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