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