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