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