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