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