1f4c12fce1ee58e670f9c3fce46c40296ba9ee8a2Ian Hodson 25b6dc79427b8f7eeb6a7ff68034ab8548ce670eaAlexander Gutkin# libtool (GNU libtool) 2.4.2 3f4c12fce1ee58e670f9c3fce46c40296ba9ee8a2Ian Hodson# Written by Gordon Matzigkeit <gord@gnu.ai.mit.edu>, 1996 4f4c12fce1ee58e670f9c3fce46c40296ba9ee8a2Ian Hodson 55b6dc79427b8f7eeb6a7ff68034ab8548ce670eaAlexander Gutkin# Copyright (C) 1996, 1997, 1998, 1999, 2000, 2001, 2003, 2004, 2005, 2006, 65b6dc79427b8f7eeb6a7ff68034ab8548ce670eaAlexander Gutkin# 2007, 2008, 2009, 2010, 2011 Free Software Foundation, Inc. 7f4c12fce1ee58e670f9c3fce46c40296ba9ee8a2Ian Hodson# This is free software; see the source for copying conditions. There is NO 8f4c12fce1ee58e670f9c3fce46c40296ba9ee8a2Ian Hodson# warranty; not even for MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. 9f4c12fce1ee58e670f9c3fce46c40296ba9ee8a2Ian Hodson 10f4c12fce1ee58e670f9c3fce46c40296ba9ee8a2Ian Hodson# GNU Libtool is free software; you can redistribute it and/or modify 11f4c12fce1ee58e670f9c3fce46c40296ba9ee8a2Ian Hodson# it under the terms of the GNU General Public License as published by 12f4c12fce1ee58e670f9c3fce46c40296ba9ee8a2Ian Hodson# the Free Software Foundation; either version 2 of the License, or 13f4c12fce1ee58e670f9c3fce46c40296ba9ee8a2Ian Hodson# (at your option) any later version. 14f4c12fce1ee58e670f9c3fce46c40296ba9ee8a2Ian Hodson# 15f4c12fce1ee58e670f9c3fce46c40296ba9ee8a2Ian Hodson# As a special exception to the GNU General Public License, 16f4c12fce1ee58e670f9c3fce46c40296ba9ee8a2Ian Hodson# if you distribute this file as part of a program or library that 17f4c12fce1ee58e670f9c3fce46c40296ba9ee8a2Ian Hodson# is built using GNU Libtool, you may include this file under the 18f4c12fce1ee58e670f9c3fce46c40296ba9ee8a2Ian Hodson# same distribution terms that you use for the rest of that program. 19f4c12fce1ee58e670f9c3fce46c40296ba9ee8a2Ian Hodson# 20f4c12fce1ee58e670f9c3fce46c40296ba9ee8a2Ian Hodson# GNU Libtool is distributed in the hope that it will be useful, but 21f4c12fce1ee58e670f9c3fce46c40296ba9ee8a2Ian Hodson# WITHOUT ANY WARRANTY; without even the implied warranty of 22f4c12fce1ee58e670f9c3fce46c40296ba9ee8a2Ian Hodson# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU 23f4c12fce1ee58e670f9c3fce46c40296ba9ee8a2Ian Hodson# General Public License for more details. 24f4c12fce1ee58e670f9c3fce46c40296ba9ee8a2Ian Hodson# 25f4c12fce1ee58e670f9c3fce46c40296ba9ee8a2Ian Hodson# You should have received a copy of the GNU General Public License 26f4c12fce1ee58e670f9c3fce46c40296ba9ee8a2Ian Hodson# along with GNU Libtool; see the file COPYING. If not, a copy 27f4c12fce1ee58e670f9c3fce46c40296ba9ee8a2Ian Hodson# can be downloaded from http://www.gnu.org/licenses/gpl.html, 28f4c12fce1ee58e670f9c3fce46c40296ba9ee8a2Ian Hodson# or obtained by writing to the Free Software Foundation, Inc., 29f4c12fce1ee58e670f9c3fce46c40296ba9ee8a2Ian Hodson# 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. 30f4c12fce1ee58e670f9c3fce46c40296ba9ee8a2Ian Hodson 31f4c12fce1ee58e670f9c3fce46c40296ba9ee8a2Ian Hodson# Usage: $progname [OPTION]... [MODE-ARG]... 32f4c12fce1ee58e670f9c3fce46c40296ba9ee8a2Ian Hodson# 33f4c12fce1ee58e670f9c3fce46c40296ba9ee8a2Ian Hodson# Provide generalized library-building support services. 34f4c12fce1ee58e670f9c3fce46c40296ba9ee8a2Ian Hodson# 355b6dc79427b8f7eeb6a7ff68034ab8548ce670eaAlexander Gutkin# --config show all configuration variables 365b6dc79427b8f7eeb6a7ff68034ab8548ce670eaAlexander Gutkin# --debug enable verbose shell tracing 375b6dc79427b8f7eeb6a7ff68034ab8548ce670eaAlexander Gutkin# -n, --dry-run display commands without modifying any files 385b6dc79427b8f7eeb6a7ff68034ab8548ce670eaAlexander Gutkin# --features display basic configuration information and exit 395b6dc79427b8f7eeb6a7ff68034ab8548ce670eaAlexander Gutkin# --mode=MODE use operation mode MODE 405b6dc79427b8f7eeb6a7ff68034ab8548ce670eaAlexander Gutkin# --preserve-dup-deps don't remove duplicate dependency libraries 415b6dc79427b8f7eeb6a7ff68034ab8548ce670eaAlexander Gutkin# --quiet, --silent don't print informational messages 425b6dc79427b8f7eeb6a7ff68034ab8548ce670eaAlexander Gutkin# --no-quiet, --no-silent 435b6dc79427b8f7eeb6a7ff68034ab8548ce670eaAlexander Gutkin# print informational messages (default) 445b6dc79427b8f7eeb6a7ff68034ab8548ce670eaAlexander Gutkin# --no-warn don't display warning messages 455b6dc79427b8f7eeb6a7ff68034ab8548ce670eaAlexander Gutkin# --tag=TAG use configuration variables from tag TAG 465b6dc79427b8f7eeb6a7ff68034ab8548ce670eaAlexander Gutkin# -v, --verbose print more informational messages than default 475b6dc79427b8f7eeb6a7ff68034ab8548ce670eaAlexander Gutkin# --no-verbose don't print the extra informational messages 485b6dc79427b8f7eeb6a7ff68034ab8548ce670eaAlexander Gutkin# --version print version information 495b6dc79427b8f7eeb6a7ff68034ab8548ce670eaAlexander Gutkin# -h, --help, --help-all print short, long, or detailed help message 50f4c12fce1ee58e670f9c3fce46c40296ba9ee8a2Ian Hodson# 51f4c12fce1ee58e670f9c3fce46c40296ba9ee8a2Ian Hodson# MODE must be one of the following: 52f4c12fce1ee58e670f9c3fce46c40296ba9ee8a2Ian Hodson# 535b6dc79427b8f7eeb6a7ff68034ab8548ce670eaAlexander Gutkin# clean remove files from the build directory 545b6dc79427b8f7eeb6a7ff68034ab8548ce670eaAlexander Gutkin# compile compile a source file into a libtool object 555b6dc79427b8f7eeb6a7ff68034ab8548ce670eaAlexander Gutkin# execute automatically set library path, then run a program 565b6dc79427b8f7eeb6a7ff68034ab8548ce670eaAlexander Gutkin# finish complete the installation of libtool libraries 575b6dc79427b8f7eeb6a7ff68034ab8548ce670eaAlexander Gutkin# install install libraries or executables 585b6dc79427b8f7eeb6a7ff68034ab8548ce670eaAlexander Gutkin# link create a library or an executable 595b6dc79427b8f7eeb6a7ff68034ab8548ce670eaAlexander Gutkin# uninstall remove libraries from an installed directory 60f4c12fce1ee58e670f9c3fce46c40296ba9ee8a2Ian Hodson# 615b6dc79427b8f7eeb6a7ff68034ab8548ce670eaAlexander Gutkin# MODE-ARGS vary depending on the MODE. When passed as first option, 625b6dc79427b8f7eeb6a7ff68034ab8548ce670eaAlexander Gutkin# `--mode=MODE' may be abbreviated as `MODE' or a unique abbreviation of that. 63f4c12fce1ee58e670f9c3fce46c40296ba9ee8a2Ian Hodson# Try `$progname --help --mode=MODE' for a more detailed description of MODE. 64f4c12fce1ee58e670f9c3fce46c40296ba9ee8a2Ian Hodson# 65f4c12fce1ee58e670f9c3fce46c40296ba9ee8a2Ian Hodson# When reporting a bug, please describe a test case to reproduce it and 66f4c12fce1ee58e670f9c3fce46c40296ba9ee8a2Ian Hodson# include the following information: 67f4c12fce1ee58e670f9c3fce46c40296ba9ee8a2Ian Hodson# 685b6dc79427b8f7eeb6a7ff68034ab8548ce670eaAlexander Gutkin# host-triplet: $host 695b6dc79427b8f7eeb6a7ff68034ab8548ce670eaAlexander Gutkin# shell: $SHELL 705b6dc79427b8f7eeb6a7ff68034ab8548ce670eaAlexander Gutkin# compiler: $LTCC 715b6dc79427b8f7eeb6a7ff68034ab8548ce670eaAlexander Gutkin# compiler flags: $LTCFLAGS 725b6dc79427b8f7eeb6a7ff68034ab8548ce670eaAlexander Gutkin# linker: $LD (gnu? $with_gnu_ld) 735b6dc79427b8f7eeb6a7ff68034ab8548ce670eaAlexander Gutkin# $progname: (GNU libtool) 2.4.2 Debian-2.4.2-1ubuntu1 745b6dc79427b8f7eeb6a7ff68034ab8548ce670eaAlexander Gutkin# automake: $automake_version 755b6dc79427b8f7eeb6a7ff68034ab8548ce670eaAlexander Gutkin# autoconf: $autoconf_version 76f4c12fce1ee58e670f9c3fce46c40296ba9ee8a2Ian Hodson# 77f4c12fce1ee58e670f9c3fce46c40296ba9ee8a2Ian Hodson# Report bugs to <bug-libtool@gnu.org>. 785b6dc79427b8f7eeb6a7ff68034ab8548ce670eaAlexander Gutkin# GNU libtool home page: <http://www.gnu.org/software/libtool/>. 795b6dc79427b8f7eeb6a7ff68034ab8548ce670eaAlexander Gutkin# General help using GNU software: <http://www.gnu.org/gethelp/>. 80f4c12fce1ee58e670f9c3fce46c40296ba9ee8a2Ian Hodson 815b6dc79427b8f7eeb6a7ff68034ab8548ce670eaAlexander GutkinPROGRAM=libtool 82f4c12fce1ee58e670f9c3fce46c40296ba9ee8a2Ian HodsonPACKAGE=libtool 835b6dc79427b8f7eeb6a7ff68034ab8548ce670eaAlexander GutkinVERSION="2.4.2 Debian-2.4.2-1ubuntu1" 84f4c12fce1ee58e670f9c3fce46c40296ba9ee8a2Ian HodsonTIMESTAMP="" 855b6dc79427b8f7eeb6a7ff68034ab8548ce670eaAlexander Gutkinpackage_revision=1.3337 86f4c12fce1ee58e670f9c3fce46c40296ba9ee8a2Ian Hodson 87f4c12fce1ee58e670f9c3fce46c40296ba9ee8a2Ian Hodson# Be Bourne compatible 88f4c12fce1ee58e670f9c3fce46c40296ba9ee8a2Ian Hodsonif test -n "${ZSH_VERSION+set}" && (emulate sh) >/dev/null 2>&1; then 89f4c12fce1ee58e670f9c3fce46c40296ba9ee8a2Ian Hodson emulate sh 90f4c12fce1ee58e670f9c3fce46c40296ba9ee8a2Ian Hodson NULLCMD=: 91f4c12fce1ee58e670f9c3fce46c40296ba9ee8a2Ian Hodson # Zsh 3.x and 4.x performs word splitting on ${1+"$@"}, which 92f4c12fce1ee58e670f9c3fce46c40296ba9ee8a2Ian Hodson # is contrary to our usage. Disable this feature. 93f4c12fce1ee58e670f9c3fce46c40296ba9ee8a2Ian Hodson alias -g '${1+"$@"}'='"$@"' 94f4c12fce1ee58e670f9c3fce46c40296ba9ee8a2Ian Hodson setopt NO_GLOB_SUBST 95f4c12fce1ee58e670f9c3fce46c40296ba9ee8a2Ian Hodsonelse 96f4c12fce1ee58e670f9c3fce46c40296ba9ee8a2Ian Hodson case `(set -o) 2>/dev/null` in *posix*) set -o posix;; esac 97f4c12fce1ee58e670f9c3fce46c40296ba9ee8a2Ian Hodsonfi 98f4c12fce1ee58e670f9c3fce46c40296ba9ee8a2Ian HodsonBIN_SH=xpg4; export BIN_SH # for Tru64 99f4c12fce1ee58e670f9c3fce46c40296ba9ee8a2Ian HodsonDUALCASE=1; export DUALCASE # for MKS sh 100f4c12fce1ee58e670f9c3fce46c40296ba9ee8a2Ian Hodson 1015b6dc79427b8f7eeb6a7ff68034ab8548ce670eaAlexander Gutkin# A function that is used when there is no print builtin or printf. 1025b6dc79427b8f7eeb6a7ff68034ab8548ce670eaAlexander Gutkinfunc_fallback_echo () 1035b6dc79427b8f7eeb6a7ff68034ab8548ce670eaAlexander Gutkin{ 1045b6dc79427b8f7eeb6a7ff68034ab8548ce670eaAlexander Gutkin eval 'cat <<_LTECHO_EOF 1055b6dc79427b8f7eeb6a7ff68034ab8548ce670eaAlexander Gutkin$1 1065b6dc79427b8f7eeb6a7ff68034ab8548ce670eaAlexander Gutkin_LTECHO_EOF' 1075b6dc79427b8f7eeb6a7ff68034ab8548ce670eaAlexander Gutkin} 1085b6dc79427b8f7eeb6a7ff68034ab8548ce670eaAlexander Gutkin 109f4c12fce1ee58e670f9c3fce46c40296ba9ee8a2Ian Hodson# NLS nuisances: We save the old values to restore during execute mode. 110f4c12fce1ee58e670f9c3fce46c40296ba9ee8a2Ian Hodsonlt_user_locale= 111f4c12fce1ee58e670f9c3fce46c40296ba9ee8a2Ian Hodsonlt_safe_locale= 112f4c12fce1ee58e670f9c3fce46c40296ba9ee8a2Ian Hodsonfor lt_var in LANG LANGUAGE LC_ALL LC_CTYPE LC_COLLATE LC_MESSAGES 113f4c12fce1ee58e670f9c3fce46c40296ba9ee8a2Ian Hodsondo 114f4c12fce1ee58e670f9c3fce46c40296ba9ee8a2Ian Hodson eval "if test \"\${$lt_var+set}\" = set; then 115f4c12fce1ee58e670f9c3fce46c40296ba9ee8a2Ian Hodson save_$lt_var=\$$lt_var 116f4c12fce1ee58e670f9c3fce46c40296ba9ee8a2Ian Hodson $lt_var=C 117f4c12fce1ee58e670f9c3fce46c40296ba9ee8a2Ian Hodson export $lt_var 118f4c12fce1ee58e670f9c3fce46c40296ba9ee8a2Ian Hodson lt_user_locale=\"$lt_var=\\\$save_\$lt_var; \$lt_user_locale\" 119f4c12fce1ee58e670f9c3fce46c40296ba9ee8a2Ian Hodson lt_safe_locale=\"$lt_var=C; \$lt_safe_locale\" 120f4c12fce1ee58e670f9c3fce46c40296ba9ee8a2Ian Hodson fi" 121f4c12fce1ee58e670f9c3fce46c40296ba9ee8a2Ian Hodsondone 1225b6dc79427b8f7eeb6a7ff68034ab8548ce670eaAlexander GutkinLC_ALL=C 1235b6dc79427b8f7eeb6a7ff68034ab8548ce670eaAlexander GutkinLANGUAGE=C 1245b6dc79427b8f7eeb6a7ff68034ab8548ce670eaAlexander Gutkinexport LANGUAGE LC_ALL 125f4c12fce1ee58e670f9c3fce46c40296ba9ee8a2Ian Hodson 126f4c12fce1ee58e670f9c3fce46c40296ba9ee8a2Ian Hodson$lt_unset CDPATH 127f4c12fce1ee58e670f9c3fce46c40296ba9ee8a2Ian Hodson 128f4c12fce1ee58e670f9c3fce46c40296ba9ee8a2Ian Hodson 1295b6dc79427b8f7eeb6a7ff68034ab8548ce670eaAlexander Gutkin# Work around backward compatibility issue on IRIX 6.5. On IRIX 6.4+, sh 1305b6dc79427b8f7eeb6a7ff68034ab8548ce670eaAlexander Gutkin# is ksh but when the shell is invoked as "sh" and the current value of 1315b6dc79427b8f7eeb6a7ff68034ab8548ce670eaAlexander Gutkin# the _XPG environment variable is not equal to 1 (one), the special 1325b6dc79427b8f7eeb6a7ff68034ab8548ce670eaAlexander Gutkin# positional parameter $0, within a function call, is the name of the 1335b6dc79427b8f7eeb6a7ff68034ab8548ce670eaAlexander Gutkin# function. 1345b6dc79427b8f7eeb6a7ff68034ab8548ce670eaAlexander Gutkinprogpath="$0" 135f4c12fce1ee58e670f9c3fce46c40296ba9ee8a2Ian Hodson 136f4c12fce1ee58e670f9c3fce46c40296ba9ee8a2Ian Hodson 137f4c12fce1ee58e670f9c3fce46c40296ba9ee8a2Ian Hodson 138f4c12fce1ee58e670f9c3fce46c40296ba9ee8a2Ian Hodson: ${CP="cp -f"} 1395b6dc79427b8f7eeb6a7ff68034ab8548ce670eaAlexander Gutkintest "${ECHO+set}" = set || ECHO=${as_echo-'printf %s\n'} 140f4c12fce1ee58e670f9c3fce46c40296ba9ee8a2Ian Hodson: ${MAKE="make"} 141f4c12fce1ee58e670f9c3fce46c40296ba9ee8a2Ian Hodson: ${MKDIR="mkdir"} 142f4c12fce1ee58e670f9c3fce46c40296ba9ee8a2Ian Hodson: ${MV="mv -f"} 143f4c12fce1ee58e670f9c3fce46c40296ba9ee8a2Ian Hodson: ${RM="rm -f"} 144f4c12fce1ee58e670f9c3fce46c40296ba9ee8a2Ian Hodson: ${SHELL="${CONFIG_SHELL-/bin/sh}"} 145f4c12fce1ee58e670f9c3fce46c40296ba9ee8a2Ian Hodson: ${Xsed="$SED -e 1s/^X//"} 146f4c12fce1ee58e670f9c3fce46c40296ba9ee8a2Ian Hodson 147f4c12fce1ee58e670f9c3fce46c40296ba9ee8a2Ian Hodson# Global variables: 148f4c12fce1ee58e670f9c3fce46c40296ba9ee8a2Ian HodsonEXIT_SUCCESS=0 149f4c12fce1ee58e670f9c3fce46c40296ba9ee8a2Ian HodsonEXIT_FAILURE=1 150f4c12fce1ee58e670f9c3fce46c40296ba9ee8a2Ian HodsonEXIT_MISMATCH=63 # $? = 63 is used to indicate version mismatch to missing. 151f4c12fce1ee58e670f9c3fce46c40296ba9ee8a2Ian HodsonEXIT_SKIP=77 # $? = 77 is used to indicate a skipped test to automake. 152f4c12fce1ee58e670f9c3fce46c40296ba9ee8a2Ian Hodson 153f4c12fce1ee58e670f9c3fce46c40296ba9ee8a2Ian Hodsonexit_status=$EXIT_SUCCESS 154f4c12fce1ee58e670f9c3fce46c40296ba9ee8a2Ian Hodson 155f4c12fce1ee58e670f9c3fce46c40296ba9ee8a2Ian Hodson# Make sure IFS has a sensible default 156f4c12fce1ee58e670f9c3fce46c40296ba9ee8a2Ian Hodsonlt_nl=' 157f4c12fce1ee58e670f9c3fce46c40296ba9ee8a2Ian Hodson' 158f4c12fce1ee58e670f9c3fce46c40296ba9ee8a2Ian HodsonIFS=" $lt_nl" 159f4c12fce1ee58e670f9c3fce46c40296ba9ee8a2Ian Hodson 160f4c12fce1ee58e670f9c3fce46c40296ba9ee8a2Ian Hodsondirname="s,/[^/]*$,," 161f4c12fce1ee58e670f9c3fce46c40296ba9ee8a2Ian Hodsonbasename="s,^.*/,," 162f4c12fce1ee58e670f9c3fce46c40296ba9ee8a2Ian Hodson 1635b6dc79427b8f7eeb6a7ff68034ab8548ce670eaAlexander Gutkin# func_dirname file append nondir_replacement 1645b6dc79427b8f7eeb6a7ff68034ab8548ce670eaAlexander Gutkin# Compute the dirname of FILE. If nonempty, add APPEND to the result, 1655b6dc79427b8f7eeb6a7ff68034ab8548ce670eaAlexander Gutkin# otherwise set result to NONDIR_REPLACEMENT. 1665b6dc79427b8f7eeb6a7ff68034ab8548ce670eaAlexander Gutkinfunc_dirname () 1675b6dc79427b8f7eeb6a7ff68034ab8548ce670eaAlexander Gutkin{ 1685b6dc79427b8f7eeb6a7ff68034ab8548ce670eaAlexander Gutkin func_dirname_result=`$ECHO "${1}" | $SED "$dirname"` 1695b6dc79427b8f7eeb6a7ff68034ab8548ce670eaAlexander Gutkin if test "X$func_dirname_result" = "X${1}"; then 1705b6dc79427b8f7eeb6a7ff68034ab8548ce670eaAlexander Gutkin func_dirname_result="${3}" 1715b6dc79427b8f7eeb6a7ff68034ab8548ce670eaAlexander Gutkin else 1725b6dc79427b8f7eeb6a7ff68034ab8548ce670eaAlexander Gutkin func_dirname_result="$func_dirname_result${2}" 1735b6dc79427b8f7eeb6a7ff68034ab8548ce670eaAlexander Gutkin fi 1745b6dc79427b8f7eeb6a7ff68034ab8548ce670eaAlexander Gutkin} # func_dirname may be replaced by extended shell implementation 1755b6dc79427b8f7eeb6a7ff68034ab8548ce670eaAlexander Gutkin 1765b6dc79427b8f7eeb6a7ff68034ab8548ce670eaAlexander Gutkin 1775b6dc79427b8f7eeb6a7ff68034ab8548ce670eaAlexander Gutkin# func_basename file 1785b6dc79427b8f7eeb6a7ff68034ab8548ce670eaAlexander Gutkinfunc_basename () 1795b6dc79427b8f7eeb6a7ff68034ab8548ce670eaAlexander Gutkin{ 1805b6dc79427b8f7eeb6a7ff68034ab8548ce670eaAlexander Gutkin func_basename_result=`$ECHO "${1}" | $SED "$basename"` 1815b6dc79427b8f7eeb6a7ff68034ab8548ce670eaAlexander Gutkin} # func_basename may be replaced by extended shell implementation 1825b6dc79427b8f7eeb6a7ff68034ab8548ce670eaAlexander Gutkin 1835b6dc79427b8f7eeb6a7ff68034ab8548ce670eaAlexander Gutkin 184f4c12fce1ee58e670f9c3fce46c40296ba9ee8a2Ian Hodson# func_dirname_and_basename file append nondir_replacement 185f4c12fce1ee58e670f9c3fce46c40296ba9ee8a2Ian Hodson# perform func_basename and func_dirname in a single function 186f4c12fce1ee58e670f9c3fce46c40296ba9ee8a2Ian Hodson# call: 187f4c12fce1ee58e670f9c3fce46c40296ba9ee8a2Ian Hodson# dirname: Compute the dirname of FILE. If nonempty, 188f4c12fce1ee58e670f9c3fce46c40296ba9ee8a2Ian Hodson# add APPEND to the result, otherwise set result 189f4c12fce1ee58e670f9c3fce46c40296ba9ee8a2Ian Hodson# to NONDIR_REPLACEMENT. 190f4c12fce1ee58e670f9c3fce46c40296ba9ee8a2Ian Hodson# value returned in "$func_dirname_result" 191f4c12fce1ee58e670f9c3fce46c40296ba9ee8a2Ian Hodson# basename: Compute filename of FILE. 192f4c12fce1ee58e670f9c3fce46c40296ba9ee8a2Ian Hodson# value retuned in "$func_basename_result" 193f4c12fce1ee58e670f9c3fce46c40296ba9ee8a2Ian Hodson# Implementation must be kept synchronized with func_dirname 194f4c12fce1ee58e670f9c3fce46c40296ba9ee8a2Ian Hodson# and func_basename. For efficiency, we do not delegate to 195f4c12fce1ee58e670f9c3fce46c40296ba9ee8a2Ian Hodson# those functions but instead duplicate the functionality here. 196f4c12fce1ee58e670f9c3fce46c40296ba9ee8a2Ian Hodsonfunc_dirname_and_basename () 197f4c12fce1ee58e670f9c3fce46c40296ba9ee8a2Ian Hodson{ 1985b6dc79427b8f7eeb6a7ff68034ab8548ce670eaAlexander Gutkin # Extract subdirectory from the argument. 1995b6dc79427b8f7eeb6a7ff68034ab8548ce670eaAlexander Gutkin func_dirname_result=`$ECHO "${1}" | $SED -e "$dirname"` 2005b6dc79427b8f7eeb6a7ff68034ab8548ce670eaAlexander Gutkin if test "X$func_dirname_result" = "X${1}"; then 2015b6dc79427b8f7eeb6a7ff68034ab8548ce670eaAlexander Gutkin func_dirname_result="${3}" 2025b6dc79427b8f7eeb6a7ff68034ab8548ce670eaAlexander Gutkin else 2035b6dc79427b8f7eeb6a7ff68034ab8548ce670eaAlexander Gutkin func_dirname_result="$func_dirname_result${2}" 2045b6dc79427b8f7eeb6a7ff68034ab8548ce670eaAlexander Gutkin fi 2055b6dc79427b8f7eeb6a7ff68034ab8548ce670eaAlexander Gutkin func_basename_result=`$ECHO "${1}" | $SED -e "$basename"` 2065b6dc79427b8f7eeb6a7ff68034ab8548ce670eaAlexander Gutkin} # func_dirname_and_basename may be replaced by extended shell implementation 2075b6dc79427b8f7eeb6a7ff68034ab8548ce670eaAlexander Gutkin 2085b6dc79427b8f7eeb6a7ff68034ab8548ce670eaAlexander Gutkin 2095b6dc79427b8f7eeb6a7ff68034ab8548ce670eaAlexander Gutkin# func_stripname prefix suffix name 2105b6dc79427b8f7eeb6a7ff68034ab8548ce670eaAlexander Gutkin# strip PREFIX and SUFFIX off of NAME. 2115b6dc79427b8f7eeb6a7ff68034ab8548ce670eaAlexander Gutkin# PREFIX and SUFFIX must not contain globbing or regex special 2125b6dc79427b8f7eeb6a7ff68034ab8548ce670eaAlexander Gutkin# characters, hashes, percent signs, but SUFFIX may contain a leading 2135b6dc79427b8f7eeb6a7ff68034ab8548ce670eaAlexander Gutkin# dot (in which case that matches only a dot). 2145b6dc79427b8f7eeb6a7ff68034ab8548ce670eaAlexander Gutkin# func_strip_suffix prefix name 2155b6dc79427b8f7eeb6a7ff68034ab8548ce670eaAlexander Gutkinfunc_stripname () 2165b6dc79427b8f7eeb6a7ff68034ab8548ce670eaAlexander Gutkin{ 2175b6dc79427b8f7eeb6a7ff68034ab8548ce670eaAlexander Gutkin case ${2} in 2185b6dc79427b8f7eeb6a7ff68034ab8548ce670eaAlexander Gutkin .*) func_stripname_result=`$ECHO "${3}" | $SED "s%^${1}%%; s%\\\\${2}\$%%"`;; 2195b6dc79427b8f7eeb6a7ff68034ab8548ce670eaAlexander Gutkin *) func_stripname_result=`$ECHO "${3}" | $SED "s%^${1}%%; s%${2}\$%%"`;; 2205b6dc79427b8f7eeb6a7ff68034ab8548ce670eaAlexander Gutkin esac 2215b6dc79427b8f7eeb6a7ff68034ab8548ce670eaAlexander Gutkin} # func_stripname may be replaced by extended shell implementation 2225b6dc79427b8f7eeb6a7ff68034ab8548ce670eaAlexander Gutkin 2235b6dc79427b8f7eeb6a7ff68034ab8548ce670eaAlexander Gutkin 2245b6dc79427b8f7eeb6a7ff68034ab8548ce670eaAlexander Gutkin# These SED scripts presuppose an absolute path with a trailing slash. 2255b6dc79427b8f7eeb6a7ff68034ab8548ce670eaAlexander Gutkinpathcar='s,^/\([^/]*\).*$,\1,' 2265b6dc79427b8f7eeb6a7ff68034ab8548ce670eaAlexander Gutkinpathcdr='s,^/[^/]*,,' 2275b6dc79427b8f7eeb6a7ff68034ab8548ce670eaAlexander Gutkinremovedotparts=':dotsl 2285b6dc79427b8f7eeb6a7ff68034ab8548ce670eaAlexander Gutkin s@/\./@/@g 2295b6dc79427b8f7eeb6a7ff68034ab8548ce670eaAlexander Gutkin t dotsl 2305b6dc79427b8f7eeb6a7ff68034ab8548ce670eaAlexander Gutkin s,/\.$,/,' 2315b6dc79427b8f7eeb6a7ff68034ab8548ce670eaAlexander Gutkincollapseslashes='s@/\{1,\}@/@g' 2325b6dc79427b8f7eeb6a7ff68034ab8548ce670eaAlexander Gutkinfinalslash='s,/*$,/,' 2335b6dc79427b8f7eeb6a7ff68034ab8548ce670eaAlexander Gutkin 2345b6dc79427b8f7eeb6a7ff68034ab8548ce670eaAlexander Gutkin# func_normal_abspath PATH 2355b6dc79427b8f7eeb6a7ff68034ab8548ce670eaAlexander Gutkin# Remove doubled-up and trailing slashes, "." path components, 2365b6dc79427b8f7eeb6a7ff68034ab8548ce670eaAlexander Gutkin# and cancel out any ".." path components in PATH after making 2375b6dc79427b8f7eeb6a7ff68034ab8548ce670eaAlexander Gutkin# it an absolute path. 2385b6dc79427b8f7eeb6a7ff68034ab8548ce670eaAlexander Gutkin# value returned in "$func_normal_abspath_result" 2395b6dc79427b8f7eeb6a7ff68034ab8548ce670eaAlexander Gutkinfunc_normal_abspath () 2405b6dc79427b8f7eeb6a7ff68034ab8548ce670eaAlexander Gutkin{ 2415b6dc79427b8f7eeb6a7ff68034ab8548ce670eaAlexander Gutkin # Start from root dir and reassemble the path. 2425b6dc79427b8f7eeb6a7ff68034ab8548ce670eaAlexander Gutkin func_normal_abspath_result= 2435b6dc79427b8f7eeb6a7ff68034ab8548ce670eaAlexander Gutkin func_normal_abspath_tpath=$1 2445b6dc79427b8f7eeb6a7ff68034ab8548ce670eaAlexander Gutkin func_normal_abspath_altnamespace= 2455b6dc79427b8f7eeb6a7ff68034ab8548ce670eaAlexander Gutkin case $func_normal_abspath_tpath in 2465b6dc79427b8f7eeb6a7ff68034ab8548ce670eaAlexander Gutkin "") 2475b6dc79427b8f7eeb6a7ff68034ab8548ce670eaAlexander Gutkin # Empty path, that just means $cwd. 2485b6dc79427b8f7eeb6a7ff68034ab8548ce670eaAlexander Gutkin func_stripname '' '/' "`pwd`" 2495b6dc79427b8f7eeb6a7ff68034ab8548ce670eaAlexander Gutkin func_normal_abspath_result=$func_stripname_result 2505b6dc79427b8f7eeb6a7ff68034ab8548ce670eaAlexander Gutkin return 2515b6dc79427b8f7eeb6a7ff68034ab8548ce670eaAlexander Gutkin ;; 2525b6dc79427b8f7eeb6a7ff68034ab8548ce670eaAlexander Gutkin # The next three entries are used to spot a run of precisely 2535b6dc79427b8f7eeb6a7ff68034ab8548ce670eaAlexander Gutkin # two leading slashes without using negated character classes; 2545b6dc79427b8f7eeb6a7ff68034ab8548ce670eaAlexander Gutkin # we take advantage of case's first-match behaviour. 2555b6dc79427b8f7eeb6a7ff68034ab8548ce670eaAlexander Gutkin ///*) 2565b6dc79427b8f7eeb6a7ff68034ab8548ce670eaAlexander Gutkin # Unusual form of absolute path, do nothing. 2575b6dc79427b8f7eeb6a7ff68034ab8548ce670eaAlexander Gutkin ;; 2585b6dc79427b8f7eeb6a7ff68034ab8548ce670eaAlexander Gutkin //*) 2595b6dc79427b8f7eeb6a7ff68034ab8548ce670eaAlexander Gutkin # Not necessarily an ordinary path; POSIX reserves leading '//' 2605b6dc79427b8f7eeb6a7ff68034ab8548ce670eaAlexander Gutkin # and for example Cygwin uses it to access remote file shares 2615b6dc79427b8f7eeb6a7ff68034ab8548ce670eaAlexander Gutkin # over CIFS/SMB, so we conserve a leading double slash if found. 2625b6dc79427b8f7eeb6a7ff68034ab8548ce670eaAlexander Gutkin func_normal_abspath_altnamespace=/ 2635b6dc79427b8f7eeb6a7ff68034ab8548ce670eaAlexander Gutkin ;; 2645b6dc79427b8f7eeb6a7ff68034ab8548ce670eaAlexander Gutkin /*) 2655b6dc79427b8f7eeb6a7ff68034ab8548ce670eaAlexander Gutkin # Absolute path, do nothing. 2665b6dc79427b8f7eeb6a7ff68034ab8548ce670eaAlexander Gutkin ;; 2675b6dc79427b8f7eeb6a7ff68034ab8548ce670eaAlexander Gutkin *) 2685b6dc79427b8f7eeb6a7ff68034ab8548ce670eaAlexander Gutkin # Relative path, prepend $cwd. 2695b6dc79427b8f7eeb6a7ff68034ab8548ce670eaAlexander Gutkin func_normal_abspath_tpath=`pwd`/$func_normal_abspath_tpath 2705b6dc79427b8f7eeb6a7ff68034ab8548ce670eaAlexander Gutkin ;; 2715b6dc79427b8f7eeb6a7ff68034ab8548ce670eaAlexander Gutkin esac 2725b6dc79427b8f7eeb6a7ff68034ab8548ce670eaAlexander Gutkin # Cancel out all the simple stuff to save iterations. We also want 2735b6dc79427b8f7eeb6a7ff68034ab8548ce670eaAlexander Gutkin # the path to end with a slash for ease of parsing, so make sure 2745b6dc79427b8f7eeb6a7ff68034ab8548ce670eaAlexander Gutkin # there is one (and only one) here. 2755b6dc79427b8f7eeb6a7ff68034ab8548ce670eaAlexander Gutkin func_normal_abspath_tpath=`$ECHO "$func_normal_abspath_tpath" | $SED \ 2765b6dc79427b8f7eeb6a7ff68034ab8548ce670eaAlexander Gutkin -e "$removedotparts" -e "$collapseslashes" -e "$finalslash"` 2775b6dc79427b8f7eeb6a7ff68034ab8548ce670eaAlexander Gutkin while :; do 2785b6dc79427b8f7eeb6a7ff68034ab8548ce670eaAlexander Gutkin # Processed it all yet? 2795b6dc79427b8f7eeb6a7ff68034ab8548ce670eaAlexander Gutkin if test "$func_normal_abspath_tpath" = / ; then 2805b6dc79427b8f7eeb6a7ff68034ab8548ce670eaAlexander Gutkin # If we ascended to the root using ".." the result may be empty now. 2815b6dc79427b8f7eeb6a7ff68034ab8548ce670eaAlexander Gutkin if test -z "$func_normal_abspath_result" ; then 2825b6dc79427b8f7eeb6a7ff68034ab8548ce670eaAlexander Gutkin func_normal_abspath_result=/ 2835b6dc79427b8f7eeb6a7ff68034ab8548ce670eaAlexander Gutkin fi 2845b6dc79427b8f7eeb6a7ff68034ab8548ce670eaAlexander Gutkin break 2855b6dc79427b8f7eeb6a7ff68034ab8548ce670eaAlexander Gutkin fi 2865b6dc79427b8f7eeb6a7ff68034ab8548ce670eaAlexander Gutkin func_normal_abspath_tcomponent=`$ECHO "$func_normal_abspath_tpath" | $SED \ 2875b6dc79427b8f7eeb6a7ff68034ab8548ce670eaAlexander Gutkin -e "$pathcar"` 2885b6dc79427b8f7eeb6a7ff68034ab8548ce670eaAlexander Gutkin func_normal_abspath_tpath=`$ECHO "$func_normal_abspath_tpath" | $SED \ 2895b6dc79427b8f7eeb6a7ff68034ab8548ce670eaAlexander Gutkin -e "$pathcdr"` 2905b6dc79427b8f7eeb6a7ff68034ab8548ce670eaAlexander Gutkin # Figure out what to do with it 2915b6dc79427b8f7eeb6a7ff68034ab8548ce670eaAlexander Gutkin case $func_normal_abspath_tcomponent in 2925b6dc79427b8f7eeb6a7ff68034ab8548ce670eaAlexander Gutkin "") 2935b6dc79427b8f7eeb6a7ff68034ab8548ce670eaAlexander Gutkin # Trailing empty path component, ignore it. 2945b6dc79427b8f7eeb6a7ff68034ab8548ce670eaAlexander Gutkin ;; 2955b6dc79427b8f7eeb6a7ff68034ab8548ce670eaAlexander Gutkin ..) 2965b6dc79427b8f7eeb6a7ff68034ab8548ce670eaAlexander Gutkin # Parent dir; strip last assembled component from result. 2975b6dc79427b8f7eeb6a7ff68034ab8548ce670eaAlexander Gutkin func_dirname "$func_normal_abspath_result" 2985b6dc79427b8f7eeb6a7ff68034ab8548ce670eaAlexander Gutkin func_normal_abspath_result=$func_dirname_result 2995b6dc79427b8f7eeb6a7ff68034ab8548ce670eaAlexander Gutkin ;; 3005b6dc79427b8f7eeb6a7ff68034ab8548ce670eaAlexander Gutkin *) 3015b6dc79427b8f7eeb6a7ff68034ab8548ce670eaAlexander Gutkin # Actual path component, append it. 3025b6dc79427b8f7eeb6a7ff68034ab8548ce670eaAlexander Gutkin func_normal_abspath_result=$func_normal_abspath_result/$func_normal_abspath_tcomponent 3035b6dc79427b8f7eeb6a7ff68034ab8548ce670eaAlexander Gutkin ;; 3045b6dc79427b8f7eeb6a7ff68034ab8548ce670eaAlexander Gutkin esac 3055b6dc79427b8f7eeb6a7ff68034ab8548ce670eaAlexander Gutkin done 3065b6dc79427b8f7eeb6a7ff68034ab8548ce670eaAlexander Gutkin # Restore leading double-slash if one was found on entry. 3075b6dc79427b8f7eeb6a7ff68034ab8548ce670eaAlexander Gutkin func_normal_abspath_result=$func_normal_abspath_altnamespace$func_normal_abspath_result 308f4c12fce1ee58e670f9c3fce46c40296ba9ee8a2Ian Hodson} 309f4c12fce1ee58e670f9c3fce46c40296ba9ee8a2Ian Hodson 3105b6dc79427b8f7eeb6a7ff68034ab8548ce670eaAlexander Gutkin# func_relative_path SRCDIR DSTDIR 3115b6dc79427b8f7eeb6a7ff68034ab8548ce670eaAlexander Gutkin# generates a relative path from SRCDIR to DSTDIR, with a trailing 3125b6dc79427b8f7eeb6a7ff68034ab8548ce670eaAlexander Gutkin# slash if non-empty, suitable for immediately appending a filename 3135b6dc79427b8f7eeb6a7ff68034ab8548ce670eaAlexander Gutkin# without needing to append a separator. 3145b6dc79427b8f7eeb6a7ff68034ab8548ce670eaAlexander Gutkin# value returned in "$func_relative_path_result" 3155b6dc79427b8f7eeb6a7ff68034ab8548ce670eaAlexander Gutkinfunc_relative_path () 3165b6dc79427b8f7eeb6a7ff68034ab8548ce670eaAlexander Gutkin{ 3175b6dc79427b8f7eeb6a7ff68034ab8548ce670eaAlexander Gutkin func_relative_path_result= 3185b6dc79427b8f7eeb6a7ff68034ab8548ce670eaAlexander Gutkin func_normal_abspath "$1" 3195b6dc79427b8f7eeb6a7ff68034ab8548ce670eaAlexander Gutkin func_relative_path_tlibdir=$func_normal_abspath_result 3205b6dc79427b8f7eeb6a7ff68034ab8548ce670eaAlexander Gutkin func_normal_abspath "$2" 3215b6dc79427b8f7eeb6a7ff68034ab8548ce670eaAlexander Gutkin func_relative_path_tbindir=$func_normal_abspath_result 3225b6dc79427b8f7eeb6a7ff68034ab8548ce670eaAlexander Gutkin 3235b6dc79427b8f7eeb6a7ff68034ab8548ce670eaAlexander Gutkin # Ascend the tree starting from libdir 3245b6dc79427b8f7eeb6a7ff68034ab8548ce670eaAlexander Gutkin while :; do 3255b6dc79427b8f7eeb6a7ff68034ab8548ce670eaAlexander Gutkin # check if we have found a prefix of bindir 3265b6dc79427b8f7eeb6a7ff68034ab8548ce670eaAlexander Gutkin case $func_relative_path_tbindir in 3275b6dc79427b8f7eeb6a7ff68034ab8548ce670eaAlexander Gutkin $func_relative_path_tlibdir) 3285b6dc79427b8f7eeb6a7ff68034ab8548ce670eaAlexander Gutkin # found an exact match 3295b6dc79427b8f7eeb6a7ff68034ab8548ce670eaAlexander Gutkin func_relative_path_tcancelled= 3305b6dc79427b8f7eeb6a7ff68034ab8548ce670eaAlexander Gutkin break 3315b6dc79427b8f7eeb6a7ff68034ab8548ce670eaAlexander Gutkin ;; 3325b6dc79427b8f7eeb6a7ff68034ab8548ce670eaAlexander Gutkin $func_relative_path_tlibdir*) 3335b6dc79427b8f7eeb6a7ff68034ab8548ce670eaAlexander Gutkin # found a matching prefix 3345b6dc79427b8f7eeb6a7ff68034ab8548ce670eaAlexander Gutkin func_stripname "$func_relative_path_tlibdir" '' "$func_relative_path_tbindir" 3355b6dc79427b8f7eeb6a7ff68034ab8548ce670eaAlexander Gutkin func_relative_path_tcancelled=$func_stripname_result 3365b6dc79427b8f7eeb6a7ff68034ab8548ce670eaAlexander Gutkin if test -z "$func_relative_path_result"; then 3375b6dc79427b8f7eeb6a7ff68034ab8548ce670eaAlexander Gutkin func_relative_path_result=. 3385b6dc79427b8f7eeb6a7ff68034ab8548ce670eaAlexander Gutkin fi 3395b6dc79427b8f7eeb6a7ff68034ab8548ce670eaAlexander Gutkin break 3405b6dc79427b8f7eeb6a7ff68034ab8548ce670eaAlexander Gutkin ;; 3415b6dc79427b8f7eeb6a7ff68034ab8548ce670eaAlexander Gutkin *) 3425b6dc79427b8f7eeb6a7ff68034ab8548ce670eaAlexander Gutkin func_dirname $func_relative_path_tlibdir 3435b6dc79427b8f7eeb6a7ff68034ab8548ce670eaAlexander Gutkin func_relative_path_tlibdir=${func_dirname_result} 3445b6dc79427b8f7eeb6a7ff68034ab8548ce670eaAlexander Gutkin if test "x$func_relative_path_tlibdir" = x ; then 3455b6dc79427b8f7eeb6a7ff68034ab8548ce670eaAlexander Gutkin # Have to descend all the way to the root! 3465b6dc79427b8f7eeb6a7ff68034ab8548ce670eaAlexander Gutkin func_relative_path_result=../$func_relative_path_result 3475b6dc79427b8f7eeb6a7ff68034ab8548ce670eaAlexander Gutkin func_relative_path_tcancelled=$func_relative_path_tbindir 3485b6dc79427b8f7eeb6a7ff68034ab8548ce670eaAlexander Gutkin break 3495b6dc79427b8f7eeb6a7ff68034ab8548ce670eaAlexander Gutkin fi 3505b6dc79427b8f7eeb6a7ff68034ab8548ce670eaAlexander Gutkin func_relative_path_result=../$func_relative_path_result 3515b6dc79427b8f7eeb6a7ff68034ab8548ce670eaAlexander Gutkin ;; 3525b6dc79427b8f7eeb6a7ff68034ab8548ce670eaAlexander Gutkin esac 3535b6dc79427b8f7eeb6a7ff68034ab8548ce670eaAlexander Gutkin done 354f4c12fce1ee58e670f9c3fce46c40296ba9ee8a2Ian Hodson 3555b6dc79427b8f7eeb6a7ff68034ab8548ce670eaAlexander Gutkin # Now calculate path; take care to avoid doubling-up slashes. 3565b6dc79427b8f7eeb6a7ff68034ab8548ce670eaAlexander Gutkin func_stripname '' '/' "$func_relative_path_result" 3575b6dc79427b8f7eeb6a7ff68034ab8548ce670eaAlexander Gutkin func_relative_path_result=$func_stripname_result 3585b6dc79427b8f7eeb6a7ff68034ab8548ce670eaAlexander Gutkin func_stripname '/' '/' "$func_relative_path_tcancelled" 3595b6dc79427b8f7eeb6a7ff68034ab8548ce670eaAlexander Gutkin if test "x$func_stripname_result" != x ; then 3605b6dc79427b8f7eeb6a7ff68034ab8548ce670eaAlexander Gutkin func_relative_path_result=${func_relative_path_result}/${func_stripname_result} 3615b6dc79427b8f7eeb6a7ff68034ab8548ce670eaAlexander Gutkin fi 3625b6dc79427b8f7eeb6a7ff68034ab8548ce670eaAlexander Gutkin 3635b6dc79427b8f7eeb6a7ff68034ab8548ce670eaAlexander Gutkin # Normalisation. If bindir is libdir, return empty string, 3645b6dc79427b8f7eeb6a7ff68034ab8548ce670eaAlexander Gutkin # else relative path ending with a slash; either way, target 3655b6dc79427b8f7eeb6a7ff68034ab8548ce670eaAlexander Gutkin # file name can be directly appended. 3665b6dc79427b8f7eeb6a7ff68034ab8548ce670eaAlexander Gutkin if test ! -z "$func_relative_path_result"; then 3675b6dc79427b8f7eeb6a7ff68034ab8548ce670eaAlexander Gutkin func_stripname './' '' "$func_relative_path_result/" 3685b6dc79427b8f7eeb6a7ff68034ab8548ce670eaAlexander Gutkin func_relative_path_result=$func_stripname_result 3695b6dc79427b8f7eeb6a7ff68034ab8548ce670eaAlexander Gutkin fi 3705b6dc79427b8f7eeb6a7ff68034ab8548ce670eaAlexander Gutkin} 371f4c12fce1ee58e670f9c3fce46c40296ba9ee8a2Ian Hodson 372f4c12fce1ee58e670f9c3fce46c40296ba9ee8a2Ian Hodson# The name of this program: 373f4c12fce1ee58e670f9c3fce46c40296ba9ee8a2Ian Hodsonfunc_dirname_and_basename "$progpath" 374f4c12fce1ee58e670f9c3fce46c40296ba9ee8a2Ian Hodsonprogname=$func_basename_result 375f4c12fce1ee58e670f9c3fce46c40296ba9ee8a2Ian Hodson 376f4c12fce1ee58e670f9c3fce46c40296ba9ee8a2Ian Hodson# Make sure we have an absolute path for reexecution: 377f4c12fce1ee58e670f9c3fce46c40296ba9ee8a2Ian Hodsoncase $progpath in 378f4c12fce1ee58e670f9c3fce46c40296ba9ee8a2Ian Hodson [\\/]*|[A-Za-z]:\\*) ;; 379f4c12fce1ee58e670f9c3fce46c40296ba9ee8a2Ian Hodson *[\\/]*) 380f4c12fce1ee58e670f9c3fce46c40296ba9ee8a2Ian Hodson progdir=$func_dirname_result 381f4c12fce1ee58e670f9c3fce46c40296ba9ee8a2Ian Hodson progdir=`cd "$progdir" && pwd` 382f4c12fce1ee58e670f9c3fce46c40296ba9ee8a2Ian Hodson progpath="$progdir/$progname" 383f4c12fce1ee58e670f9c3fce46c40296ba9ee8a2Ian Hodson ;; 384f4c12fce1ee58e670f9c3fce46c40296ba9ee8a2Ian Hodson *) 385f4c12fce1ee58e670f9c3fce46c40296ba9ee8a2Ian Hodson save_IFS="$IFS" 3865b6dc79427b8f7eeb6a7ff68034ab8548ce670eaAlexander Gutkin IFS=${PATH_SEPARATOR-:} 387f4c12fce1ee58e670f9c3fce46c40296ba9ee8a2Ian Hodson for progdir in $PATH; do 388f4c12fce1ee58e670f9c3fce46c40296ba9ee8a2Ian Hodson IFS="$save_IFS" 389f4c12fce1ee58e670f9c3fce46c40296ba9ee8a2Ian Hodson test -x "$progdir/$progname" && break 390f4c12fce1ee58e670f9c3fce46c40296ba9ee8a2Ian Hodson done 391f4c12fce1ee58e670f9c3fce46c40296ba9ee8a2Ian Hodson IFS="$save_IFS" 392f4c12fce1ee58e670f9c3fce46c40296ba9ee8a2Ian Hodson test -n "$progdir" || progdir=`pwd` 393f4c12fce1ee58e670f9c3fce46c40296ba9ee8a2Ian Hodson progpath="$progdir/$progname" 394f4c12fce1ee58e670f9c3fce46c40296ba9ee8a2Ian Hodson ;; 395f4c12fce1ee58e670f9c3fce46c40296ba9ee8a2Ian Hodsonesac 396f4c12fce1ee58e670f9c3fce46c40296ba9ee8a2Ian Hodson 397f4c12fce1ee58e670f9c3fce46c40296ba9ee8a2Ian Hodson# Sed substitution that helps us do robust quoting. It backslashifies 398f4c12fce1ee58e670f9c3fce46c40296ba9ee8a2Ian Hodson# metacharacters that are still active within double-quoted strings. 399f4c12fce1ee58e670f9c3fce46c40296ba9ee8a2Ian HodsonXsed="${SED}"' -e 1s/^X//' 400f4c12fce1ee58e670f9c3fce46c40296ba9ee8a2Ian Hodsonsed_quote_subst='s/\([`"$\\]\)/\\\1/g' 401f4c12fce1ee58e670f9c3fce46c40296ba9ee8a2Ian Hodson 402f4c12fce1ee58e670f9c3fce46c40296ba9ee8a2Ian Hodson# Same as above, but do not quote variable references. 403f4c12fce1ee58e670f9c3fce46c40296ba9ee8a2Ian Hodsondouble_quote_subst='s/\(["`\\]\)/\\\1/g' 404f4c12fce1ee58e670f9c3fce46c40296ba9ee8a2Ian Hodson 4055b6dc79427b8f7eeb6a7ff68034ab8548ce670eaAlexander Gutkin# Sed substitution that turns a string into a regex matching for the 4065b6dc79427b8f7eeb6a7ff68034ab8548ce670eaAlexander Gutkin# string literally. 4075b6dc79427b8f7eeb6a7ff68034ab8548ce670eaAlexander Gutkinsed_make_literal_regex='s,[].[^$\\*\/],\\&,g' 4085b6dc79427b8f7eeb6a7ff68034ab8548ce670eaAlexander Gutkin 4095b6dc79427b8f7eeb6a7ff68034ab8548ce670eaAlexander Gutkin# Sed substitution that converts a w32 file name or path 4105b6dc79427b8f7eeb6a7ff68034ab8548ce670eaAlexander Gutkin# which contains forward slashes, into one that contains 4115b6dc79427b8f7eeb6a7ff68034ab8548ce670eaAlexander Gutkin# (escaped) backslashes. A very naive implementation. 4125b6dc79427b8f7eeb6a7ff68034ab8548ce670eaAlexander Gutkinlt_sed_naive_backslashify='s|\\\\*|\\|g;s|/|\\|g;s|\\|\\\\|g' 4135b6dc79427b8f7eeb6a7ff68034ab8548ce670eaAlexander Gutkin 414f4c12fce1ee58e670f9c3fce46c40296ba9ee8a2Ian Hodson# Re-`\' parameter expansions in output of double_quote_subst that were 415f4c12fce1ee58e670f9c3fce46c40296ba9ee8a2Ian Hodson# `\'-ed in input to the same. If an odd number of `\' preceded a '$' 416f4c12fce1ee58e670f9c3fce46c40296ba9ee8a2Ian Hodson# in input to double_quote_subst, that '$' was protected from expansion. 417f4c12fce1ee58e670f9c3fce46c40296ba9ee8a2Ian Hodson# Since each input `\' is now two `\'s, look for any number of runs of 418f4c12fce1ee58e670f9c3fce46c40296ba9ee8a2Ian Hodson# four `\'s followed by two `\'s and then a '$'. `\' that '$'. 419f4c12fce1ee58e670f9c3fce46c40296ba9ee8a2Ian Hodsonbs='\\' 420f4c12fce1ee58e670f9c3fce46c40296ba9ee8a2Ian Hodsonbs2='\\\\' 421f4c12fce1ee58e670f9c3fce46c40296ba9ee8a2Ian Hodsonbs4='\\\\\\\\' 422f4c12fce1ee58e670f9c3fce46c40296ba9ee8a2Ian Hodsondollar='\$' 423f4c12fce1ee58e670f9c3fce46c40296ba9ee8a2Ian Hodsonsed_double_backslash="\ 424f4c12fce1ee58e670f9c3fce46c40296ba9ee8a2Ian Hodson s/$bs4/&\\ 425f4c12fce1ee58e670f9c3fce46c40296ba9ee8a2Ian Hodson/g 426f4c12fce1ee58e670f9c3fce46c40296ba9ee8a2Ian Hodson s/^$bs2$dollar/$bs&/ 427f4c12fce1ee58e670f9c3fce46c40296ba9ee8a2Ian Hodson s/\\([^$bs]\\)$bs2$dollar/\\1$bs2$bs$dollar/g 428f4c12fce1ee58e670f9c3fce46c40296ba9ee8a2Ian Hodson s/\n//g" 429f4c12fce1ee58e670f9c3fce46c40296ba9ee8a2Ian Hodson 430f4c12fce1ee58e670f9c3fce46c40296ba9ee8a2Ian Hodson# Standard options: 431f4c12fce1ee58e670f9c3fce46c40296ba9ee8a2Ian Hodsonopt_dry_run=false 432f4c12fce1ee58e670f9c3fce46c40296ba9ee8a2Ian Hodsonopt_help=false 433f4c12fce1ee58e670f9c3fce46c40296ba9ee8a2Ian Hodsonopt_quiet=false 434f4c12fce1ee58e670f9c3fce46c40296ba9ee8a2Ian Hodsonopt_verbose=false 435f4c12fce1ee58e670f9c3fce46c40296ba9ee8a2Ian Hodsonopt_warning=: 436f4c12fce1ee58e670f9c3fce46c40296ba9ee8a2Ian Hodson 437f4c12fce1ee58e670f9c3fce46c40296ba9ee8a2Ian Hodson# func_echo arg... 438f4c12fce1ee58e670f9c3fce46c40296ba9ee8a2Ian Hodson# Echo program name prefixed message, along with the current mode 439f4c12fce1ee58e670f9c3fce46c40296ba9ee8a2Ian Hodson# name if it has been set yet. 440f4c12fce1ee58e670f9c3fce46c40296ba9ee8a2Ian Hodsonfunc_echo () 441f4c12fce1ee58e670f9c3fce46c40296ba9ee8a2Ian Hodson{ 4425b6dc79427b8f7eeb6a7ff68034ab8548ce670eaAlexander Gutkin $ECHO "$progname: ${opt_mode+$opt_mode: }$*" 443f4c12fce1ee58e670f9c3fce46c40296ba9ee8a2Ian Hodson} 444f4c12fce1ee58e670f9c3fce46c40296ba9ee8a2Ian Hodson 445f4c12fce1ee58e670f9c3fce46c40296ba9ee8a2Ian Hodson# func_verbose arg... 446f4c12fce1ee58e670f9c3fce46c40296ba9ee8a2Ian Hodson# Echo program name prefixed message in verbose mode only. 447f4c12fce1ee58e670f9c3fce46c40296ba9ee8a2Ian Hodsonfunc_verbose () 448f4c12fce1ee58e670f9c3fce46c40296ba9ee8a2Ian Hodson{ 449f4c12fce1ee58e670f9c3fce46c40296ba9ee8a2Ian Hodson $opt_verbose && func_echo ${1+"$@"} 450f4c12fce1ee58e670f9c3fce46c40296ba9ee8a2Ian Hodson 451f4c12fce1ee58e670f9c3fce46c40296ba9ee8a2Ian Hodson # A bug in bash halts the script if the last line of a function 452f4c12fce1ee58e670f9c3fce46c40296ba9ee8a2Ian Hodson # fails when set -e is in force, so we need another command to 453f4c12fce1ee58e670f9c3fce46c40296ba9ee8a2Ian Hodson # work around that: 454f4c12fce1ee58e670f9c3fce46c40296ba9ee8a2Ian Hodson : 455f4c12fce1ee58e670f9c3fce46c40296ba9ee8a2Ian Hodson} 456f4c12fce1ee58e670f9c3fce46c40296ba9ee8a2Ian Hodson 4575b6dc79427b8f7eeb6a7ff68034ab8548ce670eaAlexander Gutkin# func_echo_all arg... 4585b6dc79427b8f7eeb6a7ff68034ab8548ce670eaAlexander Gutkin# Invoke $ECHO with all args, space-separated. 4595b6dc79427b8f7eeb6a7ff68034ab8548ce670eaAlexander Gutkinfunc_echo_all () 4605b6dc79427b8f7eeb6a7ff68034ab8548ce670eaAlexander Gutkin{ 4615b6dc79427b8f7eeb6a7ff68034ab8548ce670eaAlexander Gutkin $ECHO "$*" 4625b6dc79427b8f7eeb6a7ff68034ab8548ce670eaAlexander Gutkin} 4635b6dc79427b8f7eeb6a7ff68034ab8548ce670eaAlexander Gutkin 464f4c12fce1ee58e670f9c3fce46c40296ba9ee8a2Ian Hodson# func_error arg... 465f4c12fce1ee58e670f9c3fce46c40296ba9ee8a2Ian Hodson# Echo program name prefixed message to standard error. 466f4c12fce1ee58e670f9c3fce46c40296ba9ee8a2Ian Hodsonfunc_error () 467f4c12fce1ee58e670f9c3fce46c40296ba9ee8a2Ian Hodson{ 4685b6dc79427b8f7eeb6a7ff68034ab8548ce670eaAlexander Gutkin $ECHO "$progname: ${opt_mode+$opt_mode: }"${1+"$@"} 1>&2 469f4c12fce1ee58e670f9c3fce46c40296ba9ee8a2Ian Hodson} 470f4c12fce1ee58e670f9c3fce46c40296ba9ee8a2Ian Hodson 471f4c12fce1ee58e670f9c3fce46c40296ba9ee8a2Ian Hodson# func_warning arg... 472f4c12fce1ee58e670f9c3fce46c40296ba9ee8a2Ian Hodson# Echo program name prefixed warning message to standard error. 473f4c12fce1ee58e670f9c3fce46c40296ba9ee8a2Ian Hodsonfunc_warning () 474f4c12fce1ee58e670f9c3fce46c40296ba9ee8a2Ian Hodson{ 4755b6dc79427b8f7eeb6a7ff68034ab8548ce670eaAlexander Gutkin $opt_warning && $ECHO "$progname: ${opt_mode+$opt_mode: }warning: "${1+"$@"} 1>&2 476f4c12fce1ee58e670f9c3fce46c40296ba9ee8a2Ian Hodson 477f4c12fce1ee58e670f9c3fce46c40296ba9ee8a2Ian Hodson # bash bug again: 478f4c12fce1ee58e670f9c3fce46c40296ba9ee8a2Ian Hodson : 479f4c12fce1ee58e670f9c3fce46c40296ba9ee8a2Ian Hodson} 480f4c12fce1ee58e670f9c3fce46c40296ba9ee8a2Ian Hodson 481f4c12fce1ee58e670f9c3fce46c40296ba9ee8a2Ian Hodson# func_fatal_error arg... 482f4c12fce1ee58e670f9c3fce46c40296ba9ee8a2Ian Hodson# Echo program name prefixed message to standard error, and exit. 483f4c12fce1ee58e670f9c3fce46c40296ba9ee8a2Ian Hodsonfunc_fatal_error () 484f4c12fce1ee58e670f9c3fce46c40296ba9ee8a2Ian Hodson{ 485f4c12fce1ee58e670f9c3fce46c40296ba9ee8a2Ian Hodson func_error ${1+"$@"} 486f4c12fce1ee58e670f9c3fce46c40296ba9ee8a2Ian Hodson exit $EXIT_FAILURE 487f4c12fce1ee58e670f9c3fce46c40296ba9ee8a2Ian Hodson} 488f4c12fce1ee58e670f9c3fce46c40296ba9ee8a2Ian Hodson 489f4c12fce1ee58e670f9c3fce46c40296ba9ee8a2Ian Hodson# func_fatal_help arg... 490f4c12fce1ee58e670f9c3fce46c40296ba9ee8a2Ian Hodson# Echo program name prefixed message to standard error, followed by 491f4c12fce1ee58e670f9c3fce46c40296ba9ee8a2Ian Hodson# a help hint, and exit. 492f4c12fce1ee58e670f9c3fce46c40296ba9ee8a2Ian Hodsonfunc_fatal_help () 493f4c12fce1ee58e670f9c3fce46c40296ba9ee8a2Ian Hodson{ 494f4c12fce1ee58e670f9c3fce46c40296ba9ee8a2Ian Hodson func_error ${1+"$@"} 495f4c12fce1ee58e670f9c3fce46c40296ba9ee8a2Ian Hodson func_fatal_error "$help" 496f4c12fce1ee58e670f9c3fce46c40296ba9ee8a2Ian Hodson} 497f4c12fce1ee58e670f9c3fce46c40296ba9ee8a2Ian Hodsonhelp="Try \`$progname --help' for more information." ## default 498f4c12fce1ee58e670f9c3fce46c40296ba9ee8a2Ian Hodson 499f4c12fce1ee58e670f9c3fce46c40296ba9ee8a2Ian Hodson 500f4c12fce1ee58e670f9c3fce46c40296ba9ee8a2Ian Hodson# func_grep expression filename 501f4c12fce1ee58e670f9c3fce46c40296ba9ee8a2Ian Hodson# Check whether EXPRESSION matches any line of FILENAME, without output. 502f4c12fce1ee58e670f9c3fce46c40296ba9ee8a2Ian Hodsonfunc_grep () 503f4c12fce1ee58e670f9c3fce46c40296ba9ee8a2Ian Hodson{ 504f4c12fce1ee58e670f9c3fce46c40296ba9ee8a2Ian Hodson $GREP "$1" "$2" >/dev/null 2>&1 505f4c12fce1ee58e670f9c3fce46c40296ba9ee8a2Ian Hodson} 506f4c12fce1ee58e670f9c3fce46c40296ba9ee8a2Ian Hodson 507f4c12fce1ee58e670f9c3fce46c40296ba9ee8a2Ian Hodson 508f4c12fce1ee58e670f9c3fce46c40296ba9ee8a2Ian Hodson# func_mkdir_p directory-path 509f4c12fce1ee58e670f9c3fce46c40296ba9ee8a2Ian Hodson# Make sure the entire path to DIRECTORY-PATH is available. 510f4c12fce1ee58e670f9c3fce46c40296ba9ee8a2Ian Hodsonfunc_mkdir_p () 511f4c12fce1ee58e670f9c3fce46c40296ba9ee8a2Ian Hodson{ 512f4c12fce1ee58e670f9c3fce46c40296ba9ee8a2Ian Hodson my_directory_path="$1" 513f4c12fce1ee58e670f9c3fce46c40296ba9ee8a2Ian Hodson my_dir_list= 514f4c12fce1ee58e670f9c3fce46c40296ba9ee8a2Ian Hodson 515f4c12fce1ee58e670f9c3fce46c40296ba9ee8a2Ian Hodson if test -n "$my_directory_path" && test "$opt_dry_run" != ":"; then 516f4c12fce1ee58e670f9c3fce46c40296ba9ee8a2Ian Hodson 517f4c12fce1ee58e670f9c3fce46c40296ba9ee8a2Ian Hodson # Protect directory names starting with `-' 518f4c12fce1ee58e670f9c3fce46c40296ba9ee8a2Ian Hodson case $my_directory_path in 519f4c12fce1ee58e670f9c3fce46c40296ba9ee8a2Ian Hodson -*) my_directory_path="./$my_directory_path" ;; 520f4c12fce1ee58e670f9c3fce46c40296ba9ee8a2Ian Hodson esac 521f4c12fce1ee58e670f9c3fce46c40296ba9ee8a2Ian Hodson 522f4c12fce1ee58e670f9c3fce46c40296ba9ee8a2Ian Hodson # While some portion of DIR does not yet exist... 523f4c12fce1ee58e670f9c3fce46c40296ba9ee8a2Ian Hodson while test ! -d "$my_directory_path"; do 524f4c12fce1ee58e670f9c3fce46c40296ba9ee8a2Ian Hodson # ...make a list in topmost first order. Use a colon delimited 525f4c12fce1ee58e670f9c3fce46c40296ba9ee8a2Ian Hodson # list incase some portion of path contains whitespace. 526f4c12fce1ee58e670f9c3fce46c40296ba9ee8a2Ian Hodson my_dir_list="$my_directory_path:$my_dir_list" 527f4c12fce1ee58e670f9c3fce46c40296ba9ee8a2Ian Hodson 528f4c12fce1ee58e670f9c3fce46c40296ba9ee8a2Ian Hodson # If the last portion added has no slash in it, the list is done 529f4c12fce1ee58e670f9c3fce46c40296ba9ee8a2Ian Hodson case $my_directory_path in */*) ;; *) break ;; esac 530f4c12fce1ee58e670f9c3fce46c40296ba9ee8a2Ian Hodson 531f4c12fce1ee58e670f9c3fce46c40296ba9ee8a2Ian Hodson # ...otherwise throw away the child directory and loop 5325b6dc79427b8f7eeb6a7ff68034ab8548ce670eaAlexander Gutkin my_directory_path=`$ECHO "$my_directory_path" | $SED -e "$dirname"` 533f4c12fce1ee58e670f9c3fce46c40296ba9ee8a2Ian Hodson done 5345b6dc79427b8f7eeb6a7ff68034ab8548ce670eaAlexander Gutkin my_dir_list=`$ECHO "$my_dir_list" | $SED 's,:*$,,'` 535f4c12fce1ee58e670f9c3fce46c40296ba9ee8a2Ian Hodson 536f4c12fce1ee58e670f9c3fce46c40296ba9ee8a2Ian Hodson save_mkdir_p_IFS="$IFS"; IFS=':' 537f4c12fce1ee58e670f9c3fce46c40296ba9ee8a2Ian Hodson for my_dir in $my_dir_list; do 538f4c12fce1ee58e670f9c3fce46c40296ba9ee8a2Ian Hodson IFS="$save_mkdir_p_IFS" 539f4c12fce1ee58e670f9c3fce46c40296ba9ee8a2Ian Hodson # mkdir can fail with a `File exist' error if two processes 540f4c12fce1ee58e670f9c3fce46c40296ba9ee8a2Ian Hodson # try to create one of the directories concurrently. Don't 541f4c12fce1ee58e670f9c3fce46c40296ba9ee8a2Ian Hodson # stop in that case! 542f4c12fce1ee58e670f9c3fce46c40296ba9ee8a2Ian Hodson $MKDIR "$my_dir" 2>/dev/null || : 543f4c12fce1ee58e670f9c3fce46c40296ba9ee8a2Ian Hodson done 544f4c12fce1ee58e670f9c3fce46c40296ba9ee8a2Ian Hodson IFS="$save_mkdir_p_IFS" 545f4c12fce1ee58e670f9c3fce46c40296ba9ee8a2Ian Hodson 546f4c12fce1ee58e670f9c3fce46c40296ba9ee8a2Ian Hodson # Bail out if we (or some other process) failed to create a directory. 547f4c12fce1ee58e670f9c3fce46c40296ba9ee8a2Ian Hodson test -d "$my_directory_path" || \ 548f4c12fce1ee58e670f9c3fce46c40296ba9ee8a2Ian Hodson func_fatal_error "Failed to create \`$1'" 549f4c12fce1ee58e670f9c3fce46c40296ba9ee8a2Ian Hodson fi 550f4c12fce1ee58e670f9c3fce46c40296ba9ee8a2Ian Hodson} 551f4c12fce1ee58e670f9c3fce46c40296ba9ee8a2Ian Hodson 552f4c12fce1ee58e670f9c3fce46c40296ba9ee8a2Ian Hodson 553f4c12fce1ee58e670f9c3fce46c40296ba9ee8a2Ian Hodson# func_mktempdir [string] 554f4c12fce1ee58e670f9c3fce46c40296ba9ee8a2Ian Hodson# Make a temporary directory that won't clash with other running 555f4c12fce1ee58e670f9c3fce46c40296ba9ee8a2Ian Hodson# libtool processes, and avoids race conditions if possible. If 556f4c12fce1ee58e670f9c3fce46c40296ba9ee8a2Ian Hodson# given, STRING is the basename for that directory. 557f4c12fce1ee58e670f9c3fce46c40296ba9ee8a2Ian Hodsonfunc_mktempdir () 558f4c12fce1ee58e670f9c3fce46c40296ba9ee8a2Ian Hodson{ 559f4c12fce1ee58e670f9c3fce46c40296ba9ee8a2Ian Hodson my_template="${TMPDIR-/tmp}/${1-$progname}" 560f4c12fce1ee58e670f9c3fce46c40296ba9ee8a2Ian Hodson 561f4c12fce1ee58e670f9c3fce46c40296ba9ee8a2Ian Hodson if test "$opt_dry_run" = ":"; then 562f4c12fce1ee58e670f9c3fce46c40296ba9ee8a2Ian Hodson # Return a directory name, but don't create it in dry-run mode 563f4c12fce1ee58e670f9c3fce46c40296ba9ee8a2Ian Hodson my_tmpdir="${my_template}-$$" 564f4c12fce1ee58e670f9c3fce46c40296ba9ee8a2Ian Hodson else 565f4c12fce1ee58e670f9c3fce46c40296ba9ee8a2Ian Hodson 566f4c12fce1ee58e670f9c3fce46c40296ba9ee8a2Ian Hodson # If mktemp works, use that first and foremost 567f4c12fce1ee58e670f9c3fce46c40296ba9ee8a2Ian Hodson my_tmpdir=`mktemp -d "${my_template}-XXXXXXXX" 2>/dev/null` 568f4c12fce1ee58e670f9c3fce46c40296ba9ee8a2Ian Hodson 569f4c12fce1ee58e670f9c3fce46c40296ba9ee8a2Ian Hodson if test ! -d "$my_tmpdir"; then 570f4c12fce1ee58e670f9c3fce46c40296ba9ee8a2Ian Hodson # Failing that, at least try and use $RANDOM to avoid a race 571f4c12fce1ee58e670f9c3fce46c40296ba9ee8a2Ian Hodson my_tmpdir="${my_template}-${RANDOM-0}$$" 572f4c12fce1ee58e670f9c3fce46c40296ba9ee8a2Ian Hodson 573f4c12fce1ee58e670f9c3fce46c40296ba9ee8a2Ian Hodson save_mktempdir_umask=`umask` 574f4c12fce1ee58e670f9c3fce46c40296ba9ee8a2Ian Hodson umask 0077 575f4c12fce1ee58e670f9c3fce46c40296ba9ee8a2Ian Hodson $MKDIR "$my_tmpdir" 576f4c12fce1ee58e670f9c3fce46c40296ba9ee8a2Ian Hodson umask $save_mktempdir_umask 577f4c12fce1ee58e670f9c3fce46c40296ba9ee8a2Ian Hodson fi 578f4c12fce1ee58e670f9c3fce46c40296ba9ee8a2Ian Hodson 579f4c12fce1ee58e670f9c3fce46c40296ba9ee8a2Ian Hodson # If we're not in dry-run mode, bomb out on failure 580f4c12fce1ee58e670f9c3fce46c40296ba9ee8a2Ian Hodson test -d "$my_tmpdir" || \ 581f4c12fce1ee58e670f9c3fce46c40296ba9ee8a2Ian Hodson func_fatal_error "cannot create temporary directory \`$my_tmpdir'" 582f4c12fce1ee58e670f9c3fce46c40296ba9ee8a2Ian Hodson fi 583f4c12fce1ee58e670f9c3fce46c40296ba9ee8a2Ian Hodson 5845b6dc79427b8f7eeb6a7ff68034ab8548ce670eaAlexander Gutkin $ECHO "$my_tmpdir" 585f4c12fce1ee58e670f9c3fce46c40296ba9ee8a2Ian Hodson} 586f4c12fce1ee58e670f9c3fce46c40296ba9ee8a2Ian Hodson 587f4c12fce1ee58e670f9c3fce46c40296ba9ee8a2Ian Hodson 588f4c12fce1ee58e670f9c3fce46c40296ba9ee8a2Ian Hodson# func_quote_for_eval arg 589f4c12fce1ee58e670f9c3fce46c40296ba9ee8a2Ian Hodson# Aesthetically quote ARG to be evaled later. 590f4c12fce1ee58e670f9c3fce46c40296ba9ee8a2Ian Hodson# This function returns two values: FUNC_QUOTE_FOR_EVAL_RESULT 591f4c12fce1ee58e670f9c3fce46c40296ba9ee8a2Ian Hodson# is double-quoted, suitable for a subsequent eval, whereas 592f4c12fce1ee58e670f9c3fce46c40296ba9ee8a2Ian Hodson# FUNC_QUOTE_FOR_EVAL_UNQUOTED_RESULT has merely all characters 593f4c12fce1ee58e670f9c3fce46c40296ba9ee8a2Ian Hodson# which are still active within double quotes backslashified. 594f4c12fce1ee58e670f9c3fce46c40296ba9ee8a2Ian Hodsonfunc_quote_for_eval () 595f4c12fce1ee58e670f9c3fce46c40296ba9ee8a2Ian Hodson{ 596f4c12fce1ee58e670f9c3fce46c40296ba9ee8a2Ian Hodson case $1 in 597f4c12fce1ee58e670f9c3fce46c40296ba9ee8a2Ian Hodson *[\\\`\"\$]*) 5985b6dc79427b8f7eeb6a7ff68034ab8548ce670eaAlexander Gutkin func_quote_for_eval_unquoted_result=`$ECHO "$1" | $SED "$sed_quote_subst"` ;; 599f4c12fce1ee58e670f9c3fce46c40296ba9ee8a2Ian Hodson *) 600f4c12fce1ee58e670f9c3fce46c40296ba9ee8a2Ian Hodson func_quote_for_eval_unquoted_result="$1" ;; 601f4c12fce1ee58e670f9c3fce46c40296ba9ee8a2Ian Hodson esac 602f4c12fce1ee58e670f9c3fce46c40296ba9ee8a2Ian Hodson 603f4c12fce1ee58e670f9c3fce46c40296ba9ee8a2Ian Hodson case $func_quote_for_eval_unquoted_result in 604f4c12fce1ee58e670f9c3fce46c40296ba9ee8a2Ian Hodson # Double-quote args containing shell metacharacters to delay 605f4c12fce1ee58e670f9c3fce46c40296ba9ee8a2Ian Hodson # word splitting, command substitution and and variable 606f4c12fce1ee58e670f9c3fce46c40296ba9ee8a2Ian Hodson # expansion for a subsequent eval. 607f4c12fce1ee58e670f9c3fce46c40296ba9ee8a2Ian Hodson # Many Bourne shells cannot handle close brackets correctly 608f4c12fce1ee58e670f9c3fce46c40296ba9ee8a2Ian Hodson # in scan sets, so we specify it separately. 609f4c12fce1ee58e670f9c3fce46c40296ba9ee8a2Ian Hodson *[\[\~\#\^\&\*\(\)\{\}\|\;\<\>\?\'\ \ ]*|*]*|"") 610f4c12fce1ee58e670f9c3fce46c40296ba9ee8a2Ian Hodson func_quote_for_eval_result="\"$func_quote_for_eval_unquoted_result\"" 611f4c12fce1ee58e670f9c3fce46c40296ba9ee8a2Ian Hodson ;; 612f4c12fce1ee58e670f9c3fce46c40296ba9ee8a2Ian Hodson *) 613f4c12fce1ee58e670f9c3fce46c40296ba9ee8a2Ian Hodson func_quote_for_eval_result="$func_quote_for_eval_unquoted_result" 614f4c12fce1ee58e670f9c3fce46c40296ba9ee8a2Ian Hodson esac 615f4c12fce1ee58e670f9c3fce46c40296ba9ee8a2Ian Hodson} 616f4c12fce1ee58e670f9c3fce46c40296ba9ee8a2Ian Hodson 617f4c12fce1ee58e670f9c3fce46c40296ba9ee8a2Ian Hodson 618f4c12fce1ee58e670f9c3fce46c40296ba9ee8a2Ian Hodson# func_quote_for_expand arg 619f4c12fce1ee58e670f9c3fce46c40296ba9ee8a2Ian Hodson# Aesthetically quote ARG to be evaled later; same as above, 620f4c12fce1ee58e670f9c3fce46c40296ba9ee8a2Ian Hodson# but do not quote variable references. 621f4c12fce1ee58e670f9c3fce46c40296ba9ee8a2Ian Hodsonfunc_quote_for_expand () 622f4c12fce1ee58e670f9c3fce46c40296ba9ee8a2Ian Hodson{ 623f4c12fce1ee58e670f9c3fce46c40296ba9ee8a2Ian Hodson case $1 in 624f4c12fce1ee58e670f9c3fce46c40296ba9ee8a2Ian Hodson *[\\\`\"]*) 6255b6dc79427b8f7eeb6a7ff68034ab8548ce670eaAlexander Gutkin my_arg=`$ECHO "$1" | $SED \ 626f4c12fce1ee58e670f9c3fce46c40296ba9ee8a2Ian Hodson -e "$double_quote_subst" -e "$sed_double_backslash"` ;; 627f4c12fce1ee58e670f9c3fce46c40296ba9ee8a2Ian Hodson *) 628f4c12fce1ee58e670f9c3fce46c40296ba9ee8a2Ian Hodson my_arg="$1" ;; 629f4c12fce1ee58e670f9c3fce46c40296ba9ee8a2Ian Hodson esac 630f4c12fce1ee58e670f9c3fce46c40296ba9ee8a2Ian Hodson 631f4c12fce1ee58e670f9c3fce46c40296ba9ee8a2Ian Hodson case $my_arg in 632f4c12fce1ee58e670f9c3fce46c40296ba9ee8a2Ian Hodson # Double-quote args containing shell metacharacters to delay 633f4c12fce1ee58e670f9c3fce46c40296ba9ee8a2Ian Hodson # word splitting and command substitution for a subsequent eval. 634f4c12fce1ee58e670f9c3fce46c40296ba9ee8a2Ian Hodson # Many Bourne shells cannot handle close brackets correctly 635f4c12fce1ee58e670f9c3fce46c40296ba9ee8a2Ian Hodson # in scan sets, so we specify it separately. 636f4c12fce1ee58e670f9c3fce46c40296ba9ee8a2Ian Hodson *[\[\~\#\^\&\*\(\)\{\}\|\;\<\>\?\'\ \ ]*|*]*|"") 637f4c12fce1ee58e670f9c3fce46c40296ba9ee8a2Ian Hodson my_arg="\"$my_arg\"" 638f4c12fce1ee58e670f9c3fce46c40296ba9ee8a2Ian Hodson ;; 639f4c12fce1ee58e670f9c3fce46c40296ba9ee8a2Ian Hodson esac 640f4c12fce1ee58e670f9c3fce46c40296ba9ee8a2Ian Hodson 641f4c12fce1ee58e670f9c3fce46c40296ba9ee8a2Ian Hodson func_quote_for_expand_result="$my_arg" 642f4c12fce1ee58e670f9c3fce46c40296ba9ee8a2Ian Hodson} 643f4c12fce1ee58e670f9c3fce46c40296ba9ee8a2Ian Hodson 644f4c12fce1ee58e670f9c3fce46c40296ba9ee8a2Ian Hodson 645f4c12fce1ee58e670f9c3fce46c40296ba9ee8a2Ian Hodson# func_show_eval cmd [fail_exp] 646f4c12fce1ee58e670f9c3fce46c40296ba9ee8a2Ian Hodson# Unless opt_silent is true, then output CMD. Then, if opt_dryrun is 647f4c12fce1ee58e670f9c3fce46c40296ba9ee8a2Ian Hodson# not true, evaluate CMD. If the evaluation of CMD fails, and FAIL_EXP 648f4c12fce1ee58e670f9c3fce46c40296ba9ee8a2Ian Hodson# is given, then evaluate it. 649f4c12fce1ee58e670f9c3fce46c40296ba9ee8a2Ian Hodsonfunc_show_eval () 650f4c12fce1ee58e670f9c3fce46c40296ba9ee8a2Ian Hodson{ 651f4c12fce1ee58e670f9c3fce46c40296ba9ee8a2Ian Hodson my_cmd="$1" 652f4c12fce1ee58e670f9c3fce46c40296ba9ee8a2Ian Hodson my_fail_exp="${2-:}" 653f4c12fce1ee58e670f9c3fce46c40296ba9ee8a2Ian Hodson 654f4c12fce1ee58e670f9c3fce46c40296ba9ee8a2Ian Hodson ${opt_silent-false} || { 655f4c12fce1ee58e670f9c3fce46c40296ba9ee8a2Ian Hodson func_quote_for_expand "$my_cmd" 656f4c12fce1ee58e670f9c3fce46c40296ba9ee8a2Ian Hodson eval "func_echo $func_quote_for_expand_result" 657f4c12fce1ee58e670f9c3fce46c40296ba9ee8a2Ian Hodson } 658f4c12fce1ee58e670f9c3fce46c40296ba9ee8a2Ian Hodson 659f4c12fce1ee58e670f9c3fce46c40296ba9ee8a2Ian Hodson if ${opt_dry_run-false}; then :; else 660f4c12fce1ee58e670f9c3fce46c40296ba9ee8a2Ian Hodson eval "$my_cmd" 661f4c12fce1ee58e670f9c3fce46c40296ba9ee8a2Ian Hodson my_status=$? 662f4c12fce1ee58e670f9c3fce46c40296ba9ee8a2Ian Hodson if test "$my_status" -eq 0; then :; else 663f4c12fce1ee58e670f9c3fce46c40296ba9ee8a2Ian Hodson eval "(exit $my_status); $my_fail_exp" 664f4c12fce1ee58e670f9c3fce46c40296ba9ee8a2Ian Hodson fi 665f4c12fce1ee58e670f9c3fce46c40296ba9ee8a2Ian Hodson fi 666f4c12fce1ee58e670f9c3fce46c40296ba9ee8a2Ian Hodson} 667f4c12fce1ee58e670f9c3fce46c40296ba9ee8a2Ian Hodson 668f4c12fce1ee58e670f9c3fce46c40296ba9ee8a2Ian Hodson 669f4c12fce1ee58e670f9c3fce46c40296ba9ee8a2Ian Hodson# func_show_eval_locale cmd [fail_exp] 670f4c12fce1ee58e670f9c3fce46c40296ba9ee8a2Ian Hodson# Unless opt_silent is true, then output CMD. Then, if opt_dryrun is 671f4c12fce1ee58e670f9c3fce46c40296ba9ee8a2Ian Hodson# not true, evaluate CMD. If the evaluation of CMD fails, and FAIL_EXP 672f4c12fce1ee58e670f9c3fce46c40296ba9ee8a2Ian Hodson# is given, then evaluate it. Use the saved locale for evaluation. 673f4c12fce1ee58e670f9c3fce46c40296ba9ee8a2Ian Hodsonfunc_show_eval_locale () 674f4c12fce1ee58e670f9c3fce46c40296ba9ee8a2Ian Hodson{ 675f4c12fce1ee58e670f9c3fce46c40296ba9ee8a2Ian Hodson my_cmd="$1" 676f4c12fce1ee58e670f9c3fce46c40296ba9ee8a2Ian Hodson my_fail_exp="${2-:}" 677f4c12fce1ee58e670f9c3fce46c40296ba9ee8a2Ian Hodson 678f4c12fce1ee58e670f9c3fce46c40296ba9ee8a2Ian Hodson ${opt_silent-false} || { 679f4c12fce1ee58e670f9c3fce46c40296ba9ee8a2Ian Hodson func_quote_for_expand "$my_cmd" 680f4c12fce1ee58e670f9c3fce46c40296ba9ee8a2Ian Hodson eval "func_echo $func_quote_for_expand_result" 681f4c12fce1ee58e670f9c3fce46c40296ba9ee8a2Ian Hodson } 682f4c12fce1ee58e670f9c3fce46c40296ba9ee8a2Ian Hodson 683f4c12fce1ee58e670f9c3fce46c40296ba9ee8a2Ian Hodson if ${opt_dry_run-false}; then :; else 684f4c12fce1ee58e670f9c3fce46c40296ba9ee8a2Ian Hodson eval "$lt_user_locale 685f4c12fce1ee58e670f9c3fce46c40296ba9ee8a2Ian Hodson $my_cmd" 686f4c12fce1ee58e670f9c3fce46c40296ba9ee8a2Ian Hodson my_status=$? 687f4c12fce1ee58e670f9c3fce46c40296ba9ee8a2Ian Hodson eval "$lt_safe_locale" 688f4c12fce1ee58e670f9c3fce46c40296ba9ee8a2Ian Hodson if test "$my_status" -eq 0; then :; else 689f4c12fce1ee58e670f9c3fce46c40296ba9ee8a2Ian Hodson eval "(exit $my_status); $my_fail_exp" 690f4c12fce1ee58e670f9c3fce46c40296ba9ee8a2Ian Hodson fi 691f4c12fce1ee58e670f9c3fce46c40296ba9ee8a2Ian Hodson fi 692f4c12fce1ee58e670f9c3fce46c40296ba9ee8a2Ian Hodson} 693f4c12fce1ee58e670f9c3fce46c40296ba9ee8a2Ian Hodson 6945b6dc79427b8f7eeb6a7ff68034ab8548ce670eaAlexander Gutkin# func_tr_sh 6955b6dc79427b8f7eeb6a7ff68034ab8548ce670eaAlexander Gutkin# Turn $1 into a string suitable for a shell variable name. 6965b6dc79427b8f7eeb6a7ff68034ab8548ce670eaAlexander Gutkin# Result is stored in $func_tr_sh_result. All characters 6975b6dc79427b8f7eeb6a7ff68034ab8548ce670eaAlexander Gutkin# not in the set a-zA-Z0-9_ are replaced with '_'. Further, 6985b6dc79427b8f7eeb6a7ff68034ab8548ce670eaAlexander Gutkin# if $1 begins with a digit, a '_' is prepended as well. 6995b6dc79427b8f7eeb6a7ff68034ab8548ce670eaAlexander Gutkinfunc_tr_sh () 7005b6dc79427b8f7eeb6a7ff68034ab8548ce670eaAlexander Gutkin{ 7015b6dc79427b8f7eeb6a7ff68034ab8548ce670eaAlexander Gutkin case $1 in 7025b6dc79427b8f7eeb6a7ff68034ab8548ce670eaAlexander Gutkin [0-9]* | *[!a-zA-Z0-9_]*) 7035b6dc79427b8f7eeb6a7ff68034ab8548ce670eaAlexander Gutkin func_tr_sh_result=`$ECHO "$1" | $SED 's/^\([0-9]\)/_\1/; s/[^a-zA-Z0-9_]/_/g'` 7045b6dc79427b8f7eeb6a7ff68034ab8548ce670eaAlexander Gutkin ;; 7055b6dc79427b8f7eeb6a7ff68034ab8548ce670eaAlexander Gutkin * ) 7065b6dc79427b8f7eeb6a7ff68034ab8548ce670eaAlexander Gutkin func_tr_sh_result=$1 7075b6dc79427b8f7eeb6a7ff68034ab8548ce670eaAlexander Gutkin ;; 7085b6dc79427b8f7eeb6a7ff68034ab8548ce670eaAlexander Gutkin esac 7095b6dc79427b8f7eeb6a7ff68034ab8548ce670eaAlexander Gutkin} 710f4c12fce1ee58e670f9c3fce46c40296ba9ee8a2Ian Hodson 711f4c12fce1ee58e670f9c3fce46c40296ba9ee8a2Ian Hodson 712f4c12fce1ee58e670f9c3fce46c40296ba9ee8a2Ian Hodson# func_version 713f4c12fce1ee58e670f9c3fce46c40296ba9ee8a2Ian Hodson# Echo version message to standard output and exit. 714f4c12fce1ee58e670f9c3fce46c40296ba9ee8a2Ian Hodsonfunc_version () 715f4c12fce1ee58e670f9c3fce46c40296ba9ee8a2Ian Hodson{ 7165b6dc79427b8f7eeb6a7ff68034ab8548ce670eaAlexander Gutkin $opt_debug 7175b6dc79427b8f7eeb6a7ff68034ab8548ce670eaAlexander Gutkin 7185b6dc79427b8f7eeb6a7ff68034ab8548ce670eaAlexander Gutkin $SED -n '/(C)/!b go 7195b6dc79427b8f7eeb6a7ff68034ab8548ce670eaAlexander Gutkin :more 7205b6dc79427b8f7eeb6a7ff68034ab8548ce670eaAlexander Gutkin /\./!{ 7215b6dc79427b8f7eeb6a7ff68034ab8548ce670eaAlexander Gutkin N 7225b6dc79427b8f7eeb6a7ff68034ab8548ce670eaAlexander Gutkin s/\n# / / 7235b6dc79427b8f7eeb6a7ff68034ab8548ce670eaAlexander Gutkin b more 7245b6dc79427b8f7eeb6a7ff68034ab8548ce670eaAlexander Gutkin } 7255b6dc79427b8f7eeb6a7ff68034ab8548ce670eaAlexander Gutkin :go 7265b6dc79427b8f7eeb6a7ff68034ab8548ce670eaAlexander Gutkin /^# '$PROGRAM' (GNU /,/# warranty; / { 727f4c12fce1ee58e670f9c3fce46c40296ba9ee8a2Ian Hodson s/^# // 728f4c12fce1ee58e670f9c3fce46c40296ba9ee8a2Ian Hodson s/^# *$// 729f4c12fce1ee58e670f9c3fce46c40296ba9ee8a2Ian Hodson s/\((C)\)[ 0-9,-]*\( [1-9][0-9]*\)/\1\2/ 730f4c12fce1ee58e670f9c3fce46c40296ba9ee8a2Ian Hodson p 731f4c12fce1ee58e670f9c3fce46c40296ba9ee8a2Ian Hodson }' < "$progpath" 732f4c12fce1ee58e670f9c3fce46c40296ba9ee8a2Ian Hodson exit $? 733f4c12fce1ee58e670f9c3fce46c40296ba9ee8a2Ian Hodson} 734f4c12fce1ee58e670f9c3fce46c40296ba9ee8a2Ian Hodson 735f4c12fce1ee58e670f9c3fce46c40296ba9ee8a2Ian Hodson# func_usage 736f4c12fce1ee58e670f9c3fce46c40296ba9ee8a2Ian Hodson# Echo short help message to standard output and exit. 737f4c12fce1ee58e670f9c3fce46c40296ba9ee8a2Ian Hodsonfunc_usage () 738f4c12fce1ee58e670f9c3fce46c40296ba9ee8a2Ian Hodson{ 7395b6dc79427b8f7eeb6a7ff68034ab8548ce670eaAlexander Gutkin $opt_debug 7405b6dc79427b8f7eeb6a7ff68034ab8548ce670eaAlexander Gutkin 7415b6dc79427b8f7eeb6a7ff68034ab8548ce670eaAlexander Gutkin $SED -n '/^# Usage:/,/^# *.*--help/ { 742f4c12fce1ee58e670f9c3fce46c40296ba9ee8a2Ian Hodson s/^# // 743f4c12fce1ee58e670f9c3fce46c40296ba9ee8a2Ian Hodson s/^# *$// 744f4c12fce1ee58e670f9c3fce46c40296ba9ee8a2Ian Hodson s/\$progname/'$progname'/ 745f4c12fce1ee58e670f9c3fce46c40296ba9ee8a2Ian Hodson p 746f4c12fce1ee58e670f9c3fce46c40296ba9ee8a2Ian Hodson }' < "$progpath" 7475b6dc79427b8f7eeb6a7ff68034ab8548ce670eaAlexander Gutkin echo 748f4c12fce1ee58e670f9c3fce46c40296ba9ee8a2Ian Hodson $ECHO "run \`$progname --help | more' for full usage" 749f4c12fce1ee58e670f9c3fce46c40296ba9ee8a2Ian Hodson exit $? 750f4c12fce1ee58e670f9c3fce46c40296ba9ee8a2Ian Hodson} 751f4c12fce1ee58e670f9c3fce46c40296ba9ee8a2Ian Hodson 7525b6dc79427b8f7eeb6a7ff68034ab8548ce670eaAlexander Gutkin# func_help [NOEXIT] 7535b6dc79427b8f7eeb6a7ff68034ab8548ce670eaAlexander Gutkin# Echo long help message to standard output and exit, 7545b6dc79427b8f7eeb6a7ff68034ab8548ce670eaAlexander Gutkin# unless 'noexit' is passed as argument. 755f4c12fce1ee58e670f9c3fce46c40296ba9ee8a2Ian Hodsonfunc_help () 756f4c12fce1ee58e670f9c3fce46c40296ba9ee8a2Ian Hodson{ 7575b6dc79427b8f7eeb6a7ff68034ab8548ce670eaAlexander Gutkin $opt_debug 7585b6dc79427b8f7eeb6a7ff68034ab8548ce670eaAlexander Gutkin 759f4c12fce1ee58e670f9c3fce46c40296ba9ee8a2Ian Hodson $SED -n '/^# Usage:/,/# Report bugs to/ { 7605b6dc79427b8f7eeb6a7ff68034ab8548ce670eaAlexander Gutkin :print 761f4c12fce1ee58e670f9c3fce46c40296ba9ee8a2Ian Hodson s/^# // 762f4c12fce1ee58e670f9c3fce46c40296ba9ee8a2Ian Hodson s/^# *$// 763f4c12fce1ee58e670f9c3fce46c40296ba9ee8a2Ian Hodson s*\$progname*'$progname'* 764f4c12fce1ee58e670f9c3fce46c40296ba9ee8a2Ian Hodson s*\$host*'"$host"'* 765f4c12fce1ee58e670f9c3fce46c40296ba9ee8a2Ian Hodson s*\$SHELL*'"$SHELL"'* 766f4c12fce1ee58e670f9c3fce46c40296ba9ee8a2Ian Hodson s*\$LTCC*'"$LTCC"'* 767f4c12fce1ee58e670f9c3fce46c40296ba9ee8a2Ian Hodson s*\$LTCFLAGS*'"$LTCFLAGS"'* 768f4c12fce1ee58e670f9c3fce46c40296ba9ee8a2Ian Hodson s*\$LD*'"$LD"'* 769f4c12fce1ee58e670f9c3fce46c40296ba9ee8a2Ian Hodson s/\$with_gnu_ld/'"$with_gnu_ld"'/ 7705b6dc79427b8f7eeb6a7ff68034ab8548ce670eaAlexander Gutkin s/\$automake_version/'"`(${AUTOMAKE-automake} --version) 2>/dev/null |$SED 1q`"'/ 7715b6dc79427b8f7eeb6a7ff68034ab8548ce670eaAlexander Gutkin s/\$autoconf_version/'"`(${AUTOCONF-autoconf} --version) 2>/dev/null |$SED 1q`"'/ 772f4c12fce1ee58e670f9c3fce46c40296ba9ee8a2Ian Hodson p 7735b6dc79427b8f7eeb6a7ff68034ab8548ce670eaAlexander Gutkin d 7745b6dc79427b8f7eeb6a7ff68034ab8548ce670eaAlexander Gutkin } 7755b6dc79427b8f7eeb6a7ff68034ab8548ce670eaAlexander Gutkin /^# .* home page:/b print 7765b6dc79427b8f7eeb6a7ff68034ab8548ce670eaAlexander Gutkin /^# General help using/b print 7775b6dc79427b8f7eeb6a7ff68034ab8548ce670eaAlexander Gutkin ' < "$progpath" 7785b6dc79427b8f7eeb6a7ff68034ab8548ce670eaAlexander Gutkin ret=$? 7795b6dc79427b8f7eeb6a7ff68034ab8548ce670eaAlexander Gutkin if test -z "$1"; then 7805b6dc79427b8f7eeb6a7ff68034ab8548ce670eaAlexander Gutkin exit $ret 7815b6dc79427b8f7eeb6a7ff68034ab8548ce670eaAlexander Gutkin fi 782f4c12fce1ee58e670f9c3fce46c40296ba9ee8a2Ian Hodson} 783f4c12fce1ee58e670f9c3fce46c40296ba9ee8a2Ian Hodson 784f4c12fce1ee58e670f9c3fce46c40296ba9ee8a2Ian Hodson# func_missing_arg argname 785f4c12fce1ee58e670f9c3fce46c40296ba9ee8a2Ian Hodson# Echo program name prefixed message to standard error and set global 786f4c12fce1ee58e670f9c3fce46c40296ba9ee8a2Ian Hodson# exit_cmd. 787f4c12fce1ee58e670f9c3fce46c40296ba9ee8a2Ian Hodsonfunc_missing_arg () 788f4c12fce1ee58e670f9c3fce46c40296ba9ee8a2Ian Hodson{ 7895b6dc79427b8f7eeb6a7ff68034ab8548ce670eaAlexander Gutkin $opt_debug 7905b6dc79427b8f7eeb6a7ff68034ab8548ce670eaAlexander Gutkin 7915b6dc79427b8f7eeb6a7ff68034ab8548ce670eaAlexander Gutkin func_error "missing argument for $1." 792f4c12fce1ee58e670f9c3fce46c40296ba9ee8a2Ian Hodson exit_cmd=exit 793f4c12fce1ee58e670f9c3fce46c40296ba9ee8a2Ian Hodson} 794f4c12fce1ee58e670f9c3fce46c40296ba9ee8a2Ian Hodson 795f4c12fce1ee58e670f9c3fce46c40296ba9ee8a2Ian Hodson 7965b6dc79427b8f7eeb6a7ff68034ab8548ce670eaAlexander Gutkin# func_split_short_opt shortopt 7975b6dc79427b8f7eeb6a7ff68034ab8548ce670eaAlexander Gutkin# Set func_split_short_opt_name and func_split_short_opt_arg shell 7985b6dc79427b8f7eeb6a7ff68034ab8548ce670eaAlexander Gutkin# variables after splitting SHORTOPT after the 2nd character. 7995b6dc79427b8f7eeb6a7ff68034ab8548ce670eaAlexander Gutkinfunc_split_short_opt () 8005b6dc79427b8f7eeb6a7ff68034ab8548ce670eaAlexander Gutkin{ 8015b6dc79427b8f7eeb6a7ff68034ab8548ce670eaAlexander Gutkin my_sed_short_opt='1s/^\(..\).*$/\1/;q' 8025b6dc79427b8f7eeb6a7ff68034ab8548ce670eaAlexander Gutkin my_sed_short_rest='1s/^..\(.*\)$/\1/;q' 803f4c12fce1ee58e670f9c3fce46c40296ba9ee8a2Ian Hodson 8045b6dc79427b8f7eeb6a7ff68034ab8548ce670eaAlexander Gutkin func_split_short_opt_name=`$ECHO "$1" | $SED "$my_sed_short_opt"` 8055b6dc79427b8f7eeb6a7ff68034ab8548ce670eaAlexander Gutkin func_split_short_opt_arg=`$ECHO "$1" | $SED "$my_sed_short_rest"` 8065b6dc79427b8f7eeb6a7ff68034ab8548ce670eaAlexander Gutkin} # func_split_short_opt may be replaced by extended shell implementation 8075b6dc79427b8f7eeb6a7ff68034ab8548ce670eaAlexander Gutkin 8085b6dc79427b8f7eeb6a7ff68034ab8548ce670eaAlexander Gutkin 8095b6dc79427b8f7eeb6a7ff68034ab8548ce670eaAlexander Gutkin# func_split_long_opt longopt 8105b6dc79427b8f7eeb6a7ff68034ab8548ce670eaAlexander Gutkin# Set func_split_long_opt_name and func_split_long_opt_arg shell 8115b6dc79427b8f7eeb6a7ff68034ab8548ce670eaAlexander Gutkin# variables after splitting LONGOPT at the `=' sign. 8125b6dc79427b8f7eeb6a7ff68034ab8548ce670eaAlexander Gutkinfunc_split_long_opt () 8135b6dc79427b8f7eeb6a7ff68034ab8548ce670eaAlexander Gutkin{ 8145b6dc79427b8f7eeb6a7ff68034ab8548ce670eaAlexander Gutkin my_sed_long_opt='1s/^\(--[^=]*\)=.*/\1/;q' 8155b6dc79427b8f7eeb6a7ff68034ab8548ce670eaAlexander Gutkin my_sed_long_arg='1s/^--[^=]*=//' 8165b6dc79427b8f7eeb6a7ff68034ab8548ce670eaAlexander Gutkin 8175b6dc79427b8f7eeb6a7ff68034ab8548ce670eaAlexander Gutkin func_split_long_opt_name=`$ECHO "$1" | $SED "$my_sed_long_opt"` 8185b6dc79427b8f7eeb6a7ff68034ab8548ce670eaAlexander Gutkin func_split_long_opt_arg=`$ECHO "$1" | $SED "$my_sed_long_arg"` 8195b6dc79427b8f7eeb6a7ff68034ab8548ce670eaAlexander Gutkin} # func_split_long_opt may be replaced by extended shell implementation 8205b6dc79427b8f7eeb6a7ff68034ab8548ce670eaAlexander Gutkin 8215b6dc79427b8f7eeb6a7ff68034ab8548ce670eaAlexander Gutkinexit_cmd=: 822f4c12fce1ee58e670f9c3fce46c40296ba9ee8a2Ian Hodson 823f4c12fce1ee58e670f9c3fce46c40296ba9ee8a2Ian Hodson 824f4c12fce1ee58e670f9c3fce46c40296ba9ee8a2Ian Hodson 825f4c12fce1ee58e670f9c3fce46c40296ba9ee8a2Ian Hodson 826f4c12fce1ee58e670f9c3fce46c40296ba9ee8a2Ian Hodson 827f4c12fce1ee58e670f9c3fce46c40296ba9ee8a2Ian Hodsonmagic="%%%MAGIC variable%%%" 828f4c12fce1ee58e670f9c3fce46c40296ba9ee8a2Ian Hodsonmagic_exe="%%%MAGIC EXE variable%%%" 829f4c12fce1ee58e670f9c3fce46c40296ba9ee8a2Ian Hodson 830f4c12fce1ee58e670f9c3fce46c40296ba9ee8a2Ian Hodson# Global variables. 831f4c12fce1ee58e670f9c3fce46c40296ba9ee8a2Ian Hodsonnonopt= 832f4c12fce1ee58e670f9c3fce46c40296ba9ee8a2Ian Hodsonpreserve_args= 833f4c12fce1ee58e670f9c3fce46c40296ba9ee8a2Ian Hodsonlo2o="s/\\.lo\$/.${objext}/" 834f4c12fce1ee58e670f9c3fce46c40296ba9ee8a2Ian Hodsono2lo="s/\\.${objext}\$/.lo/" 835f4c12fce1ee58e670f9c3fce46c40296ba9ee8a2Ian Hodsonextracted_archives= 836f4c12fce1ee58e670f9c3fce46c40296ba9ee8a2Ian Hodsonextracted_serial=0 837f4c12fce1ee58e670f9c3fce46c40296ba9ee8a2Ian Hodson 838f4c12fce1ee58e670f9c3fce46c40296ba9ee8a2Ian Hodson# If this variable is set in any of the actions, the command in it 839f4c12fce1ee58e670f9c3fce46c40296ba9ee8a2Ian Hodson# will be execed at the end. This prevents here-documents from being 840f4c12fce1ee58e670f9c3fce46c40296ba9ee8a2Ian Hodson# left over by shells. 841f4c12fce1ee58e670f9c3fce46c40296ba9ee8a2Ian Hodsonexec_cmd= 842f4c12fce1ee58e670f9c3fce46c40296ba9ee8a2Ian Hodson 8435b6dc79427b8f7eeb6a7ff68034ab8548ce670eaAlexander Gutkin# func_append var value 8445b6dc79427b8f7eeb6a7ff68034ab8548ce670eaAlexander Gutkin# Append VALUE to the end of shell variable VAR. 8455b6dc79427b8f7eeb6a7ff68034ab8548ce670eaAlexander Gutkinfunc_append () 8465b6dc79427b8f7eeb6a7ff68034ab8548ce670eaAlexander Gutkin{ 8475b6dc79427b8f7eeb6a7ff68034ab8548ce670eaAlexander Gutkin eval "${1}=\$${1}\${2}" 8485b6dc79427b8f7eeb6a7ff68034ab8548ce670eaAlexander Gutkin} # func_append may be replaced by extended shell implementation 8495b6dc79427b8f7eeb6a7ff68034ab8548ce670eaAlexander Gutkin 8505b6dc79427b8f7eeb6a7ff68034ab8548ce670eaAlexander Gutkin# func_append_quoted var value 8515b6dc79427b8f7eeb6a7ff68034ab8548ce670eaAlexander Gutkin# Quote VALUE and append to the end of shell variable VAR, separated 8525b6dc79427b8f7eeb6a7ff68034ab8548ce670eaAlexander Gutkin# by a space. 8535b6dc79427b8f7eeb6a7ff68034ab8548ce670eaAlexander Gutkinfunc_append_quoted () 8545b6dc79427b8f7eeb6a7ff68034ab8548ce670eaAlexander Gutkin{ 8555b6dc79427b8f7eeb6a7ff68034ab8548ce670eaAlexander Gutkin func_quote_for_eval "${2}" 8565b6dc79427b8f7eeb6a7ff68034ab8548ce670eaAlexander Gutkin eval "${1}=\$${1}\\ \$func_quote_for_eval_result" 8575b6dc79427b8f7eeb6a7ff68034ab8548ce670eaAlexander Gutkin} # func_append_quoted may be replaced by extended shell implementation 8585b6dc79427b8f7eeb6a7ff68034ab8548ce670eaAlexander Gutkin 8595b6dc79427b8f7eeb6a7ff68034ab8548ce670eaAlexander Gutkin 8605b6dc79427b8f7eeb6a7ff68034ab8548ce670eaAlexander Gutkin# func_arith arithmetic-term... 8615b6dc79427b8f7eeb6a7ff68034ab8548ce670eaAlexander Gutkinfunc_arith () 8625b6dc79427b8f7eeb6a7ff68034ab8548ce670eaAlexander Gutkin{ 8635b6dc79427b8f7eeb6a7ff68034ab8548ce670eaAlexander Gutkin func_arith_result=`expr "${@}"` 8645b6dc79427b8f7eeb6a7ff68034ab8548ce670eaAlexander Gutkin} # func_arith may be replaced by extended shell implementation 8655b6dc79427b8f7eeb6a7ff68034ab8548ce670eaAlexander Gutkin 8665b6dc79427b8f7eeb6a7ff68034ab8548ce670eaAlexander Gutkin 8675b6dc79427b8f7eeb6a7ff68034ab8548ce670eaAlexander Gutkin# func_len string 8685b6dc79427b8f7eeb6a7ff68034ab8548ce670eaAlexander Gutkin# STRING may not start with a hyphen. 8695b6dc79427b8f7eeb6a7ff68034ab8548ce670eaAlexander Gutkinfunc_len () 8705b6dc79427b8f7eeb6a7ff68034ab8548ce670eaAlexander Gutkin{ 8715b6dc79427b8f7eeb6a7ff68034ab8548ce670eaAlexander Gutkin func_len_result=`expr "${1}" : ".*" 2>/dev/null || echo $max_cmd_len` 8725b6dc79427b8f7eeb6a7ff68034ab8548ce670eaAlexander Gutkin} # func_len may be replaced by extended shell implementation 8735b6dc79427b8f7eeb6a7ff68034ab8548ce670eaAlexander Gutkin 8745b6dc79427b8f7eeb6a7ff68034ab8548ce670eaAlexander Gutkin 8755b6dc79427b8f7eeb6a7ff68034ab8548ce670eaAlexander Gutkin# func_lo2o object 8765b6dc79427b8f7eeb6a7ff68034ab8548ce670eaAlexander Gutkinfunc_lo2o () 8775b6dc79427b8f7eeb6a7ff68034ab8548ce670eaAlexander Gutkin{ 8785b6dc79427b8f7eeb6a7ff68034ab8548ce670eaAlexander Gutkin func_lo2o_result=`$ECHO "${1}" | $SED "$lo2o"` 8795b6dc79427b8f7eeb6a7ff68034ab8548ce670eaAlexander Gutkin} # func_lo2o may be replaced by extended shell implementation 8805b6dc79427b8f7eeb6a7ff68034ab8548ce670eaAlexander Gutkin 8815b6dc79427b8f7eeb6a7ff68034ab8548ce670eaAlexander Gutkin 8825b6dc79427b8f7eeb6a7ff68034ab8548ce670eaAlexander Gutkin# func_xform libobj-or-source 8835b6dc79427b8f7eeb6a7ff68034ab8548ce670eaAlexander Gutkinfunc_xform () 8845b6dc79427b8f7eeb6a7ff68034ab8548ce670eaAlexander Gutkin{ 8855b6dc79427b8f7eeb6a7ff68034ab8548ce670eaAlexander Gutkin func_xform_result=`$ECHO "${1}" | $SED 's/\.[^.]*$/.lo/'` 8865b6dc79427b8f7eeb6a7ff68034ab8548ce670eaAlexander Gutkin} # func_xform may be replaced by extended shell implementation 8875b6dc79427b8f7eeb6a7ff68034ab8548ce670eaAlexander Gutkin 8885b6dc79427b8f7eeb6a7ff68034ab8548ce670eaAlexander Gutkin 889f4c12fce1ee58e670f9c3fce46c40296ba9ee8a2Ian Hodson# func_fatal_configuration arg... 890f4c12fce1ee58e670f9c3fce46c40296ba9ee8a2Ian Hodson# Echo program name prefixed message to standard error, followed by 891f4c12fce1ee58e670f9c3fce46c40296ba9ee8a2Ian Hodson# a configuration failure hint, and exit. 892f4c12fce1ee58e670f9c3fce46c40296ba9ee8a2Ian Hodsonfunc_fatal_configuration () 893f4c12fce1ee58e670f9c3fce46c40296ba9ee8a2Ian Hodson{ 894f4c12fce1ee58e670f9c3fce46c40296ba9ee8a2Ian Hodson func_error ${1+"$@"} 895f4c12fce1ee58e670f9c3fce46c40296ba9ee8a2Ian Hodson func_error "See the $PACKAGE documentation for more information." 896f4c12fce1ee58e670f9c3fce46c40296ba9ee8a2Ian Hodson func_fatal_error "Fatal configuration error." 897f4c12fce1ee58e670f9c3fce46c40296ba9ee8a2Ian Hodson} 898f4c12fce1ee58e670f9c3fce46c40296ba9ee8a2Ian Hodson 899f4c12fce1ee58e670f9c3fce46c40296ba9ee8a2Ian Hodson 900f4c12fce1ee58e670f9c3fce46c40296ba9ee8a2Ian Hodson# func_config 901f4c12fce1ee58e670f9c3fce46c40296ba9ee8a2Ian Hodson# Display the configuration for all the tags in this script. 902f4c12fce1ee58e670f9c3fce46c40296ba9ee8a2Ian Hodsonfunc_config () 903f4c12fce1ee58e670f9c3fce46c40296ba9ee8a2Ian Hodson{ 904f4c12fce1ee58e670f9c3fce46c40296ba9ee8a2Ian Hodson re_begincf='^# ### BEGIN LIBTOOL' 905f4c12fce1ee58e670f9c3fce46c40296ba9ee8a2Ian Hodson re_endcf='^# ### END LIBTOOL' 906f4c12fce1ee58e670f9c3fce46c40296ba9ee8a2Ian Hodson 907f4c12fce1ee58e670f9c3fce46c40296ba9ee8a2Ian Hodson # Default configuration. 908f4c12fce1ee58e670f9c3fce46c40296ba9ee8a2Ian Hodson $SED "1,/$re_begincf CONFIG/d;/$re_endcf CONFIG/,\$d" < "$progpath" 909f4c12fce1ee58e670f9c3fce46c40296ba9ee8a2Ian Hodson 910f4c12fce1ee58e670f9c3fce46c40296ba9ee8a2Ian Hodson # Now print the configurations for the tags. 911f4c12fce1ee58e670f9c3fce46c40296ba9ee8a2Ian Hodson for tagname in $taglist; do 912f4c12fce1ee58e670f9c3fce46c40296ba9ee8a2Ian Hodson $SED -n "/$re_begincf TAG CONFIG: $tagname\$/,/$re_endcf TAG CONFIG: $tagname\$/p" < "$progpath" 913f4c12fce1ee58e670f9c3fce46c40296ba9ee8a2Ian Hodson done 914f4c12fce1ee58e670f9c3fce46c40296ba9ee8a2Ian Hodson 915f4c12fce1ee58e670f9c3fce46c40296ba9ee8a2Ian Hodson exit $? 916f4c12fce1ee58e670f9c3fce46c40296ba9ee8a2Ian Hodson} 917f4c12fce1ee58e670f9c3fce46c40296ba9ee8a2Ian Hodson 918f4c12fce1ee58e670f9c3fce46c40296ba9ee8a2Ian Hodson# func_features 919f4c12fce1ee58e670f9c3fce46c40296ba9ee8a2Ian Hodson# Display the features supported by this script. 920f4c12fce1ee58e670f9c3fce46c40296ba9ee8a2Ian Hodsonfunc_features () 921f4c12fce1ee58e670f9c3fce46c40296ba9ee8a2Ian Hodson{ 9225b6dc79427b8f7eeb6a7ff68034ab8548ce670eaAlexander Gutkin echo "host: $host" 923f4c12fce1ee58e670f9c3fce46c40296ba9ee8a2Ian Hodson if test "$build_libtool_libs" = yes; then 9245b6dc79427b8f7eeb6a7ff68034ab8548ce670eaAlexander Gutkin echo "enable shared libraries" 925f4c12fce1ee58e670f9c3fce46c40296ba9ee8a2Ian Hodson else 9265b6dc79427b8f7eeb6a7ff68034ab8548ce670eaAlexander Gutkin echo "disable shared libraries" 927f4c12fce1ee58e670f9c3fce46c40296ba9ee8a2Ian Hodson fi 928f4c12fce1ee58e670f9c3fce46c40296ba9ee8a2Ian Hodson if test "$build_old_libs" = yes; then 9295b6dc79427b8f7eeb6a7ff68034ab8548ce670eaAlexander Gutkin echo "enable static libraries" 930f4c12fce1ee58e670f9c3fce46c40296ba9ee8a2Ian Hodson else 9315b6dc79427b8f7eeb6a7ff68034ab8548ce670eaAlexander Gutkin echo "disable static libraries" 932f4c12fce1ee58e670f9c3fce46c40296ba9ee8a2Ian Hodson fi 933f4c12fce1ee58e670f9c3fce46c40296ba9ee8a2Ian Hodson 934f4c12fce1ee58e670f9c3fce46c40296ba9ee8a2Ian Hodson exit $? 935f4c12fce1ee58e670f9c3fce46c40296ba9ee8a2Ian Hodson} 936f4c12fce1ee58e670f9c3fce46c40296ba9ee8a2Ian Hodson 937f4c12fce1ee58e670f9c3fce46c40296ba9ee8a2Ian Hodson# func_enable_tag tagname 938f4c12fce1ee58e670f9c3fce46c40296ba9ee8a2Ian Hodson# Verify that TAGNAME is valid, and either flag an error and exit, or 939f4c12fce1ee58e670f9c3fce46c40296ba9ee8a2Ian Hodson# enable the TAGNAME tag. We also add TAGNAME to the global $taglist 940f4c12fce1ee58e670f9c3fce46c40296ba9ee8a2Ian Hodson# variable here. 941f4c12fce1ee58e670f9c3fce46c40296ba9ee8a2Ian Hodsonfunc_enable_tag () 942f4c12fce1ee58e670f9c3fce46c40296ba9ee8a2Ian Hodson{ 943f4c12fce1ee58e670f9c3fce46c40296ba9ee8a2Ian Hodson # Global variable: 944f4c12fce1ee58e670f9c3fce46c40296ba9ee8a2Ian Hodson tagname="$1" 945f4c12fce1ee58e670f9c3fce46c40296ba9ee8a2Ian Hodson 946f4c12fce1ee58e670f9c3fce46c40296ba9ee8a2Ian Hodson re_begincf="^# ### BEGIN LIBTOOL TAG CONFIG: $tagname\$" 947f4c12fce1ee58e670f9c3fce46c40296ba9ee8a2Ian Hodson re_endcf="^# ### END LIBTOOL TAG CONFIG: $tagname\$" 948f4c12fce1ee58e670f9c3fce46c40296ba9ee8a2Ian Hodson sed_extractcf="/$re_begincf/,/$re_endcf/p" 949f4c12fce1ee58e670f9c3fce46c40296ba9ee8a2Ian Hodson 950f4c12fce1ee58e670f9c3fce46c40296ba9ee8a2Ian Hodson # Validate tagname. 951f4c12fce1ee58e670f9c3fce46c40296ba9ee8a2Ian Hodson case $tagname in 952f4c12fce1ee58e670f9c3fce46c40296ba9ee8a2Ian Hodson *[!-_A-Za-z0-9,/]*) 953f4c12fce1ee58e670f9c3fce46c40296ba9ee8a2Ian Hodson func_fatal_error "invalid tag name: $tagname" 954f4c12fce1ee58e670f9c3fce46c40296ba9ee8a2Ian Hodson ;; 955f4c12fce1ee58e670f9c3fce46c40296ba9ee8a2Ian Hodson esac 956f4c12fce1ee58e670f9c3fce46c40296ba9ee8a2Ian Hodson 957f4c12fce1ee58e670f9c3fce46c40296ba9ee8a2Ian Hodson # Don't test for the "default" C tag, as we know it's 958f4c12fce1ee58e670f9c3fce46c40296ba9ee8a2Ian Hodson # there but not specially marked. 959f4c12fce1ee58e670f9c3fce46c40296ba9ee8a2Ian Hodson case $tagname in 960f4c12fce1ee58e670f9c3fce46c40296ba9ee8a2Ian Hodson CC) ;; 961f4c12fce1ee58e670f9c3fce46c40296ba9ee8a2Ian Hodson *) 962f4c12fce1ee58e670f9c3fce46c40296ba9ee8a2Ian Hodson if $GREP "$re_begincf" "$progpath" >/dev/null 2>&1; then 963f4c12fce1ee58e670f9c3fce46c40296ba9ee8a2Ian Hodson taglist="$taglist $tagname" 964f4c12fce1ee58e670f9c3fce46c40296ba9ee8a2Ian Hodson 965f4c12fce1ee58e670f9c3fce46c40296ba9ee8a2Ian Hodson # Evaluate the configuration. Be careful to quote the path 966f4c12fce1ee58e670f9c3fce46c40296ba9ee8a2Ian Hodson # and the sed script, to avoid splitting on whitespace, but 967f4c12fce1ee58e670f9c3fce46c40296ba9ee8a2Ian Hodson # also don't use non-portable quotes within backquotes within 968f4c12fce1ee58e670f9c3fce46c40296ba9ee8a2Ian Hodson # quotes we have to do it in 2 steps: 969f4c12fce1ee58e670f9c3fce46c40296ba9ee8a2Ian Hodson extractedcf=`$SED -n -e "$sed_extractcf" < "$progpath"` 970f4c12fce1ee58e670f9c3fce46c40296ba9ee8a2Ian Hodson eval "$extractedcf" 971f4c12fce1ee58e670f9c3fce46c40296ba9ee8a2Ian Hodson else 972f4c12fce1ee58e670f9c3fce46c40296ba9ee8a2Ian Hodson func_error "ignoring unknown tag $tagname" 973f4c12fce1ee58e670f9c3fce46c40296ba9ee8a2Ian Hodson fi 974f4c12fce1ee58e670f9c3fce46c40296ba9ee8a2Ian Hodson ;; 975f4c12fce1ee58e670f9c3fce46c40296ba9ee8a2Ian Hodson esac 976f4c12fce1ee58e670f9c3fce46c40296ba9ee8a2Ian Hodson} 977f4c12fce1ee58e670f9c3fce46c40296ba9ee8a2Ian Hodson 9785b6dc79427b8f7eeb6a7ff68034ab8548ce670eaAlexander Gutkin# func_check_version_match 9795b6dc79427b8f7eeb6a7ff68034ab8548ce670eaAlexander Gutkin# Ensure that we are using m4 macros, and libtool script from the same 9805b6dc79427b8f7eeb6a7ff68034ab8548ce670eaAlexander Gutkin# release of libtool. 9815b6dc79427b8f7eeb6a7ff68034ab8548ce670eaAlexander Gutkinfunc_check_version_match () 982f4c12fce1ee58e670f9c3fce46c40296ba9ee8a2Ian Hodson{ 9835b6dc79427b8f7eeb6a7ff68034ab8548ce670eaAlexander Gutkin if test "$package_revision" != "$macro_revision"; then 9845b6dc79427b8f7eeb6a7ff68034ab8548ce670eaAlexander Gutkin if test "$VERSION" != "$macro_version"; then 9855b6dc79427b8f7eeb6a7ff68034ab8548ce670eaAlexander Gutkin if test -z "$macro_version"; then 9865b6dc79427b8f7eeb6a7ff68034ab8548ce670eaAlexander Gutkin cat >&2 <<_LT_EOF 9875b6dc79427b8f7eeb6a7ff68034ab8548ce670eaAlexander Gutkin$progname: Version mismatch error. This is $PACKAGE $VERSION, but the 9885b6dc79427b8f7eeb6a7ff68034ab8548ce670eaAlexander Gutkin$progname: definition of this LT_INIT comes from an older release. 9895b6dc79427b8f7eeb6a7ff68034ab8548ce670eaAlexander Gutkin$progname: You should recreate aclocal.m4 with macros from $PACKAGE $VERSION 9905b6dc79427b8f7eeb6a7ff68034ab8548ce670eaAlexander Gutkin$progname: and run autoconf again. 9915b6dc79427b8f7eeb6a7ff68034ab8548ce670eaAlexander Gutkin_LT_EOF 9925b6dc79427b8f7eeb6a7ff68034ab8548ce670eaAlexander Gutkin else 9935b6dc79427b8f7eeb6a7ff68034ab8548ce670eaAlexander Gutkin cat >&2 <<_LT_EOF 9945b6dc79427b8f7eeb6a7ff68034ab8548ce670eaAlexander Gutkin$progname: Version mismatch error. This is $PACKAGE $VERSION, but the 9955b6dc79427b8f7eeb6a7ff68034ab8548ce670eaAlexander Gutkin$progname: definition of this LT_INIT comes from $PACKAGE $macro_version. 9965b6dc79427b8f7eeb6a7ff68034ab8548ce670eaAlexander Gutkin$progname: You should recreate aclocal.m4 with macros from $PACKAGE $VERSION 9975b6dc79427b8f7eeb6a7ff68034ab8548ce670eaAlexander Gutkin$progname: and run autoconf again. 9985b6dc79427b8f7eeb6a7ff68034ab8548ce670eaAlexander Gutkin_LT_EOF 9995b6dc79427b8f7eeb6a7ff68034ab8548ce670eaAlexander Gutkin fi 10005b6dc79427b8f7eeb6a7ff68034ab8548ce670eaAlexander Gutkin else 10015b6dc79427b8f7eeb6a7ff68034ab8548ce670eaAlexander Gutkin cat >&2 <<_LT_EOF 10025b6dc79427b8f7eeb6a7ff68034ab8548ce670eaAlexander Gutkin$progname: Version mismatch error. This is $PACKAGE $VERSION, revision $package_revision, 10035b6dc79427b8f7eeb6a7ff68034ab8548ce670eaAlexander Gutkin$progname: but the definition of this LT_INIT comes from revision $macro_revision. 10045b6dc79427b8f7eeb6a7ff68034ab8548ce670eaAlexander Gutkin$progname: You should recreate aclocal.m4 with macros from revision $package_revision 10055b6dc79427b8f7eeb6a7ff68034ab8548ce670eaAlexander Gutkin$progname: of $PACKAGE $VERSION and run autoconf again. 10065b6dc79427b8f7eeb6a7ff68034ab8548ce670eaAlexander Gutkin_LT_EOF 10075b6dc79427b8f7eeb6a7ff68034ab8548ce670eaAlexander Gutkin fi 10085b6dc79427b8f7eeb6a7ff68034ab8548ce670eaAlexander Gutkin 10095b6dc79427b8f7eeb6a7ff68034ab8548ce670eaAlexander Gutkin exit $EXIT_MISMATCH 10105b6dc79427b8f7eeb6a7ff68034ab8548ce670eaAlexander Gutkin fi 10115b6dc79427b8f7eeb6a7ff68034ab8548ce670eaAlexander Gutkin} 10125b6dc79427b8f7eeb6a7ff68034ab8548ce670eaAlexander Gutkin 10135b6dc79427b8f7eeb6a7ff68034ab8548ce670eaAlexander Gutkin 10145b6dc79427b8f7eeb6a7ff68034ab8548ce670eaAlexander Gutkin# Shorthand for --mode=foo, only valid as the first argument 10155b6dc79427b8f7eeb6a7ff68034ab8548ce670eaAlexander Gutkincase $1 in 10165b6dc79427b8f7eeb6a7ff68034ab8548ce670eaAlexander Gutkinclean|clea|cle|cl) 10175b6dc79427b8f7eeb6a7ff68034ab8548ce670eaAlexander Gutkin shift; set dummy --mode clean ${1+"$@"}; shift 10185b6dc79427b8f7eeb6a7ff68034ab8548ce670eaAlexander Gutkin ;; 10195b6dc79427b8f7eeb6a7ff68034ab8548ce670eaAlexander Gutkincompile|compil|compi|comp|com|co|c) 10205b6dc79427b8f7eeb6a7ff68034ab8548ce670eaAlexander Gutkin shift; set dummy --mode compile ${1+"$@"}; shift 10215b6dc79427b8f7eeb6a7ff68034ab8548ce670eaAlexander Gutkin ;; 10225b6dc79427b8f7eeb6a7ff68034ab8548ce670eaAlexander Gutkinexecute|execut|execu|exec|exe|ex|e) 10235b6dc79427b8f7eeb6a7ff68034ab8548ce670eaAlexander Gutkin shift; set dummy --mode execute ${1+"$@"}; shift 10245b6dc79427b8f7eeb6a7ff68034ab8548ce670eaAlexander Gutkin ;; 10255b6dc79427b8f7eeb6a7ff68034ab8548ce670eaAlexander Gutkinfinish|finis|fini|fin|fi|f) 10265b6dc79427b8f7eeb6a7ff68034ab8548ce670eaAlexander Gutkin shift; set dummy --mode finish ${1+"$@"}; shift 10275b6dc79427b8f7eeb6a7ff68034ab8548ce670eaAlexander Gutkin ;; 10285b6dc79427b8f7eeb6a7ff68034ab8548ce670eaAlexander Gutkininstall|instal|insta|inst|ins|in|i) 10295b6dc79427b8f7eeb6a7ff68034ab8548ce670eaAlexander Gutkin shift; set dummy --mode install ${1+"$@"}; shift 10305b6dc79427b8f7eeb6a7ff68034ab8548ce670eaAlexander Gutkin ;; 10315b6dc79427b8f7eeb6a7ff68034ab8548ce670eaAlexander Gutkinlink|lin|li|l) 10325b6dc79427b8f7eeb6a7ff68034ab8548ce670eaAlexander Gutkin shift; set dummy --mode link ${1+"$@"}; shift 10335b6dc79427b8f7eeb6a7ff68034ab8548ce670eaAlexander Gutkin ;; 10345b6dc79427b8f7eeb6a7ff68034ab8548ce670eaAlexander Gutkinuninstall|uninstal|uninsta|uninst|unins|unin|uni|un|u) 10355b6dc79427b8f7eeb6a7ff68034ab8548ce670eaAlexander Gutkin shift; set dummy --mode uninstall ${1+"$@"}; shift 10365b6dc79427b8f7eeb6a7ff68034ab8548ce670eaAlexander Gutkin ;; 10375b6dc79427b8f7eeb6a7ff68034ab8548ce670eaAlexander Gutkinesac 10385b6dc79427b8f7eeb6a7ff68034ab8548ce670eaAlexander Gutkin 10395b6dc79427b8f7eeb6a7ff68034ab8548ce670eaAlexander Gutkin 10405b6dc79427b8f7eeb6a7ff68034ab8548ce670eaAlexander Gutkin 10415b6dc79427b8f7eeb6a7ff68034ab8548ce670eaAlexander Gutkin# Option defaults: 10425b6dc79427b8f7eeb6a7ff68034ab8548ce670eaAlexander Gutkinopt_debug=: 10435b6dc79427b8f7eeb6a7ff68034ab8548ce670eaAlexander Gutkinopt_dry_run=false 10445b6dc79427b8f7eeb6a7ff68034ab8548ce670eaAlexander Gutkinopt_config=false 10455b6dc79427b8f7eeb6a7ff68034ab8548ce670eaAlexander Gutkinopt_preserve_dup_deps=false 10465b6dc79427b8f7eeb6a7ff68034ab8548ce670eaAlexander Gutkinopt_features=false 10475b6dc79427b8f7eeb6a7ff68034ab8548ce670eaAlexander Gutkinopt_finish=false 10485b6dc79427b8f7eeb6a7ff68034ab8548ce670eaAlexander Gutkinopt_help=false 10495b6dc79427b8f7eeb6a7ff68034ab8548ce670eaAlexander Gutkinopt_help_all=false 10505b6dc79427b8f7eeb6a7ff68034ab8548ce670eaAlexander Gutkinopt_silent=: 10515b6dc79427b8f7eeb6a7ff68034ab8548ce670eaAlexander Gutkinopt_warning=: 10525b6dc79427b8f7eeb6a7ff68034ab8548ce670eaAlexander Gutkinopt_verbose=: 10535b6dc79427b8f7eeb6a7ff68034ab8548ce670eaAlexander Gutkinopt_silent=false 10545b6dc79427b8f7eeb6a7ff68034ab8548ce670eaAlexander Gutkinopt_verbose=false 1055f4c12fce1ee58e670f9c3fce46c40296ba9ee8a2Ian Hodson 1056f4c12fce1ee58e670f9c3fce46c40296ba9ee8a2Ian Hodson 10575b6dc79427b8f7eeb6a7ff68034ab8548ce670eaAlexander Gutkin# Parse options once, thoroughly. This comes as soon as possible in the 10585b6dc79427b8f7eeb6a7ff68034ab8548ce670eaAlexander Gutkin# script to make things like `--version' happen as quickly as we can. 10595b6dc79427b8f7eeb6a7ff68034ab8548ce670eaAlexander Gutkin{ 10605b6dc79427b8f7eeb6a7ff68034ab8548ce670eaAlexander Gutkin # this just eases exit handling 10615b6dc79427b8f7eeb6a7ff68034ab8548ce670eaAlexander Gutkin while test $# -gt 0; do 1062f4c12fce1ee58e670f9c3fce46c40296ba9ee8a2Ian Hodson opt="$1" 1063f4c12fce1ee58e670f9c3fce46c40296ba9ee8a2Ian Hodson shift 1064f4c12fce1ee58e670f9c3fce46c40296ba9ee8a2Ian Hodson case $opt in 10655b6dc79427b8f7eeb6a7ff68034ab8548ce670eaAlexander Gutkin --debug|-x) opt_debug='set -x' 1066f4c12fce1ee58e670f9c3fce46c40296ba9ee8a2Ian Hodson func_echo "enabling shell trace mode" 1067f4c12fce1ee58e670f9c3fce46c40296ba9ee8a2Ian Hodson $opt_debug 1068f4c12fce1ee58e670f9c3fce46c40296ba9ee8a2Ian Hodson ;; 10695b6dc79427b8f7eeb6a7ff68034ab8548ce670eaAlexander Gutkin --dry-run|--dryrun|-n) 10705b6dc79427b8f7eeb6a7ff68034ab8548ce670eaAlexander Gutkin opt_dry_run=: 1071f4c12fce1ee58e670f9c3fce46c40296ba9ee8a2Ian Hodson ;; 10725b6dc79427b8f7eeb6a7ff68034ab8548ce670eaAlexander Gutkin --config) 10735b6dc79427b8f7eeb6a7ff68034ab8548ce670eaAlexander Gutkin opt_config=: 10745b6dc79427b8f7eeb6a7ff68034ab8548ce670eaAlexander Gutkinfunc_config 10755b6dc79427b8f7eeb6a7ff68034ab8548ce670eaAlexander Gutkin ;; 10765b6dc79427b8f7eeb6a7ff68034ab8548ce670eaAlexander Gutkin --dlopen|-dlopen) 10775b6dc79427b8f7eeb6a7ff68034ab8548ce670eaAlexander Gutkin optarg="$1" 10785b6dc79427b8f7eeb6a7ff68034ab8548ce670eaAlexander Gutkin opt_dlopen="${opt_dlopen+$opt_dlopen 10795b6dc79427b8f7eeb6a7ff68034ab8548ce670eaAlexander Gutkin}$optarg" 1080f4c12fce1ee58e670f9c3fce46c40296ba9ee8a2Ian Hodson shift 1081f4c12fce1ee58e670f9c3fce46c40296ba9ee8a2Ian Hodson ;; 1082f4c12fce1ee58e670f9c3fce46c40296ba9ee8a2Ian Hodson --preserve-dup-deps) 10835b6dc79427b8f7eeb6a7ff68034ab8548ce670eaAlexander Gutkin opt_preserve_dup_deps=: 1084f4c12fce1ee58e670f9c3fce46c40296ba9ee8a2Ian Hodson ;; 10855b6dc79427b8f7eeb6a7ff68034ab8548ce670eaAlexander Gutkin --features) 10865b6dc79427b8f7eeb6a7ff68034ab8548ce670eaAlexander Gutkin opt_features=: 10875b6dc79427b8f7eeb6a7ff68034ab8548ce670eaAlexander Gutkinfunc_features 10885b6dc79427b8f7eeb6a7ff68034ab8548ce670eaAlexander Gutkin ;; 10895b6dc79427b8f7eeb6a7ff68034ab8548ce670eaAlexander Gutkin --finish) 10905b6dc79427b8f7eeb6a7ff68034ab8548ce670eaAlexander Gutkin opt_finish=: 10915b6dc79427b8f7eeb6a7ff68034ab8548ce670eaAlexander Gutkinset dummy --mode finish ${1+"$@"}; shift 10925b6dc79427b8f7eeb6a7ff68034ab8548ce670eaAlexander Gutkin ;; 10935b6dc79427b8f7eeb6a7ff68034ab8548ce670eaAlexander Gutkin --help) 10945b6dc79427b8f7eeb6a7ff68034ab8548ce670eaAlexander Gutkin opt_help=: 10955b6dc79427b8f7eeb6a7ff68034ab8548ce670eaAlexander Gutkin ;; 10965b6dc79427b8f7eeb6a7ff68034ab8548ce670eaAlexander Gutkin --help-all) 10975b6dc79427b8f7eeb6a7ff68034ab8548ce670eaAlexander Gutkin opt_help_all=: 10985b6dc79427b8f7eeb6a7ff68034ab8548ce670eaAlexander Gutkinopt_help=': help-all' 10995b6dc79427b8f7eeb6a7ff68034ab8548ce670eaAlexander Gutkin ;; 11005b6dc79427b8f7eeb6a7ff68034ab8548ce670eaAlexander Gutkin --mode) 11015b6dc79427b8f7eeb6a7ff68034ab8548ce670eaAlexander Gutkin test $# = 0 && func_missing_arg $opt && break 11025b6dc79427b8f7eeb6a7ff68034ab8548ce670eaAlexander Gutkin optarg="$1" 11035b6dc79427b8f7eeb6a7ff68034ab8548ce670eaAlexander Gutkin opt_mode="$optarg" 11045b6dc79427b8f7eeb6a7ff68034ab8548ce670eaAlexander Gutkincase $optarg in 11055b6dc79427b8f7eeb6a7ff68034ab8548ce670eaAlexander Gutkin # Valid mode arguments: 11065b6dc79427b8f7eeb6a7ff68034ab8548ce670eaAlexander Gutkin clean|compile|execute|finish|install|link|relink|uninstall) ;; 11075b6dc79427b8f7eeb6a7ff68034ab8548ce670eaAlexander Gutkin 11085b6dc79427b8f7eeb6a7ff68034ab8548ce670eaAlexander Gutkin # Catch anything else as an error 11095b6dc79427b8f7eeb6a7ff68034ab8548ce670eaAlexander Gutkin *) func_error "invalid argument for $opt" 11105b6dc79427b8f7eeb6a7ff68034ab8548ce670eaAlexander Gutkin exit_cmd=exit 11115b6dc79427b8f7eeb6a7ff68034ab8548ce670eaAlexander Gutkin break 11125b6dc79427b8f7eeb6a7ff68034ab8548ce670eaAlexander Gutkin ;; 11135b6dc79427b8f7eeb6a7ff68034ab8548ce670eaAlexander Gutkinesac 11145b6dc79427b8f7eeb6a7ff68034ab8548ce670eaAlexander Gutkin shift 11155b6dc79427b8f7eeb6a7ff68034ab8548ce670eaAlexander Gutkin ;; 11165b6dc79427b8f7eeb6a7ff68034ab8548ce670eaAlexander Gutkin --no-silent|--no-quiet) 1117f4c12fce1ee58e670f9c3fce46c40296ba9ee8a2Ian Hodson opt_silent=false 11185b6dc79427b8f7eeb6a7ff68034ab8548ce670eaAlexander Gutkinfunc_append preserve_args " $opt" 1119f4c12fce1ee58e670f9c3fce46c40296ba9ee8a2Ian Hodson ;; 11205b6dc79427b8f7eeb6a7ff68034ab8548ce670eaAlexander Gutkin --no-warning|--no-warn) 11215b6dc79427b8f7eeb6a7ff68034ab8548ce670eaAlexander Gutkin opt_warning=false 11225b6dc79427b8f7eeb6a7ff68034ab8548ce670eaAlexander Gutkinfunc_append preserve_args " $opt" 11235b6dc79427b8f7eeb6a7ff68034ab8548ce670eaAlexander Gutkin ;; 11245b6dc79427b8f7eeb6a7ff68034ab8548ce670eaAlexander Gutkin --no-verbose) 11255b6dc79427b8f7eeb6a7ff68034ab8548ce670eaAlexander Gutkin opt_verbose=false 11265b6dc79427b8f7eeb6a7ff68034ab8548ce670eaAlexander Gutkinfunc_append preserve_args " $opt" 11275b6dc79427b8f7eeb6a7ff68034ab8548ce670eaAlexander Gutkin ;; 11285b6dc79427b8f7eeb6a7ff68034ab8548ce670eaAlexander Gutkin --silent|--quiet) 11295b6dc79427b8f7eeb6a7ff68034ab8548ce670eaAlexander Gutkin opt_silent=: 11305b6dc79427b8f7eeb6a7ff68034ab8548ce670eaAlexander Gutkinfunc_append preserve_args " $opt" 11315b6dc79427b8f7eeb6a7ff68034ab8548ce670eaAlexander Gutkin opt_verbose=false 11325b6dc79427b8f7eeb6a7ff68034ab8548ce670eaAlexander Gutkin ;; 11335b6dc79427b8f7eeb6a7ff68034ab8548ce670eaAlexander Gutkin --verbose|-v) 11345b6dc79427b8f7eeb6a7ff68034ab8548ce670eaAlexander Gutkin opt_verbose=: 11355b6dc79427b8f7eeb6a7ff68034ab8548ce670eaAlexander Gutkinfunc_append preserve_args " $opt" 11365b6dc79427b8f7eeb6a7ff68034ab8548ce670eaAlexander Gutkinopt_silent=false 11375b6dc79427b8f7eeb6a7ff68034ab8548ce670eaAlexander Gutkin ;; 11385b6dc79427b8f7eeb6a7ff68034ab8548ce670eaAlexander Gutkin --tag) 11395b6dc79427b8f7eeb6a7ff68034ab8548ce670eaAlexander Gutkin test $# = 0 && func_missing_arg $opt && break 11405b6dc79427b8f7eeb6a7ff68034ab8548ce670eaAlexander Gutkin optarg="$1" 11415b6dc79427b8f7eeb6a7ff68034ab8548ce670eaAlexander Gutkin opt_tag="$optarg" 11425b6dc79427b8f7eeb6a7ff68034ab8548ce670eaAlexander Gutkinfunc_append preserve_args " $opt $optarg" 11435b6dc79427b8f7eeb6a7ff68034ab8548ce670eaAlexander Gutkinfunc_enable_tag "$optarg" 1144f4c12fce1ee58e670f9c3fce46c40296ba9ee8a2Ian Hodson shift 1145f4c12fce1ee58e670f9c3fce46c40296ba9ee8a2Ian Hodson ;; 1146f4c12fce1ee58e670f9c3fce46c40296ba9ee8a2Ian Hodson 11475b6dc79427b8f7eeb6a7ff68034ab8548ce670eaAlexander Gutkin -\?|-h) func_usage ;; 11485b6dc79427b8f7eeb6a7ff68034ab8548ce670eaAlexander Gutkin --help) func_help ;; 11495b6dc79427b8f7eeb6a7ff68034ab8548ce670eaAlexander Gutkin --version) func_version ;; 11505b6dc79427b8f7eeb6a7ff68034ab8548ce670eaAlexander Gutkin 1151f4c12fce1ee58e670f9c3fce46c40296ba9ee8a2Ian Hodson # Separate optargs to long options: 11525b6dc79427b8f7eeb6a7ff68034ab8548ce670eaAlexander Gutkin --*=*) 11535b6dc79427b8f7eeb6a7ff68034ab8548ce670eaAlexander Gutkin func_split_long_opt "$opt" 11545b6dc79427b8f7eeb6a7ff68034ab8548ce670eaAlexander Gutkin set dummy "$func_split_long_opt_name" "$func_split_long_opt_arg" ${1+"$@"} 1155f4c12fce1ee58e670f9c3fce46c40296ba9ee8a2Ian Hodson shift 1156f4c12fce1ee58e670f9c3fce46c40296ba9ee8a2Ian Hodson ;; 1157f4c12fce1ee58e670f9c3fce46c40296ba9ee8a2Ian Hodson 11585b6dc79427b8f7eeb6a7ff68034ab8548ce670eaAlexander Gutkin # Separate non-argument short options: 11595b6dc79427b8f7eeb6a7ff68034ab8548ce670eaAlexander Gutkin -\?*|-h*|-n*|-v*) 11605b6dc79427b8f7eeb6a7ff68034ab8548ce670eaAlexander Gutkin func_split_short_opt "$opt" 11615b6dc79427b8f7eeb6a7ff68034ab8548ce670eaAlexander Gutkin set dummy "$func_split_short_opt_name" "-$func_split_short_opt_arg" ${1+"$@"} 11625b6dc79427b8f7eeb6a7ff68034ab8548ce670eaAlexander Gutkin shift 1163f4c12fce1ee58e670f9c3fce46c40296ba9ee8a2Ian Hodson ;; 11645b6dc79427b8f7eeb6a7ff68034ab8548ce670eaAlexander Gutkin 11655b6dc79427b8f7eeb6a7ff68034ab8548ce670eaAlexander Gutkin --) break ;; 11665b6dc79427b8f7eeb6a7ff68034ab8548ce670eaAlexander Gutkin -*) func_fatal_help "unrecognized option \`$opt'" ;; 11675b6dc79427b8f7eeb6a7ff68034ab8548ce670eaAlexander Gutkin *) set dummy "$opt" ${1+"$@"}; shift; break ;; 1168f4c12fce1ee58e670f9c3fce46c40296ba9ee8a2Ian Hodson esac 1169f4c12fce1ee58e670f9c3fce46c40296ba9ee8a2Ian Hodson done 1170f4c12fce1ee58e670f9c3fce46c40296ba9ee8a2Ian Hodson 11715b6dc79427b8f7eeb6a7ff68034ab8548ce670eaAlexander Gutkin # Validate options: 11725b6dc79427b8f7eeb6a7ff68034ab8548ce670eaAlexander Gutkin 11735b6dc79427b8f7eeb6a7ff68034ab8548ce670eaAlexander Gutkin # save first non-option argument 11745b6dc79427b8f7eeb6a7ff68034ab8548ce670eaAlexander Gutkin if test "$#" -gt 0; then 11755b6dc79427b8f7eeb6a7ff68034ab8548ce670eaAlexander Gutkin nonopt="$opt" 11765b6dc79427b8f7eeb6a7ff68034ab8548ce670eaAlexander Gutkin shift 11775b6dc79427b8f7eeb6a7ff68034ab8548ce670eaAlexander Gutkin fi 11785b6dc79427b8f7eeb6a7ff68034ab8548ce670eaAlexander Gutkin 11795b6dc79427b8f7eeb6a7ff68034ab8548ce670eaAlexander Gutkin # preserve --debug 11805b6dc79427b8f7eeb6a7ff68034ab8548ce670eaAlexander Gutkin test "$opt_debug" = : || func_append preserve_args " --debug" 1181f4c12fce1ee58e670f9c3fce46c40296ba9ee8a2Ian Hodson 1182f4c12fce1ee58e670f9c3fce46c40296ba9ee8a2Ian Hodson case $host in 1183f4c12fce1ee58e670f9c3fce46c40296ba9ee8a2Ian Hodson *cygwin* | *mingw* | *pw32* | *cegcc*) 1184f4c12fce1ee58e670f9c3fce46c40296ba9ee8a2Ian Hodson # don't eliminate duplications in $postdeps and $predeps 1185f4c12fce1ee58e670f9c3fce46c40296ba9ee8a2Ian Hodson opt_duplicate_compiler_generated_deps=: 1186f4c12fce1ee58e670f9c3fce46c40296ba9ee8a2Ian Hodson ;; 1187f4c12fce1ee58e670f9c3fce46c40296ba9ee8a2Ian Hodson *) 11885b6dc79427b8f7eeb6a7ff68034ab8548ce670eaAlexander Gutkin opt_duplicate_compiler_generated_deps=$opt_preserve_dup_deps 1189f4c12fce1ee58e670f9c3fce46c40296ba9ee8a2Ian Hodson ;; 1190f4c12fce1ee58e670f9c3fce46c40296ba9ee8a2Ian Hodson esac 1191f4c12fce1ee58e670f9c3fce46c40296ba9ee8a2Ian Hodson 11925b6dc79427b8f7eeb6a7ff68034ab8548ce670eaAlexander Gutkin $opt_help || { 11935b6dc79427b8f7eeb6a7ff68034ab8548ce670eaAlexander Gutkin # Sanity checks first: 11945b6dc79427b8f7eeb6a7ff68034ab8548ce670eaAlexander Gutkin func_check_version_match 1195f4c12fce1ee58e670f9c3fce46c40296ba9ee8a2Ian Hodson 11965b6dc79427b8f7eeb6a7ff68034ab8548ce670eaAlexander Gutkin if test "$build_libtool_libs" != yes && test "$build_old_libs" != yes; then 11975b6dc79427b8f7eeb6a7ff68034ab8548ce670eaAlexander Gutkin func_fatal_configuration "not configured to build any kind of library" 1198f4c12fce1ee58e670f9c3fce46c40296ba9ee8a2Ian Hodson fi 1199f4c12fce1ee58e670f9c3fce46c40296ba9ee8a2Ian Hodson 12005b6dc79427b8f7eeb6a7ff68034ab8548ce670eaAlexander Gutkin # Darwin sucks 12015b6dc79427b8f7eeb6a7ff68034ab8548ce670eaAlexander Gutkin eval std_shrext=\"$shrext_cmds\" 1202f4c12fce1ee58e670f9c3fce46c40296ba9ee8a2Ian Hodson 12035b6dc79427b8f7eeb6a7ff68034ab8548ce670eaAlexander Gutkin # Only execute mode is allowed to have -dlopen flags. 12045b6dc79427b8f7eeb6a7ff68034ab8548ce670eaAlexander Gutkin if test -n "$opt_dlopen" && test "$opt_mode" != execute; then 12055b6dc79427b8f7eeb6a7ff68034ab8548ce670eaAlexander Gutkin func_error "unrecognized option \`-dlopen'" 12065b6dc79427b8f7eeb6a7ff68034ab8548ce670eaAlexander Gutkin $ECHO "$help" 1>&2 12075b6dc79427b8f7eeb6a7ff68034ab8548ce670eaAlexander Gutkin exit $EXIT_FAILURE 12085b6dc79427b8f7eeb6a7ff68034ab8548ce670eaAlexander Gutkin fi 1209f4c12fce1ee58e670f9c3fce46c40296ba9ee8a2Ian Hodson 12105b6dc79427b8f7eeb6a7ff68034ab8548ce670eaAlexander Gutkin # Change the help message to a mode-specific one. 12115b6dc79427b8f7eeb6a7ff68034ab8548ce670eaAlexander Gutkin generic_help="$help" 12125b6dc79427b8f7eeb6a7ff68034ab8548ce670eaAlexander Gutkin help="Try \`$progname --help --mode=$opt_mode' for more information." 12135b6dc79427b8f7eeb6a7ff68034ab8548ce670eaAlexander Gutkin } 1214f4c12fce1ee58e670f9c3fce46c40296ba9ee8a2Ian Hodson 1215f4c12fce1ee58e670f9c3fce46c40296ba9ee8a2Ian Hodson 12165b6dc79427b8f7eeb6a7ff68034ab8548ce670eaAlexander Gutkin # Bail if the options were screwed 12175b6dc79427b8f7eeb6a7ff68034ab8548ce670eaAlexander Gutkin $exit_cmd $EXIT_FAILURE 12185b6dc79427b8f7eeb6a7ff68034ab8548ce670eaAlexander Gutkin} 1219f4c12fce1ee58e670f9c3fce46c40296ba9ee8a2Ian Hodson 1220f4c12fce1ee58e670f9c3fce46c40296ba9ee8a2Ian Hodson 1221f4c12fce1ee58e670f9c3fce46c40296ba9ee8a2Ian Hodson 1222f4c12fce1ee58e670f9c3fce46c40296ba9ee8a2Ian Hodson 12235b6dc79427b8f7eeb6a7ff68034ab8548ce670eaAlexander Gutkin## ----------- ## 12245b6dc79427b8f7eeb6a7ff68034ab8548ce670eaAlexander Gutkin## Main. ## 12255b6dc79427b8f7eeb6a7ff68034ab8548ce670eaAlexander Gutkin## ----------- ## 1226f4c12fce1ee58e670f9c3fce46c40296ba9ee8a2Ian Hodson 1227f4c12fce1ee58e670f9c3fce46c40296ba9ee8a2Ian Hodson# func_lalib_p file 1228f4c12fce1ee58e670f9c3fce46c40296ba9ee8a2Ian Hodson# True iff FILE is a libtool `.la' library or `.lo' object file. 1229f4c12fce1ee58e670f9c3fce46c40296ba9ee8a2Ian Hodson# This function is only a basic sanity check; it will hardly flush out 1230f4c12fce1ee58e670f9c3fce46c40296ba9ee8a2Ian Hodson# determined imposters. 1231f4c12fce1ee58e670f9c3fce46c40296ba9ee8a2Ian Hodsonfunc_lalib_p () 1232f4c12fce1ee58e670f9c3fce46c40296ba9ee8a2Ian Hodson{ 1233f4c12fce1ee58e670f9c3fce46c40296ba9ee8a2Ian Hodson test -f "$1" && 1234f4c12fce1ee58e670f9c3fce46c40296ba9ee8a2Ian Hodson $SED -e 4q "$1" 2>/dev/null \ 1235f4c12fce1ee58e670f9c3fce46c40296ba9ee8a2Ian Hodson | $GREP "^# Generated by .*$PACKAGE" > /dev/null 2>&1 1236f4c12fce1ee58e670f9c3fce46c40296ba9ee8a2Ian Hodson} 1237f4c12fce1ee58e670f9c3fce46c40296ba9ee8a2Ian Hodson 1238f4c12fce1ee58e670f9c3fce46c40296ba9ee8a2Ian Hodson# func_lalib_unsafe_p file 1239f4c12fce1ee58e670f9c3fce46c40296ba9ee8a2Ian Hodson# True iff FILE is a libtool `.la' library or `.lo' object file. 1240f4c12fce1ee58e670f9c3fce46c40296ba9ee8a2Ian Hodson# This function implements the same check as func_lalib_p without 1241f4c12fce1ee58e670f9c3fce46c40296ba9ee8a2Ian Hodson# resorting to external programs. To this end, it redirects stdin and 1242f4c12fce1ee58e670f9c3fce46c40296ba9ee8a2Ian Hodson# closes it afterwards, without saving the original file descriptor. 1243f4c12fce1ee58e670f9c3fce46c40296ba9ee8a2Ian Hodson# As a safety measure, use it only where a negative result would be 1244f4c12fce1ee58e670f9c3fce46c40296ba9ee8a2Ian Hodson# fatal anyway. Works if `file' does not exist. 1245f4c12fce1ee58e670f9c3fce46c40296ba9ee8a2Ian Hodsonfunc_lalib_unsafe_p () 1246f4c12fce1ee58e670f9c3fce46c40296ba9ee8a2Ian Hodson{ 1247f4c12fce1ee58e670f9c3fce46c40296ba9ee8a2Ian Hodson lalib_p=no 1248f4c12fce1ee58e670f9c3fce46c40296ba9ee8a2Ian Hodson if test -f "$1" && test -r "$1" && exec 5<&0 <"$1"; then 1249f4c12fce1ee58e670f9c3fce46c40296ba9ee8a2Ian Hodson for lalib_p_l in 1 2 3 4 1250f4c12fce1ee58e670f9c3fce46c40296ba9ee8a2Ian Hodson do 1251f4c12fce1ee58e670f9c3fce46c40296ba9ee8a2Ian Hodson read lalib_p_line 1252f4c12fce1ee58e670f9c3fce46c40296ba9ee8a2Ian Hodson case "$lalib_p_line" in 1253f4c12fce1ee58e670f9c3fce46c40296ba9ee8a2Ian Hodson \#\ Generated\ by\ *$PACKAGE* ) lalib_p=yes; break;; 1254f4c12fce1ee58e670f9c3fce46c40296ba9ee8a2Ian Hodson esac 1255f4c12fce1ee58e670f9c3fce46c40296ba9ee8a2Ian Hodson done 1256f4c12fce1ee58e670f9c3fce46c40296ba9ee8a2Ian Hodson exec 0<&5 5<&- 1257f4c12fce1ee58e670f9c3fce46c40296ba9ee8a2Ian Hodson fi 1258f4c12fce1ee58e670f9c3fce46c40296ba9ee8a2Ian Hodson test "$lalib_p" = yes 1259f4c12fce1ee58e670f9c3fce46c40296ba9ee8a2Ian Hodson} 1260f4c12fce1ee58e670f9c3fce46c40296ba9ee8a2Ian Hodson 1261f4c12fce1ee58e670f9c3fce46c40296ba9ee8a2Ian Hodson# func_ltwrapper_script_p file 1262f4c12fce1ee58e670f9c3fce46c40296ba9ee8a2Ian Hodson# True iff FILE is a libtool wrapper script 1263f4c12fce1ee58e670f9c3fce46c40296ba9ee8a2Ian Hodson# This function is only a basic sanity check; it will hardly flush out 1264f4c12fce1ee58e670f9c3fce46c40296ba9ee8a2Ian Hodson# determined imposters. 1265f4c12fce1ee58e670f9c3fce46c40296ba9ee8a2Ian Hodsonfunc_ltwrapper_script_p () 1266f4c12fce1ee58e670f9c3fce46c40296ba9ee8a2Ian Hodson{ 1267f4c12fce1ee58e670f9c3fce46c40296ba9ee8a2Ian Hodson func_lalib_p "$1" 1268f4c12fce1ee58e670f9c3fce46c40296ba9ee8a2Ian Hodson} 1269f4c12fce1ee58e670f9c3fce46c40296ba9ee8a2Ian Hodson 1270f4c12fce1ee58e670f9c3fce46c40296ba9ee8a2Ian Hodson# func_ltwrapper_executable_p file 1271f4c12fce1ee58e670f9c3fce46c40296ba9ee8a2Ian Hodson# True iff FILE is a libtool wrapper executable 1272f4c12fce1ee58e670f9c3fce46c40296ba9ee8a2Ian Hodson# This function is only a basic sanity check; it will hardly flush out 1273f4c12fce1ee58e670f9c3fce46c40296ba9ee8a2Ian Hodson# determined imposters. 1274f4c12fce1ee58e670f9c3fce46c40296ba9ee8a2Ian Hodsonfunc_ltwrapper_executable_p () 1275f4c12fce1ee58e670f9c3fce46c40296ba9ee8a2Ian Hodson{ 1276f4c12fce1ee58e670f9c3fce46c40296ba9ee8a2Ian Hodson func_ltwrapper_exec_suffix= 1277f4c12fce1ee58e670f9c3fce46c40296ba9ee8a2Ian Hodson case $1 in 1278f4c12fce1ee58e670f9c3fce46c40296ba9ee8a2Ian Hodson *.exe) ;; 1279f4c12fce1ee58e670f9c3fce46c40296ba9ee8a2Ian Hodson *) func_ltwrapper_exec_suffix=.exe ;; 1280f4c12fce1ee58e670f9c3fce46c40296ba9ee8a2Ian Hodson esac 1281f4c12fce1ee58e670f9c3fce46c40296ba9ee8a2Ian Hodson $GREP "$magic_exe" "$1$func_ltwrapper_exec_suffix" >/dev/null 2>&1 1282f4c12fce1ee58e670f9c3fce46c40296ba9ee8a2Ian Hodson} 1283f4c12fce1ee58e670f9c3fce46c40296ba9ee8a2Ian Hodson 1284f4c12fce1ee58e670f9c3fce46c40296ba9ee8a2Ian Hodson# func_ltwrapper_scriptname file 1285f4c12fce1ee58e670f9c3fce46c40296ba9ee8a2Ian Hodson# Assumes file is an ltwrapper_executable 1286f4c12fce1ee58e670f9c3fce46c40296ba9ee8a2Ian Hodson# uses $file to determine the appropriate filename for a 1287f4c12fce1ee58e670f9c3fce46c40296ba9ee8a2Ian Hodson# temporary ltwrapper_script. 1288f4c12fce1ee58e670f9c3fce46c40296ba9ee8a2Ian Hodsonfunc_ltwrapper_scriptname () 1289f4c12fce1ee58e670f9c3fce46c40296ba9ee8a2Ian Hodson{ 12905b6dc79427b8f7eeb6a7ff68034ab8548ce670eaAlexander Gutkin func_dirname_and_basename "$1" "" "." 12915b6dc79427b8f7eeb6a7ff68034ab8548ce670eaAlexander Gutkin func_stripname '' '.exe' "$func_basename_result" 12925b6dc79427b8f7eeb6a7ff68034ab8548ce670eaAlexander Gutkin func_ltwrapper_scriptname_result="$func_dirname_result/$objdir/${func_stripname_result}_ltshwrapper" 1293f4c12fce1ee58e670f9c3fce46c40296ba9ee8a2Ian Hodson} 1294f4c12fce1ee58e670f9c3fce46c40296ba9ee8a2Ian Hodson 1295f4c12fce1ee58e670f9c3fce46c40296ba9ee8a2Ian Hodson# func_ltwrapper_p file 1296f4c12fce1ee58e670f9c3fce46c40296ba9ee8a2Ian Hodson# True iff FILE is a libtool wrapper script or wrapper executable 1297f4c12fce1ee58e670f9c3fce46c40296ba9ee8a2Ian Hodson# This function is only a basic sanity check; it will hardly flush out 1298f4c12fce1ee58e670f9c3fce46c40296ba9ee8a2Ian Hodson# determined imposters. 1299f4c12fce1ee58e670f9c3fce46c40296ba9ee8a2Ian Hodsonfunc_ltwrapper_p () 1300f4c12fce1ee58e670f9c3fce46c40296ba9ee8a2Ian Hodson{ 1301f4c12fce1ee58e670f9c3fce46c40296ba9ee8a2Ian Hodson func_ltwrapper_script_p "$1" || func_ltwrapper_executable_p "$1" 1302f4c12fce1ee58e670f9c3fce46c40296ba9ee8a2Ian Hodson} 1303f4c12fce1ee58e670f9c3fce46c40296ba9ee8a2Ian Hodson 1304f4c12fce1ee58e670f9c3fce46c40296ba9ee8a2Ian Hodson 1305f4c12fce1ee58e670f9c3fce46c40296ba9ee8a2Ian Hodson# func_execute_cmds commands fail_cmd 1306f4c12fce1ee58e670f9c3fce46c40296ba9ee8a2Ian Hodson# Execute tilde-delimited COMMANDS. 1307f4c12fce1ee58e670f9c3fce46c40296ba9ee8a2Ian Hodson# If FAIL_CMD is given, eval that upon failure. 1308f4c12fce1ee58e670f9c3fce46c40296ba9ee8a2Ian Hodson# FAIL_CMD may read-access the current command in variable CMD! 1309f4c12fce1ee58e670f9c3fce46c40296ba9ee8a2Ian Hodsonfunc_execute_cmds () 1310f4c12fce1ee58e670f9c3fce46c40296ba9ee8a2Ian Hodson{ 1311f4c12fce1ee58e670f9c3fce46c40296ba9ee8a2Ian Hodson $opt_debug 1312f4c12fce1ee58e670f9c3fce46c40296ba9ee8a2Ian Hodson save_ifs=$IFS; IFS='~' 1313f4c12fce1ee58e670f9c3fce46c40296ba9ee8a2Ian Hodson for cmd in $1; do 1314f4c12fce1ee58e670f9c3fce46c40296ba9ee8a2Ian Hodson IFS=$save_ifs 1315f4c12fce1ee58e670f9c3fce46c40296ba9ee8a2Ian Hodson eval cmd=\"$cmd\" 1316f4c12fce1ee58e670f9c3fce46c40296ba9ee8a2Ian Hodson func_show_eval "$cmd" "${2-:}" 1317f4c12fce1ee58e670f9c3fce46c40296ba9ee8a2Ian Hodson done 1318f4c12fce1ee58e670f9c3fce46c40296ba9ee8a2Ian Hodson IFS=$save_ifs 1319f4c12fce1ee58e670f9c3fce46c40296ba9ee8a2Ian Hodson} 1320f4c12fce1ee58e670f9c3fce46c40296ba9ee8a2Ian Hodson 1321f4c12fce1ee58e670f9c3fce46c40296ba9ee8a2Ian Hodson 1322f4c12fce1ee58e670f9c3fce46c40296ba9ee8a2Ian Hodson# func_source file 1323f4c12fce1ee58e670f9c3fce46c40296ba9ee8a2Ian Hodson# Source FILE, adding directory component if necessary. 1324f4c12fce1ee58e670f9c3fce46c40296ba9ee8a2Ian Hodson# Note that it is not necessary on cygwin/mingw to append a dot to 1325f4c12fce1ee58e670f9c3fce46c40296ba9ee8a2Ian Hodson# FILE even if both FILE and FILE.exe exist: automatic-append-.exe 1326f4c12fce1ee58e670f9c3fce46c40296ba9ee8a2Ian Hodson# behavior happens only for exec(3), not for open(2)! Also, sourcing 1327f4c12fce1ee58e670f9c3fce46c40296ba9ee8a2Ian Hodson# `FILE.' does not work on cygwin managed mounts. 1328f4c12fce1ee58e670f9c3fce46c40296ba9ee8a2Ian Hodsonfunc_source () 1329f4c12fce1ee58e670f9c3fce46c40296ba9ee8a2Ian Hodson{ 1330f4c12fce1ee58e670f9c3fce46c40296ba9ee8a2Ian Hodson $opt_debug 1331f4c12fce1ee58e670f9c3fce46c40296ba9ee8a2Ian Hodson case $1 in 1332f4c12fce1ee58e670f9c3fce46c40296ba9ee8a2Ian Hodson */* | *\\*) . "$1" ;; 1333f4c12fce1ee58e670f9c3fce46c40296ba9ee8a2Ian Hodson *) . "./$1" ;; 1334f4c12fce1ee58e670f9c3fce46c40296ba9ee8a2Ian Hodson esac 1335f4c12fce1ee58e670f9c3fce46c40296ba9ee8a2Ian Hodson} 1336f4c12fce1ee58e670f9c3fce46c40296ba9ee8a2Ian Hodson 1337f4c12fce1ee58e670f9c3fce46c40296ba9ee8a2Ian Hodson 13385b6dc79427b8f7eeb6a7ff68034ab8548ce670eaAlexander Gutkin# func_resolve_sysroot PATH 13395b6dc79427b8f7eeb6a7ff68034ab8548ce670eaAlexander Gutkin# Replace a leading = in PATH with a sysroot. Store the result into 13405b6dc79427b8f7eeb6a7ff68034ab8548ce670eaAlexander Gutkin# func_resolve_sysroot_result 13415b6dc79427b8f7eeb6a7ff68034ab8548ce670eaAlexander Gutkinfunc_resolve_sysroot () 13425b6dc79427b8f7eeb6a7ff68034ab8548ce670eaAlexander Gutkin{ 13435b6dc79427b8f7eeb6a7ff68034ab8548ce670eaAlexander Gutkin func_resolve_sysroot_result=$1 13445b6dc79427b8f7eeb6a7ff68034ab8548ce670eaAlexander Gutkin case $func_resolve_sysroot_result in 13455b6dc79427b8f7eeb6a7ff68034ab8548ce670eaAlexander Gutkin =*) 13465b6dc79427b8f7eeb6a7ff68034ab8548ce670eaAlexander Gutkin func_stripname '=' '' "$func_resolve_sysroot_result" 13475b6dc79427b8f7eeb6a7ff68034ab8548ce670eaAlexander Gutkin func_resolve_sysroot_result=$lt_sysroot$func_stripname_result 13485b6dc79427b8f7eeb6a7ff68034ab8548ce670eaAlexander Gutkin ;; 13495b6dc79427b8f7eeb6a7ff68034ab8548ce670eaAlexander Gutkin esac 13505b6dc79427b8f7eeb6a7ff68034ab8548ce670eaAlexander Gutkin} 13515b6dc79427b8f7eeb6a7ff68034ab8548ce670eaAlexander Gutkin 13525b6dc79427b8f7eeb6a7ff68034ab8548ce670eaAlexander Gutkin# func_replace_sysroot PATH 13535b6dc79427b8f7eeb6a7ff68034ab8548ce670eaAlexander Gutkin# If PATH begins with the sysroot, replace it with = and 13545b6dc79427b8f7eeb6a7ff68034ab8548ce670eaAlexander Gutkin# store the result into func_replace_sysroot_result. 13555b6dc79427b8f7eeb6a7ff68034ab8548ce670eaAlexander Gutkinfunc_replace_sysroot () 13565b6dc79427b8f7eeb6a7ff68034ab8548ce670eaAlexander Gutkin{ 13575b6dc79427b8f7eeb6a7ff68034ab8548ce670eaAlexander Gutkin case "$lt_sysroot:$1" in 13585b6dc79427b8f7eeb6a7ff68034ab8548ce670eaAlexander Gutkin ?*:"$lt_sysroot"*) 13595b6dc79427b8f7eeb6a7ff68034ab8548ce670eaAlexander Gutkin func_stripname "$lt_sysroot" '' "$1" 13605b6dc79427b8f7eeb6a7ff68034ab8548ce670eaAlexander Gutkin func_replace_sysroot_result="=$func_stripname_result" 13615b6dc79427b8f7eeb6a7ff68034ab8548ce670eaAlexander Gutkin ;; 13625b6dc79427b8f7eeb6a7ff68034ab8548ce670eaAlexander Gutkin *) 13635b6dc79427b8f7eeb6a7ff68034ab8548ce670eaAlexander Gutkin # Including no sysroot. 13645b6dc79427b8f7eeb6a7ff68034ab8548ce670eaAlexander Gutkin func_replace_sysroot_result=$1 13655b6dc79427b8f7eeb6a7ff68034ab8548ce670eaAlexander Gutkin ;; 13665b6dc79427b8f7eeb6a7ff68034ab8548ce670eaAlexander Gutkin esac 13675b6dc79427b8f7eeb6a7ff68034ab8548ce670eaAlexander Gutkin} 13685b6dc79427b8f7eeb6a7ff68034ab8548ce670eaAlexander Gutkin 1369f4c12fce1ee58e670f9c3fce46c40296ba9ee8a2Ian Hodson# func_infer_tag arg 1370f4c12fce1ee58e670f9c3fce46c40296ba9ee8a2Ian Hodson# Infer tagged configuration to use if any are available and 1371f4c12fce1ee58e670f9c3fce46c40296ba9ee8a2Ian Hodson# if one wasn't chosen via the "--tag" command line option. 1372f4c12fce1ee58e670f9c3fce46c40296ba9ee8a2Ian Hodson# Only attempt this if the compiler in the base compile 1373f4c12fce1ee58e670f9c3fce46c40296ba9ee8a2Ian Hodson# command doesn't match the default compiler. 1374f4c12fce1ee58e670f9c3fce46c40296ba9ee8a2Ian Hodson# arg is usually of the form 'gcc ...' 1375f4c12fce1ee58e670f9c3fce46c40296ba9ee8a2Ian Hodsonfunc_infer_tag () 1376f4c12fce1ee58e670f9c3fce46c40296ba9ee8a2Ian Hodson{ 1377f4c12fce1ee58e670f9c3fce46c40296ba9ee8a2Ian Hodson $opt_debug 1378f4c12fce1ee58e670f9c3fce46c40296ba9ee8a2Ian Hodson if test -n "$available_tags" && test -z "$tagname"; then 1379f4c12fce1ee58e670f9c3fce46c40296ba9ee8a2Ian Hodson CC_quoted= 1380f4c12fce1ee58e670f9c3fce46c40296ba9ee8a2Ian Hodson for arg in $CC; do 13815b6dc79427b8f7eeb6a7ff68034ab8548ce670eaAlexander Gutkin func_append_quoted CC_quoted "$arg" 1382f4c12fce1ee58e670f9c3fce46c40296ba9ee8a2Ian Hodson done 13835b6dc79427b8f7eeb6a7ff68034ab8548ce670eaAlexander Gutkin CC_expanded=`func_echo_all $CC` 13845b6dc79427b8f7eeb6a7ff68034ab8548ce670eaAlexander Gutkin CC_quoted_expanded=`func_echo_all $CC_quoted` 1385f4c12fce1ee58e670f9c3fce46c40296ba9ee8a2Ian Hodson case $@ in 1386f4c12fce1ee58e670f9c3fce46c40296ba9ee8a2Ian Hodson # Blanks in the command may have been stripped by the calling shell, 1387f4c12fce1ee58e670f9c3fce46c40296ba9ee8a2Ian Hodson # but not from the CC environment variable when configure was run. 13885b6dc79427b8f7eeb6a7ff68034ab8548ce670eaAlexander Gutkin " $CC "* | "$CC "* | " $CC_expanded "* | "$CC_expanded "* | \ 13895b6dc79427b8f7eeb6a7ff68034ab8548ce670eaAlexander Gutkin " $CC_quoted"* | "$CC_quoted "* | " $CC_quoted_expanded "* | "$CC_quoted_expanded "*) ;; 1390f4c12fce1ee58e670f9c3fce46c40296ba9ee8a2Ian Hodson # Blanks at the start of $base_compile will cause this to fail 1391f4c12fce1ee58e670f9c3fce46c40296ba9ee8a2Ian Hodson # if we don't check for them as well. 1392f4c12fce1ee58e670f9c3fce46c40296ba9ee8a2Ian Hodson *) 1393f4c12fce1ee58e670f9c3fce46c40296ba9ee8a2Ian Hodson for z in $available_tags; do 1394f4c12fce1ee58e670f9c3fce46c40296ba9ee8a2Ian Hodson if $GREP "^# ### BEGIN LIBTOOL TAG CONFIG: $z$" < "$progpath" > /dev/null; then 1395f4c12fce1ee58e670f9c3fce46c40296ba9ee8a2Ian Hodson # Evaluate the configuration. 1396f4c12fce1ee58e670f9c3fce46c40296ba9ee8a2Ian Hodson eval "`${SED} -n -e '/^# ### BEGIN LIBTOOL TAG CONFIG: '$z'$/,/^# ### END LIBTOOL TAG CONFIG: '$z'$/p' < $progpath`" 1397f4c12fce1ee58e670f9c3fce46c40296ba9ee8a2Ian Hodson CC_quoted= 1398f4c12fce1ee58e670f9c3fce46c40296ba9ee8a2Ian Hodson for arg in $CC; do 1399f4c12fce1ee58e670f9c3fce46c40296ba9ee8a2Ian Hodson # Double-quote args containing other shell metacharacters. 14005b6dc79427b8f7eeb6a7ff68034ab8548ce670eaAlexander Gutkin func_append_quoted CC_quoted "$arg" 1401f4c12fce1ee58e670f9c3fce46c40296ba9ee8a2Ian Hodson done 14025b6dc79427b8f7eeb6a7ff68034ab8548ce670eaAlexander Gutkin CC_expanded=`func_echo_all $CC` 14035b6dc79427b8f7eeb6a7ff68034ab8548ce670eaAlexander Gutkin CC_quoted_expanded=`func_echo_all $CC_quoted` 1404f4c12fce1ee58e670f9c3fce46c40296ba9ee8a2Ian Hodson case "$@ " in 14055b6dc79427b8f7eeb6a7ff68034ab8548ce670eaAlexander Gutkin " $CC "* | "$CC "* | " $CC_expanded "* | "$CC_expanded "* | \ 14065b6dc79427b8f7eeb6a7ff68034ab8548ce670eaAlexander Gutkin " $CC_quoted"* | "$CC_quoted "* | " $CC_quoted_expanded "* | "$CC_quoted_expanded "*) 1407f4c12fce1ee58e670f9c3fce46c40296ba9ee8a2Ian Hodson # The compiler in the base compile command matches 1408f4c12fce1ee58e670f9c3fce46c40296ba9ee8a2Ian Hodson # the one in the tagged configuration. 1409f4c12fce1ee58e670f9c3fce46c40296ba9ee8a2Ian Hodson # Assume this is the tagged configuration we want. 1410f4c12fce1ee58e670f9c3fce46c40296ba9ee8a2Ian Hodson tagname=$z 1411f4c12fce1ee58e670f9c3fce46c40296ba9ee8a2Ian Hodson break 1412f4c12fce1ee58e670f9c3fce46c40296ba9ee8a2Ian Hodson ;; 1413f4c12fce1ee58e670f9c3fce46c40296ba9ee8a2Ian Hodson esac 1414f4c12fce1ee58e670f9c3fce46c40296ba9ee8a2Ian Hodson fi 1415f4c12fce1ee58e670f9c3fce46c40296ba9ee8a2Ian Hodson done 1416f4c12fce1ee58e670f9c3fce46c40296ba9ee8a2Ian Hodson # If $tagname still isn't set, then no tagged configuration 1417f4c12fce1ee58e670f9c3fce46c40296ba9ee8a2Ian Hodson # was found and let the user know that the "--tag" command 1418f4c12fce1ee58e670f9c3fce46c40296ba9ee8a2Ian Hodson # line option must be used. 1419f4c12fce1ee58e670f9c3fce46c40296ba9ee8a2Ian Hodson if test -z "$tagname"; then 1420f4c12fce1ee58e670f9c3fce46c40296ba9ee8a2Ian Hodson func_echo "unable to infer tagged configuration" 1421f4c12fce1ee58e670f9c3fce46c40296ba9ee8a2Ian Hodson func_fatal_error "specify a tag with \`--tag'" 1422f4c12fce1ee58e670f9c3fce46c40296ba9ee8a2Ian Hodson# else 1423f4c12fce1ee58e670f9c3fce46c40296ba9ee8a2Ian Hodson# func_verbose "using $tagname tagged configuration" 1424f4c12fce1ee58e670f9c3fce46c40296ba9ee8a2Ian Hodson fi 1425f4c12fce1ee58e670f9c3fce46c40296ba9ee8a2Ian Hodson ;; 1426f4c12fce1ee58e670f9c3fce46c40296ba9ee8a2Ian Hodson esac 1427f4c12fce1ee58e670f9c3fce46c40296ba9ee8a2Ian Hodson fi 1428f4c12fce1ee58e670f9c3fce46c40296ba9ee8a2Ian Hodson} 1429f4c12fce1ee58e670f9c3fce46c40296ba9ee8a2Ian Hodson 1430f4c12fce1ee58e670f9c3fce46c40296ba9ee8a2Ian Hodson 1431f4c12fce1ee58e670f9c3fce46c40296ba9ee8a2Ian Hodson 1432f4c12fce1ee58e670f9c3fce46c40296ba9ee8a2Ian Hodson# func_write_libtool_object output_name pic_name nonpic_name 1433f4c12fce1ee58e670f9c3fce46c40296ba9ee8a2Ian Hodson# Create a libtool object file (analogous to a ".la" file), 1434f4c12fce1ee58e670f9c3fce46c40296ba9ee8a2Ian Hodson# but don't create it if we're doing a dry run. 1435f4c12fce1ee58e670f9c3fce46c40296ba9ee8a2Ian Hodsonfunc_write_libtool_object () 1436f4c12fce1ee58e670f9c3fce46c40296ba9ee8a2Ian Hodson{ 1437f4c12fce1ee58e670f9c3fce46c40296ba9ee8a2Ian Hodson write_libobj=${1} 1438f4c12fce1ee58e670f9c3fce46c40296ba9ee8a2Ian Hodson if test "$build_libtool_libs" = yes; then 1439f4c12fce1ee58e670f9c3fce46c40296ba9ee8a2Ian Hodson write_lobj=\'${2}\' 1440f4c12fce1ee58e670f9c3fce46c40296ba9ee8a2Ian Hodson else 1441f4c12fce1ee58e670f9c3fce46c40296ba9ee8a2Ian Hodson write_lobj=none 1442f4c12fce1ee58e670f9c3fce46c40296ba9ee8a2Ian Hodson fi 1443f4c12fce1ee58e670f9c3fce46c40296ba9ee8a2Ian Hodson 1444f4c12fce1ee58e670f9c3fce46c40296ba9ee8a2Ian Hodson if test "$build_old_libs" = yes; then 1445f4c12fce1ee58e670f9c3fce46c40296ba9ee8a2Ian Hodson write_oldobj=\'${3}\' 1446f4c12fce1ee58e670f9c3fce46c40296ba9ee8a2Ian Hodson else 1447f4c12fce1ee58e670f9c3fce46c40296ba9ee8a2Ian Hodson write_oldobj=none 1448f4c12fce1ee58e670f9c3fce46c40296ba9ee8a2Ian Hodson fi 1449f4c12fce1ee58e670f9c3fce46c40296ba9ee8a2Ian Hodson 1450f4c12fce1ee58e670f9c3fce46c40296ba9ee8a2Ian Hodson $opt_dry_run || { 1451f4c12fce1ee58e670f9c3fce46c40296ba9ee8a2Ian Hodson cat >${write_libobj}T <<EOF 1452f4c12fce1ee58e670f9c3fce46c40296ba9ee8a2Ian Hodson# $write_libobj - a libtool object file 1453f4c12fce1ee58e670f9c3fce46c40296ba9ee8a2Ian Hodson# Generated by $PROGRAM (GNU $PACKAGE$TIMESTAMP) $VERSION 1454f4c12fce1ee58e670f9c3fce46c40296ba9ee8a2Ian Hodson# 1455f4c12fce1ee58e670f9c3fce46c40296ba9ee8a2Ian Hodson# Please DO NOT delete this file! 1456f4c12fce1ee58e670f9c3fce46c40296ba9ee8a2Ian Hodson# It is necessary for linking the library. 1457f4c12fce1ee58e670f9c3fce46c40296ba9ee8a2Ian Hodson 1458f4c12fce1ee58e670f9c3fce46c40296ba9ee8a2Ian Hodson# Name of the PIC object. 1459f4c12fce1ee58e670f9c3fce46c40296ba9ee8a2Ian Hodsonpic_object=$write_lobj 1460f4c12fce1ee58e670f9c3fce46c40296ba9ee8a2Ian Hodson 1461f4c12fce1ee58e670f9c3fce46c40296ba9ee8a2Ian Hodson# Name of the non-PIC object 1462f4c12fce1ee58e670f9c3fce46c40296ba9ee8a2Ian Hodsonnon_pic_object=$write_oldobj 1463f4c12fce1ee58e670f9c3fce46c40296ba9ee8a2Ian Hodson 1464f4c12fce1ee58e670f9c3fce46c40296ba9ee8a2Ian HodsonEOF 1465f4c12fce1ee58e670f9c3fce46c40296ba9ee8a2Ian Hodson $MV "${write_libobj}T" "${write_libobj}" 1466f4c12fce1ee58e670f9c3fce46c40296ba9ee8a2Ian Hodson } 1467f4c12fce1ee58e670f9c3fce46c40296ba9ee8a2Ian Hodson} 1468f4c12fce1ee58e670f9c3fce46c40296ba9ee8a2Ian Hodson 14695b6dc79427b8f7eeb6a7ff68034ab8548ce670eaAlexander Gutkin 14705b6dc79427b8f7eeb6a7ff68034ab8548ce670eaAlexander Gutkin################################################## 14715b6dc79427b8f7eeb6a7ff68034ab8548ce670eaAlexander Gutkin# FILE NAME AND PATH CONVERSION HELPER FUNCTIONS # 14725b6dc79427b8f7eeb6a7ff68034ab8548ce670eaAlexander Gutkin################################################## 14735b6dc79427b8f7eeb6a7ff68034ab8548ce670eaAlexander Gutkin 14745b6dc79427b8f7eeb6a7ff68034ab8548ce670eaAlexander Gutkin# func_convert_core_file_wine_to_w32 ARG 14755b6dc79427b8f7eeb6a7ff68034ab8548ce670eaAlexander Gutkin# Helper function used by file name conversion functions when $build is *nix, 14765b6dc79427b8f7eeb6a7ff68034ab8548ce670eaAlexander Gutkin# and $host is mingw, cygwin, or some other w32 environment. Relies on a 14775b6dc79427b8f7eeb6a7ff68034ab8548ce670eaAlexander Gutkin# correctly configured wine environment available, with the winepath program 14785b6dc79427b8f7eeb6a7ff68034ab8548ce670eaAlexander Gutkin# in $build's $PATH. 14795b6dc79427b8f7eeb6a7ff68034ab8548ce670eaAlexander Gutkin# 14805b6dc79427b8f7eeb6a7ff68034ab8548ce670eaAlexander Gutkin# ARG is the $build file name to be converted to w32 format. 14815b6dc79427b8f7eeb6a7ff68034ab8548ce670eaAlexander Gutkin# Result is available in $func_convert_core_file_wine_to_w32_result, and will 14825b6dc79427b8f7eeb6a7ff68034ab8548ce670eaAlexander Gutkin# be empty on error (or when ARG is empty) 14835b6dc79427b8f7eeb6a7ff68034ab8548ce670eaAlexander Gutkinfunc_convert_core_file_wine_to_w32 () 14845b6dc79427b8f7eeb6a7ff68034ab8548ce670eaAlexander Gutkin{ 14855b6dc79427b8f7eeb6a7ff68034ab8548ce670eaAlexander Gutkin $opt_debug 14865b6dc79427b8f7eeb6a7ff68034ab8548ce670eaAlexander Gutkin func_convert_core_file_wine_to_w32_result="$1" 14875b6dc79427b8f7eeb6a7ff68034ab8548ce670eaAlexander Gutkin if test -n "$1"; then 14885b6dc79427b8f7eeb6a7ff68034ab8548ce670eaAlexander Gutkin # Unfortunately, winepath does not exit with a non-zero error code, so we 14895b6dc79427b8f7eeb6a7ff68034ab8548ce670eaAlexander Gutkin # are forced to check the contents of stdout. On the other hand, if the 14905b6dc79427b8f7eeb6a7ff68034ab8548ce670eaAlexander Gutkin # command is not found, the shell will set an exit code of 127 and print 14915b6dc79427b8f7eeb6a7ff68034ab8548ce670eaAlexander Gutkin # *an error message* to stdout. So we must check for both error code of 14925b6dc79427b8f7eeb6a7ff68034ab8548ce670eaAlexander Gutkin # zero AND non-empty stdout, which explains the odd construction: 14935b6dc79427b8f7eeb6a7ff68034ab8548ce670eaAlexander Gutkin func_convert_core_file_wine_to_w32_tmp=`winepath -w "$1" 2>/dev/null` 14945b6dc79427b8f7eeb6a7ff68034ab8548ce670eaAlexander Gutkin if test "$?" -eq 0 && test -n "${func_convert_core_file_wine_to_w32_tmp}"; then 14955b6dc79427b8f7eeb6a7ff68034ab8548ce670eaAlexander Gutkin func_convert_core_file_wine_to_w32_result=`$ECHO "$func_convert_core_file_wine_to_w32_tmp" | 14965b6dc79427b8f7eeb6a7ff68034ab8548ce670eaAlexander Gutkin $SED -e "$lt_sed_naive_backslashify"` 14975b6dc79427b8f7eeb6a7ff68034ab8548ce670eaAlexander Gutkin else 14985b6dc79427b8f7eeb6a7ff68034ab8548ce670eaAlexander Gutkin func_convert_core_file_wine_to_w32_result= 14995b6dc79427b8f7eeb6a7ff68034ab8548ce670eaAlexander Gutkin fi 15005b6dc79427b8f7eeb6a7ff68034ab8548ce670eaAlexander Gutkin fi 15015b6dc79427b8f7eeb6a7ff68034ab8548ce670eaAlexander Gutkin} 15025b6dc79427b8f7eeb6a7ff68034ab8548ce670eaAlexander Gutkin# end: func_convert_core_file_wine_to_w32 15035b6dc79427b8f7eeb6a7ff68034ab8548ce670eaAlexander Gutkin 15045b6dc79427b8f7eeb6a7ff68034ab8548ce670eaAlexander Gutkin 15055b6dc79427b8f7eeb6a7ff68034ab8548ce670eaAlexander Gutkin# func_convert_core_path_wine_to_w32 ARG 15065b6dc79427b8f7eeb6a7ff68034ab8548ce670eaAlexander Gutkin# Helper function used by path conversion functions when $build is *nix, and 15075b6dc79427b8f7eeb6a7ff68034ab8548ce670eaAlexander Gutkin# $host is mingw, cygwin, or some other w32 environment. Relies on a correctly 15085b6dc79427b8f7eeb6a7ff68034ab8548ce670eaAlexander Gutkin# configured wine environment available, with the winepath program in $build's 15095b6dc79427b8f7eeb6a7ff68034ab8548ce670eaAlexander Gutkin# $PATH. Assumes ARG has no leading or trailing path separator characters. 15105b6dc79427b8f7eeb6a7ff68034ab8548ce670eaAlexander Gutkin# 15115b6dc79427b8f7eeb6a7ff68034ab8548ce670eaAlexander Gutkin# ARG is path to be converted from $build format to win32. 15125b6dc79427b8f7eeb6a7ff68034ab8548ce670eaAlexander Gutkin# Result is available in $func_convert_core_path_wine_to_w32_result. 15135b6dc79427b8f7eeb6a7ff68034ab8548ce670eaAlexander Gutkin# Unconvertible file (directory) names in ARG are skipped; if no directory names 15145b6dc79427b8f7eeb6a7ff68034ab8548ce670eaAlexander Gutkin# are convertible, then the result may be empty. 15155b6dc79427b8f7eeb6a7ff68034ab8548ce670eaAlexander Gutkinfunc_convert_core_path_wine_to_w32 () 15165b6dc79427b8f7eeb6a7ff68034ab8548ce670eaAlexander Gutkin{ 15175b6dc79427b8f7eeb6a7ff68034ab8548ce670eaAlexander Gutkin $opt_debug 15185b6dc79427b8f7eeb6a7ff68034ab8548ce670eaAlexander Gutkin # unfortunately, winepath doesn't convert paths, only file names 15195b6dc79427b8f7eeb6a7ff68034ab8548ce670eaAlexander Gutkin func_convert_core_path_wine_to_w32_result="" 15205b6dc79427b8f7eeb6a7ff68034ab8548ce670eaAlexander Gutkin if test -n "$1"; then 15215b6dc79427b8f7eeb6a7ff68034ab8548ce670eaAlexander Gutkin oldIFS=$IFS 15225b6dc79427b8f7eeb6a7ff68034ab8548ce670eaAlexander Gutkin IFS=: 15235b6dc79427b8f7eeb6a7ff68034ab8548ce670eaAlexander Gutkin for func_convert_core_path_wine_to_w32_f in $1; do 15245b6dc79427b8f7eeb6a7ff68034ab8548ce670eaAlexander Gutkin IFS=$oldIFS 15255b6dc79427b8f7eeb6a7ff68034ab8548ce670eaAlexander Gutkin func_convert_core_file_wine_to_w32 "$func_convert_core_path_wine_to_w32_f" 15265b6dc79427b8f7eeb6a7ff68034ab8548ce670eaAlexander Gutkin if test -n "$func_convert_core_file_wine_to_w32_result" ; then 15275b6dc79427b8f7eeb6a7ff68034ab8548ce670eaAlexander Gutkin if test -z "$func_convert_core_path_wine_to_w32_result"; then 15285b6dc79427b8f7eeb6a7ff68034ab8548ce670eaAlexander Gutkin func_convert_core_path_wine_to_w32_result="$func_convert_core_file_wine_to_w32_result" 15295b6dc79427b8f7eeb6a7ff68034ab8548ce670eaAlexander Gutkin else 15305b6dc79427b8f7eeb6a7ff68034ab8548ce670eaAlexander Gutkin func_append func_convert_core_path_wine_to_w32_result ";$func_convert_core_file_wine_to_w32_result" 15315b6dc79427b8f7eeb6a7ff68034ab8548ce670eaAlexander Gutkin fi 15325b6dc79427b8f7eeb6a7ff68034ab8548ce670eaAlexander Gutkin fi 15335b6dc79427b8f7eeb6a7ff68034ab8548ce670eaAlexander Gutkin done 15345b6dc79427b8f7eeb6a7ff68034ab8548ce670eaAlexander Gutkin IFS=$oldIFS 15355b6dc79427b8f7eeb6a7ff68034ab8548ce670eaAlexander Gutkin fi 15365b6dc79427b8f7eeb6a7ff68034ab8548ce670eaAlexander Gutkin} 15375b6dc79427b8f7eeb6a7ff68034ab8548ce670eaAlexander Gutkin# end: func_convert_core_path_wine_to_w32 15385b6dc79427b8f7eeb6a7ff68034ab8548ce670eaAlexander Gutkin 15395b6dc79427b8f7eeb6a7ff68034ab8548ce670eaAlexander Gutkin 15405b6dc79427b8f7eeb6a7ff68034ab8548ce670eaAlexander Gutkin# func_cygpath ARGS... 15415b6dc79427b8f7eeb6a7ff68034ab8548ce670eaAlexander Gutkin# Wrapper around calling the cygpath program via LT_CYGPATH. This is used when 15425b6dc79427b8f7eeb6a7ff68034ab8548ce670eaAlexander Gutkin# when (1) $build is *nix and Cygwin is hosted via a wine environment; or (2) 15435b6dc79427b8f7eeb6a7ff68034ab8548ce670eaAlexander Gutkin# $build is MSYS and $host is Cygwin, or (3) $build is Cygwin. In case (1) or 15445b6dc79427b8f7eeb6a7ff68034ab8548ce670eaAlexander Gutkin# (2), returns the Cygwin file name or path in func_cygpath_result (input 15455b6dc79427b8f7eeb6a7ff68034ab8548ce670eaAlexander Gutkin# file name or path is assumed to be in w32 format, as previously converted 15465b6dc79427b8f7eeb6a7ff68034ab8548ce670eaAlexander Gutkin# from $build's *nix or MSYS format). In case (3), returns the w32 file name 15475b6dc79427b8f7eeb6a7ff68034ab8548ce670eaAlexander Gutkin# or path in func_cygpath_result (input file name or path is assumed to be in 15485b6dc79427b8f7eeb6a7ff68034ab8548ce670eaAlexander Gutkin# Cygwin format). Returns an empty string on error. 15495b6dc79427b8f7eeb6a7ff68034ab8548ce670eaAlexander Gutkin# 15505b6dc79427b8f7eeb6a7ff68034ab8548ce670eaAlexander Gutkin# ARGS are passed to cygpath, with the last one being the file name or path to 15515b6dc79427b8f7eeb6a7ff68034ab8548ce670eaAlexander Gutkin# be converted. 15525b6dc79427b8f7eeb6a7ff68034ab8548ce670eaAlexander Gutkin# 15535b6dc79427b8f7eeb6a7ff68034ab8548ce670eaAlexander Gutkin# Specify the absolute *nix (or w32) name to cygpath in the LT_CYGPATH 15545b6dc79427b8f7eeb6a7ff68034ab8548ce670eaAlexander Gutkin# environment variable; do not put it in $PATH. 15555b6dc79427b8f7eeb6a7ff68034ab8548ce670eaAlexander Gutkinfunc_cygpath () 15565b6dc79427b8f7eeb6a7ff68034ab8548ce670eaAlexander Gutkin{ 15575b6dc79427b8f7eeb6a7ff68034ab8548ce670eaAlexander Gutkin $opt_debug 15585b6dc79427b8f7eeb6a7ff68034ab8548ce670eaAlexander Gutkin if test -n "$LT_CYGPATH" && test -f "$LT_CYGPATH"; then 15595b6dc79427b8f7eeb6a7ff68034ab8548ce670eaAlexander Gutkin func_cygpath_result=`$LT_CYGPATH "$@" 2>/dev/null` 15605b6dc79427b8f7eeb6a7ff68034ab8548ce670eaAlexander Gutkin if test "$?" -ne 0; then 15615b6dc79427b8f7eeb6a7ff68034ab8548ce670eaAlexander Gutkin # on failure, ensure result is empty 15625b6dc79427b8f7eeb6a7ff68034ab8548ce670eaAlexander Gutkin func_cygpath_result= 15635b6dc79427b8f7eeb6a7ff68034ab8548ce670eaAlexander Gutkin fi 15645b6dc79427b8f7eeb6a7ff68034ab8548ce670eaAlexander Gutkin else 15655b6dc79427b8f7eeb6a7ff68034ab8548ce670eaAlexander Gutkin func_cygpath_result= 15665b6dc79427b8f7eeb6a7ff68034ab8548ce670eaAlexander Gutkin func_error "LT_CYGPATH is empty or specifies non-existent file: \`$LT_CYGPATH'" 15675b6dc79427b8f7eeb6a7ff68034ab8548ce670eaAlexander Gutkin fi 15685b6dc79427b8f7eeb6a7ff68034ab8548ce670eaAlexander Gutkin} 15695b6dc79427b8f7eeb6a7ff68034ab8548ce670eaAlexander Gutkin#end: func_cygpath 15705b6dc79427b8f7eeb6a7ff68034ab8548ce670eaAlexander Gutkin 15715b6dc79427b8f7eeb6a7ff68034ab8548ce670eaAlexander Gutkin 15725b6dc79427b8f7eeb6a7ff68034ab8548ce670eaAlexander Gutkin# func_convert_core_msys_to_w32 ARG 15735b6dc79427b8f7eeb6a7ff68034ab8548ce670eaAlexander Gutkin# Convert file name or path ARG from MSYS format to w32 format. Return 15745b6dc79427b8f7eeb6a7ff68034ab8548ce670eaAlexander Gutkin# result in func_convert_core_msys_to_w32_result. 15755b6dc79427b8f7eeb6a7ff68034ab8548ce670eaAlexander Gutkinfunc_convert_core_msys_to_w32 () 15765b6dc79427b8f7eeb6a7ff68034ab8548ce670eaAlexander Gutkin{ 15775b6dc79427b8f7eeb6a7ff68034ab8548ce670eaAlexander Gutkin $opt_debug 15785b6dc79427b8f7eeb6a7ff68034ab8548ce670eaAlexander Gutkin # awkward: cmd appends spaces to result 15795b6dc79427b8f7eeb6a7ff68034ab8548ce670eaAlexander Gutkin func_convert_core_msys_to_w32_result=`( cmd //c echo "$1" ) 2>/dev/null | 15805b6dc79427b8f7eeb6a7ff68034ab8548ce670eaAlexander Gutkin $SED -e 's/[ ]*$//' -e "$lt_sed_naive_backslashify"` 15815b6dc79427b8f7eeb6a7ff68034ab8548ce670eaAlexander Gutkin} 15825b6dc79427b8f7eeb6a7ff68034ab8548ce670eaAlexander Gutkin#end: func_convert_core_msys_to_w32 15835b6dc79427b8f7eeb6a7ff68034ab8548ce670eaAlexander Gutkin 15845b6dc79427b8f7eeb6a7ff68034ab8548ce670eaAlexander Gutkin 15855b6dc79427b8f7eeb6a7ff68034ab8548ce670eaAlexander Gutkin# func_convert_file_check ARG1 ARG2 15865b6dc79427b8f7eeb6a7ff68034ab8548ce670eaAlexander Gutkin# Verify that ARG1 (a file name in $build format) was converted to $host 15875b6dc79427b8f7eeb6a7ff68034ab8548ce670eaAlexander Gutkin# format in ARG2. Otherwise, emit an error message, but continue (resetting 15885b6dc79427b8f7eeb6a7ff68034ab8548ce670eaAlexander Gutkin# func_to_host_file_result to ARG1). 15895b6dc79427b8f7eeb6a7ff68034ab8548ce670eaAlexander Gutkinfunc_convert_file_check () 15905b6dc79427b8f7eeb6a7ff68034ab8548ce670eaAlexander Gutkin{ 15915b6dc79427b8f7eeb6a7ff68034ab8548ce670eaAlexander Gutkin $opt_debug 15925b6dc79427b8f7eeb6a7ff68034ab8548ce670eaAlexander Gutkin if test -z "$2" && test -n "$1" ; then 15935b6dc79427b8f7eeb6a7ff68034ab8548ce670eaAlexander Gutkin func_error "Could not determine host file name corresponding to" 15945b6dc79427b8f7eeb6a7ff68034ab8548ce670eaAlexander Gutkin func_error " \`$1'" 15955b6dc79427b8f7eeb6a7ff68034ab8548ce670eaAlexander Gutkin func_error "Continuing, but uninstalled executables may not work." 15965b6dc79427b8f7eeb6a7ff68034ab8548ce670eaAlexander Gutkin # Fallback: 15975b6dc79427b8f7eeb6a7ff68034ab8548ce670eaAlexander Gutkin func_to_host_file_result="$1" 15985b6dc79427b8f7eeb6a7ff68034ab8548ce670eaAlexander Gutkin fi 15995b6dc79427b8f7eeb6a7ff68034ab8548ce670eaAlexander Gutkin} 16005b6dc79427b8f7eeb6a7ff68034ab8548ce670eaAlexander Gutkin# end func_convert_file_check 16015b6dc79427b8f7eeb6a7ff68034ab8548ce670eaAlexander Gutkin 16025b6dc79427b8f7eeb6a7ff68034ab8548ce670eaAlexander Gutkin 16035b6dc79427b8f7eeb6a7ff68034ab8548ce670eaAlexander Gutkin# func_convert_path_check FROM_PATHSEP TO_PATHSEP FROM_PATH TO_PATH 16045b6dc79427b8f7eeb6a7ff68034ab8548ce670eaAlexander Gutkin# Verify that FROM_PATH (a path in $build format) was converted to $host 16055b6dc79427b8f7eeb6a7ff68034ab8548ce670eaAlexander Gutkin# format in TO_PATH. Otherwise, emit an error message, but continue, resetting 16065b6dc79427b8f7eeb6a7ff68034ab8548ce670eaAlexander Gutkin# func_to_host_file_result to a simplistic fallback value (see below). 16075b6dc79427b8f7eeb6a7ff68034ab8548ce670eaAlexander Gutkinfunc_convert_path_check () 16085b6dc79427b8f7eeb6a7ff68034ab8548ce670eaAlexander Gutkin{ 16095b6dc79427b8f7eeb6a7ff68034ab8548ce670eaAlexander Gutkin $opt_debug 16105b6dc79427b8f7eeb6a7ff68034ab8548ce670eaAlexander Gutkin if test -z "$4" && test -n "$3"; then 16115b6dc79427b8f7eeb6a7ff68034ab8548ce670eaAlexander Gutkin func_error "Could not determine the host path corresponding to" 16125b6dc79427b8f7eeb6a7ff68034ab8548ce670eaAlexander Gutkin func_error " \`$3'" 16135b6dc79427b8f7eeb6a7ff68034ab8548ce670eaAlexander Gutkin func_error "Continuing, but uninstalled executables may not work." 16145b6dc79427b8f7eeb6a7ff68034ab8548ce670eaAlexander Gutkin # Fallback. This is a deliberately simplistic "conversion" and 16155b6dc79427b8f7eeb6a7ff68034ab8548ce670eaAlexander Gutkin # should not be "improved". See libtool.info. 16165b6dc79427b8f7eeb6a7ff68034ab8548ce670eaAlexander Gutkin if test "x$1" != "x$2"; then 16175b6dc79427b8f7eeb6a7ff68034ab8548ce670eaAlexander Gutkin lt_replace_pathsep_chars="s|$1|$2|g" 16185b6dc79427b8f7eeb6a7ff68034ab8548ce670eaAlexander Gutkin func_to_host_path_result=`echo "$3" | 16195b6dc79427b8f7eeb6a7ff68034ab8548ce670eaAlexander Gutkin $SED -e "$lt_replace_pathsep_chars"` 16205b6dc79427b8f7eeb6a7ff68034ab8548ce670eaAlexander Gutkin else 16215b6dc79427b8f7eeb6a7ff68034ab8548ce670eaAlexander Gutkin func_to_host_path_result="$3" 16225b6dc79427b8f7eeb6a7ff68034ab8548ce670eaAlexander Gutkin fi 16235b6dc79427b8f7eeb6a7ff68034ab8548ce670eaAlexander Gutkin fi 16245b6dc79427b8f7eeb6a7ff68034ab8548ce670eaAlexander Gutkin} 16255b6dc79427b8f7eeb6a7ff68034ab8548ce670eaAlexander Gutkin# end func_convert_path_check 16265b6dc79427b8f7eeb6a7ff68034ab8548ce670eaAlexander Gutkin 16275b6dc79427b8f7eeb6a7ff68034ab8548ce670eaAlexander Gutkin 16285b6dc79427b8f7eeb6a7ff68034ab8548ce670eaAlexander Gutkin# func_convert_path_front_back_pathsep FRONTPAT BACKPAT REPL ORIG 16295b6dc79427b8f7eeb6a7ff68034ab8548ce670eaAlexander Gutkin# Modifies func_to_host_path_result by prepending REPL if ORIG matches FRONTPAT 16305b6dc79427b8f7eeb6a7ff68034ab8548ce670eaAlexander Gutkin# and appending REPL if ORIG matches BACKPAT. 16315b6dc79427b8f7eeb6a7ff68034ab8548ce670eaAlexander Gutkinfunc_convert_path_front_back_pathsep () 16325b6dc79427b8f7eeb6a7ff68034ab8548ce670eaAlexander Gutkin{ 16335b6dc79427b8f7eeb6a7ff68034ab8548ce670eaAlexander Gutkin $opt_debug 16345b6dc79427b8f7eeb6a7ff68034ab8548ce670eaAlexander Gutkin case $4 in 16355b6dc79427b8f7eeb6a7ff68034ab8548ce670eaAlexander Gutkin $1 ) func_to_host_path_result="$3$func_to_host_path_result" 16365b6dc79427b8f7eeb6a7ff68034ab8548ce670eaAlexander Gutkin ;; 16375b6dc79427b8f7eeb6a7ff68034ab8548ce670eaAlexander Gutkin esac 16385b6dc79427b8f7eeb6a7ff68034ab8548ce670eaAlexander Gutkin case $4 in 16395b6dc79427b8f7eeb6a7ff68034ab8548ce670eaAlexander Gutkin $2 ) func_append func_to_host_path_result "$3" 16405b6dc79427b8f7eeb6a7ff68034ab8548ce670eaAlexander Gutkin ;; 16415b6dc79427b8f7eeb6a7ff68034ab8548ce670eaAlexander Gutkin esac 16425b6dc79427b8f7eeb6a7ff68034ab8548ce670eaAlexander Gutkin} 16435b6dc79427b8f7eeb6a7ff68034ab8548ce670eaAlexander Gutkin# end func_convert_path_front_back_pathsep 16445b6dc79427b8f7eeb6a7ff68034ab8548ce670eaAlexander Gutkin 16455b6dc79427b8f7eeb6a7ff68034ab8548ce670eaAlexander Gutkin 16465b6dc79427b8f7eeb6a7ff68034ab8548ce670eaAlexander Gutkin################################################## 16475b6dc79427b8f7eeb6a7ff68034ab8548ce670eaAlexander Gutkin# $build to $host FILE NAME CONVERSION FUNCTIONS # 16485b6dc79427b8f7eeb6a7ff68034ab8548ce670eaAlexander Gutkin################################################## 16495b6dc79427b8f7eeb6a7ff68034ab8548ce670eaAlexander Gutkin# invoked via `$to_host_file_cmd ARG' 16505b6dc79427b8f7eeb6a7ff68034ab8548ce670eaAlexander Gutkin# 16515b6dc79427b8f7eeb6a7ff68034ab8548ce670eaAlexander Gutkin# In each case, ARG is the path to be converted from $build to $host format. 16525b6dc79427b8f7eeb6a7ff68034ab8548ce670eaAlexander Gutkin# Result will be available in $func_to_host_file_result. 16535b6dc79427b8f7eeb6a7ff68034ab8548ce670eaAlexander Gutkin 16545b6dc79427b8f7eeb6a7ff68034ab8548ce670eaAlexander Gutkin 16555b6dc79427b8f7eeb6a7ff68034ab8548ce670eaAlexander Gutkin# func_to_host_file ARG 16565b6dc79427b8f7eeb6a7ff68034ab8548ce670eaAlexander Gutkin# Converts the file name ARG from $build format to $host format. Return result 16575b6dc79427b8f7eeb6a7ff68034ab8548ce670eaAlexander Gutkin# in func_to_host_file_result. 16585b6dc79427b8f7eeb6a7ff68034ab8548ce670eaAlexander Gutkinfunc_to_host_file () 16595b6dc79427b8f7eeb6a7ff68034ab8548ce670eaAlexander Gutkin{ 16605b6dc79427b8f7eeb6a7ff68034ab8548ce670eaAlexander Gutkin $opt_debug 16615b6dc79427b8f7eeb6a7ff68034ab8548ce670eaAlexander Gutkin $to_host_file_cmd "$1" 16625b6dc79427b8f7eeb6a7ff68034ab8548ce670eaAlexander Gutkin} 16635b6dc79427b8f7eeb6a7ff68034ab8548ce670eaAlexander Gutkin# end func_to_host_file 16645b6dc79427b8f7eeb6a7ff68034ab8548ce670eaAlexander Gutkin 16655b6dc79427b8f7eeb6a7ff68034ab8548ce670eaAlexander Gutkin 16665b6dc79427b8f7eeb6a7ff68034ab8548ce670eaAlexander Gutkin# func_to_tool_file ARG LAZY 16675b6dc79427b8f7eeb6a7ff68034ab8548ce670eaAlexander Gutkin# converts the file name ARG from $build format to toolchain format. Return 16685b6dc79427b8f7eeb6a7ff68034ab8548ce670eaAlexander Gutkin# result in func_to_tool_file_result. If the conversion in use is listed 16695b6dc79427b8f7eeb6a7ff68034ab8548ce670eaAlexander Gutkin# in (the comma separated) LAZY, no conversion takes place. 16705b6dc79427b8f7eeb6a7ff68034ab8548ce670eaAlexander Gutkinfunc_to_tool_file () 16715b6dc79427b8f7eeb6a7ff68034ab8548ce670eaAlexander Gutkin{ 16725b6dc79427b8f7eeb6a7ff68034ab8548ce670eaAlexander Gutkin $opt_debug 16735b6dc79427b8f7eeb6a7ff68034ab8548ce670eaAlexander Gutkin case ,$2, in 16745b6dc79427b8f7eeb6a7ff68034ab8548ce670eaAlexander Gutkin *,"$to_tool_file_cmd",*) 16755b6dc79427b8f7eeb6a7ff68034ab8548ce670eaAlexander Gutkin func_to_tool_file_result=$1 16765b6dc79427b8f7eeb6a7ff68034ab8548ce670eaAlexander Gutkin ;; 16775b6dc79427b8f7eeb6a7ff68034ab8548ce670eaAlexander Gutkin *) 16785b6dc79427b8f7eeb6a7ff68034ab8548ce670eaAlexander Gutkin $to_tool_file_cmd "$1" 16795b6dc79427b8f7eeb6a7ff68034ab8548ce670eaAlexander Gutkin func_to_tool_file_result=$func_to_host_file_result 16805b6dc79427b8f7eeb6a7ff68034ab8548ce670eaAlexander Gutkin ;; 16815b6dc79427b8f7eeb6a7ff68034ab8548ce670eaAlexander Gutkin esac 16825b6dc79427b8f7eeb6a7ff68034ab8548ce670eaAlexander Gutkin} 16835b6dc79427b8f7eeb6a7ff68034ab8548ce670eaAlexander Gutkin# end func_to_tool_file 16845b6dc79427b8f7eeb6a7ff68034ab8548ce670eaAlexander Gutkin 16855b6dc79427b8f7eeb6a7ff68034ab8548ce670eaAlexander Gutkin 16865b6dc79427b8f7eeb6a7ff68034ab8548ce670eaAlexander Gutkin# func_convert_file_noop ARG 16875b6dc79427b8f7eeb6a7ff68034ab8548ce670eaAlexander Gutkin# Copy ARG to func_to_host_file_result. 16885b6dc79427b8f7eeb6a7ff68034ab8548ce670eaAlexander Gutkinfunc_convert_file_noop () 16895b6dc79427b8f7eeb6a7ff68034ab8548ce670eaAlexander Gutkin{ 16905b6dc79427b8f7eeb6a7ff68034ab8548ce670eaAlexander Gutkin func_to_host_file_result="$1" 16915b6dc79427b8f7eeb6a7ff68034ab8548ce670eaAlexander Gutkin} 16925b6dc79427b8f7eeb6a7ff68034ab8548ce670eaAlexander Gutkin# end func_convert_file_noop 16935b6dc79427b8f7eeb6a7ff68034ab8548ce670eaAlexander Gutkin 16945b6dc79427b8f7eeb6a7ff68034ab8548ce670eaAlexander Gutkin 16955b6dc79427b8f7eeb6a7ff68034ab8548ce670eaAlexander Gutkin# func_convert_file_msys_to_w32 ARG 16965b6dc79427b8f7eeb6a7ff68034ab8548ce670eaAlexander Gutkin# Convert file name ARG from (mingw) MSYS to (mingw) w32 format; automatic 16975b6dc79427b8f7eeb6a7ff68034ab8548ce670eaAlexander Gutkin# conversion to w32 is not available inside the cwrapper. Returns result in 16985b6dc79427b8f7eeb6a7ff68034ab8548ce670eaAlexander Gutkin# func_to_host_file_result. 16995b6dc79427b8f7eeb6a7ff68034ab8548ce670eaAlexander Gutkinfunc_convert_file_msys_to_w32 () 17005b6dc79427b8f7eeb6a7ff68034ab8548ce670eaAlexander Gutkin{ 17015b6dc79427b8f7eeb6a7ff68034ab8548ce670eaAlexander Gutkin $opt_debug 17025b6dc79427b8f7eeb6a7ff68034ab8548ce670eaAlexander Gutkin func_to_host_file_result="$1" 17035b6dc79427b8f7eeb6a7ff68034ab8548ce670eaAlexander Gutkin if test -n "$1"; then 17045b6dc79427b8f7eeb6a7ff68034ab8548ce670eaAlexander Gutkin func_convert_core_msys_to_w32 "$1" 17055b6dc79427b8f7eeb6a7ff68034ab8548ce670eaAlexander Gutkin func_to_host_file_result="$func_convert_core_msys_to_w32_result" 17065b6dc79427b8f7eeb6a7ff68034ab8548ce670eaAlexander Gutkin fi 17075b6dc79427b8f7eeb6a7ff68034ab8548ce670eaAlexander Gutkin func_convert_file_check "$1" "$func_to_host_file_result" 17085b6dc79427b8f7eeb6a7ff68034ab8548ce670eaAlexander Gutkin} 17095b6dc79427b8f7eeb6a7ff68034ab8548ce670eaAlexander Gutkin# end func_convert_file_msys_to_w32 17105b6dc79427b8f7eeb6a7ff68034ab8548ce670eaAlexander Gutkin 17115b6dc79427b8f7eeb6a7ff68034ab8548ce670eaAlexander Gutkin 17125b6dc79427b8f7eeb6a7ff68034ab8548ce670eaAlexander Gutkin# func_convert_file_cygwin_to_w32 ARG 17135b6dc79427b8f7eeb6a7ff68034ab8548ce670eaAlexander Gutkin# Convert file name ARG from Cygwin to w32 format. Returns result in 17145b6dc79427b8f7eeb6a7ff68034ab8548ce670eaAlexander Gutkin# func_to_host_file_result. 17155b6dc79427b8f7eeb6a7ff68034ab8548ce670eaAlexander Gutkinfunc_convert_file_cygwin_to_w32 () 17165b6dc79427b8f7eeb6a7ff68034ab8548ce670eaAlexander Gutkin{ 17175b6dc79427b8f7eeb6a7ff68034ab8548ce670eaAlexander Gutkin $opt_debug 17185b6dc79427b8f7eeb6a7ff68034ab8548ce670eaAlexander Gutkin func_to_host_file_result="$1" 17195b6dc79427b8f7eeb6a7ff68034ab8548ce670eaAlexander Gutkin if test -n "$1"; then 17205b6dc79427b8f7eeb6a7ff68034ab8548ce670eaAlexander Gutkin # because $build is cygwin, we call "the" cygpath in $PATH; no need to use 17215b6dc79427b8f7eeb6a7ff68034ab8548ce670eaAlexander Gutkin # LT_CYGPATH in this case. 17225b6dc79427b8f7eeb6a7ff68034ab8548ce670eaAlexander Gutkin func_to_host_file_result=`cygpath -m "$1"` 17235b6dc79427b8f7eeb6a7ff68034ab8548ce670eaAlexander Gutkin fi 17245b6dc79427b8f7eeb6a7ff68034ab8548ce670eaAlexander Gutkin func_convert_file_check "$1" "$func_to_host_file_result" 17255b6dc79427b8f7eeb6a7ff68034ab8548ce670eaAlexander Gutkin} 17265b6dc79427b8f7eeb6a7ff68034ab8548ce670eaAlexander Gutkin# end func_convert_file_cygwin_to_w32 17275b6dc79427b8f7eeb6a7ff68034ab8548ce670eaAlexander Gutkin 17285b6dc79427b8f7eeb6a7ff68034ab8548ce670eaAlexander Gutkin 17295b6dc79427b8f7eeb6a7ff68034ab8548ce670eaAlexander Gutkin# func_convert_file_nix_to_w32 ARG 17305b6dc79427b8f7eeb6a7ff68034ab8548ce670eaAlexander Gutkin# Convert file name ARG from *nix to w32 format. Requires a wine environment 17315b6dc79427b8f7eeb6a7ff68034ab8548ce670eaAlexander Gutkin# and a working winepath. Returns result in func_to_host_file_result. 17325b6dc79427b8f7eeb6a7ff68034ab8548ce670eaAlexander Gutkinfunc_convert_file_nix_to_w32 () 17335b6dc79427b8f7eeb6a7ff68034ab8548ce670eaAlexander Gutkin{ 17345b6dc79427b8f7eeb6a7ff68034ab8548ce670eaAlexander Gutkin $opt_debug 17355b6dc79427b8f7eeb6a7ff68034ab8548ce670eaAlexander Gutkin func_to_host_file_result="$1" 17365b6dc79427b8f7eeb6a7ff68034ab8548ce670eaAlexander Gutkin if test -n "$1"; then 17375b6dc79427b8f7eeb6a7ff68034ab8548ce670eaAlexander Gutkin func_convert_core_file_wine_to_w32 "$1" 17385b6dc79427b8f7eeb6a7ff68034ab8548ce670eaAlexander Gutkin func_to_host_file_result="$func_convert_core_file_wine_to_w32_result" 17395b6dc79427b8f7eeb6a7ff68034ab8548ce670eaAlexander Gutkin fi 17405b6dc79427b8f7eeb6a7ff68034ab8548ce670eaAlexander Gutkin func_convert_file_check "$1" "$func_to_host_file_result" 17415b6dc79427b8f7eeb6a7ff68034ab8548ce670eaAlexander Gutkin} 17425b6dc79427b8f7eeb6a7ff68034ab8548ce670eaAlexander Gutkin# end func_convert_file_nix_to_w32 17435b6dc79427b8f7eeb6a7ff68034ab8548ce670eaAlexander Gutkin 17445b6dc79427b8f7eeb6a7ff68034ab8548ce670eaAlexander Gutkin 17455b6dc79427b8f7eeb6a7ff68034ab8548ce670eaAlexander Gutkin# func_convert_file_msys_to_cygwin ARG 17465b6dc79427b8f7eeb6a7ff68034ab8548ce670eaAlexander Gutkin# Convert file name ARG from MSYS to Cygwin format. Requires LT_CYGPATH set. 17475b6dc79427b8f7eeb6a7ff68034ab8548ce670eaAlexander Gutkin# Returns result in func_to_host_file_result. 17485b6dc79427b8f7eeb6a7ff68034ab8548ce670eaAlexander Gutkinfunc_convert_file_msys_to_cygwin () 17495b6dc79427b8f7eeb6a7ff68034ab8548ce670eaAlexander Gutkin{ 17505b6dc79427b8f7eeb6a7ff68034ab8548ce670eaAlexander Gutkin $opt_debug 17515b6dc79427b8f7eeb6a7ff68034ab8548ce670eaAlexander Gutkin func_to_host_file_result="$1" 17525b6dc79427b8f7eeb6a7ff68034ab8548ce670eaAlexander Gutkin if test -n "$1"; then 17535b6dc79427b8f7eeb6a7ff68034ab8548ce670eaAlexander Gutkin func_convert_core_msys_to_w32 "$1" 17545b6dc79427b8f7eeb6a7ff68034ab8548ce670eaAlexander Gutkin func_cygpath -u "$func_convert_core_msys_to_w32_result" 17555b6dc79427b8f7eeb6a7ff68034ab8548ce670eaAlexander Gutkin func_to_host_file_result="$func_cygpath_result" 17565b6dc79427b8f7eeb6a7ff68034ab8548ce670eaAlexander Gutkin fi 17575b6dc79427b8f7eeb6a7ff68034ab8548ce670eaAlexander Gutkin func_convert_file_check "$1" "$func_to_host_file_result" 17585b6dc79427b8f7eeb6a7ff68034ab8548ce670eaAlexander Gutkin} 17595b6dc79427b8f7eeb6a7ff68034ab8548ce670eaAlexander Gutkin# end func_convert_file_msys_to_cygwin 17605b6dc79427b8f7eeb6a7ff68034ab8548ce670eaAlexander Gutkin 17615b6dc79427b8f7eeb6a7ff68034ab8548ce670eaAlexander Gutkin 17625b6dc79427b8f7eeb6a7ff68034ab8548ce670eaAlexander Gutkin# func_convert_file_nix_to_cygwin ARG 17635b6dc79427b8f7eeb6a7ff68034ab8548ce670eaAlexander Gutkin# Convert file name ARG from *nix to Cygwin format. Requires Cygwin installed 17645b6dc79427b8f7eeb6a7ff68034ab8548ce670eaAlexander Gutkin# in a wine environment, working winepath, and LT_CYGPATH set. Returns result 17655b6dc79427b8f7eeb6a7ff68034ab8548ce670eaAlexander Gutkin# in func_to_host_file_result. 17665b6dc79427b8f7eeb6a7ff68034ab8548ce670eaAlexander Gutkinfunc_convert_file_nix_to_cygwin () 17675b6dc79427b8f7eeb6a7ff68034ab8548ce670eaAlexander Gutkin{ 17685b6dc79427b8f7eeb6a7ff68034ab8548ce670eaAlexander Gutkin $opt_debug 17695b6dc79427b8f7eeb6a7ff68034ab8548ce670eaAlexander Gutkin func_to_host_file_result="$1" 17705b6dc79427b8f7eeb6a7ff68034ab8548ce670eaAlexander Gutkin if test -n "$1"; then 17715b6dc79427b8f7eeb6a7ff68034ab8548ce670eaAlexander Gutkin # convert from *nix to w32, then use cygpath to convert from w32 to cygwin. 17725b6dc79427b8f7eeb6a7ff68034ab8548ce670eaAlexander Gutkin func_convert_core_file_wine_to_w32 "$1" 17735b6dc79427b8f7eeb6a7ff68034ab8548ce670eaAlexander Gutkin func_cygpath -u "$func_convert_core_file_wine_to_w32_result" 17745b6dc79427b8f7eeb6a7ff68034ab8548ce670eaAlexander Gutkin func_to_host_file_result="$func_cygpath_result" 17755b6dc79427b8f7eeb6a7ff68034ab8548ce670eaAlexander Gutkin fi 17765b6dc79427b8f7eeb6a7ff68034ab8548ce670eaAlexander Gutkin func_convert_file_check "$1" "$func_to_host_file_result" 17775b6dc79427b8f7eeb6a7ff68034ab8548ce670eaAlexander Gutkin} 17785b6dc79427b8f7eeb6a7ff68034ab8548ce670eaAlexander Gutkin# end func_convert_file_nix_to_cygwin 17795b6dc79427b8f7eeb6a7ff68034ab8548ce670eaAlexander Gutkin 17805b6dc79427b8f7eeb6a7ff68034ab8548ce670eaAlexander Gutkin 17815b6dc79427b8f7eeb6a7ff68034ab8548ce670eaAlexander Gutkin############################################# 17825b6dc79427b8f7eeb6a7ff68034ab8548ce670eaAlexander Gutkin# $build to $host PATH CONVERSION FUNCTIONS # 17835b6dc79427b8f7eeb6a7ff68034ab8548ce670eaAlexander Gutkin############################################# 17845b6dc79427b8f7eeb6a7ff68034ab8548ce670eaAlexander Gutkin# invoked via `$to_host_path_cmd ARG' 17855b6dc79427b8f7eeb6a7ff68034ab8548ce670eaAlexander Gutkin# 17865b6dc79427b8f7eeb6a7ff68034ab8548ce670eaAlexander Gutkin# In each case, ARG is the path to be converted from $build to $host format. 17875b6dc79427b8f7eeb6a7ff68034ab8548ce670eaAlexander Gutkin# The result will be available in $func_to_host_path_result. 17885b6dc79427b8f7eeb6a7ff68034ab8548ce670eaAlexander Gutkin# 17895b6dc79427b8f7eeb6a7ff68034ab8548ce670eaAlexander Gutkin# Path separators are also converted from $build format to $host format. If 17905b6dc79427b8f7eeb6a7ff68034ab8548ce670eaAlexander Gutkin# ARG begins or ends with a path separator character, it is preserved (but 17915b6dc79427b8f7eeb6a7ff68034ab8548ce670eaAlexander Gutkin# converted to $host format) on output. 17925b6dc79427b8f7eeb6a7ff68034ab8548ce670eaAlexander Gutkin# 17935b6dc79427b8f7eeb6a7ff68034ab8548ce670eaAlexander Gutkin# All path conversion functions are named using the following convention: 17945b6dc79427b8f7eeb6a7ff68034ab8548ce670eaAlexander Gutkin# file name conversion function : func_convert_file_X_to_Y () 17955b6dc79427b8f7eeb6a7ff68034ab8548ce670eaAlexander Gutkin# path conversion function : func_convert_path_X_to_Y () 17965b6dc79427b8f7eeb6a7ff68034ab8548ce670eaAlexander Gutkin# where, for any given $build/$host combination the 'X_to_Y' value is the 17975b6dc79427b8f7eeb6a7ff68034ab8548ce670eaAlexander Gutkin# same. If conversion functions are added for new $build/$host combinations, 17985b6dc79427b8f7eeb6a7ff68034ab8548ce670eaAlexander Gutkin# the two new functions must follow this pattern, or func_init_to_host_path_cmd 17995b6dc79427b8f7eeb6a7ff68034ab8548ce670eaAlexander Gutkin# will break. 18005b6dc79427b8f7eeb6a7ff68034ab8548ce670eaAlexander Gutkin 18015b6dc79427b8f7eeb6a7ff68034ab8548ce670eaAlexander Gutkin 18025b6dc79427b8f7eeb6a7ff68034ab8548ce670eaAlexander Gutkin# func_init_to_host_path_cmd 18035b6dc79427b8f7eeb6a7ff68034ab8548ce670eaAlexander Gutkin# Ensures that function "pointer" variable $to_host_path_cmd is set to the 18045b6dc79427b8f7eeb6a7ff68034ab8548ce670eaAlexander Gutkin# appropriate value, based on the value of $to_host_file_cmd. 18055b6dc79427b8f7eeb6a7ff68034ab8548ce670eaAlexander Gutkinto_host_path_cmd= 18065b6dc79427b8f7eeb6a7ff68034ab8548ce670eaAlexander Gutkinfunc_init_to_host_path_cmd () 18075b6dc79427b8f7eeb6a7ff68034ab8548ce670eaAlexander Gutkin{ 18085b6dc79427b8f7eeb6a7ff68034ab8548ce670eaAlexander Gutkin $opt_debug 18095b6dc79427b8f7eeb6a7ff68034ab8548ce670eaAlexander Gutkin if test -z "$to_host_path_cmd"; then 18105b6dc79427b8f7eeb6a7ff68034ab8548ce670eaAlexander Gutkin func_stripname 'func_convert_file_' '' "$to_host_file_cmd" 18115b6dc79427b8f7eeb6a7ff68034ab8548ce670eaAlexander Gutkin to_host_path_cmd="func_convert_path_${func_stripname_result}" 18125b6dc79427b8f7eeb6a7ff68034ab8548ce670eaAlexander Gutkin fi 18135b6dc79427b8f7eeb6a7ff68034ab8548ce670eaAlexander Gutkin} 18145b6dc79427b8f7eeb6a7ff68034ab8548ce670eaAlexander Gutkin 18155b6dc79427b8f7eeb6a7ff68034ab8548ce670eaAlexander Gutkin 18165b6dc79427b8f7eeb6a7ff68034ab8548ce670eaAlexander Gutkin# func_to_host_path ARG 18175b6dc79427b8f7eeb6a7ff68034ab8548ce670eaAlexander Gutkin# Converts the path ARG from $build format to $host format. Return result 18185b6dc79427b8f7eeb6a7ff68034ab8548ce670eaAlexander Gutkin# in func_to_host_path_result. 18195b6dc79427b8f7eeb6a7ff68034ab8548ce670eaAlexander Gutkinfunc_to_host_path () 18205b6dc79427b8f7eeb6a7ff68034ab8548ce670eaAlexander Gutkin{ 18215b6dc79427b8f7eeb6a7ff68034ab8548ce670eaAlexander Gutkin $opt_debug 18225b6dc79427b8f7eeb6a7ff68034ab8548ce670eaAlexander Gutkin func_init_to_host_path_cmd 18235b6dc79427b8f7eeb6a7ff68034ab8548ce670eaAlexander Gutkin $to_host_path_cmd "$1" 18245b6dc79427b8f7eeb6a7ff68034ab8548ce670eaAlexander Gutkin} 18255b6dc79427b8f7eeb6a7ff68034ab8548ce670eaAlexander Gutkin# end func_to_host_path 18265b6dc79427b8f7eeb6a7ff68034ab8548ce670eaAlexander Gutkin 18275b6dc79427b8f7eeb6a7ff68034ab8548ce670eaAlexander Gutkin 18285b6dc79427b8f7eeb6a7ff68034ab8548ce670eaAlexander Gutkin# func_convert_path_noop ARG 18295b6dc79427b8f7eeb6a7ff68034ab8548ce670eaAlexander Gutkin# Copy ARG to func_to_host_path_result. 18305b6dc79427b8f7eeb6a7ff68034ab8548ce670eaAlexander Gutkinfunc_convert_path_noop () 18315b6dc79427b8f7eeb6a7ff68034ab8548ce670eaAlexander Gutkin{ 18325b6dc79427b8f7eeb6a7ff68034ab8548ce670eaAlexander Gutkin func_to_host_path_result="$1" 18335b6dc79427b8f7eeb6a7ff68034ab8548ce670eaAlexander Gutkin} 18345b6dc79427b8f7eeb6a7ff68034ab8548ce670eaAlexander Gutkin# end func_convert_path_noop 18355b6dc79427b8f7eeb6a7ff68034ab8548ce670eaAlexander Gutkin 18365b6dc79427b8f7eeb6a7ff68034ab8548ce670eaAlexander Gutkin 18375b6dc79427b8f7eeb6a7ff68034ab8548ce670eaAlexander Gutkin# func_convert_path_msys_to_w32 ARG 18385b6dc79427b8f7eeb6a7ff68034ab8548ce670eaAlexander Gutkin# Convert path ARG from (mingw) MSYS to (mingw) w32 format; automatic 18395b6dc79427b8f7eeb6a7ff68034ab8548ce670eaAlexander Gutkin# conversion to w32 is not available inside the cwrapper. Returns result in 18405b6dc79427b8f7eeb6a7ff68034ab8548ce670eaAlexander Gutkin# func_to_host_path_result. 18415b6dc79427b8f7eeb6a7ff68034ab8548ce670eaAlexander Gutkinfunc_convert_path_msys_to_w32 () 18425b6dc79427b8f7eeb6a7ff68034ab8548ce670eaAlexander Gutkin{ 18435b6dc79427b8f7eeb6a7ff68034ab8548ce670eaAlexander Gutkin $opt_debug 18445b6dc79427b8f7eeb6a7ff68034ab8548ce670eaAlexander Gutkin func_to_host_path_result="$1" 18455b6dc79427b8f7eeb6a7ff68034ab8548ce670eaAlexander Gutkin if test -n "$1"; then 18465b6dc79427b8f7eeb6a7ff68034ab8548ce670eaAlexander Gutkin # Remove leading and trailing path separator characters from ARG. MSYS 18475b6dc79427b8f7eeb6a7ff68034ab8548ce670eaAlexander Gutkin # behavior is inconsistent here; cygpath turns them into '.;' and ';.'; 18485b6dc79427b8f7eeb6a7ff68034ab8548ce670eaAlexander Gutkin # and winepath ignores them completely. 18495b6dc79427b8f7eeb6a7ff68034ab8548ce670eaAlexander Gutkin func_stripname : : "$1" 18505b6dc79427b8f7eeb6a7ff68034ab8548ce670eaAlexander Gutkin func_to_host_path_tmp1=$func_stripname_result 18515b6dc79427b8f7eeb6a7ff68034ab8548ce670eaAlexander Gutkin func_convert_core_msys_to_w32 "$func_to_host_path_tmp1" 18525b6dc79427b8f7eeb6a7ff68034ab8548ce670eaAlexander Gutkin func_to_host_path_result="$func_convert_core_msys_to_w32_result" 18535b6dc79427b8f7eeb6a7ff68034ab8548ce670eaAlexander Gutkin func_convert_path_check : ";" \ 18545b6dc79427b8f7eeb6a7ff68034ab8548ce670eaAlexander Gutkin "$func_to_host_path_tmp1" "$func_to_host_path_result" 18555b6dc79427b8f7eeb6a7ff68034ab8548ce670eaAlexander Gutkin func_convert_path_front_back_pathsep ":*" "*:" ";" "$1" 18565b6dc79427b8f7eeb6a7ff68034ab8548ce670eaAlexander Gutkin fi 18575b6dc79427b8f7eeb6a7ff68034ab8548ce670eaAlexander Gutkin} 18585b6dc79427b8f7eeb6a7ff68034ab8548ce670eaAlexander Gutkin# end func_convert_path_msys_to_w32 18595b6dc79427b8f7eeb6a7ff68034ab8548ce670eaAlexander Gutkin 18605b6dc79427b8f7eeb6a7ff68034ab8548ce670eaAlexander Gutkin 18615b6dc79427b8f7eeb6a7ff68034ab8548ce670eaAlexander Gutkin# func_convert_path_cygwin_to_w32 ARG 18625b6dc79427b8f7eeb6a7ff68034ab8548ce670eaAlexander Gutkin# Convert path ARG from Cygwin to w32 format. Returns result in 18635b6dc79427b8f7eeb6a7ff68034ab8548ce670eaAlexander Gutkin# func_to_host_file_result. 18645b6dc79427b8f7eeb6a7ff68034ab8548ce670eaAlexander Gutkinfunc_convert_path_cygwin_to_w32 () 18655b6dc79427b8f7eeb6a7ff68034ab8548ce670eaAlexander Gutkin{ 18665b6dc79427b8f7eeb6a7ff68034ab8548ce670eaAlexander Gutkin $opt_debug 18675b6dc79427b8f7eeb6a7ff68034ab8548ce670eaAlexander Gutkin func_to_host_path_result="$1" 18685b6dc79427b8f7eeb6a7ff68034ab8548ce670eaAlexander Gutkin if test -n "$1"; then 18695b6dc79427b8f7eeb6a7ff68034ab8548ce670eaAlexander Gutkin # See func_convert_path_msys_to_w32: 18705b6dc79427b8f7eeb6a7ff68034ab8548ce670eaAlexander Gutkin func_stripname : : "$1" 18715b6dc79427b8f7eeb6a7ff68034ab8548ce670eaAlexander Gutkin func_to_host_path_tmp1=$func_stripname_result 18725b6dc79427b8f7eeb6a7ff68034ab8548ce670eaAlexander Gutkin func_to_host_path_result=`cygpath -m -p "$func_to_host_path_tmp1"` 18735b6dc79427b8f7eeb6a7ff68034ab8548ce670eaAlexander Gutkin func_convert_path_check : ";" \ 18745b6dc79427b8f7eeb6a7ff68034ab8548ce670eaAlexander Gutkin "$func_to_host_path_tmp1" "$func_to_host_path_result" 18755b6dc79427b8f7eeb6a7ff68034ab8548ce670eaAlexander Gutkin func_convert_path_front_back_pathsep ":*" "*:" ";" "$1" 18765b6dc79427b8f7eeb6a7ff68034ab8548ce670eaAlexander Gutkin fi 18775b6dc79427b8f7eeb6a7ff68034ab8548ce670eaAlexander Gutkin} 18785b6dc79427b8f7eeb6a7ff68034ab8548ce670eaAlexander Gutkin# end func_convert_path_cygwin_to_w32 18795b6dc79427b8f7eeb6a7ff68034ab8548ce670eaAlexander Gutkin 18805b6dc79427b8f7eeb6a7ff68034ab8548ce670eaAlexander Gutkin 18815b6dc79427b8f7eeb6a7ff68034ab8548ce670eaAlexander Gutkin# func_convert_path_nix_to_w32 ARG 18825b6dc79427b8f7eeb6a7ff68034ab8548ce670eaAlexander Gutkin# Convert path ARG from *nix to w32 format. Requires a wine environment and 18835b6dc79427b8f7eeb6a7ff68034ab8548ce670eaAlexander Gutkin# a working winepath. Returns result in func_to_host_file_result. 18845b6dc79427b8f7eeb6a7ff68034ab8548ce670eaAlexander Gutkinfunc_convert_path_nix_to_w32 () 18855b6dc79427b8f7eeb6a7ff68034ab8548ce670eaAlexander Gutkin{ 18865b6dc79427b8f7eeb6a7ff68034ab8548ce670eaAlexander Gutkin $opt_debug 18875b6dc79427b8f7eeb6a7ff68034ab8548ce670eaAlexander Gutkin func_to_host_path_result="$1" 18885b6dc79427b8f7eeb6a7ff68034ab8548ce670eaAlexander Gutkin if test -n "$1"; then 18895b6dc79427b8f7eeb6a7ff68034ab8548ce670eaAlexander Gutkin # See func_convert_path_msys_to_w32: 18905b6dc79427b8f7eeb6a7ff68034ab8548ce670eaAlexander Gutkin func_stripname : : "$1" 18915b6dc79427b8f7eeb6a7ff68034ab8548ce670eaAlexander Gutkin func_to_host_path_tmp1=$func_stripname_result 18925b6dc79427b8f7eeb6a7ff68034ab8548ce670eaAlexander Gutkin func_convert_core_path_wine_to_w32 "$func_to_host_path_tmp1" 18935b6dc79427b8f7eeb6a7ff68034ab8548ce670eaAlexander Gutkin func_to_host_path_result="$func_convert_core_path_wine_to_w32_result" 18945b6dc79427b8f7eeb6a7ff68034ab8548ce670eaAlexander Gutkin func_convert_path_check : ";" \ 18955b6dc79427b8f7eeb6a7ff68034ab8548ce670eaAlexander Gutkin "$func_to_host_path_tmp1" "$func_to_host_path_result" 18965b6dc79427b8f7eeb6a7ff68034ab8548ce670eaAlexander Gutkin func_convert_path_front_back_pathsep ":*" "*:" ";" "$1" 18975b6dc79427b8f7eeb6a7ff68034ab8548ce670eaAlexander Gutkin fi 18985b6dc79427b8f7eeb6a7ff68034ab8548ce670eaAlexander Gutkin} 18995b6dc79427b8f7eeb6a7ff68034ab8548ce670eaAlexander Gutkin# end func_convert_path_nix_to_w32 19005b6dc79427b8f7eeb6a7ff68034ab8548ce670eaAlexander Gutkin 19015b6dc79427b8f7eeb6a7ff68034ab8548ce670eaAlexander Gutkin 19025b6dc79427b8f7eeb6a7ff68034ab8548ce670eaAlexander Gutkin# func_convert_path_msys_to_cygwin ARG 19035b6dc79427b8f7eeb6a7ff68034ab8548ce670eaAlexander Gutkin# Convert path ARG from MSYS to Cygwin format. Requires LT_CYGPATH set. 19045b6dc79427b8f7eeb6a7ff68034ab8548ce670eaAlexander Gutkin# Returns result in func_to_host_file_result. 19055b6dc79427b8f7eeb6a7ff68034ab8548ce670eaAlexander Gutkinfunc_convert_path_msys_to_cygwin () 19065b6dc79427b8f7eeb6a7ff68034ab8548ce670eaAlexander Gutkin{ 19075b6dc79427b8f7eeb6a7ff68034ab8548ce670eaAlexander Gutkin $opt_debug 19085b6dc79427b8f7eeb6a7ff68034ab8548ce670eaAlexander Gutkin func_to_host_path_result="$1" 19095b6dc79427b8f7eeb6a7ff68034ab8548ce670eaAlexander Gutkin if test -n "$1"; then 19105b6dc79427b8f7eeb6a7ff68034ab8548ce670eaAlexander Gutkin # See func_convert_path_msys_to_w32: 19115b6dc79427b8f7eeb6a7ff68034ab8548ce670eaAlexander Gutkin func_stripname : : "$1" 19125b6dc79427b8f7eeb6a7ff68034ab8548ce670eaAlexander Gutkin func_to_host_path_tmp1=$func_stripname_result 19135b6dc79427b8f7eeb6a7ff68034ab8548ce670eaAlexander Gutkin func_convert_core_msys_to_w32 "$func_to_host_path_tmp1" 19145b6dc79427b8f7eeb6a7ff68034ab8548ce670eaAlexander Gutkin func_cygpath -u -p "$func_convert_core_msys_to_w32_result" 19155b6dc79427b8f7eeb6a7ff68034ab8548ce670eaAlexander Gutkin func_to_host_path_result="$func_cygpath_result" 19165b6dc79427b8f7eeb6a7ff68034ab8548ce670eaAlexander Gutkin func_convert_path_check : : \ 19175b6dc79427b8f7eeb6a7ff68034ab8548ce670eaAlexander Gutkin "$func_to_host_path_tmp1" "$func_to_host_path_result" 19185b6dc79427b8f7eeb6a7ff68034ab8548ce670eaAlexander Gutkin func_convert_path_front_back_pathsep ":*" "*:" : "$1" 19195b6dc79427b8f7eeb6a7ff68034ab8548ce670eaAlexander Gutkin fi 19205b6dc79427b8f7eeb6a7ff68034ab8548ce670eaAlexander Gutkin} 19215b6dc79427b8f7eeb6a7ff68034ab8548ce670eaAlexander Gutkin# end func_convert_path_msys_to_cygwin 19225b6dc79427b8f7eeb6a7ff68034ab8548ce670eaAlexander Gutkin 19235b6dc79427b8f7eeb6a7ff68034ab8548ce670eaAlexander Gutkin 19245b6dc79427b8f7eeb6a7ff68034ab8548ce670eaAlexander Gutkin# func_convert_path_nix_to_cygwin ARG 19255b6dc79427b8f7eeb6a7ff68034ab8548ce670eaAlexander Gutkin# Convert path ARG from *nix to Cygwin format. Requires Cygwin installed in a 19265b6dc79427b8f7eeb6a7ff68034ab8548ce670eaAlexander Gutkin# a wine environment, working winepath, and LT_CYGPATH set. Returns result in 19275b6dc79427b8f7eeb6a7ff68034ab8548ce670eaAlexander Gutkin# func_to_host_file_result. 19285b6dc79427b8f7eeb6a7ff68034ab8548ce670eaAlexander Gutkinfunc_convert_path_nix_to_cygwin () 19295b6dc79427b8f7eeb6a7ff68034ab8548ce670eaAlexander Gutkin{ 19305b6dc79427b8f7eeb6a7ff68034ab8548ce670eaAlexander Gutkin $opt_debug 19315b6dc79427b8f7eeb6a7ff68034ab8548ce670eaAlexander Gutkin func_to_host_path_result="$1" 19325b6dc79427b8f7eeb6a7ff68034ab8548ce670eaAlexander Gutkin if test -n "$1"; then 19335b6dc79427b8f7eeb6a7ff68034ab8548ce670eaAlexander Gutkin # Remove leading and trailing path separator characters from 19345b6dc79427b8f7eeb6a7ff68034ab8548ce670eaAlexander Gutkin # ARG. msys behavior is inconsistent here, cygpath turns them 19355b6dc79427b8f7eeb6a7ff68034ab8548ce670eaAlexander Gutkin # into '.;' and ';.', and winepath ignores them completely. 19365b6dc79427b8f7eeb6a7ff68034ab8548ce670eaAlexander Gutkin func_stripname : : "$1" 19375b6dc79427b8f7eeb6a7ff68034ab8548ce670eaAlexander Gutkin func_to_host_path_tmp1=$func_stripname_result 19385b6dc79427b8f7eeb6a7ff68034ab8548ce670eaAlexander Gutkin func_convert_core_path_wine_to_w32 "$func_to_host_path_tmp1" 19395b6dc79427b8f7eeb6a7ff68034ab8548ce670eaAlexander Gutkin func_cygpath -u -p "$func_convert_core_path_wine_to_w32_result" 19405b6dc79427b8f7eeb6a7ff68034ab8548ce670eaAlexander Gutkin func_to_host_path_result="$func_cygpath_result" 19415b6dc79427b8f7eeb6a7ff68034ab8548ce670eaAlexander Gutkin func_convert_path_check : : \ 19425b6dc79427b8f7eeb6a7ff68034ab8548ce670eaAlexander Gutkin "$func_to_host_path_tmp1" "$func_to_host_path_result" 19435b6dc79427b8f7eeb6a7ff68034ab8548ce670eaAlexander Gutkin func_convert_path_front_back_pathsep ":*" "*:" : "$1" 19445b6dc79427b8f7eeb6a7ff68034ab8548ce670eaAlexander Gutkin fi 19455b6dc79427b8f7eeb6a7ff68034ab8548ce670eaAlexander Gutkin} 19465b6dc79427b8f7eeb6a7ff68034ab8548ce670eaAlexander Gutkin# end func_convert_path_nix_to_cygwin 19475b6dc79427b8f7eeb6a7ff68034ab8548ce670eaAlexander Gutkin 19485b6dc79427b8f7eeb6a7ff68034ab8548ce670eaAlexander Gutkin 1949f4c12fce1ee58e670f9c3fce46c40296ba9ee8a2Ian Hodson# func_mode_compile arg... 1950f4c12fce1ee58e670f9c3fce46c40296ba9ee8a2Ian Hodsonfunc_mode_compile () 1951f4c12fce1ee58e670f9c3fce46c40296ba9ee8a2Ian Hodson{ 1952f4c12fce1ee58e670f9c3fce46c40296ba9ee8a2Ian Hodson $opt_debug 1953f4c12fce1ee58e670f9c3fce46c40296ba9ee8a2Ian Hodson # Get the compilation command and the source file. 1954f4c12fce1ee58e670f9c3fce46c40296ba9ee8a2Ian Hodson base_compile= 1955f4c12fce1ee58e670f9c3fce46c40296ba9ee8a2Ian Hodson srcfile="$nonopt" # always keep a non-empty value in "srcfile" 1956f4c12fce1ee58e670f9c3fce46c40296ba9ee8a2Ian Hodson suppress_opt=yes 1957f4c12fce1ee58e670f9c3fce46c40296ba9ee8a2Ian Hodson suppress_output= 1958f4c12fce1ee58e670f9c3fce46c40296ba9ee8a2Ian Hodson arg_mode=normal 1959f4c12fce1ee58e670f9c3fce46c40296ba9ee8a2Ian Hodson libobj= 1960f4c12fce1ee58e670f9c3fce46c40296ba9ee8a2Ian Hodson later= 1961f4c12fce1ee58e670f9c3fce46c40296ba9ee8a2Ian Hodson pie_flag= 1962f4c12fce1ee58e670f9c3fce46c40296ba9ee8a2Ian Hodson 1963f4c12fce1ee58e670f9c3fce46c40296ba9ee8a2Ian Hodson for arg 1964f4c12fce1ee58e670f9c3fce46c40296ba9ee8a2Ian Hodson do 1965f4c12fce1ee58e670f9c3fce46c40296ba9ee8a2Ian Hodson case $arg_mode in 1966f4c12fce1ee58e670f9c3fce46c40296ba9ee8a2Ian Hodson arg ) 1967f4c12fce1ee58e670f9c3fce46c40296ba9ee8a2Ian Hodson # do not "continue". Instead, add this to base_compile 1968f4c12fce1ee58e670f9c3fce46c40296ba9ee8a2Ian Hodson lastarg="$arg" 1969f4c12fce1ee58e670f9c3fce46c40296ba9ee8a2Ian Hodson arg_mode=normal 1970f4c12fce1ee58e670f9c3fce46c40296ba9ee8a2Ian Hodson ;; 1971f4c12fce1ee58e670f9c3fce46c40296ba9ee8a2Ian Hodson 1972f4c12fce1ee58e670f9c3fce46c40296ba9ee8a2Ian Hodson target ) 1973f4c12fce1ee58e670f9c3fce46c40296ba9ee8a2Ian Hodson libobj="$arg" 1974f4c12fce1ee58e670f9c3fce46c40296ba9ee8a2Ian Hodson arg_mode=normal 1975f4c12fce1ee58e670f9c3fce46c40296ba9ee8a2Ian Hodson continue 1976f4c12fce1ee58e670f9c3fce46c40296ba9ee8a2Ian Hodson ;; 1977f4c12fce1ee58e670f9c3fce46c40296ba9ee8a2Ian Hodson 1978f4c12fce1ee58e670f9c3fce46c40296ba9ee8a2Ian Hodson normal ) 1979f4c12fce1ee58e670f9c3fce46c40296ba9ee8a2Ian Hodson # Accept any command-line options. 1980f4c12fce1ee58e670f9c3fce46c40296ba9ee8a2Ian Hodson case $arg in 1981f4c12fce1ee58e670f9c3fce46c40296ba9ee8a2Ian Hodson -o) 1982f4c12fce1ee58e670f9c3fce46c40296ba9ee8a2Ian Hodson test -n "$libobj" && \ 1983f4c12fce1ee58e670f9c3fce46c40296ba9ee8a2Ian Hodson func_fatal_error "you cannot specify \`-o' more than once" 1984f4c12fce1ee58e670f9c3fce46c40296ba9ee8a2Ian Hodson arg_mode=target 1985f4c12fce1ee58e670f9c3fce46c40296ba9ee8a2Ian Hodson continue 1986f4c12fce1ee58e670f9c3fce46c40296ba9ee8a2Ian Hodson ;; 1987f4c12fce1ee58e670f9c3fce46c40296ba9ee8a2Ian Hodson 1988f4c12fce1ee58e670f9c3fce46c40296ba9ee8a2Ian Hodson -pie | -fpie | -fPIE) 19895b6dc79427b8f7eeb6a7ff68034ab8548ce670eaAlexander Gutkin func_append pie_flag " $arg" 1990f4c12fce1ee58e670f9c3fce46c40296ba9ee8a2Ian Hodson continue 1991f4c12fce1ee58e670f9c3fce46c40296ba9ee8a2Ian Hodson ;; 1992f4c12fce1ee58e670f9c3fce46c40296ba9ee8a2Ian Hodson 1993f4c12fce1ee58e670f9c3fce46c40296ba9ee8a2Ian Hodson -shared | -static | -prefer-pic | -prefer-non-pic) 19945b6dc79427b8f7eeb6a7ff68034ab8548ce670eaAlexander Gutkin func_append later " $arg" 1995f4c12fce1ee58e670f9c3fce46c40296ba9ee8a2Ian Hodson continue 1996f4c12fce1ee58e670f9c3fce46c40296ba9ee8a2Ian Hodson ;; 1997f4c12fce1ee58e670f9c3fce46c40296ba9ee8a2Ian Hodson 1998f4c12fce1ee58e670f9c3fce46c40296ba9ee8a2Ian Hodson -no-suppress) 1999f4c12fce1ee58e670f9c3fce46c40296ba9ee8a2Ian Hodson suppress_opt=no 2000f4c12fce1ee58e670f9c3fce46c40296ba9ee8a2Ian Hodson continue 2001f4c12fce1ee58e670f9c3fce46c40296ba9ee8a2Ian Hodson ;; 2002f4c12fce1ee58e670f9c3fce46c40296ba9ee8a2Ian Hodson 2003f4c12fce1ee58e670f9c3fce46c40296ba9ee8a2Ian Hodson -Xcompiler) 2004f4c12fce1ee58e670f9c3fce46c40296ba9ee8a2Ian Hodson arg_mode=arg # the next one goes into the "base_compile" arg list 2005f4c12fce1ee58e670f9c3fce46c40296ba9ee8a2Ian Hodson continue # The current "srcfile" will either be retained or 2006f4c12fce1ee58e670f9c3fce46c40296ba9ee8a2Ian Hodson ;; # replaced later. I would guess that would be a bug. 2007f4c12fce1ee58e670f9c3fce46c40296ba9ee8a2Ian Hodson 2008f4c12fce1ee58e670f9c3fce46c40296ba9ee8a2Ian Hodson -Wc,*) 2009f4c12fce1ee58e670f9c3fce46c40296ba9ee8a2Ian Hodson func_stripname '-Wc,' '' "$arg" 2010f4c12fce1ee58e670f9c3fce46c40296ba9ee8a2Ian Hodson args=$func_stripname_result 2011f4c12fce1ee58e670f9c3fce46c40296ba9ee8a2Ian Hodson lastarg= 2012f4c12fce1ee58e670f9c3fce46c40296ba9ee8a2Ian Hodson save_ifs="$IFS"; IFS=',' 2013f4c12fce1ee58e670f9c3fce46c40296ba9ee8a2Ian Hodson for arg in $args; do 2014f4c12fce1ee58e670f9c3fce46c40296ba9ee8a2Ian Hodson IFS="$save_ifs" 20155b6dc79427b8f7eeb6a7ff68034ab8548ce670eaAlexander Gutkin func_append_quoted lastarg "$arg" 2016f4c12fce1ee58e670f9c3fce46c40296ba9ee8a2Ian Hodson done 2017f4c12fce1ee58e670f9c3fce46c40296ba9ee8a2Ian Hodson IFS="$save_ifs" 2018f4c12fce1ee58e670f9c3fce46c40296ba9ee8a2Ian Hodson func_stripname ' ' '' "$lastarg" 2019f4c12fce1ee58e670f9c3fce46c40296ba9ee8a2Ian Hodson lastarg=$func_stripname_result 2020f4c12fce1ee58e670f9c3fce46c40296ba9ee8a2Ian Hodson 2021f4c12fce1ee58e670f9c3fce46c40296ba9ee8a2Ian Hodson # Add the arguments to base_compile. 20225b6dc79427b8f7eeb6a7ff68034ab8548ce670eaAlexander Gutkin func_append base_compile " $lastarg" 2023f4c12fce1ee58e670f9c3fce46c40296ba9ee8a2Ian Hodson continue 2024f4c12fce1ee58e670f9c3fce46c40296ba9ee8a2Ian Hodson ;; 2025f4c12fce1ee58e670f9c3fce46c40296ba9ee8a2Ian Hodson 2026f4c12fce1ee58e670f9c3fce46c40296ba9ee8a2Ian Hodson *) 2027f4c12fce1ee58e670f9c3fce46c40296ba9ee8a2Ian Hodson # Accept the current argument as the source file. 2028f4c12fce1ee58e670f9c3fce46c40296ba9ee8a2Ian Hodson # The previous "srcfile" becomes the current argument. 2029f4c12fce1ee58e670f9c3fce46c40296ba9ee8a2Ian Hodson # 2030f4c12fce1ee58e670f9c3fce46c40296ba9ee8a2Ian Hodson lastarg="$srcfile" 2031f4c12fce1ee58e670f9c3fce46c40296ba9ee8a2Ian Hodson srcfile="$arg" 2032f4c12fce1ee58e670f9c3fce46c40296ba9ee8a2Ian Hodson ;; 2033f4c12fce1ee58e670f9c3fce46c40296ba9ee8a2Ian Hodson esac # case $arg 2034f4c12fce1ee58e670f9c3fce46c40296ba9ee8a2Ian Hodson ;; 2035f4c12fce1ee58e670f9c3fce46c40296ba9ee8a2Ian Hodson esac # case $arg_mode 2036f4c12fce1ee58e670f9c3fce46c40296ba9ee8a2Ian Hodson 2037f4c12fce1ee58e670f9c3fce46c40296ba9ee8a2Ian Hodson # Aesthetically quote the previous argument. 20385b6dc79427b8f7eeb6a7ff68034ab8548ce670eaAlexander Gutkin func_append_quoted base_compile "$lastarg" 2039f4c12fce1ee58e670f9c3fce46c40296ba9ee8a2Ian Hodson done # for arg 2040f4c12fce1ee58e670f9c3fce46c40296ba9ee8a2Ian Hodson 2041f4c12fce1ee58e670f9c3fce46c40296ba9ee8a2Ian Hodson case $arg_mode in 2042f4c12fce1ee58e670f9c3fce46c40296ba9ee8a2Ian Hodson arg) 2043f4c12fce1ee58e670f9c3fce46c40296ba9ee8a2Ian Hodson func_fatal_error "you must specify an argument for -Xcompile" 2044f4c12fce1ee58e670f9c3fce46c40296ba9ee8a2Ian Hodson ;; 2045f4c12fce1ee58e670f9c3fce46c40296ba9ee8a2Ian Hodson target) 2046f4c12fce1ee58e670f9c3fce46c40296ba9ee8a2Ian Hodson func_fatal_error "you must specify a target with \`-o'" 2047f4c12fce1ee58e670f9c3fce46c40296ba9ee8a2Ian Hodson ;; 2048f4c12fce1ee58e670f9c3fce46c40296ba9ee8a2Ian Hodson *) 2049f4c12fce1ee58e670f9c3fce46c40296ba9ee8a2Ian Hodson # Get the name of the library object. 2050f4c12fce1ee58e670f9c3fce46c40296ba9ee8a2Ian Hodson test -z "$libobj" && { 2051f4c12fce1ee58e670f9c3fce46c40296ba9ee8a2Ian Hodson func_basename "$srcfile" 2052f4c12fce1ee58e670f9c3fce46c40296ba9ee8a2Ian Hodson libobj="$func_basename_result" 2053f4c12fce1ee58e670f9c3fce46c40296ba9ee8a2Ian Hodson } 2054f4c12fce1ee58e670f9c3fce46c40296ba9ee8a2Ian Hodson ;; 2055f4c12fce1ee58e670f9c3fce46c40296ba9ee8a2Ian Hodson esac 2056f4c12fce1ee58e670f9c3fce46c40296ba9ee8a2Ian Hodson 2057f4c12fce1ee58e670f9c3fce46c40296ba9ee8a2Ian Hodson # Recognize several different file suffixes. 2058f4c12fce1ee58e670f9c3fce46c40296ba9ee8a2Ian Hodson # If the user specifies -o file.o, it is replaced with file.lo 2059f4c12fce1ee58e670f9c3fce46c40296ba9ee8a2Ian Hodson case $libobj in 2060f4c12fce1ee58e670f9c3fce46c40296ba9ee8a2Ian Hodson *.[cCFSifmso] | \ 2061f4c12fce1ee58e670f9c3fce46c40296ba9ee8a2Ian Hodson *.ada | *.adb | *.ads | *.asm | \ 2062f4c12fce1ee58e670f9c3fce46c40296ba9ee8a2Ian Hodson *.c++ | *.cc | *.ii | *.class | *.cpp | *.cxx | \ 20635b6dc79427b8f7eeb6a7ff68034ab8548ce670eaAlexander Gutkin *.[fF][09]? | *.for | *.java | *.go | *.obj | *.sx | *.cu | *.cup) 2064f4c12fce1ee58e670f9c3fce46c40296ba9ee8a2Ian Hodson func_xform "$libobj" 2065f4c12fce1ee58e670f9c3fce46c40296ba9ee8a2Ian Hodson libobj=$func_xform_result 2066f4c12fce1ee58e670f9c3fce46c40296ba9ee8a2Ian Hodson ;; 2067f4c12fce1ee58e670f9c3fce46c40296ba9ee8a2Ian Hodson esac 2068f4c12fce1ee58e670f9c3fce46c40296ba9ee8a2Ian Hodson 2069f4c12fce1ee58e670f9c3fce46c40296ba9ee8a2Ian Hodson case $libobj in 2070f4c12fce1ee58e670f9c3fce46c40296ba9ee8a2Ian Hodson *.lo) func_lo2o "$libobj"; obj=$func_lo2o_result ;; 2071f4c12fce1ee58e670f9c3fce46c40296ba9ee8a2Ian Hodson *) 2072f4c12fce1ee58e670f9c3fce46c40296ba9ee8a2Ian Hodson func_fatal_error "cannot determine name of library object from \`$libobj'" 2073f4c12fce1ee58e670f9c3fce46c40296ba9ee8a2Ian Hodson ;; 2074f4c12fce1ee58e670f9c3fce46c40296ba9ee8a2Ian Hodson esac 2075f4c12fce1ee58e670f9c3fce46c40296ba9ee8a2Ian Hodson 2076f4c12fce1ee58e670f9c3fce46c40296ba9ee8a2Ian Hodson func_infer_tag $base_compile 2077f4c12fce1ee58e670f9c3fce46c40296ba9ee8a2Ian Hodson 2078f4c12fce1ee58e670f9c3fce46c40296ba9ee8a2Ian Hodson for arg in $later; do 2079f4c12fce1ee58e670f9c3fce46c40296ba9ee8a2Ian Hodson case $arg in 2080f4c12fce1ee58e670f9c3fce46c40296ba9ee8a2Ian Hodson -shared) 2081f4c12fce1ee58e670f9c3fce46c40296ba9ee8a2Ian Hodson test "$build_libtool_libs" != yes && \ 2082f4c12fce1ee58e670f9c3fce46c40296ba9ee8a2Ian Hodson func_fatal_configuration "can not build a shared library" 2083f4c12fce1ee58e670f9c3fce46c40296ba9ee8a2Ian Hodson build_old_libs=no 2084f4c12fce1ee58e670f9c3fce46c40296ba9ee8a2Ian Hodson continue 2085f4c12fce1ee58e670f9c3fce46c40296ba9ee8a2Ian Hodson ;; 2086f4c12fce1ee58e670f9c3fce46c40296ba9ee8a2Ian Hodson 2087f4c12fce1ee58e670f9c3fce46c40296ba9ee8a2Ian Hodson -static) 2088f4c12fce1ee58e670f9c3fce46c40296ba9ee8a2Ian Hodson build_libtool_libs=no 2089f4c12fce1ee58e670f9c3fce46c40296ba9ee8a2Ian Hodson build_old_libs=yes 2090f4c12fce1ee58e670f9c3fce46c40296ba9ee8a2Ian Hodson continue 2091f4c12fce1ee58e670f9c3fce46c40296ba9ee8a2Ian Hodson ;; 2092f4c12fce1ee58e670f9c3fce46c40296ba9ee8a2Ian Hodson 2093f4c12fce1ee58e670f9c3fce46c40296ba9ee8a2Ian Hodson -prefer-pic) 2094f4c12fce1ee58e670f9c3fce46c40296ba9ee8a2Ian Hodson pic_mode=yes 2095f4c12fce1ee58e670f9c3fce46c40296ba9ee8a2Ian Hodson continue 2096f4c12fce1ee58e670f9c3fce46c40296ba9ee8a2Ian Hodson ;; 2097f4c12fce1ee58e670f9c3fce46c40296ba9ee8a2Ian Hodson 2098f4c12fce1ee58e670f9c3fce46c40296ba9ee8a2Ian Hodson -prefer-non-pic) 2099f4c12fce1ee58e670f9c3fce46c40296ba9ee8a2Ian Hodson pic_mode=no 2100f4c12fce1ee58e670f9c3fce46c40296ba9ee8a2Ian Hodson continue 2101f4c12fce1ee58e670f9c3fce46c40296ba9ee8a2Ian Hodson ;; 2102f4c12fce1ee58e670f9c3fce46c40296ba9ee8a2Ian Hodson esac 2103f4c12fce1ee58e670f9c3fce46c40296ba9ee8a2Ian Hodson done 2104f4c12fce1ee58e670f9c3fce46c40296ba9ee8a2Ian Hodson 2105f4c12fce1ee58e670f9c3fce46c40296ba9ee8a2Ian Hodson func_quote_for_eval "$libobj" 2106f4c12fce1ee58e670f9c3fce46c40296ba9ee8a2Ian Hodson test "X$libobj" != "X$func_quote_for_eval_result" \ 2107f4c12fce1ee58e670f9c3fce46c40296ba9ee8a2Ian Hodson && $ECHO "X$libobj" | $GREP '[]~#^*{};<>?"'"'"' &()|`$[]' \ 2108f4c12fce1ee58e670f9c3fce46c40296ba9ee8a2Ian Hodson && func_warning "libobj name \`$libobj' may not contain shell special characters." 2109f4c12fce1ee58e670f9c3fce46c40296ba9ee8a2Ian Hodson func_dirname_and_basename "$obj" "/" "" 2110f4c12fce1ee58e670f9c3fce46c40296ba9ee8a2Ian Hodson objname="$func_basename_result" 2111f4c12fce1ee58e670f9c3fce46c40296ba9ee8a2Ian Hodson xdir="$func_dirname_result" 2112f4c12fce1ee58e670f9c3fce46c40296ba9ee8a2Ian Hodson lobj=${xdir}$objdir/$objname 2113f4c12fce1ee58e670f9c3fce46c40296ba9ee8a2Ian Hodson 2114f4c12fce1ee58e670f9c3fce46c40296ba9ee8a2Ian Hodson test -z "$base_compile" && \ 2115f4c12fce1ee58e670f9c3fce46c40296ba9ee8a2Ian Hodson func_fatal_help "you must specify a compilation command" 2116f4c12fce1ee58e670f9c3fce46c40296ba9ee8a2Ian Hodson 2117f4c12fce1ee58e670f9c3fce46c40296ba9ee8a2Ian Hodson # Delete any leftover library objects. 2118f4c12fce1ee58e670f9c3fce46c40296ba9ee8a2Ian Hodson if test "$build_old_libs" = yes; then 2119f4c12fce1ee58e670f9c3fce46c40296ba9ee8a2Ian Hodson removelist="$obj $lobj $libobj ${libobj}T" 2120f4c12fce1ee58e670f9c3fce46c40296ba9ee8a2Ian Hodson else 2121f4c12fce1ee58e670f9c3fce46c40296ba9ee8a2Ian Hodson removelist="$lobj $libobj ${libobj}T" 2122f4c12fce1ee58e670f9c3fce46c40296ba9ee8a2Ian Hodson fi 2123f4c12fce1ee58e670f9c3fce46c40296ba9ee8a2Ian Hodson 2124f4c12fce1ee58e670f9c3fce46c40296ba9ee8a2Ian Hodson # On Cygwin there's no "real" PIC flag so we must build both object types 2125f4c12fce1ee58e670f9c3fce46c40296ba9ee8a2Ian Hodson case $host_os in 2126f4c12fce1ee58e670f9c3fce46c40296ba9ee8a2Ian Hodson cygwin* | mingw* | pw32* | os2* | cegcc*) 2127f4c12fce1ee58e670f9c3fce46c40296ba9ee8a2Ian Hodson pic_mode=default 2128f4c12fce1ee58e670f9c3fce46c40296ba9ee8a2Ian Hodson ;; 2129f4c12fce1ee58e670f9c3fce46c40296ba9ee8a2Ian Hodson esac 2130f4c12fce1ee58e670f9c3fce46c40296ba9ee8a2Ian Hodson if test "$pic_mode" = no && test "$deplibs_check_method" != pass_all; then 2131f4c12fce1ee58e670f9c3fce46c40296ba9ee8a2Ian Hodson # non-PIC code in shared libraries is not supported 2132f4c12fce1ee58e670f9c3fce46c40296ba9ee8a2Ian Hodson pic_mode=default 2133f4c12fce1ee58e670f9c3fce46c40296ba9ee8a2Ian Hodson fi 2134f4c12fce1ee58e670f9c3fce46c40296ba9ee8a2Ian Hodson 2135f4c12fce1ee58e670f9c3fce46c40296ba9ee8a2Ian Hodson # Calculate the filename of the output object if compiler does 2136f4c12fce1ee58e670f9c3fce46c40296ba9ee8a2Ian Hodson # not support -o with -c 2137f4c12fce1ee58e670f9c3fce46c40296ba9ee8a2Ian Hodson if test "$compiler_c_o" = no; then 21385b6dc79427b8f7eeb6a7ff68034ab8548ce670eaAlexander Gutkin output_obj=`$ECHO "$srcfile" | $SED 's%^.*/%%; s%\.[^.]*$%%'`.${objext} 2139f4c12fce1ee58e670f9c3fce46c40296ba9ee8a2Ian Hodson lockfile="$output_obj.lock" 2140f4c12fce1ee58e670f9c3fce46c40296ba9ee8a2Ian Hodson else 2141f4c12fce1ee58e670f9c3fce46c40296ba9ee8a2Ian Hodson output_obj= 2142f4c12fce1ee58e670f9c3fce46c40296ba9ee8a2Ian Hodson need_locks=no 2143f4c12fce1ee58e670f9c3fce46c40296ba9ee8a2Ian Hodson lockfile= 2144f4c12fce1ee58e670f9c3fce46c40296ba9ee8a2Ian Hodson fi 2145f4c12fce1ee58e670f9c3fce46c40296ba9ee8a2Ian Hodson 2146f4c12fce1ee58e670f9c3fce46c40296ba9ee8a2Ian Hodson # Lock this critical section if it is needed 2147f4c12fce1ee58e670f9c3fce46c40296ba9ee8a2Ian Hodson # We use this script file to make the link, it avoids creating a new file 2148f4c12fce1ee58e670f9c3fce46c40296ba9ee8a2Ian Hodson if test "$need_locks" = yes; then 2149f4c12fce1ee58e670f9c3fce46c40296ba9ee8a2Ian Hodson until $opt_dry_run || ln "$progpath" "$lockfile" 2>/dev/null; do 2150f4c12fce1ee58e670f9c3fce46c40296ba9ee8a2Ian Hodson func_echo "Waiting for $lockfile to be removed" 2151f4c12fce1ee58e670f9c3fce46c40296ba9ee8a2Ian Hodson sleep 2 2152f4c12fce1ee58e670f9c3fce46c40296ba9ee8a2Ian Hodson done 2153f4c12fce1ee58e670f9c3fce46c40296ba9ee8a2Ian Hodson elif test "$need_locks" = warn; then 2154f4c12fce1ee58e670f9c3fce46c40296ba9ee8a2Ian Hodson if test -f "$lockfile"; then 2155f4c12fce1ee58e670f9c3fce46c40296ba9ee8a2Ian Hodson $ECHO "\ 2156f4c12fce1ee58e670f9c3fce46c40296ba9ee8a2Ian Hodson*** ERROR, $lockfile exists and contains: 2157f4c12fce1ee58e670f9c3fce46c40296ba9ee8a2Ian Hodson`cat $lockfile 2>/dev/null` 2158f4c12fce1ee58e670f9c3fce46c40296ba9ee8a2Ian Hodson 2159f4c12fce1ee58e670f9c3fce46c40296ba9ee8a2Ian HodsonThis indicates that another process is trying to use the same 2160f4c12fce1ee58e670f9c3fce46c40296ba9ee8a2Ian Hodsontemporary object file, and libtool could not work around it because 2161f4c12fce1ee58e670f9c3fce46c40296ba9ee8a2Ian Hodsonyour compiler does not support \`-c' and \`-o' together. If you 2162f4c12fce1ee58e670f9c3fce46c40296ba9ee8a2Ian Hodsonrepeat this compilation, it may succeed, by chance, but you had better 2163f4c12fce1ee58e670f9c3fce46c40296ba9ee8a2Ian Hodsonavoid parallel builds (make -j) in this platform, or get a better 2164f4c12fce1ee58e670f9c3fce46c40296ba9ee8a2Ian Hodsoncompiler." 2165f4c12fce1ee58e670f9c3fce46c40296ba9ee8a2Ian Hodson 2166f4c12fce1ee58e670f9c3fce46c40296ba9ee8a2Ian Hodson $opt_dry_run || $RM $removelist 2167f4c12fce1ee58e670f9c3fce46c40296ba9ee8a2Ian Hodson exit $EXIT_FAILURE 2168f4c12fce1ee58e670f9c3fce46c40296ba9ee8a2Ian Hodson fi 21695b6dc79427b8f7eeb6a7ff68034ab8548ce670eaAlexander Gutkin func_append removelist " $output_obj" 2170f4c12fce1ee58e670f9c3fce46c40296ba9ee8a2Ian Hodson $ECHO "$srcfile" > "$lockfile" 2171f4c12fce1ee58e670f9c3fce46c40296ba9ee8a2Ian Hodson fi 2172f4c12fce1ee58e670f9c3fce46c40296ba9ee8a2Ian Hodson 2173f4c12fce1ee58e670f9c3fce46c40296ba9ee8a2Ian Hodson $opt_dry_run || $RM $removelist 21745b6dc79427b8f7eeb6a7ff68034ab8548ce670eaAlexander Gutkin func_append removelist " $lockfile" 2175f4c12fce1ee58e670f9c3fce46c40296ba9ee8a2Ian Hodson trap '$opt_dry_run || $RM $removelist; exit $EXIT_FAILURE' 1 2 15 2176f4c12fce1ee58e670f9c3fce46c40296ba9ee8a2Ian Hodson 21775b6dc79427b8f7eeb6a7ff68034ab8548ce670eaAlexander Gutkin func_to_tool_file "$srcfile" func_convert_file_msys_to_w32 21785b6dc79427b8f7eeb6a7ff68034ab8548ce670eaAlexander Gutkin srcfile=$func_to_tool_file_result 2179f4c12fce1ee58e670f9c3fce46c40296ba9ee8a2Ian Hodson func_quote_for_eval "$srcfile" 2180f4c12fce1ee58e670f9c3fce46c40296ba9ee8a2Ian Hodson qsrcfile=$func_quote_for_eval_result 2181f4c12fce1ee58e670f9c3fce46c40296ba9ee8a2Ian Hodson 2182f4c12fce1ee58e670f9c3fce46c40296ba9ee8a2Ian Hodson # Only build a PIC object if we are building libtool libraries. 2183f4c12fce1ee58e670f9c3fce46c40296ba9ee8a2Ian Hodson if test "$build_libtool_libs" = yes; then 2184f4c12fce1ee58e670f9c3fce46c40296ba9ee8a2Ian Hodson # Without this assignment, base_compile gets emptied. 2185f4c12fce1ee58e670f9c3fce46c40296ba9ee8a2Ian Hodson fbsd_hideous_sh_bug=$base_compile 2186f4c12fce1ee58e670f9c3fce46c40296ba9ee8a2Ian Hodson 2187f4c12fce1ee58e670f9c3fce46c40296ba9ee8a2Ian Hodson if test "$pic_mode" != no; then 2188f4c12fce1ee58e670f9c3fce46c40296ba9ee8a2Ian Hodson command="$base_compile $qsrcfile $pic_flag" 2189f4c12fce1ee58e670f9c3fce46c40296ba9ee8a2Ian Hodson else 2190f4c12fce1ee58e670f9c3fce46c40296ba9ee8a2Ian Hodson # Don't build PIC code 2191f4c12fce1ee58e670f9c3fce46c40296ba9ee8a2Ian Hodson command="$base_compile $qsrcfile" 2192f4c12fce1ee58e670f9c3fce46c40296ba9ee8a2Ian Hodson fi 2193f4c12fce1ee58e670f9c3fce46c40296ba9ee8a2Ian Hodson 2194f4c12fce1ee58e670f9c3fce46c40296ba9ee8a2Ian Hodson func_mkdir_p "$xdir$objdir" 2195f4c12fce1ee58e670f9c3fce46c40296ba9ee8a2Ian Hodson 2196f4c12fce1ee58e670f9c3fce46c40296ba9ee8a2Ian Hodson if test -z "$output_obj"; then 2197f4c12fce1ee58e670f9c3fce46c40296ba9ee8a2Ian Hodson # Place PIC objects in $objdir 21985b6dc79427b8f7eeb6a7ff68034ab8548ce670eaAlexander Gutkin func_append command " -o $lobj" 2199f4c12fce1ee58e670f9c3fce46c40296ba9ee8a2Ian Hodson fi 2200f4c12fce1ee58e670f9c3fce46c40296ba9ee8a2Ian Hodson 2201f4c12fce1ee58e670f9c3fce46c40296ba9ee8a2Ian Hodson func_show_eval_locale "$command" \ 2202f4c12fce1ee58e670f9c3fce46c40296ba9ee8a2Ian Hodson 'test -n "$output_obj" && $RM $removelist; exit $EXIT_FAILURE' 2203f4c12fce1ee58e670f9c3fce46c40296ba9ee8a2Ian Hodson 2204f4c12fce1ee58e670f9c3fce46c40296ba9ee8a2Ian Hodson if test "$need_locks" = warn && 2205f4c12fce1ee58e670f9c3fce46c40296ba9ee8a2Ian Hodson test "X`cat $lockfile 2>/dev/null`" != "X$srcfile"; then 2206f4c12fce1ee58e670f9c3fce46c40296ba9ee8a2Ian Hodson $ECHO "\ 2207f4c12fce1ee58e670f9c3fce46c40296ba9ee8a2Ian Hodson*** ERROR, $lockfile contains: 2208f4c12fce1ee58e670f9c3fce46c40296ba9ee8a2Ian Hodson`cat $lockfile 2>/dev/null` 2209f4c12fce1ee58e670f9c3fce46c40296ba9ee8a2Ian Hodson 2210f4c12fce1ee58e670f9c3fce46c40296ba9ee8a2Ian Hodsonbut it should contain: 2211f4c12fce1ee58e670f9c3fce46c40296ba9ee8a2Ian Hodson$srcfile 2212f4c12fce1ee58e670f9c3fce46c40296ba9ee8a2Ian Hodson 2213f4c12fce1ee58e670f9c3fce46c40296ba9ee8a2Ian HodsonThis indicates that another process is trying to use the same 2214f4c12fce1ee58e670f9c3fce46c40296ba9ee8a2Ian Hodsontemporary object file, and libtool could not work around it because 2215f4c12fce1ee58e670f9c3fce46c40296ba9ee8a2Ian Hodsonyour compiler does not support \`-c' and \`-o' together. If you 2216f4c12fce1ee58e670f9c3fce46c40296ba9ee8a2Ian Hodsonrepeat this compilation, it may succeed, by chance, but you had better 2217f4c12fce1ee58e670f9c3fce46c40296ba9ee8a2Ian Hodsonavoid parallel builds (make -j) in this platform, or get a better 2218f4c12fce1ee58e670f9c3fce46c40296ba9ee8a2Ian Hodsoncompiler." 2219f4c12fce1ee58e670f9c3fce46c40296ba9ee8a2Ian Hodson 2220f4c12fce1ee58e670f9c3fce46c40296ba9ee8a2Ian Hodson $opt_dry_run || $RM $removelist 2221f4c12fce1ee58e670f9c3fce46c40296ba9ee8a2Ian Hodson exit $EXIT_FAILURE 2222f4c12fce1ee58e670f9c3fce46c40296ba9ee8a2Ian Hodson fi 2223f4c12fce1ee58e670f9c3fce46c40296ba9ee8a2Ian Hodson 2224f4c12fce1ee58e670f9c3fce46c40296ba9ee8a2Ian Hodson # Just move the object if needed, then go on to compile the next one 2225f4c12fce1ee58e670f9c3fce46c40296ba9ee8a2Ian Hodson if test -n "$output_obj" && test "X$output_obj" != "X$lobj"; then 2226f4c12fce1ee58e670f9c3fce46c40296ba9ee8a2Ian Hodson func_show_eval '$MV "$output_obj" "$lobj"' \ 2227f4c12fce1ee58e670f9c3fce46c40296ba9ee8a2Ian Hodson 'error=$?; $opt_dry_run || $RM $removelist; exit $error' 2228f4c12fce1ee58e670f9c3fce46c40296ba9ee8a2Ian Hodson fi 2229f4c12fce1ee58e670f9c3fce46c40296ba9ee8a2Ian Hodson 2230f4c12fce1ee58e670f9c3fce46c40296ba9ee8a2Ian Hodson # Allow error messages only from the first compilation. 2231f4c12fce1ee58e670f9c3fce46c40296ba9ee8a2Ian Hodson if test "$suppress_opt" = yes; then 2232f4c12fce1ee58e670f9c3fce46c40296ba9ee8a2Ian Hodson suppress_output=' >/dev/null 2>&1' 2233f4c12fce1ee58e670f9c3fce46c40296ba9ee8a2Ian Hodson fi 2234f4c12fce1ee58e670f9c3fce46c40296ba9ee8a2Ian Hodson fi 2235f4c12fce1ee58e670f9c3fce46c40296ba9ee8a2Ian Hodson 2236f4c12fce1ee58e670f9c3fce46c40296ba9ee8a2Ian Hodson # Only build a position-dependent object if we build old libraries. 2237f4c12fce1ee58e670f9c3fce46c40296ba9ee8a2Ian Hodson if test "$build_old_libs" = yes; then 2238f4c12fce1ee58e670f9c3fce46c40296ba9ee8a2Ian Hodson if test "$pic_mode" != yes; then 2239f4c12fce1ee58e670f9c3fce46c40296ba9ee8a2Ian Hodson # Don't build PIC code 2240f4c12fce1ee58e670f9c3fce46c40296ba9ee8a2Ian Hodson command="$base_compile $qsrcfile$pie_flag" 2241f4c12fce1ee58e670f9c3fce46c40296ba9ee8a2Ian Hodson else 2242f4c12fce1ee58e670f9c3fce46c40296ba9ee8a2Ian Hodson command="$base_compile $qsrcfile $pic_flag" 2243f4c12fce1ee58e670f9c3fce46c40296ba9ee8a2Ian Hodson fi 2244f4c12fce1ee58e670f9c3fce46c40296ba9ee8a2Ian Hodson if test "$compiler_c_o" = yes; then 22455b6dc79427b8f7eeb6a7ff68034ab8548ce670eaAlexander Gutkin func_append command " -o $obj" 2246f4c12fce1ee58e670f9c3fce46c40296ba9ee8a2Ian Hodson fi 2247f4c12fce1ee58e670f9c3fce46c40296ba9ee8a2Ian Hodson 2248f4c12fce1ee58e670f9c3fce46c40296ba9ee8a2Ian Hodson # Suppress compiler output if we already did a PIC compilation. 22495b6dc79427b8f7eeb6a7ff68034ab8548ce670eaAlexander Gutkin func_append command "$suppress_output" 2250f4c12fce1ee58e670f9c3fce46c40296ba9ee8a2Ian Hodson func_show_eval_locale "$command" \ 2251f4c12fce1ee58e670f9c3fce46c40296ba9ee8a2Ian Hodson '$opt_dry_run || $RM $removelist; exit $EXIT_FAILURE' 2252f4c12fce1ee58e670f9c3fce46c40296ba9ee8a2Ian Hodson 2253f4c12fce1ee58e670f9c3fce46c40296ba9ee8a2Ian Hodson if test "$need_locks" = warn && 2254f4c12fce1ee58e670f9c3fce46c40296ba9ee8a2Ian Hodson test "X`cat $lockfile 2>/dev/null`" != "X$srcfile"; then 2255f4c12fce1ee58e670f9c3fce46c40296ba9ee8a2Ian Hodson $ECHO "\ 2256f4c12fce1ee58e670f9c3fce46c40296ba9ee8a2Ian Hodson*** ERROR, $lockfile contains: 2257f4c12fce1ee58e670f9c3fce46c40296ba9ee8a2Ian Hodson`cat $lockfile 2>/dev/null` 2258f4c12fce1ee58e670f9c3fce46c40296ba9ee8a2Ian Hodson 2259f4c12fce1ee58e670f9c3fce46c40296ba9ee8a2Ian Hodsonbut it should contain: 2260f4c12fce1ee58e670f9c3fce46c40296ba9ee8a2Ian Hodson$srcfile 2261f4c12fce1ee58e670f9c3fce46c40296ba9ee8a2Ian Hodson 2262f4c12fce1ee58e670f9c3fce46c40296ba9ee8a2Ian HodsonThis indicates that another process is trying to use the same 2263f4c12fce1ee58e670f9c3fce46c40296ba9ee8a2Ian Hodsontemporary object file, and libtool could not work around it because 2264f4c12fce1ee58e670f9c3fce46c40296ba9ee8a2Ian Hodsonyour compiler does not support \`-c' and \`-o' together. If you 2265f4c12fce1ee58e670f9c3fce46c40296ba9ee8a2Ian Hodsonrepeat this compilation, it may succeed, by chance, but you had better 2266f4c12fce1ee58e670f9c3fce46c40296ba9ee8a2Ian Hodsonavoid parallel builds (make -j) in this platform, or get a better 2267f4c12fce1ee58e670f9c3fce46c40296ba9ee8a2Ian Hodsoncompiler." 2268f4c12fce1ee58e670f9c3fce46c40296ba9ee8a2Ian Hodson 2269f4c12fce1ee58e670f9c3fce46c40296ba9ee8a2Ian Hodson $opt_dry_run || $RM $removelist 2270f4c12fce1ee58e670f9c3fce46c40296ba9ee8a2Ian Hodson exit $EXIT_FAILURE 2271f4c12fce1ee58e670f9c3fce46c40296ba9ee8a2Ian Hodson fi 2272f4c12fce1ee58e670f9c3fce46c40296ba9ee8a2Ian Hodson 2273f4c12fce1ee58e670f9c3fce46c40296ba9ee8a2Ian Hodson # Just move the object if needed 2274f4c12fce1ee58e670f9c3fce46c40296ba9ee8a2Ian Hodson if test -n "$output_obj" && test "X$output_obj" != "X$obj"; then 2275f4c12fce1ee58e670f9c3fce46c40296ba9ee8a2Ian Hodson func_show_eval '$MV "$output_obj" "$obj"' \ 2276f4c12fce1ee58e670f9c3fce46c40296ba9ee8a2Ian Hodson 'error=$?; $opt_dry_run || $RM $removelist; exit $error' 2277f4c12fce1ee58e670f9c3fce46c40296ba9ee8a2Ian Hodson fi 2278f4c12fce1ee58e670f9c3fce46c40296ba9ee8a2Ian Hodson fi 2279f4c12fce1ee58e670f9c3fce46c40296ba9ee8a2Ian Hodson 2280f4c12fce1ee58e670f9c3fce46c40296ba9ee8a2Ian Hodson $opt_dry_run || { 2281f4c12fce1ee58e670f9c3fce46c40296ba9ee8a2Ian Hodson func_write_libtool_object "$libobj" "$objdir/$objname" "$objname" 2282f4c12fce1ee58e670f9c3fce46c40296ba9ee8a2Ian Hodson 2283f4c12fce1ee58e670f9c3fce46c40296ba9ee8a2Ian Hodson # Unlock the critical section if it was locked 2284f4c12fce1ee58e670f9c3fce46c40296ba9ee8a2Ian Hodson if test "$need_locks" != no; then 2285f4c12fce1ee58e670f9c3fce46c40296ba9ee8a2Ian Hodson removelist=$lockfile 2286f4c12fce1ee58e670f9c3fce46c40296ba9ee8a2Ian Hodson $RM "$lockfile" 2287f4c12fce1ee58e670f9c3fce46c40296ba9ee8a2Ian Hodson fi 2288f4c12fce1ee58e670f9c3fce46c40296ba9ee8a2Ian Hodson } 2289f4c12fce1ee58e670f9c3fce46c40296ba9ee8a2Ian Hodson 2290f4c12fce1ee58e670f9c3fce46c40296ba9ee8a2Ian Hodson exit $EXIT_SUCCESS 2291f4c12fce1ee58e670f9c3fce46c40296ba9ee8a2Ian Hodson} 2292f4c12fce1ee58e670f9c3fce46c40296ba9ee8a2Ian Hodson 2293f4c12fce1ee58e670f9c3fce46c40296ba9ee8a2Ian Hodson$opt_help || { 22945b6dc79427b8f7eeb6a7ff68034ab8548ce670eaAlexander Gutkin test "$opt_mode" = compile && func_mode_compile ${1+"$@"} 2295f4c12fce1ee58e670f9c3fce46c40296ba9ee8a2Ian Hodson} 2296f4c12fce1ee58e670f9c3fce46c40296ba9ee8a2Ian Hodson 2297f4c12fce1ee58e670f9c3fce46c40296ba9ee8a2Ian Hodsonfunc_mode_help () 2298f4c12fce1ee58e670f9c3fce46c40296ba9ee8a2Ian Hodson{ 2299f4c12fce1ee58e670f9c3fce46c40296ba9ee8a2Ian Hodson # We need to display help for each of the modes. 23005b6dc79427b8f7eeb6a7ff68034ab8548ce670eaAlexander Gutkin case $opt_mode in 2301f4c12fce1ee58e670f9c3fce46c40296ba9ee8a2Ian Hodson "") 2302f4c12fce1ee58e670f9c3fce46c40296ba9ee8a2Ian Hodson # Generic help is extracted from the usage comments 2303f4c12fce1ee58e670f9c3fce46c40296ba9ee8a2Ian Hodson # at the start of this file. 2304f4c12fce1ee58e670f9c3fce46c40296ba9ee8a2Ian Hodson func_help 2305f4c12fce1ee58e670f9c3fce46c40296ba9ee8a2Ian Hodson ;; 2306f4c12fce1ee58e670f9c3fce46c40296ba9ee8a2Ian Hodson 2307f4c12fce1ee58e670f9c3fce46c40296ba9ee8a2Ian Hodson clean) 2308f4c12fce1ee58e670f9c3fce46c40296ba9ee8a2Ian Hodson $ECHO \ 2309f4c12fce1ee58e670f9c3fce46c40296ba9ee8a2Ian Hodson"Usage: $progname [OPTION]... --mode=clean RM [RM-OPTION]... FILE... 2310f4c12fce1ee58e670f9c3fce46c40296ba9ee8a2Ian Hodson 2311f4c12fce1ee58e670f9c3fce46c40296ba9ee8a2Ian HodsonRemove files from the build directory. 2312f4c12fce1ee58e670f9c3fce46c40296ba9ee8a2Ian Hodson 2313f4c12fce1ee58e670f9c3fce46c40296ba9ee8a2Ian HodsonRM is the name of the program to use to delete files associated with each FILE 2314f4c12fce1ee58e670f9c3fce46c40296ba9ee8a2Ian Hodson(typically \`/bin/rm'). RM-OPTIONS are options (such as \`-f') to be passed 2315f4c12fce1ee58e670f9c3fce46c40296ba9ee8a2Ian Hodsonto RM. 2316f4c12fce1ee58e670f9c3fce46c40296ba9ee8a2Ian Hodson 2317f4c12fce1ee58e670f9c3fce46c40296ba9ee8a2Ian HodsonIf FILE is a libtool library, object or program, all the files associated 2318f4c12fce1ee58e670f9c3fce46c40296ba9ee8a2Ian Hodsonwith it are deleted. Otherwise, only FILE itself is deleted using RM." 2319f4c12fce1ee58e670f9c3fce46c40296ba9ee8a2Ian Hodson ;; 2320f4c12fce1ee58e670f9c3fce46c40296ba9ee8a2Ian Hodson 2321f4c12fce1ee58e670f9c3fce46c40296ba9ee8a2Ian Hodson compile) 2322f4c12fce1ee58e670f9c3fce46c40296ba9ee8a2Ian Hodson $ECHO \ 2323f4c12fce1ee58e670f9c3fce46c40296ba9ee8a2Ian Hodson"Usage: $progname [OPTION]... --mode=compile COMPILE-COMMAND... SOURCEFILE 2324f4c12fce1ee58e670f9c3fce46c40296ba9ee8a2Ian Hodson 2325f4c12fce1ee58e670f9c3fce46c40296ba9ee8a2Ian HodsonCompile a source file into a libtool library object. 2326f4c12fce1ee58e670f9c3fce46c40296ba9ee8a2Ian Hodson 2327f4c12fce1ee58e670f9c3fce46c40296ba9ee8a2Ian HodsonThis mode accepts the following additional options: 2328f4c12fce1ee58e670f9c3fce46c40296ba9ee8a2Ian Hodson 2329f4c12fce1ee58e670f9c3fce46c40296ba9ee8a2Ian Hodson -o OUTPUT-FILE set the output file name to OUTPUT-FILE 2330f4c12fce1ee58e670f9c3fce46c40296ba9ee8a2Ian Hodson -no-suppress do not suppress compiler output for multiple passes 23315b6dc79427b8f7eeb6a7ff68034ab8548ce670eaAlexander Gutkin -prefer-pic try to build PIC objects only 23325b6dc79427b8f7eeb6a7ff68034ab8548ce670eaAlexander Gutkin -prefer-non-pic try to build non-PIC objects only 2333f4c12fce1ee58e670f9c3fce46c40296ba9ee8a2Ian Hodson -shared do not build a \`.o' file suitable for static linking 2334f4c12fce1ee58e670f9c3fce46c40296ba9ee8a2Ian Hodson -static only build a \`.o' file suitable for static linking 23355b6dc79427b8f7eeb6a7ff68034ab8548ce670eaAlexander Gutkin -Wc,FLAG pass FLAG directly to the compiler 2336f4c12fce1ee58e670f9c3fce46c40296ba9ee8a2Ian Hodson 2337f4c12fce1ee58e670f9c3fce46c40296ba9ee8a2Ian HodsonCOMPILE-COMMAND is a command to be used in creating a \`standard' object file 2338f4c12fce1ee58e670f9c3fce46c40296ba9ee8a2Ian Hodsonfrom the given SOURCEFILE. 2339f4c12fce1ee58e670f9c3fce46c40296ba9ee8a2Ian Hodson 2340f4c12fce1ee58e670f9c3fce46c40296ba9ee8a2Ian HodsonThe output file name is determined by removing the directory component from 2341f4c12fce1ee58e670f9c3fce46c40296ba9ee8a2Ian HodsonSOURCEFILE, then substituting the C source code suffix \`.c' with the 2342f4c12fce1ee58e670f9c3fce46c40296ba9ee8a2Ian Hodsonlibrary object suffix, \`.lo'." 2343f4c12fce1ee58e670f9c3fce46c40296ba9ee8a2Ian Hodson ;; 2344f4c12fce1ee58e670f9c3fce46c40296ba9ee8a2Ian Hodson 2345f4c12fce1ee58e670f9c3fce46c40296ba9ee8a2Ian Hodson execute) 2346f4c12fce1ee58e670f9c3fce46c40296ba9ee8a2Ian Hodson $ECHO \ 2347f4c12fce1ee58e670f9c3fce46c40296ba9ee8a2Ian Hodson"Usage: $progname [OPTION]... --mode=execute COMMAND [ARGS]... 2348f4c12fce1ee58e670f9c3fce46c40296ba9ee8a2Ian Hodson 2349f4c12fce1ee58e670f9c3fce46c40296ba9ee8a2Ian HodsonAutomatically set library path, then run a program. 2350f4c12fce1ee58e670f9c3fce46c40296ba9ee8a2Ian Hodson 2351f4c12fce1ee58e670f9c3fce46c40296ba9ee8a2Ian HodsonThis mode accepts the following additional options: 2352f4c12fce1ee58e670f9c3fce46c40296ba9ee8a2Ian Hodson 2353f4c12fce1ee58e670f9c3fce46c40296ba9ee8a2Ian Hodson -dlopen FILE add the directory containing FILE to the library path 2354f4c12fce1ee58e670f9c3fce46c40296ba9ee8a2Ian Hodson 2355f4c12fce1ee58e670f9c3fce46c40296ba9ee8a2Ian HodsonThis mode sets the library path environment variable according to \`-dlopen' 2356f4c12fce1ee58e670f9c3fce46c40296ba9ee8a2Ian Hodsonflags. 2357f4c12fce1ee58e670f9c3fce46c40296ba9ee8a2Ian Hodson 2358f4c12fce1ee58e670f9c3fce46c40296ba9ee8a2Ian HodsonIf any of the ARGS are libtool executable wrappers, then they are translated 2359f4c12fce1ee58e670f9c3fce46c40296ba9ee8a2Ian Hodsoninto their corresponding uninstalled binary, and any of their required library 2360f4c12fce1ee58e670f9c3fce46c40296ba9ee8a2Ian Hodsondirectories are added to the library path. 2361f4c12fce1ee58e670f9c3fce46c40296ba9ee8a2Ian Hodson 2362f4c12fce1ee58e670f9c3fce46c40296ba9ee8a2Ian HodsonThen, COMMAND is executed, with ARGS as arguments." 2363f4c12fce1ee58e670f9c3fce46c40296ba9ee8a2Ian Hodson ;; 2364f4c12fce1ee58e670f9c3fce46c40296ba9ee8a2Ian Hodson 2365f4c12fce1ee58e670f9c3fce46c40296ba9ee8a2Ian Hodson finish) 2366f4c12fce1ee58e670f9c3fce46c40296ba9ee8a2Ian Hodson $ECHO \ 2367f4c12fce1ee58e670f9c3fce46c40296ba9ee8a2Ian Hodson"Usage: $progname [OPTION]... --mode=finish [LIBDIR]... 2368f4c12fce1ee58e670f9c3fce46c40296ba9ee8a2Ian Hodson 2369f4c12fce1ee58e670f9c3fce46c40296ba9ee8a2Ian HodsonComplete the installation of libtool libraries. 2370f4c12fce1ee58e670f9c3fce46c40296ba9ee8a2Ian Hodson 2371f4c12fce1ee58e670f9c3fce46c40296ba9ee8a2Ian HodsonEach LIBDIR is a directory that contains libtool libraries. 2372f4c12fce1ee58e670f9c3fce46c40296ba9ee8a2Ian Hodson 2373f4c12fce1ee58e670f9c3fce46c40296ba9ee8a2Ian HodsonThe commands that this mode executes may require superuser privileges. Use 2374f4c12fce1ee58e670f9c3fce46c40296ba9ee8a2Ian Hodsonthe \`--dry-run' option if you just want to see what would be executed." 2375f4c12fce1ee58e670f9c3fce46c40296ba9ee8a2Ian Hodson ;; 2376f4c12fce1ee58e670f9c3fce46c40296ba9ee8a2Ian Hodson 2377f4c12fce1ee58e670f9c3fce46c40296ba9ee8a2Ian Hodson install) 2378f4c12fce1ee58e670f9c3fce46c40296ba9ee8a2Ian Hodson $ECHO \ 2379f4c12fce1ee58e670f9c3fce46c40296ba9ee8a2Ian Hodson"Usage: $progname [OPTION]... --mode=install INSTALL-COMMAND... 2380f4c12fce1ee58e670f9c3fce46c40296ba9ee8a2Ian Hodson 2381f4c12fce1ee58e670f9c3fce46c40296ba9ee8a2Ian HodsonInstall executables or libraries. 2382f4c12fce1ee58e670f9c3fce46c40296ba9ee8a2Ian Hodson 2383f4c12fce1ee58e670f9c3fce46c40296ba9ee8a2Ian HodsonINSTALL-COMMAND is the installation command. The first component should be 2384f4c12fce1ee58e670f9c3fce46c40296ba9ee8a2Ian Hodsoneither the \`install' or \`cp' program. 2385f4c12fce1ee58e670f9c3fce46c40296ba9ee8a2Ian Hodson 2386f4c12fce1ee58e670f9c3fce46c40296ba9ee8a2Ian HodsonThe following components of INSTALL-COMMAND are treated specially: 2387f4c12fce1ee58e670f9c3fce46c40296ba9ee8a2Ian Hodson 23885b6dc79427b8f7eeb6a7ff68034ab8548ce670eaAlexander Gutkin -inst-prefix-dir PREFIX-DIR Use PREFIX-DIR as a staging area for installation 2389f4c12fce1ee58e670f9c3fce46c40296ba9ee8a2Ian Hodson 2390f4c12fce1ee58e670f9c3fce46c40296ba9ee8a2Ian HodsonThe rest of the components are interpreted as arguments to that command (only 2391f4c12fce1ee58e670f9c3fce46c40296ba9ee8a2Ian HodsonBSD-compatible install options are recognized)." 2392f4c12fce1ee58e670f9c3fce46c40296ba9ee8a2Ian Hodson ;; 2393f4c12fce1ee58e670f9c3fce46c40296ba9ee8a2Ian Hodson 2394f4c12fce1ee58e670f9c3fce46c40296ba9ee8a2Ian Hodson link) 2395f4c12fce1ee58e670f9c3fce46c40296ba9ee8a2Ian Hodson $ECHO \ 2396f4c12fce1ee58e670f9c3fce46c40296ba9ee8a2Ian Hodson"Usage: $progname [OPTION]... --mode=link LINK-COMMAND... 2397f4c12fce1ee58e670f9c3fce46c40296ba9ee8a2Ian Hodson 2398f4c12fce1ee58e670f9c3fce46c40296ba9ee8a2Ian HodsonLink object files or libraries together to form another library, or to 2399f4c12fce1ee58e670f9c3fce46c40296ba9ee8a2Ian Hodsoncreate an executable program. 2400f4c12fce1ee58e670f9c3fce46c40296ba9ee8a2Ian Hodson 2401f4c12fce1ee58e670f9c3fce46c40296ba9ee8a2Ian HodsonLINK-COMMAND is a command using the C compiler that you would use to create 2402f4c12fce1ee58e670f9c3fce46c40296ba9ee8a2Ian Hodsona program from several object files. 2403f4c12fce1ee58e670f9c3fce46c40296ba9ee8a2Ian Hodson 2404f4c12fce1ee58e670f9c3fce46c40296ba9ee8a2Ian HodsonThe following components of LINK-COMMAND are treated specially: 2405f4c12fce1ee58e670f9c3fce46c40296ba9ee8a2Ian Hodson 2406f4c12fce1ee58e670f9c3fce46c40296ba9ee8a2Ian Hodson -all-static do not do any dynamic linking at all 2407f4c12fce1ee58e670f9c3fce46c40296ba9ee8a2Ian Hodson -avoid-version do not add a version suffix if possible 24085b6dc79427b8f7eeb6a7ff68034ab8548ce670eaAlexander Gutkin -bindir BINDIR specify path to binaries directory (for systems where 24095b6dc79427b8f7eeb6a7ff68034ab8548ce670eaAlexander Gutkin libraries must be found in the PATH setting at runtime) 2410f4c12fce1ee58e670f9c3fce46c40296ba9ee8a2Ian Hodson -dlopen FILE \`-dlpreopen' FILE if it cannot be dlopened at runtime 2411f4c12fce1ee58e670f9c3fce46c40296ba9ee8a2Ian Hodson -dlpreopen FILE link in FILE and add its symbols to lt_preloaded_symbols 2412f4c12fce1ee58e670f9c3fce46c40296ba9ee8a2Ian Hodson -export-dynamic allow symbols from OUTPUT-FILE to be resolved with dlsym(3) 2413f4c12fce1ee58e670f9c3fce46c40296ba9ee8a2Ian Hodson -export-symbols SYMFILE 2414f4c12fce1ee58e670f9c3fce46c40296ba9ee8a2Ian Hodson try to export only the symbols listed in SYMFILE 2415f4c12fce1ee58e670f9c3fce46c40296ba9ee8a2Ian Hodson -export-symbols-regex REGEX 2416f4c12fce1ee58e670f9c3fce46c40296ba9ee8a2Ian Hodson try to export only the symbols matching REGEX 2417f4c12fce1ee58e670f9c3fce46c40296ba9ee8a2Ian Hodson -LLIBDIR search LIBDIR for required installed libraries 2418f4c12fce1ee58e670f9c3fce46c40296ba9ee8a2Ian Hodson -lNAME OUTPUT-FILE requires the installed library libNAME 2419f4c12fce1ee58e670f9c3fce46c40296ba9ee8a2Ian Hodson -module build a library that can dlopened 2420f4c12fce1ee58e670f9c3fce46c40296ba9ee8a2Ian Hodson -no-fast-install disable the fast-install mode 2421f4c12fce1ee58e670f9c3fce46c40296ba9ee8a2Ian Hodson -no-install link a not-installable executable 2422f4c12fce1ee58e670f9c3fce46c40296ba9ee8a2Ian Hodson -no-undefined declare that a library does not refer to external symbols 2423f4c12fce1ee58e670f9c3fce46c40296ba9ee8a2Ian Hodson -o OUTPUT-FILE create OUTPUT-FILE from the specified objects 2424f4c12fce1ee58e670f9c3fce46c40296ba9ee8a2Ian Hodson -objectlist FILE Use a list of object files found in FILE to specify objects 2425f4c12fce1ee58e670f9c3fce46c40296ba9ee8a2Ian Hodson -precious-files-regex REGEX 2426f4c12fce1ee58e670f9c3fce46c40296ba9ee8a2Ian Hodson don't remove output files matching REGEX 2427f4c12fce1ee58e670f9c3fce46c40296ba9ee8a2Ian Hodson -release RELEASE specify package release information 2428f4c12fce1ee58e670f9c3fce46c40296ba9ee8a2Ian Hodson -rpath LIBDIR the created library will eventually be installed in LIBDIR 2429f4c12fce1ee58e670f9c3fce46c40296ba9ee8a2Ian Hodson -R[ ]LIBDIR add LIBDIR to the runtime path of programs and libraries 2430f4c12fce1ee58e670f9c3fce46c40296ba9ee8a2Ian Hodson -shared only do dynamic linking of libtool libraries 2431f4c12fce1ee58e670f9c3fce46c40296ba9ee8a2Ian Hodson -shrext SUFFIX override the standard shared library file extension 2432f4c12fce1ee58e670f9c3fce46c40296ba9ee8a2Ian Hodson -static do not do any dynamic linking of uninstalled libtool libraries 2433f4c12fce1ee58e670f9c3fce46c40296ba9ee8a2Ian Hodson -static-libtool-libs 2434f4c12fce1ee58e670f9c3fce46c40296ba9ee8a2Ian Hodson do not do any dynamic linking of libtool libraries 2435f4c12fce1ee58e670f9c3fce46c40296ba9ee8a2Ian Hodson -version-info CURRENT[:REVISION[:AGE]] 2436f4c12fce1ee58e670f9c3fce46c40296ba9ee8a2Ian Hodson specify library version info [each variable defaults to 0] 2437f4c12fce1ee58e670f9c3fce46c40296ba9ee8a2Ian Hodson -weak LIBNAME declare that the target provides the LIBNAME interface 24385b6dc79427b8f7eeb6a7ff68034ab8548ce670eaAlexander Gutkin -Wc,FLAG 24395b6dc79427b8f7eeb6a7ff68034ab8548ce670eaAlexander Gutkin -Xcompiler FLAG pass linker-specific FLAG directly to the compiler 24405b6dc79427b8f7eeb6a7ff68034ab8548ce670eaAlexander Gutkin -Wl,FLAG 24415b6dc79427b8f7eeb6a7ff68034ab8548ce670eaAlexander Gutkin -Xlinker FLAG pass linker-specific FLAG directly to the linker 24425b6dc79427b8f7eeb6a7ff68034ab8548ce670eaAlexander Gutkin -XCClinker FLAG pass link-specific FLAG to the compiler driver (CC) 2443f4c12fce1ee58e670f9c3fce46c40296ba9ee8a2Ian Hodson 2444f4c12fce1ee58e670f9c3fce46c40296ba9ee8a2Ian HodsonAll other options (arguments beginning with \`-') are ignored. 2445f4c12fce1ee58e670f9c3fce46c40296ba9ee8a2Ian Hodson 2446f4c12fce1ee58e670f9c3fce46c40296ba9ee8a2Ian HodsonEvery other argument is treated as a filename. Files ending in \`.la' are 2447f4c12fce1ee58e670f9c3fce46c40296ba9ee8a2Ian Hodsontreated as uninstalled libtool libraries, other files are standard or library 2448f4c12fce1ee58e670f9c3fce46c40296ba9ee8a2Ian Hodsonobject files. 2449f4c12fce1ee58e670f9c3fce46c40296ba9ee8a2Ian Hodson 2450f4c12fce1ee58e670f9c3fce46c40296ba9ee8a2Ian HodsonIf the OUTPUT-FILE ends in \`.la', then a libtool library is created, 2451f4c12fce1ee58e670f9c3fce46c40296ba9ee8a2Ian Hodsononly library objects (\`.lo' files) may be specified, and \`-rpath' is 2452f4c12fce1ee58e670f9c3fce46c40296ba9ee8a2Ian Hodsonrequired, except when creating a convenience library. 2453f4c12fce1ee58e670f9c3fce46c40296ba9ee8a2Ian Hodson 2454f4c12fce1ee58e670f9c3fce46c40296ba9ee8a2Ian HodsonIf OUTPUT-FILE ends in \`.a' or \`.lib', then a standard library is created 2455f4c12fce1ee58e670f9c3fce46c40296ba9ee8a2Ian Hodsonusing \`ar' and \`ranlib', or on Windows using \`lib'. 2456f4c12fce1ee58e670f9c3fce46c40296ba9ee8a2Ian Hodson 2457f4c12fce1ee58e670f9c3fce46c40296ba9ee8a2Ian HodsonIf OUTPUT-FILE ends in \`.lo' or \`.${objext}', then a reloadable object file 2458f4c12fce1ee58e670f9c3fce46c40296ba9ee8a2Ian Hodsonis created, otherwise an executable program is created." 2459f4c12fce1ee58e670f9c3fce46c40296ba9ee8a2Ian Hodson ;; 2460f4c12fce1ee58e670f9c3fce46c40296ba9ee8a2Ian Hodson 2461f4c12fce1ee58e670f9c3fce46c40296ba9ee8a2Ian Hodson uninstall) 2462f4c12fce1ee58e670f9c3fce46c40296ba9ee8a2Ian Hodson $ECHO \ 2463f4c12fce1ee58e670f9c3fce46c40296ba9ee8a2Ian Hodson"Usage: $progname [OPTION]... --mode=uninstall RM [RM-OPTION]... FILE... 2464f4c12fce1ee58e670f9c3fce46c40296ba9ee8a2Ian Hodson 2465f4c12fce1ee58e670f9c3fce46c40296ba9ee8a2Ian HodsonRemove libraries from an installation directory. 2466f4c12fce1ee58e670f9c3fce46c40296ba9ee8a2Ian Hodson 2467f4c12fce1ee58e670f9c3fce46c40296ba9ee8a2Ian HodsonRM is the name of the program to use to delete files associated with each FILE 2468f4c12fce1ee58e670f9c3fce46c40296ba9ee8a2Ian Hodson(typically \`/bin/rm'). RM-OPTIONS are options (such as \`-f') to be passed 2469f4c12fce1ee58e670f9c3fce46c40296ba9ee8a2Ian Hodsonto RM. 2470f4c12fce1ee58e670f9c3fce46c40296ba9ee8a2Ian Hodson 2471f4c12fce1ee58e670f9c3fce46c40296ba9ee8a2Ian HodsonIf FILE is a libtool library, all the files associated with it are deleted. 2472f4c12fce1ee58e670f9c3fce46c40296ba9ee8a2Ian HodsonOtherwise, only FILE itself is deleted using RM." 2473f4c12fce1ee58e670f9c3fce46c40296ba9ee8a2Ian Hodson ;; 2474f4c12fce1ee58e670f9c3fce46c40296ba9ee8a2Ian Hodson 2475f4c12fce1ee58e670f9c3fce46c40296ba9ee8a2Ian Hodson *) 24765b6dc79427b8f7eeb6a7ff68034ab8548ce670eaAlexander Gutkin func_fatal_help "invalid operation mode \`$opt_mode'" 2477f4c12fce1ee58e670f9c3fce46c40296ba9ee8a2Ian Hodson ;; 2478f4c12fce1ee58e670f9c3fce46c40296ba9ee8a2Ian Hodson esac 2479f4c12fce1ee58e670f9c3fce46c40296ba9ee8a2Ian Hodson 24805b6dc79427b8f7eeb6a7ff68034ab8548ce670eaAlexander Gutkin echo 2481f4c12fce1ee58e670f9c3fce46c40296ba9ee8a2Ian Hodson $ECHO "Try \`$progname --help' for more information about other modes." 2482f4c12fce1ee58e670f9c3fce46c40296ba9ee8a2Ian Hodson} 2483f4c12fce1ee58e670f9c3fce46c40296ba9ee8a2Ian Hodson 24845b6dc79427b8f7eeb6a7ff68034ab8548ce670eaAlexander Gutkin# Now that we've collected a possible --mode arg, show help if necessary 24855b6dc79427b8f7eeb6a7ff68034ab8548ce670eaAlexander Gutkinif $opt_help; then 24865b6dc79427b8f7eeb6a7ff68034ab8548ce670eaAlexander Gutkin if test "$opt_help" = :; then 24875b6dc79427b8f7eeb6a7ff68034ab8548ce670eaAlexander Gutkin func_mode_help 24885b6dc79427b8f7eeb6a7ff68034ab8548ce670eaAlexander Gutkin else 24895b6dc79427b8f7eeb6a7ff68034ab8548ce670eaAlexander Gutkin { 24905b6dc79427b8f7eeb6a7ff68034ab8548ce670eaAlexander Gutkin func_help noexit 24915b6dc79427b8f7eeb6a7ff68034ab8548ce670eaAlexander Gutkin for opt_mode in compile link execute install finish uninstall clean; do 24925b6dc79427b8f7eeb6a7ff68034ab8548ce670eaAlexander Gutkin func_mode_help 24935b6dc79427b8f7eeb6a7ff68034ab8548ce670eaAlexander Gutkin done 24945b6dc79427b8f7eeb6a7ff68034ab8548ce670eaAlexander Gutkin } | sed -n '1p; 2,$s/^Usage:/ or: /p' 24955b6dc79427b8f7eeb6a7ff68034ab8548ce670eaAlexander Gutkin { 24965b6dc79427b8f7eeb6a7ff68034ab8548ce670eaAlexander Gutkin func_help noexit 24975b6dc79427b8f7eeb6a7ff68034ab8548ce670eaAlexander Gutkin for opt_mode in compile link execute install finish uninstall clean; do 24985b6dc79427b8f7eeb6a7ff68034ab8548ce670eaAlexander Gutkin echo 24995b6dc79427b8f7eeb6a7ff68034ab8548ce670eaAlexander Gutkin func_mode_help 25005b6dc79427b8f7eeb6a7ff68034ab8548ce670eaAlexander Gutkin done 25015b6dc79427b8f7eeb6a7ff68034ab8548ce670eaAlexander Gutkin } | 25025b6dc79427b8f7eeb6a7ff68034ab8548ce670eaAlexander Gutkin sed '1d 25035b6dc79427b8f7eeb6a7ff68034ab8548ce670eaAlexander Gutkin /^When reporting/,/^Report/{ 25045b6dc79427b8f7eeb6a7ff68034ab8548ce670eaAlexander Gutkin H 25055b6dc79427b8f7eeb6a7ff68034ab8548ce670eaAlexander Gutkin d 25065b6dc79427b8f7eeb6a7ff68034ab8548ce670eaAlexander Gutkin } 25075b6dc79427b8f7eeb6a7ff68034ab8548ce670eaAlexander Gutkin $x 25085b6dc79427b8f7eeb6a7ff68034ab8548ce670eaAlexander Gutkin /information about other modes/d 25095b6dc79427b8f7eeb6a7ff68034ab8548ce670eaAlexander Gutkin /more detailed .*MODE/d 25105b6dc79427b8f7eeb6a7ff68034ab8548ce670eaAlexander Gutkin s/^Usage:.*--mode=\([^ ]*\) .*/Description of \1 mode:/' 25115b6dc79427b8f7eeb6a7ff68034ab8548ce670eaAlexander Gutkin fi 25125b6dc79427b8f7eeb6a7ff68034ab8548ce670eaAlexander Gutkin exit $? 25135b6dc79427b8f7eeb6a7ff68034ab8548ce670eaAlexander Gutkinfi 2514f4c12fce1ee58e670f9c3fce46c40296ba9ee8a2Ian Hodson 2515f4c12fce1ee58e670f9c3fce46c40296ba9ee8a2Ian Hodson 2516f4c12fce1ee58e670f9c3fce46c40296ba9ee8a2Ian Hodson# func_mode_execute arg... 2517f4c12fce1ee58e670f9c3fce46c40296ba9ee8a2Ian Hodsonfunc_mode_execute () 2518f4c12fce1ee58e670f9c3fce46c40296ba9ee8a2Ian Hodson{ 2519f4c12fce1ee58e670f9c3fce46c40296ba9ee8a2Ian Hodson $opt_debug 2520f4c12fce1ee58e670f9c3fce46c40296ba9ee8a2Ian Hodson # The first argument is the command name. 2521f4c12fce1ee58e670f9c3fce46c40296ba9ee8a2Ian Hodson cmd="$nonopt" 2522f4c12fce1ee58e670f9c3fce46c40296ba9ee8a2Ian Hodson test -z "$cmd" && \ 2523f4c12fce1ee58e670f9c3fce46c40296ba9ee8a2Ian Hodson func_fatal_help "you must specify a COMMAND" 2524f4c12fce1ee58e670f9c3fce46c40296ba9ee8a2Ian Hodson 2525f4c12fce1ee58e670f9c3fce46c40296ba9ee8a2Ian Hodson # Handle -dlopen flags immediately. 25265b6dc79427b8f7eeb6a7ff68034ab8548ce670eaAlexander Gutkin for file in $opt_dlopen; do 2527f4c12fce1ee58e670f9c3fce46c40296ba9ee8a2Ian Hodson test -f "$file" \ 2528f4c12fce1ee58e670f9c3fce46c40296ba9ee8a2Ian Hodson || func_fatal_help "\`$file' is not a file" 2529f4c12fce1ee58e670f9c3fce46c40296ba9ee8a2Ian Hodson 2530f4c12fce1ee58e670f9c3fce46c40296ba9ee8a2Ian Hodson dir= 2531f4c12fce1ee58e670f9c3fce46c40296ba9ee8a2Ian Hodson case $file in 2532f4c12fce1ee58e670f9c3fce46c40296ba9ee8a2Ian Hodson *.la) 25335b6dc79427b8f7eeb6a7ff68034ab8548ce670eaAlexander Gutkin func_resolve_sysroot "$file" 25345b6dc79427b8f7eeb6a7ff68034ab8548ce670eaAlexander Gutkin file=$func_resolve_sysroot_result 25355b6dc79427b8f7eeb6a7ff68034ab8548ce670eaAlexander Gutkin 2536f4c12fce1ee58e670f9c3fce46c40296ba9ee8a2Ian Hodson # Check to see that this really is a libtool archive. 2537f4c12fce1ee58e670f9c3fce46c40296ba9ee8a2Ian Hodson func_lalib_unsafe_p "$file" \ 2538f4c12fce1ee58e670f9c3fce46c40296ba9ee8a2Ian Hodson || func_fatal_help "\`$lib' is not a valid libtool archive" 2539f4c12fce1ee58e670f9c3fce46c40296ba9ee8a2Ian Hodson 2540f4c12fce1ee58e670f9c3fce46c40296ba9ee8a2Ian Hodson # Read the libtool library. 2541f4c12fce1ee58e670f9c3fce46c40296ba9ee8a2Ian Hodson dlname= 2542f4c12fce1ee58e670f9c3fce46c40296ba9ee8a2Ian Hodson library_names= 2543f4c12fce1ee58e670f9c3fce46c40296ba9ee8a2Ian Hodson func_source "$file" 2544f4c12fce1ee58e670f9c3fce46c40296ba9ee8a2Ian Hodson 2545f4c12fce1ee58e670f9c3fce46c40296ba9ee8a2Ian Hodson # Skip this library if it cannot be dlopened. 2546f4c12fce1ee58e670f9c3fce46c40296ba9ee8a2Ian Hodson if test -z "$dlname"; then 2547f4c12fce1ee58e670f9c3fce46c40296ba9ee8a2Ian Hodson # Warn if it was a shared library. 2548f4c12fce1ee58e670f9c3fce46c40296ba9ee8a2Ian Hodson test -n "$library_names" && \ 2549f4c12fce1ee58e670f9c3fce46c40296ba9ee8a2Ian Hodson func_warning "\`$file' was not linked with \`-export-dynamic'" 2550f4c12fce1ee58e670f9c3fce46c40296ba9ee8a2Ian Hodson continue 2551f4c12fce1ee58e670f9c3fce46c40296ba9ee8a2Ian Hodson fi 2552f4c12fce1ee58e670f9c3fce46c40296ba9ee8a2Ian Hodson 2553f4c12fce1ee58e670f9c3fce46c40296ba9ee8a2Ian Hodson func_dirname "$file" "" "." 2554f4c12fce1ee58e670f9c3fce46c40296ba9ee8a2Ian Hodson dir="$func_dirname_result" 2555f4c12fce1ee58e670f9c3fce46c40296ba9ee8a2Ian Hodson 2556f4c12fce1ee58e670f9c3fce46c40296ba9ee8a2Ian Hodson if test -f "$dir/$objdir/$dlname"; then 25575b6dc79427b8f7eeb6a7ff68034ab8548ce670eaAlexander Gutkin func_append dir "/$objdir" 2558f4c12fce1ee58e670f9c3fce46c40296ba9ee8a2Ian Hodson else 2559f4c12fce1ee58e670f9c3fce46c40296ba9ee8a2Ian Hodson if test ! -f "$dir/$dlname"; then 2560f4c12fce1ee58e670f9c3fce46c40296ba9ee8a2Ian Hodson func_fatal_error "cannot find \`$dlname' in \`$dir' or \`$dir/$objdir'" 2561f4c12fce1ee58e670f9c3fce46c40296ba9ee8a2Ian Hodson fi 2562f4c12fce1ee58e670f9c3fce46c40296ba9ee8a2Ian Hodson fi 2563f4c12fce1ee58e670f9c3fce46c40296ba9ee8a2Ian Hodson ;; 2564f4c12fce1ee58e670f9c3fce46c40296ba9ee8a2Ian Hodson 2565f4c12fce1ee58e670f9c3fce46c40296ba9ee8a2Ian Hodson *.lo) 2566f4c12fce1ee58e670f9c3fce46c40296ba9ee8a2Ian Hodson # Just add the directory containing the .lo file. 2567f4c12fce1ee58e670f9c3fce46c40296ba9ee8a2Ian Hodson func_dirname "$file" "" "." 2568f4c12fce1ee58e670f9c3fce46c40296ba9ee8a2Ian Hodson dir="$func_dirname_result" 2569f4c12fce1ee58e670f9c3fce46c40296ba9ee8a2Ian Hodson ;; 2570f4c12fce1ee58e670f9c3fce46c40296ba9ee8a2Ian Hodson 2571f4c12fce1ee58e670f9c3fce46c40296ba9ee8a2Ian Hodson *) 2572f4c12fce1ee58e670f9c3fce46c40296ba9ee8a2Ian Hodson func_warning "\`-dlopen' is ignored for non-libtool libraries and objects" 2573f4c12fce1ee58e670f9c3fce46c40296ba9ee8a2Ian Hodson continue 2574f4c12fce1ee58e670f9c3fce46c40296ba9ee8a2Ian Hodson ;; 2575f4c12fce1ee58e670f9c3fce46c40296ba9ee8a2Ian Hodson esac 2576f4c12fce1ee58e670f9c3fce46c40296ba9ee8a2Ian Hodson 2577f4c12fce1ee58e670f9c3fce46c40296ba9ee8a2Ian Hodson # Get the absolute pathname. 2578f4c12fce1ee58e670f9c3fce46c40296ba9ee8a2Ian Hodson absdir=`cd "$dir" && pwd` 2579f4c12fce1ee58e670f9c3fce46c40296ba9ee8a2Ian Hodson test -n "$absdir" && dir="$absdir" 2580f4c12fce1ee58e670f9c3fce46c40296ba9ee8a2Ian Hodson 2581f4c12fce1ee58e670f9c3fce46c40296ba9ee8a2Ian Hodson # Now add the directory to shlibpath_var. 2582f4c12fce1ee58e670f9c3fce46c40296ba9ee8a2Ian Hodson if eval "test -z \"\$$shlibpath_var\""; then 2583f4c12fce1ee58e670f9c3fce46c40296ba9ee8a2Ian Hodson eval "$shlibpath_var=\"\$dir\"" 2584f4c12fce1ee58e670f9c3fce46c40296ba9ee8a2Ian Hodson else 2585f4c12fce1ee58e670f9c3fce46c40296ba9ee8a2Ian Hodson eval "$shlibpath_var=\"\$dir:\$$shlibpath_var\"" 2586f4c12fce1ee58e670f9c3fce46c40296ba9ee8a2Ian Hodson fi 2587f4c12fce1ee58e670f9c3fce46c40296ba9ee8a2Ian Hodson done 2588f4c12fce1ee58e670f9c3fce46c40296ba9ee8a2Ian Hodson 2589f4c12fce1ee58e670f9c3fce46c40296ba9ee8a2Ian Hodson # This variable tells wrapper scripts just to set shlibpath_var 2590f4c12fce1ee58e670f9c3fce46c40296ba9ee8a2Ian Hodson # rather than running their programs. 2591f4c12fce1ee58e670f9c3fce46c40296ba9ee8a2Ian Hodson libtool_execute_magic="$magic" 2592f4c12fce1ee58e670f9c3fce46c40296ba9ee8a2Ian Hodson 2593f4c12fce1ee58e670f9c3fce46c40296ba9ee8a2Ian Hodson # Check if any of the arguments is a wrapper script. 2594f4c12fce1ee58e670f9c3fce46c40296ba9ee8a2Ian Hodson args= 2595f4c12fce1ee58e670f9c3fce46c40296ba9ee8a2Ian Hodson for file 2596f4c12fce1ee58e670f9c3fce46c40296ba9ee8a2Ian Hodson do 2597f4c12fce1ee58e670f9c3fce46c40296ba9ee8a2Ian Hodson case $file in 25985b6dc79427b8f7eeb6a7ff68034ab8548ce670eaAlexander Gutkin -* | *.la | *.lo ) ;; 2599f4c12fce1ee58e670f9c3fce46c40296ba9ee8a2Ian Hodson *) 2600f4c12fce1ee58e670f9c3fce46c40296ba9ee8a2Ian Hodson # Do a test to see if this is really a libtool program. 2601f4c12fce1ee58e670f9c3fce46c40296ba9ee8a2Ian Hodson if func_ltwrapper_script_p "$file"; then 2602f4c12fce1ee58e670f9c3fce46c40296ba9ee8a2Ian Hodson func_source "$file" 2603f4c12fce1ee58e670f9c3fce46c40296ba9ee8a2Ian Hodson # Transform arg to wrapped name. 2604f4c12fce1ee58e670f9c3fce46c40296ba9ee8a2Ian Hodson file="$progdir/$program" 2605f4c12fce1ee58e670f9c3fce46c40296ba9ee8a2Ian Hodson elif func_ltwrapper_executable_p "$file"; then 2606f4c12fce1ee58e670f9c3fce46c40296ba9ee8a2Ian Hodson func_ltwrapper_scriptname "$file" 2607f4c12fce1ee58e670f9c3fce46c40296ba9ee8a2Ian Hodson func_source "$func_ltwrapper_scriptname_result" 2608f4c12fce1ee58e670f9c3fce46c40296ba9ee8a2Ian Hodson # Transform arg to wrapped name. 2609f4c12fce1ee58e670f9c3fce46c40296ba9ee8a2Ian Hodson file="$progdir/$program" 2610f4c12fce1ee58e670f9c3fce46c40296ba9ee8a2Ian Hodson fi 2611f4c12fce1ee58e670f9c3fce46c40296ba9ee8a2Ian Hodson ;; 2612f4c12fce1ee58e670f9c3fce46c40296ba9ee8a2Ian Hodson esac 2613f4c12fce1ee58e670f9c3fce46c40296ba9ee8a2Ian Hodson # Quote arguments (to preserve shell metacharacters). 26145b6dc79427b8f7eeb6a7ff68034ab8548ce670eaAlexander Gutkin func_append_quoted args "$file" 2615f4c12fce1ee58e670f9c3fce46c40296ba9ee8a2Ian Hodson done 2616f4c12fce1ee58e670f9c3fce46c40296ba9ee8a2Ian Hodson 2617f4c12fce1ee58e670f9c3fce46c40296ba9ee8a2Ian Hodson if test "X$opt_dry_run" = Xfalse; then 2618f4c12fce1ee58e670f9c3fce46c40296ba9ee8a2Ian Hodson if test -n "$shlibpath_var"; then 2619f4c12fce1ee58e670f9c3fce46c40296ba9ee8a2Ian Hodson # Export the shlibpath_var. 2620f4c12fce1ee58e670f9c3fce46c40296ba9ee8a2Ian Hodson eval "export $shlibpath_var" 2621f4c12fce1ee58e670f9c3fce46c40296ba9ee8a2Ian Hodson fi 2622f4c12fce1ee58e670f9c3fce46c40296ba9ee8a2Ian Hodson 2623f4c12fce1ee58e670f9c3fce46c40296ba9ee8a2Ian Hodson # Restore saved environment variables 2624f4c12fce1ee58e670f9c3fce46c40296ba9ee8a2Ian Hodson for lt_var in LANG LANGUAGE LC_ALL LC_CTYPE LC_COLLATE LC_MESSAGES 2625f4c12fce1ee58e670f9c3fce46c40296ba9ee8a2Ian Hodson do 2626f4c12fce1ee58e670f9c3fce46c40296ba9ee8a2Ian Hodson eval "if test \"\${save_$lt_var+set}\" = set; then 2627f4c12fce1ee58e670f9c3fce46c40296ba9ee8a2Ian Hodson $lt_var=\$save_$lt_var; export $lt_var 2628f4c12fce1ee58e670f9c3fce46c40296ba9ee8a2Ian Hodson else 2629f4c12fce1ee58e670f9c3fce46c40296ba9ee8a2Ian Hodson $lt_unset $lt_var 2630f4c12fce1ee58e670f9c3fce46c40296ba9ee8a2Ian Hodson fi" 2631f4c12fce1ee58e670f9c3fce46c40296ba9ee8a2Ian Hodson done 2632f4c12fce1ee58e670f9c3fce46c40296ba9ee8a2Ian Hodson 2633f4c12fce1ee58e670f9c3fce46c40296ba9ee8a2Ian Hodson # Now prepare to actually exec the command. 2634f4c12fce1ee58e670f9c3fce46c40296ba9ee8a2Ian Hodson exec_cmd="\$cmd$args" 2635f4c12fce1ee58e670f9c3fce46c40296ba9ee8a2Ian Hodson else 2636f4c12fce1ee58e670f9c3fce46c40296ba9ee8a2Ian Hodson # Display what would be done. 2637f4c12fce1ee58e670f9c3fce46c40296ba9ee8a2Ian Hodson if test -n "$shlibpath_var"; then 2638f4c12fce1ee58e670f9c3fce46c40296ba9ee8a2Ian Hodson eval "\$ECHO \"\$shlibpath_var=\$$shlibpath_var\"" 26395b6dc79427b8f7eeb6a7ff68034ab8548ce670eaAlexander Gutkin echo "export $shlibpath_var" 2640f4c12fce1ee58e670f9c3fce46c40296ba9ee8a2Ian Hodson fi 2641f4c12fce1ee58e670f9c3fce46c40296ba9ee8a2Ian Hodson $ECHO "$cmd$args" 2642f4c12fce1ee58e670f9c3fce46c40296ba9ee8a2Ian Hodson exit $EXIT_SUCCESS 2643f4c12fce1ee58e670f9c3fce46c40296ba9ee8a2Ian Hodson fi 2644f4c12fce1ee58e670f9c3fce46c40296ba9ee8a2Ian Hodson} 2645f4c12fce1ee58e670f9c3fce46c40296ba9ee8a2Ian Hodson 26465b6dc79427b8f7eeb6a7ff68034ab8548ce670eaAlexander Gutkintest "$opt_mode" = execute && func_mode_execute ${1+"$@"} 2647f4c12fce1ee58e670f9c3fce46c40296ba9ee8a2Ian Hodson 2648f4c12fce1ee58e670f9c3fce46c40296ba9ee8a2Ian Hodson 2649f4c12fce1ee58e670f9c3fce46c40296ba9ee8a2Ian Hodson# func_mode_finish arg... 2650f4c12fce1ee58e670f9c3fce46c40296ba9ee8a2Ian Hodsonfunc_mode_finish () 2651f4c12fce1ee58e670f9c3fce46c40296ba9ee8a2Ian Hodson{ 2652f4c12fce1ee58e670f9c3fce46c40296ba9ee8a2Ian Hodson $opt_debug 26535b6dc79427b8f7eeb6a7ff68034ab8548ce670eaAlexander Gutkin libs= 26545b6dc79427b8f7eeb6a7ff68034ab8548ce670eaAlexander Gutkin libdirs= 2655f4c12fce1ee58e670f9c3fce46c40296ba9ee8a2Ian Hodson admincmds= 2656f4c12fce1ee58e670f9c3fce46c40296ba9ee8a2Ian Hodson 26575b6dc79427b8f7eeb6a7ff68034ab8548ce670eaAlexander Gutkin for opt in "$nonopt" ${1+"$@"} 26585b6dc79427b8f7eeb6a7ff68034ab8548ce670eaAlexander Gutkin do 26595b6dc79427b8f7eeb6a7ff68034ab8548ce670eaAlexander Gutkin if test -d "$opt"; then 26605b6dc79427b8f7eeb6a7ff68034ab8548ce670eaAlexander Gutkin func_append libdirs " $opt" 26615b6dc79427b8f7eeb6a7ff68034ab8548ce670eaAlexander Gutkin 26625b6dc79427b8f7eeb6a7ff68034ab8548ce670eaAlexander Gutkin elif test -f "$opt"; then 26635b6dc79427b8f7eeb6a7ff68034ab8548ce670eaAlexander Gutkin if func_lalib_unsafe_p "$opt"; then 26645b6dc79427b8f7eeb6a7ff68034ab8548ce670eaAlexander Gutkin func_append libs " $opt" 26655b6dc79427b8f7eeb6a7ff68034ab8548ce670eaAlexander Gutkin else 26665b6dc79427b8f7eeb6a7ff68034ab8548ce670eaAlexander Gutkin func_warning "\`$opt' is not a valid libtool archive" 26675b6dc79427b8f7eeb6a7ff68034ab8548ce670eaAlexander Gutkin fi 26685b6dc79427b8f7eeb6a7ff68034ab8548ce670eaAlexander Gutkin 26695b6dc79427b8f7eeb6a7ff68034ab8548ce670eaAlexander Gutkin else 26705b6dc79427b8f7eeb6a7ff68034ab8548ce670eaAlexander Gutkin func_fatal_error "invalid argument \`$opt'" 26715b6dc79427b8f7eeb6a7ff68034ab8548ce670eaAlexander Gutkin fi 26725b6dc79427b8f7eeb6a7ff68034ab8548ce670eaAlexander Gutkin done 26735b6dc79427b8f7eeb6a7ff68034ab8548ce670eaAlexander Gutkin 26745b6dc79427b8f7eeb6a7ff68034ab8548ce670eaAlexander Gutkin if test -n "$libs"; then 26755b6dc79427b8f7eeb6a7ff68034ab8548ce670eaAlexander Gutkin if test -n "$lt_sysroot"; then 26765b6dc79427b8f7eeb6a7ff68034ab8548ce670eaAlexander Gutkin sysroot_regex=`$ECHO "$lt_sysroot" | $SED "$sed_make_literal_regex"` 26775b6dc79427b8f7eeb6a7ff68034ab8548ce670eaAlexander Gutkin sysroot_cmd="s/\([ ']\)$sysroot_regex/\1/g;" 26785b6dc79427b8f7eeb6a7ff68034ab8548ce670eaAlexander Gutkin else 26795b6dc79427b8f7eeb6a7ff68034ab8548ce670eaAlexander Gutkin sysroot_cmd= 26805b6dc79427b8f7eeb6a7ff68034ab8548ce670eaAlexander Gutkin fi 26815b6dc79427b8f7eeb6a7ff68034ab8548ce670eaAlexander Gutkin 26825b6dc79427b8f7eeb6a7ff68034ab8548ce670eaAlexander Gutkin # Remove sysroot references 26835b6dc79427b8f7eeb6a7ff68034ab8548ce670eaAlexander Gutkin if $opt_dry_run; then 26845b6dc79427b8f7eeb6a7ff68034ab8548ce670eaAlexander Gutkin for lib in $libs; do 26855b6dc79427b8f7eeb6a7ff68034ab8548ce670eaAlexander Gutkin echo "removing references to $lt_sysroot and \`=' prefixes from $lib" 26865b6dc79427b8f7eeb6a7ff68034ab8548ce670eaAlexander Gutkin done 26875b6dc79427b8f7eeb6a7ff68034ab8548ce670eaAlexander Gutkin else 26885b6dc79427b8f7eeb6a7ff68034ab8548ce670eaAlexander Gutkin tmpdir=`func_mktempdir` 26895b6dc79427b8f7eeb6a7ff68034ab8548ce670eaAlexander Gutkin for lib in $libs; do 26905b6dc79427b8f7eeb6a7ff68034ab8548ce670eaAlexander Gutkin sed -e "${sysroot_cmd} s/\([ ']-[LR]\)=/\1/g; s/\([ ']\)=/\1/g" $lib \ 26915b6dc79427b8f7eeb6a7ff68034ab8548ce670eaAlexander Gutkin > $tmpdir/tmp-la 26925b6dc79427b8f7eeb6a7ff68034ab8548ce670eaAlexander Gutkin mv -f $tmpdir/tmp-la $lib 26935b6dc79427b8f7eeb6a7ff68034ab8548ce670eaAlexander Gutkin done 26945b6dc79427b8f7eeb6a7ff68034ab8548ce670eaAlexander Gutkin ${RM}r "$tmpdir" 26955b6dc79427b8f7eeb6a7ff68034ab8548ce670eaAlexander Gutkin fi 26965b6dc79427b8f7eeb6a7ff68034ab8548ce670eaAlexander Gutkin fi 2697f4c12fce1ee58e670f9c3fce46c40296ba9ee8a2Ian Hodson 26985b6dc79427b8f7eeb6a7ff68034ab8548ce670eaAlexander Gutkin if test -n "$finish_cmds$finish_eval" && test -n "$libdirs"; then 2699f4c12fce1ee58e670f9c3fce46c40296ba9ee8a2Ian Hodson for libdir in $libdirs; do 2700f4c12fce1ee58e670f9c3fce46c40296ba9ee8a2Ian Hodson if test -n "$finish_cmds"; then 2701f4c12fce1ee58e670f9c3fce46c40296ba9ee8a2Ian Hodson # Do each command in the finish commands. 2702f4c12fce1ee58e670f9c3fce46c40296ba9ee8a2Ian Hodson func_execute_cmds "$finish_cmds" 'admincmds="$admincmds 2703f4c12fce1ee58e670f9c3fce46c40296ba9ee8a2Ian Hodson'"$cmd"'"' 2704f4c12fce1ee58e670f9c3fce46c40296ba9ee8a2Ian Hodson fi 2705f4c12fce1ee58e670f9c3fce46c40296ba9ee8a2Ian Hodson if test -n "$finish_eval"; then 2706f4c12fce1ee58e670f9c3fce46c40296ba9ee8a2Ian Hodson # Do the single finish_eval. 2707f4c12fce1ee58e670f9c3fce46c40296ba9ee8a2Ian Hodson eval cmds=\"$finish_eval\" 27085b6dc79427b8f7eeb6a7ff68034ab8548ce670eaAlexander Gutkin $opt_dry_run || eval "$cmds" || func_append admincmds " 2709f4c12fce1ee58e670f9c3fce46c40296ba9ee8a2Ian Hodson $cmds" 2710f4c12fce1ee58e670f9c3fce46c40296ba9ee8a2Ian Hodson fi 2711f4c12fce1ee58e670f9c3fce46c40296ba9ee8a2Ian Hodson done 2712f4c12fce1ee58e670f9c3fce46c40296ba9ee8a2Ian Hodson fi 2713f4c12fce1ee58e670f9c3fce46c40296ba9ee8a2Ian Hodson 2714f4c12fce1ee58e670f9c3fce46c40296ba9ee8a2Ian Hodson # Exit here if they wanted silent mode. 2715f4c12fce1ee58e670f9c3fce46c40296ba9ee8a2Ian Hodson $opt_silent && exit $EXIT_SUCCESS 2716f4c12fce1ee58e670f9c3fce46c40296ba9ee8a2Ian Hodson 27175b6dc79427b8f7eeb6a7ff68034ab8548ce670eaAlexander Gutkin if test -n "$finish_cmds$finish_eval" && test -n "$libdirs"; then 27185b6dc79427b8f7eeb6a7ff68034ab8548ce670eaAlexander Gutkin echo "----------------------------------------------------------------------" 27195b6dc79427b8f7eeb6a7ff68034ab8548ce670eaAlexander Gutkin echo "Libraries have been installed in:" 27205b6dc79427b8f7eeb6a7ff68034ab8548ce670eaAlexander Gutkin for libdir in $libdirs; do 27215b6dc79427b8f7eeb6a7ff68034ab8548ce670eaAlexander Gutkin $ECHO " $libdir" 27225b6dc79427b8f7eeb6a7ff68034ab8548ce670eaAlexander Gutkin done 27235b6dc79427b8f7eeb6a7ff68034ab8548ce670eaAlexander Gutkin echo 27245b6dc79427b8f7eeb6a7ff68034ab8548ce670eaAlexander Gutkin echo "If you ever happen to want to link against installed libraries" 27255b6dc79427b8f7eeb6a7ff68034ab8548ce670eaAlexander Gutkin echo "in a given directory, LIBDIR, you must either use libtool, and" 27265b6dc79427b8f7eeb6a7ff68034ab8548ce670eaAlexander Gutkin echo "specify the full pathname of the library, or use the \`-LLIBDIR'" 27275b6dc79427b8f7eeb6a7ff68034ab8548ce670eaAlexander Gutkin echo "flag during linking and do at least one of the following:" 27285b6dc79427b8f7eeb6a7ff68034ab8548ce670eaAlexander Gutkin if test -n "$shlibpath_var"; then 27295b6dc79427b8f7eeb6a7ff68034ab8548ce670eaAlexander Gutkin echo " - add LIBDIR to the \`$shlibpath_var' environment variable" 27305b6dc79427b8f7eeb6a7ff68034ab8548ce670eaAlexander Gutkin echo " during execution" 27315b6dc79427b8f7eeb6a7ff68034ab8548ce670eaAlexander Gutkin fi 27325b6dc79427b8f7eeb6a7ff68034ab8548ce670eaAlexander Gutkin if test -n "$runpath_var"; then 27335b6dc79427b8f7eeb6a7ff68034ab8548ce670eaAlexander Gutkin echo " - add LIBDIR to the \`$runpath_var' environment variable" 27345b6dc79427b8f7eeb6a7ff68034ab8548ce670eaAlexander Gutkin echo " during linking" 27355b6dc79427b8f7eeb6a7ff68034ab8548ce670eaAlexander Gutkin fi 27365b6dc79427b8f7eeb6a7ff68034ab8548ce670eaAlexander Gutkin if test -n "$hardcode_libdir_flag_spec"; then 27375b6dc79427b8f7eeb6a7ff68034ab8548ce670eaAlexander Gutkin libdir=LIBDIR 27385b6dc79427b8f7eeb6a7ff68034ab8548ce670eaAlexander Gutkin eval flag=\"$hardcode_libdir_flag_spec\" 2739f4c12fce1ee58e670f9c3fce46c40296ba9ee8a2Ian Hodson 27405b6dc79427b8f7eeb6a7ff68034ab8548ce670eaAlexander Gutkin $ECHO " - use the \`$flag' linker flag" 27415b6dc79427b8f7eeb6a7ff68034ab8548ce670eaAlexander Gutkin fi 27425b6dc79427b8f7eeb6a7ff68034ab8548ce670eaAlexander Gutkin if test -n "$admincmds"; then 27435b6dc79427b8f7eeb6a7ff68034ab8548ce670eaAlexander Gutkin $ECHO " - have your system administrator run these commands:$admincmds" 27445b6dc79427b8f7eeb6a7ff68034ab8548ce670eaAlexander Gutkin fi 27455b6dc79427b8f7eeb6a7ff68034ab8548ce670eaAlexander Gutkin if test -f /etc/ld.so.conf; then 27465b6dc79427b8f7eeb6a7ff68034ab8548ce670eaAlexander Gutkin echo " - have your system administrator add LIBDIR to \`/etc/ld.so.conf'" 27475b6dc79427b8f7eeb6a7ff68034ab8548ce670eaAlexander Gutkin fi 27485b6dc79427b8f7eeb6a7ff68034ab8548ce670eaAlexander Gutkin echo 2749f4c12fce1ee58e670f9c3fce46c40296ba9ee8a2Ian Hodson 27505b6dc79427b8f7eeb6a7ff68034ab8548ce670eaAlexander Gutkin echo "See any operating system documentation about shared libraries for" 27515b6dc79427b8f7eeb6a7ff68034ab8548ce670eaAlexander Gutkin case $host in 27525b6dc79427b8f7eeb6a7ff68034ab8548ce670eaAlexander Gutkin solaris2.[6789]|solaris2.1[0-9]) 27535b6dc79427b8f7eeb6a7ff68034ab8548ce670eaAlexander Gutkin echo "more information, such as the ld(1), crle(1) and ld.so(8) manual" 27545b6dc79427b8f7eeb6a7ff68034ab8548ce670eaAlexander Gutkin echo "pages." 27555b6dc79427b8f7eeb6a7ff68034ab8548ce670eaAlexander Gutkin ;; 27565b6dc79427b8f7eeb6a7ff68034ab8548ce670eaAlexander Gutkin *) 27575b6dc79427b8f7eeb6a7ff68034ab8548ce670eaAlexander Gutkin echo "more information, such as the ld(1) and ld.so(8) manual pages." 27585b6dc79427b8f7eeb6a7ff68034ab8548ce670eaAlexander Gutkin ;; 27595b6dc79427b8f7eeb6a7ff68034ab8548ce670eaAlexander Gutkin esac 27605b6dc79427b8f7eeb6a7ff68034ab8548ce670eaAlexander Gutkin echo "----------------------------------------------------------------------" 27615b6dc79427b8f7eeb6a7ff68034ab8548ce670eaAlexander Gutkin fi 2762f4c12fce1ee58e670f9c3fce46c40296ba9ee8a2Ian Hodson exit $EXIT_SUCCESS 2763f4c12fce1ee58e670f9c3fce46c40296ba9ee8a2Ian Hodson} 2764f4c12fce1ee58e670f9c3fce46c40296ba9ee8a2Ian Hodson 27655b6dc79427b8f7eeb6a7ff68034ab8548ce670eaAlexander Gutkintest "$opt_mode" = finish && func_mode_finish ${1+"$@"} 2766f4c12fce1ee58e670f9c3fce46c40296ba9ee8a2Ian Hodson 2767f4c12fce1ee58e670f9c3fce46c40296ba9ee8a2Ian Hodson 2768f4c12fce1ee58e670f9c3fce46c40296ba9ee8a2Ian Hodson# func_mode_install arg... 2769f4c12fce1ee58e670f9c3fce46c40296ba9ee8a2Ian Hodsonfunc_mode_install () 2770f4c12fce1ee58e670f9c3fce46c40296ba9ee8a2Ian Hodson{ 2771f4c12fce1ee58e670f9c3fce46c40296ba9ee8a2Ian Hodson $opt_debug 2772f4c12fce1ee58e670f9c3fce46c40296ba9ee8a2Ian Hodson # There may be an optional sh(1) argument at the beginning of 2773f4c12fce1ee58e670f9c3fce46c40296ba9ee8a2Ian Hodson # install_prog (especially on Windows NT). 2774f4c12fce1ee58e670f9c3fce46c40296ba9ee8a2Ian Hodson if test "$nonopt" = "$SHELL" || test "$nonopt" = /bin/sh || 2775f4c12fce1ee58e670f9c3fce46c40296ba9ee8a2Ian Hodson # Allow the use of GNU shtool's install command. 27765b6dc79427b8f7eeb6a7ff68034ab8548ce670eaAlexander Gutkin case $nonopt in *shtool*) :;; *) false;; esac; then 2777f4c12fce1ee58e670f9c3fce46c40296ba9ee8a2Ian Hodson # Aesthetically quote it. 2778f4c12fce1ee58e670f9c3fce46c40296ba9ee8a2Ian Hodson func_quote_for_eval "$nonopt" 2779f4c12fce1ee58e670f9c3fce46c40296ba9ee8a2Ian Hodson install_prog="$func_quote_for_eval_result " 2780f4c12fce1ee58e670f9c3fce46c40296ba9ee8a2Ian Hodson arg=$1 2781f4c12fce1ee58e670f9c3fce46c40296ba9ee8a2Ian Hodson shift 2782f4c12fce1ee58e670f9c3fce46c40296ba9ee8a2Ian Hodson else 2783f4c12fce1ee58e670f9c3fce46c40296ba9ee8a2Ian Hodson install_prog= 2784f4c12fce1ee58e670f9c3fce46c40296ba9ee8a2Ian Hodson arg=$nonopt 2785f4c12fce1ee58e670f9c3fce46c40296ba9ee8a2Ian Hodson fi 2786f4c12fce1ee58e670f9c3fce46c40296ba9ee8a2Ian Hodson 2787f4c12fce1ee58e670f9c3fce46c40296ba9ee8a2Ian Hodson # The real first argument should be the name of the installation program. 2788f4c12fce1ee58e670f9c3fce46c40296ba9ee8a2Ian Hodson # Aesthetically quote it. 2789f4c12fce1ee58e670f9c3fce46c40296ba9ee8a2Ian Hodson func_quote_for_eval "$arg" 27905b6dc79427b8f7eeb6a7ff68034ab8548ce670eaAlexander Gutkin func_append install_prog "$func_quote_for_eval_result" 27915b6dc79427b8f7eeb6a7ff68034ab8548ce670eaAlexander Gutkin install_shared_prog=$install_prog 27925b6dc79427b8f7eeb6a7ff68034ab8548ce670eaAlexander Gutkin case " $install_prog " in 27935b6dc79427b8f7eeb6a7ff68034ab8548ce670eaAlexander Gutkin *[\\\ /]cp\ *) install_cp=: ;; 27945b6dc79427b8f7eeb6a7ff68034ab8548ce670eaAlexander Gutkin *) install_cp=false ;; 27955b6dc79427b8f7eeb6a7ff68034ab8548ce670eaAlexander Gutkin esac 2796f4c12fce1ee58e670f9c3fce46c40296ba9ee8a2Ian Hodson 2797f4c12fce1ee58e670f9c3fce46c40296ba9ee8a2Ian Hodson # We need to accept at least all the BSD install flags. 2798f4c12fce1ee58e670f9c3fce46c40296ba9ee8a2Ian Hodson dest= 2799f4c12fce1ee58e670f9c3fce46c40296ba9ee8a2Ian Hodson files= 2800f4c12fce1ee58e670f9c3fce46c40296ba9ee8a2Ian Hodson opts= 2801f4c12fce1ee58e670f9c3fce46c40296ba9ee8a2Ian Hodson prev= 2802f4c12fce1ee58e670f9c3fce46c40296ba9ee8a2Ian Hodson install_type= 2803f4c12fce1ee58e670f9c3fce46c40296ba9ee8a2Ian Hodson isdir=no 2804f4c12fce1ee58e670f9c3fce46c40296ba9ee8a2Ian Hodson stripme= 28055b6dc79427b8f7eeb6a7ff68034ab8548ce670eaAlexander Gutkin no_mode=: 2806f4c12fce1ee58e670f9c3fce46c40296ba9ee8a2Ian Hodson for arg 2807f4c12fce1ee58e670f9c3fce46c40296ba9ee8a2Ian Hodson do 28085b6dc79427b8f7eeb6a7ff68034ab8548ce670eaAlexander Gutkin arg2= 2809f4c12fce1ee58e670f9c3fce46c40296ba9ee8a2Ian Hodson if test -n "$dest"; then 28105b6dc79427b8f7eeb6a7ff68034ab8548ce670eaAlexander Gutkin func_append files " $dest" 2811f4c12fce1ee58e670f9c3fce46c40296ba9ee8a2Ian Hodson dest=$arg 2812f4c12fce1ee58e670f9c3fce46c40296ba9ee8a2Ian Hodson continue 2813f4c12fce1ee58e670f9c3fce46c40296ba9ee8a2Ian Hodson fi 2814f4c12fce1ee58e670f9c3fce46c40296ba9ee8a2Ian Hodson 2815f4c12fce1ee58e670f9c3fce46c40296ba9ee8a2Ian Hodson case $arg in 2816f4c12fce1ee58e670f9c3fce46c40296ba9ee8a2Ian Hodson -d) isdir=yes ;; 2817f4c12fce1ee58e670f9c3fce46c40296ba9ee8a2Ian Hodson -f) 28185b6dc79427b8f7eeb6a7ff68034ab8548ce670eaAlexander Gutkin if $install_cp; then :; else 28195b6dc79427b8f7eeb6a7ff68034ab8548ce670eaAlexander Gutkin prev=$arg 28205b6dc79427b8f7eeb6a7ff68034ab8548ce670eaAlexander Gutkin fi 2821f4c12fce1ee58e670f9c3fce46c40296ba9ee8a2Ian Hodson ;; 2822f4c12fce1ee58e670f9c3fce46c40296ba9ee8a2Ian Hodson -g | -m | -o) 2823f4c12fce1ee58e670f9c3fce46c40296ba9ee8a2Ian Hodson prev=$arg 2824f4c12fce1ee58e670f9c3fce46c40296ba9ee8a2Ian Hodson ;; 2825f4c12fce1ee58e670f9c3fce46c40296ba9ee8a2Ian Hodson -s) 2826f4c12fce1ee58e670f9c3fce46c40296ba9ee8a2Ian Hodson stripme=" -s" 2827f4c12fce1ee58e670f9c3fce46c40296ba9ee8a2Ian Hodson continue 2828f4c12fce1ee58e670f9c3fce46c40296ba9ee8a2Ian Hodson ;; 2829f4c12fce1ee58e670f9c3fce46c40296ba9ee8a2Ian Hodson -*) 2830f4c12fce1ee58e670f9c3fce46c40296ba9ee8a2Ian Hodson ;; 2831f4c12fce1ee58e670f9c3fce46c40296ba9ee8a2Ian Hodson *) 2832f4c12fce1ee58e670f9c3fce46c40296ba9ee8a2Ian Hodson # If the previous option needed an argument, then skip it. 2833f4c12fce1ee58e670f9c3fce46c40296ba9ee8a2Ian Hodson if test -n "$prev"; then 28345b6dc79427b8f7eeb6a7ff68034ab8548ce670eaAlexander Gutkin if test "x$prev" = x-m && test -n "$install_override_mode"; then 28355b6dc79427b8f7eeb6a7ff68034ab8548ce670eaAlexander Gutkin arg2=$install_override_mode 28365b6dc79427b8f7eeb6a7ff68034ab8548ce670eaAlexander Gutkin no_mode=false 28375b6dc79427b8f7eeb6a7ff68034ab8548ce670eaAlexander Gutkin fi 2838f4c12fce1ee58e670f9c3fce46c40296ba9ee8a2Ian Hodson prev= 2839f4c12fce1ee58e670f9c3fce46c40296ba9ee8a2Ian Hodson else 2840f4c12fce1ee58e670f9c3fce46c40296ba9ee8a2Ian Hodson dest=$arg 2841f4c12fce1ee58e670f9c3fce46c40296ba9ee8a2Ian Hodson continue 2842f4c12fce1ee58e670f9c3fce46c40296ba9ee8a2Ian Hodson fi 2843f4c12fce1ee58e670f9c3fce46c40296ba9ee8a2Ian Hodson ;; 2844f4c12fce1ee58e670f9c3fce46c40296ba9ee8a2Ian Hodson esac 2845f4c12fce1ee58e670f9c3fce46c40296ba9ee8a2Ian Hodson 2846f4c12fce1ee58e670f9c3fce46c40296ba9ee8a2Ian Hodson # Aesthetically quote the argument. 2847f4c12fce1ee58e670f9c3fce46c40296ba9ee8a2Ian Hodson func_quote_for_eval "$arg" 28485b6dc79427b8f7eeb6a7ff68034ab8548ce670eaAlexander Gutkin func_append install_prog " $func_quote_for_eval_result" 28495b6dc79427b8f7eeb6a7ff68034ab8548ce670eaAlexander Gutkin if test -n "$arg2"; then 28505b6dc79427b8f7eeb6a7ff68034ab8548ce670eaAlexander Gutkin func_quote_for_eval "$arg2" 28515b6dc79427b8f7eeb6a7ff68034ab8548ce670eaAlexander Gutkin fi 28525b6dc79427b8f7eeb6a7ff68034ab8548ce670eaAlexander Gutkin func_append install_shared_prog " $func_quote_for_eval_result" 2853f4c12fce1ee58e670f9c3fce46c40296ba9ee8a2Ian Hodson done 2854f4c12fce1ee58e670f9c3fce46c40296ba9ee8a2Ian Hodson 2855f4c12fce1ee58e670f9c3fce46c40296ba9ee8a2Ian Hodson test -z "$install_prog" && \ 2856f4c12fce1ee58e670f9c3fce46c40296ba9ee8a2Ian Hodson func_fatal_help "you must specify an install program" 2857f4c12fce1ee58e670f9c3fce46c40296ba9ee8a2Ian Hodson 2858f4c12fce1ee58e670f9c3fce46c40296ba9ee8a2Ian Hodson test -n "$prev" && \ 2859f4c12fce1ee58e670f9c3fce46c40296ba9ee8a2Ian Hodson func_fatal_help "the \`$prev' option requires an argument" 2860f4c12fce1ee58e670f9c3fce46c40296ba9ee8a2Ian Hodson 28615b6dc79427b8f7eeb6a7ff68034ab8548ce670eaAlexander Gutkin if test -n "$install_override_mode" && $no_mode; then 28625b6dc79427b8f7eeb6a7ff68034ab8548ce670eaAlexander Gutkin if $install_cp; then :; else 28635b6dc79427b8f7eeb6a7ff68034ab8548ce670eaAlexander Gutkin func_quote_for_eval "$install_override_mode" 28645b6dc79427b8f7eeb6a7ff68034ab8548ce670eaAlexander Gutkin func_append install_shared_prog " -m $func_quote_for_eval_result" 28655b6dc79427b8f7eeb6a7ff68034ab8548ce670eaAlexander Gutkin fi 28665b6dc79427b8f7eeb6a7ff68034ab8548ce670eaAlexander Gutkin fi 28675b6dc79427b8f7eeb6a7ff68034ab8548ce670eaAlexander Gutkin 2868f4c12fce1ee58e670f9c3fce46c40296ba9ee8a2Ian Hodson if test -z "$files"; then 2869f4c12fce1ee58e670f9c3fce46c40296ba9ee8a2Ian Hodson if test -z "$dest"; then 2870f4c12fce1ee58e670f9c3fce46c40296ba9ee8a2Ian Hodson func_fatal_help "no file or destination specified" 2871f4c12fce1ee58e670f9c3fce46c40296ba9ee8a2Ian Hodson else 2872f4c12fce1ee58e670f9c3fce46c40296ba9ee8a2Ian Hodson func_fatal_help "you must specify a destination" 2873f4c12fce1ee58e670f9c3fce46c40296ba9ee8a2Ian Hodson fi 2874f4c12fce1ee58e670f9c3fce46c40296ba9ee8a2Ian Hodson fi 2875f4c12fce1ee58e670f9c3fce46c40296ba9ee8a2Ian Hodson 2876f4c12fce1ee58e670f9c3fce46c40296ba9ee8a2Ian Hodson # Strip any trailing slash from the destination. 2877f4c12fce1ee58e670f9c3fce46c40296ba9ee8a2Ian Hodson func_stripname '' '/' "$dest" 2878f4c12fce1ee58e670f9c3fce46c40296ba9ee8a2Ian Hodson dest=$func_stripname_result 2879f4c12fce1ee58e670f9c3fce46c40296ba9ee8a2Ian Hodson 2880f4c12fce1ee58e670f9c3fce46c40296ba9ee8a2Ian Hodson # Check to see that the destination is a directory. 2881f4c12fce1ee58e670f9c3fce46c40296ba9ee8a2Ian Hodson test -d "$dest" && isdir=yes 2882f4c12fce1ee58e670f9c3fce46c40296ba9ee8a2Ian Hodson if test "$isdir" = yes; then 2883f4c12fce1ee58e670f9c3fce46c40296ba9ee8a2Ian Hodson destdir="$dest" 2884f4c12fce1ee58e670f9c3fce46c40296ba9ee8a2Ian Hodson destname= 2885f4c12fce1ee58e670f9c3fce46c40296ba9ee8a2Ian Hodson else 2886f4c12fce1ee58e670f9c3fce46c40296ba9ee8a2Ian Hodson func_dirname_and_basename "$dest" "" "." 2887f4c12fce1ee58e670f9c3fce46c40296ba9ee8a2Ian Hodson destdir="$func_dirname_result" 2888f4c12fce1ee58e670f9c3fce46c40296ba9ee8a2Ian Hodson destname="$func_basename_result" 2889f4c12fce1ee58e670f9c3fce46c40296ba9ee8a2Ian Hodson 2890f4c12fce1ee58e670f9c3fce46c40296ba9ee8a2Ian Hodson # Not a directory, so check to see that there is only one file specified. 2891f4c12fce1ee58e670f9c3fce46c40296ba9ee8a2Ian Hodson set dummy $files; shift 2892f4c12fce1ee58e670f9c3fce46c40296ba9ee8a2Ian Hodson test "$#" -gt 1 && \ 2893f4c12fce1ee58e670f9c3fce46c40296ba9ee8a2Ian Hodson func_fatal_help "\`$dest' is not a directory" 2894f4c12fce1ee58e670f9c3fce46c40296ba9ee8a2Ian Hodson fi 2895f4c12fce1ee58e670f9c3fce46c40296ba9ee8a2Ian Hodson case $destdir in 2896f4c12fce1ee58e670f9c3fce46c40296ba9ee8a2Ian Hodson [\\/]* | [A-Za-z]:[\\/]*) ;; 2897f4c12fce1ee58e670f9c3fce46c40296ba9ee8a2Ian Hodson *) 2898f4c12fce1ee58e670f9c3fce46c40296ba9ee8a2Ian Hodson for file in $files; do 2899f4c12fce1ee58e670f9c3fce46c40296ba9ee8a2Ian Hodson case $file in 2900f4c12fce1ee58e670f9c3fce46c40296ba9ee8a2Ian Hodson *.lo) ;; 2901f4c12fce1ee58e670f9c3fce46c40296ba9ee8a2Ian Hodson *) 2902f4c12fce1ee58e670f9c3fce46c40296ba9ee8a2Ian Hodson func_fatal_help "\`$destdir' must be an absolute directory name" 2903f4c12fce1ee58e670f9c3fce46c40296ba9ee8a2Ian Hodson ;; 2904f4c12fce1ee58e670f9c3fce46c40296ba9ee8a2Ian Hodson esac 2905f4c12fce1ee58e670f9c3fce46c40296ba9ee8a2Ian Hodson done 2906f4c12fce1ee58e670f9c3fce46c40296ba9ee8a2Ian Hodson ;; 2907f4c12fce1ee58e670f9c3fce46c40296ba9ee8a2Ian Hodson esac 2908f4c12fce1ee58e670f9c3fce46c40296ba9ee8a2Ian Hodson 2909f4c12fce1ee58e670f9c3fce46c40296ba9ee8a2Ian Hodson # This variable tells wrapper scripts just to set variables rather 2910f4c12fce1ee58e670f9c3fce46c40296ba9ee8a2Ian Hodson # than running their programs. 2911f4c12fce1ee58e670f9c3fce46c40296ba9ee8a2Ian Hodson libtool_install_magic="$magic" 2912f4c12fce1ee58e670f9c3fce46c40296ba9ee8a2Ian Hodson 2913f4c12fce1ee58e670f9c3fce46c40296ba9ee8a2Ian Hodson staticlibs= 2914f4c12fce1ee58e670f9c3fce46c40296ba9ee8a2Ian Hodson future_libdirs= 2915f4c12fce1ee58e670f9c3fce46c40296ba9ee8a2Ian Hodson current_libdirs= 2916f4c12fce1ee58e670f9c3fce46c40296ba9ee8a2Ian Hodson for file in $files; do 2917f4c12fce1ee58e670f9c3fce46c40296ba9ee8a2Ian Hodson 2918f4c12fce1ee58e670f9c3fce46c40296ba9ee8a2Ian Hodson # Do each installation. 2919f4c12fce1ee58e670f9c3fce46c40296ba9ee8a2Ian Hodson case $file in 2920f4c12fce1ee58e670f9c3fce46c40296ba9ee8a2Ian Hodson *.$libext) 2921f4c12fce1ee58e670f9c3fce46c40296ba9ee8a2Ian Hodson # Do the static libraries later. 29225b6dc79427b8f7eeb6a7ff68034ab8548ce670eaAlexander Gutkin func_append staticlibs " $file" 2923f4c12fce1ee58e670f9c3fce46c40296ba9ee8a2Ian Hodson ;; 2924f4c12fce1ee58e670f9c3fce46c40296ba9ee8a2Ian Hodson 2925f4c12fce1ee58e670f9c3fce46c40296ba9ee8a2Ian Hodson *.la) 29265b6dc79427b8f7eeb6a7ff68034ab8548ce670eaAlexander Gutkin func_resolve_sysroot "$file" 29275b6dc79427b8f7eeb6a7ff68034ab8548ce670eaAlexander Gutkin file=$func_resolve_sysroot_result 29285b6dc79427b8f7eeb6a7ff68034ab8548ce670eaAlexander Gutkin 2929f4c12fce1ee58e670f9c3fce46c40296ba9ee8a2Ian Hodson # Check to see that this really is a libtool archive. 2930f4c12fce1ee58e670f9c3fce46c40296ba9ee8a2Ian Hodson func_lalib_unsafe_p "$file" \ 2931f4c12fce1ee58e670f9c3fce46c40296ba9ee8a2Ian Hodson || func_fatal_help "\`$file' is not a valid libtool archive" 2932f4c12fce1ee58e670f9c3fce46c40296ba9ee8a2Ian Hodson 2933f4c12fce1ee58e670f9c3fce46c40296ba9ee8a2Ian Hodson library_names= 2934f4c12fce1ee58e670f9c3fce46c40296ba9ee8a2Ian Hodson old_library= 2935f4c12fce1ee58e670f9c3fce46c40296ba9ee8a2Ian Hodson relink_command= 2936f4c12fce1ee58e670f9c3fce46c40296ba9ee8a2Ian Hodson func_source "$file" 2937f4c12fce1ee58e670f9c3fce46c40296ba9ee8a2Ian Hodson 2938f4c12fce1ee58e670f9c3fce46c40296ba9ee8a2Ian Hodson # Add the libdir to current_libdirs if it is the destination. 2939f4c12fce1ee58e670f9c3fce46c40296ba9ee8a2Ian Hodson if test "X$destdir" = "X$libdir"; then 2940f4c12fce1ee58e670f9c3fce46c40296ba9ee8a2Ian Hodson case "$current_libdirs " in 2941f4c12fce1ee58e670f9c3fce46c40296ba9ee8a2Ian Hodson *" $libdir "*) ;; 29425b6dc79427b8f7eeb6a7ff68034ab8548ce670eaAlexander Gutkin *) func_append current_libdirs " $libdir" ;; 2943f4c12fce1ee58e670f9c3fce46c40296ba9ee8a2Ian Hodson esac 2944f4c12fce1ee58e670f9c3fce46c40296ba9ee8a2Ian Hodson else 2945f4c12fce1ee58e670f9c3fce46c40296ba9ee8a2Ian Hodson # Note the libdir as a future libdir. 2946f4c12fce1ee58e670f9c3fce46c40296ba9ee8a2Ian Hodson case "$future_libdirs " in 2947f4c12fce1ee58e670f9c3fce46c40296ba9ee8a2Ian Hodson *" $libdir "*) ;; 29485b6dc79427b8f7eeb6a7ff68034ab8548ce670eaAlexander Gutkin *) func_append future_libdirs " $libdir" ;; 2949f4c12fce1ee58e670f9c3fce46c40296ba9ee8a2Ian Hodson esac 2950f4c12fce1ee58e670f9c3fce46c40296ba9ee8a2Ian Hodson fi 2951f4c12fce1ee58e670f9c3fce46c40296ba9ee8a2Ian Hodson 2952f4c12fce1ee58e670f9c3fce46c40296ba9ee8a2Ian Hodson func_dirname "$file" "/" "" 2953f4c12fce1ee58e670f9c3fce46c40296ba9ee8a2Ian Hodson dir="$func_dirname_result" 29545b6dc79427b8f7eeb6a7ff68034ab8548ce670eaAlexander Gutkin func_append dir "$objdir" 2955f4c12fce1ee58e670f9c3fce46c40296ba9ee8a2Ian Hodson 2956f4c12fce1ee58e670f9c3fce46c40296ba9ee8a2Ian Hodson if test -n "$relink_command"; then 2957f4c12fce1ee58e670f9c3fce46c40296ba9ee8a2Ian Hodson # Determine the prefix the user has applied to our future dir. 29585b6dc79427b8f7eeb6a7ff68034ab8548ce670eaAlexander Gutkin inst_prefix_dir=`$ECHO "$destdir" | $SED -e "s%$libdir\$%%"` 2959f4c12fce1ee58e670f9c3fce46c40296ba9ee8a2Ian Hodson 2960f4c12fce1ee58e670f9c3fce46c40296ba9ee8a2Ian Hodson # Don't allow the user to place us outside of our expected 2961f4c12fce1ee58e670f9c3fce46c40296ba9ee8a2Ian Hodson # location b/c this prevents finding dependent libraries that 2962f4c12fce1ee58e670f9c3fce46c40296ba9ee8a2Ian Hodson # are installed to the same prefix. 2963f4c12fce1ee58e670f9c3fce46c40296ba9ee8a2Ian Hodson # At present, this check doesn't affect windows .dll's that 2964f4c12fce1ee58e670f9c3fce46c40296ba9ee8a2Ian Hodson # are installed into $libdir/../bin (currently, that works fine) 2965f4c12fce1ee58e670f9c3fce46c40296ba9ee8a2Ian Hodson # but it's something to keep an eye on. 2966f4c12fce1ee58e670f9c3fce46c40296ba9ee8a2Ian Hodson test "$inst_prefix_dir" = "$destdir" && \ 2967f4c12fce1ee58e670f9c3fce46c40296ba9ee8a2Ian Hodson func_fatal_error "error: cannot install \`$file' to a directory not ending in $libdir" 2968f4c12fce1ee58e670f9c3fce46c40296ba9ee8a2Ian Hodson 2969f4c12fce1ee58e670f9c3fce46c40296ba9ee8a2Ian Hodson if test -n "$inst_prefix_dir"; then 2970f4c12fce1ee58e670f9c3fce46c40296ba9ee8a2Ian Hodson # Stick the inst_prefix_dir data into the link command. 29715b6dc79427b8f7eeb6a7ff68034ab8548ce670eaAlexander Gutkin relink_command=`$ECHO "$relink_command" | $SED "s%@inst_prefix_dir@%-inst-prefix-dir $inst_prefix_dir%"` 2972f4c12fce1ee58e670f9c3fce46c40296ba9ee8a2Ian Hodson else 29735b6dc79427b8f7eeb6a7ff68034ab8548ce670eaAlexander Gutkin relink_command=`$ECHO "$relink_command" | $SED "s%@inst_prefix_dir@%%"` 2974f4c12fce1ee58e670f9c3fce46c40296ba9ee8a2Ian Hodson fi 2975f4c12fce1ee58e670f9c3fce46c40296ba9ee8a2Ian Hodson 2976f4c12fce1ee58e670f9c3fce46c40296ba9ee8a2Ian Hodson func_warning "relinking \`$file'" 2977f4c12fce1ee58e670f9c3fce46c40296ba9ee8a2Ian Hodson func_show_eval "$relink_command" \ 2978f4c12fce1ee58e670f9c3fce46c40296ba9ee8a2Ian Hodson 'func_fatal_error "error: relink \`$file'\'' with the above command before installing it"' 2979f4c12fce1ee58e670f9c3fce46c40296ba9ee8a2Ian Hodson fi 2980f4c12fce1ee58e670f9c3fce46c40296ba9ee8a2Ian Hodson 2981f4c12fce1ee58e670f9c3fce46c40296ba9ee8a2Ian Hodson # See the names of the shared library. 2982f4c12fce1ee58e670f9c3fce46c40296ba9ee8a2Ian Hodson set dummy $library_names; shift 2983f4c12fce1ee58e670f9c3fce46c40296ba9ee8a2Ian Hodson if test -n "$1"; then 2984f4c12fce1ee58e670f9c3fce46c40296ba9ee8a2Ian Hodson realname="$1" 2985f4c12fce1ee58e670f9c3fce46c40296ba9ee8a2Ian Hodson shift 2986f4c12fce1ee58e670f9c3fce46c40296ba9ee8a2Ian Hodson 2987f4c12fce1ee58e670f9c3fce46c40296ba9ee8a2Ian Hodson srcname="$realname" 2988f4c12fce1ee58e670f9c3fce46c40296ba9ee8a2Ian Hodson test -n "$relink_command" && srcname="$realname"T 2989f4c12fce1ee58e670f9c3fce46c40296ba9ee8a2Ian Hodson 2990f4c12fce1ee58e670f9c3fce46c40296ba9ee8a2Ian Hodson # Install the shared library and build the symlinks. 29915b6dc79427b8f7eeb6a7ff68034ab8548ce670eaAlexander Gutkin func_show_eval "$install_shared_prog $dir/$srcname $destdir/$realname" \ 2992f4c12fce1ee58e670f9c3fce46c40296ba9ee8a2Ian Hodson 'exit $?' 2993f4c12fce1ee58e670f9c3fce46c40296ba9ee8a2Ian Hodson tstripme="$stripme" 2994f4c12fce1ee58e670f9c3fce46c40296ba9ee8a2Ian Hodson case $host_os in 2995f4c12fce1ee58e670f9c3fce46c40296ba9ee8a2Ian Hodson cygwin* | mingw* | pw32* | cegcc*) 2996f4c12fce1ee58e670f9c3fce46c40296ba9ee8a2Ian Hodson case $realname in 2997f4c12fce1ee58e670f9c3fce46c40296ba9ee8a2Ian Hodson *.dll.a) 2998f4c12fce1ee58e670f9c3fce46c40296ba9ee8a2Ian Hodson tstripme="" 2999f4c12fce1ee58e670f9c3fce46c40296ba9ee8a2Ian Hodson ;; 3000f4c12fce1ee58e670f9c3fce46c40296ba9ee8a2Ian Hodson esac 3001f4c12fce1ee58e670f9c3fce46c40296ba9ee8a2Ian Hodson ;; 3002f4c12fce1ee58e670f9c3fce46c40296ba9ee8a2Ian Hodson esac 3003f4c12fce1ee58e670f9c3fce46c40296ba9ee8a2Ian Hodson if test -n "$tstripme" && test -n "$striplib"; then 3004f4c12fce1ee58e670f9c3fce46c40296ba9ee8a2Ian Hodson func_show_eval "$striplib $destdir/$realname" 'exit $?' 3005f4c12fce1ee58e670f9c3fce46c40296ba9ee8a2Ian Hodson fi 3006f4c12fce1ee58e670f9c3fce46c40296ba9ee8a2Ian Hodson 3007f4c12fce1ee58e670f9c3fce46c40296ba9ee8a2Ian Hodson if test "$#" -gt 0; then 3008f4c12fce1ee58e670f9c3fce46c40296ba9ee8a2Ian Hodson # Delete the old symlinks, and create new ones. 3009f4c12fce1ee58e670f9c3fce46c40296ba9ee8a2Ian Hodson # Try `ln -sf' first, because the `ln' binary might depend on 3010f4c12fce1ee58e670f9c3fce46c40296ba9ee8a2Ian Hodson # the symlink we replace! Solaris /bin/ln does not understand -f, 3011f4c12fce1ee58e670f9c3fce46c40296ba9ee8a2Ian Hodson # so we also need to try rm && ln -s. 3012f4c12fce1ee58e670f9c3fce46c40296ba9ee8a2Ian Hodson for linkname 3013f4c12fce1ee58e670f9c3fce46c40296ba9ee8a2Ian Hodson do 3014f4c12fce1ee58e670f9c3fce46c40296ba9ee8a2Ian Hodson test "$linkname" != "$realname" \ 3015f4c12fce1ee58e670f9c3fce46c40296ba9ee8a2Ian Hodson && func_show_eval "(cd $destdir && { $LN_S -f $realname $linkname || { $RM $linkname && $LN_S $realname $linkname; }; })" 3016f4c12fce1ee58e670f9c3fce46c40296ba9ee8a2Ian Hodson done 3017f4c12fce1ee58e670f9c3fce46c40296ba9ee8a2Ian Hodson fi 3018f4c12fce1ee58e670f9c3fce46c40296ba9ee8a2Ian Hodson 3019f4c12fce1ee58e670f9c3fce46c40296ba9ee8a2Ian Hodson # Do each command in the postinstall commands. 3020f4c12fce1ee58e670f9c3fce46c40296ba9ee8a2Ian Hodson lib="$destdir/$realname" 3021f4c12fce1ee58e670f9c3fce46c40296ba9ee8a2Ian Hodson func_execute_cmds "$postinstall_cmds" 'exit $?' 3022f4c12fce1ee58e670f9c3fce46c40296ba9ee8a2Ian Hodson fi 3023f4c12fce1ee58e670f9c3fce46c40296ba9ee8a2Ian Hodson 3024f4c12fce1ee58e670f9c3fce46c40296ba9ee8a2Ian Hodson # Install the pseudo-library for information purposes. 3025f4c12fce1ee58e670f9c3fce46c40296ba9ee8a2Ian Hodson func_basename "$file" 3026f4c12fce1ee58e670f9c3fce46c40296ba9ee8a2Ian Hodson name="$func_basename_result" 3027f4c12fce1ee58e670f9c3fce46c40296ba9ee8a2Ian Hodson instname="$dir/$name"i 3028f4c12fce1ee58e670f9c3fce46c40296ba9ee8a2Ian Hodson func_show_eval "$install_prog $instname $destdir/$name" 'exit $?' 3029f4c12fce1ee58e670f9c3fce46c40296ba9ee8a2Ian Hodson 3030f4c12fce1ee58e670f9c3fce46c40296ba9ee8a2Ian Hodson # Maybe install the static library, too. 30315b6dc79427b8f7eeb6a7ff68034ab8548ce670eaAlexander Gutkin test -n "$old_library" && func_append staticlibs " $dir/$old_library" 3032f4c12fce1ee58e670f9c3fce46c40296ba9ee8a2Ian Hodson ;; 3033f4c12fce1ee58e670f9c3fce46c40296ba9ee8a2Ian Hodson 3034f4c12fce1ee58e670f9c3fce46c40296ba9ee8a2Ian Hodson *.lo) 3035f4c12fce1ee58e670f9c3fce46c40296ba9ee8a2Ian Hodson # Install (i.e. copy) a libtool object. 3036f4c12fce1ee58e670f9c3fce46c40296ba9ee8a2Ian Hodson 3037f4c12fce1ee58e670f9c3fce46c40296ba9ee8a2Ian Hodson # Figure out destination file name, if it wasn't already specified. 3038f4c12fce1ee58e670f9c3fce46c40296ba9ee8a2Ian Hodson if test -n "$destname"; then 3039f4c12fce1ee58e670f9c3fce46c40296ba9ee8a2Ian Hodson destfile="$destdir/$destname" 3040f4c12fce1ee58e670f9c3fce46c40296ba9ee8a2Ian Hodson else 3041f4c12fce1ee58e670f9c3fce46c40296ba9ee8a2Ian Hodson func_basename "$file" 3042f4c12fce1ee58e670f9c3fce46c40296ba9ee8a2Ian Hodson destfile="$func_basename_result" 3043f4c12fce1ee58e670f9c3fce46c40296ba9ee8a2Ian Hodson destfile="$destdir/$destfile" 3044f4c12fce1ee58e670f9c3fce46c40296ba9ee8a2Ian Hodson fi 3045f4c12fce1ee58e670f9c3fce46c40296ba9ee8a2Ian Hodson 3046f4c12fce1ee58e670f9c3fce46c40296ba9ee8a2Ian Hodson # Deduce the name of the destination old-style object file. 3047f4c12fce1ee58e670f9c3fce46c40296ba9ee8a2Ian Hodson case $destfile in 3048f4c12fce1ee58e670f9c3fce46c40296ba9ee8a2Ian Hodson *.lo) 3049f4c12fce1ee58e670f9c3fce46c40296ba9ee8a2Ian Hodson func_lo2o "$destfile" 3050f4c12fce1ee58e670f9c3fce46c40296ba9ee8a2Ian Hodson staticdest=$func_lo2o_result 3051f4c12fce1ee58e670f9c3fce46c40296ba9ee8a2Ian Hodson ;; 3052f4c12fce1ee58e670f9c3fce46c40296ba9ee8a2Ian Hodson *.$objext) 3053f4c12fce1ee58e670f9c3fce46c40296ba9ee8a2Ian Hodson staticdest="$destfile" 3054f4c12fce1ee58e670f9c3fce46c40296ba9ee8a2Ian Hodson destfile= 3055f4c12fce1ee58e670f9c3fce46c40296ba9ee8a2Ian Hodson ;; 3056f4c12fce1ee58e670f9c3fce46c40296ba9ee8a2Ian Hodson *) 3057f4c12fce1ee58e670f9c3fce46c40296ba9ee8a2Ian Hodson func_fatal_help "cannot copy a libtool object to \`$destfile'" 3058f4c12fce1ee58e670f9c3fce46c40296ba9ee8a2Ian Hodson ;; 3059f4c12fce1ee58e670f9c3fce46c40296ba9ee8a2Ian Hodson esac 3060f4c12fce1ee58e670f9c3fce46c40296ba9ee8a2Ian Hodson 3061f4c12fce1ee58e670f9c3fce46c40296ba9ee8a2Ian Hodson # Install the libtool object if requested. 3062f4c12fce1ee58e670f9c3fce46c40296ba9ee8a2Ian Hodson test -n "$destfile" && \ 3063f4c12fce1ee58e670f9c3fce46c40296ba9ee8a2Ian Hodson func_show_eval "$install_prog $file $destfile" 'exit $?' 3064f4c12fce1ee58e670f9c3fce46c40296ba9ee8a2Ian Hodson 3065f4c12fce1ee58e670f9c3fce46c40296ba9ee8a2Ian Hodson # Install the old object if enabled. 3066f4c12fce1ee58e670f9c3fce46c40296ba9ee8a2Ian Hodson if test "$build_old_libs" = yes; then 3067f4c12fce1ee58e670f9c3fce46c40296ba9ee8a2Ian Hodson # Deduce the name of the old-style object file. 3068f4c12fce1ee58e670f9c3fce46c40296ba9ee8a2Ian Hodson func_lo2o "$file" 3069f4c12fce1ee58e670f9c3fce46c40296ba9ee8a2Ian Hodson staticobj=$func_lo2o_result 3070f4c12fce1ee58e670f9c3fce46c40296ba9ee8a2Ian Hodson func_show_eval "$install_prog \$staticobj \$staticdest" 'exit $?' 3071f4c12fce1ee58e670f9c3fce46c40296ba9ee8a2Ian Hodson fi 3072f4c12fce1ee58e670f9c3fce46c40296ba9ee8a2Ian Hodson exit $EXIT_SUCCESS 3073f4c12fce1ee58e670f9c3fce46c40296ba9ee8a2Ian Hodson ;; 3074f4c12fce1ee58e670f9c3fce46c40296ba9ee8a2Ian Hodson 3075f4c12fce1ee58e670f9c3fce46c40296ba9ee8a2Ian Hodson *) 3076f4c12fce1ee58e670f9c3fce46c40296ba9ee8a2Ian Hodson # Figure out destination file name, if it wasn't already specified. 3077f4c12fce1ee58e670f9c3fce46c40296ba9ee8a2Ian Hodson if test -n "$destname"; then 3078f4c12fce1ee58e670f9c3fce46c40296ba9ee8a2Ian Hodson destfile="$destdir/$destname" 3079f4c12fce1ee58e670f9c3fce46c40296ba9ee8a2Ian Hodson else 3080f4c12fce1ee58e670f9c3fce46c40296ba9ee8a2Ian Hodson func_basename "$file" 3081f4c12fce1ee58e670f9c3fce46c40296ba9ee8a2Ian Hodson destfile="$func_basename_result" 3082f4c12fce1ee58e670f9c3fce46c40296ba9ee8a2Ian Hodson destfile="$destdir/$destfile" 3083f4c12fce1ee58e670f9c3fce46c40296ba9ee8a2Ian Hodson fi 3084f4c12fce1ee58e670f9c3fce46c40296ba9ee8a2Ian Hodson 3085f4c12fce1ee58e670f9c3fce46c40296ba9ee8a2Ian Hodson # If the file is missing, and there is a .exe on the end, strip it 3086f4c12fce1ee58e670f9c3fce46c40296ba9ee8a2Ian Hodson # because it is most likely a libtool script we actually want to 3087f4c12fce1ee58e670f9c3fce46c40296ba9ee8a2Ian Hodson # install 3088f4c12fce1ee58e670f9c3fce46c40296ba9ee8a2Ian Hodson stripped_ext="" 3089f4c12fce1ee58e670f9c3fce46c40296ba9ee8a2Ian Hodson case $file in 3090f4c12fce1ee58e670f9c3fce46c40296ba9ee8a2Ian Hodson *.exe) 3091f4c12fce1ee58e670f9c3fce46c40296ba9ee8a2Ian Hodson if test ! -f "$file"; then 3092f4c12fce1ee58e670f9c3fce46c40296ba9ee8a2Ian Hodson func_stripname '' '.exe' "$file" 3093f4c12fce1ee58e670f9c3fce46c40296ba9ee8a2Ian Hodson file=$func_stripname_result 3094f4c12fce1ee58e670f9c3fce46c40296ba9ee8a2Ian Hodson stripped_ext=".exe" 3095f4c12fce1ee58e670f9c3fce46c40296ba9ee8a2Ian Hodson fi 3096f4c12fce1ee58e670f9c3fce46c40296ba9ee8a2Ian Hodson ;; 3097f4c12fce1ee58e670f9c3fce46c40296ba9ee8a2Ian Hodson esac 3098f4c12fce1ee58e670f9c3fce46c40296ba9ee8a2Ian Hodson 3099f4c12fce1ee58e670f9c3fce46c40296ba9ee8a2Ian Hodson # Do a test to see if this is really a libtool program. 3100f4c12fce1ee58e670f9c3fce46c40296ba9ee8a2Ian Hodson case $host in 3101f4c12fce1ee58e670f9c3fce46c40296ba9ee8a2Ian Hodson *cygwin* | *mingw*) 3102f4c12fce1ee58e670f9c3fce46c40296ba9ee8a2Ian Hodson if func_ltwrapper_executable_p "$file"; then 3103f4c12fce1ee58e670f9c3fce46c40296ba9ee8a2Ian Hodson func_ltwrapper_scriptname "$file" 3104f4c12fce1ee58e670f9c3fce46c40296ba9ee8a2Ian Hodson wrapper=$func_ltwrapper_scriptname_result 3105f4c12fce1ee58e670f9c3fce46c40296ba9ee8a2Ian Hodson else 3106f4c12fce1ee58e670f9c3fce46c40296ba9ee8a2Ian Hodson func_stripname '' '.exe' "$file" 3107f4c12fce1ee58e670f9c3fce46c40296ba9ee8a2Ian Hodson wrapper=$func_stripname_result 3108f4c12fce1ee58e670f9c3fce46c40296ba9ee8a2Ian Hodson fi 3109f4c12fce1ee58e670f9c3fce46c40296ba9ee8a2Ian Hodson ;; 3110f4c12fce1ee58e670f9c3fce46c40296ba9ee8a2Ian Hodson *) 3111f4c12fce1ee58e670f9c3fce46c40296ba9ee8a2Ian Hodson wrapper=$file 3112f4c12fce1ee58e670f9c3fce46c40296ba9ee8a2Ian Hodson ;; 3113f4c12fce1ee58e670f9c3fce46c40296ba9ee8a2Ian Hodson esac 3114f4c12fce1ee58e670f9c3fce46c40296ba9ee8a2Ian Hodson if func_ltwrapper_script_p "$wrapper"; then 3115f4c12fce1ee58e670f9c3fce46c40296ba9ee8a2Ian Hodson notinst_deplibs= 3116f4c12fce1ee58e670f9c3fce46c40296ba9ee8a2Ian Hodson relink_command= 3117f4c12fce1ee58e670f9c3fce46c40296ba9ee8a2Ian Hodson 3118f4c12fce1ee58e670f9c3fce46c40296ba9ee8a2Ian Hodson func_source "$wrapper" 3119f4c12fce1ee58e670f9c3fce46c40296ba9ee8a2Ian Hodson 3120f4c12fce1ee58e670f9c3fce46c40296ba9ee8a2Ian Hodson # Check the variables that should have been set. 3121f4c12fce1ee58e670f9c3fce46c40296ba9ee8a2Ian Hodson test -z "$generated_by_libtool_version" && \ 3122f4c12fce1ee58e670f9c3fce46c40296ba9ee8a2Ian Hodson func_fatal_error "invalid libtool wrapper script \`$wrapper'" 3123f4c12fce1ee58e670f9c3fce46c40296ba9ee8a2Ian Hodson 3124f4c12fce1ee58e670f9c3fce46c40296ba9ee8a2Ian Hodson finalize=yes 3125f4c12fce1ee58e670f9c3fce46c40296ba9ee8a2Ian Hodson for lib in $notinst_deplibs; do 3126f4c12fce1ee58e670f9c3fce46c40296ba9ee8a2Ian Hodson # Check to see that each library is installed. 3127f4c12fce1ee58e670f9c3fce46c40296ba9ee8a2Ian Hodson libdir= 3128f4c12fce1ee58e670f9c3fce46c40296ba9ee8a2Ian Hodson if test -f "$lib"; then 3129f4c12fce1ee58e670f9c3fce46c40296ba9ee8a2Ian Hodson func_source "$lib" 3130f4c12fce1ee58e670f9c3fce46c40296ba9ee8a2Ian Hodson fi 31315b6dc79427b8f7eeb6a7ff68034ab8548ce670eaAlexander Gutkin libfile="$libdir/"`$ECHO "$lib" | $SED 's%^.*/%%g'` ### testsuite: skip nested quoting test 3132f4c12fce1ee58e670f9c3fce46c40296ba9ee8a2Ian Hodson if test -n "$libdir" && test ! -f "$libfile"; then 3133f4c12fce1ee58e670f9c3fce46c40296ba9ee8a2Ian Hodson func_warning "\`$lib' has not been installed in \`$libdir'" 3134f4c12fce1ee58e670f9c3fce46c40296ba9ee8a2Ian Hodson finalize=no 3135f4c12fce1ee58e670f9c3fce46c40296ba9ee8a2Ian Hodson fi 3136f4c12fce1ee58e670f9c3fce46c40296ba9ee8a2Ian Hodson done 3137f4c12fce1ee58e670f9c3fce46c40296ba9ee8a2Ian Hodson 3138f4c12fce1ee58e670f9c3fce46c40296ba9ee8a2Ian Hodson relink_command= 3139f4c12fce1ee58e670f9c3fce46c40296ba9ee8a2Ian Hodson func_source "$wrapper" 3140f4c12fce1ee58e670f9c3fce46c40296ba9ee8a2Ian Hodson 3141f4c12fce1ee58e670f9c3fce46c40296ba9ee8a2Ian Hodson outputname= 3142f4c12fce1ee58e670f9c3fce46c40296ba9ee8a2Ian Hodson if test "$fast_install" = no && test -n "$relink_command"; then 3143f4c12fce1ee58e670f9c3fce46c40296ba9ee8a2Ian Hodson $opt_dry_run || { 3144f4c12fce1ee58e670f9c3fce46c40296ba9ee8a2Ian Hodson if test "$finalize" = yes; then 3145f4c12fce1ee58e670f9c3fce46c40296ba9ee8a2Ian Hodson tmpdir=`func_mktempdir` 3146f4c12fce1ee58e670f9c3fce46c40296ba9ee8a2Ian Hodson func_basename "$file$stripped_ext" 3147f4c12fce1ee58e670f9c3fce46c40296ba9ee8a2Ian Hodson file="$func_basename_result" 3148f4c12fce1ee58e670f9c3fce46c40296ba9ee8a2Ian Hodson outputname="$tmpdir/$file" 3149f4c12fce1ee58e670f9c3fce46c40296ba9ee8a2Ian Hodson # Replace the output file specification. 31505b6dc79427b8f7eeb6a7ff68034ab8548ce670eaAlexander Gutkin relink_command=`$ECHO "$relink_command" | $SED 's%@OUTPUT@%'"$outputname"'%g'` 3151f4c12fce1ee58e670f9c3fce46c40296ba9ee8a2Ian Hodson 3152f4c12fce1ee58e670f9c3fce46c40296ba9ee8a2Ian Hodson $opt_silent || { 3153f4c12fce1ee58e670f9c3fce46c40296ba9ee8a2Ian Hodson func_quote_for_expand "$relink_command" 3154f4c12fce1ee58e670f9c3fce46c40296ba9ee8a2Ian Hodson eval "func_echo $func_quote_for_expand_result" 3155f4c12fce1ee58e670f9c3fce46c40296ba9ee8a2Ian Hodson } 3156f4c12fce1ee58e670f9c3fce46c40296ba9ee8a2Ian Hodson if eval "$relink_command"; then : 3157f4c12fce1ee58e670f9c3fce46c40296ba9ee8a2Ian Hodson else 3158f4c12fce1ee58e670f9c3fce46c40296ba9ee8a2Ian Hodson func_error "error: relink \`$file' with the above command before installing it" 3159f4c12fce1ee58e670f9c3fce46c40296ba9ee8a2Ian Hodson $opt_dry_run || ${RM}r "$tmpdir" 3160f4c12fce1ee58e670f9c3fce46c40296ba9ee8a2Ian Hodson continue 3161f4c12fce1ee58e670f9c3fce46c40296ba9ee8a2Ian Hodson fi 3162f4c12fce1ee58e670f9c3fce46c40296ba9ee8a2Ian Hodson file="$outputname" 3163f4c12fce1ee58e670f9c3fce46c40296ba9ee8a2Ian Hodson else 3164f4c12fce1ee58e670f9c3fce46c40296ba9ee8a2Ian Hodson func_warning "cannot relink \`$file'" 3165f4c12fce1ee58e670f9c3fce46c40296ba9ee8a2Ian Hodson fi 3166f4c12fce1ee58e670f9c3fce46c40296ba9ee8a2Ian Hodson } 3167f4c12fce1ee58e670f9c3fce46c40296ba9ee8a2Ian Hodson else 3168f4c12fce1ee58e670f9c3fce46c40296ba9ee8a2Ian Hodson # Install the binary that we compiled earlier. 31695b6dc79427b8f7eeb6a7ff68034ab8548ce670eaAlexander Gutkin file=`$ECHO "$file$stripped_ext" | $SED "s%\([^/]*\)$%$objdir/\1%"` 3170f4c12fce1ee58e670f9c3fce46c40296ba9ee8a2Ian Hodson fi 3171f4c12fce1ee58e670f9c3fce46c40296ba9ee8a2Ian Hodson fi 3172f4c12fce1ee58e670f9c3fce46c40296ba9ee8a2Ian Hodson 3173f4c12fce1ee58e670f9c3fce46c40296ba9ee8a2Ian Hodson # remove .exe since cygwin /usr/bin/install will append another 3174f4c12fce1ee58e670f9c3fce46c40296ba9ee8a2Ian Hodson # one anyway 3175f4c12fce1ee58e670f9c3fce46c40296ba9ee8a2Ian Hodson case $install_prog,$host in 3176f4c12fce1ee58e670f9c3fce46c40296ba9ee8a2Ian Hodson */usr/bin/install*,*cygwin*) 3177f4c12fce1ee58e670f9c3fce46c40296ba9ee8a2Ian Hodson case $file:$destfile in 3178f4c12fce1ee58e670f9c3fce46c40296ba9ee8a2Ian Hodson *.exe:*.exe) 3179f4c12fce1ee58e670f9c3fce46c40296ba9ee8a2Ian Hodson # this is ok 3180f4c12fce1ee58e670f9c3fce46c40296ba9ee8a2Ian Hodson ;; 3181f4c12fce1ee58e670f9c3fce46c40296ba9ee8a2Ian Hodson *.exe:*) 3182f4c12fce1ee58e670f9c3fce46c40296ba9ee8a2Ian Hodson destfile=$destfile.exe 3183f4c12fce1ee58e670f9c3fce46c40296ba9ee8a2Ian Hodson ;; 3184f4c12fce1ee58e670f9c3fce46c40296ba9ee8a2Ian Hodson *:*.exe) 3185f4c12fce1ee58e670f9c3fce46c40296ba9ee8a2Ian Hodson func_stripname '' '.exe' "$destfile" 3186f4c12fce1ee58e670f9c3fce46c40296ba9ee8a2Ian Hodson destfile=$func_stripname_result 3187f4c12fce1ee58e670f9c3fce46c40296ba9ee8a2Ian Hodson ;; 3188f4c12fce1ee58e670f9c3fce46c40296ba9ee8a2Ian Hodson esac 3189f4c12fce1ee58e670f9c3fce46c40296ba9ee8a2Ian Hodson ;; 3190f4c12fce1ee58e670f9c3fce46c40296ba9ee8a2Ian Hodson esac 3191f4c12fce1ee58e670f9c3fce46c40296ba9ee8a2Ian Hodson func_show_eval "$install_prog\$stripme \$file \$destfile" 'exit $?' 3192f4c12fce1ee58e670f9c3fce46c40296ba9ee8a2Ian Hodson $opt_dry_run || if test -n "$outputname"; then 3193f4c12fce1ee58e670f9c3fce46c40296ba9ee8a2Ian Hodson ${RM}r "$tmpdir" 3194f4c12fce1ee58e670f9c3fce46c40296ba9ee8a2Ian Hodson fi 3195f4c12fce1ee58e670f9c3fce46c40296ba9ee8a2Ian Hodson ;; 3196f4c12fce1ee58e670f9c3fce46c40296ba9ee8a2Ian Hodson esac 3197f4c12fce1ee58e670f9c3fce46c40296ba9ee8a2Ian Hodson done 3198f4c12fce1ee58e670f9c3fce46c40296ba9ee8a2Ian Hodson 3199f4c12fce1ee58e670f9c3fce46c40296ba9ee8a2Ian Hodson for file in $staticlibs; do 3200f4c12fce1ee58e670f9c3fce46c40296ba9ee8a2Ian Hodson func_basename "$file" 3201f4c12fce1ee58e670f9c3fce46c40296ba9ee8a2Ian Hodson name="$func_basename_result" 3202f4c12fce1ee58e670f9c3fce46c40296ba9ee8a2Ian Hodson 3203f4c12fce1ee58e670f9c3fce46c40296ba9ee8a2Ian Hodson # Set up the ranlib parameters. 3204f4c12fce1ee58e670f9c3fce46c40296ba9ee8a2Ian Hodson oldlib="$destdir/$name" 32055b6dc79427b8f7eeb6a7ff68034ab8548ce670eaAlexander Gutkin func_to_tool_file "$oldlib" func_convert_file_msys_to_w32 32065b6dc79427b8f7eeb6a7ff68034ab8548ce670eaAlexander Gutkin tool_oldlib=$func_to_tool_file_result 3207f4c12fce1ee58e670f9c3fce46c40296ba9ee8a2Ian Hodson 3208f4c12fce1ee58e670f9c3fce46c40296ba9ee8a2Ian Hodson func_show_eval "$install_prog \$file \$oldlib" 'exit $?' 3209f4c12fce1ee58e670f9c3fce46c40296ba9ee8a2Ian Hodson 3210f4c12fce1ee58e670f9c3fce46c40296ba9ee8a2Ian Hodson if test -n "$stripme" && test -n "$old_striplib"; then 32115b6dc79427b8f7eeb6a7ff68034ab8548ce670eaAlexander Gutkin func_show_eval "$old_striplib $tool_oldlib" 'exit $?' 3212f4c12fce1ee58e670f9c3fce46c40296ba9ee8a2Ian Hodson fi 3213f4c12fce1ee58e670f9c3fce46c40296ba9ee8a2Ian Hodson 3214f4c12fce1ee58e670f9c3fce46c40296ba9ee8a2Ian Hodson # Do each command in the postinstall commands. 3215f4c12fce1ee58e670f9c3fce46c40296ba9ee8a2Ian Hodson func_execute_cmds "$old_postinstall_cmds" 'exit $?' 3216f4c12fce1ee58e670f9c3fce46c40296ba9ee8a2Ian Hodson done 3217f4c12fce1ee58e670f9c3fce46c40296ba9ee8a2Ian Hodson 3218f4c12fce1ee58e670f9c3fce46c40296ba9ee8a2Ian Hodson test -n "$future_libdirs" && \ 3219f4c12fce1ee58e670f9c3fce46c40296ba9ee8a2Ian Hodson func_warning "remember to run \`$progname --finish$future_libdirs'" 3220f4c12fce1ee58e670f9c3fce46c40296ba9ee8a2Ian Hodson 3221f4c12fce1ee58e670f9c3fce46c40296ba9ee8a2Ian Hodson if test -n "$current_libdirs"; then 3222f4c12fce1ee58e670f9c3fce46c40296ba9ee8a2Ian Hodson # Maybe just do a dry run. 3223f4c12fce1ee58e670f9c3fce46c40296ba9ee8a2Ian Hodson $opt_dry_run && current_libdirs=" -n$current_libdirs" 3224f4c12fce1ee58e670f9c3fce46c40296ba9ee8a2Ian Hodson exec_cmd='$SHELL $progpath $preserve_args --finish$current_libdirs' 3225f4c12fce1ee58e670f9c3fce46c40296ba9ee8a2Ian Hodson else 3226f4c12fce1ee58e670f9c3fce46c40296ba9ee8a2Ian Hodson exit $EXIT_SUCCESS 3227f4c12fce1ee58e670f9c3fce46c40296ba9ee8a2Ian Hodson fi 3228f4c12fce1ee58e670f9c3fce46c40296ba9ee8a2Ian Hodson} 3229f4c12fce1ee58e670f9c3fce46c40296ba9ee8a2Ian Hodson 32305b6dc79427b8f7eeb6a7ff68034ab8548ce670eaAlexander Gutkintest "$opt_mode" = install && func_mode_install ${1+"$@"} 3231f4c12fce1ee58e670f9c3fce46c40296ba9ee8a2Ian Hodson 3232f4c12fce1ee58e670f9c3fce46c40296ba9ee8a2Ian Hodson 3233f4c12fce1ee58e670f9c3fce46c40296ba9ee8a2Ian Hodson# func_generate_dlsyms outputname originator pic_p 3234f4c12fce1ee58e670f9c3fce46c40296ba9ee8a2Ian Hodson# Extract symbols from dlprefiles and create ${outputname}S.o with 3235f4c12fce1ee58e670f9c3fce46c40296ba9ee8a2Ian Hodson# a dlpreopen symbol table. 3236f4c12fce1ee58e670f9c3fce46c40296ba9ee8a2Ian Hodsonfunc_generate_dlsyms () 3237f4c12fce1ee58e670f9c3fce46c40296ba9ee8a2Ian Hodson{ 3238f4c12fce1ee58e670f9c3fce46c40296ba9ee8a2Ian Hodson $opt_debug 3239f4c12fce1ee58e670f9c3fce46c40296ba9ee8a2Ian Hodson my_outputname="$1" 3240f4c12fce1ee58e670f9c3fce46c40296ba9ee8a2Ian Hodson my_originator="$2" 3241f4c12fce1ee58e670f9c3fce46c40296ba9ee8a2Ian Hodson my_pic_p="${3-no}" 3242f4c12fce1ee58e670f9c3fce46c40296ba9ee8a2Ian Hodson my_prefix=`$ECHO "$my_originator" | sed 's%[^a-zA-Z0-9]%_%g'` 3243f4c12fce1ee58e670f9c3fce46c40296ba9ee8a2Ian Hodson my_dlsyms= 3244f4c12fce1ee58e670f9c3fce46c40296ba9ee8a2Ian Hodson 3245f4c12fce1ee58e670f9c3fce46c40296ba9ee8a2Ian Hodson if test -n "$dlfiles$dlprefiles" || test "$dlself" != no; then 3246f4c12fce1ee58e670f9c3fce46c40296ba9ee8a2Ian Hodson if test -n "$NM" && test -n "$global_symbol_pipe"; then 3247f4c12fce1ee58e670f9c3fce46c40296ba9ee8a2Ian Hodson my_dlsyms="${my_outputname}S.c" 3248f4c12fce1ee58e670f9c3fce46c40296ba9ee8a2Ian Hodson else 3249f4c12fce1ee58e670f9c3fce46c40296ba9ee8a2Ian Hodson func_error "not configured to extract global symbols from dlpreopened files" 3250f4c12fce1ee58e670f9c3fce46c40296ba9ee8a2Ian Hodson fi 3251f4c12fce1ee58e670f9c3fce46c40296ba9ee8a2Ian Hodson fi 3252f4c12fce1ee58e670f9c3fce46c40296ba9ee8a2Ian Hodson 3253f4c12fce1ee58e670f9c3fce46c40296ba9ee8a2Ian Hodson if test -n "$my_dlsyms"; then 3254f4c12fce1ee58e670f9c3fce46c40296ba9ee8a2Ian Hodson case $my_dlsyms in 3255f4c12fce1ee58e670f9c3fce46c40296ba9ee8a2Ian Hodson "") ;; 3256f4c12fce1ee58e670f9c3fce46c40296ba9ee8a2Ian Hodson *.c) 3257f4c12fce1ee58e670f9c3fce46c40296ba9ee8a2Ian Hodson # Discover the nlist of each of the dlfiles. 3258f4c12fce1ee58e670f9c3fce46c40296ba9ee8a2Ian Hodson nlist="$output_objdir/${my_outputname}.nm" 3259f4c12fce1ee58e670f9c3fce46c40296ba9ee8a2Ian Hodson 3260f4c12fce1ee58e670f9c3fce46c40296ba9ee8a2Ian Hodson func_show_eval "$RM $nlist ${nlist}S ${nlist}T" 3261f4c12fce1ee58e670f9c3fce46c40296ba9ee8a2Ian Hodson 3262f4c12fce1ee58e670f9c3fce46c40296ba9ee8a2Ian Hodson # Parse the name list into a source file. 3263f4c12fce1ee58e670f9c3fce46c40296ba9ee8a2Ian Hodson func_verbose "creating $output_objdir/$my_dlsyms" 3264f4c12fce1ee58e670f9c3fce46c40296ba9ee8a2Ian Hodson 3265f4c12fce1ee58e670f9c3fce46c40296ba9ee8a2Ian Hodson $opt_dry_run || $ECHO > "$output_objdir/$my_dlsyms" "\ 3266f4c12fce1ee58e670f9c3fce46c40296ba9ee8a2Ian Hodson/* $my_dlsyms - symbol resolution table for \`$my_outputname' dlsym emulation. */ 3267f4c12fce1ee58e670f9c3fce46c40296ba9ee8a2Ian Hodson/* Generated by $PROGRAM (GNU $PACKAGE$TIMESTAMP) $VERSION */ 3268f4c12fce1ee58e670f9c3fce46c40296ba9ee8a2Ian Hodson 3269f4c12fce1ee58e670f9c3fce46c40296ba9ee8a2Ian Hodson#ifdef __cplusplus 3270f4c12fce1ee58e670f9c3fce46c40296ba9ee8a2Ian Hodsonextern \"C\" { 3271f4c12fce1ee58e670f9c3fce46c40296ba9ee8a2Ian Hodson#endif 3272f4c12fce1ee58e670f9c3fce46c40296ba9ee8a2Ian Hodson 32735b6dc79427b8f7eeb6a7ff68034ab8548ce670eaAlexander Gutkin#if defined(__GNUC__) && (((__GNUC__ == 4) && (__GNUC_MINOR__ >= 4)) || (__GNUC__ > 4)) 32745b6dc79427b8f7eeb6a7ff68034ab8548ce670eaAlexander Gutkin#pragma GCC diagnostic ignored \"-Wstrict-prototypes\" 32755b6dc79427b8f7eeb6a7ff68034ab8548ce670eaAlexander Gutkin#endif 32765b6dc79427b8f7eeb6a7ff68034ab8548ce670eaAlexander Gutkin 32775b6dc79427b8f7eeb6a7ff68034ab8548ce670eaAlexander Gutkin/* Keep this code in sync between libtool.m4, ltmain, lt_system.h, and tests. */ 32785b6dc79427b8f7eeb6a7ff68034ab8548ce670eaAlexander Gutkin#if defined(_WIN32) || defined(__CYGWIN__) || defined(_WIN32_WCE) 32795b6dc79427b8f7eeb6a7ff68034ab8548ce670eaAlexander Gutkin/* DATA imports from DLLs on WIN32 con't be const, because runtime 32805b6dc79427b8f7eeb6a7ff68034ab8548ce670eaAlexander Gutkin relocations are performed -- see ld's documentation on pseudo-relocs. */ 32815b6dc79427b8f7eeb6a7ff68034ab8548ce670eaAlexander Gutkin# define LT_DLSYM_CONST 32825b6dc79427b8f7eeb6a7ff68034ab8548ce670eaAlexander Gutkin#elif defined(__osf__) 32835b6dc79427b8f7eeb6a7ff68034ab8548ce670eaAlexander Gutkin/* This system does not cope well with relocations in const data. */ 32845b6dc79427b8f7eeb6a7ff68034ab8548ce670eaAlexander Gutkin# define LT_DLSYM_CONST 32855b6dc79427b8f7eeb6a7ff68034ab8548ce670eaAlexander Gutkin#else 32865b6dc79427b8f7eeb6a7ff68034ab8548ce670eaAlexander Gutkin# define LT_DLSYM_CONST const 32875b6dc79427b8f7eeb6a7ff68034ab8548ce670eaAlexander Gutkin#endif 32885b6dc79427b8f7eeb6a7ff68034ab8548ce670eaAlexander Gutkin 3289f4c12fce1ee58e670f9c3fce46c40296ba9ee8a2Ian Hodson/* External symbol declarations for the compiler. */\ 3290f4c12fce1ee58e670f9c3fce46c40296ba9ee8a2Ian Hodson" 3291f4c12fce1ee58e670f9c3fce46c40296ba9ee8a2Ian Hodson 3292f4c12fce1ee58e670f9c3fce46c40296ba9ee8a2Ian Hodson if test "$dlself" = yes; then 3293f4c12fce1ee58e670f9c3fce46c40296ba9ee8a2Ian Hodson func_verbose "generating symbol list for \`$output'" 3294f4c12fce1ee58e670f9c3fce46c40296ba9ee8a2Ian Hodson 3295f4c12fce1ee58e670f9c3fce46c40296ba9ee8a2Ian Hodson $opt_dry_run || echo ': @PROGRAM@ ' > "$nlist" 3296f4c12fce1ee58e670f9c3fce46c40296ba9ee8a2Ian Hodson 3297f4c12fce1ee58e670f9c3fce46c40296ba9ee8a2Ian Hodson # Add our own program objects to the symbol list. 32985b6dc79427b8f7eeb6a7ff68034ab8548ce670eaAlexander Gutkin progfiles=`$ECHO "$objs$old_deplibs" | $SP2NL | $SED "$lo2o" | $NL2SP` 3299f4c12fce1ee58e670f9c3fce46c40296ba9ee8a2Ian Hodson for progfile in $progfiles; do 33005b6dc79427b8f7eeb6a7ff68034ab8548ce670eaAlexander Gutkin func_to_tool_file "$progfile" func_convert_file_msys_to_w32 33015b6dc79427b8f7eeb6a7ff68034ab8548ce670eaAlexander Gutkin func_verbose "extracting global C symbols from \`$func_to_tool_file_result'" 33025b6dc79427b8f7eeb6a7ff68034ab8548ce670eaAlexander Gutkin $opt_dry_run || eval "$NM $func_to_tool_file_result | $global_symbol_pipe >> '$nlist'" 3303f4c12fce1ee58e670f9c3fce46c40296ba9ee8a2Ian Hodson done 3304f4c12fce1ee58e670f9c3fce46c40296ba9ee8a2Ian Hodson 3305f4c12fce1ee58e670f9c3fce46c40296ba9ee8a2Ian Hodson if test -n "$exclude_expsyms"; then 3306f4c12fce1ee58e670f9c3fce46c40296ba9ee8a2Ian Hodson $opt_dry_run || { 3307f4c12fce1ee58e670f9c3fce46c40296ba9ee8a2Ian Hodson eval '$EGREP -v " ($exclude_expsyms)$" "$nlist" > "$nlist"T' 3308f4c12fce1ee58e670f9c3fce46c40296ba9ee8a2Ian Hodson eval '$MV "$nlist"T "$nlist"' 3309f4c12fce1ee58e670f9c3fce46c40296ba9ee8a2Ian Hodson } 3310f4c12fce1ee58e670f9c3fce46c40296ba9ee8a2Ian Hodson fi 3311f4c12fce1ee58e670f9c3fce46c40296ba9ee8a2Ian Hodson 3312f4c12fce1ee58e670f9c3fce46c40296ba9ee8a2Ian Hodson if test -n "$export_symbols_regex"; then 3313f4c12fce1ee58e670f9c3fce46c40296ba9ee8a2Ian Hodson $opt_dry_run || { 3314f4c12fce1ee58e670f9c3fce46c40296ba9ee8a2Ian Hodson eval '$EGREP -e "$export_symbols_regex" "$nlist" > "$nlist"T' 3315f4c12fce1ee58e670f9c3fce46c40296ba9ee8a2Ian Hodson eval '$MV "$nlist"T "$nlist"' 3316f4c12fce1ee58e670f9c3fce46c40296ba9ee8a2Ian Hodson } 3317f4c12fce1ee58e670f9c3fce46c40296ba9ee8a2Ian Hodson fi 3318f4c12fce1ee58e670f9c3fce46c40296ba9ee8a2Ian Hodson 3319f4c12fce1ee58e670f9c3fce46c40296ba9ee8a2Ian Hodson # Prepare the list of exported symbols 3320f4c12fce1ee58e670f9c3fce46c40296ba9ee8a2Ian Hodson if test -z "$export_symbols"; then 3321f4c12fce1ee58e670f9c3fce46c40296ba9ee8a2Ian Hodson export_symbols="$output_objdir/$outputname.exp" 3322f4c12fce1ee58e670f9c3fce46c40296ba9ee8a2Ian Hodson $opt_dry_run || { 3323f4c12fce1ee58e670f9c3fce46c40296ba9ee8a2Ian Hodson $RM $export_symbols 3324f4c12fce1ee58e670f9c3fce46c40296ba9ee8a2Ian Hodson eval "${SED} -n -e '/^: @PROGRAM@ $/d' -e 's/^.* \(.*\)$/\1/p' "'< "$nlist" > "$export_symbols"' 3325f4c12fce1ee58e670f9c3fce46c40296ba9ee8a2Ian Hodson case $host in 3326f4c12fce1ee58e670f9c3fce46c40296ba9ee8a2Ian Hodson *cygwin* | *mingw* | *cegcc* ) 3327f4c12fce1ee58e670f9c3fce46c40296ba9ee8a2Ian Hodson eval "echo EXPORTS "'> "$output_objdir/$outputname.def"' 3328f4c12fce1ee58e670f9c3fce46c40296ba9ee8a2Ian Hodson eval 'cat "$export_symbols" >> "$output_objdir/$outputname.def"' 3329f4c12fce1ee58e670f9c3fce46c40296ba9ee8a2Ian Hodson ;; 3330f4c12fce1ee58e670f9c3fce46c40296ba9ee8a2Ian Hodson esac 3331f4c12fce1ee58e670f9c3fce46c40296ba9ee8a2Ian Hodson } 3332f4c12fce1ee58e670f9c3fce46c40296ba9ee8a2Ian Hodson else 3333f4c12fce1ee58e670f9c3fce46c40296ba9ee8a2Ian Hodson $opt_dry_run || { 3334f4c12fce1ee58e670f9c3fce46c40296ba9ee8a2Ian Hodson eval "${SED} -e 's/\([].[*^$]\)/\\\\\1/g' -e 's/^/ /' -e 's/$/$/'"' < "$export_symbols" > "$output_objdir/$outputname.exp"' 3335f4c12fce1ee58e670f9c3fce46c40296ba9ee8a2Ian Hodson eval '$GREP -f "$output_objdir/$outputname.exp" < "$nlist" > "$nlist"T' 3336f4c12fce1ee58e670f9c3fce46c40296ba9ee8a2Ian Hodson eval '$MV "$nlist"T "$nlist"' 3337f4c12fce1ee58e670f9c3fce46c40296ba9ee8a2Ian Hodson case $host in 33385b6dc79427b8f7eeb6a7ff68034ab8548ce670eaAlexander Gutkin *cygwin* | *mingw* | *cegcc* ) 3339f4c12fce1ee58e670f9c3fce46c40296ba9ee8a2Ian Hodson eval "echo EXPORTS "'> "$output_objdir/$outputname.def"' 3340f4c12fce1ee58e670f9c3fce46c40296ba9ee8a2Ian Hodson eval 'cat "$nlist" >> "$output_objdir/$outputname.def"' 3341f4c12fce1ee58e670f9c3fce46c40296ba9ee8a2Ian Hodson ;; 3342f4c12fce1ee58e670f9c3fce46c40296ba9ee8a2Ian Hodson esac 3343f4c12fce1ee58e670f9c3fce46c40296ba9ee8a2Ian Hodson } 3344f4c12fce1ee58e670f9c3fce46c40296ba9ee8a2Ian Hodson fi 3345f4c12fce1ee58e670f9c3fce46c40296ba9ee8a2Ian Hodson fi 3346f4c12fce1ee58e670f9c3fce46c40296ba9ee8a2Ian Hodson 3347f4c12fce1ee58e670f9c3fce46c40296ba9ee8a2Ian Hodson for dlprefile in $dlprefiles; do 3348f4c12fce1ee58e670f9c3fce46c40296ba9ee8a2Ian Hodson func_verbose "extracting global C symbols from \`$dlprefile'" 3349f4c12fce1ee58e670f9c3fce46c40296ba9ee8a2Ian Hodson func_basename "$dlprefile" 3350f4c12fce1ee58e670f9c3fce46c40296ba9ee8a2Ian Hodson name="$func_basename_result" 33515b6dc79427b8f7eeb6a7ff68034ab8548ce670eaAlexander Gutkin case $host in 33525b6dc79427b8f7eeb6a7ff68034ab8548ce670eaAlexander Gutkin *cygwin* | *mingw* | *cegcc* ) 33535b6dc79427b8f7eeb6a7ff68034ab8548ce670eaAlexander Gutkin # if an import library, we need to obtain dlname 33545b6dc79427b8f7eeb6a7ff68034ab8548ce670eaAlexander Gutkin if func_win32_import_lib_p "$dlprefile"; then 33555b6dc79427b8f7eeb6a7ff68034ab8548ce670eaAlexander Gutkin func_tr_sh "$dlprefile" 33565b6dc79427b8f7eeb6a7ff68034ab8548ce670eaAlexander Gutkin eval "curr_lafile=\$libfile_$func_tr_sh_result" 33575b6dc79427b8f7eeb6a7ff68034ab8548ce670eaAlexander Gutkin dlprefile_dlbasename="" 33585b6dc79427b8f7eeb6a7ff68034ab8548ce670eaAlexander Gutkin if test -n "$curr_lafile" && func_lalib_p "$curr_lafile"; then 33595b6dc79427b8f7eeb6a7ff68034ab8548ce670eaAlexander Gutkin # Use subshell, to avoid clobbering current variable values 33605b6dc79427b8f7eeb6a7ff68034ab8548ce670eaAlexander Gutkin dlprefile_dlname=`source "$curr_lafile" && echo "$dlname"` 33615b6dc79427b8f7eeb6a7ff68034ab8548ce670eaAlexander Gutkin if test -n "$dlprefile_dlname" ; then 33625b6dc79427b8f7eeb6a7ff68034ab8548ce670eaAlexander Gutkin func_basename "$dlprefile_dlname" 33635b6dc79427b8f7eeb6a7ff68034ab8548ce670eaAlexander Gutkin dlprefile_dlbasename="$func_basename_result" 33645b6dc79427b8f7eeb6a7ff68034ab8548ce670eaAlexander Gutkin else 33655b6dc79427b8f7eeb6a7ff68034ab8548ce670eaAlexander Gutkin # no lafile. user explicitly requested -dlpreopen <import library>. 33665b6dc79427b8f7eeb6a7ff68034ab8548ce670eaAlexander Gutkin $sharedlib_from_linklib_cmd "$dlprefile" 33675b6dc79427b8f7eeb6a7ff68034ab8548ce670eaAlexander Gutkin dlprefile_dlbasename=$sharedlib_from_linklib_result 33685b6dc79427b8f7eeb6a7ff68034ab8548ce670eaAlexander Gutkin fi 33695b6dc79427b8f7eeb6a7ff68034ab8548ce670eaAlexander Gutkin fi 33705b6dc79427b8f7eeb6a7ff68034ab8548ce670eaAlexander Gutkin $opt_dry_run || { 33715b6dc79427b8f7eeb6a7ff68034ab8548ce670eaAlexander Gutkin if test -n "$dlprefile_dlbasename" ; then 33725b6dc79427b8f7eeb6a7ff68034ab8548ce670eaAlexander Gutkin eval '$ECHO ": $dlprefile_dlbasename" >> "$nlist"' 33735b6dc79427b8f7eeb6a7ff68034ab8548ce670eaAlexander Gutkin else 33745b6dc79427b8f7eeb6a7ff68034ab8548ce670eaAlexander Gutkin func_warning "Could not compute DLL name from $name" 33755b6dc79427b8f7eeb6a7ff68034ab8548ce670eaAlexander Gutkin eval '$ECHO ": $name " >> "$nlist"' 33765b6dc79427b8f7eeb6a7ff68034ab8548ce670eaAlexander Gutkin fi 33775b6dc79427b8f7eeb6a7ff68034ab8548ce670eaAlexander Gutkin func_to_tool_file "$dlprefile" func_convert_file_msys_to_w32 33785b6dc79427b8f7eeb6a7ff68034ab8548ce670eaAlexander Gutkin eval "$NM \"$func_to_tool_file_result\" 2>/dev/null | $global_symbol_pipe | 33795b6dc79427b8f7eeb6a7ff68034ab8548ce670eaAlexander Gutkin $SED -e '/I __imp/d' -e 's/I __nm_/D /;s/_nm__//' >> '$nlist'" 33805b6dc79427b8f7eeb6a7ff68034ab8548ce670eaAlexander Gutkin } 33815b6dc79427b8f7eeb6a7ff68034ab8548ce670eaAlexander Gutkin else # not an import lib 33825b6dc79427b8f7eeb6a7ff68034ab8548ce670eaAlexander Gutkin $opt_dry_run || { 33835b6dc79427b8f7eeb6a7ff68034ab8548ce670eaAlexander Gutkin eval '$ECHO ": $name " >> "$nlist"' 33845b6dc79427b8f7eeb6a7ff68034ab8548ce670eaAlexander Gutkin func_to_tool_file "$dlprefile" func_convert_file_msys_to_w32 33855b6dc79427b8f7eeb6a7ff68034ab8548ce670eaAlexander Gutkin eval "$NM \"$func_to_tool_file_result\" 2>/dev/null | $global_symbol_pipe >> '$nlist'" 33865b6dc79427b8f7eeb6a7ff68034ab8548ce670eaAlexander Gutkin } 33875b6dc79427b8f7eeb6a7ff68034ab8548ce670eaAlexander Gutkin fi 33885b6dc79427b8f7eeb6a7ff68034ab8548ce670eaAlexander Gutkin ;; 33895b6dc79427b8f7eeb6a7ff68034ab8548ce670eaAlexander Gutkin *) 33905b6dc79427b8f7eeb6a7ff68034ab8548ce670eaAlexander Gutkin $opt_dry_run || { 33915b6dc79427b8f7eeb6a7ff68034ab8548ce670eaAlexander Gutkin eval '$ECHO ": $name " >> "$nlist"' 33925b6dc79427b8f7eeb6a7ff68034ab8548ce670eaAlexander Gutkin func_to_tool_file "$dlprefile" func_convert_file_msys_to_w32 33935b6dc79427b8f7eeb6a7ff68034ab8548ce670eaAlexander Gutkin eval "$NM \"$func_to_tool_file_result\" 2>/dev/null | $global_symbol_pipe >> '$nlist'" 33945b6dc79427b8f7eeb6a7ff68034ab8548ce670eaAlexander Gutkin } 33955b6dc79427b8f7eeb6a7ff68034ab8548ce670eaAlexander Gutkin ;; 33965b6dc79427b8f7eeb6a7ff68034ab8548ce670eaAlexander Gutkin esac 3397f4c12fce1ee58e670f9c3fce46c40296ba9ee8a2Ian Hodson done 3398f4c12fce1ee58e670f9c3fce46c40296ba9ee8a2Ian Hodson 3399f4c12fce1ee58e670f9c3fce46c40296ba9ee8a2Ian Hodson $opt_dry_run || { 3400f4c12fce1ee58e670f9c3fce46c40296ba9ee8a2Ian Hodson # Make sure we have at least an empty file. 3401f4c12fce1ee58e670f9c3fce46c40296ba9ee8a2Ian Hodson test -f "$nlist" || : > "$nlist" 3402f4c12fce1ee58e670f9c3fce46c40296ba9ee8a2Ian Hodson 3403f4c12fce1ee58e670f9c3fce46c40296ba9ee8a2Ian Hodson if test -n "$exclude_expsyms"; then 3404f4c12fce1ee58e670f9c3fce46c40296ba9ee8a2Ian Hodson $EGREP -v " ($exclude_expsyms)$" "$nlist" > "$nlist"T 3405f4c12fce1ee58e670f9c3fce46c40296ba9ee8a2Ian Hodson $MV "$nlist"T "$nlist" 3406f4c12fce1ee58e670f9c3fce46c40296ba9ee8a2Ian Hodson fi 3407f4c12fce1ee58e670f9c3fce46c40296ba9ee8a2Ian Hodson 3408f4c12fce1ee58e670f9c3fce46c40296ba9ee8a2Ian Hodson # Try sorting and uniquifying the output. 3409f4c12fce1ee58e670f9c3fce46c40296ba9ee8a2Ian Hodson if $GREP -v "^: " < "$nlist" | 3410f4c12fce1ee58e670f9c3fce46c40296ba9ee8a2Ian Hodson if sort -k 3 </dev/null >/dev/null 2>&1; then 3411f4c12fce1ee58e670f9c3fce46c40296ba9ee8a2Ian Hodson sort -k 3 3412f4c12fce1ee58e670f9c3fce46c40296ba9ee8a2Ian Hodson else 3413f4c12fce1ee58e670f9c3fce46c40296ba9ee8a2Ian Hodson sort +2 3414f4c12fce1ee58e670f9c3fce46c40296ba9ee8a2Ian Hodson fi | 3415f4c12fce1ee58e670f9c3fce46c40296ba9ee8a2Ian Hodson uniq > "$nlist"S; then 3416f4c12fce1ee58e670f9c3fce46c40296ba9ee8a2Ian Hodson : 3417f4c12fce1ee58e670f9c3fce46c40296ba9ee8a2Ian Hodson else 3418f4c12fce1ee58e670f9c3fce46c40296ba9ee8a2Ian Hodson $GREP -v "^: " < "$nlist" > "$nlist"S 3419f4c12fce1ee58e670f9c3fce46c40296ba9ee8a2Ian Hodson fi 3420f4c12fce1ee58e670f9c3fce46c40296ba9ee8a2Ian Hodson 3421f4c12fce1ee58e670f9c3fce46c40296ba9ee8a2Ian Hodson if test -f "$nlist"S; then 3422f4c12fce1ee58e670f9c3fce46c40296ba9ee8a2Ian Hodson eval "$global_symbol_to_cdecl"' < "$nlist"S >> "$output_objdir/$my_dlsyms"' 3423f4c12fce1ee58e670f9c3fce46c40296ba9ee8a2Ian Hodson else 34245b6dc79427b8f7eeb6a7ff68034ab8548ce670eaAlexander Gutkin echo '/* NONE */' >> "$output_objdir/$my_dlsyms" 3425f4c12fce1ee58e670f9c3fce46c40296ba9ee8a2Ian Hodson fi 3426f4c12fce1ee58e670f9c3fce46c40296ba9ee8a2Ian Hodson 34275b6dc79427b8f7eeb6a7ff68034ab8548ce670eaAlexander Gutkin echo >> "$output_objdir/$my_dlsyms" "\ 3428f4c12fce1ee58e670f9c3fce46c40296ba9ee8a2Ian Hodson 3429f4c12fce1ee58e670f9c3fce46c40296ba9ee8a2Ian Hodson/* The mapping between symbol names and symbols. */ 3430f4c12fce1ee58e670f9c3fce46c40296ba9ee8a2Ian Hodsontypedef struct { 3431f4c12fce1ee58e670f9c3fce46c40296ba9ee8a2Ian Hodson const char *name; 3432f4c12fce1ee58e670f9c3fce46c40296ba9ee8a2Ian Hodson void *address; 3433f4c12fce1ee58e670f9c3fce46c40296ba9ee8a2Ian Hodson} lt_dlsymlist; 34345b6dc79427b8f7eeb6a7ff68034ab8548ce670eaAlexander Gutkinextern LT_DLSYM_CONST lt_dlsymlist 3435f4c12fce1ee58e670f9c3fce46c40296ba9ee8a2Ian Hodsonlt_${my_prefix}_LTX_preloaded_symbols[]; 34365b6dc79427b8f7eeb6a7ff68034ab8548ce670eaAlexander GutkinLT_DLSYM_CONST lt_dlsymlist 3437f4c12fce1ee58e670f9c3fce46c40296ba9ee8a2Ian Hodsonlt_${my_prefix}_LTX_preloaded_symbols[] = 3438f4c12fce1ee58e670f9c3fce46c40296ba9ee8a2Ian Hodson{\ 3439f4c12fce1ee58e670f9c3fce46c40296ba9ee8a2Ian Hodson { \"$my_originator\", (void *) 0 }," 3440f4c12fce1ee58e670f9c3fce46c40296ba9ee8a2Ian Hodson 3441f4c12fce1ee58e670f9c3fce46c40296ba9ee8a2Ian Hodson case $need_lib_prefix in 3442f4c12fce1ee58e670f9c3fce46c40296ba9ee8a2Ian Hodson no) 3443f4c12fce1ee58e670f9c3fce46c40296ba9ee8a2Ian Hodson eval "$global_symbol_to_c_name_address" < "$nlist" >> "$output_objdir/$my_dlsyms" 3444f4c12fce1ee58e670f9c3fce46c40296ba9ee8a2Ian Hodson ;; 3445f4c12fce1ee58e670f9c3fce46c40296ba9ee8a2Ian Hodson *) 3446f4c12fce1ee58e670f9c3fce46c40296ba9ee8a2Ian Hodson eval "$global_symbol_to_c_name_address_lib_prefix" < "$nlist" >> "$output_objdir/$my_dlsyms" 3447f4c12fce1ee58e670f9c3fce46c40296ba9ee8a2Ian Hodson ;; 3448f4c12fce1ee58e670f9c3fce46c40296ba9ee8a2Ian Hodson esac 34495b6dc79427b8f7eeb6a7ff68034ab8548ce670eaAlexander Gutkin echo >> "$output_objdir/$my_dlsyms" "\ 3450f4c12fce1ee58e670f9c3fce46c40296ba9ee8a2Ian Hodson {0, (void *) 0} 3451f4c12fce1ee58e670f9c3fce46c40296ba9ee8a2Ian Hodson}; 3452f4c12fce1ee58e670f9c3fce46c40296ba9ee8a2Ian Hodson 3453f4c12fce1ee58e670f9c3fce46c40296ba9ee8a2Ian Hodson/* This works around a problem in FreeBSD linker */ 3454f4c12fce1ee58e670f9c3fce46c40296ba9ee8a2Ian Hodson#ifdef FREEBSD_WORKAROUND 3455f4c12fce1ee58e670f9c3fce46c40296ba9ee8a2Ian Hodsonstatic const void *lt_preloaded_setup() { 3456f4c12fce1ee58e670f9c3fce46c40296ba9ee8a2Ian Hodson return lt_${my_prefix}_LTX_preloaded_symbols; 3457f4c12fce1ee58e670f9c3fce46c40296ba9ee8a2Ian Hodson} 3458f4c12fce1ee58e670f9c3fce46c40296ba9ee8a2Ian Hodson#endif 3459f4c12fce1ee58e670f9c3fce46c40296ba9ee8a2Ian Hodson 3460f4c12fce1ee58e670f9c3fce46c40296ba9ee8a2Ian Hodson#ifdef __cplusplus 3461f4c12fce1ee58e670f9c3fce46c40296ba9ee8a2Ian Hodson} 3462f4c12fce1ee58e670f9c3fce46c40296ba9ee8a2Ian Hodson#endif\ 3463f4c12fce1ee58e670f9c3fce46c40296ba9ee8a2Ian Hodson" 3464f4c12fce1ee58e670f9c3fce46c40296ba9ee8a2Ian Hodson } # !$opt_dry_run 3465f4c12fce1ee58e670f9c3fce46c40296ba9ee8a2Ian Hodson 3466f4c12fce1ee58e670f9c3fce46c40296ba9ee8a2Ian Hodson pic_flag_for_symtable= 3467f4c12fce1ee58e670f9c3fce46c40296ba9ee8a2Ian Hodson case "$compile_command " in 3468f4c12fce1ee58e670f9c3fce46c40296ba9ee8a2Ian Hodson *" -static "*) ;; 3469f4c12fce1ee58e670f9c3fce46c40296ba9ee8a2Ian Hodson *) 3470f4c12fce1ee58e670f9c3fce46c40296ba9ee8a2Ian Hodson case $host in 3471f4c12fce1ee58e670f9c3fce46c40296ba9ee8a2Ian Hodson # compiling the symbol table file with pic_flag works around 3472f4c12fce1ee58e670f9c3fce46c40296ba9ee8a2Ian Hodson # a FreeBSD bug that causes programs to crash when -lm is 3473f4c12fce1ee58e670f9c3fce46c40296ba9ee8a2Ian Hodson # linked before any other PIC object. But we must not use 3474f4c12fce1ee58e670f9c3fce46c40296ba9ee8a2Ian Hodson # pic_flag when linking with -static. The problem exists in 3475f4c12fce1ee58e670f9c3fce46c40296ba9ee8a2Ian Hodson # FreeBSD 2.2.6 and is fixed in FreeBSD 3.1. 34765b6dc79427b8f7eeb6a7ff68034ab8548ce670eaAlexander Gutkin *-*-freebsd2.*|*-*-freebsd3.0*|*-*-freebsdelf3.0*) 3477f4c12fce1ee58e670f9c3fce46c40296ba9ee8a2Ian Hodson pic_flag_for_symtable=" $pic_flag -DFREEBSD_WORKAROUND" ;; 3478f4c12fce1ee58e670f9c3fce46c40296ba9ee8a2Ian Hodson *-*-hpux*) 3479f4c12fce1ee58e670f9c3fce46c40296ba9ee8a2Ian Hodson pic_flag_for_symtable=" $pic_flag" ;; 3480f4c12fce1ee58e670f9c3fce46c40296ba9ee8a2Ian Hodson *) 3481f4c12fce1ee58e670f9c3fce46c40296ba9ee8a2Ian Hodson if test "X$my_pic_p" != Xno; then 3482f4c12fce1ee58e670f9c3fce46c40296ba9ee8a2Ian Hodson pic_flag_for_symtable=" $pic_flag" 3483f4c12fce1ee58e670f9c3fce46c40296ba9ee8a2Ian Hodson fi 3484f4c12fce1ee58e670f9c3fce46c40296ba9ee8a2Ian Hodson ;; 3485f4c12fce1ee58e670f9c3fce46c40296ba9ee8a2Ian Hodson esac 3486f4c12fce1ee58e670f9c3fce46c40296ba9ee8a2Ian Hodson ;; 3487f4c12fce1ee58e670f9c3fce46c40296ba9ee8a2Ian Hodson esac 3488f4c12fce1ee58e670f9c3fce46c40296ba9ee8a2Ian Hodson symtab_cflags= 3489f4c12fce1ee58e670f9c3fce46c40296ba9ee8a2Ian Hodson for arg in $LTCFLAGS; do 3490f4c12fce1ee58e670f9c3fce46c40296ba9ee8a2Ian Hodson case $arg in 3491f4c12fce1ee58e670f9c3fce46c40296ba9ee8a2Ian Hodson -pie | -fpie | -fPIE) ;; 34925b6dc79427b8f7eeb6a7ff68034ab8548ce670eaAlexander Gutkin *) func_append symtab_cflags " $arg" ;; 3493f4c12fce1ee58e670f9c3fce46c40296ba9ee8a2Ian Hodson esac 3494f4c12fce1ee58e670f9c3fce46c40296ba9ee8a2Ian Hodson done 3495f4c12fce1ee58e670f9c3fce46c40296ba9ee8a2Ian Hodson 3496f4c12fce1ee58e670f9c3fce46c40296ba9ee8a2Ian Hodson # Now compile the dynamic symbol file. 3497f4c12fce1ee58e670f9c3fce46c40296ba9ee8a2Ian Hodson func_show_eval '(cd $output_objdir && $LTCC$symtab_cflags -c$no_builtin_flag$pic_flag_for_symtable "$my_dlsyms")' 'exit $?' 3498f4c12fce1ee58e670f9c3fce46c40296ba9ee8a2Ian Hodson 3499f4c12fce1ee58e670f9c3fce46c40296ba9ee8a2Ian Hodson # Clean up the generated files. 3500f4c12fce1ee58e670f9c3fce46c40296ba9ee8a2Ian Hodson func_show_eval '$RM "$output_objdir/$my_dlsyms" "$nlist" "${nlist}S" "${nlist}T"' 3501f4c12fce1ee58e670f9c3fce46c40296ba9ee8a2Ian Hodson 3502f4c12fce1ee58e670f9c3fce46c40296ba9ee8a2Ian Hodson # Transform the symbol file into the correct name. 3503f4c12fce1ee58e670f9c3fce46c40296ba9ee8a2Ian Hodson symfileobj="$output_objdir/${my_outputname}S.$objext" 3504f4c12fce1ee58e670f9c3fce46c40296ba9ee8a2Ian Hodson case $host in 3505f4c12fce1ee58e670f9c3fce46c40296ba9ee8a2Ian Hodson *cygwin* | *mingw* | *cegcc* ) 3506f4c12fce1ee58e670f9c3fce46c40296ba9ee8a2Ian Hodson if test -f "$output_objdir/$my_outputname.def"; then 35075b6dc79427b8f7eeb6a7ff68034ab8548ce670eaAlexander Gutkin compile_command=`$ECHO "$compile_command" | $SED "s%@SYMFILE@%$output_objdir/$my_outputname.def $symfileobj%"` 35085b6dc79427b8f7eeb6a7ff68034ab8548ce670eaAlexander Gutkin finalize_command=`$ECHO "$finalize_command" | $SED "s%@SYMFILE@%$output_objdir/$my_outputname.def $symfileobj%"` 3509f4c12fce1ee58e670f9c3fce46c40296ba9ee8a2Ian Hodson else 35105b6dc79427b8f7eeb6a7ff68034ab8548ce670eaAlexander Gutkin compile_command=`$ECHO "$compile_command" | $SED "s%@SYMFILE@%$symfileobj%"` 35115b6dc79427b8f7eeb6a7ff68034ab8548ce670eaAlexander Gutkin finalize_command=`$ECHO "$finalize_command" | $SED "s%@SYMFILE@%$symfileobj%"` 3512f4c12fce1ee58e670f9c3fce46c40296ba9ee8a2Ian Hodson fi 3513f4c12fce1ee58e670f9c3fce46c40296ba9ee8a2Ian Hodson ;; 3514f4c12fce1ee58e670f9c3fce46c40296ba9ee8a2Ian Hodson *) 35155b6dc79427b8f7eeb6a7ff68034ab8548ce670eaAlexander Gutkin compile_command=`$ECHO "$compile_command" | $SED "s%@SYMFILE@%$symfileobj%"` 35165b6dc79427b8f7eeb6a7ff68034ab8548ce670eaAlexander Gutkin finalize_command=`$ECHO "$finalize_command" | $SED "s%@SYMFILE@%$symfileobj%"` 3517f4c12fce1ee58e670f9c3fce46c40296ba9ee8a2Ian Hodson ;; 3518f4c12fce1ee58e670f9c3fce46c40296ba9ee8a2Ian Hodson esac 3519f4c12fce1ee58e670f9c3fce46c40296ba9ee8a2Ian Hodson ;; 3520f4c12fce1ee58e670f9c3fce46c40296ba9ee8a2Ian Hodson *) 3521f4c12fce1ee58e670f9c3fce46c40296ba9ee8a2Ian Hodson func_fatal_error "unknown suffix for \`$my_dlsyms'" 3522f4c12fce1ee58e670f9c3fce46c40296ba9ee8a2Ian Hodson ;; 3523f4c12fce1ee58e670f9c3fce46c40296ba9ee8a2Ian Hodson esac 3524f4c12fce1ee58e670f9c3fce46c40296ba9ee8a2Ian Hodson else 3525f4c12fce1ee58e670f9c3fce46c40296ba9ee8a2Ian Hodson # We keep going just in case the user didn't refer to 3526f4c12fce1ee58e670f9c3fce46c40296ba9ee8a2Ian Hodson # lt_preloaded_symbols. The linker will fail if global_symbol_pipe 3527f4c12fce1ee58e670f9c3fce46c40296ba9ee8a2Ian Hodson # really was required. 3528f4c12fce1ee58e670f9c3fce46c40296ba9ee8a2Ian Hodson 3529f4c12fce1ee58e670f9c3fce46c40296ba9ee8a2Ian Hodson # Nullify the symbol file. 35305b6dc79427b8f7eeb6a7ff68034ab8548ce670eaAlexander Gutkin compile_command=`$ECHO "$compile_command" | $SED "s% @SYMFILE@%%"` 35315b6dc79427b8f7eeb6a7ff68034ab8548ce670eaAlexander Gutkin finalize_command=`$ECHO "$finalize_command" | $SED "s% @SYMFILE@%%"` 3532f4c12fce1ee58e670f9c3fce46c40296ba9ee8a2Ian Hodson fi 3533f4c12fce1ee58e670f9c3fce46c40296ba9ee8a2Ian Hodson} 3534f4c12fce1ee58e670f9c3fce46c40296ba9ee8a2Ian Hodson 3535f4c12fce1ee58e670f9c3fce46c40296ba9ee8a2Ian Hodson# func_win32_libid arg 3536f4c12fce1ee58e670f9c3fce46c40296ba9ee8a2Ian Hodson# return the library type of file 'arg' 3537f4c12fce1ee58e670f9c3fce46c40296ba9ee8a2Ian Hodson# 3538f4c12fce1ee58e670f9c3fce46c40296ba9ee8a2Ian Hodson# Need a lot of goo to handle *both* DLLs and import libs 3539f4c12fce1ee58e670f9c3fce46c40296ba9ee8a2Ian Hodson# Has to be a shell function in order to 'eat' the argument 3540f4c12fce1ee58e670f9c3fce46c40296ba9ee8a2Ian Hodson# that is supplied when $file_magic_command is called. 35415b6dc79427b8f7eeb6a7ff68034ab8548ce670eaAlexander Gutkin# Despite the name, also deal with 64 bit binaries. 3542f4c12fce1ee58e670f9c3fce46c40296ba9ee8a2Ian Hodsonfunc_win32_libid () 3543f4c12fce1ee58e670f9c3fce46c40296ba9ee8a2Ian Hodson{ 3544f4c12fce1ee58e670f9c3fce46c40296ba9ee8a2Ian Hodson $opt_debug 3545f4c12fce1ee58e670f9c3fce46c40296ba9ee8a2Ian Hodson win32_libid_type="unknown" 3546f4c12fce1ee58e670f9c3fce46c40296ba9ee8a2Ian Hodson win32_fileres=`file -L $1 2>/dev/null` 3547f4c12fce1ee58e670f9c3fce46c40296ba9ee8a2Ian Hodson case $win32_fileres in 3548f4c12fce1ee58e670f9c3fce46c40296ba9ee8a2Ian Hodson *ar\ archive\ import\ library*) # definitely import 3549f4c12fce1ee58e670f9c3fce46c40296ba9ee8a2Ian Hodson win32_libid_type="x86 archive import" 3550f4c12fce1ee58e670f9c3fce46c40296ba9ee8a2Ian Hodson ;; 3551f4c12fce1ee58e670f9c3fce46c40296ba9ee8a2Ian Hodson *ar\ archive*) # could be an import, or static 35525b6dc79427b8f7eeb6a7ff68034ab8548ce670eaAlexander Gutkin # Keep the egrep pattern in sync with the one in _LT_CHECK_MAGIC_METHOD. 3553f4c12fce1ee58e670f9c3fce46c40296ba9ee8a2Ian Hodson if eval $OBJDUMP -f $1 | $SED -e '10q' 2>/dev/null | 35545b6dc79427b8f7eeb6a7ff68034ab8548ce670eaAlexander Gutkin $EGREP 'file format (pei*-i386(.*architecture: i386)?|pe-arm-wince|pe-x86-64)' >/dev/null; then 35555b6dc79427b8f7eeb6a7ff68034ab8548ce670eaAlexander Gutkin func_to_tool_file "$1" func_convert_file_msys_to_w32 35565b6dc79427b8f7eeb6a7ff68034ab8548ce670eaAlexander Gutkin win32_nmres=`eval $NM -f posix -A \"$func_to_tool_file_result\" | 3557f4c12fce1ee58e670f9c3fce46c40296ba9ee8a2Ian Hodson $SED -n -e ' 3558f4c12fce1ee58e670f9c3fce46c40296ba9ee8a2Ian Hodson 1,100{ 3559f4c12fce1ee58e670f9c3fce46c40296ba9ee8a2Ian Hodson / I /{ 3560f4c12fce1ee58e670f9c3fce46c40296ba9ee8a2Ian Hodson s,.*,import, 3561f4c12fce1ee58e670f9c3fce46c40296ba9ee8a2Ian Hodson p 3562f4c12fce1ee58e670f9c3fce46c40296ba9ee8a2Ian Hodson q 3563f4c12fce1ee58e670f9c3fce46c40296ba9ee8a2Ian Hodson } 3564f4c12fce1ee58e670f9c3fce46c40296ba9ee8a2Ian Hodson }'` 3565f4c12fce1ee58e670f9c3fce46c40296ba9ee8a2Ian Hodson case $win32_nmres in 3566f4c12fce1ee58e670f9c3fce46c40296ba9ee8a2Ian Hodson import*) win32_libid_type="x86 archive import";; 3567f4c12fce1ee58e670f9c3fce46c40296ba9ee8a2Ian Hodson *) win32_libid_type="x86 archive static";; 3568f4c12fce1ee58e670f9c3fce46c40296ba9ee8a2Ian Hodson esac 3569f4c12fce1ee58e670f9c3fce46c40296ba9ee8a2Ian Hodson fi 3570f4c12fce1ee58e670f9c3fce46c40296ba9ee8a2Ian Hodson ;; 3571f4c12fce1ee58e670f9c3fce46c40296ba9ee8a2Ian Hodson *DLL*) 3572f4c12fce1ee58e670f9c3fce46c40296ba9ee8a2Ian Hodson win32_libid_type="x86 DLL" 3573f4c12fce1ee58e670f9c3fce46c40296ba9ee8a2Ian Hodson ;; 3574f4c12fce1ee58e670f9c3fce46c40296ba9ee8a2Ian Hodson *executable*) # but shell scripts are "executable" too... 3575f4c12fce1ee58e670f9c3fce46c40296ba9ee8a2Ian Hodson case $win32_fileres in 3576f4c12fce1ee58e670f9c3fce46c40296ba9ee8a2Ian Hodson *MS\ Windows\ PE\ Intel*) 3577f4c12fce1ee58e670f9c3fce46c40296ba9ee8a2Ian Hodson win32_libid_type="x86 DLL" 3578f4c12fce1ee58e670f9c3fce46c40296ba9ee8a2Ian Hodson ;; 3579f4c12fce1ee58e670f9c3fce46c40296ba9ee8a2Ian Hodson esac 3580f4c12fce1ee58e670f9c3fce46c40296ba9ee8a2Ian Hodson ;; 3581f4c12fce1ee58e670f9c3fce46c40296ba9ee8a2Ian Hodson esac 3582f4c12fce1ee58e670f9c3fce46c40296ba9ee8a2Ian Hodson $ECHO "$win32_libid_type" 3583f4c12fce1ee58e670f9c3fce46c40296ba9ee8a2Ian Hodson} 3584f4c12fce1ee58e670f9c3fce46c40296ba9ee8a2Ian Hodson 35855b6dc79427b8f7eeb6a7ff68034ab8548ce670eaAlexander Gutkin# func_cygming_dll_for_implib ARG 35865b6dc79427b8f7eeb6a7ff68034ab8548ce670eaAlexander Gutkin# 35875b6dc79427b8f7eeb6a7ff68034ab8548ce670eaAlexander Gutkin# Platform-specific function to extract the 35885b6dc79427b8f7eeb6a7ff68034ab8548ce670eaAlexander Gutkin# name of the DLL associated with the specified 35895b6dc79427b8f7eeb6a7ff68034ab8548ce670eaAlexander Gutkin# import library ARG. 35905b6dc79427b8f7eeb6a7ff68034ab8548ce670eaAlexander Gutkin# Invoked by eval'ing the libtool variable 35915b6dc79427b8f7eeb6a7ff68034ab8548ce670eaAlexander Gutkin# $sharedlib_from_linklib_cmd 35925b6dc79427b8f7eeb6a7ff68034ab8548ce670eaAlexander Gutkin# Result is available in the variable 35935b6dc79427b8f7eeb6a7ff68034ab8548ce670eaAlexander Gutkin# $sharedlib_from_linklib_result 35945b6dc79427b8f7eeb6a7ff68034ab8548ce670eaAlexander Gutkinfunc_cygming_dll_for_implib () 35955b6dc79427b8f7eeb6a7ff68034ab8548ce670eaAlexander Gutkin{ 35965b6dc79427b8f7eeb6a7ff68034ab8548ce670eaAlexander Gutkin $opt_debug 35975b6dc79427b8f7eeb6a7ff68034ab8548ce670eaAlexander Gutkin sharedlib_from_linklib_result=`$DLLTOOL --identify-strict --identify "$1"` 35985b6dc79427b8f7eeb6a7ff68034ab8548ce670eaAlexander Gutkin} 35995b6dc79427b8f7eeb6a7ff68034ab8548ce670eaAlexander Gutkin 36005b6dc79427b8f7eeb6a7ff68034ab8548ce670eaAlexander Gutkin# func_cygming_dll_for_implib_fallback_core SECTION_NAME LIBNAMEs 36015b6dc79427b8f7eeb6a7ff68034ab8548ce670eaAlexander Gutkin# 36025b6dc79427b8f7eeb6a7ff68034ab8548ce670eaAlexander Gutkin# The is the core of a fallback implementation of a 36035b6dc79427b8f7eeb6a7ff68034ab8548ce670eaAlexander Gutkin# platform-specific function to extract the name of the 36045b6dc79427b8f7eeb6a7ff68034ab8548ce670eaAlexander Gutkin# DLL associated with the specified import library LIBNAME. 36055b6dc79427b8f7eeb6a7ff68034ab8548ce670eaAlexander Gutkin# 36065b6dc79427b8f7eeb6a7ff68034ab8548ce670eaAlexander Gutkin# SECTION_NAME is either .idata$6 or .idata$7, depending 36075b6dc79427b8f7eeb6a7ff68034ab8548ce670eaAlexander Gutkin# on the platform and compiler that created the implib. 36085b6dc79427b8f7eeb6a7ff68034ab8548ce670eaAlexander Gutkin# 36095b6dc79427b8f7eeb6a7ff68034ab8548ce670eaAlexander Gutkin# Echos the name of the DLL associated with the 36105b6dc79427b8f7eeb6a7ff68034ab8548ce670eaAlexander Gutkin# specified import library. 36115b6dc79427b8f7eeb6a7ff68034ab8548ce670eaAlexander Gutkinfunc_cygming_dll_for_implib_fallback_core () 36125b6dc79427b8f7eeb6a7ff68034ab8548ce670eaAlexander Gutkin{ 36135b6dc79427b8f7eeb6a7ff68034ab8548ce670eaAlexander Gutkin $opt_debug 36145b6dc79427b8f7eeb6a7ff68034ab8548ce670eaAlexander Gutkin match_literal=`$ECHO "$1" | $SED "$sed_make_literal_regex"` 36155b6dc79427b8f7eeb6a7ff68034ab8548ce670eaAlexander Gutkin $OBJDUMP -s --section "$1" "$2" 2>/dev/null | 36165b6dc79427b8f7eeb6a7ff68034ab8548ce670eaAlexander Gutkin $SED '/^Contents of section '"$match_literal"':/{ 36175b6dc79427b8f7eeb6a7ff68034ab8548ce670eaAlexander Gutkin # Place marker at beginning of archive member dllname section 36185b6dc79427b8f7eeb6a7ff68034ab8548ce670eaAlexander Gutkin s/.*/====MARK====/ 36195b6dc79427b8f7eeb6a7ff68034ab8548ce670eaAlexander Gutkin p 36205b6dc79427b8f7eeb6a7ff68034ab8548ce670eaAlexander Gutkin d 36215b6dc79427b8f7eeb6a7ff68034ab8548ce670eaAlexander Gutkin } 36225b6dc79427b8f7eeb6a7ff68034ab8548ce670eaAlexander Gutkin # These lines can sometimes be longer than 43 characters, but 36235b6dc79427b8f7eeb6a7ff68034ab8548ce670eaAlexander Gutkin # are always uninteresting 36245b6dc79427b8f7eeb6a7ff68034ab8548ce670eaAlexander Gutkin /:[ ]*file format pe[i]\{,1\}-/d 36255b6dc79427b8f7eeb6a7ff68034ab8548ce670eaAlexander Gutkin /^In archive [^:]*:/d 36265b6dc79427b8f7eeb6a7ff68034ab8548ce670eaAlexander Gutkin # Ensure marker is printed 36275b6dc79427b8f7eeb6a7ff68034ab8548ce670eaAlexander Gutkin /^====MARK====/p 36285b6dc79427b8f7eeb6a7ff68034ab8548ce670eaAlexander Gutkin # Remove all lines with less than 43 characters 36295b6dc79427b8f7eeb6a7ff68034ab8548ce670eaAlexander Gutkin /^.\{43\}/!d 36305b6dc79427b8f7eeb6a7ff68034ab8548ce670eaAlexander Gutkin # From remaining lines, remove first 43 characters 36315b6dc79427b8f7eeb6a7ff68034ab8548ce670eaAlexander Gutkin s/^.\{43\}//' | 36325b6dc79427b8f7eeb6a7ff68034ab8548ce670eaAlexander Gutkin $SED -n ' 36335b6dc79427b8f7eeb6a7ff68034ab8548ce670eaAlexander Gutkin # Join marker and all lines until next marker into a single line 36345b6dc79427b8f7eeb6a7ff68034ab8548ce670eaAlexander Gutkin /^====MARK====/ b para 36355b6dc79427b8f7eeb6a7ff68034ab8548ce670eaAlexander Gutkin H 36365b6dc79427b8f7eeb6a7ff68034ab8548ce670eaAlexander Gutkin $ b para 36375b6dc79427b8f7eeb6a7ff68034ab8548ce670eaAlexander Gutkin b 36385b6dc79427b8f7eeb6a7ff68034ab8548ce670eaAlexander Gutkin :para 36395b6dc79427b8f7eeb6a7ff68034ab8548ce670eaAlexander Gutkin x 36405b6dc79427b8f7eeb6a7ff68034ab8548ce670eaAlexander Gutkin s/\n//g 36415b6dc79427b8f7eeb6a7ff68034ab8548ce670eaAlexander Gutkin # Remove the marker 36425b6dc79427b8f7eeb6a7ff68034ab8548ce670eaAlexander Gutkin s/^====MARK====// 36435b6dc79427b8f7eeb6a7ff68034ab8548ce670eaAlexander Gutkin # Remove trailing dots and whitespace 36445b6dc79427b8f7eeb6a7ff68034ab8548ce670eaAlexander Gutkin s/[\. \t]*$// 36455b6dc79427b8f7eeb6a7ff68034ab8548ce670eaAlexander Gutkin # Print 36465b6dc79427b8f7eeb6a7ff68034ab8548ce670eaAlexander Gutkin /./p' | 36475b6dc79427b8f7eeb6a7ff68034ab8548ce670eaAlexander Gutkin # we now have a list, one entry per line, of the stringified 36485b6dc79427b8f7eeb6a7ff68034ab8548ce670eaAlexander Gutkin # contents of the appropriate section of all members of the 36495b6dc79427b8f7eeb6a7ff68034ab8548ce670eaAlexander Gutkin # archive which possess that section. Heuristic: eliminate 36505b6dc79427b8f7eeb6a7ff68034ab8548ce670eaAlexander Gutkin # all those which have a first or second character that is 36515b6dc79427b8f7eeb6a7ff68034ab8548ce670eaAlexander Gutkin # a '.' (that is, objdump's representation of an unprintable 36525b6dc79427b8f7eeb6a7ff68034ab8548ce670eaAlexander Gutkin # character.) This should work for all archives with less than 36535b6dc79427b8f7eeb6a7ff68034ab8548ce670eaAlexander Gutkin # 0x302f exports -- but will fail for DLLs whose name actually 36545b6dc79427b8f7eeb6a7ff68034ab8548ce670eaAlexander Gutkin # begins with a literal '.' or a single character followed by 36555b6dc79427b8f7eeb6a7ff68034ab8548ce670eaAlexander Gutkin # a '.'. 36565b6dc79427b8f7eeb6a7ff68034ab8548ce670eaAlexander Gutkin # 36575b6dc79427b8f7eeb6a7ff68034ab8548ce670eaAlexander Gutkin # Of those that remain, print the first one. 36585b6dc79427b8f7eeb6a7ff68034ab8548ce670eaAlexander Gutkin $SED -e '/^\./d;/^.\./d;q' 36595b6dc79427b8f7eeb6a7ff68034ab8548ce670eaAlexander Gutkin} 36605b6dc79427b8f7eeb6a7ff68034ab8548ce670eaAlexander Gutkin 36615b6dc79427b8f7eeb6a7ff68034ab8548ce670eaAlexander Gutkin# func_cygming_gnu_implib_p ARG 36625b6dc79427b8f7eeb6a7ff68034ab8548ce670eaAlexander Gutkin# This predicate returns with zero status (TRUE) if 36635b6dc79427b8f7eeb6a7ff68034ab8548ce670eaAlexander Gutkin# ARG is a GNU/binutils-style import library. Returns 36645b6dc79427b8f7eeb6a7ff68034ab8548ce670eaAlexander Gutkin# with nonzero status (FALSE) otherwise. 36655b6dc79427b8f7eeb6a7ff68034ab8548ce670eaAlexander Gutkinfunc_cygming_gnu_implib_p () 36665b6dc79427b8f7eeb6a7ff68034ab8548ce670eaAlexander Gutkin{ 36675b6dc79427b8f7eeb6a7ff68034ab8548ce670eaAlexander Gutkin $opt_debug 36685b6dc79427b8f7eeb6a7ff68034ab8548ce670eaAlexander Gutkin func_to_tool_file "$1" func_convert_file_msys_to_w32 36695b6dc79427b8f7eeb6a7ff68034ab8548ce670eaAlexander Gutkin 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)$'` 36705b6dc79427b8f7eeb6a7ff68034ab8548ce670eaAlexander Gutkin test -n "$func_cygming_gnu_implib_tmp" 36715b6dc79427b8f7eeb6a7ff68034ab8548ce670eaAlexander Gutkin} 36725b6dc79427b8f7eeb6a7ff68034ab8548ce670eaAlexander Gutkin 36735b6dc79427b8f7eeb6a7ff68034ab8548ce670eaAlexander Gutkin# func_cygming_ms_implib_p ARG 36745b6dc79427b8f7eeb6a7ff68034ab8548ce670eaAlexander Gutkin# This predicate returns with zero status (TRUE) if 36755b6dc79427b8f7eeb6a7ff68034ab8548ce670eaAlexander Gutkin# ARG is an MS-style import library. Returns 36765b6dc79427b8f7eeb6a7ff68034ab8548ce670eaAlexander Gutkin# with nonzero status (FALSE) otherwise. 36775b6dc79427b8f7eeb6a7ff68034ab8548ce670eaAlexander Gutkinfunc_cygming_ms_implib_p () 36785b6dc79427b8f7eeb6a7ff68034ab8548ce670eaAlexander Gutkin{ 36795b6dc79427b8f7eeb6a7ff68034ab8548ce670eaAlexander Gutkin $opt_debug 36805b6dc79427b8f7eeb6a7ff68034ab8548ce670eaAlexander Gutkin func_to_tool_file "$1" func_convert_file_msys_to_w32 36815b6dc79427b8f7eeb6a7ff68034ab8548ce670eaAlexander Gutkin func_cygming_ms_implib_tmp=`$NM "$func_to_tool_file_result" | eval "$global_symbol_pipe" | $GREP '_NULL_IMPORT_DESCRIPTOR'` 36825b6dc79427b8f7eeb6a7ff68034ab8548ce670eaAlexander Gutkin test -n "$func_cygming_ms_implib_tmp" 36835b6dc79427b8f7eeb6a7ff68034ab8548ce670eaAlexander Gutkin} 36845b6dc79427b8f7eeb6a7ff68034ab8548ce670eaAlexander Gutkin 36855b6dc79427b8f7eeb6a7ff68034ab8548ce670eaAlexander Gutkin# func_cygming_dll_for_implib_fallback ARG 36865b6dc79427b8f7eeb6a7ff68034ab8548ce670eaAlexander Gutkin# Platform-specific function to extract the 36875b6dc79427b8f7eeb6a7ff68034ab8548ce670eaAlexander Gutkin# name of the DLL associated with the specified 36885b6dc79427b8f7eeb6a7ff68034ab8548ce670eaAlexander Gutkin# import library ARG. 36895b6dc79427b8f7eeb6a7ff68034ab8548ce670eaAlexander Gutkin# 36905b6dc79427b8f7eeb6a7ff68034ab8548ce670eaAlexander Gutkin# This fallback implementation is for use when $DLLTOOL 36915b6dc79427b8f7eeb6a7ff68034ab8548ce670eaAlexander Gutkin# does not support the --identify-strict option. 36925b6dc79427b8f7eeb6a7ff68034ab8548ce670eaAlexander Gutkin# Invoked by eval'ing the libtool variable 36935b6dc79427b8f7eeb6a7ff68034ab8548ce670eaAlexander Gutkin# $sharedlib_from_linklib_cmd 36945b6dc79427b8f7eeb6a7ff68034ab8548ce670eaAlexander Gutkin# Result is available in the variable 36955b6dc79427b8f7eeb6a7ff68034ab8548ce670eaAlexander Gutkin# $sharedlib_from_linklib_result 36965b6dc79427b8f7eeb6a7ff68034ab8548ce670eaAlexander Gutkinfunc_cygming_dll_for_implib_fallback () 36975b6dc79427b8f7eeb6a7ff68034ab8548ce670eaAlexander Gutkin{ 36985b6dc79427b8f7eeb6a7ff68034ab8548ce670eaAlexander Gutkin $opt_debug 36995b6dc79427b8f7eeb6a7ff68034ab8548ce670eaAlexander Gutkin if func_cygming_gnu_implib_p "$1" ; then 37005b6dc79427b8f7eeb6a7ff68034ab8548ce670eaAlexander Gutkin # binutils import library 37015b6dc79427b8f7eeb6a7ff68034ab8548ce670eaAlexander Gutkin sharedlib_from_linklib_result=`func_cygming_dll_for_implib_fallback_core '.idata$7' "$1"` 37025b6dc79427b8f7eeb6a7ff68034ab8548ce670eaAlexander Gutkin elif func_cygming_ms_implib_p "$1" ; then 37035b6dc79427b8f7eeb6a7ff68034ab8548ce670eaAlexander Gutkin # ms-generated import library 37045b6dc79427b8f7eeb6a7ff68034ab8548ce670eaAlexander Gutkin sharedlib_from_linklib_result=`func_cygming_dll_for_implib_fallback_core '.idata$6' "$1"` 37055b6dc79427b8f7eeb6a7ff68034ab8548ce670eaAlexander Gutkin else 37065b6dc79427b8f7eeb6a7ff68034ab8548ce670eaAlexander Gutkin # unknown 37075b6dc79427b8f7eeb6a7ff68034ab8548ce670eaAlexander Gutkin sharedlib_from_linklib_result="" 37085b6dc79427b8f7eeb6a7ff68034ab8548ce670eaAlexander Gutkin fi 37095b6dc79427b8f7eeb6a7ff68034ab8548ce670eaAlexander Gutkin} 3710f4c12fce1ee58e670f9c3fce46c40296ba9ee8a2Ian Hodson 3711f4c12fce1ee58e670f9c3fce46c40296ba9ee8a2Ian Hodson 3712f4c12fce1ee58e670f9c3fce46c40296ba9ee8a2Ian Hodson# func_extract_an_archive dir oldlib 3713f4c12fce1ee58e670f9c3fce46c40296ba9ee8a2Ian Hodsonfunc_extract_an_archive () 3714f4c12fce1ee58e670f9c3fce46c40296ba9ee8a2Ian Hodson{ 3715f4c12fce1ee58e670f9c3fce46c40296ba9ee8a2Ian Hodson $opt_debug 3716f4c12fce1ee58e670f9c3fce46c40296ba9ee8a2Ian Hodson f_ex_an_ar_dir="$1"; shift 3717f4c12fce1ee58e670f9c3fce46c40296ba9ee8a2Ian Hodson f_ex_an_ar_oldlib="$1" 37185b6dc79427b8f7eeb6a7ff68034ab8548ce670eaAlexander Gutkin if test "$lock_old_archive_extraction" = yes; then 37195b6dc79427b8f7eeb6a7ff68034ab8548ce670eaAlexander Gutkin lockfile=$f_ex_an_ar_oldlib.lock 37205b6dc79427b8f7eeb6a7ff68034ab8548ce670eaAlexander Gutkin until $opt_dry_run || ln "$progpath" "$lockfile" 2>/dev/null; do 37215b6dc79427b8f7eeb6a7ff68034ab8548ce670eaAlexander Gutkin func_echo "Waiting for $lockfile to be removed" 37225b6dc79427b8f7eeb6a7ff68034ab8548ce670eaAlexander Gutkin sleep 2 37235b6dc79427b8f7eeb6a7ff68034ab8548ce670eaAlexander Gutkin done 37245b6dc79427b8f7eeb6a7ff68034ab8548ce670eaAlexander Gutkin fi 37255b6dc79427b8f7eeb6a7ff68034ab8548ce670eaAlexander Gutkin func_show_eval "(cd \$f_ex_an_ar_dir && $AR x \"\$f_ex_an_ar_oldlib\")" \ 37265b6dc79427b8f7eeb6a7ff68034ab8548ce670eaAlexander Gutkin 'stat=$?; rm -f "$lockfile"; exit $stat' 37275b6dc79427b8f7eeb6a7ff68034ab8548ce670eaAlexander Gutkin if test "$lock_old_archive_extraction" = yes; then 37285b6dc79427b8f7eeb6a7ff68034ab8548ce670eaAlexander Gutkin $opt_dry_run || rm -f "$lockfile" 37295b6dc79427b8f7eeb6a7ff68034ab8548ce670eaAlexander Gutkin fi 3730f4c12fce1ee58e670f9c3fce46c40296ba9ee8a2Ian Hodson if ($AR t "$f_ex_an_ar_oldlib" | sort | sort -uc >/dev/null 2>&1); then 3731f4c12fce1ee58e670f9c3fce46c40296ba9ee8a2Ian Hodson : 3732f4c12fce1ee58e670f9c3fce46c40296ba9ee8a2Ian Hodson else 3733f4c12fce1ee58e670f9c3fce46c40296ba9ee8a2Ian Hodson func_fatal_error "object name conflicts in archive: $f_ex_an_ar_dir/$f_ex_an_ar_oldlib" 3734f4c12fce1ee58e670f9c3fce46c40296ba9ee8a2Ian Hodson fi 3735f4c12fce1ee58e670f9c3fce46c40296ba9ee8a2Ian Hodson} 3736f4c12fce1ee58e670f9c3fce46c40296ba9ee8a2Ian Hodson 3737f4c12fce1ee58e670f9c3fce46c40296ba9ee8a2Ian Hodson 3738f4c12fce1ee58e670f9c3fce46c40296ba9ee8a2Ian Hodson# func_extract_archives gentop oldlib ... 3739f4c12fce1ee58e670f9c3fce46c40296ba9ee8a2Ian Hodsonfunc_extract_archives () 3740f4c12fce1ee58e670f9c3fce46c40296ba9ee8a2Ian Hodson{ 3741f4c12fce1ee58e670f9c3fce46c40296ba9ee8a2Ian Hodson $opt_debug 3742f4c12fce1ee58e670f9c3fce46c40296ba9ee8a2Ian Hodson my_gentop="$1"; shift 3743f4c12fce1ee58e670f9c3fce46c40296ba9ee8a2Ian Hodson my_oldlibs=${1+"$@"} 3744f4c12fce1ee58e670f9c3fce46c40296ba9ee8a2Ian Hodson my_oldobjs="" 3745f4c12fce1ee58e670f9c3fce46c40296ba9ee8a2Ian Hodson my_xlib="" 3746f4c12fce1ee58e670f9c3fce46c40296ba9ee8a2Ian Hodson my_xabs="" 3747f4c12fce1ee58e670f9c3fce46c40296ba9ee8a2Ian Hodson my_xdir="" 3748f4c12fce1ee58e670f9c3fce46c40296ba9ee8a2Ian Hodson 3749f4c12fce1ee58e670f9c3fce46c40296ba9ee8a2Ian Hodson for my_xlib in $my_oldlibs; do 3750f4c12fce1ee58e670f9c3fce46c40296ba9ee8a2Ian Hodson # Extract the objects. 3751f4c12fce1ee58e670f9c3fce46c40296ba9ee8a2Ian Hodson case $my_xlib in 3752f4c12fce1ee58e670f9c3fce46c40296ba9ee8a2Ian Hodson [\\/]* | [A-Za-z]:[\\/]*) my_xabs="$my_xlib" ;; 3753f4c12fce1ee58e670f9c3fce46c40296ba9ee8a2Ian Hodson *) my_xabs=`pwd`"/$my_xlib" ;; 3754f4c12fce1ee58e670f9c3fce46c40296ba9ee8a2Ian Hodson esac 3755f4c12fce1ee58e670f9c3fce46c40296ba9ee8a2Ian Hodson func_basename "$my_xlib" 3756f4c12fce1ee58e670f9c3fce46c40296ba9ee8a2Ian Hodson my_xlib="$func_basename_result" 3757f4c12fce1ee58e670f9c3fce46c40296ba9ee8a2Ian Hodson my_xlib_u=$my_xlib 3758f4c12fce1ee58e670f9c3fce46c40296ba9ee8a2Ian Hodson while :; do 3759f4c12fce1ee58e670f9c3fce46c40296ba9ee8a2Ian Hodson case " $extracted_archives " in 3760f4c12fce1ee58e670f9c3fce46c40296ba9ee8a2Ian Hodson *" $my_xlib_u "*) 3761f4c12fce1ee58e670f9c3fce46c40296ba9ee8a2Ian Hodson func_arith $extracted_serial + 1 3762f4c12fce1ee58e670f9c3fce46c40296ba9ee8a2Ian Hodson extracted_serial=$func_arith_result 3763f4c12fce1ee58e670f9c3fce46c40296ba9ee8a2Ian Hodson my_xlib_u=lt$extracted_serial-$my_xlib ;; 3764f4c12fce1ee58e670f9c3fce46c40296ba9ee8a2Ian Hodson *) break ;; 3765f4c12fce1ee58e670f9c3fce46c40296ba9ee8a2Ian Hodson esac 3766f4c12fce1ee58e670f9c3fce46c40296ba9ee8a2Ian Hodson done 3767f4c12fce1ee58e670f9c3fce46c40296ba9ee8a2Ian Hodson extracted_archives="$extracted_archives $my_xlib_u" 3768f4c12fce1ee58e670f9c3fce46c40296ba9ee8a2Ian Hodson my_xdir="$my_gentop/$my_xlib_u" 3769f4c12fce1ee58e670f9c3fce46c40296ba9ee8a2Ian Hodson 3770f4c12fce1ee58e670f9c3fce46c40296ba9ee8a2Ian Hodson func_mkdir_p "$my_xdir" 3771f4c12fce1ee58e670f9c3fce46c40296ba9ee8a2Ian Hodson 3772f4c12fce1ee58e670f9c3fce46c40296ba9ee8a2Ian Hodson case $host in 3773f4c12fce1ee58e670f9c3fce46c40296ba9ee8a2Ian Hodson *-darwin*) 3774f4c12fce1ee58e670f9c3fce46c40296ba9ee8a2Ian Hodson func_verbose "Extracting $my_xabs" 3775f4c12fce1ee58e670f9c3fce46c40296ba9ee8a2Ian Hodson # Do not bother doing anything if just a dry run 3776f4c12fce1ee58e670f9c3fce46c40296ba9ee8a2Ian Hodson $opt_dry_run || { 3777f4c12fce1ee58e670f9c3fce46c40296ba9ee8a2Ian Hodson darwin_orig_dir=`pwd` 3778f4c12fce1ee58e670f9c3fce46c40296ba9ee8a2Ian Hodson cd $my_xdir || exit $? 3779f4c12fce1ee58e670f9c3fce46c40296ba9ee8a2Ian Hodson darwin_archive=$my_xabs 3780f4c12fce1ee58e670f9c3fce46c40296ba9ee8a2Ian Hodson darwin_curdir=`pwd` 3781f4c12fce1ee58e670f9c3fce46c40296ba9ee8a2Ian Hodson darwin_base_archive=`basename "$darwin_archive"` 3782f4c12fce1ee58e670f9c3fce46c40296ba9ee8a2Ian Hodson darwin_arches=`$LIPO -info "$darwin_archive" 2>/dev/null | $GREP Architectures 2>/dev/null || true` 3783f4c12fce1ee58e670f9c3fce46c40296ba9ee8a2Ian Hodson if test -n "$darwin_arches"; then 3784f4c12fce1ee58e670f9c3fce46c40296ba9ee8a2Ian Hodson darwin_arches=`$ECHO "$darwin_arches" | $SED -e 's/.*are://'` 3785f4c12fce1ee58e670f9c3fce46c40296ba9ee8a2Ian Hodson darwin_arch= 3786f4c12fce1ee58e670f9c3fce46c40296ba9ee8a2Ian Hodson func_verbose "$darwin_base_archive has multiple architectures $darwin_arches" 3787f4c12fce1ee58e670f9c3fce46c40296ba9ee8a2Ian Hodson for darwin_arch in $darwin_arches ; do 3788f4c12fce1ee58e670f9c3fce46c40296ba9ee8a2Ian Hodson func_mkdir_p "unfat-$$/${darwin_base_archive}-${darwin_arch}" 3789f4c12fce1ee58e670f9c3fce46c40296ba9ee8a2Ian Hodson $LIPO -thin $darwin_arch -output "unfat-$$/${darwin_base_archive}-${darwin_arch}/${darwin_base_archive}" "${darwin_archive}" 3790f4c12fce1ee58e670f9c3fce46c40296ba9ee8a2Ian Hodson cd "unfat-$$/${darwin_base_archive}-${darwin_arch}" 3791f4c12fce1ee58e670f9c3fce46c40296ba9ee8a2Ian Hodson func_extract_an_archive "`pwd`" "${darwin_base_archive}" 3792f4c12fce1ee58e670f9c3fce46c40296ba9ee8a2Ian Hodson cd "$darwin_curdir" 3793f4c12fce1ee58e670f9c3fce46c40296ba9ee8a2Ian Hodson $RM "unfat-$$/${darwin_base_archive}-${darwin_arch}/${darwin_base_archive}" 3794f4c12fce1ee58e670f9c3fce46c40296ba9ee8a2Ian Hodson done # $darwin_arches 3795f4c12fce1ee58e670f9c3fce46c40296ba9ee8a2Ian Hodson ## Okay now we've a bunch of thin objects, gotta fatten them up :) 3796f4c12fce1ee58e670f9c3fce46c40296ba9ee8a2Ian Hodson darwin_filelist=`find unfat-$$ -type f -name \*.o -print -o -name \*.lo -print | $SED -e "$basename" | sort -u` 3797f4c12fce1ee58e670f9c3fce46c40296ba9ee8a2Ian Hodson darwin_file= 3798f4c12fce1ee58e670f9c3fce46c40296ba9ee8a2Ian Hodson darwin_files= 3799f4c12fce1ee58e670f9c3fce46c40296ba9ee8a2Ian Hodson for darwin_file in $darwin_filelist; do 38005b6dc79427b8f7eeb6a7ff68034ab8548ce670eaAlexander Gutkin darwin_files=`find unfat-$$ -name $darwin_file -print | sort | $NL2SP` 3801f4c12fce1ee58e670f9c3fce46c40296ba9ee8a2Ian Hodson $LIPO -create -output "$darwin_file" $darwin_files 3802f4c12fce1ee58e670f9c3fce46c40296ba9ee8a2Ian Hodson done # $darwin_filelist 3803f4c12fce1ee58e670f9c3fce46c40296ba9ee8a2Ian Hodson $RM -rf unfat-$$ 3804f4c12fce1ee58e670f9c3fce46c40296ba9ee8a2Ian Hodson cd "$darwin_orig_dir" 3805f4c12fce1ee58e670f9c3fce46c40296ba9ee8a2Ian Hodson else 3806f4c12fce1ee58e670f9c3fce46c40296ba9ee8a2Ian Hodson cd $darwin_orig_dir 3807f4c12fce1ee58e670f9c3fce46c40296ba9ee8a2Ian Hodson func_extract_an_archive "$my_xdir" "$my_xabs" 3808f4c12fce1ee58e670f9c3fce46c40296ba9ee8a2Ian Hodson fi # $darwin_arches 3809f4c12fce1ee58e670f9c3fce46c40296ba9ee8a2Ian Hodson } # !$opt_dry_run 3810f4c12fce1ee58e670f9c3fce46c40296ba9ee8a2Ian Hodson ;; 3811f4c12fce1ee58e670f9c3fce46c40296ba9ee8a2Ian Hodson *) 3812f4c12fce1ee58e670f9c3fce46c40296ba9ee8a2Ian Hodson func_extract_an_archive "$my_xdir" "$my_xabs" 3813f4c12fce1ee58e670f9c3fce46c40296ba9ee8a2Ian Hodson ;; 3814f4c12fce1ee58e670f9c3fce46c40296ba9ee8a2Ian Hodson esac 38155b6dc79427b8f7eeb6a7ff68034ab8548ce670eaAlexander Gutkin my_oldobjs="$my_oldobjs "`find $my_xdir -name \*.$objext -print -o -name \*.lo -print | sort | $NL2SP` 3816f4c12fce1ee58e670f9c3fce46c40296ba9ee8a2Ian Hodson done 3817f4c12fce1ee58e670f9c3fce46c40296ba9ee8a2Ian Hodson 3818f4c12fce1ee58e670f9c3fce46c40296ba9ee8a2Ian Hodson func_extract_archives_result="$my_oldobjs" 3819f4c12fce1ee58e670f9c3fce46c40296ba9ee8a2Ian Hodson} 3820f4c12fce1ee58e670f9c3fce46c40296ba9ee8a2Ian Hodson 3821f4c12fce1ee58e670f9c3fce46c40296ba9ee8a2Ian Hodson 38225b6dc79427b8f7eeb6a7ff68034ab8548ce670eaAlexander Gutkin# func_emit_wrapper [arg=no] 38235b6dc79427b8f7eeb6a7ff68034ab8548ce670eaAlexander Gutkin# 38245b6dc79427b8f7eeb6a7ff68034ab8548ce670eaAlexander Gutkin# Emit a libtool wrapper script on stdout. 38255b6dc79427b8f7eeb6a7ff68034ab8548ce670eaAlexander Gutkin# Don't directly open a file because we may want to 38265b6dc79427b8f7eeb6a7ff68034ab8548ce670eaAlexander Gutkin# incorporate the script contents within a cygwin/mingw 38275b6dc79427b8f7eeb6a7ff68034ab8548ce670eaAlexander Gutkin# wrapper executable. Must ONLY be called from within 38285b6dc79427b8f7eeb6a7ff68034ab8548ce670eaAlexander Gutkin# func_mode_link because it depends on a number of variables 38295b6dc79427b8f7eeb6a7ff68034ab8548ce670eaAlexander Gutkin# set therein. 3830f4c12fce1ee58e670f9c3fce46c40296ba9ee8a2Ian Hodson# 38315b6dc79427b8f7eeb6a7ff68034ab8548ce670eaAlexander Gutkin# ARG is the value that the WRAPPER_SCRIPT_BELONGS_IN_OBJDIR 38325b6dc79427b8f7eeb6a7ff68034ab8548ce670eaAlexander Gutkin# variable will take. If 'yes', then the emitted script 38335b6dc79427b8f7eeb6a7ff68034ab8548ce670eaAlexander Gutkin# will assume that the directory in which it is stored is 38345b6dc79427b8f7eeb6a7ff68034ab8548ce670eaAlexander Gutkin# the $objdir directory. This is a cygwin/mingw-specific 38355b6dc79427b8f7eeb6a7ff68034ab8548ce670eaAlexander Gutkin# behavior. 38365b6dc79427b8f7eeb6a7ff68034ab8548ce670eaAlexander Gutkinfunc_emit_wrapper () 3837f4c12fce1ee58e670f9c3fce46c40296ba9ee8a2Ian Hodson{ 38385b6dc79427b8f7eeb6a7ff68034ab8548ce670eaAlexander Gutkin func_emit_wrapper_arg1=${1-no} 3839f4c12fce1ee58e670f9c3fce46c40296ba9ee8a2Ian Hodson 3840f4c12fce1ee58e670f9c3fce46c40296ba9ee8a2Ian Hodson $ECHO "\ 3841f4c12fce1ee58e670f9c3fce46c40296ba9ee8a2Ian Hodson#! $SHELL 3842f4c12fce1ee58e670f9c3fce46c40296ba9ee8a2Ian Hodson 3843f4c12fce1ee58e670f9c3fce46c40296ba9ee8a2Ian Hodson# $output - temporary wrapper script for $objdir/$outputname 3844f4c12fce1ee58e670f9c3fce46c40296ba9ee8a2Ian Hodson# Generated by $PROGRAM (GNU $PACKAGE$TIMESTAMP) $VERSION 3845f4c12fce1ee58e670f9c3fce46c40296ba9ee8a2Ian Hodson# 3846f4c12fce1ee58e670f9c3fce46c40296ba9ee8a2Ian Hodson# The $output program cannot be directly executed until all the libtool 3847f4c12fce1ee58e670f9c3fce46c40296ba9ee8a2Ian Hodson# libraries that it depends on are installed. 3848f4c12fce1ee58e670f9c3fce46c40296ba9ee8a2Ian Hodson# 3849f4c12fce1ee58e670f9c3fce46c40296ba9ee8a2Ian Hodson# This wrapper script should never be moved out of the build directory. 3850f4c12fce1ee58e670f9c3fce46c40296ba9ee8a2Ian Hodson# If it is, it will not operate correctly. 3851f4c12fce1ee58e670f9c3fce46c40296ba9ee8a2Ian Hodson 3852f4c12fce1ee58e670f9c3fce46c40296ba9ee8a2Ian Hodson# Sed substitution that helps us do robust quoting. It backslashifies 3853f4c12fce1ee58e670f9c3fce46c40296ba9ee8a2Ian Hodson# metacharacters that are still active within double-quoted strings. 3854f4c12fce1ee58e670f9c3fce46c40296ba9ee8a2Ian Hodsonsed_quote_subst='$sed_quote_subst' 3855f4c12fce1ee58e670f9c3fce46c40296ba9ee8a2Ian Hodson 3856f4c12fce1ee58e670f9c3fce46c40296ba9ee8a2Ian Hodson# Be Bourne compatible 3857f4c12fce1ee58e670f9c3fce46c40296ba9ee8a2Ian Hodsonif test -n \"\${ZSH_VERSION+set}\" && (emulate sh) >/dev/null 2>&1; then 3858f4c12fce1ee58e670f9c3fce46c40296ba9ee8a2Ian Hodson emulate sh 3859f4c12fce1ee58e670f9c3fce46c40296ba9ee8a2Ian Hodson NULLCMD=: 3860f4c12fce1ee58e670f9c3fce46c40296ba9ee8a2Ian Hodson # Zsh 3.x and 4.x performs word splitting on \${1+\"\$@\"}, which 3861f4c12fce1ee58e670f9c3fce46c40296ba9ee8a2Ian Hodson # is contrary to our usage. Disable this feature. 3862f4c12fce1ee58e670f9c3fce46c40296ba9ee8a2Ian Hodson alias -g '\${1+\"\$@\"}'='\"\$@\"' 3863f4c12fce1ee58e670f9c3fce46c40296ba9ee8a2Ian Hodson setopt NO_GLOB_SUBST 3864f4c12fce1ee58e670f9c3fce46c40296ba9ee8a2Ian Hodsonelse 3865f4c12fce1ee58e670f9c3fce46c40296ba9ee8a2Ian Hodson case \`(set -o) 2>/dev/null\` in *posix*) set -o posix;; esac 3866f4c12fce1ee58e670f9c3fce46c40296ba9ee8a2Ian Hodsonfi 3867f4c12fce1ee58e670f9c3fce46c40296ba9ee8a2Ian HodsonBIN_SH=xpg4; export BIN_SH # for Tru64 3868f4c12fce1ee58e670f9c3fce46c40296ba9ee8a2Ian HodsonDUALCASE=1; export DUALCASE # for MKS sh 3869f4c12fce1ee58e670f9c3fce46c40296ba9ee8a2Ian Hodson 3870f4c12fce1ee58e670f9c3fce46c40296ba9ee8a2Ian Hodson# The HP-UX ksh and POSIX shell print the target directory to stdout 3871f4c12fce1ee58e670f9c3fce46c40296ba9ee8a2Ian Hodson# if CDPATH is set. 3872f4c12fce1ee58e670f9c3fce46c40296ba9ee8a2Ian Hodson(unset CDPATH) >/dev/null 2>&1 && unset CDPATH 3873f4c12fce1ee58e670f9c3fce46c40296ba9ee8a2Ian Hodson 3874f4c12fce1ee58e670f9c3fce46c40296ba9ee8a2Ian Hodsonrelink_command=\"$relink_command\" 3875f4c12fce1ee58e670f9c3fce46c40296ba9ee8a2Ian Hodson 3876f4c12fce1ee58e670f9c3fce46c40296ba9ee8a2Ian Hodson# This environment variable determines our operation mode. 3877f4c12fce1ee58e670f9c3fce46c40296ba9ee8a2Ian Hodsonif test \"\$libtool_install_magic\" = \"$magic\"; then 3878f4c12fce1ee58e670f9c3fce46c40296ba9ee8a2Ian Hodson # install mode needs the following variables: 3879f4c12fce1ee58e670f9c3fce46c40296ba9ee8a2Ian Hodson generated_by_libtool_version='$macro_version' 3880f4c12fce1ee58e670f9c3fce46c40296ba9ee8a2Ian Hodson notinst_deplibs='$notinst_deplibs' 3881f4c12fce1ee58e670f9c3fce46c40296ba9ee8a2Ian Hodsonelse 3882f4c12fce1ee58e670f9c3fce46c40296ba9ee8a2Ian Hodson # When we are sourced in execute mode, \$file and \$ECHO are already set. 3883f4c12fce1ee58e670f9c3fce46c40296ba9ee8a2Ian Hodson if test \"\$libtool_execute_magic\" != \"$magic\"; then 38845b6dc79427b8f7eeb6a7ff68034ab8548ce670eaAlexander Gutkin file=\"\$0\"" 38855b6dc79427b8f7eeb6a7ff68034ab8548ce670eaAlexander Gutkin 38865b6dc79427b8f7eeb6a7ff68034ab8548ce670eaAlexander Gutkin qECHO=`$ECHO "$ECHO" | $SED "$sed_quote_subst"` 38875b6dc79427b8f7eeb6a7ff68034ab8548ce670eaAlexander Gutkin $ECHO "\ 38885b6dc79427b8f7eeb6a7ff68034ab8548ce670eaAlexander Gutkin 38895b6dc79427b8f7eeb6a7ff68034ab8548ce670eaAlexander Gutkin# A function that is used when there is no print builtin or printf. 38905b6dc79427b8f7eeb6a7ff68034ab8548ce670eaAlexander Gutkinfunc_fallback_echo () 38915b6dc79427b8f7eeb6a7ff68034ab8548ce670eaAlexander Gutkin{ 38925b6dc79427b8f7eeb6a7ff68034ab8548ce670eaAlexander Gutkin eval 'cat <<_LTECHO_EOF 38935b6dc79427b8f7eeb6a7ff68034ab8548ce670eaAlexander Gutkin\$1 38945b6dc79427b8f7eeb6a7ff68034ab8548ce670eaAlexander Gutkin_LTECHO_EOF' 38955b6dc79427b8f7eeb6a7ff68034ab8548ce670eaAlexander Gutkin} 38965b6dc79427b8f7eeb6a7ff68034ab8548ce670eaAlexander Gutkin ECHO=\"$qECHO\" 38975b6dc79427b8f7eeb6a7ff68034ab8548ce670eaAlexander Gutkin fi 38985b6dc79427b8f7eeb6a7ff68034ab8548ce670eaAlexander Gutkin 38995b6dc79427b8f7eeb6a7ff68034ab8548ce670eaAlexander Gutkin# Very basic option parsing. These options are (a) specific to 39005b6dc79427b8f7eeb6a7ff68034ab8548ce670eaAlexander Gutkin# the libtool wrapper, (b) are identical between the wrapper 39015b6dc79427b8f7eeb6a7ff68034ab8548ce670eaAlexander Gutkin# /script/ and the wrapper /executable/ which is used only on 39025b6dc79427b8f7eeb6a7ff68034ab8548ce670eaAlexander Gutkin# windows platforms, and (c) all begin with the string "--lt-" 39035b6dc79427b8f7eeb6a7ff68034ab8548ce670eaAlexander Gutkin# (application programs are unlikely to have options which match 39045b6dc79427b8f7eeb6a7ff68034ab8548ce670eaAlexander Gutkin# this pattern). 39055b6dc79427b8f7eeb6a7ff68034ab8548ce670eaAlexander Gutkin# 39065b6dc79427b8f7eeb6a7ff68034ab8548ce670eaAlexander Gutkin# There are only two supported options: --lt-debug and 39075b6dc79427b8f7eeb6a7ff68034ab8548ce670eaAlexander Gutkin# --lt-dump-script. There is, deliberately, no --lt-help. 39085b6dc79427b8f7eeb6a7ff68034ab8548ce670eaAlexander Gutkin# 39095b6dc79427b8f7eeb6a7ff68034ab8548ce670eaAlexander Gutkin# The first argument to this parsing function should be the 39105b6dc79427b8f7eeb6a7ff68034ab8548ce670eaAlexander Gutkin# script's $0 value, followed by "$@". 39115b6dc79427b8f7eeb6a7ff68034ab8548ce670eaAlexander Gutkinlt_option_debug= 39125b6dc79427b8f7eeb6a7ff68034ab8548ce670eaAlexander Gutkinfunc_parse_lt_options () 39135b6dc79427b8f7eeb6a7ff68034ab8548ce670eaAlexander Gutkin{ 39145b6dc79427b8f7eeb6a7ff68034ab8548ce670eaAlexander Gutkin lt_script_arg0=\$0 39155b6dc79427b8f7eeb6a7ff68034ab8548ce670eaAlexander Gutkin shift 39165b6dc79427b8f7eeb6a7ff68034ab8548ce670eaAlexander Gutkin for lt_opt 39175b6dc79427b8f7eeb6a7ff68034ab8548ce670eaAlexander Gutkin do 39185b6dc79427b8f7eeb6a7ff68034ab8548ce670eaAlexander Gutkin case \"\$lt_opt\" in 39195b6dc79427b8f7eeb6a7ff68034ab8548ce670eaAlexander Gutkin --lt-debug) lt_option_debug=1 ;; 39205b6dc79427b8f7eeb6a7ff68034ab8548ce670eaAlexander Gutkin --lt-dump-script) 39215b6dc79427b8f7eeb6a7ff68034ab8548ce670eaAlexander Gutkin lt_dump_D=\`\$ECHO \"X\$lt_script_arg0\" | $SED -e 's/^X//' -e 's%/[^/]*$%%'\` 39225b6dc79427b8f7eeb6a7ff68034ab8548ce670eaAlexander Gutkin test \"X\$lt_dump_D\" = \"X\$lt_script_arg0\" && lt_dump_D=. 39235b6dc79427b8f7eeb6a7ff68034ab8548ce670eaAlexander Gutkin lt_dump_F=\`\$ECHO \"X\$lt_script_arg0\" | $SED -e 's/^X//' -e 's%^.*/%%'\` 39245b6dc79427b8f7eeb6a7ff68034ab8548ce670eaAlexander Gutkin cat \"\$lt_dump_D/\$lt_dump_F\" 39255b6dc79427b8f7eeb6a7ff68034ab8548ce670eaAlexander Gutkin exit 0 39265b6dc79427b8f7eeb6a7ff68034ab8548ce670eaAlexander Gutkin ;; 39275b6dc79427b8f7eeb6a7ff68034ab8548ce670eaAlexander Gutkin --lt-*) 39285b6dc79427b8f7eeb6a7ff68034ab8548ce670eaAlexander Gutkin \$ECHO \"Unrecognized --lt- option: '\$lt_opt'\" 1>&2 39295b6dc79427b8f7eeb6a7ff68034ab8548ce670eaAlexander Gutkin exit 1 39305b6dc79427b8f7eeb6a7ff68034ab8548ce670eaAlexander Gutkin ;; 39315b6dc79427b8f7eeb6a7ff68034ab8548ce670eaAlexander Gutkin esac 39325b6dc79427b8f7eeb6a7ff68034ab8548ce670eaAlexander Gutkin done 39335b6dc79427b8f7eeb6a7ff68034ab8548ce670eaAlexander Gutkin 39345b6dc79427b8f7eeb6a7ff68034ab8548ce670eaAlexander Gutkin # Print the debug banner immediately: 39355b6dc79427b8f7eeb6a7ff68034ab8548ce670eaAlexander Gutkin if test -n \"\$lt_option_debug\"; then 39365b6dc79427b8f7eeb6a7ff68034ab8548ce670eaAlexander Gutkin echo \"${outputname}:${output}:\${LINENO}: libtool wrapper (GNU $PACKAGE$TIMESTAMP) $VERSION\" 1>&2 39375b6dc79427b8f7eeb6a7ff68034ab8548ce670eaAlexander Gutkin fi 39385b6dc79427b8f7eeb6a7ff68034ab8548ce670eaAlexander Gutkin} 39395b6dc79427b8f7eeb6a7ff68034ab8548ce670eaAlexander Gutkin 39405b6dc79427b8f7eeb6a7ff68034ab8548ce670eaAlexander Gutkin# Used when --lt-debug. Prints its arguments to stdout 39415b6dc79427b8f7eeb6a7ff68034ab8548ce670eaAlexander Gutkin# (redirection is the responsibility of the caller) 39425b6dc79427b8f7eeb6a7ff68034ab8548ce670eaAlexander Gutkinfunc_lt_dump_args () 39435b6dc79427b8f7eeb6a7ff68034ab8548ce670eaAlexander Gutkin{ 39445b6dc79427b8f7eeb6a7ff68034ab8548ce670eaAlexander Gutkin lt_dump_args_N=1; 39455b6dc79427b8f7eeb6a7ff68034ab8548ce670eaAlexander Gutkin for lt_arg 39465b6dc79427b8f7eeb6a7ff68034ab8548ce670eaAlexander Gutkin do 39475b6dc79427b8f7eeb6a7ff68034ab8548ce670eaAlexander Gutkin \$ECHO \"${outputname}:${output}:\${LINENO}: newargv[\$lt_dump_args_N]: \$lt_arg\" 39485b6dc79427b8f7eeb6a7ff68034ab8548ce670eaAlexander Gutkin lt_dump_args_N=\`expr \$lt_dump_args_N + 1\` 39495b6dc79427b8f7eeb6a7ff68034ab8548ce670eaAlexander Gutkin done 39505b6dc79427b8f7eeb6a7ff68034ab8548ce670eaAlexander Gutkin} 39515b6dc79427b8f7eeb6a7ff68034ab8548ce670eaAlexander Gutkin 39525b6dc79427b8f7eeb6a7ff68034ab8548ce670eaAlexander Gutkin# Core function for launching the target application 39535b6dc79427b8f7eeb6a7ff68034ab8548ce670eaAlexander Gutkinfunc_exec_program_core () 39545b6dc79427b8f7eeb6a7ff68034ab8548ce670eaAlexander Gutkin{ 3955f4c12fce1ee58e670f9c3fce46c40296ba9ee8a2Ian Hodson" 39565b6dc79427b8f7eeb6a7ff68034ab8548ce670eaAlexander Gutkin case $host in 39575b6dc79427b8f7eeb6a7ff68034ab8548ce670eaAlexander Gutkin # Backslashes separate directories on plain windows 39585b6dc79427b8f7eeb6a7ff68034ab8548ce670eaAlexander Gutkin *-*-mingw | *-*-os2* | *-cegcc*) 39595b6dc79427b8f7eeb6a7ff68034ab8548ce670eaAlexander Gutkin $ECHO "\ 39605b6dc79427b8f7eeb6a7ff68034ab8548ce670eaAlexander Gutkin if test -n \"\$lt_option_debug\"; then 39615b6dc79427b8f7eeb6a7ff68034ab8548ce670eaAlexander Gutkin \$ECHO \"${outputname}:${output}:\${LINENO}: newargv[0]: \$progdir\\\\\$program\" 1>&2 39625b6dc79427b8f7eeb6a7ff68034ab8548ce670eaAlexander Gutkin func_lt_dump_args \${1+\"\$@\"} 1>&2 39635b6dc79427b8f7eeb6a7ff68034ab8548ce670eaAlexander Gutkin fi 39645b6dc79427b8f7eeb6a7ff68034ab8548ce670eaAlexander Gutkin exec \"\$progdir\\\\\$program\" \${1+\"\$@\"} 39655b6dc79427b8f7eeb6a7ff68034ab8548ce670eaAlexander Gutkin" 39665b6dc79427b8f7eeb6a7ff68034ab8548ce670eaAlexander Gutkin ;; 39675b6dc79427b8f7eeb6a7ff68034ab8548ce670eaAlexander Gutkin 39685b6dc79427b8f7eeb6a7ff68034ab8548ce670eaAlexander Gutkin *) 39695b6dc79427b8f7eeb6a7ff68034ab8548ce670eaAlexander Gutkin $ECHO "\ 39705b6dc79427b8f7eeb6a7ff68034ab8548ce670eaAlexander Gutkin if test -n \"\$lt_option_debug\"; then 39715b6dc79427b8f7eeb6a7ff68034ab8548ce670eaAlexander Gutkin \$ECHO \"${outputname}:${output}:\${LINENO}: newargv[0]: \$progdir/\$program\" 1>&2 39725b6dc79427b8f7eeb6a7ff68034ab8548ce670eaAlexander Gutkin func_lt_dump_args \${1+\"\$@\"} 1>&2 39735b6dc79427b8f7eeb6a7ff68034ab8548ce670eaAlexander Gutkin fi 39745b6dc79427b8f7eeb6a7ff68034ab8548ce670eaAlexander Gutkin exec \"\$progdir/\$program\" \${1+\"\$@\"} 39755b6dc79427b8f7eeb6a7ff68034ab8548ce670eaAlexander Gutkin" 39765b6dc79427b8f7eeb6a7ff68034ab8548ce670eaAlexander Gutkin ;; 39775b6dc79427b8f7eeb6a7ff68034ab8548ce670eaAlexander Gutkin esac 39785b6dc79427b8f7eeb6a7ff68034ab8548ce670eaAlexander Gutkin $ECHO "\ 39795b6dc79427b8f7eeb6a7ff68034ab8548ce670eaAlexander Gutkin \$ECHO \"\$0: cannot exec \$program \$*\" 1>&2 39805b6dc79427b8f7eeb6a7ff68034ab8548ce670eaAlexander Gutkin exit 1 39815b6dc79427b8f7eeb6a7ff68034ab8548ce670eaAlexander Gutkin} 39825b6dc79427b8f7eeb6a7ff68034ab8548ce670eaAlexander Gutkin 39835b6dc79427b8f7eeb6a7ff68034ab8548ce670eaAlexander Gutkin# A function to encapsulate launching the target application 39845b6dc79427b8f7eeb6a7ff68034ab8548ce670eaAlexander Gutkin# Strips options in the --lt-* namespace from \$@ and 39855b6dc79427b8f7eeb6a7ff68034ab8548ce670eaAlexander Gutkin# launches target application with the remaining arguments. 39865b6dc79427b8f7eeb6a7ff68034ab8548ce670eaAlexander Gutkinfunc_exec_program () 39875b6dc79427b8f7eeb6a7ff68034ab8548ce670eaAlexander Gutkin{ 39885b6dc79427b8f7eeb6a7ff68034ab8548ce670eaAlexander Gutkin case \" \$* \" in 39895b6dc79427b8f7eeb6a7ff68034ab8548ce670eaAlexander Gutkin *\\ --lt-*) 39905b6dc79427b8f7eeb6a7ff68034ab8548ce670eaAlexander Gutkin for lt_wr_arg 39915b6dc79427b8f7eeb6a7ff68034ab8548ce670eaAlexander Gutkin do 39925b6dc79427b8f7eeb6a7ff68034ab8548ce670eaAlexander Gutkin case \$lt_wr_arg in 39935b6dc79427b8f7eeb6a7ff68034ab8548ce670eaAlexander Gutkin --lt-*) ;; 39945b6dc79427b8f7eeb6a7ff68034ab8548ce670eaAlexander Gutkin *) set x \"\$@\" \"\$lt_wr_arg\"; shift;; 39955b6dc79427b8f7eeb6a7ff68034ab8548ce670eaAlexander Gutkin esac 39965b6dc79427b8f7eeb6a7ff68034ab8548ce670eaAlexander Gutkin shift 39975b6dc79427b8f7eeb6a7ff68034ab8548ce670eaAlexander Gutkin done ;; 39985b6dc79427b8f7eeb6a7ff68034ab8548ce670eaAlexander Gutkin esac 39995b6dc79427b8f7eeb6a7ff68034ab8548ce670eaAlexander Gutkin func_exec_program_core \${1+\"\$@\"} 40005b6dc79427b8f7eeb6a7ff68034ab8548ce670eaAlexander Gutkin} 40015b6dc79427b8f7eeb6a7ff68034ab8548ce670eaAlexander Gutkin 40025b6dc79427b8f7eeb6a7ff68034ab8548ce670eaAlexander Gutkin # Parse options 40035b6dc79427b8f7eeb6a7ff68034ab8548ce670eaAlexander Gutkin func_parse_lt_options \"\$0\" \${1+\"\$@\"} 4004f4c12fce1ee58e670f9c3fce46c40296ba9ee8a2Ian Hodson 4005f4c12fce1ee58e670f9c3fce46c40296ba9ee8a2Ian Hodson # Find the directory that this script lives in. 40065b6dc79427b8f7eeb6a7ff68034ab8548ce670eaAlexander Gutkin thisdir=\`\$ECHO \"\$file\" | $SED 's%/[^/]*$%%'\` 4007f4c12fce1ee58e670f9c3fce46c40296ba9ee8a2Ian Hodson test \"x\$thisdir\" = \"x\$file\" && thisdir=. 4008f4c12fce1ee58e670f9c3fce46c40296ba9ee8a2Ian Hodson 4009f4c12fce1ee58e670f9c3fce46c40296ba9ee8a2Ian Hodson # Follow symbolic links until we get to the real thisdir. 40105b6dc79427b8f7eeb6a7ff68034ab8548ce670eaAlexander Gutkin file=\`ls -ld \"\$file\" | $SED -n 's/.*-> //p'\` 4011f4c12fce1ee58e670f9c3fce46c40296ba9ee8a2Ian Hodson while test -n \"\$file\"; do 40125b6dc79427b8f7eeb6a7ff68034ab8548ce670eaAlexander Gutkin destdir=\`\$ECHO \"\$file\" | $SED 's%/[^/]*\$%%'\` 4013f4c12fce1ee58e670f9c3fce46c40296ba9ee8a2Ian Hodson 4014f4c12fce1ee58e670f9c3fce46c40296ba9ee8a2Ian Hodson # If there was a directory component, then change thisdir. 4015f4c12fce1ee58e670f9c3fce46c40296ba9ee8a2Ian Hodson if test \"x\$destdir\" != \"x\$file\"; then 4016f4c12fce1ee58e670f9c3fce46c40296ba9ee8a2Ian Hodson case \"\$destdir\" in 4017f4c12fce1ee58e670f9c3fce46c40296ba9ee8a2Ian Hodson [\\\\/]* | [A-Za-z]:[\\\\/]*) thisdir=\"\$destdir\" ;; 4018f4c12fce1ee58e670f9c3fce46c40296ba9ee8a2Ian Hodson *) thisdir=\"\$thisdir/\$destdir\" ;; 4019f4c12fce1ee58e670f9c3fce46c40296ba9ee8a2Ian Hodson esac 4020f4c12fce1ee58e670f9c3fce46c40296ba9ee8a2Ian Hodson fi 4021f4c12fce1ee58e670f9c3fce46c40296ba9ee8a2Ian Hodson 40225b6dc79427b8f7eeb6a7ff68034ab8548ce670eaAlexander Gutkin file=\`\$ECHO \"\$file\" | $SED 's%^.*/%%'\` 40235b6dc79427b8f7eeb6a7ff68034ab8548ce670eaAlexander Gutkin file=\`ls -ld \"\$thisdir/\$file\" | $SED -n 's/.*-> //p'\` 4024f4c12fce1ee58e670f9c3fce46c40296ba9ee8a2Ian Hodson done 4025f4c12fce1ee58e670f9c3fce46c40296ba9ee8a2Ian Hodson 4026f4c12fce1ee58e670f9c3fce46c40296ba9ee8a2Ian Hodson # Usually 'no', except on cygwin/mingw when embedded into 4027f4c12fce1ee58e670f9c3fce46c40296ba9ee8a2Ian Hodson # the cwrapper. 40285b6dc79427b8f7eeb6a7ff68034ab8548ce670eaAlexander Gutkin WRAPPER_SCRIPT_BELONGS_IN_OBJDIR=$func_emit_wrapper_arg1 4029f4c12fce1ee58e670f9c3fce46c40296ba9ee8a2Ian Hodson if test \"\$WRAPPER_SCRIPT_BELONGS_IN_OBJDIR\" = \"yes\"; then 4030f4c12fce1ee58e670f9c3fce46c40296ba9ee8a2Ian Hodson # special case for '.' 4031f4c12fce1ee58e670f9c3fce46c40296ba9ee8a2Ian Hodson if test \"\$thisdir\" = \".\"; then 4032f4c12fce1ee58e670f9c3fce46c40296ba9ee8a2Ian Hodson thisdir=\`pwd\` 4033f4c12fce1ee58e670f9c3fce46c40296ba9ee8a2Ian Hodson fi 4034f4c12fce1ee58e670f9c3fce46c40296ba9ee8a2Ian Hodson # remove .libs from thisdir 4035f4c12fce1ee58e670f9c3fce46c40296ba9ee8a2Ian Hodson case \"\$thisdir\" in 40365b6dc79427b8f7eeb6a7ff68034ab8548ce670eaAlexander Gutkin *[\\\\/]$objdir ) thisdir=\`\$ECHO \"\$thisdir\" | $SED 's%[\\\\/][^\\\\/]*$%%'\` ;; 4037f4c12fce1ee58e670f9c3fce46c40296ba9ee8a2Ian Hodson $objdir ) thisdir=. ;; 4038f4c12fce1ee58e670f9c3fce46c40296ba9ee8a2Ian Hodson esac 4039f4c12fce1ee58e670f9c3fce46c40296ba9ee8a2Ian Hodson fi 4040f4c12fce1ee58e670f9c3fce46c40296ba9ee8a2Ian Hodson 4041f4c12fce1ee58e670f9c3fce46c40296ba9ee8a2Ian Hodson # Try to get the absolute directory name. 4042f4c12fce1ee58e670f9c3fce46c40296ba9ee8a2Ian Hodson absdir=\`cd \"\$thisdir\" && pwd\` 4043f4c12fce1ee58e670f9c3fce46c40296ba9ee8a2Ian Hodson test -n \"\$absdir\" && thisdir=\"\$absdir\" 4044f4c12fce1ee58e670f9c3fce46c40296ba9ee8a2Ian Hodson" 4045f4c12fce1ee58e670f9c3fce46c40296ba9ee8a2Ian Hodson 4046f4c12fce1ee58e670f9c3fce46c40296ba9ee8a2Ian Hodson if test "$fast_install" = yes; then 4047f4c12fce1ee58e670f9c3fce46c40296ba9ee8a2Ian Hodson $ECHO "\ 4048f4c12fce1ee58e670f9c3fce46c40296ba9ee8a2Ian Hodson program=lt-'$outputname'$exeext 4049f4c12fce1ee58e670f9c3fce46c40296ba9ee8a2Ian Hodson progdir=\"\$thisdir/$objdir\" 4050f4c12fce1ee58e670f9c3fce46c40296ba9ee8a2Ian Hodson 4051f4c12fce1ee58e670f9c3fce46c40296ba9ee8a2Ian Hodson if test ! -f \"\$progdir/\$program\" || 4052f4c12fce1ee58e670f9c3fce46c40296ba9ee8a2Ian Hodson { file=\`ls -1dt \"\$progdir/\$program\" \"\$progdir/../\$program\" 2>/dev/null | ${SED} 1q\`; \\ 4053f4c12fce1ee58e670f9c3fce46c40296ba9ee8a2Ian Hodson test \"X\$file\" != \"X\$progdir/\$program\"; }; then 4054f4c12fce1ee58e670f9c3fce46c40296ba9ee8a2Ian Hodson 4055f4c12fce1ee58e670f9c3fce46c40296ba9ee8a2Ian Hodson file=\"\$\$-\$program\" 4056f4c12fce1ee58e670f9c3fce46c40296ba9ee8a2Ian Hodson 4057f4c12fce1ee58e670f9c3fce46c40296ba9ee8a2Ian Hodson if test ! -d \"\$progdir\"; then 4058f4c12fce1ee58e670f9c3fce46c40296ba9ee8a2Ian Hodson $MKDIR \"\$progdir\" 4059f4c12fce1ee58e670f9c3fce46c40296ba9ee8a2Ian Hodson else 4060f4c12fce1ee58e670f9c3fce46c40296ba9ee8a2Ian Hodson $RM \"\$progdir/\$file\" 4061f4c12fce1ee58e670f9c3fce46c40296ba9ee8a2Ian Hodson fi" 4062f4c12fce1ee58e670f9c3fce46c40296ba9ee8a2Ian Hodson 4063f4c12fce1ee58e670f9c3fce46c40296ba9ee8a2Ian Hodson $ECHO "\ 4064f4c12fce1ee58e670f9c3fce46c40296ba9ee8a2Ian Hodson 4065f4c12fce1ee58e670f9c3fce46c40296ba9ee8a2Ian Hodson # relink executable if necessary 4066f4c12fce1ee58e670f9c3fce46c40296ba9ee8a2Ian Hodson if test -n \"\$relink_command\"; then 4067f4c12fce1ee58e670f9c3fce46c40296ba9ee8a2Ian Hodson if relink_command_output=\`eval \$relink_command 2>&1\`; then : 4068f4c12fce1ee58e670f9c3fce46c40296ba9ee8a2Ian Hodson else 4069f4c12fce1ee58e670f9c3fce46c40296ba9ee8a2Ian Hodson $ECHO \"\$relink_command_output\" >&2 4070f4c12fce1ee58e670f9c3fce46c40296ba9ee8a2Ian Hodson $RM \"\$progdir/\$file\" 4071f4c12fce1ee58e670f9c3fce46c40296ba9ee8a2Ian Hodson exit 1 4072f4c12fce1ee58e670f9c3fce46c40296ba9ee8a2Ian Hodson fi 4073f4c12fce1ee58e670f9c3fce46c40296ba9ee8a2Ian Hodson fi 4074f4c12fce1ee58e670f9c3fce46c40296ba9ee8a2Ian Hodson 4075f4c12fce1ee58e670f9c3fce46c40296ba9ee8a2Ian Hodson $MV \"\$progdir/\$file\" \"\$progdir/\$program\" 2>/dev/null || 4076f4c12fce1ee58e670f9c3fce46c40296ba9ee8a2Ian Hodson { $RM \"\$progdir/\$program\"; 4077f4c12fce1ee58e670f9c3fce46c40296ba9ee8a2Ian Hodson $MV \"\$progdir/\$file\" \"\$progdir/\$program\"; } 4078f4c12fce1ee58e670f9c3fce46c40296ba9ee8a2Ian Hodson $RM \"\$progdir/\$file\" 4079f4c12fce1ee58e670f9c3fce46c40296ba9ee8a2Ian Hodson fi" 4080f4c12fce1ee58e670f9c3fce46c40296ba9ee8a2Ian Hodson else 4081f4c12fce1ee58e670f9c3fce46c40296ba9ee8a2Ian Hodson $ECHO "\ 4082f4c12fce1ee58e670f9c3fce46c40296ba9ee8a2Ian Hodson program='$outputname' 4083f4c12fce1ee58e670f9c3fce46c40296ba9ee8a2Ian Hodson progdir=\"\$thisdir/$objdir\" 4084f4c12fce1ee58e670f9c3fce46c40296ba9ee8a2Ian Hodson" 4085f4c12fce1ee58e670f9c3fce46c40296ba9ee8a2Ian Hodson fi 4086f4c12fce1ee58e670f9c3fce46c40296ba9ee8a2Ian Hodson 4087f4c12fce1ee58e670f9c3fce46c40296ba9ee8a2Ian Hodson $ECHO "\ 4088f4c12fce1ee58e670f9c3fce46c40296ba9ee8a2Ian Hodson 4089f4c12fce1ee58e670f9c3fce46c40296ba9ee8a2Ian Hodson if test -f \"\$progdir/\$program\"; then" 4090f4c12fce1ee58e670f9c3fce46c40296ba9ee8a2Ian Hodson 40915b6dc79427b8f7eeb6a7ff68034ab8548ce670eaAlexander Gutkin # fixup the dll searchpath if we need to. 40925b6dc79427b8f7eeb6a7ff68034ab8548ce670eaAlexander Gutkin # 40935b6dc79427b8f7eeb6a7ff68034ab8548ce670eaAlexander Gutkin # Fix the DLL searchpath if we need to. Do this before prepending 40945b6dc79427b8f7eeb6a7ff68034ab8548ce670eaAlexander Gutkin # to shlibpath, because on Windows, both are PATH and uninstalled 40955b6dc79427b8f7eeb6a7ff68034ab8548ce670eaAlexander Gutkin # libraries must come first. 40965b6dc79427b8f7eeb6a7ff68034ab8548ce670eaAlexander Gutkin if test -n "$dllsearchpath"; then 40975b6dc79427b8f7eeb6a7ff68034ab8548ce670eaAlexander Gutkin $ECHO "\ 40985b6dc79427b8f7eeb6a7ff68034ab8548ce670eaAlexander Gutkin # Add the dll search path components to the executable PATH 40995b6dc79427b8f7eeb6a7ff68034ab8548ce670eaAlexander Gutkin PATH=$dllsearchpath:\$PATH 41005b6dc79427b8f7eeb6a7ff68034ab8548ce670eaAlexander Gutkin" 41015b6dc79427b8f7eeb6a7ff68034ab8548ce670eaAlexander Gutkin fi 41025b6dc79427b8f7eeb6a7ff68034ab8548ce670eaAlexander Gutkin 4103f4c12fce1ee58e670f9c3fce46c40296ba9ee8a2Ian Hodson # Export our shlibpath_var if we have one. 4104f4c12fce1ee58e670f9c3fce46c40296ba9ee8a2Ian Hodson if test "$shlibpath_overrides_runpath" = yes && test -n "$shlibpath_var" && test -n "$temp_rpath"; then 4105f4c12fce1ee58e670f9c3fce46c40296ba9ee8a2Ian Hodson $ECHO "\ 4106f4c12fce1ee58e670f9c3fce46c40296ba9ee8a2Ian Hodson # Add our own library path to $shlibpath_var 4107f4c12fce1ee58e670f9c3fce46c40296ba9ee8a2Ian Hodson $shlibpath_var=\"$temp_rpath\$$shlibpath_var\" 4108f4c12fce1ee58e670f9c3fce46c40296ba9ee8a2Ian Hodson 4109f4c12fce1ee58e670f9c3fce46c40296ba9ee8a2Ian Hodson # Some systems cannot cope with colon-terminated $shlibpath_var 4110f4c12fce1ee58e670f9c3fce46c40296ba9ee8a2Ian Hodson # The second colon is a workaround for a bug in BeOS R4 sed 41115b6dc79427b8f7eeb6a7ff68034ab8548ce670eaAlexander Gutkin $shlibpath_var=\`\$ECHO \"\$$shlibpath_var\" | $SED 's/::*\$//'\` 4112f4c12fce1ee58e670f9c3fce46c40296ba9ee8a2Ian Hodson 4113f4c12fce1ee58e670f9c3fce46c40296ba9ee8a2Ian Hodson export $shlibpath_var 4114f4c12fce1ee58e670f9c3fce46c40296ba9ee8a2Ian Hodson" 4115f4c12fce1ee58e670f9c3fce46c40296ba9ee8a2Ian Hodson fi 4116f4c12fce1ee58e670f9c3fce46c40296ba9ee8a2Ian Hodson 4117f4c12fce1ee58e670f9c3fce46c40296ba9ee8a2Ian Hodson $ECHO "\ 4118f4c12fce1ee58e670f9c3fce46c40296ba9ee8a2Ian Hodson if test \"\$libtool_execute_magic\" != \"$magic\"; then 4119f4c12fce1ee58e670f9c3fce46c40296ba9ee8a2Ian Hodson # Run the actual program with our arguments. 41205b6dc79427b8f7eeb6a7ff68034ab8548ce670eaAlexander Gutkin func_exec_program \${1+\"\$@\"} 4121f4c12fce1ee58e670f9c3fce46c40296ba9ee8a2Ian Hodson fi 4122f4c12fce1ee58e670f9c3fce46c40296ba9ee8a2Ian Hodson else 4123f4c12fce1ee58e670f9c3fce46c40296ba9ee8a2Ian Hodson # The program doesn't exist. 4124f4c12fce1ee58e670f9c3fce46c40296ba9ee8a2Ian Hodson \$ECHO \"\$0: error: \\\`\$progdir/\$program' does not exist\" 1>&2 4125f4c12fce1ee58e670f9c3fce46c40296ba9ee8a2Ian Hodson \$ECHO \"This script is just a wrapper for \$program.\" 1>&2 41265b6dc79427b8f7eeb6a7ff68034ab8548ce670eaAlexander Gutkin \$ECHO \"See the $PACKAGE documentation for more information.\" 1>&2 4127f4c12fce1ee58e670f9c3fce46c40296ba9ee8a2Ian Hodson exit 1 4128f4c12fce1ee58e670f9c3fce46c40296ba9ee8a2Ian Hodson fi 4129f4c12fce1ee58e670f9c3fce46c40296ba9ee8a2Ian Hodsonfi\ 4130f4c12fce1ee58e670f9c3fce46c40296ba9ee8a2Ian Hodson" 4131f4c12fce1ee58e670f9c3fce46c40296ba9ee8a2Ian Hodson} 4132f4c12fce1ee58e670f9c3fce46c40296ba9ee8a2Ian Hodson 4133f4c12fce1ee58e670f9c3fce46c40296ba9ee8a2Ian Hodson 4134f4c12fce1ee58e670f9c3fce46c40296ba9ee8a2Ian Hodson# func_emit_cwrapperexe_src 4135f4c12fce1ee58e670f9c3fce46c40296ba9ee8a2Ian Hodson# emit the source code for a wrapper executable on stdout 4136f4c12fce1ee58e670f9c3fce46c40296ba9ee8a2Ian Hodson# Must ONLY be called from within func_mode_link because 4137f4c12fce1ee58e670f9c3fce46c40296ba9ee8a2Ian Hodson# it depends on a number of variable set therein. 4138f4c12fce1ee58e670f9c3fce46c40296ba9ee8a2Ian Hodsonfunc_emit_cwrapperexe_src () 4139f4c12fce1ee58e670f9c3fce46c40296ba9ee8a2Ian Hodson{ 4140f4c12fce1ee58e670f9c3fce46c40296ba9ee8a2Ian Hodson cat <<EOF 4141f4c12fce1ee58e670f9c3fce46c40296ba9ee8a2Ian Hodson 4142f4c12fce1ee58e670f9c3fce46c40296ba9ee8a2Ian Hodson/* $cwrappersource - temporary wrapper executable for $objdir/$outputname 4143f4c12fce1ee58e670f9c3fce46c40296ba9ee8a2Ian Hodson Generated by $PROGRAM (GNU $PACKAGE$TIMESTAMP) $VERSION 4144f4c12fce1ee58e670f9c3fce46c40296ba9ee8a2Ian Hodson 4145f4c12fce1ee58e670f9c3fce46c40296ba9ee8a2Ian Hodson The $output program cannot be directly executed until all the libtool 4146f4c12fce1ee58e670f9c3fce46c40296ba9ee8a2Ian Hodson libraries that it depends on are installed. 4147f4c12fce1ee58e670f9c3fce46c40296ba9ee8a2Ian Hodson 4148f4c12fce1ee58e670f9c3fce46c40296ba9ee8a2Ian Hodson This wrapper executable should never be moved out of the build directory. 4149f4c12fce1ee58e670f9c3fce46c40296ba9ee8a2Ian Hodson If it is, it will not operate correctly. 4150f4c12fce1ee58e670f9c3fce46c40296ba9ee8a2Ian Hodson*/ 4151f4c12fce1ee58e670f9c3fce46c40296ba9ee8a2Ian HodsonEOF 4152f4c12fce1ee58e670f9c3fce46c40296ba9ee8a2Ian Hodson cat <<"EOF" 41535b6dc79427b8f7eeb6a7ff68034ab8548ce670eaAlexander Gutkin#ifdef _MSC_VER 41545b6dc79427b8f7eeb6a7ff68034ab8548ce670eaAlexander Gutkin# define _CRT_SECURE_NO_DEPRECATE 1 41555b6dc79427b8f7eeb6a7ff68034ab8548ce670eaAlexander Gutkin#endif 4156f4c12fce1ee58e670f9c3fce46c40296ba9ee8a2Ian Hodson#include <stdio.h> 4157f4c12fce1ee58e670f9c3fce46c40296ba9ee8a2Ian Hodson#include <stdlib.h> 4158f4c12fce1ee58e670f9c3fce46c40296ba9ee8a2Ian Hodson#ifdef _MSC_VER 4159f4c12fce1ee58e670f9c3fce46c40296ba9ee8a2Ian Hodson# include <direct.h> 4160f4c12fce1ee58e670f9c3fce46c40296ba9ee8a2Ian Hodson# include <process.h> 4161f4c12fce1ee58e670f9c3fce46c40296ba9ee8a2Ian Hodson# include <io.h> 4162f4c12fce1ee58e670f9c3fce46c40296ba9ee8a2Ian Hodson#else 4163f4c12fce1ee58e670f9c3fce46c40296ba9ee8a2Ian Hodson# include <unistd.h> 4164f4c12fce1ee58e670f9c3fce46c40296ba9ee8a2Ian Hodson# include <stdint.h> 4165f4c12fce1ee58e670f9c3fce46c40296ba9ee8a2Ian Hodson# ifdef __CYGWIN__ 4166f4c12fce1ee58e670f9c3fce46c40296ba9ee8a2Ian Hodson# include <io.h> 4167f4c12fce1ee58e670f9c3fce46c40296ba9ee8a2Ian Hodson# endif 4168f4c12fce1ee58e670f9c3fce46c40296ba9ee8a2Ian Hodson#endif 4169f4c12fce1ee58e670f9c3fce46c40296ba9ee8a2Ian Hodson#include <malloc.h> 4170f4c12fce1ee58e670f9c3fce46c40296ba9ee8a2Ian Hodson#include <stdarg.h> 4171f4c12fce1ee58e670f9c3fce46c40296ba9ee8a2Ian Hodson#include <assert.h> 4172f4c12fce1ee58e670f9c3fce46c40296ba9ee8a2Ian Hodson#include <string.h> 4173f4c12fce1ee58e670f9c3fce46c40296ba9ee8a2Ian Hodson#include <ctype.h> 4174f4c12fce1ee58e670f9c3fce46c40296ba9ee8a2Ian Hodson#include <errno.h> 4175f4c12fce1ee58e670f9c3fce46c40296ba9ee8a2Ian Hodson#include <fcntl.h> 4176f4c12fce1ee58e670f9c3fce46c40296ba9ee8a2Ian Hodson#include <sys/stat.h> 4177f4c12fce1ee58e670f9c3fce46c40296ba9ee8a2Ian Hodson 41785b6dc79427b8f7eeb6a7ff68034ab8548ce670eaAlexander Gutkin/* declarations of non-ANSI functions */ 41795b6dc79427b8f7eeb6a7ff68034ab8548ce670eaAlexander Gutkin#if defined(__MINGW32__) 41805b6dc79427b8f7eeb6a7ff68034ab8548ce670eaAlexander Gutkin# ifdef __STRICT_ANSI__ 41815b6dc79427b8f7eeb6a7ff68034ab8548ce670eaAlexander Gutkinint _putenv (const char *); 41825b6dc79427b8f7eeb6a7ff68034ab8548ce670eaAlexander Gutkin# endif 41835b6dc79427b8f7eeb6a7ff68034ab8548ce670eaAlexander Gutkin#elif defined(__CYGWIN__) 41845b6dc79427b8f7eeb6a7ff68034ab8548ce670eaAlexander Gutkin# ifdef __STRICT_ANSI__ 41855b6dc79427b8f7eeb6a7ff68034ab8548ce670eaAlexander Gutkinchar *realpath (const char *, char *); 41865b6dc79427b8f7eeb6a7ff68034ab8548ce670eaAlexander Gutkinint putenv (char *); 41875b6dc79427b8f7eeb6a7ff68034ab8548ce670eaAlexander Gutkinint setenv (const char *, const char *, int); 41885b6dc79427b8f7eeb6a7ff68034ab8548ce670eaAlexander Gutkin# endif 41895b6dc79427b8f7eeb6a7ff68034ab8548ce670eaAlexander Gutkin/* #elif defined (other platforms) ... */ 41905b6dc79427b8f7eeb6a7ff68034ab8548ce670eaAlexander Gutkin#endif 41915b6dc79427b8f7eeb6a7ff68034ab8548ce670eaAlexander Gutkin 41925b6dc79427b8f7eeb6a7ff68034ab8548ce670eaAlexander Gutkin/* portability defines, excluding path handling macros */ 41935b6dc79427b8f7eeb6a7ff68034ab8548ce670eaAlexander Gutkin#if defined(_MSC_VER) 41945b6dc79427b8f7eeb6a7ff68034ab8548ce670eaAlexander Gutkin# define setmode _setmode 41955b6dc79427b8f7eeb6a7ff68034ab8548ce670eaAlexander Gutkin# define stat _stat 41965b6dc79427b8f7eeb6a7ff68034ab8548ce670eaAlexander Gutkin# define chmod _chmod 41975b6dc79427b8f7eeb6a7ff68034ab8548ce670eaAlexander Gutkin# define getcwd _getcwd 41985b6dc79427b8f7eeb6a7ff68034ab8548ce670eaAlexander Gutkin# define putenv _putenv 41995b6dc79427b8f7eeb6a7ff68034ab8548ce670eaAlexander Gutkin# define S_IXUSR _S_IEXEC 42005b6dc79427b8f7eeb6a7ff68034ab8548ce670eaAlexander Gutkin# ifndef _INTPTR_T_DEFINED 42015b6dc79427b8f7eeb6a7ff68034ab8548ce670eaAlexander Gutkin# define _INTPTR_T_DEFINED 42025b6dc79427b8f7eeb6a7ff68034ab8548ce670eaAlexander Gutkin# define intptr_t int 42035b6dc79427b8f7eeb6a7ff68034ab8548ce670eaAlexander Gutkin# endif 42045b6dc79427b8f7eeb6a7ff68034ab8548ce670eaAlexander Gutkin#elif defined(__MINGW32__) 42055b6dc79427b8f7eeb6a7ff68034ab8548ce670eaAlexander Gutkin# define setmode _setmode 42065b6dc79427b8f7eeb6a7ff68034ab8548ce670eaAlexander Gutkin# define stat _stat 42075b6dc79427b8f7eeb6a7ff68034ab8548ce670eaAlexander Gutkin# define chmod _chmod 42085b6dc79427b8f7eeb6a7ff68034ab8548ce670eaAlexander Gutkin# define getcwd _getcwd 42095b6dc79427b8f7eeb6a7ff68034ab8548ce670eaAlexander Gutkin# define putenv _putenv 42105b6dc79427b8f7eeb6a7ff68034ab8548ce670eaAlexander Gutkin#elif defined(__CYGWIN__) 42115b6dc79427b8f7eeb6a7ff68034ab8548ce670eaAlexander Gutkin# define HAVE_SETENV 42125b6dc79427b8f7eeb6a7ff68034ab8548ce670eaAlexander Gutkin# define FOPEN_WB "wb" 42135b6dc79427b8f7eeb6a7ff68034ab8548ce670eaAlexander Gutkin/* #elif defined (other platforms) ... */ 42145b6dc79427b8f7eeb6a7ff68034ab8548ce670eaAlexander Gutkin#endif 42155b6dc79427b8f7eeb6a7ff68034ab8548ce670eaAlexander Gutkin 4216f4c12fce1ee58e670f9c3fce46c40296ba9ee8a2Ian Hodson#if defined(PATH_MAX) 4217f4c12fce1ee58e670f9c3fce46c40296ba9ee8a2Ian Hodson# define LT_PATHMAX PATH_MAX 4218f4c12fce1ee58e670f9c3fce46c40296ba9ee8a2Ian Hodson#elif defined(MAXPATHLEN) 4219f4c12fce1ee58e670f9c3fce46c40296ba9ee8a2Ian Hodson# define LT_PATHMAX MAXPATHLEN 4220f4c12fce1ee58e670f9c3fce46c40296ba9ee8a2Ian Hodson#else 4221f4c12fce1ee58e670f9c3fce46c40296ba9ee8a2Ian Hodson# define LT_PATHMAX 1024 4222f4c12fce1ee58e670f9c3fce46c40296ba9ee8a2Ian Hodson#endif 4223f4c12fce1ee58e670f9c3fce46c40296ba9ee8a2Ian Hodson 4224f4c12fce1ee58e670f9c3fce46c40296ba9ee8a2Ian Hodson#ifndef S_IXOTH 4225f4c12fce1ee58e670f9c3fce46c40296ba9ee8a2Ian Hodson# define S_IXOTH 0 4226f4c12fce1ee58e670f9c3fce46c40296ba9ee8a2Ian Hodson#endif 4227f4c12fce1ee58e670f9c3fce46c40296ba9ee8a2Ian Hodson#ifndef S_IXGRP 4228f4c12fce1ee58e670f9c3fce46c40296ba9ee8a2Ian Hodson# define S_IXGRP 0 4229f4c12fce1ee58e670f9c3fce46c40296ba9ee8a2Ian Hodson#endif 4230f4c12fce1ee58e670f9c3fce46c40296ba9ee8a2Ian Hodson 42315b6dc79427b8f7eeb6a7ff68034ab8548ce670eaAlexander Gutkin/* path handling portability macros */ 4232f4c12fce1ee58e670f9c3fce46c40296ba9ee8a2Ian Hodson#ifndef DIR_SEPARATOR 4233f4c12fce1ee58e670f9c3fce46c40296ba9ee8a2Ian Hodson# define DIR_SEPARATOR '/' 4234f4c12fce1ee58e670f9c3fce46c40296ba9ee8a2Ian Hodson# define PATH_SEPARATOR ':' 4235f4c12fce1ee58e670f9c3fce46c40296ba9ee8a2Ian Hodson#endif 4236f4c12fce1ee58e670f9c3fce46c40296ba9ee8a2Ian Hodson 4237f4c12fce1ee58e670f9c3fce46c40296ba9ee8a2Ian Hodson#if defined (_WIN32) || defined (__MSDOS__) || defined (__DJGPP__) || \ 4238f4c12fce1ee58e670f9c3fce46c40296ba9ee8a2Ian Hodson defined (__OS2__) 4239f4c12fce1ee58e670f9c3fce46c40296ba9ee8a2Ian Hodson# define HAVE_DOS_BASED_FILE_SYSTEM 4240f4c12fce1ee58e670f9c3fce46c40296ba9ee8a2Ian Hodson# define FOPEN_WB "wb" 4241f4c12fce1ee58e670f9c3fce46c40296ba9ee8a2Ian Hodson# ifndef DIR_SEPARATOR_2 4242f4c12fce1ee58e670f9c3fce46c40296ba9ee8a2Ian Hodson# define DIR_SEPARATOR_2 '\\' 4243f4c12fce1ee58e670f9c3fce46c40296ba9ee8a2Ian Hodson# endif 4244f4c12fce1ee58e670f9c3fce46c40296ba9ee8a2Ian Hodson# ifndef PATH_SEPARATOR_2 4245f4c12fce1ee58e670f9c3fce46c40296ba9ee8a2Ian Hodson# define PATH_SEPARATOR_2 ';' 4246f4c12fce1ee58e670f9c3fce46c40296ba9ee8a2Ian Hodson# endif 4247f4c12fce1ee58e670f9c3fce46c40296ba9ee8a2Ian Hodson#endif 4248f4c12fce1ee58e670f9c3fce46c40296ba9ee8a2Ian Hodson 4249f4c12fce1ee58e670f9c3fce46c40296ba9ee8a2Ian Hodson#ifndef DIR_SEPARATOR_2 4250f4c12fce1ee58e670f9c3fce46c40296ba9ee8a2Ian Hodson# define IS_DIR_SEPARATOR(ch) ((ch) == DIR_SEPARATOR) 4251f4c12fce1ee58e670f9c3fce46c40296ba9ee8a2Ian Hodson#else /* DIR_SEPARATOR_2 */ 4252f4c12fce1ee58e670f9c3fce46c40296ba9ee8a2Ian Hodson# define IS_DIR_SEPARATOR(ch) \ 4253f4c12fce1ee58e670f9c3fce46c40296ba9ee8a2Ian Hodson (((ch) == DIR_SEPARATOR) || ((ch) == DIR_SEPARATOR_2)) 4254f4c12fce1ee58e670f9c3fce46c40296ba9ee8a2Ian Hodson#endif /* DIR_SEPARATOR_2 */ 4255f4c12fce1ee58e670f9c3fce46c40296ba9ee8a2Ian Hodson 4256f4c12fce1ee58e670f9c3fce46c40296ba9ee8a2Ian Hodson#ifndef PATH_SEPARATOR_2 4257f4c12fce1ee58e670f9c3fce46c40296ba9ee8a2Ian Hodson# define IS_PATH_SEPARATOR(ch) ((ch) == PATH_SEPARATOR) 4258f4c12fce1ee58e670f9c3fce46c40296ba9ee8a2Ian Hodson#else /* PATH_SEPARATOR_2 */ 4259f4c12fce1ee58e670f9c3fce46c40296ba9ee8a2Ian Hodson# define IS_PATH_SEPARATOR(ch) ((ch) == PATH_SEPARATOR_2) 4260f4c12fce1ee58e670f9c3fce46c40296ba9ee8a2Ian Hodson#endif /* PATH_SEPARATOR_2 */ 4261f4c12fce1ee58e670f9c3fce46c40296ba9ee8a2Ian Hodson 4262f4c12fce1ee58e670f9c3fce46c40296ba9ee8a2Ian Hodson#ifndef FOPEN_WB 4263f4c12fce1ee58e670f9c3fce46c40296ba9ee8a2Ian Hodson# define FOPEN_WB "w" 4264f4c12fce1ee58e670f9c3fce46c40296ba9ee8a2Ian Hodson#endif 4265f4c12fce1ee58e670f9c3fce46c40296ba9ee8a2Ian Hodson#ifndef _O_BINARY 4266f4c12fce1ee58e670f9c3fce46c40296ba9ee8a2Ian Hodson# define _O_BINARY 0 4267f4c12fce1ee58e670f9c3fce46c40296ba9ee8a2Ian Hodson#endif 4268f4c12fce1ee58e670f9c3fce46c40296ba9ee8a2Ian Hodson 4269f4c12fce1ee58e670f9c3fce46c40296ba9ee8a2Ian Hodson#define XMALLOC(type, num) ((type *) xmalloc ((num) * sizeof(type))) 4270f4c12fce1ee58e670f9c3fce46c40296ba9ee8a2Ian Hodson#define XFREE(stale) do { \ 4271f4c12fce1ee58e670f9c3fce46c40296ba9ee8a2Ian Hodson if (stale) { free ((void *) stale); stale = 0; } \ 4272f4c12fce1ee58e670f9c3fce46c40296ba9ee8a2Ian Hodson} while (0) 4273f4c12fce1ee58e670f9c3fce46c40296ba9ee8a2Ian Hodson 42745b6dc79427b8f7eeb6a7ff68034ab8548ce670eaAlexander Gutkin#if defined(LT_DEBUGWRAPPER) 42755b6dc79427b8f7eeb6a7ff68034ab8548ce670eaAlexander Gutkinstatic int lt_debug = 1; 4276f4c12fce1ee58e670f9c3fce46c40296ba9ee8a2Ian Hodson#else 42775b6dc79427b8f7eeb6a7ff68034ab8548ce670eaAlexander Gutkinstatic int lt_debug = 0; 4278f4c12fce1ee58e670f9c3fce46c40296ba9ee8a2Ian Hodson#endif 4279f4c12fce1ee58e670f9c3fce46c40296ba9ee8a2Ian Hodson 42805b6dc79427b8f7eeb6a7ff68034ab8548ce670eaAlexander Gutkinconst char *program_name = "libtool-wrapper"; /* in case xstrdup fails */ 4281f4c12fce1ee58e670f9c3fce46c40296ba9ee8a2Ian Hodson 4282f4c12fce1ee58e670f9c3fce46c40296ba9ee8a2Ian Hodsonvoid *xmalloc (size_t num); 4283f4c12fce1ee58e670f9c3fce46c40296ba9ee8a2Ian Hodsonchar *xstrdup (const char *string); 4284f4c12fce1ee58e670f9c3fce46c40296ba9ee8a2Ian Hodsonconst char *base_name (const char *name); 4285f4c12fce1ee58e670f9c3fce46c40296ba9ee8a2Ian Hodsonchar *find_executable (const char *wrapper); 4286f4c12fce1ee58e670f9c3fce46c40296ba9ee8a2Ian Hodsonchar *chase_symlinks (const char *pathspec); 4287f4c12fce1ee58e670f9c3fce46c40296ba9ee8a2Ian Hodsonint make_executable (const char *path); 4288f4c12fce1ee58e670f9c3fce46c40296ba9ee8a2Ian Hodsonint check_executable (const char *path); 4289f4c12fce1ee58e670f9c3fce46c40296ba9ee8a2Ian Hodsonchar *strendzap (char *str, const char *pat); 42905b6dc79427b8f7eeb6a7ff68034ab8548ce670eaAlexander Gutkinvoid lt_debugprintf (const char *file, int line, const char *fmt, ...); 42915b6dc79427b8f7eeb6a7ff68034ab8548ce670eaAlexander Gutkinvoid lt_fatal (const char *file, int line, const char *message, ...); 42925b6dc79427b8f7eeb6a7ff68034ab8548ce670eaAlexander Gutkinstatic const char *nonnull (const char *s); 42935b6dc79427b8f7eeb6a7ff68034ab8548ce670eaAlexander Gutkinstatic const char *nonempty (const char *s); 4294f4c12fce1ee58e670f9c3fce46c40296ba9ee8a2Ian Hodsonvoid lt_setenv (const char *name, const char *value); 4295f4c12fce1ee58e670f9c3fce46c40296ba9ee8a2Ian Hodsonchar *lt_extend_str (const char *orig_value, const char *add, int to_end); 4296f4c12fce1ee58e670f9c3fce46c40296ba9ee8a2Ian Hodsonvoid lt_update_exe_path (const char *name, const char *value); 4297f4c12fce1ee58e670f9c3fce46c40296ba9ee8a2Ian Hodsonvoid lt_update_lib_path (const char *name, const char *value); 42985b6dc79427b8f7eeb6a7ff68034ab8548ce670eaAlexander Gutkinchar **prepare_spawn (char **argv); 42995b6dc79427b8f7eeb6a7ff68034ab8548ce670eaAlexander Gutkinvoid lt_dump_script (FILE *f); 4300f4c12fce1ee58e670f9c3fce46c40296ba9ee8a2Ian HodsonEOF 4301f4c12fce1ee58e670f9c3fce46c40296ba9ee8a2Ian Hodson 4302f4c12fce1ee58e670f9c3fce46c40296ba9ee8a2Ian Hodson cat <<EOF 43035b6dc79427b8f7eeb6a7ff68034ab8548ce670eaAlexander Gutkinvolatile const char * MAGIC_EXE = "$magic_exe"; 4304f4c12fce1ee58e670f9c3fce46c40296ba9ee8a2Ian Hodsonconst char * LIB_PATH_VARNAME = "$shlibpath_var"; 4305f4c12fce1ee58e670f9c3fce46c40296ba9ee8a2Ian HodsonEOF 4306f4c12fce1ee58e670f9c3fce46c40296ba9ee8a2Ian Hodson 4307f4c12fce1ee58e670f9c3fce46c40296ba9ee8a2Ian Hodson if test "$shlibpath_overrides_runpath" = yes && test -n "$shlibpath_var" && test -n "$temp_rpath"; then 43085b6dc79427b8f7eeb6a7ff68034ab8548ce670eaAlexander Gutkin func_to_host_path "$temp_rpath" 4309f4c12fce1ee58e670f9c3fce46c40296ba9ee8a2Ian Hodson cat <<EOF 43105b6dc79427b8f7eeb6a7ff68034ab8548ce670eaAlexander Gutkinconst char * LIB_PATH_VALUE = "$func_to_host_path_result"; 4311f4c12fce1ee58e670f9c3fce46c40296ba9ee8a2Ian HodsonEOF 4312f4c12fce1ee58e670f9c3fce46c40296ba9ee8a2Ian Hodson else 4313f4c12fce1ee58e670f9c3fce46c40296ba9ee8a2Ian Hodson cat <<"EOF" 4314f4c12fce1ee58e670f9c3fce46c40296ba9ee8a2Ian Hodsonconst char * LIB_PATH_VALUE = ""; 4315f4c12fce1ee58e670f9c3fce46c40296ba9ee8a2Ian HodsonEOF 4316f4c12fce1ee58e670f9c3fce46c40296ba9ee8a2Ian Hodson fi 4317f4c12fce1ee58e670f9c3fce46c40296ba9ee8a2Ian Hodson 4318f4c12fce1ee58e670f9c3fce46c40296ba9ee8a2Ian Hodson if test -n "$dllsearchpath"; then 43195b6dc79427b8f7eeb6a7ff68034ab8548ce670eaAlexander Gutkin func_to_host_path "$dllsearchpath:" 4320f4c12fce1ee58e670f9c3fce46c40296ba9ee8a2Ian Hodson cat <<EOF 4321f4c12fce1ee58e670f9c3fce46c40296ba9ee8a2Ian Hodsonconst char * EXE_PATH_VARNAME = "PATH"; 43225b6dc79427b8f7eeb6a7ff68034ab8548ce670eaAlexander Gutkinconst char * EXE_PATH_VALUE = "$func_to_host_path_result"; 4323f4c12fce1ee58e670f9c3fce46c40296ba9ee8a2Ian HodsonEOF 4324f4c12fce1ee58e670f9c3fce46c40296ba9ee8a2Ian Hodson else 4325f4c12fce1ee58e670f9c3fce46c40296ba9ee8a2Ian Hodson cat <<"EOF" 4326f4c12fce1ee58e670f9c3fce46c40296ba9ee8a2Ian Hodsonconst char * EXE_PATH_VARNAME = ""; 4327f4c12fce1ee58e670f9c3fce46c40296ba9ee8a2Ian Hodsonconst char * EXE_PATH_VALUE = ""; 4328f4c12fce1ee58e670f9c3fce46c40296ba9ee8a2Ian HodsonEOF 4329f4c12fce1ee58e670f9c3fce46c40296ba9ee8a2Ian Hodson fi 4330f4c12fce1ee58e670f9c3fce46c40296ba9ee8a2Ian Hodson 4331f4c12fce1ee58e670f9c3fce46c40296ba9ee8a2Ian Hodson if test "$fast_install" = yes; then 4332f4c12fce1ee58e670f9c3fce46c40296ba9ee8a2Ian Hodson cat <<EOF 4333f4c12fce1ee58e670f9c3fce46c40296ba9ee8a2Ian Hodsonconst char * TARGET_PROGRAM_NAME = "lt-$outputname"; /* hopefully, no .exe */ 4334f4c12fce1ee58e670f9c3fce46c40296ba9ee8a2Ian HodsonEOF 4335f4c12fce1ee58e670f9c3fce46c40296ba9ee8a2Ian Hodson else 4336f4c12fce1ee58e670f9c3fce46c40296ba9ee8a2Ian Hodson cat <<EOF 4337f4c12fce1ee58e670f9c3fce46c40296ba9ee8a2Ian Hodsonconst char * TARGET_PROGRAM_NAME = "$outputname"; /* hopefully, no .exe */ 4338f4c12fce1ee58e670f9c3fce46c40296ba9ee8a2Ian HodsonEOF 4339f4c12fce1ee58e670f9c3fce46c40296ba9ee8a2Ian Hodson fi 4340f4c12fce1ee58e670f9c3fce46c40296ba9ee8a2Ian Hodson 4341f4c12fce1ee58e670f9c3fce46c40296ba9ee8a2Ian Hodson 4342f4c12fce1ee58e670f9c3fce46c40296ba9ee8a2Ian Hodson cat <<"EOF" 4343f4c12fce1ee58e670f9c3fce46c40296ba9ee8a2Ian Hodson 4344f4c12fce1ee58e670f9c3fce46c40296ba9ee8a2Ian Hodson#define LTWRAPPER_OPTION_PREFIX "--lt-" 4345f4c12fce1ee58e670f9c3fce46c40296ba9ee8a2Ian Hodson 4346f4c12fce1ee58e670f9c3fce46c40296ba9ee8a2Ian Hodsonstatic const char *ltwrapper_option_prefix = LTWRAPPER_OPTION_PREFIX; 4347f4c12fce1ee58e670f9c3fce46c40296ba9ee8a2Ian Hodsonstatic const char *dumpscript_opt = LTWRAPPER_OPTION_PREFIX "dump-script"; 43485b6dc79427b8f7eeb6a7ff68034ab8548ce670eaAlexander Gutkinstatic const char *debug_opt = LTWRAPPER_OPTION_PREFIX "debug"; 4349f4c12fce1ee58e670f9c3fce46c40296ba9ee8a2Ian Hodson 4350f4c12fce1ee58e670f9c3fce46c40296ba9ee8a2Ian Hodsonint 4351f4c12fce1ee58e670f9c3fce46c40296ba9ee8a2Ian Hodsonmain (int argc, char *argv[]) 4352f4c12fce1ee58e670f9c3fce46c40296ba9ee8a2Ian Hodson{ 4353f4c12fce1ee58e670f9c3fce46c40296ba9ee8a2Ian Hodson char **newargz; 4354f4c12fce1ee58e670f9c3fce46c40296ba9ee8a2Ian Hodson int newargc; 4355f4c12fce1ee58e670f9c3fce46c40296ba9ee8a2Ian Hodson char *tmp_pathspec; 4356f4c12fce1ee58e670f9c3fce46c40296ba9ee8a2Ian Hodson char *actual_cwrapper_path; 4357f4c12fce1ee58e670f9c3fce46c40296ba9ee8a2Ian Hodson char *actual_cwrapper_name; 4358f4c12fce1ee58e670f9c3fce46c40296ba9ee8a2Ian Hodson char *target_name; 4359f4c12fce1ee58e670f9c3fce46c40296ba9ee8a2Ian Hodson char *lt_argv_zero; 4360f4c12fce1ee58e670f9c3fce46c40296ba9ee8a2Ian Hodson intptr_t rval = 127; 4361f4c12fce1ee58e670f9c3fce46c40296ba9ee8a2Ian Hodson 4362f4c12fce1ee58e670f9c3fce46c40296ba9ee8a2Ian Hodson int i; 4363f4c12fce1ee58e670f9c3fce46c40296ba9ee8a2Ian Hodson 4364f4c12fce1ee58e670f9c3fce46c40296ba9ee8a2Ian Hodson program_name = (char *) xstrdup (base_name (argv[0])); 43655b6dc79427b8f7eeb6a7ff68034ab8548ce670eaAlexander Gutkin newargz = XMALLOC (char *, argc + 1); 4366f4c12fce1ee58e670f9c3fce46c40296ba9ee8a2Ian Hodson 43675b6dc79427b8f7eeb6a7ff68034ab8548ce670eaAlexander Gutkin /* very simple arg parsing; don't want to rely on getopt 43685b6dc79427b8f7eeb6a7ff68034ab8548ce670eaAlexander Gutkin * also, copy all non cwrapper options to newargz, except 43695b6dc79427b8f7eeb6a7ff68034ab8548ce670eaAlexander Gutkin * argz[0], which is handled differently 43705b6dc79427b8f7eeb6a7ff68034ab8548ce670eaAlexander Gutkin */ 43715b6dc79427b8f7eeb6a7ff68034ab8548ce670eaAlexander Gutkin newargc=0; 4372f4c12fce1ee58e670f9c3fce46c40296ba9ee8a2Ian Hodson for (i = 1; i < argc; i++) 4373f4c12fce1ee58e670f9c3fce46c40296ba9ee8a2Ian Hodson { 4374f4c12fce1ee58e670f9c3fce46c40296ba9ee8a2Ian Hodson if (strcmp (argv[i], dumpscript_opt) == 0) 4375f4c12fce1ee58e670f9c3fce46c40296ba9ee8a2Ian Hodson { 4376f4c12fce1ee58e670f9c3fce46c40296ba9ee8a2Ian HodsonEOF 4377f4c12fce1ee58e670f9c3fce46c40296ba9ee8a2Ian Hodson case "$host" in 4378f4c12fce1ee58e670f9c3fce46c40296ba9ee8a2Ian Hodson *mingw* | *cygwin* ) 4379f4c12fce1ee58e670f9c3fce46c40296ba9ee8a2Ian Hodson # make stdout use "unix" line endings 4380f4c12fce1ee58e670f9c3fce46c40296ba9ee8a2Ian Hodson echo " setmode(1,_O_BINARY);" 4381f4c12fce1ee58e670f9c3fce46c40296ba9ee8a2Ian Hodson ;; 4382f4c12fce1ee58e670f9c3fce46c40296ba9ee8a2Ian Hodson esac 4383f4c12fce1ee58e670f9c3fce46c40296ba9ee8a2Ian Hodson 4384f4c12fce1ee58e670f9c3fce46c40296ba9ee8a2Ian Hodson cat <<"EOF" 43855b6dc79427b8f7eeb6a7ff68034ab8548ce670eaAlexander Gutkin lt_dump_script (stdout); 4386f4c12fce1ee58e670f9c3fce46c40296ba9ee8a2Ian Hodson return 0; 4387f4c12fce1ee58e670f9c3fce46c40296ba9ee8a2Ian Hodson } 43885b6dc79427b8f7eeb6a7ff68034ab8548ce670eaAlexander Gutkin if (strcmp (argv[i], debug_opt) == 0) 43895b6dc79427b8f7eeb6a7ff68034ab8548ce670eaAlexander Gutkin { 43905b6dc79427b8f7eeb6a7ff68034ab8548ce670eaAlexander Gutkin lt_debug = 1; 43915b6dc79427b8f7eeb6a7ff68034ab8548ce670eaAlexander Gutkin continue; 43925b6dc79427b8f7eeb6a7ff68034ab8548ce670eaAlexander Gutkin } 43935b6dc79427b8f7eeb6a7ff68034ab8548ce670eaAlexander Gutkin if (strcmp (argv[i], ltwrapper_option_prefix) == 0) 43945b6dc79427b8f7eeb6a7ff68034ab8548ce670eaAlexander Gutkin { 43955b6dc79427b8f7eeb6a7ff68034ab8548ce670eaAlexander Gutkin /* however, if there is an option in the LTWRAPPER_OPTION_PREFIX 43965b6dc79427b8f7eeb6a7ff68034ab8548ce670eaAlexander Gutkin namespace, but it is not one of the ones we know about and 43975b6dc79427b8f7eeb6a7ff68034ab8548ce670eaAlexander Gutkin have already dealt with, above (inluding dump-script), then 43985b6dc79427b8f7eeb6a7ff68034ab8548ce670eaAlexander Gutkin report an error. Otherwise, targets might begin to believe 43995b6dc79427b8f7eeb6a7ff68034ab8548ce670eaAlexander Gutkin they are allowed to use options in the LTWRAPPER_OPTION_PREFIX 44005b6dc79427b8f7eeb6a7ff68034ab8548ce670eaAlexander Gutkin namespace. The first time any user complains about this, we'll 44015b6dc79427b8f7eeb6a7ff68034ab8548ce670eaAlexander Gutkin need to make LTWRAPPER_OPTION_PREFIX a configure-time option 44025b6dc79427b8f7eeb6a7ff68034ab8548ce670eaAlexander Gutkin or a configure.ac-settable value. 44035b6dc79427b8f7eeb6a7ff68034ab8548ce670eaAlexander Gutkin */ 44045b6dc79427b8f7eeb6a7ff68034ab8548ce670eaAlexander Gutkin lt_fatal (__FILE__, __LINE__, 44055b6dc79427b8f7eeb6a7ff68034ab8548ce670eaAlexander Gutkin "unrecognized %s option: '%s'", 44065b6dc79427b8f7eeb6a7ff68034ab8548ce670eaAlexander Gutkin ltwrapper_option_prefix, argv[i]); 44075b6dc79427b8f7eeb6a7ff68034ab8548ce670eaAlexander Gutkin } 44085b6dc79427b8f7eeb6a7ff68034ab8548ce670eaAlexander Gutkin /* otherwise ... */ 44095b6dc79427b8f7eeb6a7ff68034ab8548ce670eaAlexander Gutkin newargz[++newargc] = xstrdup (argv[i]); 4410f4c12fce1ee58e670f9c3fce46c40296ba9ee8a2Ian Hodson } 44115b6dc79427b8f7eeb6a7ff68034ab8548ce670eaAlexander Gutkin newargz[++newargc] = NULL; 44125b6dc79427b8f7eeb6a7ff68034ab8548ce670eaAlexander Gutkin 44135b6dc79427b8f7eeb6a7ff68034ab8548ce670eaAlexander GutkinEOF 44145b6dc79427b8f7eeb6a7ff68034ab8548ce670eaAlexander Gutkin cat <<EOF 44155b6dc79427b8f7eeb6a7ff68034ab8548ce670eaAlexander Gutkin /* The GNU banner must be the first non-error debug message */ 44165b6dc79427b8f7eeb6a7ff68034ab8548ce670eaAlexander Gutkin lt_debugprintf (__FILE__, __LINE__, "libtool wrapper (GNU $PACKAGE$TIMESTAMP) $VERSION\n"); 44175b6dc79427b8f7eeb6a7ff68034ab8548ce670eaAlexander GutkinEOF 44185b6dc79427b8f7eeb6a7ff68034ab8548ce670eaAlexander Gutkin cat <<"EOF" 44195b6dc79427b8f7eeb6a7ff68034ab8548ce670eaAlexander Gutkin lt_debugprintf (__FILE__, __LINE__, "(main) argv[0]: %s\n", argv[0]); 44205b6dc79427b8f7eeb6a7ff68034ab8548ce670eaAlexander Gutkin lt_debugprintf (__FILE__, __LINE__, "(main) program_name: %s\n", program_name); 4421f4c12fce1ee58e670f9c3fce46c40296ba9ee8a2Ian Hodson 4422f4c12fce1ee58e670f9c3fce46c40296ba9ee8a2Ian Hodson tmp_pathspec = find_executable (argv[0]); 4423f4c12fce1ee58e670f9c3fce46c40296ba9ee8a2Ian Hodson if (tmp_pathspec == NULL) 44245b6dc79427b8f7eeb6a7ff68034ab8548ce670eaAlexander Gutkin lt_fatal (__FILE__, __LINE__, "couldn't find %s", argv[0]); 44255b6dc79427b8f7eeb6a7ff68034ab8548ce670eaAlexander Gutkin lt_debugprintf (__FILE__, __LINE__, 44265b6dc79427b8f7eeb6a7ff68034ab8548ce670eaAlexander Gutkin "(main) found exe (before symlink chase) at: %s\n", 44275b6dc79427b8f7eeb6a7ff68034ab8548ce670eaAlexander Gutkin tmp_pathspec); 4428f4c12fce1ee58e670f9c3fce46c40296ba9ee8a2Ian Hodson 4429f4c12fce1ee58e670f9c3fce46c40296ba9ee8a2Ian Hodson actual_cwrapper_path = chase_symlinks (tmp_pathspec); 44305b6dc79427b8f7eeb6a7ff68034ab8548ce670eaAlexander Gutkin lt_debugprintf (__FILE__, __LINE__, 44315b6dc79427b8f7eeb6a7ff68034ab8548ce670eaAlexander Gutkin "(main) found exe (after symlink chase) at: %s\n", 44325b6dc79427b8f7eeb6a7ff68034ab8548ce670eaAlexander Gutkin actual_cwrapper_path); 4433f4c12fce1ee58e670f9c3fce46c40296ba9ee8a2Ian Hodson XFREE (tmp_pathspec); 4434f4c12fce1ee58e670f9c3fce46c40296ba9ee8a2Ian Hodson 44355b6dc79427b8f7eeb6a7ff68034ab8548ce670eaAlexander Gutkin actual_cwrapper_name = xstrdup (base_name (actual_cwrapper_path)); 4436f4c12fce1ee58e670f9c3fce46c40296ba9ee8a2Ian Hodson strendzap (actual_cwrapper_path, actual_cwrapper_name); 4437f4c12fce1ee58e670f9c3fce46c40296ba9ee8a2Ian Hodson 4438f4c12fce1ee58e670f9c3fce46c40296ba9ee8a2Ian Hodson /* wrapper name transforms */ 4439f4c12fce1ee58e670f9c3fce46c40296ba9ee8a2Ian Hodson strendzap (actual_cwrapper_name, ".exe"); 4440f4c12fce1ee58e670f9c3fce46c40296ba9ee8a2Ian Hodson tmp_pathspec = lt_extend_str (actual_cwrapper_name, ".exe", 1); 4441f4c12fce1ee58e670f9c3fce46c40296ba9ee8a2Ian Hodson XFREE (actual_cwrapper_name); 4442f4c12fce1ee58e670f9c3fce46c40296ba9ee8a2Ian Hodson actual_cwrapper_name = tmp_pathspec; 4443f4c12fce1ee58e670f9c3fce46c40296ba9ee8a2Ian Hodson tmp_pathspec = 0; 4444f4c12fce1ee58e670f9c3fce46c40296ba9ee8a2Ian Hodson 4445f4c12fce1ee58e670f9c3fce46c40296ba9ee8a2Ian Hodson /* target_name transforms -- use actual target program name; might have lt- prefix */ 4446f4c12fce1ee58e670f9c3fce46c40296ba9ee8a2Ian Hodson target_name = xstrdup (base_name (TARGET_PROGRAM_NAME)); 4447f4c12fce1ee58e670f9c3fce46c40296ba9ee8a2Ian Hodson strendzap (target_name, ".exe"); 4448f4c12fce1ee58e670f9c3fce46c40296ba9ee8a2Ian Hodson tmp_pathspec = lt_extend_str (target_name, ".exe", 1); 4449f4c12fce1ee58e670f9c3fce46c40296ba9ee8a2Ian Hodson XFREE (target_name); 4450f4c12fce1ee58e670f9c3fce46c40296ba9ee8a2Ian Hodson target_name = tmp_pathspec; 4451f4c12fce1ee58e670f9c3fce46c40296ba9ee8a2Ian Hodson tmp_pathspec = 0; 4452f4c12fce1ee58e670f9c3fce46c40296ba9ee8a2Ian Hodson 44535b6dc79427b8f7eeb6a7ff68034ab8548ce670eaAlexander Gutkin lt_debugprintf (__FILE__, __LINE__, 44545b6dc79427b8f7eeb6a7ff68034ab8548ce670eaAlexander Gutkin "(main) libtool target name: %s\n", 44555b6dc79427b8f7eeb6a7ff68034ab8548ce670eaAlexander Gutkin target_name); 4456f4c12fce1ee58e670f9c3fce46c40296ba9ee8a2Ian HodsonEOF 4457f4c12fce1ee58e670f9c3fce46c40296ba9ee8a2Ian Hodson 4458f4c12fce1ee58e670f9c3fce46c40296ba9ee8a2Ian Hodson cat <<EOF 4459f4c12fce1ee58e670f9c3fce46c40296ba9ee8a2Ian Hodson newargz[0] = 4460f4c12fce1ee58e670f9c3fce46c40296ba9ee8a2Ian Hodson XMALLOC (char, (strlen (actual_cwrapper_path) + 4461f4c12fce1ee58e670f9c3fce46c40296ba9ee8a2Ian Hodson strlen ("$objdir") + 1 + strlen (actual_cwrapper_name) + 1)); 4462f4c12fce1ee58e670f9c3fce46c40296ba9ee8a2Ian Hodson strcpy (newargz[0], actual_cwrapper_path); 4463f4c12fce1ee58e670f9c3fce46c40296ba9ee8a2Ian Hodson strcat (newargz[0], "$objdir"); 4464f4c12fce1ee58e670f9c3fce46c40296ba9ee8a2Ian Hodson strcat (newargz[0], "/"); 4465f4c12fce1ee58e670f9c3fce46c40296ba9ee8a2Ian HodsonEOF 4466f4c12fce1ee58e670f9c3fce46c40296ba9ee8a2Ian Hodson 4467f4c12fce1ee58e670f9c3fce46c40296ba9ee8a2Ian Hodson cat <<"EOF" 4468f4c12fce1ee58e670f9c3fce46c40296ba9ee8a2Ian Hodson /* stop here, and copy so we don't have to do this twice */ 4469f4c12fce1ee58e670f9c3fce46c40296ba9ee8a2Ian Hodson tmp_pathspec = xstrdup (newargz[0]); 4470f4c12fce1ee58e670f9c3fce46c40296ba9ee8a2Ian Hodson 4471f4c12fce1ee58e670f9c3fce46c40296ba9ee8a2Ian Hodson /* do NOT want the lt- prefix here, so use actual_cwrapper_name */ 4472f4c12fce1ee58e670f9c3fce46c40296ba9ee8a2Ian Hodson strcat (newargz[0], actual_cwrapper_name); 4473f4c12fce1ee58e670f9c3fce46c40296ba9ee8a2Ian Hodson 4474f4c12fce1ee58e670f9c3fce46c40296ba9ee8a2Ian Hodson /* DO want the lt- prefix here if it exists, so use target_name */ 4475f4c12fce1ee58e670f9c3fce46c40296ba9ee8a2Ian Hodson lt_argv_zero = lt_extend_str (tmp_pathspec, target_name, 1); 4476f4c12fce1ee58e670f9c3fce46c40296ba9ee8a2Ian Hodson XFREE (tmp_pathspec); 4477f4c12fce1ee58e670f9c3fce46c40296ba9ee8a2Ian Hodson tmp_pathspec = NULL; 4478f4c12fce1ee58e670f9c3fce46c40296ba9ee8a2Ian HodsonEOF 4479f4c12fce1ee58e670f9c3fce46c40296ba9ee8a2Ian Hodson 4480f4c12fce1ee58e670f9c3fce46c40296ba9ee8a2Ian Hodson case $host_os in 4481f4c12fce1ee58e670f9c3fce46c40296ba9ee8a2Ian Hodson mingw*) 4482f4c12fce1ee58e670f9c3fce46c40296ba9ee8a2Ian Hodson cat <<"EOF" 4483f4c12fce1ee58e670f9c3fce46c40296ba9ee8a2Ian Hodson { 4484f4c12fce1ee58e670f9c3fce46c40296ba9ee8a2Ian Hodson char* p; 4485f4c12fce1ee58e670f9c3fce46c40296ba9ee8a2Ian Hodson while ((p = strchr (newargz[0], '\\')) != NULL) 4486f4c12fce1ee58e670f9c3fce46c40296ba9ee8a2Ian Hodson { 4487f4c12fce1ee58e670f9c3fce46c40296ba9ee8a2Ian Hodson *p = '/'; 4488f4c12fce1ee58e670f9c3fce46c40296ba9ee8a2Ian Hodson } 4489f4c12fce1ee58e670f9c3fce46c40296ba9ee8a2Ian Hodson while ((p = strchr (lt_argv_zero, '\\')) != NULL) 4490f4c12fce1ee58e670f9c3fce46c40296ba9ee8a2Ian Hodson { 4491f4c12fce1ee58e670f9c3fce46c40296ba9ee8a2Ian Hodson *p = '/'; 4492f4c12fce1ee58e670f9c3fce46c40296ba9ee8a2Ian Hodson } 4493f4c12fce1ee58e670f9c3fce46c40296ba9ee8a2Ian Hodson } 4494f4c12fce1ee58e670f9c3fce46c40296ba9ee8a2Ian HodsonEOF 4495f4c12fce1ee58e670f9c3fce46c40296ba9ee8a2Ian Hodson ;; 4496f4c12fce1ee58e670f9c3fce46c40296ba9ee8a2Ian Hodson esac 4497f4c12fce1ee58e670f9c3fce46c40296ba9ee8a2Ian Hodson 4498f4c12fce1ee58e670f9c3fce46c40296ba9ee8a2Ian Hodson cat <<"EOF" 4499f4c12fce1ee58e670f9c3fce46c40296ba9ee8a2Ian Hodson XFREE (target_name); 4500f4c12fce1ee58e670f9c3fce46c40296ba9ee8a2Ian Hodson XFREE (actual_cwrapper_path); 4501f4c12fce1ee58e670f9c3fce46c40296ba9ee8a2Ian Hodson XFREE (actual_cwrapper_name); 4502f4c12fce1ee58e670f9c3fce46c40296ba9ee8a2Ian Hodson 4503f4c12fce1ee58e670f9c3fce46c40296ba9ee8a2Ian Hodson lt_setenv ("BIN_SH", "xpg4"); /* for Tru64 */ 4504f4c12fce1ee58e670f9c3fce46c40296ba9ee8a2Ian Hodson lt_setenv ("DUALCASE", "1"); /* for MSK sh */ 45055b6dc79427b8f7eeb6a7ff68034ab8548ce670eaAlexander Gutkin /* Update the DLL searchpath. EXE_PATH_VALUE ($dllsearchpath) must 45065b6dc79427b8f7eeb6a7ff68034ab8548ce670eaAlexander Gutkin be prepended before (that is, appear after) LIB_PATH_VALUE ($temp_rpath) 45075b6dc79427b8f7eeb6a7ff68034ab8548ce670eaAlexander Gutkin because on Windows, both *_VARNAMEs are PATH but uninstalled 45085b6dc79427b8f7eeb6a7ff68034ab8548ce670eaAlexander Gutkin libraries must come first. */ 4509f4c12fce1ee58e670f9c3fce46c40296ba9ee8a2Ian Hodson lt_update_exe_path (EXE_PATH_VARNAME, EXE_PATH_VALUE); 45105b6dc79427b8f7eeb6a7ff68034ab8548ce670eaAlexander Gutkin lt_update_lib_path (LIB_PATH_VARNAME, LIB_PATH_VALUE); 4511f4c12fce1ee58e670f9c3fce46c40296ba9ee8a2Ian Hodson 45125b6dc79427b8f7eeb6a7ff68034ab8548ce670eaAlexander Gutkin lt_debugprintf (__FILE__, __LINE__, "(main) lt_argv_zero: %s\n", 45135b6dc79427b8f7eeb6a7ff68034ab8548ce670eaAlexander Gutkin nonnull (lt_argv_zero)); 4514f4c12fce1ee58e670f9c3fce46c40296ba9ee8a2Ian Hodson for (i = 0; i < newargc; i++) 4515f4c12fce1ee58e670f9c3fce46c40296ba9ee8a2Ian Hodson { 45165b6dc79427b8f7eeb6a7ff68034ab8548ce670eaAlexander Gutkin lt_debugprintf (__FILE__, __LINE__, "(main) newargz[%d]: %s\n", 45175b6dc79427b8f7eeb6a7ff68034ab8548ce670eaAlexander Gutkin i, nonnull (newargz[i])); 4518f4c12fce1ee58e670f9c3fce46c40296ba9ee8a2Ian Hodson } 4519f4c12fce1ee58e670f9c3fce46c40296ba9ee8a2Ian Hodson 4520f4c12fce1ee58e670f9c3fce46c40296ba9ee8a2Ian HodsonEOF 4521f4c12fce1ee58e670f9c3fce46c40296ba9ee8a2Ian Hodson 4522f4c12fce1ee58e670f9c3fce46c40296ba9ee8a2Ian Hodson case $host_os in 4523f4c12fce1ee58e670f9c3fce46c40296ba9ee8a2Ian Hodson mingw*) 4524f4c12fce1ee58e670f9c3fce46c40296ba9ee8a2Ian Hodson cat <<"EOF" 4525f4c12fce1ee58e670f9c3fce46c40296ba9ee8a2Ian Hodson /* execv doesn't actually work on mingw as expected on unix */ 45265b6dc79427b8f7eeb6a7ff68034ab8548ce670eaAlexander Gutkin newargz = prepare_spawn (newargz); 4527f4c12fce1ee58e670f9c3fce46c40296ba9ee8a2Ian Hodson rval = _spawnv (_P_WAIT, lt_argv_zero, (const char * const *) newargz); 4528f4c12fce1ee58e670f9c3fce46c40296ba9ee8a2Ian Hodson if (rval == -1) 4529f4c12fce1ee58e670f9c3fce46c40296ba9ee8a2Ian Hodson { 4530f4c12fce1ee58e670f9c3fce46c40296ba9ee8a2Ian Hodson /* failed to start process */ 45315b6dc79427b8f7eeb6a7ff68034ab8548ce670eaAlexander Gutkin lt_debugprintf (__FILE__, __LINE__, 45325b6dc79427b8f7eeb6a7ff68034ab8548ce670eaAlexander Gutkin "(main) failed to launch target \"%s\": %s\n", 45335b6dc79427b8f7eeb6a7ff68034ab8548ce670eaAlexander Gutkin lt_argv_zero, nonnull (strerror (errno))); 4534f4c12fce1ee58e670f9c3fce46c40296ba9ee8a2Ian Hodson return 127; 4535f4c12fce1ee58e670f9c3fce46c40296ba9ee8a2Ian Hodson } 4536f4c12fce1ee58e670f9c3fce46c40296ba9ee8a2Ian Hodson return rval; 4537f4c12fce1ee58e670f9c3fce46c40296ba9ee8a2Ian HodsonEOF 4538f4c12fce1ee58e670f9c3fce46c40296ba9ee8a2Ian Hodson ;; 4539f4c12fce1ee58e670f9c3fce46c40296ba9ee8a2Ian Hodson *) 4540f4c12fce1ee58e670f9c3fce46c40296ba9ee8a2Ian Hodson cat <<"EOF" 4541f4c12fce1ee58e670f9c3fce46c40296ba9ee8a2Ian Hodson execv (lt_argv_zero, newargz); 4542f4c12fce1ee58e670f9c3fce46c40296ba9ee8a2Ian Hodson return rval; /* =127, but avoids unused variable warning */ 4543f4c12fce1ee58e670f9c3fce46c40296ba9ee8a2Ian HodsonEOF 4544f4c12fce1ee58e670f9c3fce46c40296ba9ee8a2Ian Hodson ;; 4545f4c12fce1ee58e670f9c3fce46c40296ba9ee8a2Ian Hodson esac 4546f4c12fce1ee58e670f9c3fce46c40296ba9ee8a2Ian Hodson 4547f4c12fce1ee58e670f9c3fce46c40296ba9ee8a2Ian Hodson cat <<"EOF" 4548f4c12fce1ee58e670f9c3fce46c40296ba9ee8a2Ian Hodson} 4549f4c12fce1ee58e670f9c3fce46c40296ba9ee8a2Ian Hodson 4550f4c12fce1ee58e670f9c3fce46c40296ba9ee8a2Ian Hodsonvoid * 4551f4c12fce1ee58e670f9c3fce46c40296ba9ee8a2Ian Hodsonxmalloc (size_t num) 4552f4c12fce1ee58e670f9c3fce46c40296ba9ee8a2Ian Hodson{ 4553f4c12fce1ee58e670f9c3fce46c40296ba9ee8a2Ian Hodson void *p = (void *) malloc (num); 4554f4c12fce1ee58e670f9c3fce46c40296ba9ee8a2Ian Hodson if (!p) 45555b6dc79427b8f7eeb6a7ff68034ab8548ce670eaAlexander Gutkin lt_fatal (__FILE__, __LINE__, "memory exhausted"); 4556f4c12fce1ee58e670f9c3fce46c40296ba9ee8a2Ian Hodson 4557f4c12fce1ee58e670f9c3fce46c40296ba9ee8a2Ian Hodson return p; 4558f4c12fce1ee58e670f9c3fce46c40296ba9ee8a2Ian Hodson} 4559f4c12fce1ee58e670f9c3fce46c40296ba9ee8a2Ian Hodson 4560f4c12fce1ee58e670f9c3fce46c40296ba9ee8a2Ian Hodsonchar * 4561f4c12fce1ee58e670f9c3fce46c40296ba9ee8a2Ian Hodsonxstrdup (const char *string) 4562f4c12fce1ee58e670f9c3fce46c40296ba9ee8a2Ian Hodson{ 4563f4c12fce1ee58e670f9c3fce46c40296ba9ee8a2Ian Hodson return string ? strcpy ((char *) xmalloc (strlen (string) + 1), 4564f4c12fce1ee58e670f9c3fce46c40296ba9ee8a2Ian Hodson string) : NULL; 4565f4c12fce1ee58e670f9c3fce46c40296ba9ee8a2Ian Hodson} 4566f4c12fce1ee58e670f9c3fce46c40296ba9ee8a2Ian Hodson 4567f4c12fce1ee58e670f9c3fce46c40296ba9ee8a2Ian Hodsonconst char * 4568f4c12fce1ee58e670f9c3fce46c40296ba9ee8a2Ian Hodsonbase_name (const char *name) 4569f4c12fce1ee58e670f9c3fce46c40296ba9ee8a2Ian Hodson{ 4570f4c12fce1ee58e670f9c3fce46c40296ba9ee8a2Ian Hodson const char *base; 4571f4c12fce1ee58e670f9c3fce46c40296ba9ee8a2Ian Hodson 4572f4c12fce1ee58e670f9c3fce46c40296ba9ee8a2Ian Hodson#if defined (HAVE_DOS_BASED_FILE_SYSTEM) 4573f4c12fce1ee58e670f9c3fce46c40296ba9ee8a2Ian Hodson /* Skip over the disk name in MSDOS pathnames. */ 4574f4c12fce1ee58e670f9c3fce46c40296ba9ee8a2Ian Hodson if (isalpha ((unsigned char) name[0]) && name[1] == ':') 4575f4c12fce1ee58e670f9c3fce46c40296ba9ee8a2Ian Hodson name += 2; 4576f4c12fce1ee58e670f9c3fce46c40296ba9ee8a2Ian Hodson#endif 4577f4c12fce1ee58e670f9c3fce46c40296ba9ee8a2Ian Hodson 4578f4c12fce1ee58e670f9c3fce46c40296ba9ee8a2Ian Hodson for (base = name; *name; name++) 4579f4c12fce1ee58e670f9c3fce46c40296ba9ee8a2Ian Hodson if (IS_DIR_SEPARATOR (*name)) 4580f4c12fce1ee58e670f9c3fce46c40296ba9ee8a2Ian Hodson base = name + 1; 4581f4c12fce1ee58e670f9c3fce46c40296ba9ee8a2Ian Hodson return base; 4582f4c12fce1ee58e670f9c3fce46c40296ba9ee8a2Ian Hodson} 4583f4c12fce1ee58e670f9c3fce46c40296ba9ee8a2Ian Hodson 4584f4c12fce1ee58e670f9c3fce46c40296ba9ee8a2Ian Hodsonint 4585f4c12fce1ee58e670f9c3fce46c40296ba9ee8a2Ian Hodsoncheck_executable (const char *path) 4586f4c12fce1ee58e670f9c3fce46c40296ba9ee8a2Ian Hodson{ 4587f4c12fce1ee58e670f9c3fce46c40296ba9ee8a2Ian Hodson struct stat st; 4588f4c12fce1ee58e670f9c3fce46c40296ba9ee8a2Ian Hodson 45895b6dc79427b8f7eeb6a7ff68034ab8548ce670eaAlexander Gutkin lt_debugprintf (__FILE__, __LINE__, "(check_executable): %s\n", 45905b6dc79427b8f7eeb6a7ff68034ab8548ce670eaAlexander Gutkin nonempty (path)); 4591f4c12fce1ee58e670f9c3fce46c40296ba9ee8a2Ian Hodson if ((!path) || (!*path)) 4592f4c12fce1ee58e670f9c3fce46c40296ba9ee8a2Ian Hodson return 0; 4593f4c12fce1ee58e670f9c3fce46c40296ba9ee8a2Ian Hodson 4594f4c12fce1ee58e670f9c3fce46c40296ba9ee8a2Ian Hodson if ((stat (path, &st) >= 0) 4595f4c12fce1ee58e670f9c3fce46c40296ba9ee8a2Ian Hodson && (st.st_mode & (S_IXUSR | S_IXGRP | S_IXOTH))) 4596f4c12fce1ee58e670f9c3fce46c40296ba9ee8a2Ian Hodson return 1; 4597f4c12fce1ee58e670f9c3fce46c40296ba9ee8a2Ian Hodson else 4598f4c12fce1ee58e670f9c3fce46c40296ba9ee8a2Ian Hodson return 0; 4599f4c12fce1ee58e670f9c3fce46c40296ba9ee8a2Ian Hodson} 4600f4c12fce1ee58e670f9c3fce46c40296ba9ee8a2Ian Hodson 4601f4c12fce1ee58e670f9c3fce46c40296ba9ee8a2Ian Hodsonint 4602f4c12fce1ee58e670f9c3fce46c40296ba9ee8a2Ian Hodsonmake_executable (const char *path) 4603f4c12fce1ee58e670f9c3fce46c40296ba9ee8a2Ian Hodson{ 4604f4c12fce1ee58e670f9c3fce46c40296ba9ee8a2Ian Hodson int rval = 0; 4605f4c12fce1ee58e670f9c3fce46c40296ba9ee8a2Ian Hodson struct stat st; 4606f4c12fce1ee58e670f9c3fce46c40296ba9ee8a2Ian Hodson 46075b6dc79427b8f7eeb6a7ff68034ab8548ce670eaAlexander Gutkin lt_debugprintf (__FILE__, __LINE__, "(make_executable): %s\n", 46085b6dc79427b8f7eeb6a7ff68034ab8548ce670eaAlexander Gutkin nonempty (path)); 4609f4c12fce1ee58e670f9c3fce46c40296ba9ee8a2Ian Hodson if ((!path) || (!*path)) 4610f4c12fce1ee58e670f9c3fce46c40296ba9ee8a2Ian Hodson return 0; 4611f4c12fce1ee58e670f9c3fce46c40296ba9ee8a2Ian Hodson 4612f4c12fce1ee58e670f9c3fce46c40296ba9ee8a2Ian Hodson if (stat (path, &st) >= 0) 4613f4c12fce1ee58e670f9c3fce46c40296ba9ee8a2Ian Hodson { 4614f4c12fce1ee58e670f9c3fce46c40296ba9ee8a2Ian Hodson rval = chmod (path, st.st_mode | S_IXOTH | S_IXGRP | S_IXUSR); 4615f4c12fce1ee58e670f9c3fce46c40296ba9ee8a2Ian Hodson } 4616f4c12fce1ee58e670f9c3fce46c40296ba9ee8a2Ian Hodson return rval; 4617f4c12fce1ee58e670f9c3fce46c40296ba9ee8a2Ian Hodson} 4618f4c12fce1ee58e670f9c3fce46c40296ba9ee8a2Ian Hodson 4619f4c12fce1ee58e670f9c3fce46c40296ba9ee8a2Ian Hodson/* Searches for the full path of the wrapper. Returns 4620f4c12fce1ee58e670f9c3fce46c40296ba9ee8a2Ian Hodson newly allocated full path name if found, NULL otherwise 4621f4c12fce1ee58e670f9c3fce46c40296ba9ee8a2Ian Hodson Does not chase symlinks, even on platforms that support them. 4622f4c12fce1ee58e670f9c3fce46c40296ba9ee8a2Ian Hodson*/ 4623f4c12fce1ee58e670f9c3fce46c40296ba9ee8a2Ian Hodsonchar * 4624f4c12fce1ee58e670f9c3fce46c40296ba9ee8a2Ian Hodsonfind_executable (const char *wrapper) 4625f4c12fce1ee58e670f9c3fce46c40296ba9ee8a2Ian Hodson{ 4626f4c12fce1ee58e670f9c3fce46c40296ba9ee8a2Ian Hodson int has_slash = 0; 4627f4c12fce1ee58e670f9c3fce46c40296ba9ee8a2Ian Hodson const char *p; 4628f4c12fce1ee58e670f9c3fce46c40296ba9ee8a2Ian Hodson const char *p_next; 4629f4c12fce1ee58e670f9c3fce46c40296ba9ee8a2Ian Hodson /* static buffer for getcwd */ 4630f4c12fce1ee58e670f9c3fce46c40296ba9ee8a2Ian Hodson char tmp[LT_PATHMAX + 1]; 4631f4c12fce1ee58e670f9c3fce46c40296ba9ee8a2Ian Hodson int tmp_len; 4632f4c12fce1ee58e670f9c3fce46c40296ba9ee8a2Ian Hodson char *concat_name; 4633f4c12fce1ee58e670f9c3fce46c40296ba9ee8a2Ian Hodson 46345b6dc79427b8f7eeb6a7ff68034ab8548ce670eaAlexander Gutkin lt_debugprintf (__FILE__, __LINE__, "(find_executable): %s\n", 46355b6dc79427b8f7eeb6a7ff68034ab8548ce670eaAlexander Gutkin nonempty (wrapper)); 4636f4c12fce1ee58e670f9c3fce46c40296ba9ee8a2Ian Hodson 4637f4c12fce1ee58e670f9c3fce46c40296ba9ee8a2Ian Hodson if ((wrapper == NULL) || (*wrapper == '\0')) 4638f4c12fce1ee58e670f9c3fce46c40296ba9ee8a2Ian Hodson return NULL; 4639f4c12fce1ee58e670f9c3fce46c40296ba9ee8a2Ian Hodson 4640f4c12fce1ee58e670f9c3fce46c40296ba9ee8a2Ian Hodson /* Absolute path? */ 4641f4c12fce1ee58e670f9c3fce46c40296ba9ee8a2Ian Hodson#if defined (HAVE_DOS_BASED_FILE_SYSTEM) 4642f4c12fce1ee58e670f9c3fce46c40296ba9ee8a2Ian Hodson if (isalpha ((unsigned char) wrapper[0]) && wrapper[1] == ':') 4643f4c12fce1ee58e670f9c3fce46c40296ba9ee8a2Ian Hodson { 4644f4c12fce1ee58e670f9c3fce46c40296ba9ee8a2Ian Hodson concat_name = xstrdup (wrapper); 4645f4c12fce1ee58e670f9c3fce46c40296ba9ee8a2Ian Hodson if (check_executable (concat_name)) 4646f4c12fce1ee58e670f9c3fce46c40296ba9ee8a2Ian Hodson return concat_name; 4647f4c12fce1ee58e670f9c3fce46c40296ba9ee8a2Ian Hodson XFREE (concat_name); 4648f4c12fce1ee58e670f9c3fce46c40296ba9ee8a2Ian Hodson } 4649f4c12fce1ee58e670f9c3fce46c40296ba9ee8a2Ian Hodson else 4650f4c12fce1ee58e670f9c3fce46c40296ba9ee8a2Ian Hodson { 4651f4c12fce1ee58e670f9c3fce46c40296ba9ee8a2Ian Hodson#endif 4652f4c12fce1ee58e670f9c3fce46c40296ba9ee8a2Ian Hodson if (IS_DIR_SEPARATOR (wrapper[0])) 4653f4c12fce1ee58e670f9c3fce46c40296ba9ee8a2Ian Hodson { 4654f4c12fce1ee58e670f9c3fce46c40296ba9ee8a2Ian Hodson concat_name = xstrdup (wrapper); 4655f4c12fce1ee58e670f9c3fce46c40296ba9ee8a2Ian Hodson if (check_executable (concat_name)) 4656f4c12fce1ee58e670f9c3fce46c40296ba9ee8a2Ian Hodson return concat_name; 4657f4c12fce1ee58e670f9c3fce46c40296ba9ee8a2Ian Hodson XFREE (concat_name); 4658f4c12fce1ee58e670f9c3fce46c40296ba9ee8a2Ian Hodson } 4659f4c12fce1ee58e670f9c3fce46c40296ba9ee8a2Ian Hodson#if defined (HAVE_DOS_BASED_FILE_SYSTEM) 4660f4c12fce1ee58e670f9c3fce46c40296ba9ee8a2Ian Hodson } 4661f4c12fce1ee58e670f9c3fce46c40296ba9ee8a2Ian Hodson#endif 4662f4c12fce1ee58e670f9c3fce46c40296ba9ee8a2Ian Hodson 4663f4c12fce1ee58e670f9c3fce46c40296ba9ee8a2Ian Hodson for (p = wrapper; *p; p++) 4664f4c12fce1ee58e670f9c3fce46c40296ba9ee8a2Ian Hodson if (*p == '/') 4665f4c12fce1ee58e670f9c3fce46c40296ba9ee8a2Ian Hodson { 4666f4c12fce1ee58e670f9c3fce46c40296ba9ee8a2Ian Hodson has_slash = 1; 4667f4c12fce1ee58e670f9c3fce46c40296ba9ee8a2Ian Hodson break; 4668f4c12fce1ee58e670f9c3fce46c40296ba9ee8a2Ian Hodson } 4669f4c12fce1ee58e670f9c3fce46c40296ba9ee8a2Ian Hodson if (!has_slash) 4670f4c12fce1ee58e670f9c3fce46c40296ba9ee8a2Ian Hodson { 4671f4c12fce1ee58e670f9c3fce46c40296ba9ee8a2Ian Hodson /* no slashes; search PATH */ 4672f4c12fce1ee58e670f9c3fce46c40296ba9ee8a2Ian Hodson const char *path = getenv ("PATH"); 4673f4c12fce1ee58e670f9c3fce46c40296ba9ee8a2Ian Hodson if (path != NULL) 4674f4c12fce1ee58e670f9c3fce46c40296ba9ee8a2Ian Hodson { 4675f4c12fce1ee58e670f9c3fce46c40296ba9ee8a2Ian Hodson for (p = path; *p; p = p_next) 4676f4c12fce1ee58e670f9c3fce46c40296ba9ee8a2Ian Hodson { 4677f4c12fce1ee58e670f9c3fce46c40296ba9ee8a2Ian Hodson const char *q; 4678f4c12fce1ee58e670f9c3fce46c40296ba9ee8a2Ian Hodson size_t p_len; 4679f4c12fce1ee58e670f9c3fce46c40296ba9ee8a2Ian Hodson for (q = p; *q; q++) 4680f4c12fce1ee58e670f9c3fce46c40296ba9ee8a2Ian Hodson if (IS_PATH_SEPARATOR (*q)) 4681f4c12fce1ee58e670f9c3fce46c40296ba9ee8a2Ian Hodson break; 4682f4c12fce1ee58e670f9c3fce46c40296ba9ee8a2Ian Hodson p_len = q - p; 4683f4c12fce1ee58e670f9c3fce46c40296ba9ee8a2Ian Hodson p_next = (*q == '\0' ? q : q + 1); 4684f4c12fce1ee58e670f9c3fce46c40296ba9ee8a2Ian Hodson if (p_len == 0) 4685f4c12fce1ee58e670f9c3fce46c40296ba9ee8a2Ian Hodson { 4686f4c12fce1ee58e670f9c3fce46c40296ba9ee8a2Ian Hodson /* empty path: current directory */ 4687f4c12fce1ee58e670f9c3fce46c40296ba9ee8a2Ian Hodson if (getcwd (tmp, LT_PATHMAX) == NULL) 46885b6dc79427b8f7eeb6a7ff68034ab8548ce670eaAlexander Gutkin lt_fatal (__FILE__, __LINE__, "getcwd failed: %s", 46895b6dc79427b8f7eeb6a7ff68034ab8548ce670eaAlexander Gutkin nonnull (strerror (errno))); 4690f4c12fce1ee58e670f9c3fce46c40296ba9ee8a2Ian Hodson tmp_len = strlen (tmp); 4691f4c12fce1ee58e670f9c3fce46c40296ba9ee8a2Ian Hodson concat_name = 4692f4c12fce1ee58e670f9c3fce46c40296ba9ee8a2Ian Hodson XMALLOC (char, tmp_len + 1 + strlen (wrapper) + 1); 4693f4c12fce1ee58e670f9c3fce46c40296ba9ee8a2Ian Hodson memcpy (concat_name, tmp, tmp_len); 4694f4c12fce1ee58e670f9c3fce46c40296ba9ee8a2Ian Hodson concat_name[tmp_len] = '/'; 4695f4c12fce1ee58e670f9c3fce46c40296ba9ee8a2Ian Hodson strcpy (concat_name + tmp_len + 1, wrapper); 4696f4c12fce1ee58e670f9c3fce46c40296ba9ee8a2Ian Hodson } 4697f4c12fce1ee58e670f9c3fce46c40296ba9ee8a2Ian Hodson else 4698f4c12fce1ee58e670f9c3fce46c40296ba9ee8a2Ian Hodson { 4699f4c12fce1ee58e670f9c3fce46c40296ba9ee8a2Ian Hodson concat_name = 4700f4c12fce1ee58e670f9c3fce46c40296ba9ee8a2Ian Hodson XMALLOC (char, p_len + 1 + strlen (wrapper) + 1); 4701f4c12fce1ee58e670f9c3fce46c40296ba9ee8a2Ian Hodson memcpy (concat_name, p, p_len); 4702f4c12fce1ee58e670f9c3fce46c40296ba9ee8a2Ian Hodson concat_name[p_len] = '/'; 4703f4c12fce1ee58e670f9c3fce46c40296ba9ee8a2Ian Hodson strcpy (concat_name + p_len + 1, wrapper); 4704f4c12fce1ee58e670f9c3fce46c40296ba9ee8a2Ian Hodson } 4705f4c12fce1ee58e670f9c3fce46c40296ba9ee8a2Ian Hodson if (check_executable (concat_name)) 4706f4c12fce1ee58e670f9c3fce46c40296ba9ee8a2Ian Hodson return concat_name; 4707f4c12fce1ee58e670f9c3fce46c40296ba9ee8a2Ian Hodson XFREE (concat_name); 4708f4c12fce1ee58e670f9c3fce46c40296ba9ee8a2Ian Hodson } 4709f4c12fce1ee58e670f9c3fce46c40296ba9ee8a2Ian Hodson } 4710f4c12fce1ee58e670f9c3fce46c40296ba9ee8a2Ian Hodson /* not found in PATH; assume curdir */ 4711f4c12fce1ee58e670f9c3fce46c40296ba9ee8a2Ian Hodson } 4712f4c12fce1ee58e670f9c3fce46c40296ba9ee8a2Ian Hodson /* Relative path | not found in path: prepend cwd */ 4713f4c12fce1ee58e670f9c3fce46c40296ba9ee8a2Ian Hodson if (getcwd (tmp, LT_PATHMAX) == NULL) 47145b6dc79427b8f7eeb6a7ff68034ab8548ce670eaAlexander Gutkin lt_fatal (__FILE__, __LINE__, "getcwd failed: %s", 47155b6dc79427b8f7eeb6a7ff68034ab8548ce670eaAlexander Gutkin nonnull (strerror (errno))); 4716f4c12fce1ee58e670f9c3fce46c40296ba9ee8a2Ian Hodson tmp_len = strlen (tmp); 4717f4c12fce1ee58e670f9c3fce46c40296ba9ee8a2Ian Hodson concat_name = XMALLOC (char, tmp_len + 1 + strlen (wrapper) + 1); 4718f4c12fce1ee58e670f9c3fce46c40296ba9ee8a2Ian Hodson memcpy (concat_name, tmp, tmp_len); 4719f4c12fce1ee58e670f9c3fce46c40296ba9ee8a2Ian Hodson concat_name[tmp_len] = '/'; 4720f4c12fce1ee58e670f9c3fce46c40296ba9ee8a2Ian Hodson strcpy (concat_name + tmp_len + 1, wrapper); 4721f4c12fce1ee58e670f9c3fce46c40296ba9ee8a2Ian Hodson 4722f4c12fce1ee58e670f9c3fce46c40296ba9ee8a2Ian Hodson if (check_executable (concat_name)) 4723f4c12fce1ee58e670f9c3fce46c40296ba9ee8a2Ian Hodson return concat_name; 4724f4c12fce1ee58e670f9c3fce46c40296ba9ee8a2Ian Hodson XFREE (concat_name); 4725f4c12fce1ee58e670f9c3fce46c40296ba9ee8a2Ian Hodson return NULL; 4726f4c12fce1ee58e670f9c3fce46c40296ba9ee8a2Ian Hodson} 4727f4c12fce1ee58e670f9c3fce46c40296ba9ee8a2Ian Hodson 4728f4c12fce1ee58e670f9c3fce46c40296ba9ee8a2Ian Hodsonchar * 4729f4c12fce1ee58e670f9c3fce46c40296ba9ee8a2Ian Hodsonchase_symlinks (const char *pathspec) 4730f4c12fce1ee58e670f9c3fce46c40296ba9ee8a2Ian Hodson{ 4731f4c12fce1ee58e670f9c3fce46c40296ba9ee8a2Ian Hodson#ifndef S_ISLNK 4732f4c12fce1ee58e670f9c3fce46c40296ba9ee8a2Ian Hodson return xstrdup (pathspec); 4733f4c12fce1ee58e670f9c3fce46c40296ba9ee8a2Ian Hodson#else 4734f4c12fce1ee58e670f9c3fce46c40296ba9ee8a2Ian Hodson char buf[LT_PATHMAX]; 4735f4c12fce1ee58e670f9c3fce46c40296ba9ee8a2Ian Hodson struct stat s; 4736f4c12fce1ee58e670f9c3fce46c40296ba9ee8a2Ian Hodson char *tmp_pathspec = xstrdup (pathspec); 4737f4c12fce1ee58e670f9c3fce46c40296ba9ee8a2Ian Hodson char *p; 4738f4c12fce1ee58e670f9c3fce46c40296ba9ee8a2Ian Hodson int has_symlinks = 0; 4739f4c12fce1ee58e670f9c3fce46c40296ba9ee8a2Ian Hodson while (strlen (tmp_pathspec) && !has_symlinks) 4740f4c12fce1ee58e670f9c3fce46c40296ba9ee8a2Ian Hodson { 47415b6dc79427b8f7eeb6a7ff68034ab8548ce670eaAlexander Gutkin lt_debugprintf (__FILE__, __LINE__, 47425b6dc79427b8f7eeb6a7ff68034ab8548ce670eaAlexander Gutkin "checking path component for symlinks: %s\n", 47435b6dc79427b8f7eeb6a7ff68034ab8548ce670eaAlexander Gutkin tmp_pathspec); 4744f4c12fce1ee58e670f9c3fce46c40296ba9ee8a2Ian Hodson if (lstat (tmp_pathspec, &s) == 0) 4745f4c12fce1ee58e670f9c3fce46c40296ba9ee8a2Ian Hodson { 4746f4c12fce1ee58e670f9c3fce46c40296ba9ee8a2Ian Hodson if (S_ISLNK (s.st_mode) != 0) 4747f4c12fce1ee58e670f9c3fce46c40296ba9ee8a2Ian Hodson { 4748f4c12fce1ee58e670f9c3fce46c40296ba9ee8a2Ian Hodson has_symlinks = 1; 4749f4c12fce1ee58e670f9c3fce46c40296ba9ee8a2Ian Hodson break; 4750f4c12fce1ee58e670f9c3fce46c40296ba9ee8a2Ian Hodson } 4751f4c12fce1ee58e670f9c3fce46c40296ba9ee8a2Ian Hodson 4752f4c12fce1ee58e670f9c3fce46c40296ba9ee8a2Ian Hodson /* search backwards for last DIR_SEPARATOR */ 4753f4c12fce1ee58e670f9c3fce46c40296ba9ee8a2Ian Hodson p = tmp_pathspec + strlen (tmp_pathspec) - 1; 4754f4c12fce1ee58e670f9c3fce46c40296ba9ee8a2Ian Hodson while ((p > tmp_pathspec) && (!IS_DIR_SEPARATOR (*p))) 4755f4c12fce1ee58e670f9c3fce46c40296ba9ee8a2Ian Hodson p--; 4756f4c12fce1ee58e670f9c3fce46c40296ba9ee8a2Ian Hodson if ((p == tmp_pathspec) && (!IS_DIR_SEPARATOR (*p))) 4757f4c12fce1ee58e670f9c3fce46c40296ba9ee8a2Ian Hodson { 4758f4c12fce1ee58e670f9c3fce46c40296ba9ee8a2Ian Hodson /* no more DIR_SEPARATORS left */ 4759f4c12fce1ee58e670f9c3fce46c40296ba9ee8a2Ian Hodson break; 4760f4c12fce1ee58e670f9c3fce46c40296ba9ee8a2Ian Hodson } 4761f4c12fce1ee58e670f9c3fce46c40296ba9ee8a2Ian Hodson *p = '\0'; 4762f4c12fce1ee58e670f9c3fce46c40296ba9ee8a2Ian Hodson } 4763f4c12fce1ee58e670f9c3fce46c40296ba9ee8a2Ian Hodson else 4764f4c12fce1ee58e670f9c3fce46c40296ba9ee8a2Ian Hodson { 47655b6dc79427b8f7eeb6a7ff68034ab8548ce670eaAlexander Gutkin lt_fatal (__FILE__, __LINE__, 47665b6dc79427b8f7eeb6a7ff68034ab8548ce670eaAlexander Gutkin "error accessing file \"%s\": %s", 47675b6dc79427b8f7eeb6a7ff68034ab8548ce670eaAlexander Gutkin tmp_pathspec, nonnull (strerror (errno))); 4768f4c12fce1ee58e670f9c3fce46c40296ba9ee8a2Ian Hodson } 4769f4c12fce1ee58e670f9c3fce46c40296ba9ee8a2Ian Hodson } 4770f4c12fce1ee58e670f9c3fce46c40296ba9ee8a2Ian Hodson XFREE (tmp_pathspec); 4771f4c12fce1ee58e670f9c3fce46c40296ba9ee8a2Ian Hodson 4772f4c12fce1ee58e670f9c3fce46c40296ba9ee8a2Ian Hodson if (!has_symlinks) 4773f4c12fce1ee58e670f9c3fce46c40296ba9ee8a2Ian Hodson { 4774f4c12fce1ee58e670f9c3fce46c40296ba9ee8a2Ian Hodson return xstrdup (pathspec); 4775f4c12fce1ee58e670f9c3fce46c40296ba9ee8a2Ian Hodson } 4776f4c12fce1ee58e670f9c3fce46c40296ba9ee8a2Ian Hodson 4777f4c12fce1ee58e670f9c3fce46c40296ba9ee8a2Ian Hodson tmp_pathspec = realpath (pathspec, buf); 4778f4c12fce1ee58e670f9c3fce46c40296ba9ee8a2Ian Hodson if (tmp_pathspec == 0) 4779f4c12fce1ee58e670f9c3fce46c40296ba9ee8a2Ian Hodson { 47805b6dc79427b8f7eeb6a7ff68034ab8548ce670eaAlexander Gutkin lt_fatal (__FILE__, __LINE__, 47815b6dc79427b8f7eeb6a7ff68034ab8548ce670eaAlexander Gutkin "could not follow symlinks for %s", pathspec); 4782f4c12fce1ee58e670f9c3fce46c40296ba9ee8a2Ian Hodson } 4783f4c12fce1ee58e670f9c3fce46c40296ba9ee8a2Ian Hodson return xstrdup (tmp_pathspec); 4784f4c12fce1ee58e670f9c3fce46c40296ba9ee8a2Ian Hodson#endif 4785f4c12fce1ee58e670f9c3fce46c40296ba9ee8a2Ian Hodson} 4786f4c12fce1ee58e670f9c3fce46c40296ba9ee8a2Ian Hodson 4787f4c12fce1ee58e670f9c3fce46c40296ba9ee8a2Ian Hodsonchar * 4788f4c12fce1ee58e670f9c3fce46c40296ba9ee8a2Ian Hodsonstrendzap (char *str, const char *pat) 4789f4c12fce1ee58e670f9c3fce46c40296ba9ee8a2Ian Hodson{ 4790f4c12fce1ee58e670f9c3fce46c40296ba9ee8a2Ian Hodson size_t len, patlen; 4791f4c12fce1ee58e670f9c3fce46c40296ba9ee8a2Ian Hodson 4792f4c12fce1ee58e670f9c3fce46c40296ba9ee8a2Ian Hodson assert (str != NULL); 4793f4c12fce1ee58e670f9c3fce46c40296ba9ee8a2Ian Hodson assert (pat != NULL); 4794f4c12fce1ee58e670f9c3fce46c40296ba9ee8a2Ian Hodson 4795f4c12fce1ee58e670f9c3fce46c40296ba9ee8a2Ian Hodson len = strlen (str); 4796f4c12fce1ee58e670f9c3fce46c40296ba9ee8a2Ian Hodson patlen = strlen (pat); 4797f4c12fce1ee58e670f9c3fce46c40296ba9ee8a2Ian Hodson 4798f4c12fce1ee58e670f9c3fce46c40296ba9ee8a2Ian Hodson if (patlen <= len) 4799f4c12fce1ee58e670f9c3fce46c40296ba9ee8a2Ian Hodson { 4800f4c12fce1ee58e670f9c3fce46c40296ba9ee8a2Ian Hodson str += len - patlen; 4801f4c12fce1ee58e670f9c3fce46c40296ba9ee8a2Ian Hodson if (strcmp (str, pat) == 0) 4802f4c12fce1ee58e670f9c3fce46c40296ba9ee8a2Ian Hodson *str = '\0'; 4803f4c12fce1ee58e670f9c3fce46c40296ba9ee8a2Ian Hodson } 4804f4c12fce1ee58e670f9c3fce46c40296ba9ee8a2Ian Hodson return str; 4805f4c12fce1ee58e670f9c3fce46c40296ba9ee8a2Ian Hodson} 4806f4c12fce1ee58e670f9c3fce46c40296ba9ee8a2Ian Hodson 48075b6dc79427b8f7eeb6a7ff68034ab8548ce670eaAlexander Gutkinvoid 48085b6dc79427b8f7eeb6a7ff68034ab8548ce670eaAlexander Gutkinlt_debugprintf (const char *file, int line, const char *fmt, ...) 48095b6dc79427b8f7eeb6a7ff68034ab8548ce670eaAlexander Gutkin{ 48105b6dc79427b8f7eeb6a7ff68034ab8548ce670eaAlexander Gutkin va_list args; 48115b6dc79427b8f7eeb6a7ff68034ab8548ce670eaAlexander Gutkin if (lt_debug) 48125b6dc79427b8f7eeb6a7ff68034ab8548ce670eaAlexander Gutkin { 48135b6dc79427b8f7eeb6a7ff68034ab8548ce670eaAlexander Gutkin (void) fprintf (stderr, "%s:%s:%d: ", program_name, file, line); 48145b6dc79427b8f7eeb6a7ff68034ab8548ce670eaAlexander Gutkin va_start (args, fmt); 48155b6dc79427b8f7eeb6a7ff68034ab8548ce670eaAlexander Gutkin (void) vfprintf (stderr, fmt, args); 48165b6dc79427b8f7eeb6a7ff68034ab8548ce670eaAlexander Gutkin va_end (args); 48175b6dc79427b8f7eeb6a7ff68034ab8548ce670eaAlexander Gutkin } 48185b6dc79427b8f7eeb6a7ff68034ab8548ce670eaAlexander Gutkin} 48195b6dc79427b8f7eeb6a7ff68034ab8548ce670eaAlexander Gutkin 4820f4c12fce1ee58e670f9c3fce46c40296ba9ee8a2Ian Hodsonstatic void 48215b6dc79427b8f7eeb6a7ff68034ab8548ce670eaAlexander Gutkinlt_error_core (int exit_status, const char *file, 48225b6dc79427b8f7eeb6a7ff68034ab8548ce670eaAlexander Gutkin int line, const char *mode, 4823f4c12fce1ee58e670f9c3fce46c40296ba9ee8a2Ian Hodson const char *message, va_list ap) 4824f4c12fce1ee58e670f9c3fce46c40296ba9ee8a2Ian Hodson{ 48255b6dc79427b8f7eeb6a7ff68034ab8548ce670eaAlexander Gutkin fprintf (stderr, "%s:%s:%d: %s: ", program_name, file, line, mode); 4826f4c12fce1ee58e670f9c3fce46c40296ba9ee8a2Ian Hodson vfprintf (stderr, message, ap); 4827f4c12fce1ee58e670f9c3fce46c40296ba9ee8a2Ian Hodson fprintf (stderr, ".\n"); 4828f4c12fce1ee58e670f9c3fce46c40296ba9ee8a2Ian Hodson 4829f4c12fce1ee58e670f9c3fce46c40296ba9ee8a2Ian Hodson if (exit_status >= 0) 4830f4c12fce1ee58e670f9c3fce46c40296ba9ee8a2Ian Hodson exit (exit_status); 4831f4c12fce1ee58e670f9c3fce46c40296ba9ee8a2Ian Hodson} 4832f4c12fce1ee58e670f9c3fce46c40296ba9ee8a2Ian Hodson 4833f4c12fce1ee58e670f9c3fce46c40296ba9ee8a2Ian Hodsonvoid 48345b6dc79427b8f7eeb6a7ff68034ab8548ce670eaAlexander Gutkinlt_fatal (const char *file, int line, const char *message, ...) 4835f4c12fce1ee58e670f9c3fce46c40296ba9ee8a2Ian Hodson{ 4836f4c12fce1ee58e670f9c3fce46c40296ba9ee8a2Ian Hodson va_list ap; 4837f4c12fce1ee58e670f9c3fce46c40296ba9ee8a2Ian Hodson va_start (ap, message); 48385b6dc79427b8f7eeb6a7ff68034ab8548ce670eaAlexander Gutkin lt_error_core (EXIT_FAILURE, file, line, "FATAL", message, ap); 4839f4c12fce1ee58e670f9c3fce46c40296ba9ee8a2Ian Hodson va_end (ap); 4840f4c12fce1ee58e670f9c3fce46c40296ba9ee8a2Ian Hodson} 4841f4c12fce1ee58e670f9c3fce46c40296ba9ee8a2Ian Hodson 48425b6dc79427b8f7eeb6a7ff68034ab8548ce670eaAlexander Gutkinstatic const char * 48435b6dc79427b8f7eeb6a7ff68034ab8548ce670eaAlexander Gutkinnonnull (const char *s) 48445b6dc79427b8f7eeb6a7ff68034ab8548ce670eaAlexander Gutkin{ 48455b6dc79427b8f7eeb6a7ff68034ab8548ce670eaAlexander Gutkin return s ? s : "(null)"; 48465b6dc79427b8f7eeb6a7ff68034ab8548ce670eaAlexander Gutkin} 48475b6dc79427b8f7eeb6a7ff68034ab8548ce670eaAlexander Gutkin 48485b6dc79427b8f7eeb6a7ff68034ab8548ce670eaAlexander Gutkinstatic const char * 48495b6dc79427b8f7eeb6a7ff68034ab8548ce670eaAlexander Gutkinnonempty (const char *s) 48505b6dc79427b8f7eeb6a7ff68034ab8548ce670eaAlexander Gutkin{ 48515b6dc79427b8f7eeb6a7ff68034ab8548ce670eaAlexander Gutkin return (s && !*s) ? "(empty)" : nonnull (s); 48525b6dc79427b8f7eeb6a7ff68034ab8548ce670eaAlexander Gutkin} 48535b6dc79427b8f7eeb6a7ff68034ab8548ce670eaAlexander Gutkin 4854f4c12fce1ee58e670f9c3fce46c40296ba9ee8a2Ian Hodsonvoid 4855f4c12fce1ee58e670f9c3fce46c40296ba9ee8a2Ian Hodsonlt_setenv (const char *name, const char *value) 4856f4c12fce1ee58e670f9c3fce46c40296ba9ee8a2Ian Hodson{ 48575b6dc79427b8f7eeb6a7ff68034ab8548ce670eaAlexander Gutkin lt_debugprintf (__FILE__, __LINE__, 48585b6dc79427b8f7eeb6a7ff68034ab8548ce670eaAlexander Gutkin "(lt_setenv) setting '%s' to '%s'\n", 48595b6dc79427b8f7eeb6a7ff68034ab8548ce670eaAlexander Gutkin nonnull (name), nonnull (value)); 4860f4c12fce1ee58e670f9c3fce46c40296ba9ee8a2Ian Hodson { 4861f4c12fce1ee58e670f9c3fce46c40296ba9ee8a2Ian Hodson#ifdef HAVE_SETENV 4862f4c12fce1ee58e670f9c3fce46c40296ba9ee8a2Ian Hodson /* always make a copy, for consistency with !HAVE_SETENV */ 4863f4c12fce1ee58e670f9c3fce46c40296ba9ee8a2Ian Hodson char *str = xstrdup (value); 4864f4c12fce1ee58e670f9c3fce46c40296ba9ee8a2Ian Hodson setenv (name, str, 1); 4865f4c12fce1ee58e670f9c3fce46c40296ba9ee8a2Ian Hodson#else 4866f4c12fce1ee58e670f9c3fce46c40296ba9ee8a2Ian Hodson int len = strlen (name) + 1 + strlen (value) + 1; 4867f4c12fce1ee58e670f9c3fce46c40296ba9ee8a2Ian Hodson char *str = XMALLOC (char, len); 4868f4c12fce1ee58e670f9c3fce46c40296ba9ee8a2Ian Hodson sprintf (str, "%s=%s", name, value); 4869f4c12fce1ee58e670f9c3fce46c40296ba9ee8a2Ian Hodson if (putenv (str) != EXIT_SUCCESS) 4870f4c12fce1ee58e670f9c3fce46c40296ba9ee8a2Ian Hodson { 4871f4c12fce1ee58e670f9c3fce46c40296ba9ee8a2Ian Hodson XFREE (str); 4872f4c12fce1ee58e670f9c3fce46c40296ba9ee8a2Ian Hodson } 4873f4c12fce1ee58e670f9c3fce46c40296ba9ee8a2Ian Hodson#endif 4874f4c12fce1ee58e670f9c3fce46c40296ba9ee8a2Ian Hodson } 4875f4c12fce1ee58e670f9c3fce46c40296ba9ee8a2Ian Hodson} 4876f4c12fce1ee58e670f9c3fce46c40296ba9ee8a2Ian Hodson 4877f4c12fce1ee58e670f9c3fce46c40296ba9ee8a2Ian Hodsonchar * 4878f4c12fce1ee58e670f9c3fce46c40296ba9ee8a2Ian Hodsonlt_extend_str (const char *orig_value, const char *add, int to_end) 4879f4c12fce1ee58e670f9c3fce46c40296ba9ee8a2Ian Hodson{ 4880f4c12fce1ee58e670f9c3fce46c40296ba9ee8a2Ian Hodson char *new_value; 4881f4c12fce1ee58e670f9c3fce46c40296ba9ee8a2Ian Hodson if (orig_value && *orig_value) 4882f4c12fce1ee58e670f9c3fce46c40296ba9ee8a2Ian Hodson { 4883f4c12fce1ee58e670f9c3fce46c40296ba9ee8a2Ian Hodson int orig_value_len = strlen (orig_value); 4884f4c12fce1ee58e670f9c3fce46c40296ba9ee8a2Ian Hodson int add_len = strlen (add); 4885f4c12fce1ee58e670f9c3fce46c40296ba9ee8a2Ian Hodson new_value = XMALLOC (char, add_len + orig_value_len + 1); 4886f4c12fce1ee58e670f9c3fce46c40296ba9ee8a2Ian Hodson if (to_end) 4887f4c12fce1ee58e670f9c3fce46c40296ba9ee8a2Ian Hodson { 4888f4c12fce1ee58e670f9c3fce46c40296ba9ee8a2Ian Hodson strcpy (new_value, orig_value); 4889f4c12fce1ee58e670f9c3fce46c40296ba9ee8a2Ian Hodson strcpy (new_value + orig_value_len, add); 4890f4c12fce1ee58e670f9c3fce46c40296ba9ee8a2Ian Hodson } 4891f4c12fce1ee58e670f9c3fce46c40296ba9ee8a2Ian Hodson else 4892f4c12fce1ee58e670f9c3fce46c40296ba9ee8a2Ian Hodson { 4893f4c12fce1ee58e670f9c3fce46c40296ba9ee8a2Ian Hodson strcpy (new_value, add); 4894f4c12fce1ee58e670f9c3fce46c40296ba9ee8a2Ian Hodson strcpy (new_value + add_len, orig_value); 4895f4c12fce1ee58e670f9c3fce46c40296ba9ee8a2Ian Hodson } 4896f4c12fce1ee58e670f9c3fce46c40296ba9ee8a2Ian Hodson } 4897f4c12fce1ee58e670f9c3fce46c40296ba9ee8a2Ian Hodson else 4898f4c12fce1ee58e670f9c3fce46c40296ba9ee8a2Ian Hodson { 4899f4c12fce1ee58e670f9c3fce46c40296ba9ee8a2Ian Hodson new_value = xstrdup (add); 4900f4c12fce1ee58e670f9c3fce46c40296ba9ee8a2Ian Hodson } 4901f4c12fce1ee58e670f9c3fce46c40296ba9ee8a2Ian Hodson return new_value; 4902f4c12fce1ee58e670f9c3fce46c40296ba9ee8a2Ian Hodson} 4903f4c12fce1ee58e670f9c3fce46c40296ba9ee8a2Ian Hodson 4904f4c12fce1ee58e670f9c3fce46c40296ba9ee8a2Ian Hodsonvoid 4905f4c12fce1ee58e670f9c3fce46c40296ba9ee8a2Ian Hodsonlt_update_exe_path (const char *name, const char *value) 4906f4c12fce1ee58e670f9c3fce46c40296ba9ee8a2Ian Hodson{ 49075b6dc79427b8f7eeb6a7ff68034ab8548ce670eaAlexander Gutkin lt_debugprintf (__FILE__, __LINE__, 49085b6dc79427b8f7eeb6a7ff68034ab8548ce670eaAlexander Gutkin "(lt_update_exe_path) modifying '%s' by prepending '%s'\n", 49095b6dc79427b8f7eeb6a7ff68034ab8548ce670eaAlexander Gutkin nonnull (name), nonnull (value)); 4910f4c12fce1ee58e670f9c3fce46c40296ba9ee8a2Ian Hodson 4911f4c12fce1ee58e670f9c3fce46c40296ba9ee8a2Ian Hodson if (name && *name && value && *value) 4912f4c12fce1ee58e670f9c3fce46c40296ba9ee8a2Ian Hodson { 4913f4c12fce1ee58e670f9c3fce46c40296ba9ee8a2Ian Hodson char *new_value = lt_extend_str (getenv (name), value, 0); 4914f4c12fce1ee58e670f9c3fce46c40296ba9ee8a2Ian Hodson /* some systems can't cope with a ':'-terminated path #' */ 4915f4c12fce1ee58e670f9c3fce46c40296ba9ee8a2Ian Hodson int len = strlen (new_value); 4916f4c12fce1ee58e670f9c3fce46c40296ba9ee8a2Ian Hodson while (((len = strlen (new_value)) > 0) && IS_PATH_SEPARATOR (new_value[len-1])) 4917f4c12fce1ee58e670f9c3fce46c40296ba9ee8a2Ian Hodson { 4918f4c12fce1ee58e670f9c3fce46c40296ba9ee8a2Ian Hodson new_value[len-1] = '\0'; 4919f4c12fce1ee58e670f9c3fce46c40296ba9ee8a2Ian Hodson } 4920f4c12fce1ee58e670f9c3fce46c40296ba9ee8a2Ian Hodson lt_setenv (name, new_value); 4921f4c12fce1ee58e670f9c3fce46c40296ba9ee8a2Ian Hodson XFREE (new_value); 4922f4c12fce1ee58e670f9c3fce46c40296ba9ee8a2Ian Hodson } 4923f4c12fce1ee58e670f9c3fce46c40296ba9ee8a2Ian Hodson} 4924f4c12fce1ee58e670f9c3fce46c40296ba9ee8a2Ian Hodson 4925f4c12fce1ee58e670f9c3fce46c40296ba9ee8a2Ian Hodsonvoid 4926f4c12fce1ee58e670f9c3fce46c40296ba9ee8a2Ian Hodsonlt_update_lib_path (const char *name, const char *value) 4927f4c12fce1ee58e670f9c3fce46c40296ba9ee8a2Ian Hodson{ 49285b6dc79427b8f7eeb6a7ff68034ab8548ce670eaAlexander Gutkin lt_debugprintf (__FILE__, __LINE__, 49295b6dc79427b8f7eeb6a7ff68034ab8548ce670eaAlexander Gutkin "(lt_update_lib_path) modifying '%s' by prepending '%s'\n", 49305b6dc79427b8f7eeb6a7ff68034ab8548ce670eaAlexander Gutkin nonnull (name), nonnull (value)); 4931f4c12fce1ee58e670f9c3fce46c40296ba9ee8a2Ian Hodson 4932f4c12fce1ee58e670f9c3fce46c40296ba9ee8a2Ian Hodson if (name && *name && value && *value) 4933f4c12fce1ee58e670f9c3fce46c40296ba9ee8a2Ian Hodson { 4934f4c12fce1ee58e670f9c3fce46c40296ba9ee8a2Ian Hodson char *new_value = lt_extend_str (getenv (name), value, 0); 4935f4c12fce1ee58e670f9c3fce46c40296ba9ee8a2Ian Hodson lt_setenv (name, new_value); 4936f4c12fce1ee58e670f9c3fce46c40296ba9ee8a2Ian Hodson XFREE (new_value); 4937f4c12fce1ee58e670f9c3fce46c40296ba9ee8a2Ian Hodson } 4938f4c12fce1ee58e670f9c3fce46c40296ba9ee8a2Ian Hodson} 4939f4c12fce1ee58e670f9c3fce46c40296ba9ee8a2Ian Hodson 49405b6dc79427b8f7eeb6a7ff68034ab8548ce670eaAlexander GutkinEOF 49415b6dc79427b8f7eeb6a7ff68034ab8548ce670eaAlexander Gutkin case $host_os in 49425b6dc79427b8f7eeb6a7ff68034ab8548ce670eaAlexander Gutkin mingw*) 49435b6dc79427b8f7eeb6a7ff68034ab8548ce670eaAlexander Gutkin cat <<"EOF" 49445b6dc79427b8f7eeb6a7ff68034ab8548ce670eaAlexander Gutkin 49455b6dc79427b8f7eeb6a7ff68034ab8548ce670eaAlexander Gutkin/* Prepares an argument vector before calling spawn(). 49465b6dc79427b8f7eeb6a7ff68034ab8548ce670eaAlexander Gutkin Note that spawn() does not by itself call the command interpreter 49475b6dc79427b8f7eeb6a7ff68034ab8548ce670eaAlexander Gutkin (getenv ("COMSPEC") != NULL ? getenv ("COMSPEC") : 49485b6dc79427b8f7eeb6a7ff68034ab8548ce670eaAlexander Gutkin ({ OSVERSIONINFO v; v.dwOSVersionInfoSize = sizeof(OSVERSIONINFO); 49495b6dc79427b8f7eeb6a7ff68034ab8548ce670eaAlexander Gutkin GetVersionEx(&v); 49505b6dc79427b8f7eeb6a7ff68034ab8548ce670eaAlexander Gutkin v.dwPlatformId == VER_PLATFORM_WIN32_NT; 49515b6dc79427b8f7eeb6a7ff68034ab8548ce670eaAlexander Gutkin }) ? "cmd.exe" : "command.com"). 49525b6dc79427b8f7eeb6a7ff68034ab8548ce670eaAlexander Gutkin Instead it simply concatenates the arguments, separated by ' ', and calls 49535b6dc79427b8f7eeb6a7ff68034ab8548ce670eaAlexander Gutkin CreateProcess(). We must quote the arguments since Win32 CreateProcess() 49545b6dc79427b8f7eeb6a7ff68034ab8548ce670eaAlexander Gutkin interprets characters like ' ', '\t', '\\', '"' (but not '<' and '>') in a 49555b6dc79427b8f7eeb6a7ff68034ab8548ce670eaAlexander Gutkin special way: 49565b6dc79427b8f7eeb6a7ff68034ab8548ce670eaAlexander Gutkin - Space and tab are interpreted as delimiters. They are not treated as 49575b6dc79427b8f7eeb6a7ff68034ab8548ce670eaAlexander Gutkin delimiters if they are surrounded by double quotes: "...". 49585b6dc79427b8f7eeb6a7ff68034ab8548ce670eaAlexander Gutkin - Unescaped double quotes are removed from the input. Their only effect is 49595b6dc79427b8f7eeb6a7ff68034ab8548ce670eaAlexander Gutkin that within double quotes, space and tab are treated like normal 49605b6dc79427b8f7eeb6a7ff68034ab8548ce670eaAlexander Gutkin characters. 49615b6dc79427b8f7eeb6a7ff68034ab8548ce670eaAlexander Gutkin - Backslashes not followed by double quotes are not special. 49625b6dc79427b8f7eeb6a7ff68034ab8548ce670eaAlexander Gutkin - But 2*n+1 backslashes followed by a double quote become 49635b6dc79427b8f7eeb6a7ff68034ab8548ce670eaAlexander Gutkin n backslashes followed by a double quote (n >= 0): 49645b6dc79427b8f7eeb6a7ff68034ab8548ce670eaAlexander Gutkin \" -> " 49655b6dc79427b8f7eeb6a7ff68034ab8548ce670eaAlexander Gutkin \\\" -> \" 49665b6dc79427b8f7eeb6a7ff68034ab8548ce670eaAlexander Gutkin \\\\\" -> \\" 49675b6dc79427b8f7eeb6a7ff68034ab8548ce670eaAlexander Gutkin */ 49685b6dc79427b8f7eeb6a7ff68034ab8548ce670eaAlexander Gutkin#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" 49695b6dc79427b8f7eeb6a7ff68034ab8548ce670eaAlexander Gutkin#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" 49705b6dc79427b8f7eeb6a7ff68034ab8548ce670eaAlexander Gutkinchar ** 49715b6dc79427b8f7eeb6a7ff68034ab8548ce670eaAlexander Gutkinprepare_spawn (char **argv) 49725b6dc79427b8f7eeb6a7ff68034ab8548ce670eaAlexander Gutkin{ 49735b6dc79427b8f7eeb6a7ff68034ab8548ce670eaAlexander Gutkin size_t argc; 49745b6dc79427b8f7eeb6a7ff68034ab8548ce670eaAlexander Gutkin char **new_argv; 49755b6dc79427b8f7eeb6a7ff68034ab8548ce670eaAlexander Gutkin size_t i; 49765b6dc79427b8f7eeb6a7ff68034ab8548ce670eaAlexander Gutkin 49775b6dc79427b8f7eeb6a7ff68034ab8548ce670eaAlexander Gutkin /* Count number of arguments. */ 49785b6dc79427b8f7eeb6a7ff68034ab8548ce670eaAlexander Gutkin for (argc = 0; argv[argc] != NULL; argc++) 49795b6dc79427b8f7eeb6a7ff68034ab8548ce670eaAlexander Gutkin ; 49805b6dc79427b8f7eeb6a7ff68034ab8548ce670eaAlexander Gutkin 49815b6dc79427b8f7eeb6a7ff68034ab8548ce670eaAlexander Gutkin /* Allocate new argument vector. */ 49825b6dc79427b8f7eeb6a7ff68034ab8548ce670eaAlexander Gutkin new_argv = XMALLOC (char *, argc + 1); 49835b6dc79427b8f7eeb6a7ff68034ab8548ce670eaAlexander Gutkin 49845b6dc79427b8f7eeb6a7ff68034ab8548ce670eaAlexander Gutkin /* Put quoted arguments into the new argument vector. */ 49855b6dc79427b8f7eeb6a7ff68034ab8548ce670eaAlexander Gutkin for (i = 0; i < argc; i++) 49865b6dc79427b8f7eeb6a7ff68034ab8548ce670eaAlexander Gutkin { 49875b6dc79427b8f7eeb6a7ff68034ab8548ce670eaAlexander Gutkin const char *string = argv[i]; 49885b6dc79427b8f7eeb6a7ff68034ab8548ce670eaAlexander Gutkin 49895b6dc79427b8f7eeb6a7ff68034ab8548ce670eaAlexander Gutkin if (string[0] == '\0') 49905b6dc79427b8f7eeb6a7ff68034ab8548ce670eaAlexander Gutkin new_argv[i] = xstrdup ("\"\""); 49915b6dc79427b8f7eeb6a7ff68034ab8548ce670eaAlexander Gutkin else if (strpbrk (string, SHELL_SPECIAL_CHARS) != NULL) 49925b6dc79427b8f7eeb6a7ff68034ab8548ce670eaAlexander Gutkin { 49935b6dc79427b8f7eeb6a7ff68034ab8548ce670eaAlexander Gutkin int quote_around = (strpbrk (string, SHELL_SPACE_CHARS) != NULL); 49945b6dc79427b8f7eeb6a7ff68034ab8548ce670eaAlexander Gutkin size_t length; 49955b6dc79427b8f7eeb6a7ff68034ab8548ce670eaAlexander Gutkin unsigned int backslashes; 49965b6dc79427b8f7eeb6a7ff68034ab8548ce670eaAlexander Gutkin const char *s; 49975b6dc79427b8f7eeb6a7ff68034ab8548ce670eaAlexander Gutkin char *quoted_string; 49985b6dc79427b8f7eeb6a7ff68034ab8548ce670eaAlexander Gutkin char *p; 49995b6dc79427b8f7eeb6a7ff68034ab8548ce670eaAlexander Gutkin 50005b6dc79427b8f7eeb6a7ff68034ab8548ce670eaAlexander Gutkin length = 0; 50015b6dc79427b8f7eeb6a7ff68034ab8548ce670eaAlexander Gutkin backslashes = 0; 50025b6dc79427b8f7eeb6a7ff68034ab8548ce670eaAlexander Gutkin if (quote_around) 50035b6dc79427b8f7eeb6a7ff68034ab8548ce670eaAlexander Gutkin length++; 50045b6dc79427b8f7eeb6a7ff68034ab8548ce670eaAlexander Gutkin for (s = string; *s != '\0'; s++) 50055b6dc79427b8f7eeb6a7ff68034ab8548ce670eaAlexander Gutkin { 50065b6dc79427b8f7eeb6a7ff68034ab8548ce670eaAlexander Gutkin char c = *s; 50075b6dc79427b8f7eeb6a7ff68034ab8548ce670eaAlexander Gutkin if (c == '"') 50085b6dc79427b8f7eeb6a7ff68034ab8548ce670eaAlexander Gutkin length += backslashes + 1; 50095b6dc79427b8f7eeb6a7ff68034ab8548ce670eaAlexander Gutkin length++; 50105b6dc79427b8f7eeb6a7ff68034ab8548ce670eaAlexander Gutkin if (c == '\\') 50115b6dc79427b8f7eeb6a7ff68034ab8548ce670eaAlexander Gutkin backslashes++; 50125b6dc79427b8f7eeb6a7ff68034ab8548ce670eaAlexander Gutkin else 50135b6dc79427b8f7eeb6a7ff68034ab8548ce670eaAlexander Gutkin backslashes = 0; 50145b6dc79427b8f7eeb6a7ff68034ab8548ce670eaAlexander Gutkin } 50155b6dc79427b8f7eeb6a7ff68034ab8548ce670eaAlexander Gutkin if (quote_around) 50165b6dc79427b8f7eeb6a7ff68034ab8548ce670eaAlexander Gutkin length += backslashes + 1; 50175b6dc79427b8f7eeb6a7ff68034ab8548ce670eaAlexander Gutkin 50185b6dc79427b8f7eeb6a7ff68034ab8548ce670eaAlexander Gutkin quoted_string = XMALLOC (char, length + 1); 50195b6dc79427b8f7eeb6a7ff68034ab8548ce670eaAlexander Gutkin 50205b6dc79427b8f7eeb6a7ff68034ab8548ce670eaAlexander Gutkin p = quoted_string; 50215b6dc79427b8f7eeb6a7ff68034ab8548ce670eaAlexander Gutkin backslashes = 0; 50225b6dc79427b8f7eeb6a7ff68034ab8548ce670eaAlexander Gutkin if (quote_around) 50235b6dc79427b8f7eeb6a7ff68034ab8548ce670eaAlexander Gutkin *p++ = '"'; 50245b6dc79427b8f7eeb6a7ff68034ab8548ce670eaAlexander Gutkin for (s = string; *s != '\0'; s++) 50255b6dc79427b8f7eeb6a7ff68034ab8548ce670eaAlexander Gutkin { 50265b6dc79427b8f7eeb6a7ff68034ab8548ce670eaAlexander Gutkin char c = *s; 50275b6dc79427b8f7eeb6a7ff68034ab8548ce670eaAlexander Gutkin if (c == '"') 50285b6dc79427b8f7eeb6a7ff68034ab8548ce670eaAlexander Gutkin { 50295b6dc79427b8f7eeb6a7ff68034ab8548ce670eaAlexander Gutkin unsigned int j; 50305b6dc79427b8f7eeb6a7ff68034ab8548ce670eaAlexander Gutkin for (j = backslashes + 1; j > 0; j--) 50315b6dc79427b8f7eeb6a7ff68034ab8548ce670eaAlexander Gutkin *p++ = '\\'; 50325b6dc79427b8f7eeb6a7ff68034ab8548ce670eaAlexander Gutkin } 50335b6dc79427b8f7eeb6a7ff68034ab8548ce670eaAlexander Gutkin *p++ = c; 50345b6dc79427b8f7eeb6a7ff68034ab8548ce670eaAlexander Gutkin if (c == '\\') 50355b6dc79427b8f7eeb6a7ff68034ab8548ce670eaAlexander Gutkin backslashes++; 50365b6dc79427b8f7eeb6a7ff68034ab8548ce670eaAlexander Gutkin else 50375b6dc79427b8f7eeb6a7ff68034ab8548ce670eaAlexander Gutkin backslashes = 0; 50385b6dc79427b8f7eeb6a7ff68034ab8548ce670eaAlexander Gutkin } 50395b6dc79427b8f7eeb6a7ff68034ab8548ce670eaAlexander Gutkin if (quote_around) 50405b6dc79427b8f7eeb6a7ff68034ab8548ce670eaAlexander Gutkin { 50415b6dc79427b8f7eeb6a7ff68034ab8548ce670eaAlexander Gutkin unsigned int j; 50425b6dc79427b8f7eeb6a7ff68034ab8548ce670eaAlexander Gutkin for (j = backslashes; j > 0; j--) 50435b6dc79427b8f7eeb6a7ff68034ab8548ce670eaAlexander Gutkin *p++ = '\\'; 50445b6dc79427b8f7eeb6a7ff68034ab8548ce670eaAlexander Gutkin *p++ = '"'; 50455b6dc79427b8f7eeb6a7ff68034ab8548ce670eaAlexander Gutkin } 50465b6dc79427b8f7eeb6a7ff68034ab8548ce670eaAlexander Gutkin *p = '\0'; 50475b6dc79427b8f7eeb6a7ff68034ab8548ce670eaAlexander Gutkin 50485b6dc79427b8f7eeb6a7ff68034ab8548ce670eaAlexander Gutkin new_argv[i] = quoted_string; 50495b6dc79427b8f7eeb6a7ff68034ab8548ce670eaAlexander Gutkin } 50505b6dc79427b8f7eeb6a7ff68034ab8548ce670eaAlexander Gutkin else 50515b6dc79427b8f7eeb6a7ff68034ab8548ce670eaAlexander Gutkin new_argv[i] = (char *) string; 50525b6dc79427b8f7eeb6a7ff68034ab8548ce670eaAlexander Gutkin } 50535b6dc79427b8f7eeb6a7ff68034ab8548ce670eaAlexander Gutkin new_argv[argc] = NULL; 50545b6dc79427b8f7eeb6a7ff68034ab8548ce670eaAlexander Gutkin 50555b6dc79427b8f7eeb6a7ff68034ab8548ce670eaAlexander Gutkin return new_argv; 50565b6dc79427b8f7eeb6a7ff68034ab8548ce670eaAlexander Gutkin} 50575b6dc79427b8f7eeb6a7ff68034ab8548ce670eaAlexander GutkinEOF 50585b6dc79427b8f7eeb6a7ff68034ab8548ce670eaAlexander Gutkin ;; 50595b6dc79427b8f7eeb6a7ff68034ab8548ce670eaAlexander Gutkin esac 5060f4c12fce1ee58e670f9c3fce46c40296ba9ee8a2Ian Hodson 50615b6dc79427b8f7eeb6a7ff68034ab8548ce670eaAlexander Gutkin cat <<"EOF" 50625b6dc79427b8f7eeb6a7ff68034ab8548ce670eaAlexander Gutkinvoid lt_dump_script (FILE* f) 50635b6dc79427b8f7eeb6a7ff68034ab8548ce670eaAlexander Gutkin{ 50645b6dc79427b8f7eeb6a7ff68034ab8548ce670eaAlexander GutkinEOF 50655b6dc79427b8f7eeb6a7ff68034ab8548ce670eaAlexander Gutkin func_emit_wrapper yes | 50665b6dc79427b8f7eeb6a7ff68034ab8548ce670eaAlexander Gutkin $SED -n -e ' 50675b6dc79427b8f7eeb6a7ff68034ab8548ce670eaAlexander Gutkins/^\(.\{79\}\)\(..*\)/\1\ 50685b6dc79427b8f7eeb6a7ff68034ab8548ce670eaAlexander Gutkin\2/ 50695b6dc79427b8f7eeb6a7ff68034ab8548ce670eaAlexander Gutkinh 50705b6dc79427b8f7eeb6a7ff68034ab8548ce670eaAlexander Gutkins/\([\\"]\)/\\\1/g 50715b6dc79427b8f7eeb6a7ff68034ab8548ce670eaAlexander Gutkins/$/\\n/ 50725b6dc79427b8f7eeb6a7ff68034ab8548ce670eaAlexander Gutkins/\([^\n]*\).*/ fputs ("\1", f);/p 50735b6dc79427b8f7eeb6a7ff68034ab8548ce670eaAlexander Gutking 50745b6dc79427b8f7eeb6a7ff68034ab8548ce670eaAlexander GutkinD' 50755b6dc79427b8f7eeb6a7ff68034ab8548ce670eaAlexander Gutkin cat <<"EOF" 50765b6dc79427b8f7eeb6a7ff68034ab8548ce670eaAlexander Gutkin} 5077f4c12fce1ee58e670f9c3fce46c40296ba9ee8a2Ian HodsonEOF 5078f4c12fce1ee58e670f9c3fce46c40296ba9ee8a2Ian Hodson} 5079f4c12fce1ee58e670f9c3fce46c40296ba9ee8a2Ian Hodson# end: func_emit_cwrapperexe_src 5080f4c12fce1ee58e670f9c3fce46c40296ba9ee8a2Ian Hodson 50815b6dc79427b8f7eeb6a7ff68034ab8548ce670eaAlexander Gutkin# func_win32_import_lib_p ARG 50825b6dc79427b8f7eeb6a7ff68034ab8548ce670eaAlexander Gutkin# True if ARG is an import lib, as indicated by $file_magic_cmd 50835b6dc79427b8f7eeb6a7ff68034ab8548ce670eaAlexander Gutkinfunc_win32_import_lib_p () 50845b6dc79427b8f7eeb6a7ff68034ab8548ce670eaAlexander Gutkin{ 50855b6dc79427b8f7eeb6a7ff68034ab8548ce670eaAlexander Gutkin $opt_debug 50865b6dc79427b8f7eeb6a7ff68034ab8548ce670eaAlexander Gutkin case `eval $file_magic_cmd \"\$1\" 2>/dev/null | $SED -e 10q` in 50875b6dc79427b8f7eeb6a7ff68034ab8548ce670eaAlexander Gutkin *import*) : ;; 50885b6dc79427b8f7eeb6a7ff68034ab8548ce670eaAlexander Gutkin *) false ;; 50895b6dc79427b8f7eeb6a7ff68034ab8548ce670eaAlexander Gutkin esac 50905b6dc79427b8f7eeb6a7ff68034ab8548ce670eaAlexander Gutkin} 50915b6dc79427b8f7eeb6a7ff68034ab8548ce670eaAlexander Gutkin 5092f4c12fce1ee58e670f9c3fce46c40296ba9ee8a2Ian Hodson# func_mode_link arg... 5093f4c12fce1ee58e670f9c3fce46c40296ba9ee8a2Ian Hodsonfunc_mode_link () 5094f4c12fce1ee58e670f9c3fce46c40296ba9ee8a2Ian Hodson{ 5095f4c12fce1ee58e670f9c3fce46c40296ba9ee8a2Ian Hodson $opt_debug 5096f4c12fce1ee58e670f9c3fce46c40296ba9ee8a2Ian Hodson case $host in 5097f4c12fce1ee58e670f9c3fce46c40296ba9ee8a2Ian Hodson *-*-cygwin* | *-*-mingw* | *-*-pw32* | *-*-os2* | *-cegcc*) 5098f4c12fce1ee58e670f9c3fce46c40296ba9ee8a2Ian Hodson # It is impossible to link a dll without this setting, and 5099f4c12fce1ee58e670f9c3fce46c40296ba9ee8a2Ian Hodson # we shouldn't force the makefile maintainer to figure out 5100f4c12fce1ee58e670f9c3fce46c40296ba9ee8a2Ian Hodson # which system we are compiling for in order to pass an extra 5101f4c12fce1ee58e670f9c3fce46c40296ba9ee8a2Ian Hodson # flag for every libtool invocation. 5102f4c12fce1ee58e670f9c3fce46c40296ba9ee8a2Ian Hodson # allow_undefined=no 5103f4c12fce1ee58e670f9c3fce46c40296ba9ee8a2Ian Hodson 5104f4c12fce1ee58e670f9c3fce46c40296ba9ee8a2Ian Hodson # FIXME: Unfortunately, there are problems with the above when trying 5105f4c12fce1ee58e670f9c3fce46c40296ba9ee8a2Ian Hodson # to make a dll which has undefined symbols, in which case not 5106f4c12fce1ee58e670f9c3fce46c40296ba9ee8a2Ian Hodson # even a static library is built. For now, we need to specify 5107f4c12fce1ee58e670f9c3fce46c40296ba9ee8a2Ian Hodson # -no-undefined on the libtool link line when we can be certain 5108f4c12fce1ee58e670f9c3fce46c40296ba9ee8a2Ian Hodson # that all symbols are satisfied, otherwise we get a static library. 5109f4c12fce1ee58e670f9c3fce46c40296ba9ee8a2Ian Hodson allow_undefined=yes 5110f4c12fce1ee58e670f9c3fce46c40296ba9ee8a2Ian Hodson ;; 5111f4c12fce1ee58e670f9c3fce46c40296ba9ee8a2Ian Hodson *) 5112f4c12fce1ee58e670f9c3fce46c40296ba9ee8a2Ian Hodson allow_undefined=yes 5113f4c12fce1ee58e670f9c3fce46c40296ba9ee8a2Ian Hodson ;; 5114f4c12fce1ee58e670f9c3fce46c40296ba9ee8a2Ian Hodson esac 5115f4c12fce1ee58e670f9c3fce46c40296ba9ee8a2Ian Hodson libtool_args=$nonopt 5116f4c12fce1ee58e670f9c3fce46c40296ba9ee8a2Ian Hodson base_compile="$nonopt $@" 5117f4c12fce1ee58e670f9c3fce46c40296ba9ee8a2Ian Hodson compile_command=$nonopt 5118f4c12fce1ee58e670f9c3fce46c40296ba9ee8a2Ian Hodson finalize_command=$nonopt 5119f4c12fce1ee58e670f9c3fce46c40296ba9ee8a2Ian Hodson 5120f4c12fce1ee58e670f9c3fce46c40296ba9ee8a2Ian Hodson compile_rpath= 5121f4c12fce1ee58e670f9c3fce46c40296ba9ee8a2Ian Hodson finalize_rpath= 5122f4c12fce1ee58e670f9c3fce46c40296ba9ee8a2Ian Hodson compile_shlibpath= 5123f4c12fce1ee58e670f9c3fce46c40296ba9ee8a2Ian Hodson finalize_shlibpath= 5124f4c12fce1ee58e670f9c3fce46c40296ba9ee8a2Ian Hodson convenience= 5125f4c12fce1ee58e670f9c3fce46c40296ba9ee8a2Ian Hodson old_convenience= 5126f4c12fce1ee58e670f9c3fce46c40296ba9ee8a2Ian Hodson deplibs= 5127f4c12fce1ee58e670f9c3fce46c40296ba9ee8a2Ian Hodson old_deplibs= 5128f4c12fce1ee58e670f9c3fce46c40296ba9ee8a2Ian Hodson compiler_flags= 5129f4c12fce1ee58e670f9c3fce46c40296ba9ee8a2Ian Hodson linker_flags= 5130f4c12fce1ee58e670f9c3fce46c40296ba9ee8a2Ian Hodson dllsearchpath= 5131f4c12fce1ee58e670f9c3fce46c40296ba9ee8a2Ian Hodson lib_search_path=`pwd` 5132f4c12fce1ee58e670f9c3fce46c40296ba9ee8a2Ian Hodson inst_prefix_dir= 5133f4c12fce1ee58e670f9c3fce46c40296ba9ee8a2Ian Hodson new_inherited_linker_flags= 5134f4c12fce1ee58e670f9c3fce46c40296ba9ee8a2Ian Hodson 5135f4c12fce1ee58e670f9c3fce46c40296ba9ee8a2Ian Hodson avoid_version=no 51365b6dc79427b8f7eeb6a7ff68034ab8548ce670eaAlexander Gutkin bindir= 5137f4c12fce1ee58e670f9c3fce46c40296ba9ee8a2Ian Hodson dlfiles= 5138f4c12fce1ee58e670f9c3fce46c40296ba9ee8a2Ian Hodson dlprefiles= 5139f4c12fce1ee58e670f9c3fce46c40296ba9ee8a2Ian Hodson dlself=no 5140f4c12fce1ee58e670f9c3fce46c40296ba9ee8a2Ian Hodson export_dynamic=no 5141f4c12fce1ee58e670f9c3fce46c40296ba9ee8a2Ian Hodson export_symbols= 5142f4c12fce1ee58e670f9c3fce46c40296ba9ee8a2Ian Hodson export_symbols_regex= 5143f4c12fce1ee58e670f9c3fce46c40296ba9ee8a2Ian Hodson generated= 5144f4c12fce1ee58e670f9c3fce46c40296ba9ee8a2Ian Hodson libobjs= 5145f4c12fce1ee58e670f9c3fce46c40296ba9ee8a2Ian Hodson ltlibs= 5146f4c12fce1ee58e670f9c3fce46c40296ba9ee8a2Ian Hodson module=no 5147f4c12fce1ee58e670f9c3fce46c40296ba9ee8a2Ian Hodson no_install=no 5148f4c12fce1ee58e670f9c3fce46c40296ba9ee8a2Ian Hodson objs= 5149f4c12fce1ee58e670f9c3fce46c40296ba9ee8a2Ian Hodson non_pic_objects= 5150f4c12fce1ee58e670f9c3fce46c40296ba9ee8a2Ian Hodson precious_files_regex= 5151f4c12fce1ee58e670f9c3fce46c40296ba9ee8a2Ian Hodson prefer_static_libs=no 5152f4c12fce1ee58e670f9c3fce46c40296ba9ee8a2Ian Hodson preload=no 5153f4c12fce1ee58e670f9c3fce46c40296ba9ee8a2Ian Hodson prev= 5154f4c12fce1ee58e670f9c3fce46c40296ba9ee8a2Ian Hodson prevarg= 5155f4c12fce1ee58e670f9c3fce46c40296ba9ee8a2Ian Hodson release= 5156f4c12fce1ee58e670f9c3fce46c40296ba9ee8a2Ian Hodson rpath= 5157f4c12fce1ee58e670f9c3fce46c40296ba9ee8a2Ian Hodson xrpath= 5158f4c12fce1ee58e670f9c3fce46c40296ba9ee8a2Ian Hodson perm_rpath= 5159f4c12fce1ee58e670f9c3fce46c40296ba9ee8a2Ian Hodson temp_rpath= 5160f4c12fce1ee58e670f9c3fce46c40296ba9ee8a2Ian Hodson thread_safe=no 5161f4c12fce1ee58e670f9c3fce46c40296ba9ee8a2Ian Hodson vinfo= 5162f4c12fce1ee58e670f9c3fce46c40296ba9ee8a2Ian Hodson vinfo_number=no 5163f4c12fce1ee58e670f9c3fce46c40296ba9ee8a2Ian Hodson weak_libs= 5164f4c12fce1ee58e670f9c3fce46c40296ba9ee8a2Ian Hodson single_module="${wl}-single_module" 5165f4c12fce1ee58e670f9c3fce46c40296ba9ee8a2Ian Hodson func_infer_tag $base_compile 5166f4c12fce1ee58e670f9c3fce46c40296ba9ee8a2Ian Hodson 5167f4c12fce1ee58e670f9c3fce46c40296ba9ee8a2Ian Hodson # We need to know -static, to get the right output filenames. 5168f4c12fce1ee58e670f9c3fce46c40296ba9ee8a2Ian Hodson for arg 5169f4c12fce1ee58e670f9c3fce46c40296ba9ee8a2Ian Hodson do 5170f4c12fce1ee58e670f9c3fce46c40296ba9ee8a2Ian Hodson case $arg in 5171f4c12fce1ee58e670f9c3fce46c40296ba9ee8a2Ian Hodson -shared) 5172f4c12fce1ee58e670f9c3fce46c40296ba9ee8a2Ian Hodson test "$build_libtool_libs" != yes && \ 5173f4c12fce1ee58e670f9c3fce46c40296ba9ee8a2Ian Hodson func_fatal_configuration "can not build a shared library" 5174f4c12fce1ee58e670f9c3fce46c40296ba9ee8a2Ian Hodson build_old_libs=no 5175f4c12fce1ee58e670f9c3fce46c40296ba9ee8a2Ian Hodson break 5176f4c12fce1ee58e670f9c3fce46c40296ba9ee8a2Ian Hodson ;; 5177f4c12fce1ee58e670f9c3fce46c40296ba9ee8a2Ian Hodson -all-static | -static | -static-libtool-libs) 5178f4c12fce1ee58e670f9c3fce46c40296ba9ee8a2Ian Hodson case $arg in 5179f4c12fce1ee58e670f9c3fce46c40296ba9ee8a2Ian Hodson -all-static) 5180f4c12fce1ee58e670f9c3fce46c40296ba9ee8a2Ian Hodson if test "$build_libtool_libs" = yes && test -z "$link_static_flag"; then 5181f4c12fce1ee58e670f9c3fce46c40296ba9ee8a2Ian Hodson func_warning "complete static linking is impossible in this configuration" 5182f4c12fce1ee58e670f9c3fce46c40296ba9ee8a2Ian Hodson fi 5183f4c12fce1ee58e670f9c3fce46c40296ba9ee8a2Ian Hodson if test -n "$link_static_flag"; then 5184f4c12fce1ee58e670f9c3fce46c40296ba9ee8a2Ian Hodson dlopen_self=$dlopen_self_static 5185f4c12fce1ee58e670f9c3fce46c40296ba9ee8a2Ian Hodson fi 5186f4c12fce1ee58e670f9c3fce46c40296ba9ee8a2Ian Hodson prefer_static_libs=yes 5187f4c12fce1ee58e670f9c3fce46c40296ba9ee8a2Ian Hodson ;; 5188f4c12fce1ee58e670f9c3fce46c40296ba9ee8a2Ian Hodson -static) 5189f4c12fce1ee58e670f9c3fce46c40296ba9ee8a2Ian Hodson if test -z "$pic_flag" && test -n "$link_static_flag"; then 5190f4c12fce1ee58e670f9c3fce46c40296ba9ee8a2Ian Hodson dlopen_self=$dlopen_self_static 5191f4c12fce1ee58e670f9c3fce46c40296ba9ee8a2Ian Hodson fi 5192f4c12fce1ee58e670f9c3fce46c40296ba9ee8a2Ian Hodson prefer_static_libs=built 5193f4c12fce1ee58e670f9c3fce46c40296ba9ee8a2Ian Hodson ;; 5194f4c12fce1ee58e670f9c3fce46c40296ba9ee8a2Ian Hodson -static-libtool-libs) 5195f4c12fce1ee58e670f9c3fce46c40296ba9ee8a2Ian Hodson if test -z "$pic_flag" && test -n "$link_static_flag"; then 5196f4c12fce1ee58e670f9c3fce46c40296ba9ee8a2Ian Hodson dlopen_self=$dlopen_self_static 5197f4c12fce1ee58e670f9c3fce46c40296ba9ee8a2Ian Hodson fi 5198f4c12fce1ee58e670f9c3fce46c40296ba9ee8a2Ian Hodson prefer_static_libs=yes 5199f4c12fce1ee58e670f9c3fce46c40296ba9ee8a2Ian Hodson ;; 5200f4c12fce1ee58e670f9c3fce46c40296ba9ee8a2Ian Hodson esac 5201f4c12fce1ee58e670f9c3fce46c40296ba9ee8a2Ian Hodson build_libtool_libs=no 5202f4c12fce1ee58e670f9c3fce46c40296ba9ee8a2Ian Hodson build_old_libs=yes 5203f4c12fce1ee58e670f9c3fce46c40296ba9ee8a2Ian Hodson break 5204f4c12fce1ee58e670f9c3fce46c40296ba9ee8a2Ian Hodson ;; 5205f4c12fce1ee58e670f9c3fce46c40296ba9ee8a2Ian Hodson esac 5206f4c12fce1ee58e670f9c3fce46c40296ba9ee8a2Ian Hodson done 5207f4c12fce1ee58e670f9c3fce46c40296ba9ee8a2Ian Hodson 5208f4c12fce1ee58e670f9c3fce46c40296ba9ee8a2Ian Hodson # See if our shared archives depend on static archives. 5209f4c12fce1ee58e670f9c3fce46c40296ba9ee8a2Ian Hodson test -n "$old_archive_from_new_cmds" && build_old_libs=yes 5210f4c12fce1ee58e670f9c3fce46c40296ba9ee8a2Ian Hodson 5211f4c12fce1ee58e670f9c3fce46c40296ba9ee8a2Ian Hodson # Go through the arguments, transforming them on the way. 5212f4c12fce1ee58e670f9c3fce46c40296ba9ee8a2Ian Hodson while test "$#" -gt 0; do 5213f4c12fce1ee58e670f9c3fce46c40296ba9ee8a2Ian Hodson arg="$1" 5214f4c12fce1ee58e670f9c3fce46c40296ba9ee8a2Ian Hodson shift 5215f4c12fce1ee58e670f9c3fce46c40296ba9ee8a2Ian Hodson func_quote_for_eval "$arg" 5216f4c12fce1ee58e670f9c3fce46c40296ba9ee8a2Ian Hodson qarg=$func_quote_for_eval_unquoted_result 5217f4c12fce1ee58e670f9c3fce46c40296ba9ee8a2Ian Hodson func_append libtool_args " $func_quote_for_eval_result" 5218f4c12fce1ee58e670f9c3fce46c40296ba9ee8a2Ian Hodson 5219f4c12fce1ee58e670f9c3fce46c40296ba9ee8a2Ian Hodson # If the previous option needs an argument, assign it. 5220f4c12fce1ee58e670f9c3fce46c40296ba9ee8a2Ian Hodson if test -n "$prev"; then 5221f4c12fce1ee58e670f9c3fce46c40296ba9ee8a2Ian Hodson case $prev in 5222f4c12fce1ee58e670f9c3fce46c40296ba9ee8a2Ian Hodson output) 5223f4c12fce1ee58e670f9c3fce46c40296ba9ee8a2Ian Hodson func_append compile_command " @OUTPUT@" 5224f4c12fce1ee58e670f9c3fce46c40296ba9ee8a2Ian Hodson func_append finalize_command " @OUTPUT@" 5225f4c12fce1ee58e670f9c3fce46c40296ba9ee8a2Ian Hodson ;; 5226f4c12fce1ee58e670f9c3fce46c40296ba9ee8a2Ian Hodson esac 5227f4c12fce1ee58e670f9c3fce46c40296ba9ee8a2Ian Hodson 5228f4c12fce1ee58e670f9c3fce46c40296ba9ee8a2Ian Hodson case $prev in 52295b6dc79427b8f7eeb6a7ff68034ab8548ce670eaAlexander Gutkin bindir) 52305b6dc79427b8f7eeb6a7ff68034ab8548ce670eaAlexander Gutkin bindir="$arg" 52315b6dc79427b8f7eeb6a7ff68034ab8548ce670eaAlexander Gutkin prev= 52325b6dc79427b8f7eeb6a7ff68034ab8548ce670eaAlexander Gutkin continue 52335b6dc79427b8f7eeb6a7ff68034ab8548ce670eaAlexander Gutkin ;; 5234f4c12fce1ee58e670f9c3fce46c40296ba9ee8a2Ian Hodson dlfiles|dlprefiles) 5235f4c12fce1ee58e670f9c3fce46c40296ba9ee8a2Ian Hodson if test "$preload" = no; then 5236f4c12fce1ee58e670f9c3fce46c40296ba9ee8a2Ian Hodson # Add the symbol object into the linking commands. 5237f4c12fce1ee58e670f9c3fce46c40296ba9ee8a2Ian Hodson func_append compile_command " @SYMFILE@" 5238f4c12fce1ee58e670f9c3fce46c40296ba9ee8a2Ian Hodson func_append finalize_command " @SYMFILE@" 5239f4c12fce1ee58e670f9c3fce46c40296ba9ee8a2Ian Hodson preload=yes 5240f4c12fce1ee58e670f9c3fce46c40296ba9ee8a2Ian Hodson fi 5241f4c12fce1ee58e670f9c3fce46c40296ba9ee8a2Ian Hodson case $arg in 5242f4c12fce1ee58e670f9c3fce46c40296ba9ee8a2Ian Hodson *.la | *.lo) ;; # We handle these cases below. 5243f4c12fce1ee58e670f9c3fce46c40296ba9ee8a2Ian Hodson force) 5244f4c12fce1ee58e670f9c3fce46c40296ba9ee8a2Ian Hodson if test "$dlself" = no; then 5245f4c12fce1ee58e670f9c3fce46c40296ba9ee8a2Ian Hodson dlself=needless 5246f4c12fce1ee58e670f9c3fce46c40296ba9ee8a2Ian Hodson export_dynamic=yes 5247f4c12fce1ee58e670f9c3fce46c40296ba9ee8a2Ian Hodson fi 5248f4c12fce1ee58e670f9c3fce46c40296ba9ee8a2Ian Hodson prev= 5249f4c12fce1ee58e670f9c3fce46c40296ba9ee8a2Ian Hodson continue 5250f4c12fce1ee58e670f9c3fce46c40296ba9ee8a2Ian Hodson ;; 5251f4c12fce1ee58e670f9c3fce46c40296ba9ee8a2Ian Hodson self) 5252f4c12fce1ee58e670f9c3fce46c40296ba9ee8a2Ian Hodson if test "$prev" = dlprefiles; then 5253f4c12fce1ee58e670f9c3fce46c40296ba9ee8a2Ian Hodson dlself=yes 5254f4c12fce1ee58e670f9c3fce46c40296ba9ee8a2Ian Hodson elif test "$prev" = dlfiles && test "$dlopen_self" != yes; then 5255f4c12fce1ee58e670f9c3fce46c40296ba9ee8a2Ian Hodson dlself=yes 5256f4c12fce1ee58e670f9c3fce46c40296ba9ee8a2Ian Hodson else 5257f4c12fce1ee58e670f9c3fce46c40296ba9ee8a2Ian Hodson dlself=needless 5258f4c12fce1ee58e670f9c3fce46c40296ba9ee8a2Ian Hodson export_dynamic=yes 5259f4c12fce1ee58e670f9c3fce46c40296ba9ee8a2Ian Hodson fi 5260f4c12fce1ee58e670f9c3fce46c40296ba9ee8a2Ian Hodson prev= 5261f4c12fce1ee58e670f9c3fce46c40296ba9ee8a2Ian Hodson continue 5262f4c12fce1ee58e670f9c3fce46c40296ba9ee8a2Ian Hodson ;; 5263f4c12fce1ee58e670f9c3fce46c40296ba9ee8a2Ian Hodson *) 5264f4c12fce1ee58e670f9c3fce46c40296ba9ee8a2Ian Hodson if test "$prev" = dlfiles; then 52655b6dc79427b8f7eeb6a7ff68034ab8548ce670eaAlexander Gutkin func_append dlfiles " $arg" 5266f4c12fce1ee58e670f9c3fce46c40296ba9ee8a2Ian Hodson else 52675b6dc79427b8f7eeb6a7ff68034ab8548ce670eaAlexander Gutkin func_append dlprefiles " $arg" 5268f4c12fce1ee58e670f9c3fce46c40296ba9ee8a2Ian Hodson fi 5269f4c12fce1ee58e670f9c3fce46c40296ba9ee8a2Ian Hodson prev= 5270f4c12fce1ee58e670f9c3fce46c40296ba9ee8a2Ian Hodson continue 5271f4c12fce1ee58e670f9c3fce46c40296ba9ee8a2Ian Hodson ;; 5272f4c12fce1ee58e670f9c3fce46c40296ba9ee8a2Ian Hodson esac 5273f4c12fce1ee58e670f9c3fce46c40296ba9ee8a2Ian Hodson ;; 5274f4c12fce1ee58e670f9c3fce46c40296ba9ee8a2Ian Hodson expsyms) 5275f4c12fce1ee58e670f9c3fce46c40296ba9ee8a2Ian Hodson export_symbols="$arg" 5276f4c12fce1ee58e670f9c3fce46c40296ba9ee8a2Ian Hodson test -f "$arg" \ 5277f4c12fce1ee58e670f9c3fce46c40296ba9ee8a2Ian Hodson || func_fatal_error "symbol file \`$arg' does not exist" 5278f4c12fce1ee58e670f9c3fce46c40296ba9ee8a2Ian Hodson prev= 5279f4c12fce1ee58e670f9c3fce46c40296ba9ee8a2Ian Hodson continue 5280f4c12fce1ee58e670f9c3fce46c40296ba9ee8a2Ian Hodson ;; 5281f4c12fce1ee58e670f9c3fce46c40296ba9ee8a2Ian Hodson expsyms_regex) 5282f4c12fce1ee58e670f9c3fce46c40296ba9ee8a2Ian Hodson export_symbols_regex="$arg" 5283f4c12fce1ee58e670f9c3fce46c40296ba9ee8a2Ian Hodson prev= 5284f4c12fce1ee58e670f9c3fce46c40296ba9ee8a2Ian Hodson continue 5285f4c12fce1ee58e670f9c3fce46c40296ba9ee8a2Ian Hodson ;; 5286f4c12fce1ee58e670f9c3fce46c40296ba9ee8a2Ian Hodson framework) 5287f4c12fce1ee58e670f9c3fce46c40296ba9ee8a2Ian Hodson case $host in 5288f4c12fce1ee58e670f9c3fce46c40296ba9ee8a2Ian Hodson *-*-darwin*) 5289f4c12fce1ee58e670f9c3fce46c40296ba9ee8a2Ian Hodson case "$deplibs " in 5290f4c12fce1ee58e670f9c3fce46c40296ba9ee8a2Ian Hodson *" $qarg.ltframework "*) ;; 52915b6dc79427b8f7eeb6a7ff68034ab8548ce670eaAlexander Gutkin *) func_append deplibs " $qarg.ltframework" # this is fixed later 5292f4c12fce1ee58e670f9c3fce46c40296ba9ee8a2Ian Hodson ;; 5293f4c12fce1ee58e670f9c3fce46c40296ba9ee8a2Ian Hodson esac 5294f4c12fce1ee58e670f9c3fce46c40296ba9ee8a2Ian Hodson ;; 5295f4c12fce1ee58e670f9c3fce46c40296ba9ee8a2Ian Hodson esac 5296f4c12fce1ee58e670f9c3fce46c40296ba9ee8a2Ian Hodson prev= 5297f4c12fce1ee58e670f9c3fce46c40296ba9ee8a2Ian Hodson continue 5298f4c12fce1ee58e670f9c3fce46c40296ba9ee8a2Ian Hodson ;; 5299f4c12fce1ee58e670f9c3fce46c40296ba9ee8a2Ian Hodson inst_prefix) 5300f4c12fce1ee58e670f9c3fce46c40296ba9ee8a2Ian Hodson inst_prefix_dir="$arg" 5301f4c12fce1ee58e670f9c3fce46c40296ba9ee8a2Ian Hodson prev= 5302f4c12fce1ee58e670f9c3fce46c40296ba9ee8a2Ian Hodson continue 5303f4c12fce1ee58e670f9c3fce46c40296ba9ee8a2Ian Hodson ;; 5304f4c12fce1ee58e670f9c3fce46c40296ba9ee8a2Ian Hodson objectlist) 5305f4c12fce1ee58e670f9c3fce46c40296ba9ee8a2Ian Hodson if test -f "$arg"; then 5306f4c12fce1ee58e670f9c3fce46c40296ba9ee8a2Ian Hodson save_arg=$arg 5307f4c12fce1ee58e670f9c3fce46c40296ba9ee8a2Ian Hodson moreargs= 5308f4c12fce1ee58e670f9c3fce46c40296ba9ee8a2Ian Hodson for fil in `cat "$save_arg"` 5309f4c12fce1ee58e670f9c3fce46c40296ba9ee8a2Ian Hodson do 53105b6dc79427b8f7eeb6a7ff68034ab8548ce670eaAlexander Gutkin# func_append moreargs " $fil" 5311f4c12fce1ee58e670f9c3fce46c40296ba9ee8a2Ian Hodson arg=$fil 5312f4c12fce1ee58e670f9c3fce46c40296ba9ee8a2Ian Hodson # A libtool-controlled object. 5313f4c12fce1ee58e670f9c3fce46c40296ba9ee8a2Ian Hodson 5314f4c12fce1ee58e670f9c3fce46c40296ba9ee8a2Ian Hodson # Check to see that this really is a libtool object. 5315f4c12fce1ee58e670f9c3fce46c40296ba9ee8a2Ian Hodson if func_lalib_unsafe_p "$arg"; then 5316f4c12fce1ee58e670f9c3fce46c40296ba9ee8a2Ian Hodson pic_object= 5317f4c12fce1ee58e670f9c3fce46c40296ba9ee8a2Ian Hodson non_pic_object= 5318f4c12fce1ee58e670f9c3fce46c40296ba9ee8a2Ian Hodson 5319f4c12fce1ee58e670f9c3fce46c40296ba9ee8a2Ian Hodson # Read the .lo file 5320f4c12fce1ee58e670f9c3fce46c40296ba9ee8a2Ian Hodson func_source "$arg" 5321f4c12fce1ee58e670f9c3fce46c40296ba9ee8a2Ian Hodson 5322f4c12fce1ee58e670f9c3fce46c40296ba9ee8a2Ian Hodson if test -z "$pic_object" || 5323f4c12fce1ee58e670f9c3fce46c40296ba9ee8a2Ian Hodson test -z "$non_pic_object" || 5324f4c12fce1ee58e670f9c3fce46c40296ba9ee8a2Ian Hodson test "$pic_object" = none && 5325f4c12fce1ee58e670f9c3fce46c40296ba9ee8a2Ian Hodson test "$non_pic_object" = none; then 5326f4c12fce1ee58e670f9c3fce46c40296ba9ee8a2Ian Hodson func_fatal_error "cannot find name of object for \`$arg'" 5327f4c12fce1ee58e670f9c3fce46c40296ba9ee8a2Ian Hodson fi 5328f4c12fce1ee58e670f9c3fce46c40296ba9ee8a2Ian Hodson 5329f4c12fce1ee58e670f9c3fce46c40296ba9ee8a2Ian Hodson # Extract subdirectory from the argument. 5330f4c12fce1ee58e670f9c3fce46c40296ba9ee8a2Ian Hodson func_dirname "$arg" "/" "" 5331f4c12fce1ee58e670f9c3fce46c40296ba9ee8a2Ian Hodson xdir="$func_dirname_result" 5332f4c12fce1ee58e670f9c3fce46c40296ba9ee8a2Ian Hodson 5333f4c12fce1ee58e670f9c3fce46c40296ba9ee8a2Ian Hodson if test "$pic_object" != none; then 5334f4c12fce1ee58e670f9c3fce46c40296ba9ee8a2Ian Hodson # Prepend the subdirectory the object is found in. 5335f4c12fce1ee58e670f9c3fce46c40296ba9ee8a2Ian Hodson pic_object="$xdir$pic_object" 5336f4c12fce1ee58e670f9c3fce46c40296ba9ee8a2Ian Hodson 5337f4c12fce1ee58e670f9c3fce46c40296ba9ee8a2Ian Hodson if test "$prev" = dlfiles; then 5338f4c12fce1ee58e670f9c3fce46c40296ba9ee8a2Ian Hodson if test "$build_libtool_libs" = yes && test "$dlopen_support" = yes; then 53395b6dc79427b8f7eeb6a7ff68034ab8548ce670eaAlexander Gutkin func_append dlfiles " $pic_object" 5340f4c12fce1ee58e670f9c3fce46c40296ba9ee8a2Ian Hodson prev= 5341f4c12fce1ee58e670f9c3fce46c40296ba9ee8a2Ian Hodson continue 5342f4c12fce1ee58e670f9c3fce46c40296ba9ee8a2Ian Hodson else 5343f4c12fce1ee58e670f9c3fce46c40296ba9ee8a2Ian Hodson # If libtool objects are unsupported, then we need to preload. 5344f4c12fce1ee58e670f9c3fce46c40296ba9ee8a2Ian Hodson prev=dlprefiles 5345f4c12fce1ee58e670f9c3fce46c40296ba9ee8a2Ian Hodson fi 5346f4c12fce1ee58e670f9c3fce46c40296ba9ee8a2Ian Hodson fi 5347f4c12fce1ee58e670f9c3fce46c40296ba9ee8a2Ian Hodson 5348f4c12fce1ee58e670f9c3fce46c40296ba9ee8a2Ian Hodson # CHECK ME: I think I busted this. -Ossama 5349f4c12fce1ee58e670f9c3fce46c40296ba9ee8a2Ian Hodson if test "$prev" = dlprefiles; then 5350f4c12fce1ee58e670f9c3fce46c40296ba9ee8a2Ian Hodson # Preload the old-style object. 53515b6dc79427b8f7eeb6a7ff68034ab8548ce670eaAlexander Gutkin func_append dlprefiles " $pic_object" 5352f4c12fce1ee58e670f9c3fce46c40296ba9ee8a2Ian Hodson prev= 5353f4c12fce1ee58e670f9c3fce46c40296ba9ee8a2Ian Hodson fi 5354f4c12fce1ee58e670f9c3fce46c40296ba9ee8a2Ian Hodson 5355f4c12fce1ee58e670f9c3fce46c40296ba9ee8a2Ian Hodson # A PIC object. 5356f4c12fce1ee58e670f9c3fce46c40296ba9ee8a2Ian Hodson func_append libobjs " $pic_object" 5357f4c12fce1ee58e670f9c3fce46c40296ba9ee8a2Ian Hodson arg="$pic_object" 5358f4c12fce1ee58e670f9c3fce46c40296ba9ee8a2Ian Hodson fi 5359f4c12fce1ee58e670f9c3fce46c40296ba9ee8a2Ian Hodson 5360f4c12fce1ee58e670f9c3fce46c40296ba9ee8a2Ian Hodson # Non-PIC object. 5361f4c12fce1ee58e670f9c3fce46c40296ba9ee8a2Ian Hodson if test "$non_pic_object" != none; then 5362f4c12fce1ee58e670f9c3fce46c40296ba9ee8a2Ian Hodson # Prepend the subdirectory the object is found in. 5363f4c12fce1ee58e670f9c3fce46c40296ba9ee8a2Ian Hodson non_pic_object="$xdir$non_pic_object" 5364f4c12fce1ee58e670f9c3fce46c40296ba9ee8a2Ian Hodson 5365f4c12fce1ee58e670f9c3fce46c40296ba9ee8a2Ian Hodson # A standard non-PIC object 5366f4c12fce1ee58e670f9c3fce46c40296ba9ee8a2Ian Hodson func_append non_pic_objects " $non_pic_object" 5367f4c12fce1ee58e670f9c3fce46c40296ba9ee8a2Ian Hodson if test -z "$pic_object" || test "$pic_object" = none ; then 5368f4c12fce1ee58e670f9c3fce46c40296ba9ee8a2Ian Hodson arg="$non_pic_object" 5369f4c12fce1ee58e670f9c3fce46c40296ba9ee8a2Ian Hodson fi 5370f4c12fce1ee58e670f9c3fce46c40296ba9ee8a2Ian Hodson else 5371f4c12fce1ee58e670f9c3fce46c40296ba9ee8a2Ian Hodson # If the PIC object exists, use it instead. 5372f4c12fce1ee58e670f9c3fce46c40296ba9ee8a2Ian Hodson # $xdir was prepended to $pic_object above. 5373f4c12fce1ee58e670f9c3fce46c40296ba9ee8a2Ian Hodson non_pic_object="$pic_object" 5374f4c12fce1ee58e670f9c3fce46c40296ba9ee8a2Ian Hodson func_append non_pic_objects " $non_pic_object" 5375f4c12fce1ee58e670f9c3fce46c40296ba9ee8a2Ian Hodson fi 5376f4c12fce1ee58e670f9c3fce46c40296ba9ee8a2Ian Hodson else 5377f4c12fce1ee58e670f9c3fce46c40296ba9ee8a2Ian Hodson # Only an error if not doing a dry-run. 5378f4c12fce1ee58e670f9c3fce46c40296ba9ee8a2Ian Hodson if $opt_dry_run; then 5379f4c12fce1ee58e670f9c3fce46c40296ba9ee8a2Ian Hodson # Extract subdirectory from the argument. 5380f4c12fce1ee58e670f9c3fce46c40296ba9ee8a2Ian Hodson func_dirname "$arg" "/" "" 5381f4c12fce1ee58e670f9c3fce46c40296ba9ee8a2Ian Hodson xdir="$func_dirname_result" 5382f4c12fce1ee58e670f9c3fce46c40296ba9ee8a2Ian Hodson 5383f4c12fce1ee58e670f9c3fce46c40296ba9ee8a2Ian Hodson func_lo2o "$arg" 5384f4c12fce1ee58e670f9c3fce46c40296ba9ee8a2Ian Hodson pic_object=$xdir$objdir/$func_lo2o_result 5385f4c12fce1ee58e670f9c3fce46c40296ba9ee8a2Ian Hodson non_pic_object=$xdir$func_lo2o_result 5386f4c12fce1ee58e670f9c3fce46c40296ba9ee8a2Ian Hodson func_append libobjs " $pic_object" 5387f4c12fce1ee58e670f9c3fce46c40296ba9ee8a2Ian Hodson func_append non_pic_objects " $non_pic_object" 5388f4c12fce1ee58e670f9c3fce46c40296ba9ee8a2Ian Hodson else 5389f4c12fce1ee58e670f9c3fce46c40296ba9ee8a2Ian Hodson func_fatal_error "\`$arg' is not a valid libtool object" 5390f4c12fce1ee58e670f9c3fce46c40296ba9ee8a2Ian Hodson fi 5391f4c12fce1ee58e670f9c3fce46c40296ba9ee8a2Ian Hodson fi 5392f4c12fce1ee58e670f9c3fce46c40296ba9ee8a2Ian Hodson done 5393f4c12fce1ee58e670f9c3fce46c40296ba9ee8a2Ian Hodson else 5394f4c12fce1ee58e670f9c3fce46c40296ba9ee8a2Ian Hodson func_fatal_error "link input file \`$arg' does not exist" 5395f4c12fce1ee58e670f9c3fce46c40296ba9ee8a2Ian Hodson fi 5396f4c12fce1ee58e670f9c3fce46c40296ba9ee8a2Ian Hodson arg=$save_arg 5397f4c12fce1ee58e670f9c3fce46c40296ba9ee8a2Ian Hodson prev= 5398f4c12fce1ee58e670f9c3fce46c40296ba9ee8a2Ian Hodson continue 5399f4c12fce1ee58e670f9c3fce46c40296ba9ee8a2Ian Hodson ;; 5400f4c12fce1ee58e670f9c3fce46c40296ba9ee8a2Ian Hodson precious_regex) 5401f4c12fce1ee58e670f9c3fce46c40296ba9ee8a2Ian Hodson precious_files_regex="$arg" 5402f4c12fce1ee58e670f9c3fce46c40296ba9ee8a2Ian Hodson prev= 5403f4c12fce1ee58e670f9c3fce46c40296ba9ee8a2Ian Hodson continue 5404f4c12fce1ee58e670f9c3fce46c40296ba9ee8a2Ian Hodson ;; 5405f4c12fce1ee58e670f9c3fce46c40296ba9ee8a2Ian Hodson release) 5406f4c12fce1ee58e670f9c3fce46c40296ba9ee8a2Ian Hodson release="-$arg" 5407f4c12fce1ee58e670f9c3fce46c40296ba9ee8a2Ian Hodson prev= 5408f4c12fce1ee58e670f9c3fce46c40296ba9ee8a2Ian Hodson continue 5409f4c12fce1ee58e670f9c3fce46c40296ba9ee8a2Ian Hodson ;; 5410f4c12fce1ee58e670f9c3fce46c40296ba9ee8a2Ian Hodson rpath | xrpath) 5411f4c12fce1ee58e670f9c3fce46c40296ba9ee8a2Ian Hodson # We need an absolute path. 5412f4c12fce1ee58e670f9c3fce46c40296ba9ee8a2Ian Hodson case $arg in 5413f4c12fce1ee58e670f9c3fce46c40296ba9ee8a2Ian Hodson [\\/]* | [A-Za-z]:[\\/]*) ;; 5414f4c12fce1ee58e670f9c3fce46c40296ba9ee8a2Ian Hodson *) 5415f4c12fce1ee58e670f9c3fce46c40296ba9ee8a2Ian Hodson func_fatal_error "only absolute run-paths are allowed" 5416f4c12fce1ee58e670f9c3fce46c40296ba9ee8a2Ian Hodson ;; 5417f4c12fce1ee58e670f9c3fce46c40296ba9ee8a2Ian Hodson esac 5418f4c12fce1ee58e670f9c3fce46c40296ba9ee8a2Ian Hodson if test "$prev" = rpath; then 5419f4c12fce1ee58e670f9c3fce46c40296ba9ee8a2Ian Hodson case "$rpath " in 5420f4c12fce1ee58e670f9c3fce46c40296ba9ee8a2Ian Hodson *" $arg "*) ;; 54215b6dc79427b8f7eeb6a7ff68034ab8548ce670eaAlexander Gutkin *) func_append rpath " $arg" ;; 5422f4c12fce1ee58e670f9c3fce46c40296ba9ee8a2Ian Hodson esac 5423f4c12fce1ee58e670f9c3fce46c40296ba9ee8a2Ian Hodson else 5424f4c12fce1ee58e670f9c3fce46c40296ba9ee8a2Ian Hodson case "$xrpath " in 5425f4c12fce1ee58e670f9c3fce46c40296ba9ee8a2Ian Hodson *" $arg "*) ;; 54265b6dc79427b8f7eeb6a7ff68034ab8548ce670eaAlexander Gutkin *) func_append xrpath " $arg" ;; 5427f4c12fce1ee58e670f9c3fce46c40296ba9ee8a2Ian Hodson esac 5428f4c12fce1ee58e670f9c3fce46c40296ba9ee8a2Ian Hodson fi 5429f4c12fce1ee58e670f9c3fce46c40296ba9ee8a2Ian Hodson prev= 5430f4c12fce1ee58e670f9c3fce46c40296ba9ee8a2Ian Hodson continue 5431f4c12fce1ee58e670f9c3fce46c40296ba9ee8a2Ian Hodson ;; 5432f4c12fce1ee58e670f9c3fce46c40296ba9ee8a2Ian Hodson shrext) 5433f4c12fce1ee58e670f9c3fce46c40296ba9ee8a2Ian Hodson shrext_cmds="$arg" 5434f4c12fce1ee58e670f9c3fce46c40296ba9ee8a2Ian Hodson prev= 5435f4c12fce1ee58e670f9c3fce46c40296ba9ee8a2Ian Hodson continue 5436f4c12fce1ee58e670f9c3fce46c40296ba9ee8a2Ian Hodson ;; 5437f4c12fce1ee58e670f9c3fce46c40296ba9ee8a2Ian Hodson weak) 54385b6dc79427b8f7eeb6a7ff68034ab8548ce670eaAlexander Gutkin func_append weak_libs " $arg" 5439f4c12fce1ee58e670f9c3fce46c40296ba9ee8a2Ian Hodson prev= 5440f4c12fce1ee58e670f9c3fce46c40296ba9ee8a2Ian Hodson continue 5441f4c12fce1ee58e670f9c3fce46c40296ba9ee8a2Ian Hodson ;; 5442f4c12fce1ee58e670f9c3fce46c40296ba9ee8a2Ian Hodson xcclinker) 54435b6dc79427b8f7eeb6a7ff68034ab8548ce670eaAlexander Gutkin func_append linker_flags " $qarg" 54445b6dc79427b8f7eeb6a7ff68034ab8548ce670eaAlexander Gutkin func_append compiler_flags " $qarg" 5445f4c12fce1ee58e670f9c3fce46c40296ba9ee8a2Ian Hodson prev= 5446f4c12fce1ee58e670f9c3fce46c40296ba9ee8a2Ian Hodson func_append compile_command " $qarg" 5447f4c12fce1ee58e670f9c3fce46c40296ba9ee8a2Ian Hodson func_append finalize_command " $qarg" 5448f4c12fce1ee58e670f9c3fce46c40296ba9ee8a2Ian Hodson continue 5449f4c12fce1ee58e670f9c3fce46c40296ba9ee8a2Ian Hodson ;; 5450f4c12fce1ee58e670f9c3fce46c40296ba9ee8a2Ian Hodson xcompiler) 54515b6dc79427b8f7eeb6a7ff68034ab8548ce670eaAlexander Gutkin func_append compiler_flags " $qarg" 5452f4c12fce1ee58e670f9c3fce46c40296ba9ee8a2Ian Hodson prev= 5453f4c12fce1ee58e670f9c3fce46c40296ba9ee8a2Ian Hodson func_append compile_command " $qarg" 5454f4c12fce1ee58e670f9c3fce46c40296ba9ee8a2Ian Hodson func_append finalize_command " $qarg" 5455f4c12fce1ee58e670f9c3fce46c40296ba9ee8a2Ian Hodson continue 5456f4c12fce1ee58e670f9c3fce46c40296ba9ee8a2Ian Hodson ;; 5457f4c12fce1ee58e670f9c3fce46c40296ba9ee8a2Ian Hodson xlinker) 54585b6dc79427b8f7eeb6a7ff68034ab8548ce670eaAlexander Gutkin func_append linker_flags " $qarg" 54595b6dc79427b8f7eeb6a7ff68034ab8548ce670eaAlexander Gutkin func_append compiler_flags " $wl$qarg" 5460f4c12fce1ee58e670f9c3fce46c40296ba9ee8a2Ian Hodson prev= 5461f4c12fce1ee58e670f9c3fce46c40296ba9ee8a2Ian Hodson func_append compile_command " $wl$qarg" 5462f4c12fce1ee58e670f9c3fce46c40296ba9ee8a2Ian Hodson func_append finalize_command " $wl$qarg" 5463f4c12fce1ee58e670f9c3fce46c40296ba9ee8a2Ian Hodson continue 5464f4c12fce1ee58e670f9c3fce46c40296ba9ee8a2Ian Hodson ;; 5465f4c12fce1ee58e670f9c3fce46c40296ba9ee8a2Ian Hodson *) 5466f4c12fce1ee58e670f9c3fce46c40296ba9ee8a2Ian Hodson eval "$prev=\"\$arg\"" 5467f4c12fce1ee58e670f9c3fce46c40296ba9ee8a2Ian Hodson prev= 5468f4c12fce1ee58e670f9c3fce46c40296ba9ee8a2Ian Hodson continue 5469f4c12fce1ee58e670f9c3fce46c40296ba9ee8a2Ian Hodson ;; 5470f4c12fce1ee58e670f9c3fce46c40296ba9ee8a2Ian Hodson esac 5471f4c12fce1ee58e670f9c3fce46c40296ba9ee8a2Ian Hodson fi # test -n "$prev" 5472f4c12fce1ee58e670f9c3fce46c40296ba9ee8a2Ian Hodson 5473f4c12fce1ee58e670f9c3fce46c40296ba9ee8a2Ian Hodson prevarg="$arg" 5474f4c12fce1ee58e670f9c3fce46c40296ba9ee8a2Ian Hodson 5475f4c12fce1ee58e670f9c3fce46c40296ba9ee8a2Ian Hodson case $arg in 5476f4c12fce1ee58e670f9c3fce46c40296ba9ee8a2Ian Hodson -all-static) 5477f4c12fce1ee58e670f9c3fce46c40296ba9ee8a2Ian Hodson if test -n "$link_static_flag"; then 5478f4c12fce1ee58e670f9c3fce46c40296ba9ee8a2Ian Hodson # See comment for -static flag below, for more details. 5479f4c12fce1ee58e670f9c3fce46c40296ba9ee8a2Ian Hodson func_append compile_command " $link_static_flag" 5480f4c12fce1ee58e670f9c3fce46c40296ba9ee8a2Ian Hodson func_append finalize_command " $link_static_flag" 5481f4c12fce1ee58e670f9c3fce46c40296ba9ee8a2Ian Hodson fi 5482f4c12fce1ee58e670f9c3fce46c40296ba9ee8a2Ian Hodson continue 5483f4c12fce1ee58e670f9c3fce46c40296ba9ee8a2Ian Hodson ;; 5484f4c12fce1ee58e670f9c3fce46c40296ba9ee8a2Ian Hodson 5485f4c12fce1ee58e670f9c3fce46c40296ba9ee8a2Ian Hodson -allow-undefined) 5486f4c12fce1ee58e670f9c3fce46c40296ba9ee8a2Ian Hodson # FIXME: remove this flag sometime in the future. 5487f4c12fce1ee58e670f9c3fce46c40296ba9ee8a2Ian Hodson func_fatal_error "\`-allow-undefined' must not be used because it is the default" 5488f4c12fce1ee58e670f9c3fce46c40296ba9ee8a2Ian Hodson ;; 5489f4c12fce1ee58e670f9c3fce46c40296ba9ee8a2Ian Hodson 5490f4c12fce1ee58e670f9c3fce46c40296ba9ee8a2Ian Hodson -avoid-version) 5491f4c12fce1ee58e670f9c3fce46c40296ba9ee8a2Ian Hodson avoid_version=yes 5492f4c12fce1ee58e670f9c3fce46c40296ba9ee8a2Ian Hodson continue 5493f4c12fce1ee58e670f9c3fce46c40296ba9ee8a2Ian Hodson ;; 5494f4c12fce1ee58e670f9c3fce46c40296ba9ee8a2Ian Hodson 54955b6dc79427b8f7eeb6a7ff68034ab8548ce670eaAlexander Gutkin -bindir) 54965b6dc79427b8f7eeb6a7ff68034ab8548ce670eaAlexander Gutkin prev=bindir 54975b6dc79427b8f7eeb6a7ff68034ab8548ce670eaAlexander Gutkin continue 54985b6dc79427b8f7eeb6a7ff68034ab8548ce670eaAlexander Gutkin ;; 54995b6dc79427b8f7eeb6a7ff68034ab8548ce670eaAlexander Gutkin 5500f4c12fce1ee58e670f9c3fce46c40296ba9ee8a2Ian Hodson -dlopen) 5501f4c12fce1ee58e670f9c3fce46c40296ba9ee8a2Ian Hodson prev=dlfiles 5502f4c12fce1ee58e670f9c3fce46c40296ba9ee8a2Ian Hodson continue 5503f4c12fce1ee58e670f9c3fce46c40296ba9ee8a2Ian Hodson ;; 5504f4c12fce1ee58e670f9c3fce46c40296ba9ee8a2Ian Hodson 5505f4c12fce1ee58e670f9c3fce46c40296ba9ee8a2Ian Hodson -dlpreopen) 5506f4c12fce1ee58e670f9c3fce46c40296ba9ee8a2Ian Hodson prev=dlprefiles 5507f4c12fce1ee58e670f9c3fce46c40296ba9ee8a2Ian Hodson continue 5508f4c12fce1ee58e670f9c3fce46c40296ba9ee8a2Ian Hodson ;; 5509f4c12fce1ee58e670f9c3fce46c40296ba9ee8a2Ian Hodson 5510f4c12fce1ee58e670f9c3fce46c40296ba9ee8a2Ian Hodson -export-dynamic) 5511f4c12fce1ee58e670f9c3fce46c40296ba9ee8a2Ian Hodson export_dynamic=yes 5512f4c12fce1ee58e670f9c3fce46c40296ba9ee8a2Ian Hodson continue 5513f4c12fce1ee58e670f9c3fce46c40296ba9ee8a2Ian Hodson ;; 5514f4c12fce1ee58e670f9c3fce46c40296ba9ee8a2Ian Hodson 5515f4c12fce1ee58e670f9c3fce46c40296ba9ee8a2Ian Hodson -export-symbols | -export-symbols-regex) 5516f4c12fce1ee58e670f9c3fce46c40296ba9ee8a2Ian Hodson if test -n "$export_symbols" || test -n "$export_symbols_regex"; then 5517f4c12fce1ee58e670f9c3fce46c40296ba9ee8a2Ian Hodson func_fatal_error "more than one -exported-symbols argument is not allowed" 5518f4c12fce1ee58e670f9c3fce46c40296ba9ee8a2Ian Hodson fi 5519f4c12fce1ee58e670f9c3fce46c40296ba9ee8a2Ian Hodson if test "X$arg" = "X-export-symbols"; then 5520f4c12fce1ee58e670f9c3fce46c40296ba9ee8a2Ian Hodson prev=expsyms 5521f4c12fce1ee58e670f9c3fce46c40296ba9ee8a2Ian Hodson else 5522f4c12fce1ee58e670f9c3fce46c40296ba9ee8a2Ian Hodson prev=expsyms_regex 5523f4c12fce1ee58e670f9c3fce46c40296ba9ee8a2Ian Hodson fi 5524f4c12fce1ee58e670f9c3fce46c40296ba9ee8a2Ian Hodson continue 5525f4c12fce1ee58e670f9c3fce46c40296ba9ee8a2Ian Hodson ;; 5526f4c12fce1ee58e670f9c3fce46c40296ba9ee8a2Ian Hodson 5527f4c12fce1ee58e670f9c3fce46c40296ba9ee8a2Ian Hodson -framework) 5528f4c12fce1ee58e670f9c3fce46c40296ba9ee8a2Ian Hodson prev=framework 5529f4c12fce1ee58e670f9c3fce46c40296ba9ee8a2Ian Hodson continue 5530f4c12fce1ee58e670f9c3fce46c40296ba9ee8a2Ian Hodson ;; 5531f4c12fce1ee58e670f9c3fce46c40296ba9ee8a2Ian Hodson 5532f4c12fce1ee58e670f9c3fce46c40296ba9ee8a2Ian Hodson -inst-prefix-dir) 5533f4c12fce1ee58e670f9c3fce46c40296ba9ee8a2Ian Hodson prev=inst_prefix 5534f4c12fce1ee58e670f9c3fce46c40296ba9ee8a2Ian Hodson continue 5535f4c12fce1ee58e670f9c3fce46c40296ba9ee8a2Ian Hodson ;; 5536f4c12fce1ee58e670f9c3fce46c40296ba9ee8a2Ian Hodson 5537f4c12fce1ee58e670f9c3fce46c40296ba9ee8a2Ian Hodson # The native IRIX linker understands -LANG:*, -LIST:* and -LNO:* 5538f4c12fce1ee58e670f9c3fce46c40296ba9ee8a2Ian Hodson # so, if we see these flags be careful not to treat them like -L 5539f4c12fce1ee58e670f9c3fce46c40296ba9ee8a2Ian Hodson -L[A-Z][A-Z]*:*) 5540f4c12fce1ee58e670f9c3fce46c40296ba9ee8a2Ian Hodson case $with_gcc/$host in 5541f4c12fce1ee58e670f9c3fce46c40296ba9ee8a2Ian Hodson no/*-*-irix* | /*-*-irix*) 5542f4c12fce1ee58e670f9c3fce46c40296ba9ee8a2Ian Hodson func_append compile_command " $arg" 5543f4c12fce1ee58e670f9c3fce46c40296ba9ee8a2Ian Hodson func_append finalize_command " $arg" 5544f4c12fce1ee58e670f9c3fce46c40296ba9ee8a2Ian Hodson ;; 5545f4c12fce1ee58e670f9c3fce46c40296ba9ee8a2Ian Hodson esac 5546f4c12fce1ee58e670f9c3fce46c40296ba9ee8a2Ian Hodson continue 5547f4c12fce1ee58e670f9c3fce46c40296ba9ee8a2Ian Hodson ;; 5548f4c12fce1ee58e670f9c3fce46c40296ba9ee8a2Ian Hodson 5549f4c12fce1ee58e670f9c3fce46c40296ba9ee8a2Ian Hodson -L*) 55505b6dc79427b8f7eeb6a7ff68034ab8548ce670eaAlexander Gutkin func_stripname "-L" '' "$arg" 55515b6dc79427b8f7eeb6a7ff68034ab8548ce670eaAlexander Gutkin if test -z "$func_stripname_result"; then 5552f4c12fce1ee58e670f9c3fce46c40296ba9ee8a2Ian Hodson if test "$#" -gt 0; then 5553f4c12fce1ee58e670f9c3fce46c40296ba9ee8a2Ian Hodson func_fatal_error "require no space between \`-L' and \`$1'" 5554f4c12fce1ee58e670f9c3fce46c40296ba9ee8a2Ian Hodson else 5555f4c12fce1ee58e670f9c3fce46c40296ba9ee8a2Ian Hodson func_fatal_error "need path for \`-L' option" 5556f4c12fce1ee58e670f9c3fce46c40296ba9ee8a2Ian Hodson fi 5557f4c12fce1ee58e670f9c3fce46c40296ba9ee8a2Ian Hodson fi 55585b6dc79427b8f7eeb6a7ff68034ab8548ce670eaAlexander Gutkin func_resolve_sysroot "$func_stripname_result" 55595b6dc79427b8f7eeb6a7ff68034ab8548ce670eaAlexander Gutkin dir=$func_resolve_sysroot_result 5560f4c12fce1ee58e670f9c3fce46c40296ba9ee8a2Ian Hodson # We need an absolute path. 5561f4c12fce1ee58e670f9c3fce46c40296ba9ee8a2Ian Hodson case $dir in 5562f4c12fce1ee58e670f9c3fce46c40296ba9ee8a2Ian Hodson [\\/]* | [A-Za-z]:[\\/]*) ;; 5563f4c12fce1ee58e670f9c3fce46c40296ba9ee8a2Ian Hodson *) 5564f4c12fce1ee58e670f9c3fce46c40296ba9ee8a2Ian Hodson absdir=`cd "$dir" && pwd` 5565f4c12fce1ee58e670f9c3fce46c40296ba9ee8a2Ian Hodson test -z "$absdir" && \ 5566f4c12fce1ee58e670f9c3fce46c40296ba9ee8a2Ian Hodson func_fatal_error "cannot determine absolute directory name of \`$dir'" 5567f4c12fce1ee58e670f9c3fce46c40296ba9ee8a2Ian Hodson dir="$absdir" 5568f4c12fce1ee58e670f9c3fce46c40296ba9ee8a2Ian Hodson ;; 5569f4c12fce1ee58e670f9c3fce46c40296ba9ee8a2Ian Hodson esac 5570f4c12fce1ee58e670f9c3fce46c40296ba9ee8a2Ian Hodson case "$deplibs " in 55715b6dc79427b8f7eeb6a7ff68034ab8548ce670eaAlexander Gutkin *" -L$dir "* | *" $arg "*) 55725b6dc79427b8f7eeb6a7ff68034ab8548ce670eaAlexander Gutkin # Will only happen for absolute or sysroot arguments 55735b6dc79427b8f7eeb6a7ff68034ab8548ce670eaAlexander Gutkin ;; 5574f4c12fce1ee58e670f9c3fce46c40296ba9ee8a2Ian Hodson *) 55755b6dc79427b8f7eeb6a7ff68034ab8548ce670eaAlexander Gutkin # Preserve sysroot, but never include relative directories 55765b6dc79427b8f7eeb6a7ff68034ab8548ce670eaAlexander Gutkin case $dir in 55775b6dc79427b8f7eeb6a7ff68034ab8548ce670eaAlexander Gutkin [\\/]* | [A-Za-z]:[\\/]* | =*) func_append deplibs " $arg" ;; 55785b6dc79427b8f7eeb6a7ff68034ab8548ce670eaAlexander Gutkin *) func_append deplibs " -L$dir" ;; 55795b6dc79427b8f7eeb6a7ff68034ab8548ce670eaAlexander Gutkin esac 55805b6dc79427b8f7eeb6a7ff68034ab8548ce670eaAlexander Gutkin func_append lib_search_path " $dir" 5581f4c12fce1ee58e670f9c3fce46c40296ba9ee8a2Ian Hodson ;; 5582f4c12fce1ee58e670f9c3fce46c40296ba9ee8a2Ian Hodson esac 5583f4c12fce1ee58e670f9c3fce46c40296ba9ee8a2Ian Hodson case $host in 5584f4c12fce1ee58e670f9c3fce46c40296ba9ee8a2Ian Hodson *-*-cygwin* | *-*-mingw* | *-*-pw32* | *-*-os2* | *-cegcc*) 55855b6dc79427b8f7eeb6a7ff68034ab8548ce670eaAlexander Gutkin testbindir=`$ECHO "$dir" | $SED 's*/lib$*/bin*'` 5586f4c12fce1ee58e670f9c3fce46c40296ba9ee8a2Ian Hodson case :$dllsearchpath: in 5587f4c12fce1ee58e670f9c3fce46c40296ba9ee8a2Ian Hodson *":$dir:"*) ;; 5588f4c12fce1ee58e670f9c3fce46c40296ba9ee8a2Ian Hodson ::) dllsearchpath=$dir;; 55895b6dc79427b8f7eeb6a7ff68034ab8548ce670eaAlexander Gutkin *) func_append dllsearchpath ":$dir";; 5590f4c12fce1ee58e670f9c3fce46c40296ba9ee8a2Ian Hodson esac 5591f4c12fce1ee58e670f9c3fce46c40296ba9ee8a2Ian Hodson case :$dllsearchpath: in 5592f4c12fce1ee58e670f9c3fce46c40296ba9ee8a2Ian Hodson *":$testbindir:"*) ;; 5593f4c12fce1ee58e670f9c3fce46c40296ba9ee8a2Ian Hodson ::) dllsearchpath=$testbindir;; 55945b6dc79427b8f7eeb6a7ff68034ab8548ce670eaAlexander Gutkin *) func_append dllsearchpath ":$testbindir";; 5595f4c12fce1ee58e670f9c3fce46c40296ba9ee8a2Ian Hodson esac 5596f4c12fce1ee58e670f9c3fce46c40296ba9ee8a2Ian Hodson ;; 5597f4c12fce1ee58e670f9c3fce46c40296ba9ee8a2Ian Hodson esac 5598f4c12fce1ee58e670f9c3fce46c40296ba9ee8a2Ian Hodson continue 5599f4c12fce1ee58e670f9c3fce46c40296ba9ee8a2Ian Hodson ;; 5600f4c12fce1ee58e670f9c3fce46c40296ba9ee8a2Ian Hodson 5601f4c12fce1ee58e670f9c3fce46c40296ba9ee8a2Ian Hodson -l*) 5602f4c12fce1ee58e670f9c3fce46c40296ba9ee8a2Ian Hodson if test "X$arg" = "X-lc" || test "X$arg" = "X-lm"; then 5603f4c12fce1ee58e670f9c3fce46c40296ba9ee8a2Ian Hodson case $host in 56045b6dc79427b8f7eeb6a7ff68034ab8548ce670eaAlexander Gutkin *-*-cygwin* | *-*-mingw* | *-*-pw32* | *-*-beos* | *-cegcc* | *-*-haiku*) 5605f4c12fce1ee58e670f9c3fce46c40296ba9ee8a2Ian Hodson # These systems don't actually have a C or math library (as such) 5606f4c12fce1ee58e670f9c3fce46c40296ba9ee8a2Ian Hodson continue 5607f4c12fce1ee58e670f9c3fce46c40296ba9ee8a2Ian Hodson ;; 5608f4c12fce1ee58e670f9c3fce46c40296ba9ee8a2Ian Hodson *-*-os2*) 5609f4c12fce1ee58e670f9c3fce46c40296ba9ee8a2Ian Hodson # These systems don't actually have a C library (as such) 5610f4c12fce1ee58e670f9c3fce46c40296ba9ee8a2Ian Hodson test "X$arg" = "X-lc" && continue 5611f4c12fce1ee58e670f9c3fce46c40296ba9ee8a2Ian Hodson ;; 5612f4c12fce1ee58e670f9c3fce46c40296ba9ee8a2Ian Hodson *-*-openbsd* | *-*-freebsd* | *-*-dragonfly*) 5613f4c12fce1ee58e670f9c3fce46c40296ba9ee8a2Ian Hodson # Do not include libc due to us having libc/libc_r. 5614f4c12fce1ee58e670f9c3fce46c40296ba9ee8a2Ian Hodson test "X$arg" = "X-lc" && continue 5615f4c12fce1ee58e670f9c3fce46c40296ba9ee8a2Ian Hodson ;; 5616f4c12fce1ee58e670f9c3fce46c40296ba9ee8a2Ian Hodson *-*-rhapsody* | *-*-darwin1.[012]) 5617f4c12fce1ee58e670f9c3fce46c40296ba9ee8a2Ian Hodson # Rhapsody C and math libraries are in the System framework 56185b6dc79427b8f7eeb6a7ff68034ab8548ce670eaAlexander Gutkin func_append deplibs " System.ltframework" 5619f4c12fce1ee58e670f9c3fce46c40296ba9ee8a2Ian Hodson continue 5620f4c12fce1ee58e670f9c3fce46c40296ba9ee8a2Ian Hodson ;; 5621f4c12fce1ee58e670f9c3fce46c40296ba9ee8a2Ian Hodson *-*-sco3.2v5* | *-*-sco5v6*) 5622f4c12fce1ee58e670f9c3fce46c40296ba9ee8a2Ian Hodson # Causes problems with __ctype 5623f4c12fce1ee58e670f9c3fce46c40296ba9ee8a2Ian Hodson test "X$arg" = "X-lc" && continue 5624f4c12fce1ee58e670f9c3fce46c40296ba9ee8a2Ian Hodson ;; 5625f4c12fce1ee58e670f9c3fce46c40296ba9ee8a2Ian Hodson *-*-sysv4.2uw2* | *-*-sysv5* | *-*-unixware* | *-*-OpenUNIX*) 5626f4c12fce1ee58e670f9c3fce46c40296ba9ee8a2Ian Hodson # Compiler inserts libc in the correct place for threads to work 5627f4c12fce1ee58e670f9c3fce46c40296ba9ee8a2Ian Hodson test "X$arg" = "X-lc" && continue 5628f4c12fce1ee58e670f9c3fce46c40296ba9ee8a2Ian Hodson ;; 5629f4c12fce1ee58e670f9c3fce46c40296ba9ee8a2Ian Hodson esac 5630f4c12fce1ee58e670f9c3fce46c40296ba9ee8a2Ian Hodson elif test "X$arg" = "X-lc_r"; then 5631f4c12fce1ee58e670f9c3fce46c40296ba9ee8a2Ian Hodson case $host in 5632f4c12fce1ee58e670f9c3fce46c40296ba9ee8a2Ian Hodson *-*-openbsd* | *-*-freebsd* | *-*-dragonfly*) 5633f4c12fce1ee58e670f9c3fce46c40296ba9ee8a2Ian Hodson # Do not include libc_r directly, use -pthread flag. 5634f4c12fce1ee58e670f9c3fce46c40296ba9ee8a2Ian Hodson continue 5635f4c12fce1ee58e670f9c3fce46c40296ba9ee8a2Ian Hodson ;; 5636f4c12fce1ee58e670f9c3fce46c40296ba9ee8a2Ian Hodson esac 5637f4c12fce1ee58e670f9c3fce46c40296ba9ee8a2Ian Hodson fi 56385b6dc79427b8f7eeb6a7ff68034ab8548ce670eaAlexander Gutkin func_append deplibs " $arg" 5639f4c12fce1ee58e670f9c3fce46c40296ba9ee8a2Ian Hodson continue 5640f4c12fce1ee58e670f9c3fce46c40296ba9ee8a2Ian Hodson ;; 5641f4c12fce1ee58e670f9c3fce46c40296ba9ee8a2Ian Hodson 5642f4c12fce1ee58e670f9c3fce46c40296ba9ee8a2Ian Hodson -module) 5643f4c12fce1ee58e670f9c3fce46c40296ba9ee8a2Ian Hodson module=yes 5644f4c12fce1ee58e670f9c3fce46c40296ba9ee8a2Ian Hodson continue 5645f4c12fce1ee58e670f9c3fce46c40296ba9ee8a2Ian Hodson ;; 5646f4c12fce1ee58e670f9c3fce46c40296ba9ee8a2Ian Hodson 5647f4c12fce1ee58e670f9c3fce46c40296ba9ee8a2Ian Hodson # Tru64 UNIX uses -model [arg] to determine the layout of C++ 5648f4c12fce1ee58e670f9c3fce46c40296ba9ee8a2Ian Hodson # classes, name mangling, and exception handling. 5649f4c12fce1ee58e670f9c3fce46c40296ba9ee8a2Ian Hodson # Darwin uses the -arch flag to determine output architecture. 56505b6dc79427b8f7eeb6a7ff68034ab8548ce670eaAlexander Gutkin -model|-arch|-isysroot|--sysroot) 56515b6dc79427b8f7eeb6a7ff68034ab8548ce670eaAlexander Gutkin func_append compiler_flags " $arg" 5652f4c12fce1ee58e670f9c3fce46c40296ba9ee8a2Ian Hodson func_append compile_command " $arg" 5653f4c12fce1ee58e670f9c3fce46c40296ba9ee8a2Ian Hodson func_append finalize_command " $arg" 5654f4c12fce1ee58e670f9c3fce46c40296ba9ee8a2Ian Hodson prev=xcompiler 5655f4c12fce1ee58e670f9c3fce46c40296ba9ee8a2Ian Hodson continue 5656f4c12fce1ee58e670f9c3fce46c40296ba9ee8a2Ian Hodson ;; 5657f4c12fce1ee58e670f9c3fce46c40296ba9ee8a2Ian Hodson 56585b6dc79427b8f7eeb6a7ff68034ab8548ce670eaAlexander Gutkin -mt|-mthreads|-kthread|-Kthread|-pthread|-pthreads|--thread-safe \ 56595b6dc79427b8f7eeb6a7ff68034ab8548ce670eaAlexander Gutkin |-threads|-fopenmp|-openmp|-mp|-xopenmp|-omp|-qsmp=*) 56605b6dc79427b8f7eeb6a7ff68034ab8548ce670eaAlexander Gutkin func_append compiler_flags " $arg" 5661f4c12fce1ee58e670f9c3fce46c40296ba9ee8a2Ian Hodson func_append compile_command " $arg" 5662f4c12fce1ee58e670f9c3fce46c40296ba9ee8a2Ian Hodson func_append finalize_command " $arg" 5663f4c12fce1ee58e670f9c3fce46c40296ba9ee8a2Ian Hodson case "$new_inherited_linker_flags " in 5664f4c12fce1ee58e670f9c3fce46c40296ba9ee8a2Ian Hodson *" $arg "*) ;; 56655b6dc79427b8f7eeb6a7ff68034ab8548ce670eaAlexander Gutkin * ) func_append new_inherited_linker_flags " $arg" ;; 5666f4c12fce1ee58e670f9c3fce46c40296ba9ee8a2Ian Hodson esac 5667f4c12fce1ee58e670f9c3fce46c40296ba9ee8a2Ian Hodson continue 5668f4c12fce1ee58e670f9c3fce46c40296ba9ee8a2Ian Hodson ;; 5669f4c12fce1ee58e670f9c3fce46c40296ba9ee8a2Ian Hodson 5670f4c12fce1ee58e670f9c3fce46c40296ba9ee8a2Ian Hodson -multi_module) 5671f4c12fce1ee58e670f9c3fce46c40296ba9ee8a2Ian Hodson single_module="${wl}-multi_module" 5672f4c12fce1ee58e670f9c3fce46c40296ba9ee8a2Ian Hodson continue 5673f4c12fce1ee58e670f9c3fce46c40296ba9ee8a2Ian Hodson ;; 5674f4c12fce1ee58e670f9c3fce46c40296ba9ee8a2Ian Hodson 5675f4c12fce1ee58e670f9c3fce46c40296ba9ee8a2Ian Hodson -no-fast-install) 5676f4c12fce1ee58e670f9c3fce46c40296ba9ee8a2Ian Hodson fast_install=no 5677f4c12fce1ee58e670f9c3fce46c40296ba9ee8a2Ian Hodson continue 5678f4c12fce1ee58e670f9c3fce46c40296ba9ee8a2Ian Hodson ;; 5679f4c12fce1ee58e670f9c3fce46c40296ba9ee8a2Ian Hodson 5680f4c12fce1ee58e670f9c3fce46c40296ba9ee8a2Ian Hodson -no-install) 5681f4c12fce1ee58e670f9c3fce46c40296ba9ee8a2Ian Hodson case $host in 5682f4c12fce1ee58e670f9c3fce46c40296ba9ee8a2Ian Hodson *-*-cygwin* | *-*-mingw* | *-*-pw32* | *-*-os2* | *-*-darwin* | *-cegcc*) 5683f4c12fce1ee58e670f9c3fce46c40296ba9ee8a2Ian Hodson # The PATH hackery in wrapper scripts is required on Windows 5684f4c12fce1ee58e670f9c3fce46c40296ba9ee8a2Ian Hodson # and Darwin in order for the loader to find any dlls it needs. 5685f4c12fce1ee58e670f9c3fce46c40296ba9ee8a2Ian Hodson func_warning "\`-no-install' is ignored for $host" 5686f4c12fce1ee58e670f9c3fce46c40296ba9ee8a2Ian Hodson func_warning "assuming \`-no-fast-install' instead" 5687f4c12fce1ee58e670f9c3fce46c40296ba9ee8a2Ian Hodson fast_install=no 5688f4c12fce1ee58e670f9c3fce46c40296ba9ee8a2Ian Hodson ;; 5689f4c12fce1ee58e670f9c3fce46c40296ba9ee8a2Ian Hodson *) no_install=yes ;; 5690f4c12fce1ee58e670f9c3fce46c40296ba9ee8a2Ian Hodson esac 5691f4c12fce1ee58e670f9c3fce46c40296ba9ee8a2Ian Hodson continue 5692f4c12fce1ee58e670f9c3fce46c40296ba9ee8a2Ian Hodson ;; 5693f4c12fce1ee58e670f9c3fce46c40296ba9ee8a2Ian Hodson 5694f4c12fce1ee58e670f9c3fce46c40296ba9ee8a2Ian Hodson -no-undefined) 5695f4c12fce1ee58e670f9c3fce46c40296ba9ee8a2Ian Hodson allow_undefined=no 5696f4c12fce1ee58e670f9c3fce46c40296ba9ee8a2Ian Hodson continue 5697f4c12fce1ee58e670f9c3fce46c40296ba9ee8a2Ian Hodson ;; 5698f4c12fce1ee58e670f9c3fce46c40296ba9ee8a2Ian Hodson 5699f4c12fce1ee58e670f9c3fce46c40296ba9ee8a2Ian Hodson -objectlist) 5700f4c12fce1ee58e670f9c3fce46c40296ba9ee8a2Ian Hodson prev=objectlist 5701f4c12fce1ee58e670f9c3fce46c40296ba9ee8a2Ian Hodson continue 5702f4c12fce1ee58e670f9c3fce46c40296ba9ee8a2Ian Hodson ;; 5703f4c12fce1ee58e670f9c3fce46c40296ba9ee8a2Ian Hodson 5704f4c12fce1ee58e670f9c3fce46c40296ba9ee8a2Ian Hodson -o) prev=output ;; 5705f4c12fce1ee58e670f9c3fce46c40296ba9ee8a2Ian Hodson 5706f4c12fce1ee58e670f9c3fce46c40296ba9ee8a2Ian Hodson -precious-files-regex) 5707f4c12fce1ee58e670f9c3fce46c40296ba9ee8a2Ian Hodson prev=precious_regex 5708f4c12fce1ee58e670f9c3fce46c40296ba9ee8a2Ian Hodson continue 5709f4c12fce1ee58e670f9c3fce46c40296ba9ee8a2Ian Hodson ;; 5710f4c12fce1ee58e670f9c3fce46c40296ba9ee8a2Ian Hodson 5711f4c12fce1ee58e670f9c3fce46c40296ba9ee8a2Ian Hodson -release) 5712f4c12fce1ee58e670f9c3fce46c40296ba9ee8a2Ian Hodson prev=release 5713f4c12fce1ee58e670f9c3fce46c40296ba9ee8a2Ian Hodson continue 5714f4c12fce1ee58e670f9c3fce46c40296ba9ee8a2Ian Hodson ;; 5715f4c12fce1ee58e670f9c3fce46c40296ba9ee8a2Ian Hodson 5716f4c12fce1ee58e670f9c3fce46c40296ba9ee8a2Ian Hodson -rpath) 5717f4c12fce1ee58e670f9c3fce46c40296ba9ee8a2Ian Hodson prev=rpath 5718f4c12fce1ee58e670f9c3fce46c40296ba9ee8a2Ian Hodson continue 5719f4c12fce1ee58e670f9c3fce46c40296ba9ee8a2Ian Hodson ;; 5720f4c12fce1ee58e670f9c3fce46c40296ba9ee8a2Ian Hodson 5721f4c12fce1ee58e670f9c3fce46c40296ba9ee8a2Ian Hodson -R) 5722f4c12fce1ee58e670f9c3fce46c40296ba9ee8a2Ian Hodson prev=xrpath 5723f4c12fce1ee58e670f9c3fce46c40296ba9ee8a2Ian Hodson continue 5724f4c12fce1ee58e670f9c3fce46c40296ba9ee8a2Ian Hodson ;; 5725f4c12fce1ee58e670f9c3fce46c40296ba9ee8a2Ian Hodson 5726f4c12fce1ee58e670f9c3fce46c40296ba9ee8a2Ian Hodson -R*) 5727f4c12fce1ee58e670f9c3fce46c40296ba9ee8a2Ian Hodson func_stripname '-R' '' "$arg" 5728f4c12fce1ee58e670f9c3fce46c40296ba9ee8a2Ian Hodson dir=$func_stripname_result 5729f4c12fce1ee58e670f9c3fce46c40296ba9ee8a2Ian Hodson # We need an absolute path. 5730f4c12fce1ee58e670f9c3fce46c40296ba9ee8a2Ian Hodson case $dir in 5731f4c12fce1ee58e670f9c3fce46c40296ba9ee8a2Ian Hodson [\\/]* | [A-Za-z]:[\\/]*) ;; 57325b6dc79427b8f7eeb6a7ff68034ab8548ce670eaAlexander Gutkin =*) 57335b6dc79427b8f7eeb6a7ff68034ab8548ce670eaAlexander Gutkin func_stripname '=' '' "$dir" 57345b6dc79427b8f7eeb6a7ff68034ab8548ce670eaAlexander Gutkin dir=$lt_sysroot$func_stripname_result 57355b6dc79427b8f7eeb6a7ff68034ab8548ce670eaAlexander Gutkin ;; 5736f4c12fce1ee58e670f9c3fce46c40296ba9ee8a2Ian Hodson *) 5737f4c12fce1ee58e670f9c3fce46c40296ba9ee8a2Ian Hodson func_fatal_error "only absolute run-paths are allowed" 5738f4c12fce1ee58e670f9c3fce46c40296ba9ee8a2Ian Hodson ;; 5739f4c12fce1ee58e670f9c3fce46c40296ba9ee8a2Ian Hodson esac 5740f4c12fce1ee58e670f9c3fce46c40296ba9ee8a2Ian Hodson case "$xrpath " in 5741f4c12fce1ee58e670f9c3fce46c40296ba9ee8a2Ian Hodson *" $dir "*) ;; 57425b6dc79427b8f7eeb6a7ff68034ab8548ce670eaAlexander Gutkin *) func_append xrpath " $dir" ;; 5743f4c12fce1ee58e670f9c3fce46c40296ba9ee8a2Ian Hodson esac 5744f4c12fce1ee58e670f9c3fce46c40296ba9ee8a2Ian Hodson continue 5745f4c12fce1ee58e670f9c3fce46c40296ba9ee8a2Ian Hodson ;; 5746f4c12fce1ee58e670f9c3fce46c40296ba9ee8a2Ian Hodson 5747f4c12fce1ee58e670f9c3fce46c40296ba9ee8a2Ian Hodson -shared) 5748f4c12fce1ee58e670f9c3fce46c40296ba9ee8a2Ian Hodson # The effects of -shared are defined in a previous loop. 5749f4c12fce1ee58e670f9c3fce46c40296ba9ee8a2Ian Hodson continue 5750f4c12fce1ee58e670f9c3fce46c40296ba9ee8a2Ian Hodson ;; 5751f4c12fce1ee58e670f9c3fce46c40296ba9ee8a2Ian Hodson 5752f4c12fce1ee58e670f9c3fce46c40296ba9ee8a2Ian Hodson -shrext) 5753f4c12fce1ee58e670f9c3fce46c40296ba9ee8a2Ian Hodson prev=shrext 5754f4c12fce1ee58e670f9c3fce46c40296ba9ee8a2Ian Hodson continue 5755f4c12fce1ee58e670f9c3fce46c40296ba9ee8a2Ian Hodson ;; 5756f4c12fce1ee58e670f9c3fce46c40296ba9ee8a2Ian Hodson 5757f4c12fce1ee58e670f9c3fce46c40296ba9ee8a2Ian Hodson -static | -static-libtool-libs) 5758f4c12fce1ee58e670f9c3fce46c40296ba9ee8a2Ian Hodson # The effects of -static are defined in a previous loop. 5759f4c12fce1ee58e670f9c3fce46c40296ba9ee8a2Ian Hodson # We used to do the same as -all-static on platforms that 5760f4c12fce1ee58e670f9c3fce46c40296ba9ee8a2Ian Hodson # didn't have a PIC flag, but the assumption that the effects 5761f4c12fce1ee58e670f9c3fce46c40296ba9ee8a2Ian Hodson # would be equivalent was wrong. It would break on at least 5762f4c12fce1ee58e670f9c3fce46c40296ba9ee8a2Ian Hodson # Digital Unix and AIX. 5763f4c12fce1ee58e670f9c3fce46c40296ba9ee8a2Ian Hodson continue 5764f4c12fce1ee58e670f9c3fce46c40296ba9ee8a2Ian Hodson ;; 5765f4c12fce1ee58e670f9c3fce46c40296ba9ee8a2Ian Hodson 5766f4c12fce1ee58e670f9c3fce46c40296ba9ee8a2Ian Hodson -thread-safe) 5767f4c12fce1ee58e670f9c3fce46c40296ba9ee8a2Ian Hodson thread_safe=yes 5768f4c12fce1ee58e670f9c3fce46c40296ba9ee8a2Ian Hodson continue 5769f4c12fce1ee58e670f9c3fce46c40296ba9ee8a2Ian Hodson ;; 5770f4c12fce1ee58e670f9c3fce46c40296ba9ee8a2Ian Hodson 5771f4c12fce1ee58e670f9c3fce46c40296ba9ee8a2Ian Hodson -version-info) 5772f4c12fce1ee58e670f9c3fce46c40296ba9ee8a2Ian Hodson prev=vinfo 5773f4c12fce1ee58e670f9c3fce46c40296ba9ee8a2Ian Hodson continue 5774f4c12fce1ee58e670f9c3fce46c40296ba9ee8a2Ian Hodson ;; 5775f4c12fce1ee58e670f9c3fce46c40296ba9ee8a2Ian Hodson 5776f4c12fce1ee58e670f9c3fce46c40296ba9ee8a2Ian Hodson -version-number) 5777f4c12fce1ee58e670f9c3fce46c40296ba9ee8a2Ian Hodson prev=vinfo 5778f4c12fce1ee58e670f9c3fce46c40296ba9ee8a2Ian Hodson vinfo_number=yes 5779f4c12fce1ee58e670f9c3fce46c40296ba9ee8a2Ian Hodson continue 5780f4c12fce1ee58e670f9c3fce46c40296ba9ee8a2Ian Hodson ;; 5781f4c12fce1ee58e670f9c3fce46c40296ba9ee8a2Ian Hodson 5782f4c12fce1ee58e670f9c3fce46c40296ba9ee8a2Ian Hodson -weak) 5783f4c12fce1ee58e670f9c3fce46c40296ba9ee8a2Ian Hodson prev=weak 5784f4c12fce1ee58e670f9c3fce46c40296ba9ee8a2Ian Hodson continue 5785f4c12fce1ee58e670f9c3fce46c40296ba9ee8a2Ian Hodson ;; 5786f4c12fce1ee58e670f9c3fce46c40296ba9ee8a2Ian Hodson 5787f4c12fce1ee58e670f9c3fce46c40296ba9ee8a2Ian Hodson -Wc,*) 5788f4c12fce1ee58e670f9c3fce46c40296ba9ee8a2Ian Hodson func_stripname '-Wc,' '' "$arg" 5789f4c12fce1ee58e670f9c3fce46c40296ba9ee8a2Ian Hodson args=$func_stripname_result 5790f4c12fce1ee58e670f9c3fce46c40296ba9ee8a2Ian Hodson arg= 5791f4c12fce1ee58e670f9c3fce46c40296ba9ee8a2Ian Hodson save_ifs="$IFS"; IFS=',' 5792f4c12fce1ee58e670f9c3fce46c40296ba9ee8a2Ian Hodson for flag in $args; do 5793f4c12fce1ee58e670f9c3fce46c40296ba9ee8a2Ian Hodson IFS="$save_ifs" 5794f4c12fce1ee58e670f9c3fce46c40296ba9ee8a2Ian Hodson func_quote_for_eval "$flag" 57955b6dc79427b8f7eeb6a7ff68034ab8548ce670eaAlexander Gutkin func_append arg " $func_quote_for_eval_result" 57965b6dc79427b8f7eeb6a7ff68034ab8548ce670eaAlexander Gutkin func_append compiler_flags " $func_quote_for_eval_result" 5797f4c12fce1ee58e670f9c3fce46c40296ba9ee8a2Ian Hodson done 5798f4c12fce1ee58e670f9c3fce46c40296ba9ee8a2Ian Hodson IFS="$save_ifs" 5799f4c12fce1ee58e670f9c3fce46c40296ba9ee8a2Ian Hodson func_stripname ' ' '' "$arg" 5800f4c12fce1ee58e670f9c3fce46c40296ba9ee8a2Ian Hodson arg=$func_stripname_result 5801f4c12fce1ee58e670f9c3fce46c40296ba9ee8a2Ian Hodson ;; 5802f4c12fce1ee58e670f9c3fce46c40296ba9ee8a2Ian Hodson 5803f4c12fce1ee58e670f9c3fce46c40296ba9ee8a2Ian Hodson -Wl,*) 5804f4c12fce1ee58e670f9c3fce46c40296ba9ee8a2Ian Hodson func_stripname '-Wl,' '' "$arg" 5805f4c12fce1ee58e670f9c3fce46c40296ba9ee8a2Ian Hodson args=$func_stripname_result 5806f4c12fce1ee58e670f9c3fce46c40296ba9ee8a2Ian Hodson arg= 5807f4c12fce1ee58e670f9c3fce46c40296ba9ee8a2Ian Hodson save_ifs="$IFS"; IFS=',' 5808f4c12fce1ee58e670f9c3fce46c40296ba9ee8a2Ian Hodson for flag in $args; do 5809f4c12fce1ee58e670f9c3fce46c40296ba9ee8a2Ian Hodson IFS="$save_ifs" 5810f4c12fce1ee58e670f9c3fce46c40296ba9ee8a2Ian Hodson func_quote_for_eval "$flag" 58115b6dc79427b8f7eeb6a7ff68034ab8548ce670eaAlexander Gutkin func_append arg " $wl$func_quote_for_eval_result" 58125b6dc79427b8f7eeb6a7ff68034ab8548ce670eaAlexander Gutkin func_append compiler_flags " $wl$func_quote_for_eval_result" 58135b6dc79427b8f7eeb6a7ff68034ab8548ce670eaAlexander Gutkin func_append linker_flags " $func_quote_for_eval_result" 5814f4c12fce1ee58e670f9c3fce46c40296ba9ee8a2Ian Hodson done 5815f4c12fce1ee58e670f9c3fce46c40296ba9ee8a2Ian Hodson IFS="$save_ifs" 5816f4c12fce1ee58e670f9c3fce46c40296ba9ee8a2Ian Hodson func_stripname ' ' '' "$arg" 5817f4c12fce1ee58e670f9c3fce46c40296ba9ee8a2Ian Hodson arg=$func_stripname_result 5818f4c12fce1ee58e670f9c3fce46c40296ba9ee8a2Ian Hodson ;; 5819f4c12fce1ee58e670f9c3fce46c40296ba9ee8a2Ian Hodson 5820f4c12fce1ee58e670f9c3fce46c40296ba9ee8a2Ian Hodson -Xcompiler) 5821f4c12fce1ee58e670f9c3fce46c40296ba9ee8a2Ian Hodson prev=xcompiler 5822f4c12fce1ee58e670f9c3fce46c40296ba9ee8a2Ian Hodson continue 5823f4c12fce1ee58e670f9c3fce46c40296ba9ee8a2Ian Hodson ;; 5824f4c12fce1ee58e670f9c3fce46c40296ba9ee8a2Ian Hodson 5825f4c12fce1ee58e670f9c3fce46c40296ba9ee8a2Ian Hodson -Xlinker) 5826f4c12fce1ee58e670f9c3fce46c40296ba9ee8a2Ian Hodson prev=xlinker 5827f4c12fce1ee58e670f9c3fce46c40296ba9ee8a2Ian Hodson continue 5828f4c12fce1ee58e670f9c3fce46c40296ba9ee8a2Ian Hodson ;; 5829f4c12fce1ee58e670f9c3fce46c40296ba9ee8a2Ian Hodson 5830f4c12fce1ee58e670f9c3fce46c40296ba9ee8a2Ian Hodson -XCClinker) 5831f4c12fce1ee58e670f9c3fce46c40296ba9ee8a2Ian Hodson prev=xcclinker 5832f4c12fce1ee58e670f9c3fce46c40296ba9ee8a2Ian Hodson continue 5833f4c12fce1ee58e670f9c3fce46c40296ba9ee8a2Ian Hodson ;; 5834f4c12fce1ee58e670f9c3fce46c40296ba9ee8a2Ian Hodson 5835f4c12fce1ee58e670f9c3fce46c40296ba9ee8a2Ian Hodson # -msg_* for osf cc 5836f4c12fce1ee58e670f9c3fce46c40296ba9ee8a2Ian Hodson -msg_*) 5837f4c12fce1ee58e670f9c3fce46c40296ba9ee8a2Ian Hodson func_quote_for_eval "$arg" 5838f4c12fce1ee58e670f9c3fce46c40296ba9ee8a2Ian Hodson arg="$func_quote_for_eval_result" 5839f4c12fce1ee58e670f9c3fce46c40296ba9ee8a2Ian Hodson ;; 5840f4c12fce1ee58e670f9c3fce46c40296ba9ee8a2Ian Hodson 58415b6dc79427b8f7eeb6a7ff68034ab8548ce670eaAlexander Gutkin # Flags to be passed through unchanged, with rationale: 58425b6dc79427b8f7eeb6a7ff68034ab8548ce670eaAlexander Gutkin # -64, -mips[0-9] enable 64-bit mode for the SGI compiler 58435b6dc79427b8f7eeb6a7ff68034ab8548ce670eaAlexander Gutkin # -r[0-9][0-9]* specify processor for the SGI compiler 58445b6dc79427b8f7eeb6a7ff68034ab8548ce670eaAlexander Gutkin # -xarch=*, -xtarget=* enable 64-bit mode for the Sun compiler 58455b6dc79427b8f7eeb6a7ff68034ab8548ce670eaAlexander Gutkin # +DA*, +DD* enable 64-bit mode for the HP compiler 58465b6dc79427b8f7eeb6a7ff68034ab8548ce670eaAlexander Gutkin # -q* compiler args for the IBM compiler 58475b6dc79427b8f7eeb6a7ff68034ab8548ce670eaAlexander Gutkin # -m*, -t[45]*, -txscale* architecture-specific flags for GCC 58485b6dc79427b8f7eeb6a7ff68034ab8548ce670eaAlexander Gutkin # -F/path path to uninstalled frameworks, gcc on darwin 58495b6dc79427b8f7eeb6a7ff68034ab8548ce670eaAlexander Gutkin # -p, -pg, --coverage, -fprofile-* profiling flags for GCC 58505b6dc79427b8f7eeb6a7ff68034ab8548ce670eaAlexander Gutkin # @file GCC response files 58515b6dc79427b8f7eeb6a7ff68034ab8548ce670eaAlexander Gutkin # -tp=* Portland pgcc target processor selection 58525b6dc79427b8f7eeb6a7ff68034ab8548ce670eaAlexander Gutkin # --sysroot=* for sysroot support 58535b6dc79427b8f7eeb6a7ff68034ab8548ce670eaAlexander Gutkin # -O*, -flto*, -fwhopr*, -fuse-linker-plugin GCC link-time optimization 5854f4c12fce1ee58e670f9c3fce46c40296ba9ee8a2Ian Hodson -64|-mips[0-9]|-r[0-9][0-9]*|-xarch=*|-xtarget=*|+DA*|+DD*|-q*|-m*| \ 58555b6dc79427b8f7eeb6a7ff68034ab8548ce670eaAlexander Gutkin -t[45]*|-txscale*|-p|-pg|--coverage|-fprofile-*|-F*|@*|-tp=*|--sysroot=*| \ 58565b6dc79427b8f7eeb6a7ff68034ab8548ce670eaAlexander Gutkin -O*|-flto*|-fwhopr*|-fuse-linker-plugin) 5857f4c12fce1ee58e670f9c3fce46c40296ba9ee8a2Ian Hodson func_quote_for_eval "$arg" 5858f4c12fce1ee58e670f9c3fce46c40296ba9ee8a2Ian Hodson arg="$func_quote_for_eval_result" 5859f4c12fce1ee58e670f9c3fce46c40296ba9ee8a2Ian Hodson func_append compile_command " $arg" 5860f4c12fce1ee58e670f9c3fce46c40296ba9ee8a2Ian Hodson func_append finalize_command " $arg" 58615b6dc79427b8f7eeb6a7ff68034ab8548ce670eaAlexander Gutkin func_append compiler_flags " $arg" 5862f4c12fce1ee58e670f9c3fce46c40296ba9ee8a2Ian Hodson continue 5863f4c12fce1ee58e670f9c3fce46c40296ba9ee8a2Ian Hodson ;; 5864f4c12fce1ee58e670f9c3fce46c40296ba9ee8a2Ian Hodson 5865f4c12fce1ee58e670f9c3fce46c40296ba9ee8a2Ian Hodson # Some other compiler flag. 5866f4c12fce1ee58e670f9c3fce46c40296ba9ee8a2Ian Hodson -* | +*) 5867f4c12fce1ee58e670f9c3fce46c40296ba9ee8a2Ian Hodson func_quote_for_eval "$arg" 5868f4c12fce1ee58e670f9c3fce46c40296ba9ee8a2Ian Hodson arg="$func_quote_for_eval_result" 5869f4c12fce1ee58e670f9c3fce46c40296ba9ee8a2Ian Hodson ;; 5870f4c12fce1ee58e670f9c3fce46c40296ba9ee8a2Ian Hodson 5871f4c12fce1ee58e670f9c3fce46c40296ba9ee8a2Ian Hodson *.$objext) 5872f4c12fce1ee58e670f9c3fce46c40296ba9ee8a2Ian Hodson # A standard object. 58735b6dc79427b8f7eeb6a7ff68034ab8548ce670eaAlexander Gutkin func_append objs " $arg" 5874f4c12fce1ee58e670f9c3fce46c40296ba9ee8a2Ian Hodson ;; 5875f4c12fce1ee58e670f9c3fce46c40296ba9ee8a2Ian Hodson 5876f4c12fce1ee58e670f9c3fce46c40296ba9ee8a2Ian Hodson *.lo) 5877f4c12fce1ee58e670f9c3fce46c40296ba9ee8a2Ian Hodson # A libtool-controlled object. 5878f4c12fce1ee58e670f9c3fce46c40296ba9ee8a2Ian Hodson 5879f4c12fce1ee58e670f9c3fce46c40296ba9ee8a2Ian Hodson # Check to see that this really is a libtool object. 5880f4c12fce1ee58e670f9c3fce46c40296ba9ee8a2Ian Hodson if func_lalib_unsafe_p "$arg"; then 5881f4c12fce1ee58e670f9c3fce46c40296ba9ee8a2Ian Hodson pic_object= 5882f4c12fce1ee58e670f9c3fce46c40296ba9ee8a2Ian Hodson non_pic_object= 5883f4c12fce1ee58e670f9c3fce46c40296ba9ee8a2Ian Hodson 5884f4c12fce1ee58e670f9c3fce46c40296ba9ee8a2Ian Hodson # Read the .lo file 5885f4c12fce1ee58e670f9c3fce46c40296ba9ee8a2Ian Hodson func_source "$arg" 5886f4c12fce1ee58e670f9c3fce46c40296ba9ee8a2Ian Hodson 5887f4c12fce1ee58e670f9c3fce46c40296ba9ee8a2Ian Hodson if test -z "$pic_object" || 5888f4c12fce1ee58e670f9c3fce46c40296ba9ee8a2Ian Hodson test -z "$non_pic_object" || 5889f4c12fce1ee58e670f9c3fce46c40296ba9ee8a2Ian Hodson test "$pic_object" = none && 5890f4c12fce1ee58e670f9c3fce46c40296ba9ee8a2Ian Hodson test "$non_pic_object" = none; then 5891f4c12fce1ee58e670f9c3fce46c40296ba9ee8a2Ian Hodson func_fatal_error "cannot find name of object for \`$arg'" 5892f4c12fce1ee58e670f9c3fce46c40296ba9ee8a2Ian Hodson fi 5893f4c12fce1ee58e670f9c3fce46c40296ba9ee8a2Ian Hodson 5894f4c12fce1ee58e670f9c3fce46c40296ba9ee8a2Ian Hodson # Extract subdirectory from the argument. 5895f4c12fce1ee58e670f9c3fce46c40296ba9ee8a2Ian Hodson func_dirname "$arg" "/" "" 5896f4c12fce1ee58e670f9c3fce46c40296ba9ee8a2Ian Hodson xdir="$func_dirname_result" 5897f4c12fce1ee58e670f9c3fce46c40296ba9ee8a2Ian Hodson 5898f4c12fce1ee58e670f9c3fce46c40296ba9ee8a2Ian Hodson if test "$pic_object" != none; then 5899f4c12fce1ee58e670f9c3fce46c40296ba9ee8a2Ian Hodson # Prepend the subdirectory the object is found in. 5900f4c12fce1ee58e670f9c3fce46c40296ba9ee8a2Ian Hodson pic_object="$xdir$pic_object" 5901f4c12fce1ee58e670f9c3fce46c40296ba9ee8a2Ian Hodson 5902f4c12fce1ee58e670f9c3fce46c40296ba9ee8a2Ian Hodson if test "$prev" = dlfiles; then 5903f4c12fce1ee58e670f9c3fce46c40296ba9ee8a2Ian Hodson if test "$build_libtool_libs" = yes && test "$dlopen_support" = yes; then 59045b6dc79427b8f7eeb6a7ff68034ab8548ce670eaAlexander Gutkin func_append dlfiles " $pic_object" 5905f4c12fce1ee58e670f9c3fce46c40296ba9ee8a2Ian Hodson prev= 5906f4c12fce1ee58e670f9c3fce46c40296ba9ee8a2Ian Hodson continue 5907f4c12fce1ee58e670f9c3fce46c40296ba9ee8a2Ian Hodson else 5908f4c12fce1ee58e670f9c3fce46c40296ba9ee8a2Ian Hodson # If libtool objects are unsupported, then we need to preload. 5909f4c12fce1ee58e670f9c3fce46c40296ba9ee8a2Ian Hodson prev=dlprefiles 5910f4c12fce1ee58e670f9c3fce46c40296ba9ee8a2Ian Hodson fi 5911f4c12fce1ee58e670f9c3fce46c40296ba9ee8a2Ian Hodson fi 5912f4c12fce1ee58e670f9c3fce46c40296ba9ee8a2Ian Hodson 5913f4c12fce1ee58e670f9c3fce46c40296ba9ee8a2Ian Hodson # CHECK ME: I think I busted this. -Ossama 5914f4c12fce1ee58e670f9c3fce46c40296ba9ee8a2Ian Hodson if test "$prev" = dlprefiles; then 5915f4c12fce1ee58e670f9c3fce46c40296ba9ee8a2Ian Hodson # Preload the old-style object. 59165b6dc79427b8f7eeb6a7ff68034ab8548ce670eaAlexander Gutkin func_append dlprefiles " $pic_object" 5917f4c12fce1ee58e670f9c3fce46c40296ba9ee8a2Ian Hodson prev= 5918f4c12fce1ee58e670f9c3fce46c40296ba9ee8a2Ian Hodson fi 5919f4c12fce1ee58e670f9c3fce46c40296ba9ee8a2Ian Hodson 5920f4c12fce1ee58e670f9c3fce46c40296ba9ee8a2Ian Hodson # A PIC object. 5921f4c12fce1ee58e670f9c3fce46c40296ba9ee8a2Ian Hodson func_append libobjs " $pic_object" 5922f4c12fce1ee58e670f9c3fce46c40296ba9ee8a2Ian Hodson arg="$pic_object" 5923f4c12fce1ee58e670f9c3fce46c40296ba9ee8a2Ian Hodson fi 5924f4c12fce1ee58e670f9c3fce46c40296ba9ee8a2Ian Hodson 5925f4c12fce1ee58e670f9c3fce46c40296ba9ee8a2Ian Hodson # Non-PIC object. 5926f4c12fce1ee58e670f9c3fce46c40296ba9ee8a2Ian Hodson if test "$non_pic_object" != none; then 5927f4c12fce1ee58e670f9c3fce46c40296ba9ee8a2Ian Hodson # Prepend the subdirectory the object is found in. 5928f4c12fce1ee58e670f9c3fce46c40296ba9ee8a2Ian Hodson non_pic_object="$xdir$non_pic_object" 5929f4c12fce1ee58e670f9c3fce46c40296ba9ee8a2Ian Hodson 5930f4c12fce1ee58e670f9c3fce46c40296ba9ee8a2Ian Hodson # A standard non-PIC object 5931f4c12fce1ee58e670f9c3fce46c40296ba9ee8a2Ian Hodson func_append non_pic_objects " $non_pic_object" 5932f4c12fce1ee58e670f9c3fce46c40296ba9ee8a2Ian Hodson if test -z "$pic_object" || test "$pic_object" = none ; then 5933f4c12fce1ee58e670f9c3fce46c40296ba9ee8a2Ian Hodson arg="$non_pic_object" 5934f4c12fce1ee58e670f9c3fce46c40296ba9ee8a2Ian Hodson fi 5935f4c12fce1ee58e670f9c3fce46c40296ba9ee8a2Ian Hodson else 5936f4c12fce1ee58e670f9c3fce46c40296ba9ee8a2Ian Hodson # If the PIC object exists, use it instead. 5937f4c12fce1ee58e670f9c3fce46c40296ba9ee8a2Ian Hodson # $xdir was prepended to $pic_object above. 5938f4c12fce1ee58e670f9c3fce46c40296ba9ee8a2Ian Hodson non_pic_object="$pic_object" 5939f4c12fce1ee58e670f9c3fce46c40296ba9ee8a2Ian Hodson func_append non_pic_objects " $non_pic_object" 5940f4c12fce1ee58e670f9c3fce46c40296ba9ee8a2Ian Hodson fi 5941f4c12fce1ee58e670f9c3fce46c40296ba9ee8a2Ian Hodson else 5942f4c12fce1ee58e670f9c3fce46c40296ba9ee8a2Ian Hodson # Only an error if not doing a dry-run. 5943f4c12fce1ee58e670f9c3fce46c40296ba9ee8a2Ian Hodson if $opt_dry_run; then 5944f4c12fce1ee58e670f9c3fce46c40296ba9ee8a2Ian Hodson # Extract subdirectory from the argument. 5945f4c12fce1ee58e670f9c3fce46c40296ba9ee8a2Ian Hodson func_dirname "$arg" "/" "" 5946f4c12fce1ee58e670f9c3fce46c40296ba9ee8a2Ian Hodson xdir="$func_dirname_result" 5947f4c12fce1ee58e670f9c3fce46c40296ba9ee8a2Ian Hodson 5948f4c12fce1ee58e670f9c3fce46c40296ba9ee8a2Ian Hodson func_lo2o "$arg" 5949f4c12fce1ee58e670f9c3fce46c40296ba9ee8a2Ian Hodson pic_object=$xdir$objdir/$func_lo2o_result 5950f4c12fce1ee58e670f9c3fce46c40296ba9ee8a2Ian Hodson non_pic_object=$xdir$func_lo2o_result 5951f4c12fce1ee58e670f9c3fce46c40296ba9ee8a2Ian Hodson func_append libobjs " $pic_object" 5952f4c12fce1ee58e670f9c3fce46c40296ba9ee8a2Ian Hodson func_append non_pic_objects " $non_pic_object" 5953f4c12fce1ee58e670f9c3fce46c40296ba9ee8a2Ian Hodson else 5954f4c12fce1ee58e670f9c3fce46c40296ba9ee8a2Ian Hodson func_fatal_error "\`$arg' is not a valid libtool object" 5955f4c12fce1ee58e670f9c3fce46c40296ba9ee8a2Ian Hodson fi 5956f4c12fce1ee58e670f9c3fce46c40296ba9ee8a2Ian Hodson fi 5957f4c12fce1ee58e670f9c3fce46c40296ba9ee8a2Ian Hodson ;; 5958f4c12fce1ee58e670f9c3fce46c40296ba9ee8a2Ian Hodson 5959f4c12fce1ee58e670f9c3fce46c40296ba9ee8a2Ian Hodson *.$libext) 5960f4c12fce1ee58e670f9c3fce46c40296ba9ee8a2Ian Hodson # An archive. 59615b6dc79427b8f7eeb6a7ff68034ab8548ce670eaAlexander Gutkin func_append deplibs " $arg" 59625b6dc79427b8f7eeb6a7ff68034ab8548ce670eaAlexander Gutkin func_append old_deplibs " $arg" 5963f4c12fce1ee58e670f9c3fce46c40296ba9ee8a2Ian Hodson continue 5964f4c12fce1ee58e670f9c3fce46c40296ba9ee8a2Ian Hodson ;; 5965f4c12fce1ee58e670f9c3fce46c40296ba9ee8a2Ian Hodson 5966f4c12fce1ee58e670f9c3fce46c40296ba9ee8a2Ian Hodson *.la) 5967f4c12fce1ee58e670f9c3fce46c40296ba9ee8a2Ian Hodson # A libtool-controlled library. 5968f4c12fce1ee58e670f9c3fce46c40296ba9ee8a2Ian Hodson 59695b6dc79427b8f7eeb6a7ff68034ab8548ce670eaAlexander Gutkin func_resolve_sysroot "$arg" 5970f4c12fce1ee58e670f9c3fce46c40296ba9ee8a2Ian Hodson if test "$prev" = dlfiles; then 5971f4c12fce1ee58e670f9c3fce46c40296ba9ee8a2Ian Hodson # This library was specified with -dlopen. 59725b6dc79427b8f7eeb6a7ff68034ab8548ce670eaAlexander Gutkin func_append dlfiles " $func_resolve_sysroot_result" 5973f4c12fce1ee58e670f9c3fce46c40296ba9ee8a2Ian Hodson prev= 5974f4c12fce1ee58e670f9c3fce46c40296ba9ee8a2Ian Hodson elif test "$prev" = dlprefiles; then 5975f4c12fce1ee58e670f9c3fce46c40296ba9ee8a2Ian Hodson # The library was specified with -dlpreopen. 59765b6dc79427b8f7eeb6a7ff68034ab8548ce670eaAlexander Gutkin func_append dlprefiles " $func_resolve_sysroot_result" 5977f4c12fce1ee58e670f9c3fce46c40296ba9ee8a2Ian Hodson prev= 5978f4c12fce1ee58e670f9c3fce46c40296ba9ee8a2Ian Hodson else 59795b6dc79427b8f7eeb6a7ff68034ab8548ce670eaAlexander Gutkin func_append deplibs " $func_resolve_sysroot_result" 5980f4c12fce1ee58e670f9c3fce46c40296ba9ee8a2Ian Hodson fi 5981f4c12fce1ee58e670f9c3fce46c40296ba9ee8a2Ian Hodson continue 5982f4c12fce1ee58e670f9c3fce46c40296ba9ee8a2Ian Hodson ;; 5983f4c12fce1ee58e670f9c3fce46c40296ba9ee8a2Ian Hodson 5984f4c12fce1ee58e670f9c3fce46c40296ba9ee8a2Ian Hodson # Some other compiler argument. 5985f4c12fce1ee58e670f9c3fce46c40296ba9ee8a2Ian Hodson *) 5986f4c12fce1ee58e670f9c3fce46c40296ba9ee8a2Ian Hodson # Unknown arguments in both finalize_command and compile_command need 5987f4c12fce1ee58e670f9c3fce46c40296ba9ee8a2Ian Hodson # to be aesthetically quoted because they are evaled later. 5988f4c12fce1ee58e670f9c3fce46c40296ba9ee8a2Ian Hodson func_quote_for_eval "$arg" 5989f4c12fce1ee58e670f9c3fce46c40296ba9ee8a2Ian Hodson arg="$func_quote_for_eval_result" 5990f4c12fce1ee58e670f9c3fce46c40296ba9ee8a2Ian Hodson ;; 5991f4c12fce1ee58e670f9c3fce46c40296ba9ee8a2Ian Hodson esac # arg 5992f4c12fce1ee58e670f9c3fce46c40296ba9ee8a2Ian Hodson 5993f4c12fce1ee58e670f9c3fce46c40296ba9ee8a2Ian Hodson # Now actually substitute the argument into the commands. 5994f4c12fce1ee58e670f9c3fce46c40296ba9ee8a2Ian Hodson if test -n "$arg"; then 5995f4c12fce1ee58e670f9c3fce46c40296ba9ee8a2Ian Hodson func_append compile_command " $arg" 5996f4c12fce1ee58e670f9c3fce46c40296ba9ee8a2Ian Hodson func_append finalize_command " $arg" 5997f4c12fce1ee58e670f9c3fce46c40296ba9ee8a2Ian Hodson fi 5998f4c12fce1ee58e670f9c3fce46c40296ba9ee8a2Ian Hodson done # argument parsing loop 5999f4c12fce1ee58e670f9c3fce46c40296ba9ee8a2Ian Hodson 6000f4c12fce1ee58e670f9c3fce46c40296ba9ee8a2Ian Hodson test -n "$prev" && \ 6001f4c12fce1ee58e670f9c3fce46c40296ba9ee8a2Ian Hodson func_fatal_help "the \`$prevarg' option requires an argument" 6002f4c12fce1ee58e670f9c3fce46c40296ba9ee8a2Ian Hodson 6003f4c12fce1ee58e670f9c3fce46c40296ba9ee8a2Ian Hodson if test "$export_dynamic" = yes && test -n "$export_dynamic_flag_spec"; then 6004f4c12fce1ee58e670f9c3fce46c40296ba9ee8a2Ian Hodson eval arg=\"$export_dynamic_flag_spec\" 6005f4c12fce1ee58e670f9c3fce46c40296ba9ee8a2Ian Hodson func_append compile_command " $arg" 6006f4c12fce1ee58e670f9c3fce46c40296ba9ee8a2Ian Hodson func_append finalize_command " $arg" 6007f4c12fce1ee58e670f9c3fce46c40296ba9ee8a2Ian Hodson fi 6008f4c12fce1ee58e670f9c3fce46c40296ba9ee8a2Ian Hodson 6009f4c12fce1ee58e670f9c3fce46c40296ba9ee8a2Ian Hodson oldlibs= 6010f4c12fce1ee58e670f9c3fce46c40296ba9ee8a2Ian Hodson # calculate the name of the file, without its directory 6011f4c12fce1ee58e670f9c3fce46c40296ba9ee8a2Ian Hodson func_basename "$output" 6012f4c12fce1ee58e670f9c3fce46c40296ba9ee8a2Ian Hodson outputname="$func_basename_result" 6013f4c12fce1ee58e670f9c3fce46c40296ba9ee8a2Ian Hodson libobjs_save="$libobjs" 6014f4c12fce1ee58e670f9c3fce46c40296ba9ee8a2Ian Hodson 6015f4c12fce1ee58e670f9c3fce46c40296ba9ee8a2Ian Hodson if test -n "$shlibpath_var"; then 6016f4c12fce1ee58e670f9c3fce46c40296ba9ee8a2Ian Hodson # get the directories listed in $shlibpath_var 60175b6dc79427b8f7eeb6a7ff68034ab8548ce670eaAlexander Gutkin eval shlib_search_path=\`\$ECHO \"\${$shlibpath_var}\" \| \$SED \'s/:/ /g\'\` 6018f4c12fce1ee58e670f9c3fce46c40296ba9ee8a2Ian Hodson else 6019f4c12fce1ee58e670f9c3fce46c40296ba9ee8a2Ian Hodson shlib_search_path= 6020f4c12fce1ee58e670f9c3fce46c40296ba9ee8a2Ian Hodson fi 6021f4c12fce1ee58e670f9c3fce46c40296ba9ee8a2Ian Hodson eval sys_lib_search_path=\"$sys_lib_search_path_spec\" 6022f4c12fce1ee58e670f9c3fce46c40296ba9ee8a2Ian Hodson eval sys_lib_dlsearch_path=\"$sys_lib_dlsearch_path_spec\" 6023f4c12fce1ee58e670f9c3fce46c40296ba9ee8a2Ian Hodson 6024f4c12fce1ee58e670f9c3fce46c40296ba9ee8a2Ian Hodson func_dirname "$output" "/" "" 6025f4c12fce1ee58e670f9c3fce46c40296ba9ee8a2Ian Hodson output_objdir="$func_dirname_result$objdir" 60265b6dc79427b8f7eeb6a7ff68034ab8548ce670eaAlexander Gutkin func_to_tool_file "$output_objdir/" 60275b6dc79427b8f7eeb6a7ff68034ab8548ce670eaAlexander Gutkin tool_output_objdir=$func_to_tool_file_result 6028f4c12fce1ee58e670f9c3fce46c40296ba9ee8a2Ian Hodson # Create the object directory. 6029f4c12fce1ee58e670f9c3fce46c40296ba9ee8a2Ian Hodson func_mkdir_p "$output_objdir" 6030f4c12fce1ee58e670f9c3fce46c40296ba9ee8a2Ian Hodson 6031f4c12fce1ee58e670f9c3fce46c40296ba9ee8a2Ian Hodson # Determine the type of output 6032f4c12fce1ee58e670f9c3fce46c40296ba9ee8a2Ian Hodson case $output in 6033f4c12fce1ee58e670f9c3fce46c40296ba9ee8a2Ian Hodson "") 6034f4c12fce1ee58e670f9c3fce46c40296ba9ee8a2Ian Hodson func_fatal_help "you must specify an output file" 6035f4c12fce1ee58e670f9c3fce46c40296ba9ee8a2Ian Hodson ;; 6036f4c12fce1ee58e670f9c3fce46c40296ba9ee8a2Ian Hodson *.$libext) linkmode=oldlib ;; 6037f4c12fce1ee58e670f9c3fce46c40296ba9ee8a2Ian Hodson *.lo | *.$objext) linkmode=obj ;; 6038f4c12fce1ee58e670f9c3fce46c40296ba9ee8a2Ian Hodson *.la) linkmode=lib ;; 6039f4c12fce1ee58e670f9c3fce46c40296ba9ee8a2Ian Hodson *) linkmode=prog ;; # Anything else should be a program. 6040f4c12fce1ee58e670f9c3fce46c40296ba9ee8a2Ian Hodson esac 6041f4c12fce1ee58e670f9c3fce46c40296ba9ee8a2Ian Hodson 6042f4c12fce1ee58e670f9c3fce46c40296ba9ee8a2Ian Hodson specialdeplibs= 6043f4c12fce1ee58e670f9c3fce46c40296ba9ee8a2Ian Hodson 6044f4c12fce1ee58e670f9c3fce46c40296ba9ee8a2Ian Hodson libs= 6045f4c12fce1ee58e670f9c3fce46c40296ba9ee8a2Ian Hodson # Find all interdependent deplibs by searching for libraries 6046f4c12fce1ee58e670f9c3fce46c40296ba9ee8a2Ian Hodson # that are linked more than once (e.g. -la -lb -la) 6047f4c12fce1ee58e670f9c3fce46c40296ba9ee8a2Ian Hodson for deplib in $deplibs; do 60485b6dc79427b8f7eeb6a7ff68034ab8548ce670eaAlexander Gutkin if $opt_preserve_dup_deps ; then 6049f4c12fce1ee58e670f9c3fce46c40296ba9ee8a2Ian Hodson case "$libs " in 60505b6dc79427b8f7eeb6a7ff68034ab8548ce670eaAlexander Gutkin *" $deplib "*) func_append specialdeplibs " $deplib" ;; 6051f4c12fce1ee58e670f9c3fce46c40296ba9ee8a2Ian Hodson esac 6052f4c12fce1ee58e670f9c3fce46c40296ba9ee8a2Ian Hodson fi 60535b6dc79427b8f7eeb6a7ff68034ab8548ce670eaAlexander Gutkin func_append libs " $deplib" 6054f4c12fce1ee58e670f9c3fce46c40296ba9ee8a2Ian Hodson done 6055f4c12fce1ee58e670f9c3fce46c40296ba9ee8a2Ian Hodson 6056f4c12fce1ee58e670f9c3fce46c40296ba9ee8a2Ian Hodson if test "$linkmode" = lib; then 6057f4c12fce1ee58e670f9c3fce46c40296ba9ee8a2Ian Hodson libs="$predeps $libs $compiler_lib_search_path $postdeps" 6058f4c12fce1ee58e670f9c3fce46c40296ba9ee8a2Ian Hodson 6059f4c12fce1ee58e670f9c3fce46c40296ba9ee8a2Ian Hodson # Compute libraries that are listed more than once in $predeps 6060f4c12fce1ee58e670f9c3fce46c40296ba9ee8a2Ian Hodson # $postdeps and mark them as special (i.e., whose duplicates are 6061f4c12fce1ee58e670f9c3fce46c40296ba9ee8a2Ian Hodson # not to be eliminated). 6062f4c12fce1ee58e670f9c3fce46c40296ba9ee8a2Ian Hodson pre_post_deps= 6063f4c12fce1ee58e670f9c3fce46c40296ba9ee8a2Ian Hodson if $opt_duplicate_compiler_generated_deps; then 6064f4c12fce1ee58e670f9c3fce46c40296ba9ee8a2Ian Hodson for pre_post_dep in $predeps $postdeps; do 6065f4c12fce1ee58e670f9c3fce46c40296ba9ee8a2Ian Hodson case "$pre_post_deps " in 60665b6dc79427b8f7eeb6a7ff68034ab8548ce670eaAlexander Gutkin *" $pre_post_dep "*) func_append specialdeplibs " $pre_post_deps" ;; 6067f4c12fce1ee58e670f9c3fce46c40296ba9ee8a2Ian Hodson esac 60685b6dc79427b8f7eeb6a7ff68034ab8548ce670eaAlexander Gutkin func_append pre_post_deps " $pre_post_dep" 6069f4c12fce1ee58e670f9c3fce46c40296ba9ee8a2Ian Hodson done 6070f4c12fce1ee58e670f9c3fce46c40296ba9ee8a2Ian Hodson fi 6071f4c12fce1ee58e670f9c3fce46c40296ba9ee8a2Ian Hodson pre_post_deps= 6072f4c12fce1ee58e670f9c3fce46c40296ba9ee8a2Ian Hodson fi 6073f4c12fce1ee58e670f9c3fce46c40296ba9ee8a2Ian Hodson 6074f4c12fce1ee58e670f9c3fce46c40296ba9ee8a2Ian Hodson deplibs= 6075f4c12fce1ee58e670f9c3fce46c40296ba9ee8a2Ian Hodson newdependency_libs= 6076f4c12fce1ee58e670f9c3fce46c40296ba9ee8a2Ian Hodson newlib_search_path= 6077f4c12fce1ee58e670f9c3fce46c40296ba9ee8a2Ian Hodson need_relink=no # whether we're linking any uninstalled libtool libraries 6078f4c12fce1ee58e670f9c3fce46c40296ba9ee8a2Ian Hodson notinst_deplibs= # not-installed libtool libraries 6079f4c12fce1ee58e670f9c3fce46c40296ba9ee8a2Ian Hodson notinst_path= # paths that contain not-installed libtool libraries 6080f4c12fce1ee58e670f9c3fce46c40296ba9ee8a2Ian Hodson 6081f4c12fce1ee58e670f9c3fce46c40296ba9ee8a2Ian Hodson case $linkmode in 6082f4c12fce1ee58e670f9c3fce46c40296ba9ee8a2Ian Hodson lib) 6083f4c12fce1ee58e670f9c3fce46c40296ba9ee8a2Ian Hodson passes="conv dlpreopen link" 6084f4c12fce1ee58e670f9c3fce46c40296ba9ee8a2Ian Hodson for file in $dlfiles $dlprefiles; do 6085f4c12fce1ee58e670f9c3fce46c40296ba9ee8a2Ian Hodson case $file in 6086f4c12fce1ee58e670f9c3fce46c40296ba9ee8a2Ian Hodson *.la) ;; 6087f4c12fce1ee58e670f9c3fce46c40296ba9ee8a2Ian Hodson *) 6088f4c12fce1ee58e670f9c3fce46c40296ba9ee8a2Ian Hodson func_fatal_help "libraries can \`-dlopen' only libtool libraries: $file" 6089f4c12fce1ee58e670f9c3fce46c40296ba9ee8a2Ian Hodson ;; 6090f4c12fce1ee58e670f9c3fce46c40296ba9ee8a2Ian Hodson esac 6091f4c12fce1ee58e670f9c3fce46c40296ba9ee8a2Ian Hodson done 6092f4c12fce1ee58e670f9c3fce46c40296ba9ee8a2Ian Hodson ;; 6093f4c12fce1ee58e670f9c3fce46c40296ba9ee8a2Ian Hodson prog) 6094f4c12fce1ee58e670f9c3fce46c40296ba9ee8a2Ian Hodson compile_deplibs= 6095f4c12fce1ee58e670f9c3fce46c40296ba9ee8a2Ian Hodson finalize_deplibs= 6096f4c12fce1ee58e670f9c3fce46c40296ba9ee8a2Ian Hodson alldeplibs=no 6097f4c12fce1ee58e670f9c3fce46c40296ba9ee8a2Ian Hodson newdlfiles= 6098f4c12fce1ee58e670f9c3fce46c40296ba9ee8a2Ian Hodson newdlprefiles= 6099f4c12fce1ee58e670f9c3fce46c40296ba9ee8a2Ian Hodson passes="conv scan dlopen dlpreopen link" 6100f4c12fce1ee58e670f9c3fce46c40296ba9ee8a2Ian Hodson ;; 6101f4c12fce1ee58e670f9c3fce46c40296ba9ee8a2Ian Hodson *) passes="conv" 6102f4c12fce1ee58e670f9c3fce46c40296ba9ee8a2Ian Hodson ;; 6103f4c12fce1ee58e670f9c3fce46c40296ba9ee8a2Ian Hodson esac 6104f4c12fce1ee58e670f9c3fce46c40296ba9ee8a2Ian Hodson 6105f4c12fce1ee58e670f9c3fce46c40296ba9ee8a2Ian Hodson for pass in $passes; do 6106f4c12fce1ee58e670f9c3fce46c40296ba9ee8a2Ian Hodson # The preopen pass in lib mode reverses $deplibs; put it back here 6107f4c12fce1ee58e670f9c3fce46c40296ba9ee8a2Ian Hodson # so that -L comes before libs that need it for instance... 6108f4c12fce1ee58e670f9c3fce46c40296ba9ee8a2Ian Hodson if test "$linkmode,$pass" = "lib,link"; then 6109f4c12fce1ee58e670f9c3fce46c40296ba9ee8a2Ian Hodson ## FIXME: Find the place where the list is rebuilt in the wrong 6110f4c12fce1ee58e670f9c3fce46c40296ba9ee8a2Ian Hodson ## order, and fix it there properly 6111f4c12fce1ee58e670f9c3fce46c40296ba9ee8a2Ian Hodson tmp_deplibs= 6112f4c12fce1ee58e670f9c3fce46c40296ba9ee8a2Ian Hodson for deplib in $deplibs; do 6113f4c12fce1ee58e670f9c3fce46c40296ba9ee8a2Ian Hodson tmp_deplibs="$deplib $tmp_deplibs" 6114f4c12fce1ee58e670f9c3fce46c40296ba9ee8a2Ian Hodson done 6115f4c12fce1ee58e670f9c3fce46c40296ba9ee8a2Ian Hodson deplibs="$tmp_deplibs" 6116f4c12fce1ee58e670f9c3fce46c40296ba9ee8a2Ian Hodson fi 6117f4c12fce1ee58e670f9c3fce46c40296ba9ee8a2Ian Hodson 6118f4c12fce1ee58e670f9c3fce46c40296ba9ee8a2Ian Hodson if test "$linkmode,$pass" = "lib,link" || 6119f4c12fce1ee58e670f9c3fce46c40296ba9ee8a2Ian Hodson test "$linkmode,$pass" = "prog,scan"; then 6120f4c12fce1ee58e670f9c3fce46c40296ba9ee8a2Ian Hodson libs="$deplibs" 6121f4c12fce1ee58e670f9c3fce46c40296ba9ee8a2Ian Hodson deplibs= 6122f4c12fce1ee58e670f9c3fce46c40296ba9ee8a2Ian Hodson fi 6123f4c12fce1ee58e670f9c3fce46c40296ba9ee8a2Ian Hodson if test "$linkmode" = prog; then 6124f4c12fce1ee58e670f9c3fce46c40296ba9ee8a2Ian Hodson case $pass in 6125f4c12fce1ee58e670f9c3fce46c40296ba9ee8a2Ian Hodson dlopen) libs="$dlfiles" ;; 6126f4c12fce1ee58e670f9c3fce46c40296ba9ee8a2Ian Hodson dlpreopen) libs="$dlprefiles" ;; 6127f4c12fce1ee58e670f9c3fce46c40296ba9ee8a2Ian Hodson link) 6128f4c12fce1ee58e670f9c3fce46c40296ba9ee8a2Ian Hodson libs="$deplibs %DEPLIBS%" 6129f4c12fce1ee58e670f9c3fce46c40296ba9ee8a2Ian Hodson test "X$link_all_deplibs" != Xno && libs="$libs $dependency_libs" 6130f4c12fce1ee58e670f9c3fce46c40296ba9ee8a2Ian Hodson ;; 6131f4c12fce1ee58e670f9c3fce46c40296ba9ee8a2Ian Hodson esac 6132f4c12fce1ee58e670f9c3fce46c40296ba9ee8a2Ian Hodson fi 6133f4c12fce1ee58e670f9c3fce46c40296ba9ee8a2Ian Hodson if test "$linkmode,$pass" = "lib,dlpreopen"; then 6134f4c12fce1ee58e670f9c3fce46c40296ba9ee8a2Ian Hodson # Collect and forward deplibs of preopened libtool libs 6135f4c12fce1ee58e670f9c3fce46c40296ba9ee8a2Ian Hodson for lib in $dlprefiles; do 6136f4c12fce1ee58e670f9c3fce46c40296ba9ee8a2Ian Hodson # Ignore non-libtool-libs 6137f4c12fce1ee58e670f9c3fce46c40296ba9ee8a2Ian Hodson dependency_libs= 61385b6dc79427b8f7eeb6a7ff68034ab8548ce670eaAlexander Gutkin func_resolve_sysroot "$lib" 6139f4c12fce1ee58e670f9c3fce46c40296ba9ee8a2Ian Hodson case $lib in 61405b6dc79427b8f7eeb6a7ff68034ab8548ce670eaAlexander Gutkin *.la) func_source "$func_resolve_sysroot_result" ;; 6141f4c12fce1ee58e670f9c3fce46c40296ba9ee8a2Ian Hodson esac 6142f4c12fce1ee58e670f9c3fce46c40296ba9ee8a2Ian Hodson 6143f4c12fce1ee58e670f9c3fce46c40296ba9ee8a2Ian Hodson # Collect preopened libtool deplibs, except any this library 6144f4c12fce1ee58e670f9c3fce46c40296ba9ee8a2Ian Hodson # has declared as weak libs 6145f4c12fce1ee58e670f9c3fce46c40296ba9ee8a2Ian Hodson for deplib in $dependency_libs; do 61465b6dc79427b8f7eeb6a7ff68034ab8548ce670eaAlexander Gutkin func_basename "$deplib" 61475b6dc79427b8f7eeb6a7ff68034ab8548ce670eaAlexander Gutkin deplib_base=$func_basename_result 6148f4c12fce1ee58e670f9c3fce46c40296ba9ee8a2Ian Hodson case " $weak_libs " in 6149f4c12fce1ee58e670f9c3fce46c40296ba9ee8a2Ian Hodson *" $deplib_base "*) ;; 61505b6dc79427b8f7eeb6a7ff68034ab8548ce670eaAlexander Gutkin *) func_append deplibs " $deplib" ;; 6151f4c12fce1ee58e670f9c3fce46c40296ba9ee8a2Ian Hodson esac 6152f4c12fce1ee58e670f9c3fce46c40296ba9ee8a2Ian Hodson done 6153f4c12fce1ee58e670f9c3fce46c40296ba9ee8a2Ian Hodson done 6154f4c12fce1ee58e670f9c3fce46c40296ba9ee8a2Ian Hodson libs="$dlprefiles" 6155f4c12fce1ee58e670f9c3fce46c40296ba9ee8a2Ian Hodson fi 6156f4c12fce1ee58e670f9c3fce46c40296ba9ee8a2Ian Hodson if test "$pass" = dlopen; then 6157f4c12fce1ee58e670f9c3fce46c40296ba9ee8a2Ian Hodson # Collect dlpreopened libraries 6158f4c12fce1ee58e670f9c3fce46c40296ba9ee8a2Ian Hodson save_deplibs="$deplibs" 6159f4c12fce1ee58e670f9c3fce46c40296ba9ee8a2Ian Hodson deplibs= 6160f4c12fce1ee58e670f9c3fce46c40296ba9ee8a2Ian Hodson fi 6161f4c12fce1ee58e670f9c3fce46c40296ba9ee8a2Ian Hodson 6162f4c12fce1ee58e670f9c3fce46c40296ba9ee8a2Ian Hodson for deplib in $libs; do 6163f4c12fce1ee58e670f9c3fce46c40296ba9ee8a2Ian Hodson lib= 6164f4c12fce1ee58e670f9c3fce46c40296ba9ee8a2Ian Hodson found=no 6165f4c12fce1ee58e670f9c3fce46c40296ba9ee8a2Ian Hodson case $deplib in 61665b6dc79427b8f7eeb6a7ff68034ab8548ce670eaAlexander Gutkin -mt|-mthreads|-kthread|-Kthread|-pthread|-pthreads|--thread-safe \ 61675b6dc79427b8f7eeb6a7ff68034ab8548ce670eaAlexander Gutkin |-threads|-fopenmp|-openmp|-mp|-xopenmp|-omp|-qsmp=*) 6168f4c12fce1ee58e670f9c3fce46c40296ba9ee8a2Ian Hodson if test "$linkmode,$pass" = "prog,link"; then 6169f4c12fce1ee58e670f9c3fce46c40296ba9ee8a2Ian Hodson compile_deplibs="$deplib $compile_deplibs" 6170f4c12fce1ee58e670f9c3fce46c40296ba9ee8a2Ian Hodson finalize_deplibs="$deplib $finalize_deplibs" 6171f4c12fce1ee58e670f9c3fce46c40296ba9ee8a2Ian Hodson else 61725b6dc79427b8f7eeb6a7ff68034ab8548ce670eaAlexander Gutkin func_append compiler_flags " $deplib" 6173f4c12fce1ee58e670f9c3fce46c40296ba9ee8a2Ian Hodson if test "$linkmode" = lib ; then 6174f4c12fce1ee58e670f9c3fce46c40296ba9ee8a2Ian Hodson case "$new_inherited_linker_flags " in 6175f4c12fce1ee58e670f9c3fce46c40296ba9ee8a2Ian Hodson *" $deplib "*) ;; 61765b6dc79427b8f7eeb6a7ff68034ab8548ce670eaAlexander Gutkin * ) func_append new_inherited_linker_flags " $deplib" ;; 6177f4c12fce1ee58e670f9c3fce46c40296ba9ee8a2Ian Hodson esac 6178f4c12fce1ee58e670f9c3fce46c40296ba9ee8a2Ian Hodson fi 6179f4c12fce1ee58e670f9c3fce46c40296ba9ee8a2Ian Hodson fi 6180f4c12fce1ee58e670f9c3fce46c40296ba9ee8a2Ian Hodson continue 6181f4c12fce1ee58e670f9c3fce46c40296ba9ee8a2Ian Hodson ;; 6182f4c12fce1ee58e670f9c3fce46c40296ba9ee8a2Ian Hodson -l*) 6183f4c12fce1ee58e670f9c3fce46c40296ba9ee8a2Ian Hodson if test "$linkmode" != lib && test "$linkmode" != prog; then 6184f4c12fce1ee58e670f9c3fce46c40296ba9ee8a2Ian Hodson func_warning "\`-l' is ignored for archives/objects" 6185f4c12fce1ee58e670f9c3fce46c40296ba9ee8a2Ian Hodson continue 6186f4c12fce1ee58e670f9c3fce46c40296ba9ee8a2Ian Hodson fi 6187f4c12fce1ee58e670f9c3fce46c40296ba9ee8a2Ian Hodson func_stripname '-l' '' "$deplib" 6188f4c12fce1ee58e670f9c3fce46c40296ba9ee8a2Ian Hodson name=$func_stripname_result 6189f4c12fce1ee58e670f9c3fce46c40296ba9ee8a2Ian Hodson if test "$linkmode" = lib; then 6190f4c12fce1ee58e670f9c3fce46c40296ba9ee8a2Ian Hodson searchdirs="$newlib_search_path $lib_search_path $compiler_lib_search_dirs $sys_lib_search_path $shlib_search_path" 6191f4c12fce1ee58e670f9c3fce46c40296ba9ee8a2Ian Hodson else 6192f4c12fce1ee58e670f9c3fce46c40296ba9ee8a2Ian Hodson searchdirs="$newlib_search_path $lib_search_path $sys_lib_search_path $shlib_search_path" 6193f4c12fce1ee58e670f9c3fce46c40296ba9ee8a2Ian Hodson fi 6194f4c12fce1ee58e670f9c3fce46c40296ba9ee8a2Ian Hodson for searchdir in $searchdirs; do 6195f4c12fce1ee58e670f9c3fce46c40296ba9ee8a2Ian Hodson for search_ext in .la $std_shrext .so .a; do 6196f4c12fce1ee58e670f9c3fce46c40296ba9ee8a2Ian Hodson # Search the libtool library 6197f4c12fce1ee58e670f9c3fce46c40296ba9ee8a2Ian Hodson lib="$searchdir/lib${name}${search_ext}" 6198f4c12fce1ee58e670f9c3fce46c40296ba9ee8a2Ian Hodson if test -f "$lib"; then 6199f4c12fce1ee58e670f9c3fce46c40296ba9ee8a2Ian Hodson if test "$search_ext" = ".la"; then 6200f4c12fce1ee58e670f9c3fce46c40296ba9ee8a2Ian Hodson found=yes 6201f4c12fce1ee58e670f9c3fce46c40296ba9ee8a2Ian Hodson else 6202f4c12fce1ee58e670f9c3fce46c40296ba9ee8a2Ian Hodson found=no 6203f4c12fce1ee58e670f9c3fce46c40296ba9ee8a2Ian Hodson fi 6204f4c12fce1ee58e670f9c3fce46c40296ba9ee8a2Ian Hodson break 2 6205f4c12fce1ee58e670f9c3fce46c40296ba9ee8a2Ian Hodson fi 6206f4c12fce1ee58e670f9c3fce46c40296ba9ee8a2Ian Hodson done 6207f4c12fce1ee58e670f9c3fce46c40296ba9ee8a2Ian Hodson done 6208f4c12fce1ee58e670f9c3fce46c40296ba9ee8a2Ian Hodson if test "$found" != yes; then 6209f4c12fce1ee58e670f9c3fce46c40296ba9ee8a2Ian Hodson # deplib doesn't seem to be a libtool library 6210f4c12fce1ee58e670f9c3fce46c40296ba9ee8a2Ian Hodson if test "$linkmode,$pass" = "prog,link"; then 6211f4c12fce1ee58e670f9c3fce46c40296ba9ee8a2Ian Hodson compile_deplibs="$deplib $compile_deplibs" 6212f4c12fce1ee58e670f9c3fce46c40296ba9ee8a2Ian Hodson finalize_deplibs="$deplib $finalize_deplibs" 6213f4c12fce1ee58e670f9c3fce46c40296ba9ee8a2Ian Hodson else 6214f4c12fce1ee58e670f9c3fce46c40296ba9ee8a2Ian Hodson deplibs="$deplib $deplibs" 6215f4c12fce1ee58e670f9c3fce46c40296ba9ee8a2Ian Hodson test "$linkmode" = lib && newdependency_libs="$deplib $newdependency_libs" 6216f4c12fce1ee58e670f9c3fce46c40296ba9ee8a2Ian Hodson fi 6217f4c12fce1ee58e670f9c3fce46c40296ba9ee8a2Ian Hodson continue 6218f4c12fce1ee58e670f9c3fce46c40296ba9ee8a2Ian Hodson else # deplib is a libtool library 6219f4c12fce1ee58e670f9c3fce46c40296ba9ee8a2Ian Hodson # If $allow_libtool_libs_with_static_runtimes && $deplib is a stdlib, 6220f4c12fce1ee58e670f9c3fce46c40296ba9ee8a2Ian Hodson # We need to do some special things here, and not later. 6221f4c12fce1ee58e670f9c3fce46c40296ba9ee8a2Ian Hodson if test "X$allow_libtool_libs_with_static_runtimes" = "Xyes" ; then 6222f4c12fce1ee58e670f9c3fce46c40296ba9ee8a2Ian Hodson case " $predeps $postdeps " in 6223f4c12fce1ee58e670f9c3fce46c40296ba9ee8a2Ian Hodson *" $deplib "*) 6224f4c12fce1ee58e670f9c3fce46c40296ba9ee8a2Ian Hodson if func_lalib_p "$lib"; then 6225f4c12fce1ee58e670f9c3fce46c40296ba9ee8a2Ian Hodson library_names= 6226f4c12fce1ee58e670f9c3fce46c40296ba9ee8a2Ian Hodson old_library= 6227f4c12fce1ee58e670f9c3fce46c40296ba9ee8a2Ian Hodson func_source "$lib" 6228f4c12fce1ee58e670f9c3fce46c40296ba9ee8a2Ian Hodson for l in $old_library $library_names; do 6229f4c12fce1ee58e670f9c3fce46c40296ba9ee8a2Ian Hodson ll="$l" 6230f4c12fce1ee58e670f9c3fce46c40296ba9ee8a2Ian Hodson done 6231f4c12fce1ee58e670f9c3fce46c40296ba9ee8a2Ian Hodson if test "X$ll" = "X$old_library" ; then # only static version available 6232f4c12fce1ee58e670f9c3fce46c40296ba9ee8a2Ian Hodson found=no 6233f4c12fce1ee58e670f9c3fce46c40296ba9ee8a2Ian Hodson func_dirname "$lib" "" "." 6234f4c12fce1ee58e670f9c3fce46c40296ba9ee8a2Ian Hodson ladir="$func_dirname_result" 6235f4c12fce1ee58e670f9c3fce46c40296ba9ee8a2Ian Hodson lib=$ladir/$old_library 6236f4c12fce1ee58e670f9c3fce46c40296ba9ee8a2Ian Hodson if test "$linkmode,$pass" = "prog,link"; then 6237f4c12fce1ee58e670f9c3fce46c40296ba9ee8a2Ian Hodson compile_deplibs="$deplib $compile_deplibs" 6238f4c12fce1ee58e670f9c3fce46c40296ba9ee8a2Ian Hodson finalize_deplibs="$deplib $finalize_deplibs" 6239f4c12fce1ee58e670f9c3fce46c40296ba9ee8a2Ian Hodson else 6240f4c12fce1ee58e670f9c3fce46c40296ba9ee8a2Ian Hodson deplibs="$deplib $deplibs" 6241f4c12fce1ee58e670f9c3fce46c40296ba9ee8a2Ian Hodson test "$linkmode" = lib && newdependency_libs="$deplib $newdependency_libs" 6242f4c12fce1ee58e670f9c3fce46c40296ba9ee8a2Ian Hodson fi 6243f4c12fce1ee58e670f9c3fce46c40296ba9ee8a2Ian Hodson continue 6244f4c12fce1ee58e670f9c3fce46c40296ba9ee8a2Ian Hodson fi 6245f4c12fce1ee58e670f9c3fce46c40296ba9ee8a2Ian Hodson fi 6246f4c12fce1ee58e670f9c3fce46c40296ba9ee8a2Ian Hodson ;; 6247f4c12fce1ee58e670f9c3fce46c40296ba9ee8a2Ian Hodson *) ;; 6248f4c12fce1ee58e670f9c3fce46c40296ba9ee8a2Ian Hodson esac 6249f4c12fce1ee58e670f9c3fce46c40296ba9ee8a2Ian Hodson fi 6250f4c12fce1ee58e670f9c3fce46c40296ba9ee8a2Ian Hodson fi 6251f4c12fce1ee58e670f9c3fce46c40296ba9ee8a2Ian Hodson ;; # -l 6252f4c12fce1ee58e670f9c3fce46c40296ba9ee8a2Ian Hodson *.ltframework) 6253f4c12fce1ee58e670f9c3fce46c40296ba9ee8a2Ian Hodson if test "$linkmode,$pass" = "prog,link"; then 6254f4c12fce1ee58e670f9c3fce46c40296ba9ee8a2Ian Hodson compile_deplibs="$deplib $compile_deplibs" 6255f4c12fce1ee58e670f9c3fce46c40296ba9ee8a2Ian Hodson finalize_deplibs="$deplib $finalize_deplibs" 6256f4c12fce1ee58e670f9c3fce46c40296ba9ee8a2Ian Hodson else 6257f4c12fce1ee58e670f9c3fce46c40296ba9ee8a2Ian Hodson deplibs="$deplib $deplibs" 6258f4c12fce1ee58e670f9c3fce46c40296ba9ee8a2Ian Hodson if test "$linkmode" = lib ; then 6259f4c12fce1ee58e670f9c3fce46c40296ba9ee8a2Ian Hodson case "$new_inherited_linker_flags " in 6260f4c12fce1ee58e670f9c3fce46c40296ba9ee8a2Ian Hodson *" $deplib "*) ;; 62615b6dc79427b8f7eeb6a7ff68034ab8548ce670eaAlexander Gutkin * ) func_append new_inherited_linker_flags " $deplib" ;; 6262f4c12fce1ee58e670f9c3fce46c40296ba9ee8a2Ian Hodson esac 6263f4c12fce1ee58e670f9c3fce46c40296ba9ee8a2Ian Hodson fi 6264f4c12fce1ee58e670f9c3fce46c40296ba9ee8a2Ian Hodson fi 6265f4c12fce1ee58e670f9c3fce46c40296ba9ee8a2Ian Hodson continue 6266f4c12fce1ee58e670f9c3fce46c40296ba9ee8a2Ian Hodson ;; 6267f4c12fce1ee58e670f9c3fce46c40296ba9ee8a2Ian Hodson -L*) 6268f4c12fce1ee58e670f9c3fce46c40296ba9ee8a2Ian Hodson case $linkmode in 6269f4c12fce1ee58e670f9c3fce46c40296ba9ee8a2Ian Hodson lib) 6270f4c12fce1ee58e670f9c3fce46c40296ba9ee8a2Ian Hodson deplibs="$deplib $deplibs" 6271f4c12fce1ee58e670f9c3fce46c40296ba9ee8a2Ian Hodson test "$pass" = conv && continue 6272f4c12fce1ee58e670f9c3fce46c40296ba9ee8a2Ian Hodson newdependency_libs="$deplib $newdependency_libs" 6273f4c12fce1ee58e670f9c3fce46c40296ba9ee8a2Ian Hodson func_stripname '-L' '' "$deplib" 62745b6dc79427b8f7eeb6a7ff68034ab8548ce670eaAlexander Gutkin func_resolve_sysroot "$func_stripname_result" 62755b6dc79427b8f7eeb6a7ff68034ab8548ce670eaAlexander Gutkin func_append newlib_search_path " $func_resolve_sysroot_result" 6276f4c12fce1ee58e670f9c3fce46c40296ba9ee8a2Ian Hodson ;; 6277f4c12fce1ee58e670f9c3fce46c40296ba9ee8a2Ian Hodson prog) 6278f4c12fce1ee58e670f9c3fce46c40296ba9ee8a2Ian Hodson if test "$pass" = conv; then 6279f4c12fce1ee58e670f9c3fce46c40296ba9ee8a2Ian Hodson deplibs="$deplib $deplibs" 6280f4c12fce1ee58e670f9c3fce46c40296ba9ee8a2Ian Hodson continue 6281f4c12fce1ee58e670f9c3fce46c40296ba9ee8a2Ian Hodson fi 6282f4c12fce1ee58e670f9c3fce46c40296ba9ee8a2Ian Hodson if test "$pass" = scan; then 6283f4c12fce1ee58e670f9c3fce46c40296ba9ee8a2Ian Hodson deplibs="$deplib $deplibs" 6284f4c12fce1ee58e670f9c3fce46c40296ba9ee8a2Ian Hodson else 6285f4c12fce1ee58e670f9c3fce46c40296ba9ee8a2Ian Hodson compile_deplibs="$deplib $compile_deplibs" 6286f4c12fce1ee58e670f9c3fce46c40296ba9ee8a2Ian Hodson finalize_deplibs="$deplib $finalize_deplibs" 6287f4c12fce1ee58e670f9c3fce46c40296ba9ee8a2Ian Hodson fi 6288f4c12fce1ee58e670f9c3fce46c40296ba9ee8a2Ian Hodson func_stripname '-L' '' "$deplib" 62895b6dc79427b8f7eeb6a7ff68034ab8548ce670eaAlexander Gutkin func_resolve_sysroot "$func_stripname_result" 62905b6dc79427b8f7eeb6a7ff68034ab8548ce670eaAlexander Gutkin func_append newlib_search_path " $func_resolve_sysroot_result" 6291f4c12fce1ee58e670f9c3fce46c40296ba9ee8a2Ian Hodson ;; 6292f4c12fce1ee58e670f9c3fce46c40296ba9ee8a2Ian Hodson *) 6293f4c12fce1ee58e670f9c3fce46c40296ba9ee8a2Ian Hodson func_warning "\`-L' is ignored for archives/objects" 6294f4c12fce1ee58e670f9c3fce46c40296ba9ee8a2Ian Hodson ;; 6295f4c12fce1ee58e670f9c3fce46c40296ba9ee8a2Ian Hodson esac # linkmode 6296f4c12fce1ee58e670f9c3fce46c40296ba9ee8a2Ian Hodson continue 6297f4c12fce1ee58e670f9c3fce46c40296ba9ee8a2Ian Hodson ;; # -L 6298f4c12fce1ee58e670f9c3fce46c40296ba9ee8a2Ian Hodson -R*) 6299f4c12fce1ee58e670f9c3fce46c40296ba9ee8a2Ian Hodson if test "$pass" = link; then 6300f4c12fce1ee58e670f9c3fce46c40296ba9ee8a2Ian Hodson func_stripname '-R' '' "$deplib" 63015b6dc79427b8f7eeb6a7ff68034ab8548ce670eaAlexander Gutkin func_resolve_sysroot "$func_stripname_result" 63025b6dc79427b8f7eeb6a7ff68034ab8548ce670eaAlexander Gutkin dir=$func_resolve_sysroot_result 6303f4c12fce1ee58e670f9c3fce46c40296ba9ee8a2Ian Hodson # Make sure the xrpath contains only unique directories. 6304f4c12fce1ee58e670f9c3fce46c40296ba9ee8a2Ian Hodson case "$xrpath " in 6305f4c12fce1ee58e670f9c3fce46c40296ba9ee8a2Ian Hodson *" $dir "*) ;; 63065b6dc79427b8f7eeb6a7ff68034ab8548ce670eaAlexander Gutkin *) func_append xrpath " $dir" ;; 6307f4c12fce1ee58e670f9c3fce46c40296ba9ee8a2Ian Hodson esac 6308f4c12fce1ee58e670f9c3fce46c40296ba9ee8a2Ian Hodson fi 6309f4c12fce1ee58e670f9c3fce46c40296ba9ee8a2Ian Hodson deplibs="$deplib $deplibs" 6310f4c12fce1ee58e670f9c3fce46c40296ba9ee8a2Ian Hodson continue 6311f4c12fce1ee58e670f9c3fce46c40296ba9ee8a2Ian Hodson ;; 63125b6dc79427b8f7eeb6a7ff68034ab8548ce670eaAlexander Gutkin *.la) 63135b6dc79427b8f7eeb6a7ff68034ab8548ce670eaAlexander Gutkin func_resolve_sysroot "$deplib" 63145b6dc79427b8f7eeb6a7ff68034ab8548ce670eaAlexander Gutkin lib=$func_resolve_sysroot_result 63155b6dc79427b8f7eeb6a7ff68034ab8548ce670eaAlexander Gutkin ;; 6316f4c12fce1ee58e670f9c3fce46c40296ba9ee8a2Ian Hodson *.$libext) 6317f4c12fce1ee58e670f9c3fce46c40296ba9ee8a2Ian Hodson if test "$pass" = conv; then 6318f4c12fce1ee58e670f9c3fce46c40296ba9ee8a2Ian Hodson deplibs="$deplib $deplibs" 6319f4c12fce1ee58e670f9c3fce46c40296ba9ee8a2Ian Hodson continue 6320f4c12fce1ee58e670f9c3fce46c40296ba9ee8a2Ian Hodson fi 6321f4c12fce1ee58e670f9c3fce46c40296ba9ee8a2Ian Hodson case $linkmode in 6322f4c12fce1ee58e670f9c3fce46c40296ba9ee8a2Ian Hodson lib) 6323f4c12fce1ee58e670f9c3fce46c40296ba9ee8a2Ian Hodson # Linking convenience modules into shared libraries is allowed, 6324f4c12fce1ee58e670f9c3fce46c40296ba9ee8a2Ian Hodson # but linking other static libraries is non-portable. 6325f4c12fce1ee58e670f9c3fce46c40296ba9ee8a2Ian Hodson case " $dlpreconveniencelibs " in 6326f4c12fce1ee58e670f9c3fce46c40296ba9ee8a2Ian Hodson *" $deplib "*) ;; 6327f4c12fce1ee58e670f9c3fce46c40296ba9ee8a2Ian Hodson *) 6328f4c12fce1ee58e670f9c3fce46c40296ba9ee8a2Ian Hodson valid_a_lib=no 6329f4c12fce1ee58e670f9c3fce46c40296ba9ee8a2Ian Hodson case $deplibs_check_method in 6330f4c12fce1ee58e670f9c3fce46c40296ba9ee8a2Ian Hodson match_pattern*) 6331f4c12fce1ee58e670f9c3fce46c40296ba9ee8a2Ian Hodson set dummy $deplibs_check_method; shift 6332f4c12fce1ee58e670f9c3fce46c40296ba9ee8a2Ian Hodson match_pattern_regex=`expr "$deplibs_check_method" : "$1 \(.*\)"` 63335b6dc79427b8f7eeb6a7ff68034ab8548ce670eaAlexander Gutkin if eval "\$ECHO \"$deplib\"" 2>/dev/null | $SED 10q \ 6334f4c12fce1ee58e670f9c3fce46c40296ba9ee8a2Ian Hodson | $EGREP "$match_pattern_regex" > /dev/null; then 6335f4c12fce1ee58e670f9c3fce46c40296ba9ee8a2Ian Hodson valid_a_lib=yes 6336f4c12fce1ee58e670f9c3fce46c40296ba9ee8a2Ian Hodson fi 6337f4c12fce1ee58e670f9c3fce46c40296ba9ee8a2Ian Hodson ;; 6338f4c12fce1ee58e670f9c3fce46c40296ba9ee8a2Ian Hodson pass_all) 6339f4c12fce1ee58e670f9c3fce46c40296ba9ee8a2Ian Hodson valid_a_lib=yes 6340f4c12fce1ee58e670f9c3fce46c40296ba9ee8a2Ian Hodson ;; 6341f4c12fce1ee58e670f9c3fce46c40296ba9ee8a2Ian Hodson esac 6342f4c12fce1ee58e670f9c3fce46c40296ba9ee8a2Ian Hodson if test "$valid_a_lib" != yes; then 63435b6dc79427b8f7eeb6a7ff68034ab8548ce670eaAlexander Gutkin echo 6344f4c12fce1ee58e670f9c3fce46c40296ba9ee8a2Ian Hodson $ECHO "*** Warning: Trying to link with static lib archive $deplib." 63455b6dc79427b8f7eeb6a7ff68034ab8548ce670eaAlexander Gutkin echo "*** I have the capability to make that library automatically link in when" 63465b6dc79427b8f7eeb6a7ff68034ab8548ce670eaAlexander Gutkin echo "*** you link to this library. But I can only do this if you have a" 63475b6dc79427b8f7eeb6a7ff68034ab8548ce670eaAlexander Gutkin echo "*** shared version of the library, which you do not appear to have" 63485b6dc79427b8f7eeb6a7ff68034ab8548ce670eaAlexander Gutkin echo "*** because the file extensions .$libext of this argument makes me believe" 63495b6dc79427b8f7eeb6a7ff68034ab8548ce670eaAlexander Gutkin echo "*** that it is just a static archive that I should not use here." 6350f4c12fce1ee58e670f9c3fce46c40296ba9ee8a2Ian Hodson else 63515b6dc79427b8f7eeb6a7ff68034ab8548ce670eaAlexander Gutkin echo 6352f4c12fce1ee58e670f9c3fce46c40296ba9ee8a2Ian Hodson $ECHO "*** Warning: Linking the shared library $output against the" 6353f4c12fce1ee58e670f9c3fce46c40296ba9ee8a2Ian Hodson $ECHO "*** static library $deplib is not portable!" 6354f4c12fce1ee58e670f9c3fce46c40296ba9ee8a2Ian Hodson deplibs="$deplib $deplibs" 6355f4c12fce1ee58e670f9c3fce46c40296ba9ee8a2Ian Hodson fi 6356f4c12fce1ee58e670f9c3fce46c40296ba9ee8a2Ian Hodson ;; 6357f4c12fce1ee58e670f9c3fce46c40296ba9ee8a2Ian Hodson esac 6358f4c12fce1ee58e670f9c3fce46c40296ba9ee8a2Ian Hodson continue 6359f4c12fce1ee58e670f9c3fce46c40296ba9ee8a2Ian Hodson ;; 6360f4c12fce1ee58e670f9c3fce46c40296ba9ee8a2Ian Hodson prog) 6361f4c12fce1ee58e670f9c3fce46c40296ba9ee8a2Ian Hodson if test "$pass" != link; then 6362f4c12fce1ee58e670f9c3fce46c40296ba9ee8a2Ian Hodson deplibs="$deplib $deplibs" 6363f4c12fce1ee58e670f9c3fce46c40296ba9ee8a2Ian Hodson else 6364f4c12fce1ee58e670f9c3fce46c40296ba9ee8a2Ian Hodson compile_deplibs="$deplib $compile_deplibs" 6365f4c12fce1ee58e670f9c3fce46c40296ba9ee8a2Ian Hodson finalize_deplibs="$deplib $finalize_deplibs" 6366f4c12fce1ee58e670f9c3fce46c40296ba9ee8a2Ian Hodson fi 6367f4c12fce1ee58e670f9c3fce46c40296ba9ee8a2Ian Hodson continue 6368f4c12fce1ee58e670f9c3fce46c40296ba9ee8a2Ian Hodson ;; 6369f4c12fce1ee58e670f9c3fce46c40296ba9ee8a2Ian Hodson esac # linkmode 6370f4c12fce1ee58e670f9c3fce46c40296ba9ee8a2Ian Hodson ;; # *.$libext 6371f4c12fce1ee58e670f9c3fce46c40296ba9ee8a2Ian Hodson *.lo | *.$objext) 6372f4c12fce1ee58e670f9c3fce46c40296ba9ee8a2Ian Hodson if test "$pass" = conv; then 6373f4c12fce1ee58e670f9c3fce46c40296ba9ee8a2Ian Hodson deplibs="$deplib $deplibs" 6374f4c12fce1ee58e670f9c3fce46c40296ba9ee8a2Ian Hodson elif test "$linkmode" = prog; then 6375f4c12fce1ee58e670f9c3fce46c40296ba9ee8a2Ian Hodson if test "$pass" = dlpreopen || test "$dlopen_support" != yes || test "$build_libtool_libs" = no; then 6376f4c12fce1ee58e670f9c3fce46c40296ba9ee8a2Ian Hodson # If there is no dlopen support or we're linking statically, 6377f4c12fce1ee58e670f9c3fce46c40296ba9ee8a2Ian Hodson # we need to preload. 63785b6dc79427b8f7eeb6a7ff68034ab8548ce670eaAlexander Gutkin func_append newdlprefiles " $deplib" 6379f4c12fce1ee58e670f9c3fce46c40296ba9ee8a2Ian Hodson compile_deplibs="$deplib $compile_deplibs" 6380f4c12fce1ee58e670f9c3fce46c40296ba9ee8a2Ian Hodson finalize_deplibs="$deplib $finalize_deplibs" 6381f4c12fce1ee58e670f9c3fce46c40296ba9ee8a2Ian Hodson else 63825b6dc79427b8f7eeb6a7ff68034ab8548ce670eaAlexander Gutkin func_append newdlfiles " $deplib" 6383f4c12fce1ee58e670f9c3fce46c40296ba9ee8a2Ian Hodson fi 6384f4c12fce1ee58e670f9c3fce46c40296ba9ee8a2Ian Hodson fi 6385f4c12fce1ee58e670f9c3fce46c40296ba9ee8a2Ian Hodson continue 6386f4c12fce1ee58e670f9c3fce46c40296ba9ee8a2Ian Hodson ;; 6387f4c12fce1ee58e670f9c3fce46c40296ba9ee8a2Ian Hodson %DEPLIBS%) 6388f4c12fce1ee58e670f9c3fce46c40296ba9ee8a2Ian Hodson alldeplibs=yes 6389f4c12fce1ee58e670f9c3fce46c40296ba9ee8a2Ian Hodson continue 6390f4c12fce1ee58e670f9c3fce46c40296ba9ee8a2Ian Hodson ;; 6391f4c12fce1ee58e670f9c3fce46c40296ba9ee8a2Ian Hodson esac # case $deplib 6392f4c12fce1ee58e670f9c3fce46c40296ba9ee8a2Ian Hodson 6393f4c12fce1ee58e670f9c3fce46c40296ba9ee8a2Ian Hodson if test "$found" = yes || test -f "$lib"; then : 6394f4c12fce1ee58e670f9c3fce46c40296ba9ee8a2Ian Hodson else 6395f4c12fce1ee58e670f9c3fce46c40296ba9ee8a2Ian Hodson func_fatal_error "cannot find the library \`$lib' or unhandled argument \`$deplib'" 6396f4c12fce1ee58e670f9c3fce46c40296ba9ee8a2Ian Hodson fi 6397f4c12fce1ee58e670f9c3fce46c40296ba9ee8a2Ian Hodson 6398f4c12fce1ee58e670f9c3fce46c40296ba9ee8a2Ian Hodson # Check to see that this really is a libtool archive. 6399f4c12fce1ee58e670f9c3fce46c40296ba9ee8a2Ian Hodson func_lalib_unsafe_p "$lib" \ 6400f4c12fce1ee58e670f9c3fce46c40296ba9ee8a2Ian Hodson || func_fatal_error "\`$lib' is not a valid libtool archive" 6401f4c12fce1ee58e670f9c3fce46c40296ba9ee8a2Ian Hodson 6402f4c12fce1ee58e670f9c3fce46c40296ba9ee8a2Ian Hodson func_dirname "$lib" "" "." 6403f4c12fce1ee58e670f9c3fce46c40296ba9ee8a2Ian Hodson ladir="$func_dirname_result" 6404f4c12fce1ee58e670f9c3fce46c40296ba9ee8a2Ian Hodson 6405f4c12fce1ee58e670f9c3fce46c40296ba9ee8a2Ian Hodson dlname= 6406f4c12fce1ee58e670f9c3fce46c40296ba9ee8a2Ian Hodson dlopen= 6407f4c12fce1ee58e670f9c3fce46c40296ba9ee8a2Ian Hodson dlpreopen= 6408f4c12fce1ee58e670f9c3fce46c40296ba9ee8a2Ian Hodson libdir= 6409f4c12fce1ee58e670f9c3fce46c40296ba9ee8a2Ian Hodson library_names= 6410f4c12fce1ee58e670f9c3fce46c40296ba9ee8a2Ian Hodson old_library= 6411f4c12fce1ee58e670f9c3fce46c40296ba9ee8a2Ian Hodson inherited_linker_flags= 6412f4c12fce1ee58e670f9c3fce46c40296ba9ee8a2Ian Hodson # If the library was installed with an old release of libtool, 6413f4c12fce1ee58e670f9c3fce46c40296ba9ee8a2Ian Hodson # it will not redefine variables installed, or shouldnotlink 6414f4c12fce1ee58e670f9c3fce46c40296ba9ee8a2Ian Hodson installed=yes 6415f4c12fce1ee58e670f9c3fce46c40296ba9ee8a2Ian Hodson shouldnotlink=no 6416f4c12fce1ee58e670f9c3fce46c40296ba9ee8a2Ian Hodson avoidtemprpath= 6417f4c12fce1ee58e670f9c3fce46c40296ba9ee8a2Ian Hodson 6418f4c12fce1ee58e670f9c3fce46c40296ba9ee8a2Ian Hodson 6419f4c12fce1ee58e670f9c3fce46c40296ba9ee8a2Ian Hodson # Read the .la file 6420f4c12fce1ee58e670f9c3fce46c40296ba9ee8a2Ian Hodson func_source "$lib" 6421f4c12fce1ee58e670f9c3fce46c40296ba9ee8a2Ian Hodson 6422f4c12fce1ee58e670f9c3fce46c40296ba9ee8a2Ian Hodson # Convert "-framework foo" to "foo.ltframework" 6423f4c12fce1ee58e670f9c3fce46c40296ba9ee8a2Ian Hodson if test -n "$inherited_linker_flags"; then 64245b6dc79427b8f7eeb6a7ff68034ab8548ce670eaAlexander Gutkin tmp_inherited_linker_flags=`$ECHO "$inherited_linker_flags" | $SED 's/-framework \([^ $]*\)/\1.ltframework/g'` 6425f4c12fce1ee58e670f9c3fce46c40296ba9ee8a2Ian Hodson for tmp_inherited_linker_flag in $tmp_inherited_linker_flags; do 6426f4c12fce1ee58e670f9c3fce46c40296ba9ee8a2Ian Hodson case " $new_inherited_linker_flags " in 6427f4c12fce1ee58e670f9c3fce46c40296ba9ee8a2Ian Hodson *" $tmp_inherited_linker_flag "*) ;; 64285b6dc79427b8f7eeb6a7ff68034ab8548ce670eaAlexander Gutkin *) func_append new_inherited_linker_flags " $tmp_inherited_linker_flag";; 6429f4c12fce1ee58e670f9c3fce46c40296ba9ee8a2Ian Hodson esac 6430f4c12fce1ee58e670f9c3fce46c40296ba9ee8a2Ian Hodson done 6431f4c12fce1ee58e670f9c3fce46c40296ba9ee8a2Ian Hodson fi 64325b6dc79427b8f7eeb6a7ff68034ab8548ce670eaAlexander Gutkin dependency_libs=`$ECHO " $dependency_libs" | $SED 's% \([^ $]*\).ltframework% -framework \1%g'` 6433f4c12fce1ee58e670f9c3fce46c40296ba9ee8a2Ian Hodson if test "$linkmode,$pass" = "lib,link" || 6434f4c12fce1ee58e670f9c3fce46c40296ba9ee8a2Ian Hodson test "$linkmode,$pass" = "prog,scan" || 6435f4c12fce1ee58e670f9c3fce46c40296ba9ee8a2Ian Hodson { test "$linkmode" != prog && test "$linkmode" != lib; }; then 64365b6dc79427b8f7eeb6a7ff68034ab8548ce670eaAlexander Gutkin test -n "$dlopen" && func_append dlfiles " $dlopen" 64375b6dc79427b8f7eeb6a7ff68034ab8548ce670eaAlexander Gutkin test -n "$dlpreopen" && func_append dlprefiles " $dlpreopen" 6438f4c12fce1ee58e670f9c3fce46c40296ba9ee8a2Ian Hodson fi 6439f4c12fce1ee58e670f9c3fce46c40296ba9ee8a2Ian Hodson 6440f4c12fce1ee58e670f9c3fce46c40296ba9ee8a2Ian Hodson if test "$pass" = conv; then 6441f4c12fce1ee58e670f9c3fce46c40296ba9ee8a2Ian Hodson # Only check for convenience libraries 6442f4c12fce1ee58e670f9c3fce46c40296ba9ee8a2Ian Hodson deplibs="$lib $deplibs" 6443f4c12fce1ee58e670f9c3fce46c40296ba9ee8a2Ian Hodson if test -z "$libdir"; then 6444f4c12fce1ee58e670f9c3fce46c40296ba9ee8a2Ian Hodson if test -z "$old_library"; then 6445f4c12fce1ee58e670f9c3fce46c40296ba9ee8a2Ian Hodson func_fatal_error "cannot find name of link library for \`$lib'" 6446f4c12fce1ee58e670f9c3fce46c40296ba9ee8a2Ian Hodson fi 6447f4c12fce1ee58e670f9c3fce46c40296ba9ee8a2Ian Hodson # It is a libtool convenience library, so add in its objects. 64485b6dc79427b8f7eeb6a7ff68034ab8548ce670eaAlexander Gutkin func_append convenience " $ladir/$objdir/$old_library" 64495b6dc79427b8f7eeb6a7ff68034ab8548ce670eaAlexander Gutkin func_append old_convenience " $ladir/$objdir/$old_library" 6450f4c12fce1ee58e670f9c3fce46c40296ba9ee8a2Ian Hodson tmp_libs= 6451f4c12fce1ee58e670f9c3fce46c40296ba9ee8a2Ian Hodson for deplib in $dependency_libs; do 6452f4c12fce1ee58e670f9c3fce46c40296ba9ee8a2Ian Hodson deplibs="$deplib $deplibs" 64535b6dc79427b8f7eeb6a7ff68034ab8548ce670eaAlexander Gutkin if $opt_preserve_dup_deps ; then 6454f4c12fce1ee58e670f9c3fce46c40296ba9ee8a2Ian Hodson case "$tmp_libs " in 64555b6dc79427b8f7eeb6a7ff68034ab8548ce670eaAlexander Gutkin *" $deplib "*) func_append specialdeplibs " $deplib" ;; 6456f4c12fce1ee58e670f9c3fce46c40296ba9ee8a2Ian Hodson esac 6457f4c12fce1ee58e670f9c3fce46c40296ba9ee8a2Ian Hodson fi 64585b6dc79427b8f7eeb6a7ff68034ab8548ce670eaAlexander Gutkin func_append tmp_libs " $deplib" 6459f4c12fce1ee58e670f9c3fce46c40296ba9ee8a2Ian Hodson done 6460f4c12fce1ee58e670f9c3fce46c40296ba9ee8a2Ian Hodson elif test "$linkmode" != prog && test "$linkmode" != lib; then 6461f4c12fce1ee58e670f9c3fce46c40296ba9ee8a2Ian Hodson func_fatal_error "\`$lib' is not a convenience library" 6462f4c12fce1ee58e670f9c3fce46c40296ba9ee8a2Ian Hodson fi 6463f4c12fce1ee58e670f9c3fce46c40296ba9ee8a2Ian Hodson continue 6464f4c12fce1ee58e670f9c3fce46c40296ba9ee8a2Ian Hodson fi # $pass = conv 6465f4c12fce1ee58e670f9c3fce46c40296ba9ee8a2Ian Hodson 6466f4c12fce1ee58e670f9c3fce46c40296ba9ee8a2Ian Hodson 6467f4c12fce1ee58e670f9c3fce46c40296ba9ee8a2Ian Hodson # Get the name of the library we link against. 6468f4c12fce1ee58e670f9c3fce46c40296ba9ee8a2Ian Hodson linklib= 64695b6dc79427b8f7eeb6a7ff68034ab8548ce670eaAlexander Gutkin if test -n "$old_library" && 64705b6dc79427b8f7eeb6a7ff68034ab8548ce670eaAlexander Gutkin { test "$prefer_static_libs" = yes || 64715b6dc79427b8f7eeb6a7ff68034ab8548ce670eaAlexander Gutkin test "$prefer_static_libs,$installed" = "built,no"; }; then 64725b6dc79427b8f7eeb6a7ff68034ab8548ce670eaAlexander Gutkin linklib=$old_library 64735b6dc79427b8f7eeb6a7ff68034ab8548ce670eaAlexander Gutkin else 64745b6dc79427b8f7eeb6a7ff68034ab8548ce670eaAlexander Gutkin for l in $old_library $library_names; do 64755b6dc79427b8f7eeb6a7ff68034ab8548ce670eaAlexander Gutkin linklib="$l" 64765b6dc79427b8f7eeb6a7ff68034ab8548ce670eaAlexander Gutkin done 64775b6dc79427b8f7eeb6a7ff68034ab8548ce670eaAlexander Gutkin fi 6478f4c12fce1ee58e670f9c3fce46c40296ba9ee8a2Ian Hodson if test -z "$linklib"; then 6479f4c12fce1ee58e670f9c3fce46c40296ba9ee8a2Ian Hodson func_fatal_error "cannot find name of link library for \`$lib'" 6480f4c12fce1ee58e670f9c3fce46c40296ba9ee8a2Ian Hodson fi 6481f4c12fce1ee58e670f9c3fce46c40296ba9ee8a2Ian Hodson 6482f4c12fce1ee58e670f9c3fce46c40296ba9ee8a2Ian Hodson # This library was specified with -dlopen. 6483f4c12fce1ee58e670f9c3fce46c40296ba9ee8a2Ian Hodson if test "$pass" = dlopen; then 6484f4c12fce1ee58e670f9c3fce46c40296ba9ee8a2Ian Hodson if test -z "$libdir"; then 6485f4c12fce1ee58e670f9c3fce46c40296ba9ee8a2Ian Hodson func_fatal_error "cannot -dlopen a convenience library: \`$lib'" 6486f4c12fce1ee58e670f9c3fce46c40296ba9ee8a2Ian Hodson fi 6487f4c12fce1ee58e670f9c3fce46c40296ba9ee8a2Ian Hodson if test -z "$dlname" || 6488f4c12fce1ee58e670f9c3fce46c40296ba9ee8a2Ian Hodson test "$dlopen_support" != yes || 6489f4c12fce1ee58e670f9c3fce46c40296ba9ee8a2Ian Hodson test "$build_libtool_libs" = no; then 6490f4c12fce1ee58e670f9c3fce46c40296ba9ee8a2Ian Hodson # If there is no dlname, no dlopen support or we're linking 6491f4c12fce1ee58e670f9c3fce46c40296ba9ee8a2Ian Hodson # statically, we need to preload. We also need to preload any 6492f4c12fce1ee58e670f9c3fce46c40296ba9ee8a2Ian Hodson # dependent libraries so libltdl's deplib preloader doesn't 6493f4c12fce1ee58e670f9c3fce46c40296ba9ee8a2Ian Hodson # bomb out in the load deplibs phase. 64945b6dc79427b8f7eeb6a7ff68034ab8548ce670eaAlexander Gutkin func_append dlprefiles " $lib $dependency_libs" 6495f4c12fce1ee58e670f9c3fce46c40296ba9ee8a2Ian Hodson else 64965b6dc79427b8f7eeb6a7ff68034ab8548ce670eaAlexander Gutkin func_append newdlfiles " $lib" 6497f4c12fce1ee58e670f9c3fce46c40296ba9ee8a2Ian Hodson fi 6498f4c12fce1ee58e670f9c3fce46c40296ba9ee8a2Ian Hodson continue 6499f4c12fce1ee58e670f9c3fce46c40296ba9ee8a2Ian Hodson fi # $pass = dlopen 6500f4c12fce1ee58e670f9c3fce46c40296ba9ee8a2Ian Hodson 6501f4c12fce1ee58e670f9c3fce46c40296ba9ee8a2Ian Hodson # We need an absolute path. 6502f4c12fce1ee58e670f9c3fce46c40296ba9ee8a2Ian Hodson case $ladir in 6503f4c12fce1ee58e670f9c3fce46c40296ba9ee8a2Ian Hodson [\\/]* | [A-Za-z]:[\\/]*) abs_ladir="$ladir" ;; 6504f4c12fce1ee58e670f9c3fce46c40296ba9ee8a2Ian Hodson *) 6505f4c12fce1ee58e670f9c3fce46c40296ba9ee8a2Ian Hodson abs_ladir=`cd "$ladir" && pwd` 6506f4c12fce1ee58e670f9c3fce46c40296ba9ee8a2Ian Hodson if test -z "$abs_ladir"; then 6507f4c12fce1ee58e670f9c3fce46c40296ba9ee8a2Ian Hodson func_warning "cannot determine absolute directory name of \`$ladir'" 6508f4c12fce1ee58e670f9c3fce46c40296ba9ee8a2Ian Hodson func_warning "passing it literally to the linker, although it might fail" 6509f4c12fce1ee58e670f9c3fce46c40296ba9ee8a2Ian Hodson abs_ladir="$ladir" 6510f4c12fce1ee58e670f9c3fce46c40296ba9ee8a2Ian Hodson fi 6511f4c12fce1ee58e670f9c3fce46c40296ba9ee8a2Ian Hodson ;; 6512f4c12fce1ee58e670f9c3fce46c40296ba9ee8a2Ian Hodson esac 6513f4c12fce1ee58e670f9c3fce46c40296ba9ee8a2Ian Hodson func_basename "$lib" 6514f4c12fce1ee58e670f9c3fce46c40296ba9ee8a2Ian Hodson laname="$func_basename_result" 6515f4c12fce1ee58e670f9c3fce46c40296ba9ee8a2Ian Hodson 6516f4c12fce1ee58e670f9c3fce46c40296ba9ee8a2Ian Hodson # Find the relevant object directory and library name. 6517f4c12fce1ee58e670f9c3fce46c40296ba9ee8a2Ian Hodson if test "X$installed" = Xyes; then 65185b6dc79427b8f7eeb6a7ff68034ab8548ce670eaAlexander Gutkin if test ! -f "$lt_sysroot$libdir/$linklib" && test -f "$abs_ladir/$linklib"; then 6519f4c12fce1ee58e670f9c3fce46c40296ba9ee8a2Ian Hodson func_warning "library \`$lib' was moved." 6520f4c12fce1ee58e670f9c3fce46c40296ba9ee8a2Ian Hodson dir="$ladir" 6521f4c12fce1ee58e670f9c3fce46c40296ba9ee8a2Ian Hodson absdir="$abs_ladir" 6522f4c12fce1ee58e670f9c3fce46c40296ba9ee8a2Ian Hodson libdir="$abs_ladir" 6523f4c12fce1ee58e670f9c3fce46c40296ba9ee8a2Ian Hodson else 65245b6dc79427b8f7eeb6a7ff68034ab8548ce670eaAlexander Gutkin dir="$lt_sysroot$libdir" 65255b6dc79427b8f7eeb6a7ff68034ab8548ce670eaAlexander Gutkin absdir="$lt_sysroot$libdir" 6526f4c12fce1ee58e670f9c3fce46c40296ba9ee8a2Ian Hodson fi 6527f4c12fce1ee58e670f9c3fce46c40296ba9ee8a2Ian Hodson test "X$hardcode_automatic" = Xyes && avoidtemprpath=yes 6528f4c12fce1ee58e670f9c3fce46c40296ba9ee8a2Ian Hodson else 6529f4c12fce1ee58e670f9c3fce46c40296ba9ee8a2Ian Hodson if test ! -f "$ladir/$objdir/$linklib" && test -f "$abs_ladir/$linklib"; then 6530f4c12fce1ee58e670f9c3fce46c40296ba9ee8a2Ian Hodson dir="$ladir" 6531f4c12fce1ee58e670f9c3fce46c40296ba9ee8a2Ian Hodson absdir="$abs_ladir" 6532f4c12fce1ee58e670f9c3fce46c40296ba9ee8a2Ian Hodson # Remove this search path later 65335b6dc79427b8f7eeb6a7ff68034ab8548ce670eaAlexander Gutkin func_append notinst_path " $abs_ladir" 6534f4c12fce1ee58e670f9c3fce46c40296ba9ee8a2Ian Hodson else 6535f4c12fce1ee58e670f9c3fce46c40296ba9ee8a2Ian Hodson dir="$ladir/$objdir" 6536f4c12fce1ee58e670f9c3fce46c40296ba9ee8a2Ian Hodson absdir="$abs_ladir/$objdir" 6537f4c12fce1ee58e670f9c3fce46c40296ba9ee8a2Ian Hodson # Remove this search path later 65385b6dc79427b8f7eeb6a7ff68034ab8548ce670eaAlexander Gutkin func_append notinst_path " $abs_ladir" 6539f4c12fce1ee58e670f9c3fce46c40296ba9ee8a2Ian Hodson fi 6540f4c12fce1ee58e670f9c3fce46c40296ba9ee8a2Ian Hodson fi # $installed = yes 6541f4c12fce1ee58e670f9c3fce46c40296ba9ee8a2Ian Hodson func_stripname 'lib' '.la' "$laname" 6542f4c12fce1ee58e670f9c3fce46c40296ba9ee8a2Ian Hodson name=$func_stripname_result 6543f4c12fce1ee58e670f9c3fce46c40296ba9ee8a2Ian Hodson 6544f4c12fce1ee58e670f9c3fce46c40296ba9ee8a2Ian Hodson # This library was specified with -dlpreopen. 6545f4c12fce1ee58e670f9c3fce46c40296ba9ee8a2Ian Hodson if test "$pass" = dlpreopen; then 6546f4c12fce1ee58e670f9c3fce46c40296ba9ee8a2Ian Hodson if test -z "$libdir" && test "$linkmode" = prog; then 6547f4c12fce1ee58e670f9c3fce46c40296ba9ee8a2Ian Hodson func_fatal_error "only libraries may -dlpreopen a convenience library: \`$lib'" 6548f4c12fce1ee58e670f9c3fce46c40296ba9ee8a2Ian Hodson fi 65495b6dc79427b8f7eeb6a7ff68034ab8548ce670eaAlexander Gutkin case "$host" in 65505b6dc79427b8f7eeb6a7ff68034ab8548ce670eaAlexander Gutkin # special handling for platforms with PE-DLLs. 65515b6dc79427b8f7eeb6a7ff68034ab8548ce670eaAlexander Gutkin *cygwin* | *mingw* | *cegcc* ) 65525b6dc79427b8f7eeb6a7ff68034ab8548ce670eaAlexander Gutkin # Linker will automatically link against shared library if both 65535b6dc79427b8f7eeb6a7ff68034ab8548ce670eaAlexander Gutkin # static and shared are present. Therefore, ensure we extract 65545b6dc79427b8f7eeb6a7ff68034ab8548ce670eaAlexander Gutkin # symbols from the import library if a shared library is present 65555b6dc79427b8f7eeb6a7ff68034ab8548ce670eaAlexander Gutkin # (otherwise, the dlopen module name will be incorrect). We do 65565b6dc79427b8f7eeb6a7ff68034ab8548ce670eaAlexander Gutkin # this by putting the import library name into $newdlprefiles. 65575b6dc79427b8f7eeb6a7ff68034ab8548ce670eaAlexander Gutkin # We recover the dlopen module name by 'saving' the la file 65585b6dc79427b8f7eeb6a7ff68034ab8548ce670eaAlexander Gutkin # name in a special purpose variable, and (later) extracting the 65595b6dc79427b8f7eeb6a7ff68034ab8548ce670eaAlexander Gutkin # dlname from the la file. 65605b6dc79427b8f7eeb6a7ff68034ab8548ce670eaAlexander Gutkin if test -n "$dlname"; then 65615b6dc79427b8f7eeb6a7ff68034ab8548ce670eaAlexander Gutkin func_tr_sh "$dir/$linklib" 65625b6dc79427b8f7eeb6a7ff68034ab8548ce670eaAlexander Gutkin eval "libfile_$func_tr_sh_result=\$abs_ladir/\$laname" 65635b6dc79427b8f7eeb6a7ff68034ab8548ce670eaAlexander Gutkin func_append newdlprefiles " $dir/$linklib" 65645b6dc79427b8f7eeb6a7ff68034ab8548ce670eaAlexander Gutkin else 65655b6dc79427b8f7eeb6a7ff68034ab8548ce670eaAlexander Gutkin func_append newdlprefiles " $dir/$old_library" 65665b6dc79427b8f7eeb6a7ff68034ab8548ce670eaAlexander Gutkin # Keep a list of preopened convenience libraries to check 65675b6dc79427b8f7eeb6a7ff68034ab8548ce670eaAlexander Gutkin # that they are being used correctly in the link pass. 65685b6dc79427b8f7eeb6a7ff68034ab8548ce670eaAlexander Gutkin test -z "$libdir" && \ 65695b6dc79427b8f7eeb6a7ff68034ab8548ce670eaAlexander Gutkin func_append dlpreconveniencelibs " $dir/$old_library" 65705b6dc79427b8f7eeb6a7ff68034ab8548ce670eaAlexander Gutkin fi 65715b6dc79427b8f7eeb6a7ff68034ab8548ce670eaAlexander Gutkin ;; 65725b6dc79427b8f7eeb6a7ff68034ab8548ce670eaAlexander Gutkin * ) 65735b6dc79427b8f7eeb6a7ff68034ab8548ce670eaAlexander Gutkin # Prefer using a static library (so that no silly _DYNAMIC symbols 65745b6dc79427b8f7eeb6a7ff68034ab8548ce670eaAlexander Gutkin # are required to link). 65755b6dc79427b8f7eeb6a7ff68034ab8548ce670eaAlexander Gutkin if test -n "$old_library"; then 65765b6dc79427b8f7eeb6a7ff68034ab8548ce670eaAlexander Gutkin func_append newdlprefiles " $dir/$old_library" 65775b6dc79427b8f7eeb6a7ff68034ab8548ce670eaAlexander Gutkin # Keep a list of preopened convenience libraries to check 65785b6dc79427b8f7eeb6a7ff68034ab8548ce670eaAlexander Gutkin # that they are being used correctly in the link pass. 65795b6dc79427b8f7eeb6a7ff68034ab8548ce670eaAlexander Gutkin test -z "$libdir" && \ 65805b6dc79427b8f7eeb6a7ff68034ab8548ce670eaAlexander Gutkin func_append dlpreconveniencelibs " $dir/$old_library" 65815b6dc79427b8f7eeb6a7ff68034ab8548ce670eaAlexander Gutkin # Otherwise, use the dlname, so that lt_dlopen finds it. 65825b6dc79427b8f7eeb6a7ff68034ab8548ce670eaAlexander Gutkin elif test -n "$dlname"; then 65835b6dc79427b8f7eeb6a7ff68034ab8548ce670eaAlexander Gutkin func_append newdlprefiles " $dir/$dlname" 65845b6dc79427b8f7eeb6a7ff68034ab8548ce670eaAlexander Gutkin else 65855b6dc79427b8f7eeb6a7ff68034ab8548ce670eaAlexander Gutkin func_append newdlprefiles " $dir/$linklib" 65865b6dc79427b8f7eeb6a7ff68034ab8548ce670eaAlexander Gutkin fi 65875b6dc79427b8f7eeb6a7ff68034ab8548ce670eaAlexander Gutkin ;; 65885b6dc79427b8f7eeb6a7ff68034ab8548ce670eaAlexander Gutkin esac 6589f4c12fce1ee58e670f9c3fce46c40296ba9ee8a2Ian Hodson fi # $pass = dlpreopen 6590f4c12fce1ee58e670f9c3fce46c40296ba9ee8a2Ian Hodson 6591f4c12fce1ee58e670f9c3fce46c40296ba9ee8a2Ian Hodson if test -z "$libdir"; then 6592f4c12fce1ee58e670f9c3fce46c40296ba9ee8a2Ian Hodson # Link the convenience library 6593f4c12fce1ee58e670f9c3fce46c40296ba9ee8a2Ian Hodson if test "$linkmode" = lib; then 6594f4c12fce1ee58e670f9c3fce46c40296ba9ee8a2Ian Hodson deplibs="$dir/$old_library $deplibs" 6595f4c12fce1ee58e670f9c3fce46c40296ba9ee8a2Ian Hodson elif test "$linkmode,$pass" = "prog,link"; then 6596f4c12fce1ee58e670f9c3fce46c40296ba9ee8a2Ian Hodson compile_deplibs="$dir/$old_library $compile_deplibs" 6597f4c12fce1ee58e670f9c3fce46c40296ba9ee8a2Ian Hodson finalize_deplibs="$dir/$old_library $finalize_deplibs" 6598f4c12fce1ee58e670f9c3fce46c40296ba9ee8a2Ian Hodson else 6599f4c12fce1ee58e670f9c3fce46c40296ba9ee8a2Ian Hodson deplibs="$lib $deplibs" # used for prog,scan pass 6600f4c12fce1ee58e670f9c3fce46c40296ba9ee8a2Ian Hodson fi 6601f4c12fce1ee58e670f9c3fce46c40296ba9ee8a2Ian Hodson continue 6602f4c12fce1ee58e670f9c3fce46c40296ba9ee8a2Ian Hodson fi 6603f4c12fce1ee58e670f9c3fce46c40296ba9ee8a2Ian Hodson 6604f4c12fce1ee58e670f9c3fce46c40296ba9ee8a2Ian Hodson 6605f4c12fce1ee58e670f9c3fce46c40296ba9ee8a2Ian Hodson if test "$linkmode" = prog && test "$pass" != link; then 66065b6dc79427b8f7eeb6a7ff68034ab8548ce670eaAlexander Gutkin func_append newlib_search_path " $ladir" 6607f4c12fce1ee58e670f9c3fce46c40296ba9ee8a2Ian Hodson deplibs="$lib $deplibs" 6608f4c12fce1ee58e670f9c3fce46c40296ba9ee8a2Ian Hodson 6609f4c12fce1ee58e670f9c3fce46c40296ba9ee8a2Ian Hodson linkalldeplibs=no 6610f4c12fce1ee58e670f9c3fce46c40296ba9ee8a2Ian Hodson if test "$link_all_deplibs" != no || test -z "$library_names" || 6611f4c12fce1ee58e670f9c3fce46c40296ba9ee8a2Ian Hodson test "$build_libtool_libs" = no; then 6612f4c12fce1ee58e670f9c3fce46c40296ba9ee8a2Ian Hodson linkalldeplibs=yes 6613f4c12fce1ee58e670f9c3fce46c40296ba9ee8a2Ian Hodson fi 6614f4c12fce1ee58e670f9c3fce46c40296ba9ee8a2Ian Hodson 6615f4c12fce1ee58e670f9c3fce46c40296ba9ee8a2Ian Hodson tmp_libs= 6616f4c12fce1ee58e670f9c3fce46c40296ba9ee8a2Ian Hodson for deplib in $dependency_libs; do 6617f4c12fce1ee58e670f9c3fce46c40296ba9ee8a2Ian Hodson case $deplib in 6618f4c12fce1ee58e670f9c3fce46c40296ba9ee8a2Ian Hodson -L*) func_stripname '-L' '' "$deplib" 66195b6dc79427b8f7eeb6a7ff68034ab8548ce670eaAlexander Gutkin func_resolve_sysroot "$func_stripname_result" 66205b6dc79427b8f7eeb6a7ff68034ab8548ce670eaAlexander Gutkin func_append newlib_search_path " $func_resolve_sysroot_result" 6621f4c12fce1ee58e670f9c3fce46c40296ba9ee8a2Ian Hodson ;; 6622f4c12fce1ee58e670f9c3fce46c40296ba9ee8a2Ian Hodson esac 6623f4c12fce1ee58e670f9c3fce46c40296ba9ee8a2Ian Hodson # Need to link against all dependency_libs? 6624f4c12fce1ee58e670f9c3fce46c40296ba9ee8a2Ian Hodson if test "$linkalldeplibs" = yes; then 6625f4c12fce1ee58e670f9c3fce46c40296ba9ee8a2Ian Hodson deplibs="$deplib $deplibs" 6626f4c12fce1ee58e670f9c3fce46c40296ba9ee8a2Ian Hodson else 6627f4c12fce1ee58e670f9c3fce46c40296ba9ee8a2Ian Hodson # Need to hardcode shared library paths 6628f4c12fce1ee58e670f9c3fce46c40296ba9ee8a2Ian Hodson # or/and link against static libraries 6629f4c12fce1ee58e670f9c3fce46c40296ba9ee8a2Ian Hodson newdependency_libs="$deplib $newdependency_libs" 6630f4c12fce1ee58e670f9c3fce46c40296ba9ee8a2Ian Hodson fi 66315b6dc79427b8f7eeb6a7ff68034ab8548ce670eaAlexander Gutkin if $opt_preserve_dup_deps ; then 6632f4c12fce1ee58e670f9c3fce46c40296ba9ee8a2Ian Hodson case "$tmp_libs " in 66335b6dc79427b8f7eeb6a7ff68034ab8548ce670eaAlexander Gutkin *" $deplib "*) func_append specialdeplibs " $deplib" ;; 6634f4c12fce1ee58e670f9c3fce46c40296ba9ee8a2Ian Hodson esac 6635f4c12fce1ee58e670f9c3fce46c40296ba9ee8a2Ian Hodson fi 66365b6dc79427b8f7eeb6a7ff68034ab8548ce670eaAlexander Gutkin func_append tmp_libs " $deplib" 6637f4c12fce1ee58e670f9c3fce46c40296ba9ee8a2Ian Hodson done # for deplib 6638f4c12fce1ee58e670f9c3fce46c40296ba9ee8a2Ian Hodson continue 6639f4c12fce1ee58e670f9c3fce46c40296ba9ee8a2Ian Hodson fi # $linkmode = prog... 6640f4c12fce1ee58e670f9c3fce46c40296ba9ee8a2Ian Hodson 6641f4c12fce1ee58e670f9c3fce46c40296ba9ee8a2Ian Hodson if test "$linkmode,$pass" = "prog,link"; then 6642f4c12fce1ee58e670f9c3fce46c40296ba9ee8a2Ian Hodson if test -n "$library_names" && 6643f4c12fce1ee58e670f9c3fce46c40296ba9ee8a2Ian Hodson { { test "$prefer_static_libs" = no || 6644f4c12fce1ee58e670f9c3fce46c40296ba9ee8a2Ian Hodson test "$prefer_static_libs,$installed" = "built,yes"; } || 6645f4c12fce1ee58e670f9c3fce46c40296ba9ee8a2Ian Hodson test -z "$old_library"; }; then 6646f4c12fce1ee58e670f9c3fce46c40296ba9ee8a2Ian Hodson # We need to hardcode the library path 6647f4c12fce1ee58e670f9c3fce46c40296ba9ee8a2Ian Hodson if test -n "$shlibpath_var" && test -z "$avoidtemprpath" ; then 6648f4c12fce1ee58e670f9c3fce46c40296ba9ee8a2Ian Hodson # Make sure the rpath contains only unique directories. 6649f4c12fce1ee58e670f9c3fce46c40296ba9ee8a2Ian Hodson case "$temp_rpath:" in 6650f4c12fce1ee58e670f9c3fce46c40296ba9ee8a2Ian Hodson *"$absdir:"*) ;; 66515b6dc79427b8f7eeb6a7ff68034ab8548ce670eaAlexander Gutkin *) func_append temp_rpath "$absdir:" ;; 6652f4c12fce1ee58e670f9c3fce46c40296ba9ee8a2Ian Hodson esac 6653f4c12fce1ee58e670f9c3fce46c40296ba9ee8a2Ian Hodson fi 6654f4c12fce1ee58e670f9c3fce46c40296ba9ee8a2Ian Hodson 6655f4c12fce1ee58e670f9c3fce46c40296ba9ee8a2Ian Hodson # Hardcode the library path. 6656f4c12fce1ee58e670f9c3fce46c40296ba9ee8a2Ian Hodson # Skip directories that are in the system default run-time 6657f4c12fce1ee58e670f9c3fce46c40296ba9ee8a2Ian Hodson # search path. 6658f4c12fce1ee58e670f9c3fce46c40296ba9ee8a2Ian Hodson case " $sys_lib_dlsearch_path " in 6659f4c12fce1ee58e670f9c3fce46c40296ba9ee8a2Ian Hodson *" $absdir "*) ;; 6660f4c12fce1ee58e670f9c3fce46c40296ba9ee8a2Ian Hodson *) 6661f4c12fce1ee58e670f9c3fce46c40296ba9ee8a2Ian Hodson case "$compile_rpath " in 6662f4c12fce1ee58e670f9c3fce46c40296ba9ee8a2Ian Hodson *" $absdir "*) ;; 66635b6dc79427b8f7eeb6a7ff68034ab8548ce670eaAlexander Gutkin *) func_append compile_rpath " $absdir" ;; 6664f4c12fce1ee58e670f9c3fce46c40296ba9ee8a2Ian Hodson esac 6665f4c12fce1ee58e670f9c3fce46c40296ba9ee8a2Ian Hodson ;; 6666f4c12fce1ee58e670f9c3fce46c40296ba9ee8a2Ian Hodson esac 6667f4c12fce1ee58e670f9c3fce46c40296ba9ee8a2Ian Hodson case " $sys_lib_dlsearch_path " in 6668f4c12fce1ee58e670f9c3fce46c40296ba9ee8a2Ian Hodson *" $libdir "*) ;; 6669f4c12fce1ee58e670f9c3fce46c40296ba9ee8a2Ian Hodson *) 6670f4c12fce1ee58e670f9c3fce46c40296ba9ee8a2Ian Hodson case "$finalize_rpath " in 6671f4c12fce1ee58e670f9c3fce46c40296ba9ee8a2Ian Hodson *" $libdir "*) ;; 66725b6dc79427b8f7eeb6a7ff68034ab8548ce670eaAlexander Gutkin *) func_append finalize_rpath " $libdir" ;; 6673f4c12fce1ee58e670f9c3fce46c40296ba9ee8a2Ian Hodson esac 6674f4c12fce1ee58e670f9c3fce46c40296ba9ee8a2Ian Hodson ;; 6675f4c12fce1ee58e670f9c3fce46c40296ba9ee8a2Ian Hodson esac 6676f4c12fce1ee58e670f9c3fce46c40296ba9ee8a2Ian Hodson fi # $linkmode,$pass = prog,link... 6677f4c12fce1ee58e670f9c3fce46c40296ba9ee8a2Ian Hodson 6678f4c12fce1ee58e670f9c3fce46c40296ba9ee8a2Ian Hodson if test "$alldeplibs" = yes && 6679f4c12fce1ee58e670f9c3fce46c40296ba9ee8a2Ian Hodson { test "$deplibs_check_method" = pass_all || 6680f4c12fce1ee58e670f9c3fce46c40296ba9ee8a2Ian Hodson { test "$build_libtool_libs" = yes && 6681f4c12fce1ee58e670f9c3fce46c40296ba9ee8a2Ian Hodson test -n "$library_names"; }; }; then 6682f4c12fce1ee58e670f9c3fce46c40296ba9ee8a2Ian Hodson # We only need to search for static libraries 6683f4c12fce1ee58e670f9c3fce46c40296ba9ee8a2Ian Hodson continue 6684f4c12fce1ee58e670f9c3fce46c40296ba9ee8a2Ian Hodson fi 6685f4c12fce1ee58e670f9c3fce46c40296ba9ee8a2Ian Hodson fi 6686f4c12fce1ee58e670f9c3fce46c40296ba9ee8a2Ian Hodson 6687f4c12fce1ee58e670f9c3fce46c40296ba9ee8a2Ian Hodson link_static=no # Whether the deplib will be linked statically 6688f4c12fce1ee58e670f9c3fce46c40296ba9ee8a2Ian Hodson use_static_libs=$prefer_static_libs 6689f4c12fce1ee58e670f9c3fce46c40296ba9ee8a2Ian Hodson if test "$use_static_libs" = built && test "$installed" = yes; then 6690f4c12fce1ee58e670f9c3fce46c40296ba9ee8a2Ian Hodson use_static_libs=no 6691f4c12fce1ee58e670f9c3fce46c40296ba9ee8a2Ian Hodson fi 6692f4c12fce1ee58e670f9c3fce46c40296ba9ee8a2Ian Hodson if test -n "$library_names" && 6693f4c12fce1ee58e670f9c3fce46c40296ba9ee8a2Ian Hodson { test "$use_static_libs" = no || test -z "$old_library"; }; then 6694f4c12fce1ee58e670f9c3fce46c40296ba9ee8a2Ian Hodson case $host in 6695f4c12fce1ee58e670f9c3fce46c40296ba9ee8a2Ian Hodson *cygwin* | *mingw* | *cegcc*) 6696f4c12fce1ee58e670f9c3fce46c40296ba9ee8a2Ian Hodson # No point in relinking DLLs because paths are not encoded 66975b6dc79427b8f7eeb6a7ff68034ab8548ce670eaAlexander Gutkin func_append notinst_deplibs " $lib" 6698f4c12fce1ee58e670f9c3fce46c40296ba9ee8a2Ian Hodson need_relink=no 6699f4c12fce1ee58e670f9c3fce46c40296ba9ee8a2Ian Hodson ;; 6700f4c12fce1ee58e670f9c3fce46c40296ba9ee8a2Ian Hodson *) 6701f4c12fce1ee58e670f9c3fce46c40296ba9ee8a2Ian Hodson if test "$installed" = no; then 67025b6dc79427b8f7eeb6a7ff68034ab8548ce670eaAlexander Gutkin func_append notinst_deplibs " $lib" 6703f4c12fce1ee58e670f9c3fce46c40296ba9ee8a2Ian Hodson need_relink=yes 6704f4c12fce1ee58e670f9c3fce46c40296ba9ee8a2Ian Hodson fi 6705f4c12fce1ee58e670f9c3fce46c40296ba9ee8a2Ian Hodson ;; 6706f4c12fce1ee58e670f9c3fce46c40296ba9ee8a2Ian Hodson esac 6707f4c12fce1ee58e670f9c3fce46c40296ba9ee8a2Ian Hodson # This is a shared library 6708f4c12fce1ee58e670f9c3fce46c40296ba9ee8a2Ian Hodson 6709f4c12fce1ee58e670f9c3fce46c40296ba9ee8a2Ian Hodson # Warn about portability, can't link against -module's on some 6710f4c12fce1ee58e670f9c3fce46c40296ba9ee8a2Ian Hodson # systems (darwin). Don't bleat about dlopened modules though! 6711f4c12fce1ee58e670f9c3fce46c40296ba9ee8a2Ian Hodson dlopenmodule="" 6712f4c12fce1ee58e670f9c3fce46c40296ba9ee8a2Ian Hodson for dlpremoduletest in $dlprefiles; do 6713f4c12fce1ee58e670f9c3fce46c40296ba9ee8a2Ian Hodson if test "X$dlpremoduletest" = "X$lib"; then 6714f4c12fce1ee58e670f9c3fce46c40296ba9ee8a2Ian Hodson dlopenmodule="$dlpremoduletest" 6715f4c12fce1ee58e670f9c3fce46c40296ba9ee8a2Ian Hodson break 6716f4c12fce1ee58e670f9c3fce46c40296ba9ee8a2Ian Hodson fi 6717f4c12fce1ee58e670f9c3fce46c40296ba9ee8a2Ian Hodson done 6718f4c12fce1ee58e670f9c3fce46c40296ba9ee8a2Ian Hodson if test -z "$dlopenmodule" && test "$shouldnotlink" = yes && test "$pass" = link; then 67195b6dc79427b8f7eeb6a7ff68034ab8548ce670eaAlexander Gutkin echo 6720f4c12fce1ee58e670f9c3fce46c40296ba9ee8a2Ian Hodson if test "$linkmode" = prog; then 6721f4c12fce1ee58e670f9c3fce46c40296ba9ee8a2Ian Hodson $ECHO "*** Warning: Linking the executable $output against the loadable module" 6722f4c12fce1ee58e670f9c3fce46c40296ba9ee8a2Ian Hodson else 6723f4c12fce1ee58e670f9c3fce46c40296ba9ee8a2Ian Hodson $ECHO "*** Warning: Linking the shared library $output against the loadable module" 6724f4c12fce1ee58e670f9c3fce46c40296ba9ee8a2Ian Hodson fi 6725f4c12fce1ee58e670f9c3fce46c40296ba9ee8a2Ian Hodson $ECHO "*** $linklib is not portable!" 6726f4c12fce1ee58e670f9c3fce46c40296ba9ee8a2Ian Hodson fi 6727f4c12fce1ee58e670f9c3fce46c40296ba9ee8a2Ian Hodson if test "$linkmode" = lib && 6728f4c12fce1ee58e670f9c3fce46c40296ba9ee8a2Ian Hodson test "$hardcode_into_libs" = yes; then 6729f4c12fce1ee58e670f9c3fce46c40296ba9ee8a2Ian Hodson # Hardcode the library path. 6730f4c12fce1ee58e670f9c3fce46c40296ba9ee8a2Ian Hodson # Skip directories that are in the system default run-time 6731f4c12fce1ee58e670f9c3fce46c40296ba9ee8a2Ian Hodson # search path. 6732f4c12fce1ee58e670f9c3fce46c40296ba9ee8a2Ian Hodson case " $sys_lib_dlsearch_path " in 6733f4c12fce1ee58e670f9c3fce46c40296ba9ee8a2Ian Hodson *" $absdir "*) ;; 6734f4c12fce1ee58e670f9c3fce46c40296ba9ee8a2Ian Hodson *) 6735f4c12fce1ee58e670f9c3fce46c40296ba9ee8a2Ian Hodson case "$compile_rpath " in 6736f4c12fce1ee58e670f9c3fce46c40296ba9ee8a2Ian Hodson *" $absdir "*) ;; 67375b6dc79427b8f7eeb6a7ff68034ab8548ce670eaAlexander Gutkin *) func_append compile_rpath " $absdir" ;; 6738f4c12fce1ee58e670f9c3fce46c40296ba9ee8a2Ian Hodson esac 6739f4c12fce1ee58e670f9c3fce46c40296ba9ee8a2Ian Hodson ;; 6740f4c12fce1ee58e670f9c3fce46c40296ba9ee8a2Ian Hodson esac 6741f4c12fce1ee58e670f9c3fce46c40296ba9ee8a2Ian Hodson case " $sys_lib_dlsearch_path " in 6742f4c12fce1ee58e670f9c3fce46c40296ba9ee8a2Ian Hodson *" $libdir "*) ;; 6743f4c12fce1ee58e670f9c3fce46c40296ba9ee8a2Ian Hodson *) 6744f4c12fce1ee58e670f9c3fce46c40296ba9ee8a2Ian Hodson case "$finalize_rpath " in 6745f4c12fce1ee58e670f9c3fce46c40296ba9ee8a2Ian Hodson *" $libdir "*) ;; 67465b6dc79427b8f7eeb6a7ff68034ab8548ce670eaAlexander Gutkin *) func_append finalize_rpath " $libdir" ;; 6747f4c12fce1ee58e670f9c3fce46c40296ba9ee8a2Ian Hodson esac 6748f4c12fce1ee58e670f9c3fce46c40296ba9ee8a2Ian Hodson ;; 6749f4c12fce1ee58e670f9c3fce46c40296ba9ee8a2Ian Hodson esac 6750f4c12fce1ee58e670f9c3fce46c40296ba9ee8a2Ian Hodson fi 6751f4c12fce1ee58e670f9c3fce46c40296ba9ee8a2Ian Hodson 6752f4c12fce1ee58e670f9c3fce46c40296ba9ee8a2Ian Hodson if test -n "$old_archive_from_expsyms_cmds"; then 6753f4c12fce1ee58e670f9c3fce46c40296ba9ee8a2Ian Hodson # figure out the soname 6754f4c12fce1ee58e670f9c3fce46c40296ba9ee8a2Ian Hodson set dummy $library_names 6755f4c12fce1ee58e670f9c3fce46c40296ba9ee8a2Ian Hodson shift 6756f4c12fce1ee58e670f9c3fce46c40296ba9ee8a2Ian Hodson realname="$1" 6757f4c12fce1ee58e670f9c3fce46c40296ba9ee8a2Ian Hodson shift 6758f4c12fce1ee58e670f9c3fce46c40296ba9ee8a2Ian Hodson libname=`eval "\\$ECHO \"$libname_spec\""` 6759f4c12fce1ee58e670f9c3fce46c40296ba9ee8a2Ian Hodson # use dlname if we got it. it's perfectly good, no? 6760f4c12fce1ee58e670f9c3fce46c40296ba9ee8a2Ian Hodson if test -n "$dlname"; then 6761f4c12fce1ee58e670f9c3fce46c40296ba9ee8a2Ian Hodson soname="$dlname" 6762f4c12fce1ee58e670f9c3fce46c40296ba9ee8a2Ian Hodson elif test -n "$soname_spec"; then 6763f4c12fce1ee58e670f9c3fce46c40296ba9ee8a2Ian Hodson # bleh windows 6764f4c12fce1ee58e670f9c3fce46c40296ba9ee8a2Ian Hodson case $host in 6765f4c12fce1ee58e670f9c3fce46c40296ba9ee8a2Ian Hodson *cygwin* | mingw* | *cegcc*) 6766f4c12fce1ee58e670f9c3fce46c40296ba9ee8a2Ian Hodson func_arith $current - $age 6767f4c12fce1ee58e670f9c3fce46c40296ba9ee8a2Ian Hodson major=$func_arith_result 6768f4c12fce1ee58e670f9c3fce46c40296ba9ee8a2Ian Hodson versuffix="-$major" 6769f4c12fce1ee58e670f9c3fce46c40296ba9ee8a2Ian Hodson ;; 6770f4c12fce1ee58e670f9c3fce46c40296ba9ee8a2Ian Hodson esac 6771f4c12fce1ee58e670f9c3fce46c40296ba9ee8a2Ian Hodson eval soname=\"$soname_spec\" 6772f4c12fce1ee58e670f9c3fce46c40296ba9ee8a2Ian Hodson else 6773f4c12fce1ee58e670f9c3fce46c40296ba9ee8a2Ian Hodson soname="$realname" 6774f4c12fce1ee58e670f9c3fce46c40296ba9ee8a2Ian Hodson fi 6775f4c12fce1ee58e670f9c3fce46c40296ba9ee8a2Ian Hodson 6776f4c12fce1ee58e670f9c3fce46c40296ba9ee8a2Ian Hodson # Make a new name for the extract_expsyms_cmds to use 6777f4c12fce1ee58e670f9c3fce46c40296ba9ee8a2Ian Hodson soroot="$soname" 6778f4c12fce1ee58e670f9c3fce46c40296ba9ee8a2Ian Hodson func_basename "$soroot" 6779f4c12fce1ee58e670f9c3fce46c40296ba9ee8a2Ian Hodson soname="$func_basename_result" 6780f4c12fce1ee58e670f9c3fce46c40296ba9ee8a2Ian Hodson func_stripname 'lib' '.dll' "$soname" 6781f4c12fce1ee58e670f9c3fce46c40296ba9ee8a2Ian Hodson newlib=libimp-$func_stripname_result.a 6782f4c12fce1ee58e670f9c3fce46c40296ba9ee8a2Ian Hodson 6783f4c12fce1ee58e670f9c3fce46c40296ba9ee8a2Ian Hodson # If the library has no export list, then create one now 6784f4c12fce1ee58e670f9c3fce46c40296ba9ee8a2Ian Hodson if test -f "$output_objdir/$soname-def"; then : 6785f4c12fce1ee58e670f9c3fce46c40296ba9ee8a2Ian Hodson else 6786f4c12fce1ee58e670f9c3fce46c40296ba9ee8a2Ian Hodson func_verbose "extracting exported symbol list from \`$soname'" 6787f4c12fce1ee58e670f9c3fce46c40296ba9ee8a2Ian Hodson func_execute_cmds "$extract_expsyms_cmds" 'exit $?' 6788f4c12fce1ee58e670f9c3fce46c40296ba9ee8a2Ian Hodson fi 6789f4c12fce1ee58e670f9c3fce46c40296ba9ee8a2Ian Hodson 6790f4c12fce1ee58e670f9c3fce46c40296ba9ee8a2Ian Hodson # Create $newlib 6791f4c12fce1ee58e670f9c3fce46c40296ba9ee8a2Ian Hodson if test -f "$output_objdir/$newlib"; then :; else 6792f4c12fce1ee58e670f9c3fce46c40296ba9ee8a2Ian Hodson func_verbose "generating import library for \`$soname'" 6793f4c12fce1ee58e670f9c3fce46c40296ba9ee8a2Ian Hodson func_execute_cmds "$old_archive_from_expsyms_cmds" 'exit $?' 6794f4c12fce1ee58e670f9c3fce46c40296ba9ee8a2Ian Hodson fi 6795f4c12fce1ee58e670f9c3fce46c40296ba9ee8a2Ian Hodson # make sure the library variables are pointing to the new library 6796f4c12fce1ee58e670f9c3fce46c40296ba9ee8a2Ian Hodson dir=$output_objdir 6797f4c12fce1ee58e670f9c3fce46c40296ba9ee8a2Ian Hodson linklib=$newlib 6798f4c12fce1ee58e670f9c3fce46c40296ba9ee8a2Ian Hodson fi # test -n "$old_archive_from_expsyms_cmds" 6799f4c12fce1ee58e670f9c3fce46c40296ba9ee8a2Ian Hodson 68005b6dc79427b8f7eeb6a7ff68034ab8548ce670eaAlexander Gutkin if test "$linkmode" = prog || test "$opt_mode" != relink; then 6801f4c12fce1ee58e670f9c3fce46c40296ba9ee8a2Ian Hodson add_shlibpath= 6802f4c12fce1ee58e670f9c3fce46c40296ba9ee8a2Ian Hodson add_dir= 6803f4c12fce1ee58e670f9c3fce46c40296ba9ee8a2Ian Hodson add= 6804f4c12fce1ee58e670f9c3fce46c40296ba9ee8a2Ian Hodson lib_linked=yes 6805f4c12fce1ee58e670f9c3fce46c40296ba9ee8a2Ian Hodson case $hardcode_action in 6806f4c12fce1ee58e670f9c3fce46c40296ba9ee8a2Ian Hodson immediate | unsupported) 6807f4c12fce1ee58e670f9c3fce46c40296ba9ee8a2Ian Hodson if test "$hardcode_direct" = no; then 6808f4c12fce1ee58e670f9c3fce46c40296ba9ee8a2Ian Hodson add="$dir/$linklib" 6809f4c12fce1ee58e670f9c3fce46c40296ba9ee8a2Ian Hodson case $host in 6810f4c12fce1ee58e670f9c3fce46c40296ba9ee8a2Ian Hodson *-*-sco3.2v5.0.[024]*) add_dir="-L$dir" ;; 6811f4c12fce1ee58e670f9c3fce46c40296ba9ee8a2Ian Hodson *-*-sysv4*uw2*) add_dir="-L$dir" ;; 6812f4c12fce1ee58e670f9c3fce46c40296ba9ee8a2Ian Hodson *-*-sysv5OpenUNIX* | *-*-sysv5UnixWare7.[01].[10]* | \ 6813f4c12fce1ee58e670f9c3fce46c40296ba9ee8a2Ian Hodson *-*-unixware7*) add_dir="-L$dir" ;; 6814f4c12fce1ee58e670f9c3fce46c40296ba9ee8a2Ian Hodson *-*-darwin* ) 6815f4c12fce1ee58e670f9c3fce46c40296ba9ee8a2Ian Hodson # if the lib is a (non-dlopened) module then we can not 6816f4c12fce1ee58e670f9c3fce46c40296ba9ee8a2Ian Hodson # link against it, someone is ignoring the earlier warnings 6817f4c12fce1ee58e670f9c3fce46c40296ba9ee8a2Ian Hodson if /usr/bin/file -L $add 2> /dev/null | 6818f4c12fce1ee58e670f9c3fce46c40296ba9ee8a2Ian Hodson $GREP ": [^:]* bundle" >/dev/null ; then 6819f4c12fce1ee58e670f9c3fce46c40296ba9ee8a2Ian Hodson if test "X$dlopenmodule" != "X$lib"; then 6820f4c12fce1ee58e670f9c3fce46c40296ba9ee8a2Ian Hodson $ECHO "*** Warning: lib $linklib is a module, not a shared library" 6821f4c12fce1ee58e670f9c3fce46c40296ba9ee8a2Ian Hodson if test -z "$old_library" ; then 68225b6dc79427b8f7eeb6a7ff68034ab8548ce670eaAlexander Gutkin echo 68235b6dc79427b8f7eeb6a7ff68034ab8548ce670eaAlexander Gutkin echo "*** And there doesn't seem to be a static archive available" 68245b6dc79427b8f7eeb6a7ff68034ab8548ce670eaAlexander Gutkin echo "*** The link will probably fail, sorry" 6825f4c12fce1ee58e670f9c3fce46c40296ba9ee8a2Ian Hodson else 6826f4c12fce1ee58e670f9c3fce46c40296ba9ee8a2Ian Hodson add="$dir/$old_library" 6827f4c12fce1ee58e670f9c3fce46c40296ba9ee8a2Ian Hodson fi 6828f4c12fce1ee58e670f9c3fce46c40296ba9ee8a2Ian Hodson elif test -n "$old_library"; then 6829f4c12fce1ee58e670f9c3fce46c40296ba9ee8a2Ian Hodson add="$dir/$old_library" 6830f4c12fce1ee58e670f9c3fce46c40296ba9ee8a2Ian Hodson fi 6831f4c12fce1ee58e670f9c3fce46c40296ba9ee8a2Ian Hodson fi 6832f4c12fce1ee58e670f9c3fce46c40296ba9ee8a2Ian Hodson esac 6833f4c12fce1ee58e670f9c3fce46c40296ba9ee8a2Ian Hodson elif test "$hardcode_minus_L" = no; then 6834f4c12fce1ee58e670f9c3fce46c40296ba9ee8a2Ian Hodson case $host in 6835f4c12fce1ee58e670f9c3fce46c40296ba9ee8a2Ian Hodson *-*-sunos*) add_shlibpath="$dir" ;; 6836f4c12fce1ee58e670f9c3fce46c40296ba9ee8a2Ian Hodson esac 6837f4c12fce1ee58e670f9c3fce46c40296ba9ee8a2Ian Hodson add_dir="-L$dir" 6838f4c12fce1ee58e670f9c3fce46c40296ba9ee8a2Ian Hodson add="-l$name" 6839f4c12fce1ee58e670f9c3fce46c40296ba9ee8a2Ian Hodson elif test "$hardcode_shlibpath_var" = no; then 6840f4c12fce1ee58e670f9c3fce46c40296ba9ee8a2Ian Hodson add_shlibpath="$dir" 6841f4c12fce1ee58e670f9c3fce46c40296ba9ee8a2Ian Hodson add="-l$name" 6842f4c12fce1ee58e670f9c3fce46c40296ba9ee8a2Ian Hodson else 6843f4c12fce1ee58e670f9c3fce46c40296ba9ee8a2Ian Hodson lib_linked=no 6844f4c12fce1ee58e670f9c3fce46c40296ba9ee8a2Ian Hodson fi 6845f4c12fce1ee58e670f9c3fce46c40296ba9ee8a2Ian Hodson ;; 6846f4c12fce1ee58e670f9c3fce46c40296ba9ee8a2Ian Hodson relink) 6847f4c12fce1ee58e670f9c3fce46c40296ba9ee8a2Ian Hodson if test "$hardcode_direct" = yes && 6848f4c12fce1ee58e670f9c3fce46c40296ba9ee8a2Ian Hodson test "$hardcode_direct_absolute" = no; then 6849f4c12fce1ee58e670f9c3fce46c40296ba9ee8a2Ian Hodson add="$dir/$linklib" 6850f4c12fce1ee58e670f9c3fce46c40296ba9ee8a2Ian Hodson elif test "$hardcode_minus_L" = yes; then 68515b6dc79427b8f7eeb6a7ff68034ab8548ce670eaAlexander Gutkin add_dir="-L$absdir" 6852f4c12fce1ee58e670f9c3fce46c40296ba9ee8a2Ian Hodson # Try looking first in the location we're being installed to. 6853f4c12fce1ee58e670f9c3fce46c40296ba9ee8a2Ian Hodson if test -n "$inst_prefix_dir"; then 6854f4c12fce1ee58e670f9c3fce46c40296ba9ee8a2Ian Hodson case $libdir in 6855f4c12fce1ee58e670f9c3fce46c40296ba9ee8a2Ian Hodson [\\/]*) 68565b6dc79427b8f7eeb6a7ff68034ab8548ce670eaAlexander Gutkin func_append add_dir " -L$inst_prefix_dir$libdir" 6857f4c12fce1ee58e670f9c3fce46c40296ba9ee8a2Ian Hodson ;; 6858f4c12fce1ee58e670f9c3fce46c40296ba9ee8a2Ian Hodson esac 6859f4c12fce1ee58e670f9c3fce46c40296ba9ee8a2Ian Hodson fi 6860f4c12fce1ee58e670f9c3fce46c40296ba9ee8a2Ian Hodson add="-l$name" 6861f4c12fce1ee58e670f9c3fce46c40296ba9ee8a2Ian Hodson elif test "$hardcode_shlibpath_var" = yes; then 6862f4c12fce1ee58e670f9c3fce46c40296ba9ee8a2Ian Hodson add_shlibpath="$dir" 6863f4c12fce1ee58e670f9c3fce46c40296ba9ee8a2Ian Hodson add="-l$name" 6864f4c12fce1ee58e670f9c3fce46c40296ba9ee8a2Ian Hodson else 6865f4c12fce1ee58e670f9c3fce46c40296ba9ee8a2Ian Hodson lib_linked=no 6866f4c12fce1ee58e670f9c3fce46c40296ba9ee8a2Ian Hodson fi 6867f4c12fce1ee58e670f9c3fce46c40296ba9ee8a2Ian Hodson ;; 6868f4c12fce1ee58e670f9c3fce46c40296ba9ee8a2Ian Hodson *) lib_linked=no ;; 6869f4c12fce1ee58e670f9c3fce46c40296ba9ee8a2Ian Hodson esac 6870f4c12fce1ee58e670f9c3fce46c40296ba9ee8a2Ian Hodson 6871f4c12fce1ee58e670f9c3fce46c40296ba9ee8a2Ian Hodson if test "$lib_linked" != yes; then 6872f4c12fce1ee58e670f9c3fce46c40296ba9ee8a2Ian Hodson func_fatal_configuration "unsupported hardcode properties" 6873f4c12fce1ee58e670f9c3fce46c40296ba9ee8a2Ian Hodson fi 6874f4c12fce1ee58e670f9c3fce46c40296ba9ee8a2Ian Hodson 6875f4c12fce1ee58e670f9c3fce46c40296ba9ee8a2Ian Hodson if test -n "$add_shlibpath"; then 6876f4c12fce1ee58e670f9c3fce46c40296ba9ee8a2Ian Hodson case :$compile_shlibpath: in 6877f4c12fce1ee58e670f9c3fce46c40296ba9ee8a2Ian Hodson *":$add_shlibpath:"*) ;; 68785b6dc79427b8f7eeb6a7ff68034ab8548ce670eaAlexander Gutkin *) func_append compile_shlibpath "$add_shlibpath:" ;; 6879f4c12fce1ee58e670f9c3fce46c40296ba9ee8a2Ian Hodson esac 6880f4c12fce1ee58e670f9c3fce46c40296ba9ee8a2Ian Hodson fi 6881f4c12fce1ee58e670f9c3fce46c40296ba9ee8a2Ian Hodson if test "$linkmode" = prog; then 6882f4c12fce1ee58e670f9c3fce46c40296ba9ee8a2Ian Hodson test -n "$add_dir" && compile_deplibs="$add_dir $compile_deplibs" 6883f4c12fce1ee58e670f9c3fce46c40296ba9ee8a2Ian Hodson test -n "$add" && compile_deplibs="$add $compile_deplibs" 6884f4c12fce1ee58e670f9c3fce46c40296ba9ee8a2Ian Hodson else 6885f4c12fce1ee58e670f9c3fce46c40296ba9ee8a2Ian Hodson test -n "$add_dir" && deplibs="$add_dir $deplibs" 6886f4c12fce1ee58e670f9c3fce46c40296ba9ee8a2Ian Hodson test -n "$add" && deplibs="$add $deplibs" 6887f4c12fce1ee58e670f9c3fce46c40296ba9ee8a2Ian Hodson if test "$hardcode_direct" != yes && 6888f4c12fce1ee58e670f9c3fce46c40296ba9ee8a2Ian Hodson test "$hardcode_minus_L" != yes && 6889f4c12fce1ee58e670f9c3fce46c40296ba9ee8a2Ian Hodson test "$hardcode_shlibpath_var" = yes; then 6890f4c12fce1ee58e670f9c3fce46c40296ba9ee8a2Ian Hodson case :$finalize_shlibpath: in 6891f4c12fce1ee58e670f9c3fce46c40296ba9ee8a2Ian Hodson *":$libdir:"*) ;; 68925b6dc79427b8f7eeb6a7ff68034ab8548ce670eaAlexander Gutkin *) func_append finalize_shlibpath "$libdir:" ;; 6893f4c12fce1ee58e670f9c3fce46c40296ba9ee8a2Ian Hodson esac 6894f4c12fce1ee58e670f9c3fce46c40296ba9ee8a2Ian Hodson fi 6895f4c12fce1ee58e670f9c3fce46c40296ba9ee8a2Ian Hodson fi 6896f4c12fce1ee58e670f9c3fce46c40296ba9ee8a2Ian Hodson fi 6897f4c12fce1ee58e670f9c3fce46c40296ba9ee8a2Ian Hodson 68985b6dc79427b8f7eeb6a7ff68034ab8548ce670eaAlexander Gutkin if test "$linkmode" = prog || test "$opt_mode" = relink; then 6899f4c12fce1ee58e670f9c3fce46c40296ba9ee8a2Ian Hodson add_shlibpath= 6900f4c12fce1ee58e670f9c3fce46c40296ba9ee8a2Ian Hodson add_dir= 6901f4c12fce1ee58e670f9c3fce46c40296ba9ee8a2Ian Hodson add= 6902f4c12fce1ee58e670f9c3fce46c40296ba9ee8a2Ian Hodson # Finalize command for both is simple: just hardcode it. 6903f4c12fce1ee58e670f9c3fce46c40296ba9ee8a2Ian Hodson if test "$hardcode_direct" = yes && 6904f4c12fce1ee58e670f9c3fce46c40296ba9ee8a2Ian Hodson test "$hardcode_direct_absolute" = no; then 6905f4c12fce1ee58e670f9c3fce46c40296ba9ee8a2Ian Hodson add="$libdir/$linklib" 6906f4c12fce1ee58e670f9c3fce46c40296ba9ee8a2Ian Hodson elif test "$hardcode_minus_L" = yes; then 6907f4c12fce1ee58e670f9c3fce46c40296ba9ee8a2Ian Hodson add_dir="-L$libdir" 6908f4c12fce1ee58e670f9c3fce46c40296ba9ee8a2Ian Hodson add="-l$name" 6909f4c12fce1ee58e670f9c3fce46c40296ba9ee8a2Ian Hodson elif test "$hardcode_shlibpath_var" = yes; then 6910f4c12fce1ee58e670f9c3fce46c40296ba9ee8a2Ian Hodson case :$finalize_shlibpath: in 6911f4c12fce1ee58e670f9c3fce46c40296ba9ee8a2Ian Hodson *":$libdir:"*) ;; 69125b6dc79427b8f7eeb6a7ff68034ab8548ce670eaAlexander Gutkin *) func_append finalize_shlibpath "$libdir:" ;; 6913f4c12fce1ee58e670f9c3fce46c40296ba9ee8a2Ian Hodson esac 6914f4c12fce1ee58e670f9c3fce46c40296ba9ee8a2Ian Hodson add="-l$name" 6915f4c12fce1ee58e670f9c3fce46c40296ba9ee8a2Ian Hodson elif test "$hardcode_automatic" = yes; then 6916f4c12fce1ee58e670f9c3fce46c40296ba9ee8a2Ian Hodson if test -n "$inst_prefix_dir" && 6917f4c12fce1ee58e670f9c3fce46c40296ba9ee8a2Ian Hodson test -f "$inst_prefix_dir$libdir/$linklib" ; then 6918f4c12fce1ee58e670f9c3fce46c40296ba9ee8a2Ian Hodson add="$inst_prefix_dir$libdir/$linklib" 6919f4c12fce1ee58e670f9c3fce46c40296ba9ee8a2Ian Hodson else 6920f4c12fce1ee58e670f9c3fce46c40296ba9ee8a2Ian Hodson add="$libdir/$linklib" 6921f4c12fce1ee58e670f9c3fce46c40296ba9ee8a2Ian Hodson fi 6922f4c12fce1ee58e670f9c3fce46c40296ba9ee8a2Ian Hodson else 6923f4c12fce1ee58e670f9c3fce46c40296ba9ee8a2Ian Hodson # We cannot seem to hardcode it, guess we'll fake it. 6924f4c12fce1ee58e670f9c3fce46c40296ba9ee8a2Ian Hodson add_dir="-L$libdir" 6925f4c12fce1ee58e670f9c3fce46c40296ba9ee8a2Ian Hodson # Try looking first in the location we're being installed to. 6926f4c12fce1ee58e670f9c3fce46c40296ba9ee8a2Ian Hodson if test -n "$inst_prefix_dir"; then 6927f4c12fce1ee58e670f9c3fce46c40296ba9ee8a2Ian Hodson case $libdir in 6928f4c12fce1ee58e670f9c3fce46c40296ba9ee8a2Ian Hodson [\\/]*) 69295b6dc79427b8f7eeb6a7ff68034ab8548ce670eaAlexander Gutkin func_append add_dir " -L$inst_prefix_dir$libdir" 6930f4c12fce1ee58e670f9c3fce46c40296ba9ee8a2Ian Hodson ;; 6931f4c12fce1ee58e670f9c3fce46c40296ba9ee8a2Ian Hodson esac 6932f4c12fce1ee58e670f9c3fce46c40296ba9ee8a2Ian Hodson fi 6933f4c12fce1ee58e670f9c3fce46c40296ba9ee8a2Ian Hodson add="-l$name" 6934f4c12fce1ee58e670f9c3fce46c40296ba9ee8a2Ian Hodson fi 6935f4c12fce1ee58e670f9c3fce46c40296ba9ee8a2Ian Hodson 6936f4c12fce1ee58e670f9c3fce46c40296ba9ee8a2Ian Hodson if test "$linkmode" = prog; then 6937f4c12fce1ee58e670f9c3fce46c40296ba9ee8a2Ian Hodson test -n "$add_dir" && finalize_deplibs="$add_dir $finalize_deplibs" 6938f4c12fce1ee58e670f9c3fce46c40296ba9ee8a2Ian Hodson test -n "$add" && finalize_deplibs="$add $finalize_deplibs" 6939f4c12fce1ee58e670f9c3fce46c40296ba9ee8a2Ian Hodson else 6940f4c12fce1ee58e670f9c3fce46c40296ba9ee8a2Ian Hodson test -n "$add_dir" && deplibs="$add_dir $deplibs" 6941f4c12fce1ee58e670f9c3fce46c40296ba9ee8a2Ian Hodson test -n "$add" && deplibs="$add $deplibs" 6942f4c12fce1ee58e670f9c3fce46c40296ba9ee8a2Ian Hodson fi 6943f4c12fce1ee58e670f9c3fce46c40296ba9ee8a2Ian Hodson fi 6944f4c12fce1ee58e670f9c3fce46c40296ba9ee8a2Ian Hodson elif test "$linkmode" = prog; then 6945f4c12fce1ee58e670f9c3fce46c40296ba9ee8a2Ian Hodson # Here we assume that one of hardcode_direct or hardcode_minus_L 6946f4c12fce1ee58e670f9c3fce46c40296ba9ee8a2Ian Hodson # is not unsupported. This is valid on all known static and 6947f4c12fce1ee58e670f9c3fce46c40296ba9ee8a2Ian Hodson # shared platforms. 6948f4c12fce1ee58e670f9c3fce46c40296ba9ee8a2Ian Hodson if test "$hardcode_direct" != unsupported; then 6949f4c12fce1ee58e670f9c3fce46c40296ba9ee8a2Ian Hodson test -n "$old_library" && linklib="$old_library" 6950f4c12fce1ee58e670f9c3fce46c40296ba9ee8a2Ian Hodson compile_deplibs="$dir/$linklib $compile_deplibs" 6951f4c12fce1ee58e670f9c3fce46c40296ba9ee8a2Ian Hodson finalize_deplibs="$dir/$linklib $finalize_deplibs" 6952f4c12fce1ee58e670f9c3fce46c40296ba9ee8a2Ian Hodson else 6953f4c12fce1ee58e670f9c3fce46c40296ba9ee8a2Ian Hodson compile_deplibs="-l$name -L$dir $compile_deplibs" 6954f4c12fce1ee58e670f9c3fce46c40296ba9ee8a2Ian Hodson finalize_deplibs="-l$name -L$dir $finalize_deplibs" 6955f4c12fce1ee58e670f9c3fce46c40296ba9ee8a2Ian Hodson fi 6956f4c12fce1ee58e670f9c3fce46c40296ba9ee8a2Ian Hodson elif test "$build_libtool_libs" = yes; then 6957f4c12fce1ee58e670f9c3fce46c40296ba9ee8a2Ian Hodson # Not a shared library 6958f4c12fce1ee58e670f9c3fce46c40296ba9ee8a2Ian Hodson if test "$deplibs_check_method" != pass_all; then 6959f4c12fce1ee58e670f9c3fce46c40296ba9ee8a2Ian Hodson # We're trying link a shared library against a static one 6960f4c12fce1ee58e670f9c3fce46c40296ba9ee8a2Ian Hodson # but the system doesn't support it. 6961f4c12fce1ee58e670f9c3fce46c40296ba9ee8a2Ian Hodson 6962f4c12fce1ee58e670f9c3fce46c40296ba9ee8a2Ian Hodson # Just print a warning and add the library to dependency_libs so 6963f4c12fce1ee58e670f9c3fce46c40296ba9ee8a2Ian Hodson # that the program can be linked against the static library. 69645b6dc79427b8f7eeb6a7ff68034ab8548ce670eaAlexander Gutkin echo 6965f4c12fce1ee58e670f9c3fce46c40296ba9ee8a2Ian Hodson $ECHO "*** Warning: This system can not link to static lib archive $lib." 69665b6dc79427b8f7eeb6a7ff68034ab8548ce670eaAlexander Gutkin echo "*** I have the capability to make that library automatically link in when" 69675b6dc79427b8f7eeb6a7ff68034ab8548ce670eaAlexander Gutkin echo "*** you link to this library. But I can only do this if you have a" 69685b6dc79427b8f7eeb6a7ff68034ab8548ce670eaAlexander Gutkin echo "*** shared version of the library, which you do not appear to have." 6969f4c12fce1ee58e670f9c3fce46c40296ba9ee8a2Ian Hodson if test "$module" = yes; then 69705b6dc79427b8f7eeb6a7ff68034ab8548ce670eaAlexander Gutkin echo "*** But as you try to build a module library, libtool will still create " 69715b6dc79427b8f7eeb6a7ff68034ab8548ce670eaAlexander Gutkin echo "*** a static module, that should work as long as the dlopening application" 69725b6dc79427b8f7eeb6a7ff68034ab8548ce670eaAlexander Gutkin echo "*** is linked with the -dlopen flag to resolve symbols at runtime." 6973f4c12fce1ee58e670f9c3fce46c40296ba9ee8a2Ian Hodson if test -z "$global_symbol_pipe"; then 69745b6dc79427b8f7eeb6a7ff68034ab8548ce670eaAlexander Gutkin echo 69755b6dc79427b8f7eeb6a7ff68034ab8548ce670eaAlexander Gutkin echo "*** However, this would only work if libtool was able to extract symbol" 69765b6dc79427b8f7eeb6a7ff68034ab8548ce670eaAlexander Gutkin echo "*** lists from a program, using \`nm' or equivalent, but libtool could" 69775b6dc79427b8f7eeb6a7ff68034ab8548ce670eaAlexander Gutkin echo "*** not find such a program. So, this module is probably useless." 69785b6dc79427b8f7eeb6a7ff68034ab8548ce670eaAlexander Gutkin echo "*** \`nm' from GNU binutils and a full rebuild may help." 6979f4c12fce1ee58e670f9c3fce46c40296ba9ee8a2Ian Hodson fi 6980f4c12fce1ee58e670f9c3fce46c40296ba9ee8a2Ian Hodson if test "$build_old_libs" = no; then 6981f4c12fce1ee58e670f9c3fce46c40296ba9ee8a2Ian Hodson build_libtool_libs=module 6982f4c12fce1ee58e670f9c3fce46c40296ba9ee8a2Ian Hodson build_old_libs=yes 6983f4c12fce1ee58e670f9c3fce46c40296ba9ee8a2Ian Hodson else 6984f4c12fce1ee58e670f9c3fce46c40296ba9ee8a2Ian Hodson build_libtool_libs=no 6985f4c12fce1ee58e670f9c3fce46c40296ba9ee8a2Ian Hodson fi 6986f4c12fce1ee58e670f9c3fce46c40296ba9ee8a2Ian Hodson fi 6987f4c12fce1ee58e670f9c3fce46c40296ba9ee8a2Ian Hodson else 6988f4c12fce1ee58e670f9c3fce46c40296ba9ee8a2Ian Hodson deplibs="$dir/$old_library $deplibs" 6989f4c12fce1ee58e670f9c3fce46c40296ba9ee8a2Ian Hodson link_static=yes 6990f4c12fce1ee58e670f9c3fce46c40296ba9ee8a2Ian Hodson fi 6991f4c12fce1ee58e670f9c3fce46c40296ba9ee8a2Ian Hodson fi # link shared/static library? 6992f4c12fce1ee58e670f9c3fce46c40296ba9ee8a2Ian Hodson 6993f4c12fce1ee58e670f9c3fce46c40296ba9ee8a2Ian Hodson if test "$linkmode" = lib; then 6994f4c12fce1ee58e670f9c3fce46c40296ba9ee8a2Ian Hodson if test -n "$dependency_libs" && 6995f4c12fce1ee58e670f9c3fce46c40296ba9ee8a2Ian Hodson { test "$hardcode_into_libs" != yes || 6996f4c12fce1ee58e670f9c3fce46c40296ba9ee8a2Ian Hodson test "$build_old_libs" = yes || 6997f4c12fce1ee58e670f9c3fce46c40296ba9ee8a2Ian Hodson test "$link_static" = yes; }; then 6998f4c12fce1ee58e670f9c3fce46c40296ba9ee8a2Ian Hodson # Extract -R from dependency_libs 6999f4c12fce1ee58e670f9c3fce46c40296ba9ee8a2Ian Hodson temp_deplibs= 7000f4c12fce1ee58e670f9c3fce46c40296ba9ee8a2Ian Hodson for libdir in $dependency_libs; do 7001f4c12fce1ee58e670f9c3fce46c40296ba9ee8a2Ian Hodson case $libdir in 7002f4c12fce1ee58e670f9c3fce46c40296ba9ee8a2Ian Hodson -R*) func_stripname '-R' '' "$libdir" 7003f4c12fce1ee58e670f9c3fce46c40296ba9ee8a2Ian Hodson temp_xrpath=$func_stripname_result 7004f4c12fce1ee58e670f9c3fce46c40296ba9ee8a2Ian Hodson case " $xrpath " in 7005f4c12fce1ee58e670f9c3fce46c40296ba9ee8a2Ian Hodson *" $temp_xrpath "*) ;; 70065b6dc79427b8f7eeb6a7ff68034ab8548ce670eaAlexander Gutkin *) func_append xrpath " $temp_xrpath";; 7007f4c12fce1ee58e670f9c3fce46c40296ba9ee8a2Ian Hodson esac;; 70085b6dc79427b8f7eeb6a7ff68034ab8548ce670eaAlexander Gutkin *) func_append temp_deplibs " $libdir";; 7009f4c12fce1ee58e670f9c3fce46c40296ba9ee8a2Ian Hodson esac 7010f4c12fce1ee58e670f9c3fce46c40296ba9ee8a2Ian Hodson done 7011f4c12fce1ee58e670f9c3fce46c40296ba9ee8a2Ian Hodson dependency_libs="$temp_deplibs" 7012f4c12fce1ee58e670f9c3fce46c40296ba9ee8a2Ian Hodson fi 7013f4c12fce1ee58e670f9c3fce46c40296ba9ee8a2Ian Hodson 70145b6dc79427b8f7eeb6a7ff68034ab8548ce670eaAlexander Gutkin func_append newlib_search_path " $absdir" 7015f4c12fce1ee58e670f9c3fce46c40296ba9ee8a2Ian Hodson # Link against this library 7016f4c12fce1ee58e670f9c3fce46c40296ba9ee8a2Ian Hodson test "$link_static" = no && newdependency_libs="$abs_ladir/$laname $newdependency_libs" 7017f4c12fce1ee58e670f9c3fce46c40296ba9ee8a2Ian Hodson # ... and its dependency_libs 7018f4c12fce1ee58e670f9c3fce46c40296ba9ee8a2Ian Hodson tmp_libs= 7019f4c12fce1ee58e670f9c3fce46c40296ba9ee8a2Ian Hodson for deplib in $dependency_libs; do 7020f4c12fce1ee58e670f9c3fce46c40296ba9ee8a2Ian Hodson newdependency_libs="$deplib $newdependency_libs" 70215b6dc79427b8f7eeb6a7ff68034ab8548ce670eaAlexander Gutkin case $deplib in 70225b6dc79427b8f7eeb6a7ff68034ab8548ce670eaAlexander Gutkin -L*) func_stripname '-L' '' "$deplib" 70235b6dc79427b8f7eeb6a7ff68034ab8548ce670eaAlexander Gutkin func_resolve_sysroot "$func_stripname_result";; 70245b6dc79427b8f7eeb6a7ff68034ab8548ce670eaAlexander Gutkin *) func_resolve_sysroot "$deplib" ;; 70255b6dc79427b8f7eeb6a7ff68034ab8548ce670eaAlexander Gutkin esac 70265b6dc79427b8f7eeb6a7ff68034ab8548ce670eaAlexander Gutkin if $opt_preserve_dup_deps ; then 7027f4c12fce1ee58e670f9c3fce46c40296ba9ee8a2Ian Hodson case "$tmp_libs " in 70285b6dc79427b8f7eeb6a7ff68034ab8548ce670eaAlexander Gutkin *" $func_resolve_sysroot_result "*) 70295b6dc79427b8f7eeb6a7ff68034ab8548ce670eaAlexander Gutkin func_append specialdeplibs " $func_resolve_sysroot_result" ;; 7030f4c12fce1ee58e670f9c3fce46c40296ba9ee8a2Ian Hodson esac 7031f4c12fce1ee58e670f9c3fce46c40296ba9ee8a2Ian Hodson fi 70325b6dc79427b8f7eeb6a7ff68034ab8548ce670eaAlexander Gutkin func_append tmp_libs " $func_resolve_sysroot_result" 7033f4c12fce1ee58e670f9c3fce46c40296ba9ee8a2Ian Hodson done 7034f4c12fce1ee58e670f9c3fce46c40296ba9ee8a2Ian Hodson 7035f4c12fce1ee58e670f9c3fce46c40296ba9ee8a2Ian Hodson if test "$link_all_deplibs" != no; then 7036f4c12fce1ee58e670f9c3fce46c40296ba9ee8a2Ian Hodson # Add the search paths of all dependency libraries 7037f4c12fce1ee58e670f9c3fce46c40296ba9ee8a2Ian Hodson for deplib in $dependency_libs; do 7038f4c12fce1ee58e670f9c3fce46c40296ba9ee8a2Ian Hodson path= 7039f4c12fce1ee58e670f9c3fce46c40296ba9ee8a2Ian Hodson case $deplib in 7040f4c12fce1ee58e670f9c3fce46c40296ba9ee8a2Ian Hodson -L*) path="$deplib" ;; 7041f4c12fce1ee58e670f9c3fce46c40296ba9ee8a2Ian Hodson *.la) 70425b6dc79427b8f7eeb6a7ff68034ab8548ce670eaAlexander Gutkin func_resolve_sysroot "$deplib" 70435b6dc79427b8f7eeb6a7ff68034ab8548ce670eaAlexander Gutkin deplib=$func_resolve_sysroot_result 7044f4c12fce1ee58e670f9c3fce46c40296ba9ee8a2Ian Hodson func_dirname "$deplib" "" "." 70455b6dc79427b8f7eeb6a7ff68034ab8548ce670eaAlexander Gutkin dir=$func_dirname_result 7046f4c12fce1ee58e670f9c3fce46c40296ba9ee8a2Ian Hodson # We need an absolute path. 7047f4c12fce1ee58e670f9c3fce46c40296ba9ee8a2Ian Hodson case $dir in 7048f4c12fce1ee58e670f9c3fce46c40296ba9ee8a2Ian Hodson [\\/]* | [A-Za-z]:[\\/]*) absdir="$dir" ;; 7049f4c12fce1ee58e670f9c3fce46c40296ba9ee8a2Ian Hodson *) 7050f4c12fce1ee58e670f9c3fce46c40296ba9ee8a2Ian Hodson absdir=`cd "$dir" && pwd` 7051f4c12fce1ee58e670f9c3fce46c40296ba9ee8a2Ian Hodson if test -z "$absdir"; then 7052f4c12fce1ee58e670f9c3fce46c40296ba9ee8a2Ian Hodson func_warning "cannot determine absolute directory name of \`$dir'" 7053f4c12fce1ee58e670f9c3fce46c40296ba9ee8a2Ian Hodson absdir="$dir" 7054f4c12fce1ee58e670f9c3fce46c40296ba9ee8a2Ian Hodson fi 7055f4c12fce1ee58e670f9c3fce46c40296ba9ee8a2Ian Hodson ;; 7056f4c12fce1ee58e670f9c3fce46c40296ba9ee8a2Ian Hodson esac 7057f4c12fce1ee58e670f9c3fce46c40296ba9ee8a2Ian Hodson if $GREP "^installed=no" $deplib > /dev/null; then 7058f4c12fce1ee58e670f9c3fce46c40296ba9ee8a2Ian Hodson case $host in 7059f4c12fce1ee58e670f9c3fce46c40296ba9ee8a2Ian Hodson *-*-darwin*) 7060f4c12fce1ee58e670f9c3fce46c40296ba9ee8a2Ian Hodson depdepl= 7061f4c12fce1ee58e670f9c3fce46c40296ba9ee8a2Ian Hodson eval deplibrary_names=`${SED} -n -e 's/^library_names=\(.*\)$/\1/p' $deplib` 7062f4c12fce1ee58e670f9c3fce46c40296ba9ee8a2Ian Hodson if test -n "$deplibrary_names" ; then 7063f4c12fce1ee58e670f9c3fce46c40296ba9ee8a2Ian Hodson for tmp in $deplibrary_names ; do 7064f4c12fce1ee58e670f9c3fce46c40296ba9ee8a2Ian Hodson depdepl=$tmp 7065f4c12fce1ee58e670f9c3fce46c40296ba9ee8a2Ian Hodson done 7066f4c12fce1ee58e670f9c3fce46c40296ba9ee8a2Ian Hodson if test -f "$absdir/$objdir/$depdepl" ; then 7067f4c12fce1ee58e670f9c3fce46c40296ba9ee8a2Ian Hodson depdepl="$absdir/$objdir/$depdepl" 7068f4c12fce1ee58e670f9c3fce46c40296ba9ee8a2Ian Hodson darwin_install_name=`${OTOOL} -L $depdepl | awk '{if (NR == 2) {print $1;exit}}'` 7069f4c12fce1ee58e670f9c3fce46c40296ba9ee8a2Ian Hodson if test -z "$darwin_install_name"; then 7070f4c12fce1ee58e670f9c3fce46c40296ba9ee8a2Ian Hodson darwin_install_name=`${OTOOL64} -L $depdepl | awk '{if (NR == 2) {print $1;exit}}'` 7071f4c12fce1ee58e670f9c3fce46c40296ba9ee8a2Ian Hodson fi 70725b6dc79427b8f7eeb6a7ff68034ab8548ce670eaAlexander Gutkin func_append compiler_flags " ${wl}-dylib_file ${wl}${darwin_install_name}:${depdepl}" 70735b6dc79427b8f7eeb6a7ff68034ab8548ce670eaAlexander Gutkin func_append linker_flags " -dylib_file ${darwin_install_name}:${depdepl}" 7074f4c12fce1ee58e670f9c3fce46c40296ba9ee8a2Ian Hodson path= 7075f4c12fce1ee58e670f9c3fce46c40296ba9ee8a2Ian Hodson fi 7076f4c12fce1ee58e670f9c3fce46c40296ba9ee8a2Ian Hodson fi 7077f4c12fce1ee58e670f9c3fce46c40296ba9ee8a2Ian Hodson ;; 7078f4c12fce1ee58e670f9c3fce46c40296ba9ee8a2Ian Hodson *) 7079f4c12fce1ee58e670f9c3fce46c40296ba9ee8a2Ian Hodson path="-L$absdir/$objdir" 7080f4c12fce1ee58e670f9c3fce46c40296ba9ee8a2Ian Hodson ;; 7081f4c12fce1ee58e670f9c3fce46c40296ba9ee8a2Ian Hodson esac 7082f4c12fce1ee58e670f9c3fce46c40296ba9ee8a2Ian Hodson else 7083f4c12fce1ee58e670f9c3fce46c40296ba9ee8a2Ian Hodson eval libdir=`${SED} -n -e 's/^libdir=\(.*\)$/\1/p' $deplib` 7084f4c12fce1ee58e670f9c3fce46c40296ba9ee8a2Ian Hodson test -z "$libdir" && \ 7085f4c12fce1ee58e670f9c3fce46c40296ba9ee8a2Ian Hodson func_fatal_error "\`$deplib' is not a valid libtool archive" 7086f4c12fce1ee58e670f9c3fce46c40296ba9ee8a2Ian Hodson test "$absdir" != "$libdir" && \ 7087f4c12fce1ee58e670f9c3fce46c40296ba9ee8a2Ian Hodson func_warning "\`$deplib' seems to be moved" 7088f4c12fce1ee58e670f9c3fce46c40296ba9ee8a2Ian Hodson 7089f4c12fce1ee58e670f9c3fce46c40296ba9ee8a2Ian Hodson path="-L$absdir" 7090f4c12fce1ee58e670f9c3fce46c40296ba9ee8a2Ian Hodson fi 7091f4c12fce1ee58e670f9c3fce46c40296ba9ee8a2Ian Hodson ;; 7092f4c12fce1ee58e670f9c3fce46c40296ba9ee8a2Ian Hodson esac 7093f4c12fce1ee58e670f9c3fce46c40296ba9ee8a2Ian Hodson case " $deplibs " in 7094f4c12fce1ee58e670f9c3fce46c40296ba9ee8a2Ian Hodson *" $path "*) ;; 7095f4c12fce1ee58e670f9c3fce46c40296ba9ee8a2Ian Hodson *) deplibs="$path $deplibs" ;; 7096f4c12fce1ee58e670f9c3fce46c40296ba9ee8a2Ian Hodson esac 7097f4c12fce1ee58e670f9c3fce46c40296ba9ee8a2Ian Hodson done 7098f4c12fce1ee58e670f9c3fce46c40296ba9ee8a2Ian Hodson fi # link_all_deplibs != no 7099f4c12fce1ee58e670f9c3fce46c40296ba9ee8a2Ian Hodson fi # linkmode = lib 7100f4c12fce1ee58e670f9c3fce46c40296ba9ee8a2Ian Hodson done # for deplib in $libs 7101f4c12fce1ee58e670f9c3fce46c40296ba9ee8a2Ian Hodson if test "$pass" = link; then 7102f4c12fce1ee58e670f9c3fce46c40296ba9ee8a2Ian Hodson if test "$linkmode" = "prog"; then 7103f4c12fce1ee58e670f9c3fce46c40296ba9ee8a2Ian Hodson compile_deplibs="$new_inherited_linker_flags $compile_deplibs" 7104f4c12fce1ee58e670f9c3fce46c40296ba9ee8a2Ian Hodson finalize_deplibs="$new_inherited_linker_flags $finalize_deplibs" 7105f4c12fce1ee58e670f9c3fce46c40296ba9ee8a2Ian Hodson else 71065b6dc79427b8f7eeb6a7ff68034ab8548ce670eaAlexander Gutkin compiler_flags="$compiler_flags "`$ECHO " $new_inherited_linker_flags" | $SED 's% \([^ $]*\).ltframework% -framework \1%g'` 7107f4c12fce1ee58e670f9c3fce46c40296ba9ee8a2Ian Hodson fi 7108f4c12fce1ee58e670f9c3fce46c40296ba9ee8a2Ian Hodson fi 7109f4c12fce1ee58e670f9c3fce46c40296ba9ee8a2Ian Hodson dependency_libs="$newdependency_libs" 7110f4c12fce1ee58e670f9c3fce46c40296ba9ee8a2Ian Hodson if test "$pass" = dlpreopen; then 7111f4c12fce1ee58e670f9c3fce46c40296ba9ee8a2Ian Hodson # Link the dlpreopened libraries before other libraries 7112f4c12fce1ee58e670f9c3fce46c40296ba9ee8a2Ian Hodson for deplib in $save_deplibs; do 7113f4c12fce1ee58e670f9c3fce46c40296ba9ee8a2Ian Hodson deplibs="$deplib $deplibs" 7114f4c12fce1ee58e670f9c3fce46c40296ba9ee8a2Ian Hodson done 7115f4c12fce1ee58e670f9c3fce46c40296ba9ee8a2Ian Hodson fi 7116f4c12fce1ee58e670f9c3fce46c40296ba9ee8a2Ian Hodson if test "$pass" != dlopen; then 7117f4c12fce1ee58e670f9c3fce46c40296ba9ee8a2Ian Hodson if test "$pass" != conv; then 7118f4c12fce1ee58e670f9c3fce46c40296ba9ee8a2Ian Hodson # Make sure lib_search_path contains only unique directories. 7119f4c12fce1ee58e670f9c3fce46c40296ba9ee8a2Ian Hodson lib_search_path= 7120f4c12fce1ee58e670f9c3fce46c40296ba9ee8a2Ian Hodson for dir in $newlib_search_path; do 7121f4c12fce1ee58e670f9c3fce46c40296ba9ee8a2Ian Hodson case "$lib_search_path " in 7122f4c12fce1ee58e670f9c3fce46c40296ba9ee8a2Ian Hodson *" $dir "*) ;; 71235b6dc79427b8f7eeb6a7ff68034ab8548ce670eaAlexander Gutkin *) func_append lib_search_path " $dir" ;; 7124f4c12fce1ee58e670f9c3fce46c40296ba9ee8a2Ian Hodson esac 7125f4c12fce1ee58e670f9c3fce46c40296ba9ee8a2Ian Hodson done 7126f4c12fce1ee58e670f9c3fce46c40296ba9ee8a2Ian Hodson newlib_search_path= 7127f4c12fce1ee58e670f9c3fce46c40296ba9ee8a2Ian Hodson fi 7128f4c12fce1ee58e670f9c3fce46c40296ba9ee8a2Ian Hodson 7129f4c12fce1ee58e670f9c3fce46c40296ba9ee8a2Ian Hodson if test "$linkmode,$pass" != "prog,link"; then 7130f4c12fce1ee58e670f9c3fce46c40296ba9ee8a2Ian Hodson vars="deplibs" 7131f4c12fce1ee58e670f9c3fce46c40296ba9ee8a2Ian Hodson else 7132f4c12fce1ee58e670f9c3fce46c40296ba9ee8a2Ian Hodson vars="compile_deplibs finalize_deplibs" 7133f4c12fce1ee58e670f9c3fce46c40296ba9ee8a2Ian Hodson fi 7134f4c12fce1ee58e670f9c3fce46c40296ba9ee8a2Ian Hodson for var in $vars dependency_libs; do 7135f4c12fce1ee58e670f9c3fce46c40296ba9ee8a2Ian Hodson # Add libraries to $var in reverse order 7136f4c12fce1ee58e670f9c3fce46c40296ba9ee8a2Ian Hodson eval tmp_libs=\"\$$var\" 7137f4c12fce1ee58e670f9c3fce46c40296ba9ee8a2Ian Hodson new_libs= 7138f4c12fce1ee58e670f9c3fce46c40296ba9ee8a2Ian Hodson for deplib in $tmp_libs; do 7139f4c12fce1ee58e670f9c3fce46c40296ba9ee8a2Ian Hodson # FIXME: Pedantically, this is the right thing to do, so 7140f4c12fce1ee58e670f9c3fce46c40296ba9ee8a2Ian Hodson # that some nasty dependency loop isn't accidentally 7141f4c12fce1ee58e670f9c3fce46c40296ba9ee8a2Ian Hodson # broken: 7142f4c12fce1ee58e670f9c3fce46c40296ba9ee8a2Ian Hodson #new_libs="$deplib $new_libs" 7143f4c12fce1ee58e670f9c3fce46c40296ba9ee8a2Ian Hodson # Pragmatically, this seems to cause very few problems in 7144f4c12fce1ee58e670f9c3fce46c40296ba9ee8a2Ian Hodson # practice: 7145f4c12fce1ee58e670f9c3fce46c40296ba9ee8a2Ian Hodson case $deplib in 7146f4c12fce1ee58e670f9c3fce46c40296ba9ee8a2Ian Hodson -L*) new_libs="$deplib $new_libs" ;; 7147f4c12fce1ee58e670f9c3fce46c40296ba9ee8a2Ian Hodson -R*) ;; 7148f4c12fce1ee58e670f9c3fce46c40296ba9ee8a2Ian Hodson *) 7149f4c12fce1ee58e670f9c3fce46c40296ba9ee8a2Ian Hodson # And here is the reason: when a library appears more 7150f4c12fce1ee58e670f9c3fce46c40296ba9ee8a2Ian Hodson # than once as an explicit dependence of a library, or 7151f4c12fce1ee58e670f9c3fce46c40296ba9ee8a2Ian Hodson # is implicitly linked in more than once by the 7152f4c12fce1ee58e670f9c3fce46c40296ba9ee8a2Ian Hodson # compiler, it is considered special, and multiple 7153f4c12fce1ee58e670f9c3fce46c40296ba9ee8a2Ian Hodson # occurrences thereof are not removed. Compare this 7154f4c12fce1ee58e670f9c3fce46c40296ba9ee8a2Ian Hodson # with having the same library being listed as a 7155f4c12fce1ee58e670f9c3fce46c40296ba9ee8a2Ian Hodson # dependency of multiple other libraries: in this case, 7156f4c12fce1ee58e670f9c3fce46c40296ba9ee8a2Ian Hodson # we know (pedantically, we assume) the library does not 7157f4c12fce1ee58e670f9c3fce46c40296ba9ee8a2Ian Hodson # need to be listed more than once, so we keep only the 7158f4c12fce1ee58e670f9c3fce46c40296ba9ee8a2Ian Hodson # last copy. This is not always right, but it is rare 7159f4c12fce1ee58e670f9c3fce46c40296ba9ee8a2Ian Hodson # enough that we require users that really mean to play 7160f4c12fce1ee58e670f9c3fce46c40296ba9ee8a2Ian Hodson # such unportable linking tricks to link the library 7161f4c12fce1ee58e670f9c3fce46c40296ba9ee8a2Ian Hodson # using -Wl,-lname, so that libtool does not consider it 7162f4c12fce1ee58e670f9c3fce46c40296ba9ee8a2Ian Hodson # for duplicate removal. 7163f4c12fce1ee58e670f9c3fce46c40296ba9ee8a2Ian Hodson case " $specialdeplibs " in 7164f4c12fce1ee58e670f9c3fce46c40296ba9ee8a2Ian Hodson *" $deplib "*) new_libs="$deplib $new_libs" ;; 7165f4c12fce1ee58e670f9c3fce46c40296ba9ee8a2Ian Hodson *) 7166f4c12fce1ee58e670f9c3fce46c40296ba9ee8a2Ian Hodson case " $new_libs " in 7167f4c12fce1ee58e670f9c3fce46c40296ba9ee8a2Ian Hodson *" $deplib "*) ;; 7168f4c12fce1ee58e670f9c3fce46c40296ba9ee8a2Ian Hodson *) new_libs="$deplib $new_libs" ;; 7169f4c12fce1ee58e670f9c3fce46c40296ba9ee8a2Ian Hodson esac 7170f4c12fce1ee58e670f9c3fce46c40296ba9ee8a2Ian Hodson ;; 7171f4c12fce1ee58e670f9c3fce46c40296ba9ee8a2Ian Hodson esac 7172f4c12fce1ee58e670f9c3fce46c40296ba9ee8a2Ian Hodson ;; 7173f4c12fce1ee58e670f9c3fce46c40296ba9ee8a2Ian Hodson esac 7174f4c12fce1ee58e670f9c3fce46c40296ba9ee8a2Ian Hodson done 7175f4c12fce1ee58e670f9c3fce46c40296ba9ee8a2Ian Hodson tmp_libs= 7176f4c12fce1ee58e670f9c3fce46c40296ba9ee8a2Ian Hodson for deplib in $new_libs; do 7177f4c12fce1ee58e670f9c3fce46c40296ba9ee8a2Ian Hodson case $deplib in 7178f4c12fce1ee58e670f9c3fce46c40296ba9ee8a2Ian Hodson -L*) 7179f4c12fce1ee58e670f9c3fce46c40296ba9ee8a2Ian Hodson case " $tmp_libs " in 7180f4c12fce1ee58e670f9c3fce46c40296ba9ee8a2Ian Hodson *" $deplib "*) ;; 71815b6dc79427b8f7eeb6a7ff68034ab8548ce670eaAlexander Gutkin *) func_append tmp_libs " $deplib" ;; 7182f4c12fce1ee58e670f9c3fce46c40296ba9ee8a2Ian Hodson esac 7183f4c12fce1ee58e670f9c3fce46c40296ba9ee8a2Ian Hodson ;; 71845b6dc79427b8f7eeb6a7ff68034ab8548ce670eaAlexander Gutkin *) func_append tmp_libs " $deplib" ;; 7185f4c12fce1ee58e670f9c3fce46c40296ba9ee8a2Ian Hodson esac 7186f4c12fce1ee58e670f9c3fce46c40296ba9ee8a2Ian Hodson done 7187f4c12fce1ee58e670f9c3fce46c40296ba9ee8a2Ian Hodson eval $var=\"$tmp_libs\" 7188f4c12fce1ee58e670f9c3fce46c40296ba9ee8a2Ian Hodson done # for var 7189f4c12fce1ee58e670f9c3fce46c40296ba9ee8a2Ian Hodson fi 7190f4c12fce1ee58e670f9c3fce46c40296ba9ee8a2Ian Hodson # Last step: remove runtime libs from dependency_libs 7191f4c12fce1ee58e670f9c3fce46c40296ba9ee8a2Ian Hodson # (they stay in deplibs) 7192f4c12fce1ee58e670f9c3fce46c40296ba9ee8a2Ian Hodson tmp_libs= 7193f4c12fce1ee58e670f9c3fce46c40296ba9ee8a2Ian Hodson for i in $dependency_libs ; do 7194f4c12fce1ee58e670f9c3fce46c40296ba9ee8a2Ian Hodson case " $predeps $postdeps $compiler_lib_search_path " in 7195f4c12fce1ee58e670f9c3fce46c40296ba9ee8a2Ian Hodson *" $i "*) 7196f4c12fce1ee58e670f9c3fce46c40296ba9ee8a2Ian Hodson i="" 7197f4c12fce1ee58e670f9c3fce46c40296ba9ee8a2Ian Hodson ;; 7198f4c12fce1ee58e670f9c3fce46c40296ba9ee8a2Ian Hodson esac 7199f4c12fce1ee58e670f9c3fce46c40296ba9ee8a2Ian Hodson if test -n "$i" ; then 72005b6dc79427b8f7eeb6a7ff68034ab8548ce670eaAlexander Gutkin func_append tmp_libs " $i" 7201f4c12fce1ee58e670f9c3fce46c40296ba9ee8a2Ian Hodson fi 7202f4c12fce1ee58e670f9c3fce46c40296ba9ee8a2Ian Hodson done 7203f4c12fce1ee58e670f9c3fce46c40296ba9ee8a2Ian Hodson dependency_libs=$tmp_libs 7204f4c12fce1ee58e670f9c3fce46c40296ba9ee8a2Ian Hodson done # for pass 7205f4c12fce1ee58e670f9c3fce46c40296ba9ee8a2Ian Hodson if test "$linkmode" = prog; then 7206f4c12fce1ee58e670f9c3fce46c40296ba9ee8a2Ian Hodson dlfiles="$newdlfiles" 7207f4c12fce1ee58e670f9c3fce46c40296ba9ee8a2Ian Hodson fi 7208f4c12fce1ee58e670f9c3fce46c40296ba9ee8a2Ian Hodson if test "$linkmode" = prog || test "$linkmode" = lib; then 7209f4c12fce1ee58e670f9c3fce46c40296ba9ee8a2Ian Hodson dlprefiles="$newdlprefiles" 7210f4c12fce1ee58e670f9c3fce46c40296ba9ee8a2Ian Hodson fi 7211f4c12fce1ee58e670f9c3fce46c40296ba9ee8a2Ian Hodson 7212f4c12fce1ee58e670f9c3fce46c40296ba9ee8a2Ian Hodson case $linkmode in 7213f4c12fce1ee58e670f9c3fce46c40296ba9ee8a2Ian Hodson oldlib) 7214f4c12fce1ee58e670f9c3fce46c40296ba9ee8a2Ian Hodson if test -n "$dlfiles$dlprefiles" || test "$dlself" != no; then 7215f4c12fce1ee58e670f9c3fce46c40296ba9ee8a2Ian Hodson func_warning "\`-dlopen' is ignored for archives" 7216f4c12fce1ee58e670f9c3fce46c40296ba9ee8a2Ian Hodson fi 7217f4c12fce1ee58e670f9c3fce46c40296ba9ee8a2Ian Hodson 7218f4c12fce1ee58e670f9c3fce46c40296ba9ee8a2Ian Hodson case " $deplibs" in 7219f4c12fce1ee58e670f9c3fce46c40296ba9ee8a2Ian Hodson *\ -l* | *\ -L*) 7220f4c12fce1ee58e670f9c3fce46c40296ba9ee8a2Ian Hodson func_warning "\`-l' and \`-L' are ignored for archives" ;; 7221f4c12fce1ee58e670f9c3fce46c40296ba9ee8a2Ian Hodson esac 7222f4c12fce1ee58e670f9c3fce46c40296ba9ee8a2Ian Hodson 7223f4c12fce1ee58e670f9c3fce46c40296ba9ee8a2Ian Hodson test -n "$rpath" && \ 7224f4c12fce1ee58e670f9c3fce46c40296ba9ee8a2Ian Hodson func_warning "\`-rpath' is ignored for archives" 7225f4c12fce1ee58e670f9c3fce46c40296ba9ee8a2Ian Hodson 7226f4c12fce1ee58e670f9c3fce46c40296ba9ee8a2Ian Hodson test -n "$xrpath" && \ 7227f4c12fce1ee58e670f9c3fce46c40296ba9ee8a2Ian Hodson func_warning "\`-R' is ignored for archives" 7228f4c12fce1ee58e670f9c3fce46c40296ba9ee8a2Ian Hodson 7229f4c12fce1ee58e670f9c3fce46c40296ba9ee8a2Ian Hodson test -n "$vinfo" && \ 7230f4c12fce1ee58e670f9c3fce46c40296ba9ee8a2Ian Hodson func_warning "\`-version-info/-version-number' is ignored for archives" 7231f4c12fce1ee58e670f9c3fce46c40296ba9ee8a2Ian Hodson 7232f4c12fce1ee58e670f9c3fce46c40296ba9ee8a2Ian Hodson test -n "$release" && \ 7233f4c12fce1ee58e670f9c3fce46c40296ba9ee8a2Ian Hodson func_warning "\`-release' is ignored for archives" 7234f4c12fce1ee58e670f9c3fce46c40296ba9ee8a2Ian Hodson 7235f4c12fce1ee58e670f9c3fce46c40296ba9ee8a2Ian Hodson test -n "$export_symbols$export_symbols_regex" && \ 7236f4c12fce1ee58e670f9c3fce46c40296ba9ee8a2Ian Hodson func_warning "\`-export-symbols' is ignored for archives" 7237f4c12fce1ee58e670f9c3fce46c40296ba9ee8a2Ian Hodson 7238f4c12fce1ee58e670f9c3fce46c40296ba9ee8a2Ian Hodson # Now set the variables for building old libraries. 7239f4c12fce1ee58e670f9c3fce46c40296ba9ee8a2Ian Hodson build_libtool_libs=no 7240f4c12fce1ee58e670f9c3fce46c40296ba9ee8a2Ian Hodson oldlibs="$output" 72415b6dc79427b8f7eeb6a7ff68034ab8548ce670eaAlexander Gutkin func_append objs "$old_deplibs" 7242f4c12fce1ee58e670f9c3fce46c40296ba9ee8a2Ian Hodson ;; 7243f4c12fce1ee58e670f9c3fce46c40296ba9ee8a2Ian Hodson 7244f4c12fce1ee58e670f9c3fce46c40296ba9ee8a2Ian Hodson lib) 7245f4c12fce1ee58e670f9c3fce46c40296ba9ee8a2Ian Hodson # Make sure we only generate libraries of the form `libNAME.la'. 7246f4c12fce1ee58e670f9c3fce46c40296ba9ee8a2Ian Hodson case $outputname in 7247f4c12fce1ee58e670f9c3fce46c40296ba9ee8a2Ian Hodson lib*) 7248f4c12fce1ee58e670f9c3fce46c40296ba9ee8a2Ian Hodson func_stripname 'lib' '.la' "$outputname" 7249f4c12fce1ee58e670f9c3fce46c40296ba9ee8a2Ian Hodson name=$func_stripname_result 7250f4c12fce1ee58e670f9c3fce46c40296ba9ee8a2Ian Hodson eval shared_ext=\"$shrext_cmds\" 7251f4c12fce1ee58e670f9c3fce46c40296ba9ee8a2Ian Hodson eval libname=\"$libname_spec\" 7252f4c12fce1ee58e670f9c3fce46c40296ba9ee8a2Ian Hodson ;; 7253f4c12fce1ee58e670f9c3fce46c40296ba9ee8a2Ian Hodson *) 7254f4c12fce1ee58e670f9c3fce46c40296ba9ee8a2Ian Hodson test "$module" = no && \ 7255f4c12fce1ee58e670f9c3fce46c40296ba9ee8a2Ian Hodson func_fatal_help "libtool library \`$output' must begin with \`lib'" 7256f4c12fce1ee58e670f9c3fce46c40296ba9ee8a2Ian Hodson 7257f4c12fce1ee58e670f9c3fce46c40296ba9ee8a2Ian Hodson if test "$need_lib_prefix" != no; then 7258f4c12fce1ee58e670f9c3fce46c40296ba9ee8a2Ian Hodson # Add the "lib" prefix for modules if required 7259f4c12fce1ee58e670f9c3fce46c40296ba9ee8a2Ian Hodson func_stripname '' '.la' "$outputname" 7260f4c12fce1ee58e670f9c3fce46c40296ba9ee8a2Ian Hodson name=$func_stripname_result 7261f4c12fce1ee58e670f9c3fce46c40296ba9ee8a2Ian Hodson eval shared_ext=\"$shrext_cmds\" 7262f4c12fce1ee58e670f9c3fce46c40296ba9ee8a2Ian Hodson eval libname=\"$libname_spec\" 7263f4c12fce1ee58e670f9c3fce46c40296ba9ee8a2Ian Hodson else 7264f4c12fce1ee58e670f9c3fce46c40296ba9ee8a2Ian Hodson func_stripname '' '.la' "$outputname" 7265f4c12fce1ee58e670f9c3fce46c40296ba9ee8a2Ian Hodson libname=$func_stripname_result 7266f4c12fce1ee58e670f9c3fce46c40296ba9ee8a2Ian Hodson fi 7267f4c12fce1ee58e670f9c3fce46c40296ba9ee8a2Ian Hodson ;; 7268f4c12fce1ee58e670f9c3fce46c40296ba9ee8a2Ian Hodson esac 7269f4c12fce1ee58e670f9c3fce46c40296ba9ee8a2Ian Hodson 7270f4c12fce1ee58e670f9c3fce46c40296ba9ee8a2Ian Hodson if test -n "$objs"; then 7271f4c12fce1ee58e670f9c3fce46c40296ba9ee8a2Ian Hodson if test "$deplibs_check_method" != pass_all; then 7272f4c12fce1ee58e670f9c3fce46c40296ba9ee8a2Ian Hodson func_fatal_error "cannot build libtool library \`$output' from non-libtool objects on this host:$objs" 7273f4c12fce1ee58e670f9c3fce46c40296ba9ee8a2Ian Hodson else 72745b6dc79427b8f7eeb6a7ff68034ab8548ce670eaAlexander Gutkin echo 7275f4c12fce1ee58e670f9c3fce46c40296ba9ee8a2Ian Hodson $ECHO "*** Warning: Linking the shared library $output against the non-libtool" 7276f4c12fce1ee58e670f9c3fce46c40296ba9ee8a2Ian Hodson $ECHO "*** objects $objs is not portable!" 72775b6dc79427b8f7eeb6a7ff68034ab8548ce670eaAlexander Gutkin func_append libobjs " $objs" 7278f4c12fce1ee58e670f9c3fce46c40296ba9ee8a2Ian Hodson fi 7279f4c12fce1ee58e670f9c3fce46c40296ba9ee8a2Ian Hodson fi 7280f4c12fce1ee58e670f9c3fce46c40296ba9ee8a2Ian Hodson 7281f4c12fce1ee58e670f9c3fce46c40296ba9ee8a2Ian Hodson test "$dlself" != no && \ 7282f4c12fce1ee58e670f9c3fce46c40296ba9ee8a2Ian Hodson func_warning "\`-dlopen self' is ignored for libtool libraries" 7283f4c12fce1ee58e670f9c3fce46c40296ba9ee8a2Ian Hodson 7284f4c12fce1ee58e670f9c3fce46c40296ba9ee8a2Ian Hodson set dummy $rpath 7285f4c12fce1ee58e670f9c3fce46c40296ba9ee8a2Ian Hodson shift 7286f4c12fce1ee58e670f9c3fce46c40296ba9ee8a2Ian Hodson test "$#" -gt 1 && \ 7287f4c12fce1ee58e670f9c3fce46c40296ba9ee8a2Ian Hodson func_warning "ignoring multiple \`-rpath's for a libtool library" 7288f4c12fce1ee58e670f9c3fce46c40296ba9ee8a2Ian Hodson 7289f4c12fce1ee58e670f9c3fce46c40296ba9ee8a2Ian Hodson install_libdir="$1" 7290f4c12fce1ee58e670f9c3fce46c40296ba9ee8a2Ian Hodson 7291f4c12fce1ee58e670f9c3fce46c40296ba9ee8a2Ian Hodson oldlibs= 7292f4c12fce1ee58e670f9c3fce46c40296ba9ee8a2Ian Hodson if test -z "$rpath"; then 7293f4c12fce1ee58e670f9c3fce46c40296ba9ee8a2Ian Hodson if test "$build_libtool_libs" = yes; then 7294f4c12fce1ee58e670f9c3fce46c40296ba9ee8a2Ian Hodson # Building a libtool convenience library. 7295f4c12fce1ee58e670f9c3fce46c40296ba9ee8a2Ian Hodson # Some compilers have problems with a `.al' extension so 7296f4c12fce1ee58e670f9c3fce46c40296ba9ee8a2Ian Hodson # convenience libraries should have the same extension an 7297f4c12fce1ee58e670f9c3fce46c40296ba9ee8a2Ian Hodson # archive normally would. 7298f4c12fce1ee58e670f9c3fce46c40296ba9ee8a2Ian Hodson oldlibs="$output_objdir/$libname.$libext $oldlibs" 7299f4c12fce1ee58e670f9c3fce46c40296ba9ee8a2Ian Hodson build_libtool_libs=convenience 7300f4c12fce1ee58e670f9c3fce46c40296ba9ee8a2Ian Hodson build_old_libs=yes 7301f4c12fce1ee58e670f9c3fce46c40296ba9ee8a2Ian Hodson fi 7302f4c12fce1ee58e670f9c3fce46c40296ba9ee8a2Ian Hodson 7303f4c12fce1ee58e670f9c3fce46c40296ba9ee8a2Ian Hodson test -n "$vinfo" && \ 7304f4c12fce1ee58e670f9c3fce46c40296ba9ee8a2Ian Hodson func_warning "\`-version-info/-version-number' is ignored for convenience libraries" 7305f4c12fce1ee58e670f9c3fce46c40296ba9ee8a2Ian Hodson 7306f4c12fce1ee58e670f9c3fce46c40296ba9ee8a2Ian Hodson test -n "$release" && \ 7307f4c12fce1ee58e670f9c3fce46c40296ba9ee8a2Ian Hodson func_warning "\`-release' is ignored for convenience libraries" 7308f4c12fce1ee58e670f9c3fce46c40296ba9ee8a2Ian Hodson else 7309f4c12fce1ee58e670f9c3fce46c40296ba9ee8a2Ian Hodson 7310f4c12fce1ee58e670f9c3fce46c40296ba9ee8a2Ian Hodson # Parse the version information argument. 7311f4c12fce1ee58e670f9c3fce46c40296ba9ee8a2Ian Hodson save_ifs="$IFS"; IFS=':' 7312f4c12fce1ee58e670f9c3fce46c40296ba9ee8a2Ian Hodson set dummy $vinfo 0 0 0 7313f4c12fce1ee58e670f9c3fce46c40296ba9ee8a2Ian Hodson shift 7314f4c12fce1ee58e670f9c3fce46c40296ba9ee8a2Ian Hodson IFS="$save_ifs" 7315f4c12fce1ee58e670f9c3fce46c40296ba9ee8a2Ian Hodson 7316f4c12fce1ee58e670f9c3fce46c40296ba9ee8a2Ian Hodson test -n "$7" && \ 7317f4c12fce1ee58e670f9c3fce46c40296ba9ee8a2Ian Hodson func_fatal_help "too many parameters to \`-version-info'" 7318f4c12fce1ee58e670f9c3fce46c40296ba9ee8a2Ian Hodson 7319f4c12fce1ee58e670f9c3fce46c40296ba9ee8a2Ian Hodson # convert absolute version numbers to libtool ages 7320f4c12fce1ee58e670f9c3fce46c40296ba9ee8a2Ian Hodson # this retains compatibility with .la files and attempts 7321f4c12fce1ee58e670f9c3fce46c40296ba9ee8a2Ian Hodson # to make the code below a bit more comprehensible 7322f4c12fce1ee58e670f9c3fce46c40296ba9ee8a2Ian Hodson 7323f4c12fce1ee58e670f9c3fce46c40296ba9ee8a2Ian Hodson case $vinfo_number in 7324f4c12fce1ee58e670f9c3fce46c40296ba9ee8a2Ian Hodson yes) 7325f4c12fce1ee58e670f9c3fce46c40296ba9ee8a2Ian Hodson number_major="$1" 7326f4c12fce1ee58e670f9c3fce46c40296ba9ee8a2Ian Hodson number_minor="$2" 7327f4c12fce1ee58e670f9c3fce46c40296ba9ee8a2Ian Hodson number_revision="$3" 7328f4c12fce1ee58e670f9c3fce46c40296ba9ee8a2Ian Hodson # 7329f4c12fce1ee58e670f9c3fce46c40296ba9ee8a2Ian Hodson # There are really only two kinds -- those that 7330f4c12fce1ee58e670f9c3fce46c40296ba9ee8a2Ian Hodson # use the current revision as the major version 7331f4c12fce1ee58e670f9c3fce46c40296ba9ee8a2Ian Hodson # and those that subtract age and use age as 7332f4c12fce1ee58e670f9c3fce46c40296ba9ee8a2Ian Hodson # a minor version. But, then there is irix 7333f4c12fce1ee58e670f9c3fce46c40296ba9ee8a2Ian Hodson # which has an extra 1 added just for fun 7334f4c12fce1ee58e670f9c3fce46c40296ba9ee8a2Ian Hodson # 7335f4c12fce1ee58e670f9c3fce46c40296ba9ee8a2Ian Hodson case $version_type in 73365b6dc79427b8f7eeb6a7ff68034ab8548ce670eaAlexander Gutkin # correct linux to gnu/linux during the next big refactor 7337f4c12fce1ee58e670f9c3fce46c40296ba9ee8a2Ian Hodson darwin|linux|osf|windows|none) 7338f4c12fce1ee58e670f9c3fce46c40296ba9ee8a2Ian Hodson func_arith $number_major + $number_minor 7339f4c12fce1ee58e670f9c3fce46c40296ba9ee8a2Ian Hodson current=$func_arith_result 7340f4c12fce1ee58e670f9c3fce46c40296ba9ee8a2Ian Hodson age="$number_minor" 7341f4c12fce1ee58e670f9c3fce46c40296ba9ee8a2Ian Hodson revision="$number_revision" 7342f4c12fce1ee58e670f9c3fce46c40296ba9ee8a2Ian Hodson ;; 73435b6dc79427b8f7eeb6a7ff68034ab8548ce670eaAlexander Gutkin freebsd-aout|freebsd-elf|qnx|sunos) 7344f4c12fce1ee58e670f9c3fce46c40296ba9ee8a2Ian Hodson current="$number_major" 7345f4c12fce1ee58e670f9c3fce46c40296ba9ee8a2Ian Hodson revision="$number_minor" 7346f4c12fce1ee58e670f9c3fce46c40296ba9ee8a2Ian Hodson age="0" 7347f4c12fce1ee58e670f9c3fce46c40296ba9ee8a2Ian Hodson ;; 7348f4c12fce1ee58e670f9c3fce46c40296ba9ee8a2Ian Hodson irix|nonstopux) 7349f4c12fce1ee58e670f9c3fce46c40296ba9ee8a2Ian Hodson func_arith $number_major + $number_minor 7350f4c12fce1ee58e670f9c3fce46c40296ba9ee8a2Ian Hodson current=$func_arith_result 7351f4c12fce1ee58e670f9c3fce46c40296ba9ee8a2Ian Hodson age="$number_minor" 7352f4c12fce1ee58e670f9c3fce46c40296ba9ee8a2Ian Hodson revision="$number_minor" 7353f4c12fce1ee58e670f9c3fce46c40296ba9ee8a2Ian Hodson lt_irix_increment=no 7354f4c12fce1ee58e670f9c3fce46c40296ba9ee8a2Ian Hodson ;; 7355f4c12fce1ee58e670f9c3fce46c40296ba9ee8a2Ian Hodson *) 7356f4c12fce1ee58e670f9c3fce46c40296ba9ee8a2Ian Hodson func_fatal_configuration "$modename: unknown library version type \`$version_type'" 7357f4c12fce1ee58e670f9c3fce46c40296ba9ee8a2Ian Hodson ;; 7358f4c12fce1ee58e670f9c3fce46c40296ba9ee8a2Ian Hodson esac 7359f4c12fce1ee58e670f9c3fce46c40296ba9ee8a2Ian Hodson ;; 7360f4c12fce1ee58e670f9c3fce46c40296ba9ee8a2Ian Hodson no) 7361f4c12fce1ee58e670f9c3fce46c40296ba9ee8a2Ian Hodson current="$1" 7362f4c12fce1ee58e670f9c3fce46c40296ba9ee8a2Ian Hodson revision="$2" 7363f4c12fce1ee58e670f9c3fce46c40296ba9ee8a2Ian Hodson age="$3" 7364f4c12fce1ee58e670f9c3fce46c40296ba9ee8a2Ian Hodson ;; 7365f4c12fce1ee58e670f9c3fce46c40296ba9ee8a2Ian Hodson esac 7366f4c12fce1ee58e670f9c3fce46c40296ba9ee8a2Ian Hodson 7367f4c12fce1ee58e670f9c3fce46c40296ba9ee8a2Ian Hodson # Check that each of the things are valid numbers. 7368f4c12fce1ee58e670f9c3fce46c40296ba9ee8a2Ian Hodson case $current in 7369f4c12fce1ee58e670f9c3fce46c40296ba9ee8a2Ian Hodson 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]) ;; 7370f4c12fce1ee58e670f9c3fce46c40296ba9ee8a2Ian Hodson *) 7371f4c12fce1ee58e670f9c3fce46c40296ba9ee8a2Ian Hodson func_error "CURRENT \`$current' must be a nonnegative integer" 7372f4c12fce1ee58e670f9c3fce46c40296ba9ee8a2Ian Hodson func_fatal_error "\`$vinfo' is not valid version information" 7373f4c12fce1ee58e670f9c3fce46c40296ba9ee8a2Ian Hodson ;; 7374f4c12fce1ee58e670f9c3fce46c40296ba9ee8a2Ian Hodson esac 7375f4c12fce1ee58e670f9c3fce46c40296ba9ee8a2Ian Hodson 7376f4c12fce1ee58e670f9c3fce46c40296ba9ee8a2Ian Hodson case $revision in 7377f4c12fce1ee58e670f9c3fce46c40296ba9ee8a2Ian Hodson 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]) ;; 7378f4c12fce1ee58e670f9c3fce46c40296ba9ee8a2Ian Hodson *) 7379f4c12fce1ee58e670f9c3fce46c40296ba9ee8a2Ian Hodson func_error "REVISION \`$revision' must be a nonnegative integer" 7380f4c12fce1ee58e670f9c3fce46c40296ba9ee8a2Ian Hodson func_fatal_error "\`$vinfo' is not valid version information" 7381f4c12fce1ee58e670f9c3fce46c40296ba9ee8a2Ian Hodson ;; 7382f4c12fce1ee58e670f9c3fce46c40296ba9ee8a2Ian Hodson esac 7383f4c12fce1ee58e670f9c3fce46c40296ba9ee8a2Ian Hodson 7384f4c12fce1ee58e670f9c3fce46c40296ba9ee8a2Ian Hodson case $age in 7385f4c12fce1ee58e670f9c3fce46c40296ba9ee8a2Ian Hodson 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]) ;; 7386f4c12fce1ee58e670f9c3fce46c40296ba9ee8a2Ian Hodson *) 7387f4c12fce1ee58e670f9c3fce46c40296ba9ee8a2Ian Hodson func_error "AGE \`$age' must be a nonnegative integer" 7388f4c12fce1ee58e670f9c3fce46c40296ba9ee8a2Ian Hodson func_fatal_error "\`$vinfo' is not valid version information" 7389f4c12fce1ee58e670f9c3fce46c40296ba9ee8a2Ian Hodson ;; 7390f4c12fce1ee58e670f9c3fce46c40296ba9ee8a2Ian Hodson esac 7391f4c12fce1ee58e670f9c3fce46c40296ba9ee8a2Ian Hodson 7392f4c12fce1ee58e670f9c3fce46c40296ba9ee8a2Ian Hodson if test "$age" -gt "$current"; then 7393f4c12fce1ee58e670f9c3fce46c40296ba9ee8a2Ian Hodson func_error "AGE \`$age' is greater than the current interface number \`$current'" 7394f4c12fce1ee58e670f9c3fce46c40296ba9ee8a2Ian Hodson func_fatal_error "\`$vinfo' is not valid version information" 7395f4c12fce1ee58e670f9c3fce46c40296ba9ee8a2Ian Hodson fi 7396f4c12fce1ee58e670f9c3fce46c40296ba9ee8a2Ian Hodson 7397f4c12fce1ee58e670f9c3fce46c40296ba9ee8a2Ian Hodson # Calculate the version variables. 7398f4c12fce1ee58e670f9c3fce46c40296ba9ee8a2Ian Hodson major= 7399f4c12fce1ee58e670f9c3fce46c40296ba9ee8a2Ian Hodson versuffix= 7400f4c12fce1ee58e670f9c3fce46c40296ba9ee8a2Ian Hodson verstring= 7401f4c12fce1ee58e670f9c3fce46c40296ba9ee8a2Ian Hodson case $version_type in 7402f4c12fce1ee58e670f9c3fce46c40296ba9ee8a2Ian Hodson none) ;; 7403f4c12fce1ee58e670f9c3fce46c40296ba9ee8a2Ian Hodson 7404f4c12fce1ee58e670f9c3fce46c40296ba9ee8a2Ian Hodson darwin) 7405f4c12fce1ee58e670f9c3fce46c40296ba9ee8a2Ian Hodson # Like Linux, but with the current version available in 7406f4c12fce1ee58e670f9c3fce46c40296ba9ee8a2Ian Hodson # verstring for coding it into the library header 7407f4c12fce1ee58e670f9c3fce46c40296ba9ee8a2Ian Hodson func_arith $current - $age 7408f4c12fce1ee58e670f9c3fce46c40296ba9ee8a2Ian Hodson major=.$func_arith_result 7409f4c12fce1ee58e670f9c3fce46c40296ba9ee8a2Ian Hodson versuffix="$major.$age.$revision" 7410f4c12fce1ee58e670f9c3fce46c40296ba9ee8a2Ian Hodson # Darwin ld doesn't like 0 for these options... 7411f4c12fce1ee58e670f9c3fce46c40296ba9ee8a2Ian Hodson func_arith $current + 1 7412f4c12fce1ee58e670f9c3fce46c40296ba9ee8a2Ian Hodson minor_current=$func_arith_result 7413f4c12fce1ee58e670f9c3fce46c40296ba9ee8a2Ian Hodson xlcverstring="${wl}-compatibility_version ${wl}$minor_current ${wl}-current_version ${wl}$minor_current.$revision" 7414f4c12fce1ee58e670f9c3fce46c40296ba9ee8a2Ian Hodson verstring="-compatibility_version $minor_current -current_version $minor_current.$revision" 7415f4c12fce1ee58e670f9c3fce46c40296ba9ee8a2Ian Hodson ;; 7416f4c12fce1ee58e670f9c3fce46c40296ba9ee8a2Ian Hodson 7417f4c12fce1ee58e670f9c3fce46c40296ba9ee8a2Ian Hodson freebsd-aout) 7418f4c12fce1ee58e670f9c3fce46c40296ba9ee8a2Ian Hodson major=".$current" 7419f4c12fce1ee58e670f9c3fce46c40296ba9ee8a2Ian Hodson versuffix=".$current.$revision"; 7420f4c12fce1ee58e670f9c3fce46c40296ba9ee8a2Ian Hodson ;; 7421f4c12fce1ee58e670f9c3fce46c40296ba9ee8a2Ian Hodson 7422f4c12fce1ee58e670f9c3fce46c40296ba9ee8a2Ian Hodson freebsd-elf) 7423f4c12fce1ee58e670f9c3fce46c40296ba9ee8a2Ian Hodson major=".$current" 7424f4c12fce1ee58e670f9c3fce46c40296ba9ee8a2Ian Hodson versuffix=".$current" 7425f4c12fce1ee58e670f9c3fce46c40296ba9ee8a2Ian Hodson ;; 7426f4c12fce1ee58e670f9c3fce46c40296ba9ee8a2Ian Hodson 7427f4c12fce1ee58e670f9c3fce46c40296ba9ee8a2Ian Hodson irix | nonstopux) 7428f4c12fce1ee58e670f9c3fce46c40296ba9ee8a2Ian Hodson if test "X$lt_irix_increment" = "Xno"; then 7429f4c12fce1ee58e670f9c3fce46c40296ba9ee8a2Ian Hodson func_arith $current - $age 7430f4c12fce1ee58e670f9c3fce46c40296ba9ee8a2Ian Hodson else 7431f4c12fce1ee58e670f9c3fce46c40296ba9ee8a2Ian Hodson func_arith $current - $age + 1 7432f4c12fce1ee58e670f9c3fce46c40296ba9ee8a2Ian Hodson fi 7433f4c12fce1ee58e670f9c3fce46c40296ba9ee8a2Ian Hodson major=$func_arith_result 7434f4c12fce1ee58e670f9c3fce46c40296ba9ee8a2Ian Hodson 7435f4c12fce1ee58e670f9c3fce46c40296ba9ee8a2Ian Hodson case $version_type in 7436f4c12fce1ee58e670f9c3fce46c40296ba9ee8a2Ian Hodson nonstopux) verstring_prefix=nonstopux ;; 7437f4c12fce1ee58e670f9c3fce46c40296ba9ee8a2Ian Hodson *) verstring_prefix=sgi ;; 7438f4c12fce1ee58e670f9c3fce46c40296ba9ee8a2Ian Hodson esac 7439f4c12fce1ee58e670f9c3fce46c40296ba9ee8a2Ian Hodson verstring="$verstring_prefix$major.$revision" 7440f4c12fce1ee58e670f9c3fce46c40296ba9ee8a2Ian Hodson 7441f4c12fce1ee58e670f9c3fce46c40296ba9ee8a2Ian Hodson # Add in all the interfaces that we are compatible with. 7442f4c12fce1ee58e670f9c3fce46c40296ba9ee8a2Ian Hodson loop=$revision 7443f4c12fce1ee58e670f9c3fce46c40296ba9ee8a2Ian Hodson while test "$loop" -ne 0; do 7444f4c12fce1ee58e670f9c3fce46c40296ba9ee8a2Ian Hodson func_arith $revision - $loop 7445f4c12fce1ee58e670f9c3fce46c40296ba9ee8a2Ian Hodson iface=$func_arith_result 7446f4c12fce1ee58e670f9c3fce46c40296ba9ee8a2Ian Hodson func_arith $loop - 1 7447f4c12fce1ee58e670f9c3fce46c40296ba9ee8a2Ian Hodson loop=$func_arith_result 7448f4c12fce1ee58e670f9c3fce46c40296ba9ee8a2Ian Hodson verstring="$verstring_prefix$major.$iface:$verstring" 7449f4c12fce1ee58e670f9c3fce46c40296ba9ee8a2Ian Hodson done 7450f4c12fce1ee58e670f9c3fce46c40296ba9ee8a2Ian Hodson 7451f4c12fce1ee58e670f9c3fce46c40296ba9ee8a2Ian Hodson # Before this point, $major must not contain `.'. 7452f4c12fce1ee58e670f9c3fce46c40296ba9ee8a2Ian Hodson major=.$major 7453f4c12fce1ee58e670f9c3fce46c40296ba9ee8a2Ian Hodson versuffix="$major.$revision" 7454f4c12fce1ee58e670f9c3fce46c40296ba9ee8a2Ian Hodson ;; 7455f4c12fce1ee58e670f9c3fce46c40296ba9ee8a2Ian Hodson 74565b6dc79427b8f7eeb6a7ff68034ab8548ce670eaAlexander Gutkin linux) # correct to gnu/linux during the next big refactor 7457f4c12fce1ee58e670f9c3fce46c40296ba9ee8a2Ian Hodson func_arith $current - $age 7458f4c12fce1ee58e670f9c3fce46c40296ba9ee8a2Ian Hodson major=.$func_arith_result 7459f4c12fce1ee58e670f9c3fce46c40296ba9ee8a2Ian Hodson versuffix="$major.$age.$revision" 7460f4c12fce1ee58e670f9c3fce46c40296ba9ee8a2Ian Hodson ;; 7461f4c12fce1ee58e670f9c3fce46c40296ba9ee8a2Ian Hodson 7462f4c12fce1ee58e670f9c3fce46c40296ba9ee8a2Ian Hodson osf) 7463f4c12fce1ee58e670f9c3fce46c40296ba9ee8a2Ian Hodson func_arith $current - $age 7464f4c12fce1ee58e670f9c3fce46c40296ba9ee8a2Ian Hodson major=.$func_arith_result 7465f4c12fce1ee58e670f9c3fce46c40296ba9ee8a2Ian Hodson versuffix=".$current.$age.$revision" 7466f4c12fce1ee58e670f9c3fce46c40296ba9ee8a2Ian Hodson verstring="$current.$age.$revision" 7467f4c12fce1ee58e670f9c3fce46c40296ba9ee8a2Ian Hodson 7468f4c12fce1ee58e670f9c3fce46c40296ba9ee8a2Ian Hodson # Add in all the interfaces that we are compatible with. 7469f4c12fce1ee58e670f9c3fce46c40296ba9ee8a2Ian Hodson loop=$age 7470f4c12fce1ee58e670f9c3fce46c40296ba9ee8a2Ian Hodson while test "$loop" -ne 0; do 7471f4c12fce1ee58e670f9c3fce46c40296ba9ee8a2Ian Hodson func_arith $current - $loop 7472f4c12fce1ee58e670f9c3fce46c40296ba9ee8a2Ian Hodson iface=$func_arith_result 7473f4c12fce1ee58e670f9c3fce46c40296ba9ee8a2Ian Hodson func_arith $loop - 1 7474f4c12fce1ee58e670f9c3fce46c40296ba9ee8a2Ian Hodson loop=$func_arith_result 7475f4c12fce1ee58e670f9c3fce46c40296ba9ee8a2Ian Hodson verstring="$verstring:${iface}.0" 7476f4c12fce1ee58e670f9c3fce46c40296ba9ee8a2Ian Hodson done 7477f4c12fce1ee58e670f9c3fce46c40296ba9ee8a2Ian Hodson 7478f4c12fce1ee58e670f9c3fce46c40296ba9ee8a2Ian Hodson # Make executables depend on our current version. 74795b6dc79427b8f7eeb6a7ff68034ab8548ce670eaAlexander Gutkin func_append verstring ":${current}.0" 7480f4c12fce1ee58e670f9c3fce46c40296ba9ee8a2Ian Hodson ;; 7481f4c12fce1ee58e670f9c3fce46c40296ba9ee8a2Ian Hodson 7482f4c12fce1ee58e670f9c3fce46c40296ba9ee8a2Ian Hodson qnx) 7483f4c12fce1ee58e670f9c3fce46c40296ba9ee8a2Ian Hodson major=".$current" 7484f4c12fce1ee58e670f9c3fce46c40296ba9ee8a2Ian Hodson versuffix=".$current" 7485f4c12fce1ee58e670f9c3fce46c40296ba9ee8a2Ian Hodson ;; 7486f4c12fce1ee58e670f9c3fce46c40296ba9ee8a2Ian Hodson 7487f4c12fce1ee58e670f9c3fce46c40296ba9ee8a2Ian Hodson sunos) 7488f4c12fce1ee58e670f9c3fce46c40296ba9ee8a2Ian Hodson major=".$current" 7489f4c12fce1ee58e670f9c3fce46c40296ba9ee8a2Ian Hodson versuffix=".$current.$revision" 7490f4c12fce1ee58e670f9c3fce46c40296ba9ee8a2Ian Hodson ;; 7491f4c12fce1ee58e670f9c3fce46c40296ba9ee8a2Ian Hodson 7492f4c12fce1ee58e670f9c3fce46c40296ba9ee8a2Ian Hodson windows) 7493f4c12fce1ee58e670f9c3fce46c40296ba9ee8a2Ian Hodson # Use '-' rather than '.', since we only want one 7494f4c12fce1ee58e670f9c3fce46c40296ba9ee8a2Ian Hodson # extension on DOS 8.3 filesystems. 7495f4c12fce1ee58e670f9c3fce46c40296ba9ee8a2Ian Hodson func_arith $current - $age 7496f4c12fce1ee58e670f9c3fce46c40296ba9ee8a2Ian Hodson major=$func_arith_result 7497f4c12fce1ee58e670f9c3fce46c40296ba9ee8a2Ian Hodson versuffix="-$major" 7498f4c12fce1ee58e670f9c3fce46c40296ba9ee8a2Ian Hodson ;; 7499f4c12fce1ee58e670f9c3fce46c40296ba9ee8a2Ian Hodson 7500f4c12fce1ee58e670f9c3fce46c40296ba9ee8a2Ian Hodson *) 7501f4c12fce1ee58e670f9c3fce46c40296ba9ee8a2Ian Hodson func_fatal_configuration "unknown library version type \`$version_type'" 7502f4c12fce1ee58e670f9c3fce46c40296ba9ee8a2Ian Hodson ;; 7503f4c12fce1ee58e670f9c3fce46c40296ba9ee8a2Ian Hodson esac 7504f4c12fce1ee58e670f9c3fce46c40296ba9ee8a2Ian Hodson 7505f4c12fce1ee58e670f9c3fce46c40296ba9ee8a2Ian Hodson # Clear the version info if we defaulted, and they specified a release. 7506f4c12fce1ee58e670f9c3fce46c40296ba9ee8a2Ian Hodson if test -z "$vinfo" && test -n "$release"; then 7507f4c12fce1ee58e670f9c3fce46c40296ba9ee8a2Ian Hodson major= 7508f4c12fce1ee58e670f9c3fce46c40296ba9ee8a2Ian Hodson case $version_type in 7509f4c12fce1ee58e670f9c3fce46c40296ba9ee8a2Ian Hodson darwin) 7510f4c12fce1ee58e670f9c3fce46c40296ba9ee8a2Ian Hodson # we can't check for "0.0" in archive_cmds due to quoting 7511f4c12fce1ee58e670f9c3fce46c40296ba9ee8a2Ian Hodson # problems, so we reset it completely 7512f4c12fce1ee58e670f9c3fce46c40296ba9ee8a2Ian Hodson verstring= 7513f4c12fce1ee58e670f9c3fce46c40296ba9ee8a2Ian Hodson ;; 7514f4c12fce1ee58e670f9c3fce46c40296ba9ee8a2Ian Hodson *) 7515f4c12fce1ee58e670f9c3fce46c40296ba9ee8a2Ian Hodson verstring="0.0" 7516f4c12fce1ee58e670f9c3fce46c40296ba9ee8a2Ian Hodson ;; 7517f4c12fce1ee58e670f9c3fce46c40296ba9ee8a2Ian Hodson esac 7518f4c12fce1ee58e670f9c3fce46c40296ba9ee8a2Ian Hodson if test "$need_version" = no; then 7519f4c12fce1ee58e670f9c3fce46c40296ba9ee8a2Ian Hodson versuffix= 7520f4c12fce1ee58e670f9c3fce46c40296ba9ee8a2Ian Hodson else 7521f4c12fce1ee58e670f9c3fce46c40296ba9ee8a2Ian Hodson versuffix=".0.0" 7522f4c12fce1ee58e670f9c3fce46c40296ba9ee8a2Ian Hodson fi 7523f4c12fce1ee58e670f9c3fce46c40296ba9ee8a2Ian Hodson fi 7524f4c12fce1ee58e670f9c3fce46c40296ba9ee8a2Ian Hodson 7525f4c12fce1ee58e670f9c3fce46c40296ba9ee8a2Ian Hodson # Remove version info from name if versioning should be avoided 7526f4c12fce1ee58e670f9c3fce46c40296ba9ee8a2Ian Hodson if test "$avoid_version" = yes && test "$need_version" = no; then 7527f4c12fce1ee58e670f9c3fce46c40296ba9ee8a2Ian Hodson major= 7528f4c12fce1ee58e670f9c3fce46c40296ba9ee8a2Ian Hodson versuffix= 7529f4c12fce1ee58e670f9c3fce46c40296ba9ee8a2Ian Hodson verstring="" 7530f4c12fce1ee58e670f9c3fce46c40296ba9ee8a2Ian Hodson fi 7531f4c12fce1ee58e670f9c3fce46c40296ba9ee8a2Ian Hodson 7532f4c12fce1ee58e670f9c3fce46c40296ba9ee8a2Ian Hodson # Check to see if the archive will have undefined symbols. 7533f4c12fce1ee58e670f9c3fce46c40296ba9ee8a2Ian Hodson if test "$allow_undefined" = yes; then 7534f4c12fce1ee58e670f9c3fce46c40296ba9ee8a2Ian Hodson if test "$allow_undefined_flag" = unsupported; then 7535f4c12fce1ee58e670f9c3fce46c40296ba9ee8a2Ian Hodson func_warning "undefined symbols not allowed in $host shared libraries" 7536f4c12fce1ee58e670f9c3fce46c40296ba9ee8a2Ian Hodson build_libtool_libs=no 7537f4c12fce1ee58e670f9c3fce46c40296ba9ee8a2Ian Hodson build_old_libs=yes 7538f4c12fce1ee58e670f9c3fce46c40296ba9ee8a2Ian Hodson fi 7539f4c12fce1ee58e670f9c3fce46c40296ba9ee8a2Ian Hodson else 7540f4c12fce1ee58e670f9c3fce46c40296ba9ee8a2Ian Hodson # Don't allow undefined symbols. 7541f4c12fce1ee58e670f9c3fce46c40296ba9ee8a2Ian Hodson allow_undefined_flag="$no_undefined_flag" 7542f4c12fce1ee58e670f9c3fce46c40296ba9ee8a2Ian Hodson fi 7543f4c12fce1ee58e670f9c3fce46c40296ba9ee8a2Ian Hodson 7544f4c12fce1ee58e670f9c3fce46c40296ba9ee8a2Ian Hodson fi 7545f4c12fce1ee58e670f9c3fce46c40296ba9ee8a2Ian Hodson 7546f4c12fce1ee58e670f9c3fce46c40296ba9ee8a2Ian Hodson func_generate_dlsyms "$libname" "$libname" "yes" 75475b6dc79427b8f7eeb6a7ff68034ab8548ce670eaAlexander Gutkin func_append libobjs " $symfileobj" 7548f4c12fce1ee58e670f9c3fce46c40296ba9ee8a2Ian Hodson test "X$libobjs" = "X " && libobjs= 7549f4c12fce1ee58e670f9c3fce46c40296ba9ee8a2Ian Hodson 75505b6dc79427b8f7eeb6a7ff68034ab8548ce670eaAlexander Gutkin if test "$opt_mode" != relink; then 7551f4c12fce1ee58e670f9c3fce46c40296ba9ee8a2Ian Hodson # Remove our outputs, but don't remove object files since they 7552f4c12fce1ee58e670f9c3fce46c40296ba9ee8a2Ian Hodson # may have been created when compiling PIC objects. 7553f4c12fce1ee58e670f9c3fce46c40296ba9ee8a2Ian Hodson removelist= 7554f4c12fce1ee58e670f9c3fce46c40296ba9ee8a2Ian Hodson tempremovelist=`$ECHO "$output_objdir/*"` 7555f4c12fce1ee58e670f9c3fce46c40296ba9ee8a2Ian Hodson for p in $tempremovelist; do 7556f4c12fce1ee58e670f9c3fce46c40296ba9ee8a2Ian Hodson case $p in 7557f4c12fce1ee58e670f9c3fce46c40296ba9ee8a2Ian Hodson *.$objext | *.gcno) 7558f4c12fce1ee58e670f9c3fce46c40296ba9ee8a2Ian Hodson ;; 7559f4c12fce1ee58e670f9c3fce46c40296ba9ee8a2Ian Hodson $output_objdir/$outputname | $output_objdir/$libname.* | $output_objdir/${libname}${release}.*) 7560f4c12fce1ee58e670f9c3fce46c40296ba9ee8a2Ian Hodson if test "X$precious_files_regex" != "X"; then 7561f4c12fce1ee58e670f9c3fce46c40296ba9ee8a2Ian Hodson if $ECHO "$p" | $EGREP -e "$precious_files_regex" >/dev/null 2>&1 7562f4c12fce1ee58e670f9c3fce46c40296ba9ee8a2Ian Hodson then 7563f4c12fce1ee58e670f9c3fce46c40296ba9ee8a2Ian Hodson continue 7564f4c12fce1ee58e670f9c3fce46c40296ba9ee8a2Ian Hodson fi 7565f4c12fce1ee58e670f9c3fce46c40296ba9ee8a2Ian Hodson fi 75665b6dc79427b8f7eeb6a7ff68034ab8548ce670eaAlexander Gutkin func_append removelist " $p" 7567f4c12fce1ee58e670f9c3fce46c40296ba9ee8a2Ian Hodson ;; 7568f4c12fce1ee58e670f9c3fce46c40296ba9ee8a2Ian Hodson *) ;; 7569f4c12fce1ee58e670f9c3fce46c40296ba9ee8a2Ian Hodson esac 7570f4c12fce1ee58e670f9c3fce46c40296ba9ee8a2Ian Hodson done 7571f4c12fce1ee58e670f9c3fce46c40296ba9ee8a2Ian Hodson test -n "$removelist" && \ 7572f4c12fce1ee58e670f9c3fce46c40296ba9ee8a2Ian Hodson func_show_eval "${RM}r \$removelist" 7573f4c12fce1ee58e670f9c3fce46c40296ba9ee8a2Ian Hodson fi 7574f4c12fce1ee58e670f9c3fce46c40296ba9ee8a2Ian Hodson 7575f4c12fce1ee58e670f9c3fce46c40296ba9ee8a2Ian Hodson # Now set the variables for building old libraries. 7576f4c12fce1ee58e670f9c3fce46c40296ba9ee8a2Ian Hodson if test "$build_old_libs" = yes && test "$build_libtool_libs" != convenience ; then 75775b6dc79427b8f7eeb6a7ff68034ab8548ce670eaAlexander Gutkin func_append oldlibs " $output_objdir/$libname.$libext" 7578f4c12fce1ee58e670f9c3fce46c40296ba9ee8a2Ian Hodson 7579f4c12fce1ee58e670f9c3fce46c40296ba9ee8a2Ian Hodson # Transform .lo files to .o files. 75805b6dc79427b8f7eeb6a7ff68034ab8548ce670eaAlexander Gutkin oldobjs="$objs "`$ECHO "$libobjs" | $SP2NL | $SED "/\.${libext}$/d; $lo2o" | $NL2SP` 7581f4c12fce1ee58e670f9c3fce46c40296ba9ee8a2Ian Hodson fi 7582f4c12fce1ee58e670f9c3fce46c40296ba9ee8a2Ian Hodson 7583f4c12fce1ee58e670f9c3fce46c40296ba9ee8a2Ian Hodson # Eliminate all temporary directories. 7584f4c12fce1ee58e670f9c3fce46c40296ba9ee8a2Ian Hodson #for path in $notinst_path; do 75855b6dc79427b8f7eeb6a7ff68034ab8548ce670eaAlexander Gutkin # lib_search_path=`$ECHO "$lib_search_path " | $SED "s% $path % %g"` 75865b6dc79427b8f7eeb6a7ff68034ab8548ce670eaAlexander Gutkin # deplibs=`$ECHO "$deplibs " | $SED "s% -L$path % %g"` 75875b6dc79427b8f7eeb6a7ff68034ab8548ce670eaAlexander Gutkin # dependency_libs=`$ECHO "$dependency_libs " | $SED "s% -L$path % %g"` 7588f4c12fce1ee58e670f9c3fce46c40296ba9ee8a2Ian Hodson #done 7589f4c12fce1ee58e670f9c3fce46c40296ba9ee8a2Ian Hodson 7590f4c12fce1ee58e670f9c3fce46c40296ba9ee8a2Ian Hodson if test -n "$xrpath"; then 7591f4c12fce1ee58e670f9c3fce46c40296ba9ee8a2Ian Hodson # If the user specified any rpath flags, then add them. 7592f4c12fce1ee58e670f9c3fce46c40296ba9ee8a2Ian Hodson temp_xrpath= 7593f4c12fce1ee58e670f9c3fce46c40296ba9ee8a2Ian Hodson for libdir in $xrpath; do 75945b6dc79427b8f7eeb6a7ff68034ab8548ce670eaAlexander Gutkin func_replace_sysroot "$libdir" 75955b6dc79427b8f7eeb6a7ff68034ab8548ce670eaAlexander Gutkin func_append temp_xrpath " -R$func_replace_sysroot_result" 7596f4c12fce1ee58e670f9c3fce46c40296ba9ee8a2Ian Hodson case "$finalize_rpath " in 7597f4c12fce1ee58e670f9c3fce46c40296ba9ee8a2Ian Hodson *" $libdir "*) ;; 75985b6dc79427b8f7eeb6a7ff68034ab8548ce670eaAlexander Gutkin *) func_append finalize_rpath " $libdir" ;; 7599f4c12fce1ee58e670f9c3fce46c40296ba9ee8a2Ian Hodson esac 7600f4c12fce1ee58e670f9c3fce46c40296ba9ee8a2Ian Hodson done 7601f4c12fce1ee58e670f9c3fce46c40296ba9ee8a2Ian Hodson if test "$hardcode_into_libs" != yes || test "$build_old_libs" = yes; then 7602f4c12fce1ee58e670f9c3fce46c40296ba9ee8a2Ian Hodson dependency_libs="$temp_xrpath $dependency_libs" 7603f4c12fce1ee58e670f9c3fce46c40296ba9ee8a2Ian Hodson fi 7604f4c12fce1ee58e670f9c3fce46c40296ba9ee8a2Ian Hodson fi 7605f4c12fce1ee58e670f9c3fce46c40296ba9ee8a2Ian Hodson 7606f4c12fce1ee58e670f9c3fce46c40296ba9ee8a2Ian Hodson # Make sure dlfiles contains only unique files that won't be dlpreopened 7607f4c12fce1ee58e670f9c3fce46c40296ba9ee8a2Ian Hodson old_dlfiles="$dlfiles" 7608f4c12fce1ee58e670f9c3fce46c40296ba9ee8a2Ian Hodson dlfiles= 7609f4c12fce1ee58e670f9c3fce46c40296ba9ee8a2Ian Hodson for lib in $old_dlfiles; do 7610f4c12fce1ee58e670f9c3fce46c40296ba9ee8a2Ian Hodson case " $dlprefiles $dlfiles " in 7611f4c12fce1ee58e670f9c3fce46c40296ba9ee8a2Ian Hodson *" $lib "*) ;; 76125b6dc79427b8f7eeb6a7ff68034ab8548ce670eaAlexander Gutkin *) func_append dlfiles " $lib" ;; 7613f4c12fce1ee58e670f9c3fce46c40296ba9ee8a2Ian Hodson esac 7614f4c12fce1ee58e670f9c3fce46c40296ba9ee8a2Ian Hodson done 7615f4c12fce1ee58e670f9c3fce46c40296ba9ee8a2Ian Hodson 7616f4c12fce1ee58e670f9c3fce46c40296ba9ee8a2Ian Hodson # Make sure dlprefiles contains only unique files 7617f4c12fce1ee58e670f9c3fce46c40296ba9ee8a2Ian Hodson old_dlprefiles="$dlprefiles" 7618f4c12fce1ee58e670f9c3fce46c40296ba9ee8a2Ian Hodson dlprefiles= 7619f4c12fce1ee58e670f9c3fce46c40296ba9ee8a2Ian Hodson for lib in $old_dlprefiles; do 7620f4c12fce1ee58e670f9c3fce46c40296ba9ee8a2Ian Hodson case "$dlprefiles " in 7621f4c12fce1ee58e670f9c3fce46c40296ba9ee8a2Ian Hodson *" $lib "*) ;; 76225b6dc79427b8f7eeb6a7ff68034ab8548ce670eaAlexander Gutkin *) func_append dlprefiles " $lib" ;; 7623f4c12fce1ee58e670f9c3fce46c40296ba9ee8a2Ian Hodson esac 7624f4c12fce1ee58e670f9c3fce46c40296ba9ee8a2Ian Hodson done 7625f4c12fce1ee58e670f9c3fce46c40296ba9ee8a2Ian Hodson 7626f4c12fce1ee58e670f9c3fce46c40296ba9ee8a2Ian Hodson if test "$build_libtool_libs" = yes; then 7627f4c12fce1ee58e670f9c3fce46c40296ba9ee8a2Ian Hodson if test -n "$rpath"; then 7628f4c12fce1ee58e670f9c3fce46c40296ba9ee8a2Ian Hodson case $host in 76295b6dc79427b8f7eeb6a7ff68034ab8548ce670eaAlexander Gutkin *-*-cygwin* | *-*-mingw* | *-*-pw32* | *-*-os2* | *-*-beos* | *-cegcc* | *-*-haiku*) 7630f4c12fce1ee58e670f9c3fce46c40296ba9ee8a2Ian Hodson # these systems don't actually have a c library (as such)! 7631f4c12fce1ee58e670f9c3fce46c40296ba9ee8a2Ian Hodson ;; 7632f4c12fce1ee58e670f9c3fce46c40296ba9ee8a2Ian Hodson *-*-rhapsody* | *-*-darwin1.[012]) 7633f4c12fce1ee58e670f9c3fce46c40296ba9ee8a2Ian Hodson # Rhapsody C library is in the System framework 76345b6dc79427b8f7eeb6a7ff68034ab8548ce670eaAlexander Gutkin func_append deplibs " System.ltframework" 7635f4c12fce1ee58e670f9c3fce46c40296ba9ee8a2Ian Hodson ;; 7636f4c12fce1ee58e670f9c3fce46c40296ba9ee8a2Ian Hodson *-*-netbsd*) 7637f4c12fce1ee58e670f9c3fce46c40296ba9ee8a2Ian Hodson # Don't link with libc until the a.out ld.so is fixed. 7638f4c12fce1ee58e670f9c3fce46c40296ba9ee8a2Ian Hodson ;; 7639f4c12fce1ee58e670f9c3fce46c40296ba9ee8a2Ian Hodson *-*-openbsd* | *-*-freebsd* | *-*-dragonfly*) 7640f4c12fce1ee58e670f9c3fce46c40296ba9ee8a2Ian Hodson # Do not include libc due to us having libc/libc_r. 7641f4c12fce1ee58e670f9c3fce46c40296ba9ee8a2Ian Hodson ;; 7642f4c12fce1ee58e670f9c3fce46c40296ba9ee8a2Ian Hodson *-*-sco3.2v5* | *-*-sco5v6*) 7643f4c12fce1ee58e670f9c3fce46c40296ba9ee8a2Ian Hodson # Causes problems with __ctype 7644f4c12fce1ee58e670f9c3fce46c40296ba9ee8a2Ian Hodson ;; 7645f4c12fce1ee58e670f9c3fce46c40296ba9ee8a2Ian Hodson *-*-sysv4.2uw2* | *-*-sysv5* | *-*-unixware* | *-*-OpenUNIX*) 7646f4c12fce1ee58e670f9c3fce46c40296ba9ee8a2Ian Hodson # Compiler inserts libc in the correct place for threads to work 7647f4c12fce1ee58e670f9c3fce46c40296ba9ee8a2Ian Hodson ;; 7648f4c12fce1ee58e670f9c3fce46c40296ba9ee8a2Ian Hodson *) 7649f4c12fce1ee58e670f9c3fce46c40296ba9ee8a2Ian Hodson # Add libc to deplibs on all other systems if necessary. 7650f4c12fce1ee58e670f9c3fce46c40296ba9ee8a2Ian Hodson if test "$build_libtool_need_lc" = "yes"; then 76515b6dc79427b8f7eeb6a7ff68034ab8548ce670eaAlexander Gutkin func_append deplibs " -lc" 7652f4c12fce1ee58e670f9c3fce46c40296ba9ee8a2Ian Hodson fi 7653f4c12fce1ee58e670f9c3fce46c40296ba9ee8a2Ian Hodson ;; 7654f4c12fce1ee58e670f9c3fce46c40296ba9ee8a2Ian Hodson esac 7655f4c12fce1ee58e670f9c3fce46c40296ba9ee8a2Ian Hodson fi 7656f4c12fce1ee58e670f9c3fce46c40296ba9ee8a2Ian Hodson 7657f4c12fce1ee58e670f9c3fce46c40296ba9ee8a2Ian Hodson # Transform deplibs into only deplibs that can be linked in shared. 7658f4c12fce1ee58e670f9c3fce46c40296ba9ee8a2Ian Hodson name_save=$name 7659f4c12fce1ee58e670f9c3fce46c40296ba9ee8a2Ian Hodson libname_save=$libname 7660f4c12fce1ee58e670f9c3fce46c40296ba9ee8a2Ian Hodson release_save=$release 7661f4c12fce1ee58e670f9c3fce46c40296ba9ee8a2Ian Hodson versuffix_save=$versuffix 7662f4c12fce1ee58e670f9c3fce46c40296ba9ee8a2Ian Hodson major_save=$major 7663f4c12fce1ee58e670f9c3fce46c40296ba9ee8a2Ian Hodson # I'm not sure if I'm treating the release correctly. I think 7664f4c12fce1ee58e670f9c3fce46c40296ba9ee8a2Ian Hodson # release should show up in the -l (ie -lgmp5) so we don't want to 7665f4c12fce1ee58e670f9c3fce46c40296ba9ee8a2Ian Hodson # add it in twice. Is that correct? 7666f4c12fce1ee58e670f9c3fce46c40296ba9ee8a2Ian Hodson release="" 7667f4c12fce1ee58e670f9c3fce46c40296ba9ee8a2Ian Hodson versuffix="" 7668f4c12fce1ee58e670f9c3fce46c40296ba9ee8a2Ian Hodson major="" 7669f4c12fce1ee58e670f9c3fce46c40296ba9ee8a2Ian Hodson newdeplibs= 7670f4c12fce1ee58e670f9c3fce46c40296ba9ee8a2Ian Hodson droppeddeps=no 7671f4c12fce1ee58e670f9c3fce46c40296ba9ee8a2Ian Hodson case $deplibs_check_method in 7672f4c12fce1ee58e670f9c3fce46c40296ba9ee8a2Ian Hodson pass_all) 7673f4c12fce1ee58e670f9c3fce46c40296ba9ee8a2Ian Hodson # Don't check for shared/static. Everything works. 7674f4c12fce1ee58e670f9c3fce46c40296ba9ee8a2Ian Hodson # This might be a little naive. We might want to check 7675f4c12fce1ee58e670f9c3fce46c40296ba9ee8a2Ian Hodson # whether the library exists or not. But this is on 7676f4c12fce1ee58e670f9c3fce46c40296ba9ee8a2Ian Hodson # osf3 & osf4 and I'm not really sure... Just 7677f4c12fce1ee58e670f9c3fce46c40296ba9ee8a2Ian Hodson # implementing what was already the behavior. 7678f4c12fce1ee58e670f9c3fce46c40296ba9ee8a2Ian Hodson newdeplibs=$deplibs 7679f4c12fce1ee58e670f9c3fce46c40296ba9ee8a2Ian Hodson ;; 7680f4c12fce1ee58e670f9c3fce46c40296ba9ee8a2Ian Hodson test_compile) 7681f4c12fce1ee58e670f9c3fce46c40296ba9ee8a2Ian Hodson # This code stresses the "libraries are programs" paradigm to its 7682f4c12fce1ee58e670f9c3fce46c40296ba9ee8a2Ian Hodson # limits. Maybe even breaks it. We compile a program, linking it 7683f4c12fce1ee58e670f9c3fce46c40296ba9ee8a2Ian Hodson # against the deplibs as a proxy for the library. Then we can check 7684f4c12fce1ee58e670f9c3fce46c40296ba9ee8a2Ian Hodson # whether they linked in statically or dynamically with ldd. 7685f4c12fce1ee58e670f9c3fce46c40296ba9ee8a2Ian Hodson $opt_dry_run || $RM conftest.c 7686f4c12fce1ee58e670f9c3fce46c40296ba9ee8a2Ian Hodson cat > conftest.c <<EOF 7687f4c12fce1ee58e670f9c3fce46c40296ba9ee8a2Ian Hodson int main() { return 0; } 7688f4c12fce1ee58e670f9c3fce46c40296ba9ee8a2Ian HodsonEOF 7689f4c12fce1ee58e670f9c3fce46c40296ba9ee8a2Ian Hodson $opt_dry_run || $RM conftest 7690f4c12fce1ee58e670f9c3fce46c40296ba9ee8a2Ian Hodson if $LTCC $LTCFLAGS -o conftest conftest.c $deplibs; then 7691f4c12fce1ee58e670f9c3fce46c40296ba9ee8a2Ian Hodson ldd_output=`ldd conftest` 7692f4c12fce1ee58e670f9c3fce46c40296ba9ee8a2Ian Hodson for i in $deplibs; do 7693f4c12fce1ee58e670f9c3fce46c40296ba9ee8a2Ian Hodson case $i in 7694f4c12fce1ee58e670f9c3fce46c40296ba9ee8a2Ian Hodson -l*) 7695f4c12fce1ee58e670f9c3fce46c40296ba9ee8a2Ian Hodson func_stripname -l '' "$i" 7696f4c12fce1ee58e670f9c3fce46c40296ba9ee8a2Ian Hodson name=$func_stripname_result 7697f4c12fce1ee58e670f9c3fce46c40296ba9ee8a2Ian Hodson if test "X$allow_libtool_libs_with_static_runtimes" = "Xyes" ; then 7698f4c12fce1ee58e670f9c3fce46c40296ba9ee8a2Ian Hodson case " $predeps $postdeps " in 7699f4c12fce1ee58e670f9c3fce46c40296ba9ee8a2Ian Hodson *" $i "*) 77005b6dc79427b8f7eeb6a7ff68034ab8548ce670eaAlexander Gutkin func_append newdeplibs " $i" 7701f4c12fce1ee58e670f9c3fce46c40296ba9ee8a2Ian Hodson i="" 7702f4c12fce1ee58e670f9c3fce46c40296ba9ee8a2Ian Hodson ;; 7703f4c12fce1ee58e670f9c3fce46c40296ba9ee8a2Ian Hodson esac 7704f4c12fce1ee58e670f9c3fce46c40296ba9ee8a2Ian Hodson fi 7705f4c12fce1ee58e670f9c3fce46c40296ba9ee8a2Ian Hodson if test -n "$i" ; then 7706f4c12fce1ee58e670f9c3fce46c40296ba9ee8a2Ian Hodson libname=`eval "\\$ECHO \"$libname_spec\""` 7707f4c12fce1ee58e670f9c3fce46c40296ba9ee8a2Ian Hodson deplib_matches=`eval "\\$ECHO \"$library_names_spec\""` 7708f4c12fce1ee58e670f9c3fce46c40296ba9ee8a2Ian Hodson set dummy $deplib_matches; shift 7709f4c12fce1ee58e670f9c3fce46c40296ba9ee8a2Ian Hodson deplib_match=$1 7710f4c12fce1ee58e670f9c3fce46c40296ba9ee8a2Ian Hodson if test `expr "$ldd_output" : ".*$deplib_match"` -ne 0 ; then 77115b6dc79427b8f7eeb6a7ff68034ab8548ce670eaAlexander Gutkin func_append newdeplibs " $i" 7712f4c12fce1ee58e670f9c3fce46c40296ba9ee8a2Ian Hodson else 7713f4c12fce1ee58e670f9c3fce46c40296ba9ee8a2Ian Hodson droppeddeps=yes 77145b6dc79427b8f7eeb6a7ff68034ab8548ce670eaAlexander Gutkin echo 7715f4c12fce1ee58e670f9c3fce46c40296ba9ee8a2Ian Hodson $ECHO "*** Warning: dynamic linker does not accept needed library $i." 77165b6dc79427b8f7eeb6a7ff68034ab8548ce670eaAlexander Gutkin echo "*** I have the capability to make that library automatically link in when" 77175b6dc79427b8f7eeb6a7ff68034ab8548ce670eaAlexander Gutkin echo "*** you link to this library. But I can only do this if you have a" 77185b6dc79427b8f7eeb6a7ff68034ab8548ce670eaAlexander Gutkin echo "*** shared version of the library, which I believe you do not have" 77195b6dc79427b8f7eeb6a7ff68034ab8548ce670eaAlexander Gutkin echo "*** because a test_compile did reveal that the linker did not use it for" 77205b6dc79427b8f7eeb6a7ff68034ab8548ce670eaAlexander Gutkin echo "*** its dynamic dependency list that programs get resolved with at runtime." 7721f4c12fce1ee58e670f9c3fce46c40296ba9ee8a2Ian Hodson fi 7722f4c12fce1ee58e670f9c3fce46c40296ba9ee8a2Ian Hodson fi 7723f4c12fce1ee58e670f9c3fce46c40296ba9ee8a2Ian Hodson ;; 7724f4c12fce1ee58e670f9c3fce46c40296ba9ee8a2Ian Hodson *) 77255b6dc79427b8f7eeb6a7ff68034ab8548ce670eaAlexander Gutkin func_append newdeplibs " $i" 7726f4c12fce1ee58e670f9c3fce46c40296ba9ee8a2Ian Hodson ;; 7727f4c12fce1ee58e670f9c3fce46c40296ba9ee8a2Ian Hodson esac 7728f4c12fce1ee58e670f9c3fce46c40296ba9ee8a2Ian Hodson done 7729f4c12fce1ee58e670f9c3fce46c40296ba9ee8a2Ian Hodson else 7730f4c12fce1ee58e670f9c3fce46c40296ba9ee8a2Ian Hodson # Error occurred in the first compile. Let's try to salvage 7731f4c12fce1ee58e670f9c3fce46c40296ba9ee8a2Ian Hodson # the situation: Compile a separate program for each library. 7732f4c12fce1ee58e670f9c3fce46c40296ba9ee8a2Ian Hodson for i in $deplibs; do 7733f4c12fce1ee58e670f9c3fce46c40296ba9ee8a2Ian Hodson case $i in 7734f4c12fce1ee58e670f9c3fce46c40296ba9ee8a2Ian Hodson -l*) 7735f4c12fce1ee58e670f9c3fce46c40296ba9ee8a2Ian Hodson func_stripname -l '' "$i" 7736f4c12fce1ee58e670f9c3fce46c40296ba9ee8a2Ian Hodson name=$func_stripname_result 7737f4c12fce1ee58e670f9c3fce46c40296ba9ee8a2Ian Hodson $opt_dry_run || $RM conftest 7738f4c12fce1ee58e670f9c3fce46c40296ba9ee8a2Ian Hodson if $LTCC $LTCFLAGS -o conftest conftest.c $i; then 7739f4c12fce1ee58e670f9c3fce46c40296ba9ee8a2Ian Hodson ldd_output=`ldd conftest` 7740f4c12fce1ee58e670f9c3fce46c40296ba9ee8a2Ian Hodson if test "X$allow_libtool_libs_with_static_runtimes" = "Xyes" ; then 7741f4c12fce1ee58e670f9c3fce46c40296ba9ee8a2Ian Hodson case " $predeps $postdeps " in 7742f4c12fce1ee58e670f9c3fce46c40296ba9ee8a2Ian Hodson *" $i "*) 77435b6dc79427b8f7eeb6a7ff68034ab8548ce670eaAlexander Gutkin func_append newdeplibs " $i" 7744f4c12fce1ee58e670f9c3fce46c40296ba9ee8a2Ian Hodson i="" 7745f4c12fce1ee58e670f9c3fce46c40296ba9ee8a2Ian Hodson ;; 7746f4c12fce1ee58e670f9c3fce46c40296ba9ee8a2Ian Hodson esac 7747f4c12fce1ee58e670f9c3fce46c40296ba9ee8a2Ian Hodson fi 7748f4c12fce1ee58e670f9c3fce46c40296ba9ee8a2Ian Hodson if test -n "$i" ; then 7749f4c12fce1ee58e670f9c3fce46c40296ba9ee8a2Ian Hodson libname=`eval "\\$ECHO \"$libname_spec\""` 7750f4c12fce1ee58e670f9c3fce46c40296ba9ee8a2Ian Hodson deplib_matches=`eval "\\$ECHO \"$library_names_spec\""` 7751f4c12fce1ee58e670f9c3fce46c40296ba9ee8a2Ian Hodson set dummy $deplib_matches; shift 7752f4c12fce1ee58e670f9c3fce46c40296ba9ee8a2Ian Hodson deplib_match=$1 7753f4c12fce1ee58e670f9c3fce46c40296ba9ee8a2Ian Hodson if test `expr "$ldd_output" : ".*$deplib_match"` -ne 0 ; then 77545b6dc79427b8f7eeb6a7ff68034ab8548ce670eaAlexander Gutkin func_append newdeplibs " $i" 7755f4c12fce1ee58e670f9c3fce46c40296ba9ee8a2Ian Hodson else 7756f4c12fce1ee58e670f9c3fce46c40296ba9ee8a2Ian Hodson droppeddeps=yes 77575b6dc79427b8f7eeb6a7ff68034ab8548ce670eaAlexander Gutkin echo 7758f4c12fce1ee58e670f9c3fce46c40296ba9ee8a2Ian Hodson $ECHO "*** Warning: dynamic linker does not accept needed library $i." 77595b6dc79427b8f7eeb6a7ff68034ab8548ce670eaAlexander Gutkin echo "*** I have the capability to make that library automatically link in when" 77605b6dc79427b8f7eeb6a7ff68034ab8548ce670eaAlexander Gutkin echo "*** you link to this library. But I can only do this if you have a" 77615b6dc79427b8f7eeb6a7ff68034ab8548ce670eaAlexander Gutkin echo "*** shared version of the library, which you do not appear to have" 77625b6dc79427b8f7eeb6a7ff68034ab8548ce670eaAlexander Gutkin echo "*** because a test_compile did reveal that the linker did not use this one" 77635b6dc79427b8f7eeb6a7ff68034ab8548ce670eaAlexander Gutkin echo "*** as a dynamic dependency that programs can get resolved with at runtime." 7764f4c12fce1ee58e670f9c3fce46c40296ba9ee8a2Ian Hodson fi 7765f4c12fce1ee58e670f9c3fce46c40296ba9ee8a2Ian Hodson fi 7766f4c12fce1ee58e670f9c3fce46c40296ba9ee8a2Ian Hodson else 7767f4c12fce1ee58e670f9c3fce46c40296ba9ee8a2Ian Hodson droppeddeps=yes 77685b6dc79427b8f7eeb6a7ff68034ab8548ce670eaAlexander Gutkin echo 7769f4c12fce1ee58e670f9c3fce46c40296ba9ee8a2Ian Hodson $ECHO "*** Warning! Library $i is needed by this library but I was not able to" 77705b6dc79427b8f7eeb6a7ff68034ab8548ce670eaAlexander Gutkin echo "*** make it link in! You will probably need to install it or some" 77715b6dc79427b8f7eeb6a7ff68034ab8548ce670eaAlexander Gutkin echo "*** library that it depends on before this library will be fully" 77725b6dc79427b8f7eeb6a7ff68034ab8548ce670eaAlexander Gutkin echo "*** functional. Installing it before continuing would be even better." 7773f4c12fce1ee58e670f9c3fce46c40296ba9ee8a2Ian Hodson fi 7774f4c12fce1ee58e670f9c3fce46c40296ba9ee8a2Ian Hodson ;; 7775f4c12fce1ee58e670f9c3fce46c40296ba9ee8a2Ian Hodson *) 77765b6dc79427b8f7eeb6a7ff68034ab8548ce670eaAlexander Gutkin func_append newdeplibs " $i" 7777f4c12fce1ee58e670f9c3fce46c40296ba9ee8a2Ian Hodson ;; 7778f4c12fce1ee58e670f9c3fce46c40296ba9ee8a2Ian Hodson esac 7779f4c12fce1ee58e670f9c3fce46c40296ba9ee8a2Ian Hodson done 7780f4c12fce1ee58e670f9c3fce46c40296ba9ee8a2Ian Hodson fi 7781f4c12fce1ee58e670f9c3fce46c40296ba9ee8a2Ian Hodson ;; 7782f4c12fce1ee58e670f9c3fce46c40296ba9ee8a2Ian Hodson file_magic*) 7783f4c12fce1ee58e670f9c3fce46c40296ba9ee8a2Ian Hodson set dummy $deplibs_check_method; shift 7784f4c12fce1ee58e670f9c3fce46c40296ba9ee8a2Ian Hodson file_magic_regex=`expr "$deplibs_check_method" : "$1 \(.*\)"` 7785f4c12fce1ee58e670f9c3fce46c40296ba9ee8a2Ian Hodson for a_deplib in $deplibs; do 7786f4c12fce1ee58e670f9c3fce46c40296ba9ee8a2Ian Hodson case $a_deplib in 7787f4c12fce1ee58e670f9c3fce46c40296ba9ee8a2Ian Hodson -l*) 7788f4c12fce1ee58e670f9c3fce46c40296ba9ee8a2Ian Hodson func_stripname -l '' "$a_deplib" 7789f4c12fce1ee58e670f9c3fce46c40296ba9ee8a2Ian Hodson name=$func_stripname_result 7790f4c12fce1ee58e670f9c3fce46c40296ba9ee8a2Ian Hodson if test "X$allow_libtool_libs_with_static_runtimes" = "Xyes" ; then 7791f4c12fce1ee58e670f9c3fce46c40296ba9ee8a2Ian Hodson case " $predeps $postdeps " in 7792f4c12fce1ee58e670f9c3fce46c40296ba9ee8a2Ian Hodson *" $a_deplib "*) 77935b6dc79427b8f7eeb6a7ff68034ab8548ce670eaAlexander Gutkin func_append newdeplibs " $a_deplib" 7794f4c12fce1ee58e670f9c3fce46c40296ba9ee8a2Ian Hodson a_deplib="" 7795f4c12fce1ee58e670f9c3fce46c40296ba9ee8a2Ian Hodson ;; 7796f4c12fce1ee58e670f9c3fce46c40296ba9ee8a2Ian Hodson esac 7797f4c12fce1ee58e670f9c3fce46c40296ba9ee8a2Ian Hodson fi 7798f4c12fce1ee58e670f9c3fce46c40296ba9ee8a2Ian Hodson if test -n "$a_deplib" ; then 7799f4c12fce1ee58e670f9c3fce46c40296ba9ee8a2Ian Hodson libname=`eval "\\$ECHO \"$libname_spec\""` 78005b6dc79427b8f7eeb6a7ff68034ab8548ce670eaAlexander Gutkin if test -n "$file_magic_glob"; then 78015b6dc79427b8f7eeb6a7ff68034ab8548ce670eaAlexander Gutkin libnameglob=`func_echo_all "$libname" | $SED -e $file_magic_glob` 78025b6dc79427b8f7eeb6a7ff68034ab8548ce670eaAlexander Gutkin else 78035b6dc79427b8f7eeb6a7ff68034ab8548ce670eaAlexander Gutkin libnameglob=$libname 78045b6dc79427b8f7eeb6a7ff68034ab8548ce670eaAlexander Gutkin fi 78055b6dc79427b8f7eeb6a7ff68034ab8548ce670eaAlexander Gutkin test "$want_nocaseglob" = yes && nocaseglob=`shopt -p nocaseglob` 7806f4c12fce1ee58e670f9c3fce46c40296ba9ee8a2Ian Hodson for i in $lib_search_path $sys_lib_search_path $shlib_search_path; do 78075b6dc79427b8f7eeb6a7ff68034ab8548ce670eaAlexander Gutkin if test "$want_nocaseglob" = yes; then 78085b6dc79427b8f7eeb6a7ff68034ab8548ce670eaAlexander Gutkin shopt -s nocaseglob 78095b6dc79427b8f7eeb6a7ff68034ab8548ce670eaAlexander Gutkin potential_libs=`ls $i/$libnameglob[.-]* 2>/dev/null` 78105b6dc79427b8f7eeb6a7ff68034ab8548ce670eaAlexander Gutkin $nocaseglob 78115b6dc79427b8f7eeb6a7ff68034ab8548ce670eaAlexander Gutkin else 78125b6dc79427b8f7eeb6a7ff68034ab8548ce670eaAlexander Gutkin potential_libs=`ls $i/$libnameglob[.-]* 2>/dev/null` 78135b6dc79427b8f7eeb6a7ff68034ab8548ce670eaAlexander Gutkin fi 7814f4c12fce1ee58e670f9c3fce46c40296ba9ee8a2Ian Hodson for potent_lib in $potential_libs; do 7815f4c12fce1ee58e670f9c3fce46c40296ba9ee8a2Ian Hodson # Follow soft links. 7816f4c12fce1ee58e670f9c3fce46c40296ba9ee8a2Ian Hodson if ls -lLd "$potent_lib" 2>/dev/null | 7817f4c12fce1ee58e670f9c3fce46c40296ba9ee8a2Ian Hodson $GREP " -> " >/dev/null; then 7818f4c12fce1ee58e670f9c3fce46c40296ba9ee8a2Ian Hodson continue 7819f4c12fce1ee58e670f9c3fce46c40296ba9ee8a2Ian Hodson fi 7820f4c12fce1ee58e670f9c3fce46c40296ba9ee8a2Ian Hodson # The statement above tries to avoid entering an 7821f4c12fce1ee58e670f9c3fce46c40296ba9ee8a2Ian Hodson # endless loop below, in case of cyclic links. 7822f4c12fce1ee58e670f9c3fce46c40296ba9ee8a2Ian Hodson # We might still enter an endless loop, since a link 7823f4c12fce1ee58e670f9c3fce46c40296ba9ee8a2Ian Hodson # loop can be closed while we follow links, 7824f4c12fce1ee58e670f9c3fce46c40296ba9ee8a2Ian Hodson # but so what? 7825f4c12fce1ee58e670f9c3fce46c40296ba9ee8a2Ian Hodson potlib="$potent_lib" 7826f4c12fce1ee58e670f9c3fce46c40296ba9ee8a2Ian Hodson while test -h "$potlib" 2>/dev/null; do 7827f4c12fce1ee58e670f9c3fce46c40296ba9ee8a2Ian Hodson potliblink=`ls -ld $potlib | ${SED} 's/.* -> //'` 7828f4c12fce1ee58e670f9c3fce46c40296ba9ee8a2Ian Hodson case $potliblink in 7829f4c12fce1ee58e670f9c3fce46c40296ba9ee8a2Ian Hodson [\\/]* | [A-Za-z]:[\\/]*) potlib="$potliblink";; 78305b6dc79427b8f7eeb6a7ff68034ab8548ce670eaAlexander Gutkin *) potlib=`$ECHO "$potlib" | $SED 's,[^/]*$,,'`"$potliblink";; 7831f4c12fce1ee58e670f9c3fce46c40296ba9ee8a2Ian Hodson esac 7832f4c12fce1ee58e670f9c3fce46c40296ba9ee8a2Ian Hodson done 7833f4c12fce1ee58e670f9c3fce46c40296ba9ee8a2Ian Hodson if eval $file_magic_cmd \"\$potlib\" 2>/dev/null | 7834f4c12fce1ee58e670f9c3fce46c40296ba9ee8a2Ian Hodson $SED -e 10q | 7835f4c12fce1ee58e670f9c3fce46c40296ba9ee8a2Ian Hodson $EGREP "$file_magic_regex" > /dev/null; then 78365b6dc79427b8f7eeb6a7ff68034ab8548ce670eaAlexander Gutkin func_append newdeplibs " $a_deplib" 7837f4c12fce1ee58e670f9c3fce46c40296ba9ee8a2Ian Hodson a_deplib="" 7838f4c12fce1ee58e670f9c3fce46c40296ba9ee8a2Ian Hodson break 2 7839f4c12fce1ee58e670f9c3fce46c40296ba9ee8a2Ian Hodson fi 7840f4c12fce1ee58e670f9c3fce46c40296ba9ee8a2Ian Hodson done 7841f4c12fce1ee58e670f9c3fce46c40296ba9ee8a2Ian Hodson done 7842f4c12fce1ee58e670f9c3fce46c40296ba9ee8a2Ian Hodson fi 7843f4c12fce1ee58e670f9c3fce46c40296ba9ee8a2Ian Hodson if test -n "$a_deplib" ; then 7844f4c12fce1ee58e670f9c3fce46c40296ba9ee8a2Ian Hodson droppeddeps=yes 78455b6dc79427b8f7eeb6a7ff68034ab8548ce670eaAlexander Gutkin echo 7846f4c12fce1ee58e670f9c3fce46c40296ba9ee8a2Ian Hodson $ECHO "*** Warning: linker path does not have real file for library $a_deplib." 78475b6dc79427b8f7eeb6a7ff68034ab8548ce670eaAlexander Gutkin echo "*** I have the capability to make that library automatically link in when" 78485b6dc79427b8f7eeb6a7ff68034ab8548ce670eaAlexander Gutkin echo "*** you link to this library. But I can only do this if you have a" 78495b6dc79427b8f7eeb6a7ff68034ab8548ce670eaAlexander Gutkin echo "*** shared version of the library, which you do not appear to have" 78505b6dc79427b8f7eeb6a7ff68034ab8548ce670eaAlexander Gutkin echo "*** because I did check the linker path looking for a file starting" 7851f4c12fce1ee58e670f9c3fce46c40296ba9ee8a2Ian Hodson if test -z "$potlib" ; then 7852f4c12fce1ee58e670f9c3fce46c40296ba9ee8a2Ian Hodson $ECHO "*** with $libname but no candidates were found. (...for file magic test)" 7853f4c12fce1ee58e670f9c3fce46c40296ba9ee8a2Ian Hodson else 7854f4c12fce1ee58e670f9c3fce46c40296ba9ee8a2Ian Hodson $ECHO "*** with $libname and none of the candidates passed a file format test" 7855f4c12fce1ee58e670f9c3fce46c40296ba9ee8a2Ian Hodson $ECHO "*** using a file magic. Last file checked: $potlib" 7856f4c12fce1ee58e670f9c3fce46c40296ba9ee8a2Ian Hodson fi 7857f4c12fce1ee58e670f9c3fce46c40296ba9ee8a2Ian Hodson fi 7858f4c12fce1ee58e670f9c3fce46c40296ba9ee8a2Ian Hodson ;; 7859f4c12fce1ee58e670f9c3fce46c40296ba9ee8a2Ian Hodson *) 7860f4c12fce1ee58e670f9c3fce46c40296ba9ee8a2Ian Hodson # Add a -L argument. 78615b6dc79427b8f7eeb6a7ff68034ab8548ce670eaAlexander Gutkin func_append newdeplibs " $a_deplib" 7862f4c12fce1ee58e670f9c3fce46c40296ba9ee8a2Ian Hodson ;; 7863f4c12fce1ee58e670f9c3fce46c40296ba9ee8a2Ian Hodson esac 7864f4c12fce1ee58e670f9c3fce46c40296ba9ee8a2Ian Hodson done # Gone through all deplibs. 7865f4c12fce1ee58e670f9c3fce46c40296ba9ee8a2Ian Hodson ;; 7866f4c12fce1ee58e670f9c3fce46c40296ba9ee8a2Ian Hodson match_pattern*) 7867f4c12fce1ee58e670f9c3fce46c40296ba9ee8a2Ian Hodson set dummy $deplibs_check_method; shift 7868f4c12fce1ee58e670f9c3fce46c40296ba9ee8a2Ian Hodson match_pattern_regex=`expr "$deplibs_check_method" : "$1 \(.*\)"` 7869f4c12fce1ee58e670f9c3fce46c40296ba9ee8a2Ian Hodson for a_deplib in $deplibs; do 7870f4c12fce1ee58e670f9c3fce46c40296ba9ee8a2Ian Hodson case $a_deplib in 7871f4c12fce1ee58e670f9c3fce46c40296ba9ee8a2Ian Hodson -l*) 7872f4c12fce1ee58e670f9c3fce46c40296ba9ee8a2Ian Hodson func_stripname -l '' "$a_deplib" 7873f4c12fce1ee58e670f9c3fce46c40296ba9ee8a2Ian Hodson name=$func_stripname_result 7874f4c12fce1ee58e670f9c3fce46c40296ba9ee8a2Ian Hodson if test "X$allow_libtool_libs_with_static_runtimes" = "Xyes" ; then 7875f4c12fce1ee58e670f9c3fce46c40296ba9ee8a2Ian Hodson case " $predeps $postdeps " in 7876f4c12fce1ee58e670f9c3fce46c40296ba9ee8a2Ian Hodson *" $a_deplib "*) 78775b6dc79427b8f7eeb6a7ff68034ab8548ce670eaAlexander Gutkin func_append newdeplibs " $a_deplib" 7878f4c12fce1ee58e670f9c3fce46c40296ba9ee8a2Ian Hodson a_deplib="" 7879f4c12fce1ee58e670f9c3fce46c40296ba9ee8a2Ian Hodson ;; 7880f4c12fce1ee58e670f9c3fce46c40296ba9ee8a2Ian Hodson esac 7881f4c12fce1ee58e670f9c3fce46c40296ba9ee8a2Ian Hodson fi 7882f4c12fce1ee58e670f9c3fce46c40296ba9ee8a2Ian Hodson if test -n "$a_deplib" ; then 7883f4c12fce1ee58e670f9c3fce46c40296ba9ee8a2Ian Hodson libname=`eval "\\$ECHO \"$libname_spec\""` 7884f4c12fce1ee58e670f9c3fce46c40296ba9ee8a2Ian Hodson for i in $lib_search_path $sys_lib_search_path $shlib_search_path; do 7885f4c12fce1ee58e670f9c3fce46c40296ba9ee8a2Ian Hodson potential_libs=`ls $i/$libname[.-]* 2>/dev/null` 7886f4c12fce1ee58e670f9c3fce46c40296ba9ee8a2Ian Hodson for potent_lib in $potential_libs; do 7887f4c12fce1ee58e670f9c3fce46c40296ba9ee8a2Ian Hodson potlib="$potent_lib" # see symlink-check above in file_magic test 78885b6dc79427b8f7eeb6a7ff68034ab8548ce670eaAlexander Gutkin if eval "\$ECHO \"$potent_lib\"" 2>/dev/null | $SED 10q | \ 7889f4c12fce1ee58e670f9c3fce46c40296ba9ee8a2Ian Hodson $EGREP "$match_pattern_regex" > /dev/null; then 78905b6dc79427b8f7eeb6a7ff68034ab8548ce670eaAlexander Gutkin func_append newdeplibs " $a_deplib" 7891f4c12fce1ee58e670f9c3fce46c40296ba9ee8a2Ian Hodson a_deplib="" 7892f4c12fce1ee58e670f9c3fce46c40296ba9ee8a2Ian Hodson break 2 7893f4c12fce1ee58e670f9c3fce46c40296ba9ee8a2Ian Hodson fi 7894f4c12fce1ee58e670f9c3fce46c40296ba9ee8a2Ian Hodson done 7895f4c12fce1ee58e670f9c3fce46c40296ba9ee8a2Ian Hodson done 7896f4c12fce1ee58e670f9c3fce46c40296ba9ee8a2Ian Hodson fi 7897f4c12fce1ee58e670f9c3fce46c40296ba9ee8a2Ian Hodson if test -n "$a_deplib" ; then 7898f4c12fce1ee58e670f9c3fce46c40296ba9ee8a2Ian Hodson droppeddeps=yes 78995b6dc79427b8f7eeb6a7ff68034ab8548ce670eaAlexander Gutkin echo 7900f4c12fce1ee58e670f9c3fce46c40296ba9ee8a2Ian Hodson $ECHO "*** Warning: linker path does not have real file for library $a_deplib." 79015b6dc79427b8f7eeb6a7ff68034ab8548ce670eaAlexander Gutkin echo "*** I have the capability to make that library automatically link in when" 79025b6dc79427b8f7eeb6a7ff68034ab8548ce670eaAlexander Gutkin echo "*** you link to this library. But I can only do this if you have a" 79035b6dc79427b8f7eeb6a7ff68034ab8548ce670eaAlexander Gutkin echo "*** shared version of the library, which you do not appear to have" 79045b6dc79427b8f7eeb6a7ff68034ab8548ce670eaAlexander Gutkin echo "*** because I did check the linker path looking for a file starting" 7905f4c12fce1ee58e670f9c3fce46c40296ba9ee8a2Ian Hodson if test -z "$potlib" ; then 7906f4c12fce1ee58e670f9c3fce46c40296ba9ee8a2Ian Hodson $ECHO "*** with $libname but no candidates were found. (...for regex pattern test)" 7907f4c12fce1ee58e670f9c3fce46c40296ba9ee8a2Ian Hodson else 7908f4c12fce1ee58e670f9c3fce46c40296ba9ee8a2Ian Hodson $ECHO "*** with $libname and none of the candidates passed a file format test" 7909f4c12fce1ee58e670f9c3fce46c40296ba9ee8a2Ian Hodson $ECHO "*** using a regex pattern. Last file checked: $potlib" 7910f4c12fce1ee58e670f9c3fce46c40296ba9ee8a2Ian Hodson fi 7911f4c12fce1ee58e670f9c3fce46c40296ba9ee8a2Ian Hodson fi 7912f4c12fce1ee58e670f9c3fce46c40296ba9ee8a2Ian Hodson ;; 7913f4c12fce1ee58e670f9c3fce46c40296ba9ee8a2Ian Hodson *) 7914f4c12fce1ee58e670f9c3fce46c40296ba9ee8a2Ian Hodson # Add a -L argument. 79155b6dc79427b8f7eeb6a7ff68034ab8548ce670eaAlexander Gutkin func_append newdeplibs " $a_deplib" 7916f4c12fce1ee58e670f9c3fce46c40296ba9ee8a2Ian Hodson ;; 7917f4c12fce1ee58e670f9c3fce46c40296ba9ee8a2Ian Hodson esac 7918f4c12fce1ee58e670f9c3fce46c40296ba9ee8a2Ian Hodson done # Gone through all deplibs. 7919f4c12fce1ee58e670f9c3fce46c40296ba9ee8a2Ian Hodson ;; 7920f4c12fce1ee58e670f9c3fce46c40296ba9ee8a2Ian Hodson none | unknown | *) 7921f4c12fce1ee58e670f9c3fce46c40296ba9ee8a2Ian Hodson newdeplibs="" 79225b6dc79427b8f7eeb6a7ff68034ab8548ce670eaAlexander Gutkin tmp_deplibs=`$ECHO " $deplibs" | $SED 's/ -lc$//; s/ -[LR][^ ]*//g'` 7923f4c12fce1ee58e670f9c3fce46c40296ba9ee8a2Ian Hodson if test "X$allow_libtool_libs_with_static_runtimes" = "Xyes" ; then 7924f4c12fce1ee58e670f9c3fce46c40296ba9ee8a2Ian Hodson for i in $predeps $postdeps ; do 7925f4c12fce1ee58e670f9c3fce46c40296ba9ee8a2Ian Hodson # can't use Xsed below, because $i might contain '/' 79265b6dc79427b8f7eeb6a7ff68034ab8548ce670eaAlexander Gutkin tmp_deplibs=`$ECHO " $tmp_deplibs" | $SED "s,$i,,"` 7927f4c12fce1ee58e670f9c3fce46c40296ba9ee8a2Ian Hodson done 7928f4c12fce1ee58e670f9c3fce46c40296ba9ee8a2Ian Hodson fi 79295b6dc79427b8f7eeb6a7ff68034ab8548ce670eaAlexander Gutkin case $tmp_deplibs in 79305b6dc79427b8f7eeb6a7ff68034ab8548ce670eaAlexander Gutkin *[!\ \ ]*) 79315b6dc79427b8f7eeb6a7ff68034ab8548ce670eaAlexander Gutkin echo 7932f4c12fce1ee58e670f9c3fce46c40296ba9ee8a2Ian Hodson if test "X$deplibs_check_method" = "Xnone"; then 79335b6dc79427b8f7eeb6a7ff68034ab8548ce670eaAlexander Gutkin echo "*** Warning: inter-library dependencies are not supported in this platform." 7934f4c12fce1ee58e670f9c3fce46c40296ba9ee8a2Ian Hodson else 79355b6dc79427b8f7eeb6a7ff68034ab8548ce670eaAlexander Gutkin echo "*** Warning: inter-library dependencies are not known to be supported." 7936f4c12fce1ee58e670f9c3fce46c40296ba9ee8a2Ian Hodson fi 79375b6dc79427b8f7eeb6a7ff68034ab8548ce670eaAlexander Gutkin echo "*** All declared inter-library dependencies are being dropped." 7938f4c12fce1ee58e670f9c3fce46c40296ba9ee8a2Ian Hodson droppeddeps=yes 79395b6dc79427b8f7eeb6a7ff68034ab8548ce670eaAlexander Gutkin ;; 79405b6dc79427b8f7eeb6a7ff68034ab8548ce670eaAlexander Gutkin esac 7941f4c12fce1ee58e670f9c3fce46c40296ba9ee8a2Ian Hodson ;; 7942f4c12fce1ee58e670f9c3fce46c40296ba9ee8a2Ian Hodson esac 7943f4c12fce1ee58e670f9c3fce46c40296ba9ee8a2Ian Hodson versuffix=$versuffix_save 7944f4c12fce1ee58e670f9c3fce46c40296ba9ee8a2Ian Hodson major=$major_save 7945f4c12fce1ee58e670f9c3fce46c40296ba9ee8a2Ian Hodson release=$release_save 7946f4c12fce1ee58e670f9c3fce46c40296ba9ee8a2Ian Hodson libname=$libname_save 7947f4c12fce1ee58e670f9c3fce46c40296ba9ee8a2Ian Hodson name=$name_save 7948f4c12fce1ee58e670f9c3fce46c40296ba9ee8a2Ian Hodson 7949f4c12fce1ee58e670f9c3fce46c40296ba9ee8a2Ian Hodson case $host in 7950f4c12fce1ee58e670f9c3fce46c40296ba9ee8a2Ian Hodson *-*-rhapsody* | *-*-darwin1.[012]) 7951f4c12fce1ee58e670f9c3fce46c40296ba9ee8a2Ian Hodson # On Rhapsody replace the C library with the System framework 79525b6dc79427b8f7eeb6a7ff68034ab8548ce670eaAlexander Gutkin newdeplibs=`$ECHO " $newdeplibs" | $SED 's/ -lc / System.ltframework /'` 7953f4c12fce1ee58e670f9c3fce46c40296ba9ee8a2Ian Hodson ;; 7954f4c12fce1ee58e670f9c3fce46c40296ba9ee8a2Ian Hodson esac 7955f4c12fce1ee58e670f9c3fce46c40296ba9ee8a2Ian Hodson 7956f4c12fce1ee58e670f9c3fce46c40296ba9ee8a2Ian Hodson if test "$droppeddeps" = yes; then 7957f4c12fce1ee58e670f9c3fce46c40296ba9ee8a2Ian Hodson if test "$module" = yes; then 79585b6dc79427b8f7eeb6a7ff68034ab8548ce670eaAlexander Gutkin echo 79595b6dc79427b8f7eeb6a7ff68034ab8548ce670eaAlexander Gutkin echo "*** Warning: libtool could not satisfy all declared inter-library" 7960f4c12fce1ee58e670f9c3fce46c40296ba9ee8a2Ian Hodson $ECHO "*** dependencies of module $libname. Therefore, libtool will create" 79615b6dc79427b8f7eeb6a7ff68034ab8548ce670eaAlexander Gutkin echo "*** a static module, that should work as long as the dlopening" 79625b6dc79427b8f7eeb6a7ff68034ab8548ce670eaAlexander Gutkin echo "*** application is linked with the -dlopen flag." 7963f4c12fce1ee58e670f9c3fce46c40296ba9ee8a2Ian Hodson if test -z "$global_symbol_pipe"; then 79645b6dc79427b8f7eeb6a7ff68034ab8548ce670eaAlexander Gutkin echo 79655b6dc79427b8f7eeb6a7ff68034ab8548ce670eaAlexander Gutkin echo "*** However, this would only work if libtool was able to extract symbol" 79665b6dc79427b8f7eeb6a7ff68034ab8548ce670eaAlexander Gutkin echo "*** lists from a program, using \`nm' or equivalent, but libtool could" 79675b6dc79427b8f7eeb6a7ff68034ab8548ce670eaAlexander Gutkin echo "*** not find such a program. So, this module is probably useless." 79685b6dc79427b8f7eeb6a7ff68034ab8548ce670eaAlexander Gutkin echo "*** \`nm' from GNU binutils and a full rebuild may help." 7969f4c12fce1ee58e670f9c3fce46c40296ba9ee8a2Ian Hodson fi 7970f4c12fce1ee58e670f9c3fce46c40296ba9ee8a2Ian Hodson if test "$build_old_libs" = no; then 7971f4c12fce1ee58e670f9c3fce46c40296ba9ee8a2Ian Hodson oldlibs="$output_objdir/$libname.$libext" 7972f4c12fce1ee58e670f9c3fce46c40296ba9ee8a2Ian Hodson build_libtool_libs=module 7973f4c12fce1ee58e670f9c3fce46c40296ba9ee8a2Ian Hodson build_old_libs=yes 7974f4c12fce1ee58e670f9c3fce46c40296ba9ee8a2Ian Hodson else 7975f4c12fce1ee58e670f9c3fce46c40296ba9ee8a2Ian Hodson build_libtool_libs=no 7976f4c12fce1ee58e670f9c3fce46c40296ba9ee8a2Ian Hodson fi 7977f4c12fce1ee58e670f9c3fce46c40296ba9ee8a2Ian Hodson else 79785b6dc79427b8f7eeb6a7ff68034ab8548ce670eaAlexander Gutkin echo "*** The inter-library dependencies that have been dropped here will be" 79795b6dc79427b8f7eeb6a7ff68034ab8548ce670eaAlexander Gutkin echo "*** automatically added whenever a program is linked with this library" 79805b6dc79427b8f7eeb6a7ff68034ab8548ce670eaAlexander Gutkin echo "*** or is declared to -dlopen it." 7981f4c12fce1ee58e670f9c3fce46c40296ba9ee8a2Ian Hodson 7982f4c12fce1ee58e670f9c3fce46c40296ba9ee8a2Ian Hodson if test "$allow_undefined" = no; then 79835b6dc79427b8f7eeb6a7ff68034ab8548ce670eaAlexander Gutkin echo 79845b6dc79427b8f7eeb6a7ff68034ab8548ce670eaAlexander Gutkin echo "*** Since this library must not contain undefined symbols," 79855b6dc79427b8f7eeb6a7ff68034ab8548ce670eaAlexander Gutkin echo "*** because either the platform does not support them or" 79865b6dc79427b8f7eeb6a7ff68034ab8548ce670eaAlexander Gutkin echo "*** it was explicitly requested with -no-undefined," 79875b6dc79427b8f7eeb6a7ff68034ab8548ce670eaAlexander Gutkin echo "*** libtool will only create a static version of it." 7988f4c12fce1ee58e670f9c3fce46c40296ba9ee8a2Ian Hodson if test "$build_old_libs" = no; then 7989f4c12fce1ee58e670f9c3fce46c40296ba9ee8a2Ian Hodson oldlibs="$output_objdir/$libname.$libext" 7990f4c12fce1ee58e670f9c3fce46c40296ba9ee8a2Ian Hodson build_libtool_libs=module 7991f4c12fce1ee58e670f9c3fce46c40296ba9ee8a2Ian Hodson build_old_libs=yes 7992f4c12fce1ee58e670f9c3fce46c40296ba9ee8a2Ian Hodson else 7993f4c12fce1ee58e670f9c3fce46c40296ba9ee8a2Ian Hodson build_libtool_libs=no 7994f4c12fce1ee58e670f9c3fce46c40296ba9ee8a2Ian Hodson fi 7995f4c12fce1ee58e670f9c3fce46c40296ba9ee8a2Ian Hodson fi 7996f4c12fce1ee58e670f9c3fce46c40296ba9ee8a2Ian Hodson fi 7997f4c12fce1ee58e670f9c3fce46c40296ba9ee8a2Ian Hodson fi 7998f4c12fce1ee58e670f9c3fce46c40296ba9ee8a2Ian Hodson # Done checking deplibs! 7999f4c12fce1ee58e670f9c3fce46c40296ba9ee8a2Ian Hodson deplibs=$newdeplibs 8000f4c12fce1ee58e670f9c3fce46c40296ba9ee8a2Ian Hodson fi 8001f4c12fce1ee58e670f9c3fce46c40296ba9ee8a2Ian Hodson # Time to change all our "foo.ltframework" stuff back to "-framework foo" 8002f4c12fce1ee58e670f9c3fce46c40296ba9ee8a2Ian Hodson case $host in 8003f4c12fce1ee58e670f9c3fce46c40296ba9ee8a2Ian Hodson *-*-darwin*) 80045b6dc79427b8f7eeb6a7ff68034ab8548ce670eaAlexander Gutkin newdeplibs=`$ECHO " $newdeplibs" | $SED 's% \([^ $]*\).ltframework% -framework \1%g'` 80055b6dc79427b8f7eeb6a7ff68034ab8548ce670eaAlexander Gutkin new_inherited_linker_flags=`$ECHO " $new_inherited_linker_flags" | $SED 's% \([^ $]*\).ltframework% -framework \1%g'` 80065b6dc79427b8f7eeb6a7ff68034ab8548ce670eaAlexander Gutkin deplibs=`$ECHO " $deplibs" | $SED 's% \([^ $]*\).ltframework% -framework \1%g'` 8007f4c12fce1ee58e670f9c3fce46c40296ba9ee8a2Ian Hodson ;; 8008f4c12fce1ee58e670f9c3fce46c40296ba9ee8a2Ian Hodson esac 8009f4c12fce1ee58e670f9c3fce46c40296ba9ee8a2Ian Hodson 8010f4c12fce1ee58e670f9c3fce46c40296ba9ee8a2Ian Hodson # move library search paths that coincide with paths to not yet 8011f4c12fce1ee58e670f9c3fce46c40296ba9ee8a2Ian Hodson # installed libraries to the beginning of the library search list 8012f4c12fce1ee58e670f9c3fce46c40296ba9ee8a2Ian Hodson new_libs= 8013f4c12fce1ee58e670f9c3fce46c40296ba9ee8a2Ian Hodson for path in $notinst_path; do 8014f4c12fce1ee58e670f9c3fce46c40296ba9ee8a2Ian Hodson case " $new_libs " in 8015f4c12fce1ee58e670f9c3fce46c40296ba9ee8a2Ian Hodson *" -L$path/$objdir "*) ;; 8016f4c12fce1ee58e670f9c3fce46c40296ba9ee8a2Ian Hodson *) 8017f4c12fce1ee58e670f9c3fce46c40296ba9ee8a2Ian Hodson case " $deplibs " in 8018f4c12fce1ee58e670f9c3fce46c40296ba9ee8a2Ian Hodson *" -L$path/$objdir "*) 80195b6dc79427b8f7eeb6a7ff68034ab8548ce670eaAlexander Gutkin func_append new_libs " -L$path/$objdir" ;; 8020f4c12fce1ee58e670f9c3fce46c40296ba9ee8a2Ian Hodson esac 8021f4c12fce1ee58e670f9c3fce46c40296ba9ee8a2Ian Hodson ;; 8022f4c12fce1ee58e670f9c3fce46c40296ba9ee8a2Ian Hodson esac 8023f4c12fce1ee58e670f9c3fce46c40296ba9ee8a2Ian Hodson done 8024f4c12fce1ee58e670f9c3fce46c40296ba9ee8a2Ian Hodson for deplib in $deplibs; do 8025f4c12fce1ee58e670f9c3fce46c40296ba9ee8a2Ian Hodson case $deplib in 8026f4c12fce1ee58e670f9c3fce46c40296ba9ee8a2Ian Hodson -L*) 8027f4c12fce1ee58e670f9c3fce46c40296ba9ee8a2Ian Hodson case " $new_libs " in 8028f4c12fce1ee58e670f9c3fce46c40296ba9ee8a2Ian Hodson *" $deplib "*) ;; 80295b6dc79427b8f7eeb6a7ff68034ab8548ce670eaAlexander Gutkin *) func_append new_libs " $deplib" ;; 8030f4c12fce1ee58e670f9c3fce46c40296ba9ee8a2Ian Hodson esac 8031f4c12fce1ee58e670f9c3fce46c40296ba9ee8a2Ian Hodson ;; 80325b6dc79427b8f7eeb6a7ff68034ab8548ce670eaAlexander Gutkin *) func_append new_libs " $deplib" ;; 8033f4c12fce1ee58e670f9c3fce46c40296ba9ee8a2Ian Hodson esac 8034f4c12fce1ee58e670f9c3fce46c40296ba9ee8a2Ian Hodson done 8035f4c12fce1ee58e670f9c3fce46c40296ba9ee8a2Ian Hodson deplibs="$new_libs" 8036f4c12fce1ee58e670f9c3fce46c40296ba9ee8a2Ian Hodson 8037f4c12fce1ee58e670f9c3fce46c40296ba9ee8a2Ian Hodson # All the library-specific variables (install_libdir is set above). 8038f4c12fce1ee58e670f9c3fce46c40296ba9ee8a2Ian Hodson library_names= 8039f4c12fce1ee58e670f9c3fce46c40296ba9ee8a2Ian Hodson old_library= 8040f4c12fce1ee58e670f9c3fce46c40296ba9ee8a2Ian Hodson dlname= 8041f4c12fce1ee58e670f9c3fce46c40296ba9ee8a2Ian Hodson 8042f4c12fce1ee58e670f9c3fce46c40296ba9ee8a2Ian Hodson # Test again, we may have decided not to build it any more 8043f4c12fce1ee58e670f9c3fce46c40296ba9ee8a2Ian Hodson if test "$build_libtool_libs" = yes; then 80445b6dc79427b8f7eeb6a7ff68034ab8548ce670eaAlexander Gutkin # Remove ${wl} instances when linking with ld. 80455b6dc79427b8f7eeb6a7ff68034ab8548ce670eaAlexander Gutkin # FIXME: should test the right _cmds variable. 80465b6dc79427b8f7eeb6a7ff68034ab8548ce670eaAlexander Gutkin case $archive_cmds in 80475b6dc79427b8f7eeb6a7ff68034ab8548ce670eaAlexander Gutkin *\$LD\ *) wl= ;; 80485b6dc79427b8f7eeb6a7ff68034ab8548ce670eaAlexander Gutkin esac 8049f4c12fce1ee58e670f9c3fce46c40296ba9ee8a2Ian Hodson if test "$hardcode_into_libs" = yes; then 8050f4c12fce1ee58e670f9c3fce46c40296ba9ee8a2Ian Hodson # Hardcode the library paths 8051f4c12fce1ee58e670f9c3fce46c40296ba9ee8a2Ian Hodson hardcode_libdirs= 8052f4c12fce1ee58e670f9c3fce46c40296ba9ee8a2Ian Hodson dep_rpath= 8053f4c12fce1ee58e670f9c3fce46c40296ba9ee8a2Ian Hodson rpath="$finalize_rpath" 80545b6dc79427b8f7eeb6a7ff68034ab8548ce670eaAlexander Gutkin test "$opt_mode" != relink && rpath="$compile_rpath$rpath" 8055f4c12fce1ee58e670f9c3fce46c40296ba9ee8a2Ian Hodson for libdir in $rpath; do 8056f4c12fce1ee58e670f9c3fce46c40296ba9ee8a2Ian Hodson if test -n "$hardcode_libdir_flag_spec"; then 8057f4c12fce1ee58e670f9c3fce46c40296ba9ee8a2Ian Hodson if test -n "$hardcode_libdir_separator"; then 80585b6dc79427b8f7eeb6a7ff68034ab8548ce670eaAlexander Gutkin func_replace_sysroot "$libdir" 80595b6dc79427b8f7eeb6a7ff68034ab8548ce670eaAlexander Gutkin libdir=$func_replace_sysroot_result 8060f4c12fce1ee58e670f9c3fce46c40296ba9ee8a2Ian Hodson if test -z "$hardcode_libdirs"; then 8061f4c12fce1ee58e670f9c3fce46c40296ba9ee8a2Ian Hodson hardcode_libdirs="$libdir" 8062f4c12fce1ee58e670f9c3fce46c40296ba9ee8a2Ian Hodson else 8063f4c12fce1ee58e670f9c3fce46c40296ba9ee8a2Ian Hodson # Just accumulate the unique libdirs. 8064f4c12fce1ee58e670f9c3fce46c40296ba9ee8a2Ian Hodson case $hardcode_libdir_separator$hardcode_libdirs$hardcode_libdir_separator in 8065f4c12fce1ee58e670f9c3fce46c40296ba9ee8a2Ian Hodson *"$hardcode_libdir_separator$libdir$hardcode_libdir_separator"*) 8066f4c12fce1ee58e670f9c3fce46c40296ba9ee8a2Ian Hodson ;; 8067f4c12fce1ee58e670f9c3fce46c40296ba9ee8a2Ian Hodson *) 80685b6dc79427b8f7eeb6a7ff68034ab8548ce670eaAlexander Gutkin func_append hardcode_libdirs "$hardcode_libdir_separator$libdir" 8069f4c12fce1ee58e670f9c3fce46c40296ba9ee8a2Ian Hodson ;; 8070f4c12fce1ee58e670f9c3fce46c40296ba9ee8a2Ian Hodson esac 8071f4c12fce1ee58e670f9c3fce46c40296ba9ee8a2Ian Hodson fi 8072f4c12fce1ee58e670f9c3fce46c40296ba9ee8a2Ian Hodson else 8073f4c12fce1ee58e670f9c3fce46c40296ba9ee8a2Ian Hodson eval flag=\"$hardcode_libdir_flag_spec\" 80745b6dc79427b8f7eeb6a7ff68034ab8548ce670eaAlexander Gutkin func_append dep_rpath " $flag" 8075f4c12fce1ee58e670f9c3fce46c40296ba9ee8a2Ian Hodson fi 8076f4c12fce1ee58e670f9c3fce46c40296ba9ee8a2Ian Hodson elif test -n "$runpath_var"; then 8077f4c12fce1ee58e670f9c3fce46c40296ba9ee8a2Ian Hodson case "$perm_rpath " in 8078f4c12fce1ee58e670f9c3fce46c40296ba9ee8a2Ian Hodson *" $libdir "*) ;; 80795b6dc79427b8f7eeb6a7ff68034ab8548ce670eaAlexander Gutkin *) func_append perm_rpath " $libdir" ;; 8080f4c12fce1ee58e670f9c3fce46c40296ba9ee8a2Ian Hodson esac 8081f4c12fce1ee58e670f9c3fce46c40296ba9ee8a2Ian Hodson fi 8082f4c12fce1ee58e670f9c3fce46c40296ba9ee8a2Ian Hodson done 8083f4c12fce1ee58e670f9c3fce46c40296ba9ee8a2Ian Hodson # Substitute the hardcoded libdirs into the rpath. 8084f4c12fce1ee58e670f9c3fce46c40296ba9ee8a2Ian Hodson if test -n "$hardcode_libdir_separator" && 8085f4c12fce1ee58e670f9c3fce46c40296ba9ee8a2Ian Hodson test -n "$hardcode_libdirs"; then 8086f4c12fce1ee58e670f9c3fce46c40296ba9ee8a2Ian Hodson libdir="$hardcode_libdirs" 80875b6dc79427b8f7eeb6a7ff68034ab8548ce670eaAlexander Gutkin eval "dep_rpath=\"$hardcode_libdir_flag_spec\"" 8088f4c12fce1ee58e670f9c3fce46c40296ba9ee8a2Ian Hodson fi 8089f4c12fce1ee58e670f9c3fce46c40296ba9ee8a2Ian Hodson if test -n "$runpath_var" && test -n "$perm_rpath"; then 8090f4c12fce1ee58e670f9c3fce46c40296ba9ee8a2Ian Hodson # We should set the runpath_var. 8091f4c12fce1ee58e670f9c3fce46c40296ba9ee8a2Ian Hodson rpath= 8092f4c12fce1ee58e670f9c3fce46c40296ba9ee8a2Ian Hodson for dir in $perm_rpath; do 80935b6dc79427b8f7eeb6a7ff68034ab8548ce670eaAlexander Gutkin func_append rpath "$dir:" 8094f4c12fce1ee58e670f9c3fce46c40296ba9ee8a2Ian Hodson done 8095f4c12fce1ee58e670f9c3fce46c40296ba9ee8a2Ian Hodson eval "$runpath_var='$rpath\$$runpath_var'; export $runpath_var" 8096f4c12fce1ee58e670f9c3fce46c40296ba9ee8a2Ian Hodson fi 8097f4c12fce1ee58e670f9c3fce46c40296ba9ee8a2Ian Hodson test -n "$dep_rpath" && deplibs="$dep_rpath $deplibs" 8098f4c12fce1ee58e670f9c3fce46c40296ba9ee8a2Ian Hodson fi 8099f4c12fce1ee58e670f9c3fce46c40296ba9ee8a2Ian Hodson 8100f4c12fce1ee58e670f9c3fce46c40296ba9ee8a2Ian Hodson shlibpath="$finalize_shlibpath" 81015b6dc79427b8f7eeb6a7ff68034ab8548ce670eaAlexander Gutkin test "$opt_mode" != relink && shlibpath="$compile_shlibpath$shlibpath" 8102f4c12fce1ee58e670f9c3fce46c40296ba9ee8a2Ian Hodson if test -n "$shlibpath"; then 8103f4c12fce1ee58e670f9c3fce46c40296ba9ee8a2Ian Hodson eval "$shlibpath_var='$shlibpath\$$shlibpath_var'; export $shlibpath_var" 8104f4c12fce1ee58e670f9c3fce46c40296ba9ee8a2Ian Hodson fi 8105f4c12fce1ee58e670f9c3fce46c40296ba9ee8a2Ian Hodson 8106f4c12fce1ee58e670f9c3fce46c40296ba9ee8a2Ian Hodson # Get the real and link names of the library. 8107f4c12fce1ee58e670f9c3fce46c40296ba9ee8a2Ian Hodson eval shared_ext=\"$shrext_cmds\" 8108f4c12fce1ee58e670f9c3fce46c40296ba9ee8a2Ian Hodson eval library_names=\"$library_names_spec\" 8109f4c12fce1ee58e670f9c3fce46c40296ba9ee8a2Ian Hodson set dummy $library_names 8110f4c12fce1ee58e670f9c3fce46c40296ba9ee8a2Ian Hodson shift 8111f4c12fce1ee58e670f9c3fce46c40296ba9ee8a2Ian Hodson realname="$1" 8112f4c12fce1ee58e670f9c3fce46c40296ba9ee8a2Ian Hodson shift 8113f4c12fce1ee58e670f9c3fce46c40296ba9ee8a2Ian Hodson 8114f4c12fce1ee58e670f9c3fce46c40296ba9ee8a2Ian Hodson if test -n "$soname_spec"; then 8115f4c12fce1ee58e670f9c3fce46c40296ba9ee8a2Ian Hodson eval soname=\"$soname_spec\" 8116f4c12fce1ee58e670f9c3fce46c40296ba9ee8a2Ian Hodson else 8117f4c12fce1ee58e670f9c3fce46c40296ba9ee8a2Ian Hodson soname="$realname" 8118f4c12fce1ee58e670f9c3fce46c40296ba9ee8a2Ian Hodson fi 8119f4c12fce1ee58e670f9c3fce46c40296ba9ee8a2Ian Hodson if test -z "$dlname"; then 8120f4c12fce1ee58e670f9c3fce46c40296ba9ee8a2Ian Hodson dlname=$soname 8121f4c12fce1ee58e670f9c3fce46c40296ba9ee8a2Ian Hodson fi 8122f4c12fce1ee58e670f9c3fce46c40296ba9ee8a2Ian Hodson 8123f4c12fce1ee58e670f9c3fce46c40296ba9ee8a2Ian Hodson lib="$output_objdir/$realname" 8124f4c12fce1ee58e670f9c3fce46c40296ba9ee8a2Ian Hodson linknames= 8125f4c12fce1ee58e670f9c3fce46c40296ba9ee8a2Ian Hodson for link 8126f4c12fce1ee58e670f9c3fce46c40296ba9ee8a2Ian Hodson do 81275b6dc79427b8f7eeb6a7ff68034ab8548ce670eaAlexander Gutkin func_append linknames " $link" 8128f4c12fce1ee58e670f9c3fce46c40296ba9ee8a2Ian Hodson done 8129f4c12fce1ee58e670f9c3fce46c40296ba9ee8a2Ian Hodson 8130f4c12fce1ee58e670f9c3fce46c40296ba9ee8a2Ian Hodson # Use standard objects if they are pic 81315b6dc79427b8f7eeb6a7ff68034ab8548ce670eaAlexander Gutkin test -z "$pic_flag" && libobjs=`$ECHO "$libobjs" | $SP2NL | $SED "$lo2o" | $NL2SP` 8132f4c12fce1ee58e670f9c3fce46c40296ba9ee8a2Ian Hodson test "X$libobjs" = "X " && libobjs= 8133f4c12fce1ee58e670f9c3fce46c40296ba9ee8a2Ian Hodson 8134f4c12fce1ee58e670f9c3fce46c40296ba9ee8a2Ian Hodson delfiles= 8135f4c12fce1ee58e670f9c3fce46c40296ba9ee8a2Ian Hodson if test -n "$export_symbols" && test -n "$include_expsyms"; then 8136f4c12fce1ee58e670f9c3fce46c40296ba9ee8a2Ian Hodson $opt_dry_run || cp "$export_symbols" "$output_objdir/$libname.uexp" 8137f4c12fce1ee58e670f9c3fce46c40296ba9ee8a2Ian Hodson export_symbols="$output_objdir/$libname.uexp" 81385b6dc79427b8f7eeb6a7ff68034ab8548ce670eaAlexander Gutkin func_append delfiles " $export_symbols" 8139f4c12fce1ee58e670f9c3fce46c40296ba9ee8a2Ian Hodson fi 8140f4c12fce1ee58e670f9c3fce46c40296ba9ee8a2Ian Hodson 8141f4c12fce1ee58e670f9c3fce46c40296ba9ee8a2Ian Hodson orig_export_symbols= 8142f4c12fce1ee58e670f9c3fce46c40296ba9ee8a2Ian Hodson case $host_os in 8143f4c12fce1ee58e670f9c3fce46c40296ba9ee8a2Ian Hodson cygwin* | mingw* | cegcc*) 8144f4c12fce1ee58e670f9c3fce46c40296ba9ee8a2Ian Hodson if test -n "$export_symbols" && test -z "$export_symbols_regex"; then 8145f4c12fce1ee58e670f9c3fce46c40296ba9ee8a2Ian Hodson # exporting using user supplied symfile 8146f4c12fce1ee58e670f9c3fce46c40296ba9ee8a2Ian Hodson if test "x`$SED 1q $export_symbols`" != xEXPORTS; then 8147f4c12fce1ee58e670f9c3fce46c40296ba9ee8a2Ian Hodson # and it's NOT already a .def file. Must figure out 8148f4c12fce1ee58e670f9c3fce46c40296ba9ee8a2Ian Hodson # which of the given symbols are data symbols and tag 8149f4c12fce1ee58e670f9c3fce46c40296ba9ee8a2Ian Hodson # them as such. So, trigger use of export_symbols_cmds. 8150f4c12fce1ee58e670f9c3fce46c40296ba9ee8a2Ian Hodson # export_symbols gets reassigned inside the "prepare 8151f4c12fce1ee58e670f9c3fce46c40296ba9ee8a2Ian Hodson # the list of exported symbols" if statement, so the 8152f4c12fce1ee58e670f9c3fce46c40296ba9ee8a2Ian Hodson # include_expsyms logic still works. 8153f4c12fce1ee58e670f9c3fce46c40296ba9ee8a2Ian Hodson orig_export_symbols="$export_symbols" 8154f4c12fce1ee58e670f9c3fce46c40296ba9ee8a2Ian Hodson export_symbols= 8155f4c12fce1ee58e670f9c3fce46c40296ba9ee8a2Ian Hodson always_export_symbols=yes 8156f4c12fce1ee58e670f9c3fce46c40296ba9ee8a2Ian Hodson fi 8157f4c12fce1ee58e670f9c3fce46c40296ba9ee8a2Ian Hodson fi 8158f4c12fce1ee58e670f9c3fce46c40296ba9ee8a2Ian Hodson ;; 8159f4c12fce1ee58e670f9c3fce46c40296ba9ee8a2Ian Hodson esac 8160f4c12fce1ee58e670f9c3fce46c40296ba9ee8a2Ian Hodson 8161f4c12fce1ee58e670f9c3fce46c40296ba9ee8a2Ian Hodson # Prepare the list of exported symbols 8162f4c12fce1ee58e670f9c3fce46c40296ba9ee8a2Ian Hodson if test -z "$export_symbols"; then 8163f4c12fce1ee58e670f9c3fce46c40296ba9ee8a2Ian Hodson if test "$always_export_symbols" = yes || test -n "$export_symbols_regex"; then 8164f4c12fce1ee58e670f9c3fce46c40296ba9ee8a2Ian Hodson func_verbose "generating symbol list for \`$libname.la'" 8165f4c12fce1ee58e670f9c3fce46c40296ba9ee8a2Ian Hodson export_symbols="$output_objdir/$libname.exp" 8166f4c12fce1ee58e670f9c3fce46c40296ba9ee8a2Ian Hodson $opt_dry_run || $RM $export_symbols 8167f4c12fce1ee58e670f9c3fce46c40296ba9ee8a2Ian Hodson cmds=$export_symbols_cmds 8168f4c12fce1ee58e670f9c3fce46c40296ba9ee8a2Ian Hodson save_ifs="$IFS"; IFS='~' 81695b6dc79427b8f7eeb6a7ff68034ab8548ce670eaAlexander Gutkin for cmd1 in $cmds; do 8170f4c12fce1ee58e670f9c3fce46c40296ba9ee8a2Ian Hodson IFS="$save_ifs" 81715b6dc79427b8f7eeb6a7ff68034ab8548ce670eaAlexander Gutkin # Take the normal branch if the nm_file_list_spec branch 81725b6dc79427b8f7eeb6a7ff68034ab8548ce670eaAlexander Gutkin # doesn't work or if tool conversion is not needed. 81735b6dc79427b8f7eeb6a7ff68034ab8548ce670eaAlexander Gutkin case $nm_file_list_spec~$to_tool_file_cmd in 81745b6dc79427b8f7eeb6a7ff68034ab8548ce670eaAlexander Gutkin *~func_convert_file_noop | *~func_convert_file_msys_to_w32 | ~*) 81755b6dc79427b8f7eeb6a7ff68034ab8548ce670eaAlexander Gutkin try_normal_branch=yes 81765b6dc79427b8f7eeb6a7ff68034ab8548ce670eaAlexander Gutkin eval cmd=\"$cmd1\" 81775b6dc79427b8f7eeb6a7ff68034ab8548ce670eaAlexander Gutkin func_len " $cmd" 81785b6dc79427b8f7eeb6a7ff68034ab8548ce670eaAlexander Gutkin len=$func_len_result 81795b6dc79427b8f7eeb6a7ff68034ab8548ce670eaAlexander Gutkin ;; 81805b6dc79427b8f7eeb6a7ff68034ab8548ce670eaAlexander Gutkin *) 81815b6dc79427b8f7eeb6a7ff68034ab8548ce670eaAlexander Gutkin try_normal_branch=no 81825b6dc79427b8f7eeb6a7ff68034ab8548ce670eaAlexander Gutkin ;; 81835b6dc79427b8f7eeb6a7ff68034ab8548ce670eaAlexander Gutkin esac 81845b6dc79427b8f7eeb6a7ff68034ab8548ce670eaAlexander Gutkin if test "$try_normal_branch" = yes \ 81855b6dc79427b8f7eeb6a7ff68034ab8548ce670eaAlexander Gutkin && { test "$len" -lt "$max_cmd_len" \ 81865b6dc79427b8f7eeb6a7ff68034ab8548ce670eaAlexander Gutkin || test "$max_cmd_len" -le -1; } 81875b6dc79427b8f7eeb6a7ff68034ab8548ce670eaAlexander Gutkin then 81885b6dc79427b8f7eeb6a7ff68034ab8548ce670eaAlexander Gutkin func_show_eval "$cmd" 'exit $?' 81895b6dc79427b8f7eeb6a7ff68034ab8548ce670eaAlexander Gutkin skipped_export=false 81905b6dc79427b8f7eeb6a7ff68034ab8548ce670eaAlexander Gutkin elif test -n "$nm_file_list_spec"; then 81915b6dc79427b8f7eeb6a7ff68034ab8548ce670eaAlexander Gutkin func_basename "$output" 81925b6dc79427b8f7eeb6a7ff68034ab8548ce670eaAlexander Gutkin output_la=$func_basename_result 81935b6dc79427b8f7eeb6a7ff68034ab8548ce670eaAlexander Gutkin save_libobjs=$libobjs 81945b6dc79427b8f7eeb6a7ff68034ab8548ce670eaAlexander Gutkin save_output=$output 81955b6dc79427b8f7eeb6a7ff68034ab8548ce670eaAlexander Gutkin output=${output_objdir}/${output_la}.nm 81965b6dc79427b8f7eeb6a7ff68034ab8548ce670eaAlexander Gutkin func_to_tool_file "$output" 81975b6dc79427b8f7eeb6a7ff68034ab8548ce670eaAlexander Gutkin libobjs=$nm_file_list_spec$func_to_tool_file_result 81985b6dc79427b8f7eeb6a7ff68034ab8548ce670eaAlexander Gutkin func_append delfiles " $output" 81995b6dc79427b8f7eeb6a7ff68034ab8548ce670eaAlexander Gutkin func_verbose "creating $NM input file list: $output" 82005b6dc79427b8f7eeb6a7ff68034ab8548ce670eaAlexander Gutkin for obj in $save_libobjs; do 82015b6dc79427b8f7eeb6a7ff68034ab8548ce670eaAlexander Gutkin func_to_tool_file "$obj" 82025b6dc79427b8f7eeb6a7ff68034ab8548ce670eaAlexander Gutkin $ECHO "$func_to_tool_file_result" 82035b6dc79427b8f7eeb6a7ff68034ab8548ce670eaAlexander Gutkin done > "$output" 82045b6dc79427b8f7eeb6a7ff68034ab8548ce670eaAlexander Gutkin eval cmd=\"$cmd1\" 8205f4c12fce1ee58e670f9c3fce46c40296ba9ee8a2Ian Hodson func_show_eval "$cmd" 'exit $?' 82065b6dc79427b8f7eeb6a7ff68034ab8548ce670eaAlexander Gutkin output=$save_output 82075b6dc79427b8f7eeb6a7ff68034ab8548ce670eaAlexander Gutkin libobjs=$save_libobjs 8208f4c12fce1ee58e670f9c3fce46c40296ba9ee8a2Ian Hodson skipped_export=false 8209f4c12fce1ee58e670f9c3fce46c40296ba9ee8a2Ian Hodson else 8210f4c12fce1ee58e670f9c3fce46c40296ba9ee8a2Ian Hodson # The command line is too long to execute in one step. 8211f4c12fce1ee58e670f9c3fce46c40296ba9ee8a2Ian Hodson func_verbose "using reloadable object file for export list..." 8212f4c12fce1ee58e670f9c3fce46c40296ba9ee8a2Ian Hodson skipped_export=: 8213f4c12fce1ee58e670f9c3fce46c40296ba9ee8a2Ian Hodson # Break out early, otherwise skipped_export may be 8214f4c12fce1ee58e670f9c3fce46c40296ba9ee8a2Ian Hodson # set to false by a later but shorter cmd. 8215f4c12fce1ee58e670f9c3fce46c40296ba9ee8a2Ian Hodson break 8216f4c12fce1ee58e670f9c3fce46c40296ba9ee8a2Ian Hodson fi 8217f4c12fce1ee58e670f9c3fce46c40296ba9ee8a2Ian Hodson done 8218f4c12fce1ee58e670f9c3fce46c40296ba9ee8a2Ian Hodson IFS="$save_ifs" 8219f4c12fce1ee58e670f9c3fce46c40296ba9ee8a2Ian Hodson if test -n "$export_symbols_regex" && test "X$skipped_export" != "X:"; then 8220f4c12fce1ee58e670f9c3fce46c40296ba9ee8a2Ian Hodson func_show_eval '$EGREP -e "$export_symbols_regex" "$export_symbols" > "${export_symbols}T"' 8221f4c12fce1ee58e670f9c3fce46c40296ba9ee8a2Ian Hodson func_show_eval '$MV "${export_symbols}T" "$export_symbols"' 8222f4c12fce1ee58e670f9c3fce46c40296ba9ee8a2Ian Hodson fi 8223f4c12fce1ee58e670f9c3fce46c40296ba9ee8a2Ian Hodson fi 8224f4c12fce1ee58e670f9c3fce46c40296ba9ee8a2Ian Hodson fi 8225f4c12fce1ee58e670f9c3fce46c40296ba9ee8a2Ian Hodson 8226f4c12fce1ee58e670f9c3fce46c40296ba9ee8a2Ian Hodson if test -n "$export_symbols" && test -n "$include_expsyms"; then 8227f4c12fce1ee58e670f9c3fce46c40296ba9ee8a2Ian Hodson tmp_export_symbols="$export_symbols" 8228f4c12fce1ee58e670f9c3fce46c40296ba9ee8a2Ian Hodson test -n "$orig_export_symbols" && tmp_export_symbols="$orig_export_symbols" 82295b6dc79427b8f7eeb6a7ff68034ab8548ce670eaAlexander Gutkin $opt_dry_run || eval '$ECHO "$include_expsyms" | $SP2NL >> "$tmp_export_symbols"' 8230f4c12fce1ee58e670f9c3fce46c40296ba9ee8a2Ian Hodson fi 8231f4c12fce1ee58e670f9c3fce46c40296ba9ee8a2Ian Hodson 8232f4c12fce1ee58e670f9c3fce46c40296ba9ee8a2Ian Hodson if test "X$skipped_export" != "X:" && test -n "$orig_export_symbols"; then 8233f4c12fce1ee58e670f9c3fce46c40296ba9ee8a2Ian Hodson # The given exports_symbols file has to be filtered, so filter it. 8234f4c12fce1ee58e670f9c3fce46c40296ba9ee8a2Ian Hodson func_verbose "filter symbol list for \`$libname.la' to tag DATA exports" 8235f4c12fce1ee58e670f9c3fce46c40296ba9ee8a2Ian Hodson # FIXME: $output_objdir/$libname.filter potentially contains lots of 8236f4c12fce1ee58e670f9c3fce46c40296ba9ee8a2Ian Hodson # 's' commands which not all seds can handle. GNU sed should be fine 8237f4c12fce1ee58e670f9c3fce46c40296ba9ee8a2Ian Hodson # though. Also, the filter scales superlinearly with the number of 8238f4c12fce1ee58e670f9c3fce46c40296ba9ee8a2Ian Hodson # global variables. join(1) would be nice here, but unfortunately 8239f4c12fce1ee58e670f9c3fce46c40296ba9ee8a2Ian Hodson # isn't a blessed tool. 8240f4c12fce1ee58e670f9c3fce46c40296ba9ee8a2Ian Hodson $opt_dry_run || $SED -e '/[ ,]DATA/!d;s,\(.*\)\([ \,].*\),s|^\1$|\1\2|,' < $export_symbols > $output_objdir/$libname.filter 82415b6dc79427b8f7eeb6a7ff68034ab8548ce670eaAlexander Gutkin func_append delfiles " $export_symbols $output_objdir/$libname.filter" 8242f4c12fce1ee58e670f9c3fce46c40296ba9ee8a2Ian Hodson export_symbols=$output_objdir/$libname.def 8243f4c12fce1ee58e670f9c3fce46c40296ba9ee8a2Ian Hodson $opt_dry_run || $SED -f $output_objdir/$libname.filter < $orig_export_symbols > $export_symbols 8244f4c12fce1ee58e670f9c3fce46c40296ba9ee8a2Ian Hodson fi 8245f4c12fce1ee58e670f9c3fce46c40296ba9ee8a2Ian Hodson 8246f4c12fce1ee58e670f9c3fce46c40296ba9ee8a2Ian Hodson tmp_deplibs= 8247f4c12fce1ee58e670f9c3fce46c40296ba9ee8a2Ian Hodson for test_deplib in $deplibs; do 8248f4c12fce1ee58e670f9c3fce46c40296ba9ee8a2Ian Hodson case " $convenience " in 8249f4c12fce1ee58e670f9c3fce46c40296ba9ee8a2Ian Hodson *" $test_deplib "*) ;; 8250f4c12fce1ee58e670f9c3fce46c40296ba9ee8a2Ian Hodson *) 82515b6dc79427b8f7eeb6a7ff68034ab8548ce670eaAlexander Gutkin func_append tmp_deplibs " $test_deplib" 8252f4c12fce1ee58e670f9c3fce46c40296ba9ee8a2Ian Hodson ;; 8253f4c12fce1ee58e670f9c3fce46c40296ba9ee8a2Ian Hodson esac 8254f4c12fce1ee58e670f9c3fce46c40296ba9ee8a2Ian Hodson done 8255f4c12fce1ee58e670f9c3fce46c40296ba9ee8a2Ian Hodson deplibs="$tmp_deplibs" 8256f4c12fce1ee58e670f9c3fce46c40296ba9ee8a2Ian Hodson 8257f4c12fce1ee58e670f9c3fce46c40296ba9ee8a2Ian Hodson if test -n "$convenience"; then 8258f4c12fce1ee58e670f9c3fce46c40296ba9ee8a2Ian Hodson if test -n "$whole_archive_flag_spec" && 8259f4c12fce1ee58e670f9c3fce46c40296ba9ee8a2Ian Hodson test "$compiler_needs_object" = yes && 8260f4c12fce1ee58e670f9c3fce46c40296ba9ee8a2Ian Hodson test -z "$libobjs"; then 8261f4c12fce1ee58e670f9c3fce46c40296ba9ee8a2Ian Hodson # extract the archives, so we have objects to list. 8262f4c12fce1ee58e670f9c3fce46c40296ba9ee8a2Ian Hodson # TODO: could optimize this to just extract one archive. 8263f4c12fce1ee58e670f9c3fce46c40296ba9ee8a2Ian Hodson whole_archive_flag_spec= 8264f4c12fce1ee58e670f9c3fce46c40296ba9ee8a2Ian Hodson fi 8265f4c12fce1ee58e670f9c3fce46c40296ba9ee8a2Ian Hodson if test -n "$whole_archive_flag_spec"; then 8266f4c12fce1ee58e670f9c3fce46c40296ba9ee8a2Ian Hodson save_libobjs=$libobjs 8267f4c12fce1ee58e670f9c3fce46c40296ba9ee8a2Ian Hodson eval libobjs=\"\$libobjs $whole_archive_flag_spec\" 8268f4c12fce1ee58e670f9c3fce46c40296ba9ee8a2Ian Hodson test "X$libobjs" = "X " && libobjs= 8269f4c12fce1ee58e670f9c3fce46c40296ba9ee8a2Ian Hodson else 8270f4c12fce1ee58e670f9c3fce46c40296ba9ee8a2Ian Hodson gentop="$output_objdir/${outputname}x" 82715b6dc79427b8f7eeb6a7ff68034ab8548ce670eaAlexander Gutkin func_append generated " $gentop" 8272f4c12fce1ee58e670f9c3fce46c40296ba9ee8a2Ian Hodson 8273f4c12fce1ee58e670f9c3fce46c40296ba9ee8a2Ian Hodson func_extract_archives $gentop $convenience 82745b6dc79427b8f7eeb6a7ff68034ab8548ce670eaAlexander Gutkin func_append libobjs " $func_extract_archives_result" 8275f4c12fce1ee58e670f9c3fce46c40296ba9ee8a2Ian Hodson test "X$libobjs" = "X " && libobjs= 8276f4c12fce1ee58e670f9c3fce46c40296ba9ee8a2Ian Hodson fi 8277f4c12fce1ee58e670f9c3fce46c40296ba9ee8a2Ian Hodson fi 8278f4c12fce1ee58e670f9c3fce46c40296ba9ee8a2Ian Hodson 8279f4c12fce1ee58e670f9c3fce46c40296ba9ee8a2Ian Hodson if test "$thread_safe" = yes && test -n "$thread_safe_flag_spec"; then 8280f4c12fce1ee58e670f9c3fce46c40296ba9ee8a2Ian Hodson eval flag=\"$thread_safe_flag_spec\" 82815b6dc79427b8f7eeb6a7ff68034ab8548ce670eaAlexander Gutkin func_append linker_flags " $flag" 8282f4c12fce1ee58e670f9c3fce46c40296ba9ee8a2Ian Hodson fi 8283f4c12fce1ee58e670f9c3fce46c40296ba9ee8a2Ian Hodson 8284f4c12fce1ee58e670f9c3fce46c40296ba9ee8a2Ian Hodson # Make a backup of the uninstalled library when relinking 82855b6dc79427b8f7eeb6a7ff68034ab8548ce670eaAlexander Gutkin if test "$opt_mode" = relink; then 8286f4c12fce1ee58e670f9c3fce46c40296ba9ee8a2Ian Hodson $opt_dry_run || eval '(cd $output_objdir && $RM ${realname}U && $MV $realname ${realname}U)' || exit $? 8287f4c12fce1ee58e670f9c3fce46c40296ba9ee8a2Ian Hodson fi 8288f4c12fce1ee58e670f9c3fce46c40296ba9ee8a2Ian Hodson 8289f4c12fce1ee58e670f9c3fce46c40296ba9ee8a2Ian Hodson # Do each of the archive commands. 8290f4c12fce1ee58e670f9c3fce46c40296ba9ee8a2Ian Hodson if test "$module" = yes && test -n "$module_cmds" ; then 8291f4c12fce1ee58e670f9c3fce46c40296ba9ee8a2Ian Hodson if test -n "$export_symbols" && test -n "$module_expsym_cmds"; then 8292f4c12fce1ee58e670f9c3fce46c40296ba9ee8a2Ian Hodson eval test_cmds=\"$module_expsym_cmds\" 8293f4c12fce1ee58e670f9c3fce46c40296ba9ee8a2Ian Hodson cmds=$module_expsym_cmds 8294f4c12fce1ee58e670f9c3fce46c40296ba9ee8a2Ian Hodson else 8295f4c12fce1ee58e670f9c3fce46c40296ba9ee8a2Ian Hodson eval test_cmds=\"$module_cmds\" 8296f4c12fce1ee58e670f9c3fce46c40296ba9ee8a2Ian Hodson cmds=$module_cmds 8297f4c12fce1ee58e670f9c3fce46c40296ba9ee8a2Ian Hodson fi 8298f4c12fce1ee58e670f9c3fce46c40296ba9ee8a2Ian Hodson else 8299f4c12fce1ee58e670f9c3fce46c40296ba9ee8a2Ian Hodson if test -n "$export_symbols" && test -n "$archive_expsym_cmds"; then 8300f4c12fce1ee58e670f9c3fce46c40296ba9ee8a2Ian Hodson eval test_cmds=\"$archive_expsym_cmds\" 8301f4c12fce1ee58e670f9c3fce46c40296ba9ee8a2Ian Hodson cmds=$archive_expsym_cmds 8302f4c12fce1ee58e670f9c3fce46c40296ba9ee8a2Ian Hodson else 8303f4c12fce1ee58e670f9c3fce46c40296ba9ee8a2Ian Hodson eval test_cmds=\"$archive_cmds\" 8304f4c12fce1ee58e670f9c3fce46c40296ba9ee8a2Ian Hodson cmds=$archive_cmds 8305f4c12fce1ee58e670f9c3fce46c40296ba9ee8a2Ian Hodson fi 8306f4c12fce1ee58e670f9c3fce46c40296ba9ee8a2Ian Hodson fi 8307f4c12fce1ee58e670f9c3fce46c40296ba9ee8a2Ian Hodson 8308f4c12fce1ee58e670f9c3fce46c40296ba9ee8a2Ian Hodson if test "X$skipped_export" != "X:" && 8309f4c12fce1ee58e670f9c3fce46c40296ba9ee8a2Ian Hodson func_len " $test_cmds" && 8310f4c12fce1ee58e670f9c3fce46c40296ba9ee8a2Ian Hodson len=$func_len_result && 8311f4c12fce1ee58e670f9c3fce46c40296ba9ee8a2Ian Hodson test "$len" -lt "$max_cmd_len" || test "$max_cmd_len" -le -1; then 8312f4c12fce1ee58e670f9c3fce46c40296ba9ee8a2Ian Hodson : 8313f4c12fce1ee58e670f9c3fce46c40296ba9ee8a2Ian Hodson else 8314f4c12fce1ee58e670f9c3fce46c40296ba9ee8a2Ian Hodson # The command line is too long to link in one step, link piecewise 8315f4c12fce1ee58e670f9c3fce46c40296ba9ee8a2Ian Hodson # or, if using GNU ld and skipped_export is not :, use a linker 8316f4c12fce1ee58e670f9c3fce46c40296ba9ee8a2Ian Hodson # script. 8317f4c12fce1ee58e670f9c3fce46c40296ba9ee8a2Ian Hodson 8318f4c12fce1ee58e670f9c3fce46c40296ba9ee8a2Ian Hodson # Save the value of $output and $libobjs because we want to 8319f4c12fce1ee58e670f9c3fce46c40296ba9ee8a2Ian Hodson # use them later. If we have whole_archive_flag_spec, we 8320f4c12fce1ee58e670f9c3fce46c40296ba9ee8a2Ian Hodson # want to use save_libobjs as it was before 8321f4c12fce1ee58e670f9c3fce46c40296ba9ee8a2Ian Hodson # whole_archive_flag_spec was expanded, because we can't 8322f4c12fce1ee58e670f9c3fce46c40296ba9ee8a2Ian Hodson # assume the linker understands whole_archive_flag_spec. 8323f4c12fce1ee58e670f9c3fce46c40296ba9ee8a2Ian Hodson # This may have to be revisited, in case too many 8324f4c12fce1ee58e670f9c3fce46c40296ba9ee8a2Ian Hodson # convenience libraries get linked in and end up exceeding 8325f4c12fce1ee58e670f9c3fce46c40296ba9ee8a2Ian Hodson # the spec. 8326f4c12fce1ee58e670f9c3fce46c40296ba9ee8a2Ian Hodson if test -z "$convenience" || test -z "$whole_archive_flag_spec"; then 8327f4c12fce1ee58e670f9c3fce46c40296ba9ee8a2Ian Hodson save_libobjs=$libobjs 8328f4c12fce1ee58e670f9c3fce46c40296ba9ee8a2Ian Hodson fi 8329f4c12fce1ee58e670f9c3fce46c40296ba9ee8a2Ian Hodson save_output=$output 83305b6dc79427b8f7eeb6a7ff68034ab8548ce670eaAlexander Gutkin func_basename "$output" 83315b6dc79427b8f7eeb6a7ff68034ab8548ce670eaAlexander Gutkin output_la=$func_basename_result 8332f4c12fce1ee58e670f9c3fce46c40296ba9ee8a2Ian Hodson 8333f4c12fce1ee58e670f9c3fce46c40296ba9ee8a2Ian Hodson # Clear the reloadable object creation command queue and 8334f4c12fce1ee58e670f9c3fce46c40296ba9ee8a2Ian Hodson # initialize k to one. 8335f4c12fce1ee58e670f9c3fce46c40296ba9ee8a2Ian Hodson test_cmds= 8336f4c12fce1ee58e670f9c3fce46c40296ba9ee8a2Ian Hodson concat_cmds= 8337f4c12fce1ee58e670f9c3fce46c40296ba9ee8a2Ian Hodson objlist= 8338f4c12fce1ee58e670f9c3fce46c40296ba9ee8a2Ian Hodson last_robj= 8339f4c12fce1ee58e670f9c3fce46c40296ba9ee8a2Ian Hodson k=1 8340f4c12fce1ee58e670f9c3fce46c40296ba9ee8a2Ian Hodson 8341f4c12fce1ee58e670f9c3fce46c40296ba9ee8a2Ian Hodson if test -n "$save_libobjs" && test "X$skipped_export" != "X:" && test "$with_gnu_ld" = yes; then 8342f4c12fce1ee58e670f9c3fce46c40296ba9ee8a2Ian Hodson output=${output_objdir}/${output_la}.lnkscript 8343f4c12fce1ee58e670f9c3fce46c40296ba9ee8a2Ian Hodson func_verbose "creating GNU ld script: $output" 83445b6dc79427b8f7eeb6a7ff68034ab8548ce670eaAlexander Gutkin echo 'INPUT (' > $output 8345f4c12fce1ee58e670f9c3fce46c40296ba9ee8a2Ian Hodson for obj in $save_libobjs 8346f4c12fce1ee58e670f9c3fce46c40296ba9ee8a2Ian Hodson do 83475b6dc79427b8f7eeb6a7ff68034ab8548ce670eaAlexander Gutkin func_to_tool_file "$obj" 83485b6dc79427b8f7eeb6a7ff68034ab8548ce670eaAlexander Gutkin $ECHO "$func_to_tool_file_result" >> $output 8349f4c12fce1ee58e670f9c3fce46c40296ba9ee8a2Ian Hodson done 83505b6dc79427b8f7eeb6a7ff68034ab8548ce670eaAlexander Gutkin echo ')' >> $output 83515b6dc79427b8f7eeb6a7ff68034ab8548ce670eaAlexander Gutkin func_append delfiles " $output" 83525b6dc79427b8f7eeb6a7ff68034ab8548ce670eaAlexander Gutkin func_to_tool_file "$output" 83535b6dc79427b8f7eeb6a7ff68034ab8548ce670eaAlexander Gutkin output=$func_to_tool_file_result 8354f4c12fce1ee58e670f9c3fce46c40296ba9ee8a2Ian Hodson elif test -n "$save_libobjs" && test "X$skipped_export" != "X:" && test "X$file_list_spec" != X; then 8355f4c12fce1ee58e670f9c3fce46c40296ba9ee8a2Ian Hodson output=${output_objdir}/${output_la}.lnk 8356f4c12fce1ee58e670f9c3fce46c40296ba9ee8a2Ian Hodson func_verbose "creating linker input file list: $output" 8357f4c12fce1ee58e670f9c3fce46c40296ba9ee8a2Ian Hodson : > $output 8358f4c12fce1ee58e670f9c3fce46c40296ba9ee8a2Ian Hodson set x $save_libobjs 8359f4c12fce1ee58e670f9c3fce46c40296ba9ee8a2Ian Hodson shift 8360f4c12fce1ee58e670f9c3fce46c40296ba9ee8a2Ian Hodson firstobj= 8361f4c12fce1ee58e670f9c3fce46c40296ba9ee8a2Ian Hodson if test "$compiler_needs_object" = yes; then 8362f4c12fce1ee58e670f9c3fce46c40296ba9ee8a2Ian Hodson firstobj="$1 " 8363f4c12fce1ee58e670f9c3fce46c40296ba9ee8a2Ian Hodson shift 8364f4c12fce1ee58e670f9c3fce46c40296ba9ee8a2Ian Hodson fi 8365f4c12fce1ee58e670f9c3fce46c40296ba9ee8a2Ian Hodson for obj 8366f4c12fce1ee58e670f9c3fce46c40296ba9ee8a2Ian Hodson do 83675b6dc79427b8f7eeb6a7ff68034ab8548ce670eaAlexander Gutkin func_to_tool_file "$obj" 83685b6dc79427b8f7eeb6a7ff68034ab8548ce670eaAlexander Gutkin $ECHO "$func_to_tool_file_result" >> $output 8369f4c12fce1ee58e670f9c3fce46c40296ba9ee8a2Ian Hodson done 83705b6dc79427b8f7eeb6a7ff68034ab8548ce670eaAlexander Gutkin func_append delfiles " $output" 83715b6dc79427b8f7eeb6a7ff68034ab8548ce670eaAlexander Gutkin func_to_tool_file "$output" 83725b6dc79427b8f7eeb6a7ff68034ab8548ce670eaAlexander Gutkin output=$firstobj\"$file_list_spec$func_to_tool_file_result\" 8373f4c12fce1ee58e670f9c3fce46c40296ba9ee8a2Ian Hodson else 8374f4c12fce1ee58e670f9c3fce46c40296ba9ee8a2Ian Hodson if test -n "$save_libobjs"; then 8375f4c12fce1ee58e670f9c3fce46c40296ba9ee8a2Ian Hodson func_verbose "creating reloadable object files..." 8376f4c12fce1ee58e670f9c3fce46c40296ba9ee8a2Ian Hodson output=$output_objdir/$output_la-${k}.$objext 8377f4c12fce1ee58e670f9c3fce46c40296ba9ee8a2Ian Hodson eval test_cmds=\"$reload_cmds\" 8378f4c12fce1ee58e670f9c3fce46c40296ba9ee8a2Ian Hodson func_len " $test_cmds" 8379f4c12fce1ee58e670f9c3fce46c40296ba9ee8a2Ian Hodson len0=$func_len_result 8380f4c12fce1ee58e670f9c3fce46c40296ba9ee8a2Ian Hodson len=$len0 8381f4c12fce1ee58e670f9c3fce46c40296ba9ee8a2Ian Hodson 8382f4c12fce1ee58e670f9c3fce46c40296ba9ee8a2Ian Hodson # Loop over the list of objects to be linked. 8383f4c12fce1ee58e670f9c3fce46c40296ba9ee8a2Ian Hodson for obj in $save_libobjs 8384f4c12fce1ee58e670f9c3fce46c40296ba9ee8a2Ian Hodson do 8385f4c12fce1ee58e670f9c3fce46c40296ba9ee8a2Ian Hodson func_len " $obj" 8386f4c12fce1ee58e670f9c3fce46c40296ba9ee8a2Ian Hodson func_arith $len + $func_len_result 8387f4c12fce1ee58e670f9c3fce46c40296ba9ee8a2Ian Hodson len=$func_arith_result 8388f4c12fce1ee58e670f9c3fce46c40296ba9ee8a2Ian Hodson if test "X$objlist" = X || 8389f4c12fce1ee58e670f9c3fce46c40296ba9ee8a2Ian Hodson test "$len" -lt "$max_cmd_len"; then 8390f4c12fce1ee58e670f9c3fce46c40296ba9ee8a2Ian Hodson func_append objlist " $obj" 8391f4c12fce1ee58e670f9c3fce46c40296ba9ee8a2Ian Hodson else 8392f4c12fce1ee58e670f9c3fce46c40296ba9ee8a2Ian Hodson # The command $test_cmds is almost too long, add a 8393f4c12fce1ee58e670f9c3fce46c40296ba9ee8a2Ian Hodson # command to the queue. 8394f4c12fce1ee58e670f9c3fce46c40296ba9ee8a2Ian Hodson if test "$k" -eq 1 ; then 8395f4c12fce1ee58e670f9c3fce46c40296ba9ee8a2Ian Hodson # The first file doesn't have a previous command to add. 83965b6dc79427b8f7eeb6a7ff68034ab8548ce670eaAlexander Gutkin reload_objs=$objlist 83975b6dc79427b8f7eeb6a7ff68034ab8548ce670eaAlexander Gutkin eval concat_cmds=\"$reload_cmds\" 8398f4c12fce1ee58e670f9c3fce46c40296ba9ee8a2Ian Hodson else 8399f4c12fce1ee58e670f9c3fce46c40296ba9ee8a2Ian Hodson # All subsequent reloadable object files will link in 8400f4c12fce1ee58e670f9c3fce46c40296ba9ee8a2Ian Hodson # the last one created. 84015b6dc79427b8f7eeb6a7ff68034ab8548ce670eaAlexander Gutkin reload_objs="$objlist $last_robj" 84025b6dc79427b8f7eeb6a7ff68034ab8548ce670eaAlexander Gutkin eval concat_cmds=\"\$concat_cmds~$reload_cmds~\$RM $last_robj\" 8403f4c12fce1ee58e670f9c3fce46c40296ba9ee8a2Ian Hodson fi 8404f4c12fce1ee58e670f9c3fce46c40296ba9ee8a2Ian Hodson last_robj=$output_objdir/$output_la-${k}.$objext 8405f4c12fce1ee58e670f9c3fce46c40296ba9ee8a2Ian Hodson func_arith $k + 1 8406f4c12fce1ee58e670f9c3fce46c40296ba9ee8a2Ian Hodson k=$func_arith_result 8407f4c12fce1ee58e670f9c3fce46c40296ba9ee8a2Ian Hodson output=$output_objdir/$output_la-${k}.$objext 84085b6dc79427b8f7eeb6a7ff68034ab8548ce670eaAlexander Gutkin objlist=" $obj" 8409f4c12fce1ee58e670f9c3fce46c40296ba9ee8a2Ian Hodson func_len " $last_robj" 8410f4c12fce1ee58e670f9c3fce46c40296ba9ee8a2Ian Hodson func_arith $len0 + $func_len_result 8411f4c12fce1ee58e670f9c3fce46c40296ba9ee8a2Ian Hodson len=$func_arith_result 8412f4c12fce1ee58e670f9c3fce46c40296ba9ee8a2Ian Hodson fi 8413f4c12fce1ee58e670f9c3fce46c40296ba9ee8a2Ian Hodson done 8414f4c12fce1ee58e670f9c3fce46c40296ba9ee8a2Ian Hodson # Handle the remaining objects by creating one last 8415f4c12fce1ee58e670f9c3fce46c40296ba9ee8a2Ian Hodson # reloadable object file. All subsequent reloadable object 8416f4c12fce1ee58e670f9c3fce46c40296ba9ee8a2Ian Hodson # files will link in the last one created. 8417f4c12fce1ee58e670f9c3fce46c40296ba9ee8a2Ian Hodson test -z "$concat_cmds" || concat_cmds=$concat_cmds~ 84185b6dc79427b8f7eeb6a7ff68034ab8548ce670eaAlexander Gutkin reload_objs="$objlist $last_robj" 84195b6dc79427b8f7eeb6a7ff68034ab8548ce670eaAlexander Gutkin eval concat_cmds=\"\${concat_cmds}$reload_cmds\" 8420f4c12fce1ee58e670f9c3fce46c40296ba9ee8a2Ian Hodson if test -n "$last_robj"; then 8421f4c12fce1ee58e670f9c3fce46c40296ba9ee8a2Ian Hodson eval concat_cmds=\"\${concat_cmds}~\$RM $last_robj\" 8422f4c12fce1ee58e670f9c3fce46c40296ba9ee8a2Ian Hodson fi 84235b6dc79427b8f7eeb6a7ff68034ab8548ce670eaAlexander Gutkin func_append delfiles " $output" 8424f4c12fce1ee58e670f9c3fce46c40296ba9ee8a2Ian Hodson 8425f4c12fce1ee58e670f9c3fce46c40296ba9ee8a2Ian Hodson else 8426f4c12fce1ee58e670f9c3fce46c40296ba9ee8a2Ian Hodson output= 8427f4c12fce1ee58e670f9c3fce46c40296ba9ee8a2Ian Hodson fi 8428f4c12fce1ee58e670f9c3fce46c40296ba9ee8a2Ian Hodson 8429f4c12fce1ee58e670f9c3fce46c40296ba9ee8a2Ian Hodson if ${skipped_export-false}; then 8430f4c12fce1ee58e670f9c3fce46c40296ba9ee8a2Ian Hodson func_verbose "generating symbol list for \`$libname.la'" 8431f4c12fce1ee58e670f9c3fce46c40296ba9ee8a2Ian Hodson export_symbols="$output_objdir/$libname.exp" 8432f4c12fce1ee58e670f9c3fce46c40296ba9ee8a2Ian Hodson $opt_dry_run || $RM $export_symbols 8433f4c12fce1ee58e670f9c3fce46c40296ba9ee8a2Ian Hodson libobjs=$output 8434f4c12fce1ee58e670f9c3fce46c40296ba9ee8a2Ian Hodson # Append the command to create the export file. 8435f4c12fce1ee58e670f9c3fce46c40296ba9ee8a2Ian Hodson test -z "$concat_cmds" || concat_cmds=$concat_cmds~ 8436f4c12fce1ee58e670f9c3fce46c40296ba9ee8a2Ian Hodson eval concat_cmds=\"\$concat_cmds$export_symbols_cmds\" 8437f4c12fce1ee58e670f9c3fce46c40296ba9ee8a2Ian Hodson if test -n "$last_robj"; then 8438f4c12fce1ee58e670f9c3fce46c40296ba9ee8a2Ian Hodson eval concat_cmds=\"\$concat_cmds~\$RM $last_robj\" 8439f4c12fce1ee58e670f9c3fce46c40296ba9ee8a2Ian Hodson fi 8440f4c12fce1ee58e670f9c3fce46c40296ba9ee8a2Ian Hodson fi 8441f4c12fce1ee58e670f9c3fce46c40296ba9ee8a2Ian Hodson 8442f4c12fce1ee58e670f9c3fce46c40296ba9ee8a2Ian Hodson test -n "$save_libobjs" && 8443f4c12fce1ee58e670f9c3fce46c40296ba9ee8a2Ian Hodson func_verbose "creating a temporary reloadable object file: $output" 8444f4c12fce1ee58e670f9c3fce46c40296ba9ee8a2Ian Hodson 8445f4c12fce1ee58e670f9c3fce46c40296ba9ee8a2Ian Hodson # Loop through the commands generated above and execute them. 8446f4c12fce1ee58e670f9c3fce46c40296ba9ee8a2Ian Hodson save_ifs="$IFS"; IFS='~' 8447f4c12fce1ee58e670f9c3fce46c40296ba9ee8a2Ian Hodson for cmd in $concat_cmds; do 8448f4c12fce1ee58e670f9c3fce46c40296ba9ee8a2Ian Hodson IFS="$save_ifs" 8449f4c12fce1ee58e670f9c3fce46c40296ba9ee8a2Ian Hodson $opt_silent || { 8450f4c12fce1ee58e670f9c3fce46c40296ba9ee8a2Ian Hodson func_quote_for_expand "$cmd" 8451f4c12fce1ee58e670f9c3fce46c40296ba9ee8a2Ian Hodson eval "func_echo $func_quote_for_expand_result" 8452f4c12fce1ee58e670f9c3fce46c40296ba9ee8a2Ian Hodson } 8453f4c12fce1ee58e670f9c3fce46c40296ba9ee8a2Ian Hodson $opt_dry_run || eval "$cmd" || { 8454f4c12fce1ee58e670f9c3fce46c40296ba9ee8a2Ian Hodson lt_exit=$? 8455f4c12fce1ee58e670f9c3fce46c40296ba9ee8a2Ian Hodson 8456f4c12fce1ee58e670f9c3fce46c40296ba9ee8a2Ian Hodson # Restore the uninstalled library and exit 84575b6dc79427b8f7eeb6a7ff68034ab8548ce670eaAlexander Gutkin if test "$opt_mode" = relink; then 8458f4c12fce1ee58e670f9c3fce46c40296ba9ee8a2Ian Hodson ( cd "$output_objdir" && \ 8459f4c12fce1ee58e670f9c3fce46c40296ba9ee8a2Ian Hodson $RM "${realname}T" && \ 8460f4c12fce1ee58e670f9c3fce46c40296ba9ee8a2Ian Hodson $MV "${realname}U" "$realname" ) 8461f4c12fce1ee58e670f9c3fce46c40296ba9ee8a2Ian Hodson fi 8462f4c12fce1ee58e670f9c3fce46c40296ba9ee8a2Ian Hodson 8463f4c12fce1ee58e670f9c3fce46c40296ba9ee8a2Ian Hodson exit $lt_exit 8464f4c12fce1ee58e670f9c3fce46c40296ba9ee8a2Ian Hodson } 8465f4c12fce1ee58e670f9c3fce46c40296ba9ee8a2Ian Hodson done 8466f4c12fce1ee58e670f9c3fce46c40296ba9ee8a2Ian Hodson IFS="$save_ifs" 8467f4c12fce1ee58e670f9c3fce46c40296ba9ee8a2Ian Hodson 8468f4c12fce1ee58e670f9c3fce46c40296ba9ee8a2Ian Hodson if test -n "$export_symbols_regex" && ${skipped_export-false}; then 8469f4c12fce1ee58e670f9c3fce46c40296ba9ee8a2Ian Hodson func_show_eval '$EGREP -e "$export_symbols_regex" "$export_symbols" > "${export_symbols}T"' 8470f4c12fce1ee58e670f9c3fce46c40296ba9ee8a2Ian Hodson func_show_eval '$MV "${export_symbols}T" "$export_symbols"' 8471f4c12fce1ee58e670f9c3fce46c40296ba9ee8a2Ian Hodson fi 8472f4c12fce1ee58e670f9c3fce46c40296ba9ee8a2Ian Hodson fi 8473f4c12fce1ee58e670f9c3fce46c40296ba9ee8a2Ian Hodson 8474f4c12fce1ee58e670f9c3fce46c40296ba9ee8a2Ian Hodson if ${skipped_export-false}; then 8475f4c12fce1ee58e670f9c3fce46c40296ba9ee8a2Ian Hodson if test -n "$export_symbols" && test -n "$include_expsyms"; then 8476f4c12fce1ee58e670f9c3fce46c40296ba9ee8a2Ian Hodson tmp_export_symbols="$export_symbols" 8477f4c12fce1ee58e670f9c3fce46c40296ba9ee8a2Ian Hodson test -n "$orig_export_symbols" && tmp_export_symbols="$orig_export_symbols" 84785b6dc79427b8f7eeb6a7ff68034ab8548ce670eaAlexander Gutkin $opt_dry_run || eval '$ECHO "$include_expsyms" | $SP2NL >> "$tmp_export_symbols"' 8479f4c12fce1ee58e670f9c3fce46c40296ba9ee8a2Ian Hodson fi 8480f4c12fce1ee58e670f9c3fce46c40296ba9ee8a2Ian Hodson 8481f4c12fce1ee58e670f9c3fce46c40296ba9ee8a2Ian Hodson if test -n "$orig_export_symbols"; then 8482f4c12fce1ee58e670f9c3fce46c40296ba9ee8a2Ian Hodson # The given exports_symbols file has to be filtered, so filter it. 8483f4c12fce1ee58e670f9c3fce46c40296ba9ee8a2Ian Hodson func_verbose "filter symbol list for \`$libname.la' to tag DATA exports" 8484f4c12fce1ee58e670f9c3fce46c40296ba9ee8a2Ian Hodson # FIXME: $output_objdir/$libname.filter potentially contains lots of 8485f4c12fce1ee58e670f9c3fce46c40296ba9ee8a2Ian Hodson # 's' commands which not all seds can handle. GNU sed should be fine 8486f4c12fce1ee58e670f9c3fce46c40296ba9ee8a2Ian Hodson # though. Also, the filter scales superlinearly with the number of 8487f4c12fce1ee58e670f9c3fce46c40296ba9ee8a2Ian Hodson # global variables. join(1) would be nice here, but unfortunately 8488f4c12fce1ee58e670f9c3fce46c40296ba9ee8a2Ian Hodson # isn't a blessed tool. 8489f4c12fce1ee58e670f9c3fce46c40296ba9ee8a2Ian Hodson $opt_dry_run || $SED -e '/[ ,]DATA/!d;s,\(.*\)\([ \,].*\),s|^\1$|\1\2|,' < $export_symbols > $output_objdir/$libname.filter 84905b6dc79427b8f7eeb6a7ff68034ab8548ce670eaAlexander Gutkin func_append delfiles " $export_symbols $output_objdir/$libname.filter" 8491f4c12fce1ee58e670f9c3fce46c40296ba9ee8a2Ian Hodson export_symbols=$output_objdir/$libname.def 8492f4c12fce1ee58e670f9c3fce46c40296ba9ee8a2Ian Hodson $opt_dry_run || $SED -f $output_objdir/$libname.filter < $orig_export_symbols > $export_symbols 8493f4c12fce1ee58e670f9c3fce46c40296ba9ee8a2Ian Hodson fi 8494f4c12fce1ee58e670f9c3fce46c40296ba9ee8a2Ian Hodson fi 8495f4c12fce1ee58e670f9c3fce46c40296ba9ee8a2Ian Hodson 8496f4c12fce1ee58e670f9c3fce46c40296ba9ee8a2Ian Hodson libobjs=$output 8497f4c12fce1ee58e670f9c3fce46c40296ba9ee8a2Ian Hodson # Restore the value of output. 8498f4c12fce1ee58e670f9c3fce46c40296ba9ee8a2Ian Hodson output=$save_output 8499f4c12fce1ee58e670f9c3fce46c40296ba9ee8a2Ian Hodson 8500f4c12fce1ee58e670f9c3fce46c40296ba9ee8a2Ian Hodson if test -n "$convenience" && test -n "$whole_archive_flag_spec"; then 8501f4c12fce1ee58e670f9c3fce46c40296ba9ee8a2Ian Hodson eval libobjs=\"\$libobjs $whole_archive_flag_spec\" 8502f4c12fce1ee58e670f9c3fce46c40296ba9ee8a2Ian Hodson test "X$libobjs" = "X " && libobjs= 8503f4c12fce1ee58e670f9c3fce46c40296ba9ee8a2Ian Hodson fi 8504f4c12fce1ee58e670f9c3fce46c40296ba9ee8a2Ian Hodson # Expand the library linking commands again to reset the 8505f4c12fce1ee58e670f9c3fce46c40296ba9ee8a2Ian Hodson # value of $libobjs for piecewise linking. 8506f4c12fce1ee58e670f9c3fce46c40296ba9ee8a2Ian Hodson 8507f4c12fce1ee58e670f9c3fce46c40296ba9ee8a2Ian Hodson # Do each of the archive commands. 8508f4c12fce1ee58e670f9c3fce46c40296ba9ee8a2Ian Hodson if test "$module" = yes && test -n "$module_cmds" ; then 8509f4c12fce1ee58e670f9c3fce46c40296ba9ee8a2Ian Hodson if test -n "$export_symbols" && test -n "$module_expsym_cmds"; then 8510f4c12fce1ee58e670f9c3fce46c40296ba9ee8a2Ian Hodson cmds=$module_expsym_cmds 8511f4c12fce1ee58e670f9c3fce46c40296ba9ee8a2Ian Hodson else 8512f4c12fce1ee58e670f9c3fce46c40296ba9ee8a2Ian Hodson cmds=$module_cmds 8513f4c12fce1ee58e670f9c3fce46c40296ba9ee8a2Ian Hodson fi 8514f4c12fce1ee58e670f9c3fce46c40296ba9ee8a2Ian Hodson else 8515f4c12fce1ee58e670f9c3fce46c40296ba9ee8a2Ian Hodson if test -n "$export_symbols" && test -n "$archive_expsym_cmds"; then 8516f4c12fce1ee58e670f9c3fce46c40296ba9ee8a2Ian Hodson cmds=$archive_expsym_cmds 8517f4c12fce1ee58e670f9c3fce46c40296ba9ee8a2Ian Hodson else 8518f4c12fce1ee58e670f9c3fce46c40296ba9ee8a2Ian Hodson cmds=$archive_cmds 8519f4c12fce1ee58e670f9c3fce46c40296ba9ee8a2Ian Hodson fi 8520f4c12fce1ee58e670f9c3fce46c40296ba9ee8a2Ian Hodson fi 8521f4c12fce1ee58e670f9c3fce46c40296ba9ee8a2Ian Hodson fi 8522f4c12fce1ee58e670f9c3fce46c40296ba9ee8a2Ian Hodson 8523f4c12fce1ee58e670f9c3fce46c40296ba9ee8a2Ian Hodson if test -n "$delfiles"; then 8524f4c12fce1ee58e670f9c3fce46c40296ba9ee8a2Ian Hodson # Append the command to remove temporary files to $cmds. 8525f4c12fce1ee58e670f9c3fce46c40296ba9ee8a2Ian Hodson eval cmds=\"\$cmds~\$RM $delfiles\" 8526f4c12fce1ee58e670f9c3fce46c40296ba9ee8a2Ian Hodson fi 8527f4c12fce1ee58e670f9c3fce46c40296ba9ee8a2Ian Hodson 8528f4c12fce1ee58e670f9c3fce46c40296ba9ee8a2Ian Hodson # Add any objects from preloaded convenience libraries 8529f4c12fce1ee58e670f9c3fce46c40296ba9ee8a2Ian Hodson if test -n "$dlprefiles"; then 8530f4c12fce1ee58e670f9c3fce46c40296ba9ee8a2Ian Hodson gentop="$output_objdir/${outputname}x" 85315b6dc79427b8f7eeb6a7ff68034ab8548ce670eaAlexander Gutkin func_append generated " $gentop" 8532f4c12fce1ee58e670f9c3fce46c40296ba9ee8a2Ian Hodson 8533f4c12fce1ee58e670f9c3fce46c40296ba9ee8a2Ian Hodson func_extract_archives $gentop $dlprefiles 85345b6dc79427b8f7eeb6a7ff68034ab8548ce670eaAlexander Gutkin func_append libobjs " $func_extract_archives_result" 8535f4c12fce1ee58e670f9c3fce46c40296ba9ee8a2Ian Hodson test "X$libobjs" = "X " && libobjs= 8536f4c12fce1ee58e670f9c3fce46c40296ba9ee8a2Ian Hodson fi 8537f4c12fce1ee58e670f9c3fce46c40296ba9ee8a2Ian Hodson 8538f4c12fce1ee58e670f9c3fce46c40296ba9ee8a2Ian Hodson save_ifs="$IFS"; IFS='~' 8539f4c12fce1ee58e670f9c3fce46c40296ba9ee8a2Ian Hodson for cmd in $cmds; do 8540f4c12fce1ee58e670f9c3fce46c40296ba9ee8a2Ian Hodson IFS="$save_ifs" 8541f4c12fce1ee58e670f9c3fce46c40296ba9ee8a2Ian Hodson eval cmd=\"$cmd\" 8542f4c12fce1ee58e670f9c3fce46c40296ba9ee8a2Ian Hodson $opt_silent || { 8543f4c12fce1ee58e670f9c3fce46c40296ba9ee8a2Ian Hodson func_quote_for_expand "$cmd" 8544f4c12fce1ee58e670f9c3fce46c40296ba9ee8a2Ian Hodson eval "func_echo $func_quote_for_expand_result" 8545f4c12fce1ee58e670f9c3fce46c40296ba9ee8a2Ian Hodson } 8546f4c12fce1ee58e670f9c3fce46c40296ba9ee8a2Ian Hodson $opt_dry_run || eval "$cmd" || { 8547f4c12fce1ee58e670f9c3fce46c40296ba9ee8a2Ian Hodson lt_exit=$? 8548f4c12fce1ee58e670f9c3fce46c40296ba9ee8a2Ian Hodson 8549f4c12fce1ee58e670f9c3fce46c40296ba9ee8a2Ian Hodson # Restore the uninstalled library and exit 85505b6dc79427b8f7eeb6a7ff68034ab8548ce670eaAlexander Gutkin if test "$opt_mode" = relink; then 8551f4c12fce1ee58e670f9c3fce46c40296ba9ee8a2Ian Hodson ( cd "$output_objdir" && \ 8552f4c12fce1ee58e670f9c3fce46c40296ba9ee8a2Ian Hodson $RM "${realname}T" && \ 8553f4c12fce1ee58e670f9c3fce46c40296ba9ee8a2Ian Hodson $MV "${realname}U" "$realname" ) 8554f4c12fce1ee58e670f9c3fce46c40296ba9ee8a2Ian Hodson fi 8555f4c12fce1ee58e670f9c3fce46c40296ba9ee8a2Ian Hodson 8556f4c12fce1ee58e670f9c3fce46c40296ba9ee8a2Ian Hodson exit $lt_exit 8557f4c12fce1ee58e670f9c3fce46c40296ba9ee8a2Ian Hodson } 8558f4c12fce1ee58e670f9c3fce46c40296ba9ee8a2Ian Hodson done 8559f4c12fce1ee58e670f9c3fce46c40296ba9ee8a2Ian Hodson IFS="$save_ifs" 8560f4c12fce1ee58e670f9c3fce46c40296ba9ee8a2Ian Hodson 8561f4c12fce1ee58e670f9c3fce46c40296ba9ee8a2Ian Hodson # Restore the uninstalled library and exit 85625b6dc79427b8f7eeb6a7ff68034ab8548ce670eaAlexander Gutkin if test "$opt_mode" = relink; then 8563f4c12fce1ee58e670f9c3fce46c40296ba9ee8a2Ian Hodson $opt_dry_run || eval '(cd $output_objdir && $RM ${realname}T && $MV $realname ${realname}T && $MV ${realname}U $realname)' || exit $? 8564f4c12fce1ee58e670f9c3fce46c40296ba9ee8a2Ian Hodson 8565f4c12fce1ee58e670f9c3fce46c40296ba9ee8a2Ian Hodson if test -n "$convenience"; then 8566f4c12fce1ee58e670f9c3fce46c40296ba9ee8a2Ian Hodson if test -z "$whole_archive_flag_spec"; then 8567f4c12fce1ee58e670f9c3fce46c40296ba9ee8a2Ian Hodson func_show_eval '${RM}r "$gentop"' 8568f4c12fce1ee58e670f9c3fce46c40296ba9ee8a2Ian Hodson fi 8569f4c12fce1ee58e670f9c3fce46c40296ba9ee8a2Ian Hodson fi 8570f4c12fce1ee58e670f9c3fce46c40296ba9ee8a2Ian Hodson 8571f4c12fce1ee58e670f9c3fce46c40296ba9ee8a2Ian Hodson exit $EXIT_SUCCESS 8572f4c12fce1ee58e670f9c3fce46c40296ba9ee8a2Ian Hodson fi 8573f4c12fce1ee58e670f9c3fce46c40296ba9ee8a2Ian Hodson 8574f4c12fce1ee58e670f9c3fce46c40296ba9ee8a2Ian Hodson # Create links to the real library. 8575f4c12fce1ee58e670f9c3fce46c40296ba9ee8a2Ian Hodson for linkname in $linknames; do 8576f4c12fce1ee58e670f9c3fce46c40296ba9ee8a2Ian Hodson if test "$realname" != "$linkname"; then 8577f4c12fce1ee58e670f9c3fce46c40296ba9ee8a2Ian Hodson func_show_eval '(cd "$output_objdir" && $RM "$linkname" && $LN_S "$realname" "$linkname")' 'exit $?' 8578f4c12fce1ee58e670f9c3fce46c40296ba9ee8a2Ian Hodson fi 8579f4c12fce1ee58e670f9c3fce46c40296ba9ee8a2Ian Hodson done 8580f4c12fce1ee58e670f9c3fce46c40296ba9ee8a2Ian Hodson 8581f4c12fce1ee58e670f9c3fce46c40296ba9ee8a2Ian Hodson # If -module or -export-dynamic was specified, set the dlname. 8582f4c12fce1ee58e670f9c3fce46c40296ba9ee8a2Ian Hodson if test "$module" = yes || test "$export_dynamic" = yes; then 8583f4c12fce1ee58e670f9c3fce46c40296ba9ee8a2Ian Hodson # On all known operating systems, these are identical. 8584f4c12fce1ee58e670f9c3fce46c40296ba9ee8a2Ian Hodson dlname="$soname" 8585f4c12fce1ee58e670f9c3fce46c40296ba9ee8a2Ian Hodson fi 8586f4c12fce1ee58e670f9c3fce46c40296ba9ee8a2Ian Hodson fi 8587f4c12fce1ee58e670f9c3fce46c40296ba9ee8a2Ian Hodson ;; 8588f4c12fce1ee58e670f9c3fce46c40296ba9ee8a2Ian Hodson 8589f4c12fce1ee58e670f9c3fce46c40296ba9ee8a2Ian Hodson obj) 8590f4c12fce1ee58e670f9c3fce46c40296ba9ee8a2Ian Hodson if test -n "$dlfiles$dlprefiles" || test "$dlself" != no; then 8591f4c12fce1ee58e670f9c3fce46c40296ba9ee8a2Ian Hodson func_warning "\`-dlopen' is ignored for objects" 8592f4c12fce1ee58e670f9c3fce46c40296ba9ee8a2Ian Hodson fi 8593f4c12fce1ee58e670f9c3fce46c40296ba9ee8a2Ian Hodson 8594f4c12fce1ee58e670f9c3fce46c40296ba9ee8a2Ian Hodson case " $deplibs" in 8595f4c12fce1ee58e670f9c3fce46c40296ba9ee8a2Ian Hodson *\ -l* | *\ -L*) 8596f4c12fce1ee58e670f9c3fce46c40296ba9ee8a2Ian Hodson func_warning "\`-l' and \`-L' are ignored for objects" ;; 8597f4c12fce1ee58e670f9c3fce46c40296ba9ee8a2Ian Hodson esac 8598f4c12fce1ee58e670f9c3fce46c40296ba9ee8a2Ian Hodson 8599f4c12fce1ee58e670f9c3fce46c40296ba9ee8a2Ian Hodson test -n "$rpath" && \ 8600f4c12fce1ee58e670f9c3fce46c40296ba9ee8a2Ian Hodson func_warning "\`-rpath' is ignored for objects" 8601f4c12fce1ee58e670f9c3fce46c40296ba9ee8a2Ian Hodson 8602f4c12fce1ee58e670f9c3fce46c40296ba9ee8a2Ian Hodson test -n "$xrpath" && \ 8603f4c12fce1ee58e670f9c3fce46c40296ba9ee8a2Ian Hodson func_warning "\`-R' is ignored for objects" 8604f4c12fce1ee58e670f9c3fce46c40296ba9ee8a2Ian Hodson 8605f4c12fce1ee58e670f9c3fce46c40296ba9ee8a2Ian Hodson test -n "$vinfo" && \ 8606f4c12fce1ee58e670f9c3fce46c40296ba9ee8a2Ian Hodson func_warning "\`-version-info' is ignored for objects" 8607f4c12fce1ee58e670f9c3fce46c40296ba9ee8a2Ian Hodson 8608f4c12fce1ee58e670f9c3fce46c40296ba9ee8a2Ian Hodson test -n "$release" && \ 8609f4c12fce1ee58e670f9c3fce46c40296ba9ee8a2Ian Hodson func_warning "\`-release' is ignored for objects" 8610f4c12fce1ee58e670f9c3fce46c40296ba9ee8a2Ian Hodson 8611f4c12fce1ee58e670f9c3fce46c40296ba9ee8a2Ian Hodson case $output in 8612f4c12fce1ee58e670f9c3fce46c40296ba9ee8a2Ian Hodson *.lo) 8613f4c12fce1ee58e670f9c3fce46c40296ba9ee8a2Ian Hodson test -n "$objs$old_deplibs" && \ 8614f4c12fce1ee58e670f9c3fce46c40296ba9ee8a2Ian Hodson func_fatal_error "cannot build library object \`$output' from non-libtool objects" 8615f4c12fce1ee58e670f9c3fce46c40296ba9ee8a2Ian Hodson 8616f4c12fce1ee58e670f9c3fce46c40296ba9ee8a2Ian Hodson libobj=$output 8617f4c12fce1ee58e670f9c3fce46c40296ba9ee8a2Ian Hodson func_lo2o "$libobj" 8618f4c12fce1ee58e670f9c3fce46c40296ba9ee8a2Ian Hodson obj=$func_lo2o_result 8619f4c12fce1ee58e670f9c3fce46c40296ba9ee8a2Ian Hodson ;; 8620f4c12fce1ee58e670f9c3fce46c40296ba9ee8a2Ian Hodson *) 8621f4c12fce1ee58e670f9c3fce46c40296ba9ee8a2Ian Hodson libobj= 8622f4c12fce1ee58e670f9c3fce46c40296ba9ee8a2Ian Hodson obj="$output" 8623f4c12fce1ee58e670f9c3fce46c40296ba9ee8a2Ian Hodson ;; 8624f4c12fce1ee58e670f9c3fce46c40296ba9ee8a2Ian Hodson esac 8625f4c12fce1ee58e670f9c3fce46c40296ba9ee8a2Ian Hodson 8626f4c12fce1ee58e670f9c3fce46c40296ba9ee8a2Ian Hodson # Delete the old objects. 8627f4c12fce1ee58e670f9c3fce46c40296ba9ee8a2Ian Hodson $opt_dry_run || $RM $obj $libobj 8628f4c12fce1ee58e670f9c3fce46c40296ba9ee8a2Ian Hodson 8629f4c12fce1ee58e670f9c3fce46c40296ba9ee8a2Ian Hodson # Objects from convenience libraries. This assumes 8630f4c12fce1ee58e670f9c3fce46c40296ba9ee8a2Ian Hodson # single-version convenience libraries. Whenever we create 8631f4c12fce1ee58e670f9c3fce46c40296ba9ee8a2Ian Hodson # different ones for PIC/non-PIC, this we'll have to duplicate 8632f4c12fce1ee58e670f9c3fce46c40296ba9ee8a2Ian Hodson # the extraction. 8633f4c12fce1ee58e670f9c3fce46c40296ba9ee8a2Ian Hodson reload_conv_objs= 8634f4c12fce1ee58e670f9c3fce46c40296ba9ee8a2Ian Hodson gentop= 8635f4c12fce1ee58e670f9c3fce46c40296ba9ee8a2Ian Hodson # reload_cmds runs $LD directly, so let us get rid of 8636f4c12fce1ee58e670f9c3fce46c40296ba9ee8a2Ian Hodson # -Wl from whole_archive_flag_spec and hope we can get by with 8637f4c12fce1ee58e670f9c3fce46c40296ba9ee8a2Ian Hodson # turning comma into space.. 8638f4c12fce1ee58e670f9c3fce46c40296ba9ee8a2Ian Hodson wl= 8639f4c12fce1ee58e670f9c3fce46c40296ba9ee8a2Ian Hodson 8640f4c12fce1ee58e670f9c3fce46c40296ba9ee8a2Ian Hodson if test -n "$convenience"; then 8641f4c12fce1ee58e670f9c3fce46c40296ba9ee8a2Ian Hodson if test -n "$whole_archive_flag_spec"; then 8642f4c12fce1ee58e670f9c3fce46c40296ba9ee8a2Ian Hodson eval tmp_whole_archive_flags=\"$whole_archive_flag_spec\" 86435b6dc79427b8f7eeb6a7ff68034ab8548ce670eaAlexander Gutkin reload_conv_objs=$reload_objs\ `$ECHO "$tmp_whole_archive_flags" | $SED 's|,| |g'` 8644f4c12fce1ee58e670f9c3fce46c40296ba9ee8a2Ian Hodson else 8645f4c12fce1ee58e670f9c3fce46c40296ba9ee8a2Ian Hodson gentop="$output_objdir/${obj}x" 86465b6dc79427b8f7eeb6a7ff68034ab8548ce670eaAlexander Gutkin func_append generated " $gentop" 8647f4c12fce1ee58e670f9c3fce46c40296ba9ee8a2Ian Hodson 8648f4c12fce1ee58e670f9c3fce46c40296ba9ee8a2Ian Hodson func_extract_archives $gentop $convenience 8649f4c12fce1ee58e670f9c3fce46c40296ba9ee8a2Ian Hodson reload_conv_objs="$reload_objs $func_extract_archives_result" 8650f4c12fce1ee58e670f9c3fce46c40296ba9ee8a2Ian Hodson fi 8651f4c12fce1ee58e670f9c3fce46c40296ba9ee8a2Ian Hodson fi 8652f4c12fce1ee58e670f9c3fce46c40296ba9ee8a2Ian Hodson 86535b6dc79427b8f7eeb6a7ff68034ab8548ce670eaAlexander Gutkin # If we're not building shared, we need to use non_pic_objs 86545b6dc79427b8f7eeb6a7ff68034ab8548ce670eaAlexander Gutkin test "$build_libtool_libs" != yes && libobjs="$non_pic_objects" 86555b6dc79427b8f7eeb6a7ff68034ab8548ce670eaAlexander Gutkin 8656f4c12fce1ee58e670f9c3fce46c40296ba9ee8a2Ian Hodson # Create the old-style object. 86575b6dc79427b8f7eeb6a7ff68034ab8548ce670eaAlexander Gutkin reload_objs="$objs$old_deplibs "`$ECHO "$libobjs" | $SP2NL | $SED "/\.${libext}$/d; /\.lib$/d; $lo2o" | $NL2SP`" $reload_conv_objs" ### testsuite: skip nested quoting test 8658f4c12fce1ee58e670f9c3fce46c40296ba9ee8a2Ian Hodson 8659f4c12fce1ee58e670f9c3fce46c40296ba9ee8a2Ian Hodson output="$obj" 8660f4c12fce1ee58e670f9c3fce46c40296ba9ee8a2Ian Hodson func_execute_cmds "$reload_cmds" 'exit $?' 8661f4c12fce1ee58e670f9c3fce46c40296ba9ee8a2Ian Hodson 8662f4c12fce1ee58e670f9c3fce46c40296ba9ee8a2Ian Hodson # Exit if we aren't doing a library object file. 8663f4c12fce1ee58e670f9c3fce46c40296ba9ee8a2Ian Hodson if test -z "$libobj"; then 8664f4c12fce1ee58e670f9c3fce46c40296ba9ee8a2Ian Hodson if test -n "$gentop"; then 8665f4c12fce1ee58e670f9c3fce46c40296ba9ee8a2Ian Hodson func_show_eval '${RM}r "$gentop"' 8666f4c12fce1ee58e670f9c3fce46c40296ba9ee8a2Ian Hodson fi 8667f4c12fce1ee58e670f9c3fce46c40296ba9ee8a2Ian Hodson 8668f4c12fce1ee58e670f9c3fce46c40296ba9ee8a2Ian Hodson exit $EXIT_SUCCESS 8669f4c12fce1ee58e670f9c3fce46c40296ba9ee8a2Ian Hodson fi 8670f4c12fce1ee58e670f9c3fce46c40296ba9ee8a2Ian Hodson 8671f4c12fce1ee58e670f9c3fce46c40296ba9ee8a2Ian Hodson if test "$build_libtool_libs" != yes; then 8672f4c12fce1ee58e670f9c3fce46c40296ba9ee8a2Ian Hodson if test -n "$gentop"; then 8673f4c12fce1ee58e670f9c3fce46c40296ba9ee8a2Ian Hodson func_show_eval '${RM}r "$gentop"' 8674f4c12fce1ee58e670f9c3fce46c40296ba9ee8a2Ian Hodson fi 8675f4c12fce1ee58e670f9c3fce46c40296ba9ee8a2Ian Hodson 8676f4c12fce1ee58e670f9c3fce46c40296ba9ee8a2Ian Hodson # Create an invalid libtool object if no PIC, so that we don't 8677f4c12fce1ee58e670f9c3fce46c40296ba9ee8a2Ian Hodson # accidentally link it into a program. 8678f4c12fce1ee58e670f9c3fce46c40296ba9ee8a2Ian Hodson # $show "echo timestamp > $libobj" 8679f4c12fce1ee58e670f9c3fce46c40296ba9ee8a2Ian Hodson # $opt_dry_run || eval "echo timestamp > $libobj" || exit $? 8680f4c12fce1ee58e670f9c3fce46c40296ba9ee8a2Ian Hodson exit $EXIT_SUCCESS 8681f4c12fce1ee58e670f9c3fce46c40296ba9ee8a2Ian Hodson fi 8682f4c12fce1ee58e670f9c3fce46c40296ba9ee8a2Ian Hodson 8683f4c12fce1ee58e670f9c3fce46c40296ba9ee8a2Ian Hodson if test -n "$pic_flag" || test "$pic_mode" != default; then 8684f4c12fce1ee58e670f9c3fce46c40296ba9ee8a2Ian Hodson # Only do commands if we really have different PIC objects. 8685f4c12fce1ee58e670f9c3fce46c40296ba9ee8a2Ian Hodson reload_objs="$libobjs $reload_conv_objs" 8686f4c12fce1ee58e670f9c3fce46c40296ba9ee8a2Ian Hodson output="$libobj" 8687f4c12fce1ee58e670f9c3fce46c40296ba9ee8a2Ian Hodson func_execute_cmds "$reload_cmds" 'exit $?' 8688f4c12fce1ee58e670f9c3fce46c40296ba9ee8a2Ian Hodson fi 8689f4c12fce1ee58e670f9c3fce46c40296ba9ee8a2Ian Hodson 8690f4c12fce1ee58e670f9c3fce46c40296ba9ee8a2Ian Hodson if test -n "$gentop"; then 8691f4c12fce1ee58e670f9c3fce46c40296ba9ee8a2Ian Hodson func_show_eval '${RM}r "$gentop"' 8692f4c12fce1ee58e670f9c3fce46c40296ba9ee8a2Ian Hodson fi 8693f4c12fce1ee58e670f9c3fce46c40296ba9ee8a2Ian Hodson 8694f4c12fce1ee58e670f9c3fce46c40296ba9ee8a2Ian Hodson exit $EXIT_SUCCESS 8695f4c12fce1ee58e670f9c3fce46c40296ba9ee8a2Ian Hodson ;; 8696f4c12fce1ee58e670f9c3fce46c40296ba9ee8a2Ian Hodson 8697f4c12fce1ee58e670f9c3fce46c40296ba9ee8a2Ian Hodson prog) 8698f4c12fce1ee58e670f9c3fce46c40296ba9ee8a2Ian Hodson case $host in 8699f4c12fce1ee58e670f9c3fce46c40296ba9ee8a2Ian Hodson *cygwin*) func_stripname '' '.exe' "$output" 8700f4c12fce1ee58e670f9c3fce46c40296ba9ee8a2Ian Hodson output=$func_stripname_result.exe;; 8701f4c12fce1ee58e670f9c3fce46c40296ba9ee8a2Ian Hodson esac 8702f4c12fce1ee58e670f9c3fce46c40296ba9ee8a2Ian Hodson test -n "$vinfo" && \ 8703f4c12fce1ee58e670f9c3fce46c40296ba9ee8a2Ian Hodson func_warning "\`-version-info' is ignored for programs" 8704f4c12fce1ee58e670f9c3fce46c40296ba9ee8a2Ian Hodson 8705f4c12fce1ee58e670f9c3fce46c40296ba9ee8a2Ian Hodson test -n "$release" && \ 8706f4c12fce1ee58e670f9c3fce46c40296ba9ee8a2Ian Hodson func_warning "\`-release' is ignored for programs" 8707f4c12fce1ee58e670f9c3fce46c40296ba9ee8a2Ian Hodson 8708f4c12fce1ee58e670f9c3fce46c40296ba9ee8a2Ian Hodson test "$preload" = yes \ 8709f4c12fce1ee58e670f9c3fce46c40296ba9ee8a2Ian Hodson && test "$dlopen_support" = unknown \ 8710f4c12fce1ee58e670f9c3fce46c40296ba9ee8a2Ian Hodson && test "$dlopen_self" = unknown \ 8711f4c12fce1ee58e670f9c3fce46c40296ba9ee8a2Ian Hodson && test "$dlopen_self_static" = unknown && \ 8712f4c12fce1ee58e670f9c3fce46c40296ba9ee8a2Ian Hodson func_warning "\`LT_INIT([dlopen])' not used. Assuming no dlopen support." 8713f4c12fce1ee58e670f9c3fce46c40296ba9ee8a2Ian Hodson 8714f4c12fce1ee58e670f9c3fce46c40296ba9ee8a2Ian Hodson case $host in 8715f4c12fce1ee58e670f9c3fce46c40296ba9ee8a2Ian Hodson *-*-rhapsody* | *-*-darwin1.[012]) 8716f4c12fce1ee58e670f9c3fce46c40296ba9ee8a2Ian Hodson # On Rhapsody replace the C library is the System framework 87175b6dc79427b8f7eeb6a7ff68034ab8548ce670eaAlexander Gutkin compile_deplibs=`$ECHO " $compile_deplibs" | $SED 's/ -lc / System.ltframework /'` 87185b6dc79427b8f7eeb6a7ff68034ab8548ce670eaAlexander Gutkin finalize_deplibs=`$ECHO " $finalize_deplibs" | $SED 's/ -lc / System.ltframework /'` 8719f4c12fce1ee58e670f9c3fce46c40296ba9ee8a2Ian Hodson ;; 8720f4c12fce1ee58e670f9c3fce46c40296ba9ee8a2Ian Hodson esac 8721f4c12fce1ee58e670f9c3fce46c40296ba9ee8a2Ian Hodson 8722f4c12fce1ee58e670f9c3fce46c40296ba9ee8a2Ian Hodson case $host in 8723f4c12fce1ee58e670f9c3fce46c40296ba9ee8a2Ian Hodson *-*-darwin*) 8724f4c12fce1ee58e670f9c3fce46c40296ba9ee8a2Ian Hodson # Don't allow lazy linking, it breaks C++ global constructors 8725f4c12fce1ee58e670f9c3fce46c40296ba9ee8a2Ian Hodson # But is supposedly fixed on 10.4 or later (yay!). 8726f4c12fce1ee58e670f9c3fce46c40296ba9ee8a2Ian Hodson if test "$tagname" = CXX ; then 8727f4c12fce1ee58e670f9c3fce46c40296ba9ee8a2Ian Hodson case ${MACOSX_DEPLOYMENT_TARGET-10.0} in 8728f4c12fce1ee58e670f9c3fce46c40296ba9ee8a2Ian Hodson 10.[0123]) 87295b6dc79427b8f7eeb6a7ff68034ab8548ce670eaAlexander Gutkin func_append compile_command " ${wl}-bind_at_load" 87305b6dc79427b8f7eeb6a7ff68034ab8548ce670eaAlexander Gutkin func_append finalize_command " ${wl}-bind_at_load" 8731f4c12fce1ee58e670f9c3fce46c40296ba9ee8a2Ian Hodson ;; 8732f4c12fce1ee58e670f9c3fce46c40296ba9ee8a2Ian Hodson esac 8733f4c12fce1ee58e670f9c3fce46c40296ba9ee8a2Ian Hodson fi 8734f4c12fce1ee58e670f9c3fce46c40296ba9ee8a2Ian Hodson # Time to change all our "foo.ltframework" stuff back to "-framework foo" 87355b6dc79427b8f7eeb6a7ff68034ab8548ce670eaAlexander Gutkin compile_deplibs=`$ECHO " $compile_deplibs" | $SED 's% \([^ $]*\).ltframework% -framework \1%g'` 87365b6dc79427b8f7eeb6a7ff68034ab8548ce670eaAlexander Gutkin finalize_deplibs=`$ECHO " $finalize_deplibs" | $SED 's% \([^ $]*\).ltframework% -framework \1%g'` 8737f4c12fce1ee58e670f9c3fce46c40296ba9ee8a2Ian Hodson ;; 8738f4c12fce1ee58e670f9c3fce46c40296ba9ee8a2Ian Hodson esac 8739f4c12fce1ee58e670f9c3fce46c40296ba9ee8a2Ian Hodson 8740f4c12fce1ee58e670f9c3fce46c40296ba9ee8a2Ian Hodson 8741f4c12fce1ee58e670f9c3fce46c40296ba9ee8a2Ian Hodson # move library search paths that coincide with paths to not yet 8742f4c12fce1ee58e670f9c3fce46c40296ba9ee8a2Ian Hodson # installed libraries to the beginning of the library search list 8743f4c12fce1ee58e670f9c3fce46c40296ba9ee8a2Ian Hodson new_libs= 8744f4c12fce1ee58e670f9c3fce46c40296ba9ee8a2Ian Hodson for path in $notinst_path; do 8745f4c12fce1ee58e670f9c3fce46c40296ba9ee8a2Ian Hodson case " $new_libs " in 8746f4c12fce1ee58e670f9c3fce46c40296ba9ee8a2Ian Hodson *" -L$path/$objdir "*) ;; 8747f4c12fce1ee58e670f9c3fce46c40296ba9ee8a2Ian Hodson *) 8748f4c12fce1ee58e670f9c3fce46c40296ba9ee8a2Ian Hodson case " $compile_deplibs " in 8749f4c12fce1ee58e670f9c3fce46c40296ba9ee8a2Ian Hodson *" -L$path/$objdir "*) 87505b6dc79427b8f7eeb6a7ff68034ab8548ce670eaAlexander Gutkin func_append new_libs " -L$path/$objdir" ;; 8751f4c12fce1ee58e670f9c3fce46c40296ba9ee8a2Ian Hodson esac 8752f4c12fce1ee58e670f9c3fce46c40296ba9ee8a2Ian Hodson ;; 8753f4c12fce1ee58e670f9c3fce46c40296ba9ee8a2Ian Hodson esac 8754f4c12fce1ee58e670f9c3fce46c40296ba9ee8a2Ian Hodson done 8755f4c12fce1ee58e670f9c3fce46c40296ba9ee8a2Ian Hodson for deplib in $compile_deplibs; do 8756f4c12fce1ee58e670f9c3fce46c40296ba9ee8a2Ian Hodson case $deplib in 8757f4c12fce1ee58e670f9c3fce46c40296ba9ee8a2Ian Hodson -L*) 8758f4c12fce1ee58e670f9c3fce46c40296ba9ee8a2Ian Hodson case " $new_libs " in 8759f4c12fce1ee58e670f9c3fce46c40296ba9ee8a2Ian Hodson *" $deplib "*) ;; 87605b6dc79427b8f7eeb6a7ff68034ab8548ce670eaAlexander Gutkin *) func_append new_libs " $deplib" ;; 8761f4c12fce1ee58e670f9c3fce46c40296ba9ee8a2Ian Hodson esac 8762f4c12fce1ee58e670f9c3fce46c40296ba9ee8a2Ian Hodson ;; 87635b6dc79427b8f7eeb6a7ff68034ab8548ce670eaAlexander Gutkin *) func_append new_libs " $deplib" ;; 8764f4c12fce1ee58e670f9c3fce46c40296ba9ee8a2Ian Hodson esac 8765f4c12fce1ee58e670f9c3fce46c40296ba9ee8a2Ian Hodson done 8766f4c12fce1ee58e670f9c3fce46c40296ba9ee8a2Ian Hodson compile_deplibs="$new_libs" 8767f4c12fce1ee58e670f9c3fce46c40296ba9ee8a2Ian Hodson 8768f4c12fce1ee58e670f9c3fce46c40296ba9ee8a2Ian Hodson 87695b6dc79427b8f7eeb6a7ff68034ab8548ce670eaAlexander Gutkin func_append compile_command " $compile_deplibs" 87705b6dc79427b8f7eeb6a7ff68034ab8548ce670eaAlexander Gutkin func_append finalize_command " $finalize_deplibs" 8771f4c12fce1ee58e670f9c3fce46c40296ba9ee8a2Ian Hodson 8772f4c12fce1ee58e670f9c3fce46c40296ba9ee8a2Ian Hodson if test -n "$rpath$xrpath"; then 8773f4c12fce1ee58e670f9c3fce46c40296ba9ee8a2Ian Hodson # If the user specified any rpath flags, then add them. 8774f4c12fce1ee58e670f9c3fce46c40296ba9ee8a2Ian Hodson for libdir in $rpath $xrpath; do 8775f4c12fce1ee58e670f9c3fce46c40296ba9ee8a2Ian Hodson # This is the magic to use -rpath. 8776f4c12fce1ee58e670f9c3fce46c40296ba9ee8a2Ian Hodson case "$finalize_rpath " in 8777f4c12fce1ee58e670f9c3fce46c40296ba9ee8a2Ian Hodson *" $libdir "*) ;; 87785b6dc79427b8f7eeb6a7ff68034ab8548ce670eaAlexander Gutkin *) func_append finalize_rpath " $libdir" ;; 8779f4c12fce1ee58e670f9c3fce46c40296ba9ee8a2Ian Hodson esac 8780f4c12fce1ee58e670f9c3fce46c40296ba9ee8a2Ian Hodson done 8781f4c12fce1ee58e670f9c3fce46c40296ba9ee8a2Ian Hodson fi 8782f4c12fce1ee58e670f9c3fce46c40296ba9ee8a2Ian Hodson 8783f4c12fce1ee58e670f9c3fce46c40296ba9ee8a2Ian Hodson # Now hardcode the library paths 8784f4c12fce1ee58e670f9c3fce46c40296ba9ee8a2Ian Hodson rpath= 8785f4c12fce1ee58e670f9c3fce46c40296ba9ee8a2Ian Hodson hardcode_libdirs= 8786f4c12fce1ee58e670f9c3fce46c40296ba9ee8a2Ian Hodson for libdir in $compile_rpath $finalize_rpath; do 8787f4c12fce1ee58e670f9c3fce46c40296ba9ee8a2Ian Hodson if test -n "$hardcode_libdir_flag_spec"; then 8788f4c12fce1ee58e670f9c3fce46c40296ba9ee8a2Ian Hodson if test -n "$hardcode_libdir_separator"; then 8789f4c12fce1ee58e670f9c3fce46c40296ba9ee8a2Ian Hodson if test -z "$hardcode_libdirs"; then 8790f4c12fce1ee58e670f9c3fce46c40296ba9ee8a2Ian Hodson hardcode_libdirs="$libdir" 8791f4c12fce1ee58e670f9c3fce46c40296ba9ee8a2Ian Hodson else 8792f4c12fce1ee58e670f9c3fce46c40296ba9ee8a2Ian Hodson # Just accumulate the unique libdirs. 8793f4c12fce1ee58e670f9c3fce46c40296ba9ee8a2Ian Hodson case $hardcode_libdir_separator$hardcode_libdirs$hardcode_libdir_separator in 8794f4c12fce1ee58e670f9c3fce46c40296ba9ee8a2Ian Hodson *"$hardcode_libdir_separator$libdir$hardcode_libdir_separator"*) 8795f4c12fce1ee58e670f9c3fce46c40296ba9ee8a2Ian Hodson ;; 8796f4c12fce1ee58e670f9c3fce46c40296ba9ee8a2Ian Hodson *) 87975b6dc79427b8f7eeb6a7ff68034ab8548ce670eaAlexander Gutkin func_append hardcode_libdirs "$hardcode_libdir_separator$libdir" 8798f4c12fce1ee58e670f9c3fce46c40296ba9ee8a2Ian Hodson ;; 8799f4c12fce1ee58e670f9c3fce46c40296ba9ee8a2Ian Hodson esac 8800f4c12fce1ee58e670f9c3fce46c40296ba9ee8a2Ian Hodson fi 8801f4c12fce1ee58e670f9c3fce46c40296ba9ee8a2Ian Hodson else 8802f4c12fce1ee58e670f9c3fce46c40296ba9ee8a2Ian Hodson eval flag=\"$hardcode_libdir_flag_spec\" 88035b6dc79427b8f7eeb6a7ff68034ab8548ce670eaAlexander Gutkin func_append rpath " $flag" 8804f4c12fce1ee58e670f9c3fce46c40296ba9ee8a2Ian Hodson fi 8805f4c12fce1ee58e670f9c3fce46c40296ba9ee8a2Ian Hodson elif test -n "$runpath_var"; then 8806f4c12fce1ee58e670f9c3fce46c40296ba9ee8a2Ian Hodson case "$perm_rpath " in 8807f4c12fce1ee58e670f9c3fce46c40296ba9ee8a2Ian Hodson *" $libdir "*) ;; 88085b6dc79427b8f7eeb6a7ff68034ab8548ce670eaAlexander Gutkin *) func_append perm_rpath " $libdir" ;; 8809f4c12fce1ee58e670f9c3fce46c40296ba9ee8a2Ian Hodson esac 8810f4c12fce1ee58e670f9c3fce46c40296ba9ee8a2Ian Hodson fi 8811f4c12fce1ee58e670f9c3fce46c40296ba9ee8a2Ian Hodson case $host in 8812f4c12fce1ee58e670f9c3fce46c40296ba9ee8a2Ian Hodson *-*-cygwin* | *-*-mingw* | *-*-pw32* | *-*-os2* | *-cegcc*) 8813f4c12fce1ee58e670f9c3fce46c40296ba9ee8a2Ian Hodson testbindir=`${ECHO} "$libdir" | ${SED} -e 's*/lib$*/bin*'` 8814f4c12fce1ee58e670f9c3fce46c40296ba9ee8a2Ian Hodson case :$dllsearchpath: in 8815f4c12fce1ee58e670f9c3fce46c40296ba9ee8a2Ian Hodson *":$libdir:"*) ;; 8816f4c12fce1ee58e670f9c3fce46c40296ba9ee8a2Ian Hodson ::) dllsearchpath=$libdir;; 88175b6dc79427b8f7eeb6a7ff68034ab8548ce670eaAlexander Gutkin *) func_append dllsearchpath ":$libdir";; 8818f4c12fce1ee58e670f9c3fce46c40296ba9ee8a2Ian Hodson esac 8819f4c12fce1ee58e670f9c3fce46c40296ba9ee8a2Ian Hodson case :$dllsearchpath: in 8820f4c12fce1ee58e670f9c3fce46c40296ba9ee8a2Ian Hodson *":$testbindir:"*) ;; 8821f4c12fce1ee58e670f9c3fce46c40296ba9ee8a2Ian Hodson ::) dllsearchpath=$testbindir;; 88225b6dc79427b8f7eeb6a7ff68034ab8548ce670eaAlexander Gutkin *) func_append dllsearchpath ":$testbindir";; 8823f4c12fce1ee58e670f9c3fce46c40296ba9ee8a2Ian Hodson esac 8824f4c12fce1ee58e670f9c3fce46c40296ba9ee8a2Ian Hodson ;; 8825f4c12fce1ee58e670f9c3fce46c40296ba9ee8a2Ian Hodson esac 8826f4c12fce1ee58e670f9c3fce46c40296ba9ee8a2Ian Hodson done 8827f4c12fce1ee58e670f9c3fce46c40296ba9ee8a2Ian Hodson # Substitute the hardcoded libdirs into the rpath. 8828f4c12fce1ee58e670f9c3fce46c40296ba9ee8a2Ian Hodson if test -n "$hardcode_libdir_separator" && 8829f4c12fce1ee58e670f9c3fce46c40296ba9ee8a2Ian Hodson test -n "$hardcode_libdirs"; then 8830f4c12fce1ee58e670f9c3fce46c40296ba9ee8a2Ian Hodson libdir="$hardcode_libdirs" 8831f4c12fce1ee58e670f9c3fce46c40296ba9ee8a2Ian Hodson eval rpath=\" $hardcode_libdir_flag_spec\" 8832f4c12fce1ee58e670f9c3fce46c40296ba9ee8a2Ian Hodson fi 8833f4c12fce1ee58e670f9c3fce46c40296ba9ee8a2Ian Hodson compile_rpath="$rpath" 8834f4c12fce1ee58e670f9c3fce46c40296ba9ee8a2Ian Hodson 8835f4c12fce1ee58e670f9c3fce46c40296ba9ee8a2Ian Hodson rpath= 8836f4c12fce1ee58e670f9c3fce46c40296ba9ee8a2Ian Hodson hardcode_libdirs= 8837f4c12fce1ee58e670f9c3fce46c40296ba9ee8a2Ian Hodson for libdir in $finalize_rpath; do 8838f4c12fce1ee58e670f9c3fce46c40296ba9ee8a2Ian Hodson if test -n "$hardcode_libdir_flag_spec"; then 8839f4c12fce1ee58e670f9c3fce46c40296ba9ee8a2Ian Hodson if test -n "$hardcode_libdir_separator"; then 8840f4c12fce1ee58e670f9c3fce46c40296ba9ee8a2Ian Hodson if test -z "$hardcode_libdirs"; then 8841f4c12fce1ee58e670f9c3fce46c40296ba9ee8a2Ian Hodson hardcode_libdirs="$libdir" 8842f4c12fce1ee58e670f9c3fce46c40296ba9ee8a2Ian Hodson else 8843f4c12fce1ee58e670f9c3fce46c40296ba9ee8a2Ian Hodson # Just accumulate the unique libdirs. 8844f4c12fce1ee58e670f9c3fce46c40296ba9ee8a2Ian Hodson case $hardcode_libdir_separator$hardcode_libdirs$hardcode_libdir_separator in 8845f4c12fce1ee58e670f9c3fce46c40296ba9ee8a2Ian Hodson *"$hardcode_libdir_separator$libdir$hardcode_libdir_separator"*) 8846f4c12fce1ee58e670f9c3fce46c40296ba9ee8a2Ian Hodson ;; 8847f4c12fce1ee58e670f9c3fce46c40296ba9ee8a2Ian Hodson *) 88485b6dc79427b8f7eeb6a7ff68034ab8548ce670eaAlexander Gutkin func_append hardcode_libdirs "$hardcode_libdir_separator$libdir" 8849f4c12fce1ee58e670f9c3fce46c40296ba9ee8a2Ian Hodson ;; 8850f4c12fce1ee58e670f9c3fce46c40296ba9ee8a2Ian Hodson esac 8851f4c12fce1ee58e670f9c3fce46c40296ba9ee8a2Ian Hodson fi 8852f4c12fce1ee58e670f9c3fce46c40296ba9ee8a2Ian Hodson else 8853f4c12fce1ee58e670f9c3fce46c40296ba9ee8a2Ian Hodson eval flag=\"$hardcode_libdir_flag_spec\" 88545b6dc79427b8f7eeb6a7ff68034ab8548ce670eaAlexander Gutkin func_append rpath " $flag" 8855f4c12fce1ee58e670f9c3fce46c40296ba9ee8a2Ian Hodson fi 8856f4c12fce1ee58e670f9c3fce46c40296ba9ee8a2Ian Hodson elif test -n "$runpath_var"; then 8857f4c12fce1ee58e670f9c3fce46c40296ba9ee8a2Ian Hodson case "$finalize_perm_rpath " in 8858f4c12fce1ee58e670f9c3fce46c40296ba9ee8a2Ian Hodson *" $libdir "*) ;; 88595b6dc79427b8f7eeb6a7ff68034ab8548ce670eaAlexander Gutkin *) func_append finalize_perm_rpath " $libdir" ;; 8860f4c12fce1ee58e670f9c3fce46c40296ba9ee8a2Ian Hodson esac 8861f4c12fce1ee58e670f9c3fce46c40296ba9ee8a2Ian Hodson fi 8862f4c12fce1ee58e670f9c3fce46c40296ba9ee8a2Ian Hodson done 8863f4c12fce1ee58e670f9c3fce46c40296ba9ee8a2Ian Hodson # Substitute the hardcoded libdirs into the rpath. 8864f4c12fce1ee58e670f9c3fce46c40296ba9ee8a2Ian Hodson if test -n "$hardcode_libdir_separator" && 8865f4c12fce1ee58e670f9c3fce46c40296ba9ee8a2Ian Hodson test -n "$hardcode_libdirs"; then 8866f4c12fce1ee58e670f9c3fce46c40296ba9ee8a2Ian Hodson libdir="$hardcode_libdirs" 8867f4c12fce1ee58e670f9c3fce46c40296ba9ee8a2Ian Hodson eval rpath=\" $hardcode_libdir_flag_spec\" 8868f4c12fce1ee58e670f9c3fce46c40296ba9ee8a2Ian Hodson fi 8869f4c12fce1ee58e670f9c3fce46c40296ba9ee8a2Ian Hodson finalize_rpath="$rpath" 8870f4c12fce1ee58e670f9c3fce46c40296ba9ee8a2Ian Hodson 8871f4c12fce1ee58e670f9c3fce46c40296ba9ee8a2Ian Hodson if test -n "$libobjs" && test "$build_old_libs" = yes; then 8872f4c12fce1ee58e670f9c3fce46c40296ba9ee8a2Ian Hodson # Transform all the library objects into standard objects. 88735b6dc79427b8f7eeb6a7ff68034ab8548ce670eaAlexander Gutkin compile_command=`$ECHO "$compile_command" | $SP2NL | $SED "$lo2o" | $NL2SP` 88745b6dc79427b8f7eeb6a7ff68034ab8548ce670eaAlexander Gutkin finalize_command=`$ECHO "$finalize_command" | $SP2NL | $SED "$lo2o" | $NL2SP` 8875f4c12fce1ee58e670f9c3fce46c40296ba9ee8a2Ian Hodson fi 8876f4c12fce1ee58e670f9c3fce46c40296ba9ee8a2Ian Hodson 8877f4c12fce1ee58e670f9c3fce46c40296ba9ee8a2Ian Hodson func_generate_dlsyms "$outputname" "@PROGRAM@" "no" 8878f4c12fce1ee58e670f9c3fce46c40296ba9ee8a2Ian Hodson 8879f4c12fce1ee58e670f9c3fce46c40296ba9ee8a2Ian Hodson # template prelinking step 8880f4c12fce1ee58e670f9c3fce46c40296ba9ee8a2Ian Hodson if test -n "$prelink_cmds"; then 8881f4c12fce1ee58e670f9c3fce46c40296ba9ee8a2Ian Hodson func_execute_cmds "$prelink_cmds" 'exit $?' 8882f4c12fce1ee58e670f9c3fce46c40296ba9ee8a2Ian Hodson fi 8883f4c12fce1ee58e670f9c3fce46c40296ba9ee8a2Ian Hodson 8884f4c12fce1ee58e670f9c3fce46c40296ba9ee8a2Ian Hodson wrappers_required=yes 8885f4c12fce1ee58e670f9c3fce46c40296ba9ee8a2Ian Hodson case $host in 88865b6dc79427b8f7eeb6a7ff68034ab8548ce670eaAlexander Gutkin *cegcc* | *mingw32ce*) 88875b6dc79427b8f7eeb6a7ff68034ab8548ce670eaAlexander Gutkin # Disable wrappers for cegcc and mingw32ce hosts, we are cross compiling anyway. 88885b6dc79427b8f7eeb6a7ff68034ab8548ce670eaAlexander Gutkin wrappers_required=no 88895b6dc79427b8f7eeb6a7ff68034ab8548ce670eaAlexander Gutkin ;; 8890f4c12fce1ee58e670f9c3fce46c40296ba9ee8a2Ian Hodson *cygwin* | *mingw* ) 8891f4c12fce1ee58e670f9c3fce46c40296ba9ee8a2Ian Hodson if test "$build_libtool_libs" != yes; then 8892f4c12fce1ee58e670f9c3fce46c40296ba9ee8a2Ian Hodson wrappers_required=no 8893f4c12fce1ee58e670f9c3fce46c40296ba9ee8a2Ian Hodson fi 8894f4c12fce1ee58e670f9c3fce46c40296ba9ee8a2Ian Hodson ;; 8895f4c12fce1ee58e670f9c3fce46c40296ba9ee8a2Ian Hodson *) 8896f4c12fce1ee58e670f9c3fce46c40296ba9ee8a2Ian Hodson if test "$need_relink" = no || test "$build_libtool_libs" != yes; then 8897f4c12fce1ee58e670f9c3fce46c40296ba9ee8a2Ian Hodson wrappers_required=no 8898f4c12fce1ee58e670f9c3fce46c40296ba9ee8a2Ian Hodson fi 8899f4c12fce1ee58e670f9c3fce46c40296ba9ee8a2Ian Hodson ;; 8900f4c12fce1ee58e670f9c3fce46c40296ba9ee8a2Ian Hodson esac 8901f4c12fce1ee58e670f9c3fce46c40296ba9ee8a2Ian Hodson if test "$wrappers_required" = no; then 8902f4c12fce1ee58e670f9c3fce46c40296ba9ee8a2Ian Hodson # Replace the output file specification. 89035b6dc79427b8f7eeb6a7ff68034ab8548ce670eaAlexander Gutkin compile_command=`$ECHO "$compile_command" | $SED 's%@OUTPUT@%'"$output"'%g'` 8904f4c12fce1ee58e670f9c3fce46c40296ba9ee8a2Ian Hodson link_command="$compile_command$compile_rpath" 8905f4c12fce1ee58e670f9c3fce46c40296ba9ee8a2Ian Hodson 8906f4c12fce1ee58e670f9c3fce46c40296ba9ee8a2Ian Hodson # We have no uninstalled library dependencies, so finalize right now. 8907f4c12fce1ee58e670f9c3fce46c40296ba9ee8a2Ian Hodson exit_status=0 8908f4c12fce1ee58e670f9c3fce46c40296ba9ee8a2Ian Hodson func_show_eval "$link_command" 'exit_status=$?' 8909f4c12fce1ee58e670f9c3fce46c40296ba9ee8a2Ian Hodson 89105b6dc79427b8f7eeb6a7ff68034ab8548ce670eaAlexander Gutkin if test -n "$postlink_cmds"; then 89115b6dc79427b8f7eeb6a7ff68034ab8548ce670eaAlexander Gutkin func_to_tool_file "$output" 89125b6dc79427b8f7eeb6a7ff68034ab8548ce670eaAlexander Gutkin postlink_cmds=`func_echo_all "$postlink_cmds" | $SED -e 's%@OUTPUT@%'"$output"'%g' -e 's%@TOOL_OUTPUT@%'"$func_to_tool_file_result"'%g'` 89135b6dc79427b8f7eeb6a7ff68034ab8548ce670eaAlexander Gutkin func_execute_cmds "$postlink_cmds" 'exit $?' 89145b6dc79427b8f7eeb6a7ff68034ab8548ce670eaAlexander Gutkin fi 89155b6dc79427b8f7eeb6a7ff68034ab8548ce670eaAlexander Gutkin 8916f4c12fce1ee58e670f9c3fce46c40296ba9ee8a2Ian Hodson # Delete the generated files. 8917f4c12fce1ee58e670f9c3fce46c40296ba9ee8a2Ian Hodson if test -f "$output_objdir/${outputname}S.${objext}"; then 8918f4c12fce1ee58e670f9c3fce46c40296ba9ee8a2Ian Hodson func_show_eval '$RM "$output_objdir/${outputname}S.${objext}"' 8919f4c12fce1ee58e670f9c3fce46c40296ba9ee8a2Ian Hodson fi 8920f4c12fce1ee58e670f9c3fce46c40296ba9ee8a2Ian Hodson 8921f4c12fce1ee58e670f9c3fce46c40296ba9ee8a2Ian Hodson exit $exit_status 8922f4c12fce1ee58e670f9c3fce46c40296ba9ee8a2Ian Hodson fi 8923f4c12fce1ee58e670f9c3fce46c40296ba9ee8a2Ian Hodson 8924f4c12fce1ee58e670f9c3fce46c40296ba9ee8a2Ian Hodson if test -n "$compile_shlibpath$finalize_shlibpath"; then 8925f4c12fce1ee58e670f9c3fce46c40296ba9ee8a2Ian Hodson compile_command="$shlibpath_var=\"$compile_shlibpath$finalize_shlibpath\$$shlibpath_var\" $compile_command" 8926f4c12fce1ee58e670f9c3fce46c40296ba9ee8a2Ian Hodson fi 8927f4c12fce1ee58e670f9c3fce46c40296ba9ee8a2Ian Hodson if test -n "$finalize_shlibpath"; then 8928f4c12fce1ee58e670f9c3fce46c40296ba9ee8a2Ian Hodson finalize_command="$shlibpath_var=\"$finalize_shlibpath\$$shlibpath_var\" $finalize_command" 8929f4c12fce1ee58e670f9c3fce46c40296ba9ee8a2Ian Hodson fi 8930f4c12fce1ee58e670f9c3fce46c40296ba9ee8a2Ian Hodson 8931f4c12fce1ee58e670f9c3fce46c40296ba9ee8a2Ian Hodson compile_var= 8932f4c12fce1ee58e670f9c3fce46c40296ba9ee8a2Ian Hodson finalize_var= 8933f4c12fce1ee58e670f9c3fce46c40296ba9ee8a2Ian Hodson if test -n "$runpath_var"; then 8934f4c12fce1ee58e670f9c3fce46c40296ba9ee8a2Ian Hodson if test -n "$perm_rpath"; then 8935f4c12fce1ee58e670f9c3fce46c40296ba9ee8a2Ian Hodson # We should set the runpath_var. 8936f4c12fce1ee58e670f9c3fce46c40296ba9ee8a2Ian Hodson rpath= 8937f4c12fce1ee58e670f9c3fce46c40296ba9ee8a2Ian Hodson for dir in $perm_rpath; do 89385b6dc79427b8f7eeb6a7ff68034ab8548ce670eaAlexander Gutkin func_append rpath "$dir:" 8939f4c12fce1ee58e670f9c3fce46c40296ba9ee8a2Ian Hodson done 8940f4c12fce1ee58e670f9c3fce46c40296ba9ee8a2Ian Hodson compile_var="$runpath_var=\"$rpath\$$runpath_var\" " 8941f4c12fce1ee58e670f9c3fce46c40296ba9ee8a2Ian Hodson fi 8942f4c12fce1ee58e670f9c3fce46c40296ba9ee8a2Ian Hodson if test -n "$finalize_perm_rpath"; then 8943f4c12fce1ee58e670f9c3fce46c40296ba9ee8a2Ian Hodson # We should set the runpath_var. 8944f4c12fce1ee58e670f9c3fce46c40296ba9ee8a2Ian Hodson rpath= 8945f4c12fce1ee58e670f9c3fce46c40296ba9ee8a2Ian Hodson for dir in $finalize_perm_rpath; do 89465b6dc79427b8f7eeb6a7ff68034ab8548ce670eaAlexander Gutkin func_append rpath "$dir:" 8947f4c12fce1ee58e670f9c3fce46c40296ba9ee8a2Ian Hodson done 8948f4c12fce1ee58e670f9c3fce46c40296ba9ee8a2Ian Hodson finalize_var="$runpath_var=\"$rpath\$$runpath_var\" " 8949f4c12fce1ee58e670f9c3fce46c40296ba9ee8a2Ian Hodson fi 8950f4c12fce1ee58e670f9c3fce46c40296ba9ee8a2Ian Hodson fi 8951f4c12fce1ee58e670f9c3fce46c40296ba9ee8a2Ian Hodson 8952f4c12fce1ee58e670f9c3fce46c40296ba9ee8a2Ian Hodson if test "$no_install" = yes; then 8953f4c12fce1ee58e670f9c3fce46c40296ba9ee8a2Ian Hodson # We don't need to create a wrapper script. 8954f4c12fce1ee58e670f9c3fce46c40296ba9ee8a2Ian Hodson link_command="$compile_var$compile_command$compile_rpath" 8955f4c12fce1ee58e670f9c3fce46c40296ba9ee8a2Ian Hodson # Replace the output file specification. 89565b6dc79427b8f7eeb6a7ff68034ab8548ce670eaAlexander Gutkin link_command=`$ECHO "$link_command" | $SED 's%@OUTPUT@%'"$output"'%g'` 8957f4c12fce1ee58e670f9c3fce46c40296ba9ee8a2Ian Hodson # Delete the old output file. 8958f4c12fce1ee58e670f9c3fce46c40296ba9ee8a2Ian Hodson $opt_dry_run || $RM $output 8959f4c12fce1ee58e670f9c3fce46c40296ba9ee8a2Ian Hodson # Link the executable and exit 8960f4c12fce1ee58e670f9c3fce46c40296ba9ee8a2Ian Hodson func_show_eval "$link_command" 'exit $?' 89615b6dc79427b8f7eeb6a7ff68034ab8548ce670eaAlexander Gutkin 89625b6dc79427b8f7eeb6a7ff68034ab8548ce670eaAlexander Gutkin if test -n "$postlink_cmds"; then 89635b6dc79427b8f7eeb6a7ff68034ab8548ce670eaAlexander Gutkin func_to_tool_file "$output" 89645b6dc79427b8f7eeb6a7ff68034ab8548ce670eaAlexander Gutkin postlink_cmds=`func_echo_all "$postlink_cmds" | $SED -e 's%@OUTPUT@%'"$output"'%g' -e 's%@TOOL_OUTPUT@%'"$func_to_tool_file_result"'%g'` 89655b6dc79427b8f7eeb6a7ff68034ab8548ce670eaAlexander Gutkin func_execute_cmds "$postlink_cmds" 'exit $?' 89665b6dc79427b8f7eeb6a7ff68034ab8548ce670eaAlexander Gutkin fi 89675b6dc79427b8f7eeb6a7ff68034ab8548ce670eaAlexander Gutkin 8968f4c12fce1ee58e670f9c3fce46c40296ba9ee8a2Ian Hodson exit $EXIT_SUCCESS 8969f4c12fce1ee58e670f9c3fce46c40296ba9ee8a2Ian Hodson fi 8970f4c12fce1ee58e670f9c3fce46c40296ba9ee8a2Ian Hodson 8971f4c12fce1ee58e670f9c3fce46c40296ba9ee8a2Ian Hodson if test "$hardcode_action" = relink; then 8972f4c12fce1ee58e670f9c3fce46c40296ba9ee8a2Ian Hodson # Fast installation is not supported 8973f4c12fce1ee58e670f9c3fce46c40296ba9ee8a2Ian Hodson link_command="$compile_var$compile_command$compile_rpath" 8974f4c12fce1ee58e670f9c3fce46c40296ba9ee8a2Ian Hodson relink_command="$finalize_var$finalize_command$finalize_rpath" 8975f4c12fce1ee58e670f9c3fce46c40296ba9ee8a2Ian Hodson 8976f4c12fce1ee58e670f9c3fce46c40296ba9ee8a2Ian Hodson func_warning "this platform does not like uninstalled shared libraries" 8977f4c12fce1ee58e670f9c3fce46c40296ba9ee8a2Ian Hodson func_warning "\`$output' will be relinked during installation" 8978f4c12fce1ee58e670f9c3fce46c40296ba9ee8a2Ian Hodson else 8979f4c12fce1ee58e670f9c3fce46c40296ba9ee8a2Ian Hodson if test "$fast_install" != no; then 8980f4c12fce1ee58e670f9c3fce46c40296ba9ee8a2Ian Hodson link_command="$finalize_var$compile_command$finalize_rpath" 8981f4c12fce1ee58e670f9c3fce46c40296ba9ee8a2Ian Hodson if test "$fast_install" = yes; then 89825b6dc79427b8f7eeb6a7ff68034ab8548ce670eaAlexander Gutkin relink_command=`$ECHO "$compile_var$compile_command$compile_rpath" | $SED 's%@OUTPUT@%\$progdir/\$file%g'` 8983f4c12fce1ee58e670f9c3fce46c40296ba9ee8a2Ian Hodson else 8984f4c12fce1ee58e670f9c3fce46c40296ba9ee8a2Ian Hodson # fast_install is set to needless 8985f4c12fce1ee58e670f9c3fce46c40296ba9ee8a2Ian Hodson relink_command= 8986f4c12fce1ee58e670f9c3fce46c40296ba9ee8a2Ian Hodson fi 8987f4c12fce1ee58e670f9c3fce46c40296ba9ee8a2Ian Hodson else 8988f4c12fce1ee58e670f9c3fce46c40296ba9ee8a2Ian Hodson link_command="$compile_var$compile_command$compile_rpath" 8989f4c12fce1ee58e670f9c3fce46c40296ba9ee8a2Ian Hodson relink_command="$finalize_var$finalize_command$finalize_rpath" 8990f4c12fce1ee58e670f9c3fce46c40296ba9ee8a2Ian Hodson fi 8991f4c12fce1ee58e670f9c3fce46c40296ba9ee8a2Ian Hodson fi 8992f4c12fce1ee58e670f9c3fce46c40296ba9ee8a2Ian Hodson 8993f4c12fce1ee58e670f9c3fce46c40296ba9ee8a2Ian Hodson # Replace the output file specification. 89945b6dc79427b8f7eeb6a7ff68034ab8548ce670eaAlexander Gutkin link_command=`$ECHO "$link_command" | $SED 's%@OUTPUT@%'"$output_objdir/$outputname"'%g'` 8995f4c12fce1ee58e670f9c3fce46c40296ba9ee8a2Ian Hodson 8996f4c12fce1ee58e670f9c3fce46c40296ba9ee8a2Ian Hodson # Delete the old output files. 8997f4c12fce1ee58e670f9c3fce46c40296ba9ee8a2Ian Hodson $opt_dry_run || $RM $output $output_objdir/$outputname $output_objdir/lt-$outputname 8998f4c12fce1ee58e670f9c3fce46c40296ba9ee8a2Ian Hodson 8999f4c12fce1ee58e670f9c3fce46c40296ba9ee8a2Ian Hodson func_show_eval "$link_command" 'exit $?' 9000f4c12fce1ee58e670f9c3fce46c40296ba9ee8a2Ian Hodson 90015b6dc79427b8f7eeb6a7ff68034ab8548ce670eaAlexander Gutkin if test -n "$postlink_cmds"; then 90025b6dc79427b8f7eeb6a7ff68034ab8548ce670eaAlexander Gutkin func_to_tool_file "$output_objdir/$outputname" 90035b6dc79427b8f7eeb6a7ff68034ab8548ce670eaAlexander Gutkin 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'` 90045b6dc79427b8f7eeb6a7ff68034ab8548ce670eaAlexander Gutkin func_execute_cmds "$postlink_cmds" 'exit $?' 90055b6dc79427b8f7eeb6a7ff68034ab8548ce670eaAlexander Gutkin fi 90065b6dc79427b8f7eeb6a7ff68034ab8548ce670eaAlexander Gutkin 9007f4c12fce1ee58e670f9c3fce46c40296ba9ee8a2Ian Hodson # Now create the wrapper script. 9008f4c12fce1ee58e670f9c3fce46c40296ba9ee8a2Ian Hodson func_verbose "creating $output" 9009f4c12fce1ee58e670f9c3fce46c40296ba9ee8a2Ian Hodson 9010f4c12fce1ee58e670f9c3fce46c40296ba9ee8a2Ian Hodson # Quote the relink command for shipping. 9011f4c12fce1ee58e670f9c3fce46c40296ba9ee8a2Ian Hodson if test -n "$relink_command"; then 9012f4c12fce1ee58e670f9c3fce46c40296ba9ee8a2Ian Hodson # Preserve any variables that may affect compiler behavior 9013f4c12fce1ee58e670f9c3fce46c40296ba9ee8a2Ian Hodson for var in $variables_saved_for_relink; do 9014f4c12fce1ee58e670f9c3fce46c40296ba9ee8a2Ian Hodson if eval test -z \"\${$var+set}\"; then 9015f4c12fce1ee58e670f9c3fce46c40296ba9ee8a2Ian Hodson relink_command="{ test -z \"\${$var+set}\" || $lt_unset $var || { $var=; export $var; }; }; $relink_command" 9016f4c12fce1ee58e670f9c3fce46c40296ba9ee8a2Ian Hodson elif eval var_value=\$$var; test -z "$var_value"; then 9017f4c12fce1ee58e670f9c3fce46c40296ba9ee8a2Ian Hodson relink_command="$var=; export $var; $relink_command" 9018f4c12fce1ee58e670f9c3fce46c40296ba9ee8a2Ian Hodson else 9019f4c12fce1ee58e670f9c3fce46c40296ba9ee8a2Ian Hodson func_quote_for_eval "$var_value" 9020f4c12fce1ee58e670f9c3fce46c40296ba9ee8a2Ian Hodson relink_command="$var=$func_quote_for_eval_result; export $var; $relink_command" 9021f4c12fce1ee58e670f9c3fce46c40296ba9ee8a2Ian Hodson fi 9022f4c12fce1ee58e670f9c3fce46c40296ba9ee8a2Ian Hodson done 9023f4c12fce1ee58e670f9c3fce46c40296ba9ee8a2Ian Hodson relink_command="(cd `pwd`; $relink_command)" 90245b6dc79427b8f7eeb6a7ff68034ab8548ce670eaAlexander Gutkin relink_command=`$ECHO "$relink_command" | $SED "$sed_quote_subst"` 9025f4c12fce1ee58e670f9c3fce46c40296ba9ee8a2Ian Hodson fi 9026f4c12fce1ee58e670f9c3fce46c40296ba9ee8a2Ian Hodson 9027f4c12fce1ee58e670f9c3fce46c40296ba9ee8a2Ian Hodson # Only actually do things if not in dry run mode. 9028f4c12fce1ee58e670f9c3fce46c40296ba9ee8a2Ian Hodson $opt_dry_run || { 9029f4c12fce1ee58e670f9c3fce46c40296ba9ee8a2Ian Hodson # win32 will think the script is a binary if it has 9030f4c12fce1ee58e670f9c3fce46c40296ba9ee8a2Ian Hodson # a .exe suffix, so we strip it off here. 9031f4c12fce1ee58e670f9c3fce46c40296ba9ee8a2Ian Hodson case $output in 9032f4c12fce1ee58e670f9c3fce46c40296ba9ee8a2Ian Hodson *.exe) func_stripname '' '.exe' "$output" 9033f4c12fce1ee58e670f9c3fce46c40296ba9ee8a2Ian Hodson output=$func_stripname_result ;; 9034f4c12fce1ee58e670f9c3fce46c40296ba9ee8a2Ian Hodson esac 9035f4c12fce1ee58e670f9c3fce46c40296ba9ee8a2Ian Hodson # test for cygwin because mv fails w/o .exe extensions 9036f4c12fce1ee58e670f9c3fce46c40296ba9ee8a2Ian Hodson case $host in 9037f4c12fce1ee58e670f9c3fce46c40296ba9ee8a2Ian Hodson *cygwin*) 9038f4c12fce1ee58e670f9c3fce46c40296ba9ee8a2Ian Hodson exeext=.exe 9039f4c12fce1ee58e670f9c3fce46c40296ba9ee8a2Ian Hodson func_stripname '' '.exe' "$outputname" 9040f4c12fce1ee58e670f9c3fce46c40296ba9ee8a2Ian Hodson outputname=$func_stripname_result ;; 9041f4c12fce1ee58e670f9c3fce46c40296ba9ee8a2Ian Hodson *) exeext= ;; 9042f4c12fce1ee58e670f9c3fce46c40296ba9ee8a2Ian Hodson esac 9043f4c12fce1ee58e670f9c3fce46c40296ba9ee8a2Ian Hodson case $host in 9044f4c12fce1ee58e670f9c3fce46c40296ba9ee8a2Ian Hodson *cygwin* | *mingw* ) 9045f4c12fce1ee58e670f9c3fce46c40296ba9ee8a2Ian Hodson func_dirname_and_basename "$output" "" "." 9046f4c12fce1ee58e670f9c3fce46c40296ba9ee8a2Ian Hodson output_name=$func_basename_result 9047f4c12fce1ee58e670f9c3fce46c40296ba9ee8a2Ian Hodson output_path=$func_dirname_result 9048f4c12fce1ee58e670f9c3fce46c40296ba9ee8a2Ian Hodson cwrappersource="$output_path/$objdir/lt-$output_name.c" 9049f4c12fce1ee58e670f9c3fce46c40296ba9ee8a2Ian Hodson cwrapper="$output_path/$output_name.exe" 9050f4c12fce1ee58e670f9c3fce46c40296ba9ee8a2Ian Hodson $RM $cwrappersource $cwrapper 9051f4c12fce1ee58e670f9c3fce46c40296ba9ee8a2Ian Hodson trap "$RM $cwrappersource $cwrapper; exit $EXIT_FAILURE" 1 2 15 9052f4c12fce1ee58e670f9c3fce46c40296ba9ee8a2Ian Hodson 9053f4c12fce1ee58e670f9c3fce46c40296ba9ee8a2Ian Hodson func_emit_cwrapperexe_src > $cwrappersource 9054f4c12fce1ee58e670f9c3fce46c40296ba9ee8a2Ian Hodson 9055f4c12fce1ee58e670f9c3fce46c40296ba9ee8a2Ian Hodson # The wrapper executable is built using the $host compiler, 9056f4c12fce1ee58e670f9c3fce46c40296ba9ee8a2Ian Hodson # because it contains $host paths and files. If cross- 9057f4c12fce1ee58e670f9c3fce46c40296ba9ee8a2Ian Hodson # compiling, it, like the target executable, must be 9058f4c12fce1ee58e670f9c3fce46c40296ba9ee8a2Ian Hodson # executed on the $host or under an emulation environment. 9059f4c12fce1ee58e670f9c3fce46c40296ba9ee8a2Ian Hodson $opt_dry_run || { 9060f4c12fce1ee58e670f9c3fce46c40296ba9ee8a2Ian Hodson $LTCC $LTCFLAGS -o $cwrapper $cwrappersource 9061f4c12fce1ee58e670f9c3fce46c40296ba9ee8a2Ian Hodson $STRIP $cwrapper 9062f4c12fce1ee58e670f9c3fce46c40296ba9ee8a2Ian Hodson } 9063f4c12fce1ee58e670f9c3fce46c40296ba9ee8a2Ian Hodson 9064f4c12fce1ee58e670f9c3fce46c40296ba9ee8a2Ian Hodson # Now, create the wrapper script for func_source use: 9065f4c12fce1ee58e670f9c3fce46c40296ba9ee8a2Ian Hodson func_ltwrapper_scriptname $cwrapper 9066f4c12fce1ee58e670f9c3fce46c40296ba9ee8a2Ian Hodson $RM $func_ltwrapper_scriptname_result 9067f4c12fce1ee58e670f9c3fce46c40296ba9ee8a2Ian Hodson trap "$RM $func_ltwrapper_scriptname_result; exit $EXIT_FAILURE" 1 2 15 9068f4c12fce1ee58e670f9c3fce46c40296ba9ee8a2Ian Hodson $opt_dry_run || { 9069f4c12fce1ee58e670f9c3fce46c40296ba9ee8a2Ian Hodson # note: this script will not be executed, so do not chmod. 9070f4c12fce1ee58e670f9c3fce46c40296ba9ee8a2Ian Hodson if test "x$build" = "x$host" ; then 9071f4c12fce1ee58e670f9c3fce46c40296ba9ee8a2Ian Hodson $cwrapper --lt-dump-script > $func_ltwrapper_scriptname_result 9072f4c12fce1ee58e670f9c3fce46c40296ba9ee8a2Ian Hodson else 9073f4c12fce1ee58e670f9c3fce46c40296ba9ee8a2Ian Hodson func_emit_wrapper no > $func_ltwrapper_scriptname_result 9074f4c12fce1ee58e670f9c3fce46c40296ba9ee8a2Ian Hodson fi 9075f4c12fce1ee58e670f9c3fce46c40296ba9ee8a2Ian Hodson } 9076f4c12fce1ee58e670f9c3fce46c40296ba9ee8a2Ian Hodson ;; 9077f4c12fce1ee58e670f9c3fce46c40296ba9ee8a2Ian Hodson * ) 9078f4c12fce1ee58e670f9c3fce46c40296ba9ee8a2Ian Hodson $RM $output 9079f4c12fce1ee58e670f9c3fce46c40296ba9ee8a2Ian Hodson trap "$RM $output; exit $EXIT_FAILURE" 1 2 15 9080f4c12fce1ee58e670f9c3fce46c40296ba9ee8a2Ian Hodson 9081f4c12fce1ee58e670f9c3fce46c40296ba9ee8a2Ian Hodson func_emit_wrapper no > $output 9082f4c12fce1ee58e670f9c3fce46c40296ba9ee8a2Ian Hodson chmod +x $output 9083f4c12fce1ee58e670f9c3fce46c40296ba9ee8a2Ian Hodson ;; 9084f4c12fce1ee58e670f9c3fce46c40296ba9ee8a2Ian Hodson esac 9085f4c12fce1ee58e670f9c3fce46c40296ba9ee8a2Ian Hodson } 9086f4c12fce1ee58e670f9c3fce46c40296ba9ee8a2Ian Hodson exit $EXIT_SUCCESS 9087f4c12fce1ee58e670f9c3fce46c40296ba9ee8a2Ian Hodson ;; 9088f4c12fce1ee58e670f9c3fce46c40296ba9ee8a2Ian Hodson esac 9089f4c12fce1ee58e670f9c3fce46c40296ba9ee8a2Ian Hodson 9090f4c12fce1ee58e670f9c3fce46c40296ba9ee8a2Ian Hodson # See if we need to build an old-fashioned archive. 9091f4c12fce1ee58e670f9c3fce46c40296ba9ee8a2Ian Hodson for oldlib in $oldlibs; do 9092f4c12fce1ee58e670f9c3fce46c40296ba9ee8a2Ian Hodson 9093f4c12fce1ee58e670f9c3fce46c40296ba9ee8a2Ian Hodson if test "$build_libtool_libs" = convenience; then 9094f4c12fce1ee58e670f9c3fce46c40296ba9ee8a2Ian Hodson oldobjs="$libobjs_save $symfileobj" 9095f4c12fce1ee58e670f9c3fce46c40296ba9ee8a2Ian Hodson addlibs="$convenience" 9096f4c12fce1ee58e670f9c3fce46c40296ba9ee8a2Ian Hodson build_libtool_libs=no 9097f4c12fce1ee58e670f9c3fce46c40296ba9ee8a2Ian Hodson else 9098f4c12fce1ee58e670f9c3fce46c40296ba9ee8a2Ian Hodson if test "$build_libtool_libs" = module; then 9099f4c12fce1ee58e670f9c3fce46c40296ba9ee8a2Ian Hodson oldobjs="$libobjs_save" 9100f4c12fce1ee58e670f9c3fce46c40296ba9ee8a2Ian Hodson build_libtool_libs=no 9101f4c12fce1ee58e670f9c3fce46c40296ba9ee8a2Ian Hodson else 9102f4c12fce1ee58e670f9c3fce46c40296ba9ee8a2Ian Hodson oldobjs="$old_deplibs $non_pic_objects" 9103f4c12fce1ee58e670f9c3fce46c40296ba9ee8a2Ian Hodson if test "$preload" = yes && test -f "$symfileobj"; then 91045b6dc79427b8f7eeb6a7ff68034ab8548ce670eaAlexander Gutkin func_append oldobjs " $symfileobj" 9105f4c12fce1ee58e670f9c3fce46c40296ba9ee8a2Ian Hodson fi 9106f4c12fce1ee58e670f9c3fce46c40296ba9ee8a2Ian Hodson fi 9107f4c12fce1ee58e670f9c3fce46c40296ba9ee8a2Ian Hodson addlibs="$old_convenience" 9108f4c12fce1ee58e670f9c3fce46c40296ba9ee8a2Ian Hodson fi 9109f4c12fce1ee58e670f9c3fce46c40296ba9ee8a2Ian Hodson 9110f4c12fce1ee58e670f9c3fce46c40296ba9ee8a2Ian Hodson if test -n "$addlibs"; then 9111f4c12fce1ee58e670f9c3fce46c40296ba9ee8a2Ian Hodson gentop="$output_objdir/${outputname}x" 91125b6dc79427b8f7eeb6a7ff68034ab8548ce670eaAlexander Gutkin func_append generated " $gentop" 9113f4c12fce1ee58e670f9c3fce46c40296ba9ee8a2Ian Hodson 9114f4c12fce1ee58e670f9c3fce46c40296ba9ee8a2Ian Hodson func_extract_archives $gentop $addlibs 91155b6dc79427b8f7eeb6a7ff68034ab8548ce670eaAlexander Gutkin func_append oldobjs " $func_extract_archives_result" 9116f4c12fce1ee58e670f9c3fce46c40296ba9ee8a2Ian Hodson fi 9117f4c12fce1ee58e670f9c3fce46c40296ba9ee8a2Ian Hodson 9118f4c12fce1ee58e670f9c3fce46c40296ba9ee8a2Ian Hodson # Do each command in the archive commands. 9119f4c12fce1ee58e670f9c3fce46c40296ba9ee8a2Ian Hodson if test -n "$old_archive_from_new_cmds" && test "$build_libtool_libs" = yes; then 9120f4c12fce1ee58e670f9c3fce46c40296ba9ee8a2Ian Hodson cmds=$old_archive_from_new_cmds 9121f4c12fce1ee58e670f9c3fce46c40296ba9ee8a2Ian Hodson else 9122f4c12fce1ee58e670f9c3fce46c40296ba9ee8a2Ian Hodson 9123f4c12fce1ee58e670f9c3fce46c40296ba9ee8a2Ian Hodson # Add any objects from preloaded convenience libraries 9124f4c12fce1ee58e670f9c3fce46c40296ba9ee8a2Ian Hodson if test -n "$dlprefiles"; then 9125f4c12fce1ee58e670f9c3fce46c40296ba9ee8a2Ian Hodson gentop="$output_objdir/${outputname}x" 91265b6dc79427b8f7eeb6a7ff68034ab8548ce670eaAlexander Gutkin func_append generated " $gentop" 9127f4c12fce1ee58e670f9c3fce46c40296ba9ee8a2Ian Hodson 9128f4c12fce1ee58e670f9c3fce46c40296ba9ee8a2Ian Hodson func_extract_archives $gentop $dlprefiles 91295b6dc79427b8f7eeb6a7ff68034ab8548ce670eaAlexander Gutkin func_append oldobjs " $func_extract_archives_result" 9130f4c12fce1ee58e670f9c3fce46c40296ba9ee8a2Ian Hodson fi 9131f4c12fce1ee58e670f9c3fce46c40296ba9ee8a2Ian Hodson 9132f4c12fce1ee58e670f9c3fce46c40296ba9ee8a2Ian Hodson # POSIX demands no paths to be encoded in archives. We have 9133f4c12fce1ee58e670f9c3fce46c40296ba9ee8a2Ian Hodson # to avoid creating archives with duplicate basenames if we 9134f4c12fce1ee58e670f9c3fce46c40296ba9ee8a2Ian Hodson # might have to extract them afterwards, e.g., when creating a 9135f4c12fce1ee58e670f9c3fce46c40296ba9ee8a2Ian Hodson # static archive out of a convenience library, or when linking 9136f4c12fce1ee58e670f9c3fce46c40296ba9ee8a2Ian Hodson # the entirety of a libtool archive into another (currently 9137f4c12fce1ee58e670f9c3fce46c40296ba9ee8a2Ian Hodson # not supported by libtool). 9138f4c12fce1ee58e670f9c3fce46c40296ba9ee8a2Ian Hodson if (for obj in $oldobjs 9139f4c12fce1ee58e670f9c3fce46c40296ba9ee8a2Ian Hodson do 9140f4c12fce1ee58e670f9c3fce46c40296ba9ee8a2Ian Hodson func_basename "$obj" 9141f4c12fce1ee58e670f9c3fce46c40296ba9ee8a2Ian Hodson $ECHO "$func_basename_result" 9142f4c12fce1ee58e670f9c3fce46c40296ba9ee8a2Ian Hodson done | sort | sort -uc >/dev/null 2>&1); then 9143f4c12fce1ee58e670f9c3fce46c40296ba9ee8a2Ian Hodson : 9144f4c12fce1ee58e670f9c3fce46c40296ba9ee8a2Ian Hodson else 91455b6dc79427b8f7eeb6a7ff68034ab8548ce670eaAlexander Gutkin echo "copying selected object files to avoid basename conflicts..." 9146f4c12fce1ee58e670f9c3fce46c40296ba9ee8a2Ian Hodson gentop="$output_objdir/${outputname}x" 91475b6dc79427b8f7eeb6a7ff68034ab8548ce670eaAlexander Gutkin func_append generated " $gentop" 9148f4c12fce1ee58e670f9c3fce46c40296ba9ee8a2Ian Hodson func_mkdir_p "$gentop" 9149f4c12fce1ee58e670f9c3fce46c40296ba9ee8a2Ian Hodson save_oldobjs=$oldobjs 9150f4c12fce1ee58e670f9c3fce46c40296ba9ee8a2Ian Hodson oldobjs= 9151f4c12fce1ee58e670f9c3fce46c40296ba9ee8a2Ian Hodson counter=1 9152f4c12fce1ee58e670f9c3fce46c40296ba9ee8a2Ian Hodson for obj in $save_oldobjs 9153f4c12fce1ee58e670f9c3fce46c40296ba9ee8a2Ian Hodson do 9154f4c12fce1ee58e670f9c3fce46c40296ba9ee8a2Ian Hodson func_basename "$obj" 9155f4c12fce1ee58e670f9c3fce46c40296ba9ee8a2Ian Hodson objbase="$func_basename_result" 9156f4c12fce1ee58e670f9c3fce46c40296ba9ee8a2Ian Hodson case " $oldobjs " in 9157f4c12fce1ee58e670f9c3fce46c40296ba9ee8a2Ian Hodson " ") oldobjs=$obj ;; 9158f4c12fce1ee58e670f9c3fce46c40296ba9ee8a2Ian Hodson *[\ /]"$objbase "*) 9159f4c12fce1ee58e670f9c3fce46c40296ba9ee8a2Ian Hodson while :; do 9160f4c12fce1ee58e670f9c3fce46c40296ba9ee8a2Ian Hodson # Make sure we don't pick an alternate name that also 9161f4c12fce1ee58e670f9c3fce46c40296ba9ee8a2Ian Hodson # overlaps. 9162f4c12fce1ee58e670f9c3fce46c40296ba9ee8a2Ian Hodson newobj=lt$counter-$objbase 9163f4c12fce1ee58e670f9c3fce46c40296ba9ee8a2Ian Hodson func_arith $counter + 1 9164f4c12fce1ee58e670f9c3fce46c40296ba9ee8a2Ian Hodson counter=$func_arith_result 9165f4c12fce1ee58e670f9c3fce46c40296ba9ee8a2Ian Hodson case " $oldobjs " in 9166f4c12fce1ee58e670f9c3fce46c40296ba9ee8a2Ian Hodson *[\ /]"$newobj "*) ;; 9167f4c12fce1ee58e670f9c3fce46c40296ba9ee8a2Ian Hodson *) if test ! -f "$gentop/$newobj"; then break; fi ;; 9168f4c12fce1ee58e670f9c3fce46c40296ba9ee8a2Ian Hodson esac 9169f4c12fce1ee58e670f9c3fce46c40296ba9ee8a2Ian Hodson done 9170f4c12fce1ee58e670f9c3fce46c40296ba9ee8a2Ian Hodson func_show_eval "ln $obj $gentop/$newobj || cp $obj $gentop/$newobj" 91715b6dc79427b8f7eeb6a7ff68034ab8548ce670eaAlexander Gutkin func_append oldobjs " $gentop/$newobj" 9172f4c12fce1ee58e670f9c3fce46c40296ba9ee8a2Ian Hodson ;; 91735b6dc79427b8f7eeb6a7ff68034ab8548ce670eaAlexander Gutkin *) func_append oldobjs " $obj" ;; 9174f4c12fce1ee58e670f9c3fce46c40296ba9ee8a2Ian Hodson esac 9175f4c12fce1ee58e670f9c3fce46c40296ba9ee8a2Ian Hodson done 9176f4c12fce1ee58e670f9c3fce46c40296ba9ee8a2Ian Hodson fi 91775b6dc79427b8f7eeb6a7ff68034ab8548ce670eaAlexander Gutkin func_to_tool_file "$oldlib" func_convert_file_msys_to_w32 91785b6dc79427b8f7eeb6a7ff68034ab8548ce670eaAlexander Gutkin tool_oldlib=$func_to_tool_file_result 9179f4c12fce1ee58e670f9c3fce46c40296ba9ee8a2Ian Hodson eval cmds=\"$old_archive_cmds\" 9180f4c12fce1ee58e670f9c3fce46c40296ba9ee8a2Ian Hodson 9181f4c12fce1ee58e670f9c3fce46c40296ba9ee8a2Ian Hodson func_len " $cmds" 9182f4c12fce1ee58e670f9c3fce46c40296ba9ee8a2Ian Hodson len=$func_len_result 9183f4c12fce1ee58e670f9c3fce46c40296ba9ee8a2Ian Hodson if test "$len" -lt "$max_cmd_len" || test "$max_cmd_len" -le -1; then 9184f4c12fce1ee58e670f9c3fce46c40296ba9ee8a2Ian Hodson cmds=$old_archive_cmds 91855b6dc79427b8f7eeb6a7ff68034ab8548ce670eaAlexander Gutkin elif test -n "$archiver_list_spec"; then 91865b6dc79427b8f7eeb6a7ff68034ab8548ce670eaAlexander Gutkin func_verbose "using command file archive linking..." 91875b6dc79427b8f7eeb6a7ff68034ab8548ce670eaAlexander Gutkin for obj in $oldobjs 91885b6dc79427b8f7eeb6a7ff68034ab8548ce670eaAlexander Gutkin do 91895b6dc79427b8f7eeb6a7ff68034ab8548ce670eaAlexander Gutkin func_to_tool_file "$obj" 91905b6dc79427b8f7eeb6a7ff68034ab8548ce670eaAlexander Gutkin $ECHO "$func_to_tool_file_result" 91915b6dc79427b8f7eeb6a7ff68034ab8548ce670eaAlexander Gutkin done > $output_objdir/$libname.libcmd 91925b6dc79427b8f7eeb6a7ff68034ab8548ce670eaAlexander Gutkin func_to_tool_file "$output_objdir/$libname.libcmd" 91935b6dc79427b8f7eeb6a7ff68034ab8548ce670eaAlexander Gutkin oldobjs=" $archiver_list_spec$func_to_tool_file_result" 91945b6dc79427b8f7eeb6a7ff68034ab8548ce670eaAlexander Gutkin cmds=$old_archive_cmds 9195f4c12fce1ee58e670f9c3fce46c40296ba9ee8a2Ian Hodson else 9196f4c12fce1ee58e670f9c3fce46c40296ba9ee8a2Ian Hodson # the command line is too long to link in one step, link in parts 9197f4c12fce1ee58e670f9c3fce46c40296ba9ee8a2Ian Hodson func_verbose "using piecewise archive linking..." 9198f4c12fce1ee58e670f9c3fce46c40296ba9ee8a2Ian Hodson save_RANLIB=$RANLIB 9199f4c12fce1ee58e670f9c3fce46c40296ba9ee8a2Ian Hodson RANLIB=: 9200f4c12fce1ee58e670f9c3fce46c40296ba9ee8a2Ian Hodson objlist= 9201f4c12fce1ee58e670f9c3fce46c40296ba9ee8a2Ian Hodson concat_cmds= 9202f4c12fce1ee58e670f9c3fce46c40296ba9ee8a2Ian Hodson save_oldobjs=$oldobjs 9203f4c12fce1ee58e670f9c3fce46c40296ba9ee8a2Ian Hodson oldobjs= 9204f4c12fce1ee58e670f9c3fce46c40296ba9ee8a2Ian Hodson # Is there a better way of finding the last object in the list? 9205f4c12fce1ee58e670f9c3fce46c40296ba9ee8a2Ian Hodson for obj in $save_oldobjs 9206f4c12fce1ee58e670f9c3fce46c40296ba9ee8a2Ian Hodson do 9207f4c12fce1ee58e670f9c3fce46c40296ba9ee8a2Ian Hodson last_oldobj=$obj 9208f4c12fce1ee58e670f9c3fce46c40296ba9ee8a2Ian Hodson done 9209f4c12fce1ee58e670f9c3fce46c40296ba9ee8a2Ian Hodson eval test_cmds=\"$old_archive_cmds\" 9210f4c12fce1ee58e670f9c3fce46c40296ba9ee8a2Ian Hodson func_len " $test_cmds" 9211f4c12fce1ee58e670f9c3fce46c40296ba9ee8a2Ian Hodson len0=$func_len_result 9212f4c12fce1ee58e670f9c3fce46c40296ba9ee8a2Ian Hodson len=$len0 9213f4c12fce1ee58e670f9c3fce46c40296ba9ee8a2Ian Hodson for obj in $save_oldobjs 9214f4c12fce1ee58e670f9c3fce46c40296ba9ee8a2Ian Hodson do 9215f4c12fce1ee58e670f9c3fce46c40296ba9ee8a2Ian Hodson func_len " $obj" 9216f4c12fce1ee58e670f9c3fce46c40296ba9ee8a2Ian Hodson func_arith $len + $func_len_result 9217f4c12fce1ee58e670f9c3fce46c40296ba9ee8a2Ian Hodson len=$func_arith_result 9218f4c12fce1ee58e670f9c3fce46c40296ba9ee8a2Ian Hodson func_append objlist " $obj" 9219f4c12fce1ee58e670f9c3fce46c40296ba9ee8a2Ian Hodson if test "$len" -lt "$max_cmd_len"; then 9220f4c12fce1ee58e670f9c3fce46c40296ba9ee8a2Ian Hodson : 9221f4c12fce1ee58e670f9c3fce46c40296ba9ee8a2Ian Hodson else 9222f4c12fce1ee58e670f9c3fce46c40296ba9ee8a2Ian Hodson # the above command should be used before it gets too long 9223f4c12fce1ee58e670f9c3fce46c40296ba9ee8a2Ian Hodson oldobjs=$objlist 9224f4c12fce1ee58e670f9c3fce46c40296ba9ee8a2Ian Hodson if test "$obj" = "$last_oldobj" ; then 9225f4c12fce1ee58e670f9c3fce46c40296ba9ee8a2Ian Hodson RANLIB=$save_RANLIB 9226f4c12fce1ee58e670f9c3fce46c40296ba9ee8a2Ian Hodson fi 9227f4c12fce1ee58e670f9c3fce46c40296ba9ee8a2Ian Hodson test -z "$concat_cmds" || concat_cmds=$concat_cmds~ 9228f4c12fce1ee58e670f9c3fce46c40296ba9ee8a2Ian Hodson eval concat_cmds=\"\${concat_cmds}$old_archive_cmds\" 9229f4c12fce1ee58e670f9c3fce46c40296ba9ee8a2Ian Hodson objlist= 9230f4c12fce1ee58e670f9c3fce46c40296ba9ee8a2Ian Hodson len=$len0 9231f4c12fce1ee58e670f9c3fce46c40296ba9ee8a2Ian Hodson fi 9232f4c12fce1ee58e670f9c3fce46c40296ba9ee8a2Ian Hodson done 9233f4c12fce1ee58e670f9c3fce46c40296ba9ee8a2Ian Hodson RANLIB=$save_RANLIB 9234f4c12fce1ee58e670f9c3fce46c40296ba9ee8a2Ian Hodson oldobjs=$objlist 9235f4c12fce1ee58e670f9c3fce46c40296ba9ee8a2Ian Hodson if test "X$oldobjs" = "X" ; then 9236f4c12fce1ee58e670f9c3fce46c40296ba9ee8a2Ian Hodson eval cmds=\"\$concat_cmds\" 9237f4c12fce1ee58e670f9c3fce46c40296ba9ee8a2Ian Hodson else 9238f4c12fce1ee58e670f9c3fce46c40296ba9ee8a2Ian Hodson eval cmds=\"\$concat_cmds~\$old_archive_cmds\" 9239f4c12fce1ee58e670f9c3fce46c40296ba9ee8a2Ian Hodson fi 9240f4c12fce1ee58e670f9c3fce46c40296ba9ee8a2Ian Hodson fi 9241f4c12fce1ee58e670f9c3fce46c40296ba9ee8a2Ian Hodson fi 9242f4c12fce1ee58e670f9c3fce46c40296ba9ee8a2Ian Hodson func_execute_cmds "$cmds" 'exit $?' 9243f4c12fce1ee58e670f9c3fce46c40296ba9ee8a2Ian Hodson done 9244f4c12fce1ee58e670f9c3fce46c40296ba9ee8a2Ian Hodson 9245f4c12fce1ee58e670f9c3fce46c40296ba9ee8a2Ian Hodson test -n "$generated" && \ 9246f4c12fce1ee58e670f9c3fce46c40296ba9ee8a2Ian Hodson func_show_eval "${RM}r$generated" 9247f4c12fce1ee58e670f9c3fce46c40296ba9ee8a2Ian Hodson 9248f4c12fce1ee58e670f9c3fce46c40296ba9ee8a2Ian Hodson # Now create the libtool archive. 9249f4c12fce1ee58e670f9c3fce46c40296ba9ee8a2Ian Hodson case $output in 9250f4c12fce1ee58e670f9c3fce46c40296ba9ee8a2Ian Hodson *.la) 9251f4c12fce1ee58e670f9c3fce46c40296ba9ee8a2Ian Hodson old_library= 9252f4c12fce1ee58e670f9c3fce46c40296ba9ee8a2Ian Hodson test "$build_old_libs" = yes && old_library="$libname.$libext" 9253f4c12fce1ee58e670f9c3fce46c40296ba9ee8a2Ian Hodson func_verbose "creating $output" 9254f4c12fce1ee58e670f9c3fce46c40296ba9ee8a2Ian Hodson 9255f4c12fce1ee58e670f9c3fce46c40296ba9ee8a2Ian Hodson # Preserve any variables that may affect compiler behavior 9256f4c12fce1ee58e670f9c3fce46c40296ba9ee8a2Ian Hodson for var in $variables_saved_for_relink; do 9257f4c12fce1ee58e670f9c3fce46c40296ba9ee8a2Ian Hodson if eval test -z \"\${$var+set}\"; then 9258f4c12fce1ee58e670f9c3fce46c40296ba9ee8a2Ian Hodson relink_command="{ test -z \"\${$var+set}\" || $lt_unset $var || { $var=; export $var; }; }; $relink_command" 9259f4c12fce1ee58e670f9c3fce46c40296ba9ee8a2Ian Hodson elif eval var_value=\$$var; test -z "$var_value"; then 9260f4c12fce1ee58e670f9c3fce46c40296ba9ee8a2Ian Hodson relink_command="$var=; export $var; $relink_command" 9261f4c12fce1ee58e670f9c3fce46c40296ba9ee8a2Ian Hodson else 9262f4c12fce1ee58e670f9c3fce46c40296ba9ee8a2Ian Hodson func_quote_for_eval "$var_value" 9263f4c12fce1ee58e670f9c3fce46c40296ba9ee8a2Ian Hodson relink_command="$var=$func_quote_for_eval_result; export $var; $relink_command" 9264f4c12fce1ee58e670f9c3fce46c40296ba9ee8a2Ian Hodson fi 9265f4c12fce1ee58e670f9c3fce46c40296ba9ee8a2Ian Hodson done 9266f4c12fce1ee58e670f9c3fce46c40296ba9ee8a2Ian Hodson # Quote the link command for shipping. 9267f4c12fce1ee58e670f9c3fce46c40296ba9ee8a2Ian Hodson relink_command="(cd `pwd`; $SHELL $progpath $preserve_args --mode=relink $libtool_args @inst_prefix_dir@)" 92685b6dc79427b8f7eeb6a7ff68034ab8548ce670eaAlexander Gutkin relink_command=`$ECHO "$relink_command" | $SED "$sed_quote_subst"` 9269f4c12fce1ee58e670f9c3fce46c40296ba9ee8a2Ian Hodson if test "$hardcode_automatic" = yes ; then 9270f4c12fce1ee58e670f9c3fce46c40296ba9ee8a2Ian Hodson relink_command= 9271f4c12fce1ee58e670f9c3fce46c40296ba9ee8a2Ian Hodson fi 9272f4c12fce1ee58e670f9c3fce46c40296ba9ee8a2Ian Hodson 9273f4c12fce1ee58e670f9c3fce46c40296ba9ee8a2Ian Hodson # Only create the output if not a dry run. 9274f4c12fce1ee58e670f9c3fce46c40296ba9ee8a2Ian Hodson $opt_dry_run || { 9275f4c12fce1ee58e670f9c3fce46c40296ba9ee8a2Ian Hodson for installed in no yes; do 9276f4c12fce1ee58e670f9c3fce46c40296ba9ee8a2Ian Hodson if test "$installed" = yes; then 9277f4c12fce1ee58e670f9c3fce46c40296ba9ee8a2Ian Hodson if test -z "$install_libdir"; then 9278f4c12fce1ee58e670f9c3fce46c40296ba9ee8a2Ian Hodson break 9279f4c12fce1ee58e670f9c3fce46c40296ba9ee8a2Ian Hodson fi 9280f4c12fce1ee58e670f9c3fce46c40296ba9ee8a2Ian Hodson output="$output_objdir/$outputname"i 9281f4c12fce1ee58e670f9c3fce46c40296ba9ee8a2Ian Hodson # Replace all uninstalled libtool libraries with the installed ones 9282f4c12fce1ee58e670f9c3fce46c40296ba9ee8a2Ian Hodson newdependency_libs= 9283f4c12fce1ee58e670f9c3fce46c40296ba9ee8a2Ian Hodson for deplib in $dependency_libs; do 9284f4c12fce1ee58e670f9c3fce46c40296ba9ee8a2Ian Hodson case $deplib in 9285f4c12fce1ee58e670f9c3fce46c40296ba9ee8a2Ian Hodson *.la) 9286f4c12fce1ee58e670f9c3fce46c40296ba9ee8a2Ian Hodson func_basename "$deplib" 9287f4c12fce1ee58e670f9c3fce46c40296ba9ee8a2Ian Hodson name="$func_basename_result" 92885b6dc79427b8f7eeb6a7ff68034ab8548ce670eaAlexander Gutkin func_resolve_sysroot "$deplib" 92895b6dc79427b8f7eeb6a7ff68034ab8548ce670eaAlexander Gutkin eval libdir=`${SED} -n -e 's/^libdir=\(.*\)$/\1/p' $func_resolve_sysroot_result` 9290f4c12fce1ee58e670f9c3fce46c40296ba9ee8a2Ian Hodson test -z "$libdir" && \ 9291f4c12fce1ee58e670f9c3fce46c40296ba9ee8a2Ian Hodson func_fatal_error "\`$deplib' is not a valid libtool archive" 92925b6dc79427b8f7eeb6a7ff68034ab8548ce670eaAlexander Gutkin func_append newdependency_libs " ${lt_sysroot:+=}$libdir/$name" 92935b6dc79427b8f7eeb6a7ff68034ab8548ce670eaAlexander Gutkin ;; 92945b6dc79427b8f7eeb6a7ff68034ab8548ce670eaAlexander Gutkin -L*) 92955b6dc79427b8f7eeb6a7ff68034ab8548ce670eaAlexander Gutkin func_stripname -L '' "$deplib" 92965b6dc79427b8f7eeb6a7ff68034ab8548ce670eaAlexander Gutkin func_replace_sysroot "$func_stripname_result" 92975b6dc79427b8f7eeb6a7ff68034ab8548ce670eaAlexander Gutkin func_append newdependency_libs " -L$func_replace_sysroot_result" 9298f4c12fce1ee58e670f9c3fce46c40296ba9ee8a2Ian Hodson ;; 92995b6dc79427b8f7eeb6a7ff68034ab8548ce670eaAlexander Gutkin -R*) 93005b6dc79427b8f7eeb6a7ff68034ab8548ce670eaAlexander Gutkin func_stripname -R '' "$deplib" 93015b6dc79427b8f7eeb6a7ff68034ab8548ce670eaAlexander Gutkin func_replace_sysroot "$func_stripname_result" 93025b6dc79427b8f7eeb6a7ff68034ab8548ce670eaAlexander Gutkin func_append newdependency_libs " -R$func_replace_sysroot_result" 93035b6dc79427b8f7eeb6a7ff68034ab8548ce670eaAlexander Gutkin ;; 93045b6dc79427b8f7eeb6a7ff68034ab8548ce670eaAlexander Gutkin *) func_append newdependency_libs " $deplib" ;; 9305f4c12fce1ee58e670f9c3fce46c40296ba9ee8a2Ian Hodson esac 9306f4c12fce1ee58e670f9c3fce46c40296ba9ee8a2Ian Hodson done 9307f4c12fce1ee58e670f9c3fce46c40296ba9ee8a2Ian Hodson dependency_libs="$newdependency_libs" 9308f4c12fce1ee58e670f9c3fce46c40296ba9ee8a2Ian Hodson newdlfiles= 9309f4c12fce1ee58e670f9c3fce46c40296ba9ee8a2Ian Hodson 9310f4c12fce1ee58e670f9c3fce46c40296ba9ee8a2Ian Hodson for lib in $dlfiles; do 9311f4c12fce1ee58e670f9c3fce46c40296ba9ee8a2Ian Hodson case $lib in 9312f4c12fce1ee58e670f9c3fce46c40296ba9ee8a2Ian Hodson *.la) 9313f4c12fce1ee58e670f9c3fce46c40296ba9ee8a2Ian Hodson func_basename "$lib" 9314f4c12fce1ee58e670f9c3fce46c40296ba9ee8a2Ian Hodson name="$func_basename_result" 9315f4c12fce1ee58e670f9c3fce46c40296ba9ee8a2Ian Hodson eval libdir=`${SED} -n -e 's/^libdir=\(.*\)$/\1/p' $lib` 9316f4c12fce1ee58e670f9c3fce46c40296ba9ee8a2Ian Hodson test -z "$libdir" && \ 9317f4c12fce1ee58e670f9c3fce46c40296ba9ee8a2Ian Hodson func_fatal_error "\`$lib' is not a valid libtool archive" 93185b6dc79427b8f7eeb6a7ff68034ab8548ce670eaAlexander Gutkin func_append newdlfiles " ${lt_sysroot:+=}$libdir/$name" 9319f4c12fce1ee58e670f9c3fce46c40296ba9ee8a2Ian Hodson ;; 93205b6dc79427b8f7eeb6a7ff68034ab8548ce670eaAlexander Gutkin *) func_append newdlfiles " $lib" ;; 9321f4c12fce1ee58e670f9c3fce46c40296ba9ee8a2Ian Hodson esac 9322f4c12fce1ee58e670f9c3fce46c40296ba9ee8a2Ian Hodson done 9323f4c12fce1ee58e670f9c3fce46c40296ba9ee8a2Ian Hodson dlfiles="$newdlfiles" 9324f4c12fce1ee58e670f9c3fce46c40296ba9ee8a2Ian Hodson newdlprefiles= 9325f4c12fce1ee58e670f9c3fce46c40296ba9ee8a2Ian Hodson for lib in $dlprefiles; do 9326f4c12fce1ee58e670f9c3fce46c40296ba9ee8a2Ian Hodson case $lib in 9327f4c12fce1ee58e670f9c3fce46c40296ba9ee8a2Ian Hodson *.la) 9328f4c12fce1ee58e670f9c3fce46c40296ba9ee8a2Ian Hodson # Only pass preopened files to the pseudo-archive (for 9329f4c12fce1ee58e670f9c3fce46c40296ba9ee8a2Ian Hodson # eventual linking with the app. that links it) if we 9330f4c12fce1ee58e670f9c3fce46c40296ba9ee8a2Ian Hodson # didn't already link the preopened objects directly into 9331f4c12fce1ee58e670f9c3fce46c40296ba9ee8a2Ian Hodson # the library: 9332f4c12fce1ee58e670f9c3fce46c40296ba9ee8a2Ian Hodson func_basename "$lib" 9333f4c12fce1ee58e670f9c3fce46c40296ba9ee8a2Ian Hodson name="$func_basename_result" 9334f4c12fce1ee58e670f9c3fce46c40296ba9ee8a2Ian Hodson eval libdir=`${SED} -n -e 's/^libdir=\(.*\)$/\1/p' $lib` 9335f4c12fce1ee58e670f9c3fce46c40296ba9ee8a2Ian Hodson test -z "$libdir" && \ 9336f4c12fce1ee58e670f9c3fce46c40296ba9ee8a2Ian Hodson func_fatal_error "\`$lib' is not a valid libtool archive" 93375b6dc79427b8f7eeb6a7ff68034ab8548ce670eaAlexander Gutkin func_append newdlprefiles " ${lt_sysroot:+=}$libdir/$name" 9338f4c12fce1ee58e670f9c3fce46c40296ba9ee8a2Ian Hodson ;; 9339f4c12fce1ee58e670f9c3fce46c40296ba9ee8a2Ian Hodson esac 9340f4c12fce1ee58e670f9c3fce46c40296ba9ee8a2Ian Hodson done 9341f4c12fce1ee58e670f9c3fce46c40296ba9ee8a2Ian Hodson dlprefiles="$newdlprefiles" 9342f4c12fce1ee58e670f9c3fce46c40296ba9ee8a2Ian Hodson else 9343f4c12fce1ee58e670f9c3fce46c40296ba9ee8a2Ian Hodson newdlfiles= 9344f4c12fce1ee58e670f9c3fce46c40296ba9ee8a2Ian Hodson for lib in $dlfiles; do 9345f4c12fce1ee58e670f9c3fce46c40296ba9ee8a2Ian Hodson case $lib in 9346f4c12fce1ee58e670f9c3fce46c40296ba9ee8a2Ian Hodson [\\/]* | [A-Za-z]:[\\/]*) abs="$lib" ;; 9347f4c12fce1ee58e670f9c3fce46c40296ba9ee8a2Ian Hodson *) abs=`pwd`"/$lib" ;; 9348f4c12fce1ee58e670f9c3fce46c40296ba9ee8a2Ian Hodson esac 93495b6dc79427b8f7eeb6a7ff68034ab8548ce670eaAlexander Gutkin func_append newdlfiles " $abs" 9350f4c12fce1ee58e670f9c3fce46c40296ba9ee8a2Ian Hodson done 9351f4c12fce1ee58e670f9c3fce46c40296ba9ee8a2Ian Hodson dlfiles="$newdlfiles" 9352f4c12fce1ee58e670f9c3fce46c40296ba9ee8a2Ian Hodson newdlprefiles= 9353f4c12fce1ee58e670f9c3fce46c40296ba9ee8a2Ian Hodson for lib in $dlprefiles; do 9354f4c12fce1ee58e670f9c3fce46c40296ba9ee8a2Ian Hodson case $lib in 9355f4c12fce1ee58e670f9c3fce46c40296ba9ee8a2Ian Hodson [\\/]* | [A-Za-z]:[\\/]*) abs="$lib" ;; 9356f4c12fce1ee58e670f9c3fce46c40296ba9ee8a2Ian Hodson *) abs=`pwd`"/$lib" ;; 9357f4c12fce1ee58e670f9c3fce46c40296ba9ee8a2Ian Hodson esac 93585b6dc79427b8f7eeb6a7ff68034ab8548ce670eaAlexander Gutkin func_append newdlprefiles " $abs" 9359f4c12fce1ee58e670f9c3fce46c40296ba9ee8a2Ian Hodson done 9360f4c12fce1ee58e670f9c3fce46c40296ba9ee8a2Ian Hodson dlprefiles="$newdlprefiles" 9361f4c12fce1ee58e670f9c3fce46c40296ba9ee8a2Ian Hodson fi 9362f4c12fce1ee58e670f9c3fce46c40296ba9ee8a2Ian Hodson $RM $output 9363f4c12fce1ee58e670f9c3fce46c40296ba9ee8a2Ian Hodson # place dlname in correct position for cygwin 93645b6dc79427b8f7eeb6a7ff68034ab8548ce670eaAlexander Gutkin # In fact, it would be nice if we could use this code for all target 93655b6dc79427b8f7eeb6a7ff68034ab8548ce670eaAlexander Gutkin # systems that can't hard-code library paths into their executables 93665b6dc79427b8f7eeb6a7ff68034ab8548ce670eaAlexander Gutkin # and that have no shared library path variable independent of PATH, 93675b6dc79427b8f7eeb6a7ff68034ab8548ce670eaAlexander Gutkin # but it turns out we can't easily determine that from inspecting 93685b6dc79427b8f7eeb6a7ff68034ab8548ce670eaAlexander Gutkin # libtool variables, so we have to hard-code the OSs to which it 93695b6dc79427b8f7eeb6a7ff68034ab8548ce670eaAlexander Gutkin # applies here; at the moment, that means platforms that use the PE 93705b6dc79427b8f7eeb6a7ff68034ab8548ce670eaAlexander Gutkin # object format with DLL files. See the long comment at the top of 93715b6dc79427b8f7eeb6a7ff68034ab8548ce670eaAlexander Gutkin # tests/bindir.at for full details. 9372f4c12fce1ee58e670f9c3fce46c40296ba9ee8a2Ian Hodson tdlname=$dlname 9373f4c12fce1ee58e670f9c3fce46c40296ba9ee8a2Ian Hodson case $host,$output,$installed,$module,$dlname in 93745b6dc79427b8f7eeb6a7ff68034ab8548ce670eaAlexander Gutkin *cygwin*,*lai,yes,no,*.dll | *mingw*,*lai,yes,no,*.dll | *cegcc*,*lai,yes,no,*.dll) 93755b6dc79427b8f7eeb6a7ff68034ab8548ce670eaAlexander Gutkin # If a -bindir argument was supplied, place the dll there. 93765b6dc79427b8f7eeb6a7ff68034ab8548ce670eaAlexander Gutkin if test "x$bindir" != x ; 93775b6dc79427b8f7eeb6a7ff68034ab8548ce670eaAlexander Gutkin then 93785b6dc79427b8f7eeb6a7ff68034ab8548ce670eaAlexander Gutkin func_relative_path "$install_libdir" "$bindir" 93795b6dc79427b8f7eeb6a7ff68034ab8548ce670eaAlexander Gutkin tdlname=$func_relative_path_result$dlname 93805b6dc79427b8f7eeb6a7ff68034ab8548ce670eaAlexander Gutkin else 93815b6dc79427b8f7eeb6a7ff68034ab8548ce670eaAlexander Gutkin # Otherwise fall back on heuristic. 93825b6dc79427b8f7eeb6a7ff68034ab8548ce670eaAlexander Gutkin tdlname=../bin/$dlname 93835b6dc79427b8f7eeb6a7ff68034ab8548ce670eaAlexander Gutkin fi 93845b6dc79427b8f7eeb6a7ff68034ab8548ce670eaAlexander Gutkin ;; 9385f4c12fce1ee58e670f9c3fce46c40296ba9ee8a2Ian Hodson esac 9386f4c12fce1ee58e670f9c3fce46c40296ba9ee8a2Ian Hodson $ECHO > $output "\ 9387f4c12fce1ee58e670f9c3fce46c40296ba9ee8a2Ian Hodson# $outputname - a libtool library file 9388f4c12fce1ee58e670f9c3fce46c40296ba9ee8a2Ian Hodson# Generated by $PROGRAM (GNU $PACKAGE$TIMESTAMP) $VERSION 9389f4c12fce1ee58e670f9c3fce46c40296ba9ee8a2Ian Hodson# 9390f4c12fce1ee58e670f9c3fce46c40296ba9ee8a2Ian Hodson# Please DO NOT delete this file! 9391f4c12fce1ee58e670f9c3fce46c40296ba9ee8a2Ian Hodson# It is necessary for linking the library. 9392f4c12fce1ee58e670f9c3fce46c40296ba9ee8a2Ian Hodson 9393f4c12fce1ee58e670f9c3fce46c40296ba9ee8a2Ian Hodson# The name that we can dlopen(3). 9394f4c12fce1ee58e670f9c3fce46c40296ba9ee8a2Ian Hodsondlname='$tdlname' 9395f4c12fce1ee58e670f9c3fce46c40296ba9ee8a2Ian Hodson 9396f4c12fce1ee58e670f9c3fce46c40296ba9ee8a2Ian Hodson# Names of this library. 9397f4c12fce1ee58e670f9c3fce46c40296ba9ee8a2Ian Hodsonlibrary_names='$library_names' 9398f4c12fce1ee58e670f9c3fce46c40296ba9ee8a2Ian Hodson 9399f4c12fce1ee58e670f9c3fce46c40296ba9ee8a2Ian Hodson# The name of the static archive. 9400f4c12fce1ee58e670f9c3fce46c40296ba9ee8a2Ian Hodsonold_library='$old_library' 9401f4c12fce1ee58e670f9c3fce46c40296ba9ee8a2Ian Hodson 9402f4c12fce1ee58e670f9c3fce46c40296ba9ee8a2Ian Hodson# Linker flags that can not go in dependency_libs. 9403f4c12fce1ee58e670f9c3fce46c40296ba9ee8a2Ian Hodsoninherited_linker_flags='$new_inherited_linker_flags' 9404f4c12fce1ee58e670f9c3fce46c40296ba9ee8a2Ian Hodson 9405f4c12fce1ee58e670f9c3fce46c40296ba9ee8a2Ian Hodson# Libraries that this one depends upon. 9406f4c12fce1ee58e670f9c3fce46c40296ba9ee8a2Ian Hodsondependency_libs='$dependency_libs' 9407f4c12fce1ee58e670f9c3fce46c40296ba9ee8a2Ian Hodson 9408f4c12fce1ee58e670f9c3fce46c40296ba9ee8a2Ian Hodson# Names of additional weak libraries provided by this library 9409f4c12fce1ee58e670f9c3fce46c40296ba9ee8a2Ian Hodsonweak_library_names='$weak_libs' 9410f4c12fce1ee58e670f9c3fce46c40296ba9ee8a2Ian Hodson 9411f4c12fce1ee58e670f9c3fce46c40296ba9ee8a2Ian Hodson# Version information for $libname. 9412f4c12fce1ee58e670f9c3fce46c40296ba9ee8a2Ian Hodsoncurrent=$current 9413f4c12fce1ee58e670f9c3fce46c40296ba9ee8a2Ian Hodsonage=$age 9414f4c12fce1ee58e670f9c3fce46c40296ba9ee8a2Ian Hodsonrevision=$revision 9415f4c12fce1ee58e670f9c3fce46c40296ba9ee8a2Ian Hodson 9416f4c12fce1ee58e670f9c3fce46c40296ba9ee8a2Ian Hodson# Is this an already installed library? 9417f4c12fce1ee58e670f9c3fce46c40296ba9ee8a2Ian Hodsoninstalled=$installed 9418f4c12fce1ee58e670f9c3fce46c40296ba9ee8a2Ian Hodson 9419f4c12fce1ee58e670f9c3fce46c40296ba9ee8a2Ian Hodson# Should we warn about portability when linking against -modules? 9420f4c12fce1ee58e670f9c3fce46c40296ba9ee8a2Ian Hodsonshouldnotlink=$module 9421f4c12fce1ee58e670f9c3fce46c40296ba9ee8a2Ian Hodson 9422f4c12fce1ee58e670f9c3fce46c40296ba9ee8a2Ian Hodson# Files to dlopen/dlpreopen 9423f4c12fce1ee58e670f9c3fce46c40296ba9ee8a2Ian Hodsondlopen='$dlfiles' 9424f4c12fce1ee58e670f9c3fce46c40296ba9ee8a2Ian Hodsondlpreopen='$dlprefiles' 9425f4c12fce1ee58e670f9c3fce46c40296ba9ee8a2Ian Hodson 9426f4c12fce1ee58e670f9c3fce46c40296ba9ee8a2Ian Hodson# Directory that this library needs to be installed in: 9427f4c12fce1ee58e670f9c3fce46c40296ba9ee8a2Ian Hodsonlibdir='$install_libdir'" 9428f4c12fce1ee58e670f9c3fce46c40296ba9ee8a2Ian Hodson if test "$installed" = no && test "$need_relink" = yes; then 9429f4c12fce1ee58e670f9c3fce46c40296ba9ee8a2Ian Hodson $ECHO >> $output "\ 9430f4c12fce1ee58e670f9c3fce46c40296ba9ee8a2Ian Hodsonrelink_command=\"$relink_command\"" 9431f4c12fce1ee58e670f9c3fce46c40296ba9ee8a2Ian Hodson fi 9432f4c12fce1ee58e670f9c3fce46c40296ba9ee8a2Ian Hodson done 9433f4c12fce1ee58e670f9c3fce46c40296ba9ee8a2Ian Hodson } 9434f4c12fce1ee58e670f9c3fce46c40296ba9ee8a2Ian Hodson 9435f4c12fce1ee58e670f9c3fce46c40296ba9ee8a2Ian Hodson # Do a symbolic link so that the libtool archive can be found in 9436f4c12fce1ee58e670f9c3fce46c40296ba9ee8a2Ian Hodson # LD_LIBRARY_PATH before the program is installed. 9437f4c12fce1ee58e670f9c3fce46c40296ba9ee8a2Ian Hodson func_show_eval '( cd "$output_objdir" && $RM "$outputname" && $LN_S "../$outputname" "$outputname" )' 'exit $?' 9438f4c12fce1ee58e670f9c3fce46c40296ba9ee8a2Ian Hodson ;; 9439f4c12fce1ee58e670f9c3fce46c40296ba9ee8a2Ian Hodson esac 9440f4c12fce1ee58e670f9c3fce46c40296ba9ee8a2Ian Hodson exit $EXIT_SUCCESS 9441f4c12fce1ee58e670f9c3fce46c40296ba9ee8a2Ian Hodson} 9442f4c12fce1ee58e670f9c3fce46c40296ba9ee8a2Ian Hodson 94435b6dc79427b8f7eeb6a7ff68034ab8548ce670eaAlexander Gutkin{ test "$opt_mode" = link || test "$opt_mode" = relink; } && 9444f4c12fce1ee58e670f9c3fce46c40296ba9ee8a2Ian Hodson func_mode_link ${1+"$@"} 9445f4c12fce1ee58e670f9c3fce46c40296ba9ee8a2Ian Hodson 9446f4c12fce1ee58e670f9c3fce46c40296ba9ee8a2Ian Hodson 9447f4c12fce1ee58e670f9c3fce46c40296ba9ee8a2Ian Hodson# func_mode_uninstall arg... 9448f4c12fce1ee58e670f9c3fce46c40296ba9ee8a2Ian Hodsonfunc_mode_uninstall () 9449f4c12fce1ee58e670f9c3fce46c40296ba9ee8a2Ian Hodson{ 9450f4c12fce1ee58e670f9c3fce46c40296ba9ee8a2Ian Hodson $opt_debug 9451f4c12fce1ee58e670f9c3fce46c40296ba9ee8a2Ian Hodson RM="$nonopt" 9452f4c12fce1ee58e670f9c3fce46c40296ba9ee8a2Ian Hodson files= 9453f4c12fce1ee58e670f9c3fce46c40296ba9ee8a2Ian Hodson rmforce= 9454f4c12fce1ee58e670f9c3fce46c40296ba9ee8a2Ian Hodson exit_status=0 9455f4c12fce1ee58e670f9c3fce46c40296ba9ee8a2Ian Hodson 9456f4c12fce1ee58e670f9c3fce46c40296ba9ee8a2Ian Hodson # This variable tells wrapper scripts just to set variables rather 9457f4c12fce1ee58e670f9c3fce46c40296ba9ee8a2Ian Hodson # than running their programs. 9458f4c12fce1ee58e670f9c3fce46c40296ba9ee8a2Ian Hodson libtool_install_magic="$magic" 9459f4c12fce1ee58e670f9c3fce46c40296ba9ee8a2Ian Hodson 9460f4c12fce1ee58e670f9c3fce46c40296ba9ee8a2Ian Hodson for arg 9461f4c12fce1ee58e670f9c3fce46c40296ba9ee8a2Ian Hodson do 9462f4c12fce1ee58e670f9c3fce46c40296ba9ee8a2Ian Hodson case $arg in 94635b6dc79427b8f7eeb6a7ff68034ab8548ce670eaAlexander Gutkin -f) func_append RM " $arg"; rmforce=yes ;; 94645b6dc79427b8f7eeb6a7ff68034ab8548ce670eaAlexander Gutkin -*) func_append RM " $arg" ;; 94655b6dc79427b8f7eeb6a7ff68034ab8548ce670eaAlexander Gutkin *) func_append files " $arg" ;; 9466f4c12fce1ee58e670f9c3fce46c40296ba9ee8a2Ian Hodson esac 9467f4c12fce1ee58e670f9c3fce46c40296ba9ee8a2Ian Hodson done 9468f4c12fce1ee58e670f9c3fce46c40296ba9ee8a2Ian Hodson 9469f4c12fce1ee58e670f9c3fce46c40296ba9ee8a2Ian Hodson test -z "$RM" && \ 9470f4c12fce1ee58e670f9c3fce46c40296ba9ee8a2Ian Hodson func_fatal_help "you must specify an RM program" 9471f4c12fce1ee58e670f9c3fce46c40296ba9ee8a2Ian Hodson 9472f4c12fce1ee58e670f9c3fce46c40296ba9ee8a2Ian Hodson rmdirs= 9473f4c12fce1ee58e670f9c3fce46c40296ba9ee8a2Ian Hodson 9474f4c12fce1ee58e670f9c3fce46c40296ba9ee8a2Ian Hodson for file in $files; do 9475f4c12fce1ee58e670f9c3fce46c40296ba9ee8a2Ian Hodson func_dirname "$file" "" "." 9476f4c12fce1ee58e670f9c3fce46c40296ba9ee8a2Ian Hodson dir="$func_dirname_result" 9477f4c12fce1ee58e670f9c3fce46c40296ba9ee8a2Ian Hodson if test "X$dir" = X.; then 94785b6dc79427b8f7eeb6a7ff68034ab8548ce670eaAlexander Gutkin odir="$objdir" 9479f4c12fce1ee58e670f9c3fce46c40296ba9ee8a2Ian Hodson else 94805b6dc79427b8f7eeb6a7ff68034ab8548ce670eaAlexander Gutkin odir="$dir/$objdir" 9481f4c12fce1ee58e670f9c3fce46c40296ba9ee8a2Ian Hodson fi 9482f4c12fce1ee58e670f9c3fce46c40296ba9ee8a2Ian Hodson func_basename "$file" 9483f4c12fce1ee58e670f9c3fce46c40296ba9ee8a2Ian Hodson name="$func_basename_result" 94845b6dc79427b8f7eeb6a7ff68034ab8548ce670eaAlexander Gutkin test "$opt_mode" = uninstall && odir="$dir" 9485f4c12fce1ee58e670f9c3fce46c40296ba9ee8a2Ian Hodson 94865b6dc79427b8f7eeb6a7ff68034ab8548ce670eaAlexander Gutkin # Remember odir for removal later, being careful to avoid duplicates 94875b6dc79427b8f7eeb6a7ff68034ab8548ce670eaAlexander Gutkin if test "$opt_mode" = clean; then 9488f4c12fce1ee58e670f9c3fce46c40296ba9ee8a2Ian Hodson case " $rmdirs " in 94895b6dc79427b8f7eeb6a7ff68034ab8548ce670eaAlexander Gutkin *" $odir "*) ;; 94905b6dc79427b8f7eeb6a7ff68034ab8548ce670eaAlexander Gutkin *) func_append rmdirs " $odir" ;; 9491f4c12fce1ee58e670f9c3fce46c40296ba9ee8a2Ian Hodson esac 9492f4c12fce1ee58e670f9c3fce46c40296ba9ee8a2Ian Hodson fi 9493f4c12fce1ee58e670f9c3fce46c40296ba9ee8a2Ian Hodson 9494f4c12fce1ee58e670f9c3fce46c40296ba9ee8a2Ian Hodson # Don't error if the file doesn't exist and rm -f was used. 9495f4c12fce1ee58e670f9c3fce46c40296ba9ee8a2Ian Hodson if { test -L "$file"; } >/dev/null 2>&1 || 9496f4c12fce1ee58e670f9c3fce46c40296ba9ee8a2Ian Hodson { test -h "$file"; } >/dev/null 2>&1 || 9497f4c12fce1ee58e670f9c3fce46c40296ba9ee8a2Ian Hodson test -f "$file"; then 9498f4c12fce1ee58e670f9c3fce46c40296ba9ee8a2Ian Hodson : 9499f4c12fce1ee58e670f9c3fce46c40296ba9ee8a2Ian Hodson elif test -d "$file"; then 9500f4c12fce1ee58e670f9c3fce46c40296ba9ee8a2Ian Hodson exit_status=1 9501f4c12fce1ee58e670f9c3fce46c40296ba9ee8a2Ian Hodson continue 9502f4c12fce1ee58e670f9c3fce46c40296ba9ee8a2Ian Hodson elif test "$rmforce" = yes; then 9503f4c12fce1ee58e670f9c3fce46c40296ba9ee8a2Ian Hodson continue 9504f4c12fce1ee58e670f9c3fce46c40296ba9ee8a2Ian Hodson fi 9505f4c12fce1ee58e670f9c3fce46c40296ba9ee8a2Ian Hodson 9506f4c12fce1ee58e670f9c3fce46c40296ba9ee8a2Ian Hodson rmfiles="$file" 9507f4c12fce1ee58e670f9c3fce46c40296ba9ee8a2Ian Hodson 9508f4c12fce1ee58e670f9c3fce46c40296ba9ee8a2Ian Hodson case $name in 9509f4c12fce1ee58e670f9c3fce46c40296ba9ee8a2Ian Hodson *.la) 9510f4c12fce1ee58e670f9c3fce46c40296ba9ee8a2Ian Hodson # Possibly a libtool archive, so verify it. 9511f4c12fce1ee58e670f9c3fce46c40296ba9ee8a2Ian Hodson if func_lalib_p "$file"; then 9512f4c12fce1ee58e670f9c3fce46c40296ba9ee8a2Ian Hodson func_source $dir/$name 9513f4c12fce1ee58e670f9c3fce46c40296ba9ee8a2Ian Hodson 9514f4c12fce1ee58e670f9c3fce46c40296ba9ee8a2Ian Hodson # Delete the libtool libraries and symlinks. 9515f4c12fce1ee58e670f9c3fce46c40296ba9ee8a2Ian Hodson for n in $library_names; do 95165b6dc79427b8f7eeb6a7ff68034ab8548ce670eaAlexander Gutkin func_append rmfiles " $odir/$n" 9517f4c12fce1ee58e670f9c3fce46c40296ba9ee8a2Ian Hodson done 95185b6dc79427b8f7eeb6a7ff68034ab8548ce670eaAlexander Gutkin test -n "$old_library" && func_append rmfiles " $odir/$old_library" 9519f4c12fce1ee58e670f9c3fce46c40296ba9ee8a2Ian Hodson 95205b6dc79427b8f7eeb6a7ff68034ab8548ce670eaAlexander Gutkin case "$opt_mode" in 9521f4c12fce1ee58e670f9c3fce46c40296ba9ee8a2Ian Hodson clean) 95225b6dc79427b8f7eeb6a7ff68034ab8548ce670eaAlexander Gutkin case " $library_names " in 9523f4c12fce1ee58e670f9c3fce46c40296ba9ee8a2Ian Hodson *" $dlname "*) ;; 95245b6dc79427b8f7eeb6a7ff68034ab8548ce670eaAlexander Gutkin *) test -n "$dlname" && func_append rmfiles " $odir/$dlname" ;; 9525f4c12fce1ee58e670f9c3fce46c40296ba9ee8a2Ian Hodson esac 95265b6dc79427b8f7eeb6a7ff68034ab8548ce670eaAlexander Gutkin test -n "$libdir" && func_append rmfiles " $odir/$name $odir/${name}i" 9527f4c12fce1ee58e670f9c3fce46c40296ba9ee8a2Ian Hodson ;; 9528f4c12fce1ee58e670f9c3fce46c40296ba9ee8a2Ian Hodson uninstall) 9529f4c12fce1ee58e670f9c3fce46c40296ba9ee8a2Ian Hodson if test -n "$library_names"; then 9530f4c12fce1ee58e670f9c3fce46c40296ba9ee8a2Ian Hodson # Do each command in the postuninstall commands. 9531f4c12fce1ee58e670f9c3fce46c40296ba9ee8a2Ian Hodson func_execute_cmds "$postuninstall_cmds" 'test "$rmforce" = yes || exit_status=1' 9532f4c12fce1ee58e670f9c3fce46c40296ba9ee8a2Ian Hodson fi 9533f4c12fce1ee58e670f9c3fce46c40296ba9ee8a2Ian Hodson 9534f4c12fce1ee58e670f9c3fce46c40296ba9ee8a2Ian Hodson if test -n "$old_library"; then 9535f4c12fce1ee58e670f9c3fce46c40296ba9ee8a2Ian Hodson # Do each command in the old_postuninstall commands. 9536f4c12fce1ee58e670f9c3fce46c40296ba9ee8a2Ian Hodson func_execute_cmds "$old_postuninstall_cmds" 'test "$rmforce" = yes || exit_status=1' 9537f4c12fce1ee58e670f9c3fce46c40296ba9ee8a2Ian Hodson fi 9538f4c12fce1ee58e670f9c3fce46c40296ba9ee8a2Ian Hodson # FIXME: should reinstall the best remaining shared library. 9539f4c12fce1ee58e670f9c3fce46c40296ba9ee8a2Ian Hodson ;; 9540f4c12fce1ee58e670f9c3fce46c40296ba9ee8a2Ian Hodson esac 9541f4c12fce1ee58e670f9c3fce46c40296ba9ee8a2Ian Hodson fi 9542f4c12fce1ee58e670f9c3fce46c40296ba9ee8a2Ian Hodson ;; 9543f4c12fce1ee58e670f9c3fce46c40296ba9ee8a2Ian Hodson 9544f4c12fce1ee58e670f9c3fce46c40296ba9ee8a2Ian Hodson *.lo) 9545f4c12fce1ee58e670f9c3fce46c40296ba9ee8a2Ian Hodson # Possibly a libtool object, so verify it. 9546f4c12fce1ee58e670f9c3fce46c40296ba9ee8a2Ian Hodson if func_lalib_p "$file"; then 9547f4c12fce1ee58e670f9c3fce46c40296ba9ee8a2Ian Hodson 9548f4c12fce1ee58e670f9c3fce46c40296ba9ee8a2Ian Hodson # Read the .lo file 9549f4c12fce1ee58e670f9c3fce46c40296ba9ee8a2Ian Hodson func_source $dir/$name 9550f4c12fce1ee58e670f9c3fce46c40296ba9ee8a2Ian Hodson 9551f4c12fce1ee58e670f9c3fce46c40296ba9ee8a2Ian Hodson # Add PIC object to the list of files to remove. 9552f4c12fce1ee58e670f9c3fce46c40296ba9ee8a2Ian Hodson if test -n "$pic_object" && 9553f4c12fce1ee58e670f9c3fce46c40296ba9ee8a2Ian Hodson test "$pic_object" != none; then 95545b6dc79427b8f7eeb6a7ff68034ab8548ce670eaAlexander Gutkin func_append rmfiles " $dir/$pic_object" 9555f4c12fce1ee58e670f9c3fce46c40296ba9ee8a2Ian Hodson fi 9556f4c12fce1ee58e670f9c3fce46c40296ba9ee8a2Ian Hodson 9557f4c12fce1ee58e670f9c3fce46c40296ba9ee8a2Ian Hodson # Add non-PIC object to the list of files to remove. 9558f4c12fce1ee58e670f9c3fce46c40296ba9ee8a2Ian Hodson if test -n "$non_pic_object" && 9559f4c12fce1ee58e670f9c3fce46c40296ba9ee8a2Ian Hodson test "$non_pic_object" != none; then 95605b6dc79427b8f7eeb6a7ff68034ab8548ce670eaAlexander Gutkin func_append rmfiles " $dir/$non_pic_object" 9561f4c12fce1ee58e670f9c3fce46c40296ba9ee8a2Ian Hodson fi 9562f4c12fce1ee58e670f9c3fce46c40296ba9ee8a2Ian Hodson fi 9563f4c12fce1ee58e670f9c3fce46c40296ba9ee8a2Ian Hodson ;; 9564f4c12fce1ee58e670f9c3fce46c40296ba9ee8a2Ian Hodson 9565f4c12fce1ee58e670f9c3fce46c40296ba9ee8a2Ian Hodson *) 95665b6dc79427b8f7eeb6a7ff68034ab8548ce670eaAlexander Gutkin if test "$opt_mode" = clean ; then 9567f4c12fce1ee58e670f9c3fce46c40296ba9ee8a2Ian Hodson noexename=$name 9568f4c12fce1ee58e670f9c3fce46c40296ba9ee8a2Ian Hodson case $file in 9569f4c12fce1ee58e670f9c3fce46c40296ba9ee8a2Ian Hodson *.exe) 9570f4c12fce1ee58e670f9c3fce46c40296ba9ee8a2Ian Hodson func_stripname '' '.exe' "$file" 9571f4c12fce1ee58e670f9c3fce46c40296ba9ee8a2Ian Hodson file=$func_stripname_result 9572f4c12fce1ee58e670f9c3fce46c40296ba9ee8a2Ian Hodson func_stripname '' '.exe' "$name" 9573f4c12fce1ee58e670f9c3fce46c40296ba9ee8a2Ian Hodson noexename=$func_stripname_result 9574f4c12fce1ee58e670f9c3fce46c40296ba9ee8a2Ian Hodson # $file with .exe has already been added to rmfiles, 9575f4c12fce1ee58e670f9c3fce46c40296ba9ee8a2Ian Hodson # add $file without .exe 95765b6dc79427b8f7eeb6a7ff68034ab8548ce670eaAlexander Gutkin func_append rmfiles " $file" 9577f4c12fce1ee58e670f9c3fce46c40296ba9ee8a2Ian Hodson ;; 9578f4c12fce1ee58e670f9c3fce46c40296ba9ee8a2Ian Hodson esac 9579f4c12fce1ee58e670f9c3fce46c40296ba9ee8a2Ian Hodson # Do a test to see if this is a libtool program. 9580f4c12fce1ee58e670f9c3fce46c40296ba9ee8a2Ian Hodson if func_ltwrapper_p "$file"; then 9581f4c12fce1ee58e670f9c3fce46c40296ba9ee8a2Ian Hodson if func_ltwrapper_executable_p "$file"; then 9582f4c12fce1ee58e670f9c3fce46c40296ba9ee8a2Ian Hodson func_ltwrapper_scriptname "$file" 9583f4c12fce1ee58e670f9c3fce46c40296ba9ee8a2Ian Hodson relink_command= 9584f4c12fce1ee58e670f9c3fce46c40296ba9ee8a2Ian Hodson func_source $func_ltwrapper_scriptname_result 95855b6dc79427b8f7eeb6a7ff68034ab8548ce670eaAlexander Gutkin func_append rmfiles " $func_ltwrapper_scriptname_result" 9586f4c12fce1ee58e670f9c3fce46c40296ba9ee8a2Ian Hodson else 9587f4c12fce1ee58e670f9c3fce46c40296ba9ee8a2Ian Hodson relink_command= 9588f4c12fce1ee58e670f9c3fce46c40296ba9ee8a2Ian Hodson func_source $dir/$noexename 9589f4c12fce1ee58e670f9c3fce46c40296ba9ee8a2Ian Hodson fi 9590f4c12fce1ee58e670f9c3fce46c40296ba9ee8a2Ian Hodson 9591f4c12fce1ee58e670f9c3fce46c40296ba9ee8a2Ian Hodson # note $name still contains .exe if it was in $file originally 9592f4c12fce1ee58e670f9c3fce46c40296ba9ee8a2Ian Hodson # as does the version of $file that was added into $rmfiles 95935b6dc79427b8f7eeb6a7ff68034ab8548ce670eaAlexander Gutkin func_append rmfiles " $odir/$name $odir/${name}S.${objext}" 9594f4c12fce1ee58e670f9c3fce46c40296ba9ee8a2Ian Hodson if test "$fast_install" = yes && test -n "$relink_command"; then 95955b6dc79427b8f7eeb6a7ff68034ab8548ce670eaAlexander Gutkin func_append rmfiles " $odir/lt-$name" 9596f4c12fce1ee58e670f9c3fce46c40296ba9ee8a2Ian Hodson fi 9597f4c12fce1ee58e670f9c3fce46c40296ba9ee8a2Ian Hodson if test "X$noexename" != "X$name" ; then 95985b6dc79427b8f7eeb6a7ff68034ab8548ce670eaAlexander Gutkin func_append rmfiles " $odir/lt-${noexename}.c" 9599f4c12fce1ee58e670f9c3fce46c40296ba9ee8a2Ian Hodson fi 9600f4c12fce1ee58e670f9c3fce46c40296ba9ee8a2Ian Hodson fi 9601f4c12fce1ee58e670f9c3fce46c40296ba9ee8a2Ian Hodson fi 9602f4c12fce1ee58e670f9c3fce46c40296ba9ee8a2Ian Hodson ;; 9603f4c12fce1ee58e670f9c3fce46c40296ba9ee8a2Ian Hodson esac 9604f4c12fce1ee58e670f9c3fce46c40296ba9ee8a2Ian Hodson func_show_eval "$RM $rmfiles" 'exit_status=1' 9605f4c12fce1ee58e670f9c3fce46c40296ba9ee8a2Ian Hodson done 9606f4c12fce1ee58e670f9c3fce46c40296ba9ee8a2Ian Hodson 9607f4c12fce1ee58e670f9c3fce46c40296ba9ee8a2Ian Hodson # Try to remove the ${objdir}s in the directories where we deleted files 9608f4c12fce1ee58e670f9c3fce46c40296ba9ee8a2Ian Hodson for dir in $rmdirs; do 9609f4c12fce1ee58e670f9c3fce46c40296ba9ee8a2Ian Hodson if test -d "$dir"; then 9610f4c12fce1ee58e670f9c3fce46c40296ba9ee8a2Ian Hodson func_show_eval "rmdir $dir >/dev/null 2>&1" 9611f4c12fce1ee58e670f9c3fce46c40296ba9ee8a2Ian Hodson fi 9612f4c12fce1ee58e670f9c3fce46c40296ba9ee8a2Ian Hodson done 9613f4c12fce1ee58e670f9c3fce46c40296ba9ee8a2Ian Hodson 9614f4c12fce1ee58e670f9c3fce46c40296ba9ee8a2Ian Hodson exit $exit_status 9615f4c12fce1ee58e670f9c3fce46c40296ba9ee8a2Ian Hodson} 9616f4c12fce1ee58e670f9c3fce46c40296ba9ee8a2Ian Hodson 96175b6dc79427b8f7eeb6a7ff68034ab8548ce670eaAlexander Gutkin{ test "$opt_mode" = uninstall || test "$opt_mode" = clean; } && 9618f4c12fce1ee58e670f9c3fce46c40296ba9ee8a2Ian Hodson func_mode_uninstall ${1+"$@"} 9619f4c12fce1ee58e670f9c3fce46c40296ba9ee8a2Ian Hodson 96205b6dc79427b8f7eeb6a7ff68034ab8548ce670eaAlexander Gutkintest -z "$opt_mode" && { 9621f4c12fce1ee58e670f9c3fce46c40296ba9ee8a2Ian Hodson help="$generic_help" 9622f4c12fce1ee58e670f9c3fce46c40296ba9ee8a2Ian Hodson func_fatal_help "you must specify a MODE" 9623f4c12fce1ee58e670f9c3fce46c40296ba9ee8a2Ian Hodson} 9624f4c12fce1ee58e670f9c3fce46c40296ba9ee8a2Ian Hodson 9625f4c12fce1ee58e670f9c3fce46c40296ba9ee8a2Ian Hodsontest -z "$exec_cmd" && \ 96265b6dc79427b8f7eeb6a7ff68034ab8548ce670eaAlexander Gutkin func_fatal_help "invalid operation mode \`$opt_mode'" 9627f4c12fce1ee58e670f9c3fce46c40296ba9ee8a2Ian Hodson 9628f4c12fce1ee58e670f9c3fce46c40296ba9ee8a2Ian Hodsonif test -n "$exec_cmd"; then 9629f4c12fce1ee58e670f9c3fce46c40296ba9ee8a2Ian Hodson eval exec "$exec_cmd" 9630f4c12fce1ee58e670f9c3fce46c40296ba9ee8a2Ian Hodson exit $EXIT_FAILURE 9631f4c12fce1ee58e670f9c3fce46c40296ba9ee8a2Ian Hodsonfi 9632f4c12fce1ee58e670f9c3fce46c40296ba9ee8a2Ian Hodson 9633f4c12fce1ee58e670f9c3fce46c40296ba9ee8a2Ian Hodsonexit $exit_status 9634f4c12fce1ee58e670f9c3fce46c40296ba9ee8a2Ian Hodson 9635f4c12fce1ee58e670f9c3fce46c40296ba9ee8a2Ian Hodson 9636f4c12fce1ee58e670f9c3fce46c40296ba9ee8a2Ian Hodson# The TAGs below are defined such that we never get into a situation 9637f4c12fce1ee58e670f9c3fce46c40296ba9ee8a2Ian Hodson# in which we disable both kinds of libraries. Given conflicting 9638f4c12fce1ee58e670f9c3fce46c40296ba9ee8a2Ian Hodson# choices, we go for a static library, that is the most portable, 9639f4c12fce1ee58e670f9c3fce46c40296ba9ee8a2Ian Hodson# since we can't tell whether shared libraries were disabled because 9640f4c12fce1ee58e670f9c3fce46c40296ba9ee8a2Ian Hodson# the user asked for that or because the platform doesn't support 9641f4c12fce1ee58e670f9c3fce46c40296ba9ee8a2Ian Hodson# them. This is particularly important on AIX, because we don't 9642f4c12fce1ee58e670f9c3fce46c40296ba9ee8a2Ian Hodson# support having both static and shared libraries enabled at the same 9643f4c12fce1ee58e670f9c3fce46c40296ba9ee8a2Ian Hodson# time on that platform, so we default to a shared-only configuration. 9644f4c12fce1ee58e670f9c3fce46c40296ba9ee8a2Ian Hodson# If a disable-shared tag is given, we'll fallback to a static-only 9645f4c12fce1ee58e670f9c3fce46c40296ba9ee8a2Ian Hodson# configuration. But we'll never go from static-only to shared-only. 9646f4c12fce1ee58e670f9c3fce46c40296ba9ee8a2Ian Hodson 9647f4c12fce1ee58e670f9c3fce46c40296ba9ee8a2Ian Hodson# ### BEGIN LIBTOOL TAG CONFIG: disable-shared 9648f4c12fce1ee58e670f9c3fce46c40296ba9ee8a2Ian Hodsonbuild_libtool_libs=no 9649f4c12fce1ee58e670f9c3fce46c40296ba9ee8a2Ian Hodsonbuild_old_libs=yes 9650f4c12fce1ee58e670f9c3fce46c40296ba9ee8a2Ian Hodson# ### END LIBTOOL TAG CONFIG: disable-shared 9651f4c12fce1ee58e670f9c3fce46c40296ba9ee8a2Ian Hodson 9652f4c12fce1ee58e670f9c3fce46c40296ba9ee8a2Ian Hodson# ### BEGIN LIBTOOL TAG CONFIG: disable-static 9653f4c12fce1ee58e670f9c3fce46c40296ba9ee8a2Ian Hodsonbuild_old_libs=`case $build_libtool_libs in yes) echo no;; *) echo yes;; esac` 9654f4c12fce1ee58e670f9c3fce46c40296ba9ee8a2Ian Hodson# ### END LIBTOOL TAG CONFIG: disable-static 9655f4c12fce1ee58e670f9c3fce46c40296ba9ee8a2Ian Hodson 9656f4c12fce1ee58e670f9c3fce46c40296ba9ee8a2Ian Hodson# Local Variables: 9657f4c12fce1ee58e670f9c3fce46c40296ba9ee8a2Ian Hodson# mode:shell-script 9658f4c12fce1ee58e670f9c3fce46c40296ba9ee8a2Ian Hodson# sh-indentation:2 9659f4c12fce1ee58e670f9c3fce46c40296ba9ee8a2Ian Hodson# End: 9660f4c12fce1ee58e670f9c3fce46c40296ba9ee8a2Ian Hodson# vi:sw=2 9661f4c12fce1ee58e670f9c3fce46c40296ba9ee8a2Ian Hodson 9662