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