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