ltmain.sh revision 0b661123
10b661123Smrg# Generated from ltmain.m4sh. 20b661123Smrg 30b661123Smrg# ltmain.sh (GNU libtool) 2.2.6b 40b661123Smrg# Written by Gordon Matzigkeit <gord@gnu.ai.mit.edu>, 1996 50b661123Smrg 60b661123Smrg# Copyright (C) 1996, 1997, 1998, 1999, 2000, 2001, 2003, 2004, 2005, 2006, 2007 2008 Free Software Foundation, Inc. 70b661123Smrg# This is free software; see the source for copying conditions. There is NO 80b661123Smrg# warranty; not even for MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. 90b661123Smrg 100b661123Smrg# GNU Libtool is free software; you can redistribute it and/or modify 11bdcaa8d0Smrg# it under the terms of the GNU General Public License as published by 12bdcaa8d0Smrg# the Free Software Foundation; either version 2 of the License, or 13bdcaa8d0Smrg# (at your option) any later version. 14bdcaa8d0Smrg# 150b661123Smrg# As a special exception to the GNU General Public License, 160b661123Smrg# if you distribute this file as part of a program or library that 170b661123Smrg# is built using GNU Libtool, you may include this file under the 180b661123Smrg# same distribution terms that you use for the rest of that program. 190b661123Smrg# 200b661123Smrg# GNU Libtool is distributed in the hope that it will be useful, but 21bdcaa8d0Smrg# WITHOUT ANY WARRANTY; without even the implied warranty of 22bdcaa8d0Smrg# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU 23bdcaa8d0Smrg# General Public License for more details. 24bdcaa8d0Smrg# 25bdcaa8d0Smrg# You should have received a copy of the GNU General Public License 260b661123Smrg# along with GNU Libtool; see the file COPYING. If not, a copy 270b661123Smrg# can be downloaded from http://www.gnu.org/licenses/gpl.html, 280b661123Smrg# or obtained by writing to the Free Software Foundation, Inc., 290b661123Smrg# 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. 3096ce994aSmrg 310b661123Smrg# Usage: $progname [OPTION]... [MODE-ARG]... 320b661123Smrg# 330b661123Smrg# Provide generalized library-building support services. 340b661123Smrg# 350b661123Smrg# --config show all configuration variables 360b661123Smrg# --debug enable verbose shell tracing 370b661123Smrg# -n, --dry-run display commands without modifying any files 380b661123Smrg# --features display basic configuration information and exit 390b661123Smrg# --mode=MODE use operation mode MODE 400b661123Smrg# --preserve-dup-deps don't remove duplicate dependency libraries 410b661123Smrg# --quiet, --silent don't print informational messages 420b661123Smrg# --tag=TAG use configuration variables from tag TAG 430b661123Smrg# -v, --verbose print informational messages (default) 440b661123Smrg# --version print version information 450b661123Smrg# -h, --help print short or long help message 460b661123Smrg# 470b661123Smrg# MODE must be one of the following: 480b661123Smrg# 490b661123Smrg# clean remove files from the build directory 500b661123Smrg# compile compile a source file into a libtool object 510b661123Smrg# execute automatically set library path, then run a program 520b661123Smrg# finish complete the installation of libtool libraries 530b661123Smrg# install install libraries or executables 540b661123Smrg# link create a library or an executable 550b661123Smrg# uninstall remove libraries from an installed directory 560b661123Smrg# 570b661123Smrg# MODE-ARGS vary depending on the MODE. 580b661123Smrg# Try `$progname --help --mode=MODE' for a more detailed description of MODE. 590b661123Smrg# 600b661123Smrg# When reporting a bug, please describe a test case to reproduce it and 610b661123Smrg# include the following information: 620b661123Smrg# 630b661123Smrg# host-triplet: $host 640b661123Smrg# shell: $SHELL 650b661123Smrg# compiler: $LTCC 660b661123Smrg# compiler flags: $LTCFLAGS 670b661123Smrg# linker: $LD (gnu? $with_gnu_ld) 680b661123Smrg# $progname: (GNU libtool) 2.2.6b 690b661123Smrg# automake: $automake_version 700b661123Smrg# autoconf: $autoconf_version 710b661123Smrg# 720b661123Smrg# Report bugs to <bug-libtool@gnu.org>. 7372313efbSmrg 7472313efbSmrgPROGRAM=ltmain.sh 7572313efbSmrgPACKAGE=libtool 760b661123SmrgVERSION=2.2.6b 770b661123SmrgTIMESTAMP="" 780b661123Smrgpackage_revision=1.3017 7972313efbSmrg 800b661123Smrg# Be Bourne compatible 8172313efbSmrgif test -n "${ZSH_VERSION+set}" && (emulate sh) >/dev/null 2>&1; then 8272313efbSmrg emulate sh 8372313efbSmrg NULLCMD=: 8472313efbSmrg # Zsh 3.x and 4.x performs word splitting on ${1+"$@"}, which 8572313efbSmrg # is contrary to our usage. Disable this feature. 8672313efbSmrg alias -g '${1+"$@"}'='"$@"' 8772313efbSmrg setopt NO_GLOB_SUBST 8872313efbSmrgelse 8972313efbSmrg case `(set -o) 2>/dev/null` in *posix*) set -o posix;; esac 9072313efbSmrgfi 9172313efbSmrgBIN_SH=xpg4; export BIN_SH # for Tru64 9272313efbSmrgDUALCASE=1; export DUALCASE # for MKS sh 9372313efbSmrg 940b661123Smrg# NLS nuisances: We save the old values to restore during execute mode. 9572313efbSmrg# Only set LANG and LC_ALL to C if already set. 9672313efbSmrg# These must not be set unconditionally because not all systems understand 9772313efbSmrg# e.g. LANG=C (notably SCO). 980b661123Smrglt_user_locale= 990b661123Smrglt_safe_locale= 10072313efbSmrgfor lt_var in LANG LANGUAGE LC_ALL LC_CTYPE LC_COLLATE LC_MESSAGES 10172313efbSmrgdo 10272313efbSmrg eval "if test \"\${$lt_var+set}\" = set; then 1030b661123Smrg save_$lt_var=\$$lt_var 1040b661123Smrg $lt_var=C 10572313efbSmrg export $lt_var 1060b661123Smrg lt_user_locale=\"$lt_var=\\\$save_\$lt_var; \$lt_user_locale\" 1070b661123Smrg lt_safe_locale=\"$lt_var=C; \$lt_safe_locale\" 10872313efbSmrg fi" 10972313efbSmrgdone 11072313efbSmrg 1110b661123Smrg$lt_unset CDPATH 1120b661123Smrg 1130b661123Smrg 1140b661123Smrg 1150b661123Smrg 1160b661123Smrg 1170b661123Smrg: ${CP="cp -f"} 1180b661123Smrg: ${ECHO="echo"} 1190b661123Smrg: ${EGREP="/bin/grep -E"} 1200b661123Smrg: ${FGREP="/bin/grep -F"} 1210b661123Smrg: ${GREP="/bin/grep"} 1220b661123Smrg: ${LN_S="ln -s"} 1230b661123Smrg: ${MAKE="make"} 1240b661123Smrg: ${MKDIR="mkdir"} 1250b661123Smrg: ${MV="mv -f"} 1260b661123Smrg: ${RM="rm -f"} 1270b661123Smrg: ${SED="/bin/sed"} 1280b661123Smrg: ${SHELL="${CONFIG_SHELL-/bin/sh}"} 1290b661123Smrg: ${Xsed="$SED -e 1s/^X//"} 1300b661123Smrg 1310b661123Smrg# Global variables: 1320b661123SmrgEXIT_SUCCESS=0 1330b661123SmrgEXIT_FAILURE=1 1340b661123SmrgEXIT_MISMATCH=63 # $? = 63 is used to indicate version mismatch to missing. 1350b661123SmrgEXIT_SKIP=77 # $? = 77 is used to indicate a skipped test to automake. 1360b661123Smrg 1370b661123Smrgexit_status=$EXIT_SUCCESS 13872313efbSmrg 13972313efbSmrg# Make sure IFS has a sensible default 14072313efbSmrglt_nl=' 14172313efbSmrg' 14272313efbSmrgIFS=" $lt_nl" 14372313efbSmrg 1440b661123Smrgdirname="s,/[^/]*$,," 1450b661123Smrgbasename="s,^.*/,," 1460b661123Smrg 1470b661123Smrg# func_dirname_and_basename file append nondir_replacement 1480b661123Smrg# perform func_basename and func_dirname in a single function 1490b661123Smrg# call: 1500b661123Smrg# dirname: Compute the dirname of FILE. If nonempty, 1510b661123Smrg# add APPEND to the result, otherwise set result 1520b661123Smrg# to NONDIR_REPLACEMENT. 1530b661123Smrg# value returned in "$func_dirname_result" 1540b661123Smrg# basename: Compute filename of FILE. 1550b661123Smrg# value retuned in "$func_basename_result" 1560b661123Smrg# Implementation must be kept synchronized with func_dirname 1570b661123Smrg# and func_basename. For efficiency, we do not delegate to 1580b661123Smrg# those functions but instead duplicate the functionality here. 1590b661123Smrgfunc_dirname_and_basename () 1600b661123Smrg{ 1610b661123Smrg # Extract subdirectory from the argument. 1620b661123Smrg func_dirname_result=`$ECHO "X${1}" | $Xsed -e "$dirname"` 1630b661123Smrg if test "X$func_dirname_result" = "X${1}"; then 1640b661123Smrg func_dirname_result="${3}" 1650b661123Smrg else 1660b661123Smrg func_dirname_result="$func_dirname_result${2}" 1670b661123Smrg fi 1680b661123Smrg func_basename_result=`$ECHO "X${1}" | $Xsed -e "$basename"` 1690b661123Smrg} 17072313efbSmrg 1710b661123Smrg# Generated shell functions inserted here. 1720b661123Smrg 1730b661123Smrg# Work around backward compatibility issue on IRIX 6.5. On IRIX 6.4+, sh 1740b661123Smrg# is ksh but when the shell is invoked as "sh" and the current value of 1750b661123Smrg# the _XPG environment variable is not equal to 1 (one), the special 1760b661123Smrg# positional parameter $0, within a function call, is the name of the 1770b661123Smrg# function. 1780b661123Smrgprogpath="$0" 1790b661123Smrg 1800b661123Smrg# The name of this program: 1810b661123Smrg# In the unlikely event $progname began with a '-', it would play havoc with 1820b661123Smrg# func_echo (imagine progname=-n), so we prepend ./ in that case: 1830b661123Smrgfunc_dirname_and_basename "$progpath" 1840b661123Smrgprogname=$func_basename_result 1850b661123Smrgcase $progname in 1860b661123Smrg -*) progname=./$progname ;; 1870b661123Smrgesac 1880b661123Smrg 1890b661123Smrg# Make sure we have an absolute path for reexecution: 1900b661123Smrgcase $progpath in 1910b661123Smrg [\\/]*|[A-Za-z]:\\*) ;; 1920b661123Smrg *[\\/]*) 1930b661123Smrg progdir=$func_dirname_result 1940b661123Smrg progdir=`cd "$progdir" && pwd` 1950b661123Smrg progpath="$progdir/$progname" 1960b661123Smrg ;; 1970b661123Smrg *) 1980b661123Smrg save_IFS="$IFS" 1990b661123Smrg IFS=: 2000b661123Smrg for progdir in $PATH; do 2010b661123Smrg IFS="$save_IFS" 2020b661123Smrg test -x "$progdir/$progname" && break 2030b661123Smrg done 2040b661123Smrg IFS="$save_IFS" 2050b661123Smrg test -n "$progdir" || progdir=`pwd` 2060b661123Smrg progpath="$progdir/$progname" 2070b661123Smrg ;; 2080b661123Smrgesac 2090b661123Smrg 2100b661123Smrg# Sed substitution that helps us do robust quoting. It backslashifies 2110b661123Smrg# metacharacters that are still active within double-quoted strings. 2120b661123SmrgXsed="${SED}"' -e 1s/^X//' 2130b661123Smrgsed_quote_subst='s/\([`"$\\]\)/\\\1/g' 2140b661123Smrg 2150b661123Smrg# Same as above, but do not quote variable references. 2160b661123Smrgdouble_quote_subst='s/\(["`\\]\)/\\\1/g' 2170b661123Smrg 2180b661123Smrg# Re-`\' parameter expansions in output of double_quote_subst that were 2190b661123Smrg# `\'-ed in input to the same. If an odd number of `\' preceded a '$' 2200b661123Smrg# in input to double_quote_subst, that '$' was protected from expansion. 2210b661123Smrg# Since each input `\' is now two `\'s, look for any number of runs of 2220b661123Smrg# four `\'s followed by two `\'s and then a '$'. `\' that '$'. 2230b661123Smrgbs='\\' 2240b661123Smrgbs2='\\\\' 2250b661123Smrgbs4='\\\\\\\\' 2260b661123Smrgdollar='\$' 2270b661123Smrgsed_double_backslash="\ 2280b661123Smrg s/$bs4/&\\ 2290b661123Smrg/g 2300b661123Smrg s/^$bs2$dollar/$bs&/ 2310b661123Smrg s/\\([^$bs]\\)$bs2$dollar/\\1$bs2$bs$dollar/g 2320b661123Smrg s/\n//g" 2330b661123Smrg 2340b661123Smrg# Standard options: 2350b661123Smrgopt_dry_run=false 2360b661123Smrgopt_help=false 2370b661123Smrgopt_quiet=false 2380b661123Smrgopt_verbose=false 2390b661123Smrgopt_warning=: 2400b661123Smrg 2410b661123Smrg# func_echo arg... 2420b661123Smrg# Echo program name prefixed message, along with the current mode 2430b661123Smrg# name if it has been set yet. 2440b661123Smrgfunc_echo () 2450b661123Smrg{ 2460b661123Smrg $ECHO "$progname${mode+: }$mode: $*" 2470b661123Smrg} 2480b661123Smrg 2490b661123Smrg# func_verbose arg... 2500b661123Smrg# Echo program name prefixed message in verbose mode only. 2510b661123Smrgfunc_verbose () 2520b661123Smrg{ 2530b661123Smrg $opt_verbose && func_echo ${1+"$@"} 2540b661123Smrg 2550b661123Smrg # A bug in bash halts the script if the last line of a function 2560b661123Smrg # fails when set -e is in force, so we need another command to 2570b661123Smrg # work around that: 2580b661123Smrg : 2590b661123Smrg} 2600b661123Smrg 2610b661123Smrg# func_error arg... 2620b661123Smrg# Echo program name prefixed message to standard error. 2630b661123Smrgfunc_error () 2640b661123Smrg{ 2650b661123Smrg $ECHO "$progname${mode+: }$mode: "${1+"$@"} 1>&2 2660b661123Smrg} 2670b661123Smrg 2680b661123Smrg# func_warning arg... 2690b661123Smrg# Echo program name prefixed warning message to standard error. 2700b661123Smrgfunc_warning () 2710b661123Smrg{ 2720b661123Smrg $opt_warning && $ECHO "$progname${mode+: }$mode: warning: "${1+"$@"} 1>&2 2730b661123Smrg 2740b661123Smrg # bash bug again: 2750b661123Smrg : 2760b661123Smrg} 2770b661123Smrg 2780b661123Smrg# func_fatal_error arg... 2790b661123Smrg# Echo program name prefixed message to standard error, and exit. 2800b661123Smrgfunc_fatal_error () 2810b661123Smrg{ 2820b661123Smrg func_error ${1+"$@"} 2830b661123Smrg exit $EXIT_FAILURE 2840b661123Smrg} 2850b661123Smrg 2860b661123Smrg# func_fatal_help arg... 2870b661123Smrg# Echo program name prefixed message to standard error, followed by 2880b661123Smrg# a help hint, and exit. 2890b661123Smrgfunc_fatal_help () 2900b661123Smrg{ 2910b661123Smrg func_error ${1+"$@"} 2920b661123Smrg func_fatal_error "$help" 2930b661123Smrg} 2940b661123Smrghelp="Try \`$progname --help' for more information." ## default 2950b661123Smrg 2960b661123Smrg 2970b661123Smrg# func_grep expression filename 2980b661123Smrg# Check whether EXPRESSION matches any line of FILENAME, without output. 2990b661123Smrgfunc_grep () 3000b661123Smrg{ 3010b661123Smrg $GREP "$1" "$2" >/dev/null 2>&1 3020b661123Smrg} 3030b661123Smrg 3040b661123Smrg 3050b661123Smrg# func_mkdir_p directory-path 3060b661123Smrg# Make sure the entire path to DIRECTORY-PATH is available. 3070b661123Smrgfunc_mkdir_p () 3080b661123Smrg{ 3090b661123Smrg my_directory_path="$1" 3100b661123Smrg my_dir_list= 3110b661123Smrg 3120b661123Smrg if test -n "$my_directory_path" && test "$opt_dry_run" != ":"; then 3130b661123Smrg 3140b661123Smrg # Protect directory names starting with `-' 3150b661123Smrg case $my_directory_path in 3160b661123Smrg -*) my_directory_path="./$my_directory_path" ;; 3170b661123Smrg esac 3180b661123Smrg 3190b661123Smrg # While some portion of DIR does not yet exist... 3200b661123Smrg while test ! -d "$my_directory_path"; do 3210b661123Smrg # ...make a list in topmost first order. Use a colon delimited 3220b661123Smrg # list incase some portion of path contains whitespace. 3230b661123Smrg my_dir_list="$my_directory_path:$my_dir_list" 3240b661123Smrg 3250b661123Smrg # If the last portion added has no slash in it, the list is done 3260b661123Smrg case $my_directory_path in */*) ;; *) break ;; esac 3270b661123Smrg 3280b661123Smrg # ...otherwise throw away the child directory and loop 3290b661123Smrg my_directory_path=`$ECHO "X$my_directory_path" | $Xsed -e "$dirname"` 3300b661123Smrg done 3310b661123Smrg my_dir_list=`$ECHO "X$my_dir_list" | $Xsed -e 's,:*$,,'` 3320b661123Smrg 3330b661123Smrg save_mkdir_p_IFS="$IFS"; IFS=':' 3340b661123Smrg for my_dir in $my_dir_list; do 3350b661123Smrg IFS="$save_mkdir_p_IFS" 3360b661123Smrg # mkdir can fail with a `File exist' error if two processes 3370b661123Smrg # try to create one of the directories concurrently. Don't 3380b661123Smrg # stop in that case! 3390b661123Smrg $MKDIR "$my_dir" 2>/dev/null || : 3400b661123Smrg done 3410b661123Smrg IFS="$save_mkdir_p_IFS" 3420b661123Smrg 3430b661123Smrg # Bail out if we (or some other process) failed to create a directory. 3440b661123Smrg test -d "$my_directory_path" || \ 3450b661123Smrg func_fatal_error "Failed to create \`$1'" 3460b661123Smrg fi 3470b661123Smrg} 348bdcaa8d0Smrg 349bdcaa8d0Smrg 350bdcaa8d0Smrg# func_mktempdir [string] 351bdcaa8d0Smrg# Make a temporary directory that won't clash with other running 352bdcaa8d0Smrg# libtool processes, and avoids race conditions if possible. If 353bdcaa8d0Smrg# given, STRING is the basename for that directory. 354bdcaa8d0Smrgfunc_mktempdir () 355bdcaa8d0Smrg{ 356bdcaa8d0Smrg my_template="${TMPDIR-/tmp}/${1-$progname}" 357bdcaa8d0Smrg 3580b661123Smrg if test "$opt_dry_run" = ":"; then 359bdcaa8d0Smrg # Return a directory name, but don't create it in dry-run mode 360bdcaa8d0Smrg my_tmpdir="${my_template}-$$" 361bdcaa8d0Smrg else 362bdcaa8d0Smrg 363bdcaa8d0Smrg # If mktemp works, use that first and foremost 364bdcaa8d0Smrg my_tmpdir=`mktemp -d "${my_template}-XXXXXXXX" 2>/dev/null` 365bdcaa8d0Smrg 366bdcaa8d0Smrg if test ! -d "$my_tmpdir"; then 3670b661123Smrg # Failing that, at least try and use $RANDOM to avoid a race 3680b661123Smrg my_tmpdir="${my_template}-${RANDOM-0}$$" 369bdcaa8d0Smrg 3700b661123Smrg save_mktempdir_umask=`umask` 3710b661123Smrg umask 0077 3720b661123Smrg $MKDIR "$my_tmpdir" 3730b661123Smrg umask $save_mktempdir_umask 374bdcaa8d0Smrg fi 375bdcaa8d0Smrg 376bdcaa8d0Smrg # If we're not in dry-run mode, bomb out on failure 3770b661123Smrg test -d "$my_tmpdir" || \ 3780b661123Smrg func_fatal_error "cannot create temporary directory \`$my_tmpdir'" 379bdcaa8d0Smrg fi 380bdcaa8d0Smrg 3810b661123Smrg $ECHO "X$my_tmpdir" | $Xsed 382bdcaa8d0Smrg} 383bdcaa8d0Smrg 384bdcaa8d0Smrg 3850b661123Smrg# func_quote_for_eval arg 3860b661123Smrg# Aesthetically quote ARG to be evaled later. 3870b661123Smrg# This function returns two values: FUNC_QUOTE_FOR_EVAL_RESULT 3880b661123Smrg# is double-quoted, suitable for a subsequent eval, whereas 3890b661123Smrg# FUNC_QUOTE_FOR_EVAL_UNQUOTED_RESULT has merely all characters 3900b661123Smrg# which are still active within double quotes backslashified. 3910b661123Smrgfunc_quote_for_eval () 392bdcaa8d0Smrg{ 3930b661123Smrg case $1 in 3940b661123Smrg *[\\\`\"\$]*) 3950b661123Smrg func_quote_for_eval_unquoted_result=`$ECHO "X$1" | $Xsed -e "$sed_quote_subst"` ;; 3960b661123Smrg *) 3970b661123Smrg func_quote_for_eval_unquoted_result="$1" ;; 3980b661123Smrg esac 3990b661123Smrg 4000b661123Smrg case $func_quote_for_eval_unquoted_result in 4010b661123Smrg # Double-quote args containing shell metacharacters to delay 4020b661123Smrg # word splitting, command substitution and and variable 4030b661123Smrg # expansion for a subsequent eval. 4040b661123Smrg # Many Bourne shells cannot handle close brackets correctly 4050b661123Smrg # in scan sets, so we specify it separately. 4060b661123Smrg *[\[\~\#\^\&\*\(\)\{\}\|\;\<\>\?\'\ \ ]*|*]*|"") 4070b661123Smrg func_quote_for_eval_result="\"$func_quote_for_eval_unquoted_result\"" 4080b661123Smrg ;; 4090b661123Smrg *) 4100b661123Smrg func_quote_for_eval_result="$func_quote_for_eval_unquoted_result" 411bdcaa8d0Smrg esac 412bdcaa8d0Smrg} 413bdcaa8d0Smrg 414bdcaa8d0Smrg 4150b661123Smrg# func_quote_for_expand arg 4160b661123Smrg# Aesthetically quote ARG to be evaled later; same as above, 4170b661123Smrg# but do not quote variable references. 4180b661123Smrgfunc_quote_for_expand () 419bdcaa8d0Smrg{ 4200b661123Smrg case $1 in 4210b661123Smrg *[\\\`\"]*) 4220b661123Smrg my_arg=`$ECHO "X$1" | $Xsed \ 4230b661123Smrg -e "$double_quote_subst" -e "$sed_double_backslash"` ;; 424bdcaa8d0Smrg *) 4250b661123Smrg my_arg="$1" ;; 4260b661123Smrg esac 4270b661123Smrg 4280b661123Smrg case $my_arg in 4290b661123Smrg # Double-quote args containing shell metacharacters to delay 4300b661123Smrg # word splitting and command substitution for a subsequent eval. 4310b661123Smrg # Many Bourne shells cannot handle close brackets correctly 4320b661123Smrg # in scan sets, so we specify it separately. 4330b661123Smrg *[\[\~\#\^\&\*\(\)\{\}\|\;\<\>\?\'\ \ ]*|*]*|"") 4340b661123Smrg my_arg="\"$my_arg\"" 4350b661123Smrg ;; 4360b661123Smrg esac 4370b661123Smrg 4380b661123Smrg func_quote_for_expand_result="$my_arg" 439bdcaa8d0Smrg} 440bdcaa8d0Smrg 441bdcaa8d0Smrg 4420b661123Smrg# func_show_eval cmd [fail_exp] 4430b661123Smrg# Unless opt_silent is true, then output CMD. Then, if opt_dryrun is 4440b661123Smrg# not true, evaluate CMD. If the evaluation of CMD fails, and FAIL_EXP 4450b661123Smrg# is given, then evaluate it. 4460b661123Smrgfunc_show_eval () 447bdcaa8d0Smrg{ 4480b661123Smrg my_cmd="$1" 4490b661123Smrg my_fail_exp="${2-:}" 45072313efbSmrg 4510b661123Smrg ${opt_silent-false} || { 4520b661123Smrg func_quote_for_expand "$my_cmd" 4530b661123Smrg eval "func_echo $func_quote_for_expand_result" 4540b661123Smrg } 4550b661123Smrg 4560b661123Smrg if ${opt_dry_run-false}; then :; else 4570b661123Smrg eval "$my_cmd" 4580b661123Smrg my_status=$? 4590b661123Smrg if test "$my_status" -eq 0; then :; else 4600b661123Smrg eval "(exit $my_status); $my_fail_exp" 4610b661123Smrg fi 462bdcaa8d0Smrg fi 463bdcaa8d0Smrg} 464bdcaa8d0Smrg 4650b661123Smrg 4660b661123Smrg# func_show_eval_locale cmd [fail_exp] 4670b661123Smrg# Unless opt_silent is true, then output CMD. Then, if opt_dryrun is 4680b661123Smrg# not true, evaluate CMD. If the evaluation of CMD fails, and FAIL_EXP 4690b661123Smrg# is given, then evaluate it. Use the saved locale for evaluation. 4700b661123Smrgfunc_show_eval_locale () 471bdcaa8d0Smrg{ 4720b661123Smrg my_cmd="$1" 4730b661123Smrg my_fail_exp="${2-:}" 4740b661123Smrg 4750b661123Smrg ${opt_silent-false} || { 4760b661123Smrg func_quote_for_expand "$my_cmd" 4770b661123Smrg eval "func_echo $func_quote_for_expand_result" 4780b661123Smrg } 4790b661123Smrg 4800b661123Smrg if ${opt_dry_run-false}; then :; else 4810b661123Smrg eval "$lt_user_locale 4820b661123Smrg $my_cmd" 4830b661123Smrg my_status=$? 4840b661123Smrg eval "$lt_safe_locale" 4850b661123Smrg if test "$my_status" -eq 0; then :; else 4860b661123Smrg eval "(exit $my_status); $my_fail_exp" 4870b661123Smrg fi 48872313efbSmrg fi 4890b661123Smrg} 490bdcaa8d0Smrg 491bdcaa8d0Smrg 4920b661123Smrg 4930b661123Smrg 4940b661123Smrg 4950b661123Smrg# func_version 4960b661123Smrg# Echo version message to standard output and exit. 4970b661123Smrgfunc_version () 4980b661123Smrg{ 4990b661123Smrg $SED -n '/^# '$PROGRAM' (GNU /,/# warranty; / { 5000b661123Smrg s/^# // 5010b661123Smrg s/^# *$// 5020b661123Smrg s/\((C)\)[ 0-9,-]*\( [1-9][0-9]*\)/\1\2/ 5030b661123Smrg p 5040b661123Smrg }' < "$progpath" 5050b661123Smrg exit $? 5060b661123Smrg} 5070b661123Smrg 5080b661123Smrg# func_usage 5090b661123Smrg# Echo short help message to standard output and exit. 5100b661123Smrgfunc_usage () 5110b661123Smrg{ 5120b661123Smrg $SED -n '/^# Usage:/,/# -h/ { 5130b661123Smrg s/^# // 5140b661123Smrg s/^# *$// 5150b661123Smrg s/\$progname/'$progname'/ 5160b661123Smrg p 5170b661123Smrg }' < "$progpath" 5180b661123Smrg $ECHO 5190b661123Smrg $ECHO "run \`$progname --help | more' for full usage" 5200b661123Smrg exit $? 5210b661123Smrg} 5220b661123Smrg 5230b661123Smrg# func_help 5240b661123Smrg# Echo long help message to standard output and exit. 5250b661123Smrgfunc_help () 5260b661123Smrg{ 5270b661123Smrg $SED -n '/^# Usage:/,/# Report bugs to/ { 5280b661123Smrg s/^# // 5290b661123Smrg s/^# *$// 5300b661123Smrg s*\$progname*'$progname'* 5310b661123Smrg s*\$host*'"$host"'* 5320b661123Smrg s*\$SHELL*'"$SHELL"'* 5330b661123Smrg s*\$LTCC*'"$LTCC"'* 5340b661123Smrg s*\$LTCFLAGS*'"$LTCFLAGS"'* 5350b661123Smrg s*\$LD*'"$LD"'* 5360b661123Smrg s/\$with_gnu_ld/'"$with_gnu_ld"'/ 5370b661123Smrg s/\$automake_version/'"`(automake --version) 2>/dev/null |$SED 1q`"'/ 5380b661123Smrg s/\$autoconf_version/'"`(autoconf --version) 2>/dev/null |$SED 1q`"'/ 5390b661123Smrg p 5400b661123Smrg }' < "$progpath" 5410b661123Smrg exit $? 5420b661123Smrg} 5430b661123Smrg 5440b661123Smrg# func_missing_arg argname 5450b661123Smrg# Echo program name prefixed message to standard error and set global 5460b661123Smrg# exit_cmd. 5470b661123Smrgfunc_missing_arg () 5480b661123Smrg{ 5490b661123Smrg func_error "missing argument for $1" 5500b661123Smrg exit_cmd=exit 55172313efbSmrg} 55272313efbSmrg 5530b661123Smrgexit_cmd=: 55472313efbSmrg 55572313efbSmrg 5560b661123Smrg 5570b661123Smrg 5580b661123Smrg 5590b661123Smrg# Check that we have a working $ECHO. 5600b661123Smrgif test "X$1" = X--no-reexec; then 5610b661123Smrg # Discard the --no-reexec flag, and continue. 56272313efbSmrg shift 5630b661123Smrgelif test "X$1" = X--fallback-echo; then 5640b661123Smrg # Avoid inline document here, it may be left over 5650b661123Smrg : 5660b661123Smrgelif test "X`{ $ECHO '\t'; } 2>/dev/null`" = 'X\t'; then 5670b661123Smrg # Yippee, $ECHO works! 5680b661123Smrg : 5690b661123Smrgelse 5700b661123Smrg # Restart under the correct shell, and then maybe $ECHO will work. 5710b661123Smrg exec $SHELL "$progpath" --no-reexec ${1+"$@"} 5720b661123Smrgfi 573bdcaa8d0Smrg 5740b661123Smrgif test "X$1" = X--fallback-echo; then 5750b661123Smrg # used as fallback echo 5760b661123Smrg shift 5770b661123Smrg cat <<EOF 5780b661123Smrg$* 5790b661123SmrgEOF 5800b661123Smrg exit $EXIT_SUCCESS 5810b661123Smrgfi 582bdcaa8d0Smrg 5830b661123Smrgmagic="%%%MAGIC variable%%%" 5840b661123Smrgmagic_exe="%%%MAGIC EXE variable%%%" 585bdcaa8d0Smrg 5860b661123Smrg# Global variables. 5870b661123Smrg# $mode is unset 5880b661123Smrgnonopt= 5890b661123Smrgexecute_dlfiles= 5900b661123Smrgpreserve_args= 5910b661123Smrglo2o="s/\\.lo\$/.${objext}/" 5920b661123Smrgo2lo="s/\\.${objext}\$/.lo/" 5930b661123Smrgextracted_archives= 5940b661123Smrgextracted_serial=0 595bdcaa8d0Smrg 5960b661123Smrgopt_dry_run=false 5970b661123Smrgopt_duplicate_deps=false 5980b661123Smrgopt_silent=false 5990b661123Smrgopt_debug=: 60072313efbSmrg 6010b661123Smrg# If this variable is set in any of the actions, the command in it 6020b661123Smrg# will be execed at the end. This prevents here-documents from being 6030b661123Smrg# left over by shells. 6040b661123Smrgexec_cmd= 6050b661123Smrg 6060b661123Smrg# func_fatal_configuration arg... 6070b661123Smrg# Echo program name prefixed message to standard error, followed by 6080b661123Smrg# a configuration failure hint, and exit. 6090b661123Smrgfunc_fatal_configuration () 6100b661123Smrg{ 6110b661123Smrg func_error ${1+"$@"} 6120b661123Smrg func_error "See the $PACKAGE documentation for more information." 6130b661123Smrg func_fatal_error "Fatal configuration error." 6140b661123Smrg} 61572313efbSmrg 61672313efbSmrg 6170b661123Smrg# func_config 6180b661123Smrg# Display the configuration for all the tags in this script. 6190b661123Smrgfunc_config () 6200b661123Smrg{ 6210b661123Smrg re_begincf='^# ### BEGIN LIBTOOL' 6220b661123Smrg re_endcf='^# ### END LIBTOOL' 6230b661123Smrg 6240b661123Smrg # Default configuration. 6250b661123Smrg $SED "1,/$re_begincf CONFIG/d;/$re_endcf CONFIG/,\$d" < "$progpath" 626bdcaa8d0Smrg 627bdcaa8d0Smrg # Now print the configurations for the tags. 628bdcaa8d0Smrg for tagname in $taglist; do 6290b661123Smrg $SED -n "/$re_begincf TAG CONFIG: $tagname\$/,/$re_endcf TAG CONFIG: $tagname\$/p" < "$progpath" 630bdcaa8d0Smrg done 63196ce994aSmrg 6320b661123Smrg exit $? 6330b661123Smrg} 63496ce994aSmrg 6350b661123Smrg# func_features 6360b661123Smrg# Display the features supported by this script. 6370b661123Smrgfunc_features () 6380b661123Smrg{ 6390b661123Smrg $ECHO "host: $host" 640bdcaa8d0Smrg if test "$build_libtool_libs" = yes; then 6410b661123Smrg $ECHO "enable shared libraries" 642bdcaa8d0Smrg else 6430b661123Smrg $ECHO "disable shared libraries" 644bdcaa8d0Smrg fi 645bdcaa8d0Smrg if test "$build_old_libs" = yes; then 6460b661123Smrg $ECHO "enable static libraries" 647bdcaa8d0Smrg else 6480b661123Smrg $ECHO "disable static libraries" 649bdcaa8d0Smrg fi 6500b661123Smrg 651bdcaa8d0Smrg exit $? 6520b661123Smrg} 653bdcaa8d0Smrg 6540b661123Smrg# func_enable_tag tagname 6550b661123Smrg# Verify that TAGNAME is valid, and either flag an error and exit, or 6560b661123Smrg# enable the TAGNAME tag. We also add TAGNAME to the global $taglist 6570b661123Smrg# variable here. 6580b661123Smrgfunc_enable_tag () 6590b661123Smrg{ 6600b661123Smrg # Global variable: 6610b661123Smrg tagname="$1" 662bdcaa8d0Smrg 6630b661123Smrg re_begincf="^# ### BEGIN LIBTOOL TAG CONFIG: $tagname\$" 6640b661123Smrg re_endcf="^# ### END LIBTOOL TAG CONFIG: $tagname\$" 6650b661123Smrg sed_extractcf="/$re_begincf/,/$re_endcf/p" 666bdcaa8d0Smrg 6670b661123Smrg # Validate tagname. 6680b661123Smrg case $tagname in 6690b661123Smrg *[!-_A-Za-z0-9,/]*) 6700b661123Smrg func_fatal_error "invalid tag name: $tagname" 6710b661123Smrg ;; 6720b661123Smrg esac 673bdcaa8d0Smrg 6740b661123Smrg # Don't test for the "default" C tag, as we know it's 6750b661123Smrg # there but not specially marked. 6760b661123Smrg case $tagname in 6770b661123Smrg CC) ;; 6780b661123Smrg *) 6790b661123Smrg if $GREP "$re_begincf" "$progpath" >/dev/null 2>&1; then 6800b661123Smrg taglist="$taglist $tagname" 6810b661123Smrg 6820b661123Smrg # Evaluate the configuration. Be careful to quote the path 6830b661123Smrg # and the sed script, to avoid splitting on whitespace, but 6840b661123Smrg # also don't use non-portable quotes within backquotes within 6850b661123Smrg # quotes we have to do it in 2 steps: 6860b661123Smrg extractedcf=`$SED -n -e "$sed_extractcf" < "$progpath"` 6870b661123Smrg eval "$extractedcf" 6880b661123Smrg else 6890b661123Smrg func_error "ignoring unknown tag $tagname" 6900b661123Smrg fi 6910b661123Smrg ;; 6920b661123Smrg esac 6930b661123Smrg} 6940b661123Smrg 6950b661123Smrg# Parse options once, thoroughly. This comes as soon as possible in 6960b661123Smrg# the script to make things like `libtool --version' happen quickly. 6970b661123Smrg{ 69896ce994aSmrg 6990b661123Smrg # Shorthand for --mode=foo, only valid as the first argument 7000b661123Smrg case $1 in 7010b661123Smrg clean|clea|cle|cl) 7020b661123Smrg shift; set dummy --mode clean ${1+"$@"}; shift 703bdcaa8d0Smrg ;; 7040b661123Smrg compile|compil|compi|comp|com|co|c) 7050b661123Smrg shift; set dummy --mode compile ${1+"$@"}; shift 706bdcaa8d0Smrg ;; 7070b661123Smrg execute|execut|execu|exec|exe|ex|e) 7080b661123Smrg shift; set dummy --mode execute ${1+"$@"}; shift 70972313efbSmrg ;; 7100b661123Smrg finish|finis|fini|fin|fi|f) 7110b661123Smrg shift; set dummy --mode finish ${1+"$@"}; shift 71272313efbSmrg ;; 7130b661123Smrg install|instal|insta|inst|ins|in|i) 7140b661123Smrg shift; set dummy --mode install ${1+"$@"}; shift 7150b661123Smrg ;; 7160b661123Smrg link|lin|li|l) 7170b661123Smrg shift; set dummy --mode link ${1+"$@"}; shift 7180b661123Smrg ;; 7190b661123Smrg uninstall|uninstal|uninsta|uninst|unins|unin|uni|un|u) 7200b661123Smrg shift; set dummy --mode uninstall ${1+"$@"}; shift 721bdcaa8d0Smrg ;; 722bdcaa8d0Smrg esac 723bdcaa8d0Smrg 7240b661123Smrg # Parse non-mode specific arguments: 7250b661123Smrg while test "$#" -gt 0; do 7260b661123Smrg opt="$1" 7270b661123Smrg shift 72872313efbSmrg 7290b661123Smrg case $opt in 7300b661123Smrg --config) func_config ;; 73172313efbSmrg 7320b661123Smrg --debug) preserve_args="$preserve_args $opt" 7330b661123Smrg func_echo "enabling shell trace mode" 7340b661123Smrg opt_debug='set -x' 7350b661123Smrg $opt_debug 7360b661123Smrg ;; 73772313efbSmrg 7380b661123Smrg -dlopen) test "$#" -eq 0 && func_missing_arg "$opt" && break 7390b661123Smrg execute_dlfiles="$execute_dlfiles $1" 7400b661123Smrg shift 7410b661123Smrg ;; 74272313efbSmrg 7430b661123Smrg --dry-run | -n) opt_dry_run=: ;; 7440b661123Smrg --features) func_features ;; 7450b661123Smrg --finish) mode="finish" ;; 7460b661123Smrg 7470b661123Smrg --mode) test "$#" -eq 0 && func_missing_arg "$opt" && break 7480b661123Smrg case $1 in 7490b661123Smrg # Valid mode arguments: 7500b661123Smrg clean) ;; 7510b661123Smrg compile) ;; 7520b661123Smrg execute) ;; 7530b661123Smrg finish) ;; 7540b661123Smrg install) ;; 7550b661123Smrg link) ;; 7560b661123Smrg relink) ;; 7570b661123Smrg uninstall) ;; 7580b661123Smrg 7590b661123Smrg # Catch anything else as an error 7600b661123Smrg *) func_error "invalid argument for $opt" 7610b661123Smrg exit_cmd=exit 7620b661123Smrg break 7630b661123Smrg ;; 7640b661123Smrg esac 7650b661123Smrg 7660b661123Smrg mode="$1" 7670b661123Smrg shift 7680b661123Smrg ;; 7690b661123Smrg 7700b661123Smrg --preserve-dup-deps) 7710b661123Smrg opt_duplicate_deps=: ;; 7720b661123Smrg 7730b661123Smrg --quiet|--silent) preserve_args="$preserve_args $opt" 7740b661123Smrg opt_silent=: 7750b661123Smrg ;; 7760b661123Smrg 7770b661123Smrg --verbose| -v) preserve_args="$preserve_args $opt" 7780b661123Smrg opt_silent=false 7790b661123Smrg ;; 7800b661123Smrg 7810b661123Smrg --tag) test "$#" -eq 0 && func_missing_arg "$opt" && break 7820b661123Smrg preserve_args="$preserve_args $opt $1" 7830b661123Smrg func_enable_tag "$1" # tagname is set here 7840b661123Smrg shift 7850b661123Smrg ;; 7860b661123Smrg 7870b661123Smrg # Separate optargs to long options: 7880b661123Smrg -dlopen=*|--mode=*|--tag=*) 7890b661123Smrg func_opt_split "$opt" 7900b661123Smrg set dummy "$func_opt_split_opt" "$func_opt_split_arg" ${1+"$@"} 7910b661123Smrg shift 7920b661123Smrg ;; 7930b661123Smrg 7940b661123Smrg -\?|-h) func_usage ;; 7950b661123Smrg --help) opt_help=: ;; 7960b661123Smrg --version) func_version ;; 7970b661123Smrg 7980b661123Smrg -*) func_fatal_help "unrecognized option \`$opt'" ;; 7990b661123Smrg 8000b661123Smrg *) nonopt="$opt" 8010b661123Smrg break 8020b661123Smrg ;; 8030b661123Smrg esac 8040b661123Smrg done 8050b661123Smrg 8060b661123Smrg 8070b661123Smrg case $host in 8080b661123Smrg *cygwin* | *mingw* | *pw32* | *cegcc*) 8090b661123Smrg # don't eliminate duplications in $postdeps and $predeps 8100b661123Smrg opt_duplicate_compiler_generated_deps=: 81196ce994aSmrg ;; 81296ce994aSmrg *) 8130b661123Smrg opt_duplicate_compiler_generated_deps=$opt_duplicate_deps 8140b661123Smrg ;; 8150b661123Smrg esac 81672313efbSmrg 8170b661123Smrg # Having warned about all mis-specified options, bail out if 8180b661123Smrg # anything was wrong. 8190b661123Smrg $exit_cmd $EXIT_FAILURE 8200b661123Smrg} 8210b661123Smrg 8220b661123Smrg# func_check_version_match 8230b661123Smrg# Ensure that we are using m4 macros, and libtool script from the same 8240b661123Smrg# release of libtool. 8250b661123Smrgfunc_check_version_match () 8260b661123Smrg{ 8270b661123Smrg if test "$package_revision" != "$macro_revision"; then 8280b661123Smrg if test "$VERSION" != "$macro_version"; then 8290b661123Smrg if test -z "$macro_version"; then 8300b661123Smrg cat >&2 <<_LT_EOF 8310b661123Smrg$progname: Version mismatch error. This is $PACKAGE $VERSION, but the 8320b661123Smrg$progname: definition of this LT_INIT comes from an older release. 8330b661123Smrg$progname: You should recreate aclocal.m4 with macros from $PACKAGE $VERSION 8340b661123Smrg$progname: and run autoconf again. 8350b661123Smrg_LT_EOF 8360b661123Smrg else 8370b661123Smrg cat >&2 <<_LT_EOF 8380b661123Smrg$progname: Version mismatch error. This is $PACKAGE $VERSION, but the 8390b661123Smrg$progname: definition of this LT_INIT comes from $PACKAGE $macro_version. 8400b661123Smrg$progname: You should recreate aclocal.m4 with macros from $PACKAGE $VERSION 8410b661123Smrg$progname: and run autoconf again. 8420b661123Smrg_LT_EOF 843bdcaa8d0Smrg fi 8440b661123Smrg else 8450b661123Smrg cat >&2 <<_LT_EOF 8460b661123Smrg$progname: Version mismatch error. This is $PACKAGE $VERSION, revision $package_revision, 8470b661123Smrg$progname: but the definition of this LT_INIT comes from revision $macro_revision. 8480b661123Smrg$progname: You should recreate aclocal.m4 with macros from revision $package_revision 8490b661123Smrg$progname: of $PACKAGE $VERSION and run autoconf again. 8500b661123Smrg_LT_EOF 8510b661123Smrg fi 8520b661123Smrg 8530b661123Smrg exit $EXIT_MISMATCH 8540b661123Smrg fi 8550b661123Smrg} 8560b661123Smrg 8570b661123Smrg 8580b661123Smrg## ----------- ## 8590b661123Smrg## Main. ## 8600b661123Smrg## ----------- ## 8610b661123Smrg 8620b661123Smrg$opt_help || { 8630b661123Smrg # Sanity checks first: 8640b661123Smrg func_check_version_match 8650b661123Smrg 8660b661123Smrg if test "$build_libtool_libs" != yes && test "$build_old_libs" != yes; then 8670b661123Smrg func_fatal_configuration "not configured to build any kind of library" 868bdcaa8d0Smrg fi 869bdcaa8d0Smrg 8700b661123Smrg test -z "$mode" && func_fatal_error "error: you must specify a MODE." 8710b661123Smrg 8720b661123Smrg 8730b661123Smrg # Darwin sucks 8740b661123Smrg eval std_shrext=\"$shrext_cmds\" 8750b661123Smrg 8760b661123Smrg 877bdcaa8d0Smrg # Only execute mode is allowed to have -dlopen flags. 878bdcaa8d0Smrg if test -n "$execute_dlfiles" && test "$mode" != execute; then 8790b661123Smrg func_error "unrecognized option \`-dlopen'" 8800b661123Smrg $ECHO "$help" 1>&2 881bdcaa8d0Smrg exit $EXIT_FAILURE 882bdcaa8d0Smrg fi 883bdcaa8d0Smrg 884bdcaa8d0Smrg # Change the help message to a mode-specific one. 885bdcaa8d0Smrg generic_help="$help" 8860b661123Smrg help="Try \`$progname --help --mode=$mode' for more information." 8870b661123Smrg} 888bdcaa8d0Smrg 889bdcaa8d0Smrg 8900b661123Smrg# func_lalib_p file 8910b661123Smrg# True iff FILE is a libtool `.la' library or `.lo' object file. 8920b661123Smrg# This function is only a basic sanity check; it will hardly flush out 8930b661123Smrg# determined imposters. 8940b661123Smrgfunc_lalib_p () 8950b661123Smrg{ 8960b661123Smrg test -f "$1" && 8970b661123Smrg $SED -e 4q "$1" 2>/dev/null \ 8980b661123Smrg | $GREP "^# Generated by .*$PACKAGE" > /dev/null 2>&1 8990b661123Smrg} 900bdcaa8d0Smrg 9010b661123Smrg# func_lalib_unsafe_p file 9020b661123Smrg# True iff FILE is a libtool `.la' library or `.lo' object file. 9030b661123Smrg# This function implements the same check as func_lalib_p without 9040b661123Smrg# resorting to external programs. To this end, it redirects stdin and 9050b661123Smrg# closes it afterwards, without saving the original file descriptor. 9060b661123Smrg# As a safety measure, use it only where a negative result would be 9070b661123Smrg# fatal anyway. Works if `file' does not exist. 9080b661123Smrgfunc_lalib_unsafe_p () 9090b661123Smrg{ 9100b661123Smrg lalib_p=no 9110b661123Smrg if test -f "$1" && test -r "$1" && exec 5<&0 <"$1"; then 9120b661123Smrg for lalib_p_l in 1 2 3 4 9130b661123Smrg do 9140b661123Smrg read lalib_p_line 9150b661123Smrg case "$lalib_p_line" in 9160b661123Smrg \#\ Generated\ by\ *$PACKAGE* ) lalib_p=yes; break;; 9170b661123Smrg esac 9180b661123Smrg done 9190b661123Smrg exec 0<&5 5<&- 9200b661123Smrg fi 9210b661123Smrg test "$lalib_p" = yes 9220b661123Smrg} 923bdcaa8d0Smrg 9240b661123Smrg# func_ltwrapper_script_p file 9250b661123Smrg# True iff FILE is a libtool wrapper script 9260b661123Smrg# This function is only a basic sanity check; it will hardly flush out 9270b661123Smrg# determined imposters. 9280b661123Smrgfunc_ltwrapper_script_p () 9290b661123Smrg{ 9300b661123Smrg func_lalib_p "$1" 9310b661123Smrg} 932bdcaa8d0Smrg 9330b661123Smrg# func_ltwrapper_executable_p file 9340b661123Smrg# True iff FILE is a libtool wrapper executable 9350b661123Smrg# This function is only a basic sanity check; it will hardly flush out 9360b661123Smrg# determined imposters. 9370b661123Smrgfunc_ltwrapper_executable_p () 9380b661123Smrg{ 9390b661123Smrg func_ltwrapper_exec_suffix= 9400b661123Smrg case $1 in 9410b661123Smrg *.exe) ;; 9420b661123Smrg *) func_ltwrapper_exec_suffix=.exe ;; 9430b661123Smrg esac 9440b661123Smrg $GREP "$magic_exe" "$1$func_ltwrapper_exec_suffix" >/dev/null 2>&1 9450b661123Smrg} 94672313efbSmrg 9470b661123Smrg# func_ltwrapper_scriptname file 9480b661123Smrg# Assumes file is an ltwrapper_executable 9490b661123Smrg# uses $file to determine the appropriate filename for a 9500b661123Smrg# temporary ltwrapper_script. 9510b661123Smrgfunc_ltwrapper_scriptname () 9520b661123Smrg{ 9530b661123Smrg func_ltwrapper_scriptname_result="" 9540b661123Smrg if func_ltwrapper_executable_p "$1"; then 9550b661123Smrg func_dirname_and_basename "$1" "" "." 9560b661123Smrg func_stripname '' '.exe' "$func_basename_result" 9570b661123Smrg func_ltwrapper_scriptname_result="$func_dirname_result/$objdir/${func_stripname_result}_ltshwrapper" 9580b661123Smrg fi 9590b661123Smrg} 9600b661123Smrg 9610b661123Smrg# func_ltwrapper_p file 9620b661123Smrg# True iff FILE is a libtool wrapper script or wrapper executable 9630b661123Smrg# This function is only a basic sanity check; it will hardly flush out 9640b661123Smrg# determined imposters. 9650b661123Smrgfunc_ltwrapper_p () 9660b661123Smrg{ 9670b661123Smrg func_ltwrapper_script_p "$1" || func_ltwrapper_executable_p "$1" 9680b661123Smrg} 9690b661123Smrg 9700b661123Smrg 9710b661123Smrg# func_execute_cmds commands fail_cmd 9720b661123Smrg# Execute tilde-delimited COMMANDS. 9730b661123Smrg# If FAIL_CMD is given, eval that upon failure. 9740b661123Smrg# FAIL_CMD may read-access the current command in variable CMD! 9750b661123Smrgfunc_execute_cmds () 9760b661123Smrg{ 9770b661123Smrg $opt_debug 9780b661123Smrg save_ifs=$IFS; IFS='~' 9790b661123Smrg for cmd in $1; do 9800b661123Smrg IFS=$save_ifs 9810b661123Smrg eval cmd=\"$cmd\" 9820b661123Smrg func_show_eval "$cmd" "${2-:}" 9830b661123Smrg done 9840b661123Smrg IFS=$save_ifs 9850b661123Smrg} 9860b661123Smrg 9870b661123Smrg 9880b661123Smrg# func_source file 9890b661123Smrg# Source FILE, adding directory component if necessary. 9900b661123Smrg# Note that it is not necessary on cygwin/mingw to append a dot to 9910b661123Smrg# FILE even if both FILE and FILE.exe exist: automatic-append-.exe 9920b661123Smrg# behavior happens only for exec(3), not for open(2)! Also, sourcing 9930b661123Smrg# `FILE.' does not work on cygwin managed mounts. 9940b661123Smrgfunc_source () 9950b661123Smrg{ 9960b661123Smrg $opt_debug 9970b661123Smrg case $1 in 9980b661123Smrg */* | *\\*) . "$1" ;; 9990b661123Smrg *) . "./$1" ;; 10000b661123Smrg esac 10010b661123Smrg} 10020b661123Smrg 10030b661123Smrg 10040b661123Smrg# func_infer_tag arg 10050b661123Smrg# Infer tagged configuration to use if any are available and 10060b661123Smrg# if one wasn't chosen via the "--tag" command line option. 10070b661123Smrg# Only attempt this if the compiler in the base compile 10080b661123Smrg# command doesn't match the default compiler. 10090b661123Smrg# arg is usually of the form 'gcc ...' 10100b661123Smrgfunc_infer_tag () 10110b661123Smrg{ 10120b661123Smrg $opt_debug 10130b661123Smrg if test -n "$available_tags" && test -z "$tagname"; then 10140b661123Smrg CC_quoted= 10150b661123Smrg for arg in $CC; do 10160b661123Smrg func_quote_for_eval "$arg" 10170b661123Smrg CC_quoted="$CC_quoted $func_quote_for_eval_result" 10180b661123Smrg done 10190b661123Smrg case $@ in 10200b661123Smrg # Blanks in the command may have been stripped by the calling shell, 10210b661123Smrg # but not from the CC environment variable when configure was run. 10220b661123Smrg " $CC "* | "$CC "* | " `$ECHO $CC` "* | "`$ECHO $CC` "* | " $CC_quoted"* | "$CC_quoted "* | " `$ECHO $CC_quoted` "* | "`$ECHO $CC_quoted` "*) ;; 10230b661123Smrg # Blanks at the start of $base_compile will cause this to fail 10240b661123Smrg # if we don't check for them as well. 10250b661123Smrg *) 10260b661123Smrg for z in $available_tags; do 10270b661123Smrg if $GREP "^# ### BEGIN LIBTOOL TAG CONFIG: $z$" < "$progpath" > /dev/null; then 10280b661123Smrg # Evaluate the configuration. 10290b661123Smrg eval "`${SED} -n -e '/^# ### BEGIN LIBTOOL TAG CONFIG: '$z'$/,/^# ### END LIBTOOL TAG CONFIG: '$z'$/p' < $progpath`" 10300b661123Smrg CC_quoted= 10310b661123Smrg for arg in $CC; do 10320b661123Smrg # Double-quote args containing other shell metacharacters. 10330b661123Smrg func_quote_for_eval "$arg" 10340b661123Smrg CC_quoted="$CC_quoted $func_quote_for_eval_result" 10350b661123Smrg done 10360b661123Smrg case "$@ " in 10370b661123Smrg " $CC "* | "$CC "* | " `$ECHO $CC` "* | "`$ECHO $CC` "* | " $CC_quoted"* | "$CC_quoted "* | " `$ECHO $CC_quoted` "* | "`$ECHO $CC_quoted` "*) 10380b661123Smrg # The compiler in the base compile command matches 10390b661123Smrg # the one in the tagged configuration. 10400b661123Smrg # Assume this is the tagged configuration we want. 10410b661123Smrg tagname=$z 10420b661123Smrg break 10430b661123Smrg ;; 10440b661123Smrg esac 10450b661123Smrg fi 10460b661123Smrg done 10470b661123Smrg # If $tagname still isn't set, then no tagged configuration 10480b661123Smrg # was found and let the user know that the "--tag" command 10490b661123Smrg # line option must be used. 10500b661123Smrg if test -z "$tagname"; then 10510b661123Smrg func_echo "unable to infer tagged configuration" 10520b661123Smrg func_fatal_error "specify a tag with \`--tag'" 10530b661123Smrg# else 10540b661123Smrg# func_verbose "using $tagname tagged configuration" 10550b661123Smrg fi 10560b661123Smrg ;; 10570b661123Smrg esac 10580b661123Smrg fi 10590b661123Smrg} 10600b661123Smrg 10610b661123Smrg 10620b661123Smrg 10630b661123Smrg# func_write_libtool_object output_name pic_name nonpic_name 10640b661123Smrg# Create a libtool object file (analogous to a ".la" file), 10650b661123Smrg# but don't create it if we're doing a dry run. 10660b661123Smrgfunc_write_libtool_object () 10670b661123Smrg{ 10680b661123Smrg write_libobj=${1} 10690b661123Smrg if test "$build_libtool_libs" = yes; then 10700b661123Smrg write_lobj=\'${2}\' 10710b661123Smrg else 10720b661123Smrg write_lobj=none 10730b661123Smrg fi 10740b661123Smrg 10750b661123Smrg if test "$build_old_libs" = yes; then 10760b661123Smrg write_oldobj=\'${3}\' 10770b661123Smrg else 10780b661123Smrg write_oldobj=none 10790b661123Smrg fi 10800b661123Smrg 10810b661123Smrg $opt_dry_run || { 10820b661123Smrg cat >${write_libobj}T <<EOF 10830b661123Smrg# $write_libobj - a libtool object file 10840b661123Smrg# Generated by $PROGRAM (GNU $PACKAGE$TIMESTAMP) $VERSION 10850b661123Smrg# 10860b661123Smrg# Please DO NOT delete this file! 10870b661123Smrg# It is necessary for linking the library. 10880b661123Smrg 10890b661123Smrg# Name of the PIC object. 10900b661123Smrgpic_object=$write_lobj 10910b661123Smrg 10920b661123Smrg# Name of the non-PIC object 10930b661123Smrgnon_pic_object=$write_oldobj 10940b661123Smrg 10950b661123SmrgEOF 10960b661123Smrg $MV "${write_libobj}T" "${write_libobj}" 10970b661123Smrg } 10980b661123Smrg} 10990b661123Smrg 11000b661123Smrg# func_mode_compile arg... 11010b661123Smrgfunc_mode_compile () 11020b661123Smrg{ 11030b661123Smrg $opt_debug 11040b661123Smrg # Get the compilation command and the source file. 11050b661123Smrg base_compile= 11060b661123Smrg srcfile="$nonopt" # always keep a non-empty value in "srcfile" 11070b661123Smrg suppress_opt=yes 11080b661123Smrg suppress_output= 11090b661123Smrg arg_mode=normal 11100b661123Smrg libobj= 11110b661123Smrg later= 11120b661123Smrg pie_flag= 11130b661123Smrg 11140b661123Smrg for arg 11150b661123Smrg do 11160b661123Smrg case $arg_mode in 11170b661123Smrg arg ) 11180b661123Smrg # do not "continue". Instead, add this to base_compile 11190b661123Smrg lastarg="$arg" 11200b661123Smrg arg_mode=normal 11210b661123Smrg ;; 11220b661123Smrg 11230b661123Smrg target ) 11240b661123Smrg libobj="$arg" 11250b661123Smrg arg_mode=normal 11260b661123Smrg continue 11270b661123Smrg ;; 11280b661123Smrg 11290b661123Smrg normal ) 11300b661123Smrg # Accept any command-line options. 11310b661123Smrg case $arg in 11320b661123Smrg -o) 11330b661123Smrg test -n "$libobj" && \ 11340b661123Smrg func_fatal_error "you cannot specify \`-o' more than once" 11350b661123Smrg arg_mode=target 11360b661123Smrg continue 11370b661123Smrg ;; 11380b661123Smrg 11390b661123Smrg -pie | -fpie | -fPIE) 11400b661123Smrg pie_flag="$pie_flag $arg" 11410b661123Smrg continue 11420b661123Smrg ;; 11430b661123Smrg 11440b661123Smrg -shared | -static | -prefer-pic | -prefer-non-pic) 11450b661123Smrg later="$later $arg" 11460b661123Smrg continue 11470b661123Smrg ;; 11480b661123Smrg 11490b661123Smrg -no-suppress) 115072313efbSmrg suppress_opt=no 115172313efbSmrg continue 115272313efbSmrg ;; 115372313efbSmrg 115472313efbSmrg -Xcompiler) 115572313efbSmrg arg_mode=arg # the next one goes into the "base_compile" arg list 115672313efbSmrg continue # The current "srcfile" will either be retained or 115772313efbSmrg ;; # replaced later. I would guess that would be a bug. 115872313efbSmrg 115972313efbSmrg -Wc,*) 11600b661123Smrg func_stripname '-Wc,' '' "$arg" 11610b661123Smrg args=$func_stripname_result 116272313efbSmrg lastarg= 116372313efbSmrg save_ifs="$IFS"; IFS=',' 11640b661123Smrg for arg in $args; do 116572313efbSmrg IFS="$save_ifs" 11660b661123Smrg func_quote_for_eval "$arg" 11670b661123Smrg lastarg="$lastarg $func_quote_for_eval_result" 1168bdcaa8d0Smrg done 1169bdcaa8d0Smrg IFS="$save_ifs" 11700b661123Smrg func_stripname ' ' '' "$lastarg" 11710b661123Smrg lastarg=$func_stripname_result 1172bdcaa8d0Smrg 1173bdcaa8d0Smrg # Add the arguments to base_compile. 1174bdcaa8d0Smrg base_compile="$base_compile $lastarg" 1175bdcaa8d0Smrg continue 1176bdcaa8d0Smrg ;; 1177bdcaa8d0Smrg 11780b661123Smrg *) 1179bdcaa8d0Smrg # Accept the current argument as the source file. 1180bdcaa8d0Smrg # The previous "srcfile" becomes the current argument. 1181bdcaa8d0Smrg # 1182bdcaa8d0Smrg lastarg="$srcfile" 1183bdcaa8d0Smrg srcfile="$arg" 1184bdcaa8d0Smrg ;; 1185bdcaa8d0Smrg esac # case $arg 1186bdcaa8d0Smrg ;; 1187bdcaa8d0Smrg esac # case $arg_mode 1188bdcaa8d0Smrg 1189bdcaa8d0Smrg # Aesthetically quote the previous argument. 11900b661123Smrg func_quote_for_eval "$lastarg" 11910b661123Smrg base_compile="$base_compile $func_quote_for_eval_result" 1192bdcaa8d0Smrg done # for arg 1193bdcaa8d0Smrg 1194bdcaa8d0Smrg case $arg_mode in 1195bdcaa8d0Smrg arg) 11960b661123Smrg func_fatal_error "you must specify an argument for -Xcompile" 1197bdcaa8d0Smrg ;; 1198bdcaa8d0Smrg target) 11990b661123Smrg func_fatal_error "you must specify a target with \`-o'" 1200bdcaa8d0Smrg ;; 1201bdcaa8d0Smrg *) 1202bdcaa8d0Smrg # Get the name of the library object. 12030b661123Smrg test -z "$libobj" && { 12040b661123Smrg func_basename "$srcfile" 12050b661123Smrg libobj="$func_basename_result" 12060b661123Smrg } 1207bdcaa8d0Smrg ;; 1208bdcaa8d0Smrg esac 1209bdcaa8d0Smrg 1210bdcaa8d0Smrg # Recognize several different file suffixes. 1211bdcaa8d0Smrg # If the user specifies -o file.o, it is replaced with file.lo 1212bdcaa8d0Smrg case $libobj in 12130b661123Smrg *.[cCFSifmso] | \ 12140b661123Smrg *.ada | *.adb | *.ads | *.asm | \ 12150b661123Smrg *.c++ | *.cc | *.ii | *.class | *.cpp | *.cxx | \ 12160b661123Smrg *.[fF][09]? | *.for | *.java | *.obj | *.sx) 12170b661123Smrg func_xform "$libobj" 12180b661123Smrg libobj=$func_xform_result 12190b661123Smrg ;; 1220bdcaa8d0Smrg esac 1221bdcaa8d0Smrg 1222bdcaa8d0Smrg case $libobj in 12230b661123Smrg *.lo) func_lo2o "$libobj"; obj=$func_lo2o_result ;; 1224bdcaa8d0Smrg *) 12250b661123Smrg func_fatal_error "cannot determine name of library object from \`$libobj'" 1226bdcaa8d0Smrg ;; 1227bdcaa8d0Smrg esac 1228bdcaa8d0Smrg 1229bdcaa8d0Smrg func_infer_tag $base_compile 1230bdcaa8d0Smrg 1231bdcaa8d0Smrg for arg in $later; do 1232bdcaa8d0Smrg case $arg in 12330b661123Smrg -shared) 12340b661123Smrg test "$build_libtool_libs" != yes && \ 12350b661123Smrg func_fatal_configuration "can not build a shared library" 12360b661123Smrg build_old_libs=no 12370b661123Smrg continue 12380b661123Smrg ;; 12390b661123Smrg 1240bdcaa8d0Smrg -static) 12410b661123Smrg build_libtool_libs=no 1242bdcaa8d0Smrg build_old_libs=yes 1243bdcaa8d0Smrg continue 1244bdcaa8d0Smrg ;; 1245bdcaa8d0Smrg 1246bdcaa8d0Smrg -prefer-pic) 1247bdcaa8d0Smrg pic_mode=yes 1248bdcaa8d0Smrg continue 1249bdcaa8d0Smrg ;; 1250bdcaa8d0Smrg 1251bdcaa8d0Smrg -prefer-non-pic) 1252bdcaa8d0Smrg pic_mode=no 1253bdcaa8d0Smrg continue 1254bdcaa8d0Smrg ;; 1255bdcaa8d0Smrg esac 1256bdcaa8d0Smrg done 1257bdcaa8d0Smrg 12580b661123Smrg func_quote_for_eval "$libobj" 12590b661123Smrg test "X$libobj" != "X$func_quote_for_eval_result" \ 12600b661123Smrg && $ECHO "X$libobj" | $GREP '[]~#^*{};<>?"'"'"' &()|`$[]' \ 12610b661123Smrg && func_warning "libobj name \`$libobj' may not contain shell special characters." 12620b661123Smrg func_dirname_and_basename "$obj" "/" "" 12630b661123Smrg objname="$func_basename_result" 12640b661123Smrg xdir="$func_dirname_result" 1265bdcaa8d0Smrg lobj=${xdir}$objdir/$objname 1266bdcaa8d0Smrg 12670b661123Smrg test -z "$base_compile" && \ 12680b661123Smrg func_fatal_help "you must specify a compilation command" 1269bdcaa8d0Smrg 1270bdcaa8d0Smrg # Delete any leftover library objects. 1271bdcaa8d0Smrg if test "$build_old_libs" = yes; then 1272bdcaa8d0Smrg removelist="$obj $lobj $libobj ${libobj}T" 1273bdcaa8d0Smrg else 1274bdcaa8d0Smrg removelist="$lobj $libobj ${libobj}T" 1275bdcaa8d0Smrg fi 1276bdcaa8d0Smrg 1277bdcaa8d0Smrg # On Cygwin there's no "real" PIC flag so we must build both object types 1278bdcaa8d0Smrg case $host_os in 12790b661123Smrg cygwin* | mingw* | pw32* | os2* | cegcc*) 1280bdcaa8d0Smrg pic_mode=default 1281bdcaa8d0Smrg ;; 1282bdcaa8d0Smrg esac 1283bdcaa8d0Smrg if test "$pic_mode" = no && test "$deplibs_check_method" != pass_all; then 1284bdcaa8d0Smrg # non-PIC code in shared libraries is not supported 1285bdcaa8d0Smrg pic_mode=default 1286bdcaa8d0Smrg fi 1287bdcaa8d0Smrg 1288bdcaa8d0Smrg # Calculate the filename of the output object if compiler does 1289bdcaa8d0Smrg # not support -o with -c 1290bdcaa8d0Smrg if test "$compiler_c_o" = no; then 12910b661123Smrg output_obj=`$ECHO "X$srcfile" | $Xsed -e 's%^.*/%%' -e 's%\.[^.]*$%%'`.${objext} 1292bdcaa8d0Smrg lockfile="$output_obj.lock" 1293bdcaa8d0Smrg else 1294bdcaa8d0Smrg output_obj= 1295bdcaa8d0Smrg need_locks=no 1296bdcaa8d0Smrg lockfile= 1297bdcaa8d0Smrg fi 1298bdcaa8d0Smrg 1299bdcaa8d0Smrg # Lock this critical section if it is needed 1300bdcaa8d0Smrg # We use this script file to make the link, it avoids creating a new file 1301bdcaa8d0Smrg if test "$need_locks" = yes; then 13020b661123Smrg until $opt_dry_run || ln "$progpath" "$lockfile" 2>/dev/null; do 13030b661123Smrg func_echo "Waiting for $lockfile to be removed" 1304bdcaa8d0Smrg sleep 2 1305bdcaa8d0Smrg done 1306bdcaa8d0Smrg elif test "$need_locks" = warn; then 1307bdcaa8d0Smrg if test -f "$lockfile"; then 13080b661123Smrg $ECHO "\ 1309bdcaa8d0Smrg*** ERROR, $lockfile exists and contains: 1310bdcaa8d0Smrg`cat $lockfile 2>/dev/null` 1311bdcaa8d0Smrg 1312bdcaa8d0SmrgThis indicates that another process is trying to use the same 1313bdcaa8d0Smrgtemporary object file, and libtool could not work around it because 1314bdcaa8d0Smrgyour compiler does not support \`-c' and \`-o' together. If you 1315bdcaa8d0Smrgrepeat this compilation, it may succeed, by chance, but you had better 1316bdcaa8d0Smrgavoid parallel builds (make -j) in this platform, or get a better 1317bdcaa8d0Smrgcompiler." 1318bdcaa8d0Smrg 13190b661123Smrg $opt_dry_run || $RM $removelist 1320bdcaa8d0Smrg exit $EXIT_FAILURE 1321bdcaa8d0Smrg fi 13220b661123Smrg removelist="$removelist $output_obj" 13230b661123Smrg $ECHO "$srcfile" > "$lockfile" 1324bdcaa8d0Smrg fi 1325bdcaa8d0Smrg 13260b661123Smrg $opt_dry_run || $RM $removelist 13270b661123Smrg removelist="$removelist $lockfile" 13280b661123Smrg trap '$opt_dry_run || $RM $removelist; exit $EXIT_FAILURE' 1 2 15 13290b661123Smrg 1330bdcaa8d0Smrg if test -n "$fix_srcfile_path"; then 1331bdcaa8d0Smrg eval srcfile=\"$fix_srcfile_path\" 1332bdcaa8d0Smrg fi 13330b661123Smrg func_quote_for_eval "$srcfile" 13340b661123Smrg qsrcfile=$func_quote_for_eval_result 1335bdcaa8d0Smrg 1336bdcaa8d0Smrg # Only build a PIC object if we are building libtool libraries. 1337bdcaa8d0Smrg if test "$build_libtool_libs" = yes; then 1338bdcaa8d0Smrg # Without this assignment, base_compile gets emptied. 1339bdcaa8d0Smrg fbsd_hideous_sh_bug=$base_compile 1340bdcaa8d0Smrg 1341bdcaa8d0Smrg if test "$pic_mode" != no; then 1342bdcaa8d0Smrg command="$base_compile $qsrcfile $pic_flag" 1343bdcaa8d0Smrg else 1344bdcaa8d0Smrg # Don't build PIC code 1345bdcaa8d0Smrg command="$base_compile $qsrcfile" 1346bdcaa8d0Smrg fi 1347bdcaa8d0Smrg 13480b661123Smrg func_mkdir_p "$xdir$objdir" 1349bdcaa8d0Smrg 1350bdcaa8d0Smrg if test -z "$output_obj"; then 1351bdcaa8d0Smrg # Place PIC objects in $objdir 1352bdcaa8d0Smrg command="$command -o $lobj" 1353bdcaa8d0Smrg fi 1354bdcaa8d0Smrg 13550b661123Smrg func_show_eval_locale "$command" \ 13560b661123Smrg 'test -n "$output_obj" && $RM $removelist; exit $EXIT_FAILURE' 1357bdcaa8d0Smrg 1358bdcaa8d0Smrg if test "$need_locks" = warn && 1359bdcaa8d0Smrg test "X`cat $lockfile 2>/dev/null`" != "X$srcfile"; then 13600b661123Smrg $ECHO "\ 1361bdcaa8d0Smrg*** ERROR, $lockfile contains: 1362bdcaa8d0Smrg`cat $lockfile 2>/dev/null` 1363bdcaa8d0Smrg 1364bdcaa8d0Smrgbut it should contain: 1365bdcaa8d0Smrg$srcfile 1366bdcaa8d0Smrg 1367bdcaa8d0SmrgThis indicates that another process is trying to use the same 1368bdcaa8d0Smrgtemporary object file, and libtool could not work around it because 1369bdcaa8d0Smrgyour compiler does not support \`-c' and \`-o' together. If you 1370bdcaa8d0Smrgrepeat this compilation, it may succeed, by chance, but you had better 1371bdcaa8d0Smrgavoid parallel builds (make -j) in this platform, or get a better 1372bdcaa8d0Smrgcompiler." 1373bdcaa8d0Smrg 13740b661123Smrg $opt_dry_run || $RM $removelist 1375bdcaa8d0Smrg exit $EXIT_FAILURE 1376bdcaa8d0Smrg fi 1377bdcaa8d0Smrg 1378bdcaa8d0Smrg # Just move the object if needed, then go on to compile the next one 1379bdcaa8d0Smrg if test -n "$output_obj" && test "X$output_obj" != "X$lobj"; then 13800b661123Smrg func_show_eval '$MV "$output_obj" "$lobj"' \ 13810b661123Smrg 'error=$?; $opt_dry_run || $RM $removelist; exit $error' 1382bdcaa8d0Smrg fi 1383bdcaa8d0Smrg 1384bdcaa8d0Smrg # Allow error messages only from the first compilation. 1385bdcaa8d0Smrg if test "$suppress_opt" = yes; then 13860b661123Smrg suppress_output=' >/dev/null 2>&1' 1387bdcaa8d0Smrg fi 1388bdcaa8d0Smrg fi 1389bdcaa8d0Smrg 1390bdcaa8d0Smrg # Only build a position-dependent object if we build old libraries. 1391bdcaa8d0Smrg if test "$build_old_libs" = yes; then 1392bdcaa8d0Smrg if test "$pic_mode" != yes; then 1393bdcaa8d0Smrg # Don't build PIC code 13940b661123Smrg command="$base_compile $qsrcfile$pie_flag" 1395bdcaa8d0Smrg else 1396bdcaa8d0Smrg command="$base_compile $qsrcfile $pic_flag" 1397bdcaa8d0Smrg fi 1398bdcaa8d0Smrg if test "$compiler_c_o" = yes; then 1399bdcaa8d0Smrg command="$command -o $obj" 1400bdcaa8d0Smrg fi 1401bdcaa8d0Smrg 1402bdcaa8d0Smrg # Suppress compiler output if we already did a PIC compilation. 1403bdcaa8d0Smrg command="$command$suppress_output" 14040b661123Smrg func_show_eval_locale "$command" \ 14050b661123Smrg '$opt_dry_run || $RM $removelist; exit $EXIT_FAILURE' 1406bdcaa8d0Smrg 1407bdcaa8d0Smrg if test "$need_locks" = warn && 1408bdcaa8d0Smrg test "X`cat $lockfile 2>/dev/null`" != "X$srcfile"; then 14090b661123Smrg $ECHO "\ 1410bdcaa8d0Smrg*** ERROR, $lockfile contains: 1411bdcaa8d0Smrg`cat $lockfile 2>/dev/null` 1412bdcaa8d0Smrg 1413bdcaa8d0Smrgbut it should contain: 1414bdcaa8d0Smrg$srcfile 1415bdcaa8d0Smrg 1416bdcaa8d0SmrgThis indicates that another process is trying to use the same 1417bdcaa8d0Smrgtemporary object file, and libtool could not work around it because 1418bdcaa8d0Smrgyour compiler does not support \`-c' and \`-o' together. If you 1419bdcaa8d0Smrgrepeat this compilation, it may succeed, by chance, but you had better 1420bdcaa8d0Smrgavoid parallel builds (make -j) in this platform, or get a better 1421bdcaa8d0Smrgcompiler." 1422bdcaa8d0Smrg 14230b661123Smrg $opt_dry_run || $RM $removelist 1424bdcaa8d0Smrg exit $EXIT_FAILURE 1425bdcaa8d0Smrg fi 1426bdcaa8d0Smrg 1427bdcaa8d0Smrg # Just move the object if needed 1428bdcaa8d0Smrg if test -n "$output_obj" && test "X$output_obj" != "X$obj"; then 14290b661123Smrg func_show_eval '$MV "$output_obj" "$obj"' \ 14300b661123Smrg 'error=$?; $opt_dry_run || $RM $removelist; exit $error' 1431bdcaa8d0Smrg fi 1432bdcaa8d0Smrg fi 1433bdcaa8d0Smrg 14340b661123Smrg $opt_dry_run || { 14350b661123Smrg func_write_libtool_object "$libobj" "$objdir/$objname" "$objname" 1436bdcaa8d0Smrg 14370b661123Smrg # Unlock the critical section if it was locked 14380b661123Smrg if test "$need_locks" != no; then 14390b661123Smrg removelist=$lockfile 14400b661123Smrg $RM "$lockfile" 14410b661123Smrg fi 14420b661123Smrg } 1443bdcaa8d0Smrg 1444bdcaa8d0Smrg exit $EXIT_SUCCESS 14450b661123Smrg} 1446bdcaa8d0Smrg 14470b661123Smrg$opt_help || { 14480b661123Smrgtest "$mode" = compile && func_mode_compile ${1+"$@"} 14490b661123Smrg} 1450bdcaa8d0Smrg 14510b661123Smrgfunc_mode_help () 14520b661123Smrg{ 14530b661123Smrg # We need to display help for each of the modes. 14540b661123Smrg case $mode in 14550b661123Smrg "") 14560b661123Smrg # Generic help is extracted from the usage comments 14570b661123Smrg # at the start of this file. 14580b661123Smrg func_help 14590b661123Smrg ;; 1460bdcaa8d0Smrg 14610b661123Smrg clean) 14620b661123Smrg $ECHO \ 14630b661123Smrg"Usage: $progname [OPTION]... --mode=clean RM [RM-OPTION]... FILE... 1464bdcaa8d0Smrg 14650b661123SmrgRemove files from the build directory. 1466bdcaa8d0Smrg 14670b661123SmrgRM is the name of the program to use to delete files associated with each FILE 14680b661123Smrg(typically \`/bin/rm'). RM-OPTIONS are options (such as \`-f') to be passed 14690b661123Smrgto RM. 1470bdcaa8d0Smrg 14710b661123SmrgIf FILE is a libtool library, object or program, all the files associated 14720b661123Smrgwith it are deleted. Otherwise, only FILE itself is deleted using RM." 14730b661123Smrg ;; 1474bdcaa8d0Smrg 14750b661123Smrg compile) 14760b661123Smrg $ECHO \ 14770b661123Smrg"Usage: $progname [OPTION]... --mode=compile COMPILE-COMMAND... SOURCEFILE 1478bdcaa8d0Smrg 14790b661123SmrgCompile a source file into a libtool library object. 1480bdcaa8d0Smrg 14810b661123SmrgThis mode accepts the following additional options: 1482bdcaa8d0Smrg 14830b661123Smrg -o OUTPUT-FILE set the output file name to OUTPUT-FILE 14840b661123Smrg -no-suppress do not suppress compiler output for multiple passes 14850b661123Smrg -prefer-pic try to building PIC objects only 14860b661123Smrg -prefer-non-pic try to building non-PIC objects only 14870b661123Smrg -shared do not build a \`.o' file suitable for static linking 14880b661123Smrg -static only build a \`.o' file suitable for static linking 1489bdcaa8d0Smrg 14900b661123SmrgCOMPILE-COMMAND is a command to be used in creating a \`standard' object file 14910b661123Smrgfrom the given SOURCEFILE. 1492bdcaa8d0Smrg 14930b661123SmrgThe output file name is determined by removing the directory component from 14940b661123SmrgSOURCEFILE, then substituting the C source code suffix \`.c' with the 14950b661123Smrglibrary object suffix, \`.lo'." 14960b661123Smrg ;; 1497bdcaa8d0Smrg 14980b661123Smrg execute) 14990b661123Smrg $ECHO \ 15000b661123Smrg"Usage: $progname [OPTION]... --mode=execute COMMAND [ARGS]... 1501bdcaa8d0Smrg 15020b661123SmrgAutomatically set library path, then run a program. 1503bdcaa8d0Smrg 15040b661123SmrgThis mode accepts the following additional options: 1505bdcaa8d0Smrg 15060b661123Smrg -dlopen FILE add the directory containing FILE to the library path 1507bdcaa8d0Smrg 15080b661123SmrgThis mode sets the library path environment variable according to \`-dlopen' 15090b661123Smrgflags. 1510bdcaa8d0Smrg 15110b661123SmrgIf any of the ARGS are libtool executable wrappers, then they are translated 15120b661123Smrginto their corresponding uninstalled binary, and any of their required library 15130b661123Smrgdirectories are added to the library path. 1514bdcaa8d0Smrg 15150b661123SmrgThen, COMMAND is executed, with ARGS as arguments." 15160b661123Smrg ;; 1517bdcaa8d0Smrg 15180b661123Smrg finish) 15190b661123Smrg $ECHO \ 15200b661123Smrg"Usage: $progname [OPTION]... --mode=finish [LIBDIR]... 1521bdcaa8d0Smrg 15220b661123SmrgComplete the installation of libtool libraries. 1523bdcaa8d0Smrg 15240b661123SmrgEach LIBDIR is a directory that contains libtool libraries. 1525bdcaa8d0Smrg 15260b661123SmrgThe commands that this mode executes may require superuser privileges. Use 15270b661123Smrgthe \`--dry-run' option if you just want to see what would be executed." 15280b661123Smrg ;; 1529bdcaa8d0Smrg 15300b661123Smrg install) 15310b661123Smrg $ECHO \ 15320b661123Smrg"Usage: $progname [OPTION]... --mode=install INSTALL-COMMAND... 1533bdcaa8d0Smrg 15340b661123SmrgInstall executables or libraries. 1535bdcaa8d0Smrg 15360b661123SmrgINSTALL-COMMAND is the installation command. The first component should be 15370b661123Smrgeither the \`install' or \`cp' program. 1538bdcaa8d0Smrg 15390b661123SmrgThe following components of INSTALL-COMMAND are treated specially: 1540bdcaa8d0Smrg 15410b661123Smrg -inst-prefix PREFIX-DIR Use PREFIX-DIR as a staging area for installation 1542bdcaa8d0Smrg 15430b661123SmrgThe rest of the components are interpreted as arguments to that command (only 15440b661123SmrgBSD-compatible install options are recognized)." 15450b661123Smrg ;; 1546bdcaa8d0Smrg 15470b661123Smrg link) 15480b661123Smrg $ECHO \ 15490b661123Smrg"Usage: $progname [OPTION]... --mode=link LINK-COMMAND... 1550bdcaa8d0Smrg 15510b661123SmrgLink object files or libraries together to form another library, or to 15520b661123Smrgcreate an executable program. 1553bdcaa8d0Smrg 15540b661123SmrgLINK-COMMAND is a command using the C compiler that you would use to create 15550b661123Smrga program from several object files. 1556bdcaa8d0Smrg 15570b661123SmrgThe following components of LINK-COMMAND are treated specially: 1558bdcaa8d0Smrg 15590b661123Smrg -all-static do not do any dynamic linking at all 15600b661123Smrg -avoid-version do not add a version suffix if possible 15610b661123Smrg -dlopen FILE \`-dlpreopen' FILE if it cannot be dlopened at runtime 15620b661123Smrg -dlpreopen FILE link in FILE and add its symbols to lt_preloaded_symbols 15630b661123Smrg -export-dynamic allow symbols from OUTPUT-FILE to be resolved with dlsym(3) 15640b661123Smrg -export-symbols SYMFILE 15650b661123Smrg try to export only the symbols listed in SYMFILE 15660b661123Smrg -export-symbols-regex REGEX 15670b661123Smrg try to export only the symbols matching REGEX 15680b661123Smrg -LLIBDIR search LIBDIR for required installed libraries 15690b661123Smrg -lNAME OUTPUT-FILE requires the installed library libNAME 15700b661123Smrg -module build a library that can dlopened 15710b661123Smrg -no-fast-install disable the fast-install mode 15720b661123Smrg -no-install link a not-installable executable 15730b661123Smrg -no-undefined declare that a library does not refer to external symbols 15740b661123Smrg -o OUTPUT-FILE create OUTPUT-FILE from the specified objects 15750b661123Smrg -objectlist FILE Use a list of object files found in FILE to specify objects 15760b661123Smrg -precious-files-regex REGEX 15770b661123Smrg don't remove output files matching REGEX 15780b661123Smrg -release RELEASE specify package release information 15790b661123Smrg -rpath LIBDIR the created library will eventually be installed in LIBDIR 15800b661123Smrg -R[ ]LIBDIR add LIBDIR to the runtime path of programs and libraries 15810b661123Smrg -shared only do dynamic linking of libtool libraries 15820b661123Smrg -shrext SUFFIX override the standard shared library file extension 15830b661123Smrg -static do not do any dynamic linking of uninstalled libtool libraries 15840b661123Smrg -static-libtool-libs 15850b661123Smrg do not do any dynamic linking of libtool libraries 15860b661123Smrg -version-info CURRENT[:REVISION[:AGE]] 15870b661123Smrg specify library version info [each variable defaults to 0] 15880b661123Smrg -weak LIBNAME declare that the target provides the LIBNAME interface 1589bdcaa8d0Smrg 15900b661123SmrgAll other options (arguments beginning with \`-') are ignored. 1591bdcaa8d0Smrg 15920b661123SmrgEvery other argument is treated as a filename. Files ending in \`.la' are 15930b661123Smrgtreated as uninstalled libtool libraries, other files are standard or library 15940b661123Smrgobject files. 1595bdcaa8d0Smrg 15960b661123SmrgIf the OUTPUT-FILE ends in \`.la', then a libtool library is created, 15970b661123Smrgonly library objects (\`.lo' files) may be specified, and \`-rpath' is 15980b661123Smrgrequired, except when creating a convenience library. 1599bdcaa8d0Smrg 16000b661123SmrgIf OUTPUT-FILE ends in \`.a' or \`.lib', then a standard library is created 16010b661123Smrgusing \`ar' and \`ranlib', or on Windows using \`lib'. 1602bdcaa8d0Smrg 16030b661123SmrgIf OUTPUT-FILE ends in \`.lo' or \`.${objext}', then a reloadable object file 16040b661123Smrgis created, otherwise an executable program is created." 160596ce994aSmrg ;; 1606bdcaa8d0Smrg 16070b661123Smrg uninstall) 16080b661123Smrg $ECHO \ 16090b661123Smrg"Usage: $progname [OPTION]... --mode=uninstall RM [RM-OPTION]... FILE... 1610bdcaa8d0Smrg 16110b661123SmrgRemove libraries from an installation directory. 1612bdcaa8d0Smrg 16130b661123SmrgRM is the name of the program to use to delete files associated with each FILE 16140b661123Smrg(typically \`/bin/rm'). RM-OPTIONS are options (such as \`-f') to be passed 16150b661123Smrgto RM. 1616bdcaa8d0Smrg 16170b661123SmrgIf FILE is a libtool library, all the files associated with it are deleted. 16180b661123SmrgOtherwise, only FILE itself is deleted using RM." 16190b661123Smrg ;; 1620bdcaa8d0Smrg 16210b661123Smrg *) 16220b661123Smrg func_fatal_help "invalid operation mode \`$mode'" 16230b661123Smrg ;; 16240b661123Smrg esac 1625bdcaa8d0Smrg 16260b661123Smrg $ECHO 16270b661123Smrg $ECHO "Try \`$progname --help' for more information about other modes." 1628bdcaa8d0Smrg 16290b661123Smrg exit $? 16300b661123Smrg} 1631bdcaa8d0Smrg 16320b661123Smrg # Now that we've collected a possible --mode arg, show help if necessary 16330b661123Smrg $opt_help && func_mode_help 163472313efbSmrg 1635bdcaa8d0Smrg 16360b661123Smrg# func_mode_execute arg... 16370b661123Smrgfunc_mode_execute () 16380b661123Smrg{ 16390b661123Smrg $opt_debug 16400b661123Smrg # The first argument is the command name. 16410b661123Smrg cmd="$nonopt" 16420b661123Smrg test -z "$cmd" && \ 16430b661123Smrg func_fatal_help "you must specify a COMMAND" 164496ce994aSmrg 16450b661123Smrg # Handle -dlopen flags immediately. 16460b661123Smrg for file in $execute_dlfiles; do 16470b661123Smrg test -f "$file" \ 16480b661123Smrg || func_fatal_help "\`$file' is not a file" 164996ce994aSmrg 16500b661123Smrg dir= 16510b661123Smrg case $file in 16520b661123Smrg *.la) 16530b661123Smrg # Check to see that this really is a libtool archive. 16540b661123Smrg func_lalib_unsafe_p "$file" \ 16550b661123Smrg || func_fatal_help "\`$lib' is not a valid libtool archive" 165696ce994aSmrg 16570b661123Smrg # Read the libtool library. 16580b661123Smrg dlname= 16590b661123Smrg library_names= 16600b661123Smrg func_source "$file" 1661bdcaa8d0Smrg 16620b661123Smrg # Skip this library if it cannot be dlopened. 16630b661123Smrg if test -z "$dlname"; then 16640b661123Smrg # Warn if it was a shared library. 16650b661123Smrg test -n "$library_names" && \ 16660b661123Smrg func_warning "\`$file' was not linked with \`-export-dynamic'" 16670b661123Smrg continue 16680b661123Smrg fi 1669bdcaa8d0Smrg 16700b661123Smrg func_dirname "$file" "" "." 16710b661123Smrg dir="$func_dirname_result" 1672bdcaa8d0Smrg 16730b661123Smrg if test -f "$dir/$objdir/$dlname"; then 16740b661123Smrg dir="$dir/$objdir" 16750b661123Smrg else 16760b661123Smrg if test ! -f "$dir/$dlname"; then 16770b661123Smrg func_fatal_error "cannot find \`$dlname' in \`$dir' or \`$dir/$objdir'" 16780b661123Smrg fi 16790b661123Smrg fi 168096ce994aSmrg ;; 1681bdcaa8d0Smrg 16820b661123Smrg *.lo) 16830b661123Smrg # Just add the directory containing the .lo file. 16840b661123Smrg func_dirname "$file" "" "." 16850b661123Smrg dir="$func_dirname_result" 168696ce994aSmrg ;; 1687bdcaa8d0Smrg 16880b661123Smrg *) 16890b661123Smrg func_warning "\`-dlopen' is ignored for non-libtool libraries and objects" 169096ce994aSmrg continue 169196ce994aSmrg ;; 16920b661123Smrg esac 169372313efbSmrg 16940b661123Smrg # Get the absolute pathname. 16950b661123Smrg absdir=`cd "$dir" && pwd` 16960b661123Smrg test -n "$absdir" && dir="$absdir" 169772313efbSmrg 16980b661123Smrg # Now add the directory to shlibpath_var. 16990b661123Smrg if eval "test -z \"\$$shlibpath_var\""; then 17000b661123Smrg eval "$shlibpath_var=\"\$dir\"" 17010b661123Smrg else 17020b661123Smrg eval "$shlibpath_var=\"\$dir:\$$shlibpath_var\"" 17030b661123Smrg fi 17040b661123Smrg done 170572313efbSmrg 17060b661123Smrg # This variable tells wrapper scripts just to set shlibpath_var 17070b661123Smrg # rather than running their programs. 17080b661123Smrg libtool_execute_magic="$magic" 170972313efbSmrg 17100b661123Smrg # Check if any of the arguments is a wrapper script. 17110b661123Smrg args= 17120b661123Smrg for file 17130b661123Smrg do 17140b661123Smrg case $file in 17150b661123Smrg -*) ;; 17160b661123Smrg *) 17170b661123Smrg # Do a test to see if this is really a libtool program. 17180b661123Smrg if func_ltwrapper_script_p "$file"; then 17190b661123Smrg func_source "$file" 17200b661123Smrg # Transform arg to wrapped name. 17210b661123Smrg file="$progdir/$program" 17220b661123Smrg elif func_ltwrapper_executable_p "$file"; then 17230b661123Smrg func_ltwrapper_scriptname "$file" 17240b661123Smrg func_source "$func_ltwrapper_scriptname_result" 17250b661123Smrg # Transform arg to wrapped name. 17260b661123Smrg file="$progdir/$program" 17270b661123Smrg fi 17280b661123Smrg ;; 17290b661123Smrg esac 17300b661123Smrg # Quote arguments (to preserve shell metacharacters). 17310b661123Smrg func_quote_for_eval "$file" 17320b661123Smrg args="$args $func_quote_for_eval_result" 17330b661123Smrg done 173472313efbSmrg 17350b661123Smrg if test "X$opt_dry_run" = Xfalse; then 17360b661123Smrg if test -n "$shlibpath_var"; then 17370b661123Smrg # Export the shlibpath_var. 17380b661123Smrg eval "export $shlibpath_var" 17390b661123Smrg fi 174072313efbSmrg 17410b661123Smrg # Restore saved environment variables 17420b661123Smrg for lt_var in LANG LANGUAGE LC_ALL LC_CTYPE LC_COLLATE LC_MESSAGES 17430b661123Smrg do 17440b661123Smrg eval "if test \"\${save_$lt_var+set}\" = set; then 17450b661123Smrg $lt_var=\$save_$lt_var; export $lt_var 174696ce994aSmrg else 17470b661123Smrg $lt_unset $lt_var 17480b661123Smrg fi" 17490b661123Smrg done 175072313efbSmrg 17510b661123Smrg # Now prepare to actually exec the command. 17520b661123Smrg exec_cmd="\$cmd$args" 17530b661123Smrg else 17540b661123Smrg # Display what would be done. 17550b661123Smrg if test -n "$shlibpath_var"; then 17560b661123Smrg eval "\$ECHO \"\$shlibpath_var=\$$shlibpath_var\"" 17570b661123Smrg $ECHO "export $shlibpath_var" 17580b661123Smrg fi 17590b661123Smrg $ECHO "$cmd$args" 17600b661123Smrg exit $EXIT_SUCCESS 17610b661123Smrg fi 17620b661123Smrg} 176372313efbSmrg 17640b661123Smrgtest "$mode" = execute && func_mode_execute ${1+"$@"} 176572313efbSmrg 176696ce994aSmrg 17670b661123Smrg# func_mode_finish arg... 17680b661123Smrgfunc_mode_finish () 17690b661123Smrg{ 17700b661123Smrg $opt_debug 17710b661123Smrg libdirs="$nonopt" 17720b661123Smrg admincmds= 1773bdcaa8d0Smrg 17740b661123Smrg if test -n "$finish_cmds$finish_eval" && test -n "$libdirs"; then 17750b661123Smrg for dir 17760b661123Smrg do 17770b661123Smrg libdirs="$libdirs $dir" 17780b661123Smrg done 1779bdcaa8d0Smrg 17800b661123Smrg for libdir in $libdirs; do 17810b661123Smrg if test -n "$finish_cmds"; then 17820b661123Smrg # Do each command in the finish commands. 17830b661123Smrg func_execute_cmds "$finish_cmds" 'admincmds="$admincmds 17840b661123Smrg'"$cmd"'"' 178596ce994aSmrg fi 17860b661123Smrg if test -n "$finish_eval"; then 17870b661123Smrg # Do the single finish_eval. 17880b661123Smrg eval cmds=\"$finish_eval\" 17890b661123Smrg $opt_dry_run || eval "$cmds" || admincmds="$admincmds 17900b661123Smrg $cmds" 17910b661123Smrg fi 17920b661123Smrg done 17930b661123Smrg fi 1794bdcaa8d0Smrg 17950b661123Smrg # Exit here if they wanted silent mode. 17960b661123Smrg $opt_silent && exit $EXIT_SUCCESS 1797bdcaa8d0Smrg 17980b661123Smrg $ECHO "X----------------------------------------------------------------------" | $Xsed 17990b661123Smrg $ECHO "Libraries have been installed in:" 18000b661123Smrg for libdir in $libdirs; do 18010b661123Smrg $ECHO " $libdir" 18020b661123Smrg done 18030b661123Smrg $ECHO 18040b661123Smrg $ECHO "If you ever happen to want to link against installed libraries" 18050b661123Smrg $ECHO "in a given directory, LIBDIR, you must either use libtool, and" 18060b661123Smrg $ECHO "specify the full pathname of the library, or use the \`-LLIBDIR'" 18070b661123Smrg $ECHO "flag during linking and do at least one of the following:" 18080b661123Smrg if test -n "$shlibpath_var"; then 18090b661123Smrg $ECHO " - add LIBDIR to the \`$shlibpath_var' environment variable" 18100b661123Smrg $ECHO " during execution" 18110b661123Smrg fi 18120b661123Smrg if test -n "$runpath_var"; then 18130b661123Smrg $ECHO " - add LIBDIR to the \`$runpath_var' environment variable" 18140b661123Smrg $ECHO " during linking" 18150b661123Smrg fi 18160b661123Smrg if test -n "$hardcode_libdir_flag_spec"; then 18170b661123Smrg libdir=LIBDIR 18180b661123Smrg eval flag=\"$hardcode_libdir_flag_spec\" 18190b661123Smrg 18200b661123Smrg $ECHO " - use the \`$flag' linker flag" 18210b661123Smrg fi 18220b661123Smrg if test -n "$admincmds"; then 18230b661123Smrg $ECHO " - have your system administrator run these commands:$admincmds" 18240b661123Smrg fi 18250b661123Smrg if test -f /etc/ld.so.conf; then 18260b661123Smrg $ECHO " - have your system administrator add LIBDIR to \`/etc/ld.so.conf'" 18270b661123Smrg fi 18280b661123Smrg $ECHO 18290b661123Smrg 18300b661123Smrg $ECHO "See any operating system documentation about shared libraries for" 18310b661123Smrg case $host in 18320b661123Smrg solaris2.[6789]|solaris2.1[0-9]) 18330b661123Smrg $ECHO "more information, such as the ld(1), crle(1) and ld.so(8) manual" 18340b661123Smrg $ECHO "pages." 18350b661123Smrg ;; 18360b661123Smrg *) 18370b661123Smrg $ECHO "more information, such as the ld(1) and ld.so(8) manual pages." 18380b661123Smrg ;; 18390b661123Smrg esac 18400b661123Smrg $ECHO "X----------------------------------------------------------------------" | $Xsed 18410b661123Smrg exit $EXIT_SUCCESS 18420b661123Smrg} 18430b661123Smrg 18440b661123Smrgtest "$mode" = finish && func_mode_finish ${1+"$@"} 18450b661123Smrg 18460b661123Smrg 18470b661123Smrg# func_mode_install arg... 18480b661123Smrgfunc_mode_install () 18490b661123Smrg{ 18500b661123Smrg $opt_debug 18510b661123Smrg # There may be an optional sh(1) argument at the beginning of 18520b661123Smrg # install_prog (especially on Windows NT). 18530b661123Smrg if test "$nonopt" = "$SHELL" || test "$nonopt" = /bin/sh || 18540b661123Smrg # Allow the use of GNU shtool's install command. 18550b661123Smrg $ECHO "X$nonopt" | $GREP shtool >/dev/null; then 18560b661123Smrg # Aesthetically quote it. 18570b661123Smrg func_quote_for_eval "$nonopt" 18580b661123Smrg install_prog="$func_quote_for_eval_result " 18590b661123Smrg arg=$1 18600b661123Smrg shift 18610b661123Smrg else 18620b661123Smrg install_prog= 18630b661123Smrg arg=$nonopt 18640b661123Smrg fi 18650b661123Smrg 18660b661123Smrg # The real first argument should be the name of the installation program. 18670b661123Smrg # Aesthetically quote it. 18680b661123Smrg func_quote_for_eval "$arg" 18690b661123Smrg install_prog="$install_prog$func_quote_for_eval_result" 18700b661123Smrg 18710b661123Smrg # We need to accept at least all the BSD install flags. 18720b661123Smrg dest= 18730b661123Smrg files= 18740b661123Smrg opts= 18750b661123Smrg prev= 18760b661123Smrg install_type= 18770b661123Smrg isdir=no 18780b661123Smrg stripme= 18790b661123Smrg for arg 18800b661123Smrg do 18810b661123Smrg if test -n "$dest"; then 18820b661123Smrg files="$files $dest" 18830b661123Smrg dest=$arg 18840b661123Smrg continue 18850b661123Smrg fi 18860b661123Smrg 18870b661123Smrg case $arg in 18880b661123Smrg -d) isdir=yes ;; 18890b661123Smrg -f) 18900b661123Smrg case " $install_prog " in 18910b661123Smrg *[\\\ /]cp\ *) ;; 18920b661123Smrg *) prev=$arg ;; 18930b661123Smrg esac 18940b661123Smrg ;; 18950b661123Smrg -g | -m | -o) 18960b661123Smrg prev=$arg 18970b661123Smrg ;; 18980b661123Smrg -s) 18990b661123Smrg stripme=" -s" 19000b661123Smrg continue 19010b661123Smrg ;; 19020b661123Smrg -*) 19030b661123Smrg ;; 19040b661123Smrg *) 19050b661123Smrg # If the previous option needed an argument, then skip it. 19060b661123Smrg if test -n "$prev"; then 190796ce994aSmrg prev= 190872313efbSmrg else 19090b661123Smrg dest=$arg 19100b661123Smrg continue 191172313efbSmrg fi 191296ce994aSmrg ;; 19130b661123Smrg esac 191472313efbSmrg 19150b661123Smrg # Aesthetically quote the argument. 19160b661123Smrg func_quote_for_eval "$arg" 19170b661123Smrg install_prog="$install_prog $func_quote_for_eval_result" 19180b661123Smrg done 1919bdcaa8d0Smrg 19200b661123Smrg test -z "$install_prog" && \ 19210b661123Smrg func_fatal_help "you must specify an install program" 192272313efbSmrg 19230b661123Smrg test -n "$prev" && \ 19240b661123Smrg func_fatal_help "the \`$prev' option requires an argument" 1925bdcaa8d0Smrg 19260b661123Smrg if test -z "$files"; then 19270b661123Smrg if test -z "$dest"; then 19280b661123Smrg func_fatal_help "no file or destination specified" 19290b661123Smrg else 19300b661123Smrg func_fatal_help "you must specify a destination" 19310b661123Smrg fi 193296ce994aSmrg fi 1933bdcaa8d0Smrg 19340b661123Smrg # Strip any trailing slash from the destination. 19350b661123Smrg func_stripname '' '/' "$dest" 19360b661123Smrg dest=$func_stripname_result 1937bdcaa8d0Smrg 19380b661123Smrg # Check to see that the destination is a directory. 19390b661123Smrg test -d "$dest" && isdir=yes 19400b661123Smrg if test "$isdir" = yes; then 19410b661123Smrg destdir="$dest" 19420b661123Smrg destname= 194396ce994aSmrg else 19440b661123Smrg func_dirname_and_basename "$dest" "" "." 19450b661123Smrg destdir="$func_dirname_result" 19460b661123Smrg destname="$func_basename_result" 194772313efbSmrg 19480b661123Smrg # Not a directory, so check to see that there is only one file specified. 19490b661123Smrg set dummy $files; shift 19500b661123Smrg test "$#" -gt 1 && \ 19510b661123Smrg func_fatal_help "\`$dest' is not a directory" 195272313efbSmrg fi 19530b661123Smrg case $destdir in 19540b661123Smrg [\\/]* | [A-Za-z]:[\\/]*) ;; 195596ce994aSmrg *) 19560b661123Smrg for file in $files; do 19570b661123Smrg case $file in 19580b661123Smrg *.lo) ;; 19590b661123Smrg *) 19600b661123Smrg func_fatal_help "\`$destdir' must be an absolute directory name" 19610b661123Smrg ;; 19620b661123Smrg esac 19630b661123Smrg done 196496ce994aSmrg ;; 196596ce994aSmrg esac 1966bdcaa8d0Smrg 19670b661123Smrg # This variable tells wrapper scripts just to set variables rather 19680b661123Smrg # than running their programs. 19690b661123Smrg libtool_install_magic="$magic" 197072313efbSmrg 19710b661123Smrg staticlibs= 19720b661123Smrg future_libdirs= 19730b661123Smrg current_libdirs= 19740b661123Smrg for file in $files; do 197572313efbSmrg 19760b661123Smrg # Do each installation. 19770b661123Smrg case $file in 19780b661123Smrg *.$libext) 19790b661123Smrg # Do the static libraries later. 19800b661123Smrg staticlibs="$staticlibs $file" 19810b661123Smrg ;; 19820b661123Smrg 19830b661123Smrg *.la) 19840b661123Smrg # Check to see that this really is a libtool archive. 19850b661123Smrg func_lalib_unsafe_p "$file" \ 19860b661123Smrg || func_fatal_help "\`$file' is not a valid libtool archive" 19870b661123Smrg 19880b661123Smrg library_names= 19890b661123Smrg old_library= 19900b661123Smrg relink_command= 19910b661123Smrg func_source "$file" 19920b661123Smrg 19930b661123Smrg # Add the libdir to current_libdirs if it is the destination. 19940b661123Smrg if test "X$destdir" = "X$libdir"; then 19950b661123Smrg case "$current_libdirs " in 19960b661123Smrg *" $libdir "*) ;; 19970b661123Smrg *) current_libdirs="$current_libdirs $libdir" ;; 199872313efbSmrg esac 19990b661123Smrg else 20000b661123Smrg # Note the libdir as a future libdir. 20010b661123Smrg case "$future_libdirs " in 20020b661123Smrg *" $libdir "*) ;; 20030b661123Smrg *) future_libdirs="$future_libdirs $libdir" ;; 20040b661123Smrg esac 20050b661123Smrg fi 200672313efbSmrg 20070b661123Smrg func_dirname "$file" "/" "" 20080b661123Smrg dir="$func_dirname_result" 20090b661123Smrg dir="$dir$objdir" 20100b661123Smrg 20110b661123Smrg if test -n "$relink_command"; then 20120b661123Smrg # Determine the prefix the user has applied to our future dir. 20130b661123Smrg inst_prefix_dir=`$ECHO "X$destdir" | $Xsed -e "s%$libdir\$%%"` 20140b661123Smrg 20150b661123Smrg # Don't allow the user to place us outside of our expected 20160b661123Smrg # location b/c this prevents finding dependent libraries that 20170b661123Smrg # are installed to the same prefix. 20180b661123Smrg # At present, this check doesn't affect windows .dll's that 20190b661123Smrg # are installed into $libdir/../bin (currently, that works fine) 20200b661123Smrg # but it's something to keep an eye on. 20210b661123Smrg test "$inst_prefix_dir" = "$destdir" && \ 20220b661123Smrg func_fatal_error "error: cannot install \`$file' to a directory not ending in $libdir" 20230b661123Smrg 20240b661123Smrg if test -n "$inst_prefix_dir"; then 20250b661123Smrg # Stick the inst_prefix_dir data into the link command. 20260b661123Smrg relink_command=`$ECHO "X$relink_command" | $Xsed -e "s%@inst_prefix_dir@%-inst-prefix-dir $inst_prefix_dir%"` 20270b661123Smrg else 20280b661123Smrg relink_command=`$ECHO "X$relink_command" | $Xsed -e "s%@inst_prefix_dir@%%"` 20290b661123Smrg fi 20300b661123Smrg 20310b661123Smrg func_warning "relinking \`$file'" 20320b661123Smrg func_show_eval "$relink_command" \ 20330b661123Smrg 'func_fatal_error "error: relink \`$file'\'' with the above command before installing it"' 20340b661123Smrg fi 20350b661123Smrg 20360b661123Smrg # See the names of the shared library. 20370b661123Smrg set dummy $library_names; shift 20380b661123Smrg if test -n "$1"; then 20390b661123Smrg realname="$1" 20400b661123Smrg shift 20410b661123Smrg 20420b661123Smrg srcname="$realname" 20430b661123Smrg test -n "$relink_command" && srcname="$realname"T 20440b661123Smrg 20450b661123Smrg # Install the shared library and build the symlinks. 20460b661123Smrg func_show_eval "$install_prog $dir/$srcname $destdir/$realname" \ 20470b661123Smrg 'exit $?' 20480b661123Smrg tstripme="$stripme" 20490b661123Smrg case $host_os in 20500b661123Smrg cygwin* | mingw* | pw32* | cegcc*) 20510b661123Smrg case $realname in 20520b661123Smrg *.dll.a) 20530b661123Smrg tstripme="" 20540b661123Smrg ;; 20550b661123Smrg esac 205672313efbSmrg ;; 205772313efbSmrg esac 20580b661123Smrg if test -n "$tstripme" && test -n "$striplib"; then 20590b661123Smrg func_show_eval "$striplib $destdir/$realname" 'exit $?' 206096ce994aSmrg fi 20610b661123Smrg 20620b661123Smrg if test "$#" -gt 0; then 20630b661123Smrg # Delete the old symlinks, and create new ones. 20640b661123Smrg # Try `ln -sf' first, because the `ln' binary might depend on 20650b661123Smrg # the symlink we replace! Solaris /bin/ln does not understand -f, 20660b661123Smrg # so we also need to try rm && ln -s. 20670b661123Smrg for linkname 20680b661123Smrg do 20690b661123Smrg test "$linkname" != "$realname" \ 20700b661123Smrg && func_show_eval "(cd $destdir && { $LN_S -f $realname $linkname || { $RM $linkname && $LN_S $realname $linkname; }; })" 207196ce994aSmrg done 207296ce994aSmrg fi 2073bdcaa8d0Smrg 20740b661123Smrg # Do each command in the postinstall commands. 20750b661123Smrg lib="$destdir/$realname" 20760b661123Smrg func_execute_cmds "$postinstall_cmds" 'exit $?' 207796ce994aSmrg fi 2078bdcaa8d0Smrg 20790b661123Smrg # Install the pseudo-library for information purposes. 20800b661123Smrg func_basename "$file" 20810b661123Smrg name="$func_basename_result" 20820b661123Smrg instname="$dir/$name"i 20830b661123Smrg func_show_eval "$install_prog $instname $destdir/$name" 'exit $?' 2084bdcaa8d0Smrg 20850b661123Smrg # Maybe install the static library, too. 20860b661123Smrg test -n "$old_library" && staticlibs="$staticlibs $dir/$old_library" 20870b661123Smrg ;; 2088bdcaa8d0Smrg 20890b661123Smrg *.lo) 20900b661123Smrg # Install (i.e. copy) a libtool object. 2091bdcaa8d0Smrg 20920b661123Smrg # Figure out destination file name, if it wasn't already specified. 20930b661123Smrg if test -n "$destname"; then 20940b661123Smrg destfile="$destdir/$destname" 20950b661123Smrg else 20960b661123Smrg func_basename "$file" 20970b661123Smrg destfile="$func_basename_result" 20980b661123Smrg destfile="$destdir/$destfile" 209996ce994aSmrg fi 2100bdcaa8d0Smrg 21010b661123Smrg # Deduce the name of the destination old-style object file. 21020b661123Smrg case $destfile in 21030b661123Smrg *.lo) 21040b661123Smrg func_lo2o "$destfile" 21050b661123Smrg staticdest=$func_lo2o_result 21060b661123Smrg ;; 21070b661123Smrg *.$objext) 21080b661123Smrg staticdest="$destfile" 21090b661123Smrg destfile= 21100b661123Smrg ;; 21110b661123Smrg *) 21120b661123Smrg func_fatal_help "cannot copy a libtool object to \`$destfile'" 21130b661123Smrg ;; 21140b661123Smrg esac 2115bdcaa8d0Smrg 21160b661123Smrg # Install the libtool object if requested. 21170b661123Smrg test -n "$destfile" && \ 21180b661123Smrg func_show_eval "$install_prog $file $destfile" 'exit $?' 2119bdcaa8d0Smrg 21200b661123Smrg # Install the old object if enabled. 21210b661123Smrg if test "$build_old_libs" = yes; then 21220b661123Smrg # Deduce the name of the old-style object file. 21230b661123Smrg func_lo2o "$file" 21240b661123Smrg staticobj=$func_lo2o_result 21250b661123Smrg func_show_eval "$install_prog \$staticobj \$staticdest" 'exit $?' 2126bdcaa8d0Smrg fi 21270b661123Smrg exit $EXIT_SUCCESS 21280b661123Smrg ;; 2129bdcaa8d0Smrg 21300b661123Smrg *) 21310b661123Smrg # Figure out destination file name, if it wasn't already specified. 21320b661123Smrg if test -n "$destname"; then 21330b661123Smrg destfile="$destdir/$destname" 21340b661123Smrg else 21350b661123Smrg func_basename "$file" 21360b661123Smrg destfile="$func_basename_result" 21370b661123Smrg destfile="$destdir/$destfile" 21380b661123Smrg fi 2139bdcaa8d0Smrg 21400b661123Smrg # If the file is missing, and there is a .exe on the end, strip it 21410b661123Smrg # because it is most likely a libtool script we actually want to 21420b661123Smrg # install 21430b661123Smrg stripped_ext="" 21440b661123Smrg case $file in 21450b661123Smrg *.exe) 21460b661123Smrg if test ! -f "$file"; then 21470b661123Smrg func_stripname '' '.exe' "$file" 21480b661123Smrg file=$func_stripname_result 21490b661123Smrg stripped_ext=".exe" 21500b661123Smrg fi 21510b661123Smrg ;; 21520b661123Smrg esac 21530b661123Smrg 21540b661123Smrg # Do a test to see if this is really a libtool program. 21550b661123Smrg case $host in 21560b661123Smrg *cygwin* | *mingw*) 21570b661123Smrg if func_ltwrapper_executable_p "$file"; then 21580b661123Smrg func_ltwrapper_scriptname "$file" 21590b661123Smrg wrapper=$func_ltwrapper_scriptname_result 21600b661123Smrg else 21610b661123Smrg func_stripname '' '.exe' "$file" 21620b661123Smrg wrapper=$func_stripname_result 21630b661123Smrg fi 21640b661123Smrg ;; 216596ce994aSmrg *) 21660b661123Smrg wrapper=$file 21670b661123Smrg ;; 21680b661123Smrg esac 21690b661123Smrg if func_ltwrapper_script_p "$wrapper"; then 21700b661123Smrg notinst_deplibs= 21710b661123Smrg relink_command= 21720b661123Smrg 21730b661123Smrg func_source "$wrapper" 21740b661123Smrg 21750b661123Smrg # Check the variables that should have been set. 21760b661123Smrg test -z "$generated_by_libtool_version" && \ 21770b661123Smrg func_fatal_error "invalid libtool wrapper script \`$wrapper'" 21780b661123Smrg 21790b661123Smrg finalize=yes 21800b661123Smrg for lib in $notinst_deplibs; do 21810b661123Smrg # Check to see that each library is installed. 21820b661123Smrg libdir= 21830b661123Smrg if test -f "$lib"; then 21840b661123Smrg func_source "$lib" 21850b661123Smrg fi 21860b661123Smrg libfile="$libdir/"`$ECHO "X$lib" | $Xsed -e 's%^.*/%%g'` ### testsuite: skip nested quoting test 21870b661123Smrg if test -n "$libdir" && test ! -f "$libfile"; then 21880b661123Smrg func_warning "\`$lib' has not been installed in \`$libdir'" 21890b661123Smrg finalize=no 21900b661123Smrg fi 21910b661123Smrg done 21920b661123Smrg 21930b661123Smrg relink_command= 21940b661123Smrg func_source "$wrapper" 21950b661123Smrg 21960b661123Smrg outputname= 21970b661123Smrg if test "$fast_install" = no && test -n "$relink_command"; then 21980b661123Smrg $opt_dry_run || { 21990b661123Smrg if test "$finalize" = yes; then 22000b661123Smrg tmpdir=`func_mktempdir` 22010b661123Smrg func_basename "$file$stripped_ext" 22020b661123Smrg file="$func_basename_result" 22030b661123Smrg outputname="$tmpdir/$file" 22040b661123Smrg # Replace the output file specification. 22050b661123Smrg relink_command=`$ECHO "X$relink_command" | $Xsed -e 's%@OUTPUT@%'"$outputname"'%g'` 22060b661123Smrg 22070b661123Smrg $opt_silent || { 22080b661123Smrg func_quote_for_expand "$relink_command" 22090b661123Smrg eval "func_echo $func_quote_for_expand_result" 22100b661123Smrg } 22110b661123Smrg if eval "$relink_command"; then : 22120b661123Smrg else 22130b661123Smrg func_error "error: relink \`$file' with the above command before installing it" 22140b661123Smrg $opt_dry_run || ${RM}r "$tmpdir" 22150b661123Smrg continue 22160b661123Smrg fi 22170b661123Smrg file="$outputname" 22180b661123Smrg else 22190b661123Smrg func_warning "cannot relink \`$file'" 22200b661123Smrg fi 22210b661123Smrg } 22220b661123Smrg else 22230b661123Smrg # Install the binary that we compiled earlier. 22240b661123Smrg file=`$ECHO "X$file$stripped_ext" | $Xsed -e "s%\([^/]*\)$%$objdir/\1%"` 222596ce994aSmrg fi 22260b661123Smrg fi 22270b661123Smrg 22280b661123Smrg # remove .exe since cygwin /usr/bin/install will append another 22290b661123Smrg # one anyway 22300b661123Smrg case $install_prog,$host in 22310b661123Smrg */usr/bin/install*,*cygwin*) 22320b661123Smrg case $file:$destfile in 22330b661123Smrg *.exe:*.exe) 22340b661123Smrg # this is ok 22350b661123Smrg ;; 22360b661123Smrg *.exe:*) 22370b661123Smrg destfile=$destfile.exe 22380b661123Smrg ;; 22390b661123Smrg *:*.exe) 22400b661123Smrg func_stripname '' '.exe' "$destfile" 22410b661123Smrg destfile=$func_stripname_result 22420b661123Smrg ;; 22430b661123Smrg esac 224496ce994aSmrg ;; 224596ce994aSmrg esac 22460b661123Smrg func_show_eval "$install_prog\$stripme \$file \$destfile" 'exit $?' 22470b661123Smrg $opt_dry_run || if test -n "$outputname"; then 22480b661123Smrg ${RM}r "$tmpdir" 22490b661123Smrg fi 22500b661123Smrg ;; 22510b661123Smrg esac 22520b661123Smrg done 2253bdcaa8d0Smrg 22540b661123Smrg for file in $staticlibs; do 22550b661123Smrg func_basename "$file" 22560b661123Smrg name="$func_basename_result" 22570b661123Smrg 22580b661123Smrg # Set up the ranlib parameters. 22590b661123Smrg oldlib="$destdir/$name" 22600b661123Smrg 22610b661123Smrg func_show_eval "$install_prog \$file \$oldlib" 'exit $?' 22620b661123Smrg 22630b661123Smrg if test -n "$stripme" && test -n "$old_striplib"; then 22640b661123Smrg func_show_eval "$old_striplib $oldlib" 'exit $?' 22650b661123Smrg fi 22660b661123Smrg 22670b661123Smrg # Do each command in the postinstall commands. 22680b661123Smrg func_execute_cmds "$old_postinstall_cmds" 'exit $?' 22690b661123Smrg done 22700b661123Smrg 22710b661123Smrg test -n "$future_libdirs" && \ 22720b661123Smrg func_warning "remember to run \`$progname --finish$future_libdirs'" 22730b661123Smrg 22740b661123Smrg if test -n "$current_libdirs"; then 22750b661123Smrg # Maybe just do a dry run. 22760b661123Smrg $opt_dry_run && current_libdirs=" -n$current_libdirs" 22770b661123Smrg exec_cmd='$SHELL $progpath $preserve_args --finish$current_libdirs' 22780b661123Smrg else 22790b661123Smrg exit $EXIT_SUCCESS 22800b661123Smrg fi 22810b661123Smrg} 22820b661123Smrg 22830b661123Smrgtest "$mode" = install && func_mode_install ${1+"$@"} 22840b661123Smrg 22850b661123Smrg 22860b661123Smrg# func_generate_dlsyms outputname originator pic_p 22870b661123Smrg# Extract symbols from dlprefiles and create ${outputname}S.o with 22880b661123Smrg# a dlpreopen symbol table. 22890b661123Smrgfunc_generate_dlsyms () 22900b661123Smrg{ 22910b661123Smrg $opt_debug 22920b661123Smrg my_outputname="$1" 22930b661123Smrg my_originator="$2" 22940b661123Smrg my_pic_p="${3-no}" 22950b661123Smrg my_prefix=`$ECHO "$my_originator" | sed 's%[^a-zA-Z0-9]%_%g'` 22960b661123Smrg my_dlsyms= 22970b661123Smrg 22980b661123Smrg if test -n "$dlfiles$dlprefiles" || test "$dlself" != no; then 22990b661123Smrg if test -n "$NM" && test -n "$global_symbol_pipe"; then 23000b661123Smrg my_dlsyms="${my_outputname}S.c" 23010b661123Smrg else 23020b661123Smrg func_error "not configured to extract global symbols from dlpreopened files" 23030b661123Smrg fi 23040b661123Smrg fi 23050b661123Smrg 23060b661123Smrg if test -n "$my_dlsyms"; then 23070b661123Smrg case $my_dlsyms in 23080b661123Smrg "") ;; 23090b661123Smrg *.c) 23100b661123Smrg # Discover the nlist of each of the dlfiles. 23110b661123Smrg nlist="$output_objdir/${my_outputname}.nm" 23120b661123Smrg 23130b661123Smrg func_show_eval "$RM $nlist ${nlist}S ${nlist}T" 23140b661123Smrg 23150b661123Smrg # Parse the name list into a source file. 23160b661123Smrg func_verbose "creating $output_objdir/$my_dlsyms" 23170b661123Smrg 23180b661123Smrg $opt_dry_run || $ECHO > "$output_objdir/$my_dlsyms" "\ 23190b661123Smrg/* $my_dlsyms - symbol resolution table for \`$my_outputname' dlsym emulation. */ 23200b661123Smrg/* Generated by $PROGRAM (GNU $PACKAGE$TIMESTAMP) $VERSION */ 23210b661123Smrg 23220b661123Smrg#ifdef __cplusplus 23230b661123Smrgextern \"C\" { 23240b661123Smrg#endif 23250b661123Smrg 23260b661123Smrg/* External symbol declarations for the compiler. */\ 23270b661123Smrg" 23280b661123Smrg 23290b661123Smrg if test "$dlself" = yes; then 23300b661123Smrg func_verbose "generating symbol list for \`$output'" 23310b661123Smrg 23320b661123Smrg $opt_dry_run || echo ': @PROGRAM@ ' > "$nlist" 23330b661123Smrg 23340b661123Smrg # Add our own program objects to the symbol list. 23350b661123Smrg progfiles=`$ECHO "X$objs$old_deplibs" | $SP2NL | $Xsed -e "$lo2o" | $NL2SP` 23360b661123Smrg for progfile in $progfiles; do 23370b661123Smrg func_verbose "extracting global C symbols from \`$progfile'" 23380b661123Smrg $opt_dry_run || eval "$NM $progfile | $global_symbol_pipe >> '$nlist'" 23390b661123Smrg done 23400b661123Smrg 23410b661123Smrg if test -n "$exclude_expsyms"; then 23420b661123Smrg $opt_dry_run || { 23430b661123Smrg eval '$EGREP -v " ($exclude_expsyms)$" "$nlist" > "$nlist"T' 23440b661123Smrg eval '$MV "$nlist"T "$nlist"' 23450b661123Smrg } 234696ce994aSmrg fi 23470b661123Smrg 23480b661123Smrg if test -n "$export_symbols_regex"; then 23490b661123Smrg $opt_dry_run || { 23500b661123Smrg eval '$EGREP -e "$export_symbols_regex" "$nlist" > "$nlist"T' 23510b661123Smrg eval '$MV "$nlist"T "$nlist"' 23520b661123Smrg } 23530b661123Smrg fi 23540b661123Smrg 23550b661123Smrg # Prepare the list of exported symbols 23560b661123Smrg if test -z "$export_symbols"; then 23570b661123Smrg export_symbols="$output_objdir/$outputname.exp" 23580b661123Smrg $opt_dry_run || { 23590b661123Smrg $RM $export_symbols 23600b661123Smrg eval "${SED} -n -e '/^: @PROGRAM@ $/d' -e 's/^.* \(.*\)$/\1/p' "'< "$nlist" > "$export_symbols"' 23610b661123Smrg case $host in 23620b661123Smrg *cygwin* | *mingw* | *cegcc* ) 23630b661123Smrg eval "echo EXPORTS "'> "$output_objdir/$outputname.def"' 23640b661123Smrg eval 'cat "$export_symbols" >> "$output_objdir/$outputname.def"' 23650b661123Smrg ;; 23660b661123Smrg esac 23670b661123Smrg } 236896ce994aSmrg else 23690b661123Smrg $opt_dry_run || { 23700b661123Smrg eval "${SED} -e 's/\([].[*^$]\)/\\\\\1/g' -e 's/^/ /' -e 's/$/$/'"' < "$export_symbols" > "$output_objdir/$outputname.exp"' 23710b661123Smrg eval '$GREP -f "$output_objdir/$outputname.exp" < "$nlist" > "$nlist"T' 23720b661123Smrg eval '$MV "$nlist"T "$nlist"' 23730b661123Smrg case $host in 23740b661123Smrg *cygwin | *mingw* | *cegcc* ) 23750b661123Smrg eval "echo EXPORTS "'> "$output_objdir/$outputname.def"' 23760b661123Smrg eval 'cat "$nlist" >> "$output_objdir/$outputname.def"' 23770b661123Smrg ;; 23780b661123Smrg esac 23790b661123Smrg } 238096ce994aSmrg fi 23810b661123Smrg fi 2382bdcaa8d0Smrg 23830b661123Smrg for dlprefile in $dlprefiles; do 23840b661123Smrg func_verbose "extracting global C symbols from \`$dlprefile'" 23850b661123Smrg func_basename "$dlprefile" 23860b661123Smrg name="$func_basename_result" 23870b661123Smrg $opt_dry_run || { 23880b661123Smrg eval '$ECHO ": $name " >> "$nlist"' 23890b661123Smrg eval "$NM $dlprefile 2>/dev/null | $global_symbol_pipe >> '$nlist'" 23900b661123Smrg } 23910b661123Smrg done 23920b661123Smrg 23930b661123Smrg $opt_dry_run || { 23940b661123Smrg # Make sure we have at least an empty file. 23950b661123Smrg test -f "$nlist" || : > "$nlist" 23960b661123Smrg 23970b661123Smrg if test -n "$exclude_expsyms"; then 23980b661123Smrg $EGREP -v " ($exclude_expsyms)$" "$nlist" > "$nlist"T 23990b661123Smrg $MV "$nlist"T "$nlist" 240096ce994aSmrg fi 24010b661123Smrg 24020b661123Smrg # Try sorting and uniquifying the output. 24030b661123Smrg if $GREP -v "^: " < "$nlist" | 24040b661123Smrg if sort -k 3 </dev/null >/dev/null 2>&1; then 24050b661123Smrg sort -k 3 24060b661123Smrg else 24070b661123Smrg sort +2 24080b661123Smrg fi | 24090b661123Smrg uniq > "$nlist"S; then 24100b661123Smrg : 241196ce994aSmrg else 24120b661123Smrg $GREP -v "^: " < "$nlist" > "$nlist"S 241396ce994aSmrg fi 2414bdcaa8d0Smrg 24150b661123Smrg if test -f "$nlist"S; then 24160b661123Smrg eval "$global_symbol_to_cdecl"' < "$nlist"S >> "$output_objdir/$my_dlsyms"' 241796ce994aSmrg else 24180b661123Smrg $ECHO '/* NONE */' >> "$output_objdir/$my_dlsyms" 241996ce994aSmrg fi 2420bdcaa8d0Smrg 24210b661123Smrg $ECHO >> "$output_objdir/$my_dlsyms" "\ 2422bdcaa8d0Smrg 24230b661123Smrg/* The mapping between symbol names and symbols. */ 24240b661123Smrgtypedef struct { 24250b661123Smrg const char *name; 24260b661123Smrg void *address; 24270b661123Smrg} lt_dlsymlist; 24280b661123Smrg" 24290b661123Smrg case $host in 24300b661123Smrg *cygwin* | *mingw* | *cegcc* ) 24310b661123Smrg $ECHO >> "$output_objdir/$my_dlsyms" "\ 24320b661123Smrg/* DATA imports from DLLs on WIN32 con't be const, because 24330b661123Smrg runtime relocations are performed -- see ld's documentation 24340b661123Smrg on pseudo-relocs. */" 24350b661123Smrg lt_dlsym_const= ;; 24360b661123Smrg *osf5*) 24370b661123Smrg echo >> "$output_objdir/$my_dlsyms" "\ 24380b661123Smrg/* This system does not cope well with relocations in const data */" 24390b661123Smrg lt_dlsym_const= ;; 24400b661123Smrg *) 24410b661123Smrg lt_dlsym_const=const ;; 24420b661123Smrg esac 2443bdcaa8d0Smrg 24440b661123Smrg $ECHO >> "$output_objdir/$my_dlsyms" "\ 24450b661123Smrgextern $lt_dlsym_const lt_dlsymlist 24460b661123Smrglt_${my_prefix}_LTX_preloaded_symbols[]; 24470b661123Smrg$lt_dlsym_const lt_dlsymlist 24480b661123Smrglt_${my_prefix}_LTX_preloaded_symbols[] = 24490b661123Smrg{\ 24500b661123Smrg { \"$my_originator\", (void *) 0 }," 2451bdcaa8d0Smrg 24520b661123Smrg case $need_lib_prefix in 24530b661123Smrg no) 24540b661123Smrg eval "$global_symbol_to_c_name_address" < "$nlist" >> "$output_objdir/$my_dlsyms" 24550b661123Smrg ;; 24560b661123Smrg *) 24570b661123Smrg eval "$global_symbol_to_c_name_address_lib_prefix" < "$nlist" >> "$output_objdir/$my_dlsyms" 24580b661123Smrg ;; 24590b661123Smrg esac 24600b661123Smrg $ECHO >> "$output_objdir/$my_dlsyms" "\ 24610b661123Smrg {0, (void *) 0} 24620b661123Smrg}; 2463bdcaa8d0Smrg 24640b661123Smrg/* This works around a problem in FreeBSD linker */ 24650b661123Smrg#ifdef FREEBSD_WORKAROUND 24660b661123Smrgstatic const void *lt_preloaded_setup() { 24670b661123Smrg return lt_${my_prefix}_LTX_preloaded_symbols; 24680b661123Smrg} 24690b661123Smrg#endif 24700b661123Smrg 24710b661123Smrg#ifdef __cplusplus 24720b661123Smrg} 24730b661123Smrg#endif\ 24740b661123Smrg" 24750b661123Smrg } # !$opt_dry_run 24760b661123Smrg 24770b661123Smrg pic_flag_for_symtable= 24780b661123Smrg case "$compile_command " in 24790b661123Smrg *" -static "*) ;; 24800b661123Smrg *) 24810b661123Smrg case $host in 24820b661123Smrg # compiling the symbol table file with pic_flag works around 24830b661123Smrg # a FreeBSD bug that causes programs to crash when -lm is 24840b661123Smrg # linked before any other PIC object. But we must not use 24850b661123Smrg # pic_flag when linking with -static. The problem exists in 24860b661123Smrg # FreeBSD 2.2.6 and is fixed in FreeBSD 3.1. 24870b661123Smrg *-*-freebsd2*|*-*-freebsd3.0*|*-*-freebsdelf3.0*) 24880b661123Smrg pic_flag_for_symtable=" $pic_flag -DFREEBSD_WORKAROUND" ;; 24890b661123Smrg *-*-hpux*) 24900b661123Smrg pic_flag_for_symtable=" $pic_flag" ;; 24910b661123Smrg *) 24920b661123Smrg if test "X$my_pic_p" != Xno; then 24930b661123Smrg pic_flag_for_symtable=" $pic_flag" 249496ce994aSmrg fi 24950b661123Smrg ;; 24960b661123Smrg esac 24970b661123Smrg ;; 24980b661123Smrg esac 24990b661123Smrg symtab_cflags= 25000b661123Smrg for arg in $LTCFLAGS; do 25010b661123Smrg case $arg in 25020b661123Smrg -pie | -fpie | -fPIE) ;; 25030b661123Smrg *) symtab_cflags="$symtab_cflags $arg" ;; 25040b661123Smrg esac 25050b661123Smrg done 2506bdcaa8d0Smrg 25070b661123Smrg # Now compile the dynamic symbol file. 25080b661123Smrg func_show_eval '(cd $output_objdir && $LTCC$symtab_cflags -c$no_builtin_flag$pic_flag_for_symtable "$my_dlsyms")' 'exit $?' 2509bdcaa8d0Smrg 25100b661123Smrg # Clean up the generated files. 25110b661123Smrg func_show_eval '$RM "$output_objdir/$my_dlsyms" "$nlist" "${nlist}S" "${nlist}T"' 2512bdcaa8d0Smrg 25130b661123Smrg # Transform the symbol file into the correct name. 25140b661123Smrg symfileobj="$output_objdir/${my_outputname}S.$objext" 25150b661123Smrg case $host in 25160b661123Smrg *cygwin* | *mingw* | *cegcc* ) 25170b661123Smrg if test -f "$output_objdir/$my_outputname.def"; then 25180b661123Smrg compile_command=`$ECHO "X$compile_command" | $Xsed -e "s%@SYMFILE@%$output_objdir/$my_outputname.def $symfileobj%"` 25190b661123Smrg finalize_command=`$ECHO "X$finalize_command" | $Xsed -e "s%@SYMFILE@%$output_objdir/$my_outputname.def $symfileobj%"` 25200b661123Smrg else 25210b661123Smrg compile_command=`$ECHO "X$compile_command" | $Xsed -e "s%@SYMFILE@%$symfileobj%"` 25220b661123Smrg finalize_command=`$ECHO "X$finalize_command" | $Xsed -e "s%@SYMFILE@%$symfileobj%"` 252396ce994aSmrg fi 25240b661123Smrg ;; 25250b661123Smrg *) 25260b661123Smrg compile_command=`$ECHO "X$compile_command" | $Xsed -e "s%@SYMFILE@%$symfileobj%"` 25270b661123Smrg finalize_command=`$ECHO "X$finalize_command" | $Xsed -e "s%@SYMFILE@%$symfileobj%"` 25280b661123Smrg ;; 25290b661123Smrg esac 25300b661123Smrg ;; 25310b661123Smrg *) 25320b661123Smrg func_fatal_error "unknown suffix for \`$my_dlsyms'" 25330b661123Smrg ;; 25340b661123Smrg esac 25350b661123Smrg else 25360b661123Smrg # We keep going just in case the user didn't refer to 25370b661123Smrg # lt_preloaded_symbols. The linker will fail if global_symbol_pipe 25380b661123Smrg # really was required. 2539bdcaa8d0Smrg 25400b661123Smrg # Nullify the symbol file. 25410b661123Smrg compile_command=`$ECHO "X$compile_command" | $Xsed -e "s% @SYMFILE@%%"` 25420b661123Smrg finalize_command=`$ECHO "X$finalize_command" | $Xsed -e "s% @SYMFILE@%%"` 25430b661123Smrg fi 25440b661123Smrg} 2545bdcaa8d0Smrg 25460b661123Smrg# func_win32_libid arg 25470b661123Smrg# return the library type of file 'arg' 25480b661123Smrg# 25490b661123Smrg# Need a lot of goo to handle *both* DLLs and import libs 25500b661123Smrg# Has to be a shell function in order to 'eat' the argument 25510b661123Smrg# that is supplied when $file_magic_command is called. 25520b661123Smrgfunc_win32_libid () 25530b661123Smrg{ 25540b661123Smrg $opt_debug 25550b661123Smrg win32_libid_type="unknown" 25560b661123Smrg win32_fileres=`file -L $1 2>/dev/null` 25570b661123Smrg case $win32_fileres in 25580b661123Smrg *ar\ archive\ import\ library*) # definitely import 25590b661123Smrg win32_libid_type="x86 archive import" 25600b661123Smrg ;; 25610b661123Smrg *ar\ archive*) # could be an import, or static 25620b661123Smrg if eval $OBJDUMP -f $1 | $SED -e '10q' 2>/dev/null | 25630b661123Smrg $EGREP 'file format pe-i386(.*architecture: i386)?' >/dev/null ; then 25640b661123Smrg win32_nmres=`eval $NM -f posix -A $1 | 25650b661123Smrg $SED -n -e ' 25660b661123Smrg 1,100{ 25670b661123Smrg / I /{ 25680b661123Smrg s,.*,import, 25690b661123Smrg p 25700b661123Smrg q 25710b661123Smrg } 25720b661123Smrg }'` 25730b661123Smrg case $win32_nmres in 25740b661123Smrg import*) win32_libid_type="x86 archive import";; 25750b661123Smrg *) win32_libid_type="x86 archive static";; 25760b661123Smrg esac 25770b661123Smrg fi 25780b661123Smrg ;; 25790b661123Smrg *DLL*) 25800b661123Smrg win32_libid_type="x86 DLL" 25810b661123Smrg ;; 25820b661123Smrg *executable*) # but shell scripts are "executable" too... 25830b661123Smrg case $win32_fileres in 25840b661123Smrg *MS\ Windows\ PE\ Intel*) 25850b661123Smrg win32_libid_type="x86 DLL" 25860b661123Smrg ;; 25870b661123Smrg esac 25880b661123Smrg ;; 25890b661123Smrg esac 25900b661123Smrg $ECHO "$win32_libid_type" 25910b661123Smrg} 2592bdcaa8d0Smrg 2593bdcaa8d0Smrg 2594bdcaa8d0Smrg 25950b661123Smrg# func_extract_an_archive dir oldlib 25960b661123Smrgfunc_extract_an_archive () 25970b661123Smrg{ 25980b661123Smrg $opt_debug 25990b661123Smrg f_ex_an_ar_dir="$1"; shift 26000b661123Smrg f_ex_an_ar_oldlib="$1" 26010b661123Smrg func_show_eval "(cd \$f_ex_an_ar_dir && $AR x \"\$f_ex_an_ar_oldlib\")" 'exit $?' 26020b661123Smrg if ($AR t "$f_ex_an_ar_oldlib" | sort | sort -uc >/dev/null 2>&1); then 26030b661123Smrg : 26040b661123Smrg else 26050b661123Smrg func_fatal_error "object name conflicts in archive: $f_ex_an_ar_dir/$f_ex_an_ar_oldlib" 26060b661123Smrg fi 26070b661123Smrg} 2608bdcaa8d0Smrg 2609bdcaa8d0Smrg 26100b661123Smrg# func_extract_archives gentop oldlib ... 26110b661123Smrgfunc_extract_archives () 26120b661123Smrg{ 26130b661123Smrg $opt_debug 26140b661123Smrg my_gentop="$1"; shift 26150b661123Smrg my_oldlibs=${1+"$@"} 26160b661123Smrg my_oldobjs="" 26170b661123Smrg my_xlib="" 26180b661123Smrg my_xabs="" 26190b661123Smrg my_xdir="" 2620bdcaa8d0Smrg 26210b661123Smrg for my_xlib in $my_oldlibs; do 26220b661123Smrg # Extract the objects. 26230b661123Smrg case $my_xlib in 26240b661123Smrg [\\/]* | [A-Za-z]:[\\/]*) my_xabs="$my_xlib" ;; 26250b661123Smrg *) my_xabs=`pwd`"/$my_xlib" ;; 26260b661123Smrg esac 26270b661123Smrg func_basename "$my_xlib" 26280b661123Smrg my_xlib="$func_basename_result" 26290b661123Smrg my_xlib_u=$my_xlib 26300b661123Smrg while :; do 26310b661123Smrg case " $extracted_archives " in 26320b661123Smrg *" $my_xlib_u "*) 26330b661123Smrg func_arith $extracted_serial + 1 26340b661123Smrg extracted_serial=$func_arith_result 26350b661123Smrg my_xlib_u=lt$extracted_serial-$my_xlib ;; 26360b661123Smrg *) break ;; 26370b661123Smrg esac 26380b661123Smrg done 26390b661123Smrg extracted_archives="$extracted_archives $my_xlib_u" 26400b661123Smrg my_xdir="$my_gentop/$my_xlib_u" 2641bdcaa8d0Smrg 26420b661123Smrg func_mkdir_p "$my_xdir" 2643bdcaa8d0Smrg 26440b661123Smrg case $host in 26450b661123Smrg *-darwin*) 26460b661123Smrg func_verbose "Extracting $my_xabs" 26470b661123Smrg # Do not bother doing anything if just a dry run 26480b661123Smrg $opt_dry_run || { 26490b661123Smrg darwin_orig_dir=`pwd` 26500b661123Smrg cd $my_xdir || exit $? 26510b661123Smrg darwin_archive=$my_xabs 26520b661123Smrg darwin_curdir=`pwd` 26530b661123Smrg darwin_base_archive=`basename "$darwin_archive"` 26540b661123Smrg darwin_arches=`$LIPO -info "$darwin_archive" 2>/dev/null | $GREP Architectures 2>/dev/null || true` 26550b661123Smrg if test -n "$darwin_arches"; then 26560b661123Smrg darwin_arches=`$ECHO "$darwin_arches" | $SED -e 's/.*are://'` 26570b661123Smrg darwin_arch= 26580b661123Smrg func_verbose "$darwin_base_archive has multiple architectures $darwin_arches" 26590b661123Smrg for darwin_arch in $darwin_arches ; do 26600b661123Smrg func_mkdir_p "unfat-$$/${darwin_base_archive}-${darwin_arch}" 26610b661123Smrg $LIPO -thin $darwin_arch -output "unfat-$$/${darwin_base_archive}-${darwin_arch}/${darwin_base_archive}" "${darwin_archive}" 26620b661123Smrg cd "unfat-$$/${darwin_base_archive}-${darwin_arch}" 26630b661123Smrg func_extract_an_archive "`pwd`" "${darwin_base_archive}" 26640b661123Smrg cd "$darwin_curdir" 26650b661123Smrg $RM "unfat-$$/${darwin_base_archive}-${darwin_arch}/${darwin_base_archive}" 26660b661123Smrg done # $darwin_arches 26670b661123Smrg ## Okay now we've a bunch of thin objects, gotta fatten them up :) 26680b661123Smrg darwin_filelist=`find unfat-$$ -type f -name \*.o -print -o -name \*.lo -print | $SED -e "$basename" | sort -u` 26690b661123Smrg darwin_file= 26700b661123Smrg darwin_files= 26710b661123Smrg for darwin_file in $darwin_filelist; do 26720b661123Smrg darwin_files=`find unfat-$$ -name $darwin_file -print | $NL2SP` 26730b661123Smrg $LIPO -create -output "$darwin_file" $darwin_files 26740b661123Smrg done # $darwin_filelist 26750b661123Smrg $RM -rf unfat-$$ 26760b661123Smrg cd "$darwin_orig_dir" 267796ce994aSmrg else 26780b661123Smrg cd $darwin_orig_dir 26790b661123Smrg func_extract_an_archive "$my_xdir" "$my_xabs" 26800b661123Smrg fi # $darwin_arches 26810b661123Smrg } # !$opt_dry_run 26820b661123Smrg ;; 26830b661123Smrg *) 26840b661123Smrg func_extract_an_archive "$my_xdir" "$my_xabs" 26850b661123Smrg ;; 26860b661123Smrg esac 26870b661123Smrg my_oldobjs="$my_oldobjs "`find $my_xdir -name \*.$objext -print -o -name \*.lo -print | $NL2SP` 26880b661123Smrg done 2689bdcaa8d0Smrg 26900b661123Smrg func_extract_archives_result="$my_oldobjs" 26910b661123Smrg} 2692bdcaa8d0Smrg 2693bdcaa8d0Smrg 269472313efbSmrg 26950b661123Smrg# func_emit_wrapper_part1 [arg=no] 26960b661123Smrg# 26970b661123Smrg# Emit the first part of a libtool wrapper script on stdout. 26980b661123Smrg# For more information, see the description associated with 26990b661123Smrg# func_emit_wrapper(), below. 27000b661123Smrgfunc_emit_wrapper_part1 () 27010b661123Smrg{ 27020b661123Smrg func_emit_wrapper_part1_arg1=no 27030b661123Smrg if test -n "$1" ; then 27040b661123Smrg func_emit_wrapper_part1_arg1=$1 270596ce994aSmrg fi 270696ce994aSmrg 27070b661123Smrg $ECHO "\ 27080b661123Smrg#! $SHELL 270972313efbSmrg 27100b661123Smrg# $output - temporary wrapper script for $objdir/$outputname 27110b661123Smrg# Generated by $PROGRAM (GNU $PACKAGE$TIMESTAMP) $VERSION 27120b661123Smrg# 27130b661123Smrg# The $output program cannot be directly executed until all the libtool 27140b661123Smrg# libraries that it depends on are installed. 27150b661123Smrg# 27160b661123Smrg# This wrapper script should never be moved out of the build directory. 27170b661123Smrg# If it is, it will not operate correctly. 271872313efbSmrg 27190b661123Smrg# Sed substitution that helps us do robust quoting. It backslashifies 27200b661123Smrg# metacharacters that are still active within double-quoted strings. 27210b661123SmrgXsed='${SED} -e 1s/^X//' 27220b661123Smrgsed_quote_subst='$sed_quote_subst' 2723bdcaa8d0Smrg 27240b661123Smrg# Be Bourne compatible 27250b661123Smrgif test -n \"\${ZSH_VERSION+set}\" && (emulate sh) >/dev/null 2>&1; then 27260b661123Smrg emulate sh 27270b661123Smrg NULLCMD=: 27280b661123Smrg # Zsh 3.x and 4.x performs word splitting on \${1+\"\$@\"}, which 27290b661123Smrg # is contrary to our usage. Disable this feature. 27300b661123Smrg alias -g '\${1+\"\$@\"}'='\"\$@\"' 27310b661123Smrg setopt NO_GLOB_SUBST 27320b661123Smrgelse 27330b661123Smrg case \`(set -o) 2>/dev/null\` in *posix*) set -o posix;; esac 27340b661123Smrgfi 27350b661123SmrgBIN_SH=xpg4; export BIN_SH # for Tru64 27360b661123SmrgDUALCASE=1; export DUALCASE # for MKS sh 2737bdcaa8d0Smrg 27380b661123Smrg# The HP-UX ksh and POSIX shell print the target directory to stdout 27390b661123Smrg# if CDPATH is set. 27400b661123Smrg(unset CDPATH) >/dev/null 2>&1 && unset CDPATH 2741bdcaa8d0Smrg 27420b661123Smrgrelink_command=\"$relink_command\" 2743bdcaa8d0Smrg 27440b661123Smrg# This environment variable determines our operation mode. 27450b661123Smrgif test \"\$libtool_install_magic\" = \"$magic\"; then 27460b661123Smrg # install mode needs the following variables: 27470b661123Smrg generated_by_libtool_version='$macro_version' 27480b661123Smrg notinst_deplibs='$notinst_deplibs' 27490b661123Smrgelse 27500b661123Smrg # When we are sourced in execute mode, \$file and \$ECHO are already set. 27510b661123Smrg if test \"\$libtool_execute_magic\" != \"$magic\"; then 27520b661123Smrg ECHO=\"$qecho\" 27530b661123Smrg file=\"\$0\" 27540b661123Smrg # Make sure echo works. 27550b661123Smrg if test \"X\$1\" = X--no-reexec; then 27560b661123Smrg # Discard the --no-reexec flag, and continue. 27570b661123Smrg shift 27580b661123Smrg elif test \"X\`{ \$ECHO '\t'; } 2>/dev/null\`\" = 'X\t'; then 27590b661123Smrg # Yippee, \$ECHO works! 27600b661123Smrg : 27610b661123Smrg else 27620b661123Smrg # Restart under the correct shell, and then maybe \$ECHO will work. 27630b661123Smrg exec $SHELL \"\$0\" --no-reexec \${1+\"\$@\"} 27640b661123Smrg fi 27650b661123Smrg fi\ 27660b661123Smrg" 27670b661123Smrg $ECHO "\ 2768bdcaa8d0Smrg 27690b661123Smrg # Find the directory that this script lives in. 27700b661123Smrg thisdir=\`\$ECHO \"X\$file\" | \$Xsed -e 's%/[^/]*$%%'\` 27710b661123Smrg test \"x\$thisdir\" = \"x\$file\" && thisdir=. 2772bdcaa8d0Smrg 27730b661123Smrg # Follow symbolic links until we get to the real thisdir. 27740b661123Smrg file=\`ls -ld \"\$file\" | ${SED} -n 's/.*-> //p'\` 27750b661123Smrg while test -n \"\$file\"; do 27760b661123Smrg destdir=\`\$ECHO \"X\$file\" | \$Xsed -e 's%/[^/]*\$%%'\` 2777bdcaa8d0Smrg 27780b661123Smrg # If there was a directory component, then change thisdir. 27790b661123Smrg if test \"x\$destdir\" != \"x\$file\"; then 27800b661123Smrg case \"\$destdir\" in 27810b661123Smrg [\\\\/]* | [A-Za-z]:[\\\\/]*) thisdir=\"\$destdir\" ;; 27820b661123Smrg *) thisdir=\"\$thisdir/\$destdir\" ;; 278396ce994aSmrg esac 27840b661123Smrg fi 278572313efbSmrg 27860b661123Smrg file=\`\$ECHO \"X\$file\" | \$Xsed -e 's%^.*/%%'\` 27870b661123Smrg file=\`ls -ld \"\$thisdir/\$file\" | ${SED} -n 's/.*-> //p'\` 27880b661123Smrg done 27890b661123Smrg" 27900b661123Smrg} 27910b661123Smrg# end: func_emit_wrapper_part1 27920b661123Smrg 27930b661123Smrg# func_emit_wrapper_part2 [arg=no] 27940b661123Smrg# 27950b661123Smrg# Emit the second part of a libtool wrapper script on stdout. 27960b661123Smrg# For more information, see the description associated with 27970b661123Smrg# func_emit_wrapper(), below. 27980b661123Smrgfunc_emit_wrapper_part2 () 27990b661123Smrg{ 28000b661123Smrg func_emit_wrapper_part2_arg1=no 28010b661123Smrg if test -n "$1" ; then 28020b661123Smrg func_emit_wrapper_part2_arg1=$1 280396ce994aSmrg fi 280472313efbSmrg 28050b661123Smrg $ECHO "\ 280672313efbSmrg 28070b661123Smrg # Usually 'no', except on cygwin/mingw when embedded into 28080b661123Smrg # the cwrapper. 28090b661123Smrg WRAPPER_SCRIPT_BELONGS_IN_OBJDIR=$func_emit_wrapper_part2_arg1 28100b661123Smrg if test \"\$WRAPPER_SCRIPT_BELONGS_IN_OBJDIR\" = \"yes\"; then 28110b661123Smrg # special case for '.' 28120b661123Smrg if test \"\$thisdir\" = \".\"; then 28130b661123Smrg thisdir=\`pwd\` 28140b661123Smrg fi 28150b661123Smrg # remove .libs from thisdir 28160b661123Smrg case \"\$thisdir\" in 28170b661123Smrg *[\\\\/]$objdir ) thisdir=\`\$ECHO \"X\$thisdir\" | \$Xsed -e 's%[\\\\/][^\\\\/]*$%%'\` ;; 28180b661123Smrg $objdir ) thisdir=. ;; 28190b661123Smrg esac 28200b661123Smrg fi 28210b661123Smrg 28220b661123Smrg # Try to get the absolute directory name. 28230b661123Smrg absdir=\`cd \"\$thisdir\" && pwd\` 28240b661123Smrg test -n \"\$absdir\" && thisdir=\"\$absdir\" 28250b661123Smrg" 28260b661123Smrg 28270b661123Smrg if test "$fast_install" = yes; then 28280b661123Smrg $ECHO "\ 28290b661123Smrg program=lt-'$outputname'$exeext 28300b661123Smrg progdir=\"\$thisdir/$objdir\" 28310b661123Smrg 28320b661123Smrg if test ! -f \"\$progdir/\$program\" || 28330b661123Smrg { file=\`ls -1dt \"\$progdir/\$program\" \"\$progdir/../\$program\" 2>/dev/null | ${SED} 1q\`; \\ 28340b661123Smrg test \"X\$file\" != \"X\$progdir/\$program\"; }; then 28350b661123Smrg 28360b661123Smrg file=\"\$\$-\$program\" 28370b661123Smrg 28380b661123Smrg if test ! -d \"\$progdir\"; then 28390b661123Smrg $MKDIR \"\$progdir\" 28400b661123Smrg else 28410b661123Smrg $RM \"\$progdir/\$file\" 28420b661123Smrg fi" 28430b661123Smrg 28440b661123Smrg $ECHO "\ 28450b661123Smrg 28460b661123Smrg # relink executable if necessary 28470b661123Smrg if test -n \"\$relink_command\"; then 28480b661123Smrg if relink_command_output=\`eval \$relink_command 2>&1\`; then : 28490b661123Smrg else 28500b661123Smrg $ECHO \"\$relink_command_output\" >&2 28510b661123Smrg $RM \"\$progdir/\$file\" 28520b661123Smrg exit 1 285396ce994aSmrg fi 28540b661123Smrg fi 285572313efbSmrg 28560b661123Smrg $MV \"\$progdir/\$file\" \"\$progdir/\$program\" 2>/dev/null || 28570b661123Smrg { $RM \"\$progdir/\$program\"; 28580b661123Smrg $MV \"\$progdir/\$file\" \"\$progdir/\$program\"; } 28590b661123Smrg $RM \"\$progdir/\$file\" 28600b661123Smrg fi" 28610b661123Smrg else 28620b661123Smrg $ECHO "\ 28630b661123Smrg program='$outputname' 28640b661123Smrg progdir=\"\$thisdir/$objdir\" 28650b661123Smrg" 286696ce994aSmrg fi 286772313efbSmrg 28680b661123Smrg $ECHO "\ 286972313efbSmrg 28700b661123Smrg if test -f \"\$progdir/\$program\"; then" 287172313efbSmrg 28720b661123Smrg # Export our shlibpath_var if we have one. 28730b661123Smrg if test "$shlibpath_overrides_runpath" = yes && test -n "$shlibpath_var" && test -n "$temp_rpath"; then 28740b661123Smrg $ECHO "\ 28750b661123Smrg # Add our own library path to $shlibpath_var 28760b661123Smrg $shlibpath_var=\"$temp_rpath\$$shlibpath_var\" 28770b661123Smrg 28780b661123Smrg # Some systems cannot cope with colon-terminated $shlibpath_var 28790b661123Smrg # The second colon is a workaround for a bug in BeOS R4 sed 28800b661123Smrg $shlibpath_var=\`\$ECHO \"X\$$shlibpath_var\" | \$Xsed -e 's/::*\$//'\` 288172313efbSmrg 28820b661123Smrg export $shlibpath_var 28830b661123Smrg" 288496ce994aSmrg fi 288572313efbSmrg 28860b661123Smrg # fixup the dll searchpath if we need to. 28870b661123Smrg if test -n "$dllsearchpath"; then 28880b661123Smrg $ECHO "\ 28890b661123Smrg # Add the dll search path components to the executable PATH 28900b661123Smrg PATH=$dllsearchpath:\$PATH 28910b661123Smrg" 28920b661123Smrg fi 289372313efbSmrg 28940b661123Smrg $ECHO "\ 28950b661123Smrg if test \"\$libtool_execute_magic\" != \"$magic\"; then 28960b661123Smrg # Run the actual program with our arguments. 28970b661123Smrg" 28980b661123Smrg case $host in 28990b661123Smrg # Backslashes separate directories on plain windows 29000b661123Smrg *-*-mingw | *-*-os2* | *-cegcc*) 29010b661123Smrg $ECHO "\ 29020b661123Smrg exec \"\$progdir\\\\\$program\" \${1+\"\$@\"} 29030b661123Smrg" 290496ce994aSmrg ;; 290572313efbSmrg 290696ce994aSmrg *) 29070b661123Smrg $ECHO "\ 29080b661123Smrg exec \"\$progdir/\$program\" \${1+\"\$@\"} 29090b661123Smrg" 291096ce994aSmrg ;; 291196ce994aSmrg esac 29120b661123Smrg $ECHO "\ 29130b661123Smrg \$ECHO \"\$0: cannot exec \$program \$*\" 1>&2 29140b661123Smrg exit 1 29150b661123Smrg fi 29160b661123Smrg else 29170b661123Smrg # The program doesn't exist. 29180b661123Smrg \$ECHO \"\$0: error: \\\`\$progdir/\$program' does not exist\" 1>&2 29190b661123Smrg \$ECHO \"This script is just a wrapper for \$program.\" 1>&2 29200b661123Smrg $ECHO \"See the $PACKAGE documentation for more information.\" 1>&2 29210b661123Smrg exit 1 29220b661123Smrg fi 29230b661123Smrgfi\ 29240b661123Smrg" 29250b661123Smrg} 29260b661123Smrg# end: func_emit_wrapper_part2 292772313efbSmrg 292872313efbSmrg 29290b661123Smrg# func_emit_wrapper [arg=no] 29300b661123Smrg# 29310b661123Smrg# Emit a libtool wrapper script on stdout. 29320b661123Smrg# Don't directly open a file because we may want to 29330b661123Smrg# incorporate the script contents within a cygwin/mingw 29340b661123Smrg# wrapper executable. Must ONLY be called from within 29350b661123Smrg# func_mode_link because it depends on a number of variables 29360b661123Smrg# set therein. 29370b661123Smrg# 29380b661123Smrg# ARG is the value that the WRAPPER_SCRIPT_BELONGS_IN_OBJDIR 29390b661123Smrg# variable will take. If 'yes', then the emitted script 29400b661123Smrg# will assume that the directory in which it is stored is 29410b661123Smrg# the $objdir directory. This is a cygwin/mingw-specific 29420b661123Smrg# behavior. 29430b661123Smrgfunc_emit_wrapper () 29440b661123Smrg{ 29450b661123Smrg func_emit_wrapper_arg1=no 29460b661123Smrg if test -n "$1" ; then 29470b661123Smrg func_emit_wrapper_arg1=$1 294896ce994aSmrg fi 294972313efbSmrg 29500b661123Smrg # split this up so that func_emit_cwrapperexe_src 29510b661123Smrg # can call each part independently. 29520b661123Smrg func_emit_wrapper_part1 "${func_emit_wrapper_arg1}" 29530b661123Smrg func_emit_wrapper_part2 "${func_emit_wrapper_arg1}" 29540b661123Smrg} 295572313efbSmrg 295672313efbSmrg 29570b661123Smrg# func_to_host_path arg 29580b661123Smrg# 29590b661123Smrg# Convert paths to host format when used with build tools. 29600b661123Smrg# Intended for use with "native" mingw (where libtool itself 29610b661123Smrg# is running under the msys shell), or in the following cross- 29620b661123Smrg# build environments: 29630b661123Smrg# $build $host 29640b661123Smrg# mingw (msys) mingw [e.g. native] 29650b661123Smrg# cygwin mingw 29660b661123Smrg# *nix + wine mingw 29670b661123Smrg# where wine is equipped with the `winepath' executable. 29680b661123Smrg# In the native mingw case, the (msys) shell automatically 29690b661123Smrg# converts paths for any non-msys applications it launches, 29700b661123Smrg# but that facility isn't available from inside the cwrapper. 29710b661123Smrg# Similar accommodations are necessary for $host mingw and 29720b661123Smrg# $build cygwin. Calling this function does no harm for other 29730b661123Smrg# $host/$build combinations not listed above. 29740b661123Smrg# 29750b661123Smrg# ARG is the path (on $build) that should be converted to 29760b661123Smrg# the proper representation for $host. The result is stored 29770b661123Smrg# in $func_to_host_path_result. 29780b661123Smrgfunc_to_host_path () 29790b661123Smrg{ 29800b661123Smrg func_to_host_path_result="$1" 29810b661123Smrg if test -n "$1" ; then 29820b661123Smrg case $host in 29830b661123Smrg *mingw* ) 29840b661123Smrg lt_sed_naive_backslashify='s|\\\\*|\\|g;s|/|\\|g;s|\\|\\\\|g' 29850b661123Smrg case $build in 29860b661123Smrg *mingw* ) # actually, msys 29870b661123Smrg # awkward: cmd appends spaces to result 29880b661123Smrg lt_sed_strip_trailing_spaces="s/[ ]*\$//" 29890b661123Smrg func_to_host_path_tmp1=`( cmd //c echo "$1" |\ 29900b661123Smrg $SED -e "$lt_sed_strip_trailing_spaces" ) 2>/dev/null || echo ""` 29910b661123Smrg func_to_host_path_result=`echo "$func_to_host_path_tmp1" |\ 29920b661123Smrg $SED -e "$lt_sed_naive_backslashify"` 29930b661123Smrg ;; 29940b661123Smrg *cygwin* ) 29950b661123Smrg func_to_host_path_tmp1=`cygpath -w "$1"` 29960b661123Smrg func_to_host_path_result=`echo "$func_to_host_path_tmp1" |\ 29970b661123Smrg $SED -e "$lt_sed_naive_backslashify"` 29980b661123Smrg ;; 29990b661123Smrg * ) 30000b661123Smrg # Unfortunately, winepath does not exit with a non-zero 30010b661123Smrg # error code, so we are forced to check the contents of 30020b661123Smrg # stdout. On the other hand, if the command is not 30030b661123Smrg # found, the shell will set an exit code of 127 and print 30040b661123Smrg # *an error message* to stdout. So we must check for both 30050b661123Smrg # error code of zero AND non-empty stdout, which explains 30060b661123Smrg # the odd construction: 30070b661123Smrg func_to_host_path_tmp1=`winepath -w "$1" 2>/dev/null` 30080b661123Smrg if test "$?" -eq 0 && test -n "${func_to_host_path_tmp1}"; then 30090b661123Smrg func_to_host_path_result=`echo "$func_to_host_path_tmp1" |\ 30100b661123Smrg $SED -e "$lt_sed_naive_backslashify"` 30110b661123Smrg else 30120b661123Smrg # Allow warning below. 30130b661123Smrg func_to_host_path_result="" 30140b661123Smrg fi 30150b661123Smrg ;; 30160b661123Smrg esac 30170b661123Smrg if test -z "$func_to_host_path_result" ; then 30180b661123Smrg func_error "Could not determine host path corresponding to" 30190b661123Smrg func_error " '$1'" 30200b661123Smrg func_error "Continuing, but uninstalled executables may not work." 30210b661123Smrg # Fallback: 30220b661123Smrg func_to_host_path_result="$1" 30230b661123Smrg fi 30240b661123Smrg ;; 30250b661123Smrg esac 30260b661123Smrg fi 30270b661123Smrg} 30280b661123Smrg# end: func_to_host_path 302972313efbSmrg 30300b661123Smrg# func_to_host_pathlist arg 30310b661123Smrg# 30320b661123Smrg# Convert pathlists to host format when used with build tools. 30330b661123Smrg# See func_to_host_path(), above. This function supports the 30340b661123Smrg# following $build/$host combinations (but does no harm for 30350b661123Smrg# combinations not listed here): 30360b661123Smrg# $build $host 30370b661123Smrg# mingw (msys) mingw [e.g. native] 30380b661123Smrg# cygwin mingw 30390b661123Smrg# *nix + wine mingw 30400b661123Smrg# 30410b661123Smrg# Path separators are also converted from $build format to 30420b661123Smrg# $host format. If ARG begins or ends with a path separator 30430b661123Smrg# character, it is preserved (but converted to $host format) 30440b661123Smrg# on output. 30450b661123Smrg# 30460b661123Smrg# ARG is a pathlist (on $build) that should be converted to 30470b661123Smrg# the proper representation on $host. The result is stored 30480b661123Smrg# in $func_to_host_pathlist_result. 30490b661123Smrgfunc_to_host_pathlist () 30500b661123Smrg{ 30510b661123Smrg func_to_host_pathlist_result="$1" 30520b661123Smrg if test -n "$1" ; then 30530b661123Smrg case $host in 30540b661123Smrg *mingw* ) 30550b661123Smrg lt_sed_naive_backslashify='s|\\\\*|\\|g;s|/|\\|g;s|\\|\\\\|g' 30560b661123Smrg # Remove leading and trailing path separator characters from 30570b661123Smrg # ARG. msys behavior is inconsistent here, cygpath turns them 30580b661123Smrg # into '.;' and ';.', and winepath ignores them completely. 30590b661123Smrg func_to_host_pathlist_tmp2="$1" 30600b661123Smrg # Once set for this call, this variable should not be 30610b661123Smrg # reassigned. It is used in tha fallback case. 30620b661123Smrg func_to_host_pathlist_tmp1=`echo "$func_to_host_pathlist_tmp2" |\ 30630b661123Smrg $SED -e 's|^:*||' -e 's|:*$||'` 30640b661123Smrg case $build in 30650b661123Smrg *mingw* ) # Actually, msys. 30660b661123Smrg # Awkward: cmd appends spaces to result. 30670b661123Smrg lt_sed_strip_trailing_spaces="s/[ ]*\$//" 30680b661123Smrg func_to_host_pathlist_tmp2=`( cmd //c echo "$func_to_host_pathlist_tmp1" |\ 30690b661123Smrg $SED -e "$lt_sed_strip_trailing_spaces" ) 2>/dev/null || echo ""` 30700b661123Smrg func_to_host_pathlist_result=`echo "$func_to_host_pathlist_tmp2" |\ 30710b661123Smrg $SED -e "$lt_sed_naive_backslashify"` 30720b661123Smrg ;; 30730b661123Smrg *cygwin* ) 30740b661123Smrg func_to_host_pathlist_tmp2=`cygpath -w -p "$func_to_host_pathlist_tmp1"` 30750b661123Smrg func_to_host_pathlist_result=`echo "$func_to_host_pathlist_tmp2" |\ 30760b661123Smrg $SED -e "$lt_sed_naive_backslashify"` 30770b661123Smrg ;; 30780b661123Smrg * ) 30790b661123Smrg # unfortunately, winepath doesn't convert pathlists 30800b661123Smrg func_to_host_pathlist_result="" 30810b661123Smrg func_to_host_pathlist_oldIFS=$IFS 30820b661123Smrg IFS=: 30830b661123Smrg for func_to_host_pathlist_f in $func_to_host_pathlist_tmp1 ; do 30840b661123Smrg IFS=$func_to_host_pathlist_oldIFS 30850b661123Smrg if test -n "$func_to_host_pathlist_f" ; then 30860b661123Smrg func_to_host_path "$func_to_host_pathlist_f" 30870b661123Smrg if test -n "$func_to_host_path_result" ; then 30880b661123Smrg if test -z "$func_to_host_pathlist_result" ; then 30890b661123Smrg func_to_host_pathlist_result="$func_to_host_path_result" 30900b661123Smrg else 30910b661123Smrg func_to_host_pathlist_result="$func_to_host_pathlist_result;$func_to_host_path_result" 30920b661123Smrg fi 30930b661123Smrg fi 30940b661123Smrg fi 30950b661123Smrg IFS=: 30960b661123Smrg done 30970b661123Smrg IFS=$func_to_host_pathlist_oldIFS 30980b661123Smrg ;; 30990b661123Smrg esac 31000b661123Smrg if test -z "$func_to_host_pathlist_result" ; then 31010b661123Smrg func_error "Could not determine the host path(s) corresponding to" 31020b661123Smrg func_error " '$1'" 31030b661123Smrg func_error "Continuing, but uninstalled executables may not work." 31040b661123Smrg # Fallback. This may break if $1 contains DOS-style drive 31050b661123Smrg # specifications. The fix is not to complicate the expression 31060b661123Smrg # below, but for the user to provide a working wine installation 31070b661123Smrg # with winepath so that path translation in the cross-to-mingw 31080b661123Smrg # case works properly. 31090b661123Smrg lt_replace_pathsep_nix_to_dos="s|:|;|g" 31100b661123Smrg func_to_host_pathlist_result=`echo "$func_to_host_pathlist_tmp1" |\ 31110b661123Smrg $SED -e "$lt_replace_pathsep_nix_to_dos"` 31120b661123Smrg fi 31130b661123Smrg # Now, add the leading and trailing path separators back 31140b661123Smrg case "$1" in 31150b661123Smrg :* ) func_to_host_pathlist_result=";$func_to_host_pathlist_result" 31160b661123Smrg ;; 31170b661123Smrg esac 31180b661123Smrg case "$1" in 31190b661123Smrg *: ) func_to_host_pathlist_result="$func_to_host_pathlist_result;" 31200b661123Smrg ;; 31210b661123Smrg esac 31220b661123Smrg ;; 31230b661123Smrg esac 31240b661123Smrg fi 31250b661123Smrg} 31260b661123Smrg# end: func_to_host_pathlist 312772313efbSmrg 31280b661123Smrg# func_emit_cwrapperexe_src 31290b661123Smrg# emit the source code for a wrapper executable on stdout 31300b661123Smrg# Must ONLY be called from within func_mode_link because 31310b661123Smrg# it depends on a number of variable set therein. 31320b661123Smrgfunc_emit_cwrapperexe_src () 31330b661123Smrg{ 31340b661123Smrg cat <<EOF 3135bdcaa8d0Smrg 31360b661123Smrg/* $cwrappersource - temporary wrapper executable for $objdir/$outputname 31370b661123Smrg Generated by $PROGRAM (GNU $PACKAGE$TIMESTAMP) $VERSION 3138bdcaa8d0Smrg 31390b661123Smrg The $output program cannot be directly executed until all the libtool 31400b661123Smrg libraries that it depends on are installed. 3141bdcaa8d0Smrg 31420b661123Smrg This wrapper executable should never be moved out of the build directory. 31430b661123Smrg If it is, it will not operate correctly. 3144bdcaa8d0Smrg 31450b661123Smrg Currently, it simply execs the wrapper *script* "$SHELL $output", 31460b661123Smrg but could eventually absorb all of the scripts functionality and 31470b661123Smrg exec $objdir/$outputname directly. 31480b661123Smrg*/ 31490b661123SmrgEOF 31500b661123Smrg cat <<"EOF" 31510b661123Smrg#include <stdio.h> 31520b661123Smrg#include <stdlib.h> 31530b661123Smrg#ifdef _MSC_VER 31540b661123Smrg# include <direct.h> 31550b661123Smrg# include <process.h> 31560b661123Smrg# include <io.h> 31570b661123Smrg# define setmode _setmode 31580b661123Smrg#else 31590b661123Smrg# include <unistd.h> 31600b661123Smrg# include <stdint.h> 31610b661123Smrg# ifdef __CYGWIN__ 31620b661123Smrg# include <io.h> 31630b661123Smrg# define HAVE_SETENV 31640b661123Smrg# ifdef __STRICT_ANSI__ 31650b661123Smrgchar *realpath (const char *, char *); 31660b661123Smrgint putenv (char *); 31670b661123Smrgint setenv (const char *, const char *, int); 31680b661123Smrg# endif 31690b661123Smrg# endif 31700b661123Smrg#endif 31710b661123Smrg#include <malloc.h> 31720b661123Smrg#include <stdarg.h> 31730b661123Smrg#include <assert.h> 31740b661123Smrg#include <string.h> 31750b661123Smrg#include <ctype.h> 31760b661123Smrg#include <errno.h> 31770b661123Smrg#include <fcntl.h> 31780b661123Smrg#include <sys/stat.h> 3179bdcaa8d0Smrg 31800b661123Smrg#if defined(PATH_MAX) 31810b661123Smrg# define LT_PATHMAX PATH_MAX 31820b661123Smrg#elif defined(MAXPATHLEN) 31830b661123Smrg# define LT_PATHMAX MAXPATHLEN 31840b661123Smrg#else 31850b661123Smrg# define LT_PATHMAX 1024 31860b661123Smrg#endif 3187bdcaa8d0Smrg 31880b661123Smrg#ifndef S_IXOTH 31890b661123Smrg# define S_IXOTH 0 31900b661123Smrg#endif 31910b661123Smrg#ifndef S_IXGRP 31920b661123Smrg# define S_IXGRP 0 31930b661123Smrg#endif 3194bdcaa8d0Smrg 31950b661123Smrg#ifdef _MSC_VER 31960b661123Smrg# define S_IXUSR _S_IEXEC 31970b661123Smrg# define stat _stat 31980b661123Smrg# ifndef _INTPTR_T_DEFINED 31990b661123Smrg# define intptr_t int 32000b661123Smrg# endif 32010b661123Smrg#endif 3202bdcaa8d0Smrg 32030b661123Smrg#ifndef DIR_SEPARATOR 32040b661123Smrg# define DIR_SEPARATOR '/' 32050b661123Smrg# define PATH_SEPARATOR ':' 32060b661123Smrg#endif 3207bdcaa8d0Smrg 32080b661123Smrg#if defined (_WIN32) || defined (__MSDOS__) || defined (__DJGPP__) || \ 32090b661123Smrg defined (__OS2__) 32100b661123Smrg# define HAVE_DOS_BASED_FILE_SYSTEM 32110b661123Smrg# define FOPEN_WB "wb" 32120b661123Smrg# ifndef DIR_SEPARATOR_2 32130b661123Smrg# define DIR_SEPARATOR_2 '\\' 32140b661123Smrg# endif 32150b661123Smrg# ifndef PATH_SEPARATOR_2 32160b661123Smrg# define PATH_SEPARATOR_2 ';' 32170b661123Smrg# endif 32180b661123Smrg#endif 3219bdcaa8d0Smrg 32200b661123Smrg#ifndef DIR_SEPARATOR_2 32210b661123Smrg# define IS_DIR_SEPARATOR(ch) ((ch) == DIR_SEPARATOR) 32220b661123Smrg#else /* DIR_SEPARATOR_2 */ 32230b661123Smrg# define IS_DIR_SEPARATOR(ch) \ 32240b661123Smrg (((ch) == DIR_SEPARATOR) || ((ch) == DIR_SEPARATOR_2)) 32250b661123Smrg#endif /* DIR_SEPARATOR_2 */ 3226bdcaa8d0Smrg 32270b661123Smrg#ifndef PATH_SEPARATOR_2 32280b661123Smrg# define IS_PATH_SEPARATOR(ch) ((ch) == PATH_SEPARATOR) 32290b661123Smrg#else /* PATH_SEPARATOR_2 */ 32300b661123Smrg# define IS_PATH_SEPARATOR(ch) ((ch) == PATH_SEPARATOR_2) 32310b661123Smrg#endif /* PATH_SEPARATOR_2 */ 3232bdcaa8d0Smrg 32330b661123Smrg#ifdef __CYGWIN__ 32340b661123Smrg# define FOPEN_WB "wb" 32350b661123Smrg#endif 3236bdcaa8d0Smrg 32370b661123Smrg#ifndef FOPEN_WB 32380b661123Smrg# define FOPEN_WB "w" 32390b661123Smrg#endif 32400b661123Smrg#ifndef _O_BINARY 32410b661123Smrg# define _O_BINARY 0 32420b661123Smrg#endif 3243bdcaa8d0Smrg 32440b661123Smrg#define XMALLOC(type, num) ((type *) xmalloc ((num) * sizeof(type))) 32450b661123Smrg#define XFREE(stale) do { \ 32460b661123Smrg if (stale) { free ((void *) stale); stale = 0; } \ 32470b661123Smrg} while (0) 3248bdcaa8d0Smrg 32490b661123Smrg#undef LTWRAPPER_DEBUGPRINTF 32500b661123Smrg#if defined DEBUGWRAPPER 32510b661123Smrg# define LTWRAPPER_DEBUGPRINTF(args) ltwrapper_debugprintf args 32520b661123Smrgstatic void 32530b661123Smrgltwrapper_debugprintf (const char *fmt, ...) 32540b661123Smrg{ 32550b661123Smrg va_list args; 32560b661123Smrg va_start (args, fmt); 32570b661123Smrg (void) vfprintf (stderr, fmt, args); 32580b661123Smrg va_end (args); 32590b661123Smrg} 32600b661123Smrg#else 32610b661123Smrg# define LTWRAPPER_DEBUGPRINTF(args) 32620b661123Smrg#endif 3263bdcaa8d0Smrg 32640b661123Smrgconst char *program_name = NULL; 3265bdcaa8d0Smrg 32660b661123Smrgvoid *xmalloc (size_t num); 32670b661123Smrgchar *xstrdup (const char *string); 32680b661123Smrgconst char *base_name (const char *name); 32690b661123Smrgchar *find_executable (const char *wrapper); 32700b661123Smrgchar *chase_symlinks (const char *pathspec); 32710b661123Smrgint make_executable (const char *path); 32720b661123Smrgint check_executable (const char *path); 32730b661123Smrgchar *strendzap (char *str, const char *pat); 32740b661123Smrgvoid lt_fatal (const char *message, ...); 32750b661123Smrgvoid lt_setenv (const char *name, const char *value); 32760b661123Smrgchar *lt_extend_str (const char *orig_value, const char *add, int to_end); 32770b661123Smrgvoid lt_opt_process_env_set (const char *arg); 32780b661123Smrgvoid lt_opt_process_env_prepend (const char *arg); 32790b661123Smrgvoid lt_opt_process_env_append (const char *arg); 32800b661123Smrgint lt_split_name_value (const char *arg, char** name, char** value); 32810b661123Smrgvoid lt_update_exe_path (const char *name, const char *value); 32820b661123Smrgvoid lt_update_lib_path (const char *name, const char *value); 32830b661123Smrg 32840b661123Smrgstatic const char *script_text_part1 = 32850b661123SmrgEOF 3286bdcaa8d0Smrg 32870b661123Smrg func_emit_wrapper_part1 yes | 32880b661123Smrg $SED -e 's/\([\\"]\)/\\\1/g' \ 32890b661123Smrg -e 's/^/ "/' -e 's/$/\\n"/' 32900b661123Smrg echo ";" 32910b661123Smrg cat <<EOF 3292bdcaa8d0Smrg 32930b661123Smrgstatic const char *script_text_part2 = 32940b661123SmrgEOF 32950b661123Smrg func_emit_wrapper_part2 yes | 32960b661123Smrg $SED -e 's/\([\\"]\)/\\\1/g' \ 32970b661123Smrg -e 's/^/ "/' -e 's/$/\\n"/' 32980b661123Smrg echo ";" 32990b661123Smrg 33000b661123Smrg cat <<EOF 33010b661123Smrgconst char * MAGIC_EXE = "$magic_exe"; 33020b661123Smrgconst char * LIB_PATH_VARNAME = "$shlibpath_var"; 33030b661123SmrgEOF 3304bdcaa8d0Smrg 33050b661123Smrg if test "$shlibpath_overrides_runpath" = yes && test -n "$shlibpath_var" && test -n "$temp_rpath"; then 33060b661123Smrg func_to_host_pathlist "$temp_rpath" 33070b661123Smrg cat <<EOF 33080b661123Smrgconst char * LIB_PATH_VALUE = "$func_to_host_pathlist_result"; 33090b661123SmrgEOF 33100b661123Smrg else 33110b661123Smrg cat <<"EOF" 33120b661123Smrgconst char * LIB_PATH_VALUE = ""; 33130b661123SmrgEOF 331496ce994aSmrg fi 3315bdcaa8d0Smrg 33160b661123Smrg if test -n "$dllsearchpath"; then 33170b661123Smrg func_to_host_pathlist "$dllsearchpath:" 33180b661123Smrg cat <<EOF 33190b661123Smrgconst char * EXE_PATH_VARNAME = "PATH"; 33200b661123Smrgconst char * EXE_PATH_VALUE = "$func_to_host_pathlist_result"; 332196ce994aSmrgEOF 332296ce994aSmrg else 33230b661123Smrg cat <<"EOF" 33240b661123Smrgconst char * EXE_PATH_VARNAME = ""; 33250b661123Smrgconst char * EXE_PATH_VALUE = ""; 33260b661123SmrgEOF 332796ce994aSmrg fi 33280b661123Smrg 33290b661123Smrg if test "$fast_install" = yes; then 33300b661123Smrg cat <<EOF 33310b661123Smrgconst char * TARGET_PROGRAM_NAME = "lt-$outputname"; /* hopefully, no .exe */ 33320b661123SmrgEOF 333396ce994aSmrg else 33340b661123Smrg cat <<EOF 33350b661123Smrgconst char * TARGET_PROGRAM_NAME = "$outputname"; /* hopefully, no .exe */ 33360b661123SmrgEOF 333796ce994aSmrg fi 3338bdcaa8d0Smrg 3339bdcaa8d0Smrg 33400b661123Smrg cat <<"EOF" 3341bdcaa8d0Smrg 33420b661123Smrg#define LTWRAPPER_OPTION_PREFIX "--lt-" 33430b661123Smrg#define LTWRAPPER_OPTION_PREFIX_LENGTH 5 3344bdcaa8d0Smrg 33450b661123Smrgstatic const size_t opt_prefix_len = LTWRAPPER_OPTION_PREFIX_LENGTH; 33460b661123Smrgstatic const char *ltwrapper_option_prefix = LTWRAPPER_OPTION_PREFIX; 3347bdcaa8d0Smrg 33480b661123Smrgstatic const char *dumpscript_opt = LTWRAPPER_OPTION_PREFIX "dump-script"; 3349bdcaa8d0Smrg 33500b661123Smrgstatic const size_t env_set_opt_len = LTWRAPPER_OPTION_PREFIX_LENGTH + 7; 33510b661123Smrgstatic const char *env_set_opt = LTWRAPPER_OPTION_PREFIX "env-set"; 33520b661123Smrg /* argument is putenv-style "foo=bar", value of foo is set to bar */ 3353bdcaa8d0Smrg 33540b661123Smrgstatic const size_t env_prepend_opt_len = LTWRAPPER_OPTION_PREFIX_LENGTH + 11; 33550b661123Smrgstatic const char *env_prepend_opt = LTWRAPPER_OPTION_PREFIX "env-prepend"; 33560b661123Smrg /* argument is putenv-style "foo=bar", new value of foo is bar${foo} */ 3357bdcaa8d0Smrg 33580b661123Smrgstatic const size_t env_append_opt_len = LTWRAPPER_OPTION_PREFIX_LENGTH + 10; 33590b661123Smrgstatic const char *env_append_opt = LTWRAPPER_OPTION_PREFIX "env-append"; 33600b661123Smrg /* argument is putenv-style "foo=bar", new value of foo is ${foo}bar */ 3361bdcaa8d0Smrg 33620b661123Smrgint 33630b661123Smrgmain (int argc, char *argv[]) 33640b661123Smrg{ 33650b661123Smrg char **newargz; 33660b661123Smrg int newargc; 33670b661123Smrg char *tmp_pathspec; 33680b661123Smrg char *actual_cwrapper_path; 33690b661123Smrg char *actual_cwrapper_name; 33700b661123Smrg char *target_name; 33710b661123Smrg char *lt_argv_zero; 33720b661123Smrg intptr_t rval = 127; 3373bdcaa8d0Smrg 33740b661123Smrg int i; 3375bdcaa8d0Smrg 33760b661123Smrg program_name = (char *) xstrdup (base_name (argv[0])); 33770b661123Smrg LTWRAPPER_DEBUGPRINTF (("(main) argv[0] : %s\n", argv[0])); 33780b661123Smrg LTWRAPPER_DEBUGPRINTF (("(main) program_name : %s\n", program_name)); 3379bdcaa8d0Smrg 33800b661123Smrg /* very simple arg parsing; don't want to rely on getopt */ 33810b661123Smrg for (i = 1; i < argc; i++) 33820b661123Smrg { 33830b661123Smrg if (strcmp (argv[i], dumpscript_opt) == 0) 33840b661123Smrg { 33850b661123SmrgEOF 33860b661123Smrg case "$host" in 33870b661123Smrg *mingw* | *cygwin* ) 33880b661123Smrg # make stdout use "unix" line endings 33890b661123Smrg echo " setmode(1,_O_BINARY);" 33900b661123Smrg ;; 33910b661123Smrg esac 3392bdcaa8d0Smrg 33930b661123Smrg cat <<"EOF" 33940b661123Smrg printf ("%s", script_text_part1); 33950b661123Smrg printf ("%s", script_text_part2); 33960b661123Smrg return 0; 33970b661123Smrg } 33980b661123Smrg } 3399bdcaa8d0Smrg 34000b661123Smrg newargz = XMALLOC (char *, argc + 1); 34010b661123Smrg tmp_pathspec = find_executable (argv[0]); 34020b661123Smrg if (tmp_pathspec == NULL) 34030b661123Smrg lt_fatal ("Couldn't find %s", argv[0]); 34040b661123Smrg LTWRAPPER_DEBUGPRINTF (("(main) found exe (before symlink chase) at : %s\n", 34050b661123Smrg tmp_pathspec)); 34060b661123Smrg 34070b661123Smrg actual_cwrapper_path = chase_symlinks (tmp_pathspec); 34080b661123Smrg LTWRAPPER_DEBUGPRINTF (("(main) found exe (after symlink chase) at : %s\n", 34090b661123Smrg actual_cwrapper_path)); 34100b661123Smrg XFREE (tmp_pathspec); 34110b661123Smrg 34120b661123Smrg actual_cwrapper_name = xstrdup( base_name (actual_cwrapper_path)); 34130b661123Smrg strendzap (actual_cwrapper_path, actual_cwrapper_name); 34140b661123Smrg 34150b661123Smrg /* wrapper name transforms */ 34160b661123Smrg strendzap (actual_cwrapper_name, ".exe"); 34170b661123Smrg tmp_pathspec = lt_extend_str (actual_cwrapper_name, ".exe", 1); 34180b661123Smrg XFREE (actual_cwrapper_name); 34190b661123Smrg actual_cwrapper_name = tmp_pathspec; 34200b661123Smrg tmp_pathspec = 0; 34210b661123Smrg 34220b661123Smrg /* target_name transforms -- use actual target program name; might have lt- prefix */ 34230b661123Smrg target_name = xstrdup (base_name (TARGET_PROGRAM_NAME)); 34240b661123Smrg strendzap (target_name, ".exe"); 34250b661123Smrg tmp_pathspec = lt_extend_str (target_name, ".exe", 1); 34260b661123Smrg XFREE (target_name); 34270b661123Smrg target_name = tmp_pathspec; 34280b661123Smrg tmp_pathspec = 0; 34290b661123Smrg 34300b661123Smrg LTWRAPPER_DEBUGPRINTF (("(main) libtool target name: %s\n", 34310b661123Smrg target_name)); 34320b661123SmrgEOF 3433bdcaa8d0Smrg 34340b661123Smrg cat <<EOF 34350b661123Smrg newargz[0] = 34360b661123Smrg XMALLOC (char, (strlen (actual_cwrapper_path) + 34370b661123Smrg strlen ("$objdir") + 1 + strlen (actual_cwrapper_name) + 1)); 34380b661123Smrg strcpy (newargz[0], actual_cwrapper_path); 34390b661123Smrg strcat (newargz[0], "$objdir"); 34400b661123Smrg strcat (newargz[0], "/"); 34410b661123SmrgEOF 3442bdcaa8d0Smrg 34430b661123Smrg cat <<"EOF" 34440b661123Smrg /* stop here, and copy so we don't have to do this twice */ 34450b661123Smrg tmp_pathspec = xstrdup (newargz[0]); 3446bdcaa8d0Smrg 34470b661123Smrg /* do NOT want the lt- prefix here, so use actual_cwrapper_name */ 34480b661123Smrg strcat (newargz[0], actual_cwrapper_name); 3449bdcaa8d0Smrg 34500b661123Smrg /* DO want the lt- prefix here if it exists, so use target_name */ 34510b661123Smrg lt_argv_zero = lt_extend_str (tmp_pathspec, target_name, 1); 34520b661123Smrg XFREE (tmp_pathspec); 34530b661123Smrg tmp_pathspec = NULL; 34540b661123SmrgEOF 3455bdcaa8d0Smrg 34560b661123Smrg case $host_os in 34570b661123Smrg mingw*) 34580b661123Smrg cat <<"EOF" 34590b661123Smrg { 34600b661123Smrg char* p; 34610b661123Smrg while ((p = strchr (newargz[0], '\\')) != NULL) 34620b661123Smrg { 34630b661123Smrg *p = '/'; 34640b661123Smrg } 34650b661123Smrg while ((p = strchr (lt_argv_zero, '\\')) != NULL) 34660b661123Smrg { 34670b661123Smrg *p = '/'; 34680b661123Smrg } 34690b661123Smrg } 34700b661123SmrgEOF 34710b661123Smrg ;; 34720b661123Smrg esac 3473bdcaa8d0Smrg 34740b661123Smrg cat <<"EOF" 34750b661123Smrg XFREE (target_name); 34760b661123Smrg XFREE (actual_cwrapper_path); 34770b661123Smrg XFREE (actual_cwrapper_name); 3478bdcaa8d0Smrg 34790b661123Smrg lt_setenv ("BIN_SH", "xpg4"); /* for Tru64 */ 34800b661123Smrg lt_setenv ("DUALCASE", "1"); /* for MSK sh */ 34810b661123Smrg lt_update_lib_path (LIB_PATH_VARNAME, LIB_PATH_VALUE); 34820b661123Smrg lt_update_exe_path (EXE_PATH_VARNAME, EXE_PATH_VALUE); 3483bdcaa8d0Smrg 34840b661123Smrg newargc=0; 34850b661123Smrg for (i = 1; i < argc; i++) 34860b661123Smrg { 34870b661123Smrg if (strncmp (argv[i], env_set_opt, env_set_opt_len) == 0) 34880b661123Smrg { 34890b661123Smrg if (argv[i][env_set_opt_len] == '=') 34900b661123Smrg { 34910b661123Smrg const char *p = argv[i] + env_set_opt_len + 1; 34920b661123Smrg lt_opt_process_env_set (p); 34930b661123Smrg } 34940b661123Smrg else if (argv[i][env_set_opt_len] == '\0' && i + 1 < argc) 34950b661123Smrg { 34960b661123Smrg lt_opt_process_env_set (argv[++i]); /* don't copy */ 34970b661123Smrg } 34980b661123Smrg else 34990b661123Smrg lt_fatal ("%s missing required argument", env_set_opt); 35000b661123Smrg continue; 35010b661123Smrg } 35020b661123Smrg if (strncmp (argv[i], env_prepend_opt, env_prepend_opt_len) == 0) 35030b661123Smrg { 35040b661123Smrg if (argv[i][env_prepend_opt_len] == '=') 35050b661123Smrg { 35060b661123Smrg const char *p = argv[i] + env_prepend_opt_len + 1; 35070b661123Smrg lt_opt_process_env_prepend (p); 35080b661123Smrg } 35090b661123Smrg else if (argv[i][env_prepend_opt_len] == '\0' && i + 1 < argc) 35100b661123Smrg { 35110b661123Smrg lt_opt_process_env_prepend (argv[++i]); /* don't copy */ 35120b661123Smrg } 35130b661123Smrg else 35140b661123Smrg lt_fatal ("%s missing required argument", env_prepend_opt); 35150b661123Smrg continue; 35160b661123Smrg } 35170b661123Smrg if (strncmp (argv[i], env_append_opt, env_append_opt_len) == 0) 35180b661123Smrg { 35190b661123Smrg if (argv[i][env_append_opt_len] == '=') 35200b661123Smrg { 35210b661123Smrg const char *p = argv[i] + env_append_opt_len + 1; 35220b661123Smrg lt_opt_process_env_append (p); 35230b661123Smrg } 35240b661123Smrg else if (argv[i][env_append_opt_len] == '\0' && i + 1 < argc) 35250b661123Smrg { 35260b661123Smrg lt_opt_process_env_append (argv[++i]); /* don't copy */ 35270b661123Smrg } 35280b661123Smrg else 35290b661123Smrg lt_fatal ("%s missing required argument", env_append_opt); 35300b661123Smrg continue; 35310b661123Smrg } 35320b661123Smrg if (strncmp (argv[i], ltwrapper_option_prefix, opt_prefix_len) == 0) 35330b661123Smrg { 35340b661123Smrg /* however, if there is an option in the LTWRAPPER_OPTION_PREFIX 35350b661123Smrg namespace, but it is not one of the ones we know about and 35360b661123Smrg have already dealt with, above (inluding dump-script), then 35370b661123Smrg report an error. Otherwise, targets might begin to believe 35380b661123Smrg they are allowed to use options in the LTWRAPPER_OPTION_PREFIX 35390b661123Smrg namespace. The first time any user complains about this, we'll 35400b661123Smrg need to make LTWRAPPER_OPTION_PREFIX a configure-time option 35410b661123Smrg or a configure.ac-settable value. 35420b661123Smrg */ 35430b661123Smrg lt_fatal ("Unrecognized option in %s namespace: '%s'", 35440b661123Smrg ltwrapper_option_prefix, argv[i]); 35450b661123Smrg } 35460b661123Smrg /* otherwise ... */ 35470b661123Smrg newargz[++newargc] = xstrdup (argv[i]); 35480b661123Smrg } 35490b661123Smrg newargz[++newargc] = NULL; 3550bdcaa8d0Smrg 35510b661123Smrg LTWRAPPER_DEBUGPRINTF (("(main) lt_argv_zero : %s\n", (lt_argv_zero ? lt_argv_zero : "<NULL>"))); 35520b661123Smrg for (i = 0; i < newargc; i++) 35530b661123Smrg { 35540b661123Smrg LTWRAPPER_DEBUGPRINTF (("(main) newargz[%d] : %s\n", i, (newargz[i] ? newargz[i] : "<NULL>"))); 35550b661123Smrg } 3556bdcaa8d0Smrg 35570b661123SmrgEOF 3558bdcaa8d0Smrg 35590b661123Smrg case $host_os in 35600b661123Smrg mingw*) 35610b661123Smrg cat <<"EOF" 35620b661123Smrg /* execv doesn't actually work on mingw as expected on unix */ 35630b661123Smrg rval = _spawnv (_P_WAIT, lt_argv_zero, (const char * const *) newargz); 35640b661123Smrg if (rval == -1) 35650b661123Smrg { 35660b661123Smrg /* failed to start process */ 35670b661123Smrg LTWRAPPER_DEBUGPRINTF (("(main) failed to launch target \"%s\": errno = %d\n", lt_argv_zero, errno)); 35680b661123Smrg return 127; 35690b661123Smrg } 35700b661123Smrg return rval; 35710b661123SmrgEOF 35720b661123Smrg ;; 35730b661123Smrg *) 35740b661123Smrg cat <<"EOF" 35750b661123Smrg execv (lt_argv_zero, newargz); 35760b661123Smrg return rval; /* =127, but avoids unused variable warning */ 35770b661123SmrgEOF 35780b661123Smrg ;; 35790b661123Smrg esac 3580bdcaa8d0Smrg 35810b661123Smrg cat <<"EOF" 35820b661123Smrg} 3583bdcaa8d0Smrg 35840b661123Smrgvoid * 35850b661123Smrgxmalloc (size_t num) 35860b661123Smrg{ 35870b661123Smrg void *p = (void *) malloc (num); 35880b661123Smrg if (!p) 35890b661123Smrg lt_fatal ("Memory exhausted"); 3590bdcaa8d0Smrg 35910b661123Smrg return p; 35920b661123Smrg} 3593bdcaa8d0Smrg 35940b661123Smrgchar * 35950b661123Smrgxstrdup (const char *string) 35960b661123Smrg{ 35970b661123Smrg return string ? strcpy ((char *) xmalloc (strlen (string) + 1), 35980b661123Smrg string) : NULL; 35990b661123Smrg} 3600bdcaa8d0Smrg 36010b661123Smrgconst char * 36020b661123Smrgbase_name (const char *name) 36030b661123Smrg{ 36040b661123Smrg const char *base; 360596ce994aSmrg 36060b661123Smrg#if defined (HAVE_DOS_BASED_FILE_SYSTEM) 36070b661123Smrg /* Skip over the disk name in MSDOS pathnames. */ 36080b661123Smrg if (isalpha ((unsigned char) name[0]) && name[1] == ':') 36090b661123Smrg name += 2; 36100b661123Smrg#endif 361196ce994aSmrg 36120b661123Smrg for (base = name; *name; name++) 36130b661123Smrg if (IS_DIR_SEPARATOR (*name)) 36140b661123Smrg base = name + 1; 36150b661123Smrg return base; 36160b661123Smrg} 361796ce994aSmrg 36180b661123Smrgint 36190b661123Smrgcheck_executable (const char *path) 36200b661123Smrg{ 36210b661123Smrg struct stat st; 362296ce994aSmrg 36230b661123Smrg LTWRAPPER_DEBUGPRINTF (("(check_executable) : %s\n", 36240b661123Smrg path ? (*path ? path : "EMPTY!") : "NULL!")); 36250b661123Smrg if ((!path) || (!*path)) 36260b661123Smrg return 0; 362796ce994aSmrg 36280b661123Smrg if ((stat (path, &st) >= 0) 36290b661123Smrg && (st.st_mode & (S_IXUSR | S_IXGRP | S_IXOTH))) 36300b661123Smrg return 1; 36310b661123Smrg else 36320b661123Smrg return 0; 36330b661123Smrg} 3634bdcaa8d0Smrg 36350b661123Smrgint 36360b661123Smrgmake_executable (const char *path) 36370b661123Smrg{ 36380b661123Smrg int rval = 0; 36390b661123Smrg struct stat st; 3640bdcaa8d0Smrg 36410b661123Smrg LTWRAPPER_DEBUGPRINTF (("(make_executable) : %s\n", 36420b661123Smrg path ? (*path ? path : "EMPTY!") : "NULL!")); 36430b661123Smrg if ((!path) || (!*path)) 36440b661123Smrg return 0; 3645bdcaa8d0Smrg 36460b661123Smrg if (stat (path, &st) >= 0) 36470b661123Smrg { 36480b661123Smrg rval = chmod (path, st.st_mode | S_IXOTH | S_IXGRP | S_IXUSR); 36490b661123Smrg } 36500b661123Smrg return rval; 36510b661123Smrg} 365296ce994aSmrg 36530b661123Smrg/* Searches for the full path of the wrapper. Returns 36540b661123Smrg newly allocated full path name if found, NULL otherwise 36550b661123Smrg Does not chase symlinks, even on platforms that support them. 36560b661123Smrg*/ 36570b661123Smrgchar * 36580b661123Smrgfind_executable (const char *wrapper) 36590b661123Smrg{ 36600b661123Smrg int has_slash = 0; 36610b661123Smrg const char *p; 36620b661123Smrg const char *p_next; 36630b661123Smrg /* static buffer for getcwd */ 36640b661123Smrg char tmp[LT_PATHMAX + 1]; 36650b661123Smrg int tmp_len; 36660b661123Smrg char *concat_name; 366796ce994aSmrg 36680b661123Smrg LTWRAPPER_DEBUGPRINTF (("(find_executable) : %s\n", 36690b661123Smrg wrapper ? (*wrapper ? wrapper : "EMPTY!") : "NULL!")); 367096ce994aSmrg 36710b661123Smrg if ((wrapper == NULL) || (*wrapper == '\0')) 36720b661123Smrg return NULL; 367396ce994aSmrg 36740b661123Smrg /* Absolute path? */ 36750b661123Smrg#if defined (HAVE_DOS_BASED_FILE_SYSTEM) 36760b661123Smrg if (isalpha ((unsigned char) wrapper[0]) && wrapper[1] == ':') 36770b661123Smrg { 36780b661123Smrg concat_name = xstrdup (wrapper); 36790b661123Smrg if (check_executable (concat_name)) 36800b661123Smrg return concat_name; 36810b661123Smrg XFREE (concat_name); 36820b661123Smrg } 36830b661123Smrg else 36840b661123Smrg { 36850b661123Smrg#endif 36860b661123Smrg if (IS_DIR_SEPARATOR (wrapper[0])) 36870b661123Smrg { 36880b661123Smrg concat_name = xstrdup (wrapper); 36890b661123Smrg if (check_executable (concat_name)) 36900b661123Smrg return concat_name; 36910b661123Smrg XFREE (concat_name); 36920b661123Smrg } 36930b661123Smrg#if defined (HAVE_DOS_BASED_FILE_SYSTEM) 36940b661123Smrg } 36950b661123Smrg#endif 3696bdcaa8d0Smrg 36970b661123Smrg for (p = wrapper; *p; p++) 36980b661123Smrg if (*p == '/') 36990b661123Smrg { 37000b661123Smrg has_slash = 1; 37010b661123Smrg break; 37020b661123Smrg } 37030b661123Smrg if (!has_slash) 37040b661123Smrg { 37050b661123Smrg /* no slashes; search PATH */ 37060b661123Smrg const char *path = getenv ("PATH"); 37070b661123Smrg if (path != NULL) 37080b661123Smrg { 37090b661123Smrg for (p = path; *p; p = p_next) 37100b661123Smrg { 37110b661123Smrg const char *q; 37120b661123Smrg size_t p_len; 37130b661123Smrg for (q = p; *q; q++) 37140b661123Smrg if (IS_PATH_SEPARATOR (*q)) 37150b661123Smrg break; 37160b661123Smrg p_len = q - p; 37170b661123Smrg p_next = (*q == '\0' ? q : q + 1); 37180b661123Smrg if (p_len == 0) 37190b661123Smrg { 37200b661123Smrg /* empty path: current directory */ 37210b661123Smrg if (getcwd (tmp, LT_PATHMAX) == NULL) 37220b661123Smrg lt_fatal ("getcwd failed"); 37230b661123Smrg tmp_len = strlen (tmp); 37240b661123Smrg concat_name = 37250b661123Smrg XMALLOC (char, tmp_len + 1 + strlen (wrapper) + 1); 37260b661123Smrg memcpy (concat_name, tmp, tmp_len); 37270b661123Smrg concat_name[tmp_len] = '/'; 37280b661123Smrg strcpy (concat_name + tmp_len + 1, wrapper); 37290b661123Smrg } 37300b661123Smrg else 37310b661123Smrg { 37320b661123Smrg concat_name = 37330b661123Smrg XMALLOC (char, p_len + 1 + strlen (wrapper) + 1); 37340b661123Smrg memcpy (concat_name, p, p_len); 37350b661123Smrg concat_name[p_len] = '/'; 37360b661123Smrg strcpy (concat_name + p_len + 1, wrapper); 37370b661123Smrg } 37380b661123Smrg if (check_executable (concat_name)) 37390b661123Smrg return concat_name; 37400b661123Smrg XFREE (concat_name); 37410b661123Smrg } 37420b661123Smrg } 37430b661123Smrg /* not found in PATH; assume curdir */ 37440b661123Smrg } 37450b661123Smrg /* Relative path | not found in path: prepend cwd */ 37460b661123Smrg if (getcwd (tmp, LT_PATHMAX) == NULL) 37470b661123Smrg lt_fatal ("getcwd failed"); 37480b661123Smrg tmp_len = strlen (tmp); 37490b661123Smrg concat_name = XMALLOC (char, tmp_len + 1 + strlen (wrapper) + 1); 37500b661123Smrg memcpy (concat_name, tmp, tmp_len); 37510b661123Smrg concat_name[tmp_len] = '/'; 37520b661123Smrg strcpy (concat_name + tmp_len + 1, wrapper); 3753bdcaa8d0Smrg 37540b661123Smrg if (check_executable (concat_name)) 37550b661123Smrg return concat_name; 37560b661123Smrg XFREE (concat_name); 37570b661123Smrg return NULL; 37580b661123Smrg} 3759bdcaa8d0Smrg 37600b661123Smrgchar * 37610b661123Smrgchase_symlinks (const char *pathspec) 37620b661123Smrg{ 37630b661123Smrg#ifndef S_ISLNK 37640b661123Smrg return xstrdup (pathspec); 37650b661123Smrg#else 37660b661123Smrg char buf[LT_PATHMAX]; 37670b661123Smrg struct stat s; 37680b661123Smrg char *tmp_pathspec = xstrdup (pathspec); 37690b661123Smrg char *p; 37700b661123Smrg int has_symlinks = 0; 37710b661123Smrg while (strlen (tmp_pathspec) && !has_symlinks) 37720b661123Smrg { 37730b661123Smrg LTWRAPPER_DEBUGPRINTF (("checking path component for symlinks: %s\n", 37740b661123Smrg tmp_pathspec)); 37750b661123Smrg if (lstat (tmp_pathspec, &s) == 0) 37760b661123Smrg { 37770b661123Smrg if (S_ISLNK (s.st_mode) != 0) 37780b661123Smrg { 37790b661123Smrg has_symlinks = 1; 37800b661123Smrg break; 37810b661123Smrg } 3782bdcaa8d0Smrg 37830b661123Smrg /* search backwards for last DIR_SEPARATOR */ 37840b661123Smrg p = tmp_pathspec + strlen (tmp_pathspec) - 1; 37850b661123Smrg while ((p > tmp_pathspec) && (!IS_DIR_SEPARATOR (*p))) 37860b661123Smrg p--; 37870b661123Smrg if ((p == tmp_pathspec) && (!IS_DIR_SEPARATOR (*p))) 37880b661123Smrg { 37890b661123Smrg /* no more DIR_SEPARATORS left */ 37900b661123Smrg break; 37910b661123Smrg } 37920b661123Smrg *p = '\0'; 37930b661123Smrg } 37940b661123Smrg else 37950b661123Smrg { 37960b661123Smrg char *errstr = strerror (errno); 37970b661123Smrg lt_fatal ("Error accessing file %s (%s)", tmp_pathspec, errstr); 37980b661123Smrg } 37990b661123Smrg } 38000b661123Smrg XFREE (tmp_pathspec); 3801bdcaa8d0Smrg 38020b661123Smrg if (!has_symlinks) 38030b661123Smrg { 38040b661123Smrg return xstrdup (pathspec); 38050b661123Smrg } 3806bdcaa8d0Smrg 38070b661123Smrg tmp_pathspec = realpath (pathspec, buf); 38080b661123Smrg if (tmp_pathspec == 0) 38090b661123Smrg { 38100b661123Smrg lt_fatal ("Could not follow symlinks for %s", pathspec); 38110b661123Smrg } 38120b661123Smrg return xstrdup (tmp_pathspec); 38130b661123Smrg#endif 38140b661123Smrg} 3815bdcaa8d0Smrg 38160b661123Smrgchar * 38170b661123Smrgstrendzap (char *str, const char *pat) 38180b661123Smrg{ 38190b661123Smrg size_t len, patlen; 3820bdcaa8d0Smrg 38210b661123Smrg assert (str != NULL); 38220b661123Smrg assert (pat != NULL); 3823bdcaa8d0Smrg 38240b661123Smrg len = strlen (str); 38250b661123Smrg patlen = strlen (pat); 3826bdcaa8d0Smrg 38270b661123Smrg if (patlen <= len) 38280b661123Smrg { 38290b661123Smrg str += len - patlen; 38300b661123Smrg if (strcmp (str, pat) == 0) 38310b661123Smrg *str = '\0'; 38320b661123Smrg } 38330b661123Smrg return str; 38340b661123Smrg} 3835bdcaa8d0Smrg 38360b661123Smrgstatic void 38370b661123Smrglt_error_core (int exit_status, const char *mode, 38380b661123Smrg const char *message, va_list ap) 38390b661123Smrg{ 38400b661123Smrg fprintf (stderr, "%s: %s: ", program_name, mode); 38410b661123Smrg vfprintf (stderr, message, ap); 38420b661123Smrg fprintf (stderr, ".\n"); 3843bdcaa8d0Smrg 38440b661123Smrg if (exit_status >= 0) 38450b661123Smrg exit (exit_status); 38460b661123Smrg} 3847bdcaa8d0Smrg 38480b661123Smrgvoid 38490b661123Smrglt_fatal (const char *message, ...) 38500b661123Smrg{ 38510b661123Smrg va_list ap; 38520b661123Smrg va_start (ap, message); 38530b661123Smrg lt_error_core (EXIT_FAILURE, "FATAL", message, ap); 38540b661123Smrg va_end (ap); 38550b661123Smrg} 3856bdcaa8d0Smrg 38570b661123Smrgvoid 38580b661123Smrglt_setenv (const char *name, const char *value) 38590b661123Smrg{ 38600b661123Smrg LTWRAPPER_DEBUGPRINTF (("(lt_setenv) setting '%s' to '%s'\n", 38610b661123Smrg (name ? name : "<NULL>"), 38620b661123Smrg (value ? value : "<NULL>"))); 38630b661123Smrg { 38640b661123Smrg#ifdef HAVE_SETENV 38650b661123Smrg /* always make a copy, for consistency with !HAVE_SETENV */ 38660b661123Smrg char *str = xstrdup (value); 38670b661123Smrg setenv (name, str, 1); 38680b661123Smrg#else 38690b661123Smrg int len = strlen (name) + 1 + strlen (value) + 1; 38700b661123Smrg char *str = XMALLOC (char, len); 38710b661123Smrg sprintf (str, "%s=%s", name, value); 38720b661123Smrg if (putenv (str) != EXIT_SUCCESS) 38730b661123Smrg { 38740b661123Smrg XFREE (str); 38750b661123Smrg } 38760b661123Smrg#endif 38770b661123Smrg } 38780b661123Smrg} 3879bdcaa8d0Smrg 38800b661123Smrgchar * 38810b661123Smrglt_extend_str (const char *orig_value, const char *add, int to_end) 38820b661123Smrg{ 38830b661123Smrg char *new_value; 38840b661123Smrg if (orig_value && *orig_value) 38850b661123Smrg { 38860b661123Smrg int orig_value_len = strlen (orig_value); 38870b661123Smrg int add_len = strlen (add); 38880b661123Smrg new_value = XMALLOC (char, add_len + orig_value_len + 1); 38890b661123Smrg if (to_end) 38900b661123Smrg { 38910b661123Smrg strcpy (new_value, orig_value); 38920b661123Smrg strcpy (new_value + orig_value_len, add); 38930b661123Smrg } 38940b661123Smrg else 38950b661123Smrg { 38960b661123Smrg strcpy (new_value, add); 38970b661123Smrg strcpy (new_value + add_len, orig_value); 38980b661123Smrg } 38990b661123Smrg } 39000b661123Smrg else 39010b661123Smrg { 39020b661123Smrg new_value = xstrdup (add); 39030b661123Smrg } 39040b661123Smrg return new_value; 39050b661123Smrg} 3906bdcaa8d0Smrg 39070b661123Smrgint 39080b661123Smrglt_split_name_value (const char *arg, char** name, char** value) 39090b661123Smrg{ 39100b661123Smrg const char *p; 39110b661123Smrg int len; 39120b661123Smrg if (!arg || !*arg) 39130b661123Smrg return 1; 3914bdcaa8d0Smrg 39150b661123Smrg p = strchr (arg, (int)'='); 3916bdcaa8d0Smrg 39170b661123Smrg if (!p) 39180b661123Smrg return 1; 3919bdcaa8d0Smrg 39200b661123Smrg *value = xstrdup (++p); 3921bdcaa8d0Smrg 39220b661123Smrg len = strlen (arg) - strlen (*value); 39230b661123Smrg *name = XMALLOC (char, len); 39240b661123Smrg strncpy (*name, arg, len-1); 39250b661123Smrg (*name)[len - 1] = '\0'; 3926bdcaa8d0Smrg 39270b661123Smrg return 0; 39280b661123Smrg} 3929bdcaa8d0Smrg 39300b661123Smrgvoid 39310b661123Smrglt_opt_process_env_set (const char *arg) 39320b661123Smrg{ 39330b661123Smrg char *name = NULL; 39340b661123Smrg char *value = NULL; 3935bdcaa8d0Smrg 39360b661123Smrg if (lt_split_name_value (arg, &name, &value) != 0) 39370b661123Smrg { 39380b661123Smrg XFREE (name); 39390b661123Smrg XFREE (value); 39400b661123Smrg lt_fatal ("bad argument for %s: '%s'", env_set_opt, arg); 39410b661123Smrg } 3942bdcaa8d0Smrg 39430b661123Smrg lt_setenv (name, value); 39440b661123Smrg XFREE (name); 39450b661123Smrg XFREE (value); 39460b661123Smrg} 3947bdcaa8d0Smrg 39480b661123Smrgvoid 39490b661123Smrglt_opt_process_env_prepend (const char *arg) 39500b661123Smrg{ 39510b661123Smrg char *name = NULL; 39520b661123Smrg char *value = NULL; 39530b661123Smrg char *new_value = NULL; 3954bdcaa8d0Smrg 39550b661123Smrg if (lt_split_name_value (arg, &name, &value) != 0) 39560b661123Smrg { 39570b661123Smrg XFREE (name); 39580b661123Smrg XFREE (value); 39590b661123Smrg lt_fatal ("bad argument for %s: '%s'", env_prepend_opt, arg); 39600b661123Smrg } 3961bdcaa8d0Smrg 39620b661123Smrg new_value = lt_extend_str (getenv (name), value, 0); 39630b661123Smrg lt_setenv (name, new_value); 39640b661123Smrg XFREE (new_value); 39650b661123Smrg XFREE (name); 39660b661123Smrg XFREE (value); 39670b661123Smrg} 3968bdcaa8d0Smrg 39690b661123Smrgvoid 39700b661123Smrglt_opt_process_env_append (const char *arg) 39710b661123Smrg{ 39720b661123Smrg char *name = NULL; 39730b661123Smrg char *value = NULL; 39740b661123Smrg char *new_value = NULL; 3975bdcaa8d0Smrg 39760b661123Smrg if (lt_split_name_value (arg, &name, &value) != 0) 39770b661123Smrg { 39780b661123Smrg XFREE (name); 39790b661123Smrg XFREE (value); 39800b661123Smrg lt_fatal ("bad argument for %s: '%s'", env_append_opt, arg); 39810b661123Smrg } 3982bdcaa8d0Smrg 39830b661123Smrg new_value = lt_extend_str (getenv (name), value, 1); 39840b661123Smrg lt_setenv (name, new_value); 39850b661123Smrg XFREE (new_value); 39860b661123Smrg XFREE (name); 39870b661123Smrg XFREE (value); 39880b661123Smrg} 3989bdcaa8d0Smrg 39900b661123Smrgvoid 39910b661123Smrglt_update_exe_path (const char *name, const char *value) 39920b661123Smrg{ 39930b661123Smrg LTWRAPPER_DEBUGPRINTF (("(lt_update_exe_path) modifying '%s' by prepending '%s'\n", 39940b661123Smrg (name ? name : "<NULL>"), 39950b661123Smrg (value ? value : "<NULL>"))); 3996bdcaa8d0Smrg 39970b661123Smrg if (name && *name && value && *value) 39980b661123Smrg { 39990b661123Smrg char *new_value = lt_extend_str (getenv (name), value, 0); 40000b661123Smrg /* some systems can't cope with a ':'-terminated path #' */ 40010b661123Smrg int len = strlen (new_value); 40020b661123Smrg while (((len = strlen (new_value)) > 0) && IS_PATH_SEPARATOR (new_value[len-1])) 40030b661123Smrg { 40040b661123Smrg new_value[len-1] = '\0'; 40050b661123Smrg } 40060b661123Smrg lt_setenv (name, new_value); 40070b661123Smrg XFREE (new_value); 40080b661123Smrg } 40090b661123Smrg} 4010bdcaa8d0Smrg 40110b661123Smrgvoid 40120b661123Smrglt_update_lib_path (const char *name, const char *value) 40130b661123Smrg{ 40140b661123Smrg LTWRAPPER_DEBUGPRINTF (("(lt_update_lib_path) modifying '%s' by prepending '%s'\n", 40150b661123Smrg (name ? name : "<NULL>"), 40160b661123Smrg (value ? value : "<NULL>"))); 4017bdcaa8d0Smrg 40180b661123Smrg if (name && *name && value && *value) 40190b661123Smrg { 40200b661123Smrg char *new_value = lt_extend_str (getenv (name), value, 0); 40210b661123Smrg lt_setenv (name, new_value); 40220b661123Smrg XFREE (new_value); 40230b661123Smrg } 40240b661123Smrg} 4025bdcaa8d0Smrg 4026bdcaa8d0Smrg 40270b661123SmrgEOF 40280b661123Smrg} 40290b661123Smrg# end: func_emit_cwrapperexe_src 4030bdcaa8d0Smrg 40310b661123Smrg# func_mode_link arg... 40320b661123Smrgfunc_mode_link () 40330b661123Smrg{ 40340b661123Smrg $opt_debug 40350b661123Smrg case $host in 40360b661123Smrg *-*-cygwin* | *-*-mingw* | *-*-pw32* | *-*-os2* | *-cegcc*) 40370b661123Smrg # It is impossible to link a dll without this setting, and 40380b661123Smrg # we shouldn't force the makefile maintainer to figure out 40390b661123Smrg # which system we are compiling for in order to pass an extra 40400b661123Smrg # flag for every libtool invocation. 40410b661123Smrg # allow_undefined=no 4042bdcaa8d0Smrg 40430b661123Smrg # FIXME: Unfortunately, there are problems with the above when trying 40440b661123Smrg # to make a dll which has undefined symbols, in which case not 40450b661123Smrg # even a static library is built. For now, we need to specify 40460b661123Smrg # -no-undefined on the libtool link line when we can be certain 40470b661123Smrg # that all symbols are satisfied, otherwise we get a static library. 40480b661123Smrg allow_undefined=yes 40490b661123Smrg ;; 40500b661123Smrg *) 40510b661123Smrg allow_undefined=yes 40520b661123Smrg ;; 40530b661123Smrg esac 40540b661123Smrg libtool_args=$nonopt 40550b661123Smrg base_compile="$nonopt $@" 40560b661123Smrg compile_command=$nonopt 40570b661123Smrg finalize_command=$nonopt 4058bdcaa8d0Smrg 40590b661123Smrg compile_rpath= 40600b661123Smrg finalize_rpath= 40610b661123Smrg compile_shlibpath= 40620b661123Smrg finalize_shlibpath= 40630b661123Smrg convenience= 40640b661123Smrg old_convenience= 40650b661123Smrg deplibs= 40660b661123Smrg old_deplibs= 40670b661123Smrg compiler_flags= 40680b661123Smrg linker_flags= 40690b661123Smrg dllsearchpath= 40700b661123Smrg lib_search_path=`pwd` 40710b661123Smrg inst_prefix_dir= 40720b661123Smrg new_inherited_linker_flags= 4073bdcaa8d0Smrg 40740b661123Smrg avoid_version=no 40750b661123Smrg dlfiles= 40760b661123Smrg dlprefiles= 40770b661123Smrg dlself=no 40780b661123Smrg export_dynamic=no 40790b661123Smrg export_symbols= 40800b661123Smrg export_symbols_regex= 40810b661123Smrg generated= 40820b661123Smrg libobjs= 40830b661123Smrg ltlibs= 40840b661123Smrg module=no 40850b661123Smrg no_install=no 40860b661123Smrg objs= 40870b661123Smrg non_pic_objects= 40880b661123Smrg precious_files_regex= 40890b661123Smrg prefer_static_libs=no 40900b661123Smrg preload=no 40910b661123Smrg prev= 40920b661123Smrg prevarg= 40930b661123Smrg release= 40940b661123Smrg rpath= 40950b661123Smrg xrpath= 40960b661123Smrg perm_rpath= 40970b661123Smrg temp_rpath= 40980b661123Smrg thread_safe=no 40990b661123Smrg vinfo= 41000b661123Smrg vinfo_number=no 41010b661123Smrg weak_libs= 41020b661123Smrg single_module="${wl}-single_module" 41030b661123Smrg func_infer_tag $base_compile 41040b661123Smrg 41050b661123Smrg # We need to know -static, to get the right output filenames. 41060b661123Smrg for arg 41070b661123Smrg do 41080b661123Smrg case $arg in 41090b661123Smrg -shared) 41100b661123Smrg test "$build_libtool_libs" != yes && \ 41110b661123Smrg func_fatal_configuration "can not build a shared library" 41120b661123Smrg build_old_libs=no 41130b661123Smrg break 41140b661123Smrg ;; 41150b661123Smrg -all-static | -static | -static-libtool-libs) 41160b661123Smrg case $arg in 41170b661123Smrg -all-static) 41180b661123Smrg if test "$build_libtool_libs" = yes && test -z "$link_static_flag"; then 41190b661123Smrg func_warning "complete static linking is impossible in this configuration" 41200b661123Smrg fi 41210b661123Smrg if test -n "$link_static_flag"; then 41220b661123Smrg dlopen_self=$dlopen_self_static 41230b661123Smrg fi 41240b661123Smrg prefer_static_libs=yes 41250b661123Smrg ;; 41260b661123Smrg -static) 41270b661123Smrg if test -z "$pic_flag" && test -n "$link_static_flag"; then 41280b661123Smrg dlopen_self=$dlopen_self_static 41290b661123Smrg fi 41300b661123Smrg prefer_static_libs=built 41310b661123Smrg ;; 41320b661123Smrg -static-libtool-libs) 41330b661123Smrg if test -z "$pic_flag" && test -n "$link_static_flag"; then 41340b661123Smrg dlopen_self=$dlopen_self_static 413596ce994aSmrg fi 41360b661123Smrg prefer_static_libs=yes 41370b661123Smrg ;; 41380b661123Smrg esac 41390b661123Smrg build_libtool_libs=no 41400b661123Smrg build_old_libs=yes 41410b661123Smrg break 41420b661123Smrg ;; 41430b661123Smrg esac 41440b661123Smrg done 4145bdcaa8d0Smrg 41460b661123Smrg # See if our shared archives depend on static archives. 41470b661123Smrg test -n "$old_archive_from_new_cmds" && build_old_libs=yes 4148bdcaa8d0Smrg 41490b661123Smrg # Go through the arguments, transforming them on the way. 41500b661123Smrg while test "$#" -gt 0; do 41510b661123Smrg arg="$1" 41520b661123Smrg shift 41530b661123Smrg func_quote_for_eval "$arg" 41540b661123Smrg qarg=$func_quote_for_eval_unquoted_result 41550b661123Smrg func_append libtool_args " $func_quote_for_eval_result" 4156bdcaa8d0Smrg 41570b661123Smrg # If the previous option needs an argument, assign it. 41580b661123Smrg if test -n "$prev"; then 41590b661123Smrg case $prev in 41600b661123Smrg output) 41610b661123Smrg func_append compile_command " @OUTPUT@" 41620b661123Smrg func_append finalize_command " @OUTPUT@" 41630b661123Smrg ;; 41640b661123Smrg esac 4165bdcaa8d0Smrg 41660b661123Smrg case $prev in 41670b661123Smrg dlfiles|dlprefiles) 41680b661123Smrg if test "$preload" = no; then 41690b661123Smrg # Add the symbol object into the linking commands. 41700b661123Smrg func_append compile_command " @SYMFILE@" 41710b661123Smrg func_append finalize_command " @SYMFILE@" 41720b661123Smrg preload=yes 41730b661123Smrg fi 41740b661123Smrg case $arg in 41750b661123Smrg *.la | *.lo) ;; # We handle these cases below. 41760b661123Smrg force) 41770b661123Smrg if test "$dlself" = no; then 41780b661123Smrg dlself=needless 41790b661123Smrg export_dynamic=yes 41800b661123Smrg fi 41810b661123Smrg prev= 41820b661123Smrg continue 41830b661123Smrg ;; 41840b661123Smrg self) 41850b661123Smrg if test "$prev" = dlprefiles; then 41860b661123Smrg dlself=yes 41870b661123Smrg elif test "$prev" = dlfiles && test "$dlopen_self" != yes; then 41880b661123Smrg dlself=yes 418996ce994aSmrg else 41900b661123Smrg dlself=needless 41910b661123Smrg export_dynamic=yes 419296ce994aSmrg fi 41930b661123Smrg prev= 41940b661123Smrg continue 41950b661123Smrg ;; 41960b661123Smrg *) 41970b661123Smrg if test "$prev" = dlfiles; then 41980b661123Smrg dlfiles="$dlfiles $arg" 419996ce994aSmrg else 42000b661123Smrg dlprefiles="$dlprefiles $arg" 420196ce994aSmrg fi 42020b661123Smrg prev= 42030b661123Smrg continue 42040b661123Smrg ;; 42050b661123Smrg esac 42060b661123Smrg ;; 42070b661123Smrg expsyms) 42080b661123Smrg export_symbols="$arg" 42090b661123Smrg test -f "$arg" \ 42100b661123Smrg || func_fatal_error "symbol file \`$arg' does not exist" 42110b661123Smrg prev= 42120b661123Smrg continue 42130b661123Smrg ;; 42140b661123Smrg expsyms_regex) 42150b661123Smrg export_symbols_regex="$arg" 42160b661123Smrg prev= 42170b661123Smrg continue 42180b661123Smrg ;; 42190b661123Smrg framework) 422096ce994aSmrg case $host in 42210b661123Smrg *-*-darwin*) 42220b661123Smrg case "$deplibs " in 42230b661123Smrg *" $qarg.ltframework "*) ;; 42240b661123Smrg *) deplibs="$deplibs $qarg.ltframework" # this is fixed later 42250b661123Smrg ;; 42260b661123Smrg esac 42270b661123Smrg ;; 422896ce994aSmrg esac 42290b661123Smrg prev= 42300b661123Smrg continue 423196ce994aSmrg ;; 42320b661123Smrg inst_prefix) 42330b661123Smrg inst_prefix_dir="$arg" 42340b661123Smrg prev= 42350b661123Smrg continue 423696ce994aSmrg ;; 42370b661123Smrg objectlist) 42380b661123Smrg if test -f "$arg"; then 42390b661123Smrg save_arg=$arg 42400b661123Smrg moreargs= 42410b661123Smrg for fil in `cat "$save_arg"` 42420b661123Smrg do 42430b661123Smrg# moreargs="$moreargs $fil" 42440b661123Smrg arg=$fil 42450b661123Smrg # A libtool-controlled object. 424672313efbSmrg 42470b661123Smrg # Check to see that this really is a libtool object. 42480b661123Smrg if func_lalib_unsafe_p "$arg"; then 42490b661123Smrg pic_object= 42500b661123Smrg non_pic_object= 425172313efbSmrg 42520b661123Smrg # Read the .lo file 42530b661123Smrg func_source "$arg" 425472313efbSmrg 42550b661123Smrg if test -z "$pic_object" || 42560b661123Smrg test -z "$non_pic_object" || 42570b661123Smrg test "$pic_object" = none && 42580b661123Smrg test "$non_pic_object" = none; then 42590b661123Smrg func_fatal_error "cannot find name of object for \`$arg'" 42600b661123Smrg fi 426172313efbSmrg 42620b661123Smrg # Extract subdirectory from the argument. 42630b661123Smrg func_dirname "$arg" "/" "" 42640b661123Smrg xdir="$func_dirname_result" 426572313efbSmrg 42660b661123Smrg if test "$pic_object" != none; then 42670b661123Smrg # Prepend the subdirectory the object is found in. 42680b661123Smrg pic_object="$xdir$pic_object" 426972313efbSmrg 42700b661123Smrg if test "$prev" = dlfiles; then 42710b661123Smrg if test "$build_libtool_libs" = yes && test "$dlopen_support" = yes; then 42720b661123Smrg dlfiles="$dlfiles $pic_object" 42730b661123Smrg prev= 42740b661123Smrg continue 42750b661123Smrg else 42760b661123Smrg # If libtool objects are unsupported, then we need to preload. 42770b661123Smrg prev=dlprefiles 42780b661123Smrg fi 42790b661123Smrg fi 428072313efbSmrg 42810b661123Smrg # CHECK ME: I think I busted this. -Ossama 42820b661123Smrg if test "$prev" = dlprefiles; then 42830b661123Smrg # Preload the old-style object. 42840b661123Smrg dlprefiles="$dlprefiles $pic_object" 42850b661123Smrg prev= 42860b661123Smrg fi 428772313efbSmrg 42880b661123Smrg # A PIC object. 42890b661123Smrg func_append libobjs " $pic_object" 42900b661123Smrg arg="$pic_object" 42910b661123Smrg fi 429272313efbSmrg 42930b661123Smrg # Non-PIC object. 42940b661123Smrg if test "$non_pic_object" != none; then 42950b661123Smrg # Prepend the subdirectory the object is found in. 42960b661123Smrg non_pic_object="$xdir$non_pic_object" 429772313efbSmrg 42980b661123Smrg # A standard non-PIC object 42990b661123Smrg func_append non_pic_objects " $non_pic_object" 43000b661123Smrg if test -z "$pic_object" || test "$pic_object" = none ; then 43010b661123Smrg arg="$non_pic_object" 43020b661123Smrg fi 43030b661123Smrg else 43040b661123Smrg # If the PIC object exists, use it instead. 43050b661123Smrg # $xdir was prepended to $pic_object above. 43060b661123Smrg non_pic_object="$pic_object" 43070b661123Smrg func_append non_pic_objects " $non_pic_object" 43080b661123Smrg fi 43090b661123Smrg else 43100b661123Smrg # Only an error if not doing a dry-run. 43110b661123Smrg if $opt_dry_run; then 43120b661123Smrg # Extract subdirectory from the argument. 43130b661123Smrg func_dirname "$arg" "/" "" 43140b661123Smrg xdir="$func_dirname_result" 43150b661123Smrg 43160b661123Smrg func_lo2o "$arg" 43170b661123Smrg pic_object=$xdir$objdir/$func_lo2o_result 43180b661123Smrg non_pic_object=$xdir$func_lo2o_result 43190b661123Smrg func_append libobjs " $pic_object" 43200b661123Smrg func_append non_pic_objects " $non_pic_object" 43210b661123Smrg else 43220b661123Smrg func_fatal_error "\`$arg' is not a valid libtool object" 43230b661123Smrg fi 43240b661123Smrg fi 43250b661123Smrg done 432696ce994aSmrg else 43270b661123Smrg func_fatal_error "link input file \`$arg' does not exist" 432896ce994aSmrg fi 43290b661123Smrg arg=$save_arg 43300b661123Smrg prev= 43310b661123Smrg continue 43320b661123Smrg ;; 43330b661123Smrg precious_regex) 43340b661123Smrg precious_files_regex="$arg" 43350b661123Smrg prev= 43360b661123Smrg continue 43370b661123Smrg ;; 43380b661123Smrg release) 43390b661123Smrg release="-$arg" 43400b661123Smrg prev= 43410b661123Smrg continue 43420b661123Smrg ;; 43430b661123Smrg rpath | xrpath) 43440b661123Smrg # We need an absolute path. 43450b661123Smrg case $arg in 43460b661123Smrg [\\/]* | [A-Za-z]:[\\/]*) ;; 43470b661123Smrg *) 43480b661123Smrg func_fatal_error "only absolute run-paths are allowed" 43490b661123Smrg ;; 43500b661123Smrg esac 43510b661123Smrg if test "$prev" = rpath; then 43520b661123Smrg case "$rpath " in 43530b661123Smrg *" $arg "*) ;; 43540b661123Smrg *) rpath="$rpath $arg" ;; 43550b661123Smrg esac 435696ce994aSmrg else 43570b661123Smrg case "$xrpath " in 43580b661123Smrg *" $arg "*) ;; 43590b661123Smrg *) xrpath="$xrpath $arg" ;; 43600b661123Smrg esac 436196ce994aSmrg fi 43620b661123Smrg prev= 43630b661123Smrg continue 43640b661123Smrg ;; 43650b661123Smrg shrext) 43660b661123Smrg shrext_cmds="$arg" 43670b661123Smrg prev= 43680b661123Smrg continue 43690b661123Smrg ;; 43700b661123Smrg weak) 43710b661123Smrg weak_libs="$weak_libs $arg" 43720b661123Smrg prev= 43730b661123Smrg continue 43740b661123Smrg ;; 43750b661123Smrg xcclinker) 43760b661123Smrg linker_flags="$linker_flags $qarg" 43770b661123Smrg compiler_flags="$compiler_flags $qarg" 43780b661123Smrg prev= 43790b661123Smrg func_append compile_command " $qarg" 43800b661123Smrg func_append finalize_command " $qarg" 43810b661123Smrg continue 43820b661123Smrg ;; 43830b661123Smrg xcompiler) 43840b661123Smrg compiler_flags="$compiler_flags $qarg" 43850b661123Smrg prev= 43860b661123Smrg func_append compile_command " $qarg" 43870b661123Smrg func_append finalize_command " $qarg" 43880b661123Smrg continue 43890b661123Smrg ;; 43900b661123Smrg xlinker) 43910b661123Smrg linker_flags="$linker_flags $qarg" 43920b661123Smrg compiler_flags="$compiler_flags $wl$qarg" 43930b661123Smrg prev= 43940b661123Smrg func_append compile_command " $wl$qarg" 43950b661123Smrg func_append finalize_command " $wl$qarg" 43960b661123Smrg continue 43970b661123Smrg ;; 43980b661123Smrg *) 43990b661123Smrg eval "$prev=\"\$arg\"" 44000b661123Smrg prev= 44010b661123Smrg continue 44020b661123Smrg ;; 440372313efbSmrg esac 44040b661123Smrg fi # test -n "$prev" 440572313efbSmrg 44060b661123Smrg prevarg="$arg" 440772313efbSmrg 44080b661123Smrg case $arg in 44090b661123Smrg -all-static) 44100b661123Smrg if test -n "$link_static_flag"; then 44110b661123Smrg # See comment for -static flag below, for more details. 44120b661123Smrg func_append compile_command " $link_static_flag" 44130b661123Smrg func_append finalize_command " $link_static_flag" 44140b661123Smrg fi 44150b661123Smrg continue 44160b661123Smrg ;; 441772313efbSmrg 44180b661123Smrg -allow-undefined) 44190b661123Smrg # FIXME: remove this flag sometime in the future. 44200b661123Smrg func_fatal_error "\`-allow-undefined' must not be used because it is the default" 44210b661123Smrg ;; 442272313efbSmrg 44230b661123Smrg -avoid-version) 44240b661123Smrg avoid_version=yes 44250b661123Smrg continue 44260b661123Smrg ;; 442772313efbSmrg 44280b661123Smrg -dlopen) 44290b661123Smrg prev=dlfiles 44300b661123Smrg continue 44310b661123Smrg ;; 443272313efbSmrg 44330b661123Smrg -dlpreopen) 44340b661123Smrg prev=dlprefiles 44350b661123Smrg continue 44360b661123Smrg ;; 443772313efbSmrg 44380b661123Smrg -export-dynamic) 44390b661123Smrg export_dynamic=yes 44400b661123Smrg continue 44410b661123Smrg ;; 444272313efbSmrg 44430b661123Smrg -export-symbols | -export-symbols-regex) 44440b661123Smrg if test -n "$export_symbols" || test -n "$export_symbols_regex"; then 44450b661123Smrg func_fatal_error "more than one -exported-symbols argument is not allowed" 44460b661123Smrg fi 44470b661123Smrg if test "X$arg" = "X-export-symbols"; then 44480b661123Smrg prev=expsyms 44490b661123Smrg else 44500b661123Smrg prev=expsyms_regex 44510b661123Smrg fi 44520b661123Smrg continue 44530b661123Smrg ;; 445472313efbSmrg 44550b661123Smrg -framework) 44560b661123Smrg prev=framework 44570b661123Smrg continue 44580b661123Smrg ;; 445972313efbSmrg 44600b661123Smrg -inst-prefix-dir) 44610b661123Smrg prev=inst_prefix 44620b661123Smrg continue 44630b661123Smrg ;; 446472313efbSmrg 44650b661123Smrg # The native IRIX linker understands -LANG:*, -LIST:* and -LNO:* 44660b661123Smrg # so, if we see these flags be careful not to treat them like -L 44670b661123Smrg -L[A-Z][A-Z]*:*) 44680b661123Smrg case $with_gcc/$host in 44690b661123Smrg no/*-*-irix* | /*-*-irix*) 44700b661123Smrg func_append compile_command " $arg" 44710b661123Smrg func_append finalize_command " $arg" 44720b661123Smrg ;; 44730b661123Smrg esac 44740b661123Smrg continue 44750b661123Smrg ;; 447672313efbSmrg 44770b661123Smrg -L*) 44780b661123Smrg func_stripname '-L' '' "$arg" 44790b661123Smrg dir=$func_stripname_result 44800b661123Smrg if test -z "$dir"; then 44810b661123Smrg if test "$#" -gt 0; then 44820b661123Smrg func_fatal_error "require no space between \`-L' and \`$1'" 44830b661123Smrg else 44840b661123Smrg func_fatal_error "need path for \`-L' option" 44850b661123Smrg fi 44860b661123Smrg fi 44870b661123Smrg # We need an absolute path. 44880b661123Smrg case $dir in 44890b661123Smrg [\\/]* | [A-Za-z]:[\\/]*) ;; 44900b661123Smrg *) 44910b661123Smrg absdir=`cd "$dir" && pwd` 44920b661123Smrg test -z "$absdir" && \ 44930b661123Smrg func_fatal_error "cannot determine absolute directory name of \`$dir'" 44940b661123Smrg dir="$absdir" 44950b661123Smrg ;; 44960b661123Smrg esac 44970b661123Smrg case "$deplibs " in 44980b661123Smrg *" -L$dir "*) ;; 44990b661123Smrg *) 45000b661123Smrg deplibs="$deplibs -L$dir" 45010b661123Smrg lib_search_path="$lib_search_path $dir" 45020b661123Smrg ;; 45030b661123Smrg esac 45040b661123Smrg case $host in 45050b661123Smrg *-*-cygwin* | *-*-mingw* | *-*-pw32* | *-*-os2* | *-cegcc*) 45060b661123Smrg testbindir=`$ECHO "X$dir" | $Xsed -e 's*/lib$*/bin*'` 45070b661123Smrg case :$dllsearchpath: in 45080b661123Smrg *":$dir:"*) ;; 45090b661123Smrg ::) dllsearchpath=$dir;; 45100b661123Smrg *) dllsearchpath="$dllsearchpath:$dir";; 45110b661123Smrg esac 45120b661123Smrg case :$dllsearchpath: in 45130b661123Smrg *":$testbindir:"*) ;; 45140b661123Smrg ::) dllsearchpath=$testbindir;; 45150b661123Smrg *) dllsearchpath="$dllsearchpath:$testbindir";; 45160b661123Smrg esac 45170b661123Smrg ;; 45180b661123Smrg esac 45190b661123Smrg continue 45200b661123Smrg ;; 452172313efbSmrg 45220b661123Smrg -l*) 45230b661123Smrg if test "X$arg" = "X-lc" || test "X$arg" = "X-lm"; then 45240b661123Smrg case $host in 45250b661123Smrg *-*-cygwin* | *-*-mingw* | *-*-pw32* | *-*-beos* | *-cegcc*) 45260b661123Smrg # These systems don't actually have a C or math library (as such) 45270b661123Smrg continue 45280b661123Smrg ;; 45290b661123Smrg *-*-os2*) 45300b661123Smrg # These systems don't actually have a C library (as such) 45310b661123Smrg test "X$arg" = "X-lc" && continue 45320b661123Smrg ;; 45330b661123Smrg *-*-openbsd* | *-*-freebsd* | *-*-dragonfly*) 45340b661123Smrg # Do not include libc due to us having libc/libc_r. 45350b661123Smrg test "X$arg" = "X-lc" && continue 45360b661123Smrg ;; 45370b661123Smrg *-*-rhapsody* | *-*-darwin1.[012]) 45380b661123Smrg # Rhapsody C and math libraries are in the System framework 45390b661123Smrg deplibs="$deplibs System.ltframework" 45400b661123Smrg continue 45410b661123Smrg ;; 45420b661123Smrg *-*-sco3.2v5* | *-*-sco5v6*) 45430b661123Smrg # Causes problems with __ctype 45440b661123Smrg test "X$arg" = "X-lc" && continue 45450b661123Smrg ;; 45460b661123Smrg *-*-sysv4.2uw2* | *-*-sysv5* | *-*-unixware* | *-*-OpenUNIX*) 45470b661123Smrg # Compiler inserts libc in the correct place for threads to work 45480b661123Smrg test "X$arg" = "X-lc" && continue 45490b661123Smrg ;; 45500b661123Smrg esac 45510b661123Smrg elif test "X$arg" = "X-lc_r"; then 45520b661123Smrg case $host in 45530b661123Smrg *-*-openbsd* | *-*-freebsd* | *-*-dragonfly*) 45540b661123Smrg # Do not include libc_r directly, use -pthread flag. 45550b661123Smrg continue 45560b661123Smrg ;; 45570b661123Smrg esac 45580b661123Smrg fi 45590b661123Smrg deplibs="$deplibs $arg" 45600b661123Smrg continue 45610b661123Smrg ;; 456272313efbSmrg 45630b661123Smrg -module) 45640b661123Smrg module=yes 45650b661123Smrg continue 45660b661123Smrg ;; 456772313efbSmrg 45680b661123Smrg # Tru64 UNIX uses -model [arg] to determine the layout of C++ 45690b661123Smrg # classes, name mangling, and exception handling. 45700b661123Smrg # Darwin uses the -arch flag to determine output architecture. 45710b661123Smrg -model|-arch|-isysroot) 45720b661123Smrg compiler_flags="$compiler_flags $arg" 45730b661123Smrg func_append compile_command " $arg" 45740b661123Smrg func_append finalize_command " $arg" 45750b661123Smrg prev=xcompiler 45760b661123Smrg continue 45770b661123Smrg ;; 457872313efbSmrg 45790b661123Smrg -mt|-mthreads|-kthread|-Kthread|-pthread|-pthreads|--thread-safe|-threads) 45800b661123Smrg compiler_flags="$compiler_flags $arg" 45810b661123Smrg func_append compile_command " $arg" 45820b661123Smrg func_append finalize_command " $arg" 45830b661123Smrg case "$new_inherited_linker_flags " in 45840b661123Smrg *" $arg "*) ;; 45850b661123Smrg * ) new_inherited_linker_flags="$new_inherited_linker_flags $arg" ;; 45860b661123Smrg esac 45870b661123Smrg continue 45880b661123Smrg ;; 458972313efbSmrg 45900b661123Smrg -multi_module) 45910b661123Smrg single_module="${wl}-multi_module" 45920b661123Smrg continue 45930b661123Smrg ;; 459472313efbSmrg 45950b661123Smrg -no-fast-install) 45960b661123Smrg fast_install=no 45970b661123Smrg continue 45980b661123Smrg ;; 459972313efbSmrg 46000b661123Smrg -no-install) 46010b661123Smrg case $host in 46020b661123Smrg *-*-cygwin* | *-*-mingw* | *-*-pw32* | *-*-os2* | *-*-darwin* | *-cegcc*) 46030b661123Smrg # The PATH hackery in wrapper scripts is required on Windows 46040b661123Smrg # and Darwin in order for the loader to find any dlls it needs. 46050b661123Smrg func_warning "\`-no-install' is ignored for $host" 46060b661123Smrg func_warning "assuming \`-no-fast-install' instead" 46070b661123Smrg fast_install=no 46080b661123Smrg ;; 46090b661123Smrg *) no_install=yes ;; 46100b661123Smrg esac 46110b661123Smrg continue 46120b661123Smrg ;; 461372313efbSmrg 46140b661123Smrg -no-undefined) 46150b661123Smrg allow_undefined=no 46160b661123Smrg continue 46170b661123Smrg ;; 461872313efbSmrg 46190b661123Smrg -objectlist) 46200b661123Smrg prev=objectlist 46210b661123Smrg continue 46220b661123Smrg ;; 462372313efbSmrg 46240b661123Smrg -o) prev=output ;; 462572313efbSmrg 46260b661123Smrg -precious-files-regex) 46270b661123Smrg prev=precious_regex 46280b661123Smrg continue 46290b661123Smrg ;; 463072313efbSmrg 46310b661123Smrg -release) 46320b661123Smrg prev=release 46330b661123Smrg continue 46340b661123Smrg ;; 463572313efbSmrg 46360b661123Smrg -rpath) 46370b661123Smrg prev=rpath 46380b661123Smrg continue 46390b661123Smrg ;; 464072313efbSmrg 46410b661123Smrg -R) 46420b661123Smrg prev=xrpath 46430b661123Smrg continue 46440b661123Smrg ;; 464572313efbSmrg 46460b661123Smrg -R*) 46470b661123Smrg func_stripname '-R' '' "$arg" 46480b661123Smrg dir=$func_stripname_result 46490b661123Smrg # We need an absolute path. 46500b661123Smrg case $dir in 46510b661123Smrg [\\/]* | [A-Za-z]:[\\/]*) ;; 46520b661123Smrg *) 46530b661123Smrg func_fatal_error "only absolute run-paths are allowed" 46540b661123Smrg ;; 46550b661123Smrg esac 46560b661123Smrg case "$xrpath " in 46570b661123Smrg *" $dir "*) ;; 46580b661123Smrg *) xrpath="$xrpath $dir" ;; 46590b661123Smrg esac 46600b661123Smrg continue 46610b661123Smrg ;; 466272313efbSmrg 46630b661123Smrg -shared) 46640b661123Smrg # The effects of -shared are defined in a previous loop. 46650b661123Smrg continue 46660b661123Smrg ;; 466772313efbSmrg 46680b661123Smrg -shrext) 46690b661123Smrg prev=shrext 46700b661123Smrg continue 46710b661123Smrg ;; 467272313efbSmrg 46730b661123Smrg -static | -static-libtool-libs) 46740b661123Smrg # The effects of -static are defined in a previous loop. 46750b661123Smrg # We used to do the same as -all-static on platforms that 46760b661123Smrg # didn't have a PIC flag, but the assumption that the effects 46770b661123Smrg # would be equivalent was wrong. It would break on at least 46780b661123Smrg # Digital Unix and AIX. 46790b661123Smrg continue 46800b661123Smrg ;; 468172313efbSmrg 46820b661123Smrg -thread-safe) 46830b661123Smrg thread_safe=yes 46840b661123Smrg continue 46850b661123Smrg ;; 468672313efbSmrg 46870b661123Smrg -version-info) 46880b661123Smrg prev=vinfo 46890b661123Smrg continue 46900b661123Smrg ;; 469172313efbSmrg 46920b661123Smrg -version-number) 46930b661123Smrg prev=vinfo 46940b661123Smrg vinfo_number=yes 46950b661123Smrg continue 46960b661123Smrg ;; 469772313efbSmrg 46980b661123Smrg -weak) 46990b661123Smrg prev=weak 47000b661123Smrg continue 47010b661123Smrg ;; 4702bdcaa8d0Smrg 47030b661123Smrg -Wc,*) 47040b661123Smrg func_stripname '-Wc,' '' "$arg" 47050b661123Smrg args=$func_stripname_result 47060b661123Smrg arg= 47070b661123Smrg save_ifs="$IFS"; IFS=',' 47080b661123Smrg for flag in $args; do 47090b661123Smrg IFS="$save_ifs" 47100b661123Smrg func_quote_for_eval "$flag" 47110b661123Smrg arg="$arg $wl$func_quote_for_eval_result" 47120b661123Smrg compiler_flags="$compiler_flags $func_quote_for_eval_result" 47130b661123Smrg done 47140b661123Smrg IFS="$save_ifs" 47150b661123Smrg func_stripname ' ' '' "$arg" 47160b661123Smrg arg=$func_stripname_result 47170b661123Smrg ;; 471896ce994aSmrg 47190b661123Smrg -Wl,*) 47200b661123Smrg func_stripname '-Wl,' '' "$arg" 47210b661123Smrg args=$func_stripname_result 47220b661123Smrg arg= 47230b661123Smrg save_ifs="$IFS"; IFS=',' 47240b661123Smrg for flag in $args; do 47250b661123Smrg IFS="$save_ifs" 47260b661123Smrg func_quote_for_eval "$flag" 47270b661123Smrg arg="$arg $wl$func_quote_for_eval_result" 47280b661123Smrg compiler_flags="$compiler_flags $wl$func_quote_for_eval_result" 47290b661123Smrg linker_flags="$linker_flags $func_quote_for_eval_result" 47300b661123Smrg done 47310b661123Smrg IFS="$save_ifs" 47320b661123Smrg func_stripname ' ' '' "$arg" 47330b661123Smrg arg=$func_stripname_result 47340b661123Smrg ;; 473596ce994aSmrg 47360b661123Smrg -Xcompiler) 47370b661123Smrg prev=xcompiler 47380b661123Smrg continue 47390b661123Smrg ;; 474096ce994aSmrg 47410b661123Smrg -Xlinker) 47420b661123Smrg prev=xlinker 47430b661123Smrg continue 47440b661123Smrg ;; 474596ce994aSmrg 47460b661123Smrg -XCClinker) 47470b661123Smrg prev=xcclinker 47480b661123Smrg continue 47490b661123Smrg ;; 475096ce994aSmrg 47510b661123Smrg # -msg_* for osf cc 47520b661123Smrg -msg_*) 47530b661123Smrg func_quote_for_eval "$arg" 47540b661123Smrg arg="$func_quote_for_eval_result" 47550b661123Smrg ;; 475696ce994aSmrg 47570b661123Smrg # -64, -mips[0-9] enable 64-bit mode on the SGI compiler 47580b661123Smrg # -r[0-9][0-9]* specifies the processor on the SGI compiler 47590b661123Smrg # -xarch=*, -xtarget=* enable 64-bit mode on the Sun compiler 47600b661123Smrg # +DA*, +DD* enable 64-bit mode on the HP compiler 47610b661123Smrg # -q* pass through compiler args for the IBM compiler 47620b661123Smrg # -m*, -t[45]*, -txscale* pass through architecture-specific 47630b661123Smrg # compiler args for GCC 47640b661123Smrg # -F/path gives path to uninstalled frameworks, gcc on darwin 47650b661123Smrg # -p, -pg, --coverage, -fprofile-* pass through profiling flag for GCC 47660b661123Smrg # @file GCC response files 47670b661123Smrg -64|-mips[0-9]|-r[0-9][0-9]*|-xarch=*|-xtarget=*|+DA*|+DD*|-q*|-m*| \ 47680b661123Smrg -t[45]*|-txscale*|-p|-pg|--coverage|-fprofile-*|-F*|@*) 47690b661123Smrg func_quote_for_eval "$arg" 47700b661123Smrg arg="$func_quote_for_eval_result" 47710b661123Smrg func_append compile_command " $arg" 47720b661123Smrg func_append finalize_command " $arg" 47730b661123Smrg compiler_flags="$compiler_flags $arg" 47740b661123Smrg continue 47750b661123Smrg ;; 477696ce994aSmrg 47770b661123Smrg # Some other compiler flag. 47780b661123Smrg -* | +*) 47790b661123Smrg func_quote_for_eval "$arg" 47800b661123Smrg arg="$func_quote_for_eval_result" 47810b661123Smrg ;; 478296ce994aSmrg 47830b661123Smrg *.$objext) 47840b661123Smrg # A standard object. 47850b661123Smrg objs="$objs $arg" 47860b661123Smrg ;; 478796ce994aSmrg 47880b661123Smrg *.lo) 47890b661123Smrg # A libtool-controlled object. 479096ce994aSmrg 47910b661123Smrg # Check to see that this really is a libtool object. 47920b661123Smrg if func_lalib_unsafe_p "$arg"; then 47930b661123Smrg pic_object= 47940b661123Smrg non_pic_object= 479596ce994aSmrg 47960b661123Smrg # Read the .lo file 47970b661123Smrg func_source "$arg" 479896ce994aSmrg 47990b661123Smrg if test -z "$pic_object" || 48000b661123Smrg test -z "$non_pic_object" || 48010b661123Smrg test "$pic_object" = none && 48020b661123Smrg test "$non_pic_object" = none; then 48030b661123Smrg func_fatal_error "cannot find name of object for \`$arg'" 48040b661123Smrg fi 480596ce994aSmrg 48060b661123Smrg # Extract subdirectory from the argument. 48070b661123Smrg func_dirname "$arg" "/" "" 48080b661123Smrg xdir="$func_dirname_result" 480996ce994aSmrg 48100b661123Smrg if test "$pic_object" != none; then 48110b661123Smrg # Prepend the subdirectory the object is found in. 48120b661123Smrg pic_object="$xdir$pic_object" 481396ce994aSmrg 48140b661123Smrg if test "$prev" = dlfiles; then 48150b661123Smrg if test "$build_libtool_libs" = yes && test "$dlopen_support" = yes; then 48160b661123Smrg dlfiles="$dlfiles $pic_object" 48170b661123Smrg prev= 48180b661123Smrg continue 48190b661123Smrg else 48200b661123Smrg # If libtool objects are unsupported, then we need to preload. 48210b661123Smrg prev=dlprefiles 48220b661123Smrg fi 48230b661123Smrg fi 482496ce994aSmrg 48250b661123Smrg # CHECK ME: I think I busted this. -Ossama 48260b661123Smrg if test "$prev" = dlprefiles; then 48270b661123Smrg # Preload the old-style object. 48280b661123Smrg dlprefiles="$dlprefiles $pic_object" 48290b661123Smrg prev= 48300b661123Smrg fi 4831bdcaa8d0Smrg 48320b661123Smrg # A PIC object. 48330b661123Smrg func_append libobjs " $pic_object" 48340b661123Smrg arg="$pic_object" 48350b661123Smrg fi 4836bdcaa8d0Smrg 48370b661123Smrg # Non-PIC object. 48380b661123Smrg if test "$non_pic_object" != none; then 48390b661123Smrg # Prepend the subdirectory the object is found in. 48400b661123Smrg non_pic_object="$xdir$non_pic_object" 4841bdcaa8d0Smrg 48420b661123Smrg # A standard non-PIC object 48430b661123Smrg func_append non_pic_objects " $non_pic_object" 48440b661123Smrg if test -z "$pic_object" || test "$pic_object" = none ; then 48450b661123Smrg arg="$non_pic_object" 48460b661123Smrg fi 48470b661123Smrg else 48480b661123Smrg # If the PIC object exists, use it instead. 48490b661123Smrg # $xdir was prepended to $pic_object above. 48500b661123Smrg non_pic_object="$pic_object" 48510b661123Smrg func_append non_pic_objects " $non_pic_object" 48520b661123Smrg fi 48530b661123Smrg else 48540b661123Smrg # Only an error if not doing a dry-run. 48550b661123Smrg if $opt_dry_run; then 48560b661123Smrg # Extract subdirectory from the argument. 48570b661123Smrg func_dirname "$arg" "/" "" 48580b661123Smrg xdir="$func_dirname_result" 48590b661123Smrg 48600b661123Smrg func_lo2o "$arg" 48610b661123Smrg pic_object=$xdir$objdir/$func_lo2o_result 48620b661123Smrg non_pic_object=$xdir$func_lo2o_result 48630b661123Smrg func_append libobjs " $pic_object" 48640b661123Smrg func_append non_pic_objects " $non_pic_object" 48650b661123Smrg else 48660b661123Smrg func_fatal_error "\`$arg' is not a valid libtool object" 48670b661123Smrg fi 48680b661123Smrg fi 48690b661123Smrg ;; 4870bdcaa8d0Smrg 48710b661123Smrg *.$libext) 48720b661123Smrg # An archive. 48730b661123Smrg deplibs="$deplibs $arg" 48740b661123Smrg old_deplibs="$old_deplibs $arg" 48750b661123Smrg continue 48760b661123Smrg ;; 48770b661123Smrg 48780b661123Smrg *.la) 48790b661123Smrg # A libtool-controlled library. 48800b661123Smrg 48810b661123Smrg if test "$prev" = dlfiles; then 48820b661123Smrg # This library was specified with -dlopen. 48830b661123Smrg dlfiles="$dlfiles $arg" 48840b661123Smrg prev= 48850b661123Smrg elif test "$prev" = dlprefiles; then 48860b661123Smrg # The library was specified with -dlpreopen. 48870b661123Smrg dlprefiles="$dlprefiles $arg" 48880b661123Smrg prev= 48890b661123Smrg else 48900b661123Smrg deplibs="$deplibs $arg" 48910b661123Smrg fi 48920b661123Smrg continue 48930b661123Smrg ;; 48940b661123Smrg 48950b661123Smrg # Some other compiler argument. 48960b661123Smrg *) 48970b661123Smrg # Unknown arguments in both finalize_command and compile_command need 48980b661123Smrg # to be aesthetically quoted because they are evaled later. 48990b661123Smrg func_quote_for_eval "$arg" 49000b661123Smrg arg="$func_quote_for_eval_result" 49010b661123Smrg ;; 49020b661123Smrg esac # arg 49030b661123Smrg 49040b661123Smrg # Now actually substitute the argument into the commands. 49050b661123Smrg if test -n "$arg"; then 49060b661123Smrg func_append compile_command " $arg" 49070b661123Smrg func_append finalize_command " $arg" 49080b661123Smrg fi 49090b661123Smrg done # argument parsing loop 49100b661123Smrg 49110b661123Smrg test -n "$prev" && \ 49120b661123Smrg func_fatal_help "the \`$prevarg' option requires an argument" 49130b661123Smrg 49140b661123Smrg if test "$export_dynamic" = yes && test -n "$export_dynamic_flag_spec"; then 49150b661123Smrg eval arg=\"$export_dynamic_flag_spec\" 49160b661123Smrg func_append compile_command " $arg" 49170b661123Smrg func_append finalize_command " $arg" 49180b661123Smrg fi 49190b661123Smrg 49200b661123Smrg oldlibs= 49210b661123Smrg # calculate the name of the file, without its directory 49220b661123Smrg func_basename "$output" 49230b661123Smrg outputname="$func_basename_result" 49240b661123Smrg libobjs_save="$libobjs" 49250b661123Smrg 49260b661123Smrg if test -n "$shlibpath_var"; then 49270b661123Smrg # get the directories listed in $shlibpath_var 49280b661123Smrg eval shlib_search_path=\`\$ECHO \"X\${$shlibpath_var}\" \| \$Xsed -e \'s/:/ /g\'\` 49290b661123Smrg else 49300b661123Smrg shlib_search_path= 49310b661123Smrg fi 49320b661123Smrg eval sys_lib_search_path=\"$sys_lib_search_path_spec\" 49330b661123Smrg eval sys_lib_dlsearch_path=\"$sys_lib_dlsearch_path_spec\" 49340b661123Smrg 49350b661123Smrg func_dirname "$output" "/" "" 49360b661123Smrg output_objdir="$func_dirname_result$objdir" 49370b661123Smrg # Create the object directory. 49380b661123Smrg func_mkdir_p "$output_objdir" 49390b661123Smrg 49400b661123Smrg # Determine the type of output 49410b661123Smrg case $output in 49420b661123Smrg "") 49430b661123Smrg func_fatal_help "you must specify an output file" 49440b661123Smrg ;; 49450b661123Smrg *.$libext) linkmode=oldlib ;; 49460b661123Smrg *.lo | *.$objext) linkmode=obj ;; 49470b661123Smrg *.la) linkmode=lib ;; 49480b661123Smrg *) linkmode=prog ;; # Anything else should be a program. 49490b661123Smrg esac 49500b661123Smrg 49510b661123Smrg specialdeplibs= 49520b661123Smrg 49530b661123Smrg libs= 49540b661123Smrg # Find all interdependent deplibs by searching for libraries 49550b661123Smrg # that are linked more than once (e.g. -la -lb -la) 49560b661123Smrg for deplib in $deplibs; do 49570b661123Smrg if $opt_duplicate_deps ; then 49580b661123Smrg case "$libs " in 49590b661123Smrg *" $deplib "*) specialdeplibs="$specialdeplibs $deplib" ;; 49600b661123Smrg esac 49610b661123Smrg fi 49620b661123Smrg libs="$libs $deplib" 49630b661123Smrg done 49640b661123Smrg 49650b661123Smrg if test "$linkmode" = lib; then 49660b661123Smrg libs="$predeps $libs $compiler_lib_search_path $postdeps" 49670b661123Smrg 49680b661123Smrg # Compute libraries that are listed more than once in $predeps 49690b661123Smrg # $postdeps and mark them as special (i.e., whose duplicates are 49700b661123Smrg # not to be eliminated). 49710b661123Smrg pre_post_deps= 49720b661123Smrg if $opt_duplicate_compiler_generated_deps; then 49730b661123Smrg for pre_post_dep in $predeps $postdeps; do 49740b661123Smrg case "$pre_post_deps " in 49750b661123Smrg *" $pre_post_dep "*) specialdeplibs="$specialdeplibs $pre_post_deps" ;; 49760b661123Smrg esac 49770b661123Smrg pre_post_deps="$pre_post_deps $pre_post_dep" 49780b661123Smrg done 49790b661123Smrg fi 49800b661123Smrg pre_post_deps= 49810b661123Smrg fi 49820b661123Smrg 49830b661123Smrg deplibs= 49840b661123Smrg newdependency_libs= 49850b661123Smrg newlib_search_path= 49860b661123Smrg need_relink=no # whether we're linking any uninstalled libtool libraries 49870b661123Smrg notinst_deplibs= # not-installed libtool libraries 49880b661123Smrg notinst_path= # paths that contain not-installed libtool libraries 49890b661123Smrg 49900b661123Smrg case $linkmode in 49910b661123Smrg lib) 49920b661123Smrg passes="conv dlpreopen link" 49930b661123Smrg for file in $dlfiles $dlprefiles; do 49940b661123Smrg case $file in 49950b661123Smrg *.la) ;; 49960b661123Smrg *) 49970b661123Smrg func_fatal_help "libraries can \`-dlopen' only libtool libraries: $file" 49980b661123Smrg ;; 49990b661123Smrg esac 50000b661123Smrg done 50010b661123Smrg ;; 50020b661123Smrg prog) 50030b661123Smrg compile_deplibs= 50040b661123Smrg finalize_deplibs= 50050b661123Smrg alldeplibs=no 50060b661123Smrg newdlfiles= 50070b661123Smrg newdlprefiles= 50080b661123Smrg passes="conv scan dlopen dlpreopen link" 50090b661123Smrg ;; 50100b661123Smrg *) passes="conv" 50110b661123Smrg ;; 50120b661123Smrg esac 50130b661123Smrg 50140b661123Smrg for pass in $passes; do 50150b661123Smrg # The preopen pass in lib mode reverses $deplibs; put it back here 50160b661123Smrg # so that -L comes before libs that need it for instance... 50170b661123Smrg if test "$linkmode,$pass" = "lib,link"; then 50180b661123Smrg ## FIXME: Find the place where the list is rebuilt in the wrong 50190b661123Smrg ## order, and fix it there properly 50200b661123Smrg tmp_deplibs= 50210b661123Smrg for deplib in $deplibs; do 50220b661123Smrg tmp_deplibs="$deplib $tmp_deplibs" 50230b661123Smrg done 50240b661123Smrg deplibs="$tmp_deplibs" 50250b661123Smrg fi 50260b661123Smrg 50270b661123Smrg if test "$linkmode,$pass" = "lib,link" || 50280b661123Smrg test "$linkmode,$pass" = "prog,scan"; then 50290b661123Smrg libs="$deplibs" 50300b661123Smrg deplibs= 50310b661123Smrg fi 50320b661123Smrg if test "$linkmode" = prog; then 50330b661123Smrg case $pass in 50340b661123Smrg dlopen) libs="$dlfiles" ;; 50350b661123Smrg dlpreopen) libs="$dlprefiles" ;; 50360b661123Smrg link) libs="$deplibs %DEPLIBS% $dependency_libs" ;; 50370b661123Smrg esac 50380b661123Smrg fi 50390b661123Smrg if test "$linkmode,$pass" = "lib,dlpreopen"; then 50400b661123Smrg # Collect and forward deplibs of preopened libtool libs 50410b661123Smrg for lib in $dlprefiles; do 50420b661123Smrg # Ignore non-libtool-libs 50430b661123Smrg dependency_libs= 50440b661123Smrg case $lib in 50450b661123Smrg *.la) func_source "$lib" ;; 50460b661123Smrg esac 50470b661123Smrg 50480b661123Smrg # Collect preopened libtool deplibs, except any this library 50490b661123Smrg # has declared as weak libs 50500b661123Smrg for deplib in $dependency_libs; do 50510b661123Smrg deplib_base=`$ECHO "X$deplib" | $Xsed -e "$basename"` 50520b661123Smrg case " $weak_libs " in 50530b661123Smrg *" $deplib_base "*) ;; 50540b661123Smrg *) deplibs="$deplibs $deplib" ;; 50550b661123Smrg esac 50560b661123Smrg done 50570b661123Smrg done 50580b661123Smrg libs="$dlprefiles" 50590b661123Smrg fi 50600b661123Smrg if test "$pass" = dlopen; then 50610b661123Smrg # Collect dlpreopened libraries 50620b661123Smrg save_deplibs="$deplibs" 50630b661123Smrg deplibs= 50640b661123Smrg fi 50650b661123Smrg 50660b661123Smrg for deplib in $libs; do 50670b661123Smrg lib= 50680b661123Smrg found=no 50690b661123Smrg case $deplib in 50700b661123Smrg -mt|-mthreads|-kthread|-Kthread|-pthread|-pthreads|--thread-safe|-threads) 50710b661123Smrg if test "$linkmode,$pass" = "prog,link"; then 50720b661123Smrg compile_deplibs="$deplib $compile_deplibs" 50730b661123Smrg finalize_deplibs="$deplib $finalize_deplibs" 50740b661123Smrg else 50750b661123Smrg compiler_flags="$compiler_flags $deplib" 50760b661123Smrg if test "$linkmode" = lib ; then 50770b661123Smrg case "$new_inherited_linker_flags " in 50780b661123Smrg *" $deplib "*) ;; 50790b661123Smrg * ) new_inherited_linker_flags="$new_inherited_linker_flags $deplib" ;; 50800b661123Smrg esac 50810b661123Smrg fi 50820b661123Smrg fi 50830b661123Smrg continue 50840b661123Smrg ;; 50850b661123Smrg -l*) 50860b661123Smrg if test "$linkmode" != lib && test "$linkmode" != prog; then 50870b661123Smrg func_warning "\`-l' is ignored for archives/objects" 50880b661123Smrg continue 50890b661123Smrg fi 50900b661123Smrg func_stripname '-l' '' "$deplib" 50910b661123Smrg name=$func_stripname_result 50920b661123Smrg if test "$linkmode" = lib; then 50930b661123Smrg searchdirs="$newlib_search_path $lib_search_path $compiler_lib_search_dirs $sys_lib_search_path $shlib_search_path" 50940b661123Smrg else 50950b661123Smrg searchdirs="$newlib_search_path $lib_search_path $sys_lib_search_path $shlib_search_path" 50960b661123Smrg fi 50970b661123Smrg for searchdir in $searchdirs; do 50980b661123Smrg for search_ext in .la $std_shrext .so .a; do 50990b661123Smrg # Search the libtool library 51000b661123Smrg lib="$searchdir/lib${name}${search_ext}" 51010b661123Smrg if test -f "$lib"; then 51020b661123Smrg if test "$search_ext" = ".la"; then 51030b661123Smrg found=yes 51040b661123Smrg else 51050b661123Smrg found=no 51060b661123Smrg fi 51070b661123Smrg break 2 51080b661123Smrg fi 51090b661123Smrg done 51100b661123Smrg done 51110b661123Smrg if test "$found" != yes; then 51120b661123Smrg # deplib doesn't seem to be a libtool library 51130b661123Smrg if test "$linkmode,$pass" = "prog,link"; then 51140b661123Smrg compile_deplibs="$deplib $compile_deplibs" 51150b661123Smrg finalize_deplibs="$deplib $finalize_deplibs" 51160b661123Smrg else 51170b661123Smrg deplibs="$deplib $deplibs" 51180b661123Smrg test "$linkmode" = lib && newdependency_libs="$deplib $newdependency_libs" 51190b661123Smrg fi 51200b661123Smrg continue 51210b661123Smrg else # deplib is a libtool library 51220b661123Smrg # If $allow_libtool_libs_with_static_runtimes && $deplib is a stdlib, 51230b661123Smrg # We need to do some special things here, and not later. 51240b661123Smrg if test "X$allow_libtool_libs_with_static_runtimes" = "Xyes" ; then 51250b661123Smrg case " $predeps $postdeps " in 51260b661123Smrg *" $deplib "*) 51270b661123Smrg if func_lalib_p "$lib"; then 51280b661123Smrg library_names= 51290b661123Smrg old_library= 51300b661123Smrg func_source "$lib" 51310b661123Smrg for l in $old_library $library_names; do 51320b661123Smrg ll="$l" 51330b661123Smrg done 51340b661123Smrg if test "X$ll" = "X$old_library" ; then # only static version available 51350b661123Smrg found=no 51360b661123Smrg func_dirname "$lib" "" "." 51370b661123Smrg ladir="$func_dirname_result" 51380b661123Smrg lib=$ladir/$old_library 51390b661123Smrg if test "$linkmode,$pass" = "prog,link"; then 51400b661123Smrg compile_deplibs="$deplib $compile_deplibs" 51410b661123Smrg finalize_deplibs="$deplib $finalize_deplibs" 51420b661123Smrg else 51430b661123Smrg deplibs="$deplib $deplibs" 51440b661123Smrg test "$linkmode" = lib && newdependency_libs="$deplib $newdependency_libs" 51450b661123Smrg fi 51460b661123Smrg continue 51470b661123Smrg fi 51480b661123Smrg fi 51490b661123Smrg ;; 51500b661123Smrg *) ;; 51510b661123Smrg esac 51520b661123Smrg fi 51530b661123Smrg fi 51540b661123Smrg ;; # -l 51550b661123Smrg *.ltframework) 51560b661123Smrg if test "$linkmode,$pass" = "prog,link"; then 51570b661123Smrg compile_deplibs="$deplib $compile_deplibs" 51580b661123Smrg finalize_deplibs="$deplib $finalize_deplibs" 51590b661123Smrg else 51600b661123Smrg deplibs="$deplib $deplibs" 51610b661123Smrg if test "$linkmode" = lib ; then 51620b661123Smrg case "$new_inherited_linker_flags " in 51630b661123Smrg *" $deplib "*) ;; 51640b661123Smrg * ) new_inherited_linker_flags="$new_inherited_linker_flags $deplib" ;; 51650b661123Smrg esac 51660b661123Smrg fi 51670b661123Smrg fi 51680b661123Smrg continue 51690b661123Smrg ;; 51700b661123Smrg -L*) 51710b661123Smrg case $linkmode in 51720b661123Smrg lib) 51730b661123Smrg deplibs="$deplib $deplibs" 51740b661123Smrg test "$pass" = conv && continue 51750b661123Smrg newdependency_libs="$deplib $newdependency_libs" 51760b661123Smrg func_stripname '-L' '' "$deplib" 51770b661123Smrg newlib_search_path="$newlib_search_path $func_stripname_result" 51780b661123Smrg ;; 51790b661123Smrg prog) 51800b661123Smrg if test "$pass" = conv; then 51810b661123Smrg deplibs="$deplib $deplibs" 51820b661123Smrg continue 51830b661123Smrg fi 51840b661123Smrg if test "$pass" = scan; then 51850b661123Smrg deplibs="$deplib $deplibs" 51860b661123Smrg else 51870b661123Smrg compile_deplibs="$deplib $compile_deplibs" 51880b661123Smrg finalize_deplibs="$deplib $finalize_deplibs" 51890b661123Smrg fi 51900b661123Smrg func_stripname '-L' '' "$deplib" 51910b661123Smrg newlib_search_path="$newlib_search_path $func_stripname_result" 51920b661123Smrg ;; 51930b661123Smrg *) 51940b661123Smrg func_warning "\`-L' is ignored for archives/objects" 51950b661123Smrg ;; 51960b661123Smrg esac # linkmode 51970b661123Smrg continue 51980b661123Smrg ;; # -L 51990b661123Smrg -R*) 52000b661123Smrg if test "$pass" = link; then 52010b661123Smrg func_stripname '-R' '' "$deplib" 52020b661123Smrg dir=$func_stripname_result 52030b661123Smrg # Make sure the xrpath contains only unique directories. 52040b661123Smrg case "$xrpath " in 52050b661123Smrg *" $dir "*) ;; 52060b661123Smrg *) xrpath="$xrpath $dir" ;; 52070b661123Smrg esac 52080b661123Smrg fi 52090b661123Smrg deplibs="$deplib $deplibs" 52100b661123Smrg continue 52110b661123Smrg ;; 52120b661123Smrg *.la) lib="$deplib" ;; 52130b661123Smrg *.$libext) 52140b661123Smrg if test "$pass" = conv; then 52150b661123Smrg deplibs="$deplib $deplibs" 52160b661123Smrg continue 52170b661123Smrg fi 52180b661123Smrg case $linkmode in 52190b661123Smrg lib) 52200b661123Smrg # Linking convenience modules into shared libraries is allowed, 52210b661123Smrg # but linking other static libraries is non-portable. 52220b661123Smrg case " $dlpreconveniencelibs " in 52230b661123Smrg *" $deplib "*) ;; 52240b661123Smrg *) 52250b661123Smrg valid_a_lib=no 52260b661123Smrg case $deplibs_check_method in 52270b661123Smrg match_pattern*) 52280b661123Smrg set dummy $deplibs_check_method; shift 52290b661123Smrg match_pattern_regex=`expr "$deplibs_check_method" : "$1 \(.*\)"` 52300b661123Smrg if eval "\$ECHO \"X$deplib\"" 2>/dev/null | $Xsed -e 10q \ 52310b661123Smrg | $EGREP "$match_pattern_regex" > /dev/null; then 52320b661123Smrg valid_a_lib=yes 52330b661123Smrg fi 52340b661123Smrg ;; 52350b661123Smrg pass_all) 52360b661123Smrg valid_a_lib=yes 52370b661123Smrg ;; 52380b661123Smrg esac 52390b661123Smrg if test "$valid_a_lib" != yes; then 52400b661123Smrg $ECHO 52410b661123Smrg $ECHO "*** Warning: Trying to link with static lib archive $deplib." 52420b661123Smrg $ECHO "*** I have the capability to make that library automatically link in when" 52430b661123Smrg $ECHO "*** you link to this library. But I can only do this if you have a" 52440b661123Smrg $ECHO "*** shared version of the library, which you do not appear to have" 52450b661123Smrg $ECHO "*** because the file extensions .$libext of this argument makes me believe" 52460b661123Smrg $ECHO "*** that it is just a static archive that I should not use here." 52470b661123Smrg else 52480b661123Smrg $ECHO 52490b661123Smrg $ECHO "*** Warning: Linking the shared library $output against the" 52500b661123Smrg $ECHO "*** static library $deplib is not portable!" 52510b661123Smrg deplibs="$deplib $deplibs" 52520b661123Smrg fi 52530b661123Smrg ;; 52540b661123Smrg esac 52550b661123Smrg continue 52560b661123Smrg ;; 52570b661123Smrg prog) 52580b661123Smrg if test "$pass" != link; then 52590b661123Smrg deplibs="$deplib $deplibs" 52600b661123Smrg else 52610b661123Smrg compile_deplibs="$deplib $compile_deplibs" 52620b661123Smrg finalize_deplibs="$deplib $finalize_deplibs" 52630b661123Smrg fi 52640b661123Smrg continue 52650b661123Smrg ;; 52660b661123Smrg esac # linkmode 52670b661123Smrg ;; # *.$libext 52680b661123Smrg *.lo | *.$objext) 52690b661123Smrg if test "$pass" = conv; then 52700b661123Smrg deplibs="$deplib $deplibs" 52710b661123Smrg elif test "$linkmode" = prog; then 52720b661123Smrg if test "$pass" = dlpreopen || test "$dlopen_support" != yes || test "$build_libtool_libs" = no; then 52730b661123Smrg # If there is no dlopen support or we're linking statically, 52740b661123Smrg # we need to preload. 52750b661123Smrg newdlprefiles="$newdlprefiles $deplib" 52760b661123Smrg compile_deplibs="$deplib $compile_deplibs" 52770b661123Smrg finalize_deplibs="$deplib $finalize_deplibs" 52780b661123Smrg else 52790b661123Smrg newdlfiles="$newdlfiles $deplib" 52800b661123Smrg fi 52810b661123Smrg fi 52820b661123Smrg continue 52830b661123Smrg ;; 52840b661123Smrg %DEPLIBS%) 52850b661123Smrg alldeplibs=yes 52860b661123Smrg continue 52870b661123Smrg ;; 52880b661123Smrg esac # case $deplib 52890b661123Smrg 52900b661123Smrg if test "$found" = yes || test -f "$lib"; then : 52910b661123Smrg else 52920b661123Smrg func_fatal_error "cannot find the library \`$lib' or unhandled argument \`$deplib'" 52930b661123Smrg fi 52940b661123Smrg 52950b661123Smrg # Check to see that this really is a libtool archive. 52960b661123Smrg func_lalib_unsafe_p "$lib" \ 52970b661123Smrg || func_fatal_error "\`$lib' is not a valid libtool archive" 52980b661123Smrg 52990b661123Smrg func_dirname "$lib" "" "." 53000b661123Smrg ladir="$func_dirname_result" 53010b661123Smrg 53020b661123Smrg dlname= 53030b661123Smrg dlopen= 53040b661123Smrg dlpreopen= 53050b661123Smrg libdir= 53060b661123Smrg library_names= 53070b661123Smrg old_library= 53080b661123Smrg inherited_linker_flags= 53090b661123Smrg # If the library was installed with an old release of libtool, 53100b661123Smrg # it will not redefine variables installed, or shouldnotlink 53110b661123Smrg installed=yes 53120b661123Smrg shouldnotlink=no 53130b661123Smrg avoidtemprpath= 53140b661123Smrg 53150b661123Smrg 53160b661123Smrg # Read the .la file 53170b661123Smrg func_source "$lib" 53180b661123Smrg 53190b661123Smrg # Convert "-framework foo" to "foo.ltframework" 53200b661123Smrg if test -n "$inherited_linker_flags"; then 53210b661123Smrg tmp_inherited_linker_flags=`$ECHO "X$inherited_linker_flags" | $Xsed -e 's/-framework \([^ $]*\)/\1.ltframework/g'` 53220b661123Smrg for tmp_inherited_linker_flag in $tmp_inherited_linker_flags; do 53230b661123Smrg case " $new_inherited_linker_flags " in 53240b661123Smrg *" $tmp_inherited_linker_flag "*) ;; 53250b661123Smrg *) new_inherited_linker_flags="$new_inherited_linker_flags $tmp_inherited_linker_flag";; 53260b661123Smrg esac 53270b661123Smrg done 53280b661123Smrg fi 53290b661123Smrg dependency_libs=`$ECHO "X $dependency_libs" | $Xsed -e 's% \([^ $]*\).ltframework% -framework \1%g'` 53300b661123Smrg if test "$linkmode,$pass" = "lib,link" || 53310b661123Smrg test "$linkmode,$pass" = "prog,scan" || 53320b661123Smrg { test "$linkmode" != prog && test "$linkmode" != lib; }; then 53330b661123Smrg test -n "$dlopen" && dlfiles="$dlfiles $dlopen" 53340b661123Smrg test -n "$dlpreopen" && dlprefiles="$dlprefiles $dlpreopen" 53350b661123Smrg fi 53360b661123Smrg 53370b661123Smrg if test "$pass" = conv; then 53380b661123Smrg # Only check for convenience libraries 53390b661123Smrg deplibs="$lib $deplibs" 53400b661123Smrg if test -z "$libdir"; then 53410b661123Smrg if test -z "$old_library"; then 53420b661123Smrg func_fatal_error "cannot find name of link library for \`$lib'" 53430b661123Smrg fi 53440b661123Smrg # It is a libtool convenience library, so add in its objects. 53450b661123Smrg convenience="$convenience $ladir/$objdir/$old_library" 53460b661123Smrg old_convenience="$old_convenience $ladir/$objdir/$old_library" 53470b661123Smrg elif test "$linkmode" != prog && test "$linkmode" != lib; then 53480b661123Smrg func_fatal_error "\`$lib' is not a convenience library" 53490b661123Smrg fi 53500b661123Smrg tmp_libs= 53510b661123Smrg for deplib in $dependency_libs; do 53520b661123Smrg deplibs="$deplib $deplibs" 53530b661123Smrg if $opt_duplicate_deps ; then 53540b661123Smrg case "$tmp_libs " in 53550b661123Smrg *" $deplib "*) specialdeplibs="$specialdeplibs $deplib" ;; 53560b661123Smrg esac 53570b661123Smrg fi 53580b661123Smrg tmp_libs="$tmp_libs $deplib" 53590b661123Smrg done 53600b661123Smrg continue 53610b661123Smrg fi # $pass = conv 53620b661123Smrg 53630b661123Smrg 53640b661123Smrg # Get the name of the library we link against. 53650b661123Smrg linklib= 53660b661123Smrg for l in $old_library $library_names; do 53670b661123Smrg linklib="$l" 53680b661123Smrg done 53690b661123Smrg if test -z "$linklib"; then 53700b661123Smrg func_fatal_error "cannot find name of link library for \`$lib'" 53710b661123Smrg fi 53720b661123Smrg 53730b661123Smrg # This library was specified with -dlopen. 53740b661123Smrg if test "$pass" = dlopen; then 53750b661123Smrg if test -z "$libdir"; then 53760b661123Smrg func_fatal_error "cannot -dlopen a convenience library: \`$lib'" 53770b661123Smrg fi 53780b661123Smrg if test -z "$dlname" || 53790b661123Smrg test "$dlopen_support" != yes || 53800b661123Smrg test "$build_libtool_libs" = no; then 53810b661123Smrg # If there is no dlname, no dlopen support or we're linking 53820b661123Smrg # statically, we need to preload. We also need to preload any 53830b661123Smrg # dependent libraries so libltdl's deplib preloader doesn't 53840b661123Smrg # bomb out in the load deplibs phase. 53850b661123Smrg dlprefiles="$dlprefiles $lib $dependency_libs" 53860b661123Smrg else 53870b661123Smrg newdlfiles="$newdlfiles $lib" 53880b661123Smrg fi 53890b661123Smrg continue 53900b661123Smrg fi # $pass = dlopen 53910b661123Smrg 53920b661123Smrg # We need an absolute path. 53930b661123Smrg case $ladir in 53940b661123Smrg [\\/]* | [A-Za-z]:[\\/]*) abs_ladir="$ladir" ;; 53950b661123Smrg *) 53960b661123Smrg abs_ladir=`cd "$ladir" && pwd` 53970b661123Smrg if test -z "$abs_ladir"; then 53980b661123Smrg func_warning "cannot determine absolute directory name of \`$ladir'" 53990b661123Smrg func_warning "passing it literally to the linker, although it might fail" 54000b661123Smrg abs_ladir="$ladir" 54010b661123Smrg fi 54020b661123Smrg ;; 54030b661123Smrg esac 54040b661123Smrg func_basename "$lib" 54050b661123Smrg laname="$func_basename_result" 54060b661123Smrg 54070b661123Smrg # Find the relevant object directory and library name. 54080b661123Smrg if test "X$installed" = Xyes; then 54090b661123Smrg if test ! -f "$libdir/$linklib" && test -f "$abs_ladir/$linklib"; then 54100b661123Smrg func_warning "library \`$lib' was moved." 54110b661123Smrg dir="$ladir" 54120b661123Smrg absdir="$abs_ladir" 54130b661123Smrg libdir="$abs_ladir" 54140b661123Smrg else 54150b661123Smrg dir="$libdir" 54160b661123Smrg absdir="$libdir" 54170b661123Smrg fi 54180b661123Smrg test "X$hardcode_automatic" = Xyes && avoidtemprpath=yes 54190b661123Smrg else 54200b661123Smrg if test ! -f "$ladir/$objdir/$linklib" && test -f "$abs_ladir/$linklib"; then 54210b661123Smrg dir="$ladir" 54220b661123Smrg absdir="$abs_ladir" 54230b661123Smrg # Remove this search path later 54240b661123Smrg notinst_path="$notinst_path $abs_ladir" 54250b661123Smrg else 54260b661123Smrg dir="$ladir/$objdir" 54270b661123Smrg absdir="$abs_ladir/$objdir" 54280b661123Smrg # Remove this search path later 54290b661123Smrg notinst_path="$notinst_path $abs_ladir" 54300b661123Smrg fi 54310b661123Smrg fi # $installed = yes 54320b661123Smrg func_stripname 'lib' '.la' "$laname" 54330b661123Smrg name=$func_stripname_result 54340b661123Smrg 54350b661123Smrg # This library was specified with -dlpreopen. 54360b661123Smrg if test "$pass" = dlpreopen; then 54370b661123Smrg if test -z "$libdir" && test "$linkmode" = prog; then 54380b661123Smrg func_fatal_error "only libraries may -dlpreopen a convenience library: \`$lib'" 54390b661123Smrg fi 54400b661123Smrg # Prefer using a static library (so that no silly _DYNAMIC symbols 54410b661123Smrg # are required to link). 54420b661123Smrg if test -n "$old_library"; then 54430b661123Smrg newdlprefiles="$newdlprefiles $dir/$old_library" 54440b661123Smrg # Keep a list of preopened convenience libraries to check 54450b661123Smrg # that they are being used correctly in the link pass. 54460b661123Smrg test -z "$libdir" && \ 54470b661123Smrg dlpreconveniencelibs="$dlpreconveniencelibs $dir/$old_library" 54480b661123Smrg # Otherwise, use the dlname, so that lt_dlopen finds it. 54490b661123Smrg elif test -n "$dlname"; then 54500b661123Smrg newdlprefiles="$newdlprefiles $dir/$dlname" 54510b661123Smrg else 54520b661123Smrg newdlprefiles="$newdlprefiles $dir/$linklib" 54530b661123Smrg fi 54540b661123Smrg fi # $pass = dlpreopen 54550b661123Smrg 54560b661123Smrg if test -z "$libdir"; then 54570b661123Smrg # Link the convenience library 54580b661123Smrg if test "$linkmode" = lib; then 54590b661123Smrg deplibs="$dir/$old_library $deplibs" 54600b661123Smrg elif test "$linkmode,$pass" = "prog,link"; then 54610b661123Smrg compile_deplibs="$dir/$old_library $compile_deplibs" 54620b661123Smrg finalize_deplibs="$dir/$old_library $finalize_deplibs" 54630b661123Smrg else 54640b661123Smrg deplibs="$lib $deplibs" # used for prog,scan pass 54650b661123Smrg fi 54660b661123Smrg continue 54670b661123Smrg fi 54680b661123Smrg 54690b661123Smrg 54700b661123Smrg if test "$linkmode" = prog && test "$pass" != link; then 54710b661123Smrg newlib_search_path="$newlib_search_path $ladir" 54720b661123Smrg deplibs="$lib $deplibs" 54730b661123Smrg 54740b661123Smrg linkalldeplibs=no 54750b661123Smrg if test "$link_all_deplibs" != no || test -z "$library_names" || 54760b661123Smrg test "$build_libtool_libs" = no; then 54770b661123Smrg linkalldeplibs=yes 54780b661123Smrg fi 54790b661123Smrg 54800b661123Smrg tmp_libs= 54810b661123Smrg for deplib in $dependency_libs; do 54820b661123Smrg case $deplib in 54830b661123Smrg -L*) func_stripname '-L' '' "$deplib" 54840b661123Smrg newlib_search_path="$newlib_search_path $func_stripname_result" 54850b661123Smrg ;; 54860b661123Smrg esac 54870b661123Smrg # Need to link against all dependency_libs? 54880b661123Smrg if test "$linkalldeplibs" = yes; then 54890b661123Smrg deplibs="$deplib $deplibs" 54900b661123Smrg else 54910b661123Smrg # Need to hardcode shared library paths 54920b661123Smrg # or/and link against static libraries 54930b661123Smrg newdependency_libs="$deplib $newdependency_libs" 54940b661123Smrg fi 54950b661123Smrg if $opt_duplicate_deps ; then 54960b661123Smrg case "$tmp_libs " in 54970b661123Smrg *" $deplib "*) specialdeplibs="$specialdeplibs $deplib" ;; 54980b661123Smrg esac 54990b661123Smrg fi 55000b661123Smrg tmp_libs="$tmp_libs $deplib" 55010b661123Smrg done # for deplib 55020b661123Smrg continue 55030b661123Smrg fi # $linkmode = prog... 55040b661123Smrg 55050b661123Smrg if test "$linkmode,$pass" = "prog,link"; then 55060b661123Smrg if test -n "$library_names" && 55070b661123Smrg { { test "$prefer_static_libs" = no || 55080b661123Smrg test "$prefer_static_libs,$installed" = "built,yes"; } || 55090b661123Smrg test -z "$old_library"; }; then 55100b661123Smrg # We need to hardcode the library path 55110b661123Smrg if test -n "$shlibpath_var" && test -z "$avoidtemprpath" ; then 55120b661123Smrg # Make sure the rpath contains only unique directories. 55130b661123Smrg case "$temp_rpath:" in 55140b661123Smrg *"$absdir:"*) ;; 55150b661123Smrg *) temp_rpath="$temp_rpath$absdir:" ;; 55160b661123Smrg esac 55170b661123Smrg fi 55180b661123Smrg 55190b661123Smrg # Hardcode the library path. 55200b661123Smrg # Skip directories that are in the system default run-time 55210b661123Smrg # search path. 55220b661123Smrg case " $sys_lib_dlsearch_path " in 55230b661123Smrg *" $absdir "*) ;; 55240b661123Smrg *) 55250b661123Smrg case "$compile_rpath " in 55260b661123Smrg *" $absdir "*) ;; 55270b661123Smrg *) compile_rpath="$compile_rpath $absdir" 55280b661123Smrg esac 55290b661123Smrg ;; 55300b661123Smrg esac 55310b661123Smrg case " $sys_lib_dlsearch_path " in 55320b661123Smrg *" $libdir "*) ;; 55330b661123Smrg *) 55340b661123Smrg case "$finalize_rpath " in 55350b661123Smrg *" $libdir "*) ;; 55360b661123Smrg *) finalize_rpath="$finalize_rpath $libdir" 55370b661123Smrg esac 55380b661123Smrg ;; 55390b661123Smrg esac 55400b661123Smrg fi # $linkmode,$pass = prog,link... 55410b661123Smrg 55420b661123Smrg if test "$alldeplibs" = yes && 55430b661123Smrg { test "$deplibs_check_method" = pass_all || 55440b661123Smrg { test "$build_libtool_libs" = yes && 55450b661123Smrg test -n "$library_names"; }; }; then 55460b661123Smrg # We only need to search for static libraries 55470b661123Smrg continue 55480b661123Smrg fi 55490b661123Smrg fi 55500b661123Smrg 55510b661123Smrg link_static=no # Whether the deplib will be linked statically 55520b661123Smrg use_static_libs=$prefer_static_libs 55530b661123Smrg if test "$use_static_libs" = built && test "$installed" = yes; then 55540b661123Smrg use_static_libs=no 55550b661123Smrg fi 55560b661123Smrg if test -n "$library_names" && 55570b661123Smrg { test "$use_static_libs" = no || test -z "$old_library"; }; then 55580b661123Smrg case $host in 55590b661123Smrg *cygwin* | *mingw* | *cegcc*) 55600b661123Smrg # No point in relinking DLLs because paths are not encoded 55610b661123Smrg notinst_deplibs="$notinst_deplibs $lib" 55620b661123Smrg need_relink=no 55630b661123Smrg ;; 55640b661123Smrg *) 55650b661123Smrg if test "$installed" = no; then 55660b661123Smrg notinst_deplibs="$notinst_deplibs $lib" 55670b661123Smrg need_relink=yes 55680b661123Smrg fi 55690b661123Smrg ;; 55700b661123Smrg esac 55710b661123Smrg # This is a shared library 55720b661123Smrg 55730b661123Smrg # Warn about portability, can't link against -module's on some 55740b661123Smrg # systems (darwin). Don't bleat about dlopened modules though! 55750b661123Smrg dlopenmodule="" 55760b661123Smrg for dlpremoduletest in $dlprefiles; do 55770b661123Smrg if test "X$dlpremoduletest" = "X$lib"; then 55780b661123Smrg dlopenmodule="$dlpremoduletest" 55790b661123Smrg break 55800b661123Smrg fi 55810b661123Smrg done 55820b661123Smrg if test -z "$dlopenmodule" && test "$shouldnotlink" = yes && test "$pass" = link; then 55830b661123Smrg $ECHO 55840b661123Smrg if test "$linkmode" = prog; then 55850b661123Smrg $ECHO "*** Warning: Linking the executable $output against the loadable module" 55860b661123Smrg else 55870b661123Smrg $ECHO "*** Warning: Linking the shared library $output against the loadable module" 55880b661123Smrg fi 55890b661123Smrg $ECHO "*** $linklib is not portable!" 55900b661123Smrg fi 55910b661123Smrg if test "$linkmode" = lib && 55920b661123Smrg test "$hardcode_into_libs" = yes; then 55930b661123Smrg # Hardcode the library path. 55940b661123Smrg # Skip directories that are in the system default run-time 55950b661123Smrg # search path. 55960b661123Smrg case " $sys_lib_dlsearch_path " in 55970b661123Smrg *" $absdir "*) ;; 55980b661123Smrg *) 55990b661123Smrg case "$compile_rpath " in 56000b661123Smrg *" $absdir "*) ;; 56010b661123Smrg *) compile_rpath="$compile_rpath $absdir" 56020b661123Smrg esac 56030b661123Smrg ;; 56040b661123Smrg esac 56050b661123Smrg case " $sys_lib_dlsearch_path " in 56060b661123Smrg *" $libdir "*) ;; 56070b661123Smrg *) 56080b661123Smrg case "$finalize_rpath " in 56090b661123Smrg *" $libdir "*) ;; 56100b661123Smrg *) finalize_rpath="$finalize_rpath $libdir" 56110b661123Smrg esac 56120b661123Smrg ;; 56130b661123Smrg esac 56140b661123Smrg fi 56150b661123Smrg 56160b661123Smrg if test -n "$old_archive_from_expsyms_cmds"; then 56170b661123Smrg # figure out the soname 56180b661123Smrg set dummy $library_names 56190b661123Smrg shift 56200b661123Smrg realname="$1" 56210b661123Smrg shift 56220b661123Smrg libname=`eval "\\$ECHO \"$libname_spec\""` 56230b661123Smrg # use dlname if we got it. it's perfectly good, no? 56240b661123Smrg if test -n "$dlname"; then 56250b661123Smrg soname="$dlname" 56260b661123Smrg elif test -n "$soname_spec"; then 56270b661123Smrg # bleh windows 56280b661123Smrg case $host in 56290b661123Smrg *cygwin* | mingw* | *cegcc*) 56300b661123Smrg func_arith $current - $age 56310b661123Smrg major=$func_arith_result 56320b661123Smrg versuffix="-$major" 56330b661123Smrg ;; 56340b661123Smrg esac 56350b661123Smrg eval soname=\"$soname_spec\" 56360b661123Smrg else 56370b661123Smrg soname="$realname" 56380b661123Smrg fi 56390b661123Smrg 56400b661123Smrg # Make a new name for the extract_expsyms_cmds to use 56410b661123Smrg soroot="$soname" 56420b661123Smrg func_basename "$soroot" 56430b661123Smrg soname="$func_basename_result" 56440b661123Smrg func_stripname 'lib' '.dll' "$soname" 56450b661123Smrg newlib=libimp-$func_stripname_result.a 56460b661123Smrg 56470b661123Smrg # If the library has no export list, then create one now 56480b661123Smrg if test -f "$output_objdir/$soname-def"; then : 56490b661123Smrg else 56500b661123Smrg func_verbose "extracting exported symbol list from \`$soname'" 56510b661123Smrg func_execute_cmds "$extract_expsyms_cmds" 'exit $?' 56520b661123Smrg fi 56530b661123Smrg 56540b661123Smrg # Create $newlib 56550b661123Smrg if test -f "$output_objdir/$newlib"; then :; else 56560b661123Smrg func_verbose "generating import library for \`$soname'" 56570b661123Smrg func_execute_cmds "$old_archive_from_expsyms_cmds" 'exit $?' 56580b661123Smrg fi 56590b661123Smrg # make sure the library variables are pointing to the new library 56600b661123Smrg dir=$output_objdir 56610b661123Smrg linklib=$newlib 56620b661123Smrg fi # test -n "$old_archive_from_expsyms_cmds" 56630b661123Smrg 56640b661123Smrg if test "$linkmode" = prog || test "$mode" != relink; then 56650b661123Smrg add_shlibpath= 56660b661123Smrg add_dir= 56670b661123Smrg add= 56680b661123Smrg lib_linked=yes 56690b661123Smrg case $hardcode_action in 56700b661123Smrg immediate | unsupported) 56710b661123Smrg if test "$hardcode_direct" = no; then 56720b661123Smrg add="$dir/$linklib" 56730b661123Smrg case $host in 56740b661123Smrg *-*-sco3.2v5.0.[024]*) add_dir="-L$dir" ;; 56750b661123Smrg *-*-sysv4*uw2*) add_dir="-L$dir" ;; 56760b661123Smrg *-*-sysv5OpenUNIX* | *-*-sysv5UnixWare7.[01].[10]* | \ 56770b661123Smrg *-*-unixware7*) add_dir="-L$dir" ;; 56780b661123Smrg *-*-darwin* ) 56790b661123Smrg # if the lib is a (non-dlopened) module then we can not 56800b661123Smrg # link against it, someone is ignoring the earlier warnings 56810b661123Smrg if /usr/bin/file -L $add 2> /dev/null | 56820b661123Smrg $GREP ": [^:]* bundle" >/dev/null ; then 56830b661123Smrg if test "X$dlopenmodule" != "X$lib"; then 56840b661123Smrg $ECHO "*** Warning: lib $linklib is a module, not a shared library" 56850b661123Smrg if test -z "$old_library" ; then 56860b661123Smrg $ECHO 56870b661123Smrg $ECHO "*** And there doesn't seem to be a static archive available" 56880b661123Smrg $ECHO "*** The link will probably fail, sorry" 56890b661123Smrg else 56900b661123Smrg add="$dir/$old_library" 56910b661123Smrg fi 56920b661123Smrg elif test -n "$old_library"; then 56930b661123Smrg add="$dir/$old_library" 56940b661123Smrg fi 56950b661123Smrg fi 56960b661123Smrg esac 56970b661123Smrg elif test "$hardcode_minus_L" = no; then 56980b661123Smrg case $host in 56990b661123Smrg *-*-sunos*) add_shlibpath="$dir" ;; 57000b661123Smrg esac 57010b661123Smrg add_dir="-L$dir" 57020b661123Smrg add="-l$name" 57030b661123Smrg elif test "$hardcode_shlibpath_var" = no; then 57040b661123Smrg add_shlibpath="$dir" 57050b661123Smrg add="-l$name" 57060b661123Smrg else 57070b661123Smrg lib_linked=no 57080b661123Smrg fi 57090b661123Smrg ;; 57100b661123Smrg relink) 57110b661123Smrg if test "$hardcode_direct" = yes && 57120b661123Smrg test "$hardcode_direct_absolute" = no; then 57130b661123Smrg add="$dir/$linklib" 57140b661123Smrg elif test "$hardcode_minus_L" = yes; then 57150b661123Smrg add_dir="-L$dir" 57160b661123Smrg # Try looking first in the location we're being installed to. 57170b661123Smrg if test -n "$inst_prefix_dir"; then 57180b661123Smrg case $libdir in 57190b661123Smrg [\\/]*) 57200b661123Smrg add_dir="$add_dir -L$inst_prefix_dir$libdir" 57210b661123Smrg ;; 57220b661123Smrg esac 57230b661123Smrg fi 57240b661123Smrg add="-l$name" 57250b661123Smrg elif test "$hardcode_shlibpath_var" = yes; then 57260b661123Smrg add_shlibpath="$dir" 57270b661123Smrg add="-l$name" 57280b661123Smrg else 57290b661123Smrg lib_linked=no 57300b661123Smrg fi 57310b661123Smrg ;; 57320b661123Smrg *) lib_linked=no ;; 57330b661123Smrg esac 57340b661123Smrg 57350b661123Smrg if test "$lib_linked" != yes; then 57360b661123Smrg func_fatal_configuration "unsupported hardcode properties" 57370b661123Smrg fi 57380b661123Smrg 57390b661123Smrg if test -n "$add_shlibpath"; then 57400b661123Smrg case :$compile_shlibpath: in 57410b661123Smrg *":$add_shlibpath:"*) ;; 57420b661123Smrg *) compile_shlibpath="$compile_shlibpath$add_shlibpath:" ;; 57430b661123Smrg esac 57440b661123Smrg fi 57450b661123Smrg if test "$linkmode" = prog; then 57460b661123Smrg test -n "$add_dir" && compile_deplibs="$add_dir $compile_deplibs" 57470b661123Smrg test -n "$add" && compile_deplibs="$add $compile_deplibs" 57480b661123Smrg else 57490b661123Smrg test -n "$add_dir" && deplibs="$add_dir $deplibs" 57500b661123Smrg test -n "$add" && deplibs="$add $deplibs" 57510b661123Smrg if test "$hardcode_direct" != yes && 57520b661123Smrg test "$hardcode_minus_L" != yes && 57530b661123Smrg test "$hardcode_shlibpath_var" = yes; then 57540b661123Smrg case :$finalize_shlibpath: in 57550b661123Smrg *":$libdir:"*) ;; 57560b661123Smrg *) finalize_shlibpath="$finalize_shlibpath$libdir:" ;; 57570b661123Smrg esac 57580b661123Smrg fi 57590b661123Smrg fi 57600b661123Smrg fi 57610b661123Smrg 57620b661123Smrg if test "$linkmode" = prog || test "$mode" = relink; then 57630b661123Smrg add_shlibpath= 57640b661123Smrg add_dir= 57650b661123Smrg add= 57660b661123Smrg # Finalize command for both is simple: just hardcode it. 57670b661123Smrg if test "$hardcode_direct" = yes && 57680b661123Smrg test "$hardcode_direct_absolute" = no; then 57690b661123Smrg add="$libdir/$linklib" 57700b661123Smrg elif test "$hardcode_minus_L" = yes; then 57710b661123Smrg add_dir="-L$libdir" 57720b661123Smrg add="-l$name" 57730b661123Smrg elif test "$hardcode_shlibpath_var" = yes; then 57740b661123Smrg case :$finalize_shlibpath: in 57750b661123Smrg *":$libdir:"*) ;; 57760b661123Smrg *) finalize_shlibpath="$finalize_shlibpath$libdir:" ;; 57770b661123Smrg esac 57780b661123Smrg add="-l$name" 57790b661123Smrg elif test "$hardcode_automatic" = yes; then 57800b661123Smrg if test -n "$inst_prefix_dir" && 57810b661123Smrg test -f "$inst_prefix_dir$libdir/$linklib" ; then 57820b661123Smrg add="$inst_prefix_dir$libdir/$linklib" 57830b661123Smrg else 57840b661123Smrg add="$libdir/$linklib" 57850b661123Smrg fi 57860b661123Smrg else 57870b661123Smrg # We cannot seem to hardcode it, guess we'll fake it. 57880b661123Smrg add_dir="-L$libdir" 57890b661123Smrg # Try looking first in the location we're being installed to. 57900b661123Smrg if test -n "$inst_prefix_dir"; then 57910b661123Smrg case $libdir in 57920b661123Smrg [\\/]*) 57930b661123Smrg add_dir="$add_dir -L$inst_prefix_dir$libdir" 57940b661123Smrg ;; 57950b661123Smrg esac 57960b661123Smrg fi 57970b661123Smrg add="-l$name" 57980b661123Smrg fi 57990b661123Smrg 58000b661123Smrg if test "$linkmode" = prog; then 58010b661123Smrg test -n "$add_dir" && finalize_deplibs="$add_dir $finalize_deplibs" 58020b661123Smrg test -n "$add" && finalize_deplibs="$add $finalize_deplibs" 58030b661123Smrg else 58040b661123Smrg test -n "$add_dir" && deplibs="$add_dir $deplibs" 58050b661123Smrg test -n "$add" && deplibs="$add $deplibs" 58060b661123Smrg fi 58070b661123Smrg fi 58080b661123Smrg elif test "$linkmode" = prog; then 58090b661123Smrg # Here we assume that one of hardcode_direct or hardcode_minus_L 58100b661123Smrg # is not unsupported. This is valid on all known static and 58110b661123Smrg # shared platforms. 58120b661123Smrg if test "$hardcode_direct" != unsupported; then 58130b661123Smrg test -n "$old_library" && linklib="$old_library" 58140b661123Smrg compile_deplibs="$dir/$linklib $compile_deplibs" 58150b661123Smrg finalize_deplibs="$dir/$linklib $finalize_deplibs" 58160b661123Smrg else 58170b661123Smrg compile_deplibs="-l$name -L$dir $compile_deplibs" 58180b661123Smrg finalize_deplibs="-l$name -L$dir $finalize_deplibs" 58190b661123Smrg fi 58200b661123Smrg elif test "$build_libtool_libs" = yes; then 58210b661123Smrg # Not a shared library 58220b661123Smrg if test "$deplibs_check_method" != pass_all; then 58230b661123Smrg # We're trying link a shared library against a static one 58240b661123Smrg # but the system doesn't support it. 58250b661123Smrg 58260b661123Smrg # Just print a warning and add the library to dependency_libs so 58270b661123Smrg # that the program can be linked against the static library. 58280b661123Smrg $ECHO 58290b661123Smrg $ECHO "*** Warning: This system can not link to static lib archive $lib." 58300b661123Smrg $ECHO "*** I have the capability to make that library automatically link in when" 58310b661123Smrg $ECHO "*** you link to this library. But I can only do this if you have a" 58320b661123Smrg $ECHO "*** shared version of the library, which you do not appear to have." 58330b661123Smrg if test "$module" = yes; then 58340b661123Smrg $ECHO "*** But as you try to build a module library, libtool will still create " 58350b661123Smrg $ECHO "*** a static module, that should work as long as the dlopening application" 58360b661123Smrg $ECHO "*** is linked with the -dlopen flag to resolve symbols at runtime." 58370b661123Smrg if test -z "$global_symbol_pipe"; then 58380b661123Smrg $ECHO 58390b661123Smrg $ECHO "*** However, this would only work if libtool was able to extract symbol" 58400b661123Smrg $ECHO "*** lists from a program, using \`nm' or equivalent, but libtool could" 58410b661123Smrg $ECHO "*** not find such a program. So, this module is probably useless." 58420b661123Smrg $ECHO "*** \`nm' from GNU binutils and a full rebuild may help." 58430b661123Smrg fi 58440b661123Smrg if test "$build_old_libs" = no; then 58450b661123Smrg build_libtool_libs=module 58460b661123Smrg build_old_libs=yes 58470b661123Smrg else 58480b661123Smrg build_libtool_libs=no 58490b661123Smrg fi 58500b661123Smrg fi 58510b661123Smrg else 58520b661123Smrg deplibs="$dir/$old_library $deplibs" 58530b661123Smrg link_static=yes 58540b661123Smrg fi 58550b661123Smrg fi # link shared/static library? 58560b661123Smrg 58570b661123Smrg if test "$linkmode" = lib; then 58580b661123Smrg if test -n "$dependency_libs" && 58590b661123Smrg { test "$hardcode_into_libs" != yes || 58600b661123Smrg test "$build_old_libs" = yes || 58610b661123Smrg test "$link_static" = yes; }; then 58620b661123Smrg # Extract -R from dependency_libs 58630b661123Smrg temp_deplibs= 58640b661123Smrg for libdir in $dependency_libs; do 58650b661123Smrg case $libdir in 58660b661123Smrg -R*) func_stripname '-R' '' "$libdir" 58670b661123Smrg temp_xrpath=$func_stripname_result 58680b661123Smrg case " $xrpath " in 58690b661123Smrg *" $temp_xrpath "*) ;; 58700b661123Smrg *) xrpath="$xrpath $temp_xrpath";; 58710b661123Smrg esac;; 58720b661123Smrg *) temp_deplibs="$temp_deplibs $libdir";; 58730b661123Smrg esac 58740b661123Smrg done 58750b661123Smrg dependency_libs="$temp_deplibs" 58760b661123Smrg fi 58770b661123Smrg 58780b661123Smrg newlib_search_path="$newlib_search_path $absdir" 58790b661123Smrg # Link against this library 58800b661123Smrg test "$link_static" = no && newdependency_libs="$abs_ladir/$laname $newdependency_libs" 58810b661123Smrg # ... and its dependency_libs 58820b661123Smrg tmp_libs= 58830b661123Smrg for deplib in $dependency_libs; do 58840b661123Smrg newdependency_libs="$deplib $newdependency_libs" 58850b661123Smrg if $opt_duplicate_deps ; then 58860b661123Smrg case "$tmp_libs " in 58870b661123Smrg *" $deplib "*) specialdeplibs="$specialdeplibs $deplib" ;; 58880b661123Smrg esac 58890b661123Smrg fi 58900b661123Smrg tmp_libs="$tmp_libs $deplib" 58910b661123Smrg done 58920b661123Smrg 58930b661123Smrg if test "$link_all_deplibs" != no; then 58940b661123Smrg # Add the search paths of all dependency libraries 58950b661123Smrg for deplib in $dependency_libs; do 58960b661123Smrg case $deplib in 58970b661123Smrg -L*) path="$deplib" ;; 58980b661123Smrg *.la) 58990b661123Smrg func_dirname "$deplib" "" "." 59000b661123Smrg dir="$func_dirname_result" 59010b661123Smrg # We need an absolute path. 59020b661123Smrg case $dir in 59030b661123Smrg [\\/]* | [A-Za-z]:[\\/]*) absdir="$dir" ;; 59040b661123Smrg *) 59050b661123Smrg absdir=`cd "$dir" && pwd` 59060b661123Smrg if test -z "$absdir"; then 59070b661123Smrg func_warning "cannot determine absolute directory name of \`$dir'" 59080b661123Smrg absdir="$dir" 59090b661123Smrg fi 59100b661123Smrg ;; 59110b661123Smrg esac 59120b661123Smrg if $GREP "^installed=no" $deplib > /dev/null; then 59130b661123Smrg case $host in 59140b661123Smrg *-*-darwin*) 59150b661123Smrg depdepl= 59160b661123Smrg eval deplibrary_names=`${SED} -n -e 's/^library_names=\(.*\)$/\1/p' $deplib` 59170b661123Smrg if test -n "$deplibrary_names" ; then 59180b661123Smrg for tmp in $deplibrary_names ; do 59190b661123Smrg depdepl=$tmp 59200b661123Smrg done 59210b661123Smrg if test -f "$absdir/$objdir/$depdepl" ; then 59220b661123Smrg depdepl="$absdir/$objdir/$depdepl" 59230b661123Smrg darwin_install_name=`${OTOOL} -L $depdepl | awk '{if (NR == 2) {print $1;exit}}'` 59240b661123Smrg if test -z "$darwin_install_name"; then 59250b661123Smrg darwin_install_name=`${OTOOL64} -L $depdepl | awk '{if (NR == 2) {print $1;exit}}'` 59260b661123Smrg fi 59270b661123Smrg compiler_flags="$compiler_flags ${wl}-dylib_file ${wl}${darwin_install_name}:${depdepl}" 59280b661123Smrg linker_flags="$linker_flags -dylib_file ${darwin_install_name}:${depdepl}" 59290b661123Smrg path= 59300b661123Smrg fi 59310b661123Smrg fi 59320b661123Smrg ;; 59330b661123Smrg *) 59340b661123Smrg path="-L$absdir/$objdir" 59350b661123Smrg ;; 59360b661123Smrg esac 59370b661123Smrg else 59380b661123Smrg eval libdir=`${SED} -n -e 's/^libdir=\(.*\)$/\1/p' $deplib` 59390b661123Smrg test -z "$libdir" && \ 59400b661123Smrg func_fatal_error "\`$deplib' is not a valid libtool archive" 59410b661123Smrg test "$absdir" != "$libdir" && \ 59420b661123Smrg func_warning "\`$deplib' seems to be moved" 59430b661123Smrg 59440b661123Smrg path="-L$absdir" 59450b661123Smrg fi 59460b661123Smrg ;; 59470b661123Smrg esac 59480b661123Smrg case " $deplibs " in 59490b661123Smrg *" $path "*) ;; 59500b661123Smrg *) deplibs="$path $deplibs" ;; 59510b661123Smrg esac 59520b661123Smrg done 59530b661123Smrg fi # link_all_deplibs != no 59540b661123Smrg fi # linkmode = lib 59550b661123Smrg done # for deplib in $libs 59560b661123Smrg if test "$pass" = link; then 59570b661123Smrg if test "$linkmode" = "prog"; then 59580b661123Smrg compile_deplibs="$new_inherited_linker_flags $compile_deplibs" 59590b661123Smrg finalize_deplibs="$new_inherited_linker_flags $finalize_deplibs" 59600b661123Smrg else 59610b661123Smrg compiler_flags="$compiler_flags "`$ECHO "X $new_inherited_linker_flags" | $Xsed -e 's% \([^ $]*\).ltframework% -framework \1%g'` 59620b661123Smrg fi 59630b661123Smrg fi 59640b661123Smrg dependency_libs="$newdependency_libs" 59650b661123Smrg if test "$pass" = dlpreopen; then 59660b661123Smrg # Link the dlpreopened libraries before other libraries 59670b661123Smrg for deplib in $save_deplibs; do 59680b661123Smrg deplibs="$deplib $deplibs" 59690b661123Smrg done 59700b661123Smrg fi 59710b661123Smrg if test "$pass" != dlopen; then 59720b661123Smrg if test "$pass" != conv; then 59730b661123Smrg # Make sure lib_search_path contains only unique directories. 59740b661123Smrg lib_search_path= 59750b661123Smrg for dir in $newlib_search_path; do 59760b661123Smrg case "$lib_search_path " in 59770b661123Smrg *" $dir "*) ;; 59780b661123Smrg *) lib_search_path="$lib_search_path $dir" ;; 59790b661123Smrg esac 59800b661123Smrg done 59810b661123Smrg newlib_search_path= 59820b661123Smrg fi 59830b661123Smrg 59840b661123Smrg if test "$linkmode,$pass" != "prog,link"; then 59850b661123Smrg vars="deplibs" 59860b661123Smrg else 59870b661123Smrg vars="compile_deplibs finalize_deplibs" 59880b661123Smrg fi 59890b661123Smrg for var in $vars dependency_libs; do 59900b661123Smrg # Add libraries to $var in reverse order 59910b661123Smrg eval tmp_libs=\"\$$var\" 59920b661123Smrg new_libs= 59930b661123Smrg for deplib in $tmp_libs; do 59940b661123Smrg # FIXME: Pedantically, this is the right thing to do, so 59950b661123Smrg # that some nasty dependency loop isn't accidentally 59960b661123Smrg # broken: 59970b661123Smrg #new_libs="$deplib $new_libs" 59980b661123Smrg # Pragmatically, this seems to cause very few problems in 59990b661123Smrg # practice: 60000b661123Smrg case $deplib in 60010b661123Smrg -L*) new_libs="$deplib $new_libs" ;; 60020b661123Smrg -R*) ;; 60030b661123Smrg *) 60040b661123Smrg # And here is the reason: when a library appears more 60050b661123Smrg # than once as an explicit dependence of a library, or 60060b661123Smrg # is implicitly linked in more than once by the 60070b661123Smrg # compiler, it is considered special, and multiple 60080b661123Smrg # occurrences thereof are not removed. Compare this 60090b661123Smrg # with having the same library being listed as a 60100b661123Smrg # dependency of multiple other libraries: in this case, 60110b661123Smrg # we know (pedantically, we assume) the library does not 60120b661123Smrg # need to be listed more than once, so we keep only the 60130b661123Smrg # last copy. This is not always right, but it is rare 60140b661123Smrg # enough that we require users that really mean to play 60150b661123Smrg # such unportable linking tricks to link the library 60160b661123Smrg # using -Wl,-lname, so that libtool does not consider it 60170b661123Smrg # for duplicate removal. 60180b661123Smrg case " $specialdeplibs " in 60190b661123Smrg *" $deplib "*) new_libs="$deplib $new_libs" ;; 60200b661123Smrg *) 60210b661123Smrg case " $new_libs " in 60220b661123Smrg *" $deplib "*) ;; 60230b661123Smrg *) new_libs="$deplib $new_libs" ;; 60240b661123Smrg esac 60250b661123Smrg ;; 60260b661123Smrg esac 60270b661123Smrg ;; 60280b661123Smrg esac 60290b661123Smrg done 60300b661123Smrg tmp_libs= 60310b661123Smrg for deplib in $new_libs; do 60320b661123Smrg case $deplib in 60330b661123Smrg -L*) 60340b661123Smrg case " $tmp_libs " in 60350b661123Smrg *" $deplib "*) ;; 60360b661123Smrg *) tmp_libs="$tmp_libs $deplib" ;; 60370b661123Smrg esac 60380b661123Smrg ;; 60390b661123Smrg *) tmp_libs="$tmp_libs $deplib" ;; 60400b661123Smrg esac 60410b661123Smrg done 60420b661123Smrg eval $var=\"$tmp_libs\" 60430b661123Smrg done # for var 60440b661123Smrg fi 60450b661123Smrg # Last step: remove runtime libs from dependency_libs 60460b661123Smrg # (they stay in deplibs) 60470b661123Smrg tmp_libs= 60480b661123Smrg for i in $dependency_libs ; do 60490b661123Smrg case " $predeps $postdeps $compiler_lib_search_path " in 60500b661123Smrg *" $i "*) 60510b661123Smrg i="" 60520b661123Smrg ;; 60530b661123Smrg esac 60540b661123Smrg if test -n "$i" ; then 60550b661123Smrg tmp_libs="$tmp_libs $i" 60560b661123Smrg fi 60570b661123Smrg done 60580b661123Smrg dependency_libs=$tmp_libs 60590b661123Smrg done # for pass 60600b661123Smrg if test "$linkmode" = prog; then 60610b661123Smrg dlfiles="$newdlfiles" 60620b661123Smrg fi 60630b661123Smrg if test "$linkmode" = prog || test "$linkmode" = lib; then 60640b661123Smrg dlprefiles="$newdlprefiles" 60650b661123Smrg fi 60660b661123Smrg 60670b661123Smrg case $linkmode in 60680b661123Smrg oldlib) 60690b661123Smrg if test -n "$dlfiles$dlprefiles" || test "$dlself" != no; then 60700b661123Smrg func_warning "\`-dlopen' is ignored for archives" 60710b661123Smrg fi 60720b661123Smrg 60730b661123Smrg case " $deplibs" in 60740b661123Smrg *\ -l* | *\ -L*) 60750b661123Smrg func_warning "\`-l' and \`-L' are ignored for archives" ;; 60760b661123Smrg esac 60770b661123Smrg 60780b661123Smrg test -n "$rpath" && \ 60790b661123Smrg func_warning "\`-rpath' is ignored for archives" 60800b661123Smrg 60810b661123Smrg test -n "$xrpath" && \ 60820b661123Smrg func_warning "\`-R' is ignored for archives" 60830b661123Smrg 60840b661123Smrg test -n "$vinfo" && \ 60850b661123Smrg func_warning "\`-version-info/-version-number' is ignored for archives" 60860b661123Smrg 60870b661123Smrg test -n "$release" && \ 60880b661123Smrg func_warning "\`-release' is ignored for archives" 60890b661123Smrg 60900b661123Smrg test -n "$export_symbols$export_symbols_regex" && \ 60910b661123Smrg func_warning "\`-export-symbols' is ignored for archives" 60920b661123Smrg 60930b661123Smrg # Now set the variables for building old libraries. 60940b661123Smrg build_libtool_libs=no 60950b661123Smrg oldlibs="$output" 60960b661123Smrg objs="$objs$old_deplibs" 60970b661123Smrg ;; 60980b661123Smrg 60990b661123Smrg lib) 61000b661123Smrg # Make sure we only generate libraries of the form `libNAME.la'. 61010b661123Smrg case $outputname in 61020b661123Smrg lib*) 61030b661123Smrg func_stripname 'lib' '.la' "$outputname" 61040b661123Smrg name=$func_stripname_result 61050b661123Smrg eval shared_ext=\"$shrext_cmds\" 61060b661123Smrg eval libname=\"$libname_spec\" 61070b661123Smrg ;; 61080b661123Smrg *) 61090b661123Smrg test "$module" = no && \ 61100b661123Smrg func_fatal_help "libtool library \`$output' must begin with \`lib'" 61110b661123Smrg 61120b661123Smrg if test "$need_lib_prefix" != no; then 61130b661123Smrg # Add the "lib" prefix for modules if required 61140b661123Smrg func_stripname '' '.la' "$outputname" 61150b661123Smrg name=$func_stripname_result 61160b661123Smrg eval shared_ext=\"$shrext_cmds\" 61170b661123Smrg eval libname=\"$libname_spec\" 61180b661123Smrg else 61190b661123Smrg func_stripname '' '.la' "$outputname" 61200b661123Smrg libname=$func_stripname_result 61210b661123Smrg fi 61220b661123Smrg ;; 61230b661123Smrg esac 61240b661123Smrg 61250b661123Smrg if test -n "$objs"; then 61260b661123Smrg if test "$deplibs_check_method" != pass_all; then 61270b661123Smrg func_fatal_error "cannot build libtool library \`$output' from non-libtool objects on this host:$objs" 61280b661123Smrg else 61290b661123Smrg $ECHO 61300b661123Smrg $ECHO "*** Warning: Linking the shared library $output against the non-libtool" 61310b661123Smrg $ECHO "*** objects $objs is not portable!" 61320b661123Smrg libobjs="$libobjs $objs" 61330b661123Smrg fi 61340b661123Smrg fi 61350b661123Smrg 61360b661123Smrg test "$dlself" != no && \ 61370b661123Smrg func_warning "\`-dlopen self' is ignored for libtool libraries" 61380b661123Smrg 61390b661123Smrg set dummy $rpath 61400b661123Smrg shift 61410b661123Smrg test "$#" -gt 1 && \ 61420b661123Smrg func_warning "ignoring multiple \`-rpath's for a libtool library" 61430b661123Smrg 61440b661123Smrg install_libdir="$1" 61450b661123Smrg 61460b661123Smrg oldlibs= 61470b661123Smrg if test -z "$rpath"; then 61480b661123Smrg if test "$build_libtool_libs" = yes; then 61490b661123Smrg # Building a libtool convenience library. 61500b661123Smrg # Some compilers have problems with a `.al' extension so 61510b661123Smrg # convenience libraries should have the same extension an 61520b661123Smrg # archive normally would. 61530b661123Smrg oldlibs="$output_objdir/$libname.$libext $oldlibs" 61540b661123Smrg build_libtool_libs=convenience 61550b661123Smrg build_old_libs=yes 61560b661123Smrg fi 61570b661123Smrg 61580b661123Smrg test -n "$vinfo" && \ 61590b661123Smrg func_warning "\`-version-info/-version-number' is ignored for convenience libraries" 61600b661123Smrg 61610b661123Smrg test -n "$release" && \ 61620b661123Smrg func_warning "\`-release' is ignored for convenience libraries" 61630b661123Smrg else 61640b661123Smrg 61650b661123Smrg # Parse the version information argument. 61660b661123Smrg save_ifs="$IFS"; IFS=':' 61670b661123Smrg set dummy $vinfo 0 0 0 61680b661123Smrg shift 61690b661123Smrg IFS="$save_ifs" 61700b661123Smrg 61710b661123Smrg test -n "$7" && \ 61720b661123Smrg func_fatal_help "too many parameters to \`-version-info'" 61730b661123Smrg 61740b661123Smrg # convert absolute version numbers to libtool ages 61750b661123Smrg # this retains compatibility with .la files and attempts 61760b661123Smrg # to make the code below a bit more comprehensible 61770b661123Smrg 61780b661123Smrg case $vinfo_number in 61790b661123Smrg yes) 61800b661123Smrg number_major="$1" 61810b661123Smrg number_minor="$2" 61820b661123Smrg number_revision="$3" 61830b661123Smrg # 61840b661123Smrg # There are really only two kinds -- those that 61850b661123Smrg # use the current revision as the major version 61860b661123Smrg # and those that subtract age and use age as 61870b661123Smrg # a minor version. But, then there is irix 61880b661123Smrg # which has an extra 1 added just for fun 61890b661123Smrg # 61900b661123Smrg case $version_type in 61910b661123Smrg darwin|linux|osf|windows|none) 61920b661123Smrg func_arith $number_major + $number_minor 61930b661123Smrg current=$func_arith_result 61940b661123Smrg age="$number_minor" 61950b661123Smrg revision="$number_revision" 61960b661123Smrg ;; 61970b661123Smrg freebsd-aout|freebsd-elf|sunos) 61980b661123Smrg current="$number_major" 61990b661123Smrg revision="$number_minor" 62000b661123Smrg age="0" 62010b661123Smrg ;; 62020b661123Smrg irix|nonstopux) 62030b661123Smrg func_arith $number_major + $number_minor 62040b661123Smrg current=$func_arith_result 62050b661123Smrg age="$number_minor" 62060b661123Smrg revision="$number_minor" 62070b661123Smrg lt_irix_increment=no 62080b661123Smrg ;; 62090b661123Smrg esac 62100b661123Smrg ;; 62110b661123Smrg no) 62120b661123Smrg current="$1" 62130b661123Smrg revision="$2" 62140b661123Smrg age="$3" 62150b661123Smrg ;; 62160b661123Smrg esac 62170b661123Smrg 62180b661123Smrg # Check that each of the things are valid numbers. 62190b661123Smrg case $current in 62200b661123Smrg 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]) ;; 62210b661123Smrg *) 62220b661123Smrg func_error "CURRENT \`$current' must be a nonnegative integer" 62230b661123Smrg func_fatal_error "\`$vinfo' is not valid version information" 62240b661123Smrg ;; 62250b661123Smrg esac 62260b661123Smrg 62270b661123Smrg case $revision in 62280b661123Smrg 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]) ;; 62290b661123Smrg *) 62300b661123Smrg func_error "REVISION \`$revision' must be a nonnegative integer" 62310b661123Smrg func_fatal_error "\`$vinfo' is not valid version information" 62320b661123Smrg ;; 62330b661123Smrg esac 62340b661123Smrg 62350b661123Smrg case $age in 62360b661123Smrg 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]) ;; 62370b661123Smrg *) 62380b661123Smrg func_error "AGE \`$age' must be a nonnegative integer" 62390b661123Smrg func_fatal_error "\`$vinfo' is not valid version information" 62400b661123Smrg ;; 62410b661123Smrg esac 62420b661123Smrg 62430b661123Smrg if test "$age" -gt "$current"; then 62440b661123Smrg func_error "AGE \`$age' is greater than the current interface number \`$current'" 62450b661123Smrg func_fatal_error "\`$vinfo' is not valid version information" 62460b661123Smrg fi 62470b661123Smrg 62480b661123Smrg # Calculate the version variables. 62490b661123Smrg major= 62500b661123Smrg versuffix= 62510b661123Smrg verstring= 62520b661123Smrg case $version_type in 62530b661123Smrg none) ;; 62540b661123Smrg 62550b661123Smrg darwin) 62560b661123Smrg # Like Linux, but with the current version available in 62570b661123Smrg # verstring for coding it into the library header 62580b661123Smrg func_arith $current - $age 62590b661123Smrg major=.$func_arith_result 62600b661123Smrg versuffix="$major.$age.$revision" 62610b661123Smrg # Darwin ld doesn't like 0 for these options... 62620b661123Smrg func_arith $current + 1 62630b661123Smrg minor_current=$func_arith_result 62640b661123Smrg xlcverstring="${wl}-compatibility_version ${wl}$minor_current ${wl}-current_version ${wl}$minor_current.$revision" 62650b661123Smrg verstring="-compatibility_version $minor_current -current_version $minor_current.$revision" 62660b661123Smrg ;; 62670b661123Smrg 62680b661123Smrg freebsd-aout) 62690b661123Smrg major=".$current" 62700b661123Smrg versuffix=".$current.$revision"; 62710b661123Smrg ;; 62720b661123Smrg 62730b661123Smrg freebsd-elf) 62740b661123Smrg major=".$current" 62750b661123Smrg versuffix=".$current" 62760b661123Smrg ;; 62770b661123Smrg 62780b661123Smrg irix | nonstopux) 62790b661123Smrg if test "X$lt_irix_increment" = "Xno"; then 62800b661123Smrg func_arith $current - $age 62810b661123Smrg else 62820b661123Smrg func_arith $current - $age + 1 62830b661123Smrg fi 62840b661123Smrg major=$func_arith_result 62850b661123Smrg 62860b661123Smrg case $version_type in 62870b661123Smrg nonstopux) verstring_prefix=nonstopux ;; 62880b661123Smrg *) verstring_prefix=sgi ;; 62890b661123Smrg esac 62900b661123Smrg verstring="$verstring_prefix$major.$revision" 62910b661123Smrg 62920b661123Smrg # Add in all the interfaces that we are compatible with. 62930b661123Smrg loop=$revision 62940b661123Smrg while test "$loop" -ne 0; do 62950b661123Smrg func_arith $revision - $loop 62960b661123Smrg iface=$func_arith_result 62970b661123Smrg func_arith $loop - 1 62980b661123Smrg loop=$func_arith_result 62990b661123Smrg verstring="$verstring_prefix$major.$iface:$verstring" 63000b661123Smrg done 63010b661123Smrg 63020b661123Smrg # Before this point, $major must not contain `.'. 63030b661123Smrg major=.$major 63040b661123Smrg versuffix="$major.$revision" 63050b661123Smrg ;; 63060b661123Smrg 63070b661123Smrg linux) 63080b661123Smrg func_arith $current - $age 63090b661123Smrg major=.$func_arith_result 63100b661123Smrg versuffix="$major.$age.$revision" 63110b661123Smrg ;; 63120b661123Smrg 63130b661123Smrg osf) 63140b661123Smrg func_arith $current - $age 63150b661123Smrg major=.$func_arith_result 63160b661123Smrg versuffix=".$current.$age.$revision" 63170b661123Smrg verstring="$current.$age.$revision" 63180b661123Smrg 63190b661123Smrg # Add in all the interfaces that we are compatible with. 63200b661123Smrg loop=$age 63210b661123Smrg while test "$loop" -ne 0; do 63220b661123Smrg func_arith $current - $loop 63230b661123Smrg iface=$func_arith_result 63240b661123Smrg func_arith $loop - 1 63250b661123Smrg loop=$func_arith_result 63260b661123Smrg verstring="$verstring:${iface}.0" 63270b661123Smrg done 63280b661123Smrg 63290b661123Smrg # Make executables depend on our current version. 63300b661123Smrg verstring="$verstring:${current}.0" 63310b661123Smrg ;; 63320b661123Smrg 63330b661123Smrg qnx) 63340b661123Smrg major=".$current" 63350b661123Smrg versuffix=".$current" 63360b661123Smrg ;; 63370b661123Smrg 63380b661123Smrg sunos) 63390b661123Smrg major=".$current" 63400b661123Smrg versuffix=".$current.$revision" 63410b661123Smrg ;; 63420b661123Smrg 63430b661123Smrg windows) 63440b661123Smrg # Use '-' rather than '.', since we only want one 63450b661123Smrg # extension on DOS 8.3 filesystems. 63460b661123Smrg func_arith $current - $age 63470b661123Smrg major=$func_arith_result 63480b661123Smrg versuffix="-$major" 63490b661123Smrg ;; 63500b661123Smrg 63510b661123Smrg *) 63520b661123Smrg func_fatal_configuration "unknown library version type \`$version_type'" 63530b661123Smrg ;; 63540b661123Smrg esac 63550b661123Smrg 63560b661123Smrg # Clear the version info if we defaulted, and they specified a release. 63570b661123Smrg if test -z "$vinfo" && test -n "$release"; then 63580b661123Smrg major= 63590b661123Smrg case $version_type in 63600b661123Smrg darwin) 63610b661123Smrg # we can't check for "0.0" in archive_cmds due to quoting 63620b661123Smrg # problems, so we reset it completely 63630b661123Smrg verstring= 63640b661123Smrg ;; 63650b661123Smrg *) 63660b661123Smrg verstring="0.0" 63670b661123Smrg ;; 63680b661123Smrg esac 63690b661123Smrg if test "$need_version" = no; then 63700b661123Smrg versuffix= 63710b661123Smrg else 63720b661123Smrg versuffix=".0.0" 63730b661123Smrg fi 63740b661123Smrg fi 63750b661123Smrg 63760b661123Smrg # Remove version info from name if versioning should be avoided 63770b661123Smrg if test "$avoid_version" = yes && test "$need_version" = no; then 63780b661123Smrg major= 63790b661123Smrg versuffix= 63800b661123Smrg verstring="" 63810b661123Smrg fi 63820b661123Smrg 63830b661123Smrg # Check to see if the archive will have undefined symbols. 63840b661123Smrg if test "$allow_undefined" = yes; then 63850b661123Smrg if test "$allow_undefined_flag" = unsupported; then 63860b661123Smrg func_warning "undefined symbols not allowed in $host shared libraries" 63870b661123Smrg build_libtool_libs=no 63880b661123Smrg build_old_libs=yes 63890b661123Smrg fi 63900b661123Smrg else 63910b661123Smrg # Don't allow undefined symbols. 63920b661123Smrg allow_undefined_flag="$no_undefined_flag" 63930b661123Smrg fi 63940b661123Smrg 63950b661123Smrg fi 63960b661123Smrg 63970b661123Smrg func_generate_dlsyms "$libname" "$libname" "yes" 63980b661123Smrg libobjs="$libobjs $symfileobj" 63990b661123Smrg test "X$libobjs" = "X " && libobjs= 64000b661123Smrg 64010b661123Smrg if test "$mode" != relink; then 64020b661123Smrg # Remove our outputs, but don't remove object files since they 64030b661123Smrg # may have been created when compiling PIC objects. 64040b661123Smrg removelist= 64050b661123Smrg tempremovelist=`$ECHO "$output_objdir/*"` 64060b661123Smrg for p in $tempremovelist; do 64070b661123Smrg case $p in 64080b661123Smrg *.$objext | *.gcno) 64090b661123Smrg ;; 64100b661123Smrg $output_objdir/$outputname | $output_objdir/$libname.* | $output_objdir/${libname}${release}.*) 64110b661123Smrg if test "X$precious_files_regex" != "X"; then 64120b661123Smrg if $ECHO "$p" | $EGREP -e "$precious_files_regex" >/dev/null 2>&1 64130b661123Smrg then 64140b661123Smrg continue 64150b661123Smrg fi 64160b661123Smrg fi 64170b661123Smrg removelist="$removelist $p" 64180b661123Smrg ;; 64190b661123Smrg *) ;; 64200b661123Smrg esac 64210b661123Smrg done 64220b661123Smrg test -n "$removelist" && \ 64230b661123Smrg func_show_eval "${RM}r \$removelist" 64240b661123Smrg fi 64250b661123Smrg 64260b661123Smrg # Now set the variables for building old libraries. 64270b661123Smrg if test "$build_old_libs" = yes && test "$build_libtool_libs" != convenience ; then 64280b661123Smrg oldlibs="$oldlibs $output_objdir/$libname.$libext" 64290b661123Smrg 64300b661123Smrg # Transform .lo files to .o files. 64310b661123Smrg oldobjs="$objs "`$ECHO "X$libobjs" | $SP2NL | $Xsed -e '/\.'${libext}'$/d' -e "$lo2o" | $NL2SP` 64320b661123Smrg fi 64330b661123Smrg 64340b661123Smrg # Eliminate all temporary directories. 64350b661123Smrg #for path in $notinst_path; do 64360b661123Smrg # lib_search_path=`$ECHO "X$lib_search_path " | $Xsed -e "s% $path % %g"` 64370b661123Smrg # deplibs=`$ECHO "X$deplibs " | $Xsed -e "s% -L$path % %g"` 64380b661123Smrg # dependency_libs=`$ECHO "X$dependency_libs " | $Xsed -e "s% -L$path % %g"` 64390b661123Smrg #done 64400b661123Smrg 64410b661123Smrg if test -n "$xrpath"; then 64420b661123Smrg # If the user specified any rpath flags, then add them. 64430b661123Smrg temp_xrpath= 64440b661123Smrg for libdir in $xrpath; do 64450b661123Smrg temp_xrpath="$temp_xrpath -R$libdir" 64460b661123Smrg case "$finalize_rpath " in 64470b661123Smrg *" $libdir "*) ;; 64480b661123Smrg *) finalize_rpath="$finalize_rpath $libdir" ;; 64490b661123Smrg esac 64500b661123Smrg done 64510b661123Smrg if test "$hardcode_into_libs" != yes || test "$build_old_libs" = yes; then 64520b661123Smrg dependency_libs="$temp_xrpath $dependency_libs" 64530b661123Smrg fi 64540b661123Smrg fi 64550b661123Smrg 64560b661123Smrg # Make sure dlfiles contains only unique files that won't be dlpreopened 64570b661123Smrg old_dlfiles="$dlfiles" 64580b661123Smrg dlfiles= 64590b661123Smrg for lib in $old_dlfiles; do 64600b661123Smrg case " $dlprefiles $dlfiles " in 64610b661123Smrg *" $lib "*) ;; 64620b661123Smrg *) dlfiles="$dlfiles $lib" ;; 64630b661123Smrg esac 64640b661123Smrg done 64650b661123Smrg 64660b661123Smrg # Make sure dlprefiles contains only unique files 64670b661123Smrg old_dlprefiles="$dlprefiles" 64680b661123Smrg dlprefiles= 64690b661123Smrg for lib in $old_dlprefiles; do 64700b661123Smrg case "$dlprefiles " in 64710b661123Smrg *" $lib "*) ;; 64720b661123Smrg *) dlprefiles="$dlprefiles $lib" ;; 64730b661123Smrg esac 64740b661123Smrg done 64750b661123Smrg 64760b661123Smrg if test "$build_libtool_libs" = yes; then 64770b661123Smrg if test -n "$rpath"; then 64780b661123Smrg case $host in 64790b661123Smrg *-*-cygwin* | *-*-mingw* | *-*-pw32* | *-*-os2* | *-*-beos* | *-cegcc*) 64800b661123Smrg # these systems don't actually have a c library (as such)! 64810b661123Smrg ;; 64820b661123Smrg *-*-rhapsody* | *-*-darwin1.[012]) 64830b661123Smrg # Rhapsody C library is in the System framework 64840b661123Smrg deplibs="$deplibs System.ltframework" 64850b661123Smrg ;; 64860b661123Smrg *-*-netbsd*) 64870b661123Smrg # Don't link with libc until the a.out ld.so is fixed. 64880b661123Smrg ;; 64890b661123Smrg *-*-openbsd* | *-*-freebsd* | *-*-dragonfly*) 64900b661123Smrg # Do not include libc due to us having libc/libc_r. 64910b661123Smrg ;; 64920b661123Smrg *-*-sco3.2v5* | *-*-sco5v6*) 64930b661123Smrg # Causes problems with __ctype 64940b661123Smrg ;; 64950b661123Smrg *-*-sysv4.2uw2* | *-*-sysv5* | *-*-unixware* | *-*-OpenUNIX*) 64960b661123Smrg # Compiler inserts libc in the correct place for threads to work 64970b661123Smrg ;; 64980b661123Smrg *) 64990b661123Smrg # Add libc to deplibs on all other systems if necessary. 65000b661123Smrg if test "$build_libtool_need_lc" = "yes"; then 65010b661123Smrg deplibs="$deplibs -lc" 65020b661123Smrg fi 65030b661123Smrg ;; 65040b661123Smrg esac 65050b661123Smrg fi 65060b661123Smrg 65070b661123Smrg # Transform deplibs into only deplibs that can be linked in shared. 65080b661123Smrg name_save=$name 65090b661123Smrg libname_save=$libname 65100b661123Smrg release_save=$release 65110b661123Smrg versuffix_save=$versuffix 65120b661123Smrg major_save=$major 65130b661123Smrg # I'm not sure if I'm treating the release correctly. I think 65140b661123Smrg # release should show up in the -l (ie -lgmp5) so we don't want to 65150b661123Smrg # add it in twice. Is that correct? 65160b661123Smrg release="" 65170b661123Smrg versuffix="" 65180b661123Smrg major="" 65190b661123Smrg newdeplibs= 65200b661123Smrg droppeddeps=no 65210b661123Smrg case $deplibs_check_method in 65220b661123Smrg pass_all) 65230b661123Smrg # Don't check for shared/static. Everything works. 65240b661123Smrg # This might be a little naive. We might want to check 65250b661123Smrg # whether the library exists or not. But this is on 65260b661123Smrg # osf3 & osf4 and I'm not really sure... Just 65270b661123Smrg # implementing what was already the behavior. 65280b661123Smrg newdeplibs=$deplibs 65290b661123Smrg ;; 65300b661123Smrg test_compile) 65310b661123Smrg # This code stresses the "libraries are programs" paradigm to its 65320b661123Smrg # limits. Maybe even breaks it. We compile a program, linking it 65330b661123Smrg # against the deplibs as a proxy for the library. Then we can check 65340b661123Smrg # whether they linked in statically or dynamically with ldd. 65350b661123Smrg $opt_dry_run || $RM conftest.c 65360b661123Smrg cat > conftest.c <<EOF 65370b661123Smrg int main() { return 0; } 65380b661123SmrgEOF 65390b661123Smrg $opt_dry_run || $RM conftest 65400b661123Smrg if $LTCC $LTCFLAGS -o conftest conftest.c $deplibs; then 65410b661123Smrg ldd_output=`ldd conftest` 65420b661123Smrg for i in $deplibs; do 65430b661123Smrg case $i in 65440b661123Smrg -l*) 65450b661123Smrg func_stripname -l '' "$i" 65460b661123Smrg name=$func_stripname_result 65470b661123Smrg if test "X$allow_libtool_libs_with_static_runtimes" = "Xyes" ; then 65480b661123Smrg case " $predeps $postdeps " in 65490b661123Smrg *" $i "*) 65500b661123Smrg newdeplibs="$newdeplibs $i" 65510b661123Smrg i="" 65520b661123Smrg ;; 65530b661123Smrg esac 65540b661123Smrg fi 65550b661123Smrg if test -n "$i" ; then 65560b661123Smrg libname=`eval "\\$ECHO \"$libname_spec\""` 65570b661123Smrg deplib_matches=`eval "\\$ECHO \"$library_names_spec\""` 65580b661123Smrg set dummy $deplib_matches; shift 65590b661123Smrg deplib_match=$1 65600b661123Smrg if test `expr "$ldd_output" : ".*$deplib_match"` -ne 0 ; then 65610b661123Smrg newdeplibs="$newdeplibs $i" 65620b661123Smrg else 65630b661123Smrg droppeddeps=yes 65640b661123Smrg $ECHO 65650b661123Smrg $ECHO "*** Warning: dynamic linker does not accept needed library $i." 65660b661123Smrg $ECHO "*** I have the capability to make that library automatically link in when" 65670b661123Smrg $ECHO "*** you link to this library. But I can only do this if you have a" 65680b661123Smrg $ECHO "*** shared version of the library, which I believe you do not have" 65690b661123Smrg $ECHO "*** because a test_compile did reveal that the linker did not use it for" 65700b661123Smrg $ECHO "*** its dynamic dependency list that programs get resolved with at runtime." 65710b661123Smrg fi 65720b661123Smrg fi 65730b661123Smrg ;; 65740b661123Smrg *) 65750b661123Smrg newdeplibs="$newdeplibs $i" 65760b661123Smrg ;; 65770b661123Smrg esac 65780b661123Smrg done 65790b661123Smrg else 65800b661123Smrg # Error occurred in the first compile. Let's try to salvage 65810b661123Smrg # the situation: Compile a separate program for each library. 65820b661123Smrg for i in $deplibs; do 65830b661123Smrg case $i in 65840b661123Smrg -l*) 65850b661123Smrg func_stripname -l '' "$i" 65860b661123Smrg name=$func_stripname_result 65870b661123Smrg $opt_dry_run || $RM conftest 65880b661123Smrg if $LTCC $LTCFLAGS -o conftest conftest.c $i; then 65890b661123Smrg ldd_output=`ldd conftest` 65900b661123Smrg if test "X$allow_libtool_libs_with_static_runtimes" = "Xyes" ; then 65910b661123Smrg case " $predeps $postdeps " in 65920b661123Smrg *" $i "*) 65930b661123Smrg newdeplibs="$newdeplibs $i" 65940b661123Smrg i="" 65950b661123Smrg ;; 65960b661123Smrg esac 65970b661123Smrg fi 65980b661123Smrg if test -n "$i" ; then 65990b661123Smrg libname=`eval "\\$ECHO \"$libname_spec\""` 66000b661123Smrg deplib_matches=`eval "\\$ECHO \"$library_names_spec\""` 66010b661123Smrg set dummy $deplib_matches; shift 66020b661123Smrg deplib_match=$1 66030b661123Smrg if test `expr "$ldd_output" : ".*$deplib_match"` -ne 0 ; then 66040b661123Smrg newdeplibs="$newdeplibs $i" 66050b661123Smrg else 66060b661123Smrg droppeddeps=yes 66070b661123Smrg $ECHO 66080b661123Smrg $ECHO "*** Warning: dynamic linker does not accept needed library $i." 66090b661123Smrg $ECHO "*** I have the capability to make that library automatically link in when" 66100b661123Smrg $ECHO "*** you link to this library. But I can only do this if you have a" 66110b661123Smrg $ECHO "*** shared version of the library, which you do not appear to have" 66120b661123Smrg $ECHO "*** because a test_compile did reveal that the linker did not use this one" 66130b661123Smrg $ECHO "*** as a dynamic dependency that programs can get resolved with at runtime." 66140b661123Smrg fi 66150b661123Smrg fi 66160b661123Smrg else 66170b661123Smrg droppeddeps=yes 66180b661123Smrg $ECHO 66190b661123Smrg $ECHO "*** Warning! Library $i is needed by this library but I was not able to" 66200b661123Smrg $ECHO "*** make it link in! You will probably need to install it or some" 66210b661123Smrg $ECHO "*** library that it depends on before this library will be fully" 66220b661123Smrg $ECHO "*** functional. Installing it before continuing would be even better." 66230b661123Smrg fi 66240b661123Smrg ;; 66250b661123Smrg *) 66260b661123Smrg newdeplibs="$newdeplibs $i" 66270b661123Smrg ;; 66280b661123Smrg esac 66290b661123Smrg done 66300b661123Smrg fi 66310b661123Smrg ;; 66320b661123Smrg file_magic*) 66330b661123Smrg set dummy $deplibs_check_method; shift 66340b661123Smrg file_magic_regex=`expr "$deplibs_check_method" : "$1 \(.*\)"` 66350b661123Smrg for a_deplib in $deplibs; do 66360b661123Smrg case $a_deplib in 66370b661123Smrg -l*) 66380b661123Smrg func_stripname -l '' "$a_deplib" 66390b661123Smrg name=$func_stripname_result 66400b661123Smrg if test "X$allow_libtool_libs_with_static_runtimes" = "Xyes" ; then 66410b661123Smrg case " $predeps $postdeps " in 66420b661123Smrg *" $a_deplib "*) 66430b661123Smrg newdeplibs="$newdeplibs $a_deplib" 66440b661123Smrg a_deplib="" 66450b661123Smrg ;; 66460b661123Smrg esac 66470b661123Smrg fi 66480b661123Smrg if test -n "$a_deplib" ; then 66490b661123Smrg libname=`eval "\\$ECHO \"$libname_spec\""` 66500b661123Smrg for i in $lib_search_path $sys_lib_search_path $shlib_search_path; do 66510b661123Smrg potential_libs=`ls $i/$libname[.-]* 2>/dev/null` 66520b661123Smrg for potent_lib in $potential_libs; do 66530b661123Smrg # Follow soft links. 66540b661123Smrg if ls -lLd "$potent_lib" 2>/dev/null | 66550b661123Smrg $GREP " -> " >/dev/null; then 66560b661123Smrg continue 66570b661123Smrg fi 66580b661123Smrg # The statement above tries to avoid entering an 66590b661123Smrg # endless loop below, in case of cyclic links. 66600b661123Smrg # We might still enter an endless loop, since a link 66610b661123Smrg # loop can be closed while we follow links, 66620b661123Smrg # but so what? 66630b661123Smrg potlib="$potent_lib" 66640b661123Smrg while test -h "$potlib" 2>/dev/null; do 66650b661123Smrg potliblink=`ls -ld $potlib | ${SED} 's/.* -> //'` 66660b661123Smrg case $potliblink in 66670b661123Smrg [\\/]* | [A-Za-z]:[\\/]*) potlib="$potliblink";; 66680b661123Smrg *) potlib=`$ECHO "X$potlib" | $Xsed -e 's,[^/]*$,,'`"$potliblink";; 66690b661123Smrg esac 66700b661123Smrg done 66710b661123Smrg if eval $file_magic_cmd \"\$potlib\" 2>/dev/null | 66720b661123Smrg $SED -e 10q | 66730b661123Smrg $EGREP "$file_magic_regex" > /dev/null; then 66740b661123Smrg newdeplibs="$newdeplibs $a_deplib" 66750b661123Smrg a_deplib="" 66760b661123Smrg break 2 66770b661123Smrg fi 66780b661123Smrg done 66790b661123Smrg done 66800b661123Smrg fi 66810b661123Smrg if test -n "$a_deplib" ; then 66820b661123Smrg droppeddeps=yes 66830b661123Smrg $ECHO 66840b661123Smrg $ECHO "*** Warning: linker path does not have real file for library $a_deplib." 66850b661123Smrg $ECHO "*** I have the capability to make that library automatically link in when" 66860b661123Smrg $ECHO "*** you link to this library. But I can only do this if you have a" 66870b661123Smrg $ECHO "*** shared version of the library, which you do not appear to have" 66880b661123Smrg $ECHO "*** because I did check the linker path looking for a file starting" 66890b661123Smrg if test -z "$potlib" ; then 66900b661123Smrg $ECHO "*** with $libname but no candidates were found. (...for file magic test)" 66910b661123Smrg else 66920b661123Smrg $ECHO "*** with $libname and none of the candidates passed a file format test" 66930b661123Smrg $ECHO "*** using a file magic. Last file checked: $potlib" 66940b661123Smrg fi 66950b661123Smrg fi 66960b661123Smrg ;; 66970b661123Smrg *) 66980b661123Smrg # Add a -L argument. 66990b661123Smrg newdeplibs="$newdeplibs $a_deplib" 67000b661123Smrg ;; 67010b661123Smrg esac 67020b661123Smrg done # Gone through all deplibs. 67030b661123Smrg ;; 67040b661123Smrg match_pattern*) 67050b661123Smrg set dummy $deplibs_check_method; shift 67060b661123Smrg match_pattern_regex=`expr "$deplibs_check_method" : "$1 \(.*\)"` 67070b661123Smrg for a_deplib in $deplibs; do 67080b661123Smrg case $a_deplib in 67090b661123Smrg -l*) 67100b661123Smrg func_stripname -l '' "$a_deplib" 67110b661123Smrg name=$func_stripname_result 67120b661123Smrg if test "X$allow_libtool_libs_with_static_runtimes" = "Xyes" ; then 67130b661123Smrg case " $predeps $postdeps " in 67140b661123Smrg *" $a_deplib "*) 67150b661123Smrg newdeplibs="$newdeplibs $a_deplib" 67160b661123Smrg a_deplib="" 67170b661123Smrg ;; 67180b661123Smrg esac 67190b661123Smrg fi 67200b661123Smrg if test -n "$a_deplib" ; then 67210b661123Smrg libname=`eval "\\$ECHO \"$libname_spec\""` 67220b661123Smrg for i in $lib_search_path $sys_lib_search_path $shlib_search_path; do 67230b661123Smrg potential_libs=`ls $i/$libname[.-]* 2>/dev/null` 67240b661123Smrg for potent_lib in $potential_libs; do 67250b661123Smrg potlib="$potent_lib" # see symlink-check above in file_magic test 67260b661123Smrg if eval "\$ECHO \"X$potent_lib\"" 2>/dev/null | $Xsed -e 10q | \ 67270b661123Smrg $EGREP "$match_pattern_regex" > /dev/null; then 67280b661123Smrg newdeplibs="$newdeplibs $a_deplib" 67290b661123Smrg a_deplib="" 67300b661123Smrg break 2 67310b661123Smrg fi 67320b661123Smrg done 67330b661123Smrg done 67340b661123Smrg fi 67350b661123Smrg if test -n "$a_deplib" ; then 67360b661123Smrg droppeddeps=yes 67370b661123Smrg $ECHO 67380b661123Smrg $ECHO "*** Warning: linker path does not have real file for library $a_deplib." 67390b661123Smrg $ECHO "*** I have the capability to make that library automatically link in when" 67400b661123Smrg $ECHO "*** you link to this library. But I can only do this if you have a" 67410b661123Smrg $ECHO "*** shared version of the library, which you do not appear to have" 67420b661123Smrg $ECHO "*** because I did check the linker path looking for a file starting" 67430b661123Smrg if test -z "$potlib" ; then 67440b661123Smrg $ECHO "*** with $libname but no candidates were found. (...for regex pattern test)" 67450b661123Smrg else 67460b661123Smrg $ECHO "*** with $libname and none of the candidates passed a file format test" 67470b661123Smrg $ECHO "*** using a regex pattern. Last file checked: $potlib" 67480b661123Smrg fi 67490b661123Smrg fi 67500b661123Smrg ;; 67510b661123Smrg *) 67520b661123Smrg # Add a -L argument. 67530b661123Smrg newdeplibs="$newdeplibs $a_deplib" 67540b661123Smrg ;; 67550b661123Smrg esac 67560b661123Smrg done # Gone through all deplibs. 67570b661123Smrg ;; 67580b661123Smrg none | unknown | *) 67590b661123Smrg newdeplibs="" 67600b661123Smrg tmp_deplibs=`$ECHO "X $deplibs" | $Xsed \ 67610b661123Smrg -e 's/ -lc$//' -e 's/ -[LR][^ ]*//g'` 67620b661123Smrg if test "X$allow_libtool_libs_with_static_runtimes" = "Xyes" ; then 67630b661123Smrg for i in $predeps $postdeps ; do 67640b661123Smrg # can't use Xsed below, because $i might contain '/' 67650b661123Smrg tmp_deplibs=`$ECHO "X $tmp_deplibs" | $Xsed -e "s,$i,,"` 67660b661123Smrg done 67670b661123Smrg fi 67680b661123Smrg if $ECHO "X $tmp_deplibs" | $Xsed -e 's/[ ]//g' | 67690b661123Smrg $GREP . >/dev/null; then 67700b661123Smrg $ECHO 67710b661123Smrg if test "X$deplibs_check_method" = "Xnone"; then 67720b661123Smrg $ECHO "*** Warning: inter-library dependencies are not supported in this platform." 67730b661123Smrg else 67740b661123Smrg $ECHO "*** Warning: inter-library dependencies are not known to be supported." 67750b661123Smrg fi 67760b661123Smrg $ECHO "*** All declared inter-library dependencies are being dropped." 67770b661123Smrg droppeddeps=yes 67780b661123Smrg fi 67790b661123Smrg ;; 67800b661123Smrg esac 67810b661123Smrg versuffix=$versuffix_save 67820b661123Smrg major=$major_save 67830b661123Smrg release=$release_save 67840b661123Smrg libname=$libname_save 67850b661123Smrg name=$name_save 67860b661123Smrg 67870b661123Smrg case $host in 67880b661123Smrg *-*-rhapsody* | *-*-darwin1.[012]) 67890b661123Smrg # On Rhapsody replace the C library with the System framework 67900b661123Smrg newdeplibs=`$ECHO "X $newdeplibs" | $Xsed -e 's/ -lc / System.ltframework /'` 67910b661123Smrg ;; 67920b661123Smrg esac 67930b661123Smrg 67940b661123Smrg if test "$droppeddeps" = yes; then 67950b661123Smrg if test "$module" = yes; then 67960b661123Smrg $ECHO 67970b661123Smrg $ECHO "*** Warning: libtool could not satisfy all declared inter-library" 67980b661123Smrg $ECHO "*** dependencies of module $libname. Therefore, libtool will create" 67990b661123Smrg $ECHO "*** a static module, that should work as long as the dlopening" 68000b661123Smrg $ECHO "*** application is linked with the -dlopen flag." 68010b661123Smrg if test -z "$global_symbol_pipe"; then 68020b661123Smrg $ECHO 68030b661123Smrg $ECHO "*** However, this would only work if libtool was able to extract symbol" 68040b661123Smrg $ECHO "*** lists from a program, using \`nm' or equivalent, but libtool could" 68050b661123Smrg $ECHO "*** not find such a program. So, this module is probably useless." 68060b661123Smrg $ECHO "*** \`nm' from GNU binutils and a full rebuild may help." 68070b661123Smrg fi 68080b661123Smrg if test "$build_old_libs" = no; then 68090b661123Smrg oldlibs="$output_objdir/$libname.$libext" 68100b661123Smrg build_libtool_libs=module 68110b661123Smrg build_old_libs=yes 68120b661123Smrg else 68130b661123Smrg build_libtool_libs=no 68140b661123Smrg fi 68150b661123Smrg else 68160b661123Smrg $ECHO "*** The inter-library dependencies that have been dropped here will be" 68170b661123Smrg $ECHO "*** automatically added whenever a program is linked with this library" 68180b661123Smrg $ECHO "*** or is declared to -dlopen it." 68190b661123Smrg 68200b661123Smrg if test "$allow_undefined" = no; then 68210b661123Smrg $ECHO 68220b661123Smrg $ECHO "*** Since this library must not contain undefined symbols," 68230b661123Smrg $ECHO "*** because either the platform does not support them or" 68240b661123Smrg $ECHO "*** it was explicitly requested with -no-undefined," 68250b661123Smrg $ECHO "*** libtool will only create a static version of it." 68260b661123Smrg if test "$build_old_libs" = no; then 68270b661123Smrg oldlibs="$output_objdir/$libname.$libext" 68280b661123Smrg build_libtool_libs=module 68290b661123Smrg build_old_libs=yes 68300b661123Smrg else 68310b661123Smrg build_libtool_libs=no 68320b661123Smrg fi 68330b661123Smrg fi 68340b661123Smrg fi 68350b661123Smrg fi 68360b661123Smrg # Done checking deplibs! 68370b661123Smrg deplibs=$newdeplibs 68380b661123Smrg fi 68390b661123Smrg # Time to change all our "foo.ltframework" stuff back to "-framework foo" 68400b661123Smrg case $host in 68410b661123Smrg *-*-darwin*) 68420b661123Smrg newdeplibs=`$ECHO "X $newdeplibs" | $Xsed -e 's% \([^ $]*\).ltframework% -framework \1%g'` 68430b661123Smrg new_inherited_linker_flags=`$ECHO "X $new_inherited_linker_flags" | $Xsed -e 's% \([^ $]*\).ltframework% -framework \1%g'` 68440b661123Smrg deplibs=`$ECHO "X $deplibs" | $Xsed -e 's% \([^ $]*\).ltframework% -framework \1%g'` 68450b661123Smrg ;; 68460b661123Smrg esac 68470b661123Smrg 68480b661123Smrg # move library search paths that coincide with paths to not yet 68490b661123Smrg # installed libraries to the beginning of the library search list 68500b661123Smrg new_libs= 68510b661123Smrg for path in $notinst_path; do 68520b661123Smrg case " $new_libs " in 68530b661123Smrg *" -L$path/$objdir "*) ;; 68540b661123Smrg *) 68550b661123Smrg case " $deplibs " in 68560b661123Smrg *" -L$path/$objdir "*) 68570b661123Smrg new_libs="$new_libs -L$path/$objdir" ;; 68580b661123Smrg esac 68590b661123Smrg ;; 68600b661123Smrg esac 68610b661123Smrg done 68620b661123Smrg for deplib in $deplibs; do 68630b661123Smrg case $deplib in 68640b661123Smrg -L*) 68650b661123Smrg case " $new_libs " in 68660b661123Smrg *" $deplib "*) ;; 68670b661123Smrg *) new_libs="$new_libs $deplib" ;; 68680b661123Smrg esac 68690b661123Smrg ;; 68700b661123Smrg *) new_libs="$new_libs $deplib" ;; 68710b661123Smrg esac 68720b661123Smrg done 68730b661123Smrg deplibs="$new_libs" 68740b661123Smrg 68750b661123Smrg # All the library-specific variables (install_libdir is set above). 68760b661123Smrg library_names= 68770b661123Smrg old_library= 68780b661123Smrg dlname= 68790b661123Smrg 68800b661123Smrg # Test again, we may have decided not to build it any more 68810b661123Smrg if test "$build_libtool_libs" = yes; then 68820b661123Smrg if test "$hardcode_into_libs" = yes; then 68830b661123Smrg # Hardcode the library paths 68840b661123Smrg hardcode_libdirs= 68850b661123Smrg dep_rpath= 68860b661123Smrg rpath="$finalize_rpath" 68870b661123Smrg test "$mode" != relink && rpath="$compile_rpath$rpath" 68880b661123Smrg for libdir in $rpath; do 68890b661123Smrg if test -n "$hardcode_libdir_flag_spec"; then 68900b661123Smrg if test -n "$hardcode_libdir_separator"; then 68910b661123Smrg if test -z "$hardcode_libdirs"; then 68920b661123Smrg hardcode_libdirs="$libdir" 68930b661123Smrg else 68940b661123Smrg # Just accumulate the unique libdirs. 68950b661123Smrg case $hardcode_libdir_separator$hardcode_libdirs$hardcode_libdir_separator in 68960b661123Smrg *"$hardcode_libdir_separator$libdir$hardcode_libdir_separator"*) 68970b661123Smrg ;; 68980b661123Smrg *) 68990b661123Smrg hardcode_libdirs="$hardcode_libdirs$hardcode_libdir_separator$libdir" 69000b661123Smrg ;; 69010b661123Smrg esac 69020b661123Smrg fi 69030b661123Smrg else 69040b661123Smrg eval flag=\"$hardcode_libdir_flag_spec\" 69050b661123Smrg dep_rpath="$dep_rpath $flag" 69060b661123Smrg fi 69070b661123Smrg elif test -n "$runpath_var"; then 69080b661123Smrg case "$perm_rpath " in 69090b661123Smrg *" $libdir "*) ;; 69100b661123Smrg *) perm_rpath="$perm_rpath $libdir" ;; 69110b661123Smrg esac 69120b661123Smrg fi 69130b661123Smrg done 69140b661123Smrg # Substitute the hardcoded libdirs into the rpath. 69150b661123Smrg if test -n "$hardcode_libdir_separator" && 69160b661123Smrg test -n "$hardcode_libdirs"; then 69170b661123Smrg libdir="$hardcode_libdirs" 69180b661123Smrg if test -n "$hardcode_libdir_flag_spec_ld"; then 69190b661123Smrg eval dep_rpath=\"$hardcode_libdir_flag_spec_ld\" 69200b661123Smrg else 69210b661123Smrg eval dep_rpath=\"$hardcode_libdir_flag_spec\" 69220b661123Smrg fi 69230b661123Smrg fi 69240b661123Smrg if test -n "$runpath_var" && test -n "$perm_rpath"; then 69250b661123Smrg # We should set the runpath_var. 69260b661123Smrg rpath= 69270b661123Smrg for dir in $perm_rpath; do 69280b661123Smrg rpath="$rpath$dir:" 69290b661123Smrg done 69300b661123Smrg eval "$runpath_var='$rpath\$$runpath_var'; export $runpath_var" 69310b661123Smrg fi 69320b661123Smrg test -n "$dep_rpath" && deplibs="$dep_rpath $deplibs" 69330b661123Smrg fi 6934bdcaa8d0Smrg 69350b661123Smrg shlibpath="$finalize_shlibpath" 69360b661123Smrg test "$mode" != relink && shlibpath="$compile_shlibpath$shlibpath" 69370b661123Smrg if test -n "$shlibpath"; then 69380b661123Smrg eval "$shlibpath_var='$shlibpath\$$shlibpath_var'; export $shlibpath_var" 69390b661123Smrg fi 6940bdcaa8d0Smrg 69410b661123Smrg # Get the real and link names of the library. 69420b661123Smrg eval shared_ext=\"$shrext_cmds\" 69430b661123Smrg eval library_names=\"$library_names_spec\" 69440b661123Smrg set dummy $library_names 69450b661123Smrg shift 69460b661123Smrg realname="$1" 69470b661123Smrg shift 6948bdcaa8d0Smrg 69490b661123Smrg if test -n "$soname_spec"; then 69500b661123Smrg eval soname=\"$soname_spec\" 69510b661123Smrg else 69520b661123Smrg soname="$realname" 69530b661123Smrg fi 69540b661123Smrg if test -z "$dlname"; then 69550b661123Smrg dlname=$soname 69560b661123Smrg fi 6957bdcaa8d0Smrg 69580b661123Smrg lib="$output_objdir/$realname" 69590b661123Smrg linknames= 69600b661123Smrg for link 69610b661123Smrg do 69620b661123Smrg linknames="$linknames $link" 69630b661123Smrg done 6964bdcaa8d0Smrg 69650b661123Smrg # Use standard objects if they are pic 69660b661123Smrg test -z "$pic_flag" && libobjs=`$ECHO "X$libobjs" | $SP2NL | $Xsed -e "$lo2o" | $NL2SP` 69670b661123Smrg test "X$libobjs" = "X " && libobjs= 6968bdcaa8d0Smrg 69690b661123Smrg delfiles= 69700b661123Smrg if test -n "$export_symbols" && test -n "$include_expsyms"; then 69710b661123Smrg $opt_dry_run || cp "$export_symbols" "$output_objdir/$libname.uexp" 69720b661123Smrg export_symbols="$output_objdir/$libname.uexp" 69730b661123Smrg delfiles="$delfiles $export_symbols" 69740b661123Smrg fi 6975bdcaa8d0Smrg 69760b661123Smrg orig_export_symbols= 69770b661123Smrg case $host_os in 69780b661123Smrg cygwin* | mingw* | cegcc*) 69790b661123Smrg if test -n "$export_symbols" && test -z "$export_symbols_regex"; then 69800b661123Smrg # exporting using user supplied symfile 69810b661123Smrg if test "x`$SED 1q $export_symbols`" != xEXPORTS; then 69820b661123Smrg # and it's NOT already a .def file. Must figure out 69830b661123Smrg # which of the given symbols are data symbols and tag 69840b661123Smrg # them as such. So, trigger use of export_symbols_cmds. 69850b661123Smrg # export_symbols gets reassigned inside the "prepare 69860b661123Smrg # the list of exported symbols" if statement, so the 69870b661123Smrg # include_expsyms logic still works. 69880b661123Smrg orig_export_symbols="$export_symbols" 69890b661123Smrg export_symbols= 69900b661123Smrg always_export_symbols=yes 69910b661123Smrg fi 69920b661123Smrg fi 69930b661123Smrg ;; 69940b661123Smrg esac 6995bdcaa8d0Smrg 69960b661123Smrg # Prepare the list of exported symbols 69970b661123Smrg if test -z "$export_symbols"; then 69980b661123Smrg if test "$always_export_symbols" = yes || test -n "$export_symbols_regex"; then 69990b661123Smrg func_verbose "generating symbol list for \`$libname.la'" 70000b661123Smrg export_symbols="$output_objdir/$libname.exp" 70010b661123Smrg $opt_dry_run || $RM $export_symbols 70020b661123Smrg cmds=$export_symbols_cmds 70030b661123Smrg save_ifs="$IFS"; IFS='~' 70040b661123Smrg for cmd in $cmds; do 70050b661123Smrg IFS="$save_ifs" 70060b661123Smrg eval cmd=\"$cmd\" 70070b661123Smrg func_len " $cmd" 70080b661123Smrg len=$func_len_result 70090b661123Smrg if test "$len" -lt "$max_cmd_len" || test "$max_cmd_len" -le -1; then 70100b661123Smrg func_show_eval "$cmd" 'exit $?' 70110b661123Smrg skipped_export=false 70120b661123Smrg else 70130b661123Smrg # The command line is too long to execute in one step. 70140b661123Smrg func_verbose "using reloadable object file for export list..." 70150b661123Smrg skipped_export=: 70160b661123Smrg # Break out early, otherwise skipped_export may be 70170b661123Smrg # set to false by a later but shorter cmd. 70180b661123Smrg break 70190b661123Smrg fi 70200b661123Smrg done 70210b661123Smrg IFS="$save_ifs" 70220b661123Smrg if test -n "$export_symbols_regex" && test "X$skipped_export" != "X:"; then 70230b661123Smrg func_show_eval '$EGREP -e "$export_symbols_regex" "$export_symbols" > "${export_symbols}T"' 70240b661123Smrg func_show_eval '$MV "${export_symbols}T" "$export_symbols"' 70250b661123Smrg fi 70260b661123Smrg fi 702772313efbSmrg fi 7028bdcaa8d0Smrg 70290b661123Smrg if test -n "$export_symbols" && test -n "$include_expsyms"; then 70300b661123Smrg tmp_export_symbols="$export_symbols" 70310b661123Smrg test -n "$orig_export_symbols" && tmp_export_symbols="$orig_export_symbols" 70320b661123Smrg $opt_dry_run || eval '$ECHO "X$include_expsyms" | $Xsed | $SP2NL >> "$tmp_export_symbols"' 70330b661123Smrg fi 7034bdcaa8d0Smrg 70350b661123Smrg if test "X$skipped_export" != "X:" && test -n "$orig_export_symbols"; then 70360b661123Smrg # The given exports_symbols file has to be filtered, so filter it. 70370b661123Smrg func_verbose "filter symbol list for \`$libname.la' to tag DATA exports" 70380b661123Smrg # FIXME: $output_objdir/$libname.filter potentially contains lots of 70390b661123Smrg # 's' commands which not all seds can handle. GNU sed should be fine 70400b661123Smrg # though. Also, the filter scales superlinearly with the number of 70410b661123Smrg # global variables. join(1) would be nice here, but unfortunately 70420b661123Smrg # isn't a blessed tool. 70430b661123Smrg $opt_dry_run || $SED -e '/[ ,]DATA/!d;s,\(.*\)\([ \,].*\),s|^\1$|\1\2|,' < $export_symbols > $output_objdir/$libname.filter 70440b661123Smrg delfiles="$delfiles $export_symbols $output_objdir/$libname.filter" 70450b661123Smrg export_symbols=$output_objdir/$libname.def 70460b661123Smrg $opt_dry_run || $SED -f $output_objdir/$libname.filter < $orig_export_symbols > $export_symbols 70470b661123Smrg fi 7048bdcaa8d0Smrg 70490b661123Smrg tmp_deplibs= 70500b661123Smrg for test_deplib in $deplibs; do 70510b661123Smrg case " $convenience " in 70520b661123Smrg *" $test_deplib "*) ;; 70530b661123Smrg *) 70540b661123Smrg tmp_deplibs="$tmp_deplibs $test_deplib" 70550b661123Smrg ;; 70560b661123Smrg esac 70570b661123Smrg done 70580b661123Smrg deplibs="$tmp_deplibs" 7059bdcaa8d0Smrg 70600b661123Smrg if test -n "$convenience"; then 70610b661123Smrg if test -n "$whole_archive_flag_spec" && 70620b661123Smrg test "$compiler_needs_object" = yes && 70630b661123Smrg test -z "$libobjs"; then 70640b661123Smrg # extract the archives, so we have objects to list. 70650b661123Smrg # TODO: could optimize this to just extract one archive. 70660b661123Smrg whole_archive_flag_spec= 70670b661123Smrg fi 70680b661123Smrg if test -n "$whole_archive_flag_spec"; then 70690b661123Smrg save_libobjs=$libobjs 70700b661123Smrg eval libobjs=\"\$libobjs $whole_archive_flag_spec\" 70710b661123Smrg test "X$libobjs" = "X " && libobjs= 70720b661123Smrg else 70730b661123Smrg gentop="$output_objdir/${outputname}x" 70740b661123Smrg generated="$generated $gentop" 7075bdcaa8d0Smrg 70760b661123Smrg func_extract_archives $gentop $convenience 70770b661123Smrg libobjs="$libobjs $func_extract_archives_result" 70780b661123Smrg test "X$libobjs" = "X " && libobjs= 70790b661123Smrg fi 708096ce994aSmrg fi 7081bdcaa8d0Smrg 70820b661123Smrg if test "$thread_safe" = yes && test -n "$thread_safe_flag_spec"; then 70830b661123Smrg eval flag=\"$thread_safe_flag_spec\" 70840b661123Smrg linker_flags="$linker_flags $flag" 708596ce994aSmrg fi 7086bdcaa8d0Smrg 70870b661123Smrg # Make a backup of the uninstalled library when relinking 70880b661123Smrg if test "$mode" = relink; then 70890b661123Smrg $opt_dry_run || eval '(cd $output_objdir && $RM ${realname}U && $MV $realname ${realname}U)' || exit $? 70900b661123Smrg fi 7091bdcaa8d0Smrg 70920b661123Smrg # Do each of the archive commands. 70930b661123Smrg if test "$module" = yes && test -n "$module_cmds" ; then 70940b661123Smrg if test -n "$export_symbols" && test -n "$module_expsym_cmds"; then 70950b661123Smrg eval test_cmds=\"$module_expsym_cmds\" 70960b661123Smrg cmds=$module_expsym_cmds 70970b661123Smrg else 70980b661123Smrg eval test_cmds=\"$module_cmds\" 70990b661123Smrg cmds=$module_cmds 71000b661123Smrg fi 710196ce994aSmrg else 71020b661123Smrg if test -n "$export_symbols" && test -n "$archive_expsym_cmds"; then 71030b661123Smrg eval test_cmds=\"$archive_expsym_cmds\" 71040b661123Smrg cmds=$archive_expsym_cmds 71050b661123Smrg else 71060b661123Smrg eval test_cmds=\"$archive_cmds\" 71070b661123Smrg cmds=$archive_cmds 71080b661123Smrg fi 710996ce994aSmrg fi 7110bdcaa8d0Smrg 71110b661123Smrg if test "X$skipped_export" != "X:" && 71120b661123Smrg func_len " $test_cmds" && 71130b661123Smrg len=$func_len_result && 71140b661123Smrg test "$len" -lt "$max_cmd_len" || test "$max_cmd_len" -le -1; then 71150b661123Smrg : 71160b661123Smrg else 71170b661123Smrg # The command line is too long to link in one step, link piecewise 71180b661123Smrg # or, if using GNU ld and skipped_export is not :, use a linker 71190b661123Smrg # script. 7120bdcaa8d0Smrg 71210b661123Smrg # Save the value of $output and $libobjs because we want to 71220b661123Smrg # use them later. If we have whole_archive_flag_spec, we 71230b661123Smrg # want to use save_libobjs as it was before 71240b661123Smrg # whole_archive_flag_spec was expanded, because we can't 71250b661123Smrg # assume the linker understands whole_archive_flag_spec. 71260b661123Smrg # This may have to be revisited, in case too many 71270b661123Smrg # convenience libraries get linked in and end up exceeding 71280b661123Smrg # the spec. 71290b661123Smrg if test -z "$convenience" || test -z "$whole_archive_flag_spec"; then 71300b661123Smrg save_libobjs=$libobjs 71310b661123Smrg fi 71320b661123Smrg save_output=$output 71330b661123Smrg output_la=`$ECHO "X$output" | $Xsed -e "$basename"` 713472313efbSmrg 71350b661123Smrg # Clear the reloadable object creation command queue and 71360b661123Smrg # initialize k to one. 71370b661123Smrg test_cmds= 71380b661123Smrg concat_cmds= 71390b661123Smrg objlist= 71400b661123Smrg last_robj= 71410b661123Smrg k=1 71420b661123Smrg 71430b661123Smrg if test -n "$save_libobjs" && test "X$skipped_export" != "X:" && test "$with_gnu_ld" = yes; then 71440b661123Smrg output=${output_objdir}/${output_la}.lnkscript 71450b661123Smrg func_verbose "creating GNU ld script: $output" 71460b661123Smrg $ECHO 'INPUT (' > $output 71470b661123Smrg for obj in $save_libobjs 714896ce994aSmrg do 71490b661123Smrg $ECHO "$obj" >> $output 71500b661123Smrg done 71510b661123Smrg $ECHO ')' >> $output 71520b661123Smrg delfiles="$delfiles $output" 71530b661123Smrg elif test -n "$save_libobjs" && test "X$skipped_export" != "X:" && test "X$file_list_spec" != X; then 71540b661123Smrg output=${output_objdir}/${output_la}.lnk 71550b661123Smrg func_verbose "creating linker input file list: $output" 71560b661123Smrg : > $output 71570b661123Smrg set x $save_libobjs 71580b661123Smrg shift 71590b661123Smrg firstobj= 71600b661123Smrg if test "$compiler_needs_object" = yes; then 71610b661123Smrg firstobj="$1 " 71620b661123Smrg shift 71630b661123Smrg fi 71640b661123Smrg for obj 71650b661123Smrg do 71660b661123Smrg $ECHO "$obj" >> $output 71670b661123Smrg done 71680b661123Smrg delfiles="$delfiles $output" 71690b661123Smrg output=$firstobj\"$file_list_spec$output\" 71700b661123Smrg else 71710b661123Smrg if test -n "$save_libobjs"; then 71720b661123Smrg func_verbose "creating reloadable object files..." 71730b661123Smrg output=$output_objdir/$output_la-${k}.$objext 71740b661123Smrg eval test_cmds=\"$reload_cmds\" 71750b661123Smrg func_len " $test_cmds" 71760b661123Smrg len0=$func_len_result 71770b661123Smrg len=$len0 71780b661123Smrg 71790b661123Smrg # Loop over the list of objects to be linked. 71800b661123Smrg for obj in $save_libobjs 71810b661123Smrg do 71820b661123Smrg func_len " $obj" 71830b661123Smrg func_arith $len + $func_len_result 71840b661123Smrg len=$func_arith_result 71850b661123Smrg if test "X$objlist" = X || 71860b661123Smrg test "$len" -lt "$max_cmd_len"; then 71870b661123Smrg func_append objlist " $obj" 71880b661123Smrg else 71890b661123Smrg # The command $test_cmds is almost too long, add a 71900b661123Smrg # command to the queue. 71910b661123Smrg if test "$k" -eq 1 ; then 71920b661123Smrg # The first file doesn't have a previous command to add. 71930b661123Smrg eval concat_cmds=\"$reload_cmds $objlist $last_robj\" 71940b661123Smrg else 71950b661123Smrg # All subsequent reloadable object files will link in 71960b661123Smrg # the last one created. 71970b661123Smrg eval concat_cmds=\"\$concat_cmds~$reload_cmds $objlist $last_robj~\$RM $last_robj\" 71980b661123Smrg fi 71990b661123Smrg last_robj=$output_objdir/$output_la-${k}.$objext 72000b661123Smrg func_arith $k + 1 72010b661123Smrg k=$func_arith_result 72020b661123Smrg output=$output_objdir/$output_la-${k}.$objext 72030b661123Smrg objlist=$obj 72040b661123Smrg func_len " $last_robj" 72050b661123Smrg func_arith $len0 + $func_len_result 72060b661123Smrg len=$func_arith_result 72070b661123Smrg fi 72080b661123Smrg done 72090b661123Smrg # Handle the remaining objects by creating one last 72100b661123Smrg # reloadable object file. All subsequent reloadable object 72110b661123Smrg # files will link in the last one created. 72120b661123Smrg test -z "$concat_cmds" || concat_cmds=$concat_cmds~ 72130b661123Smrg eval concat_cmds=\"\${concat_cmds}$reload_cmds $objlist $last_robj\" 72140b661123Smrg if test -n "$last_robj"; then 72150b661123Smrg eval concat_cmds=\"\${concat_cmds}~\$RM $last_robj\" 72160b661123Smrg fi 72170b661123Smrg delfiles="$delfiles $output" 7218bdcaa8d0Smrg 72190b661123Smrg else 72200b661123Smrg output= 72210b661123Smrg fi 7222bdcaa8d0Smrg 72230b661123Smrg if ${skipped_export-false}; then 72240b661123Smrg func_verbose "generating symbol list for \`$libname.la'" 72250b661123Smrg export_symbols="$output_objdir/$libname.exp" 72260b661123Smrg $opt_dry_run || $RM $export_symbols 72270b661123Smrg libobjs=$output 72280b661123Smrg # Append the command to create the export file. 72290b661123Smrg test -z "$concat_cmds" || concat_cmds=$concat_cmds~ 72300b661123Smrg eval concat_cmds=\"\$concat_cmds$export_symbols_cmds\" 72310b661123Smrg if test -n "$last_robj"; then 72320b661123Smrg eval concat_cmds=\"\$concat_cmds~\$RM $last_robj\" 72330b661123Smrg fi 723472313efbSmrg fi 7235bdcaa8d0Smrg 72360b661123Smrg test -n "$save_libobjs" && 72370b661123Smrg func_verbose "creating a temporary reloadable object file: $output" 7238bdcaa8d0Smrg 72390b661123Smrg # Loop through the commands generated above and execute them. 72400b661123Smrg save_ifs="$IFS"; IFS='~' 72410b661123Smrg for cmd in $concat_cmds; do 72420b661123Smrg IFS="$save_ifs" 72430b661123Smrg $opt_silent || { 72440b661123Smrg func_quote_for_expand "$cmd" 72450b661123Smrg eval "func_echo $func_quote_for_expand_result" 72460b661123Smrg } 72470b661123Smrg $opt_dry_run || eval "$cmd" || { 72480b661123Smrg lt_exit=$? 72490b661123Smrg 72500b661123Smrg # Restore the uninstalled library and exit 72510b661123Smrg if test "$mode" = relink; then 72520b661123Smrg ( cd "$output_objdir" && \ 72530b661123Smrg $RM "${realname}T" && \ 72540b661123Smrg $MV "${realname}U" "$realname" ) 72550b661123Smrg fi 725672313efbSmrg 72570b661123Smrg exit $lt_exit 72580b661123Smrg } 72590b661123Smrg done 72600b661123Smrg IFS="$save_ifs" 726196ce994aSmrg 72620b661123Smrg if test -n "$export_symbols_regex" && ${skipped_export-false}; then 72630b661123Smrg func_show_eval '$EGREP -e "$export_symbols_regex" "$export_symbols" > "${export_symbols}T"' 72640b661123Smrg func_show_eval '$MV "${export_symbols}T" "$export_symbols"' 7265bdcaa8d0Smrg fi 7266bdcaa8d0Smrg fi 726772313efbSmrg 72680b661123Smrg if ${skipped_export-false}; then 72690b661123Smrg if test -n "$export_symbols" && test -n "$include_expsyms"; then 72700b661123Smrg tmp_export_symbols="$export_symbols" 72710b661123Smrg test -n "$orig_export_symbols" && tmp_export_symbols="$orig_export_symbols" 72720b661123Smrg $opt_dry_run || eval '$ECHO "X$include_expsyms" | $Xsed | $SP2NL >> "$tmp_export_symbols"' 72730b661123Smrg fi 7274bdcaa8d0Smrg 72750b661123Smrg if test -n "$orig_export_symbols"; then 72760b661123Smrg # The given exports_symbols file has to be filtered, so filter it. 72770b661123Smrg func_verbose "filter symbol list for \`$libname.la' to tag DATA exports" 72780b661123Smrg # FIXME: $output_objdir/$libname.filter potentially contains lots of 72790b661123Smrg # 's' commands which not all seds can handle. GNU sed should be fine 72800b661123Smrg # though. Also, the filter scales superlinearly with the number of 72810b661123Smrg # global variables. join(1) would be nice here, but unfortunately 72820b661123Smrg # isn't a blessed tool. 72830b661123Smrg $opt_dry_run || $SED -e '/[ ,]DATA/!d;s,\(.*\)\([ \,].*\),s|^\1$|\1\2|,' < $export_symbols > $output_objdir/$libname.filter 72840b661123Smrg delfiles="$delfiles $export_symbols $output_objdir/$libname.filter" 72850b661123Smrg export_symbols=$output_objdir/$libname.def 72860b661123Smrg $opt_dry_run || $SED -f $output_objdir/$libname.filter < $orig_export_symbols > $export_symbols 72870b661123Smrg fi 72880b661123Smrg fi 728972313efbSmrg 72900b661123Smrg libobjs=$output 72910b661123Smrg # Restore the value of output. 72920b661123Smrg output=$save_output 729372313efbSmrg 72940b661123Smrg if test -n "$convenience" && test -n "$whole_archive_flag_spec"; then 72950b661123Smrg eval libobjs=\"\$libobjs $whole_archive_flag_spec\" 72960b661123Smrg test "X$libobjs" = "X " && libobjs= 72970b661123Smrg fi 72980b661123Smrg # Expand the library linking commands again to reset the 72990b661123Smrg # value of $libobjs for piecewise linking. 730072313efbSmrg 73010b661123Smrg # Do each of the archive commands. 73020b661123Smrg if test "$module" = yes && test -n "$module_cmds" ; then 73030b661123Smrg if test -n "$export_symbols" && test -n "$module_expsym_cmds"; then 73040b661123Smrg cmds=$module_expsym_cmds 73050b661123Smrg else 73060b661123Smrg cmds=$module_cmds 730796ce994aSmrg fi 730896ce994aSmrg else 73090b661123Smrg if test -n "$export_symbols" && test -n "$archive_expsym_cmds"; then 73100b661123Smrg cmds=$archive_expsym_cmds 73110b661123Smrg else 73120b661123Smrg cmds=$archive_cmds 73130b661123Smrg fi 731496ce994aSmrg fi 73150b661123Smrg fi 731672313efbSmrg 73170b661123Smrg if test -n "$delfiles"; then 73180b661123Smrg # Append the command to remove temporary files to $cmds. 73190b661123Smrg eval cmds=\"\$cmds~\$RM $delfiles\" 73200b661123Smrg fi 7321bdcaa8d0Smrg 73220b661123Smrg # Add any objects from preloaded convenience libraries 73230b661123Smrg if test -n "$dlprefiles"; then 73240b661123Smrg gentop="$output_objdir/${outputname}x" 73250b661123Smrg generated="$generated $gentop" 7326bdcaa8d0Smrg 73270b661123Smrg func_extract_archives $gentop $dlprefiles 73280b661123Smrg libobjs="$libobjs $func_extract_archives_result" 73290b661123Smrg test "X$libobjs" = "X " && libobjs= 73300b661123Smrg fi 7331bdcaa8d0Smrg 73320b661123Smrg save_ifs="$IFS"; IFS='~' 73330b661123Smrg for cmd in $cmds; do 73340b661123Smrg IFS="$save_ifs" 73350b661123Smrg eval cmd=\"$cmd\" 73360b661123Smrg $opt_silent || { 73370b661123Smrg func_quote_for_expand "$cmd" 73380b661123Smrg eval "func_echo $func_quote_for_expand_result" 73390b661123Smrg } 73400b661123Smrg $opt_dry_run || eval "$cmd" || { 73410b661123Smrg lt_exit=$? 7342bdcaa8d0Smrg 73430b661123Smrg # Restore the uninstalled library and exit 73440b661123Smrg if test "$mode" = relink; then 73450b661123Smrg ( cd "$output_objdir" && \ 73460b661123Smrg $RM "${realname}T" && \ 73470b661123Smrg $MV "${realname}U" "$realname" ) 73480b661123Smrg fi 7349bdcaa8d0Smrg 73500b661123Smrg exit $lt_exit 73510b661123Smrg } 73520b661123Smrg done 73530b661123Smrg IFS="$save_ifs" 7354bdcaa8d0Smrg 73550b661123Smrg # Restore the uninstalled library and exit 73560b661123Smrg if test "$mode" = relink; then 73570b661123Smrg $opt_dry_run || eval '(cd $output_objdir && $RM ${realname}T && $MV $realname ${realname}T && $MV ${realname}U $realname)' || exit $? 7358bdcaa8d0Smrg 73590b661123Smrg if test -n "$convenience"; then 73600b661123Smrg if test -z "$whole_archive_flag_spec"; then 73610b661123Smrg func_show_eval '${RM}r "$gentop"' 73620b661123Smrg fi 73630b661123Smrg fi 7364bdcaa8d0Smrg 73650b661123Smrg exit $EXIT_SUCCESS 73660b661123Smrg fi 73670b661123Smrg 73680b661123Smrg # Create links to the real library. 73690b661123Smrg for linkname in $linknames; do 73700b661123Smrg if test "$realname" != "$linkname"; then 73710b661123Smrg func_show_eval '(cd "$output_objdir" && $RM "$linkname" && $LN_S "$realname" "$linkname")' 'exit $?' 737296ce994aSmrg fi 737396ce994aSmrg done 7374bdcaa8d0Smrg 73750b661123Smrg # If -module or -export-dynamic was specified, set the dlname. 73760b661123Smrg if test "$module" = yes || test "$export_dynamic" = yes; then 73770b661123Smrg # On all known operating systems, these are identical. 73780b661123Smrg dlname="$soname" 73790b661123Smrg fi 73800b661123Smrg fi 738172313efbSmrg ;; 7382bdcaa8d0Smrg 73830b661123Smrg obj) 73840b661123Smrg if test -n "$dlfiles$dlprefiles" || test "$dlself" != no; then 73850b661123Smrg func_warning "\`-dlopen' is ignored for objects" 73860b661123Smrg fi 738796ce994aSmrg 73880b661123Smrg case " $deplibs" in 73890b661123Smrg *\ -l* | *\ -L*) 73900b661123Smrg func_warning "\`-l' and \`-L' are ignored for objects" ;; 7391bdcaa8d0Smrg esac 7392bdcaa8d0Smrg 73930b661123Smrg test -n "$rpath" && \ 73940b661123Smrg func_warning "\`-rpath' is ignored for objects" 73950b661123Smrg 73960b661123Smrg test -n "$xrpath" && \ 73970b661123Smrg func_warning "\`-R' is ignored for objects" 7398bdcaa8d0Smrg 73990b661123Smrg test -n "$vinfo" && \ 74000b661123Smrg func_warning "\`-version-info' is ignored for objects" 7401bdcaa8d0Smrg 74020b661123Smrg test -n "$release" && \ 74030b661123Smrg func_warning "\`-release' is ignored for objects" 74040b661123Smrg 74050b661123Smrg case $output in 74060b661123Smrg *.lo) 74070b661123Smrg test -n "$objs$old_deplibs" && \ 74080b661123Smrg func_fatal_error "cannot build library object \`$output' from non-libtool objects" 74090b661123Smrg 74100b661123Smrg libobj=$output 74110b661123Smrg func_lo2o "$libobj" 74120b661123Smrg obj=$func_lo2o_result 741396ce994aSmrg ;; 741496ce994aSmrg *) 74150b661123Smrg libobj= 74160b661123Smrg obj="$output" 7417bdcaa8d0Smrg ;; 7418bdcaa8d0Smrg esac 7419bdcaa8d0Smrg 74200b661123Smrg # Delete the old objects. 74210b661123Smrg $opt_dry_run || $RM $obj $libobj 7422bdcaa8d0Smrg 74230b661123Smrg # Objects from convenience libraries. This assumes 74240b661123Smrg # single-version convenience libraries. Whenever we create 74250b661123Smrg # different ones for PIC/non-PIC, this we'll have to duplicate 74260b661123Smrg # the extraction. 74270b661123Smrg reload_conv_objs= 74280b661123Smrg gentop= 74290b661123Smrg # reload_cmds runs $LD directly, so let us get rid of 74300b661123Smrg # -Wl from whole_archive_flag_spec and hope we can get by with 74310b661123Smrg # turning comma into space.. 74320b661123Smrg wl= 7433bdcaa8d0Smrg 74340b661123Smrg if test -n "$convenience"; then 74350b661123Smrg if test -n "$whole_archive_flag_spec"; then 74360b661123Smrg eval tmp_whole_archive_flags=\"$whole_archive_flag_spec\" 74370b661123Smrg reload_conv_objs=$reload_objs\ `$ECHO "X$tmp_whole_archive_flags" | $Xsed -e 's|,| |g'` 74380b661123Smrg else 74390b661123Smrg gentop="$output_objdir/${obj}x" 74400b661123Smrg generated="$generated $gentop" 744196ce994aSmrg 74420b661123Smrg func_extract_archives $gentop $convenience 74430b661123Smrg reload_conv_objs="$reload_objs $func_extract_archives_result" 74440b661123Smrg fi 744596ce994aSmrg fi 744696ce994aSmrg 74470b661123Smrg # Create the old-style object. 74480b661123Smrg 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 744996ce994aSmrg 74500b661123Smrg output="$obj" 74510b661123Smrg func_execute_cmds "$reload_cmds" 'exit $?' 745296ce994aSmrg 74530b661123Smrg # Exit if we aren't doing a library object file. 74540b661123Smrg if test -z "$libobj"; then 74550b661123Smrg if test -n "$gentop"; then 74560b661123Smrg func_show_eval '${RM}r "$gentop"' 74570b661123Smrg fi 74580b661123Smrg 74590b661123Smrg exit $EXIT_SUCCESS 746096ce994aSmrg fi 74610b661123Smrg 74620b661123Smrg if test "$build_libtool_libs" != yes; then 74630b661123Smrg if test -n "$gentop"; then 74640b661123Smrg func_show_eval '${RM}r "$gentop"' 74650b661123Smrg fi 74660b661123Smrg 74670b661123Smrg # Create an invalid libtool object if no PIC, so that we don't 74680b661123Smrg # accidentally link it into a program. 74690b661123Smrg # $show "echo timestamp > $libobj" 74700b661123Smrg # $opt_dry_run || eval "echo timestamp > $libobj" || exit $? 74710b661123Smrg exit $EXIT_SUCCESS 74720b661123Smrg fi 74730b661123Smrg 74740b661123Smrg if test -n "$pic_flag" || test "$pic_mode" != default; then 74750b661123Smrg # Only do commands if we really have different PIC objects. 74760b661123Smrg reload_objs="$libobjs $reload_conv_objs" 74770b661123Smrg output="$libobj" 74780b661123Smrg func_execute_cmds "$reload_cmds" 'exit $?' 74790b661123Smrg fi 74800b661123Smrg 74810b661123Smrg if test -n "$gentop"; then 74820b661123Smrg func_show_eval '${RM}r "$gentop"' 74830b661123Smrg fi 74840b661123Smrg 74850b661123Smrg exit $EXIT_SUCCESS 748696ce994aSmrg ;; 7487bdcaa8d0Smrg 74880b661123Smrg prog) 74890b661123Smrg case $host in 74900b661123Smrg *cygwin*) func_stripname '' '.exe' "$output" 74910b661123Smrg output=$func_stripname_result.exe;; 74920b661123Smrg esac 74930b661123Smrg test -n "$vinfo" && \ 74940b661123Smrg func_warning "\`-version-info' is ignored for programs" 7495bdcaa8d0Smrg 74960b661123Smrg test -n "$release" && \ 74970b661123Smrg func_warning "\`-release' is ignored for programs" 7498bdcaa8d0Smrg 74990b661123Smrg test "$preload" = yes \ 75000b661123Smrg && test "$dlopen_support" = unknown \ 75010b661123Smrg && test "$dlopen_self" = unknown \ 75020b661123Smrg && test "$dlopen_self_static" = unknown && \ 75030b661123Smrg func_warning "\`LT_INIT([dlopen])' not used. Assuming no dlopen support." 75040b661123Smrg 75050b661123Smrg case $host in 75060b661123Smrg *-*-rhapsody* | *-*-darwin1.[012]) 75070b661123Smrg # On Rhapsody replace the C library is the System framework 75080b661123Smrg compile_deplibs=`$ECHO "X $compile_deplibs" | $Xsed -e 's/ -lc / System.ltframework /'` 75090b661123Smrg finalize_deplibs=`$ECHO "X $finalize_deplibs" | $Xsed -e 's/ -lc / System.ltframework /'` 751096ce994aSmrg ;; 75110b661123Smrg esac 751296ce994aSmrg 75130b661123Smrg case $host in 75140b661123Smrg *-*-darwin*) 75150b661123Smrg # Don't allow lazy linking, it breaks C++ global constructors 75160b661123Smrg # But is supposedly fixed on 10.4 or later (yay!). 75170b661123Smrg if test "$tagname" = CXX ; then 75180b661123Smrg case ${MACOSX_DEPLOYMENT_TARGET-10.0} in 75190b661123Smrg 10.[0123]) 75200b661123Smrg compile_command="$compile_command ${wl}-bind_at_load" 75210b661123Smrg finalize_command="$finalize_command ${wl}-bind_at_load" 75220b661123Smrg ;; 75230b661123Smrg esac 752496ce994aSmrg fi 75250b661123Smrg # Time to change all our "foo.ltframework" stuff back to "-framework foo" 75260b661123Smrg compile_deplibs=`$ECHO "X $compile_deplibs" | $Xsed -e 's% \([^ $]*\).ltframework% -framework \1%g'` 75270b661123Smrg finalize_deplibs=`$ECHO "X $finalize_deplibs" | $Xsed -e 's% \([^ $]*\).ltframework% -framework \1%g'` 75280b661123Smrg ;; 75290b661123Smrg esac 753096ce994aSmrg 753196ce994aSmrg 75320b661123Smrg # move library search paths that coincide with paths to not yet 75330b661123Smrg # installed libraries to the beginning of the library search list 75340b661123Smrg new_libs= 75350b661123Smrg for path in $notinst_path; do 75360b661123Smrg case " $new_libs " in 75370b661123Smrg *" -L$path/$objdir "*) ;; 75380b661123Smrg *) 75390b661123Smrg case " $compile_deplibs " in 75400b661123Smrg *" -L$path/$objdir "*) 75410b661123Smrg new_libs="$new_libs -L$path/$objdir" ;; 754272313efbSmrg esac 75430b661123Smrg ;; 75440b661123Smrg esac 75450b661123Smrg done 75460b661123Smrg for deplib in $compile_deplibs; do 75470b661123Smrg case $deplib in 75480b661123Smrg -L*) 75490b661123Smrg case " $new_libs " in 75500b661123Smrg *" $deplib "*) ;; 75510b661123Smrg *) new_libs="$new_libs $deplib" ;; 7552bdcaa8d0Smrg esac 75530b661123Smrg ;; 75540b661123Smrg *) new_libs="$new_libs $deplib" ;; 75550b661123Smrg esac 75560b661123Smrg done 75570b661123Smrg compile_deplibs="$new_libs" 755872313efbSmrg 755996ce994aSmrg 75600b661123Smrg compile_command="$compile_command $compile_deplibs" 75610b661123Smrg finalize_command="$finalize_command $finalize_deplibs" 756296ce994aSmrg 75630b661123Smrg if test -n "$rpath$xrpath"; then 75640b661123Smrg # If the user specified any rpath flags, then add them. 75650b661123Smrg for libdir in $rpath $xrpath; do 75660b661123Smrg # This is the magic to use -rpath. 75670b661123Smrg case "$finalize_rpath " in 75680b661123Smrg *" $libdir "*) ;; 75690b661123Smrg *) finalize_rpath="$finalize_rpath $libdir" ;; 75700b661123Smrg esac 75710b661123Smrg done 75720b661123Smrg fi 757396ce994aSmrg 75740b661123Smrg # Now hardcode the library paths 75750b661123Smrg rpath= 75760b661123Smrg hardcode_libdirs= 75770b661123Smrg for libdir in $compile_rpath $finalize_rpath; do 75780b661123Smrg if test -n "$hardcode_libdir_flag_spec"; then 75790b661123Smrg if test -n "$hardcode_libdir_separator"; then 75800b661123Smrg if test -z "$hardcode_libdirs"; then 75810b661123Smrg hardcode_libdirs="$libdir" 75820b661123Smrg else 75830b661123Smrg # Just accumulate the unique libdirs. 75840b661123Smrg case $hardcode_libdir_separator$hardcode_libdirs$hardcode_libdir_separator in 75850b661123Smrg *"$hardcode_libdir_separator$libdir$hardcode_libdir_separator"*) 75860b661123Smrg ;; 75870b661123Smrg *) 75880b661123Smrg hardcode_libdirs="$hardcode_libdirs$hardcode_libdir_separator$libdir" 75890b661123Smrg ;; 75900b661123Smrg esac 75910b661123Smrg fi 759296ce994aSmrg else 75930b661123Smrg eval flag=\"$hardcode_libdir_flag_spec\" 75940b661123Smrg rpath="$rpath $flag" 759596ce994aSmrg fi 75960b661123Smrg elif test -n "$runpath_var"; then 75970b661123Smrg case "$perm_rpath " in 75980b661123Smrg *" $libdir "*) ;; 75990b661123Smrg *) perm_rpath="$perm_rpath $libdir" ;; 76000b661123Smrg esac 76010b661123Smrg fi 76020b661123Smrg case $host in 76030b661123Smrg *-*-cygwin* | *-*-mingw* | *-*-pw32* | *-*-os2* | *-cegcc*) 76040b661123Smrg testbindir=`${ECHO} "$libdir" | ${SED} -e 's*/lib$*/bin*'` 76050b661123Smrg case :$dllsearchpath: in 76060b661123Smrg *":$libdir:"*) ;; 76070b661123Smrg ::) dllsearchpath=$libdir;; 76080b661123Smrg *) dllsearchpath="$dllsearchpath:$libdir";; 76090b661123Smrg esac 76100b661123Smrg case :$dllsearchpath: in 76110b661123Smrg *":$testbindir:"*) ;; 76120b661123Smrg ::) dllsearchpath=$testbindir;; 76130b661123Smrg *) dllsearchpath="$dllsearchpath:$testbindir";; 76140b661123Smrg esac 76150b661123Smrg ;; 76160b661123Smrg esac 76170b661123Smrg done 76180b661123Smrg # Substitute the hardcoded libdirs into the rpath. 76190b661123Smrg if test -n "$hardcode_libdir_separator" && 76200b661123Smrg test -n "$hardcode_libdirs"; then 76210b661123Smrg libdir="$hardcode_libdirs" 76220b661123Smrg eval rpath=\" $hardcode_libdir_flag_spec\" 76230b661123Smrg fi 76240b661123Smrg compile_rpath="$rpath" 762596ce994aSmrg 76260b661123Smrg rpath= 76270b661123Smrg hardcode_libdirs= 76280b661123Smrg for libdir in $finalize_rpath; do 76290b661123Smrg if test -n "$hardcode_libdir_flag_spec"; then 76300b661123Smrg if test -n "$hardcode_libdir_separator"; then 76310b661123Smrg if test -z "$hardcode_libdirs"; then 76320b661123Smrg hardcode_libdirs="$libdir" 76330b661123Smrg else 76340b661123Smrg # Just accumulate the unique libdirs. 76350b661123Smrg case $hardcode_libdir_separator$hardcode_libdirs$hardcode_libdir_separator in 76360b661123Smrg *"$hardcode_libdir_separator$libdir$hardcode_libdir_separator"*) 76370b661123Smrg ;; 76380b661123Smrg *) 76390b661123Smrg hardcode_libdirs="$hardcode_libdirs$hardcode_libdir_separator$libdir" 76400b661123Smrg ;; 76410b661123Smrg esac 76420b661123Smrg fi 764372313efbSmrg else 76440b661123Smrg eval flag=\"$hardcode_libdir_flag_spec\" 76450b661123Smrg rpath="$rpath $flag" 764672313efbSmrg fi 76470b661123Smrg elif test -n "$runpath_var"; then 76480b661123Smrg case "$finalize_perm_rpath " in 76490b661123Smrg *" $libdir "*) ;; 76500b661123Smrg *) finalize_perm_rpath="$finalize_perm_rpath $libdir" ;; 76510b661123Smrg esac 7652bdcaa8d0Smrg fi 76530b661123Smrg done 76540b661123Smrg # Substitute the hardcoded libdirs into the rpath. 76550b661123Smrg if test -n "$hardcode_libdir_separator" && 76560b661123Smrg test -n "$hardcode_libdirs"; then 76570b661123Smrg libdir="$hardcode_libdirs" 76580b661123Smrg eval rpath=\" $hardcode_libdir_flag_spec\" 76590b661123Smrg fi 76600b661123Smrg finalize_rpath="$rpath" 7661bdcaa8d0Smrg 76620b661123Smrg if test -n "$libobjs" && test "$build_old_libs" = yes; then 76630b661123Smrg # Transform all the library objects into standard objects. 76640b661123Smrg compile_command=`$ECHO "X$compile_command" | $SP2NL | $Xsed -e "$lo2o" | $NL2SP` 76650b661123Smrg finalize_command=`$ECHO "X$finalize_command" | $SP2NL | $Xsed -e "$lo2o" | $NL2SP` 76660b661123Smrg fi 7667bdcaa8d0Smrg 76680b661123Smrg func_generate_dlsyms "$outputname" "@PROGRAM@" "no" 7669bdcaa8d0Smrg 76700b661123Smrg # template prelinking step 76710b661123Smrg if test -n "$prelink_cmds"; then 76720b661123Smrg func_execute_cmds "$prelink_cmds" 'exit $?' 76730b661123Smrg fi 7674bdcaa8d0Smrg 76750b661123Smrg wrappers_required=yes 76760b661123Smrg case $host in 76770b661123Smrg *cygwin* | *mingw* ) 76780b661123Smrg if test "$build_libtool_libs" != yes; then 76790b661123Smrg wrappers_required=no 76800b661123Smrg fi 76810b661123Smrg ;; 76820b661123Smrg *cegcc) 76830b661123Smrg # Disable wrappers for cegcc, we are cross compiling anyway. 76840b661123Smrg wrappers_required=no 76850b661123Smrg ;; 76860b661123Smrg *) 76870b661123Smrg if test "$need_relink" = no || test "$build_libtool_libs" != yes; then 76880b661123Smrg wrappers_required=no 76890b661123Smrg fi 76900b661123Smrg ;; 76910b661123Smrg esac 76920b661123Smrg if test "$wrappers_required" = no; then 76930b661123Smrg # Replace the output file specification. 76940b661123Smrg compile_command=`$ECHO "X$compile_command" | $Xsed -e 's%@OUTPUT@%'"$output"'%g'` 76950b661123Smrg link_command="$compile_command$compile_rpath" 7696bdcaa8d0Smrg 76970b661123Smrg # We have no uninstalled library dependencies, so finalize right now. 76980b661123Smrg exit_status=0 76990b661123Smrg func_show_eval "$link_command" 'exit_status=$?' 7700bdcaa8d0Smrg 77010b661123Smrg # Delete the generated files. 77020b661123Smrg if test -f "$output_objdir/${outputname}S.${objext}"; then 77030b661123Smrg func_show_eval '$RM "$output_objdir/${outputname}S.${objext}"' 770472313efbSmrg fi 7705bdcaa8d0Smrg 77060b661123Smrg exit $exit_status 77070b661123Smrg fi 7708bdcaa8d0Smrg 77090b661123Smrg if test -n "$compile_shlibpath$finalize_shlibpath"; then 77100b661123Smrg compile_command="$shlibpath_var=\"$compile_shlibpath$finalize_shlibpath\$$shlibpath_var\" $compile_command" 77110b661123Smrg fi 77120b661123Smrg if test -n "$finalize_shlibpath"; then 77130b661123Smrg finalize_command="$shlibpath_var=\"$finalize_shlibpath\$$shlibpath_var\" $finalize_command" 77140b661123Smrg fi 771596ce994aSmrg 77160b661123Smrg compile_var= 77170b661123Smrg finalize_var= 77180b661123Smrg if test -n "$runpath_var"; then 77190b661123Smrg if test -n "$perm_rpath"; then 77200b661123Smrg # We should set the runpath_var. 77210b661123Smrg rpath= 77220b661123Smrg for dir in $perm_rpath; do 77230b661123Smrg rpath="$rpath$dir:" 77240b661123Smrg done 77250b661123Smrg compile_var="$runpath_var=\"$rpath\$$runpath_var\" " 7726bdcaa8d0Smrg fi 77270b661123Smrg if test -n "$finalize_perm_rpath"; then 77280b661123Smrg # We should set the runpath_var. 77290b661123Smrg rpath= 77300b661123Smrg for dir in $finalize_perm_rpath; do 77310b661123Smrg rpath="$rpath$dir:" 77320b661123Smrg done 77330b661123Smrg finalize_var="$runpath_var=\"$rpath\$$runpath_var\" " 773472313efbSmrg fi 77350b661123Smrg fi 7736bdcaa8d0Smrg 77370b661123Smrg if test "$no_install" = yes; then 77380b661123Smrg # We don't need to create a wrapper script. 77390b661123Smrg link_command="$compile_var$compile_command$compile_rpath" 77400b661123Smrg # Replace the output file specification. 77410b661123Smrg link_command=`$ECHO "X$link_command" | $Xsed -e 's%@OUTPUT@%'"$output"'%g'` 77420b661123Smrg # Delete the old output file. 77430b661123Smrg $opt_dry_run || $RM $output 77440b661123Smrg # Link the executable and exit 77450b661123Smrg func_show_eval "$link_command" 'exit $?' 774696ce994aSmrg exit $EXIT_SUCCESS 77470b661123Smrg fi 7748bdcaa8d0Smrg 77490b661123Smrg if test "$hardcode_action" = relink; then 77500b661123Smrg # Fast installation is not supported 77510b661123Smrg link_command="$compile_var$compile_command$compile_rpath" 77520b661123Smrg relink_command="$finalize_var$finalize_command$finalize_rpath" 77530b661123Smrg 77540b661123Smrg func_warning "this platform does not like uninstalled shared libraries" 77550b661123Smrg func_warning "\`$output' will be relinked during installation" 77560b661123Smrg else 77570b661123Smrg if test "$fast_install" != no; then 77580b661123Smrg link_command="$finalize_var$compile_command$finalize_rpath" 77590b661123Smrg if test "$fast_install" = yes; then 77600b661123Smrg relink_command=`$ECHO "X$compile_var$compile_command$compile_rpath" | $Xsed -e 's%@OUTPUT@%\$progdir/\$file%g'` 77610b661123Smrg else 77620b661123Smrg # fast_install is set to needless 77630b661123Smrg relink_command= 77640b661123Smrg fi 7765bdcaa8d0Smrg else 77660b661123Smrg link_command="$compile_var$compile_command$compile_rpath" 77670b661123Smrg relink_command="$finalize_var$finalize_command$finalize_rpath" 7768bdcaa8d0Smrg fi 77690b661123Smrg fi 7770bdcaa8d0Smrg 77710b661123Smrg # Replace the output file specification. 77720b661123Smrg link_command=`$ECHO "X$link_command" | $Xsed -e 's%@OUTPUT@%'"$output_objdir/$outputname"'%g'` 7773bdcaa8d0Smrg 77740b661123Smrg # Delete the old output files. 77750b661123Smrg $opt_dry_run || $RM $output $output_objdir/$outputname $output_objdir/lt-$outputname 7776bdcaa8d0Smrg 77770b661123Smrg func_show_eval "$link_command" 'exit $?' 777896ce994aSmrg 77790b661123Smrg # Now create the wrapper script. 77800b661123Smrg func_verbose "creating $output" 778196ce994aSmrg 77820b661123Smrg # Quote the relink command for shipping. 77830b661123Smrg if test -n "$relink_command"; then 77840b661123Smrg # Preserve any variables that may affect compiler behavior 77850b661123Smrg for var in $variables_saved_for_relink; do 77860b661123Smrg if eval test -z \"\${$var+set}\"; then 77870b661123Smrg relink_command="{ test -z \"\${$var+set}\" || $lt_unset $var || { $var=; export $var; }; }; $relink_command" 77880b661123Smrg elif eval var_value=\$$var; test -z "$var_value"; then 77890b661123Smrg relink_command="$var=; export $var; $relink_command" 779072313efbSmrg else 77910b661123Smrg func_quote_for_eval "$var_value" 77920b661123Smrg relink_command="$var=$func_quote_for_eval_result; export $var; $relink_command" 779372313efbSmrg fi 77940b661123Smrg done 77950b661123Smrg relink_command="(cd `pwd`; $relink_command)" 77960b661123Smrg relink_command=`$ECHO "X$relink_command" | $Xsed -e "$sed_quote_subst"` 77970b661123Smrg fi 7798bdcaa8d0Smrg 77990b661123Smrg # Quote $ECHO for shipping. 78000b661123Smrg if test "X$ECHO" = "X$SHELL $progpath --fallback-echo"; then 78010b661123Smrg case $progpath in 78020b661123Smrg [\\/]* | [A-Za-z]:[\\/]*) qecho="$SHELL $progpath --fallback-echo";; 78030b661123Smrg *) qecho="$SHELL `pwd`/$progpath --fallback-echo";; 78040b661123Smrg esac 78050b661123Smrg qecho=`$ECHO "X$qecho" | $Xsed -e "$sed_quote_subst"` 78060b661123Smrg else 78070b661123Smrg qecho=`$ECHO "X$ECHO" | $Xsed -e "$sed_quote_subst"` 78080b661123Smrg fi 78090b661123Smrg 78100b661123Smrg # Only actually do things if not in dry run mode. 78110b661123Smrg $opt_dry_run || { 78120b661123Smrg # win32 will think the script is a binary if it has 78130b661123Smrg # a .exe suffix, so we strip it off here. 78140b661123Smrg case $output in 78150b661123Smrg *.exe) func_stripname '' '.exe' "$output" 78160b661123Smrg output=$func_stripname_result ;; 78170b661123Smrg esac 78180b661123Smrg # test for cygwin because mv fails w/o .exe extensions 78190b661123Smrg case $host in 78200b661123Smrg *cygwin*) 78210b661123Smrg exeext=.exe 78220b661123Smrg func_stripname '' '.exe' "$outputname" 78230b661123Smrg outputname=$func_stripname_result ;; 78240b661123Smrg *) exeext= ;; 7825bdcaa8d0Smrg esac 78260b661123Smrg case $host in 78270b661123Smrg *cygwin* | *mingw* ) 78280b661123Smrg func_dirname_and_basename "$output" "" "." 78290b661123Smrg output_name=$func_basename_result 78300b661123Smrg output_path=$func_dirname_result 78310b661123Smrg cwrappersource="$output_path/$objdir/lt-$output_name.c" 78320b661123Smrg cwrapper="$output_path/$output_name.exe" 78330b661123Smrg $RM $cwrappersource $cwrapper 78340b661123Smrg trap "$RM $cwrappersource $cwrapper; exit $EXIT_FAILURE" 1 2 15 78350b661123Smrg 78360b661123Smrg func_emit_cwrapperexe_src > $cwrappersource 78370b661123Smrg 78380b661123Smrg # The wrapper executable is built using the $host compiler, 78390b661123Smrg # because it contains $host paths and files. If cross- 78400b661123Smrg # compiling, it, like the target executable, must be 78410b661123Smrg # executed on the $host or under an emulation environment. 78420b661123Smrg $opt_dry_run || { 78430b661123Smrg $LTCC $LTCFLAGS -o $cwrapper $cwrappersource 78440b661123Smrg $STRIP $cwrapper 78450b661123Smrg } 7846bdcaa8d0Smrg 78470b661123Smrg # Now, create the wrapper script for func_source use: 78480b661123Smrg func_ltwrapper_scriptname $cwrapper 78490b661123Smrg $RM $func_ltwrapper_scriptname_result 78500b661123Smrg trap "$RM $func_ltwrapper_scriptname_result; exit $EXIT_FAILURE" 1 2 15 78510b661123Smrg $opt_dry_run || { 78520b661123Smrg # note: this script will not be executed, so do not chmod. 78530b661123Smrg if test "x$build" = "x$host" ; then 78540b661123Smrg $cwrapper --lt-dump-script > $func_ltwrapper_scriptname_result 78550b661123Smrg else 78560b661123Smrg func_emit_wrapper no > $func_ltwrapper_scriptname_result 78570b661123Smrg fi 78580b661123Smrg } 78590b661123Smrg ;; 78600b661123Smrg * ) 78610b661123Smrg $RM $output 78620b661123Smrg trap "$RM $output; exit $EXIT_FAILURE" 1 2 15 7863bdcaa8d0Smrg 78640b661123Smrg func_emit_wrapper no > $output 78650b661123Smrg chmod +x $output 78660b661123Smrg ;; 78670b661123Smrg esac 78680b661123Smrg } 78690b661123Smrg exit $EXIT_SUCCESS 78700b661123Smrg ;; 78710b661123Smrg esac 7872bdcaa8d0Smrg 78730b661123Smrg # See if we need to build an old-fashioned archive. 78740b661123Smrg for oldlib in $oldlibs; do 7875bdcaa8d0Smrg 78760b661123Smrg if test "$build_libtool_libs" = convenience; then 78770b661123Smrg oldobjs="$libobjs_save $symfileobj" 78780b661123Smrg addlibs="$convenience" 78790b661123Smrg build_libtool_libs=no 78800b661123Smrg else 78810b661123Smrg if test "$build_libtool_libs" = module; then 78820b661123Smrg oldobjs="$libobjs_save" 78830b661123Smrg build_libtool_libs=no 78840b661123Smrg else 78850b661123Smrg oldobjs="$old_deplibs $non_pic_objects" 78860b661123Smrg if test "$preload" = yes && test -f "$symfileobj"; then 78870b661123Smrg oldobjs="$oldobjs $symfileobj" 78880b661123Smrg fi 78890b661123Smrg fi 78900b661123Smrg addlibs="$old_convenience" 7891bdcaa8d0Smrg fi 7892bdcaa8d0Smrg 78930b661123Smrg if test -n "$addlibs"; then 78940b661123Smrg gentop="$output_objdir/${outputname}x" 78950b661123Smrg generated="$generated $gentop" 7896bdcaa8d0Smrg 78970b661123Smrg func_extract_archives $gentop $addlibs 78980b661123Smrg oldobjs="$oldobjs $func_extract_archives_result" 78990b661123Smrg fi 7900bdcaa8d0Smrg 79010b661123Smrg # Do each command in the archive commands. 79020b661123Smrg if test -n "$old_archive_from_new_cmds" && test "$build_libtool_libs" = yes; then 79030b661123Smrg cmds=$old_archive_from_new_cmds 79040b661123Smrg else 7905bdcaa8d0Smrg 79060b661123Smrg # Add any objects from preloaded convenience libraries 79070b661123Smrg if test -n "$dlprefiles"; then 79080b661123Smrg gentop="$output_objdir/${outputname}x" 79090b661123Smrg generated="$generated $gentop" 7910bdcaa8d0Smrg 79110b661123Smrg func_extract_archives $gentop $dlprefiles 79120b661123Smrg oldobjs="$oldobjs $func_extract_archives_result" 79130b661123Smrg fi 7914bdcaa8d0Smrg 79150b661123Smrg # POSIX demands no paths to be encoded in archives. We have 79160b661123Smrg # to avoid creating archives with duplicate basenames if we 79170b661123Smrg # might have to extract them afterwards, e.g., when creating a 79180b661123Smrg # static archive out of a convenience library, or when linking 79190b661123Smrg # the entirety of a libtool archive into another (currently 79200b661123Smrg # not supported by libtool). 79210b661123Smrg if (for obj in $oldobjs 79220b661123Smrg do 79230b661123Smrg func_basename "$obj" 79240b661123Smrg $ECHO "$func_basename_result" 79250b661123Smrg done | sort | sort -uc >/dev/null 2>&1); then 79260b661123Smrg : 79270b661123Smrg else 79280b661123Smrg $ECHO "copying selected object files to avoid basename conflicts..." 79290b661123Smrg gentop="$output_objdir/${outputname}x" 79300b661123Smrg generated="$generated $gentop" 79310b661123Smrg func_mkdir_p "$gentop" 79320b661123Smrg save_oldobjs=$oldobjs 79330b661123Smrg oldobjs= 79340b661123Smrg counter=1 79350b661123Smrg for obj in $save_oldobjs 79360b661123Smrg do 79370b661123Smrg func_basename "$obj" 79380b661123Smrg objbase="$func_basename_result" 79390b661123Smrg case " $oldobjs " in 79400b661123Smrg " ") oldobjs=$obj ;; 79410b661123Smrg *[\ /]"$objbase "*) 79420b661123Smrg while :; do 79430b661123Smrg # Make sure we don't pick an alternate name that also 79440b661123Smrg # overlaps. 79450b661123Smrg newobj=lt$counter-$objbase 79460b661123Smrg func_arith $counter + 1 79470b661123Smrg counter=$func_arith_result 79480b661123Smrg case " $oldobjs " in 79490b661123Smrg *[\ /]"$newobj "*) ;; 79500b661123Smrg *) if test ! -f "$gentop/$newobj"; then break; fi ;; 79510b661123Smrg esac 79520b661123Smrg done 79530b661123Smrg func_show_eval "ln $obj $gentop/$newobj || cp $obj $gentop/$newobj" 79540b661123Smrg oldobjs="$oldobjs $gentop/$newobj" 79550b661123Smrg ;; 79560b661123Smrg *) oldobjs="$oldobjs $obj" ;; 79570b661123Smrg esac 7958bdcaa8d0Smrg done 795972313efbSmrg fi 79600b661123Smrg eval cmds=\"$old_archive_cmds\" 796196ce994aSmrg 79620b661123Smrg func_len " $cmds" 79630b661123Smrg len=$func_len_result 79640b661123Smrg if test "$len" -lt "$max_cmd_len" || test "$max_cmd_len" -le -1; then 79650b661123Smrg cmds=$old_archive_cmds 79660b661123Smrg else 79670b661123Smrg # the command line is too long to link in one step, link in parts 79680b661123Smrg func_verbose "using piecewise archive linking..." 79690b661123Smrg save_RANLIB=$RANLIB 79700b661123Smrg RANLIB=: 79710b661123Smrg objlist= 79720b661123Smrg concat_cmds= 79730b661123Smrg save_oldobjs=$oldobjs 79740b661123Smrg oldobjs= 79750b661123Smrg # Is there a better way of finding the last object in the list? 79760b661123Smrg for obj in $save_oldobjs 79770b661123Smrg do 79780b661123Smrg last_oldobj=$obj 79790b661123Smrg done 79800b661123Smrg eval test_cmds=\"$old_archive_cmds\" 79810b661123Smrg func_len " $test_cmds" 79820b661123Smrg len0=$func_len_result 79830b661123Smrg len=$len0 79840b661123Smrg for obj in $save_oldobjs 79850b661123Smrg do 79860b661123Smrg func_len " $obj" 79870b661123Smrg func_arith $len + $func_len_result 79880b661123Smrg len=$func_arith_result 79890b661123Smrg func_append objlist " $obj" 79900b661123Smrg if test "$len" -lt "$max_cmd_len"; then 79910b661123Smrg : 79920b661123Smrg else 79930b661123Smrg # the above command should be used before it gets too long 79940b661123Smrg oldobjs=$objlist 79950b661123Smrg if test "$obj" = "$last_oldobj" ; then 79960b661123Smrg RANLIB=$save_RANLIB 79970b661123Smrg fi 79980b661123Smrg test -z "$concat_cmds" || concat_cmds=$concat_cmds~ 79990b661123Smrg eval concat_cmds=\"\${concat_cmds}$old_archive_cmds\" 80000b661123Smrg objlist= 80010b661123Smrg len=$len0 80020b661123Smrg fi 80030b661123Smrg done 80040b661123Smrg RANLIB=$save_RANLIB 80050b661123Smrg oldobjs=$objlist 80060b661123Smrg if test "X$oldobjs" = "X" ; then 80070b661123Smrg eval cmds=\"\$concat_cmds\" 80080b661123Smrg else 80090b661123Smrg eval cmds=\"\$concat_cmds~\$old_archive_cmds\" 80100b661123Smrg fi 80110b661123Smrg fi 80120b661123Smrg fi 80130b661123Smrg func_execute_cmds "$cmds" 'exit $?' 8014bdcaa8d0Smrg done 8015bdcaa8d0Smrg 80160b661123Smrg test -n "$generated" && \ 80170b661123Smrg func_show_eval "${RM}r$generated" 8018bdcaa8d0Smrg 80190b661123Smrg # Now create the libtool archive. 80200b661123Smrg case $output in 80210b661123Smrg *.la) 80220b661123Smrg old_library= 80230b661123Smrg test "$build_old_libs" = yes && old_library="$libname.$libext" 80240b661123Smrg func_verbose "creating $output" 802572313efbSmrg 80260b661123Smrg # Preserve any variables that may affect compiler behavior 80270b661123Smrg for var in $variables_saved_for_relink; do 80280b661123Smrg if eval test -z \"\${$var+set}\"; then 80290b661123Smrg relink_command="{ test -z \"\${$var+set}\" || $lt_unset $var || { $var=; export $var; }; }; $relink_command" 80300b661123Smrg elif eval var_value=\$$var; test -z "$var_value"; then 80310b661123Smrg relink_command="$var=; export $var; $relink_command" 803296ce994aSmrg else 80330b661123Smrg func_quote_for_eval "$var_value" 80340b661123Smrg relink_command="$var=$func_quote_for_eval_result; export $var; $relink_command" 803596ce994aSmrg fi 80360b661123Smrg done 80370b661123Smrg # Quote the link command for shipping. 80380b661123Smrg relink_command="(cd `pwd`; $SHELL $progpath $preserve_args --mode=relink $libtool_args @inst_prefix_dir@)" 80390b661123Smrg relink_command=`$ECHO "X$relink_command" | $Xsed -e "$sed_quote_subst"` 80400b661123Smrg if test "$hardcode_automatic" = yes ; then 80410b661123Smrg relink_command= 80420b661123Smrg fi 8043bdcaa8d0Smrg 80440b661123Smrg # Only create the output if not a dry run. 80450b661123Smrg $opt_dry_run || { 80460b661123Smrg for installed in no yes; do 80470b661123Smrg if test "$installed" = yes; then 80480b661123Smrg if test -z "$install_libdir"; then 80490b661123Smrg break 80500b661123Smrg fi 80510b661123Smrg output="$output_objdir/$outputname"i 80520b661123Smrg # Replace all uninstalled libtool libraries with the installed ones 80530b661123Smrg newdependency_libs= 80540b661123Smrg for deplib in $dependency_libs; do 80550b661123Smrg case $deplib in 80560b661123Smrg *.la) 80570b661123Smrg func_basename "$deplib" 80580b661123Smrg name="$func_basename_result" 80590b661123Smrg eval libdir=`${SED} -n -e 's/^libdir=\(.*\)$/\1/p' $deplib` 80600b661123Smrg test -z "$libdir" && \ 80610b661123Smrg func_fatal_error "\`$deplib' is not a valid libtool archive" 80620b661123Smrg newdependency_libs="$newdependency_libs $libdir/$name" 80630b661123Smrg ;; 80640b661123Smrg *) newdependency_libs="$newdependency_libs $deplib" ;; 80650b661123Smrg esac 80660b661123Smrg done 80670b661123Smrg dependency_libs="$newdependency_libs" 80680b661123Smrg newdlfiles= 80690b661123Smrg 80700b661123Smrg for lib in $dlfiles; do 80710b661123Smrg case $lib in 80720b661123Smrg *.la) 80730b661123Smrg func_basename "$lib" 80740b661123Smrg name="$func_basename_result" 80750b661123Smrg eval libdir=`${SED} -n -e 's/^libdir=\(.*\)$/\1/p' $lib` 80760b661123Smrg test -z "$libdir" && \ 80770b661123Smrg func_fatal_error "\`$lib' is not a valid libtool archive" 80780b661123Smrg newdlfiles="$newdlfiles $libdir/$name" 80790b661123Smrg ;; 80800b661123Smrg *) newdlfiles="$newdlfiles $lib" ;; 80810b661123Smrg esac 80820b661123Smrg done 80830b661123Smrg dlfiles="$newdlfiles" 80840b661123Smrg newdlprefiles= 80850b661123Smrg for lib in $dlprefiles; do 80860b661123Smrg case $lib in 80870b661123Smrg *.la) 80880b661123Smrg # Only pass preopened files to the pseudo-archive (for 80890b661123Smrg # eventual linking with the app. that links it) if we 80900b661123Smrg # didn't already link the preopened objects directly into 80910b661123Smrg # the library: 80920b661123Smrg func_basename "$lib" 80930b661123Smrg name="$func_basename_result" 80940b661123Smrg eval libdir=`${SED} -n -e 's/^libdir=\(.*\)$/\1/p' $lib` 80950b661123Smrg test -z "$libdir" && \ 80960b661123Smrg func_fatal_error "\`$lib' is not a valid libtool archive" 80970b661123Smrg newdlprefiles="$newdlprefiles $libdir/$name" 80980b661123Smrg ;; 80990b661123Smrg esac 81000b661123Smrg done 81010b661123Smrg dlprefiles="$newdlprefiles" 81020b661123Smrg else 81030b661123Smrg newdlfiles= 81040b661123Smrg for lib in $dlfiles; do 81050b661123Smrg case $lib in 81060b661123Smrg [\\/]* | [A-Za-z]:[\\/]*) abs="$lib" ;; 81070b661123Smrg *) abs=`pwd`"/$lib" ;; 81080b661123Smrg esac 81090b661123Smrg newdlfiles="$newdlfiles $abs" 81100b661123Smrg done 81110b661123Smrg dlfiles="$newdlfiles" 81120b661123Smrg newdlprefiles= 81130b661123Smrg for lib in $dlprefiles; do 81140b661123Smrg case $lib in 81150b661123Smrg [\\/]* | [A-Za-z]:[\\/]*) abs="$lib" ;; 81160b661123Smrg *) abs=`pwd`"/$lib" ;; 81170b661123Smrg esac 81180b661123Smrg newdlprefiles="$newdlprefiles $abs" 81190b661123Smrg done 81200b661123Smrg dlprefiles="$newdlprefiles" 81210b661123Smrg fi 81220b661123Smrg $RM $output 81230b661123Smrg # place dlname in correct position for cygwin 81240b661123Smrg tdlname=$dlname 81250b661123Smrg case $host,$output,$installed,$module,$dlname in 81260b661123Smrg *cygwin*,*lai,yes,no,*.dll | *mingw*,*lai,yes,no,*.dll | *cegcc*,*lai,yes,no,*.dll) tdlname=../bin/$dlname ;; 81270b661123Smrg esac 81280b661123Smrg $ECHO > $output "\ 81290b661123Smrg# $outputname - a libtool library file 81300b661123Smrg# Generated by $PROGRAM (GNU $PACKAGE$TIMESTAMP) $VERSION 81310b661123Smrg# 81320b661123Smrg# Please DO NOT delete this file! 81330b661123Smrg# It is necessary for linking the library. 8134bdcaa8d0Smrg 81350b661123Smrg# The name that we can dlopen(3). 81360b661123Smrgdlname='$tdlname' 8137bdcaa8d0Smrg 81380b661123Smrg# Names of this library. 81390b661123Smrglibrary_names='$library_names' 8140bdcaa8d0Smrg 81410b661123Smrg# The name of the static archive. 81420b661123Smrgold_library='$old_library' 8143bdcaa8d0Smrg 81440b661123Smrg# Linker flags that can not go in dependency_libs. 81450b661123Smrginherited_linker_flags='$new_inherited_linker_flags' 8146bdcaa8d0Smrg 81470b661123Smrg# Libraries that this one depends upon. 81480b661123Smrgdependency_libs='$dependency_libs' 8149bdcaa8d0Smrg 81500b661123Smrg# Names of additional weak libraries provided by this library 81510b661123Smrgweak_library_names='$weak_libs' 8152bdcaa8d0Smrg 81530b661123Smrg# Version information for $libname. 81540b661123Smrgcurrent=$current 81550b661123Smrgage=$age 81560b661123Smrgrevision=$revision 8157bdcaa8d0Smrg 81580b661123Smrg# Is this an already installed library? 81590b661123Smrginstalled=$installed 8160bdcaa8d0Smrg 81610b661123Smrg# Should we warn about portability when linking against -modules? 81620b661123Smrgshouldnotlink=$module 8163bdcaa8d0Smrg 81640b661123Smrg# Files to dlopen/dlpreopen 81650b661123Smrgdlopen='$dlfiles' 81660b661123Smrgdlpreopen='$dlprefiles' 8167bdcaa8d0Smrg 81680b661123Smrg# Directory that this library needs to be installed in: 81690b661123Smrglibdir='$install_libdir'" 81700b661123Smrg if test "$installed" = no && test "$need_relink" = yes; then 81710b661123Smrg $ECHO >> $output "\ 81720b661123Smrgrelink_command=\"$relink_command\"" 81730b661123Smrg fi 81740b661123Smrg done 81750b661123Smrg } 8176bdcaa8d0Smrg 81770b661123Smrg # Do a symbolic link so that the libtool archive can be found in 81780b661123Smrg # LD_LIBRARY_PATH before the program is installed. 81790b661123Smrg func_show_eval '( cd "$output_objdir" && $RM "$outputname" && $LN_S "../$outputname" "$outputname" )' 'exit $?' 81800b661123Smrg ;; 81810b661123Smrg esac 81820b661123Smrg exit $EXIT_SUCCESS 81830b661123Smrg} 818496ce994aSmrg 81850b661123Smrg{ test "$mode" = link || test "$mode" = relink; } && 81860b661123Smrg func_mode_link ${1+"$@"} 8187bdcaa8d0Smrg 8188bdcaa8d0Smrg 81890b661123Smrg# func_mode_uninstall arg... 81900b661123Smrgfunc_mode_uninstall () 81910b661123Smrg{ 81920b661123Smrg $opt_debug 81930b661123Smrg RM="$nonopt" 8194bdcaa8d0Smrg files= 8195bdcaa8d0Smrg rmforce= 8196bdcaa8d0Smrg exit_status=0 8197bdcaa8d0Smrg 8198bdcaa8d0Smrg # This variable tells wrapper scripts just to set variables rather 8199bdcaa8d0Smrg # than running their programs. 8200bdcaa8d0Smrg libtool_install_magic="$magic" 8201bdcaa8d0Smrg 8202bdcaa8d0Smrg for arg 8203bdcaa8d0Smrg do 8204bdcaa8d0Smrg case $arg in 82050b661123Smrg -f) RM="$RM $arg"; rmforce=yes ;; 82060b661123Smrg -*) RM="$RM $arg" ;; 8207bdcaa8d0Smrg *) files="$files $arg" ;; 8208bdcaa8d0Smrg esac 8209bdcaa8d0Smrg done 8210bdcaa8d0Smrg 82110b661123Smrg test -z "$RM" && \ 82120b661123Smrg func_fatal_help "you must specify an RM program" 8213bdcaa8d0Smrg 8214bdcaa8d0Smrg rmdirs= 8215bdcaa8d0Smrg 8216bdcaa8d0Smrg origobjdir="$objdir" 8217bdcaa8d0Smrg for file in $files; do 82180b661123Smrg func_dirname "$file" "" "." 82190b661123Smrg dir="$func_dirname_result" 82200b661123Smrg if test "X$dir" = X.; then 8221bdcaa8d0Smrg objdir="$origobjdir" 8222bdcaa8d0Smrg else 8223bdcaa8d0Smrg objdir="$dir/$origobjdir" 8224bdcaa8d0Smrg fi 82250b661123Smrg func_basename "$file" 82260b661123Smrg name="$func_basename_result" 8227bdcaa8d0Smrg test "$mode" = uninstall && objdir="$dir" 8228bdcaa8d0Smrg 8229bdcaa8d0Smrg # Remember objdir for removal later, being careful to avoid duplicates 8230bdcaa8d0Smrg if test "$mode" = clean; then 8231bdcaa8d0Smrg case " $rmdirs " in 8232bdcaa8d0Smrg *" $objdir "*) ;; 8233bdcaa8d0Smrg *) rmdirs="$rmdirs $objdir" ;; 8234bdcaa8d0Smrg esac 8235bdcaa8d0Smrg fi 8236bdcaa8d0Smrg 8237bdcaa8d0Smrg # Don't error if the file doesn't exist and rm -f was used. 82380b661123Smrg if { test -L "$file"; } >/dev/null 2>&1 || 82390b661123Smrg { test -h "$file"; } >/dev/null 2>&1 || 82400b661123Smrg test -f "$file"; then 8241bdcaa8d0Smrg : 8242bdcaa8d0Smrg elif test -d "$file"; then 8243bdcaa8d0Smrg exit_status=1 8244bdcaa8d0Smrg continue 8245bdcaa8d0Smrg elif test "$rmforce" = yes; then 8246bdcaa8d0Smrg continue 8247bdcaa8d0Smrg fi 8248bdcaa8d0Smrg 8249bdcaa8d0Smrg rmfiles="$file" 8250bdcaa8d0Smrg 8251bdcaa8d0Smrg case $name in 8252bdcaa8d0Smrg *.la) 8253bdcaa8d0Smrg # Possibly a libtool archive, so verify it. 82540b661123Smrg if func_lalib_p "$file"; then 82550b661123Smrg func_source $dir/$name 8256bdcaa8d0Smrg 8257bdcaa8d0Smrg # Delete the libtool libraries and symlinks. 8258bdcaa8d0Smrg for n in $library_names; do 8259bdcaa8d0Smrg rmfiles="$rmfiles $objdir/$n" 8260bdcaa8d0Smrg done 8261bdcaa8d0Smrg test -n "$old_library" && rmfiles="$rmfiles $objdir/$old_library" 8262bdcaa8d0Smrg 8263bdcaa8d0Smrg case "$mode" in 8264bdcaa8d0Smrg clean) 8265bdcaa8d0Smrg case " $library_names " in 8266bdcaa8d0Smrg # " " in the beginning catches empty $dlname 8267bdcaa8d0Smrg *" $dlname "*) ;; 8268bdcaa8d0Smrg *) rmfiles="$rmfiles $objdir/$dlname" ;; 8269bdcaa8d0Smrg esac 82700b661123Smrg test -n "$libdir" && rmfiles="$rmfiles $objdir/$name $objdir/${name}i" 8271bdcaa8d0Smrg ;; 8272bdcaa8d0Smrg uninstall) 8273bdcaa8d0Smrg if test -n "$library_names"; then 8274bdcaa8d0Smrg # Do each command in the postuninstall commands. 82750b661123Smrg func_execute_cmds "$postuninstall_cmds" 'test "$rmforce" = yes || exit_status=1' 8276bdcaa8d0Smrg fi 8277bdcaa8d0Smrg 8278bdcaa8d0Smrg if test -n "$old_library"; then 8279bdcaa8d0Smrg # Do each command in the old_postuninstall commands. 82800b661123Smrg func_execute_cmds "$old_postuninstall_cmds" 'test "$rmforce" = yes || exit_status=1' 8281bdcaa8d0Smrg fi 8282bdcaa8d0Smrg # FIXME: should reinstall the best remaining shared library. 8283bdcaa8d0Smrg ;; 8284bdcaa8d0Smrg esac 8285bdcaa8d0Smrg fi 8286bdcaa8d0Smrg ;; 8287bdcaa8d0Smrg 8288bdcaa8d0Smrg *.lo) 8289bdcaa8d0Smrg # Possibly a libtool object, so verify it. 82900b661123Smrg if func_lalib_p "$file"; then 8291bdcaa8d0Smrg 8292bdcaa8d0Smrg # Read the .lo file 82930b661123Smrg func_source $dir/$name 8294bdcaa8d0Smrg 8295bdcaa8d0Smrg # Add PIC object to the list of files to remove. 82960b661123Smrg if test -n "$pic_object" && 82970b661123Smrg test "$pic_object" != none; then 8298bdcaa8d0Smrg rmfiles="$rmfiles $dir/$pic_object" 8299bdcaa8d0Smrg fi 8300bdcaa8d0Smrg 8301bdcaa8d0Smrg # Add non-PIC object to the list of files to remove. 83020b661123Smrg if test -n "$non_pic_object" && 83030b661123Smrg test "$non_pic_object" != none; then 8304bdcaa8d0Smrg rmfiles="$rmfiles $dir/$non_pic_object" 8305bdcaa8d0Smrg fi 8306bdcaa8d0Smrg fi 8307bdcaa8d0Smrg ;; 8308bdcaa8d0Smrg 8309bdcaa8d0Smrg *) 8310bdcaa8d0Smrg if test "$mode" = clean ; then 8311bdcaa8d0Smrg noexename=$name 8312bdcaa8d0Smrg case $file in 8313bdcaa8d0Smrg *.exe) 83140b661123Smrg func_stripname '' '.exe' "$file" 83150b661123Smrg file=$func_stripname_result 83160b661123Smrg func_stripname '' '.exe' "$name" 83170b661123Smrg noexename=$func_stripname_result 8318bdcaa8d0Smrg # $file with .exe has already been added to rmfiles, 8319bdcaa8d0Smrg # add $file without .exe 8320bdcaa8d0Smrg rmfiles="$rmfiles $file" 8321bdcaa8d0Smrg ;; 8322bdcaa8d0Smrg esac 8323bdcaa8d0Smrg # Do a test to see if this is a libtool program. 83240b661123Smrg if func_ltwrapper_p "$file"; then 83250b661123Smrg if func_ltwrapper_executable_p "$file"; then 83260b661123Smrg func_ltwrapper_scriptname "$file" 83270b661123Smrg relink_command= 83280b661123Smrg func_source $func_ltwrapper_scriptname_result 83290b661123Smrg rmfiles="$rmfiles $func_ltwrapper_scriptname_result" 83300b661123Smrg else 83310b661123Smrg relink_command= 83320b661123Smrg func_source $dir/$noexename 83330b661123Smrg fi 8334bdcaa8d0Smrg 8335bdcaa8d0Smrg # note $name still contains .exe if it was in $file originally 8336bdcaa8d0Smrg # as does the version of $file that was added into $rmfiles 8337bdcaa8d0Smrg rmfiles="$rmfiles $objdir/$name $objdir/${name}S.${objext}" 8338bdcaa8d0Smrg if test "$fast_install" = yes && test -n "$relink_command"; then 8339bdcaa8d0Smrg rmfiles="$rmfiles $objdir/lt-$name" 8340bdcaa8d0Smrg fi 8341bdcaa8d0Smrg if test "X$noexename" != "X$name" ; then 8342bdcaa8d0Smrg rmfiles="$rmfiles $objdir/lt-${noexename}.c" 8343bdcaa8d0Smrg fi 8344bdcaa8d0Smrg fi 8345bdcaa8d0Smrg fi 8346bdcaa8d0Smrg ;; 8347bdcaa8d0Smrg esac 83480b661123Smrg func_show_eval "$RM $rmfiles" 'exit_status=1' 8349bdcaa8d0Smrg done 8350bdcaa8d0Smrg objdir="$origobjdir" 8351bdcaa8d0Smrg 8352bdcaa8d0Smrg # Try to remove the ${objdir}s in the directories where we deleted files 8353bdcaa8d0Smrg for dir in $rmdirs; do 8354bdcaa8d0Smrg if test -d "$dir"; then 83550b661123Smrg func_show_eval "rmdir $dir >/dev/null 2>&1" 8356bdcaa8d0Smrg fi 8357bdcaa8d0Smrg done 8358bdcaa8d0Smrg 8359bdcaa8d0Smrg exit $exit_status 83600b661123Smrg} 8361bdcaa8d0Smrg 83620b661123Smrg{ test "$mode" = uninstall || test "$mode" = clean; } && 83630b661123Smrg func_mode_uninstall ${1+"$@"} 836472313efbSmrg 83650b661123Smrgtest -z "$mode" && { 83660b661123Smrg help="$generic_help" 83670b661123Smrg func_fatal_help "you must specify a MODE" 83680b661123Smrg} 83690b661123Smrg 83700b661123Smrgtest -z "$exec_cmd" && \ 83710b661123Smrg func_fatal_help "invalid operation mode \`$mode'" 8372bdcaa8d0Smrg 8373bdcaa8d0Smrgif test -n "$exec_cmd"; then 83740b661123Smrg eval exec "$exec_cmd" 8375bdcaa8d0Smrg exit $EXIT_FAILURE 8376bdcaa8d0Smrgfi 8377bdcaa8d0Smrg 83780b661123Smrgexit $exit_status 8379bdcaa8d0Smrg 8380bdcaa8d0Smrg 8381bdcaa8d0Smrg# The TAGs below are defined such that we never get into a situation 8382bdcaa8d0Smrg# in which we disable both kinds of libraries. Given conflicting 8383bdcaa8d0Smrg# choices, we go for a static library, that is the most portable, 8384bdcaa8d0Smrg# since we can't tell whether shared libraries were disabled because 8385bdcaa8d0Smrg# the user asked for that or because the platform doesn't support 8386bdcaa8d0Smrg# them. This is particularly important on AIX, because we don't 8387bdcaa8d0Smrg# support having both static and shared libraries enabled at the same 8388bdcaa8d0Smrg# time on that platform, so we default to a shared-only configuration. 8389bdcaa8d0Smrg# If a disable-shared tag is given, we'll fallback to a static-only 8390bdcaa8d0Smrg# configuration. But we'll never go from static-only to shared-only. 8391bdcaa8d0Smrg 8392bdcaa8d0Smrg# ### BEGIN LIBTOOL TAG CONFIG: disable-shared 83930b661123Smrgbuild_libtool_libs=no 83940b661123Smrgbuild_old_libs=yes 8395bdcaa8d0Smrg# ### END LIBTOOL TAG CONFIG: disable-shared 8396bdcaa8d0Smrg 8397bdcaa8d0Smrg# ### BEGIN LIBTOOL TAG CONFIG: disable-static 83980b661123Smrgbuild_old_libs=`case $build_libtool_libs in yes) echo no;; *) echo yes;; esac` 8399bdcaa8d0Smrg# ### END LIBTOOL TAG CONFIG: disable-static 8400bdcaa8d0Smrg 8401bdcaa8d0Smrg# Local Variables: 8402bdcaa8d0Smrg# mode:shell-script 8403bdcaa8d0Smrg# sh-indentation:2 8404bdcaa8d0Smrg# End: 84050b661123Smrg# vi:sw=2 84060b661123Smrg 8407