ltmain.sh revision 698f425b
1698f425bSmrg# Generated from ltmain.m4sh. 2698f425bSmrg 3698f425bSmrg# ltmain.sh (GNU libtool) 2.2.6 4698f425bSmrg# Written by Gordon Matzigkeit <gord@gnu.ai.mit.edu>, 1996 5698f425bSmrg 6698f425bSmrg# Copyright (C) 1996, 1997, 1998, 1999, 2000, 2001, 2003, 2004, 2005, 2006, 2007 2008 Free Software Foundation, Inc. 7698f425bSmrg# This is free software; see the source for copying conditions. There is NO 8698f425bSmrg# warranty; not even for MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. 9698f425bSmrg 10698f425bSmrg# GNU Libtool is free software; you can redistribute it and/or modify 11266e564dSmrg# it under the terms of the GNU General Public License as published by 12266e564dSmrg# the Free Software Foundation; either version 2 of the License, or 13266e564dSmrg# (at your option) any later version. 14266e564dSmrg# 15698f425bSmrg# As a special exception to the GNU General Public License, 16698f425bSmrg# if you distribute this file as part of a program or library that 17698f425bSmrg# is built using GNU Libtool, you may include this file under the 18698f425bSmrg# same distribution terms that you use for the rest of that program. 19698f425bSmrg# 20698f425bSmrg# GNU Libtool is distributed in the hope that it will be useful, but 21266e564dSmrg# WITHOUT ANY WARRANTY; without even the implied warranty of 22266e564dSmrg# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU 23266e564dSmrg# General Public License for more details. 24266e564dSmrg# 25266e564dSmrg# You should have received a copy of the GNU General Public License 26698f425bSmrg# along with GNU Libtool; see the file COPYING. If not, a copy 27698f425bSmrg# can be downloaded from http://www.gnu.org/licenses/gpl.html, 28698f425bSmrg# or obtained by writing to the Free Software Foundation, Inc., 29698f425bSmrg# 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. 30c5629e66Smrg 31698f425bSmrg# Usage: $progname [OPTION]... [MODE-ARG]... 32698f425bSmrg# 33698f425bSmrg# Provide generalized library-building support services. 34698f425bSmrg# 35698f425bSmrg# --config show all configuration variables 36698f425bSmrg# --debug enable verbose shell tracing 37698f425bSmrg# -n, --dry-run display commands without modifying any files 38698f425bSmrg# --features display basic configuration information and exit 39698f425bSmrg# --mode=MODE use operation mode MODE 40698f425bSmrg# --preserve-dup-deps don't remove duplicate dependency libraries 41698f425bSmrg# --quiet, --silent don't print informational messages 42698f425bSmrg# --tag=TAG use configuration variables from tag TAG 43698f425bSmrg# -v, --verbose print informational messages (default) 44698f425bSmrg# --version print version information 45698f425bSmrg# -h, --help print short or long help message 46698f425bSmrg# 47698f425bSmrg# MODE must be one of the following: 48698f425bSmrg# 49698f425bSmrg# clean remove files from the build directory 50698f425bSmrg# compile compile a source file into a libtool object 51698f425bSmrg# execute automatically set library path, then run a program 52698f425bSmrg# finish complete the installation of libtool libraries 53698f425bSmrg# install install libraries or executables 54698f425bSmrg# link create a library or an executable 55698f425bSmrg# uninstall remove libraries from an installed directory 56698f425bSmrg# 57698f425bSmrg# MODE-ARGS vary depending on the MODE. 58698f425bSmrg# Try `$progname --help --mode=MODE' for a more detailed description of MODE. 59698f425bSmrg# 60698f425bSmrg# When reporting a bug, please describe a test case to reproduce it and 61698f425bSmrg# include the following information: 62698f425bSmrg# 63698f425bSmrg# host-triplet: $host 64698f425bSmrg# shell: $SHELL 65698f425bSmrg# compiler: $LTCC 66698f425bSmrg# compiler flags: $LTCFLAGS 67698f425bSmrg# linker: $LD (gnu? $with_gnu_ld) 68698f425bSmrg# $progname: (GNU libtool) 2.2.6 69698f425bSmrg# automake: $automake_version 70698f425bSmrg# autoconf: $autoconf_version 71698f425bSmrg# 72698f425bSmrg# Report bugs to <bug-libtool@gnu.org>. 73266e564dSmrg 74266e564dSmrgPROGRAM=ltmain.sh 75266e564dSmrgPACKAGE=libtool 76698f425bSmrgVERSION=2.2.6 77698f425bSmrgTIMESTAMP="" 78698f425bSmrgpackage_revision=1.3012 79c5629e66Smrg 80698f425bSmrg# Be Bourne compatible 81c5629e66Smrgif test -n "${ZSH_VERSION+set}" && (emulate sh) >/dev/null 2>&1; then 82c5629e66Smrg emulate sh 83c5629e66Smrg NULLCMD=: 84c5629e66Smrg # Zsh 3.x and 4.x performs word splitting on ${1+"$@"}, which 85c5629e66Smrg # is contrary to our usage. Disable this feature. 86c5629e66Smrg alias -g '${1+"$@"}'='"$@"' 87266e564dSmrg setopt NO_GLOB_SUBST 88c5629e66Smrgelse 89c5629e66Smrg case `(set -o) 2>/dev/null` in *posix*) set -o posix;; esac 90266e564dSmrgfi 91c5629e66SmrgBIN_SH=xpg4; export BIN_SH # for Tru64 92c5629e66SmrgDUALCASE=1; export DUALCASE # for MKS sh 93266e564dSmrg 94698f425bSmrg# NLS nuisances: We save the old values to restore during execute mode. 95266e564dSmrg# Only set LANG and LC_ALL to C if already set. 96266e564dSmrg# These must not be set unconditionally because not all systems understand 97266e564dSmrg# e.g. LANG=C (notably SCO). 98698f425bSmrglt_user_locale= 99698f425bSmrglt_safe_locale= 100c5629e66Smrgfor lt_var in LANG LANGUAGE LC_ALL LC_CTYPE LC_COLLATE LC_MESSAGES 101c5629e66Smrgdo 102c5629e66Smrg eval "if test \"\${$lt_var+set}\" = set; then 103698f425bSmrg save_$lt_var=\$$lt_var 104698f425bSmrg $lt_var=C 105c5629e66Smrg export $lt_var 106698f425bSmrg lt_user_locale=\"$lt_var=\\\$save_\$lt_var; \$lt_user_locale\" 107698f425bSmrg lt_safe_locale=\"$lt_var=C; \$lt_safe_locale\" 108c5629e66Smrg fi" 109c5629e66Smrgdone 110c5629e66Smrg 111698f425bSmrg$lt_unset CDPATH 112698f425bSmrg 113698f425bSmrg 114698f425bSmrg 115698f425bSmrg 116698f425bSmrg 117698f425bSmrg: ${CP="cp -f"} 118698f425bSmrg: ${ECHO="echo"} 119698f425bSmrg: ${EGREP="/bin/grep -E"} 120698f425bSmrg: ${FGREP="/bin/grep -F"} 121698f425bSmrg: ${GREP="/bin/grep"} 122698f425bSmrg: ${LN_S="ln -s"} 123698f425bSmrg: ${MAKE="make"} 124698f425bSmrg: ${MKDIR="mkdir"} 125698f425bSmrg: ${MV="mv -f"} 126698f425bSmrg: ${RM="rm -f"} 127698f425bSmrg: ${SED="/bin/sed"} 128698f425bSmrg: ${SHELL="${CONFIG_SHELL-/bin/sh}"} 129698f425bSmrg: ${Xsed="$SED -e 1s/^X//"} 130698f425bSmrg 131698f425bSmrg# Global variables: 132698f425bSmrgEXIT_SUCCESS=0 133698f425bSmrgEXIT_FAILURE=1 134698f425bSmrgEXIT_MISMATCH=63 # $? = 63 is used to indicate version mismatch to missing. 135698f425bSmrgEXIT_SKIP=77 # $? = 77 is used to indicate a skipped test to automake. 136698f425bSmrg 137698f425bSmrgexit_status=$EXIT_SUCCESS 138266e564dSmrg 139266e564dSmrg# Make sure IFS has a sensible default 140266e564dSmrglt_nl=' 141266e564dSmrg' 142266e564dSmrgIFS=" $lt_nl" 143266e564dSmrg 144698f425bSmrgdirname="s,/[^/]*$,," 145698f425bSmrgbasename="s,^.*/,," 146698f425bSmrg 147698f425bSmrg# func_dirname_and_basename file append nondir_replacement 148698f425bSmrg# perform func_basename and func_dirname in a single function 149698f425bSmrg# call: 150698f425bSmrg# dirname: Compute the dirname of FILE. If nonempty, 151698f425bSmrg# add APPEND to the result, otherwise set result 152698f425bSmrg# to NONDIR_REPLACEMENT. 153698f425bSmrg# value returned in "$func_dirname_result" 154698f425bSmrg# basename: Compute filename of FILE. 155698f425bSmrg# value retuned in "$func_basename_result" 156698f425bSmrg# Implementation must be kept synchronized with func_dirname 157698f425bSmrg# and func_basename. For efficiency, we do not delegate to 158698f425bSmrg# those functions but instead duplicate the functionality here. 159698f425bSmrgfunc_dirname_and_basename () 160698f425bSmrg{ 161698f425bSmrg # Extract subdirectory from the argument. 162698f425bSmrg func_dirname_result=`$ECHO "X${1}" | $Xsed -e "$dirname"` 163698f425bSmrg if test "X$func_dirname_result" = "X${1}"; then 164698f425bSmrg func_dirname_result="${3}" 165698f425bSmrg else 166698f425bSmrg func_dirname_result="$func_dirname_result${2}" 167698f425bSmrg fi 168698f425bSmrg func_basename_result=`$ECHO "X${1}" | $Xsed -e "$basename"` 169698f425bSmrg} 170266e564dSmrg 171698f425bSmrg# Generated shell functions inserted here. 172698f425bSmrg 173698f425bSmrg# Work around backward compatibility issue on IRIX 6.5. On IRIX 6.4+, sh 174698f425bSmrg# is ksh but when the shell is invoked as "sh" and the current value of 175698f425bSmrg# the _XPG environment variable is not equal to 1 (one), the special 176698f425bSmrg# positional parameter $0, within a function call, is the name of the 177698f425bSmrg# function. 178698f425bSmrgprogpath="$0" 179698f425bSmrg 180698f425bSmrg# The name of this program: 181698f425bSmrg# In the unlikely event $progname began with a '-', it would play havoc with 182698f425bSmrg# func_echo (imagine progname=-n), so we prepend ./ in that case: 183698f425bSmrgfunc_dirname_and_basename "$progpath" 184698f425bSmrgprogname=$func_basename_result 185698f425bSmrgcase $progname in 186698f425bSmrg -*) progname=./$progname ;; 187698f425bSmrgesac 188698f425bSmrg 189698f425bSmrg# Make sure we have an absolute path for reexecution: 190698f425bSmrgcase $progpath in 191698f425bSmrg [\\/]*|[A-Za-z]:\\*) ;; 192698f425bSmrg *[\\/]*) 193698f425bSmrg progdir=$func_dirname_result 194698f425bSmrg progdir=`cd "$progdir" && pwd` 195698f425bSmrg progpath="$progdir/$progname" 196698f425bSmrg ;; 197698f425bSmrg *) 198698f425bSmrg save_IFS="$IFS" 199698f425bSmrg IFS=: 200698f425bSmrg for progdir in $PATH; do 201698f425bSmrg IFS="$save_IFS" 202698f425bSmrg test -x "$progdir/$progname" && break 203698f425bSmrg done 204698f425bSmrg IFS="$save_IFS" 205698f425bSmrg test -n "$progdir" || progdir=`pwd` 206698f425bSmrg progpath="$progdir/$progname" 207698f425bSmrg ;; 208698f425bSmrgesac 209698f425bSmrg 210698f425bSmrg# Sed substitution that helps us do robust quoting. It backslashifies 211698f425bSmrg# metacharacters that are still active within double-quoted strings. 212698f425bSmrgXsed="${SED}"' -e 1s/^X//' 213698f425bSmrgsed_quote_subst='s/\([`"$\\]\)/\\\1/g' 214698f425bSmrg 215698f425bSmrg# Same as above, but do not quote variable references. 216698f425bSmrgdouble_quote_subst='s/\(["`\\]\)/\\\1/g' 217698f425bSmrg 218698f425bSmrg# Re-`\' parameter expansions in output of double_quote_subst that were 219698f425bSmrg# `\'-ed in input to the same. If an odd number of `\' preceded a '$' 220698f425bSmrg# in input to double_quote_subst, that '$' was protected from expansion. 221698f425bSmrg# Since each input `\' is now two `\'s, look for any number of runs of 222698f425bSmrg# four `\'s followed by two `\'s and then a '$'. `\' that '$'. 223698f425bSmrgbs='\\' 224698f425bSmrgbs2='\\\\' 225698f425bSmrgbs4='\\\\\\\\' 226698f425bSmrgdollar='\$' 227698f425bSmrgsed_double_backslash="\ 228698f425bSmrg s/$bs4/&\\ 229698f425bSmrg/g 230698f425bSmrg s/^$bs2$dollar/$bs&/ 231698f425bSmrg s/\\([^$bs]\\)$bs2$dollar/\\1$bs2$bs$dollar/g 232698f425bSmrg s/\n//g" 233698f425bSmrg 234698f425bSmrg# Standard options: 235698f425bSmrgopt_dry_run=false 236698f425bSmrgopt_help=false 237698f425bSmrgopt_quiet=false 238698f425bSmrgopt_verbose=false 239698f425bSmrgopt_warning=: 240698f425bSmrg 241698f425bSmrg# func_echo arg... 242698f425bSmrg# Echo program name prefixed message, along with the current mode 243698f425bSmrg# name if it has been set yet. 244698f425bSmrgfunc_echo () 245698f425bSmrg{ 246698f425bSmrg $ECHO "$progname${mode+: }$mode: $*" 247698f425bSmrg} 248698f425bSmrg 249698f425bSmrg# func_verbose arg... 250698f425bSmrg# Echo program name prefixed message in verbose mode only. 251698f425bSmrgfunc_verbose () 252698f425bSmrg{ 253698f425bSmrg $opt_verbose && func_echo ${1+"$@"} 254698f425bSmrg 255698f425bSmrg # A bug in bash halts the script if the last line of a function 256698f425bSmrg # fails when set -e is in force, so we need another command to 257698f425bSmrg # work around that: 258698f425bSmrg : 259698f425bSmrg} 260698f425bSmrg 261698f425bSmrg# func_error arg... 262698f425bSmrg# Echo program name prefixed message to standard error. 263698f425bSmrgfunc_error () 264698f425bSmrg{ 265698f425bSmrg $ECHO "$progname${mode+: }$mode: "${1+"$@"} 1>&2 266698f425bSmrg} 267698f425bSmrg 268698f425bSmrg# func_warning arg... 269698f425bSmrg# Echo program name prefixed warning message to standard error. 270698f425bSmrgfunc_warning () 271698f425bSmrg{ 272698f425bSmrg $opt_warning && $ECHO "$progname${mode+: }$mode: warning: "${1+"$@"} 1>&2 273698f425bSmrg 274698f425bSmrg # bash bug again: 275698f425bSmrg : 276698f425bSmrg} 277698f425bSmrg 278698f425bSmrg# func_fatal_error arg... 279698f425bSmrg# Echo program name prefixed message to standard error, and exit. 280698f425bSmrgfunc_fatal_error () 281698f425bSmrg{ 282698f425bSmrg func_error ${1+"$@"} 283698f425bSmrg exit $EXIT_FAILURE 284698f425bSmrg} 285698f425bSmrg 286698f425bSmrg# func_fatal_help arg... 287698f425bSmrg# Echo program name prefixed message to standard error, followed by 288698f425bSmrg# a help hint, and exit. 289698f425bSmrgfunc_fatal_help () 290698f425bSmrg{ 291698f425bSmrg func_error ${1+"$@"} 292698f425bSmrg func_fatal_error "$help" 293698f425bSmrg} 294698f425bSmrghelp="Try \`$progname --help' for more information." ## default 295698f425bSmrg 296698f425bSmrg 297698f425bSmrg# func_grep expression filename 298698f425bSmrg# Check whether EXPRESSION matches any line of FILENAME, without output. 299698f425bSmrgfunc_grep () 300698f425bSmrg{ 301698f425bSmrg $GREP "$1" "$2" >/dev/null 2>&1 302698f425bSmrg} 303698f425bSmrg 304698f425bSmrg 305698f425bSmrg# func_mkdir_p directory-path 306698f425bSmrg# Make sure the entire path to DIRECTORY-PATH is available. 307698f425bSmrgfunc_mkdir_p () 308698f425bSmrg{ 309698f425bSmrg my_directory_path="$1" 310698f425bSmrg my_dir_list= 311698f425bSmrg 312698f425bSmrg if test -n "$my_directory_path" && test "$opt_dry_run" != ":"; then 313698f425bSmrg 314698f425bSmrg # Protect directory names starting with `-' 315698f425bSmrg case $my_directory_path in 316698f425bSmrg -*) my_directory_path="./$my_directory_path" ;; 317698f425bSmrg esac 318698f425bSmrg 319698f425bSmrg # While some portion of DIR does not yet exist... 320698f425bSmrg while test ! -d "$my_directory_path"; do 321698f425bSmrg # ...make a list in topmost first order. Use a colon delimited 322698f425bSmrg # list incase some portion of path contains whitespace. 323698f425bSmrg my_dir_list="$my_directory_path:$my_dir_list" 324698f425bSmrg 325698f425bSmrg # If the last portion added has no slash in it, the list is done 326698f425bSmrg case $my_directory_path in */*) ;; *) break ;; esac 327698f425bSmrg 328698f425bSmrg # ...otherwise throw away the child directory and loop 329698f425bSmrg my_directory_path=`$ECHO "X$my_directory_path" | $Xsed -e "$dirname"` 330698f425bSmrg done 331698f425bSmrg my_dir_list=`$ECHO "X$my_dir_list" | $Xsed -e 's,:*$,,'` 332698f425bSmrg 333698f425bSmrg save_mkdir_p_IFS="$IFS"; IFS=':' 334698f425bSmrg for my_dir in $my_dir_list; do 335698f425bSmrg IFS="$save_mkdir_p_IFS" 336698f425bSmrg # mkdir can fail with a `File exist' error if two processes 337698f425bSmrg # try to create one of the directories concurrently. Don't 338698f425bSmrg # stop in that case! 339698f425bSmrg $MKDIR "$my_dir" 2>/dev/null || : 340698f425bSmrg done 341698f425bSmrg IFS="$save_mkdir_p_IFS" 342698f425bSmrg 343698f425bSmrg # Bail out if we (or some other process) failed to create a directory. 344698f425bSmrg test -d "$my_directory_path" || \ 345698f425bSmrg func_fatal_error "Failed to create \`$1'" 346698f425bSmrg fi 347698f425bSmrg} 348266e564dSmrg 349266e564dSmrg 350266e564dSmrg# func_mktempdir [string] 351266e564dSmrg# Make a temporary directory that won't clash with other running 352266e564dSmrg# libtool processes, and avoids race conditions if possible. If 353266e564dSmrg# given, STRING is the basename for that directory. 354266e564dSmrgfunc_mktempdir () 355266e564dSmrg{ 356266e564dSmrg my_template="${TMPDIR-/tmp}/${1-$progname}" 357266e564dSmrg 358698f425bSmrg if test "$opt_dry_run" = ":"; then 359266e564dSmrg # Return a directory name, but don't create it in dry-run mode 360266e564dSmrg my_tmpdir="${my_template}-$$" 361266e564dSmrg else 362266e564dSmrg 363266e564dSmrg # If mktemp works, use that first and foremost 364266e564dSmrg my_tmpdir=`mktemp -d "${my_template}-XXXXXXXX" 2>/dev/null` 365266e564dSmrg 366266e564dSmrg if test ! -d "$my_tmpdir"; then 367698f425bSmrg # Failing that, at least try and use $RANDOM to avoid a race 368698f425bSmrg my_tmpdir="${my_template}-${RANDOM-0}$$" 369266e564dSmrg 370698f425bSmrg save_mktempdir_umask=`umask` 371698f425bSmrg umask 0077 372698f425bSmrg $MKDIR "$my_tmpdir" 373698f425bSmrg umask $save_mktempdir_umask 374266e564dSmrg fi 375266e564dSmrg 376266e564dSmrg # If we're not in dry-run mode, bomb out on failure 377698f425bSmrg test -d "$my_tmpdir" || \ 378698f425bSmrg func_fatal_error "cannot create temporary directory \`$my_tmpdir'" 379266e564dSmrg fi 380266e564dSmrg 381698f425bSmrg $ECHO "X$my_tmpdir" | $Xsed 382266e564dSmrg} 383266e564dSmrg 384266e564dSmrg 385698f425bSmrg# func_quote_for_eval arg 386698f425bSmrg# Aesthetically quote ARG to be evaled later. 387698f425bSmrg# This function returns two values: FUNC_QUOTE_FOR_EVAL_RESULT 388698f425bSmrg# is double-quoted, suitable for a subsequent eval, whereas 389698f425bSmrg# FUNC_QUOTE_FOR_EVAL_UNQUOTED_RESULT has merely all characters 390698f425bSmrg# which are still active within double quotes backslashified. 391698f425bSmrgfunc_quote_for_eval () 392266e564dSmrg{ 393698f425bSmrg case $1 in 394698f425bSmrg *[\\\`\"\$]*) 395698f425bSmrg func_quote_for_eval_unquoted_result=`$ECHO "X$1" | $Xsed -e "$sed_quote_subst"` ;; 396698f425bSmrg *) 397698f425bSmrg func_quote_for_eval_unquoted_result="$1" ;; 398698f425bSmrg esac 399698f425bSmrg 400698f425bSmrg case $func_quote_for_eval_unquoted_result in 401698f425bSmrg # Double-quote args containing shell metacharacters to delay 402698f425bSmrg # word splitting, command substitution and and variable 403698f425bSmrg # expansion for a subsequent eval. 404698f425bSmrg # Many Bourne shells cannot handle close brackets correctly 405698f425bSmrg # in scan sets, so we specify it separately. 406698f425bSmrg *[\[\~\#\^\&\*\(\)\{\}\|\;\<\>\?\'\ \ ]*|*]*|"") 407698f425bSmrg func_quote_for_eval_result="\"$func_quote_for_eval_unquoted_result\"" 408698f425bSmrg ;; 409698f425bSmrg *) 410698f425bSmrg func_quote_for_eval_result="$func_quote_for_eval_unquoted_result" 411266e564dSmrg esac 412266e564dSmrg} 413266e564dSmrg 414266e564dSmrg 415698f425bSmrg# func_quote_for_expand arg 416698f425bSmrg# Aesthetically quote ARG to be evaled later; same as above, 417698f425bSmrg# but do not quote variable references. 418698f425bSmrgfunc_quote_for_expand () 419266e564dSmrg{ 420698f425bSmrg case $1 in 421698f425bSmrg *[\\\`\"]*) 422698f425bSmrg my_arg=`$ECHO "X$1" | $Xsed \ 423698f425bSmrg -e "$double_quote_subst" -e "$sed_double_backslash"` ;; 424266e564dSmrg *) 425698f425bSmrg my_arg="$1" ;; 426698f425bSmrg esac 427698f425bSmrg 428698f425bSmrg case $my_arg in 429698f425bSmrg # Double-quote args containing shell metacharacters to delay 430698f425bSmrg # word splitting and command substitution for a subsequent eval. 431698f425bSmrg # Many Bourne shells cannot handle close brackets correctly 432698f425bSmrg # in scan sets, so we specify it separately. 433698f425bSmrg *[\[\~\#\^\&\*\(\)\{\}\|\;\<\>\?\'\ \ ]*|*]*|"") 434698f425bSmrg my_arg="\"$my_arg\"" 435698f425bSmrg ;; 436698f425bSmrg esac 437698f425bSmrg 438698f425bSmrg func_quote_for_expand_result="$my_arg" 439266e564dSmrg} 440266e564dSmrg 441266e564dSmrg 442698f425bSmrg# func_show_eval cmd [fail_exp] 443698f425bSmrg# Unless opt_silent is true, then output CMD. Then, if opt_dryrun is 444698f425bSmrg# not true, evaluate CMD. If the evaluation of CMD fails, and FAIL_EXP 445698f425bSmrg# is given, then evaluate it. 446698f425bSmrgfunc_show_eval () 447266e564dSmrg{ 448698f425bSmrg my_cmd="$1" 449698f425bSmrg my_fail_exp="${2-:}" 450266e564dSmrg 451698f425bSmrg ${opt_silent-false} || { 452698f425bSmrg func_quote_for_expand "$my_cmd" 453698f425bSmrg eval "func_echo $func_quote_for_expand_result" 454698f425bSmrg } 455698f425bSmrg 456698f425bSmrg if ${opt_dry_run-false}; then :; else 457698f425bSmrg eval "$my_cmd" 458698f425bSmrg my_status=$? 459698f425bSmrg if test "$my_status" -eq 0; then :; else 460698f425bSmrg eval "(exit $my_status); $my_fail_exp" 461698f425bSmrg fi 462266e564dSmrg fi 463266e564dSmrg} 464266e564dSmrg 465698f425bSmrg 466698f425bSmrg# func_show_eval_locale cmd [fail_exp] 467698f425bSmrg# Unless opt_silent is true, then output CMD. Then, if opt_dryrun is 468698f425bSmrg# not true, evaluate CMD. If the evaluation of CMD fails, and FAIL_EXP 469698f425bSmrg# is given, then evaluate it. Use the saved locale for evaluation. 470698f425bSmrgfunc_show_eval_locale () 471266e564dSmrg{ 472698f425bSmrg my_cmd="$1" 473698f425bSmrg my_fail_exp="${2-:}" 474698f425bSmrg 475698f425bSmrg ${opt_silent-false} || { 476698f425bSmrg func_quote_for_expand "$my_cmd" 477698f425bSmrg eval "func_echo $func_quote_for_expand_result" 478698f425bSmrg } 479698f425bSmrg 480698f425bSmrg if ${opt_dry_run-false}; then :; else 481698f425bSmrg eval "$lt_user_locale 482698f425bSmrg $my_cmd" 483698f425bSmrg my_status=$? 484698f425bSmrg eval "$lt_safe_locale" 485698f425bSmrg if test "$my_status" -eq 0; then :; else 486698f425bSmrg eval "(exit $my_status); $my_fail_exp" 487698f425bSmrg fi 488266e564dSmrg fi 489698f425bSmrg} 490266e564dSmrg 491266e564dSmrg 492698f425bSmrg 493698f425bSmrg 494698f425bSmrg 495698f425bSmrg# func_version 496698f425bSmrg# Echo version message to standard output and exit. 497698f425bSmrgfunc_version () 498698f425bSmrg{ 499698f425bSmrg $SED -n '/^# '$PROGRAM' (GNU /,/# warranty; / { 500698f425bSmrg s/^# // 501698f425bSmrg s/^# *$// 502698f425bSmrg s/\((C)\)[ 0-9,-]*\( [1-9][0-9]*\)/\1\2/ 503698f425bSmrg p 504698f425bSmrg }' < "$progpath" 505698f425bSmrg exit $? 506266e564dSmrg} 507266e564dSmrg 508698f425bSmrg# func_usage 509698f425bSmrg# Echo short help message to standard output and exit. 510698f425bSmrgfunc_usage () 511698f425bSmrg{ 512698f425bSmrg $SED -n '/^# Usage:/,/# -h/ { 513698f425bSmrg s/^# // 514698f425bSmrg s/^# *$// 515698f425bSmrg s/\$progname/'$progname'/ 516698f425bSmrg p 517698f425bSmrg }' < "$progpath" 518698f425bSmrg $ECHO 519698f425bSmrg $ECHO "run \`$progname --help | more' for full usage" 520698f425bSmrg exit $? 521698f425bSmrg} 522266e564dSmrg 523698f425bSmrg# func_help 524698f425bSmrg# Echo long help message to standard output and exit. 525698f425bSmrgfunc_help () 526698f425bSmrg{ 527698f425bSmrg $SED -n '/^# Usage:/,/# Report bugs to/ { 528698f425bSmrg s/^# // 529698f425bSmrg s/^# *$// 530698f425bSmrg s*\$progname*'$progname'* 531698f425bSmrg s*\$host*'"$host"'* 532698f425bSmrg s*\$SHELL*'"$SHELL"'* 533698f425bSmrg s*\$LTCC*'"$LTCC"'* 534698f425bSmrg s*\$LTCFLAGS*'"$LTCFLAGS"'* 535698f425bSmrg s*\$LD*'"$LD"'* 536698f425bSmrg s/\$with_gnu_ld/'"$with_gnu_ld"'/ 537698f425bSmrg s/\$automake_version/'"`(automake --version) 2>/dev/null |$SED 1q`"'/ 538698f425bSmrg s/\$autoconf_version/'"`(autoconf --version) 2>/dev/null |$SED 1q`"'/ 539698f425bSmrg p 540698f425bSmrg }' < "$progpath" 541698f425bSmrg exit $? 542698f425bSmrg} 543266e564dSmrg 544698f425bSmrg# func_missing_arg argname 545698f425bSmrg# Echo program name prefixed message to standard error and set global 546698f425bSmrg# exit_cmd. 547698f425bSmrgfunc_missing_arg () 548698f425bSmrg{ 549698f425bSmrg func_error "missing argument for $1" 550698f425bSmrg exit_cmd=exit 551698f425bSmrg} 552698f425bSmrg 553698f425bSmrgexit_cmd=: 554698f425bSmrg 555698f425bSmrg 556698f425bSmrg 557698f425bSmrg 558698f425bSmrg 559698f425bSmrg# Check that we have a working $ECHO. 560698f425bSmrgif test "X$1" = X--no-reexec; then 561698f425bSmrg # Discard the --no-reexec flag, and continue. 562266e564dSmrg shift 563698f425bSmrgelif test "X$1" = X--fallback-echo; then 564698f425bSmrg # Avoid inline document here, it may be left over 565698f425bSmrg : 566698f425bSmrgelif test "X`{ $ECHO '\t'; } 2>/dev/null`" = 'X\t'; then 567698f425bSmrg # Yippee, $ECHO works! 568698f425bSmrg : 569698f425bSmrgelse 570698f425bSmrg # Restart under the correct shell, and then maybe $ECHO will work. 571698f425bSmrg exec $SHELL "$progpath" --no-reexec ${1+"$@"} 572698f425bSmrgfi 573266e564dSmrg 574698f425bSmrgif test "X$1" = X--fallback-echo; then 575698f425bSmrg # used as fallback echo 576698f425bSmrg shift 577698f425bSmrg cat <<EOF 578698f425bSmrg$* 579698f425bSmrgEOF 580698f425bSmrg exit $EXIT_SUCCESS 581698f425bSmrgfi 582266e564dSmrg 583698f425bSmrgmagic="%%%MAGIC variable%%%" 584698f425bSmrgmagic_exe="%%%MAGIC EXE variable%%%" 585266e564dSmrg 586698f425bSmrg# Global variables. 587698f425bSmrg# $mode is unset 588698f425bSmrgnonopt= 589698f425bSmrgexecute_dlfiles= 590698f425bSmrgpreserve_args= 591698f425bSmrglo2o="s/\\.lo\$/.${objext}/" 592698f425bSmrgo2lo="s/\\.${objext}\$/.lo/" 593698f425bSmrgextracted_archives= 594698f425bSmrgextracted_serial=0 595266e564dSmrg 596698f425bSmrgopt_dry_run=false 597698f425bSmrgopt_duplicate_deps=false 598698f425bSmrgopt_silent=false 599698f425bSmrgopt_debug=: 600266e564dSmrg 601698f425bSmrg# If this variable is set in any of the actions, the command in it 602698f425bSmrg# will be execed at the end. This prevents here-documents from being 603698f425bSmrg# left over by shells. 604698f425bSmrgexec_cmd= 605698f425bSmrg 606698f425bSmrg# func_fatal_configuration arg... 607698f425bSmrg# Echo program name prefixed message to standard error, followed by 608698f425bSmrg# a configuration failure hint, and exit. 609698f425bSmrgfunc_fatal_configuration () 610698f425bSmrg{ 611698f425bSmrg func_error ${1+"$@"} 612698f425bSmrg func_error "See the $PACKAGE documentation for more information." 613698f425bSmrg func_fatal_error "Fatal configuration error." 614698f425bSmrg} 615266e564dSmrg 616c5629e66Smrg 617698f425bSmrg# func_config 618698f425bSmrg# Display the configuration for all the tags in this script. 619698f425bSmrgfunc_config () 620698f425bSmrg{ 621698f425bSmrg re_begincf='^# ### BEGIN LIBTOOL' 622698f425bSmrg re_endcf='^# ### END LIBTOOL' 623698f425bSmrg 624698f425bSmrg # Default configuration. 625698f425bSmrg $SED "1,/$re_begincf CONFIG/d;/$re_endcf CONFIG/,\$d" < "$progpath" 626266e564dSmrg 627266e564dSmrg # Now print the configurations for the tags. 628266e564dSmrg for tagname in $taglist; do 629698f425bSmrg $SED -n "/$re_begincf TAG CONFIG: $tagname\$/,/$re_endcf TAG CONFIG: $tagname\$/p" < "$progpath" 630266e564dSmrg done 631266e564dSmrg 632698f425bSmrg exit $? 633698f425bSmrg} 634266e564dSmrg 635698f425bSmrg# func_features 636698f425bSmrg# Display the features supported by this script. 637698f425bSmrgfunc_features () 638698f425bSmrg{ 639698f425bSmrg $ECHO "host: $host" 640266e564dSmrg if test "$build_libtool_libs" = yes; then 641698f425bSmrg $ECHO "enable shared libraries" 642266e564dSmrg else 643698f425bSmrg $ECHO "disable shared libraries" 644266e564dSmrg fi 645266e564dSmrg if test "$build_old_libs" = yes; then 646698f425bSmrg $ECHO "enable static libraries" 647266e564dSmrg else 648698f425bSmrg $ECHO "disable static libraries" 649266e564dSmrg fi 650698f425bSmrg 651266e564dSmrg exit $? 652698f425bSmrg} 653266e564dSmrg 654698f425bSmrg# func_enable_tag tagname 655698f425bSmrg# Verify that TAGNAME is valid, and either flag an error and exit, or 656698f425bSmrg# enable the TAGNAME tag. We also add TAGNAME to the global $taglist 657698f425bSmrg# variable here. 658698f425bSmrgfunc_enable_tag () 659698f425bSmrg{ 660698f425bSmrg # Global variable: 661698f425bSmrg tagname="$1" 662266e564dSmrg 663698f425bSmrg re_begincf="^# ### BEGIN LIBTOOL TAG CONFIG: $tagname\$" 664698f425bSmrg re_endcf="^# ### END LIBTOOL TAG CONFIG: $tagname\$" 665698f425bSmrg sed_extractcf="/$re_begincf/,/$re_endcf/p" 666266e564dSmrg 667698f425bSmrg # Validate tagname. 668698f425bSmrg case $tagname in 669698f425bSmrg *[!-_A-Za-z0-9,/]*) 670698f425bSmrg func_fatal_error "invalid tag name: $tagname" 671698f425bSmrg ;; 672698f425bSmrg esac 673266e564dSmrg 674698f425bSmrg # Don't test for the "default" C tag, as we know it's 675698f425bSmrg # there but not specially marked. 676698f425bSmrg case $tagname in 677698f425bSmrg CC) ;; 678698f425bSmrg *) 679698f425bSmrg if $GREP "$re_begincf" "$progpath" >/dev/null 2>&1; then 680698f425bSmrg taglist="$taglist $tagname" 681698f425bSmrg 682698f425bSmrg # Evaluate the configuration. Be careful to quote the path 683698f425bSmrg # and the sed script, to avoid splitting on whitespace, but 684698f425bSmrg # also don't use non-portable quotes within backquotes within 685698f425bSmrg # quotes we have to do it in 2 steps: 686698f425bSmrg extractedcf=`$SED -n -e "$sed_extractcf" < "$progpath"` 687698f425bSmrg eval "$extractedcf" 688698f425bSmrg else 689698f425bSmrg func_error "ignoring unknown tag $tagname" 690698f425bSmrg fi 691698f425bSmrg ;; 692698f425bSmrg esac 693698f425bSmrg} 694698f425bSmrg 695698f425bSmrg# Parse options once, thoroughly. This comes as soon as possible in 696698f425bSmrg# the script to make things like `libtool --version' happen quickly. 697698f425bSmrg{ 698266e564dSmrg 699698f425bSmrg # Shorthand for --mode=foo, only valid as the first argument 700698f425bSmrg case $1 in 701698f425bSmrg clean|clea|cle|cl) 702698f425bSmrg shift; set dummy --mode clean ${1+"$@"}; shift 703266e564dSmrg ;; 704698f425bSmrg compile|compil|compi|comp|com|co|c) 705698f425bSmrg shift; set dummy --mode compile ${1+"$@"}; shift 706266e564dSmrg ;; 707698f425bSmrg execute|execut|execu|exec|exe|ex|e) 708698f425bSmrg shift; set dummy --mode execute ${1+"$@"}; shift 709266e564dSmrg ;; 710698f425bSmrg finish|finis|fini|fin|fi|f) 711698f425bSmrg shift; set dummy --mode finish ${1+"$@"}; shift 712266e564dSmrg ;; 713698f425bSmrg install|instal|insta|inst|ins|in|i) 714698f425bSmrg shift; set dummy --mode install ${1+"$@"}; shift 715698f425bSmrg ;; 716698f425bSmrg link|lin|li|l) 717698f425bSmrg shift; set dummy --mode link ${1+"$@"}; shift 718698f425bSmrg ;; 719698f425bSmrg uninstall|uninstal|uninsta|uninst|unins|unin|uni|un|u) 720698f425bSmrg shift; set dummy --mode uninstall ${1+"$@"}; shift 721266e564dSmrg ;; 722266e564dSmrg esac 723266e564dSmrg 724698f425bSmrg # Parse non-mode specific arguments: 725698f425bSmrg while test "$#" -gt 0; do 726698f425bSmrg opt="$1" 727698f425bSmrg shift 728266e564dSmrg 729698f425bSmrg case $opt in 730698f425bSmrg --config) func_config ;; 731266e564dSmrg 732698f425bSmrg --debug) preserve_args="$preserve_args $opt" 733698f425bSmrg func_echo "enabling shell trace mode" 734698f425bSmrg opt_debug='set -x' 735698f425bSmrg $opt_debug 736698f425bSmrg ;; 737698f425bSmrg 738698f425bSmrg -dlopen) test "$#" -eq 0 && func_missing_arg "$opt" && break 739698f425bSmrg execute_dlfiles="$execute_dlfiles $1" 740698f425bSmrg shift 741698f425bSmrg ;; 742266e564dSmrg 743698f425bSmrg --dry-run | -n) opt_dry_run=: ;; 744698f425bSmrg --features) func_features ;; 745698f425bSmrg --finish) mode="finish" ;; 746698f425bSmrg 747698f425bSmrg --mode) test "$#" -eq 0 && func_missing_arg "$opt" && break 748698f425bSmrg case $1 in 749698f425bSmrg # Valid mode arguments: 750698f425bSmrg clean) ;; 751698f425bSmrg compile) ;; 752698f425bSmrg execute) ;; 753698f425bSmrg finish) ;; 754698f425bSmrg install) ;; 755698f425bSmrg link) ;; 756698f425bSmrg relink) ;; 757698f425bSmrg uninstall) ;; 758698f425bSmrg 759698f425bSmrg # Catch anything else as an error 760698f425bSmrg *) func_error "invalid argument for $opt" 761698f425bSmrg exit_cmd=exit 762698f425bSmrg break 763698f425bSmrg ;; 764698f425bSmrg esac 765698f425bSmrg 766698f425bSmrg mode="$1" 767698f425bSmrg shift 768698f425bSmrg ;; 769266e564dSmrg 770698f425bSmrg --preserve-dup-deps) 771698f425bSmrg opt_duplicate_deps=: ;; 772698f425bSmrg 773698f425bSmrg --quiet|--silent) preserve_args="$preserve_args $opt" 774698f425bSmrg opt_silent=: 775698f425bSmrg ;; 776698f425bSmrg 777698f425bSmrg --verbose| -v) preserve_args="$preserve_args $opt" 778698f425bSmrg opt_silent=false 779698f425bSmrg ;; 780698f425bSmrg 781698f425bSmrg --tag) test "$#" -eq 0 && func_missing_arg "$opt" && break 782698f425bSmrg preserve_args="$preserve_args $opt $1" 783698f425bSmrg func_enable_tag "$1" # tagname is set here 784698f425bSmrg shift 785698f425bSmrg ;; 786698f425bSmrg 787698f425bSmrg # Separate optargs to long options: 788698f425bSmrg -dlopen=*|--mode=*|--tag=*) 789698f425bSmrg func_opt_split "$opt" 790698f425bSmrg set dummy "$func_opt_split_opt" "$func_opt_split_arg" ${1+"$@"} 791698f425bSmrg shift 792698f425bSmrg ;; 793698f425bSmrg 794698f425bSmrg -\?|-h) func_usage ;; 795698f425bSmrg --help) opt_help=: ;; 796698f425bSmrg --version) func_version ;; 797698f425bSmrg 798698f425bSmrg -*) func_fatal_help "unrecognized option \`$opt'" ;; 799698f425bSmrg 800698f425bSmrg *) nonopt="$opt" 801698f425bSmrg break 802698f425bSmrg ;; 803698f425bSmrg esac 804698f425bSmrg done 805698f425bSmrg 806698f425bSmrg 807698f425bSmrg case $host in 808698f425bSmrg *cygwin* | *mingw* | *pw32* | *cegcc*) 809698f425bSmrg # don't eliminate duplications in $postdeps and $predeps 810698f425bSmrg opt_duplicate_compiler_generated_deps=: 811266e564dSmrg ;; 812266e564dSmrg *) 813698f425bSmrg opt_duplicate_compiler_generated_deps=$opt_duplicate_deps 814698f425bSmrg ;; 815698f425bSmrg esac 816266e564dSmrg 817698f425bSmrg # Having warned about all mis-specified options, bail out if 818698f425bSmrg # anything was wrong. 819698f425bSmrg $exit_cmd $EXIT_FAILURE 820698f425bSmrg} 821698f425bSmrg 822698f425bSmrg# func_check_version_match 823698f425bSmrg# Ensure that we are using m4 macros, and libtool script from the same 824698f425bSmrg# release of libtool. 825698f425bSmrgfunc_check_version_match () 826698f425bSmrg{ 827698f425bSmrg if test "$package_revision" != "$macro_revision"; then 828698f425bSmrg if test "$VERSION" != "$macro_version"; then 829698f425bSmrg if test -z "$macro_version"; then 830698f425bSmrg cat >&2 <<_LT_EOF 831698f425bSmrg$progname: Version mismatch error. This is $PACKAGE $VERSION, but the 832698f425bSmrg$progname: definition of this LT_INIT comes from an older release. 833698f425bSmrg$progname: You should recreate aclocal.m4 with macros from $PACKAGE $VERSION 834698f425bSmrg$progname: and run autoconf again. 835698f425bSmrg_LT_EOF 836698f425bSmrg else 837698f425bSmrg cat >&2 <<_LT_EOF 838698f425bSmrg$progname: Version mismatch error. This is $PACKAGE $VERSION, but the 839698f425bSmrg$progname: definition of this LT_INIT comes from $PACKAGE $macro_version. 840698f425bSmrg$progname: You should recreate aclocal.m4 with macros from $PACKAGE $VERSION 841698f425bSmrg$progname: and run autoconf again. 842698f425bSmrg_LT_EOF 843266e564dSmrg fi 844698f425bSmrg else 845698f425bSmrg cat >&2 <<_LT_EOF 846698f425bSmrg$progname: Version mismatch error. This is $PACKAGE $VERSION, revision $package_revision, 847698f425bSmrg$progname: but the definition of this LT_INIT comes from revision $macro_revision. 848698f425bSmrg$progname: You should recreate aclocal.m4 with macros from revision $package_revision 849698f425bSmrg$progname: of $PACKAGE $VERSION and run autoconf again. 850698f425bSmrg_LT_EOF 851698f425bSmrg fi 852698f425bSmrg 853698f425bSmrg exit $EXIT_MISMATCH 854266e564dSmrg fi 855698f425bSmrg} 856698f425bSmrg 857698f425bSmrg 858698f425bSmrg## ----------- ## 859698f425bSmrg## Main. ## 860698f425bSmrg## ----------- ## 861698f425bSmrg 862698f425bSmrg$opt_help || { 863698f425bSmrg # Sanity checks first: 864698f425bSmrg func_check_version_match 865698f425bSmrg 866698f425bSmrg if test "$build_libtool_libs" != yes && test "$build_old_libs" != yes; then 867698f425bSmrg func_fatal_configuration "not configured to build any kind of library" 868698f425bSmrg fi 869698f425bSmrg 870698f425bSmrg test -z "$mode" && func_fatal_error "error: you must specify a MODE." 871698f425bSmrg 872698f425bSmrg 873698f425bSmrg # Darwin sucks 874698f425bSmrg eval std_shrext=\"$shrext_cmds\" 875698f425bSmrg 876266e564dSmrg 877266e564dSmrg # Only execute mode is allowed to have -dlopen flags. 878266e564dSmrg if test -n "$execute_dlfiles" && test "$mode" != execute; then 879698f425bSmrg func_error "unrecognized option \`-dlopen'" 880698f425bSmrg $ECHO "$help" 1>&2 881266e564dSmrg exit $EXIT_FAILURE 882266e564dSmrg fi 883266e564dSmrg 884266e564dSmrg # Change the help message to a mode-specific one. 885266e564dSmrg generic_help="$help" 886698f425bSmrg help="Try \`$progname --help --mode=$mode' for more information." 887698f425bSmrg} 888266e564dSmrg 889266e564dSmrg 890698f425bSmrg# func_lalib_p file 891698f425bSmrg# True iff FILE is a libtool `.la' library or `.lo' object file. 892698f425bSmrg# This function is only a basic sanity check; it will hardly flush out 893698f425bSmrg# determined imposters. 894698f425bSmrgfunc_lalib_p () 895698f425bSmrg{ 896698f425bSmrg test -f "$1" && 897698f425bSmrg $SED -e 4q "$1" 2>/dev/null \ 898698f425bSmrg | $GREP "^# Generated by .*$PACKAGE" > /dev/null 2>&1 899698f425bSmrg} 900266e564dSmrg 901698f425bSmrg# func_lalib_unsafe_p file 902698f425bSmrg# True iff FILE is a libtool `.la' library or `.lo' object file. 903698f425bSmrg# This function implements the same check as func_lalib_p without 904698f425bSmrg# resorting to external programs. To this end, it redirects stdin and 905698f425bSmrg# closes it afterwards, without saving the original file descriptor. 906698f425bSmrg# As a safety measure, use it only where a negative result would be 907698f425bSmrg# fatal anyway. Works if `file' does not exist. 908698f425bSmrgfunc_lalib_unsafe_p () 909698f425bSmrg{ 910698f425bSmrg lalib_p=no 911698f425bSmrg if test -f "$1" && test -r "$1" && exec 5<&0 <"$1"; then 912698f425bSmrg for lalib_p_l in 1 2 3 4 913698f425bSmrg do 914698f425bSmrg read lalib_p_line 915698f425bSmrg case "$lalib_p_line" in 916698f425bSmrg \#\ Generated\ by\ *$PACKAGE* ) lalib_p=yes; break;; 917698f425bSmrg esac 918698f425bSmrg done 919698f425bSmrg exec 0<&5 5<&- 920698f425bSmrg fi 921698f425bSmrg test "$lalib_p" = yes 922698f425bSmrg} 923266e564dSmrg 924698f425bSmrg# func_ltwrapper_script_p file 925698f425bSmrg# True iff FILE is a libtool wrapper script 926698f425bSmrg# This function is only a basic sanity check; it will hardly flush out 927698f425bSmrg# determined imposters. 928698f425bSmrgfunc_ltwrapper_script_p () 929698f425bSmrg{ 930698f425bSmrg func_lalib_p "$1" 931698f425bSmrg} 932266e564dSmrg 933698f425bSmrg# func_ltwrapper_executable_p file 934698f425bSmrg# True iff FILE is a libtool wrapper executable 935698f425bSmrg# This function is only a basic sanity check; it will hardly flush out 936698f425bSmrg# determined imposters. 937698f425bSmrgfunc_ltwrapper_executable_p () 938698f425bSmrg{ 939698f425bSmrg func_ltwrapper_exec_suffix= 940698f425bSmrg case $1 in 941698f425bSmrg *.exe) ;; 942698f425bSmrg *) func_ltwrapper_exec_suffix=.exe ;; 943698f425bSmrg esac 944698f425bSmrg $GREP "$magic_exe" "$1$func_ltwrapper_exec_suffix" >/dev/null 2>&1 945698f425bSmrg} 946698f425bSmrg 947698f425bSmrg# func_ltwrapper_scriptname file 948698f425bSmrg# Assumes file is an ltwrapper_executable 949698f425bSmrg# uses $file to determine the appropriate filename for a 950698f425bSmrg# temporary ltwrapper_script. 951698f425bSmrgfunc_ltwrapper_scriptname () 952698f425bSmrg{ 953698f425bSmrg func_ltwrapper_scriptname_result="" 954698f425bSmrg if func_ltwrapper_executable_p "$1"; then 955698f425bSmrg func_dirname_and_basename "$1" "" "." 956698f425bSmrg func_stripname '' '.exe' "$func_basename_result" 957698f425bSmrg func_ltwrapper_scriptname_result="$func_dirname_result/$objdir/${func_stripname_result}_ltshwrapper" 958698f425bSmrg fi 959698f425bSmrg} 960698f425bSmrg 961698f425bSmrg# func_ltwrapper_p file 962698f425bSmrg# True iff FILE is a libtool wrapper script or wrapper executable 963698f425bSmrg# This function is only a basic sanity check; it will hardly flush out 964698f425bSmrg# determined imposters. 965698f425bSmrgfunc_ltwrapper_p () 966698f425bSmrg{ 967698f425bSmrg func_ltwrapper_script_p "$1" || func_ltwrapper_executable_p "$1" 968698f425bSmrg} 969698f425bSmrg 970698f425bSmrg 971698f425bSmrg# func_execute_cmds commands fail_cmd 972698f425bSmrg# Execute tilde-delimited COMMANDS. 973698f425bSmrg# If FAIL_CMD is given, eval that upon failure. 974698f425bSmrg# FAIL_CMD may read-access the current command in variable CMD! 975698f425bSmrgfunc_execute_cmds () 976698f425bSmrg{ 977698f425bSmrg $opt_debug 978698f425bSmrg save_ifs=$IFS; IFS='~' 979698f425bSmrg for cmd in $1; do 980698f425bSmrg IFS=$save_ifs 981698f425bSmrg eval cmd=\"$cmd\" 982698f425bSmrg func_show_eval "$cmd" "${2-:}" 983698f425bSmrg done 984698f425bSmrg IFS=$save_ifs 985698f425bSmrg} 986698f425bSmrg 987698f425bSmrg 988698f425bSmrg# func_source file 989698f425bSmrg# Source FILE, adding directory component if necessary. 990698f425bSmrg# Note that it is not necessary on cygwin/mingw to append a dot to 991698f425bSmrg# FILE even if both FILE and FILE.exe exist: automatic-append-.exe 992698f425bSmrg# behavior happens only for exec(3), not for open(2)! Also, sourcing 993698f425bSmrg# `FILE.' does not work on cygwin managed mounts. 994698f425bSmrgfunc_source () 995698f425bSmrg{ 996698f425bSmrg $opt_debug 997698f425bSmrg case $1 in 998698f425bSmrg */* | *\\*) . "$1" ;; 999698f425bSmrg *) . "./$1" ;; 1000698f425bSmrg esac 1001698f425bSmrg} 1002698f425bSmrg 1003698f425bSmrg 1004698f425bSmrg# func_infer_tag arg 1005698f425bSmrg# Infer tagged configuration to use if any are available and 1006698f425bSmrg# if one wasn't chosen via the "--tag" command line option. 1007698f425bSmrg# Only attempt this if the compiler in the base compile 1008698f425bSmrg# command doesn't match the default compiler. 1009698f425bSmrg# arg is usually of the form 'gcc ...' 1010698f425bSmrgfunc_infer_tag () 1011698f425bSmrg{ 1012698f425bSmrg $opt_debug 1013698f425bSmrg if test -n "$available_tags" && test -z "$tagname"; then 1014698f425bSmrg CC_quoted= 1015698f425bSmrg for arg in $CC; do 1016698f425bSmrg func_quote_for_eval "$arg" 1017698f425bSmrg CC_quoted="$CC_quoted $func_quote_for_eval_result" 1018698f425bSmrg done 1019698f425bSmrg case $@ in 1020698f425bSmrg # Blanks in the command may have been stripped by the calling shell, 1021698f425bSmrg # but not from the CC environment variable when configure was run. 1022698f425bSmrg " $CC "* | "$CC "* | " `$ECHO $CC` "* | "`$ECHO $CC` "* | " $CC_quoted"* | "$CC_quoted "* | " `$ECHO $CC_quoted` "* | "`$ECHO $CC_quoted` "*) ;; 1023698f425bSmrg # Blanks at the start of $base_compile will cause this to fail 1024698f425bSmrg # if we don't check for them as well. 1025698f425bSmrg *) 1026698f425bSmrg for z in $available_tags; do 1027698f425bSmrg if $GREP "^# ### BEGIN LIBTOOL TAG CONFIG: $z$" < "$progpath" > /dev/null; then 1028698f425bSmrg # Evaluate the configuration. 1029698f425bSmrg eval "`${SED} -n -e '/^# ### BEGIN LIBTOOL TAG CONFIG: '$z'$/,/^# ### END LIBTOOL TAG CONFIG: '$z'$/p' < $progpath`" 1030698f425bSmrg CC_quoted= 1031698f425bSmrg for arg in $CC; do 1032698f425bSmrg # Double-quote args containing other shell metacharacters. 1033698f425bSmrg func_quote_for_eval "$arg" 1034698f425bSmrg CC_quoted="$CC_quoted $func_quote_for_eval_result" 1035698f425bSmrg done 1036698f425bSmrg case "$@ " in 1037698f425bSmrg " $CC "* | "$CC "* | " `$ECHO $CC` "* | "`$ECHO $CC` "* | " $CC_quoted"* | "$CC_quoted "* | " `$ECHO $CC_quoted` "* | "`$ECHO $CC_quoted` "*) 1038698f425bSmrg # The compiler in the base compile command matches 1039698f425bSmrg # the one in the tagged configuration. 1040698f425bSmrg # Assume this is the tagged configuration we want. 1041698f425bSmrg tagname=$z 1042698f425bSmrg break 1043698f425bSmrg ;; 1044698f425bSmrg esac 1045698f425bSmrg fi 1046698f425bSmrg done 1047698f425bSmrg # If $tagname still isn't set, then no tagged configuration 1048698f425bSmrg # was found and let the user know that the "--tag" command 1049698f425bSmrg # line option must be used. 1050698f425bSmrg if test -z "$tagname"; then 1051698f425bSmrg func_echo "unable to infer tagged configuration" 1052698f425bSmrg func_fatal_error "specify a tag with \`--tag'" 1053698f425bSmrg# else 1054698f425bSmrg# func_verbose "using $tagname tagged configuration" 1055698f425bSmrg fi 1056698f425bSmrg ;; 1057698f425bSmrg esac 1058698f425bSmrg fi 1059698f425bSmrg} 1060698f425bSmrg 1061698f425bSmrg 1062698f425bSmrg 1063698f425bSmrg# func_write_libtool_object output_name pic_name nonpic_name 1064698f425bSmrg# Create a libtool object file (analogous to a ".la" file), 1065698f425bSmrg# but don't create it if we're doing a dry run. 1066698f425bSmrgfunc_write_libtool_object () 1067698f425bSmrg{ 1068698f425bSmrg write_libobj=${1} 1069698f425bSmrg if test "$build_libtool_libs" = yes; then 1070698f425bSmrg write_lobj=\'${2}\' 1071698f425bSmrg else 1072698f425bSmrg write_lobj=none 1073698f425bSmrg fi 1074698f425bSmrg 1075698f425bSmrg if test "$build_old_libs" = yes; then 1076698f425bSmrg write_oldobj=\'${3}\' 1077698f425bSmrg else 1078698f425bSmrg write_oldobj=none 1079698f425bSmrg fi 1080698f425bSmrg 1081698f425bSmrg $opt_dry_run || { 1082698f425bSmrg cat >${write_libobj}T <<EOF 1083698f425bSmrg# $write_libobj - a libtool object file 1084698f425bSmrg# Generated by $PROGRAM (GNU $PACKAGE$TIMESTAMP) $VERSION 1085698f425bSmrg# 1086698f425bSmrg# Please DO NOT delete this file! 1087698f425bSmrg# It is necessary for linking the library. 1088698f425bSmrg 1089698f425bSmrg# Name of the PIC object. 1090698f425bSmrgpic_object=$write_lobj 1091698f425bSmrg 1092698f425bSmrg# Name of the non-PIC object 1093698f425bSmrgnon_pic_object=$write_oldobj 1094698f425bSmrg 1095698f425bSmrgEOF 1096698f425bSmrg $MV "${write_libobj}T" "${write_libobj}" 1097698f425bSmrg } 1098698f425bSmrg} 1099698f425bSmrg 1100698f425bSmrg# func_mode_compile arg... 1101698f425bSmrgfunc_mode_compile () 1102698f425bSmrg{ 1103698f425bSmrg $opt_debug 1104698f425bSmrg # Get the compilation command and the source file. 1105698f425bSmrg base_compile= 1106698f425bSmrg srcfile="$nonopt" # always keep a non-empty value in "srcfile" 1107698f425bSmrg suppress_opt=yes 1108698f425bSmrg suppress_output= 1109698f425bSmrg arg_mode=normal 1110698f425bSmrg libobj= 1111698f425bSmrg later= 1112698f425bSmrg pie_flag= 1113698f425bSmrg 1114698f425bSmrg for arg 1115698f425bSmrg do 1116698f425bSmrg case $arg_mode in 1117698f425bSmrg arg ) 1118698f425bSmrg # do not "continue". Instead, add this to base_compile 1119698f425bSmrg lastarg="$arg" 1120698f425bSmrg arg_mode=normal 1121698f425bSmrg ;; 1122698f425bSmrg 1123698f425bSmrg target ) 1124698f425bSmrg libobj="$arg" 1125698f425bSmrg arg_mode=normal 1126698f425bSmrg continue 1127698f425bSmrg ;; 1128698f425bSmrg 1129698f425bSmrg normal ) 1130698f425bSmrg # Accept any command-line options. 1131698f425bSmrg case $arg in 1132698f425bSmrg -o) 1133698f425bSmrg test -n "$libobj" && \ 1134698f425bSmrg func_fatal_error "you cannot specify \`-o' more than once" 1135698f425bSmrg arg_mode=target 1136698f425bSmrg continue 1137698f425bSmrg ;; 1138698f425bSmrg 1139698f425bSmrg -pie | -fpie | -fPIE) 1140698f425bSmrg pie_flag="$pie_flag $arg" 1141698f425bSmrg continue 1142698f425bSmrg ;; 1143698f425bSmrg 1144698f425bSmrg -shared | -static | -prefer-pic | -prefer-non-pic) 1145698f425bSmrg later="$later $arg" 1146698f425bSmrg continue 1147698f425bSmrg ;; 1148266e564dSmrg 1149266e564dSmrg -no-suppress) 1150266e564dSmrg suppress_opt=no 1151266e564dSmrg continue 1152266e564dSmrg ;; 1153266e564dSmrg 1154266e564dSmrg -Xcompiler) 1155266e564dSmrg arg_mode=arg # the next one goes into the "base_compile" arg list 1156266e564dSmrg continue # The current "srcfile" will either be retained or 1157266e564dSmrg ;; # replaced later. I would guess that would be a bug. 1158266e564dSmrg 1159266e564dSmrg -Wc,*) 1160698f425bSmrg func_stripname '-Wc,' '' "$arg" 1161698f425bSmrg args=$func_stripname_result 1162266e564dSmrg lastarg= 1163266e564dSmrg save_ifs="$IFS"; IFS=',' 1164698f425bSmrg for arg in $args; do 1165266e564dSmrg IFS="$save_ifs" 1166698f425bSmrg func_quote_for_eval "$arg" 1167698f425bSmrg lastarg="$lastarg $func_quote_for_eval_result" 1168266e564dSmrg done 1169266e564dSmrg IFS="$save_ifs" 1170698f425bSmrg func_stripname ' ' '' "$lastarg" 1171698f425bSmrg lastarg=$func_stripname_result 1172266e564dSmrg 1173266e564dSmrg # Add the arguments to base_compile. 1174266e564dSmrg base_compile="$base_compile $lastarg" 1175266e564dSmrg continue 1176266e564dSmrg ;; 1177266e564dSmrg 1178698f425bSmrg *) 1179266e564dSmrg # Accept the current argument as the source file. 1180266e564dSmrg # The previous "srcfile" becomes the current argument. 1181266e564dSmrg # 1182266e564dSmrg lastarg="$srcfile" 1183266e564dSmrg srcfile="$arg" 1184266e564dSmrg ;; 1185266e564dSmrg esac # case $arg 1186266e564dSmrg ;; 1187266e564dSmrg esac # case $arg_mode 1188266e564dSmrg 1189266e564dSmrg # Aesthetically quote the previous argument. 1190698f425bSmrg func_quote_for_eval "$lastarg" 1191698f425bSmrg base_compile="$base_compile $func_quote_for_eval_result" 1192266e564dSmrg done # for arg 1193266e564dSmrg 1194266e564dSmrg case $arg_mode in 1195266e564dSmrg arg) 1196698f425bSmrg func_fatal_error "you must specify an argument for -Xcompile" 1197266e564dSmrg ;; 1198266e564dSmrg target) 1199698f425bSmrg func_fatal_error "you must specify a target with \`-o'" 1200266e564dSmrg ;; 1201266e564dSmrg *) 1202266e564dSmrg # Get the name of the library object. 1203698f425bSmrg test -z "$libobj" && { 1204698f425bSmrg func_basename "$srcfile" 1205698f425bSmrg libobj="$func_basename_result" 1206698f425bSmrg } 1207266e564dSmrg ;; 1208266e564dSmrg esac 1209266e564dSmrg 1210266e564dSmrg # Recognize several different file suffixes. 1211266e564dSmrg # If the user specifies -o file.o, it is replaced with file.lo 1212266e564dSmrg case $libobj in 1213698f425bSmrg *.[cCFSifmso] | \ 1214698f425bSmrg *.ada | *.adb | *.ads | *.asm | \ 1215698f425bSmrg *.c++ | *.cc | *.ii | *.class | *.cpp | *.cxx | \ 1216698f425bSmrg *.[fF][09]? | *.for | *.java | *.obj | *.sx) 1217698f425bSmrg func_xform "$libobj" 1218698f425bSmrg libobj=$func_xform_result 1219698f425bSmrg ;; 1220266e564dSmrg esac 1221266e564dSmrg 1222266e564dSmrg case $libobj in 1223698f425bSmrg *.lo) func_lo2o "$libobj"; obj=$func_lo2o_result ;; 1224266e564dSmrg *) 1225698f425bSmrg func_fatal_error "cannot determine name of library object from \`$libobj'" 1226266e564dSmrg ;; 1227266e564dSmrg esac 1228266e564dSmrg 1229266e564dSmrg func_infer_tag $base_compile 1230266e564dSmrg 1231266e564dSmrg for arg in $later; do 1232266e564dSmrg case $arg in 1233698f425bSmrg -shared) 1234698f425bSmrg test "$build_libtool_libs" != yes && \ 1235698f425bSmrg func_fatal_configuration "can not build a shared library" 1236698f425bSmrg build_old_libs=no 1237698f425bSmrg continue 1238698f425bSmrg ;; 1239698f425bSmrg 1240266e564dSmrg -static) 1241698f425bSmrg build_libtool_libs=no 1242266e564dSmrg build_old_libs=yes 1243266e564dSmrg continue 1244266e564dSmrg ;; 1245266e564dSmrg 1246266e564dSmrg -prefer-pic) 1247266e564dSmrg pic_mode=yes 1248266e564dSmrg continue 1249266e564dSmrg ;; 1250266e564dSmrg 1251266e564dSmrg -prefer-non-pic) 1252266e564dSmrg pic_mode=no 1253266e564dSmrg continue 1254266e564dSmrg ;; 1255266e564dSmrg esac 1256266e564dSmrg done 1257266e564dSmrg 1258698f425bSmrg func_quote_for_eval "$libobj" 1259698f425bSmrg test "X$libobj" != "X$func_quote_for_eval_result" \ 1260698f425bSmrg && $ECHO "X$libobj" | $GREP '[]~#^*{};<>?"'"'"' &()|`$[]' \ 1261698f425bSmrg && func_warning "libobj name \`$libobj' may not contain shell special characters." 1262698f425bSmrg func_dirname_and_basename "$obj" "/" "" 1263698f425bSmrg objname="$func_basename_result" 1264698f425bSmrg xdir="$func_dirname_result" 1265266e564dSmrg lobj=${xdir}$objdir/$objname 1266266e564dSmrg 1267698f425bSmrg test -z "$base_compile" && \ 1268698f425bSmrg func_fatal_help "you must specify a compilation command" 1269266e564dSmrg 1270266e564dSmrg # Delete any leftover library objects. 1271266e564dSmrg if test "$build_old_libs" = yes; then 1272266e564dSmrg removelist="$obj $lobj $libobj ${libobj}T" 1273266e564dSmrg else 1274266e564dSmrg removelist="$lobj $libobj ${libobj}T" 1275266e564dSmrg fi 1276266e564dSmrg 1277266e564dSmrg # On Cygwin there's no "real" PIC flag so we must build both object types 1278266e564dSmrg case $host_os in 1279698f425bSmrg cygwin* | mingw* | pw32* | os2* | cegcc*) 1280266e564dSmrg pic_mode=default 1281266e564dSmrg ;; 1282266e564dSmrg esac 1283266e564dSmrg if test "$pic_mode" = no && test "$deplibs_check_method" != pass_all; then 1284266e564dSmrg # non-PIC code in shared libraries is not supported 1285266e564dSmrg pic_mode=default 1286266e564dSmrg fi 1287266e564dSmrg 1288266e564dSmrg # Calculate the filename of the output object if compiler does 1289266e564dSmrg # not support -o with -c 1290266e564dSmrg if test "$compiler_c_o" = no; then 1291698f425bSmrg output_obj=`$ECHO "X$srcfile" | $Xsed -e 's%^.*/%%' -e 's%\.[^.]*$%%'`.${objext} 1292266e564dSmrg lockfile="$output_obj.lock" 1293266e564dSmrg else 1294266e564dSmrg output_obj= 1295266e564dSmrg need_locks=no 1296266e564dSmrg lockfile= 1297266e564dSmrg fi 1298266e564dSmrg 1299266e564dSmrg # Lock this critical section if it is needed 1300266e564dSmrg # We use this script file to make the link, it avoids creating a new file 1301266e564dSmrg if test "$need_locks" = yes; then 1302698f425bSmrg until $opt_dry_run || ln "$progpath" "$lockfile" 2>/dev/null; do 1303698f425bSmrg func_echo "Waiting for $lockfile to be removed" 1304266e564dSmrg sleep 2 1305266e564dSmrg done 1306266e564dSmrg elif test "$need_locks" = warn; then 1307266e564dSmrg if test -f "$lockfile"; then 1308698f425bSmrg $ECHO "\ 1309266e564dSmrg*** ERROR, $lockfile exists and contains: 1310266e564dSmrg`cat $lockfile 2>/dev/null` 1311266e564dSmrg 1312266e564dSmrgThis indicates that another process is trying to use the same 1313266e564dSmrgtemporary object file, and libtool could not work around it because 1314266e564dSmrgyour compiler does not support \`-c' and \`-o' together. If you 1315266e564dSmrgrepeat this compilation, it may succeed, by chance, but you had better 1316266e564dSmrgavoid parallel builds (make -j) in this platform, or get a better 1317266e564dSmrgcompiler." 1318266e564dSmrg 1319698f425bSmrg $opt_dry_run || $RM $removelist 1320266e564dSmrg exit $EXIT_FAILURE 1321266e564dSmrg fi 1322698f425bSmrg removelist="$removelist $output_obj" 1323698f425bSmrg $ECHO "$srcfile" > "$lockfile" 1324266e564dSmrg fi 1325266e564dSmrg 1326698f425bSmrg $opt_dry_run || $RM $removelist 1327698f425bSmrg removelist="$removelist $lockfile" 1328698f425bSmrg trap '$opt_dry_run || $RM $removelist; exit $EXIT_FAILURE' 1 2 15 1329698f425bSmrg 1330266e564dSmrg if test -n "$fix_srcfile_path"; then 1331266e564dSmrg eval srcfile=\"$fix_srcfile_path\" 1332266e564dSmrg fi 1333698f425bSmrg func_quote_for_eval "$srcfile" 1334698f425bSmrg qsrcfile=$func_quote_for_eval_result 1335266e564dSmrg 1336266e564dSmrg # Only build a PIC object if we are building libtool libraries. 1337266e564dSmrg if test "$build_libtool_libs" = yes; then 1338266e564dSmrg # Without this assignment, base_compile gets emptied. 1339266e564dSmrg fbsd_hideous_sh_bug=$base_compile 1340266e564dSmrg 1341266e564dSmrg if test "$pic_mode" != no; then 1342266e564dSmrg command="$base_compile $qsrcfile $pic_flag" 1343266e564dSmrg else 1344266e564dSmrg # Don't build PIC code 1345266e564dSmrg command="$base_compile $qsrcfile" 1346266e564dSmrg fi 1347266e564dSmrg 1348698f425bSmrg func_mkdir_p "$xdir$objdir" 1349266e564dSmrg 1350266e564dSmrg if test -z "$output_obj"; then 1351266e564dSmrg # Place PIC objects in $objdir 1352266e564dSmrg command="$command -o $lobj" 1353266e564dSmrg fi 1354266e564dSmrg 1355698f425bSmrg func_show_eval_locale "$command" \ 1356698f425bSmrg 'test -n "$output_obj" && $RM $removelist; exit $EXIT_FAILURE' 1357266e564dSmrg 1358266e564dSmrg if test "$need_locks" = warn && 1359266e564dSmrg test "X`cat $lockfile 2>/dev/null`" != "X$srcfile"; then 1360698f425bSmrg $ECHO "\ 1361266e564dSmrg*** ERROR, $lockfile contains: 1362266e564dSmrg`cat $lockfile 2>/dev/null` 1363266e564dSmrg 1364266e564dSmrgbut it should contain: 1365266e564dSmrg$srcfile 1366266e564dSmrg 1367266e564dSmrgThis indicates that another process is trying to use the same 1368266e564dSmrgtemporary object file, and libtool could not work around it because 1369266e564dSmrgyour compiler does not support \`-c' and \`-o' together. If you 1370266e564dSmrgrepeat this compilation, it may succeed, by chance, but you had better 1371266e564dSmrgavoid parallel builds (make -j) in this platform, or get a better 1372266e564dSmrgcompiler." 1373266e564dSmrg 1374698f425bSmrg $opt_dry_run || $RM $removelist 1375266e564dSmrg exit $EXIT_FAILURE 1376266e564dSmrg fi 1377266e564dSmrg 1378266e564dSmrg # Just move the object if needed, then go on to compile the next one 1379266e564dSmrg if test -n "$output_obj" && test "X$output_obj" != "X$lobj"; then 1380698f425bSmrg func_show_eval '$MV "$output_obj" "$lobj"' \ 1381698f425bSmrg 'error=$?; $opt_dry_run || $RM $removelist; exit $error' 1382266e564dSmrg fi 1383266e564dSmrg 1384266e564dSmrg # Allow error messages only from the first compilation. 1385266e564dSmrg if test "$suppress_opt" = yes; then 1386698f425bSmrg suppress_output=' >/dev/null 2>&1' 1387266e564dSmrg fi 1388266e564dSmrg fi 1389266e564dSmrg 1390266e564dSmrg # Only build a position-dependent object if we build old libraries. 1391266e564dSmrg if test "$build_old_libs" = yes; then 1392266e564dSmrg if test "$pic_mode" != yes; then 1393266e564dSmrg # Don't build PIC code 1394698f425bSmrg command="$base_compile $qsrcfile$pie_flag" 1395266e564dSmrg else 1396266e564dSmrg command="$base_compile $qsrcfile $pic_flag" 1397266e564dSmrg fi 1398266e564dSmrg if test "$compiler_c_o" = yes; then 1399266e564dSmrg command="$command -o $obj" 1400266e564dSmrg fi 1401266e564dSmrg 1402266e564dSmrg # Suppress compiler output if we already did a PIC compilation. 1403266e564dSmrg command="$command$suppress_output" 1404698f425bSmrg func_show_eval_locale "$command" \ 1405698f425bSmrg '$opt_dry_run || $RM $removelist; exit $EXIT_FAILURE' 1406266e564dSmrg 1407266e564dSmrg if test "$need_locks" = warn && 1408266e564dSmrg test "X`cat $lockfile 2>/dev/null`" != "X$srcfile"; then 1409698f425bSmrg $ECHO "\ 1410266e564dSmrg*** ERROR, $lockfile contains: 1411266e564dSmrg`cat $lockfile 2>/dev/null` 1412266e564dSmrg 1413266e564dSmrgbut it should contain: 1414266e564dSmrg$srcfile 1415266e564dSmrg 1416266e564dSmrgThis indicates that another process is trying to use the same 1417266e564dSmrgtemporary object file, and libtool could not work around it because 1418266e564dSmrgyour compiler does not support \`-c' and \`-o' together. If you 1419266e564dSmrgrepeat this compilation, it may succeed, by chance, but you had better 1420266e564dSmrgavoid parallel builds (make -j) in this platform, or get a better 1421266e564dSmrgcompiler." 1422266e564dSmrg 1423698f425bSmrg $opt_dry_run || $RM $removelist 1424266e564dSmrg exit $EXIT_FAILURE 1425266e564dSmrg fi 1426266e564dSmrg 1427266e564dSmrg # Just move the object if needed 1428266e564dSmrg if test -n "$output_obj" && test "X$output_obj" != "X$obj"; then 1429698f425bSmrg func_show_eval '$MV "$output_obj" "$obj"' \ 1430698f425bSmrg 'error=$?; $opt_dry_run || $RM $removelist; exit $error' 1431266e564dSmrg fi 1432266e564dSmrg fi 1433266e564dSmrg 1434698f425bSmrg $opt_dry_run || { 1435698f425bSmrg func_write_libtool_object "$libobj" "$objdir/$objname" "$objname" 1436266e564dSmrg 1437698f425bSmrg # Unlock the critical section if it was locked 1438698f425bSmrg if test "$need_locks" != no; then 1439698f425bSmrg removelist=$lockfile 1440698f425bSmrg $RM "$lockfile" 1441698f425bSmrg fi 1442698f425bSmrg } 1443266e564dSmrg 1444266e564dSmrg exit $EXIT_SUCCESS 1445698f425bSmrg} 1446266e564dSmrg 1447698f425bSmrg$opt_help || { 1448698f425bSmrgtest "$mode" = compile && func_mode_compile ${1+"$@"} 1449698f425bSmrg} 1450266e564dSmrg 1451698f425bSmrgfunc_mode_help () 1452698f425bSmrg{ 1453698f425bSmrg # We need to display help for each of the modes. 1454698f425bSmrg case $mode in 1455698f425bSmrg "") 1456698f425bSmrg # Generic help is extracted from the usage comments 1457698f425bSmrg # at the start of this file. 1458698f425bSmrg func_help 1459698f425bSmrg ;; 1460266e564dSmrg 1461698f425bSmrg clean) 1462698f425bSmrg $ECHO \ 1463698f425bSmrg"Usage: $progname [OPTION]... --mode=clean RM [RM-OPTION]... FILE... 1464266e564dSmrg 1465698f425bSmrgRemove files from the build directory. 1466266e564dSmrg 1467698f425bSmrgRM is the name of the program to use to delete files associated with each FILE 1468698f425bSmrg(typically \`/bin/rm'). RM-OPTIONS are options (such as \`-f') to be passed 1469698f425bSmrgto RM. 1470266e564dSmrg 1471698f425bSmrgIf FILE is a libtool library, object or program, all the files associated 1472698f425bSmrgwith it are deleted. Otherwise, only FILE itself is deleted using RM." 1473698f425bSmrg ;; 1474266e564dSmrg 1475698f425bSmrg compile) 1476698f425bSmrg $ECHO \ 1477698f425bSmrg"Usage: $progname [OPTION]... --mode=compile COMPILE-COMMAND... SOURCEFILE 1478266e564dSmrg 1479698f425bSmrgCompile a source file into a libtool library object. 1480266e564dSmrg 1481698f425bSmrgThis mode accepts the following additional options: 1482266e564dSmrg 1483698f425bSmrg -o OUTPUT-FILE set the output file name to OUTPUT-FILE 1484698f425bSmrg -no-suppress do not suppress compiler output for multiple passes 1485698f425bSmrg -prefer-pic try to building PIC objects only 1486698f425bSmrg -prefer-non-pic try to building non-PIC objects only 1487698f425bSmrg -shared do not build a \`.o' file suitable for static linking 1488698f425bSmrg -static only build a \`.o' file suitable for static linking 1489266e564dSmrg 1490698f425bSmrgCOMPILE-COMMAND is a command to be used in creating a \`standard' object file 1491698f425bSmrgfrom the given SOURCEFILE. 1492266e564dSmrg 1493698f425bSmrgThe output file name is determined by removing the directory component from 1494698f425bSmrgSOURCEFILE, then substituting the C source code suffix \`.c' with the 1495698f425bSmrglibrary object suffix, \`.lo'." 1496698f425bSmrg ;; 1497266e564dSmrg 1498698f425bSmrg execute) 1499698f425bSmrg $ECHO \ 1500698f425bSmrg"Usage: $progname [OPTION]... --mode=execute COMMAND [ARGS]... 1501266e564dSmrg 1502698f425bSmrgAutomatically set library path, then run a program. 1503266e564dSmrg 1504698f425bSmrgThis mode accepts the following additional options: 1505266e564dSmrg 1506698f425bSmrg -dlopen FILE add the directory containing FILE to the library path 1507266e564dSmrg 1508698f425bSmrgThis mode sets the library path environment variable according to \`-dlopen' 1509698f425bSmrgflags. 1510266e564dSmrg 1511698f425bSmrgIf any of the ARGS are libtool executable wrappers, then they are translated 1512698f425bSmrginto their corresponding uninstalled binary, and any of their required library 1513698f425bSmrgdirectories are added to the library path. 1514266e564dSmrg 1515698f425bSmrgThen, COMMAND is executed, with ARGS as arguments." 1516698f425bSmrg ;; 1517266e564dSmrg 1518698f425bSmrg finish) 1519698f425bSmrg $ECHO \ 1520698f425bSmrg"Usage: $progname [OPTION]... --mode=finish [LIBDIR]... 1521266e564dSmrg 1522698f425bSmrgComplete the installation of libtool libraries. 1523266e564dSmrg 1524698f425bSmrgEach LIBDIR is a directory that contains libtool libraries. 1525266e564dSmrg 1526698f425bSmrgThe commands that this mode executes may require superuser privileges. Use 1527698f425bSmrgthe \`--dry-run' option if you just want to see what would be executed." 1528698f425bSmrg ;; 1529266e564dSmrg 1530698f425bSmrg install) 1531698f425bSmrg $ECHO \ 1532698f425bSmrg"Usage: $progname [OPTION]... --mode=install INSTALL-COMMAND... 1533266e564dSmrg 1534698f425bSmrgInstall executables or libraries. 1535266e564dSmrg 1536698f425bSmrgINSTALL-COMMAND is the installation command. The first component should be 1537698f425bSmrgeither the \`install' or \`cp' program. 1538266e564dSmrg 1539698f425bSmrgThe following components of INSTALL-COMMAND are treated specially: 1540266e564dSmrg 1541698f425bSmrg -inst-prefix PREFIX-DIR Use PREFIX-DIR as a staging area for installation 1542266e564dSmrg 1543698f425bSmrgThe rest of the components are interpreted as arguments to that command (only 1544698f425bSmrgBSD-compatible install options are recognized)." 1545698f425bSmrg ;; 1546266e564dSmrg 1547698f425bSmrg link) 1548698f425bSmrg $ECHO \ 1549698f425bSmrg"Usage: $progname [OPTION]... --mode=link LINK-COMMAND... 1550266e564dSmrg 1551698f425bSmrgLink object files or libraries together to form another library, or to 1552698f425bSmrgcreate an executable program. 1553266e564dSmrg 1554698f425bSmrgLINK-COMMAND is a command using the C compiler that you would use to create 1555698f425bSmrga program from several object files. 1556266e564dSmrg 1557698f425bSmrgThe following components of LINK-COMMAND are treated specially: 1558266e564dSmrg 1559698f425bSmrg -all-static do not do any dynamic linking at all 1560698f425bSmrg -avoid-version do not add a version suffix if possible 1561698f425bSmrg -dlopen FILE \`-dlpreopen' FILE if it cannot be dlopened at runtime 1562698f425bSmrg -dlpreopen FILE link in FILE and add its symbols to lt_preloaded_symbols 1563698f425bSmrg -export-dynamic allow symbols from OUTPUT-FILE to be resolved with dlsym(3) 1564698f425bSmrg -export-symbols SYMFILE 1565698f425bSmrg try to export only the symbols listed in SYMFILE 1566698f425bSmrg -export-symbols-regex REGEX 1567698f425bSmrg try to export only the symbols matching REGEX 1568698f425bSmrg -LLIBDIR search LIBDIR for required installed libraries 1569698f425bSmrg -lNAME OUTPUT-FILE requires the installed library libNAME 1570698f425bSmrg -module build a library that can dlopened 1571698f425bSmrg -no-fast-install disable the fast-install mode 1572698f425bSmrg -no-install link a not-installable executable 1573698f425bSmrg -no-undefined declare that a library does not refer to external symbols 1574698f425bSmrg -o OUTPUT-FILE create OUTPUT-FILE from the specified objects 1575698f425bSmrg -objectlist FILE Use a list of object files found in FILE to specify objects 1576698f425bSmrg -precious-files-regex REGEX 1577698f425bSmrg don't remove output files matching REGEX 1578698f425bSmrg -release RELEASE specify package release information 1579698f425bSmrg -rpath LIBDIR the created library will eventually be installed in LIBDIR 1580698f425bSmrg -R[ ]LIBDIR add LIBDIR to the runtime path of programs and libraries 1581698f425bSmrg -shared only do dynamic linking of libtool libraries 1582698f425bSmrg -shrext SUFFIX override the standard shared library file extension 1583698f425bSmrg -static do not do any dynamic linking of uninstalled libtool libraries 1584698f425bSmrg -static-libtool-libs 1585698f425bSmrg do not do any dynamic linking of libtool libraries 1586698f425bSmrg -version-info CURRENT[:REVISION[:AGE]] 1587698f425bSmrg specify library version info [each variable defaults to 0] 1588698f425bSmrg -weak LIBNAME declare that the target provides the LIBNAME interface 1589266e564dSmrg 1590698f425bSmrgAll other options (arguments beginning with \`-') are ignored. 1591266e564dSmrg 1592698f425bSmrgEvery other argument is treated as a filename. Files ending in \`.la' are 1593698f425bSmrgtreated as uninstalled libtool libraries, other files are standard or library 1594698f425bSmrgobject files. 1595c5629e66Smrg 1596698f425bSmrgIf the OUTPUT-FILE ends in \`.la', then a libtool library is created, 1597698f425bSmrgonly library objects (\`.lo' files) may be specified, and \`-rpath' is 1598698f425bSmrgrequired, except when creating a convenience library. 1599266e564dSmrg 1600698f425bSmrgIf OUTPUT-FILE ends in \`.a' or \`.lib', then a standard library is created 1601698f425bSmrgusing \`ar' and \`ranlib', or on Windows using \`lib'. 1602266e564dSmrg 1603698f425bSmrgIf OUTPUT-FILE ends in \`.lo' or \`.${objext}', then a reloadable object file 1604698f425bSmrgis created, otherwise an executable program is created." 1605266e564dSmrg ;; 1606266e564dSmrg 1607698f425bSmrg uninstall) 1608698f425bSmrg $ECHO \ 1609698f425bSmrg"Usage: $progname [OPTION]... --mode=uninstall RM [RM-OPTION]... FILE... 1610266e564dSmrg 1611698f425bSmrgRemove libraries from an installation directory. 1612266e564dSmrg 1613698f425bSmrgRM is the name of the program to use to delete files associated with each FILE 1614698f425bSmrg(typically \`/bin/rm'). RM-OPTIONS are options (such as \`-f') to be passed 1615698f425bSmrgto RM. 1616266e564dSmrg 1617698f425bSmrgIf FILE is a libtool library, all the files associated with it are deleted. 1618698f425bSmrgOtherwise, only FILE itself is deleted using RM." 1619698f425bSmrg ;; 1620266e564dSmrg 1621698f425bSmrg *) 1622698f425bSmrg func_fatal_help "invalid operation mode \`$mode'" 1623698f425bSmrg ;; 1624698f425bSmrg esac 1625266e564dSmrg 1626698f425bSmrg $ECHO 1627698f425bSmrg $ECHO "Try \`$progname --help' for more information about other modes." 1628266e564dSmrg 1629698f425bSmrg exit $? 1630698f425bSmrg} 1631266e564dSmrg 1632698f425bSmrg # Now that we've collected a possible --mode arg, show help if necessary 1633698f425bSmrg $opt_help && func_mode_help 1634266e564dSmrg 1635266e564dSmrg 1636698f425bSmrg# func_mode_execute arg... 1637698f425bSmrgfunc_mode_execute () 1638698f425bSmrg{ 1639698f425bSmrg $opt_debug 1640698f425bSmrg # The first argument is the command name. 1641698f425bSmrg cmd="$nonopt" 1642698f425bSmrg test -z "$cmd" && \ 1643698f425bSmrg func_fatal_help "you must specify a COMMAND" 1644266e564dSmrg 1645698f425bSmrg # Handle -dlopen flags immediately. 1646698f425bSmrg for file in $execute_dlfiles; do 1647698f425bSmrg test -f "$file" \ 1648698f425bSmrg || func_fatal_help "\`$file' is not a file" 1649266e564dSmrg 1650698f425bSmrg dir= 1651698f425bSmrg case $file in 1652698f425bSmrg *.la) 1653698f425bSmrg # Check to see that this really is a libtool archive. 1654698f425bSmrg func_lalib_unsafe_p "$file" \ 1655698f425bSmrg || func_fatal_help "\`$lib' is not a valid libtool archive" 1656266e564dSmrg 1657698f425bSmrg # Read the libtool library. 1658698f425bSmrg dlname= 1659698f425bSmrg library_names= 1660698f425bSmrg func_source "$file" 1661266e564dSmrg 1662698f425bSmrg # Skip this library if it cannot be dlopened. 1663698f425bSmrg if test -z "$dlname"; then 1664698f425bSmrg # Warn if it was a shared library. 1665698f425bSmrg test -n "$library_names" && \ 1666698f425bSmrg func_warning "\`$file' was not linked with \`-export-dynamic'" 1667698f425bSmrg continue 1668698f425bSmrg fi 1669266e564dSmrg 1670698f425bSmrg func_dirname "$file" "" "." 1671698f425bSmrg dir="$func_dirname_result" 1672266e564dSmrg 1673698f425bSmrg if test -f "$dir/$objdir/$dlname"; then 1674698f425bSmrg dir="$dir/$objdir" 1675698f425bSmrg else 1676698f425bSmrg if test ! -f "$dir/$dlname"; then 1677698f425bSmrg func_fatal_error "cannot find \`$dlname' in \`$dir' or \`$dir/$objdir'" 1678698f425bSmrg fi 1679698f425bSmrg fi 1680266e564dSmrg ;; 1681266e564dSmrg 1682698f425bSmrg *.lo) 1683698f425bSmrg # Just add the directory containing the .lo file. 1684698f425bSmrg func_dirname "$file" "" "." 1685698f425bSmrg dir="$func_dirname_result" 1686266e564dSmrg ;; 1687266e564dSmrg 1688698f425bSmrg *) 1689698f425bSmrg func_warning "\`-dlopen' is ignored for non-libtool libraries and objects" 1690266e564dSmrg continue 1691266e564dSmrg ;; 1692698f425bSmrg esac 1693266e564dSmrg 1694698f425bSmrg # Get the absolute pathname. 1695698f425bSmrg absdir=`cd "$dir" && pwd` 1696698f425bSmrg test -n "$absdir" && dir="$absdir" 1697266e564dSmrg 1698698f425bSmrg # Now add the directory to shlibpath_var. 1699698f425bSmrg if eval "test -z \"\$$shlibpath_var\""; then 1700698f425bSmrg eval "$shlibpath_var=\"\$dir\"" 1701698f425bSmrg else 1702698f425bSmrg eval "$shlibpath_var=\"\$dir:\$$shlibpath_var\"" 1703698f425bSmrg fi 1704698f425bSmrg done 1705266e564dSmrg 1706698f425bSmrg # This variable tells wrapper scripts just to set shlibpath_var 1707698f425bSmrg # rather than running their programs. 1708698f425bSmrg libtool_execute_magic="$magic" 1709266e564dSmrg 1710698f425bSmrg # Check if any of the arguments is a wrapper script. 1711698f425bSmrg args= 1712698f425bSmrg for file 1713698f425bSmrg do 1714698f425bSmrg case $file in 1715698f425bSmrg -*) ;; 1716698f425bSmrg *) 1717698f425bSmrg # Do a test to see if this is really a libtool program. 1718698f425bSmrg if func_ltwrapper_script_p "$file"; then 1719698f425bSmrg func_source "$file" 1720698f425bSmrg # Transform arg to wrapped name. 1721698f425bSmrg file="$progdir/$program" 1722698f425bSmrg elif func_ltwrapper_executable_p "$file"; then 1723698f425bSmrg func_ltwrapper_scriptname "$file" 1724698f425bSmrg func_source "$func_ltwrapper_scriptname_result" 1725698f425bSmrg # Transform arg to wrapped name. 1726698f425bSmrg file="$progdir/$program" 1727698f425bSmrg fi 1728698f425bSmrg ;; 1729698f425bSmrg esac 1730698f425bSmrg # Quote arguments (to preserve shell metacharacters). 1731698f425bSmrg func_quote_for_eval "$file" 1732698f425bSmrg args="$args $func_quote_for_eval_result" 1733698f425bSmrg done 1734266e564dSmrg 1735698f425bSmrg if test "X$opt_dry_run" = Xfalse; then 1736698f425bSmrg if test -n "$shlibpath_var"; then 1737698f425bSmrg # Export the shlibpath_var. 1738698f425bSmrg eval "export $shlibpath_var" 1739698f425bSmrg fi 1740266e564dSmrg 1741698f425bSmrg # Restore saved environment variables 1742698f425bSmrg for lt_var in LANG LANGUAGE LC_ALL LC_CTYPE LC_COLLATE LC_MESSAGES 1743698f425bSmrg do 1744698f425bSmrg eval "if test \"\${save_$lt_var+set}\" = set; then 1745698f425bSmrg $lt_var=\$save_$lt_var; export $lt_var 1746266e564dSmrg else 1747698f425bSmrg $lt_unset $lt_var 1748698f425bSmrg fi" 1749698f425bSmrg done 1750266e564dSmrg 1751698f425bSmrg # Now prepare to actually exec the command. 1752698f425bSmrg exec_cmd="\$cmd$args" 1753698f425bSmrg else 1754698f425bSmrg # Display what would be done. 1755698f425bSmrg if test -n "$shlibpath_var"; then 1756698f425bSmrg eval "\$ECHO \"\$shlibpath_var=\$$shlibpath_var\"" 1757698f425bSmrg $ECHO "export $shlibpath_var" 1758698f425bSmrg fi 1759698f425bSmrg $ECHO "$cmd$args" 1760698f425bSmrg exit $EXIT_SUCCESS 1761698f425bSmrg fi 1762698f425bSmrg} 1763266e564dSmrg 1764698f425bSmrgtest "$mode" = execute && func_mode_execute ${1+"$@"} 1765266e564dSmrg 1766266e564dSmrg 1767698f425bSmrg# func_mode_finish arg... 1768698f425bSmrgfunc_mode_finish () 1769698f425bSmrg{ 1770698f425bSmrg $opt_debug 1771698f425bSmrg libdirs="$nonopt" 1772698f425bSmrg admincmds= 1773266e564dSmrg 1774698f425bSmrg if test -n "$finish_cmds$finish_eval" && test -n "$libdirs"; then 1775698f425bSmrg for dir 1776698f425bSmrg do 1777698f425bSmrg libdirs="$libdirs $dir" 1778698f425bSmrg done 1779266e564dSmrg 1780698f425bSmrg for libdir in $libdirs; do 1781698f425bSmrg if test -n "$finish_cmds"; then 1782698f425bSmrg # Do each command in the finish commands. 1783698f425bSmrg func_execute_cmds "$finish_cmds" 'admincmds="$admincmds 1784698f425bSmrg'"$cmd"'"' 1785266e564dSmrg fi 1786698f425bSmrg if test -n "$finish_eval"; then 1787698f425bSmrg # Do the single finish_eval. 1788698f425bSmrg eval cmds=\"$finish_eval\" 1789698f425bSmrg $opt_dry_run || eval "$cmds" || admincmds="$admincmds 1790698f425bSmrg $cmds" 1791698f425bSmrg fi 1792698f425bSmrg done 1793698f425bSmrg fi 1794266e564dSmrg 1795698f425bSmrg # Exit here if they wanted silent mode. 1796698f425bSmrg $opt_silent && exit $EXIT_SUCCESS 1797266e564dSmrg 1798698f425bSmrg $ECHO "X----------------------------------------------------------------------" | $Xsed 1799698f425bSmrg $ECHO "Libraries have been installed in:" 1800698f425bSmrg for libdir in $libdirs; do 1801698f425bSmrg $ECHO " $libdir" 1802698f425bSmrg done 1803698f425bSmrg $ECHO 1804698f425bSmrg $ECHO "If you ever happen to want to link against installed libraries" 1805698f425bSmrg $ECHO "in a given directory, LIBDIR, you must either use libtool, and" 1806698f425bSmrg $ECHO "specify the full pathname of the library, or use the \`-LLIBDIR'" 1807698f425bSmrg $ECHO "flag during linking and do at least one of the following:" 1808698f425bSmrg if test -n "$shlibpath_var"; then 1809698f425bSmrg $ECHO " - add LIBDIR to the \`$shlibpath_var' environment variable" 1810698f425bSmrg $ECHO " during execution" 1811698f425bSmrg fi 1812698f425bSmrg if test -n "$runpath_var"; then 1813698f425bSmrg $ECHO " - add LIBDIR to the \`$runpath_var' environment variable" 1814698f425bSmrg $ECHO " during linking" 1815698f425bSmrg fi 1816698f425bSmrg if test -n "$hardcode_libdir_flag_spec"; then 1817698f425bSmrg libdir=LIBDIR 1818698f425bSmrg eval flag=\"$hardcode_libdir_flag_spec\" 1819266e564dSmrg 1820698f425bSmrg $ECHO " - use the \`$flag' linker flag" 1821698f425bSmrg fi 1822698f425bSmrg if test -n "$admincmds"; then 1823698f425bSmrg $ECHO " - have your system administrator run these commands:$admincmds" 1824698f425bSmrg fi 1825698f425bSmrg if test -f /etc/ld.so.conf; then 1826698f425bSmrg $ECHO " - have your system administrator add LIBDIR to \`/etc/ld.so.conf'" 1827698f425bSmrg fi 1828698f425bSmrg $ECHO 1829698f425bSmrg 1830698f425bSmrg $ECHO "See any operating system documentation about shared libraries for" 1831698f425bSmrg case $host in 1832698f425bSmrg solaris2.[6789]|solaris2.1[0-9]) 1833698f425bSmrg $ECHO "more information, such as the ld(1), crle(1) and ld.so(8) manual" 1834698f425bSmrg $ECHO "pages." 1835266e564dSmrg ;; 1836698f425bSmrg *) 1837698f425bSmrg $ECHO "more information, such as the ld(1) and ld.so(8) manual pages." 1838698f425bSmrg ;; 1839698f425bSmrg esac 1840698f425bSmrg $ECHO "X----------------------------------------------------------------------" | $Xsed 1841698f425bSmrg exit $EXIT_SUCCESS 1842698f425bSmrg} 1843266e564dSmrg 1844698f425bSmrgtest "$mode" = finish && func_mode_finish ${1+"$@"} 1845266e564dSmrg 1846c5629e66Smrg 1847698f425bSmrg# func_mode_install arg... 1848698f425bSmrgfunc_mode_install () 1849698f425bSmrg{ 1850698f425bSmrg $opt_debug 1851698f425bSmrg # There may be an optional sh(1) argument at the beginning of 1852698f425bSmrg # install_prog (especially on Windows NT). 1853698f425bSmrg if test "$nonopt" = "$SHELL" || test "$nonopt" = /bin/sh || 1854698f425bSmrg # Allow the use of GNU shtool's install command. 1855698f425bSmrg $ECHO "X$nonopt" | $GREP shtool >/dev/null; then 1856698f425bSmrg # Aesthetically quote it. 1857698f425bSmrg func_quote_for_eval "$nonopt" 1858698f425bSmrg install_prog="$func_quote_for_eval_result " 1859698f425bSmrg arg=$1 1860698f425bSmrg shift 1861698f425bSmrg else 1862698f425bSmrg install_prog= 1863698f425bSmrg arg=$nonopt 1864266e564dSmrg fi 1865266e564dSmrg 1866698f425bSmrg # The real first argument should be the name of the installation program. 1867698f425bSmrg # Aesthetically quote it. 1868698f425bSmrg func_quote_for_eval "$arg" 1869698f425bSmrg install_prog="$install_prog$func_quote_for_eval_result" 1870266e564dSmrg 1871698f425bSmrg # We need to accept at least all the BSD install flags. 1872698f425bSmrg dest= 1873698f425bSmrg files= 1874698f425bSmrg opts= 1875698f425bSmrg prev= 1876698f425bSmrg install_type= 1877698f425bSmrg isdir=no 1878698f425bSmrg stripme= 1879698f425bSmrg for arg 1880698f425bSmrg do 1881698f425bSmrg if test -n "$dest"; then 1882698f425bSmrg files="$files $dest" 1883698f425bSmrg dest=$arg 1884698f425bSmrg continue 1885698f425bSmrg fi 1886266e564dSmrg 1887698f425bSmrg case $arg in 1888698f425bSmrg -d) isdir=yes ;; 1889698f425bSmrg -f) 1890698f425bSmrg case " $install_prog " in 1891698f425bSmrg *[\\\ /]cp\ *) ;; 1892698f425bSmrg *) prev=$arg ;; 1893698f425bSmrg esac 1894698f425bSmrg ;; 1895698f425bSmrg -g | -m | -o) 1896698f425bSmrg prev=$arg 1897698f425bSmrg ;; 1898698f425bSmrg -s) 1899698f425bSmrg stripme=" -s" 1900698f425bSmrg continue 1901698f425bSmrg ;; 1902698f425bSmrg -*) 1903698f425bSmrg ;; 1904698f425bSmrg *) 1905698f425bSmrg # If the previous option needed an argument, then skip it. 1906698f425bSmrg if test -n "$prev"; then 1907698f425bSmrg prev= 1908698f425bSmrg else 1909698f425bSmrg dest=$arg 1910698f425bSmrg continue 1911698f425bSmrg fi 1912698f425bSmrg ;; 1913698f425bSmrg esac 1914266e564dSmrg 1915698f425bSmrg # Aesthetically quote the argument. 1916698f425bSmrg func_quote_for_eval "$arg" 1917698f425bSmrg install_prog="$install_prog $func_quote_for_eval_result" 1918698f425bSmrg done 1919698f425bSmrg 1920698f425bSmrg test -z "$install_prog" && \ 1921698f425bSmrg func_fatal_help "you must specify an install program" 1922698f425bSmrg 1923698f425bSmrg test -n "$prev" && \ 1924698f425bSmrg func_fatal_help "the \`$prev' option requires an argument" 1925698f425bSmrg 1926698f425bSmrg if test -z "$files"; then 1927698f425bSmrg if test -z "$dest"; then 1928698f425bSmrg func_fatal_help "no file or destination specified" 1929698f425bSmrg else 1930698f425bSmrg func_fatal_help "you must specify a destination" 1931266e564dSmrg fi 1932266e564dSmrg fi 1933266e564dSmrg 1934698f425bSmrg # Strip any trailing slash from the destination. 1935698f425bSmrg func_stripname '' '/' "$dest" 1936698f425bSmrg dest=$func_stripname_result 1937266e564dSmrg 1938698f425bSmrg # Check to see that the destination is a directory. 1939698f425bSmrg test -d "$dest" && isdir=yes 1940698f425bSmrg if test "$isdir" = yes; then 1941698f425bSmrg destdir="$dest" 1942698f425bSmrg destname= 1943698f425bSmrg else 1944698f425bSmrg func_dirname_and_basename "$dest" "" "." 1945698f425bSmrg destdir="$func_dirname_result" 1946698f425bSmrg destname="$func_basename_result" 1947698f425bSmrg 1948698f425bSmrg # Not a directory, so check to see that there is only one file specified. 1949698f425bSmrg set dummy $files; shift 1950698f425bSmrg test "$#" -gt 1 && \ 1951698f425bSmrg func_fatal_help "\`$dest' is not a directory" 1952698f425bSmrg fi 1953698f425bSmrg case $destdir in 1954698f425bSmrg [\\/]* | [A-Za-z]:[\\/]*) ;; 1955266e564dSmrg *) 1956698f425bSmrg for file in $files; do 1957698f425bSmrg case $file in 1958698f425bSmrg *.lo) ;; 1959698f425bSmrg *) 1960698f425bSmrg func_fatal_help "\`$destdir' must be an absolute directory name" 1961698f425bSmrg ;; 1962698f425bSmrg esac 1963698f425bSmrg done 1964266e564dSmrg ;; 1965266e564dSmrg esac 1966266e564dSmrg 1967698f425bSmrg # This variable tells wrapper scripts just to set variables rather 1968698f425bSmrg # than running their programs. 1969698f425bSmrg libtool_install_magic="$magic" 1970266e564dSmrg 1971698f425bSmrg staticlibs= 1972698f425bSmrg future_libdirs= 1973698f425bSmrg current_libdirs= 1974698f425bSmrg for file in $files; do 1975266e564dSmrg 1976698f425bSmrg # Do each installation. 1977698f425bSmrg case $file in 1978698f425bSmrg *.$libext) 1979698f425bSmrg # Do the static libraries later. 1980698f425bSmrg staticlibs="$staticlibs $file" 1981698f425bSmrg ;; 1982698f425bSmrg 1983698f425bSmrg *.la) 1984698f425bSmrg # Check to see that this really is a libtool archive. 1985698f425bSmrg func_lalib_unsafe_p "$file" \ 1986698f425bSmrg || func_fatal_help "\`$file' is not a valid libtool archive" 1987698f425bSmrg 1988698f425bSmrg library_names= 1989698f425bSmrg old_library= 1990698f425bSmrg relink_command= 1991698f425bSmrg func_source "$file" 1992698f425bSmrg 1993698f425bSmrg # Add the libdir to current_libdirs if it is the destination. 1994698f425bSmrg if test "X$destdir" = "X$libdir"; then 1995698f425bSmrg case "$current_libdirs " in 1996698f425bSmrg *" $libdir "*) ;; 1997698f425bSmrg *) current_libdirs="$current_libdirs $libdir" ;; 1998266e564dSmrg esac 1999698f425bSmrg else 2000698f425bSmrg # Note the libdir as a future libdir. 2001698f425bSmrg case "$future_libdirs " in 2002698f425bSmrg *" $libdir "*) ;; 2003698f425bSmrg *) future_libdirs="$future_libdirs $libdir" ;; 2004698f425bSmrg esac 2005698f425bSmrg fi 2006266e564dSmrg 2007698f425bSmrg func_dirname "$file" "/" "" 2008698f425bSmrg dir="$func_dirname_result" 2009698f425bSmrg dir="$dir$objdir" 2010698f425bSmrg 2011698f425bSmrg if test -n "$relink_command"; then 2012698f425bSmrg # Determine the prefix the user has applied to our future dir. 2013698f425bSmrg inst_prefix_dir=`$ECHO "X$destdir" | $Xsed -e "s%$libdir\$%%"` 2014698f425bSmrg 2015698f425bSmrg # Don't allow the user to place us outside of our expected 2016698f425bSmrg # location b/c this prevents finding dependent libraries that 2017698f425bSmrg # are installed to the same prefix. 2018698f425bSmrg # At present, this check doesn't affect windows .dll's that 2019698f425bSmrg # are installed into $libdir/../bin (currently, that works fine) 2020698f425bSmrg # but it's something to keep an eye on. 2021698f425bSmrg test "$inst_prefix_dir" = "$destdir" && \ 2022698f425bSmrg func_fatal_error "error: cannot install \`$file' to a directory not ending in $libdir" 2023698f425bSmrg 2024698f425bSmrg if test -n "$inst_prefix_dir"; then 2025698f425bSmrg # Stick the inst_prefix_dir data into the link command. 2026698f425bSmrg relink_command=`$ECHO "X$relink_command" | $Xsed -e "s%@inst_prefix_dir@%-inst-prefix-dir $inst_prefix_dir%"` 2027698f425bSmrg else 2028698f425bSmrg relink_command=`$ECHO "X$relink_command" | $Xsed -e "s%@inst_prefix_dir@%%"` 2029698f425bSmrg fi 2030698f425bSmrg 2031698f425bSmrg func_warning "relinking \`$file'" 2032698f425bSmrg func_show_eval "$relink_command" \ 2033698f425bSmrg 'func_fatal_error "error: relink \`$file'\'' with the above command before installing it"' 2034698f425bSmrg fi 2035698f425bSmrg 2036698f425bSmrg # See the names of the shared library. 2037698f425bSmrg set dummy $library_names; shift 2038698f425bSmrg if test -n "$1"; then 2039698f425bSmrg realname="$1" 2040698f425bSmrg shift 2041698f425bSmrg 2042698f425bSmrg srcname="$realname" 2043698f425bSmrg test -n "$relink_command" && srcname="$realname"T 2044698f425bSmrg 2045698f425bSmrg # Install the shared library and build the symlinks. 2046698f425bSmrg func_show_eval "$install_prog $dir/$srcname $destdir/$realname" \ 2047698f425bSmrg 'exit $?' 2048698f425bSmrg tstripme="$stripme" 2049698f425bSmrg case $host_os in 2050698f425bSmrg cygwin* | mingw* | pw32* | cegcc*) 2051698f425bSmrg case $realname in 2052698f425bSmrg *.dll.a) 2053698f425bSmrg tstripme="" 2054698f425bSmrg ;; 2055698f425bSmrg esac 2056266e564dSmrg ;; 2057266e564dSmrg esac 2058698f425bSmrg if test -n "$tstripme" && test -n "$striplib"; then 2059698f425bSmrg func_show_eval "$striplib $destdir/$realname" 'exit $?' 2060c5629e66Smrg fi 2061698f425bSmrg 2062698f425bSmrg if test "$#" -gt 0; then 2063698f425bSmrg # Delete the old symlinks, and create new ones. 2064698f425bSmrg # Try `ln -sf' first, because the `ln' binary might depend on 2065698f425bSmrg # the symlink we replace! Solaris /bin/ln does not understand -f, 2066698f425bSmrg # so we also need to try rm && ln -s. 2067698f425bSmrg for linkname 2068698f425bSmrg do 2069698f425bSmrg test "$linkname" != "$realname" \ 2070698f425bSmrg && func_show_eval "(cd $destdir && { $LN_S -f $realname $linkname || { $RM $linkname && $LN_S $realname $linkname; }; })" 2071266e564dSmrg done 2072266e564dSmrg fi 2073266e564dSmrg 2074698f425bSmrg # Do each command in the postinstall commands. 2075698f425bSmrg lib="$destdir/$realname" 2076698f425bSmrg func_execute_cmds "$postinstall_cmds" 'exit $?' 2077266e564dSmrg fi 2078266e564dSmrg 2079698f425bSmrg # Install the pseudo-library for information purposes. 2080698f425bSmrg func_basename "$file" 2081698f425bSmrg name="$func_basename_result" 2082698f425bSmrg instname="$dir/$name"i 2083698f425bSmrg func_show_eval "$install_prog $instname $destdir/$name" 'exit $?' 2084266e564dSmrg 2085698f425bSmrg # Maybe install the static library, too. 2086698f425bSmrg test -n "$old_library" && staticlibs="$staticlibs $dir/$old_library" 2087698f425bSmrg ;; 2088266e564dSmrg 2089698f425bSmrg *.lo) 2090698f425bSmrg # Install (i.e. copy) a libtool object. 2091266e564dSmrg 2092698f425bSmrg # Figure out destination file name, if it wasn't already specified. 2093698f425bSmrg if test -n "$destname"; then 2094698f425bSmrg destfile="$destdir/$destname" 2095698f425bSmrg else 2096698f425bSmrg func_basename "$file" 2097698f425bSmrg destfile="$func_basename_result" 2098698f425bSmrg destfile="$destdir/$destfile" 2099698f425bSmrg fi 2100698f425bSmrg 2101698f425bSmrg # Deduce the name of the destination old-style object file. 2102698f425bSmrg case $destfile in 2103698f425bSmrg *.lo) 2104698f425bSmrg func_lo2o "$destfile" 2105698f425bSmrg staticdest=$func_lo2o_result 2106698f425bSmrg ;; 2107698f425bSmrg *.$objext) 2108698f425bSmrg staticdest="$destfile" 2109698f425bSmrg destfile= 2110698f425bSmrg ;; 2111698f425bSmrg *) 2112698f425bSmrg func_fatal_help "cannot copy a libtool object to \`$destfile'" 2113698f425bSmrg ;; 2114266e564dSmrg esac 2115266e564dSmrg 2116698f425bSmrg # Install the libtool object if requested. 2117698f425bSmrg test -n "$destfile" && \ 2118698f425bSmrg func_show_eval "$install_prog $file $destfile" 'exit $?' 2119698f425bSmrg 2120698f425bSmrg # Install the old object if enabled. 2121698f425bSmrg if test "$build_old_libs" = yes; then 2122698f425bSmrg # Deduce the name of the old-style object file. 2123698f425bSmrg func_lo2o "$file" 2124698f425bSmrg staticobj=$func_lo2o_result 2125698f425bSmrg func_show_eval "$install_prog \$staticobj \$staticdest" 'exit $?' 2126266e564dSmrg fi 2127698f425bSmrg exit $EXIT_SUCCESS 2128698f425bSmrg ;; 2129266e564dSmrg 2130698f425bSmrg *) 2131698f425bSmrg # Figure out destination file name, if it wasn't already specified. 2132698f425bSmrg if test -n "$destname"; then 2133698f425bSmrg destfile="$destdir/$destname" 2134698f425bSmrg else 2135698f425bSmrg func_basename "$file" 2136698f425bSmrg destfile="$func_basename_result" 2137698f425bSmrg destfile="$destdir/$destfile" 2138698f425bSmrg fi 2139266e564dSmrg 2140698f425bSmrg # If the file is missing, and there is a .exe on the end, strip it 2141698f425bSmrg # because it is most likely a libtool script we actually want to 2142698f425bSmrg # install 2143698f425bSmrg stripped_ext="" 2144698f425bSmrg case $file in 2145698f425bSmrg *.exe) 2146698f425bSmrg if test ! -f "$file"; then 2147698f425bSmrg func_stripname '' '.exe' "$file" 2148698f425bSmrg file=$func_stripname_result 2149698f425bSmrg stripped_ext=".exe" 2150698f425bSmrg fi 2151698f425bSmrg ;; 2152698f425bSmrg esac 2153266e564dSmrg 2154698f425bSmrg # Do a test to see if this is really a libtool program. 2155698f425bSmrg case $host in 2156698f425bSmrg *cygwin* | *mingw*) 2157698f425bSmrg if func_ltwrapper_executable_p "$file"; then 2158698f425bSmrg func_ltwrapper_scriptname "$file" 2159698f425bSmrg wrapper=$func_ltwrapper_scriptname_result 2160698f425bSmrg else 2161698f425bSmrg func_stripname '' '.exe' "$file" 2162698f425bSmrg wrapper=$func_stripname_result 2163698f425bSmrg fi 2164698f425bSmrg ;; 2165698f425bSmrg *) 2166698f425bSmrg wrapper=$file 2167698f425bSmrg ;; 2168698f425bSmrg esac 2169698f425bSmrg if func_ltwrapper_script_p "$wrapper"; then 2170698f425bSmrg notinst_deplibs= 2171698f425bSmrg relink_command= 2172266e564dSmrg 2173698f425bSmrg func_source "$wrapper" 2174698f425bSmrg 2175698f425bSmrg # Check the variables that should have been set. 2176698f425bSmrg test -z "$generated_by_libtool_version" && \ 2177698f425bSmrg func_fatal_error "invalid libtool wrapper script \`$wrapper'" 2178698f425bSmrg 2179698f425bSmrg finalize=yes 2180698f425bSmrg for lib in $notinst_deplibs; do 2181698f425bSmrg # Check to see that each library is installed. 2182698f425bSmrg libdir= 2183698f425bSmrg if test -f "$lib"; then 2184698f425bSmrg func_source "$lib" 2185698f425bSmrg fi 2186698f425bSmrg libfile="$libdir/"`$ECHO "X$lib" | $Xsed -e 's%^.*/%%g'` ### testsuite: skip nested quoting test 2187698f425bSmrg if test -n "$libdir" && test ! -f "$libfile"; then 2188698f425bSmrg func_warning "\`$lib' has not been installed in \`$libdir'" 2189698f425bSmrg finalize=no 2190698f425bSmrg fi 2191698f425bSmrg done 2192698f425bSmrg 2193698f425bSmrg relink_command= 2194698f425bSmrg func_source "$wrapper" 2195698f425bSmrg 2196698f425bSmrg outputname= 2197698f425bSmrg if test "$fast_install" = no && test -n "$relink_command"; then 2198698f425bSmrg $opt_dry_run || { 2199698f425bSmrg if test "$finalize" = yes; then 2200698f425bSmrg tmpdir=`func_mktempdir` 2201698f425bSmrg func_basename "$file$stripped_ext" 2202698f425bSmrg file="$func_basename_result" 2203698f425bSmrg outputname="$tmpdir/$file" 2204698f425bSmrg # Replace the output file specification. 2205698f425bSmrg relink_command=`$ECHO "X$relink_command" | $Xsed -e 's%@OUTPUT@%'"$outputname"'%g'` 2206698f425bSmrg 2207698f425bSmrg $opt_silent || { 2208698f425bSmrg func_quote_for_expand "$relink_command" 2209698f425bSmrg eval "func_echo $func_quote_for_expand_result" 2210698f425bSmrg } 2211698f425bSmrg if eval "$relink_command"; then : 2212698f425bSmrg else 2213698f425bSmrg func_error "error: relink \`$file' with the above command before installing it" 2214698f425bSmrg $opt_dry_run || ${RM}r "$tmpdir" 2215698f425bSmrg continue 2216698f425bSmrg fi 2217698f425bSmrg file="$outputname" 2218698f425bSmrg else 2219698f425bSmrg func_warning "cannot relink \`$file'" 2220698f425bSmrg fi 2221698f425bSmrg } 2222266e564dSmrg else 2223698f425bSmrg # Install the binary that we compiled earlier. 2224698f425bSmrg file=`$ECHO "X$file$stripped_ext" | $Xsed -e "s%\([^/]*\)$%$objdir/\1%"` 2225266e564dSmrg fi 2226698f425bSmrg fi 2227266e564dSmrg 2228698f425bSmrg # remove .exe since cygwin /usr/bin/install will append another 2229698f425bSmrg # one anyway 2230698f425bSmrg case $install_prog,$host in 2231698f425bSmrg */usr/bin/install*,*cygwin*) 2232698f425bSmrg case $file:$destfile in 2233698f425bSmrg *.exe:*.exe) 2234698f425bSmrg # this is ok 2235698f425bSmrg ;; 2236698f425bSmrg *.exe:*) 2237698f425bSmrg destfile=$destfile.exe 2238698f425bSmrg ;; 2239698f425bSmrg *:*.exe) 2240698f425bSmrg func_stripname '' '.exe' "$destfile" 2241698f425bSmrg destfile=$func_stripname_result 2242698f425bSmrg ;; 2243698f425bSmrg esac 2244266e564dSmrg ;; 2245266e564dSmrg esac 2246698f425bSmrg func_show_eval "$install_prog\$stripme \$file \$destfile" 'exit $?' 2247698f425bSmrg $opt_dry_run || if test -n "$outputname"; then 2248698f425bSmrg ${RM}r "$tmpdir" 2249698f425bSmrg fi 2250698f425bSmrg ;; 2251698f425bSmrg esac 2252698f425bSmrg done 2253266e564dSmrg 2254698f425bSmrg for file in $staticlibs; do 2255698f425bSmrg func_basename "$file" 2256698f425bSmrg name="$func_basename_result" 2257698f425bSmrg 2258698f425bSmrg # Set up the ranlib parameters. 2259698f425bSmrg oldlib="$destdir/$name" 2260698f425bSmrg 2261698f425bSmrg func_show_eval "$install_prog \$file \$oldlib" 'exit $?' 2262698f425bSmrg 2263698f425bSmrg if test -n "$stripme" && test -n "$old_striplib"; then 2264698f425bSmrg func_show_eval "$old_striplib $oldlib" 'exit $?' 2265698f425bSmrg fi 2266698f425bSmrg 2267698f425bSmrg # Do each command in the postinstall commands. 2268698f425bSmrg func_execute_cmds "$old_postinstall_cmds" 'exit $?' 2269698f425bSmrg done 2270698f425bSmrg 2271698f425bSmrg test -n "$future_libdirs" && \ 2272698f425bSmrg func_warning "remember to run \`$progname --finish$future_libdirs'" 2273698f425bSmrg 2274698f425bSmrg if test -n "$current_libdirs"; then 2275698f425bSmrg # Maybe just do a dry run. 2276698f425bSmrg $opt_dry_run && current_libdirs=" -n$current_libdirs" 2277698f425bSmrg exec_cmd='$SHELL $progpath $preserve_args --finish$current_libdirs' 2278698f425bSmrg else 2279698f425bSmrg exit $EXIT_SUCCESS 2280698f425bSmrg fi 2281698f425bSmrg} 2282698f425bSmrg 2283698f425bSmrgtest "$mode" = install && func_mode_install ${1+"$@"} 2284698f425bSmrg 2285698f425bSmrg 2286698f425bSmrg# func_generate_dlsyms outputname originator pic_p 2287698f425bSmrg# Extract symbols from dlprefiles and create ${outputname}S.o with 2288698f425bSmrg# a dlpreopen symbol table. 2289698f425bSmrgfunc_generate_dlsyms () 2290698f425bSmrg{ 2291698f425bSmrg $opt_debug 2292698f425bSmrg my_outputname="$1" 2293698f425bSmrg my_originator="$2" 2294698f425bSmrg my_pic_p="${3-no}" 2295698f425bSmrg my_prefix=`$ECHO "$my_originator" | sed 's%[^a-zA-Z0-9]%_%g'` 2296698f425bSmrg my_dlsyms= 2297698f425bSmrg 2298698f425bSmrg if test -n "$dlfiles$dlprefiles" || test "$dlself" != no; then 2299698f425bSmrg if test -n "$NM" && test -n "$global_symbol_pipe"; then 2300698f425bSmrg my_dlsyms="${my_outputname}S.c" 2301698f425bSmrg else 2302698f425bSmrg func_error "not configured to extract global symbols from dlpreopened files" 2303698f425bSmrg fi 2304698f425bSmrg fi 2305698f425bSmrg 2306698f425bSmrg if test -n "$my_dlsyms"; then 2307698f425bSmrg case $my_dlsyms in 2308698f425bSmrg "") ;; 2309698f425bSmrg *.c) 2310698f425bSmrg # Discover the nlist of each of the dlfiles. 2311698f425bSmrg nlist="$output_objdir/${my_outputname}.nm" 2312698f425bSmrg 2313698f425bSmrg func_show_eval "$RM $nlist ${nlist}S ${nlist}T" 2314698f425bSmrg 2315698f425bSmrg # Parse the name list into a source file. 2316698f425bSmrg func_verbose "creating $output_objdir/$my_dlsyms" 2317698f425bSmrg 2318698f425bSmrg $opt_dry_run || $ECHO > "$output_objdir/$my_dlsyms" "\ 2319698f425bSmrg/* $my_dlsyms - symbol resolution table for \`$my_outputname' dlsym emulation. */ 2320698f425bSmrg/* Generated by $PROGRAM (GNU $PACKAGE$TIMESTAMP) $VERSION */ 2321698f425bSmrg 2322698f425bSmrg#ifdef __cplusplus 2323698f425bSmrgextern \"C\" { 2324698f425bSmrg#endif 2325698f425bSmrg 2326698f425bSmrg/* External symbol declarations for the compiler. */\ 2327698f425bSmrg" 2328698f425bSmrg 2329698f425bSmrg if test "$dlself" = yes; then 2330698f425bSmrg func_verbose "generating symbol list for \`$output'" 2331698f425bSmrg 2332698f425bSmrg $opt_dry_run || echo ': @PROGRAM@ ' > "$nlist" 2333698f425bSmrg 2334698f425bSmrg # Add our own program objects to the symbol list. 2335698f425bSmrg progfiles=`$ECHO "X$objs$old_deplibs" | $SP2NL | $Xsed -e "$lo2o" | $NL2SP` 2336698f425bSmrg for progfile in $progfiles; do 2337698f425bSmrg func_verbose "extracting global C symbols from \`$progfile'" 2338698f425bSmrg $opt_dry_run || eval "$NM $progfile | $global_symbol_pipe >> '$nlist'" 2339698f425bSmrg done 2340698f425bSmrg 2341698f425bSmrg if test -n "$exclude_expsyms"; then 2342698f425bSmrg $opt_dry_run || { 2343698f425bSmrg eval '$EGREP -v " ($exclude_expsyms)$" "$nlist" > "$nlist"T' 2344698f425bSmrg eval '$MV "$nlist"T "$nlist"' 2345698f425bSmrg } 2346266e564dSmrg fi 2347698f425bSmrg 2348698f425bSmrg if test -n "$export_symbols_regex"; then 2349698f425bSmrg $opt_dry_run || { 2350698f425bSmrg eval '$EGREP -e "$export_symbols_regex" "$nlist" > "$nlist"T' 2351698f425bSmrg eval '$MV "$nlist"T "$nlist"' 2352698f425bSmrg } 2353698f425bSmrg fi 2354698f425bSmrg 2355698f425bSmrg # Prepare the list of exported symbols 2356698f425bSmrg if test -z "$export_symbols"; then 2357698f425bSmrg export_symbols="$output_objdir/$outputname.exp" 2358698f425bSmrg $opt_dry_run || { 2359698f425bSmrg $RM $export_symbols 2360698f425bSmrg eval "${SED} -n -e '/^: @PROGRAM@ $/d' -e 's/^.* \(.*\)$/\1/p' "'< "$nlist" > "$export_symbols"' 2361698f425bSmrg case $host in 2362698f425bSmrg *cygwin* | *mingw* | *cegcc* ) 2363698f425bSmrg eval "echo EXPORTS "'> "$output_objdir/$outputname.def"' 2364698f425bSmrg eval 'cat "$export_symbols" >> "$output_objdir/$outputname.def"' 2365698f425bSmrg ;; 2366698f425bSmrg esac 2367698f425bSmrg } 2368266e564dSmrg else 2369698f425bSmrg $opt_dry_run || { 2370698f425bSmrg eval "${SED} -e 's/\([].[*^$]\)/\\\\\1/g' -e 's/^/ /' -e 's/$/$/'"' < "$export_symbols" > "$output_objdir/$outputname.exp"' 2371698f425bSmrg eval '$GREP -f "$output_objdir/$outputname.exp" < "$nlist" > "$nlist"T' 2372698f425bSmrg eval '$MV "$nlist"T "$nlist"' 2373698f425bSmrg case $host in 2374698f425bSmrg *cygwin | *mingw* | *cegcc* ) 2375698f425bSmrg eval "echo EXPORTS "'> "$output_objdir/$outputname.def"' 2376698f425bSmrg eval 'cat "$nlist" >> "$output_objdir/$outputname.def"' 2377698f425bSmrg ;; 2378698f425bSmrg esac 2379698f425bSmrg } 2380266e564dSmrg fi 2381698f425bSmrg fi 2382266e564dSmrg 2383698f425bSmrg for dlprefile in $dlprefiles; do 2384698f425bSmrg func_verbose "extracting global C symbols from \`$dlprefile'" 2385698f425bSmrg func_basename "$dlprefile" 2386698f425bSmrg name="$func_basename_result" 2387698f425bSmrg $opt_dry_run || { 2388698f425bSmrg eval '$ECHO ": $name " >> "$nlist"' 2389698f425bSmrg eval "$NM $dlprefile 2>/dev/null | $global_symbol_pipe >> '$nlist'" 2390698f425bSmrg } 2391698f425bSmrg done 2392698f425bSmrg 2393698f425bSmrg $opt_dry_run || { 2394698f425bSmrg # Make sure we have at least an empty file. 2395698f425bSmrg test -f "$nlist" || : > "$nlist" 2396698f425bSmrg 2397698f425bSmrg if test -n "$exclude_expsyms"; then 2398698f425bSmrg $EGREP -v " ($exclude_expsyms)$" "$nlist" > "$nlist"T 2399698f425bSmrg $MV "$nlist"T "$nlist" 2400266e564dSmrg fi 2401698f425bSmrg 2402698f425bSmrg # Try sorting and uniquifying the output. 2403698f425bSmrg if $GREP -v "^: " < "$nlist" | 2404698f425bSmrg if sort -k 3 </dev/null >/dev/null 2>&1; then 2405698f425bSmrg sort -k 3 2406698f425bSmrg else 2407698f425bSmrg sort +2 2408698f425bSmrg fi | 2409698f425bSmrg uniq > "$nlist"S; then 2410698f425bSmrg : 2411266e564dSmrg else 2412698f425bSmrg $GREP -v "^: " < "$nlist" > "$nlist"S 2413266e564dSmrg fi 2414266e564dSmrg 2415698f425bSmrg if test -f "$nlist"S; then 2416698f425bSmrg eval "$global_symbol_to_cdecl"' < "$nlist"S >> "$output_objdir/$my_dlsyms"' 2417266e564dSmrg else 2418698f425bSmrg $ECHO '/* NONE */' >> "$output_objdir/$my_dlsyms" 2419266e564dSmrg fi 2420266e564dSmrg 2421698f425bSmrg $ECHO >> "$output_objdir/$my_dlsyms" "\ 2422266e564dSmrg 2423698f425bSmrg/* The mapping between symbol names and symbols. */ 2424698f425bSmrgtypedef struct { 2425698f425bSmrg const char *name; 2426698f425bSmrg void *address; 2427698f425bSmrg} lt_dlsymlist; 2428698f425bSmrg" 2429698f425bSmrg case $host in 2430698f425bSmrg *cygwin* | *mingw* | *cegcc* ) 2431698f425bSmrg $ECHO >> "$output_objdir/$my_dlsyms" "\ 2432698f425bSmrg/* DATA imports from DLLs on WIN32 con't be const, because 2433698f425bSmrg runtime relocations are performed -- see ld's documentation 2434698f425bSmrg on pseudo-relocs. */" 2435698f425bSmrg lt_dlsym_const= ;; 2436698f425bSmrg *osf5*) 2437698f425bSmrg echo >> "$output_objdir/$my_dlsyms" "\ 2438698f425bSmrg/* This system does not cope well with relocations in const data */" 2439698f425bSmrg lt_dlsym_const= ;; 2440698f425bSmrg *) 2441698f425bSmrg lt_dlsym_const=const ;; 2442698f425bSmrg esac 2443266e564dSmrg 2444698f425bSmrg $ECHO >> "$output_objdir/$my_dlsyms" "\ 2445698f425bSmrgextern $lt_dlsym_const lt_dlsymlist 2446698f425bSmrglt_${my_prefix}_LTX_preloaded_symbols[]; 2447698f425bSmrg$lt_dlsym_const lt_dlsymlist 2448698f425bSmrglt_${my_prefix}_LTX_preloaded_symbols[] = 2449698f425bSmrg{\ 2450698f425bSmrg { \"$my_originator\", (void *) 0 }," 2451266e564dSmrg 2452698f425bSmrg case $need_lib_prefix in 2453698f425bSmrg no) 2454698f425bSmrg eval "$global_symbol_to_c_name_address" < "$nlist" >> "$output_objdir/$my_dlsyms" 2455698f425bSmrg ;; 2456698f425bSmrg *) 2457698f425bSmrg eval "$global_symbol_to_c_name_address_lib_prefix" < "$nlist" >> "$output_objdir/$my_dlsyms" 2458698f425bSmrg ;; 2459698f425bSmrg esac 2460698f425bSmrg $ECHO >> "$output_objdir/$my_dlsyms" "\ 2461698f425bSmrg {0, (void *) 0} 2462698f425bSmrg}; 2463266e564dSmrg 2464698f425bSmrg/* This works around a problem in FreeBSD linker */ 2465698f425bSmrg#ifdef FREEBSD_WORKAROUND 2466698f425bSmrgstatic const void *lt_preloaded_setup() { 2467698f425bSmrg return lt_${my_prefix}_LTX_preloaded_symbols; 2468698f425bSmrg} 2469698f425bSmrg#endif 2470698f425bSmrg 2471698f425bSmrg#ifdef __cplusplus 2472698f425bSmrg} 2473698f425bSmrg#endif\ 2474698f425bSmrg" 2475698f425bSmrg } # !$opt_dry_run 2476698f425bSmrg 2477698f425bSmrg pic_flag_for_symtable= 2478698f425bSmrg case "$compile_command " in 2479698f425bSmrg *" -static "*) ;; 2480698f425bSmrg *) 2481698f425bSmrg case $host in 2482698f425bSmrg # compiling the symbol table file with pic_flag works around 2483698f425bSmrg # a FreeBSD bug that causes programs to crash when -lm is 2484698f425bSmrg # linked before any other PIC object. But we must not use 2485698f425bSmrg # pic_flag when linking with -static. The problem exists in 2486698f425bSmrg # FreeBSD 2.2.6 and is fixed in FreeBSD 3.1. 2487698f425bSmrg *-*-freebsd2*|*-*-freebsd3.0*|*-*-freebsdelf3.0*) 2488698f425bSmrg pic_flag_for_symtable=" $pic_flag -DFREEBSD_WORKAROUND" ;; 2489698f425bSmrg *-*-hpux*) 2490698f425bSmrg pic_flag_for_symtable=" $pic_flag" ;; 2491698f425bSmrg *) 2492698f425bSmrg if test "X$my_pic_p" != Xno; then 2493698f425bSmrg pic_flag_for_symtable=" $pic_flag" 2494266e564dSmrg fi 2495698f425bSmrg ;; 2496698f425bSmrg esac 2497698f425bSmrg ;; 2498698f425bSmrg esac 2499698f425bSmrg symtab_cflags= 2500698f425bSmrg for arg in $LTCFLAGS; do 2501698f425bSmrg case $arg in 2502698f425bSmrg -pie | -fpie | -fPIE) ;; 2503698f425bSmrg *) symtab_cflags="$symtab_cflags $arg" ;; 2504698f425bSmrg esac 2505698f425bSmrg done 2506266e564dSmrg 2507698f425bSmrg # Now compile the dynamic symbol file. 2508698f425bSmrg func_show_eval '(cd $output_objdir && $LTCC$symtab_cflags -c$no_builtin_flag$pic_flag_for_symtable "$my_dlsyms")' 'exit $?' 2509266e564dSmrg 2510698f425bSmrg # Clean up the generated files. 2511698f425bSmrg func_show_eval '$RM "$output_objdir/$my_dlsyms" "$nlist" "${nlist}S" "${nlist}T"' 2512266e564dSmrg 2513698f425bSmrg # Transform the symbol file into the correct name. 2514698f425bSmrg symfileobj="$output_objdir/${my_outputname}S.$objext" 2515698f425bSmrg case $host in 2516698f425bSmrg *cygwin* | *mingw* | *cegcc* ) 2517698f425bSmrg if test -f "$output_objdir/$my_outputname.def"; then 2518698f425bSmrg compile_command=`$ECHO "X$compile_command" | $Xsed -e "s%@SYMFILE@%$output_objdir/$my_outputname.def $symfileobj%"` 2519698f425bSmrg finalize_command=`$ECHO "X$finalize_command" | $Xsed -e "s%@SYMFILE@%$output_objdir/$my_outputname.def $symfileobj%"` 2520698f425bSmrg else 2521698f425bSmrg compile_command=`$ECHO "X$compile_command" | $Xsed -e "s%@SYMFILE@%$symfileobj%"` 2522698f425bSmrg finalize_command=`$ECHO "X$finalize_command" | $Xsed -e "s%@SYMFILE@%$symfileobj%"` 2523266e564dSmrg fi 2524698f425bSmrg ;; 2525698f425bSmrg *) 2526698f425bSmrg compile_command=`$ECHO "X$compile_command" | $Xsed -e "s%@SYMFILE@%$symfileobj%"` 2527698f425bSmrg finalize_command=`$ECHO "X$finalize_command" | $Xsed -e "s%@SYMFILE@%$symfileobj%"` 2528698f425bSmrg ;; 2529698f425bSmrg esac 2530698f425bSmrg ;; 2531698f425bSmrg *) 2532698f425bSmrg func_fatal_error "unknown suffix for \`$my_dlsyms'" 2533698f425bSmrg ;; 2534698f425bSmrg esac 2535698f425bSmrg else 2536698f425bSmrg # We keep going just in case the user didn't refer to 2537698f425bSmrg # lt_preloaded_symbols. The linker will fail if global_symbol_pipe 2538698f425bSmrg # really was required. 2539266e564dSmrg 2540698f425bSmrg # Nullify the symbol file. 2541698f425bSmrg compile_command=`$ECHO "X$compile_command" | $Xsed -e "s% @SYMFILE@%%"` 2542698f425bSmrg finalize_command=`$ECHO "X$finalize_command" | $Xsed -e "s% @SYMFILE@%%"` 2543698f425bSmrg fi 2544698f425bSmrg} 2545266e564dSmrg 2546698f425bSmrg# func_win32_libid arg 2547698f425bSmrg# return the library type of file 'arg' 2548698f425bSmrg# 2549698f425bSmrg# Need a lot of goo to handle *both* DLLs and import libs 2550698f425bSmrg# Has to be a shell function in order to 'eat' the argument 2551698f425bSmrg# that is supplied when $file_magic_command is called. 2552698f425bSmrgfunc_win32_libid () 2553698f425bSmrg{ 2554698f425bSmrg $opt_debug 2555698f425bSmrg win32_libid_type="unknown" 2556698f425bSmrg win32_fileres=`file -L $1 2>/dev/null` 2557698f425bSmrg case $win32_fileres in 2558698f425bSmrg *ar\ archive\ import\ library*) # definitely import 2559698f425bSmrg win32_libid_type="x86 archive import" 2560698f425bSmrg ;; 2561698f425bSmrg *ar\ archive*) # could be an import, or static 2562698f425bSmrg if eval $OBJDUMP -f $1 | $SED -e '10q' 2>/dev/null | 2563698f425bSmrg $EGREP 'file format pe-i386(.*architecture: i386)?' >/dev/null ; then 2564698f425bSmrg win32_nmres=`eval $NM -f posix -A $1 | 2565698f425bSmrg $SED -n -e ' 2566698f425bSmrg 1,100{ 2567698f425bSmrg / I /{ 2568698f425bSmrg s,.*,import, 2569698f425bSmrg p 2570698f425bSmrg q 2571698f425bSmrg } 2572698f425bSmrg }'` 2573698f425bSmrg case $win32_nmres in 2574698f425bSmrg import*) win32_libid_type="x86 archive import";; 2575698f425bSmrg *) win32_libid_type="x86 archive static";; 2576698f425bSmrg esac 2577698f425bSmrg fi 2578698f425bSmrg ;; 2579698f425bSmrg *DLL*) 2580698f425bSmrg win32_libid_type="x86 DLL" 2581698f425bSmrg ;; 2582698f425bSmrg *executable*) # but shell scripts are "executable" too... 2583698f425bSmrg case $win32_fileres in 2584698f425bSmrg *MS\ Windows\ PE\ Intel*) 2585698f425bSmrg win32_libid_type="x86 DLL" 2586698f425bSmrg ;; 2587698f425bSmrg esac 2588698f425bSmrg ;; 2589698f425bSmrg esac 2590698f425bSmrg $ECHO "$win32_libid_type" 2591698f425bSmrg} 2592266e564dSmrg 2593266e564dSmrg 2594266e564dSmrg 2595698f425bSmrg# func_extract_an_archive dir oldlib 2596698f425bSmrgfunc_extract_an_archive () 2597698f425bSmrg{ 2598698f425bSmrg $opt_debug 2599698f425bSmrg f_ex_an_ar_dir="$1"; shift 2600698f425bSmrg f_ex_an_ar_oldlib="$1" 2601698f425bSmrg func_show_eval "(cd \$f_ex_an_ar_dir && $AR x \"\$f_ex_an_ar_oldlib\")" 'exit $?' 2602698f425bSmrg if ($AR t "$f_ex_an_ar_oldlib" | sort | sort -uc >/dev/null 2>&1); then 2603698f425bSmrg : 2604698f425bSmrg else 2605698f425bSmrg func_fatal_error "object name conflicts in archive: $f_ex_an_ar_dir/$f_ex_an_ar_oldlib" 2606698f425bSmrg fi 2607698f425bSmrg} 2608266e564dSmrg 2609266e564dSmrg 2610698f425bSmrg# func_extract_archives gentop oldlib ... 2611698f425bSmrgfunc_extract_archives () 2612698f425bSmrg{ 2613698f425bSmrg $opt_debug 2614698f425bSmrg my_gentop="$1"; shift 2615698f425bSmrg my_oldlibs=${1+"$@"} 2616698f425bSmrg my_oldobjs="" 2617698f425bSmrg my_xlib="" 2618698f425bSmrg my_xabs="" 2619698f425bSmrg my_xdir="" 2620266e564dSmrg 2621698f425bSmrg for my_xlib in $my_oldlibs; do 2622698f425bSmrg # Extract the objects. 2623698f425bSmrg case $my_xlib in 2624698f425bSmrg [\\/]* | [A-Za-z]:[\\/]*) my_xabs="$my_xlib" ;; 2625698f425bSmrg *) my_xabs=`pwd`"/$my_xlib" ;; 2626698f425bSmrg esac 2627698f425bSmrg func_basename "$my_xlib" 2628698f425bSmrg my_xlib="$func_basename_result" 2629698f425bSmrg my_xlib_u=$my_xlib 2630698f425bSmrg while :; do 2631698f425bSmrg case " $extracted_archives " in 2632698f425bSmrg *" $my_xlib_u "*) 2633698f425bSmrg func_arith $extracted_serial + 1 2634698f425bSmrg extracted_serial=$func_arith_result 2635698f425bSmrg my_xlib_u=lt$extracted_serial-$my_xlib ;; 2636698f425bSmrg *) break ;; 2637698f425bSmrg esac 2638698f425bSmrg done 2639698f425bSmrg extracted_archives="$extracted_archives $my_xlib_u" 2640698f425bSmrg my_xdir="$my_gentop/$my_xlib_u" 2641266e564dSmrg 2642698f425bSmrg func_mkdir_p "$my_xdir" 2643266e564dSmrg 2644698f425bSmrg case $host in 2645698f425bSmrg *-darwin*) 2646698f425bSmrg func_verbose "Extracting $my_xabs" 2647698f425bSmrg # Do not bother doing anything if just a dry run 2648698f425bSmrg $opt_dry_run || { 2649698f425bSmrg darwin_orig_dir=`pwd` 2650698f425bSmrg cd $my_xdir || exit $? 2651698f425bSmrg darwin_archive=$my_xabs 2652698f425bSmrg darwin_curdir=`pwd` 2653698f425bSmrg darwin_base_archive=`basename "$darwin_archive"` 2654698f425bSmrg darwin_arches=`$LIPO -info "$darwin_archive" 2>/dev/null | $GREP Architectures 2>/dev/null || true` 2655698f425bSmrg if test -n "$darwin_arches"; then 2656698f425bSmrg darwin_arches=`$ECHO "$darwin_arches" | $SED -e 's/.*are://'` 2657698f425bSmrg darwin_arch= 2658698f425bSmrg func_verbose "$darwin_base_archive has multiple architectures $darwin_arches" 2659698f425bSmrg for darwin_arch in $darwin_arches ; do 2660698f425bSmrg func_mkdir_p "unfat-$$/${darwin_base_archive}-${darwin_arch}" 2661698f425bSmrg $LIPO -thin $darwin_arch -output "unfat-$$/${darwin_base_archive}-${darwin_arch}/${darwin_base_archive}" "${darwin_archive}" 2662698f425bSmrg cd "unfat-$$/${darwin_base_archive}-${darwin_arch}" 2663698f425bSmrg func_extract_an_archive "`pwd`" "${darwin_base_archive}" 2664698f425bSmrg cd "$darwin_curdir" 2665698f425bSmrg $RM "unfat-$$/${darwin_base_archive}-${darwin_arch}/${darwin_base_archive}" 2666698f425bSmrg done # $darwin_arches 2667698f425bSmrg ## Okay now we've a bunch of thin objects, gotta fatten them up :) 2668698f425bSmrg darwin_filelist=`find unfat-$$ -type f -name \*.o -print -o -name \*.lo -print | $SED -e "$basename" | sort -u` 2669698f425bSmrg darwin_file= 2670698f425bSmrg darwin_files= 2671698f425bSmrg for darwin_file in $darwin_filelist; do 2672698f425bSmrg darwin_files=`find unfat-$$ -name $darwin_file -print | $NL2SP` 2673698f425bSmrg $LIPO -create -output "$darwin_file" $darwin_files 2674698f425bSmrg done # $darwin_filelist 2675698f425bSmrg $RM -rf unfat-$$ 2676698f425bSmrg cd "$darwin_orig_dir" 2677266e564dSmrg else 2678698f425bSmrg cd $darwin_orig_dir 2679698f425bSmrg func_extract_an_archive "$my_xdir" "$my_xabs" 2680698f425bSmrg fi # $darwin_arches 2681698f425bSmrg } # !$opt_dry_run 2682698f425bSmrg ;; 2683698f425bSmrg *) 2684698f425bSmrg func_extract_an_archive "$my_xdir" "$my_xabs" 2685698f425bSmrg ;; 2686698f425bSmrg esac 2687698f425bSmrg my_oldobjs="$my_oldobjs "`find $my_xdir -name \*.$objext -print -o -name \*.lo -print | $NL2SP` 2688698f425bSmrg done 2689266e564dSmrg 2690698f425bSmrg func_extract_archives_result="$my_oldobjs" 2691698f425bSmrg} 2692266e564dSmrg 2693266e564dSmrg 2694266e564dSmrg 2695698f425bSmrg# func_emit_wrapper_part1 [arg=no] 2696698f425bSmrg# 2697698f425bSmrg# Emit the first part of a libtool wrapper script on stdout. 2698698f425bSmrg# For more information, see the description associated with 2699698f425bSmrg# func_emit_wrapper(), below. 2700698f425bSmrgfunc_emit_wrapper_part1 () 2701698f425bSmrg{ 2702698f425bSmrg func_emit_wrapper_part1_arg1=no 2703698f425bSmrg if test -n "$1" ; then 2704698f425bSmrg func_emit_wrapper_part1_arg1=$1 2705266e564dSmrg fi 2706266e564dSmrg 2707698f425bSmrg $ECHO "\ 2708698f425bSmrg#! $SHELL 2709266e564dSmrg 2710698f425bSmrg# $output - temporary wrapper script for $objdir/$outputname 2711698f425bSmrg# Generated by $PROGRAM (GNU $PACKAGE$TIMESTAMP) $VERSION 2712698f425bSmrg# 2713698f425bSmrg# The $output program cannot be directly executed until all the libtool 2714698f425bSmrg# libraries that it depends on are installed. 2715698f425bSmrg# 2716698f425bSmrg# This wrapper script should never be moved out of the build directory. 2717698f425bSmrg# If it is, it will not operate correctly. 2718266e564dSmrg 2719698f425bSmrg# Sed substitution that helps us do robust quoting. It backslashifies 2720698f425bSmrg# metacharacters that are still active within double-quoted strings. 2721698f425bSmrgXsed='${SED} -e 1s/^X//' 2722698f425bSmrgsed_quote_subst='$sed_quote_subst' 2723266e564dSmrg 2724698f425bSmrg# Be Bourne compatible 2725698f425bSmrgif test -n \"\${ZSH_VERSION+set}\" && (emulate sh) >/dev/null 2>&1; then 2726698f425bSmrg emulate sh 2727698f425bSmrg NULLCMD=: 2728698f425bSmrg # Zsh 3.x and 4.x performs word splitting on \${1+\"\$@\"}, which 2729698f425bSmrg # is contrary to our usage. Disable this feature. 2730698f425bSmrg alias -g '\${1+\"\$@\"}'='\"\$@\"' 2731698f425bSmrg setopt NO_GLOB_SUBST 2732698f425bSmrgelse 2733698f425bSmrg case \`(set -o) 2>/dev/null\` in *posix*) set -o posix;; esac 2734698f425bSmrgfi 2735698f425bSmrgBIN_SH=xpg4; export BIN_SH # for Tru64 2736698f425bSmrgDUALCASE=1; export DUALCASE # for MKS sh 2737266e564dSmrg 2738698f425bSmrg# The HP-UX ksh and POSIX shell print the target directory to stdout 2739698f425bSmrg# if CDPATH is set. 2740698f425bSmrg(unset CDPATH) >/dev/null 2>&1 && unset CDPATH 2741266e564dSmrg 2742698f425bSmrgrelink_command=\"$relink_command\" 2743266e564dSmrg 2744698f425bSmrg# This environment variable determines our operation mode. 2745698f425bSmrgif test \"\$libtool_install_magic\" = \"$magic\"; then 2746698f425bSmrg # install mode needs the following variables: 2747698f425bSmrg generated_by_libtool_version='$macro_version' 2748698f425bSmrg notinst_deplibs='$notinst_deplibs' 2749698f425bSmrgelse 2750698f425bSmrg # When we are sourced in execute mode, \$file and \$ECHO are already set. 2751698f425bSmrg if test \"\$libtool_execute_magic\" != \"$magic\"; then 2752698f425bSmrg ECHO=\"$qecho\" 2753698f425bSmrg file=\"\$0\" 2754698f425bSmrg # Make sure echo works. 2755698f425bSmrg if test \"X\$1\" = X--no-reexec; then 2756698f425bSmrg # Discard the --no-reexec flag, and continue. 2757698f425bSmrg shift 2758698f425bSmrg elif test \"X\`{ \$ECHO '\t'; } 2>/dev/null\`\" = 'X\t'; then 2759698f425bSmrg # Yippee, \$ECHO works! 2760698f425bSmrg : 2761698f425bSmrg else 2762698f425bSmrg # Restart under the correct shell, and then maybe \$ECHO will work. 2763698f425bSmrg exec $SHELL \"\$0\" --no-reexec \${1+\"\$@\"} 2764698f425bSmrg fi 2765698f425bSmrg fi\ 2766698f425bSmrg" 2767698f425bSmrg $ECHO "\ 2768266e564dSmrg 2769698f425bSmrg # Find the directory that this script lives in. 2770698f425bSmrg thisdir=\`\$ECHO \"X\$file\" | \$Xsed -e 's%/[^/]*$%%'\` 2771698f425bSmrg test \"x\$thisdir\" = \"x\$file\" && thisdir=. 2772266e564dSmrg 2773698f425bSmrg # Follow symbolic links until we get to the real thisdir. 2774698f425bSmrg file=\`ls -ld \"\$file\" | ${SED} -n 's/.*-> //p'\` 2775698f425bSmrg while test -n \"\$file\"; do 2776698f425bSmrg destdir=\`\$ECHO \"X\$file\" | \$Xsed -e 's%/[^/]*\$%%'\` 2777266e564dSmrg 2778698f425bSmrg # If there was a directory component, then change thisdir. 2779698f425bSmrg if test \"x\$destdir\" != \"x\$file\"; then 2780698f425bSmrg case \"\$destdir\" in 2781698f425bSmrg [\\\\/]* | [A-Za-z]:[\\\\/]*) thisdir=\"\$destdir\" ;; 2782698f425bSmrg *) thisdir=\"\$thisdir/\$destdir\" ;; 2783266e564dSmrg esac 2784698f425bSmrg fi 2785266e564dSmrg 2786698f425bSmrg file=\`\$ECHO \"X\$file\" | \$Xsed -e 's%^.*/%%'\` 2787698f425bSmrg file=\`ls -ld \"\$thisdir/\$file\" | ${SED} -n 's/.*-> //p'\` 2788698f425bSmrg done 2789698f425bSmrg" 2790698f425bSmrg} 2791698f425bSmrg# end: func_emit_wrapper_part1 2792698f425bSmrg 2793698f425bSmrg# func_emit_wrapper_part2 [arg=no] 2794698f425bSmrg# 2795698f425bSmrg# Emit the second part of a libtool wrapper script on stdout. 2796698f425bSmrg# For more information, see the description associated with 2797698f425bSmrg# func_emit_wrapper(), below. 2798698f425bSmrgfunc_emit_wrapper_part2 () 2799698f425bSmrg{ 2800698f425bSmrg func_emit_wrapper_part2_arg1=no 2801698f425bSmrg if test -n "$1" ; then 2802698f425bSmrg func_emit_wrapper_part2_arg1=$1 2803266e564dSmrg fi 2804266e564dSmrg 2805698f425bSmrg $ECHO "\ 2806266e564dSmrg 2807698f425bSmrg # Usually 'no', except on cygwin/mingw when embedded into 2808698f425bSmrg # the cwrapper. 2809698f425bSmrg WRAPPER_SCRIPT_BELONGS_IN_OBJDIR=$func_emit_wrapper_part2_arg1 2810698f425bSmrg if test \"\$WRAPPER_SCRIPT_BELONGS_IN_OBJDIR\" = \"yes\"; then 2811698f425bSmrg # special case for '.' 2812698f425bSmrg if test \"\$thisdir\" = \".\"; then 2813698f425bSmrg thisdir=\`pwd\` 2814698f425bSmrg fi 2815698f425bSmrg # remove .libs from thisdir 2816698f425bSmrg case \"\$thisdir\" in 2817698f425bSmrg *[\\\\/]$objdir ) thisdir=\`\$ECHO \"X\$thisdir\" | \$Xsed -e 's%[\\\\/][^\\\\/]*$%%'\` ;; 2818698f425bSmrg $objdir ) thisdir=. ;; 2819698f425bSmrg esac 2820698f425bSmrg fi 2821698f425bSmrg 2822698f425bSmrg # Try to get the absolute directory name. 2823698f425bSmrg absdir=\`cd \"\$thisdir\" && pwd\` 2824698f425bSmrg test -n \"\$absdir\" && thisdir=\"\$absdir\" 2825698f425bSmrg" 2826698f425bSmrg 2827698f425bSmrg if test "$fast_install" = yes; then 2828698f425bSmrg $ECHO "\ 2829698f425bSmrg program=lt-'$outputname'$exeext 2830698f425bSmrg progdir=\"\$thisdir/$objdir\" 2831698f425bSmrg 2832698f425bSmrg if test ! -f \"\$progdir/\$program\" || 2833698f425bSmrg { file=\`ls -1dt \"\$progdir/\$program\" \"\$progdir/../\$program\" 2>/dev/null | ${SED} 1q\`; \\ 2834698f425bSmrg test \"X\$file\" != \"X\$progdir/\$program\"; }; then 2835698f425bSmrg 2836698f425bSmrg file=\"\$\$-\$program\" 2837698f425bSmrg 2838698f425bSmrg if test ! -d \"\$progdir\"; then 2839698f425bSmrg $MKDIR \"\$progdir\" 2840698f425bSmrg else 2841698f425bSmrg $RM \"\$progdir/\$file\" 2842698f425bSmrg fi" 2843698f425bSmrg 2844698f425bSmrg $ECHO "\ 2845698f425bSmrg 2846698f425bSmrg # relink executable if necessary 2847698f425bSmrg if test -n \"\$relink_command\"; then 2848698f425bSmrg if relink_command_output=\`eval \$relink_command 2>&1\`; then : 2849698f425bSmrg else 2850698f425bSmrg $ECHO \"\$relink_command_output\" >&2 2851698f425bSmrg $RM \"\$progdir/\$file\" 2852698f425bSmrg exit 1 2853266e564dSmrg fi 2854698f425bSmrg fi 2855266e564dSmrg 2856698f425bSmrg $MV \"\$progdir/\$file\" \"\$progdir/\$program\" 2>/dev/null || 2857698f425bSmrg { $RM \"\$progdir/\$program\"; 2858698f425bSmrg $MV \"\$progdir/\$file\" \"\$progdir/\$program\"; } 2859698f425bSmrg $RM \"\$progdir/\$file\" 2860698f425bSmrg fi" 2861698f425bSmrg else 2862698f425bSmrg $ECHO "\ 2863698f425bSmrg program='$outputname' 2864698f425bSmrg progdir=\"\$thisdir/$objdir\" 2865698f425bSmrg" 2866266e564dSmrg fi 2867266e564dSmrg 2868698f425bSmrg $ECHO "\ 2869266e564dSmrg 2870698f425bSmrg if test -f \"\$progdir/\$program\"; then" 2871266e564dSmrg 2872698f425bSmrg # Export our shlibpath_var if we have one. 2873698f425bSmrg if test "$shlibpath_overrides_runpath" = yes && test -n "$shlibpath_var" && test -n "$temp_rpath"; then 2874698f425bSmrg $ECHO "\ 2875698f425bSmrg # Add our own library path to $shlibpath_var 2876698f425bSmrg $shlibpath_var=\"$temp_rpath\$$shlibpath_var\" 2877266e564dSmrg 2878698f425bSmrg # Some systems cannot cope with colon-terminated $shlibpath_var 2879698f425bSmrg # The second colon is a workaround for a bug in BeOS R4 sed 2880698f425bSmrg $shlibpath_var=\`\$ECHO \"X\$$shlibpath_var\" | \$Xsed -e 's/::*\$//'\` 2881698f425bSmrg 2882698f425bSmrg export $shlibpath_var 2883698f425bSmrg" 2884266e564dSmrg fi 2885266e564dSmrg 2886698f425bSmrg # fixup the dll searchpath if we need to. 2887698f425bSmrg if test -n "$dllsearchpath"; then 2888698f425bSmrg $ECHO "\ 2889698f425bSmrg # Add the dll search path components to the executable PATH 2890698f425bSmrg PATH=$dllsearchpath:\$PATH 2891698f425bSmrg" 2892698f425bSmrg fi 2893266e564dSmrg 2894698f425bSmrg $ECHO "\ 2895698f425bSmrg if test \"\$libtool_execute_magic\" != \"$magic\"; then 2896698f425bSmrg # Run the actual program with our arguments. 2897698f425bSmrg" 2898698f425bSmrg case $host in 2899698f425bSmrg # Backslashes separate directories on plain windows 2900698f425bSmrg *-*-mingw | *-*-os2* | *-cegcc*) 2901698f425bSmrg $ECHO "\ 2902698f425bSmrg exec \"\$progdir\\\\\$program\" \${1+\"\$@\"} 2903698f425bSmrg" 2904266e564dSmrg ;; 2905266e564dSmrg 2906266e564dSmrg *) 2907698f425bSmrg $ECHO "\ 2908698f425bSmrg exec \"\$progdir/\$program\" \${1+\"\$@\"} 2909698f425bSmrg" 2910266e564dSmrg ;; 2911266e564dSmrg esac 2912698f425bSmrg $ECHO "\ 2913698f425bSmrg \$ECHO \"\$0: cannot exec \$program \$*\" 1>&2 2914698f425bSmrg exit 1 2915698f425bSmrg fi 2916698f425bSmrg else 2917698f425bSmrg # The program doesn't exist. 2918698f425bSmrg \$ECHO \"\$0: error: \\\`\$progdir/\$program' does not exist\" 1>&2 2919698f425bSmrg \$ECHO \"This script is just a wrapper for \$program.\" 1>&2 2920698f425bSmrg $ECHO \"See the $PACKAGE documentation for more information.\" 1>&2 2921698f425bSmrg exit 1 2922698f425bSmrg fi 2923698f425bSmrgfi\ 2924698f425bSmrg" 2925698f425bSmrg} 2926698f425bSmrg# end: func_emit_wrapper_part2 2927266e564dSmrg 2928266e564dSmrg 2929698f425bSmrg# func_emit_wrapper [arg=no] 2930698f425bSmrg# 2931698f425bSmrg# Emit a libtool wrapper script on stdout. 2932698f425bSmrg# Don't directly open a file because we may want to 2933698f425bSmrg# incorporate the script contents within a cygwin/mingw 2934698f425bSmrg# wrapper executable. Must ONLY be called from within 2935698f425bSmrg# func_mode_link because it depends on a number of variables 2936698f425bSmrg# set therein. 2937698f425bSmrg# 2938698f425bSmrg# ARG is the value that the WRAPPER_SCRIPT_BELONGS_IN_OBJDIR 2939698f425bSmrg# variable will take. If 'yes', then the emitted script 2940698f425bSmrg# will assume that the directory in which it is stored is 2941698f425bSmrg# the $objdir directory. This is a cygwin/mingw-specific 2942698f425bSmrg# behavior. 2943698f425bSmrgfunc_emit_wrapper () 2944698f425bSmrg{ 2945698f425bSmrg func_emit_wrapper_arg1=no 2946698f425bSmrg if test -n "$1" ; then 2947698f425bSmrg func_emit_wrapper_arg1=$1 2948266e564dSmrg fi 2949266e564dSmrg 2950698f425bSmrg # split this up so that func_emit_cwrapperexe_src 2951698f425bSmrg # can call each part independently. 2952698f425bSmrg func_emit_wrapper_part1 "${func_emit_wrapper_arg1}" 2953698f425bSmrg func_emit_wrapper_part2 "${func_emit_wrapper_arg1}" 2954698f425bSmrg} 2955266e564dSmrg 2956266e564dSmrg 2957698f425bSmrg# func_to_host_path arg 2958698f425bSmrg# 2959698f425bSmrg# Convert paths to host format when used with build tools. 2960698f425bSmrg# Intended for use with "native" mingw (where libtool itself 2961698f425bSmrg# is running under the msys shell), or in the following cross- 2962698f425bSmrg# build environments: 2963698f425bSmrg# $build $host 2964698f425bSmrg# mingw (msys) mingw [e.g. native] 2965698f425bSmrg# cygwin mingw 2966698f425bSmrg# *nix + wine mingw 2967698f425bSmrg# where wine is equipped with the `winepath' executable. 2968698f425bSmrg# In the native mingw case, the (msys) shell automatically 2969698f425bSmrg# converts paths for any non-msys applications it launches, 2970698f425bSmrg# but that facility isn't available from inside the cwrapper. 2971698f425bSmrg# Similar accommodations are necessary for $host mingw and 2972698f425bSmrg# $build cygwin. Calling this function does no harm for other 2973698f425bSmrg# $host/$build combinations not listed above. 2974698f425bSmrg# 2975698f425bSmrg# ARG is the path (on $build) that should be converted to 2976698f425bSmrg# the proper representation for $host. The result is stored 2977698f425bSmrg# in $func_to_host_path_result. 2978698f425bSmrgfunc_to_host_path () 2979698f425bSmrg{ 2980698f425bSmrg func_to_host_path_result="$1" 2981698f425bSmrg if test -n "$1" ; then 2982698f425bSmrg case $host in 2983698f425bSmrg *mingw* ) 2984698f425bSmrg lt_sed_naive_backslashify='s|\\\\*|\\|g;s|/|\\|g;s|\\|\\\\|g' 2985698f425bSmrg case $build in 2986698f425bSmrg *mingw* ) # actually, msys 2987698f425bSmrg # awkward: cmd appends spaces to result 2988698f425bSmrg lt_sed_strip_trailing_spaces="s/[ ]*\$//" 2989698f425bSmrg func_to_host_path_tmp1=`( cmd //c echo "$1" |\ 2990698f425bSmrg $SED -e "$lt_sed_strip_trailing_spaces" ) 2>/dev/null || echo ""` 2991698f425bSmrg func_to_host_path_result=`echo "$func_to_host_path_tmp1" |\ 2992698f425bSmrg $SED -e "$lt_sed_naive_backslashify"` 2993698f425bSmrg ;; 2994698f425bSmrg *cygwin* ) 2995698f425bSmrg func_to_host_path_tmp1=`cygpath -w "$1"` 2996698f425bSmrg func_to_host_path_result=`echo "$func_to_host_path_tmp1" |\ 2997698f425bSmrg $SED -e "$lt_sed_naive_backslashify"` 2998698f425bSmrg ;; 2999698f425bSmrg * ) 3000698f425bSmrg # Unfortunately, winepath does not exit with a non-zero 3001698f425bSmrg # error code, so we are forced to check the contents of 3002698f425bSmrg # stdout. On the other hand, if the command is not 3003698f425bSmrg # found, the shell will set an exit code of 127 and print 3004698f425bSmrg # *an error message* to stdout. So we must check for both 3005698f425bSmrg # error code of zero AND non-empty stdout, which explains 3006698f425bSmrg # the odd construction: 3007698f425bSmrg func_to_host_path_tmp1=`winepath -w "$1" 2>/dev/null` 3008698f425bSmrg if test "$?" -eq 0 && test -n "${func_to_host_path_tmp1}"; then 3009698f425bSmrg func_to_host_path_result=`echo "$func_to_host_path_tmp1" |\ 3010698f425bSmrg $SED -e "$lt_sed_naive_backslashify"` 3011698f425bSmrg else 3012698f425bSmrg # Allow warning below. 3013698f425bSmrg func_to_host_path_result="" 3014698f425bSmrg fi 3015698f425bSmrg ;; 3016698f425bSmrg esac 3017698f425bSmrg if test -z "$func_to_host_path_result" ; then 3018698f425bSmrg func_error "Could not determine host path corresponding to" 3019698f425bSmrg func_error " '$1'" 3020698f425bSmrg func_error "Continuing, but uninstalled executables may not work." 3021698f425bSmrg # Fallback: 3022698f425bSmrg func_to_host_path_result="$1" 3023698f425bSmrg fi 3024698f425bSmrg ;; 3025698f425bSmrg esac 3026698f425bSmrg fi 3027698f425bSmrg} 3028698f425bSmrg# end: func_to_host_path 3029266e564dSmrg 3030698f425bSmrg# func_to_host_pathlist arg 3031698f425bSmrg# 3032698f425bSmrg# Convert pathlists to host format when used with build tools. 3033698f425bSmrg# See func_to_host_path(), above. This function supports the 3034698f425bSmrg# following $build/$host combinations (but does no harm for 3035698f425bSmrg# combinations not listed here): 3036698f425bSmrg# $build $host 3037698f425bSmrg# mingw (msys) mingw [e.g. native] 3038698f425bSmrg# cygwin mingw 3039698f425bSmrg# *nix + wine mingw 3040698f425bSmrg# 3041698f425bSmrg# Path separators are also converted from $build format to 3042698f425bSmrg# $host format. If ARG begins or ends with a path separator 3043698f425bSmrg# character, it is preserved (but converted to $host format) 3044698f425bSmrg# on output. 3045698f425bSmrg# 3046698f425bSmrg# ARG is a pathlist (on $build) that should be converted to 3047698f425bSmrg# the proper representation on $host. The result is stored 3048698f425bSmrg# in $func_to_host_pathlist_result. 3049698f425bSmrgfunc_to_host_pathlist () 3050698f425bSmrg{ 3051698f425bSmrg func_to_host_pathlist_result="$1" 3052698f425bSmrg if test -n "$1" ; then 3053698f425bSmrg case $host in 3054698f425bSmrg *mingw* ) 3055698f425bSmrg lt_sed_naive_backslashify='s|\\\\*|\\|g;s|/|\\|g;s|\\|\\\\|g' 3056698f425bSmrg # Remove leading and trailing path separator characters from 3057698f425bSmrg # ARG. msys behavior is inconsistent here, cygpath turns them 3058698f425bSmrg # into '.;' and ';.', and winepath ignores them completely. 3059698f425bSmrg func_to_host_pathlist_tmp2="$1" 3060698f425bSmrg # Once set for this call, this variable should not be 3061698f425bSmrg # reassigned. It is used in tha fallback case. 3062698f425bSmrg func_to_host_pathlist_tmp1=`echo "$func_to_host_pathlist_tmp2" |\ 3063698f425bSmrg $SED -e 's|^:*||' -e 's|:*$||'` 3064698f425bSmrg case $build in 3065698f425bSmrg *mingw* ) # Actually, msys. 3066698f425bSmrg # Awkward: cmd appends spaces to result. 3067698f425bSmrg lt_sed_strip_trailing_spaces="s/[ ]*\$//" 3068698f425bSmrg func_to_host_pathlist_tmp2=`( cmd //c echo "$func_to_host_pathlist_tmp1" |\ 3069698f425bSmrg $SED -e "$lt_sed_strip_trailing_spaces" ) 2>/dev/null || echo ""` 3070698f425bSmrg func_to_host_pathlist_result=`echo "$func_to_host_pathlist_tmp2" |\ 3071698f425bSmrg $SED -e "$lt_sed_naive_backslashify"` 3072698f425bSmrg ;; 3073698f425bSmrg *cygwin* ) 3074698f425bSmrg func_to_host_pathlist_tmp2=`cygpath -w -p "$func_to_host_pathlist_tmp1"` 3075698f425bSmrg func_to_host_pathlist_result=`echo "$func_to_host_pathlist_tmp2" |\ 3076698f425bSmrg $SED -e "$lt_sed_naive_backslashify"` 3077698f425bSmrg ;; 3078698f425bSmrg * ) 3079698f425bSmrg # unfortunately, winepath doesn't convert pathlists 3080698f425bSmrg func_to_host_pathlist_result="" 3081698f425bSmrg func_to_host_pathlist_oldIFS=$IFS 3082698f425bSmrg IFS=: 3083698f425bSmrg for func_to_host_pathlist_f in $func_to_host_pathlist_tmp1 ; do 3084698f425bSmrg IFS=$func_to_host_pathlist_oldIFS 3085698f425bSmrg if test -n "$func_to_host_pathlist_f" ; then 3086698f425bSmrg func_to_host_path "$func_to_host_pathlist_f" 3087698f425bSmrg if test -n "$func_to_host_path_result" ; then 3088698f425bSmrg if test -z "$func_to_host_pathlist_result" ; then 3089698f425bSmrg func_to_host_pathlist_result="$func_to_host_path_result" 3090698f425bSmrg else 3091698f425bSmrg func_to_host_pathlist_result="$func_to_host_pathlist_result;$func_to_host_path_result" 3092698f425bSmrg fi 3093698f425bSmrg fi 3094698f425bSmrg fi 3095698f425bSmrg IFS=: 3096698f425bSmrg done 3097698f425bSmrg IFS=$func_to_host_pathlist_oldIFS 3098698f425bSmrg ;; 3099698f425bSmrg esac 3100698f425bSmrg if test -z "$func_to_host_pathlist_result" ; then 3101698f425bSmrg func_error "Could not determine the host path(s) corresponding to" 3102698f425bSmrg func_error " '$1'" 3103698f425bSmrg func_error "Continuing, but uninstalled executables may not work." 3104698f425bSmrg # Fallback. This may break if $1 contains DOS-style drive 3105698f425bSmrg # specifications. The fix is not to complicate the expression 3106698f425bSmrg # below, but for the user to provide a working wine installation 3107698f425bSmrg # with winepath so that path translation in the cross-to-mingw 3108698f425bSmrg # case works properly. 3109698f425bSmrg lt_replace_pathsep_nix_to_dos="s|:|;|g" 3110698f425bSmrg func_to_host_pathlist_result=`echo "$func_to_host_pathlist_tmp1" |\ 3111698f425bSmrg $SED -e "$lt_replace_pathsep_nix_to_dos"` 3112698f425bSmrg fi 3113698f425bSmrg # Now, add the leading and trailing path separators back 3114698f425bSmrg case "$1" in 3115698f425bSmrg :* ) func_to_host_pathlist_result=";$func_to_host_pathlist_result" 3116698f425bSmrg ;; 3117698f425bSmrg esac 3118698f425bSmrg case "$1" in 3119698f425bSmrg *: ) func_to_host_pathlist_result="$func_to_host_pathlist_result;" 3120698f425bSmrg ;; 3121698f425bSmrg esac 3122698f425bSmrg ;; 3123698f425bSmrg esac 3124698f425bSmrg fi 3125698f425bSmrg} 3126698f425bSmrg# end: func_to_host_pathlist 3127266e564dSmrg 3128698f425bSmrg# func_emit_cwrapperexe_src 3129698f425bSmrg# emit the source code for a wrapper executable on stdout 3130698f425bSmrg# Must ONLY be called from within func_mode_link because 3131698f425bSmrg# it depends on a number of variable set therein. 3132698f425bSmrgfunc_emit_cwrapperexe_src () 3133698f425bSmrg{ 3134698f425bSmrg cat <<EOF 3135266e564dSmrg 3136698f425bSmrg/* $cwrappersource - temporary wrapper executable for $objdir/$outputname 3137698f425bSmrg Generated by $PROGRAM (GNU $PACKAGE$TIMESTAMP) $VERSION 3138266e564dSmrg 3139698f425bSmrg The $output program cannot be directly executed until all the libtool 3140698f425bSmrg libraries that it depends on are installed. 3141266e564dSmrg 3142698f425bSmrg This wrapper executable should never be moved out of the build directory. 3143698f425bSmrg If it is, it will not operate correctly. 3144266e564dSmrg 3145698f425bSmrg Currently, it simply execs the wrapper *script* "$SHELL $output", 3146698f425bSmrg but could eventually absorb all of the scripts functionality and 3147698f425bSmrg exec $objdir/$outputname directly. 3148698f425bSmrg*/ 3149698f425bSmrgEOF 3150698f425bSmrg cat <<"EOF" 3151698f425bSmrg#include <stdio.h> 3152698f425bSmrg#include <stdlib.h> 3153698f425bSmrg#ifdef _MSC_VER 3154698f425bSmrg# include <direct.h> 3155698f425bSmrg# include <process.h> 3156698f425bSmrg# include <io.h> 3157698f425bSmrg# define setmode _setmode 3158698f425bSmrg#else 3159698f425bSmrg# include <unistd.h> 3160698f425bSmrg# include <stdint.h> 3161698f425bSmrg# ifdef __CYGWIN__ 3162698f425bSmrg# include <io.h> 3163698f425bSmrg# define HAVE_SETENV 3164698f425bSmrg# ifdef __STRICT_ANSI__ 3165698f425bSmrgchar *realpath (const char *, char *); 3166698f425bSmrgint putenv (char *); 3167698f425bSmrgint setenv (const char *, const char *, int); 3168698f425bSmrg# endif 3169698f425bSmrg# endif 3170698f425bSmrg#endif 3171698f425bSmrg#include <malloc.h> 3172698f425bSmrg#include <stdarg.h> 3173698f425bSmrg#include <assert.h> 3174698f425bSmrg#include <string.h> 3175698f425bSmrg#include <ctype.h> 3176698f425bSmrg#include <errno.h> 3177698f425bSmrg#include <fcntl.h> 3178698f425bSmrg#include <sys/stat.h> 3179266e564dSmrg 3180698f425bSmrg#if defined(PATH_MAX) 3181698f425bSmrg# define LT_PATHMAX PATH_MAX 3182698f425bSmrg#elif defined(MAXPATHLEN) 3183698f425bSmrg# define LT_PATHMAX MAXPATHLEN 3184698f425bSmrg#else 3185698f425bSmrg# define LT_PATHMAX 1024 3186698f425bSmrg#endif 3187266e564dSmrg 3188698f425bSmrg#ifndef S_IXOTH 3189698f425bSmrg# define S_IXOTH 0 3190698f425bSmrg#endif 3191698f425bSmrg#ifndef S_IXGRP 3192698f425bSmrg# define S_IXGRP 0 3193698f425bSmrg#endif 3194266e564dSmrg 3195698f425bSmrg#ifdef _MSC_VER 3196698f425bSmrg# define S_IXUSR _S_IEXEC 3197698f425bSmrg# define stat _stat 3198698f425bSmrg# ifndef _INTPTR_T_DEFINED 3199698f425bSmrg# define intptr_t int 3200698f425bSmrg# endif 3201698f425bSmrg#endif 3202266e564dSmrg 3203698f425bSmrg#ifndef DIR_SEPARATOR 3204698f425bSmrg# define DIR_SEPARATOR '/' 3205698f425bSmrg# define PATH_SEPARATOR ':' 3206698f425bSmrg#endif 3207266e564dSmrg 3208698f425bSmrg#if defined (_WIN32) || defined (__MSDOS__) || defined (__DJGPP__) || \ 3209698f425bSmrg defined (__OS2__) 3210698f425bSmrg# define HAVE_DOS_BASED_FILE_SYSTEM 3211698f425bSmrg# define FOPEN_WB "wb" 3212698f425bSmrg# ifndef DIR_SEPARATOR_2 3213698f425bSmrg# define DIR_SEPARATOR_2 '\\' 3214698f425bSmrg# endif 3215698f425bSmrg# ifndef PATH_SEPARATOR_2 3216698f425bSmrg# define PATH_SEPARATOR_2 ';' 3217698f425bSmrg# endif 3218698f425bSmrg#endif 3219266e564dSmrg 3220698f425bSmrg#ifndef DIR_SEPARATOR_2 3221698f425bSmrg# define IS_DIR_SEPARATOR(ch) ((ch) == DIR_SEPARATOR) 3222698f425bSmrg#else /* DIR_SEPARATOR_2 */ 3223698f425bSmrg# define IS_DIR_SEPARATOR(ch) \ 3224698f425bSmrg (((ch) == DIR_SEPARATOR) || ((ch) == DIR_SEPARATOR_2)) 3225698f425bSmrg#endif /* DIR_SEPARATOR_2 */ 3226266e564dSmrg 3227698f425bSmrg#ifndef PATH_SEPARATOR_2 3228698f425bSmrg# define IS_PATH_SEPARATOR(ch) ((ch) == PATH_SEPARATOR) 3229698f425bSmrg#else /* PATH_SEPARATOR_2 */ 3230698f425bSmrg# define IS_PATH_SEPARATOR(ch) ((ch) == PATH_SEPARATOR_2) 3231698f425bSmrg#endif /* PATH_SEPARATOR_2 */ 3232266e564dSmrg 3233698f425bSmrg#ifdef __CYGWIN__ 3234698f425bSmrg# define FOPEN_WB "wb" 3235698f425bSmrg#endif 3236266e564dSmrg 3237698f425bSmrg#ifndef FOPEN_WB 3238698f425bSmrg# define FOPEN_WB "w" 3239698f425bSmrg#endif 3240698f425bSmrg#ifndef _O_BINARY 3241698f425bSmrg# define _O_BINARY 0 3242698f425bSmrg#endif 3243266e564dSmrg 3244698f425bSmrg#define XMALLOC(type, num) ((type *) xmalloc ((num) * sizeof(type))) 3245698f425bSmrg#define XFREE(stale) do { \ 3246698f425bSmrg if (stale) { free ((void *) stale); stale = 0; } \ 3247698f425bSmrg} while (0) 3248266e564dSmrg 3249698f425bSmrg#undef LTWRAPPER_DEBUGPRINTF 3250698f425bSmrg#if defined DEBUGWRAPPER 3251698f425bSmrg# define LTWRAPPER_DEBUGPRINTF(args) ltwrapper_debugprintf args 3252698f425bSmrgstatic void 3253698f425bSmrgltwrapper_debugprintf (const char *fmt, ...) 3254698f425bSmrg{ 3255698f425bSmrg va_list args; 3256698f425bSmrg va_start (args, fmt); 3257698f425bSmrg (void) vfprintf (stderr, fmt, args); 3258698f425bSmrg va_end (args); 3259698f425bSmrg} 3260698f425bSmrg#else 3261698f425bSmrg# define LTWRAPPER_DEBUGPRINTF(args) 3262698f425bSmrg#endif 3263266e564dSmrg 3264698f425bSmrgconst char *program_name = NULL; 3265266e564dSmrg 3266698f425bSmrgvoid *xmalloc (size_t num); 3267698f425bSmrgchar *xstrdup (const char *string); 3268698f425bSmrgconst char *base_name (const char *name); 3269698f425bSmrgchar *find_executable (const char *wrapper); 3270698f425bSmrgchar *chase_symlinks (const char *pathspec); 3271698f425bSmrgint make_executable (const char *path); 3272698f425bSmrgint check_executable (const char *path); 3273698f425bSmrgchar *strendzap (char *str, const char *pat); 3274698f425bSmrgvoid lt_fatal (const char *message, ...); 3275698f425bSmrgvoid lt_setenv (const char *name, const char *value); 3276698f425bSmrgchar *lt_extend_str (const char *orig_value, const char *add, int to_end); 3277698f425bSmrgvoid lt_opt_process_env_set (const char *arg); 3278698f425bSmrgvoid lt_opt_process_env_prepend (const char *arg); 3279698f425bSmrgvoid lt_opt_process_env_append (const char *arg); 3280698f425bSmrgint lt_split_name_value (const char *arg, char** name, char** value); 3281698f425bSmrgvoid lt_update_exe_path (const char *name, const char *value); 3282698f425bSmrgvoid lt_update_lib_path (const char *name, const char *value); 3283698f425bSmrg 3284698f425bSmrgstatic const char *script_text_part1 = 3285698f425bSmrgEOF 3286266e564dSmrg 3287698f425bSmrg func_emit_wrapper_part1 yes | 3288698f425bSmrg $SED -e 's/\([\\"]\)/\\\1/g' \ 3289698f425bSmrg -e 's/^/ "/' -e 's/$/\\n"/' 3290698f425bSmrg echo ";" 3291698f425bSmrg cat <<EOF 3292266e564dSmrg 3293698f425bSmrgstatic const char *script_text_part2 = 3294698f425bSmrgEOF 3295698f425bSmrg func_emit_wrapper_part2 yes | 3296698f425bSmrg $SED -e 's/\([\\"]\)/\\\1/g' \ 3297698f425bSmrg -e 's/^/ "/' -e 's/$/\\n"/' 3298698f425bSmrg echo ";" 3299698f425bSmrg 3300698f425bSmrg cat <<EOF 3301698f425bSmrgconst char * MAGIC_EXE = "$magic_exe"; 3302698f425bSmrgconst char * LIB_PATH_VARNAME = "$shlibpath_var"; 3303698f425bSmrgEOF 3304266e564dSmrg 3305698f425bSmrg if test "$shlibpath_overrides_runpath" = yes && test -n "$shlibpath_var" && test -n "$temp_rpath"; then 3306698f425bSmrg func_to_host_pathlist "$temp_rpath" 3307698f425bSmrg cat <<EOF 3308698f425bSmrgconst char * LIB_PATH_VALUE = "$func_to_host_pathlist_result"; 3309698f425bSmrgEOF 3310698f425bSmrg else 3311698f425bSmrg cat <<"EOF" 3312698f425bSmrgconst char * LIB_PATH_VALUE = ""; 3313698f425bSmrgEOF 3314266e564dSmrg fi 3315266e564dSmrg 3316698f425bSmrg if test -n "$dllsearchpath"; then 3317698f425bSmrg func_to_host_pathlist "$dllsearchpath:" 3318698f425bSmrg cat <<EOF 3319698f425bSmrgconst char * EXE_PATH_VARNAME = "PATH"; 3320698f425bSmrgconst char * EXE_PATH_VALUE = "$func_to_host_pathlist_result"; 3321266e564dSmrgEOF 3322266e564dSmrg else 3323698f425bSmrg cat <<"EOF" 3324698f425bSmrgconst char * EXE_PATH_VARNAME = ""; 3325698f425bSmrgconst char * EXE_PATH_VALUE = ""; 3326698f425bSmrgEOF 3327266e564dSmrg fi 3328698f425bSmrg 3329698f425bSmrg if test "$fast_install" = yes; then 3330698f425bSmrg cat <<EOF 3331698f425bSmrgconst char * TARGET_PROGRAM_NAME = "lt-$outputname"; /* hopefully, no .exe */ 3332698f425bSmrgEOF 3333266e564dSmrg else 3334698f425bSmrg cat <<EOF 3335698f425bSmrgconst char * TARGET_PROGRAM_NAME = "$outputname"; /* hopefully, no .exe */ 3336698f425bSmrgEOF 3337266e564dSmrg fi 3338266e564dSmrg 3339266e564dSmrg 3340698f425bSmrg cat <<"EOF" 3341266e564dSmrg 3342698f425bSmrg#define LTWRAPPER_OPTION_PREFIX "--lt-" 3343698f425bSmrg#define LTWRAPPER_OPTION_PREFIX_LENGTH 5 3344266e564dSmrg 3345698f425bSmrgstatic const size_t opt_prefix_len = LTWRAPPER_OPTION_PREFIX_LENGTH; 3346698f425bSmrgstatic const char *ltwrapper_option_prefix = LTWRAPPER_OPTION_PREFIX; 3347266e564dSmrg 3348698f425bSmrgstatic const char *dumpscript_opt = LTWRAPPER_OPTION_PREFIX "dump-script"; 3349266e564dSmrg 3350698f425bSmrgstatic const size_t env_set_opt_len = LTWRAPPER_OPTION_PREFIX_LENGTH + 7; 3351698f425bSmrgstatic const char *env_set_opt = LTWRAPPER_OPTION_PREFIX "env-set"; 3352698f425bSmrg /* argument is putenv-style "foo=bar", value of foo is set to bar */ 3353266e564dSmrg 3354698f425bSmrgstatic const size_t env_prepend_opt_len = LTWRAPPER_OPTION_PREFIX_LENGTH + 11; 3355698f425bSmrgstatic const char *env_prepend_opt = LTWRAPPER_OPTION_PREFIX "env-prepend"; 3356698f425bSmrg /* argument is putenv-style "foo=bar", new value of foo is bar${foo} */ 3357266e564dSmrg 3358698f425bSmrgstatic const size_t env_append_opt_len = LTWRAPPER_OPTION_PREFIX_LENGTH + 10; 3359698f425bSmrgstatic const char *env_append_opt = LTWRAPPER_OPTION_PREFIX "env-append"; 3360698f425bSmrg /* argument is putenv-style "foo=bar", new value of foo is ${foo}bar */ 3361266e564dSmrg 3362698f425bSmrgint 3363698f425bSmrgmain (int argc, char *argv[]) 3364698f425bSmrg{ 3365698f425bSmrg char **newargz; 3366698f425bSmrg int newargc; 3367698f425bSmrg char *tmp_pathspec; 3368698f425bSmrg char *actual_cwrapper_path; 3369698f425bSmrg char *actual_cwrapper_name; 3370698f425bSmrg char *target_name; 3371698f425bSmrg char *lt_argv_zero; 3372698f425bSmrg intptr_t rval = 127; 3373266e564dSmrg 3374698f425bSmrg int i; 3375266e564dSmrg 3376698f425bSmrg program_name = (char *) xstrdup (base_name (argv[0])); 3377698f425bSmrg LTWRAPPER_DEBUGPRINTF (("(main) argv[0] : %s\n", argv[0])); 3378698f425bSmrg LTWRAPPER_DEBUGPRINTF (("(main) program_name : %s\n", program_name)); 3379266e564dSmrg 3380698f425bSmrg /* very simple arg parsing; don't want to rely on getopt */ 3381698f425bSmrg for (i = 1; i < argc; i++) 3382698f425bSmrg { 3383698f425bSmrg if (strcmp (argv[i], dumpscript_opt) == 0) 3384698f425bSmrg { 3385698f425bSmrgEOF 3386698f425bSmrg case "$host" in 3387698f425bSmrg *mingw* | *cygwin* ) 3388698f425bSmrg # make stdout use "unix" line endings 3389698f425bSmrg echo " setmode(1,_O_BINARY);" 3390698f425bSmrg ;; 3391698f425bSmrg esac 3392266e564dSmrg 3393698f425bSmrg cat <<"EOF" 3394698f425bSmrg printf ("%s", script_text_part1); 3395698f425bSmrg printf ("%s", script_text_part2); 3396698f425bSmrg return 0; 3397698f425bSmrg } 3398698f425bSmrg } 3399266e564dSmrg 3400698f425bSmrg newargz = XMALLOC (char *, argc + 1); 3401698f425bSmrg tmp_pathspec = find_executable (argv[0]); 3402698f425bSmrg if (tmp_pathspec == NULL) 3403698f425bSmrg lt_fatal ("Couldn't find %s", argv[0]); 3404698f425bSmrg LTWRAPPER_DEBUGPRINTF (("(main) found exe (before symlink chase) at : %s\n", 3405698f425bSmrg tmp_pathspec)); 3406698f425bSmrg 3407698f425bSmrg actual_cwrapper_path = chase_symlinks (tmp_pathspec); 3408698f425bSmrg LTWRAPPER_DEBUGPRINTF (("(main) found exe (after symlink chase) at : %s\n", 3409698f425bSmrg actual_cwrapper_path)); 3410698f425bSmrg XFREE (tmp_pathspec); 3411698f425bSmrg 3412698f425bSmrg actual_cwrapper_name = xstrdup( base_name (actual_cwrapper_path)); 3413698f425bSmrg strendzap (actual_cwrapper_path, actual_cwrapper_name); 3414698f425bSmrg 3415698f425bSmrg /* wrapper name transforms */ 3416698f425bSmrg strendzap (actual_cwrapper_name, ".exe"); 3417698f425bSmrg tmp_pathspec = lt_extend_str (actual_cwrapper_name, ".exe", 1); 3418698f425bSmrg XFREE (actual_cwrapper_name); 3419698f425bSmrg actual_cwrapper_name = tmp_pathspec; 3420698f425bSmrg tmp_pathspec = 0; 3421698f425bSmrg 3422698f425bSmrg /* target_name transforms -- use actual target program name; might have lt- prefix */ 3423698f425bSmrg target_name = xstrdup (base_name (TARGET_PROGRAM_NAME)); 3424698f425bSmrg strendzap (target_name, ".exe"); 3425698f425bSmrg tmp_pathspec = lt_extend_str (target_name, ".exe", 1); 3426698f425bSmrg XFREE (target_name); 3427698f425bSmrg target_name = tmp_pathspec; 3428698f425bSmrg tmp_pathspec = 0; 3429698f425bSmrg 3430698f425bSmrg LTWRAPPER_DEBUGPRINTF (("(main) libtool target name: %s\n", 3431698f425bSmrg target_name)); 3432698f425bSmrgEOF 3433266e564dSmrg 3434698f425bSmrg cat <<EOF 3435698f425bSmrg newargz[0] = 3436698f425bSmrg XMALLOC (char, (strlen (actual_cwrapper_path) + 3437698f425bSmrg strlen ("$objdir") + 1 + strlen (actual_cwrapper_name) + 1)); 3438698f425bSmrg strcpy (newargz[0], actual_cwrapper_path); 3439698f425bSmrg strcat (newargz[0], "$objdir"); 3440698f425bSmrg strcat (newargz[0], "/"); 3441698f425bSmrgEOF 3442266e564dSmrg 3443698f425bSmrg cat <<"EOF" 3444698f425bSmrg /* stop here, and copy so we don't have to do this twice */ 3445698f425bSmrg tmp_pathspec = xstrdup (newargz[0]); 3446266e564dSmrg 3447698f425bSmrg /* do NOT want the lt- prefix here, so use actual_cwrapper_name */ 3448698f425bSmrg strcat (newargz[0], actual_cwrapper_name); 3449266e564dSmrg 3450698f425bSmrg /* DO want the lt- prefix here if it exists, so use target_name */ 3451698f425bSmrg lt_argv_zero = lt_extend_str (tmp_pathspec, target_name, 1); 3452698f425bSmrg XFREE (tmp_pathspec); 3453698f425bSmrg tmp_pathspec = NULL; 3454698f425bSmrgEOF 3455266e564dSmrg 3456698f425bSmrg case $host_os in 3457698f425bSmrg mingw*) 3458698f425bSmrg cat <<"EOF" 3459698f425bSmrg { 3460698f425bSmrg char* p; 3461698f425bSmrg while ((p = strchr (newargz[0], '\\')) != NULL) 3462698f425bSmrg { 3463698f425bSmrg *p = '/'; 3464698f425bSmrg } 3465698f425bSmrg while ((p = strchr (lt_argv_zero, '\\')) != NULL) 3466698f425bSmrg { 3467698f425bSmrg *p = '/'; 3468698f425bSmrg } 3469698f425bSmrg } 3470698f425bSmrgEOF 3471698f425bSmrg ;; 3472698f425bSmrg esac 3473266e564dSmrg 3474698f425bSmrg cat <<"EOF" 3475698f425bSmrg XFREE (target_name); 3476698f425bSmrg XFREE (actual_cwrapper_path); 3477698f425bSmrg XFREE (actual_cwrapper_name); 3478266e564dSmrg 3479698f425bSmrg lt_setenv ("BIN_SH", "xpg4"); /* for Tru64 */ 3480698f425bSmrg lt_setenv ("DUALCASE", "1"); /* for MSK sh */ 3481698f425bSmrg lt_update_lib_path (LIB_PATH_VARNAME, LIB_PATH_VALUE); 3482698f425bSmrg lt_update_exe_path (EXE_PATH_VARNAME, EXE_PATH_VALUE); 3483266e564dSmrg 3484698f425bSmrg newargc=0; 3485698f425bSmrg for (i = 1; i < argc; i++) 3486698f425bSmrg { 3487698f425bSmrg if (strncmp (argv[i], env_set_opt, env_set_opt_len) == 0) 3488698f425bSmrg { 3489698f425bSmrg if (argv[i][env_set_opt_len] == '=') 3490698f425bSmrg { 3491698f425bSmrg const char *p = argv[i] + env_set_opt_len + 1; 3492698f425bSmrg lt_opt_process_env_set (p); 3493698f425bSmrg } 3494698f425bSmrg else if (argv[i][env_set_opt_len] == '\0' && i + 1 < argc) 3495698f425bSmrg { 3496698f425bSmrg lt_opt_process_env_set (argv[++i]); /* don't copy */ 3497698f425bSmrg } 3498698f425bSmrg else 3499698f425bSmrg lt_fatal ("%s missing required argument", env_set_opt); 3500698f425bSmrg continue; 3501698f425bSmrg } 3502698f425bSmrg if (strncmp (argv[i], env_prepend_opt, env_prepend_opt_len) == 0) 3503698f425bSmrg { 3504698f425bSmrg if (argv[i][env_prepend_opt_len] == '=') 3505698f425bSmrg { 3506698f425bSmrg const char *p = argv[i] + env_prepend_opt_len + 1; 3507698f425bSmrg lt_opt_process_env_prepend (p); 3508698f425bSmrg } 3509698f425bSmrg else if (argv[i][env_prepend_opt_len] == '\0' && i + 1 < argc) 3510698f425bSmrg { 3511698f425bSmrg lt_opt_process_env_prepend (argv[++i]); /* don't copy */ 3512698f425bSmrg } 3513698f425bSmrg else 3514698f425bSmrg lt_fatal ("%s missing required argument", env_prepend_opt); 3515698f425bSmrg continue; 3516698f425bSmrg } 3517698f425bSmrg if (strncmp (argv[i], env_append_opt, env_append_opt_len) == 0) 3518698f425bSmrg { 3519698f425bSmrg if (argv[i][env_append_opt_len] == '=') 3520698f425bSmrg { 3521698f425bSmrg const char *p = argv[i] + env_append_opt_len + 1; 3522698f425bSmrg lt_opt_process_env_append (p); 3523698f425bSmrg } 3524698f425bSmrg else if (argv[i][env_append_opt_len] == '\0' && i + 1 < argc) 3525698f425bSmrg { 3526698f425bSmrg lt_opt_process_env_append (argv[++i]); /* don't copy */ 3527698f425bSmrg } 3528698f425bSmrg else 3529698f425bSmrg lt_fatal ("%s missing required argument", env_append_opt); 3530698f425bSmrg continue; 3531698f425bSmrg } 3532698f425bSmrg if (strncmp (argv[i], ltwrapper_option_prefix, opt_prefix_len) == 0) 3533698f425bSmrg { 3534698f425bSmrg /* however, if there is an option in the LTWRAPPER_OPTION_PREFIX 3535698f425bSmrg namespace, but it is not one of the ones we know about and 3536698f425bSmrg have already dealt with, above (inluding dump-script), then 3537698f425bSmrg report an error. Otherwise, targets might begin to believe 3538698f425bSmrg they are allowed to use options in the LTWRAPPER_OPTION_PREFIX 3539698f425bSmrg namespace. The first time any user complains about this, we'll 3540698f425bSmrg need to make LTWRAPPER_OPTION_PREFIX a configure-time option 3541698f425bSmrg or a configure.ac-settable value. 3542698f425bSmrg */ 3543698f425bSmrg lt_fatal ("Unrecognized option in %s namespace: '%s'", 3544698f425bSmrg ltwrapper_option_prefix, argv[i]); 3545698f425bSmrg } 3546698f425bSmrg /* otherwise ... */ 3547698f425bSmrg newargz[++newargc] = xstrdup (argv[i]); 3548698f425bSmrg } 3549698f425bSmrg newargz[++newargc] = NULL; 3550266e564dSmrg 3551698f425bSmrg LTWRAPPER_DEBUGPRINTF (("(main) lt_argv_zero : %s\n", (lt_argv_zero ? lt_argv_zero : "<NULL>"))); 3552698f425bSmrg for (i = 0; i < newargc; i++) 3553698f425bSmrg { 3554698f425bSmrg LTWRAPPER_DEBUGPRINTF (("(main) newargz[%d] : %s\n", i, (newargz[i] ? newargz[i] : "<NULL>"))); 3555698f425bSmrg } 3556266e564dSmrg 3557698f425bSmrgEOF 3558266e564dSmrg 3559698f425bSmrg case $host_os in 3560698f425bSmrg mingw*) 3561698f425bSmrg cat <<"EOF" 3562698f425bSmrg /* execv doesn't actually work on mingw as expected on unix */ 3563698f425bSmrg rval = _spawnv (_P_WAIT, lt_argv_zero, (const char * const *) newargz); 3564698f425bSmrg if (rval == -1) 3565698f425bSmrg { 3566698f425bSmrg /* failed to start process */ 3567698f425bSmrg LTWRAPPER_DEBUGPRINTF (("(main) failed to launch target \"%s\": errno = %d\n", lt_argv_zero, errno)); 3568698f425bSmrg return 127; 3569698f425bSmrg } 3570698f425bSmrg return rval; 3571698f425bSmrgEOF 3572698f425bSmrg ;; 3573698f425bSmrg *) 3574698f425bSmrg cat <<"EOF" 3575698f425bSmrg execv (lt_argv_zero, newargz); 3576698f425bSmrg return rval; /* =127, but avoids unused variable warning */ 3577698f425bSmrgEOF 3578698f425bSmrg ;; 3579698f425bSmrg esac 3580266e564dSmrg 3581698f425bSmrg cat <<"EOF" 3582698f425bSmrg} 3583266e564dSmrg 3584698f425bSmrgvoid * 3585698f425bSmrgxmalloc (size_t num) 3586698f425bSmrg{ 3587698f425bSmrg void *p = (void *) malloc (num); 3588698f425bSmrg if (!p) 3589698f425bSmrg lt_fatal ("Memory exhausted"); 3590266e564dSmrg 3591698f425bSmrg return p; 3592698f425bSmrg} 3593266e564dSmrg 3594698f425bSmrgchar * 3595698f425bSmrgxstrdup (const char *string) 3596698f425bSmrg{ 3597698f425bSmrg return string ? strcpy ((char *) xmalloc (strlen (string) + 1), 3598698f425bSmrg string) : NULL; 3599698f425bSmrg} 3600266e564dSmrg 3601698f425bSmrgconst char * 3602698f425bSmrgbase_name (const char *name) 3603698f425bSmrg{ 3604698f425bSmrg const char *base; 3605266e564dSmrg 3606698f425bSmrg#if defined (HAVE_DOS_BASED_FILE_SYSTEM) 3607698f425bSmrg /* Skip over the disk name in MSDOS pathnames. */ 3608698f425bSmrg if (isalpha ((unsigned char) name[0]) && name[1] == ':') 3609698f425bSmrg name += 2; 3610698f425bSmrg#endif 3611266e564dSmrg 3612698f425bSmrg for (base = name; *name; name++) 3613698f425bSmrg if (IS_DIR_SEPARATOR (*name)) 3614698f425bSmrg base = name + 1; 3615698f425bSmrg return base; 3616698f425bSmrg} 3617266e564dSmrg 3618698f425bSmrgint 3619698f425bSmrgcheck_executable (const char *path) 3620698f425bSmrg{ 3621698f425bSmrg struct stat st; 3622266e564dSmrg 3623698f425bSmrg LTWRAPPER_DEBUGPRINTF (("(check_executable) : %s\n", 3624698f425bSmrg path ? (*path ? path : "EMPTY!") : "NULL!")); 3625698f425bSmrg if ((!path) || (!*path)) 3626698f425bSmrg return 0; 3627266e564dSmrg 3628698f425bSmrg if ((stat (path, &st) >= 0) 3629698f425bSmrg && (st.st_mode & (S_IXUSR | S_IXGRP | S_IXOTH))) 3630698f425bSmrg return 1; 3631698f425bSmrg else 3632698f425bSmrg return 0; 3633698f425bSmrg} 3634266e564dSmrg 3635698f425bSmrgint 3636698f425bSmrgmake_executable (const char *path) 3637698f425bSmrg{ 3638698f425bSmrg int rval = 0; 3639698f425bSmrg struct stat st; 3640266e564dSmrg 3641698f425bSmrg LTWRAPPER_DEBUGPRINTF (("(make_executable) : %s\n", 3642698f425bSmrg path ? (*path ? path : "EMPTY!") : "NULL!")); 3643698f425bSmrg if ((!path) || (!*path)) 3644698f425bSmrg return 0; 3645266e564dSmrg 3646698f425bSmrg if (stat (path, &st) >= 0) 3647698f425bSmrg { 3648698f425bSmrg rval = chmod (path, st.st_mode | S_IXOTH | S_IXGRP | S_IXUSR); 3649698f425bSmrg } 3650698f425bSmrg return rval; 3651698f425bSmrg} 3652266e564dSmrg 3653698f425bSmrg/* Searches for the full path of the wrapper. Returns 3654698f425bSmrg newly allocated full path name if found, NULL otherwise 3655698f425bSmrg Does not chase symlinks, even on platforms that support them. 3656698f425bSmrg*/ 3657698f425bSmrgchar * 3658698f425bSmrgfind_executable (const char *wrapper) 3659698f425bSmrg{ 3660698f425bSmrg int has_slash = 0; 3661698f425bSmrg const char *p; 3662698f425bSmrg const char *p_next; 3663698f425bSmrg /* static buffer for getcwd */ 3664698f425bSmrg char tmp[LT_PATHMAX + 1]; 3665698f425bSmrg int tmp_len; 3666698f425bSmrg char *concat_name; 3667266e564dSmrg 3668698f425bSmrg LTWRAPPER_DEBUGPRINTF (("(find_executable) : %s\n", 3669698f425bSmrg wrapper ? (*wrapper ? wrapper : "EMPTY!") : "NULL!")); 3670266e564dSmrg 3671698f425bSmrg if ((wrapper == NULL) || (*wrapper == '\0')) 3672698f425bSmrg return NULL; 3673266e564dSmrg 3674698f425bSmrg /* Absolute path? */ 3675698f425bSmrg#if defined (HAVE_DOS_BASED_FILE_SYSTEM) 3676698f425bSmrg if (isalpha ((unsigned char) wrapper[0]) && wrapper[1] == ':') 3677698f425bSmrg { 3678698f425bSmrg concat_name = xstrdup (wrapper); 3679698f425bSmrg if (check_executable (concat_name)) 3680698f425bSmrg return concat_name; 3681698f425bSmrg XFREE (concat_name); 3682698f425bSmrg } 3683698f425bSmrg else 3684698f425bSmrg { 3685698f425bSmrg#endif 3686698f425bSmrg if (IS_DIR_SEPARATOR (wrapper[0])) 3687698f425bSmrg { 3688698f425bSmrg concat_name = xstrdup (wrapper); 3689698f425bSmrg if (check_executable (concat_name)) 3690698f425bSmrg return concat_name; 3691698f425bSmrg XFREE (concat_name); 3692698f425bSmrg } 3693698f425bSmrg#if defined (HAVE_DOS_BASED_FILE_SYSTEM) 3694698f425bSmrg } 3695698f425bSmrg#endif 3696266e564dSmrg 3697698f425bSmrg for (p = wrapper; *p; p++) 3698698f425bSmrg if (*p == '/') 3699698f425bSmrg { 3700698f425bSmrg has_slash = 1; 3701698f425bSmrg break; 3702698f425bSmrg } 3703698f425bSmrg if (!has_slash) 3704698f425bSmrg { 3705698f425bSmrg /* no slashes; search PATH */ 3706698f425bSmrg const char *path = getenv ("PATH"); 3707698f425bSmrg if (path != NULL) 3708698f425bSmrg { 3709698f425bSmrg for (p = path; *p; p = p_next) 3710698f425bSmrg { 3711698f425bSmrg const char *q; 3712698f425bSmrg size_t p_len; 3713698f425bSmrg for (q = p; *q; q++) 3714698f425bSmrg if (IS_PATH_SEPARATOR (*q)) 3715698f425bSmrg break; 3716698f425bSmrg p_len = q - p; 3717698f425bSmrg p_next = (*q == '\0' ? q : q + 1); 3718698f425bSmrg if (p_len == 0) 3719698f425bSmrg { 3720698f425bSmrg /* empty path: current directory */ 3721698f425bSmrg if (getcwd (tmp, LT_PATHMAX) == NULL) 3722698f425bSmrg lt_fatal ("getcwd failed"); 3723698f425bSmrg tmp_len = strlen (tmp); 3724698f425bSmrg concat_name = 3725698f425bSmrg XMALLOC (char, tmp_len + 1 + strlen (wrapper) + 1); 3726698f425bSmrg memcpy (concat_name, tmp, tmp_len); 3727698f425bSmrg concat_name[tmp_len] = '/'; 3728698f425bSmrg strcpy (concat_name + tmp_len + 1, wrapper); 3729698f425bSmrg } 3730698f425bSmrg else 3731698f425bSmrg { 3732698f425bSmrg concat_name = 3733698f425bSmrg XMALLOC (char, p_len + 1 + strlen (wrapper) + 1); 3734698f425bSmrg memcpy (concat_name, p, p_len); 3735698f425bSmrg concat_name[p_len] = '/'; 3736698f425bSmrg strcpy (concat_name + p_len + 1, wrapper); 3737698f425bSmrg } 3738698f425bSmrg if (check_executable (concat_name)) 3739698f425bSmrg return concat_name; 3740698f425bSmrg XFREE (concat_name); 3741698f425bSmrg } 3742698f425bSmrg } 3743698f425bSmrg /* not found in PATH; assume curdir */ 3744698f425bSmrg } 3745698f425bSmrg /* Relative path | not found in path: prepend cwd */ 3746698f425bSmrg if (getcwd (tmp, LT_PATHMAX) == NULL) 3747698f425bSmrg lt_fatal ("getcwd failed"); 3748698f425bSmrg tmp_len = strlen (tmp); 3749698f425bSmrg concat_name = XMALLOC (char, tmp_len + 1 + strlen (wrapper) + 1); 3750698f425bSmrg memcpy (concat_name, tmp, tmp_len); 3751698f425bSmrg concat_name[tmp_len] = '/'; 3752698f425bSmrg strcpy (concat_name + tmp_len + 1, wrapper); 3753266e564dSmrg 3754698f425bSmrg if (check_executable (concat_name)) 3755698f425bSmrg return concat_name; 3756698f425bSmrg XFREE (concat_name); 3757698f425bSmrg return NULL; 3758698f425bSmrg} 3759266e564dSmrg 3760698f425bSmrgchar * 3761698f425bSmrgchase_symlinks (const char *pathspec) 3762698f425bSmrg{ 3763698f425bSmrg#ifndef S_ISLNK 3764698f425bSmrg return xstrdup (pathspec); 3765698f425bSmrg#else 3766698f425bSmrg char buf[LT_PATHMAX]; 3767698f425bSmrg struct stat s; 3768698f425bSmrg char *tmp_pathspec = xstrdup (pathspec); 3769698f425bSmrg char *p; 3770698f425bSmrg int has_symlinks = 0; 3771698f425bSmrg while (strlen (tmp_pathspec) && !has_symlinks) 3772698f425bSmrg { 3773698f425bSmrg LTWRAPPER_DEBUGPRINTF (("checking path component for symlinks: %s\n", 3774698f425bSmrg tmp_pathspec)); 3775698f425bSmrg if (lstat (tmp_pathspec, &s) == 0) 3776698f425bSmrg { 3777698f425bSmrg if (S_ISLNK (s.st_mode) != 0) 3778698f425bSmrg { 3779698f425bSmrg has_symlinks = 1; 3780698f425bSmrg break; 3781698f425bSmrg } 3782266e564dSmrg 3783698f425bSmrg /* search backwards for last DIR_SEPARATOR */ 3784698f425bSmrg p = tmp_pathspec + strlen (tmp_pathspec) - 1; 3785698f425bSmrg while ((p > tmp_pathspec) && (!IS_DIR_SEPARATOR (*p))) 3786698f425bSmrg p--; 3787698f425bSmrg if ((p == tmp_pathspec) && (!IS_DIR_SEPARATOR (*p))) 3788698f425bSmrg { 3789698f425bSmrg /* no more DIR_SEPARATORS left */ 3790698f425bSmrg break; 3791698f425bSmrg } 3792698f425bSmrg *p = '\0'; 3793698f425bSmrg } 3794698f425bSmrg else 3795698f425bSmrg { 3796698f425bSmrg char *errstr = strerror (errno); 3797698f425bSmrg lt_fatal ("Error accessing file %s (%s)", tmp_pathspec, errstr); 3798698f425bSmrg } 3799698f425bSmrg } 3800698f425bSmrg XFREE (tmp_pathspec); 3801266e564dSmrg 3802698f425bSmrg if (!has_symlinks) 3803698f425bSmrg { 3804698f425bSmrg return xstrdup (pathspec); 3805698f425bSmrg } 3806266e564dSmrg 3807698f425bSmrg tmp_pathspec = realpath (pathspec, buf); 3808698f425bSmrg if (tmp_pathspec == 0) 3809698f425bSmrg { 3810698f425bSmrg lt_fatal ("Could not follow symlinks for %s", pathspec); 3811698f425bSmrg } 3812698f425bSmrg return xstrdup (tmp_pathspec); 3813698f425bSmrg#endif 3814698f425bSmrg} 3815266e564dSmrg 3816698f425bSmrgchar * 3817698f425bSmrgstrendzap (char *str, const char *pat) 3818698f425bSmrg{ 3819698f425bSmrg size_t len, patlen; 3820266e564dSmrg 3821698f425bSmrg assert (str != NULL); 3822698f425bSmrg assert (pat != NULL); 3823266e564dSmrg 3824698f425bSmrg len = strlen (str); 3825698f425bSmrg patlen = strlen (pat); 3826266e564dSmrg 3827698f425bSmrg if (patlen <= len) 3828698f425bSmrg { 3829698f425bSmrg str += len - patlen; 3830698f425bSmrg if (strcmp (str, pat) == 0) 3831698f425bSmrg *str = '\0'; 3832698f425bSmrg } 3833698f425bSmrg return str; 3834698f425bSmrg} 3835266e564dSmrg 3836698f425bSmrgstatic void 3837698f425bSmrglt_error_core (int exit_status, const char *mode, 3838698f425bSmrg const char *message, va_list ap) 3839698f425bSmrg{ 3840698f425bSmrg fprintf (stderr, "%s: %s: ", program_name, mode); 3841698f425bSmrg vfprintf (stderr, message, ap); 3842698f425bSmrg fprintf (stderr, ".\n"); 3843266e564dSmrg 3844698f425bSmrg if (exit_status >= 0) 3845698f425bSmrg exit (exit_status); 3846698f425bSmrg} 3847266e564dSmrg 3848698f425bSmrgvoid 3849698f425bSmrglt_fatal (const char *message, ...) 3850698f425bSmrg{ 3851698f425bSmrg va_list ap; 3852698f425bSmrg va_start (ap, message); 3853698f425bSmrg lt_error_core (EXIT_FAILURE, "FATAL", message, ap); 3854698f425bSmrg va_end (ap); 3855698f425bSmrg} 3856266e564dSmrg 3857698f425bSmrgvoid 3858698f425bSmrglt_setenv (const char *name, const char *value) 3859698f425bSmrg{ 3860698f425bSmrg LTWRAPPER_DEBUGPRINTF (("(lt_setenv) setting '%s' to '%s'\n", 3861698f425bSmrg (name ? name : "<NULL>"), 3862698f425bSmrg (value ? value : "<NULL>"))); 3863698f425bSmrg { 3864698f425bSmrg#ifdef HAVE_SETENV 3865698f425bSmrg /* always make a copy, for consistency with !HAVE_SETENV */ 3866698f425bSmrg char *str = xstrdup (value); 3867698f425bSmrg setenv (name, str, 1); 3868698f425bSmrg#else 3869698f425bSmrg int len = strlen (name) + 1 + strlen (value) + 1; 3870698f425bSmrg char *str = XMALLOC (char, len); 3871698f425bSmrg sprintf (str, "%s=%s", name, value); 3872698f425bSmrg if (putenv (str) != EXIT_SUCCESS) 3873698f425bSmrg { 3874698f425bSmrg XFREE (str); 3875698f425bSmrg } 3876698f425bSmrg#endif 3877698f425bSmrg } 3878698f425bSmrg} 3879266e564dSmrg 3880698f425bSmrgchar * 3881698f425bSmrglt_extend_str (const char *orig_value, const char *add, int to_end) 3882698f425bSmrg{ 3883698f425bSmrg char *new_value; 3884698f425bSmrg if (orig_value && *orig_value) 3885698f425bSmrg { 3886698f425bSmrg int orig_value_len = strlen (orig_value); 3887698f425bSmrg int add_len = strlen (add); 3888698f425bSmrg new_value = XMALLOC (char, add_len + orig_value_len + 1); 3889698f425bSmrg if (to_end) 3890698f425bSmrg { 3891698f425bSmrg strcpy (new_value, orig_value); 3892698f425bSmrg strcpy (new_value + orig_value_len, add); 3893698f425bSmrg } 3894698f425bSmrg else 3895698f425bSmrg { 3896698f425bSmrg strcpy (new_value, add); 3897698f425bSmrg strcpy (new_value + add_len, orig_value); 3898698f425bSmrg } 3899698f425bSmrg } 3900698f425bSmrg else 3901698f425bSmrg { 3902698f425bSmrg new_value = xstrdup (add); 3903698f425bSmrg } 3904698f425bSmrg return new_value; 3905698f425bSmrg} 3906266e564dSmrg 3907698f425bSmrgint 3908698f425bSmrglt_split_name_value (const char *arg, char** name, char** value) 3909698f425bSmrg{ 3910698f425bSmrg const char *p; 3911698f425bSmrg int len; 3912698f425bSmrg if (!arg || !*arg) 3913698f425bSmrg return 1; 3914266e564dSmrg 3915698f425bSmrg p = strchr (arg, (int)'='); 3916266e564dSmrg 3917698f425bSmrg if (!p) 3918698f425bSmrg return 1; 3919266e564dSmrg 3920698f425bSmrg *value = xstrdup (++p); 3921266e564dSmrg 3922698f425bSmrg len = strlen (arg) - strlen (*value); 3923698f425bSmrg *name = XMALLOC (char, len); 3924698f425bSmrg strncpy (*name, arg, len-1); 3925698f425bSmrg (*name)[len - 1] = '\0'; 3926266e564dSmrg 3927698f425bSmrg return 0; 3928698f425bSmrg} 3929266e564dSmrg 3930698f425bSmrgvoid 3931698f425bSmrglt_opt_process_env_set (const char *arg) 3932698f425bSmrg{ 3933698f425bSmrg char *name = NULL; 3934698f425bSmrg char *value = NULL; 3935266e564dSmrg 3936698f425bSmrg if (lt_split_name_value (arg, &name, &value) != 0) 3937698f425bSmrg { 3938698f425bSmrg XFREE (name); 3939698f425bSmrg XFREE (value); 3940698f425bSmrg lt_fatal ("bad argument for %s: '%s'", env_set_opt, arg); 3941698f425bSmrg } 3942266e564dSmrg 3943698f425bSmrg lt_setenv (name, value); 3944698f425bSmrg XFREE (name); 3945698f425bSmrg XFREE (value); 3946698f425bSmrg} 3947266e564dSmrg 3948698f425bSmrgvoid 3949698f425bSmrglt_opt_process_env_prepend (const char *arg) 3950698f425bSmrg{ 3951698f425bSmrg char *name = NULL; 3952698f425bSmrg char *value = NULL; 3953698f425bSmrg char *new_value = NULL; 3954266e564dSmrg 3955698f425bSmrg if (lt_split_name_value (arg, &name, &value) != 0) 3956698f425bSmrg { 3957698f425bSmrg XFREE (name); 3958698f425bSmrg XFREE (value); 3959698f425bSmrg lt_fatal ("bad argument for %s: '%s'", env_prepend_opt, arg); 3960698f425bSmrg } 3961266e564dSmrg 3962698f425bSmrg new_value = lt_extend_str (getenv (name), value, 0); 3963698f425bSmrg lt_setenv (name, new_value); 3964698f425bSmrg XFREE (new_value); 3965698f425bSmrg XFREE (name); 3966698f425bSmrg XFREE (value); 3967698f425bSmrg} 3968266e564dSmrg 3969698f425bSmrgvoid 3970698f425bSmrglt_opt_process_env_append (const char *arg) 3971698f425bSmrg{ 3972698f425bSmrg char *name = NULL; 3973698f425bSmrg char *value = NULL; 3974698f425bSmrg char *new_value = NULL; 3975266e564dSmrg 3976698f425bSmrg if (lt_split_name_value (arg, &name, &value) != 0) 3977698f425bSmrg { 3978698f425bSmrg XFREE (name); 3979698f425bSmrg XFREE (value); 3980698f425bSmrg lt_fatal ("bad argument for %s: '%s'", env_append_opt, arg); 3981698f425bSmrg } 3982266e564dSmrg 3983698f425bSmrg new_value = lt_extend_str (getenv (name), value, 1); 3984698f425bSmrg lt_setenv (name, new_value); 3985698f425bSmrg XFREE (new_value); 3986698f425bSmrg XFREE (name); 3987698f425bSmrg XFREE (value); 3988698f425bSmrg} 3989266e564dSmrg 3990698f425bSmrgvoid 3991698f425bSmrglt_update_exe_path (const char *name, const char *value) 3992698f425bSmrg{ 3993698f425bSmrg LTWRAPPER_DEBUGPRINTF (("(lt_update_exe_path) modifying '%s' by prepending '%s'\n", 3994698f425bSmrg (name ? name : "<NULL>"), 3995698f425bSmrg (value ? value : "<NULL>"))); 3996266e564dSmrg 3997698f425bSmrg if (name && *name && value && *value) 3998698f425bSmrg { 3999698f425bSmrg char *new_value = lt_extend_str (getenv (name), value, 0); 4000698f425bSmrg /* some systems can't cope with a ':'-terminated path #' */ 4001698f425bSmrg int len = strlen (new_value); 4002698f425bSmrg while (((len = strlen (new_value)) > 0) && IS_PATH_SEPARATOR (new_value[len-1])) 4003698f425bSmrg { 4004698f425bSmrg new_value[len-1] = '\0'; 4005698f425bSmrg } 4006698f425bSmrg lt_setenv (name, new_value); 4007698f425bSmrg XFREE (new_value); 4008698f425bSmrg } 4009698f425bSmrg} 4010266e564dSmrg 4011698f425bSmrgvoid 4012698f425bSmrglt_update_lib_path (const char *name, const char *value) 4013698f425bSmrg{ 4014698f425bSmrg LTWRAPPER_DEBUGPRINTF (("(lt_update_lib_path) modifying '%s' by prepending '%s'\n", 4015698f425bSmrg (name ? name : "<NULL>"), 4016698f425bSmrg (value ? value : "<NULL>"))); 4017266e564dSmrg 4018698f425bSmrg if (name && *name && value && *value) 4019698f425bSmrg { 4020698f425bSmrg char *new_value = lt_extend_str (getenv (name), value, 0); 4021698f425bSmrg lt_setenv (name, new_value); 4022698f425bSmrg XFREE (new_value); 4023698f425bSmrg } 4024698f425bSmrg} 4025266e564dSmrg 4026266e564dSmrg 4027698f425bSmrgEOF 4028698f425bSmrg} 4029698f425bSmrg# end: func_emit_cwrapperexe_src 4030266e564dSmrg 4031698f425bSmrg# func_mode_link arg... 4032698f425bSmrgfunc_mode_link () 4033698f425bSmrg{ 4034698f425bSmrg $opt_debug 4035698f425bSmrg case $host in 4036698f425bSmrg *-*-cygwin* | *-*-mingw* | *-*-pw32* | *-*-os2* | *-cegcc*) 4037698f425bSmrg # It is impossible to link a dll without this setting, and 4038698f425bSmrg # we shouldn't force the makefile maintainer to figure out 4039698f425bSmrg # which system we are compiling for in order to pass an extra 4040698f425bSmrg # flag for every libtool invocation. 4041698f425bSmrg # allow_undefined=no 4042266e564dSmrg 4043698f425bSmrg # FIXME: Unfortunately, there are problems with the above when trying 4044698f425bSmrg # to make a dll which has undefined symbols, in which case not 4045698f425bSmrg # even a static library is built. For now, we need to specify 4046698f425bSmrg # -no-undefined on the libtool link line when we can be certain 4047698f425bSmrg # that all symbols are satisfied, otherwise we get a static library. 4048698f425bSmrg allow_undefined=yes 4049698f425bSmrg ;; 4050698f425bSmrg *) 4051698f425bSmrg allow_undefined=yes 4052698f425bSmrg ;; 4053698f425bSmrg esac 4054698f425bSmrg libtool_args=$nonopt 4055698f425bSmrg base_compile="$nonopt $@" 4056698f425bSmrg compile_command=$nonopt 4057698f425bSmrg finalize_command=$nonopt 4058266e564dSmrg 4059698f425bSmrg compile_rpath= 4060698f425bSmrg finalize_rpath= 4061698f425bSmrg compile_shlibpath= 4062698f425bSmrg finalize_shlibpath= 4063698f425bSmrg convenience= 4064698f425bSmrg old_convenience= 4065698f425bSmrg deplibs= 4066698f425bSmrg old_deplibs= 4067698f425bSmrg compiler_flags= 4068698f425bSmrg linker_flags= 4069698f425bSmrg dllsearchpath= 4070698f425bSmrg lib_search_path=`pwd` 4071698f425bSmrg inst_prefix_dir= 4072698f425bSmrg new_inherited_linker_flags= 4073266e564dSmrg 4074698f425bSmrg avoid_version=no 4075698f425bSmrg dlfiles= 4076698f425bSmrg dlprefiles= 4077698f425bSmrg dlself=no 4078698f425bSmrg export_dynamic=no 4079698f425bSmrg export_symbols= 4080698f425bSmrg export_symbols_regex= 4081698f425bSmrg generated= 4082698f425bSmrg libobjs= 4083698f425bSmrg ltlibs= 4084698f425bSmrg module=no 4085698f425bSmrg no_install=no 4086698f425bSmrg objs= 4087698f425bSmrg non_pic_objects= 4088698f425bSmrg precious_files_regex= 4089698f425bSmrg prefer_static_libs=no 4090698f425bSmrg preload=no 4091698f425bSmrg prev= 4092698f425bSmrg prevarg= 4093698f425bSmrg release= 4094698f425bSmrg rpath= 4095698f425bSmrg xrpath= 4096698f425bSmrg perm_rpath= 4097698f425bSmrg temp_rpath= 4098698f425bSmrg thread_safe=no 4099698f425bSmrg vinfo= 4100698f425bSmrg vinfo_number=no 4101698f425bSmrg weak_libs= 4102698f425bSmrg single_module="${wl}-single_module" 4103698f425bSmrg func_infer_tag $base_compile 4104266e564dSmrg 4105698f425bSmrg # We need to know -static, to get the right output filenames. 4106698f425bSmrg for arg 4107698f425bSmrg do 4108698f425bSmrg case $arg in 4109698f425bSmrg -shared) 4110698f425bSmrg test "$build_libtool_libs" != yes && \ 4111698f425bSmrg func_fatal_configuration "can not build a shared library" 4112698f425bSmrg build_old_libs=no 4113698f425bSmrg break 4114698f425bSmrg ;; 4115698f425bSmrg -all-static | -static | -static-libtool-libs) 4116698f425bSmrg case $arg in 4117698f425bSmrg -all-static) 4118698f425bSmrg if test "$build_libtool_libs" = yes && test -z "$link_static_flag"; then 4119698f425bSmrg func_warning "complete static linking is impossible in this configuration" 4120698f425bSmrg fi 4121698f425bSmrg if test -n "$link_static_flag"; then 4122698f425bSmrg dlopen_self=$dlopen_self_static 4123698f425bSmrg fi 4124698f425bSmrg prefer_static_libs=yes 4125698f425bSmrg ;; 4126698f425bSmrg -static) 4127698f425bSmrg if test -z "$pic_flag" && test -n "$link_static_flag"; then 4128698f425bSmrg dlopen_self=$dlopen_self_static 4129698f425bSmrg fi 4130698f425bSmrg prefer_static_libs=built 4131698f425bSmrg ;; 4132698f425bSmrg -static-libtool-libs) 4133698f425bSmrg if test -z "$pic_flag" && test -n "$link_static_flag"; then 4134698f425bSmrg dlopen_self=$dlopen_self_static 4135698f425bSmrg fi 4136698f425bSmrg prefer_static_libs=yes 4137698f425bSmrg ;; 4138698f425bSmrg esac 4139698f425bSmrg build_libtool_libs=no 4140698f425bSmrg build_old_libs=yes 4141698f425bSmrg break 4142698f425bSmrg ;; 4143698f425bSmrg esac 4144698f425bSmrg done 4145266e564dSmrg 4146698f425bSmrg # See if our shared archives depend on static archives. 4147698f425bSmrg test -n "$old_archive_from_new_cmds" && build_old_libs=yes 4148266e564dSmrg 4149698f425bSmrg # Go through the arguments, transforming them on the way. 4150698f425bSmrg while test "$#" -gt 0; do 4151698f425bSmrg arg="$1" 4152698f425bSmrg shift 4153698f425bSmrg func_quote_for_eval "$arg" 4154698f425bSmrg qarg=$func_quote_for_eval_unquoted_result 4155698f425bSmrg func_append libtool_args " $func_quote_for_eval_result" 4156266e564dSmrg 4157698f425bSmrg # If the previous option needs an argument, assign it. 4158698f425bSmrg if test -n "$prev"; then 4159698f425bSmrg case $prev in 4160698f425bSmrg output) 4161698f425bSmrg func_append compile_command " @OUTPUT@" 4162698f425bSmrg func_append finalize_command " @OUTPUT@" 4163698f425bSmrg ;; 4164698f425bSmrg esac 4165266e564dSmrg 4166698f425bSmrg case $prev in 4167698f425bSmrg dlfiles|dlprefiles) 4168698f425bSmrg if test "$preload" = no; then 4169698f425bSmrg # Add the symbol object into the linking commands. 4170698f425bSmrg func_append compile_command " @SYMFILE@" 4171698f425bSmrg func_append finalize_command " @SYMFILE@" 4172698f425bSmrg preload=yes 4173266e564dSmrg fi 4174698f425bSmrg case $arg in 4175698f425bSmrg *.la | *.lo) ;; # We handle these cases below. 4176698f425bSmrg force) 4177698f425bSmrg if test "$dlself" = no; then 4178698f425bSmrg dlself=needless 4179698f425bSmrg export_dynamic=yes 4180698f425bSmrg fi 4181698f425bSmrg prev= 4182698f425bSmrg continue 4183698f425bSmrg ;; 4184698f425bSmrg self) 4185698f425bSmrg if test "$prev" = dlprefiles; then 4186698f425bSmrg dlself=yes 4187698f425bSmrg elif test "$prev" = dlfiles && test "$dlopen_self" != yes; then 4188698f425bSmrg dlself=yes 4189698f425bSmrg else 4190698f425bSmrg dlself=needless 4191698f425bSmrg export_dynamic=yes 4192698f425bSmrg fi 4193698f425bSmrg prev= 4194698f425bSmrg continue 4195698f425bSmrg ;; 4196698f425bSmrg *) 4197698f425bSmrg if test "$prev" = dlfiles; then 4198698f425bSmrg dlfiles="$dlfiles $arg" 4199698f425bSmrg else 4200698f425bSmrg dlprefiles="$dlprefiles $arg" 4201698f425bSmrg fi 4202698f425bSmrg prev= 4203698f425bSmrg continue 4204698f425bSmrg ;; 4205698f425bSmrg esac 4206698f425bSmrg ;; 4207698f425bSmrg expsyms) 4208698f425bSmrg export_symbols="$arg" 4209698f425bSmrg test -f "$arg" \ 4210698f425bSmrg || func_fatal_error "symbol file \`$arg' does not exist" 4211698f425bSmrg prev= 4212698f425bSmrg continue 4213698f425bSmrg ;; 4214698f425bSmrg expsyms_regex) 4215698f425bSmrg export_symbols_regex="$arg" 4216698f425bSmrg prev= 4217698f425bSmrg continue 4218698f425bSmrg ;; 4219698f425bSmrg framework) 4220266e564dSmrg case $host in 4221698f425bSmrg *-*-darwin*) 4222698f425bSmrg case "$deplibs " in 4223698f425bSmrg *" $qarg.ltframework "*) ;; 4224698f425bSmrg *) deplibs="$deplibs $qarg.ltframework" # this is fixed later 4225698f425bSmrg ;; 4226698f425bSmrg esac 4227698f425bSmrg ;; 4228266e564dSmrg esac 4229698f425bSmrg prev= 4230698f425bSmrg continue 4231266e564dSmrg ;; 4232698f425bSmrg inst_prefix) 4233698f425bSmrg inst_prefix_dir="$arg" 4234698f425bSmrg prev= 4235698f425bSmrg continue 4236266e564dSmrg ;; 4237698f425bSmrg objectlist) 4238698f425bSmrg if test -f "$arg"; then 4239698f425bSmrg save_arg=$arg 4240698f425bSmrg moreargs= 4241698f425bSmrg for fil in `cat "$save_arg"` 4242698f425bSmrg do 4243698f425bSmrg# moreargs="$moreargs $fil" 4244698f425bSmrg arg=$fil 4245698f425bSmrg # A libtool-controlled object. 4246266e564dSmrg 4247698f425bSmrg # Check to see that this really is a libtool object. 4248698f425bSmrg if func_lalib_unsafe_p "$arg"; then 4249698f425bSmrg pic_object= 4250698f425bSmrg non_pic_object= 4251266e564dSmrg 4252698f425bSmrg # Read the .lo file 4253698f425bSmrg func_source "$arg" 4254266e564dSmrg 4255698f425bSmrg if test -z "$pic_object" || 4256698f425bSmrg test -z "$non_pic_object" || 4257698f425bSmrg test "$pic_object" = none && 4258698f425bSmrg test "$non_pic_object" = none; then 4259698f425bSmrg func_fatal_error "cannot find name of object for \`$arg'" 4260698f425bSmrg fi 4261266e564dSmrg 4262698f425bSmrg # Extract subdirectory from the argument. 4263698f425bSmrg func_dirname "$arg" "/" "" 4264698f425bSmrg xdir="$func_dirname_result" 4265266e564dSmrg 4266698f425bSmrg if test "$pic_object" != none; then 4267698f425bSmrg # Prepend the subdirectory the object is found in. 4268698f425bSmrg pic_object="$xdir$pic_object" 4269266e564dSmrg 4270698f425bSmrg if test "$prev" = dlfiles; then 4271698f425bSmrg if test "$build_libtool_libs" = yes && test "$dlopen_support" = yes; then 4272698f425bSmrg dlfiles="$dlfiles $pic_object" 4273698f425bSmrg prev= 4274698f425bSmrg continue 4275698f425bSmrg else 4276698f425bSmrg # If libtool objects are unsupported, then we need to preload. 4277698f425bSmrg prev=dlprefiles 4278698f425bSmrg fi 4279698f425bSmrg fi 4280266e564dSmrg 4281698f425bSmrg # CHECK ME: I think I busted this. -Ossama 4282698f425bSmrg if test "$prev" = dlprefiles; then 4283698f425bSmrg # Preload the old-style object. 4284698f425bSmrg dlprefiles="$dlprefiles $pic_object" 4285698f425bSmrg prev= 4286698f425bSmrg fi 4287266e564dSmrg 4288698f425bSmrg # A PIC object. 4289698f425bSmrg func_append libobjs " $pic_object" 4290698f425bSmrg arg="$pic_object" 4291698f425bSmrg fi 4292266e564dSmrg 4293698f425bSmrg # Non-PIC object. 4294698f425bSmrg if test "$non_pic_object" != none; then 4295698f425bSmrg # Prepend the subdirectory the object is found in. 4296698f425bSmrg non_pic_object="$xdir$non_pic_object" 4297698f425bSmrg 4298698f425bSmrg # A standard non-PIC object 4299698f425bSmrg func_append non_pic_objects " $non_pic_object" 4300698f425bSmrg if test -z "$pic_object" || test "$pic_object" = none ; then 4301698f425bSmrg arg="$non_pic_object" 4302698f425bSmrg fi 4303698f425bSmrg else 4304698f425bSmrg # If the PIC object exists, use it instead. 4305698f425bSmrg # $xdir was prepended to $pic_object above. 4306698f425bSmrg non_pic_object="$pic_object" 4307698f425bSmrg func_append non_pic_objects " $non_pic_object" 4308698f425bSmrg fi 4309698f425bSmrg else 4310698f425bSmrg # Only an error if not doing a dry-run. 4311698f425bSmrg if $opt_dry_run; then 4312698f425bSmrg # Extract subdirectory from the argument. 4313698f425bSmrg func_dirname "$arg" "/" "" 4314698f425bSmrg xdir="$func_dirname_result" 4315698f425bSmrg 4316698f425bSmrg func_lo2o "$arg" 4317698f425bSmrg pic_object=$xdir$objdir/$func_lo2o_result 4318698f425bSmrg non_pic_object=$xdir$func_lo2o_result 4319698f425bSmrg func_append libobjs " $pic_object" 4320698f425bSmrg func_append non_pic_objects " $non_pic_object" 4321698f425bSmrg else 4322698f425bSmrg func_fatal_error "\`$arg' is not a valid libtool object" 4323698f425bSmrg fi 4324698f425bSmrg fi 4325698f425bSmrg done 4326266e564dSmrg else 4327698f425bSmrg func_fatal_error "link input file \`$arg' does not exist" 4328266e564dSmrg fi 4329698f425bSmrg arg=$save_arg 4330698f425bSmrg prev= 4331698f425bSmrg continue 4332698f425bSmrg ;; 4333698f425bSmrg precious_regex) 4334698f425bSmrg precious_files_regex="$arg" 4335698f425bSmrg prev= 4336698f425bSmrg continue 4337698f425bSmrg ;; 4338698f425bSmrg release) 4339698f425bSmrg release="-$arg" 4340698f425bSmrg prev= 4341698f425bSmrg continue 4342698f425bSmrg ;; 4343698f425bSmrg rpath | xrpath) 4344698f425bSmrg # We need an absolute path. 4345698f425bSmrg case $arg in 4346698f425bSmrg [\\/]* | [A-Za-z]:[\\/]*) ;; 4347698f425bSmrg *) 4348698f425bSmrg func_fatal_error "only absolute run-paths are allowed" 4349698f425bSmrg ;; 4350698f425bSmrg esac 4351698f425bSmrg if test "$prev" = rpath; then 4352698f425bSmrg case "$rpath " in 4353698f425bSmrg *" $arg "*) ;; 4354698f425bSmrg *) rpath="$rpath $arg" ;; 4355698f425bSmrg esac 4356266e564dSmrg else 4357698f425bSmrg case "$xrpath " in 4358698f425bSmrg *" $arg "*) ;; 4359698f425bSmrg *) xrpath="$xrpath $arg" ;; 4360698f425bSmrg esac 4361266e564dSmrg fi 4362698f425bSmrg prev= 4363698f425bSmrg continue 4364698f425bSmrg ;; 4365698f425bSmrg shrext) 4366698f425bSmrg shrext_cmds="$arg" 4367698f425bSmrg prev= 4368698f425bSmrg continue 4369698f425bSmrg ;; 4370698f425bSmrg weak) 4371698f425bSmrg weak_libs="$weak_libs $arg" 4372698f425bSmrg prev= 4373698f425bSmrg continue 4374698f425bSmrg ;; 4375698f425bSmrg xcclinker) 4376698f425bSmrg linker_flags="$linker_flags $qarg" 4377698f425bSmrg compiler_flags="$compiler_flags $qarg" 4378698f425bSmrg prev= 4379698f425bSmrg func_append compile_command " $qarg" 4380698f425bSmrg func_append finalize_command " $qarg" 4381698f425bSmrg continue 4382698f425bSmrg ;; 4383698f425bSmrg xcompiler) 4384698f425bSmrg compiler_flags="$compiler_flags $qarg" 4385698f425bSmrg prev= 4386698f425bSmrg func_append compile_command " $qarg" 4387698f425bSmrg func_append finalize_command " $qarg" 4388698f425bSmrg continue 4389698f425bSmrg ;; 4390698f425bSmrg xlinker) 4391698f425bSmrg linker_flags="$linker_flags $qarg" 4392698f425bSmrg compiler_flags="$compiler_flags $wl$qarg" 4393698f425bSmrg prev= 4394698f425bSmrg func_append compile_command " $wl$qarg" 4395698f425bSmrg func_append finalize_command " $wl$qarg" 4396698f425bSmrg continue 4397698f425bSmrg ;; 4398698f425bSmrg *) 4399698f425bSmrg eval "$prev=\"\$arg\"" 4400698f425bSmrg prev= 4401698f425bSmrg continue 4402698f425bSmrg ;; 4403266e564dSmrg esac 4404698f425bSmrg fi # test -n "$prev" 4405266e564dSmrg 4406698f425bSmrg prevarg="$arg" 4407266e564dSmrg 4408698f425bSmrg case $arg in 4409698f425bSmrg -all-static) 4410698f425bSmrg if test -n "$link_static_flag"; then 4411698f425bSmrg # See comment for -static flag below, for more details. 4412698f425bSmrg func_append compile_command " $link_static_flag" 4413698f425bSmrg func_append finalize_command " $link_static_flag" 4414698f425bSmrg fi 4415698f425bSmrg continue 4416698f425bSmrg ;; 4417266e564dSmrg 4418698f425bSmrg -allow-undefined) 4419698f425bSmrg # FIXME: remove this flag sometime in the future. 4420698f425bSmrg func_fatal_error "\`-allow-undefined' must not be used because it is the default" 4421698f425bSmrg ;; 4422266e564dSmrg 4423698f425bSmrg -avoid-version) 4424698f425bSmrg avoid_version=yes 4425698f425bSmrg continue 4426698f425bSmrg ;; 4427266e564dSmrg 4428698f425bSmrg -dlopen) 4429698f425bSmrg prev=dlfiles 4430698f425bSmrg continue 4431698f425bSmrg ;; 4432266e564dSmrg 4433698f425bSmrg -dlpreopen) 4434698f425bSmrg prev=dlprefiles 4435698f425bSmrg continue 4436698f425bSmrg ;; 4437266e564dSmrg 4438698f425bSmrg -export-dynamic) 4439698f425bSmrg export_dynamic=yes 4440698f425bSmrg continue 4441698f425bSmrg ;; 4442266e564dSmrg 4443698f425bSmrg -export-symbols | -export-symbols-regex) 4444698f425bSmrg if test -n "$export_symbols" || test -n "$export_symbols_regex"; then 4445698f425bSmrg func_fatal_error "more than one -exported-symbols argument is not allowed" 4446698f425bSmrg fi 4447698f425bSmrg if test "X$arg" = "X-export-symbols"; then 4448698f425bSmrg prev=expsyms 4449698f425bSmrg else 4450698f425bSmrg prev=expsyms_regex 4451698f425bSmrg fi 4452698f425bSmrg continue 4453698f425bSmrg ;; 4454266e564dSmrg 4455698f425bSmrg -framework) 4456698f425bSmrg prev=framework 4457698f425bSmrg continue 4458698f425bSmrg ;; 4459266e564dSmrg 4460698f425bSmrg -inst-prefix-dir) 4461698f425bSmrg prev=inst_prefix 4462698f425bSmrg continue 4463698f425bSmrg ;; 4464266e564dSmrg 4465698f425bSmrg # The native IRIX linker understands -LANG:*, -LIST:* and -LNO:* 4466698f425bSmrg # so, if we see these flags be careful not to treat them like -L 4467698f425bSmrg -L[A-Z][A-Z]*:*) 4468698f425bSmrg case $with_gcc/$host in 4469698f425bSmrg no/*-*-irix* | /*-*-irix*) 4470698f425bSmrg func_append compile_command " $arg" 4471698f425bSmrg func_append finalize_command " $arg" 4472698f425bSmrg ;; 4473698f425bSmrg esac 4474698f425bSmrg continue 4475698f425bSmrg ;; 4476266e564dSmrg 4477698f425bSmrg -L*) 4478698f425bSmrg func_stripname '-L' '' "$arg" 4479698f425bSmrg dir=$func_stripname_result 4480698f425bSmrg if test -z "$dir"; then 4481698f425bSmrg if test "$#" -gt 0; then 4482698f425bSmrg func_fatal_error "require no space between \`-L' and \`$1'" 4483698f425bSmrg else 4484698f425bSmrg func_fatal_error "need path for \`-L' option" 4485698f425bSmrg fi 4486698f425bSmrg fi 4487698f425bSmrg # We need an absolute path. 4488698f425bSmrg case $dir in 4489698f425bSmrg [\\/]* | [A-Za-z]:[\\/]*) ;; 4490698f425bSmrg *) 4491698f425bSmrg absdir=`cd "$dir" && pwd` 4492698f425bSmrg test -z "$absdir" && \ 4493698f425bSmrg func_fatal_error "cannot determine absolute directory name of \`$dir'" 4494698f425bSmrg dir="$absdir" 4495698f425bSmrg ;; 4496698f425bSmrg esac 4497698f425bSmrg case "$deplibs " in 4498698f425bSmrg *" -L$dir "*) ;; 4499698f425bSmrg *) 4500698f425bSmrg deplibs="$deplibs -L$dir" 4501698f425bSmrg lib_search_path="$lib_search_path $dir" 4502698f425bSmrg ;; 4503698f425bSmrg esac 4504698f425bSmrg case $host in 4505698f425bSmrg *-*-cygwin* | *-*-mingw* | *-*-pw32* | *-*-os2* | *-cegcc*) 4506698f425bSmrg testbindir=`$ECHO "X$dir" | $Xsed -e 's*/lib$*/bin*'` 4507698f425bSmrg case :$dllsearchpath: in 4508698f425bSmrg *":$dir:"*) ;; 4509698f425bSmrg ::) dllsearchpath=$dir;; 4510698f425bSmrg *) dllsearchpath="$dllsearchpath:$dir";; 4511698f425bSmrg esac 4512698f425bSmrg case :$dllsearchpath: in 4513698f425bSmrg *":$testbindir:"*) ;; 4514698f425bSmrg ::) dllsearchpath=$testbindir;; 4515698f425bSmrg *) dllsearchpath="$dllsearchpath:$testbindir";; 4516698f425bSmrg esac 4517698f425bSmrg ;; 4518698f425bSmrg esac 4519698f425bSmrg continue 4520698f425bSmrg ;; 4521266e564dSmrg 4522698f425bSmrg -l*) 4523698f425bSmrg if test "X$arg" = "X-lc" || test "X$arg" = "X-lm"; then 4524698f425bSmrg case $host in 4525698f425bSmrg *-*-cygwin* | *-*-mingw* | *-*-pw32* | *-*-beos* | *-cegcc*) 4526698f425bSmrg # These systems don't actually have a C or math library (as such) 4527698f425bSmrg continue 4528698f425bSmrg ;; 4529698f425bSmrg *-*-os2*) 4530698f425bSmrg # These systems don't actually have a C library (as such) 4531698f425bSmrg test "X$arg" = "X-lc" && continue 4532698f425bSmrg ;; 4533698f425bSmrg *-*-openbsd* | *-*-freebsd* | *-*-dragonfly*) 4534698f425bSmrg # Do not include libc due to us having libc/libc_r. 4535698f425bSmrg test "X$arg" = "X-lc" && continue 4536698f425bSmrg ;; 4537698f425bSmrg *-*-rhapsody* | *-*-darwin1.[012]) 4538698f425bSmrg # Rhapsody C and math libraries are in the System framework 4539698f425bSmrg deplibs="$deplibs System.ltframework" 4540698f425bSmrg continue 4541698f425bSmrg ;; 4542698f425bSmrg *-*-sco3.2v5* | *-*-sco5v6*) 4543698f425bSmrg # Causes problems with __ctype 4544698f425bSmrg test "X$arg" = "X-lc" && continue 4545698f425bSmrg ;; 4546698f425bSmrg *-*-sysv4.2uw2* | *-*-sysv5* | *-*-unixware* | *-*-OpenUNIX*) 4547698f425bSmrg # Compiler inserts libc in the correct place for threads to work 4548698f425bSmrg test "X$arg" = "X-lc" && continue 4549698f425bSmrg ;; 4550698f425bSmrg esac 4551698f425bSmrg elif test "X$arg" = "X-lc_r"; then 4552698f425bSmrg case $host in 4553698f425bSmrg *-*-openbsd* | *-*-freebsd* | *-*-dragonfly*) 4554698f425bSmrg # Do not include libc_r directly, use -pthread flag. 4555698f425bSmrg continue 4556698f425bSmrg ;; 4557698f425bSmrg esac 4558698f425bSmrg fi 4559698f425bSmrg deplibs="$deplibs $arg" 4560698f425bSmrg continue 4561698f425bSmrg ;; 4562266e564dSmrg 4563698f425bSmrg -module) 4564698f425bSmrg module=yes 4565698f425bSmrg continue 4566698f425bSmrg ;; 4567266e564dSmrg 4568698f425bSmrg # Tru64 UNIX uses -model [arg] to determine the layout of C++ 4569698f425bSmrg # classes, name mangling, and exception handling. 4570698f425bSmrg # Darwin uses the -arch flag to determine output architecture. 4571698f425bSmrg -model|-arch|-isysroot) 4572698f425bSmrg compiler_flags="$compiler_flags $arg" 4573698f425bSmrg func_append compile_command " $arg" 4574698f425bSmrg func_append finalize_command " $arg" 4575698f425bSmrg prev=xcompiler 4576698f425bSmrg continue 4577698f425bSmrg ;; 4578266e564dSmrg 4579698f425bSmrg -mt|-mthreads|-kthread|-Kthread|-pthread|-pthreads|--thread-safe|-threads) 4580698f425bSmrg compiler_flags="$compiler_flags $arg" 4581698f425bSmrg func_append compile_command " $arg" 4582698f425bSmrg func_append finalize_command " $arg" 4583698f425bSmrg case "$new_inherited_linker_flags " in 4584698f425bSmrg *" $arg "*) ;; 4585698f425bSmrg * ) new_inherited_linker_flags="$new_inherited_linker_flags $arg" ;; 4586698f425bSmrg esac 4587698f425bSmrg continue 4588698f425bSmrg ;; 4589266e564dSmrg 4590698f425bSmrg -multi_module) 4591698f425bSmrg single_module="${wl}-multi_module" 4592698f425bSmrg continue 4593698f425bSmrg ;; 4594266e564dSmrg 4595698f425bSmrg -no-fast-install) 4596698f425bSmrg fast_install=no 4597698f425bSmrg continue 4598698f425bSmrg ;; 4599266e564dSmrg 4600698f425bSmrg -no-install) 4601698f425bSmrg case $host in 4602698f425bSmrg *-*-cygwin* | *-*-mingw* | *-*-pw32* | *-*-os2* | *-*-darwin* | *-cegcc*) 4603698f425bSmrg # The PATH hackery in wrapper scripts is required on Windows 4604698f425bSmrg # and Darwin in order for the loader to find any dlls it needs. 4605698f425bSmrg func_warning "\`-no-install' is ignored for $host" 4606698f425bSmrg func_warning "assuming \`-no-fast-install' instead" 4607698f425bSmrg fast_install=no 4608698f425bSmrg ;; 4609698f425bSmrg *) no_install=yes ;; 4610698f425bSmrg esac 4611698f425bSmrg continue 4612698f425bSmrg ;; 4613266e564dSmrg 4614698f425bSmrg -no-undefined) 4615698f425bSmrg allow_undefined=no 4616698f425bSmrg continue 4617698f425bSmrg ;; 4618266e564dSmrg 4619698f425bSmrg -objectlist) 4620698f425bSmrg prev=objectlist 4621698f425bSmrg continue 4622698f425bSmrg ;; 4623266e564dSmrg 4624698f425bSmrg -o) prev=output ;; 4625266e564dSmrg 4626698f425bSmrg -precious-files-regex) 4627698f425bSmrg prev=precious_regex 4628698f425bSmrg continue 4629698f425bSmrg ;; 4630266e564dSmrg 4631698f425bSmrg -release) 4632698f425bSmrg prev=release 4633698f425bSmrg continue 4634698f425bSmrg ;; 4635266e564dSmrg 4636698f425bSmrg -rpath) 4637698f425bSmrg prev=rpath 4638698f425bSmrg continue 4639698f425bSmrg ;; 4640266e564dSmrg 4641698f425bSmrg -R) 4642698f425bSmrg prev=xrpath 4643698f425bSmrg continue 4644698f425bSmrg ;; 4645266e564dSmrg 4646698f425bSmrg -R*) 4647698f425bSmrg func_stripname '-R' '' "$arg" 4648698f425bSmrg dir=$func_stripname_result 4649698f425bSmrg # We need an absolute path. 4650698f425bSmrg case $dir in 4651698f425bSmrg [\\/]* | [A-Za-z]:[\\/]*) ;; 4652698f425bSmrg *) 4653698f425bSmrg func_fatal_error "only absolute run-paths are allowed" 4654698f425bSmrg ;; 4655698f425bSmrg esac 4656698f425bSmrg case "$xrpath " in 4657698f425bSmrg *" $dir "*) ;; 4658698f425bSmrg *) xrpath="$xrpath $dir" ;; 4659698f425bSmrg esac 4660698f425bSmrg continue 4661698f425bSmrg ;; 4662266e564dSmrg 4663698f425bSmrg -shared) 4664698f425bSmrg # The effects of -shared are defined in a previous loop. 4665698f425bSmrg continue 4666698f425bSmrg ;; 4667266e564dSmrg 4668698f425bSmrg -shrext) 4669698f425bSmrg prev=shrext 4670698f425bSmrg continue 4671698f425bSmrg ;; 4672266e564dSmrg 4673698f425bSmrg -static | -static-libtool-libs) 4674698f425bSmrg # The effects of -static are defined in a previous loop. 4675698f425bSmrg # We used to do the same as -all-static on platforms that 4676698f425bSmrg # didn't have a PIC flag, but the assumption that the effects 4677698f425bSmrg # would be equivalent was wrong. It would break on at least 4678698f425bSmrg # Digital Unix and AIX. 4679698f425bSmrg continue 4680698f425bSmrg ;; 4681266e564dSmrg 4682698f425bSmrg -thread-safe) 4683698f425bSmrg thread_safe=yes 4684698f425bSmrg continue 4685698f425bSmrg ;; 4686266e564dSmrg 4687698f425bSmrg -version-info) 4688698f425bSmrg prev=vinfo 4689698f425bSmrg continue 4690698f425bSmrg ;; 4691266e564dSmrg 4692698f425bSmrg -version-number) 4693698f425bSmrg prev=vinfo 4694698f425bSmrg vinfo_number=yes 4695698f425bSmrg continue 4696698f425bSmrg ;; 4697266e564dSmrg 4698698f425bSmrg -weak) 4699698f425bSmrg prev=weak 4700698f425bSmrg continue 4701698f425bSmrg ;; 4702266e564dSmrg 4703698f425bSmrg -Wc,*) 4704698f425bSmrg func_stripname '-Wc,' '' "$arg" 4705698f425bSmrg args=$func_stripname_result 4706698f425bSmrg arg= 4707698f425bSmrg save_ifs="$IFS"; IFS=',' 4708698f425bSmrg for flag in $args; do 4709698f425bSmrg IFS="$save_ifs" 4710698f425bSmrg func_quote_for_eval "$flag" 4711698f425bSmrg arg="$arg $wl$func_quote_for_eval_result" 4712698f425bSmrg compiler_flags="$compiler_flags $func_quote_for_eval_result" 4713698f425bSmrg done 4714698f425bSmrg IFS="$save_ifs" 4715698f425bSmrg func_stripname ' ' '' "$arg" 4716698f425bSmrg arg=$func_stripname_result 4717698f425bSmrg ;; 4718266e564dSmrg 4719698f425bSmrg -Wl,*) 4720698f425bSmrg func_stripname '-Wl,' '' "$arg" 4721698f425bSmrg args=$func_stripname_result 4722698f425bSmrg arg= 4723698f425bSmrg save_ifs="$IFS"; IFS=',' 4724698f425bSmrg for flag in $args; do 4725698f425bSmrg IFS="$save_ifs" 4726698f425bSmrg func_quote_for_eval "$flag" 4727698f425bSmrg arg="$arg $wl$func_quote_for_eval_result" 4728698f425bSmrg compiler_flags="$compiler_flags $wl$func_quote_for_eval_result" 4729698f425bSmrg linker_flags="$linker_flags $func_quote_for_eval_result" 4730698f425bSmrg done 4731698f425bSmrg IFS="$save_ifs" 4732698f425bSmrg func_stripname ' ' '' "$arg" 4733698f425bSmrg arg=$func_stripname_result 4734698f425bSmrg ;; 4735266e564dSmrg 4736698f425bSmrg -Xcompiler) 4737698f425bSmrg prev=xcompiler 4738698f425bSmrg continue 4739698f425bSmrg ;; 4740266e564dSmrg 4741698f425bSmrg -Xlinker) 4742698f425bSmrg prev=xlinker 4743698f425bSmrg continue 4744698f425bSmrg ;; 4745266e564dSmrg 4746698f425bSmrg -XCClinker) 4747698f425bSmrg prev=xcclinker 4748698f425bSmrg continue 4749698f425bSmrg ;; 4750266e564dSmrg 4751698f425bSmrg # -msg_* for osf cc 4752698f425bSmrg -msg_*) 4753698f425bSmrg func_quote_for_eval "$arg" 4754698f425bSmrg arg="$func_quote_for_eval_result" 4755698f425bSmrg ;; 4756266e564dSmrg 4757698f425bSmrg # -64, -mips[0-9] enable 64-bit mode on the SGI compiler 4758698f425bSmrg # -r[0-9][0-9]* specifies the processor on the SGI compiler 4759698f425bSmrg # -xarch=*, -xtarget=* enable 64-bit mode on the Sun compiler 4760698f425bSmrg # +DA*, +DD* enable 64-bit mode on the HP compiler 4761698f425bSmrg # -q* pass through compiler args for the IBM compiler 4762698f425bSmrg # -m*, -t[45]*, -txscale* pass through architecture-specific 4763698f425bSmrg # compiler args for GCC 4764698f425bSmrg # -F/path gives path to uninstalled frameworks, gcc on darwin 4765698f425bSmrg # -p, -pg, --coverage, -fprofile-* pass through profiling flag for GCC 4766698f425bSmrg # @file GCC response files 4767698f425bSmrg -64|-mips[0-9]|-r[0-9][0-9]*|-xarch=*|-xtarget=*|+DA*|+DD*|-q*|-m*| \ 4768698f425bSmrg -t[45]*|-txscale*|-p|-pg|--coverage|-fprofile-*|-F*|@*) 4769698f425bSmrg func_quote_for_eval "$arg" 4770698f425bSmrg arg="$func_quote_for_eval_result" 4771698f425bSmrg func_append compile_command " $arg" 4772698f425bSmrg func_append finalize_command " $arg" 4773698f425bSmrg compiler_flags="$compiler_flags $arg" 4774698f425bSmrg continue 4775698f425bSmrg ;; 4776266e564dSmrg 4777698f425bSmrg # Some other compiler flag. 4778698f425bSmrg -* | +*) 4779698f425bSmrg func_quote_for_eval "$arg" 4780698f425bSmrg arg="$func_quote_for_eval_result" 4781698f425bSmrg ;; 4782266e564dSmrg 4783698f425bSmrg *.$objext) 4784698f425bSmrg # A standard object. 4785698f425bSmrg objs="$objs $arg" 4786698f425bSmrg ;; 4787266e564dSmrg 4788698f425bSmrg *.lo) 4789698f425bSmrg # A libtool-controlled object. 4790266e564dSmrg 4791698f425bSmrg # Check to see that this really is a libtool object. 4792698f425bSmrg if func_lalib_unsafe_p "$arg"; then 4793698f425bSmrg pic_object= 4794698f425bSmrg non_pic_object= 4795266e564dSmrg 4796698f425bSmrg # Read the .lo file 4797698f425bSmrg func_source "$arg" 4798266e564dSmrg 4799698f425bSmrg if test -z "$pic_object" || 4800698f425bSmrg test -z "$non_pic_object" || 4801698f425bSmrg test "$pic_object" = none && 4802698f425bSmrg test "$non_pic_object" = none; then 4803698f425bSmrg func_fatal_error "cannot find name of object for \`$arg'" 4804698f425bSmrg fi 4805c5629e66Smrg 4806698f425bSmrg # Extract subdirectory from the argument. 4807698f425bSmrg func_dirname "$arg" "/" "" 4808698f425bSmrg xdir="$func_dirname_result" 4809266e564dSmrg 4810698f425bSmrg if test "$pic_object" != none; then 4811698f425bSmrg # Prepend the subdirectory the object is found in. 4812698f425bSmrg pic_object="$xdir$pic_object" 4813266e564dSmrg 4814698f425bSmrg if test "$prev" = dlfiles; then 4815698f425bSmrg if test "$build_libtool_libs" = yes && test "$dlopen_support" = yes; then 4816698f425bSmrg dlfiles="$dlfiles $pic_object" 4817698f425bSmrg prev= 4818698f425bSmrg continue 4819698f425bSmrg else 4820698f425bSmrg # If libtool objects are unsupported, then we need to preload. 4821698f425bSmrg prev=dlprefiles 4822698f425bSmrg fi 4823698f425bSmrg fi 4824266e564dSmrg 4825698f425bSmrg # CHECK ME: I think I busted this. -Ossama 4826698f425bSmrg if test "$prev" = dlprefiles; then 4827698f425bSmrg # Preload the old-style object. 4828698f425bSmrg dlprefiles="$dlprefiles $pic_object" 4829698f425bSmrg prev= 4830698f425bSmrg fi 4831266e564dSmrg 4832698f425bSmrg # A PIC object. 4833698f425bSmrg func_append libobjs " $pic_object" 4834698f425bSmrg arg="$pic_object" 4835698f425bSmrg fi 4836266e564dSmrg 4837698f425bSmrg # Non-PIC object. 4838698f425bSmrg if test "$non_pic_object" != none; then 4839698f425bSmrg # Prepend the subdirectory the object is found in. 4840698f425bSmrg non_pic_object="$xdir$non_pic_object" 4841266e564dSmrg 4842698f425bSmrg # A standard non-PIC object 4843698f425bSmrg func_append non_pic_objects " $non_pic_object" 4844698f425bSmrg if test -z "$pic_object" || test "$pic_object" = none ; then 4845698f425bSmrg arg="$non_pic_object" 4846698f425bSmrg fi 4847698f425bSmrg else 4848698f425bSmrg # If the PIC object exists, use it instead. 4849698f425bSmrg # $xdir was prepended to $pic_object above. 4850698f425bSmrg non_pic_object="$pic_object" 4851698f425bSmrg func_append non_pic_objects " $non_pic_object" 4852698f425bSmrg fi 4853698f425bSmrg else 4854698f425bSmrg # Only an error if not doing a dry-run. 4855698f425bSmrg if $opt_dry_run; then 4856698f425bSmrg # Extract subdirectory from the argument. 4857698f425bSmrg func_dirname "$arg" "/" "" 4858698f425bSmrg xdir="$func_dirname_result" 4859698f425bSmrg 4860698f425bSmrg func_lo2o "$arg" 4861698f425bSmrg pic_object=$xdir$objdir/$func_lo2o_result 4862698f425bSmrg non_pic_object=$xdir$func_lo2o_result 4863698f425bSmrg func_append libobjs " $pic_object" 4864698f425bSmrg func_append non_pic_objects " $non_pic_object" 4865698f425bSmrg else 4866698f425bSmrg func_fatal_error "\`$arg' is not a valid libtool object" 4867698f425bSmrg fi 4868698f425bSmrg fi 4869698f425bSmrg ;; 4870698f425bSmrg 4871698f425bSmrg *.$libext) 4872698f425bSmrg # An archive. 4873698f425bSmrg deplibs="$deplibs $arg" 4874698f425bSmrg old_deplibs="$old_deplibs $arg" 4875698f425bSmrg continue 4876698f425bSmrg ;; 4877698f425bSmrg 4878698f425bSmrg *.la) 4879698f425bSmrg # A libtool-controlled library. 4880698f425bSmrg 4881698f425bSmrg if test "$prev" = dlfiles; then 4882698f425bSmrg # This library was specified with -dlopen. 4883698f425bSmrg dlfiles="$dlfiles $arg" 4884698f425bSmrg prev= 4885698f425bSmrg elif test "$prev" = dlprefiles; then 4886698f425bSmrg # The library was specified with -dlpreopen. 4887698f425bSmrg dlprefiles="$dlprefiles $arg" 4888698f425bSmrg prev= 4889698f425bSmrg else 4890698f425bSmrg deplibs="$deplibs $arg" 4891698f425bSmrg fi 4892698f425bSmrg continue 4893698f425bSmrg ;; 4894698f425bSmrg 4895698f425bSmrg # Some other compiler argument. 4896698f425bSmrg *) 4897698f425bSmrg # Unknown arguments in both finalize_command and compile_command need 4898698f425bSmrg # to be aesthetically quoted because they are evaled later. 4899698f425bSmrg func_quote_for_eval "$arg" 4900698f425bSmrg arg="$func_quote_for_eval_result" 4901698f425bSmrg ;; 4902698f425bSmrg esac # arg 4903698f425bSmrg 4904698f425bSmrg # Now actually substitute the argument into the commands. 4905698f425bSmrg if test -n "$arg"; then 4906698f425bSmrg func_append compile_command " $arg" 4907698f425bSmrg func_append finalize_command " $arg" 4908698f425bSmrg fi 4909698f425bSmrg done # argument parsing loop 4910698f425bSmrg 4911698f425bSmrg test -n "$prev" && \ 4912698f425bSmrg func_fatal_help "the \`$prevarg' option requires an argument" 4913698f425bSmrg 4914698f425bSmrg if test "$export_dynamic" = yes && test -n "$export_dynamic_flag_spec"; then 4915698f425bSmrg eval arg=\"$export_dynamic_flag_spec\" 4916698f425bSmrg func_append compile_command " $arg" 4917698f425bSmrg func_append finalize_command " $arg" 4918698f425bSmrg fi 4919698f425bSmrg 4920698f425bSmrg oldlibs= 4921698f425bSmrg # calculate the name of the file, without its directory 4922698f425bSmrg func_basename "$output" 4923698f425bSmrg outputname="$func_basename_result" 4924698f425bSmrg libobjs_save="$libobjs" 4925698f425bSmrg 4926698f425bSmrg if test -n "$shlibpath_var"; then 4927698f425bSmrg # get the directories listed in $shlibpath_var 4928698f425bSmrg eval shlib_search_path=\`\$ECHO \"X\${$shlibpath_var}\" \| \$Xsed -e \'s/:/ /g\'\` 4929698f425bSmrg else 4930698f425bSmrg shlib_search_path= 4931698f425bSmrg fi 4932698f425bSmrg eval sys_lib_search_path=\"$sys_lib_search_path_spec\" 4933698f425bSmrg eval sys_lib_dlsearch_path=\"$sys_lib_dlsearch_path_spec\" 4934698f425bSmrg 4935698f425bSmrg func_dirname "$output" "/" "" 4936698f425bSmrg output_objdir="$func_dirname_result$objdir" 4937698f425bSmrg # Create the object directory. 4938698f425bSmrg func_mkdir_p "$output_objdir" 4939698f425bSmrg 4940698f425bSmrg # Determine the type of output 4941698f425bSmrg case $output in 4942698f425bSmrg "") 4943698f425bSmrg func_fatal_help "you must specify an output file" 4944698f425bSmrg ;; 4945698f425bSmrg *.$libext) linkmode=oldlib ;; 4946698f425bSmrg *.lo | *.$objext) linkmode=obj ;; 4947698f425bSmrg *.la) linkmode=lib ;; 4948698f425bSmrg *) linkmode=prog ;; # Anything else should be a program. 4949698f425bSmrg esac 4950698f425bSmrg 4951698f425bSmrg specialdeplibs= 4952698f425bSmrg 4953698f425bSmrg libs= 4954698f425bSmrg # Find all interdependent deplibs by searching for libraries 4955698f425bSmrg # that are linked more than once (e.g. -la -lb -la) 4956698f425bSmrg for deplib in $deplibs; do 4957698f425bSmrg if $opt_duplicate_deps ; then 4958698f425bSmrg case "$libs " in 4959698f425bSmrg *" $deplib "*) specialdeplibs="$specialdeplibs $deplib" ;; 4960698f425bSmrg esac 4961698f425bSmrg fi 4962698f425bSmrg libs="$libs $deplib" 4963698f425bSmrg done 4964698f425bSmrg 4965698f425bSmrg if test "$linkmode" = lib; then 4966698f425bSmrg libs="$predeps $libs $compiler_lib_search_path $postdeps" 4967698f425bSmrg 4968698f425bSmrg # Compute libraries that are listed more than once in $predeps 4969698f425bSmrg # $postdeps and mark them as special (i.e., whose duplicates are 4970698f425bSmrg # not to be eliminated). 4971698f425bSmrg pre_post_deps= 4972698f425bSmrg if $opt_duplicate_compiler_generated_deps; then 4973698f425bSmrg for pre_post_dep in $predeps $postdeps; do 4974698f425bSmrg case "$pre_post_deps " in 4975698f425bSmrg *" $pre_post_dep "*) specialdeplibs="$specialdeplibs $pre_post_deps" ;; 4976698f425bSmrg esac 4977698f425bSmrg pre_post_deps="$pre_post_deps $pre_post_dep" 4978698f425bSmrg done 4979698f425bSmrg fi 4980698f425bSmrg pre_post_deps= 4981698f425bSmrg fi 4982698f425bSmrg 4983698f425bSmrg deplibs= 4984698f425bSmrg newdependency_libs= 4985698f425bSmrg newlib_search_path= 4986698f425bSmrg need_relink=no # whether we're linking any uninstalled libtool libraries 4987698f425bSmrg notinst_deplibs= # not-installed libtool libraries 4988698f425bSmrg notinst_path= # paths that contain not-installed libtool libraries 4989698f425bSmrg 4990698f425bSmrg case $linkmode in 4991698f425bSmrg lib) 4992698f425bSmrg passes="conv dlpreopen link" 4993698f425bSmrg for file in $dlfiles $dlprefiles; do 4994698f425bSmrg case $file in 4995698f425bSmrg *.la) ;; 4996698f425bSmrg *) 4997698f425bSmrg func_fatal_help "libraries can \`-dlopen' only libtool libraries: $file" 4998698f425bSmrg ;; 4999698f425bSmrg esac 5000698f425bSmrg done 5001698f425bSmrg ;; 5002698f425bSmrg prog) 5003698f425bSmrg compile_deplibs= 5004698f425bSmrg finalize_deplibs= 5005698f425bSmrg alldeplibs=no 5006698f425bSmrg newdlfiles= 5007698f425bSmrg newdlprefiles= 5008698f425bSmrg passes="conv scan dlopen dlpreopen link" 5009698f425bSmrg ;; 5010698f425bSmrg *) passes="conv" 5011698f425bSmrg ;; 5012698f425bSmrg esac 5013698f425bSmrg 5014698f425bSmrg for pass in $passes; do 5015698f425bSmrg # The preopen pass in lib mode reverses $deplibs; put it back here 5016698f425bSmrg # so that -L comes before libs that need it for instance... 5017698f425bSmrg if test "$linkmode,$pass" = "lib,link"; then 5018698f425bSmrg ## FIXME: Find the place where the list is rebuilt in the wrong 5019698f425bSmrg ## order, and fix it there properly 5020698f425bSmrg tmp_deplibs= 5021698f425bSmrg for deplib in $deplibs; do 5022698f425bSmrg tmp_deplibs="$deplib $tmp_deplibs" 5023698f425bSmrg done 5024698f425bSmrg deplibs="$tmp_deplibs" 5025698f425bSmrg fi 5026698f425bSmrg 5027698f425bSmrg if test "$linkmode,$pass" = "lib,link" || 5028698f425bSmrg test "$linkmode,$pass" = "prog,scan"; then 5029698f425bSmrg libs="$deplibs" 5030698f425bSmrg deplibs= 5031698f425bSmrg fi 5032698f425bSmrg if test "$linkmode" = prog; then 5033698f425bSmrg case $pass in 5034698f425bSmrg dlopen) libs="$dlfiles" ;; 5035698f425bSmrg dlpreopen) libs="$dlprefiles" ;; 5036698f425bSmrg link) libs="$deplibs %DEPLIBS% $dependency_libs" ;; 5037698f425bSmrg esac 5038698f425bSmrg fi 5039698f425bSmrg if test "$linkmode,$pass" = "lib,dlpreopen"; then 5040698f425bSmrg # Collect and forward deplibs of preopened libtool libs 5041698f425bSmrg for lib in $dlprefiles; do 5042698f425bSmrg # Ignore non-libtool-libs 5043698f425bSmrg dependency_libs= 5044698f425bSmrg case $lib in 5045698f425bSmrg *.la) func_source "$lib" ;; 5046698f425bSmrg esac 5047698f425bSmrg 5048698f425bSmrg # Collect preopened libtool deplibs, except any this library 5049698f425bSmrg # has declared as weak libs 5050698f425bSmrg for deplib in $dependency_libs; do 5051698f425bSmrg deplib_base=`$ECHO "X$deplib" | $Xsed -e "$basename"` 5052698f425bSmrg case " $weak_libs " in 5053698f425bSmrg *" $deplib_base "*) ;; 5054698f425bSmrg *) deplibs="$deplibs $deplib" ;; 5055698f425bSmrg esac 5056698f425bSmrg done 5057698f425bSmrg done 5058698f425bSmrg libs="$dlprefiles" 5059698f425bSmrg fi 5060698f425bSmrg if test "$pass" = dlopen; then 5061698f425bSmrg # Collect dlpreopened libraries 5062698f425bSmrg save_deplibs="$deplibs" 5063698f425bSmrg deplibs= 5064698f425bSmrg fi 5065698f425bSmrg 5066698f425bSmrg for deplib in $libs; do 5067698f425bSmrg lib= 5068698f425bSmrg found=no 5069698f425bSmrg case $deplib in 5070698f425bSmrg -mt|-mthreads|-kthread|-Kthread|-pthread|-pthreads|--thread-safe|-threads) 5071698f425bSmrg if test "$linkmode,$pass" = "prog,link"; then 5072698f425bSmrg compile_deplibs="$deplib $compile_deplibs" 5073698f425bSmrg finalize_deplibs="$deplib $finalize_deplibs" 5074698f425bSmrg else 5075698f425bSmrg compiler_flags="$compiler_flags $deplib" 5076698f425bSmrg if test "$linkmode" = lib ; then 5077698f425bSmrg case "$new_inherited_linker_flags " in 5078698f425bSmrg *" $deplib "*) ;; 5079698f425bSmrg * ) new_inherited_linker_flags="$new_inherited_linker_flags $deplib" ;; 5080698f425bSmrg esac 5081698f425bSmrg fi 5082698f425bSmrg fi 5083698f425bSmrg continue 5084698f425bSmrg ;; 5085698f425bSmrg -l*) 5086698f425bSmrg if test "$linkmode" != lib && test "$linkmode" != prog; then 5087698f425bSmrg func_warning "\`-l' is ignored for archives/objects" 5088698f425bSmrg continue 5089698f425bSmrg fi 5090698f425bSmrg func_stripname '-l' '' "$deplib" 5091698f425bSmrg name=$func_stripname_result 5092698f425bSmrg if test "$linkmode" = lib; then 5093698f425bSmrg searchdirs="$newlib_search_path $lib_search_path $compiler_lib_search_dirs $sys_lib_search_path $shlib_search_path" 5094698f425bSmrg else 5095698f425bSmrg searchdirs="$newlib_search_path $lib_search_path $sys_lib_search_path $shlib_search_path" 5096698f425bSmrg fi 5097698f425bSmrg for searchdir in $searchdirs; do 5098698f425bSmrg for search_ext in .la $std_shrext .so .a; do 5099698f425bSmrg # Search the libtool library 5100698f425bSmrg lib="$searchdir/lib${name}${search_ext}" 5101698f425bSmrg if test -f "$lib"; then 5102698f425bSmrg if test "$search_ext" = ".la"; then 5103698f425bSmrg found=yes 5104698f425bSmrg else 5105698f425bSmrg found=no 5106698f425bSmrg fi 5107698f425bSmrg break 2 5108698f425bSmrg fi 5109698f425bSmrg done 5110698f425bSmrg done 5111698f425bSmrg if test "$found" != yes; then 5112698f425bSmrg # deplib doesn't seem to be a libtool library 5113698f425bSmrg if test "$linkmode,$pass" = "prog,link"; then 5114698f425bSmrg compile_deplibs="$deplib $compile_deplibs" 5115698f425bSmrg finalize_deplibs="$deplib $finalize_deplibs" 5116698f425bSmrg else 5117698f425bSmrg deplibs="$deplib $deplibs" 5118698f425bSmrg test "$linkmode" = lib && newdependency_libs="$deplib $newdependency_libs" 5119698f425bSmrg fi 5120698f425bSmrg continue 5121698f425bSmrg else # deplib is a libtool library 5122698f425bSmrg # If $allow_libtool_libs_with_static_runtimes && $deplib is a stdlib, 5123698f425bSmrg # We need to do some special things here, and not later. 5124698f425bSmrg if test "X$allow_libtool_libs_with_static_runtimes" = "Xyes" ; then 5125698f425bSmrg case " $predeps $postdeps " in 5126698f425bSmrg *" $deplib "*) 5127698f425bSmrg if func_lalib_p "$lib"; then 5128698f425bSmrg library_names= 5129698f425bSmrg old_library= 5130698f425bSmrg func_source "$lib" 5131698f425bSmrg for l in $old_library $library_names; do 5132698f425bSmrg ll="$l" 5133698f425bSmrg done 5134698f425bSmrg if test "X$ll" = "X$old_library" ; then # only static version available 5135698f425bSmrg found=no 5136698f425bSmrg func_dirname "$lib" "" "." 5137698f425bSmrg ladir="$func_dirname_result" 5138698f425bSmrg lib=$ladir/$old_library 5139698f425bSmrg if test "$linkmode,$pass" = "prog,link"; then 5140698f425bSmrg compile_deplibs="$deplib $compile_deplibs" 5141698f425bSmrg finalize_deplibs="$deplib $finalize_deplibs" 5142698f425bSmrg else 5143698f425bSmrg deplibs="$deplib $deplibs" 5144698f425bSmrg test "$linkmode" = lib && newdependency_libs="$deplib $newdependency_libs" 5145698f425bSmrg fi 5146698f425bSmrg continue 5147698f425bSmrg fi 5148698f425bSmrg fi 5149698f425bSmrg ;; 5150698f425bSmrg *) ;; 5151698f425bSmrg esac 5152698f425bSmrg fi 5153698f425bSmrg fi 5154698f425bSmrg ;; # -l 5155698f425bSmrg *.ltframework) 5156698f425bSmrg if test "$linkmode,$pass" = "prog,link"; then 5157698f425bSmrg compile_deplibs="$deplib $compile_deplibs" 5158698f425bSmrg finalize_deplibs="$deplib $finalize_deplibs" 5159698f425bSmrg else 5160698f425bSmrg deplibs="$deplib $deplibs" 5161698f425bSmrg if test "$linkmode" = lib ; then 5162698f425bSmrg case "$new_inherited_linker_flags " in 5163698f425bSmrg *" $deplib "*) ;; 5164698f425bSmrg * ) new_inherited_linker_flags="$new_inherited_linker_flags $deplib" ;; 5165698f425bSmrg esac 5166698f425bSmrg fi 5167698f425bSmrg fi 5168698f425bSmrg continue 5169698f425bSmrg ;; 5170698f425bSmrg -L*) 5171698f425bSmrg case $linkmode in 5172698f425bSmrg lib) 5173698f425bSmrg deplibs="$deplib $deplibs" 5174698f425bSmrg test "$pass" = conv && continue 5175698f425bSmrg newdependency_libs="$deplib $newdependency_libs" 5176698f425bSmrg func_stripname '-L' '' "$deplib" 5177698f425bSmrg newlib_search_path="$newlib_search_path $func_stripname_result" 5178698f425bSmrg ;; 5179698f425bSmrg prog) 5180698f425bSmrg if test "$pass" = conv; then 5181698f425bSmrg deplibs="$deplib $deplibs" 5182698f425bSmrg continue 5183698f425bSmrg fi 5184698f425bSmrg if test "$pass" = scan; then 5185698f425bSmrg deplibs="$deplib $deplibs" 5186698f425bSmrg else 5187698f425bSmrg compile_deplibs="$deplib $compile_deplibs" 5188698f425bSmrg finalize_deplibs="$deplib $finalize_deplibs" 5189698f425bSmrg fi 5190698f425bSmrg func_stripname '-L' '' "$deplib" 5191698f425bSmrg newlib_search_path="$newlib_search_path $func_stripname_result" 5192698f425bSmrg ;; 5193698f425bSmrg *) 5194698f425bSmrg func_warning "\`-L' is ignored for archives/objects" 5195698f425bSmrg ;; 5196698f425bSmrg esac # linkmode 5197698f425bSmrg continue 5198698f425bSmrg ;; # -L 5199698f425bSmrg -R*) 5200698f425bSmrg if test "$pass" = link; then 5201698f425bSmrg func_stripname '-R' '' "$deplib" 5202698f425bSmrg dir=$func_stripname_result 5203698f425bSmrg # Make sure the xrpath contains only unique directories. 5204698f425bSmrg case "$xrpath " in 5205698f425bSmrg *" $dir "*) ;; 5206698f425bSmrg *) xrpath="$xrpath $dir" ;; 5207698f425bSmrg esac 5208698f425bSmrg fi 5209698f425bSmrg deplibs="$deplib $deplibs" 5210698f425bSmrg continue 5211698f425bSmrg ;; 5212698f425bSmrg *.la) lib="$deplib" ;; 5213698f425bSmrg *.$libext) 5214698f425bSmrg if test "$pass" = conv; then 5215698f425bSmrg deplibs="$deplib $deplibs" 5216698f425bSmrg continue 5217698f425bSmrg fi 5218698f425bSmrg case $linkmode in 5219698f425bSmrg lib) 5220698f425bSmrg # Linking convenience modules into shared libraries is allowed, 5221698f425bSmrg # but linking other static libraries is non-portable. 5222698f425bSmrg case " $dlpreconveniencelibs " in 5223698f425bSmrg *" $deplib "*) ;; 5224698f425bSmrg *) 5225698f425bSmrg valid_a_lib=no 5226698f425bSmrg case $deplibs_check_method in 5227698f425bSmrg match_pattern*) 5228698f425bSmrg set dummy $deplibs_check_method; shift 5229698f425bSmrg match_pattern_regex=`expr "$deplibs_check_method" : "$1 \(.*\)"` 5230698f425bSmrg if eval "\$ECHO \"X$deplib\"" 2>/dev/null | $Xsed -e 10q \ 5231698f425bSmrg | $EGREP "$match_pattern_regex" > /dev/null; then 5232698f425bSmrg valid_a_lib=yes 5233698f425bSmrg fi 5234698f425bSmrg ;; 5235698f425bSmrg pass_all) 5236698f425bSmrg valid_a_lib=yes 5237698f425bSmrg ;; 5238698f425bSmrg esac 5239698f425bSmrg if test "$valid_a_lib" != yes; then 5240698f425bSmrg $ECHO 5241698f425bSmrg $ECHO "*** Warning: Trying to link with static lib archive $deplib." 5242698f425bSmrg $ECHO "*** I have the capability to make that library automatically link in when" 5243698f425bSmrg $ECHO "*** you link to this library. But I can only do this if you have a" 5244698f425bSmrg $ECHO "*** shared version of the library, which you do not appear to have" 5245698f425bSmrg $ECHO "*** because the file extensions .$libext of this argument makes me believe" 5246698f425bSmrg $ECHO "*** that it is just a static archive that I should not use here." 5247698f425bSmrg else 5248698f425bSmrg $ECHO 5249698f425bSmrg $ECHO "*** Warning: Linking the shared library $output against the" 5250698f425bSmrg $ECHO "*** static library $deplib is not portable!" 5251698f425bSmrg deplibs="$deplib $deplibs" 5252698f425bSmrg fi 5253698f425bSmrg ;; 5254698f425bSmrg esac 5255698f425bSmrg continue 5256698f425bSmrg ;; 5257698f425bSmrg prog) 5258698f425bSmrg if test "$pass" != link; then 5259698f425bSmrg deplibs="$deplib $deplibs" 5260698f425bSmrg else 5261698f425bSmrg compile_deplibs="$deplib $compile_deplibs" 5262698f425bSmrg finalize_deplibs="$deplib $finalize_deplibs" 5263698f425bSmrg fi 5264698f425bSmrg continue 5265698f425bSmrg ;; 5266698f425bSmrg esac # linkmode 5267698f425bSmrg ;; # *.$libext 5268698f425bSmrg *.lo | *.$objext) 5269698f425bSmrg if test "$pass" = conv; then 5270698f425bSmrg deplibs="$deplib $deplibs" 5271698f425bSmrg elif test "$linkmode" = prog; then 5272698f425bSmrg if test "$pass" = dlpreopen || test "$dlopen_support" != yes || test "$build_libtool_libs" = no; then 5273698f425bSmrg # If there is no dlopen support or we're linking statically, 5274698f425bSmrg # we need to preload. 5275698f425bSmrg newdlprefiles="$newdlprefiles $deplib" 5276698f425bSmrg compile_deplibs="$deplib $compile_deplibs" 5277698f425bSmrg finalize_deplibs="$deplib $finalize_deplibs" 5278698f425bSmrg else 5279698f425bSmrg newdlfiles="$newdlfiles $deplib" 5280698f425bSmrg fi 5281698f425bSmrg fi 5282698f425bSmrg continue 5283698f425bSmrg ;; 5284698f425bSmrg %DEPLIBS%) 5285698f425bSmrg alldeplibs=yes 5286698f425bSmrg continue 5287698f425bSmrg ;; 5288698f425bSmrg esac # case $deplib 5289698f425bSmrg 5290698f425bSmrg if test "$found" = yes || test -f "$lib"; then : 5291698f425bSmrg else 5292698f425bSmrg func_fatal_error "cannot find the library \`$lib' or unhandled argument \`$deplib'" 5293698f425bSmrg fi 5294698f425bSmrg 5295698f425bSmrg # Check to see that this really is a libtool archive. 5296698f425bSmrg func_lalib_unsafe_p "$lib" \ 5297698f425bSmrg || func_fatal_error "\`$lib' is not a valid libtool archive" 5298698f425bSmrg 5299698f425bSmrg func_dirname "$lib" "" "." 5300698f425bSmrg ladir="$func_dirname_result" 5301698f425bSmrg 5302698f425bSmrg dlname= 5303698f425bSmrg dlopen= 5304698f425bSmrg dlpreopen= 5305698f425bSmrg libdir= 5306698f425bSmrg library_names= 5307698f425bSmrg old_library= 5308698f425bSmrg inherited_linker_flags= 5309698f425bSmrg # If the library was installed with an old release of libtool, 5310698f425bSmrg # it will not redefine variables installed, or shouldnotlink 5311698f425bSmrg installed=yes 5312698f425bSmrg shouldnotlink=no 5313698f425bSmrg avoidtemprpath= 5314698f425bSmrg 5315698f425bSmrg 5316698f425bSmrg # Read the .la file 5317698f425bSmrg func_source "$lib" 5318698f425bSmrg 5319698f425bSmrg # Convert "-framework foo" to "foo.ltframework" 5320698f425bSmrg if test -n "$inherited_linker_flags"; then 5321698f425bSmrg tmp_inherited_linker_flags=`$ECHO "X$inherited_linker_flags" | $Xsed -e 's/-framework \([^ $]*\)/\1.ltframework/g'` 5322698f425bSmrg for tmp_inherited_linker_flag in $tmp_inherited_linker_flags; do 5323698f425bSmrg case " $new_inherited_linker_flags " in 5324698f425bSmrg *" $tmp_inherited_linker_flag "*) ;; 5325698f425bSmrg *) new_inherited_linker_flags="$new_inherited_linker_flags $tmp_inherited_linker_flag";; 5326698f425bSmrg esac 5327698f425bSmrg done 5328698f425bSmrg fi 5329698f425bSmrg dependency_libs=`$ECHO "X $dependency_libs" | $Xsed -e 's% \([^ $]*\).ltframework% -framework \1%g'` 5330698f425bSmrg if test "$linkmode,$pass" = "lib,link" || 5331698f425bSmrg test "$linkmode,$pass" = "prog,scan" || 5332698f425bSmrg { test "$linkmode" != prog && test "$linkmode" != lib; }; then 5333698f425bSmrg test -n "$dlopen" && dlfiles="$dlfiles $dlopen" 5334698f425bSmrg test -n "$dlpreopen" && dlprefiles="$dlprefiles $dlpreopen" 5335698f425bSmrg fi 5336698f425bSmrg 5337698f425bSmrg if test "$pass" = conv; then 5338698f425bSmrg # Only check for convenience libraries 5339698f425bSmrg deplibs="$lib $deplibs" 5340698f425bSmrg if test -z "$libdir"; then 5341698f425bSmrg if test -z "$old_library"; then 5342698f425bSmrg func_fatal_error "cannot find name of link library for \`$lib'" 5343698f425bSmrg fi 5344698f425bSmrg # It is a libtool convenience library, so add in its objects. 5345698f425bSmrg convenience="$convenience $ladir/$objdir/$old_library" 5346698f425bSmrg old_convenience="$old_convenience $ladir/$objdir/$old_library" 5347698f425bSmrg elif test "$linkmode" != prog && test "$linkmode" != lib; then 5348698f425bSmrg func_fatal_error "\`$lib' is not a convenience library" 5349698f425bSmrg fi 5350698f425bSmrg tmp_libs= 5351698f425bSmrg for deplib in $dependency_libs; do 5352698f425bSmrg deplibs="$deplib $deplibs" 5353698f425bSmrg if $opt_duplicate_deps ; then 5354698f425bSmrg case "$tmp_libs " in 5355698f425bSmrg *" $deplib "*) specialdeplibs="$specialdeplibs $deplib" ;; 5356698f425bSmrg esac 5357698f425bSmrg fi 5358698f425bSmrg tmp_libs="$tmp_libs $deplib" 5359698f425bSmrg done 5360698f425bSmrg continue 5361698f425bSmrg fi # $pass = conv 5362698f425bSmrg 5363698f425bSmrg 5364698f425bSmrg # Get the name of the library we link against. 5365698f425bSmrg linklib= 5366698f425bSmrg for l in $old_library $library_names; do 5367698f425bSmrg linklib="$l" 5368698f425bSmrg done 5369698f425bSmrg if test -z "$linklib"; then 5370698f425bSmrg func_fatal_error "cannot find name of link library for \`$lib'" 5371698f425bSmrg fi 5372698f425bSmrg 5373698f425bSmrg # This library was specified with -dlopen. 5374698f425bSmrg if test "$pass" = dlopen; then 5375698f425bSmrg if test -z "$libdir"; then 5376698f425bSmrg func_fatal_error "cannot -dlopen a convenience library: \`$lib'" 5377698f425bSmrg fi 5378698f425bSmrg if test -z "$dlname" || 5379698f425bSmrg test "$dlopen_support" != yes || 5380698f425bSmrg test "$build_libtool_libs" = no; then 5381698f425bSmrg # If there is no dlname, no dlopen support or we're linking 5382698f425bSmrg # statically, we need to preload. We also need to preload any 5383698f425bSmrg # dependent libraries so libltdl's deplib preloader doesn't 5384698f425bSmrg # bomb out in the load deplibs phase. 5385698f425bSmrg dlprefiles="$dlprefiles $lib $dependency_libs" 5386698f425bSmrg else 5387698f425bSmrg newdlfiles="$newdlfiles $lib" 5388698f425bSmrg fi 5389698f425bSmrg continue 5390698f425bSmrg fi # $pass = dlopen 5391698f425bSmrg 5392698f425bSmrg # We need an absolute path. 5393698f425bSmrg case $ladir in 5394698f425bSmrg [\\/]* | [A-Za-z]:[\\/]*) abs_ladir="$ladir" ;; 5395698f425bSmrg *) 5396698f425bSmrg abs_ladir=`cd "$ladir" && pwd` 5397698f425bSmrg if test -z "$abs_ladir"; then 5398698f425bSmrg func_warning "cannot determine absolute directory name of \`$ladir'" 5399698f425bSmrg func_warning "passing it literally to the linker, although it might fail" 5400698f425bSmrg abs_ladir="$ladir" 5401698f425bSmrg fi 5402698f425bSmrg ;; 5403698f425bSmrg esac 5404698f425bSmrg func_basename "$lib" 5405698f425bSmrg laname="$func_basename_result" 5406698f425bSmrg 5407698f425bSmrg # Find the relevant object directory and library name. 5408698f425bSmrg if test "X$installed" = Xyes; then 5409698f425bSmrg if test ! -f "$libdir/$linklib" && test -f "$abs_ladir/$linklib"; then 5410698f425bSmrg func_warning "library \`$lib' was moved." 5411698f425bSmrg dir="$ladir" 5412698f425bSmrg absdir="$abs_ladir" 5413698f425bSmrg libdir="$abs_ladir" 5414698f425bSmrg else 5415698f425bSmrg dir="$libdir" 5416698f425bSmrg absdir="$libdir" 5417698f425bSmrg fi 5418698f425bSmrg test "X$hardcode_automatic" = Xyes && avoidtemprpath=yes 5419698f425bSmrg else 5420698f425bSmrg if test ! -f "$ladir/$objdir/$linklib" && test -f "$abs_ladir/$linklib"; then 5421698f425bSmrg dir="$ladir" 5422698f425bSmrg absdir="$abs_ladir" 5423698f425bSmrg # Remove this search path later 5424698f425bSmrg notinst_path="$notinst_path $abs_ladir" 5425698f425bSmrg else 5426698f425bSmrg dir="$ladir/$objdir" 5427698f425bSmrg absdir="$abs_ladir/$objdir" 5428698f425bSmrg # Remove this search path later 5429698f425bSmrg notinst_path="$notinst_path $abs_ladir" 5430698f425bSmrg fi 5431698f425bSmrg fi # $installed = yes 5432698f425bSmrg func_stripname 'lib' '.la' "$laname" 5433698f425bSmrg name=$func_stripname_result 5434698f425bSmrg 5435698f425bSmrg # This library was specified with -dlpreopen. 5436698f425bSmrg if test "$pass" = dlpreopen; then 5437698f425bSmrg if test -z "$libdir" && test "$linkmode" = prog; then 5438698f425bSmrg func_fatal_error "only libraries may -dlpreopen a convenience library: \`$lib'" 5439698f425bSmrg fi 5440698f425bSmrg # Prefer using a static library (so that no silly _DYNAMIC symbols 5441698f425bSmrg # are required to link). 5442698f425bSmrg if test -n "$old_library"; then 5443698f425bSmrg newdlprefiles="$newdlprefiles $dir/$old_library" 5444698f425bSmrg # Keep a list of preopened convenience libraries to check 5445698f425bSmrg # that they are being used correctly in the link pass. 5446698f425bSmrg test -z "$libdir" && \ 5447698f425bSmrg dlpreconveniencelibs="$dlpreconveniencelibs $dir/$old_library" 5448698f425bSmrg # Otherwise, use the dlname, so that lt_dlopen finds it. 5449698f425bSmrg elif test -n "$dlname"; then 5450698f425bSmrg newdlprefiles="$newdlprefiles $dir/$dlname" 5451698f425bSmrg else 5452698f425bSmrg newdlprefiles="$newdlprefiles $dir/$linklib" 5453698f425bSmrg fi 5454698f425bSmrg fi # $pass = dlpreopen 5455698f425bSmrg 5456698f425bSmrg if test -z "$libdir"; then 5457698f425bSmrg # Link the convenience library 5458698f425bSmrg if test "$linkmode" = lib; then 5459698f425bSmrg deplibs="$dir/$old_library $deplibs" 5460698f425bSmrg elif test "$linkmode,$pass" = "prog,link"; then 5461698f425bSmrg compile_deplibs="$dir/$old_library $compile_deplibs" 5462698f425bSmrg finalize_deplibs="$dir/$old_library $finalize_deplibs" 5463698f425bSmrg else 5464698f425bSmrg deplibs="$lib $deplibs" # used for prog,scan pass 5465698f425bSmrg fi 5466698f425bSmrg continue 5467698f425bSmrg fi 5468698f425bSmrg 5469698f425bSmrg 5470698f425bSmrg if test "$linkmode" = prog && test "$pass" != link; then 5471698f425bSmrg newlib_search_path="$newlib_search_path $ladir" 5472698f425bSmrg deplibs="$lib $deplibs" 5473698f425bSmrg 5474698f425bSmrg linkalldeplibs=no 5475698f425bSmrg if test "$link_all_deplibs" != no || test -z "$library_names" || 5476698f425bSmrg test "$build_libtool_libs" = no; then 5477698f425bSmrg linkalldeplibs=yes 5478698f425bSmrg fi 5479698f425bSmrg 5480698f425bSmrg tmp_libs= 5481698f425bSmrg for deplib in $dependency_libs; do 5482698f425bSmrg case $deplib in 5483698f425bSmrg -L*) func_stripname '-L' '' "$deplib" 5484698f425bSmrg newlib_search_path="$newlib_search_path $func_stripname_result" 5485698f425bSmrg ;; 5486698f425bSmrg esac 5487698f425bSmrg # Need to link against all dependency_libs? 5488698f425bSmrg if test "$linkalldeplibs" = yes; then 5489698f425bSmrg deplibs="$deplib $deplibs" 5490698f425bSmrg else 5491698f425bSmrg # Need to hardcode shared library paths 5492698f425bSmrg # or/and link against static libraries 5493698f425bSmrg newdependency_libs="$deplib $newdependency_libs" 5494698f425bSmrg fi 5495698f425bSmrg if $opt_duplicate_deps ; then 5496698f425bSmrg case "$tmp_libs " in 5497698f425bSmrg *" $deplib "*) specialdeplibs="$specialdeplibs $deplib" ;; 5498698f425bSmrg esac 5499698f425bSmrg fi 5500698f425bSmrg tmp_libs="$tmp_libs $deplib" 5501698f425bSmrg done # for deplib 5502698f425bSmrg continue 5503698f425bSmrg fi # $linkmode = prog... 5504698f425bSmrg 5505698f425bSmrg if test "$linkmode,$pass" = "prog,link"; then 5506698f425bSmrg if test -n "$library_names" && 5507698f425bSmrg { { test "$prefer_static_libs" = no || 5508698f425bSmrg test "$prefer_static_libs,$installed" = "built,yes"; } || 5509698f425bSmrg test -z "$old_library"; }; then 5510698f425bSmrg # We need to hardcode the library path 5511698f425bSmrg if test -n "$shlibpath_var" && test -z "$avoidtemprpath" ; then 5512698f425bSmrg # Make sure the rpath contains only unique directories. 5513698f425bSmrg case "$temp_rpath:" in 5514698f425bSmrg *"$absdir:"*) ;; 5515698f425bSmrg *) temp_rpath="$temp_rpath$absdir:" ;; 5516698f425bSmrg esac 5517698f425bSmrg fi 5518698f425bSmrg 5519698f425bSmrg # Hardcode the library path. 5520698f425bSmrg # Skip directories that are in the system default run-time 5521698f425bSmrg # search path. 5522698f425bSmrg case " $sys_lib_dlsearch_path " in 5523698f425bSmrg *" $absdir "*) ;; 5524698f425bSmrg *) 5525698f425bSmrg case "$compile_rpath " in 5526698f425bSmrg *" $absdir "*) ;; 5527698f425bSmrg *) compile_rpath="$compile_rpath $absdir" 5528698f425bSmrg esac 5529698f425bSmrg ;; 5530698f425bSmrg esac 5531698f425bSmrg case " $sys_lib_dlsearch_path " in 5532698f425bSmrg *" $libdir "*) ;; 5533698f425bSmrg *) 5534698f425bSmrg case "$finalize_rpath " in 5535698f425bSmrg *" $libdir "*) ;; 5536698f425bSmrg *) finalize_rpath="$finalize_rpath $libdir" 5537698f425bSmrg esac 5538698f425bSmrg ;; 5539698f425bSmrg esac 5540698f425bSmrg fi # $linkmode,$pass = prog,link... 5541698f425bSmrg 5542698f425bSmrg if test "$alldeplibs" = yes && 5543698f425bSmrg { test "$deplibs_check_method" = pass_all || 5544698f425bSmrg { test "$build_libtool_libs" = yes && 5545698f425bSmrg test -n "$library_names"; }; }; then 5546698f425bSmrg # We only need to search for static libraries 5547698f425bSmrg continue 5548698f425bSmrg fi 5549698f425bSmrg fi 5550698f425bSmrg 5551698f425bSmrg link_static=no # Whether the deplib will be linked statically 5552698f425bSmrg use_static_libs=$prefer_static_libs 5553698f425bSmrg if test "$use_static_libs" = built && test "$installed" = yes; then 5554698f425bSmrg use_static_libs=no 5555698f425bSmrg fi 5556698f425bSmrg if test -n "$library_names" && 5557698f425bSmrg { test "$use_static_libs" = no || test -z "$old_library"; }; then 5558698f425bSmrg case $host in 5559698f425bSmrg *cygwin* | *mingw* | *cegcc*) 5560698f425bSmrg # No point in relinking DLLs because paths are not encoded 5561698f425bSmrg notinst_deplibs="$notinst_deplibs $lib" 5562698f425bSmrg need_relink=no 5563698f425bSmrg ;; 5564698f425bSmrg *) 5565698f425bSmrg if test "$installed" = no; then 5566698f425bSmrg notinst_deplibs="$notinst_deplibs $lib" 5567698f425bSmrg need_relink=yes 5568698f425bSmrg fi 5569698f425bSmrg ;; 5570698f425bSmrg esac 5571698f425bSmrg # This is a shared library 5572698f425bSmrg 5573698f425bSmrg # Warn about portability, can't link against -module's on some 5574698f425bSmrg # systems (darwin). Don't bleat about dlopened modules though! 5575698f425bSmrg dlopenmodule="" 5576698f425bSmrg for dlpremoduletest in $dlprefiles; do 5577698f425bSmrg if test "X$dlpremoduletest" = "X$lib"; then 5578698f425bSmrg dlopenmodule="$dlpremoduletest" 5579698f425bSmrg break 5580698f425bSmrg fi 5581698f425bSmrg done 5582698f425bSmrg if test -z "$dlopenmodule" && test "$shouldnotlink" = yes && test "$pass" = link; then 5583698f425bSmrg $ECHO 5584698f425bSmrg if test "$linkmode" = prog; then 5585698f425bSmrg $ECHO "*** Warning: Linking the executable $output against the loadable module" 5586698f425bSmrg else 5587698f425bSmrg $ECHO "*** Warning: Linking the shared library $output against the loadable module" 5588698f425bSmrg fi 5589698f425bSmrg $ECHO "*** $linklib is not portable!" 5590698f425bSmrg fi 5591698f425bSmrg if test "$linkmode" = lib && 5592698f425bSmrg test "$hardcode_into_libs" = yes; then 5593698f425bSmrg # Hardcode the library path. 5594698f425bSmrg # Skip directories that are in the system default run-time 5595698f425bSmrg # search path. 5596698f425bSmrg case " $sys_lib_dlsearch_path " in 5597698f425bSmrg *" $absdir "*) ;; 5598698f425bSmrg *) 5599698f425bSmrg case "$compile_rpath " in 5600698f425bSmrg *" $absdir "*) ;; 5601698f425bSmrg *) compile_rpath="$compile_rpath $absdir" 5602698f425bSmrg esac 5603698f425bSmrg ;; 5604698f425bSmrg esac 5605698f425bSmrg case " $sys_lib_dlsearch_path " in 5606698f425bSmrg *" $libdir "*) ;; 5607698f425bSmrg *) 5608698f425bSmrg case "$finalize_rpath " in 5609698f425bSmrg *" $libdir "*) ;; 5610698f425bSmrg *) finalize_rpath="$finalize_rpath $libdir" 5611698f425bSmrg esac 5612698f425bSmrg ;; 5613698f425bSmrg esac 5614698f425bSmrg fi 5615698f425bSmrg 5616698f425bSmrg if test -n "$old_archive_from_expsyms_cmds"; then 5617698f425bSmrg # figure out the soname 5618698f425bSmrg set dummy $library_names 5619698f425bSmrg shift 5620698f425bSmrg realname="$1" 5621698f425bSmrg shift 5622698f425bSmrg libname=`eval "\\$ECHO \"$libname_spec\""` 5623698f425bSmrg # use dlname if we got it. it's perfectly good, no? 5624698f425bSmrg if test -n "$dlname"; then 5625698f425bSmrg soname="$dlname" 5626698f425bSmrg elif test -n "$soname_spec"; then 5627698f425bSmrg # bleh windows 5628698f425bSmrg case $host in 5629698f425bSmrg *cygwin* | mingw* | *cegcc*) 5630698f425bSmrg func_arith $current - $age 5631698f425bSmrg major=$func_arith_result 5632698f425bSmrg versuffix="-$major" 5633698f425bSmrg ;; 5634698f425bSmrg esac 5635698f425bSmrg eval soname=\"$soname_spec\" 5636698f425bSmrg else 5637698f425bSmrg soname="$realname" 5638698f425bSmrg fi 5639698f425bSmrg 5640698f425bSmrg # Make a new name for the extract_expsyms_cmds to use 5641698f425bSmrg soroot="$soname" 5642698f425bSmrg func_basename "$soroot" 5643698f425bSmrg soname="$func_basename_result" 5644698f425bSmrg func_stripname 'lib' '.dll' "$soname" 5645698f425bSmrg newlib=libimp-$func_stripname_result.a 5646698f425bSmrg 5647698f425bSmrg # If the library has no export list, then create one now 5648698f425bSmrg if test -f "$output_objdir/$soname-def"; then : 5649698f425bSmrg else 5650698f425bSmrg func_verbose "extracting exported symbol list from \`$soname'" 5651698f425bSmrg func_execute_cmds "$extract_expsyms_cmds" 'exit $?' 5652698f425bSmrg fi 5653698f425bSmrg 5654698f425bSmrg # Create $newlib 5655698f425bSmrg if test -f "$output_objdir/$newlib"; then :; else 5656698f425bSmrg func_verbose "generating import library for \`$soname'" 5657698f425bSmrg func_execute_cmds "$old_archive_from_expsyms_cmds" 'exit $?' 5658698f425bSmrg fi 5659698f425bSmrg # make sure the library variables are pointing to the new library 5660698f425bSmrg dir=$output_objdir 5661698f425bSmrg linklib=$newlib 5662698f425bSmrg fi # test -n "$old_archive_from_expsyms_cmds" 5663698f425bSmrg 5664698f425bSmrg if test "$linkmode" = prog || test "$mode" != relink; then 5665698f425bSmrg add_shlibpath= 5666698f425bSmrg add_dir= 5667698f425bSmrg add= 5668698f425bSmrg lib_linked=yes 5669698f425bSmrg case $hardcode_action in 5670698f425bSmrg immediate | unsupported) 5671698f425bSmrg if test "$hardcode_direct" = no; then 5672698f425bSmrg add="$dir/$linklib" 5673698f425bSmrg case $host in 5674698f425bSmrg *-*-sco3.2v5.0.[024]*) add_dir="-L$dir" ;; 5675698f425bSmrg *-*-sysv4*uw2*) add_dir="-L$dir" ;; 5676698f425bSmrg *-*-sysv5OpenUNIX* | *-*-sysv5UnixWare7.[01].[10]* | \ 5677698f425bSmrg *-*-unixware7*) add_dir="-L$dir" ;; 5678698f425bSmrg *-*-darwin* ) 5679698f425bSmrg # if the lib is a (non-dlopened) module then we can not 5680698f425bSmrg # link against it, someone is ignoring the earlier warnings 5681698f425bSmrg if /usr/bin/file -L $add 2> /dev/null | 5682698f425bSmrg $GREP ": [^:]* bundle" >/dev/null ; then 5683698f425bSmrg if test "X$dlopenmodule" != "X$lib"; then 5684698f425bSmrg $ECHO "*** Warning: lib $linklib is a module, not a shared library" 5685698f425bSmrg if test -z "$old_library" ; then 5686698f425bSmrg $ECHO 5687698f425bSmrg $ECHO "*** And there doesn't seem to be a static archive available" 5688698f425bSmrg $ECHO "*** The link will probably fail, sorry" 5689698f425bSmrg else 5690698f425bSmrg add="$dir/$old_library" 5691698f425bSmrg fi 5692698f425bSmrg elif test -n "$old_library"; then 5693698f425bSmrg add="$dir/$old_library" 5694698f425bSmrg fi 5695698f425bSmrg fi 5696698f425bSmrg esac 5697698f425bSmrg elif test "$hardcode_minus_L" = no; then 5698698f425bSmrg case $host in 5699698f425bSmrg *-*-sunos*) add_shlibpath="$dir" ;; 5700698f425bSmrg esac 5701698f425bSmrg add_dir="-L$dir" 5702698f425bSmrg add="-l$name" 5703698f425bSmrg elif test "$hardcode_shlibpath_var" = no; then 5704698f425bSmrg add_shlibpath="$dir" 5705698f425bSmrg add="-l$name" 5706698f425bSmrg else 5707698f425bSmrg lib_linked=no 5708698f425bSmrg fi 5709698f425bSmrg ;; 5710698f425bSmrg relink) 5711698f425bSmrg if test "$hardcode_direct" = yes && 5712698f425bSmrg test "$hardcode_direct_absolute" = no; then 5713698f425bSmrg add="$dir/$linklib" 5714698f425bSmrg elif test "$hardcode_minus_L" = yes; then 5715698f425bSmrg add_dir="-L$dir" 5716698f425bSmrg # Try looking first in the location we're being installed to. 5717698f425bSmrg if test -n "$inst_prefix_dir"; then 5718698f425bSmrg case $libdir in 5719698f425bSmrg [\\/]*) 5720698f425bSmrg add_dir="$add_dir -L$inst_prefix_dir$libdir" 5721698f425bSmrg ;; 5722698f425bSmrg esac 5723698f425bSmrg fi 5724698f425bSmrg add="-l$name" 5725698f425bSmrg elif test "$hardcode_shlibpath_var" = yes; then 5726698f425bSmrg add_shlibpath="$dir" 5727698f425bSmrg add="-l$name" 5728698f425bSmrg else 5729698f425bSmrg lib_linked=no 5730698f425bSmrg fi 5731698f425bSmrg ;; 5732698f425bSmrg *) lib_linked=no ;; 5733698f425bSmrg esac 5734698f425bSmrg 5735698f425bSmrg if test "$lib_linked" != yes; then 5736698f425bSmrg func_fatal_configuration "unsupported hardcode properties" 5737698f425bSmrg fi 5738698f425bSmrg 5739698f425bSmrg if test -n "$add_shlibpath"; then 5740698f425bSmrg case :$compile_shlibpath: in 5741698f425bSmrg *":$add_shlibpath:"*) ;; 5742698f425bSmrg *) compile_shlibpath="$compile_shlibpath$add_shlibpath:" ;; 5743698f425bSmrg esac 5744698f425bSmrg fi 5745698f425bSmrg if test "$linkmode" = prog; then 5746698f425bSmrg test -n "$add_dir" && compile_deplibs="$add_dir $compile_deplibs" 5747698f425bSmrg test -n "$add" && compile_deplibs="$add $compile_deplibs" 5748698f425bSmrg else 5749698f425bSmrg test -n "$add_dir" && deplibs="$add_dir $deplibs" 5750698f425bSmrg test -n "$add" && deplibs="$add $deplibs" 5751698f425bSmrg if test "$hardcode_direct" != yes && 5752698f425bSmrg test "$hardcode_minus_L" != yes && 5753698f425bSmrg test "$hardcode_shlibpath_var" = yes; then 5754698f425bSmrg case :$finalize_shlibpath: in 5755698f425bSmrg *":$libdir:"*) ;; 5756698f425bSmrg *) finalize_shlibpath="$finalize_shlibpath$libdir:" ;; 5757698f425bSmrg esac 5758698f425bSmrg fi 5759698f425bSmrg fi 5760698f425bSmrg fi 5761698f425bSmrg 5762698f425bSmrg if test "$linkmode" = prog || test "$mode" = relink; then 5763698f425bSmrg add_shlibpath= 5764698f425bSmrg add_dir= 5765698f425bSmrg add= 5766698f425bSmrg # Finalize command for both is simple: just hardcode it. 5767698f425bSmrg if test "$hardcode_direct" = yes && 5768698f425bSmrg test "$hardcode_direct_absolute" = no; then 5769698f425bSmrg add="$libdir/$linklib" 5770698f425bSmrg elif test "$hardcode_minus_L" = yes; then 5771698f425bSmrg add_dir="-L$libdir" 5772698f425bSmrg add="-l$name" 5773698f425bSmrg elif test "$hardcode_shlibpath_var" = yes; then 5774698f425bSmrg case :$finalize_shlibpath: in 5775698f425bSmrg *":$libdir:"*) ;; 5776698f425bSmrg *) finalize_shlibpath="$finalize_shlibpath$libdir:" ;; 5777698f425bSmrg esac 5778698f425bSmrg add="-l$name" 5779698f425bSmrg elif test "$hardcode_automatic" = yes; then 5780698f425bSmrg if test -n "$inst_prefix_dir" && 5781698f425bSmrg test -f "$inst_prefix_dir$libdir/$linklib" ; then 5782698f425bSmrg add="$inst_prefix_dir$libdir/$linklib" 5783698f425bSmrg else 5784698f425bSmrg add="$libdir/$linklib" 5785698f425bSmrg fi 5786698f425bSmrg else 5787698f425bSmrg # We cannot seem to hardcode it, guess we'll fake it. 5788698f425bSmrg add_dir="-L$libdir" 5789698f425bSmrg # Try looking first in the location we're being installed to. 5790698f425bSmrg if test -n "$inst_prefix_dir"; then 5791698f425bSmrg case $libdir in 5792698f425bSmrg [\\/]*) 5793698f425bSmrg add_dir="$add_dir -L$inst_prefix_dir$libdir" 5794698f425bSmrg ;; 5795698f425bSmrg esac 5796698f425bSmrg fi 5797698f425bSmrg add="-l$name" 5798698f425bSmrg fi 5799698f425bSmrg 5800698f425bSmrg if test "$linkmode" = prog; then 5801698f425bSmrg test -n "$add_dir" && finalize_deplibs="$add_dir $finalize_deplibs" 5802698f425bSmrg test -n "$add" && finalize_deplibs="$add $finalize_deplibs" 5803698f425bSmrg else 5804698f425bSmrg test -n "$add_dir" && deplibs="$add_dir $deplibs" 5805698f425bSmrg test -n "$add" && deplibs="$add $deplibs" 5806698f425bSmrg fi 5807698f425bSmrg fi 5808698f425bSmrg elif test "$linkmode" = prog; then 5809698f425bSmrg # Here we assume that one of hardcode_direct or hardcode_minus_L 5810698f425bSmrg # is not unsupported. This is valid on all known static and 5811698f425bSmrg # shared platforms. 5812698f425bSmrg if test "$hardcode_direct" != unsupported; then 5813698f425bSmrg test -n "$old_library" && linklib="$old_library" 5814698f425bSmrg compile_deplibs="$dir/$linklib $compile_deplibs" 5815698f425bSmrg finalize_deplibs="$dir/$linklib $finalize_deplibs" 5816698f425bSmrg else 5817698f425bSmrg compile_deplibs="-l$name -L$dir $compile_deplibs" 5818698f425bSmrg finalize_deplibs="-l$name -L$dir $finalize_deplibs" 5819698f425bSmrg fi 5820698f425bSmrg elif test "$build_libtool_libs" = yes; then 5821698f425bSmrg # Not a shared library 5822698f425bSmrg if test "$deplibs_check_method" != pass_all; then 5823698f425bSmrg # We're trying link a shared library against a static one 5824698f425bSmrg # but the system doesn't support it. 5825698f425bSmrg 5826698f425bSmrg # Just print a warning and add the library to dependency_libs so 5827698f425bSmrg # that the program can be linked against the static library. 5828698f425bSmrg $ECHO 5829698f425bSmrg $ECHO "*** Warning: This system can not link to static lib archive $lib." 5830698f425bSmrg $ECHO "*** I have the capability to make that library automatically link in when" 5831698f425bSmrg $ECHO "*** you link to this library. But I can only do this if you have a" 5832698f425bSmrg $ECHO "*** shared version of the library, which you do not appear to have." 5833698f425bSmrg if test "$module" = yes; then 5834698f425bSmrg $ECHO "*** But as you try to build a module library, libtool will still create " 5835698f425bSmrg $ECHO "*** a static module, that should work as long as the dlopening application" 5836698f425bSmrg $ECHO "*** is linked with the -dlopen flag to resolve symbols at runtime." 5837698f425bSmrg if test -z "$global_symbol_pipe"; then 5838698f425bSmrg $ECHO 5839698f425bSmrg $ECHO "*** However, this would only work if libtool was able to extract symbol" 5840698f425bSmrg $ECHO "*** lists from a program, using \`nm' or equivalent, but libtool could" 5841698f425bSmrg $ECHO "*** not find such a program. So, this module is probably useless." 5842698f425bSmrg $ECHO "*** \`nm' from GNU binutils and a full rebuild may help." 5843698f425bSmrg fi 5844698f425bSmrg if test "$build_old_libs" = no; then 5845698f425bSmrg build_libtool_libs=module 5846698f425bSmrg build_old_libs=yes 5847698f425bSmrg else 5848698f425bSmrg build_libtool_libs=no 5849698f425bSmrg fi 5850698f425bSmrg fi 5851698f425bSmrg else 5852698f425bSmrg deplibs="$dir/$old_library $deplibs" 5853698f425bSmrg link_static=yes 5854698f425bSmrg fi 5855698f425bSmrg fi # link shared/static library? 5856698f425bSmrg 5857698f425bSmrg if test "$linkmode" = lib; then 5858698f425bSmrg if test -n "$dependency_libs" && 5859698f425bSmrg { test "$hardcode_into_libs" != yes || 5860698f425bSmrg test "$build_old_libs" = yes || 5861698f425bSmrg test "$link_static" = yes; }; then 5862698f425bSmrg # Extract -R from dependency_libs 5863698f425bSmrg temp_deplibs= 5864698f425bSmrg for libdir in $dependency_libs; do 5865698f425bSmrg case $libdir in 5866698f425bSmrg -R*) func_stripname '-R' '' "$libdir" 5867698f425bSmrg temp_xrpath=$func_stripname_result 5868698f425bSmrg case " $xrpath " in 5869698f425bSmrg *" $temp_xrpath "*) ;; 5870698f425bSmrg *) xrpath="$xrpath $temp_xrpath";; 5871698f425bSmrg esac;; 5872698f425bSmrg *) temp_deplibs="$temp_deplibs $libdir";; 5873698f425bSmrg esac 5874698f425bSmrg done 5875698f425bSmrg dependency_libs="$temp_deplibs" 5876698f425bSmrg fi 5877698f425bSmrg 5878698f425bSmrg newlib_search_path="$newlib_search_path $absdir" 5879698f425bSmrg # Link against this library 5880698f425bSmrg test "$link_static" = no && newdependency_libs="$abs_ladir/$laname $newdependency_libs" 5881698f425bSmrg # ... and its dependency_libs 5882698f425bSmrg tmp_libs= 5883698f425bSmrg for deplib in $dependency_libs; do 5884698f425bSmrg newdependency_libs="$deplib $newdependency_libs" 5885698f425bSmrg if $opt_duplicate_deps ; then 5886698f425bSmrg case "$tmp_libs " in 5887698f425bSmrg *" $deplib "*) specialdeplibs="$specialdeplibs $deplib" ;; 5888698f425bSmrg esac 5889698f425bSmrg fi 5890698f425bSmrg tmp_libs="$tmp_libs $deplib" 5891698f425bSmrg done 5892698f425bSmrg 5893698f425bSmrg if test "$link_all_deplibs" != no; then 5894698f425bSmrg # Add the search paths of all dependency libraries 5895698f425bSmrg for deplib in $dependency_libs; do 5896698f425bSmrg case $deplib in 5897698f425bSmrg -L*) path="$deplib" ;; 5898698f425bSmrg *.la) 5899698f425bSmrg func_dirname "$deplib" "" "." 5900698f425bSmrg dir="$func_dirname_result" 5901698f425bSmrg # We need an absolute path. 5902698f425bSmrg case $dir in 5903698f425bSmrg [\\/]* | [A-Za-z]:[\\/]*) absdir="$dir" ;; 5904698f425bSmrg *) 5905698f425bSmrg absdir=`cd "$dir" && pwd` 5906698f425bSmrg if test -z "$absdir"; then 5907698f425bSmrg func_warning "cannot determine absolute directory name of \`$dir'" 5908698f425bSmrg absdir="$dir" 5909698f425bSmrg fi 5910698f425bSmrg ;; 5911698f425bSmrg esac 5912698f425bSmrg if $GREP "^installed=no" $deplib > /dev/null; then 5913698f425bSmrg case $host in 5914698f425bSmrg *-*-darwin*) 5915698f425bSmrg depdepl= 5916698f425bSmrg eval deplibrary_names=`${SED} -n -e 's/^library_names=\(.*\)$/\1/p' $deplib` 5917698f425bSmrg if test -n "$deplibrary_names" ; then 5918698f425bSmrg for tmp in $deplibrary_names ; do 5919698f425bSmrg depdepl=$tmp 5920698f425bSmrg done 5921698f425bSmrg if test -f "$absdir/$objdir/$depdepl" ; then 5922698f425bSmrg depdepl="$absdir/$objdir/$depdepl" 5923698f425bSmrg darwin_install_name=`${OTOOL} -L $depdepl | awk '{if (NR == 2) {print $1;exit}}'` 5924698f425bSmrg if test -z "$darwin_install_name"; then 5925698f425bSmrg darwin_install_name=`${OTOOL64} -L $depdepl | awk '{if (NR == 2) {print $1;exit}}'` 5926698f425bSmrg fi 5927698f425bSmrg compiler_flags="$compiler_flags ${wl}-dylib_file ${wl}${darwin_install_name}:${depdepl}" 5928698f425bSmrg linker_flags="$linker_flags -dylib_file ${darwin_install_name}:${depdepl}" 5929698f425bSmrg path= 5930698f425bSmrg fi 5931698f425bSmrg fi 5932698f425bSmrg ;; 5933698f425bSmrg *) 5934698f425bSmrg path="-L$absdir/$objdir" 5935698f425bSmrg ;; 5936698f425bSmrg esac 5937698f425bSmrg else 5938698f425bSmrg eval libdir=`${SED} -n -e 's/^libdir=\(.*\)$/\1/p' $deplib` 5939698f425bSmrg test -z "$libdir" && \ 5940698f425bSmrg func_fatal_error "\`$deplib' is not a valid libtool archive" 5941698f425bSmrg test "$absdir" != "$libdir" && \ 5942698f425bSmrg func_warning "\`$deplib' seems to be moved" 5943698f425bSmrg 5944698f425bSmrg path="-L$absdir" 5945698f425bSmrg fi 5946698f425bSmrg ;; 5947698f425bSmrg esac 5948698f425bSmrg case " $deplibs " in 5949698f425bSmrg *" $path "*) ;; 5950698f425bSmrg *) deplibs="$path $deplibs" ;; 5951698f425bSmrg esac 5952698f425bSmrg done 5953698f425bSmrg fi # link_all_deplibs != no 5954698f425bSmrg fi # linkmode = lib 5955698f425bSmrg done # for deplib in $libs 5956698f425bSmrg if test "$pass" = link; then 5957698f425bSmrg if test "$linkmode" = "prog"; then 5958698f425bSmrg compile_deplibs="$new_inherited_linker_flags $compile_deplibs" 5959698f425bSmrg finalize_deplibs="$new_inherited_linker_flags $finalize_deplibs" 5960698f425bSmrg else 5961698f425bSmrg compiler_flags="$compiler_flags "`$ECHO "X $new_inherited_linker_flags" | $Xsed -e 's% \([^ $]*\).ltframework% -framework \1%g'` 5962698f425bSmrg fi 5963698f425bSmrg fi 5964698f425bSmrg dependency_libs="$newdependency_libs" 5965698f425bSmrg if test "$pass" = dlpreopen; then 5966698f425bSmrg # Link the dlpreopened libraries before other libraries 5967698f425bSmrg for deplib in $save_deplibs; do 5968698f425bSmrg deplibs="$deplib $deplibs" 5969698f425bSmrg done 5970698f425bSmrg fi 5971698f425bSmrg if test "$pass" != dlopen; then 5972698f425bSmrg if test "$pass" != conv; then 5973698f425bSmrg # Make sure lib_search_path contains only unique directories. 5974698f425bSmrg lib_search_path= 5975698f425bSmrg for dir in $newlib_search_path; do 5976698f425bSmrg case "$lib_search_path " in 5977698f425bSmrg *" $dir "*) ;; 5978698f425bSmrg *) lib_search_path="$lib_search_path $dir" ;; 5979698f425bSmrg esac 5980698f425bSmrg done 5981698f425bSmrg newlib_search_path= 5982698f425bSmrg fi 5983698f425bSmrg 5984698f425bSmrg if test "$linkmode,$pass" != "prog,link"; then 5985698f425bSmrg vars="deplibs" 5986698f425bSmrg else 5987698f425bSmrg vars="compile_deplibs finalize_deplibs" 5988698f425bSmrg fi 5989698f425bSmrg for var in $vars dependency_libs; do 5990698f425bSmrg # Add libraries to $var in reverse order 5991698f425bSmrg eval tmp_libs=\"\$$var\" 5992698f425bSmrg new_libs= 5993698f425bSmrg for deplib in $tmp_libs; do 5994698f425bSmrg # FIXME: Pedantically, this is the right thing to do, so 5995698f425bSmrg # that some nasty dependency loop isn't accidentally 5996698f425bSmrg # broken: 5997698f425bSmrg #new_libs="$deplib $new_libs" 5998698f425bSmrg # Pragmatically, this seems to cause very few problems in 5999698f425bSmrg # practice: 6000698f425bSmrg case $deplib in 6001698f425bSmrg -L*) new_libs="$deplib $new_libs" ;; 6002698f425bSmrg -R*) ;; 6003698f425bSmrg *) 6004698f425bSmrg # And here is the reason: when a library appears more 6005698f425bSmrg # than once as an explicit dependence of a library, or 6006698f425bSmrg # is implicitly linked in more than once by the 6007698f425bSmrg # compiler, it is considered special, and multiple 6008698f425bSmrg # occurrences thereof are not removed. Compare this 6009698f425bSmrg # with having the same library being listed as a 6010698f425bSmrg # dependency of multiple other libraries: in this case, 6011698f425bSmrg # we know (pedantically, we assume) the library does not 6012698f425bSmrg # need to be listed more than once, so we keep only the 6013698f425bSmrg # last copy. This is not always right, but it is rare 6014698f425bSmrg # enough that we require users that really mean to play 6015698f425bSmrg # such unportable linking tricks to link the library 6016698f425bSmrg # using -Wl,-lname, so that libtool does not consider it 6017698f425bSmrg # for duplicate removal. 6018698f425bSmrg case " $specialdeplibs " in 6019698f425bSmrg *" $deplib "*) new_libs="$deplib $new_libs" ;; 6020698f425bSmrg *) 6021698f425bSmrg case " $new_libs " in 6022698f425bSmrg *" $deplib "*) ;; 6023698f425bSmrg *) new_libs="$deplib $new_libs" ;; 6024698f425bSmrg esac 6025698f425bSmrg ;; 6026698f425bSmrg esac 6027698f425bSmrg ;; 6028698f425bSmrg esac 6029698f425bSmrg done 6030698f425bSmrg tmp_libs= 6031698f425bSmrg for deplib in $new_libs; do 6032698f425bSmrg case $deplib in 6033698f425bSmrg -L*) 6034698f425bSmrg case " $tmp_libs " in 6035698f425bSmrg *" $deplib "*) ;; 6036698f425bSmrg *) tmp_libs="$tmp_libs $deplib" ;; 6037698f425bSmrg esac 6038698f425bSmrg ;; 6039698f425bSmrg *) tmp_libs="$tmp_libs $deplib" ;; 6040698f425bSmrg esac 6041698f425bSmrg done 6042698f425bSmrg eval $var=\"$tmp_libs\" 6043698f425bSmrg done # for var 6044698f425bSmrg fi 6045698f425bSmrg # Last step: remove runtime libs from dependency_libs 6046698f425bSmrg # (they stay in deplibs) 6047698f425bSmrg tmp_libs= 6048698f425bSmrg for i in $dependency_libs ; do 6049698f425bSmrg case " $predeps $postdeps $compiler_lib_search_path " in 6050698f425bSmrg *" $i "*) 6051698f425bSmrg i="" 6052698f425bSmrg ;; 6053698f425bSmrg esac 6054698f425bSmrg if test -n "$i" ; then 6055698f425bSmrg tmp_libs="$tmp_libs $i" 6056698f425bSmrg fi 6057698f425bSmrg done 6058698f425bSmrg dependency_libs=$tmp_libs 6059698f425bSmrg done # for pass 6060698f425bSmrg if test "$linkmode" = prog; then 6061698f425bSmrg dlfiles="$newdlfiles" 6062698f425bSmrg fi 6063698f425bSmrg if test "$linkmode" = prog || test "$linkmode" = lib; then 6064698f425bSmrg dlprefiles="$newdlprefiles" 6065698f425bSmrg fi 6066698f425bSmrg 6067698f425bSmrg case $linkmode in 6068698f425bSmrg oldlib) 6069698f425bSmrg if test -n "$dlfiles$dlprefiles" || test "$dlself" != no; then 6070698f425bSmrg func_warning "\`-dlopen' is ignored for archives" 6071698f425bSmrg fi 6072698f425bSmrg 6073698f425bSmrg case " $deplibs" in 6074698f425bSmrg *\ -l* | *\ -L*) 6075698f425bSmrg func_warning "\`-l' and \`-L' are ignored for archives" ;; 6076698f425bSmrg esac 6077698f425bSmrg 6078698f425bSmrg test -n "$rpath" && \ 6079698f425bSmrg func_warning "\`-rpath' is ignored for archives" 6080698f425bSmrg 6081698f425bSmrg test -n "$xrpath" && \ 6082698f425bSmrg func_warning "\`-R' is ignored for archives" 6083698f425bSmrg 6084698f425bSmrg test -n "$vinfo" && \ 6085698f425bSmrg func_warning "\`-version-info/-version-number' is ignored for archives" 6086698f425bSmrg 6087698f425bSmrg test -n "$release" && \ 6088698f425bSmrg func_warning "\`-release' is ignored for archives" 6089698f425bSmrg 6090698f425bSmrg test -n "$export_symbols$export_symbols_regex" && \ 6091698f425bSmrg func_warning "\`-export-symbols' is ignored for archives" 6092698f425bSmrg 6093698f425bSmrg # Now set the variables for building old libraries. 6094698f425bSmrg build_libtool_libs=no 6095698f425bSmrg oldlibs="$output" 6096698f425bSmrg objs="$objs$old_deplibs" 6097698f425bSmrg ;; 6098698f425bSmrg 6099698f425bSmrg lib) 6100698f425bSmrg # Make sure we only generate libraries of the form `libNAME.la'. 6101698f425bSmrg case $outputname in 6102698f425bSmrg lib*) 6103698f425bSmrg func_stripname 'lib' '.la' "$outputname" 6104698f425bSmrg name=$func_stripname_result 6105698f425bSmrg eval shared_ext=\"$shrext_cmds\" 6106698f425bSmrg eval libname=\"$libname_spec\" 6107698f425bSmrg ;; 6108698f425bSmrg *) 6109698f425bSmrg test "$module" = no && \ 6110698f425bSmrg func_fatal_help "libtool library \`$output' must begin with \`lib'" 6111698f425bSmrg 6112698f425bSmrg if test "$need_lib_prefix" != no; then 6113698f425bSmrg # Add the "lib" prefix for modules if required 6114698f425bSmrg func_stripname '' '.la' "$outputname" 6115698f425bSmrg name=$func_stripname_result 6116698f425bSmrg eval shared_ext=\"$shrext_cmds\" 6117698f425bSmrg eval libname=\"$libname_spec\" 6118698f425bSmrg else 6119698f425bSmrg func_stripname '' '.la' "$outputname" 6120698f425bSmrg libname=$func_stripname_result 6121698f425bSmrg fi 6122698f425bSmrg ;; 6123698f425bSmrg esac 6124698f425bSmrg 6125698f425bSmrg if test -n "$objs"; then 6126698f425bSmrg if test "$deplibs_check_method" != pass_all; then 6127698f425bSmrg func_fatal_error "cannot build libtool library \`$output' from non-libtool objects on this host:$objs" 6128698f425bSmrg else 6129698f425bSmrg $ECHO 6130698f425bSmrg $ECHO "*** Warning: Linking the shared library $output against the non-libtool" 6131698f425bSmrg $ECHO "*** objects $objs is not portable!" 6132698f425bSmrg libobjs="$libobjs $objs" 6133698f425bSmrg fi 6134698f425bSmrg fi 6135698f425bSmrg 6136698f425bSmrg test "$dlself" != no && \ 6137698f425bSmrg func_warning "\`-dlopen self' is ignored for libtool libraries" 6138698f425bSmrg 6139698f425bSmrg set dummy $rpath 6140698f425bSmrg shift 6141698f425bSmrg test "$#" -gt 1 && \ 6142698f425bSmrg func_warning "ignoring multiple \`-rpath's for a libtool library" 6143698f425bSmrg 6144698f425bSmrg install_libdir="$1" 6145698f425bSmrg 6146698f425bSmrg oldlibs= 6147698f425bSmrg if test -z "$rpath"; then 6148698f425bSmrg if test "$build_libtool_libs" = yes; then 6149698f425bSmrg # Building a libtool convenience library. 6150698f425bSmrg # Some compilers have problems with a `.al' extension so 6151698f425bSmrg # convenience libraries should have the same extension an 6152698f425bSmrg # archive normally would. 6153698f425bSmrg oldlibs="$output_objdir/$libname.$libext $oldlibs" 6154698f425bSmrg build_libtool_libs=convenience 6155698f425bSmrg build_old_libs=yes 6156698f425bSmrg fi 6157698f425bSmrg 6158698f425bSmrg test -n "$vinfo" && \ 6159698f425bSmrg func_warning "\`-version-info/-version-number' is ignored for convenience libraries" 6160698f425bSmrg 6161698f425bSmrg test -n "$release" && \ 6162698f425bSmrg func_warning "\`-release' is ignored for convenience libraries" 6163698f425bSmrg else 6164698f425bSmrg 6165698f425bSmrg # Parse the version information argument. 6166698f425bSmrg save_ifs="$IFS"; IFS=':' 6167698f425bSmrg set dummy $vinfo 0 0 0 6168698f425bSmrg shift 6169698f425bSmrg IFS="$save_ifs" 6170698f425bSmrg 6171698f425bSmrg test -n "$7" && \ 6172698f425bSmrg func_fatal_help "too many parameters to \`-version-info'" 6173698f425bSmrg 6174698f425bSmrg # convert absolute version numbers to libtool ages 6175698f425bSmrg # this retains compatibility with .la files and attempts 6176698f425bSmrg # to make the code below a bit more comprehensible 6177698f425bSmrg 6178698f425bSmrg case $vinfo_number in 6179698f425bSmrg yes) 6180698f425bSmrg number_major="$1" 6181698f425bSmrg number_minor="$2" 6182698f425bSmrg number_revision="$3" 6183698f425bSmrg # 6184698f425bSmrg # There are really only two kinds -- those that 6185698f425bSmrg # use the current revision as the major version 6186698f425bSmrg # and those that subtract age and use age as 6187698f425bSmrg # a minor version. But, then there is irix 6188698f425bSmrg # which has an extra 1 added just for fun 6189698f425bSmrg # 6190698f425bSmrg case $version_type in 6191698f425bSmrg darwin|linux|osf|windows|none) 6192698f425bSmrg func_arith $number_major + $number_minor 6193698f425bSmrg current=$func_arith_result 6194698f425bSmrg age="$number_minor" 6195698f425bSmrg revision="$number_revision" 6196698f425bSmrg ;; 6197698f425bSmrg freebsd-aout|freebsd-elf|sunos) 6198698f425bSmrg current="$number_major" 6199698f425bSmrg revision="$number_minor" 6200698f425bSmrg age="0" 6201698f425bSmrg ;; 6202698f425bSmrg irix|nonstopux) 6203698f425bSmrg func_arith $number_major + $number_minor 6204698f425bSmrg current=$func_arith_result 6205698f425bSmrg age="$number_minor" 6206698f425bSmrg revision="$number_minor" 6207698f425bSmrg lt_irix_increment=no 6208698f425bSmrg ;; 6209698f425bSmrg esac 6210698f425bSmrg ;; 6211698f425bSmrg no) 6212698f425bSmrg current="$1" 6213698f425bSmrg revision="$2" 6214698f425bSmrg age="$3" 6215698f425bSmrg ;; 6216698f425bSmrg esac 6217698f425bSmrg 6218698f425bSmrg # Check that each of the things are valid numbers. 6219698f425bSmrg case $current in 6220698f425bSmrg 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]) ;; 6221698f425bSmrg *) 6222698f425bSmrg func_error "CURRENT \`$current' must be a nonnegative integer" 6223698f425bSmrg func_fatal_error "\`$vinfo' is not valid version information" 6224698f425bSmrg ;; 6225698f425bSmrg esac 6226698f425bSmrg 6227698f425bSmrg case $revision in 6228698f425bSmrg 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]) ;; 6229698f425bSmrg *) 6230698f425bSmrg func_error "REVISION \`$revision' must be a nonnegative integer" 6231698f425bSmrg func_fatal_error "\`$vinfo' is not valid version information" 6232698f425bSmrg ;; 6233698f425bSmrg esac 6234698f425bSmrg 6235698f425bSmrg case $age in 6236698f425bSmrg 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]) ;; 6237698f425bSmrg *) 6238698f425bSmrg func_error "AGE \`$age' must be a nonnegative integer" 6239698f425bSmrg func_fatal_error "\`$vinfo' is not valid version information" 6240698f425bSmrg ;; 6241698f425bSmrg esac 6242698f425bSmrg 6243698f425bSmrg if test "$age" -gt "$current"; then 6244698f425bSmrg func_error "AGE \`$age' is greater than the current interface number \`$current'" 6245698f425bSmrg func_fatal_error "\`$vinfo' is not valid version information" 6246698f425bSmrg fi 6247698f425bSmrg 6248698f425bSmrg # Calculate the version variables. 6249698f425bSmrg major= 6250698f425bSmrg versuffix= 6251698f425bSmrg verstring= 6252698f425bSmrg case $version_type in 6253698f425bSmrg none) ;; 6254698f425bSmrg 6255698f425bSmrg darwin) 6256698f425bSmrg # Like Linux, but with the current version available in 6257698f425bSmrg # verstring for coding it into the library header 6258698f425bSmrg func_arith $current - $age 6259698f425bSmrg major=.$func_arith_result 6260698f425bSmrg versuffix="$major.$age.$revision" 6261698f425bSmrg # Darwin ld doesn't like 0 for these options... 6262698f425bSmrg func_arith $current + 1 6263698f425bSmrg minor_current=$func_arith_result 6264698f425bSmrg xlcverstring="${wl}-compatibility_version ${wl}$minor_current ${wl}-current_version ${wl}$minor_current.$revision" 6265698f425bSmrg verstring="-compatibility_version $minor_current -current_version $minor_current.$revision" 6266698f425bSmrg ;; 6267698f425bSmrg 6268698f425bSmrg freebsd-aout) 6269698f425bSmrg major=".$current" 6270698f425bSmrg versuffix=".$current.$revision"; 6271698f425bSmrg ;; 6272698f425bSmrg 6273698f425bSmrg freebsd-elf) 6274698f425bSmrg major=".$current" 6275698f425bSmrg versuffix=".$current" 6276698f425bSmrg ;; 6277698f425bSmrg 6278698f425bSmrg irix | nonstopux) 6279698f425bSmrg if test "X$lt_irix_increment" = "Xno"; then 6280698f425bSmrg func_arith $current - $age 6281698f425bSmrg else 6282698f425bSmrg func_arith $current - $age + 1 6283698f425bSmrg fi 6284698f425bSmrg major=$func_arith_result 6285698f425bSmrg 6286698f425bSmrg case $version_type in 6287698f425bSmrg nonstopux) verstring_prefix=nonstopux ;; 6288698f425bSmrg *) verstring_prefix=sgi ;; 6289698f425bSmrg esac 6290698f425bSmrg verstring="$verstring_prefix$major.$revision" 6291698f425bSmrg 6292698f425bSmrg # Add in all the interfaces that we are compatible with. 6293698f425bSmrg loop=$revision 6294698f425bSmrg while test "$loop" -ne 0; do 6295698f425bSmrg func_arith $revision - $loop 6296698f425bSmrg iface=$func_arith_result 6297698f425bSmrg func_arith $loop - 1 6298698f425bSmrg loop=$func_arith_result 6299698f425bSmrg verstring="$verstring_prefix$major.$iface:$verstring" 6300698f425bSmrg done 6301698f425bSmrg 6302698f425bSmrg # Before this point, $major must not contain `.'. 6303698f425bSmrg major=.$major 6304698f425bSmrg versuffix="$major.$revision" 6305698f425bSmrg ;; 6306698f425bSmrg 6307698f425bSmrg linux) 6308698f425bSmrg func_arith $current - $age 6309698f425bSmrg major=.$func_arith_result 6310698f425bSmrg versuffix="$major.$age.$revision" 6311698f425bSmrg ;; 6312698f425bSmrg 6313698f425bSmrg osf) 6314698f425bSmrg func_arith $current - $age 6315698f425bSmrg major=.$func_arith_result 6316698f425bSmrg versuffix=".$current.$age.$revision" 6317698f425bSmrg verstring="$current.$age.$revision" 6318698f425bSmrg 6319698f425bSmrg # Add in all the interfaces that we are compatible with. 6320698f425bSmrg loop=$age 6321698f425bSmrg while test "$loop" -ne 0; do 6322698f425bSmrg func_arith $current - $loop 6323698f425bSmrg iface=$func_arith_result 6324698f425bSmrg func_arith $loop - 1 6325698f425bSmrg loop=$func_arith_result 6326698f425bSmrg verstring="$verstring:${iface}.0" 6327698f425bSmrg done 6328698f425bSmrg 6329698f425bSmrg # Make executables depend on our current version. 6330698f425bSmrg verstring="$verstring:${current}.0" 6331698f425bSmrg ;; 6332698f425bSmrg 6333698f425bSmrg qnx) 6334698f425bSmrg major=".$current" 6335698f425bSmrg versuffix=".$current" 6336698f425bSmrg ;; 6337698f425bSmrg 6338698f425bSmrg sunos) 6339698f425bSmrg major=".$current" 6340698f425bSmrg versuffix=".$current.$revision" 6341698f425bSmrg ;; 6342698f425bSmrg 6343698f425bSmrg windows) 6344698f425bSmrg # Use '-' rather than '.', since we only want one 6345698f425bSmrg # extension on DOS 8.3 filesystems. 6346698f425bSmrg func_arith $current - $age 6347698f425bSmrg major=$func_arith_result 6348698f425bSmrg versuffix="-$major" 6349698f425bSmrg ;; 6350698f425bSmrg 6351698f425bSmrg *) 6352698f425bSmrg func_fatal_configuration "unknown library version type \`$version_type'" 6353698f425bSmrg ;; 6354698f425bSmrg esac 6355698f425bSmrg 6356698f425bSmrg # Clear the version info if we defaulted, and they specified a release. 6357698f425bSmrg if test -z "$vinfo" && test -n "$release"; then 6358698f425bSmrg major= 6359698f425bSmrg case $version_type in 6360698f425bSmrg darwin) 6361698f425bSmrg # we can't check for "0.0" in archive_cmds due to quoting 6362698f425bSmrg # problems, so we reset it completely 6363698f425bSmrg verstring= 6364698f425bSmrg ;; 6365698f425bSmrg *) 6366698f425bSmrg verstring="0.0" 6367698f425bSmrg ;; 6368698f425bSmrg esac 6369698f425bSmrg if test "$need_version" = no; then 6370698f425bSmrg versuffix= 6371698f425bSmrg else 6372698f425bSmrg versuffix=".0.0" 6373698f425bSmrg fi 6374698f425bSmrg fi 6375698f425bSmrg 6376698f425bSmrg # Remove version info from name if versioning should be avoided 6377698f425bSmrg if test "$avoid_version" = yes && test "$need_version" = no; then 6378698f425bSmrg major= 6379698f425bSmrg versuffix= 6380698f425bSmrg verstring="" 6381698f425bSmrg fi 6382698f425bSmrg 6383698f425bSmrg # Check to see if the archive will have undefined symbols. 6384698f425bSmrg if test "$allow_undefined" = yes; then 6385698f425bSmrg if test "$allow_undefined_flag" = unsupported; then 6386698f425bSmrg func_warning "undefined symbols not allowed in $host shared libraries" 6387698f425bSmrg build_libtool_libs=no 6388698f425bSmrg build_old_libs=yes 6389698f425bSmrg fi 6390698f425bSmrg else 6391698f425bSmrg # Don't allow undefined symbols. 6392698f425bSmrg allow_undefined_flag="$no_undefined_flag" 6393698f425bSmrg fi 6394698f425bSmrg 6395698f425bSmrg fi 6396698f425bSmrg 6397698f425bSmrg func_generate_dlsyms "$libname" "$libname" "yes" 6398698f425bSmrg libobjs="$libobjs $symfileobj" 6399698f425bSmrg test "X$libobjs" = "X " && libobjs= 6400698f425bSmrg 6401698f425bSmrg if test "$mode" != relink; then 6402698f425bSmrg # Remove our outputs, but don't remove object files since they 6403698f425bSmrg # may have been created when compiling PIC objects. 6404698f425bSmrg removelist= 6405698f425bSmrg tempremovelist=`$ECHO "$output_objdir/*"` 6406698f425bSmrg for p in $tempremovelist; do 6407698f425bSmrg case $p in 6408698f425bSmrg *.$objext | *.gcno) 6409698f425bSmrg ;; 6410698f425bSmrg $output_objdir/$outputname | $output_objdir/$libname.* | $output_objdir/${libname}${release}.*) 6411698f425bSmrg if test "X$precious_files_regex" != "X"; then 6412698f425bSmrg if $ECHO "$p" | $EGREP -e "$precious_files_regex" >/dev/null 2>&1 6413698f425bSmrg then 6414698f425bSmrg continue 6415698f425bSmrg fi 6416698f425bSmrg fi 6417698f425bSmrg removelist="$removelist $p" 6418698f425bSmrg ;; 6419698f425bSmrg *) ;; 6420698f425bSmrg esac 6421698f425bSmrg done 6422698f425bSmrg test -n "$removelist" && \ 6423698f425bSmrg func_show_eval "${RM}r \$removelist" 6424698f425bSmrg fi 6425698f425bSmrg 6426698f425bSmrg # Now set the variables for building old libraries. 6427698f425bSmrg if test "$build_old_libs" = yes && test "$build_libtool_libs" != convenience ; then 6428698f425bSmrg oldlibs="$oldlibs $output_objdir/$libname.$libext" 6429698f425bSmrg 6430698f425bSmrg # Transform .lo files to .o files. 6431698f425bSmrg oldobjs="$objs "`$ECHO "X$libobjs" | $SP2NL | $Xsed -e '/\.'${libext}'$/d' -e "$lo2o" | $NL2SP` 6432698f425bSmrg fi 6433698f425bSmrg 6434698f425bSmrg # Eliminate all temporary directories. 6435698f425bSmrg #for path in $notinst_path; do 6436698f425bSmrg # lib_search_path=`$ECHO "X$lib_search_path " | $Xsed -e "s% $path % %g"` 6437698f425bSmrg # deplibs=`$ECHO "X$deplibs " | $Xsed -e "s% -L$path % %g"` 6438698f425bSmrg # dependency_libs=`$ECHO "X$dependency_libs " | $Xsed -e "s% -L$path % %g"` 6439698f425bSmrg #done 6440698f425bSmrg 6441698f425bSmrg if test -n "$xrpath"; then 6442698f425bSmrg # If the user specified any rpath flags, then add them. 6443698f425bSmrg temp_xrpath= 6444698f425bSmrg for libdir in $xrpath; do 6445698f425bSmrg temp_xrpath="$temp_xrpath -R$libdir" 6446698f425bSmrg case "$finalize_rpath " in 6447698f425bSmrg *" $libdir "*) ;; 6448698f425bSmrg *) finalize_rpath="$finalize_rpath $libdir" ;; 6449698f425bSmrg esac 6450698f425bSmrg done 6451698f425bSmrg if test "$hardcode_into_libs" != yes || test "$build_old_libs" = yes; then 6452698f425bSmrg dependency_libs="$temp_xrpath $dependency_libs" 6453698f425bSmrg fi 6454698f425bSmrg fi 6455698f425bSmrg 6456698f425bSmrg # Make sure dlfiles contains only unique files that won't be dlpreopened 6457698f425bSmrg old_dlfiles="$dlfiles" 6458698f425bSmrg dlfiles= 6459698f425bSmrg for lib in $old_dlfiles; do 6460698f425bSmrg case " $dlprefiles $dlfiles " in 6461698f425bSmrg *" $lib "*) ;; 6462698f425bSmrg *) dlfiles="$dlfiles $lib" ;; 6463698f425bSmrg esac 6464698f425bSmrg done 6465698f425bSmrg 6466698f425bSmrg # Make sure dlprefiles contains only unique files 6467698f425bSmrg old_dlprefiles="$dlprefiles" 6468698f425bSmrg dlprefiles= 6469698f425bSmrg for lib in $old_dlprefiles; do 6470698f425bSmrg case "$dlprefiles " in 6471698f425bSmrg *" $lib "*) ;; 6472698f425bSmrg *) dlprefiles="$dlprefiles $lib" ;; 6473698f425bSmrg esac 6474698f425bSmrg done 6475698f425bSmrg 6476698f425bSmrg if test "$build_libtool_libs" = yes; then 6477698f425bSmrg if test -n "$rpath"; then 6478698f425bSmrg case $host in 6479698f425bSmrg *-*-cygwin* | *-*-mingw* | *-*-pw32* | *-*-os2* | *-*-beos* | *-cegcc*) 6480698f425bSmrg # these systems don't actually have a c library (as such)! 6481698f425bSmrg ;; 6482698f425bSmrg *-*-rhapsody* | *-*-darwin1.[012]) 6483698f425bSmrg # Rhapsody C library is in the System framework 6484698f425bSmrg deplibs="$deplibs System.ltframework" 6485698f425bSmrg ;; 6486698f425bSmrg *-*-netbsd*) 6487698f425bSmrg # Don't link with libc until the a.out ld.so is fixed. 6488698f425bSmrg ;; 6489698f425bSmrg *-*-openbsd* | *-*-freebsd* | *-*-dragonfly*) 6490698f425bSmrg # Do not include libc due to us having libc/libc_r. 6491698f425bSmrg ;; 6492698f425bSmrg *-*-sco3.2v5* | *-*-sco5v6*) 6493698f425bSmrg # Causes problems with __ctype 6494698f425bSmrg ;; 6495698f425bSmrg *-*-sysv4.2uw2* | *-*-sysv5* | *-*-unixware* | *-*-OpenUNIX*) 6496698f425bSmrg # Compiler inserts libc in the correct place for threads to work 6497698f425bSmrg ;; 6498698f425bSmrg *) 6499698f425bSmrg # Add libc to deplibs on all other systems if necessary. 6500698f425bSmrg if test "$build_libtool_need_lc" = "yes"; then 6501698f425bSmrg deplibs="$deplibs -lc" 6502698f425bSmrg fi 6503698f425bSmrg ;; 6504698f425bSmrg esac 6505698f425bSmrg fi 6506698f425bSmrg 6507698f425bSmrg # Transform deplibs into only deplibs that can be linked in shared. 6508698f425bSmrg name_save=$name 6509698f425bSmrg libname_save=$libname 6510698f425bSmrg release_save=$release 6511698f425bSmrg versuffix_save=$versuffix 6512698f425bSmrg major_save=$major 6513698f425bSmrg # I'm not sure if I'm treating the release correctly. I think 6514698f425bSmrg # release should show up in the -l (ie -lgmp5) so we don't want to 6515698f425bSmrg # add it in twice. Is that correct? 6516698f425bSmrg release="" 6517698f425bSmrg versuffix="" 6518698f425bSmrg major="" 6519698f425bSmrg newdeplibs= 6520698f425bSmrg droppeddeps=no 6521698f425bSmrg case $deplibs_check_method in 6522698f425bSmrg pass_all) 6523698f425bSmrg # Don't check for shared/static. Everything works. 6524698f425bSmrg # This might be a little naive. We might want to check 6525698f425bSmrg # whether the library exists or not. But this is on 6526698f425bSmrg # osf3 & osf4 and I'm not really sure... Just 6527698f425bSmrg # implementing what was already the behavior. 6528698f425bSmrg newdeplibs=$deplibs 6529698f425bSmrg ;; 6530698f425bSmrg test_compile) 6531698f425bSmrg # This code stresses the "libraries are programs" paradigm to its 6532698f425bSmrg # limits. Maybe even breaks it. We compile a program, linking it 6533698f425bSmrg # against the deplibs as a proxy for the library. Then we can check 6534698f425bSmrg # whether they linked in statically or dynamically with ldd. 6535698f425bSmrg $opt_dry_run || $RM conftest.c 6536698f425bSmrg cat > conftest.c <<EOF 6537698f425bSmrg int main() { return 0; } 6538698f425bSmrgEOF 6539698f425bSmrg $opt_dry_run || $RM conftest 6540698f425bSmrg if $LTCC $LTCFLAGS -o conftest conftest.c $deplibs; then 6541698f425bSmrg ldd_output=`ldd conftest` 6542698f425bSmrg for i in $deplibs; do 6543698f425bSmrg case $i in 6544698f425bSmrg -l*) 6545698f425bSmrg func_stripname -l '' "$i" 6546698f425bSmrg name=$func_stripname_result 6547698f425bSmrg if test "X$allow_libtool_libs_with_static_runtimes" = "Xyes" ; then 6548698f425bSmrg case " $predeps $postdeps " in 6549698f425bSmrg *" $i "*) 6550698f425bSmrg newdeplibs="$newdeplibs $i" 6551698f425bSmrg i="" 6552698f425bSmrg ;; 6553698f425bSmrg esac 6554698f425bSmrg fi 6555698f425bSmrg if test -n "$i" ; then 6556698f425bSmrg libname=`eval "\\$ECHO \"$libname_spec\""` 6557698f425bSmrg deplib_matches=`eval "\\$ECHO \"$library_names_spec\""` 6558698f425bSmrg set dummy $deplib_matches; shift 6559698f425bSmrg deplib_match=$1 6560698f425bSmrg if test `expr "$ldd_output" : ".*$deplib_match"` -ne 0 ; then 6561698f425bSmrg newdeplibs="$newdeplibs $i" 6562698f425bSmrg else 6563698f425bSmrg droppeddeps=yes 6564698f425bSmrg $ECHO 6565698f425bSmrg $ECHO "*** Warning: dynamic linker does not accept needed library $i." 6566698f425bSmrg $ECHO "*** I have the capability to make that library automatically link in when" 6567698f425bSmrg $ECHO "*** you link to this library. But I can only do this if you have a" 6568698f425bSmrg $ECHO "*** shared version of the library, which I believe you do not have" 6569698f425bSmrg $ECHO "*** because a test_compile did reveal that the linker did not use it for" 6570698f425bSmrg $ECHO "*** its dynamic dependency list that programs get resolved with at runtime." 6571698f425bSmrg fi 6572698f425bSmrg fi 6573698f425bSmrg ;; 6574698f425bSmrg *) 6575698f425bSmrg newdeplibs="$newdeplibs $i" 6576698f425bSmrg ;; 6577698f425bSmrg esac 6578698f425bSmrg done 6579698f425bSmrg else 6580698f425bSmrg # Error occurred in the first compile. Let's try to salvage 6581698f425bSmrg # the situation: Compile a separate program for each library. 6582698f425bSmrg for i in $deplibs; do 6583698f425bSmrg case $i in 6584698f425bSmrg -l*) 6585698f425bSmrg func_stripname -l '' "$i" 6586698f425bSmrg name=$func_stripname_result 6587698f425bSmrg $opt_dry_run || $RM conftest 6588698f425bSmrg if $LTCC $LTCFLAGS -o conftest conftest.c $i; then 6589698f425bSmrg ldd_output=`ldd conftest` 6590698f425bSmrg if test "X$allow_libtool_libs_with_static_runtimes" = "Xyes" ; then 6591698f425bSmrg case " $predeps $postdeps " in 6592698f425bSmrg *" $i "*) 6593698f425bSmrg newdeplibs="$newdeplibs $i" 6594698f425bSmrg i="" 6595698f425bSmrg ;; 6596698f425bSmrg esac 6597698f425bSmrg fi 6598698f425bSmrg if test -n "$i" ; then 6599698f425bSmrg libname=`eval "\\$ECHO \"$libname_spec\""` 6600698f425bSmrg deplib_matches=`eval "\\$ECHO \"$library_names_spec\""` 6601698f425bSmrg set dummy $deplib_matches; shift 6602698f425bSmrg deplib_match=$1 6603698f425bSmrg if test `expr "$ldd_output" : ".*$deplib_match"` -ne 0 ; then 6604698f425bSmrg newdeplibs="$newdeplibs $i" 6605698f425bSmrg else 6606698f425bSmrg droppeddeps=yes 6607698f425bSmrg $ECHO 6608698f425bSmrg $ECHO "*** Warning: dynamic linker does not accept needed library $i." 6609698f425bSmrg $ECHO "*** I have the capability to make that library automatically link in when" 6610698f425bSmrg $ECHO "*** you link to this library. But I can only do this if you have a" 6611698f425bSmrg $ECHO "*** shared version of the library, which you do not appear to have" 6612698f425bSmrg $ECHO "*** because a test_compile did reveal that the linker did not use this one" 6613698f425bSmrg $ECHO "*** as a dynamic dependency that programs can get resolved with at runtime." 6614698f425bSmrg fi 6615698f425bSmrg fi 6616698f425bSmrg else 6617698f425bSmrg droppeddeps=yes 6618698f425bSmrg $ECHO 6619698f425bSmrg $ECHO "*** Warning! Library $i is needed by this library but I was not able to" 6620698f425bSmrg $ECHO "*** make it link in! You will probably need to install it or some" 6621698f425bSmrg $ECHO "*** library that it depends on before this library will be fully" 6622698f425bSmrg $ECHO "*** functional. Installing it before continuing would be even better." 6623698f425bSmrg fi 6624698f425bSmrg ;; 6625698f425bSmrg *) 6626698f425bSmrg newdeplibs="$newdeplibs $i" 6627698f425bSmrg ;; 6628698f425bSmrg esac 6629698f425bSmrg done 6630698f425bSmrg fi 6631698f425bSmrg ;; 6632698f425bSmrg file_magic*) 6633698f425bSmrg set dummy $deplibs_check_method; shift 6634698f425bSmrg file_magic_regex=`expr "$deplibs_check_method" : "$1 \(.*\)"` 6635698f425bSmrg for a_deplib in $deplibs; do 6636698f425bSmrg case $a_deplib in 6637698f425bSmrg -l*) 6638698f425bSmrg func_stripname -l '' "$a_deplib" 6639698f425bSmrg name=$func_stripname_result 6640698f425bSmrg if test "X$allow_libtool_libs_with_static_runtimes" = "Xyes" ; then 6641698f425bSmrg case " $predeps $postdeps " in 6642698f425bSmrg *" $a_deplib "*) 6643698f425bSmrg newdeplibs="$newdeplibs $a_deplib" 6644698f425bSmrg a_deplib="" 6645698f425bSmrg ;; 6646698f425bSmrg esac 6647698f425bSmrg fi 6648698f425bSmrg if test -n "$a_deplib" ; then 6649698f425bSmrg libname=`eval "\\$ECHO \"$libname_spec\""` 6650698f425bSmrg for i in $lib_search_path $sys_lib_search_path $shlib_search_path; do 6651698f425bSmrg potential_libs=`ls $i/$libname[.-]* 2>/dev/null` 6652698f425bSmrg for potent_lib in $potential_libs; do 6653698f425bSmrg # Follow soft links. 6654698f425bSmrg if ls -lLd "$potent_lib" 2>/dev/null | 6655698f425bSmrg $GREP " -> " >/dev/null; then 6656698f425bSmrg continue 6657698f425bSmrg fi 6658698f425bSmrg # The statement above tries to avoid entering an 6659698f425bSmrg # endless loop below, in case of cyclic links. 6660698f425bSmrg # We might still enter an endless loop, since a link 6661698f425bSmrg # loop can be closed while we follow links, 6662698f425bSmrg # but so what? 6663698f425bSmrg potlib="$potent_lib" 6664698f425bSmrg while test -h "$potlib" 2>/dev/null; do 6665698f425bSmrg potliblink=`ls -ld $potlib | ${SED} 's/.* -> //'` 6666698f425bSmrg case $potliblink in 6667698f425bSmrg [\\/]* | [A-Za-z]:[\\/]*) potlib="$potliblink";; 6668698f425bSmrg *) potlib=`$ECHO "X$potlib" | $Xsed -e 's,[^/]*$,,'`"$potliblink";; 6669698f425bSmrg esac 6670698f425bSmrg done 6671698f425bSmrg if eval $file_magic_cmd \"\$potlib\" 2>/dev/null | 6672698f425bSmrg $SED -e 10q | 6673698f425bSmrg $EGREP "$file_magic_regex" > /dev/null; then 6674698f425bSmrg newdeplibs="$newdeplibs $a_deplib" 6675698f425bSmrg a_deplib="" 6676698f425bSmrg break 2 6677698f425bSmrg fi 6678698f425bSmrg done 6679698f425bSmrg done 6680698f425bSmrg fi 6681698f425bSmrg if test -n "$a_deplib" ; then 6682698f425bSmrg droppeddeps=yes 6683698f425bSmrg $ECHO 6684698f425bSmrg $ECHO "*** Warning: linker path does not have real file for library $a_deplib." 6685698f425bSmrg $ECHO "*** I have the capability to make that library automatically link in when" 6686698f425bSmrg $ECHO "*** you link to this library. But I can only do this if you have a" 6687698f425bSmrg $ECHO "*** shared version of the library, which you do not appear to have" 6688698f425bSmrg $ECHO "*** because I did check the linker path looking for a file starting" 6689698f425bSmrg if test -z "$potlib" ; then 6690698f425bSmrg $ECHO "*** with $libname but no candidates were found. (...for file magic test)" 6691698f425bSmrg else 6692698f425bSmrg $ECHO "*** with $libname and none of the candidates passed a file format test" 6693698f425bSmrg $ECHO "*** using a file magic. Last file checked: $potlib" 6694698f425bSmrg fi 6695698f425bSmrg fi 6696698f425bSmrg ;; 6697698f425bSmrg *) 6698698f425bSmrg # Add a -L argument. 6699698f425bSmrg newdeplibs="$newdeplibs $a_deplib" 6700698f425bSmrg ;; 6701698f425bSmrg esac 6702698f425bSmrg done # Gone through all deplibs. 6703698f425bSmrg ;; 6704698f425bSmrg match_pattern*) 6705698f425bSmrg set dummy $deplibs_check_method; shift 6706698f425bSmrg match_pattern_regex=`expr "$deplibs_check_method" : "$1 \(.*\)"` 6707698f425bSmrg for a_deplib in $deplibs; do 6708698f425bSmrg case $a_deplib in 6709698f425bSmrg -l*) 6710698f425bSmrg func_stripname -l '' "$a_deplib" 6711698f425bSmrg name=$func_stripname_result 6712698f425bSmrg if test "X$allow_libtool_libs_with_static_runtimes" = "Xyes" ; then 6713698f425bSmrg case " $predeps $postdeps " in 6714698f425bSmrg *" $a_deplib "*) 6715698f425bSmrg newdeplibs="$newdeplibs $a_deplib" 6716698f425bSmrg a_deplib="" 6717698f425bSmrg ;; 6718698f425bSmrg esac 6719698f425bSmrg fi 6720698f425bSmrg if test -n "$a_deplib" ; then 6721698f425bSmrg libname=`eval "\\$ECHO \"$libname_spec\""` 6722698f425bSmrg for i in $lib_search_path $sys_lib_search_path $shlib_search_path; do 6723698f425bSmrg potential_libs=`ls $i/$libname[.-]* 2>/dev/null` 6724698f425bSmrg for potent_lib in $potential_libs; do 6725698f425bSmrg potlib="$potent_lib" # see symlink-check above in file_magic test 6726698f425bSmrg if eval "\$ECHO \"X$potent_lib\"" 2>/dev/null | $Xsed -e 10q | \ 6727698f425bSmrg $EGREP "$match_pattern_regex" > /dev/null; then 6728698f425bSmrg newdeplibs="$newdeplibs $a_deplib" 6729698f425bSmrg a_deplib="" 6730698f425bSmrg break 2 6731698f425bSmrg fi 6732698f425bSmrg done 6733698f425bSmrg done 6734698f425bSmrg fi 6735698f425bSmrg if test -n "$a_deplib" ; then 6736698f425bSmrg droppeddeps=yes 6737698f425bSmrg $ECHO 6738698f425bSmrg $ECHO "*** Warning: linker path does not have real file for library $a_deplib." 6739698f425bSmrg $ECHO "*** I have the capability to make that library automatically link in when" 6740698f425bSmrg $ECHO "*** you link to this library. But I can only do this if you have a" 6741698f425bSmrg $ECHO "*** shared version of the library, which you do not appear to have" 6742698f425bSmrg $ECHO "*** because I did check the linker path looking for a file starting" 6743698f425bSmrg if test -z "$potlib" ; then 6744698f425bSmrg $ECHO "*** with $libname but no candidates were found. (...for regex pattern test)" 6745698f425bSmrg else 6746698f425bSmrg $ECHO "*** with $libname and none of the candidates passed a file format test" 6747698f425bSmrg $ECHO "*** using a regex pattern. Last file checked: $potlib" 6748698f425bSmrg fi 6749698f425bSmrg fi 6750698f425bSmrg ;; 6751698f425bSmrg *) 6752698f425bSmrg # Add a -L argument. 6753698f425bSmrg newdeplibs="$newdeplibs $a_deplib" 6754698f425bSmrg ;; 6755698f425bSmrg esac 6756698f425bSmrg done # Gone through all deplibs. 6757698f425bSmrg ;; 6758698f425bSmrg none | unknown | *) 6759698f425bSmrg newdeplibs="" 6760698f425bSmrg tmp_deplibs=`$ECHO "X $deplibs" | $Xsed \ 6761698f425bSmrg -e 's/ -lc$//' -e 's/ -[LR][^ ]*//g'` 6762698f425bSmrg if test "X$allow_libtool_libs_with_static_runtimes" = "Xyes" ; then 6763698f425bSmrg for i in $predeps $postdeps ; do 6764698f425bSmrg # can't use Xsed below, because $i might contain '/' 6765698f425bSmrg tmp_deplibs=`$ECHO "X $tmp_deplibs" | $Xsed -e "s,$i,,"` 6766698f425bSmrg done 6767698f425bSmrg fi 6768698f425bSmrg if $ECHO "X $tmp_deplibs" | $Xsed -e 's/[ ]//g' | 6769698f425bSmrg $GREP . >/dev/null; then 6770698f425bSmrg $ECHO 6771698f425bSmrg if test "X$deplibs_check_method" = "Xnone"; then 6772698f425bSmrg $ECHO "*** Warning: inter-library dependencies are not supported in this platform." 6773698f425bSmrg else 6774698f425bSmrg $ECHO "*** Warning: inter-library dependencies are not known to be supported." 6775698f425bSmrg fi 6776698f425bSmrg $ECHO "*** All declared inter-library dependencies are being dropped." 6777698f425bSmrg droppeddeps=yes 6778698f425bSmrg fi 6779698f425bSmrg ;; 6780698f425bSmrg esac 6781698f425bSmrg versuffix=$versuffix_save 6782698f425bSmrg major=$major_save 6783698f425bSmrg release=$release_save 6784698f425bSmrg libname=$libname_save 6785698f425bSmrg name=$name_save 6786698f425bSmrg 6787698f425bSmrg case $host in 6788698f425bSmrg *-*-rhapsody* | *-*-darwin1.[012]) 6789698f425bSmrg # On Rhapsody replace the C library with the System framework 6790698f425bSmrg newdeplibs=`$ECHO "X $newdeplibs" | $Xsed -e 's/ -lc / System.ltframework /'` 6791698f425bSmrg ;; 6792698f425bSmrg esac 6793698f425bSmrg 6794698f425bSmrg if test "$droppeddeps" = yes; then 6795698f425bSmrg if test "$module" = yes; then 6796698f425bSmrg $ECHO 6797698f425bSmrg $ECHO "*** Warning: libtool could not satisfy all declared inter-library" 6798698f425bSmrg $ECHO "*** dependencies of module $libname. Therefore, libtool will create" 6799698f425bSmrg $ECHO "*** a static module, that should work as long as the dlopening" 6800698f425bSmrg $ECHO "*** application is linked with the -dlopen flag." 6801698f425bSmrg if test -z "$global_symbol_pipe"; then 6802698f425bSmrg $ECHO 6803698f425bSmrg $ECHO "*** However, this would only work if libtool was able to extract symbol" 6804698f425bSmrg $ECHO "*** lists from a program, using \`nm' or equivalent, but libtool could" 6805698f425bSmrg $ECHO "*** not find such a program. So, this module is probably useless." 6806698f425bSmrg $ECHO "*** \`nm' from GNU binutils and a full rebuild may help." 6807698f425bSmrg fi 6808698f425bSmrg if test "$build_old_libs" = no; then 6809698f425bSmrg oldlibs="$output_objdir/$libname.$libext" 6810698f425bSmrg build_libtool_libs=module 6811698f425bSmrg build_old_libs=yes 6812698f425bSmrg else 6813698f425bSmrg build_libtool_libs=no 6814698f425bSmrg fi 6815698f425bSmrg else 6816698f425bSmrg $ECHO "*** The inter-library dependencies that have been dropped here will be" 6817698f425bSmrg $ECHO "*** automatically added whenever a program is linked with this library" 6818698f425bSmrg $ECHO "*** or is declared to -dlopen it." 6819698f425bSmrg 6820698f425bSmrg if test "$allow_undefined" = no; then 6821698f425bSmrg $ECHO 6822698f425bSmrg $ECHO "*** Since this library must not contain undefined symbols," 6823698f425bSmrg $ECHO "*** because either the platform does not support them or" 6824698f425bSmrg $ECHO "*** it was explicitly requested with -no-undefined," 6825698f425bSmrg $ECHO "*** libtool will only create a static version of it." 6826698f425bSmrg if test "$build_old_libs" = no; then 6827698f425bSmrg oldlibs="$output_objdir/$libname.$libext" 6828698f425bSmrg build_libtool_libs=module 6829698f425bSmrg build_old_libs=yes 6830698f425bSmrg else 6831698f425bSmrg build_libtool_libs=no 6832698f425bSmrg fi 6833698f425bSmrg fi 6834698f425bSmrg fi 6835698f425bSmrg fi 6836698f425bSmrg # Done checking deplibs! 6837698f425bSmrg deplibs=$newdeplibs 6838698f425bSmrg fi 6839698f425bSmrg # Time to change all our "foo.ltframework" stuff back to "-framework foo" 6840698f425bSmrg case $host in 6841698f425bSmrg *-*-darwin*) 6842698f425bSmrg newdeplibs=`$ECHO "X $newdeplibs" | $Xsed -e 's% \([^ $]*\).ltframework% -framework \1%g'` 6843698f425bSmrg new_inherited_linker_flags=`$ECHO "X $new_inherited_linker_flags" | $Xsed -e 's% \([^ $]*\).ltframework% -framework \1%g'` 6844698f425bSmrg deplibs=`$ECHO "X $deplibs" | $Xsed -e 's% \([^ $]*\).ltframework% -framework \1%g'` 6845698f425bSmrg ;; 6846698f425bSmrg esac 6847698f425bSmrg 6848698f425bSmrg # move library search paths that coincide with paths to not yet 6849698f425bSmrg # installed libraries to the beginning of the library search list 6850698f425bSmrg new_libs= 6851698f425bSmrg for path in $notinst_path; do 6852698f425bSmrg case " $new_libs " in 6853698f425bSmrg *" -L$path/$objdir "*) ;; 6854698f425bSmrg *) 6855698f425bSmrg case " $deplibs " in 6856698f425bSmrg *" -L$path/$objdir "*) 6857698f425bSmrg new_libs="$new_libs -L$path/$objdir" ;; 6858698f425bSmrg esac 6859698f425bSmrg ;; 6860698f425bSmrg esac 6861698f425bSmrg done 6862698f425bSmrg for deplib in $deplibs; do 6863698f425bSmrg case $deplib in 6864698f425bSmrg -L*) 6865698f425bSmrg case " $new_libs " in 6866698f425bSmrg *" $deplib "*) ;; 6867698f425bSmrg *) new_libs="$new_libs $deplib" ;; 6868698f425bSmrg esac 6869698f425bSmrg ;; 6870698f425bSmrg *) new_libs="$new_libs $deplib" ;; 6871698f425bSmrg esac 6872698f425bSmrg done 6873698f425bSmrg deplibs="$new_libs" 6874698f425bSmrg 6875698f425bSmrg # All the library-specific variables (install_libdir is set above). 6876698f425bSmrg library_names= 6877698f425bSmrg old_library= 6878698f425bSmrg dlname= 6879698f425bSmrg 6880698f425bSmrg # Test again, we may have decided not to build it any more 6881698f425bSmrg if test "$build_libtool_libs" = yes; then 6882698f425bSmrg if test "$hardcode_into_libs" = yes; then 6883698f425bSmrg # Hardcode the library paths 6884698f425bSmrg hardcode_libdirs= 6885698f425bSmrg dep_rpath= 6886698f425bSmrg rpath="$finalize_rpath" 6887698f425bSmrg test "$mode" != relink && rpath="$compile_rpath$rpath" 6888698f425bSmrg for libdir in $rpath; do 6889698f425bSmrg if test -n "$hardcode_libdir_flag_spec"; then 6890698f425bSmrg if test -n "$hardcode_libdir_separator"; then 6891698f425bSmrg if test -z "$hardcode_libdirs"; then 6892698f425bSmrg hardcode_libdirs="$libdir" 6893698f425bSmrg else 6894698f425bSmrg # Just accumulate the unique libdirs. 6895698f425bSmrg case $hardcode_libdir_separator$hardcode_libdirs$hardcode_libdir_separator in 6896698f425bSmrg *"$hardcode_libdir_separator$libdir$hardcode_libdir_separator"*) 6897698f425bSmrg ;; 6898698f425bSmrg *) 6899698f425bSmrg hardcode_libdirs="$hardcode_libdirs$hardcode_libdir_separator$libdir" 6900698f425bSmrg ;; 6901698f425bSmrg esac 6902698f425bSmrg fi 6903698f425bSmrg else 6904698f425bSmrg eval flag=\"$hardcode_libdir_flag_spec\" 6905698f425bSmrg dep_rpath="$dep_rpath $flag" 6906698f425bSmrg fi 6907698f425bSmrg elif test -n "$runpath_var"; then 6908698f425bSmrg case "$perm_rpath " in 6909698f425bSmrg *" $libdir "*) ;; 6910698f425bSmrg *) perm_rpath="$perm_rpath $libdir" ;; 6911698f425bSmrg esac 6912698f425bSmrg fi 6913698f425bSmrg done 6914698f425bSmrg # Substitute the hardcoded libdirs into the rpath. 6915698f425bSmrg if test -n "$hardcode_libdir_separator" && 6916698f425bSmrg test -n "$hardcode_libdirs"; then 6917698f425bSmrg libdir="$hardcode_libdirs" 6918698f425bSmrg if test -n "$hardcode_libdir_flag_spec_ld"; then 6919698f425bSmrg eval dep_rpath=\"$hardcode_libdir_flag_spec_ld\" 6920698f425bSmrg else 6921698f425bSmrg eval dep_rpath=\"$hardcode_libdir_flag_spec\" 6922698f425bSmrg fi 6923698f425bSmrg fi 6924698f425bSmrg if test -n "$runpath_var" && test -n "$perm_rpath"; then 6925698f425bSmrg # We should set the runpath_var. 6926698f425bSmrg rpath= 6927698f425bSmrg for dir in $perm_rpath; do 6928698f425bSmrg rpath="$rpath$dir:" 6929698f425bSmrg done 6930698f425bSmrg eval "$runpath_var='$rpath\$$runpath_var'; export $runpath_var" 6931698f425bSmrg fi 6932698f425bSmrg test -n "$dep_rpath" && deplibs="$dep_rpath $deplibs" 6933698f425bSmrg fi 6934266e564dSmrg 6935698f425bSmrg shlibpath="$finalize_shlibpath" 6936698f425bSmrg test "$mode" != relink && shlibpath="$compile_shlibpath$shlibpath" 6937698f425bSmrg if test -n "$shlibpath"; then 6938698f425bSmrg eval "$shlibpath_var='$shlibpath\$$shlibpath_var'; export $shlibpath_var" 6939698f425bSmrg fi 6940266e564dSmrg 6941698f425bSmrg # Get the real and link names of the library. 6942698f425bSmrg eval shared_ext=\"$shrext_cmds\" 6943698f425bSmrg eval library_names=\"$library_names_spec\" 6944698f425bSmrg set dummy $library_names 6945698f425bSmrg shift 6946698f425bSmrg realname="$1" 6947698f425bSmrg shift 6948266e564dSmrg 6949698f425bSmrg if test -n "$soname_spec"; then 6950698f425bSmrg eval soname=\"$soname_spec\" 6951698f425bSmrg else 6952698f425bSmrg soname="$realname" 6953698f425bSmrg fi 6954698f425bSmrg if test -z "$dlname"; then 6955698f425bSmrg dlname=$soname 6956698f425bSmrg fi 6957266e564dSmrg 6958698f425bSmrg lib="$output_objdir/$realname" 6959698f425bSmrg linknames= 6960698f425bSmrg for link 6961698f425bSmrg do 6962698f425bSmrg linknames="$linknames $link" 6963698f425bSmrg done 6964266e564dSmrg 6965698f425bSmrg # Use standard objects if they are pic 6966698f425bSmrg test -z "$pic_flag" && libobjs=`$ECHO "X$libobjs" | $SP2NL | $Xsed -e "$lo2o" | $NL2SP` 6967698f425bSmrg test "X$libobjs" = "X " && libobjs= 6968266e564dSmrg 6969698f425bSmrg delfiles= 6970698f425bSmrg if test -n "$export_symbols" && test -n "$include_expsyms"; then 6971698f425bSmrg $opt_dry_run || cp "$export_symbols" "$output_objdir/$libname.uexp" 6972698f425bSmrg export_symbols="$output_objdir/$libname.uexp" 6973698f425bSmrg delfiles="$delfiles $export_symbols" 6974698f425bSmrg fi 6975266e564dSmrg 6976698f425bSmrg orig_export_symbols= 6977698f425bSmrg case $host_os in 6978698f425bSmrg cygwin* | mingw* | cegcc*) 6979698f425bSmrg if test -n "$export_symbols" && test -z "$export_symbols_regex"; then 6980698f425bSmrg # exporting using user supplied symfile 6981698f425bSmrg if test "x`$SED 1q $export_symbols`" != xEXPORTS; then 6982698f425bSmrg # and it's NOT already a .def file. Must figure out 6983698f425bSmrg # which of the given symbols are data symbols and tag 6984698f425bSmrg # them as such. So, trigger use of export_symbols_cmds. 6985698f425bSmrg # export_symbols gets reassigned inside the "prepare 6986698f425bSmrg # the list of exported symbols" if statement, so the 6987698f425bSmrg # include_expsyms logic still works. 6988698f425bSmrg orig_export_symbols="$export_symbols" 6989698f425bSmrg export_symbols= 6990698f425bSmrg always_export_symbols=yes 6991698f425bSmrg fi 6992698f425bSmrg fi 6993698f425bSmrg ;; 6994698f425bSmrg esac 6995266e564dSmrg 6996698f425bSmrg # Prepare the list of exported symbols 6997698f425bSmrg if test -z "$export_symbols"; then 6998698f425bSmrg if test "$always_export_symbols" = yes || test -n "$export_symbols_regex"; then 6999698f425bSmrg func_verbose "generating symbol list for \`$libname.la'" 7000698f425bSmrg export_symbols="$output_objdir/$libname.exp" 7001698f425bSmrg $opt_dry_run || $RM $export_symbols 7002698f425bSmrg cmds=$export_symbols_cmds 7003698f425bSmrg save_ifs="$IFS"; IFS='~' 7004698f425bSmrg for cmd in $cmds; do 7005698f425bSmrg IFS="$save_ifs" 7006698f425bSmrg eval cmd=\"$cmd\" 7007698f425bSmrg func_len " $cmd" 7008698f425bSmrg len=$func_len_result 7009698f425bSmrg if test "$len" -lt "$max_cmd_len" || test "$max_cmd_len" -le -1; then 7010698f425bSmrg func_show_eval "$cmd" 'exit $?' 7011698f425bSmrg skipped_export=false 7012698f425bSmrg else 7013698f425bSmrg # The command line is too long to execute in one step. 7014698f425bSmrg func_verbose "using reloadable object file for export list..." 7015698f425bSmrg skipped_export=: 7016698f425bSmrg # Break out early, otherwise skipped_export may be 7017698f425bSmrg # set to false by a later but shorter cmd. 7018698f425bSmrg break 7019698f425bSmrg fi 7020698f425bSmrg done 7021698f425bSmrg IFS="$save_ifs" 7022698f425bSmrg if test -n "$export_symbols_regex" && test "X$skipped_export" != "X:"; then 7023698f425bSmrg func_show_eval '$EGREP -e "$export_symbols_regex" "$export_symbols" > "${export_symbols}T"' 7024698f425bSmrg func_show_eval '$MV "${export_symbols}T" "$export_symbols"' 7025698f425bSmrg fi 7026698f425bSmrg fi 7027266e564dSmrg fi 7028266e564dSmrg 7029698f425bSmrg if test -n "$export_symbols" && test -n "$include_expsyms"; then 7030698f425bSmrg tmp_export_symbols="$export_symbols" 7031698f425bSmrg test -n "$orig_export_symbols" && tmp_export_symbols="$orig_export_symbols" 7032698f425bSmrg $opt_dry_run || eval '$ECHO "X$include_expsyms" | $Xsed | $SP2NL >> "$tmp_export_symbols"' 7033698f425bSmrg fi 7034266e564dSmrg 7035698f425bSmrg if test "X$skipped_export" != "X:" && test -n "$orig_export_symbols"; then 7036698f425bSmrg # The given exports_symbols file has to be filtered, so filter it. 7037698f425bSmrg func_verbose "filter symbol list for \`$libname.la' to tag DATA exports" 7038698f425bSmrg # FIXME: $output_objdir/$libname.filter potentially contains lots of 7039698f425bSmrg # 's' commands which not all seds can handle. GNU sed should be fine 7040698f425bSmrg # though. Also, the filter scales superlinearly with the number of 7041698f425bSmrg # global variables. join(1) would be nice here, but unfortunately 7042698f425bSmrg # isn't a blessed tool. 7043698f425bSmrg $opt_dry_run || $SED -e '/[ ,]DATA/!d;s,\(.*\)\([ \,].*\),s|^\1$|\1\2|,' < $export_symbols > $output_objdir/$libname.filter 7044698f425bSmrg delfiles="$delfiles $export_symbols $output_objdir/$libname.filter" 7045698f425bSmrg export_symbols=$output_objdir/$libname.def 7046698f425bSmrg $opt_dry_run || $SED -f $output_objdir/$libname.filter < $orig_export_symbols > $export_symbols 7047698f425bSmrg fi 7048266e564dSmrg 7049698f425bSmrg tmp_deplibs= 7050698f425bSmrg for test_deplib in $deplibs; do 7051698f425bSmrg case " $convenience " in 7052698f425bSmrg *" $test_deplib "*) ;; 7053698f425bSmrg *) 7054698f425bSmrg tmp_deplibs="$tmp_deplibs $test_deplib" 7055698f425bSmrg ;; 7056698f425bSmrg esac 7057698f425bSmrg done 7058698f425bSmrg deplibs="$tmp_deplibs" 7059266e564dSmrg 7060698f425bSmrg if test -n "$convenience"; then 7061698f425bSmrg if test -n "$whole_archive_flag_spec" && 7062698f425bSmrg test "$compiler_needs_object" = yes && 7063698f425bSmrg test -z "$libobjs"; then 7064698f425bSmrg # extract the archives, so we have objects to list. 7065698f425bSmrg # TODO: could optimize this to just extract one archive. 7066698f425bSmrg whole_archive_flag_spec= 7067698f425bSmrg fi 7068698f425bSmrg if test -n "$whole_archive_flag_spec"; then 7069698f425bSmrg save_libobjs=$libobjs 7070698f425bSmrg eval libobjs=\"\$libobjs $whole_archive_flag_spec\" 7071698f425bSmrg test "X$libobjs" = "X " && libobjs= 7072698f425bSmrg else 7073698f425bSmrg gentop="$output_objdir/${outputname}x" 7074698f425bSmrg generated="$generated $gentop" 7075266e564dSmrg 7076698f425bSmrg func_extract_archives $gentop $convenience 7077698f425bSmrg libobjs="$libobjs $func_extract_archives_result" 7078698f425bSmrg test "X$libobjs" = "X " && libobjs= 7079698f425bSmrg fi 7080266e564dSmrg fi 7081266e564dSmrg 7082698f425bSmrg if test "$thread_safe" = yes && test -n "$thread_safe_flag_spec"; then 7083698f425bSmrg eval flag=\"$thread_safe_flag_spec\" 7084698f425bSmrg linker_flags="$linker_flags $flag" 7085266e564dSmrg fi 7086266e564dSmrg 7087698f425bSmrg # Make a backup of the uninstalled library when relinking 7088698f425bSmrg if test "$mode" = relink; then 7089698f425bSmrg $opt_dry_run || eval '(cd $output_objdir && $RM ${realname}U && $MV $realname ${realname}U)' || exit $? 7090698f425bSmrg fi 7091266e564dSmrg 7092698f425bSmrg # Do each of the archive commands. 7093698f425bSmrg if test "$module" = yes && test -n "$module_cmds" ; then 7094698f425bSmrg if test -n "$export_symbols" && test -n "$module_expsym_cmds"; then 7095698f425bSmrg eval test_cmds=\"$module_expsym_cmds\" 7096698f425bSmrg cmds=$module_expsym_cmds 7097698f425bSmrg else 7098698f425bSmrg eval test_cmds=\"$module_cmds\" 7099698f425bSmrg cmds=$module_cmds 7100698f425bSmrg fi 7101266e564dSmrg else 7102698f425bSmrg if test -n "$export_symbols" && test -n "$archive_expsym_cmds"; then 7103698f425bSmrg eval test_cmds=\"$archive_expsym_cmds\" 7104698f425bSmrg cmds=$archive_expsym_cmds 7105698f425bSmrg else 7106698f425bSmrg eval test_cmds=\"$archive_cmds\" 7107698f425bSmrg cmds=$archive_cmds 7108698f425bSmrg fi 7109266e564dSmrg fi 7110266e564dSmrg 7111698f425bSmrg if test "X$skipped_export" != "X:" && 7112698f425bSmrg func_len " $test_cmds" && 7113698f425bSmrg len=$func_len_result && 7114698f425bSmrg test "$len" -lt "$max_cmd_len" || test "$max_cmd_len" -le -1; then 7115698f425bSmrg : 7116698f425bSmrg else 7117698f425bSmrg # The command line is too long to link in one step, link piecewise 7118698f425bSmrg # or, if using GNU ld and skipped_export is not :, use a linker 7119698f425bSmrg # script. 7120266e564dSmrg 7121698f425bSmrg # Save the value of $output and $libobjs because we want to 7122698f425bSmrg # use them later. If we have whole_archive_flag_spec, we 7123698f425bSmrg # want to use save_libobjs as it was before 7124698f425bSmrg # whole_archive_flag_spec was expanded, because we can't 7125698f425bSmrg # assume the linker understands whole_archive_flag_spec. 7126698f425bSmrg # This may have to be revisited, in case too many 7127698f425bSmrg # convenience libraries get linked in and end up exceeding 7128698f425bSmrg # the spec. 7129698f425bSmrg if test -z "$convenience" || test -z "$whole_archive_flag_spec"; then 7130698f425bSmrg save_libobjs=$libobjs 7131698f425bSmrg fi 7132698f425bSmrg save_output=$output 7133698f425bSmrg output_la=`$ECHO "X$output" | $Xsed -e "$basename"` 7134266e564dSmrg 7135698f425bSmrg # Clear the reloadable object creation command queue and 7136698f425bSmrg # initialize k to one. 7137698f425bSmrg test_cmds= 7138698f425bSmrg concat_cmds= 7139698f425bSmrg objlist= 7140698f425bSmrg last_robj= 7141698f425bSmrg k=1 7142698f425bSmrg 7143698f425bSmrg if test -n "$save_libobjs" && test "X$skipped_export" != "X:" && test "$with_gnu_ld" = yes; then 7144698f425bSmrg output=${output_objdir}/${output_la}.lnkscript 7145698f425bSmrg func_verbose "creating GNU ld script: $output" 7146698f425bSmrg $ECHO 'INPUT (' > $output 7147698f425bSmrg for obj in $save_libobjs 7148266e564dSmrg do 7149698f425bSmrg $ECHO "$obj" >> $output 7150698f425bSmrg done 7151698f425bSmrg $ECHO ')' >> $output 7152698f425bSmrg delfiles="$delfiles $output" 7153698f425bSmrg elif test -n "$save_libobjs" && test "X$skipped_export" != "X:" && test "X$file_list_spec" != X; then 7154698f425bSmrg output=${output_objdir}/${output_la}.lnk 7155698f425bSmrg func_verbose "creating linker input file list: $output" 7156698f425bSmrg : > $output 7157698f425bSmrg set x $save_libobjs 7158698f425bSmrg shift 7159698f425bSmrg firstobj= 7160698f425bSmrg if test "$compiler_needs_object" = yes; then 7161698f425bSmrg firstobj="$1 " 7162698f425bSmrg shift 7163698f425bSmrg fi 7164698f425bSmrg for obj 7165698f425bSmrg do 7166698f425bSmrg $ECHO "$obj" >> $output 7167698f425bSmrg done 7168698f425bSmrg delfiles="$delfiles $output" 7169698f425bSmrg output=$firstobj\"$file_list_spec$output\" 7170698f425bSmrg else 7171698f425bSmrg if test -n "$save_libobjs"; then 7172698f425bSmrg func_verbose "creating reloadable object files..." 7173698f425bSmrg output=$output_objdir/$output_la-${k}.$objext 7174698f425bSmrg eval test_cmds=\"$reload_cmds\" 7175698f425bSmrg func_len " $test_cmds" 7176698f425bSmrg len0=$func_len_result 7177698f425bSmrg len=$len0 7178698f425bSmrg 7179698f425bSmrg # Loop over the list of objects to be linked. 7180698f425bSmrg for obj in $save_libobjs 7181698f425bSmrg do 7182698f425bSmrg func_len " $obj" 7183698f425bSmrg func_arith $len + $func_len_result 7184698f425bSmrg len=$func_arith_result 7185698f425bSmrg if test "X$objlist" = X || 7186698f425bSmrg test "$len" -lt "$max_cmd_len"; then 7187698f425bSmrg func_append objlist " $obj" 7188698f425bSmrg else 7189698f425bSmrg # The command $test_cmds is almost too long, add a 7190698f425bSmrg # command to the queue. 7191698f425bSmrg if test "$k" -eq 1 ; then 7192698f425bSmrg # The first file doesn't have a previous command to add. 7193698f425bSmrg eval concat_cmds=\"$reload_cmds $objlist $last_robj\" 7194698f425bSmrg else 7195698f425bSmrg # All subsequent reloadable object files will link in 7196698f425bSmrg # the last one created. 7197698f425bSmrg eval concat_cmds=\"\$concat_cmds~$reload_cmds $objlist $last_robj~\$RM $last_robj\" 7198698f425bSmrg fi 7199698f425bSmrg last_robj=$output_objdir/$output_la-${k}.$objext 7200698f425bSmrg func_arith $k + 1 7201698f425bSmrg k=$func_arith_result 7202698f425bSmrg output=$output_objdir/$output_la-${k}.$objext 7203698f425bSmrg objlist=$obj 7204698f425bSmrg func_len " $last_robj" 7205698f425bSmrg func_arith $len0 + $func_len_result 7206698f425bSmrg len=$func_arith_result 7207698f425bSmrg fi 7208698f425bSmrg done 7209698f425bSmrg # Handle the remaining objects by creating one last 7210698f425bSmrg # reloadable object file. All subsequent reloadable object 7211698f425bSmrg # files will link in the last one created. 7212698f425bSmrg test -z "$concat_cmds" || concat_cmds=$concat_cmds~ 7213698f425bSmrg eval concat_cmds=\"\${concat_cmds}$reload_cmds $objlist $last_robj\" 7214698f425bSmrg if test -n "$last_robj"; then 7215698f425bSmrg eval concat_cmds=\"\${concat_cmds}~\$RM $last_robj\" 7216698f425bSmrg fi 7217698f425bSmrg delfiles="$delfiles $output" 7218266e564dSmrg 7219698f425bSmrg else 7220698f425bSmrg output= 7221698f425bSmrg fi 7222266e564dSmrg 7223698f425bSmrg if ${skipped_export-false}; then 7224698f425bSmrg func_verbose "generating symbol list for \`$libname.la'" 7225698f425bSmrg export_symbols="$output_objdir/$libname.exp" 7226698f425bSmrg $opt_dry_run || $RM $export_symbols 7227698f425bSmrg libobjs=$output 7228698f425bSmrg # Append the command to create the export file. 7229698f425bSmrg test -z "$concat_cmds" || concat_cmds=$concat_cmds~ 7230698f425bSmrg eval concat_cmds=\"\$concat_cmds$export_symbols_cmds\" 7231698f425bSmrg if test -n "$last_robj"; then 7232698f425bSmrg eval concat_cmds=\"\$concat_cmds~\$RM $last_robj\" 7233698f425bSmrg fi 7234266e564dSmrg fi 7235266e564dSmrg 7236698f425bSmrg test -n "$save_libobjs" && 7237698f425bSmrg func_verbose "creating a temporary reloadable object file: $output" 7238266e564dSmrg 7239698f425bSmrg # Loop through the commands generated above and execute them. 7240698f425bSmrg save_ifs="$IFS"; IFS='~' 7241698f425bSmrg for cmd in $concat_cmds; do 7242698f425bSmrg IFS="$save_ifs" 7243698f425bSmrg $opt_silent || { 7244698f425bSmrg func_quote_for_expand "$cmd" 7245698f425bSmrg eval "func_echo $func_quote_for_expand_result" 7246698f425bSmrg } 7247698f425bSmrg $opt_dry_run || eval "$cmd" || { 7248698f425bSmrg lt_exit=$? 7249698f425bSmrg 7250698f425bSmrg # Restore the uninstalled library and exit 7251698f425bSmrg if test "$mode" = relink; then 7252698f425bSmrg ( cd "$output_objdir" && \ 7253698f425bSmrg $RM "${realname}T" && \ 7254698f425bSmrg $MV "${realname}U" "$realname" ) 7255698f425bSmrg fi 7256266e564dSmrg 7257698f425bSmrg exit $lt_exit 7258698f425bSmrg } 7259698f425bSmrg done 7260698f425bSmrg IFS="$save_ifs" 7261266e564dSmrg 7262698f425bSmrg if test -n "$export_symbols_regex" && ${skipped_export-false}; then 7263698f425bSmrg func_show_eval '$EGREP -e "$export_symbols_regex" "$export_symbols" > "${export_symbols}T"' 7264698f425bSmrg func_show_eval '$MV "${export_symbols}T" "$export_symbols"' 7265266e564dSmrg fi 7266266e564dSmrg fi 7267266e564dSmrg 7268698f425bSmrg if ${skipped_export-false}; then 7269698f425bSmrg if test -n "$export_symbols" && test -n "$include_expsyms"; then 7270698f425bSmrg tmp_export_symbols="$export_symbols" 7271698f425bSmrg test -n "$orig_export_symbols" && tmp_export_symbols="$orig_export_symbols" 7272698f425bSmrg $opt_dry_run || eval '$ECHO "X$include_expsyms" | $Xsed | $SP2NL >> "$tmp_export_symbols"' 7273698f425bSmrg fi 7274266e564dSmrg 7275698f425bSmrg if test -n "$orig_export_symbols"; then 7276698f425bSmrg # The given exports_symbols file has to be filtered, so filter it. 7277698f425bSmrg func_verbose "filter symbol list for \`$libname.la' to tag DATA exports" 7278698f425bSmrg # FIXME: $output_objdir/$libname.filter potentially contains lots of 7279698f425bSmrg # 's' commands which not all seds can handle. GNU sed should be fine 7280698f425bSmrg # though. Also, the filter scales superlinearly with the number of 7281698f425bSmrg # global variables. join(1) would be nice here, but unfortunately 7282698f425bSmrg # isn't a blessed tool. 7283698f425bSmrg $opt_dry_run || $SED -e '/[ ,]DATA/!d;s,\(.*\)\([ \,].*\),s|^\1$|\1\2|,' < $export_symbols > $output_objdir/$libname.filter 7284698f425bSmrg delfiles="$delfiles $export_symbols $output_objdir/$libname.filter" 7285698f425bSmrg export_symbols=$output_objdir/$libname.def 7286698f425bSmrg $opt_dry_run || $SED -f $output_objdir/$libname.filter < $orig_export_symbols > $export_symbols 7287698f425bSmrg fi 7288698f425bSmrg fi 7289266e564dSmrg 7290698f425bSmrg libobjs=$output 7291698f425bSmrg # Restore the value of output. 7292698f425bSmrg output=$save_output 7293266e564dSmrg 7294698f425bSmrg if test -n "$convenience" && test -n "$whole_archive_flag_spec"; then 7295698f425bSmrg eval libobjs=\"\$libobjs $whole_archive_flag_spec\" 7296698f425bSmrg test "X$libobjs" = "X " && libobjs= 7297698f425bSmrg fi 7298698f425bSmrg # Expand the library linking commands again to reset the 7299698f425bSmrg # value of $libobjs for piecewise linking. 7300266e564dSmrg 7301698f425bSmrg # Do each of the archive commands. 7302698f425bSmrg if test "$module" = yes && test -n "$module_cmds" ; then 7303698f425bSmrg if test -n "$export_symbols" && test -n "$module_expsym_cmds"; then 7304698f425bSmrg cmds=$module_expsym_cmds 7305698f425bSmrg else 7306698f425bSmrg cmds=$module_cmds 7307266e564dSmrg fi 7308266e564dSmrg else 7309698f425bSmrg if test -n "$export_symbols" && test -n "$archive_expsym_cmds"; then 7310698f425bSmrg cmds=$archive_expsym_cmds 7311698f425bSmrg else 7312698f425bSmrg cmds=$archive_cmds 7313698f425bSmrg fi 7314266e564dSmrg fi 7315698f425bSmrg fi 7316266e564dSmrg 7317698f425bSmrg if test -n "$delfiles"; then 7318698f425bSmrg # Append the command to remove temporary files to $cmds. 7319698f425bSmrg eval cmds=\"\$cmds~\$RM $delfiles\" 7320698f425bSmrg fi 7321266e564dSmrg 7322698f425bSmrg # Add any objects from preloaded convenience libraries 7323698f425bSmrg if test -n "$dlprefiles"; then 7324698f425bSmrg gentop="$output_objdir/${outputname}x" 7325698f425bSmrg generated="$generated $gentop" 7326266e564dSmrg 7327698f425bSmrg func_extract_archives $gentop $dlprefiles 7328698f425bSmrg libobjs="$libobjs $func_extract_archives_result" 7329698f425bSmrg test "X$libobjs" = "X " && libobjs= 7330698f425bSmrg fi 7331266e564dSmrg 7332698f425bSmrg save_ifs="$IFS"; IFS='~' 7333698f425bSmrg for cmd in $cmds; do 7334698f425bSmrg IFS="$save_ifs" 7335698f425bSmrg eval cmd=\"$cmd\" 7336698f425bSmrg $opt_silent || { 7337698f425bSmrg func_quote_for_expand "$cmd" 7338698f425bSmrg eval "func_echo $func_quote_for_expand_result" 7339698f425bSmrg } 7340698f425bSmrg $opt_dry_run || eval "$cmd" || { 7341698f425bSmrg lt_exit=$? 7342266e564dSmrg 7343698f425bSmrg # Restore the uninstalled library and exit 7344698f425bSmrg if test "$mode" = relink; then 7345698f425bSmrg ( cd "$output_objdir" && \ 7346698f425bSmrg $RM "${realname}T" && \ 7347698f425bSmrg $MV "${realname}U" "$realname" ) 7348698f425bSmrg fi 7349266e564dSmrg 7350698f425bSmrg exit $lt_exit 7351698f425bSmrg } 7352698f425bSmrg done 7353698f425bSmrg IFS="$save_ifs" 7354266e564dSmrg 7355698f425bSmrg # Restore the uninstalled library and exit 7356698f425bSmrg if test "$mode" = relink; then 7357698f425bSmrg $opt_dry_run || eval '(cd $output_objdir && $RM ${realname}T && $MV $realname ${realname}T && $MV ${realname}U $realname)' || exit $? 7358266e564dSmrg 7359698f425bSmrg if test -n "$convenience"; then 7360698f425bSmrg if test -z "$whole_archive_flag_spec"; then 7361698f425bSmrg func_show_eval '${RM}r "$gentop"' 7362698f425bSmrg fi 7363698f425bSmrg fi 7364266e564dSmrg 7365698f425bSmrg exit $EXIT_SUCCESS 7366698f425bSmrg fi 7367698f425bSmrg 7368698f425bSmrg # Create links to the real library. 7369698f425bSmrg for linkname in $linknames; do 7370698f425bSmrg if test "$realname" != "$linkname"; then 7371698f425bSmrg func_show_eval '(cd "$output_objdir" && $RM "$linkname" && $LN_S "$realname" "$linkname")' 'exit $?' 7372266e564dSmrg fi 7373266e564dSmrg done 7374266e564dSmrg 7375698f425bSmrg # If -module or -export-dynamic was specified, set the dlname. 7376698f425bSmrg if test "$module" = yes || test "$export_dynamic" = yes; then 7377698f425bSmrg # On all known operating systems, these are identical. 7378698f425bSmrg dlname="$soname" 7379698f425bSmrg fi 7380698f425bSmrg fi 7381266e564dSmrg ;; 7382266e564dSmrg 7383698f425bSmrg obj) 7384698f425bSmrg if test -n "$dlfiles$dlprefiles" || test "$dlself" != no; then 7385698f425bSmrg func_warning "\`-dlopen' is ignored for objects" 7386698f425bSmrg fi 7387266e564dSmrg 7388698f425bSmrg case " $deplibs" in 7389698f425bSmrg *\ -l* | *\ -L*) 7390698f425bSmrg func_warning "\`-l' and \`-L' are ignored for objects" ;; 7391266e564dSmrg esac 7392266e564dSmrg 7393698f425bSmrg test -n "$rpath" && \ 7394698f425bSmrg func_warning "\`-rpath' is ignored for objects" 7395698f425bSmrg 7396698f425bSmrg test -n "$xrpath" && \ 7397698f425bSmrg func_warning "\`-R' is ignored for objects" 7398266e564dSmrg 7399698f425bSmrg test -n "$vinfo" && \ 7400698f425bSmrg func_warning "\`-version-info' is ignored for objects" 7401266e564dSmrg 7402698f425bSmrg test -n "$release" && \ 7403698f425bSmrg func_warning "\`-release' is ignored for objects" 7404698f425bSmrg 7405698f425bSmrg case $output in 7406698f425bSmrg *.lo) 7407698f425bSmrg test -n "$objs$old_deplibs" && \ 7408698f425bSmrg func_fatal_error "cannot build library object \`$output' from non-libtool objects" 7409698f425bSmrg 7410698f425bSmrg libobj=$output 7411698f425bSmrg func_lo2o "$libobj" 7412698f425bSmrg obj=$func_lo2o_result 7413266e564dSmrg ;; 7414266e564dSmrg *) 7415698f425bSmrg libobj= 7416698f425bSmrg obj="$output" 7417266e564dSmrg ;; 7418266e564dSmrg esac 7419266e564dSmrg 7420698f425bSmrg # Delete the old objects. 7421698f425bSmrg $opt_dry_run || $RM $obj $libobj 7422266e564dSmrg 7423698f425bSmrg # Objects from convenience libraries. This assumes 7424698f425bSmrg # single-version convenience libraries. Whenever we create 7425698f425bSmrg # different ones for PIC/non-PIC, this we'll have to duplicate 7426698f425bSmrg # the extraction. 7427698f425bSmrg reload_conv_objs= 7428698f425bSmrg gentop= 7429698f425bSmrg # reload_cmds runs $LD directly, so let us get rid of 7430698f425bSmrg # -Wl from whole_archive_flag_spec and hope we can get by with 7431698f425bSmrg # turning comma into space.. 7432698f425bSmrg wl= 7433266e564dSmrg 7434698f425bSmrg if test -n "$convenience"; then 7435698f425bSmrg if test -n "$whole_archive_flag_spec"; then 7436698f425bSmrg eval tmp_whole_archive_flags=\"$whole_archive_flag_spec\" 7437698f425bSmrg reload_conv_objs=$reload_objs\ `$ECHO "X$tmp_whole_archive_flags" | $Xsed -e 's|,| |g'` 7438698f425bSmrg else 7439698f425bSmrg gentop="$output_objdir/${obj}x" 7440698f425bSmrg generated="$generated $gentop" 7441266e564dSmrg 7442698f425bSmrg func_extract_archives $gentop $convenience 7443698f425bSmrg reload_conv_objs="$reload_objs $func_extract_archives_result" 7444698f425bSmrg fi 7445266e564dSmrg fi 7446266e564dSmrg 7447698f425bSmrg # Create the old-style object. 7448698f425bSmrg 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 7449266e564dSmrg 7450698f425bSmrg output="$obj" 7451698f425bSmrg func_execute_cmds "$reload_cmds" 'exit $?' 7452266e564dSmrg 7453698f425bSmrg # Exit if we aren't doing a library object file. 7454698f425bSmrg if test -z "$libobj"; then 7455698f425bSmrg if test -n "$gentop"; then 7456698f425bSmrg func_show_eval '${RM}r "$gentop"' 7457698f425bSmrg fi 7458698f425bSmrg 7459698f425bSmrg exit $EXIT_SUCCESS 7460266e564dSmrg fi 7461698f425bSmrg 7462698f425bSmrg if test "$build_libtool_libs" != yes; then 7463698f425bSmrg if test -n "$gentop"; then 7464698f425bSmrg func_show_eval '${RM}r "$gentop"' 7465698f425bSmrg fi 7466698f425bSmrg 7467698f425bSmrg # Create an invalid libtool object if no PIC, so that we don't 7468698f425bSmrg # accidentally link it into a program. 7469698f425bSmrg # $show "echo timestamp > $libobj" 7470698f425bSmrg # $opt_dry_run || eval "echo timestamp > $libobj" || exit $? 7471698f425bSmrg exit $EXIT_SUCCESS 7472698f425bSmrg fi 7473698f425bSmrg 7474698f425bSmrg if test -n "$pic_flag" || test "$pic_mode" != default; then 7475698f425bSmrg # Only do commands if we really have different PIC objects. 7476698f425bSmrg reload_objs="$libobjs $reload_conv_objs" 7477698f425bSmrg output="$libobj" 7478698f425bSmrg func_execute_cmds "$reload_cmds" 'exit $?' 7479698f425bSmrg fi 7480698f425bSmrg 7481698f425bSmrg if test -n "$gentop"; then 7482698f425bSmrg func_show_eval '${RM}r "$gentop"' 7483698f425bSmrg fi 7484698f425bSmrg 7485698f425bSmrg exit $EXIT_SUCCESS 7486266e564dSmrg ;; 7487266e564dSmrg 7488698f425bSmrg prog) 7489698f425bSmrg case $host in 7490698f425bSmrg *cygwin*) func_stripname '' '.exe' "$output" 7491698f425bSmrg output=$func_stripname_result.exe;; 7492698f425bSmrg esac 7493698f425bSmrg test -n "$vinfo" && \ 7494698f425bSmrg func_warning "\`-version-info' is ignored for programs" 7495266e564dSmrg 7496698f425bSmrg test -n "$release" && \ 7497698f425bSmrg func_warning "\`-release' is ignored for programs" 7498266e564dSmrg 7499698f425bSmrg test "$preload" = yes \ 7500698f425bSmrg && test "$dlopen_support" = unknown \ 7501698f425bSmrg && test "$dlopen_self" = unknown \ 7502698f425bSmrg && test "$dlopen_self_static" = unknown && \ 7503698f425bSmrg func_warning "\`LT_INIT([dlopen])' not used. Assuming no dlopen support." 7504698f425bSmrg 7505698f425bSmrg case $host in 7506698f425bSmrg *-*-rhapsody* | *-*-darwin1.[012]) 7507698f425bSmrg # On Rhapsody replace the C library is the System framework 7508698f425bSmrg compile_deplibs=`$ECHO "X $compile_deplibs" | $Xsed -e 's/ -lc / System.ltframework /'` 7509698f425bSmrg finalize_deplibs=`$ECHO "X $finalize_deplibs" | $Xsed -e 's/ -lc / System.ltframework /'` 7510266e564dSmrg ;; 7511698f425bSmrg esac 7512266e564dSmrg 7513698f425bSmrg case $host in 7514698f425bSmrg *-*-darwin*) 7515698f425bSmrg # Don't allow lazy linking, it breaks C++ global constructors 7516698f425bSmrg # But is supposedly fixed on 10.4 or later (yay!). 7517698f425bSmrg if test "$tagname" = CXX ; then 7518698f425bSmrg case ${MACOSX_DEPLOYMENT_TARGET-10.0} in 7519698f425bSmrg 10.[0123]) 7520698f425bSmrg compile_command="$compile_command ${wl}-bind_at_load" 7521698f425bSmrg finalize_command="$finalize_command ${wl}-bind_at_load" 7522698f425bSmrg ;; 7523698f425bSmrg esac 7524266e564dSmrg fi 7525698f425bSmrg # Time to change all our "foo.ltframework" stuff back to "-framework foo" 7526698f425bSmrg compile_deplibs=`$ECHO "X $compile_deplibs" | $Xsed -e 's% \([^ $]*\).ltframework% -framework \1%g'` 7527698f425bSmrg finalize_deplibs=`$ECHO "X $finalize_deplibs" | $Xsed -e 's% \([^ $]*\).ltframework% -framework \1%g'` 7528698f425bSmrg ;; 7529698f425bSmrg esac 7530266e564dSmrg 7531266e564dSmrg 7532698f425bSmrg # move library search paths that coincide with paths to not yet 7533698f425bSmrg # installed libraries to the beginning of the library search list 7534698f425bSmrg new_libs= 7535698f425bSmrg for path in $notinst_path; do 7536698f425bSmrg case " $new_libs " in 7537698f425bSmrg *" -L$path/$objdir "*) ;; 7538698f425bSmrg *) 7539698f425bSmrg case " $compile_deplibs " in 7540698f425bSmrg *" -L$path/$objdir "*) 7541698f425bSmrg new_libs="$new_libs -L$path/$objdir" ;; 7542266e564dSmrg esac 7543698f425bSmrg ;; 7544698f425bSmrg esac 7545698f425bSmrg done 7546698f425bSmrg for deplib in $compile_deplibs; do 7547698f425bSmrg case $deplib in 7548698f425bSmrg -L*) 7549698f425bSmrg case " $new_libs " in 7550698f425bSmrg *" $deplib "*) ;; 7551698f425bSmrg *) new_libs="$new_libs $deplib" ;; 7552266e564dSmrg esac 7553698f425bSmrg ;; 7554698f425bSmrg *) new_libs="$new_libs $deplib" ;; 7555698f425bSmrg esac 7556698f425bSmrg done 7557698f425bSmrg compile_deplibs="$new_libs" 7558266e564dSmrg 7559266e564dSmrg 7560698f425bSmrg compile_command="$compile_command $compile_deplibs" 7561698f425bSmrg finalize_command="$finalize_command $finalize_deplibs" 7562266e564dSmrg 7563698f425bSmrg if test -n "$rpath$xrpath"; then 7564698f425bSmrg # If the user specified any rpath flags, then add them. 7565698f425bSmrg for libdir in $rpath $xrpath; do 7566698f425bSmrg # This is the magic to use -rpath. 7567698f425bSmrg case "$finalize_rpath " in 7568698f425bSmrg *" $libdir "*) ;; 7569698f425bSmrg *) finalize_rpath="$finalize_rpath $libdir" ;; 7570698f425bSmrg esac 7571698f425bSmrg done 7572698f425bSmrg fi 7573266e564dSmrg 7574698f425bSmrg # Now hardcode the library paths 7575698f425bSmrg rpath= 7576698f425bSmrg hardcode_libdirs= 7577698f425bSmrg for libdir in $compile_rpath $finalize_rpath; do 7578698f425bSmrg if test -n "$hardcode_libdir_flag_spec"; then 7579698f425bSmrg if test -n "$hardcode_libdir_separator"; then 7580698f425bSmrg if test -z "$hardcode_libdirs"; then 7581698f425bSmrg hardcode_libdirs="$libdir" 7582698f425bSmrg else 7583698f425bSmrg # Just accumulate the unique libdirs. 7584698f425bSmrg case $hardcode_libdir_separator$hardcode_libdirs$hardcode_libdir_separator in 7585698f425bSmrg *"$hardcode_libdir_separator$libdir$hardcode_libdir_separator"*) 7586698f425bSmrg ;; 7587698f425bSmrg *) 7588698f425bSmrg hardcode_libdirs="$hardcode_libdirs$hardcode_libdir_separator$libdir" 7589698f425bSmrg ;; 7590698f425bSmrg esac 7591698f425bSmrg fi 7592266e564dSmrg else 7593698f425bSmrg eval flag=\"$hardcode_libdir_flag_spec\" 7594698f425bSmrg rpath="$rpath $flag" 7595266e564dSmrg fi 7596698f425bSmrg elif test -n "$runpath_var"; then 7597698f425bSmrg case "$perm_rpath " in 7598698f425bSmrg *" $libdir "*) ;; 7599698f425bSmrg *) perm_rpath="$perm_rpath $libdir" ;; 7600698f425bSmrg esac 7601698f425bSmrg fi 7602698f425bSmrg case $host in 7603698f425bSmrg *-*-cygwin* | *-*-mingw* | *-*-pw32* | *-*-os2* | *-cegcc*) 7604698f425bSmrg testbindir=`${ECHO} "$libdir" | ${SED} -e 's*/lib$*/bin*'` 7605698f425bSmrg case :$dllsearchpath: in 7606698f425bSmrg *":$libdir:"*) ;; 7607698f425bSmrg ::) dllsearchpath=$libdir;; 7608698f425bSmrg *) dllsearchpath="$dllsearchpath:$libdir";; 7609698f425bSmrg esac 7610698f425bSmrg case :$dllsearchpath: in 7611698f425bSmrg *":$testbindir:"*) ;; 7612698f425bSmrg ::) dllsearchpath=$testbindir;; 7613698f425bSmrg *) dllsearchpath="$dllsearchpath:$testbindir";; 7614698f425bSmrg esac 7615698f425bSmrg ;; 7616698f425bSmrg esac 7617698f425bSmrg done 7618698f425bSmrg # Substitute the hardcoded libdirs into the rpath. 7619698f425bSmrg if test -n "$hardcode_libdir_separator" && 7620698f425bSmrg test -n "$hardcode_libdirs"; then 7621698f425bSmrg libdir="$hardcode_libdirs" 7622698f425bSmrg eval rpath=\" $hardcode_libdir_flag_spec\" 7623698f425bSmrg fi 7624698f425bSmrg compile_rpath="$rpath" 7625266e564dSmrg 7626698f425bSmrg rpath= 7627698f425bSmrg hardcode_libdirs= 7628698f425bSmrg for libdir in $finalize_rpath; do 7629698f425bSmrg if test -n "$hardcode_libdir_flag_spec"; then 7630698f425bSmrg if test -n "$hardcode_libdir_separator"; then 7631698f425bSmrg if test -z "$hardcode_libdirs"; then 7632698f425bSmrg hardcode_libdirs="$libdir" 7633698f425bSmrg else 7634698f425bSmrg # Just accumulate the unique libdirs. 7635698f425bSmrg case $hardcode_libdir_separator$hardcode_libdirs$hardcode_libdir_separator in 7636698f425bSmrg *"$hardcode_libdir_separator$libdir$hardcode_libdir_separator"*) 7637698f425bSmrg ;; 7638698f425bSmrg *) 7639698f425bSmrg hardcode_libdirs="$hardcode_libdirs$hardcode_libdir_separator$libdir" 7640698f425bSmrg ;; 7641698f425bSmrg esac 7642698f425bSmrg fi 7643266e564dSmrg else 7644698f425bSmrg eval flag=\"$hardcode_libdir_flag_spec\" 7645698f425bSmrg rpath="$rpath $flag" 7646266e564dSmrg fi 7647698f425bSmrg elif test -n "$runpath_var"; then 7648698f425bSmrg case "$finalize_perm_rpath " in 7649698f425bSmrg *" $libdir "*) ;; 7650698f425bSmrg *) finalize_perm_rpath="$finalize_perm_rpath $libdir" ;; 7651698f425bSmrg esac 7652266e564dSmrg fi 7653698f425bSmrg done 7654698f425bSmrg # Substitute the hardcoded libdirs into the rpath. 7655698f425bSmrg if test -n "$hardcode_libdir_separator" && 7656698f425bSmrg test -n "$hardcode_libdirs"; then 7657698f425bSmrg libdir="$hardcode_libdirs" 7658698f425bSmrg eval rpath=\" $hardcode_libdir_flag_spec\" 7659698f425bSmrg fi 7660698f425bSmrg finalize_rpath="$rpath" 7661266e564dSmrg 7662698f425bSmrg if test -n "$libobjs" && test "$build_old_libs" = yes; then 7663698f425bSmrg # Transform all the library objects into standard objects. 7664698f425bSmrg compile_command=`$ECHO "X$compile_command" | $SP2NL | $Xsed -e "$lo2o" | $NL2SP` 7665698f425bSmrg finalize_command=`$ECHO "X$finalize_command" | $SP2NL | $Xsed -e "$lo2o" | $NL2SP` 7666698f425bSmrg fi 7667266e564dSmrg 7668698f425bSmrg func_generate_dlsyms "$outputname" "@PROGRAM@" "no" 7669266e564dSmrg 7670698f425bSmrg # template prelinking step 7671698f425bSmrg if test -n "$prelink_cmds"; then 7672698f425bSmrg func_execute_cmds "$prelink_cmds" 'exit $?' 7673698f425bSmrg fi 7674266e564dSmrg 7675698f425bSmrg wrappers_required=yes 7676698f425bSmrg case $host in 7677698f425bSmrg *cygwin* | *mingw* ) 7678698f425bSmrg if test "$build_libtool_libs" != yes; then 7679698f425bSmrg wrappers_required=no 7680698f425bSmrg fi 7681698f425bSmrg ;; 7682698f425bSmrg *cegcc) 7683698f425bSmrg # Disable wrappers for cegcc, we are cross compiling anyway. 7684698f425bSmrg wrappers_required=no 7685698f425bSmrg ;; 7686698f425bSmrg *) 7687698f425bSmrg if test "$need_relink" = no || test "$build_libtool_libs" != yes; then 7688698f425bSmrg wrappers_required=no 7689698f425bSmrg fi 7690698f425bSmrg ;; 7691698f425bSmrg esac 7692698f425bSmrg if test "$wrappers_required" = no; then 7693698f425bSmrg # Replace the output file specification. 7694698f425bSmrg compile_command=`$ECHO "X$compile_command" | $Xsed -e 's%@OUTPUT@%'"$output"'%g'` 7695698f425bSmrg link_command="$compile_command$compile_rpath" 7696266e564dSmrg 7697698f425bSmrg # We have no uninstalled library dependencies, so finalize right now. 7698698f425bSmrg exit_status=0 7699698f425bSmrg func_show_eval "$link_command" 'exit_status=$?' 7700266e564dSmrg 7701698f425bSmrg # Delete the generated files. 7702698f425bSmrg if test -f "$output_objdir/${outputname}S.${objext}"; then 7703698f425bSmrg func_show_eval '$RM "$output_objdir/${outputname}S.${objext}"' 7704266e564dSmrg fi 7705266e564dSmrg 7706698f425bSmrg exit $exit_status 7707698f425bSmrg fi 7708266e564dSmrg 7709698f425bSmrg if test -n "$compile_shlibpath$finalize_shlibpath"; then 7710698f425bSmrg compile_command="$shlibpath_var=\"$compile_shlibpath$finalize_shlibpath\$$shlibpath_var\" $compile_command" 7711698f425bSmrg fi 7712698f425bSmrg if test -n "$finalize_shlibpath"; then 7713698f425bSmrg finalize_command="$shlibpath_var=\"$finalize_shlibpath\$$shlibpath_var\" $finalize_command" 7714698f425bSmrg fi 7715266e564dSmrg 7716698f425bSmrg compile_var= 7717698f425bSmrg finalize_var= 7718698f425bSmrg if test -n "$runpath_var"; then 7719698f425bSmrg if test -n "$perm_rpath"; then 7720698f425bSmrg # We should set the runpath_var. 7721698f425bSmrg rpath= 7722698f425bSmrg for dir in $perm_rpath; do 7723698f425bSmrg rpath="$rpath$dir:" 7724698f425bSmrg done 7725698f425bSmrg compile_var="$runpath_var=\"$rpath\$$runpath_var\" " 7726266e564dSmrg fi 7727698f425bSmrg if test -n "$finalize_perm_rpath"; then 7728698f425bSmrg # We should set the runpath_var. 7729698f425bSmrg rpath= 7730698f425bSmrg for dir in $finalize_perm_rpath; do 7731698f425bSmrg rpath="$rpath$dir:" 7732698f425bSmrg done 7733698f425bSmrg finalize_var="$runpath_var=\"$rpath\$$runpath_var\" " 7734266e564dSmrg fi 7735698f425bSmrg fi 7736266e564dSmrg 7737698f425bSmrg if test "$no_install" = yes; then 7738698f425bSmrg # We don't need to create a wrapper script. 7739698f425bSmrg link_command="$compile_var$compile_command$compile_rpath" 7740698f425bSmrg # Replace the output file specification. 7741698f425bSmrg link_command=`$ECHO "X$link_command" | $Xsed -e 's%@OUTPUT@%'"$output"'%g'` 7742698f425bSmrg # Delete the old output file. 7743698f425bSmrg $opt_dry_run || $RM $output 7744698f425bSmrg # Link the executable and exit 7745698f425bSmrg func_show_eval "$link_command" 'exit $?' 7746266e564dSmrg exit $EXIT_SUCCESS 7747698f425bSmrg fi 7748266e564dSmrg 7749698f425bSmrg if test "$hardcode_action" = relink; then 7750698f425bSmrg # Fast installation is not supported 7751698f425bSmrg link_command="$compile_var$compile_command$compile_rpath" 7752698f425bSmrg relink_command="$finalize_var$finalize_command$finalize_rpath" 7753698f425bSmrg 7754698f425bSmrg func_warning "this platform does not like uninstalled shared libraries" 7755698f425bSmrg func_warning "\`$output' will be relinked during installation" 7756698f425bSmrg else 7757698f425bSmrg if test "$fast_install" != no; then 7758698f425bSmrg link_command="$finalize_var$compile_command$finalize_rpath" 7759698f425bSmrg if test "$fast_install" = yes; then 7760698f425bSmrg relink_command=`$ECHO "X$compile_var$compile_command$compile_rpath" | $Xsed -e 's%@OUTPUT@%\$progdir/\$file%g'` 7761698f425bSmrg else 7762698f425bSmrg # fast_install is set to needless 7763698f425bSmrg relink_command= 7764698f425bSmrg fi 7765266e564dSmrg else 7766698f425bSmrg link_command="$compile_var$compile_command$compile_rpath" 7767698f425bSmrg relink_command="$finalize_var$finalize_command$finalize_rpath" 7768266e564dSmrg fi 7769698f425bSmrg fi 7770266e564dSmrg 7771698f425bSmrg # Replace the output file specification. 7772698f425bSmrg link_command=`$ECHO "X$link_command" | $Xsed -e 's%@OUTPUT@%'"$output_objdir/$outputname"'%g'` 7773266e564dSmrg 7774698f425bSmrg # Delete the old output files. 7775698f425bSmrg $opt_dry_run || $RM $output $output_objdir/$outputname $output_objdir/lt-$outputname 7776266e564dSmrg 7777698f425bSmrg func_show_eval "$link_command" 'exit $?' 7778266e564dSmrg 7779698f425bSmrg # Now create the wrapper script. 7780698f425bSmrg func_verbose "creating $output" 7781266e564dSmrg 7782698f425bSmrg # Quote the relink command for shipping. 7783698f425bSmrg if test -n "$relink_command"; then 7784698f425bSmrg # Preserve any variables that may affect compiler behavior 7785698f425bSmrg for var in $variables_saved_for_relink; do 7786698f425bSmrg if eval test -z \"\${$var+set}\"; then 7787698f425bSmrg relink_command="{ test -z \"\${$var+set}\" || $lt_unset $var || { $var=; export $var; }; }; $relink_command" 7788698f425bSmrg elif eval var_value=\$$var; test -z "$var_value"; then 7789698f425bSmrg relink_command="$var=; export $var; $relink_command" 7790266e564dSmrg else 7791698f425bSmrg func_quote_for_eval "$var_value" 7792698f425bSmrg relink_command="$var=$func_quote_for_eval_result; export $var; $relink_command" 7793266e564dSmrg fi 7794698f425bSmrg done 7795698f425bSmrg relink_command="(cd `pwd`; $relink_command)" 7796698f425bSmrg relink_command=`$ECHO "X$relink_command" | $Xsed -e "$sed_quote_subst"` 7797698f425bSmrg fi 7798266e564dSmrg 7799698f425bSmrg # Quote $ECHO for shipping. 7800698f425bSmrg if test "X$ECHO" = "X$SHELL $progpath --fallback-echo"; then 7801698f425bSmrg case $progpath in 7802698f425bSmrg [\\/]* | [A-Za-z]:[\\/]*) qecho="$SHELL $progpath --fallback-echo";; 7803698f425bSmrg *) qecho="$SHELL `pwd`/$progpath --fallback-echo";; 7804698f425bSmrg esac 7805698f425bSmrg qecho=`$ECHO "X$qecho" | $Xsed -e "$sed_quote_subst"` 7806698f425bSmrg else 7807698f425bSmrg qecho=`$ECHO "X$ECHO" | $Xsed -e "$sed_quote_subst"` 7808698f425bSmrg fi 7809698f425bSmrg 7810698f425bSmrg # Only actually do things if not in dry run mode. 7811698f425bSmrg $opt_dry_run || { 7812698f425bSmrg # win32 will think the script is a binary if it has 7813698f425bSmrg # a .exe suffix, so we strip it off here. 7814698f425bSmrg case $output in 7815698f425bSmrg *.exe) func_stripname '' '.exe' "$output" 7816698f425bSmrg output=$func_stripname_result ;; 7817698f425bSmrg esac 7818698f425bSmrg # test for cygwin because mv fails w/o .exe extensions 7819698f425bSmrg case $host in 7820698f425bSmrg *cygwin*) 7821698f425bSmrg exeext=.exe 7822698f425bSmrg func_stripname '' '.exe' "$outputname" 7823698f425bSmrg outputname=$func_stripname_result ;; 7824698f425bSmrg *) exeext= ;; 7825266e564dSmrg esac 7826698f425bSmrg case $host in 7827698f425bSmrg *cygwin* | *mingw* ) 7828698f425bSmrg func_dirname_and_basename "$output" "" "." 7829698f425bSmrg output_name=$func_basename_result 7830698f425bSmrg output_path=$func_dirname_result 7831698f425bSmrg cwrappersource="$output_path/$objdir/lt-$output_name.c" 7832698f425bSmrg cwrapper="$output_path/$output_name.exe" 7833698f425bSmrg $RM $cwrappersource $cwrapper 7834698f425bSmrg trap "$RM $cwrappersource $cwrapper; exit $EXIT_FAILURE" 1 2 15 7835698f425bSmrg 7836698f425bSmrg func_emit_cwrapperexe_src > $cwrappersource 7837698f425bSmrg 7838698f425bSmrg # The wrapper executable is built using the $host compiler, 7839698f425bSmrg # because it contains $host paths and files. If cross- 7840698f425bSmrg # compiling, it, like the target executable, must be 7841698f425bSmrg # executed on the $host or under an emulation environment. 7842698f425bSmrg $opt_dry_run || { 7843698f425bSmrg $LTCC $LTCFLAGS -o $cwrapper $cwrappersource 7844698f425bSmrg $STRIP $cwrapper 7845698f425bSmrg } 7846266e564dSmrg 7847698f425bSmrg # Now, create the wrapper script for func_source use: 7848698f425bSmrg func_ltwrapper_scriptname $cwrapper 7849698f425bSmrg $RM $func_ltwrapper_scriptname_result 7850698f425bSmrg trap "$RM $func_ltwrapper_scriptname_result; exit $EXIT_FAILURE" 1 2 15 7851698f425bSmrg $opt_dry_run || { 7852698f425bSmrg # note: this script will not be executed, so do not chmod. 7853698f425bSmrg if test "x$build" = "x$host" ; then 7854698f425bSmrg $cwrapper --lt-dump-script > $func_ltwrapper_scriptname_result 7855698f425bSmrg else 7856698f425bSmrg func_emit_wrapper no > $func_ltwrapper_scriptname_result 7857698f425bSmrg fi 7858698f425bSmrg } 7859698f425bSmrg ;; 7860698f425bSmrg * ) 7861698f425bSmrg $RM $output 7862698f425bSmrg trap "$RM $output; exit $EXIT_FAILURE" 1 2 15 7863266e564dSmrg 7864698f425bSmrg func_emit_wrapper no > $output 7865698f425bSmrg chmod +x $output 7866698f425bSmrg ;; 7867698f425bSmrg esac 7868698f425bSmrg } 7869698f425bSmrg exit $EXIT_SUCCESS 7870698f425bSmrg ;; 7871698f425bSmrg esac 7872266e564dSmrg 7873698f425bSmrg # See if we need to build an old-fashioned archive. 7874698f425bSmrg for oldlib in $oldlibs; do 7875266e564dSmrg 7876698f425bSmrg if test "$build_libtool_libs" = convenience; then 7877698f425bSmrg oldobjs="$libobjs_save $symfileobj" 7878698f425bSmrg addlibs="$convenience" 7879698f425bSmrg build_libtool_libs=no 7880698f425bSmrg else 7881698f425bSmrg if test "$build_libtool_libs" = module; then 7882698f425bSmrg oldobjs="$libobjs_save" 7883698f425bSmrg build_libtool_libs=no 7884698f425bSmrg else 7885698f425bSmrg oldobjs="$old_deplibs $non_pic_objects" 7886698f425bSmrg if test "$preload" = yes && test -f "$symfileobj"; then 7887698f425bSmrg oldobjs="$oldobjs $symfileobj" 7888698f425bSmrg fi 7889698f425bSmrg fi 7890698f425bSmrg addlibs="$old_convenience" 7891266e564dSmrg fi 7892266e564dSmrg 7893698f425bSmrg if test -n "$addlibs"; then 7894698f425bSmrg gentop="$output_objdir/${outputname}x" 7895698f425bSmrg generated="$generated $gentop" 7896266e564dSmrg 7897698f425bSmrg func_extract_archives $gentop $addlibs 7898698f425bSmrg oldobjs="$oldobjs $func_extract_archives_result" 7899698f425bSmrg fi 7900266e564dSmrg 7901698f425bSmrg # Do each command in the archive commands. 7902698f425bSmrg if test -n "$old_archive_from_new_cmds" && test "$build_libtool_libs" = yes; then 7903698f425bSmrg cmds=$old_archive_from_new_cmds 7904698f425bSmrg else 7905266e564dSmrg 7906698f425bSmrg # Add any objects from preloaded convenience libraries 7907698f425bSmrg if test -n "$dlprefiles"; then 7908698f425bSmrg gentop="$output_objdir/${outputname}x" 7909698f425bSmrg generated="$generated $gentop" 7910266e564dSmrg 7911698f425bSmrg func_extract_archives $gentop $dlprefiles 7912698f425bSmrg oldobjs="$oldobjs $func_extract_archives_result" 7913698f425bSmrg fi 7914266e564dSmrg 7915698f425bSmrg # POSIX demands no paths to be encoded in archives. We have 7916698f425bSmrg # to avoid creating archives with duplicate basenames if we 7917698f425bSmrg # might have to extract them afterwards, e.g., when creating a 7918698f425bSmrg # static archive out of a convenience library, or when linking 7919698f425bSmrg # the entirety of a libtool archive into another (currently 7920698f425bSmrg # not supported by libtool). 7921698f425bSmrg if (for obj in $oldobjs 7922698f425bSmrg do 7923698f425bSmrg func_basename "$obj" 7924698f425bSmrg $ECHO "$func_basename_result" 7925698f425bSmrg done | sort | sort -uc >/dev/null 2>&1); then 7926698f425bSmrg : 7927698f425bSmrg else 7928698f425bSmrg $ECHO "copying selected object files to avoid basename conflicts..." 7929698f425bSmrg gentop="$output_objdir/${outputname}x" 7930698f425bSmrg generated="$generated $gentop" 7931698f425bSmrg func_mkdir_p "$gentop" 7932698f425bSmrg save_oldobjs=$oldobjs 7933698f425bSmrg oldobjs= 7934698f425bSmrg counter=1 7935698f425bSmrg for obj in $save_oldobjs 7936698f425bSmrg do 7937698f425bSmrg func_basename "$obj" 7938698f425bSmrg objbase="$func_basename_result" 7939698f425bSmrg case " $oldobjs " in 7940698f425bSmrg " ") oldobjs=$obj ;; 7941698f425bSmrg *[\ /]"$objbase "*) 7942698f425bSmrg while :; do 7943698f425bSmrg # Make sure we don't pick an alternate name that also 7944698f425bSmrg # overlaps. 7945698f425bSmrg newobj=lt$counter-$objbase 7946698f425bSmrg func_arith $counter + 1 7947698f425bSmrg counter=$func_arith_result 7948698f425bSmrg case " $oldobjs " in 7949698f425bSmrg *[\ /]"$newobj "*) ;; 7950698f425bSmrg *) if test ! -f "$gentop/$newobj"; then break; fi ;; 7951698f425bSmrg esac 7952698f425bSmrg done 7953698f425bSmrg func_show_eval "ln $obj $gentop/$newobj || cp $obj $gentop/$newobj" 7954698f425bSmrg oldobjs="$oldobjs $gentop/$newobj" 7955698f425bSmrg ;; 7956698f425bSmrg *) oldobjs="$oldobjs $obj" ;; 7957698f425bSmrg esac 7958266e564dSmrg done 7959266e564dSmrg fi 7960698f425bSmrg eval cmds=\"$old_archive_cmds\" 7961266e564dSmrg 7962698f425bSmrg func_len " $cmds" 7963698f425bSmrg len=$func_len_result 7964698f425bSmrg if test "$len" -lt "$max_cmd_len" || test "$max_cmd_len" -le -1; then 7965698f425bSmrg cmds=$old_archive_cmds 7966698f425bSmrg else 7967698f425bSmrg # the command line is too long to link in one step, link in parts 7968698f425bSmrg func_verbose "using piecewise archive linking..." 7969698f425bSmrg save_RANLIB=$RANLIB 7970698f425bSmrg RANLIB=: 7971698f425bSmrg objlist= 7972698f425bSmrg concat_cmds= 7973698f425bSmrg save_oldobjs=$oldobjs 7974698f425bSmrg oldobjs= 7975698f425bSmrg # Is there a better way of finding the last object in the list? 7976698f425bSmrg for obj in $save_oldobjs 7977698f425bSmrg do 7978698f425bSmrg last_oldobj=$obj 7979698f425bSmrg done 7980698f425bSmrg eval test_cmds=\"$old_archive_cmds\" 7981698f425bSmrg func_len " $test_cmds" 7982698f425bSmrg len0=$func_len_result 7983698f425bSmrg len=$len0 7984698f425bSmrg for obj in $save_oldobjs 7985698f425bSmrg do 7986698f425bSmrg func_len " $obj" 7987698f425bSmrg func_arith $len + $func_len_result 7988698f425bSmrg len=$func_arith_result 7989698f425bSmrg func_append objlist " $obj" 7990698f425bSmrg if test "$len" -lt "$max_cmd_len"; then 7991698f425bSmrg : 7992698f425bSmrg else 7993698f425bSmrg # the above command should be used before it gets too long 7994698f425bSmrg oldobjs=$objlist 7995698f425bSmrg if test "$obj" = "$last_oldobj" ; then 7996698f425bSmrg RANLIB=$save_RANLIB 7997698f425bSmrg fi 7998698f425bSmrg test -z "$concat_cmds" || concat_cmds=$concat_cmds~ 7999698f425bSmrg eval concat_cmds=\"\${concat_cmds}$old_archive_cmds\" 8000698f425bSmrg objlist= 8001698f425bSmrg len=$len0 8002698f425bSmrg fi 8003698f425bSmrg done 8004698f425bSmrg RANLIB=$save_RANLIB 8005698f425bSmrg oldobjs=$objlist 8006698f425bSmrg if test "X$oldobjs" = "X" ; then 8007698f425bSmrg eval cmds=\"\$concat_cmds\" 8008698f425bSmrg else 8009698f425bSmrg eval cmds=\"\$concat_cmds~\$old_archive_cmds\" 8010698f425bSmrg fi 8011698f425bSmrg fi 8012698f425bSmrg fi 8013698f425bSmrg func_execute_cmds "$cmds" 'exit $?' 8014266e564dSmrg done 8015266e564dSmrg 8016698f425bSmrg test -n "$generated" && \ 8017698f425bSmrg func_show_eval "${RM}r$generated" 8018266e564dSmrg 8019698f425bSmrg # Now create the libtool archive. 8020698f425bSmrg case $output in 8021698f425bSmrg *.la) 8022698f425bSmrg old_library= 8023698f425bSmrg test "$build_old_libs" = yes && old_library="$libname.$libext" 8024698f425bSmrg func_verbose "creating $output" 8025266e564dSmrg 8026698f425bSmrg # Preserve any variables that may affect compiler behavior 8027698f425bSmrg for var in $variables_saved_for_relink; do 8028698f425bSmrg if eval test -z \"\${$var+set}\"; then 8029698f425bSmrg relink_command="{ test -z \"\${$var+set}\" || $lt_unset $var || { $var=; export $var; }; }; $relink_command" 8030698f425bSmrg elif eval var_value=\$$var; test -z "$var_value"; then 8031698f425bSmrg relink_command="$var=; export $var; $relink_command" 8032266e564dSmrg else 8033698f425bSmrg func_quote_for_eval "$var_value" 8034698f425bSmrg relink_command="$var=$func_quote_for_eval_result; export $var; $relink_command" 8035266e564dSmrg fi 8036698f425bSmrg done 8037698f425bSmrg # Quote the link command for shipping. 8038698f425bSmrg relink_command="(cd `pwd`; $SHELL $progpath $preserve_args --mode=relink $libtool_args @inst_prefix_dir@)" 8039698f425bSmrg relink_command=`$ECHO "X$relink_command" | $Xsed -e "$sed_quote_subst"` 8040698f425bSmrg if test "$hardcode_automatic" = yes ; then 8041698f425bSmrg relink_command= 8042698f425bSmrg fi 8043266e564dSmrg 8044698f425bSmrg # Only create the output if not a dry run. 8045698f425bSmrg $opt_dry_run || { 8046698f425bSmrg for installed in no yes; do 8047698f425bSmrg if test "$installed" = yes; then 8048698f425bSmrg if test -z "$install_libdir"; then 8049698f425bSmrg break 8050698f425bSmrg fi 8051698f425bSmrg output="$output_objdir/$outputname"i 8052698f425bSmrg # Replace all uninstalled libtool libraries with the installed ones 8053698f425bSmrg newdependency_libs= 8054698f425bSmrg for deplib in $dependency_libs; do 8055698f425bSmrg case $deplib in 8056698f425bSmrg *.la) 8057698f425bSmrg func_basename "$deplib" 8058698f425bSmrg name="$func_basename_result" 8059698f425bSmrg eval libdir=`${SED} -n -e 's/^libdir=\(.*\)$/\1/p' $deplib` 8060698f425bSmrg test -z "$libdir" && \ 8061698f425bSmrg func_fatal_error "\`$deplib' is not a valid libtool archive" 8062698f425bSmrg newdependency_libs="$newdependency_libs $libdir/$name" 8063698f425bSmrg ;; 8064698f425bSmrg *) newdependency_libs="$newdependency_libs $deplib" ;; 8065698f425bSmrg esac 8066698f425bSmrg done 8067698f425bSmrg dependency_libs="$newdependency_libs" 8068698f425bSmrg newdlfiles= 8069698f425bSmrg 8070698f425bSmrg for lib in $dlfiles; do 8071698f425bSmrg case $lib in 8072698f425bSmrg *.la) 8073698f425bSmrg func_basename "$lib" 8074698f425bSmrg name="$func_basename_result" 8075698f425bSmrg eval libdir=`${SED} -n -e 's/^libdir=\(.*\)$/\1/p' $lib` 8076698f425bSmrg test -z "$libdir" && \ 8077698f425bSmrg func_fatal_error "\`$lib' is not a valid libtool archive" 8078698f425bSmrg newdlfiles="$newdlfiles $libdir/$name" 8079698f425bSmrg ;; 8080698f425bSmrg *) newdlfiles="$newdlfiles $lib" ;; 8081698f425bSmrg esac 8082698f425bSmrg done 8083698f425bSmrg dlfiles="$newdlfiles" 8084698f425bSmrg newdlprefiles= 8085698f425bSmrg for lib in $dlprefiles; do 8086698f425bSmrg case $lib in 8087698f425bSmrg *.la) 8088698f425bSmrg # Only pass preopened files to the pseudo-archive (for 8089698f425bSmrg # eventual linking with the app. that links it) if we 8090698f425bSmrg # didn't already link the preopened objects directly into 8091698f425bSmrg # the library: 8092698f425bSmrg func_basename "$lib" 8093698f425bSmrg name="$func_basename_result" 8094698f425bSmrg eval libdir=`${SED} -n -e 's/^libdir=\(.*\)$/\1/p' $lib` 8095698f425bSmrg test -z "$libdir" && \ 8096698f425bSmrg func_fatal_error "\`$lib' is not a valid libtool archive" 8097698f425bSmrg newdlprefiles="$newdlprefiles $libdir/$name" 8098698f425bSmrg ;; 8099698f425bSmrg esac 8100698f425bSmrg done 8101698f425bSmrg dlprefiles="$newdlprefiles" 8102698f425bSmrg else 8103698f425bSmrg newdlfiles= 8104698f425bSmrg for lib in $dlfiles; do 8105698f425bSmrg case $lib in 8106698f425bSmrg [\\/]* | [A-Za-z]:[\\/]*) abs="$lib" ;; 8107698f425bSmrg *) abs=`pwd`"/$lib" ;; 8108698f425bSmrg esac 8109698f425bSmrg newdlfiles="$newdlfiles $abs" 8110698f425bSmrg done 8111698f425bSmrg dlfiles="$newdlfiles" 8112698f425bSmrg newdlprefiles= 8113698f425bSmrg for lib in $dlprefiles; do 8114698f425bSmrg case $lib in 8115698f425bSmrg [\\/]* | [A-Za-z]:[\\/]*) abs="$lib" ;; 8116698f425bSmrg *) abs=`pwd`"/$lib" ;; 8117698f425bSmrg esac 8118698f425bSmrg newdlprefiles="$newdlprefiles $abs" 8119698f425bSmrg done 8120698f425bSmrg dlprefiles="$newdlprefiles" 8121698f425bSmrg fi 8122698f425bSmrg $RM $output 8123698f425bSmrg # place dlname in correct position for cygwin 8124698f425bSmrg tdlname=$dlname 8125698f425bSmrg case $host,$output,$installed,$module,$dlname in 8126698f425bSmrg *cygwin*,*lai,yes,no,*.dll | *mingw*,*lai,yes,no,*.dll | *cegcc*,*lai,yes,no,*.dll) tdlname=../bin/$dlname ;; 8127698f425bSmrg esac 8128698f425bSmrg $ECHO > $output "\ 8129698f425bSmrg# $outputname - a libtool library file 8130698f425bSmrg# Generated by $PROGRAM (GNU $PACKAGE$TIMESTAMP) $VERSION 8131698f425bSmrg# 8132698f425bSmrg# Please DO NOT delete this file! 8133698f425bSmrg# It is necessary for linking the library. 8134266e564dSmrg 8135698f425bSmrg# The name that we can dlopen(3). 8136698f425bSmrgdlname='$tdlname' 8137266e564dSmrg 8138698f425bSmrg# Names of this library. 8139698f425bSmrglibrary_names='$library_names' 8140266e564dSmrg 8141698f425bSmrg# The name of the static archive. 8142698f425bSmrgold_library='$old_library' 8143266e564dSmrg 8144698f425bSmrg# Linker flags that can not go in dependency_libs. 8145698f425bSmrginherited_linker_flags='$new_inherited_linker_flags' 8146266e564dSmrg 8147698f425bSmrg# Libraries that this one depends upon. 8148698f425bSmrgdependency_libs='$dependency_libs' 8149266e564dSmrg 8150698f425bSmrg# Names of additional weak libraries provided by this library 8151698f425bSmrgweak_library_names='$weak_libs' 8152266e564dSmrg 8153698f425bSmrg# Version information for $libname. 8154698f425bSmrgcurrent=$current 8155698f425bSmrgage=$age 8156698f425bSmrgrevision=$revision 8157266e564dSmrg 8158698f425bSmrg# Is this an already installed library? 8159698f425bSmrginstalled=$installed 8160266e564dSmrg 8161698f425bSmrg# Should we warn about portability when linking against -modules? 8162698f425bSmrgshouldnotlink=$module 8163266e564dSmrg 8164698f425bSmrg# Files to dlopen/dlpreopen 8165698f425bSmrgdlopen='$dlfiles' 8166698f425bSmrgdlpreopen='$dlprefiles' 8167266e564dSmrg 8168698f425bSmrg# Directory that this library needs to be installed in: 8169698f425bSmrglibdir='$install_libdir'" 8170698f425bSmrg if test "$installed" = no && test "$need_relink" = yes; then 8171698f425bSmrg $ECHO >> $output "\ 8172698f425bSmrgrelink_command=\"$relink_command\"" 8173698f425bSmrg fi 8174698f425bSmrg done 8175698f425bSmrg } 8176266e564dSmrg 8177698f425bSmrg # Do a symbolic link so that the libtool archive can be found in 8178698f425bSmrg # LD_LIBRARY_PATH before the program is installed. 8179698f425bSmrg func_show_eval '( cd "$output_objdir" && $RM "$outputname" && $LN_S "../$outputname" "$outputname" )' 'exit $?' 8180698f425bSmrg ;; 8181698f425bSmrg esac 8182698f425bSmrg exit $EXIT_SUCCESS 8183698f425bSmrg} 8184266e564dSmrg 8185698f425bSmrg{ test "$mode" = link || test "$mode" = relink; } && 8186698f425bSmrg func_mode_link ${1+"$@"} 8187266e564dSmrg 8188266e564dSmrg 8189698f425bSmrg# func_mode_uninstall arg... 8190698f425bSmrgfunc_mode_uninstall () 8191698f425bSmrg{ 8192698f425bSmrg $opt_debug 8193698f425bSmrg RM="$nonopt" 8194266e564dSmrg files= 8195266e564dSmrg rmforce= 8196266e564dSmrg exit_status=0 8197266e564dSmrg 8198266e564dSmrg # This variable tells wrapper scripts just to set variables rather 8199266e564dSmrg # than running their programs. 8200266e564dSmrg libtool_install_magic="$magic" 8201266e564dSmrg 8202266e564dSmrg for arg 8203266e564dSmrg do 8204266e564dSmrg case $arg in 8205698f425bSmrg -f) RM="$RM $arg"; rmforce=yes ;; 8206698f425bSmrg -*) RM="$RM $arg" ;; 8207266e564dSmrg *) files="$files $arg" ;; 8208266e564dSmrg esac 8209266e564dSmrg done 8210266e564dSmrg 8211698f425bSmrg test -z "$RM" && \ 8212698f425bSmrg func_fatal_help "you must specify an RM program" 8213266e564dSmrg 8214266e564dSmrg rmdirs= 8215266e564dSmrg 8216266e564dSmrg origobjdir="$objdir" 8217266e564dSmrg for file in $files; do 8218698f425bSmrg func_dirname "$file" "" "." 8219698f425bSmrg dir="$func_dirname_result" 8220698f425bSmrg if test "X$dir" = X.; then 8221266e564dSmrg objdir="$origobjdir" 8222266e564dSmrg else 8223266e564dSmrg objdir="$dir/$origobjdir" 8224266e564dSmrg fi 8225698f425bSmrg func_basename "$file" 8226698f425bSmrg name="$func_basename_result" 8227266e564dSmrg test "$mode" = uninstall && objdir="$dir" 8228266e564dSmrg 8229266e564dSmrg # Remember objdir for removal later, being careful to avoid duplicates 8230266e564dSmrg if test "$mode" = clean; then 8231266e564dSmrg case " $rmdirs " in 8232266e564dSmrg *" $objdir "*) ;; 8233266e564dSmrg *) rmdirs="$rmdirs $objdir" ;; 8234266e564dSmrg esac 8235266e564dSmrg fi 8236266e564dSmrg 8237266e564dSmrg # Don't error if the file doesn't exist and rm -f was used. 8238698f425bSmrg if { test -L "$file"; } >/dev/null 2>&1 || 8239698f425bSmrg { test -h "$file"; } >/dev/null 2>&1 || 8240698f425bSmrg test -f "$file"; then 8241266e564dSmrg : 8242266e564dSmrg elif test -d "$file"; then 8243266e564dSmrg exit_status=1 8244266e564dSmrg continue 8245266e564dSmrg elif test "$rmforce" = yes; then 8246266e564dSmrg continue 8247266e564dSmrg fi 8248266e564dSmrg 8249266e564dSmrg rmfiles="$file" 8250266e564dSmrg 8251266e564dSmrg case $name in 8252266e564dSmrg *.la) 8253266e564dSmrg # Possibly a libtool archive, so verify it. 8254698f425bSmrg if func_lalib_p "$file"; then 8255698f425bSmrg func_source $dir/$name 8256266e564dSmrg 8257266e564dSmrg # Delete the libtool libraries and symlinks. 8258266e564dSmrg for n in $library_names; do 8259266e564dSmrg rmfiles="$rmfiles $objdir/$n" 8260266e564dSmrg done 8261266e564dSmrg test -n "$old_library" && rmfiles="$rmfiles $objdir/$old_library" 8262266e564dSmrg 8263266e564dSmrg case "$mode" in 8264266e564dSmrg clean) 8265266e564dSmrg case " $library_names " in 8266266e564dSmrg # " " in the beginning catches empty $dlname 8267266e564dSmrg *" $dlname "*) ;; 8268266e564dSmrg *) rmfiles="$rmfiles $objdir/$dlname" ;; 8269266e564dSmrg esac 8270698f425bSmrg test -n "$libdir" && rmfiles="$rmfiles $objdir/$name $objdir/${name}i" 8271266e564dSmrg ;; 8272266e564dSmrg uninstall) 8273266e564dSmrg if test -n "$library_names"; then 8274266e564dSmrg # Do each command in the postuninstall commands. 8275698f425bSmrg func_execute_cmds "$postuninstall_cmds" 'test "$rmforce" = yes || exit_status=1' 8276266e564dSmrg fi 8277266e564dSmrg 8278266e564dSmrg if test -n "$old_library"; then 8279266e564dSmrg # Do each command in the old_postuninstall commands. 8280698f425bSmrg func_execute_cmds "$old_postuninstall_cmds" 'test "$rmforce" = yes || exit_status=1' 8281266e564dSmrg fi 8282266e564dSmrg # FIXME: should reinstall the best remaining shared library. 8283266e564dSmrg ;; 8284266e564dSmrg esac 8285266e564dSmrg fi 8286266e564dSmrg ;; 8287266e564dSmrg 8288266e564dSmrg *.lo) 8289266e564dSmrg # Possibly a libtool object, so verify it. 8290698f425bSmrg if func_lalib_p "$file"; then 8291266e564dSmrg 8292266e564dSmrg # Read the .lo file 8293698f425bSmrg func_source $dir/$name 8294266e564dSmrg 8295266e564dSmrg # Add PIC object to the list of files to remove. 8296698f425bSmrg if test -n "$pic_object" && 8297698f425bSmrg test "$pic_object" != none; then 8298266e564dSmrg rmfiles="$rmfiles $dir/$pic_object" 8299266e564dSmrg fi 8300266e564dSmrg 8301266e564dSmrg # Add non-PIC object to the list of files to remove. 8302698f425bSmrg if test -n "$non_pic_object" && 8303698f425bSmrg test "$non_pic_object" != none; then 8304266e564dSmrg rmfiles="$rmfiles $dir/$non_pic_object" 8305266e564dSmrg fi 8306266e564dSmrg fi 8307266e564dSmrg ;; 8308266e564dSmrg 8309266e564dSmrg *) 8310266e564dSmrg if test "$mode" = clean ; then 8311266e564dSmrg noexename=$name 8312266e564dSmrg case $file in 8313266e564dSmrg *.exe) 8314698f425bSmrg func_stripname '' '.exe' "$file" 8315698f425bSmrg file=$func_stripname_result 8316698f425bSmrg func_stripname '' '.exe' "$name" 8317698f425bSmrg noexename=$func_stripname_result 8318266e564dSmrg # $file with .exe has already been added to rmfiles, 8319266e564dSmrg # add $file without .exe 8320266e564dSmrg rmfiles="$rmfiles $file" 8321266e564dSmrg ;; 8322266e564dSmrg esac 8323266e564dSmrg # Do a test to see if this is a libtool program. 8324698f425bSmrg if func_ltwrapper_p "$file"; then 8325698f425bSmrg if func_ltwrapper_executable_p "$file"; then 8326698f425bSmrg func_ltwrapper_scriptname "$file" 8327698f425bSmrg relink_command= 8328698f425bSmrg func_source $func_ltwrapper_scriptname_result 8329698f425bSmrg rmfiles="$rmfiles $func_ltwrapper_scriptname_result" 8330698f425bSmrg else 8331698f425bSmrg relink_command= 8332698f425bSmrg func_source $dir/$noexename 8333698f425bSmrg fi 8334266e564dSmrg 8335266e564dSmrg # note $name still contains .exe if it was in $file originally 8336266e564dSmrg # as does the version of $file that was added into $rmfiles 8337266e564dSmrg rmfiles="$rmfiles $objdir/$name $objdir/${name}S.${objext}" 8338266e564dSmrg if test "$fast_install" = yes && test -n "$relink_command"; then 8339266e564dSmrg rmfiles="$rmfiles $objdir/lt-$name" 8340266e564dSmrg fi 8341266e564dSmrg if test "X$noexename" != "X$name" ; then 8342266e564dSmrg rmfiles="$rmfiles $objdir/lt-${noexename}.c" 8343266e564dSmrg fi 8344266e564dSmrg fi 8345266e564dSmrg fi 8346266e564dSmrg ;; 8347266e564dSmrg esac 8348698f425bSmrg func_show_eval "$RM $rmfiles" 'exit_status=1' 8349266e564dSmrg done 8350266e564dSmrg objdir="$origobjdir" 8351266e564dSmrg 8352266e564dSmrg # Try to remove the ${objdir}s in the directories where we deleted files 8353266e564dSmrg for dir in $rmdirs; do 8354266e564dSmrg if test -d "$dir"; then 8355698f425bSmrg func_show_eval "rmdir $dir >/dev/null 2>&1" 8356266e564dSmrg fi 8357266e564dSmrg done 8358266e564dSmrg 8359266e564dSmrg exit $exit_status 8360698f425bSmrg} 8361266e564dSmrg 8362698f425bSmrg{ test "$mode" = uninstall || test "$mode" = clean; } && 8363698f425bSmrg func_mode_uninstall ${1+"$@"} 8364266e564dSmrg 8365698f425bSmrgtest -z "$mode" && { 8366698f425bSmrg help="$generic_help" 8367698f425bSmrg func_fatal_help "you must specify a MODE" 8368698f425bSmrg} 8369698f425bSmrg 8370698f425bSmrgtest -z "$exec_cmd" && \ 8371698f425bSmrg func_fatal_help "invalid operation mode \`$mode'" 8372266e564dSmrg 8373266e564dSmrgif test -n "$exec_cmd"; then 8374698f425bSmrg eval exec "$exec_cmd" 8375266e564dSmrg exit $EXIT_FAILURE 8376266e564dSmrgfi 8377266e564dSmrg 8378698f425bSmrgexit $exit_status 8379266e564dSmrg 8380266e564dSmrg 8381266e564dSmrg# The TAGs below are defined such that we never get into a situation 8382266e564dSmrg# in which we disable both kinds of libraries. Given conflicting 8383266e564dSmrg# choices, we go for a static library, that is the most portable, 8384266e564dSmrg# since we can't tell whether shared libraries were disabled because 8385266e564dSmrg# the user asked for that or because the platform doesn't support 8386266e564dSmrg# them. This is particularly important on AIX, because we don't 8387266e564dSmrg# support having both static and shared libraries enabled at the same 8388266e564dSmrg# time on that platform, so we default to a shared-only configuration. 8389266e564dSmrg# If a disable-shared tag is given, we'll fallback to a static-only 8390266e564dSmrg# configuration. But we'll never go from static-only to shared-only. 8391266e564dSmrg 8392266e564dSmrg# ### BEGIN LIBTOOL TAG CONFIG: disable-shared 8393698f425bSmrgbuild_libtool_libs=no 8394698f425bSmrgbuild_old_libs=yes 8395266e564dSmrg# ### END LIBTOOL TAG CONFIG: disable-shared 8396266e564dSmrg 8397266e564dSmrg# ### BEGIN LIBTOOL TAG CONFIG: disable-static 8398698f425bSmrgbuild_old_libs=`case $build_libtool_libs in yes) echo no;; *) echo yes;; esac` 8399266e564dSmrg# ### END LIBTOOL TAG CONFIG: disable-static 8400266e564dSmrg 8401266e564dSmrg# Local Variables: 8402266e564dSmrg# mode:shell-script 8403266e564dSmrg# sh-indentation:2 8404266e564dSmrg# End: 8405698f425bSmrg# vi:sw=2 8406698f425bSmrg 8407