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