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