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