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