1#! /usr/bin/env sh 2## DO NOT EDIT - This file generated from ./build-aux/ltmain.in 3## by inline-source v2019-02-19.15 4 5# libtool (GNU libtool) 2.4.7 6# Provide generalized library-building support services. 7# Written by Gordon Matzigkeit <gord@gnu.ai.mit.edu>, 1996 8 9# Copyright (C) 1996-2019, 2021-2022 Free Software Foundation, Inc. 10# This is free software; see the source for copying conditions. There is NO 11# warranty; not even for MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. 12 13# GNU Libtool is free software; you can redistribute it and/or modify 14# it under the terms of the GNU General Public License as published by 15# the Free Software Foundation; either version 2 of the License, or 16# (at your option) any later version. 17# 18# As a special exception to the GNU General Public License, 19# if you distribute this file as part of a program or library that 20# is built using GNU Libtool, you may include this file under the 21# same distribution terms that you use for the rest of that program. 22# 23# GNU Libtool is distributed in the hope that it will be useful, but 24# WITHOUT ANY WARRANTY; without even the implied warranty of 25# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU 26# General Public License for more details. 27# 28# You should have received a copy of the GNU General Public License 29# along with this program. If not, see <http://www.gnu.org/licenses/>. 30 31 32PROGRAM=libtool 33PACKAGE=libtool 34VERSION=2.4.7 35package_revision=2.4.7 36 37 38## ------ ## 39## Usage. ## 40## ------ ## 41 42# Run './libtool --help' for help with using this script from the 43# command line. 44 45 46## ------------------------------- ## 47## User overridable command paths. ## 48## ------------------------------- ## 49 50# After configure completes, it has a better idea of some of the 51# shell tools we need than the defaults used by the functions shared 52# with bootstrap, so set those here where they can still be over- 53# ridden by the user, but otherwise take precedence. 54 55: ${AUTOCONF="autoconf"} 56: ${AUTOMAKE="automake"} 57 58 59## -------------------------- ## 60## Source external libraries. ## 61## -------------------------- ## 62 63# Much of our low-level functionality needs to be sourced from external 64# libraries, which are installed to $pkgauxdir. 65 66# Set a version string for this script. 67scriptversion=2019-02-19.15; # UTC 68 69# General shell script boiler plate, and helper functions. 70# Written by Gary V. Vaughan, 2004 71 72# This is free software. There is NO warranty; not even for 73# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. 74# 75# Copyright (C) 2004-2019, 2021 Bootstrap Authors 76# 77# This file is dual licensed under the terms of the MIT license 78# <https://opensource.org/license/MIT>, and GPL version 2 or later 79# <http://www.gnu.org/licenses/gpl-2.0.html>. You must apply one of 80# these licenses when using or redistributing this software or any of 81# the files within it. See the URLs above, or the file `LICENSE` 82# included in the Bootstrap distribution for the full license texts. 83 84# Please report bugs or propose patches to: 85# <https://github.com/gnulib-modules/bootstrap/issues> 86 87 88## ------ ## 89## Usage. ## 90## ------ ## 91 92# Evaluate this file near the top of your script to gain access to 93# the functions and variables defined here: 94# 95# . `echo "$0" | ${SED-sed} 's|[^/]*$||'`/build-aux/funclib.sh 96# 97# If you need to override any of the default environment variable 98# settings, do that before evaluating this file. 99 100 101## -------------------- ## 102## Shell normalisation. ## 103## -------------------- ## 104 105# Some shells need a little help to be as Bourne compatible as possible. 106# Before doing anything else, make sure all that help has been provided! 107 108DUALCASE=1; export DUALCASE # for MKS sh 109if test -n "${ZSH_VERSION+set}" && (emulate sh) >/dev/null 2>&1; then : 110 emulate sh 111 NULLCMD=: 112 # Pre-4.2 versions of Zsh do word splitting on ${1+"$@"}, which 113 # is contrary to our usage. Disable this feature. 114 alias -g '${1+"$@"}'='"$@"' 115 setopt NO_GLOB_SUBST 116else 117 case `(set -o) 2>/dev/null` in *posix*) set -o posix ;; esac 118fi 119 120# NLS nuisances: We save the old values in case they are required later. 121_G_user_locale= 122_G_safe_locale= 123for _G_var in LANG LANGUAGE LC_ALL LC_CTYPE LC_COLLATE LC_MESSAGES 124do 125 eval "if test set = \"\${$_G_var+set}\"; then 126 save_$_G_var=\$$_G_var 127 $_G_var=C 128 export $_G_var 129 _G_user_locale=\"$_G_var=\\\$save_\$_G_var; \$_G_user_locale\" 130 _G_safe_locale=\"$_G_var=C; \$_G_safe_locale\" 131 fi" 132done 133# These NLS vars are set unconditionally (bootstrap issue #24). Unset those 134# in case the environment reset is needed later and the $save_* variant is not 135# defined (see the code above). 136LC_ALL=C 137LANGUAGE=C 138export LANGUAGE LC_ALL 139 140# Make sure IFS has a sensible default 141sp=' ' 142nl=' 143' 144IFS="$sp $nl" 145 146# There are apparently some retarded systems that use ';' as a PATH separator! 147if test "${PATH_SEPARATOR+set}" != set; then 148 PATH_SEPARATOR=: 149 (PATH='/bin;/bin'; FPATH=$PATH; sh -c :) >/dev/null 2>&1 && { 150 (PATH='/bin:/bin'; FPATH=$PATH; sh -c :) >/dev/null 2>&1 || 151 PATH_SEPARATOR=';' 152 } 153fi 154 155 156# func_unset VAR 157# -------------- 158# Portably unset VAR. 159# In some shells, an 'unset VAR' statement leaves a non-zero return 160# status if VAR is already unset, which might be problematic if the 161# statement is used at the end of a function (thus poisoning its return 162# value) or when 'set -e' is active (causing even a spurious abort of 163# the script in this case). 164func_unset () 165{ 166 { eval $1=; (eval unset $1) >/dev/null 2>&1 && eval unset $1 || : ; } 167} 168 169 170# Make sure CDPATH doesn't cause `cd` commands to output the target dir. 171func_unset CDPATH 172 173# Make sure ${,E,F}GREP behave sanely. 174func_unset GREP_OPTIONS 175 176 177## ------------------------- ## 178## Locate command utilities. ## 179## ------------------------- ## 180 181 182# func_executable_p FILE 183# ---------------------- 184# Check that FILE is an executable regular file. 185func_executable_p () 186{ 187 test -f "$1" && test -x "$1" 188} 189 190 191# func_path_progs PROGS_LIST CHECK_FUNC [PATH] 192# -------------------------------------------- 193# Search for either a program that responds to --version with output 194# containing "GNU", or else returned by CHECK_FUNC otherwise, by 195# trying all the directories in PATH with each of the elements of 196# PROGS_LIST. 197# 198# CHECK_FUNC should accept the path to a candidate program, and 199# set $func_check_prog_result if it truncates its output less than 200# $_G_path_prog_max characters. 201func_path_progs () 202{ 203 _G_progs_list=$1 204 _G_check_func=$2 205 _G_PATH=${3-"$PATH"} 206 207 _G_path_prog_max=0 208 _G_path_prog_found=false 209 _G_save_IFS=$IFS; IFS=${PATH_SEPARATOR-:} 210 for _G_dir in $_G_PATH; do 211 IFS=$_G_save_IFS 212 test -z "$_G_dir" && _G_dir=. 213 for _G_prog_name in $_G_progs_list; do 214 for _exeext in '' .EXE; do 215 _G_path_prog=$_G_dir/$_G_prog_name$_exeext 216 func_executable_p "$_G_path_prog" || continue 217 case `"$_G_path_prog" --version 2>&1` in 218 *GNU*) func_path_progs_result=$_G_path_prog _G_path_prog_found=: ;; 219 *) $_G_check_func $_G_path_prog 220 func_path_progs_result=$func_check_prog_result 221 ;; 222 esac 223 $_G_path_prog_found && break 3 224 done 225 done 226 done 227 IFS=$_G_save_IFS 228 test -z "$func_path_progs_result" && { 229 echo "no acceptable sed could be found in \$PATH" >&2 230 exit 1 231 } 232} 233 234 235# We want to be able to use the functions in this file before configure 236# has figured out where the best binaries are kept, which means we have 237# to search for them ourselves - except when the results are already set 238# where we skip the searches. 239 240# Unless the user overrides by setting SED, search the path for either GNU 241# sed, or the sed that truncates its output the least. 242test -z "$SED" && { 243 _G_sed_script=s/aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa/bbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbb/ 244 for _G_i in 1 2 3 4 5 6 7; do 245 _G_sed_script=$_G_sed_script$nl$_G_sed_script 246 done 247 echo "$_G_sed_script" 2>/dev/null | sed 99q >conftest.sed 248 _G_sed_script= 249 250 func_check_prog_sed () 251 { 252 _G_path_prog=$1 253 254 _G_count=0 255 printf 0123456789 >conftest.in 256 while : 257 do 258 cat conftest.in conftest.in >conftest.tmp 259 mv conftest.tmp conftest.in 260 cp conftest.in conftest.nl 261 echo '' >> conftest.nl 262 "$_G_path_prog" -f conftest.sed <conftest.nl >conftest.out 2>/dev/null || break 263 diff conftest.out conftest.nl >/dev/null 2>&1 || break 264 _G_count=`expr $_G_count + 1` 265 if test "$_G_count" -gt "$_G_path_prog_max"; then 266 # Best one so far, save it but keep looking for a better one 267 func_check_prog_result=$_G_path_prog 268 _G_path_prog_max=$_G_count 269 fi 270 # 10*(2^10) chars as input seems more than enough 271 test 10 -lt "$_G_count" && break 272 done 273 rm -f conftest.in conftest.tmp conftest.nl conftest.out 274 } 275 276 func_path_progs "sed gsed" func_check_prog_sed "$PATH:/usr/xpg4/bin" 277 rm -f conftest.sed 278 SED=$func_path_progs_result 279} 280 281 282# Unless the user overrides by setting GREP, search the path for either GNU 283# grep, or the grep that truncates its output the least. 284test -z "$GREP" && { 285 func_check_prog_grep () 286 { 287 _G_path_prog=$1 288 289 _G_count=0 290 _G_path_prog_max=0 291 printf 0123456789 >conftest.in 292 while : 293 do 294 cat conftest.in conftest.in >conftest.tmp 295 mv conftest.tmp conftest.in 296 cp conftest.in conftest.nl 297 echo 'GREP' >> conftest.nl 298 "$_G_path_prog" -e 'GREP$' -e '-(cannot match)-' <conftest.nl >conftest.out 2>/dev/null || break 299 diff conftest.out conftest.nl >/dev/null 2>&1 || break 300 _G_count=`expr $_G_count + 1` 301 if test "$_G_count" -gt "$_G_path_prog_max"; then 302 # Best one so far, save it but keep looking for a better one 303 func_check_prog_result=$_G_path_prog 304 _G_path_prog_max=$_G_count 305 fi 306 # 10*(2^10) chars as input seems more than enough 307 test 10 -lt "$_G_count" && break 308 done 309 rm -f conftest.in conftest.tmp conftest.nl conftest.out 310 } 311 312 func_path_progs "grep ggrep" func_check_prog_grep "$PATH:/usr/xpg4/bin" 313 GREP=$func_path_progs_result 314} 315 316 317## ------------------------------- ## 318## User overridable command paths. ## 319## ------------------------------- ## 320 321# All uppercase variable names are used for environment variables. These 322# variables can be overridden by the user before calling a script that 323# uses them if a suitable command of that name is not already available 324# in the command search PATH. 325 326unset CP 327unset MV 328unset RM 329: ${CP="cp -f"} 330: ${ECHO="printf %s\n"} 331: ${EGREP="$GREP -E"} 332: ${FGREP="$GREP -F"} 333: ${LN_S="ln -s"} 334: ${MAKE="make"} 335: ${MKDIR="mkdir"} 336: ${MV="mv -f"} 337: ${RM="rm -f"} 338: ${SHELL="${CONFIG_SHELL-/bin/sh}"} 339 340 341## -------------------- ## 342## Useful sed snippets. ## 343## -------------------- ## 344 345sed_dirname='s|/[^/]*$||' 346sed_basename='s|^.*/||' 347 348# Sed substitution that helps us do robust quoting. It backslashifies 349# metacharacters that are still active within double-quoted strings. 350sed_quote_subst='s|\([`"$\\]\)|\\\1|g' 351 352# Same as above, but do not quote variable references. 353sed_double_quote_subst='s/\(["`\\]\)/\\\1/g' 354 355# Sed substitution that turns a string into a regex matching for the 356# string literally. 357sed_make_literal_regex='s|[].[^$\\*\/]|\\&|g' 358 359# Sed substitution that converts a w32 file name or path 360# that contains forward slashes, into one that contains 361# (escaped) backslashes. A very naive implementation. 362sed_naive_backslashify='s|\\\\*|\\|g;s|/|\\|g;s|\\|\\\\|g' 363 364# Re-'\' parameter expansions in output of sed_double_quote_subst that 365# were '\'-ed in input to the same. If an odd number of '\' preceded a 366# '$' in input to sed_double_quote_subst, that '$' was protected from 367# expansion. Since each input '\' is now two '\'s, look for any number 368# of runs of four '\'s followed by two '\'s and then a '$'. '\' that '$'. 369_G_bs='\\' 370_G_bs2='\\\\' 371_G_bs4='\\\\\\\\' 372_G_dollar='\$' 373sed_double_backslash="\ 374 s/$_G_bs4/&\\ 375/g 376 s/^$_G_bs2$_G_dollar/$_G_bs&/ 377 s/\\([^$_G_bs]\\)$_G_bs2$_G_dollar/\\1$_G_bs2$_G_bs$_G_dollar/g 378 s/\n//g" 379 380# require_check_ifs_backslash 381# --------------------------- 382# Check if we can use backslash as IFS='\' separator, and set 383# $check_ifs_backshlash_broken to ':' or 'false'. 384require_check_ifs_backslash=func_require_check_ifs_backslash 385func_require_check_ifs_backslash () 386{ 387 _G_save_IFS=$IFS 388 IFS='\' 389 _G_check_ifs_backshlash='a\\b' 390 for _G_i in $_G_check_ifs_backshlash 391 do 392 case $_G_i in 393 a) 394 check_ifs_backshlash_broken=false 395 ;; 396 '') 397 break 398 ;; 399 *) 400 check_ifs_backshlash_broken=: 401 break 402 ;; 403 esac 404 done 405 IFS=$_G_save_IFS 406 require_check_ifs_backslash=: 407} 408 409 410## ----------------- ## 411## Global variables. ## 412## ----------------- ## 413 414# Except for the global variables explicitly listed below, the following 415# functions in the '^func_' namespace, and the '^require_' namespace 416# variables initialised in the 'Resource management' section, sourcing 417# this file will not pollute your global namespace with anything 418# else. There's no portable way to scope variables in Bourne shell 419# though, so actually running these functions will sometimes place 420# results into a variable named after the function, and often use 421# temporary variables in the '^_G_' namespace. If you are careful to 422# avoid using those namespaces casually in your sourcing script, things 423# should continue to work as you expect. And, of course, you can freely 424# overwrite any of the functions or variables defined here before 425# calling anything to customize them. 426 427EXIT_SUCCESS=0 428EXIT_FAILURE=1 429EXIT_MISMATCH=63 # $? = 63 is used to indicate version mismatch to missing. 430EXIT_SKIP=77 # $? = 77 is used to indicate a skipped test to automake. 431 432# Allow overriding, eg assuming that you follow the convention of 433# putting '$debug_cmd' at the start of all your functions, you can get 434# bash to show function call trace with: 435# 436# debug_cmd='eval echo "${FUNCNAME[0]} $*" >&2' bash your-script-name 437debug_cmd=${debug_cmd-":"} 438exit_cmd=: 439 440# By convention, finish your script with: 441# 442# exit $exit_status 443# 444# so that you can set exit_status to non-zero if you want to indicate 445# something went wrong during execution without actually bailing out at 446# the point of failure. 447exit_status=$EXIT_SUCCESS 448 449# Work around backward compatibility issue on IRIX 6.5. On IRIX 6.4+, sh 450# is ksh but when the shell is invoked as "sh" and the current value of 451# the _XPG environment variable is not equal to 1 (one), the special 452# positional parameter $0, within a function call, is the name of the 453# function. 454progpath=$0 455 456# The name of this program. 457progname=`$ECHO "$progpath" |$SED "$sed_basename"` 458 459# Make sure we have an absolute progpath for reexecution: 460case $progpath in 461 [\\/]*|[A-Za-z]:\\*) ;; 462 *[\\/]*) 463 progdir=`$ECHO "$progpath" |$SED "$sed_dirname"` 464 progdir=`cd "$progdir" && pwd` 465 progpath=$progdir/$progname 466 ;; 467 *) 468 _G_IFS=$IFS 469 IFS=${PATH_SEPARATOR-:} 470 for progdir in $PATH; do 471 IFS=$_G_IFS 472 test -x "$progdir/$progname" && break 473 done 474 IFS=$_G_IFS 475 test -n "$progdir" || progdir=`pwd` 476 progpath=$progdir/$progname 477 ;; 478esac 479 480 481## ----------------- ## 482## Standard options. ## 483## ----------------- ## 484 485# The following options affect the operation of the functions defined 486# below, and should be set appropriately depending on run-time para- 487# meters passed on the command line. 488 489opt_dry_run=false 490opt_quiet=false 491opt_verbose=false 492 493# Categories 'all' and 'none' are always available. Append any others 494# you will pass as the first argument to func_warning from your own 495# code. 496warning_categories= 497 498# By default, display warnings according to 'opt_warning_types'. Set 499# 'warning_func' to ':' to elide all warnings, or func_fatal_error to 500# treat the next displayed warning as a fatal error. 501warning_func=func_warn_and_continue 502 503# Set to 'all' to display all warnings, 'none' to suppress all 504# warnings, or a space delimited list of some subset of 505# 'warning_categories' to display only the listed warnings. 506opt_warning_types=all 507 508 509## -------------------- ## 510## Resource management. ## 511## -------------------- ## 512 513# This section contains definitions for functions that each ensure a 514# particular resource (a file, or a non-empty configuration variable for 515# example) is available, and if appropriate to extract default values 516# from pertinent package files. Call them using their associated 517# 'require_*' variable to ensure that they are executed, at most, once. 518# 519# It's entirely deliberate that calling these functions can set 520# variables that don't obey the namespace limitations obeyed by the rest 521# of this file, in order that that they be as useful as possible to 522# callers. 523 524 525# require_term_colors 526# ------------------- 527# Allow display of bold text on terminals that support it. 528require_term_colors=func_require_term_colors 529func_require_term_colors () 530{ 531 $debug_cmd 532 533 test -t 1 && { 534 # COLORTERM and USE_ANSI_COLORS environment variables take 535 # precedence, because most terminfo databases neglect to describe 536 # whether color sequences are supported. 537 test -n "${COLORTERM+set}" && : ${USE_ANSI_COLORS="1"} 538 539 if test 1 = "$USE_ANSI_COLORS"; then 540 # Standard ANSI escape sequences 541 tc_reset='[0m' 542 tc_bold='[1m'; tc_standout='[7m' 543 tc_red='[31m'; tc_green='[32m' 544 tc_blue='[34m'; tc_cyan='[36m' 545 else 546 # Otherwise trust the terminfo database after all. 547 test -n "`tput sgr0 2>/dev/null`" && { 548 tc_reset=`tput sgr0` 549 test -n "`tput bold 2>/dev/null`" && tc_bold=`tput bold` 550 tc_standout=$tc_bold 551 test -n "`tput smso 2>/dev/null`" && tc_standout=`tput smso` 552 test -n "`tput setaf 1 2>/dev/null`" && tc_red=`tput setaf 1` 553 test -n "`tput setaf 2 2>/dev/null`" && tc_green=`tput setaf 2` 554 test -n "`tput setaf 4 2>/dev/null`" && tc_blue=`tput setaf 4` 555 test -n "`tput setaf 5 2>/dev/null`" && tc_cyan=`tput setaf 5` 556 } 557 fi 558 } 559 560 require_term_colors=: 561} 562 563 564## ----------------- ## 565## Function library. ## 566## ----------------- ## 567 568# This section contains a variety of useful functions to call in your 569# scripts. Take note of the portable wrappers for features provided by 570# some modern shells, which will fall back to slower equivalents on 571# less featureful shells. 572 573 574# func_append VAR VALUE 575# --------------------- 576# Append VALUE onto the existing contents of VAR. 577 578 # We should try to minimise forks, especially on Windows where they are 579 # unreasonably slow, so skip the feature probes when bash or zsh are 580 # being used: 581 if test set = "${BASH_VERSION+set}${ZSH_VERSION+set}"; then 582 : ${_G_HAVE_ARITH_OP="yes"} 583 : ${_G_HAVE_XSI_OPS="yes"} 584 # The += operator was introduced in bash 3.1 585 case $BASH_VERSION in 586 [12].* | 3.0 | 3.0*) ;; 587 *) 588 : ${_G_HAVE_PLUSEQ_OP="yes"} 589 ;; 590 esac 591 fi 592 593 # _G_HAVE_PLUSEQ_OP 594 # Can be empty, in which case the shell is probed, "yes" if += is 595 # useable or anything else if it does not work. 596 test -z "$_G_HAVE_PLUSEQ_OP" \ 597 && (eval 'x=a; x+=" b"; test "a b" = "$x"') 2>/dev/null \ 598 && _G_HAVE_PLUSEQ_OP=yes 599 600if test yes = "$_G_HAVE_PLUSEQ_OP" 601then 602 # This is an XSI compatible shell, allowing a faster implementation... 603 eval 'func_append () 604 { 605 $debug_cmd 606 607 eval "$1+=\$2" 608 }' 609else 610 # ...otherwise fall back to using expr, which is often a shell builtin. 611 func_append () 612 { 613 $debug_cmd 614 615 eval "$1=\$$1\$2" 616 } 617fi 618 619 620# func_append_quoted VAR VALUE 621# ---------------------------- 622# Quote VALUE and append to the end of shell variable VAR, separated 623# by a space. 624if test yes = "$_G_HAVE_PLUSEQ_OP"; then 625 eval 'func_append_quoted () 626 { 627 $debug_cmd 628 629 func_quote_arg pretty "$2" 630 eval "$1+=\\ \$func_quote_arg_result" 631 }' 632else 633 func_append_quoted () 634 { 635 $debug_cmd 636 637 func_quote_arg pretty "$2" 638 eval "$1=\$$1\\ \$func_quote_arg_result" 639 } 640fi 641 642 643# func_append_uniq VAR VALUE 644# -------------------------- 645# Append unique VALUE onto the existing contents of VAR, assuming 646# entries are delimited by the first character of VALUE. For example: 647# 648# func_append_uniq options " --another-option option-argument" 649# 650# will only append to $options if " --another-option option-argument " 651# is not already present somewhere in $options already (note spaces at 652# each end implied by leading space in second argument). 653func_append_uniq () 654{ 655 $debug_cmd 656 657 eval _G_current_value='`$ECHO $'$1'`' 658 _G_delim=`expr "$2" : '\(.\)'` 659 660 case $_G_delim$_G_current_value$_G_delim in 661 *"$2$_G_delim"*) ;; 662 *) func_append "$@" ;; 663 esac 664} 665 666 667# func_arith TERM... 668# ------------------ 669# Set func_arith_result to the result of evaluating TERMs. 670 test -z "$_G_HAVE_ARITH_OP" \ 671 && (eval 'test 2 = $(( 1 + 1 ))') 2>/dev/null \ 672 && _G_HAVE_ARITH_OP=yes 673 674if test yes = "$_G_HAVE_ARITH_OP"; then 675 eval 'func_arith () 676 { 677 $debug_cmd 678 679 func_arith_result=$(( $* )) 680 }' 681else 682 func_arith () 683 { 684 $debug_cmd 685 686 func_arith_result=`expr "$@"` 687 } 688fi 689 690 691# func_basename FILE 692# ------------------ 693# Set func_basename_result to FILE with everything up to and including 694# the last / stripped. 695if test yes = "$_G_HAVE_XSI_OPS"; then 696 # If this shell supports suffix pattern removal, then use it to avoid 697 # forking. Hide the definitions single quotes in case the shell chokes 698 # on unsupported syntax... 699 _b='func_basename_result=${1##*/}' 700 _d='case $1 in 701 */*) func_dirname_result=${1%/*}$2 ;; 702 * ) func_dirname_result=$3 ;; 703 esac' 704 705else 706 # ...otherwise fall back to using sed. 707 _b='func_basename_result=`$ECHO "$1" |$SED "$sed_basename"`' 708 _d='func_dirname_result=`$ECHO "$1" |$SED "$sed_dirname"` 709 if test "X$func_dirname_result" = "X$1"; then 710 func_dirname_result=$3 711 else 712 func_append func_dirname_result "$2" 713 fi' 714fi 715 716eval 'func_basename () 717{ 718 $debug_cmd 719 720 '"$_b"' 721}' 722 723 724# func_dirname FILE APPEND NONDIR_REPLACEMENT 725# ------------------------------------------- 726# Compute the dirname of FILE. If nonempty, add APPEND to the result, 727# otherwise set result to NONDIR_REPLACEMENT. 728eval 'func_dirname () 729{ 730 $debug_cmd 731 732 '"$_d"' 733}' 734 735 736# func_dirname_and_basename FILE APPEND NONDIR_REPLACEMENT 737# -------------------------------------------------------- 738# Perform func_basename and func_dirname in a single function 739# call: 740# dirname: Compute the dirname of FILE. If nonempty, 741# add APPEND to the result, otherwise set result 742# to NONDIR_REPLACEMENT. 743# value returned in "$func_dirname_result" 744# basename: Compute filename of FILE. 745# value retuned in "$func_basename_result" 746# For efficiency, we do not delegate to the functions above but instead 747# duplicate the functionality here. 748eval 'func_dirname_and_basename () 749{ 750 $debug_cmd 751 752 '"$_b"' 753 '"$_d"' 754}' 755 756 757# func_echo ARG... 758# ---------------- 759# Echo program name prefixed message. 760func_echo () 761{ 762 $debug_cmd 763 764 _G_message=$* 765 766 func_echo_IFS=$IFS 767 IFS=$nl 768 for _G_line in $_G_message; do 769 IFS=$func_echo_IFS 770 $ECHO "$progname: $_G_line" 771 done 772 IFS=$func_echo_IFS 773} 774 775 776# func_echo_all ARG... 777# -------------------- 778# Invoke $ECHO with all args, space-separated. 779func_echo_all () 780{ 781 $ECHO "$*" 782} 783 784 785# func_echo_infix_1 INFIX ARG... 786# ------------------------------ 787# Echo program name, followed by INFIX on the first line, with any 788# additional lines not showing INFIX. 789func_echo_infix_1 () 790{ 791 $debug_cmd 792 793 $require_term_colors 794 795 _G_infix=$1; shift 796 _G_indent=$_G_infix 797 _G_prefix="$progname: $_G_infix: " 798 _G_message=$* 799 800 # Strip color escape sequences before counting printable length 801 for _G_tc in "$tc_reset" "$tc_bold" "$tc_standout" "$tc_red" "$tc_green" "$tc_blue" "$tc_cyan" 802 do 803 test -n "$_G_tc" && { 804 _G_esc_tc=`$ECHO "$_G_tc" | $SED "$sed_make_literal_regex"` 805 _G_indent=`$ECHO "$_G_indent" | $SED "s|$_G_esc_tc||g"` 806 } 807 done 808 _G_indent="$progname: "`echo "$_G_indent" | $SED 's|.| |g'`" " ## exclude from sc_prohibit_nested_quotes 809 810 func_echo_infix_1_IFS=$IFS 811 IFS=$nl 812 for _G_line in $_G_message; do 813 IFS=$func_echo_infix_1_IFS 814 $ECHO "$_G_prefix$tc_bold$_G_line$tc_reset" >&2 815 _G_prefix=$_G_indent 816 done 817 IFS=$func_echo_infix_1_IFS 818} 819 820 821# func_error ARG... 822# ----------------- 823# Echo program name prefixed message to standard error. 824func_error () 825{ 826 $debug_cmd 827 828 $require_term_colors 829 830 func_echo_infix_1 " $tc_standout${tc_red}error$tc_reset" "$*" >&2 831} 832 833 834# func_fatal_error ARG... 835# ----------------------- 836# Echo program name prefixed message to standard error, and exit. 837func_fatal_error () 838{ 839 $debug_cmd 840 841 func_error "$*" 842 exit $EXIT_FAILURE 843} 844 845 846# func_grep EXPRESSION FILENAME 847# ----------------------------- 848# Check whether EXPRESSION matches any line of FILENAME, without output. 849func_grep () 850{ 851 $debug_cmd 852 853 $GREP "$1" "$2" >/dev/null 2>&1 854} 855 856 857# func_len STRING 858# --------------- 859# Set func_len_result to the length of STRING. STRING may not 860# start with a hyphen. 861 test -z "$_G_HAVE_XSI_OPS" \ 862 && (eval 'x=a/b/c; 863 test 5aa/bb/cc = "${#x}${x%%/*}${x%/*}${x#*/}${x##*/}"') 2>/dev/null \ 864 && _G_HAVE_XSI_OPS=yes 865 866if test yes = "$_G_HAVE_XSI_OPS"; then 867 eval 'func_len () 868 { 869 $debug_cmd 870 871 func_len_result=${#1} 872 }' 873else 874 func_len () 875 { 876 $debug_cmd 877 878 func_len_result=`expr "$1" : ".*" 2>/dev/null || echo $max_cmd_len` 879 } 880fi 881 882 883# func_mkdir_p DIRECTORY-PATH 884# --------------------------- 885# Make sure the entire path to DIRECTORY-PATH is available. 886func_mkdir_p () 887{ 888 $debug_cmd 889 890 _G_directory_path=$1 891 _G_dir_list= 892 893 if test -n "$_G_directory_path" && test : != "$opt_dry_run"; then 894 895 # Protect directory names starting with '-' 896 case $_G_directory_path in 897 -*) _G_directory_path=./$_G_directory_path ;; 898 esac 899 900 # While some portion of DIR does not yet exist... 901 while test ! -d "$_G_directory_path"; do 902 # ...make a list in topmost first order. Use a colon delimited 903 # list incase some portion of path contains whitespace. 904 _G_dir_list=$_G_directory_path:$_G_dir_list 905 906 # If the last portion added has no slash in it, the list is done 907 case $_G_directory_path in */*) ;; *) break ;; esac 908 909 # ...otherwise throw away the child directory and loop 910 _G_directory_path=`$ECHO "$_G_directory_path" | $SED -e "$sed_dirname"` 911 done 912 _G_dir_list=`$ECHO "$_G_dir_list" | $SED 's|:*$||'` 913 914 func_mkdir_p_IFS=$IFS; IFS=: 915 for _G_dir in $_G_dir_list; do 916 IFS=$func_mkdir_p_IFS 917 # mkdir can fail with a 'File exist' error if two processes 918 # try to create one of the directories concurrently. Don't 919 # stop in that case! 920 $MKDIR "$_G_dir" 2>/dev/null || : 921 done 922 IFS=$func_mkdir_p_IFS 923 924 # Bail out if we (or some other process) failed to create a directory. 925 test -d "$_G_directory_path" || \ 926 func_fatal_error "Failed to create '$1'" 927 fi 928} 929 930 931# func_mktempdir [BASENAME] 932# ------------------------- 933# Make a temporary directory that won't clash with other running 934# libtool processes, and avoids race conditions if possible. If 935# given, BASENAME is the basename for that directory. 936func_mktempdir () 937{ 938 $debug_cmd 939 940 _G_template=${TMPDIR-/tmp}/${1-$progname} 941 942 if test : = "$opt_dry_run"; then 943 # Return a directory name, but don't create it in dry-run mode 944 _G_tmpdir=$_G_template-$$ 945 else 946 947 # If mktemp works, use that first and foremost 948 _G_tmpdir=`mktemp -d "$_G_template-XXXXXXXX" 2>/dev/null` 949 950 if test ! -d "$_G_tmpdir"; then 951 # Failing that, at least try and use $RANDOM to avoid a race 952 _G_tmpdir=$_G_template-${RANDOM-0}$$ 953 954 func_mktempdir_umask=`umask` 955 umask 0077 956 $MKDIR "$_G_tmpdir" 957 umask $func_mktempdir_umask 958 fi 959 960 # If we're not in dry-run mode, bomb out on failure 961 test -d "$_G_tmpdir" || \ 962 func_fatal_error "cannot create temporary directory '$_G_tmpdir'" 963 fi 964 965 $ECHO "$_G_tmpdir" 966} 967 968 969# func_normal_abspath PATH 970# ------------------------ 971# Remove doubled-up and trailing slashes, "." path components, 972# and cancel out any ".." path components in PATH after making 973# it an absolute path. 974func_normal_abspath () 975{ 976 $debug_cmd 977 978 # These SED scripts presuppose an absolute path with a trailing slash. 979 _G_pathcar='s|^/\([^/]*\).*$|\1|' 980 _G_pathcdr='s|^/[^/]*||' 981 _G_removedotparts=':dotsl 982 s|/\./|/|g 983 t dotsl 984 s|/\.$|/|' 985 _G_collapseslashes='s|/\{1,\}|/|g' 986 _G_finalslash='s|/*$|/|' 987 988 # Start from root dir and reassemble the path. 989 func_normal_abspath_result= 990 func_normal_abspath_tpath=$1 991 func_normal_abspath_altnamespace= 992 case $func_normal_abspath_tpath in 993 "") 994 # Empty path, that just means $cwd. 995 func_stripname '' '/' "`pwd`" 996 func_normal_abspath_result=$func_stripname_result 997 return 998 ;; 999 # The next three entries are used to spot a run of precisely 1000 # two leading slashes without using negated character classes; 1001 # we take advantage of case's first-match behaviour. 1002 ///*) 1003 # Unusual form of absolute path, do nothing. 1004 ;; 1005 //*) 1006 # Not necessarily an ordinary path; POSIX reserves leading '//' 1007 # and for example Cygwin uses it to access remote file shares 1008 # over CIFS/SMB, so we conserve a leading double slash if found. 1009 func_normal_abspath_altnamespace=/ 1010 ;; 1011 /*) 1012 # Absolute path, do nothing. 1013 ;; 1014 *) 1015 # Relative path, prepend $cwd. 1016 func_normal_abspath_tpath=`pwd`/$func_normal_abspath_tpath 1017 ;; 1018 esac 1019 1020 # Cancel out all the simple stuff to save iterations. We also want 1021 # the path to end with a slash for ease of parsing, so make sure 1022 # there is one (and only one) here. 1023 func_normal_abspath_tpath=`$ECHO "$func_normal_abspath_tpath" | $SED \ 1024 -e "$_G_removedotparts" -e "$_G_collapseslashes" -e "$_G_finalslash"` 1025 while :; do 1026 # Processed it all yet? 1027 if test / = "$func_normal_abspath_tpath"; then 1028 # If we ascended to the root using ".." the result may be empty now. 1029 if test -z "$func_normal_abspath_result"; then 1030 func_normal_abspath_result=/ 1031 fi 1032 break 1033 fi 1034 func_normal_abspath_tcomponent=`$ECHO "$func_normal_abspath_tpath" | $SED \ 1035 -e "$_G_pathcar"` 1036 func_normal_abspath_tpath=`$ECHO "$func_normal_abspath_tpath" | $SED \ 1037 -e "$_G_pathcdr"` 1038 # Figure out what to do with it 1039 case $func_normal_abspath_tcomponent in 1040 "") 1041 # Trailing empty path component, ignore it. 1042 ;; 1043 ..) 1044 # Parent dir; strip last assembled component from result. 1045 func_dirname "$func_normal_abspath_result" 1046 func_normal_abspath_result=$func_dirname_result 1047 ;; 1048 *) 1049 # Actual path component, append it. 1050 func_append func_normal_abspath_result "/$func_normal_abspath_tcomponent" 1051 ;; 1052 esac 1053 done 1054 # Restore leading double-slash if one was found on entry. 1055 func_normal_abspath_result=$func_normal_abspath_altnamespace$func_normal_abspath_result 1056} 1057 1058 1059# func_notquiet ARG... 1060# -------------------- 1061# Echo program name prefixed message only when not in quiet mode. 1062func_notquiet () 1063{ 1064 $debug_cmd 1065 1066 $opt_quiet || func_echo ${1+"$@"} 1067 1068 # A bug in bash halts the script if the last line of a function 1069 # fails when set -e is in force, so we need another command to 1070 # work around that: 1071 : 1072} 1073 1074 1075# func_relative_path SRCDIR DSTDIR 1076# -------------------------------- 1077# Set func_relative_path_result to the relative path from SRCDIR to DSTDIR. 1078func_relative_path () 1079{ 1080 $debug_cmd 1081 1082 func_relative_path_result= 1083 func_normal_abspath "$1" 1084 func_relative_path_tlibdir=$func_normal_abspath_result 1085 func_normal_abspath "$2" 1086 func_relative_path_tbindir=$func_normal_abspath_result 1087 1088 # Ascend the tree starting from libdir 1089 while :; do 1090 # check if we have found a prefix of bindir 1091 case $func_relative_path_tbindir in 1092 $func_relative_path_tlibdir) 1093 # found an exact match 1094 func_relative_path_tcancelled= 1095 break 1096 ;; 1097 $func_relative_path_tlibdir*) 1098 # found a matching prefix 1099 func_stripname "$func_relative_path_tlibdir" '' "$func_relative_path_tbindir" 1100 func_relative_path_tcancelled=$func_stripname_result 1101 if test -z "$func_relative_path_result"; then 1102 func_relative_path_result=. 1103 fi 1104 break 1105 ;; 1106 *) 1107 func_dirname $func_relative_path_tlibdir 1108 func_relative_path_tlibdir=$func_dirname_result 1109 if test -z "$func_relative_path_tlibdir"; then 1110 # Have to descend all the way to the root! 1111 func_relative_path_result=../$func_relative_path_result 1112 func_relative_path_tcancelled=$func_relative_path_tbindir 1113 break 1114 fi 1115 func_relative_path_result=../$func_relative_path_result 1116 ;; 1117 esac 1118 done 1119 1120 # Now calculate path; take care to avoid doubling-up slashes. 1121 func_stripname '' '/' "$func_relative_path_result" 1122 func_relative_path_result=$func_stripname_result 1123 func_stripname '/' '/' "$func_relative_path_tcancelled" 1124 if test -n "$func_stripname_result"; then 1125 func_append func_relative_path_result "/$func_stripname_result" 1126 fi 1127 1128 # Normalisation. If bindir is libdir, return '.' else relative path. 1129 if test -n "$func_relative_path_result"; then 1130 func_stripname './' '' "$func_relative_path_result" 1131 func_relative_path_result=$func_stripname_result 1132 fi 1133 1134 test -n "$func_relative_path_result" || func_relative_path_result=. 1135 1136 : 1137} 1138 1139 1140# func_quote_portable EVAL ARG 1141# ---------------------------- 1142# Internal function to portably implement func_quote_arg. Note that we still 1143# keep attention to performance here so we as much as possible try to avoid 1144# calling sed binary (so far O(N) complexity as long as func_append is O(1)). 1145func_quote_portable () 1146{ 1147 $debug_cmd 1148 1149 $require_check_ifs_backslash 1150 1151 func_quote_portable_result=$2 1152 1153 # one-time-loop (easy break) 1154 while true 1155 do 1156 if $1; then 1157 func_quote_portable_result=`$ECHO "$2" | $SED \ 1158 -e "$sed_double_quote_subst" -e "$sed_double_backslash"` 1159 break 1160 fi 1161 1162 # Quote for eval. 1163 case $func_quote_portable_result in 1164 *[\\\`\"\$]*) 1165 # Fallback to sed for $func_check_bs_ifs_broken=:, or when the string 1166 # contains the shell wildcard characters. 1167 case $check_ifs_backshlash_broken$func_quote_portable_result in 1168 :*|*[\[\*\?]*) 1169 func_quote_portable_result=`$ECHO "$func_quote_portable_result" \ 1170 | $SED "$sed_quote_subst"` 1171 break 1172 ;; 1173 esac 1174 1175 func_quote_portable_old_IFS=$IFS 1176 for _G_char in '\' '`' '"' '$' 1177 do 1178 # STATE($1) PREV($2) SEPARATOR($3) 1179 set start "" "" 1180 func_quote_portable_result=dummy"$_G_char$func_quote_portable_result$_G_char"dummy 1181 IFS=$_G_char 1182 for _G_part in $func_quote_portable_result 1183 do 1184 case $1 in 1185 quote) 1186 func_append func_quote_portable_result "$3$2" 1187 set quote "$_G_part" "\\$_G_char" 1188 ;; 1189 start) 1190 set first "" "" 1191 func_quote_portable_result= 1192 ;; 1193 first) 1194 set quote "$_G_part" "" 1195 ;; 1196 esac 1197 done 1198 done 1199 IFS=$func_quote_portable_old_IFS 1200 ;; 1201 *) ;; 1202 esac 1203 break 1204 done 1205 1206 func_quote_portable_unquoted_result=$func_quote_portable_result 1207 case $func_quote_portable_result in 1208 # double-quote args containing shell metacharacters to delay 1209 # word splitting, command substitution and variable expansion 1210 # for a subsequent eval. 1211 # many bourne shells cannot handle close brackets correctly 1212 # in scan sets, so we specify it separately. 1213 *[\[\~\#\^\&\*\(\)\{\}\|\;\<\>\?\'\ \ ]*|*]*|"") 1214 func_quote_portable_result=\"$func_quote_portable_result\" 1215 ;; 1216 esac 1217} 1218 1219 1220# func_quotefast_eval ARG 1221# ----------------------- 1222# Quote one ARG (internal). This is equivalent to 'func_quote_arg eval ARG', 1223# but optimized for speed. Result is stored in $func_quotefast_eval. 1224if test xyes = `(x=; printf -v x %q yes; echo x"$x") 2>/dev/null`; then 1225 printf -v _GL_test_printf_tilde %q '~' 1226 if test '\~' = "$_GL_test_printf_tilde"; then 1227 func_quotefast_eval () 1228 { 1229 printf -v func_quotefast_eval_result %q "$1" 1230 } 1231 else 1232 # Broken older Bash implementations. Make those faster too if possible. 1233 func_quotefast_eval () 1234 { 1235 case $1 in 1236 '~'*) 1237 func_quote_portable false "$1" 1238 func_quotefast_eval_result=$func_quote_portable_result 1239 ;; 1240 *) 1241 printf -v func_quotefast_eval_result %q "$1" 1242 ;; 1243 esac 1244 } 1245 fi 1246else 1247 func_quotefast_eval () 1248 { 1249 func_quote_portable false "$1" 1250 func_quotefast_eval_result=$func_quote_portable_result 1251 } 1252fi 1253 1254 1255# func_quote_arg MODEs ARG 1256# ------------------------ 1257# Quote one ARG to be evaled later. MODEs argument may contain zero or more 1258# specifiers listed below separated by ',' character. This function returns two 1259# values: 1260# i) func_quote_arg_result 1261# double-quoted (when needed), suitable for a subsequent eval 1262# ii) func_quote_arg_unquoted_result 1263# has all characters that are still active within double 1264# quotes backslashified. Available only if 'unquoted' is specified. 1265# 1266# Available modes: 1267# ---------------- 1268# 'eval' (default) 1269# - escape shell special characters 1270# 'expand' 1271# - the same as 'eval'; but do not quote variable references 1272# 'pretty' 1273# - request aesthetic output, i.e. '"a b"' instead of 'a\ b'. This might 1274# be used later in func_quote to get output like: 'echo "a b"' instead 1275# of 'echo a\ b'. This is slower than default on some shells. 1276# 'unquoted' 1277# - produce also $func_quote_arg_unquoted_result which does not contain 1278# wrapping double-quotes. 1279# 1280# Examples for 'func_quote_arg pretty,unquoted string': 1281# 1282# string | *_result | *_unquoted_result 1283# ------------+-----------------------+------------------- 1284# " | \" | \" 1285# a b | "a b" | a b 1286# "a b" | "\"a b\"" | \"a b\" 1287# * | "*" | * 1288# z="${x-$y}" | "z=\"\${x-\$y}\"" | z=\"\${x-\$y}\" 1289# 1290# Examples for 'func_quote_arg pretty,unquoted,expand string': 1291# 1292# string | *_result | *_unquoted_result 1293# --------------+---------------------+-------------------- 1294# z="${x-$y}" | "z=\"${x-$y}\"" | z=\"${x-$y}\" 1295func_quote_arg () 1296{ 1297 _G_quote_expand=false 1298 case ,$1, in 1299 *,expand,*) 1300 _G_quote_expand=: 1301 ;; 1302 esac 1303 1304 case ,$1, in 1305 *,pretty,*|*,expand,*|*,unquoted,*) 1306 func_quote_portable $_G_quote_expand "$2" 1307 func_quote_arg_result=$func_quote_portable_result 1308 func_quote_arg_unquoted_result=$func_quote_portable_unquoted_result 1309 ;; 1310 *) 1311 # Faster quote-for-eval for some shells. 1312 func_quotefast_eval "$2" 1313 func_quote_arg_result=$func_quotefast_eval_result 1314 ;; 1315 esac 1316} 1317 1318 1319# func_quote MODEs ARGs... 1320# ------------------------ 1321# Quote all ARGs to be evaled later and join them into single command. See 1322# func_quote_arg's description for more info. 1323func_quote () 1324{ 1325 $debug_cmd 1326 _G_func_quote_mode=$1 ; shift 1327 func_quote_result= 1328 while test 0 -lt $#; do 1329 func_quote_arg "$_G_func_quote_mode" "$1" 1330 if test -n "$func_quote_result"; then 1331 func_append func_quote_result " $func_quote_arg_result" 1332 else 1333 func_append func_quote_result "$func_quote_arg_result" 1334 fi 1335 shift 1336 done 1337} 1338 1339 1340# func_stripname PREFIX SUFFIX NAME 1341# --------------------------------- 1342# strip PREFIX and SUFFIX from NAME, and store in func_stripname_result. 1343# PREFIX and SUFFIX must not contain globbing or regex special 1344# characters, hashes, percent signs, but SUFFIX may contain a leading 1345# dot (in which case that matches only a dot). 1346if test yes = "$_G_HAVE_XSI_OPS"; then 1347 eval 'func_stripname () 1348 { 1349 $debug_cmd 1350 1351 # pdksh 5.2.14 does not do ${X%$Y} correctly if both X and Y are 1352 # positional parameters, so assign one to ordinary variable first. 1353 func_stripname_result=$3 1354 func_stripname_result=${func_stripname_result#"$1"} 1355 func_stripname_result=${func_stripname_result%"$2"} 1356 }' 1357else 1358 func_stripname () 1359 { 1360 $debug_cmd 1361 1362 case $2 in 1363 .*) func_stripname_result=`$ECHO "$3" | $SED -e "s%^$1%%" -e "s%\\\\$2\$%%"`;; 1364 *) func_stripname_result=`$ECHO "$3" | $SED -e "s%^$1%%" -e "s%$2\$%%"`;; 1365 esac 1366 } 1367fi 1368 1369 1370# func_show_eval CMD [FAIL_EXP] 1371# ----------------------------- 1372# Unless opt_quiet is true, then output CMD. Then, if opt_dryrun is 1373# not true, evaluate CMD. If the evaluation of CMD fails, and FAIL_EXP 1374# is given, then evaluate it. 1375func_show_eval () 1376{ 1377 $debug_cmd 1378 1379 _G_cmd=$1 1380 _G_fail_exp=${2-':'} 1381 1382 func_quote_arg pretty,expand "$_G_cmd" 1383 eval "func_notquiet $func_quote_arg_result" 1384 1385 $opt_dry_run || { 1386 eval "$_G_cmd" 1387 _G_status=$? 1388 if test 0 -ne "$_G_status"; then 1389 eval "(exit $_G_status); $_G_fail_exp" 1390 fi 1391 } 1392} 1393 1394 1395# func_show_eval_locale CMD [FAIL_EXP] 1396# ------------------------------------ 1397# Unless opt_quiet is true, then output CMD. Then, if opt_dryrun is 1398# not true, evaluate CMD. If the evaluation of CMD fails, and FAIL_EXP 1399# is given, then evaluate it. Use the saved locale for evaluation. 1400func_show_eval_locale () 1401{ 1402 $debug_cmd 1403 1404 _G_cmd=$1 1405 _G_fail_exp=${2-':'} 1406 1407 $opt_quiet || { 1408 func_quote_arg expand,pretty "$_G_cmd" 1409 eval "func_echo $func_quote_arg_result" 1410 } 1411 1412 $opt_dry_run || { 1413 eval "$_G_user_locale 1414 $_G_cmd" 1415 _G_status=$? 1416 eval "$_G_safe_locale" 1417 if test 0 -ne "$_G_status"; then 1418 eval "(exit $_G_status); $_G_fail_exp" 1419 fi 1420 } 1421} 1422 1423 1424# func_tr_sh 1425# ---------- 1426# Turn $1 into a string suitable for a shell variable name. 1427# Result is stored in $func_tr_sh_result. All characters 1428# not in the set a-zA-Z0-9_ are replaced with '_'. Further, 1429# if $1 begins with a digit, a '_' is prepended as well. 1430func_tr_sh () 1431{ 1432 $debug_cmd 1433 1434 case $1 in 1435 [0-9]* | *[!a-zA-Z0-9_]*) 1436 func_tr_sh_result=`$ECHO "$1" | $SED -e 's/^\([0-9]\)/_\1/' -e 's/[^a-zA-Z0-9_]/_/g'` 1437 ;; 1438 * ) 1439 func_tr_sh_result=$1 1440 ;; 1441 esac 1442} 1443 1444 1445# func_verbose ARG... 1446# ------------------- 1447# Echo program name prefixed message in verbose mode only. 1448func_verbose () 1449{ 1450 $debug_cmd 1451 1452 $opt_verbose && func_echo "$*" 1453 1454 : 1455} 1456 1457 1458# func_warn_and_continue ARG... 1459# ----------------------------- 1460# Echo program name prefixed warning message to standard error. 1461func_warn_and_continue () 1462{ 1463 $debug_cmd 1464 1465 $require_term_colors 1466 1467 func_echo_infix_1 "${tc_red}warning$tc_reset" "$*" >&2 1468} 1469 1470 1471# func_warning CATEGORY ARG... 1472# ---------------------------- 1473# Echo program name prefixed warning message to standard error. Warning 1474# messages can be filtered according to CATEGORY, where this function 1475# elides messages where CATEGORY is not listed in the global variable 1476# 'opt_warning_types'. 1477func_warning () 1478{ 1479 $debug_cmd 1480 1481 # CATEGORY must be in the warning_categories list! 1482 case " $warning_categories " in 1483 *" $1 "*) ;; 1484 *) func_internal_error "invalid warning category '$1'" ;; 1485 esac 1486 1487 _G_category=$1 1488 shift 1489 1490 case " $opt_warning_types " in 1491 *" $_G_category "*) $warning_func ${1+"$@"} ;; 1492 esac 1493} 1494 1495 1496# func_sort_ver VER1 VER2 1497# ----------------------- 1498# 'sort -V' is not generally available. 1499# Note this deviates from the version comparison in automake 1500# in that it treats 1.5 < 1.5.0, and treats 1.4.4a < 1.4-p3a 1501# but this should suffice as we won't be specifying old 1502# version formats or redundant trailing .0 in bootstrap.conf. 1503# If we did want full compatibility then we should probably 1504# use m4_version_compare from autoconf. 1505func_sort_ver () 1506{ 1507 $debug_cmd 1508 1509 printf '%s\n%s\n' "$1" "$2" \ 1510 | sort -t. -k 1,1n -k 2,2n -k 3,3n -k 4,4n -k 5,5n -k 6,6n -k 7,7n -k 8,8n -k 9,9n 1511} 1512 1513# func_lt_ver PREV CURR 1514# --------------------- 1515# Return true if PREV and CURR are in the correct order according to 1516# func_sort_ver, otherwise false. Use it like this: 1517# 1518# func_lt_ver "$prev_ver" "$proposed_ver" || func_fatal_error "..." 1519func_lt_ver () 1520{ 1521 $debug_cmd 1522 1523 test "x$1" = x`func_sort_ver "$1" "$2" | $SED 1q` 1524} 1525 1526 1527# Local variables: 1528# mode: shell-script 1529# sh-indentation: 2 1530# eval: (add-hook 'before-save-hook 'time-stamp) 1531# time-stamp-pattern: "10/scriptversion=%:y-%02m-%02d.%02H; # UTC" 1532# time-stamp-time-zone: "UTC" 1533# End: 1534#! /bin/sh 1535 1536# A portable, pluggable option parser for Bourne shell. 1537# Written by Gary V. Vaughan, 2010 1538 1539# This is free software. There is NO warranty; not even for 1540# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. 1541# 1542# Copyright (C) 2010-2019, 2021 Bootstrap Authors 1543# 1544# This file is dual licensed under the terms of the MIT license 1545# <https://opensource.org/license/MIT>, and GPL version 2 or later 1546# <http://www.gnu.org/licenses/gpl-2.0.html>. You must apply one of 1547# these licenses when using or redistributing this software or any of 1548# the files within it. See the URLs above, or the file `LICENSE` 1549# included in the Bootstrap distribution for the full license texts. 1550 1551# Please report bugs or propose patches to: 1552# <https://github.com/gnulib-modules/bootstrap/issues> 1553 1554# Set a version string for this script. 1555scriptversion=2019-02-19.15; # UTC 1556 1557 1558## ------ ## 1559## Usage. ## 1560## ------ ## 1561 1562# This file is a library for parsing options in your shell scripts along 1563# with assorted other useful supporting features that you can make use 1564# of too. 1565# 1566# For the simplest scripts you might need only: 1567# 1568# #!/bin/sh 1569# . relative/path/to/funclib.sh 1570# . relative/path/to/options-parser 1571# scriptversion=1.0 1572# func_options ${1+"$@"} 1573# eval set dummy "$func_options_result"; shift 1574# ...rest of your script... 1575# 1576# In order for the '--version' option to work, you will need to have a 1577# suitably formatted comment like the one at the top of this file 1578# starting with '# Written by ' and ending with '# Copyright'. 1579# 1580# For '-h' and '--help' to work, you will also need a one line 1581# description of your script's purpose in a comment directly above the 1582# '# Written by ' line, like the one at the top of this file. 1583# 1584# The default options also support '--debug', which will turn on shell 1585# execution tracing (see the comment above debug_cmd below for another 1586# use), and '--verbose' and the func_verbose function to allow your script 1587# to display verbose messages only when your user has specified 1588# '--verbose'. 1589# 1590# After sourcing this file, you can plug in processing for additional 1591# options by amending the variables from the 'Configuration' section 1592# below, and following the instructions in the 'Option parsing' 1593# section further down. 1594 1595## -------------- ## 1596## Configuration. ## 1597## -------------- ## 1598 1599# You should override these variables in your script after sourcing this 1600# file so that they reflect the customisations you have added to the 1601# option parser. 1602 1603# The usage line for option parsing errors and the start of '-h' and 1604# '--help' output messages. You can embed shell variables for delayed 1605# expansion at the time the message is displayed, but you will need to 1606# quote other shell meta-characters carefully to prevent them being 1607# expanded when the contents are evaled. 1608usage='$progpath [OPTION]...' 1609 1610# Short help message in response to '-h' and '--help'. Add to this or 1611# override it after sourcing this library to reflect the full set of 1612# options your script accepts. 1613usage_message="\ 1614 --debug enable verbose shell tracing 1615 -W, --warnings=CATEGORY 1616 report the warnings falling in CATEGORY [all] 1617 -v, --verbose verbosely report processing 1618 --version print version information and exit 1619 -h, --help print short or long help message and exit 1620" 1621 1622# Additional text appended to 'usage_message' in response to '--help'. 1623long_help_message=" 1624Warning categories include: 1625 'all' show all warnings 1626 'none' turn off all the warnings 1627 'error' warnings are treated as fatal errors" 1628 1629# Help message printed before fatal option parsing errors. 1630fatal_help="Try '\$progname --help' for more information." 1631 1632 1633 1634## ------------------------- ## 1635## Hook function management. ## 1636## ------------------------- ## 1637 1638# This section contains functions for adding, removing, and running hooks 1639# in the main code. A hook is just a list of function names that can be 1640# run in order later on. 1641 1642# func_hookable FUNC_NAME 1643# ----------------------- 1644# Declare that FUNC_NAME will run hooks added with 1645# 'func_add_hook FUNC_NAME ...'. 1646func_hookable () 1647{ 1648 $debug_cmd 1649 1650 func_append hookable_fns " $1" 1651} 1652 1653 1654# func_add_hook FUNC_NAME HOOK_FUNC 1655# --------------------------------- 1656# Request that FUNC_NAME call HOOK_FUNC before it returns. FUNC_NAME must 1657# first have been declared "hookable" by a call to 'func_hookable'. 1658func_add_hook () 1659{ 1660 $debug_cmd 1661 1662 case " $hookable_fns " in 1663 *" $1 "*) ;; 1664 *) func_fatal_error "'$1' does not accept hook functions." ;; 1665 esac 1666 1667 eval func_append ${1}_hooks '" $2"' 1668} 1669 1670 1671# func_remove_hook FUNC_NAME HOOK_FUNC 1672# ------------------------------------ 1673# Remove HOOK_FUNC from the list of hook functions to be called by 1674# FUNC_NAME. 1675func_remove_hook () 1676{ 1677 $debug_cmd 1678 1679 eval ${1}_hooks='`$ECHO "\$'$1'_hooks" |$SED "s| '$2'||"`' 1680} 1681 1682 1683# func_propagate_result FUNC_NAME_A FUNC_NAME_B 1684# --------------------------------------------- 1685# If the *_result variable of FUNC_NAME_A _is set_, assign its value to 1686# *_result variable of FUNC_NAME_B. 1687func_propagate_result () 1688{ 1689 $debug_cmd 1690 1691 func_propagate_result_result=: 1692 if eval "test \"\${${1}_result+set}\" = set" 1693 then 1694 eval "${2}_result=\$${1}_result" 1695 else 1696 func_propagate_result_result=false 1697 fi 1698} 1699 1700 1701# func_run_hooks FUNC_NAME [ARG]... 1702# --------------------------------- 1703# Run all hook functions registered to FUNC_NAME. 1704# It's assumed that the list of hook functions contains nothing more 1705# than a whitespace-delimited list of legal shell function names, and 1706# no effort is wasted trying to catch shell meta-characters or preserve 1707# whitespace. 1708func_run_hooks () 1709{ 1710 $debug_cmd 1711 1712 case " $hookable_fns " in 1713 *" $1 "*) ;; 1714 *) func_fatal_error "'$1' does not support hook functions." ;; 1715 esac 1716 1717 eval _G_hook_fns=\$$1_hooks; shift 1718 1719 for _G_hook in $_G_hook_fns; do 1720 func_unset "${_G_hook}_result" 1721 eval $_G_hook '${1+"$@"}' 1722 func_propagate_result $_G_hook func_run_hooks 1723 if $func_propagate_result_result; then 1724 eval set dummy "$func_run_hooks_result"; shift 1725 fi 1726 done 1727} 1728 1729 1730 1731## --------------- ## 1732## Option parsing. ## 1733## --------------- ## 1734 1735# In order to add your own option parsing hooks, you must accept the 1736# full positional parameter list from your hook function. You may remove 1737# or edit any options that you action, and then pass back the remaining 1738# unprocessed options in '<hooked_function_name>_result', escaped 1739# suitably for 'eval'. 1740# 1741# The '<hooked_function_name>_result' variable is automatically unset 1742# before your hook gets called; for best performance, only set the 1743# *_result variable when necessary (i.e. don't call the 'func_quote' 1744# function unnecessarily because it can be an expensive operation on some 1745# machines). 1746# 1747# Like this: 1748# 1749# my_options_prep () 1750# { 1751# $debug_cmd 1752# 1753# # Extend the existing usage message. 1754# usage_message=$usage_message' 1755# -s, --silent don'\''t print informational messages 1756# ' 1757# # No change in '$@' (ignored completely by this hook). Leave 1758# # my_options_prep_result variable intact. 1759# } 1760# func_add_hook func_options_prep my_options_prep 1761# 1762# 1763# my_silent_option () 1764# { 1765# $debug_cmd 1766# 1767# args_changed=false 1768# 1769# # Note that, for efficiency, we parse as many options as we can 1770# # recognise in a loop before passing the remainder back to the 1771# # caller on the first unrecognised argument we encounter. 1772# while test $# -gt 0; do 1773# opt=$1; shift 1774# case $opt in 1775# --silent|-s) opt_silent=: 1776# args_changed=: 1777# ;; 1778# # Separate non-argument short options: 1779# -s*) func_split_short_opt "$_G_opt" 1780# set dummy "$func_split_short_opt_name" \ 1781# "-$func_split_short_opt_arg" ${1+"$@"} 1782# shift 1783# args_changed=: 1784# ;; 1785# *) # Make sure the first unrecognised option "$_G_opt" 1786# # is added back to "$@" in case we need it later, 1787# # if $args_changed was set to 'true'. 1788# set dummy "$_G_opt" ${1+"$@"}; shift; break ;; 1789# esac 1790# done 1791# 1792# # Only call 'func_quote' here if we processed at least one argument. 1793# if $args_changed; then 1794# func_quote eval ${1+"$@"} 1795# my_silent_option_result=$func_quote_result 1796# fi 1797# } 1798# func_add_hook func_parse_options my_silent_option 1799# 1800# 1801# my_option_validation () 1802# { 1803# $debug_cmd 1804# 1805# $opt_silent && $opt_verbose && func_fatal_help "\ 1806# '--silent' and '--verbose' options are mutually exclusive." 1807# } 1808# func_add_hook func_validate_options my_option_validation 1809# 1810# You'll also need to manually amend $usage_message to reflect the extra 1811# options you parse. It's preferable to append if you can, so that 1812# multiple option parsing hooks can be added safely. 1813 1814 1815# func_options_finish [ARG]... 1816# ---------------------------- 1817# Finishing the option parse loop (call 'func_options' hooks ATM). 1818func_options_finish () 1819{ 1820 $debug_cmd 1821 1822 func_run_hooks func_options ${1+"$@"} 1823 func_propagate_result func_run_hooks func_options_finish 1824} 1825 1826 1827# func_options [ARG]... 1828# --------------------- 1829# All the functions called inside func_options are hookable. See the 1830# individual implementations for details. 1831func_hookable func_options 1832func_options () 1833{ 1834 $debug_cmd 1835 1836 _G_options_quoted=false 1837 1838 for my_func in options_prep parse_options validate_options options_finish 1839 do 1840 func_unset func_${my_func}_result 1841 func_unset func_run_hooks_result 1842 eval func_$my_func '${1+"$@"}' 1843 func_propagate_result func_$my_func func_options 1844 if $func_propagate_result_result; then 1845 eval set dummy "$func_options_result"; shift 1846 _G_options_quoted=: 1847 fi 1848 done 1849 1850 $_G_options_quoted || { 1851 # As we (func_options) are top-level options-parser function and 1852 # nobody quoted "$@" for us yet, we need to do it explicitly for 1853 # caller. 1854 func_quote eval ${1+"$@"} 1855 func_options_result=$func_quote_result 1856 } 1857} 1858 1859 1860# func_options_prep [ARG]... 1861# -------------------------- 1862# All initialisations required before starting the option parse loop. 1863# Note that when calling hook functions, we pass through the list of 1864# positional parameters. If a hook function modifies that list, and 1865# needs to propagate that back to rest of this script, then the complete 1866# modified list must be put in 'func_run_hooks_result' before returning. 1867func_hookable func_options_prep 1868func_options_prep () 1869{ 1870 $debug_cmd 1871 1872 # Option defaults: 1873 opt_verbose=false 1874 opt_warning_types= 1875 1876 func_run_hooks func_options_prep ${1+"$@"} 1877 func_propagate_result func_run_hooks func_options_prep 1878} 1879 1880 1881# func_parse_options [ARG]... 1882# --------------------------- 1883# The main option parsing loop. 1884func_hookable func_parse_options 1885func_parse_options () 1886{ 1887 $debug_cmd 1888 1889 _G_parse_options_requote=false 1890 # this just eases exit handling 1891 while test $# -gt 0; do 1892 # Defer to hook functions for initial option parsing, so they 1893 # get priority in the event of reusing an option name. 1894 func_run_hooks func_parse_options ${1+"$@"} 1895 func_propagate_result func_run_hooks func_parse_options 1896 if $func_propagate_result_result; then 1897 eval set dummy "$func_parse_options_result"; shift 1898 # Even though we may have changed "$@", we passed the "$@" array 1899 # down into the hook and it quoted it for us (because we are in 1900 # this if-branch). No need to quote it again. 1901 _G_parse_options_requote=false 1902 fi 1903 1904 # Break out of the loop if we already parsed every option. 1905 test $# -gt 0 || break 1906 1907 # We expect that one of the options parsed in this function matches 1908 # and thus we remove _G_opt from "$@" and need to re-quote. 1909 _G_match_parse_options=: 1910 _G_opt=$1 1911 shift 1912 case $_G_opt in 1913 --debug|-x) debug_cmd='set -x' 1914 func_echo "enabling shell trace mode" >&2 1915 $debug_cmd 1916 ;; 1917 1918 --no-warnings|--no-warning|--no-warn) 1919 set dummy --warnings none ${1+"$@"} 1920 shift 1921 ;; 1922 1923 --warnings|--warning|-W) 1924 if test $# = 0 && func_missing_arg $_G_opt; then 1925 _G_parse_options_requote=: 1926 break 1927 fi 1928 case " $warning_categories $1" in 1929 *" $1 "*) 1930 # trailing space prevents matching last $1 above 1931 func_append_uniq opt_warning_types " $1" 1932 ;; 1933 *all) 1934 opt_warning_types=$warning_categories 1935 ;; 1936 *none) 1937 opt_warning_types=none 1938 warning_func=: 1939 ;; 1940 *error) 1941 opt_warning_types=$warning_categories 1942 warning_func=func_fatal_error 1943 ;; 1944 *) 1945 func_fatal_error \ 1946 "unsupported warning category: '$1'" 1947 ;; 1948 esac 1949 shift 1950 ;; 1951 1952 --verbose|-v) opt_verbose=: ;; 1953 --version) func_version ;; 1954 -\?|-h) func_usage ;; 1955 --help) func_help ;; 1956 1957 # Separate optargs to long options (plugins may need this): 1958 --*=*) func_split_equals "$_G_opt" 1959 set dummy "$func_split_equals_lhs" \ 1960 "$func_split_equals_rhs" ${1+"$@"} 1961 shift 1962 ;; 1963 1964 # Separate optargs to short options: 1965 -W*) 1966 func_split_short_opt "$_G_opt" 1967 set dummy "$func_split_short_opt_name" \ 1968 "$func_split_short_opt_arg" ${1+"$@"} 1969 shift 1970 ;; 1971 1972 # Separate non-argument short options: 1973 -\?*|-h*|-v*|-x*) 1974 func_split_short_opt "$_G_opt" 1975 set dummy "$func_split_short_opt_name" \ 1976 "-$func_split_short_opt_arg" ${1+"$@"} 1977 shift 1978 ;; 1979 1980 --) _G_parse_options_requote=: ; break ;; 1981 -*) func_fatal_help "unrecognised option: '$_G_opt'" ;; 1982 *) set dummy "$_G_opt" ${1+"$@"}; shift 1983 _G_match_parse_options=false 1984 break 1985 ;; 1986 esac 1987 1988 if $_G_match_parse_options; then 1989 _G_parse_options_requote=: 1990 fi 1991 done 1992 1993 if $_G_parse_options_requote; then 1994 # save modified positional parameters for caller 1995 func_quote eval ${1+"$@"} 1996 func_parse_options_result=$func_quote_result 1997 fi 1998} 1999 2000 2001# func_validate_options [ARG]... 2002# ------------------------------ 2003# Perform any sanity checks on option settings and/or unconsumed 2004# arguments. 2005func_hookable func_validate_options 2006func_validate_options () 2007{ 2008 $debug_cmd 2009 2010 # Display all warnings if -W was not given. 2011 test -n "$opt_warning_types" || opt_warning_types=" $warning_categories" 2012 2013 func_run_hooks func_validate_options ${1+"$@"} 2014 func_propagate_result func_run_hooks func_validate_options 2015 2016 # Bail if the options were screwed! 2017 $exit_cmd $EXIT_FAILURE 2018} 2019 2020 2021 2022## ----------------- ## 2023## Helper functions. ## 2024## ----------------- ## 2025 2026# This section contains the helper functions used by the rest of the 2027# hookable option parser framework in ascii-betical order. 2028 2029 2030# func_fatal_help ARG... 2031# ---------------------- 2032# Echo program name prefixed message to standard error, followed by 2033# a help hint, and exit. 2034func_fatal_help () 2035{ 2036 $debug_cmd 2037 2038 eval \$ECHO \""Usage: $usage"\" 2039 eval \$ECHO \""$fatal_help"\" 2040 func_error ${1+"$@"} 2041 exit $EXIT_FAILURE 2042} 2043 2044 2045# func_help 2046# --------- 2047# Echo long help message to standard output and exit. 2048func_help () 2049{ 2050 $debug_cmd 2051 2052 func_usage_message 2053 $ECHO "$long_help_message" 2054 exit 0 2055} 2056 2057 2058# func_missing_arg ARGNAME 2059# ------------------------ 2060# Echo program name prefixed message to standard error and set global 2061# exit_cmd. 2062func_missing_arg () 2063{ 2064 $debug_cmd 2065 2066 func_error "Missing argument for '$1'." 2067 exit_cmd=exit 2068} 2069 2070 2071# func_split_equals STRING 2072# ------------------------ 2073# Set func_split_equals_lhs and func_split_equals_rhs shell variables 2074# after splitting STRING at the '=' sign. 2075test -z "$_G_HAVE_XSI_OPS" \ 2076 && (eval 'x=a/b/c; 2077 test 5aa/bb/cc = "${#x}${x%%/*}${x%/*}${x#*/}${x##*/}"') 2>/dev/null \ 2078 && _G_HAVE_XSI_OPS=yes 2079 2080if test yes = "$_G_HAVE_XSI_OPS" 2081then 2082 # This is an XSI compatible shell, allowing a faster implementation... 2083 eval 'func_split_equals () 2084 { 2085 $debug_cmd 2086 2087 func_split_equals_lhs=${1%%=*} 2088 func_split_equals_rhs=${1#*=} 2089 if test "x$func_split_equals_lhs" = "x$1"; then 2090 func_split_equals_rhs= 2091 fi 2092 }' 2093else 2094 # ...otherwise fall back to using expr, which is often a shell builtin. 2095 func_split_equals () 2096 { 2097 $debug_cmd 2098 2099 func_split_equals_lhs=`expr "x$1" : 'x\([^=]*\)'` 2100 func_split_equals_rhs= 2101 test "x$func_split_equals_lhs=" = "x$1" \ 2102 || func_split_equals_rhs=`expr "x$1" : 'x[^=]*=\(.*\)$'` 2103 } 2104fi #func_split_equals 2105 2106 2107# func_split_short_opt SHORTOPT 2108# ----------------------------- 2109# Set func_split_short_opt_name and func_split_short_opt_arg shell 2110# variables after splitting SHORTOPT after the 2nd character. 2111if test yes = "$_G_HAVE_XSI_OPS" 2112then 2113 # This is an XSI compatible shell, allowing a faster implementation... 2114 eval 'func_split_short_opt () 2115 { 2116 $debug_cmd 2117 2118 func_split_short_opt_arg=${1#??} 2119 func_split_short_opt_name=${1%"$func_split_short_opt_arg"} 2120 }' 2121else 2122 # ...otherwise fall back to using expr, which is often a shell builtin. 2123 func_split_short_opt () 2124 { 2125 $debug_cmd 2126 2127 func_split_short_opt_name=`expr "x$1" : 'x\(-.\)'` 2128 func_split_short_opt_arg=`expr "x$1" : 'x-.\(.*\)$'` 2129 } 2130fi #func_split_short_opt 2131 2132 2133# func_usage 2134# ---------- 2135# Echo short help message to standard output and exit. 2136func_usage () 2137{ 2138 $debug_cmd 2139 2140 func_usage_message 2141 $ECHO "Run '$progname --help |${PAGER-more}' for full usage" 2142 exit 0 2143} 2144 2145 2146# func_usage_message 2147# ------------------ 2148# Echo short help message to standard output. 2149func_usage_message () 2150{ 2151 $debug_cmd 2152 2153 eval \$ECHO \""Usage: $usage"\" 2154 echo 2155 $SED -n 's|^# || 2156 /^Written by/{ 2157 x;p;x 2158 } 2159 h 2160 /^Written by/q' < "$progpath" 2161 echo 2162 eval \$ECHO \""$usage_message"\" 2163} 2164 2165 2166# func_version 2167# ------------ 2168# Echo version message to standard output and exit. 2169# The version message is extracted from the calling file's header 2170# comments, with leading '# ' stripped: 2171# 1. First display the progname and version 2172# 2. Followed by the header comment line matching /^# Written by / 2173# 3. Then a blank line followed by the first following line matching 2174# /^# Copyright / 2175# 4. Immediately followed by any lines between the previous matches, 2176# except lines preceding the intervening completely blank line. 2177# For example, see the header comments of this file. 2178func_version () 2179{ 2180 $debug_cmd 2181 2182 printf '%s\n' "$progname $scriptversion" 2183 $SED -n ' 2184 /^# Written by /!b 2185 s|^# ||; p; n 2186 2187 :fwd2blnk 2188 /./ { 2189 n 2190 b fwd2blnk 2191 } 2192 p; n 2193 2194 :holdwrnt 2195 s|^# || 2196 s|^# *$|| 2197 /^Copyright /!{ 2198 /./H 2199 n 2200 b holdwrnt 2201 } 2202 2203 s|\((C)\)[ 0-9,-]*[ ,-]\([1-9][0-9]* \)|\1 \2| 2204 G 2205 s|\(\n\)\n*|\1|g 2206 p; q' < "$progpath" 2207 2208 exit $? 2209} 2210 2211 2212# Local variables: 2213# mode: shell-script 2214# sh-indentation: 2 2215# eval: (add-hook 'before-save-hook 'time-stamp) 2216# time-stamp-pattern: "30/scriptversion=%:y-%02m-%02d.%02H; # UTC" 2217# time-stamp-time-zone: "UTC" 2218# End: 2219 2220# Set a version string. 2221scriptversion='(GNU libtool) 2.4.7' 2222 2223 2224# func_echo ARG... 2225# ---------------- 2226# Libtool also displays the current mode in messages, so override 2227# funclib.sh func_echo with this custom definition. 2228func_echo () 2229{ 2230 $debug_cmd 2231 2232 _G_message=$* 2233 2234 func_echo_IFS=$IFS 2235 IFS=$nl 2236 for _G_line in $_G_message; do 2237 IFS=$func_echo_IFS 2238 $ECHO "$progname${opt_mode+: $opt_mode}: $_G_line" 2239 done 2240 IFS=$func_echo_IFS 2241} 2242 2243 2244# func_warning ARG... 2245# ------------------- 2246# Libtool warnings are not categorized, so override funclib.sh 2247# func_warning with this simpler definition. 2248func_warning () 2249{ 2250 $debug_cmd 2251 2252 $warning_func ${1+"$@"} 2253} 2254 2255 2256## ---------------- ## 2257## Options parsing. ## 2258## ---------------- ## 2259 2260# Hook in the functions to make sure our own options are parsed during 2261# the option parsing loop. 2262 2263usage='$progpath [OPTION]... [MODE-ARG]...' 2264 2265# Short help message in response to '-h'. 2266usage_message="Options: 2267 --config show all configuration variables 2268 --debug enable verbose shell tracing 2269 -n, --dry-run display commands without modifying any files 2270 --features display basic configuration information and exit 2271 --mode=MODE use operation mode MODE 2272 --no-warnings equivalent to '-Wnone' 2273 --preserve-dup-deps don't remove duplicate dependency libraries 2274 --quiet, --silent don't print informational messages 2275 --tag=TAG use configuration variables from tag TAG 2276 -v, --verbose print more informational messages than default 2277 --version print version information 2278 -W, --warnings=CATEGORY report the warnings falling in CATEGORY [all] 2279 -h, --help, --help-all print short, long, or detailed help message 2280" 2281 2282# Additional text appended to 'usage_message' in response to '--help'. 2283func_help () 2284{ 2285 $debug_cmd 2286 2287 func_usage_message 2288 $ECHO "$long_help_message 2289 2290MODE must be one of the following: 2291 2292 clean remove files from the build directory 2293 compile compile a source file into a libtool object 2294 execute automatically set library path, then run a program 2295 finish complete the installation of libtool libraries 2296 install install libraries or executables 2297 link create a library or an executable 2298 uninstall remove libraries from an installed directory 2299 2300MODE-ARGS vary depending on the MODE. When passed as first option, 2301'--mode=MODE' may be abbreviated as 'MODE' or a unique abbreviation of that. 2302Try '$progname --help --mode=MODE' for a more detailed description of MODE. 2303 2304When reporting a bug, please describe a test case to reproduce it and 2305include the following information: 2306 2307 host-triplet: $host 2308 shell: $SHELL 2309 compiler: $LTCC 2310 compiler flags: $LTCFLAGS 2311 linker: $LD (gnu? $with_gnu_ld) 2312 version: $progname (GNU libtool) 2.4.7 2313 automake: `($AUTOMAKE --version) 2>/dev/null |$SED 1q` 2314 autoconf: `($AUTOCONF --version) 2>/dev/null |$SED 1q` 2315 2316Report bugs to <bug-libtool@gnu.org>. 2317GNU libtool home page: <http://www.gnu.org/s/libtool/>. 2318General help using GNU software: <http://www.gnu.org/gethelp/>." 2319 exit 0 2320} 2321 2322 2323# func_lo2o OBJECT-NAME 2324# --------------------- 2325# Transform OBJECT-NAME from a '.lo' suffix to the platform specific 2326# object suffix. 2327 2328lo2o=s/\\.lo\$/.$objext/ 2329o2lo=s/\\.$objext\$/.lo/ 2330 2331if test yes = "$_G_HAVE_XSI_OPS"; then 2332 eval 'func_lo2o () 2333 { 2334 case $1 in 2335 *.lo) func_lo2o_result=${1%.lo}.$objext ;; 2336 * ) func_lo2o_result=$1 ;; 2337 esac 2338 }' 2339 2340 # func_xform LIBOBJ-OR-SOURCE 2341 # --------------------------- 2342 # Transform LIBOBJ-OR-SOURCE from a '.o' or '.c' (or otherwise) 2343 # suffix to a '.lo' libtool-object suffix. 2344 eval 'func_xform () 2345 { 2346 func_xform_result=${1%.*}.lo 2347 }' 2348else 2349 # ...otherwise fall back to using sed. 2350 func_lo2o () 2351 { 2352 func_lo2o_result=`$ECHO "$1" | $SED "$lo2o"` 2353 } 2354 2355 func_xform () 2356 { 2357 func_xform_result=`$ECHO "$1" | $SED 's|\.[^.]*$|.lo|'` 2358 } 2359fi 2360 2361 2362# func_fatal_configuration ARG... 2363# ------------------------------- 2364# Echo program name prefixed message to standard error, followed by 2365# a configuration failure hint, and exit. 2366func_fatal_configuration () 2367{ 2368 func_fatal_error ${1+"$@"} \ 2369 "See the $PACKAGE documentation for more information." \ 2370 "Fatal configuration error." 2371} 2372 2373 2374# func_config 2375# ----------- 2376# Display the configuration for all the tags in this script. 2377func_config () 2378{ 2379 re_begincf='^# ### BEGIN LIBTOOL' 2380 re_endcf='^# ### END LIBTOOL' 2381 2382 # Default configuration. 2383 $SED "1,/$re_begincf CONFIG/d;/$re_endcf CONFIG/,\$d" < "$progpath" 2384 2385 # Now print the configurations for the tags. 2386 for tagname in $taglist; do 2387 $SED -n "/$re_begincf TAG CONFIG: $tagname\$/,/$re_endcf TAG CONFIG: $tagname\$/p" < "$progpath" 2388 done 2389 2390 exit $? 2391} 2392 2393 2394# func_features 2395# ------------- 2396# Display the features supported by this script. 2397func_features () 2398{ 2399 echo "host: $host" 2400 if test yes = "$build_libtool_libs"; then 2401 echo "enable shared libraries" 2402 else 2403 echo "disable shared libraries" 2404 fi 2405 if test yes = "$build_old_libs"; then 2406 echo "enable static libraries" 2407 else 2408 echo "disable static libraries" 2409 fi 2410 2411 exit $? 2412} 2413 2414 2415# func_enable_tag TAGNAME 2416# ----------------------- 2417# Verify that TAGNAME is valid, and either flag an error and exit, or 2418# enable the TAGNAME tag. We also add TAGNAME to the global $taglist 2419# variable here. 2420func_enable_tag () 2421{ 2422 # Global variable: 2423 tagname=$1 2424 2425 re_begincf="^# ### BEGIN LIBTOOL TAG CONFIG: $tagname\$" 2426 re_endcf="^# ### END LIBTOOL TAG CONFIG: $tagname\$" 2427 sed_extractcf=/$re_begincf/,/$re_endcf/p 2428 2429 # Validate tagname. 2430 case $tagname in 2431 *[!-_A-Za-z0-9,/]*) 2432 func_fatal_error "invalid tag name: $tagname" 2433 ;; 2434 esac 2435 2436 # Don't test for the "default" C tag, as we know it's 2437 # there but not specially marked. 2438 case $tagname in 2439 CC) ;; 2440 *) 2441 if $GREP "$re_begincf" "$progpath" >/dev/null 2>&1; then 2442 taglist="$taglist $tagname" 2443 2444 # Evaluate the configuration. Be careful to quote the path 2445 # and the sed script, to avoid splitting on whitespace, but 2446 # also don't use non-portable quotes within backquotes within 2447 # quotes we have to do it in 2 steps: 2448 extractedcf=`$SED -n -e "$sed_extractcf" < "$progpath"` 2449 eval "$extractedcf" 2450 else 2451 func_error "ignoring unknown tag $tagname" 2452 fi 2453 ;; 2454 esac 2455} 2456 2457 2458# func_check_version_match 2459# ------------------------ 2460# Ensure that we are using m4 macros, and libtool script from the same 2461# release of libtool. 2462func_check_version_match () 2463{ 2464 if test "$package_revision" != "$macro_revision"; then 2465 if test "$VERSION" != "$macro_version"; then 2466 if test -z "$macro_version"; then 2467 cat >&2 <<_LT_EOF 2468$progname: Version mismatch error. This is $PACKAGE $VERSION, but the 2469$progname: definition of this LT_INIT comes from an older release. 2470$progname: You should recreate aclocal.m4 with macros from $PACKAGE $VERSION 2471$progname: and run autoconf again. 2472_LT_EOF 2473 else 2474 cat >&2 <<_LT_EOF 2475$progname: Version mismatch error. This is $PACKAGE $VERSION, but the 2476$progname: definition of this LT_INIT comes from $PACKAGE $macro_version. 2477$progname: You should recreate aclocal.m4 with macros from $PACKAGE $VERSION 2478$progname: and run autoconf again. 2479_LT_EOF 2480 fi 2481 else 2482 cat >&2 <<_LT_EOF 2483$progname: Version mismatch error. This is $PACKAGE $VERSION, revision $package_revision, 2484$progname: but the definition of this LT_INIT comes from revision $macro_revision. 2485$progname: You should recreate aclocal.m4 with macros from revision $package_revision 2486$progname: of $PACKAGE $VERSION and run autoconf again. 2487_LT_EOF 2488 fi 2489 2490 exit $EXIT_MISMATCH 2491 fi 2492} 2493 2494 2495# libtool_options_prep [ARG]... 2496# ----------------------------- 2497# Preparation for options parsed by libtool. 2498libtool_options_prep () 2499{ 2500 $debug_mode 2501 2502 # Option defaults: 2503 opt_config=false 2504 opt_dlopen= 2505 opt_dry_run=false 2506 opt_help=false 2507 opt_mode= 2508 opt_preserve_dup_deps=false 2509 opt_quiet=false 2510 2511 nonopt= 2512 preserve_args= 2513 2514 _G_rc_lt_options_prep=: 2515 2516 # Shorthand for --mode=foo, only valid as the first argument 2517 case $1 in 2518 clean|clea|cle|cl) 2519 shift; set dummy --mode clean ${1+"$@"}; shift 2520 ;; 2521 compile|compil|compi|comp|com|co|c) 2522 shift; set dummy --mode compile ${1+"$@"}; shift 2523 ;; 2524 execute|execut|execu|exec|exe|ex|e) 2525 shift; set dummy --mode execute ${1+"$@"}; shift 2526 ;; 2527 finish|finis|fini|fin|fi|f) 2528 shift; set dummy --mode finish ${1+"$@"}; shift 2529 ;; 2530 install|instal|insta|inst|ins|in|i) 2531 shift; set dummy --mode install ${1+"$@"}; shift 2532 ;; 2533 link|lin|li|l) 2534 shift; set dummy --mode link ${1+"$@"}; shift 2535 ;; 2536 uninstall|uninstal|uninsta|uninst|unins|unin|uni|un|u) 2537 shift; set dummy --mode uninstall ${1+"$@"}; shift 2538 ;; 2539 *) 2540 _G_rc_lt_options_prep=false 2541 ;; 2542 esac 2543 2544 if $_G_rc_lt_options_prep; then 2545 # Pass back the list of options. 2546 func_quote eval ${1+"$@"} 2547 libtool_options_prep_result=$func_quote_result 2548 fi 2549} 2550func_add_hook func_options_prep libtool_options_prep 2551 2552 2553# libtool_parse_options [ARG]... 2554# --------------------------------- 2555# Provide handling for libtool specific options. 2556libtool_parse_options () 2557{ 2558 $debug_cmd 2559 2560 _G_rc_lt_parse_options=false 2561 2562 # Perform our own loop to consume as many options as possible in 2563 # each iteration. 2564 while test $# -gt 0; do 2565 _G_match_lt_parse_options=: 2566 _G_opt=$1 2567 shift 2568 case $_G_opt in 2569 --dry-run|--dryrun|-n) 2570 opt_dry_run=: 2571 ;; 2572 2573 --config) func_config ;; 2574 2575 --dlopen|-dlopen) 2576 opt_dlopen="${opt_dlopen+$opt_dlopen 2577}$1" 2578 shift 2579 ;; 2580 2581 --preserve-dup-deps) 2582 opt_preserve_dup_deps=: ;; 2583 2584 --features) func_features ;; 2585 2586 --finish) set dummy --mode finish ${1+"$@"}; shift ;; 2587 2588 --help) opt_help=: ;; 2589 2590 --help-all) opt_help=': help-all' ;; 2591 2592 --mode) test $# = 0 && func_missing_arg $_G_opt && break 2593 opt_mode=$1 2594 case $1 in 2595 # Valid mode arguments: 2596 clean|compile|execute|finish|install|link|relink|uninstall) ;; 2597 2598 # Catch anything else as an error 2599 *) func_error "invalid argument for $_G_opt" 2600 exit_cmd=exit 2601 break 2602 ;; 2603 esac 2604 shift 2605 ;; 2606 2607 --no-silent|--no-quiet) 2608 opt_quiet=false 2609 func_append preserve_args " $_G_opt" 2610 ;; 2611 2612 --no-warnings|--no-warning|--no-warn) 2613 opt_warning=false 2614 func_append preserve_args " $_G_opt" 2615 ;; 2616 2617 --no-verbose) 2618 opt_verbose=false 2619 func_append preserve_args " $_G_opt" 2620 ;; 2621 2622 --silent|--quiet) 2623 opt_quiet=: 2624 opt_verbose=false 2625 func_append preserve_args " $_G_opt" 2626 ;; 2627 2628 --tag) test $# = 0 && func_missing_arg $_G_opt && break 2629 opt_tag=$1 2630 func_append preserve_args " $_G_opt $1" 2631 func_enable_tag "$1" 2632 shift 2633 ;; 2634 2635 --verbose|-v) opt_quiet=false 2636 opt_verbose=: 2637 func_append preserve_args " $_G_opt" 2638 ;; 2639 2640 # An option not handled by this hook function: 2641 *) set dummy "$_G_opt" ${1+"$@"} ; shift 2642 _G_match_lt_parse_options=false 2643 break 2644 ;; 2645 esac 2646 $_G_match_lt_parse_options && _G_rc_lt_parse_options=: 2647 done 2648 2649 if $_G_rc_lt_parse_options; then 2650 # save modified positional parameters for caller 2651 func_quote eval ${1+"$@"} 2652 libtool_parse_options_result=$func_quote_result 2653 fi 2654} 2655func_add_hook func_parse_options libtool_parse_options 2656 2657 2658 2659# libtool_validate_options [ARG]... 2660# --------------------------------- 2661# Perform any sanity checks on option settings and/or unconsumed 2662# arguments. 2663libtool_validate_options () 2664{ 2665 # save first non-option argument 2666 if test 0 -lt $#; then 2667 nonopt=$1 2668 shift 2669 fi 2670 2671 # preserve --debug 2672 test : = "$debug_cmd" || func_append preserve_args " --debug" 2673 2674 case $host in 2675 # Solaris2 added to fix http://debbugs.gnu.org/cgi/bugreport.cgi?bug=16452 2676 # see also: http://gcc.gnu.org/bugzilla/show_bug.cgi?id=59788 2677 *cygwin* | *mingw* | *pw32* | *cegcc* | *solaris2* | *os2*) 2678 # don't eliminate duplications in $postdeps and $predeps 2679 opt_duplicate_compiler_generated_deps=: 2680 ;; 2681 *) 2682 opt_duplicate_compiler_generated_deps=$opt_preserve_dup_deps 2683 ;; 2684 esac 2685 2686 $opt_help || { 2687 # Sanity checks first: 2688 func_check_version_match 2689 2690 test yes != "$build_libtool_libs" \ 2691 && test yes != "$build_old_libs" \ 2692 && func_fatal_configuration "not configured to build any kind of library" 2693 2694 # Darwin sucks 2695 eval std_shrext=\"$shrext_cmds\" 2696 2697 # Only execute mode is allowed to have -dlopen flags. 2698 if test -n "$opt_dlopen" && test execute != "$opt_mode"; then 2699 func_error "unrecognized option '-dlopen'" 2700 $ECHO "$help" 1>&2 2701 exit $EXIT_FAILURE 2702 fi 2703 2704 # Change the help message to a mode-specific one. 2705 generic_help=$help 2706 help="Try '$progname --help --mode=$opt_mode' for more information." 2707 } 2708 2709 # Pass back the unparsed argument list 2710 func_quote eval ${1+"$@"} 2711 libtool_validate_options_result=$func_quote_result 2712} 2713func_add_hook func_validate_options libtool_validate_options 2714 2715 2716# Process options as early as possible so that --help and --version 2717# can return quickly. 2718func_options ${1+"$@"} 2719eval set dummy "$func_options_result"; shift 2720 2721 2722 2723## ----------- ## 2724## Main. ## 2725## ----------- ## 2726 2727magic='%%%MAGIC variable%%%' 2728magic_exe='%%%MAGIC EXE variable%%%' 2729 2730# Global variables. 2731extracted_archives= 2732extracted_serial=0 2733 2734# If this variable is set in any of the actions, the command in it 2735# will be execed at the end. This prevents here-documents from being 2736# left over by shells. 2737exec_cmd= 2738 2739 2740# A function that is used when there is no print builtin or printf. 2741func_fallback_echo () 2742{ 2743 eval 'cat <<_LTECHO_EOF 2744$1 2745_LTECHO_EOF' 2746} 2747 2748# func_generated_by_libtool 2749# True iff stdin has been generated by Libtool. This function is only 2750# a basic sanity check; it will hardly flush out determined imposters. 2751func_generated_by_libtool_p () 2752{ 2753 $GREP "^# Generated by .*$PACKAGE" > /dev/null 2>&1 2754} 2755 2756# func_lalib_p file 2757# True iff FILE is a libtool '.la' library or '.lo' object file. 2758# This function is only a basic sanity check; it will hardly flush out 2759# determined imposters. 2760func_lalib_p () 2761{ 2762 test -f "$1" && 2763 $SED -e 4q "$1" 2>/dev/null | func_generated_by_libtool_p 2764} 2765 2766# func_lalib_unsafe_p file 2767# True iff FILE is a libtool '.la' library or '.lo' object file. 2768# This function implements the same check as func_lalib_p without 2769# resorting to external programs. To this end, it redirects stdin and 2770# closes it afterwards, without saving the original file descriptor. 2771# As a safety measure, use it only where a negative result would be 2772# fatal anyway. Works if 'file' does not exist. 2773func_lalib_unsafe_p () 2774{ 2775 lalib_p=no 2776 if test -f "$1" && test -r "$1" && exec 5<&0 <"$1"; then 2777 for lalib_p_l in 1 2 3 4 2778 do 2779 read lalib_p_line 2780 case $lalib_p_line in 2781 \#\ Generated\ by\ *$PACKAGE* ) lalib_p=yes; break;; 2782 esac 2783 done 2784 exec 0<&5 5<&- 2785 fi 2786 test yes = "$lalib_p" 2787} 2788 2789# func_ltwrapper_script_p file 2790# True iff FILE is a libtool wrapper script 2791# This function is only a basic sanity check; it will hardly flush out 2792# determined imposters. 2793func_ltwrapper_script_p () 2794{ 2795 test -f "$1" && 2796 $lt_truncate_bin < "$1" 2>/dev/null | func_generated_by_libtool_p 2797} 2798 2799# func_ltwrapper_executable_p file 2800# True iff FILE is a libtool wrapper executable 2801# This function is only a basic sanity check; it will hardly flush out 2802# determined imposters. 2803func_ltwrapper_executable_p () 2804{ 2805 func_ltwrapper_exec_suffix= 2806 case $1 in 2807 *.exe) ;; 2808 *) func_ltwrapper_exec_suffix=.exe ;; 2809 esac 2810 $GREP "$magic_exe" "$1$func_ltwrapper_exec_suffix" >/dev/null 2>&1 2811} 2812 2813# func_ltwrapper_scriptname file 2814# Assumes file is an ltwrapper_executable 2815# uses $file to determine the appropriate filename for a 2816# temporary ltwrapper_script. 2817func_ltwrapper_scriptname () 2818{ 2819 func_dirname_and_basename "$1" "" "." 2820 func_stripname '' '.exe' "$func_basename_result" 2821 func_ltwrapper_scriptname_result=$func_dirname_result/$objdir/${func_stripname_result}_ltshwrapper 2822} 2823 2824# func_ltwrapper_p file 2825# True iff FILE is a libtool wrapper script or wrapper executable 2826# This function is only a basic sanity check; it will hardly flush out 2827# determined imposters. 2828func_ltwrapper_p () 2829{ 2830 func_ltwrapper_script_p "$1" || func_ltwrapper_executable_p "$1" 2831} 2832 2833 2834# func_execute_cmds commands fail_cmd 2835# Execute tilde-delimited COMMANDS. 2836# If FAIL_CMD is given, eval that upon failure. 2837# FAIL_CMD may read-access the current command in variable CMD! 2838func_execute_cmds () 2839{ 2840 $debug_cmd 2841 2842 save_ifs=$IFS; IFS='~' 2843 for cmd in $1; do 2844 IFS=$sp$nl 2845 eval cmd=\"$cmd\" 2846 IFS=$save_ifs 2847 func_show_eval "$cmd" "${2-:}" 2848 done 2849 IFS=$save_ifs 2850} 2851 2852 2853# func_source file 2854# Source FILE, adding directory component if necessary. 2855# Note that it is not necessary on cygwin/mingw to append a dot to 2856# FILE even if both FILE and FILE.exe exist: automatic-append-.exe 2857# behavior happens only for exec(3), not for open(2)! Also, sourcing 2858# 'FILE.' does not work on cygwin managed mounts. 2859func_source () 2860{ 2861 $debug_cmd 2862 2863 case $1 in 2864 */* | *\\*) . "$1" ;; 2865 *) . "./$1" ;; 2866 esac 2867} 2868 2869 2870# func_resolve_sysroot PATH 2871# Replace a leading = in PATH with a sysroot. Store the result into 2872# func_resolve_sysroot_result 2873func_resolve_sysroot () 2874{ 2875 func_resolve_sysroot_result=$1 2876 case $func_resolve_sysroot_result in 2877 =*) 2878 func_stripname '=' '' "$func_resolve_sysroot_result" 2879 func_resolve_sysroot_result=$lt_sysroot$func_stripname_result 2880 ;; 2881 esac 2882} 2883 2884# func_replace_sysroot PATH 2885# If PATH begins with the sysroot, replace it with = and 2886# store the result into func_replace_sysroot_result. 2887func_replace_sysroot () 2888{ 2889 case $lt_sysroot:$1 in 2890 ?*:"$lt_sysroot"*) 2891 func_stripname "$lt_sysroot" '' "$1" 2892 func_replace_sysroot_result='='$func_stripname_result 2893 ;; 2894 *) 2895 # Including no sysroot. 2896 func_replace_sysroot_result=$1 2897 ;; 2898 esac 2899} 2900 2901# func_infer_tag arg 2902# Infer tagged configuration to use if any are available and 2903# if one wasn't chosen via the "--tag" command line option. 2904# Only attempt this if the compiler in the base compile 2905# command doesn't match the default compiler. 2906# arg is usually of the form 'gcc ...' 2907func_infer_tag () 2908{ 2909 $debug_cmd 2910 2911 if test -n "$available_tags" && test -z "$tagname"; then 2912 CC_quoted= 2913 for arg in $CC; do 2914 func_append_quoted CC_quoted "$arg" 2915 done 2916 CC_expanded=`func_echo_all $CC` 2917 CC_quoted_expanded=`func_echo_all $CC_quoted` 2918 case $@ in 2919 # Blanks in the command may have been stripped by the calling shell, 2920 # but not from the CC environment variable when configure was run. 2921 " $CC "* | "$CC "* | " $CC_expanded "* | "$CC_expanded "* | \ 2922 " $CC_quoted"* | "$CC_quoted "* | " $CC_quoted_expanded "* | "$CC_quoted_expanded "*) ;; 2923 # Blanks at the start of $base_compile will cause this to fail 2924 # if we don't check for them as well. 2925 *) 2926 for z in $available_tags; do 2927 if $GREP "^# ### BEGIN LIBTOOL TAG CONFIG: $z$" < "$progpath" > /dev/null; then 2928 # Evaluate the configuration. 2929 eval "`$SED -n -e '/^# ### BEGIN LIBTOOL TAG CONFIG: '$z'$/,/^# ### END LIBTOOL TAG CONFIG: '$z'$/p' < $progpath`" 2930 CC_quoted= 2931 for arg in $CC; do 2932 # Double-quote args containing other shell metacharacters. 2933 func_append_quoted CC_quoted "$arg" 2934 done 2935 CC_expanded=`func_echo_all $CC` 2936 CC_quoted_expanded=`func_echo_all $CC_quoted` 2937 case "$@ " in 2938 " $CC "* | "$CC "* | " $CC_expanded "* | "$CC_expanded "* | \ 2939 " $CC_quoted"* | "$CC_quoted "* | " $CC_quoted_expanded "* | "$CC_quoted_expanded "*) 2940 # The compiler in the base compile command matches 2941 # the one in the tagged configuration. 2942 # Assume this is the tagged configuration we want. 2943 tagname=$z 2944 break 2945 ;; 2946 esac 2947 fi 2948 done 2949 # If $tagname still isn't set, then no tagged configuration 2950 # was found and let the user know that the "--tag" command 2951 # line option must be used. 2952 if test -z "$tagname"; then 2953 func_echo "unable to infer tagged configuration" 2954 func_fatal_error "specify a tag with '--tag'" 2955# else 2956# func_verbose "using $tagname tagged configuration" 2957 fi 2958 ;; 2959 esac 2960 fi 2961} 2962 2963 2964 2965# func_write_libtool_object output_name pic_name nonpic_name 2966# Create a libtool object file (analogous to a ".la" file), 2967# but don't create it if we're doing a dry run. 2968func_write_libtool_object () 2969{ 2970 write_libobj=$1 2971 if test yes = "$build_libtool_libs"; then 2972 write_lobj=\'$2\' 2973 else 2974 write_lobj=none 2975 fi 2976 2977 if test yes = "$build_old_libs"; then 2978 write_oldobj=\'$3\' 2979 else 2980 write_oldobj=none 2981 fi 2982 2983 $opt_dry_run || { 2984 cat >${write_libobj}T <<EOF 2985# $write_libobj - a libtool object file 2986# Generated by $PROGRAM (GNU $PACKAGE) $VERSION 2987# 2988# Please DO NOT delete this file! 2989# It is necessary for linking the library. 2990 2991# Name of the PIC object. 2992pic_object=$write_lobj 2993 2994# Name of the non-PIC object 2995non_pic_object=$write_oldobj 2996 2997EOF 2998 $MV "${write_libobj}T" "$write_libobj" 2999 } 3000} 3001 3002 3003################################################## 3004# FILE NAME AND PATH CONVERSION HELPER FUNCTIONS # 3005################################################## 3006 3007# func_convert_core_file_wine_to_w32 ARG 3008# Helper function used by file name conversion functions when $build is *nix, 3009# and $host is mingw, cygwin, or some other w32 environment. Relies on a 3010# correctly configured wine environment available, with the winepath program 3011# in $build's $PATH. 3012# 3013# ARG is the $build file name to be converted to w32 format. 3014# Result is available in $func_convert_core_file_wine_to_w32_result, and will 3015# be empty on error (or when ARG is empty) 3016func_convert_core_file_wine_to_w32 () 3017{ 3018 $debug_cmd 3019 3020 func_convert_core_file_wine_to_w32_result=$1 3021 if test -n "$1"; then 3022 # Unfortunately, winepath does not exit with a non-zero error code, so we 3023 # are forced to check the contents of stdout. On the other hand, if the 3024 # command is not found, the shell will set an exit code of 127 and print 3025 # *an error message* to stdout. So we must check for both error code of 3026 # zero AND non-empty stdout, which explains the odd construction: 3027 func_convert_core_file_wine_to_w32_tmp=`winepath -w "$1" 2>/dev/null` 3028 if test "$?" -eq 0 && test -n "$func_convert_core_file_wine_to_w32_tmp"; then 3029 func_convert_core_file_wine_to_w32_result=`$ECHO "$func_convert_core_file_wine_to_w32_tmp" | 3030 $SED -e "$sed_naive_backslashify"` 3031 else 3032 func_convert_core_file_wine_to_w32_result= 3033 fi 3034 fi 3035} 3036# end: func_convert_core_file_wine_to_w32 3037 3038 3039# func_convert_core_path_wine_to_w32 ARG 3040# Helper function used by path conversion functions when $build is *nix, and 3041# $host is mingw, cygwin, or some other w32 environment. Relies on a correctly 3042# configured wine environment available, with the winepath program in $build's 3043# $PATH. Assumes ARG has no leading or trailing path separator characters. 3044# 3045# ARG is path to be converted from $build format to win32. 3046# Result is available in $func_convert_core_path_wine_to_w32_result. 3047# Unconvertible file (directory) names in ARG are skipped; if no directory names 3048# are convertible, then the result may be empty. 3049func_convert_core_path_wine_to_w32 () 3050{ 3051 $debug_cmd 3052 3053 # unfortunately, winepath doesn't convert paths, only file names 3054 func_convert_core_path_wine_to_w32_result= 3055 if test -n "$1"; then 3056 oldIFS=$IFS 3057 IFS=: 3058 for func_convert_core_path_wine_to_w32_f in $1; do 3059 IFS=$oldIFS 3060 func_convert_core_file_wine_to_w32 "$func_convert_core_path_wine_to_w32_f" 3061 if test -n "$func_convert_core_file_wine_to_w32_result"; then 3062 if test -z "$func_convert_core_path_wine_to_w32_result"; then 3063 func_convert_core_path_wine_to_w32_result=$func_convert_core_file_wine_to_w32_result 3064 else 3065 func_append func_convert_core_path_wine_to_w32_result ";$func_convert_core_file_wine_to_w32_result" 3066 fi 3067 fi 3068 done 3069 IFS=$oldIFS 3070 fi 3071} 3072# end: func_convert_core_path_wine_to_w32 3073 3074 3075# func_cygpath ARGS... 3076# Wrapper around calling the cygpath program via LT_CYGPATH. This is used when 3077# when (1) $build is *nix and Cygwin is hosted via a wine environment; or (2) 3078# $build is MSYS and $host is Cygwin, or (3) $build is Cygwin. In case (1) or 3079# (2), returns the Cygwin file name or path in func_cygpath_result (input 3080# file name or path is assumed to be in w32 format, as previously converted 3081# from $build's *nix or MSYS format). In case (3), returns the w32 file name 3082# or path in func_cygpath_result (input file name or path is assumed to be in 3083# Cygwin format). Returns an empty string on error. 3084# 3085# ARGS are passed to cygpath, with the last one being the file name or path to 3086# be converted. 3087# 3088# Specify the absolute *nix (or w32) name to cygpath in the LT_CYGPATH 3089# environment variable; do not put it in $PATH. 3090func_cygpath () 3091{ 3092 $debug_cmd 3093 3094 if test -n "$LT_CYGPATH" && test -f "$LT_CYGPATH"; then 3095 func_cygpath_result=`$LT_CYGPATH "$@" 2>/dev/null` 3096 if test "$?" -ne 0; then 3097 # on failure, ensure result is empty 3098 func_cygpath_result= 3099 fi 3100 else 3101 func_cygpath_result= 3102 func_error "LT_CYGPATH is empty or specifies non-existent file: '$LT_CYGPATH'" 3103 fi 3104} 3105#end: func_cygpath 3106 3107 3108# func_convert_core_msys_to_w32 ARG 3109# Convert file name or path ARG from MSYS format to w32 format. Return 3110# result in func_convert_core_msys_to_w32_result. 3111func_convert_core_msys_to_w32 () 3112{ 3113 $debug_cmd 3114 3115 # awkward: cmd appends spaces to result 3116 func_convert_core_msys_to_w32_result=`( cmd //c echo "$1" ) 2>/dev/null | 3117 $SED -e 's/[ ]*$//' -e "$sed_naive_backslashify"` 3118} 3119#end: func_convert_core_msys_to_w32 3120 3121 3122# func_convert_file_check ARG1 ARG2 3123# Verify that ARG1 (a file name in $build format) was converted to $host 3124# format in ARG2. Otherwise, emit an error message, but continue (resetting 3125# func_to_host_file_result to ARG1). 3126func_convert_file_check () 3127{ 3128 $debug_cmd 3129 3130 if test -z "$2" && test -n "$1"; then 3131 func_error "Could not determine host file name corresponding to" 3132 func_error " '$1'" 3133 func_error "Continuing, but uninstalled executables may not work." 3134 # Fallback: 3135 func_to_host_file_result=$1 3136 fi 3137} 3138# end func_convert_file_check 3139 3140 3141# func_convert_path_check FROM_PATHSEP TO_PATHSEP FROM_PATH TO_PATH 3142# Verify that FROM_PATH (a path in $build format) was converted to $host 3143# format in TO_PATH. Otherwise, emit an error message, but continue, resetting 3144# func_to_host_file_result to a simplistic fallback value (see below). 3145func_convert_path_check () 3146{ 3147 $debug_cmd 3148 3149 if test -z "$4" && test -n "$3"; then 3150 func_error "Could not determine the host path corresponding to" 3151 func_error " '$3'" 3152 func_error "Continuing, but uninstalled executables may not work." 3153 # Fallback. This is a deliberately simplistic "conversion" and 3154 # should not be "improved". See libtool.info. 3155 if test "x$1" != "x$2"; then 3156 lt_replace_pathsep_chars="s|$1|$2|g" 3157 func_to_host_path_result=`echo "$3" | 3158 $SED -e "$lt_replace_pathsep_chars"` 3159 else 3160 func_to_host_path_result=$3 3161 fi 3162 fi 3163} 3164# end func_convert_path_check 3165 3166 3167# func_convert_path_front_back_pathsep FRONTPAT BACKPAT REPL ORIG 3168# Modifies func_to_host_path_result by prepending REPL if ORIG matches FRONTPAT 3169# and appending REPL if ORIG matches BACKPAT. 3170func_convert_path_front_back_pathsep () 3171{ 3172 $debug_cmd 3173 3174 case $4 in 3175 $1 ) func_to_host_path_result=$3$func_to_host_path_result 3176 ;; 3177 esac 3178 case $4 in 3179 $2 ) func_append func_to_host_path_result "$3" 3180 ;; 3181 esac 3182} 3183# end func_convert_path_front_back_pathsep 3184 3185 3186################################################## 3187# $build to $host FILE NAME CONVERSION FUNCTIONS # 3188################################################## 3189# invoked via '$to_host_file_cmd ARG' 3190# 3191# In each case, ARG is the path to be converted from $build to $host format. 3192# Result will be available in $func_to_host_file_result. 3193 3194 3195# func_to_host_file ARG 3196# Converts the file name ARG from $build format to $host format. Return result 3197# in func_to_host_file_result. 3198func_to_host_file () 3199{ 3200 $debug_cmd 3201 3202 $to_host_file_cmd "$1" 3203} 3204# end func_to_host_file 3205 3206 3207# func_to_tool_file ARG LAZY 3208# converts the file name ARG from $build format to toolchain format. Return 3209# result in func_to_tool_file_result. If the conversion in use is listed 3210# in (the comma separated) LAZY, no conversion takes place. 3211func_to_tool_file () 3212{ 3213 $debug_cmd 3214 3215 case ,$2, in 3216 *,"$to_tool_file_cmd",*) 3217 func_to_tool_file_result=$1 3218 ;; 3219 *) 3220 $to_tool_file_cmd "$1" 3221 func_to_tool_file_result=$func_to_host_file_result 3222 ;; 3223 esac 3224} 3225# end func_to_tool_file 3226 3227 3228# func_convert_file_noop ARG 3229# Copy ARG to func_to_host_file_result. 3230func_convert_file_noop () 3231{ 3232 func_to_host_file_result=$1 3233} 3234# end func_convert_file_noop 3235 3236 3237# func_convert_file_msys_to_w32 ARG 3238# Convert file name ARG from (mingw) MSYS to (mingw) w32 format; automatic 3239# conversion to w32 is not available inside the cwrapper. Returns result in 3240# func_to_host_file_result. 3241func_convert_file_msys_to_w32 () 3242{ 3243 $debug_cmd 3244 3245 func_to_host_file_result=$1 3246 if test -n "$1"; then 3247 func_convert_core_msys_to_w32 "$1" 3248 func_to_host_file_result=$func_convert_core_msys_to_w32_result 3249 fi 3250 func_convert_file_check "$1" "$func_to_host_file_result" 3251} 3252# end func_convert_file_msys_to_w32 3253 3254 3255# func_convert_file_cygwin_to_w32 ARG 3256# Convert file name ARG from Cygwin to w32 format. Returns result in 3257# func_to_host_file_result. 3258func_convert_file_cygwin_to_w32 () 3259{ 3260 $debug_cmd 3261 3262 func_to_host_file_result=$1 3263 if test -n "$1"; then 3264 # because $build is cygwin, we call "the" cygpath in $PATH; no need to use 3265 # LT_CYGPATH in this case. 3266 func_to_host_file_result=`cygpath -m "$1"` 3267 fi 3268 func_convert_file_check "$1" "$func_to_host_file_result" 3269} 3270# end func_convert_file_cygwin_to_w32 3271 3272 3273# func_convert_file_nix_to_w32 ARG 3274# Convert file name ARG from *nix to w32 format. Requires a wine environment 3275# and a working winepath. Returns result in func_to_host_file_result. 3276func_convert_file_nix_to_w32 () 3277{ 3278 $debug_cmd 3279 3280 func_to_host_file_result=$1 3281 if test -n "$1"; then 3282 func_convert_core_file_wine_to_w32 "$1" 3283 func_to_host_file_result=$func_convert_core_file_wine_to_w32_result 3284 fi 3285 func_convert_file_check "$1" "$func_to_host_file_result" 3286} 3287# end func_convert_file_nix_to_w32 3288 3289 3290# func_convert_file_msys_to_cygwin ARG 3291# Convert file name ARG from MSYS to Cygwin format. Requires LT_CYGPATH set. 3292# Returns result in func_to_host_file_result. 3293func_convert_file_msys_to_cygwin () 3294{ 3295 $debug_cmd 3296 3297 func_to_host_file_result=$1 3298 if test -n "$1"; then 3299 func_convert_core_msys_to_w32 "$1" 3300 func_cygpath -u "$func_convert_core_msys_to_w32_result" 3301 func_to_host_file_result=$func_cygpath_result 3302 fi 3303 func_convert_file_check "$1" "$func_to_host_file_result" 3304} 3305# end func_convert_file_msys_to_cygwin 3306 3307 3308# func_convert_file_nix_to_cygwin ARG 3309# Convert file name ARG from *nix to Cygwin format. Requires Cygwin installed 3310# in a wine environment, working winepath, and LT_CYGPATH set. Returns result 3311# in func_to_host_file_result. 3312func_convert_file_nix_to_cygwin () 3313{ 3314 $debug_cmd 3315 3316 func_to_host_file_result=$1 3317 if test -n "$1"; then 3318 # convert from *nix to w32, then use cygpath to convert from w32 to cygwin. 3319 func_convert_core_file_wine_to_w32 "$1" 3320 func_cygpath -u "$func_convert_core_file_wine_to_w32_result" 3321 func_to_host_file_result=$func_cygpath_result 3322 fi 3323 func_convert_file_check "$1" "$func_to_host_file_result" 3324} 3325# end func_convert_file_nix_to_cygwin 3326 3327 3328############################################# 3329# $build to $host PATH CONVERSION FUNCTIONS # 3330############################################# 3331# invoked via '$to_host_path_cmd ARG' 3332# 3333# In each case, ARG is the path to be converted from $build to $host format. 3334# The result will be available in $func_to_host_path_result. 3335# 3336# Path separators are also converted from $build format to $host format. If 3337# ARG begins or ends with a path separator character, it is preserved (but 3338# converted to $host format) on output. 3339# 3340# All path conversion functions are named using the following convention: 3341# file name conversion function : func_convert_file_X_to_Y () 3342# path conversion function : func_convert_path_X_to_Y () 3343# where, for any given $build/$host combination the 'X_to_Y' value is the 3344# same. If conversion functions are added for new $build/$host combinations, 3345# the two new functions must follow this pattern, or func_init_to_host_path_cmd 3346# will break. 3347 3348 3349# func_init_to_host_path_cmd 3350# Ensures that function "pointer" variable $to_host_path_cmd is set to the 3351# appropriate value, based on the value of $to_host_file_cmd. 3352to_host_path_cmd= 3353func_init_to_host_path_cmd () 3354{ 3355 $debug_cmd 3356 3357 if test -z "$to_host_path_cmd"; then 3358 func_stripname 'func_convert_file_' '' "$to_host_file_cmd" 3359 to_host_path_cmd=func_convert_path_$func_stripname_result 3360 fi 3361} 3362 3363 3364# func_to_host_path ARG 3365# Converts the path ARG from $build format to $host format. Return result 3366# in func_to_host_path_result. 3367func_to_host_path () 3368{ 3369 $debug_cmd 3370 3371 func_init_to_host_path_cmd 3372 $to_host_path_cmd "$1" 3373} 3374# end func_to_host_path 3375 3376 3377# func_convert_path_noop ARG 3378# Copy ARG to func_to_host_path_result. 3379func_convert_path_noop () 3380{ 3381 func_to_host_path_result=$1 3382} 3383# end func_convert_path_noop 3384 3385 3386# func_convert_path_msys_to_w32 ARG 3387# Convert path ARG from (mingw) MSYS to (mingw) w32 format; automatic 3388# conversion to w32 is not available inside the cwrapper. Returns result in 3389# func_to_host_path_result. 3390func_convert_path_msys_to_w32 () 3391{ 3392 $debug_cmd 3393 3394 func_to_host_path_result=$1 3395 if test -n "$1"; then 3396 # Remove leading and trailing path separator characters from ARG. MSYS 3397 # behavior is inconsistent here; cygpath turns them into '.;' and ';.'; 3398 # and winepath ignores them completely. 3399 func_stripname : : "$1" 3400 func_to_host_path_tmp1=$func_stripname_result 3401 func_convert_core_msys_to_w32 "$func_to_host_path_tmp1" 3402 func_to_host_path_result=$func_convert_core_msys_to_w32_result 3403 func_convert_path_check : ";" \ 3404 "$func_to_host_path_tmp1" "$func_to_host_path_result" 3405 func_convert_path_front_back_pathsep ":*" "*:" ";" "$1" 3406 fi 3407} 3408# end func_convert_path_msys_to_w32 3409 3410 3411# func_convert_path_cygwin_to_w32 ARG 3412# Convert path ARG from Cygwin to w32 format. Returns result in 3413# func_to_host_file_result. 3414func_convert_path_cygwin_to_w32 () 3415{ 3416 $debug_cmd 3417 3418 func_to_host_path_result=$1 3419 if test -n "$1"; then 3420 # See func_convert_path_msys_to_w32: 3421 func_stripname : : "$1" 3422 func_to_host_path_tmp1=$func_stripname_result 3423 func_to_host_path_result=`cygpath -m -p "$func_to_host_path_tmp1"` 3424 func_convert_path_check : ";" \ 3425 "$func_to_host_path_tmp1" "$func_to_host_path_result" 3426 func_convert_path_front_back_pathsep ":*" "*:" ";" "$1" 3427 fi 3428} 3429# end func_convert_path_cygwin_to_w32 3430 3431 3432# func_convert_path_nix_to_w32 ARG 3433# Convert path ARG from *nix to w32 format. Requires a wine environment and 3434# a working winepath. Returns result in func_to_host_file_result. 3435func_convert_path_nix_to_w32 () 3436{ 3437 $debug_cmd 3438 3439 func_to_host_path_result=$1 3440 if test -n "$1"; then 3441 # See func_convert_path_msys_to_w32: 3442 func_stripname : : "$1" 3443 func_to_host_path_tmp1=$func_stripname_result 3444 func_convert_core_path_wine_to_w32 "$func_to_host_path_tmp1" 3445 func_to_host_path_result=$func_convert_core_path_wine_to_w32_result 3446 func_convert_path_check : ";" \ 3447 "$func_to_host_path_tmp1" "$func_to_host_path_result" 3448 func_convert_path_front_back_pathsep ":*" "*:" ";" "$1" 3449 fi 3450} 3451# end func_convert_path_nix_to_w32 3452 3453 3454# func_convert_path_msys_to_cygwin ARG 3455# Convert path ARG from MSYS to Cygwin format. Requires LT_CYGPATH set. 3456# Returns result in func_to_host_file_result. 3457func_convert_path_msys_to_cygwin () 3458{ 3459 $debug_cmd 3460 3461 func_to_host_path_result=$1 3462 if test -n "$1"; then 3463 # See func_convert_path_msys_to_w32: 3464 func_stripname : : "$1" 3465 func_to_host_path_tmp1=$func_stripname_result 3466 func_convert_core_msys_to_w32 "$func_to_host_path_tmp1" 3467 func_cygpath -u -p "$func_convert_core_msys_to_w32_result" 3468 func_to_host_path_result=$func_cygpath_result 3469 func_convert_path_check : : \ 3470 "$func_to_host_path_tmp1" "$func_to_host_path_result" 3471 func_convert_path_front_back_pathsep ":*" "*:" : "$1" 3472 fi 3473} 3474# end func_convert_path_msys_to_cygwin 3475 3476 3477# func_convert_path_nix_to_cygwin ARG 3478# Convert path ARG from *nix to Cygwin format. Requires Cygwin installed in a 3479# a wine environment, working winepath, and LT_CYGPATH set. Returns result in 3480# func_to_host_file_result. 3481func_convert_path_nix_to_cygwin () 3482{ 3483 $debug_cmd 3484 3485 func_to_host_path_result=$1 3486 if test -n "$1"; then 3487 # Remove leading and trailing path separator characters from 3488 # ARG. msys behavior is inconsistent here, cygpath turns them 3489 # into '.;' and ';.', and winepath ignores them completely. 3490 func_stripname : : "$1" 3491 func_to_host_path_tmp1=$func_stripname_result 3492 func_convert_core_path_wine_to_w32 "$func_to_host_path_tmp1" 3493 func_cygpath -u -p "$func_convert_core_path_wine_to_w32_result" 3494 func_to_host_path_result=$func_cygpath_result 3495 func_convert_path_check : : \ 3496 "$func_to_host_path_tmp1" "$func_to_host_path_result" 3497 func_convert_path_front_back_pathsep ":*" "*:" : "$1" 3498 fi 3499} 3500# end func_convert_path_nix_to_cygwin 3501 3502 3503# func_dll_def_p FILE 3504# True iff FILE is a Windows DLL '.def' file. 3505# Keep in sync with _LT_DLL_DEF_P in libtool.m4 3506func_dll_def_p () 3507{ 3508 $debug_cmd 3509 3510 func_dll_def_p_tmp=`$SED -n \ 3511 -e 's/^[ ]*//' \ 3512 -e '/^\(;.*\)*$/d' \ 3513 -e 's/^\(EXPORTS\|LIBRARY\)\([ ].*\)*$/DEF/p' \ 3514 -e q \ 3515 "$1"` 3516 test DEF = "$func_dll_def_p_tmp" 3517} 3518 3519 3520# func_mode_compile arg... 3521func_mode_compile () 3522{ 3523 $debug_cmd 3524 3525 # Get the compilation command and the source file. 3526 base_compile= 3527 srcfile=$nonopt # always keep a non-empty value in "srcfile" 3528 suppress_opt=yes 3529 suppress_output= 3530 arg_mode=normal 3531 libobj= 3532 later= 3533 pie_flag= 3534 3535 for arg 3536 do 3537 case $arg_mode in 3538 arg ) 3539 # do not "continue". Instead, add this to base_compile 3540 lastarg=$arg 3541 arg_mode=normal 3542 ;; 3543 3544 target ) 3545 libobj=$arg 3546 arg_mode=normal 3547 continue 3548 ;; 3549 3550 normal ) 3551 # Accept any command-line options. 3552 case $arg in 3553 -o) 3554 test -n "$libobj" && \ 3555 func_fatal_error "you cannot specify '-o' more than once" 3556 arg_mode=target 3557 continue 3558 ;; 3559 3560 -pie | -fpie | -fPIE) 3561 func_append pie_flag " $arg" 3562 continue 3563 ;; 3564 3565 -shared | -static | -prefer-pic | -prefer-non-pic) 3566 func_append later " $arg" 3567 continue 3568 ;; 3569 3570 -no-suppress) 3571 suppress_opt=no 3572 continue 3573 ;; 3574 3575 -Xcompiler) 3576 arg_mode=arg # the next one goes into the "base_compile" arg list 3577 continue # The current "srcfile" will either be retained or 3578 ;; # replaced later. I would guess that would be a bug. 3579 3580 -Wc,*) 3581 func_stripname '-Wc,' '' "$arg" 3582 args=$func_stripname_result 3583 lastarg= 3584 save_ifs=$IFS; IFS=, 3585 for arg in $args; do 3586 IFS=$save_ifs 3587 func_append_quoted lastarg "$arg" 3588 done 3589 IFS=$save_ifs 3590 func_stripname ' ' '' "$lastarg" 3591 lastarg=$func_stripname_result 3592 3593 # Add the arguments to base_compile. 3594 func_append base_compile " $lastarg" 3595 continue 3596 ;; 3597 3598 *) 3599 # Accept the current argument as the source file. 3600 # The previous "srcfile" becomes the current argument. 3601 # 3602 lastarg=$srcfile 3603 srcfile=$arg 3604 ;; 3605 esac # case $arg 3606 ;; 3607 esac # case $arg_mode 3608 3609 # Aesthetically quote the previous argument. 3610 func_append_quoted base_compile "$lastarg" 3611 done # for arg 3612 3613 case $arg_mode in 3614 arg) 3615 func_fatal_error "you must specify an argument for -Xcompile" 3616 ;; 3617 target) 3618 func_fatal_error "you must specify a target with '-o'" 3619 ;; 3620 *) 3621 # Get the name of the library object. 3622 test -z "$libobj" && { 3623 func_basename "$srcfile" 3624 libobj=$func_basename_result 3625 } 3626 ;; 3627 esac 3628 3629 # Recognize several different file suffixes. 3630 # If the user specifies -o file.o, it is replaced with file.lo 3631 case $libobj in 3632 *.[cCFSifmso] | \ 3633 *.ada | *.adb | *.ads | *.asm | \ 3634 *.c++ | *.cc | *.ii | *.class | *.cpp | *.cxx | \ 3635 *.[fF][09]? | *.for | *.java | *.go | *.obj | *.sx | *.cu | *.cup) 3636 func_xform "$libobj" 3637 libobj=$func_xform_result 3638 ;; 3639 esac 3640 3641 case $libobj in 3642 *.lo) func_lo2o "$libobj"; obj=$func_lo2o_result ;; 3643 *) 3644 func_fatal_error "cannot determine name of library object from '$libobj'" 3645 ;; 3646 esac 3647 3648 func_infer_tag $base_compile 3649 3650 for arg in $later; do 3651 case $arg in 3652 -shared) 3653 test yes = "$build_libtool_libs" \ 3654 || func_fatal_configuration "cannot build a shared library" 3655 build_old_libs=no 3656 continue 3657 ;; 3658 3659 -static) 3660 build_libtool_libs=no 3661 build_old_libs=yes 3662 continue 3663 ;; 3664 3665 -prefer-pic) 3666 pic_mode=yes 3667 continue 3668 ;; 3669 3670 -prefer-non-pic) 3671 pic_mode=no 3672 continue 3673 ;; 3674 esac 3675 done 3676 3677 func_quote_arg pretty "$libobj" 3678 test "X$libobj" != "X$func_quote_arg_result" \ 3679 && $ECHO "X$libobj" | $GREP '[]~#^*{};<>?"'"'"' &()|`$[]' \ 3680 && func_warning "libobj name '$libobj' may not contain shell special characters." 3681 func_dirname_and_basename "$obj" "/" "" 3682 objname=$func_basename_result 3683 xdir=$func_dirname_result 3684 lobj=$xdir$objdir/$objname 3685 3686 test -z "$base_compile" && \ 3687 func_fatal_help "you must specify a compilation command" 3688 3689 # Delete any leftover library objects. 3690 if test yes = "$build_old_libs"; then 3691 removelist="$obj $lobj $libobj ${libobj}T" 3692 else 3693 removelist="$lobj $libobj ${libobj}T" 3694 fi 3695 3696 # On Cygwin there's no "real" PIC flag so we must build both object types 3697 case $host_os in 3698 cygwin* | mingw* | pw32* | os2* | cegcc*) 3699 pic_mode=default 3700 ;; 3701 esac 3702 if test no = "$pic_mode" && test pass_all != "$deplibs_check_method"; then 3703 # non-PIC code in shared libraries is not supported 3704 pic_mode=default 3705 fi 3706 3707 # Calculate the filename of the output object if compiler does 3708 # not support -o with -c 3709 if test no = "$compiler_c_o"; then 3710 output_obj=`$ECHO "$srcfile" | $SED 's%^.*/%%; s%\.[^.]*$%%'`.$objext 3711 lockfile=$output_obj.lock 3712 else 3713 output_obj= 3714 need_locks=no 3715 lockfile= 3716 fi 3717 3718 # Lock this critical section if it is needed 3719 # We use this script file to make the link, it avoids creating a new file 3720 if test yes = "$need_locks"; then 3721 until $opt_dry_run || ln "$progpath" "$lockfile" 2>/dev/null; do 3722 func_echo "Waiting for $lockfile to be removed" 3723 sleep 2 3724 done 3725 elif test warn = "$need_locks"; then 3726 if test -f "$lockfile"; then 3727 $ECHO "\ 3728*** ERROR, $lockfile exists and contains: 3729`cat $lockfile 2>/dev/null` 3730 3731This indicates that another process is trying to use the same 3732temporary object file, and libtool could not work around it because 3733your compiler does not support '-c' and '-o' together. If you 3734repeat this compilation, it may succeed, by chance, but you had better 3735avoid parallel builds (make -j) in this platform, or get a better 3736compiler." 3737 3738 $opt_dry_run || $RM $removelist 3739 exit $EXIT_FAILURE 3740 fi 3741 func_append removelist " $output_obj" 3742 $ECHO "$srcfile" > "$lockfile" 3743 fi 3744 3745 $opt_dry_run || $RM $removelist 3746 func_append removelist " $lockfile" 3747 trap '$opt_dry_run || $RM $removelist; exit $EXIT_FAILURE' 1 2 15 3748 3749 func_to_tool_file "$srcfile" func_convert_file_msys_to_w32 3750 srcfile=$func_to_tool_file_result 3751 func_quote_arg pretty "$srcfile" 3752 qsrcfile=$func_quote_arg_result 3753 3754 # Only build a PIC object if we are building libtool libraries. 3755 if test yes = "$build_libtool_libs"; then 3756 # Without this assignment, base_compile gets emptied. 3757 fbsd_hideous_sh_bug=$base_compile 3758 3759 if test no != "$pic_mode"; then 3760 command="$base_compile $qsrcfile $pic_flag" 3761 else 3762 # Don't build PIC code 3763 command="$base_compile $qsrcfile" 3764 fi 3765 3766 func_mkdir_p "$xdir$objdir" 3767 3768 if test -z "$output_obj"; then 3769 # Place PIC objects in $objdir 3770 func_append command " -o $lobj" 3771 fi 3772 3773 func_show_eval_locale "$command" \ 3774 'test -n "$output_obj" && $RM $removelist; exit $EXIT_FAILURE' 3775 3776 if test warn = "$need_locks" && 3777 test "X`cat $lockfile 2>/dev/null`" != "X$srcfile"; then 3778 $ECHO "\ 3779*** ERROR, $lockfile contains: 3780`cat $lockfile 2>/dev/null` 3781 3782but it should contain: 3783$srcfile 3784 3785This indicates that another process is trying to use the same 3786temporary object file, and libtool could not work around it because 3787your compiler does not support '-c' and '-o' together. If you 3788repeat this compilation, it may succeed, by chance, but you had better 3789avoid parallel builds (make -j) in this platform, or get a better 3790compiler." 3791 3792 $opt_dry_run || $RM $removelist 3793 exit $EXIT_FAILURE 3794 fi 3795 3796 # Just move the object if needed, then go on to compile the next one 3797 if test -n "$output_obj" && test "X$output_obj" != "X$lobj"; then 3798 func_show_eval '$MV "$output_obj" "$lobj"' \ 3799 'error=$?; $opt_dry_run || $RM $removelist; exit $error' 3800 fi 3801 3802 # Allow error messages only from the first compilation. 3803 if test yes = "$suppress_opt"; then 3804 suppress_output=' >/dev/null 2>&1' 3805 fi 3806 fi 3807 3808 # Only build a position-dependent object if we build old libraries. 3809 if test yes = "$build_old_libs"; then 3810 if test yes != "$pic_mode"; then 3811 # Don't build PIC code 3812 command="$base_compile $qsrcfile$pie_flag" 3813 else 3814 command="$base_compile $qsrcfile $pic_flag" 3815 fi 3816 if test yes = "$compiler_c_o"; then 3817 func_append command " -o $obj" 3818 fi 3819 3820 # Suppress compiler output if we already did a PIC compilation. 3821 func_append command "$suppress_output" 3822 func_show_eval_locale "$command" \ 3823 '$opt_dry_run || $RM $removelist; exit $EXIT_FAILURE' 3824 3825 if test warn = "$need_locks" && 3826 test "X`cat $lockfile 2>/dev/null`" != "X$srcfile"; then 3827 $ECHO "\ 3828*** ERROR, $lockfile contains: 3829`cat $lockfile 2>/dev/null` 3830 3831but it should contain: 3832$srcfile 3833 3834This indicates that another process is trying to use the same 3835temporary object file, and libtool could not work around it because 3836your compiler does not support '-c' and '-o' together. If you 3837repeat this compilation, it may succeed, by chance, but you had better 3838avoid parallel builds (make -j) in this platform, or get a better 3839compiler." 3840 3841 $opt_dry_run || $RM $removelist 3842 exit $EXIT_FAILURE 3843 fi 3844 3845 # Just move the object if needed 3846 if test -n "$output_obj" && test "X$output_obj" != "X$obj"; then 3847 func_show_eval '$MV "$output_obj" "$obj"' \ 3848 'error=$?; $opt_dry_run || $RM $removelist; exit $error' 3849 fi 3850 fi 3851 3852 $opt_dry_run || { 3853 func_write_libtool_object "$libobj" "$objdir/$objname" "$objname" 3854 3855 # Unlock the critical section if it was locked 3856 if test no != "$need_locks"; then 3857 removelist=$lockfile 3858 $RM "$lockfile" 3859 fi 3860 } 3861 3862 exit $EXIT_SUCCESS 3863} 3864 3865$opt_help || { 3866 test compile = "$opt_mode" && func_mode_compile ${1+"$@"} 3867} 3868 3869func_mode_help () 3870{ 3871 # We need to display help for each of the modes. 3872 case $opt_mode in 3873 "") 3874 # Generic help is extracted from the usage comments 3875 # at the start of this file. 3876 func_help 3877 ;; 3878 3879 clean) 3880 $ECHO \ 3881"Usage: $progname [OPTION]... --mode=clean RM [RM-OPTION]... FILE... 3882 3883Remove files from the build directory. 3884 3885RM is the name of the program to use to delete files associated with each FILE 3886(typically '/bin/rm'). RM-OPTIONS are options (such as '-f') to be passed 3887to RM. 3888 3889If FILE is a libtool library, object or program, all the files associated 3890with it are deleted. Otherwise, only FILE itself is deleted using RM." 3891 ;; 3892 3893 compile) 3894 $ECHO \ 3895"Usage: $progname [OPTION]... --mode=compile COMPILE-COMMAND... SOURCEFILE 3896 3897Compile a source file into a libtool library object. 3898 3899This mode accepts the following additional options: 3900 3901 -o OUTPUT-FILE set the output file name to OUTPUT-FILE 3902 -no-suppress do not suppress compiler output for multiple passes 3903 -prefer-pic try to build PIC objects only 3904 -prefer-non-pic try to build non-PIC objects only 3905 -shared do not build a '.o' file suitable for static linking 3906 -static only build a '.o' file suitable for static linking 3907 -Wc,FLAG 3908 -Xcompiler FLAG pass FLAG directly to the compiler 3909 3910COMPILE-COMMAND is a command to be used in creating a 'standard' object file 3911from the given SOURCEFILE. 3912 3913The output file name is determined by removing the directory component from 3914SOURCEFILE, then substituting the C source code suffix '.c' with the 3915library object suffix, '.lo'." 3916 ;; 3917 3918 execute) 3919 $ECHO \ 3920"Usage: $progname [OPTION]... --mode=execute COMMAND [ARGS]... 3921 3922Automatically set library path, then run a program. 3923 3924This mode accepts the following additional options: 3925 3926 -dlopen FILE add the directory containing FILE to the library path 3927 3928This mode sets the library path environment variable according to '-dlopen' 3929flags. 3930 3931If any of the ARGS are libtool executable wrappers, then they are translated 3932into their corresponding uninstalled binary, and any of their required library 3933directories are added to the library path. 3934 3935Then, COMMAND is executed, with ARGS as arguments." 3936 ;; 3937 3938 finish) 3939 $ECHO \ 3940"Usage: $progname [OPTION]... --mode=finish [LIBDIR]... 3941 3942Complete the installation of libtool libraries. 3943 3944Each LIBDIR is a directory that contains libtool libraries. 3945 3946The commands that this mode executes may require superuser privileges. Use 3947the '--dry-run' option if you just want to see what would be executed." 3948 ;; 3949 3950 install) 3951 $ECHO \ 3952"Usage: $progname [OPTION]... --mode=install INSTALL-COMMAND... 3953 3954Install executables or libraries. 3955 3956INSTALL-COMMAND is the installation command. The first component should be 3957either the 'install' or 'cp' program. 3958 3959The following components of INSTALL-COMMAND are treated specially: 3960 3961 -inst-prefix-dir PREFIX-DIR Use PREFIX-DIR as a staging area for installation 3962 3963The rest of the components are interpreted as arguments to that command (only 3964BSD-compatible install options are recognized)." 3965 ;; 3966 3967 link) 3968 $ECHO \ 3969"Usage: $progname [OPTION]... --mode=link LINK-COMMAND... 3970 3971Link object files or libraries together to form another library, or to 3972create an executable program. 3973 3974LINK-COMMAND is a command using the C compiler that you would use to create 3975a program from several object files. 3976 3977The following components of LINK-COMMAND are treated specially: 3978 3979 -all-static do not do any dynamic linking at all 3980 -avoid-version do not add a version suffix if possible 3981 -bindir BINDIR specify path to binaries directory (for systems where 3982 libraries must be found in the PATH setting at runtime) 3983 -dlopen FILE '-dlpreopen' FILE if it cannot be dlopened at runtime 3984 -dlpreopen FILE link in FILE and add its symbols to lt_preloaded_symbols 3985 -export-dynamic allow symbols from OUTPUT-FILE to be resolved with dlsym(3) 3986 -export-symbols SYMFILE 3987 try to export only the symbols listed in SYMFILE 3988 -export-symbols-regex REGEX 3989 try to export only the symbols matching REGEX 3990 -LLIBDIR search LIBDIR for required installed libraries 3991 -lNAME OUTPUT-FILE requires the installed library libNAME 3992 -module build a library that can dlopened 3993 -no-fast-install disable the fast-install mode 3994 -no-install link a not-installable executable 3995 -no-undefined declare that a library does not refer to external symbols 3996 -o OUTPUT-FILE create OUTPUT-FILE from the specified objects 3997 -objectlist FILE use a list of object files found in FILE to specify objects 3998 -os2dllname NAME force a short DLL name on OS/2 (no effect on other OSes) 3999 -precious-files-regex REGEX 4000 don't remove output files matching REGEX 4001 -release RELEASE specify package release information 4002 -rpath LIBDIR the created library will eventually be installed in LIBDIR 4003 -R[ ]LIBDIR add LIBDIR to the runtime path of programs and libraries 4004 -shared only do dynamic linking of libtool libraries 4005 -shrext SUFFIX override the standard shared library file extension 4006 -static do not do any dynamic linking of uninstalled libtool libraries 4007 -static-libtool-libs 4008 do not do any dynamic linking of libtool libraries 4009 -version-info CURRENT[:REVISION[:AGE]] 4010 specify library version info [each variable defaults to 0] 4011 -weak LIBNAME declare that the target provides the LIBNAME interface 4012 -Wc,FLAG 4013 -Xcompiler FLAG pass linker-specific FLAG directly to the compiler 4014 -Wa,FLAG 4015 -Xassembler FLAG pass linker-specific FLAG directly to the assembler 4016 -Wl,FLAG 4017 -Xlinker FLAG pass linker-specific FLAG directly to the linker 4018 -XCClinker FLAG pass link-specific FLAG to the compiler driver (CC) 4019 4020All other options (arguments beginning with '-') are ignored. 4021 4022Every other argument is treated as a filename. Files ending in '.la' are 4023treated as uninstalled libtool libraries, other files are standard or library 4024object files. 4025 4026If the OUTPUT-FILE ends in '.la', then a libtool library is created, 4027only library objects ('.lo' files) may be specified, and '-rpath' is 4028required, except when creating a convenience library. 4029 4030If OUTPUT-FILE ends in '.a' or '.lib', then a standard library is created 4031using 'ar' and 'ranlib', or on Windows using 'lib'. 4032 4033If OUTPUT-FILE ends in '.lo' or '.$objext', then a reloadable object file 4034is created, otherwise an executable program is created." 4035 ;; 4036 4037 uninstall) 4038 $ECHO \ 4039"Usage: $progname [OPTION]... --mode=uninstall RM [RM-OPTION]... FILE... 4040 4041Remove libraries from an installation directory. 4042 4043RM is the name of the program to use to delete files associated with each FILE 4044(typically '/bin/rm'). RM-OPTIONS are options (such as '-f') to be passed 4045to RM. 4046 4047If FILE is a libtool library, all the files associated with it are deleted. 4048Otherwise, only FILE itself is deleted using RM." 4049 ;; 4050 4051 *) 4052 func_fatal_help "invalid operation mode '$opt_mode'" 4053 ;; 4054 esac 4055 4056 echo 4057 $ECHO "Try '$progname --help' for more information about other modes." 4058} 4059 4060# Now that we've collected a possible --mode arg, show help if necessary 4061if $opt_help; then 4062 if test : = "$opt_help"; then 4063 func_mode_help 4064 else 4065 { 4066 func_help noexit 4067 for opt_mode in compile link execute install finish uninstall clean; do 4068 func_mode_help 4069 done 4070 } | $SED -n '1p; 2,$s/^Usage:/ or: /p' 4071 { 4072 func_help noexit 4073 for opt_mode in compile link execute install finish uninstall clean; do 4074 echo 4075 func_mode_help 4076 done 4077 } | 4078 $SED '1d 4079 /^When reporting/,/^Report/{ 4080 H 4081 d 4082 } 4083 $x 4084 /information about other modes/d 4085 /more detailed .*MODE/d 4086 s/^Usage:.*--mode=\([^ ]*\) .*/Description of \1 mode:/' 4087 fi 4088 exit $? 4089fi 4090 4091 4092# func_mode_execute arg... 4093func_mode_execute () 4094{ 4095 $debug_cmd 4096 4097 # The first argument is the command name. 4098 cmd=$nonopt 4099 test -z "$cmd" && \ 4100 func_fatal_help "you must specify a COMMAND" 4101 4102 # Handle -dlopen flags immediately. 4103 for file in $opt_dlopen; do 4104 test -f "$file" \ 4105 || func_fatal_help "'$file' is not a file" 4106 4107 dir= 4108 case $file in 4109 *.la) 4110 func_resolve_sysroot "$file" 4111 file=$func_resolve_sysroot_result 4112 4113 # Check to see that this really is a libtool archive. 4114 func_lalib_unsafe_p "$file" \ 4115 || func_fatal_help "'$lib' is not a valid libtool archive" 4116 4117 # Read the libtool library. 4118 dlname= 4119 library_names= 4120 func_source "$file" 4121 4122 # Skip this library if it cannot be dlopened. 4123 if test -z "$dlname"; then 4124 # Warn if it was a shared library. 4125 test -n "$library_names" && \ 4126 func_warning "'$file' was not linked with '-export-dynamic'" 4127 continue 4128 fi 4129 4130 func_dirname "$file" "" "." 4131 dir=$func_dirname_result 4132 4133 if test -f "$dir/$objdir/$dlname"; then 4134 func_append dir "/$objdir" 4135 else 4136 if test ! -f "$dir/$dlname"; then 4137 func_fatal_error "cannot find '$dlname' in '$dir' or '$dir/$objdir'" 4138 fi 4139 fi 4140 ;; 4141 4142 *.lo) 4143 # Just add the directory containing the .lo file. 4144 func_dirname "$file" "" "." 4145 dir=$func_dirname_result 4146 ;; 4147 4148 *) 4149 func_warning "'-dlopen' is ignored for non-libtool libraries and objects" 4150 continue 4151 ;; 4152 esac 4153 4154 # Get the absolute pathname. 4155 absdir=`cd "$dir" && pwd` 4156 test -n "$absdir" && dir=$absdir 4157 4158 # Now add the directory to shlibpath_var. 4159 if eval "test -z \"\$$shlibpath_var\""; then 4160 eval "$shlibpath_var=\"\$dir\"" 4161 else 4162 eval "$shlibpath_var=\"\$dir:\$$shlibpath_var\"" 4163 fi 4164 done 4165 4166 # This variable tells wrapper scripts just to set shlibpath_var 4167 # rather than running their programs. 4168 libtool_execute_magic=$magic 4169 4170 # Check if any of the arguments is a wrapper script. 4171 args= 4172 for file 4173 do 4174 case $file in 4175 -* | *.la | *.lo ) ;; 4176 *) 4177 # Do a test to see if this is really a libtool program. 4178 if func_ltwrapper_script_p "$file"; then 4179 func_source "$file" 4180 # Transform arg to wrapped name. 4181 file=$progdir/$program 4182 elif func_ltwrapper_executable_p "$file"; then 4183 func_ltwrapper_scriptname "$file" 4184 func_source "$func_ltwrapper_scriptname_result" 4185 # Transform arg to wrapped name. 4186 file=$progdir/$program 4187 fi 4188 ;; 4189 esac 4190 # Quote arguments (to preserve shell metacharacters). 4191 func_append_quoted args "$file" 4192 done 4193 4194 if $opt_dry_run; then 4195 # Display what would be done. 4196 if test -n "$shlibpath_var"; then 4197 eval "\$ECHO \"\$shlibpath_var=\$$shlibpath_var\"" 4198 echo "export $shlibpath_var" 4199 fi 4200 $ECHO "$cmd$args" 4201 exit $EXIT_SUCCESS 4202 else 4203 if test -n "$shlibpath_var"; then 4204 # Export the shlibpath_var. 4205 eval "export $shlibpath_var" 4206 fi 4207 4208 # Restore saved environment variables 4209 for lt_var in LANG LANGUAGE LC_ALL LC_CTYPE LC_COLLATE LC_MESSAGES 4210 do 4211 eval "if test \"\${save_$lt_var+set}\" = set; then 4212 $lt_var=\$save_$lt_var; export $lt_var 4213 else 4214 $lt_unset $lt_var 4215 fi" 4216 done 4217 4218 # Now prepare to actually exec the command. 4219 exec_cmd=\$cmd$args 4220 fi 4221} 4222 4223test execute = "$opt_mode" && func_mode_execute ${1+"$@"} 4224 4225 4226# func_mode_finish arg... 4227func_mode_finish () 4228{ 4229 $debug_cmd 4230 4231 libs= 4232 libdirs= 4233 admincmds= 4234 4235 for opt in "$nonopt" ${1+"$@"} 4236 do 4237 if test -d "$opt"; then 4238 func_append libdirs " $opt" 4239 4240 elif test -f "$opt"; then 4241 if func_lalib_unsafe_p "$opt"; then 4242 func_append libs " $opt" 4243 else 4244 func_warning "'$opt' is not a valid libtool archive" 4245 fi 4246 4247 else 4248 func_fatal_error "invalid argument '$opt'" 4249 fi 4250 done 4251 4252 if test -n "$libs"; then 4253 if test -n "$lt_sysroot"; then 4254 sysroot_regex=`$ECHO "$lt_sysroot" | $SED "$sed_make_literal_regex"` 4255 sysroot_cmd="s/\([ ']\)$sysroot_regex/\1/g;" 4256 else 4257 sysroot_cmd= 4258 fi 4259 4260 # Remove sysroot references 4261 if $opt_dry_run; then 4262 for lib in $libs; do 4263 echo "removing references to $lt_sysroot and '=' prefixes from $lib" 4264 done 4265 else 4266 tmpdir=`func_mktempdir` 4267 for lib in $libs; do 4268 $SED -e "$sysroot_cmd s/\([ ']-[LR]\)=/\1/g; s/\([ ']\)=/\1/g" $lib \ 4269 > $tmpdir/tmp-la 4270 mv -f $tmpdir/tmp-la $lib 4271 done 4272 ${RM}r "$tmpdir" 4273 fi 4274 fi 4275 4276 if test -n "$finish_cmds$finish_eval" && test -n "$libdirs"; then 4277 for libdir in $libdirs; do 4278 if test -n "$finish_cmds"; then 4279 # Do each command in the finish commands. 4280 func_execute_cmds "$finish_cmds" 'admincmds="$admincmds 4281'"$cmd"'"' 4282 fi 4283 if test -n "$finish_eval"; then 4284 # Do the single finish_eval. 4285 eval cmds=\"$finish_eval\" 4286 $opt_dry_run || eval "$cmds" || func_append admincmds " 4287 $cmds" 4288 fi 4289 done 4290 fi 4291 4292 # Exit here if they wanted silent mode. 4293 $opt_quiet && exit $EXIT_SUCCESS 4294 4295 if test -n "$finish_cmds$finish_eval" && test -n "$libdirs"; then 4296 echo "----------------------------------------------------------------------" 4297 echo "Libraries have been installed in:" 4298 for libdir in $libdirs; do 4299 $ECHO " $libdir" 4300 done 4301 echo 4302 echo "If you ever happen to want to link against installed libraries" 4303 echo "in a given directory, LIBDIR, you must either use libtool, and" 4304 echo "specify the full pathname of the library, or use the '-LLIBDIR'" 4305 echo "flag during linking and do at least one of the following:" 4306 if test -n "$shlibpath_var"; then 4307 echo " - add LIBDIR to the '$shlibpath_var' environment variable" 4308 echo " during execution" 4309 fi 4310 if test -n "$runpath_var"; then 4311 echo " - add LIBDIR to the '$runpath_var' environment variable" 4312 echo " during linking" 4313 fi 4314 if test -n "$hardcode_libdir_flag_spec"; then 4315 libdir=LIBDIR 4316 eval flag=\"$hardcode_libdir_flag_spec\" 4317 4318 $ECHO " - use the '$flag' linker flag" 4319 fi 4320 if test -n "$admincmds"; then 4321 $ECHO " - have your system administrator run these commands:$admincmds" 4322 fi 4323 if test -f /etc/ld.so.conf; then 4324 echo " - have your system administrator add LIBDIR to '/etc/ld.so.conf'" 4325 fi 4326 echo 4327 4328 echo "See any operating system documentation about shared libraries for" 4329 case $host in 4330 solaris2.[6789]|solaris2.1[0-9]) 4331 echo "more information, such as the ld(1), crle(1) and ld.so(8) manual" 4332 echo "pages." 4333 ;; 4334 *) 4335 echo "more information, such as the ld(1) and ld.so(8) manual pages." 4336 ;; 4337 esac 4338 echo "----------------------------------------------------------------------" 4339 fi 4340 exit $EXIT_SUCCESS 4341} 4342 4343test finish = "$opt_mode" && func_mode_finish ${1+"$@"} 4344 4345 4346# func_mode_install arg... 4347func_mode_install () 4348{ 4349 $debug_cmd 4350 4351 # There may be an optional sh(1) argument at the beginning of 4352 # install_prog (especially on Windows NT). 4353 if test "$SHELL" = "$nonopt" || test /bin/sh = "$nonopt" || 4354 # Allow the use of GNU shtool's install command. 4355 case $nonopt in *shtool*) :;; *) false;; esac 4356 then 4357 # Aesthetically quote it. 4358 func_quote_arg pretty "$nonopt" 4359 install_prog="$func_quote_arg_result " 4360 arg=$1 4361 shift 4362 else 4363 install_prog= 4364 arg=$nonopt 4365 fi 4366 4367 # The real first argument should be the name of the installation program. 4368 # Aesthetically quote it. 4369 func_quote_arg pretty "$arg" 4370 func_append install_prog "$func_quote_arg_result" 4371 install_shared_prog=$install_prog 4372 case " $install_prog " in 4373 *[\\\ /]cp\ *) install_cp=: ;; 4374 *) install_cp=false ;; 4375 esac 4376 4377 # We need to accept at least all the BSD install flags. 4378 dest= 4379 files= 4380 opts= 4381 prev= 4382 install_type= 4383 isdir=false 4384 stripme= 4385 no_mode=: 4386 for arg 4387 do 4388 arg2= 4389 if test -n "$dest"; then 4390 func_append files " $dest" 4391 dest=$arg 4392 continue 4393 fi 4394 4395 case $arg in 4396 -d) isdir=: ;; 4397 -f) 4398 if $install_cp; then :; else 4399 prev=$arg 4400 fi 4401 ;; 4402 -g | -m | -o) 4403 prev=$arg 4404 ;; 4405 -s) 4406 stripme=" -s" 4407 continue 4408 ;; 4409 -*) 4410 ;; 4411 *) 4412 # If the previous option needed an argument, then skip it. 4413 if test -n "$prev"; then 4414 if test X-m = "X$prev" && test -n "$install_override_mode"; then 4415 arg2=$install_override_mode 4416 no_mode=false 4417 fi 4418 prev= 4419 else 4420 dest=$arg 4421 continue 4422 fi 4423 ;; 4424 esac 4425 4426 # Aesthetically quote the argument. 4427 func_quote_arg pretty "$arg" 4428 func_append install_prog " $func_quote_arg_result" 4429 if test -n "$arg2"; then 4430 func_quote_arg pretty "$arg2" 4431 fi 4432 func_append install_shared_prog " $func_quote_arg_result" 4433 done 4434 4435 test -z "$install_prog" && \ 4436 func_fatal_help "you must specify an install program" 4437 4438 test -n "$prev" && \ 4439 func_fatal_help "the '$prev' option requires an argument" 4440 4441 if test -n "$install_override_mode" && $no_mode; then 4442 if $install_cp; then :; else 4443 func_quote_arg pretty "$install_override_mode" 4444 func_append install_shared_prog " -m $func_quote_arg_result" 4445 fi 4446 fi 4447 4448 if test -z "$files"; then 4449 if test -z "$dest"; then 4450 func_fatal_help "no file or destination specified" 4451 else 4452 func_fatal_help "you must specify a destination" 4453 fi 4454 fi 4455 4456 # Strip any trailing slash from the destination. 4457 func_stripname '' '/' "$dest" 4458 dest=$func_stripname_result 4459 4460 # Check to see that the destination is a directory. 4461 test -d "$dest" && isdir=: 4462 if $isdir; then 4463 destdir=$dest 4464 destname= 4465 else 4466 func_dirname_and_basename "$dest" "" "." 4467 destdir=$func_dirname_result 4468 destname=$func_basename_result 4469 4470 # Not a directory, so check to see that there is only one file specified. 4471 set dummy $files; shift 4472 test "$#" -gt 1 && \ 4473 func_fatal_help "'$dest' is not a directory" 4474 fi 4475 case $destdir in 4476 [\\/]* | [A-Za-z]:[\\/]*) ;; 4477 *) 4478 for file in $files; do 4479 case $file in 4480 *.lo) ;; 4481 *) 4482 func_fatal_help "'$destdir' must be an absolute directory name" 4483 ;; 4484 esac 4485 done 4486 ;; 4487 esac 4488 4489 # This variable tells wrapper scripts just to set variables rather 4490 # than running their programs. 4491 libtool_install_magic=$magic 4492 4493 staticlibs= 4494 future_libdirs= 4495 current_libdirs= 4496 for file in $files; do 4497 4498 # Do each installation. 4499 case $file in 4500 *.$libext) 4501 # Do the static libraries later. 4502 func_append staticlibs " $file" 4503 ;; 4504 4505 *.la) 4506 func_resolve_sysroot "$file" 4507 file=$func_resolve_sysroot_result 4508 4509 # Check to see that this really is a libtool archive. 4510 func_lalib_unsafe_p "$file" \ 4511 || func_fatal_help "'$file' is not a valid libtool archive" 4512 4513 library_names= 4514 old_library= 4515 relink_command= 4516 func_source "$file" 4517 4518 # Add the libdir to current_libdirs if it is the destination. 4519 if test "X$destdir" = "X$libdir"; then 4520 case "$current_libdirs " in 4521 *" $libdir "*) ;; 4522 *) func_append current_libdirs " $libdir" ;; 4523 esac 4524 else 4525 # Note the libdir as a future libdir. 4526 case "$future_libdirs " in 4527 *" $libdir "*) ;; 4528 *) func_append future_libdirs " $libdir" ;; 4529 esac 4530 fi 4531 4532 func_dirname "$file" "/" "" 4533 dir=$func_dirname_result 4534 func_append dir "$objdir" 4535 4536 if test -n "$relink_command"; then 4537 # Determine the prefix the user has applied to our future dir. 4538 inst_prefix_dir=`$ECHO "$destdir" | $SED -e "s%$libdir\$%%"` 4539 4540 # Don't allow the user to place us outside of our expected 4541 # location b/c this prevents finding dependent libraries that 4542 # are installed to the same prefix. 4543 # At present, this check doesn't affect windows .dll's that 4544 # are installed into $libdir/../bin (currently, that works fine) 4545 # but it's something to keep an eye on. 4546 test "$inst_prefix_dir" = "$destdir" && \ 4547 func_fatal_error "error: cannot install '$file' to a directory not ending in $libdir" 4548 4549 if test -n "$inst_prefix_dir"; then 4550 # Stick the inst_prefix_dir data into the link command. 4551 relink_command=`$ECHO "$relink_command" | $SED "s%@inst_prefix_dir@%-inst-prefix-dir $inst_prefix_dir%"` 4552 else 4553 relink_command=`$ECHO "$relink_command" | $SED "s%@inst_prefix_dir@%%"` 4554 fi 4555 4556 func_warning "relinking '$file'" 4557 func_show_eval "$relink_command" \ 4558 'func_fatal_error "error: relink '\''$file'\'' with the above command before installing it"' 4559 fi 4560 4561 # See the names of the shared library. 4562 set dummy $library_names; shift 4563 if test -n "$1"; then 4564 realname=$1 4565 shift 4566 4567 srcname=$realname 4568 test -n "$relink_command" && srcname=${realname}T 4569 4570 # Install the shared library and build the symlinks. 4571 func_show_eval "$install_shared_prog $dir/$srcname $destdir/$realname" \ 4572 'exit $?' 4573 tstripme=$stripme 4574 case $host_os in 4575 cygwin* | mingw* | pw32* | cegcc*) 4576 case $realname in 4577 *.dll.a) 4578 tstripme= 4579 ;; 4580 esac 4581 ;; 4582 os2*) 4583 case $realname in 4584 *_dll.a) 4585 tstripme= 4586 ;; 4587 esac 4588 ;; 4589 esac 4590 if test -n "$tstripme" && test -n "$striplib"; then 4591 func_show_eval "$striplib $destdir/$realname" 'exit $?' 4592 fi 4593 4594 if test "$#" -gt 0; then 4595 # Delete the old symlinks, and create new ones. 4596 # Try 'ln -sf' first, because the 'ln' binary might depend on 4597 # the symlink we replace! Solaris /bin/ln does not understand -f, 4598 # so we also need to try rm && ln -s. 4599 for linkname 4600 do 4601 test "$linkname" != "$realname" \ 4602 && func_show_eval "(cd $destdir && { $LN_S -f $realname $linkname || { $RM $linkname && $LN_S $realname $linkname; }; })" 4603 done 4604 fi 4605 4606 # Do each command in the postinstall commands. 4607 lib=$destdir/$realname 4608 func_execute_cmds "$postinstall_cmds" 'exit $?' 4609 fi 4610 4611 # Install the pseudo-library for information purposes. 4612 func_basename "$file" 4613 name=$func_basename_result 4614 instname=$dir/${name}i 4615 func_show_eval "$install_prog $instname $destdir/$name" 'exit $?' 4616 4617 # Maybe install the static library, too. 4618 test -n "$old_library" && func_append staticlibs " $dir/$old_library" 4619 ;; 4620 4621 *.lo) 4622 # Install (i.e. copy) a libtool object. 4623 4624 # Figure out destination file name, if it wasn't already specified. 4625 if test -n "$destname"; then 4626 destfile=$destdir/$destname 4627 else 4628 func_basename "$file" 4629 destfile=$func_basename_result 4630 destfile=$destdir/$destfile 4631 fi 4632 4633 # Deduce the name of the destination old-style object file. 4634 case $destfile in 4635 *.lo) 4636 func_lo2o "$destfile" 4637 staticdest=$func_lo2o_result 4638 ;; 4639 *.$objext) 4640 staticdest=$destfile 4641 destfile= 4642 ;; 4643 *) 4644 func_fatal_help "cannot copy a libtool object to '$destfile'" 4645 ;; 4646 esac 4647 4648 # Install the libtool object if requested. 4649 test -n "$destfile" && \ 4650 func_show_eval "$install_prog $file $destfile" 'exit $?' 4651 4652 # Install the old object if enabled. 4653 if test yes = "$build_old_libs"; then 4654 # Deduce the name of the old-style object file. 4655 func_lo2o "$file" 4656 staticobj=$func_lo2o_result 4657 func_show_eval "$install_prog \$staticobj \$staticdest" 'exit $?' 4658 fi 4659 exit $EXIT_SUCCESS 4660 ;; 4661 4662 *) 4663 # Figure out destination file name, if it wasn't already specified. 4664 if test -n "$destname"; then 4665 destfile=$destdir/$destname 4666 else 4667 func_basename "$file" 4668 destfile=$func_basename_result 4669 destfile=$destdir/$destfile 4670 fi 4671 4672 # If the file is missing, and there is a .exe on the end, strip it 4673 # because it is most likely a libtool script we actually want to 4674 # install 4675 stripped_ext= 4676 case $file in 4677 *.exe) 4678 if test ! -f "$file"; then 4679 func_stripname '' '.exe' "$file" 4680 file=$func_stripname_result 4681 stripped_ext=.exe 4682 fi 4683 ;; 4684 esac 4685 4686 # Do a test to see if this is really a libtool program. 4687 case $host in 4688 *cygwin* | *mingw*) 4689 if func_ltwrapper_executable_p "$file"; then 4690 func_ltwrapper_scriptname "$file" 4691 wrapper=$func_ltwrapper_scriptname_result 4692 else 4693 func_stripname '' '.exe' "$file" 4694 wrapper=$func_stripname_result 4695 fi 4696 ;; 4697 *) 4698 wrapper=$file 4699 ;; 4700 esac 4701 if func_ltwrapper_script_p "$wrapper"; then 4702 notinst_deplibs= 4703 relink_command= 4704 4705 func_source "$wrapper" 4706 4707 # Check the variables that should have been set. 4708 test -z "$generated_by_libtool_version" && \ 4709 func_fatal_error "invalid libtool wrapper script '$wrapper'" 4710 4711 finalize=: 4712 for lib in $notinst_deplibs; do 4713 # Check to see that each library is installed. 4714 libdir= 4715 if test -f "$lib"; then 4716 func_source "$lib" 4717 fi 4718 libfile=$libdir/`$ECHO "$lib" | $SED 's%^.*/%%g'` 4719 if test -n "$libdir" && test ! -f "$libfile"; then 4720 func_warning "'$lib' has not been installed in '$libdir'" 4721 finalize=false 4722 fi 4723 done 4724 4725 relink_command= 4726 func_source "$wrapper" 4727 4728 outputname= 4729 if test no = "$fast_install" && test -n "$relink_command"; then 4730 $opt_dry_run || { 4731 if $finalize; then 4732 tmpdir=`func_mktempdir` 4733 func_basename "$file$stripped_ext" 4734 file=$func_basename_result 4735 outputname=$tmpdir/$file 4736 # Replace the output file specification. 4737 relink_command=`$ECHO "$relink_command" | $SED 's%@OUTPUT@%'"$outputname"'%g'` 4738 4739 $opt_quiet || { 4740 func_quote_arg expand,pretty "$relink_command" 4741 eval "func_echo $func_quote_arg_result" 4742 } 4743 if eval "$relink_command"; then : 4744 else 4745 func_error "error: relink '$file' with the above command before installing it" 4746 $opt_dry_run || ${RM}r "$tmpdir" 4747 continue 4748 fi 4749 file=$outputname 4750 else 4751 func_warning "cannot relink '$file'" 4752 fi 4753 } 4754 else 4755 # Install the binary that we compiled earlier. 4756 file=`$ECHO "$file$stripped_ext" | $SED "s%\([^/]*\)$%$objdir/\1%"` 4757 fi 4758 fi 4759 4760 # remove .exe since cygwin /usr/bin/install will append another 4761 # one anyway 4762 case $install_prog,$host in 4763 */usr/bin/install*,*cygwin*) 4764 case $file:$destfile in 4765 *.exe:*.exe) 4766 # this is ok 4767 ;; 4768 *.exe:*) 4769 destfile=$destfile.exe 4770 ;; 4771 *:*.exe) 4772 func_stripname '' '.exe' "$destfile" 4773 destfile=$func_stripname_result 4774 ;; 4775 esac 4776 ;; 4777 esac 4778 func_show_eval "$install_prog\$stripme \$file \$destfile" 'exit $?' 4779 $opt_dry_run || if test -n "$outputname"; then 4780 ${RM}r "$tmpdir" 4781 fi 4782 ;; 4783 esac 4784 done 4785 4786 for file in $staticlibs; do 4787 func_basename "$file" 4788 name=$func_basename_result 4789 4790 # Set up the ranlib parameters. 4791 oldlib=$destdir/$name 4792 func_to_tool_file "$oldlib" func_convert_file_msys_to_w32 4793 tool_oldlib=$func_to_tool_file_result 4794 4795 func_show_eval "$install_prog \$file \$oldlib" 'exit $?' 4796 4797 if test -n "$stripme" && test -n "$old_striplib"; then 4798 func_show_eval "$old_striplib $tool_oldlib" 'exit $?' 4799 fi 4800 4801 # Do each command in the postinstall commands. 4802 func_execute_cmds "$old_postinstall_cmds" 'exit $?' 4803 done 4804 4805 test -n "$future_libdirs" && \ 4806 func_warning "remember to run '$progname --finish$future_libdirs'" 4807 4808 if test -n "$current_libdirs"; then 4809 # Maybe just do a dry run. 4810 $opt_dry_run && current_libdirs=" -n$current_libdirs" 4811 exec_cmd='$SHELL "$progpath" $preserve_args --finish$current_libdirs' 4812 else 4813 exit $EXIT_SUCCESS 4814 fi 4815} 4816 4817test install = "$opt_mode" && func_mode_install ${1+"$@"} 4818 4819 4820# func_generate_dlsyms outputname originator pic_p 4821# Extract symbols from dlprefiles and create ${outputname}S.o with 4822# a dlpreopen symbol table. 4823func_generate_dlsyms () 4824{ 4825 $debug_cmd 4826 4827 my_outputname=$1 4828 my_originator=$2 4829 my_pic_p=${3-false} 4830 my_prefix=`$ECHO "$my_originator" | $SED 's%[^a-zA-Z0-9]%_%g'` 4831 my_dlsyms= 4832 4833 if test -n "$dlfiles$dlprefiles" || test no != "$dlself"; then 4834 if test -n "$NM" && test -n "$global_symbol_pipe"; then 4835 my_dlsyms=${my_outputname}S.c 4836 else 4837 func_error "not configured to extract global symbols from dlpreopened files" 4838 fi 4839 fi 4840 4841 if test -n "$my_dlsyms"; then 4842 case $my_dlsyms in 4843 "") ;; 4844 *.c) 4845 # Discover the nlist of each of the dlfiles. 4846 nlist=$output_objdir/$my_outputname.nm 4847 4848 func_show_eval "$RM $nlist ${nlist}S ${nlist}T" 4849 4850 # Parse the name list into a source file. 4851 func_verbose "creating $output_objdir/$my_dlsyms" 4852 4853 $opt_dry_run || $ECHO > "$output_objdir/$my_dlsyms" "\ 4854/* $my_dlsyms - symbol resolution table for '$my_outputname' dlsym emulation. */ 4855/* Generated by $PROGRAM (GNU $PACKAGE) $VERSION */ 4856 4857#ifdef __cplusplus 4858extern \"C\" { 4859#endif 4860 4861#if defined __GNUC__ && (((__GNUC__ == 4) && (__GNUC_MINOR__ >= 4)) || (__GNUC__ > 4)) 4862#pragma GCC diagnostic ignored \"-Wstrict-prototypes\" 4863#endif 4864 4865/* Keep this code in sync between libtool.m4, ltmain, lt_system.h, and tests. */ 4866#if defined _WIN32 || defined __CYGWIN__ || defined _WIN32_WCE 4867/* DATA imports from DLLs on WIN32 can't be const, because runtime 4868 relocations are performed -- see ld's documentation on pseudo-relocs. */ 4869# define LT_DLSYM_CONST 4870#elif defined __osf__ 4871/* This system does not cope well with relocations in const data. */ 4872# define LT_DLSYM_CONST 4873#else 4874# define LT_DLSYM_CONST const 4875#endif 4876 4877#define STREQ(s1, s2) (strcmp ((s1), (s2)) == 0) 4878 4879/* External symbol declarations for the compiler. */\ 4880" 4881 4882 if test yes = "$dlself"; then 4883 func_verbose "generating symbol list for '$output'" 4884 4885 $opt_dry_run || echo ': @PROGRAM@ ' > "$nlist" 4886 4887 # Add our own program objects to the symbol list. 4888 progfiles=`$ECHO "$objs$old_deplibs" | $SP2NL | $SED "$lo2o" | $NL2SP` 4889 for progfile in $progfiles; do 4890 func_to_tool_file "$progfile" func_convert_file_msys_to_w32 4891 func_verbose "extracting global C symbols from '$func_to_tool_file_result'" 4892 $opt_dry_run || eval "$NM $func_to_tool_file_result | $global_symbol_pipe >> '$nlist'" 4893 done 4894 4895 if test -n "$exclude_expsyms"; then 4896 $opt_dry_run || { 4897 eval '$EGREP -v " ($exclude_expsyms)$" "$nlist" > "$nlist"T' 4898 eval '$MV "$nlist"T "$nlist"' 4899 } 4900 fi 4901 4902 if test -n "$export_symbols_regex"; then 4903 $opt_dry_run || { 4904 eval '$EGREP -e "$export_symbols_regex" "$nlist" > "$nlist"T' 4905 eval '$MV "$nlist"T "$nlist"' 4906 } 4907 fi 4908 4909 # Prepare the list of exported symbols 4910 if test -z "$export_symbols"; then 4911 export_symbols=$output_objdir/$outputname.exp 4912 $opt_dry_run || { 4913 $RM $export_symbols 4914 eval "$SED -n -e '/^: @PROGRAM@ $/d' -e 's/^.* \(.*\)$/\1/p' "'< "$nlist" > "$export_symbols"' 4915 case $host in 4916 *cygwin* | *mingw* | *cegcc* ) 4917 eval "echo EXPORTS "'> "$output_objdir/$outputname.def"' 4918 eval 'cat "$export_symbols" >> "$output_objdir/$outputname.def"' 4919 ;; 4920 esac 4921 } 4922 else 4923 $opt_dry_run || { 4924 eval "$SED -e 's/\([].[*^$]\)/\\\\\1/g' -e 's/^/ /' -e 's/$/$/'"' < "$export_symbols" > "$output_objdir/$outputname.exp"' 4925 eval '$GREP -f "$output_objdir/$outputname.exp" < "$nlist" > "$nlist"T' 4926 eval '$MV "$nlist"T "$nlist"' 4927 case $host in 4928 *cygwin* | *mingw* | *cegcc* ) 4929 eval "echo EXPORTS "'> "$output_objdir/$outputname.def"' 4930 eval 'cat "$nlist" >> "$output_objdir/$outputname.def"' 4931 ;; 4932 esac 4933 } 4934 fi 4935 fi 4936 4937 for dlprefile in $dlprefiles; do 4938 func_verbose "extracting global C symbols from '$dlprefile'" 4939 func_basename "$dlprefile" 4940 name=$func_basename_result 4941 case $host in 4942 *cygwin* | *mingw* | *cegcc* ) 4943 # if an import library, we need to obtain dlname 4944 if func_win32_import_lib_p "$dlprefile"; then 4945 func_tr_sh "$dlprefile" 4946 eval "curr_lafile=\$libfile_$func_tr_sh_result" 4947 dlprefile_dlbasename= 4948 if test -n "$curr_lafile" && func_lalib_p "$curr_lafile"; then 4949 # Use subshell, to avoid clobbering current variable values 4950 dlprefile_dlname=`source "$curr_lafile" && echo "$dlname"` 4951 if test -n "$dlprefile_dlname"; then 4952 func_basename "$dlprefile_dlname" 4953 dlprefile_dlbasename=$func_basename_result 4954 else 4955 # no lafile. user explicitly requested -dlpreopen <import library>. 4956 $sharedlib_from_linklib_cmd "$dlprefile" 4957 dlprefile_dlbasename=$sharedlib_from_linklib_result 4958 fi 4959 fi 4960 $opt_dry_run || { 4961 if test -n "$dlprefile_dlbasename"; then 4962 eval '$ECHO ": $dlprefile_dlbasename" >> "$nlist"' 4963 else 4964 func_warning "Could not compute DLL name from $name" 4965 eval '$ECHO ": $name " >> "$nlist"' 4966 fi 4967 func_to_tool_file "$dlprefile" func_convert_file_msys_to_w32 4968 eval "$NM \"$func_to_tool_file_result\" 2>/dev/null | $global_symbol_pipe | 4969 $SED -e '/I __imp/d' -e 's/I __nm_/D /;s/_nm__//' >> '$nlist'" 4970 } 4971 else # not an import lib 4972 $opt_dry_run || { 4973 eval '$ECHO ": $name " >> "$nlist"' 4974 func_to_tool_file "$dlprefile" func_convert_file_msys_to_w32 4975 eval "$NM \"$func_to_tool_file_result\" 2>/dev/null | $global_symbol_pipe >> '$nlist'" 4976 } 4977 fi 4978 ;; 4979 *) 4980 $opt_dry_run || { 4981 eval '$ECHO ": $name " >> "$nlist"' 4982 func_to_tool_file "$dlprefile" func_convert_file_msys_to_w32 4983 eval "$NM \"$func_to_tool_file_result\" 2>/dev/null | $global_symbol_pipe >> '$nlist'" 4984 } 4985 ;; 4986 esac 4987 done 4988 4989 $opt_dry_run || { 4990 # Make sure we have at least an empty file. 4991 test -f "$nlist" || : > "$nlist" 4992 4993 if test -n "$exclude_expsyms"; then 4994 $EGREP -v " ($exclude_expsyms)$" "$nlist" > "$nlist"T 4995 $MV "$nlist"T "$nlist" 4996 fi 4997 4998 # Try sorting and uniquifying the output. 4999 if $GREP -v "^: " < "$nlist" | 5000 if sort -k 3 </dev/null >/dev/null 2>&1; then 5001 sort -k 3 5002 else 5003 sort +2 5004 fi | 5005 uniq > "$nlist"S; then 5006 : 5007 else 5008 $GREP -v "^: " < "$nlist" > "$nlist"S 5009 fi 5010 5011 if test -f "$nlist"S; then 5012 eval "$global_symbol_to_cdecl"' < "$nlist"S >> "$output_objdir/$my_dlsyms"' 5013 else 5014 echo '/* NONE */' >> "$output_objdir/$my_dlsyms" 5015 fi 5016 5017 func_show_eval '$RM "${nlist}I"' 5018 if test -n "$global_symbol_to_import"; then 5019 eval "$global_symbol_to_import"' < "$nlist"S > "$nlist"I' 5020 fi 5021 5022 echo >> "$output_objdir/$my_dlsyms" "\ 5023 5024/* The mapping between symbol names and symbols. */ 5025typedef struct { 5026 const char *name; 5027 void *address; 5028} lt_dlsymlist; 5029extern LT_DLSYM_CONST lt_dlsymlist 5030lt_${my_prefix}_LTX_preloaded_symbols[];\ 5031" 5032 5033 if test -s "$nlist"I; then 5034 echo >> "$output_objdir/$my_dlsyms" "\ 5035static void lt_syminit(void) 5036{ 5037 LT_DLSYM_CONST lt_dlsymlist *symbol = lt_${my_prefix}_LTX_preloaded_symbols; 5038 for (; symbol->name; ++symbol) 5039 {" 5040 $SED 's/.*/ if (STREQ (symbol->name, \"&\")) symbol->address = (void *) \&&;/' < "$nlist"I >> "$output_objdir/$my_dlsyms" 5041 echo >> "$output_objdir/$my_dlsyms" "\ 5042 } 5043}" 5044 fi 5045 echo >> "$output_objdir/$my_dlsyms" "\ 5046LT_DLSYM_CONST lt_dlsymlist 5047lt_${my_prefix}_LTX_preloaded_symbols[] = 5048{ {\"$my_originator\", (void *) 0}," 5049 5050 if test -s "$nlist"I; then 5051 echo >> "$output_objdir/$my_dlsyms" "\ 5052 {\"@INIT@\", (void *) <_syminit}," 5053 fi 5054 5055 case $need_lib_prefix in 5056 no) 5057 eval "$global_symbol_to_c_name_address" < "$nlist" >> "$output_objdir/$my_dlsyms" 5058 ;; 5059 *) 5060 eval "$global_symbol_to_c_name_address_lib_prefix" < "$nlist" >> "$output_objdir/$my_dlsyms" 5061 ;; 5062 esac 5063 echo >> "$output_objdir/$my_dlsyms" "\ 5064 {0, (void *) 0} 5065}; 5066 5067/* This works around a problem in FreeBSD linker */ 5068#ifdef FREEBSD_WORKAROUND 5069static const void *lt_preloaded_setup() { 5070 return lt_${my_prefix}_LTX_preloaded_symbols; 5071} 5072#endif 5073 5074#ifdef __cplusplus 5075} 5076#endif\ 5077" 5078 } # !$opt_dry_run 5079 5080 pic_flag_for_symtable= 5081 case "$compile_command " in 5082 *" -static "*) ;; 5083 *) 5084 case $host in 5085 # compiling the symbol table file with pic_flag works around 5086 # a FreeBSD bug that causes programs to crash when -lm is 5087 # linked before any other PIC object. But we must not use 5088 # pic_flag when linking with -static. The problem exists in 5089 # FreeBSD 2.2.6 and is fixed in FreeBSD 3.1. 5090 *-*-freebsd2.*|*-*-freebsd3.0*|*-*-freebsdelf3.0*) 5091 pic_flag_for_symtable=" $pic_flag -DFREEBSD_WORKAROUND" ;; 5092 *-*-hpux*) 5093 pic_flag_for_symtable=" $pic_flag" ;; 5094 *) 5095 $my_pic_p && pic_flag_for_symtable=" $pic_flag" 5096 ;; 5097 esac 5098 ;; 5099 esac 5100 symtab_cflags= 5101 for arg in $LTCFLAGS; do 5102 case $arg in 5103 -pie | -fpie | -fPIE) ;; 5104 *) func_append symtab_cflags " $arg" ;; 5105 esac 5106 done 5107 5108 # Now compile the dynamic symbol file. 5109 func_show_eval '(cd $output_objdir && $LTCC$symtab_cflags -c$no_builtin_flag$pic_flag_for_symtable "$my_dlsyms")' 'exit $?' 5110 5111 # Clean up the generated files. 5112 func_show_eval '$RM "$output_objdir/$my_dlsyms" "$nlist" "${nlist}S" "${nlist}T" "${nlist}I"' 5113 5114 # Transform the symbol file into the correct name. 5115 symfileobj=$output_objdir/${my_outputname}S.$objext 5116 case $host in 5117 *cygwin* | *mingw* | *cegcc* ) 5118 if test -f "$output_objdir/$my_outputname.def"; then 5119 compile_command=`$ECHO "$compile_command" | $SED "s%@SYMFILE@%$output_objdir/$my_outputname.def $symfileobj%"` 5120 finalize_command=`$ECHO "$finalize_command" | $SED "s%@SYMFILE@%$output_objdir/$my_outputname.def $symfileobj%"` 5121 else 5122 compile_command=`$ECHO "$compile_command" | $SED "s%@SYMFILE@%$symfileobj%"` 5123 finalize_command=`$ECHO "$finalize_command" | $SED "s%@SYMFILE@%$symfileobj%"` 5124 fi 5125 ;; 5126 *) 5127 compile_command=`$ECHO "$compile_command" | $SED "s%@SYMFILE@%$symfileobj%"` 5128 finalize_command=`$ECHO "$finalize_command" | $SED "s%@SYMFILE@%$symfileobj%"` 5129 ;; 5130 esac 5131 ;; 5132 *) 5133 func_fatal_error "unknown suffix for '$my_dlsyms'" 5134 ;; 5135 esac 5136 else 5137 # We keep going just in case the user didn't refer to 5138 # lt_preloaded_symbols. The linker will fail if global_symbol_pipe 5139 # really was required. 5140 5141 # Nullify the symbol file. 5142 compile_command=`$ECHO "$compile_command" | $SED "s% @SYMFILE@%%"` 5143 finalize_command=`$ECHO "$finalize_command" | $SED "s% @SYMFILE@%%"` 5144 fi 5145} 5146 5147# func_cygming_gnu_implib_p ARG 5148# This predicate returns with zero status (TRUE) if 5149# ARG is a GNU/binutils-style import library. Returns 5150# with nonzero status (FALSE) otherwise. 5151func_cygming_gnu_implib_p () 5152{ 5153 $debug_cmd 5154 5155 func_to_tool_file "$1" func_convert_file_msys_to_w32 5156 func_cygming_gnu_implib_tmp=`$NM "$func_to_tool_file_result" | eval "$global_symbol_pipe" | $EGREP ' (_head_[A-Za-z0-9_]+_[ad]l*|[A-Za-z0-9_]+_[ad]l*_iname)$'` 5157 test -n "$func_cygming_gnu_implib_tmp" 5158} 5159 5160# func_cygming_ms_implib_p ARG 5161# This predicate returns with zero status (TRUE) if 5162# ARG is an MS-style import library. Returns 5163# with nonzero status (FALSE) otherwise. 5164func_cygming_ms_implib_p () 5165{ 5166 $debug_cmd 5167 5168 func_to_tool_file "$1" func_convert_file_msys_to_w32 5169 func_cygming_ms_implib_tmp=`$NM "$func_to_tool_file_result" | eval "$global_symbol_pipe" | $GREP '_NULL_IMPORT_DESCRIPTOR'` 5170 test -n "$func_cygming_ms_implib_tmp" 5171} 5172 5173# func_win32_libid arg 5174# return the library type of file 'arg' 5175# 5176# Need a lot of goo to handle *both* DLLs and import libs 5177# Has to be a shell function in order to 'eat' the argument 5178# that is supplied when $file_magic_command is called. 5179# Despite the name, also deal with 64 bit binaries. 5180func_win32_libid () 5181{ 5182 $debug_cmd 5183 5184 win32_libid_type=unknown 5185 win32_fileres=`file -L $1 2>/dev/null` 5186 case $win32_fileres in 5187 *ar\ archive\ import\ library*) # definitely import 5188 win32_libid_type="x86 archive import" 5189 ;; 5190 *ar\ archive*) # could be an import, or static 5191 # Keep the egrep pattern in sync with the one in _LT_CHECK_MAGIC_METHOD. 5192 if eval $OBJDUMP -f $1 | $SED -e '10q' 2>/dev/null | 5193 $EGREP 'file format (pei*-i386(.*architecture: i386)?|pe-arm-wince|pe-x86-64)' >/dev/null; then 5194 case $nm_interface in 5195 "MS dumpbin") 5196 if func_cygming_ms_implib_p "$1" || 5197 func_cygming_gnu_implib_p "$1" 5198 then 5199 win32_nmres=import 5200 else 5201 win32_nmres= 5202 fi 5203 ;; 5204 *) 5205 func_to_tool_file "$1" func_convert_file_msys_to_w32 5206 win32_nmres=`eval $NM -f posix -A \"$func_to_tool_file_result\" | 5207 $SED -n -e ' 5208 1,100{ 5209 / I /{ 5210 s|.*|import| 5211 p 5212 q 5213 } 5214 }'` 5215 ;; 5216 esac 5217 case $win32_nmres in 5218 import*) win32_libid_type="x86 archive import";; 5219 *) win32_libid_type="x86 archive static";; 5220 esac 5221 fi 5222 ;; 5223 *DLL*) 5224 win32_libid_type="x86 DLL" 5225 ;; 5226 *executable*) # but shell scripts are "executable" too... 5227 case $win32_fileres in 5228 *MS\ Windows\ PE\ Intel*) 5229 win32_libid_type="x86 DLL" 5230 ;; 5231 esac 5232 ;; 5233 esac 5234 $ECHO "$win32_libid_type" 5235} 5236 5237# func_cygming_dll_for_implib ARG 5238# 5239# Platform-specific function to extract the 5240# name of the DLL associated with the specified 5241# import library ARG. 5242# Invoked by eval'ing the libtool variable 5243# $sharedlib_from_linklib_cmd 5244# Result is available in the variable 5245# $sharedlib_from_linklib_result 5246func_cygming_dll_for_implib () 5247{ 5248 $debug_cmd 5249 5250 sharedlib_from_linklib_result=`$DLLTOOL --identify-strict --identify "$1"` 5251} 5252 5253# func_cygming_dll_for_implib_fallback_core SECTION_NAME LIBNAMEs 5254# 5255# The is the core of a fallback implementation of a 5256# platform-specific function to extract the name of the 5257# DLL associated with the specified import library LIBNAME. 5258# 5259# SECTION_NAME is either .idata$6 or .idata$7, depending 5260# on the platform and compiler that created the implib. 5261# 5262# Echos the name of the DLL associated with the 5263# specified import library. 5264func_cygming_dll_for_implib_fallback_core () 5265{ 5266 $debug_cmd 5267 5268 match_literal=`$ECHO "$1" | $SED "$sed_make_literal_regex"` 5269 $OBJDUMP -s --section "$1" "$2" 2>/dev/null | 5270 $SED '/^Contents of section '"$match_literal"':/{ 5271 # Place marker at beginning of archive member dllname section 5272 s/.*/====MARK====/ 5273 p 5274 d 5275 } 5276 # These lines can sometimes be longer than 43 characters, but 5277 # are always uninteresting 5278 /:[ ]*file format pe[i]\{,1\}-/d 5279 /^In archive [^:]*:/d 5280 # Ensure marker is printed 5281 /^====MARK====/p 5282 # Remove all lines with less than 43 characters 5283 /^.\{43\}/!d 5284 # From remaining lines, remove first 43 characters 5285 s/^.\{43\}//' | 5286 $SED -n ' 5287 # Join marker and all lines until next marker into a single line 5288 /^====MARK====/ b para 5289 H 5290 $ b para 5291 b 5292 :para 5293 x 5294 s/\n//g 5295 # Remove the marker 5296 s/^====MARK====// 5297 # Remove trailing dots and whitespace 5298 s/[\. \t]*$// 5299 # Print 5300 /./p' | 5301 # we now have a list, one entry per line, of the stringified 5302 # contents of the appropriate section of all members of the 5303 # archive that possess that section. Heuristic: eliminate 5304 # all those that have a first or second character that is 5305 # a '.' (that is, objdump's representation of an unprintable 5306 # character.) This should work for all archives with less than 5307 # 0x302f exports -- but will fail for DLLs whose name actually 5308 # begins with a literal '.' or a single character followed by 5309 # a '.'. 5310 # 5311 # Of those that remain, print the first one. 5312 $SED -e '/^\./d;/^.\./d;q' 5313} 5314 5315# func_cygming_dll_for_implib_fallback ARG 5316# Platform-specific function to extract the 5317# name of the DLL associated with the specified 5318# import library ARG. 5319# 5320# This fallback implementation is for use when $DLLTOOL 5321# does not support the --identify-strict option. 5322# Invoked by eval'ing the libtool variable 5323# $sharedlib_from_linklib_cmd 5324# Result is available in the variable 5325# $sharedlib_from_linklib_result 5326func_cygming_dll_for_implib_fallback () 5327{ 5328 $debug_cmd 5329 5330 if func_cygming_gnu_implib_p "$1"; then 5331 # binutils import library 5332 sharedlib_from_linklib_result=`func_cygming_dll_for_implib_fallback_core '.idata$7' "$1"` 5333 elif func_cygming_ms_implib_p "$1"; then 5334 # ms-generated import library 5335 sharedlib_from_linklib_result=`func_cygming_dll_for_implib_fallback_core '.idata$6' "$1"` 5336 else 5337 # unknown 5338 sharedlib_from_linklib_result= 5339 fi 5340} 5341 5342 5343# func_extract_an_archive dir oldlib 5344func_extract_an_archive () 5345{ 5346 $debug_cmd 5347 5348 f_ex_an_ar_dir=$1; shift 5349 f_ex_an_ar_oldlib=$1 5350 if test yes = "$lock_old_archive_extraction"; then 5351 lockfile=$f_ex_an_ar_oldlib.lock 5352 until $opt_dry_run || ln "$progpath" "$lockfile" 2>/dev/null; do 5353 func_echo "Waiting for $lockfile to be removed" 5354 sleep 2 5355 done 5356 fi 5357 func_show_eval "(cd \$f_ex_an_ar_dir && $AR x \"\$f_ex_an_ar_oldlib\")" \ 5358 'stat=$?; rm -f "$lockfile"; exit $stat' 5359 if test yes = "$lock_old_archive_extraction"; then 5360 $opt_dry_run || rm -f "$lockfile" 5361 fi 5362 if ($AR t "$f_ex_an_ar_oldlib" | sort | sort -uc >/dev/null 2>&1); then 5363 : 5364 else 5365 func_fatal_error "object name conflicts in archive: $f_ex_an_ar_dir/$f_ex_an_ar_oldlib" 5366 fi 5367} 5368 5369 5370# func_extract_archives gentop oldlib ... 5371func_extract_archives () 5372{ 5373 $debug_cmd 5374 5375 my_gentop=$1; shift 5376 my_oldlibs=${1+"$@"} 5377 my_oldobjs= 5378 my_xlib= 5379 my_xabs= 5380 my_xdir= 5381 5382 for my_xlib in $my_oldlibs; do 5383 # Extract the objects. 5384 case $my_xlib in 5385 [\\/]* | [A-Za-z]:[\\/]*) my_xabs=$my_xlib ;; 5386 *) my_xabs=`pwd`"/$my_xlib" ;; 5387 esac 5388 func_basename "$my_xlib" 5389 my_xlib=$func_basename_result 5390 my_xlib_u=$my_xlib 5391 while :; do 5392 case " $extracted_archives " in 5393 *" $my_xlib_u "*) 5394 func_arith $extracted_serial + 1 5395 extracted_serial=$func_arith_result 5396 my_xlib_u=lt$extracted_serial-$my_xlib ;; 5397 *) break ;; 5398 esac 5399 done 5400 extracted_archives="$extracted_archives $my_xlib_u" 5401 my_xdir=$my_gentop/$my_xlib_u 5402 5403 func_mkdir_p "$my_xdir" 5404 5405 case $host in 5406 *-darwin*) 5407 func_verbose "Extracting $my_xabs" 5408 # Do not bother doing anything if just a dry run 5409 $opt_dry_run || { 5410 darwin_orig_dir=`pwd` 5411 cd $my_xdir || exit $? 5412 darwin_archive=$my_xabs 5413 darwin_curdir=`pwd` 5414 func_basename "$darwin_archive" 5415 darwin_base_archive=$func_basename_result 5416 darwin_arches=`$LIPO -info "$darwin_archive" 2>/dev/null | $GREP Architectures 2>/dev/null || true` 5417 if test -n "$darwin_arches"; then 5418 darwin_arches=`$ECHO "$darwin_arches" | $SED -e 's/.*are://'` 5419 darwin_arch= 5420 func_verbose "$darwin_base_archive has multiple architectures $darwin_arches" 5421 for darwin_arch in $darwin_arches; do 5422 func_mkdir_p "unfat-$$/$darwin_base_archive-$darwin_arch" 5423 $LIPO -thin $darwin_arch -output "unfat-$$/$darwin_base_archive-$darwin_arch/$darwin_base_archive" "$darwin_archive" 5424 cd "unfat-$$/$darwin_base_archive-$darwin_arch" 5425 func_extract_an_archive "`pwd`" "$darwin_base_archive" 5426 cd "$darwin_curdir" 5427 $RM "unfat-$$/$darwin_base_archive-$darwin_arch/$darwin_base_archive" 5428 done # $darwin_arches 5429 ## Okay now we've a bunch of thin objects, gotta fatten them up :) 5430 darwin_filelist=`find unfat-$$ -type f -name \*.o -print -o -name \*.lo -print | $SED -e "$sed_basename" | sort -u` 5431 darwin_file= 5432 darwin_files= 5433 for darwin_file in $darwin_filelist; do 5434 darwin_files=`find unfat-$$ -name $darwin_file -print | sort | $NL2SP` 5435 $LIPO -create -output "$darwin_file" $darwin_files 5436 done # $darwin_filelist 5437 $RM -rf unfat-$$ 5438 cd "$darwin_orig_dir" 5439 else 5440 cd $darwin_orig_dir 5441 func_extract_an_archive "$my_xdir" "$my_xabs" 5442 fi # $darwin_arches 5443 } # !$opt_dry_run 5444 ;; 5445 *) 5446 func_extract_an_archive "$my_xdir" "$my_xabs" 5447 ;; 5448 esac 5449 my_oldobjs="$my_oldobjs "`find $my_xdir -name \*.$objext -print -o -name \*.lo -print | sort | $NL2SP` 5450 done 5451 5452 func_extract_archives_result=$my_oldobjs 5453} 5454 5455 5456# func_emit_wrapper [arg=no] 5457# 5458# Emit a libtool wrapper script on stdout. 5459# Don't directly open a file because we may want to 5460# incorporate the script contents within a cygwin/mingw 5461# wrapper executable. Must ONLY be called from within 5462# func_mode_link because it depends on a number of variables 5463# set therein. 5464# 5465# ARG is the value that the WRAPPER_SCRIPT_BELONGS_IN_OBJDIR 5466# variable will take. If 'yes', then the emitted script 5467# will assume that the directory where it is stored is 5468# the $objdir directory. This is a cygwin/mingw-specific 5469# behavior. 5470func_emit_wrapper () 5471{ 5472 func_emit_wrapper_arg1=${1-no} 5473 5474 $ECHO "\ 5475#! $SHELL 5476 5477# $output - temporary wrapper script for $objdir/$outputname 5478# Generated by $PROGRAM (GNU $PACKAGE) $VERSION 5479# 5480# The $output program cannot be directly executed until all the libtool 5481# libraries that it depends on are installed. 5482# 5483# This wrapper script should never be moved out of the build directory. 5484# If it is, it will not operate correctly. 5485 5486# Sed substitution that helps us do robust quoting. It backslashifies 5487# metacharacters that are still active within double-quoted strings. 5488sed_quote_subst='$sed_quote_subst' 5489 5490# Be Bourne compatible 5491if test -n \"\${ZSH_VERSION+set}\" && (emulate sh) >/dev/null 2>&1; then 5492 emulate sh 5493 NULLCMD=: 5494 # Zsh 3.x and 4.x performs word splitting on \${1+\"\$@\"}, which 5495 # is contrary to our usage. Disable this feature. 5496 alias -g '\${1+\"\$@\"}'='\"\$@\"' 5497 setopt NO_GLOB_SUBST 5498else 5499 case \`(set -o) 2>/dev/null\` in *posix*) set -o posix;; esac 5500fi 5501BIN_SH=xpg4; export BIN_SH # for Tru64 5502DUALCASE=1; export DUALCASE # for MKS sh 5503 5504# The HP-UX ksh and POSIX shell print the target directory to stdout 5505# if CDPATH is set. 5506(unset CDPATH) >/dev/null 2>&1 && unset CDPATH 5507 5508relink_command=\"$relink_command\" 5509 5510# This environment variable determines our operation mode. 5511if test \"\$libtool_install_magic\" = \"$magic\"; then 5512 # install mode needs the following variables: 5513 generated_by_libtool_version='$macro_version' 5514 notinst_deplibs='$notinst_deplibs' 5515else 5516 # When we are sourced in execute mode, \$file and \$ECHO are already set. 5517 if test \"\$libtool_execute_magic\" != \"$magic\"; then 5518 file=\"\$0\"" 5519 5520 func_quote_arg pretty "$ECHO" 5521 qECHO=$func_quote_arg_result 5522 $ECHO "\ 5523 5524# A function that is used when there is no print builtin or printf. 5525func_fallback_echo () 5526{ 5527 eval 'cat <<_LTECHO_EOF 5528\$1 5529_LTECHO_EOF' 5530} 5531 ECHO=$qECHO 5532 fi 5533 5534# Very basic option parsing. These options are (a) specific to 5535# the libtool wrapper, (b) are identical between the wrapper 5536# /script/ and the wrapper /executable/ that is used only on 5537# windows platforms, and (c) all begin with the string "--lt-" 5538# (application programs are unlikely to have options that match 5539# this pattern). 5540# 5541# There are only two supported options: --lt-debug and 5542# --lt-dump-script. There is, deliberately, no --lt-help. 5543# 5544# The first argument to this parsing function should be the 5545# script's $0 value, followed by "$@". 5546lt_option_debug= 5547func_parse_lt_options () 5548{ 5549 lt_script_arg0=\$0 5550 shift 5551 for lt_opt 5552 do 5553 case \"\$lt_opt\" in 5554 --lt-debug) lt_option_debug=1 ;; 5555 --lt-dump-script) 5556 lt_dump_D=\`\$ECHO \"X\$lt_script_arg0\" | $SED -e 's/^X//' -e 's%/[^/]*$%%'\` 5557 test \"X\$lt_dump_D\" = \"X\$lt_script_arg0\" && lt_dump_D=. 5558 lt_dump_F=\`\$ECHO \"X\$lt_script_arg0\" | $SED -e 's/^X//' -e 's%^.*/%%'\` 5559 cat \"\$lt_dump_D/\$lt_dump_F\" 5560 exit 0 5561 ;; 5562 --lt-*) 5563 \$ECHO \"Unrecognized --lt- option: '\$lt_opt'\" 1>&2 5564 exit 1 5565 ;; 5566 esac 5567 done 5568 5569 # Print the debug banner immediately: 5570 if test -n \"\$lt_option_debug\"; then 5571 echo \"$outputname:$output:\$LINENO: libtool wrapper (GNU $PACKAGE) $VERSION\" 1>&2 5572 fi 5573} 5574 5575# Used when --lt-debug. Prints its arguments to stdout 5576# (redirection is the responsibility of the caller) 5577func_lt_dump_args () 5578{ 5579 lt_dump_args_N=1; 5580 for lt_arg 5581 do 5582 \$ECHO \"$outputname:$output:\$LINENO: newargv[\$lt_dump_args_N]: \$lt_arg\" 5583 lt_dump_args_N=\`expr \$lt_dump_args_N + 1\` 5584 done 5585} 5586 5587# Core function for launching the target application 5588func_exec_program_core () 5589{ 5590" 5591 case $host in 5592 # Backslashes separate directories on plain windows 5593 *-*-mingw | *-*-os2* | *-cegcc*) 5594 $ECHO "\ 5595 if test -n \"\$lt_option_debug\"; then 5596 \$ECHO \"$outputname:$output:\$LINENO: newargv[0]: \$progdir\\\\\$program\" 1>&2 5597 func_lt_dump_args \${1+\"\$@\"} 1>&2 5598 fi 5599 exec \"\$progdir\\\\\$program\" \${1+\"\$@\"} 5600" 5601 ;; 5602 5603 *) 5604 $ECHO "\ 5605 if test -n \"\$lt_option_debug\"; then 5606 \$ECHO \"$outputname:$output:\$LINENO: newargv[0]: \$progdir/\$program\" 1>&2 5607 func_lt_dump_args \${1+\"\$@\"} 1>&2 5608 fi 5609 exec \"\$progdir/\$program\" \${1+\"\$@\"} 5610" 5611 ;; 5612 esac 5613 $ECHO "\ 5614 \$ECHO \"\$0: cannot exec \$program \$*\" 1>&2 5615 exit 1 5616} 5617 5618# A function to encapsulate launching the target application 5619# Strips options in the --lt-* namespace from \$@ and 5620# launches target application with the remaining arguments. 5621func_exec_program () 5622{ 5623 case \" \$* \" in 5624 *\\ --lt-*) 5625 for lt_wr_arg 5626 do 5627 case \$lt_wr_arg in 5628 --lt-*) ;; 5629 *) set x \"\$@\" \"\$lt_wr_arg\"; shift;; 5630 esac 5631 shift 5632 done ;; 5633 esac 5634 func_exec_program_core \${1+\"\$@\"} 5635} 5636 5637 # Parse options 5638 func_parse_lt_options \"\$0\" \${1+\"\$@\"} 5639 5640 # Find the directory that this script lives in. 5641 thisdir=\`\$ECHO \"\$file\" | $SED 's%/[^/]*$%%'\` 5642 test \"x\$thisdir\" = \"x\$file\" && thisdir=. 5643 5644 # Follow symbolic links until we get to the real thisdir. 5645 file=\`ls -ld \"\$file\" | $SED -n 's/.*-> //p'\` 5646 while test -n \"\$file\"; do 5647 destdir=\`\$ECHO \"\$file\" | $SED 's%/[^/]*\$%%'\` 5648 5649 # If there was a directory component, then change thisdir. 5650 if test \"x\$destdir\" != \"x\$file\"; then 5651 case \"\$destdir\" in 5652 [\\\\/]* | [A-Za-z]:[\\\\/]*) thisdir=\"\$destdir\" ;; 5653 *) thisdir=\"\$thisdir/\$destdir\" ;; 5654 esac 5655 fi 5656 5657 file=\`\$ECHO \"\$file\" | $SED 's%^.*/%%'\` 5658 file=\`ls -ld \"\$thisdir/\$file\" | $SED -n 's/.*-> //p'\` 5659 done 5660 5661 # Usually 'no', except on cygwin/mingw when embedded into 5662 # the cwrapper. 5663 WRAPPER_SCRIPT_BELONGS_IN_OBJDIR=$func_emit_wrapper_arg1 5664 if test \"\$WRAPPER_SCRIPT_BELONGS_IN_OBJDIR\" = \"yes\"; then 5665 # special case for '.' 5666 if test \"\$thisdir\" = \".\"; then 5667 thisdir=\`pwd\` 5668 fi 5669 # remove .libs from thisdir 5670 case \"\$thisdir\" in 5671 *[\\\\/]$objdir ) thisdir=\`\$ECHO \"\$thisdir\" | $SED 's%[\\\\/][^\\\\/]*$%%'\` ;; 5672 $objdir ) thisdir=. ;; 5673 esac 5674 fi 5675 5676 # Try to get the absolute directory name. 5677 absdir=\`cd \"\$thisdir\" && pwd\` 5678 test -n \"\$absdir\" && thisdir=\"\$absdir\" 5679" 5680 5681 if test yes = "$fast_install"; then 5682 $ECHO "\ 5683 program=lt-'$outputname'$exeext 5684 progdir=\"\$thisdir/$objdir\" 5685 5686 if test ! -f \"\$progdir/\$program\" || 5687 { file=\`ls -1dt \"\$progdir/\$program\" \"\$progdir/../\$program\" 2>/dev/null | $SED 1q\`; \\ 5688 test \"X\$file\" != \"X\$progdir/\$program\"; }; then 5689 5690 file=\"\$\$-\$program\" 5691 5692 if test ! -d \"\$progdir\"; then 5693 $MKDIR \"\$progdir\" 5694 else 5695 $RM \"\$progdir/\$file\" 5696 fi" 5697 5698 $ECHO "\ 5699 5700 # relink executable if necessary 5701 if test -n \"\$relink_command\"; then 5702 if relink_command_output=\`eval \$relink_command 2>&1\`; then : 5703 else 5704 \$ECHO \"\$relink_command_output\" >&2 5705 $RM \"\$progdir/\$file\" 5706 exit 1 5707 fi 5708 fi 5709 5710 $MV \"\$progdir/\$file\" \"\$progdir/\$program\" 2>/dev/null || 5711 { $RM \"\$progdir/\$program\"; 5712 $MV \"\$progdir/\$file\" \"\$progdir/\$program\"; } 5713 $RM \"\$progdir/\$file\" 5714 fi" 5715 else 5716 $ECHO "\ 5717 program='$outputname' 5718 progdir=\"\$thisdir/$objdir\" 5719" 5720 fi 5721 5722 $ECHO "\ 5723 5724 if test -f \"\$progdir/\$program\"; then" 5725 5726 # fixup the dll searchpath if we need to. 5727 # 5728 # Fix the DLL searchpath if we need to. Do this before prepending 5729 # to shlibpath, because on Windows, both are PATH and uninstalled 5730 # libraries must come first. 5731 if test -n "$dllsearchpath"; then 5732 $ECHO "\ 5733 # Add the dll search path components to the executable PATH 5734 PATH=$dllsearchpath:\$PATH 5735" 5736 fi 5737 5738 # Export our shlibpath_var if we have one. 5739 if test yes = "$shlibpath_overrides_runpath" && test -n "$shlibpath_var" && test -n "$temp_rpath"; then 5740 $ECHO "\ 5741 # Add our own library path to $shlibpath_var 5742 $shlibpath_var=\"$temp_rpath\$$shlibpath_var\" 5743 5744 # Some systems cannot cope with colon-terminated $shlibpath_var 5745 # The second colon is a workaround for a bug in BeOS R4 sed 5746 $shlibpath_var=\`\$ECHO \"\$$shlibpath_var\" | $SED 's/::*\$//'\` 5747 5748 export $shlibpath_var 5749" 5750 fi 5751 5752 $ECHO "\ 5753 if test \"\$libtool_execute_magic\" != \"$magic\"; then 5754 # Run the actual program with our arguments. 5755 func_exec_program \${1+\"\$@\"} 5756 fi 5757 else 5758 # The program doesn't exist. 5759 \$ECHO \"\$0: error: '\$progdir/\$program' does not exist\" 1>&2 5760 \$ECHO \"This script is just a wrapper for \$program.\" 1>&2 5761 \$ECHO \"See the $PACKAGE documentation for more information.\" 1>&2 5762 exit 1 5763 fi 5764fi\ 5765" 5766} 5767 5768 5769# func_emit_cwrapperexe_src 5770# emit the source code for a wrapper executable on stdout 5771# Must ONLY be called from within func_mode_link because 5772# it depends on a number of variable set therein. 5773func_emit_cwrapperexe_src () 5774{ 5775 cat <<EOF 5776 5777/* $cwrappersource - temporary wrapper executable for $objdir/$outputname 5778 Generated by $PROGRAM (GNU $PACKAGE) $VERSION 5779 5780 The $output program cannot be directly executed until all the libtool 5781 libraries that it depends on are installed. 5782 5783 This wrapper executable should never be moved out of the build directory. 5784 If it is, it will not operate correctly. 5785*/ 5786EOF 5787 cat <<"EOF" 5788#ifdef _MSC_VER 5789# define _CRT_SECURE_NO_DEPRECATE 1 5790#endif 5791#include <stdio.h> 5792#include <stdlib.h> 5793#ifdef _MSC_VER 5794# include <direct.h> 5795# include <process.h> 5796# include <io.h> 5797#else 5798# include <unistd.h> 5799# include <stdint.h> 5800# ifdef __CYGWIN__ 5801# include <io.h> 5802# endif 5803#endif 5804#include <malloc.h> 5805#include <stdarg.h> 5806#include <assert.h> 5807#include <string.h> 5808#include <ctype.h> 5809#include <errno.h> 5810#include <fcntl.h> 5811#include <sys/stat.h> 5812 5813#define STREQ(s1, s2) (strcmp ((s1), (s2)) == 0) 5814 5815/* declarations of non-ANSI functions */ 5816#if defined __MINGW32__ 5817# ifdef __STRICT_ANSI__ 5818int _putenv (const char *); 5819# endif 5820#elif defined __CYGWIN__ 5821# ifdef __STRICT_ANSI__ 5822char *realpath (const char *, char *); 5823int putenv (char *); 5824int setenv (const char *, const char *, int); 5825# endif 5826/* #elif defined other_platform || defined ... */ 5827#endif 5828 5829/* portability defines, excluding path handling macros */ 5830#if defined _MSC_VER 5831# define setmode _setmode 5832# define stat _stat 5833# define chmod _chmod 5834# define getcwd _getcwd 5835# define putenv _putenv 5836# define S_IXUSR _S_IEXEC 5837#elif defined __MINGW32__ 5838# define setmode _setmode 5839# define stat _stat 5840# define chmod _chmod 5841# define getcwd _getcwd 5842# define putenv _putenv 5843#elif defined __CYGWIN__ 5844# define HAVE_SETENV 5845# define FOPEN_WB "wb" 5846/* #elif defined other platforms ... */ 5847#endif 5848 5849#if defined PATH_MAX 5850# define LT_PATHMAX PATH_MAX 5851#elif defined MAXPATHLEN 5852# define LT_PATHMAX MAXPATHLEN 5853#else 5854# define LT_PATHMAX 1024 5855#endif 5856 5857#ifndef S_IXOTH 5858# define S_IXOTH 0 5859#endif 5860#ifndef S_IXGRP 5861# define S_IXGRP 0 5862#endif 5863 5864/* path handling portability macros */ 5865#ifndef DIR_SEPARATOR 5866# define DIR_SEPARATOR '/' 5867# define PATH_SEPARATOR ':' 5868#endif 5869 5870#if defined _WIN32 || defined __MSDOS__ || defined __DJGPP__ || \ 5871 defined __OS2__ 5872# define HAVE_DOS_BASED_FILE_SYSTEM 5873# define FOPEN_WB "wb" 5874# ifndef DIR_SEPARATOR_2 5875# define DIR_SEPARATOR_2 '\\' 5876# endif 5877# ifndef PATH_SEPARATOR_2 5878# define PATH_SEPARATOR_2 ';' 5879# endif 5880#endif 5881 5882#ifndef DIR_SEPARATOR_2 5883# define IS_DIR_SEPARATOR(ch) ((ch) == DIR_SEPARATOR) 5884#else /* DIR_SEPARATOR_2 */ 5885# define IS_DIR_SEPARATOR(ch) \ 5886 (((ch) == DIR_SEPARATOR) || ((ch) == DIR_SEPARATOR_2)) 5887#endif /* DIR_SEPARATOR_2 */ 5888 5889#ifndef PATH_SEPARATOR_2 5890# define IS_PATH_SEPARATOR(ch) ((ch) == PATH_SEPARATOR) 5891#else /* PATH_SEPARATOR_2 */ 5892# define IS_PATH_SEPARATOR(ch) ((ch) == PATH_SEPARATOR_2) 5893#endif /* PATH_SEPARATOR_2 */ 5894 5895#ifndef FOPEN_WB 5896# define FOPEN_WB "w" 5897#endif 5898#ifndef _O_BINARY 5899# define _O_BINARY 0 5900#endif 5901 5902#define XMALLOC(type, num) ((type *) xmalloc ((num) * sizeof(type))) 5903#define XFREE(stale) do { \ 5904 if (stale) { free (stale); stale = 0; } \ 5905} while (0) 5906 5907#if defined LT_DEBUGWRAPPER 5908static int lt_debug = 1; 5909#else 5910static int lt_debug = 0; 5911#endif 5912 5913const char *program_name = "libtool-wrapper"; /* in case xstrdup fails */ 5914 5915void *xmalloc (size_t num); 5916char *xstrdup (const char *string); 5917const char *base_name (const char *name); 5918char *find_executable (const char *wrapper); 5919char *chase_symlinks (const char *pathspec); 5920int make_executable (const char *path); 5921int check_executable (const char *path); 5922char *strendzap (char *str, const char *pat); 5923void lt_debugprintf (const char *file, int line, const char *fmt, ...); 5924void lt_fatal (const char *file, int line, const char *message, ...); 5925static const char *nonnull (const char *s); 5926static const char *nonempty (const char *s); 5927void lt_setenv (const char *name, const char *value); 5928char *lt_extend_str (const char *orig_value, const char *add, int to_end); 5929void lt_update_exe_path (const char *name, const char *value); 5930void lt_update_lib_path (const char *name, const char *value); 5931char **prepare_spawn (char **argv); 5932void lt_dump_script (FILE *f); 5933EOF 5934 5935 cat <<EOF 5936#if __GNUC__ < 4 || (__GNUC__ == 4 && __GNUC_MINOR__ < 5) 5937# define externally_visible volatile 5938#else 5939# define externally_visible __attribute__((externally_visible)) volatile 5940#endif 5941externally_visible const char * MAGIC_EXE = "$magic_exe"; 5942const char * LIB_PATH_VARNAME = "$shlibpath_var"; 5943EOF 5944 5945 if test yes = "$shlibpath_overrides_runpath" && test -n "$shlibpath_var" && test -n "$temp_rpath"; then 5946 func_to_host_path "$temp_rpath" 5947 cat <<EOF 5948const char * LIB_PATH_VALUE = "$func_to_host_path_result"; 5949EOF 5950 else 5951 cat <<"EOF" 5952const char * LIB_PATH_VALUE = ""; 5953EOF 5954 fi 5955 5956 if test -n "$dllsearchpath"; then 5957 func_to_host_path "$dllsearchpath:" 5958 cat <<EOF 5959const char * EXE_PATH_VARNAME = "PATH"; 5960const char * EXE_PATH_VALUE = "$func_to_host_path_result"; 5961EOF 5962 else 5963 cat <<"EOF" 5964const char * EXE_PATH_VARNAME = ""; 5965const char * EXE_PATH_VALUE = ""; 5966EOF 5967 fi 5968 5969 if test yes = "$fast_install"; then 5970 cat <<EOF 5971const char * TARGET_PROGRAM_NAME = "lt-$outputname"; /* hopefully, no .exe */ 5972EOF 5973 else 5974 cat <<EOF 5975const char * TARGET_PROGRAM_NAME = "$outputname"; /* hopefully, no .exe */ 5976EOF 5977 fi 5978 5979 5980 cat <<"EOF" 5981 5982#define LTWRAPPER_OPTION_PREFIX "--lt-" 5983 5984static const char *ltwrapper_option_prefix = LTWRAPPER_OPTION_PREFIX; 5985static const char *dumpscript_opt = LTWRAPPER_OPTION_PREFIX "dump-script"; 5986static const char *debug_opt = LTWRAPPER_OPTION_PREFIX "debug"; 5987 5988int 5989main (int argc, char *argv[]) 5990{ 5991 char **newargz; 5992 int newargc; 5993 char *tmp_pathspec; 5994 char *actual_cwrapper_path; 5995 char *actual_cwrapper_name; 5996 char *target_name; 5997 char *lt_argv_zero; 5998 int rval = 127; 5999 6000 int i; 6001 6002 program_name = (char *) xstrdup (base_name (argv[0])); 6003 newargz = XMALLOC (char *, (size_t) argc + 1); 6004 6005 /* very simple arg parsing; don't want to rely on getopt 6006 * also, copy all non cwrapper options to newargz, except 6007 * argz[0], which is handled differently 6008 */ 6009 newargc=0; 6010 for (i = 1; i < argc; i++) 6011 { 6012 if (STREQ (argv[i], dumpscript_opt)) 6013 { 6014EOF 6015 case $host in 6016 *mingw* | *cygwin* ) 6017 # make stdout use "unix" line endings 6018 echo " setmode(1,_O_BINARY);" 6019 ;; 6020 esac 6021 6022 cat <<"EOF" 6023 lt_dump_script (stdout); 6024 return 0; 6025 } 6026 if (STREQ (argv[i], debug_opt)) 6027 { 6028 lt_debug = 1; 6029 continue; 6030 } 6031 if (STREQ (argv[i], ltwrapper_option_prefix)) 6032 { 6033 /* however, if there is an option in the LTWRAPPER_OPTION_PREFIX 6034 namespace, but it is not one of the ones we know about and 6035 have already dealt with, above (inluding dump-script), then 6036 report an error. Otherwise, targets might begin to believe 6037 they are allowed to use options in the LTWRAPPER_OPTION_PREFIX 6038 namespace. The first time any user complains about this, we'll 6039 need to make LTWRAPPER_OPTION_PREFIX a configure-time option 6040 or a configure.ac-settable value. 6041 */ 6042 lt_fatal (__FILE__, __LINE__, 6043 "unrecognized %s option: '%s'", 6044 ltwrapper_option_prefix, argv[i]); 6045 } 6046 /* otherwise ... */ 6047 newargz[++newargc] = xstrdup (argv[i]); 6048 } 6049 newargz[++newargc] = NULL; 6050 6051EOF 6052 cat <<EOF 6053 /* The GNU banner must be the first non-error debug message */ 6054 lt_debugprintf (__FILE__, __LINE__, "libtool wrapper (GNU $PACKAGE) $VERSION\n"); 6055EOF 6056 cat <<"EOF" 6057 lt_debugprintf (__FILE__, __LINE__, "(main) argv[0]: %s\n", argv[0]); 6058 lt_debugprintf (__FILE__, __LINE__, "(main) program_name: %s\n", program_name); 6059 6060 tmp_pathspec = find_executable (argv[0]); 6061 if (tmp_pathspec == NULL) 6062 lt_fatal (__FILE__, __LINE__, "couldn't find %s", argv[0]); 6063 lt_debugprintf (__FILE__, __LINE__, 6064 "(main) found exe (before symlink chase) at: %s\n", 6065 tmp_pathspec); 6066 6067 actual_cwrapper_path = chase_symlinks (tmp_pathspec); 6068 lt_debugprintf (__FILE__, __LINE__, 6069 "(main) found exe (after symlink chase) at: %s\n", 6070 actual_cwrapper_path); 6071 XFREE (tmp_pathspec); 6072 6073 actual_cwrapper_name = xstrdup (base_name (actual_cwrapper_path)); 6074 strendzap (actual_cwrapper_path, actual_cwrapper_name); 6075 6076 /* wrapper name transforms */ 6077 strendzap (actual_cwrapper_name, ".exe"); 6078 tmp_pathspec = lt_extend_str (actual_cwrapper_name, ".exe", 1); 6079 XFREE (actual_cwrapper_name); 6080 actual_cwrapper_name = tmp_pathspec; 6081 tmp_pathspec = 0; 6082 6083 /* target_name transforms -- use actual target program name; might have lt- prefix */ 6084 target_name = xstrdup (base_name (TARGET_PROGRAM_NAME)); 6085 strendzap (target_name, ".exe"); 6086 tmp_pathspec = lt_extend_str (target_name, ".exe", 1); 6087 XFREE (target_name); 6088 target_name = tmp_pathspec; 6089 tmp_pathspec = 0; 6090 6091 lt_debugprintf (__FILE__, __LINE__, 6092 "(main) libtool target name: %s\n", 6093 target_name); 6094EOF 6095 6096 cat <<EOF 6097 newargz[0] = 6098 XMALLOC (char, (strlen (actual_cwrapper_path) + 6099 strlen ("$objdir") + 1 + strlen (actual_cwrapper_name) + 1)); 6100 strcpy (newargz[0], actual_cwrapper_path); 6101 strcat (newargz[0], "$objdir"); 6102 strcat (newargz[0], "/"); 6103EOF 6104 6105 cat <<"EOF" 6106 /* stop here, and copy so we don't have to do this twice */ 6107 tmp_pathspec = xstrdup (newargz[0]); 6108 6109 /* do NOT want the lt- prefix here, so use actual_cwrapper_name */ 6110 strcat (newargz[0], actual_cwrapper_name); 6111 6112 /* DO want the lt- prefix here if it exists, so use target_name */ 6113 lt_argv_zero = lt_extend_str (tmp_pathspec, target_name, 1); 6114 XFREE (tmp_pathspec); 6115 tmp_pathspec = NULL; 6116EOF 6117 6118 case $host_os in 6119 mingw*) 6120 cat <<"EOF" 6121 { 6122 char* p; 6123 while ((p = strchr (newargz[0], '\\')) != NULL) 6124 { 6125 *p = '/'; 6126 } 6127 while ((p = strchr (lt_argv_zero, '\\')) != NULL) 6128 { 6129 *p = '/'; 6130 } 6131 } 6132EOF 6133 ;; 6134 esac 6135 6136 cat <<"EOF" 6137 XFREE (target_name); 6138 XFREE (actual_cwrapper_path); 6139 XFREE (actual_cwrapper_name); 6140 6141 lt_setenv ("BIN_SH", "xpg4"); /* for Tru64 */ 6142 lt_setenv ("DUALCASE", "1"); /* for MSK sh */ 6143 /* Update the DLL searchpath. EXE_PATH_VALUE ($dllsearchpath) must 6144 be prepended before (that is, appear after) LIB_PATH_VALUE ($temp_rpath) 6145 because on Windows, both *_VARNAMEs are PATH but uninstalled 6146 libraries must come first. */ 6147 lt_update_exe_path (EXE_PATH_VARNAME, EXE_PATH_VALUE); 6148 lt_update_lib_path (LIB_PATH_VARNAME, LIB_PATH_VALUE); 6149 6150 lt_debugprintf (__FILE__, __LINE__, "(main) lt_argv_zero: %s\n", 6151 nonnull (lt_argv_zero)); 6152 for (i = 0; i < newargc; i++) 6153 { 6154 lt_debugprintf (__FILE__, __LINE__, "(main) newargz[%d]: %s\n", 6155 i, nonnull (newargz[i])); 6156 } 6157 6158EOF 6159 6160 case $host_os in 6161 mingw*) 6162 cat <<"EOF" 6163 /* execv doesn't actually work on mingw as expected on unix */ 6164 newargz = prepare_spawn (newargz); 6165 rval = (int) _spawnv (_P_WAIT, lt_argv_zero, (const char * const *) newargz); 6166 if (rval == -1) 6167 { 6168 /* failed to start process */ 6169 lt_debugprintf (__FILE__, __LINE__, 6170 "(main) failed to launch target \"%s\": %s\n", 6171 lt_argv_zero, nonnull (strerror (errno))); 6172 return 127; 6173 } 6174 return rval; 6175EOF 6176 ;; 6177 *) 6178 cat <<"EOF" 6179 execv (lt_argv_zero, newargz); 6180 return rval; /* =127, but avoids unused variable warning */ 6181EOF 6182 ;; 6183 esac 6184 6185 cat <<"EOF" 6186} 6187 6188void * 6189xmalloc (size_t num) 6190{ 6191 void *p = (void *) malloc (num); 6192 if (!p) 6193 lt_fatal (__FILE__, __LINE__, "memory exhausted"); 6194 6195 return p; 6196} 6197 6198char * 6199xstrdup (const char *string) 6200{ 6201 return string ? strcpy ((char *) xmalloc (strlen (string) + 1), 6202 string) : NULL; 6203} 6204 6205const char * 6206base_name (const char *name) 6207{ 6208 const char *base; 6209 6210#if defined HAVE_DOS_BASED_FILE_SYSTEM 6211 /* Skip over the disk name in MSDOS pathnames. */ 6212 if (isalpha ((unsigned char) name[0]) && name[1] == ':') 6213 name += 2; 6214#endif 6215 6216 for (base = name; *name; name++) 6217 if (IS_DIR_SEPARATOR (*name)) 6218 base = name + 1; 6219 return base; 6220} 6221 6222int 6223check_executable (const char *path) 6224{ 6225 struct stat st; 6226 6227 lt_debugprintf (__FILE__, __LINE__, "(check_executable): %s\n", 6228 nonempty (path)); 6229 if ((!path) || (!*path)) 6230 return 0; 6231 6232 if ((stat (path, &st) >= 0) 6233 && (st.st_mode & (S_IXUSR | S_IXGRP | S_IXOTH))) 6234 return 1; 6235 else 6236 return 0; 6237} 6238 6239int 6240make_executable (const char *path) 6241{ 6242 int rval = 0; 6243 struct stat st; 6244 6245 lt_debugprintf (__FILE__, __LINE__, "(make_executable): %s\n", 6246 nonempty (path)); 6247 if ((!path) || (!*path)) 6248 return 0; 6249 6250 if (stat (path, &st) >= 0) 6251 { 6252 rval = chmod (path, st.st_mode | S_IXOTH | S_IXGRP | S_IXUSR); 6253 } 6254 return rval; 6255} 6256 6257/* Searches for the full path of the wrapper. Returns 6258 newly allocated full path name if found, NULL otherwise 6259 Does not chase symlinks, even on platforms that support them. 6260*/ 6261char * 6262find_executable (const char *wrapper) 6263{ 6264 int has_slash = 0; 6265 const char *p; 6266 const char *p_next; 6267 /* static buffer for getcwd */ 6268 char tmp[LT_PATHMAX + 1]; 6269 size_t tmp_len; 6270 char *concat_name; 6271 6272 lt_debugprintf (__FILE__, __LINE__, "(find_executable): %s\n", 6273 nonempty (wrapper)); 6274 6275 if ((wrapper == NULL) || (*wrapper == '\0')) 6276 return NULL; 6277 6278 /* Absolute path? */ 6279#if defined HAVE_DOS_BASED_FILE_SYSTEM 6280 if (isalpha ((unsigned char) wrapper[0]) && wrapper[1] == ':') 6281 { 6282 concat_name = xstrdup (wrapper); 6283 if (check_executable (concat_name)) 6284 return concat_name; 6285 XFREE (concat_name); 6286 } 6287 else 6288 { 6289#endif 6290 if (IS_DIR_SEPARATOR (wrapper[0])) 6291 { 6292 concat_name = xstrdup (wrapper); 6293 if (check_executable (concat_name)) 6294 return concat_name; 6295 XFREE (concat_name); 6296 } 6297#if defined HAVE_DOS_BASED_FILE_SYSTEM 6298 } 6299#endif 6300 6301 for (p = wrapper; *p; p++) 6302 if (*p == '/') 6303 { 6304 has_slash = 1; 6305 break; 6306 } 6307 if (!has_slash) 6308 { 6309 /* no slashes; search PATH */ 6310 const char *path = getenv ("PATH"); 6311 if (path != NULL) 6312 { 6313 for (p = path; *p; p = p_next) 6314 { 6315 const char *q; 6316 size_t p_len; 6317 for (q = p; *q; q++) 6318 if (IS_PATH_SEPARATOR (*q)) 6319 break; 6320 p_len = (size_t) (q - p); 6321 p_next = (*q == '\0' ? q : q + 1); 6322 if (p_len == 0) 6323 { 6324 /* empty path: current directory */ 6325 if (getcwd (tmp, LT_PATHMAX) == NULL) 6326 lt_fatal (__FILE__, __LINE__, "getcwd failed: %s", 6327 nonnull (strerror (errno))); 6328 tmp_len = strlen (tmp); 6329 concat_name = 6330 XMALLOC (char, tmp_len + 1 + strlen (wrapper) + 1); 6331 memcpy (concat_name, tmp, tmp_len); 6332 concat_name[tmp_len] = '/'; 6333 strcpy (concat_name + tmp_len + 1, wrapper); 6334 } 6335 else 6336 { 6337 concat_name = 6338 XMALLOC (char, p_len + 1 + strlen (wrapper) + 1); 6339 memcpy (concat_name, p, p_len); 6340 concat_name[p_len] = '/'; 6341 strcpy (concat_name + p_len + 1, wrapper); 6342 } 6343 if (check_executable (concat_name)) 6344 return concat_name; 6345 XFREE (concat_name); 6346 } 6347 } 6348 /* not found in PATH; assume curdir */ 6349 } 6350 /* Relative path | not found in path: prepend cwd */ 6351 if (getcwd (tmp, LT_PATHMAX) == NULL) 6352 lt_fatal (__FILE__, __LINE__, "getcwd failed: %s", 6353 nonnull (strerror (errno))); 6354 tmp_len = strlen (tmp); 6355 concat_name = XMALLOC (char, tmp_len + 1 + strlen (wrapper) + 1); 6356 memcpy (concat_name, tmp, tmp_len); 6357 concat_name[tmp_len] = '/'; 6358 strcpy (concat_name + tmp_len + 1, wrapper); 6359 6360 if (check_executable (concat_name)) 6361 return concat_name; 6362 XFREE (concat_name); 6363 return NULL; 6364} 6365 6366char * 6367chase_symlinks (const char *pathspec) 6368{ 6369#ifndef S_ISLNK 6370 return xstrdup (pathspec); 6371#else 6372 char buf[LT_PATHMAX]; 6373 struct stat s; 6374 char *tmp_pathspec = xstrdup (pathspec); 6375 char *p; 6376 int has_symlinks = 0; 6377 while (strlen (tmp_pathspec) && !has_symlinks) 6378 { 6379 lt_debugprintf (__FILE__, __LINE__, 6380 "checking path component for symlinks: %s\n", 6381 tmp_pathspec); 6382 if (lstat (tmp_pathspec, &s) == 0) 6383 { 6384 if (S_ISLNK (s.st_mode) != 0) 6385 { 6386 has_symlinks = 1; 6387 break; 6388 } 6389 6390 /* search backwards for last DIR_SEPARATOR */ 6391 p = tmp_pathspec + strlen (tmp_pathspec) - 1; 6392 while ((p > tmp_pathspec) && (!IS_DIR_SEPARATOR (*p))) 6393 p--; 6394 if ((p == tmp_pathspec) && (!IS_DIR_SEPARATOR (*p))) 6395 { 6396 /* no more DIR_SEPARATORS left */ 6397 break; 6398 } 6399 *p = '\0'; 6400 } 6401 else 6402 { 6403 lt_fatal (__FILE__, __LINE__, 6404 "error accessing file \"%s\": %s", 6405 tmp_pathspec, nonnull (strerror (errno))); 6406 } 6407 } 6408 XFREE (tmp_pathspec); 6409 6410 if (!has_symlinks) 6411 { 6412 return xstrdup (pathspec); 6413 } 6414 6415 tmp_pathspec = realpath (pathspec, buf); 6416 if (tmp_pathspec == 0) 6417 { 6418 lt_fatal (__FILE__, __LINE__, 6419 "could not follow symlinks for %s", pathspec); 6420 } 6421 return xstrdup (tmp_pathspec); 6422#endif 6423} 6424 6425char * 6426strendzap (char *str, const char *pat) 6427{ 6428 size_t len, patlen; 6429 6430 assert (str != NULL); 6431 assert (pat != NULL); 6432 6433 len = strlen (str); 6434 patlen = strlen (pat); 6435 6436 if (patlen <= len) 6437 { 6438 str += len - patlen; 6439 if (STREQ (str, pat)) 6440 *str = '\0'; 6441 } 6442 return str; 6443} 6444 6445void 6446lt_debugprintf (const char *file, int line, const char *fmt, ...) 6447{ 6448 va_list args; 6449 if (lt_debug) 6450 { 6451 (void) fprintf (stderr, "%s:%s:%d: ", program_name, file, line); 6452 va_start (args, fmt); 6453 (void) vfprintf (stderr, fmt, args); 6454 va_end (args); 6455 } 6456} 6457 6458static void 6459lt_error_core (int exit_status, const char *file, 6460 int line, const char *mode, 6461 const char *message, va_list ap) 6462{ 6463 fprintf (stderr, "%s:%s:%d: %s: ", program_name, file, line, mode); 6464 vfprintf (stderr, message, ap); 6465 fprintf (stderr, ".\n"); 6466 6467 if (exit_status >= 0) 6468 exit (exit_status); 6469} 6470 6471void 6472lt_fatal (const char *file, int line, const char *message, ...) 6473{ 6474 va_list ap; 6475 va_start (ap, message); 6476 lt_error_core (EXIT_FAILURE, file, line, "FATAL", message, ap); 6477 va_end (ap); 6478} 6479 6480static const char * 6481nonnull (const char *s) 6482{ 6483 return s ? s : "(null)"; 6484} 6485 6486static const char * 6487nonempty (const char *s) 6488{ 6489 return (s && !*s) ? "(empty)" : nonnull (s); 6490} 6491 6492void 6493lt_setenv (const char *name, const char *value) 6494{ 6495 lt_debugprintf (__FILE__, __LINE__, 6496 "(lt_setenv) setting '%s' to '%s'\n", 6497 nonnull (name), nonnull (value)); 6498 { 6499#ifdef HAVE_SETENV 6500 /* always make a copy, for consistency with !HAVE_SETENV */ 6501 char *str = xstrdup (value); 6502 setenv (name, str, 1); 6503#else 6504 size_t len = strlen (name) + 1 + strlen (value) + 1; 6505 char *str = XMALLOC (char, len); 6506 sprintf (str, "%s=%s", name, value); 6507 if (putenv (str) != EXIT_SUCCESS) 6508 { 6509 XFREE (str); 6510 } 6511#endif 6512 } 6513} 6514 6515char * 6516lt_extend_str (const char *orig_value, const char *add, int to_end) 6517{ 6518 char *new_value; 6519 if (orig_value && *orig_value) 6520 { 6521 size_t orig_value_len = strlen (orig_value); 6522 size_t add_len = strlen (add); 6523 new_value = XMALLOC (char, add_len + orig_value_len + 1); 6524 if (to_end) 6525 { 6526 strcpy (new_value, orig_value); 6527 strcpy (new_value + orig_value_len, add); 6528 } 6529 else 6530 { 6531 strcpy (new_value, add); 6532 strcpy (new_value + add_len, orig_value); 6533 } 6534 } 6535 else 6536 { 6537 new_value = xstrdup (add); 6538 } 6539 return new_value; 6540} 6541 6542void 6543lt_update_exe_path (const char *name, const char *value) 6544{ 6545 lt_debugprintf (__FILE__, __LINE__, 6546 "(lt_update_exe_path) modifying '%s' by prepending '%s'\n", 6547 nonnull (name), nonnull (value)); 6548 6549 if (name && *name && value && *value) 6550 { 6551 char *new_value = lt_extend_str (getenv (name), value, 0); 6552 /* some systems can't cope with a ':'-terminated path #' */ 6553 size_t len = strlen (new_value); 6554 while ((len > 0) && IS_PATH_SEPARATOR (new_value[len-1])) 6555 { 6556 new_value[--len] = '\0'; 6557 } 6558 lt_setenv (name, new_value); 6559 XFREE (new_value); 6560 } 6561} 6562 6563void 6564lt_update_lib_path (const char *name, const char *value) 6565{ 6566 lt_debugprintf (__FILE__, __LINE__, 6567 "(lt_update_lib_path) modifying '%s' by prepending '%s'\n", 6568 nonnull (name), nonnull (value)); 6569 6570 if (name && *name && value && *value) 6571 { 6572 char *new_value = lt_extend_str (getenv (name), value, 0); 6573 lt_setenv (name, new_value); 6574 XFREE (new_value); 6575 } 6576} 6577 6578EOF 6579 case $host_os in 6580 mingw*) 6581 cat <<"EOF" 6582 6583/* Prepares an argument vector before calling spawn(). 6584 Note that spawn() does not by itself call the command interpreter 6585 (getenv ("COMSPEC") != NULL ? getenv ("COMSPEC") : 6586 ({ OSVERSIONINFO v; v.dwOSVersionInfoSize = sizeof(OSVERSIONINFO); 6587 GetVersionEx(&v); 6588 v.dwPlatformId == VER_PLATFORM_WIN32_NT; 6589 }) ? "cmd.exe" : "command.com"). 6590 Instead it simply concatenates the arguments, separated by ' ', and calls 6591 CreateProcess(). We must quote the arguments since Win32 CreateProcess() 6592 interprets characters like ' ', '\t', '\\', '"' (but not '<' and '>') in a 6593 special way: 6594 - Space and tab are interpreted as delimiters. They are not treated as 6595 delimiters if they are surrounded by double quotes: "...". 6596 - Unescaped double quotes are removed from the input. Their only effect is 6597 that within double quotes, space and tab are treated like normal 6598 characters. 6599 - Backslashes not followed by double quotes are not special. 6600 - But 2*n+1 backslashes followed by a double quote become 6601 n backslashes followed by a double quote (n >= 0): 6602 \" -> " 6603 \\\" -> \" 6604 \\\\\" -> \\" 6605 */ 6606#define SHELL_SPECIAL_CHARS "\"\\ \001\002\003\004\005\006\007\010\011\012\013\014\015\016\017\020\021\022\023\024\025\026\027\030\031\032\033\034\035\036\037" 6607#define SHELL_SPACE_CHARS " \001\002\003\004\005\006\007\010\011\012\013\014\015\016\017\020\021\022\023\024\025\026\027\030\031\032\033\034\035\036\037" 6608char ** 6609prepare_spawn (char **argv) 6610{ 6611 size_t argc; 6612 char **new_argv; 6613 size_t i; 6614 6615 /* Count number of arguments. */ 6616 for (argc = 0; argv[argc] != NULL; argc++) 6617 ; 6618 6619 /* Allocate new argument vector. */ 6620 new_argv = XMALLOC (char *, argc + 1); 6621 6622 /* Put quoted arguments into the new argument vector. */ 6623 for (i = 0; i < argc; i++) 6624 { 6625 const char *string = argv[i]; 6626 6627 if (string[0] == '\0') 6628 new_argv[i] = xstrdup ("\"\""); 6629 else if (strpbrk (string, SHELL_SPECIAL_CHARS) != NULL) 6630 { 6631 int quote_around = (strpbrk (string, SHELL_SPACE_CHARS) != NULL); 6632 size_t length; 6633 unsigned int backslashes; 6634 const char *s; 6635 char *quoted_string; 6636 char *p; 6637 6638 length = 0; 6639 backslashes = 0; 6640 if (quote_around) 6641 length++; 6642 for (s = string; *s != '\0'; s++) 6643 { 6644 char c = *s; 6645 if (c == '"') 6646 length += backslashes + 1; 6647 length++; 6648 if (c == '\\') 6649 backslashes++; 6650 else 6651 backslashes = 0; 6652 } 6653 if (quote_around) 6654 length += backslashes + 1; 6655 6656 quoted_string = XMALLOC (char, length + 1); 6657 6658 p = quoted_string; 6659 backslashes = 0; 6660 if (quote_around) 6661 *p++ = '"'; 6662 for (s = string; *s != '\0'; s++) 6663 { 6664 char c = *s; 6665 if (c == '"') 6666 { 6667 unsigned int j; 6668 for (j = backslashes + 1; j > 0; j--) 6669 *p++ = '\\'; 6670 } 6671 *p++ = c; 6672 if (c == '\\') 6673 backslashes++; 6674 else 6675 backslashes = 0; 6676 } 6677 if (quote_around) 6678 { 6679 unsigned int j; 6680 for (j = backslashes; j > 0; j--) 6681 *p++ = '\\'; 6682 *p++ = '"'; 6683 } 6684 *p = '\0'; 6685 6686 new_argv[i] = quoted_string; 6687 } 6688 else 6689 new_argv[i] = (char *) string; 6690 } 6691 new_argv[argc] = NULL; 6692 6693 return new_argv; 6694} 6695EOF 6696 ;; 6697 esac 6698 6699 cat <<"EOF" 6700void lt_dump_script (FILE* f) 6701{ 6702EOF 6703 func_emit_wrapper yes | 6704 $SED -n -e ' 6705s/^\(.\{79\}\)\(..*\)/\1\ 6706\2/ 6707h 6708s/\([\\"]\)/\\\1/g 6709s/$/\\n/ 6710s/\([^\n]*\).*/ fputs ("\1", f);/p 6711g 6712D' 6713 cat <<"EOF" 6714} 6715EOF 6716} 6717# end: func_emit_cwrapperexe_src 6718 6719# func_win32_import_lib_p ARG 6720# True if ARG is an import lib, as indicated by $file_magic_cmd 6721func_win32_import_lib_p () 6722{ 6723 $debug_cmd 6724 6725 case `eval $file_magic_cmd \"\$1\" 2>/dev/null | $SED -e 10q` in 6726 *import*) : ;; 6727 *) false ;; 6728 esac 6729} 6730 6731# func_suncc_cstd_abi 6732# !!ONLY CALL THIS FOR SUN CC AFTER $compile_command IS FULLY EXPANDED!! 6733# Several compiler flags select an ABI that is incompatible with the 6734# Cstd library. Avoid specifying it if any are in CXXFLAGS. 6735func_suncc_cstd_abi () 6736{ 6737 $debug_cmd 6738 6739 case " $compile_command " in 6740 *" -compat=g "*|*\ -std=c++[0-9][0-9]\ *|*" -library=stdcxx4 "*|*" -library=stlport4 "*) 6741 suncc_use_cstd_abi=no 6742 ;; 6743 *) 6744 suncc_use_cstd_abi=yes 6745 ;; 6746 esac 6747} 6748 6749# func_mode_link arg... 6750func_mode_link () 6751{ 6752 $debug_cmd 6753 6754 case $host in 6755 *-*-cygwin* | *-*-mingw* | *-*-pw32* | *-*-os2* | *-cegcc*) 6756 # It is impossible to link a dll without this setting, and 6757 # we shouldn't force the makefile maintainer to figure out 6758 # what system we are compiling for in order to pass an extra 6759 # flag for every libtool invocation. 6760 # allow_undefined=no 6761 6762 # FIXME: Unfortunately, there are problems with the above when trying 6763 # to make a dll that has undefined symbols, in which case not 6764 # even a static library is built. For now, we need to specify 6765 # -no-undefined on the libtool link line when we can be certain 6766 # that all symbols are satisfied, otherwise we get a static library. 6767 allow_undefined=yes 6768 ;; 6769 *) 6770 allow_undefined=yes 6771 ;; 6772 esac 6773 libtool_args=$nonopt 6774 base_compile="$nonopt $@" 6775 compile_command=$nonopt 6776 finalize_command=$nonopt 6777 6778 compile_rpath= 6779 finalize_rpath= 6780 compile_shlibpath= 6781 finalize_shlibpath= 6782 convenience= 6783 old_convenience= 6784 deplibs= 6785 old_deplibs= 6786 compiler_flags= 6787 linker_flags= 6788 dllsearchpath= 6789 lib_search_path=`pwd` 6790 inst_prefix_dir= 6791 new_inherited_linker_flags= 6792 6793 avoid_version=no 6794 bindir= 6795 dlfiles= 6796 dlprefiles= 6797 dlself=no 6798 export_dynamic=no 6799 export_symbols= 6800 export_symbols_regex= 6801 generated= 6802 libobjs= 6803 ltlibs= 6804 module=no 6805 no_install=no 6806 objs= 6807 os2dllname= 6808 non_pic_objects= 6809 precious_files_regex= 6810 prefer_static_libs=no 6811 preload=false 6812 prev= 6813 prevarg= 6814 release= 6815 rpath= 6816 xrpath= 6817 perm_rpath= 6818 temp_rpath= 6819 thread_safe=no 6820 vinfo= 6821 vinfo_number=no 6822 weak_libs= 6823 single_module=$wl-single_module 6824 func_infer_tag $base_compile 6825 6826 # We need to know -static, to get the right output filenames. 6827 for arg 6828 do 6829 case $arg in 6830 -shared) 6831 test yes != "$build_libtool_libs" \ 6832 && func_fatal_configuration "cannot build a shared library" 6833 build_old_libs=no 6834 break 6835 ;; 6836 -all-static | -static | -static-libtool-libs) 6837 case $arg in 6838 -all-static) 6839 if test yes = "$build_libtool_libs" && test -z "$link_static_flag"; then 6840 func_warning "complete static linking is impossible in this configuration" 6841 fi 6842 if test -n "$link_static_flag"; then 6843 dlopen_self=$dlopen_self_static 6844 fi 6845 prefer_static_libs=yes 6846 ;; 6847 -static) 6848 if test -z "$pic_flag" && test -n "$link_static_flag"; then 6849 dlopen_self=$dlopen_self_static 6850 fi 6851 prefer_static_libs=built 6852 ;; 6853 -static-libtool-libs) 6854 if test -z "$pic_flag" && test -n "$link_static_flag"; then 6855 dlopen_self=$dlopen_self_static 6856 fi 6857 prefer_static_libs=yes 6858 ;; 6859 esac 6860 build_libtool_libs=no 6861 build_old_libs=yes 6862 break 6863 ;; 6864 esac 6865 done 6866 6867 # See if our shared archives depend on static archives. 6868 test -n "$old_archive_from_new_cmds" && build_old_libs=yes 6869 6870 # Go through the arguments, transforming them on the way. 6871 while test "$#" -gt 0; do 6872 arg=$1 6873 shift 6874 func_quote_arg pretty,unquoted "$arg" 6875 qarg=$func_quote_arg_unquoted_result 6876 func_append libtool_args " $func_quote_arg_result" 6877 6878 # If the previous option needs an argument, assign it. 6879 if test -n "$prev"; then 6880 case $prev in 6881 output) 6882 func_append compile_command " @OUTPUT@" 6883 func_append finalize_command " @OUTPUT@" 6884 ;; 6885 esac 6886 6887 case $prev in 6888 bindir) 6889 bindir=$arg 6890 prev= 6891 continue 6892 ;; 6893 dlfiles|dlprefiles) 6894 $preload || { 6895 # Add the symbol object into the linking commands. 6896 func_append compile_command " @SYMFILE@" 6897 func_append finalize_command " @SYMFILE@" 6898 preload=: 6899 } 6900 case $arg in 6901 *.la | *.lo) ;; # We handle these cases below. 6902 force) 6903 if test no = "$dlself"; then 6904 dlself=needless 6905 export_dynamic=yes 6906 fi 6907 prev= 6908 continue 6909 ;; 6910 self) 6911 if test dlprefiles = "$prev"; then 6912 dlself=yes 6913 elif test dlfiles = "$prev" && test yes != "$dlopen_self"; then 6914 dlself=yes 6915 else 6916 dlself=needless 6917 export_dynamic=yes 6918 fi 6919 prev= 6920 continue 6921 ;; 6922 *) 6923 if test dlfiles = "$prev"; then 6924 func_append dlfiles " $arg" 6925 else 6926 func_append dlprefiles " $arg" 6927 fi 6928 prev= 6929 continue 6930 ;; 6931 esac 6932 ;; 6933 expsyms) 6934 export_symbols=$arg 6935 test -f "$arg" \ 6936 || func_fatal_error "symbol file '$arg' does not exist" 6937 prev= 6938 continue 6939 ;; 6940 expsyms_regex) 6941 export_symbols_regex=$arg 6942 prev= 6943 continue 6944 ;; 6945 framework) 6946 case $host in 6947 *-*-darwin*) 6948 case "$deplibs " in 6949 *" $qarg.ltframework "*) ;; 6950 *) func_append deplibs " $qarg.ltframework" # this is fixed later 6951 ;; 6952 esac 6953 ;; 6954 esac 6955 prev= 6956 continue 6957 ;; 6958 inst_prefix) 6959 inst_prefix_dir=$arg 6960 prev= 6961 continue 6962 ;; 6963 mllvm) 6964 # Clang does not use LLVM to link, so we can simply discard any 6965 # '-mllvm $arg' options when doing the link step. 6966 prev= 6967 continue 6968 ;; 6969 objectlist) 6970 if test -f "$arg"; then 6971 save_arg=$arg 6972 moreargs= 6973 for fil in `cat "$save_arg"` 6974 do 6975# func_append moreargs " $fil" 6976 arg=$fil 6977 # A libtool-controlled object. 6978 6979 # Check to see that this really is a libtool object. 6980 if func_lalib_unsafe_p "$arg"; then 6981 pic_object= 6982 non_pic_object= 6983 6984 # Read the .lo file 6985 func_source "$arg" 6986 6987 if test -z "$pic_object" || 6988 test -z "$non_pic_object" || 6989 test none = "$pic_object" && 6990 test none = "$non_pic_object"; then 6991 func_fatal_error "cannot find name of object for '$arg'" 6992 fi 6993 6994 # Extract subdirectory from the argument. 6995 func_dirname "$arg" "/" "" 6996 xdir=$func_dirname_result 6997 6998 if test none != "$pic_object"; then 6999 # Prepend the subdirectory the object is found in. 7000 pic_object=$xdir$pic_object 7001 7002 if test dlfiles = "$prev"; then 7003 if test yes = "$build_libtool_libs" && test yes = "$dlopen_support"; then 7004 func_append dlfiles " $pic_object" 7005 prev= 7006 continue 7007 else 7008 # If libtool objects are unsupported, then we need to preload. 7009 prev=dlprefiles 7010 fi 7011 fi 7012 7013 # CHECK ME: I think I busted this. -Ossama 7014 if test dlprefiles = "$prev"; then 7015 # Preload the old-style object. 7016 func_append dlprefiles " $pic_object" 7017 prev= 7018 fi 7019 7020 # A PIC object. 7021 func_append libobjs " $pic_object" 7022 arg=$pic_object 7023 fi 7024 7025 # Non-PIC object. 7026 if test none != "$non_pic_object"; then 7027 # Prepend the subdirectory the object is found in. 7028 non_pic_object=$xdir$non_pic_object 7029 7030 # A standard non-PIC object 7031 func_append non_pic_objects " $non_pic_object" 7032 if test -z "$pic_object" || test none = "$pic_object"; then 7033 arg=$non_pic_object 7034 fi 7035 else 7036 # If the PIC object exists, use it instead. 7037 # $xdir was prepended to $pic_object above. 7038 non_pic_object=$pic_object 7039 func_append non_pic_objects " $non_pic_object" 7040 fi 7041 else 7042 # Only an error if not doing a dry-run. 7043 if $opt_dry_run; then 7044 # Extract subdirectory from the argument. 7045 func_dirname "$arg" "/" "" 7046 xdir=$func_dirname_result 7047 7048 func_lo2o "$arg" 7049 pic_object=$xdir$objdir/$func_lo2o_result 7050 non_pic_object=$xdir$func_lo2o_result 7051 func_append libobjs " $pic_object" 7052 func_append non_pic_objects " $non_pic_object" 7053 else 7054 func_fatal_error "'$arg' is not a valid libtool object" 7055 fi 7056 fi 7057 done 7058 else 7059 func_fatal_error "link input file '$arg' does not exist" 7060 fi 7061 arg=$save_arg 7062 prev= 7063 continue 7064 ;; 7065 os2dllname) 7066 os2dllname=$arg 7067 prev= 7068 continue 7069 ;; 7070 precious_regex) 7071 precious_files_regex=$arg 7072 prev= 7073 continue 7074 ;; 7075 release) 7076 release=-$arg 7077 prev= 7078 continue 7079 ;; 7080 rpath | xrpath) 7081 # We need an absolute path. 7082 case $arg in 7083 [\\/]* | [A-Za-z]:[\\/]*) ;; 7084 *) 7085 func_fatal_error "only absolute run-paths are allowed" 7086 ;; 7087 esac 7088 if test rpath = "$prev"; then 7089 case "$rpath " in 7090 *" $arg "*) ;; 7091 *) func_append rpath " $arg" ;; 7092 esac 7093 else 7094 case "$xrpath " in 7095 *" $arg "*) ;; 7096 *) func_append xrpath " $arg" ;; 7097 esac 7098 fi 7099 prev= 7100 continue 7101 ;; 7102 shrext) 7103 shrext_cmds=$arg 7104 prev= 7105 continue 7106 ;; 7107 weak) 7108 func_append weak_libs " $arg" 7109 prev= 7110 continue 7111 ;; 7112 xassembler) 7113 func_append compiler_flags " -Xassembler $qarg" 7114 prev= 7115 func_append compile_command " -Xassembler $qarg" 7116 func_append finalize_command " -Xassembler $qarg" 7117 continue 7118 ;; 7119 xcclinker) 7120 func_append linker_flags " $qarg" 7121 func_append compiler_flags " $qarg" 7122 prev= 7123 func_append compile_command " $qarg" 7124 func_append finalize_command " $qarg" 7125 continue 7126 ;; 7127 xcompiler) 7128 func_append compiler_flags " $qarg" 7129 prev= 7130 func_append compile_command " $qarg" 7131 func_append finalize_command " $qarg" 7132 continue 7133 ;; 7134 xlinker) 7135 func_append linker_flags " $qarg" 7136 func_append compiler_flags " $wl$qarg" 7137 prev= 7138 func_append compile_command " $wl$qarg" 7139 func_append finalize_command " $wl$qarg" 7140 continue 7141 ;; 7142 *) 7143 eval "$prev=\"\$arg\"" 7144 prev= 7145 continue 7146 ;; 7147 esac 7148 fi # test -n "$prev" 7149 7150 prevarg=$arg 7151 7152 case $arg in 7153 -all-static) 7154 if test -n "$link_static_flag"; then 7155 # See comment for -static flag below, for more details. 7156 func_append compile_command " $link_static_flag" 7157 func_append finalize_command " $link_static_flag" 7158 fi 7159 continue 7160 ;; 7161 7162 -allow-undefined) 7163 # FIXME: remove this flag sometime in the future. 7164 func_fatal_error "'-allow-undefined' must not be used because it is the default" 7165 ;; 7166 7167 -avoid-version) 7168 avoid_version=yes 7169 continue 7170 ;; 7171 7172 -bindir) 7173 prev=bindir 7174 continue 7175 ;; 7176 7177 -dlopen) 7178 prev=dlfiles 7179 continue 7180 ;; 7181 7182 -dlpreopen) 7183 prev=dlprefiles 7184 continue 7185 ;; 7186 7187 -export-dynamic) 7188 export_dynamic=yes 7189 continue 7190 ;; 7191 7192 -export-symbols | -export-symbols-regex) 7193 if test -n "$export_symbols" || test -n "$export_symbols_regex"; then 7194 func_fatal_error "more than one -exported-symbols argument is not allowed" 7195 fi 7196 if test X-export-symbols = "X$arg"; then 7197 prev=expsyms 7198 else 7199 prev=expsyms_regex 7200 fi 7201 continue 7202 ;; 7203 7204 -framework) 7205 prev=framework 7206 continue 7207 ;; 7208 7209 -inst-prefix-dir) 7210 prev=inst_prefix 7211 continue 7212 ;; 7213 7214 # The native IRIX linker understands -LANG:*, -LIST:* and -LNO:* 7215 # so, if we see these flags be careful not to treat them like -L 7216 -L[A-Z][A-Z]*:*) 7217 case $with_gcc/$host in 7218 no/*-*-irix* | /*-*-irix*) 7219 func_append compile_command " $arg" 7220 func_append finalize_command " $arg" 7221 ;; 7222 esac 7223 continue 7224 ;; 7225 7226 -L*) 7227 func_stripname "-L" '' "$arg" 7228 if test -z "$func_stripname_result"; then 7229 if test "$#" -gt 0; then 7230 func_fatal_error "require no space between '-L' and '$1'" 7231 else 7232 func_fatal_error "need path for '-L' option" 7233 fi 7234 fi 7235 func_resolve_sysroot "$func_stripname_result" 7236 dir=$func_resolve_sysroot_result 7237 # We need an absolute path. 7238 case $dir in 7239 [\\/]* | [A-Za-z]:[\\/]*) ;; 7240 *) 7241 absdir=`cd "$dir" && pwd` 7242 test -z "$absdir" && \ 7243 func_fatal_error "cannot determine absolute directory name of '$dir'" 7244 dir=$absdir 7245 ;; 7246 esac 7247 case "$deplibs " in 7248 *" -L$dir "* | *" $arg "*) 7249 # Will only happen for absolute or sysroot arguments 7250 ;; 7251 *) 7252 # Preserve sysroot, but never include relative directories 7253 case $dir in 7254 [\\/]* | [A-Za-z]:[\\/]* | =*) func_append deplibs " $arg" ;; 7255 *) func_append deplibs " -L$dir" ;; 7256 esac 7257 func_append lib_search_path " $dir" 7258 ;; 7259 esac 7260 case $host in 7261 *-*-cygwin* | *-*-mingw* | *-*-pw32* | *-*-os2* | *-cegcc*) 7262 testbindir=`$ECHO "$dir" | $SED 's*/lib$*/bin*'` 7263 case :$dllsearchpath: in 7264 *":$dir:"*) ;; 7265 ::) dllsearchpath=$dir;; 7266 *) func_append dllsearchpath ":$dir";; 7267 esac 7268 case :$dllsearchpath: in 7269 *":$testbindir:"*) ;; 7270 ::) dllsearchpath=$testbindir;; 7271 *) func_append dllsearchpath ":$testbindir";; 7272 esac 7273 ;; 7274 esac 7275 continue 7276 ;; 7277 7278 -l*) 7279 if test X-lc = "X$arg" || test X-lm = "X$arg"; then 7280 case $host in 7281 *-*-cygwin* | *-*-mingw* | *-*-pw32* | *-*-beos* | *-cegcc* | *-*-haiku*) 7282 # These systems don't actually have a C or math library (as such) 7283 continue 7284 ;; 7285 *-*-os2*) 7286 # These systems don't actually have a C library (as such) 7287 test X-lc = "X$arg" && continue 7288 ;; 7289 *-*-openbsd* | *-*-freebsd* | *-*-dragonfly* | *-*-bitrig* | *-*-midnightbsd*) 7290 # Do not include libc due to us having libc/libc_r. 7291 test X-lc = "X$arg" && continue 7292 ;; 7293 *-*-rhapsody* | *-*-darwin1.[012]) 7294 # Rhapsody C and math libraries are in the System framework 7295 func_append deplibs " System.ltframework" 7296 continue 7297 ;; 7298 *-*-sco3.2v5* | *-*-sco5v6*) 7299 # Causes problems with __ctype 7300 test X-lc = "X$arg" && continue 7301 ;; 7302 *-*-sysv4.2uw2* | *-*-sysv5* | *-*-unixware* | *-*-OpenUNIX*) 7303 # Compiler inserts libc in the correct place for threads to work 7304 test X-lc = "X$arg" && continue 7305 ;; 7306 esac 7307 elif test X-lc_r = "X$arg"; then 7308 case $host in 7309 *-*-openbsd* | *-*-freebsd* | *-*-dragonfly* | *-*-bitrig* | *-*-midnightbsd*) 7310 # Do not include libc_r directly, use -pthread flag. 7311 continue 7312 ;; 7313 esac 7314 fi 7315 func_append deplibs " $arg" 7316 continue 7317 ;; 7318 7319 -mllvm) 7320 prev=mllvm 7321 continue 7322 ;; 7323 7324 -module) 7325 module=yes 7326 continue 7327 ;; 7328 7329 # Tru64 UNIX uses -model [arg] to determine the layout of C++ 7330 # classes, name mangling, and exception handling. 7331 # Darwin uses the -arch flag to determine output architecture. 7332 -model|-arch|-isysroot|--sysroot) 7333 func_append compiler_flags " $arg" 7334 func_append compile_command " $arg" 7335 func_append finalize_command " $arg" 7336 prev=xcompiler 7337 continue 7338 ;; 7339 # Solaris ld rejects as of 11.4. Refer to Oracle bug 22985199. 7340 -pthread) 7341 case $host in 7342 *solaris2*) ;; 7343 *) 7344 case "$new_inherited_linker_flags " in 7345 *" $arg "*) ;; 7346 * ) func_append new_inherited_linker_flags " $arg" ;; 7347 esac 7348 ;; 7349 esac 7350 continue 7351 ;; 7352 -mt|-mthreads|-kthread|-Kthread|-pthreads|--thread-safe \ 7353 |-threads|-fopenmp|-openmp|-mp|-xopenmp|-omp|-qsmp=*) 7354 func_append compiler_flags " $arg" 7355 func_append compile_command " $arg" 7356 func_append finalize_command " $arg" 7357 case "$new_inherited_linker_flags " in 7358 *" $arg "*) ;; 7359 * ) func_append new_inherited_linker_flags " $arg" ;; 7360 esac 7361 continue 7362 ;; 7363 7364 -multi_module) 7365 single_module=$wl-multi_module 7366 continue 7367 ;; 7368 7369 -no-fast-install) 7370 fast_install=no 7371 continue 7372 ;; 7373 7374 -no-install) 7375 case $host in 7376 *-*-cygwin* | *-*-mingw* | *-*-pw32* | *-*-os2* | *-*-darwin* | *-cegcc*) 7377 # The PATH hackery in wrapper scripts is required on Windows 7378 # and Darwin in order for the loader to find any dlls it needs. 7379 func_warning "'-no-install' is ignored for $host" 7380 func_warning "assuming '-no-fast-install' instead" 7381 fast_install=no 7382 ;; 7383 *) no_install=yes ;; 7384 esac 7385 continue 7386 ;; 7387 7388 -no-undefined) 7389 allow_undefined=no 7390 continue 7391 ;; 7392 7393 -objectlist) 7394 prev=objectlist 7395 continue 7396 ;; 7397 7398 -os2dllname) 7399 prev=os2dllname 7400 continue 7401 ;; 7402 7403 -o) prev=output ;; 7404 7405 -precious-files-regex) 7406 prev=precious_regex 7407 continue 7408 ;; 7409 7410 -release) 7411 prev=release 7412 continue 7413 ;; 7414 7415 -rpath) 7416 prev=rpath 7417 continue 7418 ;; 7419 7420 -R) 7421 prev=xrpath 7422 continue 7423 ;; 7424 7425 -R*) 7426 func_stripname '-R' '' "$arg" 7427 dir=$func_stripname_result 7428 # We need an absolute path. 7429 case $dir in 7430 [\\/]* | [A-Za-z]:[\\/]*) ;; 7431 =*) 7432 func_stripname '=' '' "$dir" 7433 dir=$lt_sysroot$func_stripname_result 7434 ;; 7435 *) 7436 func_fatal_error "only absolute run-paths are allowed" 7437 ;; 7438 esac 7439 case "$xrpath " in 7440 *" $dir "*) ;; 7441 *) func_append xrpath " $dir" ;; 7442 esac 7443 continue 7444 ;; 7445 7446 -shared) 7447 # The effects of -shared are defined in a previous loop. 7448 continue 7449 ;; 7450 7451 -shrext) 7452 prev=shrext 7453 continue 7454 ;; 7455 7456 -static | -static-libtool-libs) 7457 # The effects of -static are defined in a previous loop. 7458 # We used to do the same as -all-static on platforms that 7459 # didn't have a PIC flag, but the assumption that the effects 7460 # would be equivalent was wrong. It would break on at least 7461 # Digital Unix and AIX. 7462 continue 7463 ;; 7464 7465 -thread-safe) 7466 thread_safe=yes 7467 continue 7468 ;; 7469 7470 -version-info) 7471 prev=vinfo 7472 continue 7473 ;; 7474 7475 -version-number) 7476 prev=vinfo 7477 vinfo_number=yes 7478 continue 7479 ;; 7480 7481 -weak) 7482 prev=weak 7483 continue 7484 ;; 7485 7486 -Wc,*) 7487 func_stripname '-Wc,' '' "$arg" 7488 args=$func_stripname_result 7489 arg= 7490 save_ifs=$IFS; IFS=, 7491 for flag in $args; do 7492 IFS=$save_ifs 7493 func_quote_arg pretty "$flag" 7494 func_append arg " $func_quote_arg_result" 7495 func_append compiler_flags " $func_quote_arg_result" 7496 done 7497 IFS=$save_ifs 7498 func_stripname ' ' '' "$arg" 7499 arg=$func_stripname_result 7500 ;; 7501 7502 -Wl,*) 7503 func_stripname '-Wl,' '' "$arg" 7504 args=$func_stripname_result 7505 arg= 7506 save_ifs=$IFS; IFS=, 7507 for flag in $args; do 7508 IFS=$save_ifs 7509 func_quote_arg pretty "$flag" 7510 func_append arg " $wl$func_quote_arg_result" 7511 func_append compiler_flags " $wl$func_quote_arg_result" 7512 func_append linker_flags " $func_quote_arg_result" 7513 done 7514 IFS=$save_ifs 7515 func_stripname ' ' '' "$arg" 7516 arg=$func_stripname_result 7517 ;; 7518 7519 -Xassembler) 7520 prev=xassembler 7521 continue 7522 ;; 7523 7524 -Xcompiler) 7525 prev=xcompiler 7526 continue 7527 ;; 7528 7529 -Xlinker) 7530 prev=xlinker 7531 continue 7532 ;; 7533 7534 -XCClinker) 7535 prev=xcclinker 7536 continue 7537 ;; 7538 7539 # -msg_* for osf cc 7540 -msg_*) 7541 func_quote_arg pretty "$arg" 7542 arg=$func_quote_arg_result 7543 ;; 7544 7545 # Flags to be passed through unchanged, with rationale: 7546 # -64, -mips[0-9] enable 64-bit mode for the SGI compiler 7547 # -r[0-9][0-9]* specify processor for the SGI compiler 7548 # -xarch=*, -xtarget=* enable 64-bit mode for the Sun compiler 7549 # +DA*, +DD* enable 64-bit mode for the HP compiler 7550 # -q* compiler args for the IBM compiler 7551 # -m*, -t[45]*, -txscale* architecture-specific flags for GCC 7552 # -F/path path to uninstalled frameworks, gcc on darwin 7553 # -p, -pg, --coverage, -fprofile-* profiling flags for GCC 7554 # -fstack-protector* stack protector flags for GCC 7555 # @file GCC response files 7556 # -tp=* Portland pgcc target processor selection 7557 # --sysroot=* for sysroot support 7558 # -O*, -g*, -flto*, -fwhopr*, -fuse-linker-plugin GCC link-time optimization 7559 # -specs=* GCC specs files 7560 # -stdlib=* select c++ std lib with clang 7561 # -fsanitize=* Clang/GCC memory and address sanitizer 7562 # -fuse-ld=* Linker select flags for GCC 7563 # -Wa,* Pass flags directly to the assembler 7564 -64|-mips[0-9]|-r[0-9][0-9]*|-xarch=*|-xtarget=*|+DA*|+DD*|-q*|-m*| \ 7565 -t[45]*|-txscale*|-p|-pg|--coverage|-fprofile-*|-F*|@*|-tp=*|--sysroot=*| \ 7566 -O*|-g*|-flto*|-fwhopr*|-fuse-linker-plugin|-fstack-protector*|-stdlib=*| \ 7567 -specs=*|-fsanitize=*|-fuse-ld=*|-Wa,*) 7568 func_quote_arg pretty "$arg" 7569 arg=$func_quote_arg_result 7570 func_append compile_command " $arg" 7571 func_append finalize_command " $arg" 7572 func_append compiler_flags " $arg" 7573 continue 7574 ;; 7575 7576 -Z*) 7577 if test os2 = "`expr $host : '.*\(os2\)'`"; then 7578 # OS/2 uses -Zxxx to specify OS/2-specific options 7579 compiler_flags="$compiler_flags $arg" 7580 func_append compile_command " $arg" 7581 func_append finalize_command " $arg" 7582 case $arg in 7583 -Zlinker | -Zstack) 7584 prev=xcompiler 7585 ;; 7586 esac 7587 continue 7588 else 7589 # Otherwise treat like 'Some other compiler flag' below 7590 func_quote_arg pretty "$arg" 7591 arg=$func_quote_arg_result 7592 fi 7593 ;; 7594 7595 # Some other compiler flag. 7596 -* | +*) 7597 func_quote_arg pretty "$arg" 7598 arg=$func_quote_arg_result 7599 ;; 7600 7601 *.$objext) 7602 # A standard object. 7603 func_append objs " $arg" 7604 ;; 7605 7606 *.lo) 7607 # A libtool-controlled object. 7608 7609 # Check to see that this really is a libtool object. 7610 if func_lalib_unsafe_p "$arg"; then 7611 pic_object= 7612 non_pic_object= 7613 7614 # Read the .lo file 7615 func_source "$arg" 7616 7617 if test -z "$pic_object" || 7618 test -z "$non_pic_object" || 7619 test none = "$pic_object" && 7620 test none = "$non_pic_object"; then 7621 func_fatal_error "cannot find name of object for '$arg'" 7622 fi 7623 7624 # Extract subdirectory from the argument. 7625 func_dirname "$arg" "/" "" 7626 xdir=$func_dirname_result 7627 7628 test none = "$pic_object" || { 7629 # Prepend the subdirectory the object is found in. 7630 pic_object=$xdir$pic_object 7631 7632 if test dlfiles = "$prev"; then 7633 if test yes = "$build_libtool_libs" && test yes = "$dlopen_support"; then 7634 func_append dlfiles " $pic_object" 7635 prev= 7636 continue 7637 else 7638 # If libtool objects are unsupported, then we need to preload. 7639 prev=dlprefiles 7640 fi 7641 fi 7642 7643 # CHECK ME: I think I busted this. -Ossama 7644 if test dlprefiles = "$prev"; then 7645 # Preload the old-style object. 7646 func_append dlprefiles " $pic_object" 7647 prev= 7648 fi 7649 7650 # A PIC object. 7651 func_append libobjs " $pic_object" 7652 arg=$pic_object 7653 } 7654 7655 # Non-PIC object. 7656 if test none != "$non_pic_object"; then 7657 # Prepend the subdirectory the object is found in. 7658 non_pic_object=$xdir$non_pic_object 7659 7660 # A standard non-PIC object 7661 func_append non_pic_objects " $non_pic_object" 7662 if test -z "$pic_object" || test none = "$pic_object"; then 7663 arg=$non_pic_object 7664 fi 7665 else 7666 # If the PIC object exists, use it instead. 7667 # $xdir was prepended to $pic_object above. 7668 non_pic_object=$pic_object 7669 func_append non_pic_objects " $non_pic_object" 7670 fi 7671 else 7672 # Only an error if not doing a dry-run. 7673 if $opt_dry_run; then 7674 # Extract subdirectory from the argument. 7675 func_dirname "$arg" "/" "" 7676 xdir=$func_dirname_result 7677 7678 func_lo2o "$arg" 7679 pic_object=$xdir$objdir/$func_lo2o_result 7680 non_pic_object=$xdir$func_lo2o_result 7681 func_append libobjs " $pic_object" 7682 func_append non_pic_objects " $non_pic_object" 7683 else 7684 func_fatal_error "'$arg' is not a valid libtool object" 7685 fi 7686 fi 7687 ;; 7688 7689 *.$libext) 7690 # An archive. 7691 func_append deplibs " $arg" 7692 func_append old_deplibs " $arg" 7693 continue 7694 ;; 7695 7696 *.la) 7697 # A libtool-controlled library. 7698 7699 func_resolve_sysroot "$arg" 7700 if test dlfiles = "$prev"; then 7701 # This library was specified with -dlopen. 7702 func_append dlfiles " $func_resolve_sysroot_result" 7703 prev= 7704 elif test dlprefiles = "$prev"; then 7705 # The library was specified with -dlpreopen. 7706 func_append dlprefiles " $func_resolve_sysroot_result" 7707 prev= 7708 else 7709 func_append deplibs " $func_resolve_sysroot_result" 7710 fi 7711 continue 7712 ;; 7713 7714 # Some other compiler argument. 7715 *) 7716 # Unknown arguments in both finalize_command and compile_command need 7717 # to be aesthetically quoted because they are evaled later. 7718 func_quote_arg pretty "$arg" 7719 arg=$func_quote_arg_result 7720 ;; 7721 esac # arg 7722 7723 # Now actually substitute the argument into the commands. 7724 if test -n "$arg"; then 7725 func_append compile_command " $arg" 7726 func_append finalize_command " $arg" 7727 fi 7728 done # argument parsing loop 7729 7730 test -n "$prev" && \ 7731 func_fatal_help "the '$prevarg' option requires an argument" 7732 7733 if test yes = "$export_dynamic" && test -n "$export_dynamic_flag_spec"; then 7734 eval arg=\"$export_dynamic_flag_spec\" 7735 func_append compile_command " $arg" 7736 func_append finalize_command " $arg" 7737 fi 7738 7739 oldlibs= 7740 # calculate the name of the file, without its directory 7741 func_basename "$output" 7742 outputname=$func_basename_result 7743 libobjs_save=$libobjs 7744 7745 if test -n "$shlibpath_var"; then 7746 # get the directories listed in $shlibpath_var 7747 eval shlib_search_path=\`\$ECHO \"\$$shlibpath_var\" \| \$SED \'s/:/ /g\'\` 7748 else 7749 shlib_search_path= 7750 fi 7751 eval sys_lib_search_path=\"$sys_lib_search_path_spec\" 7752 eval sys_lib_dlsearch_path=\"$sys_lib_dlsearch_path_spec\" 7753 7754 # Definition is injected by LT_CONFIG during libtool generation. 7755 func_munge_path_list sys_lib_dlsearch_path "$LT_SYS_LIBRARY_PATH" 7756 7757 func_dirname "$output" "/" "" 7758 output_objdir=$func_dirname_result$objdir 7759 func_to_tool_file "$output_objdir/" 7760 tool_output_objdir=$func_to_tool_file_result 7761 # Create the object directory. 7762 func_mkdir_p "$output_objdir" 7763 7764 # Determine the type of output 7765 case $output in 7766 "") 7767 func_fatal_help "you must specify an output file" 7768 ;; 7769 *.$libext) linkmode=oldlib ;; 7770 *.lo | *.$objext) linkmode=obj ;; 7771 *.la) linkmode=lib ;; 7772 *) linkmode=prog ;; # Anything else should be a program. 7773 esac 7774 7775 specialdeplibs= 7776 7777 libs= 7778 # Find all interdependent deplibs by searching for libraries 7779 # that are linked more than once (e.g. -la -lb -la) 7780 for deplib in $deplibs; do 7781 if $opt_preserve_dup_deps; then 7782 case "$libs " in 7783 *" $deplib "*) func_append specialdeplibs " $deplib" ;; 7784 esac 7785 fi 7786 func_append libs " $deplib" 7787 done 7788 7789 if test lib = "$linkmode"; then 7790 libs="$predeps $libs $compiler_lib_search_path $postdeps" 7791 7792 # Compute libraries that are listed more than once in $predeps 7793 # $postdeps and mark them as special (i.e., whose duplicates are 7794 # not to be eliminated). 7795 pre_post_deps= 7796 if $opt_duplicate_compiler_generated_deps; then 7797 for pre_post_dep in $predeps $postdeps; do 7798 case "$pre_post_deps " in 7799 *" $pre_post_dep "*) func_append specialdeplibs " $pre_post_deps" ;; 7800 esac 7801 func_append pre_post_deps " $pre_post_dep" 7802 done 7803 fi 7804 pre_post_deps= 7805 fi 7806 7807 deplibs= 7808 newdependency_libs= 7809 newlib_search_path= 7810 need_relink=no # whether we're linking any uninstalled libtool libraries 7811 notinst_deplibs= # not-installed libtool libraries 7812 notinst_path= # paths that contain not-installed libtool libraries 7813 7814 case $linkmode in 7815 lib) 7816 passes="conv dlpreopen link" 7817 for file in $dlfiles $dlprefiles; do 7818 case $file in 7819 *.la) ;; 7820 *) 7821 func_fatal_help "libraries can '-dlopen' only libtool libraries: $file" 7822 ;; 7823 esac 7824 done 7825 ;; 7826 prog) 7827 compile_deplibs= 7828 finalize_deplibs= 7829 alldeplibs=false 7830 newdlfiles= 7831 newdlprefiles= 7832 passes="conv scan dlopen dlpreopen link" 7833 ;; 7834 *) passes="conv" 7835 ;; 7836 esac 7837 7838 for pass in $passes; do 7839 # The preopen pass in lib mode reverses $deplibs; put it back here 7840 # so that -L comes before libs that need it for instance... 7841 if test lib,link = "$linkmode,$pass"; then 7842 ## FIXME: Find the place where the list is rebuilt in the wrong 7843 ## order, and fix it there properly 7844 tmp_deplibs= 7845 for deplib in $deplibs; do 7846 tmp_deplibs="$deplib $tmp_deplibs" 7847 done 7848 deplibs=$tmp_deplibs 7849 fi 7850 7851 if test lib,link = "$linkmode,$pass" || 7852 test prog,scan = "$linkmode,$pass"; then 7853 libs=$deplibs 7854 deplibs= 7855 fi 7856 if test prog = "$linkmode"; then 7857 case $pass in 7858 dlopen) libs=$dlfiles ;; 7859 dlpreopen) libs=$dlprefiles ;; 7860 link) libs="$deplibs %DEPLIBS% $dependency_libs" ;; 7861 esac 7862 fi 7863 if test lib,dlpreopen = "$linkmode,$pass"; then 7864 # Collect and forward deplibs of preopened libtool libs 7865 for lib in $dlprefiles; do 7866 # Ignore non-libtool-libs 7867 dependency_libs= 7868 func_resolve_sysroot "$lib" 7869 case $lib in 7870 *.la) func_source "$func_resolve_sysroot_result" ;; 7871 esac 7872 7873 # Collect preopened libtool deplibs, except any this library 7874 # has declared as weak libs 7875 for deplib in $dependency_libs; do 7876 func_basename "$deplib" 7877 deplib_base=$func_basename_result 7878 case " $weak_libs " in 7879 *" $deplib_base "*) ;; 7880 *) func_append deplibs " $deplib" ;; 7881 esac 7882 done 7883 done 7884 libs=$dlprefiles 7885 fi 7886 if test dlopen = "$pass"; then 7887 # Collect dlpreopened libraries 7888 save_deplibs=$deplibs 7889 deplibs= 7890 fi 7891 7892 for deplib in $libs; do 7893 lib= 7894 found=false 7895 case $deplib in 7896 -mt|-mthreads|-kthread|-Kthread|-pthread|-pthreads|--thread-safe \ 7897 |-threads|-fopenmp|-openmp|-mp|-xopenmp|-omp|-qsmp=*) 7898 if test prog,link = "$linkmode,$pass"; then 7899 compile_deplibs="$deplib $compile_deplibs" 7900 finalize_deplibs="$deplib $finalize_deplibs" 7901 else 7902 func_append compiler_flags " $deplib" 7903 if test lib = "$linkmode"; then 7904 case "$new_inherited_linker_flags " in 7905 *" $deplib "*) ;; 7906 * ) func_append new_inherited_linker_flags " $deplib" ;; 7907 esac 7908 fi 7909 fi 7910 continue 7911 ;; 7912 -l*) 7913 if test lib != "$linkmode" && test prog != "$linkmode"; then 7914 func_warning "'-l' is ignored for archives/objects" 7915 continue 7916 fi 7917 func_stripname '-l' '' "$deplib" 7918 name=$func_stripname_result 7919 if test lib = "$linkmode"; then 7920 searchdirs="$newlib_search_path $lib_search_path $compiler_lib_search_dirs $sys_lib_search_path $shlib_search_path" 7921 else 7922 searchdirs="$newlib_search_path $lib_search_path $sys_lib_search_path $shlib_search_path" 7923 fi 7924 for searchdir in $searchdirs; do 7925 for search_ext in .la $std_shrext .so .a; do 7926 # Search the libtool library 7927 lib=$searchdir/lib$name$search_ext 7928 if test -f "$lib"; then 7929 if test .la = "$search_ext"; then 7930 found=: 7931 else 7932 found=false 7933 fi 7934 break 2 7935 fi 7936 done 7937 done 7938 if $found; then 7939 # deplib is a libtool library 7940 # If $allow_libtool_libs_with_static_runtimes && $deplib is a stdlib, 7941 # We need to do some special things here, and not later. 7942 if test yes = "$allow_libtool_libs_with_static_runtimes"; then 7943 case " $predeps $postdeps " in 7944 *" $deplib "*) 7945 if func_lalib_p "$lib"; then 7946 library_names= 7947 old_library= 7948 func_source "$lib" 7949 for l in $old_library $library_names; do 7950 ll=$l 7951 done 7952 if test "X$ll" = "X$old_library"; then # only static version available 7953 found=false 7954 func_dirname "$lib" "" "." 7955 ladir=$func_dirname_result 7956 lib=$ladir/$old_library 7957 if test prog,link = "$linkmode,$pass"; then 7958 compile_deplibs="$deplib $compile_deplibs" 7959 finalize_deplibs="$deplib $finalize_deplibs" 7960 else 7961 deplibs="$deplib $deplibs" 7962 test lib = "$linkmode" && newdependency_libs="$deplib $newdependency_libs" 7963 fi 7964 continue 7965 fi 7966 fi 7967 ;; 7968 *) ;; 7969 esac 7970 fi 7971 else 7972 # deplib doesn't seem to be a libtool library 7973 if test prog,link = "$linkmode,$pass"; then 7974 compile_deplibs="$deplib $compile_deplibs" 7975 finalize_deplibs="$deplib $finalize_deplibs" 7976 else 7977 deplibs="$deplib $deplibs" 7978 test lib = "$linkmode" && newdependency_libs="$deplib $newdependency_libs" 7979 fi 7980 continue 7981 fi 7982 ;; # -l 7983 *.ltframework) 7984 if test prog,link = "$linkmode,$pass"; then 7985 compile_deplibs="$deplib $compile_deplibs" 7986 finalize_deplibs="$deplib $finalize_deplibs" 7987 else 7988 deplibs="$deplib $deplibs" 7989 if test lib = "$linkmode"; then 7990 case "$new_inherited_linker_flags " in 7991 *" $deplib "*) ;; 7992 * ) func_append new_inherited_linker_flags " $deplib" ;; 7993 esac 7994 fi 7995 fi 7996 continue 7997 ;; 7998 -L*) 7999 case $linkmode in 8000 lib) 8001 deplibs="$deplib $deplibs" 8002 test conv = "$pass" && continue 8003 newdependency_libs="$deplib $newdependency_libs" 8004 func_stripname '-L' '' "$deplib" 8005 func_resolve_sysroot "$func_stripname_result" 8006 func_append newlib_search_path " $func_resolve_sysroot_result" 8007 ;; 8008 prog) 8009 if test conv = "$pass"; then 8010 deplibs="$deplib $deplibs" 8011 continue 8012 fi 8013 if test scan = "$pass"; then 8014 deplibs="$deplib $deplibs" 8015 else 8016 compile_deplibs="$deplib $compile_deplibs" 8017 finalize_deplibs="$deplib $finalize_deplibs" 8018 fi 8019 func_stripname '-L' '' "$deplib" 8020 func_resolve_sysroot "$func_stripname_result" 8021 func_append newlib_search_path " $func_resolve_sysroot_result" 8022 ;; 8023 *) 8024 func_warning "'-L' is ignored for archives/objects" 8025 ;; 8026 esac # linkmode 8027 continue 8028 ;; # -L 8029 -R*) 8030 if test link = "$pass"; then 8031 func_stripname '-R' '' "$deplib" 8032 func_resolve_sysroot "$func_stripname_result" 8033 dir=$func_resolve_sysroot_result 8034 # Make sure the xrpath contains only unique directories. 8035 case "$xrpath " in 8036 *" $dir "*) ;; 8037 *) func_append xrpath " $dir" ;; 8038 esac 8039 fi 8040 deplibs="$deplib $deplibs" 8041 continue 8042 ;; 8043 *.la) 8044 func_resolve_sysroot "$deplib" 8045 lib=$func_resolve_sysroot_result 8046 ;; 8047 *.$libext) 8048 if test conv = "$pass"; then 8049 deplibs="$deplib $deplibs" 8050 continue 8051 fi 8052 case $linkmode in 8053 lib) 8054 # Linking convenience modules into shared libraries is allowed, 8055 # but linking other static libraries is non-portable. 8056 case " $dlpreconveniencelibs " in 8057 *" $deplib "*) ;; 8058 *) 8059 valid_a_lib=false 8060 case $deplibs_check_method in 8061 match_pattern*) 8062 set dummy $deplibs_check_method; shift 8063 match_pattern_regex=`expr "$deplibs_check_method" : "$1 \(.*\)"` 8064 if eval "\$ECHO \"$deplib\"" 2>/dev/null | $SED 10q \ 8065 | $EGREP "$match_pattern_regex" > /dev/null; then 8066 valid_a_lib=: 8067 fi 8068 ;; 8069 pass_all) 8070 valid_a_lib=: 8071 ;; 8072 esac 8073 if $valid_a_lib; then 8074 echo 8075 $ECHO "*** Warning: Linking the shared library $output against the" 8076 $ECHO "*** static library $deplib is not portable!" 8077 deplibs="$deplib $deplibs" 8078 else 8079 echo 8080 $ECHO "*** Warning: Trying to link with static lib archive $deplib." 8081 echo "*** I have the capability to make that library automatically link in when" 8082 echo "*** you link to this library. But I can only do this if you have a" 8083 echo "*** shared version of the library, which you do not appear to have" 8084 echo "*** because the file extensions .$libext of this argument makes me believe" 8085 echo "*** that it is just a static archive that I should not use here." 8086 fi 8087 ;; 8088 esac 8089 continue 8090 ;; 8091 prog) 8092 if test link != "$pass"; then 8093 deplibs="$deplib $deplibs" 8094 else 8095 compile_deplibs="$deplib $compile_deplibs" 8096 finalize_deplibs="$deplib $finalize_deplibs" 8097 fi 8098 continue 8099 ;; 8100 esac # linkmode 8101 ;; # *.$libext 8102 *.lo | *.$objext) 8103 if test conv = "$pass"; then 8104 deplibs="$deplib $deplibs" 8105 elif test prog = "$linkmode"; then 8106 if test dlpreopen = "$pass" || test yes != "$dlopen_support" || test no = "$build_libtool_libs"; then 8107 # If there is no dlopen support or we're linking statically, 8108 # we need to preload. 8109 func_append newdlprefiles " $deplib" 8110 compile_deplibs="$deplib $compile_deplibs" 8111 finalize_deplibs="$deplib $finalize_deplibs" 8112 else 8113 func_append newdlfiles " $deplib" 8114 fi 8115 fi 8116 continue 8117 ;; 8118 %DEPLIBS%) 8119 alldeplibs=: 8120 continue 8121 ;; 8122 esac # case $deplib 8123 8124 $found || test -f "$lib" \ 8125 || func_fatal_error "cannot find the library '$lib' or unhandled argument '$deplib'" 8126 8127 # Check to see that this really is a libtool archive. 8128 func_lalib_unsafe_p "$lib" \ 8129 || func_fatal_error "'$lib' is not a valid libtool archive" 8130 8131 func_dirname "$lib" "" "." 8132 ladir=$func_dirname_result 8133 8134 dlname= 8135 dlopen= 8136 dlpreopen= 8137 libdir= 8138 library_names= 8139 old_library= 8140 inherited_linker_flags= 8141 # If the library was installed with an old release of libtool, 8142 # it will not redefine variables installed, or shouldnotlink 8143 installed=yes 8144 shouldnotlink=no 8145 avoidtemprpath= 8146 8147 8148 # Read the .la file 8149 func_source "$lib" 8150 8151 # Convert "-framework foo" to "foo.ltframework" 8152 if test -n "$inherited_linker_flags"; then 8153 tmp_inherited_linker_flags=`$ECHO "$inherited_linker_flags" | $SED 's/-framework \([^ $]*\)/\1.ltframework/g'` 8154 for tmp_inherited_linker_flag in $tmp_inherited_linker_flags; do 8155 case " $new_inherited_linker_flags " in 8156 *" $tmp_inherited_linker_flag "*) ;; 8157 *) func_append new_inherited_linker_flags " $tmp_inherited_linker_flag";; 8158 esac 8159 done 8160 fi 8161 dependency_libs=`$ECHO " $dependency_libs" | $SED 's% \([^ $]*\).ltframework% -framework \1%g'` 8162 if test lib,link = "$linkmode,$pass" || 8163 test prog,scan = "$linkmode,$pass" || 8164 { test prog != "$linkmode" && test lib != "$linkmode"; }; then 8165 test -n "$dlopen" && func_append dlfiles " $dlopen" 8166 test -n "$dlpreopen" && func_append dlprefiles " $dlpreopen" 8167 fi 8168 8169 if test conv = "$pass"; then 8170 # Only check for convenience libraries 8171 deplibs="$lib $deplibs" 8172 if test -z "$libdir"; then 8173 if test -z "$old_library"; then 8174 func_fatal_error "cannot find name of link library for '$lib'" 8175 fi 8176 # It is a libtool convenience library, so add in its objects. 8177 func_append convenience " $ladir/$objdir/$old_library" 8178 func_append old_convenience " $ladir/$objdir/$old_library" 8179 elif test prog != "$linkmode" && test lib != "$linkmode"; then 8180 func_fatal_error "'$lib' is not a convenience library" 8181 fi 8182 tmp_libs= 8183 for deplib in $dependency_libs; do 8184 deplibs="$deplib $deplibs" 8185 if $opt_preserve_dup_deps; then 8186 case "$tmp_libs " in 8187 *" $deplib "*) func_append specialdeplibs " $deplib" ;; 8188 esac 8189 fi 8190 func_append tmp_libs " $deplib" 8191 done 8192 continue 8193 fi # $pass = conv 8194 8195 8196 # Get the name of the library we link against. 8197 linklib= 8198 if test -n "$old_library" && 8199 { test yes = "$prefer_static_libs" || 8200 test built,no = "$prefer_static_libs,$installed"; }; then 8201 linklib=$old_library 8202 else 8203 for l in $old_library $library_names; do 8204 linklib=$l 8205 done 8206 fi 8207 if test -z "$linklib"; then 8208 func_fatal_error "cannot find name of link library for '$lib'" 8209 fi 8210 8211 # This library was specified with -dlopen. 8212 if test dlopen = "$pass"; then 8213 test -z "$libdir" \ 8214 && func_fatal_error "cannot -dlopen a convenience library: '$lib'" 8215 if test -z "$dlname" || 8216 test yes != "$dlopen_support" || 8217 test no = "$build_libtool_libs" 8218 then 8219 # If there is no dlname, no dlopen support or we're linking 8220 # statically, we need to preload. We also need to preload any 8221 # dependent libraries so libltdl's deplib preloader doesn't 8222 # bomb out in the load deplibs phase. 8223 func_append dlprefiles " $lib $dependency_libs" 8224 else 8225 func_append newdlfiles " $lib" 8226 fi 8227 continue 8228 fi # $pass = dlopen 8229 8230 # We need an absolute path. 8231 case $ladir in 8232 [\\/]* | [A-Za-z]:[\\/]*) abs_ladir=$ladir ;; 8233 *) 8234 abs_ladir=`cd "$ladir" && pwd` 8235 if test -z "$abs_ladir"; then 8236 func_warning "cannot determine absolute directory name of '$ladir'" 8237 func_warning "passing it literally to the linker, although it might fail" 8238 abs_ladir=$ladir 8239 fi 8240 ;; 8241 esac 8242 func_basename "$lib" 8243 laname=$func_basename_result 8244 8245 # Find the relevant object directory and library name. 8246 if test yes = "$installed"; then 8247 if test ! -f "$lt_sysroot$libdir/$linklib" && test -f "$abs_ladir/$linklib"; then 8248 func_warning "library '$lib' was moved." 8249 dir=$ladir 8250 absdir=$abs_ladir 8251 libdir=$abs_ladir 8252 else 8253 dir=$lt_sysroot$libdir 8254 absdir=$lt_sysroot$libdir 8255 fi 8256 test yes = "$hardcode_automatic" && avoidtemprpath=yes 8257 else 8258 if test ! -f "$ladir/$objdir/$linklib" && test -f "$abs_ladir/$linklib"; then 8259 dir=$ladir 8260 absdir=$abs_ladir 8261 # Remove this search path later 8262 func_append notinst_path " $abs_ladir" 8263 else 8264 dir=$ladir/$objdir 8265 absdir=$abs_ladir/$objdir 8266 # Remove this search path later 8267 func_append notinst_path " $abs_ladir" 8268 fi 8269 fi # $installed = yes 8270 func_stripname 'lib' '.la' "$laname" 8271 name=$func_stripname_result 8272 8273 # This library was specified with -dlpreopen. 8274 if test dlpreopen = "$pass"; then 8275 if test -z "$libdir" && test prog = "$linkmode"; then 8276 func_fatal_error "only libraries may -dlpreopen a convenience library: '$lib'" 8277 fi 8278 case $host in 8279 # special handling for platforms with PE-DLLs. 8280 *cygwin* | *mingw* | *cegcc* ) 8281 # Linker will automatically link against shared library if both 8282 # static and shared are present. Therefore, ensure we extract 8283 # symbols from the import library if a shared library is present 8284 # (otherwise, the dlopen module name will be incorrect). We do 8285 # this by putting the import library name into $newdlprefiles. 8286 # We recover the dlopen module name by 'saving' the la file 8287 # name in a special purpose variable, and (later) extracting the 8288 # dlname from the la file. 8289 if test -n "$dlname"; then 8290 func_tr_sh "$dir/$linklib" 8291 eval "libfile_$func_tr_sh_result=\$abs_ladir/\$laname" 8292 func_append newdlprefiles " $dir/$linklib" 8293 else 8294 func_append newdlprefiles " $dir/$old_library" 8295 # Keep a list of preopened convenience libraries to check 8296 # that they are being used correctly in the link pass. 8297 test -z "$libdir" && \ 8298 func_append dlpreconveniencelibs " $dir/$old_library" 8299 fi 8300 ;; 8301 * ) 8302 # Prefer using a static library (so that no silly _DYNAMIC symbols 8303 # are required to link). 8304 if test -n "$old_library"; then 8305 func_append newdlprefiles " $dir/$old_library" 8306 # Keep a list of preopened convenience libraries to check 8307 # that they are being used correctly in the link pass. 8308 test -z "$libdir" && \ 8309 func_append dlpreconveniencelibs " $dir/$old_library" 8310 # Otherwise, use the dlname, so that lt_dlopen finds it. 8311 elif test -n "$dlname"; then 8312 func_append newdlprefiles " $dir/$dlname" 8313 else 8314 func_append newdlprefiles " $dir/$linklib" 8315 fi 8316 ;; 8317 esac 8318 fi # $pass = dlpreopen 8319 8320 if test -z "$libdir"; then 8321 # Link the convenience library 8322 if test lib = "$linkmode"; then 8323 deplibs="$dir/$old_library $deplibs" 8324 elif test prog,link = "$linkmode,$pass"; then 8325 compile_deplibs="$dir/$old_library $compile_deplibs" 8326 finalize_deplibs="$dir/$old_library $finalize_deplibs" 8327 else 8328 deplibs="$lib $deplibs" # used for prog,scan pass 8329 fi 8330 continue 8331 fi 8332 8333 8334 if test prog = "$linkmode" && test link != "$pass"; then 8335 func_append newlib_search_path " $ladir" 8336 deplibs="$lib $deplibs" 8337 8338 linkalldeplibs=false 8339 if test no != "$link_all_deplibs" || test -z "$library_names" || 8340 test no = "$build_libtool_libs"; then 8341 linkalldeplibs=: 8342 fi 8343 8344 tmp_libs= 8345 for deplib in $dependency_libs; do 8346 case $deplib in 8347 -L*) func_stripname '-L' '' "$deplib" 8348 func_resolve_sysroot "$func_stripname_result" 8349 func_append newlib_search_path " $func_resolve_sysroot_result" 8350 ;; 8351 esac 8352 # Need to link against all dependency_libs? 8353 if $linkalldeplibs; then 8354 deplibs="$deplib $deplibs" 8355 else 8356 # Need to hardcode shared library paths 8357 # or/and link against static libraries 8358 newdependency_libs="$deplib $newdependency_libs" 8359 fi 8360 if $opt_preserve_dup_deps; then 8361 case "$tmp_libs " in 8362 *" $deplib "*) func_append specialdeplibs " $deplib" ;; 8363 esac 8364 fi 8365 func_append tmp_libs " $deplib" 8366 done # for deplib 8367 continue 8368 fi # $linkmode = prog... 8369 8370 if test prog,link = "$linkmode,$pass"; then 8371 if test -n "$library_names" && 8372 { { test no = "$prefer_static_libs" || 8373 test built,yes = "$prefer_static_libs,$installed"; } || 8374 test -z "$old_library"; }; then 8375 # We need to hardcode the library path 8376 if test -n "$shlibpath_var" && test -z "$avoidtemprpath"; then 8377 # Make sure the rpath contains only unique directories. 8378 case $temp_rpath: in 8379 *"$absdir:"*) ;; 8380 *) func_append temp_rpath "$absdir:" ;; 8381 esac 8382 fi 8383 8384 # Hardcode the library path. 8385 # Skip directories that are in the system default run-time 8386 # search path. 8387 case " $sys_lib_dlsearch_path " in 8388 *" $absdir "*) ;; 8389 *) 8390 case "$compile_rpath " in 8391 *" $absdir "*) ;; 8392 *) func_append compile_rpath " $absdir" ;; 8393 esac 8394 ;; 8395 esac 8396 case " $sys_lib_dlsearch_path " in 8397 *" $libdir "*) ;; 8398 *) 8399 case "$finalize_rpath " in 8400 *" $libdir "*) ;; 8401 *) func_append finalize_rpath " $libdir" ;; 8402 esac 8403 ;; 8404 esac 8405 fi # $linkmode,$pass = prog,link... 8406 8407 if $alldeplibs && 8408 { test pass_all = "$deplibs_check_method" || 8409 { test yes = "$build_libtool_libs" && 8410 test -n "$library_names"; }; }; then 8411 # We only need to search for static libraries 8412 continue 8413 fi 8414 fi 8415 8416 link_static=no # Whether the deplib will be linked statically 8417 use_static_libs=$prefer_static_libs 8418 if test built = "$use_static_libs" && test yes = "$installed"; then 8419 use_static_libs=no 8420 fi 8421 if test -n "$library_names" && 8422 { test no = "$use_static_libs" || test -z "$old_library"; }; then 8423 case $host in 8424 *cygwin* | *mingw* | *cegcc* | *os2*) 8425 # No point in relinking DLLs because paths are not encoded 8426 func_append notinst_deplibs " $lib" 8427 need_relink=no 8428 ;; 8429 *) 8430 if test no = "$installed"; then 8431 func_append notinst_deplibs " $lib" 8432 need_relink=yes 8433 fi 8434 ;; 8435 esac 8436 # This is a shared library 8437 8438 # Warn about portability, can't link against -module's on some 8439 # systems (darwin). Don't bleat about dlopened modules though! 8440 dlopenmodule= 8441 for dlpremoduletest in $dlprefiles; do 8442 if test "X$dlpremoduletest" = "X$lib"; then 8443 dlopenmodule=$dlpremoduletest 8444 break 8445 fi 8446 done 8447 if test -z "$dlopenmodule" && test yes = "$shouldnotlink" && test link = "$pass"; then 8448 echo 8449 if test prog = "$linkmode"; then 8450 $ECHO "*** Warning: Linking the executable $output against the loadable module" 8451 else 8452 $ECHO "*** Warning: Linking the shared library $output against the loadable module" 8453 fi 8454 $ECHO "*** $linklib is not portable!" 8455 fi 8456 if test lib = "$linkmode" && 8457 test yes = "$hardcode_into_libs"; then 8458 # Hardcode the library path. 8459 # Skip directories that are in the system default run-time 8460 # search path. 8461 case " $sys_lib_dlsearch_path " in 8462 *" $absdir "*) ;; 8463 *) 8464 case "$compile_rpath " in 8465 *" $absdir "*) ;; 8466 *) func_append compile_rpath " $absdir" ;; 8467 esac 8468 ;; 8469 esac 8470 case " $sys_lib_dlsearch_path " in 8471 *" $libdir "*) ;; 8472 *) 8473 case "$finalize_rpath " in 8474 *" $libdir "*) ;; 8475 *) func_append finalize_rpath " $libdir" ;; 8476 esac 8477 ;; 8478 esac 8479 fi 8480 8481 if test -n "$old_archive_from_expsyms_cmds"; then 8482 # figure out the soname 8483 set dummy $library_names 8484 shift 8485 realname=$1 8486 shift 8487 libname=`eval "\\$ECHO \"$libname_spec\""` 8488 # use dlname if we got it. it's perfectly good, no? 8489 if test -n "$dlname"; then 8490 soname=$dlname 8491 elif test -n "$soname_spec"; then 8492 # bleh windows 8493 case $host in 8494 *cygwin* | mingw* | *cegcc* | *os2*) 8495 func_arith $current - $age 8496 major=$func_arith_result 8497 versuffix=-$major 8498 ;; 8499 esac 8500 eval soname=\"$soname_spec\" 8501 else 8502 soname=$realname 8503 fi 8504 8505 # Make a new name for the extract_expsyms_cmds to use 8506 soroot=$soname 8507 func_basename "$soroot" 8508 soname=$func_basename_result 8509 func_stripname 'lib' '.dll' "$soname" 8510 newlib=libimp-$func_stripname_result.a 8511 8512 # If the library has no export list, then create one now 8513 if test -f "$output_objdir/$soname-def"; then : 8514 else 8515 func_verbose "extracting exported symbol list from '$soname'" 8516 func_execute_cmds "$extract_expsyms_cmds" 'exit $?' 8517 fi 8518 8519 # Create $newlib 8520 if test -f "$output_objdir/$newlib"; then :; else 8521 func_verbose "generating import library for '$soname'" 8522 func_execute_cmds "$old_archive_from_expsyms_cmds" 'exit $?' 8523 fi 8524 # make sure the library variables are pointing to the new library 8525 dir=$output_objdir 8526 linklib=$newlib 8527 fi # test -n "$old_archive_from_expsyms_cmds" 8528 8529 if test prog = "$linkmode" || test relink != "$opt_mode"; then 8530 add_shlibpath= 8531 add_dir= 8532 add= 8533 lib_linked=yes 8534 case $hardcode_action in 8535 immediate | unsupported) 8536 if test no = "$hardcode_direct"; then 8537 add=$dir/$linklib 8538 case $host in 8539 *-*-sco3.2v5.0.[024]*) add_dir=-L$dir ;; 8540 *-*-sysv4*uw2*) add_dir=-L$dir ;; 8541 *-*-sysv5OpenUNIX* | *-*-sysv5UnixWare7.[01].[10]* | \ 8542 *-*-unixware7*) add_dir=-L$dir ;; 8543 *-*-darwin* ) 8544 # if the lib is a (non-dlopened) module then we cannot 8545 # link against it, someone is ignoring the earlier warnings 8546 if /usr/bin/file -L $add 2> /dev/null | 8547 $GREP ": [^:]* bundle" >/dev/null; then 8548 if test "X$dlopenmodule" != "X$lib"; then 8549 $ECHO "*** Warning: lib $linklib is a module, not a shared library" 8550 if test -z "$old_library"; then 8551 echo 8552 echo "*** And there doesn't seem to be a static archive available" 8553 echo "*** The link will probably fail, sorry" 8554 else 8555 add=$dir/$old_library 8556 fi 8557 elif test -n "$old_library"; then 8558 add=$dir/$old_library 8559 fi 8560 fi 8561 esac 8562 elif test no = "$hardcode_minus_L"; then 8563 case $host in 8564 *-*-sunos*) add_shlibpath=$dir ;; 8565 esac 8566 add_dir=-L$dir 8567 add=-l$name 8568 elif test no = "$hardcode_shlibpath_var"; then 8569 add_shlibpath=$dir 8570 add=-l$name 8571 else 8572 lib_linked=no 8573 fi 8574 ;; 8575 relink) 8576 if test yes = "$hardcode_direct" && 8577 test no = "$hardcode_direct_absolute"; then 8578 add=$dir/$linklib 8579 elif test yes = "$hardcode_minus_L"; then 8580 add_dir=-L$absdir 8581 # Try looking first in the location we're being installed to. 8582 if test -n "$inst_prefix_dir"; then 8583 case $libdir in 8584 [\\/]*) 8585 func_append add_dir " -L$inst_prefix_dir$libdir" 8586 ;; 8587 esac 8588 fi 8589 add=-l$name 8590 elif test yes = "$hardcode_shlibpath_var"; then 8591 add_shlibpath=$dir 8592 add=-l$name 8593 else 8594 lib_linked=no 8595 fi 8596 ;; 8597 *) lib_linked=no ;; 8598 esac 8599 8600 if test yes != "$lib_linked"; then 8601 func_fatal_configuration "unsupported hardcode properties" 8602 fi 8603 8604 if test -n "$add_shlibpath"; then 8605 case :$compile_shlibpath: in 8606 *":$add_shlibpath:"*) ;; 8607 *) func_append compile_shlibpath "$add_shlibpath:" ;; 8608 esac 8609 fi 8610 if test prog = "$linkmode"; then 8611 test -n "$add_dir" && compile_deplibs="$add_dir $compile_deplibs" 8612 test -n "$add" && compile_deplibs="$add $compile_deplibs" 8613 else 8614 test -n "$add_dir" && deplibs="$add_dir $deplibs" 8615 test -n "$add" && deplibs="$add $deplibs" 8616 if test yes != "$hardcode_direct" && 8617 test yes != "$hardcode_minus_L" && 8618 test yes = "$hardcode_shlibpath_var"; then 8619 case :$finalize_shlibpath: in 8620 *":$libdir:"*) ;; 8621 *) func_append finalize_shlibpath "$libdir:" ;; 8622 esac 8623 fi 8624 fi 8625 fi 8626 8627 if test prog = "$linkmode" || test relink = "$opt_mode"; then 8628 add_shlibpath= 8629 add_dir= 8630 add= 8631 # Finalize command for both is simple: just hardcode it. 8632 if test yes = "$hardcode_direct" && 8633 test no = "$hardcode_direct_absolute"; then 8634 if test -f "$inst_prefix_dir$libdir/$linklib"; then 8635 add="$inst_prefix_dir$libdir/$linklib" 8636 else 8637 add="$libdir/$linklib" 8638 fi 8639 elif test yes = "$hardcode_minus_L"; then 8640 add_dir=-L$libdir 8641 add=-l$name 8642 elif test yes = "$hardcode_shlibpath_var"; then 8643 case :$finalize_shlibpath: in 8644 *":$libdir:"*) ;; 8645 *) func_append finalize_shlibpath "$libdir:" ;; 8646 esac 8647 add=-l$name 8648 elif test yes = "$hardcode_automatic"; then 8649 if test -n "$inst_prefix_dir" && 8650 test -f "$inst_prefix_dir$libdir/$linklib"; then 8651 add=$inst_prefix_dir$libdir/$linklib 8652 else 8653 add=$libdir/$linklib 8654 fi 8655 else 8656 # We cannot seem to hardcode it, guess we'll fake it. 8657 add_dir=-L$libdir 8658 # Try looking first in the location we're being installed to. 8659 if test -n "$inst_prefix_dir"; then 8660 case $libdir in 8661 [\\/]*) 8662 func_append add_dir " -L$inst_prefix_dir$libdir" 8663 ;; 8664 esac 8665 fi 8666 add=-l$name 8667 fi 8668 8669 if test prog = "$linkmode"; then 8670 test -n "$add_dir" && finalize_deplibs="$add_dir $finalize_deplibs" 8671 test -n "$add" && finalize_deplibs="$add $finalize_deplibs" 8672 else 8673 test -n "$add_dir" && deplibs="$add_dir $deplibs" 8674 test -n "$add" && deplibs="$add $deplibs" 8675 fi 8676 fi 8677 elif test prog = "$linkmode"; then 8678 # Here we assume that one of hardcode_direct or hardcode_minus_L 8679 # is not unsupported. This is valid on all known static and 8680 # shared platforms. 8681 if test unsupported != "$hardcode_direct"; then 8682 test -n "$old_library" && linklib=$old_library 8683 compile_deplibs="$dir/$linklib $compile_deplibs" 8684 finalize_deplibs="$dir/$linklib $finalize_deplibs" 8685 else 8686 compile_deplibs="-l$name -L$dir $compile_deplibs" 8687 finalize_deplibs="-l$name -L$dir $finalize_deplibs" 8688 fi 8689 elif test yes = "$build_libtool_libs"; then 8690 # Not a shared library 8691 if test pass_all != "$deplibs_check_method"; then 8692 # We're trying link a shared library against a static one 8693 # but the system doesn't support it. 8694 8695 # Just print a warning and add the library to dependency_libs so 8696 # that the program can be linked against the static library. 8697 echo 8698 $ECHO "*** Warning: This system cannot link to static lib archive $lib." 8699 echo "*** I have the capability to make that library automatically link in when" 8700 echo "*** you link to this library. But I can only do this if you have a" 8701 echo "*** shared version of the library, which you do not appear to have." 8702 if test yes = "$module"; then 8703 echo "*** But as you try to build a module library, libtool will still create " 8704 echo "*** a static module, that should work as long as the dlopening application" 8705 echo "*** is linked with the -dlopen flag to resolve symbols at runtime." 8706 if test -z "$global_symbol_pipe"; then 8707 echo 8708 echo "*** However, this would only work if libtool was able to extract symbol" 8709 echo "*** lists from a program, using 'nm' or equivalent, but libtool could" 8710 echo "*** not find such a program. So, this module is probably useless." 8711 echo "*** 'nm' from GNU binutils and a full rebuild may help." 8712 fi 8713 if test no = "$build_old_libs"; then 8714 build_libtool_libs=module 8715 build_old_libs=yes 8716 else 8717 build_libtool_libs=no 8718 fi 8719 fi 8720 else 8721 deplibs="$dir/$old_library $deplibs" 8722 link_static=yes 8723 fi 8724 fi # link shared/static library? 8725 8726 if test lib = "$linkmode"; then 8727 if test -n "$dependency_libs" && 8728 { test yes != "$hardcode_into_libs" || 8729 test yes = "$build_old_libs" || 8730 test yes = "$link_static"; }; then 8731 # Extract -R from dependency_libs 8732 temp_deplibs= 8733 for libdir in $dependency_libs; do 8734 case $libdir in 8735 -R*) func_stripname '-R' '' "$libdir" 8736 temp_xrpath=$func_stripname_result 8737 case " $xrpath " in 8738 *" $temp_xrpath "*) ;; 8739 *) func_append xrpath " $temp_xrpath";; 8740 esac;; 8741 *) func_append temp_deplibs " $libdir";; 8742 esac 8743 done 8744 dependency_libs=$temp_deplibs 8745 fi 8746 8747 func_append newlib_search_path " $absdir" 8748 # Link against this library 8749 test no = "$link_static" && newdependency_libs="$abs_ladir/$laname $newdependency_libs" 8750 # ... and its dependency_libs 8751 tmp_libs= 8752 for deplib in $dependency_libs; do 8753 newdependency_libs="$deplib $newdependency_libs" 8754 case $deplib in 8755 -L*) func_stripname '-L' '' "$deplib" 8756 func_resolve_sysroot "$func_stripname_result";; 8757 *) func_resolve_sysroot "$deplib" ;; 8758 esac 8759 if $opt_preserve_dup_deps; then 8760 case "$tmp_libs " in 8761 *" $func_resolve_sysroot_result "*) 8762 func_append specialdeplibs " $func_resolve_sysroot_result" ;; 8763 esac 8764 fi 8765 func_append tmp_libs " $func_resolve_sysroot_result" 8766 done 8767 8768 if test no != "$link_all_deplibs"; then 8769 # Add the search paths of all dependency libraries 8770 for deplib in $dependency_libs; do 8771 path= 8772 case $deplib in 8773 -L*) path=$deplib ;; 8774 *.la) 8775 func_resolve_sysroot "$deplib" 8776 deplib=$func_resolve_sysroot_result 8777 func_dirname "$deplib" "" "." 8778 dir=$func_dirname_result 8779 # We need an absolute path. 8780 case $dir in 8781 [\\/]* | [A-Za-z]:[\\/]*) absdir=$dir ;; 8782 *) 8783 absdir=`cd "$dir" && pwd` 8784 if test -z "$absdir"; then 8785 func_warning "cannot determine absolute directory name of '$dir'" 8786 absdir=$dir 8787 fi 8788 ;; 8789 esac 8790 if $GREP "^installed=no" $deplib > /dev/null; then 8791 case $host in 8792 *-*-darwin*) 8793 depdepl= 8794 eval deplibrary_names=`$SED -n -e 's/^library_names=\(.*\)$/\1/p' $deplib` 8795 if test -n "$deplibrary_names"; then 8796 for tmp in $deplibrary_names; do 8797 depdepl=$tmp 8798 done 8799 if test -f "$absdir/$objdir/$depdepl"; then 8800 depdepl=$absdir/$objdir/$depdepl 8801 darwin_install_name=`$OTOOL -L $depdepl | awk '{if (NR == 2) {print $1;exit}}'` 8802 if test -z "$darwin_install_name"; then 8803 darwin_install_name=`$OTOOL64 -L $depdepl | awk '{if (NR == 2) {print $1;exit}}'` 8804 fi 8805 func_append compiler_flags " $wl-dylib_file $wl$darwin_install_name:$depdepl" 8806 func_append linker_flags " -dylib_file $darwin_install_name:$depdepl" 8807 path= 8808 fi 8809 fi 8810 ;; 8811 *) 8812 path=-L$absdir/$objdir 8813 ;; 8814 esac 8815 else 8816 eval libdir=`$SED -n -e 's/^libdir=\(.*\)$/\1/p' $deplib` 8817 test -z "$libdir" && \ 8818 func_fatal_error "'$deplib' is not a valid libtool archive" 8819 test "$absdir" != "$libdir" && \ 8820 func_warning "'$deplib' seems to be moved" 8821 8822 path=-L$absdir 8823 fi 8824 ;; 8825 esac 8826 case " $deplibs " in 8827 *" $path "*) ;; 8828 *) deplibs="$path $deplibs" ;; 8829 esac 8830 done 8831 fi # link_all_deplibs != no 8832 fi # linkmode = lib 8833 done # for deplib in $libs 8834 if test link = "$pass"; then 8835 if test prog = "$linkmode"; then 8836 compile_deplibs="$new_inherited_linker_flags $compile_deplibs" 8837 finalize_deplibs="$new_inherited_linker_flags $finalize_deplibs" 8838 else 8839 compiler_flags="$compiler_flags "`$ECHO " $new_inherited_linker_flags" | $SED 's% \([^ $]*\).ltframework% -framework \1%g'` 8840 fi 8841 fi 8842 dependency_libs=$newdependency_libs 8843 if test dlpreopen = "$pass"; then 8844 # Link the dlpreopened libraries before other libraries 8845 for deplib in $save_deplibs; do 8846 deplibs="$deplib $deplibs" 8847 done 8848 fi 8849 if test dlopen != "$pass"; then 8850 test conv = "$pass" || { 8851 # Make sure lib_search_path contains only unique directories. 8852 lib_search_path= 8853 for dir in $newlib_search_path; do 8854 case "$lib_search_path " in 8855 *" $dir "*) ;; 8856 *) func_append lib_search_path " $dir" ;; 8857 esac 8858 done 8859 newlib_search_path= 8860 } 8861 8862 if test prog,link = "$linkmode,$pass"; then 8863 vars="compile_deplibs finalize_deplibs" 8864 else 8865 vars=deplibs 8866 fi 8867 for var in $vars dependency_libs; do 8868 # Add libraries to $var in reverse order 8869 eval tmp_libs=\"\$$var\" 8870 new_libs= 8871 for deplib in $tmp_libs; do 8872 # FIXME: Pedantically, this is the right thing to do, so 8873 # that some nasty dependency loop isn't accidentally 8874 # broken: 8875 #new_libs="$deplib $new_libs" 8876 # Pragmatically, this seems to cause very few problems in 8877 # practice: 8878 case $deplib in 8879 -L*) new_libs="$deplib $new_libs" ;; 8880 -R*) ;; 8881 *) 8882 # And here is the reason: when a library appears more 8883 # than once as an explicit dependence of a library, or 8884 # is implicitly linked in more than once by the 8885 # compiler, it is considered special, and multiple 8886 # occurrences thereof are not removed. Compare this 8887 # with having the same library being listed as a 8888 # dependency of multiple other libraries: in this case, 8889 # we know (pedantically, we assume) the library does not 8890 # need to be listed more than once, so we keep only the 8891 # last copy. This is not always right, but it is rare 8892 # enough that we require users that really mean to play 8893 # such unportable linking tricks to link the library 8894 # using -Wl,-lname, so that libtool does not consider it 8895 # for duplicate removal. 8896 case " $specialdeplibs " in 8897 *" $deplib "*) new_libs="$deplib $new_libs" ;; 8898 *) 8899 case " $new_libs " in 8900 *" $deplib "*) ;; 8901 *) new_libs="$deplib $new_libs" ;; 8902 esac 8903 ;; 8904 esac 8905 ;; 8906 esac 8907 done 8908 tmp_libs= 8909 for deplib in $new_libs; do 8910 case $deplib in 8911 -L*) 8912 case " $tmp_libs " in 8913 *" $deplib "*) ;; 8914 *) func_append tmp_libs " $deplib" ;; 8915 esac 8916 ;; 8917 *) func_append tmp_libs " $deplib" ;; 8918 esac 8919 done 8920 eval $var=\"$tmp_libs\" 8921 done # for var 8922 fi 8923 8924 # Add Sun CC postdeps if required: 8925 test CXX = "$tagname" && { 8926 case $host_os in 8927 linux*) 8928 case `$CC -V 2>&1 | $SED 5q` in 8929 *Sun\ C*) # Sun C++ 5.9 8930 func_suncc_cstd_abi 8931 8932 if test no != "$suncc_use_cstd_abi"; then 8933 func_append postdeps ' -library=Cstd -library=Crun' 8934 fi 8935 ;; 8936 esac 8937 ;; 8938 8939 solaris*) 8940 func_cc_basename "$CC" 8941 case $func_cc_basename_result in 8942 CC* | sunCC*) 8943 func_suncc_cstd_abi 8944 8945 if test no != "$suncc_use_cstd_abi"; then 8946 func_append postdeps ' -library=Cstd -library=Crun' 8947 fi 8948 ;; 8949 esac 8950 ;; 8951 esac 8952 } 8953 8954 # Last step: remove runtime libs from dependency_libs 8955 # (they stay in deplibs) 8956 tmp_libs= 8957 for i in $dependency_libs; do 8958 case " $predeps $postdeps $compiler_lib_search_path " in 8959 *" $i "*) 8960 i= 8961 ;; 8962 esac 8963 if test -n "$i"; then 8964 func_append tmp_libs " $i" 8965 fi 8966 done 8967 dependency_libs=$tmp_libs 8968 done # for pass 8969 if test prog = "$linkmode"; then 8970 dlfiles=$newdlfiles 8971 fi 8972 if test prog = "$linkmode" || test lib = "$linkmode"; then 8973 dlprefiles=$newdlprefiles 8974 fi 8975 8976 case $linkmode in 8977 oldlib) 8978 if test -n "$dlfiles$dlprefiles" || test no != "$dlself"; then 8979 func_warning "'-dlopen' is ignored for archives" 8980 fi 8981 8982 case " $deplibs" in 8983 *\ -l* | *\ -L*) 8984 func_warning "'-l' and '-L' are ignored for archives" ;; 8985 esac 8986 8987 test -n "$rpath" && \ 8988 func_warning "'-rpath' is ignored for archives" 8989 8990 test -n "$xrpath" && \ 8991 func_warning "'-R' is ignored for archives" 8992 8993 test -n "$vinfo" && \ 8994 func_warning "'-version-info/-version-number' is ignored for archives" 8995 8996 test -n "$release" && \ 8997 func_warning "'-release' is ignored for archives" 8998 8999 test -n "$export_symbols$export_symbols_regex" && \ 9000 func_warning "'-export-symbols' is ignored for archives" 9001 9002 # Now set the variables for building old libraries. 9003 build_libtool_libs=no 9004 oldlibs=$output 9005 func_append objs "$old_deplibs" 9006 ;; 9007 9008 lib) 9009 # Make sure we only generate libraries of the form 'libNAME.la'. 9010 case $outputname in 9011 lib*) 9012 func_stripname 'lib' '.la' "$outputname" 9013 name=$func_stripname_result 9014 eval shared_ext=\"$shrext_cmds\" 9015 eval libname=\"$libname_spec\" 9016 ;; 9017 *) 9018 test no = "$module" \ 9019 && func_fatal_help "libtool library '$output' must begin with 'lib'" 9020 9021 if test no != "$need_lib_prefix"; then 9022 # Add the "lib" prefix for modules if required 9023 func_stripname '' '.la' "$outputname" 9024 name=$func_stripname_result 9025 eval shared_ext=\"$shrext_cmds\" 9026 eval libname=\"$libname_spec\" 9027 else 9028 func_stripname '' '.la' "$outputname" 9029 libname=$func_stripname_result 9030 fi 9031 ;; 9032 esac 9033 9034 if test -n "$objs"; then 9035 if test pass_all != "$deplibs_check_method"; then 9036 func_fatal_error "cannot build libtool library '$output' from non-libtool objects on this host:$objs" 9037 else 9038 echo 9039 $ECHO "*** Warning: Linking the shared library $output against the non-libtool" 9040 $ECHO "*** objects $objs is not portable!" 9041 func_append libobjs " $objs" 9042 fi 9043 fi 9044 9045 test no = "$dlself" \ 9046 || func_warning "'-dlopen self' is ignored for libtool libraries" 9047 9048 set dummy $rpath 9049 shift 9050 test 1 -lt "$#" \ 9051 && func_warning "ignoring multiple '-rpath's for a libtool library" 9052 9053 install_libdir=$1 9054 9055 oldlibs= 9056 if test -z "$rpath"; then 9057 if test yes = "$build_libtool_libs"; then 9058 # Building a libtool convenience library. 9059 # Some compilers have problems with a '.al' extension so 9060 # convenience libraries should have the same extension an 9061 # archive normally would. 9062 oldlibs="$output_objdir/$libname.$libext $oldlibs" 9063 build_libtool_libs=convenience 9064 build_old_libs=yes 9065 fi 9066 9067 test -n "$vinfo" && \ 9068 func_warning "'-version-info/-version-number' is ignored for convenience libraries" 9069 9070 test -n "$release" && \ 9071 func_warning "'-release' is ignored for convenience libraries" 9072 else 9073 9074 # Parse the version information argument. 9075 save_ifs=$IFS; IFS=: 9076 set dummy $vinfo 0 0 0 9077 shift 9078 IFS=$save_ifs 9079 9080 test -n "$7" && \ 9081 func_fatal_help "too many parameters to '-version-info'" 9082 9083 # convert absolute version numbers to libtool ages 9084 # this retains compatibility with .la files and attempts 9085 # to make the code below a bit more comprehensible 9086 9087 case $vinfo_number in 9088 yes) 9089 number_major=$1 9090 number_minor=$2 9091 number_revision=$3 9092 # 9093 # There are really only two kinds -- those that 9094 # use the current revision as the major version 9095 # and those that subtract age and use age as 9096 # a minor version. But, then there is irix 9097 # that has an extra 1 added just for fun 9098 # 9099 case $version_type in 9100 # correct linux to gnu/linux during the next big refactor 9101 darwin|freebsd-elf|linux|midnightbsd-elf|osf|windows|none) 9102 func_arith $number_major + $number_minor 9103 current=$func_arith_result 9104 age=$number_minor 9105 revision=$number_revision 9106 ;; 9107 freebsd-aout|qnx|sunos) 9108 current=$number_major 9109 revision=$number_minor 9110 age=0 9111 ;; 9112 irix|nonstopux) 9113 func_arith $number_major + $number_minor 9114 current=$func_arith_result 9115 age=$number_minor 9116 revision=$number_minor 9117 lt_irix_increment=no 9118 ;; 9119 esac 9120 ;; 9121 no) 9122 current=$1 9123 revision=$2 9124 age=$3 9125 ;; 9126 esac 9127 9128 # Check that each of the things are valid numbers. 9129 case $current in 9130 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]) ;; 9131 *) 9132 func_error "CURRENT '$current' must be a nonnegative integer" 9133 func_fatal_error "'$vinfo' is not valid version information" 9134 ;; 9135 esac 9136 9137 case $revision in 9138 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]) ;; 9139 *) 9140 func_error "REVISION '$revision' must be a nonnegative integer" 9141 func_fatal_error "'$vinfo' is not valid version information" 9142 ;; 9143 esac 9144 9145 case $age in 9146 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]) ;; 9147 *) 9148 func_error "AGE '$age' must be a nonnegative integer" 9149 func_fatal_error "'$vinfo' is not valid version information" 9150 ;; 9151 esac 9152 9153 if test "$age" -gt "$current"; then 9154 func_error "AGE '$age' is greater than the current interface number '$current'" 9155 func_fatal_error "'$vinfo' is not valid version information" 9156 fi 9157 9158 # Calculate the version variables. 9159 major= 9160 versuffix= 9161 verstring= 9162 case $version_type in 9163 none) ;; 9164 9165 darwin) 9166 # Like Linux, but with the current version available in 9167 # verstring for coding it into the library header 9168 func_arith $current - $age 9169 major=.$func_arith_result 9170 versuffix=$major.$age.$revision 9171 # Darwin ld doesn't like 0 for these options... 9172 func_arith $current + 1 9173 minor_current=$func_arith_result 9174 xlcverstring="$wl-compatibility_version $wl$minor_current $wl-current_version $wl$minor_current.$revision" 9175 verstring="-compatibility_version $minor_current -current_version $minor_current.$revision" 9176 # On Darwin other compilers 9177 case $CC in 9178 nagfor*) 9179 verstring="$wl-compatibility_version $wl$minor_current $wl-current_version $wl$minor_current.$revision" 9180 ;; 9181 *) 9182 verstring="-compatibility_version $minor_current -current_version $minor_current.$revision" 9183 ;; 9184 esac 9185 ;; 9186 9187 freebsd-aout) 9188 major=.$current 9189 versuffix=.$current.$revision 9190 ;; 9191 9192 freebsd-elf | midnightbsd-elf) 9193 func_arith $current - $age 9194 major=.$func_arith_result 9195 versuffix=$major.$age.$revision 9196 ;; 9197 9198 irix | nonstopux) 9199 if test no = "$lt_irix_increment"; then 9200 func_arith $current - $age 9201 else 9202 func_arith $current - $age + 1 9203 fi 9204 major=$func_arith_result 9205 9206 case $version_type in 9207 nonstopux) verstring_prefix=nonstopux ;; 9208 *) verstring_prefix=sgi ;; 9209 esac 9210 verstring=$verstring_prefix$major.$revision 9211 9212 # Add in all the interfaces that we are compatible with. 9213 loop=$revision 9214 while test 0 -ne "$loop"; do 9215 func_arith $revision - $loop 9216 iface=$func_arith_result 9217 func_arith $loop - 1 9218 loop=$func_arith_result 9219 verstring=$verstring_prefix$major.$iface:$verstring 9220 done 9221 9222 # Before this point, $major must not contain '.'. 9223 major=.$major 9224 versuffix=$major.$revision 9225 ;; 9226 9227 linux) # correct to gnu/linux during the next big refactor 9228 func_arith $current - $age 9229 major=.$func_arith_result 9230 versuffix=$major.$age.$revision 9231 ;; 9232 9233 osf) 9234 func_arith $current - $age 9235 major=.$func_arith_result 9236 versuffix=.$current.$age.$revision 9237 verstring=$current.$age.$revision 9238 9239 # Add in all the interfaces that we are compatible with. 9240 loop=$age 9241 while test 0 -ne "$loop"; do 9242 func_arith $current - $loop 9243 iface=$func_arith_result 9244 func_arith $loop - 1 9245 loop=$func_arith_result 9246 verstring=$verstring:$iface.0 9247 done 9248 9249 # Make executables depend on our current version. 9250 func_append verstring ":$current.0" 9251 ;; 9252 9253 qnx) 9254 major=.$current 9255 versuffix=.$current 9256 ;; 9257 9258 sco) 9259 major=.$current 9260 versuffix=.$current 9261 ;; 9262 9263 sunos) 9264 major=.$current 9265 versuffix=.$current.$revision 9266 ;; 9267 9268 windows) 9269 # Use '-' rather than '.', since we only want one 9270 # extension on DOS 8.3 file systems. 9271 func_arith $current - $age 9272 major=$func_arith_result 9273 versuffix=-$major 9274 ;; 9275 9276 *) 9277 func_fatal_configuration "unknown library version type '$version_type'" 9278 ;; 9279 esac 9280 9281 # Clear the version info if we defaulted, and they specified a release. 9282 if test -z "$vinfo" && test -n "$release"; then 9283 major= 9284 case $version_type in 9285 darwin) 9286 # we can't check for "0.0" in archive_cmds due to quoting 9287 # problems, so we reset it completely 9288 verstring= 9289 ;; 9290 *) 9291 verstring=0.0 9292 ;; 9293 esac 9294 if test no = "$need_version"; then 9295 versuffix= 9296 else 9297 versuffix=.0.0 9298 fi 9299 fi 9300 9301 # Remove version info from name if versioning should be avoided 9302 if test yes,no = "$avoid_version,$need_version"; then 9303 major= 9304 versuffix= 9305 verstring= 9306 fi 9307 9308 # Check to see if the archive will have undefined symbols. 9309 if test yes = "$allow_undefined"; then 9310 if test unsupported = "$allow_undefined_flag"; then 9311 if test yes = "$build_old_libs"; then 9312 func_warning "undefined symbols not allowed in $host shared libraries; building static only" 9313 build_libtool_libs=no 9314 else 9315 func_fatal_error "can't build $host shared library unless -no-undefined is specified" 9316 fi 9317 fi 9318 else 9319 # Don't allow undefined symbols. 9320 allow_undefined_flag=$no_undefined_flag 9321 fi 9322 9323 fi 9324 9325 func_generate_dlsyms "$libname" "$libname" : 9326 func_append libobjs " $symfileobj" 9327 test " " = "$libobjs" && libobjs= 9328 9329 if test relink != "$opt_mode"; then 9330 # Remove our outputs, but don't remove object files since they 9331 # may have been created when compiling PIC objects. 9332 removelist= 9333 tempremovelist=`$ECHO "$output_objdir/*"` 9334 for p in $tempremovelist; do 9335 case $p in 9336 *.$objext | *.gcno) 9337 ;; 9338 $output_objdir/$outputname | $output_objdir/$libname.* | $output_objdir/$libname$release.*) 9339 if test -n "$precious_files_regex"; then 9340 if $ECHO "$p" | $EGREP -e "$precious_files_regex" >/dev/null 2>&1 9341 then 9342 continue 9343 fi 9344 fi 9345 func_append removelist " $p" 9346 ;; 9347 *) ;; 9348 esac 9349 done 9350 test -n "$removelist" && \ 9351 func_show_eval "${RM}r \$removelist" 9352 fi 9353 9354 # Now set the variables for building old libraries. 9355 if test yes = "$build_old_libs" && test convenience != "$build_libtool_libs"; then 9356 func_append oldlibs " $output_objdir/$libname.$libext" 9357 9358 # Transform .lo files to .o files. 9359 oldobjs="$objs "`$ECHO "$libobjs" | $SP2NL | $SED "/\.$libext$/d; $lo2o" | $NL2SP` 9360 fi 9361 9362 # Eliminate all temporary directories. 9363 #for path in $notinst_path; do 9364 # lib_search_path=`$ECHO "$lib_search_path " | $SED "s% $path % %g"` 9365 # deplibs=`$ECHO "$deplibs " | $SED "s% -L$path % %g"` 9366 # dependency_libs=`$ECHO "$dependency_libs " | $SED "s% -L$path % %g"` 9367 #done 9368 9369 if test -n "$xrpath"; then 9370 # If the user specified any rpath flags, then add them. 9371 temp_xrpath= 9372 for libdir in $xrpath; do 9373 func_replace_sysroot "$libdir" 9374 func_append temp_xrpath " -R$func_replace_sysroot_result" 9375 case "$finalize_rpath " in 9376 *" $libdir "*) ;; 9377 *) func_append finalize_rpath " $libdir" ;; 9378 esac 9379 done 9380 if test yes != "$hardcode_into_libs" || test yes = "$build_old_libs"; then 9381 dependency_libs="$temp_xrpath $dependency_libs" 9382 fi 9383 fi 9384 9385 # Make sure dlfiles contains only unique files that won't be dlpreopened 9386 old_dlfiles=$dlfiles 9387 dlfiles= 9388 for lib in $old_dlfiles; do 9389 case " $dlprefiles $dlfiles " in 9390 *" $lib "*) ;; 9391 *) func_append dlfiles " $lib" ;; 9392 esac 9393 done 9394 9395 # Make sure dlprefiles contains only unique files 9396 old_dlprefiles=$dlprefiles 9397 dlprefiles= 9398 for lib in $old_dlprefiles; do 9399 case "$dlprefiles " in 9400 *" $lib "*) ;; 9401 *) func_append dlprefiles " $lib" ;; 9402 esac 9403 done 9404 9405 if test yes = "$build_libtool_libs"; then 9406 if test -n "$rpath"; then 9407 case $host in 9408 *-*-cygwin* | *-*-mingw* | *-*-pw32* | *-*-os2* | *-*-beos* | *-cegcc* | *-*-haiku*) 9409 # these systems don't actually have a c library (as such)! 9410 ;; 9411 *-*-rhapsody* | *-*-darwin1.[012]) 9412 # Rhapsody C library is in the System framework 9413 func_append deplibs " System.ltframework" 9414 ;; 9415 *-*-netbsd*) 9416 # Don't link with libc until the a.out ld.so is fixed. 9417 ;; 9418 *-*-openbsd* | *-*-freebsd* | *-*-dragonfly* | *-*-midnightbsd*) 9419 # Do not include libc due to us having libc/libc_r. 9420 ;; 9421 *-*-sco3.2v5* | *-*-sco5v6*) 9422 # Causes problems with __ctype 9423 ;; 9424 *-*-sysv4.2uw2* | *-*-sysv5* | *-*-unixware* | *-*-OpenUNIX*) 9425 # Compiler inserts libc in the correct place for threads to work 9426 ;; 9427 *) 9428 # Add libc to deplibs on all other systems if necessary. 9429 if test yes = "$build_libtool_need_lc"; then 9430 func_append deplibs " -lc" 9431 fi 9432 ;; 9433 esac 9434 fi 9435 9436 # Transform deplibs into only deplibs that can be linked in shared. 9437 name_save=$name 9438 libname_save=$libname 9439 release_save=$release 9440 versuffix_save=$versuffix 9441 major_save=$major 9442 # I'm not sure if I'm treating the release correctly. I think 9443 # release should show up in the -l (ie -lgmp5) so we don't want to 9444 # add it in twice. Is that correct? 9445 release= 9446 versuffix= 9447 major= 9448 newdeplibs= 9449 droppeddeps=no 9450 case $deplibs_check_method in 9451 pass_all) 9452 # Don't check for shared/static. Everything works. 9453 # This might be a little naive. We might want to check 9454 # whether the library exists or not. But this is on 9455 # osf3 & osf4 and I'm not really sure... Just 9456 # implementing what was already the behavior. 9457 newdeplibs=$deplibs 9458 ;; 9459 test_compile) 9460 # This code stresses the "libraries are programs" paradigm to its 9461 # limits. Maybe even breaks it. We compile a program, linking it 9462 # against the deplibs as a proxy for the library. Then we can check 9463 # whether they linked in statically or dynamically with ldd. 9464 $opt_dry_run || $RM conftest.c 9465 cat > conftest.c <<EOF 9466 int main() { return 0; } 9467EOF 9468 $opt_dry_run || $RM conftest 9469 if $LTCC $LTCFLAGS -o conftest conftest.c $deplibs; then 9470 ldd_output=`ldd conftest` 9471 for i in $deplibs; do 9472 case $i in 9473 -l*) 9474 func_stripname -l '' "$i" 9475 name=$func_stripname_result 9476 if test yes = "$allow_libtool_libs_with_static_runtimes"; then 9477 case " $predeps $postdeps " in 9478 *" $i "*) 9479 func_append newdeplibs " $i" 9480 i= 9481 ;; 9482 esac 9483 fi 9484 if test -n "$i"; then 9485 libname=`eval "\\$ECHO \"$libname_spec\""` 9486 deplib_matches=`eval "\\$ECHO \"$library_names_spec\""` 9487 set dummy $deplib_matches; shift 9488 deplib_match=$1 9489 if test `expr "$ldd_output" : ".*$deplib_match"` -ne 0; then 9490 func_append newdeplibs " $i" 9491 else 9492 droppeddeps=yes 9493 echo 9494 $ECHO "*** Warning: dynamic linker does not accept needed library $i." 9495 echo "*** I have the capability to make that library automatically link in when" 9496 echo "*** you link to this library. But I can only do this if you have a" 9497 echo "*** shared version of the library, which I believe you do not have" 9498 echo "*** because a test_compile did reveal that the linker did not use it for" 9499 echo "*** its dynamic dependency list that programs get resolved with at runtime." 9500 fi 9501 fi 9502 ;; 9503 *) 9504 func_append newdeplibs " $i" 9505 ;; 9506 esac 9507 done 9508 else 9509 # Error occurred in the first compile. Let's try to salvage 9510 # the situation: Compile a separate program for each library. 9511 for i in $deplibs; do 9512 case $i in 9513 -l*) 9514 func_stripname -l '' "$i" 9515 name=$func_stripname_result 9516 $opt_dry_run || $RM conftest 9517 if $LTCC $LTCFLAGS -o conftest conftest.c $i; then 9518 ldd_output=`ldd conftest` 9519 if test yes = "$allow_libtool_libs_with_static_runtimes"; then 9520 case " $predeps $postdeps " in 9521 *" $i "*) 9522 func_append newdeplibs " $i" 9523 i= 9524 ;; 9525 esac 9526 fi 9527 if test -n "$i"; then 9528 libname=`eval "\\$ECHO \"$libname_spec\""` 9529 deplib_matches=`eval "\\$ECHO \"$library_names_spec\""` 9530 set dummy $deplib_matches; shift 9531 deplib_match=$1 9532 if test `expr "$ldd_output" : ".*$deplib_match"` -ne 0; then 9533 func_append newdeplibs " $i" 9534 else 9535 droppeddeps=yes 9536 echo 9537 $ECHO "*** Warning: dynamic linker does not accept needed library $i." 9538 echo "*** I have the capability to make that library automatically link in when" 9539 echo "*** you link to this library. But I can only do this if you have a" 9540 echo "*** shared version of the library, which you do not appear to have" 9541 echo "*** because a test_compile did reveal that the linker did not use this one" 9542 echo "*** as a dynamic dependency that programs can get resolved with at runtime." 9543 fi 9544 fi 9545 else 9546 droppeddeps=yes 9547 echo 9548 $ECHO "*** Warning! Library $i is needed by this library but I was not able to" 9549 echo "*** make it link in! You will probably need to install it or some" 9550 echo "*** library that it depends on before this library will be fully" 9551 echo "*** functional. Installing it before continuing would be even better." 9552 fi 9553 ;; 9554 *) 9555 func_append newdeplibs " $i" 9556 ;; 9557 esac 9558 done 9559 fi 9560 ;; 9561 file_magic*) 9562 set dummy $deplibs_check_method; shift 9563 file_magic_regex=`expr "$deplibs_check_method" : "$1 \(.*\)"` 9564 for a_deplib in $deplibs; do 9565 case $a_deplib in 9566 -l*) 9567 func_stripname -l '' "$a_deplib" 9568 name=$func_stripname_result 9569 if test yes = "$allow_libtool_libs_with_static_runtimes"; then 9570 case " $predeps $postdeps " in 9571 *" $a_deplib "*) 9572 func_append newdeplibs " $a_deplib" 9573 a_deplib= 9574 ;; 9575 esac 9576 fi 9577 if test -n "$a_deplib"; then 9578 libname=`eval "\\$ECHO \"$libname_spec\""` 9579 if test -n "$file_magic_glob"; then 9580 libnameglob=`func_echo_all "$libname" | $SED -e $file_magic_glob` 9581 else 9582 libnameglob=$libname 9583 fi 9584 test yes = "$want_nocaseglob" && nocaseglob=`shopt -p nocaseglob` 9585 for i in $lib_search_path $sys_lib_search_path $shlib_search_path; do 9586 if test yes = "$want_nocaseglob"; then 9587 shopt -s nocaseglob 9588 potential_libs=`ls $i/$libnameglob[.-]* 2>/dev/null` 9589 $nocaseglob 9590 else 9591 potential_libs=`ls $i/$libnameglob[.-]* 2>/dev/null` 9592 fi 9593 for potent_lib in $potential_libs; do 9594 # Follow soft links. 9595 if ls -lLd "$potent_lib" 2>/dev/null | 9596 $GREP " -> " >/dev/null; then 9597 continue 9598 fi 9599 # The statement above tries to avoid entering an 9600 # endless loop below, in case of cyclic links. 9601 # We might still enter an endless loop, since a link 9602 # loop can be closed while we follow links, 9603 # but so what? 9604 potlib=$potent_lib 9605 while test -h "$potlib" 2>/dev/null; do 9606 potliblink=`ls -ld $potlib | $SED 's/.* -> //'` 9607 case $potliblink in 9608 [\\/]* | [A-Za-z]:[\\/]*) potlib=$potliblink;; 9609 *) potlib=`$ECHO "$potlib" | $SED 's|[^/]*$||'`"$potliblink";; 9610 esac 9611 done 9612 if eval $file_magic_cmd \"\$potlib\" 2>/dev/null | 9613 $SED -e 10q | 9614 $EGREP "$file_magic_regex" > /dev/null; then 9615 func_append newdeplibs " $a_deplib" 9616 a_deplib= 9617 break 2 9618 fi 9619 done 9620 done 9621 fi 9622 if test -n "$a_deplib"; then 9623 droppeddeps=yes 9624 echo 9625 $ECHO "*** Warning: linker path does not have real file for library $a_deplib." 9626 echo "*** I have the capability to make that library automatically link in when" 9627 echo "*** you link to this library. But I can only do this if you have a" 9628 echo "*** shared version of the library, which you do not appear to have" 9629 echo "*** because I did check the linker path looking for a file starting" 9630 if test -z "$potlib"; then 9631 $ECHO "*** with $libname but no candidates were found. (...for file magic test)" 9632 else 9633 $ECHO "*** with $libname and none of the candidates passed a file format test" 9634 $ECHO "*** using a file magic. Last file checked: $potlib" 9635 fi 9636 fi 9637 ;; 9638 *) 9639 # Add a -L argument. 9640 func_append newdeplibs " $a_deplib" 9641 ;; 9642 esac 9643 done # Gone through all deplibs. 9644 ;; 9645 match_pattern*) 9646 set dummy $deplibs_check_method; shift 9647 match_pattern_regex=`expr "$deplibs_check_method" : "$1 \(.*\)"` 9648 for a_deplib in $deplibs; do 9649 case $a_deplib in 9650 -l*) 9651 func_stripname -l '' "$a_deplib" 9652 name=$func_stripname_result 9653 if test yes = "$allow_libtool_libs_with_static_runtimes"; then 9654 case " $predeps $postdeps " in 9655 *" $a_deplib "*) 9656 func_append newdeplibs " $a_deplib" 9657 a_deplib= 9658 ;; 9659 esac 9660 fi 9661 if test -n "$a_deplib"; then 9662 libname=`eval "\\$ECHO \"$libname_spec\""` 9663 for i in $lib_search_path $sys_lib_search_path $shlib_search_path; do 9664 potential_libs=`ls $i/$libname[.-]* 2>/dev/null` 9665 for potent_lib in $potential_libs; do 9666 potlib=$potent_lib # see symlink-check above in file_magic test 9667 if eval "\$ECHO \"$potent_lib\"" 2>/dev/null | $SED 10q | \ 9668 $EGREP "$match_pattern_regex" > /dev/null; then 9669 func_append newdeplibs " $a_deplib" 9670 a_deplib= 9671 break 2 9672 fi 9673 done 9674 done 9675 fi 9676 if test -n "$a_deplib"; then 9677 droppeddeps=yes 9678 echo 9679 $ECHO "*** Warning: linker path does not have real file for library $a_deplib." 9680 echo "*** I have the capability to make that library automatically link in when" 9681 echo "*** you link to this library. But I can only do this if you have a" 9682 echo "*** shared version of the library, which you do not appear to have" 9683 echo "*** because I did check the linker path looking for a file starting" 9684 if test -z "$potlib"; then 9685 $ECHO "*** with $libname but no candidates were found. (...for regex pattern test)" 9686 else 9687 $ECHO "*** with $libname and none of the candidates passed a file format test" 9688 $ECHO "*** using a regex pattern. Last file checked: $potlib" 9689 fi 9690 fi 9691 ;; 9692 *) 9693 # Add a -L argument. 9694 func_append newdeplibs " $a_deplib" 9695 ;; 9696 esac 9697 done # Gone through all deplibs. 9698 ;; 9699 none | unknown | *) 9700 newdeplibs= 9701 tmp_deplibs=`$ECHO " $deplibs" | $SED 's/ -lc$//; s/ -[LR][^ ]*//g'` 9702 if test yes = "$allow_libtool_libs_with_static_runtimes"; then 9703 for i in $predeps $postdeps; do 9704 # can't use Xsed below, because $i might contain '/' 9705 tmp_deplibs=`$ECHO " $tmp_deplibs" | $SED "s|$i||"` 9706 done 9707 fi 9708 case $tmp_deplibs in 9709 *[!\ \ ]*) 9710 echo 9711 if test none = "$deplibs_check_method"; then 9712 echo "*** Warning: inter-library dependencies are not supported in this platform." 9713 else 9714 echo "*** Warning: inter-library dependencies are not known to be supported." 9715 fi 9716 echo "*** All declared inter-library dependencies are being dropped." 9717 droppeddeps=yes 9718 ;; 9719 esac 9720 ;; 9721 esac 9722 versuffix=$versuffix_save 9723 major=$major_save 9724 release=$release_save 9725 libname=$libname_save 9726 name=$name_save 9727 9728 case $host in 9729 *-*-rhapsody* | *-*-darwin1.[012]) 9730 # On Rhapsody replace the C library with the System framework 9731 newdeplibs=`$ECHO " $newdeplibs" | $SED 's/ -lc / System.ltframework /'` 9732 ;; 9733 esac 9734 9735 if test yes = "$droppeddeps"; then 9736 if test yes = "$module"; then 9737 echo 9738 echo "*** Warning: libtool could not satisfy all declared inter-library" 9739 $ECHO "*** dependencies of module $libname. Therefore, libtool will create" 9740 echo "*** a static module, that should work as long as the dlopening" 9741 echo "*** application is linked with the -dlopen flag." 9742 if test -z "$global_symbol_pipe"; then 9743 echo 9744 echo "*** However, this would only work if libtool was able to extract symbol" 9745 echo "*** lists from a program, using 'nm' or equivalent, but libtool could" 9746 echo "*** not find such a program. So, this module is probably useless." 9747 echo "*** 'nm' from GNU binutils and a full rebuild may help." 9748 fi 9749 if test no = "$build_old_libs"; then 9750 oldlibs=$output_objdir/$libname.$libext 9751 build_libtool_libs=module 9752 build_old_libs=yes 9753 else 9754 build_libtool_libs=no 9755 fi 9756 else 9757 echo "*** The inter-library dependencies that have been dropped here will be" 9758 echo "*** automatically added whenever a program is linked with this library" 9759 echo "*** or is declared to -dlopen it." 9760 9761 if test no = "$allow_undefined"; then 9762 echo 9763 echo "*** Since this library must not contain undefined symbols," 9764 echo "*** because either the platform does not support them or" 9765 echo "*** it was explicitly requested with -no-undefined," 9766 echo "*** libtool will only create a static version of it." 9767 if test no = "$build_old_libs"; then 9768 oldlibs=$output_objdir/$libname.$libext 9769 build_libtool_libs=module 9770 build_old_libs=yes 9771 else 9772 build_libtool_libs=no 9773 fi 9774 fi 9775 fi 9776 fi 9777 # Done checking deplibs! 9778 deplibs=$newdeplibs 9779 fi 9780 # Time to change all our "foo.ltframework" stuff back to "-framework foo" 9781 case $host in 9782 *-*-darwin*) 9783 newdeplibs=`$ECHO " $newdeplibs" | $SED 's% \([^ $]*\).ltframework% -framework \1%g'` 9784 new_inherited_linker_flags=`$ECHO " $new_inherited_linker_flags" | $SED 's% \([^ $]*\).ltframework% -framework \1%g'` 9785 deplibs=`$ECHO " $deplibs" | $SED 's% \([^ $]*\).ltframework% -framework \1%g'` 9786 ;; 9787 esac 9788 9789 # move library search paths that coincide with paths to not yet 9790 # installed libraries to the beginning of the library search list 9791 new_libs= 9792 for path in $notinst_path; do 9793 case " $new_libs " in 9794 *" -L$path/$objdir "*) ;; 9795 *) 9796 case " $deplibs " in 9797 *" -L$path/$objdir "*) 9798 func_append new_libs " -L$path/$objdir" ;; 9799 esac 9800 ;; 9801 esac 9802 done 9803 for deplib in $deplibs; do 9804 case $deplib in 9805 -L*) 9806 case " $new_libs " in 9807 *" $deplib "*) ;; 9808 *) func_append new_libs " $deplib" ;; 9809 esac 9810 ;; 9811 *) func_append new_libs " $deplib" ;; 9812 esac 9813 done 9814 deplibs=$new_libs 9815 9816 # All the library-specific variables (install_libdir is set above). 9817 library_names= 9818 old_library= 9819 dlname= 9820 9821 # Test again, we may have decided not to build it any more 9822 if test yes = "$build_libtool_libs"; then 9823 # Remove $wl instances when linking with ld. 9824 # FIXME: should test the right _cmds variable. 9825 case $archive_cmds in 9826 *\$LD\ *) wl= ;; 9827 esac 9828 if test yes = "$hardcode_into_libs"; then 9829 # Hardcode the library paths 9830 hardcode_libdirs= 9831 dep_rpath= 9832 rpath=$finalize_rpath 9833 test relink = "$opt_mode" || rpath=$compile_rpath$rpath 9834 for libdir in $rpath; do 9835 if test -n "$hardcode_libdir_flag_spec"; then 9836 if test -n "$hardcode_libdir_separator"; then 9837 func_replace_sysroot "$libdir" 9838 libdir=$func_replace_sysroot_result 9839 if test -z "$hardcode_libdirs"; then 9840 hardcode_libdirs=$libdir 9841 else 9842 # Just accumulate the unique libdirs. 9843 case $hardcode_libdir_separator$hardcode_libdirs$hardcode_libdir_separator in 9844 *"$hardcode_libdir_separator$libdir$hardcode_libdir_separator"*) 9845 ;; 9846 *) 9847 func_append hardcode_libdirs "$hardcode_libdir_separator$libdir" 9848 ;; 9849 esac 9850 fi 9851 else 9852 eval flag=\"$hardcode_libdir_flag_spec\" 9853 func_append dep_rpath " $flag" 9854 fi 9855 elif test -n "$runpath_var"; then 9856 case "$perm_rpath " in 9857 *" $libdir "*) ;; 9858 *) func_append perm_rpath " $libdir" ;; 9859 esac 9860 fi 9861 done 9862 # Substitute the hardcoded libdirs into the rpath. 9863 if test -n "$hardcode_libdir_separator" && 9864 test -n "$hardcode_libdirs"; then 9865 libdir=$hardcode_libdirs 9866 eval "dep_rpath=\"$hardcode_libdir_flag_spec\"" 9867 fi 9868 if test -n "$runpath_var" && test -n "$perm_rpath"; then 9869 # We should set the runpath_var. 9870 rpath= 9871 for dir in $perm_rpath; do 9872 func_append rpath "$dir:" 9873 done 9874 eval "$runpath_var='$rpath\$$runpath_var'; export $runpath_var" 9875 fi 9876 test -n "$dep_rpath" && deplibs="$dep_rpath $deplibs" 9877 fi 9878 9879 shlibpath=$finalize_shlibpath 9880 test relink = "$opt_mode" || shlibpath=$compile_shlibpath$shlibpath 9881 if test -n "$shlibpath"; then 9882 eval "$shlibpath_var='$shlibpath\$$shlibpath_var'; export $shlibpath_var" 9883 fi 9884 9885 # Get the real and link names of the library. 9886 eval shared_ext=\"$shrext_cmds\" 9887 eval library_names=\"$library_names_spec\" 9888 set dummy $library_names 9889 shift 9890 realname=$1 9891 shift 9892 9893 if test -n "$soname_spec"; then 9894 eval soname=\"$soname_spec\" 9895 else 9896 soname=$realname 9897 fi 9898 if test -z "$dlname"; then 9899 dlname=$soname 9900 fi 9901 9902 lib=$output_objdir/$realname 9903 linknames= 9904 for link 9905 do 9906 func_append linknames " $link" 9907 done 9908 9909 # Use standard objects if they are pic 9910 test -z "$pic_flag" && libobjs=`$ECHO "$libobjs" | $SP2NL | $SED "$lo2o" | $NL2SP` 9911 test "X$libobjs" = "X " && libobjs= 9912 9913 delfiles= 9914 if test -n "$export_symbols" && test -n "$include_expsyms"; then 9915 $opt_dry_run || cp "$export_symbols" "$output_objdir/$libname.uexp" 9916 export_symbols=$output_objdir/$libname.uexp 9917 func_append delfiles " $export_symbols" 9918 fi 9919 9920 orig_export_symbols= 9921 case $host_os in 9922 cygwin* | mingw* | cegcc*) 9923 if test -n "$export_symbols" && test -z "$export_symbols_regex"; then 9924 # exporting using user supplied symfile 9925 func_dll_def_p "$export_symbols" || { 9926 # and it's NOT already a .def file. Must figure out 9927 # which of the given symbols are data symbols and tag 9928 # them as such. So, trigger use of export_symbols_cmds. 9929 # export_symbols gets reassigned inside the "prepare 9930 # the list of exported symbols" if statement, so the 9931 # include_expsyms logic still works. 9932 orig_export_symbols=$export_symbols 9933 export_symbols= 9934 always_export_symbols=yes 9935 } 9936 fi 9937 ;; 9938 esac 9939 9940 # Prepare the list of exported symbols 9941 if test -z "$export_symbols"; then 9942 if test yes = "$always_export_symbols" || test -n "$export_symbols_regex"; then 9943 func_verbose "generating symbol list for '$libname.la'" 9944 export_symbols=$output_objdir/$libname.exp 9945 $opt_dry_run || $RM $export_symbols 9946 cmds=$export_symbols_cmds 9947 save_ifs=$IFS; IFS='~' 9948 for cmd1 in $cmds; do 9949 IFS=$save_ifs 9950 # Take the normal branch if the nm_file_list_spec branch 9951 # doesn't work or if tool conversion is not needed. 9952 case $nm_file_list_spec~$to_tool_file_cmd in 9953 *~func_convert_file_noop | *~func_convert_file_msys_to_w32 | ~*) 9954 try_normal_branch=yes 9955 eval cmd=\"$cmd1\" 9956 func_len " $cmd" 9957 len=$func_len_result 9958 ;; 9959 *) 9960 try_normal_branch=no 9961 ;; 9962 esac 9963 if test yes = "$try_normal_branch" \ 9964 && { test "$len" -lt "$max_cmd_len" \ 9965 || test "$max_cmd_len" -le -1; } 9966 then 9967 func_show_eval "$cmd" 'exit $?' 9968 skipped_export=false 9969 elif test -n "$nm_file_list_spec"; then 9970 func_basename "$output" 9971 output_la=$func_basename_result 9972 save_libobjs=$libobjs 9973 save_output=$output 9974 output=$output_objdir/$output_la.nm 9975 func_to_tool_file "$output" 9976 libobjs=$nm_file_list_spec$func_to_tool_file_result 9977 func_append delfiles " $output" 9978 func_verbose "creating $NM input file list: $output" 9979 for obj in $save_libobjs; do 9980 func_to_tool_file "$obj" 9981 $ECHO "$func_to_tool_file_result" 9982 done > "$output" 9983 eval cmd=\"$cmd1\" 9984 func_show_eval "$cmd" 'exit $?' 9985 output=$save_output 9986 libobjs=$save_libobjs 9987 skipped_export=false 9988 else 9989 # The command line is too long to execute in one step. 9990 func_verbose "using reloadable object file for export list..." 9991 skipped_export=: 9992 # Break out early, otherwise skipped_export may be 9993 # set to false by a later but shorter cmd. 9994 break 9995 fi 9996 done 9997 IFS=$save_ifs 9998 if test -n "$export_symbols_regex" && test : != "$skipped_export"; then 9999 func_show_eval '$EGREP -e "$export_symbols_regex" "$export_symbols" > "${export_symbols}T"' 10000 func_show_eval '$MV "${export_symbols}T" "$export_symbols"' 10001 fi 10002 fi 10003 fi 10004 10005 if test -n "$export_symbols" && test -n "$include_expsyms"; then 10006 tmp_export_symbols=$export_symbols 10007 test -n "$orig_export_symbols" && tmp_export_symbols=$orig_export_symbols 10008 $opt_dry_run || eval '$ECHO "$include_expsyms" | $SP2NL >> "$tmp_export_symbols"' 10009 fi 10010 10011 if test : != "$skipped_export" && test -n "$orig_export_symbols"; then 10012 # The given exports_symbols file has to be filtered, so filter it. 10013 func_verbose "filter symbol list for '$libname.la' to tag DATA exports" 10014 # FIXME: $output_objdir/$libname.filter potentially contains lots of 10015 # 's' commands, which not all seds can handle. GNU sed should be fine 10016 # though. Also, the filter scales superlinearly with the number of 10017 # global variables. join(1) would be nice here, but unfortunately 10018 # isn't a blessed tool. 10019 $opt_dry_run || $SED -e '/[ ,]DATA/!d;s,\(.*\)\([ \,].*\),s|^\1$|\1\2|,' < $export_symbols > $output_objdir/$libname.filter 10020 func_append delfiles " $export_symbols $output_objdir/$libname.filter" 10021 export_symbols=$output_objdir/$libname.def 10022 $opt_dry_run || $SED -f $output_objdir/$libname.filter < $orig_export_symbols > $export_symbols 10023 fi 10024 10025 tmp_deplibs= 10026 for test_deplib in $deplibs; do 10027 case " $convenience " in 10028 *" $test_deplib "*) ;; 10029 *) 10030 func_append tmp_deplibs " $test_deplib" 10031 ;; 10032 esac 10033 done 10034 deplibs=$tmp_deplibs 10035 10036 if test -n "$convenience"; then 10037 if test -n "$whole_archive_flag_spec" && 10038 test yes = "$compiler_needs_object" && 10039 test -z "$libobjs"; then 10040 # extract the archives, so we have objects to list. 10041 # TODO: could optimize this to just extract one archive. 10042 whole_archive_flag_spec= 10043 fi 10044 if test -n "$whole_archive_flag_spec"; then 10045 save_libobjs=$libobjs 10046 eval libobjs=\"\$libobjs $whole_archive_flag_spec\" 10047 test "X$libobjs" = "X " && libobjs= 10048 else 10049 gentop=$output_objdir/${outputname}x 10050 func_append generated " $gentop" 10051 10052 func_extract_archives $gentop $convenience 10053 func_append libobjs " $func_extract_archives_result" 10054 test "X$libobjs" = "X " && libobjs= 10055 fi 10056 fi 10057 10058 if test yes = "$thread_safe" && test -n "$thread_safe_flag_spec"; then 10059 eval flag=\"$thread_safe_flag_spec\" 10060 func_append linker_flags " $flag" 10061 fi 10062 10063 # Make a backup of the uninstalled library when relinking 10064 if test relink = "$opt_mode"; then 10065 $opt_dry_run || eval '(cd $output_objdir && $RM ${realname}U && $MV $realname ${realname}U)' || exit $? 10066 fi 10067 10068 # Do each of the archive commands. 10069 if test yes = "$module" && test -n "$module_cmds"; then 10070 if test -n "$export_symbols" && test -n "$module_expsym_cmds"; then 10071 eval test_cmds=\"$module_expsym_cmds\" 10072 cmds=$module_expsym_cmds 10073 else 10074 eval test_cmds=\"$module_cmds\" 10075 cmds=$module_cmds 10076 fi 10077 else 10078 if test -n "$export_symbols" && test -n "$archive_expsym_cmds"; then 10079 eval test_cmds=\"$archive_expsym_cmds\" 10080 cmds=$archive_expsym_cmds 10081 else 10082 eval test_cmds=\"$archive_cmds\" 10083 cmds=$archive_cmds 10084 fi 10085 fi 10086 10087 if test : != "$skipped_export" && 10088 func_len " $test_cmds" && 10089 len=$func_len_result && 10090 test "$len" -lt "$max_cmd_len" || test "$max_cmd_len" -le -1; then 10091 : 10092 else 10093 # The command line is too long to link in one step, link piecewise 10094 # or, if using GNU ld and skipped_export is not :, use a linker 10095 # script. 10096 10097 # Save the value of $output and $libobjs because we want to 10098 # use them later. If we have whole_archive_flag_spec, we 10099 # want to use save_libobjs as it was before 10100 # whole_archive_flag_spec was expanded, because we can't 10101 # assume the linker understands whole_archive_flag_spec. 10102 # This may have to be revisited, in case too many 10103 # convenience libraries get linked in and end up exceeding 10104 # the spec. 10105 if test -z "$convenience" || test -z "$whole_archive_flag_spec"; then 10106 save_libobjs=$libobjs 10107 fi 10108 save_output=$output 10109 func_basename "$output" 10110 output_la=$func_basename_result 10111 10112 # Clear the reloadable object creation command queue and 10113 # initialize k to one. 10114 test_cmds= 10115 concat_cmds= 10116 objlist= 10117 last_robj= 10118 k=1 10119 10120 if test -n "$save_libobjs" && test : != "$skipped_export" && test yes = "$with_gnu_ld"; then 10121 output=$output_objdir/$output_la.lnkscript 10122 func_verbose "creating GNU ld script: $output" 10123 echo 'INPUT (' > $output 10124 for obj in $save_libobjs 10125 do 10126 func_to_tool_file "$obj" 10127 $ECHO "$func_to_tool_file_result" >> $output 10128 done 10129 echo ')' >> $output 10130 func_append delfiles " $output" 10131 func_to_tool_file "$output" 10132 output=$func_to_tool_file_result 10133 elif test -n "$save_libobjs" && test : != "$skipped_export" && test -n "$file_list_spec"; then 10134 output=$output_objdir/$output_la.lnk 10135 func_verbose "creating linker input file list: $output" 10136 : > $output 10137 set x $save_libobjs 10138 shift 10139 firstobj= 10140 if test yes = "$compiler_needs_object"; then 10141 firstobj="$1 " 10142 shift 10143 fi 10144 for obj 10145 do 10146 func_to_tool_file "$obj" 10147 $ECHO "$func_to_tool_file_result" >> $output 10148 done 10149 func_append delfiles " $output" 10150 func_to_tool_file "$output" 10151 output=$firstobj\"$file_list_spec$func_to_tool_file_result\" 10152 else 10153 if test -n "$save_libobjs"; then 10154 func_verbose "creating reloadable object files..." 10155 output=$output_objdir/$output_la-$k.$objext 10156 eval test_cmds=\"$reload_cmds\" 10157 func_len " $test_cmds" 10158 len0=$func_len_result 10159 len=$len0 10160 10161 # Loop over the list of objects to be linked. 10162 for obj in $save_libobjs 10163 do 10164 func_len " $obj" 10165 func_arith $len + $func_len_result 10166 len=$func_arith_result 10167 if test -z "$objlist" || 10168 test "$len" -lt "$max_cmd_len"; then 10169 func_append objlist " $obj" 10170 else 10171 # The command $test_cmds is almost too long, add a 10172 # command to the queue. 10173 if test 1 -eq "$k"; then 10174 # The first file doesn't have a previous command to add. 10175 reload_objs=$objlist 10176 eval concat_cmds=\"$reload_cmds\" 10177 else 10178 # All subsequent reloadable object files will link in 10179 # the last one created. 10180 reload_objs="$objlist $last_robj" 10181 eval concat_cmds=\"\$concat_cmds~$reload_cmds~\$RM $last_robj\" 10182 fi 10183 last_robj=$output_objdir/$output_la-$k.$objext 10184 func_arith $k + 1 10185 k=$func_arith_result 10186 output=$output_objdir/$output_la-$k.$objext 10187 objlist=" $obj" 10188 func_len " $last_robj" 10189 func_arith $len0 + $func_len_result 10190 len=$func_arith_result 10191 fi 10192 done 10193 # Handle the remaining objects by creating one last 10194 # reloadable object file. All subsequent reloadable object 10195 # files will link in the last one created. 10196 test -z "$concat_cmds" || concat_cmds=$concat_cmds~ 10197 reload_objs="$objlist $last_robj" 10198 eval concat_cmds=\"\$concat_cmds$reload_cmds\" 10199 if test -n "$last_robj"; then 10200 eval concat_cmds=\"\$concat_cmds~\$RM $last_robj\" 10201 fi 10202 func_append delfiles " $output" 10203 10204 else 10205 output= 10206 fi 10207 10208 ${skipped_export-false} && { 10209 func_verbose "generating symbol list for '$libname.la'" 10210 export_symbols=$output_objdir/$libname.exp 10211 $opt_dry_run || $RM $export_symbols 10212 libobjs=$output 10213 # Append the command to create the export file. 10214 test -z "$concat_cmds" || concat_cmds=$concat_cmds~ 10215 eval concat_cmds=\"\$concat_cmds$export_symbols_cmds\" 10216 if test -n "$last_robj"; then 10217 eval concat_cmds=\"\$concat_cmds~\$RM $last_robj\" 10218 fi 10219 } 10220 10221 test -n "$save_libobjs" && 10222 func_verbose "creating a temporary reloadable object file: $output" 10223 10224 # Loop through the commands generated above and execute them. 10225 save_ifs=$IFS; IFS='~' 10226 for cmd in $concat_cmds; do 10227 IFS=$save_ifs 10228 $opt_quiet || { 10229 func_quote_arg expand,pretty "$cmd" 10230 eval "func_echo $func_quote_arg_result" 10231 } 10232 $opt_dry_run || eval "$cmd" || { 10233 lt_exit=$? 10234 10235 # Restore the uninstalled library and exit 10236 if test relink = "$opt_mode"; then 10237 ( cd "$output_objdir" && \ 10238 $RM "${realname}T" && \ 10239 $MV "${realname}U" "$realname" ) 10240 fi 10241 10242 exit $lt_exit 10243 } 10244 done 10245 IFS=$save_ifs 10246 10247 if test -n "$export_symbols_regex" && ${skipped_export-false}; then 10248 func_show_eval '$EGREP -e "$export_symbols_regex" "$export_symbols" > "${export_symbols}T"' 10249 func_show_eval '$MV "${export_symbols}T" "$export_symbols"' 10250 fi 10251 fi 10252 10253 ${skipped_export-false} && { 10254 if test -n "$export_symbols" && test -n "$include_expsyms"; then 10255 tmp_export_symbols=$export_symbols 10256 test -n "$orig_export_symbols" && tmp_export_symbols=$orig_export_symbols 10257 $opt_dry_run || eval '$ECHO "$include_expsyms" | $SP2NL >> "$tmp_export_symbols"' 10258 fi 10259 10260 if test -n "$orig_export_symbols"; then 10261 # The given exports_symbols file has to be filtered, so filter it. 10262 func_verbose "filter symbol list for '$libname.la' to tag DATA exports" 10263 # FIXME: $output_objdir/$libname.filter potentially contains lots of 10264 # 's' commands, which not all seds can handle. GNU sed should be fine 10265 # though. Also, the filter scales superlinearly with the number of 10266 # global variables. join(1) would be nice here, but unfortunately 10267 # isn't a blessed tool. 10268 $opt_dry_run || $SED -e '/[ ,]DATA/!d;s,\(.*\)\([ \,].*\),s|^\1$|\1\2|,' < $export_symbols > $output_objdir/$libname.filter 10269 func_append delfiles " $export_symbols $output_objdir/$libname.filter" 10270 export_symbols=$output_objdir/$libname.def 10271 $opt_dry_run || $SED -f $output_objdir/$libname.filter < $orig_export_symbols > $export_symbols 10272 fi 10273 } 10274 10275 libobjs=$output 10276 # Restore the value of output. 10277 output=$save_output 10278 10279 if test -n "$convenience" && test -n "$whole_archive_flag_spec"; then 10280 eval libobjs=\"\$libobjs $whole_archive_flag_spec\" 10281 test "X$libobjs" = "X " && libobjs= 10282 fi 10283 # Expand the library linking commands again to reset the 10284 # value of $libobjs for piecewise linking. 10285 10286 # Do each of the archive commands. 10287 if test yes = "$module" && test -n "$module_cmds"; then 10288 if test -n "$export_symbols" && test -n "$module_expsym_cmds"; then 10289 cmds=$module_expsym_cmds 10290 else 10291 cmds=$module_cmds 10292 fi 10293 else 10294 if test -n "$export_symbols" && test -n "$archive_expsym_cmds"; then 10295 cmds=$archive_expsym_cmds 10296 else 10297 cmds=$archive_cmds 10298 fi 10299 fi 10300 fi 10301 10302 if test -n "$delfiles"; then 10303 # Append the command to remove temporary files to $cmds. 10304 eval cmds=\"\$cmds~\$RM $delfiles\" 10305 fi 10306 10307 # Add any objects from preloaded convenience libraries 10308 if test -n "$dlprefiles"; then 10309 gentop=$output_objdir/${outputname}x 10310 func_append generated " $gentop" 10311 10312 func_extract_archives $gentop $dlprefiles 10313 func_append libobjs " $func_extract_archives_result" 10314 test "X$libobjs" = "X " && libobjs= 10315 fi 10316 10317 save_ifs=$IFS; IFS='~' 10318 for cmd in $cmds; do 10319 IFS=$sp$nl 10320 eval cmd=\"$cmd\" 10321 IFS=$save_ifs 10322 $opt_quiet || { 10323 func_quote_arg expand,pretty "$cmd" 10324 eval "func_echo $func_quote_arg_result" 10325 } 10326 $opt_dry_run || eval "$cmd" || { 10327 lt_exit=$? 10328 10329 # Restore the uninstalled library and exit 10330 if test relink = "$opt_mode"; then 10331 ( cd "$output_objdir" && \ 10332 $RM "${realname}T" && \ 10333 $MV "${realname}U" "$realname" ) 10334 fi 10335 10336 exit $lt_exit 10337 } 10338 done 10339 IFS=$save_ifs 10340 10341 # Restore the uninstalled library and exit 10342 if test relink = "$opt_mode"; then 10343 $opt_dry_run || eval '(cd $output_objdir && $RM ${realname}T && $MV $realname ${realname}T && $MV ${realname}U $realname)' || exit $? 10344 10345 if test -n "$convenience"; then 10346 if test -z "$whole_archive_flag_spec"; then 10347 func_show_eval '${RM}r "$gentop"' 10348 fi 10349 fi 10350 10351 exit $EXIT_SUCCESS 10352 fi 10353 10354 # Create links to the real library. 10355 for linkname in $linknames; do 10356 if test "$realname" != "$linkname"; then 10357 func_show_eval '(cd "$output_objdir" && $RM "$linkname" && $LN_S "$realname" "$linkname")' 'exit $?' 10358 fi 10359 done 10360 10361 # If -module or -export-dynamic was specified, set the dlname. 10362 if test yes = "$module" || test yes = "$export_dynamic"; then 10363 # On all known operating systems, these are identical. 10364 dlname=$soname 10365 fi 10366 fi 10367 ;; 10368 10369 obj) 10370 if test -n "$dlfiles$dlprefiles" || test no != "$dlself"; then 10371 func_warning "'-dlopen' is ignored for objects" 10372 fi 10373 10374 case " $deplibs" in 10375 *\ -l* | *\ -L*) 10376 func_warning "'-l' and '-L' are ignored for objects" ;; 10377 esac 10378 10379 test -n "$rpath" && \ 10380 func_warning "'-rpath' is ignored for objects" 10381 10382 test -n "$xrpath" && \ 10383 func_warning "'-R' is ignored for objects" 10384 10385 test -n "$vinfo" && \ 10386 func_warning "'-version-info' is ignored for objects" 10387 10388 test -n "$release" && \ 10389 func_warning "'-release' is ignored for objects" 10390 10391 case $output in 10392 *.lo) 10393 test -n "$objs$old_deplibs" && \ 10394 func_fatal_error "cannot build library object '$output' from non-libtool objects" 10395 10396 libobj=$output 10397 func_lo2o "$libobj" 10398 obj=$func_lo2o_result 10399 ;; 10400 *) 10401 libobj= 10402 obj=$output 10403 ;; 10404 esac 10405 10406 # Delete the old objects. 10407 $opt_dry_run || $RM $obj $libobj 10408 10409 # Objects from convenience libraries. This assumes 10410 # single-version convenience libraries. Whenever we create 10411 # different ones for PIC/non-PIC, this we'll have to duplicate 10412 # the extraction. 10413 reload_conv_objs= 10414 gentop= 10415 # if reload_cmds runs $LD directly, get rid of -Wl from 10416 # whole_archive_flag_spec and hope we can get by with turning comma 10417 # into space. 10418 case $reload_cmds in 10419 *\$LD[\ \$]*) wl= ;; 10420 esac 10421 if test -n "$convenience"; then 10422 if test -n "$whole_archive_flag_spec"; then 10423 eval tmp_whole_archive_flags=\"$whole_archive_flag_spec\" 10424 test -n "$wl" || tmp_whole_archive_flags=`$ECHO "$tmp_whole_archive_flags" | $SED 's|,| |g'` 10425 reload_conv_objs=$reload_objs\ $tmp_whole_archive_flags 10426 else 10427 gentop=$output_objdir/${obj}x 10428 func_append generated " $gentop" 10429 10430 func_extract_archives $gentop $convenience 10431 reload_conv_objs="$reload_objs $func_extract_archives_result" 10432 fi 10433 fi 10434 10435 # If we're not building shared, we need to use non_pic_objs 10436 test yes = "$build_libtool_libs" || libobjs=$non_pic_objects 10437 10438 # Create the old-style object. 10439 reload_objs=$objs$old_deplibs' '`$ECHO "$libobjs" | $SP2NL | $SED "/\.$libext$/d; /\.lib$/d; $lo2o" | $NL2SP`' '$reload_conv_objs 10440 10441 output=$obj 10442 func_execute_cmds "$reload_cmds" 'exit $?' 10443 10444 # Exit if we aren't doing a library object file. 10445 if test -z "$libobj"; then 10446 if test -n "$gentop"; then 10447 func_show_eval '${RM}r "$gentop"' 10448 fi 10449 10450 exit $EXIT_SUCCESS 10451 fi 10452 10453 test yes = "$build_libtool_libs" || { 10454 if test -n "$gentop"; then 10455 func_show_eval '${RM}r "$gentop"' 10456 fi 10457 10458 # Create an invalid libtool object if no PIC, so that we don't 10459 # accidentally link it into a program. 10460 # $show "echo timestamp > $libobj" 10461 # $opt_dry_run || eval "echo timestamp > $libobj" || exit $? 10462 exit $EXIT_SUCCESS 10463 } 10464 10465 if test -n "$pic_flag" || test default != "$pic_mode"; then 10466 # Only do commands if we really have different PIC objects. 10467 reload_objs="$libobjs $reload_conv_objs" 10468 output=$libobj 10469 func_execute_cmds "$reload_cmds" 'exit $?' 10470 fi 10471 10472 if test -n "$gentop"; then 10473 func_show_eval '${RM}r "$gentop"' 10474 fi 10475 10476 exit $EXIT_SUCCESS 10477 ;; 10478 10479 prog) 10480 case $host in 10481 *cygwin*) func_stripname '' '.exe' "$output" 10482 output=$func_stripname_result.exe;; 10483 esac 10484 test -n "$vinfo" && \ 10485 func_warning "'-version-info' is ignored for programs" 10486 10487 test -n "$release" && \ 10488 func_warning "'-release' is ignored for programs" 10489 10490 $preload \ 10491 && test unknown,unknown,unknown = "$dlopen_support,$dlopen_self,$dlopen_self_static" \ 10492 && func_warning "'LT_INIT([dlopen])' not used. Assuming no dlopen support." 10493 10494 case $host in 10495 *-*-rhapsody* | *-*-darwin1.[012]) 10496 # On Rhapsody replace the C library is the System framework 10497 compile_deplibs=`$ECHO " $compile_deplibs" | $SED 's/ -lc / System.ltframework /'` 10498 finalize_deplibs=`$ECHO " $finalize_deplibs" | $SED 's/ -lc / System.ltframework /'` 10499 ;; 10500 esac 10501 10502 case $host in 10503 *-*-darwin*) 10504 # Don't allow lazy linking, it breaks C++ global constructors 10505 # But is supposedly fixed on 10.4 or later (yay!). 10506 if test CXX = "$tagname"; then 10507 case ${MACOSX_DEPLOYMENT_TARGET-10.0} in 10508 10.[0123]) 10509 func_append compile_command " $wl-bind_at_load" 10510 func_append finalize_command " $wl-bind_at_load" 10511 ;; 10512 esac 10513 fi 10514 # Time to change all our "foo.ltframework" stuff back to "-framework foo" 10515 compile_deplibs=`$ECHO " $compile_deplibs" | $SED 's% \([^ $]*\).ltframework% -framework \1%g'` 10516 finalize_deplibs=`$ECHO " $finalize_deplibs" | $SED 's% \([^ $]*\).ltframework% -framework \1%g'` 10517 ;; 10518 esac 10519 10520 10521 # move library search paths that coincide with paths to not yet 10522 # installed libraries to the beginning of the library search list 10523 new_libs= 10524 for path in $notinst_path; do 10525 case " $new_libs " in 10526 *" -L$path/$objdir "*) ;; 10527 *) 10528 case " $compile_deplibs " in 10529 *" -L$path/$objdir "*) 10530 func_append new_libs " -L$path/$objdir" ;; 10531 esac 10532 ;; 10533 esac 10534 done 10535 for deplib in $compile_deplibs; do 10536 case $deplib in 10537 -L*) 10538 case " $new_libs " in 10539 *" $deplib "*) ;; 10540 *) func_append new_libs " $deplib" ;; 10541 esac 10542 ;; 10543 *) func_append new_libs " $deplib" ;; 10544 esac 10545 done 10546 compile_deplibs=$new_libs 10547 10548 10549 func_append compile_command " $compile_deplibs" 10550 func_append finalize_command " $finalize_deplibs" 10551 10552 if test -n "$rpath$xrpath"; then 10553 # If the user specified any rpath flags, then add them. 10554 for libdir in $rpath $xrpath; do 10555 # This is the magic to use -rpath. 10556 case "$finalize_rpath " in 10557 *" $libdir "*) ;; 10558 *) func_append finalize_rpath " $libdir" ;; 10559 esac 10560 done 10561 fi 10562 10563 # Now hardcode the library paths 10564 rpath= 10565 hardcode_libdirs= 10566 for libdir in $compile_rpath $finalize_rpath; do 10567 if test -n "$hardcode_libdir_flag_spec"; then 10568 if test -n "$hardcode_libdir_separator"; then 10569 if test -z "$hardcode_libdirs"; then 10570 hardcode_libdirs=$libdir 10571 else 10572 # Just accumulate the unique libdirs. 10573 case $hardcode_libdir_separator$hardcode_libdirs$hardcode_libdir_separator in 10574 *"$hardcode_libdir_separator$libdir$hardcode_libdir_separator"*) 10575 ;; 10576 *) 10577 func_append hardcode_libdirs "$hardcode_libdir_separator$libdir" 10578 ;; 10579 esac 10580 fi 10581 else 10582 eval flag=\"$hardcode_libdir_flag_spec\" 10583 func_append rpath " $flag" 10584 fi 10585 elif test -n "$runpath_var"; then 10586 case "$perm_rpath " in 10587 *" $libdir "*) ;; 10588 *) func_append perm_rpath " $libdir" ;; 10589 esac 10590 fi 10591 case $host in 10592 *-*-cygwin* | *-*-mingw* | *-*-pw32* | *-*-os2* | *-cegcc*) 10593 testbindir=`$ECHO "$libdir" | $SED -e 's*/lib$*/bin*'` 10594 case :$dllsearchpath: in 10595 *":$libdir:"*) ;; 10596 ::) dllsearchpath=$libdir;; 10597 *) func_append dllsearchpath ":$libdir";; 10598 esac 10599 case :$dllsearchpath: in 10600 *":$testbindir:"*) ;; 10601 ::) dllsearchpath=$testbindir;; 10602 *) func_append dllsearchpath ":$testbindir";; 10603 esac 10604 ;; 10605 esac 10606 done 10607 # Substitute the hardcoded libdirs into the rpath. 10608 if test -n "$hardcode_libdir_separator" && 10609 test -n "$hardcode_libdirs"; then 10610 libdir=$hardcode_libdirs 10611 eval rpath=\" $hardcode_libdir_flag_spec\" 10612 fi 10613 compile_rpath=$rpath 10614 10615 rpath= 10616 hardcode_libdirs= 10617 for libdir in $finalize_rpath; do 10618 if test -n "$hardcode_libdir_flag_spec"; then 10619 if test -n "$hardcode_libdir_separator"; then 10620 if test -z "$hardcode_libdirs"; then 10621 hardcode_libdirs=$libdir 10622 else 10623 # Just accumulate the unique libdirs. 10624 case $hardcode_libdir_separator$hardcode_libdirs$hardcode_libdir_separator in 10625 *"$hardcode_libdir_separator$libdir$hardcode_libdir_separator"*) 10626 ;; 10627 *) 10628 func_append hardcode_libdirs "$hardcode_libdir_separator$libdir" 10629 ;; 10630 esac 10631 fi 10632 else 10633 eval flag=\"$hardcode_libdir_flag_spec\" 10634 func_append rpath " $flag" 10635 fi 10636 elif test -n "$runpath_var"; then 10637 case "$finalize_perm_rpath " in 10638 *" $libdir "*) ;; 10639 *) func_append finalize_perm_rpath " $libdir" ;; 10640 esac 10641 fi 10642 done 10643 # Substitute the hardcoded libdirs into the rpath. 10644 if test -n "$hardcode_libdir_separator" && 10645 test -n "$hardcode_libdirs"; then 10646 libdir=$hardcode_libdirs 10647 eval rpath=\" $hardcode_libdir_flag_spec\" 10648 fi 10649 finalize_rpath=$rpath 10650 10651 if test -n "$libobjs" && test yes = "$build_old_libs"; then 10652 # Transform all the library objects into standard objects. 10653 compile_command=`$ECHO "$compile_command" | $SP2NL | $SED "$lo2o" | $NL2SP` 10654 finalize_command=`$ECHO "$finalize_command" | $SP2NL | $SED "$lo2o" | $NL2SP` 10655 fi 10656 10657 func_generate_dlsyms "$outputname" "@PROGRAM@" false 10658 10659 # template prelinking step 10660 if test -n "$prelink_cmds"; then 10661 func_execute_cmds "$prelink_cmds" 'exit $?' 10662 fi 10663 10664 wrappers_required=: 10665 case $host in 10666 *cegcc* | *mingw32ce*) 10667 # Disable wrappers for cegcc and mingw32ce hosts, we are cross compiling anyway. 10668 wrappers_required=false 10669 ;; 10670 *cygwin* | *mingw* ) 10671 test yes = "$build_libtool_libs" || wrappers_required=false 10672 ;; 10673 *) 10674 if test no = "$need_relink" || test yes != "$build_libtool_libs"; then 10675 wrappers_required=false 10676 fi 10677 ;; 10678 esac 10679 $wrappers_required || { 10680 # Replace the output file specification. 10681 compile_command=`$ECHO "$compile_command" | $SED 's%@OUTPUT@%'"$output"'%g'` 10682 link_command=$compile_command$compile_rpath 10683 10684 # We have no uninstalled library dependencies, so finalize right now. 10685 exit_status=0 10686 func_show_eval "$link_command" 'exit_status=$?' 10687 10688 if test -n "$postlink_cmds"; then 10689 func_to_tool_file "$output" 10690 postlink_cmds=`func_echo_all "$postlink_cmds" | $SED -e 's%@OUTPUT@%'"$output"'%g' -e 's%@TOOL_OUTPUT@%'"$func_to_tool_file_result"'%g'` 10691 func_execute_cmds "$postlink_cmds" 'exit $?' 10692 fi 10693 10694 # Delete the generated files. 10695 if test -f "$output_objdir/${outputname}S.$objext"; then 10696 func_show_eval '$RM "$output_objdir/${outputname}S.$objext"' 10697 fi 10698 10699 exit $exit_status 10700 } 10701 10702 if test -n "$compile_shlibpath$finalize_shlibpath"; then 10703 compile_command="$shlibpath_var=\"$compile_shlibpath$finalize_shlibpath\$$shlibpath_var\" $compile_command" 10704 fi 10705 if test -n "$finalize_shlibpath"; then 10706 finalize_command="$shlibpath_var=\"$finalize_shlibpath\$$shlibpath_var\" $finalize_command" 10707 fi 10708 10709 compile_var= 10710 finalize_var= 10711 if test -n "$runpath_var"; then 10712 if test -n "$perm_rpath"; then 10713 # We should set the runpath_var. 10714 rpath= 10715 for dir in $perm_rpath; do 10716 func_append rpath "$dir:" 10717 done 10718 compile_var="$runpath_var=\"$rpath\$$runpath_var\" " 10719 fi 10720 if test -n "$finalize_perm_rpath"; then 10721 # We should set the runpath_var. 10722 rpath= 10723 for dir in $finalize_perm_rpath; do 10724 func_append rpath "$dir:" 10725 done 10726 finalize_var="$runpath_var=\"$rpath\$$runpath_var\" " 10727 fi 10728 fi 10729 10730 if test yes = "$no_install"; then 10731 # We don't need to create a wrapper script. 10732 link_command=$compile_var$compile_command$compile_rpath 10733 # Replace the output file specification. 10734 link_command=`$ECHO "$link_command" | $SED 's%@OUTPUT@%'"$output"'%g'` 10735 # Delete the old output file. 10736 $opt_dry_run || $RM $output 10737 # Link the executable and exit 10738 func_show_eval "$link_command" 'exit $?' 10739 10740 if test -n "$postlink_cmds"; then 10741 func_to_tool_file "$output" 10742 postlink_cmds=`func_echo_all "$postlink_cmds" | $SED -e 's%@OUTPUT@%'"$output"'%g' -e 's%@TOOL_OUTPUT@%'"$func_to_tool_file_result"'%g'` 10743 func_execute_cmds "$postlink_cmds" 'exit $?' 10744 fi 10745 10746 exit $EXIT_SUCCESS 10747 fi 10748 10749 case $hardcode_action,$fast_install in 10750 relink,*) 10751 # Fast installation is not supported 10752 link_command=$compile_var$compile_command$compile_rpath 10753 relink_command=$finalize_var$finalize_command$finalize_rpath 10754 10755 func_warning "this platform does not like uninstalled shared libraries" 10756 func_warning "'$output' will be relinked during installation" 10757 ;; 10758 *,yes) 10759 link_command=$finalize_var$compile_command$finalize_rpath 10760 relink_command=`$ECHO "$compile_var$compile_command$compile_rpath" | $SED 's%@OUTPUT@%\$progdir/\$file%g'` 10761 ;; 10762 *,no) 10763 link_command=$compile_var$compile_command$compile_rpath 10764 relink_command=$finalize_var$finalize_command$finalize_rpath 10765 ;; 10766 *,needless) 10767 link_command=$finalize_var$compile_command$finalize_rpath 10768 relink_command= 10769 ;; 10770 esac 10771 10772 # Replace the output file specification. 10773 link_command=`$ECHO "$link_command" | $SED 's%@OUTPUT@%'"$output_objdir/$outputname"'%g'` 10774 10775 # Delete the old output files. 10776 $opt_dry_run || $RM $output $output_objdir/$outputname $output_objdir/lt-$outputname 10777 10778 func_show_eval "$link_command" 'exit $?' 10779 10780 if test -n "$postlink_cmds"; then 10781 func_to_tool_file "$output_objdir/$outputname" 10782 postlink_cmds=`func_echo_all "$postlink_cmds" | $SED -e 's%@OUTPUT@%'"$output_objdir/$outputname"'%g' -e 's%@TOOL_OUTPUT@%'"$func_to_tool_file_result"'%g'` 10783 func_execute_cmds "$postlink_cmds" 'exit $?' 10784 fi 10785 10786 # Now create the wrapper script. 10787 func_verbose "creating $output" 10788 10789 # Quote the relink command for shipping. 10790 if test -n "$relink_command"; then 10791 # Preserve any variables that may affect compiler behavior 10792 for var in $variables_saved_for_relink; do 10793 if eval test -z \"\${$var+set}\"; then 10794 relink_command="{ test -z \"\${$var+set}\" || $lt_unset $var || { $var=; export $var; }; }; $relink_command" 10795 elif eval var_value=\$$var; test -z "$var_value"; then 10796 relink_command="$var=; export $var; $relink_command" 10797 else 10798 func_quote_arg pretty "$var_value" 10799 relink_command="$var=$func_quote_arg_result; export $var; $relink_command" 10800 fi 10801 done 10802 func_quote eval cd "`pwd`" 10803 func_quote_arg pretty,unquoted "($func_quote_result; $relink_command)" 10804 relink_command=$func_quote_arg_unquoted_result 10805 fi 10806 10807 # Only actually do things if not in dry run mode. 10808 $opt_dry_run || { 10809 # win32 will think the script is a binary if it has 10810 # a .exe suffix, so we strip it off here. 10811 case $output in 10812 *.exe) func_stripname '' '.exe' "$output" 10813 output=$func_stripname_result ;; 10814 esac 10815 # test for cygwin because mv fails w/o .exe extensions 10816 case $host in 10817 *cygwin*) 10818 exeext=.exe 10819 func_stripname '' '.exe' "$outputname" 10820 outputname=$func_stripname_result ;; 10821 *) exeext= ;; 10822 esac 10823 case $host in 10824 *cygwin* | *mingw* ) 10825 func_dirname_and_basename "$output" "" "." 10826 output_name=$func_basename_result 10827 output_path=$func_dirname_result 10828 cwrappersource=$output_path/$objdir/lt-$output_name.c 10829 cwrapper=$output_path/$output_name.exe 10830 $RM $cwrappersource $cwrapper 10831 trap "$RM $cwrappersource $cwrapper; exit $EXIT_FAILURE" 1 2 15 10832 10833 func_emit_cwrapperexe_src > $cwrappersource 10834 10835 # The wrapper executable is built using the $host compiler, 10836 # because it contains $host paths and files. If cross- 10837 # compiling, it, like the target executable, must be 10838 # executed on the $host or under an emulation environment. 10839 $opt_dry_run || { 10840 $LTCC $LTCFLAGS -o $cwrapper $cwrappersource 10841 $STRIP $cwrapper 10842 } 10843 10844 # Now, create the wrapper script for func_source use: 10845 func_ltwrapper_scriptname $cwrapper 10846 $RM $func_ltwrapper_scriptname_result 10847 trap "$RM $func_ltwrapper_scriptname_result; exit $EXIT_FAILURE" 1 2 15 10848 $opt_dry_run || { 10849 # note: this script will not be executed, so do not chmod. 10850 if test "x$build" = "x$host"; then 10851 $cwrapper --lt-dump-script > $func_ltwrapper_scriptname_result 10852 else 10853 func_emit_wrapper no > $func_ltwrapper_scriptname_result 10854 fi 10855 } 10856 ;; 10857 * ) 10858 $RM $output 10859 trap "$RM $output; exit $EXIT_FAILURE" 1 2 15 10860 10861 func_emit_wrapper no > $output 10862 chmod +x $output 10863 ;; 10864 esac 10865 } 10866 exit $EXIT_SUCCESS 10867 ;; 10868 esac 10869 10870 # See if we need to build an old-fashioned archive. 10871 for oldlib in $oldlibs; do 10872 10873 case $build_libtool_libs in 10874 convenience) 10875 oldobjs="$libobjs_save $symfileobj" 10876 addlibs=$convenience 10877 build_libtool_libs=no 10878 ;; 10879 module) 10880 oldobjs=$libobjs_save 10881 addlibs=$old_convenience 10882 build_libtool_libs=no 10883 ;; 10884 *) 10885 oldobjs="$old_deplibs $non_pic_objects" 10886 $preload && test -f "$symfileobj" \ 10887 && func_append oldobjs " $symfileobj" 10888 addlibs=$old_convenience 10889 ;; 10890 esac 10891 10892 if test -n "$addlibs"; then 10893 gentop=$output_objdir/${outputname}x 10894 func_append generated " $gentop" 10895 10896 func_extract_archives $gentop $addlibs 10897 func_append oldobjs " $func_extract_archives_result" 10898 fi 10899 10900 # Do each command in the archive commands. 10901 if test -n "$old_archive_from_new_cmds" && test yes = "$build_libtool_libs"; then 10902 cmds=$old_archive_from_new_cmds 10903 else 10904 10905 # Add any objects from preloaded convenience libraries 10906 if test -n "$dlprefiles"; then 10907 gentop=$output_objdir/${outputname}x 10908 func_append generated " $gentop" 10909 10910 func_extract_archives $gentop $dlprefiles 10911 func_append oldobjs " $func_extract_archives_result" 10912 fi 10913 10914 # POSIX demands no paths to be encoded in archives. We have 10915 # to avoid creating archives with duplicate basenames if we 10916 # might have to extract them afterwards, e.g., when creating a 10917 # static archive out of a convenience library, or when linking 10918 # the entirety of a libtool archive into another (currently 10919 # not supported by libtool). 10920 if (for obj in $oldobjs 10921 do 10922 func_basename "$obj" 10923 $ECHO "$func_basename_result" 10924 done | sort | sort -uc >/dev/null 2>&1); then 10925 : 10926 else 10927 echo "copying selected object files to avoid basename conflicts..." 10928 gentop=$output_objdir/${outputname}x 10929 func_append generated " $gentop" 10930 func_mkdir_p "$gentop" 10931 save_oldobjs=$oldobjs 10932 oldobjs= 10933 counter=1 10934 for obj in $save_oldobjs 10935 do 10936 func_basename "$obj" 10937 objbase=$func_basename_result 10938 case " $oldobjs " in 10939 " ") oldobjs=$obj ;; 10940 *[\ /]"$objbase "*) 10941 while :; do 10942 # Make sure we don't pick an alternate name that also 10943 # overlaps. 10944 newobj=lt$counter-$objbase 10945 func_arith $counter + 1 10946 counter=$func_arith_result 10947 case " $oldobjs " in 10948 *[\ /]"$newobj "*) ;; 10949 *) if test ! -f "$gentop/$newobj"; then break; fi ;; 10950 esac 10951 done 10952 func_show_eval "ln $obj $gentop/$newobj || cp $obj $gentop/$newobj" 10953 func_append oldobjs " $gentop/$newobj" 10954 ;; 10955 *) func_append oldobjs " $obj" ;; 10956 esac 10957 done 10958 fi 10959 func_to_tool_file "$oldlib" func_convert_file_msys_to_w32 10960 tool_oldlib=$func_to_tool_file_result 10961 eval cmds=\"$old_archive_cmds\" 10962 10963 func_len " $cmds" 10964 len=$func_len_result 10965 if test "$len" -lt "$max_cmd_len" || test "$max_cmd_len" -le -1; then 10966 cmds=$old_archive_cmds 10967 elif test -n "$archiver_list_spec"; then 10968 func_verbose "using command file archive linking..." 10969 for obj in $oldobjs 10970 do 10971 func_to_tool_file "$obj" 10972 $ECHO "$func_to_tool_file_result" 10973 done > $output_objdir/$libname.libcmd 10974 func_to_tool_file "$output_objdir/$libname.libcmd" 10975 oldobjs=" $archiver_list_spec$func_to_tool_file_result" 10976 cmds=$old_archive_cmds 10977 else 10978 # the command line is too long to link in one step, link in parts 10979 func_verbose "using piecewise archive linking..." 10980 save_RANLIB=$RANLIB 10981 RANLIB=: 10982 objlist= 10983 concat_cmds= 10984 save_oldobjs=$oldobjs 10985 oldobjs= 10986 # Is there a better way of finding the last object in the list? 10987 for obj in $save_oldobjs 10988 do 10989 last_oldobj=$obj 10990 done 10991 eval test_cmds=\"$old_archive_cmds\" 10992 func_len " $test_cmds" 10993 len0=$func_len_result 10994 len=$len0 10995 for obj in $save_oldobjs 10996 do 10997 func_len " $obj" 10998 func_arith $len + $func_len_result 10999 len=$func_arith_result 11000 func_append objlist " $obj" 11001 if test "$len" -lt "$max_cmd_len"; then 11002 : 11003 else 11004 # the above command should be used before it gets too long 11005 oldobjs=$objlist 11006 if test "$obj" = "$last_oldobj"; then 11007 RANLIB=$save_RANLIB 11008 fi 11009 test -z "$concat_cmds" || concat_cmds=$concat_cmds~ 11010 eval concat_cmds=\"\$concat_cmds$old_archive_cmds\" 11011 objlist= 11012 len=$len0 11013 fi 11014 done 11015 RANLIB=$save_RANLIB 11016 oldobjs=$objlist 11017 if test -z "$oldobjs"; then 11018 eval cmds=\"\$concat_cmds\" 11019 else 11020 eval cmds=\"\$concat_cmds~\$old_archive_cmds\" 11021 fi 11022 fi 11023 fi 11024 func_execute_cmds "$cmds" 'exit $?' 11025 done 11026 11027 test -n "$generated" && \ 11028 func_show_eval "${RM}r$generated" 11029 11030 # Now create the libtool archive. 11031 case $output in 11032 *.la) 11033 old_library= 11034 test yes = "$build_old_libs" && old_library=$libname.$libext 11035 func_verbose "creating $output" 11036 11037 # Preserve any variables that may affect compiler behavior 11038 for var in $variables_saved_for_relink; do 11039 if eval test -z \"\${$var+set}\"; then 11040 relink_command="{ test -z \"\${$var+set}\" || $lt_unset $var || { $var=; export $var; }; }; $relink_command" 11041 elif eval var_value=\$$var; test -z "$var_value"; then 11042 relink_command="$var=; export $var; $relink_command" 11043 else 11044 func_quote_arg pretty,unquoted "$var_value" 11045 relink_command="$var=$func_quote_arg_unquoted_result; export $var; $relink_command" 11046 fi 11047 done 11048 # Quote the link command for shipping. 11049 func_quote eval cd "`pwd`" 11050 relink_command="($func_quote_result; $SHELL \"$progpath\" $preserve_args --mode=relink $libtool_args @inst_prefix_dir@)" 11051 func_quote_arg pretty,unquoted "$relink_command" 11052 relink_command=$func_quote_arg_unquoted_result 11053 if test yes = "$hardcode_automatic"; then 11054 relink_command= 11055 fi 11056 11057 # Only create the output if not a dry run. 11058 $opt_dry_run || { 11059 for installed in no yes; do 11060 if test yes = "$installed"; then 11061 if test -z "$install_libdir"; then 11062 break 11063 fi 11064 output=$output_objdir/${outputname}i 11065 # Replace all uninstalled libtool libraries with the installed ones 11066 newdependency_libs= 11067 for deplib in $dependency_libs; do 11068 case $deplib in 11069 *.la) 11070 func_basename "$deplib" 11071 name=$func_basename_result 11072 func_resolve_sysroot "$deplib" 11073 eval libdir=`$SED -n -e 's/^libdir=\(.*\)$/\1/p' $func_resolve_sysroot_result` 11074 test -z "$libdir" && \ 11075 func_fatal_error "'$deplib' is not a valid libtool archive" 11076 func_append newdependency_libs " ${lt_sysroot:+=}$libdir/$name" 11077 ;; 11078 -L*) 11079 func_stripname -L '' "$deplib" 11080 func_replace_sysroot "$func_stripname_result" 11081 func_append newdependency_libs " -L$func_replace_sysroot_result" 11082 ;; 11083 -R*) 11084 func_stripname -R '' "$deplib" 11085 func_replace_sysroot "$func_stripname_result" 11086 func_append newdependency_libs " -R$func_replace_sysroot_result" 11087 ;; 11088 *) func_append newdependency_libs " $deplib" ;; 11089 esac 11090 done 11091 dependency_libs=$newdependency_libs 11092 newdlfiles= 11093 11094 for lib in $dlfiles; do 11095 case $lib in 11096 *.la) 11097 func_basename "$lib" 11098 name=$func_basename_result 11099 eval libdir=`$SED -n -e 's/^libdir=\(.*\)$/\1/p' $lib` 11100 test -z "$libdir" && \ 11101 func_fatal_error "'$lib' is not a valid libtool archive" 11102 func_append newdlfiles " ${lt_sysroot:+=}$libdir/$name" 11103 ;; 11104 *) func_append newdlfiles " $lib" ;; 11105 esac 11106 done 11107 dlfiles=$newdlfiles 11108 newdlprefiles= 11109 for lib in $dlprefiles; do 11110 case $lib in 11111 *.la) 11112 # Only pass preopened files to the pseudo-archive (for 11113 # eventual linking with the app. that links it) if we 11114 # didn't already link the preopened objects directly into 11115 # the library: 11116 func_basename "$lib" 11117 name=$func_basename_result 11118 eval libdir=`$SED -n -e 's/^libdir=\(.*\)$/\1/p' $lib` 11119 test -z "$libdir" && \ 11120 func_fatal_error "'$lib' is not a valid libtool archive" 11121 func_append newdlprefiles " ${lt_sysroot:+=}$libdir/$name" 11122 ;; 11123 esac 11124 done 11125 dlprefiles=$newdlprefiles 11126 else 11127 newdlfiles= 11128 for lib in $dlfiles; do 11129 case $lib in 11130 [\\/]* | [A-Za-z]:[\\/]*) abs=$lib ;; 11131 *) abs=`pwd`"/$lib" ;; 11132 esac 11133 func_append newdlfiles " $abs" 11134 done 11135 dlfiles=$newdlfiles 11136 newdlprefiles= 11137 for lib in $dlprefiles; do 11138 case $lib in 11139 [\\/]* | [A-Za-z]:[\\/]*) abs=$lib ;; 11140 *) abs=`pwd`"/$lib" ;; 11141 esac 11142 func_append newdlprefiles " $abs" 11143 done 11144 dlprefiles=$newdlprefiles 11145 fi 11146 $RM $output 11147 # place dlname in correct position for cygwin 11148 # In fact, it would be nice if we could use this code for all target 11149 # systems that can't hard-code library paths into their executables 11150 # and that have no shared library path variable independent of PATH, 11151 # but it turns out we can't easily determine that from inspecting 11152 # libtool variables, so we have to hard-code the OSs to which it 11153 # applies here; at the moment, that means platforms that use the PE 11154 # object format with DLL files. See the long comment at the top of 11155 # tests/bindir.at for full details. 11156 tdlname=$dlname 11157 case $host,$output,$installed,$module,$dlname in 11158 *cygwin*,*lai,yes,no,*.dll | *mingw*,*lai,yes,no,*.dll | *cegcc*,*lai,yes,no,*.dll) 11159 # If a -bindir argument was supplied, place the dll there. 11160 if test -n "$bindir"; then 11161 func_relative_path "$install_libdir" "$bindir" 11162 tdlname=$func_relative_path_result/$dlname 11163 else 11164 # Otherwise fall back on heuristic. 11165 tdlname=../bin/$dlname 11166 fi 11167 ;; 11168 esac 11169 $ECHO > $output "\ 11170# $outputname - a libtool library file 11171# Generated by $PROGRAM (GNU $PACKAGE) $VERSION 11172# 11173# Please DO NOT delete this file! 11174# It is necessary for linking the library. 11175 11176# The name that we can dlopen(3). 11177dlname='$tdlname' 11178 11179# Names of this library. 11180library_names='$library_names' 11181 11182# The name of the static archive. 11183old_library='$old_library' 11184 11185# Linker flags that cannot go in dependency_libs. 11186inherited_linker_flags='$new_inherited_linker_flags' 11187 11188# Libraries that this one depends upon. 11189dependency_libs='$dependency_libs' 11190 11191# Names of additional weak libraries provided by this library 11192weak_library_names='$weak_libs' 11193 11194# Version information for $libname. 11195current=$current 11196age=$age 11197revision=$revision 11198 11199# Is this an already installed library? 11200installed=$installed 11201 11202# Should we warn about portability when linking against -modules? 11203shouldnotlink=$module 11204 11205# Files to dlopen/dlpreopen 11206dlopen='$dlfiles' 11207dlpreopen='$dlprefiles' 11208 11209# Directory that this library needs to be installed in: 11210libdir='$install_libdir'" 11211 if test no,yes = "$installed,$need_relink" && test -n "$relink_command"; then 11212 $ECHO >> $output "\ 11213relink_command=\"$relink_command\"" 11214 fi 11215 done 11216 } 11217 11218 # Do a symbolic link so that the libtool archive can be found in 11219 # LD_LIBRARY_PATH before the program is installed. 11220 func_show_eval '( cd "$output_objdir" && $RM "$outputname" && $LN_S "../$outputname" "$outputname" )' 'exit $?' 11221 ;; 11222 esac 11223 exit $EXIT_SUCCESS 11224} 11225 11226if test link = "$opt_mode" || test relink = "$opt_mode"; then 11227 func_mode_link ${1+"$@"} 11228fi 11229 11230 11231# func_mode_uninstall arg... 11232func_mode_uninstall () 11233{ 11234 $debug_cmd 11235 11236 RM=$nonopt 11237 files= 11238 rmforce=false 11239 exit_status=0 11240 11241 # This variable tells wrapper scripts just to set variables rather 11242 # than running their programs. 11243 libtool_install_magic=$magic 11244 11245 for arg 11246 do 11247 case $arg in 11248 -f) func_append RM " $arg"; rmforce=: ;; 11249 -*) func_append RM " $arg" ;; 11250 *) func_append files " $arg" ;; 11251 esac 11252 done 11253 11254 test -z "$RM" && \ 11255 func_fatal_help "you must specify an RM program" 11256 11257 rmdirs= 11258 11259 for file in $files; do 11260 func_dirname "$file" "" "." 11261 dir=$func_dirname_result 11262 if test . = "$dir"; then 11263 odir=$objdir 11264 else 11265 odir=$dir/$objdir 11266 fi 11267 func_basename "$file" 11268 name=$func_basename_result 11269 test uninstall = "$opt_mode" && odir=$dir 11270 11271 # Remember odir for removal later, being careful to avoid duplicates 11272 if test clean = "$opt_mode"; then 11273 case " $rmdirs " in 11274 *" $odir "*) ;; 11275 *) func_append rmdirs " $odir" ;; 11276 esac 11277 fi 11278 11279 # Don't error if the file doesn't exist and rm -f was used. 11280 if { test -L "$file"; } >/dev/null 2>&1 || 11281 { test -h "$file"; } >/dev/null 2>&1 || 11282 test -f "$file"; then 11283 : 11284 elif test -d "$file"; then 11285 exit_status=1 11286 continue 11287 elif $rmforce; then 11288 continue 11289 fi 11290 11291 rmfiles=$file 11292 11293 case $name in 11294 *.la) 11295 # Possibly a libtool archive, so verify it. 11296 if func_lalib_p "$file"; then 11297 func_source $dir/$name 11298 11299 # Delete the libtool libraries and symlinks. 11300 for n in $library_names; do 11301 func_append rmfiles " $odir/$n" 11302 done 11303 test -n "$old_library" && func_append rmfiles " $odir/$old_library" 11304 11305 case $opt_mode in 11306 clean) 11307 case " $library_names " in 11308 *" $dlname "*) ;; 11309 *) test -n "$dlname" && func_append rmfiles " $odir/$dlname" ;; 11310 esac 11311 test -n "$libdir" && func_append rmfiles " $odir/$name $odir/${name}i" 11312 ;; 11313 uninstall) 11314 if test -n "$library_names"; then 11315 # Do each command in the postuninstall commands. 11316 func_execute_cmds "$postuninstall_cmds" '$rmforce || exit_status=1' 11317 fi 11318 11319 if test -n "$old_library"; then 11320 # Do each command in the old_postuninstall commands. 11321 func_execute_cmds "$old_postuninstall_cmds" '$rmforce || exit_status=1' 11322 fi 11323 # FIXME: should reinstall the best remaining shared library. 11324 ;; 11325 esac 11326 fi 11327 ;; 11328 11329 *.lo) 11330 # Possibly a libtool object, so verify it. 11331 if func_lalib_p "$file"; then 11332 11333 # Read the .lo file 11334 func_source $dir/$name 11335 11336 # Add PIC object to the list of files to remove. 11337 if test -n "$pic_object" && test none != "$pic_object"; then 11338 func_append rmfiles " $dir/$pic_object" 11339 fi 11340 11341 # Add non-PIC object to the list of files to remove. 11342 if test -n "$non_pic_object" && test none != "$non_pic_object"; then 11343 func_append rmfiles " $dir/$non_pic_object" 11344 fi 11345 fi 11346 ;; 11347 11348 *) 11349 if test clean = "$opt_mode"; then 11350 noexename=$name 11351 case $file in 11352 *.exe) 11353 func_stripname '' '.exe' "$file" 11354 file=$func_stripname_result 11355 func_stripname '' '.exe' "$name" 11356 noexename=$func_stripname_result 11357 # $file with .exe has already been added to rmfiles, 11358 # add $file without .exe 11359 func_append rmfiles " $file" 11360 ;; 11361 esac 11362 # Do a test to see if this is a libtool program. 11363 if func_ltwrapper_p "$file"; then 11364 if func_ltwrapper_executable_p "$file"; then 11365 func_ltwrapper_scriptname "$file" 11366 relink_command= 11367 func_source $func_ltwrapper_scriptname_result 11368 func_append rmfiles " $func_ltwrapper_scriptname_result" 11369 else 11370 relink_command= 11371 func_source $dir/$noexename 11372 fi 11373 11374 # note $name still contains .exe if it was in $file originally 11375 # as does the version of $file that was added into $rmfiles 11376 func_append rmfiles " $odir/$name $odir/${name}S.$objext" 11377 if test yes = "$fast_install" && test -n "$relink_command"; then 11378 func_append rmfiles " $odir/lt-$name" 11379 fi 11380 if test "X$noexename" != "X$name"; then 11381 func_append rmfiles " $odir/lt-$noexename.c" 11382 fi 11383 fi 11384 fi 11385 ;; 11386 esac 11387 func_show_eval "$RM $rmfiles" 'exit_status=1' 11388 done 11389 11390 # Try to remove the $objdir's in the directories where we deleted files 11391 for dir in $rmdirs; do 11392 if test -d "$dir"; then 11393 func_show_eval "rmdir $dir >/dev/null 2>&1" 11394 fi 11395 done 11396 11397 exit $exit_status 11398} 11399 11400if test uninstall = "$opt_mode" || test clean = "$opt_mode"; then 11401 func_mode_uninstall ${1+"$@"} 11402fi 11403 11404test -z "$opt_mode" && { 11405 help=$generic_help 11406 func_fatal_help "you must specify a MODE" 11407} 11408 11409test -z "$exec_cmd" && \ 11410 func_fatal_help "invalid operation mode '$opt_mode'" 11411 11412if test -n "$exec_cmd"; then 11413 eval exec "$exec_cmd" 11414 exit $EXIT_FAILURE 11415fi 11416 11417exit $exit_status 11418 11419 11420# The TAGs below are defined such that we never get into a situation 11421# where we disable both kinds of libraries. Given conflicting 11422# choices, we go for a static library, that is the most portable, 11423# since we can't tell whether shared libraries were disabled because 11424# the user asked for that or because the platform doesn't support 11425# them. This is particularly important on AIX, because we don't 11426# support having both static and shared libraries enabled at the same 11427# time on that platform, so we default to a shared-only configuration. 11428# If a disable-shared tag is given, we'll fallback to a static-only 11429# configuration. But we'll never go from static-only to shared-only. 11430 11431# ### BEGIN LIBTOOL TAG CONFIG: disable-shared 11432build_libtool_libs=no 11433build_old_libs=yes 11434# ### END LIBTOOL TAG CONFIG: disable-shared 11435 11436# ### BEGIN LIBTOOL TAG CONFIG: disable-static 11437build_old_libs=`case $build_libtool_libs in yes) echo no;; *) echo yes;; esac` 11438# ### END LIBTOOL TAG CONFIG: disable-static 11439 11440# Local Variables: 11441# mode:shell-script 11442# sh-indentation:2 11443# End: 11444