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