ltmain.sh revision 88de56cc
188de56ccSmrg# Generated from ltmain.m4sh. 288de56ccSmrg 388de56ccSmrg# ltmain.sh (GNU libtool) 2.2.6b 488de56ccSmrg# Written by Gordon Matzigkeit <gord@gnu.ai.mit.edu>, 1996 588de56ccSmrg 688de56ccSmrg# Copyright (C) 1996, 1997, 1998, 1999, 2000, 2001, 2003, 2004, 2005, 2006, 2007 2008 Free Software Foundation, Inc. 788de56ccSmrg# This is free software; see the source for copying conditions. There is NO 888de56ccSmrg# warranty; not even for MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. 988de56ccSmrg 1088de56ccSmrg# GNU Libtool is free software; you can redistribute it and/or modify 111ab64890Smrg# it under the terms of the GNU General Public License as published by 121ab64890Smrg# the Free Software Foundation; either version 2 of the License, or 131ab64890Smrg# (at your option) any later version. 141ab64890Smrg# 1588de56ccSmrg# As a special exception to the GNU General Public License, 1688de56ccSmrg# if you distribute this file as part of a program or library that 1788de56ccSmrg# is built using GNU Libtool, you may include this file under the 1888de56ccSmrg# same distribution terms that you use for the rest of that program. 1988de56ccSmrg# 2088de56ccSmrg# GNU Libtool is distributed in the hope that it will be useful, but 211ab64890Smrg# WITHOUT ANY WARRANTY; without even the implied warranty of 221ab64890Smrg# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU 231ab64890Smrg# General Public License for more details. 241ab64890Smrg# 251ab64890Smrg# You should have received a copy of the GNU General Public License 2688de56ccSmrg# along with GNU Libtool; see the file COPYING. If not, a copy 2788de56ccSmrg# can be downloaded from http://www.gnu.org/licenses/gpl.html, 2888de56ccSmrg# or obtained by writing to the Free Software Foundation, Inc., 2988de56ccSmrg# 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. 30b4ee4795Smrg 3188de56ccSmrg# Usage: $progname [OPTION]... [MODE-ARG]... 3288de56ccSmrg# 3388de56ccSmrg# Provide generalized library-building support services. 3488de56ccSmrg# 3588de56ccSmrg# --config show all configuration variables 3688de56ccSmrg# --debug enable verbose shell tracing 3788de56ccSmrg# -n, --dry-run display commands without modifying any files 3888de56ccSmrg# --features display basic configuration information and exit 3988de56ccSmrg# --mode=MODE use operation mode MODE 4088de56ccSmrg# --preserve-dup-deps don't remove duplicate dependency libraries 4188de56ccSmrg# --quiet, --silent don't print informational messages 4288de56ccSmrg# --tag=TAG use configuration variables from tag TAG 4388de56ccSmrg# -v, --verbose print informational messages (default) 4488de56ccSmrg# --version print version information 4588de56ccSmrg# -h, --help print short or long help message 4688de56ccSmrg# 4788de56ccSmrg# MODE must be one of the following: 4888de56ccSmrg# 4988de56ccSmrg# clean remove files from the build directory 5088de56ccSmrg# compile compile a source file into a libtool object 5188de56ccSmrg# execute automatically set library path, then run a program 5288de56ccSmrg# finish complete the installation of libtool libraries 5388de56ccSmrg# install install libraries or executables 5488de56ccSmrg# link create a library or an executable 5588de56ccSmrg# uninstall remove libraries from an installed directory 5688de56ccSmrg# 5788de56ccSmrg# MODE-ARGS vary depending on the MODE. 5888de56ccSmrg# Try `$progname --help --mode=MODE' for a more detailed description of MODE. 5988de56ccSmrg# 6088de56ccSmrg# When reporting a bug, please describe a test case to reproduce it and 6188de56ccSmrg# include the following information: 6288de56ccSmrg# 6388de56ccSmrg# host-triplet: $host 6488de56ccSmrg# shell: $SHELL 6588de56ccSmrg# compiler: $LTCC 6688de56ccSmrg# compiler flags: $LTCFLAGS 6788de56ccSmrg# linker: $LD (gnu? $with_gnu_ld) 6888de56ccSmrg# $progname: (GNU libtool) 2.2.6b 6988de56ccSmrg# automake: $automake_version 7088de56ccSmrg# autoconf: $autoconf_version 7188de56ccSmrg# 7288de56ccSmrg# Report bugs to <bug-libtool@gnu.org>. 731ab64890Smrg 741ab64890SmrgPROGRAM=ltmain.sh 751ab64890SmrgPACKAGE=libtool 7688de56ccSmrgVERSION=2.2.6b 7788de56ccSmrgTIMESTAMP="" 7888de56ccSmrgpackage_revision=1.3017 791ab64890Smrg 8088de56ccSmrg# Be Bourne compatible 811ab64890Smrgif test -n "${ZSH_VERSION+set}" && (emulate sh) >/dev/null 2>&1; then 821ab64890Smrg emulate sh 831ab64890Smrg NULLCMD=: 841ab64890Smrg # Zsh 3.x and 4.x performs word splitting on ${1+"$@"}, which 851ab64890Smrg # is contrary to our usage. Disable this feature. 861ab64890Smrg alias -g '${1+"$@"}'='"$@"' 871ab64890Smrg setopt NO_GLOB_SUBST 881ab64890Smrgelse 891ab64890Smrg case `(set -o) 2>/dev/null` in *posix*) set -o posix;; esac 901ab64890Smrgfi 911ab64890SmrgBIN_SH=xpg4; export BIN_SH # for Tru64 921ab64890SmrgDUALCASE=1; export DUALCASE # for MKS sh 931ab64890Smrg 9488de56ccSmrg# NLS nuisances: We save the old values to restore during execute mode. 951ab64890Smrg# Only set LANG and LC_ALL to C if already set. 961ab64890Smrg# These must not be set unconditionally because not all systems understand 971ab64890Smrg# e.g. LANG=C (notably SCO). 9888de56ccSmrglt_user_locale= 9988de56ccSmrglt_safe_locale= 10061b2299dSmrgfor lt_var in LANG LANGUAGE LC_ALL LC_CTYPE LC_COLLATE LC_MESSAGES 1011ab64890Smrgdo 1021ab64890Smrg eval "if test \"\${$lt_var+set}\" = set; then 10388de56ccSmrg save_$lt_var=\$$lt_var 10488de56ccSmrg $lt_var=C 1051ab64890Smrg export $lt_var 10688de56ccSmrg lt_user_locale=\"$lt_var=\\\$save_\$lt_var; \$lt_user_locale\" 10788de56ccSmrg lt_safe_locale=\"$lt_var=C; \$lt_safe_locale\" 1081ab64890Smrg fi" 1091ab64890Smrgdone 1101ab64890Smrg 11188de56ccSmrg$lt_unset CDPATH 11288de56ccSmrg 11388de56ccSmrg 11488de56ccSmrg 11588de56ccSmrg 11688de56ccSmrg 11788de56ccSmrg: ${CP="cp -f"} 11888de56ccSmrg: ${ECHO="echo"} 11988de56ccSmrg: ${EGREP="/bin/grep -E"} 12088de56ccSmrg: ${FGREP="/bin/grep -F"} 12188de56ccSmrg: ${GREP="/bin/grep"} 12288de56ccSmrg: ${LN_S="ln -s"} 12388de56ccSmrg: ${MAKE="make"} 12488de56ccSmrg: ${MKDIR="mkdir"} 12588de56ccSmrg: ${MV="mv -f"} 12688de56ccSmrg: ${RM="rm -f"} 12788de56ccSmrg: ${SED="/bin/sed"} 12888de56ccSmrg: ${SHELL="${CONFIG_SHELL-/bin/sh}"} 12988de56ccSmrg: ${Xsed="$SED -e 1s/^X//"} 13088de56ccSmrg 13188de56ccSmrg# Global variables: 13288de56ccSmrgEXIT_SUCCESS=0 13388de56ccSmrgEXIT_FAILURE=1 13488de56ccSmrgEXIT_MISMATCH=63 # $? = 63 is used to indicate version mismatch to missing. 13588de56ccSmrgEXIT_SKIP=77 # $? = 77 is used to indicate a skipped test to automake. 13688de56ccSmrg 13788de56ccSmrgexit_status=$EXIT_SUCCESS 13861b2299dSmrg 1391ab64890Smrg# Make sure IFS has a sensible default 1401ab64890Smrglt_nl=' 1411ab64890Smrg' 1421ab64890SmrgIFS=" $lt_nl" 1431ab64890Smrg 14488de56ccSmrgdirname="s,/[^/]*$,," 14588de56ccSmrgbasename="s,^.*/,," 14688de56ccSmrg 14788de56ccSmrg# func_dirname_and_basename file append nondir_replacement 14888de56ccSmrg# perform func_basename and func_dirname in a single function 14988de56ccSmrg# call: 15088de56ccSmrg# dirname: Compute the dirname of FILE. If nonempty, 15188de56ccSmrg# add APPEND to the result, otherwise set result 15288de56ccSmrg# to NONDIR_REPLACEMENT. 15388de56ccSmrg# value returned in "$func_dirname_result" 15488de56ccSmrg# basename: Compute filename of FILE. 15588de56ccSmrg# value retuned in "$func_basename_result" 15688de56ccSmrg# Implementation must be kept synchronized with func_dirname 15788de56ccSmrg# and func_basename. For efficiency, we do not delegate to 15888de56ccSmrg# those functions but instead duplicate the functionality here. 15988de56ccSmrgfunc_dirname_and_basename () 16088de56ccSmrg{ 16188de56ccSmrg # Extract subdirectory from the argument. 16288de56ccSmrg func_dirname_result=`$ECHO "X${1}" | $Xsed -e "$dirname"` 16388de56ccSmrg if test "X$func_dirname_result" = "X${1}"; then 16488de56ccSmrg func_dirname_result="${3}" 16588de56ccSmrg else 16688de56ccSmrg func_dirname_result="$func_dirname_result${2}" 16788de56ccSmrg fi 16888de56ccSmrg func_basename_result=`$ECHO "X${1}" | $Xsed -e "$basename"` 16988de56ccSmrg} 1702e9c7c8cSmrg 17188de56ccSmrg# Generated shell functions inserted here. 17288de56ccSmrg 17388de56ccSmrg# Work around backward compatibility issue on IRIX 6.5. On IRIX 6.4+, sh 17488de56ccSmrg# is ksh but when the shell is invoked as "sh" and the current value of 17588de56ccSmrg# the _XPG environment variable is not equal to 1 (one), the special 17688de56ccSmrg# positional parameter $0, within a function call, is the name of the 17788de56ccSmrg# function. 17888de56ccSmrgprogpath="$0" 17988de56ccSmrg 18088de56ccSmrg# The name of this program: 18188de56ccSmrg# In the unlikely event $progname began with a '-', it would play havoc with 18288de56ccSmrg# func_echo (imagine progname=-n), so we prepend ./ in that case: 18388de56ccSmrgfunc_dirname_and_basename "$progpath" 18488de56ccSmrgprogname=$func_basename_result 18588de56ccSmrgcase $progname in 18688de56ccSmrg -*) progname=./$progname ;; 18788de56ccSmrgesac 18888de56ccSmrg 18988de56ccSmrg# Make sure we have an absolute path for reexecution: 19088de56ccSmrgcase $progpath in 19188de56ccSmrg [\\/]*|[A-Za-z]:\\*) ;; 19288de56ccSmrg *[\\/]*) 19388de56ccSmrg progdir=$func_dirname_result 19488de56ccSmrg progdir=`cd "$progdir" && pwd` 19588de56ccSmrg progpath="$progdir/$progname" 19688de56ccSmrg ;; 19788de56ccSmrg *) 19888de56ccSmrg save_IFS="$IFS" 19988de56ccSmrg IFS=: 20088de56ccSmrg for progdir in $PATH; do 20188de56ccSmrg IFS="$save_IFS" 20288de56ccSmrg test -x "$progdir/$progname" && break 20388de56ccSmrg done 20488de56ccSmrg IFS="$save_IFS" 20588de56ccSmrg test -n "$progdir" || progdir=`pwd` 20688de56ccSmrg progpath="$progdir/$progname" 20788de56ccSmrg ;; 20888de56ccSmrgesac 20988de56ccSmrg 21088de56ccSmrg# Sed substitution that helps us do robust quoting. It backslashifies 21188de56ccSmrg# metacharacters that are still active within double-quoted strings. 21288de56ccSmrgXsed="${SED}"' -e 1s/^X//' 21388de56ccSmrgsed_quote_subst='s/\([`"$\\]\)/\\\1/g' 21488de56ccSmrg 21588de56ccSmrg# Same as above, but do not quote variable references. 21688de56ccSmrgdouble_quote_subst='s/\(["`\\]\)/\\\1/g' 21788de56ccSmrg 21888de56ccSmrg# Re-`\' parameter expansions in output of double_quote_subst that were 21988de56ccSmrg# `\'-ed in input to the same. If an odd number of `\' preceded a '$' 22088de56ccSmrg# in input to double_quote_subst, that '$' was protected from expansion. 22188de56ccSmrg# Since each input `\' is now two `\'s, look for any number of runs of 22288de56ccSmrg# four `\'s followed by two `\'s and then a '$'. `\' that '$'. 22388de56ccSmrgbs='\\' 22488de56ccSmrgbs2='\\\\' 22588de56ccSmrgbs4='\\\\\\\\' 22688de56ccSmrgdollar='\$' 22788de56ccSmrgsed_double_backslash="\ 22888de56ccSmrg s/$bs4/&\\ 22988de56ccSmrg/g 23088de56ccSmrg s/^$bs2$dollar/$bs&/ 23188de56ccSmrg s/\\([^$bs]\\)$bs2$dollar/\\1$bs2$bs$dollar/g 23288de56ccSmrg s/\n//g" 23388de56ccSmrg 23488de56ccSmrg# Standard options: 23588de56ccSmrgopt_dry_run=false 23688de56ccSmrgopt_help=false 23788de56ccSmrgopt_quiet=false 23888de56ccSmrgopt_verbose=false 23988de56ccSmrgopt_warning=: 24088de56ccSmrg 24188de56ccSmrg# func_echo arg... 24288de56ccSmrg# Echo program name prefixed message, along with the current mode 24388de56ccSmrg# name if it has been set yet. 24488de56ccSmrgfunc_echo () 24588de56ccSmrg{ 24688de56ccSmrg $ECHO "$progname${mode+: }$mode: $*" 24788de56ccSmrg} 24888de56ccSmrg 24988de56ccSmrg# func_verbose arg... 25088de56ccSmrg# Echo program name prefixed message in verbose mode only. 25188de56ccSmrgfunc_verbose () 25288de56ccSmrg{ 25388de56ccSmrg $opt_verbose && func_echo ${1+"$@"} 25488de56ccSmrg 25588de56ccSmrg # A bug in bash halts the script if the last line of a function 25688de56ccSmrg # fails when set -e is in force, so we need another command to 25788de56ccSmrg # work around that: 25888de56ccSmrg : 25988de56ccSmrg} 26088de56ccSmrg 26188de56ccSmrg# func_error arg... 26288de56ccSmrg# Echo program name prefixed message to standard error. 26388de56ccSmrgfunc_error () 26488de56ccSmrg{ 26588de56ccSmrg $ECHO "$progname${mode+: }$mode: "${1+"$@"} 1>&2 26688de56ccSmrg} 26788de56ccSmrg 26888de56ccSmrg# func_warning arg... 26988de56ccSmrg# Echo program name prefixed warning message to standard error. 27088de56ccSmrgfunc_warning () 27188de56ccSmrg{ 27288de56ccSmrg $opt_warning && $ECHO "$progname${mode+: }$mode: warning: "${1+"$@"} 1>&2 27388de56ccSmrg 27488de56ccSmrg # bash bug again: 27588de56ccSmrg : 27688de56ccSmrg} 27788de56ccSmrg 27888de56ccSmrg# func_fatal_error arg... 27988de56ccSmrg# Echo program name prefixed message to standard error, and exit. 28088de56ccSmrgfunc_fatal_error () 28188de56ccSmrg{ 28288de56ccSmrg func_error ${1+"$@"} 28388de56ccSmrg exit $EXIT_FAILURE 28488de56ccSmrg} 28588de56ccSmrg 28688de56ccSmrg# func_fatal_help arg... 28788de56ccSmrg# Echo program name prefixed message to standard error, followed by 28888de56ccSmrg# a help hint, and exit. 28988de56ccSmrgfunc_fatal_help () 29088de56ccSmrg{ 29188de56ccSmrg func_error ${1+"$@"} 29288de56ccSmrg func_fatal_error "$help" 29388de56ccSmrg} 29488de56ccSmrghelp="Try \`$progname --help' for more information." ## default 29588de56ccSmrg 29688de56ccSmrg 29788de56ccSmrg# func_grep expression filename 29888de56ccSmrg# Check whether EXPRESSION matches any line of FILENAME, without output. 29988de56ccSmrgfunc_grep () 30088de56ccSmrg{ 30188de56ccSmrg $GREP "$1" "$2" >/dev/null 2>&1 30288de56ccSmrg} 30388de56ccSmrg 30488de56ccSmrg 30588de56ccSmrg# func_mkdir_p directory-path 30688de56ccSmrg# Make sure the entire path to DIRECTORY-PATH is available. 30788de56ccSmrgfunc_mkdir_p () 30888de56ccSmrg{ 30988de56ccSmrg my_directory_path="$1" 31088de56ccSmrg my_dir_list= 31188de56ccSmrg 31288de56ccSmrg if test -n "$my_directory_path" && test "$opt_dry_run" != ":"; then 31388de56ccSmrg 31488de56ccSmrg # Protect directory names starting with `-' 31588de56ccSmrg case $my_directory_path in 31688de56ccSmrg -*) my_directory_path="./$my_directory_path" ;; 31788de56ccSmrg esac 31888de56ccSmrg 31988de56ccSmrg # While some portion of DIR does not yet exist... 32088de56ccSmrg while test ! -d "$my_directory_path"; do 32188de56ccSmrg # ...make a list in topmost first order. Use a colon delimited 32288de56ccSmrg # list incase some portion of path contains whitespace. 32388de56ccSmrg my_dir_list="$my_directory_path:$my_dir_list" 32488de56ccSmrg 32588de56ccSmrg # If the last portion added has no slash in it, the list is done 32688de56ccSmrg case $my_directory_path in */*) ;; *) break ;; esac 32788de56ccSmrg 32888de56ccSmrg # ...otherwise throw away the child directory and loop 32988de56ccSmrg my_directory_path=`$ECHO "X$my_directory_path" | $Xsed -e "$dirname"` 33088de56ccSmrg done 33188de56ccSmrg my_dir_list=`$ECHO "X$my_dir_list" | $Xsed -e 's,:*$,,'` 33288de56ccSmrg 33388de56ccSmrg save_mkdir_p_IFS="$IFS"; IFS=':' 33488de56ccSmrg for my_dir in $my_dir_list; do 33588de56ccSmrg IFS="$save_mkdir_p_IFS" 33688de56ccSmrg # mkdir can fail with a `File exist' error if two processes 33788de56ccSmrg # try to create one of the directories concurrently. Don't 33888de56ccSmrg # stop in that case! 33988de56ccSmrg $MKDIR "$my_dir" 2>/dev/null || : 34088de56ccSmrg done 34188de56ccSmrg IFS="$save_mkdir_p_IFS" 34288de56ccSmrg 34388de56ccSmrg # Bail out if we (or some other process) failed to create a directory. 34488de56ccSmrg test -d "$my_directory_path" || \ 34588de56ccSmrg func_fatal_error "Failed to create \`$1'" 34688de56ccSmrg fi 34788de56ccSmrg} 3481ab64890Smrg 3491ab64890Smrg 3501ab64890Smrg# func_mktempdir [string] 3511ab64890Smrg# Make a temporary directory that won't clash with other running 3521ab64890Smrg# libtool processes, and avoids race conditions if possible. If 3531ab64890Smrg# given, STRING is the basename for that directory. 3541ab64890Smrgfunc_mktempdir () 3551ab64890Smrg{ 3561ab64890Smrg my_template="${TMPDIR-/tmp}/${1-$progname}" 3571ab64890Smrg 35888de56ccSmrg if test "$opt_dry_run" = ":"; then 3591ab64890Smrg # Return a directory name, but don't create it in dry-run mode 3601ab64890Smrg my_tmpdir="${my_template}-$$" 3611ab64890Smrg else 3621ab64890Smrg 3631ab64890Smrg # If mktemp works, use that first and foremost 3641ab64890Smrg my_tmpdir=`mktemp -d "${my_template}-XXXXXXXX" 2>/dev/null` 3651ab64890Smrg 3661ab64890Smrg if test ! -d "$my_tmpdir"; then 36788de56ccSmrg # Failing that, at least try and use $RANDOM to avoid a race 36888de56ccSmrg my_tmpdir="${my_template}-${RANDOM-0}$$" 3691ab64890Smrg 37088de56ccSmrg save_mktempdir_umask=`umask` 37188de56ccSmrg umask 0077 37288de56ccSmrg $MKDIR "$my_tmpdir" 37388de56ccSmrg umask $save_mktempdir_umask 3741ab64890Smrg fi 3751ab64890Smrg 3761ab64890Smrg # If we're not in dry-run mode, bomb out on failure 37788de56ccSmrg test -d "$my_tmpdir" || \ 37888de56ccSmrg func_fatal_error "cannot create temporary directory \`$my_tmpdir'" 3791ab64890Smrg fi 3801ab64890Smrg 38188de56ccSmrg $ECHO "X$my_tmpdir" | $Xsed 3821ab64890Smrg} 3831ab64890Smrg 3841ab64890Smrg 38588de56ccSmrg# func_quote_for_eval arg 38688de56ccSmrg# Aesthetically quote ARG to be evaled later. 38788de56ccSmrg# This function returns two values: FUNC_QUOTE_FOR_EVAL_RESULT 38888de56ccSmrg# is double-quoted, suitable for a subsequent eval, whereas 38988de56ccSmrg# FUNC_QUOTE_FOR_EVAL_UNQUOTED_RESULT has merely all characters 39088de56ccSmrg# which are still active within double quotes backslashified. 39188de56ccSmrgfunc_quote_for_eval () 3921ab64890Smrg{ 39388de56ccSmrg case $1 in 39488de56ccSmrg *[\\\`\"\$]*) 39588de56ccSmrg func_quote_for_eval_unquoted_result=`$ECHO "X$1" | $Xsed -e "$sed_quote_subst"` ;; 39688de56ccSmrg *) 39788de56ccSmrg func_quote_for_eval_unquoted_result="$1" ;; 39888de56ccSmrg esac 39988de56ccSmrg 40088de56ccSmrg case $func_quote_for_eval_unquoted_result in 40188de56ccSmrg # Double-quote args containing shell metacharacters to delay 40288de56ccSmrg # word splitting, command substitution and and variable 40388de56ccSmrg # expansion for a subsequent eval. 40488de56ccSmrg # Many Bourne shells cannot handle close brackets correctly 40588de56ccSmrg # in scan sets, so we specify it separately. 40688de56ccSmrg *[\[\~\#\^\&\*\(\)\{\}\|\;\<\>\?\'\ \ ]*|*]*|"") 40788de56ccSmrg func_quote_for_eval_result="\"$func_quote_for_eval_unquoted_result\"" 40888de56ccSmrg ;; 40988de56ccSmrg *) 41088de56ccSmrg func_quote_for_eval_result="$func_quote_for_eval_unquoted_result" 4111ab64890Smrg esac 4121ab64890Smrg} 4131ab64890Smrg 4141ab64890Smrg 41588de56ccSmrg# func_quote_for_expand arg 41688de56ccSmrg# Aesthetically quote ARG to be evaled later; same as above, 41788de56ccSmrg# but do not quote variable references. 41888de56ccSmrgfunc_quote_for_expand () 4191ab64890Smrg{ 42088de56ccSmrg case $1 in 42188de56ccSmrg *[\\\`\"]*) 42288de56ccSmrg my_arg=`$ECHO "X$1" | $Xsed \ 42388de56ccSmrg -e "$double_quote_subst" -e "$sed_double_backslash"` ;; 4241ab64890Smrg *) 42588de56ccSmrg my_arg="$1" ;; 42688de56ccSmrg esac 42788de56ccSmrg 42888de56ccSmrg case $my_arg in 42988de56ccSmrg # Double-quote args containing shell metacharacters to delay 43088de56ccSmrg # word splitting and command substitution for a subsequent eval. 43188de56ccSmrg # Many Bourne shells cannot handle close brackets correctly 43288de56ccSmrg # in scan sets, so we specify it separately. 43388de56ccSmrg *[\[\~\#\^\&\*\(\)\{\}\|\;\<\>\?\'\ \ ]*|*]*|"") 43488de56ccSmrg my_arg="\"$my_arg\"" 43588de56ccSmrg ;; 43688de56ccSmrg esac 43788de56ccSmrg 43888de56ccSmrg func_quote_for_expand_result="$my_arg" 4391ab64890Smrg} 4401ab64890Smrg 4411ab64890Smrg 44288de56ccSmrg# func_show_eval cmd [fail_exp] 44388de56ccSmrg# Unless opt_silent is true, then output CMD. Then, if opt_dryrun is 44488de56ccSmrg# not true, evaluate CMD. If the evaluation of CMD fails, and FAIL_EXP 44588de56ccSmrg# is given, then evaluate it. 44688de56ccSmrgfunc_show_eval () 4471ab64890Smrg{ 44888de56ccSmrg my_cmd="$1" 44988de56ccSmrg my_fail_exp="${2-:}" 4502e9c7c8cSmrg 45188de56ccSmrg ${opt_silent-false} || { 45288de56ccSmrg func_quote_for_expand "$my_cmd" 45388de56ccSmrg eval "func_echo $func_quote_for_expand_result" 45488de56ccSmrg } 45588de56ccSmrg 45688de56ccSmrg if ${opt_dry_run-false}; then :; else 45788de56ccSmrg eval "$my_cmd" 45888de56ccSmrg my_status=$? 45988de56ccSmrg if test "$my_status" -eq 0; then :; else 46088de56ccSmrg eval "(exit $my_status); $my_fail_exp" 46188de56ccSmrg fi 4621ab64890Smrg fi 4631ab64890Smrg} 4641ab64890Smrg 46588de56ccSmrg 46688de56ccSmrg# func_show_eval_locale cmd [fail_exp] 46788de56ccSmrg# Unless opt_silent is true, then output CMD. Then, if opt_dryrun is 46888de56ccSmrg# not true, evaluate CMD. If the evaluation of CMD fails, and FAIL_EXP 46988de56ccSmrg# is given, then evaluate it. Use the saved locale for evaluation. 47088de56ccSmrgfunc_show_eval_locale () 4711ab64890Smrg{ 47288de56ccSmrg my_cmd="$1" 47388de56ccSmrg my_fail_exp="${2-:}" 47488de56ccSmrg 47588de56ccSmrg ${opt_silent-false} || { 47688de56ccSmrg func_quote_for_expand "$my_cmd" 47788de56ccSmrg eval "func_echo $func_quote_for_expand_result" 47888de56ccSmrg } 47988de56ccSmrg 48088de56ccSmrg if ${opt_dry_run-false}; then :; else 48188de56ccSmrg eval "$lt_user_locale 48288de56ccSmrg $my_cmd" 48388de56ccSmrg my_status=$? 48488de56ccSmrg eval "$lt_safe_locale" 48588de56ccSmrg if test "$my_status" -eq 0; then :; else 48688de56ccSmrg eval "(exit $my_status); $my_fail_exp" 48788de56ccSmrg fi 4881ab64890Smrg fi 48988de56ccSmrg} 4901ab64890Smrg 4912e9c7c8cSmrg 49288de56ccSmrg 49388de56ccSmrg 49488de56ccSmrg 49588de56ccSmrg# func_version 49688de56ccSmrg# Echo version message to standard output and exit. 49788de56ccSmrgfunc_version () 49888de56ccSmrg{ 49988de56ccSmrg $SED -n '/^# '$PROGRAM' (GNU /,/# warranty; / { 50088de56ccSmrg s/^# // 50188de56ccSmrg s/^# *$// 50288de56ccSmrg s/\((C)\)[ 0-9,-]*\( [1-9][0-9]*\)/\1\2/ 50388de56ccSmrg p 50488de56ccSmrg }' < "$progpath" 50588de56ccSmrg exit $? 50688de56ccSmrg} 50788de56ccSmrg 50888de56ccSmrg# func_usage 50988de56ccSmrg# Echo short help message to standard output and exit. 51088de56ccSmrgfunc_usage () 51188de56ccSmrg{ 51288de56ccSmrg $SED -n '/^# Usage:/,/# -h/ { 51388de56ccSmrg s/^# // 51488de56ccSmrg s/^# *$// 51588de56ccSmrg s/\$progname/'$progname'/ 51688de56ccSmrg p 51788de56ccSmrg }' < "$progpath" 51888de56ccSmrg $ECHO 51988de56ccSmrg $ECHO "run \`$progname --help | more' for full usage" 52088de56ccSmrg exit $? 52188de56ccSmrg} 52288de56ccSmrg 52388de56ccSmrg# func_help 52488de56ccSmrg# Echo long help message to standard output and exit. 52588de56ccSmrgfunc_help () 52688de56ccSmrg{ 52788de56ccSmrg $SED -n '/^# Usage:/,/# Report bugs to/ { 52888de56ccSmrg s/^# // 52988de56ccSmrg s/^# *$// 53088de56ccSmrg s*\$progname*'$progname'* 53188de56ccSmrg s*\$host*'"$host"'* 53288de56ccSmrg s*\$SHELL*'"$SHELL"'* 53388de56ccSmrg s*\$LTCC*'"$LTCC"'* 53488de56ccSmrg s*\$LTCFLAGS*'"$LTCFLAGS"'* 53588de56ccSmrg s*\$LD*'"$LD"'* 53688de56ccSmrg s/\$with_gnu_ld/'"$with_gnu_ld"'/ 53788de56ccSmrg s/\$automake_version/'"`(automake --version) 2>/dev/null |$SED 1q`"'/ 53888de56ccSmrg s/\$autoconf_version/'"`(autoconf --version) 2>/dev/null |$SED 1q`"'/ 53988de56ccSmrg p 54088de56ccSmrg }' < "$progpath" 54188de56ccSmrg exit $? 54288de56ccSmrg} 54388de56ccSmrg 54488de56ccSmrg# func_missing_arg argname 54588de56ccSmrg# Echo program name prefixed message to standard error and set global 54688de56ccSmrg# exit_cmd. 54788de56ccSmrgfunc_missing_arg () 54888de56ccSmrg{ 54988de56ccSmrg func_error "missing argument for $1" 55088de56ccSmrg exit_cmd=exit 5511ab64890Smrg} 5521ab64890Smrg 55388de56ccSmrgexit_cmd=: 5542e9c7c8cSmrg 5552e9c7c8cSmrg 55688de56ccSmrg 55788de56ccSmrg 55888de56ccSmrg 55988de56ccSmrg# Check that we have a working $ECHO. 56088de56ccSmrgif test "X$1" = X--no-reexec; then 56188de56ccSmrg # Discard the --no-reexec flag, and continue. 5622e9c7c8cSmrg shift 56388de56ccSmrgelif test "X$1" = X--fallback-echo; then 56488de56ccSmrg # Avoid inline document here, it may be left over 56588de56ccSmrg : 56688de56ccSmrgelif test "X`{ $ECHO '\t'; } 2>/dev/null`" = 'X\t'; then 56788de56ccSmrg # Yippee, $ECHO works! 56888de56ccSmrg : 56988de56ccSmrgelse 57088de56ccSmrg # Restart under the correct shell, and then maybe $ECHO will work. 57188de56ccSmrg exec $SHELL "$progpath" --no-reexec ${1+"$@"} 57288de56ccSmrgfi 5731ab64890Smrg 57488de56ccSmrgif test "X$1" = X--fallback-echo; then 57588de56ccSmrg # used as fallback echo 57688de56ccSmrg shift 57788de56ccSmrg cat <<EOF 57888de56ccSmrg$* 57988de56ccSmrgEOF 58088de56ccSmrg exit $EXIT_SUCCESS 58188de56ccSmrgfi 5821ab64890Smrg 58388de56ccSmrgmagic="%%%MAGIC variable%%%" 58488de56ccSmrgmagic_exe="%%%MAGIC EXE variable%%%" 5851ab64890Smrg 58688de56ccSmrg# Global variables. 58788de56ccSmrg# $mode is unset 58888de56ccSmrgnonopt= 58988de56ccSmrgexecute_dlfiles= 59088de56ccSmrgpreserve_args= 59188de56ccSmrglo2o="s/\\.lo\$/.${objext}/" 59288de56ccSmrgo2lo="s/\\.${objext}\$/.lo/" 59388de56ccSmrgextracted_archives= 59488de56ccSmrgextracted_serial=0 5952e9c7c8cSmrg 59688de56ccSmrgopt_dry_run=false 59788de56ccSmrgopt_duplicate_deps=false 59888de56ccSmrgopt_silent=false 59988de56ccSmrgopt_debug=: 6001ab64890Smrg 60188de56ccSmrg# If this variable is set in any of the actions, the command in it 60288de56ccSmrg# will be execed at the end. This prevents here-documents from being 60388de56ccSmrg# left over by shells. 60488de56ccSmrgexec_cmd= 60588de56ccSmrg 60688de56ccSmrg# func_fatal_configuration arg... 60788de56ccSmrg# Echo program name prefixed message to standard error, followed by 60888de56ccSmrg# a configuration failure hint, and exit. 60988de56ccSmrgfunc_fatal_configuration () 61088de56ccSmrg{ 61188de56ccSmrg func_error ${1+"$@"} 61288de56ccSmrg func_error "See the $PACKAGE documentation for more information." 61388de56ccSmrg func_fatal_error "Fatal configuration error." 61488de56ccSmrg} 6151ab64890Smrg 6162e9c7c8cSmrg 61788de56ccSmrg# func_config 61888de56ccSmrg# Display the configuration for all the tags in this script. 61988de56ccSmrgfunc_config () 62088de56ccSmrg{ 62188de56ccSmrg re_begincf='^# ### BEGIN LIBTOOL' 62288de56ccSmrg re_endcf='^# ### END LIBTOOL' 62388de56ccSmrg 62488de56ccSmrg # Default configuration. 62588de56ccSmrg $SED "1,/$re_begincf CONFIG/d;/$re_endcf CONFIG/,\$d" < "$progpath" 6261ab64890Smrg 6271ab64890Smrg # Now print the configurations for the tags. 6281ab64890Smrg for tagname in $taglist; do 62988de56ccSmrg $SED -n "/$re_begincf TAG CONFIG: $tagname\$/,/$re_endcf TAG CONFIG: $tagname\$/p" < "$progpath" 6301ab64890Smrg done 631b4ee4795Smrg 63288de56ccSmrg exit $? 63388de56ccSmrg} 634b4ee4795Smrg 63588de56ccSmrg# func_features 63688de56ccSmrg# Display the features supported by this script. 63788de56ccSmrgfunc_features () 63888de56ccSmrg{ 63988de56ccSmrg $ECHO "host: $host" 6401ab64890Smrg if test "$build_libtool_libs" = yes; then 64188de56ccSmrg $ECHO "enable shared libraries" 6421ab64890Smrg else 64388de56ccSmrg $ECHO "disable shared libraries" 6441ab64890Smrg fi 6451ab64890Smrg if test "$build_old_libs" = yes; then 64688de56ccSmrg $ECHO "enable static libraries" 6471ab64890Smrg else 64888de56ccSmrg $ECHO "disable static libraries" 6491ab64890Smrg fi 65088de56ccSmrg 6511ab64890Smrg exit $? 65288de56ccSmrg} 6531ab64890Smrg 65488de56ccSmrg# func_enable_tag tagname 65588de56ccSmrg# Verify that TAGNAME is valid, and either flag an error and exit, or 65688de56ccSmrg# enable the TAGNAME tag. We also add TAGNAME to the global $taglist 65788de56ccSmrg# variable here. 65888de56ccSmrgfunc_enable_tag () 65988de56ccSmrg{ 66088de56ccSmrg # Global variable: 66188de56ccSmrg tagname="$1" 6621ab64890Smrg 66388de56ccSmrg re_begincf="^# ### BEGIN LIBTOOL TAG CONFIG: $tagname\$" 66488de56ccSmrg re_endcf="^# ### END LIBTOOL TAG CONFIG: $tagname\$" 66588de56ccSmrg sed_extractcf="/$re_begincf/,/$re_endcf/p" 6662e9c7c8cSmrg 66788de56ccSmrg # Validate tagname. 66888de56ccSmrg case $tagname in 66988de56ccSmrg *[!-_A-Za-z0-9,/]*) 67088de56ccSmrg func_fatal_error "invalid tag name: $tagname" 67188de56ccSmrg ;; 67288de56ccSmrg esac 6731ab64890Smrg 67488de56ccSmrg # Don't test for the "default" C tag, as we know it's 67588de56ccSmrg # there but not specially marked. 67688de56ccSmrg case $tagname in 67788de56ccSmrg CC) ;; 67888de56ccSmrg *) 67988de56ccSmrg if $GREP "$re_begincf" "$progpath" >/dev/null 2>&1; then 68088de56ccSmrg taglist="$taglist $tagname" 68188de56ccSmrg 68288de56ccSmrg # Evaluate the configuration. Be careful to quote the path 68388de56ccSmrg # and the sed script, to avoid splitting on whitespace, but 68488de56ccSmrg # also don't use non-portable quotes within backquotes within 68588de56ccSmrg # quotes we have to do it in 2 steps: 68688de56ccSmrg extractedcf=`$SED -n -e "$sed_extractcf" < "$progpath"` 68788de56ccSmrg eval "$extractedcf" 68888de56ccSmrg else 68988de56ccSmrg func_error "ignoring unknown tag $tagname" 69088de56ccSmrg fi 69188de56ccSmrg ;; 69288de56ccSmrg esac 69388de56ccSmrg} 69488de56ccSmrg 69588de56ccSmrg# Parse options once, thoroughly. This comes as soon as possible in 69688de56ccSmrg# the script to make things like `libtool --version' happen quickly. 69788de56ccSmrg{ 698b4ee4795Smrg 69988de56ccSmrg # Shorthand for --mode=foo, only valid as the first argument 70088de56ccSmrg case $1 in 70188de56ccSmrg clean|clea|cle|cl) 70288de56ccSmrg shift; set dummy --mode clean ${1+"$@"}; shift 7031ab64890Smrg ;; 70488de56ccSmrg compile|compil|compi|comp|com|co|c) 70588de56ccSmrg shift; set dummy --mode compile ${1+"$@"}; shift 7061ab64890Smrg ;; 70788de56ccSmrg execute|execut|execu|exec|exe|ex|e) 70888de56ccSmrg shift; set dummy --mode execute ${1+"$@"}; shift 7092e9c7c8cSmrg ;; 71088de56ccSmrg finish|finis|fini|fin|fi|f) 71188de56ccSmrg shift; set dummy --mode finish ${1+"$@"}; shift 7122e9c7c8cSmrg ;; 71388de56ccSmrg install|instal|insta|inst|ins|in|i) 71488de56ccSmrg shift; set dummy --mode install ${1+"$@"}; shift 71588de56ccSmrg ;; 71688de56ccSmrg link|lin|li|l) 71788de56ccSmrg shift; set dummy --mode link ${1+"$@"}; shift 71888de56ccSmrg ;; 71988de56ccSmrg uninstall|uninstal|uninsta|uninst|unins|unin|uni|un|u) 72088de56ccSmrg shift; set dummy --mode uninstall ${1+"$@"}; shift 7211ab64890Smrg ;; 7221ab64890Smrg esac 7231ab64890Smrg 72488de56ccSmrg # Parse non-mode specific arguments: 72588de56ccSmrg while test "$#" -gt 0; do 72688de56ccSmrg opt="$1" 72788de56ccSmrg shift 7282e9c7c8cSmrg 72988de56ccSmrg case $opt in 73088de56ccSmrg --config) func_config ;; 7312e9c7c8cSmrg 73288de56ccSmrg --debug) preserve_args="$preserve_args $opt" 73388de56ccSmrg func_echo "enabling shell trace mode" 73488de56ccSmrg opt_debug='set -x' 73588de56ccSmrg $opt_debug 73688de56ccSmrg ;; 7372e9c7c8cSmrg 73888de56ccSmrg -dlopen) test "$#" -eq 0 && func_missing_arg "$opt" && break 73988de56ccSmrg execute_dlfiles="$execute_dlfiles $1" 74088de56ccSmrg shift 74188de56ccSmrg ;; 7422e9c7c8cSmrg 74388de56ccSmrg --dry-run | -n) opt_dry_run=: ;; 74488de56ccSmrg --features) func_features ;; 74588de56ccSmrg --finish) mode="finish" ;; 74688de56ccSmrg 74788de56ccSmrg --mode) test "$#" -eq 0 && func_missing_arg "$opt" && break 74888de56ccSmrg case $1 in 74988de56ccSmrg # Valid mode arguments: 75088de56ccSmrg clean) ;; 75188de56ccSmrg compile) ;; 75288de56ccSmrg execute) ;; 75388de56ccSmrg finish) ;; 75488de56ccSmrg install) ;; 75588de56ccSmrg link) ;; 75688de56ccSmrg relink) ;; 75788de56ccSmrg uninstall) ;; 75888de56ccSmrg 75988de56ccSmrg # Catch anything else as an error 76088de56ccSmrg *) func_error "invalid argument for $opt" 76188de56ccSmrg exit_cmd=exit 76288de56ccSmrg break 76388de56ccSmrg ;; 76488de56ccSmrg esac 76588de56ccSmrg 76688de56ccSmrg mode="$1" 76788de56ccSmrg shift 76888de56ccSmrg ;; 76988de56ccSmrg 77088de56ccSmrg --preserve-dup-deps) 77188de56ccSmrg opt_duplicate_deps=: ;; 77288de56ccSmrg 77388de56ccSmrg --quiet|--silent) preserve_args="$preserve_args $opt" 77488de56ccSmrg opt_silent=: 77588de56ccSmrg ;; 77688de56ccSmrg 77788de56ccSmrg --verbose| -v) preserve_args="$preserve_args $opt" 77888de56ccSmrg opt_silent=false 77988de56ccSmrg ;; 78088de56ccSmrg 78188de56ccSmrg --tag) test "$#" -eq 0 && func_missing_arg "$opt" && break 78288de56ccSmrg preserve_args="$preserve_args $opt $1" 78388de56ccSmrg func_enable_tag "$1" # tagname is set here 78488de56ccSmrg shift 78588de56ccSmrg ;; 78688de56ccSmrg 78788de56ccSmrg # Separate optargs to long options: 78888de56ccSmrg -dlopen=*|--mode=*|--tag=*) 78988de56ccSmrg func_opt_split "$opt" 79088de56ccSmrg set dummy "$func_opt_split_opt" "$func_opt_split_arg" ${1+"$@"} 79188de56ccSmrg shift 79288de56ccSmrg ;; 79388de56ccSmrg 79488de56ccSmrg -\?|-h) func_usage ;; 79588de56ccSmrg --help) opt_help=: ;; 79688de56ccSmrg --version) func_version ;; 79788de56ccSmrg 79888de56ccSmrg -*) func_fatal_help "unrecognized option \`$opt'" ;; 79988de56ccSmrg 80088de56ccSmrg *) nonopt="$opt" 80188de56ccSmrg break 80288de56ccSmrg ;; 80388de56ccSmrg esac 80488de56ccSmrg done 80588de56ccSmrg 80688de56ccSmrg 80788de56ccSmrg case $host in 80888de56ccSmrg *cygwin* | *mingw* | *pw32* | *cegcc*) 80988de56ccSmrg # don't eliminate duplications in $postdeps and $predeps 81088de56ccSmrg opt_duplicate_compiler_generated_deps=: 811b4ee4795Smrg ;; 812b4ee4795Smrg *) 81388de56ccSmrg opt_duplicate_compiler_generated_deps=$opt_duplicate_deps 81488de56ccSmrg ;; 81588de56ccSmrg esac 8162e9c7c8cSmrg 81788de56ccSmrg # Having warned about all mis-specified options, bail out if 81888de56ccSmrg # anything was wrong. 81988de56ccSmrg $exit_cmd $EXIT_FAILURE 82088de56ccSmrg} 82188de56ccSmrg 82288de56ccSmrg# func_check_version_match 82388de56ccSmrg# Ensure that we are using m4 macros, and libtool script from the same 82488de56ccSmrg# release of libtool. 82588de56ccSmrgfunc_check_version_match () 82688de56ccSmrg{ 82788de56ccSmrg if test "$package_revision" != "$macro_revision"; then 82888de56ccSmrg if test "$VERSION" != "$macro_version"; then 82988de56ccSmrg if test -z "$macro_version"; then 83088de56ccSmrg cat >&2 <<_LT_EOF 83188de56ccSmrg$progname: Version mismatch error. This is $PACKAGE $VERSION, but the 83288de56ccSmrg$progname: definition of this LT_INIT comes from an older release. 83388de56ccSmrg$progname: You should recreate aclocal.m4 with macros from $PACKAGE $VERSION 83488de56ccSmrg$progname: and run autoconf again. 83588de56ccSmrg_LT_EOF 83688de56ccSmrg else 83788de56ccSmrg cat >&2 <<_LT_EOF 83888de56ccSmrg$progname: Version mismatch error. This is $PACKAGE $VERSION, but the 83988de56ccSmrg$progname: definition of this LT_INIT comes from $PACKAGE $macro_version. 84088de56ccSmrg$progname: You should recreate aclocal.m4 with macros from $PACKAGE $VERSION 84188de56ccSmrg$progname: and run autoconf again. 84288de56ccSmrg_LT_EOF 8431ab64890Smrg fi 84488de56ccSmrg else 84588de56ccSmrg cat >&2 <<_LT_EOF 84688de56ccSmrg$progname: Version mismatch error. This is $PACKAGE $VERSION, revision $package_revision, 84788de56ccSmrg$progname: but the definition of this LT_INIT comes from revision $macro_revision. 84888de56ccSmrg$progname: You should recreate aclocal.m4 with macros from revision $package_revision 84988de56ccSmrg$progname: of $PACKAGE $VERSION and run autoconf again. 85088de56ccSmrg_LT_EOF 85188de56ccSmrg fi 85288de56ccSmrg 85388de56ccSmrg exit $EXIT_MISMATCH 85488de56ccSmrg fi 85588de56ccSmrg} 85688de56ccSmrg 85788de56ccSmrg 85888de56ccSmrg## ----------- ## 85988de56ccSmrg## Main. ## 86088de56ccSmrg## ----------- ## 86188de56ccSmrg 86288de56ccSmrg$opt_help || { 86388de56ccSmrg # Sanity checks first: 86488de56ccSmrg func_check_version_match 86588de56ccSmrg 86688de56ccSmrg if test "$build_libtool_libs" != yes && test "$build_old_libs" != yes; then 86788de56ccSmrg func_fatal_configuration "not configured to build any kind of library" 8681ab64890Smrg fi 8691ab64890Smrg 87088de56ccSmrg test -z "$mode" && func_fatal_error "error: you must specify a MODE." 87188de56ccSmrg 87288de56ccSmrg 87388de56ccSmrg # Darwin sucks 87488de56ccSmrg eval std_shrext=\"$shrext_cmds\" 87588de56ccSmrg 87688de56ccSmrg 8771ab64890Smrg # Only execute mode is allowed to have -dlopen flags. 8781ab64890Smrg if test -n "$execute_dlfiles" && test "$mode" != execute; then 87988de56ccSmrg func_error "unrecognized option \`-dlopen'" 88088de56ccSmrg $ECHO "$help" 1>&2 8811ab64890Smrg exit $EXIT_FAILURE 8821ab64890Smrg fi 8831ab64890Smrg 8841ab64890Smrg # Change the help message to a mode-specific one. 8851ab64890Smrg generic_help="$help" 88688de56ccSmrg help="Try \`$progname --help --mode=$mode' for more information." 88788de56ccSmrg} 8881ab64890Smrg 8891ab64890Smrg 89088de56ccSmrg# func_lalib_p file 89188de56ccSmrg# True iff FILE is a libtool `.la' library or `.lo' object file. 89288de56ccSmrg# This function is only a basic sanity check; it will hardly flush out 89388de56ccSmrg# determined imposters. 89488de56ccSmrgfunc_lalib_p () 89588de56ccSmrg{ 89688de56ccSmrg test -f "$1" && 89788de56ccSmrg $SED -e 4q "$1" 2>/dev/null \ 89888de56ccSmrg | $GREP "^# Generated by .*$PACKAGE" > /dev/null 2>&1 89988de56ccSmrg} 9001ab64890Smrg 90188de56ccSmrg# func_lalib_unsafe_p file 90288de56ccSmrg# True iff FILE is a libtool `.la' library or `.lo' object file. 90388de56ccSmrg# This function implements the same check as func_lalib_p without 90488de56ccSmrg# resorting to external programs. To this end, it redirects stdin and 90588de56ccSmrg# closes it afterwards, without saving the original file descriptor. 90688de56ccSmrg# As a safety measure, use it only where a negative result would be 90788de56ccSmrg# fatal anyway. Works if `file' does not exist. 90888de56ccSmrgfunc_lalib_unsafe_p () 90988de56ccSmrg{ 91088de56ccSmrg lalib_p=no 91188de56ccSmrg if test -f "$1" && test -r "$1" && exec 5<&0 <"$1"; then 91288de56ccSmrg for lalib_p_l in 1 2 3 4 91388de56ccSmrg do 91488de56ccSmrg read lalib_p_line 91588de56ccSmrg case "$lalib_p_line" in 91688de56ccSmrg \#\ Generated\ by\ *$PACKAGE* ) lalib_p=yes; break;; 91788de56ccSmrg esac 91888de56ccSmrg done 91988de56ccSmrg exec 0<&5 5<&- 92088de56ccSmrg fi 92188de56ccSmrg test "$lalib_p" = yes 92288de56ccSmrg} 9231ab64890Smrg 92488de56ccSmrg# func_ltwrapper_script_p file 92588de56ccSmrg# True iff FILE is a libtool wrapper script 92688de56ccSmrg# This function is only a basic sanity check; it will hardly flush out 92788de56ccSmrg# determined imposters. 92888de56ccSmrgfunc_ltwrapper_script_p () 92988de56ccSmrg{ 93088de56ccSmrg func_lalib_p "$1" 93188de56ccSmrg} 9321ab64890Smrg 93388de56ccSmrg# func_ltwrapper_executable_p file 93488de56ccSmrg# True iff FILE is a libtool wrapper executable 93588de56ccSmrg# This function is only a basic sanity check; it will hardly flush out 93688de56ccSmrg# determined imposters. 93788de56ccSmrgfunc_ltwrapper_executable_p () 93888de56ccSmrg{ 93988de56ccSmrg func_ltwrapper_exec_suffix= 94088de56ccSmrg case $1 in 94188de56ccSmrg *.exe) ;; 94288de56ccSmrg *) func_ltwrapper_exec_suffix=.exe ;; 94388de56ccSmrg esac 94488de56ccSmrg $GREP "$magic_exe" "$1$func_ltwrapper_exec_suffix" >/dev/null 2>&1 94588de56ccSmrg} 9462e9c7c8cSmrg 94788de56ccSmrg# func_ltwrapper_scriptname file 94888de56ccSmrg# Assumes file is an ltwrapper_executable 94988de56ccSmrg# uses $file to determine the appropriate filename for a 95088de56ccSmrg# temporary ltwrapper_script. 95188de56ccSmrgfunc_ltwrapper_scriptname () 95288de56ccSmrg{ 95388de56ccSmrg func_ltwrapper_scriptname_result="" 95488de56ccSmrg if func_ltwrapper_executable_p "$1"; then 95588de56ccSmrg func_dirname_and_basename "$1" "" "." 95688de56ccSmrg func_stripname '' '.exe' "$func_basename_result" 95788de56ccSmrg func_ltwrapper_scriptname_result="$func_dirname_result/$objdir/${func_stripname_result}_ltshwrapper" 95888de56ccSmrg fi 95988de56ccSmrg} 96088de56ccSmrg 96188de56ccSmrg# func_ltwrapper_p file 96288de56ccSmrg# True iff FILE is a libtool wrapper script or wrapper executable 96388de56ccSmrg# This function is only a basic sanity check; it will hardly flush out 96488de56ccSmrg# determined imposters. 96588de56ccSmrgfunc_ltwrapper_p () 96688de56ccSmrg{ 96788de56ccSmrg func_ltwrapper_script_p "$1" || func_ltwrapper_executable_p "$1" 96888de56ccSmrg} 96988de56ccSmrg 97088de56ccSmrg 97188de56ccSmrg# func_execute_cmds commands fail_cmd 97288de56ccSmrg# Execute tilde-delimited COMMANDS. 97388de56ccSmrg# If FAIL_CMD is given, eval that upon failure. 97488de56ccSmrg# FAIL_CMD may read-access the current command in variable CMD! 97588de56ccSmrgfunc_execute_cmds () 97688de56ccSmrg{ 97788de56ccSmrg $opt_debug 97888de56ccSmrg save_ifs=$IFS; IFS='~' 97988de56ccSmrg for cmd in $1; do 98088de56ccSmrg IFS=$save_ifs 98188de56ccSmrg eval cmd=\"$cmd\" 98288de56ccSmrg func_show_eval "$cmd" "${2-:}" 98388de56ccSmrg done 98488de56ccSmrg IFS=$save_ifs 98588de56ccSmrg} 98688de56ccSmrg 98788de56ccSmrg 98888de56ccSmrg# func_source file 98988de56ccSmrg# Source FILE, adding directory component if necessary. 99088de56ccSmrg# Note that it is not necessary on cygwin/mingw to append a dot to 99188de56ccSmrg# FILE even if both FILE and FILE.exe exist: automatic-append-.exe 99288de56ccSmrg# behavior happens only for exec(3), not for open(2)! Also, sourcing 99388de56ccSmrg# `FILE.' does not work on cygwin managed mounts. 99488de56ccSmrgfunc_source () 99588de56ccSmrg{ 99688de56ccSmrg $opt_debug 99788de56ccSmrg case $1 in 99888de56ccSmrg */* | *\\*) . "$1" ;; 99988de56ccSmrg *) . "./$1" ;; 100088de56ccSmrg esac 100188de56ccSmrg} 100288de56ccSmrg 100388de56ccSmrg 100488de56ccSmrg# func_infer_tag arg 100588de56ccSmrg# Infer tagged configuration to use if any are available and 100688de56ccSmrg# if one wasn't chosen via the "--tag" command line option. 100788de56ccSmrg# Only attempt this if the compiler in the base compile 100888de56ccSmrg# command doesn't match the default compiler. 100988de56ccSmrg# arg is usually of the form 'gcc ...' 101088de56ccSmrgfunc_infer_tag () 101188de56ccSmrg{ 101288de56ccSmrg $opt_debug 101388de56ccSmrg if test -n "$available_tags" && test -z "$tagname"; then 101488de56ccSmrg CC_quoted= 101588de56ccSmrg for arg in $CC; do 101688de56ccSmrg func_quote_for_eval "$arg" 101788de56ccSmrg CC_quoted="$CC_quoted $func_quote_for_eval_result" 101888de56ccSmrg done 101988de56ccSmrg case $@ in 102088de56ccSmrg # Blanks in the command may have been stripped by the calling shell, 102188de56ccSmrg # but not from the CC environment variable when configure was run. 102288de56ccSmrg " $CC "* | "$CC "* | " `$ECHO $CC` "* | "`$ECHO $CC` "* | " $CC_quoted"* | "$CC_quoted "* | " `$ECHO $CC_quoted` "* | "`$ECHO $CC_quoted` "*) ;; 102388de56ccSmrg # Blanks at the start of $base_compile will cause this to fail 102488de56ccSmrg # if we don't check for them as well. 102588de56ccSmrg *) 102688de56ccSmrg for z in $available_tags; do 102788de56ccSmrg if $GREP "^# ### BEGIN LIBTOOL TAG CONFIG: $z$" < "$progpath" > /dev/null; then 102888de56ccSmrg # Evaluate the configuration. 102988de56ccSmrg eval "`${SED} -n -e '/^# ### BEGIN LIBTOOL TAG CONFIG: '$z'$/,/^# ### END LIBTOOL TAG CONFIG: '$z'$/p' < $progpath`" 103088de56ccSmrg CC_quoted= 103188de56ccSmrg for arg in $CC; do 103288de56ccSmrg # Double-quote args containing other shell metacharacters. 103388de56ccSmrg func_quote_for_eval "$arg" 103488de56ccSmrg CC_quoted="$CC_quoted $func_quote_for_eval_result" 103588de56ccSmrg done 103688de56ccSmrg case "$@ " in 103788de56ccSmrg " $CC "* | "$CC "* | " `$ECHO $CC` "* | "`$ECHO $CC` "* | " $CC_quoted"* | "$CC_quoted "* | " `$ECHO $CC_quoted` "* | "`$ECHO $CC_quoted` "*) 103888de56ccSmrg # The compiler in the base compile command matches 103988de56ccSmrg # the one in the tagged configuration. 104088de56ccSmrg # Assume this is the tagged configuration we want. 104188de56ccSmrg tagname=$z 104288de56ccSmrg break 104388de56ccSmrg ;; 104488de56ccSmrg esac 104588de56ccSmrg fi 104688de56ccSmrg done 104788de56ccSmrg # If $tagname still isn't set, then no tagged configuration 104888de56ccSmrg # was found and let the user know that the "--tag" command 104988de56ccSmrg # line option must be used. 105088de56ccSmrg if test -z "$tagname"; then 105188de56ccSmrg func_echo "unable to infer tagged configuration" 105288de56ccSmrg func_fatal_error "specify a tag with \`--tag'" 105388de56ccSmrg# else 105488de56ccSmrg# func_verbose "using $tagname tagged configuration" 105588de56ccSmrg fi 105688de56ccSmrg ;; 105788de56ccSmrg esac 105888de56ccSmrg fi 105988de56ccSmrg} 106088de56ccSmrg 106188de56ccSmrg 106288de56ccSmrg 106388de56ccSmrg# func_write_libtool_object output_name pic_name nonpic_name 106488de56ccSmrg# Create a libtool object file (analogous to a ".la" file), 106588de56ccSmrg# but don't create it if we're doing a dry run. 106688de56ccSmrgfunc_write_libtool_object () 106788de56ccSmrg{ 106888de56ccSmrg write_libobj=${1} 106988de56ccSmrg if test "$build_libtool_libs" = yes; then 107088de56ccSmrg write_lobj=\'${2}\' 107188de56ccSmrg else 107288de56ccSmrg write_lobj=none 107388de56ccSmrg fi 107488de56ccSmrg 107588de56ccSmrg if test "$build_old_libs" = yes; then 107688de56ccSmrg write_oldobj=\'${3}\' 107788de56ccSmrg else 107888de56ccSmrg write_oldobj=none 107988de56ccSmrg fi 108088de56ccSmrg 108188de56ccSmrg $opt_dry_run || { 108288de56ccSmrg cat >${write_libobj}T <<EOF 108388de56ccSmrg# $write_libobj - a libtool object file 108488de56ccSmrg# Generated by $PROGRAM (GNU $PACKAGE$TIMESTAMP) $VERSION 108588de56ccSmrg# 108688de56ccSmrg# Please DO NOT delete this file! 108788de56ccSmrg# It is necessary for linking the library. 108888de56ccSmrg 108988de56ccSmrg# Name of the PIC object. 109088de56ccSmrgpic_object=$write_lobj 109188de56ccSmrg 109288de56ccSmrg# Name of the non-PIC object 109388de56ccSmrgnon_pic_object=$write_oldobj 109488de56ccSmrg 109588de56ccSmrgEOF 109688de56ccSmrg $MV "${write_libobj}T" "${write_libobj}" 109788de56ccSmrg } 109888de56ccSmrg} 109988de56ccSmrg 110088de56ccSmrg# func_mode_compile arg... 110188de56ccSmrgfunc_mode_compile () 110288de56ccSmrg{ 110388de56ccSmrg $opt_debug 110488de56ccSmrg # Get the compilation command and the source file. 110588de56ccSmrg base_compile= 110688de56ccSmrg srcfile="$nonopt" # always keep a non-empty value in "srcfile" 110788de56ccSmrg suppress_opt=yes 110888de56ccSmrg suppress_output= 110988de56ccSmrg arg_mode=normal 111088de56ccSmrg libobj= 111188de56ccSmrg later= 111288de56ccSmrg pie_flag= 111388de56ccSmrg 111488de56ccSmrg for arg 111588de56ccSmrg do 111688de56ccSmrg case $arg_mode in 111788de56ccSmrg arg ) 111888de56ccSmrg # do not "continue". Instead, add this to base_compile 111988de56ccSmrg lastarg="$arg" 112088de56ccSmrg arg_mode=normal 112188de56ccSmrg ;; 112288de56ccSmrg 112388de56ccSmrg target ) 112488de56ccSmrg libobj="$arg" 112588de56ccSmrg arg_mode=normal 112688de56ccSmrg continue 112788de56ccSmrg ;; 112888de56ccSmrg 112988de56ccSmrg normal ) 113088de56ccSmrg # Accept any command-line options. 113188de56ccSmrg case $arg in 113288de56ccSmrg -o) 113388de56ccSmrg test -n "$libobj" && \ 113488de56ccSmrg func_fatal_error "you cannot specify \`-o' more than once" 113588de56ccSmrg arg_mode=target 113688de56ccSmrg continue 113788de56ccSmrg ;; 113888de56ccSmrg 113988de56ccSmrg -pie | -fpie | -fPIE) 114088de56ccSmrg pie_flag="$pie_flag $arg" 114188de56ccSmrg continue 114288de56ccSmrg ;; 114388de56ccSmrg 114488de56ccSmrg -shared | -static | -prefer-pic | -prefer-non-pic) 114588de56ccSmrg later="$later $arg" 114688de56ccSmrg continue 114788de56ccSmrg ;; 114888de56ccSmrg 114988de56ccSmrg -no-suppress) 11501ab64890Smrg suppress_opt=no 11511ab64890Smrg continue 11521ab64890Smrg ;; 11531ab64890Smrg 11541ab64890Smrg -Xcompiler) 11551ab64890Smrg arg_mode=arg # the next one goes into the "base_compile" arg list 11561ab64890Smrg continue # The current "srcfile" will either be retained or 11571ab64890Smrg ;; # replaced later. I would guess that would be a bug. 11581ab64890Smrg 11591ab64890Smrg -Wc,*) 116088de56ccSmrg func_stripname '-Wc,' '' "$arg" 116188de56ccSmrg args=$func_stripname_result 11621ab64890Smrg lastarg= 11631ab64890Smrg save_ifs="$IFS"; IFS=',' 116488de56ccSmrg for arg in $args; do 11651ab64890Smrg IFS="$save_ifs" 116688de56ccSmrg func_quote_for_eval "$arg" 116788de56ccSmrg lastarg="$lastarg $func_quote_for_eval_result" 11681ab64890Smrg done 11691ab64890Smrg IFS="$save_ifs" 117088de56ccSmrg func_stripname ' ' '' "$lastarg" 117188de56ccSmrg lastarg=$func_stripname_result 11721ab64890Smrg 11731ab64890Smrg # Add the arguments to base_compile. 11741ab64890Smrg base_compile="$base_compile $lastarg" 11751ab64890Smrg continue 11761ab64890Smrg ;; 11771ab64890Smrg 117888de56ccSmrg *) 11791ab64890Smrg # Accept the current argument as the source file. 11801ab64890Smrg # The previous "srcfile" becomes the current argument. 11811ab64890Smrg # 11821ab64890Smrg lastarg="$srcfile" 11831ab64890Smrg srcfile="$arg" 11841ab64890Smrg ;; 11851ab64890Smrg esac # case $arg 11861ab64890Smrg ;; 11871ab64890Smrg esac # case $arg_mode 11881ab64890Smrg 11891ab64890Smrg # Aesthetically quote the previous argument. 119088de56ccSmrg func_quote_for_eval "$lastarg" 119188de56ccSmrg base_compile="$base_compile $func_quote_for_eval_result" 11921ab64890Smrg done # for arg 11931ab64890Smrg 11941ab64890Smrg case $arg_mode in 11951ab64890Smrg arg) 119688de56ccSmrg func_fatal_error "you must specify an argument for -Xcompile" 11971ab64890Smrg ;; 11981ab64890Smrg target) 119988de56ccSmrg func_fatal_error "you must specify a target with \`-o'" 12001ab64890Smrg ;; 12011ab64890Smrg *) 12021ab64890Smrg # Get the name of the library object. 120388de56ccSmrg test -z "$libobj" && { 120488de56ccSmrg func_basename "$srcfile" 120588de56ccSmrg libobj="$func_basename_result" 120688de56ccSmrg } 12071ab64890Smrg ;; 12081ab64890Smrg esac 12091ab64890Smrg 12101ab64890Smrg # Recognize several different file suffixes. 12111ab64890Smrg # If the user specifies -o file.o, it is replaced with file.lo 12121ab64890Smrg case $libobj in 121388de56ccSmrg *.[cCFSifmso] | \ 121488de56ccSmrg *.ada | *.adb | *.ads | *.asm | \ 121588de56ccSmrg *.c++ | *.cc | *.ii | *.class | *.cpp | *.cxx | \ 121688de56ccSmrg *.[fF][09]? | *.for | *.java | *.obj | *.sx) 121788de56ccSmrg func_xform "$libobj" 121888de56ccSmrg libobj=$func_xform_result 121988de56ccSmrg ;; 12201ab64890Smrg esac 12211ab64890Smrg 12221ab64890Smrg case $libobj in 122388de56ccSmrg *.lo) func_lo2o "$libobj"; obj=$func_lo2o_result ;; 12241ab64890Smrg *) 122588de56ccSmrg func_fatal_error "cannot determine name of library object from \`$libobj'" 12261ab64890Smrg ;; 12271ab64890Smrg esac 12281ab64890Smrg 12291ab64890Smrg func_infer_tag $base_compile 12301ab64890Smrg 12311ab64890Smrg for arg in $later; do 12321ab64890Smrg case $arg in 123388de56ccSmrg -shared) 123488de56ccSmrg test "$build_libtool_libs" != yes && \ 123588de56ccSmrg func_fatal_configuration "can not build a shared library" 123688de56ccSmrg build_old_libs=no 123788de56ccSmrg continue 123888de56ccSmrg ;; 123988de56ccSmrg 12401ab64890Smrg -static) 124188de56ccSmrg build_libtool_libs=no 12421ab64890Smrg build_old_libs=yes 12431ab64890Smrg continue 12441ab64890Smrg ;; 12451ab64890Smrg 12461ab64890Smrg -prefer-pic) 12471ab64890Smrg pic_mode=yes 12481ab64890Smrg continue 12491ab64890Smrg ;; 12501ab64890Smrg 12511ab64890Smrg -prefer-non-pic) 12521ab64890Smrg pic_mode=no 12531ab64890Smrg continue 12541ab64890Smrg ;; 12551ab64890Smrg esac 12561ab64890Smrg done 12571ab64890Smrg 125888de56ccSmrg func_quote_for_eval "$libobj" 125988de56ccSmrg test "X$libobj" != "X$func_quote_for_eval_result" \ 126088de56ccSmrg && $ECHO "X$libobj" | $GREP '[]~#^*{};<>?"'"'"' &()|`$[]' \ 126188de56ccSmrg && func_warning "libobj name \`$libobj' may not contain shell special characters." 126288de56ccSmrg func_dirname_and_basename "$obj" "/" "" 126388de56ccSmrg objname="$func_basename_result" 126488de56ccSmrg xdir="$func_dirname_result" 12651ab64890Smrg lobj=${xdir}$objdir/$objname 12661ab64890Smrg 126788de56ccSmrg test -z "$base_compile" && \ 126888de56ccSmrg func_fatal_help "you must specify a compilation command" 12691ab64890Smrg 12701ab64890Smrg # Delete any leftover library objects. 12711ab64890Smrg if test "$build_old_libs" = yes; then 12721ab64890Smrg removelist="$obj $lobj $libobj ${libobj}T" 12731ab64890Smrg else 12741ab64890Smrg removelist="$lobj $libobj ${libobj}T" 12751ab64890Smrg fi 12761ab64890Smrg 12771ab64890Smrg # On Cygwin there's no "real" PIC flag so we must build both object types 12781ab64890Smrg case $host_os in 127988de56ccSmrg cygwin* | mingw* | pw32* | os2* | cegcc*) 12801ab64890Smrg pic_mode=default 12811ab64890Smrg ;; 12821ab64890Smrg esac 12831ab64890Smrg if test "$pic_mode" = no && test "$deplibs_check_method" != pass_all; then 12841ab64890Smrg # non-PIC code in shared libraries is not supported 12851ab64890Smrg pic_mode=default 12861ab64890Smrg fi 12871ab64890Smrg 12881ab64890Smrg # Calculate the filename of the output object if compiler does 12891ab64890Smrg # not support -o with -c 12901ab64890Smrg if test "$compiler_c_o" = no; then 129188de56ccSmrg output_obj=`$ECHO "X$srcfile" | $Xsed -e 's%^.*/%%' -e 's%\.[^.]*$%%'`.${objext} 12921ab64890Smrg lockfile="$output_obj.lock" 12931ab64890Smrg else 12941ab64890Smrg output_obj= 12951ab64890Smrg need_locks=no 12961ab64890Smrg lockfile= 12971ab64890Smrg fi 12981ab64890Smrg 12991ab64890Smrg # Lock this critical section if it is needed 13001ab64890Smrg # We use this script file to make the link, it avoids creating a new file 13011ab64890Smrg if test "$need_locks" = yes; then 130288de56ccSmrg until $opt_dry_run || ln "$progpath" "$lockfile" 2>/dev/null; do 130388de56ccSmrg func_echo "Waiting for $lockfile to be removed" 13041ab64890Smrg sleep 2 13051ab64890Smrg done 13061ab64890Smrg elif test "$need_locks" = warn; then 13071ab64890Smrg if test -f "$lockfile"; then 130888de56ccSmrg $ECHO "\ 13091ab64890Smrg*** ERROR, $lockfile exists and contains: 13101ab64890Smrg`cat $lockfile 2>/dev/null` 13111ab64890Smrg 13121ab64890SmrgThis indicates that another process is trying to use the same 13131ab64890Smrgtemporary object file, and libtool could not work around it because 13141ab64890Smrgyour compiler does not support \`-c' and \`-o' together. If you 13151ab64890Smrgrepeat this compilation, it may succeed, by chance, but you had better 13161ab64890Smrgavoid parallel builds (make -j) in this platform, or get a better 13171ab64890Smrgcompiler." 13181ab64890Smrg 131988de56ccSmrg $opt_dry_run || $RM $removelist 13201ab64890Smrg exit $EXIT_FAILURE 13211ab64890Smrg fi 132288de56ccSmrg removelist="$removelist $output_obj" 132388de56ccSmrg $ECHO "$srcfile" > "$lockfile" 13241ab64890Smrg fi 13251ab64890Smrg 132688de56ccSmrg $opt_dry_run || $RM $removelist 132788de56ccSmrg removelist="$removelist $lockfile" 132888de56ccSmrg trap '$opt_dry_run || $RM $removelist; exit $EXIT_FAILURE' 1 2 15 132988de56ccSmrg 13301ab64890Smrg if test -n "$fix_srcfile_path"; then 13311ab64890Smrg eval srcfile=\"$fix_srcfile_path\" 13321ab64890Smrg fi 133388de56ccSmrg func_quote_for_eval "$srcfile" 133488de56ccSmrg qsrcfile=$func_quote_for_eval_result 13351ab64890Smrg 13361ab64890Smrg # Only build a PIC object if we are building libtool libraries. 13371ab64890Smrg if test "$build_libtool_libs" = yes; then 13381ab64890Smrg # Without this assignment, base_compile gets emptied. 13391ab64890Smrg fbsd_hideous_sh_bug=$base_compile 13401ab64890Smrg 13411ab64890Smrg if test "$pic_mode" != no; then 13421ab64890Smrg command="$base_compile $qsrcfile $pic_flag" 13431ab64890Smrg else 13441ab64890Smrg # Don't build PIC code 13451ab64890Smrg command="$base_compile $qsrcfile" 13461ab64890Smrg fi 13471ab64890Smrg 134888de56ccSmrg func_mkdir_p "$xdir$objdir" 13491ab64890Smrg 13501ab64890Smrg if test -z "$output_obj"; then 13511ab64890Smrg # Place PIC objects in $objdir 13521ab64890Smrg command="$command -o $lobj" 13531ab64890Smrg fi 13541ab64890Smrg 135588de56ccSmrg func_show_eval_locale "$command" \ 135688de56ccSmrg 'test -n "$output_obj" && $RM $removelist; exit $EXIT_FAILURE' 13571ab64890Smrg 13581ab64890Smrg if test "$need_locks" = warn && 13591ab64890Smrg test "X`cat $lockfile 2>/dev/null`" != "X$srcfile"; then 136088de56ccSmrg $ECHO "\ 13611ab64890Smrg*** ERROR, $lockfile contains: 13621ab64890Smrg`cat $lockfile 2>/dev/null` 13631ab64890Smrg 13641ab64890Smrgbut it should contain: 13651ab64890Smrg$srcfile 13661ab64890Smrg 13671ab64890SmrgThis indicates that another process is trying to use the same 13681ab64890Smrgtemporary object file, and libtool could not work around it because 13691ab64890Smrgyour compiler does not support \`-c' and \`-o' together. If you 13701ab64890Smrgrepeat this compilation, it may succeed, by chance, but you had better 13711ab64890Smrgavoid parallel builds (make -j) in this platform, or get a better 13721ab64890Smrgcompiler." 13731ab64890Smrg 137488de56ccSmrg $opt_dry_run || $RM $removelist 13751ab64890Smrg exit $EXIT_FAILURE 13761ab64890Smrg fi 13771ab64890Smrg 13781ab64890Smrg # Just move the object if needed, then go on to compile the next one 13791ab64890Smrg if test -n "$output_obj" && test "X$output_obj" != "X$lobj"; then 138088de56ccSmrg func_show_eval '$MV "$output_obj" "$lobj"' \ 138188de56ccSmrg 'error=$?; $opt_dry_run || $RM $removelist; exit $error' 13821ab64890Smrg fi 13831ab64890Smrg 13841ab64890Smrg # Allow error messages only from the first compilation. 13851ab64890Smrg if test "$suppress_opt" = yes; then 138688de56ccSmrg suppress_output=' >/dev/null 2>&1' 13871ab64890Smrg fi 13881ab64890Smrg fi 13891ab64890Smrg 13901ab64890Smrg # Only build a position-dependent object if we build old libraries. 13911ab64890Smrg if test "$build_old_libs" = yes; then 13921ab64890Smrg if test "$pic_mode" != yes; then 13931ab64890Smrg # Don't build PIC code 139488de56ccSmrg command="$base_compile $qsrcfile$pie_flag" 13951ab64890Smrg else 13961ab64890Smrg command="$base_compile $qsrcfile $pic_flag" 13971ab64890Smrg fi 13981ab64890Smrg if test "$compiler_c_o" = yes; then 13991ab64890Smrg command="$command -o $obj" 14001ab64890Smrg fi 14011ab64890Smrg 14021ab64890Smrg # Suppress compiler output if we already did a PIC compilation. 14031ab64890Smrg command="$command$suppress_output" 140488de56ccSmrg func_show_eval_locale "$command" \ 140588de56ccSmrg '$opt_dry_run || $RM $removelist; exit $EXIT_FAILURE' 14061ab64890Smrg 14071ab64890Smrg if test "$need_locks" = warn && 14081ab64890Smrg test "X`cat $lockfile 2>/dev/null`" != "X$srcfile"; then 140988de56ccSmrg $ECHO "\ 14101ab64890Smrg*** ERROR, $lockfile contains: 14111ab64890Smrg`cat $lockfile 2>/dev/null` 14121ab64890Smrg 14131ab64890Smrgbut it should contain: 14141ab64890Smrg$srcfile 14151ab64890Smrg 14161ab64890SmrgThis indicates that another process is trying to use the same 14171ab64890Smrgtemporary object file, and libtool could not work around it because 14181ab64890Smrgyour compiler does not support \`-c' and \`-o' together. If you 14191ab64890Smrgrepeat this compilation, it may succeed, by chance, but you had better 14201ab64890Smrgavoid parallel builds (make -j) in this platform, or get a better 14211ab64890Smrgcompiler." 14221ab64890Smrg 142388de56ccSmrg $opt_dry_run || $RM $removelist 14241ab64890Smrg exit $EXIT_FAILURE 14251ab64890Smrg fi 14261ab64890Smrg 14271ab64890Smrg # Just move the object if needed 14281ab64890Smrg if test -n "$output_obj" && test "X$output_obj" != "X$obj"; then 142988de56ccSmrg func_show_eval '$MV "$output_obj" "$obj"' \ 143088de56ccSmrg 'error=$?; $opt_dry_run || $RM $removelist; exit $error' 14311ab64890Smrg fi 14321ab64890Smrg fi 14331ab64890Smrg 143488de56ccSmrg $opt_dry_run || { 143588de56ccSmrg func_write_libtool_object "$libobj" "$objdir/$objname" "$objname" 14361ab64890Smrg 143788de56ccSmrg # Unlock the critical section if it was locked 143888de56ccSmrg if test "$need_locks" != no; then 143988de56ccSmrg removelist=$lockfile 144088de56ccSmrg $RM "$lockfile" 144188de56ccSmrg fi 144288de56ccSmrg } 14431ab64890Smrg 14441ab64890Smrg exit $EXIT_SUCCESS 144588de56ccSmrg} 14461ab64890Smrg 144788de56ccSmrg$opt_help || { 144888de56ccSmrgtest "$mode" = compile && func_mode_compile ${1+"$@"} 144988de56ccSmrg} 14501ab64890Smrg 145188de56ccSmrgfunc_mode_help () 145288de56ccSmrg{ 145388de56ccSmrg # We need to display help for each of the modes. 145488de56ccSmrg case $mode in 145588de56ccSmrg "") 145688de56ccSmrg # Generic help is extracted from the usage comments 145788de56ccSmrg # at the start of this file. 145888de56ccSmrg func_help 145988de56ccSmrg ;; 14601ab64890Smrg 146188de56ccSmrg clean) 146288de56ccSmrg $ECHO \ 146388de56ccSmrg"Usage: $progname [OPTION]... --mode=clean RM [RM-OPTION]... FILE... 14641ab64890Smrg 146588de56ccSmrgRemove files from the build directory. 14661ab64890Smrg 146788de56ccSmrgRM is the name of the program to use to delete files associated with each FILE 146888de56ccSmrg(typically \`/bin/rm'). RM-OPTIONS are options (such as \`-f') to be passed 146988de56ccSmrgto RM. 14701ab64890Smrg 147188de56ccSmrgIf FILE is a libtool library, object or program, all the files associated 147288de56ccSmrgwith it are deleted. Otherwise, only FILE itself is deleted using RM." 147388de56ccSmrg ;; 14741ab64890Smrg 147588de56ccSmrg compile) 147688de56ccSmrg $ECHO \ 147788de56ccSmrg"Usage: $progname [OPTION]... --mode=compile COMPILE-COMMAND... SOURCEFILE 14781ab64890Smrg 147988de56ccSmrgCompile a source file into a libtool library object. 14801ab64890Smrg 148188de56ccSmrgThis mode accepts the following additional options: 14821ab64890Smrg 148388de56ccSmrg -o OUTPUT-FILE set the output file name to OUTPUT-FILE 148488de56ccSmrg -no-suppress do not suppress compiler output for multiple passes 148588de56ccSmrg -prefer-pic try to building PIC objects only 148688de56ccSmrg -prefer-non-pic try to building non-PIC objects only 148788de56ccSmrg -shared do not build a \`.o' file suitable for static linking 148888de56ccSmrg -static only build a \`.o' file suitable for static linking 14891ab64890Smrg 149088de56ccSmrgCOMPILE-COMMAND is a command to be used in creating a \`standard' object file 149188de56ccSmrgfrom the given SOURCEFILE. 14921ab64890Smrg 149388de56ccSmrgThe output file name is determined by removing the directory component from 149488de56ccSmrgSOURCEFILE, then substituting the C source code suffix \`.c' with the 149588de56ccSmrglibrary object suffix, \`.lo'." 149688de56ccSmrg ;; 14971ab64890Smrg 149888de56ccSmrg execute) 149988de56ccSmrg $ECHO \ 150088de56ccSmrg"Usage: $progname [OPTION]... --mode=execute COMMAND [ARGS]... 15011ab64890Smrg 150288de56ccSmrgAutomatically set library path, then run a program. 15031ab64890Smrg 150488de56ccSmrgThis mode accepts the following additional options: 15051ab64890Smrg 150688de56ccSmrg -dlopen FILE add the directory containing FILE to the library path 15071ab64890Smrg 150888de56ccSmrgThis mode sets the library path environment variable according to \`-dlopen' 150988de56ccSmrgflags. 15101ab64890Smrg 151188de56ccSmrgIf any of the ARGS are libtool executable wrappers, then they are translated 151288de56ccSmrginto their corresponding uninstalled binary, and any of their required library 151388de56ccSmrgdirectories are added to the library path. 15141ab64890Smrg 151588de56ccSmrgThen, COMMAND is executed, with ARGS as arguments." 151688de56ccSmrg ;; 15171ab64890Smrg 151888de56ccSmrg finish) 151988de56ccSmrg $ECHO \ 152088de56ccSmrg"Usage: $progname [OPTION]... --mode=finish [LIBDIR]... 15211ab64890Smrg 152288de56ccSmrgComplete the installation of libtool libraries. 15231ab64890Smrg 152488de56ccSmrgEach LIBDIR is a directory that contains libtool libraries. 15251ab64890Smrg 152688de56ccSmrgThe commands that this mode executes may require superuser privileges. Use 152788de56ccSmrgthe \`--dry-run' option if you just want to see what would be executed." 152888de56ccSmrg ;; 15291ab64890Smrg 153088de56ccSmrg install) 153188de56ccSmrg $ECHO \ 153288de56ccSmrg"Usage: $progname [OPTION]... --mode=install INSTALL-COMMAND... 15331ab64890Smrg 153488de56ccSmrgInstall executables or libraries. 15351ab64890Smrg 153688de56ccSmrgINSTALL-COMMAND is the installation command. The first component should be 153788de56ccSmrgeither the \`install' or \`cp' program. 15381ab64890Smrg 153988de56ccSmrgThe following components of INSTALL-COMMAND are treated specially: 15401ab64890Smrg 154188de56ccSmrg -inst-prefix PREFIX-DIR Use PREFIX-DIR as a staging area for installation 15421ab64890Smrg 154388de56ccSmrgThe rest of the components are interpreted as arguments to that command (only 154488de56ccSmrgBSD-compatible install options are recognized)." 154588de56ccSmrg ;; 15461ab64890Smrg 154788de56ccSmrg link) 154888de56ccSmrg $ECHO \ 154988de56ccSmrg"Usage: $progname [OPTION]... --mode=link LINK-COMMAND... 15501ab64890Smrg 155188de56ccSmrgLink object files or libraries together to form another library, or to 155288de56ccSmrgcreate an executable program. 15531ab64890Smrg 155488de56ccSmrgLINK-COMMAND is a command using the C compiler that you would use to create 155588de56ccSmrga program from several object files. 15561ab64890Smrg 155788de56ccSmrgThe following components of LINK-COMMAND are treated specially: 15581ab64890Smrg 155988de56ccSmrg -all-static do not do any dynamic linking at all 156088de56ccSmrg -avoid-version do not add a version suffix if possible 156188de56ccSmrg -dlopen FILE \`-dlpreopen' FILE if it cannot be dlopened at runtime 156288de56ccSmrg -dlpreopen FILE link in FILE and add its symbols to lt_preloaded_symbols 156388de56ccSmrg -export-dynamic allow symbols from OUTPUT-FILE to be resolved with dlsym(3) 156488de56ccSmrg -export-symbols SYMFILE 156588de56ccSmrg try to export only the symbols listed in SYMFILE 156688de56ccSmrg -export-symbols-regex REGEX 156788de56ccSmrg try to export only the symbols matching REGEX 156888de56ccSmrg -LLIBDIR search LIBDIR for required installed libraries 156988de56ccSmrg -lNAME OUTPUT-FILE requires the installed library libNAME 157088de56ccSmrg -module build a library that can dlopened 157188de56ccSmrg -no-fast-install disable the fast-install mode 157288de56ccSmrg -no-install link a not-installable executable 157388de56ccSmrg -no-undefined declare that a library does not refer to external symbols 157488de56ccSmrg -o OUTPUT-FILE create OUTPUT-FILE from the specified objects 157588de56ccSmrg -objectlist FILE Use a list of object files found in FILE to specify objects 157688de56ccSmrg -precious-files-regex REGEX 157788de56ccSmrg don't remove output files matching REGEX 157888de56ccSmrg -release RELEASE specify package release information 157988de56ccSmrg -rpath LIBDIR the created library will eventually be installed in LIBDIR 158088de56ccSmrg -R[ ]LIBDIR add LIBDIR to the runtime path of programs and libraries 158188de56ccSmrg -shared only do dynamic linking of libtool libraries 158288de56ccSmrg -shrext SUFFIX override the standard shared library file extension 158388de56ccSmrg -static do not do any dynamic linking of uninstalled libtool libraries 158488de56ccSmrg -static-libtool-libs 158588de56ccSmrg do not do any dynamic linking of libtool libraries 158688de56ccSmrg -version-info CURRENT[:REVISION[:AGE]] 158788de56ccSmrg specify library version info [each variable defaults to 0] 158888de56ccSmrg -weak LIBNAME declare that the target provides the LIBNAME interface 15891ab64890Smrg 159088de56ccSmrgAll other options (arguments beginning with \`-') are ignored. 15911ab64890Smrg 159288de56ccSmrgEvery other argument is treated as a filename. Files ending in \`.la' are 159388de56ccSmrgtreated as uninstalled libtool libraries, other files are standard or library 159488de56ccSmrgobject files. 15951ab64890Smrg 159688de56ccSmrgIf the OUTPUT-FILE ends in \`.la', then a libtool library is created, 159788de56ccSmrgonly library objects (\`.lo' files) may be specified, and \`-rpath' is 159888de56ccSmrgrequired, except when creating a convenience library. 15991ab64890Smrg 160088de56ccSmrgIf OUTPUT-FILE ends in \`.a' or \`.lib', then a standard library is created 160188de56ccSmrgusing \`ar' and \`ranlib', or on Windows using \`lib'. 16021ab64890Smrg 160388de56ccSmrgIf OUTPUT-FILE ends in \`.lo' or \`.${objext}', then a reloadable object file 160488de56ccSmrgis created, otherwise an executable program is created." 1605b4ee4795Smrg ;; 16061ab64890Smrg 160788de56ccSmrg uninstall) 160888de56ccSmrg $ECHO \ 160988de56ccSmrg"Usage: $progname [OPTION]... --mode=uninstall RM [RM-OPTION]... FILE... 16101ab64890Smrg 161188de56ccSmrgRemove libraries from an installation directory. 16121ab64890Smrg 161388de56ccSmrgRM is the name of the program to use to delete files associated with each FILE 161488de56ccSmrg(typically \`/bin/rm'). RM-OPTIONS are options (such as \`-f') to be passed 161588de56ccSmrgto RM. 16162e9c7c8cSmrg 161788de56ccSmrgIf FILE is a libtool library, all the files associated with it are deleted. 161888de56ccSmrgOtherwise, only FILE itself is deleted using RM." 161988de56ccSmrg ;; 16202e9c7c8cSmrg 162188de56ccSmrg *) 162288de56ccSmrg func_fatal_help "invalid operation mode \`$mode'" 162388de56ccSmrg ;; 162488de56ccSmrg esac 16252e9c7c8cSmrg 162688de56ccSmrg $ECHO 162788de56ccSmrg $ECHO "Try \`$progname --help' for more information about other modes." 16282e9c7c8cSmrg 162988de56ccSmrg exit $? 163088de56ccSmrg} 16312e9c7c8cSmrg 163288de56ccSmrg # Now that we've collected a possible --mode arg, show help if necessary 163388de56ccSmrg $opt_help && func_mode_help 16342e9c7c8cSmrg 16352e9c7c8cSmrg 163688de56ccSmrg# func_mode_execute arg... 163788de56ccSmrgfunc_mode_execute () 163888de56ccSmrg{ 163988de56ccSmrg $opt_debug 164088de56ccSmrg # The first argument is the command name. 164188de56ccSmrg cmd="$nonopt" 164288de56ccSmrg test -z "$cmd" && \ 164388de56ccSmrg func_fatal_help "you must specify a COMMAND" 1644b4ee4795Smrg 164588de56ccSmrg # Handle -dlopen flags immediately. 164688de56ccSmrg for file in $execute_dlfiles; do 164788de56ccSmrg test -f "$file" \ 164888de56ccSmrg || func_fatal_help "\`$file' is not a file" 1649b4ee4795Smrg 165088de56ccSmrg dir= 165188de56ccSmrg case $file in 165288de56ccSmrg *.la) 165388de56ccSmrg # Check to see that this really is a libtool archive. 165488de56ccSmrg func_lalib_unsafe_p "$file" \ 165588de56ccSmrg || func_fatal_help "\`$lib' is not a valid libtool archive" 1656b4ee4795Smrg 165788de56ccSmrg # Read the libtool library. 165888de56ccSmrg dlname= 165988de56ccSmrg library_names= 166088de56ccSmrg func_source "$file" 16611ab64890Smrg 166288de56ccSmrg # Skip this library if it cannot be dlopened. 166388de56ccSmrg if test -z "$dlname"; then 166488de56ccSmrg # Warn if it was a shared library. 166588de56ccSmrg test -n "$library_names" && \ 166688de56ccSmrg func_warning "\`$file' was not linked with \`-export-dynamic'" 166788de56ccSmrg continue 166888de56ccSmrg fi 16691ab64890Smrg 167088de56ccSmrg func_dirname "$file" "" "." 167188de56ccSmrg dir="$func_dirname_result" 16721ab64890Smrg 167388de56ccSmrg if test -f "$dir/$objdir/$dlname"; then 167488de56ccSmrg dir="$dir/$objdir" 167588de56ccSmrg else 167688de56ccSmrg if test ! -f "$dir/$dlname"; then 167788de56ccSmrg func_fatal_error "cannot find \`$dlname' in \`$dir' or \`$dir/$objdir'" 167888de56ccSmrg fi 167988de56ccSmrg fi 1680b4ee4795Smrg ;; 16811ab64890Smrg 168288de56ccSmrg *.lo) 168388de56ccSmrg # Just add the directory containing the .lo file. 168488de56ccSmrg func_dirname "$file" "" "." 168588de56ccSmrg dir="$func_dirname_result" 1686b4ee4795Smrg ;; 16871ab64890Smrg 168888de56ccSmrg *) 168988de56ccSmrg func_warning "\`-dlopen' is ignored for non-libtool libraries and objects" 1690b4ee4795Smrg continue 1691b4ee4795Smrg ;; 169288de56ccSmrg esac 16931ab64890Smrg 169488de56ccSmrg # Get the absolute pathname. 169588de56ccSmrg absdir=`cd "$dir" && pwd` 169688de56ccSmrg test -n "$absdir" && dir="$absdir" 16972e9c7c8cSmrg 169888de56ccSmrg # Now add the directory to shlibpath_var. 169988de56ccSmrg if eval "test -z \"\$$shlibpath_var\""; then 170088de56ccSmrg eval "$shlibpath_var=\"\$dir\"" 170188de56ccSmrg else 170288de56ccSmrg eval "$shlibpath_var=\"\$dir:\$$shlibpath_var\"" 170388de56ccSmrg fi 170488de56ccSmrg done 17052e9c7c8cSmrg 170688de56ccSmrg # This variable tells wrapper scripts just to set shlibpath_var 170788de56ccSmrg # rather than running their programs. 170888de56ccSmrg libtool_execute_magic="$magic" 17092e9c7c8cSmrg 171088de56ccSmrg # Check if any of the arguments is a wrapper script. 171188de56ccSmrg args= 171288de56ccSmrg for file 171388de56ccSmrg do 171488de56ccSmrg case $file in 171588de56ccSmrg -*) ;; 171688de56ccSmrg *) 171788de56ccSmrg # Do a test to see if this is really a libtool program. 171888de56ccSmrg if func_ltwrapper_script_p "$file"; then 171988de56ccSmrg func_source "$file" 172088de56ccSmrg # Transform arg to wrapped name. 172188de56ccSmrg file="$progdir/$program" 172288de56ccSmrg elif func_ltwrapper_executable_p "$file"; then 172388de56ccSmrg func_ltwrapper_scriptname "$file" 172488de56ccSmrg func_source "$func_ltwrapper_scriptname_result" 172588de56ccSmrg # Transform arg to wrapped name. 172688de56ccSmrg file="$progdir/$program" 172788de56ccSmrg fi 172888de56ccSmrg ;; 172988de56ccSmrg esac 173088de56ccSmrg # Quote arguments (to preserve shell metacharacters). 173188de56ccSmrg func_quote_for_eval "$file" 173288de56ccSmrg args="$args $func_quote_for_eval_result" 173388de56ccSmrg done 17342e9c7c8cSmrg 173588de56ccSmrg if test "X$opt_dry_run" = Xfalse; then 173688de56ccSmrg if test -n "$shlibpath_var"; then 173788de56ccSmrg # Export the shlibpath_var. 173888de56ccSmrg eval "export $shlibpath_var" 173988de56ccSmrg fi 17402e9c7c8cSmrg 174188de56ccSmrg # Restore saved environment variables 174288de56ccSmrg for lt_var in LANG LANGUAGE LC_ALL LC_CTYPE LC_COLLATE LC_MESSAGES 174388de56ccSmrg do 174488de56ccSmrg eval "if test \"\${save_$lt_var+set}\" = set; then 174588de56ccSmrg $lt_var=\$save_$lt_var; export $lt_var 1746b4ee4795Smrg else 174788de56ccSmrg $lt_unset $lt_var 174888de56ccSmrg fi" 174988de56ccSmrg done 17502e9c7c8cSmrg 175188de56ccSmrg # Now prepare to actually exec the command. 175288de56ccSmrg exec_cmd="\$cmd$args" 175388de56ccSmrg else 175488de56ccSmrg # Display what would be done. 175588de56ccSmrg if test -n "$shlibpath_var"; then 175688de56ccSmrg eval "\$ECHO \"\$shlibpath_var=\$$shlibpath_var\"" 175788de56ccSmrg $ECHO "export $shlibpath_var" 175888de56ccSmrg fi 175988de56ccSmrg $ECHO "$cmd$args" 176088de56ccSmrg exit $EXIT_SUCCESS 176188de56ccSmrg fi 176288de56ccSmrg} 17632e9c7c8cSmrg 176488de56ccSmrgtest "$mode" = execute && func_mode_execute ${1+"$@"} 17652e9c7c8cSmrg 1766b4ee4795Smrg 176788de56ccSmrg# func_mode_finish arg... 176888de56ccSmrgfunc_mode_finish () 176988de56ccSmrg{ 177088de56ccSmrg $opt_debug 177188de56ccSmrg libdirs="$nonopt" 177288de56ccSmrg admincmds= 17731ab64890Smrg 177488de56ccSmrg if test -n "$finish_cmds$finish_eval" && test -n "$libdirs"; then 177588de56ccSmrg for dir 177688de56ccSmrg do 177788de56ccSmrg libdirs="$libdirs $dir" 177888de56ccSmrg done 17791ab64890Smrg 178088de56ccSmrg for libdir in $libdirs; do 178188de56ccSmrg if test -n "$finish_cmds"; then 178288de56ccSmrg # Do each command in the finish commands. 178388de56ccSmrg func_execute_cmds "$finish_cmds" 'admincmds="$admincmds 178488de56ccSmrg'"$cmd"'"' 1785b4ee4795Smrg fi 178688de56ccSmrg if test -n "$finish_eval"; then 178788de56ccSmrg # Do the single finish_eval. 178888de56ccSmrg eval cmds=\"$finish_eval\" 178988de56ccSmrg $opt_dry_run || eval "$cmds" || admincmds="$admincmds 179088de56ccSmrg $cmds" 179188de56ccSmrg fi 179288de56ccSmrg done 179388de56ccSmrg fi 17941ab64890Smrg 179588de56ccSmrg # Exit here if they wanted silent mode. 179688de56ccSmrg $opt_silent && exit $EXIT_SUCCESS 17971ab64890Smrg 179888de56ccSmrg $ECHO "X----------------------------------------------------------------------" | $Xsed 179988de56ccSmrg $ECHO "Libraries have been installed in:" 180088de56ccSmrg for libdir in $libdirs; do 180188de56ccSmrg $ECHO " $libdir" 180288de56ccSmrg done 180388de56ccSmrg $ECHO 180488de56ccSmrg $ECHO "If you ever happen to want to link against installed libraries" 180588de56ccSmrg $ECHO "in a given directory, LIBDIR, you must either use libtool, and" 180688de56ccSmrg $ECHO "specify the full pathname of the library, or use the \`-LLIBDIR'" 180788de56ccSmrg $ECHO "flag during linking and do at least one of the following:" 180888de56ccSmrg if test -n "$shlibpath_var"; then 180988de56ccSmrg $ECHO " - add LIBDIR to the \`$shlibpath_var' environment variable" 181088de56ccSmrg $ECHO " during execution" 181188de56ccSmrg fi 181288de56ccSmrg if test -n "$runpath_var"; then 181388de56ccSmrg $ECHO " - add LIBDIR to the \`$runpath_var' environment variable" 181488de56ccSmrg $ECHO " during linking" 181588de56ccSmrg fi 181688de56ccSmrg if test -n "$hardcode_libdir_flag_spec"; then 181788de56ccSmrg libdir=LIBDIR 181888de56ccSmrg eval flag=\"$hardcode_libdir_flag_spec\" 181988de56ccSmrg 182088de56ccSmrg $ECHO " - use the \`$flag' linker flag" 182188de56ccSmrg fi 182288de56ccSmrg if test -n "$admincmds"; then 182388de56ccSmrg $ECHO " - have your system administrator run these commands:$admincmds" 182488de56ccSmrg fi 182588de56ccSmrg if test -f /etc/ld.so.conf; then 182688de56ccSmrg $ECHO " - have your system administrator add LIBDIR to \`/etc/ld.so.conf'" 182788de56ccSmrg fi 182888de56ccSmrg $ECHO 182988de56ccSmrg 183088de56ccSmrg $ECHO "See any operating system documentation about shared libraries for" 183188de56ccSmrg case $host in 183288de56ccSmrg solaris2.[6789]|solaris2.1[0-9]) 183388de56ccSmrg $ECHO "more information, such as the ld(1), crle(1) and ld.so(8) manual" 183488de56ccSmrg $ECHO "pages." 183588de56ccSmrg ;; 183688de56ccSmrg *) 183788de56ccSmrg $ECHO "more information, such as the ld(1) and ld.so(8) manual pages." 183888de56ccSmrg ;; 183988de56ccSmrg esac 184088de56ccSmrg $ECHO "X----------------------------------------------------------------------" | $Xsed 184188de56ccSmrg exit $EXIT_SUCCESS 184288de56ccSmrg} 184388de56ccSmrg 184488de56ccSmrgtest "$mode" = finish && func_mode_finish ${1+"$@"} 184588de56ccSmrg 184688de56ccSmrg 184788de56ccSmrg# func_mode_install arg... 184888de56ccSmrgfunc_mode_install () 184988de56ccSmrg{ 185088de56ccSmrg $opt_debug 185188de56ccSmrg # There may be an optional sh(1) argument at the beginning of 185288de56ccSmrg # install_prog (especially on Windows NT). 185388de56ccSmrg if test "$nonopt" = "$SHELL" || test "$nonopt" = /bin/sh || 185488de56ccSmrg # Allow the use of GNU shtool's install command. 185588de56ccSmrg $ECHO "X$nonopt" | $GREP shtool >/dev/null; then 185688de56ccSmrg # Aesthetically quote it. 185788de56ccSmrg func_quote_for_eval "$nonopt" 185888de56ccSmrg install_prog="$func_quote_for_eval_result " 185988de56ccSmrg arg=$1 186088de56ccSmrg shift 186188de56ccSmrg else 186288de56ccSmrg install_prog= 186388de56ccSmrg arg=$nonopt 186488de56ccSmrg fi 186588de56ccSmrg 186688de56ccSmrg # The real first argument should be the name of the installation program. 186788de56ccSmrg # Aesthetically quote it. 186888de56ccSmrg func_quote_for_eval "$arg" 186988de56ccSmrg install_prog="$install_prog$func_quote_for_eval_result" 187088de56ccSmrg 187188de56ccSmrg # We need to accept at least all the BSD install flags. 187288de56ccSmrg dest= 187388de56ccSmrg files= 187488de56ccSmrg opts= 187588de56ccSmrg prev= 187688de56ccSmrg install_type= 187788de56ccSmrg isdir=no 187888de56ccSmrg stripme= 187988de56ccSmrg for arg 188088de56ccSmrg do 188188de56ccSmrg if test -n "$dest"; then 188288de56ccSmrg files="$files $dest" 188388de56ccSmrg dest=$arg 188488de56ccSmrg continue 188588de56ccSmrg fi 188688de56ccSmrg 188788de56ccSmrg case $arg in 188888de56ccSmrg -d) isdir=yes ;; 188988de56ccSmrg -f) 189088de56ccSmrg case " $install_prog " in 189188de56ccSmrg *[\\\ /]cp\ *) ;; 189288de56ccSmrg *) prev=$arg ;; 189388de56ccSmrg esac 189488de56ccSmrg ;; 189588de56ccSmrg -g | -m | -o) 189688de56ccSmrg prev=$arg 189788de56ccSmrg ;; 189888de56ccSmrg -s) 189988de56ccSmrg stripme=" -s" 190088de56ccSmrg continue 190188de56ccSmrg ;; 190288de56ccSmrg -*) 190388de56ccSmrg ;; 190488de56ccSmrg *) 190588de56ccSmrg # If the previous option needed an argument, then skip it. 190688de56ccSmrg if test -n "$prev"; then 1907b4ee4795Smrg prev= 19082e9c7c8cSmrg else 190988de56ccSmrg dest=$arg 191088de56ccSmrg continue 19111ab64890Smrg fi 1912b4ee4795Smrg ;; 191388de56ccSmrg esac 19141ab64890Smrg 191588de56ccSmrg # Aesthetically quote the argument. 191688de56ccSmrg func_quote_for_eval "$arg" 191788de56ccSmrg install_prog="$install_prog $func_quote_for_eval_result" 191888de56ccSmrg done 19191ab64890Smrg 192088de56ccSmrg test -z "$install_prog" && \ 192188de56ccSmrg func_fatal_help "you must specify an install program" 19221ab64890Smrg 192388de56ccSmrg test -n "$prev" && \ 192488de56ccSmrg func_fatal_help "the \`$prev' option requires an argument" 19252e9c7c8cSmrg 192688de56ccSmrg if test -z "$files"; then 192788de56ccSmrg if test -z "$dest"; then 192888de56ccSmrg func_fatal_help "no file or destination specified" 192988de56ccSmrg else 193088de56ccSmrg func_fatal_help "you must specify a destination" 193188de56ccSmrg fi 1932b4ee4795Smrg fi 19332e9c7c8cSmrg 193488de56ccSmrg # Strip any trailing slash from the destination. 193588de56ccSmrg func_stripname '' '/' "$dest" 193688de56ccSmrg dest=$func_stripname_result 19372e9c7c8cSmrg 193888de56ccSmrg # Check to see that the destination is a directory. 193988de56ccSmrg test -d "$dest" && isdir=yes 194088de56ccSmrg if test "$isdir" = yes; then 194188de56ccSmrg destdir="$dest" 194288de56ccSmrg destname= 1943b4ee4795Smrg else 194488de56ccSmrg func_dirname_and_basename "$dest" "" "." 194588de56ccSmrg destdir="$func_dirname_result" 194688de56ccSmrg destname="$func_basename_result" 19472e9c7c8cSmrg 194888de56ccSmrg # Not a directory, so check to see that there is only one file specified. 194988de56ccSmrg set dummy $files; shift 195088de56ccSmrg test "$#" -gt 1 && \ 195188de56ccSmrg func_fatal_help "\`$dest' is not a directory" 19522e9c7c8cSmrg fi 195388de56ccSmrg case $destdir in 195488de56ccSmrg [\\/]* | [A-Za-z]:[\\/]*) ;; 1955b4ee4795Smrg *) 195688de56ccSmrg for file in $files; do 195788de56ccSmrg case $file in 195888de56ccSmrg *.lo) ;; 195988de56ccSmrg *) 196088de56ccSmrg func_fatal_help "\`$destdir' must be an absolute directory name" 196188de56ccSmrg ;; 196288de56ccSmrg esac 196388de56ccSmrg done 1964b4ee4795Smrg ;; 1965b4ee4795Smrg esac 19661ab64890Smrg 196788de56ccSmrg # This variable tells wrapper scripts just to set variables rather 196888de56ccSmrg # than running their programs. 196988de56ccSmrg libtool_install_magic="$magic" 19701ab64890Smrg 197188de56ccSmrg staticlibs= 197288de56ccSmrg future_libdirs= 197388de56ccSmrg current_libdirs= 197488de56ccSmrg for file in $files; do 19751ab64890Smrg 197688de56ccSmrg # Do each installation. 197788de56ccSmrg case $file in 197888de56ccSmrg *.$libext) 197988de56ccSmrg # Do the static libraries later. 198088de56ccSmrg staticlibs="$staticlibs $file" 198188de56ccSmrg ;; 198288de56ccSmrg 198388de56ccSmrg *.la) 198488de56ccSmrg # Check to see that this really is a libtool archive. 198588de56ccSmrg func_lalib_unsafe_p "$file" \ 198688de56ccSmrg || func_fatal_help "\`$file' is not a valid libtool archive" 198788de56ccSmrg 198888de56ccSmrg library_names= 198988de56ccSmrg old_library= 199088de56ccSmrg relink_command= 199188de56ccSmrg func_source "$file" 199288de56ccSmrg 199388de56ccSmrg # Add the libdir to current_libdirs if it is the destination. 199488de56ccSmrg if test "X$destdir" = "X$libdir"; then 199588de56ccSmrg case "$current_libdirs " in 199688de56ccSmrg *" $libdir "*) ;; 199788de56ccSmrg *) current_libdirs="$current_libdirs $libdir" ;; 19982e9c7c8cSmrg esac 199988de56ccSmrg else 200088de56ccSmrg # Note the libdir as a future libdir. 200188de56ccSmrg case "$future_libdirs " in 200288de56ccSmrg *" $libdir "*) ;; 200388de56ccSmrg *) future_libdirs="$future_libdirs $libdir" ;; 200488de56ccSmrg esac 200588de56ccSmrg fi 20062e9c7c8cSmrg 200788de56ccSmrg func_dirname "$file" "/" "" 200888de56ccSmrg dir="$func_dirname_result" 200988de56ccSmrg dir="$dir$objdir" 201088de56ccSmrg 201188de56ccSmrg if test -n "$relink_command"; then 201288de56ccSmrg # Determine the prefix the user has applied to our future dir. 201388de56ccSmrg inst_prefix_dir=`$ECHO "X$destdir" | $Xsed -e "s%$libdir\$%%"` 201488de56ccSmrg 201588de56ccSmrg # Don't allow the user to place us outside of our expected 201688de56ccSmrg # location b/c this prevents finding dependent libraries that 201788de56ccSmrg # are installed to the same prefix. 201888de56ccSmrg # At present, this check doesn't affect windows .dll's that 201988de56ccSmrg # are installed into $libdir/../bin (currently, that works fine) 202088de56ccSmrg # but it's something to keep an eye on. 202188de56ccSmrg test "$inst_prefix_dir" = "$destdir" && \ 202288de56ccSmrg func_fatal_error "error: cannot install \`$file' to a directory not ending in $libdir" 202388de56ccSmrg 202488de56ccSmrg if test -n "$inst_prefix_dir"; then 202588de56ccSmrg # Stick the inst_prefix_dir data into the link command. 202688de56ccSmrg relink_command=`$ECHO "X$relink_command" | $Xsed -e "s%@inst_prefix_dir@%-inst-prefix-dir $inst_prefix_dir%"` 202788de56ccSmrg else 202888de56ccSmrg relink_command=`$ECHO "X$relink_command" | $Xsed -e "s%@inst_prefix_dir@%%"` 202988de56ccSmrg fi 203088de56ccSmrg 203188de56ccSmrg func_warning "relinking \`$file'" 203288de56ccSmrg func_show_eval "$relink_command" \ 203388de56ccSmrg 'func_fatal_error "error: relink \`$file'\'' with the above command before installing it"' 203488de56ccSmrg fi 203588de56ccSmrg 203688de56ccSmrg # See the names of the shared library. 203788de56ccSmrg set dummy $library_names; shift 203888de56ccSmrg if test -n "$1"; then 203988de56ccSmrg realname="$1" 204088de56ccSmrg shift 204188de56ccSmrg 204288de56ccSmrg srcname="$realname" 204388de56ccSmrg test -n "$relink_command" && srcname="$realname"T 204488de56ccSmrg 204588de56ccSmrg # Install the shared library and build the symlinks. 204688de56ccSmrg func_show_eval "$install_prog $dir/$srcname $destdir/$realname" \ 204788de56ccSmrg 'exit $?' 204888de56ccSmrg tstripme="$stripme" 204988de56ccSmrg case $host_os in 205088de56ccSmrg cygwin* | mingw* | pw32* | cegcc*) 205188de56ccSmrg case $realname in 205288de56ccSmrg *.dll.a) 205388de56ccSmrg tstripme="" 205488de56ccSmrg ;; 205588de56ccSmrg esac 20562e9c7c8cSmrg ;; 20572e9c7c8cSmrg esac 205888de56ccSmrg if test -n "$tstripme" && test -n "$striplib"; then 205988de56ccSmrg func_show_eval "$striplib $destdir/$realname" 'exit $?' 2060b4ee4795Smrg fi 206188de56ccSmrg 206288de56ccSmrg if test "$#" -gt 0; then 206388de56ccSmrg # Delete the old symlinks, and create new ones. 206488de56ccSmrg # Try `ln -sf' first, because the `ln' binary might depend on 206588de56ccSmrg # the symlink we replace! Solaris /bin/ln does not understand -f, 206688de56ccSmrg # so we also need to try rm && ln -s. 206788de56ccSmrg for linkname 206888de56ccSmrg do 206988de56ccSmrg test "$linkname" != "$realname" \ 207088de56ccSmrg && func_show_eval "(cd $destdir && { $LN_S -f $realname $linkname || { $RM $linkname && $LN_S $realname $linkname; }; })" 2071b4ee4795Smrg done 2072b4ee4795Smrg fi 20731ab64890Smrg 207488de56ccSmrg # Do each command in the postinstall commands. 207588de56ccSmrg lib="$destdir/$realname" 207688de56ccSmrg func_execute_cmds "$postinstall_cmds" 'exit $?' 2077b4ee4795Smrg fi 20781ab64890Smrg 207988de56ccSmrg # Install the pseudo-library for information purposes. 208088de56ccSmrg func_basename "$file" 208188de56ccSmrg name="$func_basename_result" 208288de56ccSmrg instname="$dir/$name"i 208388de56ccSmrg func_show_eval "$install_prog $instname $destdir/$name" 'exit $?' 20841ab64890Smrg 208588de56ccSmrg # Maybe install the static library, too. 208688de56ccSmrg test -n "$old_library" && staticlibs="$staticlibs $dir/$old_library" 208788de56ccSmrg ;; 20881ab64890Smrg 208988de56ccSmrg *.lo) 209088de56ccSmrg # Install (i.e. copy) a libtool object. 20911ab64890Smrg 209288de56ccSmrg # Figure out destination file name, if it wasn't already specified. 209388de56ccSmrg if test -n "$destname"; then 209488de56ccSmrg destfile="$destdir/$destname" 209588de56ccSmrg else 209688de56ccSmrg func_basename "$file" 209788de56ccSmrg destfile="$func_basename_result" 209888de56ccSmrg destfile="$destdir/$destfile" 2099b4ee4795Smrg fi 21001ab64890Smrg 210188de56ccSmrg # Deduce the name of the destination old-style object file. 210288de56ccSmrg case $destfile in 210388de56ccSmrg *.lo) 210488de56ccSmrg func_lo2o "$destfile" 210588de56ccSmrg staticdest=$func_lo2o_result 210688de56ccSmrg ;; 210788de56ccSmrg *.$objext) 210888de56ccSmrg staticdest="$destfile" 210988de56ccSmrg destfile= 211088de56ccSmrg ;; 211188de56ccSmrg *) 211288de56ccSmrg func_fatal_help "cannot copy a libtool object to \`$destfile'" 211388de56ccSmrg ;; 211488de56ccSmrg esac 21151ab64890Smrg 211688de56ccSmrg # Install the libtool object if requested. 211788de56ccSmrg test -n "$destfile" && \ 211888de56ccSmrg func_show_eval "$install_prog $file $destfile" 'exit $?' 21191ab64890Smrg 212088de56ccSmrg # Install the old object if enabled. 212188de56ccSmrg if test "$build_old_libs" = yes; then 212288de56ccSmrg # Deduce the name of the old-style object file. 212388de56ccSmrg func_lo2o "$file" 212488de56ccSmrg staticobj=$func_lo2o_result 212588de56ccSmrg func_show_eval "$install_prog \$staticobj \$staticdest" 'exit $?' 21261ab64890Smrg fi 212788de56ccSmrg exit $EXIT_SUCCESS 212888de56ccSmrg ;; 21291ab64890Smrg 213088de56ccSmrg *) 213188de56ccSmrg # Figure out destination file name, if it wasn't already specified. 213288de56ccSmrg if test -n "$destname"; then 213388de56ccSmrg destfile="$destdir/$destname" 213488de56ccSmrg else 213588de56ccSmrg func_basename "$file" 213688de56ccSmrg destfile="$func_basename_result" 213788de56ccSmrg destfile="$destdir/$destfile" 213888de56ccSmrg fi 21391ab64890Smrg 214088de56ccSmrg # If the file is missing, and there is a .exe on the end, strip it 214188de56ccSmrg # because it is most likely a libtool script we actually want to 214288de56ccSmrg # install 214388de56ccSmrg stripped_ext="" 214488de56ccSmrg case $file in 214588de56ccSmrg *.exe) 214688de56ccSmrg if test ! -f "$file"; then 214788de56ccSmrg func_stripname '' '.exe' "$file" 214888de56ccSmrg file=$func_stripname_result 214988de56ccSmrg stripped_ext=".exe" 215088de56ccSmrg fi 215188de56ccSmrg ;; 215288de56ccSmrg esac 215388de56ccSmrg 215488de56ccSmrg # Do a test to see if this is really a libtool program. 215588de56ccSmrg case $host in 215688de56ccSmrg *cygwin* | *mingw*) 215788de56ccSmrg if func_ltwrapper_executable_p "$file"; then 215888de56ccSmrg func_ltwrapper_scriptname "$file" 215988de56ccSmrg wrapper=$func_ltwrapper_scriptname_result 216088de56ccSmrg else 216188de56ccSmrg func_stripname '' '.exe' "$file" 216288de56ccSmrg wrapper=$func_stripname_result 216388de56ccSmrg fi 216488de56ccSmrg ;; 2165b4ee4795Smrg *) 216688de56ccSmrg wrapper=$file 216788de56ccSmrg ;; 216888de56ccSmrg esac 216988de56ccSmrg if func_ltwrapper_script_p "$wrapper"; then 217088de56ccSmrg notinst_deplibs= 217188de56ccSmrg relink_command= 217288de56ccSmrg 217388de56ccSmrg func_source "$wrapper" 217488de56ccSmrg 217588de56ccSmrg # Check the variables that should have been set. 217688de56ccSmrg test -z "$generated_by_libtool_version" && \ 217788de56ccSmrg func_fatal_error "invalid libtool wrapper script \`$wrapper'" 217888de56ccSmrg 217988de56ccSmrg finalize=yes 218088de56ccSmrg for lib in $notinst_deplibs; do 218188de56ccSmrg # Check to see that each library is installed. 218288de56ccSmrg libdir= 218388de56ccSmrg if test -f "$lib"; then 218488de56ccSmrg func_source "$lib" 218588de56ccSmrg fi 218688de56ccSmrg libfile="$libdir/"`$ECHO "X$lib" | $Xsed -e 's%^.*/%%g'` ### testsuite: skip nested quoting test 218788de56ccSmrg if test -n "$libdir" && test ! -f "$libfile"; then 218888de56ccSmrg func_warning "\`$lib' has not been installed in \`$libdir'" 218988de56ccSmrg finalize=no 219088de56ccSmrg fi 219188de56ccSmrg done 219288de56ccSmrg 219388de56ccSmrg relink_command= 219488de56ccSmrg func_source "$wrapper" 219588de56ccSmrg 219688de56ccSmrg outputname= 219788de56ccSmrg if test "$fast_install" = no && test -n "$relink_command"; then 219888de56ccSmrg $opt_dry_run || { 219988de56ccSmrg if test "$finalize" = yes; then 220088de56ccSmrg tmpdir=`func_mktempdir` 220188de56ccSmrg func_basename "$file$stripped_ext" 220288de56ccSmrg file="$func_basename_result" 220388de56ccSmrg outputname="$tmpdir/$file" 220488de56ccSmrg # Replace the output file specification. 220588de56ccSmrg relink_command=`$ECHO "X$relink_command" | $Xsed -e 's%@OUTPUT@%'"$outputname"'%g'` 220688de56ccSmrg 220788de56ccSmrg $opt_silent || { 220888de56ccSmrg func_quote_for_expand "$relink_command" 220988de56ccSmrg eval "func_echo $func_quote_for_expand_result" 221088de56ccSmrg } 221188de56ccSmrg if eval "$relink_command"; then : 221288de56ccSmrg else 221388de56ccSmrg func_error "error: relink \`$file' with the above command before installing it" 221488de56ccSmrg $opt_dry_run || ${RM}r "$tmpdir" 221588de56ccSmrg continue 221688de56ccSmrg fi 221788de56ccSmrg file="$outputname" 221888de56ccSmrg else 221988de56ccSmrg func_warning "cannot relink \`$file'" 222088de56ccSmrg fi 222188de56ccSmrg } 222288de56ccSmrg else 222388de56ccSmrg # Install the binary that we compiled earlier. 222488de56ccSmrg file=`$ECHO "X$file$stripped_ext" | $Xsed -e "s%\([^/]*\)$%$objdir/\1%"` 2225b4ee4795Smrg fi 222688de56ccSmrg fi 222788de56ccSmrg 222888de56ccSmrg # remove .exe since cygwin /usr/bin/install will append another 222988de56ccSmrg # one anyway 223088de56ccSmrg case $install_prog,$host in 223188de56ccSmrg */usr/bin/install*,*cygwin*) 223288de56ccSmrg case $file:$destfile in 223388de56ccSmrg *.exe:*.exe) 223488de56ccSmrg # this is ok 223588de56ccSmrg ;; 223688de56ccSmrg *.exe:*) 223788de56ccSmrg destfile=$destfile.exe 223888de56ccSmrg ;; 223988de56ccSmrg *:*.exe) 224088de56ccSmrg func_stripname '' '.exe' "$destfile" 224188de56ccSmrg destfile=$func_stripname_result 224288de56ccSmrg ;; 224388de56ccSmrg esac 2244b4ee4795Smrg ;; 2245b4ee4795Smrg esac 224688de56ccSmrg func_show_eval "$install_prog\$stripme \$file \$destfile" 'exit $?' 224788de56ccSmrg $opt_dry_run || if test -n "$outputname"; then 224888de56ccSmrg ${RM}r "$tmpdir" 224988de56ccSmrg fi 225088de56ccSmrg ;; 225188de56ccSmrg esac 225288de56ccSmrg done 22531ab64890Smrg 225488de56ccSmrg for file in $staticlibs; do 225588de56ccSmrg func_basename "$file" 225688de56ccSmrg name="$func_basename_result" 225788de56ccSmrg 225888de56ccSmrg # Set up the ranlib parameters. 225988de56ccSmrg oldlib="$destdir/$name" 226088de56ccSmrg 226188de56ccSmrg func_show_eval "$install_prog \$file \$oldlib" 'exit $?' 226288de56ccSmrg 226388de56ccSmrg if test -n "$stripme" && test -n "$old_striplib"; then 226488de56ccSmrg func_show_eval "$old_striplib $oldlib" 'exit $?' 226588de56ccSmrg fi 226688de56ccSmrg 226788de56ccSmrg # Do each command in the postinstall commands. 226888de56ccSmrg func_execute_cmds "$old_postinstall_cmds" 'exit $?' 226988de56ccSmrg done 227088de56ccSmrg 227188de56ccSmrg test -n "$future_libdirs" && \ 227288de56ccSmrg func_warning "remember to run \`$progname --finish$future_libdirs'" 227388de56ccSmrg 227488de56ccSmrg if test -n "$current_libdirs"; then 227588de56ccSmrg # Maybe just do a dry run. 227688de56ccSmrg $opt_dry_run && current_libdirs=" -n$current_libdirs" 227788de56ccSmrg exec_cmd='$SHELL $progpath $preserve_args --finish$current_libdirs' 227888de56ccSmrg else 227988de56ccSmrg exit $EXIT_SUCCESS 228088de56ccSmrg fi 228188de56ccSmrg} 228288de56ccSmrg 228388de56ccSmrgtest "$mode" = install && func_mode_install ${1+"$@"} 228488de56ccSmrg 228588de56ccSmrg 228688de56ccSmrg# func_generate_dlsyms outputname originator pic_p 228788de56ccSmrg# Extract symbols from dlprefiles and create ${outputname}S.o with 228888de56ccSmrg# a dlpreopen symbol table. 228988de56ccSmrgfunc_generate_dlsyms () 229088de56ccSmrg{ 229188de56ccSmrg $opt_debug 229288de56ccSmrg my_outputname="$1" 229388de56ccSmrg my_originator="$2" 229488de56ccSmrg my_pic_p="${3-no}" 229588de56ccSmrg my_prefix=`$ECHO "$my_originator" | sed 's%[^a-zA-Z0-9]%_%g'` 229688de56ccSmrg my_dlsyms= 229788de56ccSmrg 229888de56ccSmrg if test -n "$dlfiles$dlprefiles" || test "$dlself" != no; then 229988de56ccSmrg if test -n "$NM" && test -n "$global_symbol_pipe"; then 230088de56ccSmrg my_dlsyms="${my_outputname}S.c" 230188de56ccSmrg else 230288de56ccSmrg func_error "not configured to extract global symbols from dlpreopened files" 230388de56ccSmrg fi 230488de56ccSmrg fi 230588de56ccSmrg 230688de56ccSmrg if test -n "$my_dlsyms"; then 230788de56ccSmrg case $my_dlsyms in 230888de56ccSmrg "") ;; 230988de56ccSmrg *.c) 231088de56ccSmrg # Discover the nlist of each of the dlfiles. 231188de56ccSmrg nlist="$output_objdir/${my_outputname}.nm" 231288de56ccSmrg 231388de56ccSmrg func_show_eval "$RM $nlist ${nlist}S ${nlist}T" 231488de56ccSmrg 231588de56ccSmrg # Parse the name list into a source file. 231688de56ccSmrg func_verbose "creating $output_objdir/$my_dlsyms" 231788de56ccSmrg 231888de56ccSmrg $opt_dry_run || $ECHO > "$output_objdir/$my_dlsyms" "\ 231988de56ccSmrg/* $my_dlsyms - symbol resolution table for \`$my_outputname' dlsym emulation. */ 232088de56ccSmrg/* Generated by $PROGRAM (GNU $PACKAGE$TIMESTAMP) $VERSION */ 232188de56ccSmrg 232288de56ccSmrg#ifdef __cplusplus 232388de56ccSmrgextern \"C\" { 232488de56ccSmrg#endif 232588de56ccSmrg 232688de56ccSmrg/* External symbol declarations for the compiler. */\ 232788de56ccSmrg" 232888de56ccSmrg 232988de56ccSmrg if test "$dlself" = yes; then 233088de56ccSmrg func_verbose "generating symbol list for \`$output'" 233188de56ccSmrg 233288de56ccSmrg $opt_dry_run || echo ': @PROGRAM@ ' > "$nlist" 233388de56ccSmrg 233488de56ccSmrg # Add our own program objects to the symbol list. 233588de56ccSmrg progfiles=`$ECHO "X$objs$old_deplibs" | $SP2NL | $Xsed -e "$lo2o" | $NL2SP` 233688de56ccSmrg for progfile in $progfiles; do 233788de56ccSmrg func_verbose "extracting global C symbols from \`$progfile'" 233888de56ccSmrg $opt_dry_run || eval "$NM $progfile | $global_symbol_pipe >> '$nlist'" 233988de56ccSmrg done 234088de56ccSmrg 234188de56ccSmrg if test -n "$exclude_expsyms"; then 234288de56ccSmrg $opt_dry_run || { 234388de56ccSmrg eval '$EGREP -v " ($exclude_expsyms)$" "$nlist" > "$nlist"T' 234488de56ccSmrg eval '$MV "$nlist"T "$nlist"' 234588de56ccSmrg } 2346b4ee4795Smrg fi 234788de56ccSmrg 234888de56ccSmrg if test -n "$export_symbols_regex"; then 234988de56ccSmrg $opt_dry_run || { 235088de56ccSmrg eval '$EGREP -e "$export_symbols_regex" "$nlist" > "$nlist"T' 235188de56ccSmrg eval '$MV "$nlist"T "$nlist"' 235288de56ccSmrg } 235388de56ccSmrg fi 235488de56ccSmrg 235588de56ccSmrg # Prepare the list of exported symbols 235688de56ccSmrg if test -z "$export_symbols"; then 235788de56ccSmrg export_symbols="$output_objdir/$outputname.exp" 235888de56ccSmrg $opt_dry_run || { 235988de56ccSmrg $RM $export_symbols 236088de56ccSmrg eval "${SED} -n -e '/^: @PROGRAM@ $/d' -e 's/^.* \(.*\)$/\1/p' "'< "$nlist" > "$export_symbols"' 236188de56ccSmrg case $host in 236288de56ccSmrg *cygwin* | *mingw* | *cegcc* ) 236388de56ccSmrg eval "echo EXPORTS "'> "$output_objdir/$outputname.def"' 236488de56ccSmrg eval 'cat "$export_symbols" >> "$output_objdir/$outputname.def"' 236588de56ccSmrg ;; 236688de56ccSmrg esac 236788de56ccSmrg } 2368b4ee4795Smrg else 236988de56ccSmrg $opt_dry_run || { 237088de56ccSmrg eval "${SED} -e 's/\([].[*^$]\)/\\\\\1/g' -e 's/^/ /' -e 's/$/$/'"' < "$export_symbols" > "$output_objdir/$outputname.exp"' 237188de56ccSmrg eval '$GREP -f "$output_objdir/$outputname.exp" < "$nlist" > "$nlist"T' 237288de56ccSmrg eval '$MV "$nlist"T "$nlist"' 237388de56ccSmrg case $host in 237488de56ccSmrg *cygwin | *mingw* | *cegcc* ) 237588de56ccSmrg eval "echo EXPORTS "'> "$output_objdir/$outputname.def"' 237688de56ccSmrg eval 'cat "$nlist" >> "$output_objdir/$outputname.def"' 237788de56ccSmrg ;; 237888de56ccSmrg esac 237988de56ccSmrg } 2380b4ee4795Smrg fi 238188de56ccSmrg fi 23821ab64890Smrg 238388de56ccSmrg for dlprefile in $dlprefiles; do 238488de56ccSmrg func_verbose "extracting global C symbols from \`$dlprefile'" 238588de56ccSmrg func_basename "$dlprefile" 238688de56ccSmrg name="$func_basename_result" 238788de56ccSmrg $opt_dry_run || { 238888de56ccSmrg eval '$ECHO ": $name " >> "$nlist"' 238988de56ccSmrg eval "$NM $dlprefile 2>/dev/null | $global_symbol_pipe >> '$nlist'" 239088de56ccSmrg } 239188de56ccSmrg done 239288de56ccSmrg 239388de56ccSmrg $opt_dry_run || { 239488de56ccSmrg # Make sure we have at least an empty file. 239588de56ccSmrg test -f "$nlist" || : > "$nlist" 239688de56ccSmrg 239788de56ccSmrg if test -n "$exclude_expsyms"; then 239888de56ccSmrg $EGREP -v " ($exclude_expsyms)$" "$nlist" > "$nlist"T 239988de56ccSmrg $MV "$nlist"T "$nlist" 2400b4ee4795Smrg fi 240188de56ccSmrg 240288de56ccSmrg # Try sorting and uniquifying the output. 240388de56ccSmrg if $GREP -v "^: " < "$nlist" | 240488de56ccSmrg if sort -k 3 </dev/null >/dev/null 2>&1; then 240588de56ccSmrg sort -k 3 240688de56ccSmrg else 240788de56ccSmrg sort +2 240888de56ccSmrg fi | 240988de56ccSmrg uniq > "$nlist"S; then 241088de56ccSmrg : 2411b4ee4795Smrg else 241288de56ccSmrg $GREP -v "^: " < "$nlist" > "$nlist"S 2413b4ee4795Smrg fi 24141ab64890Smrg 241588de56ccSmrg if test -f "$nlist"S; then 241688de56ccSmrg eval "$global_symbol_to_cdecl"' < "$nlist"S >> "$output_objdir/$my_dlsyms"' 2417b4ee4795Smrg else 241888de56ccSmrg $ECHO '/* NONE */' >> "$output_objdir/$my_dlsyms" 2419b4ee4795Smrg fi 24201ab64890Smrg 242188de56ccSmrg $ECHO >> "$output_objdir/$my_dlsyms" "\ 24221ab64890Smrg 242388de56ccSmrg/* The mapping between symbol names and symbols. */ 242488de56ccSmrgtypedef struct { 242588de56ccSmrg const char *name; 242688de56ccSmrg void *address; 242788de56ccSmrg} lt_dlsymlist; 242888de56ccSmrg" 242988de56ccSmrg case $host in 243088de56ccSmrg *cygwin* | *mingw* | *cegcc* ) 243188de56ccSmrg $ECHO >> "$output_objdir/$my_dlsyms" "\ 243288de56ccSmrg/* DATA imports from DLLs on WIN32 con't be const, because 243388de56ccSmrg runtime relocations are performed -- see ld's documentation 243488de56ccSmrg on pseudo-relocs. */" 243588de56ccSmrg lt_dlsym_const= ;; 243688de56ccSmrg *osf5*) 243788de56ccSmrg echo >> "$output_objdir/$my_dlsyms" "\ 243888de56ccSmrg/* This system does not cope well with relocations in const data */" 243988de56ccSmrg lt_dlsym_const= ;; 244088de56ccSmrg *) 244188de56ccSmrg lt_dlsym_const=const ;; 244288de56ccSmrg esac 24431ab64890Smrg 244488de56ccSmrg $ECHO >> "$output_objdir/$my_dlsyms" "\ 244588de56ccSmrgextern $lt_dlsym_const lt_dlsymlist 244688de56ccSmrglt_${my_prefix}_LTX_preloaded_symbols[]; 244788de56ccSmrg$lt_dlsym_const lt_dlsymlist 244888de56ccSmrglt_${my_prefix}_LTX_preloaded_symbols[] = 244988de56ccSmrg{\ 245088de56ccSmrg { \"$my_originator\", (void *) 0 }," 24511ab64890Smrg 245288de56ccSmrg case $need_lib_prefix in 245388de56ccSmrg no) 245488de56ccSmrg eval "$global_symbol_to_c_name_address" < "$nlist" >> "$output_objdir/$my_dlsyms" 245588de56ccSmrg ;; 245688de56ccSmrg *) 245788de56ccSmrg eval "$global_symbol_to_c_name_address_lib_prefix" < "$nlist" >> "$output_objdir/$my_dlsyms" 245888de56ccSmrg ;; 245988de56ccSmrg esac 246088de56ccSmrg $ECHO >> "$output_objdir/$my_dlsyms" "\ 246188de56ccSmrg {0, (void *) 0} 246288de56ccSmrg}; 24631ab64890Smrg 246488de56ccSmrg/* This works around a problem in FreeBSD linker */ 246588de56ccSmrg#ifdef FREEBSD_WORKAROUND 246688de56ccSmrgstatic const void *lt_preloaded_setup() { 246788de56ccSmrg return lt_${my_prefix}_LTX_preloaded_symbols; 246888de56ccSmrg} 246988de56ccSmrg#endif 247088de56ccSmrg 247188de56ccSmrg#ifdef __cplusplus 247288de56ccSmrg} 247388de56ccSmrg#endif\ 247488de56ccSmrg" 247588de56ccSmrg } # !$opt_dry_run 247688de56ccSmrg 247788de56ccSmrg pic_flag_for_symtable= 247888de56ccSmrg case "$compile_command " in 247988de56ccSmrg *" -static "*) ;; 248088de56ccSmrg *) 248188de56ccSmrg case $host in 248288de56ccSmrg # compiling the symbol table file with pic_flag works around 248388de56ccSmrg # a FreeBSD bug that causes programs to crash when -lm is 248488de56ccSmrg # linked before any other PIC object. But we must not use 248588de56ccSmrg # pic_flag when linking with -static. The problem exists in 248688de56ccSmrg # FreeBSD 2.2.6 and is fixed in FreeBSD 3.1. 248788de56ccSmrg *-*-freebsd2*|*-*-freebsd3.0*|*-*-freebsdelf3.0*) 248888de56ccSmrg pic_flag_for_symtable=" $pic_flag -DFREEBSD_WORKAROUND" ;; 248988de56ccSmrg *-*-hpux*) 249088de56ccSmrg pic_flag_for_symtable=" $pic_flag" ;; 249188de56ccSmrg *) 249288de56ccSmrg if test "X$my_pic_p" != Xno; then 249388de56ccSmrg pic_flag_for_symtable=" $pic_flag" 2494b4ee4795Smrg fi 249588de56ccSmrg ;; 249688de56ccSmrg esac 249788de56ccSmrg ;; 249888de56ccSmrg esac 249988de56ccSmrg symtab_cflags= 250088de56ccSmrg for arg in $LTCFLAGS; do 250188de56ccSmrg case $arg in 250288de56ccSmrg -pie | -fpie | -fPIE) ;; 250388de56ccSmrg *) symtab_cflags="$symtab_cflags $arg" ;; 250488de56ccSmrg esac 250588de56ccSmrg done 25061ab64890Smrg 250788de56ccSmrg # Now compile the dynamic symbol file. 250888de56ccSmrg func_show_eval '(cd $output_objdir && $LTCC$symtab_cflags -c$no_builtin_flag$pic_flag_for_symtable "$my_dlsyms")' 'exit $?' 25092e9c7c8cSmrg 251088de56ccSmrg # Clean up the generated files. 251188de56ccSmrg func_show_eval '$RM "$output_objdir/$my_dlsyms" "$nlist" "${nlist}S" "${nlist}T"' 25121ab64890Smrg 251388de56ccSmrg # Transform the symbol file into the correct name. 251488de56ccSmrg symfileobj="$output_objdir/${my_outputname}S.$objext" 251588de56ccSmrg case $host in 251688de56ccSmrg *cygwin* | *mingw* | *cegcc* ) 251788de56ccSmrg if test -f "$output_objdir/$my_outputname.def"; then 251888de56ccSmrg compile_command=`$ECHO "X$compile_command" | $Xsed -e "s%@SYMFILE@%$output_objdir/$my_outputname.def $symfileobj%"` 251988de56ccSmrg finalize_command=`$ECHO "X$finalize_command" | $Xsed -e "s%@SYMFILE@%$output_objdir/$my_outputname.def $symfileobj%"` 252088de56ccSmrg else 252188de56ccSmrg compile_command=`$ECHO "X$compile_command" | $Xsed -e "s%@SYMFILE@%$symfileobj%"` 252288de56ccSmrg finalize_command=`$ECHO "X$finalize_command" | $Xsed -e "s%@SYMFILE@%$symfileobj%"` 2523b4ee4795Smrg fi 252488de56ccSmrg ;; 252588de56ccSmrg *) 252688de56ccSmrg compile_command=`$ECHO "X$compile_command" | $Xsed -e "s%@SYMFILE@%$symfileobj%"` 252788de56ccSmrg finalize_command=`$ECHO "X$finalize_command" | $Xsed -e "s%@SYMFILE@%$symfileobj%"` 252888de56ccSmrg ;; 252988de56ccSmrg esac 253088de56ccSmrg ;; 253188de56ccSmrg *) 253288de56ccSmrg func_fatal_error "unknown suffix for \`$my_dlsyms'" 253388de56ccSmrg ;; 253488de56ccSmrg esac 253588de56ccSmrg else 253688de56ccSmrg # We keep going just in case the user didn't refer to 253788de56ccSmrg # lt_preloaded_symbols. The linker will fail if global_symbol_pipe 253888de56ccSmrg # really was required. 25391ab64890Smrg 254088de56ccSmrg # Nullify the symbol file. 254188de56ccSmrg compile_command=`$ECHO "X$compile_command" | $Xsed -e "s% @SYMFILE@%%"` 254288de56ccSmrg finalize_command=`$ECHO "X$finalize_command" | $Xsed -e "s% @SYMFILE@%%"` 254388de56ccSmrg fi 254488de56ccSmrg} 25452e9c7c8cSmrg 254688de56ccSmrg# func_win32_libid arg 254788de56ccSmrg# return the library type of file 'arg' 254888de56ccSmrg# 254988de56ccSmrg# Need a lot of goo to handle *both* DLLs and import libs 255088de56ccSmrg# Has to be a shell function in order to 'eat' the argument 255188de56ccSmrg# that is supplied when $file_magic_command is called. 255288de56ccSmrgfunc_win32_libid () 255388de56ccSmrg{ 255488de56ccSmrg $opt_debug 255588de56ccSmrg win32_libid_type="unknown" 255688de56ccSmrg win32_fileres=`file -L $1 2>/dev/null` 255788de56ccSmrg case $win32_fileres in 255888de56ccSmrg *ar\ archive\ import\ library*) # definitely import 255988de56ccSmrg win32_libid_type="x86 archive import" 256088de56ccSmrg ;; 256188de56ccSmrg *ar\ archive*) # could be an import, or static 256288de56ccSmrg if eval $OBJDUMP -f $1 | $SED -e '10q' 2>/dev/null | 256388de56ccSmrg $EGREP 'file format pe-i386(.*architecture: i386)?' >/dev/null ; then 256488de56ccSmrg win32_nmres=`eval $NM -f posix -A $1 | 256588de56ccSmrg $SED -n -e ' 256688de56ccSmrg 1,100{ 256788de56ccSmrg / I /{ 256888de56ccSmrg s,.*,import, 256988de56ccSmrg p 257088de56ccSmrg q 257188de56ccSmrg } 257288de56ccSmrg }'` 257388de56ccSmrg case $win32_nmres in 257488de56ccSmrg import*) win32_libid_type="x86 archive import";; 257588de56ccSmrg *) win32_libid_type="x86 archive static";; 257688de56ccSmrg esac 257788de56ccSmrg fi 257888de56ccSmrg ;; 257988de56ccSmrg *DLL*) 258088de56ccSmrg win32_libid_type="x86 DLL" 258188de56ccSmrg ;; 258288de56ccSmrg *executable*) # but shell scripts are "executable" too... 258388de56ccSmrg case $win32_fileres in 258488de56ccSmrg *MS\ Windows\ PE\ Intel*) 258588de56ccSmrg win32_libid_type="x86 DLL" 258688de56ccSmrg ;; 258788de56ccSmrg esac 258888de56ccSmrg ;; 258988de56ccSmrg esac 259088de56ccSmrg $ECHO "$win32_libid_type" 259188de56ccSmrg} 25922e9c7c8cSmrg 25932e9c7c8cSmrg 25942e9c7c8cSmrg 259588de56ccSmrg# func_extract_an_archive dir oldlib 259688de56ccSmrgfunc_extract_an_archive () 259788de56ccSmrg{ 259888de56ccSmrg $opt_debug 259988de56ccSmrg f_ex_an_ar_dir="$1"; shift 260088de56ccSmrg f_ex_an_ar_oldlib="$1" 260188de56ccSmrg func_show_eval "(cd \$f_ex_an_ar_dir && $AR x \"\$f_ex_an_ar_oldlib\")" 'exit $?' 260288de56ccSmrg if ($AR t "$f_ex_an_ar_oldlib" | sort | sort -uc >/dev/null 2>&1); then 260388de56ccSmrg : 260488de56ccSmrg else 260588de56ccSmrg func_fatal_error "object name conflicts in archive: $f_ex_an_ar_dir/$f_ex_an_ar_oldlib" 260688de56ccSmrg fi 260788de56ccSmrg} 26081ab64890Smrg 26091ab64890Smrg 261088de56ccSmrg# func_extract_archives gentop oldlib ... 261188de56ccSmrgfunc_extract_archives () 261288de56ccSmrg{ 261388de56ccSmrg $opt_debug 261488de56ccSmrg my_gentop="$1"; shift 261588de56ccSmrg my_oldlibs=${1+"$@"} 261688de56ccSmrg my_oldobjs="" 261788de56ccSmrg my_xlib="" 261888de56ccSmrg my_xabs="" 261988de56ccSmrg my_xdir="" 26201ab64890Smrg 262188de56ccSmrg for my_xlib in $my_oldlibs; do 262288de56ccSmrg # Extract the objects. 262388de56ccSmrg case $my_xlib in 262488de56ccSmrg [\\/]* | [A-Za-z]:[\\/]*) my_xabs="$my_xlib" ;; 262588de56ccSmrg *) my_xabs=`pwd`"/$my_xlib" ;; 262688de56ccSmrg esac 262788de56ccSmrg func_basename "$my_xlib" 262888de56ccSmrg my_xlib="$func_basename_result" 262988de56ccSmrg my_xlib_u=$my_xlib 263088de56ccSmrg while :; do 263188de56ccSmrg case " $extracted_archives " in 263288de56ccSmrg *" $my_xlib_u "*) 263388de56ccSmrg func_arith $extracted_serial + 1 263488de56ccSmrg extracted_serial=$func_arith_result 263588de56ccSmrg my_xlib_u=lt$extracted_serial-$my_xlib ;; 263688de56ccSmrg *) break ;; 263788de56ccSmrg esac 263888de56ccSmrg done 263988de56ccSmrg extracted_archives="$extracted_archives $my_xlib_u" 264088de56ccSmrg my_xdir="$my_gentop/$my_xlib_u" 26411ab64890Smrg 264288de56ccSmrg func_mkdir_p "$my_xdir" 26432e9c7c8cSmrg 264488de56ccSmrg case $host in 264588de56ccSmrg *-darwin*) 264688de56ccSmrg func_verbose "Extracting $my_xabs" 264788de56ccSmrg # Do not bother doing anything if just a dry run 264888de56ccSmrg $opt_dry_run || { 264988de56ccSmrg darwin_orig_dir=`pwd` 265088de56ccSmrg cd $my_xdir || exit $? 265188de56ccSmrg darwin_archive=$my_xabs 265288de56ccSmrg darwin_curdir=`pwd` 265388de56ccSmrg darwin_base_archive=`basename "$darwin_archive"` 265488de56ccSmrg darwin_arches=`$LIPO -info "$darwin_archive" 2>/dev/null | $GREP Architectures 2>/dev/null || true` 265588de56ccSmrg if test -n "$darwin_arches"; then 265688de56ccSmrg darwin_arches=`$ECHO "$darwin_arches" | $SED -e 's/.*are://'` 265788de56ccSmrg darwin_arch= 265888de56ccSmrg func_verbose "$darwin_base_archive has multiple architectures $darwin_arches" 265988de56ccSmrg for darwin_arch in $darwin_arches ; do 266088de56ccSmrg func_mkdir_p "unfat-$$/${darwin_base_archive}-${darwin_arch}" 266188de56ccSmrg $LIPO -thin $darwin_arch -output "unfat-$$/${darwin_base_archive}-${darwin_arch}/${darwin_base_archive}" "${darwin_archive}" 266288de56ccSmrg cd "unfat-$$/${darwin_base_archive}-${darwin_arch}" 266388de56ccSmrg func_extract_an_archive "`pwd`" "${darwin_base_archive}" 266488de56ccSmrg cd "$darwin_curdir" 266588de56ccSmrg $RM "unfat-$$/${darwin_base_archive}-${darwin_arch}/${darwin_base_archive}" 266688de56ccSmrg done # $darwin_arches 266788de56ccSmrg ## Okay now we've a bunch of thin objects, gotta fatten them up :) 266888de56ccSmrg darwin_filelist=`find unfat-$$ -type f -name \*.o -print -o -name \*.lo -print | $SED -e "$basename" | sort -u` 266988de56ccSmrg darwin_file= 267088de56ccSmrg darwin_files= 267188de56ccSmrg for darwin_file in $darwin_filelist; do 267288de56ccSmrg darwin_files=`find unfat-$$ -name $darwin_file -print | $NL2SP` 267388de56ccSmrg $LIPO -create -output "$darwin_file" $darwin_files 267488de56ccSmrg done # $darwin_filelist 267588de56ccSmrg $RM -rf unfat-$$ 267688de56ccSmrg cd "$darwin_orig_dir" 2677b4ee4795Smrg else 267888de56ccSmrg cd $darwin_orig_dir 267988de56ccSmrg func_extract_an_archive "$my_xdir" "$my_xabs" 268088de56ccSmrg fi # $darwin_arches 268188de56ccSmrg } # !$opt_dry_run 268288de56ccSmrg ;; 268388de56ccSmrg *) 268488de56ccSmrg func_extract_an_archive "$my_xdir" "$my_xabs" 268588de56ccSmrg ;; 268688de56ccSmrg esac 268788de56ccSmrg my_oldobjs="$my_oldobjs "`find $my_xdir -name \*.$objext -print -o -name \*.lo -print | $NL2SP` 268888de56ccSmrg done 26891ab64890Smrg 269088de56ccSmrg func_extract_archives_result="$my_oldobjs" 269188de56ccSmrg} 26921ab64890Smrg 26931ab64890Smrg 26941ab64890Smrg 269588de56ccSmrg# func_emit_wrapper_part1 [arg=no] 269688de56ccSmrg# 269788de56ccSmrg# Emit the first part of a libtool wrapper script on stdout. 269888de56ccSmrg# For more information, see the description associated with 269988de56ccSmrg# func_emit_wrapper(), below. 270088de56ccSmrgfunc_emit_wrapper_part1 () 270188de56ccSmrg{ 270288de56ccSmrg func_emit_wrapper_part1_arg1=no 270388de56ccSmrg if test -n "$1" ; then 270488de56ccSmrg func_emit_wrapper_part1_arg1=$1 2705b4ee4795Smrg fi 2706b4ee4795Smrg 270788de56ccSmrg $ECHO "\ 270888de56ccSmrg#! $SHELL 27091ab64890Smrg 271088de56ccSmrg# $output - temporary wrapper script for $objdir/$outputname 271188de56ccSmrg# Generated by $PROGRAM (GNU $PACKAGE$TIMESTAMP) $VERSION 271288de56ccSmrg# 271388de56ccSmrg# The $output program cannot be directly executed until all the libtool 271488de56ccSmrg# libraries that it depends on are installed. 271588de56ccSmrg# 271688de56ccSmrg# This wrapper script should never be moved out of the build directory. 271788de56ccSmrg# If it is, it will not operate correctly. 27181ab64890Smrg 271988de56ccSmrg# Sed substitution that helps us do robust quoting. It backslashifies 272088de56ccSmrg# metacharacters that are still active within double-quoted strings. 272188de56ccSmrgXsed='${SED} -e 1s/^X//' 272288de56ccSmrgsed_quote_subst='$sed_quote_subst' 27231ab64890Smrg 272488de56ccSmrg# Be Bourne compatible 272588de56ccSmrgif test -n \"\${ZSH_VERSION+set}\" && (emulate sh) >/dev/null 2>&1; then 272688de56ccSmrg emulate sh 272788de56ccSmrg NULLCMD=: 272888de56ccSmrg # Zsh 3.x and 4.x performs word splitting on \${1+\"\$@\"}, which 272988de56ccSmrg # is contrary to our usage. Disable this feature. 273088de56ccSmrg alias -g '\${1+\"\$@\"}'='\"\$@\"' 273188de56ccSmrg setopt NO_GLOB_SUBST 273288de56ccSmrgelse 273388de56ccSmrg case \`(set -o) 2>/dev/null\` in *posix*) set -o posix;; esac 273488de56ccSmrgfi 273588de56ccSmrgBIN_SH=xpg4; export BIN_SH # for Tru64 273688de56ccSmrgDUALCASE=1; export DUALCASE # for MKS sh 27371ab64890Smrg 273888de56ccSmrg# The HP-UX ksh and POSIX shell print the target directory to stdout 273988de56ccSmrg# if CDPATH is set. 274088de56ccSmrg(unset CDPATH) >/dev/null 2>&1 && unset CDPATH 27411ab64890Smrg 274288de56ccSmrgrelink_command=\"$relink_command\" 27431ab64890Smrg 274488de56ccSmrg# This environment variable determines our operation mode. 274588de56ccSmrgif test \"\$libtool_install_magic\" = \"$magic\"; then 274688de56ccSmrg # install mode needs the following variables: 274788de56ccSmrg generated_by_libtool_version='$macro_version' 274888de56ccSmrg notinst_deplibs='$notinst_deplibs' 274988de56ccSmrgelse 275088de56ccSmrg # When we are sourced in execute mode, \$file and \$ECHO are already set. 275188de56ccSmrg if test \"\$libtool_execute_magic\" != \"$magic\"; then 275288de56ccSmrg ECHO=\"$qecho\" 275388de56ccSmrg file=\"\$0\" 275488de56ccSmrg # Make sure echo works. 275588de56ccSmrg if test \"X\$1\" = X--no-reexec; then 275688de56ccSmrg # Discard the --no-reexec flag, and continue. 275788de56ccSmrg shift 275888de56ccSmrg elif test \"X\`{ \$ECHO '\t'; } 2>/dev/null\`\" = 'X\t'; then 275988de56ccSmrg # Yippee, \$ECHO works! 276088de56ccSmrg : 276188de56ccSmrg else 276288de56ccSmrg # Restart under the correct shell, and then maybe \$ECHO will work. 276388de56ccSmrg exec $SHELL \"\$0\" --no-reexec \${1+\"\$@\"} 276488de56ccSmrg fi 276588de56ccSmrg fi\ 276688de56ccSmrg" 276788de56ccSmrg $ECHO "\ 27681ab64890Smrg 276988de56ccSmrg # Find the directory that this script lives in. 277088de56ccSmrg thisdir=\`\$ECHO \"X\$file\" | \$Xsed -e 's%/[^/]*$%%'\` 277188de56ccSmrg test \"x\$thisdir\" = \"x\$file\" && thisdir=. 27721ab64890Smrg 277388de56ccSmrg # Follow symbolic links until we get to the real thisdir. 277488de56ccSmrg file=\`ls -ld \"\$file\" | ${SED} -n 's/.*-> //p'\` 277588de56ccSmrg while test -n \"\$file\"; do 277688de56ccSmrg destdir=\`\$ECHO \"X\$file\" | \$Xsed -e 's%/[^/]*\$%%'\` 27771ab64890Smrg 277888de56ccSmrg # If there was a directory component, then change thisdir. 277988de56ccSmrg if test \"x\$destdir\" != \"x\$file\"; then 278088de56ccSmrg case \"\$destdir\" in 278188de56ccSmrg [\\\\/]* | [A-Za-z]:[\\\\/]*) thisdir=\"\$destdir\" ;; 278288de56ccSmrg *) thisdir=\"\$thisdir/\$destdir\" ;; 2783b4ee4795Smrg esac 278488de56ccSmrg fi 27851ab64890Smrg 278688de56ccSmrg file=\`\$ECHO \"X\$file\" | \$Xsed -e 's%^.*/%%'\` 278788de56ccSmrg file=\`ls -ld \"\$thisdir/\$file\" | ${SED} -n 's/.*-> //p'\` 278888de56ccSmrg done 278988de56ccSmrg" 279088de56ccSmrg} 279188de56ccSmrg# end: func_emit_wrapper_part1 279288de56ccSmrg 279388de56ccSmrg# func_emit_wrapper_part2 [arg=no] 279488de56ccSmrg# 279588de56ccSmrg# Emit the second part of a libtool wrapper script on stdout. 279688de56ccSmrg# For more information, see the description associated with 279788de56ccSmrg# func_emit_wrapper(), below. 279888de56ccSmrgfunc_emit_wrapper_part2 () 279988de56ccSmrg{ 280088de56ccSmrg func_emit_wrapper_part2_arg1=no 280188de56ccSmrg if test -n "$1" ; then 280288de56ccSmrg func_emit_wrapper_part2_arg1=$1 2803b4ee4795Smrg fi 28041ab64890Smrg 280588de56ccSmrg $ECHO "\ 28061ab64890Smrg 280788de56ccSmrg # Usually 'no', except on cygwin/mingw when embedded into 280888de56ccSmrg # the cwrapper. 280988de56ccSmrg WRAPPER_SCRIPT_BELONGS_IN_OBJDIR=$func_emit_wrapper_part2_arg1 281088de56ccSmrg if test \"\$WRAPPER_SCRIPT_BELONGS_IN_OBJDIR\" = \"yes\"; then 281188de56ccSmrg # special case for '.' 281288de56ccSmrg if test \"\$thisdir\" = \".\"; then 281388de56ccSmrg thisdir=\`pwd\` 281488de56ccSmrg fi 281588de56ccSmrg # remove .libs from thisdir 281688de56ccSmrg case \"\$thisdir\" in 281788de56ccSmrg *[\\\\/]$objdir ) thisdir=\`\$ECHO \"X\$thisdir\" | \$Xsed -e 's%[\\\\/][^\\\\/]*$%%'\` ;; 281888de56ccSmrg $objdir ) thisdir=. ;; 281988de56ccSmrg esac 282088de56ccSmrg fi 282188de56ccSmrg 282288de56ccSmrg # Try to get the absolute directory name. 282388de56ccSmrg absdir=\`cd \"\$thisdir\" && pwd\` 282488de56ccSmrg test -n \"\$absdir\" && thisdir=\"\$absdir\" 282588de56ccSmrg" 282688de56ccSmrg 282788de56ccSmrg if test "$fast_install" = yes; then 282888de56ccSmrg $ECHO "\ 282988de56ccSmrg program=lt-'$outputname'$exeext 283088de56ccSmrg progdir=\"\$thisdir/$objdir\" 283188de56ccSmrg 283288de56ccSmrg if test ! -f \"\$progdir/\$program\" || 283388de56ccSmrg { file=\`ls -1dt \"\$progdir/\$program\" \"\$progdir/../\$program\" 2>/dev/null | ${SED} 1q\`; \\ 283488de56ccSmrg test \"X\$file\" != \"X\$progdir/\$program\"; }; then 283588de56ccSmrg 283688de56ccSmrg file=\"\$\$-\$program\" 283788de56ccSmrg 283888de56ccSmrg if test ! -d \"\$progdir\"; then 283988de56ccSmrg $MKDIR \"\$progdir\" 284088de56ccSmrg else 284188de56ccSmrg $RM \"\$progdir/\$file\" 284288de56ccSmrg fi" 284388de56ccSmrg 284488de56ccSmrg $ECHO "\ 284588de56ccSmrg 284688de56ccSmrg # relink executable if necessary 284788de56ccSmrg if test -n \"\$relink_command\"; then 284888de56ccSmrg if relink_command_output=\`eval \$relink_command 2>&1\`; then : 284988de56ccSmrg else 285088de56ccSmrg $ECHO \"\$relink_command_output\" >&2 285188de56ccSmrg $RM \"\$progdir/\$file\" 285288de56ccSmrg exit 1 2853b4ee4795Smrg fi 285488de56ccSmrg fi 28551ab64890Smrg 285688de56ccSmrg $MV \"\$progdir/\$file\" \"\$progdir/\$program\" 2>/dev/null || 285788de56ccSmrg { $RM \"\$progdir/\$program\"; 285888de56ccSmrg $MV \"\$progdir/\$file\" \"\$progdir/\$program\"; } 285988de56ccSmrg $RM \"\$progdir/\$file\" 286088de56ccSmrg fi" 286188de56ccSmrg else 286288de56ccSmrg $ECHO "\ 286388de56ccSmrg program='$outputname' 286488de56ccSmrg progdir=\"\$thisdir/$objdir\" 286588de56ccSmrg" 2866b4ee4795Smrg fi 28671ab64890Smrg 286888de56ccSmrg $ECHO "\ 28691ab64890Smrg 287088de56ccSmrg if test -f \"\$progdir/\$program\"; then" 28711ab64890Smrg 287288de56ccSmrg # Export our shlibpath_var if we have one. 287388de56ccSmrg if test "$shlibpath_overrides_runpath" = yes && test -n "$shlibpath_var" && test -n "$temp_rpath"; then 287488de56ccSmrg $ECHO "\ 287588de56ccSmrg # Add our own library path to $shlibpath_var 287688de56ccSmrg $shlibpath_var=\"$temp_rpath\$$shlibpath_var\" 287788de56ccSmrg 287888de56ccSmrg # Some systems cannot cope with colon-terminated $shlibpath_var 287988de56ccSmrg # The second colon is a workaround for a bug in BeOS R4 sed 288088de56ccSmrg $shlibpath_var=\`\$ECHO \"X\$$shlibpath_var\" | \$Xsed -e 's/::*\$//'\` 28811ab64890Smrg 288288de56ccSmrg export $shlibpath_var 288388de56ccSmrg" 2884b4ee4795Smrg fi 28851ab64890Smrg 288688de56ccSmrg # fixup the dll searchpath if we need to. 288788de56ccSmrg if test -n "$dllsearchpath"; then 288888de56ccSmrg $ECHO "\ 288988de56ccSmrg # Add the dll search path components to the executable PATH 289088de56ccSmrg PATH=$dllsearchpath:\$PATH 289188de56ccSmrg" 289288de56ccSmrg fi 28931ab64890Smrg 289488de56ccSmrg $ECHO "\ 289588de56ccSmrg if test \"\$libtool_execute_magic\" != \"$magic\"; then 289688de56ccSmrg # Run the actual program with our arguments. 289788de56ccSmrg" 289888de56ccSmrg case $host in 289988de56ccSmrg # Backslashes separate directories on plain windows 290088de56ccSmrg *-*-mingw | *-*-os2* | *-cegcc*) 290188de56ccSmrg $ECHO "\ 290288de56ccSmrg exec \"\$progdir\\\\\$program\" \${1+\"\$@\"} 290388de56ccSmrg" 2904b4ee4795Smrg ;; 29051ab64890Smrg 2906b4ee4795Smrg *) 290788de56ccSmrg $ECHO "\ 290888de56ccSmrg exec \"\$progdir/\$program\" \${1+\"\$@\"} 290988de56ccSmrg" 2910b4ee4795Smrg ;; 2911b4ee4795Smrg esac 291288de56ccSmrg $ECHO "\ 291388de56ccSmrg \$ECHO \"\$0: cannot exec \$program \$*\" 1>&2 291488de56ccSmrg exit 1 291588de56ccSmrg fi 291688de56ccSmrg else 291788de56ccSmrg # The program doesn't exist. 291888de56ccSmrg \$ECHO \"\$0: error: \\\`\$progdir/\$program' does not exist\" 1>&2 291988de56ccSmrg \$ECHO \"This script is just a wrapper for \$program.\" 1>&2 292088de56ccSmrg $ECHO \"See the $PACKAGE documentation for more information.\" 1>&2 292188de56ccSmrg exit 1 292288de56ccSmrg fi 292388de56ccSmrgfi\ 292488de56ccSmrg" 292588de56ccSmrg} 292688de56ccSmrg# end: func_emit_wrapper_part2 29271ab64890Smrg 29281ab64890Smrg 292988de56ccSmrg# func_emit_wrapper [arg=no] 293088de56ccSmrg# 293188de56ccSmrg# Emit a libtool wrapper script on stdout. 293288de56ccSmrg# Don't directly open a file because we may want to 293388de56ccSmrg# incorporate the script contents within a cygwin/mingw 293488de56ccSmrg# wrapper executable. Must ONLY be called from within 293588de56ccSmrg# func_mode_link because it depends on a number of variables 293688de56ccSmrg# set therein. 293788de56ccSmrg# 293888de56ccSmrg# ARG is the value that the WRAPPER_SCRIPT_BELONGS_IN_OBJDIR 293988de56ccSmrg# variable will take. If 'yes', then the emitted script 294088de56ccSmrg# will assume that the directory in which it is stored is 294188de56ccSmrg# the $objdir directory. This is a cygwin/mingw-specific 294288de56ccSmrg# behavior. 294388de56ccSmrgfunc_emit_wrapper () 294488de56ccSmrg{ 294588de56ccSmrg func_emit_wrapper_arg1=no 294688de56ccSmrg if test -n "$1" ; then 294788de56ccSmrg func_emit_wrapper_arg1=$1 2948b4ee4795Smrg fi 29491ab64890Smrg 295088de56ccSmrg # split this up so that func_emit_cwrapperexe_src 295188de56ccSmrg # can call each part independently. 295288de56ccSmrg func_emit_wrapper_part1 "${func_emit_wrapper_arg1}" 295388de56ccSmrg func_emit_wrapper_part2 "${func_emit_wrapper_arg1}" 295488de56ccSmrg} 29551ab64890Smrg 29561ab64890Smrg 295788de56ccSmrg# func_to_host_path arg 295888de56ccSmrg# 295988de56ccSmrg# Convert paths to host format when used with build tools. 296088de56ccSmrg# Intended for use with "native" mingw (where libtool itself 296188de56ccSmrg# is running under the msys shell), or in the following cross- 296288de56ccSmrg# build environments: 296388de56ccSmrg# $build $host 296488de56ccSmrg# mingw (msys) mingw [e.g. native] 296588de56ccSmrg# cygwin mingw 296688de56ccSmrg# *nix + wine mingw 296788de56ccSmrg# where wine is equipped with the `winepath' executable. 296888de56ccSmrg# In the native mingw case, the (msys) shell automatically 296988de56ccSmrg# converts paths for any non-msys applications it launches, 297088de56ccSmrg# but that facility isn't available from inside the cwrapper. 297188de56ccSmrg# Similar accommodations are necessary for $host mingw and 297288de56ccSmrg# $build cygwin. Calling this function does no harm for other 297388de56ccSmrg# $host/$build combinations not listed above. 297488de56ccSmrg# 297588de56ccSmrg# ARG is the path (on $build) that should be converted to 297688de56ccSmrg# the proper representation for $host. The result is stored 297788de56ccSmrg# in $func_to_host_path_result. 297888de56ccSmrgfunc_to_host_path () 297988de56ccSmrg{ 298088de56ccSmrg func_to_host_path_result="$1" 298188de56ccSmrg if test -n "$1" ; then 298288de56ccSmrg case $host in 298388de56ccSmrg *mingw* ) 298488de56ccSmrg lt_sed_naive_backslashify='s|\\\\*|\\|g;s|/|\\|g;s|\\|\\\\|g' 298588de56ccSmrg case $build in 298688de56ccSmrg *mingw* ) # actually, msys 298788de56ccSmrg # awkward: cmd appends spaces to result 298888de56ccSmrg lt_sed_strip_trailing_spaces="s/[ ]*\$//" 298988de56ccSmrg func_to_host_path_tmp1=`( cmd //c echo "$1" |\ 299088de56ccSmrg $SED -e "$lt_sed_strip_trailing_spaces" ) 2>/dev/null || echo ""` 299188de56ccSmrg func_to_host_path_result=`echo "$func_to_host_path_tmp1" |\ 299288de56ccSmrg $SED -e "$lt_sed_naive_backslashify"` 299388de56ccSmrg ;; 299488de56ccSmrg *cygwin* ) 299588de56ccSmrg func_to_host_path_tmp1=`cygpath -w "$1"` 299688de56ccSmrg func_to_host_path_result=`echo "$func_to_host_path_tmp1" |\ 299788de56ccSmrg $SED -e "$lt_sed_naive_backslashify"` 299888de56ccSmrg ;; 299988de56ccSmrg * ) 300088de56ccSmrg # Unfortunately, winepath does not exit with a non-zero 300188de56ccSmrg # error code, so we are forced to check the contents of 300288de56ccSmrg # stdout. On the other hand, if the command is not 300388de56ccSmrg # found, the shell will set an exit code of 127 and print 300488de56ccSmrg # *an error message* to stdout. So we must check for both 300588de56ccSmrg # error code of zero AND non-empty stdout, which explains 300688de56ccSmrg # the odd construction: 300788de56ccSmrg func_to_host_path_tmp1=`winepath -w "$1" 2>/dev/null` 300888de56ccSmrg if test "$?" -eq 0 && test -n "${func_to_host_path_tmp1}"; then 300988de56ccSmrg func_to_host_path_result=`echo "$func_to_host_path_tmp1" |\ 301088de56ccSmrg $SED -e "$lt_sed_naive_backslashify"` 301188de56ccSmrg else 301288de56ccSmrg # Allow warning below. 301388de56ccSmrg func_to_host_path_result="" 301488de56ccSmrg fi 301588de56ccSmrg ;; 301688de56ccSmrg esac 301788de56ccSmrg if test -z "$func_to_host_path_result" ; then 301888de56ccSmrg func_error "Could not determine host path corresponding to" 301988de56ccSmrg func_error " '$1'" 302088de56ccSmrg func_error "Continuing, but uninstalled executables may not work." 302188de56ccSmrg # Fallback: 302288de56ccSmrg func_to_host_path_result="$1" 302388de56ccSmrg fi 302488de56ccSmrg ;; 302588de56ccSmrg esac 302688de56ccSmrg fi 302788de56ccSmrg} 302888de56ccSmrg# end: func_to_host_path 30291ab64890Smrg 303088de56ccSmrg# func_to_host_pathlist arg 303188de56ccSmrg# 303288de56ccSmrg# Convert pathlists to host format when used with build tools. 303388de56ccSmrg# See func_to_host_path(), above. This function supports the 303488de56ccSmrg# following $build/$host combinations (but does no harm for 303588de56ccSmrg# combinations not listed here): 303688de56ccSmrg# $build $host 303788de56ccSmrg# mingw (msys) mingw [e.g. native] 303888de56ccSmrg# cygwin mingw 303988de56ccSmrg# *nix + wine mingw 304088de56ccSmrg# 304188de56ccSmrg# Path separators are also converted from $build format to 304288de56ccSmrg# $host format. If ARG begins or ends with a path separator 304388de56ccSmrg# character, it is preserved (but converted to $host format) 304488de56ccSmrg# on output. 304588de56ccSmrg# 304688de56ccSmrg# ARG is a pathlist (on $build) that should be converted to 304788de56ccSmrg# the proper representation on $host. The result is stored 304888de56ccSmrg# in $func_to_host_pathlist_result. 304988de56ccSmrgfunc_to_host_pathlist () 305088de56ccSmrg{ 305188de56ccSmrg func_to_host_pathlist_result="$1" 305288de56ccSmrg if test -n "$1" ; then 305388de56ccSmrg case $host in 305488de56ccSmrg *mingw* ) 305588de56ccSmrg lt_sed_naive_backslashify='s|\\\\*|\\|g;s|/|\\|g;s|\\|\\\\|g' 305688de56ccSmrg # Remove leading and trailing path separator characters from 305788de56ccSmrg # ARG. msys behavior is inconsistent here, cygpath turns them 305888de56ccSmrg # into '.;' and ';.', and winepath ignores them completely. 305988de56ccSmrg func_to_host_pathlist_tmp2="$1" 306088de56ccSmrg # Once set for this call, this variable should not be 306188de56ccSmrg # reassigned. It is used in tha fallback case. 306288de56ccSmrg func_to_host_pathlist_tmp1=`echo "$func_to_host_pathlist_tmp2" |\ 306388de56ccSmrg $SED -e 's|^:*||' -e 's|:*$||'` 306488de56ccSmrg case $build in 306588de56ccSmrg *mingw* ) # Actually, msys. 306688de56ccSmrg # Awkward: cmd appends spaces to result. 306788de56ccSmrg lt_sed_strip_trailing_spaces="s/[ ]*\$//" 306888de56ccSmrg func_to_host_pathlist_tmp2=`( cmd //c echo "$func_to_host_pathlist_tmp1" |\ 306988de56ccSmrg $SED -e "$lt_sed_strip_trailing_spaces" ) 2>/dev/null || echo ""` 307088de56ccSmrg func_to_host_pathlist_result=`echo "$func_to_host_pathlist_tmp2" |\ 307188de56ccSmrg $SED -e "$lt_sed_naive_backslashify"` 307288de56ccSmrg ;; 307388de56ccSmrg *cygwin* ) 307488de56ccSmrg func_to_host_pathlist_tmp2=`cygpath -w -p "$func_to_host_pathlist_tmp1"` 307588de56ccSmrg func_to_host_pathlist_result=`echo "$func_to_host_pathlist_tmp2" |\ 307688de56ccSmrg $SED -e "$lt_sed_naive_backslashify"` 307788de56ccSmrg ;; 307888de56ccSmrg * ) 307988de56ccSmrg # unfortunately, winepath doesn't convert pathlists 308088de56ccSmrg func_to_host_pathlist_result="" 308188de56ccSmrg func_to_host_pathlist_oldIFS=$IFS 308288de56ccSmrg IFS=: 308388de56ccSmrg for func_to_host_pathlist_f in $func_to_host_pathlist_tmp1 ; do 308488de56ccSmrg IFS=$func_to_host_pathlist_oldIFS 308588de56ccSmrg if test -n "$func_to_host_pathlist_f" ; then 308688de56ccSmrg func_to_host_path "$func_to_host_pathlist_f" 308788de56ccSmrg if test -n "$func_to_host_path_result" ; then 308888de56ccSmrg if test -z "$func_to_host_pathlist_result" ; then 308988de56ccSmrg func_to_host_pathlist_result="$func_to_host_path_result" 309088de56ccSmrg else 309188de56ccSmrg func_to_host_pathlist_result="$func_to_host_pathlist_result;$func_to_host_path_result" 309288de56ccSmrg fi 309388de56ccSmrg fi 309488de56ccSmrg fi 309588de56ccSmrg IFS=: 309688de56ccSmrg done 309788de56ccSmrg IFS=$func_to_host_pathlist_oldIFS 309888de56ccSmrg ;; 309988de56ccSmrg esac 310088de56ccSmrg if test -z "$func_to_host_pathlist_result" ; then 310188de56ccSmrg func_error "Could not determine the host path(s) corresponding to" 310288de56ccSmrg func_error " '$1'" 310388de56ccSmrg func_error "Continuing, but uninstalled executables may not work." 310488de56ccSmrg # Fallback. This may break if $1 contains DOS-style drive 310588de56ccSmrg # specifications. The fix is not to complicate the expression 310688de56ccSmrg # below, but for the user to provide a working wine installation 310788de56ccSmrg # with winepath so that path translation in the cross-to-mingw 310888de56ccSmrg # case works properly. 310988de56ccSmrg lt_replace_pathsep_nix_to_dos="s|:|;|g" 311088de56ccSmrg func_to_host_pathlist_result=`echo "$func_to_host_pathlist_tmp1" |\ 311188de56ccSmrg $SED -e "$lt_replace_pathsep_nix_to_dos"` 311288de56ccSmrg fi 311388de56ccSmrg # Now, add the leading and trailing path separators back 311488de56ccSmrg case "$1" in 311588de56ccSmrg :* ) func_to_host_pathlist_result=";$func_to_host_pathlist_result" 311688de56ccSmrg ;; 311788de56ccSmrg esac 311888de56ccSmrg case "$1" in 311988de56ccSmrg *: ) func_to_host_pathlist_result="$func_to_host_pathlist_result;" 312088de56ccSmrg ;; 312188de56ccSmrg esac 312288de56ccSmrg ;; 312388de56ccSmrg esac 312488de56ccSmrg fi 312588de56ccSmrg} 312688de56ccSmrg# end: func_to_host_pathlist 31272e9c7c8cSmrg 312888de56ccSmrg# func_emit_cwrapperexe_src 312988de56ccSmrg# emit the source code for a wrapper executable on stdout 313088de56ccSmrg# Must ONLY be called from within func_mode_link because 313188de56ccSmrg# it depends on a number of variable set therein. 313288de56ccSmrgfunc_emit_cwrapperexe_src () 313388de56ccSmrg{ 313488de56ccSmrg cat <<EOF 31351ab64890Smrg 313688de56ccSmrg/* $cwrappersource - temporary wrapper executable for $objdir/$outputname 313788de56ccSmrg Generated by $PROGRAM (GNU $PACKAGE$TIMESTAMP) $VERSION 31381ab64890Smrg 313988de56ccSmrg The $output program cannot be directly executed until all the libtool 314088de56ccSmrg libraries that it depends on are installed. 31411ab64890Smrg 314288de56ccSmrg This wrapper executable should never be moved out of the build directory. 314388de56ccSmrg If it is, it will not operate correctly. 31441ab64890Smrg 314588de56ccSmrg Currently, it simply execs the wrapper *script* "$SHELL $output", 314688de56ccSmrg but could eventually absorb all of the scripts functionality and 314788de56ccSmrg exec $objdir/$outputname directly. 314888de56ccSmrg*/ 314988de56ccSmrgEOF 315088de56ccSmrg cat <<"EOF" 315188de56ccSmrg#include <stdio.h> 315288de56ccSmrg#include <stdlib.h> 315388de56ccSmrg#ifdef _MSC_VER 315488de56ccSmrg# include <direct.h> 315588de56ccSmrg# include <process.h> 315688de56ccSmrg# include <io.h> 315788de56ccSmrg# define setmode _setmode 315888de56ccSmrg#else 315988de56ccSmrg# include <unistd.h> 316088de56ccSmrg# include <stdint.h> 316188de56ccSmrg# ifdef __CYGWIN__ 316288de56ccSmrg# include <io.h> 316388de56ccSmrg# define HAVE_SETENV 316488de56ccSmrg# ifdef __STRICT_ANSI__ 316588de56ccSmrgchar *realpath (const char *, char *); 316688de56ccSmrgint putenv (char *); 316788de56ccSmrgint setenv (const char *, const char *, int); 316888de56ccSmrg# endif 316988de56ccSmrg# endif 317088de56ccSmrg#endif 317188de56ccSmrg#include <malloc.h> 317288de56ccSmrg#include <stdarg.h> 317388de56ccSmrg#include <assert.h> 317488de56ccSmrg#include <string.h> 317588de56ccSmrg#include <ctype.h> 317688de56ccSmrg#include <errno.h> 317788de56ccSmrg#include <fcntl.h> 317888de56ccSmrg#include <sys/stat.h> 31791ab64890Smrg 318088de56ccSmrg#if defined(PATH_MAX) 318188de56ccSmrg# define LT_PATHMAX PATH_MAX 318288de56ccSmrg#elif defined(MAXPATHLEN) 318388de56ccSmrg# define LT_PATHMAX MAXPATHLEN 318488de56ccSmrg#else 318588de56ccSmrg# define LT_PATHMAX 1024 318688de56ccSmrg#endif 31871ab64890Smrg 318888de56ccSmrg#ifndef S_IXOTH 318988de56ccSmrg# define S_IXOTH 0 319088de56ccSmrg#endif 319188de56ccSmrg#ifndef S_IXGRP 319288de56ccSmrg# define S_IXGRP 0 319388de56ccSmrg#endif 31941ab64890Smrg 319588de56ccSmrg#ifdef _MSC_VER 319688de56ccSmrg# define S_IXUSR _S_IEXEC 319788de56ccSmrg# define stat _stat 319888de56ccSmrg# ifndef _INTPTR_T_DEFINED 319988de56ccSmrg# define intptr_t int 320088de56ccSmrg# endif 320188de56ccSmrg#endif 32021ab64890Smrg 320388de56ccSmrg#ifndef DIR_SEPARATOR 320488de56ccSmrg# define DIR_SEPARATOR '/' 320588de56ccSmrg# define PATH_SEPARATOR ':' 320688de56ccSmrg#endif 32071ab64890Smrg 320888de56ccSmrg#if defined (_WIN32) || defined (__MSDOS__) || defined (__DJGPP__) || \ 320988de56ccSmrg defined (__OS2__) 321088de56ccSmrg# define HAVE_DOS_BASED_FILE_SYSTEM 321188de56ccSmrg# define FOPEN_WB "wb" 321288de56ccSmrg# ifndef DIR_SEPARATOR_2 321388de56ccSmrg# define DIR_SEPARATOR_2 '\\' 321488de56ccSmrg# endif 321588de56ccSmrg# ifndef PATH_SEPARATOR_2 321688de56ccSmrg# define PATH_SEPARATOR_2 ';' 321788de56ccSmrg# endif 321888de56ccSmrg#endif 32191ab64890Smrg 322088de56ccSmrg#ifndef DIR_SEPARATOR_2 322188de56ccSmrg# define IS_DIR_SEPARATOR(ch) ((ch) == DIR_SEPARATOR) 322288de56ccSmrg#else /* DIR_SEPARATOR_2 */ 322388de56ccSmrg# define IS_DIR_SEPARATOR(ch) \ 322488de56ccSmrg (((ch) == DIR_SEPARATOR) || ((ch) == DIR_SEPARATOR_2)) 322588de56ccSmrg#endif /* DIR_SEPARATOR_2 */ 32261ab64890Smrg 322788de56ccSmrg#ifndef PATH_SEPARATOR_2 322888de56ccSmrg# define IS_PATH_SEPARATOR(ch) ((ch) == PATH_SEPARATOR) 322988de56ccSmrg#else /* PATH_SEPARATOR_2 */ 323088de56ccSmrg# define IS_PATH_SEPARATOR(ch) ((ch) == PATH_SEPARATOR_2) 323188de56ccSmrg#endif /* PATH_SEPARATOR_2 */ 32321ab64890Smrg 323388de56ccSmrg#ifdef __CYGWIN__ 323488de56ccSmrg# define FOPEN_WB "wb" 323588de56ccSmrg#endif 32361ab64890Smrg 323788de56ccSmrg#ifndef FOPEN_WB 323888de56ccSmrg# define FOPEN_WB "w" 323988de56ccSmrg#endif 324088de56ccSmrg#ifndef _O_BINARY 324188de56ccSmrg# define _O_BINARY 0 324288de56ccSmrg#endif 32431ab64890Smrg 324488de56ccSmrg#define XMALLOC(type, num) ((type *) xmalloc ((num) * sizeof(type))) 324588de56ccSmrg#define XFREE(stale) do { \ 324688de56ccSmrg if (stale) { free ((void *) stale); stale = 0; } \ 324788de56ccSmrg} while (0) 32481ab64890Smrg 324988de56ccSmrg#undef LTWRAPPER_DEBUGPRINTF 325088de56ccSmrg#if defined DEBUGWRAPPER 325188de56ccSmrg# define LTWRAPPER_DEBUGPRINTF(args) ltwrapper_debugprintf args 325288de56ccSmrgstatic void 325388de56ccSmrgltwrapper_debugprintf (const char *fmt, ...) 325488de56ccSmrg{ 325588de56ccSmrg va_list args; 325688de56ccSmrg va_start (args, fmt); 325788de56ccSmrg (void) vfprintf (stderr, fmt, args); 325888de56ccSmrg va_end (args); 325988de56ccSmrg} 326088de56ccSmrg#else 326188de56ccSmrg# define LTWRAPPER_DEBUGPRINTF(args) 326288de56ccSmrg#endif 32631ab64890Smrg 326488de56ccSmrgconst char *program_name = NULL; 32651ab64890Smrg 326688de56ccSmrgvoid *xmalloc (size_t num); 326788de56ccSmrgchar *xstrdup (const char *string); 326888de56ccSmrgconst char *base_name (const char *name); 326988de56ccSmrgchar *find_executable (const char *wrapper); 327088de56ccSmrgchar *chase_symlinks (const char *pathspec); 327188de56ccSmrgint make_executable (const char *path); 327288de56ccSmrgint check_executable (const char *path); 327388de56ccSmrgchar *strendzap (char *str, const char *pat); 327488de56ccSmrgvoid lt_fatal (const char *message, ...); 327588de56ccSmrgvoid lt_setenv (const char *name, const char *value); 327688de56ccSmrgchar *lt_extend_str (const char *orig_value, const char *add, int to_end); 327788de56ccSmrgvoid lt_opt_process_env_set (const char *arg); 327888de56ccSmrgvoid lt_opt_process_env_prepend (const char *arg); 327988de56ccSmrgvoid lt_opt_process_env_append (const char *arg); 328088de56ccSmrgint lt_split_name_value (const char *arg, char** name, char** value); 328188de56ccSmrgvoid lt_update_exe_path (const char *name, const char *value); 328288de56ccSmrgvoid lt_update_lib_path (const char *name, const char *value); 328388de56ccSmrg 328488de56ccSmrgstatic const char *script_text_part1 = 328588de56ccSmrgEOF 32861ab64890Smrg 328788de56ccSmrg func_emit_wrapper_part1 yes | 328888de56ccSmrg $SED -e 's/\([\\"]\)/\\\1/g' \ 328988de56ccSmrg -e 's/^/ "/' -e 's/$/\\n"/' 329088de56ccSmrg echo ";" 329188de56ccSmrg cat <<EOF 32921ab64890Smrg 329388de56ccSmrgstatic const char *script_text_part2 = 329488de56ccSmrgEOF 329588de56ccSmrg func_emit_wrapper_part2 yes | 329688de56ccSmrg $SED -e 's/\([\\"]\)/\\\1/g' \ 329788de56ccSmrg -e 's/^/ "/' -e 's/$/\\n"/' 329888de56ccSmrg echo ";" 329988de56ccSmrg 330088de56ccSmrg cat <<EOF 330188de56ccSmrgconst char * MAGIC_EXE = "$magic_exe"; 330288de56ccSmrgconst char * LIB_PATH_VARNAME = "$shlibpath_var"; 330388de56ccSmrgEOF 33041ab64890Smrg 330588de56ccSmrg if test "$shlibpath_overrides_runpath" = yes && test -n "$shlibpath_var" && test -n "$temp_rpath"; then 330688de56ccSmrg func_to_host_pathlist "$temp_rpath" 330788de56ccSmrg cat <<EOF 330888de56ccSmrgconst char * LIB_PATH_VALUE = "$func_to_host_pathlist_result"; 330988de56ccSmrgEOF 331088de56ccSmrg else 331188de56ccSmrg cat <<"EOF" 331288de56ccSmrgconst char * LIB_PATH_VALUE = ""; 331388de56ccSmrgEOF 3314b4ee4795Smrg fi 33151ab64890Smrg 331688de56ccSmrg if test -n "$dllsearchpath"; then 331788de56ccSmrg func_to_host_pathlist "$dllsearchpath:" 331888de56ccSmrg cat <<EOF 331988de56ccSmrgconst char * EXE_PATH_VARNAME = "PATH"; 332088de56ccSmrgconst char * EXE_PATH_VALUE = "$func_to_host_pathlist_result"; 3321b4ee4795SmrgEOF 3322b4ee4795Smrg else 332388de56ccSmrg cat <<"EOF" 332488de56ccSmrgconst char * EXE_PATH_VARNAME = ""; 332588de56ccSmrgconst char * EXE_PATH_VALUE = ""; 332688de56ccSmrgEOF 3327b4ee4795Smrg fi 332888de56ccSmrg 332988de56ccSmrg if test "$fast_install" = yes; then 333088de56ccSmrg cat <<EOF 333188de56ccSmrgconst char * TARGET_PROGRAM_NAME = "lt-$outputname"; /* hopefully, no .exe */ 333288de56ccSmrgEOF 3333b4ee4795Smrg else 333488de56ccSmrg cat <<EOF 333588de56ccSmrgconst char * TARGET_PROGRAM_NAME = "$outputname"; /* hopefully, no .exe */ 333688de56ccSmrgEOF 3337b4ee4795Smrg fi 33381ab64890Smrg 33391ab64890Smrg 334088de56ccSmrg cat <<"EOF" 33411ab64890Smrg 334288de56ccSmrg#define LTWRAPPER_OPTION_PREFIX "--lt-" 334388de56ccSmrg#define LTWRAPPER_OPTION_PREFIX_LENGTH 5 33441ab64890Smrg 334588de56ccSmrgstatic const size_t opt_prefix_len = LTWRAPPER_OPTION_PREFIX_LENGTH; 334688de56ccSmrgstatic const char *ltwrapper_option_prefix = LTWRAPPER_OPTION_PREFIX; 33471ab64890Smrg 334888de56ccSmrgstatic const char *dumpscript_opt = LTWRAPPER_OPTION_PREFIX "dump-script"; 33491ab64890Smrg 335088de56ccSmrgstatic const size_t env_set_opt_len = LTWRAPPER_OPTION_PREFIX_LENGTH + 7; 335188de56ccSmrgstatic const char *env_set_opt = LTWRAPPER_OPTION_PREFIX "env-set"; 335288de56ccSmrg /* argument is putenv-style "foo=bar", value of foo is set to bar */ 33531ab64890Smrg 335488de56ccSmrgstatic const size_t env_prepend_opt_len = LTWRAPPER_OPTION_PREFIX_LENGTH + 11; 335588de56ccSmrgstatic const char *env_prepend_opt = LTWRAPPER_OPTION_PREFIX "env-prepend"; 335688de56ccSmrg /* argument is putenv-style "foo=bar", new value of foo is bar${foo} */ 33571ab64890Smrg 335888de56ccSmrgstatic const size_t env_append_opt_len = LTWRAPPER_OPTION_PREFIX_LENGTH + 10; 335988de56ccSmrgstatic const char *env_append_opt = LTWRAPPER_OPTION_PREFIX "env-append"; 336088de56ccSmrg /* argument is putenv-style "foo=bar", new value of foo is ${foo}bar */ 33611ab64890Smrg 336288de56ccSmrgint 336388de56ccSmrgmain (int argc, char *argv[]) 336488de56ccSmrg{ 336588de56ccSmrg char **newargz; 336688de56ccSmrg int newargc; 336788de56ccSmrg char *tmp_pathspec; 336888de56ccSmrg char *actual_cwrapper_path; 336988de56ccSmrg char *actual_cwrapper_name; 337088de56ccSmrg char *target_name; 337188de56ccSmrg char *lt_argv_zero; 337288de56ccSmrg intptr_t rval = 127; 33731ab64890Smrg 337488de56ccSmrg int i; 33751ab64890Smrg 337688de56ccSmrg program_name = (char *) xstrdup (base_name (argv[0])); 337788de56ccSmrg LTWRAPPER_DEBUGPRINTF (("(main) argv[0] : %s\n", argv[0])); 337888de56ccSmrg LTWRAPPER_DEBUGPRINTF (("(main) program_name : %s\n", program_name)); 33791ab64890Smrg 338088de56ccSmrg /* very simple arg parsing; don't want to rely on getopt */ 338188de56ccSmrg for (i = 1; i < argc; i++) 338288de56ccSmrg { 338388de56ccSmrg if (strcmp (argv[i], dumpscript_opt) == 0) 338488de56ccSmrg { 338588de56ccSmrgEOF 338688de56ccSmrg case "$host" in 338788de56ccSmrg *mingw* | *cygwin* ) 338888de56ccSmrg # make stdout use "unix" line endings 338988de56ccSmrg echo " setmode(1,_O_BINARY);" 339088de56ccSmrg ;; 339188de56ccSmrg esac 33921ab64890Smrg 339388de56ccSmrg cat <<"EOF" 339488de56ccSmrg printf ("%s", script_text_part1); 339588de56ccSmrg printf ("%s", script_text_part2); 339688de56ccSmrg return 0; 339788de56ccSmrg } 339888de56ccSmrg } 33991ab64890Smrg 340088de56ccSmrg newargz = XMALLOC (char *, argc + 1); 340188de56ccSmrg tmp_pathspec = find_executable (argv[0]); 340288de56ccSmrg if (tmp_pathspec == NULL) 340388de56ccSmrg lt_fatal ("Couldn't find %s", argv[0]); 340488de56ccSmrg LTWRAPPER_DEBUGPRINTF (("(main) found exe (before symlink chase) at : %s\n", 340588de56ccSmrg tmp_pathspec)); 340688de56ccSmrg 340788de56ccSmrg actual_cwrapper_path = chase_symlinks (tmp_pathspec); 340888de56ccSmrg LTWRAPPER_DEBUGPRINTF (("(main) found exe (after symlink chase) at : %s\n", 340988de56ccSmrg actual_cwrapper_path)); 341088de56ccSmrg XFREE (tmp_pathspec); 341188de56ccSmrg 341288de56ccSmrg actual_cwrapper_name = xstrdup( base_name (actual_cwrapper_path)); 341388de56ccSmrg strendzap (actual_cwrapper_path, actual_cwrapper_name); 341488de56ccSmrg 341588de56ccSmrg /* wrapper name transforms */ 341688de56ccSmrg strendzap (actual_cwrapper_name, ".exe"); 341788de56ccSmrg tmp_pathspec = lt_extend_str (actual_cwrapper_name, ".exe", 1); 341888de56ccSmrg XFREE (actual_cwrapper_name); 341988de56ccSmrg actual_cwrapper_name = tmp_pathspec; 342088de56ccSmrg tmp_pathspec = 0; 342188de56ccSmrg 342288de56ccSmrg /* target_name transforms -- use actual target program name; might have lt- prefix */ 342388de56ccSmrg target_name = xstrdup (base_name (TARGET_PROGRAM_NAME)); 342488de56ccSmrg strendzap (target_name, ".exe"); 342588de56ccSmrg tmp_pathspec = lt_extend_str (target_name, ".exe", 1); 342688de56ccSmrg XFREE (target_name); 342788de56ccSmrg target_name = tmp_pathspec; 342888de56ccSmrg tmp_pathspec = 0; 342988de56ccSmrg 343088de56ccSmrg LTWRAPPER_DEBUGPRINTF (("(main) libtool target name: %s\n", 343188de56ccSmrg target_name)); 343288de56ccSmrgEOF 34331ab64890Smrg 343488de56ccSmrg cat <<EOF 343588de56ccSmrg newargz[0] = 343688de56ccSmrg XMALLOC (char, (strlen (actual_cwrapper_path) + 343788de56ccSmrg strlen ("$objdir") + 1 + strlen (actual_cwrapper_name) + 1)); 343888de56ccSmrg strcpy (newargz[0], actual_cwrapper_path); 343988de56ccSmrg strcat (newargz[0], "$objdir"); 344088de56ccSmrg strcat (newargz[0], "/"); 344188de56ccSmrgEOF 34421ab64890Smrg 344388de56ccSmrg cat <<"EOF" 344488de56ccSmrg /* stop here, and copy so we don't have to do this twice */ 344588de56ccSmrg tmp_pathspec = xstrdup (newargz[0]); 34461ab64890Smrg 344788de56ccSmrg /* do NOT want the lt- prefix here, so use actual_cwrapper_name */ 344888de56ccSmrg strcat (newargz[0], actual_cwrapper_name); 34491ab64890Smrg 345088de56ccSmrg /* DO want the lt- prefix here if it exists, so use target_name */ 345188de56ccSmrg lt_argv_zero = lt_extend_str (tmp_pathspec, target_name, 1); 345288de56ccSmrg XFREE (tmp_pathspec); 345388de56ccSmrg tmp_pathspec = NULL; 345488de56ccSmrgEOF 34551ab64890Smrg 345688de56ccSmrg case $host_os in 345788de56ccSmrg mingw*) 345888de56ccSmrg cat <<"EOF" 345988de56ccSmrg { 346088de56ccSmrg char* p; 346188de56ccSmrg while ((p = strchr (newargz[0], '\\')) != NULL) 346288de56ccSmrg { 346388de56ccSmrg *p = '/'; 346488de56ccSmrg } 346588de56ccSmrg while ((p = strchr (lt_argv_zero, '\\')) != NULL) 346688de56ccSmrg { 346788de56ccSmrg *p = '/'; 346888de56ccSmrg } 346988de56ccSmrg } 347088de56ccSmrgEOF 347188de56ccSmrg ;; 347288de56ccSmrg esac 34731ab64890Smrg 347488de56ccSmrg cat <<"EOF" 347588de56ccSmrg XFREE (target_name); 347688de56ccSmrg XFREE (actual_cwrapper_path); 347788de56ccSmrg XFREE (actual_cwrapper_name); 34781ab64890Smrg 347988de56ccSmrg lt_setenv ("BIN_SH", "xpg4"); /* for Tru64 */ 348088de56ccSmrg lt_setenv ("DUALCASE", "1"); /* for MSK sh */ 348188de56ccSmrg lt_update_lib_path (LIB_PATH_VARNAME, LIB_PATH_VALUE); 348288de56ccSmrg lt_update_exe_path (EXE_PATH_VARNAME, EXE_PATH_VALUE); 34831ab64890Smrg 348488de56ccSmrg newargc=0; 348588de56ccSmrg for (i = 1; i < argc; i++) 348688de56ccSmrg { 348788de56ccSmrg if (strncmp (argv[i], env_set_opt, env_set_opt_len) == 0) 348888de56ccSmrg { 348988de56ccSmrg if (argv[i][env_set_opt_len] == '=') 349088de56ccSmrg { 349188de56ccSmrg const char *p = argv[i] + env_set_opt_len + 1; 349288de56ccSmrg lt_opt_process_env_set (p); 349388de56ccSmrg } 349488de56ccSmrg else if (argv[i][env_set_opt_len] == '\0' && i + 1 < argc) 349588de56ccSmrg { 349688de56ccSmrg lt_opt_process_env_set (argv[++i]); /* don't copy */ 349788de56ccSmrg } 349888de56ccSmrg else 349988de56ccSmrg lt_fatal ("%s missing required argument", env_set_opt); 350088de56ccSmrg continue; 350188de56ccSmrg } 350288de56ccSmrg if (strncmp (argv[i], env_prepend_opt, env_prepend_opt_len) == 0) 350388de56ccSmrg { 350488de56ccSmrg if (argv[i][env_prepend_opt_len] == '=') 350588de56ccSmrg { 350688de56ccSmrg const char *p = argv[i] + env_prepend_opt_len + 1; 350788de56ccSmrg lt_opt_process_env_prepend (p); 350888de56ccSmrg } 350988de56ccSmrg else if (argv[i][env_prepend_opt_len] == '\0' && i + 1 < argc) 351088de56ccSmrg { 351188de56ccSmrg lt_opt_process_env_prepend (argv[++i]); /* don't copy */ 351288de56ccSmrg } 351388de56ccSmrg else 351488de56ccSmrg lt_fatal ("%s missing required argument", env_prepend_opt); 351588de56ccSmrg continue; 351688de56ccSmrg } 351788de56ccSmrg if (strncmp (argv[i], env_append_opt, env_append_opt_len) == 0) 351888de56ccSmrg { 351988de56ccSmrg if (argv[i][env_append_opt_len] == '=') 352088de56ccSmrg { 352188de56ccSmrg const char *p = argv[i] + env_append_opt_len + 1; 352288de56ccSmrg lt_opt_process_env_append (p); 352388de56ccSmrg } 352488de56ccSmrg else if (argv[i][env_append_opt_len] == '\0' && i + 1 < argc) 352588de56ccSmrg { 352688de56ccSmrg lt_opt_process_env_append (argv[++i]); /* don't copy */ 352788de56ccSmrg } 352888de56ccSmrg else 352988de56ccSmrg lt_fatal ("%s missing required argument", env_append_opt); 353088de56ccSmrg continue; 353188de56ccSmrg } 353288de56ccSmrg if (strncmp (argv[i], ltwrapper_option_prefix, opt_prefix_len) == 0) 353388de56ccSmrg { 353488de56ccSmrg /* however, if there is an option in the LTWRAPPER_OPTION_PREFIX 353588de56ccSmrg namespace, but it is not one of the ones we know about and 353688de56ccSmrg have already dealt with, above (inluding dump-script), then 353788de56ccSmrg report an error. Otherwise, targets might begin to believe 353888de56ccSmrg they are allowed to use options in the LTWRAPPER_OPTION_PREFIX 353988de56ccSmrg namespace. The first time any user complains about this, we'll 354088de56ccSmrg need to make LTWRAPPER_OPTION_PREFIX a configure-time option 354188de56ccSmrg or a configure.ac-settable value. 354288de56ccSmrg */ 354388de56ccSmrg lt_fatal ("Unrecognized option in %s namespace: '%s'", 354488de56ccSmrg ltwrapper_option_prefix, argv[i]); 354588de56ccSmrg } 354688de56ccSmrg /* otherwise ... */ 354788de56ccSmrg newargz[++newargc] = xstrdup (argv[i]); 354888de56ccSmrg } 354988de56ccSmrg newargz[++newargc] = NULL; 35501ab64890Smrg 355188de56ccSmrg LTWRAPPER_DEBUGPRINTF (("(main) lt_argv_zero : %s\n", (lt_argv_zero ? lt_argv_zero : "<NULL>"))); 355288de56ccSmrg for (i = 0; i < newargc; i++) 355388de56ccSmrg { 355488de56ccSmrg LTWRAPPER_DEBUGPRINTF (("(main) newargz[%d] : %s\n", i, (newargz[i] ? newargz[i] : "<NULL>"))); 355588de56ccSmrg } 35561ab64890Smrg 355788de56ccSmrgEOF 35581ab64890Smrg 355988de56ccSmrg case $host_os in 356088de56ccSmrg mingw*) 356188de56ccSmrg cat <<"EOF" 356288de56ccSmrg /* execv doesn't actually work on mingw as expected on unix */ 356388de56ccSmrg rval = _spawnv (_P_WAIT, lt_argv_zero, (const char * const *) newargz); 356488de56ccSmrg if (rval == -1) 356588de56ccSmrg { 356688de56ccSmrg /* failed to start process */ 356788de56ccSmrg LTWRAPPER_DEBUGPRINTF (("(main) failed to launch target \"%s\": errno = %d\n", lt_argv_zero, errno)); 356888de56ccSmrg return 127; 356988de56ccSmrg } 357088de56ccSmrg return rval; 357188de56ccSmrgEOF 357288de56ccSmrg ;; 357388de56ccSmrg *) 357488de56ccSmrg cat <<"EOF" 357588de56ccSmrg execv (lt_argv_zero, newargz); 357688de56ccSmrg return rval; /* =127, but avoids unused variable warning */ 357788de56ccSmrgEOF 357888de56ccSmrg ;; 357988de56ccSmrg esac 35801ab64890Smrg 358188de56ccSmrg cat <<"EOF" 358288de56ccSmrg} 35831ab64890Smrg 358488de56ccSmrgvoid * 358588de56ccSmrgxmalloc (size_t num) 358688de56ccSmrg{ 358788de56ccSmrg void *p = (void *) malloc (num); 358888de56ccSmrg if (!p) 358988de56ccSmrg lt_fatal ("Memory exhausted"); 35901ab64890Smrg 359188de56ccSmrg return p; 359288de56ccSmrg} 35931ab64890Smrg 359488de56ccSmrgchar * 359588de56ccSmrgxstrdup (const char *string) 359688de56ccSmrg{ 359788de56ccSmrg return string ? strcpy ((char *) xmalloc (strlen (string) + 1), 359888de56ccSmrg string) : NULL; 359988de56ccSmrg} 36001ab64890Smrg 360188de56ccSmrgconst char * 360288de56ccSmrgbase_name (const char *name) 360388de56ccSmrg{ 360488de56ccSmrg const char *base; 3605b4ee4795Smrg 360688de56ccSmrg#if defined (HAVE_DOS_BASED_FILE_SYSTEM) 360788de56ccSmrg /* Skip over the disk name in MSDOS pathnames. */ 360888de56ccSmrg if (isalpha ((unsigned char) name[0]) && name[1] == ':') 360988de56ccSmrg name += 2; 361088de56ccSmrg#endif 3611b4ee4795Smrg 361288de56ccSmrg for (base = name; *name; name++) 361388de56ccSmrg if (IS_DIR_SEPARATOR (*name)) 361488de56ccSmrg base = name + 1; 361588de56ccSmrg return base; 361688de56ccSmrg} 3617b4ee4795Smrg 361888de56ccSmrgint 361988de56ccSmrgcheck_executable (const char *path) 362088de56ccSmrg{ 362188de56ccSmrg struct stat st; 3622b4ee4795Smrg 362388de56ccSmrg LTWRAPPER_DEBUGPRINTF (("(check_executable) : %s\n", 362488de56ccSmrg path ? (*path ? path : "EMPTY!") : "NULL!")); 362588de56ccSmrg if ((!path) || (!*path)) 362688de56ccSmrg return 0; 3627b4ee4795Smrg 362888de56ccSmrg if ((stat (path, &st) >= 0) 362988de56ccSmrg && (st.st_mode & (S_IXUSR | S_IXGRP | S_IXOTH))) 363088de56ccSmrg return 1; 363188de56ccSmrg else 363288de56ccSmrg return 0; 363388de56ccSmrg} 36341ab64890Smrg 363588de56ccSmrgint 363688de56ccSmrgmake_executable (const char *path) 363788de56ccSmrg{ 363888de56ccSmrg int rval = 0; 363988de56ccSmrg struct stat st; 36401ab64890Smrg 364188de56ccSmrg LTWRAPPER_DEBUGPRINTF (("(make_executable) : %s\n", 364288de56ccSmrg path ? (*path ? path : "EMPTY!") : "NULL!")); 364388de56ccSmrg if ((!path) || (!*path)) 364488de56ccSmrg return 0; 36451ab64890Smrg 364688de56ccSmrg if (stat (path, &st) >= 0) 364788de56ccSmrg { 364888de56ccSmrg rval = chmod (path, st.st_mode | S_IXOTH | S_IXGRP | S_IXUSR); 364988de56ccSmrg } 365088de56ccSmrg return rval; 365188de56ccSmrg} 3652b4ee4795Smrg 365388de56ccSmrg/* Searches for the full path of the wrapper. Returns 365488de56ccSmrg newly allocated full path name if found, NULL otherwise 365588de56ccSmrg Does not chase symlinks, even on platforms that support them. 365688de56ccSmrg*/ 365788de56ccSmrgchar * 365888de56ccSmrgfind_executable (const char *wrapper) 365988de56ccSmrg{ 366088de56ccSmrg int has_slash = 0; 366188de56ccSmrg const char *p; 366288de56ccSmrg const char *p_next; 366388de56ccSmrg /* static buffer for getcwd */ 366488de56ccSmrg char tmp[LT_PATHMAX + 1]; 366588de56ccSmrg int tmp_len; 366688de56ccSmrg char *concat_name; 3667b4ee4795Smrg 366888de56ccSmrg LTWRAPPER_DEBUGPRINTF (("(find_executable) : %s\n", 366988de56ccSmrg wrapper ? (*wrapper ? wrapper : "EMPTY!") : "NULL!")); 3670b4ee4795Smrg 367188de56ccSmrg if ((wrapper == NULL) || (*wrapper == '\0')) 367288de56ccSmrg return NULL; 3673b4ee4795Smrg 367488de56ccSmrg /* Absolute path? */ 367588de56ccSmrg#if defined (HAVE_DOS_BASED_FILE_SYSTEM) 367688de56ccSmrg if (isalpha ((unsigned char) wrapper[0]) && wrapper[1] == ':') 367788de56ccSmrg { 367888de56ccSmrg concat_name = xstrdup (wrapper); 367988de56ccSmrg if (check_executable (concat_name)) 368088de56ccSmrg return concat_name; 368188de56ccSmrg XFREE (concat_name); 368288de56ccSmrg } 368388de56ccSmrg else 368488de56ccSmrg { 368588de56ccSmrg#endif 368688de56ccSmrg if (IS_DIR_SEPARATOR (wrapper[0])) 368788de56ccSmrg { 368888de56ccSmrg concat_name = xstrdup (wrapper); 368988de56ccSmrg if (check_executable (concat_name)) 369088de56ccSmrg return concat_name; 369188de56ccSmrg XFREE (concat_name); 369288de56ccSmrg } 369388de56ccSmrg#if defined (HAVE_DOS_BASED_FILE_SYSTEM) 369488de56ccSmrg } 369588de56ccSmrg#endif 36961ab64890Smrg 369788de56ccSmrg for (p = wrapper; *p; p++) 369888de56ccSmrg if (*p == '/') 369988de56ccSmrg { 370088de56ccSmrg has_slash = 1; 370188de56ccSmrg break; 370288de56ccSmrg } 370388de56ccSmrg if (!has_slash) 370488de56ccSmrg { 370588de56ccSmrg /* no slashes; search PATH */ 370688de56ccSmrg const char *path = getenv ("PATH"); 370788de56ccSmrg if (path != NULL) 370888de56ccSmrg { 370988de56ccSmrg for (p = path; *p; p = p_next) 371088de56ccSmrg { 371188de56ccSmrg const char *q; 371288de56ccSmrg size_t p_len; 371388de56ccSmrg for (q = p; *q; q++) 371488de56ccSmrg if (IS_PATH_SEPARATOR (*q)) 371588de56ccSmrg break; 371688de56ccSmrg p_len = q - p; 371788de56ccSmrg p_next = (*q == '\0' ? q : q + 1); 371888de56ccSmrg if (p_len == 0) 371988de56ccSmrg { 372088de56ccSmrg /* empty path: current directory */ 372188de56ccSmrg if (getcwd (tmp, LT_PATHMAX) == NULL) 372288de56ccSmrg lt_fatal ("getcwd failed"); 372388de56ccSmrg tmp_len = strlen (tmp); 372488de56ccSmrg concat_name = 372588de56ccSmrg XMALLOC (char, tmp_len + 1 + strlen (wrapper) + 1); 372688de56ccSmrg memcpy (concat_name, tmp, tmp_len); 372788de56ccSmrg concat_name[tmp_len] = '/'; 372888de56ccSmrg strcpy (concat_name + tmp_len + 1, wrapper); 372988de56ccSmrg } 373088de56ccSmrg else 373188de56ccSmrg { 373288de56ccSmrg concat_name = 373388de56ccSmrg XMALLOC (char, p_len + 1 + strlen (wrapper) + 1); 373488de56ccSmrg memcpy (concat_name, p, p_len); 373588de56ccSmrg concat_name[p_len] = '/'; 373688de56ccSmrg strcpy (concat_name + p_len + 1, wrapper); 373788de56ccSmrg } 373888de56ccSmrg if (check_executable (concat_name)) 373988de56ccSmrg return concat_name; 374088de56ccSmrg XFREE (concat_name); 374188de56ccSmrg } 374288de56ccSmrg } 374388de56ccSmrg /* not found in PATH; assume curdir */ 374488de56ccSmrg } 374588de56ccSmrg /* Relative path | not found in path: prepend cwd */ 374688de56ccSmrg if (getcwd (tmp, LT_PATHMAX) == NULL) 374788de56ccSmrg lt_fatal ("getcwd failed"); 374888de56ccSmrg tmp_len = strlen (tmp); 374988de56ccSmrg concat_name = XMALLOC (char, tmp_len + 1 + strlen (wrapper) + 1); 375088de56ccSmrg memcpy (concat_name, tmp, tmp_len); 375188de56ccSmrg concat_name[tmp_len] = '/'; 375288de56ccSmrg strcpy (concat_name + tmp_len + 1, wrapper); 37531ab64890Smrg 375488de56ccSmrg if (check_executable (concat_name)) 375588de56ccSmrg return concat_name; 375688de56ccSmrg XFREE (concat_name); 375788de56ccSmrg return NULL; 375888de56ccSmrg} 37591ab64890Smrg 376088de56ccSmrgchar * 376188de56ccSmrgchase_symlinks (const char *pathspec) 376288de56ccSmrg{ 376388de56ccSmrg#ifndef S_ISLNK 376488de56ccSmrg return xstrdup (pathspec); 376588de56ccSmrg#else 376688de56ccSmrg char buf[LT_PATHMAX]; 376788de56ccSmrg struct stat s; 376888de56ccSmrg char *tmp_pathspec = xstrdup (pathspec); 376988de56ccSmrg char *p; 377088de56ccSmrg int has_symlinks = 0; 377188de56ccSmrg while (strlen (tmp_pathspec) && !has_symlinks) 377288de56ccSmrg { 377388de56ccSmrg LTWRAPPER_DEBUGPRINTF (("checking path component for symlinks: %s\n", 377488de56ccSmrg tmp_pathspec)); 377588de56ccSmrg if (lstat (tmp_pathspec, &s) == 0) 377688de56ccSmrg { 377788de56ccSmrg if (S_ISLNK (s.st_mode) != 0) 377888de56ccSmrg { 377988de56ccSmrg has_symlinks = 1; 378088de56ccSmrg break; 378188de56ccSmrg } 37821ab64890Smrg 378388de56ccSmrg /* search backwards for last DIR_SEPARATOR */ 378488de56ccSmrg p = tmp_pathspec + strlen (tmp_pathspec) - 1; 378588de56ccSmrg while ((p > tmp_pathspec) && (!IS_DIR_SEPARATOR (*p))) 378688de56ccSmrg p--; 378788de56ccSmrg if ((p == tmp_pathspec) && (!IS_DIR_SEPARATOR (*p))) 378888de56ccSmrg { 378988de56ccSmrg /* no more DIR_SEPARATORS left */ 379088de56ccSmrg break; 379188de56ccSmrg } 379288de56ccSmrg *p = '\0'; 379388de56ccSmrg } 379488de56ccSmrg else 379588de56ccSmrg { 379688de56ccSmrg char *errstr = strerror (errno); 379788de56ccSmrg lt_fatal ("Error accessing file %s (%s)", tmp_pathspec, errstr); 379888de56ccSmrg } 379988de56ccSmrg } 380088de56ccSmrg XFREE (tmp_pathspec); 38011ab64890Smrg 380288de56ccSmrg if (!has_symlinks) 380388de56ccSmrg { 380488de56ccSmrg return xstrdup (pathspec); 380588de56ccSmrg } 38061ab64890Smrg 380788de56ccSmrg tmp_pathspec = realpath (pathspec, buf); 380888de56ccSmrg if (tmp_pathspec == 0) 380988de56ccSmrg { 381088de56ccSmrg lt_fatal ("Could not follow symlinks for %s", pathspec); 381188de56ccSmrg } 381288de56ccSmrg return xstrdup (tmp_pathspec); 381388de56ccSmrg#endif 381488de56ccSmrg} 38151ab64890Smrg 381688de56ccSmrgchar * 381788de56ccSmrgstrendzap (char *str, const char *pat) 381888de56ccSmrg{ 381988de56ccSmrg size_t len, patlen; 38201ab64890Smrg 382188de56ccSmrg assert (str != NULL); 382288de56ccSmrg assert (pat != NULL); 38231ab64890Smrg 382488de56ccSmrg len = strlen (str); 382588de56ccSmrg patlen = strlen (pat); 38261ab64890Smrg 382788de56ccSmrg if (patlen <= len) 382888de56ccSmrg { 382988de56ccSmrg str += len - patlen; 383088de56ccSmrg if (strcmp (str, pat) == 0) 383188de56ccSmrg *str = '\0'; 383288de56ccSmrg } 383388de56ccSmrg return str; 383488de56ccSmrg} 38351ab64890Smrg 383688de56ccSmrgstatic void 383788de56ccSmrglt_error_core (int exit_status, const char *mode, 383888de56ccSmrg const char *message, va_list ap) 383988de56ccSmrg{ 384088de56ccSmrg fprintf (stderr, "%s: %s: ", program_name, mode); 384188de56ccSmrg vfprintf (stderr, message, ap); 384288de56ccSmrg fprintf (stderr, ".\n"); 38431ab64890Smrg 384488de56ccSmrg if (exit_status >= 0) 384588de56ccSmrg exit (exit_status); 384688de56ccSmrg} 38471ab64890Smrg 384888de56ccSmrgvoid 384988de56ccSmrglt_fatal (const char *message, ...) 385088de56ccSmrg{ 385188de56ccSmrg va_list ap; 385288de56ccSmrg va_start (ap, message); 385388de56ccSmrg lt_error_core (EXIT_FAILURE, "FATAL", message, ap); 385488de56ccSmrg va_end (ap); 385588de56ccSmrg} 38562e9c7c8cSmrg 385788de56ccSmrgvoid 385888de56ccSmrglt_setenv (const char *name, const char *value) 385988de56ccSmrg{ 386088de56ccSmrg LTWRAPPER_DEBUGPRINTF (("(lt_setenv) setting '%s' to '%s'\n", 386188de56ccSmrg (name ? name : "<NULL>"), 386288de56ccSmrg (value ? value : "<NULL>"))); 386388de56ccSmrg { 386488de56ccSmrg#ifdef HAVE_SETENV 386588de56ccSmrg /* always make a copy, for consistency with !HAVE_SETENV */ 386688de56ccSmrg char *str = xstrdup (value); 386788de56ccSmrg setenv (name, str, 1); 386888de56ccSmrg#else 386988de56ccSmrg int len = strlen (name) + 1 + strlen (value) + 1; 387088de56ccSmrg char *str = XMALLOC (char, len); 387188de56ccSmrg sprintf (str, "%s=%s", name, value); 387288de56ccSmrg if (putenv (str) != EXIT_SUCCESS) 387388de56ccSmrg { 387488de56ccSmrg XFREE (str); 387588de56ccSmrg } 387688de56ccSmrg#endif 387788de56ccSmrg } 387888de56ccSmrg} 38791ab64890Smrg 388088de56ccSmrgchar * 388188de56ccSmrglt_extend_str (const char *orig_value, const char *add, int to_end) 388288de56ccSmrg{ 388388de56ccSmrg char *new_value; 388488de56ccSmrg if (orig_value && *orig_value) 388588de56ccSmrg { 388688de56ccSmrg int orig_value_len = strlen (orig_value); 388788de56ccSmrg int add_len = strlen (add); 388888de56ccSmrg new_value = XMALLOC (char, add_len + orig_value_len + 1); 388988de56ccSmrg if (to_end) 389088de56ccSmrg { 389188de56ccSmrg strcpy (new_value, orig_value); 389288de56ccSmrg strcpy (new_value + orig_value_len, add); 389388de56ccSmrg } 389488de56ccSmrg else 389588de56ccSmrg { 389688de56ccSmrg strcpy (new_value, add); 389788de56ccSmrg strcpy (new_value + add_len, orig_value); 389888de56ccSmrg } 389988de56ccSmrg } 390088de56ccSmrg else 390188de56ccSmrg { 390288de56ccSmrg new_value = xstrdup (add); 390388de56ccSmrg } 390488de56ccSmrg return new_value; 390588de56ccSmrg} 39061ab64890Smrg 390788de56ccSmrgint 390888de56ccSmrglt_split_name_value (const char *arg, char** name, char** value) 390988de56ccSmrg{ 391088de56ccSmrg const char *p; 391188de56ccSmrg int len; 391288de56ccSmrg if (!arg || !*arg) 391388de56ccSmrg return 1; 39141ab64890Smrg 391588de56ccSmrg p = strchr (arg, (int)'='); 39161ab64890Smrg 391788de56ccSmrg if (!p) 391888de56ccSmrg return 1; 39191ab64890Smrg 392088de56ccSmrg *value = xstrdup (++p); 39211ab64890Smrg 392288de56ccSmrg len = strlen (arg) - strlen (*value); 392388de56ccSmrg *name = XMALLOC (char, len); 392488de56ccSmrg strncpy (*name, arg, len-1); 392588de56ccSmrg (*name)[len - 1] = '\0'; 39261ab64890Smrg 392788de56ccSmrg return 0; 392888de56ccSmrg} 39291ab64890Smrg 393088de56ccSmrgvoid 393188de56ccSmrglt_opt_process_env_set (const char *arg) 393288de56ccSmrg{ 393388de56ccSmrg char *name = NULL; 393488de56ccSmrg char *value = NULL; 39351ab64890Smrg 393688de56ccSmrg if (lt_split_name_value (arg, &name, &value) != 0) 393788de56ccSmrg { 393888de56ccSmrg XFREE (name); 393988de56ccSmrg XFREE (value); 394088de56ccSmrg lt_fatal ("bad argument for %s: '%s'", env_set_opt, arg); 394188de56ccSmrg } 39421ab64890Smrg 394388de56ccSmrg lt_setenv (name, value); 394488de56ccSmrg XFREE (name); 394588de56ccSmrg XFREE (value); 394688de56ccSmrg} 39471ab64890Smrg 394888de56ccSmrgvoid 394988de56ccSmrglt_opt_process_env_prepend (const char *arg) 395088de56ccSmrg{ 395188de56ccSmrg char *name = NULL; 395288de56ccSmrg char *value = NULL; 395388de56ccSmrg char *new_value = NULL; 39541ab64890Smrg 395588de56ccSmrg if (lt_split_name_value (arg, &name, &value) != 0) 395688de56ccSmrg { 395788de56ccSmrg XFREE (name); 395888de56ccSmrg XFREE (value); 395988de56ccSmrg lt_fatal ("bad argument for %s: '%s'", env_prepend_opt, arg); 396088de56ccSmrg } 39611ab64890Smrg 396288de56ccSmrg new_value = lt_extend_str (getenv (name), value, 0); 396388de56ccSmrg lt_setenv (name, new_value); 396488de56ccSmrg XFREE (new_value); 396588de56ccSmrg XFREE (name); 396688de56ccSmrg XFREE (value); 396788de56ccSmrg} 39681ab64890Smrg 396988de56ccSmrgvoid 397088de56ccSmrglt_opt_process_env_append (const char *arg) 397188de56ccSmrg{ 397288de56ccSmrg char *name = NULL; 397388de56ccSmrg char *value = NULL; 397488de56ccSmrg char *new_value = NULL; 39751ab64890Smrg 397688de56ccSmrg if (lt_split_name_value (arg, &name, &value) != 0) 397788de56ccSmrg { 397888de56ccSmrg XFREE (name); 397988de56ccSmrg XFREE (value); 398088de56ccSmrg lt_fatal ("bad argument for %s: '%s'", env_append_opt, arg); 398188de56ccSmrg } 39821ab64890Smrg 398388de56ccSmrg new_value = lt_extend_str (getenv (name), value, 1); 398488de56ccSmrg lt_setenv (name, new_value); 398588de56ccSmrg XFREE (new_value); 398688de56ccSmrg XFREE (name); 398788de56ccSmrg XFREE (value); 398888de56ccSmrg} 39891ab64890Smrg 399088de56ccSmrgvoid 399188de56ccSmrglt_update_exe_path (const char *name, const char *value) 399288de56ccSmrg{ 399388de56ccSmrg LTWRAPPER_DEBUGPRINTF (("(lt_update_exe_path) modifying '%s' by prepending '%s'\n", 399488de56ccSmrg (name ? name : "<NULL>"), 399588de56ccSmrg (value ? value : "<NULL>"))); 39961ab64890Smrg 399788de56ccSmrg if (name && *name && value && *value) 399888de56ccSmrg { 399988de56ccSmrg char *new_value = lt_extend_str (getenv (name), value, 0); 400088de56ccSmrg /* some systems can't cope with a ':'-terminated path #' */ 400188de56ccSmrg int len = strlen (new_value); 400288de56ccSmrg while (((len = strlen (new_value)) > 0) && IS_PATH_SEPARATOR (new_value[len-1])) 400388de56ccSmrg { 400488de56ccSmrg new_value[len-1] = '\0'; 400588de56ccSmrg } 400688de56ccSmrg lt_setenv (name, new_value); 400788de56ccSmrg XFREE (new_value); 400888de56ccSmrg } 400988de56ccSmrg} 40101ab64890Smrg 401188de56ccSmrgvoid 401288de56ccSmrglt_update_lib_path (const char *name, const char *value) 401388de56ccSmrg{ 401488de56ccSmrg LTWRAPPER_DEBUGPRINTF (("(lt_update_lib_path) modifying '%s' by prepending '%s'\n", 401588de56ccSmrg (name ? name : "<NULL>"), 401688de56ccSmrg (value ? value : "<NULL>"))); 40171ab64890Smrg 401888de56ccSmrg if (name && *name && value && *value) 401988de56ccSmrg { 402088de56ccSmrg char *new_value = lt_extend_str (getenv (name), value, 0); 402188de56ccSmrg lt_setenv (name, new_value); 402288de56ccSmrg XFREE (new_value); 402388de56ccSmrg } 402488de56ccSmrg} 40251ab64890Smrg 40261ab64890Smrg 402788de56ccSmrgEOF 402888de56ccSmrg} 402988de56ccSmrg# end: func_emit_cwrapperexe_src 40301ab64890Smrg 403188de56ccSmrg# func_mode_link arg... 403288de56ccSmrgfunc_mode_link () 403388de56ccSmrg{ 403488de56ccSmrg $opt_debug 403588de56ccSmrg case $host in 403688de56ccSmrg *-*-cygwin* | *-*-mingw* | *-*-pw32* | *-*-os2* | *-cegcc*) 403788de56ccSmrg # It is impossible to link a dll without this setting, and 403888de56ccSmrg # we shouldn't force the makefile maintainer to figure out 403988de56ccSmrg # which system we are compiling for in order to pass an extra 404088de56ccSmrg # flag for every libtool invocation. 404188de56ccSmrg # allow_undefined=no 40421ab64890Smrg 404388de56ccSmrg # FIXME: Unfortunately, there are problems with the above when trying 404488de56ccSmrg # to make a dll which has undefined symbols, in which case not 404588de56ccSmrg # even a static library is built. For now, we need to specify 404688de56ccSmrg # -no-undefined on the libtool link line when we can be certain 404788de56ccSmrg # that all symbols are satisfied, otherwise we get a static library. 404888de56ccSmrg allow_undefined=yes 404988de56ccSmrg ;; 405088de56ccSmrg *) 405188de56ccSmrg allow_undefined=yes 405288de56ccSmrg ;; 405388de56ccSmrg esac 405488de56ccSmrg libtool_args=$nonopt 405588de56ccSmrg base_compile="$nonopt $@" 405688de56ccSmrg compile_command=$nonopt 405788de56ccSmrg finalize_command=$nonopt 40581ab64890Smrg 405988de56ccSmrg compile_rpath= 406088de56ccSmrg finalize_rpath= 406188de56ccSmrg compile_shlibpath= 406288de56ccSmrg finalize_shlibpath= 406388de56ccSmrg convenience= 406488de56ccSmrg old_convenience= 406588de56ccSmrg deplibs= 406688de56ccSmrg old_deplibs= 406788de56ccSmrg compiler_flags= 406888de56ccSmrg linker_flags= 406988de56ccSmrg dllsearchpath= 407088de56ccSmrg lib_search_path=`pwd` 407188de56ccSmrg inst_prefix_dir= 407288de56ccSmrg new_inherited_linker_flags= 40731ab64890Smrg 407488de56ccSmrg avoid_version=no 407588de56ccSmrg dlfiles= 407688de56ccSmrg dlprefiles= 407788de56ccSmrg dlself=no 407888de56ccSmrg export_dynamic=no 407988de56ccSmrg export_symbols= 408088de56ccSmrg export_symbols_regex= 408188de56ccSmrg generated= 408288de56ccSmrg libobjs= 408388de56ccSmrg ltlibs= 408488de56ccSmrg module=no 408588de56ccSmrg no_install=no 408688de56ccSmrg objs= 408788de56ccSmrg non_pic_objects= 408888de56ccSmrg precious_files_regex= 408988de56ccSmrg prefer_static_libs=no 409088de56ccSmrg preload=no 409188de56ccSmrg prev= 409288de56ccSmrg prevarg= 409388de56ccSmrg release= 409488de56ccSmrg rpath= 409588de56ccSmrg xrpath= 409688de56ccSmrg perm_rpath= 409788de56ccSmrg temp_rpath= 409888de56ccSmrg thread_safe=no 409988de56ccSmrg vinfo= 410088de56ccSmrg vinfo_number=no 410188de56ccSmrg weak_libs= 410288de56ccSmrg single_module="${wl}-single_module" 410388de56ccSmrg func_infer_tag $base_compile 410488de56ccSmrg 410588de56ccSmrg # We need to know -static, to get the right output filenames. 410688de56ccSmrg for arg 410788de56ccSmrg do 410888de56ccSmrg case $arg in 410988de56ccSmrg -shared) 411088de56ccSmrg test "$build_libtool_libs" != yes && \ 411188de56ccSmrg func_fatal_configuration "can not build a shared library" 411288de56ccSmrg build_old_libs=no 411388de56ccSmrg break 411488de56ccSmrg ;; 411588de56ccSmrg -all-static | -static | -static-libtool-libs) 411688de56ccSmrg case $arg in 411788de56ccSmrg -all-static) 411888de56ccSmrg if test "$build_libtool_libs" = yes && test -z "$link_static_flag"; then 411988de56ccSmrg func_warning "complete static linking is impossible in this configuration" 412088de56ccSmrg fi 412188de56ccSmrg if test -n "$link_static_flag"; then 412288de56ccSmrg dlopen_self=$dlopen_self_static 412388de56ccSmrg fi 412488de56ccSmrg prefer_static_libs=yes 412588de56ccSmrg ;; 412688de56ccSmrg -static) 412788de56ccSmrg if test -z "$pic_flag" && test -n "$link_static_flag"; then 412888de56ccSmrg dlopen_self=$dlopen_self_static 412988de56ccSmrg fi 413088de56ccSmrg prefer_static_libs=built 413188de56ccSmrg ;; 413288de56ccSmrg -static-libtool-libs) 413388de56ccSmrg if test -z "$pic_flag" && test -n "$link_static_flag"; then 413488de56ccSmrg dlopen_self=$dlopen_self_static 4135b4ee4795Smrg fi 413688de56ccSmrg prefer_static_libs=yes 413788de56ccSmrg ;; 413888de56ccSmrg esac 413988de56ccSmrg build_libtool_libs=no 414088de56ccSmrg build_old_libs=yes 414188de56ccSmrg break 414288de56ccSmrg ;; 414388de56ccSmrg esac 414488de56ccSmrg done 41451ab64890Smrg 414688de56ccSmrg # See if our shared archives depend on static archives. 414788de56ccSmrg test -n "$old_archive_from_new_cmds" && build_old_libs=yes 41481ab64890Smrg 414988de56ccSmrg # Go through the arguments, transforming them on the way. 415088de56ccSmrg while test "$#" -gt 0; do 415188de56ccSmrg arg="$1" 415288de56ccSmrg shift 415388de56ccSmrg func_quote_for_eval "$arg" 415488de56ccSmrg qarg=$func_quote_for_eval_unquoted_result 415588de56ccSmrg func_append libtool_args " $func_quote_for_eval_result" 41561ab64890Smrg 415788de56ccSmrg # If the previous option needs an argument, assign it. 415888de56ccSmrg if test -n "$prev"; then 415988de56ccSmrg case $prev in 416088de56ccSmrg output) 416188de56ccSmrg func_append compile_command " @OUTPUT@" 416288de56ccSmrg func_append finalize_command " @OUTPUT@" 416388de56ccSmrg ;; 416488de56ccSmrg esac 41651ab64890Smrg 416688de56ccSmrg case $prev in 416788de56ccSmrg dlfiles|dlprefiles) 416888de56ccSmrg if test "$preload" = no; then 416988de56ccSmrg # Add the symbol object into the linking commands. 417088de56ccSmrg func_append compile_command " @SYMFILE@" 417188de56ccSmrg func_append finalize_command " @SYMFILE@" 417288de56ccSmrg preload=yes 417388de56ccSmrg fi 417488de56ccSmrg case $arg in 417588de56ccSmrg *.la | *.lo) ;; # We handle these cases below. 417688de56ccSmrg force) 417788de56ccSmrg if test "$dlself" = no; then 417888de56ccSmrg dlself=needless 417988de56ccSmrg export_dynamic=yes 418088de56ccSmrg fi 418188de56ccSmrg prev= 418288de56ccSmrg continue 418388de56ccSmrg ;; 418488de56ccSmrg self) 418588de56ccSmrg if test "$prev" = dlprefiles; then 418688de56ccSmrg dlself=yes 418788de56ccSmrg elif test "$prev" = dlfiles && test "$dlopen_self" != yes; then 418888de56ccSmrg dlself=yes 4189b4ee4795Smrg else 419088de56ccSmrg dlself=needless 419188de56ccSmrg export_dynamic=yes 4192b4ee4795Smrg fi 419388de56ccSmrg prev= 419488de56ccSmrg continue 419588de56ccSmrg ;; 419688de56ccSmrg *) 419788de56ccSmrg if test "$prev" = dlfiles; then 419888de56ccSmrg dlfiles="$dlfiles $arg" 4199b4ee4795Smrg else 420088de56ccSmrg dlprefiles="$dlprefiles $arg" 4201b4ee4795Smrg fi 420288de56ccSmrg prev= 420388de56ccSmrg continue 420488de56ccSmrg ;; 420588de56ccSmrg esac 420688de56ccSmrg ;; 420788de56ccSmrg expsyms) 420888de56ccSmrg export_symbols="$arg" 420988de56ccSmrg test -f "$arg" \ 421088de56ccSmrg || func_fatal_error "symbol file \`$arg' does not exist" 421188de56ccSmrg prev= 421288de56ccSmrg continue 421388de56ccSmrg ;; 421488de56ccSmrg expsyms_regex) 421588de56ccSmrg export_symbols_regex="$arg" 421688de56ccSmrg prev= 421788de56ccSmrg continue 421888de56ccSmrg ;; 421988de56ccSmrg framework) 4220b4ee4795Smrg case $host in 422188de56ccSmrg *-*-darwin*) 422288de56ccSmrg case "$deplibs " in 422388de56ccSmrg *" $qarg.ltframework "*) ;; 422488de56ccSmrg *) deplibs="$deplibs $qarg.ltframework" # this is fixed later 422588de56ccSmrg ;; 422688de56ccSmrg esac 422788de56ccSmrg ;; 4228b4ee4795Smrg esac 422988de56ccSmrg prev= 423088de56ccSmrg continue 4231b4ee4795Smrg ;; 423288de56ccSmrg inst_prefix) 423388de56ccSmrg inst_prefix_dir="$arg" 423488de56ccSmrg prev= 423588de56ccSmrg continue 4236b4ee4795Smrg ;; 423788de56ccSmrg objectlist) 423888de56ccSmrg if test -f "$arg"; then 423988de56ccSmrg save_arg=$arg 424088de56ccSmrg moreargs= 424188de56ccSmrg for fil in `cat "$save_arg"` 424288de56ccSmrg do 424388de56ccSmrg# moreargs="$moreargs $fil" 424488de56ccSmrg arg=$fil 424588de56ccSmrg # A libtool-controlled object. 42462e9c7c8cSmrg 424788de56ccSmrg # Check to see that this really is a libtool object. 424888de56ccSmrg if func_lalib_unsafe_p "$arg"; then 424988de56ccSmrg pic_object= 425088de56ccSmrg non_pic_object= 42512e9c7c8cSmrg 425288de56ccSmrg # Read the .lo file 425388de56ccSmrg func_source "$arg" 42542e9c7c8cSmrg 425588de56ccSmrg if test -z "$pic_object" || 425688de56ccSmrg test -z "$non_pic_object" || 425788de56ccSmrg test "$pic_object" = none && 425888de56ccSmrg test "$non_pic_object" = none; then 425988de56ccSmrg func_fatal_error "cannot find name of object for \`$arg'" 426088de56ccSmrg fi 42612e9c7c8cSmrg 426288de56ccSmrg # Extract subdirectory from the argument. 426388de56ccSmrg func_dirname "$arg" "/" "" 426488de56ccSmrg xdir="$func_dirname_result" 42652e9c7c8cSmrg 426688de56ccSmrg if test "$pic_object" != none; then 426788de56ccSmrg # Prepend the subdirectory the object is found in. 426888de56ccSmrg pic_object="$xdir$pic_object" 42692e9c7c8cSmrg 427088de56ccSmrg if test "$prev" = dlfiles; then 427188de56ccSmrg if test "$build_libtool_libs" = yes && test "$dlopen_support" = yes; then 427288de56ccSmrg dlfiles="$dlfiles $pic_object" 427388de56ccSmrg prev= 427488de56ccSmrg continue 427588de56ccSmrg else 427688de56ccSmrg # If libtool objects are unsupported, then we need to preload. 427788de56ccSmrg prev=dlprefiles 427888de56ccSmrg fi 427988de56ccSmrg fi 42802e9c7c8cSmrg 428188de56ccSmrg # CHECK ME: I think I busted this. -Ossama 428288de56ccSmrg if test "$prev" = dlprefiles; then 428388de56ccSmrg # Preload the old-style object. 428488de56ccSmrg dlprefiles="$dlprefiles $pic_object" 428588de56ccSmrg prev= 428688de56ccSmrg fi 42872e9c7c8cSmrg 428888de56ccSmrg # A PIC object. 428988de56ccSmrg func_append libobjs " $pic_object" 429088de56ccSmrg arg="$pic_object" 429188de56ccSmrg fi 42922e9c7c8cSmrg 429388de56ccSmrg # Non-PIC object. 429488de56ccSmrg if test "$non_pic_object" != none; then 429588de56ccSmrg # Prepend the subdirectory the object is found in. 429688de56ccSmrg non_pic_object="$xdir$non_pic_object" 42972e9c7c8cSmrg 429888de56ccSmrg # A standard non-PIC object 429988de56ccSmrg func_append non_pic_objects " $non_pic_object" 430088de56ccSmrg if test -z "$pic_object" || test "$pic_object" = none ; then 430188de56ccSmrg arg="$non_pic_object" 430288de56ccSmrg fi 430388de56ccSmrg else 430488de56ccSmrg # If the PIC object exists, use it instead. 430588de56ccSmrg # $xdir was prepended to $pic_object above. 430688de56ccSmrg non_pic_object="$pic_object" 430788de56ccSmrg func_append non_pic_objects " $non_pic_object" 430888de56ccSmrg fi 430988de56ccSmrg else 431088de56ccSmrg # Only an error if not doing a dry-run. 431188de56ccSmrg if $opt_dry_run; then 431288de56ccSmrg # Extract subdirectory from the argument. 431388de56ccSmrg func_dirname "$arg" "/" "" 431488de56ccSmrg xdir="$func_dirname_result" 431588de56ccSmrg 431688de56ccSmrg func_lo2o "$arg" 431788de56ccSmrg pic_object=$xdir$objdir/$func_lo2o_result 431888de56ccSmrg non_pic_object=$xdir$func_lo2o_result 431988de56ccSmrg func_append libobjs " $pic_object" 432088de56ccSmrg func_append non_pic_objects " $non_pic_object" 432188de56ccSmrg else 432288de56ccSmrg func_fatal_error "\`$arg' is not a valid libtool object" 432388de56ccSmrg fi 432488de56ccSmrg fi 432588de56ccSmrg done 4326b4ee4795Smrg else 432788de56ccSmrg func_fatal_error "link input file \`$arg' does not exist" 4328b4ee4795Smrg fi 432988de56ccSmrg arg=$save_arg 433088de56ccSmrg prev= 433188de56ccSmrg continue 433288de56ccSmrg ;; 433388de56ccSmrg precious_regex) 433488de56ccSmrg precious_files_regex="$arg" 433588de56ccSmrg prev= 433688de56ccSmrg continue 433788de56ccSmrg ;; 433888de56ccSmrg release) 433988de56ccSmrg release="-$arg" 434088de56ccSmrg prev= 434188de56ccSmrg continue 434288de56ccSmrg ;; 434388de56ccSmrg rpath | xrpath) 434488de56ccSmrg # We need an absolute path. 434588de56ccSmrg case $arg in 434688de56ccSmrg [\\/]* | [A-Za-z]:[\\/]*) ;; 434788de56ccSmrg *) 434888de56ccSmrg func_fatal_error "only absolute run-paths are allowed" 434988de56ccSmrg ;; 435088de56ccSmrg esac 435188de56ccSmrg if test "$prev" = rpath; then 435288de56ccSmrg case "$rpath " in 435388de56ccSmrg *" $arg "*) ;; 435488de56ccSmrg *) rpath="$rpath $arg" ;; 435588de56ccSmrg esac 4356b4ee4795Smrg else 435788de56ccSmrg case "$xrpath " in 435888de56ccSmrg *" $arg "*) ;; 435988de56ccSmrg *) xrpath="$xrpath $arg" ;; 436088de56ccSmrg esac 4361b4ee4795Smrg fi 436288de56ccSmrg prev= 436388de56ccSmrg continue 436488de56ccSmrg ;; 436588de56ccSmrg shrext) 436688de56ccSmrg shrext_cmds="$arg" 436788de56ccSmrg prev= 436888de56ccSmrg continue 436988de56ccSmrg ;; 437088de56ccSmrg weak) 437188de56ccSmrg weak_libs="$weak_libs $arg" 437288de56ccSmrg prev= 437388de56ccSmrg continue 437488de56ccSmrg ;; 437588de56ccSmrg xcclinker) 437688de56ccSmrg linker_flags="$linker_flags $qarg" 437788de56ccSmrg compiler_flags="$compiler_flags $qarg" 437888de56ccSmrg prev= 437988de56ccSmrg func_append compile_command " $qarg" 438088de56ccSmrg func_append finalize_command " $qarg" 438188de56ccSmrg continue 438288de56ccSmrg ;; 438388de56ccSmrg xcompiler) 438488de56ccSmrg compiler_flags="$compiler_flags $qarg" 438588de56ccSmrg prev= 438688de56ccSmrg func_append compile_command " $qarg" 438788de56ccSmrg func_append finalize_command " $qarg" 438888de56ccSmrg continue 438988de56ccSmrg ;; 439088de56ccSmrg xlinker) 439188de56ccSmrg linker_flags="$linker_flags $qarg" 439288de56ccSmrg compiler_flags="$compiler_flags $wl$qarg" 439388de56ccSmrg prev= 439488de56ccSmrg func_append compile_command " $wl$qarg" 439588de56ccSmrg func_append finalize_command " $wl$qarg" 439688de56ccSmrg continue 439788de56ccSmrg ;; 439888de56ccSmrg *) 439988de56ccSmrg eval "$prev=\"\$arg\"" 440088de56ccSmrg prev= 440188de56ccSmrg continue 440288de56ccSmrg ;; 44032e9c7c8cSmrg esac 440488de56ccSmrg fi # test -n "$prev" 44052e9c7c8cSmrg 440688de56ccSmrg prevarg="$arg" 44072e9c7c8cSmrg 440888de56ccSmrg case $arg in 440988de56ccSmrg -all-static) 441088de56ccSmrg if test -n "$link_static_flag"; then 441188de56ccSmrg # See comment for -static flag below, for more details. 441288de56ccSmrg func_append compile_command " $link_static_flag" 441388de56ccSmrg func_append finalize_command " $link_static_flag" 441488de56ccSmrg fi 441588de56ccSmrg continue 441688de56ccSmrg ;; 44172e9c7c8cSmrg 441888de56ccSmrg -allow-undefined) 441988de56ccSmrg # FIXME: remove this flag sometime in the future. 442088de56ccSmrg func_fatal_error "\`-allow-undefined' must not be used because it is the default" 442188de56ccSmrg ;; 44222e9c7c8cSmrg 442388de56ccSmrg -avoid-version) 442488de56ccSmrg avoid_version=yes 442588de56ccSmrg continue 442688de56ccSmrg ;; 44272e9c7c8cSmrg 442888de56ccSmrg -dlopen) 442988de56ccSmrg prev=dlfiles 443088de56ccSmrg continue 443188de56ccSmrg ;; 44322e9c7c8cSmrg 443388de56ccSmrg -dlpreopen) 443488de56ccSmrg prev=dlprefiles 443588de56ccSmrg continue 443688de56ccSmrg ;; 44372e9c7c8cSmrg 443888de56ccSmrg -export-dynamic) 443988de56ccSmrg export_dynamic=yes 444088de56ccSmrg continue 444188de56ccSmrg ;; 44422e9c7c8cSmrg 444388de56ccSmrg -export-symbols | -export-symbols-regex) 444488de56ccSmrg if test -n "$export_symbols" || test -n "$export_symbols_regex"; then 444588de56ccSmrg func_fatal_error "more than one -exported-symbols argument is not allowed" 444688de56ccSmrg fi 444788de56ccSmrg if test "X$arg" = "X-export-symbols"; then 444888de56ccSmrg prev=expsyms 444988de56ccSmrg else 445088de56ccSmrg prev=expsyms_regex 445188de56ccSmrg fi 445288de56ccSmrg continue 445388de56ccSmrg ;; 44542e9c7c8cSmrg 445588de56ccSmrg -framework) 445688de56ccSmrg prev=framework 445788de56ccSmrg continue 445888de56ccSmrg ;; 44592e9c7c8cSmrg 446088de56ccSmrg -inst-prefix-dir) 446188de56ccSmrg prev=inst_prefix 446288de56ccSmrg continue 446388de56ccSmrg ;; 44642e9c7c8cSmrg 446588de56ccSmrg # The native IRIX linker understands -LANG:*, -LIST:* and -LNO:* 446688de56ccSmrg # so, if we see these flags be careful not to treat them like -L 446788de56ccSmrg -L[A-Z][A-Z]*:*) 446888de56ccSmrg case $with_gcc/$host in 446988de56ccSmrg no/*-*-irix* | /*-*-irix*) 447088de56ccSmrg func_append compile_command " $arg" 447188de56ccSmrg func_append finalize_command " $arg" 447288de56ccSmrg ;; 447388de56ccSmrg esac 447488de56ccSmrg continue 447588de56ccSmrg ;; 44762e9c7c8cSmrg 447788de56ccSmrg -L*) 447888de56ccSmrg func_stripname '-L' '' "$arg" 447988de56ccSmrg dir=$func_stripname_result 448088de56ccSmrg if test -z "$dir"; then 448188de56ccSmrg if test "$#" -gt 0; then 448288de56ccSmrg func_fatal_error "require no space between \`-L' and \`$1'" 448388de56ccSmrg else 448488de56ccSmrg func_fatal_error "need path for \`-L' option" 448588de56ccSmrg fi 448688de56ccSmrg fi 448788de56ccSmrg # We need an absolute path. 448888de56ccSmrg case $dir in 448988de56ccSmrg [\\/]* | [A-Za-z]:[\\/]*) ;; 449088de56ccSmrg *) 449188de56ccSmrg absdir=`cd "$dir" && pwd` 449288de56ccSmrg test -z "$absdir" && \ 449388de56ccSmrg func_fatal_error "cannot determine absolute directory name of \`$dir'" 449488de56ccSmrg dir="$absdir" 449588de56ccSmrg ;; 449688de56ccSmrg esac 449788de56ccSmrg case "$deplibs " in 449888de56ccSmrg *" -L$dir "*) ;; 449988de56ccSmrg *) 450088de56ccSmrg deplibs="$deplibs -L$dir" 450188de56ccSmrg lib_search_path="$lib_search_path $dir" 450288de56ccSmrg ;; 450388de56ccSmrg esac 450488de56ccSmrg case $host in 450588de56ccSmrg *-*-cygwin* | *-*-mingw* | *-*-pw32* | *-*-os2* | *-cegcc*) 450688de56ccSmrg testbindir=`$ECHO "X$dir" | $Xsed -e 's*/lib$*/bin*'` 450788de56ccSmrg case :$dllsearchpath: in 450888de56ccSmrg *":$dir:"*) ;; 450988de56ccSmrg ::) dllsearchpath=$dir;; 451088de56ccSmrg *) dllsearchpath="$dllsearchpath:$dir";; 451188de56ccSmrg esac 451288de56ccSmrg case :$dllsearchpath: in 451388de56ccSmrg *":$testbindir:"*) ;; 451488de56ccSmrg ::) dllsearchpath=$testbindir;; 451588de56ccSmrg *) dllsearchpath="$dllsearchpath:$testbindir";; 451688de56ccSmrg esac 451788de56ccSmrg ;; 451888de56ccSmrg esac 451988de56ccSmrg continue 452088de56ccSmrg ;; 45212e9c7c8cSmrg 452288de56ccSmrg -l*) 452388de56ccSmrg if test "X$arg" = "X-lc" || test "X$arg" = "X-lm"; then 452488de56ccSmrg case $host in 452588de56ccSmrg *-*-cygwin* | *-*-mingw* | *-*-pw32* | *-*-beos* | *-cegcc*) 452688de56ccSmrg # These systems don't actually have a C or math library (as such) 452788de56ccSmrg continue 452888de56ccSmrg ;; 452988de56ccSmrg *-*-os2*) 453088de56ccSmrg # These systems don't actually have a C library (as such) 453188de56ccSmrg test "X$arg" = "X-lc" && continue 453288de56ccSmrg ;; 453388de56ccSmrg *-*-openbsd* | *-*-freebsd* | *-*-dragonfly*) 453488de56ccSmrg # Do not include libc due to us having libc/libc_r. 453588de56ccSmrg test "X$arg" = "X-lc" && continue 453688de56ccSmrg ;; 453788de56ccSmrg *-*-rhapsody* | *-*-darwin1.[012]) 453888de56ccSmrg # Rhapsody C and math libraries are in the System framework 453988de56ccSmrg deplibs="$deplibs System.ltframework" 454088de56ccSmrg continue 454188de56ccSmrg ;; 454288de56ccSmrg *-*-sco3.2v5* | *-*-sco5v6*) 454388de56ccSmrg # Causes problems with __ctype 454488de56ccSmrg test "X$arg" = "X-lc" && continue 454588de56ccSmrg ;; 454688de56ccSmrg *-*-sysv4.2uw2* | *-*-sysv5* | *-*-unixware* | *-*-OpenUNIX*) 454788de56ccSmrg # Compiler inserts libc in the correct place for threads to work 454888de56ccSmrg test "X$arg" = "X-lc" && continue 454988de56ccSmrg ;; 455088de56ccSmrg esac 455188de56ccSmrg elif test "X$arg" = "X-lc_r"; then 455288de56ccSmrg case $host in 455388de56ccSmrg *-*-openbsd* | *-*-freebsd* | *-*-dragonfly*) 455488de56ccSmrg # Do not include libc_r directly, use -pthread flag. 455588de56ccSmrg continue 455688de56ccSmrg ;; 455788de56ccSmrg esac 455888de56ccSmrg fi 455988de56ccSmrg deplibs="$deplibs $arg" 456088de56ccSmrg continue 456188de56ccSmrg ;; 45622e9c7c8cSmrg 456388de56ccSmrg -module) 456488de56ccSmrg module=yes 456588de56ccSmrg continue 456688de56ccSmrg ;; 45672e9c7c8cSmrg 456888de56ccSmrg # Tru64 UNIX uses -model [arg] to determine the layout of C++ 456988de56ccSmrg # classes, name mangling, and exception handling. 457088de56ccSmrg # Darwin uses the -arch flag to determine output architecture. 457188de56ccSmrg -model|-arch|-isysroot) 457288de56ccSmrg compiler_flags="$compiler_flags $arg" 457388de56ccSmrg func_append compile_command " $arg" 457488de56ccSmrg func_append finalize_command " $arg" 457588de56ccSmrg prev=xcompiler 457688de56ccSmrg continue 457788de56ccSmrg ;; 45782e9c7c8cSmrg 457988de56ccSmrg -mt|-mthreads|-kthread|-Kthread|-pthread|-pthreads|--thread-safe|-threads) 458088de56ccSmrg compiler_flags="$compiler_flags $arg" 458188de56ccSmrg func_append compile_command " $arg" 458288de56ccSmrg func_append finalize_command " $arg" 458388de56ccSmrg case "$new_inherited_linker_flags " in 458488de56ccSmrg *" $arg "*) ;; 458588de56ccSmrg * ) new_inherited_linker_flags="$new_inherited_linker_flags $arg" ;; 458688de56ccSmrg esac 458788de56ccSmrg continue 458888de56ccSmrg ;; 45892e9c7c8cSmrg 459088de56ccSmrg -multi_module) 459188de56ccSmrg single_module="${wl}-multi_module" 459288de56ccSmrg continue 459388de56ccSmrg ;; 45942e9c7c8cSmrg 459588de56ccSmrg -no-fast-install) 459688de56ccSmrg fast_install=no 459788de56ccSmrg continue 459888de56ccSmrg ;; 45992e9c7c8cSmrg 460088de56ccSmrg -no-install) 460188de56ccSmrg case $host in 460288de56ccSmrg *-*-cygwin* | *-*-mingw* | *-*-pw32* | *-*-os2* | *-*-darwin* | *-cegcc*) 460388de56ccSmrg # The PATH hackery in wrapper scripts is required on Windows 460488de56ccSmrg # and Darwin in order for the loader to find any dlls it needs. 460588de56ccSmrg func_warning "\`-no-install' is ignored for $host" 460688de56ccSmrg func_warning "assuming \`-no-fast-install' instead" 460788de56ccSmrg fast_install=no 460888de56ccSmrg ;; 460988de56ccSmrg *) no_install=yes ;; 461088de56ccSmrg esac 461188de56ccSmrg continue 461288de56ccSmrg ;; 46132e9c7c8cSmrg 461488de56ccSmrg -no-undefined) 461588de56ccSmrg allow_undefined=no 461688de56ccSmrg continue 461788de56ccSmrg ;; 46182e9c7c8cSmrg 461988de56ccSmrg -objectlist) 462088de56ccSmrg prev=objectlist 462188de56ccSmrg continue 462288de56ccSmrg ;; 46232e9c7c8cSmrg 462488de56ccSmrg -o) prev=output ;; 46252e9c7c8cSmrg 462688de56ccSmrg -precious-files-regex) 462788de56ccSmrg prev=precious_regex 462888de56ccSmrg continue 462988de56ccSmrg ;; 46302e9c7c8cSmrg 463188de56ccSmrg -release) 463288de56ccSmrg prev=release 463388de56ccSmrg continue 463488de56ccSmrg ;; 46352e9c7c8cSmrg 463688de56ccSmrg -rpath) 463788de56ccSmrg prev=rpath 463888de56ccSmrg continue 463988de56ccSmrg ;; 46402e9c7c8cSmrg 464188de56ccSmrg -R) 464288de56ccSmrg prev=xrpath 464388de56ccSmrg continue 464488de56ccSmrg ;; 46452e9c7c8cSmrg 464688de56ccSmrg -R*) 464788de56ccSmrg func_stripname '-R' '' "$arg" 464888de56ccSmrg dir=$func_stripname_result 464988de56ccSmrg # We need an absolute path. 465088de56ccSmrg case $dir in 465188de56ccSmrg [\\/]* | [A-Za-z]:[\\/]*) ;; 465288de56ccSmrg *) 465388de56ccSmrg func_fatal_error "only absolute run-paths are allowed" 465488de56ccSmrg ;; 465588de56ccSmrg esac 465688de56ccSmrg case "$xrpath " in 465788de56ccSmrg *" $dir "*) ;; 465888de56ccSmrg *) xrpath="$xrpath $dir" ;; 465988de56ccSmrg esac 466088de56ccSmrg continue 466188de56ccSmrg ;; 46622e9c7c8cSmrg 466388de56ccSmrg -shared) 466488de56ccSmrg # The effects of -shared are defined in a previous loop. 466588de56ccSmrg continue 466688de56ccSmrg ;; 46672e9c7c8cSmrg 466888de56ccSmrg -shrext) 466988de56ccSmrg prev=shrext 467088de56ccSmrg continue 467188de56ccSmrg ;; 46722e9c7c8cSmrg 467388de56ccSmrg -static | -static-libtool-libs) 467488de56ccSmrg # The effects of -static are defined in a previous loop. 467588de56ccSmrg # We used to do the same as -all-static on platforms that 467688de56ccSmrg # didn't have a PIC flag, but the assumption that the effects 467788de56ccSmrg # would be equivalent was wrong. It would break on at least 467888de56ccSmrg # Digital Unix and AIX. 467988de56ccSmrg continue 468088de56ccSmrg ;; 46812e9c7c8cSmrg 468288de56ccSmrg -thread-safe) 468388de56ccSmrg thread_safe=yes 468488de56ccSmrg continue 468588de56ccSmrg ;; 46862e9c7c8cSmrg 468788de56ccSmrg -version-info) 468888de56ccSmrg prev=vinfo 468988de56ccSmrg continue 469088de56ccSmrg ;; 46912e9c7c8cSmrg 469288de56ccSmrg -version-number) 469388de56ccSmrg prev=vinfo 469488de56ccSmrg vinfo_number=yes 469588de56ccSmrg continue 469688de56ccSmrg ;; 46972e9c7c8cSmrg 469888de56ccSmrg -weak) 469988de56ccSmrg prev=weak 470088de56ccSmrg continue 470188de56ccSmrg ;; 47021ab64890Smrg 470388de56ccSmrg -Wc,*) 470488de56ccSmrg func_stripname '-Wc,' '' "$arg" 470588de56ccSmrg args=$func_stripname_result 470688de56ccSmrg arg= 470788de56ccSmrg save_ifs="$IFS"; IFS=',' 470888de56ccSmrg for flag in $args; do 470988de56ccSmrg IFS="$save_ifs" 471088de56ccSmrg func_quote_for_eval "$flag" 471188de56ccSmrg arg="$arg $wl$func_quote_for_eval_result" 471288de56ccSmrg compiler_flags="$compiler_flags $func_quote_for_eval_result" 471388de56ccSmrg done 471488de56ccSmrg IFS="$save_ifs" 471588de56ccSmrg func_stripname ' ' '' "$arg" 471688de56ccSmrg arg=$func_stripname_result 471788de56ccSmrg ;; 4718b4ee4795Smrg 471988de56ccSmrg -Wl,*) 472088de56ccSmrg func_stripname '-Wl,' '' "$arg" 472188de56ccSmrg args=$func_stripname_result 472288de56ccSmrg arg= 472388de56ccSmrg save_ifs="$IFS"; IFS=',' 472488de56ccSmrg for flag in $args; do 472588de56ccSmrg IFS="$save_ifs" 472688de56ccSmrg func_quote_for_eval "$flag" 472788de56ccSmrg arg="$arg $wl$func_quote_for_eval_result" 472888de56ccSmrg compiler_flags="$compiler_flags $wl$func_quote_for_eval_result" 472988de56ccSmrg linker_flags="$linker_flags $func_quote_for_eval_result" 473088de56ccSmrg done 473188de56ccSmrg IFS="$save_ifs" 473288de56ccSmrg func_stripname ' ' '' "$arg" 473388de56ccSmrg arg=$func_stripname_result 473488de56ccSmrg ;; 4735b4ee4795Smrg 473688de56ccSmrg -Xcompiler) 473788de56ccSmrg prev=xcompiler 473888de56ccSmrg continue 473988de56ccSmrg ;; 4740b4ee4795Smrg 474188de56ccSmrg -Xlinker) 474288de56ccSmrg prev=xlinker 474388de56ccSmrg continue 474488de56ccSmrg ;; 4745b4ee4795Smrg 474688de56ccSmrg -XCClinker) 474788de56ccSmrg prev=xcclinker 474888de56ccSmrg continue 474988de56ccSmrg ;; 4750b4ee4795Smrg 475188de56ccSmrg # -msg_* for osf cc 475288de56ccSmrg -msg_*) 475388de56ccSmrg func_quote_for_eval "$arg" 475488de56ccSmrg arg="$func_quote_for_eval_result" 475588de56ccSmrg ;; 4756b4ee4795Smrg 475788de56ccSmrg # -64, -mips[0-9] enable 64-bit mode on the SGI compiler 475888de56ccSmrg # -r[0-9][0-9]* specifies the processor on the SGI compiler 475988de56ccSmrg # -xarch=*, -xtarget=* enable 64-bit mode on the Sun compiler 476088de56ccSmrg # +DA*, +DD* enable 64-bit mode on the HP compiler 476188de56ccSmrg # -q* pass through compiler args for the IBM compiler 476288de56ccSmrg # -m*, -t[45]*, -txscale* pass through architecture-specific 476388de56ccSmrg # compiler args for GCC 476488de56ccSmrg # -F/path gives path to uninstalled frameworks, gcc on darwin 476588de56ccSmrg # -p, -pg, --coverage, -fprofile-* pass through profiling flag for GCC 476688de56ccSmrg # @file GCC response files 476788de56ccSmrg -64|-mips[0-9]|-r[0-9][0-9]*|-xarch=*|-xtarget=*|+DA*|+DD*|-q*|-m*| \ 476888de56ccSmrg -t[45]*|-txscale*|-p|-pg|--coverage|-fprofile-*|-F*|@*) 476988de56ccSmrg func_quote_for_eval "$arg" 477088de56ccSmrg arg="$func_quote_for_eval_result" 477188de56ccSmrg func_append compile_command " $arg" 477288de56ccSmrg func_append finalize_command " $arg" 477388de56ccSmrg compiler_flags="$compiler_flags $arg" 477488de56ccSmrg continue 477588de56ccSmrg ;; 4776b4ee4795Smrg 477788de56ccSmrg # Some other compiler flag. 477888de56ccSmrg -* | +*) 477988de56ccSmrg func_quote_for_eval "$arg" 478088de56ccSmrg arg="$func_quote_for_eval_result" 478188de56ccSmrg ;; 4782b4ee4795Smrg 478388de56ccSmrg *.$objext) 478488de56ccSmrg # A standard object. 478588de56ccSmrg objs="$objs $arg" 478688de56ccSmrg ;; 4787b4ee4795Smrg 478888de56ccSmrg *.lo) 478988de56ccSmrg # A libtool-controlled object. 4790b4ee4795Smrg 479188de56ccSmrg # Check to see that this really is a libtool object. 479288de56ccSmrg if func_lalib_unsafe_p "$arg"; then 479388de56ccSmrg pic_object= 479488de56ccSmrg non_pic_object= 4795b4ee4795Smrg 479688de56ccSmrg # Read the .lo file 479788de56ccSmrg func_source "$arg" 4798b4ee4795Smrg 479988de56ccSmrg if test -z "$pic_object" || 480088de56ccSmrg test -z "$non_pic_object" || 480188de56ccSmrg test "$pic_object" = none && 480288de56ccSmrg test "$non_pic_object" = none; then 480388de56ccSmrg func_fatal_error "cannot find name of object for \`$arg'" 480488de56ccSmrg fi 4805b4ee4795Smrg 480688de56ccSmrg # Extract subdirectory from the argument. 480788de56ccSmrg func_dirname "$arg" "/" "" 480888de56ccSmrg xdir="$func_dirname_result" 4809b4ee4795Smrg 481088de56ccSmrg if test "$pic_object" != none; then 481188de56ccSmrg # Prepend the subdirectory the object is found in. 481288de56ccSmrg pic_object="$xdir$pic_object" 4813b4ee4795Smrg 481488de56ccSmrg if test "$prev" = dlfiles; then 481588de56ccSmrg if test "$build_libtool_libs" = yes && test "$dlopen_support" = yes; then 481688de56ccSmrg dlfiles="$dlfiles $pic_object" 481788de56ccSmrg prev= 481888de56ccSmrg continue 481988de56ccSmrg else 482088de56ccSmrg # If libtool objects are unsupported, then we need to preload. 482188de56ccSmrg prev=dlprefiles 482288de56ccSmrg fi 482388de56ccSmrg fi 4824b4ee4795Smrg 482588de56ccSmrg # CHECK ME: I think I busted this. -Ossama 482688de56ccSmrg if test "$prev" = dlprefiles; then 482788de56ccSmrg # Preload the old-style object. 482888de56ccSmrg dlprefiles="$dlprefiles $pic_object" 482988de56ccSmrg prev= 483088de56ccSmrg fi 48311ab64890Smrg 483288de56ccSmrg # A PIC object. 483388de56ccSmrg func_append libobjs " $pic_object" 483488de56ccSmrg arg="$pic_object" 483588de56ccSmrg fi 48361ab64890Smrg 483788de56ccSmrg # Non-PIC object. 483888de56ccSmrg if test "$non_pic_object" != none; then 483988de56ccSmrg # Prepend the subdirectory the object is found in. 484088de56ccSmrg non_pic_object="$xdir$non_pic_object" 48411ab64890Smrg 484288de56ccSmrg # A standard non-PIC object 484388de56ccSmrg func_append non_pic_objects " $non_pic_object" 484488de56ccSmrg if test -z "$pic_object" || test "$pic_object" = none ; then 484588de56ccSmrg arg="$non_pic_object" 484688de56ccSmrg fi 484788de56ccSmrg else 484888de56ccSmrg # If the PIC object exists, use it instead. 484988de56ccSmrg # $xdir was prepended to $pic_object above. 485088de56ccSmrg non_pic_object="$pic_object" 485188de56ccSmrg func_append non_pic_objects " $non_pic_object" 485288de56ccSmrg fi 485388de56ccSmrg else 485488de56ccSmrg # Only an error if not doing a dry-run. 485588de56ccSmrg if $opt_dry_run; then 485688de56ccSmrg # Extract subdirectory from the argument. 485788de56ccSmrg func_dirname "$arg" "/" "" 485888de56ccSmrg xdir="$func_dirname_result" 485988de56ccSmrg 486088de56ccSmrg func_lo2o "$arg" 486188de56ccSmrg pic_object=$xdir$objdir/$func_lo2o_result 486288de56ccSmrg non_pic_object=$xdir$func_lo2o_result 486388de56ccSmrg func_append libobjs " $pic_object" 486488de56ccSmrg func_append non_pic_objects " $non_pic_object" 486588de56ccSmrg else 486688de56ccSmrg func_fatal_error "\`$arg' is not a valid libtool object" 486788de56ccSmrg fi 486888de56ccSmrg fi 486988de56ccSmrg ;; 48701ab64890Smrg 487188de56ccSmrg *.$libext) 487288de56ccSmrg # An archive. 487388de56ccSmrg deplibs="$deplibs $arg" 487488de56ccSmrg old_deplibs="$old_deplibs $arg" 487588de56ccSmrg continue 487688de56ccSmrg ;; 487788de56ccSmrg 487888de56ccSmrg *.la) 487988de56ccSmrg # A libtool-controlled library. 488088de56ccSmrg 488188de56ccSmrg if test "$prev" = dlfiles; then 488288de56ccSmrg # This library was specified with -dlopen. 488388de56ccSmrg dlfiles="$dlfiles $arg" 488488de56ccSmrg prev= 488588de56ccSmrg elif test "$prev" = dlprefiles; then 488688de56ccSmrg # The library was specified with -dlpreopen. 488788de56ccSmrg dlprefiles="$dlprefiles $arg" 488888de56ccSmrg prev= 488988de56ccSmrg else 489088de56ccSmrg deplibs="$deplibs $arg" 489188de56ccSmrg fi 489288de56ccSmrg continue 489388de56ccSmrg ;; 489488de56ccSmrg 489588de56ccSmrg # Some other compiler argument. 489688de56ccSmrg *) 489788de56ccSmrg # Unknown arguments in both finalize_command and compile_command need 489888de56ccSmrg # to be aesthetically quoted because they are evaled later. 489988de56ccSmrg func_quote_for_eval "$arg" 490088de56ccSmrg arg="$func_quote_for_eval_result" 490188de56ccSmrg ;; 490288de56ccSmrg esac # arg 490388de56ccSmrg 490488de56ccSmrg # Now actually substitute the argument into the commands. 490588de56ccSmrg if test -n "$arg"; then 490688de56ccSmrg func_append compile_command " $arg" 490788de56ccSmrg func_append finalize_command " $arg" 490888de56ccSmrg fi 490988de56ccSmrg done # argument parsing loop 491088de56ccSmrg 491188de56ccSmrg test -n "$prev" && \ 491288de56ccSmrg func_fatal_help "the \`$prevarg' option requires an argument" 491388de56ccSmrg 491488de56ccSmrg if test "$export_dynamic" = yes && test -n "$export_dynamic_flag_spec"; then 491588de56ccSmrg eval arg=\"$export_dynamic_flag_spec\" 491688de56ccSmrg func_append compile_command " $arg" 491788de56ccSmrg func_append finalize_command " $arg" 491888de56ccSmrg fi 491988de56ccSmrg 492088de56ccSmrg oldlibs= 492188de56ccSmrg # calculate the name of the file, without its directory 492288de56ccSmrg func_basename "$output" 492388de56ccSmrg outputname="$func_basename_result" 492488de56ccSmrg libobjs_save="$libobjs" 492588de56ccSmrg 492688de56ccSmrg if test -n "$shlibpath_var"; then 492788de56ccSmrg # get the directories listed in $shlibpath_var 492888de56ccSmrg eval shlib_search_path=\`\$ECHO \"X\${$shlibpath_var}\" \| \$Xsed -e \'s/:/ /g\'\` 492988de56ccSmrg else 493088de56ccSmrg shlib_search_path= 493188de56ccSmrg fi 493288de56ccSmrg eval sys_lib_search_path=\"$sys_lib_search_path_spec\" 493388de56ccSmrg eval sys_lib_dlsearch_path=\"$sys_lib_dlsearch_path_spec\" 493488de56ccSmrg 493588de56ccSmrg func_dirname "$output" "/" "" 493688de56ccSmrg output_objdir="$func_dirname_result$objdir" 493788de56ccSmrg # Create the object directory. 493888de56ccSmrg func_mkdir_p "$output_objdir" 493988de56ccSmrg 494088de56ccSmrg # Determine the type of output 494188de56ccSmrg case $output in 494288de56ccSmrg "") 494388de56ccSmrg func_fatal_help "you must specify an output file" 494488de56ccSmrg ;; 494588de56ccSmrg *.$libext) linkmode=oldlib ;; 494688de56ccSmrg *.lo | *.$objext) linkmode=obj ;; 494788de56ccSmrg *.la) linkmode=lib ;; 494888de56ccSmrg *) linkmode=prog ;; # Anything else should be a program. 494988de56ccSmrg esac 495088de56ccSmrg 495188de56ccSmrg specialdeplibs= 495288de56ccSmrg 495388de56ccSmrg libs= 495488de56ccSmrg # Find all interdependent deplibs by searching for libraries 495588de56ccSmrg # that are linked more than once (e.g. -la -lb -la) 495688de56ccSmrg for deplib in $deplibs; do 495788de56ccSmrg if $opt_duplicate_deps ; then 495888de56ccSmrg case "$libs " in 495988de56ccSmrg *" $deplib "*) specialdeplibs="$specialdeplibs $deplib" ;; 496088de56ccSmrg esac 496188de56ccSmrg fi 496288de56ccSmrg libs="$libs $deplib" 496388de56ccSmrg done 496488de56ccSmrg 496588de56ccSmrg if test "$linkmode" = lib; then 496688de56ccSmrg libs="$predeps $libs $compiler_lib_search_path $postdeps" 496788de56ccSmrg 496888de56ccSmrg # Compute libraries that are listed more than once in $predeps 496988de56ccSmrg # $postdeps and mark them as special (i.e., whose duplicates are 497088de56ccSmrg # not to be eliminated). 497188de56ccSmrg pre_post_deps= 497288de56ccSmrg if $opt_duplicate_compiler_generated_deps; then 497388de56ccSmrg for pre_post_dep in $predeps $postdeps; do 497488de56ccSmrg case "$pre_post_deps " in 497588de56ccSmrg *" $pre_post_dep "*) specialdeplibs="$specialdeplibs $pre_post_deps" ;; 497688de56ccSmrg esac 497788de56ccSmrg pre_post_deps="$pre_post_deps $pre_post_dep" 497888de56ccSmrg done 497988de56ccSmrg fi 498088de56ccSmrg pre_post_deps= 498188de56ccSmrg fi 498288de56ccSmrg 498388de56ccSmrg deplibs= 498488de56ccSmrg newdependency_libs= 498588de56ccSmrg newlib_search_path= 498688de56ccSmrg need_relink=no # whether we're linking any uninstalled libtool libraries 498788de56ccSmrg notinst_deplibs= # not-installed libtool libraries 498888de56ccSmrg notinst_path= # paths that contain not-installed libtool libraries 498988de56ccSmrg 499088de56ccSmrg case $linkmode in 499188de56ccSmrg lib) 499288de56ccSmrg passes="conv dlpreopen link" 499388de56ccSmrg for file in $dlfiles $dlprefiles; do 499488de56ccSmrg case $file in 499588de56ccSmrg *.la) ;; 499688de56ccSmrg *) 499788de56ccSmrg func_fatal_help "libraries can \`-dlopen' only libtool libraries: $file" 499888de56ccSmrg ;; 499988de56ccSmrg esac 500088de56ccSmrg done 500188de56ccSmrg ;; 500288de56ccSmrg prog) 500388de56ccSmrg compile_deplibs= 500488de56ccSmrg finalize_deplibs= 500588de56ccSmrg alldeplibs=no 500688de56ccSmrg newdlfiles= 500788de56ccSmrg newdlprefiles= 500888de56ccSmrg passes="conv scan dlopen dlpreopen link" 500988de56ccSmrg ;; 501088de56ccSmrg *) passes="conv" 501188de56ccSmrg ;; 501288de56ccSmrg esac 501388de56ccSmrg 501488de56ccSmrg for pass in $passes; do 501588de56ccSmrg # The preopen pass in lib mode reverses $deplibs; put it back here 501688de56ccSmrg # so that -L comes before libs that need it for instance... 501788de56ccSmrg if test "$linkmode,$pass" = "lib,link"; then 501888de56ccSmrg ## FIXME: Find the place where the list is rebuilt in the wrong 501988de56ccSmrg ## order, and fix it there properly 502088de56ccSmrg tmp_deplibs= 502188de56ccSmrg for deplib in $deplibs; do 502288de56ccSmrg tmp_deplibs="$deplib $tmp_deplibs" 502388de56ccSmrg done 502488de56ccSmrg deplibs="$tmp_deplibs" 502588de56ccSmrg fi 502688de56ccSmrg 502788de56ccSmrg if test "$linkmode,$pass" = "lib,link" || 502888de56ccSmrg test "$linkmode,$pass" = "prog,scan"; then 502988de56ccSmrg libs="$deplibs" 503088de56ccSmrg deplibs= 503188de56ccSmrg fi 503288de56ccSmrg if test "$linkmode" = prog; then 503388de56ccSmrg case $pass in 503488de56ccSmrg dlopen) libs="$dlfiles" ;; 503588de56ccSmrg dlpreopen) libs="$dlprefiles" ;; 503688de56ccSmrg link) libs="$deplibs %DEPLIBS% $dependency_libs" ;; 503788de56ccSmrg esac 503888de56ccSmrg fi 503988de56ccSmrg if test "$linkmode,$pass" = "lib,dlpreopen"; then 504088de56ccSmrg # Collect and forward deplibs of preopened libtool libs 504188de56ccSmrg for lib in $dlprefiles; do 504288de56ccSmrg # Ignore non-libtool-libs 504388de56ccSmrg dependency_libs= 504488de56ccSmrg case $lib in 504588de56ccSmrg *.la) func_source "$lib" ;; 504688de56ccSmrg esac 504788de56ccSmrg 504888de56ccSmrg # Collect preopened libtool deplibs, except any this library 504988de56ccSmrg # has declared as weak libs 505088de56ccSmrg for deplib in $dependency_libs; do 505188de56ccSmrg deplib_base=`$ECHO "X$deplib" | $Xsed -e "$basename"` 505288de56ccSmrg case " $weak_libs " in 505388de56ccSmrg *" $deplib_base "*) ;; 505488de56ccSmrg *) deplibs="$deplibs $deplib" ;; 505588de56ccSmrg esac 505688de56ccSmrg done 505788de56ccSmrg done 505888de56ccSmrg libs="$dlprefiles" 505988de56ccSmrg fi 506088de56ccSmrg if test "$pass" = dlopen; then 506188de56ccSmrg # Collect dlpreopened libraries 506288de56ccSmrg save_deplibs="$deplibs" 506388de56ccSmrg deplibs= 506488de56ccSmrg fi 506588de56ccSmrg 506688de56ccSmrg for deplib in $libs; do 506788de56ccSmrg lib= 506888de56ccSmrg found=no 506988de56ccSmrg case $deplib in 507088de56ccSmrg -mt|-mthreads|-kthread|-Kthread|-pthread|-pthreads|--thread-safe|-threads) 507188de56ccSmrg if test "$linkmode,$pass" = "prog,link"; then 507288de56ccSmrg compile_deplibs="$deplib $compile_deplibs" 507388de56ccSmrg finalize_deplibs="$deplib $finalize_deplibs" 507488de56ccSmrg else 507588de56ccSmrg compiler_flags="$compiler_flags $deplib" 507688de56ccSmrg if test "$linkmode" = lib ; then 507788de56ccSmrg case "$new_inherited_linker_flags " in 507888de56ccSmrg *" $deplib "*) ;; 507988de56ccSmrg * ) new_inherited_linker_flags="$new_inherited_linker_flags $deplib" ;; 508088de56ccSmrg esac 508188de56ccSmrg fi 508288de56ccSmrg fi 508388de56ccSmrg continue 508488de56ccSmrg ;; 508588de56ccSmrg -l*) 508688de56ccSmrg if test "$linkmode" != lib && test "$linkmode" != prog; then 508788de56ccSmrg func_warning "\`-l' is ignored for archives/objects" 508888de56ccSmrg continue 508988de56ccSmrg fi 509088de56ccSmrg func_stripname '-l' '' "$deplib" 509188de56ccSmrg name=$func_stripname_result 509288de56ccSmrg if test "$linkmode" = lib; then 509388de56ccSmrg searchdirs="$newlib_search_path $lib_search_path $compiler_lib_search_dirs $sys_lib_search_path $shlib_search_path" 509488de56ccSmrg else 509588de56ccSmrg searchdirs="$newlib_search_path $lib_search_path $sys_lib_search_path $shlib_search_path" 509688de56ccSmrg fi 509788de56ccSmrg for searchdir in $searchdirs; do 509888de56ccSmrg for search_ext in .la $std_shrext .so .a; do 509988de56ccSmrg # Search the libtool library 510088de56ccSmrg lib="$searchdir/lib${name}${search_ext}" 510188de56ccSmrg if test -f "$lib"; then 510288de56ccSmrg if test "$search_ext" = ".la"; then 510388de56ccSmrg found=yes 510488de56ccSmrg else 510588de56ccSmrg found=no 510688de56ccSmrg fi 510788de56ccSmrg break 2 510888de56ccSmrg fi 510988de56ccSmrg done 511088de56ccSmrg done 511188de56ccSmrg if test "$found" != yes; then 511288de56ccSmrg # deplib doesn't seem to be a libtool library 511388de56ccSmrg if test "$linkmode,$pass" = "prog,link"; then 511488de56ccSmrg compile_deplibs="$deplib $compile_deplibs" 511588de56ccSmrg finalize_deplibs="$deplib $finalize_deplibs" 511688de56ccSmrg else 511788de56ccSmrg deplibs="$deplib $deplibs" 511888de56ccSmrg test "$linkmode" = lib && newdependency_libs="$deplib $newdependency_libs" 511988de56ccSmrg fi 512088de56ccSmrg continue 512188de56ccSmrg else # deplib is a libtool library 512288de56ccSmrg # If $allow_libtool_libs_with_static_runtimes && $deplib is a stdlib, 512388de56ccSmrg # We need to do some special things here, and not later. 512488de56ccSmrg if test "X$allow_libtool_libs_with_static_runtimes" = "Xyes" ; then 512588de56ccSmrg case " $predeps $postdeps " in 512688de56ccSmrg *" $deplib "*) 512788de56ccSmrg if func_lalib_p "$lib"; then 512888de56ccSmrg library_names= 512988de56ccSmrg old_library= 513088de56ccSmrg func_source "$lib" 513188de56ccSmrg for l in $old_library $library_names; do 513288de56ccSmrg ll="$l" 513388de56ccSmrg done 513488de56ccSmrg if test "X$ll" = "X$old_library" ; then # only static version available 513588de56ccSmrg found=no 513688de56ccSmrg func_dirname "$lib" "" "." 513788de56ccSmrg ladir="$func_dirname_result" 513888de56ccSmrg lib=$ladir/$old_library 513988de56ccSmrg if test "$linkmode,$pass" = "prog,link"; then 514088de56ccSmrg compile_deplibs="$deplib $compile_deplibs" 514188de56ccSmrg finalize_deplibs="$deplib $finalize_deplibs" 514288de56ccSmrg else 514388de56ccSmrg deplibs="$deplib $deplibs" 514488de56ccSmrg test "$linkmode" = lib && newdependency_libs="$deplib $newdependency_libs" 514588de56ccSmrg fi 514688de56ccSmrg continue 514788de56ccSmrg fi 514888de56ccSmrg fi 514988de56ccSmrg ;; 515088de56ccSmrg *) ;; 515188de56ccSmrg esac 515288de56ccSmrg fi 515388de56ccSmrg fi 515488de56ccSmrg ;; # -l 515588de56ccSmrg *.ltframework) 515688de56ccSmrg if test "$linkmode,$pass" = "prog,link"; then 515788de56ccSmrg compile_deplibs="$deplib $compile_deplibs" 515888de56ccSmrg finalize_deplibs="$deplib $finalize_deplibs" 515988de56ccSmrg else 516088de56ccSmrg deplibs="$deplib $deplibs" 516188de56ccSmrg if test "$linkmode" = lib ; then 516288de56ccSmrg case "$new_inherited_linker_flags " in 516388de56ccSmrg *" $deplib "*) ;; 516488de56ccSmrg * ) new_inherited_linker_flags="$new_inherited_linker_flags $deplib" ;; 516588de56ccSmrg esac 516688de56ccSmrg fi 516788de56ccSmrg fi 516888de56ccSmrg continue 516988de56ccSmrg ;; 517088de56ccSmrg -L*) 517188de56ccSmrg case $linkmode in 517288de56ccSmrg lib) 517388de56ccSmrg deplibs="$deplib $deplibs" 517488de56ccSmrg test "$pass" = conv && continue 517588de56ccSmrg newdependency_libs="$deplib $newdependency_libs" 517688de56ccSmrg func_stripname '-L' '' "$deplib" 517788de56ccSmrg newlib_search_path="$newlib_search_path $func_stripname_result" 517888de56ccSmrg ;; 517988de56ccSmrg prog) 518088de56ccSmrg if test "$pass" = conv; then 518188de56ccSmrg deplibs="$deplib $deplibs" 518288de56ccSmrg continue 518388de56ccSmrg fi 518488de56ccSmrg if test "$pass" = scan; then 518588de56ccSmrg deplibs="$deplib $deplibs" 518688de56ccSmrg else 518788de56ccSmrg compile_deplibs="$deplib $compile_deplibs" 518888de56ccSmrg finalize_deplibs="$deplib $finalize_deplibs" 518988de56ccSmrg fi 519088de56ccSmrg func_stripname '-L' '' "$deplib" 519188de56ccSmrg newlib_search_path="$newlib_search_path $func_stripname_result" 519288de56ccSmrg ;; 519388de56ccSmrg *) 519488de56ccSmrg func_warning "\`-L' is ignored for archives/objects" 519588de56ccSmrg ;; 519688de56ccSmrg esac # linkmode 519788de56ccSmrg continue 519888de56ccSmrg ;; # -L 519988de56ccSmrg -R*) 520088de56ccSmrg if test "$pass" = link; then 520188de56ccSmrg func_stripname '-R' '' "$deplib" 520288de56ccSmrg dir=$func_stripname_result 520388de56ccSmrg # Make sure the xrpath contains only unique directories. 520488de56ccSmrg case "$xrpath " in 520588de56ccSmrg *" $dir "*) ;; 520688de56ccSmrg *) xrpath="$xrpath $dir" ;; 520788de56ccSmrg esac 520888de56ccSmrg fi 520988de56ccSmrg deplibs="$deplib $deplibs" 521088de56ccSmrg continue 521188de56ccSmrg ;; 521288de56ccSmrg *.la) lib="$deplib" ;; 521388de56ccSmrg *.$libext) 521488de56ccSmrg if test "$pass" = conv; then 521588de56ccSmrg deplibs="$deplib $deplibs" 521688de56ccSmrg continue 521788de56ccSmrg fi 521888de56ccSmrg case $linkmode in 521988de56ccSmrg lib) 522088de56ccSmrg # Linking convenience modules into shared libraries is allowed, 522188de56ccSmrg # but linking other static libraries is non-portable. 522288de56ccSmrg case " $dlpreconveniencelibs " in 522388de56ccSmrg *" $deplib "*) ;; 522488de56ccSmrg *) 522588de56ccSmrg valid_a_lib=no 522688de56ccSmrg case $deplibs_check_method in 522788de56ccSmrg match_pattern*) 522888de56ccSmrg set dummy $deplibs_check_method; shift 522988de56ccSmrg match_pattern_regex=`expr "$deplibs_check_method" : "$1 \(.*\)"` 523088de56ccSmrg if eval "\$ECHO \"X$deplib\"" 2>/dev/null | $Xsed -e 10q \ 523188de56ccSmrg | $EGREP "$match_pattern_regex" > /dev/null; then 523288de56ccSmrg valid_a_lib=yes 523388de56ccSmrg fi 523488de56ccSmrg ;; 523588de56ccSmrg pass_all) 523688de56ccSmrg valid_a_lib=yes 523788de56ccSmrg ;; 523888de56ccSmrg esac 523988de56ccSmrg if test "$valid_a_lib" != yes; then 524088de56ccSmrg $ECHO 524188de56ccSmrg $ECHO "*** Warning: Trying to link with static lib archive $deplib." 524288de56ccSmrg $ECHO "*** I have the capability to make that library automatically link in when" 524388de56ccSmrg $ECHO "*** you link to this library. But I can only do this if you have a" 524488de56ccSmrg $ECHO "*** shared version of the library, which you do not appear to have" 524588de56ccSmrg $ECHO "*** because the file extensions .$libext of this argument makes me believe" 524688de56ccSmrg $ECHO "*** that it is just a static archive that I should not use here." 524788de56ccSmrg else 524888de56ccSmrg $ECHO 524988de56ccSmrg $ECHO "*** Warning: Linking the shared library $output against the" 525088de56ccSmrg $ECHO "*** static library $deplib is not portable!" 525188de56ccSmrg deplibs="$deplib $deplibs" 525288de56ccSmrg fi 525388de56ccSmrg ;; 525488de56ccSmrg esac 525588de56ccSmrg continue 525688de56ccSmrg ;; 525788de56ccSmrg prog) 525888de56ccSmrg if test "$pass" != link; then 525988de56ccSmrg deplibs="$deplib $deplibs" 526088de56ccSmrg else 526188de56ccSmrg compile_deplibs="$deplib $compile_deplibs" 526288de56ccSmrg finalize_deplibs="$deplib $finalize_deplibs" 526388de56ccSmrg fi 526488de56ccSmrg continue 526588de56ccSmrg ;; 526688de56ccSmrg esac # linkmode 526788de56ccSmrg ;; # *.$libext 526888de56ccSmrg *.lo | *.$objext) 526988de56ccSmrg if test "$pass" = conv; then 527088de56ccSmrg deplibs="$deplib $deplibs" 527188de56ccSmrg elif test "$linkmode" = prog; then 527288de56ccSmrg if test "$pass" = dlpreopen || test "$dlopen_support" != yes || test "$build_libtool_libs" = no; then 527388de56ccSmrg # If there is no dlopen support or we're linking statically, 527488de56ccSmrg # we need to preload. 527588de56ccSmrg newdlprefiles="$newdlprefiles $deplib" 527688de56ccSmrg compile_deplibs="$deplib $compile_deplibs" 527788de56ccSmrg finalize_deplibs="$deplib $finalize_deplibs" 527888de56ccSmrg else 527988de56ccSmrg newdlfiles="$newdlfiles $deplib" 528088de56ccSmrg fi 528188de56ccSmrg fi 528288de56ccSmrg continue 528388de56ccSmrg ;; 528488de56ccSmrg %DEPLIBS%) 528588de56ccSmrg alldeplibs=yes 528688de56ccSmrg continue 528788de56ccSmrg ;; 528888de56ccSmrg esac # case $deplib 528988de56ccSmrg 529088de56ccSmrg if test "$found" = yes || test -f "$lib"; then : 529188de56ccSmrg else 529288de56ccSmrg func_fatal_error "cannot find the library \`$lib' or unhandled argument \`$deplib'" 529388de56ccSmrg fi 529488de56ccSmrg 529588de56ccSmrg # Check to see that this really is a libtool archive. 529688de56ccSmrg func_lalib_unsafe_p "$lib" \ 529788de56ccSmrg || func_fatal_error "\`$lib' is not a valid libtool archive" 529888de56ccSmrg 529988de56ccSmrg func_dirname "$lib" "" "." 530088de56ccSmrg ladir="$func_dirname_result" 530188de56ccSmrg 530288de56ccSmrg dlname= 530388de56ccSmrg dlopen= 530488de56ccSmrg dlpreopen= 530588de56ccSmrg libdir= 530688de56ccSmrg library_names= 530788de56ccSmrg old_library= 530888de56ccSmrg inherited_linker_flags= 530988de56ccSmrg # If the library was installed with an old release of libtool, 531088de56ccSmrg # it will not redefine variables installed, or shouldnotlink 531188de56ccSmrg installed=yes 531288de56ccSmrg shouldnotlink=no 531388de56ccSmrg avoidtemprpath= 531488de56ccSmrg 531588de56ccSmrg 531688de56ccSmrg # Read the .la file 531788de56ccSmrg func_source "$lib" 531888de56ccSmrg 531988de56ccSmrg # Convert "-framework foo" to "foo.ltframework" 532088de56ccSmrg if test -n "$inherited_linker_flags"; then 532188de56ccSmrg tmp_inherited_linker_flags=`$ECHO "X$inherited_linker_flags" | $Xsed -e 's/-framework \([^ $]*\)/\1.ltframework/g'` 532288de56ccSmrg for tmp_inherited_linker_flag in $tmp_inherited_linker_flags; do 532388de56ccSmrg case " $new_inherited_linker_flags " in 532488de56ccSmrg *" $tmp_inherited_linker_flag "*) ;; 532588de56ccSmrg *) new_inherited_linker_flags="$new_inherited_linker_flags $tmp_inherited_linker_flag";; 532688de56ccSmrg esac 532788de56ccSmrg done 532888de56ccSmrg fi 532988de56ccSmrg dependency_libs=`$ECHO "X $dependency_libs" | $Xsed -e 's% \([^ $]*\).ltframework% -framework \1%g'` 533088de56ccSmrg if test "$linkmode,$pass" = "lib,link" || 533188de56ccSmrg test "$linkmode,$pass" = "prog,scan" || 533288de56ccSmrg { test "$linkmode" != prog && test "$linkmode" != lib; }; then 533388de56ccSmrg test -n "$dlopen" && dlfiles="$dlfiles $dlopen" 533488de56ccSmrg test -n "$dlpreopen" && dlprefiles="$dlprefiles $dlpreopen" 533588de56ccSmrg fi 533688de56ccSmrg 533788de56ccSmrg if test "$pass" = conv; then 533888de56ccSmrg # Only check for convenience libraries 533988de56ccSmrg deplibs="$lib $deplibs" 534088de56ccSmrg if test -z "$libdir"; then 534188de56ccSmrg if test -z "$old_library"; then 534288de56ccSmrg func_fatal_error "cannot find name of link library for \`$lib'" 534388de56ccSmrg fi 534488de56ccSmrg # It is a libtool convenience library, so add in its objects. 534588de56ccSmrg convenience="$convenience $ladir/$objdir/$old_library" 534688de56ccSmrg old_convenience="$old_convenience $ladir/$objdir/$old_library" 534788de56ccSmrg elif test "$linkmode" != prog && test "$linkmode" != lib; then 534888de56ccSmrg func_fatal_error "\`$lib' is not a convenience library" 534988de56ccSmrg fi 535088de56ccSmrg tmp_libs= 535188de56ccSmrg for deplib in $dependency_libs; do 535288de56ccSmrg deplibs="$deplib $deplibs" 535388de56ccSmrg if $opt_duplicate_deps ; then 535488de56ccSmrg case "$tmp_libs " in 535588de56ccSmrg *" $deplib "*) specialdeplibs="$specialdeplibs $deplib" ;; 535688de56ccSmrg esac 535788de56ccSmrg fi 535888de56ccSmrg tmp_libs="$tmp_libs $deplib" 535988de56ccSmrg done 536088de56ccSmrg continue 536188de56ccSmrg fi # $pass = conv 536288de56ccSmrg 536388de56ccSmrg 536488de56ccSmrg # Get the name of the library we link against. 536588de56ccSmrg linklib= 536688de56ccSmrg for l in $old_library $library_names; do 536788de56ccSmrg linklib="$l" 536888de56ccSmrg done 536988de56ccSmrg if test -z "$linklib"; then 537088de56ccSmrg func_fatal_error "cannot find name of link library for \`$lib'" 537188de56ccSmrg fi 537288de56ccSmrg 537388de56ccSmrg # This library was specified with -dlopen. 537488de56ccSmrg if test "$pass" = dlopen; then 537588de56ccSmrg if test -z "$libdir"; then 537688de56ccSmrg func_fatal_error "cannot -dlopen a convenience library: \`$lib'" 537788de56ccSmrg fi 537888de56ccSmrg if test -z "$dlname" || 537988de56ccSmrg test "$dlopen_support" != yes || 538088de56ccSmrg test "$build_libtool_libs" = no; then 538188de56ccSmrg # If there is no dlname, no dlopen support or we're linking 538288de56ccSmrg # statically, we need to preload. We also need to preload any 538388de56ccSmrg # dependent libraries so libltdl's deplib preloader doesn't 538488de56ccSmrg # bomb out in the load deplibs phase. 538588de56ccSmrg dlprefiles="$dlprefiles $lib $dependency_libs" 538688de56ccSmrg else 538788de56ccSmrg newdlfiles="$newdlfiles $lib" 538888de56ccSmrg fi 538988de56ccSmrg continue 539088de56ccSmrg fi # $pass = dlopen 539188de56ccSmrg 539288de56ccSmrg # We need an absolute path. 539388de56ccSmrg case $ladir in 539488de56ccSmrg [\\/]* | [A-Za-z]:[\\/]*) abs_ladir="$ladir" ;; 539588de56ccSmrg *) 539688de56ccSmrg abs_ladir=`cd "$ladir" && pwd` 539788de56ccSmrg if test -z "$abs_ladir"; then 539888de56ccSmrg func_warning "cannot determine absolute directory name of \`$ladir'" 539988de56ccSmrg func_warning "passing it literally to the linker, although it might fail" 540088de56ccSmrg abs_ladir="$ladir" 540188de56ccSmrg fi 540288de56ccSmrg ;; 540388de56ccSmrg esac 540488de56ccSmrg func_basename "$lib" 540588de56ccSmrg laname="$func_basename_result" 540688de56ccSmrg 540788de56ccSmrg # Find the relevant object directory and library name. 540888de56ccSmrg if test "X$installed" = Xyes; then 540988de56ccSmrg if test ! -f "$libdir/$linklib" && test -f "$abs_ladir/$linklib"; then 541088de56ccSmrg func_warning "library \`$lib' was moved." 541188de56ccSmrg dir="$ladir" 541288de56ccSmrg absdir="$abs_ladir" 541388de56ccSmrg libdir="$abs_ladir" 541488de56ccSmrg else 541588de56ccSmrg dir="$libdir" 541688de56ccSmrg absdir="$libdir" 541788de56ccSmrg fi 541888de56ccSmrg test "X$hardcode_automatic" = Xyes && avoidtemprpath=yes 541988de56ccSmrg else 542088de56ccSmrg if test ! -f "$ladir/$objdir/$linklib" && test -f "$abs_ladir/$linklib"; then 542188de56ccSmrg dir="$ladir" 542288de56ccSmrg absdir="$abs_ladir" 542388de56ccSmrg # Remove this search path later 542488de56ccSmrg notinst_path="$notinst_path $abs_ladir" 542588de56ccSmrg else 542688de56ccSmrg dir="$ladir/$objdir" 542788de56ccSmrg absdir="$abs_ladir/$objdir" 542888de56ccSmrg # Remove this search path later 542988de56ccSmrg notinst_path="$notinst_path $abs_ladir" 543088de56ccSmrg fi 543188de56ccSmrg fi # $installed = yes 543288de56ccSmrg func_stripname 'lib' '.la' "$laname" 543388de56ccSmrg name=$func_stripname_result 543488de56ccSmrg 543588de56ccSmrg # This library was specified with -dlpreopen. 543688de56ccSmrg if test "$pass" = dlpreopen; then 543788de56ccSmrg if test -z "$libdir" && test "$linkmode" = prog; then 543888de56ccSmrg func_fatal_error "only libraries may -dlpreopen a convenience library: \`$lib'" 543988de56ccSmrg fi 544088de56ccSmrg # Prefer using a static library (so that no silly _DYNAMIC symbols 544188de56ccSmrg # are required to link). 544288de56ccSmrg if test -n "$old_library"; then 544388de56ccSmrg newdlprefiles="$newdlprefiles $dir/$old_library" 544488de56ccSmrg # Keep a list of preopened convenience libraries to check 544588de56ccSmrg # that they are being used correctly in the link pass. 544688de56ccSmrg test -z "$libdir" && \ 544788de56ccSmrg dlpreconveniencelibs="$dlpreconveniencelibs $dir/$old_library" 544888de56ccSmrg # Otherwise, use the dlname, so that lt_dlopen finds it. 544988de56ccSmrg elif test -n "$dlname"; then 545088de56ccSmrg newdlprefiles="$newdlprefiles $dir/$dlname" 545188de56ccSmrg else 545288de56ccSmrg newdlprefiles="$newdlprefiles $dir/$linklib" 545388de56ccSmrg fi 545488de56ccSmrg fi # $pass = dlpreopen 545588de56ccSmrg 545688de56ccSmrg if test -z "$libdir"; then 545788de56ccSmrg # Link the convenience library 545888de56ccSmrg if test "$linkmode" = lib; then 545988de56ccSmrg deplibs="$dir/$old_library $deplibs" 546088de56ccSmrg elif test "$linkmode,$pass" = "prog,link"; then 546188de56ccSmrg compile_deplibs="$dir/$old_library $compile_deplibs" 546288de56ccSmrg finalize_deplibs="$dir/$old_library $finalize_deplibs" 546388de56ccSmrg else 546488de56ccSmrg deplibs="$lib $deplibs" # used for prog,scan pass 546588de56ccSmrg fi 546688de56ccSmrg continue 546788de56ccSmrg fi 546888de56ccSmrg 546988de56ccSmrg 547088de56ccSmrg if test "$linkmode" = prog && test "$pass" != link; then 547188de56ccSmrg newlib_search_path="$newlib_search_path $ladir" 547288de56ccSmrg deplibs="$lib $deplibs" 547388de56ccSmrg 547488de56ccSmrg linkalldeplibs=no 547588de56ccSmrg if test "$link_all_deplibs" != no || test -z "$library_names" || 547688de56ccSmrg test "$build_libtool_libs" = no; then 547788de56ccSmrg linkalldeplibs=yes 547888de56ccSmrg fi 547988de56ccSmrg 548088de56ccSmrg tmp_libs= 548188de56ccSmrg for deplib in $dependency_libs; do 548288de56ccSmrg case $deplib in 548388de56ccSmrg -L*) func_stripname '-L' '' "$deplib" 548488de56ccSmrg newlib_search_path="$newlib_search_path $func_stripname_result" 548588de56ccSmrg ;; 548688de56ccSmrg esac 548788de56ccSmrg # Need to link against all dependency_libs? 548888de56ccSmrg if test "$linkalldeplibs" = yes; then 548988de56ccSmrg deplibs="$deplib $deplibs" 549088de56ccSmrg else 549188de56ccSmrg # Need to hardcode shared library paths 549288de56ccSmrg # or/and link against static libraries 549388de56ccSmrg newdependency_libs="$deplib $newdependency_libs" 549488de56ccSmrg fi 549588de56ccSmrg if $opt_duplicate_deps ; then 549688de56ccSmrg case "$tmp_libs " in 549788de56ccSmrg *" $deplib "*) specialdeplibs="$specialdeplibs $deplib" ;; 549888de56ccSmrg esac 549988de56ccSmrg fi 550088de56ccSmrg tmp_libs="$tmp_libs $deplib" 550188de56ccSmrg done # for deplib 550288de56ccSmrg continue 550388de56ccSmrg fi # $linkmode = prog... 550488de56ccSmrg 550588de56ccSmrg if test "$linkmode,$pass" = "prog,link"; then 550688de56ccSmrg if test -n "$library_names" && 550788de56ccSmrg { { test "$prefer_static_libs" = no || 550888de56ccSmrg test "$prefer_static_libs,$installed" = "built,yes"; } || 550988de56ccSmrg test -z "$old_library"; }; then 551088de56ccSmrg # We need to hardcode the library path 551188de56ccSmrg if test -n "$shlibpath_var" && test -z "$avoidtemprpath" ; then 551288de56ccSmrg # Make sure the rpath contains only unique directories. 551388de56ccSmrg case "$temp_rpath:" in 551488de56ccSmrg *"$absdir:"*) ;; 551588de56ccSmrg *) temp_rpath="$temp_rpath$absdir:" ;; 551688de56ccSmrg esac 551788de56ccSmrg fi 551888de56ccSmrg 551988de56ccSmrg # Hardcode the library path. 552088de56ccSmrg # Skip directories that are in the system default run-time 552188de56ccSmrg # search path. 552288de56ccSmrg case " $sys_lib_dlsearch_path " in 552388de56ccSmrg *" $absdir "*) ;; 552488de56ccSmrg *) 552588de56ccSmrg case "$compile_rpath " in 552688de56ccSmrg *" $absdir "*) ;; 552788de56ccSmrg *) compile_rpath="$compile_rpath $absdir" 552888de56ccSmrg esac 552988de56ccSmrg ;; 553088de56ccSmrg esac 553188de56ccSmrg case " $sys_lib_dlsearch_path " in 553288de56ccSmrg *" $libdir "*) ;; 553388de56ccSmrg *) 553488de56ccSmrg case "$finalize_rpath " in 553588de56ccSmrg *" $libdir "*) ;; 553688de56ccSmrg *) finalize_rpath="$finalize_rpath $libdir" 553788de56ccSmrg esac 553888de56ccSmrg ;; 553988de56ccSmrg esac 554088de56ccSmrg fi # $linkmode,$pass = prog,link... 554188de56ccSmrg 554288de56ccSmrg if test "$alldeplibs" = yes && 554388de56ccSmrg { test "$deplibs_check_method" = pass_all || 554488de56ccSmrg { test "$build_libtool_libs" = yes && 554588de56ccSmrg test -n "$library_names"; }; }; then 554688de56ccSmrg # We only need to search for static libraries 554788de56ccSmrg continue 554888de56ccSmrg fi 554988de56ccSmrg fi 555088de56ccSmrg 555188de56ccSmrg link_static=no # Whether the deplib will be linked statically 555288de56ccSmrg use_static_libs=$prefer_static_libs 555388de56ccSmrg if test "$use_static_libs" = built && test "$installed" = yes; then 555488de56ccSmrg use_static_libs=no 555588de56ccSmrg fi 555688de56ccSmrg if test -n "$library_names" && 555788de56ccSmrg { test "$use_static_libs" = no || test -z "$old_library"; }; then 555888de56ccSmrg case $host in 555988de56ccSmrg *cygwin* | *mingw* | *cegcc*) 556088de56ccSmrg # No point in relinking DLLs because paths are not encoded 556188de56ccSmrg notinst_deplibs="$notinst_deplibs $lib" 556288de56ccSmrg need_relink=no 556388de56ccSmrg ;; 556488de56ccSmrg *) 556588de56ccSmrg if test "$installed" = no; then 556688de56ccSmrg notinst_deplibs="$notinst_deplibs $lib" 556788de56ccSmrg need_relink=yes 556888de56ccSmrg fi 556988de56ccSmrg ;; 557088de56ccSmrg esac 557188de56ccSmrg # This is a shared library 557288de56ccSmrg 557388de56ccSmrg # Warn about portability, can't link against -module's on some 557488de56ccSmrg # systems (darwin). Don't bleat about dlopened modules though! 557588de56ccSmrg dlopenmodule="" 557688de56ccSmrg for dlpremoduletest in $dlprefiles; do 557788de56ccSmrg if test "X$dlpremoduletest" = "X$lib"; then 557888de56ccSmrg dlopenmodule="$dlpremoduletest" 557988de56ccSmrg break 558088de56ccSmrg fi 558188de56ccSmrg done 558288de56ccSmrg if test -z "$dlopenmodule" && test "$shouldnotlink" = yes && test "$pass" = link; then 558388de56ccSmrg $ECHO 558488de56ccSmrg if test "$linkmode" = prog; then 558588de56ccSmrg $ECHO "*** Warning: Linking the executable $output against the loadable module" 558688de56ccSmrg else 558788de56ccSmrg $ECHO "*** Warning: Linking the shared library $output against the loadable module" 558888de56ccSmrg fi 558988de56ccSmrg $ECHO "*** $linklib is not portable!" 559088de56ccSmrg fi 559188de56ccSmrg if test "$linkmode" = lib && 559288de56ccSmrg test "$hardcode_into_libs" = yes; then 559388de56ccSmrg # Hardcode the library path. 559488de56ccSmrg # Skip directories that are in the system default run-time 559588de56ccSmrg # search path. 559688de56ccSmrg case " $sys_lib_dlsearch_path " in 559788de56ccSmrg *" $absdir "*) ;; 559888de56ccSmrg *) 559988de56ccSmrg case "$compile_rpath " in 560088de56ccSmrg *" $absdir "*) ;; 560188de56ccSmrg *) compile_rpath="$compile_rpath $absdir" 560288de56ccSmrg esac 560388de56ccSmrg ;; 560488de56ccSmrg esac 560588de56ccSmrg case " $sys_lib_dlsearch_path " in 560688de56ccSmrg *" $libdir "*) ;; 560788de56ccSmrg *) 560888de56ccSmrg case "$finalize_rpath " in 560988de56ccSmrg *" $libdir "*) ;; 561088de56ccSmrg *) finalize_rpath="$finalize_rpath $libdir" 561188de56ccSmrg esac 561288de56ccSmrg ;; 561388de56ccSmrg esac 561488de56ccSmrg fi 561588de56ccSmrg 561688de56ccSmrg if test -n "$old_archive_from_expsyms_cmds"; then 561788de56ccSmrg # figure out the soname 561888de56ccSmrg set dummy $library_names 561988de56ccSmrg shift 562088de56ccSmrg realname="$1" 562188de56ccSmrg shift 562288de56ccSmrg libname=`eval "\\$ECHO \"$libname_spec\""` 562388de56ccSmrg # use dlname if we got it. it's perfectly good, no? 562488de56ccSmrg if test -n "$dlname"; then 562588de56ccSmrg soname="$dlname" 562688de56ccSmrg elif test -n "$soname_spec"; then 562788de56ccSmrg # bleh windows 562888de56ccSmrg case $host in 562988de56ccSmrg *cygwin* | mingw* | *cegcc*) 563088de56ccSmrg func_arith $current - $age 563188de56ccSmrg major=$func_arith_result 563288de56ccSmrg versuffix="-$major" 563388de56ccSmrg ;; 563488de56ccSmrg esac 563588de56ccSmrg eval soname=\"$soname_spec\" 563688de56ccSmrg else 563788de56ccSmrg soname="$realname" 563888de56ccSmrg fi 563988de56ccSmrg 564088de56ccSmrg # Make a new name for the extract_expsyms_cmds to use 564188de56ccSmrg soroot="$soname" 564288de56ccSmrg func_basename "$soroot" 564388de56ccSmrg soname="$func_basename_result" 564488de56ccSmrg func_stripname 'lib' '.dll' "$soname" 564588de56ccSmrg newlib=libimp-$func_stripname_result.a 564688de56ccSmrg 564788de56ccSmrg # If the library has no export list, then create one now 564888de56ccSmrg if test -f "$output_objdir/$soname-def"; then : 564988de56ccSmrg else 565088de56ccSmrg func_verbose "extracting exported symbol list from \`$soname'" 565188de56ccSmrg func_execute_cmds "$extract_expsyms_cmds" 'exit $?' 565288de56ccSmrg fi 565388de56ccSmrg 565488de56ccSmrg # Create $newlib 565588de56ccSmrg if test -f "$output_objdir/$newlib"; then :; else 565688de56ccSmrg func_verbose "generating import library for \`$soname'" 565788de56ccSmrg func_execute_cmds "$old_archive_from_expsyms_cmds" 'exit $?' 565888de56ccSmrg fi 565988de56ccSmrg # make sure the library variables are pointing to the new library 566088de56ccSmrg dir=$output_objdir 566188de56ccSmrg linklib=$newlib 566288de56ccSmrg fi # test -n "$old_archive_from_expsyms_cmds" 566388de56ccSmrg 566488de56ccSmrg if test "$linkmode" = prog || test "$mode" != relink; then 566588de56ccSmrg add_shlibpath= 566688de56ccSmrg add_dir= 566788de56ccSmrg add= 566888de56ccSmrg lib_linked=yes 566988de56ccSmrg case $hardcode_action in 567088de56ccSmrg immediate | unsupported) 567188de56ccSmrg if test "$hardcode_direct" = no; then 567288de56ccSmrg add="$dir/$linklib" 567388de56ccSmrg case $host in 567488de56ccSmrg *-*-sco3.2v5.0.[024]*) add_dir="-L$dir" ;; 567588de56ccSmrg *-*-sysv4*uw2*) add_dir="-L$dir" ;; 567688de56ccSmrg *-*-sysv5OpenUNIX* | *-*-sysv5UnixWare7.[01].[10]* | \ 567788de56ccSmrg *-*-unixware7*) add_dir="-L$dir" ;; 567888de56ccSmrg *-*-darwin* ) 567988de56ccSmrg # if the lib is a (non-dlopened) module then we can not 568088de56ccSmrg # link against it, someone is ignoring the earlier warnings 568188de56ccSmrg if /usr/bin/file -L $add 2> /dev/null | 568288de56ccSmrg $GREP ": [^:]* bundle" >/dev/null ; then 568388de56ccSmrg if test "X$dlopenmodule" != "X$lib"; then 568488de56ccSmrg $ECHO "*** Warning: lib $linklib is a module, not a shared library" 568588de56ccSmrg if test -z "$old_library" ; then 568688de56ccSmrg $ECHO 568788de56ccSmrg $ECHO "*** And there doesn't seem to be a static archive available" 568888de56ccSmrg $ECHO "*** The link will probably fail, sorry" 568988de56ccSmrg else 569088de56ccSmrg add="$dir/$old_library" 569188de56ccSmrg fi 569288de56ccSmrg elif test -n "$old_library"; then 569388de56ccSmrg add="$dir/$old_library" 569488de56ccSmrg fi 569588de56ccSmrg fi 569688de56ccSmrg esac 569788de56ccSmrg elif test "$hardcode_minus_L" = no; then 569888de56ccSmrg case $host in 569988de56ccSmrg *-*-sunos*) add_shlibpath="$dir" ;; 570088de56ccSmrg esac 570188de56ccSmrg add_dir="-L$dir" 570288de56ccSmrg add="-l$name" 570388de56ccSmrg elif test "$hardcode_shlibpath_var" = no; then 570488de56ccSmrg add_shlibpath="$dir" 570588de56ccSmrg add="-l$name" 570688de56ccSmrg else 570788de56ccSmrg lib_linked=no 570888de56ccSmrg fi 570988de56ccSmrg ;; 571088de56ccSmrg relink) 571188de56ccSmrg if test "$hardcode_direct" = yes && 571288de56ccSmrg test "$hardcode_direct_absolute" = no; then 571388de56ccSmrg add="$dir/$linklib" 571488de56ccSmrg elif test "$hardcode_minus_L" = yes; then 571588de56ccSmrg add_dir="-L$dir" 571688de56ccSmrg # Try looking first in the location we're being installed to. 571788de56ccSmrg if test -n "$inst_prefix_dir"; then 571888de56ccSmrg case $libdir in 571988de56ccSmrg [\\/]*) 572088de56ccSmrg add_dir="$add_dir -L$inst_prefix_dir$libdir" 572188de56ccSmrg ;; 572288de56ccSmrg esac 572388de56ccSmrg fi 572488de56ccSmrg add="-l$name" 572588de56ccSmrg elif test "$hardcode_shlibpath_var" = yes; then 572688de56ccSmrg add_shlibpath="$dir" 572788de56ccSmrg add="-l$name" 572888de56ccSmrg else 572988de56ccSmrg lib_linked=no 573088de56ccSmrg fi 573188de56ccSmrg ;; 573288de56ccSmrg *) lib_linked=no ;; 573388de56ccSmrg esac 573488de56ccSmrg 573588de56ccSmrg if test "$lib_linked" != yes; then 573688de56ccSmrg func_fatal_configuration "unsupported hardcode properties" 573788de56ccSmrg fi 573888de56ccSmrg 573988de56ccSmrg if test -n "$add_shlibpath"; then 574088de56ccSmrg case :$compile_shlibpath: in 574188de56ccSmrg *":$add_shlibpath:"*) ;; 574288de56ccSmrg *) compile_shlibpath="$compile_shlibpath$add_shlibpath:" ;; 574388de56ccSmrg esac 574488de56ccSmrg fi 574588de56ccSmrg if test "$linkmode" = prog; then 574688de56ccSmrg test -n "$add_dir" && compile_deplibs="$add_dir $compile_deplibs" 574788de56ccSmrg test -n "$add" && compile_deplibs="$add $compile_deplibs" 574888de56ccSmrg else 574988de56ccSmrg test -n "$add_dir" && deplibs="$add_dir $deplibs" 575088de56ccSmrg test -n "$add" && deplibs="$add $deplibs" 575188de56ccSmrg if test "$hardcode_direct" != yes && 575288de56ccSmrg test "$hardcode_minus_L" != yes && 575388de56ccSmrg test "$hardcode_shlibpath_var" = yes; then 575488de56ccSmrg case :$finalize_shlibpath: in 575588de56ccSmrg *":$libdir:"*) ;; 575688de56ccSmrg *) finalize_shlibpath="$finalize_shlibpath$libdir:" ;; 575788de56ccSmrg esac 575888de56ccSmrg fi 575988de56ccSmrg fi 576088de56ccSmrg fi 576188de56ccSmrg 576288de56ccSmrg if test "$linkmode" = prog || test "$mode" = relink; then 576388de56ccSmrg add_shlibpath= 576488de56ccSmrg add_dir= 576588de56ccSmrg add= 576688de56ccSmrg # Finalize command for both is simple: just hardcode it. 576788de56ccSmrg if test "$hardcode_direct" = yes && 576888de56ccSmrg test "$hardcode_direct_absolute" = no; then 576988de56ccSmrg add="$libdir/$linklib" 577088de56ccSmrg elif test "$hardcode_minus_L" = yes; then 577188de56ccSmrg add_dir="-L$libdir" 577288de56ccSmrg add="-l$name" 577388de56ccSmrg elif test "$hardcode_shlibpath_var" = yes; then 577488de56ccSmrg case :$finalize_shlibpath: in 577588de56ccSmrg *":$libdir:"*) ;; 577688de56ccSmrg *) finalize_shlibpath="$finalize_shlibpath$libdir:" ;; 577788de56ccSmrg esac 577888de56ccSmrg add="-l$name" 577988de56ccSmrg elif test "$hardcode_automatic" = yes; then 578088de56ccSmrg if test -n "$inst_prefix_dir" && 578188de56ccSmrg test -f "$inst_prefix_dir$libdir/$linklib" ; then 578288de56ccSmrg add="$inst_prefix_dir$libdir/$linklib" 578388de56ccSmrg else 578488de56ccSmrg add="$libdir/$linklib" 578588de56ccSmrg fi 578688de56ccSmrg else 578788de56ccSmrg # We cannot seem to hardcode it, guess we'll fake it. 578888de56ccSmrg add_dir="-L$libdir" 578988de56ccSmrg # Try looking first in the location we're being installed to. 579088de56ccSmrg if test -n "$inst_prefix_dir"; then 579188de56ccSmrg case $libdir in 579288de56ccSmrg [\\/]*) 579388de56ccSmrg add_dir="$add_dir -L$inst_prefix_dir$libdir" 579488de56ccSmrg ;; 579588de56ccSmrg esac 579688de56ccSmrg fi 579788de56ccSmrg add="-l$name" 579888de56ccSmrg fi 579988de56ccSmrg 580088de56ccSmrg if test "$linkmode" = prog; then 580188de56ccSmrg test -n "$add_dir" && finalize_deplibs="$add_dir $finalize_deplibs" 580288de56ccSmrg test -n "$add" && finalize_deplibs="$add $finalize_deplibs" 580388de56ccSmrg else 580488de56ccSmrg test -n "$add_dir" && deplibs="$add_dir $deplibs" 580588de56ccSmrg test -n "$add" && deplibs="$add $deplibs" 580688de56ccSmrg fi 580788de56ccSmrg fi 580888de56ccSmrg elif test "$linkmode" = prog; then 580988de56ccSmrg # Here we assume that one of hardcode_direct or hardcode_minus_L 581088de56ccSmrg # is not unsupported. This is valid on all known static and 581188de56ccSmrg # shared platforms. 581288de56ccSmrg if test "$hardcode_direct" != unsupported; then 581388de56ccSmrg test -n "$old_library" && linklib="$old_library" 581488de56ccSmrg compile_deplibs="$dir/$linklib $compile_deplibs" 581588de56ccSmrg finalize_deplibs="$dir/$linklib $finalize_deplibs" 581688de56ccSmrg else 581788de56ccSmrg compile_deplibs="-l$name -L$dir $compile_deplibs" 581888de56ccSmrg finalize_deplibs="-l$name -L$dir $finalize_deplibs" 581988de56ccSmrg fi 582088de56ccSmrg elif test "$build_libtool_libs" = yes; then 582188de56ccSmrg # Not a shared library 582288de56ccSmrg if test "$deplibs_check_method" != pass_all; then 582388de56ccSmrg # We're trying link a shared library against a static one 582488de56ccSmrg # but the system doesn't support it. 582588de56ccSmrg 582688de56ccSmrg # Just print a warning and add the library to dependency_libs so 582788de56ccSmrg # that the program can be linked against the static library. 582888de56ccSmrg $ECHO 582988de56ccSmrg $ECHO "*** Warning: This system can not link to static lib archive $lib." 583088de56ccSmrg $ECHO "*** I have the capability to make that library automatically link in when" 583188de56ccSmrg $ECHO "*** you link to this library. But I can only do this if you have a" 583288de56ccSmrg $ECHO "*** shared version of the library, which you do not appear to have." 583388de56ccSmrg if test "$module" = yes; then 583488de56ccSmrg $ECHO "*** But as you try to build a module library, libtool will still create " 583588de56ccSmrg $ECHO "*** a static module, that should work as long as the dlopening application" 583688de56ccSmrg $ECHO "*** is linked with the -dlopen flag to resolve symbols at runtime." 583788de56ccSmrg if test -z "$global_symbol_pipe"; then 583888de56ccSmrg $ECHO 583988de56ccSmrg $ECHO "*** However, this would only work if libtool was able to extract symbol" 584088de56ccSmrg $ECHO "*** lists from a program, using \`nm' or equivalent, but libtool could" 584188de56ccSmrg $ECHO "*** not find such a program. So, this module is probably useless." 584288de56ccSmrg $ECHO "*** \`nm' from GNU binutils and a full rebuild may help." 584388de56ccSmrg fi 584488de56ccSmrg if test "$build_old_libs" = no; then 584588de56ccSmrg build_libtool_libs=module 584688de56ccSmrg build_old_libs=yes 584788de56ccSmrg else 584888de56ccSmrg build_libtool_libs=no 584988de56ccSmrg fi 585088de56ccSmrg fi 585188de56ccSmrg else 585288de56ccSmrg deplibs="$dir/$old_library $deplibs" 585388de56ccSmrg link_static=yes 585488de56ccSmrg fi 585588de56ccSmrg fi # link shared/static library? 585688de56ccSmrg 585788de56ccSmrg if test "$linkmode" = lib; then 585888de56ccSmrg if test -n "$dependency_libs" && 585988de56ccSmrg { test "$hardcode_into_libs" != yes || 586088de56ccSmrg test "$build_old_libs" = yes || 586188de56ccSmrg test "$link_static" = yes; }; then 586288de56ccSmrg # Extract -R from dependency_libs 586388de56ccSmrg temp_deplibs= 586488de56ccSmrg for libdir in $dependency_libs; do 586588de56ccSmrg case $libdir in 586688de56ccSmrg -R*) func_stripname '-R' '' "$libdir" 586788de56ccSmrg temp_xrpath=$func_stripname_result 586888de56ccSmrg case " $xrpath " in 586988de56ccSmrg *" $temp_xrpath "*) ;; 587088de56ccSmrg *) xrpath="$xrpath $temp_xrpath";; 587188de56ccSmrg esac;; 587288de56ccSmrg *) temp_deplibs="$temp_deplibs $libdir";; 587388de56ccSmrg esac 587488de56ccSmrg done 587588de56ccSmrg dependency_libs="$temp_deplibs" 587688de56ccSmrg fi 587788de56ccSmrg 587888de56ccSmrg newlib_search_path="$newlib_search_path $absdir" 587988de56ccSmrg # Link against this library 588088de56ccSmrg test "$link_static" = no && newdependency_libs="$abs_ladir/$laname $newdependency_libs" 588188de56ccSmrg # ... and its dependency_libs 588288de56ccSmrg tmp_libs= 588388de56ccSmrg for deplib in $dependency_libs; do 588488de56ccSmrg newdependency_libs="$deplib $newdependency_libs" 588588de56ccSmrg if $opt_duplicate_deps ; then 588688de56ccSmrg case "$tmp_libs " in 588788de56ccSmrg *" $deplib "*) specialdeplibs="$specialdeplibs $deplib" ;; 588888de56ccSmrg esac 588988de56ccSmrg fi 589088de56ccSmrg tmp_libs="$tmp_libs $deplib" 589188de56ccSmrg done 589288de56ccSmrg 589388de56ccSmrg if test "$link_all_deplibs" != no; then 589488de56ccSmrg # Add the search paths of all dependency libraries 589588de56ccSmrg for deplib in $dependency_libs; do 589688de56ccSmrg case $deplib in 589788de56ccSmrg -L*) path="$deplib" ;; 589888de56ccSmrg *.la) 589988de56ccSmrg func_dirname "$deplib" "" "." 590088de56ccSmrg dir="$func_dirname_result" 590188de56ccSmrg # We need an absolute path. 590288de56ccSmrg case $dir in 590388de56ccSmrg [\\/]* | [A-Za-z]:[\\/]*) absdir="$dir" ;; 590488de56ccSmrg *) 590588de56ccSmrg absdir=`cd "$dir" && pwd` 590688de56ccSmrg if test -z "$absdir"; then 590788de56ccSmrg func_warning "cannot determine absolute directory name of \`$dir'" 590888de56ccSmrg absdir="$dir" 590988de56ccSmrg fi 591088de56ccSmrg ;; 591188de56ccSmrg esac 591288de56ccSmrg if $GREP "^installed=no" $deplib > /dev/null; then 591388de56ccSmrg case $host in 591488de56ccSmrg *-*-darwin*) 591588de56ccSmrg depdepl= 591688de56ccSmrg eval deplibrary_names=`${SED} -n -e 's/^library_names=\(.*\)$/\1/p' $deplib` 591788de56ccSmrg if test -n "$deplibrary_names" ; then 591888de56ccSmrg for tmp in $deplibrary_names ; do 591988de56ccSmrg depdepl=$tmp 592088de56ccSmrg done 592188de56ccSmrg if test -f "$absdir/$objdir/$depdepl" ; then 592288de56ccSmrg depdepl="$absdir/$objdir/$depdepl" 592388de56ccSmrg darwin_install_name=`${OTOOL} -L $depdepl | awk '{if (NR == 2) {print $1;exit}}'` 592488de56ccSmrg if test -z "$darwin_install_name"; then 592588de56ccSmrg darwin_install_name=`${OTOOL64} -L $depdepl | awk '{if (NR == 2) {print $1;exit}}'` 592688de56ccSmrg fi 592788de56ccSmrg compiler_flags="$compiler_flags ${wl}-dylib_file ${wl}${darwin_install_name}:${depdepl}" 592888de56ccSmrg linker_flags="$linker_flags -dylib_file ${darwin_install_name}:${depdepl}" 592988de56ccSmrg path= 593088de56ccSmrg fi 593188de56ccSmrg fi 593288de56ccSmrg ;; 593388de56ccSmrg *) 593488de56ccSmrg path="-L$absdir/$objdir" 593588de56ccSmrg ;; 593688de56ccSmrg esac 593788de56ccSmrg else 593888de56ccSmrg eval libdir=`${SED} -n -e 's/^libdir=\(.*\)$/\1/p' $deplib` 593988de56ccSmrg test -z "$libdir" && \ 594088de56ccSmrg func_fatal_error "\`$deplib' is not a valid libtool archive" 594188de56ccSmrg test "$absdir" != "$libdir" && \ 594288de56ccSmrg func_warning "\`$deplib' seems to be moved" 594388de56ccSmrg 594488de56ccSmrg path="-L$absdir" 594588de56ccSmrg fi 594688de56ccSmrg ;; 594788de56ccSmrg esac 594888de56ccSmrg case " $deplibs " in 594988de56ccSmrg *" $path "*) ;; 595088de56ccSmrg *) deplibs="$path $deplibs" ;; 595188de56ccSmrg esac 595288de56ccSmrg done 595388de56ccSmrg fi # link_all_deplibs != no 595488de56ccSmrg fi # linkmode = lib 595588de56ccSmrg done # for deplib in $libs 595688de56ccSmrg if test "$pass" = link; then 595788de56ccSmrg if test "$linkmode" = "prog"; then 595888de56ccSmrg compile_deplibs="$new_inherited_linker_flags $compile_deplibs" 595988de56ccSmrg finalize_deplibs="$new_inherited_linker_flags $finalize_deplibs" 596088de56ccSmrg else 596188de56ccSmrg compiler_flags="$compiler_flags "`$ECHO "X $new_inherited_linker_flags" | $Xsed -e 's% \([^ $]*\).ltframework% -framework \1%g'` 596288de56ccSmrg fi 596388de56ccSmrg fi 596488de56ccSmrg dependency_libs="$newdependency_libs" 596588de56ccSmrg if test "$pass" = dlpreopen; then 596688de56ccSmrg # Link the dlpreopened libraries before other libraries 596788de56ccSmrg for deplib in $save_deplibs; do 596888de56ccSmrg deplibs="$deplib $deplibs" 596988de56ccSmrg done 597088de56ccSmrg fi 597188de56ccSmrg if test "$pass" != dlopen; then 597288de56ccSmrg if test "$pass" != conv; then 597388de56ccSmrg # Make sure lib_search_path contains only unique directories. 597488de56ccSmrg lib_search_path= 597588de56ccSmrg for dir in $newlib_search_path; do 597688de56ccSmrg case "$lib_search_path " in 597788de56ccSmrg *" $dir "*) ;; 597888de56ccSmrg *) lib_search_path="$lib_search_path $dir" ;; 597988de56ccSmrg esac 598088de56ccSmrg done 598188de56ccSmrg newlib_search_path= 598288de56ccSmrg fi 598388de56ccSmrg 598488de56ccSmrg if test "$linkmode,$pass" != "prog,link"; then 598588de56ccSmrg vars="deplibs" 598688de56ccSmrg else 598788de56ccSmrg vars="compile_deplibs finalize_deplibs" 598888de56ccSmrg fi 598988de56ccSmrg for var in $vars dependency_libs; do 599088de56ccSmrg # Add libraries to $var in reverse order 599188de56ccSmrg eval tmp_libs=\"\$$var\" 599288de56ccSmrg new_libs= 599388de56ccSmrg for deplib in $tmp_libs; do 599488de56ccSmrg # FIXME: Pedantically, this is the right thing to do, so 599588de56ccSmrg # that some nasty dependency loop isn't accidentally 599688de56ccSmrg # broken: 599788de56ccSmrg #new_libs="$deplib $new_libs" 599888de56ccSmrg # Pragmatically, this seems to cause very few problems in 599988de56ccSmrg # practice: 600088de56ccSmrg case $deplib in 600188de56ccSmrg -L*) new_libs="$deplib $new_libs" ;; 600288de56ccSmrg -R*) ;; 600388de56ccSmrg *) 600488de56ccSmrg # And here is the reason: when a library appears more 600588de56ccSmrg # than once as an explicit dependence of a library, or 600688de56ccSmrg # is implicitly linked in more than once by the 600788de56ccSmrg # compiler, it is considered special, and multiple 600888de56ccSmrg # occurrences thereof are not removed. Compare this 600988de56ccSmrg # with having the same library being listed as a 601088de56ccSmrg # dependency of multiple other libraries: in this case, 601188de56ccSmrg # we know (pedantically, we assume) the library does not 601288de56ccSmrg # need to be listed more than once, so we keep only the 601388de56ccSmrg # last copy. This is not always right, but it is rare 601488de56ccSmrg # enough that we require users that really mean to play 601588de56ccSmrg # such unportable linking tricks to link the library 601688de56ccSmrg # using -Wl,-lname, so that libtool does not consider it 601788de56ccSmrg # for duplicate removal. 601888de56ccSmrg case " $specialdeplibs " in 601988de56ccSmrg *" $deplib "*) new_libs="$deplib $new_libs" ;; 602088de56ccSmrg *) 602188de56ccSmrg case " $new_libs " in 602288de56ccSmrg *" $deplib "*) ;; 602388de56ccSmrg *) new_libs="$deplib $new_libs" ;; 602488de56ccSmrg esac 602588de56ccSmrg ;; 602688de56ccSmrg esac 602788de56ccSmrg ;; 602888de56ccSmrg esac 602988de56ccSmrg done 603088de56ccSmrg tmp_libs= 603188de56ccSmrg for deplib in $new_libs; do 603288de56ccSmrg case $deplib in 603388de56ccSmrg -L*) 603488de56ccSmrg case " $tmp_libs " in 603588de56ccSmrg *" $deplib "*) ;; 603688de56ccSmrg *) tmp_libs="$tmp_libs $deplib" ;; 603788de56ccSmrg esac 603888de56ccSmrg ;; 603988de56ccSmrg *) tmp_libs="$tmp_libs $deplib" ;; 604088de56ccSmrg esac 604188de56ccSmrg done 604288de56ccSmrg eval $var=\"$tmp_libs\" 604388de56ccSmrg done # for var 604488de56ccSmrg fi 604588de56ccSmrg # Last step: remove runtime libs from dependency_libs 604688de56ccSmrg # (they stay in deplibs) 604788de56ccSmrg tmp_libs= 604888de56ccSmrg for i in $dependency_libs ; do 604988de56ccSmrg case " $predeps $postdeps $compiler_lib_search_path " in 605088de56ccSmrg *" $i "*) 605188de56ccSmrg i="" 605288de56ccSmrg ;; 605388de56ccSmrg esac 605488de56ccSmrg if test -n "$i" ; then 605588de56ccSmrg tmp_libs="$tmp_libs $i" 605688de56ccSmrg fi 605788de56ccSmrg done 605888de56ccSmrg dependency_libs=$tmp_libs 605988de56ccSmrg done # for pass 606088de56ccSmrg if test "$linkmode" = prog; then 606188de56ccSmrg dlfiles="$newdlfiles" 606288de56ccSmrg fi 606388de56ccSmrg if test "$linkmode" = prog || test "$linkmode" = lib; then 606488de56ccSmrg dlprefiles="$newdlprefiles" 606588de56ccSmrg fi 606688de56ccSmrg 606788de56ccSmrg case $linkmode in 606888de56ccSmrg oldlib) 606988de56ccSmrg if test -n "$dlfiles$dlprefiles" || test "$dlself" != no; then 607088de56ccSmrg func_warning "\`-dlopen' is ignored for archives" 607188de56ccSmrg fi 607288de56ccSmrg 607388de56ccSmrg case " $deplibs" in 607488de56ccSmrg *\ -l* | *\ -L*) 607588de56ccSmrg func_warning "\`-l' and \`-L' are ignored for archives" ;; 607688de56ccSmrg esac 607788de56ccSmrg 607888de56ccSmrg test -n "$rpath" && \ 607988de56ccSmrg func_warning "\`-rpath' is ignored for archives" 608088de56ccSmrg 608188de56ccSmrg test -n "$xrpath" && \ 608288de56ccSmrg func_warning "\`-R' is ignored for archives" 608388de56ccSmrg 608488de56ccSmrg test -n "$vinfo" && \ 608588de56ccSmrg func_warning "\`-version-info/-version-number' is ignored for archives" 608688de56ccSmrg 608788de56ccSmrg test -n "$release" && \ 608888de56ccSmrg func_warning "\`-release' is ignored for archives" 608988de56ccSmrg 609088de56ccSmrg test -n "$export_symbols$export_symbols_regex" && \ 609188de56ccSmrg func_warning "\`-export-symbols' is ignored for archives" 609288de56ccSmrg 609388de56ccSmrg # Now set the variables for building old libraries. 609488de56ccSmrg build_libtool_libs=no 609588de56ccSmrg oldlibs="$output" 609688de56ccSmrg objs="$objs$old_deplibs" 609788de56ccSmrg ;; 609888de56ccSmrg 609988de56ccSmrg lib) 610088de56ccSmrg # Make sure we only generate libraries of the form `libNAME.la'. 610188de56ccSmrg case $outputname in 610288de56ccSmrg lib*) 610388de56ccSmrg func_stripname 'lib' '.la' "$outputname" 610488de56ccSmrg name=$func_stripname_result 610588de56ccSmrg eval shared_ext=\"$shrext_cmds\" 610688de56ccSmrg eval libname=\"$libname_spec\" 610788de56ccSmrg ;; 610888de56ccSmrg *) 610988de56ccSmrg test "$module" = no && \ 611088de56ccSmrg func_fatal_help "libtool library \`$output' must begin with \`lib'" 611188de56ccSmrg 611288de56ccSmrg if test "$need_lib_prefix" != no; then 611388de56ccSmrg # Add the "lib" prefix for modules if required 611488de56ccSmrg func_stripname '' '.la' "$outputname" 611588de56ccSmrg name=$func_stripname_result 611688de56ccSmrg eval shared_ext=\"$shrext_cmds\" 611788de56ccSmrg eval libname=\"$libname_spec\" 611888de56ccSmrg else 611988de56ccSmrg func_stripname '' '.la' "$outputname" 612088de56ccSmrg libname=$func_stripname_result 612188de56ccSmrg fi 612288de56ccSmrg ;; 612388de56ccSmrg esac 612488de56ccSmrg 612588de56ccSmrg if test -n "$objs"; then 612688de56ccSmrg if test "$deplibs_check_method" != pass_all; then 612788de56ccSmrg func_fatal_error "cannot build libtool library \`$output' from non-libtool objects on this host:$objs" 612888de56ccSmrg else 612988de56ccSmrg $ECHO 613088de56ccSmrg $ECHO "*** Warning: Linking the shared library $output against the non-libtool" 613188de56ccSmrg $ECHO "*** objects $objs is not portable!" 613288de56ccSmrg libobjs="$libobjs $objs" 613388de56ccSmrg fi 613488de56ccSmrg fi 613588de56ccSmrg 613688de56ccSmrg test "$dlself" != no && \ 613788de56ccSmrg func_warning "\`-dlopen self' is ignored for libtool libraries" 613888de56ccSmrg 613988de56ccSmrg set dummy $rpath 614088de56ccSmrg shift 614188de56ccSmrg test "$#" -gt 1 && \ 614288de56ccSmrg func_warning "ignoring multiple \`-rpath's for a libtool library" 614388de56ccSmrg 614488de56ccSmrg install_libdir="$1" 614588de56ccSmrg 614688de56ccSmrg oldlibs= 614788de56ccSmrg if test -z "$rpath"; then 614888de56ccSmrg if test "$build_libtool_libs" = yes; then 614988de56ccSmrg # Building a libtool convenience library. 615088de56ccSmrg # Some compilers have problems with a `.al' extension so 615188de56ccSmrg # convenience libraries should have the same extension an 615288de56ccSmrg # archive normally would. 615388de56ccSmrg oldlibs="$output_objdir/$libname.$libext $oldlibs" 615488de56ccSmrg build_libtool_libs=convenience 615588de56ccSmrg build_old_libs=yes 615688de56ccSmrg fi 615788de56ccSmrg 615888de56ccSmrg test -n "$vinfo" && \ 615988de56ccSmrg func_warning "\`-version-info/-version-number' is ignored for convenience libraries" 616088de56ccSmrg 616188de56ccSmrg test -n "$release" && \ 616288de56ccSmrg func_warning "\`-release' is ignored for convenience libraries" 616388de56ccSmrg else 616488de56ccSmrg 616588de56ccSmrg # Parse the version information argument. 616688de56ccSmrg save_ifs="$IFS"; IFS=':' 616788de56ccSmrg set dummy $vinfo 0 0 0 616888de56ccSmrg shift 616988de56ccSmrg IFS="$save_ifs" 617088de56ccSmrg 617188de56ccSmrg test -n "$7" && \ 617288de56ccSmrg func_fatal_help "too many parameters to \`-version-info'" 617388de56ccSmrg 617488de56ccSmrg # convert absolute version numbers to libtool ages 617588de56ccSmrg # this retains compatibility with .la files and attempts 617688de56ccSmrg # to make the code below a bit more comprehensible 617788de56ccSmrg 617888de56ccSmrg case $vinfo_number in 617988de56ccSmrg yes) 618088de56ccSmrg number_major="$1" 618188de56ccSmrg number_minor="$2" 618288de56ccSmrg number_revision="$3" 618388de56ccSmrg # 618488de56ccSmrg # There are really only two kinds -- those that 618588de56ccSmrg # use the current revision as the major version 618688de56ccSmrg # and those that subtract age and use age as 618788de56ccSmrg # a minor version. But, then there is irix 618888de56ccSmrg # which has an extra 1 added just for fun 618988de56ccSmrg # 619088de56ccSmrg case $version_type in 619188de56ccSmrg darwin|linux|osf|windows|none) 619288de56ccSmrg func_arith $number_major + $number_minor 619388de56ccSmrg current=$func_arith_result 619488de56ccSmrg age="$number_minor" 619588de56ccSmrg revision="$number_revision" 619688de56ccSmrg ;; 619788de56ccSmrg freebsd-aout|freebsd-elf|sunos) 619888de56ccSmrg current="$number_major" 619988de56ccSmrg revision="$number_minor" 620088de56ccSmrg age="0" 620188de56ccSmrg ;; 620288de56ccSmrg irix|nonstopux) 620388de56ccSmrg func_arith $number_major + $number_minor 620488de56ccSmrg current=$func_arith_result 620588de56ccSmrg age="$number_minor" 620688de56ccSmrg revision="$number_minor" 620788de56ccSmrg lt_irix_increment=no 620888de56ccSmrg ;; 620988de56ccSmrg esac 621088de56ccSmrg ;; 621188de56ccSmrg no) 621288de56ccSmrg current="$1" 621388de56ccSmrg revision="$2" 621488de56ccSmrg age="$3" 621588de56ccSmrg ;; 621688de56ccSmrg esac 621788de56ccSmrg 621888de56ccSmrg # Check that each of the things are valid numbers. 621988de56ccSmrg case $current in 622088de56ccSmrg 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]) ;; 622188de56ccSmrg *) 622288de56ccSmrg func_error "CURRENT \`$current' must be a nonnegative integer" 622388de56ccSmrg func_fatal_error "\`$vinfo' is not valid version information" 622488de56ccSmrg ;; 622588de56ccSmrg esac 622688de56ccSmrg 622788de56ccSmrg case $revision in 622888de56ccSmrg 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]) ;; 622988de56ccSmrg *) 623088de56ccSmrg func_error "REVISION \`$revision' must be a nonnegative integer" 623188de56ccSmrg func_fatal_error "\`$vinfo' is not valid version information" 623288de56ccSmrg ;; 623388de56ccSmrg esac 623488de56ccSmrg 623588de56ccSmrg case $age in 623688de56ccSmrg 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]) ;; 623788de56ccSmrg *) 623888de56ccSmrg func_error "AGE \`$age' must be a nonnegative integer" 623988de56ccSmrg func_fatal_error "\`$vinfo' is not valid version information" 624088de56ccSmrg ;; 624188de56ccSmrg esac 624288de56ccSmrg 624388de56ccSmrg if test "$age" -gt "$current"; then 624488de56ccSmrg func_error "AGE \`$age' is greater than the current interface number \`$current'" 624588de56ccSmrg func_fatal_error "\`$vinfo' is not valid version information" 624688de56ccSmrg fi 624788de56ccSmrg 624888de56ccSmrg # Calculate the version variables. 624988de56ccSmrg major= 625088de56ccSmrg versuffix= 625188de56ccSmrg verstring= 625288de56ccSmrg case $version_type in 625388de56ccSmrg none) ;; 625488de56ccSmrg 625588de56ccSmrg darwin) 625688de56ccSmrg # Like Linux, but with the current version available in 625788de56ccSmrg # verstring for coding it into the library header 625888de56ccSmrg func_arith $current - $age 625988de56ccSmrg major=.$func_arith_result 626088de56ccSmrg versuffix="$major.$age.$revision" 626188de56ccSmrg # Darwin ld doesn't like 0 for these options... 626288de56ccSmrg func_arith $current + 1 626388de56ccSmrg minor_current=$func_arith_result 626488de56ccSmrg xlcverstring="${wl}-compatibility_version ${wl}$minor_current ${wl}-current_version ${wl}$minor_current.$revision" 626588de56ccSmrg verstring="-compatibility_version $minor_current -current_version $minor_current.$revision" 626688de56ccSmrg ;; 626788de56ccSmrg 626888de56ccSmrg freebsd-aout) 626988de56ccSmrg major=".$current" 627088de56ccSmrg versuffix=".$current.$revision"; 627188de56ccSmrg ;; 627288de56ccSmrg 627388de56ccSmrg freebsd-elf) 627488de56ccSmrg major=".$current" 627588de56ccSmrg versuffix=".$current" 627688de56ccSmrg ;; 627788de56ccSmrg 627888de56ccSmrg irix | nonstopux) 627988de56ccSmrg if test "X$lt_irix_increment" = "Xno"; then 628088de56ccSmrg func_arith $current - $age 628188de56ccSmrg else 628288de56ccSmrg func_arith $current - $age + 1 628388de56ccSmrg fi 628488de56ccSmrg major=$func_arith_result 628588de56ccSmrg 628688de56ccSmrg case $version_type in 628788de56ccSmrg nonstopux) verstring_prefix=nonstopux ;; 628888de56ccSmrg *) verstring_prefix=sgi ;; 628988de56ccSmrg esac 629088de56ccSmrg verstring="$verstring_prefix$major.$revision" 629188de56ccSmrg 629288de56ccSmrg # Add in all the interfaces that we are compatible with. 629388de56ccSmrg loop=$revision 629488de56ccSmrg while test "$loop" -ne 0; do 629588de56ccSmrg func_arith $revision - $loop 629688de56ccSmrg iface=$func_arith_result 629788de56ccSmrg func_arith $loop - 1 629888de56ccSmrg loop=$func_arith_result 629988de56ccSmrg verstring="$verstring_prefix$major.$iface:$verstring" 630088de56ccSmrg done 630188de56ccSmrg 630288de56ccSmrg # Before this point, $major must not contain `.'. 630388de56ccSmrg major=.$major 630488de56ccSmrg versuffix="$major.$revision" 630588de56ccSmrg ;; 630688de56ccSmrg 630788de56ccSmrg linux) 630888de56ccSmrg func_arith $current - $age 630988de56ccSmrg major=.$func_arith_result 631088de56ccSmrg versuffix="$major.$age.$revision" 631188de56ccSmrg ;; 631288de56ccSmrg 631388de56ccSmrg osf) 631488de56ccSmrg func_arith $current - $age 631588de56ccSmrg major=.$func_arith_result 631688de56ccSmrg versuffix=".$current.$age.$revision" 631788de56ccSmrg verstring="$current.$age.$revision" 631888de56ccSmrg 631988de56ccSmrg # Add in all the interfaces that we are compatible with. 632088de56ccSmrg loop=$age 632188de56ccSmrg while test "$loop" -ne 0; do 632288de56ccSmrg func_arith $current - $loop 632388de56ccSmrg iface=$func_arith_result 632488de56ccSmrg func_arith $loop - 1 632588de56ccSmrg loop=$func_arith_result 632688de56ccSmrg verstring="$verstring:${iface}.0" 632788de56ccSmrg done 632888de56ccSmrg 632988de56ccSmrg # Make executables depend on our current version. 633088de56ccSmrg verstring="$verstring:${current}.0" 633188de56ccSmrg ;; 633288de56ccSmrg 633388de56ccSmrg qnx) 633488de56ccSmrg major=".$current" 633588de56ccSmrg versuffix=".$current" 633688de56ccSmrg ;; 633788de56ccSmrg 633888de56ccSmrg sunos) 633988de56ccSmrg major=".$current" 634088de56ccSmrg versuffix=".$current.$revision" 634188de56ccSmrg ;; 634288de56ccSmrg 634388de56ccSmrg windows) 634488de56ccSmrg # Use '-' rather than '.', since we only want one 634588de56ccSmrg # extension on DOS 8.3 filesystems. 634688de56ccSmrg func_arith $current - $age 634788de56ccSmrg major=$func_arith_result 634888de56ccSmrg versuffix="-$major" 634988de56ccSmrg ;; 635088de56ccSmrg 635188de56ccSmrg *) 635288de56ccSmrg func_fatal_configuration "unknown library version type \`$version_type'" 635388de56ccSmrg ;; 635488de56ccSmrg esac 635588de56ccSmrg 635688de56ccSmrg # Clear the version info if we defaulted, and they specified a release. 635788de56ccSmrg if test -z "$vinfo" && test -n "$release"; then 635888de56ccSmrg major= 635988de56ccSmrg case $version_type in 636088de56ccSmrg darwin) 636188de56ccSmrg # we can't check for "0.0" in archive_cmds due to quoting 636288de56ccSmrg # problems, so we reset it completely 636388de56ccSmrg verstring= 636488de56ccSmrg ;; 636588de56ccSmrg *) 636688de56ccSmrg verstring="0.0" 636788de56ccSmrg ;; 636888de56ccSmrg esac 636988de56ccSmrg if test "$need_version" = no; then 637088de56ccSmrg versuffix= 637188de56ccSmrg else 637288de56ccSmrg versuffix=".0.0" 637388de56ccSmrg fi 637488de56ccSmrg fi 637588de56ccSmrg 637688de56ccSmrg # Remove version info from name if versioning should be avoided 637788de56ccSmrg if test "$avoid_version" = yes && test "$need_version" = no; then 637888de56ccSmrg major= 637988de56ccSmrg versuffix= 638088de56ccSmrg verstring="" 638188de56ccSmrg fi 638288de56ccSmrg 638388de56ccSmrg # Check to see if the archive will have undefined symbols. 638488de56ccSmrg if test "$allow_undefined" = yes; then 638588de56ccSmrg if test "$allow_undefined_flag" = unsupported; then 638688de56ccSmrg func_warning "undefined symbols not allowed in $host shared libraries" 638788de56ccSmrg build_libtool_libs=no 638888de56ccSmrg build_old_libs=yes 638988de56ccSmrg fi 639088de56ccSmrg else 639188de56ccSmrg # Don't allow undefined symbols. 639288de56ccSmrg allow_undefined_flag="$no_undefined_flag" 639388de56ccSmrg fi 639488de56ccSmrg 639588de56ccSmrg fi 639688de56ccSmrg 639788de56ccSmrg func_generate_dlsyms "$libname" "$libname" "yes" 639888de56ccSmrg libobjs="$libobjs $symfileobj" 639988de56ccSmrg test "X$libobjs" = "X " && libobjs= 640088de56ccSmrg 640188de56ccSmrg if test "$mode" != relink; then 640288de56ccSmrg # Remove our outputs, but don't remove object files since they 640388de56ccSmrg # may have been created when compiling PIC objects. 640488de56ccSmrg removelist= 640588de56ccSmrg tempremovelist=`$ECHO "$output_objdir/*"` 640688de56ccSmrg for p in $tempremovelist; do 640788de56ccSmrg case $p in 640888de56ccSmrg *.$objext | *.gcno) 640988de56ccSmrg ;; 641088de56ccSmrg $output_objdir/$outputname | $output_objdir/$libname.* | $output_objdir/${libname}${release}.*) 641188de56ccSmrg if test "X$precious_files_regex" != "X"; then 641288de56ccSmrg if $ECHO "$p" | $EGREP -e "$precious_files_regex" >/dev/null 2>&1 641388de56ccSmrg then 641488de56ccSmrg continue 641588de56ccSmrg fi 641688de56ccSmrg fi 641788de56ccSmrg removelist="$removelist $p" 641888de56ccSmrg ;; 641988de56ccSmrg *) ;; 642088de56ccSmrg esac 642188de56ccSmrg done 642288de56ccSmrg test -n "$removelist" && \ 642388de56ccSmrg func_show_eval "${RM}r \$removelist" 642488de56ccSmrg fi 642588de56ccSmrg 642688de56ccSmrg # Now set the variables for building old libraries. 642788de56ccSmrg if test "$build_old_libs" = yes && test "$build_libtool_libs" != convenience ; then 642888de56ccSmrg oldlibs="$oldlibs $output_objdir/$libname.$libext" 642988de56ccSmrg 643088de56ccSmrg # Transform .lo files to .o files. 643188de56ccSmrg oldobjs="$objs "`$ECHO "X$libobjs" | $SP2NL | $Xsed -e '/\.'${libext}'$/d' -e "$lo2o" | $NL2SP` 643288de56ccSmrg fi 643388de56ccSmrg 643488de56ccSmrg # Eliminate all temporary directories. 643588de56ccSmrg #for path in $notinst_path; do 643688de56ccSmrg # lib_search_path=`$ECHO "X$lib_search_path " | $Xsed -e "s% $path % %g"` 643788de56ccSmrg # deplibs=`$ECHO "X$deplibs " | $Xsed -e "s% -L$path % %g"` 643888de56ccSmrg # dependency_libs=`$ECHO "X$dependency_libs " | $Xsed -e "s% -L$path % %g"` 643988de56ccSmrg #done 644088de56ccSmrg 644188de56ccSmrg if test -n "$xrpath"; then 644288de56ccSmrg # If the user specified any rpath flags, then add them. 644388de56ccSmrg temp_xrpath= 644488de56ccSmrg for libdir in $xrpath; do 644588de56ccSmrg temp_xrpath="$temp_xrpath -R$libdir" 644688de56ccSmrg case "$finalize_rpath " in 644788de56ccSmrg *" $libdir "*) ;; 644888de56ccSmrg *) finalize_rpath="$finalize_rpath $libdir" ;; 644988de56ccSmrg esac 645088de56ccSmrg done 645188de56ccSmrg if test "$hardcode_into_libs" != yes || test "$build_old_libs" = yes; then 645288de56ccSmrg dependency_libs="$temp_xrpath $dependency_libs" 645388de56ccSmrg fi 645488de56ccSmrg fi 645588de56ccSmrg 645688de56ccSmrg # Make sure dlfiles contains only unique files that won't be dlpreopened 645788de56ccSmrg old_dlfiles="$dlfiles" 645888de56ccSmrg dlfiles= 645988de56ccSmrg for lib in $old_dlfiles; do 646088de56ccSmrg case " $dlprefiles $dlfiles " in 646188de56ccSmrg *" $lib "*) ;; 646288de56ccSmrg *) dlfiles="$dlfiles $lib" ;; 646388de56ccSmrg esac 646488de56ccSmrg done 646588de56ccSmrg 646688de56ccSmrg # Make sure dlprefiles contains only unique files 646788de56ccSmrg old_dlprefiles="$dlprefiles" 646888de56ccSmrg dlprefiles= 646988de56ccSmrg for lib in $old_dlprefiles; do 647088de56ccSmrg case "$dlprefiles " in 647188de56ccSmrg *" $lib "*) ;; 647288de56ccSmrg *) dlprefiles="$dlprefiles $lib" ;; 647388de56ccSmrg esac 647488de56ccSmrg done 647588de56ccSmrg 647688de56ccSmrg if test "$build_libtool_libs" = yes; then 647788de56ccSmrg if test -n "$rpath"; then 647888de56ccSmrg case $host in 647988de56ccSmrg *-*-cygwin* | *-*-mingw* | *-*-pw32* | *-*-os2* | *-*-beos* | *-cegcc*) 648088de56ccSmrg # these systems don't actually have a c library (as such)! 648188de56ccSmrg ;; 648288de56ccSmrg *-*-rhapsody* | *-*-darwin1.[012]) 648388de56ccSmrg # Rhapsody C library is in the System framework 648488de56ccSmrg deplibs="$deplibs System.ltframework" 648588de56ccSmrg ;; 648688de56ccSmrg *-*-netbsd*) 648788de56ccSmrg # Don't link with libc until the a.out ld.so is fixed. 648888de56ccSmrg ;; 648988de56ccSmrg *-*-openbsd* | *-*-freebsd* | *-*-dragonfly*) 649088de56ccSmrg # Do not include libc due to us having libc/libc_r. 649188de56ccSmrg ;; 649288de56ccSmrg *-*-sco3.2v5* | *-*-sco5v6*) 649388de56ccSmrg # Causes problems with __ctype 649488de56ccSmrg ;; 649588de56ccSmrg *-*-sysv4.2uw2* | *-*-sysv5* | *-*-unixware* | *-*-OpenUNIX*) 649688de56ccSmrg # Compiler inserts libc in the correct place for threads to work 649788de56ccSmrg ;; 649888de56ccSmrg *) 649988de56ccSmrg # Add libc to deplibs on all other systems if necessary. 650088de56ccSmrg if test "$build_libtool_need_lc" = "yes"; then 650188de56ccSmrg deplibs="$deplibs -lc" 650288de56ccSmrg fi 650388de56ccSmrg ;; 650488de56ccSmrg esac 650588de56ccSmrg fi 650688de56ccSmrg 650788de56ccSmrg # Transform deplibs into only deplibs that can be linked in shared. 650888de56ccSmrg name_save=$name 650988de56ccSmrg libname_save=$libname 651088de56ccSmrg release_save=$release 651188de56ccSmrg versuffix_save=$versuffix 651288de56ccSmrg major_save=$major 651388de56ccSmrg # I'm not sure if I'm treating the release correctly. I think 651488de56ccSmrg # release should show up in the -l (ie -lgmp5) so we don't want to 651588de56ccSmrg # add it in twice. Is that correct? 651688de56ccSmrg release="" 651788de56ccSmrg versuffix="" 651888de56ccSmrg major="" 651988de56ccSmrg newdeplibs= 652088de56ccSmrg droppeddeps=no 652188de56ccSmrg case $deplibs_check_method in 652288de56ccSmrg pass_all) 652388de56ccSmrg # Don't check for shared/static. Everything works. 652488de56ccSmrg # This might be a little naive. We might want to check 652588de56ccSmrg # whether the library exists or not. But this is on 652688de56ccSmrg # osf3 & osf4 and I'm not really sure... Just 652788de56ccSmrg # implementing what was already the behavior. 652888de56ccSmrg newdeplibs=$deplibs 652988de56ccSmrg ;; 653088de56ccSmrg test_compile) 653188de56ccSmrg # This code stresses the "libraries are programs" paradigm to its 653288de56ccSmrg # limits. Maybe even breaks it. We compile a program, linking it 653388de56ccSmrg # against the deplibs as a proxy for the library. Then we can check 653488de56ccSmrg # whether they linked in statically or dynamically with ldd. 653588de56ccSmrg $opt_dry_run || $RM conftest.c 653688de56ccSmrg cat > conftest.c <<EOF 653788de56ccSmrg int main() { return 0; } 653888de56ccSmrgEOF 653988de56ccSmrg $opt_dry_run || $RM conftest 654088de56ccSmrg if $LTCC $LTCFLAGS -o conftest conftest.c $deplibs; then 654188de56ccSmrg ldd_output=`ldd conftest` 654288de56ccSmrg for i in $deplibs; do 654388de56ccSmrg case $i in 654488de56ccSmrg -l*) 654588de56ccSmrg func_stripname -l '' "$i" 654688de56ccSmrg name=$func_stripname_result 654788de56ccSmrg if test "X$allow_libtool_libs_with_static_runtimes" = "Xyes" ; then 654888de56ccSmrg case " $predeps $postdeps " in 654988de56ccSmrg *" $i "*) 655088de56ccSmrg newdeplibs="$newdeplibs $i" 655188de56ccSmrg i="" 655288de56ccSmrg ;; 655388de56ccSmrg esac 655488de56ccSmrg fi 655588de56ccSmrg if test -n "$i" ; then 655688de56ccSmrg libname=`eval "\\$ECHO \"$libname_spec\""` 655788de56ccSmrg deplib_matches=`eval "\\$ECHO \"$library_names_spec\""` 655888de56ccSmrg set dummy $deplib_matches; shift 655988de56ccSmrg deplib_match=$1 656088de56ccSmrg if test `expr "$ldd_output" : ".*$deplib_match"` -ne 0 ; then 656188de56ccSmrg newdeplibs="$newdeplibs $i" 656288de56ccSmrg else 656388de56ccSmrg droppeddeps=yes 656488de56ccSmrg $ECHO 656588de56ccSmrg $ECHO "*** Warning: dynamic linker does not accept needed library $i." 656688de56ccSmrg $ECHO "*** I have the capability to make that library automatically link in when" 656788de56ccSmrg $ECHO "*** you link to this library. But I can only do this if you have a" 656888de56ccSmrg $ECHO "*** shared version of the library, which I believe you do not have" 656988de56ccSmrg $ECHO "*** because a test_compile did reveal that the linker did not use it for" 657088de56ccSmrg $ECHO "*** its dynamic dependency list that programs get resolved with at runtime." 657188de56ccSmrg fi 657288de56ccSmrg fi 657388de56ccSmrg ;; 657488de56ccSmrg *) 657588de56ccSmrg newdeplibs="$newdeplibs $i" 657688de56ccSmrg ;; 657788de56ccSmrg esac 657888de56ccSmrg done 657988de56ccSmrg else 658088de56ccSmrg # Error occurred in the first compile. Let's try to salvage 658188de56ccSmrg # the situation: Compile a separate program for each library. 658288de56ccSmrg for i in $deplibs; do 658388de56ccSmrg case $i in 658488de56ccSmrg -l*) 658588de56ccSmrg func_stripname -l '' "$i" 658688de56ccSmrg name=$func_stripname_result 658788de56ccSmrg $opt_dry_run || $RM conftest 658888de56ccSmrg if $LTCC $LTCFLAGS -o conftest conftest.c $i; then 658988de56ccSmrg ldd_output=`ldd conftest` 659088de56ccSmrg if test "X$allow_libtool_libs_with_static_runtimes" = "Xyes" ; then 659188de56ccSmrg case " $predeps $postdeps " in 659288de56ccSmrg *" $i "*) 659388de56ccSmrg newdeplibs="$newdeplibs $i" 659488de56ccSmrg i="" 659588de56ccSmrg ;; 659688de56ccSmrg esac 659788de56ccSmrg fi 659888de56ccSmrg if test -n "$i" ; then 659988de56ccSmrg libname=`eval "\\$ECHO \"$libname_spec\""` 660088de56ccSmrg deplib_matches=`eval "\\$ECHO \"$library_names_spec\""` 660188de56ccSmrg set dummy $deplib_matches; shift 660288de56ccSmrg deplib_match=$1 660388de56ccSmrg if test `expr "$ldd_output" : ".*$deplib_match"` -ne 0 ; then 660488de56ccSmrg newdeplibs="$newdeplibs $i" 660588de56ccSmrg else 660688de56ccSmrg droppeddeps=yes 660788de56ccSmrg $ECHO 660888de56ccSmrg $ECHO "*** Warning: dynamic linker does not accept needed library $i." 660988de56ccSmrg $ECHO "*** I have the capability to make that library automatically link in when" 661088de56ccSmrg $ECHO "*** you link to this library. But I can only do this if you have a" 661188de56ccSmrg $ECHO "*** shared version of the library, which you do not appear to have" 661288de56ccSmrg $ECHO "*** because a test_compile did reveal that the linker did not use this one" 661388de56ccSmrg $ECHO "*** as a dynamic dependency that programs can get resolved with at runtime." 661488de56ccSmrg fi 661588de56ccSmrg fi 661688de56ccSmrg else 661788de56ccSmrg droppeddeps=yes 661888de56ccSmrg $ECHO 661988de56ccSmrg $ECHO "*** Warning! Library $i is needed by this library but I was not able to" 662088de56ccSmrg $ECHO "*** make it link in! You will probably need to install it or some" 662188de56ccSmrg $ECHO "*** library that it depends on before this library will be fully" 662288de56ccSmrg $ECHO "*** functional. Installing it before continuing would be even better." 662388de56ccSmrg fi 662488de56ccSmrg ;; 662588de56ccSmrg *) 662688de56ccSmrg newdeplibs="$newdeplibs $i" 662788de56ccSmrg ;; 662888de56ccSmrg esac 662988de56ccSmrg done 663088de56ccSmrg fi 663188de56ccSmrg ;; 663288de56ccSmrg file_magic*) 663388de56ccSmrg set dummy $deplibs_check_method; shift 663488de56ccSmrg file_magic_regex=`expr "$deplibs_check_method" : "$1 \(.*\)"` 663588de56ccSmrg for a_deplib in $deplibs; do 663688de56ccSmrg case $a_deplib in 663788de56ccSmrg -l*) 663888de56ccSmrg func_stripname -l '' "$a_deplib" 663988de56ccSmrg name=$func_stripname_result 664088de56ccSmrg if test "X$allow_libtool_libs_with_static_runtimes" = "Xyes" ; then 664188de56ccSmrg case " $predeps $postdeps " in 664288de56ccSmrg *" $a_deplib "*) 664388de56ccSmrg newdeplibs="$newdeplibs $a_deplib" 664488de56ccSmrg a_deplib="" 664588de56ccSmrg ;; 664688de56ccSmrg esac 664788de56ccSmrg fi 664888de56ccSmrg if test -n "$a_deplib" ; then 664988de56ccSmrg libname=`eval "\\$ECHO \"$libname_spec\""` 665088de56ccSmrg for i in $lib_search_path $sys_lib_search_path $shlib_search_path; do 665188de56ccSmrg potential_libs=`ls $i/$libname[.-]* 2>/dev/null` 665288de56ccSmrg for potent_lib in $potential_libs; do 665388de56ccSmrg # Follow soft links. 665488de56ccSmrg if ls -lLd "$potent_lib" 2>/dev/null | 665588de56ccSmrg $GREP " -> " >/dev/null; then 665688de56ccSmrg continue 665788de56ccSmrg fi 665888de56ccSmrg # The statement above tries to avoid entering an 665988de56ccSmrg # endless loop below, in case of cyclic links. 666088de56ccSmrg # We might still enter an endless loop, since a link 666188de56ccSmrg # loop can be closed while we follow links, 666288de56ccSmrg # but so what? 666388de56ccSmrg potlib="$potent_lib" 666488de56ccSmrg while test -h "$potlib" 2>/dev/null; do 666588de56ccSmrg potliblink=`ls -ld $potlib | ${SED} 's/.* -> //'` 666688de56ccSmrg case $potliblink in 666788de56ccSmrg [\\/]* | [A-Za-z]:[\\/]*) potlib="$potliblink";; 666888de56ccSmrg *) potlib=`$ECHO "X$potlib" | $Xsed -e 's,[^/]*$,,'`"$potliblink";; 666988de56ccSmrg esac 667088de56ccSmrg done 667188de56ccSmrg if eval $file_magic_cmd \"\$potlib\" 2>/dev/null | 667288de56ccSmrg $SED -e 10q | 667388de56ccSmrg $EGREP "$file_magic_regex" > /dev/null; then 667488de56ccSmrg newdeplibs="$newdeplibs $a_deplib" 667588de56ccSmrg a_deplib="" 667688de56ccSmrg break 2 667788de56ccSmrg fi 667888de56ccSmrg done 667988de56ccSmrg done 668088de56ccSmrg fi 668188de56ccSmrg if test -n "$a_deplib" ; then 668288de56ccSmrg droppeddeps=yes 668388de56ccSmrg $ECHO 668488de56ccSmrg $ECHO "*** Warning: linker path does not have real file for library $a_deplib." 668588de56ccSmrg $ECHO "*** I have the capability to make that library automatically link in when" 668688de56ccSmrg $ECHO "*** you link to this library. But I can only do this if you have a" 668788de56ccSmrg $ECHO "*** shared version of the library, which you do not appear to have" 668888de56ccSmrg $ECHO "*** because I did check the linker path looking for a file starting" 668988de56ccSmrg if test -z "$potlib" ; then 669088de56ccSmrg $ECHO "*** with $libname but no candidates were found. (...for file magic test)" 669188de56ccSmrg else 669288de56ccSmrg $ECHO "*** with $libname and none of the candidates passed a file format test" 669388de56ccSmrg $ECHO "*** using a file magic. Last file checked: $potlib" 669488de56ccSmrg fi 669588de56ccSmrg fi 669688de56ccSmrg ;; 669788de56ccSmrg *) 669888de56ccSmrg # Add a -L argument. 669988de56ccSmrg newdeplibs="$newdeplibs $a_deplib" 670088de56ccSmrg ;; 670188de56ccSmrg esac 670288de56ccSmrg done # Gone through all deplibs. 670388de56ccSmrg ;; 670488de56ccSmrg match_pattern*) 670588de56ccSmrg set dummy $deplibs_check_method; shift 670688de56ccSmrg match_pattern_regex=`expr "$deplibs_check_method" : "$1 \(.*\)"` 670788de56ccSmrg for a_deplib in $deplibs; do 670888de56ccSmrg case $a_deplib in 670988de56ccSmrg -l*) 671088de56ccSmrg func_stripname -l '' "$a_deplib" 671188de56ccSmrg name=$func_stripname_result 671288de56ccSmrg if test "X$allow_libtool_libs_with_static_runtimes" = "Xyes" ; then 671388de56ccSmrg case " $predeps $postdeps " in 671488de56ccSmrg *" $a_deplib "*) 671588de56ccSmrg newdeplibs="$newdeplibs $a_deplib" 671688de56ccSmrg a_deplib="" 671788de56ccSmrg ;; 671888de56ccSmrg esac 671988de56ccSmrg fi 672088de56ccSmrg if test -n "$a_deplib" ; then 672188de56ccSmrg libname=`eval "\\$ECHO \"$libname_spec\""` 672288de56ccSmrg for i in $lib_search_path $sys_lib_search_path $shlib_search_path; do 672388de56ccSmrg potential_libs=`ls $i/$libname[.-]* 2>/dev/null` 672488de56ccSmrg for potent_lib in $potential_libs; do 672588de56ccSmrg potlib="$potent_lib" # see symlink-check above in file_magic test 672688de56ccSmrg if eval "\$ECHO \"X$potent_lib\"" 2>/dev/null | $Xsed -e 10q | \ 672788de56ccSmrg $EGREP "$match_pattern_regex" > /dev/null; then 672888de56ccSmrg newdeplibs="$newdeplibs $a_deplib" 672988de56ccSmrg a_deplib="" 673088de56ccSmrg break 2 673188de56ccSmrg fi 673288de56ccSmrg done 673388de56ccSmrg done 673488de56ccSmrg fi 673588de56ccSmrg if test -n "$a_deplib" ; then 673688de56ccSmrg droppeddeps=yes 673788de56ccSmrg $ECHO 673888de56ccSmrg $ECHO "*** Warning: linker path does not have real file for library $a_deplib." 673988de56ccSmrg $ECHO "*** I have the capability to make that library automatically link in when" 674088de56ccSmrg $ECHO "*** you link to this library. But I can only do this if you have a" 674188de56ccSmrg $ECHO "*** shared version of the library, which you do not appear to have" 674288de56ccSmrg $ECHO "*** because I did check the linker path looking for a file starting" 674388de56ccSmrg if test -z "$potlib" ; then 674488de56ccSmrg $ECHO "*** with $libname but no candidates were found. (...for regex pattern test)" 674588de56ccSmrg else 674688de56ccSmrg $ECHO "*** with $libname and none of the candidates passed a file format test" 674788de56ccSmrg $ECHO "*** using a regex pattern. Last file checked: $potlib" 674888de56ccSmrg fi 674988de56ccSmrg fi 675088de56ccSmrg ;; 675188de56ccSmrg *) 675288de56ccSmrg # Add a -L argument. 675388de56ccSmrg newdeplibs="$newdeplibs $a_deplib" 675488de56ccSmrg ;; 675588de56ccSmrg esac 675688de56ccSmrg done # Gone through all deplibs. 675788de56ccSmrg ;; 675888de56ccSmrg none | unknown | *) 675988de56ccSmrg newdeplibs="" 676088de56ccSmrg tmp_deplibs=`$ECHO "X $deplibs" | $Xsed \ 676188de56ccSmrg -e 's/ -lc$//' -e 's/ -[LR][^ ]*//g'` 676288de56ccSmrg if test "X$allow_libtool_libs_with_static_runtimes" = "Xyes" ; then 676388de56ccSmrg for i in $predeps $postdeps ; do 676488de56ccSmrg # can't use Xsed below, because $i might contain '/' 676588de56ccSmrg tmp_deplibs=`$ECHO "X $tmp_deplibs" | $Xsed -e "s,$i,,"` 676688de56ccSmrg done 676788de56ccSmrg fi 676888de56ccSmrg if $ECHO "X $tmp_deplibs" | $Xsed -e 's/[ ]//g' | 676988de56ccSmrg $GREP . >/dev/null; then 677088de56ccSmrg $ECHO 677188de56ccSmrg if test "X$deplibs_check_method" = "Xnone"; then 677288de56ccSmrg $ECHO "*** Warning: inter-library dependencies are not supported in this platform." 677388de56ccSmrg else 677488de56ccSmrg $ECHO "*** Warning: inter-library dependencies are not known to be supported." 677588de56ccSmrg fi 677688de56ccSmrg $ECHO "*** All declared inter-library dependencies are being dropped." 677788de56ccSmrg droppeddeps=yes 677888de56ccSmrg fi 677988de56ccSmrg ;; 678088de56ccSmrg esac 678188de56ccSmrg versuffix=$versuffix_save 678288de56ccSmrg major=$major_save 678388de56ccSmrg release=$release_save 678488de56ccSmrg libname=$libname_save 678588de56ccSmrg name=$name_save 678688de56ccSmrg 678788de56ccSmrg case $host in 678888de56ccSmrg *-*-rhapsody* | *-*-darwin1.[012]) 678988de56ccSmrg # On Rhapsody replace the C library with the System framework 679088de56ccSmrg newdeplibs=`$ECHO "X $newdeplibs" | $Xsed -e 's/ -lc / System.ltframework /'` 679188de56ccSmrg ;; 679288de56ccSmrg esac 679388de56ccSmrg 679488de56ccSmrg if test "$droppeddeps" = yes; then 679588de56ccSmrg if test "$module" = yes; then 679688de56ccSmrg $ECHO 679788de56ccSmrg $ECHO "*** Warning: libtool could not satisfy all declared inter-library" 679888de56ccSmrg $ECHO "*** dependencies of module $libname. Therefore, libtool will create" 679988de56ccSmrg $ECHO "*** a static module, that should work as long as the dlopening" 680088de56ccSmrg $ECHO "*** application is linked with the -dlopen flag." 680188de56ccSmrg if test -z "$global_symbol_pipe"; then 680288de56ccSmrg $ECHO 680388de56ccSmrg $ECHO "*** However, this would only work if libtool was able to extract symbol" 680488de56ccSmrg $ECHO "*** lists from a program, using \`nm' or equivalent, but libtool could" 680588de56ccSmrg $ECHO "*** not find such a program. So, this module is probably useless." 680688de56ccSmrg $ECHO "*** \`nm' from GNU binutils and a full rebuild may help." 680788de56ccSmrg fi 680888de56ccSmrg if test "$build_old_libs" = no; then 680988de56ccSmrg oldlibs="$output_objdir/$libname.$libext" 681088de56ccSmrg build_libtool_libs=module 681188de56ccSmrg build_old_libs=yes 681288de56ccSmrg else 681388de56ccSmrg build_libtool_libs=no 681488de56ccSmrg fi 681588de56ccSmrg else 681688de56ccSmrg $ECHO "*** The inter-library dependencies that have been dropped here will be" 681788de56ccSmrg $ECHO "*** automatically added whenever a program is linked with this library" 681888de56ccSmrg $ECHO "*** or is declared to -dlopen it." 681988de56ccSmrg 682088de56ccSmrg if test "$allow_undefined" = no; then 682188de56ccSmrg $ECHO 682288de56ccSmrg $ECHO "*** Since this library must not contain undefined symbols," 682388de56ccSmrg $ECHO "*** because either the platform does not support them or" 682488de56ccSmrg $ECHO "*** it was explicitly requested with -no-undefined," 682588de56ccSmrg $ECHO "*** libtool will only create a static version of it." 682688de56ccSmrg if test "$build_old_libs" = no; then 682788de56ccSmrg oldlibs="$output_objdir/$libname.$libext" 682888de56ccSmrg build_libtool_libs=module 682988de56ccSmrg build_old_libs=yes 683088de56ccSmrg else 683188de56ccSmrg build_libtool_libs=no 683288de56ccSmrg fi 683388de56ccSmrg fi 683488de56ccSmrg fi 683588de56ccSmrg fi 683688de56ccSmrg # Done checking deplibs! 683788de56ccSmrg deplibs=$newdeplibs 683888de56ccSmrg fi 683988de56ccSmrg # Time to change all our "foo.ltframework" stuff back to "-framework foo" 684088de56ccSmrg case $host in 684188de56ccSmrg *-*-darwin*) 684288de56ccSmrg newdeplibs=`$ECHO "X $newdeplibs" | $Xsed -e 's% \([^ $]*\).ltframework% -framework \1%g'` 684388de56ccSmrg new_inherited_linker_flags=`$ECHO "X $new_inherited_linker_flags" | $Xsed -e 's% \([^ $]*\).ltframework% -framework \1%g'` 684488de56ccSmrg deplibs=`$ECHO "X $deplibs" | $Xsed -e 's% \([^ $]*\).ltframework% -framework \1%g'` 684588de56ccSmrg ;; 684688de56ccSmrg esac 684788de56ccSmrg 684888de56ccSmrg # move library search paths that coincide with paths to not yet 684988de56ccSmrg # installed libraries to the beginning of the library search list 685088de56ccSmrg new_libs= 685188de56ccSmrg for path in $notinst_path; do 685288de56ccSmrg case " $new_libs " in 685388de56ccSmrg *" -L$path/$objdir "*) ;; 685488de56ccSmrg *) 685588de56ccSmrg case " $deplibs " in 685688de56ccSmrg *" -L$path/$objdir "*) 685788de56ccSmrg new_libs="$new_libs -L$path/$objdir" ;; 685888de56ccSmrg esac 685988de56ccSmrg ;; 686088de56ccSmrg esac 686188de56ccSmrg done 686288de56ccSmrg for deplib in $deplibs; do 686388de56ccSmrg case $deplib in 686488de56ccSmrg -L*) 686588de56ccSmrg case " $new_libs " in 686688de56ccSmrg *" $deplib "*) ;; 686788de56ccSmrg *) new_libs="$new_libs $deplib" ;; 686888de56ccSmrg esac 686988de56ccSmrg ;; 687088de56ccSmrg *) new_libs="$new_libs $deplib" ;; 687188de56ccSmrg esac 687288de56ccSmrg done 687388de56ccSmrg deplibs="$new_libs" 687488de56ccSmrg 687588de56ccSmrg # All the library-specific variables (install_libdir is set above). 687688de56ccSmrg library_names= 687788de56ccSmrg old_library= 687888de56ccSmrg dlname= 687988de56ccSmrg 688088de56ccSmrg # Test again, we may have decided not to build it any more 688188de56ccSmrg if test "$build_libtool_libs" = yes; then 688288de56ccSmrg if test "$hardcode_into_libs" = yes; then 688388de56ccSmrg # Hardcode the library paths 688488de56ccSmrg hardcode_libdirs= 688588de56ccSmrg dep_rpath= 688688de56ccSmrg rpath="$finalize_rpath" 688788de56ccSmrg test "$mode" != relink && rpath="$compile_rpath$rpath" 688888de56ccSmrg for libdir in $rpath; do 688988de56ccSmrg if test -n "$hardcode_libdir_flag_spec"; then 689088de56ccSmrg if test -n "$hardcode_libdir_separator"; then 689188de56ccSmrg if test -z "$hardcode_libdirs"; then 689288de56ccSmrg hardcode_libdirs="$libdir" 689388de56ccSmrg else 689488de56ccSmrg # Just accumulate the unique libdirs. 689588de56ccSmrg case $hardcode_libdir_separator$hardcode_libdirs$hardcode_libdir_separator in 689688de56ccSmrg *"$hardcode_libdir_separator$libdir$hardcode_libdir_separator"*) 689788de56ccSmrg ;; 689888de56ccSmrg *) 689988de56ccSmrg hardcode_libdirs="$hardcode_libdirs$hardcode_libdir_separator$libdir" 690088de56ccSmrg ;; 690188de56ccSmrg esac 690288de56ccSmrg fi 690388de56ccSmrg else 690488de56ccSmrg eval flag=\"$hardcode_libdir_flag_spec\" 690588de56ccSmrg dep_rpath="$dep_rpath $flag" 690688de56ccSmrg fi 690788de56ccSmrg elif test -n "$runpath_var"; then 690888de56ccSmrg case "$perm_rpath " in 690988de56ccSmrg *" $libdir "*) ;; 691088de56ccSmrg *) perm_rpath="$perm_rpath $libdir" ;; 691188de56ccSmrg esac 691288de56ccSmrg fi 691388de56ccSmrg done 691488de56ccSmrg # Substitute the hardcoded libdirs into the rpath. 691588de56ccSmrg if test -n "$hardcode_libdir_separator" && 691688de56ccSmrg test -n "$hardcode_libdirs"; then 691788de56ccSmrg libdir="$hardcode_libdirs" 691888de56ccSmrg if test -n "$hardcode_libdir_flag_spec_ld"; then 691988de56ccSmrg eval dep_rpath=\"$hardcode_libdir_flag_spec_ld\" 692088de56ccSmrg else 692188de56ccSmrg eval dep_rpath=\"$hardcode_libdir_flag_spec\" 692288de56ccSmrg fi 692388de56ccSmrg fi 692488de56ccSmrg if test -n "$runpath_var" && test -n "$perm_rpath"; then 692588de56ccSmrg # We should set the runpath_var. 692688de56ccSmrg rpath= 692788de56ccSmrg for dir in $perm_rpath; do 692888de56ccSmrg rpath="$rpath$dir:" 692988de56ccSmrg done 693088de56ccSmrg eval "$runpath_var='$rpath\$$runpath_var'; export $runpath_var" 693188de56ccSmrg fi 693288de56ccSmrg test -n "$dep_rpath" && deplibs="$dep_rpath $deplibs" 693388de56ccSmrg fi 69341ab64890Smrg 693588de56ccSmrg shlibpath="$finalize_shlibpath" 693688de56ccSmrg test "$mode" != relink && shlibpath="$compile_shlibpath$shlibpath" 693788de56ccSmrg if test -n "$shlibpath"; then 693888de56ccSmrg eval "$shlibpath_var='$shlibpath\$$shlibpath_var'; export $shlibpath_var" 693988de56ccSmrg fi 69401ab64890Smrg 694188de56ccSmrg # Get the real and link names of the library. 694288de56ccSmrg eval shared_ext=\"$shrext_cmds\" 694388de56ccSmrg eval library_names=\"$library_names_spec\" 694488de56ccSmrg set dummy $library_names 694588de56ccSmrg shift 694688de56ccSmrg realname="$1" 694788de56ccSmrg shift 69481ab64890Smrg 694988de56ccSmrg if test -n "$soname_spec"; then 695088de56ccSmrg eval soname=\"$soname_spec\" 695188de56ccSmrg else 695288de56ccSmrg soname="$realname" 695388de56ccSmrg fi 695488de56ccSmrg if test -z "$dlname"; then 695588de56ccSmrg dlname=$soname 695688de56ccSmrg fi 69571ab64890Smrg 695888de56ccSmrg lib="$output_objdir/$realname" 695988de56ccSmrg linknames= 696088de56ccSmrg for link 696188de56ccSmrg do 696288de56ccSmrg linknames="$linknames $link" 696388de56ccSmrg done 69641ab64890Smrg 696588de56ccSmrg # Use standard objects if they are pic 696688de56ccSmrg test -z "$pic_flag" && libobjs=`$ECHO "X$libobjs" | $SP2NL | $Xsed -e "$lo2o" | $NL2SP` 696788de56ccSmrg test "X$libobjs" = "X " && libobjs= 69681ab64890Smrg 696988de56ccSmrg delfiles= 697088de56ccSmrg if test -n "$export_symbols" && test -n "$include_expsyms"; then 697188de56ccSmrg $opt_dry_run || cp "$export_symbols" "$output_objdir/$libname.uexp" 697288de56ccSmrg export_symbols="$output_objdir/$libname.uexp" 697388de56ccSmrg delfiles="$delfiles $export_symbols" 697488de56ccSmrg fi 69751ab64890Smrg 697688de56ccSmrg orig_export_symbols= 697788de56ccSmrg case $host_os in 697888de56ccSmrg cygwin* | mingw* | cegcc*) 697988de56ccSmrg if test -n "$export_symbols" && test -z "$export_symbols_regex"; then 698088de56ccSmrg # exporting using user supplied symfile 698188de56ccSmrg if test "x`$SED 1q $export_symbols`" != xEXPORTS; then 698288de56ccSmrg # and it's NOT already a .def file. Must figure out 698388de56ccSmrg # which of the given symbols are data symbols and tag 698488de56ccSmrg # them as such. So, trigger use of export_symbols_cmds. 698588de56ccSmrg # export_symbols gets reassigned inside the "prepare 698688de56ccSmrg # the list of exported symbols" if statement, so the 698788de56ccSmrg # include_expsyms logic still works. 698888de56ccSmrg orig_export_symbols="$export_symbols" 698988de56ccSmrg export_symbols= 699088de56ccSmrg always_export_symbols=yes 699188de56ccSmrg fi 699288de56ccSmrg fi 699388de56ccSmrg ;; 699488de56ccSmrg esac 69951ab64890Smrg 699688de56ccSmrg # Prepare the list of exported symbols 699788de56ccSmrg if test -z "$export_symbols"; then 699888de56ccSmrg if test "$always_export_symbols" = yes || test -n "$export_symbols_regex"; then 699988de56ccSmrg func_verbose "generating symbol list for \`$libname.la'" 700088de56ccSmrg export_symbols="$output_objdir/$libname.exp" 700188de56ccSmrg $opt_dry_run || $RM $export_symbols 700288de56ccSmrg cmds=$export_symbols_cmds 700388de56ccSmrg save_ifs="$IFS"; IFS='~' 700488de56ccSmrg for cmd in $cmds; do 700588de56ccSmrg IFS="$save_ifs" 700688de56ccSmrg eval cmd=\"$cmd\" 700788de56ccSmrg func_len " $cmd" 700888de56ccSmrg len=$func_len_result 700988de56ccSmrg if test "$len" -lt "$max_cmd_len" || test "$max_cmd_len" -le -1; then 701088de56ccSmrg func_show_eval "$cmd" 'exit $?' 701188de56ccSmrg skipped_export=false 701288de56ccSmrg else 701388de56ccSmrg # The command line is too long to execute in one step. 701488de56ccSmrg func_verbose "using reloadable object file for export list..." 701588de56ccSmrg skipped_export=: 701688de56ccSmrg # Break out early, otherwise skipped_export may be 701788de56ccSmrg # set to false by a later but shorter cmd. 701888de56ccSmrg break 701988de56ccSmrg fi 702088de56ccSmrg done 702188de56ccSmrg IFS="$save_ifs" 702288de56ccSmrg if test -n "$export_symbols_regex" && test "X$skipped_export" != "X:"; then 702388de56ccSmrg func_show_eval '$EGREP -e "$export_symbols_regex" "$export_symbols" > "${export_symbols}T"' 702488de56ccSmrg func_show_eval '$MV "${export_symbols}T" "$export_symbols"' 702588de56ccSmrg fi 702688de56ccSmrg fi 70271ab64890Smrg fi 70281ab64890Smrg 702988de56ccSmrg if test -n "$export_symbols" && test -n "$include_expsyms"; then 703088de56ccSmrg tmp_export_symbols="$export_symbols" 703188de56ccSmrg test -n "$orig_export_symbols" && tmp_export_symbols="$orig_export_symbols" 703288de56ccSmrg $opt_dry_run || eval '$ECHO "X$include_expsyms" | $Xsed | $SP2NL >> "$tmp_export_symbols"' 703388de56ccSmrg fi 70341ab64890Smrg 703588de56ccSmrg if test "X$skipped_export" != "X:" && test -n "$orig_export_symbols"; then 703688de56ccSmrg # The given exports_symbols file has to be filtered, so filter it. 703788de56ccSmrg func_verbose "filter symbol list for \`$libname.la' to tag DATA exports" 703888de56ccSmrg # FIXME: $output_objdir/$libname.filter potentially contains lots of 703988de56ccSmrg # 's' commands which not all seds can handle. GNU sed should be fine 704088de56ccSmrg # though. Also, the filter scales superlinearly with the number of 704188de56ccSmrg # global variables. join(1) would be nice here, but unfortunately 704288de56ccSmrg # isn't a blessed tool. 704388de56ccSmrg $opt_dry_run || $SED -e '/[ ,]DATA/!d;s,\(.*\)\([ \,].*\),s|^\1$|\1\2|,' < $export_symbols > $output_objdir/$libname.filter 704488de56ccSmrg delfiles="$delfiles $export_symbols $output_objdir/$libname.filter" 704588de56ccSmrg export_symbols=$output_objdir/$libname.def 704688de56ccSmrg $opt_dry_run || $SED -f $output_objdir/$libname.filter < $orig_export_symbols > $export_symbols 704788de56ccSmrg fi 70481ab64890Smrg 704988de56ccSmrg tmp_deplibs= 705088de56ccSmrg for test_deplib in $deplibs; do 705188de56ccSmrg case " $convenience " in 705288de56ccSmrg *" $test_deplib "*) ;; 705388de56ccSmrg *) 705488de56ccSmrg tmp_deplibs="$tmp_deplibs $test_deplib" 705588de56ccSmrg ;; 705688de56ccSmrg esac 705788de56ccSmrg done 705888de56ccSmrg deplibs="$tmp_deplibs" 70591ab64890Smrg 706088de56ccSmrg if test -n "$convenience"; then 706188de56ccSmrg if test -n "$whole_archive_flag_spec" && 706288de56ccSmrg test "$compiler_needs_object" = yes && 706388de56ccSmrg test -z "$libobjs"; then 706488de56ccSmrg # extract the archives, so we have objects to list. 706588de56ccSmrg # TODO: could optimize this to just extract one archive. 706688de56ccSmrg whole_archive_flag_spec= 706788de56ccSmrg fi 706888de56ccSmrg if test -n "$whole_archive_flag_spec"; then 706988de56ccSmrg save_libobjs=$libobjs 707088de56ccSmrg eval libobjs=\"\$libobjs $whole_archive_flag_spec\" 707188de56ccSmrg test "X$libobjs" = "X " && libobjs= 707288de56ccSmrg else 707388de56ccSmrg gentop="$output_objdir/${outputname}x" 707488de56ccSmrg generated="$generated $gentop" 70751ab64890Smrg 707688de56ccSmrg func_extract_archives $gentop $convenience 707788de56ccSmrg libobjs="$libobjs $func_extract_archives_result" 707888de56ccSmrg test "X$libobjs" = "X " && libobjs= 707988de56ccSmrg fi 7080b4ee4795Smrg fi 70811ab64890Smrg 708288de56ccSmrg if test "$thread_safe" = yes && test -n "$thread_safe_flag_spec"; then 708388de56ccSmrg eval flag=\"$thread_safe_flag_spec\" 708488de56ccSmrg linker_flags="$linker_flags $flag" 7085b4ee4795Smrg fi 70862e9c7c8cSmrg 708788de56ccSmrg # Make a backup of the uninstalled library when relinking 708888de56ccSmrg if test "$mode" = relink; then 708988de56ccSmrg $opt_dry_run || eval '(cd $output_objdir && $RM ${realname}U && $MV $realname ${realname}U)' || exit $? 709088de56ccSmrg fi 70911ab64890Smrg 709288de56ccSmrg # Do each of the archive commands. 709388de56ccSmrg if test "$module" = yes && test -n "$module_cmds" ; then 709488de56ccSmrg if test -n "$export_symbols" && test -n "$module_expsym_cmds"; then 709588de56ccSmrg eval test_cmds=\"$module_expsym_cmds\" 709688de56ccSmrg cmds=$module_expsym_cmds 709788de56ccSmrg else 709888de56ccSmrg eval test_cmds=\"$module_cmds\" 709988de56ccSmrg cmds=$module_cmds 710088de56ccSmrg fi 7101b4ee4795Smrg else 710288de56ccSmrg if test -n "$export_symbols" && test -n "$archive_expsym_cmds"; then 710388de56ccSmrg eval test_cmds=\"$archive_expsym_cmds\" 710488de56ccSmrg cmds=$archive_expsym_cmds 710588de56ccSmrg else 710688de56ccSmrg eval test_cmds=\"$archive_cmds\" 710788de56ccSmrg cmds=$archive_cmds 710888de56ccSmrg fi 7109b4ee4795Smrg fi 71101ab64890Smrg 711188de56ccSmrg if test "X$skipped_export" != "X:" && 711288de56ccSmrg func_len " $test_cmds" && 711388de56ccSmrg len=$func_len_result && 711488de56ccSmrg test "$len" -lt "$max_cmd_len" || test "$max_cmd_len" -le -1; then 711588de56ccSmrg : 711688de56ccSmrg else 711788de56ccSmrg # The command line is too long to link in one step, link piecewise 711888de56ccSmrg # or, if using GNU ld and skipped_export is not :, use a linker 711988de56ccSmrg # script. 71201ab64890Smrg 712188de56ccSmrg # Save the value of $output and $libobjs because we want to 712288de56ccSmrg # use them later. If we have whole_archive_flag_spec, we 712388de56ccSmrg # want to use save_libobjs as it was before 712488de56ccSmrg # whole_archive_flag_spec was expanded, because we can't 712588de56ccSmrg # assume the linker understands whole_archive_flag_spec. 712688de56ccSmrg # This may have to be revisited, in case too many 712788de56ccSmrg # convenience libraries get linked in and end up exceeding 712888de56ccSmrg # the spec. 712988de56ccSmrg if test -z "$convenience" || test -z "$whole_archive_flag_spec"; then 713088de56ccSmrg save_libobjs=$libobjs 713188de56ccSmrg fi 713288de56ccSmrg save_output=$output 713388de56ccSmrg output_la=`$ECHO "X$output" | $Xsed -e "$basename"` 71341ab64890Smrg 713588de56ccSmrg # Clear the reloadable object creation command queue and 713688de56ccSmrg # initialize k to one. 713788de56ccSmrg test_cmds= 713888de56ccSmrg concat_cmds= 713988de56ccSmrg objlist= 714088de56ccSmrg last_robj= 714188de56ccSmrg k=1 714288de56ccSmrg 714388de56ccSmrg if test -n "$save_libobjs" && test "X$skipped_export" != "X:" && test "$with_gnu_ld" = yes; then 714488de56ccSmrg output=${output_objdir}/${output_la}.lnkscript 714588de56ccSmrg func_verbose "creating GNU ld script: $output" 714688de56ccSmrg $ECHO 'INPUT (' > $output 714788de56ccSmrg for obj in $save_libobjs 7148b4ee4795Smrg do 714988de56ccSmrg $ECHO "$obj" >> $output 715088de56ccSmrg done 715188de56ccSmrg $ECHO ')' >> $output 715288de56ccSmrg delfiles="$delfiles $output" 715388de56ccSmrg elif test -n "$save_libobjs" && test "X$skipped_export" != "X:" && test "X$file_list_spec" != X; then 715488de56ccSmrg output=${output_objdir}/${output_la}.lnk 715588de56ccSmrg func_verbose "creating linker input file list: $output" 715688de56ccSmrg : > $output 715788de56ccSmrg set x $save_libobjs 715888de56ccSmrg shift 715988de56ccSmrg firstobj= 716088de56ccSmrg if test "$compiler_needs_object" = yes; then 716188de56ccSmrg firstobj="$1 " 716288de56ccSmrg shift 716388de56ccSmrg fi 716488de56ccSmrg for obj 716588de56ccSmrg do 716688de56ccSmrg $ECHO "$obj" >> $output 716788de56ccSmrg done 716888de56ccSmrg delfiles="$delfiles $output" 716988de56ccSmrg output=$firstobj\"$file_list_spec$output\" 717088de56ccSmrg else 717188de56ccSmrg if test -n "$save_libobjs"; then 717288de56ccSmrg func_verbose "creating reloadable object files..." 717388de56ccSmrg output=$output_objdir/$output_la-${k}.$objext 717488de56ccSmrg eval test_cmds=\"$reload_cmds\" 717588de56ccSmrg func_len " $test_cmds" 717688de56ccSmrg len0=$func_len_result 717788de56ccSmrg len=$len0 717888de56ccSmrg 717988de56ccSmrg # Loop over the list of objects to be linked. 718088de56ccSmrg for obj in $save_libobjs 718188de56ccSmrg do 718288de56ccSmrg func_len " $obj" 718388de56ccSmrg func_arith $len + $func_len_result 718488de56ccSmrg len=$func_arith_result 718588de56ccSmrg if test "X$objlist" = X || 718688de56ccSmrg test "$len" -lt "$max_cmd_len"; then 718788de56ccSmrg func_append objlist " $obj" 718888de56ccSmrg else 718988de56ccSmrg # The command $test_cmds is almost too long, add a 719088de56ccSmrg # command to the queue. 719188de56ccSmrg if test "$k" -eq 1 ; then 719288de56ccSmrg # The first file doesn't have a previous command to add. 719388de56ccSmrg eval concat_cmds=\"$reload_cmds $objlist $last_robj\" 719488de56ccSmrg else 719588de56ccSmrg # All subsequent reloadable object files will link in 719688de56ccSmrg # the last one created. 719788de56ccSmrg eval concat_cmds=\"\$concat_cmds~$reload_cmds $objlist $last_robj~\$RM $last_robj\" 719888de56ccSmrg fi 719988de56ccSmrg last_robj=$output_objdir/$output_la-${k}.$objext 720088de56ccSmrg func_arith $k + 1 720188de56ccSmrg k=$func_arith_result 720288de56ccSmrg output=$output_objdir/$output_la-${k}.$objext 720388de56ccSmrg objlist=$obj 720488de56ccSmrg func_len " $last_robj" 720588de56ccSmrg func_arith $len0 + $func_len_result 720688de56ccSmrg len=$func_arith_result 720788de56ccSmrg fi 720888de56ccSmrg done 720988de56ccSmrg # Handle the remaining objects by creating one last 721088de56ccSmrg # reloadable object file. All subsequent reloadable object 721188de56ccSmrg # files will link in the last one created. 721288de56ccSmrg test -z "$concat_cmds" || concat_cmds=$concat_cmds~ 721388de56ccSmrg eval concat_cmds=\"\${concat_cmds}$reload_cmds $objlist $last_robj\" 721488de56ccSmrg if test -n "$last_robj"; then 721588de56ccSmrg eval concat_cmds=\"\${concat_cmds}~\$RM $last_robj\" 721688de56ccSmrg fi 721788de56ccSmrg delfiles="$delfiles $output" 72181ab64890Smrg 721988de56ccSmrg else 722088de56ccSmrg output= 722188de56ccSmrg fi 72221ab64890Smrg 722388de56ccSmrg if ${skipped_export-false}; then 722488de56ccSmrg func_verbose "generating symbol list for \`$libname.la'" 722588de56ccSmrg export_symbols="$output_objdir/$libname.exp" 722688de56ccSmrg $opt_dry_run || $RM $export_symbols 722788de56ccSmrg libobjs=$output 722888de56ccSmrg # Append the command to create the export file. 722988de56ccSmrg test -z "$concat_cmds" || concat_cmds=$concat_cmds~ 723088de56ccSmrg eval concat_cmds=\"\$concat_cmds$export_symbols_cmds\" 723188de56ccSmrg if test -n "$last_robj"; then 723288de56ccSmrg eval concat_cmds=\"\$concat_cmds~\$RM $last_robj\" 723388de56ccSmrg fi 72342e9c7c8cSmrg fi 72351ab64890Smrg 723688de56ccSmrg test -n "$save_libobjs" && 723788de56ccSmrg func_verbose "creating a temporary reloadable object file: $output" 72381ab64890Smrg 723988de56ccSmrg # Loop through the commands generated above and execute them. 724088de56ccSmrg save_ifs="$IFS"; IFS='~' 724188de56ccSmrg for cmd in $concat_cmds; do 724288de56ccSmrg IFS="$save_ifs" 724388de56ccSmrg $opt_silent || { 724488de56ccSmrg func_quote_for_expand "$cmd" 724588de56ccSmrg eval "func_echo $func_quote_for_expand_result" 724688de56ccSmrg } 724788de56ccSmrg $opt_dry_run || eval "$cmd" || { 724888de56ccSmrg lt_exit=$? 724988de56ccSmrg 725088de56ccSmrg # Restore the uninstalled library and exit 725188de56ccSmrg if test "$mode" = relink; then 725288de56ccSmrg ( cd "$output_objdir" && \ 725388de56ccSmrg $RM "${realname}T" && \ 725488de56ccSmrg $MV "${realname}U" "$realname" ) 725588de56ccSmrg fi 72561ab64890Smrg 725788de56ccSmrg exit $lt_exit 725888de56ccSmrg } 725988de56ccSmrg done 726088de56ccSmrg IFS="$save_ifs" 7261b4ee4795Smrg 726288de56ccSmrg if test -n "$export_symbols_regex" && ${skipped_export-false}; then 726388de56ccSmrg func_show_eval '$EGREP -e "$export_symbols_regex" "$export_symbols" > "${export_symbols}T"' 726488de56ccSmrg func_show_eval '$MV "${export_symbols}T" "$export_symbols"' 72651ab64890Smrg fi 72661ab64890Smrg fi 72671ab64890Smrg 726888de56ccSmrg if ${skipped_export-false}; then 726988de56ccSmrg if test -n "$export_symbols" && test -n "$include_expsyms"; then 727088de56ccSmrg tmp_export_symbols="$export_symbols" 727188de56ccSmrg test -n "$orig_export_symbols" && tmp_export_symbols="$orig_export_symbols" 727288de56ccSmrg $opt_dry_run || eval '$ECHO "X$include_expsyms" | $Xsed | $SP2NL >> "$tmp_export_symbols"' 727388de56ccSmrg fi 72742e9c7c8cSmrg 727588de56ccSmrg if test -n "$orig_export_symbols"; then 727688de56ccSmrg # The given exports_symbols file has to be filtered, so filter it. 727788de56ccSmrg func_verbose "filter symbol list for \`$libname.la' to tag DATA exports" 727888de56ccSmrg # FIXME: $output_objdir/$libname.filter potentially contains lots of 727988de56ccSmrg # 's' commands which not all seds can handle. GNU sed should be fine 728088de56ccSmrg # though. Also, the filter scales superlinearly with the number of 728188de56ccSmrg # global variables. join(1) would be nice here, but unfortunately 728288de56ccSmrg # isn't a blessed tool. 728388de56ccSmrg $opt_dry_run || $SED -e '/[ ,]DATA/!d;s,\(.*\)\([ \,].*\),s|^\1$|\1\2|,' < $export_symbols > $output_objdir/$libname.filter 728488de56ccSmrg delfiles="$delfiles $export_symbols $output_objdir/$libname.filter" 728588de56ccSmrg export_symbols=$output_objdir/$libname.def 728688de56ccSmrg $opt_dry_run || $SED -f $output_objdir/$libname.filter < $orig_export_symbols > $export_symbols 728788de56ccSmrg fi 728888de56ccSmrg fi 72891ab64890Smrg 729088de56ccSmrg libobjs=$output 729188de56ccSmrg # Restore the value of output. 729288de56ccSmrg output=$save_output 72931ab64890Smrg 729488de56ccSmrg if test -n "$convenience" && test -n "$whole_archive_flag_spec"; then 729588de56ccSmrg eval libobjs=\"\$libobjs $whole_archive_flag_spec\" 729688de56ccSmrg test "X$libobjs" = "X " && libobjs= 729788de56ccSmrg fi 729888de56ccSmrg # Expand the library linking commands again to reset the 729988de56ccSmrg # value of $libobjs for piecewise linking. 73001ab64890Smrg 730188de56ccSmrg # Do each of the archive commands. 730288de56ccSmrg if test "$module" = yes && test -n "$module_cmds" ; then 730388de56ccSmrg if test -n "$export_symbols" && test -n "$module_expsym_cmds"; then 730488de56ccSmrg cmds=$module_expsym_cmds 730588de56ccSmrg else 730688de56ccSmrg cmds=$module_cmds 7307b4ee4795Smrg fi 7308b4ee4795Smrg else 730988de56ccSmrg if test -n "$export_symbols" && test -n "$archive_expsym_cmds"; then 731088de56ccSmrg cmds=$archive_expsym_cmds 731188de56ccSmrg else 731288de56ccSmrg cmds=$archive_cmds 731388de56ccSmrg fi 7314b4ee4795Smrg fi 731588de56ccSmrg fi 73161ab64890Smrg 731788de56ccSmrg if test -n "$delfiles"; then 731888de56ccSmrg # Append the command to remove temporary files to $cmds. 731988de56ccSmrg eval cmds=\"\$cmds~\$RM $delfiles\" 732088de56ccSmrg fi 73211ab64890Smrg 732288de56ccSmrg # Add any objects from preloaded convenience libraries 732388de56ccSmrg if test -n "$dlprefiles"; then 732488de56ccSmrg gentop="$output_objdir/${outputname}x" 732588de56ccSmrg generated="$generated $gentop" 73261ab64890Smrg 732788de56ccSmrg func_extract_archives $gentop $dlprefiles 732888de56ccSmrg libobjs="$libobjs $func_extract_archives_result" 732988de56ccSmrg test "X$libobjs" = "X " && libobjs= 733088de56ccSmrg fi 73311ab64890Smrg 733288de56ccSmrg save_ifs="$IFS"; IFS='~' 733388de56ccSmrg for cmd in $cmds; do 733488de56ccSmrg IFS="$save_ifs" 733588de56ccSmrg eval cmd=\"$cmd\" 733688de56ccSmrg $opt_silent || { 733788de56ccSmrg func_quote_for_expand "$cmd" 733888de56ccSmrg eval "func_echo $func_quote_for_expand_result" 733988de56ccSmrg } 734088de56ccSmrg $opt_dry_run || eval "$cmd" || { 734188de56ccSmrg lt_exit=$? 73422e9c7c8cSmrg 734388de56ccSmrg # Restore the uninstalled library and exit 734488de56ccSmrg if test "$mode" = relink; then 734588de56ccSmrg ( cd "$output_objdir" && \ 734688de56ccSmrg $RM "${realname}T" && \ 734788de56ccSmrg $MV "${realname}U" "$realname" ) 734888de56ccSmrg fi 73492e9c7c8cSmrg 735088de56ccSmrg exit $lt_exit 735188de56ccSmrg } 735288de56ccSmrg done 735388de56ccSmrg IFS="$save_ifs" 73542e9c7c8cSmrg 735588de56ccSmrg # Restore the uninstalled library and exit 735688de56ccSmrg if test "$mode" = relink; then 735788de56ccSmrg $opt_dry_run || eval '(cd $output_objdir && $RM ${realname}T && $MV $realname ${realname}T && $MV ${realname}U $realname)' || exit $? 73582e9c7c8cSmrg 735988de56ccSmrg if test -n "$convenience"; then 736088de56ccSmrg if test -z "$whole_archive_flag_spec"; then 736188de56ccSmrg func_show_eval '${RM}r "$gentop"' 736288de56ccSmrg fi 736388de56ccSmrg fi 73642e9c7c8cSmrg 736588de56ccSmrg exit $EXIT_SUCCESS 736688de56ccSmrg fi 736788de56ccSmrg 736888de56ccSmrg # Create links to the real library. 736988de56ccSmrg for linkname in $linknames; do 737088de56ccSmrg if test "$realname" != "$linkname"; then 737188de56ccSmrg func_show_eval '(cd "$output_objdir" && $RM "$linkname" && $LN_S "$realname" "$linkname")' 'exit $?' 7372b4ee4795Smrg fi 7373b4ee4795Smrg done 73742e9c7c8cSmrg 737588de56ccSmrg # If -module or -export-dynamic was specified, set the dlname. 737688de56ccSmrg if test "$module" = yes || test "$export_dynamic" = yes; then 737788de56ccSmrg # On all known operating systems, these are identical. 737888de56ccSmrg dlname="$soname" 737988de56ccSmrg fi 738088de56ccSmrg fi 73811ab64890Smrg ;; 73821ab64890Smrg 738388de56ccSmrg obj) 738488de56ccSmrg if test -n "$dlfiles$dlprefiles" || test "$dlself" != no; then 738588de56ccSmrg func_warning "\`-dlopen' is ignored for objects" 738688de56ccSmrg fi 7387b4ee4795Smrg 738888de56ccSmrg case " $deplibs" in 738988de56ccSmrg *\ -l* | *\ -L*) 739088de56ccSmrg func_warning "\`-l' and \`-L' are ignored for objects" ;; 73912e9c7c8cSmrg esac 73921ab64890Smrg 739388de56ccSmrg test -n "$rpath" && \ 739488de56ccSmrg func_warning "\`-rpath' is ignored for objects" 739588de56ccSmrg 739688de56ccSmrg test -n "$xrpath" && \ 739788de56ccSmrg func_warning "\`-R' is ignored for objects" 73981ab64890Smrg 739988de56ccSmrg test -n "$vinfo" && \ 740088de56ccSmrg func_warning "\`-version-info' is ignored for objects" 74012e9c7c8cSmrg 740288de56ccSmrg test -n "$release" && \ 740388de56ccSmrg func_warning "\`-release' is ignored for objects" 740488de56ccSmrg 740588de56ccSmrg case $output in 740688de56ccSmrg *.lo) 740788de56ccSmrg test -n "$objs$old_deplibs" && \ 740888de56ccSmrg func_fatal_error "cannot build library object \`$output' from non-libtool objects" 740988de56ccSmrg 741088de56ccSmrg libobj=$output 741188de56ccSmrg func_lo2o "$libobj" 741288de56ccSmrg obj=$func_lo2o_result 7413b4ee4795Smrg ;; 7414b4ee4795Smrg *) 741588de56ccSmrg libobj= 741688de56ccSmrg obj="$output" 74171ab64890Smrg ;; 74182e9c7c8cSmrg esac 74191ab64890Smrg 742088de56ccSmrg # Delete the old objects. 742188de56ccSmrg $opt_dry_run || $RM $obj $libobj 74221ab64890Smrg 742388de56ccSmrg # Objects from convenience libraries. This assumes 742488de56ccSmrg # single-version convenience libraries. Whenever we create 742588de56ccSmrg # different ones for PIC/non-PIC, this we'll have to duplicate 742688de56ccSmrg # the extraction. 742788de56ccSmrg reload_conv_objs= 742888de56ccSmrg gentop= 742988de56ccSmrg # reload_cmds runs $LD directly, so let us get rid of 743088de56ccSmrg # -Wl from whole_archive_flag_spec and hope we can get by with 743188de56ccSmrg # turning comma into space.. 743288de56ccSmrg wl= 74331ab64890Smrg 743488de56ccSmrg if test -n "$convenience"; then 743588de56ccSmrg if test -n "$whole_archive_flag_spec"; then 743688de56ccSmrg eval tmp_whole_archive_flags=\"$whole_archive_flag_spec\" 743788de56ccSmrg reload_conv_objs=$reload_objs\ `$ECHO "X$tmp_whole_archive_flags" | $Xsed -e 's|,| |g'` 743888de56ccSmrg else 743988de56ccSmrg gentop="$output_objdir/${obj}x" 744088de56ccSmrg generated="$generated $gentop" 7441b4ee4795Smrg 744288de56ccSmrg func_extract_archives $gentop $convenience 744388de56ccSmrg reload_conv_objs="$reload_objs $func_extract_archives_result" 744488de56ccSmrg fi 7445b4ee4795Smrg fi 7446b4ee4795Smrg 744788de56ccSmrg # Create the old-style object. 744888de56ccSmrg reload_objs="$objs$old_deplibs "`$ECHO "X$libobjs" | $SP2NL | $Xsed -e '/\.'${libext}$'/d' -e '/\.lib$/d' -e "$lo2o" | $NL2SP`" $reload_conv_objs" ### testsuite: skip nested quoting test 7449b4ee4795Smrg 745088de56ccSmrg output="$obj" 745188de56ccSmrg func_execute_cmds "$reload_cmds" 'exit $?' 7452b4ee4795Smrg 745388de56ccSmrg # Exit if we aren't doing a library object file. 745488de56ccSmrg if test -z "$libobj"; then 745588de56ccSmrg if test -n "$gentop"; then 745688de56ccSmrg func_show_eval '${RM}r "$gentop"' 745788de56ccSmrg fi 745888de56ccSmrg 745988de56ccSmrg exit $EXIT_SUCCESS 7460b4ee4795Smrg fi 746188de56ccSmrg 746288de56ccSmrg if test "$build_libtool_libs" != yes; then 746388de56ccSmrg if test -n "$gentop"; then 746488de56ccSmrg func_show_eval '${RM}r "$gentop"' 746588de56ccSmrg fi 746688de56ccSmrg 746788de56ccSmrg # Create an invalid libtool object if no PIC, so that we don't 746888de56ccSmrg # accidentally link it into a program. 746988de56ccSmrg # $show "echo timestamp > $libobj" 747088de56ccSmrg # $opt_dry_run || eval "echo timestamp > $libobj" || exit $? 747188de56ccSmrg exit $EXIT_SUCCESS 747288de56ccSmrg fi 747388de56ccSmrg 747488de56ccSmrg if test -n "$pic_flag" || test "$pic_mode" != default; then 747588de56ccSmrg # Only do commands if we really have different PIC objects. 747688de56ccSmrg reload_objs="$libobjs $reload_conv_objs" 747788de56ccSmrg output="$libobj" 747888de56ccSmrg func_execute_cmds "$reload_cmds" 'exit $?' 747988de56ccSmrg fi 748088de56ccSmrg 748188de56ccSmrg if test -n "$gentop"; then 748288de56ccSmrg func_show_eval '${RM}r "$gentop"' 748388de56ccSmrg fi 748488de56ccSmrg 748588de56ccSmrg exit $EXIT_SUCCESS 7486b4ee4795Smrg ;; 74871ab64890Smrg 748888de56ccSmrg prog) 748988de56ccSmrg case $host in 749088de56ccSmrg *cygwin*) func_stripname '' '.exe' "$output" 749188de56ccSmrg output=$func_stripname_result.exe;; 749288de56ccSmrg esac 749388de56ccSmrg test -n "$vinfo" && \ 749488de56ccSmrg func_warning "\`-version-info' is ignored for programs" 74951ab64890Smrg 749688de56ccSmrg test -n "$release" && \ 749788de56ccSmrg func_warning "\`-release' is ignored for programs" 74981ab64890Smrg 749988de56ccSmrg test "$preload" = yes \ 750088de56ccSmrg && test "$dlopen_support" = unknown \ 750188de56ccSmrg && test "$dlopen_self" = unknown \ 750288de56ccSmrg && test "$dlopen_self_static" = unknown && \ 750388de56ccSmrg func_warning "\`LT_INIT([dlopen])' not used. Assuming no dlopen support." 750488de56ccSmrg 750588de56ccSmrg case $host in 750688de56ccSmrg *-*-rhapsody* | *-*-darwin1.[012]) 750788de56ccSmrg # On Rhapsody replace the C library is the System framework 750888de56ccSmrg compile_deplibs=`$ECHO "X $compile_deplibs" | $Xsed -e 's/ -lc / System.ltframework /'` 750988de56ccSmrg finalize_deplibs=`$ECHO "X $finalize_deplibs" | $Xsed -e 's/ -lc / System.ltframework /'` 7510b4ee4795Smrg ;; 751188de56ccSmrg esac 7512b4ee4795Smrg 751388de56ccSmrg case $host in 751488de56ccSmrg *-*-darwin*) 751588de56ccSmrg # Don't allow lazy linking, it breaks C++ global constructors 751688de56ccSmrg # But is supposedly fixed on 10.4 or later (yay!). 751788de56ccSmrg if test "$tagname" = CXX ; then 751888de56ccSmrg case ${MACOSX_DEPLOYMENT_TARGET-10.0} in 751988de56ccSmrg 10.[0123]) 752088de56ccSmrg compile_command="$compile_command ${wl}-bind_at_load" 752188de56ccSmrg finalize_command="$finalize_command ${wl}-bind_at_load" 752288de56ccSmrg ;; 752388de56ccSmrg esac 7524b4ee4795Smrg fi 752588de56ccSmrg # Time to change all our "foo.ltframework" stuff back to "-framework foo" 752688de56ccSmrg compile_deplibs=`$ECHO "X $compile_deplibs" | $Xsed -e 's% \([^ $]*\).ltframework% -framework \1%g'` 752788de56ccSmrg finalize_deplibs=`$ECHO "X $finalize_deplibs" | $Xsed -e 's% \([^ $]*\).ltframework% -framework \1%g'` 752888de56ccSmrg ;; 752988de56ccSmrg esac 7530b4ee4795Smrg 7531b4ee4795Smrg 753288de56ccSmrg # move library search paths that coincide with paths to not yet 753388de56ccSmrg # installed libraries to the beginning of the library search list 753488de56ccSmrg new_libs= 753588de56ccSmrg for path in $notinst_path; do 753688de56ccSmrg case " $new_libs " in 753788de56ccSmrg *" -L$path/$objdir "*) ;; 753888de56ccSmrg *) 753988de56ccSmrg case " $compile_deplibs " in 754088de56ccSmrg *" -L$path/$objdir "*) 754188de56ccSmrg new_libs="$new_libs -L$path/$objdir" ;; 75422e9c7c8cSmrg esac 754388de56ccSmrg ;; 754488de56ccSmrg esac 754588de56ccSmrg done 754688de56ccSmrg for deplib in $compile_deplibs; do 754788de56ccSmrg case $deplib in 754888de56ccSmrg -L*) 754988de56ccSmrg case " $new_libs " in 755088de56ccSmrg *" $deplib "*) ;; 755188de56ccSmrg *) new_libs="$new_libs $deplib" ;; 75522e9c7c8cSmrg esac 755388de56ccSmrg ;; 755488de56ccSmrg *) new_libs="$new_libs $deplib" ;; 755588de56ccSmrg esac 755688de56ccSmrg done 755788de56ccSmrg compile_deplibs="$new_libs" 75581ab64890Smrg 7559b4ee4795Smrg 756088de56ccSmrg compile_command="$compile_command $compile_deplibs" 756188de56ccSmrg finalize_command="$finalize_command $finalize_deplibs" 7562b4ee4795Smrg 756388de56ccSmrg if test -n "$rpath$xrpath"; then 756488de56ccSmrg # If the user specified any rpath flags, then add them. 756588de56ccSmrg for libdir in $rpath $xrpath; do 756688de56ccSmrg # This is the magic to use -rpath. 756788de56ccSmrg case "$finalize_rpath " in 756888de56ccSmrg *" $libdir "*) ;; 756988de56ccSmrg *) finalize_rpath="$finalize_rpath $libdir" ;; 757088de56ccSmrg esac 757188de56ccSmrg done 757288de56ccSmrg fi 7573b4ee4795Smrg 757488de56ccSmrg # Now hardcode the library paths 757588de56ccSmrg rpath= 757688de56ccSmrg hardcode_libdirs= 757788de56ccSmrg for libdir in $compile_rpath $finalize_rpath; do 757888de56ccSmrg if test -n "$hardcode_libdir_flag_spec"; then 757988de56ccSmrg if test -n "$hardcode_libdir_separator"; then 758088de56ccSmrg if test -z "$hardcode_libdirs"; then 758188de56ccSmrg hardcode_libdirs="$libdir" 758288de56ccSmrg else 758388de56ccSmrg # Just accumulate the unique libdirs. 758488de56ccSmrg case $hardcode_libdir_separator$hardcode_libdirs$hardcode_libdir_separator in 758588de56ccSmrg *"$hardcode_libdir_separator$libdir$hardcode_libdir_separator"*) 758688de56ccSmrg ;; 758788de56ccSmrg *) 758888de56ccSmrg hardcode_libdirs="$hardcode_libdirs$hardcode_libdir_separator$libdir" 758988de56ccSmrg ;; 759088de56ccSmrg esac 759188de56ccSmrg fi 7592b4ee4795Smrg else 759388de56ccSmrg eval flag=\"$hardcode_libdir_flag_spec\" 759488de56ccSmrg rpath="$rpath $flag" 7595b4ee4795Smrg fi 759688de56ccSmrg elif test -n "$runpath_var"; then 759788de56ccSmrg case "$perm_rpath " in 759888de56ccSmrg *" $libdir "*) ;; 759988de56ccSmrg *) perm_rpath="$perm_rpath $libdir" ;; 760088de56ccSmrg esac 760188de56ccSmrg fi 760288de56ccSmrg case $host in 760388de56ccSmrg *-*-cygwin* | *-*-mingw* | *-*-pw32* | *-*-os2* | *-cegcc*) 760488de56ccSmrg testbindir=`${ECHO} "$libdir" | ${SED} -e 's*/lib$*/bin*'` 760588de56ccSmrg case :$dllsearchpath: in 760688de56ccSmrg *":$libdir:"*) ;; 760788de56ccSmrg ::) dllsearchpath=$libdir;; 760888de56ccSmrg *) dllsearchpath="$dllsearchpath:$libdir";; 760988de56ccSmrg esac 761088de56ccSmrg case :$dllsearchpath: in 761188de56ccSmrg *":$testbindir:"*) ;; 761288de56ccSmrg ::) dllsearchpath=$testbindir;; 761388de56ccSmrg *) dllsearchpath="$dllsearchpath:$testbindir";; 761488de56ccSmrg esac 761588de56ccSmrg ;; 761688de56ccSmrg esac 761788de56ccSmrg done 761888de56ccSmrg # Substitute the hardcoded libdirs into the rpath. 761988de56ccSmrg if test -n "$hardcode_libdir_separator" && 762088de56ccSmrg test -n "$hardcode_libdirs"; then 762188de56ccSmrg libdir="$hardcode_libdirs" 762288de56ccSmrg eval rpath=\" $hardcode_libdir_flag_spec\" 762388de56ccSmrg fi 762488de56ccSmrg compile_rpath="$rpath" 7625b4ee4795Smrg 762688de56ccSmrg rpath= 762788de56ccSmrg hardcode_libdirs= 762888de56ccSmrg for libdir in $finalize_rpath; do 762988de56ccSmrg if test -n "$hardcode_libdir_flag_spec"; then 763088de56ccSmrg if test -n "$hardcode_libdir_separator"; then 763188de56ccSmrg if test -z "$hardcode_libdirs"; then 763288de56ccSmrg hardcode_libdirs="$libdir" 763388de56ccSmrg else 763488de56ccSmrg # Just accumulate the unique libdirs. 763588de56ccSmrg case $hardcode_libdir_separator$hardcode_libdirs$hardcode_libdir_separator in 763688de56ccSmrg *"$hardcode_libdir_separator$libdir$hardcode_libdir_separator"*) 763788de56ccSmrg ;; 763888de56ccSmrg *) 763988de56ccSmrg hardcode_libdirs="$hardcode_libdirs$hardcode_libdir_separator$libdir" 764088de56ccSmrg ;; 764188de56ccSmrg esac 764288de56ccSmrg fi 76431ab64890Smrg else 764488de56ccSmrg eval flag=\"$hardcode_libdir_flag_spec\" 764588de56ccSmrg rpath="$rpath $flag" 76461ab64890Smrg fi 764788de56ccSmrg elif test -n "$runpath_var"; then 764888de56ccSmrg case "$finalize_perm_rpath " in 764988de56ccSmrg *" $libdir "*) ;; 765088de56ccSmrg *) finalize_perm_rpath="$finalize_perm_rpath $libdir" ;; 765188de56ccSmrg esac 76521ab64890Smrg fi 765388de56ccSmrg done 765488de56ccSmrg # Substitute the hardcoded libdirs into the rpath. 765588de56ccSmrg if test -n "$hardcode_libdir_separator" && 765688de56ccSmrg test -n "$hardcode_libdirs"; then 765788de56ccSmrg libdir="$hardcode_libdirs" 765888de56ccSmrg eval rpath=\" $hardcode_libdir_flag_spec\" 765988de56ccSmrg fi 766088de56ccSmrg finalize_rpath="$rpath" 76611ab64890Smrg 766288de56ccSmrg if test -n "$libobjs" && test "$build_old_libs" = yes; then 766388de56ccSmrg # Transform all the library objects into standard objects. 766488de56ccSmrg compile_command=`$ECHO "X$compile_command" | $SP2NL | $Xsed -e "$lo2o" | $NL2SP` 766588de56ccSmrg finalize_command=`$ECHO "X$finalize_command" | $SP2NL | $Xsed -e "$lo2o" | $NL2SP` 766688de56ccSmrg fi 76671ab64890Smrg 766888de56ccSmrg func_generate_dlsyms "$outputname" "@PROGRAM@" "no" 76691ab64890Smrg 767088de56ccSmrg # template prelinking step 767188de56ccSmrg if test -n "$prelink_cmds"; then 767288de56ccSmrg func_execute_cmds "$prelink_cmds" 'exit $?' 767388de56ccSmrg fi 76741ab64890Smrg 767588de56ccSmrg wrappers_required=yes 767688de56ccSmrg case $host in 767788de56ccSmrg *cygwin* | *mingw* ) 767888de56ccSmrg if test "$build_libtool_libs" != yes; then 767988de56ccSmrg wrappers_required=no 768088de56ccSmrg fi 768188de56ccSmrg ;; 768288de56ccSmrg *cegcc) 768388de56ccSmrg # Disable wrappers for cegcc, we are cross compiling anyway. 768488de56ccSmrg wrappers_required=no 768588de56ccSmrg ;; 768688de56ccSmrg *) 768788de56ccSmrg if test "$need_relink" = no || test "$build_libtool_libs" != yes; then 768888de56ccSmrg wrappers_required=no 768988de56ccSmrg fi 769088de56ccSmrg ;; 769188de56ccSmrg esac 769288de56ccSmrg if test "$wrappers_required" = no; then 769388de56ccSmrg # Replace the output file specification. 769488de56ccSmrg compile_command=`$ECHO "X$compile_command" | $Xsed -e 's%@OUTPUT@%'"$output"'%g'` 769588de56ccSmrg link_command="$compile_command$compile_rpath" 76961ab64890Smrg 769788de56ccSmrg # We have no uninstalled library dependencies, so finalize right now. 769888de56ccSmrg exit_status=0 769988de56ccSmrg func_show_eval "$link_command" 'exit_status=$?' 77001ab64890Smrg 770188de56ccSmrg # Delete the generated files. 770288de56ccSmrg if test -f "$output_objdir/${outputname}S.${objext}"; then 770388de56ccSmrg func_show_eval '$RM "$output_objdir/${outputname}S.${objext}"' 77041ab64890Smrg fi 77051ab64890Smrg 770688de56ccSmrg exit $exit_status 770788de56ccSmrg fi 77081ab64890Smrg 770988de56ccSmrg if test -n "$compile_shlibpath$finalize_shlibpath"; then 771088de56ccSmrg compile_command="$shlibpath_var=\"$compile_shlibpath$finalize_shlibpath\$$shlibpath_var\" $compile_command" 771188de56ccSmrg fi 771288de56ccSmrg if test -n "$finalize_shlibpath"; then 771388de56ccSmrg finalize_command="$shlibpath_var=\"$finalize_shlibpath\$$shlibpath_var\" $finalize_command" 771488de56ccSmrg fi 7715b4ee4795Smrg 771688de56ccSmrg compile_var= 771788de56ccSmrg finalize_var= 771888de56ccSmrg if test -n "$runpath_var"; then 771988de56ccSmrg if test -n "$perm_rpath"; then 772088de56ccSmrg # We should set the runpath_var. 772188de56ccSmrg rpath= 772288de56ccSmrg for dir in $perm_rpath; do 772388de56ccSmrg rpath="$rpath$dir:" 772488de56ccSmrg done 772588de56ccSmrg compile_var="$runpath_var=\"$rpath\$$runpath_var\" " 77261ab64890Smrg fi 772788de56ccSmrg if test -n "$finalize_perm_rpath"; then 772888de56ccSmrg # We should set the runpath_var. 772988de56ccSmrg rpath= 773088de56ccSmrg for dir in $finalize_perm_rpath; do 773188de56ccSmrg rpath="$rpath$dir:" 773288de56ccSmrg done 773388de56ccSmrg finalize_var="$runpath_var=\"$rpath\$$runpath_var\" " 77341ab64890Smrg fi 773588de56ccSmrg fi 77361ab64890Smrg 773788de56ccSmrg if test "$no_install" = yes; then 773888de56ccSmrg # We don't need to create a wrapper script. 773988de56ccSmrg link_command="$compile_var$compile_command$compile_rpath" 774088de56ccSmrg # Replace the output file specification. 774188de56ccSmrg link_command=`$ECHO "X$link_command" | $Xsed -e 's%@OUTPUT@%'"$output"'%g'` 774288de56ccSmrg # Delete the old output file. 774388de56ccSmrg $opt_dry_run || $RM $output 774488de56ccSmrg # Link the executable and exit 774588de56ccSmrg func_show_eval "$link_command" 'exit $?' 7746b4ee4795Smrg exit $EXIT_SUCCESS 774788de56ccSmrg fi 77482e9c7c8cSmrg 774988de56ccSmrg if test "$hardcode_action" = relink; then 775088de56ccSmrg # Fast installation is not supported 775188de56ccSmrg link_command="$compile_var$compile_command$compile_rpath" 775288de56ccSmrg relink_command="$finalize_var$finalize_command$finalize_rpath" 775388de56ccSmrg 775488de56ccSmrg func_warning "this platform does not like uninstalled shared libraries" 775588de56ccSmrg func_warning "\`$output' will be relinked during installation" 775688de56ccSmrg else 775788de56ccSmrg if test "$fast_install" != no; then 775888de56ccSmrg link_command="$finalize_var$compile_command$finalize_rpath" 775988de56ccSmrg if test "$fast_install" = yes; then 776088de56ccSmrg relink_command=`$ECHO "X$compile_var$compile_command$compile_rpath" | $Xsed -e 's%@OUTPUT@%\$progdir/\$file%g'` 776188de56ccSmrg else 776288de56ccSmrg # fast_install is set to needless 776388de56ccSmrg relink_command= 776488de56ccSmrg fi 77651ab64890Smrg else 776688de56ccSmrg link_command="$compile_var$compile_command$compile_rpath" 776788de56ccSmrg relink_command="$finalize_var$finalize_command$finalize_rpath" 77681ab64890Smrg fi 776988de56ccSmrg fi 77701ab64890Smrg 777188de56ccSmrg # Replace the output file specification. 777288de56ccSmrg link_command=`$ECHO "X$link_command" | $Xsed -e 's%@OUTPUT@%'"$output_objdir/$outputname"'%g'` 77731ab64890Smrg 777488de56ccSmrg # Delete the old output files. 777588de56ccSmrg $opt_dry_run || $RM $output $output_objdir/$outputname $output_objdir/lt-$outputname 77761ab64890Smrg 777788de56ccSmrg func_show_eval "$link_command" 'exit $?' 7778b4ee4795Smrg 777988de56ccSmrg # Now create the wrapper script. 778088de56ccSmrg func_verbose "creating $output" 7781b4ee4795Smrg 778288de56ccSmrg # Quote the relink command for shipping. 778388de56ccSmrg if test -n "$relink_command"; then 778488de56ccSmrg # Preserve any variables that may affect compiler behavior 778588de56ccSmrg for var in $variables_saved_for_relink; do 778688de56ccSmrg if eval test -z \"\${$var+set}\"; then 778788de56ccSmrg relink_command="{ test -z \"\${$var+set}\" || $lt_unset $var || { $var=; export $var; }; }; $relink_command" 778888de56ccSmrg elif eval var_value=\$$var; test -z "$var_value"; then 778988de56ccSmrg relink_command="$var=; export $var; $relink_command" 77901ab64890Smrg else 779188de56ccSmrg func_quote_for_eval "$var_value" 779288de56ccSmrg relink_command="$var=$func_quote_for_eval_result; export $var; $relink_command" 77931ab64890Smrg fi 779488de56ccSmrg done 779588de56ccSmrg relink_command="(cd `pwd`; $relink_command)" 779688de56ccSmrg relink_command=`$ECHO "X$relink_command" | $Xsed -e "$sed_quote_subst"` 779788de56ccSmrg fi 77982e9c7c8cSmrg 779988de56ccSmrg # Quote $ECHO for shipping. 780088de56ccSmrg if test "X$ECHO" = "X$SHELL $progpath --fallback-echo"; then 780188de56ccSmrg case $progpath in 780288de56ccSmrg [\\/]* | [A-Za-z]:[\\/]*) qecho="$SHELL $progpath --fallback-echo";; 780388de56ccSmrg *) qecho="$SHELL `pwd`/$progpath --fallback-echo";; 780488de56ccSmrg esac 780588de56ccSmrg qecho=`$ECHO "X$qecho" | $Xsed -e "$sed_quote_subst"` 780688de56ccSmrg else 780788de56ccSmrg qecho=`$ECHO "X$ECHO" | $Xsed -e "$sed_quote_subst"` 780888de56ccSmrg fi 780988de56ccSmrg 781088de56ccSmrg # Only actually do things if not in dry run mode. 781188de56ccSmrg $opt_dry_run || { 781288de56ccSmrg # win32 will think the script is a binary if it has 781388de56ccSmrg # a .exe suffix, so we strip it off here. 781488de56ccSmrg case $output in 781588de56ccSmrg *.exe) func_stripname '' '.exe' "$output" 781688de56ccSmrg output=$func_stripname_result ;; 781788de56ccSmrg esac 781888de56ccSmrg # test for cygwin because mv fails w/o .exe extensions 781988de56ccSmrg case $host in 782088de56ccSmrg *cygwin*) 782188de56ccSmrg exeext=.exe 782288de56ccSmrg func_stripname '' '.exe' "$outputname" 782388de56ccSmrg outputname=$func_stripname_result ;; 782488de56ccSmrg *) exeext= ;; 78251ab64890Smrg esac 782688de56ccSmrg case $host in 782788de56ccSmrg *cygwin* | *mingw* ) 782888de56ccSmrg func_dirname_and_basename "$output" "" "." 782988de56ccSmrg output_name=$func_basename_result 783088de56ccSmrg output_path=$func_dirname_result 783188de56ccSmrg cwrappersource="$output_path/$objdir/lt-$output_name.c" 783288de56ccSmrg cwrapper="$output_path/$output_name.exe" 783388de56ccSmrg $RM $cwrappersource $cwrapper 783488de56ccSmrg trap "$RM $cwrappersource $cwrapper; exit $EXIT_FAILURE" 1 2 15 783588de56ccSmrg 783688de56ccSmrg func_emit_cwrapperexe_src > $cwrappersource 783788de56ccSmrg 783888de56ccSmrg # The wrapper executable is built using the $host compiler, 783988de56ccSmrg # because it contains $host paths and files. If cross- 784088de56ccSmrg # compiling, it, like the target executable, must be 784188de56ccSmrg # executed on the $host or under an emulation environment. 784288de56ccSmrg $opt_dry_run || { 784388de56ccSmrg $LTCC $LTCFLAGS -o $cwrapper $cwrappersource 784488de56ccSmrg $STRIP $cwrapper 784588de56ccSmrg } 78461ab64890Smrg 784788de56ccSmrg # Now, create the wrapper script for func_source use: 784888de56ccSmrg func_ltwrapper_scriptname $cwrapper 784988de56ccSmrg $RM $func_ltwrapper_scriptname_result 785088de56ccSmrg trap "$RM $func_ltwrapper_scriptname_result; exit $EXIT_FAILURE" 1 2 15 785188de56ccSmrg $opt_dry_run || { 785288de56ccSmrg # note: this script will not be executed, so do not chmod. 785388de56ccSmrg if test "x$build" = "x$host" ; then 785488de56ccSmrg $cwrapper --lt-dump-script > $func_ltwrapper_scriptname_result 785588de56ccSmrg else 785688de56ccSmrg func_emit_wrapper no > $func_ltwrapper_scriptname_result 785788de56ccSmrg fi 785888de56ccSmrg } 785988de56ccSmrg ;; 786088de56ccSmrg * ) 786188de56ccSmrg $RM $output 786288de56ccSmrg trap "$RM $output; exit $EXIT_FAILURE" 1 2 15 78631ab64890Smrg 786488de56ccSmrg func_emit_wrapper no > $output 786588de56ccSmrg chmod +x $output 786688de56ccSmrg ;; 786788de56ccSmrg esac 786888de56ccSmrg } 786988de56ccSmrg exit $EXIT_SUCCESS 787088de56ccSmrg ;; 787188de56ccSmrg esac 78721ab64890Smrg 787388de56ccSmrg # See if we need to build an old-fashioned archive. 787488de56ccSmrg for oldlib in $oldlibs; do 78751ab64890Smrg 787688de56ccSmrg if test "$build_libtool_libs" = convenience; then 787788de56ccSmrg oldobjs="$libobjs_save $symfileobj" 787888de56ccSmrg addlibs="$convenience" 787988de56ccSmrg build_libtool_libs=no 788088de56ccSmrg else 788188de56ccSmrg if test "$build_libtool_libs" = module; then 788288de56ccSmrg oldobjs="$libobjs_save" 788388de56ccSmrg build_libtool_libs=no 788488de56ccSmrg else 788588de56ccSmrg oldobjs="$old_deplibs $non_pic_objects" 788688de56ccSmrg if test "$preload" = yes && test -f "$symfileobj"; then 788788de56ccSmrg oldobjs="$oldobjs $symfileobj" 788888de56ccSmrg fi 788988de56ccSmrg fi 789088de56ccSmrg addlibs="$old_convenience" 78911ab64890Smrg fi 78921ab64890Smrg 789388de56ccSmrg if test -n "$addlibs"; then 789488de56ccSmrg gentop="$output_objdir/${outputname}x" 789588de56ccSmrg generated="$generated $gentop" 78961ab64890Smrg 789788de56ccSmrg func_extract_archives $gentop $addlibs 789888de56ccSmrg oldobjs="$oldobjs $func_extract_archives_result" 789988de56ccSmrg fi 79001ab64890Smrg 790188de56ccSmrg # Do each command in the archive commands. 790288de56ccSmrg if test -n "$old_archive_from_new_cmds" && test "$build_libtool_libs" = yes; then 790388de56ccSmrg cmds=$old_archive_from_new_cmds 790488de56ccSmrg else 79051ab64890Smrg 790688de56ccSmrg # Add any objects from preloaded convenience libraries 790788de56ccSmrg if test -n "$dlprefiles"; then 790888de56ccSmrg gentop="$output_objdir/${outputname}x" 790988de56ccSmrg generated="$generated $gentop" 79101ab64890Smrg 791188de56ccSmrg func_extract_archives $gentop $dlprefiles 791288de56ccSmrg oldobjs="$oldobjs $func_extract_archives_result" 791388de56ccSmrg fi 79141ab64890Smrg 791588de56ccSmrg # POSIX demands no paths to be encoded in archives. We have 791688de56ccSmrg # to avoid creating archives with duplicate basenames if we 791788de56ccSmrg # might have to extract them afterwards, e.g., when creating a 791888de56ccSmrg # static archive out of a convenience library, or when linking 791988de56ccSmrg # the entirety of a libtool archive into another (currently 792088de56ccSmrg # not supported by libtool). 792188de56ccSmrg if (for obj in $oldobjs 792288de56ccSmrg do 792388de56ccSmrg func_basename "$obj" 792488de56ccSmrg $ECHO "$func_basename_result" 792588de56ccSmrg done | sort | sort -uc >/dev/null 2>&1); then 792688de56ccSmrg : 792788de56ccSmrg else 792888de56ccSmrg $ECHO "copying selected object files to avoid basename conflicts..." 792988de56ccSmrg gentop="$output_objdir/${outputname}x" 793088de56ccSmrg generated="$generated $gentop" 793188de56ccSmrg func_mkdir_p "$gentop" 793288de56ccSmrg save_oldobjs=$oldobjs 793388de56ccSmrg oldobjs= 793488de56ccSmrg counter=1 793588de56ccSmrg for obj in $save_oldobjs 793688de56ccSmrg do 793788de56ccSmrg func_basename "$obj" 793888de56ccSmrg objbase="$func_basename_result" 793988de56ccSmrg case " $oldobjs " in 794088de56ccSmrg " ") oldobjs=$obj ;; 794188de56ccSmrg *[\ /]"$objbase "*) 794288de56ccSmrg while :; do 794388de56ccSmrg # Make sure we don't pick an alternate name that also 794488de56ccSmrg # overlaps. 794588de56ccSmrg newobj=lt$counter-$objbase 794688de56ccSmrg func_arith $counter + 1 794788de56ccSmrg counter=$func_arith_result 794888de56ccSmrg case " $oldobjs " in 794988de56ccSmrg *[\ /]"$newobj "*) ;; 795088de56ccSmrg *) if test ! -f "$gentop/$newobj"; then break; fi ;; 795188de56ccSmrg esac 795288de56ccSmrg done 795388de56ccSmrg func_show_eval "ln $obj $gentop/$newobj || cp $obj $gentop/$newobj" 795488de56ccSmrg oldobjs="$oldobjs $gentop/$newobj" 795588de56ccSmrg ;; 795688de56ccSmrg *) oldobjs="$oldobjs $obj" ;; 795788de56ccSmrg esac 79581ab64890Smrg done 79592e9c7c8cSmrg fi 796088de56ccSmrg eval cmds=\"$old_archive_cmds\" 7961b4ee4795Smrg 796288de56ccSmrg func_len " $cmds" 796388de56ccSmrg len=$func_len_result 796488de56ccSmrg if test "$len" -lt "$max_cmd_len" || test "$max_cmd_len" -le -1; then 796588de56ccSmrg cmds=$old_archive_cmds 796688de56ccSmrg else 796788de56ccSmrg # the command line is too long to link in one step, link in parts 796888de56ccSmrg func_verbose "using piecewise archive linking..." 796988de56ccSmrg save_RANLIB=$RANLIB 797088de56ccSmrg RANLIB=: 797188de56ccSmrg objlist= 797288de56ccSmrg concat_cmds= 797388de56ccSmrg save_oldobjs=$oldobjs 797488de56ccSmrg oldobjs= 797588de56ccSmrg # Is there a better way of finding the last object in the list? 797688de56ccSmrg for obj in $save_oldobjs 797788de56ccSmrg do 797888de56ccSmrg last_oldobj=$obj 797988de56ccSmrg done 798088de56ccSmrg eval test_cmds=\"$old_archive_cmds\" 798188de56ccSmrg func_len " $test_cmds" 798288de56ccSmrg len0=$func_len_result 798388de56ccSmrg len=$len0 798488de56ccSmrg for obj in $save_oldobjs 798588de56ccSmrg do 798688de56ccSmrg func_len " $obj" 798788de56ccSmrg func_arith $len + $func_len_result 798888de56ccSmrg len=$func_arith_result 798988de56ccSmrg func_append objlist " $obj" 799088de56ccSmrg if test "$len" -lt "$max_cmd_len"; then 799188de56ccSmrg : 799288de56ccSmrg else 799388de56ccSmrg # the above command should be used before it gets too long 799488de56ccSmrg oldobjs=$objlist 799588de56ccSmrg if test "$obj" = "$last_oldobj" ; then 799688de56ccSmrg RANLIB=$save_RANLIB 799788de56ccSmrg fi 799888de56ccSmrg test -z "$concat_cmds" || concat_cmds=$concat_cmds~ 799988de56ccSmrg eval concat_cmds=\"\${concat_cmds}$old_archive_cmds\" 800088de56ccSmrg objlist= 800188de56ccSmrg len=$len0 800288de56ccSmrg fi 800388de56ccSmrg done 800488de56ccSmrg RANLIB=$save_RANLIB 800588de56ccSmrg oldobjs=$objlist 800688de56ccSmrg if test "X$oldobjs" = "X" ; then 800788de56ccSmrg eval cmds=\"\$concat_cmds\" 800888de56ccSmrg else 800988de56ccSmrg eval cmds=\"\$concat_cmds~\$old_archive_cmds\" 801088de56ccSmrg fi 801188de56ccSmrg fi 801288de56ccSmrg fi 801388de56ccSmrg func_execute_cmds "$cmds" 'exit $?' 80141ab64890Smrg done 80151ab64890Smrg 801688de56ccSmrg test -n "$generated" && \ 801788de56ccSmrg func_show_eval "${RM}r$generated" 80181ab64890Smrg 801988de56ccSmrg # Now create the libtool archive. 802088de56ccSmrg case $output in 802188de56ccSmrg *.la) 802288de56ccSmrg old_library= 802388de56ccSmrg test "$build_old_libs" = yes && old_library="$libname.$libext" 802488de56ccSmrg func_verbose "creating $output" 80252e9c7c8cSmrg 802688de56ccSmrg # Preserve any variables that may affect compiler behavior 802788de56ccSmrg for var in $variables_saved_for_relink; do 802888de56ccSmrg if eval test -z \"\${$var+set}\"; then 802988de56ccSmrg relink_command="{ test -z \"\${$var+set}\" || $lt_unset $var || { $var=; export $var; }; }; $relink_command" 803088de56ccSmrg elif eval var_value=\$$var; test -z "$var_value"; then 803188de56ccSmrg relink_command="$var=; export $var; $relink_command" 8032b4ee4795Smrg else 803388de56ccSmrg func_quote_for_eval "$var_value" 803488de56ccSmrg relink_command="$var=$func_quote_for_eval_result; export $var; $relink_command" 8035b4ee4795Smrg fi 803688de56ccSmrg done 803788de56ccSmrg # Quote the link command for shipping. 803888de56ccSmrg relink_command="(cd `pwd`; $SHELL $progpath $preserve_args --mode=relink $libtool_args @inst_prefix_dir@)" 803988de56ccSmrg relink_command=`$ECHO "X$relink_command" | $Xsed -e "$sed_quote_subst"` 804088de56ccSmrg if test "$hardcode_automatic" = yes ; then 804188de56ccSmrg relink_command= 804288de56ccSmrg fi 80431ab64890Smrg 804488de56ccSmrg # Only create the output if not a dry run. 804588de56ccSmrg $opt_dry_run || { 804688de56ccSmrg for installed in no yes; do 804788de56ccSmrg if test "$installed" = yes; then 804888de56ccSmrg if test -z "$install_libdir"; then 804988de56ccSmrg break 805088de56ccSmrg fi 805188de56ccSmrg output="$output_objdir/$outputname"i 805288de56ccSmrg # Replace all uninstalled libtool libraries with the installed ones 805388de56ccSmrg newdependency_libs= 805488de56ccSmrg for deplib in $dependency_libs; do 805588de56ccSmrg case $deplib in 805688de56ccSmrg *.la) 805788de56ccSmrg func_basename "$deplib" 805888de56ccSmrg name="$func_basename_result" 805988de56ccSmrg eval libdir=`${SED} -n -e 's/^libdir=\(.*\)$/\1/p' $deplib` 806088de56ccSmrg test -z "$libdir" && \ 806188de56ccSmrg func_fatal_error "\`$deplib' is not a valid libtool archive" 806288de56ccSmrg newdependency_libs="$newdependency_libs $libdir/$name" 806388de56ccSmrg ;; 806488de56ccSmrg *) newdependency_libs="$newdependency_libs $deplib" ;; 806588de56ccSmrg esac 806688de56ccSmrg done 806788de56ccSmrg dependency_libs="$newdependency_libs" 806888de56ccSmrg newdlfiles= 806988de56ccSmrg 807088de56ccSmrg for lib in $dlfiles; do 807188de56ccSmrg case $lib in 807288de56ccSmrg *.la) 807388de56ccSmrg func_basename "$lib" 807488de56ccSmrg name="$func_basename_result" 807588de56ccSmrg eval libdir=`${SED} -n -e 's/^libdir=\(.*\)$/\1/p' $lib` 807688de56ccSmrg test -z "$libdir" && \ 807788de56ccSmrg func_fatal_error "\`$lib' is not a valid libtool archive" 807888de56ccSmrg newdlfiles="$newdlfiles $libdir/$name" 807988de56ccSmrg ;; 808088de56ccSmrg *) newdlfiles="$newdlfiles $lib" ;; 808188de56ccSmrg esac 808288de56ccSmrg done 808388de56ccSmrg dlfiles="$newdlfiles" 808488de56ccSmrg newdlprefiles= 808588de56ccSmrg for lib in $dlprefiles; do 808688de56ccSmrg case $lib in 808788de56ccSmrg *.la) 808888de56ccSmrg # Only pass preopened files to the pseudo-archive (for 808988de56ccSmrg # eventual linking with the app. that links it) if we 809088de56ccSmrg # didn't already link the preopened objects directly into 809188de56ccSmrg # the library: 809288de56ccSmrg func_basename "$lib" 809388de56ccSmrg name="$func_basename_result" 809488de56ccSmrg eval libdir=`${SED} -n -e 's/^libdir=\(.*\)$/\1/p' $lib` 809588de56ccSmrg test -z "$libdir" && \ 809688de56ccSmrg func_fatal_error "\`$lib' is not a valid libtool archive" 809788de56ccSmrg newdlprefiles="$newdlprefiles $libdir/$name" 809888de56ccSmrg ;; 809988de56ccSmrg esac 810088de56ccSmrg done 810188de56ccSmrg dlprefiles="$newdlprefiles" 810288de56ccSmrg else 810388de56ccSmrg newdlfiles= 810488de56ccSmrg for lib in $dlfiles; do 810588de56ccSmrg case $lib in 810688de56ccSmrg [\\/]* | [A-Za-z]:[\\/]*) abs="$lib" ;; 810788de56ccSmrg *) abs=`pwd`"/$lib" ;; 810888de56ccSmrg esac 810988de56ccSmrg newdlfiles="$newdlfiles $abs" 811088de56ccSmrg done 811188de56ccSmrg dlfiles="$newdlfiles" 811288de56ccSmrg newdlprefiles= 811388de56ccSmrg for lib in $dlprefiles; do 811488de56ccSmrg case $lib in 811588de56ccSmrg [\\/]* | [A-Za-z]:[\\/]*) abs="$lib" ;; 811688de56ccSmrg *) abs=`pwd`"/$lib" ;; 811788de56ccSmrg esac 811888de56ccSmrg newdlprefiles="$newdlprefiles $abs" 811988de56ccSmrg done 812088de56ccSmrg dlprefiles="$newdlprefiles" 812188de56ccSmrg fi 812288de56ccSmrg $RM $output 812388de56ccSmrg # place dlname in correct position for cygwin 812488de56ccSmrg tdlname=$dlname 812588de56ccSmrg case $host,$output,$installed,$module,$dlname in 812688de56ccSmrg *cygwin*,*lai,yes,no,*.dll | *mingw*,*lai,yes,no,*.dll | *cegcc*,*lai,yes,no,*.dll) tdlname=../bin/$dlname ;; 812788de56ccSmrg esac 812888de56ccSmrg $ECHO > $output "\ 812988de56ccSmrg# $outputname - a libtool library file 813088de56ccSmrg# Generated by $PROGRAM (GNU $PACKAGE$TIMESTAMP) $VERSION 813188de56ccSmrg# 813288de56ccSmrg# Please DO NOT delete this file! 813388de56ccSmrg# It is necessary for linking the library. 81341ab64890Smrg 813588de56ccSmrg# The name that we can dlopen(3). 813688de56ccSmrgdlname='$tdlname' 81371ab64890Smrg 813888de56ccSmrg# Names of this library. 813988de56ccSmrglibrary_names='$library_names' 81401ab64890Smrg 814188de56ccSmrg# The name of the static archive. 814288de56ccSmrgold_library='$old_library' 81431ab64890Smrg 814488de56ccSmrg# Linker flags that can not go in dependency_libs. 814588de56ccSmrginherited_linker_flags='$new_inherited_linker_flags' 81461ab64890Smrg 814788de56ccSmrg# Libraries that this one depends upon. 814888de56ccSmrgdependency_libs='$dependency_libs' 81491ab64890Smrg 815088de56ccSmrg# Names of additional weak libraries provided by this library 815188de56ccSmrgweak_library_names='$weak_libs' 81521ab64890Smrg 815388de56ccSmrg# Version information for $libname. 815488de56ccSmrgcurrent=$current 815588de56ccSmrgage=$age 815688de56ccSmrgrevision=$revision 81571ab64890Smrg 815888de56ccSmrg# Is this an already installed library? 815988de56ccSmrginstalled=$installed 81601ab64890Smrg 816188de56ccSmrg# Should we warn about portability when linking against -modules? 816288de56ccSmrgshouldnotlink=$module 81631ab64890Smrg 816488de56ccSmrg# Files to dlopen/dlpreopen 816588de56ccSmrgdlopen='$dlfiles' 816688de56ccSmrgdlpreopen='$dlprefiles' 81671ab64890Smrg 816888de56ccSmrg# Directory that this library needs to be installed in: 816988de56ccSmrglibdir='$install_libdir'" 817088de56ccSmrg if test "$installed" = no && test "$need_relink" = yes; then 817188de56ccSmrg $ECHO >> $output "\ 817288de56ccSmrgrelink_command=\"$relink_command\"" 817388de56ccSmrg fi 817488de56ccSmrg done 817588de56ccSmrg } 81761ab64890Smrg 817788de56ccSmrg # Do a symbolic link so that the libtool archive can be found in 817888de56ccSmrg # LD_LIBRARY_PATH before the program is installed. 817988de56ccSmrg func_show_eval '( cd "$output_objdir" && $RM "$outputname" && $LN_S "../$outputname" "$outputname" )' 'exit $?' 818088de56ccSmrg ;; 818188de56ccSmrg esac 818288de56ccSmrg exit $EXIT_SUCCESS 818388de56ccSmrg} 8184b4ee4795Smrg 818588de56ccSmrg{ test "$mode" = link || test "$mode" = relink; } && 818688de56ccSmrg func_mode_link ${1+"$@"} 81871ab64890Smrg 81881ab64890Smrg 818988de56ccSmrg# func_mode_uninstall arg... 819088de56ccSmrgfunc_mode_uninstall () 819188de56ccSmrg{ 819288de56ccSmrg $opt_debug 819388de56ccSmrg RM="$nonopt" 81941ab64890Smrg files= 81951ab64890Smrg rmforce= 81961ab64890Smrg exit_status=0 81971ab64890Smrg 81981ab64890Smrg # This variable tells wrapper scripts just to set variables rather 81991ab64890Smrg # than running their programs. 82001ab64890Smrg libtool_install_magic="$magic" 82011ab64890Smrg 82021ab64890Smrg for arg 82031ab64890Smrg do 82041ab64890Smrg case $arg in 820588de56ccSmrg -f) RM="$RM $arg"; rmforce=yes ;; 820688de56ccSmrg -*) RM="$RM $arg" ;; 82071ab64890Smrg *) files="$files $arg" ;; 82081ab64890Smrg esac 82091ab64890Smrg done 82101ab64890Smrg 821188de56ccSmrg test -z "$RM" && \ 821288de56ccSmrg func_fatal_help "you must specify an RM program" 82131ab64890Smrg 82141ab64890Smrg rmdirs= 82151ab64890Smrg 82161ab64890Smrg origobjdir="$objdir" 82171ab64890Smrg for file in $files; do 821888de56ccSmrg func_dirname "$file" "" "." 821988de56ccSmrg dir="$func_dirname_result" 822088de56ccSmrg if test "X$dir" = X.; then 82211ab64890Smrg objdir="$origobjdir" 82221ab64890Smrg else 82231ab64890Smrg objdir="$dir/$origobjdir" 82241ab64890Smrg fi 822588de56ccSmrg func_basename "$file" 822688de56ccSmrg name="$func_basename_result" 82271ab64890Smrg test "$mode" = uninstall && objdir="$dir" 82281ab64890Smrg 82291ab64890Smrg # Remember objdir for removal later, being careful to avoid duplicates 82301ab64890Smrg if test "$mode" = clean; then 82311ab64890Smrg case " $rmdirs " in 82321ab64890Smrg *" $objdir "*) ;; 82331ab64890Smrg *) rmdirs="$rmdirs $objdir" ;; 82341ab64890Smrg esac 82351ab64890Smrg fi 82361ab64890Smrg 82371ab64890Smrg # Don't error if the file doesn't exist and rm -f was used. 823888de56ccSmrg if { test -L "$file"; } >/dev/null 2>&1 || 823988de56ccSmrg { test -h "$file"; } >/dev/null 2>&1 || 824088de56ccSmrg test -f "$file"; then 82411ab64890Smrg : 82421ab64890Smrg elif test -d "$file"; then 82431ab64890Smrg exit_status=1 82441ab64890Smrg continue 82451ab64890Smrg elif test "$rmforce" = yes; then 82461ab64890Smrg continue 82471ab64890Smrg fi 82481ab64890Smrg 82491ab64890Smrg rmfiles="$file" 82501ab64890Smrg 82511ab64890Smrg case $name in 82521ab64890Smrg *.la) 82531ab64890Smrg # Possibly a libtool archive, so verify it. 825488de56ccSmrg if func_lalib_p "$file"; then 825588de56ccSmrg func_source $dir/$name 82561ab64890Smrg 82571ab64890Smrg # Delete the libtool libraries and symlinks. 82581ab64890Smrg for n in $library_names; do 82591ab64890Smrg rmfiles="$rmfiles $objdir/$n" 82601ab64890Smrg done 82611ab64890Smrg test -n "$old_library" && rmfiles="$rmfiles $objdir/$old_library" 82621ab64890Smrg 82631ab64890Smrg case "$mode" in 82641ab64890Smrg clean) 82651ab64890Smrg case " $library_names " in 82661ab64890Smrg # " " in the beginning catches empty $dlname 82671ab64890Smrg *" $dlname "*) ;; 82681ab64890Smrg *) rmfiles="$rmfiles $objdir/$dlname" ;; 82691ab64890Smrg esac 827088de56ccSmrg test -n "$libdir" && rmfiles="$rmfiles $objdir/$name $objdir/${name}i" 82711ab64890Smrg ;; 82721ab64890Smrg uninstall) 82731ab64890Smrg if test -n "$library_names"; then 82741ab64890Smrg # Do each command in the postuninstall commands. 827588de56ccSmrg func_execute_cmds "$postuninstall_cmds" 'test "$rmforce" = yes || exit_status=1' 82761ab64890Smrg fi 82771ab64890Smrg 82781ab64890Smrg if test -n "$old_library"; then 82791ab64890Smrg # Do each command in the old_postuninstall commands. 828088de56ccSmrg func_execute_cmds "$old_postuninstall_cmds" 'test "$rmforce" = yes || exit_status=1' 82811ab64890Smrg fi 82821ab64890Smrg # FIXME: should reinstall the best remaining shared library. 82831ab64890Smrg ;; 82841ab64890Smrg esac 82851ab64890Smrg fi 82861ab64890Smrg ;; 82871ab64890Smrg 82881ab64890Smrg *.lo) 82891ab64890Smrg # Possibly a libtool object, so verify it. 829088de56ccSmrg if func_lalib_p "$file"; then 82911ab64890Smrg 82921ab64890Smrg # Read the .lo file 829388de56ccSmrg func_source $dir/$name 82941ab64890Smrg 82951ab64890Smrg # Add PIC object to the list of files to remove. 829688de56ccSmrg if test -n "$pic_object" && 829788de56ccSmrg test "$pic_object" != none; then 82981ab64890Smrg rmfiles="$rmfiles $dir/$pic_object" 82991ab64890Smrg fi 83001ab64890Smrg 83011ab64890Smrg # Add non-PIC object to the list of files to remove. 830288de56ccSmrg if test -n "$non_pic_object" && 830388de56ccSmrg test "$non_pic_object" != none; then 83041ab64890Smrg rmfiles="$rmfiles $dir/$non_pic_object" 83051ab64890Smrg fi 83061ab64890Smrg fi 83071ab64890Smrg ;; 83081ab64890Smrg 83091ab64890Smrg *) 83101ab64890Smrg if test "$mode" = clean ; then 83111ab64890Smrg noexename=$name 83121ab64890Smrg case $file in 83131ab64890Smrg *.exe) 831488de56ccSmrg func_stripname '' '.exe' "$file" 831588de56ccSmrg file=$func_stripname_result 831688de56ccSmrg func_stripname '' '.exe' "$name" 831788de56ccSmrg noexename=$func_stripname_result 83181ab64890Smrg # $file with .exe has already been added to rmfiles, 83191ab64890Smrg # add $file without .exe 83201ab64890Smrg rmfiles="$rmfiles $file" 83211ab64890Smrg ;; 83221ab64890Smrg esac 83231ab64890Smrg # Do a test to see if this is a libtool program. 832488de56ccSmrg if func_ltwrapper_p "$file"; then 832588de56ccSmrg if func_ltwrapper_executable_p "$file"; then 832688de56ccSmrg func_ltwrapper_scriptname "$file" 832788de56ccSmrg relink_command= 832888de56ccSmrg func_source $func_ltwrapper_scriptname_result 832988de56ccSmrg rmfiles="$rmfiles $func_ltwrapper_scriptname_result" 833088de56ccSmrg else 833188de56ccSmrg relink_command= 833288de56ccSmrg func_source $dir/$noexename 833388de56ccSmrg fi 83341ab64890Smrg 83351ab64890Smrg # note $name still contains .exe if it was in $file originally 83361ab64890Smrg # as does the version of $file that was added into $rmfiles 83371ab64890Smrg rmfiles="$rmfiles $objdir/$name $objdir/${name}S.${objext}" 83381ab64890Smrg if test "$fast_install" = yes && test -n "$relink_command"; then 83391ab64890Smrg rmfiles="$rmfiles $objdir/lt-$name" 83401ab64890Smrg fi 83411ab64890Smrg if test "X$noexename" != "X$name" ; then 83421ab64890Smrg rmfiles="$rmfiles $objdir/lt-${noexename}.c" 83431ab64890Smrg fi 83441ab64890Smrg fi 83451ab64890Smrg fi 83461ab64890Smrg ;; 83471ab64890Smrg esac 834888de56ccSmrg func_show_eval "$RM $rmfiles" 'exit_status=1' 83491ab64890Smrg done 83501ab64890Smrg objdir="$origobjdir" 83511ab64890Smrg 83521ab64890Smrg # Try to remove the ${objdir}s in the directories where we deleted files 83531ab64890Smrg for dir in $rmdirs; do 83541ab64890Smrg if test -d "$dir"; then 835588de56ccSmrg func_show_eval "rmdir $dir >/dev/null 2>&1" 83561ab64890Smrg fi 83571ab64890Smrg done 83581ab64890Smrg 83591ab64890Smrg exit $exit_status 836088de56ccSmrg} 83611ab64890Smrg 836288de56ccSmrg{ test "$mode" = uninstall || test "$mode" = clean; } && 836388de56ccSmrg func_mode_uninstall ${1+"$@"} 83642e9c7c8cSmrg 836588de56ccSmrgtest -z "$mode" && { 836688de56ccSmrg help="$generic_help" 836788de56ccSmrg func_fatal_help "you must specify a MODE" 836888de56ccSmrg} 836988de56ccSmrg 837088de56ccSmrgtest -z "$exec_cmd" && \ 837188de56ccSmrg func_fatal_help "invalid operation mode \`$mode'" 83721ab64890Smrg 83731ab64890Smrgif test -n "$exec_cmd"; then 837488de56ccSmrg eval exec "$exec_cmd" 83751ab64890Smrg exit $EXIT_FAILURE 83761ab64890Smrgfi 83771ab64890Smrg 837888de56ccSmrgexit $exit_status 83791ab64890Smrg 83801ab64890Smrg 83811ab64890Smrg# The TAGs below are defined such that we never get into a situation 83821ab64890Smrg# in which we disable both kinds of libraries. Given conflicting 83831ab64890Smrg# choices, we go for a static library, that is the most portable, 83841ab64890Smrg# since we can't tell whether shared libraries were disabled because 83851ab64890Smrg# the user asked for that or because the platform doesn't support 83861ab64890Smrg# them. This is particularly important on AIX, because we don't 83871ab64890Smrg# support having both static and shared libraries enabled at the same 83881ab64890Smrg# time on that platform, so we default to a shared-only configuration. 83891ab64890Smrg# If a disable-shared tag is given, we'll fallback to a static-only 83901ab64890Smrg# configuration. But we'll never go from static-only to shared-only. 83911ab64890Smrg 83921ab64890Smrg# ### BEGIN LIBTOOL TAG CONFIG: disable-shared 839388de56ccSmrgbuild_libtool_libs=no 839488de56ccSmrgbuild_old_libs=yes 83951ab64890Smrg# ### END LIBTOOL TAG CONFIG: disable-shared 83961ab64890Smrg 83971ab64890Smrg# ### BEGIN LIBTOOL TAG CONFIG: disable-static 839888de56ccSmrgbuild_old_libs=`case $build_libtool_libs in yes) echo no;; *) echo yes;; esac` 83991ab64890Smrg# ### END LIBTOOL TAG CONFIG: disable-static 84001ab64890Smrg 84011ab64890Smrg# Local Variables: 84021ab64890Smrg# mode:shell-script 84031ab64890Smrg# sh-indentation:2 84041ab64890Smrg# End: 840588de56ccSmrg# vi:sw=2 840688de56ccSmrg 8407