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 http://www.gnu.org/licenses/gpl.html, 28# or obtained by writing to the Free Software Foundation, Inc., 29# 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. 30 31# Usage: $progname [OPTION]... [MODE-ARG]... 32# 33# Provide generalized library-building support services. 34# 35# --config show all configuration variables 36# --debug enable verbose shell tracing 37# -n, --dry-run display commands without modifying any files 38# --features display basic configuration information and exit 39# --mode=MODE use operation mode MODE 40# --preserve-dup-deps don't remove duplicate dependency libraries 41# --quiet, --silent don't print informational messages 42# --no-quiet, --no-silent 43# print informational messages (default) 44# --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: <http://www.gnu.org/software/libtool/>. 79# General help using GNU software: <http://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 x86_64-*mingw32*) 6770 func_arith $current - $age 6771 major=$func_arith_result 6772 versuffix="6-$major" 6773 ;; 6774 *cygwin* | mingw* | *cegcc*) 6775 func_arith $current - $age 6776 major=$func_arith_result 6777 versuffix="-$major" 6778 ;; 6779 esac 6780 eval soname=\"$soname_spec\" 6781 else 6782 soname="$realname" 6783 fi 6784 6785 # Make a new name for the extract_expsyms_cmds to use 6786 soroot="$soname" 6787 func_basename "$soroot" 6788 soname="$func_basename_result" 6789 func_stripname 'lib' '.dll' "$soname" 6790 newlib=libimp-$func_stripname_result.a 6791 6792 # If the library has no export list, then create one now 6793 if test -f "$output_objdir/$soname-def"; then : 6794 else 6795 func_verbose "extracting exported symbol list from \`$soname'" 6796 func_execute_cmds "$extract_expsyms_cmds" 'exit $?' 6797 fi 6798 6799 # Create $newlib 6800 if test -f "$output_objdir/$newlib"; then :; else 6801 func_verbose "generating import library for \`$soname'" 6802 func_execute_cmds "$old_archive_from_expsyms_cmds" 'exit $?' 6803 fi 6804 # make sure the library variables are pointing to the new library 6805 dir=$output_objdir 6806 linklib=$newlib 6807 fi # test -n "$old_archive_from_expsyms_cmds" 6808 6809 if test "$linkmode" = prog || test "$opt_mode" != relink; then 6810 add_shlibpath= 6811 add_dir= 6812 add= 6813 lib_linked=yes 6814 case $hardcode_action in 6815 immediate | unsupported) 6816 if test "$hardcode_direct" = no; then 6817 add="$dir/$linklib" 6818 case $host in 6819 *-*-sco3.2v5.0.[024]*) add_dir="-L$dir" ;; 6820 *-*-sysv4*uw2*) add_dir="-L$dir" ;; 6821 *-*-sysv5OpenUNIX* | *-*-sysv5UnixWare7.[01].[10]* | \ 6822 *-*-unixware7*) add_dir="-L$dir" ;; 6823 *-*-darwin* ) 6824 # if the lib is a (non-dlopened) module then we can not 6825 # link against it, someone is ignoring the earlier warnings 6826 if /usr/bin/file -L $add 2> /dev/null | 6827 $GREP ": [^:]* bundle" >/dev/null ; then 6828 if test "X$dlopenmodule" != "X$lib"; then 6829 $ECHO "*** Warning: lib $linklib is a module, not a shared library" 6830 if test -z "$old_library" ; then 6831 echo 6832 echo "*** And there doesn't seem to be a static archive available" 6833 echo "*** The link will probably fail, sorry" 6834 else 6835 add="$dir/$old_library" 6836 fi 6837 elif test -n "$old_library"; then 6838 add="$dir/$old_library" 6839 fi 6840 fi 6841 esac 6842 elif test "$hardcode_minus_L" = no; then 6843 case $host in 6844 *-*-sunos*) add_shlibpath="$dir" ;; 6845 esac 6846 add_dir="-L$dir" 6847 add="-l$name" 6848 elif test "$hardcode_shlibpath_var" = no; then 6849 add_shlibpath="$dir" 6850 add="-l$name" 6851 else 6852 lib_linked=no 6853 fi 6854 ;; 6855 relink) 6856 if test "$hardcode_direct" = yes && 6857 test "$hardcode_direct_absolute" = no; then 6858 add="$dir/$linklib" 6859 elif test "$hardcode_minus_L" = yes; then 6860 add_dir="-L$absdir" 6861 # Try looking first in the location we're being installed to. 6862 if test -n "$inst_prefix_dir"; then 6863 case $libdir in 6864 [\\/]*) 6865 func_append add_dir " -L$inst_prefix_dir$libdir" 6866 ;; 6867 esac 6868 fi 6869 add="-l$name" 6870 elif test "$hardcode_shlibpath_var" = yes; then 6871 add_shlibpath="$dir" 6872 add="-l$name" 6873 else 6874 lib_linked=no 6875 fi 6876 ;; 6877 *) lib_linked=no ;; 6878 esac 6879 6880 if test "$lib_linked" != yes; then 6881 func_fatal_configuration "unsupported hardcode properties" 6882 fi 6883 6884 if test -n "$add_shlibpath"; then 6885 case :$compile_shlibpath: in 6886 *":$add_shlibpath:"*) ;; 6887 *) func_append compile_shlibpath "$add_shlibpath:" ;; 6888 esac 6889 fi 6890 if test "$linkmode" = prog; then 6891 test -n "$add_dir" && compile_deplibs="$add_dir $compile_deplibs" 6892 test -n "$add" && compile_deplibs="$add $compile_deplibs" 6893 else 6894 test -n "$add_dir" && deplibs="$add_dir $deplibs" 6895 test -n "$add" && deplibs="$add $deplibs" 6896 if test "$hardcode_direct" != yes && 6897 test "$hardcode_minus_L" != yes && 6898 test "$hardcode_shlibpath_var" = yes; then 6899 case :$finalize_shlibpath: in 6900 *":$libdir:"*) ;; 6901 *) func_append finalize_shlibpath "$libdir:" ;; 6902 esac 6903 fi 6904 fi 6905 fi 6906 6907 if test "$linkmode" = prog || test "$opt_mode" = relink; then 6908 add_shlibpath= 6909 add_dir= 6910 add= 6911 # Finalize command for both is simple: just hardcode it. 6912 if test "$hardcode_direct" = yes && 6913 test "$hardcode_direct_absolute" = no; then 6914 add="$libdir/$linklib" 6915 elif test "$hardcode_minus_L" = yes; then 6916 add_dir="-L$libdir" 6917 add="-l$name" 6918 elif test "$hardcode_shlibpath_var" = yes; then 6919 case :$finalize_shlibpath: in 6920 *":$libdir:"*) ;; 6921 *) func_append finalize_shlibpath "$libdir:" ;; 6922 esac 6923 add="-l$name" 6924 elif test "$hardcode_automatic" = yes; then 6925 if test -n "$inst_prefix_dir" && 6926 test -f "$inst_prefix_dir$libdir/$linklib" ; then 6927 add="$inst_prefix_dir$libdir/$linklib" 6928 else 6929 add="$libdir/$linklib" 6930 fi 6931 else 6932 # We cannot seem to hardcode it, guess we'll fake it. 6933 add_dir="-L$libdir" 6934 # Try looking first in the location we're being installed to. 6935 if test -n "$inst_prefix_dir"; then 6936 case $libdir in 6937 [\\/]*) 6938 func_append add_dir " -L$inst_prefix_dir$libdir" 6939 ;; 6940 esac 6941 fi 6942 add="-l$name" 6943 fi 6944 6945 if test "$linkmode" = prog; then 6946 test -n "$add_dir" && finalize_deplibs="$add_dir $finalize_deplibs" 6947 test -n "$add" && finalize_deplibs="$add $finalize_deplibs" 6948 else 6949 test -n "$add_dir" && deplibs="$add_dir $deplibs" 6950 test -n "$add" && deplibs="$add $deplibs" 6951 fi 6952 fi 6953 elif test "$linkmode" = prog; then 6954 # Here we assume that one of hardcode_direct or hardcode_minus_L 6955 # is not unsupported. This is valid on all known static and 6956 # shared platforms. 6957 if test "$hardcode_direct" != unsupported; then 6958 test -n "$old_library" && linklib="$old_library" 6959 compile_deplibs="$dir/$linklib $compile_deplibs" 6960 finalize_deplibs="$dir/$linklib $finalize_deplibs" 6961 else 6962 compile_deplibs="-l$name -L$dir $compile_deplibs" 6963 finalize_deplibs="-l$name -L$dir $finalize_deplibs" 6964 fi 6965 elif test "$build_libtool_libs" = yes; then 6966 # Not a shared library 6967 if test "$deplibs_check_method" != pass_all; then 6968 # We're trying link a shared library against a static one 6969 # but the system doesn't support it. 6970 6971 # Just print a warning and add the library to dependency_libs so 6972 # that the program can be linked against the static library. 6973 echo 6974 $ECHO "*** Warning: This system can not link to static lib archive $lib." 6975 echo "*** I have the capability to make that library automatically link in when" 6976 echo "*** you link to this library. But I can only do this if you have a" 6977 echo "*** shared version of the library, which you do not appear to have." 6978 if test "$module" = yes; then 6979 echo "*** But as you try to build a module library, libtool will still create " 6980 echo "*** a static module, that should work as long as the dlopening application" 6981 echo "*** is linked with the -dlopen flag to resolve symbols at runtime." 6982 if test -z "$global_symbol_pipe"; then 6983 echo 6984 echo "*** However, this would only work if libtool was able to extract symbol" 6985 echo "*** lists from a program, using \`nm' or equivalent, but libtool could" 6986 echo "*** not find such a program. So, this module is probably useless." 6987 echo "*** \`nm' from GNU binutils and a full rebuild may help." 6988 fi 6989 if test "$build_old_libs" = no; then 6990 build_libtool_libs=module 6991 build_old_libs=yes 6992 else 6993 build_libtool_libs=no 6994 fi 6995 fi 6996 else 6997 deplibs="$dir/$old_library $deplibs" 6998 link_static=yes 6999 fi 7000 fi # link shared/static library? 7001 7002 if test "$linkmode" = lib; then 7003 if test -n "$dependency_libs" && 7004 { test "$hardcode_into_libs" != yes || 7005 test "$build_old_libs" = yes || 7006 test "$link_static" = yes; }; then 7007 # Extract -R from dependency_libs 7008 temp_deplibs= 7009 for libdir in $dependency_libs; do 7010 case $libdir in 7011 -R*) func_stripname '-R' '' "$libdir" 7012 temp_xrpath=$func_stripname_result 7013 case " $xrpath " in 7014 *" $temp_xrpath "*) ;; 7015 *) func_append xrpath " $temp_xrpath";; 7016 esac;; 7017 *) func_append temp_deplibs " $libdir";; 7018 esac 7019 done 7020 dependency_libs="$temp_deplibs" 7021 fi 7022 7023 func_append newlib_search_path " $absdir" 7024 # Link against this library 7025 test "$link_static" = no && newdependency_libs="$abs_ladir/$laname $newdependency_libs" 7026 # ... and its dependency_libs 7027 tmp_libs= 7028 for deplib in $dependency_libs; do 7029 newdependency_libs="$deplib $newdependency_libs" 7030 case $deplib in 7031 -L*) func_stripname '-L' '' "$deplib" 7032 func_resolve_sysroot "$func_stripname_result";; 7033 *) func_resolve_sysroot "$deplib" ;; 7034 esac 7035 if $opt_preserve_dup_deps ; then 7036 case "$tmp_libs " in 7037 *" $func_resolve_sysroot_result "*) 7038 func_append specialdeplibs " $func_resolve_sysroot_result" ;; 7039 esac 7040 fi 7041 func_append tmp_libs " $func_resolve_sysroot_result" 7042 done 7043 7044 if test "$link_all_deplibs" != no; then 7045 # Add the search paths of all dependency libraries 7046 for deplib in $dependency_libs; do 7047 path= 7048 case $deplib in 7049 -L*) path="$deplib" ;; 7050 *.la) 7051 func_resolve_sysroot "$deplib" 7052 deplib=$func_resolve_sysroot_result 7053 func_dirname "$deplib" "" "." 7054 dir=$func_dirname_result 7055 # We need an absolute path. 7056 case $dir in 7057 [\\/]* | [A-Za-z]:[\\/]*) absdir="$dir" ;; 7058 *) 7059 absdir=`cd "$dir" && pwd` 7060 if test -z "$absdir"; then 7061 func_warning "cannot determine absolute directory name of \`$dir'" 7062 absdir="$dir" 7063 fi 7064 ;; 7065 esac 7066 if $GREP "^installed=no" $deplib > /dev/null; then 7067 case $host in 7068 *-*-darwin*) 7069 depdepl= 7070 eval deplibrary_names=`${SED} -n -e 's/^library_names=\(.*\)$/\1/p' $deplib` 7071 if test -n "$deplibrary_names" ; then 7072 for tmp in $deplibrary_names ; do 7073 depdepl=$tmp 7074 done 7075 if test -f "$absdir/$objdir/$depdepl" ; then 7076 depdepl="$absdir/$objdir/$depdepl" 7077 darwin_install_name=`${OTOOL} -L $depdepl | awk '{if (NR == 2) {print $1;exit}}'` 7078 if test -z "$darwin_install_name"; then 7079 darwin_install_name=`${OTOOL64} -L $depdepl | awk '{if (NR == 2) {print $1;exit}}'` 7080 fi 7081 func_append compiler_flags " ${wl}-dylib_file ${wl}${darwin_install_name}:${depdepl}" 7082 func_append linker_flags " -dylib_file ${darwin_install_name}:${depdepl}" 7083 path= 7084 fi 7085 fi 7086 ;; 7087 *) 7088 path="-L$absdir/$objdir" 7089 ;; 7090 esac 7091 else 7092 eval libdir=`${SED} -n -e 's/^libdir=\(.*\)$/\1/p' $deplib` 7093 test -z "$libdir" && \ 7094 func_fatal_error "\`$deplib' is not a valid libtool archive" 7095 test "$absdir" != "$libdir" && \ 7096 func_warning "\`$deplib' seems to be moved" 7097 7098 path="-L$absdir" 7099 fi 7100 ;; 7101 esac 7102 case " $deplibs " in 7103 *" $path "*) ;; 7104 *) deplibs="$path $deplibs" ;; 7105 esac 7106 done 7107 fi # link_all_deplibs != no 7108 fi # linkmode = lib 7109 done # for deplib in $libs 7110 if test "$pass" = link; then 7111 if test "$linkmode" = "prog"; then 7112 compile_deplibs="$new_inherited_linker_flags $compile_deplibs" 7113 finalize_deplibs="$new_inherited_linker_flags $finalize_deplibs" 7114 else 7115 compiler_flags="$compiler_flags "`$ECHO " $new_inherited_linker_flags" | $SED 's% \([^ $]*\).ltframework% -framework \1%g'` 7116 fi 7117 fi 7118 dependency_libs="$newdependency_libs" 7119 if test "$pass" = dlpreopen; then 7120 # Link the dlpreopened libraries before other libraries 7121 for deplib in $save_deplibs; do 7122 deplibs="$deplib $deplibs" 7123 done 7124 fi 7125 if test "$pass" != dlopen; then 7126 if test "$pass" != conv; then 7127 # Make sure lib_search_path contains only unique directories. 7128 lib_search_path= 7129 for dir in $newlib_search_path; do 7130 case "$lib_search_path " in 7131 *" $dir "*) ;; 7132 *) func_append lib_search_path " $dir" ;; 7133 esac 7134 done 7135 newlib_search_path= 7136 fi 7137 7138 if test "$linkmode,$pass" != "prog,link"; then 7139 vars="deplibs" 7140 else 7141 vars="compile_deplibs finalize_deplibs" 7142 fi 7143 for var in $vars dependency_libs; do 7144 # Add libraries to $var in reverse order 7145 eval tmp_libs=\"\$$var\" 7146 new_libs= 7147 for deplib in $tmp_libs; do 7148 # FIXME: Pedantically, this is the right thing to do, so 7149 # that some nasty dependency loop isn't accidentally 7150 # broken: 7151 #new_libs="$deplib $new_libs" 7152 # Pragmatically, this seems to cause very few problems in 7153 # practice: 7154 case $deplib in 7155 -L*) new_libs="$deplib $new_libs" ;; 7156 -R*) ;; 7157 *) 7158 # And here is the reason: when a library appears more 7159 # than once as an explicit dependence of a library, or 7160 # is implicitly linked in more than once by the 7161 # compiler, it is considered special, and multiple 7162 # occurrences thereof are not removed. Compare this 7163 # with having the same library being listed as a 7164 # dependency of multiple other libraries: in this case, 7165 # we know (pedantically, we assume) the library does not 7166 # need to be listed more than once, so we keep only the 7167 # last copy. This is not always right, but it is rare 7168 # enough that we require users that really mean to play 7169 # such unportable linking tricks to link the library 7170 # using -Wl,-lname, so that libtool does not consider it 7171 # for duplicate removal. 7172 case " $specialdeplibs " in 7173 *" $deplib "*) new_libs="$deplib $new_libs" ;; 7174 *) 7175 case " $new_libs " in 7176 *" $deplib "*) ;; 7177 *) new_libs="$deplib $new_libs" ;; 7178 esac 7179 ;; 7180 esac 7181 ;; 7182 esac 7183 done 7184 tmp_libs= 7185 for deplib in $new_libs; do 7186 case $deplib in 7187 -L*) 7188 case " $tmp_libs " in 7189 *" $deplib "*) ;; 7190 *) func_append tmp_libs " $deplib" ;; 7191 esac 7192 ;; 7193 *) func_append tmp_libs " $deplib" ;; 7194 esac 7195 done 7196 eval $var=\"$tmp_libs\" 7197 done # for var 7198 fi 7199 # Last step: remove runtime libs from dependency_libs 7200 # (they stay in deplibs) 7201 tmp_libs= 7202 for i in $dependency_libs ; do 7203 case " $predeps $postdeps $compiler_lib_search_path " in 7204 *" $i "*) 7205 i="" 7206 ;; 7207 esac 7208 if test -n "$i" ; then 7209 func_append tmp_libs " $i" 7210 fi 7211 done 7212 dependency_libs=$tmp_libs 7213 done # for pass 7214 if test "$linkmode" = prog; then 7215 dlfiles="$newdlfiles" 7216 fi 7217 if test "$linkmode" = prog || test "$linkmode" = lib; then 7218 dlprefiles="$newdlprefiles" 7219 fi 7220 7221 case $linkmode in 7222 oldlib) 7223 if test -n "$dlfiles$dlprefiles" || test "$dlself" != no; then 7224 func_warning "\`-dlopen' is ignored for archives" 7225 fi 7226 7227 case " $deplibs" in 7228 *\ -l* | *\ -L*) 7229 func_warning "\`-l' and \`-L' are ignored for archives" ;; 7230 esac 7231 7232 test -n "$rpath" && \ 7233 func_warning "\`-rpath' is ignored for archives" 7234 7235 test -n "$xrpath" && \ 7236 func_warning "\`-R' is ignored for archives" 7237 7238 test -n "$vinfo" && \ 7239 func_warning "\`-version-info/-version-number' is ignored for archives" 7240 7241 test -n "$release" && \ 7242 func_warning "\`-release' is ignored for archives" 7243 7244 test -n "$export_symbols$export_symbols_regex" && \ 7245 func_warning "\`-export-symbols' is ignored for archives" 7246 7247 # Now set the variables for building old libraries. 7248 build_libtool_libs=no 7249 oldlibs="$output" 7250 func_append objs "$old_deplibs" 7251 ;; 7252 7253 lib) 7254 # Make sure we only generate libraries of the form `libNAME.la'. 7255 case $outputname in 7256 lib*) 7257 func_stripname 'lib' '.la' "$outputname" 7258 name=$func_stripname_result 7259 eval shared_ext=\"$shrext_cmds\" 7260 eval libname=\"$libname_spec\" 7261 ;; 7262 *) 7263 test "$module" = no && \ 7264 func_fatal_help "libtool library \`$output' must begin with \`lib'" 7265 7266 if test "$need_lib_prefix" != no; then 7267 # Add the "lib" prefix for modules if required 7268 func_stripname '' '.la' "$outputname" 7269 name=$func_stripname_result 7270 eval shared_ext=\"$shrext_cmds\" 7271 eval libname=\"$libname_spec\" 7272 else 7273 func_stripname '' '.la' "$outputname" 7274 libname=$func_stripname_result 7275 fi 7276 ;; 7277 esac 7278 7279 if test -n "$objs"; then 7280 if test "$deplibs_check_method" != pass_all; then 7281 func_fatal_error "cannot build libtool library \`$output' from non-libtool objects on this host:$objs" 7282 else 7283 echo 7284 $ECHO "*** Warning: Linking the shared library $output against the non-libtool" 7285 $ECHO "*** objects $objs is not portable!" 7286 func_append libobjs " $objs" 7287 fi 7288 fi 7289 7290 test "$dlself" != no && \ 7291 func_warning "\`-dlopen self' is ignored for libtool libraries" 7292 7293 set dummy $rpath 7294 shift 7295 test "$#" -gt 1 && \ 7296 func_warning "ignoring multiple \`-rpath's for a libtool library" 7297 7298 install_libdir="$1" 7299 7300 oldlibs= 7301 if test -z "$rpath"; then 7302 if test "$build_libtool_libs" = yes; then 7303 # Building a libtool convenience library. 7304 # Some compilers have problems with a `.al' extension so 7305 # convenience libraries should have the same extension an 7306 # archive normally would. 7307 oldlibs="$output_objdir/$libname.$libext $oldlibs" 7308 build_libtool_libs=convenience 7309 build_old_libs=yes 7310 fi 7311 7312 test -n "$vinfo" && \ 7313 func_warning "\`-version-info/-version-number' is ignored for convenience libraries" 7314 7315 test -n "$release" && \ 7316 func_warning "\`-release' is ignored for convenience libraries" 7317 else 7318 7319 # Parse the version information argument. 7320 save_ifs="$IFS"; IFS=':' 7321 set dummy $vinfo 0 0 0 7322 shift 7323 IFS="$save_ifs" 7324 7325 test -n "$7" && \ 7326 func_fatal_help "too many parameters to \`-version-info'" 7327 7328 # convert absolute version numbers to libtool ages 7329 # this retains compatibility with .la files and attempts 7330 # to make the code below a bit more comprehensible 7331 7332 case $vinfo_number in 7333 yes) 7334 number_major="$1" 7335 number_minor="$2" 7336 number_revision="$3" 7337 # 7338 # There are really only two kinds -- those that 7339 # use the current revision as the major version 7340 # and those that subtract age and use age as 7341 # a minor version. But, then there is irix 7342 # which has an extra 1 added just for fun 7343 # 7344 case $version_type in 7345 # correct linux to gnu/linux during the next big refactor 7346 darwin|linux|osf|windows|none) 7347 func_arith $number_major + $number_minor 7348 current=$func_arith_result 7349 age="$number_minor" 7350 revision="$number_revision" 7351 ;; 7352 freebsd-aout|freebsd-elf|qnx|sunos) 7353 current="$number_major" 7354 revision="$number_minor" 7355 age="0" 7356 ;; 7357 irix|nonstopux) 7358 func_arith $number_major + $number_minor 7359 current=$func_arith_result 7360 age="$number_minor" 7361 revision="$number_minor" 7362 lt_irix_increment=no 7363 ;; 7364 *) 7365 func_fatal_configuration "$modename: unknown library version type \`$version_type'" 7366 ;; 7367 esac 7368 ;; 7369 no) 7370 current="$1" 7371 revision="$2" 7372 age="$3" 7373 ;; 7374 esac 7375 7376 # Check that each of the things are valid numbers. 7377 case $current in 7378 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]) ;; 7379 *) 7380 func_error "CURRENT \`$current' must be a nonnegative integer" 7381 func_fatal_error "\`$vinfo' is not valid version information" 7382 ;; 7383 esac 7384 7385 case $revision in 7386 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]) ;; 7387 *) 7388 func_error "REVISION \`$revision' must be a nonnegative integer" 7389 func_fatal_error "\`$vinfo' is not valid version information" 7390 ;; 7391 esac 7392 7393 case $age in 7394 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]) ;; 7395 *) 7396 func_error "AGE \`$age' must be a nonnegative integer" 7397 func_fatal_error "\`$vinfo' is not valid version information" 7398 ;; 7399 esac 7400 7401 if test "$age" -gt "$current"; then 7402 func_error "AGE \`$age' is greater than the current interface number \`$current'" 7403 func_fatal_error "\`$vinfo' is not valid version information" 7404 fi 7405 7406 # Calculate the version variables. 7407 major= 7408 versuffix= 7409 verstring= 7410 case $version_type in 7411 none) ;; 7412 7413 darwin) 7414 # Like Linux, but with the current version available in 7415 # verstring for coding it into the library header 7416 func_arith $current - $age 7417 major=.$func_arith_result 7418 versuffix="$major.$age.$revision" 7419 # Darwin ld doesn't like 0 for these options... 7420 func_arith $current + 1 7421 minor_current=$func_arith_result 7422 xlcverstring="${wl}-compatibility_version ${wl}$minor_current ${wl}-current_version ${wl}$minor_current.$revision" 7423 verstring="-compatibility_version $minor_current -current_version $minor_current.$revision" 7424 ;; 7425 7426 freebsd-aout) 7427 major=".$current" 7428 versuffix=".$current.$revision"; 7429 ;; 7430 7431 freebsd-elf) 7432 major=".$current" 7433 versuffix=".$current" 7434 ;; 7435 7436 irix | nonstopux) 7437 if test "X$lt_irix_increment" = "Xno"; then 7438 func_arith $current - $age 7439 else 7440 func_arith $current - $age + 1 7441 fi 7442 major=$func_arith_result 7443 7444 case $version_type in 7445 nonstopux) verstring_prefix=nonstopux ;; 7446 *) verstring_prefix=sgi ;; 7447 esac 7448 verstring="$verstring_prefix$major.$revision" 7449 7450 # Add in all the interfaces that we are compatible with. 7451 loop=$revision 7452 while test "$loop" -ne 0; do 7453 func_arith $revision - $loop 7454 iface=$func_arith_result 7455 func_arith $loop - 1 7456 loop=$func_arith_result 7457 verstring="$verstring_prefix$major.$iface:$verstring" 7458 done 7459 7460 # Before this point, $major must not contain `.'. 7461 major=.$major 7462 versuffix="$major.$revision" 7463 ;; 7464 7465 linux) # correct to gnu/linux during the next big refactor 7466 func_arith $current - $age 7467 major=.$func_arith_result 7468 versuffix="$major.$age.$revision" 7469 ;; 7470 7471 osf) 7472 func_arith $current - $age 7473 major=.$func_arith_result 7474 versuffix=".$current.$age.$revision" 7475 verstring="$current.$age.$revision" 7476 7477 # Add in all the interfaces that we are compatible with. 7478 loop=$age 7479 while test "$loop" -ne 0; do 7480 func_arith $current - $loop 7481 iface=$func_arith_result 7482 func_arith $loop - 1 7483 loop=$func_arith_result 7484 verstring="$verstring:${iface}.0" 7485 done 7486 7487 # Make executables depend on our current version. 7488 func_append verstring ":${current}.0" 7489 ;; 7490 7491 qnx) 7492 major=".$current" 7493 versuffix=".$current" 7494 ;; 7495 7496 sunos) 7497 major=".$current" 7498 versuffix=".$current.$revision" 7499 ;; 7500 7501 windows) 7502 # Use '-' rather than '.', since we only want one 7503 # extension on DOS 8.3 filesystems. 7504 func_arith $current - $age 7505 major=$func_arith_result 7506 versuffix="-$major" 7507 case $host in 7508 x86_64-*mingw32*) 7509 versuffix="6-$major" 7510 ;; 7511 *) 7512 versuffix="-$major" 7513 ;; 7514 esac 7515 ;; 7516 7517 *) 7518 func_fatal_configuration "unknown library version type \`$version_type'" 7519 ;; 7520 esac 7521 7522 # Clear the version info if we defaulted, and they specified a release. 7523 if test -z "$vinfo" && test -n "$release"; then 7524 major= 7525 case $version_type in 7526 darwin) 7527 # we can't check for "0.0" in archive_cmds due to quoting 7528 # problems, so we reset it completely 7529 verstring= 7530 ;; 7531 *) 7532 verstring="0.0" 7533 ;; 7534 esac 7535 if test "$need_version" = no; then 7536 versuffix= 7537 else 7538 versuffix=".0.0" 7539 fi 7540 fi 7541 7542 # Remove version info from name if versioning should be avoided 7543 if test "$avoid_version" = yes && test "$need_version" = no; then 7544 major= 7545 versuffix= 7546 verstring="" 7547 fi 7548 7549 # Check to see if the archive will have undefined symbols. 7550 if test "$allow_undefined" = yes; then 7551 if test "$allow_undefined_flag" = unsupported; then 7552 func_warning "undefined symbols not allowed in $host shared libraries" 7553 build_libtool_libs=no 7554 build_old_libs=yes 7555 fi 7556 else 7557 # Don't allow undefined symbols. 7558 allow_undefined_flag="$no_undefined_flag" 7559 fi 7560 7561 fi 7562 7563 func_generate_dlsyms "$libname" "$libname" "yes" 7564 func_append libobjs " $symfileobj" 7565 test "X$libobjs" = "X " && libobjs= 7566 7567 if test "$opt_mode" != relink; then 7568 # Remove our outputs, but don't remove object files since they 7569 # may have been created when compiling PIC objects. 7570 removelist= 7571 tempremovelist=`$ECHO "$output_objdir/*"` 7572 for p in $tempremovelist; do 7573 case $p in 7574 *.$objext | *.gcno) 7575 ;; 7576 $output_objdir/$outputname | $output_objdir/$libname.* | $output_objdir/${libname}${release}.*) 7577 if test "X$precious_files_regex" != "X"; then 7578 if $ECHO "$p" | $EGREP -e "$precious_files_regex" >/dev/null 2>&1 7579 then 7580 continue 7581 fi 7582 fi 7583 func_append removelist " $p" 7584 ;; 7585 *) ;; 7586 esac 7587 done 7588 test -n "$removelist" && \ 7589 func_show_eval "${RM}r \$removelist" 7590 fi 7591 7592 # Now set the variables for building old libraries. 7593 if test "$build_old_libs" = yes && test "$build_libtool_libs" != convenience ; then 7594 func_append oldlibs " $output_objdir/$libname.$libext" 7595 7596 # Transform .lo files to .o files. 7597 oldobjs="$objs "`$ECHO "$libobjs" | $SP2NL | $SED "/\.${libext}$/d; $lo2o" | $NL2SP` 7598 fi 7599 7600 # Eliminate all temporary directories. 7601 #for path in $notinst_path; do 7602 # lib_search_path=`$ECHO "$lib_search_path " | $SED "s% $path % %g"` 7603 # deplibs=`$ECHO "$deplibs " | $SED "s% -L$path % %g"` 7604 # dependency_libs=`$ECHO "$dependency_libs " | $SED "s% -L$path % %g"` 7605 #done 7606 7607 if test -n "$xrpath"; then 7608 # If the user specified any rpath flags, then add them. 7609 temp_xrpath= 7610 for libdir in $xrpath; do 7611 func_replace_sysroot "$libdir" 7612 func_append temp_xrpath " -R$func_replace_sysroot_result" 7613 case "$finalize_rpath " in 7614 *" $libdir "*) ;; 7615 *) func_append finalize_rpath " $libdir" ;; 7616 esac 7617 done 7618 if test "$hardcode_into_libs" != yes || test "$build_old_libs" = yes; then 7619 dependency_libs="$temp_xrpath $dependency_libs" 7620 fi 7621 fi 7622 7623 # Make sure dlfiles contains only unique files that won't be dlpreopened 7624 old_dlfiles="$dlfiles" 7625 dlfiles= 7626 for lib in $old_dlfiles; do 7627 case " $dlprefiles $dlfiles " in 7628 *" $lib "*) ;; 7629 *) func_append dlfiles " $lib" ;; 7630 esac 7631 done 7632 7633 # Make sure dlprefiles contains only unique files 7634 old_dlprefiles="$dlprefiles" 7635 dlprefiles= 7636 for lib in $old_dlprefiles; do 7637 case "$dlprefiles " in 7638 *" $lib "*) ;; 7639 *) func_append dlprefiles " $lib" ;; 7640 esac 7641 done 7642 7643 if test "$build_libtool_libs" = yes; then 7644 if test -n "$rpath"; then 7645 case $host in 7646 *-*-cygwin* | *-*-mingw* | *-*-pw32* | *-*-os2* | *-*-beos* | *-cegcc* | *-*-haiku*) 7647 # these systems don't actually have a c library (as such)! 7648 ;; 7649 *-*-rhapsody* | *-*-darwin1.[012]) 7650 # Rhapsody C library is in the System framework 7651 func_append deplibs " System.ltframework" 7652 ;; 7653 *-*-netbsd*) 7654 # Don't link with libc until the a.out ld.so is fixed. 7655 ;; 7656 *-*-openbsd* | *-*-freebsd* | *-*-dragonfly*) 7657 # Do not include libc due to us having libc/libc_r. 7658 ;; 7659 *-*-sco3.2v5* | *-*-sco5v6*) 7660 # Causes problems with __ctype 7661 ;; 7662 *-*-sysv4.2uw2* | *-*-sysv5* | *-*-unixware* | *-*-OpenUNIX*) 7663 # Compiler inserts libc in the correct place for threads to work 7664 ;; 7665 *) 7666 # Add libc to deplibs on all other systems if necessary. 7667 if test "$build_libtool_need_lc" = "yes"; then 7668 func_append deplibs " -lc" 7669 fi 7670 ;; 7671 esac 7672 fi 7673 7674 # Transform deplibs into only deplibs that can be linked in shared. 7675 name_save=$name 7676 libname_save=$libname 7677 release_save=$release 7678 versuffix_save=$versuffix 7679 major_save=$major 7680 # I'm not sure if I'm treating the release correctly. I think 7681 # release should show up in the -l (ie -lgmp5) so we don't want to 7682 # add it in twice. Is that correct? 7683 release="" 7684 versuffix="" 7685 major="" 7686 newdeplibs= 7687 droppeddeps=no 7688 case $deplibs_check_method in 7689 pass_all) 7690 # Don't check for shared/static. Everything works. 7691 # This might be a little naive. We might want to check 7692 # whether the library exists or not. But this is on 7693 # osf3 & osf4 and I'm not really sure... Just 7694 # implementing what was already the behavior. 7695 newdeplibs=$deplibs 7696 ;; 7697 test_compile) 7698 # This code stresses the "libraries are programs" paradigm to its 7699 # limits. Maybe even breaks it. We compile a program, linking it 7700 # against the deplibs as a proxy for the library. Then we can check 7701 # whether they linked in statically or dynamically with ldd. 7702 $opt_dry_run || $RM conftest.c 7703 cat > conftest.c <<EOF 7704 int main() { return 0; } 7705EOF 7706 $opt_dry_run || $RM conftest 7707 if $LTCC $LTCFLAGS -o conftest conftest.c $deplibs; then 7708 ldd_output=`ldd conftest` 7709 for i in $deplibs; do 7710 case $i in 7711 -l*) 7712 func_stripname -l '' "$i" 7713 name=$func_stripname_result 7714 if test "X$allow_libtool_libs_with_static_runtimes" = "Xyes" ; then 7715 case " $predeps $postdeps " in 7716 *" $i "*) 7717 func_append newdeplibs " $i" 7718 i="" 7719 ;; 7720 esac 7721 fi 7722 if test -n "$i" ; then 7723 libname=`eval "\\$ECHO \"$libname_spec\""` 7724 deplib_matches=`eval "\\$ECHO \"$library_names_spec\""` 7725 set dummy $deplib_matches; shift 7726 deplib_match=$1 7727 if test `expr "$ldd_output" : ".*$deplib_match"` -ne 0 ; then 7728 func_append newdeplibs " $i" 7729 else 7730 droppeddeps=yes 7731 echo 7732 $ECHO "*** Warning: dynamic linker does not accept needed library $i." 7733 echo "*** I have the capability to make that library automatically link in when" 7734 echo "*** you link to this library. But I can only do this if you have a" 7735 echo "*** shared version of the library, which I believe you do not have" 7736 echo "*** because a test_compile did reveal that the linker did not use it for" 7737 echo "*** its dynamic dependency list that programs get resolved with at runtime." 7738 fi 7739 fi 7740 ;; 7741 *) 7742 func_append newdeplibs " $i" 7743 ;; 7744 esac 7745 done 7746 else 7747 # Error occurred in the first compile. Let's try to salvage 7748 # the situation: Compile a separate program for each library. 7749 for i in $deplibs; do 7750 case $i in 7751 -l*) 7752 func_stripname -l '' "$i" 7753 name=$func_stripname_result 7754 $opt_dry_run || $RM conftest 7755 if $LTCC $LTCFLAGS -o conftest conftest.c $i; then 7756 ldd_output=`ldd conftest` 7757 if test "X$allow_libtool_libs_with_static_runtimes" = "Xyes" ; then 7758 case " $predeps $postdeps " in 7759 *" $i "*) 7760 func_append newdeplibs " $i" 7761 i="" 7762 ;; 7763 esac 7764 fi 7765 if test -n "$i" ; then 7766 libname=`eval "\\$ECHO \"$libname_spec\""` 7767 deplib_matches=`eval "\\$ECHO \"$library_names_spec\""` 7768 set dummy $deplib_matches; shift 7769 deplib_match=$1 7770 if test `expr "$ldd_output" : ".*$deplib_match"` -ne 0 ; then 7771 func_append newdeplibs " $i" 7772 else 7773 droppeddeps=yes 7774 echo 7775 $ECHO "*** Warning: dynamic linker does not accept needed library $i." 7776 echo "*** I have the capability to make that library automatically link in when" 7777 echo "*** you link to this library. But I can only do this if you have a" 7778 echo "*** shared version of the library, which you do not appear to have" 7779 echo "*** because a test_compile did reveal that the linker did not use this one" 7780 echo "*** as a dynamic dependency that programs can get resolved with at runtime." 7781 fi 7782 fi 7783 else 7784 droppeddeps=yes 7785 echo 7786 $ECHO "*** Warning! Library $i is needed by this library but I was not able to" 7787 echo "*** make it link in! You will probably need to install it or some" 7788 echo "*** library that it depends on before this library will be fully" 7789 echo "*** functional. Installing it before continuing would be even better." 7790 fi 7791 ;; 7792 *) 7793 func_append newdeplibs " $i" 7794 ;; 7795 esac 7796 done 7797 fi 7798 ;; 7799 file_magic*) 7800 set dummy $deplibs_check_method; shift 7801 file_magic_regex=`expr "$deplibs_check_method" : "$1 \(.*\)"` 7802 for a_deplib in $deplibs; do 7803 case $a_deplib in 7804 -l*) 7805 func_stripname -l '' "$a_deplib" 7806 name=$func_stripname_result 7807 if test "X$allow_libtool_libs_with_static_runtimes" = "Xyes" ; then 7808 case " $predeps $postdeps " in 7809 *" $a_deplib "*) 7810 func_append newdeplibs " $a_deplib" 7811 a_deplib="" 7812 ;; 7813 esac 7814 fi 7815 if test -n "$a_deplib" ; then 7816 libname=`eval "\\$ECHO \"$libname_spec\""` 7817 if test -n "$file_magic_glob"; then 7818 libnameglob=`func_echo_all "$libname" | $SED -e $file_magic_glob` 7819 else 7820 libnameglob=$libname 7821 fi 7822 test "$want_nocaseglob" = yes && nocaseglob=`shopt -p nocaseglob` 7823 for i in $lib_search_path $sys_lib_search_path $shlib_search_path; do 7824 if test "$want_nocaseglob" = yes; then 7825 shopt -s nocaseglob 7826 potential_libs=`ls $i/$libnameglob[.-]* 2>/dev/null` 7827 $nocaseglob 7828 else 7829 potential_libs=`ls $i/$libnameglob[.-]* 2>/dev/null` 7830 fi 7831 for potent_lib in $potential_libs; do 7832 # Follow soft links. 7833 if ls -lLd "$potent_lib" 2>/dev/null | 7834 $GREP " -> " >/dev/null; then 7835 continue 7836 fi 7837 # The statement above tries to avoid entering an 7838 # endless loop below, in case of cyclic links. 7839 # We might still enter an endless loop, since a link 7840 # loop can be closed while we follow links, 7841 # but so what? 7842 potlib="$potent_lib" 7843 while test -h "$potlib" 2>/dev/null; do 7844 potliblink=`ls -ld $potlib | ${SED} 's/.* -> //'` 7845 case $potliblink in 7846 [\\/]* | [A-Za-z]:[\\/]*) potlib="$potliblink";; 7847 *) potlib=`$ECHO "$potlib" | $SED 's,[^/]*$,,'`"$potliblink";; 7848 esac 7849 done 7850 if eval $file_magic_cmd \"\$potlib\" 2>/dev/null | 7851 $SED -e 10q | 7852 $EGREP "$file_magic_regex" > /dev/null; then 7853 func_append newdeplibs " $a_deplib" 7854 a_deplib="" 7855 break 2 7856 fi 7857 done 7858 done 7859 fi 7860 if test -n "$a_deplib" ; then 7861 droppeddeps=yes 7862 echo 7863 $ECHO "*** Warning: linker path does not have real file for library $a_deplib." 7864 echo "*** I have the capability to make that library automatically link in when" 7865 echo "*** you link to this library. But I can only do this if you have a" 7866 echo "*** shared version of the library, which you do not appear to have" 7867 echo "*** because I did check the linker path looking for a file starting" 7868 if test -z "$potlib" ; then 7869 $ECHO "*** with $libname but no candidates were found. (...for file magic test)" 7870 else 7871 $ECHO "*** with $libname and none of the candidates passed a file format test" 7872 $ECHO "*** using a file magic. Last file checked: $potlib" 7873 fi 7874 fi 7875 ;; 7876 *) 7877 # Add a -L argument. 7878 func_append newdeplibs " $a_deplib" 7879 ;; 7880 esac 7881 done # Gone through all deplibs. 7882 ;; 7883 match_pattern*) 7884 set dummy $deplibs_check_method; shift 7885 match_pattern_regex=`expr "$deplibs_check_method" : "$1 \(.*\)"` 7886 for a_deplib in $deplibs; do 7887 case $a_deplib in 7888 -l*) 7889 func_stripname -l '' "$a_deplib" 7890 name=$func_stripname_result 7891 if test "X$allow_libtool_libs_with_static_runtimes" = "Xyes" ; then 7892 case " $predeps $postdeps " in 7893 *" $a_deplib "*) 7894 func_append newdeplibs " $a_deplib" 7895 a_deplib="" 7896 ;; 7897 esac 7898 fi 7899 if test -n "$a_deplib" ; then 7900 libname=`eval "\\$ECHO \"$libname_spec\""` 7901 for i in $lib_search_path $sys_lib_search_path $shlib_search_path; do 7902 potential_libs=`ls $i/$libname[.-]* 2>/dev/null` 7903 for potent_lib in $potential_libs; do 7904 potlib="$potent_lib" # see symlink-check above in file_magic test 7905 if eval "\$ECHO \"$potent_lib\"" 2>/dev/null | $SED 10q | \ 7906 $EGREP "$match_pattern_regex" > /dev/null; then 7907 func_append newdeplibs " $a_deplib" 7908 a_deplib="" 7909 break 2 7910 fi 7911 done 7912 done 7913 fi 7914 if test -n "$a_deplib" ; then 7915 droppeddeps=yes 7916 echo 7917 $ECHO "*** Warning: linker path does not have real file for library $a_deplib." 7918 echo "*** I have the capability to make that library automatically link in when" 7919 echo "*** you link to this library. But I can only do this if you have a" 7920 echo "*** shared version of the library, which you do not appear to have" 7921 echo "*** because I did check the linker path looking for a file starting" 7922 if test -z "$potlib" ; then 7923 $ECHO "*** with $libname but no candidates were found. (...for regex pattern test)" 7924 else 7925 $ECHO "*** with $libname and none of the candidates passed a file format test" 7926 $ECHO "*** using a regex pattern. Last file checked: $potlib" 7927 fi 7928 fi 7929 ;; 7930 *) 7931 # Add a -L argument. 7932 func_append newdeplibs " $a_deplib" 7933 ;; 7934 esac 7935 done # Gone through all deplibs. 7936 ;; 7937 none | unknown | *) 7938 newdeplibs="" 7939 tmp_deplibs=`$ECHO " $deplibs" | $SED 's/ -lc$//; s/ -[LR][^ ]*//g'` 7940 if test "X$allow_libtool_libs_with_static_runtimes" = "Xyes" ; then 7941 for i in $predeps $postdeps ; do 7942 # can't use Xsed below, because $i might contain '/' 7943 tmp_deplibs=`$ECHO " $tmp_deplibs" | $SED "s,$i,,"` 7944 done 7945 fi 7946 case $tmp_deplibs in 7947 *[!\ \ ]*) 7948 echo 7949 if test "X$deplibs_check_method" = "Xnone"; then 7950 echo "*** Warning: inter-library dependencies are not supported in this platform." 7951 else 7952 echo "*** Warning: inter-library dependencies are not known to be supported." 7953 fi 7954 echo "*** All declared inter-library dependencies are being dropped." 7955 droppeddeps=yes 7956 ;; 7957 esac 7958 ;; 7959 esac 7960 versuffix=$versuffix_save 7961 major=$major_save 7962 release=$release_save 7963 libname=$libname_save 7964 name=$name_save 7965 7966 case $host in 7967 *-*-rhapsody* | *-*-darwin1.[012]) 7968 # On Rhapsody replace the C library with the System framework 7969 newdeplibs=`$ECHO " $newdeplibs" | $SED 's/ -lc / System.ltframework /'` 7970 ;; 7971 esac 7972 7973 if test "$droppeddeps" = yes; then 7974 if test "$module" = yes; then 7975 echo 7976 echo "*** Warning: libtool could not satisfy all declared inter-library" 7977 $ECHO "*** dependencies of module $libname. Therefore, libtool will create" 7978 echo "*** a static module, that should work as long as the dlopening" 7979 echo "*** application is linked with the -dlopen flag." 7980 if test -z "$global_symbol_pipe"; then 7981 echo 7982 echo "*** However, this would only work if libtool was able to extract symbol" 7983 echo "*** lists from a program, using \`nm' or equivalent, but libtool could" 7984 echo "*** not find such a program. So, this module is probably useless." 7985 echo "*** \`nm' from GNU binutils and a full rebuild may help." 7986 fi 7987 if test "$build_old_libs" = no; then 7988 oldlibs="$output_objdir/$libname.$libext" 7989 build_libtool_libs=module 7990 build_old_libs=yes 7991 else 7992 build_libtool_libs=no 7993 fi 7994 else 7995 echo "*** The inter-library dependencies that have been dropped here will be" 7996 echo "*** automatically added whenever a program is linked with this library" 7997 echo "*** or is declared to -dlopen it." 7998 7999 if test "$allow_undefined" = no; then 8000 echo 8001 echo "*** Since this library must not contain undefined symbols," 8002 echo "*** because either the platform does not support them or" 8003 echo "*** it was explicitly requested with -no-undefined," 8004 echo "*** libtool will only create a static version of it." 8005 if test "$build_old_libs" = no; then 8006 oldlibs="$output_objdir/$libname.$libext" 8007 build_libtool_libs=module 8008 build_old_libs=yes 8009 else 8010 build_libtool_libs=no 8011 fi 8012 fi 8013 fi 8014 fi 8015 # Done checking deplibs! 8016 deplibs=$newdeplibs 8017 fi 8018 # Time to change all our "foo.ltframework" stuff back to "-framework foo" 8019 case $host in 8020 *-*-darwin*) 8021 newdeplibs=`$ECHO " $newdeplibs" | $SED 's% \([^ $]*\).ltframework% -framework \1%g'` 8022 new_inherited_linker_flags=`$ECHO " $new_inherited_linker_flags" | $SED 's% \([^ $]*\).ltframework% -framework \1%g'` 8023 deplibs=`$ECHO " $deplibs" | $SED 's% \([^ $]*\).ltframework% -framework \1%g'` 8024 ;; 8025 esac 8026 8027 # move library search paths that coincide with paths to not yet 8028 # installed libraries to the beginning of the library search list 8029 new_libs= 8030 for path in $notinst_path; do 8031 case " $new_libs " in 8032 *" -L$path/$objdir "*) ;; 8033 *) 8034 case " $deplibs " in 8035 *" -L$path/$objdir "*) 8036 func_append new_libs " -L$path/$objdir" ;; 8037 esac 8038 ;; 8039 esac 8040 done 8041 for deplib in $deplibs; do 8042 case $deplib in 8043 -L*) 8044 case " $new_libs " in 8045 *" $deplib "*) ;; 8046 *) func_append new_libs " $deplib" ;; 8047 esac 8048 ;; 8049 *) func_append new_libs " $deplib" ;; 8050 esac 8051 done 8052 deplibs="$new_libs" 8053 8054 # All the library-specific variables (install_libdir is set above). 8055 library_names= 8056 old_library= 8057 dlname= 8058 8059 # Test again, we may have decided not to build it any more 8060 if test "$build_libtool_libs" = yes; then 8061 # Remove ${wl} instances when linking with ld. 8062 # FIXME: should test the right _cmds variable. 8063 case $archive_cmds in 8064 *\$LD\ *) wl= ;; 8065 esac 8066 if test "$hardcode_into_libs" = yes; then 8067 # Hardcode the library paths 8068 hardcode_libdirs= 8069 dep_rpath= 8070 rpath="$finalize_rpath" 8071 test "$opt_mode" != relink && rpath="$compile_rpath$rpath" 8072 for libdir in $rpath; do 8073 if test -n "$hardcode_libdir_flag_spec"; then 8074 if test -n "$hardcode_libdir_separator"; then 8075 func_replace_sysroot "$libdir" 8076 libdir=$func_replace_sysroot_result 8077 if test -z "$hardcode_libdirs"; then 8078 hardcode_libdirs="$libdir" 8079 else 8080 # Just accumulate the unique libdirs. 8081 case $hardcode_libdir_separator$hardcode_libdirs$hardcode_libdir_separator in 8082 *"$hardcode_libdir_separator$libdir$hardcode_libdir_separator"*) 8083 ;; 8084 *) 8085 func_append hardcode_libdirs "$hardcode_libdir_separator$libdir" 8086 ;; 8087 esac 8088 fi 8089 else 8090 eval flag=\"$hardcode_libdir_flag_spec\" 8091 func_append dep_rpath " $flag" 8092 fi 8093 elif test -n "$runpath_var"; then 8094 case "$perm_rpath " in 8095 *" $libdir "*) ;; 8096 *) func_append perm_rpath " $libdir" ;; 8097 esac 8098 fi 8099 done 8100 # Substitute the hardcoded libdirs into the rpath. 8101 if test -n "$hardcode_libdir_separator" && 8102 test -n "$hardcode_libdirs"; then 8103 libdir="$hardcode_libdirs" 8104 eval "dep_rpath=\"$hardcode_libdir_flag_spec\"" 8105 fi 8106 if test -n "$runpath_var" && test -n "$perm_rpath"; then 8107 # We should set the runpath_var. 8108 rpath= 8109 for dir in $perm_rpath; do 8110 func_append rpath "$dir:" 8111 done 8112 eval "$runpath_var='$rpath\$$runpath_var'; export $runpath_var" 8113 fi 8114 test -n "$dep_rpath" && deplibs="$dep_rpath $deplibs" 8115 fi 8116 8117 shlibpath="$finalize_shlibpath" 8118 test "$opt_mode" != relink && shlibpath="$compile_shlibpath$shlibpath" 8119 if test -n "$shlibpath"; then 8120 eval "$shlibpath_var='$shlibpath\$$shlibpath_var'; export $shlibpath_var" 8121 fi 8122 8123 # Get the real and link names of the library. 8124 eval shared_ext=\"$shrext_cmds\" 8125 eval library_names=\"$library_names_spec\" 8126 set dummy $library_names 8127 shift 8128 realname="$1" 8129 shift 8130 8131 if test -n "$soname_spec"; then 8132 eval soname=\"$soname_spec\" 8133 else 8134 soname="$realname" 8135 fi 8136 if test -z "$dlname"; then 8137 dlname=$soname 8138 fi 8139 8140 lib="$output_objdir/$realname" 8141 linknames= 8142 for link 8143 do 8144 func_append linknames " $link" 8145 done 8146 8147 # Use standard objects if they are pic 8148 test -z "$pic_flag" && libobjs=`$ECHO "$libobjs" | $SP2NL | $SED "$lo2o" | $NL2SP` 8149 test "X$libobjs" = "X " && libobjs= 8150 8151 delfiles= 8152 if test -n "$export_symbols" && test -n "$include_expsyms"; then 8153 $opt_dry_run || cp "$export_symbols" "$output_objdir/$libname.uexp" 8154 export_symbols="$output_objdir/$libname.uexp" 8155 func_append delfiles " $export_symbols" 8156 fi 8157 8158 orig_export_symbols= 8159 case $host_os in 8160 cygwin* | mingw* | cegcc*) 8161 if test -n "$export_symbols" && test -z "$export_symbols_regex"; then 8162 # exporting using user supplied symfile 8163 if test "x`$SED "$sed_uncomment_deffile" $export_symbols | $SED 1q`" != xEXPORTS; then 8164 # and it's NOT already a .def file. Must figure out 8165 # which of the given symbols are data symbols and tag 8166 # them as such. So, trigger use of export_symbols_cmds. 8167 # export_symbols gets reassigned inside the "prepare 8168 # the list of exported symbols" if statement, so the 8169 # include_expsyms logic still works. 8170 orig_export_symbols="$export_symbols" 8171 export_symbols= 8172 always_export_symbols=yes 8173 fi 8174 fi 8175 ;; 8176 esac 8177 8178 # Prepare the list of exported symbols 8179 if test -z "$export_symbols"; then 8180 if test "$always_export_symbols" = yes || test -n "$export_symbols_regex"; then 8181 func_verbose "generating symbol list for \`$libname.la'" 8182 export_symbols="$output_objdir/$libname.exp" 8183 $opt_dry_run || $RM $export_symbols 8184 cmds=$export_symbols_cmds 8185 save_ifs="$IFS"; IFS='~' 8186 for cmd1 in $cmds; do 8187 IFS="$save_ifs" 8188 # Take the normal branch if the nm_file_list_spec branch 8189 # doesn't work or if tool conversion is not needed. 8190 case $nm_file_list_spec~$to_tool_file_cmd in 8191 *~func_convert_file_noop | *~func_convert_file_msys_to_w32 | ~*) 8192 try_normal_branch=yes 8193 eval cmd=\"$cmd1\" 8194 func_len " $cmd" 8195 len=$func_len_result 8196 ;; 8197 *) 8198 try_normal_branch=no 8199 ;; 8200 esac 8201 if test "$try_normal_branch" = yes \ 8202 && { test "$len" -lt "$max_cmd_len" \ 8203 || test "$max_cmd_len" -le -1; } 8204 then 8205 func_show_eval "$cmd" 'exit $?' 8206 skipped_export=false 8207 elif test -n "$nm_file_list_spec"; then 8208 func_basename "$output" 8209 output_la=$func_basename_result 8210 save_libobjs=$libobjs 8211 save_output=$output 8212 output=${output_objdir}/${output_la}.nm 8213 func_to_tool_file "$output" 8214 libobjs=$nm_file_list_spec$func_to_tool_file_result 8215 func_append delfiles " $output" 8216 func_verbose "creating $NM input file list: $output" 8217 for obj in $save_libobjs; do 8218 func_to_tool_file "$obj" 8219 $ECHO "$func_to_tool_file_result" 8220 done > "$output" 8221 eval cmd=\"$cmd1\" 8222 func_show_eval "$cmd" 'exit $?' 8223 output=$save_output 8224 libobjs=$save_libobjs 8225 skipped_export=false 8226 else 8227 # The command line is too long to execute in one step. 8228 func_verbose "using reloadable object file for export list..." 8229 skipped_export=: 8230 # Break out early, otherwise skipped_export may be 8231 # set to false by a later but shorter cmd. 8232 break 8233 fi 8234 done 8235 IFS="$save_ifs" 8236 if test -n "$export_symbols_regex" && test "X$skipped_export" != "X:"; then 8237 func_show_eval '$EGREP -e "$export_symbols_regex" "$export_symbols" > "${export_symbols}T"' 8238 func_show_eval '$MV "${export_symbols}T" "$export_symbols"' 8239 fi 8240 fi 8241 fi 8242 8243 if test -n "$export_symbols" && test -n "$include_expsyms"; then 8244 tmp_export_symbols="$export_symbols" 8245 test -n "$orig_export_symbols" && tmp_export_symbols="$orig_export_symbols" 8246 $opt_dry_run || eval '$ECHO "$include_expsyms" | $SP2NL >> "$tmp_export_symbols"' 8247 fi 8248 8249 if test "X$skipped_export" != "X:" && test -n "$orig_export_symbols"; then 8250 # The given exports_symbols file has to be filtered, so filter it. 8251 func_verbose "filter symbol list for \`$libname.la' to tag DATA exports" 8252 # FIXME: $output_objdir/$libname.filter potentially contains lots of 8253 # 's' commands which not all seds can handle. GNU sed should be fine 8254 # though. Also, the filter scales superlinearly with the number of 8255 # global variables. join(1) would be nice here, but unfortunately 8256 # isn't a blessed tool. 8257 $opt_dry_run || $SED -e '/[ ,]DATA/!d;s,\(.*\)\([ \,].*\),s|^\1$|\1\2|,' < $export_symbols > $output_objdir/$libname.filter 8258 func_append delfiles " $export_symbols $output_objdir/$libname.filter" 8259 export_symbols=$output_objdir/$libname.def 8260 $opt_dry_run || $SED -f $output_objdir/$libname.filter < $orig_export_symbols > $export_symbols 8261 fi 8262 8263 tmp_deplibs= 8264 for test_deplib in $deplibs; do 8265 case " $convenience " in 8266 *" $test_deplib "*) ;; 8267 *) 8268 func_append tmp_deplibs " $test_deplib" 8269 ;; 8270 esac 8271 done 8272 deplibs="$tmp_deplibs" 8273 8274 if test -n "$convenience"; then 8275 if test -n "$whole_archive_flag_spec" && 8276 test "$compiler_needs_object" = yes && 8277 test -z "$libobjs"; then 8278 # extract the archives, so we have objects to list. 8279 # TODO: could optimize this to just extract one archive. 8280 whole_archive_flag_spec= 8281 fi 8282 if test -n "$whole_archive_flag_spec"; then 8283 save_libobjs=$libobjs 8284 eval libobjs=\"\$libobjs $whole_archive_flag_spec\" 8285 test "X$libobjs" = "X " && libobjs= 8286 else 8287 gentop="$output_objdir/${outputname}x" 8288 func_append generated " $gentop" 8289 8290 func_extract_archives $gentop $convenience 8291 func_append libobjs " $func_extract_archives_result" 8292 test "X$libobjs" = "X " && libobjs= 8293 fi 8294 fi 8295 8296 if test "$thread_safe" = yes && test -n "$thread_safe_flag_spec"; then 8297 eval flag=\"$thread_safe_flag_spec\" 8298 func_append linker_flags " $flag" 8299 fi 8300 8301 # Make a backup of the uninstalled library when relinking 8302 if test "$opt_mode" = relink; then 8303 $opt_dry_run || eval '(cd $output_objdir && $RM ${realname}U && $MV $realname ${realname}U)' || exit $? 8304 fi 8305 8306 # Do each of the archive commands. 8307 if test "$module" = yes && test -n "$module_cmds" ; then 8308 if test -n "$export_symbols" && test -n "$module_expsym_cmds"; then 8309 eval test_cmds=\"$module_expsym_cmds\" 8310 cmds=$module_expsym_cmds 8311 else 8312 eval test_cmds=\"$module_cmds\" 8313 cmds=$module_cmds 8314 fi 8315 else 8316 if test -n "$export_symbols" && test -n "$archive_expsym_cmds"; then 8317 eval test_cmds=\"$archive_expsym_cmds\" 8318 cmds=$archive_expsym_cmds 8319 else 8320 eval test_cmds=\"$archive_cmds\" 8321 cmds=$archive_cmds 8322 fi 8323 fi 8324 8325 if test "X$skipped_export" != "X:" && 8326 func_len " $test_cmds" && 8327 len=$func_len_result && 8328 test "$len" -lt "$max_cmd_len" || test "$max_cmd_len" -le -1; then 8329 : 8330 else 8331 # The command line is too long to link in one step, link piecewise 8332 # or, if using GNU ld and skipped_export is not :, use a linker 8333 # script. 8334 8335 # Save the value of $output and $libobjs because we want to 8336 # use them later. If we have whole_archive_flag_spec, we 8337 # want to use save_libobjs as it was before 8338 # whole_archive_flag_spec was expanded, because we can't 8339 # assume the linker understands whole_archive_flag_spec. 8340 # This may have to be revisited, in case too many 8341 # convenience libraries get linked in and end up exceeding 8342 # the spec. 8343 if test -z "$convenience" || test -z "$whole_archive_flag_spec"; then 8344 save_libobjs=$libobjs 8345 fi 8346 save_output=$output 8347 func_basename "$output" 8348 output_la=$func_basename_result 8349 8350 # Clear the reloadable object creation command queue and 8351 # initialize k to one. 8352 test_cmds= 8353 concat_cmds= 8354 objlist= 8355 last_robj= 8356 k=1 8357 8358 if test -n "$save_libobjs" && test "X$skipped_export" != "X:" && test "$with_gnu_ld" = yes; then 8359 output=${output_objdir}/${output_la}.lnkscript 8360 func_verbose "creating GNU ld script: $output" 8361 echo 'INPUT (' > $output 8362 for obj in $save_libobjs 8363 do 8364 func_to_tool_file "$obj" 8365 $ECHO "$func_to_tool_file_result" >> $output 8366 done 8367 echo ')' >> $output 8368 func_append delfiles " $output" 8369 func_to_tool_file "$output" 8370 output=$func_to_tool_file_result 8371 elif test -n "$save_libobjs" && test "X$skipped_export" != "X:" && test "X$file_list_spec" != X; then 8372 output=${output_objdir}/${output_la}.lnk 8373 func_verbose "creating linker input file list: $output" 8374 : > $output 8375 set x $save_libobjs 8376 shift 8377 firstobj= 8378 if test "$compiler_needs_object" = yes; then 8379 firstobj="$1 " 8380 shift 8381 fi 8382 for obj 8383 do 8384 func_to_tool_file "$obj" 8385 $ECHO "$func_to_tool_file_result" >> $output 8386 done 8387 func_append delfiles " $output" 8388 func_to_tool_file "$output" 8389 output=$firstobj\"$file_list_spec$func_to_tool_file_result\" 8390 else 8391 if test -n "$save_libobjs"; then 8392 func_verbose "creating reloadable object files..." 8393 output=$output_objdir/$output_la-${k}.$objext 8394 eval test_cmds=\"$reload_cmds\" 8395 func_len " $test_cmds" 8396 len0=$func_len_result 8397 len=$len0 8398 8399 # Loop over the list of objects to be linked. 8400 for obj in $save_libobjs 8401 do 8402 func_len " $obj" 8403 func_arith $len + $func_len_result 8404 len=$func_arith_result 8405 if test "X$objlist" = X || 8406 test "$len" -lt "$max_cmd_len"; then 8407 func_append objlist " $obj" 8408 else 8409 # The command $test_cmds is almost too long, add a 8410 # command to the queue. 8411 if test "$k" -eq 1 ; then 8412 # The first file doesn't have a previous command to add. 8413 reload_objs=$objlist 8414 eval concat_cmds=\"$reload_cmds\" 8415 else 8416 # All subsequent reloadable object files will link in 8417 # the last one created. 8418 reload_objs="$objlist $last_robj" 8419 eval concat_cmds=\"\$concat_cmds~$reload_cmds~\$RM $last_robj\" 8420 fi 8421 last_robj=$output_objdir/$output_la-${k}.$objext 8422 func_arith $k + 1 8423 k=$func_arith_result 8424 output=$output_objdir/$output_la-${k}.$objext 8425 objlist=" $obj" 8426 func_len " $last_robj" 8427 func_arith $len0 + $func_len_result 8428 len=$func_arith_result 8429 fi 8430 done 8431 # Handle the remaining objects by creating one last 8432 # reloadable object file. All subsequent reloadable object 8433 # files will link in the last one created. 8434 test -z "$concat_cmds" || concat_cmds=$concat_cmds~ 8435 reload_objs="$objlist $last_robj" 8436 eval concat_cmds=\"\${concat_cmds}$reload_cmds\" 8437 if test -n "$last_robj"; then 8438 eval concat_cmds=\"\${concat_cmds}~\$RM $last_robj\" 8439 fi 8440 func_append delfiles " $output" 8441 8442 else 8443 output= 8444 fi 8445 8446 if ${skipped_export-false}; then 8447 func_verbose "generating symbol list for \`$libname.la'" 8448 export_symbols="$output_objdir/$libname.exp" 8449 $opt_dry_run || $RM $export_symbols 8450 libobjs=$output 8451 # Append the command to create the export file. 8452 test -z "$concat_cmds" || concat_cmds=$concat_cmds~ 8453 eval concat_cmds=\"\$concat_cmds$export_symbols_cmds\" 8454 if test -n "$last_robj"; then 8455 eval concat_cmds=\"\$concat_cmds~\$RM $last_robj\" 8456 fi 8457 fi 8458 8459 test -n "$save_libobjs" && 8460 func_verbose "creating a temporary reloadable object file: $output" 8461 8462 # Loop through the commands generated above and execute them. 8463 save_ifs="$IFS"; IFS='~' 8464 for cmd in $concat_cmds; do 8465 IFS="$save_ifs" 8466 $opt_silent || { 8467 func_quote_for_expand "$cmd" 8468 eval "func_echo $func_quote_for_expand_result" 8469 } 8470 $opt_dry_run || eval "$cmd" || { 8471 lt_exit=$? 8472 8473 # Restore the uninstalled library and exit 8474 if test "$opt_mode" = relink; then 8475 ( cd "$output_objdir" && \ 8476 $RM "${realname}T" && \ 8477 $MV "${realname}U" "$realname" ) 8478 fi 8479 8480 exit $lt_exit 8481 } 8482 done 8483 IFS="$save_ifs" 8484 8485 if test -n "$export_symbols_regex" && ${skipped_export-false}; then 8486 func_show_eval '$EGREP -e "$export_symbols_regex" "$export_symbols" > "${export_symbols}T"' 8487 func_show_eval '$MV "${export_symbols}T" "$export_symbols"' 8488 fi 8489 fi 8490 8491 if ${skipped_export-false}; then 8492 if test -n "$export_symbols" && test -n "$include_expsyms"; then 8493 tmp_export_symbols="$export_symbols" 8494 test -n "$orig_export_symbols" && tmp_export_symbols="$orig_export_symbols" 8495 $opt_dry_run || eval '$ECHO "$include_expsyms" | $SP2NL >> "$tmp_export_symbols"' 8496 fi 8497 8498 if test -n "$orig_export_symbols"; then 8499 # The given exports_symbols file has to be filtered, so filter it. 8500 func_verbose "filter symbol list for \`$libname.la' to tag DATA exports" 8501 # FIXME: $output_objdir/$libname.filter potentially contains lots of 8502 # 's' commands which not all seds can handle. GNU sed should be fine 8503 # though. Also, the filter scales superlinearly with the number of 8504 # global variables. join(1) would be nice here, but unfortunately 8505 # isn't a blessed tool. 8506 $opt_dry_run || $SED -e '/[ ,]DATA/!d;s,\(.*\)\([ \,].*\),s|^\1$|\1\2|,' < $export_symbols > $output_objdir/$libname.filter 8507 func_append delfiles " $export_symbols $output_objdir/$libname.filter" 8508 export_symbols=$output_objdir/$libname.def 8509 $opt_dry_run || $SED -f $output_objdir/$libname.filter < $orig_export_symbols > $export_symbols 8510 fi 8511 fi 8512 8513 libobjs=$output 8514 # Restore the value of output. 8515 output=$save_output 8516 8517 if test -n "$convenience" && test -n "$whole_archive_flag_spec"; then 8518 eval libobjs=\"\$libobjs $whole_archive_flag_spec\" 8519 test "X$libobjs" = "X " && libobjs= 8520 fi 8521 # Expand the library linking commands again to reset the 8522 # value of $libobjs for piecewise linking. 8523 8524 # Do each of the archive commands. 8525 if test "$module" = yes && test -n "$module_cmds" ; then 8526 if test -n "$export_symbols" && test -n "$module_expsym_cmds"; then 8527 cmds=$module_expsym_cmds 8528 else 8529 cmds=$module_cmds 8530 fi 8531 else 8532 if test -n "$export_symbols" && test -n "$archive_expsym_cmds"; then 8533 cmds=$archive_expsym_cmds 8534 else 8535 cmds=$archive_cmds 8536 fi 8537 fi 8538 fi 8539 8540 if test -n "$delfiles"; then 8541 # Append the command to remove temporary files to $cmds. 8542 eval cmds=\"\$cmds~\$RM $delfiles\" 8543 fi 8544 8545 # Add any objects from preloaded convenience libraries 8546 if test -n "$dlprefiles"; then 8547 gentop="$output_objdir/${outputname}x" 8548 func_append generated " $gentop" 8549 8550 func_extract_archives $gentop $dlprefiles 8551 func_append libobjs " $func_extract_archives_result" 8552 test "X$libobjs" = "X " && libobjs= 8553 fi 8554 8555 save_ifs="$IFS"; IFS='~' 8556 for cmd in $cmds; do 8557 IFS="$save_ifs" 8558 eval cmd=\"$cmd\" 8559 $opt_silent || { 8560 func_quote_for_expand "$cmd" 8561 eval "func_echo $func_quote_for_expand_result" 8562 } 8563 $opt_dry_run || eval "$cmd" || { 8564 lt_exit=$? 8565 8566 # Restore the uninstalled library and exit 8567 if test "$opt_mode" = relink; then 8568 ( cd "$output_objdir" && \ 8569 $RM "${realname}T" && \ 8570 $MV "${realname}U" "$realname" ) 8571 fi 8572 8573 exit $lt_exit 8574 } 8575 done 8576 IFS="$save_ifs" 8577 8578 # Restore the uninstalled library and exit 8579 if test "$opt_mode" = relink; then 8580 $opt_dry_run || eval '(cd $output_objdir && $RM ${realname}T && $MV $realname ${realname}T && $MV ${realname}U $realname)' || exit $? 8581 8582 if test -n "$convenience"; then 8583 if test -z "$whole_archive_flag_spec"; then 8584 func_show_eval '${RM}r "$gentop"' 8585 fi 8586 fi 8587 8588 exit $EXIT_SUCCESS 8589 fi 8590 8591 # Create links to the real library. 8592 for linkname in $linknames; do 8593 if test "$realname" != "$linkname"; then 8594 func_show_eval '(cd "$output_objdir" && $RM "$linkname" && $LN_S "$realname" "$linkname")' 'exit $?' 8595 fi 8596 done 8597 8598 # If -module or -export-dynamic was specified, set the dlname. 8599 if test "$module" = yes || test "$export_dynamic" = yes; then 8600 # On all known operating systems, these are identical. 8601 dlname="$soname" 8602 fi 8603 fi 8604 ;; 8605 8606 obj) 8607 if test -n "$dlfiles$dlprefiles" || test "$dlself" != no; then 8608 func_warning "\`-dlopen' is ignored for objects" 8609 fi 8610 8611 case " $deplibs" in 8612 *\ -l* | *\ -L*) 8613 func_warning "\`-l' and \`-L' are ignored for objects" ;; 8614 esac 8615 8616 test -n "$rpath" && \ 8617 func_warning "\`-rpath' is ignored for objects" 8618 8619 test -n "$xrpath" && \ 8620 func_warning "\`-R' is ignored for objects" 8621 8622 test -n "$vinfo" && \ 8623 func_warning "\`-version-info' is ignored for objects" 8624 8625 test -n "$release" && \ 8626 func_warning "\`-release' is ignored for objects" 8627 8628 case $output in 8629 *.lo) 8630 test -n "$objs$old_deplibs" && \ 8631 func_fatal_error "cannot build library object \`$output' from non-libtool objects" 8632 8633 libobj=$output 8634 func_lo2o "$libobj" 8635 obj=$func_lo2o_result 8636 ;; 8637 *) 8638 libobj= 8639 obj="$output" 8640 ;; 8641 esac 8642 8643 # Delete the old objects. 8644 $opt_dry_run || $RM $obj $libobj 8645 8646 # Objects from convenience libraries. This assumes 8647 # single-version convenience libraries. Whenever we create 8648 # different ones for PIC/non-PIC, this we'll have to duplicate 8649 # the extraction. 8650 reload_conv_objs= 8651 gentop= 8652 # reload_cmds runs $LD directly, so let us get rid of 8653 # -Wl from whole_archive_flag_spec and hope we can get by with 8654 # turning comma into space.. 8655 wl= 8656 8657 if test -n "$convenience"; then 8658 if test -n "$whole_archive_flag_spec"; then 8659 eval tmp_whole_archive_flags=\"$whole_archive_flag_spec\" 8660 reload_conv_objs=$reload_objs\ `$ECHO "$tmp_whole_archive_flags" | $SED 's|,| |g'` 8661 else 8662 gentop="$output_objdir/${obj}x" 8663 func_append generated " $gentop" 8664 8665 func_extract_archives $gentop $convenience 8666 reload_conv_objs="$reload_objs $func_extract_archives_result" 8667 fi 8668 fi 8669 8670 # If we're not building shared, we need to use non_pic_objs 8671 test "$build_libtool_libs" != yes && libobjs="$non_pic_objects" 8672 8673 # Create the old-style object. 8674 reload_objs="$objs$old_deplibs "`$ECHO "$libobjs" | $SP2NL | $SED "/\.${libext}$/d; /\.lib$/d; $lo2o" | $NL2SP`" $reload_conv_objs" ### testsuite: skip nested quoting test 8675 8676 output="$obj" 8677 func_execute_cmds "$reload_cmds" 'exit $?' 8678 8679 # Exit if we aren't doing a library object file. 8680 if test -z "$libobj"; then 8681 if test -n "$gentop"; then 8682 func_show_eval '${RM}r "$gentop"' 8683 fi 8684 8685 exit $EXIT_SUCCESS 8686 fi 8687 8688 if test "$build_libtool_libs" != yes; then 8689 if test -n "$gentop"; then 8690 func_show_eval '${RM}r "$gentop"' 8691 fi 8692 8693 # Create an invalid libtool object if no PIC, so that we don't 8694 # accidentally link it into a program. 8695 # $show "echo timestamp > $libobj" 8696 # $opt_dry_run || eval "echo timestamp > $libobj" || exit $? 8697 exit $EXIT_SUCCESS 8698 fi 8699 8700 if test -n "$pic_flag" || test "$pic_mode" != default; then 8701 # Only do commands if we really have different PIC objects. 8702 reload_objs="$libobjs $reload_conv_objs" 8703 output="$libobj" 8704 func_execute_cmds "$reload_cmds" 'exit $?' 8705 fi 8706 8707 if test -n "$gentop"; then 8708 func_show_eval '${RM}r "$gentop"' 8709 fi 8710 8711 exit $EXIT_SUCCESS 8712 ;; 8713 8714 prog) 8715 case $host in 8716 *cygwin*) func_stripname '' '.exe' "$output" 8717 output=$func_stripname_result.exe;; 8718 esac 8719 test -n "$vinfo" && \ 8720 func_warning "\`-version-info' is ignored for programs" 8721 8722 test -n "$release" && \ 8723 func_warning "\`-release' is ignored for programs" 8724 8725 test "$preload" = yes \ 8726 && test "$dlopen_support" = unknown \ 8727 && test "$dlopen_self" = unknown \ 8728 && test "$dlopen_self_static" = unknown && \ 8729 func_warning "\`LT_INIT([dlopen])' not used. Assuming no dlopen support." 8730 8731 case $host in 8732 *-*-rhapsody* | *-*-darwin1.[012]) 8733 # On Rhapsody replace the C library is the System framework 8734 compile_deplibs=`$ECHO " $compile_deplibs" | $SED 's/ -lc / System.ltframework /'` 8735 finalize_deplibs=`$ECHO " $finalize_deplibs" | $SED 's/ -lc / System.ltframework /'` 8736 ;; 8737 esac 8738 8739 case $host in 8740 *-*-darwin*) 8741 # Don't allow lazy linking, it breaks C++ global constructors 8742 # But is supposedly fixed on 10.4 or later (yay!). 8743 if test "$tagname" = CXX ; then 8744 case ${MACOSX_DEPLOYMENT_TARGET-10.0} in 8745 10.[0123]) 8746 func_append compile_command " ${wl}-bind_at_load" 8747 func_append finalize_command " ${wl}-bind_at_load" 8748 ;; 8749 esac 8750 fi 8751 # Time to change all our "foo.ltframework" stuff back to "-framework foo" 8752 compile_deplibs=`$ECHO " $compile_deplibs" | $SED 's% \([^ $]*\).ltframework% -framework \1%g'` 8753 finalize_deplibs=`$ECHO " $finalize_deplibs" | $SED 's% \([^ $]*\).ltframework% -framework \1%g'` 8754 ;; 8755 esac 8756 8757 8758 # move library search paths that coincide with paths to not yet 8759 # installed libraries to the beginning of the library search list 8760 new_libs= 8761 for path in $notinst_path; do 8762 case " $new_libs " in 8763 *" -L$path/$objdir "*) ;; 8764 *) 8765 case " $compile_deplibs " in 8766 *" -L$path/$objdir "*) 8767 func_append new_libs " -L$path/$objdir" ;; 8768 esac 8769 ;; 8770 esac 8771 done 8772 for deplib in $compile_deplibs; do 8773 case $deplib in 8774 -L*) 8775 case " $new_libs " in 8776 *" $deplib "*) ;; 8777 *) func_append new_libs " $deplib" ;; 8778 esac 8779 ;; 8780 *) func_append new_libs " $deplib" ;; 8781 esac 8782 done 8783 compile_deplibs="$new_libs" 8784 8785 8786 func_append compile_command " $compile_deplibs" 8787 func_append finalize_command " $finalize_deplibs" 8788 8789 if test -n "$rpath$xrpath"; then 8790 # If the user specified any rpath flags, then add them. 8791 for libdir in $rpath $xrpath; do 8792 # This is the magic to use -rpath. 8793 case "$finalize_rpath " in 8794 *" $libdir "*) ;; 8795 *) func_append finalize_rpath " $libdir" ;; 8796 esac 8797 done 8798 fi 8799 8800 # Now hardcode the library paths 8801 rpath= 8802 hardcode_libdirs= 8803 for libdir in $compile_rpath $finalize_rpath; do 8804 if test -n "$hardcode_libdir_flag_spec"; then 8805 if test -n "$hardcode_libdir_separator"; then 8806 if test -z "$hardcode_libdirs"; then 8807 hardcode_libdirs="$libdir" 8808 else 8809 # Just accumulate the unique libdirs. 8810 case $hardcode_libdir_separator$hardcode_libdirs$hardcode_libdir_separator in 8811 *"$hardcode_libdir_separator$libdir$hardcode_libdir_separator"*) 8812 ;; 8813 *) 8814 func_append hardcode_libdirs "$hardcode_libdir_separator$libdir" 8815 ;; 8816 esac 8817 fi 8818 else 8819 eval flag=\"$hardcode_libdir_flag_spec\" 8820 func_append rpath " $flag" 8821 fi 8822 elif test -n "$runpath_var"; then 8823 case "$perm_rpath " in 8824 *" $libdir "*) ;; 8825 *) func_append perm_rpath " $libdir" ;; 8826 esac 8827 fi 8828 case $host in 8829 *-*-cygwin* | *-*-mingw* | *-*-pw32* | *-*-os2* | *-cegcc*) 8830 testbindir=`${ECHO} "$libdir" | ${SED} -e 's*/lib$*/bin*'` 8831 case :$dllsearchpath: in 8832 *":$libdir:"*) ;; 8833 ::) dllsearchpath=$libdir;; 8834 *) func_append dllsearchpath ":$libdir";; 8835 esac 8836 case :$dllsearchpath: in 8837 *":$testbindir:"*) ;; 8838 ::) dllsearchpath=$testbindir;; 8839 *) func_append dllsearchpath ":$testbindir";; 8840 esac 8841 ;; 8842 esac 8843 done 8844 # Substitute the hardcoded libdirs into the rpath. 8845 if test -n "$hardcode_libdir_separator" && 8846 test -n "$hardcode_libdirs"; then 8847 libdir="$hardcode_libdirs" 8848 eval rpath=\" $hardcode_libdir_flag_spec\" 8849 fi 8850 compile_rpath="$rpath" 8851 8852 rpath= 8853 hardcode_libdirs= 8854 for libdir in $finalize_rpath; do 8855 if test -n "$hardcode_libdir_flag_spec"; then 8856 if test -n "$hardcode_libdir_separator"; then 8857 if test -z "$hardcode_libdirs"; then 8858 hardcode_libdirs="$libdir" 8859 else 8860 # Just accumulate the unique libdirs. 8861 case $hardcode_libdir_separator$hardcode_libdirs$hardcode_libdir_separator in 8862 *"$hardcode_libdir_separator$libdir$hardcode_libdir_separator"*) 8863 ;; 8864 *) 8865 func_append hardcode_libdirs "$hardcode_libdir_separator$libdir" 8866 ;; 8867 esac 8868 fi 8869 else 8870 eval flag=\"$hardcode_libdir_flag_spec\" 8871 func_append rpath " $flag" 8872 fi 8873 elif test -n "$runpath_var"; then 8874 case "$finalize_perm_rpath " in 8875 *" $libdir "*) ;; 8876 *) func_append finalize_perm_rpath " $libdir" ;; 8877 esac 8878 fi 8879 done 8880 # Substitute the hardcoded libdirs into the rpath. 8881 if test -n "$hardcode_libdir_separator" && 8882 test -n "$hardcode_libdirs"; then 8883 libdir="$hardcode_libdirs" 8884 eval rpath=\" $hardcode_libdir_flag_spec\" 8885 fi 8886 finalize_rpath="$rpath" 8887 8888 if test -n "$libobjs" && test "$build_old_libs" = yes; then 8889 # Transform all the library objects into standard objects. 8890 compile_command=`$ECHO "$compile_command" | $SP2NL | $SED "$lo2o" | $NL2SP` 8891 finalize_command=`$ECHO "$finalize_command" | $SP2NL | $SED "$lo2o" | $NL2SP` 8892 fi 8893 8894 func_generate_dlsyms "$outputname" "@PROGRAM@" "no" 8895 8896 # template prelinking step 8897 if test -n "$prelink_cmds"; then 8898 func_execute_cmds "$prelink_cmds" 'exit $?' 8899 fi 8900 8901 wrappers_required=yes 8902 case $host in 8903 *cegcc* | *mingw32ce*) 8904 # Disable wrappers for cegcc and mingw32ce hosts, we are cross compiling anyway. 8905 wrappers_required=no 8906 ;; 8907 *cygwin* | *mingw* ) 8908 if test "$build_libtool_libs" != yes; then 8909 wrappers_required=no 8910 fi 8911 ;; 8912 *) 8913 if test "$need_relink" = no || test "$build_libtool_libs" != yes; then 8914 wrappers_required=no 8915 fi 8916 ;; 8917 esac 8918 if test "$wrappers_required" = no; then 8919 # Replace the output file specification. 8920 compile_command=`$ECHO "$compile_command" | $SED 's%@OUTPUT@%'"$output"'%g'` 8921 link_command="$compile_command$compile_rpath" 8922 8923 # We have no uninstalled library dependencies, so finalize right now. 8924 exit_status=0 8925 func_show_eval "$link_command" 'exit_status=$?' 8926 8927 if test -n "$postlink_cmds"; then 8928 func_to_tool_file "$output" 8929 postlink_cmds=`func_echo_all "$postlink_cmds" | $SED -e 's%@OUTPUT@%'"$output"'%g' -e 's%@TOOL_OUTPUT@%'"$func_to_tool_file_result"'%g'` 8930 func_execute_cmds "$postlink_cmds" 'exit $?' 8931 fi 8932 8933 # Delete the generated files. 8934 if test -f "$output_objdir/${outputname}S.${objext}"; then 8935 func_show_eval '$RM "$output_objdir/${outputname}S.${objext}"' 8936 fi 8937 8938 exit $exit_status 8939 fi 8940 8941 if test -n "$compile_shlibpath$finalize_shlibpath"; then 8942 compile_command="$shlibpath_var=\"$compile_shlibpath$finalize_shlibpath\$$shlibpath_var\" $compile_command" 8943 fi 8944 if test -n "$finalize_shlibpath"; then 8945 finalize_command="$shlibpath_var=\"$finalize_shlibpath\$$shlibpath_var\" $finalize_command" 8946 fi 8947 8948 compile_var= 8949 finalize_var= 8950 if test -n "$runpath_var"; then 8951 if test -n "$perm_rpath"; then 8952 # We should set the runpath_var. 8953 rpath= 8954 for dir in $perm_rpath; do 8955 func_append rpath "$dir:" 8956 done 8957 compile_var="$runpath_var=\"$rpath\$$runpath_var\" " 8958 fi 8959 if test -n "$finalize_perm_rpath"; then 8960 # We should set the runpath_var. 8961 rpath= 8962 for dir in $finalize_perm_rpath; do 8963 func_append rpath "$dir:" 8964 done 8965 finalize_var="$runpath_var=\"$rpath\$$runpath_var\" " 8966 fi 8967 fi 8968 8969 if test "$no_install" = yes; then 8970 # We don't need to create a wrapper script. 8971 link_command="$compile_var$compile_command$compile_rpath" 8972 # Replace the output file specification. 8973 link_command=`$ECHO "$link_command" | $SED 's%@OUTPUT@%'"$output"'%g'` 8974 # Delete the old output file. 8975 $opt_dry_run || $RM $output 8976 # Link the executable and exit 8977 func_show_eval "$link_command" 'exit $?' 8978 8979 if test -n "$postlink_cmds"; then 8980 func_to_tool_file "$output" 8981 postlink_cmds=`func_echo_all "$postlink_cmds" | $SED -e 's%@OUTPUT@%'"$output"'%g' -e 's%@TOOL_OUTPUT@%'"$func_to_tool_file_result"'%g'` 8982 func_execute_cmds "$postlink_cmds" 'exit $?' 8983 fi 8984 8985 exit $EXIT_SUCCESS 8986 fi 8987 8988 if test "$hardcode_action" = relink; then 8989 # Fast installation is not supported 8990 link_command="$compile_var$compile_command$compile_rpath" 8991 relink_command="$finalize_var$finalize_command$finalize_rpath" 8992 8993 func_warning "this platform does not like uninstalled shared libraries" 8994 func_warning "\`$output' will be relinked during installation" 8995 else 8996 if test "$fast_install" != no; then 8997 link_command="$finalize_var$compile_command$finalize_rpath" 8998 if test "$fast_install" = yes; then 8999 relink_command=`$ECHO "$compile_var$compile_command$compile_rpath" | $SED 's%@OUTPUT@%\$progdir/\$file%g'` 9000 else 9001 # fast_install is set to needless 9002 relink_command= 9003 fi 9004 else 9005 link_command="$compile_var$compile_command$compile_rpath" 9006 relink_command="$finalize_var$finalize_command$finalize_rpath" 9007 fi 9008 fi 9009 9010 # Replace the output file specification. 9011 link_command=`$ECHO "$link_command" | $SED 's%@OUTPUT@%'"$output_objdir/$outputname"'%g'` 9012 9013 # Delete the old output files. 9014 $opt_dry_run || $RM $output $output_objdir/$outputname $output_objdir/lt-$outputname 9015 9016 func_show_eval "$link_command" 'exit $?' 9017 9018 if test -n "$postlink_cmds"; then 9019 func_to_tool_file "$output_objdir/$outputname" 9020 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'` 9021 func_execute_cmds "$postlink_cmds" 'exit $?' 9022 fi 9023 9024 # Now create the wrapper script. 9025 func_verbose "creating $output" 9026 9027 # Quote the relink command for shipping. 9028 if test -n "$relink_command"; then 9029 # Preserve any variables that may affect compiler behavior 9030 for var in $variables_saved_for_relink; do 9031 if eval test -z \"\${$var+set}\"; then 9032 relink_command="{ test -z \"\${$var+set}\" || $lt_unset $var || { $var=; export $var; }; }; $relink_command" 9033 elif eval var_value=\$$var; test -z "$var_value"; then 9034 relink_command="$var=; export $var; $relink_command" 9035 else 9036 func_quote_for_eval "$var_value" 9037 relink_command="$var=$func_quote_for_eval_result; export $var; $relink_command" 9038 fi 9039 done 9040 relink_command="(cd `pwd`; $relink_command)" 9041 relink_command=`$ECHO "$relink_command" | $SED "$sed_quote_subst"` 9042 fi 9043 9044 # Only actually do things if not in dry run mode. 9045 $opt_dry_run || { 9046 # win32 will think the script is a binary if it has 9047 # a .exe suffix, so we strip it off here. 9048 case $output in 9049 *.exe) func_stripname '' '.exe' "$output" 9050 output=$func_stripname_result ;; 9051 esac 9052 # test for cygwin because mv fails w/o .exe extensions 9053 case $host in 9054 *cygwin*) 9055 exeext=.exe 9056 func_stripname '' '.exe' "$outputname" 9057 outputname=$func_stripname_result ;; 9058 *) exeext= ;; 9059 esac 9060 case $host in 9061 *cygwin* | *mingw* ) 9062 func_dirname_and_basename "$output" "" "." 9063 output_name=$func_basename_result 9064 output_path=$func_dirname_result 9065 cwrappersource="$output_path/$objdir/lt-$output_name.c" 9066 cwrapper="$output_path/$output_name.exe" 9067 $RM $cwrappersource $cwrapper 9068 trap "$RM $cwrappersource $cwrapper; exit $EXIT_FAILURE" 1 2 15 9069 9070 func_emit_cwrapperexe_src > $cwrappersource 9071 9072 # The wrapper executable is built using the $host compiler, 9073 # because it contains $host paths and files. If cross- 9074 # compiling, it, like the target executable, must be 9075 # executed on the $host or under an emulation environment. 9076 $opt_dry_run || { 9077 $LTCC $LTCFLAGS -o $cwrapper $cwrappersource 9078 $STRIP $cwrapper 9079 } 9080 9081 # Now, create the wrapper script for func_source use: 9082 func_ltwrapper_scriptname $cwrapper 9083 $RM $func_ltwrapper_scriptname_result 9084 trap "$RM $func_ltwrapper_scriptname_result; exit $EXIT_FAILURE" 1 2 15 9085 $opt_dry_run || { 9086 # note: this script will not be executed, so do not chmod. 9087 if test "x$build" = "x$host" ; then 9088 $cwrapper --lt-dump-script > $func_ltwrapper_scriptname_result 9089 else 9090 func_emit_wrapper no > $func_ltwrapper_scriptname_result 9091 fi 9092 } 9093 ;; 9094 * ) 9095 $RM $output 9096 trap "$RM $output; exit $EXIT_FAILURE" 1 2 15 9097 9098 func_emit_wrapper no > $output 9099 chmod +x $output 9100 ;; 9101 esac 9102 } 9103 exit $EXIT_SUCCESS 9104 ;; 9105 esac 9106 9107 # See if we need to build an old-fashioned archive. 9108 for oldlib in $oldlibs; do 9109 9110 if test "$build_libtool_libs" = convenience; then 9111 oldobjs="$libobjs_save $symfileobj" 9112 addlibs="$convenience" 9113 build_libtool_libs=no 9114 else 9115 if test "$build_libtool_libs" = module; then 9116 oldobjs="$libobjs_save" 9117 build_libtool_libs=no 9118 else 9119 oldobjs="$old_deplibs $non_pic_objects" 9120 if test "$preload" = yes && test -f "$symfileobj"; then 9121 func_append oldobjs " $symfileobj" 9122 fi 9123 fi 9124 addlibs="$old_convenience" 9125 fi 9126 9127 if test -n "$addlibs"; then 9128 gentop="$output_objdir/${outputname}x" 9129 func_append generated " $gentop" 9130 9131 func_extract_archives $gentop $addlibs 9132 func_append oldobjs " $func_extract_archives_result" 9133 fi 9134 9135 # Do each command in the archive commands. 9136 if test -n "$old_archive_from_new_cmds" && test "$build_libtool_libs" = yes; then 9137 cmds=$old_archive_from_new_cmds 9138 else 9139 9140 # Add any objects from preloaded convenience libraries 9141 if test -n "$dlprefiles"; then 9142 gentop="$output_objdir/${outputname}x" 9143 func_append generated " $gentop" 9144 9145 func_extract_archives $gentop $dlprefiles 9146 func_append oldobjs " $func_extract_archives_result" 9147 fi 9148 9149 # POSIX demands no paths to be encoded in archives. We have 9150 # to avoid creating archives with duplicate basenames if we 9151 # might have to extract them afterwards, e.g., when creating a 9152 # static archive out of a convenience library, or when linking 9153 # the entirety of a libtool archive into another (currently 9154 # not supported by libtool). 9155 if (for obj in $oldobjs 9156 do 9157 func_basename "$obj" 9158 $ECHO "$func_basename_result" 9159 done | sort | sort -uc >/dev/null 2>&1); then 9160 : 9161 else 9162 echo "copying selected object files to avoid basename conflicts..." 9163 gentop="$output_objdir/${outputname}x" 9164 func_append generated " $gentop" 9165 func_mkdir_p "$gentop" 9166 save_oldobjs=$oldobjs 9167 oldobjs= 9168 counter=1 9169 for obj in $save_oldobjs 9170 do 9171 func_basename "$obj" 9172 objbase="$func_basename_result" 9173 case " $oldobjs " in 9174 " ") oldobjs=$obj ;; 9175 *[\ /]"$objbase "*) 9176 while :; do 9177 # Make sure we don't pick an alternate name that also 9178 # overlaps. 9179 newobj=lt$counter-$objbase 9180 func_arith $counter + 1 9181 counter=$func_arith_result 9182 case " $oldobjs " in 9183 *[\ /]"$newobj "*) ;; 9184 *) if test ! -f "$gentop/$newobj"; then break; fi ;; 9185 esac 9186 done 9187 func_show_eval "ln $obj $gentop/$newobj || cp $obj $gentop/$newobj" 9188 func_append oldobjs " $gentop/$newobj" 9189 ;; 9190 *) func_append oldobjs " $obj" ;; 9191 esac 9192 done 9193 fi 9194 func_to_tool_file "$oldlib" func_convert_file_msys_to_w32 9195 tool_oldlib=$func_to_tool_file_result 9196 eval cmds=\"$old_archive_cmds\" 9197 9198 func_len " $cmds" 9199 len=$func_len_result 9200 if test "$len" -lt "$max_cmd_len" || test "$max_cmd_len" -le -1; then 9201 cmds=$old_archive_cmds 9202 elif test -n "$archiver_list_spec"; then 9203 func_verbose "using command file archive linking..." 9204 for obj in $oldobjs 9205 do 9206 func_to_tool_file "$obj" 9207 $ECHO "$func_to_tool_file_result" 9208 done > $output_objdir/$libname.libcmd 9209 func_to_tool_file "$output_objdir/$libname.libcmd" 9210 oldobjs=" $archiver_list_spec$func_to_tool_file_result" 9211 cmds=$old_archive_cmds 9212 else 9213 # the command line is too long to link in one step, link in parts 9214 func_verbose "using piecewise archive linking..." 9215 save_RANLIB=$RANLIB 9216 RANLIB=: 9217 objlist= 9218 concat_cmds= 9219 save_oldobjs=$oldobjs 9220 oldobjs= 9221 # Is there a better way of finding the last object in the list? 9222 for obj in $save_oldobjs 9223 do 9224 last_oldobj=$obj 9225 done 9226 eval test_cmds=\"$old_archive_cmds\" 9227 func_len " $test_cmds" 9228 len0=$func_len_result 9229 len=$len0 9230 for obj in $save_oldobjs 9231 do 9232 func_len " $obj" 9233 func_arith $len + $func_len_result 9234 len=$func_arith_result 9235 func_append objlist " $obj" 9236 if test "$len" -lt "$max_cmd_len"; then 9237 : 9238 else 9239 # the above command should be used before it gets too long 9240 oldobjs=$objlist 9241 if test "$obj" = "$last_oldobj" ; then 9242 RANLIB=$save_RANLIB 9243 fi 9244 test -z "$concat_cmds" || concat_cmds=$concat_cmds~ 9245 eval concat_cmds=\"\${concat_cmds}$old_archive_cmds\" 9246 objlist= 9247 len=$len0 9248 fi 9249 done 9250 RANLIB=$save_RANLIB 9251 oldobjs=$objlist 9252 if test "X$oldobjs" = "X" ; then 9253 eval cmds=\"\$concat_cmds\" 9254 else 9255 eval cmds=\"\$concat_cmds~\$old_archive_cmds\" 9256 fi 9257 fi 9258 fi 9259 func_execute_cmds "$cmds" 'exit $?' 9260 done 9261 9262 test -n "$generated" && \ 9263 func_show_eval "${RM}r$generated" 9264 9265 # Now create the libtool archive. 9266 case $output in 9267 *.la) 9268 old_library= 9269 test "$build_old_libs" = yes && old_library="$libname.$libext" 9270 func_verbose "creating $output" 9271 9272 # Preserve any variables that may affect compiler behavior 9273 for var in $variables_saved_for_relink; do 9274 if eval test -z \"\${$var+set}\"; then 9275 relink_command="{ test -z \"\${$var+set}\" || $lt_unset $var || { $var=; export $var; }; }; $relink_command" 9276 elif eval var_value=\$$var; test -z "$var_value"; then 9277 relink_command="$var=; export $var; $relink_command" 9278 else 9279 func_quote_for_eval "$var_value" 9280 relink_command="$var=$func_quote_for_eval_result; export $var; $relink_command" 9281 fi 9282 done 9283 # Quote the link command for shipping. 9284 relink_command="(cd `pwd`; $SHELL $progpath $preserve_args --mode=relink $libtool_args @inst_prefix_dir@)" 9285 relink_command=`$ECHO "$relink_command" | $SED "$sed_quote_subst"` 9286 if test "$hardcode_automatic" = yes ; then 9287 relink_command= 9288 fi 9289 9290 # Only create the output if not a dry run. 9291 $opt_dry_run || { 9292 for installed in no yes; do 9293 if test "$installed" = yes; then 9294 if test -z "$install_libdir"; then 9295 break 9296 fi 9297 output="$output_objdir/$outputname"i 9298 # Replace all uninstalled libtool libraries with the installed ones 9299 newdependency_libs= 9300 for deplib in $dependency_libs; do 9301 case $deplib in 9302 *.la) 9303 func_basename "$deplib" 9304 name="$func_basename_result" 9305 func_resolve_sysroot "$deplib" 9306 eval libdir=`${SED} -n -e 's/^libdir=\(.*\)$/\1/p' $func_resolve_sysroot_result` 9307 test -z "$libdir" && \ 9308 func_fatal_error "\`$deplib' is not a valid libtool archive" 9309 func_append newdependency_libs " ${lt_sysroot:+=}$libdir/$name" 9310 ;; 9311 -L*) 9312 func_stripname -L '' "$deplib" 9313 func_replace_sysroot "$func_stripname_result" 9314 func_append newdependency_libs " -L$func_replace_sysroot_result" 9315 ;; 9316 -R*) 9317 func_stripname -R '' "$deplib" 9318 func_replace_sysroot "$func_stripname_result" 9319 func_append newdependency_libs " -R$func_replace_sysroot_result" 9320 ;; 9321 *) func_append newdependency_libs " $deplib" ;; 9322 esac 9323 done 9324 dependency_libs="$newdependency_libs" 9325 newdlfiles= 9326 9327 for lib in $dlfiles; do 9328 case $lib in 9329 *.la) 9330 func_basename "$lib" 9331 name="$func_basename_result" 9332 eval libdir=`${SED} -n -e 's/^libdir=\(.*\)$/\1/p' $lib` 9333 test -z "$libdir" && \ 9334 func_fatal_error "\`$lib' is not a valid libtool archive" 9335 func_append newdlfiles " ${lt_sysroot:+=}$libdir/$name" 9336 ;; 9337 *) func_append newdlfiles " $lib" ;; 9338 esac 9339 done 9340 dlfiles="$newdlfiles" 9341 newdlprefiles= 9342 for lib in $dlprefiles; do 9343 case $lib in 9344 *.la) 9345 # Only pass preopened files to the pseudo-archive (for 9346 # eventual linking with the app. that links it) if we 9347 # didn't already link the preopened objects directly into 9348 # the library: 9349 func_basename "$lib" 9350 name="$func_basename_result" 9351 eval libdir=`${SED} -n -e 's/^libdir=\(.*\)$/\1/p' $lib` 9352 test -z "$libdir" && \ 9353 func_fatal_error "\`$lib' is not a valid libtool archive" 9354 func_append newdlprefiles " ${lt_sysroot:+=}$libdir/$name" 9355 ;; 9356 esac 9357 done 9358 dlprefiles="$newdlprefiles" 9359 else 9360 newdlfiles= 9361 for lib in $dlfiles; do 9362 case $lib in 9363 [\\/]* | [A-Za-z]:[\\/]*) abs="$lib" ;; 9364 *) abs=`pwd`"/$lib" ;; 9365 esac 9366 func_append newdlfiles " $abs" 9367 done 9368 dlfiles="$newdlfiles" 9369 newdlprefiles= 9370 for lib in $dlprefiles; do 9371 case $lib in 9372 [\\/]* | [A-Za-z]:[\\/]*) abs="$lib" ;; 9373 *) abs=`pwd`"/$lib" ;; 9374 esac 9375 func_append newdlprefiles " $abs" 9376 done 9377 dlprefiles="$newdlprefiles" 9378 fi 9379 $RM $output 9380 # place dlname in correct position for cygwin 9381 # In fact, it would be nice if we could use this code for all target 9382 # systems that can't hard-code library paths into their executables 9383 # and that have no shared library path variable independent of PATH, 9384 # but it turns out we can't easily determine that from inspecting 9385 # libtool variables, so we have to hard-code the OSs to which it 9386 # applies here; at the moment, that means platforms that use the PE 9387 # object format with DLL files. See the long comment at the top of 9388 # tests/bindir.at for full details. 9389 tdlname=$dlname 9390 case $host,$output,$installed,$module,$dlname in 9391 *cygwin*,*lai,yes,no,*.dll | *mingw*,*lai,yes,no,*.dll | *cegcc*,*lai,yes,no,*.dll) 9392 # If a -bindir argument was supplied, place the dll there. 9393 if test "x$bindir" != x ; 9394 then 9395 func_relative_path "$install_libdir" "$bindir" 9396 tdlname=$func_relative_path_result$dlname 9397 else 9398 # Otherwise fall back on heuristic. 9399 tdlname=../bin/$dlname 9400 fi 9401 ;; 9402 esac 9403 $ECHO > $output "\ 9404# $outputname - a libtool library file 9405# Generated by $PROGRAM (GNU $PACKAGE$TIMESTAMP) $VERSION 9406# 9407# Please DO NOT delete this file! 9408# It is necessary for linking the library. 9409 9410# The name that we can dlopen(3). 9411dlname='$tdlname' 9412 9413# Names of this library. 9414library_names='$library_names' 9415 9416# The name of the static archive. 9417old_library='$old_library' 9418 9419# Linker flags that can not go in dependency_libs. 9420inherited_linker_flags='$new_inherited_linker_flags' 9421 9422# Libraries that this one depends upon. 9423dependency_libs='$dependency_libs' 9424 9425# Names of additional weak libraries provided by this library 9426weak_library_names='$weak_libs' 9427 9428# Version information for $libname. 9429current=$current 9430age=$age 9431revision=$revision 9432 9433# Is this an already installed library? 9434installed=$installed 9435 9436# Should we warn about portability when linking against -modules? 9437shouldnotlink=$module 9438 9439# Files to dlopen/dlpreopen 9440dlopen='$dlfiles' 9441dlpreopen='$dlprefiles' 9442 9443# Directory that this library needs to be installed in: 9444libdir='$install_libdir'" 9445 if test "$installed" = no && test "$need_relink" = yes; then 9446 $ECHO >> $output "\ 9447relink_command=\"$relink_command\"" 9448 fi 9449 done 9450 } 9451 9452 # Do a symbolic link so that the libtool archive can be found in 9453 # LD_LIBRARY_PATH before the program is installed. 9454 func_show_eval '( cd "$output_objdir" && $RM "$outputname" && $LN_S "../$outputname" "$outputname" )' 'exit $?' 9455 ;; 9456 esac 9457 exit $EXIT_SUCCESS 9458} 9459 9460{ test "$opt_mode" = link || test "$opt_mode" = relink; } && 9461 func_mode_link ${1+"$@"} 9462 9463 9464# func_mode_uninstall arg... 9465func_mode_uninstall () 9466{ 9467 $opt_debug 9468 RM="$nonopt" 9469 files= 9470 rmforce= 9471 exit_status=0 9472 9473 # This variable tells wrapper scripts just to set variables rather 9474 # than running their programs. 9475 libtool_install_magic="$magic" 9476 9477 for arg 9478 do 9479 case $arg in 9480 -f) func_append RM " $arg"; rmforce=yes ;; 9481 -*) func_append RM " $arg" ;; 9482 *) func_append files " $arg" ;; 9483 esac 9484 done 9485 9486 test -z "$RM" && \ 9487 func_fatal_help "you must specify an RM program" 9488 9489 rmdirs= 9490 9491 for file in $files; do 9492 func_dirname "$file" "" "." 9493 dir="$func_dirname_result" 9494 if test "X$dir" = X.; then 9495 odir="$objdir" 9496 else 9497 odir="$dir/$objdir" 9498 fi 9499 func_basename "$file" 9500 name="$func_basename_result" 9501 test "$opt_mode" = uninstall && odir="$dir" 9502 9503 # Remember odir for removal later, being careful to avoid duplicates 9504 if test "$opt_mode" = clean; then 9505 case " $rmdirs " in 9506 *" $odir "*) ;; 9507 *) func_append rmdirs " $odir" ;; 9508 esac 9509 fi 9510 9511 # Don't error if the file doesn't exist and rm -f was used. 9512 if { test -L "$file"; } >/dev/null 2>&1 || 9513 { test -h "$file"; } >/dev/null 2>&1 || 9514 test -f "$file"; then 9515 : 9516 elif test -d "$file"; then 9517 exit_status=1 9518 continue 9519 elif test "$rmforce" = yes; then 9520 continue 9521 fi 9522 9523 rmfiles="$file" 9524 9525 case $name in 9526 *.la) 9527 # Possibly a libtool archive, so verify it. 9528 if func_lalib_p "$file"; then 9529 func_source $dir/$name 9530 9531 # Delete the libtool libraries and symlinks. 9532 for n in $library_names; do 9533 func_append rmfiles " $odir/$n" 9534 done 9535 test -n "$old_library" && func_append rmfiles " $odir/$old_library" 9536 9537 case "$opt_mode" in 9538 clean) 9539 case " $library_names " in 9540 *" $dlname "*) ;; 9541 *) test -n "$dlname" && func_append rmfiles " $odir/$dlname" ;; 9542 esac 9543 test -n "$libdir" && func_append rmfiles " $odir/$name $odir/${name}i" 9544 ;; 9545 uninstall) 9546 if test -n "$library_names"; then 9547 # Do each command in the postuninstall commands. 9548 func_execute_cmds "$postuninstall_cmds" 'test "$rmforce" = yes || exit_status=1' 9549 fi 9550 9551 if test -n "$old_library"; then 9552 # Do each command in the old_postuninstall commands. 9553 func_execute_cmds "$old_postuninstall_cmds" 'test "$rmforce" = yes || exit_status=1' 9554 fi 9555 # FIXME: should reinstall the best remaining shared library. 9556 ;; 9557 esac 9558 fi 9559 ;; 9560 9561 *.lo) 9562 # Possibly a libtool object, so verify it. 9563 if func_lalib_p "$file"; then 9564 9565 # Read the .lo file 9566 func_source $dir/$name 9567 9568 # Add PIC object to the list of files to remove. 9569 if test -n "$pic_object" && 9570 test "$pic_object" != none; then 9571 func_append rmfiles " $dir/$pic_object" 9572 fi 9573 9574 # Add non-PIC object to the list of files to remove. 9575 if test -n "$non_pic_object" && 9576 test "$non_pic_object" != none; then 9577 func_append rmfiles " $dir/$non_pic_object" 9578 fi 9579 fi 9580 ;; 9581 9582 *) 9583 if test "$opt_mode" = clean ; then 9584 noexename=$name 9585 case $file in 9586 *.exe) 9587 func_stripname '' '.exe' "$file" 9588 file=$func_stripname_result 9589 func_stripname '' '.exe' "$name" 9590 noexename=$func_stripname_result 9591 # $file with .exe has already been added to rmfiles, 9592 # add $file without .exe 9593 func_append rmfiles " $file" 9594 ;; 9595 esac 9596 # Do a test to see if this is a libtool program. 9597 if func_ltwrapper_p "$file"; then 9598 if func_ltwrapper_executable_p "$file"; then 9599 func_ltwrapper_scriptname "$file" 9600 relink_command= 9601 func_source $func_ltwrapper_scriptname_result 9602 func_append rmfiles " $func_ltwrapper_scriptname_result" 9603 else 9604 relink_command= 9605 func_source $dir/$noexename 9606 fi 9607 9608 # note $name still contains .exe if it was in $file originally 9609 # as does the version of $file that was added into $rmfiles 9610 func_append rmfiles " $odir/$name $odir/${name}S.${objext}" 9611 if test "$fast_install" = yes && test -n "$relink_command"; then 9612 func_append rmfiles " $odir/lt-$name" 9613 fi 9614 if test "X$noexename" != "X$name" ; then 9615 func_append rmfiles " $odir/lt-${noexename}.c" 9616 fi 9617 fi 9618 fi 9619 ;; 9620 esac 9621 func_show_eval "$RM $rmfiles" 'exit_status=1' 9622 done 9623 9624 # Try to remove the ${objdir}s in the directories where we deleted files 9625 for dir in $rmdirs; do 9626 if test -d "$dir"; then 9627 func_show_eval "rmdir $dir >/dev/null 2>&1" 9628 fi 9629 done 9630 9631 exit $exit_status 9632} 9633 9634{ test "$opt_mode" = uninstall || test "$opt_mode" = clean; } && 9635 func_mode_uninstall ${1+"$@"} 9636 9637test -z "$opt_mode" && { 9638 help="$generic_help" 9639 func_fatal_help "you must specify a MODE" 9640} 9641 9642test -z "$exec_cmd" && \ 9643 func_fatal_help "invalid operation mode \`$opt_mode'" 9644 9645if test -n "$exec_cmd"; then 9646 eval exec "$exec_cmd" 9647 exit $EXIT_FAILURE 9648fi 9649 9650exit $exit_status 9651 9652 9653# The TAGs below are defined such that we never get into a situation 9654# in which we disable both kinds of libraries. Given conflicting 9655# choices, we go for a static library, that is the most portable, 9656# since we can't tell whether shared libraries were disabled because 9657# the user asked for that or because the platform doesn't support 9658# them. This is particularly important on AIX, because we don't 9659# support having both static and shared libraries enabled at the same 9660# time on that platform, so we default to a shared-only configuration. 9661# If a disable-shared tag is given, we'll fallback to a static-only 9662# configuration. But we'll never go from static-only to shared-only. 9663 9664# ### BEGIN LIBTOOL TAG CONFIG: disable-shared 9665build_libtool_libs=no 9666build_old_libs=yes 9667# ### END LIBTOOL TAG CONFIG: disable-shared 9668 9669# ### BEGIN LIBTOOL TAG CONFIG: disable-static 9670build_old_libs=`case $build_libtool_libs in yes) echo no;; *) echo yes;; esac` 9671# ### END LIBTOOL TAG CONFIG: disable-static 9672 9673# Local Variables: 9674# mode:shell-script 9675# sh-indentation:2 9676# End: 9677# vi:sw=2 9678