Jeff Thompson | 3617406 | 2013-06-21 16:03:44 -0700 | [diff] [blame] | 1 | #! /bin/sh |
| 2 | |
| 3 | # libtool - Provide generalized library-building support services. |
Jeff Thompson | 93a2416 | 2013-09-27 13:28:13 -0700 | [diff] [blame] | 4 | # Generated automatically by config.status (ndn-cpp) 0.2 |
Jeff Thompson | b752300 | 2013-10-09 10:25:00 -0700 | [diff] [blame^] | 5 | # Libtool was configured on host lance.tft.ucla.edu: |
Jeff Thompson | 3617406 | 2013-06-21 16:03:44 -0700 | [diff] [blame] | 6 | # NOTE: Changes made to this file will be lost: look at ltmain.sh. |
| 7 | # |
| 8 | # Copyright (C) 1996, 1997, 1998, 1999, 2000, 2001, 2003, 2004, 2005, |
| 9 | # 2006, 2007, 2008, 2009, 2010, 2011 Free Software |
| 10 | # Foundation, Inc. |
| 11 | # Written by Gordon Matzigkeit, 1996 |
| 12 | # |
| 13 | # This file is part of GNU Libtool. |
| 14 | # |
| 15 | # GNU Libtool is free software; you can redistribute it and/or |
| 16 | # modify it under the terms of the GNU General Public License as |
| 17 | # published by the Free Software Foundation; either version 2 of |
| 18 | # the License, or (at your option) any later version. |
| 19 | # |
| 20 | # As a special exception to the GNU General Public License, |
| 21 | # if you distribute this file as part of a program or library that |
| 22 | # is built using GNU Libtool, you may include this file under the |
| 23 | # same distribution terms that you use for the rest of that program. |
| 24 | # |
| 25 | # GNU Libtool is distributed in the hope that it will be useful, |
| 26 | # but WITHOUT ANY WARRANTY; without even the implied warranty of |
| 27 | # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
| 28 | # GNU General Public License for more details. |
| 29 | # |
| 30 | # You should have received a copy of the GNU General Public License |
| 31 | # along with GNU Libtool; see the file COPYING. If not, a copy |
| 32 | # can be downloaded from http://www.gnu.org/licenses/gpl.html, or |
| 33 | # obtained by writing to the Free Software Foundation, Inc., |
| 34 | # 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. |
| 35 | |
| 36 | |
| 37 | # The names of the tagged configurations supported by this script. |
| 38 | available_tags="CXX " |
| 39 | |
| 40 | # ### BEGIN LIBTOOL CONFIG |
| 41 | |
| 42 | # Which release of libtool.m4 was used? |
| 43 | macro_version=2.4.2 |
| 44 | macro_revision=1.3337 |
| 45 | |
| 46 | # Whether or not to build shared libraries. |
Jeff Thompson | 4f03164 | 2013-08-05 11:03:16 -0700 | [diff] [blame] | 47 | build_libtool_libs=yes |
Jeff Thompson | 3617406 | 2013-06-21 16:03:44 -0700 | [diff] [blame] | 48 | |
| 49 | # Whether or not to build static libraries. |
| 50 | build_old_libs=yes |
| 51 | |
| 52 | # What type of objects to build. |
| 53 | pic_mode=default |
| 54 | |
| 55 | # Whether or not to optimize for fast installation. |
| 56 | fast_install=needless |
| 57 | |
| 58 | # Shell to use when invoking shell scripts. |
| 59 | SHELL="/bin/sh" |
| 60 | |
| 61 | # An echo program that protects backslashes. |
| 62 | ECHO="printf %s\\n" |
| 63 | |
| 64 | # The PATH separator for the build system. |
| 65 | PATH_SEPARATOR=":" |
| 66 | |
| 67 | # The host system. |
| 68 | host_alias= |
Jeff Thompson | b752300 | 2013-10-09 10:25:00 -0700 | [diff] [blame^] | 69 | host=x86_64-apple-darwin12.5.0 |
| 70 | host_os=darwin12.5.0 |
Jeff Thompson | 3617406 | 2013-06-21 16:03:44 -0700 | [diff] [blame] | 71 | |
| 72 | # The build system. |
| 73 | build_alias= |
Jeff Thompson | b752300 | 2013-10-09 10:25:00 -0700 | [diff] [blame^] | 74 | build=x86_64-apple-darwin12.5.0 |
| 75 | build_os=darwin12.5.0 |
Jeff Thompson | 3617406 | 2013-06-21 16:03:44 -0700 | [diff] [blame] | 76 | |
| 77 | # A sed program that does not truncate output. |
| 78 | SED="/usr/bin/sed" |
| 79 | |
| 80 | # Sed that helps us avoid accidentally triggering echo(1) options like -n. |
| 81 | Xsed="$SED -e 1s/^X//" |
| 82 | |
| 83 | # A grep program that handles long lines. |
| 84 | GREP="/usr/bin/grep" |
| 85 | |
| 86 | # An ERE matcher. |
| 87 | EGREP="/usr/bin/grep -E" |
| 88 | |
| 89 | # A literal string matcher. |
| 90 | FGREP="/usr/bin/grep -F" |
| 91 | |
| 92 | # A BSD- or MS-compatible name lister. |
| 93 | NM="/opt/local/bin/nm" |
| 94 | |
| 95 | # Whether we need soft or hard links. |
| 96 | LN_S="ln -s" |
| 97 | |
| 98 | # What is the maximum length of a command? |
| 99 | max_cmd_len=196608 |
| 100 | |
| 101 | # Object file suffix (normally "o"). |
| 102 | objext=o |
| 103 | |
| 104 | # Executable file suffix (normally ""). |
| 105 | exeext= |
| 106 | |
| 107 | # whether the shell understands "unset". |
| 108 | lt_unset=unset |
| 109 | |
| 110 | # turn spaces into newlines. |
| 111 | SP2NL="tr \\040 \\012" |
| 112 | |
| 113 | # turn newlines into spaces. |
| 114 | NL2SP="tr \\015\\012 \\040\\040" |
| 115 | |
| 116 | # convert $build file names to $host format. |
| 117 | to_host_file_cmd=func_convert_file_noop |
| 118 | |
| 119 | # convert $build files to toolchain format. |
| 120 | to_tool_file_cmd=func_convert_file_noop |
| 121 | |
| 122 | # An object symbol dumper. |
| 123 | OBJDUMP="false" |
| 124 | |
| 125 | # Method to check whether dependent libraries are shared objects. |
| 126 | deplibs_check_method="pass_all" |
| 127 | |
| 128 | # Command to use when deplibs_check_method = "file_magic". |
| 129 | file_magic_cmd="\$MAGIC_CMD" |
| 130 | |
| 131 | # How to find potential files when deplibs_check_method = "file_magic". |
| 132 | file_magic_glob="" |
| 133 | |
| 134 | # Find potential files using nocaseglob when deplibs_check_method = "file_magic". |
| 135 | want_nocaseglob="no" |
| 136 | |
| 137 | # DLL creation program. |
| 138 | DLLTOOL="false" |
| 139 | |
| 140 | # Command to associate shared and link libraries. |
| 141 | sharedlib_from_linklib_cmd="printf %s\\n" |
| 142 | |
| 143 | # The archiver. |
| 144 | AR="ar" |
| 145 | |
| 146 | # Flags to create an archive. |
| 147 | AR_FLAGS="cru" |
| 148 | |
| 149 | # How to feed a file listing to the archiver. |
| 150 | archiver_list_spec="" |
| 151 | |
| 152 | # A symbol stripping program. |
| 153 | STRIP="strip" |
| 154 | |
| 155 | # Commands used to install an old-style archive. |
| 156 | RANLIB="ranlib" |
| 157 | old_postinstall_cmds="chmod 644 \$oldlib~\$RANLIB \$tool_oldlib" |
| 158 | old_postuninstall_cmds="" |
| 159 | |
| 160 | # Whether to use a lock for old archive extraction. |
| 161 | lock_old_archive_extraction=yes |
| 162 | |
| 163 | # A C compiler. |
| 164 | LTCC="gcc" |
| 165 | |
| 166 | # LTCC compiler flags. |
| 167 | LTCFLAGS="-g -O2" |
| 168 | |
| 169 | # Take the output of nm and produce a listing of raw symbols and C names. |
| 170 | global_symbol_pipe="sed -n -e 's/^.*[ ]\\([BCDEGRST][BCDEGRST]*\\)[ ][ ]*_\\([_A-Za-z][_A-Za-z0-9]*\\)\$/\\1 _\\2 \\2/p' | sed '/ __gnu_lto/d'" |
| 171 | |
| 172 | # Transform the output of nm in a proper C declaration. |
| 173 | global_symbol_to_cdecl="sed -n -e 's/^T .* \\(.*\\)\$/extern int \\1();/p' -e 's/^[BCDEGRST]* .* \\(.*\\)\$/extern char \\1;/p'" |
| 174 | |
| 175 | # Transform the output of nm in a C name address pair. |
| 176 | global_symbol_to_c_name_address="sed -n -e 's/^: \\([^ ]*\\)[ ]*\$/ {\\\"\\1\\\", (void *) 0},/p' -e 's/^[BCDEGRST]* \\([^ ]*\\) \\([^ ]*\\)\$/ {\"\\2\", (void *) \\&\\2},/p'" |
| 177 | |
| 178 | # Transform the output of nm in a C name address pair when lib prefix is needed. |
| 179 | global_symbol_to_c_name_address_lib_prefix="sed -n -e 's/^: \\([^ ]*\\)[ ]*\$/ {\\\"\\1\\\", (void *) 0},/p' -e 's/^[BCDEGRST]* \\([^ ]*\\) \\(lib[^ ]*\\)\$/ {\"\\2\", (void *) \\&\\2},/p' -e 's/^[BCDEGRST]* \\([^ ]*\\) \\([^ ]*\\)\$/ {\"lib\\2\", (void *) \\&\\2},/p'" |
| 180 | |
| 181 | # Specify filename containing input files for $NM. |
| 182 | nm_file_list_spec="" |
| 183 | |
| 184 | # The root where to search for dependent libraries,and in which our libraries should be installed. |
| 185 | lt_sysroot= |
| 186 | |
| 187 | # The name of the directory that contains temporary libtool files. |
| 188 | objdir=.libs |
| 189 | |
| 190 | # Used to examine libraries when file_magic_cmd begins with "file". |
| 191 | MAGIC_CMD=file |
| 192 | |
| 193 | # Must we lock files when doing compilation? |
| 194 | need_locks="no" |
| 195 | |
| 196 | # Manifest tool. |
| 197 | MANIFEST_TOOL=":" |
| 198 | |
| 199 | # Tool to manipulate archived DWARF debug symbol files on Mac OS X. |
| 200 | DSYMUTIL="dsymutil" |
| 201 | |
| 202 | # Tool to change global to local symbols on Mac OS X. |
| 203 | NMEDIT="nmedit" |
| 204 | |
| 205 | # Tool to manipulate fat objects and archives on Mac OS X. |
| 206 | LIPO="lipo" |
| 207 | |
| 208 | # ldd/readelf like tool for Mach-O binaries on Mac OS X. |
| 209 | OTOOL="otool" |
| 210 | |
| 211 | # ldd/readelf like tool for 64 bit Mach-O binaries on Mac OS X 10.4. |
| 212 | OTOOL64=":" |
| 213 | |
| 214 | # Old archive suffix (normally "a"). |
| 215 | libext=a |
| 216 | |
| 217 | # Shared library suffix (normally ".so"). |
| 218 | shrext_cmds="\`test .\$module = .yes && echo .so || echo .dylib\`" |
| 219 | |
| 220 | # The commands to extract the exported symbol list from a shared archive. |
| 221 | extract_expsyms_cmds="" |
| 222 | |
| 223 | # Variables whose values should be saved in libtool wrapper scripts and |
| 224 | # restored at link time. |
| 225 | variables_saved_for_relink="PATH DYLD_LIBRARY_PATH GCC_EXEC_PREFIX COMPILER_PATH LIBRARY_PATH" |
| 226 | |
| 227 | # Do we need the "lib" prefix for modules? |
| 228 | need_lib_prefix=no |
| 229 | |
| 230 | # Do we need a version for libraries? |
| 231 | need_version=no |
| 232 | |
| 233 | # Library versioning type. |
| 234 | version_type=darwin |
| 235 | |
| 236 | # Shared library runtime path variable. |
| 237 | runpath_var= |
| 238 | |
| 239 | # Shared library path variable. |
| 240 | shlibpath_var=DYLD_LIBRARY_PATH |
| 241 | |
| 242 | # Is shlibpath searched before the hard-coded library search path? |
| 243 | shlibpath_overrides_runpath=yes |
| 244 | |
| 245 | # Format of library name prefix. |
| 246 | libname_spec="lib\$name" |
| 247 | |
| 248 | # List of archive names. First name is the real one, the rest are links. |
| 249 | # The last name is the one that the linker finds with -lNAME |
| 250 | library_names_spec="\${libname}\${release}\${major}\$shared_ext \${libname}\$shared_ext" |
| 251 | |
| 252 | # The coded name of the library, if different from the real name. |
| 253 | soname_spec="\${libname}\${release}\${major}\$shared_ext" |
| 254 | |
| 255 | # Permission mode override for installation of shared libraries. |
| 256 | install_override_mode="" |
| 257 | |
| 258 | # Command to use after installation of a shared archive. |
| 259 | postinstall_cmds="" |
| 260 | |
| 261 | # Command to use after uninstallation of a shared archive. |
| 262 | postuninstall_cmds="" |
| 263 | |
| 264 | # Commands used to finish a libtool library installation in a directory. |
| 265 | finish_cmds="" |
| 266 | |
| 267 | # As "finish_cmds", except a single script fragment to be evaled but |
| 268 | # not shown. |
| 269 | finish_eval="" |
| 270 | |
| 271 | # Whether we should hardcode library paths into libraries. |
| 272 | hardcode_into_libs=no |
| 273 | |
| 274 | # Compile-time system search path for libraries. |
Jeff Thompson | 965a324 | 2013-10-02 09:59:35 -0700 | [diff] [blame] | 275 | sys_lib_search_path_spec="/usr/llvm-gcc-4.2/lib/gcc/i686-apple-darwin11/4.2.1/x86_64 /usr/lib /usr/llvm-gcc-4.2/lib/gcc /usr/llvm-gcc-4.2/lib /usr/local/lib" |
Jeff Thompson | 3617406 | 2013-06-21 16:03:44 -0700 | [diff] [blame] | 276 | |
| 277 | # Run-time system search path for libraries. |
| 278 | sys_lib_dlsearch_path_spec="/usr/local/lib /lib /usr/lib" |
| 279 | |
| 280 | # Whether dlopen is supported. |
| 281 | dlopen_support=unknown |
| 282 | |
| 283 | # Whether dlopen of programs is supported. |
| 284 | dlopen_self=unknown |
| 285 | |
| 286 | # Whether dlopen of statically linked programs is supported. |
| 287 | dlopen_self_static=unknown |
| 288 | |
| 289 | # Commands to strip libraries. |
| 290 | old_striplib="strip -S" |
| 291 | striplib="strip -x" |
| 292 | |
| 293 | |
| 294 | # The linker used to build libraries. |
| 295 | LD="/usr/llvm-gcc-4.2/libexec/gcc/i686-apple-darwin11/4.2.1/ld" |
| 296 | |
| 297 | # How to create reloadable object files. |
| 298 | reload_flag=" -r" |
| 299 | reload_cmds="\$LTCC \$LTCFLAGS -nostdlib \${wl}-r -o \$output\$reload_objs" |
| 300 | |
| 301 | # Commands used to build an old-style archive. |
| 302 | old_archive_cmds="\$AR \$AR_FLAGS \$oldlib\$oldobjs~\$RANLIB \$tool_oldlib" |
| 303 | |
| 304 | # A language specific compiler. |
| 305 | CC="gcc" |
| 306 | |
| 307 | # Is the compiler the GNU compiler? |
| 308 | with_gcc=yes |
| 309 | |
| 310 | # Compiler flag to turn off builtin functions. |
| 311 | no_builtin_flag=" -fno-builtin" |
| 312 | |
| 313 | # Additional compiler flags for building library objects. |
| 314 | pic_flag=" -fno-common -DPIC" |
| 315 | |
| 316 | # How to pass a linker flag through the compiler. |
| 317 | wl="-Wl," |
| 318 | |
| 319 | # Compiler flag to prevent dynamic linking. |
| 320 | link_static_flag="" |
| 321 | |
| 322 | # Does compiler simultaneously support -c and -o options? |
| 323 | compiler_c_o="yes" |
| 324 | |
| 325 | # Whether or not to add -lc for building shared libraries. |
| 326 | build_libtool_need_lc=no |
| 327 | |
| 328 | # Whether or not to disallow shared libs when runtime libs are static. |
| 329 | allow_libtool_libs_with_static_runtimes=no |
| 330 | |
| 331 | # Compiler flag to allow reflexive dlopens. |
| 332 | export_dynamic_flag_spec="" |
| 333 | |
| 334 | # Compiler flag to generate shared objects directly from archives. |
| 335 | whole_archive_flag_spec="\`for conv in \$convenience\\\"\\\"; do test -n \\\"\$conv\\\" && new_convenience=\\\"\$new_convenience \${wl}-force_load,\$conv\\\"; done; func_echo_all \\\"\$new_convenience\\\"\`" |
| 336 | |
| 337 | # Whether the compiler copes with passing no objects directly. |
| 338 | compiler_needs_object="no" |
| 339 | |
| 340 | # Create an old-style archive from a shared archive. |
| 341 | old_archive_from_new_cmds="" |
| 342 | |
| 343 | # Create a temporary old-style archive to link instead of a shared archive. |
| 344 | old_archive_from_expsyms_cmds="" |
| 345 | |
| 346 | # Commands used to build a shared archive. |
| 347 | archive_cmds="\$CC -dynamiclib \$allow_undefined_flag -o \$lib \$libobjs \$deplibs \$compiler_flags -install_name \$rpath/\$soname \$verstring \$single_module" |
| 348 | archive_expsym_cmds="sed 's,^,_,' < \$export_symbols > \$output_objdir/\${libname}-symbols.expsym~\$CC -dynamiclib \$allow_undefined_flag -o \$lib \$libobjs \$deplibs \$compiler_flags -install_name \$rpath/\$soname \$verstring \$single_module \${wl}-exported_symbols_list,\$output_objdir/\${libname}-symbols.expsym" |
| 349 | |
| 350 | # Commands used to build a loadable module if different from building |
| 351 | # a shared archive. |
| 352 | module_cmds="\$CC \$allow_undefined_flag -o \$lib -bundle \$libobjs \$deplibs \$compiler_flags" |
| 353 | module_expsym_cmds="sed -e 's,^,_,' < \$export_symbols > \$output_objdir/\${libname}-symbols.expsym~\$CC \$allow_undefined_flag -o \$lib -bundle \$libobjs \$deplibs \$compiler_flags \${wl}-exported_symbols_list,\$output_objdir/\${libname}-symbols.expsym" |
| 354 | |
| 355 | # Whether we are building with GNU ld or not. |
| 356 | with_gnu_ld="no" |
| 357 | |
| 358 | # Flag that allows shared libraries with undefined symbols to be built. |
| 359 | allow_undefined_flag="\${wl}-undefined \${wl}dynamic_lookup" |
| 360 | |
| 361 | # Flag that enforces no undefined symbols. |
| 362 | no_undefined_flag="" |
| 363 | |
| 364 | # Flag to hardcode $libdir into a binary during linking. |
| 365 | # This must work even if $libdir does not exist |
| 366 | hardcode_libdir_flag_spec="" |
| 367 | |
| 368 | # Whether we need a single "-rpath" flag with a separated argument. |
| 369 | hardcode_libdir_separator="" |
| 370 | |
| 371 | # Set to "yes" if using DIR/libNAME${shared_ext} during linking hardcodes |
| 372 | # DIR into the resulting binary. |
| 373 | hardcode_direct=no |
| 374 | |
| 375 | # Set to "yes" if using DIR/libNAME${shared_ext} during linking hardcodes |
| 376 | # DIR into the resulting binary and the resulting library dependency is |
| 377 | # "absolute",i.e impossible to change by setting ${shlibpath_var} if the |
| 378 | # library is relocated. |
| 379 | hardcode_direct_absolute=no |
| 380 | |
| 381 | # Set to "yes" if using the -LDIR flag during linking hardcodes DIR |
| 382 | # into the resulting binary. |
| 383 | hardcode_minus_L=no |
| 384 | |
| 385 | # Set to "yes" if using SHLIBPATH_VAR=DIR during linking hardcodes DIR |
| 386 | # into the resulting binary. |
| 387 | hardcode_shlibpath_var=unsupported |
| 388 | |
| 389 | # Set to "yes" if building a shared library automatically hardcodes DIR |
| 390 | # into the library and all subsequent libraries and executables linked |
| 391 | # against it. |
| 392 | hardcode_automatic=yes |
| 393 | |
| 394 | # Set to yes if linker adds runtime paths of dependent libraries |
| 395 | # to runtime path list. |
| 396 | inherit_rpath=no |
| 397 | |
| 398 | # Whether libtool must link a program against all its dependency libraries. |
| 399 | link_all_deplibs=yes |
| 400 | |
| 401 | # Set to "yes" if exported symbols are required. |
| 402 | always_export_symbols=no |
| 403 | |
| 404 | # The commands to list exported symbols. |
| 405 | export_symbols_cmds="\$NM \$libobjs \$convenience | \$global_symbol_pipe | \$SED 's/.* //' | sort | uniq > \$export_symbols" |
| 406 | |
| 407 | # Symbols that should not be listed in the preloaded symbols. |
| 408 | exclude_expsyms="_GLOBAL_OFFSET_TABLE_|_GLOBAL__F[ID]_.*" |
| 409 | |
| 410 | # Symbols that must always be exported. |
| 411 | include_expsyms="" |
| 412 | |
| 413 | # Commands necessary for linking programs (against libraries) with templates. |
| 414 | prelink_cmds="" |
| 415 | |
| 416 | # Commands necessary for finishing linking programs. |
| 417 | postlink_cmds="" |
| 418 | |
| 419 | # Specify filename containing input files. |
| 420 | file_list_spec="" |
| 421 | |
| 422 | # How to hardcode a shared library path into an executable. |
| 423 | hardcode_action=immediate |
| 424 | |
| 425 | # The directories searched by this compiler when creating a shared library. |
| 426 | compiler_lib_search_dirs="" |
| 427 | |
| 428 | # Dependencies to place before and after the objects being linked to |
| 429 | # create a shared library. |
| 430 | predep_objects="" |
| 431 | postdep_objects="" |
| 432 | predeps="" |
| 433 | postdeps="" |
| 434 | |
| 435 | # The library search path used internally by the compiler when linking |
| 436 | # a shared library. |
| 437 | compiler_lib_search_path="" |
| 438 | |
| 439 | # ### END LIBTOOL CONFIG |
| 440 | |
| 441 | |
| 442 | # libtool (GNU libtool) 2.4.2 |
| 443 | # Written by Gordon Matzigkeit <gord@gnu.ai.mit.edu>, 1996 |
| 444 | |
| 445 | # Copyright (C) 1996, 1997, 1998, 1999, 2000, 2001, 2003, 2004, 2005, 2006, |
| 446 | # 2007, 2008, 2009, 2010, 2011 Free Software Foundation, Inc. |
| 447 | # This is free software; see the source for copying conditions. There is NO |
| 448 | # warranty; not even for MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. |
| 449 | |
| 450 | # GNU Libtool is free software; you can redistribute it and/or modify |
| 451 | # it under the terms of the GNU General Public License as published by |
| 452 | # the Free Software Foundation; either version 2 of the License, or |
| 453 | # (at your option) any later version. |
| 454 | # |
| 455 | # As a special exception to the GNU General Public License, |
| 456 | # if you distribute this file as part of a program or library that |
| 457 | # is built using GNU Libtool, you may include this file under the |
| 458 | # same distribution terms that you use for the rest of that program. |
| 459 | # |
| 460 | # GNU Libtool is distributed in the hope that it will be useful, but |
| 461 | # WITHOUT ANY WARRANTY; without even the implied warranty of |
| 462 | # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU |
| 463 | # General Public License for more details. |
| 464 | # |
| 465 | # You should have received a copy of the GNU General Public License |
| 466 | # along with GNU Libtool; see the file COPYING. If not, a copy |
| 467 | # can be downloaded from http://www.gnu.org/licenses/gpl.html, |
| 468 | # or obtained by writing to the Free Software Foundation, Inc., |
| 469 | # 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. |
| 470 | |
| 471 | # Usage: $progname [OPTION]... [MODE-ARG]... |
| 472 | # |
| 473 | # Provide generalized library-building support services. |
| 474 | # |
| 475 | # --config show all configuration variables |
| 476 | # --debug enable verbose shell tracing |
| 477 | # -n, --dry-run display commands without modifying any files |
| 478 | # --features display basic configuration information and exit |
| 479 | # --mode=MODE use operation mode MODE |
| 480 | # --preserve-dup-deps don't remove duplicate dependency libraries |
| 481 | # --quiet, --silent don't print informational messages |
| 482 | # --no-quiet, --no-silent |
| 483 | # print informational messages (default) |
| 484 | # --no-warn don't display warning messages |
| 485 | # --tag=TAG use configuration variables from tag TAG |
| 486 | # -v, --verbose print more informational messages than default |
| 487 | # --no-verbose don't print the extra informational messages |
| 488 | # --version print version information |
| 489 | # -h, --help, --help-all print short, long, or detailed help message |
| 490 | # |
| 491 | # MODE must be one of the following: |
| 492 | # |
| 493 | # clean remove files from the build directory |
| 494 | # compile compile a source file into a libtool object |
| 495 | # execute automatically set library path, then run a program |
| 496 | # finish complete the installation of libtool libraries |
| 497 | # install install libraries or executables |
| 498 | # link create a library or an executable |
| 499 | # uninstall remove libraries from an installed directory |
| 500 | # |
| 501 | # MODE-ARGS vary depending on the MODE. When passed as first option, |
| 502 | # `--mode=MODE' may be abbreviated as `MODE' or a unique abbreviation of that. |
| 503 | # Try `$progname --help --mode=MODE' for a more detailed description of MODE. |
| 504 | # |
| 505 | # When reporting a bug, please describe a test case to reproduce it and |
| 506 | # include the following information: |
| 507 | # |
| 508 | # host-triplet: $host |
| 509 | # shell: $SHELL |
| 510 | # compiler: $LTCC |
| 511 | # compiler flags: $LTCFLAGS |
| 512 | # linker: $LD (gnu? $with_gnu_ld) |
| 513 | # $progname: (GNU libtool) 2.4.2 |
| 514 | # automake: $automake_version |
| 515 | # autoconf: $autoconf_version |
| 516 | # |
| 517 | # Report bugs to <bug-libtool@gnu.org>. |
| 518 | # GNU libtool home page: <http://www.gnu.org/software/libtool/>. |
| 519 | # General help using GNU software: <http://www.gnu.org/gethelp/>. |
| 520 | |
| 521 | PROGRAM=libtool |
| 522 | PACKAGE=libtool |
| 523 | VERSION=2.4.2 |
| 524 | TIMESTAMP="" |
| 525 | package_revision=1.3337 |
| 526 | |
| 527 | # Be Bourne compatible |
| 528 | if test -n "${ZSH_VERSION+set}" && (emulate sh) >/dev/null 2>&1; then |
| 529 | emulate sh |
| 530 | NULLCMD=: |
| 531 | # Zsh 3.x and 4.x performs word splitting on ${1+"$@"}, which |
| 532 | # is contrary to our usage. Disable this feature. |
| 533 | alias -g '${1+"$@"}'='"$@"' |
| 534 | setopt NO_GLOB_SUBST |
| 535 | else |
| 536 | case `(set -o) 2>/dev/null` in *posix*) set -o posix;; esac |
| 537 | fi |
| 538 | BIN_SH=xpg4; export BIN_SH # for Tru64 |
| 539 | DUALCASE=1; export DUALCASE # for MKS sh |
| 540 | |
| 541 | # A function that is used when there is no print builtin or printf. |
| 542 | func_fallback_echo () |
| 543 | { |
| 544 | eval 'cat <<_LTECHO_EOF |
| 545 | $1 |
| 546 | _LTECHO_EOF' |
| 547 | } |
| 548 | |
| 549 | # NLS nuisances: We save the old values to restore during execute mode. |
| 550 | lt_user_locale= |
| 551 | lt_safe_locale= |
| 552 | for lt_var in LANG LANGUAGE LC_ALL LC_CTYPE LC_COLLATE LC_MESSAGES |
| 553 | do |
| 554 | eval "if test \"\${$lt_var+set}\" = set; then |
| 555 | save_$lt_var=\$$lt_var |
| 556 | $lt_var=C |
| 557 | export $lt_var |
| 558 | lt_user_locale=\"$lt_var=\\\$save_\$lt_var; \$lt_user_locale\" |
| 559 | lt_safe_locale=\"$lt_var=C; \$lt_safe_locale\" |
| 560 | fi" |
| 561 | done |
| 562 | LC_ALL=C |
| 563 | LANGUAGE=C |
| 564 | export LANGUAGE LC_ALL |
| 565 | |
| 566 | $lt_unset CDPATH |
| 567 | |
| 568 | |
| 569 | # Work around backward compatibility issue on IRIX 6.5. On IRIX 6.4+, sh |
| 570 | # is ksh but when the shell is invoked as "sh" and the current value of |
| 571 | # the _XPG environment variable is not equal to 1 (one), the special |
| 572 | # positional parameter $0, within a function call, is the name of the |
| 573 | # function. |
| 574 | progpath="$0" |
| 575 | |
| 576 | |
| 577 | |
| 578 | : ${CP="cp -f"} |
| 579 | test "${ECHO+set}" = set || ECHO=${as_echo-'printf %s\n'} |
| 580 | : ${MAKE="make"} |
| 581 | : ${MKDIR="mkdir"} |
| 582 | : ${MV="mv -f"} |
| 583 | : ${RM="rm -f"} |
| 584 | : ${SHELL="${CONFIG_SHELL-/bin/sh}"} |
| 585 | : ${Xsed="$SED -e 1s/^X//"} |
| 586 | |
| 587 | # Global variables: |
| 588 | EXIT_SUCCESS=0 |
| 589 | EXIT_FAILURE=1 |
| 590 | EXIT_MISMATCH=63 # $? = 63 is used to indicate version mismatch to missing. |
| 591 | EXIT_SKIP=77 # $? = 77 is used to indicate a skipped test to automake. |
| 592 | |
| 593 | exit_status=$EXIT_SUCCESS |
| 594 | |
| 595 | # Make sure IFS has a sensible default |
| 596 | lt_nl=' |
| 597 | ' |
| 598 | IFS=" $lt_nl" |
| 599 | |
| 600 | dirname="s,/[^/]*$,," |
| 601 | basename="s,^.*/,," |
| 602 | |
| 603 | # func_dirname file append nondir_replacement |
| 604 | # Compute the dirname of FILE. If nonempty, add APPEND to the result, |
| 605 | # otherwise set result to NONDIR_REPLACEMENT. |
| 606 | func_dirname () |
| 607 | { |
| 608 | case ${1} in |
| 609 | */*) func_dirname_result="${1%/*}${2}" ;; |
| 610 | * ) func_dirname_result="${3}" ;; |
| 611 | esac |
| 612 | } # Extended-shell func_dirname implementation |
| 613 | |
| 614 | |
| 615 | # func_basename file |
| 616 | func_basename () |
| 617 | { |
| 618 | func_basename_result="${1##*/}" |
| 619 | } # Extended-shell func_basename implementation |
| 620 | |
| 621 | |
| 622 | # func_dirname_and_basename file append nondir_replacement |
| 623 | # perform func_basename and func_dirname in a single function |
| 624 | # call: |
| 625 | # dirname: Compute the dirname of FILE. If nonempty, |
| 626 | # add APPEND to the result, otherwise set result |
| 627 | # to NONDIR_REPLACEMENT. |
| 628 | # value returned in "$func_dirname_result" |
| 629 | # basename: Compute filename of FILE. |
| 630 | # value retuned in "$func_basename_result" |
| 631 | # Implementation must be kept synchronized with func_dirname |
| 632 | # and func_basename. For efficiency, we do not delegate to |
| 633 | # those functions but instead duplicate the functionality here. |
| 634 | func_dirname_and_basename () |
| 635 | { |
| 636 | case ${1} in |
| 637 | */*) func_dirname_result="${1%/*}${2}" ;; |
| 638 | * ) func_dirname_result="${3}" ;; |
| 639 | esac |
| 640 | func_basename_result="${1##*/}" |
| 641 | } # Extended-shell func_dirname_and_basename implementation |
| 642 | |
| 643 | |
| 644 | # func_stripname prefix suffix name |
| 645 | # strip PREFIX and SUFFIX off of NAME. |
| 646 | # PREFIX and SUFFIX must not contain globbing or regex special |
| 647 | # characters, hashes, percent signs, but SUFFIX may contain a leading |
| 648 | # dot (in which case that matches only a dot). |
| 649 | # func_strip_suffix prefix name |
| 650 | func_stripname () |
| 651 | { |
| 652 | # pdksh 5.2.14 does not do ${X%$Y} correctly if both X and Y are |
| 653 | # positional parameters, so assign one to ordinary parameter first. |
| 654 | func_stripname_result=${3} |
| 655 | func_stripname_result=${func_stripname_result#"${1}"} |
| 656 | func_stripname_result=${func_stripname_result%"${2}"} |
| 657 | } # Extended-shell func_stripname implementation |
| 658 | |
| 659 | |
| 660 | # These SED scripts presuppose an absolute path with a trailing slash. |
| 661 | pathcar='s,^/\([^/]*\).*$,\1,' |
| 662 | pathcdr='s,^/[^/]*,,' |
| 663 | removedotparts=':dotsl |
| 664 | s@/\./@/@g |
| 665 | t dotsl |
| 666 | s,/\.$,/,' |
| 667 | collapseslashes='s@/\{1,\}@/@g' |
| 668 | finalslash='s,/*$,/,' |
| 669 | |
| 670 | # func_normal_abspath PATH |
| 671 | # Remove doubled-up and trailing slashes, "." path components, |
| 672 | # and cancel out any ".." path components in PATH after making |
| 673 | # it an absolute path. |
| 674 | # value returned in "$func_normal_abspath_result" |
| 675 | func_normal_abspath () |
| 676 | { |
| 677 | # Start from root dir and reassemble the path. |
| 678 | func_normal_abspath_result= |
| 679 | func_normal_abspath_tpath=$1 |
| 680 | func_normal_abspath_altnamespace= |
| 681 | case $func_normal_abspath_tpath in |
| 682 | "") |
| 683 | # Empty path, that just means $cwd. |
| 684 | func_stripname '' '/' "`pwd`" |
| 685 | func_normal_abspath_result=$func_stripname_result |
| 686 | return |
| 687 | ;; |
| 688 | # The next three entries are used to spot a run of precisely |
| 689 | # two leading slashes without using negated character classes; |
| 690 | # we take advantage of case's first-match behaviour. |
| 691 | ///*) |
| 692 | # Unusual form of absolute path, do nothing. |
| 693 | ;; |
| 694 | //*) |
| 695 | # Not necessarily an ordinary path; POSIX reserves leading '//' |
| 696 | # and for example Cygwin uses it to access remote file shares |
| 697 | # over CIFS/SMB, so we conserve a leading double slash if found. |
| 698 | func_normal_abspath_altnamespace=/ |
| 699 | ;; |
| 700 | /*) |
| 701 | # Absolute path, do nothing. |
| 702 | ;; |
| 703 | *) |
| 704 | # Relative path, prepend $cwd. |
| 705 | func_normal_abspath_tpath=`pwd`/$func_normal_abspath_tpath |
| 706 | ;; |
| 707 | esac |
| 708 | # Cancel out all the simple stuff to save iterations. We also want |
| 709 | # the path to end with a slash for ease of parsing, so make sure |
| 710 | # there is one (and only one) here. |
| 711 | func_normal_abspath_tpath=`$ECHO "$func_normal_abspath_tpath" | $SED \ |
| 712 | -e "$removedotparts" -e "$collapseslashes" -e "$finalslash"` |
| 713 | while :; do |
| 714 | # Processed it all yet? |
| 715 | if test "$func_normal_abspath_tpath" = / ; then |
| 716 | # If we ascended to the root using ".." the result may be empty now. |
| 717 | if test -z "$func_normal_abspath_result" ; then |
| 718 | func_normal_abspath_result=/ |
| 719 | fi |
| 720 | break |
| 721 | fi |
| 722 | func_normal_abspath_tcomponent=`$ECHO "$func_normal_abspath_tpath" | $SED \ |
| 723 | -e "$pathcar"` |
| 724 | func_normal_abspath_tpath=`$ECHO "$func_normal_abspath_tpath" | $SED \ |
| 725 | -e "$pathcdr"` |
| 726 | # Figure out what to do with it |
| 727 | case $func_normal_abspath_tcomponent in |
| 728 | "") |
| 729 | # Trailing empty path component, ignore it. |
| 730 | ;; |
| 731 | ..) |
| 732 | # Parent dir; strip last assembled component from result. |
| 733 | func_dirname "$func_normal_abspath_result" |
| 734 | func_normal_abspath_result=$func_dirname_result |
| 735 | ;; |
| 736 | *) |
| 737 | # Actual path component, append it. |
| 738 | func_normal_abspath_result=$func_normal_abspath_result/$func_normal_abspath_tcomponent |
| 739 | ;; |
| 740 | esac |
| 741 | done |
| 742 | # Restore leading double-slash if one was found on entry. |
| 743 | func_normal_abspath_result=$func_normal_abspath_altnamespace$func_normal_abspath_result |
| 744 | } |
| 745 | |
| 746 | # func_relative_path SRCDIR DSTDIR |
| 747 | # generates a relative path from SRCDIR to DSTDIR, with a trailing |
| 748 | # slash if non-empty, suitable for immediately appending a filename |
| 749 | # without needing to append a separator. |
| 750 | # value returned in "$func_relative_path_result" |
| 751 | func_relative_path () |
| 752 | { |
| 753 | func_relative_path_result= |
| 754 | func_normal_abspath "$1" |
| 755 | func_relative_path_tlibdir=$func_normal_abspath_result |
| 756 | func_normal_abspath "$2" |
| 757 | func_relative_path_tbindir=$func_normal_abspath_result |
| 758 | |
| 759 | # Ascend the tree starting from libdir |
| 760 | while :; do |
| 761 | # check if we have found a prefix of bindir |
| 762 | case $func_relative_path_tbindir in |
| 763 | $func_relative_path_tlibdir) |
| 764 | # found an exact match |
| 765 | func_relative_path_tcancelled= |
| 766 | break |
| 767 | ;; |
| 768 | $func_relative_path_tlibdir*) |
| 769 | # found a matching prefix |
| 770 | func_stripname "$func_relative_path_tlibdir" '' "$func_relative_path_tbindir" |
| 771 | func_relative_path_tcancelled=$func_stripname_result |
| 772 | if test -z "$func_relative_path_result"; then |
| 773 | func_relative_path_result=. |
| 774 | fi |
| 775 | break |
| 776 | ;; |
| 777 | *) |
| 778 | func_dirname $func_relative_path_tlibdir |
| 779 | func_relative_path_tlibdir=${func_dirname_result} |
| 780 | if test "x$func_relative_path_tlibdir" = x ; then |
| 781 | # Have to descend all the way to the root! |
| 782 | func_relative_path_result=../$func_relative_path_result |
| 783 | func_relative_path_tcancelled=$func_relative_path_tbindir |
| 784 | break |
| 785 | fi |
| 786 | func_relative_path_result=../$func_relative_path_result |
| 787 | ;; |
| 788 | esac |
| 789 | done |
| 790 | |
| 791 | # Now calculate path; take care to avoid doubling-up slashes. |
| 792 | func_stripname '' '/' "$func_relative_path_result" |
| 793 | func_relative_path_result=$func_stripname_result |
| 794 | func_stripname '/' '/' "$func_relative_path_tcancelled" |
| 795 | if test "x$func_stripname_result" != x ; then |
| 796 | func_relative_path_result=${func_relative_path_result}/${func_stripname_result} |
| 797 | fi |
| 798 | |
| 799 | # Normalisation. If bindir is libdir, return empty string, |
| 800 | # else relative path ending with a slash; either way, target |
| 801 | # file name can be directly appended. |
| 802 | if test ! -z "$func_relative_path_result"; then |
| 803 | func_stripname './' '' "$func_relative_path_result/" |
| 804 | func_relative_path_result=$func_stripname_result |
| 805 | fi |
| 806 | } |
| 807 | |
| 808 | # The name of this program: |
| 809 | func_dirname_and_basename "$progpath" |
| 810 | progname=$func_basename_result |
| 811 | |
| 812 | # Make sure we have an absolute path for reexecution: |
| 813 | case $progpath in |
| 814 | [\\/]*|[A-Za-z]:\\*) ;; |
| 815 | *[\\/]*) |
| 816 | progdir=$func_dirname_result |
| 817 | progdir=`cd "$progdir" && pwd` |
| 818 | progpath="$progdir/$progname" |
| 819 | ;; |
| 820 | *) |
| 821 | save_IFS="$IFS" |
| 822 | IFS=${PATH_SEPARATOR-:} |
| 823 | for progdir in $PATH; do |
| 824 | IFS="$save_IFS" |
| 825 | test -x "$progdir/$progname" && break |
| 826 | done |
| 827 | IFS="$save_IFS" |
| 828 | test -n "$progdir" || progdir=`pwd` |
| 829 | progpath="$progdir/$progname" |
| 830 | ;; |
| 831 | esac |
| 832 | |
| 833 | # Sed substitution that helps us do robust quoting. It backslashifies |
| 834 | # metacharacters that are still active within double-quoted strings. |
| 835 | Xsed="${SED}"' -e 1s/^X//' |
| 836 | sed_quote_subst='s/\([`"$\\]\)/\\\1/g' |
| 837 | |
| 838 | # Same as above, but do not quote variable references. |
| 839 | double_quote_subst='s/\(["`\\]\)/\\\1/g' |
| 840 | |
| 841 | # Sed substitution that turns a string into a regex matching for the |
| 842 | # string literally. |
| 843 | sed_make_literal_regex='s,[].[^$\\*\/],\\&,g' |
| 844 | |
| 845 | # Sed substitution that converts a w32 file name or path |
| 846 | # which contains forward slashes, into one that contains |
| 847 | # (escaped) backslashes. A very naive implementation. |
| 848 | lt_sed_naive_backslashify='s|\\\\*|\\|g;s|/|\\|g;s|\\|\\\\|g' |
| 849 | |
| 850 | # Re-`\' parameter expansions in output of double_quote_subst that were |
| 851 | # `\'-ed in input to the same. If an odd number of `\' preceded a '$' |
| 852 | # in input to double_quote_subst, that '$' was protected from expansion. |
| 853 | # Since each input `\' is now two `\'s, look for any number of runs of |
| 854 | # four `\'s followed by two `\'s and then a '$'. `\' that '$'. |
| 855 | bs='\\' |
| 856 | bs2='\\\\' |
| 857 | bs4='\\\\\\\\' |
| 858 | dollar='\$' |
| 859 | sed_double_backslash="\ |
| 860 | s/$bs4/&\\ |
| 861 | /g |
| 862 | s/^$bs2$dollar/$bs&/ |
| 863 | s/\\([^$bs]\\)$bs2$dollar/\\1$bs2$bs$dollar/g |
| 864 | s/\n//g" |
| 865 | |
| 866 | # Standard options: |
| 867 | opt_dry_run=false |
| 868 | opt_help=false |
| 869 | opt_quiet=false |
| 870 | opt_verbose=false |
| 871 | opt_warning=: |
| 872 | |
| 873 | # func_echo arg... |
| 874 | # Echo program name prefixed message, along with the current mode |
| 875 | # name if it has been set yet. |
| 876 | func_echo () |
| 877 | { |
| 878 | $ECHO "$progname: ${opt_mode+$opt_mode: }$*" |
| 879 | } |
| 880 | |
| 881 | # func_verbose arg... |
| 882 | # Echo program name prefixed message in verbose mode only. |
| 883 | func_verbose () |
| 884 | { |
| 885 | $opt_verbose && func_echo ${1+"$@"} |
| 886 | |
| 887 | # A bug in bash halts the script if the last line of a function |
| 888 | # fails when set -e is in force, so we need another command to |
| 889 | # work around that: |
| 890 | : |
| 891 | } |
| 892 | |
| 893 | # func_echo_all arg... |
| 894 | # Invoke $ECHO with all args, space-separated. |
| 895 | func_echo_all () |
| 896 | { |
| 897 | $ECHO "$*" |
| 898 | } |
| 899 | |
| 900 | # func_error arg... |
| 901 | # Echo program name prefixed message to standard error. |
| 902 | func_error () |
| 903 | { |
| 904 | $ECHO "$progname: ${opt_mode+$opt_mode: }"${1+"$@"} 1>&2 |
| 905 | } |
| 906 | |
| 907 | # func_warning arg... |
| 908 | # Echo program name prefixed warning message to standard error. |
| 909 | func_warning () |
| 910 | { |
| 911 | $opt_warning && $ECHO "$progname: ${opt_mode+$opt_mode: }warning: "${1+"$@"} 1>&2 |
| 912 | |
| 913 | # bash bug again: |
| 914 | : |
| 915 | } |
| 916 | |
| 917 | # func_fatal_error arg... |
| 918 | # Echo program name prefixed message to standard error, and exit. |
| 919 | func_fatal_error () |
| 920 | { |
| 921 | func_error ${1+"$@"} |
| 922 | exit $EXIT_FAILURE |
| 923 | } |
| 924 | |
| 925 | # func_fatal_help arg... |
| 926 | # Echo program name prefixed message to standard error, followed by |
| 927 | # a help hint, and exit. |
| 928 | func_fatal_help () |
| 929 | { |
| 930 | func_error ${1+"$@"} |
| 931 | func_fatal_error "$help" |
| 932 | } |
| 933 | help="Try \`$progname --help' for more information." ## default |
| 934 | |
| 935 | |
| 936 | # func_grep expression filename |
| 937 | # Check whether EXPRESSION matches any line of FILENAME, without output. |
| 938 | func_grep () |
| 939 | { |
| 940 | $GREP "$1" "$2" >/dev/null 2>&1 |
| 941 | } |
| 942 | |
| 943 | |
| 944 | # func_mkdir_p directory-path |
| 945 | # Make sure the entire path to DIRECTORY-PATH is available. |
| 946 | func_mkdir_p () |
| 947 | { |
| 948 | my_directory_path="$1" |
| 949 | my_dir_list= |
| 950 | |
| 951 | if test -n "$my_directory_path" && test "$opt_dry_run" != ":"; then |
| 952 | |
| 953 | # Protect directory names starting with `-' |
| 954 | case $my_directory_path in |
| 955 | -*) my_directory_path="./$my_directory_path" ;; |
| 956 | esac |
| 957 | |
| 958 | # While some portion of DIR does not yet exist... |
| 959 | while test ! -d "$my_directory_path"; do |
| 960 | # ...make a list in topmost first order. Use a colon delimited |
| 961 | # list incase some portion of path contains whitespace. |
| 962 | my_dir_list="$my_directory_path:$my_dir_list" |
| 963 | |
| 964 | # If the last portion added has no slash in it, the list is done |
| 965 | case $my_directory_path in */*) ;; *) break ;; esac |
| 966 | |
| 967 | # ...otherwise throw away the child directory and loop |
| 968 | my_directory_path=`$ECHO "$my_directory_path" | $SED -e "$dirname"` |
| 969 | done |
| 970 | my_dir_list=`$ECHO "$my_dir_list" | $SED 's,:*$,,'` |
| 971 | |
| 972 | save_mkdir_p_IFS="$IFS"; IFS=':' |
| 973 | for my_dir in $my_dir_list; do |
| 974 | IFS="$save_mkdir_p_IFS" |
| 975 | # mkdir can fail with a `File exist' error if two processes |
| 976 | # try to create one of the directories concurrently. Don't |
| 977 | # stop in that case! |
| 978 | $MKDIR "$my_dir" 2>/dev/null || : |
| 979 | done |
| 980 | IFS="$save_mkdir_p_IFS" |
| 981 | |
| 982 | # Bail out if we (or some other process) failed to create a directory. |
| 983 | test -d "$my_directory_path" || \ |
| 984 | func_fatal_error "Failed to create \`$1'" |
| 985 | fi |
| 986 | } |
| 987 | |
| 988 | |
| 989 | # func_mktempdir [string] |
| 990 | # Make a temporary directory that won't clash with other running |
| 991 | # libtool processes, and avoids race conditions if possible. If |
| 992 | # given, STRING is the basename for that directory. |
| 993 | func_mktempdir () |
| 994 | { |
| 995 | my_template="${TMPDIR-/tmp}/${1-$progname}" |
| 996 | |
| 997 | if test "$opt_dry_run" = ":"; then |
| 998 | # Return a directory name, but don't create it in dry-run mode |
| 999 | my_tmpdir="${my_template}-$$" |
| 1000 | else |
| 1001 | |
| 1002 | # If mktemp works, use that first and foremost |
| 1003 | my_tmpdir=`mktemp -d "${my_template}-XXXXXXXX" 2>/dev/null` |
| 1004 | |
| 1005 | if test ! -d "$my_tmpdir"; then |
| 1006 | # Failing that, at least try and use $RANDOM to avoid a race |
| 1007 | my_tmpdir="${my_template}-${RANDOM-0}$$" |
| 1008 | |
| 1009 | save_mktempdir_umask=`umask` |
| 1010 | umask 0077 |
| 1011 | $MKDIR "$my_tmpdir" |
| 1012 | umask $save_mktempdir_umask |
| 1013 | fi |
| 1014 | |
| 1015 | # If we're not in dry-run mode, bomb out on failure |
| 1016 | test -d "$my_tmpdir" || \ |
| 1017 | func_fatal_error "cannot create temporary directory \`$my_tmpdir'" |
| 1018 | fi |
| 1019 | |
| 1020 | $ECHO "$my_tmpdir" |
| 1021 | } |
| 1022 | |
| 1023 | |
| 1024 | # func_quote_for_eval arg |
| 1025 | # Aesthetically quote ARG to be evaled later. |
| 1026 | # This function returns two values: FUNC_QUOTE_FOR_EVAL_RESULT |
| 1027 | # is double-quoted, suitable for a subsequent eval, whereas |
| 1028 | # FUNC_QUOTE_FOR_EVAL_UNQUOTED_RESULT has merely all characters |
| 1029 | # which are still active within double quotes backslashified. |
| 1030 | func_quote_for_eval () |
| 1031 | { |
| 1032 | case $1 in |
| 1033 | *[\\\`\"\$]*) |
| 1034 | func_quote_for_eval_unquoted_result=`$ECHO "$1" | $SED "$sed_quote_subst"` ;; |
| 1035 | *) |
| 1036 | func_quote_for_eval_unquoted_result="$1" ;; |
| 1037 | esac |
| 1038 | |
| 1039 | case $func_quote_for_eval_unquoted_result in |
| 1040 | # Double-quote args containing shell metacharacters to delay |
| 1041 | # word splitting, command substitution and and variable |
| 1042 | # expansion for a subsequent eval. |
| 1043 | # Many Bourne shells cannot handle close brackets correctly |
| 1044 | # in scan sets, so we specify it separately. |
| 1045 | *[\[\~\#\^\&\*\(\)\{\}\|\;\<\>\?\'\ \ ]*|*]*|"") |
| 1046 | func_quote_for_eval_result="\"$func_quote_for_eval_unquoted_result\"" |
| 1047 | ;; |
| 1048 | *) |
| 1049 | func_quote_for_eval_result="$func_quote_for_eval_unquoted_result" |
| 1050 | esac |
| 1051 | } |
| 1052 | |
| 1053 | |
| 1054 | # func_quote_for_expand arg |
| 1055 | # Aesthetically quote ARG to be evaled later; same as above, |
| 1056 | # but do not quote variable references. |
| 1057 | func_quote_for_expand () |
| 1058 | { |
| 1059 | case $1 in |
| 1060 | *[\\\`\"]*) |
| 1061 | my_arg=`$ECHO "$1" | $SED \ |
| 1062 | -e "$double_quote_subst" -e "$sed_double_backslash"` ;; |
| 1063 | *) |
| 1064 | my_arg="$1" ;; |
| 1065 | esac |
| 1066 | |
| 1067 | case $my_arg in |
| 1068 | # Double-quote args containing shell metacharacters to delay |
| 1069 | # word splitting and command substitution for a subsequent eval. |
| 1070 | # Many Bourne shells cannot handle close brackets correctly |
| 1071 | # in scan sets, so we specify it separately. |
| 1072 | *[\[\~\#\^\&\*\(\)\{\}\|\;\<\>\?\'\ \ ]*|*]*|"") |
| 1073 | my_arg="\"$my_arg\"" |
| 1074 | ;; |
| 1075 | esac |
| 1076 | |
| 1077 | func_quote_for_expand_result="$my_arg" |
| 1078 | } |
| 1079 | |
| 1080 | |
| 1081 | # func_show_eval cmd [fail_exp] |
| 1082 | # Unless opt_silent is true, then output CMD. Then, if opt_dryrun is |
| 1083 | # not true, evaluate CMD. If the evaluation of CMD fails, and FAIL_EXP |
| 1084 | # is given, then evaluate it. |
| 1085 | func_show_eval () |
| 1086 | { |
| 1087 | my_cmd="$1" |
| 1088 | my_fail_exp="${2-:}" |
| 1089 | |
| 1090 | ${opt_silent-false} || { |
| 1091 | func_quote_for_expand "$my_cmd" |
| 1092 | eval "func_echo $func_quote_for_expand_result" |
| 1093 | } |
| 1094 | |
| 1095 | if ${opt_dry_run-false}; then :; else |
| 1096 | eval "$my_cmd" |
| 1097 | my_status=$? |
| 1098 | if test "$my_status" -eq 0; then :; else |
| 1099 | eval "(exit $my_status); $my_fail_exp" |
| 1100 | fi |
| 1101 | fi |
| 1102 | } |
| 1103 | |
| 1104 | |
| 1105 | # func_show_eval_locale cmd [fail_exp] |
| 1106 | # Unless opt_silent is true, then output CMD. Then, if opt_dryrun is |
| 1107 | # not true, evaluate CMD. If the evaluation of CMD fails, and FAIL_EXP |
| 1108 | # is given, then evaluate it. Use the saved locale for evaluation. |
| 1109 | func_show_eval_locale () |
| 1110 | { |
| 1111 | my_cmd="$1" |
| 1112 | my_fail_exp="${2-:}" |
| 1113 | |
| 1114 | ${opt_silent-false} || { |
| 1115 | func_quote_for_expand "$my_cmd" |
| 1116 | eval "func_echo $func_quote_for_expand_result" |
| 1117 | } |
| 1118 | |
| 1119 | if ${opt_dry_run-false}; then :; else |
| 1120 | eval "$lt_user_locale |
| 1121 | $my_cmd" |
| 1122 | my_status=$? |
| 1123 | eval "$lt_safe_locale" |
| 1124 | if test "$my_status" -eq 0; then :; else |
| 1125 | eval "(exit $my_status); $my_fail_exp" |
| 1126 | fi |
| 1127 | fi |
| 1128 | } |
| 1129 | |
| 1130 | # func_tr_sh |
| 1131 | # Turn $1 into a string suitable for a shell variable name. |
| 1132 | # Result is stored in $func_tr_sh_result. All characters |
| 1133 | # not in the set a-zA-Z0-9_ are replaced with '_'. Further, |
| 1134 | # if $1 begins with a digit, a '_' is prepended as well. |
| 1135 | func_tr_sh () |
| 1136 | { |
| 1137 | case $1 in |
| 1138 | [0-9]* | *[!a-zA-Z0-9_]*) |
| 1139 | func_tr_sh_result=`$ECHO "$1" | $SED 's/^\([0-9]\)/_\1/; s/[^a-zA-Z0-9_]/_/g'` |
| 1140 | ;; |
| 1141 | * ) |
| 1142 | func_tr_sh_result=$1 |
| 1143 | ;; |
| 1144 | esac |
| 1145 | } |
| 1146 | |
| 1147 | |
| 1148 | # func_version |
| 1149 | # Echo version message to standard output and exit. |
| 1150 | func_version () |
| 1151 | { |
| 1152 | $opt_debug |
| 1153 | |
| 1154 | $SED -n '/(C)/!b go |
| 1155 | :more |
| 1156 | /\./!{ |
| 1157 | N |
| 1158 | s/\n# / / |
| 1159 | b more |
| 1160 | } |
| 1161 | :go |
| 1162 | /^# '$PROGRAM' (GNU /,/# warranty; / { |
| 1163 | s/^# // |
| 1164 | s/^# *$// |
| 1165 | s/\((C)\)[ 0-9,-]*\( [1-9][0-9]*\)/\1\2/ |
| 1166 | p |
| 1167 | }' < "$progpath" |
| 1168 | exit $? |
| 1169 | } |
| 1170 | |
| 1171 | # func_usage |
| 1172 | # Echo short help message to standard output and exit. |
| 1173 | func_usage () |
| 1174 | { |
| 1175 | $opt_debug |
| 1176 | |
| 1177 | $SED -n '/^# Usage:/,/^# *.*--help/ { |
| 1178 | s/^# // |
| 1179 | s/^# *$// |
| 1180 | s/\$progname/'$progname'/ |
| 1181 | p |
| 1182 | }' < "$progpath" |
| 1183 | echo |
| 1184 | $ECHO "run \`$progname --help | more' for full usage" |
| 1185 | exit $? |
| 1186 | } |
| 1187 | |
| 1188 | # func_help [NOEXIT] |
| 1189 | # Echo long help message to standard output and exit, |
| 1190 | # unless 'noexit' is passed as argument. |
| 1191 | func_help () |
| 1192 | { |
| 1193 | $opt_debug |
| 1194 | |
| 1195 | $SED -n '/^# Usage:/,/# Report bugs to/ { |
| 1196 | :print |
| 1197 | s/^# // |
| 1198 | s/^# *$// |
| 1199 | s*\$progname*'$progname'* |
| 1200 | s*\$host*'"$host"'* |
| 1201 | s*\$SHELL*'"$SHELL"'* |
| 1202 | s*\$LTCC*'"$LTCC"'* |
| 1203 | s*\$LTCFLAGS*'"$LTCFLAGS"'* |
| 1204 | s*\$LD*'"$LD"'* |
| 1205 | s/\$with_gnu_ld/'"$with_gnu_ld"'/ |
| 1206 | s/\$automake_version/'"`(${AUTOMAKE-automake} --version) 2>/dev/null |$SED 1q`"'/ |
| 1207 | s/\$autoconf_version/'"`(${AUTOCONF-autoconf} --version) 2>/dev/null |$SED 1q`"'/ |
| 1208 | p |
| 1209 | d |
| 1210 | } |
| 1211 | /^# .* home page:/b print |
| 1212 | /^# General help using/b print |
| 1213 | ' < "$progpath" |
| 1214 | ret=$? |
| 1215 | if test -z "$1"; then |
| 1216 | exit $ret |
| 1217 | fi |
| 1218 | } |
| 1219 | |
| 1220 | # func_missing_arg argname |
| 1221 | # Echo program name prefixed message to standard error and set global |
| 1222 | # exit_cmd. |
| 1223 | func_missing_arg () |
| 1224 | { |
| 1225 | $opt_debug |
| 1226 | |
| 1227 | func_error "missing argument for $1." |
| 1228 | exit_cmd=exit |
| 1229 | } |
| 1230 | |
| 1231 | |
| 1232 | # func_split_short_opt shortopt |
| 1233 | # Set func_split_short_opt_name and func_split_short_opt_arg shell |
| 1234 | # variables after splitting SHORTOPT after the 2nd character. |
| 1235 | func_split_short_opt () |
| 1236 | { |
| 1237 | func_split_short_opt_arg=${1#??} |
| 1238 | func_split_short_opt_name=${1%"$func_split_short_opt_arg"} |
| 1239 | } # Extended-shell func_split_short_opt implementation |
| 1240 | |
| 1241 | |
| 1242 | # func_split_long_opt longopt |
| 1243 | # Set func_split_long_opt_name and func_split_long_opt_arg shell |
| 1244 | # variables after splitting LONGOPT at the `=' sign. |
| 1245 | func_split_long_opt () |
| 1246 | { |
| 1247 | func_split_long_opt_name=${1%%=*} |
| 1248 | func_split_long_opt_arg=${1#*=} |
| 1249 | } # Extended-shell func_split_long_opt implementation |
| 1250 | |
| 1251 | exit_cmd=: |
| 1252 | |
| 1253 | |
| 1254 | |
| 1255 | |
| 1256 | |
| 1257 | magic="%%%MAGIC variable%%%" |
| 1258 | magic_exe="%%%MAGIC EXE variable%%%" |
| 1259 | |
| 1260 | # Global variables. |
| 1261 | nonopt= |
| 1262 | preserve_args= |
| 1263 | lo2o="s/\\.lo\$/.${objext}/" |
| 1264 | o2lo="s/\\.${objext}\$/.lo/" |
| 1265 | extracted_archives= |
| 1266 | extracted_serial=0 |
| 1267 | |
| 1268 | # If this variable is set in any of the actions, the command in it |
| 1269 | # will be execed at the end. This prevents here-documents from being |
| 1270 | # left over by shells. |
| 1271 | exec_cmd= |
| 1272 | |
| 1273 | # func_append var value |
| 1274 | # Append VALUE to the end of shell variable VAR. |
| 1275 | func_append () |
| 1276 | { |
| 1277 | eval "${1}+=\${2}" |
| 1278 | } # Extended-shell func_append implementation |
| 1279 | |
| 1280 | # func_append_quoted var value |
| 1281 | # Quote VALUE and append to the end of shell variable VAR, separated |
| 1282 | # by a space. |
| 1283 | func_append_quoted () |
| 1284 | { |
| 1285 | func_quote_for_eval "${2}" |
| 1286 | eval "${1}+=\\ \$func_quote_for_eval_result" |
| 1287 | } # Extended-shell func_append_quoted implementation |
| 1288 | |
| 1289 | |
| 1290 | # func_arith arithmetic-term... |
| 1291 | func_arith () |
| 1292 | { |
| 1293 | func_arith_result=$(( $* )) |
| 1294 | } # Extended-shell func_arith implementation |
| 1295 | |
| 1296 | |
| 1297 | # func_len string |
| 1298 | # STRING may not start with a hyphen. |
| 1299 | func_len () |
| 1300 | { |
| 1301 | func_len_result=${#1} |
| 1302 | } # Extended-shell func_len implementation |
| 1303 | |
| 1304 | |
| 1305 | # func_lo2o object |
| 1306 | func_lo2o () |
| 1307 | { |
| 1308 | case ${1} in |
| 1309 | *.lo) func_lo2o_result=${1%.lo}.${objext} ;; |
| 1310 | *) func_lo2o_result=${1} ;; |
| 1311 | esac |
| 1312 | } # Extended-shell func_lo2o implementation |
| 1313 | |
| 1314 | |
| 1315 | # func_xform libobj-or-source |
| 1316 | func_xform () |
| 1317 | { |
| 1318 | func_xform_result=${1%.*}.lo |
| 1319 | } # Extended-shell func_xform implementation |
| 1320 | |
| 1321 | |
| 1322 | # func_fatal_configuration arg... |
| 1323 | # Echo program name prefixed message to standard error, followed by |
| 1324 | # a configuration failure hint, and exit. |
| 1325 | func_fatal_configuration () |
| 1326 | { |
| 1327 | func_error ${1+"$@"} |
| 1328 | func_error "See the $PACKAGE documentation for more information." |
| 1329 | func_fatal_error "Fatal configuration error." |
| 1330 | } |
| 1331 | |
| 1332 | |
| 1333 | # func_config |
| 1334 | # Display the configuration for all the tags in this script. |
| 1335 | func_config () |
| 1336 | { |
| 1337 | re_begincf='^# ### BEGIN LIBTOOL' |
| 1338 | re_endcf='^# ### END LIBTOOL' |
| 1339 | |
| 1340 | # Default configuration. |
| 1341 | $SED "1,/$re_begincf CONFIG/d;/$re_endcf CONFIG/,\$d" < "$progpath" |
| 1342 | |
| 1343 | # Now print the configurations for the tags. |
| 1344 | for tagname in $taglist; do |
| 1345 | $SED -n "/$re_begincf TAG CONFIG: $tagname\$/,/$re_endcf TAG CONFIG: $tagname\$/p" < "$progpath" |
| 1346 | done |
| 1347 | |
| 1348 | exit $? |
| 1349 | } |
| 1350 | |
| 1351 | # func_features |
| 1352 | # Display the features supported by this script. |
| 1353 | func_features () |
| 1354 | { |
| 1355 | echo "host: $host" |
| 1356 | if test "$build_libtool_libs" = yes; then |
| 1357 | echo "enable shared libraries" |
| 1358 | else |
| 1359 | echo "disable shared libraries" |
| 1360 | fi |
| 1361 | if test "$build_old_libs" = yes; then |
| 1362 | echo "enable static libraries" |
| 1363 | else |
| 1364 | echo "disable static libraries" |
| 1365 | fi |
| 1366 | |
| 1367 | exit $? |
| 1368 | } |
| 1369 | |
| 1370 | # func_enable_tag tagname |
| 1371 | # Verify that TAGNAME is valid, and either flag an error and exit, or |
| 1372 | # enable the TAGNAME tag. We also add TAGNAME to the global $taglist |
| 1373 | # variable here. |
| 1374 | func_enable_tag () |
| 1375 | { |
| 1376 | # Global variable: |
| 1377 | tagname="$1" |
| 1378 | |
| 1379 | re_begincf="^# ### BEGIN LIBTOOL TAG CONFIG: $tagname\$" |
| 1380 | re_endcf="^# ### END LIBTOOL TAG CONFIG: $tagname\$" |
| 1381 | sed_extractcf="/$re_begincf/,/$re_endcf/p" |
| 1382 | |
| 1383 | # Validate tagname. |
| 1384 | case $tagname in |
| 1385 | *[!-_A-Za-z0-9,/]*) |
| 1386 | func_fatal_error "invalid tag name: $tagname" |
| 1387 | ;; |
| 1388 | esac |
| 1389 | |
| 1390 | # Don't test for the "default" C tag, as we know it's |
| 1391 | # there but not specially marked. |
| 1392 | case $tagname in |
| 1393 | CC) ;; |
| 1394 | *) |
| 1395 | if $GREP "$re_begincf" "$progpath" >/dev/null 2>&1; then |
| 1396 | taglist="$taglist $tagname" |
| 1397 | |
| 1398 | # Evaluate the configuration. Be careful to quote the path |
| 1399 | # and the sed script, to avoid splitting on whitespace, but |
| 1400 | # also don't use non-portable quotes within backquotes within |
| 1401 | # quotes we have to do it in 2 steps: |
| 1402 | extractedcf=`$SED -n -e "$sed_extractcf" < "$progpath"` |
| 1403 | eval "$extractedcf" |
| 1404 | else |
| 1405 | func_error "ignoring unknown tag $tagname" |
| 1406 | fi |
| 1407 | ;; |
| 1408 | esac |
| 1409 | } |
| 1410 | |
| 1411 | # func_check_version_match |
| 1412 | # Ensure that we are using m4 macros, and libtool script from the same |
| 1413 | # release of libtool. |
| 1414 | func_check_version_match () |
| 1415 | { |
| 1416 | if test "$package_revision" != "$macro_revision"; then |
| 1417 | if test "$VERSION" != "$macro_version"; then |
| 1418 | if test -z "$macro_version"; then |
| 1419 | cat >&2 <<_LT_EOF |
| 1420 | $progname: Version mismatch error. This is $PACKAGE $VERSION, but the |
| 1421 | $progname: definition of this LT_INIT comes from an older release. |
| 1422 | $progname: You should recreate aclocal.m4 with macros from $PACKAGE $VERSION |
| 1423 | $progname: and run autoconf again. |
| 1424 | _LT_EOF |
| 1425 | else |
| 1426 | cat >&2 <<_LT_EOF |
| 1427 | $progname: Version mismatch error. This is $PACKAGE $VERSION, but the |
| 1428 | $progname: definition of this LT_INIT comes from $PACKAGE $macro_version. |
| 1429 | $progname: You should recreate aclocal.m4 with macros from $PACKAGE $VERSION |
| 1430 | $progname: and run autoconf again. |
| 1431 | _LT_EOF |
| 1432 | fi |
| 1433 | else |
| 1434 | cat >&2 <<_LT_EOF |
| 1435 | $progname: Version mismatch error. This is $PACKAGE $VERSION, revision $package_revision, |
| 1436 | $progname: but the definition of this LT_INIT comes from revision $macro_revision. |
| 1437 | $progname: You should recreate aclocal.m4 with macros from revision $package_revision |
| 1438 | $progname: of $PACKAGE $VERSION and run autoconf again. |
| 1439 | _LT_EOF |
| 1440 | fi |
| 1441 | |
| 1442 | exit $EXIT_MISMATCH |
| 1443 | fi |
| 1444 | } |
| 1445 | |
| 1446 | |
| 1447 | # Shorthand for --mode=foo, only valid as the first argument |
| 1448 | case $1 in |
| 1449 | clean|clea|cle|cl) |
| 1450 | shift; set dummy --mode clean ${1+"$@"}; shift |
| 1451 | ;; |
| 1452 | compile|compil|compi|comp|com|co|c) |
| 1453 | shift; set dummy --mode compile ${1+"$@"}; shift |
| 1454 | ;; |
| 1455 | execute|execut|execu|exec|exe|ex|e) |
| 1456 | shift; set dummy --mode execute ${1+"$@"}; shift |
| 1457 | ;; |
| 1458 | finish|finis|fini|fin|fi|f) |
| 1459 | shift; set dummy --mode finish ${1+"$@"}; shift |
| 1460 | ;; |
| 1461 | install|instal|insta|inst|ins|in|i) |
| 1462 | shift; set dummy --mode install ${1+"$@"}; shift |
| 1463 | ;; |
| 1464 | link|lin|li|l) |
| 1465 | shift; set dummy --mode link ${1+"$@"}; shift |
| 1466 | ;; |
| 1467 | uninstall|uninstal|uninsta|uninst|unins|unin|uni|un|u) |
| 1468 | shift; set dummy --mode uninstall ${1+"$@"}; shift |
| 1469 | ;; |
| 1470 | esac |
| 1471 | |
| 1472 | |
| 1473 | |
| 1474 | # Option defaults: |
| 1475 | opt_debug=: |
| 1476 | opt_dry_run=false |
| 1477 | opt_config=false |
| 1478 | opt_preserve_dup_deps=false |
| 1479 | opt_features=false |
| 1480 | opt_finish=false |
| 1481 | opt_help=false |
| 1482 | opt_help_all=false |
| 1483 | opt_silent=: |
| 1484 | opt_warning=: |
| 1485 | opt_verbose=: |
| 1486 | opt_silent=false |
| 1487 | opt_verbose=false |
| 1488 | |
| 1489 | |
| 1490 | # Parse options once, thoroughly. This comes as soon as possible in the |
| 1491 | # script to make things like `--version' happen as quickly as we can. |
| 1492 | { |
| 1493 | # this just eases exit handling |
| 1494 | while test $# -gt 0; do |
| 1495 | opt="$1" |
| 1496 | shift |
| 1497 | case $opt in |
| 1498 | --debug|-x) opt_debug='set -x' |
| 1499 | func_echo "enabling shell trace mode" |
| 1500 | $opt_debug |
| 1501 | ;; |
| 1502 | --dry-run|--dryrun|-n) |
| 1503 | opt_dry_run=: |
| 1504 | ;; |
| 1505 | --config) |
| 1506 | opt_config=: |
| 1507 | func_config |
| 1508 | ;; |
| 1509 | --dlopen|-dlopen) |
| 1510 | optarg="$1" |
| 1511 | opt_dlopen="${opt_dlopen+$opt_dlopen |
| 1512 | }$optarg" |
| 1513 | shift |
| 1514 | ;; |
| 1515 | --preserve-dup-deps) |
| 1516 | opt_preserve_dup_deps=: |
| 1517 | ;; |
| 1518 | --features) |
| 1519 | opt_features=: |
| 1520 | func_features |
| 1521 | ;; |
| 1522 | --finish) |
| 1523 | opt_finish=: |
| 1524 | set dummy --mode finish ${1+"$@"}; shift |
| 1525 | ;; |
| 1526 | --help) |
| 1527 | opt_help=: |
| 1528 | ;; |
| 1529 | --help-all) |
| 1530 | opt_help_all=: |
| 1531 | opt_help=': help-all' |
| 1532 | ;; |
| 1533 | --mode) |
| 1534 | test $# = 0 && func_missing_arg $opt && break |
| 1535 | optarg="$1" |
| 1536 | opt_mode="$optarg" |
| 1537 | case $optarg in |
| 1538 | # Valid mode arguments: |
| 1539 | clean|compile|execute|finish|install|link|relink|uninstall) ;; |
| 1540 | |
| 1541 | # Catch anything else as an error |
| 1542 | *) func_error "invalid argument for $opt" |
| 1543 | exit_cmd=exit |
| 1544 | break |
| 1545 | ;; |
| 1546 | esac |
| 1547 | shift |
| 1548 | ;; |
| 1549 | --no-silent|--no-quiet) |
| 1550 | opt_silent=false |
| 1551 | preserve_args+=" $opt" |
| 1552 | ;; |
| 1553 | --no-warning|--no-warn) |
| 1554 | opt_warning=false |
| 1555 | preserve_args+=" $opt" |
| 1556 | ;; |
| 1557 | --no-verbose) |
| 1558 | opt_verbose=false |
| 1559 | preserve_args+=" $opt" |
| 1560 | ;; |
| 1561 | --silent|--quiet) |
| 1562 | opt_silent=: |
| 1563 | preserve_args+=" $opt" |
| 1564 | opt_verbose=false |
| 1565 | ;; |
| 1566 | --verbose|-v) |
| 1567 | opt_verbose=: |
| 1568 | preserve_args+=" $opt" |
| 1569 | opt_silent=false |
| 1570 | ;; |
| 1571 | --tag) |
| 1572 | test $# = 0 && func_missing_arg $opt && break |
| 1573 | optarg="$1" |
| 1574 | opt_tag="$optarg" |
| 1575 | preserve_args+=" $opt $optarg" |
| 1576 | func_enable_tag "$optarg" |
| 1577 | shift |
| 1578 | ;; |
| 1579 | |
| 1580 | -\?|-h) func_usage ;; |
| 1581 | --help) func_help ;; |
| 1582 | --version) func_version ;; |
| 1583 | |
| 1584 | # Separate optargs to long options: |
| 1585 | --*=*) |
| 1586 | func_split_long_opt "$opt" |
| 1587 | set dummy "$func_split_long_opt_name" "$func_split_long_opt_arg" ${1+"$@"} |
| 1588 | shift |
| 1589 | ;; |
| 1590 | |
| 1591 | # Separate non-argument short options: |
| 1592 | -\?*|-h*|-n*|-v*) |
| 1593 | func_split_short_opt "$opt" |
| 1594 | set dummy "$func_split_short_opt_name" "-$func_split_short_opt_arg" ${1+"$@"} |
| 1595 | shift |
| 1596 | ;; |
| 1597 | |
| 1598 | --) break ;; |
| 1599 | -*) func_fatal_help "unrecognized option \`$opt'" ;; |
| 1600 | *) set dummy "$opt" ${1+"$@"}; shift; break ;; |
| 1601 | esac |
| 1602 | done |
| 1603 | |
| 1604 | # Validate options: |
| 1605 | |
| 1606 | # save first non-option argument |
| 1607 | if test "$#" -gt 0; then |
| 1608 | nonopt="$opt" |
| 1609 | shift |
| 1610 | fi |
| 1611 | |
| 1612 | # preserve --debug |
| 1613 | test "$opt_debug" = : || preserve_args+=" --debug" |
| 1614 | |
| 1615 | case $host in |
| 1616 | *cygwin* | *mingw* | *pw32* | *cegcc*) |
| 1617 | # don't eliminate duplications in $postdeps and $predeps |
| 1618 | opt_duplicate_compiler_generated_deps=: |
| 1619 | ;; |
| 1620 | *) |
| 1621 | opt_duplicate_compiler_generated_deps=$opt_preserve_dup_deps |
| 1622 | ;; |
| 1623 | esac |
| 1624 | |
| 1625 | $opt_help || { |
| 1626 | # Sanity checks first: |
| 1627 | func_check_version_match |
| 1628 | |
| 1629 | if test "$build_libtool_libs" != yes && test "$build_old_libs" != yes; then |
| 1630 | func_fatal_configuration "not configured to build any kind of library" |
| 1631 | fi |
| 1632 | |
| 1633 | # Darwin sucks |
| 1634 | eval std_shrext=\"$shrext_cmds\" |
| 1635 | |
| 1636 | # Only execute mode is allowed to have -dlopen flags. |
| 1637 | if test -n "$opt_dlopen" && test "$opt_mode" != execute; then |
| 1638 | func_error "unrecognized option \`-dlopen'" |
| 1639 | $ECHO "$help" 1>&2 |
| 1640 | exit $EXIT_FAILURE |
| 1641 | fi |
| 1642 | |
| 1643 | # Change the help message to a mode-specific one. |
| 1644 | generic_help="$help" |
| 1645 | help="Try \`$progname --help --mode=$opt_mode' for more information." |
| 1646 | } |
| 1647 | |
| 1648 | |
| 1649 | # Bail if the options were screwed |
| 1650 | $exit_cmd $EXIT_FAILURE |
| 1651 | } |
| 1652 | |
| 1653 | |
| 1654 | |
| 1655 | |
| 1656 | ## ----------- ## |
| 1657 | ## Main. ## |
| 1658 | ## ----------- ## |
| 1659 | |
| 1660 | # func_lalib_p file |
| 1661 | # True iff FILE is a libtool `.la' library or `.lo' object file. |
| 1662 | # This function is only a basic sanity check; it will hardly flush out |
| 1663 | # determined imposters. |
| 1664 | func_lalib_p () |
| 1665 | { |
| 1666 | test -f "$1" && |
| 1667 | $SED -e 4q "$1" 2>/dev/null \ |
| 1668 | | $GREP "^# Generated by .*$PACKAGE" > /dev/null 2>&1 |
| 1669 | } |
| 1670 | |
| 1671 | # func_lalib_unsafe_p file |
| 1672 | # True iff FILE is a libtool `.la' library or `.lo' object file. |
| 1673 | # This function implements the same check as func_lalib_p without |
| 1674 | # resorting to external programs. To this end, it redirects stdin and |
| 1675 | # closes it afterwards, without saving the original file descriptor. |
| 1676 | # As a safety measure, use it only where a negative result would be |
| 1677 | # fatal anyway. Works if `file' does not exist. |
| 1678 | func_lalib_unsafe_p () |
| 1679 | { |
| 1680 | lalib_p=no |
| 1681 | if test -f "$1" && test -r "$1" && exec 5<&0 <"$1"; then |
| 1682 | for lalib_p_l in 1 2 3 4 |
| 1683 | do |
| 1684 | read lalib_p_line |
| 1685 | case "$lalib_p_line" in |
| 1686 | \#\ Generated\ by\ *$PACKAGE* ) lalib_p=yes; break;; |
| 1687 | esac |
| 1688 | done |
| 1689 | exec 0<&5 5<&- |
| 1690 | fi |
| 1691 | test "$lalib_p" = yes |
| 1692 | } |
| 1693 | |
| 1694 | # func_ltwrapper_script_p file |
| 1695 | # True iff FILE is a libtool wrapper script |
| 1696 | # This function is only a basic sanity check; it will hardly flush out |
| 1697 | # determined imposters. |
| 1698 | func_ltwrapper_script_p () |
| 1699 | { |
| 1700 | func_lalib_p "$1" |
| 1701 | } |
| 1702 | |
| 1703 | # func_ltwrapper_executable_p file |
| 1704 | # True iff FILE is a libtool wrapper executable |
| 1705 | # This function is only a basic sanity check; it will hardly flush out |
| 1706 | # determined imposters. |
| 1707 | func_ltwrapper_executable_p () |
| 1708 | { |
| 1709 | func_ltwrapper_exec_suffix= |
| 1710 | case $1 in |
| 1711 | *.exe) ;; |
| 1712 | *) func_ltwrapper_exec_suffix=.exe ;; |
| 1713 | esac |
| 1714 | $GREP "$magic_exe" "$1$func_ltwrapper_exec_suffix" >/dev/null 2>&1 |
| 1715 | } |
| 1716 | |
| 1717 | # func_ltwrapper_scriptname file |
| 1718 | # Assumes file is an ltwrapper_executable |
| 1719 | # uses $file to determine the appropriate filename for a |
| 1720 | # temporary ltwrapper_script. |
| 1721 | func_ltwrapper_scriptname () |
| 1722 | { |
| 1723 | func_dirname_and_basename "$1" "" "." |
| 1724 | func_stripname '' '.exe' "$func_basename_result" |
| 1725 | func_ltwrapper_scriptname_result="$func_dirname_result/$objdir/${func_stripname_result}_ltshwrapper" |
| 1726 | } |
| 1727 | |
| 1728 | # func_ltwrapper_p file |
| 1729 | # True iff FILE is a libtool wrapper script or wrapper executable |
| 1730 | # This function is only a basic sanity check; it will hardly flush out |
| 1731 | # determined imposters. |
| 1732 | func_ltwrapper_p () |
| 1733 | { |
| 1734 | func_ltwrapper_script_p "$1" || func_ltwrapper_executable_p "$1" |
| 1735 | } |
| 1736 | |
| 1737 | |
| 1738 | # func_execute_cmds commands fail_cmd |
| 1739 | # Execute tilde-delimited COMMANDS. |
| 1740 | # If FAIL_CMD is given, eval that upon failure. |
| 1741 | # FAIL_CMD may read-access the current command in variable CMD! |
| 1742 | func_execute_cmds () |
| 1743 | { |
| 1744 | $opt_debug |
| 1745 | save_ifs=$IFS; IFS='~' |
| 1746 | for cmd in $1; do |
| 1747 | IFS=$save_ifs |
| 1748 | eval cmd=\"$cmd\" |
| 1749 | func_show_eval "$cmd" "${2-:}" |
| 1750 | done |
| 1751 | IFS=$save_ifs |
| 1752 | } |
| 1753 | |
| 1754 | |
| 1755 | # func_source file |
| 1756 | # Source FILE, adding directory component if necessary. |
| 1757 | # Note that it is not necessary on cygwin/mingw to append a dot to |
| 1758 | # FILE even if both FILE and FILE.exe exist: automatic-append-.exe |
| 1759 | # behavior happens only for exec(3), not for open(2)! Also, sourcing |
| 1760 | # `FILE.' does not work on cygwin managed mounts. |
| 1761 | func_source () |
| 1762 | { |
| 1763 | $opt_debug |
| 1764 | case $1 in |
| 1765 | */* | *\\*) . "$1" ;; |
| 1766 | *) . "./$1" ;; |
| 1767 | esac |
| 1768 | } |
| 1769 | |
| 1770 | |
| 1771 | # func_resolve_sysroot PATH |
| 1772 | # Replace a leading = in PATH with a sysroot. Store the result into |
| 1773 | # func_resolve_sysroot_result |
| 1774 | func_resolve_sysroot () |
| 1775 | { |
| 1776 | func_resolve_sysroot_result=$1 |
| 1777 | case $func_resolve_sysroot_result in |
| 1778 | =*) |
| 1779 | func_stripname '=' '' "$func_resolve_sysroot_result" |
| 1780 | func_resolve_sysroot_result=$lt_sysroot$func_stripname_result |
| 1781 | ;; |
| 1782 | esac |
| 1783 | } |
| 1784 | |
| 1785 | # func_replace_sysroot PATH |
| 1786 | # If PATH begins with the sysroot, replace it with = and |
| 1787 | # store the result into func_replace_sysroot_result. |
| 1788 | func_replace_sysroot () |
| 1789 | { |
| 1790 | case "$lt_sysroot:$1" in |
| 1791 | ?*:"$lt_sysroot"*) |
| 1792 | func_stripname "$lt_sysroot" '' "$1" |
| 1793 | func_replace_sysroot_result="=$func_stripname_result" |
| 1794 | ;; |
| 1795 | *) |
| 1796 | # Including no sysroot. |
| 1797 | func_replace_sysroot_result=$1 |
| 1798 | ;; |
| 1799 | esac |
| 1800 | } |
| 1801 | |
| 1802 | # func_infer_tag arg |
| 1803 | # Infer tagged configuration to use if any are available and |
| 1804 | # if one wasn't chosen via the "--tag" command line option. |
| 1805 | # Only attempt this if the compiler in the base compile |
| 1806 | # command doesn't match the default compiler. |
| 1807 | # arg is usually of the form 'gcc ...' |
| 1808 | func_infer_tag () |
| 1809 | { |
| 1810 | $opt_debug |
| 1811 | if test -n "$available_tags" && test -z "$tagname"; then |
| 1812 | CC_quoted= |
| 1813 | for arg in $CC; do |
| 1814 | func_append_quoted CC_quoted "$arg" |
| 1815 | done |
| 1816 | CC_expanded=`func_echo_all $CC` |
| 1817 | CC_quoted_expanded=`func_echo_all $CC_quoted` |
| 1818 | case $@ in |
| 1819 | # Blanks in the command may have been stripped by the calling shell, |
| 1820 | # but not from the CC environment variable when configure was run. |
| 1821 | " $CC "* | "$CC "* | " $CC_expanded "* | "$CC_expanded "* | \ |
| 1822 | " $CC_quoted"* | "$CC_quoted "* | " $CC_quoted_expanded "* | "$CC_quoted_expanded "*) ;; |
| 1823 | # Blanks at the start of $base_compile will cause this to fail |
| 1824 | # if we don't check for them as well. |
| 1825 | *) |
| 1826 | for z in $available_tags; do |
| 1827 | if $GREP "^# ### BEGIN LIBTOOL TAG CONFIG: $z$" < "$progpath" > /dev/null; then |
| 1828 | # Evaluate the configuration. |
| 1829 | eval "`${SED} -n -e '/^# ### BEGIN LIBTOOL TAG CONFIG: '$z'$/,/^# ### END LIBTOOL TAG CONFIG: '$z'$/p' < $progpath`" |
| 1830 | CC_quoted= |
| 1831 | for arg in $CC; do |
| 1832 | # Double-quote args containing other shell metacharacters. |
| 1833 | func_append_quoted CC_quoted "$arg" |
| 1834 | done |
| 1835 | CC_expanded=`func_echo_all $CC` |
| 1836 | CC_quoted_expanded=`func_echo_all $CC_quoted` |
| 1837 | case "$@ " in |
| 1838 | " $CC "* | "$CC "* | " $CC_expanded "* | "$CC_expanded "* | \ |
| 1839 | " $CC_quoted"* | "$CC_quoted "* | " $CC_quoted_expanded "* | "$CC_quoted_expanded "*) |
| 1840 | # The compiler in the base compile command matches |
| 1841 | # the one in the tagged configuration. |
| 1842 | # Assume this is the tagged configuration we want. |
| 1843 | tagname=$z |
| 1844 | break |
| 1845 | ;; |
| 1846 | esac |
| 1847 | fi |
| 1848 | done |
| 1849 | # If $tagname still isn't set, then no tagged configuration |
| 1850 | # was found and let the user know that the "--tag" command |
| 1851 | # line option must be used. |
| 1852 | if test -z "$tagname"; then |
| 1853 | func_echo "unable to infer tagged configuration" |
| 1854 | func_fatal_error "specify a tag with \`--tag'" |
| 1855 | # else |
| 1856 | # func_verbose "using $tagname tagged configuration" |
| 1857 | fi |
| 1858 | ;; |
| 1859 | esac |
| 1860 | fi |
| 1861 | } |
| 1862 | |
| 1863 | |
| 1864 | |
| 1865 | # func_write_libtool_object output_name pic_name nonpic_name |
| 1866 | # Create a libtool object file (analogous to a ".la" file), |
| 1867 | # but don't create it if we're doing a dry run. |
| 1868 | func_write_libtool_object () |
| 1869 | { |
| 1870 | write_libobj=${1} |
| 1871 | if test "$build_libtool_libs" = yes; then |
| 1872 | write_lobj=\'${2}\' |
| 1873 | else |
| 1874 | write_lobj=none |
| 1875 | fi |
| 1876 | |
| 1877 | if test "$build_old_libs" = yes; then |
| 1878 | write_oldobj=\'${3}\' |
| 1879 | else |
| 1880 | write_oldobj=none |
| 1881 | fi |
| 1882 | |
| 1883 | $opt_dry_run || { |
| 1884 | cat >${write_libobj}T <<EOF |
| 1885 | # $write_libobj - a libtool object file |
| 1886 | # Generated by $PROGRAM (GNU $PACKAGE$TIMESTAMP) $VERSION |
| 1887 | # |
| 1888 | # Please DO NOT delete this file! |
| 1889 | # It is necessary for linking the library. |
| 1890 | |
| 1891 | # Name of the PIC object. |
| 1892 | pic_object=$write_lobj |
| 1893 | |
| 1894 | # Name of the non-PIC object |
| 1895 | non_pic_object=$write_oldobj |
| 1896 | |
| 1897 | EOF |
| 1898 | $MV "${write_libobj}T" "${write_libobj}" |
| 1899 | } |
| 1900 | } |
| 1901 | |
| 1902 | |
| 1903 | ################################################## |
| 1904 | # FILE NAME AND PATH CONVERSION HELPER FUNCTIONS # |
| 1905 | ################################################## |
| 1906 | |
| 1907 | # func_convert_core_file_wine_to_w32 ARG |
| 1908 | # Helper function used by file name conversion functions when $build is *nix, |
| 1909 | # and $host is mingw, cygwin, or some other w32 environment. Relies on a |
| 1910 | # correctly configured wine environment available, with the winepath program |
| 1911 | # in $build's $PATH. |
| 1912 | # |
| 1913 | # ARG is the $build file name to be converted to w32 format. |
| 1914 | # Result is available in $func_convert_core_file_wine_to_w32_result, and will |
| 1915 | # be empty on error (or when ARG is empty) |
| 1916 | func_convert_core_file_wine_to_w32 () |
| 1917 | { |
| 1918 | $opt_debug |
| 1919 | func_convert_core_file_wine_to_w32_result="$1" |
| 1920 | if test -n "$1"; then |
| 1921 | # Unfortunately, winepath does not exit with a non-zero error code, so we |
| 1922 | # are forced to check the contents of stdout. On the other hand, if the |
| 1923 | # command is not found, the shell will set an exit code of 127 and print |
| 1924 | # *an error message* to stdout. So we must check for both error code of |
| 1925 | # zero AND non-empty stdout, which explains the odd construction: |
| 1926 | func_convert_core_file_wine_to_w32_tmp=`winepath -w "$1" 2>/dev/null` |
| 1927 | if test "$?" -eq 0 && test -n "${func_convert_core_file_wine_to_w32_tmp}"; then |
| 1928 | func_convert_core_file_wine_to_w32_result=`$ECHO "$func_convert_core_file_wine_to_w32_tmp" | |
| 1929 | $SED -e "$lt_sed_naive_backslashify"` |
| 1930 | else |
| 1931 | func_convert_core_file_wine_to_w32_result= |
| 1932 | fi |
| 1933 | fi |
| 1934 | } |
| 1935 | # end: func_convert_core_file_wine_to_w32 |
| 1936 | |
| 1937 | |
| 1938 | # func_convert_core_path_wine_to_w32 ARG |
| 1939 | # Helper function used by path conversion functions when $build is *nix, and |
| 1940 | # $host is mingw, cygwin, or some other w32 environment. Relies on a correctly |
| 1941 | # configured wine environment available, with the winepath program in $build's |
| 1942 | # $PATH. Assumes ARG has no leading or trailing path separator characters. |
| 1943 | # |
| 1944 | # ARG is path to be converted from $build format to win32. |
| 1945 | # Result is available in $func_convert_core_path_wine_to_w32_result. |
| 1946 | # Unconvertible file (directory) names in ARG are skipped; if no directory names |
| 1947 | # are convertible, then the result may be empty. |
| 1948 | func_convert_core_path_wine_to_w32 () |
| 1949 | { |
| 1950 | $opt_debug |
| 1951 | # unfortunately, winepath doesn't convert paths, only file names |
| 1952 | func_convert_core_path_wine_to_w32_result="" |
| 1953 | if test -n "$1"; then |
| 1954 | oldIFS=$IFS |
| 1955 | IFS=: |
| 1956 | for func_convert_core_path_wine_to_w32_f in $1; do |
| 1957 | IFS=$oldIFS |
| 1958 | func_convert_core_file_wine_to_w32 "$func_convert_core_path_wine_to_w32_f" |
| 1959 | if test -n "$func_convert_core_file_wine_to_w32_result" ; then |
| 1960 | if test -z "$func_convert_core_path_wine_to_w32_result"; then |
| 1961 | func_convert_core_path_wine_to_w32_result="$func_convert_core_file_wine_to_w32_result" |
| 1962 | else |
| 1963 | func_append func_convert_core_path_wine_to_w32_result ";$func_convert_core_file_wine_to_w32_result" |
| 1964 | fi |
| 1965 | fi |
| 1966 | done |
| 1967 | IFS=$oldIFS |
| 1968 | fi |
| 1969 | } |
| 1970 | # end: func_convert_core_path_wine_to_w32 |
| 1971 | |
| 1972 | |
| 1973 | # func_cygpath ARGS... |
| 1974 | # Wrapper around calling the cygpath program via LT_CYGPATH. This is used when |
| 1975 | # when (1) $build is *nix and Cygwin is hosted via a wine environment; or (2) |
| 1976 | # $build is MSYS and $host is Cygwin, or (3) $build is Cygwin. In case (1) or |
| 1977 | # (2), returns the Cygwin file name or path in func_cygpath_result (input |
| 1978 | # file name or path is assumed to be in w32 format, as previously converted |
| 1979 | # from $build's *nix or MSYS format). In case (3), returns the w32 file name |
| 1980 | # or path in func_cygpath_result (input file name or path is assumed to be in |
| 1981 | # Cygwin format). Returns an empty string on error. |
| 1982 | # |
| 1983 | # ARGS are passed to cygpath, with the last one being the file name or path to |
| 1984 | # be converted. |
| 1985 | # |
| 1986 | # Specify the absolute *nix (or w32) name to cygpath in the LT_CYGPATH |
| 1987 | # environment variable; do not put it in $PATH. |
| 1988 | func_cygpath () |
| 1989 | { |
| 1990 | $opt_debug |
| 1991 | if test -n "$LT_CYGPATH" && test -f "$LT_CYGPATH"; then |
| 1992 | func_cygpath_result=`$LT_CYGPATH "$@" 2>/dev/null` |
| 1993 | if test "$?" -ne 0; then |
| 1994 | # on failure, ensure result is empty |
| 1995 | func_cygpath_result= |
| 1996 | fi |
| 1997 | else |
| 1998 | func_cygpath_result= |
| 1999 | func_error "LT_CYGPATH is empty or specifies non-existent file: \`$LT_CYGPATH'" |
| 2000 | fi |
| 2001 | } |
| 2002 | #end: func_cygpath |
| 2003 | |
| 2004 | |
| 2005 | # func_convert_core_msys_to_w32 ARG |
| 2006 | # Convert file name or path ARG from MSYS format to w32 format. Return |
| 2007 | # result in func_convert_core_msys_to_w32_result. |
| 2008 | func_convert_core_msys_to_w32 () |
| 2009 | { |
| 2010 | $opt_debug |
| 2011 | # awkward: cmd appends spaces to result |
| 2012 | func_convert_core_msys_to_w32_result=`( cmd //c echo "$1" ) 2>/dev/null | |
| 2013 | $SED -e 's/[ ]*$//' -e "$lt_sed_naive_backslashify"` |
| 2014 | } |
| 2015 | #end: func_convert_core_msys_to_w32 |
| 2016 | |
| 2017 | |
| 2018 | # func_convert_file_check ARG1 ARG2 |
| 2019 | # Verify that ARG1 (a file name in $build format) was converted to $host |
| 2020 | # format in ARG2. Otherwise, emit an error message, but continue (resetting |
| 2021 | # func_to_host_file_result to ARG1). |
| 2022 | func_convert_file_check () |
| 2023 | { |
| 2024 | $opt_debug |
| 2025 | if test -z "$2" && test -n "$1" ; then |
| 2026 | func_error "Could not determine host file name corresponding to" |
| 2027 | func_error " \`$1'" |
| 2028 | func_error "Continuing, but uninstalled executables may not work." |
| 2029 | # Fallback: |
| 2030 | func_to_host_file_result="$1" |
| 2031 | fi |
| 2032 | } |
| 2033 | # end func_convert_file_check |
| 2034 | |
| 2035 | |
| 2036 | # func_convert_path_check FROM_PATHSEP TO_PATHSEP FROM_PATH TO_PATH |
| 2037 | # Verify that FROM_PATH (a path in $build format) was converted to $host |
| 2038 | # format in TO_PATH. Otherwise, emit an error message, but continue, resetting |
| 2039 | # func_to_host_file_result to a simplistic fallback value (see below). |
| 2040 | func_convert_path_check () |
| 2041 | { |
| 2042 | $opt_debug |
| 2043 | if test -z "$4" && test -n "$3"; then |
| 2044 | func_error "Could not determine the host path corresponding to" |
| 2045 | func_error " \`$3'" |
| 2046 | func_error "Continuing, but uninstalled executables may not work." |
| 2047 | # Fallback. This is a deliberately simplistic "conversion" and |
| 2048 | # should not be "improved". See libtool.info. |
| 2049 | if test "x$1" != "x$2"; then |
| 2050 | lt_replace_pathsep_chars="s|$1|$2|g" |
| 2051 | func_to_host_path_result=`echo "$3" | |
| 2052 | $SED -e "$lt_replace_pathsep_chars"` |
| 2053 | else |
| 2054 | func_to_host_path_result="$3" |
| 2055 | fi |
| 2056 | fi |
| 2057 | } |
| 2058 | # end func_convert_path_check |
| 2059 | |
| 2060 | |
| 2061 | # func_convert_path_front_back_pathsep FRONTPAT BACKPAT REPL ORIG |
| 2062 | # Modifies func_to_host_path_result by prepending REPL if ORIG matches FRONTPAT |
| 2063 | # and appending REPL if ORIG matches BACKPAT. |
| 2064 | func_convert_path_front_back_pathsep () |
| 2065 | { |
| 2066 | $opt_debug |
| 2067 | case $4 in |
| 2068 | $1 ) func_to_host_path_result="$3$func_to_host_path_result" |
| 2069 | ;; |
| 2070 | esac |
| 2071 | case $4 in |
| 2072 | $2 ) func_to_host_path_result+="$3" |
| 2073 | ;; |
| 2074 | esac |
| 2075 | } |
| 2076 | # end func_convert_path_front_back_pathsep |
| 2077 | |
| 2078 | |
| 2079 | ################################################## |
| 2080 | # $build to $host FILE NAME CONVERSION FUNCTIONS # |
| 2081 | ################################################## |
| 2082 | # invoked via `$to_host_file_cmd ARG' |
| 2083 | # |
| 2084 | # In each case, ARG is the path to be converted from $build to $host format. |
| 2085 | # Result will be available in $func_to_host_file_result. |
| 2086 | |
| 2087 | |
| 2088 | # func_to_host_file ARG |
| 2089 | # Converts the file name ARG from $build format to $host format. Return result |
| 2090 | # in func_to_host_file_result. |
| 2091 | func_to_host_file () |
| 2092 | { |
| 2093 | $opt_debug |
| 2094 | $to_host_file_cmd "$1" |
| 2095 | } |
| 2096 | # end func_to_host_file |
| 2097 | |
| 2098 | |
| 2099 | # func_to_tool_file ARG LAZY |
| 2100 | # converts the file name ARG from $build format to toolchain format. Return |
| 2101 | # result in func_to_tool_file_result. If the conversion in use is listed |
| 2102 | # in (the comma separated) LAZY, no conversion takes place. |
| 2103 | func_to_tool_file () |
| 2104 | { |
| 2105 | $opt_debug |
| 2106 | case ,$2, in |
| 2107 | *,"$to_tool_file_cmd",*) |
| 2108 | func_to_tool_file_result=$1 |
| 2109 | ;; |
| 2110 | *) |
| 2111 | $to_tool_file_cmd "$1" |
| 2112 | func_to_tool_file_result=$func_to_host_file_result |
| 2113 | ;; |
| 2114 | esac |
| 2115 | } |
| 2116 | # end func_to_tool_file |
| 2117 | |
| 2118 | |
| 2119 | # func_convert_file_noop ARG |
| 2120 | # Copy ARG to func_to_host_file_result. |
| 2121 | func_convert_file_noop () |
| 2122 | { |
| 2123 | func_to_host_file_result="$1" |
| 2124 | } |
| 2125 | # end func_convert_file_noop |
| 2126 | |
| 2127 | |
| 2128 | # func_convert_file_msys_to_w32 ARG |
| 2129 | # Convert file name ARG from (mingw) MSYS to (mingw) w32 format; automatic |
| 2130 | # conversion to w32 is not available inside the cwrapper. Returns result in |
| 2131 | # func_to_host_file_result. |
| 2132 | func_convert_file_msys_to_w32 () |
| 2133 | { |
| 2134 | $opt_debug |
| 2135 | func_to_host_file_result="$1" |
| 2136 | if test -n "$1"; then |
| 2137 | func_convert_core_msys_to_w32 "$1" |
| 2138 | func_to_host_file_result="$func_convert_core_msys_to_w32_result" |
| 2139 | fi |
| 2140 | func_convert_file_check "$1" "$func_to_host_file_result" |
| 2141 | } |
| 2142 | # end func_convert_file_msys_to_w32 |
| 2143 | |
| 2144 | |
| 2145 | # func_convert_file_cygwin_to_w32 ARG |
| 2146 | # Convert file name ARG from Cygwin to w32 format. Returns result in |
| 2147 | # func_to_host_file_result. |
| 2148 | func_convert_file_cygwin_to_w32 () |
| 2149 | { |
| 2150 | $opt_debug |
| 2151 | func_to_host_file_result="$1" |
| 2152 | if test -n "$1"; then |
| 2153 | # because $build is cygwin, we call "the" cygpath in $PATH; no need to use |
| 2154 | # LT_CYGPATH in this case. |
| 2155 | func_to_host_file_result=`cygpath -m "$1"` |
| 2156 | fi |
| 2157 | func_convert_file_check "$1" "$func_to_host_file_result" |
| 2158 | } |
| 2159 | # end func_convert_file_cygwin_to_w32 |
| 2160 | |
| 2161 | |
| 2162 | # func_convert_file_nix_to_w32 ARG |
| 2163 | # Convert file name ARG from *nix to w32 format. Requires a wine environment |
| 2164 | # and a working winepath. Returns result in func_to_host_file_result. |
| 2165 | func_convert_file_nix_to_w32 () |
| 2166 | { |
| 2167 | $opt_debug |
| 2168 | func_to_host_file_result="$1" |
| 2169 | if test -n "$1"; then |
| 2170 | func_convert_core_file_wine_to_w32 "$1" |
| 2171 | func_to_host_file_result="$func_convert_core_file_wine_to_w32_result" |
| 2172 | fi |
| 2173 | func_convert_file_check "$1" "$func_to_host_file_result" |
| 2174 | } |
| 2175 | # end func_convert_file_nix_to_w32 |
| 2176 | |
| 2177 | |
| 2178 | # func_convert_file_msys_to_cygwin ARG |
| 2179 | # Convert file name ARG from MSYS to Cygwin format. Requires LT_CYGPATH set. |
| 2180 | # Returns result in func_to_host_file_result. |
| 2181 | func_convert_file_msys_to_cygwin () |
| 2182 | { |
| 2183 | $opt_debug |
| 2184 | func_to_host_file_result="$1" |
| 2185 | if test -n "$1"; then |
| 2186 | func_convert_core_msys_to_w32 "$1" |
| 2187 | func_cygpath -u "$func_convert_core_msys_to_w32_result" |
| 2188 | func_to_host_file_result="$func_cygpath_result" |
| 2189 | fi |
| 2190 | func_convert_file_check "$1" "$func_to_host_file_result" |
| 2191 | } |
| 2192 | # end func_convert_file_msys_to_cygwin |
| 2193 | |
| 2194 | |
| 2195 | # func_convert_file_nix_to_cygwin ARG |
| 2196 | # Convert file name ARG from *nix to Cygwin format. Requires Cygwin installed |
| 2197 | # in a wine environment, working winepath, and LT_CYGPATH set. Returns result |
| 2198 | # in func_to_host_file_result. |
| 2199 | func_convert_file_nix_to_cygwin () |
| 2200 | { |
| 2201 | $opt_debug |
| 2202 | func_to_host_file_result="$1" |
| 2203 | if test -n "$1"; then |
| 2204 | # convert from *nix to w32, then use cygpath to convert from w32 to cygwin. |
| 2205 | func_convert_core_file_wine_to_w32 "$1" |
| 2206 | func_cygpath -u "$func_convert_core_file_wine_to_w32_result" |
| 2207 | func_to_host_file_result="$func_cygpath_result" |
| 2208 | fi |
| 2209 | func_convert_file_check "$1" "$func_to_host_file_result" |
| 2210 | } |
| 2211 | # end func_convert_file_nix_to_cygwin |
| 2212 | |
| 2213 | |
| 2214 | ############################################# |
| 2215 | # $build to $host PATH CONVERSION FUNCTIONS # |
| 2216 | ############################################# |
| 2217 | # invoked via `$to_host_path_cmd ARG' |
| 2218 | # |
| 2219 | # In each case, ARG is the path to be converted from $build to $host format. |
| 2220 | # The result will be available in $func_to_host_path_result. |
| 2221 | # |
| 2222 | # Path separators are also converted from $build format to $host format. If |
| 2223 | # ARG begins or ends with a path separator character, it is preserved (but |
| 2224 | # converted to $host format) on output. |
| 2225 | # |
| 2226 | # All path conversion functions are named using the following convention: |
| 2227 | # file name conversion function : func_convert_file_X_to_Y () |
| 2228 | # path conversion function : func_convert_path_X_to_Y () |
| 2229 | # where, for any given $build/$host combination the 'X_to_Y' value is the |
| 2230 | # same. If conversion functions are added for new $build/$host combinations, |
| 2231 | # the two new functions must follow this pattern, or func_init_to_host_path_cmd |
| 2232 | # will break. |
| 2233 | |
| 2234 | |
| 2235 | # func_init_to_host_path_cmd |
| 2236 | # Ensures that function "pointer" variable $to_host_path_cmd is set to the |
| 2237 | # appropriate value, based on the value of $to_host_file_cmd. |
| 2238 | to_host_path_cmd= |
| 2239 | func_init_to_host_path_cmd () |
| 2240 | { |
| 2241 | $opt_debug |
| 2242 | if test -z "$to_host_path_cmd"; then |
| 2243 | func_stripname 'func_convert_file_' '' "$to_host_file_cmd" |
| 2244 | to_host_path_cmd="func_convert_path_${func_stripname_result}" |
| 2245 | fi |
| 2246 | } |
| 2247 | |
| 2248 | |
| 2249 | # func_to_host_path ARG |
| 2250 | # Converts the path ARG from $build format to $host format. Return result |
| 2251 | # in func_to_host_path_result. |
| 2252 | func_to_host_path () |
| 2253 | { |
| 2254 | $opt_debug |
| 2255 | func_init_to_host_path_cmd |
| 2256 | $to_host_path_cmd "$1" |
| 2257 | } |
| 2258 | # end func_to_host_path |
| 2259 | |
| 2260 | |
| 2261 | # func_convert_path_noop ARG |
| 2262 | # Copy ARG to func_to_host_path_result. |
| 2263 | func_convert_path_noop () |
| 2264 | { |
| 2265 | func_to_host_path_result="$1" |
| 2266 | } |
| 2267 | # end func_convert_path_noop |
| 2268 | |
| 2269 | |
| 2270 | # func_convert_path_msys_to_w32 ARG |
| 2271 | # Convert path ARG from (mingw) MSYS to (mingw) w32 format; automatic |
| 2272 | # conversion to w32 is not available inside the cwrapper. Returns result in |
| 2273 | # func_to_host_path_result. |
| 2274 | func_convert_path_msys_to_w32 () |
| 2275 | { |
| 2276 | $opt_debug |
| 2277 | func_to_host_path_result="$1" |
| 2278 | if test -n "$1"; then |
| 2279 | # Remove leading and trailing path separator characters from ARG. MSYS |
| 2280 | # behavior is inconsistent here; cygpath turns them into '.;' and ';.'; |
| 2281 | # and winepath ignores them completely. |
| 2282 | func_stripname : : "$1" |
| 2283 | func_to_host_path_tmp1=$func_stripname_result |
| 2284 | func_convert_core_msys_to_w32 "$func_to_host_path_tmp1" |
| 2285 | func_to_host_path_result="$func_convert_core_msys_to_w32_result" |
| 2286 | func_convert_path_check : ";" \ |
| 2287 | "$func_to_host_path_tmp1" "$func_to_host_path_result" |
| 2288 | func_convert_path_front_back_pathsep ":*" "*:" ";" "$1" |
| 2289 | fi |
| 2290 | } |
| 2291 | # end func_convert_path_msys_to_w32 |
| 2292 | |
| 2293 | |
| 2294 | # func_convert_path_cygwin_to_w32 ARG |
| 2295 | # Convert path ARG from Cygwin to w32 format. Returns result in |
| 2296 | # func_to_host_file_result. |
| 2297 | func_convert_path_cygwin_to_w32 () |
| 2298 | { |
| 2299 | $opt_debug |
| 2300 | func_to_host_path_result="$1" |
| 2301 | if test -n "$1"; then |
| 2302 | # See func_convert_path_msys_to_w32: |
| 2303 | func_stripname : : "$1" |
| 2304 | func_to_host_path_tmp1=$func_stripname_result |
| 2305 | func_to_host_path_result=`cygpath -m -p "$func_to_host_path_tmp1"` |
| 2306 | func_convert_path_check : ";" \ |
| 2307 | "$func_to_host_path_tmp1" "$func_to_host_path_result" |
| 2308 | func_convert_path_front_back_pathsep ":*" "*:" ";" "$1" |
| 2309 | fi |
| 2310 | } |
| 2311 | # end func_convert_path_cygwin_to_w32 |
| 2312 | |
| 2313 | |
| 2314 | # func_convert_path_nix_to_w32 ARG |
| 2315 | # Convert path ARG from *nix to w32 format. Requires a wine environment and |
| 2316 | # a working winepath. Returns result in func_to_host_file_result. |
| 2317 | func_convert_path_nix_to_w32 () |
| 2318 | { |
| 2319 | $opt_debug |
| 2320 | func_to_host_path_result="$1" |
| 2321 | if test -n "$1"; then |
| 2322 | # See func_convert_path_msys_to_w32: |
| 2323 | func_stripname : : "$1" |
| 2324 | func_to_host_path_tmp1=$func_stripname_result |
| 2325 | func_convert_core_path_wine_to_w32 "$func_to_host_path_tmp1" |
| 2326 | func_to_host_path_result="$func_convert_core_path_wine_to_w32_result" |
| 2327 | func_convert_path_check : ";" \ |
| 2328 | "$func_to_host_path_tmp1" "$func_to_host_path_result" |
| 2329 | func_convert_path_front_back_pathsep ":*" "*:" ";" "$1" |
| 2330 | fi |
| 2331 | } |
| 2332 | # end func_convert_path_nix_to_w32 |
| 2333 | |
| 2334 | |
| 2335 | # func_convert_path_msys_to_cygwin ARG |
| 2336 | # Convert path ARG from MSYS to Cygwin format. Requires LT_CYGPATH set. |
| 2337 | # Returns result in func_to_host_file_result. |
| 2338 | func_convert_path_msys_to_cygwin () |
| 2339 | { |
| 2340 | $opt_debug |
| 2341 | func_to_host_path_result="$1" |
| 2342 | if test -n "$1"; then |
| 2343 | # See func_convert_path_msys_to_w32: |
| 2344 | func_stripname : : "$1" |
| 2345 | func_to_host_path_tmp1=$func_stripname_result |
| 2346 | func_convert_core_msys_to_w32 "$func_to_host_path_tmp1" |
| 2347 | func_cygpath -u -p "$func_convert_core_msys_to_w32_result" |
| 2348 | func_to_host_path_result="$func_cygpath_result" |
| 2349 | func_convert_path_check : : \ |
| 2350 | "$func_to_host_path_tmp1" "$func_to_host_path_result" |
| 2351 | func_convert_path_front_back_pathsep ":*" "*:" : "$1" |
| 2352 | fi |
| 2353 | } |
| 2354 | # end func_convert_path_msys_to_cygwin |
| 2355 | |
| 2356 | |
| 2357 | # func_convert_path_nix_to_cygwin ARG |
| 2358 | # Convert path ARG from *nix to Cygwin format. Requires Cygwin installed in a |
| 2359 | # a wine environment, working winepath, and LT_CYGPATH set. Returns result in |
| 2360 | # func_to_host_file_result. |
| 2361 | func_convert_path_nix_to_cygwin () |
| 2362 | { |
| 2363 | $opt_debug |
| 2364 | func_to_host_path_result="$1" |
| 2365 | if test -n "$1"; then |
| 2366 | # Remove leading and trailing path separator characters from |
| 2367 | # ARG. msys behavior is inconsistent here, cygpath turns them |
| 2368 | # into '.;' and ';.', and winepath ignores them completely. |
| 2369 | func_stripname : : "$1" |
| 2370 | func_to_host_path_tmp1=$func_stripname_result |
| 2371 | func_convert_core_path_wine_to_w32 "$func_to_host_path_tmp1" |
| 2372 | func_cygpath -u -p "$func_convert_core_path_wine_to_w32_result" |
| 2373 | func_to_host_path_result="$func_cygpath_result" |
| 2374 | func_convert_path_check : : \ |
| 2375 | "$func_to_host_path_tmp1" "$func_to_host_path_result" |
| 2376 | func_convert_path_front_back_pathsep ":*" "*:" : "$1" |
| 2377 | fi |
| 2378 | } |
| 2379 | # end func_convert_path_nix_to_cygwin |
| 2380 | |
| 2381 | |
| 2382 | # func_mode_compile arg... |
| 2383 | func_mode_compile () |
| 2384 | { |
| 2385 | $opt_debug |
| 2386 | # Get the compilation command and the source file. |
| 2387 | base_compile= |
| 2388 | srcfile="$nonopt" # always keep a non-empty value in "srcfile" |
| 2389 | suppress_opt=yes |
| 2390 | suppress_output= |
| 2391 | arg_mode=normal |
| 2392 | libobj= |
| 2393 | later= |
| 2394 | pie_flag= |
| 2395 | |
| 2396 | for arg |
| 2397 | do |
| 2398 | case $arg_mode in |
| 2399 | arg ) |
| 2400 | # do not "continue". Instead, add this to base_compile |
| 2401 | lastarg="$arg" |
| 2402 | arg_mode=normal |
| 2403 | ;; |
| 2404 | |
| 2405 | target ) |
| 2406 | libobj="$arg" |
| 2407 | arg_mode=normal |
| 2408 | continue |
| 2409 | ;; |
| 2410 | |
| 2411 | normal ) |
| 2412 | # Accept any command-line options. |
| 2413 | case $arg in |
| 2414 | -o) |
| 2415 | test -n "$libobj" && \ |
| 2416 | func_fatal_error "you cannot specify \`-o' more than once" |
| 2417 | arg_mode=target |
| 2418 | continue |
| 2419 | ;; |
| 2420 | |
| 2421 | -pie | -fpie | -fPIE) |
| 2422 | pie_flag+=" $arg" |
| 2423 | continue |
| 2424 | ;; |
| 2425 | |
| 2426 | -shared | -static | -prefer-pic | -prefer-non-pic) |
| 2427 | later+=" $arg" |
| 2428 | continue |
| 2429 | ;; |
| 2430 | |
| 2431 | -no-suppress) |
| 2432 | suppress_opt=no |
| 2433 | continue |
| 2434 | ;; |
| 2435 | |
| 2436 | -Xcompiler) |
| 2437 | arg_mode=arg # the next one goes into the "base_compile" arg list |
| 2438 | continue # The current "srcfile" will either be retained or |
| 2439 | ;; # replaced later. I would guess that would be a bug. |
| 2440 | |
| 2441 | -Wc,*) |
| 2442 | func_stripname '-Wc,' '' "$arg" |
| 2443 | args=$func_stripname_result |
| 2444 | lastarg= |
| 2445 | save_ifs="$IFS"; IFS=',' |
| 2446 | for arg in $args; do |
| 2447 | IFS="$save_ifs" |
| 2448 | func_append_quoted lastarg "$arg" |
| 2449 | done |
| 2450 | IFS="$save_ifs" |
| 2451 | func_stripname ' ' '' "$lastarg" |
| 2452 | lastarg=$func_stripname_result |
| 2453 | |
| 2454 | # Add the arguments to base_compile. |
| 2455 | base_compile+=" $lastarg" |
| 2456 | continue |
| 2457 | ;; |
| 2458 | |
| 2459 | *) |
| 2460 | # Accept the current argument as the source file. |
| 2461 | # The previous "srcfile" becomes the current argument. |
| 2462 | # |
| 2463 | lastarg="$srcfile" |
| 2464 | srcfile="$arg" |
| 2465 | ;; |
| 2466 | esac # case $arg |
| 2467 | ;; |
| 2468 | esac # case $arg_mode |
| 2469 | |
| 2470 | # Aesthetically quote the previous argument. |
| 2471 | func_append_quoted base_compile "$lastarg" |
| 2472 | done # for arg |
| 2473 | |
| 2474 | case $arg_mode in |
| 2475 | arg) |
| 2476 | func_fatal_error "you must specify an argument for -Xcompile" |
| 2477 | ;; |
| 2478 | target) |
| 2479 | func_fatal_error "you must specify a target with \`-o'" |
| 2480 | ;; |
| 2481 | *) |
| 2482 | # Get the name of the library object. |
| 2483 | test -z "$libobj" && { |
| 2484 | func_basename "$srcfile" |
| 2485 | libobj="$func_basename_result" |
| 2486 | } |
| 2487 | ;; |
| 2488 | esac |
| 2489 | |
| 2490 | # Recognize several different file suffixes. |
| 2491 | # If the user specifies -o file.o, it is replaced with file.lo |
| 2492 | case $libobj in |
| 2493 | *.[cCFSifmso] | \ |
| 2494 | *.ada | *.adb | *.ads | *.asm | \ |
| 2495 | *.c++ | *.cc | *.ii | *.class | *.cpp | *.cxx | \ |
| 2496 | *.[fF][09]? | *.for | *.java | *.go | *.obj | *.sx | *.cu | *.cup) |
| 2497 | func_xform "$libobj" |
| 2498 | libobj=$func_xform_result |
| 2499 | ;; |
| 2500 | esac |
| 2501 | |
| 2502 | case $libobj in |
| 2503 | *.lo) func_lo2o "$libobj"; obj=$func_lo2o_result ;; |
| 2504 | *) |
| 2505 | func_fatal_error "cannot determine name of library object from \`$libobj'" |
| 2506 | ;; |
| 2507 | esac |
| 2508 | |
| 2509 | func_infer_tag $base_compile |
| 2510 | |
| 2511 | for arg in $later; do |
| 2512 | case $arg in |
| 2513 | -shared) |
| 2514 | test "$build_libtool_libs" != yes && \ |
| 2515 | func_fatal_configuration "can not build a shared library" |
| 2516 | build_old_libs=no |
| 2517 | continue |
| 2518 | ;; |
| 2519 | |
| 2520 | -static) |
| 2521 | build_libtool_libs=no |
| 2522 | build_old_libs=yes |
| 2523 | continue |
| 2524 | ;; |
| 2525 | |
| 2526 | -prefer-pic) |
| 2527 | pic_mode=yes |
| 2528 | continue |
| 2529 | ;; |
| 2530 | |
| 2531 | -prefer-non-pic) |
| 2532 | pic_mode=no |
| 2533 | continue |
| 2534 | ;; |
| 2535 | esac |
| 2536 | done |
| 2537 | |
| 2538 | func_quote_for_eval "$libobj" |
| 2539 | test "X$libobj" != "X$func_quote_for_eval_result" \ |
| 2540 | && $ECHO "X$libobj" | $GREP '[]~#^*{};<>?"'"'"' &()|`$[]' \ |
| 2541 | && func_warning "libobj name \`$libobj' may not contain shell special characters." |
| 2542 | func_dirname_and_basename "$obj" "/" "" |
| 2543 | objname="$func_basename_result" |
| 2544 | xdir="$func_dirname_result" |
| 2545 | lobj=${xdir}$objdir/$objname |
| 2546 | |
| 2547 | test -z "$base_compile" && \ |
| 2548 | func_fatal_help "you must specify a compilation command" |
| 2549 | |
| 2550 | # Delete any leftover library objects. |
| 2551 | if test "$build_old_libs" = yes; then |
| 2552 | removelist="$obj $lobj $libobj ${libobj}T" |
| 2553 | else |
| 2554 | removelist="$lobj $libobj ${libobj}T" |
| 2555 | fi |
| 2556 | |
| 2557 | # On Cygwin there's no "real" PIC flag so we must build both object types |
| 2558 | case $host_os in |
| 2559 | cygwin* | mingw* | pw32* | os2* | cegcc*) |
| 2560 | pic_mode=default |
| 2561 | ;; |
| 2562 | esac |
| 2563 | if test "$pic_mode" = no && test "$deplibs_check_method" != pass_all; then |
| 2564 | # non-PIC code in shared libraries is not supported |
| 2565 | pic_mode=default |
| 2566 | fi |
| 2567 | |
| 2568 | # Calculate the filename of the output object if compiler does |
| 2569 | # not support -o with -c |
| 2570 | if test "$compiler_c_o" = no; then |
| 2571 | output_obj=`$ECHO "$srcfile" | $SED 's%^.*/%%; s%\.[^.]*$%%'`.${objext} |
| 2572 | lockfile="$output_obj.lock" |
| 2573 | else |
| 2574 | output_obj= |
| 2575 | need_locks=no |
| 2576 | lockfile= |
| 2577 | fi |
| 2578 | |
| 2579 | # Lock this critical section if it is needed |
| 2580 | # We use this script file to make the link, it avoids creating a new file |
| 2581 | if test "$need_locks" = yes; then |
| 2582 | until $opt_dry_run || ln "$progpath" "$lockfile" 2>/dev/null; do |
| 2583 | func_echo "Waiting for $lockfile to be removed" |
| 2584 | sleep 2 |
| 2585 | done |
| 2586 | elif test "$need_locks" = warn; then |
| 2587 | if test -f "$lockfile"; then |
| 2588 | $ECHO "\ |
| 2589 | *** ERROR, $lockfile exists and contains: |
| 2590 | `cat $lockfile 2>/dev/null` |
| 2591 | |
| 2592 | This indicates that another process is trying to use the same |
| 2593 | temporary object file, and libtool could not work around it because |
| 2594 | your compiler does not support \`-c' and \`-o' together. If you |
| 2595 | repeat this compilation, it may succeed, by chance, but you had better |
| 2596 | avoid parallel builds (make -j) in this platform, or get a better |
| 2597 | compiler." |
| 2598 | |
| 2599 | $opt_dry_run || $RM $removelist |
| 2600 | exit $EXIT_FAILURE |
| 2601 | fi |
| 2602 | removelist+=" $output_obj" |
| 2603 | $ECHO "$srcfile" > "$lockfile" |
| 2604 | fi |
| 2605 | |
| 2606 | $opt_dry_run || $RM $removelist |
| 2607 | removelist+=" $lockfile" |
| 2608 | trap '$opt_dry_run || $RM $removelist; exit $EXIT_FAILURE' 1 2 15 |
| 2609 | |
| 2610 | func_to_tool_file "$srcfile" func_convert_file_msys_to_w32 |
| 2611 | srcfile=$func_to_tool_file_result |
| 2612 | func_quote_for_eval "$srcfile" |
| 2613 | qsrcfile=$func_quote_for_eval_result |
| 2614 | |
| 2615 | # Only build a PIC object if we are building libtool libraries. |
| 2616 | if test "$build_libtool_libs" = yes; then |
| 2617 | # Without this assignment, base_compile gets emptied. |
| 2618 | fbsd_hideous_sh_bug=$base_compile |
| 2619 | |
| 2620 | if test "$pic_mode" != no; then |
| 2621 | command="$base_compile $qsrcfile $pic_flag" |
| 2622 | else |
| 2623 | # Don't build PIC code |
| 2624 | command="$base_compile $qsrcfile" |
| 2625 | fi |
| 2626 | |
| 2627 | func_mkdir_p "$xdir$objdir" |
| 2628 | |
| 2629 | if test -z "$output_obj"; then |
| 2630 | # Place PIC objects in $objdir |
| 2631 | command+=" -o $lobj" |
| 2632 | fi |
| 2633 | |
| 2634 | func_show_eval_locale "$command" \ |
| 2635 | 'test -n "$output_obj" && $RM $removelist; exit $EXIT_FAILURE' |
| 2636 | |
| 2637 | if test "$need_locks" = warn && |
| 2638 | test "X`cat $lockfile 2>/dev/null`" != "X$srcfile"; then |
| 2639 | $ECHO "\ |
| 2640 | *** ERROR, $lockfile contains: |
| 2641 | `cat $lockfile 2>/dev/null` |
| 2642 | |
| 2643 | but it should contain: |
| 2644 | $srcfile |
| 2645 | |
| 2646 | This indicates that another process is trying to use the same |
| 2647 | temporary object file, and libtool could not work around it because |
| 2648 | your compiler does not support \`-c' and \`-o' together. If you |
| 2649 | repeat this compilation, it may succeed, by chance, but you had better |
| 2650 | avoid parallel builds (make -j) in this platform, or get a better |
| 2651 | compiler." |
| 2652 | |
| 2653 | $opt_dry_run || $RM $removelist |
| 2654 | exit $EXIT_FAILURE |
| 2655 | fi |
| 2656 | |
| 2657 | # Just move the object if needed, then go on to compile the next one |
| 2658 | if test -n "$output_obj" && test "X$output_obj" != "X$lobj"; then |
| 2659 | func_show_eval '$MV "$output_obj" "$lobj"' \ |
| 2660 | 'error=$?; $opt_dry_run || $RM $removelist; exit $error' |
| 2661 | fi |
| 2662 | |
| 2663 | # Allow error messages only from the first compilation. |
| 2664 | if test "$suppress_opt" = yes; then |
| 2665 | suppress_output=' >/dev/null 2>&1' |
| 2666 | fi |
| 2667 | fi |
| 2668 | |
| 2669 | # Only build a position-dependent object if we build old libraries. |
| 2670 | if test "$build_old_libs" = yes; then |
| 2671 | if test "$pic_mode" != yes; then |
| 2672 | # Don't build PIC code |
| 2673 | command="$base_compile $qsrcfile$pie_flag" |
| 2674 | else |
| 2675 | command="$base_compile $qsrcfile $pic_flag" |
| 2676 | fi |
| 2677 | if test "$compiler_c_o" = yes; then |
| 2678 | command+=" -o $obj" |
| 2679 | fi |
| 2680 | |
| 2681 | # Suppress compiler output if we already did a PIC compilation. |
| 2682 | command+="$suppress_output" |
| 2683 | func_show_eval_locale "$command" \ |
| 2684 | '$opt_dry_run || $RM $removelist; exit $EXIT_FAILURE' |
| 2685 | |
| 2686 | if test "$need_locks" = warn && |
| 2687 | test "X`cat $lockfile 2>/dev/null`" != "X$srcfile"; then |
| 2688 | $ECHO "\ |
| 2689 | *** ERROR, $lockfile contains: |
| 2690 | `cat $lockfile 2>/dev/null` |
| 2691 | |
| 2692 | but it should contain: |
| 2693 | $srcfile |
| 2694 | |
| 2695 | This indicates that another process is trying to use the same |
| 2696 | temporary object file, and libtool could not work around it because |
| 2697 | your compiler does not support \`-c' and \`-o' together. If you |
| 2698 | repeat this compilation, it may succeed, by chance, but you had better |
| 2699 | avoid parallel builds (make -j) in this platform, or get a better |
| 2700 | compiler." |
| 2701 | |
| 2702 | $opt_dry_run || $RM $removelist |
| 2703 | exit $EXIT_FAILURE |
| 2704 | fi |
| 2705 | |
| 2706 | # Just move the object if needed |
| 2707 | if test -n "$output_obj" && test "X$output_obj" != "X$obj"; then |
| 2708 | func_show_eval '$MV "$output_obj" "$obj"' \ |
| 2709 | 'error=$?; $opt_dry_run || $RM $removelist; exit $error' |
| 2710 | fi |
| 2711 | fi |
| 2712 | |
| 2713 | $opt_dry_run || { |
| 2714 | func_write_libtool_object "$libobj" "$objdir/$objname" "$objname" |
| 2715 | |
| 2716 | # Unlock the critical section if it was locked |
| 2717 | if test "$need_locks" != no; then |
| 2718 | removelist=$lockfile |
| 2719 | $RM "$lockfile" |
| 2720 | fi |
| 2721 | } |
| 2722 | |
| 2723 | exit $EXIT_SUCCESS |
| 2724 | } |
| 2725 | |
| 2726 | $opt_help || { |
| 2727 | test "$opt_mode" = compile && func_mode_compile ${1+"$@"} |
| 2728 | } |
| 2729 | |
| 2730 | func_mode_help () |
| 2731 | { |
| 2732 | # We need to display help for each of the modes. |
| 2733 | case $opt_mode in |
| 2734 | "") |
| 2735 | # Generic help is extracted from the usage comments |
| 2736 | # at the start of this file. |
| 2737 | func_help |
| 2738 | ;; |
| 2739 | |
| 2740 | clean) |
| 2741 | $ECHO \ |
| 2742 | "Usage: $progname [OPTION]... --mode=clean RM [RM-OPTION]... FILE... |
| 2743 | |
| 2744 | Remove files from the build directory. |
| 2745 | |
| 2746 | RM is the name of the program to use to delete files associated with each FILE |
| 2747 | (typically \`/bin/rm'). RM-OPTIONS are options (such as \`-f') to be passed |
| 2748 | to RM. |
| 2749 | |
| 2750 | If FILE is a libtool library, object or program, all the files associated |
| 2751 | with it are deleted. Otherwise, only FILE itself is deleted using RM." |
| 2752 | ;; |
| 2753 | |
| 2754 | compile) |
| 2755 | $ECHO \ |
| 2756 | "Usage: $progname [OPTION]... --mode=compile COMPILE-COMMAND... SOURCEFILE |
| 2757 | |
| 2758 | Compile a source file into a libtool library object. |
| 2759 | |
| 2760 | This mode accepts the following additional options: |
| 2761 | |
| 2762 | -o OUTPUT-FILE set the output file name to OUTPUT-FILE |
| 2763 | -no-suppress do not suppress compiler output for multiple passes |
| 2764 | -prefer-pic try to build PIC objects only |
| 2765 | -prefer-non-pic try to build non-PIC objects only |
| 2766 | -shared do not build a \`.o' file suitable for static linking |
| 2767 | -static only build a \`.o' file suitable for static linking |
| 2768 | -Wc,FLAG pass FLAG directly to the compiler |
| 2769 | |
| 2770 | COMPILE-COMMAND is a command to be used in creating a \`standard' object file |
| 2771 | from the given SOURCEFILE. |
| 2772 | |
| 2773 | The output file name is determined by removing the directory component from |
| 2774 | SOURCEFILE, then substituting the C source code suffix \`.c' with the |
| 2775 | library object suffix, \`.lo'." |
| 2776 | ;; |
| 2777 | |
| 2778 | execute) |
| 2779 | $ECHO \ |
| 2780 | "Usage: $progname [OPTION]... --mode=execute COMMAND [ARGS]... |
| 2781 | |
| 2782 | Automatically set library path, then run a program. |
| 2783 | |
| 2784 | This mode accepts the following additional options: |
| 2785 | |
| 2786 | -dlopen FILE add the directory containing FILE to the library path |
| 2787 | |
| 2788 | This mode sets the library path environment variable according to \`-dlopen' |
| 2789 | flags. |
| 2790 | |
| 2791 | If any of the ARGS are libtool executable wrappers, then they are translated |
| 2792 | into their corresponding uninstalled binary, and any of their required library |
| 2793 | directories are added to the library path. |
| 2794 | |
| 2795 | Then, COMMAND is executed, with ARGS as arguments." |
| 2796 | ;; |
| 2797 | |
| 2798 | finish) |
| 2799 | $ECHO \ |
| 2800 | "Usage: $progname [OPTION]... --mode=finish [LIBDIR]... |
| 2801 | |
| 2802 | Complete the installation of libtool libraries. |
| 2803 | |
| 2804 | Each LIBDIR is a directory that contains libtool libraries. |
| 2805 | |
| 2806 | The commands that this mode executes may require superuser privileges. Use |
| 2807 | the \`--dry-run' option if you just want to see what would be executed." |
| 2808 | ;; |
| 2809 | |
| 2810 | install) |
| 2811 | $ECHO \ |
| 2812 | "Usage: $progname [OPTION]... --mode=install INSTALL-COMMAND... |
| 2813 | |
| 2814 | Install executables or libraries. |
| 2815 | |
| 2816 | INSTALL-COMMAND is the installation command. The first component should be |
| 2817 | either the \`install' or \`cp' program. |
| 2818 | |
| 2819 | The following components of INSTALL-COMMAND are treated specially: |
| 2820 | |
| 2821 | -inst-prefix-dir PREFIX-DIR Use PREFIX-DIR as a staging area for installation |
| 2822 | |
| 2823 | The rest of the components are interpreted as arguments to that command (only |
| 2824 | BSD-compatible install options are recognized)." |
| 2825 | ;; |
| 2826 | |
| 2827 | link) |
| 2828 | $ECHO \ |
| 2829 | "Usage: $progname [OPTION]... --mode=link LINK-COMMAND... |
| 2830 | |
| 2831 | Link object files or libraries together to form another library, or to |
| 2832 | create an executable program. |
| 2833 | |
| 2834 | LINK-COMMAND is a command using the C compiler that you would use to create |
| 2835 | a program from several object files. |
| 2836 | |
| 2837 | The following components of LINK-COMMAND are treated specially: |
| 2838 | |
| 2839 | -all-static do not do any dynamic linking at all |
| 2840 | -avoid-version do not add a version suffix if possible |
| 2841 | -bindir BINDIR specify path to binaries directory (for systems where |
| 2842 | libraries must be found in the PATH setting at runtime) |
| 2843 | -dlopen FILE \`-dlpreopen' FILE if it cannot be dlopened at runtime |
| 2844 | -dlpreopen FILE link in FILE and add its symbols to lt_preloaded_symbols |
| 2845 | -export-dynamic allow symbols from OUTPUT-FILE to be resolved with dlsym(3) |
| 2846 | -export-symbols SYMFILE |
| 2847 | try to export only the symbols listed in SYMFILE |
| 2848 | -export-symbols-regex REGEX |
| 2849 | try to export only the symbols matching REGEX |
| 2850 | -LLIBDIR search LIBDIR for required installed libraries |
| 2851 | -lNAME OUTPUT-FILE requires the installed library libNAME |
| 2852 | -module build a library that can dlopened |
| 2853 | -no-fast-install disable the fast-install mode |
| 2854 | -no-install link a not-installable executable |
| 2855 | -no-undefined declare that a library does not refer to external symbols |
| 2856 | -o OUTPUT-FILE create OUTPUT-FILE from the specified objects |
| 2857 | -objectlist FILE Use a list of object files found in FILE to specify objects |
| 2858 | -precious-files-regex REGEX |
| 2859 | don't remove output files matching REGEX |
| 2860 | -release RELEASE specify package release information |
| 2861 | -rpath LIBDIR the created library will eventually be installed in LIBDIR |
| 2862 | -R[ ]LIBDIR add LIBDIR to the runtime path of programs and libraries |
| 2863 | -shared only do dynamic linking of libtool libraries |
| 2864 | -shrext SUFFIX override the standard shared library file extension |
| 2865 | -static do not do any dynamic linking of uninstalled libtool libraries |
| 2866 | -static-libtool-libs |
| 2867 | do not do any dynamic linking of libtool libraries |
| 2868 | -version-info CURRENT[:REVISION[:AGE]] |
| 2869 | specify library version info [each variable defaults to 0] |
| 2870 | -weak LIBNAME declare that the target provides the LIBNAME interface |
| 2871 | -Wc,FLAG |
| 2872 | -Xcompiler FLAG pass linker-specific FLAG directly to the compiler |
| 2873 | -Wl,FLAG |
| 2874 | -Xlinker FLAG pass linker-specific FLAG directly to the linker |
| 2875 | -XCClinker FLAG pass link-specific FLAG to the compiler driver (CC) |
| 2876 | |
| 2877 | All other options (arguments beginning with \`-') are ignored. |
| 2878 | |
| 2879 | Every other argument is treated as a filename. Files ending in \`.la' are |
| 2880 | treated as uninstalled libtool libraries, other files are standard or library |
| 2881 | object files. |
| 2882 | |
| 2883 | If the OUTPUT-FILE ends in \`.la', then a libtool library is created, |
| 2884 | only library objects (\`.lo' files) may be specified, and \`-rpath' is |
| 2885 | required, except when creating a convenience library. |
| 2886 | |
| 2887 | If OUTPUT-FILE ends in \`.a' or \`.lib', then a standard library is created |
| 2888 | using \`ar' and \`ranlib', or on Windows using \`lib'. |
| 2889 | |
| 2890 | If OUTPUT-FILE ends in \`.lo' or \`.${objext}', then a reloadable object file |
| 2891 | is created, otherwise an executable program is created." |
| 2892 | ;; |
| 2893 | |
| 2894 | uninstall) |
| 2895 | $ECHO \ |
| 2896 | "Usage: $progname [OPTION]... --mode=uninstall RM [RM-OPTION]... FILE... |
| 2897 | |
| 2898 | Remove libraries from an installation directory. |
| 2899 | |
| 2900 | RM is the name of the program to use to delete files associated with each FILE |
| 2901 | (typically \`/bin/rm'). RM-OPTIONS are options (such as \`-f') to be passed |
| 2902 | to RM. |
| 2903 | |
| 2904 | If FILE is a libtool library, all the files associated with it are deleted. |
| 2905 | Otherwise, only FILE itself is deleted using RM." |
| 2906 | ;; |
| 2907 | |
| 2908 | *) |
| 2909 | func_fatal_help "invalid operation mode \`$opt_mode'" |
| 2910 | ;; |
| 2911 | esac |
| 2912 | |
| 2913 | echo |
| 2914 | $ECHO "Try \`$progname --help' for more information about other modes." |
| 2915 | } |
| 2916 | |
| 2917 | # Now that we've collected a possible --mode arg, show help if necessary |
| 2918 | if $opt_help; then |
| 2919 | if test "$opt_help" = :; then |
| 2920 | func_mode_help |
| 2921 | else |
| 2922 | { |
| 2923 | func_help noexit |
| 2924 | for opt_mode in compile link execute install finish uninstall clean; do |
| 2925 | func_mode_help |
| 2926 | done |
| 2927 | } | sed -n '1p; 2,$s/^Usage:/ or: /p' |
| 2928 | { |
| 2929 | func_help noexit |
| 2930 | for opt_mode in compile link execute install finish uninstall clean; do |
| 2931 | echo |
| 2932 | func_mode_help |
| 2933 | done |
| 2934 | } | |
| 2935 | sed '1d |
| 2936 | /^When reporting/,/^Report/{ |
| 2937 | H |
| 2938 | d |
| 2939 | } |
| 2940 | $x |
| 2941 | /information about other modes/d |
| 2942 | /more detailed .*MODE/d |
| 2943 | s/^Usage:.*--mode=\([^ ]*\) .*/Description of \1 mode:/' |
| 2944 | fi |
| 2945 | exit $? |
| 2946 | fi |
| 2947 | |
| 2948 | |
| 2949 | # func_mode_execute arg... |
| 2950 | func_mode_execute () |
| 2951 | { |
| 2952 | $opt_debug |
| 2953 | # The first argument is the command name. |
| 2954 | cmd="$nonopt" |
| 2955 | test -z "$cmd" && \ |
| 2956 | func_fatal_help "you must specify a COMMAND" |
| 2957 | |
| 2958 | # Handle -dlopen flags immediately. |
| 2959 | for file in $opt_dlopen; do |
| 2960 | test -f "$file" \ |
| 2961 | || func_fatal_help "\`$file' is not a file" |
| 2962 | |
| 2963 | dir= |
| 2964 | case $file in |
| 2965 | *.la) |
| 2966 | func_resolve_sysroot "$file" |
| 2967 | file=$func_resolve_sysroot_result |
| 2968 | |
| 2969 | # Check to see that this really is a libtool archive. |
| 2970 | func_lalib_unsafe_p "$file" \ |
| 2971 | || func_fatal_help "\`$lib' is not a valid libtool archive" |
| 2972 | |
| 2973 | # Read the libtool library. |
| 2974 | dlname= |
| 2975 | library_names= |
| 2976 | func_source "$file" |
| 2977 | |
| 2978 | # Skip this library if it cannot be dlopened. |
| 2979 | if test -z "$dlname"; then |
| 2980 | # Warn if it was a shared library. |
| 2981 | test -n "$library_names" && \ |
| 2982 | func_warning "\`$file' was not linked with \`-export-dynamic'" |
| 2983 | continue |
| 2984 | fi |
| 2985 | |
| 2986 | func_dirname "$file" "" "." |
| 2987 | dir="$func_dirname_result" |
| 2988 | |
| 2989 | if test -f "$dir/$objdir/$dlname"; then |
| 2990 | dir+="/$objdir" |
| 2991 | else |
| 2992 | if test ! -f "$dir/$dlname"; then |
| 2993 | func_fatal_error "cannot find \`$dlname' in \`$dir' or \`$dir/$objdir'" |
| 2994 | fi |
| 2995 | fi |
| 2996 | ;; |
| 2997 | |
| 2998 | *.lo) |
| 2999 | # Just add the directory containing the .lo file. |
| 3000 | func_dirname "$file" "" "." |
| 3001 | dir="$func_dirname_result" |
| 3002 | ;; |
| 3003 | |
| 3004 | *) |
| 3005 | func_warning "\`-dlopen' is ignored for non-libtool libraries and objects" |
| 3006 | continue |
| 3007 | ;; |
| 3008 | esac |
| 3009 | |
| 3010 | # Get the absolute pathname. |
| 3011 | absdir=`cd "$dir" && pwd` |
| 3012 | test -n "$absdir" && dir="$absdir" |
| 3013 | |
| 3014 | # Now add the directory to shlibpath_var. |
| 3015 | if eval "test -z \"\$$shlibpath_var\""; then |
| 3016 | eval "$shlibpath_var=\"\$dir\"" |
| 3017 | else |
| 3018 | eval "$shlibpath_var=\"\$dir:\$$shlibpath_var\"" |
| 3019 | fi |
| 3020 | done |
| 3021 | |
| 3022 | # This variable tells wrapper scripts just to set shlibpath_var |
| 3023 | # rather than running their programs. |
| 3024 | libtool_execute_magic="$magic" |
| 3025 | |
| 3026 | # Check if any of the arguments is a wrapper script. |
| 3027 | args= |
| 3028 | for file |
| 3029 | do |
| 3030 | case $file in |
| 3031 | -* | *.la | *.lo ) ;; |
| 3032 | *) |
| 3033 | # Do a test to see if this is really a libtool program. |
| 3034 | if func_ltwrapper_script_p "$file"; then |
| 3035 | func_source "$file" |
| 3036 | # Transform arg to wrapped name. |
| 3037 | file="$progdir/$program" |
| 3038 | elif func_ltwrapper_executable_p "$file"; then |
| 3039 | func_ltwrapper_scriptname "$file" |
| 3040 | func_source "$func_ltwrapper_scriptname_result" |
| 3041 | # Transform arg to wrapped name. |
| 3042 | file="$progdir/$program" |
| 3043 | fi |
| 3044 | ;; |
| 3045 | esac |
| 3046 | # Quote arguments (to preserve shell metacharacters). |
| 3047 | func_append_quoted args "$file" |
| 3048 | done |
| 3049 | |
| 3050 | if test "X$opt_dry_run" = Xfalse; then |
| 3051 | if test -n "$shlibpath_var"; then |
| 3052 | # Export the shlibpath_var. |
| 3053 | eval "export $shlibpath_var" |
| 3054 | fi |
| 3055 | |
| 3056 | # Restore saved environment variables |
| 3057 | for lt_var in LANG LANGUAGE LC_ALL LC_CTYPE LC_COLLATE LC_MESSAGES |
| 3058 | do |
| 3059 | eval "if test \"\${save_$lt_var+set}\" = set; then |
| 3060 | $lt_var=\$save_$lt_var; export $lt_var |
| 3061 | else |
| 3062 | $lt_unset $lt_var |
| 3063 | fi" |
| 3064 | done |
| 3065 | |
| 3066 | # Now prepare to actually exec the command. |
| 3067 | exec_cmd="\$cmd$args" |
| 3068 | else |
| 3069 | # Display what would be done. |
| 3070 | if test -n "$shlibpath_var"; then |
| 3071 | eval "\$ECHO \"\$shlibpath_var=\$$shlibpath_var\"" |
| 3072 | echo "export $shlibpath_var" |
| 3073 | fi |
| 3074 | $ECHO "$cmd$args" |
| 3075 | exit $EXIT_SUCCESS |
| 3076 | fi |
| 3077 | } |
| 3078 | |
| 3079 | test "$opt_mode" = execute && func_mode_execute ${1+"$@"} |
| 3080 | |
| 3081 | |
| 3082 | # func_mode_finish arg... |
| 3083 | func_mode_finish () |
| 3084 | { |
| 3085 | $opt_debug |
| 3086 | libs= |
| 3087 | libdirs= |
| 3088 | admincmds= |
| 3089 | |
| 3090 | for opt in "$nonopt" ${1+"$@"} |
| 3091 | do |
| 3092 | if test -d "$opt"; then |
| 3093 | libdirs+=" $opt" |
| 3094 | |
| 3095 | elif test -f "$opt"; then |
| 3096 | if func_lalib_unsafe_p "$opt"; then |
| 3097 | libs+=" $opt" |
| 3098 | else |
| 3099 | func_warning "\`$opt' is not a valid libtool archive" |
| 3100 | fi |
| 3101 | |
| 3102 | else |
| 3103 | func_fatal_error "invalid argument \`$opt'" |
| 3104 | fi |
| 3105 | done |
| 3106 | |
| 3107 | if test -n "$libs"; then |
| 3108 | if test -n "$lt_sysroot"; then |
| 3109 | sysroot_regex=`$ECHO "$lt_sysroot" | $SED "$sed_make_literal_regex"` |
| 3110 | sysroot_cmd="s/\([ ']\)$sysroot_regex/\1/g;" |
| 3111 | else |
| 3112 | sysroot_cmd= |
| 3113 | fi |
| 3114 | |
| 3115 | # Remove sysroot references |
| 3116 | if $opt_dry_run; then |
| 3117 | for lib in $libs; do |
| 3118 | echo "removing references to $lt_sysroot and \`=' prefixes from $lib" |
| 3119 | done |
| 3120 | else |
| 3121 | tmpdir=`func_mktempdir` |
| 3122 | for lib in $libs; do |
| 3123 | sed -e "${sysroot_cmd} s/\([ ']-[LR]\)=/\1/g; s/\([ ']\)=/\1/g" $lib \ |
| 3124 | > $tmpdir/tmp-la |
| 3125 | mv -f $tmpdir/tmp-la $lib |
| 3126 | done |
| 3127 | ${RM}r "$tmpdir" |
| 3128 | fi |
| 3129 | fi |
| 3130 | |
| 3131 | if test -n "$finish_cmds$finish_eval" && test -n "$libdirs"; then |
| 3132 | for libdir in $libdirs; do |
| 3133 | if test -n "$finish_cmds"; then |
| 3134 | # Do each command in the finish commands. |
| 3135 | func_execute_cmds "$finish_cmds" 'admincmds="$admincmds |
| 3136 | '"$cmd"'"' |
| 3137 | fi |
| 3138 | if test -n "$finish_eval"; then |
| 3139 | # Do the single finish_eval. |
| 3140 | eval cmds=\"$finish_eval\" |
| 3141 | $opt_dry_run || eval "$cmds" || admincmds+=" |
| 3142 | $cmds" |
| 3143 | fi |
| 3144 | done |
| 3145 | fi |
| 3146 | |
| 3147 | # Exit here if they wanted silent mode. |
| 3148 | $opt_silent && exit $EXIT_SUCCESS |
| 3149 | |
| 3150 | if test -n "$finish_cmds$finish_eval" && test -n "$libdirs"; then |
| 3151 | echo "----------------------------------------------------------------------" |
| 3152 | echo "Libraries have been installed in:" |
| 3153 | for libdir in $libdirs; do |
| 3154 | $ECHO " $libdir" |
| 3155 | done |
| 3156 | echo |
| 3157 | echo "If you ever happen to want to link against installed libraries" |
| 3158 | echo "in a given directory, LIBDIR, you must either use libtool, and" |
| 3159 | echo "specify the full pathname of the library, or use the \`-LLIBDIR'" |
| 3160 | echo "flag during linking and do at least one of the following:" |
| 3161 | if test -n "$shlibpath_var"; then |
| 3162 | echo " - add LIBDIR to the \`$shlibpath_var' environment variable" |
| 3163 | echo " during execution" |
| 3164 | fi |
| 3165 | if test -n "$runpath_var"; then |
| 3166 | echo " - add LIBDIR to the \`$runpath_var' environment variable" |
| 3167 | echo " during linking" |
| 3168 | fi |
| 3169 | if test -n "$hardcode_libdir_flag_spec"; then |
| 3170 | libdir=LIBDIR |
| 3171 | eval flag=\"$hardcode_libdir_flag_spec\" |
| 3172 | |
| 3173 | $ECHO " - use the \`$flag' linker flag" |
| 3174 | fi |
| 3175 | if test -n "$admincmds"; then |
| 3176 | $ECHO " - have your system administrator run these commands:$admincmds" |
| 3177 | fi |
| 3178 | if test -f /etc/ld.so.conf; then |
| 3179 | echo " - have your system administrator add LIBDIR to \`/etc/ld.so.conf'" |
| 3180 | fi |
| 3181 | echo |
| 3182 | |
| 3183 | echo "See any operating system documentation about shared libraries for" |
| 3184 | case $host in |
| 3185 | solaris2.[6789]|solaris2.1[0-9]) |
| 3186 | echo "more information, such as the ld(1), crle(1) and ld.so(8) manual" |
| 3187 | echo "pages." |
| 3188 | ;; |
| 3189 | *) |
| 3190 | echo "more information, such as the ld(1) and ld.so(8) manual pages." |
| 3191 | ;; |
| 3192 | esac |
| 3193 | echo "----------------------------------------------------------------------" |
| 3194 | fi |
| 3195 | exit $EXIT_SUCCESS |
| 3196 | } |
| 3197 | |
| 3198 | test "$opt_mode" = finish && func_mode_finish ${1+"$@"} |
| 3199 | |
| 3200 | |
| 3201 | # func_mode_install arg... |
| 3202 | func_mode_install () |
| 3203 | { |
| 3204 | $opt_debug |
| 3205 | # There may be an optional sh(1) argument at the beginning of |
| 3206 | # install_prog (especially on Windows NT). |
| 3207 | if test "$nonopt" = "$SHELL" || test "$nonopt" = /bin/sh || |
| 3208 | # Allow the use of GNU shtool's install command. |
| 3209 | case $nonopt in *shtool*) :;; *) false;; esac; then |
| 3210 | # Aesthetically quote it. |
| 3211 | func_quote_for_eval "$nonopt" |
| 3212 | install_prog="$func_quote_for_eval_result " |
| 3213 | arg=$1 |
| 3214 | shift |
| 3215 | else |
| 3216 | install_prog= |
| 3217 | arg=$nonopt |
| 3218 | fi |
| 3219 | |
| 3220 | # The real first argument should be the name of the installation program. |
| 3221 | # Aesthetically quote it. |
| 3222 | func_quote_for_eval "$arg" |
| 3223 | install_prog+="$func_quote_for_eval_result" |
| 3224 | install_shared_prog=$install_prog |
| 3225 | case " $install_prog " in |
| 3226 | *[\\\ /]cp\ *) install_cp=: ;; |
| 3227 | *) install_cp=false ;; |
| 3228 | esac |
| 3229 | |
| 3230 | # We need to accept at least all the BSD install flags. |
| 3231 | dest= |
| 3232 | files= |
| 3233 | opts= |
| 3234 | prev= |
| 3235 | install_type= |
| 3236 | isdir=no |
| 3237 | stripme= |
| 3238 | no_mode=: |
| 3239 | for arg |
| 3240 | do |
| 3241 | arg2= |
| 3242 | if test -n "$dest"; then |
| 3243 | files+=" $dest" |
| 3244 | dest=$arg |
| 3245 | continue |
| 3246 | fi |
| 3247 | |
| 3248 | case $arg in |
| 3249 | -d) isdir=yes ;; |
| 3250 | -f) |
| 3251 | if $install_cp; then :; else |
| 3252 | prev=$arg |
| 3253 | fi |
| 3254 | ;; |
| 3255 | -g | -m | -o) |
| 3256 | prev=$arg |
| 3257 | ;; |
| 3258 | -s) |
| 3259 | stripme=" -s" |
| 3260 | continue |
| 3261 | ;; |
| 3262 | -*) |
| 3263 | ;; |
| 3264 | *) |
| 3265 | # If the previous option needed an argument, then skip it. |
| 3266 | if test -n "$prev"; then |
| 3267 | if test "x$prev" = x-m && test -n "$install_override_mode"; then |
| 3268 | arg2=$install_override_mode |
| 3269 | no_mode=false |
| 3270 | fi |
| 3271 | prev= |
| 3272 | else |
| 3273 | dest=$arg |
| 3274 | continue |
| 3275 | fi |
| 3276 | ;; |
| 3277 | esac |
| 3278 | |
| 3279 | # Aesthetically quote the argument. |
| 3280 | func_quote_for_eval "$arg" |
| 3281 | install_prog+=" $func_quote_for_eval_result" |
| 3282 | if test -n "$arg2"; then |
| 3283 | func_quote_for_eval "$arg2" |
| 3284 | fi |
| 3285 | install_shared_prog+=" $func_quote_for_eval_result" |
| 3286 | done |
| 3287 | |
| 3288 | test -z "$install_prog" && \ |
| 3289 | func_fatal_help "you must specify an install program" |
| 3290 | |
| 3291 | test -n "$prev" && \ |
| 3292 | func_fatal_help "the \`$prev' option requires an argument" |
| 3293 | |
| 3294 | if test -n "$install_override_mode" && $no_mode; then |
| 3295 | if $install_cp; then :; else |
| 3296 | func_quote_for_eval "$install_override_mode" |
| 3297 | install_shared_prog+=" -m $func_quote_for_eval_result" |
| 3298 | fi |
| 3299 | fi |
| 3300 | |
| 3301 | if test -z "$files"; then |
| 3302 | if test -z "$dest"; then |
| 3303 | func_fatal_help "no file or destination specified" |
| 3304 | else |
| 3305 | func_fatal_help "you must specify a destination" |
| 3306 | fi |
| 3307 | fi |
| 3308 | |
| 3309 | # Strip any trailing slash from the destination. |
| 3310 | func_stripname '' '/' "$dest" |
| 3311 | dest=$func_stripname_result |
| 3312 | |
| 3313 | # Check to see that the destination is a directory. |
| 3314 | test -d "$dest" && isdir=yes |
| 3315 | if test "$isdir" = yes; then |
| 3316 | destdir="$dest" |
| 3317 | destname= |
| 3318 | else |
| 3319 | func_dirname_and_basename "$dest" "" "." |
| 3320 | destdir="$func_dirname_result" |
| 3321 | destname="$func_basename_result" |
| 3322 | |
| 3323 | # Not a directory, so check to see that there is only one file specified. |
| 3324 | set dummy $files; shift |
| 3325 | test "$#" -gt 1 && \ |
| 3326 | func_fatal_help "\`$dest' is not a directory" |
| 3327 | fi |
| 3328 | case $destdir in |
| 3329 | [\\/]* | [A-Za-z]:[\\/]*) ;; |
| 3330 | *) |
| 3331 | for file in $files; do |
| 3332 | case $file in |
| 3333 | *.lo) ;; |
| 3334 | *) |
| 3335 | func_fatal_help "\`$destdir' must be an absolute directory name" |
| 3336 | ;; |
| 3337 | esac |
| 3338 | done |
| 3339 | ;; |
| 3340 | esac |
| 3341 | |
| 3342 | # This variable tells wrapper scripts just to set variables rather |
| 3343 | # than running their programs. |
| 3344 | libtool_install_magic="$magic" |
| 3345 | |
| 3346 | staticlibs= |
| 3347 | future_libdirs= |
| 3348 | current_libdirs= |
| 3349 | for file in $files; do |
| 3350 | |
| 3351 | # Do each installation. |
| 3352 | case $file in |
| 3353 | *.$libext) |
| 3354 | # Do the static libraries later. |
| 3355 | staticlibs+=" $file" |
| 3356 | ;; |
| 3357 | |
| 3358 | *.la) |
| 3359 | func_resolve_sysroot "$file" |
| 3360 | file=$func_resolve_sysroot_result |
| 3361 | |
| 3362 | # Check to see that this really is a libtool archive. |
| 3363 | func_lalib_unsafe_p "$file" \ |
| 3364 | || func_fatal_help "\`$file' is not a valid libtool archive" |
| 3365 | |
| 3366 | library_names= |
| 3367 | old_library= |
| 3368 | relink_command= |
| 3369 | func_source "$file" |
| 3370 | |
| 3371 | # Add the libdir to current_libdirs if it is the destination. |
| 3372 | if test "X$destdir" = "X$libdir"; then |
| 3373 | case "$current_libdirs " in |
| 3374 | *" $libdir "*) ;; |
| 3375 | *) current_libdirs+=" $libdir" ;; |
| 3376 | esac |
| 3377 | else |
| 3378 | # Note the libdir as a future libdir. |
| 3379 | case "$future_libdirs " in |
| 3380 | *" $libdir "*) ;; |
| 3381 | *) future_libdirs+=" $libdir" ;; |
| 3382 | esac |
| 3383 | fi |
| 3384 | |
| 3385 | func_dirname "$file" "/" "" |
| 3386 | dir="$func_dirname_result" |
| 3387 | dir+="$objdir" |
| 3388 | |
| 3389 | if test -n "$relink_command"; then |
| 3390 | # Determine the prefix the user has applied to our future dir. |
| 3391 | inst_prefix_dir=`$ECHO "$destdir" | $SED -e "s%$libdir\$%%"` |
| 3392 | |
| 3393 | # Don't allow the user to place us outside of our expected |
| 3394 | # location b/c this prevents finding dependent libraries that |
| 3395 | # are installed to the same prefix. |
| 3396 | # At present, this check doesn't affect windows .dll's that |
| 3397 | # are installed into $libdir/../bin (currently, that works fine) |
| 3398 | # but it's something to keep an eye on. |
| 3399 | test "$inst_prefix_dir" = "$destdir" && \ |
| 3400 | func_fatal_error "error: cannot install \`$file' to a directory not ending in $libdir" |
| 3401 | |
| 3402 | if test -n "$inst_prefix_dir"; then |
| 3403 | # Stick the inst_prefix_dir data into the link command. |
| 3404 | relink_command=`$ECHO "$relink_command" | $SED "s%@inst_prefix_dir@%-inst-prefix-dir $inst_prefix_dir%"` |
| 3405 | else |
| 3406 | relink_command=`$ECHO "$relink_command" | $SED "s%@inst_prefix_dir@%%"` |
| 3407 | fi |
| 3408 | |
| 3409 | func_warning "relinking \`$file'" |
| 3410 | func_show_eval "$relink_command" \ |
| 3411 | 'func_fatal_error "error: relink \`$file'\'' with the above command before installing it"' |
| 3412 | fi |
| 3413 | |
| 3414 | # See the names of the shared library. |
| 3415 | set dummy $library_names; shift |
| 3416 | if test -n "$1"; then |
| 3417 | realname="$1" |
| 3418 | shift |
| 3419 | |
| 3420 | srcname="$realname" |
| 3421 | test -n "$relink_command" && srcname="$realname"T |
| 3422 | |
| 3423 | # Install the shared library and build the symlinks. |
| 3424 | func_show_eval "$install_shared_prog $dir/$srcname $destdir/$realname" \ |
| 3425 | 'exit $?' |
| 3426 | tstripme="$stripme" |
| 3427 | case $host_os in |
| 3428 | cygwin* | mingw* | pw32* | cegcc*) |
| 3429 | case $realname in |
| 3430 | *.dll.a) |
| 3431 | tstripme="" |
| 3432 | ;; |
| 3433 | esac |
| 3434 | ;; |
| 3435 | esac |
| 3436 | if test -n "$tstripme" && test -n "$striplib"; then |
| 3437 | func_show_eval "$striplib $destdir/$realname" 'exit $?' |
| 3438 | fi |
| 3439 | |
| 3440 | if test "$#" -gt 0; then |
| 3441 | # Delete the old symlinks, and create new ones. |
| 3442 | # Try `ln -sf' first, because the `ln' binary might depend on |
| 3443 | # the symlink we replace! Solaris /bin/ln does not understand -f, |
| 3444 | # so we also need to try rm && ln -s. |
| 3445 | for linkname |
| 3446 | do |
| 3447 | test "$linkname" != "$realname" \ |
| 3448 | && func_show_eval "(cd $destdir && { $LN_S -f $realname $linkname || { $RM $linkname && $LN_S $realname $linkname; }; })" |
| 3449 | done |
| 3450 | fi |
| 3451 | |
| 3452 | # Do each command in the postinstall commands. |
| 3453 | lib="$destdir/$realname" |
| 3454 | func_execute_cmds "$postinstall_cmds" 'exit $?' |
| 3455 | fi |
| 3456 | |
| 3457 | # Install the pseudo-library for information purposes. |
| 3458 | func_basename "$file" |
| 3459 | name="$func_basename_result" |
| 3460 | instname="$dir/$name"i |
| 3461 | func_show_eval "$install_prog $instname $destdir/$name" 'exit $?' |
| 3462 | |
| 3463 | # Maybe install the static library, too. |
| 3464 | test -n "$old_library" && staticlibs+=" $dir/$old_library" |
| 3465 | ;; |
| 3466 | |
| 3467 | *.lo) |
| 3468 | # Install (i.e. copy) a libtool object. |
| 3469 | |
| 3470 | # Figure out destination file name, if it wasn't already specified. |
| 3471 | if test -n "$destname"; then |
| 3472 | destfile="$destdir/$destname" |
| 3473 | else |
| 3474 | func_basename "$file" |
| 3475 | destfile="$func_basename_result" |
| 3476 | destfile="$destdir/$destfile" |
| 3477 | fi |
| 3478 | |
| 3479 | # Deduce the name of the destination old-style object file. |
| 3480 | case $destfile in |
| 3481 | *.lo) |
| 3482 | func_lo2o "$destfile" |
| 3483 | staticdest=$func_lo2o_result |
| 3484 | ;; |
| 3485 | *.$objext) |
| 3486 | staticdest="$destfile" |
| 3487 | destfile= |
| 3488 | ;; |
| 3489 | *) |
| 3490 | func_fatal_help "cannot copy a libtool object to \`$destfile'" |
| 3491 | ;; |
| 3492 | esac |
| 3493 | |
| 3494 | # Install the libtool object if requested. |
| 3495 | test -n "$destfile" && \ |
| 3496 | func_show_eval "$install_prog $file $destfile" 'exit $?' |
| 3497 | |
| 3498 | # Install the old object if enabled. |
| 3499 | if test "$build_old_libs" = yes; then |
| 3500 | # Deduce the name of the old-style object file. |
| 3501 | func_lo2o "$file" |
| 3502 | staticobj=$func_lo2o_result |
| 3503 | func_show_eval "$install_prog \$staticobj \$staticdest" 'exit $?' |
| 3504 | fi |
| 3505 | exit $EXIT_SUCCESS |
| 3506 | ;; |
| 3507 | |
| 3508 | *) |
| 3509 | # Figure out destination file name, if it wasn't already specified. |
| 3510 | if test -n "$destname"; then |
| 3511 | destfile="$destdir/$destname" |
| 3512 | else |
| 3513 | func_basename "$file" |
| 3514 | destfile="$func_basename_result" |
| 3515 | destfile="$destdir/$destfile" |
| 3516 | fi |
| 3517 | |
| 3518 | # If the file is missing, and there is a .exe on the end, strip it |
| 3519 | # because it is most likely a libtool script we actually want to |
| 3520 | # install |
| 3521 | stripped_ext="" |
| 3522 | case $file in |
| 3523 | *.exe) |
| 3524 | if test ! -f "$file"; then |
| 3525 | func_stripname '' '.exe' "$file" |
| 3526 | file=$func_stripname_result |
| 3527 | stripped_ext=".exe" |
| 3528 | fi |
| 3529 | ;; |
| 3530 | esac |
| 3531 | |
| 3532 | # Do a test to see if this is really a libtool program. |
| 3533 | case $host in |
| 3534 | *cygwin* | *mingw*) |
| 3535 | if func_ltwrapper_executable_p "$file"; then |
| 3536 | func_ltwrapper_scriptname "$file" |
| 3537 | wrapper=$func_ltwrapper_scriptname_result |
| 3538 | else |
| 3539 | func_stripname '' '.exe' "$file" |
| 3540 | wrapper=$func_stripname_result |
| 3541 | fi |
| 3542 | ;; |
| 3543 | *) |
| 3544 | wrapper=$file |
| 3545 | ;; |
| 3546 | esac |
| 3547 | if func_ltwrapper_script_p "$wrapper"; then |
| 3548 | notinst_deplibs= |
| 3549 | relink_command= |
| 3550 | |
| 3551 | func_source "$wrapper" |
| 3552 | |
| 3553 | # Check the variables that should have been set. |
| 3554 | test -z "$generated_by_libtool_version" && \ |
| 3555 | func_fatal_error "invalid libtool wrapper script \`$wrapper'" |
| 3556 | |
| 3557 | finalize=yes |
| 3558 | for lib in $notinst_deplibs; do |
| 3559 | # Check to see that each library is installed. |
| 3560 | libdir= |
| 3561 | if test -f "$lib"; then |
| 3562 | func_source "$lib" |
| 3563 | fi |
| 3564 | libfile="$libdir/"`$ECHO "$lib" | $SED 's%^.*/%%g'` ### testsuite: skip nested quoting test |
| 3565 | if test -n "$libdir" && test ! -f "$libfile"; then |
| 3566 | func_warning "\`$lib' has not been installed in \`$libdir'" |
| 3567 | finalize=no |
| 3568 | fi |
| 3569 | done |
| 3570 | |
| 3571 | relink_command= |
| 3572 | func_source "$wrapper" |
| 3573 | |
| 3574 | outputname= |
| 3575 | if test "$fast_install" = no && test -n "$relink_command"; then |
| 3576 | $opt_dry_run || { |
| 3577 | if test "$finalize" = yes; then |
| 3578 | tmpdir=`func_mktempdir` |
| 3579 | func_basename "$file$stripped_ext" |
| 3580 | file="$func_basename_result" |
| 3581 | outputname="$tmpdir/$file" |
| 3582 | # Replace the output file specification. |
| 3583 | relink_command=`$ECHO "$relink_command" | $SED 's%@OUTPUT@%'"$outputname"'%g'` |
| 3584 | |
| 3585 | $opt_silent || { |
| 3586 | func_quote_for_expand "$relink_command" |
| 3587 | eval "func_echo $func_quote_for_expand_result" |
| 3588 | } |
| 3589 | if eval "$relink_command"; then : |
| 3590 | else |
| 3591 | func_error "error: relink \`$file' with the above command before installing it" |
| 3592 | $opt_dry_run || ${RM}r "$tmpdir" |
| 3593 | continue |
| 3594 | fi |
| 3595 | file="$outputname" |
| 3596 | else |
| 3597 | func_warning "cannot relink \`$file'" |
| 3598 | fi |
| 3599 | } |
| 3600 | else |
| 3601 | # Install the binary that we compiled earlier. |
| 3602 | file=`$ECHO "$file$stripped_ext" | $SED "s%\([^/]*\)$%$objdir/\1%"` |
| 3603 | fi |
| 3604 | fi |
| 3605 | |
| 3606 | # remove .exe since cygwin /usr/bin/install will append another |
| 3607 | # one anyway |
| 3608 | case $install_prog,$host in |
| 3609 | */usr/bin/install*,*cygwin*) |
| 3610 | case $file:$destfile in |
| 3611 | *.exe:*.exe) |
| 3612 | # this is ok |
| 3613 | ;; |
| 3614 | *.exe:*) |
| 3615 | destfile=$destfile.exe |
| 3616 | ;; |
| 3617 | *:*.exe) |
| 3618 | func_stripname '' '.exe' "$destfile" |
| 3619 | destfile=$func_stripname_result |
| 3620 | ;; |
| 3621 | esac |
| 3622 | ;; |
| 3623 | esac |
| 3624 | func_show_eval "$install_prog\$stripme \$file \$destfile" 'exit $?' |
| 3625 | $opt_dry_run || if test -n "$outputname"; then |
| 3626 | ${RM}r "$tmpdir" |
| 3627 | fi |
| 3628 | ;; |
| 3629 | esac |
| 3630 | done |
| 3631 | |
| 3632 | for file in $staticlibs; do |
| 3633 | func_basename "$file" |
| 3634 | name="$func_basename_result" |
| 3635 | |
| 3636 | # Set up the ranlib parameters. |
| 3637 | oldlib="$destdir/$name" |
| 3638 | func_to_tool_file "$oldlib" func_convert_file_msys_to_w32 |
| 3639 | tool_oldlib=$func_to_tool_file_result |
| 3640 | |
| 3641 | func_show_eval "$install_prog \$file \$oldlib" 'exit $?' |
| 3642 | |
| 3643 | if test -n "$stripme" && test -n "$old_striplib"; then |
| 3644 | func_show_eval "$old_striplib $tool_oldlib" 'exit $?' |
| 3645 | fi |
| 3646 | |
| 3647 | # Do each command in the postinstall commands. |
| 3648 | func_execute_cmds "$old_postinstall_cmds" 'exit $?' |
| 3649 | done |
| 3650 | |
| 3651 | test -n "$future_libdirs" && \ |
| 3652 | func_warning "remember to run \`$progname --finish$future_libdirs'" |
| 3653 | |
| 3654 | if test -n "$current_libdirs"; then |
| 3655 | # Maybe just do a dry run. |
| 3656 | $opt_dry_run && current_libdirs=" -n$current_libdirs" |
| 3657 | exec_cmd='$SHELL $progpath $preserve_args --finish$current_libdirs' |
| 3658 | else |
| 3659 | exit $EXIT_SUCCESS |
| 3660 | fi |
| 3661 | } |
| 3662 | |
| 3663 | test "$opt_mode" = install && func_mode_install ${1+"$@"} |
| 3664 | |
| 3665 | |
| 3666 | # func_generate_dlsyms outputname originator pic_p |
| 3667 | # Extract symbols from dlprefiles and create ${outputname}S.o with |
| 3668 | # a dlpreopen symbol table. |
| 3669 | func_generate_dlsyms () |
| 3670 | { |
| 3671 | $opt_debug |
| 3672 | my_outputname="$1" |
| 3673 | my_originator="$2" |
| 3674 | my_pic_p="${3-no}" |
| 3675 | my_prefix=`$ECHO "$my_originator" | sed 's%[^a-zA-Z0-9]%_%g'` |
| 3676 | my_dlsyms= |
| 3677 | |
| 3678 | if test -n "$dlfiles$dlprefiles" || test "$dlself" != no; then |
| 3679 | if test -n "$NM" && test -n "$global_symbol_pipe"; then |
| 3680 | my_dlsyms="${my_outputname}S.c" |
| 3681 | else |
| 3682 | func_error "not configured to extract global symbols from dlpreopened files" |
| 3683 | fi |
| 3684 | fi |
| 3685 | |
| 3686 | if test -n "$my_dlsyms"; then |
| 3687 | case $my_dlsyms in |
| 3688 | "") ;; |
| 3689 | *.c) |
| 3690 | # Discover the nlist of each of the dlfiles. |
| 3691 | nlist="$output_objdir/${my_outputname}.nm" |
| 3692 | |
| 3693 | func_show_eval "$RM $nlist ${nlist}S ${nlist}T" |
| 3694 | |
| 3695 | # Parse the name list into a source file. |
| 3696 | func_verbose "creating $output_objdir/$my_dlsyms" |
| 3697 | |
| 3698 | $opt_dry_run || $ECHO > "$output_objdir/$my_dlsyms" "\ |
| 3699 | /* $my_dlsyms - symbol resolution table for \`$my_outputname' dlsym emulation. */ |
| 3700 | /* Generated by $PROGRAM (GNU $PACKAGE$TIMESTAMP) $VERSION */ |
| 3701 | |
| 3702 | #ifdef __cplusplus |
| 3703 | extern \"C\" { |
| 3704 | #endif |
| 3705 | |
| 3706 | #if defined(__GNUC__) && (((__GNUC__ == 4) && (__GNUC_MINOR__ >= 4)) || (__GNUC__ > 4)) |
| 3707 | #pragma GCC diagnostic ignored \"-Wstrict-prototypes\" |
| 3708 | #endif |
| 3709 | |
| 3710 | /* Keep this code in sync between libtool.m4, ltmain, lt_system.h, and tests. */ |
| 3711 | #if defined(_WIN32) || defined(__CYGWIN__) || defined(_WIN32_WCE) |
| 3712 | /* DATA imports from DLLs on WIN32 con't be const, because runtime |
| 3713 | relocations are performed -- see ld's documentation on pseudo-relocs. */ |
| 3714 | # define LT_DLSYM_CONST |
| 3715 | #elif defined(__osf__) |
| 3716 | /* This system does not cope well with relocations in const data. */ |
| 3717 | # define LT_DLSYM_CONST |
| 3718 | #else |
| 3719 | # define LT_DLSYM_CONST const |
| 3720 | #endif |
| 3721 | |
| 3722 | /* External symbol declarations for the compiler. */\ |
| 3723 | " |
| 3724 | |
| 3725 | if test "$dlself" = yes; then |
| 3726 | func_verbose "generating symbol list for \`$output'" |
| 3727 | |
| 3728 | $opt_dry_run || echo ': @PROGRAM@ ' > "$nlist" |
| 3729 | |
| 3730 | # Add our own program objects to the symbol list. |
| 3731 | progfiles=`$ECHO "$objs$old_deplibs" | $SP2NL | $SED "$lo2o" | $NL2SP` |
| 3732 | for progfile in $progfiles; do |
| 3733 | func_to_tool_file "$progfile" func_convert_file_msys_to_w32 |
| 3734 | func_verbose "extracting global C symbols from \`$func_to_tool_file_result'" |
| 3735 | $opt_dry_run || eval "$NM $func_to_tool_file_result | $global_symbol_pipe >> '$nlist'" |
| 3736 | done |
| 3737 | |
| 3738 | if test -n "$exclude_expsyms"; then |
| 3739 | $opt_dry_run || { |
| 3740 | eval '$EGREP -v " ($exclude_expsyms)$" "$nlist" > "$nlist"T' |
| 3741 | eval '$MV "$nlist"T "$nlist"' |
| 3742 | } |
| 3743 | fi |
| 3744 | |
| 3745 | if test -n "$export_symbols_regex"; then |
| 3746 | $opt_dry_run || { |
| 3747 | eval '$EGREP -e "$export_symbols_regex" "$nlist" > "$nlist"T' |
| 3748 | eval '$MV "$nlist"T "$nlist"' |
| 3749 | } |
| 3750 | fi |
| 3751 | |
| 3752 | # Prepare the list of exported symbols |
| 3753 | if test -z "$export_symbols"; then |
| 3754 | export_symbols="$output_objdir/$outputname.exp" |
| 3755 | $opt_dry_run || { |
| 3756 | $RM $export_symbols |
| 3757 | eval "${SED} -n -e '/^: @PROGRAM@ $/d' -e 's/^.* \(.*\)$/\1/p' "'< "$nlist" > "$export_symbols"' |
| 3758 | case $host in |
| 3759 | *cygwin* | *mingw* | *cegcc* ) |
| 3760 | eval "echo EXPORTS "'> "$output_objdir/$outputname.def"' |
| 3761 | eval 'cat "$export_symbols" >> "$output_objdir/$outputname.def"' |
| 3762 | ;; |
| 3763 | esac |
| 3764 | } |
| 3765 | else |
| 3766 | $opt_dry_run || { |
| 3767 | eval "${SED} -e 's/\([].[*^$]\)/\\\\\1/g' -e 's/^/ /' -e 's/$/$/'"' < "$export_symbols" > "$output_objdir/$outputname.exp"' |
| 3768 | eval '$GREP -f "$output_objdir/$outputname.exp" < "$nlist" > "$nlist"T' |
| 3769 | eval '$MV "$nlist"T "$nlist"' |
| 3770 | case $host in |
| 3771 | *cygwin* | *mingw* | *cegcc* ) |
| 3772 | eval "echo EXPORTS "'> "$output_objdir/$outputname.def"' |
| 3773 | eval 'cat "$nlist" >> "$output_objdir/$outputname.def"' |
| 3774 | ;; |
| 3775 | esac |
| 3776 | } |
| 3777 | fi |
| 3778 | fi |
| 3779 | |
| 3780 | for dlprefile in $dlprefiles; do |
| 3781 | func_verbose "extracting global C symbols from \`$dlprefile'" |
| 3782 | func_basename "$dlprefile" |
| 3783 | name="$func_basename_result" |
| 3784 | case $host in |
| 3785 | *cygwin* | *mingw* | *cegcc* ) |
| 3786 | # if an import library, we need to obtain dlname |
| 3787 | if func_win32_import_lib_p "$dlprefile"; then |
| 3788 | func_tr_sh "$dlprefile" |
| 3789 | eval "curr_lafile=\$libfile_$func_tr_sh_result" |
| 3790 | dlprefile_dlbasename="" |
| 3791 | if test -n "$curr_lafile" && func_lalib_p "$curr_lafile"; then |
| 3792 | # Use subshell, to avoid clobbering current variable values |
| 3793 | dlprefile_dlname=`source "$curr_lafile" && echo "$dlname"` |
| 3794 | if test -n "$dlprefile_dlname" ; then |
| 3795 | func_basename "$dlprefile_dlname" |
| 3796 | dlprefile_dlbasename="$func_basename_result" |
| 3797 | else |
| 3798 | # no lafile. user explicitly requested -dlpreopen <import library>. |
| 3799 | $sharedlib_from_linklib_cmd "$dlprefile" |
| 3800 | dlprefile_dlbasename=$sharedlib_from_linklib_result |
| 3801 | fi |
| 3802 | fi |
| 3803 | $opt_dry_run || { |
| 3804 | if test -n "$dlprefile_dlbasename" ; then |
| 3805 | eval '$ECHO ": $dlprefile_dlbasename" >> "$nlist"' |
| 3806 | else |
| 3807 | func_warning "Could not compute DLL name from $name" |
| 3808 | eval '$ECHO ": $name " >> "$nlist"' |
| 3809 | fi |
| 3810 | func_to_tool_file "$dlprefile" func_convert_file_msys_to_w32 |
| 3811 | eval "$NM \"$func_to_tool_file_result\" 2>/dev/null | $global_symbol_pipe | |
| 3812 | $SED -e '/I __imp/d' -e 's/I __nm_/D /;s/_nm__//' >> '$nlist'" |
| 3813 | } |
| 3814 | else # not an import lib |
| 3815 | $opt_dry_run || { |
| 3816 | eval '$ECHO ": $name " >> "$nlist"' |
| 3817 | func_to_tool_file "$dlprefile" func_convert_file_msys_to_w32 |
| 3818 | eval "$NM \"$func_to_tool_file_result\" 2>/dev/null | $global_symbol_pipe >> '$nlist'" |
| 3819 | } |
| 3820 | fi |
| 3821 | ;; |
| 3822 | *) |
| 3823 | $opt_dry_run || { |
| 3824 | eval '$ECHO ": $name " >> "$nlist"' |
| 3825 | func_to_tool_file "$dlprefile" func_convert_file_msys_to_w32 |
| 3826 | eval "$NM \"$func_to_tool_file_result\" 2>/dev/null | $global_symbol_pipe >> '$nlist'" |
| 3827 | } |
| 3828 | ;; |
| 3829 | esac |
| 3830 | done |
| 3831 | |
| 3832 | $opt_dry_run || { |
| 3833 | # Make sure we have at least an empty file. |
| 3834 | test -f "$nlist" || : > "$nlist" |
| 3835 | |
| 3836 | if test -n "$exclude_expsyms"; then |
| 3837 | $EGREP -v " ($exclude_expsyms)$" "$nlist" > "$nlist"T |
| 3838 | $MV "$nlist"T "$nlist" |
| 3839 | fi |
| 3840 | |
| 3841 | # Try sorting and uniquifying the output. |
| 3842 | if $GREP -v "^: " < "$nlist" | |
| 3843 | if sort -k 3 </dev/null >/dev/null 2>&1; then |
| 3844 | sort -k 3 |
| 3845 | else |
| 3846 | sort +2 |
| 3847 | fi | |
| 3848 | uniq > "$nlist"S; then |
| 3849 | : |
| 3850 | else |
| 3851 | $GREP -v "^: " < "$nlist" > "$nlist"S |
| 3852 | fi |
| 3853 | |
| 3854 | if test -f "$nlist"S; then |
| 3855 | eval "$global_symbol_to_cdecl"' < "$nlist"S >> "$output_objdir/$my_dlsyms"' |
| 3856 | else |
| 3857 | echo '/* NONE */' >> "$output_objdir/$my_dlsyms" |
| 3858 | fi |
| 3859 | |
| 3860 | echo >> "$output_objdir/$my_dlsyms" "\ |
| 3861 | |
| 3862 | /* The mapping between symbol names and symbols. */ |
| 3863 | typedef struct { |
| 3864 | const char *name; |
| 3865 | void *address; |
| 3866 | } lt_dlsymlist; |
| 3867 | extern LT_DLSYM_CONST lt_dlsymlist |
| 3868 | lt_${my_prefix}_LTX_preloaded_symbols[]; |
| 3869 | LT_DLSYM_CONST lt_dlsymlist |
| 3870 | lt_${my_prefix}_LTX_preloaded_symbols[] = |
| 3871 | {\ |
| 3872 | { \"$my_originator\", (void *) 0 }," |
| 3873 | |
| 3874 | case $need_lib_prefix in |
| 3875 | no) |
| 3876 | eval "$global_symbol_to_c_name_address" < "$nlist" >> "$output_objdir/$my_dlsyms" |
| 3877 | ;; |
| 3878 | *) |
| 3879 | eval "$global_symbol_to_c_name_address_lib_prefix" < "$nlist" >> "$output_objdir/$my_dlsyms" |
| 3880 | ;; |
| 3881 | esac |
| 3882 | echo >> "$output_objdir/$my_dlsyms" "\ |
| 3883 | {0, (void *) 0} |
| 3884 | }; |
| 3885 | |
| 3886 | /* This works around a problem in FreeBSD linker */ |
| 3887 | #ifdef FREEBSD_WORKAROUND |
| 3888 | static const void *lt_preloaded_setup() { |
| 3889 | return lt_${my_prefix}_LTX_preloaded_symbols; |
| 3890 | } |
| 3891 | #endif |
| 3892 | |
| 3893 | #ifdef __cplusplus |
| 3894 | } |
| 3895 | #endif\ |
| 3896 | " |
| 3897 | } # !$opt_dry_run |
| 3898 | |
| 3899 | pic_flag_for_symtable= |
| 3900 | case "$compile_command " in |
| 3901 | *" -static "*) ;; |
| 3902 | *) |
| 3903 | case $host in |
| 3904 | # compiling the symbol table file with pic_flag works around |
| 3905 | # a FreeBSD bug that causes programs to crash when -lm is |
| 3906 | # linked before any other PIC object. But we must not use |
| 3907 | # pic_flag when linking with -static. The problem exists in |
| 3908 | # FreeBSD 2.2.6 and is fixed in FreeBSD 3.1. |
| 3909 | *-*-freebsd2.*|*-*-freebsd3.0*|*-*-freebsdelf3.0*) |
| 3910 | pic_flag_for_symtable=" $pic_flag -DFREEBSD_WORKAROUND" ;; |
| 3911 | *-*-hpux*) |
| 3912 | pic_flag_for_symtable=" $pic_flag" ;; |
| 3913 | *) |
| 3914 | if test "X$my_pic_p" != Xno; then |
| 3915 | pic_flag_for_symtable=" $pic_flag" |
| 3916 | fi |
| 3917 | ;; |
| 3918 | esac |
| 3919 | ;; |
| 3920 | esac |
| 3921 | symtab_cflags= |
| 3922 | for arg in $LTCFLAGS; do |
| 3923 | case $arg in |
| 3924 | -pie | -fpie | -fPIE) ;; |
| 3925 | *) symtab_cflags+=" $arg" ;; |
| 3926 | esac |
| 3927 | done |
| 3928 | |
| 3929 | # Now compile the dynamic symbol file. |
| 3930 | func_show_eval '(cd $output_objdir && $LTCC$symtab_cflags -c$no_builtin_flag$pic_flag_for_symtable "$my_dlsyms")' 'exit $?' |
| 3931 | |
| 3932 | # Clean up the generated files. |
| 3933 | func_show_eval '$RM "$output_objdir/$my_dlsyms" "$nlist" "${nlist}S" "${nlist}T"' |
| 3934 | |
| 3935 | # Transform the symbol file into the correct name. |
| 3936 | symfileobj="$output_objdir/${my_outputname}S.$objext" |
| 3937 | case $host in |
| 3938 | *cygwin* | *mingw* | *cegcc* ) |
| 3939 | if test -f "$output_objdir/$my_outputname.def"; then |
| 3940 | compile_command=`$ECHO "$compile_command" | $SED "s%@SYMFILE@%$output_objdir/$my_outputname.def $symfileobj%"` |
| 3941 | finalize_command=`$ECHO "$finalize_command" | $SED "s%@SYMFILE@%$output_objdir/$my_outputname.def $symfileobj%"` |
| 3942 | else |
| 3943 | compile_command=`$ECHO "$compile_command" | $SED "s%@SYMFILE@%$symfileobj%"` |
| 3944 | finalize_command=`$ECHO "$finalize_command" | $SED "s%@SYMFILE@%$symfileobj%"` |
| 3945 | fi |
| 3946 | ;; |
| 3947 | *) |
| 3948 | compile_command=`$ECHO "$compile_command" | $SED "s%@SYMFILE@%$symfileobj%"` |
| 3949 | finalize_command=`$ECHO "$finalize_command" | $SED "s%@SYMFILE@%$symfileobj%"` |
| 3950 | ;; |
| 3951 | esac |
| 3952 | ;; |
| 3953 | *) |
| 3954 | func_fatal_error "unknown suffix for \`$my_dlsyms'" |
| 3955 | ;; |
| 3956 | esac |
| 3957 | else |
| 3958 | # We keep going just in case the user didn't refer to |
| 3959 | # lt_preloaded_symbols. The linker will fail if global_symbol_pipe |
| 3960 | # really was required. |
| 3961 | |
| 3962 | # Nullify the symbol file. |
| 3963 | compile_command=`$ECHO "$compile_command" | $SED "s% @SYMFILE@%%"` |
| 3964 | finalize_command=`$ECHO "$finalize_command" | $SED "s% @SYMFILE@%%"` |
| 3965 | fi |
| 3966 | } |
| 3967 | |
| 3968 | # func_win32_libid arg |
| 3969 | # return the library type of file 'arg' |
| 3970 | # |
| 3971 | # Need a lot of goo to handle *both* DLLs and import libs |
| 3972 | # Has to be a shell function in order to 'eat' the argument |
| 3973 | # that is supplied when $file_magic_command is called. |
| 3974 | # Despite the name, also deal with 64 bit binaries. |
| 3975 | func_win32_libid () |
| 3976 | { |
| 3977 | $opt_debug |
| 3978 | win32_libid_type="unknown" |
| 3979 | win32_fileres=`file -L $1 2>/dev/null` |
| 3980 | case $win32_fileres in |
| 3981 | *ar\ archive\ import\ library*) # definitely import |
| 3982 | win32_libid_type="x86 archive import" |
| 3983 | ;; |
| 3984 | *ar\ archive*) # could be an import, or static |
| 3985 | # Keep the egrep pattern in sync with the one in _LT_CHECK_MAGIC_METHOD. |
| 3986 | if eval $OBJDUMP -f $1 | $SED -e '10q' 2>/dev/null | |
| 3987 | $EGREP 'file format (pei*-i386(.*architecture: i386)?|pe-arm-wince|pe-x86-64)' >/dev/null; then |
| 3988 | func_to_tool_file "$1" func_convert_file_msys_to_w32 |
| 3989 | win32_nmres=`eval $NM -f posix -A \"$func_to_tool_file_result\" | |
| 3990 | $SED -n -e ' |
| 3991 | 1,100{ |
| 3992 | / I /{ |
| 3993 | s,.*,import, |
| 3994 | p |
| 3995 | q |
| 3996 | } |
| 3997 | }'` |
| 3998 | case $win32_nmres in |
| 3999 | import*) win32_libid_type="x86 archive import";; |
| 4000 | *) win32_libid_type="x86 archive static";; |
| 4001 | esac |
| 4002 | fi |
| 4003 | ;; |
| 4004 | *DLL*) |
| 4005 | win32_libid_type="x86 DLL" |
| 4006 | ;; |
| 4007 | *executable*) # but shell scripts are "executable" too... |
| 4008 | case $win32_fileres in |
| 4009 | *MS\ Windows\ PE\ Intel*) |
| 4010 | win32_libid_type="x86 DLL" |
| 4011 | ;; |
| 4012 | esac |
| 4013 | ;; |
| 4014 | esac |
| 4015 | $ECHO "$win32_libid_type" |
| 4016 | } |
| 4017 | |
| 4018 | # func_cygming_dll_for_implib ARG |
| 4019 | # |
| 4020 | # Platform-specific function to extract the |
| 4021 | # name of the DLL associated with the specified |
| 4022 | # import library ARG. |
| 4023 | # Invoked by eval'ing the libtool variable |
| 4024 | # $sharedlib_from_linklib_cmd |
| 4025 | # Result is available in the variable |
| 4026 | # $sharedlib_from_linklib_result |
| 4027 | func_cygming_dll_for_implib () |
| 4028 | { |
| 4029 | $opt_debug |
| 4030 | sharedlib_from_linklib_result=`$DLLTOOL --identify-strict --identify "$1"` |
| 4031 | } |
| 4032 | |
| 4033 | # func_cygming_dll_for_implib_fallback_core SECTION_NAME LIBNAMEs |
| 4034 | # |
| 4035 | # The is the core of a fallback implementation of a |
| 4036 | # platform-specific function to extract the name of the |
| 4037 | # DLL associated with the specified import library LIBNAME. |
| 4038 | # |
| 4039 | # SECTION_NAME is either .idata$6 or .idata$7, depending |
| 4040 | # on the platform and compiler that created the implib. |
| 4041 | # |
| 4042 | # Echos the name of the DLL associated with the |
| 4043 | # specified import library. |
| 4044 | func_cygming_dll_for_implib_fallback_core () |
| 4045 | { |
| 4046 | $opt_debug |
| 4047 | match_literal=`$ECHO "$1" | $SED "$sed_make_literal_regex"` |
| 4048 | $OBJDUMP -s --section "$1" "$2" 2>/dev/null | |
| 4049 | $SED '/^Contents of section '"$match_literal"':/{ |
| 4050 | # Place marker at beginning of archive member dllname section |
| 4051 | s/.*/====MARK====/ |
| 4052 | p |
| 4053 | d |
| 4054 | } |
| 4055 | # These lines can sometimes be longer than 43 characters, but |
| 4056 | # are always uninteresting |
| 4057 | /:[ ]*file format pe[i]\{,1\}-/d |
| 4058 | /^In archive [^:]*:/d |
| 4059 | # Ensure marker is printed |
| 4060 | /^====MARK====/p |
| 4061 | # Remove all lines with less than 43 characters |
| 4062 | /^.\{43\}/!d |
| 4063 | # From remaining lines, remove first 43 characters |
| 4064 | s/^.\{43\}//' | |
| 4065 | $SED -n ' |
| 4066 | # Join marker and all lines until next marker into a single line |
| 4067 | /^====MARK====/ b para |
| 4068 | H |
| 4069 | $ b para |
| 4070 | b |
| 4071 | :para |
| 4072 | x |
| 4073 | s/\n//g |
| 4074 | # Remove the marker |
| 4075 | s/^====MARK====// |
| 4076 | # Remove trailing dots and whitespace |
| 4077 | s/[\. \t]*$// |
| 4078 | # Print |
| 4079 | /./p' | |
| 4080 | # we now have a list, one entry per line, of the stringified |
| 4081 | # contents of the appropriate section of all members of the |
| 4082 | # archive which possess that section. Heuristic: eliminate |
| 4083 | # all those which have a first or second character that is |
| 4084 | # a '.' (that is, objdump's representation of an unprintable |
| 4085 | # character.) This should work for all archives with less than |
| 4086 | # 0x302f exports -- but will fail for DLLs whose name actually |
| 4087 | # begins with a literal '.' or a single character followed by |
| 4088 | # a '.'. |
| 4089 | # |
| 4090 | # Of those that remain, print the first one. |
| 4091 | $SED -e '/^\./d;/^.\./d;q' |
| 4092 | } |
| 4093 | |
| 4094 | # func_cygming_gnu_implib_p ARG |
| 4095 | # This predicate returns with zero status (TRUE) if |
| 4096 | # ARG is a GNU/binutils-style import library. Returns |
| 4097 | # with nonzero status (FALSE) otherwise. |
| 4098 | func_cygming_gnu_implib_p () |
| 4099 | { |
| 4100 | $opt_debug |
| 4101 | func_to_tool_file "$1" func_convert_file_msys_to_w32 |
| 4102 | func_cygming_gnu_implib_tmp=`$NM "$func_to_tool_file_result" | eval "$global_symbol_pipe" | $EGREP ' (_head_[A-Za-z0-9_]+_[ad]l*|[A-Za-z0-9_]+_[ad]l*_iname)$'` |
| 4103 | test -n "$func_cygming_gnu_implib_tmp" |
| 4104 | } |
| 4105 | |
| 4106 | # func_cygming_ms_implib_p ARG |
| 4107 | # This predicate returns with zero status (TRUE) if |
| 4108 | # ARG is an MS-style import library. Returns |
| 4109 | # with nonzero status (FALSE) otherwise. |
| 4110 | func_cygming_ms_implib_p () |
| 4111 | { |
| 4112 | $opt_debug |
| 4113 | func_to_tool_file "$1" func_convert_file_msys_to_w32 |
| 4114 | func_cygming_ms_implib_tmp=`$NM "$func_to_tool_file_result" | eval "$global_symbol_pipe" | $GREP '_NULL_IMPORT_DESCRIPTOR'` |
| 4115 | test -n "$func_cygming_ms_implib_tmp" |
| 4116 | } |
| 4117 | |
| 4118 | # func_cygming_dll_for_implib_fallback ARG |
| 4119 | # Platform-specific function to extract the |
| 4120 | # name of the DLL associated with the specified |
| 4121 | # import library ARG. |
| 4122 | # |
| 4123 | # This fallback implementation is for use when $DLLTOOL |
| 4124 | # does not support the --identify-strict option. |
| 4125 | # Invoked by eval'ing the libtool variable |
| 4126 | # $sharedlib_from_linklib_cmd |
| 4127 | # Result is available in the variable |
| 4128 | # $sharedlib_from_linklib_result |
| 4129 | func_cygming_dll_for_implib_fallback () |
| 4130 | { |
| 4131 | $opt_debug |
| 4132 | if func_cygming_gnu_implib_p "$1" ; then |
| 4133 | # binutils import library |
| 4134 | sharedlib_from_linklib_result=`func_cygming_dll_for_implib_fallback_core '.idata$7' "$1"` |
| 4135 | elif func_cygming_ms_implib_p "$1" ; then |
| 4136 | # ms-generated import library |
| 4137 | sharedlib_from_linklib_result=`func_cygming_dll_for_implib_fallback_core '.idata$6' "$1"` |
| 4138 | else |
| 4139 | # unknown |
| 4140 | sharedlib_from_linklib_result="" |
| 4141 | fi |
| 4142 | } |
| 4143 | |
| 4144 | |
| 4145 | # func_extract_an_archive dir oldlib |
| 4146 | func_extract_an_archive () |
| 4147 | { |
| 4148 | $opt_debug |
| 4149 | f_ex_an_ar_dir="$1"; shift |
| 4150 | f_ex_an_ar_oldlib="$1" |
| 4151 | if test "$lock_old_archive_extraction" = yes; then |
| 4152 | lockfile=$f_ex_an_ar_oldlib.lock |
| 4153 | until $opt_dry_run || ln "$progpath" "$lockfile" 2>/dev/null; do |
| 4154 | func_echo "Waiting for $lockfile to be removed" |
| 4155 | sleep 2 |
| 4156 | done |
| 4157 | fi |
| 4158 | func_show_eval "(cd \$f_ex_an_ar_dir && $AR x \"\$f_ex_an_ar_oldlib\")" \ |
| 4159 | 'stat=$?; rm -f "$lockfile"; exit $stat' |
| 4160 | if test "$lock_old_archive_extraction" = yes; then |
| 4161 | $opt_dry_run || rm -f "$lockfile" |
| 4162 | fi |
| 4163 | if ($AR t "$f_ex_an_ar_oldlib" | sort | sort -uc >/dev/null 2>&1); then |
| 4164 | : |
| 4165 | else |
| 4166 | func_fatal_error "object name conflicts in archive: $f_ex_an_ar_dir/$f_ex_an_ar_oldlib" |
| 4167 | fi |
| 4168 | } |
| 4169 | |
| 4170 | |
| 4171 | # func_extract_archives gentop oldlib ... |
| 4172 | func_extract_archives () |
| 4173 | { |
| 4174 | $opt_debug |
| 4175 | my_gentop="$1"; shift |
| 4176 | my_oldlibs=${1+"$@"} |
| 4177 | my_oldobjs="" |
| 4178 | my_xlib="" |
| 4179 | my_xabs="" |
| 4180 | my_xdir="" |
| 4181 | |
| 4182 | for my_xlib in $my_oldlibs; do |
| 4183 | # Extract the objects. |
| 4184 | case $my_xlib in |
| 4185 | [\\/]* | [A-Za-z]:[\\/]*) my_xabs="$my_xlib" ;; |
| 4186 | *) my_xabs=`pwd`"/$my_xlib" ;; |
| 4187 | esac |
| 4188 | func_basename "$my_xlib" |
| 4189 | my_xlib="$func_basename_result" |
| 4190 | my_xlib_u=$my_xlib |
| 4191 | while :; do |
| 4192 | case " $extracted_archives " in |
| 4193 | *" $my_xlib_u "*) |
| 4194 | func_arith $extracted_serial + 1 |
| 4195 | extracted_serial=$func_arith_result |
| 4196 | my_xlib_u=lt$extracted_serial-$my_xlib ;; |
| 4197 | *) break ;; |
| 4198 | esac |
| 4199 | done |
| 4200 | extracted_archives="$extracted_archives $my_xlib_u" |
| 4201 | my_xdir="$my_gentop/$my_xlib_u" |
| 4202 | |
| 4203 | func_mkdir_p "$my_xdir" |
| 4204 | |
| 4205 | case $host in |
| 4206 | *-darwin*) |
| 4207 | func_verbose "Extracting $my_xabs" |
| 4208 | # Do not bother doing anything if just a dry run |
| 4209 | $opt_dry_run || { |
| 4210 | darwin_orig_dir=`pwd` |
| 4211 | cd $my_xdir || exit $? |
| 4212 | darwin_archive=$my_xabs |
| 4213 | darwin_curdir=`pwd` |
| 4214 | darwin_base_archive=`basename "$darwin_archive"` |
| 4215 | darwin_arches=`$LIPO -info "$darwin_archive" 2>/dev/null | $GREP Architectures 2>/dev/null || true` |
| 4216 | if test -n "$darwin_arches"; then |
| 4217 | darwin_arches=`$ECHO "$darwin_arches" | $SED -e 's/.*are://'` |
| 4218 | darwin_arch= |
| 4219 | func_verbose "$darwin_base_archive has multiple architectures $darwin_arches" |
| 4220 | for darwin_arch in $darwin_arches ; do |
| 4221 | func_mkdir_p "unfat-$$/${darwin_base_archive}-${darwin_arch}" |
| 4222 | $LIPO -thin $darwin_arch -output "unfat-$$/${darwin_base_archive}-${darwin_arch}/${darwin_base_archive}" "${darwin_archive}" |
| 4223 | cd "unfat-$$/${darwin_base_archive}-${darwin_arch}" |
| 4224 | func_extract_an_archive "`pwd`" "${darwin_base_archive}" |
| 4225 | cd "$darwin_curdir" |
| 4226 | $RM "unfat-$$/${darwin_base_archive}-${darwin_arch}/${darwin_base_archive}" |
| 4227 | done # $darwin_arches |
| 4228 | ## Okay now we've a bunch of thin objects, gotta fatten them up :) |
| 4229 | darwin_filelist=`find unfat-$$ -type f -name \*.o -print -o -name \*.lo -print | $SED -e "$basename" | sort -u` |
| 4230 | darwin_file= |
| 4231 | darwin_files= |
| 4232 | for darwin_file in $darwin_filelist; do |
| 4233 | darwin_files=`find unfat-$$ -name $darwin_file -print | sort | $NL2SP` |
| 4234 | $LIPO -create -output "$darwin_file" $darwin_files |
| 4235 | done # $darwin_filelist |
| 4236 | $RM -rf unfat-$$ |
| 4237 | cd "$darwin_orig_dir" |
| 4238 | else |
| 4239 | cd $darwin_orig_dir |
| 4240 | func_extract_an_archive "$my_xdir" "$my_xabs" |
| 4241 | fi # $darwin_arches |
| 4242 | } # !$opt_dry_run |
| 4243 | ;; |
| 4244 | *) |
| 4245 | func_extract_an_archive "$my_xdir" "$my_xabs" |
| 4246 | ;; |
| 4247 | esac |
| 4248 | my_oldobjs="$my_oldobjs "`find $my_xdir -name \*.$objext -print -o -name \*.lo -print | sort | $NL2SP` |
| 4249 | done |
| 4250 | |
| 4251 | func_extract_archives_result="$my_oldobjs" |
| 4252 | } |
| 4253 | |
| 4254 | |
| 4255 | # func_emit_wrapper [arg=no] |
| 4256 | # |
| 4257 | # Emit a libtool wrapper script on stdout. |
| 4258 | # Don't directly open a file because we may want to |
| 4259 | # incorporate the script contents within a cygwin/mingw |
| 4260 | # wrapper executable. Must ONLY be called from within |
| 4261 | # func_mode_link because it depends on a number of variables |
| 4262 | # set therein. |
| 4263 | # |
| 4264 | # ARG is the value that the WRAPPER_SCRIPT_BELONGS_IN_OBJDIR |
| 4265 | # variable will take. If 'yes', then the emitted script |
| 4266 | # will assume that the directory in which it is stored is |
| 4267 | # the $objdir directory. This is a cygwin/mingw-specific |
| 4268 | # behavior. |
| 4269 | func_emit_wrapper () |
| 4270 | { |
| 4271 | func_emit_wrapper_arg1=${1-no} |
| 4272 | |
| 4273 | $ECHO "\ |
| 4274 | #! $SHELL |
| 4275 | |
| 4276 | # $output - temporary wrapper script for $objdir/$outputname |
| 4277 | # Generated by $PROGRAM (GNU $PACKAGE$TIMESTAMP) $VERSION |
| 4278 | # |
| 4279 | # The $output program cannot be directly executed until all the libtool |
| 4280 | # libraries that it depends on are installed. |
| 4281 | # |
| 4282 | # This wrapper script should never be moved out of the build directory. |
| 4283 | # If it is, it will not operate correctly. |
| 4284 | |
| 4285 | # Sed substitution that helps us do robust quoting. It backslashifies |
| 4286 | # metacharacters that are still active within double-quoted strings. |
| 4287 | sed_quote_subst='$sed_quote_subst' |
| 4288 | |
| 4289 | # Be Bourne compatible |
| 4290 | if test -n \"\${ZSH_VERSION+set}\" && (emulate sh) >/dev/null 2>&1; then |
| 4291 | emulate sh |
| 4292 | NULLCMD=: |
| 4293 | # Zsh 3.x and 4.x performs word splitting on \${1+\"\$@\"}, which |
| 4294 | # is contrary to our usage. Disable this feature. |
| 4295 | alias -g '\${1+\"\$@\"}'='\"\$@\"' |
| 4296 | setopt NO_GLOB_SUBST |
| 4297 | else |
| 4298 | case \`(set -o) 2>/dev/null\` in *posix*) set -o posix;; esac |
| 4299 | fi |
| 4300 | BIN_SH=xpg4; export BIN_SH # for Tru64 |
| 4301 | DUALCASE=1; export DUALCASE # for MKS sh |
| 4302 | |
| 4303 | # The HP-UX ksh and POSIX shell print the target directory to stdout |
| 4304 | # if CDPATH is set. |
| 4305 | (unset CDPATH) >/dev/null 2>&1 && unset CDPATH |
| 4306 | |
| 4307 | relink_command=\"$relink_command\" |
| 4308 | |
| 4309 | # This environment variable determines our operation mode. |
| 4310 | if test \"\$libtool_install_magic\" = \"$magic\"; then |
| 4311 | # install mode needs the following variables: |
| 4312 | generated_by_libtool_version='$macro_version' |
| 4313 | notinst_deplibs='$notinst_deplibs' |
| 4314 | else |
| 4315 | # When we are sourced in execute mode, \$file and \$ECHO are already set. |
| 4316 | if test \"\$libtool_execute_magic\" != \"$magic\"; then |
| 4317 | file=\"\$0\"" |
| 4318 | |
| 4319 | qECHO=`$ECHO "$ECHO" | $SED "$sed_quote_subst"` |
| 4320 | $ECHO "\ |
| 4321 | |
| 4322 | # A function that is used when there is no print builtin or printf. |
| 4323 | func_fallback_echo () |
| 4324 | { |
| 4325 | eval 'cat <<_LTECHO_EOF |
| 4326 | \$1 |
| 4327 | _LTECHO_EOF' |
| 4328 | } |
| 4329 | ECHO=\"$qECHO\" |
| 4330 | fi |
| 4331 | |
| 4332 | # Very basic option parsing. These options are (a) specific to |
| 4333 | # the libtool wrapper, (b) are identical between the wrapper |
| 4334 | # /script/ and the wrapper /executable/ which is used only on |
| 4335 | # windows platforms, and (c) all begin with the string "--lt-" |
| 4336 | # (application programs are unlikely to have options which match |
| 4337 | # this pattern). |
| 4338 | # |
| 4339 | # There are only two supported options: --lt-debug and |
| 4340 | # --lt-dump-script. There is, deliberately, no --lt-help. |
| 4341 | # |
| 4342 | # The first argument to this parsing function should be the |
| 4343 | # script's $0 value, followed by "$@". |
| 4344 | lt_option_debug= |
| 4345 | func_parse_lt_options () |
| 4346 | { |
| 4347 | lt_script_arg0=\$0 |
| 4348 | shift |
| 4349 | for lt_opt |
| 4350 | do |
| 4351 | case \"\$lt_opt\" in |
| 4352 | --lt-debug) lt_option_debug=1 ;; |
| 4353 | --lt-dump-script) |
| 4354 | lt_dump_D=\`\$ECHO \"X\$lt_script_arg0\" | $SED -e 's/^X//' -e 's%/[^/]*$%%'\` |
| 4355 | test \"X\$lt_dump_D\" = \"X\$lt_script_arg0\" && lt_dump_D=. |
| 4356 | lt_dump_F=\`\$ECHO \"X\$lt_script_arg0\" | $SED -e 's/^X//' -e 's%^.*/%%'\` |
| 4357 | cat \"\$lt_dump_D/\$lt_dump_F\" |
| 4358 | exit 0 |
| 4359 | ;; |
| 4360 | --lt-*) |
| 4361 | \$ECHO \"Unrecognized --lt- option: '\$lt_opt'\" 1>&2 |
| 4362 | exit 1 |
| 4363 | ;; |
| 4364 | esac |
| 4365 | done |
| 4366 | |
| 4367 | # Print the debug banner immediately: |
| 4368 | if test -n \"\$lt_option_debug\"; then |
| 4369 | echo \"${outputname}:${output}:\${LINENO}: libtool wrapper (GNU $PACKAGE$TIMESTAMP) $VERSION\" 1>&2 |
| 4370 | fi |
| 4371 | } |
| 4372 | |
| 4373 | # Used when --lt-debug. Prints its arguments to stdout |
| 4374 | # (redirection is the responsibility of the caller) |
| 4375 | func_lt_dump_args () |
| 4376 | { |
| 4377 | lt_dump_args_N=1; |
| 4378 | for lt_arg |
| 4379 | do |
| 4380 | \$ECHO \"${outputname}:${output}:\${LINENO}: newargv[\$lt_dump_args_N]: \$lt_arg\" |
| 4381 | lt_dump_args_N=\`expr \$lt_dump_args_N + 1\` |
| 4382 | done |
| 4383 | } |
| 4384 | |
| 4385 | # Core function for launching the target application |
| 4386 | func_exec_program_core () |
| 4387 | { |
| 4388 | " |
| 4389 | case $host in |
| 4390 | # Backslashes separate directories on plain windows |
| 4391 | *-*-mingw | *-*-os2* | *-cegcc*) |
| 4392 | $ECHO "\ |
| 4393 | if test -n \"\$lt_option_debug\"; then |
| 4394 | \$ECHO \"${outputname}:${output}:\${LINENO}: newargv[0]: \$progdir\\\\\$program\" 1>&2 |
| 4395 | func_lt_dump_args \${1+\"\$@\"} 1>&2 |
| 4396 | fi |
| 4397 | exec \"\$progdir\\\\\$program\" \${1+\"\$@\"} |
| 4398 | " |
| 4399 | ;; |
| 4400 | |
| 4401 | *) |
| 4402 | $ECHO "\ |
| 4403 | if test -n \"\$lt_option_debug\"; then |
| 4404 | \$ECHO \"${outputname}:${output}:\${LINENO}: newargv[0]: \$progdir/\$program\" 1>&2 |
| 4405 | func_lt_dump_args \${1+\"\$@\"} 1>&2 |
| 4406 | fi |
| 4407 | exec \"\$progdir/\$program\" \${1+\"\$@\"} |
| 4408 | " |
| 4409 | ;; |
| 4410 | esac |
| 4411 | $ECHO "\ |
| 4412 | \$ECHO \"\$0: cannot exec \$program \$*\" 1>&2 |
| 4413 | exit 1 |
| 4414 | } |
| 4415 | |
| 4416 | # A function to encapsulate launching the target application |
| 4417 | # Strips options in the --lt-* namespace from \$@ and |
| 4418 | # launches target application with the remaining arguments. |
| 4419 | func_exec_program () |
| 4420 | { |
| 4421 | case \" \$* \" in |
| 4422 | *\\ --lt-*) |
| 4423 | for lt_wr_arg |
| 4424 | do |
| 4425 | case \$lt_wr_arg in |
| 4426 | --lt-*) ;; |
| 4427 | *) set x \"\$@\" \"\$lt_wr_arg\"; shift;; |
| 4428 | esac |
| 4429 | shift |
| 4430 | done ;; |
| 4431 | esac |
| 4432 | func_exec_program_core \${1+\"\$@\"} |
| 4433 | } |
| 4434 | |
| 4435 | # Parse options |
| 4436 | func_parse_lt_options \"\$0\" \${1+\"\$@\"} |
| 4437 | |
| 4438 | # Find the directory that this script lives in. |
| 4439 | thisdir=\`\$ECHO \"\$file\" | $SED 's%/[^/]*$%%'\` |
| 4440 | test \"x\$thisdir\" = \"x\$file\" && thisdir=. |
| 4441 | |
| 4442 | # Follow symbolic links until we get to the real thisdir. |
| 4443 | file=\`ls -ld \"\$file\" | $SED -n 's/.*-> //p'\` |
| 4444 | while test -n \"\$file\"; do |
| 4445 | destdir=\`\$ECHO \"\$file\" | $SED 's%/[^/]*\$%%'\` |
| 4446 | |
| 4447 | # If there was a directory component, then change thisdir. |
| 4448 | if test \"x\$destdir\" != \"x\$file\"; then |
| 4449 | case \"\$destdir\" in |
| 4450 | [\\\\/]* | [A-Za-z]:[\\\\/]*) thisdir=\"\$destdir\" ;; |
| 4451 | *) thisdir=\"\$thisdir/\$destdir\" ;; |
| 4452 | esac |
| 4453 | fi |
| 4454 | |
| 4455 | file=\`\$ECHO \"\$file\" | $SED 's%^.*/%%'\` |
| 4456 | file=\`ls -ld \"\$thisdir/\$file\" | $SED -n 's/.*-> //p'\` |
| 4457 | done |
| 4458 | |
| 4459 | # Usually 'no', except on cygwin/mingw when embedded into |
| 4460 | # the cwrapper. |
| 4461 | WRAPPER_SCRIPT_BELONGS_IN_OBJDIR=$func_emit_wrapper_arg1 |
| 4462 | if test \"\$WRAPPER_SCRIPT_BELONGS_IN_OBJDIR\" = \"yes\"; then |
| 4463 | # special case for '.' |
| 4464 | if test \"\$thisdir\" = \".\"; then |
| 4465 | thisdir=\`pwd\` |
| 4466 | fi |
| 4467 | # remove .libs from thisdir |
| 4468 | case \"\$thisdir\" in |
| 4469 | *[\\\\/]$objdir ) thisdir=\`\$ECHO \"\$thisdir\" | $SED 's%[\\\\/][^\\\\/]*$%%'\` ;; |
| 4470 | $objdir ) thisdir=. ;; |
| 4471 | esac |
| 4472 | fi |
| 4473 | |
| 4474 | # Try to get the absolute directory name. |
| 4475 | absdir=\`cd \"\$thisdir\" && pwd\` |
| 4476 | test -n \"\$absdir\" && thisdir=\"\$absdir\" |
| 4477 | " |
| 4478 | |
| 4479 | if test "$fast_install" = yes; then |
| 4480 | $ECHO "\ |
| 4481 | program=lt-'$outputname'$exeext |
| 4482 | progdir=\"\$thisdir/$objdir\" |
| 4483 | |
| 4484 | if test ! -f \"\$progdir/\$program\" || |
| 4485 | { file=\`ls -1dt \"\$progdir/\$program\" \"\$progdir/../\$program\" 2>/dev/null | ${SED} 1q\`; \\ |
| 4486 | test \"X\$file\" != \"X\$progdir/\$program\"; }; then |
| 4487 | |
| 4488 | file=\"\$\$-\$program\" |
| 4489 | |
| 4490 | if test ! -d \"\$progdir\"; then |
| 4491 | $MKDIR \"\$progdir\" |
| 4492 | else |
| 4493 | $RM \"\$progdir/\$file\" |
| 4494 | fi" |
| 4495 | |
| 4496 | $ECHO "\ |
| 4497 | |
| 4498 | # relink executable if necessary |
| 4499 | if test -n \"\$relink_command\"; then |
| 4500 | if relink_command_output=\`eval \$relink_command 2>&1\`; then : |
| 4501 | else |
| 4502 | $ECHO \"\$relink_command_output\" >&2 |
| 4503 | $RM \"\$progdir/\$file\" |
| 4504 | exit 1 |
| 4505 | fi |
| 4506 | fi |
| 4507 | |
| 4508 | $MV \"\$progdir/\$file\" \"\$progdir/\$program\" 2>/dev/null || |
| 4509 | { $RM \"\$progdir/\$program\"; |
| 4510 | $MV \"\$progdir/\$file\" \"\$progdir/\$program\"; } |
| 4511 | $RM \"\$progdir/\$file\" |
| 4512 | fi" |
| 4513 | else |
| 4514 | $ECHO "\ |
| 4515 | program='$outputname' |
| 4516 | progdir=\"\$thisdir/$objdir\" |
| 4517 | " |
| 4518 | fi |
| 4519 | |
| 4520 | $ECHO "\ |
| 4521 | |
| 4522 | if test -f \"\$progdir/\$program\"; then" |
| 4523 | |
| 4524 | # fixup the dll searchpath if we need to. |
| 4525 | # |
| 4526 | # Fix the DLL searchpath if we need to. Do this before prepending |
| 4527 | # to shlibpath, because on Windows, both are PATH and uninstalled |
| 4528 | # libraries must come first. |
| 4529 | if test -n "$dllsearchpath"; then |
| 4530 | $ECHO "\ |
| 4531 | # Add the dll search path components to the executable PATH |
| 4532 | PATH=$dllsearchpath:\$PATH |
| 4533 | " |
| 4534 | fi |
| 4535 | |
| 4536 | # Export our shlibpath_var if we have one. |
| 4537 | if test "$shlibpath_overrides_runpath" = yes && test -n "$shlibpath_var" && test -n "$temp_rpath"; then |
| 4538 | $ECHO "\ |
| 4539 | # Add our own library path to $shlibpath_var |
| 4540 | $shlibpath_var=\"$temp_rpath\$$shlibpath_var\" |
| 4541 | |
| 4542 | # Some systems cannot cope with colon-terminated $shlibpath_var |
| 4543 | # The second colon is a workaround for a bug in BeOS R4 sed |
| 4544 | $shlibpath_var=\`\$ECHO \"\$$shlibpath_var\" | $SED 's/::*\$//'\` |
| 4545 | |
| 4546 | export $shlibpath_var |
| 4547 | " |
| 4548 | fi |
| 4549 | |
| 4550 | $ECHO "\ |
| 4551 | if test \"\$libtool_execute_magic\" != \"$magic\"; then |
| 4552 | # Run the actual program with our arguments. |
| 4553 | func_exec_program \${1+\"\$@\"} |
| 4554 | fi |
| 4555 | else |
| 4556 | # The program doesn't exist. |
| 4557 | \$ECHO \"\$0: error: \\\`\$progdir/\$program' does not exist\" 1>&2 |
| 4558 | \$ECHO \"This script is just a wrapper for \$program.\" 1>&2 |
| 4559 | \$ECHO \"See the $PACKAGE documentation for more information.\" 1>&2 |
| 4560 | exit 1 |
| 4561 | fi |
| 4562 | fi\ |
| 4563 | " |
| 4564 | } |
| 4565 | |
| 4566 | |
| 4567 | # func_emit_cwrapperexe_src |
| 4568 | # emit the source code for a wrapper executable on stdout |
| 4569 | # Must ONLY be called from within func_mode_link because |
| 4570 | # it depends on a number of variable set therein. |
| 4571 | func_emit_cwrapperexe_src () |
| 4572 | { |
| 4573 | cat <<EOF |
| 4574 | |
| 4575 | /* $cwrappersource - temporary wrapper executable for $objdir/$outputname |
| 4576 | Generated by $PROGRAM (GNU $PACKAGE$TIMESTAMP) $VERSION |
| 4577 | |
| 4578 | The $output program cannot be directly executed until all the libtool |
| 4579 | libraries that it depends on are installed. |
| 4580 | |
| 4581 | This wrapper executable should never be moved out of the build directory. |
| 4582 | If it is, it will not operate correctly. |
| 4583 | */ |
| 4584 | EOF |
| 4585 | cat <<"EOF" |
| 4586 | #ifdef _MSC_VER |
| 4587 | # define _CRT_SECURE_NO_DEPRECATE 1 |
| 4588 | #endif |
| 4589 | #include <stdio.h> |
| 4590 | #include <stdlib.h> |
| 4591 | #ifdef _MSC_VER |
| 4592 | # include <direct.h> |
| 4593 | # include <process.h> |
| 4594 | # include <io.h> |
| 4595 | #else |
| 4596 | # include <unistd.h> |
| 4597 | # include <stdint.h> |
| 4598 | # ifdef __CYGWIN__ |
| 4599 | # include <io.h> |
| 4600 | # endif |
| 4601 | #endif |
| 4602 | #include <malloc.h> |
| 4603 | #include <stdarg.h> |
| 4604 | #include <assert.h> |
| 4605 | #include <string.h> |
| 4606 | #include <ctype.h> |
| 4607 | #include <errno.h> |
| 4608 | #include <fcntl.h> |
| 4609 | #include <sys/stat.h> |
| 4610 | |
| 4611 | /* declarations of non-ANSI functions */ |
| 4612 | #if defined(__MINGW32__) |
| 4613 | # ifdef __STRICT_ANSI__ |
| 4614 | int _putenv (const char *); |
| 4615 | # endif |
| 4616 | #elif defined(__CYGWIN__) |
| 4617 | # ifdef __STRICT_ANSI__ |
| 4618 | char *realpath (const char *, char *); |
| 4619 | int putenv (char *); |
| 4620 | int setenv (const char *, const char *, int); |
| 4621 | # endif |
| 4622 | /* #elif defined (other platforms) ... */ |
| 4623 | #endif |
| 4624 | |
| 4625 | /* portability defines, excluding path handling macros */ |
| 4626 | #if defined(_MSC_VER) |
| 4627 | # define setmode _setmode |
| 4628 | # define stat _stat |
| 4629 | # define chmod _chmod |
| 4630 | # define getcwd _getcwd |
| 4631 | # define putenv _putenv |
| 4632 | # define S_IXUSR _S_IEXEC |
| 4633 | # ifndef _INTPTR_T_DEFINED |
| 4634 | # define _INTPTR_T_DEFINED |
| 4635 | # define intptr_t int |
| 4636 | # endif |
| 4637 | #elif defined(__MINGW32__) |
| 4638 | # define setmode _setmode |
| 4639 | # define stat _stat |
| 4640 | # define chmod _chmod |
| 4641 | # define getcwd _getcwd |
| 4642 | # define putenv _putenv |
| 4643 | #elif defined(__CYGWIN__) |
| 4644 | # define HAVE_SETENV |
| 4645 | # define FOPEN_WB "wb" |
| 4646 | /* #elif defined (other platforms) ... */ |
| 4647 | #endif |
| 4648 | |
| 4649 | #if defined(PATH_MAX) |
| 4650 | # define LT_PATHMAX PATH_MAX |
| 4651 | #elif defined(MAXPATHLEN) |
| 4652 | # define LT_PATHMAX MAXPATHLEN |
| 4653 | #else |
| 4654 | # define LT_PATHMAX 1024 |
| 4655 | #endif |
| 4656 | |
| 4657 | #ifndef S_IXOTH |
| 4658 | # define S_IXOTH 0 |
| 4659 | #endif |
| 4660 | #ifndef S_IXGRP |
| 4661 | # define S_IXGRP 0 |
| 4662 | #endif |
| 4663 | |
| 4664 | /* path handling portability macros */ |
| 4665 | #ifndef DIR_SEPARATOR |
| 4666 | # define DIR_SEPARATOR '/' |
| 4667 | # define PATH_SEPARATOR ':' |
| 4668 | #endif |
| 4669 | |
| 4670 | #if defined (_WIN32) || defined (__MSDOS__) || defined (__DJGPP__) || \ |
| 4671 | defined (__OS2__) |
| 4672 | # define HAVE_DOS_BASED_FILE_SYSTEM |
| 4673 | # define FOPEN_WB "wb" |
| 4674 | # ifndef DIR_SEPARATOR_2 |
| 4675 | # define DIR_SEPARATOR_2 '\\' |
| 4676 | # endif |
| 4677 | # ifndef PATH_SEPARATOR_2 |
| 4678 | # define PATH_SEPARATOR_2 ';' |
| 4679 | # endif |
| 4680 | #endif |
| 4681 | |
| 4682 | #ifndef DIR_SEPARATOR_2 |
| 4683 | # define IS_DIR_SEPARATOR(ch) ((ch) == DIR_SEPARATOR) |
| 4684 | #else /* DIR_SEPARATOR_2 */ |
| 4685 | # define IS_DIR_SEPARATOR(ch) \ |
| 4686 | (((ch) == DIR_SEPARATOR) || ((ch) == DIR_SEPARATOR_2)) |
| 4687 | #endif /* DIR_SEPARATOR_2 */ |
| 4688 | |
| 4689 | #ifndef PATH_SEPARATOR_2 |
| 4690 | # define IS_PATH_SEPARATOR(ch) ((ch) == PATH_SEPARATOR) |
| 4691 | #else /* PATH_SEPARATOR_2 */ |
| 4692 | # define IS_PATH_SEPARATOR(ch) ((ch) == PATH_SEPARATOR_2) |
| 4693 | #endif /* PATH_SEPARATOR_2 */ |
| 4694 | |
| 4695 | #ifndef FOPEN_WB |
| 4696 | # define FOPEN_WB "w" |
| 4697 | #endif |
| 4698 | #ifndef _O_BINARY |
| 4699 | # define _O_BINARY 0 |
| 4700 | #endif |
| 4701 | |
| 4702 | #define XMALLOC(type, num) ((type *) xmalloc ((num) * sizeof(type))) |
| 4703 | #define XFREE(stale) do { \ |
| 4704 | if (stale) { free ((void *) stale); stale = 0; } \ |
| 4705 | } while (0) |
| 4706 | |
| 4707 | #if defined(LT_DEBUGWRAPPER) |
| 4708 | static int lt_debug = 1; |
| 4709 | #else |
| 4710 | static int lt_debug = 0; |
| 4711 | #endif |
| 4712 | |
| 4713 | const char *program_name = "libtool-wrapper"; /* in case xstrdup fails */ |
| 4714 | |
| 4715 | void *xmalloc (size_t num); |
| 4716 | char *xstrdup (const char *string); |
| 4717 | const char *base_name (const char *name); |
| 4718 | char *find_executable (const char *wrapper); |
| 4719 | char *chase_symlinks (const char *pathspec); |
| 4720 | int make_executable (const char *path); |
| 4721 | int check_executable (const char *path); |
| 4722 | char *strendzap (char *str, const char *pat); |
| 4723 | void lt_debugprintf (const char *file, int line, const char *fmt, ...); |
| 4724 | void lt_fatal (const char *file, int line, const char *message, ...); |
| 4725 | static const char *nonnull (const char *s); |
| 4726 | static const char *nonempty (const char *s); |
| 4727 | void lt_setenv (const char *name, const char *value); |
| 4728 | char *lt_extend_str (const char *orig_value, const char *add, int to_end); |
| 4729 | void lt_update_exe_path (const char *name, const char *value); |
| 4730 | void lt_update_lib_path (const char *name, const char *value); |
| 4731 | char **prepare_spawn (char **argv); |
| 4732 | void lt_dump_script (FILE *f); |
| 4733 | EOF |
| 4734 | |
| 4735 | cat <<EOF |
| 4736 | volatile const char * MAGIC_EXE = "$magic_exe"; |
| 4737 | const char * LIB_PATH_VARNAME = "$shlibpath_var"; |
| 4738 | EOF |
| 4739 | |
| 4740 | if test "$shlibpath_overrides_runpath" = yes && test -n "$shlibpath_var" && test -n "$temp_rpath"; then |
| 4741 | func_to_host_path "$temp_rpath" |
| 4742 | cat <<EOF |
| 4743 | const char * LIB_PATH_VALUE = "$func_to_host_path_result"; |
| 4744 | EOF |
| 4745 | else |
| 4746 | cat <<"EOF" |
| 4747 | const char * LIB_PATH_VALUE = ""; |
| 4748 | EOF |
| 4749 | fi |
| 4750 | |
| 4751 | if test -n "$dllsearchpath"; then |
| 4752 | func_to_host_path "$dllsearchpath:" |
| 4753 | cat <<EOF |
| 4754 | const char * EXE_PATH_VARNAME = "PATH"; |
| 4755 | const char * EXE_PATH_VALUE = "$func_to_host_path_result"; |
| 4756 | EOF |
| 4757 | else |
| 4758 | cat <<"EOF" |
| 4759 | const char * EXE_PATH_VARNAME = ""; |
| 4760 | const char * EXE_PATH_VALUE = ""; |
| 4761 | EOF |
| 4762 | fi |
| 4763 | |
| 4764 | if test "$fast_install" = yes; then |
| 4765 | cat <<EOF |
| 4766 | const char * TARGET_PROGRAM_NAME = "lt-$outputname"; /* hopefully, no .exe */ |
| 4767 | EOF |
| 4768 | else |
| 4769 | cat <<EOF |
| 4770 | const char * TARGET_PROGRAM_NAME = "$outputname"; /* hopefully, no .exe */ |
| 4771 | EOF |
| 4772 | fi |
| 4773 | |
| 4774 | |
| 4775 | cat <<"EOF" |
| 4776 | |
| 4777 | #define LTWRAPPER_OPTION_PREFIX "--lt-" |
| 4778 | |
| 4779 | static const char *ltwrapper_option_prefix = LTWRAPPER_OPTION_PREFIX; |
| 4780 | static const char *dumpscript_opt = LTWRAPPER_OPTION_PREFIX "dump-script"; |
| 4781 | static const char *debug_opt = LTWRAPPER_OPTION_PREFIX "debug"; |
| 4782 | |
| 4783 | int |
| 4784 | main (int argc, char *argv[]) |
| 4785 | { |
| 4786 | char **newargz; |
| 4787 | int newargc; |
| 4788 | char *tmp_pathspec; |
| 4789 | char *actual_cwrapper_path; |
| 4790 | char *actual_cwrapper_name; |
| 4791 | char *target_name; |
| 4792 | char *lt_argv_zero; |
| 4793 | intptr_t rval = 127; |
| 4794 | |
| 4795 | int i; |
| 4796 | |
| 4797 | program_name = (char *) xstrdup (base_name (argv[0])); |
| 4798 | newargz = XMALLOC (char *, argc + 1); |
| 4799 | |
| 4800 | /* very simple arg parsing; don't want to rely on getopt |
| 4801 | * also, copy all non cwrapper options to newargz, except |
| 4802 | * argz[0], which is handled differently |
| 4803 | */ |
| 4804 | newargc=0; |
| 4805 | for (i = 1; i < argc; i++) |
| 4806 | { |
| 4807 | if (strcmp (argv[i], dumpscript_opt) == 0) |
| 4808 | { |
| 4809 | EOF |
| 4810 | case "$host" in |
| 4811 | *mingw* | *cygwin* ) |
| 4812 | # make stdout use "unix" line endings |
| 4813 | echo " setmode(1,_O_BINARY);" |
| 4814 | ;; |
| 4815 | esac |
| 4816 | |
| 4817 | cat <<"EOF" |
| 4818 | lt_dump_script (stdout); |
| 4819 | return 0; |
| 4820 | } |
| 4821 | if (strcmp (argv[i], debug_opt) == 0) |
| 4822 | { |
| 4823 | lt_debug = 1; |
| 4824 | continue; |
| 4825 | } |
| 4826 | if (strcmp (argv[i], ltwrapper_option_prefix) == 0) |
| 4827 | { |
| 4828 | /* however, if there is an option in the LTWRAPPER_OPTION_PREFIX |
| 4829 | namespace, but it is not one of the ones we know about and |
| 4830 | have already dealt with, above (inluding dump-script), then |
| 4831 | report an error. Otherwise, targets might begin to believe |
| 4832 | they are allowed to use options in the LTWRAPPER_OPTION_PREFIX |
| 4833 | namespace. The first time any user complains about this, we'll |
| 4834 | need to make LTWRAPPER_OPTION_PREFIX a configure-time option |
| 4835 | or a configure.ac-settable value. |
| 4836 | */ |
| 4837 | lt_fatal (__FILE__, __LINE__, |
| 4838 | "unrecognized %s option: '%s'", |
| 4839 | ltwrapper_option_prefix, argv[i]); |
| 4840 | } |
| 4841 | /* otherwise ... */ |
| 4842 | newargz[++newargc] = xstrdup (argv[i]); |
| 4843 | } |
| 4844 | newargz[++newargc] = NULL; |
| 4845 | |
| 4846 | EOF |
| 4847 | cat <<EOF |
| 4848 | /* The GNU banner must be the first non-error debug message */ |
| 4849 | lt_debugprintf (__FILE__, __LINE__, "libtool wrapper (GNU $PACKAGE$TIMESTAMP) $VERSION\n"); |
| 4850 | EOF |
| 4851 | cat <<"EOF" |
| 4852 | lt_debugprintf (__FILE__, __LINE__, "(main) argv[0]: %s\n", argv[0]); |
| 4853 | lt_debugprintf (__FILE__, __LINE__, "(main) program_name: %s\n", program_name); |
| 4854 | |
| 4855 | tmp_pathspec = find_executable (argv[0]); |
| 4856 | if (tmp_pathspec == NULL) |
| 4857 | lt_fatal (__FILE__, __LINE__, "couldn't find %s", argv[0]); |
| 4858 | lt_debugprintf (__FILE__, __LINE__, |
| 4859 | "(main) found exe (before symlink chase) at: %s\n", |
| 4860 | tmp_pathspec); |
| 4861 | |
| 4862 | actual_cwrapper_path = chase_symlinks (tmp_pathspec); |
| 4863 | lt_debugprintf (__FILE__, __LINE__, |
| 4864 | "(main) found exe (after symlink chase) at: %s\n", |
| 4865 | actual_cwrapper_path); |
| 4866 | XFREE (tmp_pathspec); |
| 4867 | |
| 4868 | actual_cwrapper_name = xstrdup (base_name (actual_cwrapper_path)); |
| 4869 | strendzap (actual_cwrapper_path, actual_cwrapper_name); |
| 4870 | |
| 4871 | /* wrapper name transforms */ |
| 4872 | strendzap (actual_cwrapper_name, ".exe"); |
| 4873 | tmp_pathspec = lt_extend_str (actual_cwrapper_name, ".exe", 1); |
| 4874 | XFREE (actual_cwrapper_name); |
| 4875 | actual_cwrapper_name = tmp_pathspec; |
| 4876 | tmp_pathspec = 0; |
| 4877 | |
| 4878 | /* target_name transforms -- use actual target program name; might have lt- prefix */ |
| 4879 | target_name = xstrdup (base_name (TARGET_PROGRAM_NAME)); |
| 4880 | strendzap (target_name, ".exe"); |
| 4881 | tmp_pathspec = lt_extend_str (target_name, ".exe", 1); |
| 4882 | XFREE (target_name); |
| 4883 | target_name = tmp_pathspec; |
| 4884 | tmp_pathspec = 0; |
| 4885 | |
| 4886 | lt_debugprintf (__FILE__, __LINE__, |
| 4887 | "(main) libtool target name: %s\n", |
| 4888 | target_name); |
| 4889 | EOF |
| 4890 | |
| 4891 | cat <<EOF |
| 4892 | newargz[0] = |
| 4893 | XMALLOC (char, (strlen (actual_cwrapper_path) + |
| 4894 | strlen ("$objdir") + 1 + strlen (actual_cwrapper_name) + 1)); |
| 4895 | strcpy (newargz[0], actual_cwrapper_path); |
| 4896 | strcat (newargz[0], "$objdir"); |
| 4897 | strcat (newargz[0], "/"); |
| 4898 | EOF |
| 4899 | |
| 4900 | cat <<"EOF" |
| 4901 | /* stop here, and copy so we don't have to do this twice */ |
| 4902 | tmp_pathspec = xstrdup (newargz[0]); |
| 4903 | |
| 4904 | /* do NOT want the lt- prefix here, so use actual_cwrapper_name */ |
| 4905 | strcat (newargz[0], actual_cwrapper_name); |
| 4906 | |
| 4907 | /* DO want the lt- prefix here if it exists, so use target_name */ |
| 4908 | lt_argv_zero = lt_extend_str (tmp_pathspec, target_name, 1); |
| 4909 | XFREE (tmp_pathspec); |
| 4910 | tmp_pathspec = NULL; |
| 4911 | EOF |
| 4912 | |
| 4913 | case $host_os in |
| 4914 | mingw*) |
| 4915 | cat <<"EOF" |
| 4916 | { |
| 4917 | char* p; |
| 4918 | while ((p = strchr (newargz[0], '\\')) != NULL) |
| 4919 | { |
| 4920 | *p = '/'; |
| 4921 | } |
| 4922 | while ((p = strchr (lt_argv_zero, '\\')) != NULL) |
| 4923 | { |
| 4924 | *p = '/'; |
| 4925 | } |
| 4926 | } |
| 4927 | EOF |
| 4928 | ;; |
| 4929 | esac |
| 4930 | |
| 4931 | cat <<"EOF" |
| 4932 | XFREE (target_name); |
| 4933 | XFREE (actual_cwrapper_path); |
| 4934 | XFREE (actual_cwrapper_name); |
| 4935 | |
| 4936 | lt_setenv ("BIN_SH", "xpg4"); /* for Tru64 */ |
| 4937 | lt_setenv ("DUALCASE", "1"); /* for MSK sh */ |
| 4938 | /* Update the DLL searchpath. EXE_PATH_VALUE ($dllsearchpath) must |
| 4939 | be prepended before (that is, appear after) LIB_PATH_VALUE ($temp_rpath) |
| 4940 | because on Windows, both *_VARNAMEs are PATH but uninstalled |
| 4941 | libraries must come first. */ |
| 4942 | lt_update_exe_path (EXE_PATH_VARNAME, EXE_PATH_VALUE); |
| 4943 | lt_update_lib_path (LIB_PATH_VARNAME, LIB_PATH_VALUE); |
| 4944 | |
| 4945 | lt_debugprintf (__FILE__, __LINE__, "(main) lt_argv_zero: %s\n", |
| 4946 | nonnull (lt_argv_zero)); |
| 4947 | for (i = 0; i < newargc; i++) |
| 4948 | { |
| 4949 | lt_debugprintf (__FILE__, __LINE__, "(main) newargz[%d]: %s\n", |
| 4950 | i, nonnull (newargz[i])); |
| 4951 | } |
| 4952 | |
| 4953 | EOF |
| 4954 | |
| 4955 | case $host_os in |
| 4956 | mingw*) |
| 4957 | cat <<"EOF" |
| 4958 | /* execv doesn't actually work on mingw as expected on unix */ |
| 4959 | newargz = prepare_spawn (newargz); |
| 4960 | rval = _spawnv (_P_WAIT, lt_argv_zero, (const char * const *) newargz); |
| 4961 | if (rval == -1) |
| 4962 | { |
| 4963 | /* failed to start process */ |
| 4964 | lt_debugprintf (__FILE__, __LINE__, |
| 4965 | "(main) failed to launch target \"%s\": %s\n", |
| 4966 | lt_argv_zero, nonnull (strerror (errno))); |
| 4967 | return 127; |
| 4968 | } |
| 4969 | return rval; |
| 4970 | EOF |
| 4971 | ;; |
| 4972 | *) |
| 4973 | cat <<"EOF" |
| 4974 | execv (lt_argv_zero, newargz); |
| 4975 | return rval; /* =127, but avoids unused variable warning */ |
| 4976 | EOF |
| 4977 | ;; |
| 4978 | esac |
| 4979 | |
| 4980 | cat <<"EOF" |
| 4981 | } |
| 4982 | |
| 4983 | void * |
| 4984 | xmalloc (size_t num) |
| 4985 | { |
| 4986 | void *p = (void *) malloc (num); |
| 4987 | if (!p) |
| 4988 | lt_fatal (__FILE__, __LINE__, "memory exhausted"); |
| 4989 | |
| 4990 | return p; |
| 4991 | } |
| 4992 | |
| 4993 | char * |
| 4994 | xstrdup (const char *string) |
| 4995 | { |
| 4996 | return string ? strcpy ((char *) xmalloc (strlen (string) + 1), |
| 4997 | string) : NULL; |
| 4998 | } |
| 4999 | |
| 5000 | const char * |
| 5001 | base_name (const char *name) |
| 5002 | { |
| 5003 | const char *base; |
| 5004 | |
| 5005 | #if defined (HAVE_DOS_BASED_FILE_SYSTEM) |
| 5006 | /* Skip over the disk name in MSDOS pathnames. */ |
| 5007 | if (isalpha ((unsigned char) name[0]) && name[1] == ':') |
| 5008 | name += 2; |
| 5009 | #endif |
| 5010 | |
| 5011 | for (base = name; *name; name++) |
| 5012 | if (IS_DIR_SEPARATOR (*name)) |
| 5013 | base = name + 1; |
| 5014 | return base; |
| 5015 | } |
| 5016 | |
| 5017 | int |
| 5018 | check_executable (const char *path) |
| 5019 | { |
| 5020 | struct stat st; |
| 5021 | |
| 5022 | lt_debugprintf (__FILE__, __LINE__, "(check_executable): %s\n", |
| 5023 | nonempty (path)); |
| 5024 | if ((!path) || (!*path)) |
| 5025 | return 0; |
| 5026 | |
| 5027 | if ((stat (path, &st) >= 0) |
| 5028 | && (st.st_mode & (S_IXUSR | S_IXGRP | S_IXOTH))) |
| 5029 | return 1; |
| 5030 | else |
| 5031 | return 0; |
| 5032 | } |
| 5033 | |
| 5034 | int |
| 5035 | make_executable (const char *path) |
| 5036 | { |
| 5037 | int rval = 0; |
| 5038 | struct stat st; |
| 5039 | |
| 5040 | lt_debugprintf (__FILE__, __LINE__, "(make_executable): %s\n", |
| 5041 | nonempty (path)); |
| 5042 | if ((!path) || (!*path)) |
| 5043 | return 0; |
| 5044 | |
| 5045 | if (stat (path, &st) >= 0) |
| 5046 | { |
| 5047 | rval = chmod (path, st.st_mode | S_IXOTH | S_IXGRP | S_IXUSR); |
| 5048 | } |
| 5049 | return rval; |
| 5050 | } |
| 5051 | |
| 5052 | /* Searches for the full path of the wrapper. Returns |
| 5053 | newly allocated full path name if found, NULL otherwise |
| 5054 | Does not chase symlinks, even on platforms that support them. |
| 5055 | */ |
| 5056 | char * |
| 5057 | find_executable (const char *wrapper) |
| 5058 | { |
| 5059 | int has_slash = 0; |
| 5060 | const char *p; |
| 5061 | const char *p_next; |
| 5062 | /* static buffer for getcwd */ |
| 5063 | char tmp[LT_PATHMAX + 1]; |
| 5064 | int tmp_len; |
| 5065 | char *concat_name; |
| 5066 | |
| 5067 | lt_debugprintf (__FILE__, __LINE__, "(find_executable): %s\n", |
| 5068 | nonempty (wrapper)); |
| 5069 | |
| 5070 | if ((wrapper == NULL) || (*wrapper == '\0')) |
| 5071 | return NULL; |
| 5072 | |
| 5073 | /* Absolute path? */ |
| 5074 | #if defined (HAVE_DOS_BASED_FILE_SYSTEM) |
| 5075 | if (isalpha ((unsigned char) wrapper[0]) && wrapper[1] == ':') |
| 5076 | { |
| 5077 | concat_name = xstrdup (wrapper); |
| 5078 | if (check_executable (concat_name)) |
| 5079 | return concat_name; |
| 5080 | XFREE (concat_name); |
| 5081 | } |
| 5082 | else |
| 5083 | { |
| 5084 | #endif |
| 5085 | if (IS_DIR_SEPARATOR (wrapper[0])) |
| 5086 | { |
| 5087 | concat_name = xstrdup (wrapper); |
| 5088 | if (check_executable (concat_name)) |
| 5089 | return concat_name; |
| 5090 | XFREE (concat_name); |
| 5091 | } |
| 5092 | #if defined (HAVE_DOS_BASED_FILE_SYSTEM) |
| 5093 | } |
| 5094 | #endif |
| 5095 | |
| 5096 | for (p = wrapper; *p; p++) |
| 5097 | if (*p == '/') |
| 5098 | { |
| 5099 | has_slash = 1; |
| 5100 | break; |
| 5101 | } |
| 5102 | if (!has_slash) |
| 5103 | { |
| 5104 | /* no slashes; search PATH */ |
| 5105 | const char *path = getenv ("PATH"); |
| 5106 | if (path != NULL) |
| 5107 | { |
| 5108 | for (p = path; *p; p = p_next) |
| 5109 | { |
| 5110 | const char *q; |
| 5111 | size_t p_len; |
| 5112 | for (q = p; *q; q++) |
| 5113 | if (IS_PATH_SEPARATOR (*q)) |
| 5114 | break; |
| 5115 | p_len = q - p; |
| 5116 | p_next = (*q == '\0' ? q : q + 1); |
| 5117 | if (p_len == 0) |
| 5118 | { |
| 5119 | /* empty path: current directory */ |
| 5120 | if (getcwd (tmp, LT_PATHMAX) == NULL) |
| 5121 | lt_fatal (__FILE__, __LINE__, "getcwd failed: %s", |
| 5122 | nonnull (strerror (errno))); |
| 5123 | tmp_len = strlen (tmp); |
| 5124 | concat_name = |
| 5125 | XMALLOC (char, tmp_len + 1 + strlen (wrapper) + 1); |
| 5126 | memcpy (concat_name, tmp, tmp_len); |
| 5127 | concat_name[tmp_len] = '/'; |
| 5128 | strcpy (concat_name + tmp_len + 1, wrapper); |
| 5129 | } |
| 5130 | else |
| 5131 | { |
| 5132 | concat_name = |
| 5133 | XMALLOC (char, p_len + 1 + strlen (wrapper) + 1); |
| 5134 | memcpy (concat_name, p, p_len); |
| 5135 | concat_name[p_len] = '/'; |
| 5136 | strcpy (concat_name + p_len + 1, wrapper); |
| 5137 | } |
| 5138 | if (check_executable (concat_name)) |
| 5139 | return concat_name; |
| 5140 | XFREE (concat_name); |
| 5141 | } |
| 5142 | } |
| 5143 | /* not found in PATH; assume curdir */ |
| 5144 | } |
| 5145 | /* Relative path | not found in path: prepend cwd */ |
| 5146 | if (getcwd (tmp, LT_PATHMAX) == NULL) |
| 5147 | lt_fatal (__FILE__, __LINE__, "getcwd failed: %s", |
| 5148 | nonnull (strerror (errno))); |
| 5149 | tmp_len = strlen (tmp); |
| 5150 | concat_name = XMALLOC (char, tmp_len + 1 + strlen (wrapper) + 1); |
| 5151 | memcpy (concat_name, tmp, tmp_len); |
| 5152 | concat_name[tmp_len] = '/'; |
| 5153 | strcpy (concat_name + tmp_len + 1, wrapper); |
| 5154 | |
| 5155 | if (check_executable (concat_name)) |
| 5156 | return concat_name; |
| 5157 | XFREE (concat_name); |
| 5158 | return NULL; |
| 5159 | } |
| 5160 | |
| 5161 | char * |
| 5162 | chase_symlinks (const char *pathspec) |
| 5163 | { |
| 5164 | #ifndef S_ISLNK |
| 5165 | return xstrdup (pathspec); |
| 5166 | #else |
| 5167 | char buf[LT_PATHMAX]; |
| 5168 | struct stat s; |
| 5169 | char *tmp_pathspec = xstrdup (pathspec); |
| 5170 | char *p; |
| 5171 | int has_symlinks = 0; |
| 5172 | while (strlen (tmp_pathspec) && !has_symlinks) |
| 5173 | { |
| 5174 | lt_debugprintf (__FILE__, __LINE__, |
| 5175 | "checking path component for symlinks: %s\n", |
| 5176 | tmp_pathspec); |
| 5177 | if (lstat (tmp_pathspec, &s) == 0) |
| 5178 | { |
| 5179 | if (S_ISLNK (s.st_mode) != 0) |
| 5180 | { |
| 5181 | has_symlinks = 1; |
| 5182 | break; |
| 5183 | } |
| 5184 | |
| 5185 | /* search backwards for last DIR_SEPARATOR */ |
| 5186 | p = tmp_pathspec + strlen (tmp_pathspec) - 1; |
| 5187 | while ((p > tmp_pathspec) && (!IS_DIR_SEPARATOR (*p))) |
| 5188 | p--; |
| 5189 | if ((p == tmp_pathspec) && (!IS_DIR_SEPARATOR (*p))) |
| 5190 | { |
| 5191 | /* no more DIR_SEPARATORS left */ |
| 5192 | break; |
| 5193 | } |
| 5194 | *p = '\0'; |
| 5195 | } |
| 5196 | else |
| 5197 | { |
| 5198 | lt_fatal (__FILE__, __LINE__, |
| 5199 | "error accessing file \"%s\": %s", |
| 5200 | tmp_pathspec, nonnull (strerror (errno))); |
| 5201 | } |
| 5202 | } |
| 5203 | XFREE (tmp_pathspec); |
| 5204 | |
| 5205 | if (!has_symlinks) |
| 5206 | { |
| 5207 | return xstrdup (pathspec); |
| 5208 | } |
| 5209 | |
| 5210 | tmp_pathspec = realpath (pathspec, buf); |
| 5211 | if (tmp_pathspec == 0) |
| 5212 | { |
| 5213 | lt_fatal (__FILE__, __LINE__, |
| 5214 | "could not follow symlinks for %s", pathspec); |
| 5215 | } |
| 5216 | return xstrdup (tmp_pathspec); |
| 5217 | #endif |
| 5218 | } |
| 5219 | |
| 5220 | char * |
| 5221 | strendzap (char *str, const char *pat) |
| 5222 | { |
| 5223 | size_t len, patlen; |
| 5224 | |
| 5225 | assert (str != NULL); |
| 5226 | assert (pat != NULL); |
| 5227 | |
| 5228 | len = strlen (str); |
| 5229 | patlen = strlen (pat); |
| 5230 | |
| 5231 | if (patlen <= len) |
| 5232 | { |
| 5233 | str += len - patlen; |
| 5234 | if (strcmp (str, pat) == 0) |
| 5235 | *str = '\0'; |
| 5236 | } |
| 5237 | return str; |
| 5238 | } |
| 5239 | |
| 5240 | void |
| 5241 | lt_debugprintf (const char *file, int line, const char *fmt, ...) |
| 5242 | { |
| 5243 | va_list args; |
| 5244 | if (lt_debug) |
| 5245 | { |
| 5246 | (void) fprintf (stderr, "%s:%s:%d: ", program_name, file, line); |
| 5247 | va_start (args, fmt); |
| 5248 | (void) vfprintf (stderr, fmt, args); |
| 5249 | va_end (args); |
| 5250 | } |
| 5251 | } |
| 5252 | |
| 5253 | static void |
| 5254 | lt_error_core (int exit_status, const char *file, |
| 5255 | int line, const char *mode, |
| 5256 | const char *message, va_list ap) |
| 5257 | { |
| 5258 | fprintf (stderr, "%s:%s:%d: %s: ", program_name, file, line, mode); |
| 5259 | vfprintf (stderr, message, ap); |
| 5260 | fprintf (stderr, ".\n"); |
| 5261 | |
| 5262 | if (exit_status >= 0) |
| 5263 | exit (exit_status); |
| 5264 | } |
| 5265 | |
| 5266 | void |
| 5267 | lt_fatal (const char *file, int line, const char *message, ...) |
| 5268 | { |
| 5269 | va_list ap; |
| 5270 | va_start (ap, message); |
| 5271 | lt_error_core (EXIT_FAILURE, file, line, "FATAL", message, ap); |
| 5272 | va_end (ap); |
| 5273 | } |
| 5274 | |
| 5275 | static const char * |
| 5276 | nonnull (const char *s) |
| 5277 | { |
| 5278 | return s ? s : "(null)"; |
| 5279 | } |
| 5280 | |
| 5281 | static const char * |
| 5282 | nonempty (const char *s) |
| 5283 | { |
| 5284 | return (s && !*s) ? "(empty)" : nonnull (s); |
| 5285 | } |
| 5286 | |
| 5287 | void |
| 5288 | lt_setenv (const char *name, const char *value) |
| 5289 | { |
| 5290 | lt_debugprintf (__FILE__, __LINE__, |
| 5291 | "(lt_setenv) setting '%s' to '%s'\n", |
| 5292 | nonnull (name), nonnull (value)); |
| 5293 | { |
| 5294 | #ifdef HAVE_SETENV |
| 5295 | /* always make a copy, for consistency with !HAVE_SETENV */ |
| 5296 | char *str = xstrdup (value); |
| 5297 | setenv (name, str, 1); |
| 5298 | #else |
| 5299 | int len = strlen (name) + 1 + strlen (value) + 1; |
| 5300 | char *str = XMALLOC (char, len); |
| 5301 | sprintf (str, "%s=%s", name, value); |
| 5302 | if (putenv (str) != EXIT_SUCCESS) |
| 5303 | { |
| 5304 | XFREE (str); |
| 5305 | } |
| 5306 | #endif |
| 5307 | } |
| 5308 | } |
| 5309 | |
| 5310 | char * |
| 5311 | lt_extend_str (const char *orig_value, const char *add, int to_end) |
| 5312 | { |
| 5313 | char *new_value; |
| 5314 | if (orig_value && *orig_value) |
| 5315 | { |
| 5316 | int orig_value_len = strlen (orig_value); |
| 5317 | int add_len = strlen (add); |
| 5318 | new_value = XMALLOC (char, add_len + orig_value_len + 1); |
| 5319 | if (to_end) |
| 5320 | { |
| 5321 | strcpy (new_value, orig_value); |
| 5322 | strcpy (new_value + orig_value_len, add); |
| 5323 | } |
| 5324 | else |
| 5325 | { |
| 5326 | strcpy (new_value, add); |
| 5327 | strcpy (new_value + add_len, orig_value); |
| 5328 | } |
| 5329 | } |
| 5330 | else |
| 5331 | { |
| 5332 | new_value = xstrdup (add); |
| 5333 | } |
| 5334 | return new_value; |
| 5335 | } |
| 5336 | |
| 5337 | void |
| 5338 | lt_update_exe_path (const char *name, const char *value) |
| 5339 | { |
| 5340 | lt_debugprintf (__FILE__, __LINE__, |
| 5341 | "(lt_update_exe_path) modifying '%s' by prepending '%s'\n", |
| 5342 | nonnull (name), nonnull (value)); |
| 5343 | |
| 5344 | if (name && *name && value && *value) |
| 5345 | { |
| 5346 | char *new_value = lt_extend_str (getenv (name), value, 0); |
| 5347 | /* some systems can't cope with a ':'-terminated path #' */ |
| 5348 | int len = strlen (new_value); |
| 5349 | while (((len = strlen (new_value)) > 0) && IS_PATH_SEPARATOR (new_value[len-1])) |
| 5350 | { |
| 5351 | new_value[len-1] = '\0'; |
| 5352 | } |
| 5353 | lt_setenv (name, new_value); |
| 5354 | XFREE (new_value); |
| 5355 | } |
| 5356 | } |
| 5357 | |
| 5358 | void |
| 5359 | lt_update_lib_path (const char *name, const char *value) |
| 5360 | { |
| 5361 | lt_debugprintf (__FILE__, __LINE__, |
| 5362 | "(lt_update_lib_path) modifying '%s' by prepending '%s'\n", |
| 5363 | nonnull (name), nonnull (value)); |
| 5364 | |
| 5365 | if (name && *name && value && *value) |
| 5366 | { |
| 5367 | char *new_value = lt_extend_str (getenv (name), value, 0); |
| 5368 | lt_setenv (name, new_value); |
| 5369 | XFREE (new_value); |
| 5370 | } |
| 5371 | } |
| 5372 | |
| 5373 | EOF |
| 5374 | case $host_os in |
| 5375 | mingw*) |
| 5376 | cat <<"EOF" |
| 5377 | |
| 5378 | /* Prepares an argument vector before calling spawn(). |
| 5379 | Note that spawn() does not by itself call the command interpreter |
| 5380 | (getenv ("COMSPEC") != NULL ? getenv ("COMSPEC") : |
| 5381 | ({ OSVERSIONINFO v; v.dwOSVersionInfoSize = sizeof(OSVERSIONINFO); |
| 5382 | GetVersionEx(&v); |
| 5383 | v.dwPlatformId == VER_PLATFORM_WIN32_NT; |
| 5384 | }) ? "cmd.exe" : "command.com"). |
| 5385 | Instead it simply concatenates the arguments, separated by ' ', and calls |
| 5386 | CreateProcess(). We must quote the arguments since Win32 CreateProcess() |
| 5387 | interprets characters like ' ', '\t', '\\', '"' (but not '<' and '>') in a |
| 5388 | special way: |
| 5389 | - Space and tab are interpreted as delimiters. They are not treated as |
| 5390 | delimiters if they are surrounded by double quotes: "...". |
| 5391 | - Unescaped double quotes are removed from the input. Their only effect is |
| 5392 | that within double quotes, space and tab are treated like normal |
| 5393 | characters. |
| 5394 | - Backslashes not followed by double quotes are not special. |
| 5395 | - But 2*n+1 backslashes followed by a double quote become |
| 5396 | n backslashes followed by a double quote (n >= 0): |
| 5397 | \" -> " |
| 5398 | \\\" -> \" |
| 5399 | \\\\\" -> \\" |
| 5400 | */ |
| 5401 | #define SHELL_SPECIAL_CHARS "\"\\ \001\002\003\004\005\006\007\010\011\012\013\014\015\016\017\020\021\022\023\024\025\026\027\030\031\032\033\034\035\036\037" |
| 5402 | #define SHELL_SPACE_CHARS " \001\002\003\004\005\006\007\010\011\012\013\014\015\016\017\020\021\022\023\024\025\026\027\030\031\032\033\034\035\036\037" |
| 5403 | char ** |
| 5404 | prepare_spawn (char **argv) |
| 5405 | { |
| 5406 | size_t argc; |
| 5407 | char **new_argv; |
| 5408 | size_t i; |
| 5409 | |
| 5410 | /* Count number of arguments. */ |
| 5411 | for (argc = 0; argv[argc] != NULL; argc++) |
| 5412 | ; |
| 5413 | |
| 5414 | /* Allocate new argument vector. */ |
| 5415 | new_argv = XMALLOC (char *, argc + 1); |
| 5416 | |
| 5417 | /* Put quoted arguments into the new argument vector. */ |
| 5418 | for (i = 0; i < argc; i++) |
| 5419 | { |
| 5420 | const char *string = argv[i]; |
| 5421 | |
| 5422 | if (string[0] == '\0') |
| 5423 | new_argv[i] = xstrdup ("\"\""); |
| 5424 | else if (strpbrk (string, SHELL_SPECIAL_CHARS) != NULL) |
| 5425 | { |
| 5426 | int quote_around = (strpbrk (string, SHELL_SPACE_CHARS) != NULL); |
| 5427 | size_t length; |
| 5428 | unsigned int backslashes; |
| 5429 | const char *s; |
| 5430 | char *quoted_string; |
| 5431 | char *p; |
| 5432 | |
| 5433 | length = 0; |
| 5434 | backslashes = 0; |
| 5435 | if (quote_around) |
| 5436 | length++; |
| 5437 | for (s = string; *s != '\0'; s++) |
| 5438 | { |
| 5439 | char c = *s; |
| 5440 | if (c == '"') |
| 5441 | length += backslashes + 1; |
| 5442 | length++; |
| 5443 | if (c == '\\') |
| 5444 | backslashes++; |
| 5445 | else |
| 5446 | backslashes = 0; |
| 5447 | } |
| 5448 | if (quote_around) |
| 5449 | length += backslashes + 1; |
| 5450 | |
| 5451 | quoted_string = XMALLOC (char, length + 1); |
| 5452 | |
| 5453 | p = quoted_string; |
| 5454 | backslashes = 0; |
| 5455 | if (quote_around) |
| 5456 | *p++ = '"'; |
| 5457 | for (s = string; *s != '\0'; s++) |
| 5458 | { |
| 5459 | char c = *s; |
| 5460 | if (c == '"') |
| 5461 | { |
| 5462 | unsigned int j; |
| 5463 | for (j = backslashes + 1; j > 0; j--) |
| 5464 | *p++ = '\\'; |
| 5465 | } |
| 5466 | *p++ = c; |
| 5467 | if (c == '\\') |
| 5468 | backslashes++; |
| 5469 | else |
| 5470 | backslashes = 0; |
| 5471 | } |
| 5472 | if (quote_around) |
| 5473 | { |
| 5474 | unsigned int j; |
| 5475 | for (j = backslashes; j > 0; j--) |
| 5476 | *p++ = '\\'; |
| 5477 | *p++ = '"'; |
| 5478 | } |
| 5479 | *p = '\0'; |
| 5480 | |
| 5481 | new_argv[i] = quoted_string; |
| 5482 | } |
| 5483 | else |
| 5484 | new_argv[i] = (char *) string; |
| 5485 | } |
| 5486 | new_argv[argc] = NULL; |
| 5487 | |
| 5488 | return new_argv; |
| 5489 | } |
| 5490 | EOF |
| 5491 | ;; |
| 5492 | esac |
| 5493 | |
| 5494 | cat <<"EOF" |
| 5495 | void lt_dump_script (FILE* f) |
| 5496 | { |
| 5497 | EOF |
| 5498 | func_emit_wrapper yes | |
| 5499 | $SED -n -e ' |
| 5500 | s/^\(.\{79\}\)\(..*\)/\1\ |
| 5501 | \2/ |
| 5502 | h |
| 5503 | s/\([\\"]\)/\\\1/g |
| 5504 | s/$/\\n/ |
| 5505 | s/\([^\n]*\).*/ fputs ("\1", f);/p |
| 5506 | g |
| 5507 | D' |
| 5508 | cat <<"EOF" |
| 5509 | } |
| 5510 | EOF |
| 5511 | } |
| 5512 | # end: func_emit_cwrapperexe_src |
| 5513 | |
| 5514 | # func_win32_import_lib_p ARG |
| 5515 | # True if ARG is an import lib, as indicated by $file_magic_cmd |
| 5516 | func_win32_import_lib_p () |
| 5517 | { |
| 5518 | $opt_debug |
| 5519 | case `eval $file_magic_cmd \"\$1\" 2>/dev/null | $SED -e 10q` in |
| 5520 | *import*) : ;; |
| 5521 | *) false ;; |
| 5522 | esac |
| 5523 | } |
| 5524 | |
| 5525 | # func_mode_link arg... |
| 5526 | func_mode_link () |
| 5527 | { |
| 5528 | $opt_debug |
| 5529 | case $host in |
| 5530 | *-*-cygwin* | *-*-mingw* | *-*-pw32* | *-*-os2* | *-cegcc*) |
| 5531 | # It is impossible to link a dll without this setting, and |
| 5532 | # we shouldn't force the makefile maintainer to figure out |
| 5533 | # which system we are compiling for in order to pass an extra |
| 5534 | # flag for every libtool invocation. |
| 5535 | # allow_undefined=no |
| 5536 | |
| 5537 | # FIXME: Unfortunately, there are problems with the above when trying |
| 5538 | # to make a dll which has undefined symbols, in which case not |
| 5539 | # even a static library is built. For now, we need to specify |
| 5540 | # -no-undefined on the libtool link line when we can be certain |
| 5541 | # that all symbols are satisfied, otherwise we get a static library. |
| 5542 | allow_undefined=yes |
| 5543 | ;; |
| 5544 | *) |
| 5545 | allow_undefined=yes |
| 5546 | ;; |
| 5547 | esac |
| 5548 | libtool_args=$nonopt |
| 5549 | base_compile="$nonopt $@" |
| 5550 | compile_command=$nonopt |
| 5551 | finalize_command=$nonopt |
| 5552 | |
| 5553 | compile_rpath= |
| 5554 | finalize_rpath= |
| 5555 | compile_shlibpath= |
| 5556 | finalize_shlibpath= |
| 5557 | convenience= |
| 5558 | old_convenience= |
| 5559 | deplibs= |
| 5560 | old_deplibs= |
| 5561 | compiler_flags= |
| 5562 | linker_flags= |
| 5563 | dllsearchpath= |
| 5564 | lib_search_path=`pwd` |
| 5565 | inst_prefix_dir= |
| 5566 | new_inherited_linker_flags= |
| 5567 | |
| 5568 | avoid_version=no |
| 5569 | bindir= |
| 5570 | dlfiles= |
| 5571 | dlprefiles= |
| 5572 | dlself=no |
| 5573 | export_dynamic=no |
| 5574 | export_symbols= |
| 5575 | export_symbols_regex= |
| 5576 | generated= |
| 5577 | libobjs= |
| 5578 | ltlibs= |
| 5579 | module=no |
| 5580 | no_install=no |
| 5581 | objs= |
| 5582 | non_pic_objects= |
| 5583 | precious_files_regex= |
| 5584 | prefer_static_libs=no |
| 5585 | preload=no |
| 5586 | prev= |
| 5587 | prevarg= |
| 5588 | release= |
| 5589 | rpath= |
| 5590 | xrpath= |
| 5591 | perm_rpath= |
| 5592 | temp_rpath= |
| 5593 | thread_safe=no |
| 5594 | vinfo= |
| 5595 | vinfo_number=no |
| 5596 | weak_libs= |
| 5597 | single_module="${wl}-single_module" |
| 5598 | func_infer_tag $base_compile |
| 5599 | |
| 5600 | # We need to know -static, to get the right output filenames. |
| 5601 | for arg |
| 5602 | do |
| 5603 | case $arg in |
| 5604 | -shared) |
| 5605 | test "$build_libtool_libs" != yes && \ |
| 5606 | func_fatal_configuration "can not build a shared library" |
| 5607 | build_old_libs=no |
| 5608 | break |
| 5609 | ;; |
| 5610 | -all-static | -static | -static-libtool-libs) |
| 5611 | case $arg in |
| 5612 | -all-static) |
| 5613 | if test "$build_libtool_libs" = yes && test -z "$link_static_flag"; then |
| 5614 | func_warning "complete static linking is impossible in this configuration" |
| 5615 | fi |
| 5616 | if test -n "$link_static_flag"; then |
| 5617 | dlopen_self=$dlopen_self_static |
| 5618 | fi |
| 5619 | prefer_static_libs=yes |
| 5620 | ;; |
| 5621 | -static) |
| 5622 | if test -z "$pic_flag" && test -n "$link_static_flag"; then |
| 5623 | dlopen_self=$dlopen_self_static |
| 5624 | fi |
| 5625 | prefer_static_libs=built |
| 5626 | ;; |
| 5627 | -static-libtool-libs) |
| 5628 | if test -z "$pic_flag" && test -n "$link_static_flag"; then |
| 5629 | dlopen_self=$dlopen_self_static |
| 5630 | fi |
| 5631 | prefer_static_libs=yes |
| 5632 | ;; |
| 5633 | esac |
| 5634 | build_libtool_libs=no |
| 5635 | build_old_libs=yes |
| 5636 | break |
| 5637 | ;; |
| 5638 | esac |
| 5639 | done |
| 5640 | |
| 5641 | # See if our shared archives depend on static archives. |
| 5642 | test -n "$old_archive_from_new_cmds" && build_old_libs=yes |
| 5643 | |
| 5644 | # Go through the arguments, transforming them on the way. |
| 5645 | while test "$#" -gt 0; do |
| 5646 | arg="$1" |
| 5647 | shift |
| 5648 | func_quote_for_eval "$arg" |
| 5649 | qarg=$func_quote_for_eval_unquoted_result |
| 5650 | libtool_args+=" $func_quote_for_eval_result" |
| 5651 | |
| 5652 | # If the previous option needs an argument, assign it. |
| 5653 | if test -n "$prev"; then |
| 5654 | case $prev in |
| 5655 | output) |
| 5656 | compile_command+=" @OUTPUT@" |
| 5657 | finalize_command+=" @OUTPUT@" |
| 5658 | ;; |
| 5659 | esac |
| 5660 | |
| 5661 | case $prev in |
| 5662 | bindir) |
| 5663 | bindir="$arg" |
| 5664 | prev= |
| 5665 | continue |
| 5666 | ;; |
| 5667 | dlfiles|dlprefiles) |
| 5668 | if test "$preload" = no; then |
| 5669 | # Add the symbol object into the linking commands. |
| 5670 | compile_command+=" @SYMFILE@" |
| 5671 | finalize_command+=" @SYMFILE@" |
| 5672 | preload=yes |
| 5673 | fi |
| 5674 | case $arg in |
| 5675 | *.la | *.lo) ;; # We handle these cases below. |
| 5676 | force) |
| 5677 | if test "$dlself" = no; then |
| 5678 | dlself=needless |
| 5679 | export_dynamic=yes |
| 5680 | fi |
| 5681 | prev= |
| 5682 | continue |
| 5683 | ;; |
| 5684 | self) |
| 5685 | if test "$prev" = dlprefiles; then |
| 5686 | dlself=yes |
| 5687 | elif test "$prev" = dlfiles && test "$dlopen_self" != yes; then |
| 5688 | dlself=yes |
| 5689 | else |
| 5690 | dlself=needless |
| 5691 | export_dynamic=yes |
| 5692 | fi |
| 5693 | prev= |
| 5694 | continue |
| 5695 | ;; |
| 5696 | *) |
| 5697 | if test "$prev" = dlfiles; then |
| 5698 | dlfiles+=" $arg" |
| 5699 | else |
| 5700 | dlprefiles+=" $arg" |
| 5701 | fi |
| 5702 | prev= |
| 5703 | continue |
| 5704 | ;; |
| 5705 | esac |
| 5706 | ;; |
| 5707 | expsyms) |
| 5708 | export_symbols="$arg" |
| 5709 | test -f "$arg" \ |
| 5710 | || func_fatal_error "symbol file \`$arg' does not exist" |
| 5711 | prev= |
| 5712 | continue |
| 5713 | ;; |
| 5714 | expsyms_regex) |
| 5715 | export_symbols_regex="$arg" |
| 5716 | prev= |
| 5717 | continue |
| 5718 | ;; |
| 5719 | framework) |
| 5720 | case $host in |
| 5721 | *-*-darwin*) |
| 5722 | case "$deplibs " in |
| 5723 | *" $qarg.ltframework "*) ;; |
| 5724 | *) deplibs+=" $qarg.ltframework" # this is fixed later |
| 5725 | ;; |
| 5726 | esac |
| 5727 | ;; |
| 5728 | esac |
| 5729 | prev= |
| 5730 | continue |
| 5731 | ;; |
| 5732 | inst_prefix) |
| 5733 | inst_prefix_dir="$arg" |
| 5734 | prev= |
| 5735 | continue |
| 5736 | ;; |
| 5737 | objectlist) |
| 5738 | if test -f "$arg"; then |
| 5739 | save_arg=$arg |
| 5740 | moreargs= |
| 5741 | for fil in `cat "$save_arg"` |
| 5742 | do |
| 5743 | # moreargs+=" $fil" |
| 5744 | arg=$fil |
| 5745 | # A libtool-controlled object. |
| 5746 | |
| 5747 | # Check to see that this really is a libtool object. |
| 5748 | if func_lalib_unsafe_p "$arg"; then |
| 5749 | pic_object= |
| 5750 | non_pic_object= |
| 5751 | |
| 5752 | # Read the .lo file |
| 5753 | func_source "$arg" |
| 5754 | |
| 5755 | if test -z "$pic_object" || |
| 5756 | test -z "$non_pic_object" || |
| 5757 | test "$pic_object" = none && |
| 5758 | test "$non_pic_object" = none; then |
| 5759 | func_fatal_error "cannot find name of object for \`$arg'" |
| 5760 | fi |
| 5761 | |
| 5762 | # Extract subdirectory from the argument. |
| 5763 | func_dirname "$arg" "/" "" |
| 5764 | xdir="$func_dirname_result" |
| 5765 | |
| 5766 | if test "$pic_object" != none; then |
| 5767 | # Prepend the subdirectory the object is found in. |
| 5768 | pic_object="$xdir$pic_object" |
| 5769 | |
| 5770 | if test "$prev" = dlfiles; then |
| 5771 | if test "$build_libtool_libs" = yes && test "$dlopen_support" = yes; then |
| 5772 | dlfiles+=" $pic_object" |
| 5773 | prev= |
| 5774 | continue |
| 5775 | else |
| 5776 | # If libtool objects are unsupported, then we need to preload. |
| 5777 | prev=dlprefiles |
| 5778 | fi |
| 5779 | fi |
| 5780 | |
| 5781 | # CHECK ME: I think I busted this. -Ossama |
| 5782 | if test "$prev" = dlprefiles; then |
| 5783 | # Preload the old-style object. |
| 5784 | dlprefiles+=" $pic_object" |
| 5785 | prev= |
| 5786 | fi |
| 5787 | |
| 5788 | # A PIC object. |
| 5789 | libobjs+=" $pic_object" |
| 5790 | arg="$pic_object" |
| 5791 | fi |
| 5792 | |
| 5793 | # Non-PIC object. |
| 5794 | if test "$non_pic_object" != none; then |
| 5795 | # Prepend the subdirectory the object is found in. |
| 5796 | non_pic_object="$xdir$non_pic_object" |
| 5797 | |
| 5798 | # A standard non-PIC object |
| 5799 | non_pic_objects+=" $non_pic_object" |
| 5800 | if test -z "$pic_object" || test "$pic_object" = none ; then |
| 5801 | arg="$non_pic_object" |
| 5802 | fi |
| 5803 | else |
| 5804 | # If the PIC object exists, use it instead. |
| 5805 | # $xdir was prepended to $pic_object above. |
| 5806 | non_pic_object="$pic_object" |
| 5807 | non_pic_objects+=" $non_pic_object" |
| 5808 | fi |
| 5809 | else |
| 5810 | # Only an error if not doing a dry-run. |
| 5811 | if $opt_dry_run; then |
| 5812 | # Extract subdirectory from the argument. |
| 5813 | func_dirname "$arg" "/" "" |
| 5814 | xdir="$func_dirname_result" |
| 5815 | |
| 5816 | func_lo2o "$arg" |
| 5817 | pic_object=$xdir$objdir/$func_lo2o_result |
| 5818 | non_pic_object=$xdir$func_lo2o_result |
| 5819 | libobjs+=" $pic_object" |
| 5820 | non_pic_objects+=" $non_pic_object" |
| 5821 | else |
| 5822 | func_fatal_error "\`$arg' is not a valid libtool object" |
| 5823 | fi |
| 5824 | fi |
| 5825 | done |
| 5826 | else |
| 5827 | func_fatal_error "link input file \`$arg' does not exist" |
| 5828 | fi |
| 5829 | arg=$save_arg |
| 5830 | prev= |
| 5831 | continue |
| 5832 | ;; |
| 5833 | precious_regex) |
| 5834 | precious_files_regex="$arg" |
| 5835 | prev= |
| 5836 | continue |
| 5837 | ;; |
| 5838 | release) |
| 5839 | release="-$arg" |
| 5840 | prev= |
| 5841 | continue |
| 5842 | ;; |
| 5843 | rpath | xrpath) |
| 5844 | # We need an absolute path. |
| 5845 | case $arg in |
| 5846 | [\\/]* | [A-Za-z]:[\\/]*) ;; |
| 5847 | *) |
| 5848 | func_fatal_error "only absolute run-paths are allowed" |
| 5849 | ;; |
| 5850 | esac |
| 5851 | if test "$prev" = rpath; then |
| 5852 | case "$rpath " in |
| 5853 | *" $arg "*) ;; |
| 5854 | *) rpath+=" $arg" ;; |
| 5855 | esac |
| 5856 | else |
| 5857 | case "$xrpath " in |
| 5858 | *" $arg "*) ;; |
| 5859 | *) xrpath+=" $arg" ;; |
| 5860 | esac |
| 5861 | fi |
| 5862 | prev= |
| 5863 | continue |
| 5864 | ;; |
| 5865 | shrext) |
| 5866 | shrext_cmds="$arg" |
| 5867 | prev= |
| 5868 | continue |
| 5869 | ;; |
| 5870 | weak) |
| 5871 | weak_libs+=" $arg" |
| 5872 | prev= |
| 5873 | continue |
| 5874 | ;; |
| 5875 | xcclinker) |
| 5876 | linker_flags+=" $qarg" |
| 5877 | compiler_flags+=" $qarg" |
| 5878 | prev= |
| 5879 | compile_command+=" $qarg" |
| 5880 | finalize_command+=" $qarg" |
| 5881 | continue |
| 5882 | ;; |
| 5883 | xcompiler) |
| 5884 | compiler_flags+=" $qarg" |
| 5885 | prev= |
| 5886 | compile_command+=" $qarg" |
| 5887 | finalize_command+=" $qarg" |
| 5888 | continue |
| 5889 | ;; |
| 5890 | xlinker) |
| 5891 | linker_flags+=" $qarg" |
| 5892 | compiler_flags+=" $wl$qarg" |
| 5893 | prev= |
| 5894 | compile_command+=" $wl$qarg" |
| 5895 | finalize_command+=" $wl$qarg" |
| 5896 | continue |
| 5897 | ;; |
| 5898 | *) |
| 5899 | eval "$prev=\"\$arg\"" |
| 5900 | prev= |
| 5901 | continue |
| 5902 | ;; |
| 5903 | esac |
| 5904 | fi # test -n "$prev" |
| 5905 | |
| 5906 | prevarg="$arg" |
| 5907 | |
| 5908 | case $arg in |
| 5909 | -all-static) |
| 5910 | if test -n "$link_static_flag"; then |
| 5911 | # See comment for -static flag below, for more details. |
| 5912 | compile_command+=" $link_static_flag" |
| 5913 | finalize_command+=" $link_static_flag" |
| 5914 | fi |
| 5915 | continue |
| 5916 | ;; |
| 5917 | |
| 5918 | -allow-undefined) |
| 5919 | # FIXME: remove this flag sometime in the future. |
| 5920 | func_fatal_error "\`-allow-undefined' must not be used because it is the default" |
| 5921 | ;; |
| 5922 | |
| 5923 | -avoid-version) |
| 5924 | avoid_version=yes |
| 5925 | continue |
| 5926 | ;; |
| 5927 | |
| 5928 | -bindir) |
| 5929 | prev=bindir |
| 5930 | continue |
| 5931 | ;; |
| 5932 | |
| 5933 | -dlopen) |
| 5934 | prev=dlfiles |
| 5935 | continue |
| 5936 | ;; |
| 5937 | |
| 5938 | -dlpreopen) |
| 5939 | prev=dlprefiles |
| 5940 | continue |
| 5941 | ;; |
| 5942 | |
| 5943 | -export-dynamic) |
| 5944 | export_dynamic=yes |
| 5945 | continue |
| 5946 | ;; |
| 5947 | |
| 5948 | -export-symbols | -export-symbols-regex) |
| 5949 | if test -n "$export_symbols" || test -n "$export_symbols_regex"; then |
| 5950 | func_fatal_error "more than one -exported-symbols argument is not allowed" |
| 5951 | fi |
| 5952 | if test "X$arg" = "X-export-symbols"; then |
| 5953 | prev=expsyms |
| 5954 | else |
| 5955 | prev=expsyms_regex |
| 5956 | fi |
| 5957 | continue |
| 5958 | ;; |
| 5959 | |
| 5960 | -framework) |
| 5961 | prev=framework |
| 5962 | continue |
| 5963 | ;; |
| 5964 | |
| 5965 | -inst-prefix-dir) |
| 5966 | prev=inst_prefix |
| 5967 | continue |
| 5968 | ;; |
| 5969 | |
| 5970 | # The native IRIX linker understands -LANG:*, -LIST:* and -LNO:* |
| 5971 | # so, if we see these flags be careful not to treat them like -L |
| 5972 | -L[A-Z][A-Z]*:*) |
| 5973 | case $with_gcc/$host in |
| 5974 | no/*-*-irix* | /*-*-irix*) |
| 5975 | compile_command+=" $arg" |
| 5976 | finalize_command+=" $arg" |
| 5977 | ;; |
| 5978 | esac |
| 5979 | continue |
| 5980 | ;; |
| 5981 | |
| 5982 | -L*) |
| 5983 | func_stripname "-L" '' "$arg" |
| 5984 | if test -z "$func_stripname_result"; then |
| 5985 | if test "$#" -gt 0; then |
| 5986 | func_fatal_error "require no space between \`-L' and \`$1'" |
| 5987 | else |
| 5988 | func_fatal_error "need path for \`-L' option" |
| 5989 | fi |
| 5990 | fi |
| 5991 | func_resolve_sysroot "$func_stripname_result" |
| 5992 | dir=$func_resolve_sysroot_result |
| 5993 | # We need an absolute path. |
| 5994 | case $dir in |
| 5995 | [\\/]* | [A-Za-z]:[\\/]*) ;; |
| 5996 | *) |
| 5997 | absdir=`cd "$dir" && pwd` |
| 5998 | test -z "$absdir" && \ |
| 5999 | func_fatal_error "cannot determine absolute directory name of \`$dir'" |
| 6000 | dir="$absdir" |
| 6001 | ;; |
| 6002 | esac |
| 6003 | case "$deplibs " in |
| 6004 | *" -L$dir "* | *" $arg "*) |
| 6005 | # Will only happen for absolute or sysroot arguments |
| 6006 | ;; |
| 6007 | *) |
| 6008 | # Preserve sysroot, but never include relative directories |
| 6009 | case $dir in |
| 6010 | [\\/]* | [A-Za-z]:[\\/]* | =*) deplibs+=" $arg" ;; |
| 6011 | *) deplibs+=" -L$dir" ;; |
| 6012 | esac |
| 6013 | lib_search_path+=" $dir" |
| 6014 | ;; |
| 6015 | esac |
| 6016 | case $host in |
| 6017 | *-*-cygwin* | *-*-mingw* | *-*-pw32* | *-*-os2* | *-cegcc*) |
| 6018 | testbindir=`$ECHO "$dir" | $SED 's*/lib$*/bin*'` |
| 6019 | case :$dllsearchpath: in |
| 6020 | *":$dir:"*) ;; |
| 6021 | ::) dllsearchpath=$dir;; |
| 6022 | *) dllsearchpath+=":$dir";; |
| 6023 | esac |
| 6024 | case :$dllsearchpath: in |
| 6025 | *":$testbindir:"*) ;; |
| 6026 | ::) dllsearchpath=$testbindir;; |
| 6027 | *) dllsearchpath+=":$testbindir";; |
| 6028 | esac |
| 6029 | ;; |
| 6030 | esac |
| 6031 | continue |
| 6032 | ;; |
| 6033 | |
| 6034 | -l*) |
| 6035 | if test "X$arg" = "X-lc" || test "X$arg" = "X-lm"; then |
| 6036 | case $host in |
| 6037 | *-*-cygwin* | *-*-mingw* | *-*-pw32* | *-*-beos* | *-cegcc* | *-*-haiku*) |
| 6038 | # These systems don't actually have a C or math library (as such) |
| 6039 | continue |
| 6040 | ;; |
| 6041 | *-*-os2*) |
| 6042 | # These systems don't actually have a C library (as such) |
| 6043 | test "X$arg" = "X-lc" && continue |
| 6044 | ;; |
| 6045 | *-*-openbsd* | *-*-freebsd* | *-*-dragonfly*) |
| 6046 | # Do not include libc due to us having libc/libc_r. |
| 6047 | test "X$arg" = "X-lc" && continue |
| 6048 | ;; |
| 6049 | *-*-rhapsody* | *-*-darwin1.[012]) |
| 6050 | # Rhapsody C and math libraries are in the System framework |
| 6051 | deplibs+=" System.ltframework" |
| 6052 | continue |
| 6053 | ;; |
| 6054 | *-*-sco3.2v5* | *-*-sco5v6*) |
| 6055 | # Causes problems with __ctype |
| 6056 | test "X$arg" = "X-lc" && continue |
| 6057 | ;; |
| 6058 | *-*-sysv4.2uw2* | *-*-sysv5* | *-*-unixware* | *-*-OpenUNIX*) |
| 6059 | # Compiler inserts libc in the correct place for threads to work |
| 6060 | test "X$arg" = "X-lc" && continue |
| 6061 | ;; |
| 6062 | esac |
| 6063 | elif test "X$arg" = "X-lc_r"; then |
| 6064 | case $host in |
| 6065 | *-*-openbsd* | *-*-freebsd* | *-*-dragonfly*) |
| 6066 | # Do not include libc_r directly, use -pthread flag. |
| 6067 | continue |
| 6068 | ;; |
| 6069 | esac |
| 6070 | fi |
| 6071 | deplibs+=" $arg" |
| 6072 | continue |
| 6073 | ;; |
| 6074 | |
| 6075 | -module) |
| 6076 | module=yes |
| 6077 | continue |
| 6078 | ;; |
| 6079 | |
| 6080 | # Tru64 UNIX uses -model [arg] to determine the layout of C++ |
| 6081 | # classes, name mangling, and exception handling. |
| 6082 | # Darwin uses the -arch flag to determine output architecture. |
| 6083 | -model|-arch|-isysroot|--sysroot) |
| 6084 | compiler_flags+=" $arg" |
| 6085 | compile_command+=" $arg" |
| 6086 | finalize_command+=" $arg" |
| 6087 | prev=xcompiler |
| 6088 | continue |
| 6089 | ;; |
| 6090 | |
| 6091 | -mt|-mthreads|-kthread|-Kthread|-pthread|-pthreads|--thread-safe \ |
| 6092 | |-threads|-fopenmp|-openmp|-mp|-xopenmp|-omp|-qsmp=*) |
| 6093 | compiler_flags+=" $arg" |
| 6094 | compile_command+=" $arg" |
| 6095 | finalize_command+=" $arg" |
| 6096 | case "$new_inherited_linker_flags " in |
| 6097 | *" $arg "*) ;; |
| 6098 | * ) new_inherited_linker_flags+=" $arg" ;; |
| 6099 | esac |
| 6100 | continue |
| 6101 | ;; |
| 6102 | |
| 6103 | -multi_module) |
| 6104 | single_module="${wl}-multi_module" |
| 6105 | continue |
| 6106 | ;; |
| 6107 | |
| 6108 | -no-fast-install) |
| 6109 | fast_install=no |
| 6110 | continue |
| 6111 | ;; |
| 6112 | |
| 6113 | -no-install) |
| 6114 | case $host in |
| 6115 | *-*-cygwin* | *-*-mingw* | *-*-pw32* | *-*-os2* | *-*-darwin* | *-cegcc*) |
| 6116 | # The PATH hackery in wrapper scripts is required on Windows |
| 6117 | # and Darwin in order for the loader to find any dlls it needs. |
| 6118 | func_warning "\`-no-install' is ignored for $host" |
| 6119 | func_warning "assuming \`-no-fast-install' instead" |
| 6120 | fast_install=no |
| 6121 | ;; |
| 6122 | *) no_install=yes ;; |
| 6123 | esac |
| 6124 | continue |
| 6125 | ;; |
| 6126 | |
| 6127 | -no-undefined) |
| 6128 | allow_undefined=no |
| 6129 | continue |
| 6130 | ;; |
| 6131 | |
| 6132 | -objectlist) |
| 6133 | prev=objectlist |
| 6134 | continue |
| 6135 | ;; |
| 6136 | |
| 6137 | -o) prev=output ;; |
| 6138 | |
| 6139 | -precious-files-regex) |
| 6140 | prev=precious_regex |
| 6141 | continue |
| 6142 | ;; |
| 6143 | |
| 6144 | -release) |
| 6145 | prev=release |
| 6146 | continue |
| 6147 | ;; |
| 6148 | |
| 6149 | -rpath) |
| 6150 | prev=rpath |
| 6151 | continue |
| 6152 | ;; |
| 6153 | |
| 6154 | -R) |
| 6155 | prev=xrpath |
| 6156 | continue |
| 6157 | ;; |
| 6158 | |
| 6159 | -R*) |
| 6160 | func_stripname '-R' '' "$arg" |
| 6161 | dir=$func_stripname_result |
| 6162 | # We need an absolute path. |
| 6163 | case $dir in |
| 6164 | [\\/]* | [A-Za-z]:[\\/]*) ;; |
| 6165 | =*) |
| 6166 | func_stripname '=' '' "$dir" |
| 6167 | dir=$lt_sysroot$func_stripname_result |
| 6168 | ;; |
| 6169 | *) |
| 6170 | func_fatal_error "only absolute run-paths are allowed" |
| 6171 | ;; |
| 6172 | esac |
| 6173 | case "$xrpath " in |
| 6174 | *" $dir "*) ;; |
| 6175 | *) xrpath+=" $dir" ;; |
| 6176 | esac |
| 6177 | continue |
| 6178 | ;; |
| 6179 | |
| 6180 | -shared) |
| 6181 | # The effects of -shared are defined in a previous loop. |
| 6182 | continue |
| 6183 | ;; |
| 6184 | |
| 6185 | -shrext) |
| 6186 | prev=shrext |
| 6187 | continue |
| 6188 | ;; |
| 6189 | |
| 6190 | -static | -static-libtool-libs) |
| 6191 | # The effects of -static are defined in a previous loop. |
| 6192 | # We used to do the same as -all-static on platforms that |
| 6193 | # didn't have a PIC flag, but the assumption that the effects |
| 6194 | # would be equivalent was wrong. It would break on at least |
| 6195 | # Digital Unix and AIX. |
| 6196 | continue |
| 6197 | ;; |
| 6198 | |
| 6199 | -thread-safe) |
| 6200 | thread_safe=yes |
| 6201 | continue |
| 6202 | ;; |
| 6203 | |
| 6204 | -version-info) |
| 6205 | prev=vinfo |
| 6206 | continue |
| 6207 | ;; |
| 6208 | |
| 6209 | -version-number) |
| 6210 | prev=vinfo |
| 6211 | vinfo_number=yes |
| 6212 | continue |
| 6213 | ;; |
| 6214 | |
| 6215 | -weak) |
| 6216 | prev=weak |
| 6217 | continue |
| 6218 | ;; |
| 6219 | |
| 6220 | -Wc,*) |
| 6221 | func_stripname '-Wc,' '' "$arg" |
| 6222 | args=$func_stripname_result |
| 6223 | arg= |
| 6224 | save_ifs="$IFS"; IFS=',' |
| 6225 | for flag in $args; do |
| 6226 | IFS="$save_ifs" |
| 6227 | func_quote_for_eval "$flag" |
| 6228 | arg+=" $func_quote_for_eval_result" |
| 6229 | compiler_flags+=" $func_quote_for_eval_result" |
| 6230 | done |
| 6231 | IFS="$save_ifs" |
| 6232 | func_stripname ' ' '' "$arg" |
| 6233 | arg=$func_stripname_result |
| 6234 | ;; |
| 6235 | |
| 6236 | -Wl,*) |
| 6237 | func_stripname '-Wl,' '' "$arg" |
| 6238 | args=$func_stripname_result |
| 6239 | arg= |
| 6240 | save_ifs="$IFS"; IFS=',' |
| 6241 | for flag in $args; do |
| 6242 | IFS="$save_ifs" |
| 6243 | func_quote_for_eval "$flag" |
| 6244 | arg+=" $wl$func_quote_for_eval_result" |
| 6245 | compiler_flags+=" $wl$func_quote_for_eval_result" |
| 6246 | linker_flags+=" $func_quote_for_eval_result" |
| 6247 | done |
| 6248 | IFS="$save_ifs" |
| 6249 | func_stripname ' ' '' "$arg" |
| 6250 | arg=$func_stripname_result |
| 6251 | ;; |
| 6252 | |
| 6253 | -Xcompiler) |
| 6254 | prev=xcompiler |
| 6255 | continue |
| 6256 | ;; |
| 6257 | |
| 6258 | -Xlinker) |
| 6259 | prev=xlinker |
| 6260 | continue |
| 6261 | ;; |
| 6262 | |
| 6263 | -XCClinker) |
| 6264 | prev=xcclinker |
| 6265 | continue |
| 6266 | ;; |
| 6267 | |
| 6268 | # -msg_* for osf cc |
| 6269 | -msg_*) |
| 6270 | func_quote_for_eval "$arg" |
| 6271 | arg="$func_quote_for_eval_result" |
| 6272 | ;; |
| 6273 | |
| 6274 | # Flags to be passed through unchanged, with rationale: |
| 6275 | # -64, -mips[0-9] enable 64-bit mode for the SGI compiler |
| 6276 | # -r[0-9][0-9]* specify processor for the SGI compiler |
| 6277 | # -xarch=*, -xtarget=* enable 64-bit mode for the Sun compiler |
| 6278 | # +DA*, +DD* enable 64-bit mode for the HP compiler |
| 6279 | # -q* compiler args for the IBM compiler |
| 6280 | # -m*, -t[45]*, -txscale* architecture-specific flags for GCC |
| 6281 | # -F/path path to uninstalled frameworks, gcc on darwin |
| 6282 | # -p, -pg, --coverage, -fprofile-* profiling flags for GCC |
| 6283 | # @file GCC response files |
| 6284 | # -tp=* Portland pgcc target processor selection |
| 6285 | # --sysroot=* for sysroot support |
| 6286 | # -O*, -flto*, -fwhopr*, -fuse-linker-plugin GCC link-time optimization |
| 6287 | # -stdlib=* select c++ std lib with clang |
| 6288 | -64|-mips[0-9]|-r[0-9][0-9]*|-xarch=*|-xtarget=*|+DA*|+DD*|-q*|-m*| \ |
| 6289 | -t[45]*|-txscale*|-p|-pg|--coverage|-fprofile-*|-F*|@*|-tp=*|--sysroot=*| \ |
| 6290 | -O*|-flto*|-fwhopr*|-fuse-linker-plugin|-stdlib=*) |
| 6291 | func_quote_for_eval "$arg" |
| 6292 | arg="$func_quote_for_eval_result" |
| 6293 | compile_command+=" $arg" |
| 6294 | finalize_command+=" $arg" |
| 6295 | compiler_flags+=" $arg" |
| 6296 | continue |
| 6297 | ;; |
| 6298 | |
| 6299 | # Some other compiler flag. |
| 6300 | -* | +*) |
| 6301 | func_quote_for_eval "$arg" |
| 6302 | arg="$func_quote_for_eval_result" |
| 6303 | ;; |
| 6304 | |
| 6305 | *.$objext) |
| 6306 | # A standard object. |
| 6307 | objs+=" $arg" |
| 6308 | ;; |
| 6309 | |
| 6310 | *.lo) |
| 6311 | # A libtool-controlled object. |
| 6312 | |
| 6313 | # Check to see that this really is a libtool object. |
| 6314 | if func_lalib_unsafe_p "$arg"; then |
| 6315 | pic_object= |
| 6316 | non_pic_object= |
| 6317 | |
| 6318 | # Read the .lo file |
| 6319 | func_source "$arg" |
| 6320 | |
| 6321 | if test -z "$pic_object" || |
| 6322 | test -z "$non_pic_object" || |
| 6323 | test "$pic_object" = none && |
| 6324 | test "$non_pic_object" = none; then |
| 6325 | func_fatal_error "cannot find name of object for \`$arg'" |
| 6326 | fi |
| 6327 | |
| 6328 | # Extract subdirectory from the argument. |
| 6329 | func_dirname "$arg" "/" "" |
| 6330 | xdir="$func_dirname_result" |
| 6331 | |
| 6332 | if test "$pic_object" != none; then |
| 6333 | # Prepend the subdirectory the object is found in. |
| 6334 | pic_object="$xdir$pic_object" |
| 6335 | |
| 6336 | if test "$prev" = dlfiles; then |
| 6337 | if test "$build_libtool_libs" = yes && test "$dlopen_support" = yes; then |
| 6338 | dlfiles+=" $pic_object" |
| 6339 | prev= |
| 6340 | continue |
| 6341 | else |
| 6342 | # If libtool objects are unsupported, then we need to preload. |
| 6343 | prev=dlprefiles |
| 6344 | fi |
| 6345 | fi |
| 6346 | |
| 6347 | # CHECK ME: I think I busted this. -Ossama |
| 6348 | if test "$prev" = dlprefiles; then |
| 6349 | # Preload the old-style object. |
| 6350 | dlprefiles+=" $pic_object" |
| 6351 | prev= |
| 6352 | fi |
| 6353 | |
| 6354 | # A PIC object. |
| 6355 | libobjs+=" $pic_object" |
| 6356 | arg="$pic_object" |
| 6357 | fi |
| 6358 | |
| 6359 | # Non-PIC object. |
| 6360 | if test "$non_pic_object" != none; then |
| 6361 | # Prepend the subdirectory the object is found in. |
| 6362 | non_pic_object="$xdir$non_pic_object" |
| 6363 | |
| 6364 | # A standard non-PIC object |
| 6365 | non_pic_objects+=" $non_pic_object" |
| 6366 | if test -z "$pic_object" || test "$pic_object" = none ; then |
| 6367 | arg="$non_pic_object" |
| 6368 | fi |
| 6369 | else |
| 6370 | # If the PIC object exists, use it instead. |
| 6371 | # $xdir was prepended to $pic_object above. |
| 6372 | non_pic_object="$pic_object" |
| 6373 | non_pic_objects+=" $non_pic_object" |
| 6374 | fi |
| 6375 | else |
| 6376 | # Only an error if not doing a dry-run. |
| 6377 | if $opt_dry_run; then |
| 6378 | # Extract subdirectory from the argument. |
| 6379 | func_dirname "$arg" "/" "" |
| 6380 | xdir="$func_dirname_result" |
| 6381 | |
| 6382 | func_lo2o "$arg" |
| 6383 | pic_object=$xdir$objdir/$func_lo2o_result |
| 6384 | non_pic_object=$xdir$func_lo2o_result |
| 6385 | libobjs+=" $pic_object" |
| 6386 | non_pic_objects+=" $non_pic_object" |
| 6387 | else |
| 6388 | func_fatal_error "\`$arg' is not a valid libtool object" |
| 6389 | fi |
| 6390 | fi |
| 6391 | ;; |
| 6392 | |
| 6393 | *.$libext) |
| 6394 | # An archive. |
| 6395 | deplibs+=" $arg" |
| 6396 | old_deplibs+=" $arg" |
| 6397 | continue |
| 6398 | ;; |
| 6399 | |
| 6400 | *.la) |
| 6401 | # A libtool-controlled library. |
| 6402 | |
| 6403 | func_resolve_sysroot "$arg" |
| 6404 | if test "$prev" = dlfiles; then |
| 6405 | # This library was specified with -dlopen. |
| 6406 | dlfiles+=" $func_resolve_sysroot_result" |
| 6407 | prev= |
| 6408 | elif test "$prev" = dlprefiles; then |
| 6409 | # The library was specified with -dlpreopen. |
| 6410 | dlprefiles+=" $func_resolve_sysroot_result" |
| 6411 | prev= |
| 6412 | else |
| 6413 | deplibs+=" $func_resolve_sysroot_result" |
| 6414 | fi |
| 6415 | continue |
| 6416 | ;; |
| 6417 | |
| 6418 | # Some other compiler argument. |
| 6419 | *) |
| 6420 | # Unknown arguments in both finalize_command and compile_command need |
| 6421 | # to be aesthetically quoted because they are evaled later. |
| 6422 | func_quote_for_eval "$arg" |
| 6423 | arg="$func_quote_for_eval_result" |
| 6424 | ;; |
| 6425 | esac # arg |
| 6426 | |
| 6427 | # Now actually substitute the argument into the commands. |
| 6428 | if test -n "$arg"; then |
| 6429 | compile_command+=" $arg" |
| 6430 | finalize_command+=" $arg" |
| 6431 | fi |
| 6432 | done # argument parsing loop |
| 6433 | |
| 6434 | test -n "$prev" && \ |
| 6435 | func_fatal_help "the \`$prevarg' option requires an argument" |
| 6436 | |
| 6437 | if test "$export_dynamic" = yes && test -n "$export_dynamic_flag_spec"; then |
| 6438 | eval arg=\"$export_dynamic_flag_spec\" |
| 6439 | compile_command+=" $arg" |
| 6440 | finalize_command+=" $arg" |
| 6441 | fi |
| 6442 | |
| 6443 | oldlibs= |
| 6444 | # calculate the name of the file, without its directory |
| 6445 | func_basename "$output" |
| 6446 | outputname="$func_basename_result" |
| 6447 | libobjs_save="$libobjs" |
| 6448 | |
| 6449 | if test -n "$shlibpath_var"; then |
| 6450 | # get the directories listed in $shlibpath_var |
| 6451 | eval shlib_search_path=\`\$ECHO \"\${$shlibpath_var}\" \| \$SED \'s/:/ /g\'\` |
| 6452 | else |
| 6453 | shlib_search_path= |
| 6454 | fi |
| 6455 | eval sys_lib_search_path=\"$sys_lib_search_path_spec\" |
| 6456 | eval sys_lib_dlsearch_path=\"$sys_lib_dlsearch_path_spec\" |
| 6457 | |
| 6458 | func_dirname "$output" "/" "" |
| 6459 | output_objdir="$func_dirname_result$objdir" |
| 6460 | func_to_tool_file "$output_objdir/" |
| 6461 | tool_output_objdir=$func_to_tool_file_result |
| 6462 | # Create the object directory. |
| 6463 | func_mkdir_p "$output_objdir" |
| 6464 | |
| 6465 | # Determine the type of output |
| 6466 | case $output in |
| 6467 | "") |
| 6468 | func_fatal_help "you must specify an output file" |
| 6469 | ;; |
| 6470 | *.$libext) linkmode=oldlib ;; |
| 6471 | *.lo | *.$objext) linkmode=obj ;; |
| 6472 | *.la) linkmode=lib ;; |
| 6473 | *) linkmode=prog ;; # Anything else should be a program. |
| 6474 | esac |
| 6475 | |
| 6476 | specialdeplibs= |
| 6477 | |
| 6478 | libs= |
| 6479 | # Find all interdependent deplibs by searching for libraries |
| 6480 | # that are linked more than once (e.g. -la -lb -la) |
| 6481 | for deplib in $deplibs; do |
| 6482 | if $opt_preserve_dup_deps ; then |
| 6483 | case "$libs " in |
| 6484 | *" $deplib "*) specialdeplibs+=" $deplib" ;; |
| 6485 | esac |
| 6486 | fi |
| 6487 | libs+=" $deplib" |
| 6488 | done |
| 6489 | |
| 6490 | if test "$linkmode" = lib; then |
| 6491 | libs="$predeps $libs $compiler_lib_search_path $postdeps" |
| 6492 | |
| 6493 | # Compute libraries that are listed more than once in $predeps |
| 6494 | # $postdeps and mark them as special (i.e., whose duplicates are |
| 6495 | # not to be eliminated). |
| 6496 | pre_post_deps= |
| 6497 | if $opt_duplicate_compiler_generated_deps; then |
| 6498 | for pre_post_dep in $predeps $postdeps; do |
| 6499 | case "$pre_post_deps " in |
| 6500 | *" $pre_post_dep "*) specialdeplibs+=" $pre_post_deps" ;; |
| 6501 | esac |
| 6502 | pre_post_deps+=" $pre_post_dep" |
| 6503 | done |
| 6504 | fi |
| 6505 | pre_post_deps= |
| 6506 | fi |
| 6507 | |
| 6508 | deplibs= |
| 6509 | newdependency_libs= |
| 6510 | newlib_search_path= |
| 6511 | need_relink=no # whether we're linking any uninstalled libtool libraries |
| 6512 | notinst_deplibs= # not-installed libtool libraries |
| 6513 | notinst_path= # paths that contain not-installed libtool libraries |
| 6514 | |
| 6515 | case $linkmode in |
| 6516 | lib) |
| 6517 | passes="conv dlpreopen link" |
| 6518 | for file in $dlfiles $dlprefiles; do |
| 6519 | case $file in |
| 6520 | *.la) ;; |
| 6521 | *) |
| 6522 | func_fatal_help "libraries can \`-dlopen' only libtool libraries: $file" |
| 6523 | ;; |
| 6524 | esac |
| 6525 | done |
| 6526 | ;; |
| 6527 | prog) |
| 6528 | compile_deplibs= |
| 6529 | finalize_deplibs= |
| 6530 | alldeplibs=no |
| 6531 | newdlfiles= |
| 6532 | newdlprefiles= |
| 6533 | passes="conv scan dlopen dlpreopen link" |
| 6534 | ;; |
| 6535 | *) passes="conv" |
| 6536 | ;; |
| 6537 | esac |
| 6538 | |
| 6539 | for pass in $passes; do |
| 6540 | # The preopen pass in lib mode reverses $deplibs; put it back here |
| 6541 | # so that -L comes before libs that need it for instance... |
| 6542 | if test "$linkmode,$pass" = "lib,link"; then |
| 6543 | ## FIXME: Find the place where the list is rebuilt in the wrong |
| 6544 | ## order, and fix it there properly |
| 6545 | tmp_deplibs= |
| 6546 | for deplib in $deplibs; do |
| 6547 | tmp_deplibs="$deplib $tmp_deplibs" |
| 6548 | done |
| 6549 | deplibs="$tmp_deplibs" |
| 6550 | fi |
| 6551 | |
| 6552 | if test "$linkmode,$pass" = "lib,link" || |
| 6553 | test "$linkmode,$pass" = "prog,scan"; then |
| 6554 | libs="$deplibs" |
| 6555 | deplibs= |
| 6556 | fi |
| 6557 | if test "$linkmode" = prog; then |
| 6558 | case $pass in |
| 6559 | dlopen) libs="$dlfiles" ;; |
| 6560 | dlpreopen) libs="$dlprefiles" ;; |
| 6561 | link) libs="$deplibs %DEPLIBS% $dependency_libs" ;; |
| 6562 | esac |
| 6563 | fi |
| 6564 | if test "$linkmode,$pass" = "lib,dlpreopen"; then |
| 6565 | # Collect and forward deplibs of preopened libtool libs |
| 6566 | for lib in $dlprefiles; do |
| 6567 | # Ignore non-libtool-libs |
| 6568 | dependency_libs= |
| 6569 | func_resolve_sysroot "$lib" |
| 6570 | case $lib in |
| 6571 | *.la) func_source "$func_resolve_sysroot_result" ;; |
| 6572 | esac |
| 6573 | |
| 6574 | # Collect preopened libtool deplibs, except any this library |
| 6575 | # has declared as weak libs |
| 6576 | for deplib in $dependency_libs; do |
| 6577 | func_basename "$deplib" |
| 6578 | deplib_base=$func_basename_result |
| 6579 | case " $weak_libs " in |
| 6580 | *" $deplib_base "*) ;; |
| 6581 | *) deplibs+=" $deplib" ;; |
| 6582 | esac |
| 6583 | done |
| 6584 | done |
| 6585 | libs="$dlprefiles" |
| 6586 | fi |
| 6587 | if test "$pass" = dlopen; then |
| 6588 | # Collect dlpreopened libraries |
| 6589 | save_deplibs="$deplibs" |
| 6590 | deplibs= |
| 6591 | fi |
| 6592 | |
| 6593 | for deplib in $libs; do |
| 6594 | lib= |
| 6595 | found=no |
| 6596 | case $deplib in |
| 6597 | -mt|-mthreads|-kthread|-Kthread|-pthread|-pthreads|--thread-safe \ |
| 6598 | |-threads|-fopenmp|-openmp|-mp|-xopenmp|-omp|-qsmp=*) |
| 6599 | if test "$linkmode,$pass" = "prog,link"; then |
| 6600 | compile_deplibs="$deplib $compile_deplibs" |
| 6601 | finalize_deplibs="$deplib $finalize_deplibs" |
| 6602 | else |
| 6603 | compiler_flags+=" $deplib" |
| 6604 | if test "$linkmode" = lib ; then |
| 6605 | case "$new_inherited_linker_flags " in |
| 6606 | *" $deplib "*) ;; |
| 6607 | * ) new_inherited_linker_flags+=" $deplib" ;; |
| 6608 | esac |
| 6609 | fi |
| 6610 | fi |
| 6611 | continue |
| 6612 | ;; |
| 6613 | -l*) |
| 6614 | if test "$linkmode" != lib && test "$linkmode" != prog; then |
| 6615 | func_warning "\`-l' is ignored for archives/objects" |
| 6616 | continue |
| 6617 | fi |
| 6618 | func_stripname '-l' '' "$deplib" |
| 6619 | name=$func_stripname_result |
| 6620 | if test "$linkmode" = lib; then |
| 6621 | searchdirs="$newlib_search_path $lib_search_path $compiler_lib_search_dirs $sys_lib_search_path $shlib_search_path" |
| 6622 | else |
| 6623 | searchdirs="$newlib_search_path $lib_search_path $sys_lib_search_path $shlib_search_path" |
| 6624 | fi |
| 6625 | for searchdir in $searchdirs; do |
| 6626 | for search_ext in .la $std_shrext .so .a; do |
| 6627 | # Search the libtool library |
| 6628 | lib="$searchdir/lib${name}${search_ext}" |
| 6629 | if test -f "$lib"; then |
| 6630 | if test "$search_ext" = ".la"; then |
| 6631 | found=yes |
| 6632 | else |
| 6633 | found=no |
| 6634 | fi |
| 6635 | break 2 |
| 6636 | fi |
| 6637 | done |
| 6638 | done |
| 6639 | if test "$found" != yes; then |
| 6640 | # deplib doesn't seem to be a libtool library |
| 6641 | if test "$linkmode,$pass" = "prog,link"; then |
| 6642 | compile_deplibs="$deplib $compile_deplibs" |
| 6643 | finalize_deplibs="$deplib $finalize_deplibs" |
| 6644 | else |
| 6645 | deplibs="$deplib $deplibs" |
| 6646 | test "$linkmode" = lib && newdependency_libs="$deplib $newdependency_libs" |
| 6647 | fi |
| 6648 | continue |
| 6649 | else # deplib is a libtool library |
| 6650 | # If $allow_libtool_libs_with_static_runtimes && $deplib is a stdlib, |
| 6651 | # We need to do some special things here, and not later. |
| 6652 | if test "X$allow_libtool_libs_with_static_runtimes" = "Xyes" ; then |
| 6653 | case " $predeps $postdeps " in |
| 6654 | *" $deplib "*) |
| 6655 | if func_lalib_p "$lib"; then |
| 6656 | library_names= |
| 6657 | old_library= |
| 6658 | func_source "$lib" |
| 6659 | for l in $old_library $library_names; do |
| 6660 | ll="$l" |
| 6661 | done |
| 6662 | if test "X$ll" = "X$old_library" ; then # only static version available |
| 6663 | found=no |
| 6664 | func_dirname "$lib" "" "." |
| 6665 | ladir="$func_dirname_result" |
| 6666 | lib=$ladir/$old_library |
| 6667 | if test "$linkmode,$pass" = "prog,link"; then |
| 6668 | compile_deplibs="$deplib $compile_deplibs" |
| 6669 | finalize_deplibs="$deplib $finalize_deplibs" |
| 6670 | else |
| 6671 | deplibs="$deplib $deplibs" |
| 6672 | test "$linkmode" = lib && newdependency_libs="$deplib $newdependency_libs" |
| 6673 | fi |
| 6674 | continue |
| 6675 | fi |
| 6676 | fi |
| 6677 | ;; |
| 6678 | *) ;; |
| 6679 | esac |
| 6680 | fi |
| 6681 | fi |
| 6682 | ;; # -l |
| 6683 | *.ltframework) |
| 6684 | if test "$linkmode,$pass" = "prog,link"; then |
| 6685 | compile_deplibs="$deplib $compile_deplibs" |
| 6686 | finalize_deplibs="$deplib $finalize_deplibs" |
| 6687 | else |
| 6688 | deplibs="$deplib $deplibs" |
| 6689 | if test "$linkmode" = lib ; then |
| 6690 | case "$new_inherited_linker_flags " in |
| 6691 | *" $deplib "*) ;; |
| 6692 | * ) new_inherited_linker_flags+=" $deplib" ;; |
| 6693 | esac |
| 6694 | fi |
| 6695 | fi |
| 6696 | continue |
| 6697 | ;; |
| 6698 | -L*) |
| 6699 | case $linkmode in |
| 6700 | lib) |
| 6701 | deplibs="$deplib $deplibs" |
| 6702 | test "$pass" = conv && continue |
| 6703 | newdependency_libs="$deplib $newdependency_libs" |
| 6704 | func_stripname '-L' '' "$deplib" |
| 6705 | func_resolve_sysroot "$func_stripname_result" |
| 6706 | newlib_search_path+=" $func_resolve_sysroot_result" |
| 6707 | ;; |
| 6708 | prog) |
| 6709 | if test "$pass" = conv; then |
| 6710 | deplibs="$deplib $deplibs" |
| 6711 | continue |
| 6712 | fi |
| 6713 | if test "$pass" = scan; then |
| 6714 | deplibs="$deplib $deplibs" |
| 6715 | else |
| 6716 | compile_deplibs="$deplib $compile_deplibs" |
| 6717 | finalize_deplibs="$deplib $finalize_deplibs" |
| 6718 | fi |
| 6719 | func_stripname '-L' '' "$deplib" |
| 6720 | func_resolve_sysroot "$func_stripname_result" |
| 6721 | newlib_search_path+=" $func_resolve_sysroot_result" |
| 6722 | ;; |
| 6723 | *) |
| 6724 | func_warning "\`-L' is ignored for archives/objects" |
| 6725 | ;; |
| 6726 | esac # linkmode |
| 6727 | continue |
| 6728 | ;; # -L |
| 6729 | -R*) |
| 6730 | if test "$pass" = link; then |
| 6731 | func_stripname '-R' '' "$deplib" |
| 6732 | func_resolve_sysroot "$func_stripname_result" |
| 6733 | dir=$func_resolve_sysroot_result |
| 6734 | # Make sure the xrpath contains only unique directories. |
| 6735 | case "$xrpath " in |
| 6736 | *" $dir "*) ;; |
| 6737 | *) xrpath+=" $dir" ;; |
| 6738 | esac |
| 6739 | fi |
| 6740 | deplibs="$deplib $deplibs" |
| 6741 | continue |
| 6742 | ;; |
| 6743 | *.la) |
| 6744 | func_resolve_sysroot "$deplib" |
| 6745 | lib=$func_resolve_sysroot_result |
| 6746 | ;; |
| 6747 | *.$libext) |
| 6748 | if test "$pass" = conv; then |
| 6749 | deplibs="$deplib $deplibs" |
| 6750 | continue |
| 6751 | fi |
| 6752 | case $linkmode in |
| 6753 | lib) |
| 6754 | # Linking convenience modules into shared libraries is allowed, |
| 6755 | # but linking other static libraries is non-portable. |
| 6756 | case " $dlpreconveniencelibs " in |
| 6757 | *" $deplib "*) ;; |
| 6758 | *) |
| 6759 | valid_a_lib=no |
| 6760 | case $deplibs_check_method in |
| 6761 | match_pattern*) |
| 6762 | set dummy $deplibs_check_method; shift |
| 6763 | match_pattern_regex=`expr "$deplibs_check_method" : "$1 \(.*\)"` |
| 6764 | if eval "\$ECHO \"$deplib\"" 2>/dev/null | $SED 10q \ |
| 6765 | | $EGREP "$match_pattern_regex" > /dev/null; then |
| 6766 | valid_a_lib=yes |
| 6767 | fi |
| 6768 | ;; |
| 6769 | pass_all) |
| 6770 | valid_a_lib=yes |
| 6771 | ;; |
| 6772 | esac |
| 6773 | if test "$valid_a_lib" != yes; then |
| 6774 | echo |
| 6775 | $ECHO "*** Warning: Trying to link with static lib archive $deplib." |
| 6776 | echo "*** I have the capability to make that library automatically link in when" |
| 6777 | echo "*** you link to this library. But I can only do this if you have a" |
| 6778 | echo "*** shared version of the library, which you do not appear to have" |
| 6779 | echo "*** because the file extensions .$libext of this argument makes me believe" |
| 6780 | echo "*** that it is just a static archive that I should not use here." |
| 6781 | else |
| 6782 | echo |
| 6783 | $ECHO "*** Warning: Linking the shared library $output against the" |
| 6784 | $ECHO "*** static library $deplib is not portable!" |
| 6785 | deplibs="$deplib $deplibs" |
| 6786 | fi |
| 6787 | ;; |
| 6788 | esac |
| 6789 | continue |
| 6790 | ;; |
| 6791 | prog) |
| 6792 | if test "$pass" != link; then |
| 6793 | deplibs="$deplib $deplibs" |
| 6794 | else |
| 6795 | compile_deplibs="$deplib $compile_deplibs" |
| 6796 | finalize_deplibs="$deplib $finalize_deplibs" |
| 6797 | fi |
| 6798 | continue |
| 6799 | ;; |
| 6800 | esac # linkmode |
| 6801 | ;; # *.$libext |
| 6802 | *.lo | *.$objext) |
| 6803 | if test "$pass" = conv; then |
| 6804 | deplibs="$deplib $deplibs" |
| 6805 | elif test "$linkmode" = prog; then |
| 6806 | if test "$pass" = dlpreopen || test "$dlopen_support" != yes || test "$build_libtool_libs" = no; then |
| 6807 | # If there is no dlopen support or we're linking statically, |
| 6808 | # we need to preload. |
| 6809 | newdlprefiles+=" $deplib" |
| 6810 | compile_deplibs="$deplib $compile_deplibs" |
| 6811 | finalize_deplibs="$deplib $finalize_deplibs" |
| 6812 | else |
| 6813 | newdlfiles+=" $deplib" |
| 6814 | fi |
| 6815 | fi |
| 6816 | continue |
| 6817 | ;; |
| 6818 | %DEPLIBS%) |
| 6819 | alldeplibs=yes |
| 6820 | continue |
| 6821 | ;; |
| 6822 | esac # case $deplib |
| 6823 | |
| 6824 | if test "$found" = yes || test -f "$lib"; then : |
| 6825 | else |
| 6826 | func_fatal_error "cannot find the library \`$lib' or unhandled argument \`$deplib'" |
| 6827 | fi |
| 6828 | |
| 6829 | # Check to see that this really is a libtool archive. |
| 6830 | func_lalib_unsafe_p "$lib" \ |
| 6831 | || func_fatal_error "\`$lib' is not a valid libtool archive" |
| 6832 | |
| 6833 | func_dirname "$lib" "" "." |
| 6834 | ladir="$func_dirname_result" |
| 6835 | |
| 6836 | dlname= |
| 6837 | dlopen= |
| 6838 | dlpreopen= |
| 6839 | libdir= |
| 6840 | library_names= |
| 6841 | old_library= |
| 6842 | inherited_linker_flags= |
| 6843 | # If the library was installed with an old release of libtool, |
| 6844 | # it will not redefine variables installed, or shouldnotlink |
| 6845 | installed=yes |
| 6846 | shouldnotlink=no |
| 6847 | avoidtemprpath= |
| 6848 | |
| 6849 | |
| 6850 | # Read the .la file |
| 6851 | func_source "$lib" |
| 6852 | |
| 6853 | # Convert "-framework foo" to "foo.ltframework" |
| 6854 | if test -n "$inherited_linker_flags"; then |
| 6855 | tmp_inherited_linker_flags=`$ECHO "$inherited_linker_flags" | $SED 's/-framework \([^ $]*\)/\1.ltframework/g'` |
| 6856 | for tmp_inherited_linker_flag in $tmp_inherited_linker_flags; do |
| 6857 | case " $new_inherited_linker_flags " in |
| 6858 | *" $tmp_inherited_linker_flag "*) ;; |
| 6859 | *) new_inherited_linker_flags+=" $tmp_inherited_linker_flag";; |
| 6860 | esac |
| 6861 | done |
| 6862 | fi |
| 6863 | dependency_libs=`$ECHO " $dependency_libs" | $SED 's% \([^ $]*\).ltframework% -framework \1%g'` |
| 6864 | if test "$linkmode,$pass" = "lib,link" || |
| 6865 | test "$linkmode,$pass" = "prog,scan" || |
| 6866 | { test "$linkmode" != prog && test "$linkmode" != lib; }; then |
| 6867 | test -n "$dlopen" && dlfiles+=" $dlopen" |
| 6868 | test -n "$dlpreopen" && dlprefiles+=" $dlpreopen" |
| 6869 | fi |
| 6870 | |
| 6871 | if test "$pass" = conv; then |
| 6872 | # Only check for convenience libraries |
| 6873 | deplibs="$lib $deplibs" |
| 6874 | if test -z "$libdir"; then |
| 6875 | if test -z "$old_library"; then |
| 6876 | func_fatal_error "cannot find name of link library for \`$lib'" |
| 6877 | fi |
| 6878 | # It is a libtool convenience library, so add in its objects. |
| 6879 | convenience+=" $ladir/$objdir/$old_library" |
| 6880 | old_convenience+=" $ladir/$objdir/$old_library" |
| 6881 | elif test "$linkmode" != prog && test "$linkmode" != lib; then |
| 6882 | func_fatal_error "\`$lib' is not a convenience library" |
| 6883 | fi |
| 6884 | tmp_libs= |
| 6885 | for deplib in $dependency_libs; do |
| 6886 | deplibs="$deplib $deplibs" |
| 6887 | if $opt_preserve_dup_deps ; then |
| 6888 | case "$tmp_libs " in |
| 6889 | *" $deplib "*) specialdeplibs+=" $deplib" ;; |
| 6890 | esac |
| 6891 | fi |
| 6892 | tmp_libs+=" $deplib" |
| 6893 | done |
| 6894 | continue |
| 6895 | fi # $pass = conv |
| 6896 | |
| 6897 | |
| 6898 | # Get the name of the library we link against. |
| 6899 | linklib= |
| 6900 | if test -n "$old_library" && |
| 6901 | { test "$prefer_static_libs" = yes || |
| 6902 | test "$prefer_static_libs,$installed" = "built,no"; }; then |
| 6903 | linklib=$old_library |
| 6904 | else |
| 6905 | for l in $old_library $library_names; do |
| 6906 | linklib="$l" |
| 6907 | done |
| 6908 | fi |
| 6909 | if test -z "$linklib"; then |
| 6910 | func_fatal_error "cannot find name of link library for \`$lib'" |
| 6911 | fi |
| 6912 | |
| 6913 | # This library was specified with -dlopen. |
| 6914 | if test "$pass" = dlopen; then |
| 6915 | if test -z "$libdir"; then |
| 6916 | func_fatal_error "cannot -dlopen a convenience library: \`$lib'" |
| 6917 | fi |
| 6918 | if test -z "$dlname" || |
| 6919 | test "$dlopen_support" != yes || |
| 6920 | test "$build_libtool_libs" = no; then |
| 6921 | # If there is no dlname, no dlopen support or we're linking |
| 6922 | # statically, we need to preload. We also need to preload any |
| 6923 | # dependent libraries so libltdl's deplib preloader doesn't |
| 6924 | # bomb out in the load deplibs phase. |
| 6925 | dlprefiles+=" $lib $dependency_libs" |
| 6926 | else |
| 6927 | newdlfiles+=" $lib" |
| 6928 | fi |
| 6929 | continue |
| 6930 | fi # $pass = dlopen |
| 6931 | |
| 6932 | # We need an absolute path. |
| 6933 | case $ladir in |
| 6934 | [\\/]* | [A-Za-z]:[\\/]*) abs_ladir="$ladir" ;; |
| 6935 | *) |
| 6936 | abs_ladir=`cd "$ladir" && pwd` |
| 6937 | if test -z "$abs_ladir"; then |
| 6938 | func_warning "cannot determine absolute directory name of \`$ladir'" |
| 6939 | func_warning "passing it literally to the linker, although it might fail" |
| 6940 | abs_ladir="$ladir" |
| 6941 | fi |
| 6942 | ;; |
| 6943 | esac |
| 6944 | func_basename "$lib" |
| 6945 | laname="$func_basename_result" |
| 6946 | |
| 6947 | # Find the relevant object directory and library name. |
| 6948 | if test "X$installed" = Xyes; then |
| 6949 | if test ! -f "$lt_sysroot$libdir/$linklib" && test -f "$abs_ladir/$linklib"; then |
| 6950 | func_warning "library \`$lib' was moved." |
| 6951 | dir="$ladir" |
| 6952 | absdir="$abs_ladir" |
| 6953 | libdir="$abs_ladir" |
| 6954 | else |
| 6955 | dir="$lt_sysroot$libdir" |
| 6956 | absdir="$lt_sysroot$libdir" |
| 6957 | fi |
| 6958 | test "X$hardcode_automatic" = Xyes && avoidtemprpath=yes |
| 6959 | else |
| 6960 | if test ! -f "$ladir/$objdir/$linklib" && test -f "$abs_ladir/$linklib"; then |
| 6961 | dir="$ladir" |
| 6962 | absdir="$abs_ladir" |
| 6963 | # Remove this search path later |
| 6964 | notinst_path+=" $abs_ladir" |
| 6965 | else |
| 6966 | dir="$ladir/$objdir" |
| 6967 | absdir="$abs_ladir/$objdir" |
| 6968 | # Remove this search path later |
| 6969 | notinst_path+=" $abs_ladir" |
| 6970 | fi |
| 6971 | fi # $installed = yes |
| 6972 | func_stripname 'lib' '.la' "$laname" |
| 6973 | name=$func_stripname_result |
| 6974 | |
| 6975 | # This library was specified with -dlpreopen. |
| 6976 | if test "$pass" = dlpreopen; then |
| 6977 | if test -z "$libdir" && test "$linkmode" = prog; then |
| 6978 | func_fatal_error "only libraries may -dlpreopen a convenience library: \`$lib'" |
| 6979 | fi |
| 6980 | case "$host" in |
| 6981 | # special handling for platforms with PE-DLLs. |
| 6982 | *cygwin* | *mingw* | *cegcc* ) |
| 6983 | # Linker will automatically link against shared library if both |
| 6984 | # static and shared are present. Therefore, ensure we extract |
| 6985 | # symbols from the import library if a shared library is present |
| 6986 | # (otherwise, the dlopen module name will be incorrect). We do |
| 6987 | # this by putting the import library name into $newdlprefiles. |
| 6988 | # We recover the dlopen module name by 'saving' the la file |
| 6989 | # name in a special purpose variable, and (later) extracting the |
| 6990 | # dlname from the la file. |
| 6991 | if test -n "$dlname"; then |
| 6992 | func_tr_sh "$dir/$linklib" |
| 6993 | eval "libfile_$func_tr_sh_result=\$abs_ladir/\$laname" |
| 6994 | newdlprefiles+=" $dir/$linklib" |
| 6995 | else |
| 6996 | newdlprefiles+=" $dir/$old_library" |
| 6997 | # Keep a list of preopened convenience libraries to check |
| 6998 | # that they are being used correctly in the link pass. |
| 6999 | test -z "$libdir" && \ |
| 7000 | dlpreconveniencelibs+=" $dir/$old_library" |
| 7001 | fi |
| 7002 | ;; |
| 7003 | * ) |
| 7004 | # Prefer using a static library (so that no silly _DYNAMIC symbols |
| 7005 | # are required to link). |
| 7006 | if test -n "$old_library"; then |
| 7007 | newdlprefiles+=" $dir/$old_library" |
| 7008 | # Keep a list of preopened convenience libraries to check |
| 7009 | # that they are being used correctly in the link pass. |
| 7010 | test -z "$libdir" && \ |
| 7011 | dlpreconveniencelibs+=" $dir/$old_library" |
| 7012 | # Otherwise, use the dlname, so that lt_dlopen finds it. |
| 7013 | elif test -n "$dlname"; then |
| 7014 | newdlprefiles+=" $dir/$dlname" |
| 7015 | else |
| 7016 | newdlprefiles+=" $dir/$linklib" |
| 7017 | fi |
| 7018 | ;; |
| 7019 | esac |
| 7020 | fi # $pass = dlpreopen |
| 7021 | |
| 7022 | if test -z "$libdir"; then |
| 7023 | # Link the convenience library |
| 7024 | if test "$linkmode" = lib; then |
| 7025 | deplibs="$dir/$old_library $deplibs" |
| 7026 | elif test "$linkmode,$pass" = "prog,link"; then |
| 7027 | compile_deplibs="$dir/$old_library $compile_deplibs" |
| 7028 | finalize_deplibs="$dir/$old_library $finalize_deplibs" |
| 7029 | else |
| 7030 | deplibs="$lib $deplibs" # used for prog,scan pass |
| 7031 | fi |
| 7032 | continue |
| 7033 | fi |
| 7034 | |
| 7035 | |
| 7036 | if test "$linkmode" = prog && test "$pass" != link; then |
| 7037 | newlib_search_path+=" $ladir" |
| 7038 | deplibs="$lib $deplibs" |
| 7039 | |
| 7040 | linkalldeplibs=no |
| 7041 | if test "$link_all_deplibs" != no || test -z "$library_names" || |
| 7042 | test "$build_libtool_libs" = no; then |
| 7043 | linkalldeplibs=yes |
| 7044 | fi |
| 7045 | |
| 7046 | tmp_libs= |
| 7047 | for deplib in $dependency_libs; do |
| 7048 | case $deplib in |
| 7049 | -L*) func_stripname '-L' '' "$deplib" |
| 7050 | func_resolve_sysroot "$func_stripname_result" |
| 7051 | newlib_search_path+=" $func_resolve_sysroot_result" |
| 7052 | ;; |
| 7053 | esac |
| 7054 | # Need to link against all dependency_libs? |
| 7055 | if test "$linkalldeplibs" = yes; then |
| 7056 | deplibs="$deplib $deplibs" |
| 7057 | else |
| 7058 | # Need to hardcode shared library paths |
| 7059 | # or/and link against static libraries |
| 7060 | newdependency_libs="$deplib $newdependency_libs" |
| 7061 | fi |
| 7062 | if $opt_preserve_dup_deps ; then |
| 7063 | case "$tmp_libs " in |
| 7064 | *" $deplib "*) specialdeplibs+=" $deplib" ;; |
| 7065 | esac |
| 7066 | fi |
| 7067 | tmp_libs+=" $deplib" |
| 7068 | done # for deplib |
| 7069 | continue |
| 7070 | fi # $linkmode = prog... |
| 7071 | |
| 7072 | if test "$linkmode,$pass" = "prog,link"; then |
| 7073 | if test -n "$library_names" && |
| 7074 | { { test "$prefer_static_libs" = no || |
| 7075 | test "$prefer_static_libs,$installed" = "built,yes"; } || |
| 7076 | test -z "$old_library"; }; then |
| 7077 | # We need to hardcode the library path |
| 7078 | if test -n "$shlibpath_var" && test -z "$avoidtemprpath" ; then |
| 7079 | # Make sure the rpath contains only unique directories. |
| 7080 | case "$temp_rpath:" in |
| 7081 | *"$absdir:"*) ;; |
| 7082 | *) temp_rpath+="$absdir:" ;; |
| 7083 | esac |
| 7084 | fi |
| 7085 | |
| 7086 | # Hardcode the library path. |
| 7087 | # Skip directories that are in the system default run-time |
| 7088 | # search path. |
| 7089 | case " $sys_lib_dlsearch_path " in |
| 7090 | *" $absdir "*) ;; |
| 7091 | *) |
| 7092 | case "$compile_rpath " in |
| 7093 | *" $absdir "*) ;; |
| 7094 | *) compile_rpath+=" $absdir" ;; |
| 7095 | esac |
| 7096 | ;; |
| 7097 | esac |
| 7098 | case " $sys_lib_dlsearch_path " in |
| 7099 | *" $libdir "*) ;; |
| 7100 | *) |
| 7101 | case "$finalize_rpath " in |
| 7102 | *" $libdir "*) ;; |
| 7103 | *) finalize_rpath+=" $libdir" ;; |
| 7104 | esac |
| 7105 | ;; |
| 7106 | esac |
| 7107 | fi # $linkmode,$pass = prog,link... |
| 7108 | |
| 7109 | if test "$alldeplibs" = yes && |
| 7110 | { test "$deplibs_check_method" = pass_all || |
| 7111 | { test "$build_libtool_libs" = yes && |
| 7112 | test -n "$library_names"; }; }; then |
| 7113 | # We only need to search for static libraries |
| 7114 | continue |
| 7115 | fi |
| 7116 | fi |
| 7117 | |
| 7118 | link_static=no # Whether the deplib will be linked statically |
| 7119 | use_static_libs=$prefer_static_libs |
| 7120 | if test "$use_static_libs" = built && test "$installed" = yes; then |
| 7121 | use_static_libs=no |
| 7122 | fi |
| 7123 | if test -n "$library_names" && |
| 7124 | { test "$use_static_libs" = no || test -z "$old_library"; }; then |
| 7125 | case $host in |
| 7126 | *cygwin* | *mingw* | *cegcc*) |
| 7127 | # No point in relinking DLLs because paths are not encoded |
| 7128 | notinst_deplibs+=" $lib" |
| 7129 | need_relink=no |
| 7130 | ;; |
| 7131 | *) |
| 7132 | if test "$installed" = no; then |
| 7133 | notinst_deplibs+=" $lib" |
| 7134 | need_relink=yes |
| 7135 | fi |
| 7136 | ;; |
| 7137 | esac |
| 7138 | # This is a shared library |
| 7139 | |
| 7140 | # Warn about portability, can't link against -module's on some |
| 7141 | # systems (darwin). Don't bleat about dlopened modules though! |
| 7142 | dlopenmodule="" |
| 7143 | for dlpremoduletest in $dlprefiles; do |
| 7144 | if test "X$dlpremoduletest" = "X$lib"; then |
| 7145 | dlopenmodule="$dlpremoduletest" |
| 7146 | break |
| 7147 | fi |
| 7148 | done |
| 7149 | if test -z "$dlopenmodule" && test "$shouldnotlink" = yes && test "$pass" = link; then |
| 7150 | echo |
| 7151 | if test "$linkmode" = prog; then |
| 7152 | $ECHO "*** Warning: Linking the executable $output against the loadable module" |
| 7153 | else |
| 7154 | $ECHO "*** Warning: Linking the shared library $output against the loadable module" |
| 7155 | fi |
| 7156 | $ECHO "*** $linklib is not portable!" |
| 7157 | fi |
| 7158 | if test "$linkmode" = lib && |
| 7159 | test "$hardcode_into_libs" = yes; then |
| 7160 | # Hardcode the library path. |
| 7161 | # Skip directories that are in the system default run-time |
| 7162 | # search path. |
| 7163 | case " $sys_lib_dlsearch_path " in |
| 7164 | *" $absdir "*) ;; |
| 7165 | *) |
| 7166 | case "$compile_rpath " in |
| 7167 | *" $absdir "*) ;; |
| 7168 | *) compile_rpath+=" $absdir" ;; |
| 7169 | esac |
| 7170 | ;; |
| 7171 | esac |
| 7172 | case " $sys_lib_dlsearch_path " in |
| 7173 | *" $libdir "*) ;; |
| 7174 | *) |
| 7175 | case "$finalize_rpath " in |
| 7176 | *" $libdir "*) ;; |
| 7177 | *) finalize_rpath+=" $libdir" ;; |
| 7178 | esac |
| 7179 | ;; |
| 7180 | esac |
| 7181 | fi |
| 7182 | |
| 7183 | if test -n "$old_archive_from_expsyms_cmds"; then |
| 7184 | # figure out the soname |
| 7185 | set dummy $library_names |
| 7186 | shift |
| 7187 | realname="$1" |
| 7188 | shift |
| 7189 | libname=`eval "\\$ECHO \"$libname_spec\""` |
| 7190 | # use dlname if we got it. it's perfectly good, no? |
| 7191 | if test -n "$dlname"; then |
| 7192 | soname="$dlname" |
| 7193 | elif test -n "$soname_spec"; then |
| 7194 | # bleh windows |
| 7195 | case $host in |
| 7196 | *cygwin* | mingw* | *cegcc*) |
| 7197 | func_arith $current - $age |
| 7198 | major=$func_arith_result |
| 7199 | versuffix="-$major" |
| 7200 | ;; |
| 7201 | esac |
| 7202 | eval soname=\"$soname_spec\" |
| 7203 | else |
| 7204 | soname="$realname" |
| 7205 | fi |
| 7206 | |
| 7207 | # Make a new name for the extract_expsyms_cmds to use |
| 7208 | soroot="$soname" |
| 7209 | func_basename "$soroot" |
| 7210 | soname="$func_basename_result" |
| 7211 | func_stripname 'lib' '.dll' "$soname" |
| 7212 | newlib=libimp-$func_stripname_result.a |
| 7213 | |
| 7214 | # If the library has no export list, then create one now |
| 7215 | if test -f "$output_objdir/$soname-def"; then : |
| 7216 | else |
| 7217 | func_verbose "extracting exported symbol list from \`$soname'" |
| 7218 | func_execute_cmds "$extract_expsyms_cmds" 'exit $?' |
| 7219 | fi |
| 7220 | |
| 7221 | # Create $newlib |
| 7222 | if test -f "$output_objdir/$newlib"; then :; else |
| 7223 | func_verbose "generating import library for \`$soname'" |
| 7224 | func_execute_cmds "$old_archive_from_expsyms_cmds" 'exit $?' |
| 7225 | fi |
| 7226 | # make sure the library variables are pointing to the new library |
| 7227 | dir=$output_objdir |
| 7228 | linklib=$newlib |
| 7229 | fi # test -n "$old_archive_from_expsyms_cmds" |
| 7230 | |
| 7231 | if test "$linkmode" = prog || test "$opt_mode" != relink; then |
| 7232 | add_shlibpath= |
| 7233 | add_dir= |
| 7234 | add= |
| 7235 | lib_linked=yes |
| 7236 | case $hardcode_action in |
| 7237 | immediate | unsupported) |
| 7238 | if test "$hardcode_direct" = no; then |
| 7239 | add="$dir/$linklib" |
| 7240 | case $host in |
| 7241 | *-*-sco3.2v5.0.[024]*) add_dir="-L$dir" ;; |
| 7242 | *-*-sysv4*uw2*) add_dir="-L$dir" ;; |
| 7243 | *-*-sysv5OpenUNIX* | *-*-sysv5UnixWare7.[01].[10]* | \ |
| 7244 | *-*-unixware7*) add_dir="-L$dir" ;; |
| 7245 | *-*-darwin* ) |
| 7246 | # if the lib is a (non-dlopened) module then we can not |
| 7247 | # link against it, someone is ignoring the earlier warnings |
| 7248 | if /usr/bin/file -L $add 2> /dev/null | |
| 7249 | $GREP ": [^:]* bundle" >/dev/null ; then |
| 7250 | if test "X$dlopenmodule" != "X$lib"; then |
| 7251 | $ECHO "*** Warning: lib $linklib is a module, not a shared library" |
| 7252 | if test -z "$old_library" ; then |
| 7253 | echo |
| 7254 | echo "*** And there doesn't seem to be a static archive available" |
| 7255 | echo "*** The link will probably fail, sorry" |
| 7256 | else |
| 7257 | add="$dir/$old_library" |
| 7258 | fi |
| 7259 | elif test -n "$old_library"; then |
| 7260 | add="$dir/$old_library" |
| 7261 | fi |
| 7262 | fi |
| 7263 | esac |
| 7264 | elif test "$hardcode_minus_L" = no; then |
| 7265 | case $host in |
| 7266 | *-*-sunos*) add_shlibpath="$dir" ;; |
| 7267 | esac |
| 7268 | add_dir="-L$dir" |
| 7269 | add="-l$name" |
| 7270 | elif test "$hardcode_shlibpath_var" = no; then |
| 7271 | add_shlibpath="$dir" |
| 7272 | add="-l$name" |
| 7273 | else |
| 7274 | lib_linked=no |
| 7275 | fi |
| 7276 | ;; |
| 7277 | relink) |
| 7278 | if test "$hardcode_direct" = yes && |
| 7279 | test "$hardcode_direct_absolute" = no; then |
| 7280 | add="$dir/$linklib" |
| 7281 | elif test "$hardcode_minus_L" = yes; then |
| 7282 | add_dir="-L$absdir" |
| 7283 | # Try looking first in the location we're being installed to. |
| 7284 | if test -n "$inst_prefix_dir"; then |
| 7285 | case $libdir in |
| 7286 | [\\/]*) |
| 7287 | add_dir+=" -L$inst_prefix_dir$libdir" |
| 7288 | ;; |
| 7289 | esac |
| 7290 | fi |
| 7291 | add="-l$name" |
| 7292 | elif test "$hardcode_shlibpath_var" = yes; then |
| 7293 | add_shlibpath="$dir" |
| 7294 | add="-l$name" |
| 7295 | else |
| 7296 | lib_linked=no |
| 7297 | fi |
| 7298 | ;; |
| 7299 | *) lib_linked=no ;; |
| 7300 | esac |
| 7301 | |
| 7302 | if test "$lib_linked" != yes; then |
| 7303 | func_fatal_configuration "unsupported hardcode properties" |
| 7304 | fi |
| 7305 | |
| 7306 | if test -n "$add_shlibpath"; then |
| 7307 | case :$compile_shlibpath: in |
| 7308 | *":$add_shlibpath:"*) ;; |
| 7309 | *) compile_shlibpath+="$add_shlibpath:" ;; |
| 7310 | esac |
| 7311 | fi |
| 7312 | if test "$linkmode" = prog; then |
| 7313 | test -n "$add_dir" && compile_deplibs="$add_dir $compile_deplibs" |
| 7314 | test -n "$add" && compile_deplibs="$add $compile_deplibs" |
| 7315 | else |
| 7316 | test -n "$add_dir" && deplibs="$add_dir $deplibs" |
| 7317 | test -n "$add" && deplibs="$add $deplibs" |
| 7318 | if test "$hardcode_direct" != yes && |
| 7319 | test "$hardcode_minus_L" != yes && |
| 7320 | test "$hardcode_shlibpath_var" = yes; then |
| 7321 | case :$finalize_shlibpath: in |
| 7322 | *":$libdir:"*) ;; |
| 7323 | *) finalize_shlibpath+="$libdir:" ;; |
| 7324 | esac |
| 7325 | fi |
| 7326 | fi |
| 7327 | fi |
| 7328 | |
| 7329 | if test "$linkmode" = prog || test "$opt_mode" = relink; then |
| 7330 | add_shlibpath= |
| 7331 | add_dir= |
| 7332 | add= |
| 7333 | # Finalize command for both is simple: just hardcode it. |
| 7334 | if test "$hardcode_direct" = yes && |
| 7335 | test "$hardcode_direct_absolute" = no; then |
| 7336 | add="$libdir/$linklib" |
| 7337 | elif test "$hardcode_minus_L" = yes; then |
| 7338 | add_dir="-L$libdir" |
| 7339 | add="-l$name" |
| 7340 | elif test "$hardcode_shlibpath_var" = yes; then |
| 7341 | case :$finalize_shlibpath: in |
| 7342 | *":$libdir:"*) ;; |
| 7343 | *) finalize_shlibpath+="$libdir:" ;; |
| 7344 | esac |
| 7345 | add="-l$name" |
| 7346 | elif test "$hardcode_automatic" = yes; then |
| 7347 | if test -n "$inst_prefix_dir" && |
| 7348 | test -f "$inst_prefix_dir$libdir/$linklib" ; then |
| 7349 | add="$inst_prefix_dir$libdir/$linklib" |
| 7350 | else |
| 7351 | add="$libdir/$linklib" |
| 7352 | fi |
| 7353 | else |
| 7354 | # We cannot seem to hardcode it, guess we'll fake it. |
| 7355 | add_dir="-L$libdir" |
| 7356 | # Try looking first in the location we're being installed to. |
| 7357 | if test -n "$inst_prefix_dir"; then |
| 7358 | case $libdir in |
| 7359 | [\\/]*) |
| 7360 | add_dir+=" -L$inst_prefix_dir$libdir" |
| 7361 | ;; |
| 7362 | esac |
| 7363 | fi |
| 7364 | add="-l$name" |
| 7365 | fi |
| 7366 | |
| 7367 | if test "$linkmode" = prog; then |
| 7368 | test -n "$add_dir" && finalize_deplibs="$add_dir $finalize_deplibs" |
| 7369 | test -n "$add" && finalize_deplibs="$add $finalize_deplibs" |
| 7370 | else |
| 7371 | test -n "$add_dir" && deplibs="$add_dir $deplibs" |
| 7372 | test -n "$add" && deplibs="$add $deplibs" |
| 7373 | fi |
| 7374 | fi |
| 7375 | elif test "$linkmode" = prog; then |
| 7376 | # Here we assume that one of hardcode_direct or hardcode_minus_L |
| 7377 | # is not unsupported. This is valid on all known static and |
| 7378 | # shared platforms. |
| 7379 | if test "$hardcode_direct" != unsupported; then |
| 7380 | test -n "$old_library" && linklib="$old_library" |
| 7381 | compile_deplibs="$dir/$linklib $compile_deplibs" |
| 7382 | finalize_deplibs="$dir/$linklib $finalize_deplibs" |
| 7383 | else |
| 7384 | compile_deplibs="-l$name -L$dir $compile_deplibs" |
| 7385 | finalize_deplibs="-l$name -L$dir $finalize_deplibs" |
| 7386 | fi |
| 7387 | elif test "$build_libtool_libs" = yes; then |
| 7388 | # Not a shared library |
| 7389 | if test "$deplibs_check_method" != pass_all; then |
| 7390 | # We're trying link a shared library against a static one |
| 7391 | # but the system doesn't support it. |
| 7392 | |
| 7393 | # Just print a warning and add the library to dependency_libs so |
| 7394 | # that the program can be linked against the static library. |
| 7395 | echo |
| 7396 | $ECHO "*** Warning: This system can not link to static lib archive $lib." |
| 7397 | echo "*** I have the capability to make that library automatically link in when" |
| 7398 | echo "*** you link to this library. But I can only do this if you have a" |
| 7399 | echo "*** shared version of the library, which you do not appear to have." |
| 7400 | if test "$module" = yes; then |
| 7401 | echo "*** But as you try to build a module library, libtool will still create " |
| 7402 | echo "*** a static module, that should work as long as the dlopening application" |
| 7403 | echo "*** is linked with the -dlopen flag to resolve symbols at runtime." |
| 7404 | if test -z "$global_symbol_pipe"; then |
| 7405 | echo |
| 7406 | echo "*** However, this would only work if libtool was able to extract symbol" |
| 7407 | echo "*** lists from a program, using \`nm' or equivalent, but libtool could" |
| 7408 | echo "*** not find such a program. So, this module is probably useless." |
| 7409 | echo "*** \`nm' from GNU binutils and a full rebuild may help." |
| 7410 | fi |
| 7411 | if test "$build_old_libs" = no; then |
| 7412 | build_libtool_libs=module |
| 7413 | build_old_libs=yes |
| 7414 | else |
| 7415 | build_libtool_libs=no |
| 7416 | fi |
| 7417 | fi |
| 7418 | else |
| 7419 | deplibs="$dir/$old_library $deplibs" |
| 7420 | link_static=yes |
| 7421 | fi |
| 7422 | fi # link shared/static library? |
| 7423 | |
| 7424 | if test "$linkmode" = lib; then |
| 7425 | if test -n "$dependency_libs" && |
| 7426 | { test "$hardcode_into_libs" != yes || |
| 7427 | test "$build_old_libs" = yes || |
| 7428 | test "$link_static" = yes; }; then |
| 7429 | # Extract -R from dependency_libs |
| 7430 | temp_deplibs= |
| 7431 | for libdir in $dependency_libs; do |
| 7432 | case $libdir in |
| 7433 | -R*) func_stripname '-R' '' "$libdir" |
| 7434 | temp_xrpath=$func_stripname_result |
| 7435 | case " $xrpath " in |
| 7436 | *" $temp_xrpath "*) ;; |
| 7437 | *) xrpath+=" $temp_xrpath";; |
| 7438 | esac;; |
| 7439 | *) temp_deplibs+=" $libdir";; |
| 7440 | esac |
| 7441 | done |
| 7442 | dependency_libs="$temp_deplibs" |
| 7443 | fi |
| 7444 | |
| 7445 | newlib_search_path+=" $absdir" |
| 7446 | # Link against this library |
| 7447 | test "$link_static" = no && newdependency_libs="$abs_ladir/$laname $newdependency_libs" |
| 7448 | # ... and its dependency_libs |
| 7449 | tmp_libs= |
| 7450 | for deplib in $dependency_libs; do |
| 7451 | newdependency_libs="$deplib $newdependency_libs" |
| 7452 | case $deplib in |
| 7453 | -L*) func_stripname '-L' '' "$deplib" |
| 7454 | func_resolve_sysroot "$func_stripname_result";; |
| 7455 | *) func_resolve_sysroot "$deplib" ;; |
| 7456 | esac |
| 7457 | if $opt_preserve_dup_deps ; then |
| 7458 | case "$tmp_libs " in |
| 7459 | *" $func_resolve_sysroot_result "*) |
| 7460 | specialdeplibs+=" $func_resolve_sysroot_result" ;; |
| 7461 | esac |
| 7462 | fi |
| 7463 | tmp_libs+=" $func_resolve_sysroot_result" |
| 7464 | done |
| 7465 | |
| 7466 | if test "$link_all_deplibs" != no; then |
| 7467 | # Add the search paths of all dependency libraries |
| 7468 | for deplib in $dependency_libs; do |
| 7469 | path= |
| 7470 | case $deplib in |
| 7471 | -L*) path="$deplib" ;; |
| 7472 | *.la) |
| 7473 | func_resolve_sysroot "$deplib" |
| 7474 | deplib=$func_resolve_sysroot_result |
| 7475 | func_dirname "$deplib" "" "." |
| 7476 | dir=$func_dirname_result |
| 7477 | # We need an absolute path. |
| 7478 | case $dir in |
| 7479 | [\\/]* | [A-Za-z]:[\\/]*) absdir="$dir" ;; |
| 7480 | *) |
| 7481 | absdir=`cd "$dir" && pwd` |
| 7482 | if test -z "$absdir"; then |
| 7483 | func_warning "cannot determine absolute directory name of \`$dir'" |
| 7484 | absdir="$dir" |
| 7485 | fi |
| 7486 | ;; |
| 7487 | esac |
| 7488 | if $GREP "^installed=no" $deplib > /dev/null; then |
| 7489 | case $host in |
| 7490 | *-*-darwin*) |
| 7491 | depdepl= |
| 7492 | eval deplibrary_names=`${SED} -n -e 's/^library_names=\(.*\)$/\1/p' $deplib` |
| 7493 | if test -n "$deplibrary_names" ; then |
| 7494 | for tmp in $deplibrary_names ; do |
| 7495 | depdepl=$tmp |
| 7496 | done |
| 7497 | if test -f "$absdir/$objdir/$depdepl" ; then |
| 7498 | depdepl="$absdir/$objdir/$depdepl" |
| 7499 | darwin_install_name=`${OTOOL} -L $depdepl | awk '{if (NR == 2) {print $1;exit}}'` |
| 7500 | if test -z "$darwin_install_name"; then |
| 7501 | darwin_install_name=`${OTOOL64} -L $depdepl | awk '{if (NR == 2) {print $1;exit}}'` |
| 7502 | fi |
| 7503 | compiler_flags+=" ${wl}-dylib_file ${wl}${darwin_install_name}:${depdepl}" |
| 7504 | linker_flags+=" -dylib_file ${darwin_install_name}:${depdepl}" |
| 7505 | path= |
| 7506 | fi |
| 7507 | fi |
| 7508 | ;; |
| 7509 | *) |
| 7510 | path="-L$absdir/$objdir" |
| 7511 | ;; |
| 7512 | esac |
| 7513 | else |
| 7514 | eval libdir=`${SED} -n -e 's/^libdir=\(.*\)$/\1/p' $deplib` |
| 7515 | test -z "$libdir" && \ |
| 7516 | func_fatal_error "\`$deplib' is not a valid libtool archive" |
| 7517 | test "$absdir" != "$libdir" && \ |
| 7518 | func_warning "\`$deplib' seems to be moved" |
| 7519 | |
| 7520 | path="-L$absdir" |
| 7521 | fi |
| 7522 | ;; |
| 7523 | esac |
| 7524 | case " $deplibs " in |
| 7525 | *" $path "*) ;; |
| 7526 | *) deplibs="$path $deplibs" ;; |
| 7527 | esac |
| 7528 | done |
| 7529 | fi # link_all_deplibs != no |
| 7530 | fi # linkmode = lib |
| 7531 | done # for deplib in $libs |
| 7532 | if test "$pass" = link; then |
| 7533 | if test "$linkmode" = "prog"; then |
| 7534 | compile_deplibs="$new_inherited_linker_flags $compile_deplibs" |
| 7535 | finalize_deplibs="$new_inherited_linker_flags $finalize_deplibs" |
| 7536 | else |
| 7537 | compiler_flags="$compiler_flags "`$ECHO " $new_inherited_linker_flags" | $SED 's% \([^ $]*\).ltframework% -framework \1%g'` |
| 7538 | fi |
| 7539 | fi |
| 7540 | dependency_libs="$newdependency_libs" |
| 7541 | if test "$pass" = dlpreopen; then |
| 7542 | # Link the dlpreopened libraries before other libraries |
| 7543 | for deplib in $save_deplibs; do |
| 7544 | deplibs="$deplib $deplibs" |
| 7545 | done |
| 7546 | fi |
| 7547 | if test "$pass" != dlopen; then |
| 7548 | if test "$pass" != conv; then |
| 7549 | # Make sure lib_search_path contains only unique directories. |
| 7550 | lib_search_path= |
| 7551 | for dir in $newlib_search_path; do |
| 7552 | case "$lib_search_path " in |
| 7553 | *" $dir "*) ;; |
| 7554 | *) lib_search_path+=" $dir" ;; |
| 7555 | esac |
| 7556 | done |
| 7557 | newlib_search_path= |
| 7558 | fi |
| 7559 | |
| 7560 | if test "$linkmode,$pass" != "prog,link"; then |
| 7561 | vars="deplibs" |
| 7562 | else |
| 7563 | vars="compile_deplibs finalize_deplibs" |
| 7564 | fi |
| 7565 | for var in $vars dependency_libs; do |
| 7566 | # Add libraries to $var in reverse order |
| 7567 | eval tmp_libs=\"\$$var\" |
| 7568 | new_libs= |
| 7569 | for deplib in $tmp_libs; do |
| 7570 | # FIXME: Pedantically, this is the right thing to do, so |
| 7571 | # that some nasty dependency loop isn't accidentally |
| 7572 | # broken: |
| 7573 | #new_libs="$deplib $new_libs" |
| 7574 | # Pragmatically, this seems to cause very few problems in |
| 7575 | # practice: |
| 7576 | case $deplib in |
| 7577 | -L*) new_libs="$deplib $new_libs" ;; |
| 7578 | -R*) ;; |
| 7579 | *) |
| 7580 | # And here is the reason: when a library appears more |
| 7581 | # than once as an explicit dependence of a library, or |
| 7582 | # is implicitly linked in more than once by the |
| 7583 | # compiler, it is considered special, and multiple |
| 7584 | # occurrences thereof are not removed. Compare this |
| 7585 | # with having the same library being listed as a |
| 7586 | # dependency of multiple other libraries: in this case, |
| 7587 | # we know (pedantically, we assume) the library does not |
| 7588 | # need to be listed more than once, so we keep only the |
| 7589 | # last copy. This is not always right, but it is rare |
| 7590 | # enough that we require users that really mean to play |
| 7591 | # such unportable linking tricks to link the library |
| 7592 | # using -Wl,-lname, so that libtool does not consider it |
| 7593 | # for duplicate removal. |
| 7594 | case " $specialdeplibs " in |
| 7595 | *" $deplib "*) new_libs="$deplib $new_libs" ;; |
| 7596 | *) |
| 7597 | case " $new_libs " in |
| 7598 | *" $deplib "*) ;; |
| 7599 | *) new_libs="$deplib $new_libs" ;; |
| 7600 | esac |
| 7601 | ;; |
| 7602 | esac |
| 7603 | ;; |
| 7604 | esac |
| 7605 | done |
| 7606 | tmp_libs= |
| 7607 | for deplib in $new_libs; do |
| 7608 | case $deplib in |
| 7609 | -L*) |
| 7610 | case " $tmp_libs " in |
| 7611 | *" $deplib "*) ;; |
| 7612 | *) tmp_libs+=" $deplib" ;; |
| 7613 | esac |
| 7614 | ;; |
| 7615 | *) tmp_libs+=" $deplib" ;; |
| 7616 | esac |
| 7617 | done |
| 7618 | eval $var=\"$tmp_libs\" |
| 7619 | done # for var |
| 7620 | fi |
| 7621 | # Last step: remove runtime libs from dependency_libs |
| 7622 | # (they stay in deplibs) |
| 7623 | tmp_libs= |
| 7624 | for i in $dependency_libs ; do |
| 7625 | case " $predeps $postdeps $compiler_lib_search_path " in |
| 7626 | *" $i "*) |
| 7627 | i="" |
| 7628 | ;; |
| 7629 | esac |
| 7630 | if test -n "$i" ; then |
| 7631 | tmp_libs+=" $i" |
| 7632 | fi |
| 7633 | done |
| 7634 | dependency_libs=$tmp_libs |
| 7635 | done # for pass |
| 7636 | if test "$linkmode" = prog; then |
| 7637 | dlfiles="$newdlfiles" |
| 7638 | fi |
| 7639 | if test "$linkmode" = prog || test "$linkmode" = lib; then |
| 7640 | dlprefiles="$newdlprefiles" |
| 7641 | fi |
| 7642 | |
| 7643 | case $linkmode in |
| 7644 | oldlib) |
| 7645 | if test -n "$dlfiles$dlprefiles" || test "$dlself" != no; then |
| 7646 | func_warning "\`-dlopen' is ignored for archives" |
| 7647 | fi |
| 7648 | |
| 7649 | case " $deplibs" in |
| 7650 | *\ -l* | *\ -L*) |
| 7651 | func_warning "\`-l' and \`-L' are ignored for archives" ;; |
| 7652 | esac |
| 7653 | |
| 7654 | test -n "$rpath" && \ |
| 7655 | func_warning "\`-rpath' is ignored for archives" |
| 7656 | |
| 7657 | test -n "$xrpath" && \ |
| 7658 | func_warning "\`-R' is ignored for archives" |
| 7659 | |
| 7660 | test -n "$vinfo" && \ |
| 7661 | func_warning "\`-version-info/-version-number' is ignored for archives" |
| 7662 | |
| 7663 | test -n "$release" && \ |
| 7664 | func_warning "\`-release' is ignored for archives" |
| 7665 | |
| 7666 | test -n "$export_symbols$export_symbols_regex" && \ |
| 7667 | func_warning "\`-export-symbols' is ignored for archives" |
| 7668 | |
| 7669 | # Now set the variables for building old libraries. |
| 7670 | build_libtool_libs=no |
| 7671 | oldlibs="$output" |
| 7672 | objs+="$old_deplibs" |
| 7673 | ;; |
| 7674 | |
| 7675 | lib) |
| 7676 | # Make sure we only generate libraries of the form `libNAME.la'. |
| 7677 | case $outputname in |
| 7678 | lib*) |
| 7679 | func_stripname 'lib' '.la' "$outputname" |
| 7680 | name=$func_stripname_result |
| 7681 | eval shared_ext=\"$shrext_cmds\" |
| 7682 | eval libname=\"$libname_spec\" |
| 7683 | ;; |
| 7684 | *) |
| 7685 | test "$module" = no && \ |
| 7686 | func_fatal_help "libtool library \`$output' must begin with \`lib'" |
| 7687 | |
| 7688 | if test "$need_lib_prefix" != no; then |
| 7689 | # Add the "lib" prefix for modules if required |
| 7690 | func_stripname '' '.la' "$outputname" |
| 7691 | name=$func_stripname_result |
| 7692 | eval shared_ext=\"$shrext_cmds\" |
| 7693 | eval libname=\"$libname_spec\" |
| 7694 | else |
| 7695 | func_stripname '' '.la' "$outputname" |
| 7696 | libname=$func_stripname_result |
| 7697 | fi |
| 7698 | ;; |
| 7699 | esac |
| 7700 | |
| 7701 | if test -n "$objs"; then |
| 7702 | if test "$deplibs_check_method" != pass_all; then |
| 7703 | func_fatal_error "cannot build libtool library \`$output' from non-libtool objects on this host:$objs" |
| 7704 | else |
| 7705 | echo |
| 7706 | $ECHO "*** Warning: Linking the shared library $output against the non-libtool" |
| 7707 | $ECHO "*** objects $objs is not portable!" |
| 7708 | libobjs+=" $objs" |
| 7709 | fi |
| 7710 | fi |
| 7711 | |
| 7712 | test "$dlself" != no && \ |
| 7713 | func_warning "\`-dlopen self' is ignored for libtool libraries" |
| 7714 | |
| 7715 | set dummy $rpath |
| 7716 | shift |
| 7717 | test "$#" -gt 1 && \ |
| 7718 | func_warning "ignoring multiple \`-rpath's for a libtool library" |
| 7719 | |
| 7720 | install_libdir="$1" |
| 7721 | |
| 7722 | oldlibs= |
| 7723 | if test -z "$rpath"; then |
| 7724 | if test "$build_libtool_libs" = yes; then |
| 7725 | # Building a libtool convenience library. |
| 7726 | # Some compilers have problems with a `.al' extension so |
| 7727 | # convenience libraries should have the same extension an |
| 7728 | # archive normally would. |
| 7729 | oldlibs="$output_objdir/$libname.$libext $oldlibs" |
| 7730 | build_libtool_libs=convenience |
| 7731 | build_old_libs=yes |
| 7732 | fi |
| 7733 | |
| 7734 | test -n "$vinfo" && \ |
| 7735 | func_warning "\`-version-info/-version-number' is ignored for convenience libraries" |
| 7736 | |
| 7737 | test -n "$release" && \ |
| 7738 | func_warning "\`-release' is ignored for convenience libraries" |
| 7739 | else |
| 7740 | |
| 7741 | # Parse the version information argument. |
| 7742 | save_ifs="$IFS"; IFS=':' |
| 7743 | set dummy $vinfo 0 0 0 |
| 7744 | shift |
| 7745 | IFS="$save_ifs" |
| 7746 | |
| 7747 | test -n "$7" && \ |
| 7748 | func_fatal_help "too many parameters to \`-version-info'" |
| 7749 | |
| 7750 | # convert absolute version numbers to libtool ages |
| 7751 | # this retains compatibility with .la files and attempts |
| 7752 | # to make the code below a bit more comprehensible |
| 7753 | |
| 7754 | case $vinfo_number in |
| 7755 | yes) |
| 7756 | number_major="$1" |
| 7757 | number_minor="$2" |
| 7758 | number_revision="$3" |
| 7759 | # |
| 7760 | # There are really only two kinds -- those that |
| 7761 | # use the current revision as the major version |
| 7762 | # and those that subtract age and use age as |
| 7763 | # a minor version. But, then there is irix |
| 7764 | # which has an extra 1 added just for fun |
| 7765 | # |
| 7766 | case $version_type in |
| 7767 | # correct linux to gnu/linux during the next big refactor |
| 7768 | darwin|linux|osf|windows|none) |
| 7769 | func_arith $number_major + $number_minor |
| 7770 | current=$func_arith_result |
| 7771 | age="$number_minor" |
| 7772 | revision="$number_revision" |
| 7773 | ;; |
| 7774 | freebsd-aout|freebsd-elf|qnx|sunos) |
| 7775 | current="$number_major" |
| 7776 | revision="$number_minor" |
| 7777 | age="0" |
| 7778 | ;; |
| 7779 | irix|nonstopux) |
| 7780 | func_arith $number_major + $number_minor |
| 7781 | current=$func_arith_result |
| 7782 | age="$number_minor" |
| 7783 | revision="$number_minor" |
| 7784 | lt_irix_increment=no |
| 7785 | ;; |
| 7786 | esac |
| 7787 | ;; |
| 7788 | no) |
| 7789 | current="$1" |
| 7790 | revision="$2" |
| 7791 | age="$3" |
| 7792 | ;; |
| 7793 | esac |
| 7794 | |
| 7795 | # Check that each of the things are valid numbers. |
| 7796 | case $current in |
| 7797 | 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]) ;; |
| 7798 | *) |
| 7799 | func_error "CURRENT \`$current' must be a nonnegative integer" |
| 7800 | func_fatal_error "\`$vinfo' is not valid version information" |
| 7801 | ;; |
| 7802 | esac |
| 7803 | |
| 7804 | case $revision in |
| 7805 | 0|[1-9]|[1-9][0-9]|[1-9][0-9][0-9]|[1-9][0-9][0-9][0-9]|[1-9][0-9][0-9][0-9][0-9]) ;; |
| 7806 | *) |
| 7807 | func_error "REVISION \`$revision' must be a nonnegative integer" |
| 7808 | func_fatal_error "\`$vinfo' is not valid version information" |
| 7809 | ;; |
| 7810 | esac |
| 7811 | |
| 7812 | case $age in |
| 7813 | 0|[1-9]|[1-9][0-9]|[1-9][0-9][0-9]|[1-9][0-9][0-9][0-9]|[1-9][0-9][0-9][0-9][0-9]) ;; |
| 7814 | *) |
| 7815 | func_error "AGE \`$age' must be a nonnegative integer" |
| 7816 | func_fatal_error "\`$vinfo' is not valid version information" |
| 7817 | ;; |
| 7818 | esac |
| 7819 | |
| 7820 | if test "$age" -gt "$current"; then |
| 7821 | func_error "AGE \`$age' is greater than the current interface number \`$current'" |
| 7822 | func_fatal_error "\`$vinfo' is not valid version information" |
| 7823 | fi |
| 7824 | |
| 7825 | # Calculate the version variables. |
| 7826 | major= |
| 7827 | versuffix= |
| 7828 | verstring= |
| 7829 | case $version_type in |
| 7830 | none) ;; |
| 7831 | |
| 7832 | darwin) |
| 7833 | # Like Linux, but with the current version available in |
| 7834 | # verstring for coding it into the library header |
| 7835 | func_arith $current - $age |
| 7836 | major=.$func_arith_result |
| 7837 | versuffix="$major.$age.$revision" |
| 7838 | # Darwin ld doesn't like 0 for these options... |
| 7839 | func_arith $current + 1 |
| 7840 | minor_current=$func_arith_result |
| 7841 | xlcverstring="${wl}-compatibility_version ${wl}$minor_current ${wl}-current_version ${wl}$minor_current.$revision" |
| 7842 | verstring="-compatibility_version $minor_current -current_version $minor_current.$revision" |
| 7843 | ;; |
| 7844 | |
| 7845 | freebsd-aout) |
| 7846 | major=".$current" |
| 7847 | versuffix=".$current.$revision"; |
| 7848 | ;; |
| 7849 | |
| 7850 | freebsd-elf) |
| 7851 | major=".$current" |
| 7852 | versuffix=".$current" |
| 7853 | ;; |
| 7854 | |
| 7855 | irix | nonstopux) |
| 7856 | if test "X$lt_irix_increment" = "Xno"; then |
| 7857 | func_arith $current - $age |
| 7858 | else |
| 7859 | func_arith $current - $age + 1 |
| 7860 | fi |
| 7861 | major=$func_arith_result |
| 7862 | |
| 7863 | case $version_type in |
| 7864 | nonstopux) verstring_prefix=nonstopux ;; |
| 7865 | *) verstring_prefix=sgi ;; |
| 7866 | esac |
| 7867 | verstring="$verstring_prefix$major.$revision" |
| 7868 | |
| 7869 | # Add in all the interfaces that we are compatible with. |
| 7870 | loop=$revision |
| 7871 | while test "$loop" -ne 0; do |
| 7872 | func_arith $revision - $loop |
| 7873 | iface=$func_arith_result |
| 7874 | func_arith $loop - 1 |
| 7875 | loop=$func_arith_result |
| 7876 | verstring="$verstring_prefix$major.$iface:$verstring" |
| 7877 | done |
| 7878 | |
| 7879 | # Before this point, $major must not contain `.'. |
| 7880 | major=.$major |
| 7881 | versuffix="$major.$revision" |
| 7882 | ;; |
| 7883 | |
| 7884 | linux) # correct to gnu/linux during the next big refactor |
| 7885 | func_arith $current - $age |
| 7886 | major=.$func_arith_result |
| 7887 | versuffix="$major.$age.$revision" |
| 7888 | ;; |
| 7889 | |
| 7890 | osf) |
| 7891 | func_arith $current - $age |
| 7892 | major=.$func_arith_result |
| 7893 | versuffix=".$current.$age.$revision" |
| 7894 | verstring="$current.$age.$revision" |
| 7895 | |
| 7896 | # Add in all the interfaces that we are compatible with. |
| 7897 | loop=$age |
| 7898 | while test "$loop" -ne 0; do |
| 7899 | func_arith $current - $loop |
| 7900 | iface=$func_arith_result |
| 7901 | func_arith $loop - 1 |
| 7902 | loop=$func_arith_result |
| 7903 | verstring="$verstring:${iface}.0" |
| 7904 | done |
| 7905 | |
| 7906 | # Make executables depend on our current version. |
| 7907 | verstring+=":${current}.0" |
| 7908 | ;; |
| 7909 | |
| 7910 | qnx) |
| 7911 | major=".$current" |
| 7912 | versuffix=".$current" |
| 7913 | ;; |
| 7914 | |
| 7915 | sunos) |
| 7916 | major=".$current" |
| 7917 | versuffix=".$current.$revision" |
| 7918 | ;; |
| 7919 | |
| 7920 | windows) |
| 7921 | # Use '-' rather than '.', since we only want one |
| 7922 | # extension on DOS 8.3 filesystems. |
| 7923 | func_arith $current - $age |
| 7924 | major=$func_arith_result |
| 7925 | versuffix="-$major" |
| 7926 | ;; |
| 7927 | |
| 7928 | *) |
| 7929 | func_fatal_configuration "unknown library version type \`$version_type'" |
| 7930 | ;; |
| 7931 | esac |
| 7932 | |
| 7933 | # Clear the version info if we defaulted, and they specified a release. |
| 7934 | if test -z "$vinfo" && test -n "$release"; then |
| 7935 | major= |
| 7936 | case $version_type in |
| 7937 | darwin) |
| 7938 | # we can't check for "0.0" in archive_cmds due to quoting |
| 7939 | # problems, so we reset it completely |
| 7940 | verstring= |
| 7941 | ;; |
| 7942 | *) |
| 7943 | verstring="0.0" |
| 7944 | ;; |
| 7945 | esac |
| 7946 | if test "$need_version" = no; then |
| 7947 | versuffix= |
| 7948 | else |
| 7949 | versuffix=".0.0" |
| 7950 | fi |
| 7951 | fi |
| 7952 | |
| 7953 | # Remove version info from name if versioning should be avoided |
| 7954 | if test "$avoid_version" = yes && test "$need_version" = no; then |
| 7955 | major= |
| 7956 | versuffix= |
| 7957 | verstring="" |
| 7958 | fi |
| 7959 | |
| 7960 | # Check to see if the archive will have undefined symbols. |
| 7961 | if test "$allow_undefined" = yes; then |
| 7962 | if test "$allow_undefined_flag" = unsupported; then |
| 7963 | func_warning "undefined symbols not allowed in $host shared libraries" |
| 7964 | build_libtool_libs=no |
| 7965 | build_old_libs=yes |
| 7966 | fi |
| 7967 | else |
| 7968 | # Don't allow undefined symbols. |
| 7969 | allow_undefined_flag="$no_undefined_flag" |
| 7970 | fi |
| 7971 | |
| 7972 | fi |
| 7973 | |
| 7974 | func_generate_dlsyms "$libname" "$libname" "yes" |
| 7975 | libobjs+=" $symfileobj" |
| 7976 | test "X$libobjs" = "X " && libobjs= |
| 7977 | |
| 7978 | if test "$opt_mode" != relink; then |
| 7979 | # Remove our outputs, but don't remove object files since they |
| 7980 | # may have been created when compiling PIC objects. |
| 7981 | removelist= |
| 7982 | tempremovelist=`$ECHO "$output_objdir/*"` |
| 7983 | for p in $tempremovelist; do |
| 7984 | case $p in |
| 7985 | *.$objext | *.gcno) |
| 7986 | ;; |
| 7987 | $output_objdir/$outputname | $output_objdir/$libname.* | $output_objdir/${libname}${release}.*) |
| 7988 | if test "X$precious_files_regex" != "X"; then |
| 7989 | if $ECHO "$p" | $EGREP -e "$precious_files_regex" >/dev/null 2>&1 |
| 7990 | then |
| 7991 | continue |
| 7992 | fi |
| 7993 | fi |
| 7994 | removelist+=" $p" |
| 7995 | ;; |
| 7996 | *) ;; |
| 7997 | esac |
| 7998 | done |
| 7999 | test -n "$removelist" && \ |
| 8000 | func_show_eval "${RM}r \$removelist" |
| 8001 | fi |
| 8002 | |
| 8003 | # Now set the variables for building old libraries. |
| 8004 | if test "$build_old_libs" = yes && test "$build_libtool_libs" != convenience ; then |
| 8005 | oldlibs+=" $output_objdir/$libname.$libext" |
| 8006 | |
| 8007 | # Transform .lo files to .o files. |
| 8008 | oldobjs="$objs "`$ECHO "$libobjs" | $SP2NL | $SED "/\.${libext}$/d; $lo2o" | $NL2SP` |
| 8009 | fi |
| 8010 | |
| 8011 | # Eliminate all temporary directories. |
| 8012 | #for path in $notinst_path; do |
| 8013 | # lib_search_path=`$ECHO "$lib_search_path " | $SED "s% $path % %g"` |
| 8014 | # deplibs=`$ECHO "$deplibs " | $SED "s% -L$path % %g"` |
| 8015 | # dependency_libs=`$ECHO "$dependency_libs " | $SED "s% -L$path % %g"` |
| 8016 | #done |
| 8017 | |
| 8018 | if test -n "$xrpath"; then |
| 8019 | # If the user specified any rpath flags, then add them. |
| 8020 | temp_xrpath= |
| 8021 | for libdir in $xrpath; do |
| 8022 | func_replace_sysroot "$libdir" |
| 8023 | temp_xrpath+=" -R$func_replace_sysroot_result" |
| 8024 | case "$finalize_rpath " in |
| 8025 | *" $libdir "*) ;; |
| 8026 | *) finalize_rpath+=" $libdir" ;; |
| 8027 | esac |
| 8028 | done |
| 8029 | if test "$hardcode_into_libs" != yes || test "$build_old_libs" = yes; then |
| 8030 | dependency_libs="$temp_xrpath $dependency_libs" |
| 8031 | fi |
| 8032 | fi |
| 8033 | |
| 8034 | # Make sure dlfiles contains only unique files that won't be dlpreopened |
| 8035 | old_dlfiles="$dlfiles" |
| 8036 | dlfiles= |
| 8037 | for lib in $old_dlfiles; do |
| 8038 | case " $dlprefiles $dlfiles " in |
| 8039 | *" $lib "*) ;; |
| 8040 | *) dlfiles+=" $lib" ;; |
| 8041 | esac |
| 8042 | done |
| 8043 | |
| 8044 | # Make sure dlprefiles contains only unique files |
| 8045 | old_dlprefiles="$dlprefiles" |
| 8046 | dlprefiles= |
| 8047 | for lib in $old_dlprefiles; do |
| 8048 | case "$dlprefiles " in |
| 8049 | *" $lib "*) ;; |
| 8050 | *) dlprefiles+=" $lib" ;; |
| 8051 | esac |
| 8052 | done |
| 8053 | |
| 8054 | if test "$build_libtool_libs" = yes; then |
| 8055 | if test -n "$rpath"; then |
| 8056 | case $host in |
| 8057 | *-*-cygwin* | *-*-mingw* | *-*-pw32* | *-*-os2* | *-*-beos* | *-cegcc* | *-*-haiku*) |
| 8058 | # these systems don't actually have a c library (as such)! |
| 8059 | ;; |
| 8060 | *-*-rhapsody* | *-*-darwin1.[012]) |
| 8061 | # Rhapsody C library is in the System framework |
| 8062 | deplibs+=" System.ltframework" |
| 8063 | ;; |
| 8064 | *-*-netbsd*) |
| 8065 | # Don't link with libc until the a.out ld.so is fixed. |
| 8066 | ;; |
| 8067 | *-*-openbsd* | *-*-freebsd* | *-*-dragonfly*) |
| 8068 | # Do not include libc due to us having libc/libc_r. |
| 8069 | ;; |
| 8070 | *-*-sco3.2v5* | *-*-sco5v6*) |
| 8071 | # Causes problems with __ctype |
| 8072 | ;; |
| 8073 | *-*-sysv4.2uw2* | *-*-sysv5* | *-*-unixware* | *-*-OpenUNIX*) |
| 8074 | # Compiler inserts libc in the correct place for threads to work |
| 8075 | ;; |
| 8076 | *) |
| 8077 | # Add libc to deplibs on all other systems if necessary. |
| 8078 | if test "$build_libtool_need_lc" = "yes"; then |
| 8079 | deplibs+=" -lc" |
| 8080 | fi |
| 8081 | ;; |
| 8082 | esac |
| 8083 | fi |
| 8084 | |
| 8085 | # Transform deplibs into only deplibs that can be linked in shared. |
| 8086 | name_save=$name |
| 8087 | libname_save=$libname |
| 8088 | release_save=$release |
| 8089 | versuffix_save=$versuffix |
| 8090 | major_save=$major |
| 8091 | # I'm not sure if I'm treating the release correctly. I think |
| 8092 | # release should show up in the -l (ie -lgmp5) so we don't want to |
| 8093 | # add it in twice. Is that correct? |
| 8094 | release="" |
| 8095 | versuffix="" |
| 8096 | major="" |
| 8097 | newdeplibs= |
| 8098 | droppeddeps=no |
| 8099 | case $deplibs_check_method in |
| 8100 | pass_all) |
| 8101 | # Don't check for shared/static. Everything works. |
| 8102 | # This might be a little naive. We might want to check |
| 8103 | # whether the library exists or not. But this is on |
| 8104 | # osf3 & osf4 and I'm not really sure... Just |
| 8105 | # implementing what was already the behavior. |
| 8106 | newdeplibs=$deplibs |
| 8107 | ;; |
| 8108 | test_compile) |
| 8109 | # This code stresses the "libraries are programs" paradigm to its |
| 8110 | # limits. Maybe even breaks it. We compile a program, linking it |
| 8111 | # against the deplibs as a proxy for the library. Then we can check |
| 8112 | # whether they linked in statically or dynamically with ldd. |
| 8113 | $opt_dry_run || $RM conftest.c |
| 8114 | cat > conftest.c <<EOF |
| 8115 | int main() { return 0; } |
| 8116 | EOF |
| 8117 | $opt_dry_run || $RM conftest |
| 8118 | if $LTCC $LTCFLAGS -o conftest conftest.c $deplibs; then |
| 8119 | ldd_output=`ldd conftest` |
| 8120 | for i in $deplibs; do |
| 8121 | case $i in |
| 8122 | -l*) |
| 8123 | func_stripname -l '' "$i" |
| 8124 | name=$func_stripname_result |
| 8125 | if test "X$allow_libtool_libs_with_static_runtimes" = "Xyes" ; then |
| 8126 | case " $predeps $postdeps " in |
| 8127 | *" $i "*) |
| 8128 | newdeplibs+=" $i" |
| 8129 | i="" |
| 8130 | ;; |
| 8131 | esac |
| 8132 | fi |
| 8133 | if test -n "$i" ; then |
| 8134 | libname=`eval "\\$ECHO \"$libname_spec\""` |
| 8135 | deplib_matches=`eval "\\$ECHO \"$library_names_spec\""` |
| 8136 | set dummy $deplib_matches; shift |
| 8137 | deplib_match=$1 |
| 8138 | if test `expr "$ldd_output" : ".*$deplib_match"` -ne 0 ; then |
| 8139 | newdeplibs+=" $i" |
| 8140 | else |
| 8141 | droppeddeps=yes |
| 8142 | echo |
| 8143 | $ECHO "*** Warning: dynamic linker does not accept needed library $i." |
| 8144 | echo "*** I have the capability to make that library automatically link in when" |
| 8145 | echo "*** you link to this library. But I can only do this if you have a" |
| 8146 | echo "*** shared version of the library, which I believe you do not have" |
| 8147 | echo "*** because a test_compile did reveal that the linker did not use it for" |
| 8148 | echo "*** its dynamic dependency list that programs get resolved with at runtime." |
| 8149 | fi |
| 8150 | fi |
| 8151 | ;; |
| 8152 | *) |
| 8153 | newdeplibs+=" $i" |
| 8154 | ;; |
| 8155 | esac |
| 8156 | done |
| 8157 | else |
| 8158 | # Error occurred in the first compile. Let's try to salvage |
| 8159 | # the situation: Compile a separate program for each library. |
| 8160 | for i in $deplibs; do |
| 8161 | case $i in |
| 8162 | -l*) |
| 8163 | func_stripname -l '' "$i" |
| 8164 | name=$func_stripname_result |
| 8165 | $opt_dry_run || $RM conftest |
| 8166 | if $LTCC $LTCFLAGS -o conftest conftest.c $i; then |
| 8167 | ldd_output=`ldd conftest` |
| 8168 | if test "X$allow_libtool_libs_with_static_runtimes" = "Xyes" ; then |
| 8169 | case " $predeps $postdeps " in |
| 8170 | *" $i "*) |
| 8171 | newdeplibs+=" $i" |
| 8172 | i="" |
| 8173 | ;; |
| 8174 | esac |
| 8175 | fi |
| 8176 | if test -n "$i" ; then |
| 8177 | libname=`eval "\\$ECHO \"$libname_spec\""` |
| 8178 | deplib_matches=`eval "\\$ECHO \"$library_names_spec\""` |
| 8179 | set dummy $deplib_matches; shift |
| 8180 | deplib_match=$1 |
| 8181 | if test `expr "$ldd_output" : ".*$deplib_match"` -ne 0 ; then |
| 8182 | newdeplibs+=" $i" |
| 8183 | else |
| 8184 | droppeddeps=yes |
| 8185 | echo |
| 8186 | $ECHO "*** Warning: dynamic linker does not accept needed library $i." |
| 8187 | echo "*** I have the capability to make that library automatically link in when" |
| 8188 | echo "*** you link to this library. But I can only do this if you have a" |
| 8189 | echo "*** shared version of the library, which you do not appear to have" |
| 8190 | echo "*** because a test_compile did reveal that the linker did not use this one" |
| 8191 | echo "*** as a dynamic dependency that programs can get resolved with at runtime." |
| 8192 | fi |
| 8193 | fi |
| 8194 | else |
| 8195 | droppeddeps=yes |
| 8196 | echo |
| 8197 | $ECHO "*** Warning! Library $i is needed by this library but I was not able to" |
| 8198 | echo "*** make it link in! You will probably need to install it or some" |
| 8199 | echo "*** library that it depends on before this library will be fully" |
| 8200 | echo "*** functional. Installing it before continuing would be even better." |
| 8201 | fi |
| 8202 | ;; |
| 8203 | *) |
| 8204 | newdeplibs+=" $i" |
| 8205 | ;; |
| 8206 | esac |
| 8207 | done |
| 8208 | fi |
| 8209 | ;; |
| 8210 | file_magic*) |
| 8211 | set dummy $deplibs_check_method; shift |
| 8212 | file_magic_regex=`expr "$deplibs_check_method" : "$1 \(.*\)"` |
| 8213 | for a_deplib in $deplibs; do |
| 8214 | case $a_deplib in |
| 8215 | -l*) |
| 8216 | func_stripname -l '' "$a_deplib" |
| 8217 | name=$func_stripname_result |
| 8218 | if test "X$allow_libtool_libs_with_static_runtimes" = "Xyes" ; then |
| 8219 | case " $predeps $postdeps " in |
| 8220 | *" $a_deplib "*) |
| 8221 | newdeplibs+=" $a_deplib" |
| 8222 | a_deplib="" |
| 8223 | ;; |
| 8224 | esac |
| 8225 | fi |
| 8226 | if test -n "$a_deplib" ; then |
| 8227 | libname=`eval "\\$ECHO \"$libname_spec\""` |
| 8228 | if test -n "$file_magic_glob"; then |
| 8229 | libnameglob=`func_echo_all "$libname" | $SED -e $file_magic_glob` |
| 8230 | else |
| 8231 | libnameglob=$libname |
| 8232 | fi |
| 8233 | test "$want_nocaseglob" = yes && nocaseglob=`shopt -p nocaseglob` |
| 8234 | for i in $lib_search_path $sys_lib_search_path $shlib_search_path; do |
| 8235 | if test "$want_nocaseglob" = yes; then |
| 8236 | shopt -s nocaseglob |
| 8237 | potential_libs=`ls $i/$libnameglob[.-]* 2>/dev/null` |
| 8238 | $nocaseglob |
| 8239 | else |
| 8240 | potential_libs=`ls $i/$libnameglob[.-]* 2>/dev/null` |
| 8241 | fi |
| 8242 | for potent_lib in $potential_libs; do |
| 8243 | # Follow soft links. |
| 8244 | if ls -lLd "$potent_lib" 2>/dev/null | |
| 8245 | $GREP " -> " >/dev/null; then |
| 8246 | continue |
| 8247 | fi |
| 8248 | # The statement above tries to avoid entering an |
| 8249 | # endless loop below, in case of cyclic links. |
| 8250 | # We might still enter an endless loop, since a link |
| 8251 | # loop can be closed while we follow links, |
| 8252 | # but so what? |
| 8253 | potlib="$potent_lib" |
| 8254 | while test -h "$potlib" 2>/dev/null; do |
| 8255 | potliblink=`ls -ld $potlib | ${SED} 's/.* -> //'` |
| 8256 | case $potliblink in |
| 8257 | [\\/]* | [A-Za-z]:[\\/]*) potlib="$potliblink";; |
| 8258 | *) potlib=`$ECHO "$potlib" | $SED 's,[^/]*$,,'`"$potliblink";; |
| 8259 | esac |
| 8260 | done |
| 8261 | if eval $file_magic_cmd \"\$potlib\" 2>/dev/null | |
| 8262 | $SED -e 10q | |
| 8263 | $EGREP "$file_magic_regex" > /dev/null; then |
| 8264 | newdeplibs+=" $a_deplib" |
| 8265 | a_deplib="" |
| 8266 | break 2 |
| 8267 | fi |
| 8268 | done |
| 8269 | done |
| 8270 | fi |
| 8271 | if test -n "$a_deplib" ; then |
| 8272 | droppeddeps=yes |
| 8273 | echo |
| 8274 | $ECHO "*** Warning: linker path does not have real file for library $a_deplib." |
| 8275 | echo "*** I have the capability to make that library automatically link in when" |
| 8276 | echo "*** you link to this library. But I can only do this if you have a" |
| 8277 | echo "*** shared version of the library, which you do not appear to have" |
| 8278 | echo "*** because I did check the linker path looking for a file starting" |
| 8279 | if test -z "$potlib" ; then |
| 8280 | $ECHO "*** with $libname but no candidates were found. (...for file magic test)" |
| 8281 | else |
| 8282 | $ECHO "*** with $libname and none of the candidates passed a file format test" |
| 8283 | $ECHO "*** using a file magic. Last file checked: $potlib" |
| 8284 | fi |
| 8285 | fi |
| 8286 | ;; |
| 8287 | *) |
| 8288 | # Add a -L argument. |
| 8289 | newdeplibs+=" $a_deplib" |
| 8290 | ;; |
| 8291 | esac |
| 8292 | done # Gone through all deplibs. |
| 8293 | ;; |
| 8294 | match_pattern*) |
| 8295 | set dummy $deplibs_check_method; shift |
| 8296 | match_pattern_regex=`expr "$deplibs_check_method" : "$1 \(.*\)"` |
| 8297 | for a_deplib in $deplibs; do |
| 8298 | case $a_deplib in |
| 8299 | -l*) |
| 8300 | func_stripname -l '' "$a_deplib" |
| 8301 | name=$func_stripname_result |
| 8302 | if test "X$allow_libtool_libs_with_static_runtimes" = "Xyes" ; then |
| 8303 | case " $predeps $postdeps " in |
| 8304 | *" $a_deplib "*) |
| 8305 | newdeplibs+=" $a_deplib" |
| 8306 | a_deplib="" |
| 8307 | ;; |
| 8308 | esac |
| 8309 | fi |
| 8310 | if test -n "$a_deplib" ; then |
| 8311 | libname=`eval "\\$ECHO \"$libname_spec\""` |
| 8312 | for i in $lib_search_path $sys_lib_search_path $shlib_search_path; do |
| 8313 | potential_libs=`ls $i/$libname[.-]* 2>/dev/null` |
| 8314 | for potent_lib in $potential_libs; do |
| 8315 | potlib="$potent_lib" # see symlink-check above in file_magic test |
| 8316 | if eval "\$ECHO \"$potent_lib\"" 2>/dev/null | $SED 10q | \ |
| 8317 | $EGREP "$match_pattern_regex" > /dev/null; then |
| 8318 | newdeplibs+=" $a_deplib" |
| 8319 | a_deplib="" |
| 8320 | break 2 |
| 8321 | fi |
| 8322 | done |
| 8323 | done |
| 8324 | fi |
| 8325 | if test -n "$a_deplib" ; then |
| 8326 | droppeddeps=yes |
| 8327 | echo |
| 8328 | $ECHO "*** Warning: linker path does not have real file for library $a_deplib." |
| 8329 | echo "*** I have the capability to make that library automatically link in when" |
| 8330 | echo "*** you link to this library. But I can only do this if you have a" |
| 8331 | echo "*** shared version of the library, which you do not appear to have" |
| 8332 | echo "*** because I did check the linker path looking for a file starting" |
| 8333 | if test -z "$potlib" ; then |
| 8334 | $ECHO "*** with $libname but no candidates were found. (...for regex pattern test)" |
| 8335 | else |
| 8336 | $ECHO "*** with $libname and none of the candidates passed a file format test" |
| 8337 | $ECHO "*** using a regex pattern. Last file checked: $potlib" |
| 8338 | fi |
| 8339 | fi |
| 8340 | ;; |
| 8341 | *) |
| 8342 | # Add a -L argument. |
| 8343 | newdeplibs+=" $a_deplib" |
| 8344 | ;; |
| 8345 | esac |
| 8346 | done # Gone through all deplibs. |
| 8347 | ;; |
| 8348 | none | unknown | *) |
| 8349 | newdeplibs="" |
| 8350 | tmp_deplibs=`$ECHO " $deplibs" | $SED 's/ -lc$//; s/ -[LR][^ ]*//g'` |
| 8351 | if test "X$allow_libtool_libs_with_static_runtimes" = "Xyes" ; then |
| 8352 | for i in $predeps $postdeps ; do |
| 8353 | # can't use Xsed below, because $i might contain '/' |
| 8354 | tmp_deplibs=`$ECHO " $tmp_deplibs" | $SED "s,$i,,"` |
| 8355 | done |
| 8356 | fi |
| 8357 | case $tmp_deplibs in |
| 8358 | *[!\ \ ]*) |
| 8359 | echo |
| 8360 | if test "X$deplibs_check_method" = "Xnone"; then |
| 8361 | echo "*** Warning: inter-library dependencies are not supported in this platform." |
| 8362 | else |
| 8363 | echo "*** Warning: inter-library dependencies are not known to be supported." |
| 8364 | fi |
| 8365 | echo "*** All declared inter-library dependencies are being dropped." |
| 8366 | droppeddeps=yes |
| 8367 | ;; |
| 8368 | esac |
| 8369 | ;; |
| 8370 | esac |
| 8371 | versuffix=$versuffix_save |
| 8372 | major=$major_save |
| 8373 | release=$release_save |
| 8374 | libname=$libname_save |
| 8375 | name=$name_save |
| 8376 | |
| 8377 | case $host in |
| 8378 | *-*-rhapsody* | *-*-darwin1.[012]) |
| 8379 | # On Rhapsody replace the C library with the System framework |
| 8380 | newdeplibs=`$ECHO " $newdeplibs" | $SED 's/ -lc / System.ltframework /'` |
| 8381 | ;; |
| 8382 | esac |
| 8383 | |
| 8384 | if test "$droppeddeps" = yes; then |
| 8385 | if test "$module" = yes; then |
| 8386 | echo |
| 8387 | echo "*** Warning: libtool could not satisfy all declared inter-library" |
| 8388 | $ECHO "*** dependencies of module $libname. Therefore, libtool will create" |
| 8389 | echo "*** a static module, that should work as long as the dlopening" |
| 8390 | echo "*** application is linked with the -dlopen flag." |
| 8391 | if test -z "$global_symbol_pipe"; then |
| 8392 | echo |
| 8393 | echo "*** However, this would only work if libtool was able to extract symbol" |
| 8394 | echo "*** lists from a program, using \`nm' or equivalent, but libtool could" |
| 8395 | echo "*** not find such a program. So, this module is probably useless." |
| 8396 | echo "*** \`nm' from GNU binutils and a full rebuild may help." |
| 8397 | fi |
| 8398 | if test "$build_old_libs" = no; then |
| 8399 | oldlibs="$output_objdir/$libname.$libext" |
| 8400 | build_libtool_libs=module |
| 8401 | build_old_libs=yes |
| 8402 | else |
| 8403 | build_libtool_libs=no |
| 8404 | fi |
| 8405 | else |
| 8406 | echo "*** The inter-library dependencies that have been dropped here will be" |
| 8407 | echo "*** automatically added whenever a program is linked with this library" |
| 8408 | echo "*** or is declared to -dlopen it." |
| 8409 | |
| 8410 | if test "$allow_undefined" = no; then |
| 8411 | echo |
| 8412 | echo "*** Since this library must not contain undefined symbols," |
| 8413 | echo "*** because either the platform does not support them or" |
| 8414 | echo "*** it was explicitly requested with -no-undefined," |
| 8415 | echo "*** libtool will only create a static version of it." |
| 8416 | if test "$build_old_libs" = no; then |
| 8417 | oldlibs="$output_objdir/$libname.$libext" |
| 8418 | build_libtool_libs=module |
| 8419 | build_old_libs=yes |
| 8420 | else |
| 8421 | build_libtool_libs=no |
| 8422 | fi |
| 8423 | fi |
| 8424 | fi |
| 8425 | fi |
| 8426 | # Done checking deplibs! |
| 8427 | deplibs=$newdeplibs |
| 8428 | fi |
| 8429 | # Time to change all our "foo.ltframework" stuff back to "-framework foo" |
| 8430 | case $host in |
| 8431 | *-*-darwin*) |
| 8432 | newdeplibs=`$ECHO " $newdeplibs" | $SED 's% \([^ $]*\).ltframework% -framework \1%g'` |
| 8433 | new_inherited_linker_flags=`$ECHO " $new_inherited_linker_flags" | $SED 's% \([^ $]*\).ltframework% -framework \1%g'` |
| 8434 | deplibs=`$ECHO " $deplibs" | $SED 's% \([^ $]*\).ltframework% -framework \1%g'` |
| 8435 | ;; |
| 8436 | esac |
| 8437 | |
| 8438 | # move library search paths that coincide with paths to not yet |
| 8439 | # installed libraries to the beginning of the library search list |
| 8440 | new_libs= |
| 8441 | for path in $notinst_path; do |
| 8442 | case " $new_libs " in |
| 8443 | *" -L$path/$objdir "*) ;; |
| 8444 | *) |
| 8445 | case " $deplibs " in |
| 8446 | *" -L$path/$objdir "*) |
| 8447 | new_libs+=" -L$path/$objdir" ;; |
| 8448 | esac |
| 8449 | ;; |
| 8450 | esac |
| 8451 | done |
| 8452 | for deplib in $deplibs; do |
| 8453 | case $deplib in |
| 8454 | -L*) |
| 8455 | case " $new_libs " in |
| 8456 | *" $deplib "*) ;; |
| 8457 | *) new_libs+=" $deplib" ;; |
| 8458 | esac |
| 8459 | ;; |
| 8460 | *) new_libs+=" $deplib" ;; |
| 8461 | esac |
| 8462 | done |
| 8463 | deplibs="$new_libs" |
| 8464 | |
| 8465 | # All the library-specific variables (install_libdir is set above). |
| 8466 | library_names= |
| 8467 | old_library= |
| 8468 | dlname= |
| 8469 | |
| 8470 | # Test again, we may have decided not to build it any more |
| 8471 | if test "$build_libtool_libs" = yes; then |
| 8472 | # Remove ${wl} instances when linking with ld. |
| 8473 | # FIXME: should test the right _cmds variable. |
| 8474 | case $archive_cmds in |
| 8475 | *\$LD\ *) wl= ;; |
| 8476 | esac |
| 8477 | if test "$hardcode_into_libs" = yes; then |
| 8478 | # Hardcode the library paths |
| 8479 | hardcode_libdirs= |
| 8480 | dep_rpath= |
| 8481 | rpath="$finalize_rpath" |
| 8482 | test "$opt_mode" != relink && rpath="$compile_rpath$rpath" |
| 8483 | for libdir in $rpath; do |
| 8484 | if test -n "$hardcode_libdir_flag_spec"; then |
| 8485 | if test -n "$hardcode_libdir_separator"; then |
| 8486 | func_replace_sysroot "$libdir" |
| 8487 | libdir=$func_replace_sysroot_result |
| 8488 | if test -z "$hardcode_libdirs"; then |
| 8489 | hardcode_libdirs="$libdir" |
| 8490 | else |
| 8491 | # Just accumulate the unique libdirs. |
| 8492 | case $hardcode_libdir_separator$hardcode_libdirs$hardcode_libdir_separator in |
| 8493 | *"$hardcode_libdir_separator$libdir$hardcode_libdir_separator"*) |
| 8494 | ;; |
| 8495 | *) |
| 8496 | hardcode_libdirs+="$hardcode_libdir_separator$libdir" |
| 8497 | ;; |
| 8498 | esac |
| 8499 | fi |
| 8500 | else |
| 8501 | eval flag=\"$hardcode_libdir_flag_spec\" |
| 8502 | dep_rpath+=" $flag" |
| 8503 | fi |
| 8504 | elif test -n "$runpath_var"; then |
| 8505 | case "$perm_rpath " in |
| 8506 | *" $libdir "*) ;; |
| 8507 | *) perm_rpath+=" $libdir" ;; |
| 8508 | esac |
| 8509 | fi |
| 8510 | done |
| 8511 | # Substitute the hardcoded libdirs into the rpath. |
| 8512 | if test -n "$hardcode_libdir_separator" && |
| 8513 | test -n "$hardcode_libdirs"; then |
| 8514 | libdir="$hardcode_libdirs" |
| 8515 | eval "dep_rpath=\"$hardcode_libdir_flag_spec\"" |
| 8516 | fi |
| 8517 | if test -n "$runpath_var" && test -n "$perm_rpath"; then |
| 8518 | # We should set the runpath_var. |
| 8519 | rpath= |
| 8520 | for dir in $perm_rpath; do |
| 8521 | rpath+="$dir:" |
| 8522 | done |
| 8523 | eval "$runpath_var='$rpath\$$runpath_var'; export $runpath_var" |
| 8524 | fi |
| 8525 | test -n "$dep_rpath" && deplibs="$dep_rpath $deplibs" |
| 8526 | fi |
| 8527 | |
| 8528 | shlibpath="$finalize_shlibpath" |
| 8529 | test "$opt_mode" != relink && shlibpath="$compile_shlibpath$shlibpath" |
| 8530 | if test -n "$shlibpath"; then |
| 8531 | eval "$shlibpath_var='$shlibpath\$$shlibpath_var'; export $shlibpath_var" |
| 8532 | fi |
| 8533 | |
| 8534 | # Get the real and link names of the library. |
| 8535 | eval shared_ext=\"$shrext_cmds\" |
| 8536 | eval library_names=\"$library_names_spec\" |
| 8537 | set dummy $library_names |
| 8538 | shift |
| 8539 | realname="$1" |
| 8540 | shift |
| 8541 | |
| 8542 | if test -n "$soname_spec"; then |
| 8543 | eval soname=\"$soname_spec\" |
| 8544 | else |
| 8545 | soname="$realname" |
| 8546 | fi |
| 8547 | if test -z "$dlname"; then |
| 8548 | dlname=$soname |
| 8549 | fi |
| 8550 | |
| 8551 | lib="$output_objdir/$realname" |
| 8552 | linknames= |
| 8553 | for link |
| 8554 | do |
| 8555 | linknames+=" $link" |
| 8556 | done |
| 8557 | |
| 8558 | # Use standard objects if they are pic |
| 8559 | test -z "$pic_flag" && libobjs=`$ECHO "$libobjs" | $SP2NL | $SED "$lo2o" | $NL2SP` |
| 8560 | test "X$libobjs" = "X " && libobjs= |
| 8561 | |
| 8562 | delfiles= |
| 8563 | if test -n "$export_symbols" && test -n "$include_expsyms"; then |
| 8564 | $opt_dry_run || cp "$export_symbols" "$output_objdir/$libname.uexp" |
| 8565 | export_symbols="$output_objdir/$libname.uexp" |
| 8566 | delfiles+=" $export_symbols" |
| 8567 | fi |
| 8568 | |
| 8569 | orig_export_symbols= |
| 8570 | case $host_os in |
| 8571 | cygwin* | mingw* | cegcc*) |
| 8572 | if test -n "$export_symbols" && test -z "$export_symbols_regex"; then |
| 8573 | # exporting using user supplied symfile |
| 8574 | if test "x`$SED 1q $export_symbols`" != xEXPORTS; then |
| 8575 | # and it's NOT already a .def file. Must figure out |
| 8576 | # which of the given symbols are data symbols and tag |
| 8577 | # them as such. So, trigger use of export_symbols_cmds. |
| 8578 | # export_symbols gets reassigned inside the "prepare |
| 8579 | # the list of exported symbols" if statement, so the |
| 8580 | # include_expsyms logic still works. |
| 8581 | orig_export_symbols="$export_symbols" |
| 8582 | export_symbols= |
| 8583 | always_export_symbols=yes |
| 8584 | fi |
| 8585 | fi |
| 8586 | ;; |
| 8587 | esac |
| 8588 | |
| 8589 | # Prepare the list of exported symbols |
| 8590 | if test -z "$export_symbols"; then |
| 8591 | if test "$always_export_symbols" = yes || test -n "$export_symbols_regex"; then |
| 8592 | func_verbose "generating symbol list for \`$libname.la'" |
| 8593 | export_symbols="$output_objdir/$libname.exp" |
| 8594 | $opt_dry_run || $RM $export_symbols |
| 8595 | cmds=$export_symbols_cmds |
| 8596 | save_ifs="$IFS"; IFS='~' |
| 8597 | for cmd1 in $cmds; do |
| 8598 | IFS="$save_ifs" |
| 8599 | # Take the normal branch if the nm_file_list_spec branch |
| 8600 | # doesn't work or if tool conversion is not needed. |
| 8601 | case $nm_file_list_spec~$to_tool_file_cmd in |
| 8602 | *~func_convert_file_noop | *~func_convert_file_msys_to_w32 | ~*) |
| 8603 | try_normal_branch=yes |
| 8604 | eval cmd=\"$cmd1\" |
| 8605 | func_len " $cmd" |
| 8606 | len=$func_len_result |
| 8607 | ;; |
| 8608 | *) |
| 8609 | try_normal_branch=no |
| 8610 | ;; |
| 8611 | esac |
| 8612 | if test "$try_normal_branch" = yes \ |
| 8613 | && { test "$len" -lt "$max_cmd_len" \ |
| 8614 | || test "$max_cmd_len" -le -1; } |
| 8615 | then |
| 8616 | func_show_eval "$cmd" 'exit $?' |
| 8617 | skipped_export=false |
| 8618 | elif test -n "$nm_file_list_spec"; then |
| 8619 | func_basename "$output" |
| 8620 | output_la=$func_basename_result |
| 8621 | save_libobjs=$libobjs |
| 8622 | save_output=$output |
| 8623 | output=${output_objdir}/${output_la}.nm |
| 8624 | func_to_tool_file "$output" |
| 8625 | libobjs=$nm_file_list_spec$func_to_tool_file_result |
| 8626 | delfiles+=" $output" |
| 8627 | func_verbose "creating $NM input file list: $output" |
| 8628 | for obj in $save_libobjs; do |
| 8629 | func_to_tool_file "$obj" |
| 8630 | $ECHO "$func_to_tool_file_result" |
| 8631 | done > "$output" |
| 8632 | eval cmd=\"$cmd1\" |
| 8633 | func_show_eval "$cmd" 'exit $?' |
| 8634 | output=$save_output |
| 8635 | libobjs=$save_libobjs |
| 8636 | skipped_export=false |
| 8637 | else |
| 8638 | # The command line is too long to execute in one step. |
| 8639 | func_verbose "using reloadable object file for export list..." |
| 8640 | skipped_export=: |
| 8641 | # Break out early, otherwise skipped_export may be |
| 8642 | # set to false by a later but shorter cmd. |
| 8643 | break |
| 8644 | fi |
| 8645 | done |
| 8646 | IFS="$save_ifs" |
| 8647 | if test -n "$export_symbols_regex" && test "X$skipped_export" != "X:"; then |
| 8648 | func_show_eval '$EGREP -e "$export_symbols_regex" "$export_symbols" > "${export_symbols}T"' |
| 8649 | func_show_eval '$MV "${export_symbols}T" "$export_symbols"' |
| 8650 | fi |
| 8651 | fi |
| 8652 | fi |
| 8653 | |
| 8654 | if test -n "$export_symbols" && test -n "$include_expsyms"; then |
| 8655 | tmp_export_symbols="$export_symbols" |
| 8656 | test -n "$orig_export_symbols" && tmp_export_symbols="$orig_export_symbols" |
| 8657 | $opt_dry_run || eval '$ECHO "$include_expsyms" | $SP2NL >> "$tmp_export_symbols"' |
| 8658 | fi |
| 8659 | |
| 8660 | if test "X$skipped_export" != "X:" && test -n "$orig_export_symbols"; then |
| 8661 | # The given exports_symbols file has to be filtered, so filter it. |
| 8662 | func_verbose "filter symbol list for \`$libname.la' to tag DATA exports" |
| 8663 | # FIXME: $output_objdir/$libname.filter potentially contains lots of |
| 8664 | # 's' commands which not all seds can handle. GNU sed should be fine |
| 8665 | # though. Also, the filter scales superlinearly with the number of |
| 8666 | # global variables. join(1) would be nice here, but unfortunately |
| 8667 | # isn't a blessed tool. |
| 8668 | $opt_dry_run || $SED -e '/[ ,]DATA/!d;s,\(.*\)\([ \,].*\),s|^\1$|\1\2|,' < $export_symbols > $output_objdir/$libname.filter |
| 8669 | delfiles+=" $export_symbols $output_objdir/$libname.filter" |
| 8670 | export_symbols=$output_objdir/$libname.def |
| 8671 | $opt_dry_run || $SED -f $output_objdir/$libname.filter < $orig_export_symbols > $export_symbols |
| 8672 | fi |
| 8673 | |
| 8674 | tmp_deplibs= |
| 8675 | for test_deplib in $deplibs; do |
| 8676 | case " $convenience " in |
| 8677 | *" $test_deplib "*) ;; |
| 8678 | *) |
| 8679 | tmp_deplibs+=" $test_deplib" |
| 8680 | ;; |
| 8681 | esac |
| 8682 | done |
| 8683 | deplibs="$tmp_deplibs" |
| 8684 | |
| 8685 | if test -n "$convenience"; then |
| 8686 | if test -n "$whole_archive_flag_spec" && |
| 8687 | test "$compiler_needs_object" = yes && |
| 8688 | test -z "$libobjs"; then |
| 8689 | # extract the archives, so we have objects to list. |
| 8690 | # TODO: could optimize this to just extract one archive. |
| 8691 | whole_archive_flag_spec= |
| 8692 | fi |
| 8693 | if test -n "$whole_archive_flag_spec"; then |
| 8694 | save_libobjs=$libobjs |
| 8695 | eval libobjs=\"\$libobjs $whole_archive_flag_spec\" |
| 8696 | test "X$libobjs" = "X " && libobjs= |
| 8697 | else |
| 8698 | gentop="$output_objdir/${outputname}x" |
| 8699 | generated+=" $gentop" |
| 8700 | |
| 8701 | func_extract_archives $gentop $convenience |
| 8702 | libobjs+=" $func_extract_archives_result" |
| 8703 | test "X$libobjs" = "X " && libobjs= |
| 8704 | fi |
| 8705 | fi |
| 8706 | |
| 8707 | if test "$thread_safe" = yes && test -n "$thread_safe_flag_spec"; then |
| 8708 | eval flag=\"$thread_safe_flag_spec\" |
| 8709 | linker_flags+=" $flag" |
| 8710 | fi |
| 8711 | |
| 8712 | # Make a backup of the uninstalled library when relinking |
| 8713 | if test "$opt_mode" = relink; then |
| 8714 | $opt_dry_run || eval '(cd $output_objdir && $RM ${realname}U && $MV $realname ${realname}U)' || exit $? |
| 8715 | fi |
| 8716 | |
| 8717 | # Do each of the archive commands. |
| 8718 | if test "$module" = yes && test -n "$module_cmds" ; then |
| 8719 | if test -n "$export_symbols" && test -n "$module_expsym_cmds"; then |
| 8720 | eval test_cmds=\"$module_expsym_cmds\" |
| 8721 | cmds=$module_expsym_cmds |
| 8722 | else |
| 8723 | eval test_cmds=\"$module_cmds\" |
| 8724 | cmds=$module_cmds |
| 8725 | fi |
| 8726 | else |
| 8727 | if test -n "$export_symbols" && test -n "$archive_expsym_cmds"; then |
| 8728 | eval test_cmds=\"$archive_expsym_cmds\" |
| 8729 | cmds=$archive_expsym_cmds |
| 8730 | else |
| 8731 | eval test_cmds=\"$archive_cmds\" |
| 8732 | cmds=$archive_cmds |
| 8733 | fi |
| 8734 | fi |
| 8735 | |
| 8736 | if test "X$skipped_export" != "X:" && |
| 8737 | func_len " $test_cmds" && |
| 8738 | len=$func_len_result && |
| 8739 | test "$len" -lt "$max_cmd_len" || test "$max_cmd_len" -le -1; then |
| 8740 | : |
| 8741 | else |
| 8742 | # The command line is too long to link in one step, link piecewise |
| 8743 | # or, if using GNU ld and skipped_export is not :, use a linker |
| 8744 | # script. |
| 8745 | |
| 8746 | # Save the value of $output and $libobjs because we want to |
| 8747 | # use them later. If we have whole_archive_flag_spec, we |
| 8748 | # want to use save_libobjs as it was before |
| 8749 | # whole_archive_flag_spec was expanded, because we can't |
| 8750 | # assume the linker understands whole_archive_flag_spec. |
| 8751 | # This may have to be revisited, in case too many |
| 8752 | # convenience libraries get linked in and end up exceeding |
| 8753 | # the spec. |
| 8754 | if test -z "$convenience" || test -z "$whole_archive_flag_spec"; then |
| 8755 | save_libobjs=$libobjs |
| 8756 | fi |
| 8757 | save_output=$output |
| 8758 | func_basename "$output" |
| 8759 | output_la=$func_basename_result |
| 8760 | |
| 8761 | # Clear the reloadable object creation command queue and |
| 8762 | # initialize k to one. |
| 8763 | test_cmds= |
| 8764 | concat_cmds= |
| 8765 | objlist= |
| 8766 | last_robj= |
| 8767 | k=1 |
| 8768 | |
| 8769 | if test -n "$save_libobjs" && test "X$skipped_export" != "X:" && test "$with_gnu_ld" = yes; then |
| 8770 | output=${output_objdir}/${output_la}.lnkscript |
| 8771 | func_verbose "creating GNU ld script: $output" |
| 8772 | echo 'INPUT (' > $output |
| 8773 | for obj in $save_libobjs |
| 8774 | do |
| 8775 | func_to_tool_file "$obj" |
| 8776 | $ECHO "$func_to_tool_file_result" >> $output |
| 8777 | done |
| 8778 | echo ')' >> $output |
| 8779 | delfiles+=" $output" |
| 8780 | func_to_tool_file "$output" |
| 8781 | output=$func_to_tool_file_result |
| 8782 | elif test -n "$save_libobjs" && test "X$skipped_export" != "X:" && test "X$file_list_spec" != X; then |
| 8783 | output=${output_objdir}/${output_la}.lnk |
| 8784 | func_verbose "creating linker input file list: $output" |
| 8785 | : > $output |
| 8786 | set x $save_libobjs |
| 8787 | shift |
| 8788 | firstobj= |
| 8789 | if test "$compiler_needs_object" = yes; then |
| 8790 | firstobj="$1 " |
| 8791 | shift |
| 8792 | fi |
| 8793 | for obj |
| 8794 | do |
| 8795 | func_to_tool_file "$obj" |
| 8796 | $ECHO "$func_to_tool_file_result" >> $output |
| 8797 | done |
| 8798 | delfiles+=" $output" |
| 8799 | func_to_tool_file "$output" |
| 8800 | output=$firstobj\"$file_list_spec$func_to_tool_file_result\" |
| 8801 | else |
| 8802 | if test -n "$save_libobjs"; then |
| 8803 | func_verbose "creating reloadable object files..." |
| 8804 | output=$output_objdir/$output_la-${k}.$objext |
| 8805 | eval test_cmds=\"$reload_cmds\" |
| 8806 | func_len " $test_cmds" |
| 8807 | len0=$func_len_result |
| 8808 | len=$len0 |
| 8809 | |
| 8810 | # Loop over the list of objects to be linked. |
| 8811 | for obj in $save_libobjs |
| 8812 | do |
| 8813 | func_len " $obj" |
| 8814 | func_arith $len + $func_len_result |
| 8815 | len=$func_arith_result |
| 8816 | if test "X$objlist" = X || |
| 8817 | test "$len" -lt "$max_cmd_len"; then |
| 8818 | objlist+=" $obj" |
| 8819 | else |
| 8820 | # The command $test_cmds is almost too long, add a |
| 8821 | # command to the queue. |
| 8822 | if test "$k" -eq 1 ; then |
| 8823 | # The first file doesn't have a previous command to add. |
| 8824 | reload_objs=$objlist |
| 8825 | eval concat_cmds=\"$reload_cmds\" |
| 8826 | else |
| 8827 | # All subsequent reloadable object files will link in |
| 8828 | # the last one created. |
| 8829 | reload_objs="$objlist $last_robj" |
| 8830 | eval concat_cmds=\"\$concat_cmds~$reload_cmds~\$RM $last_robj\" |
| 8831 | fi |
| 8832 | last_robj=$output_objdir/$output_la-${k}.$objext |
| 8833 | func_arith $k + 1 |
| 8834 | k=$func_arith_result |
| 8835 | output=$output_objdir/$output_la-${k}.$objext |
| 8836 | objlist=" $obj" |
| 8837 | func_len " $last_robj" |
| 8838 | func_arith $len0 + $func_len_result |
| 8839 | len=$func_arith_result |
| 8840 | fi |
| 8841 | done |
| 8842 | # Handle the remaining objects by creating one last |
| 8843 | # reloadable object file. All subsequent reloadable object |
| 8844 | # files will link in the last one created. |
| 8845 | test -z "$concat_cmds" || concat_cmds=$concat_cmds~ |
| 8846 | reload_objs="$objlist $last_robj" |
| 8847 | eval concat_cmds=\"\${concat_cmds}$reload_cmds\" |
| 8848 | if test -n "$last_robj"; then |
| 8849 | eval concat_cmds=\"\${concat_cmds}~\$RM $last_robj\" |
| 8850 | fi |
| 8851 | delfiles+=" $output" |
| 8852 | |
| 8853 | else |
| 8854 | output= |
| 8855 | fi |
| 8856 | |
| 8857 | if ${skipped_export-false}; then |
| 8858 | func_verbose "generating symbol list for \`$libname.la'" |
| 8859 | export_symbols="$output_objdir/$libname.exp" |
| 8860 | $opt_dry_run || $RM $export_symbols |
| 8861 | libobjs=$output |
| 8862 | # Append the command to create the export file. |
| 8863 | test -z "$concat_cmds" || concat_cmds=$concat_cmds~ |
| 8864 | eval concat_cmds=\"\$concat_cmds$export_symbols_cmds\" |
| 8865 | if test -n "$last_robj"; then |
| 8866 | eval concat_cmds=\"\$concat_cmds~\$RM $last_robj\" |
| 8867 | fi |
| 8868 | fi |
| 8869 | |
| 8870 | test -n "$save_libobjs" && |
| 8871 | func_verbose "creating a temporary reloadable object file: $output" |
| 8872 | |
| 8873 | # Loop through the commands generated above and execute them. |
| 8874 | save_ifs="$IFS"; IFS='~' |
| 8875 | for cmd in $concat_cmds; do |
| 8876 | IFS="$save_ifs" |
| 8877 | $opt_silent || { |
| 8878 | func_quote_for_expand "$cmd" |
| 8879 | eval "func_echo $func_quote_for_expand_result" |
| 8880 | } |
| 8881 | $opt_dry_run || eval "$cmd" || { |
| 8882 | lt_exit=$? |
| 8883 | |
| 8884 | # Restore the uninstalled library and exit |
| 8885 | if test "$opt_mode" = relink; then |
| 8886 | ( cd "$output_objdir" && \ |
| 8887 | $RM "${realname}T" && \ |
| 8888 | $MV "${realname}U" "$realname" ) |
| 8889 | fi |
| 8890 | |
| 8891 | exit $lt_exit |
| 8892 | } |
| 8893 | done |
| 8894 | IFS="$save_ifs" |
| 8895 | |
| 8896 | if test -n "$export_symbols_regex" && ${skipped_export-false}; then |
| 8897 | func_show_eval '$EGREP -e "$export_symbols_regex" "$export_symbols" > "${export_symbols}T"' |
| 8898 | func_show_eval '$MV "${export_symbols}T" "$export_symbols"' |
| 8899 | fi |
| 8900 | fi |
| 8901 | |
| 8902 | if ${skipped_export-false}; then |
| 8903 | if test -n "$export_symbols" && test -n "$include_expsyms"; then |
| 8904 | tmp_export_symbols="$export_symbols" |
| 8905 | test -n "$orig_export_symbols" && tmp_export_symbols="$orig_export_symbols" |
| 8906 | $opt_dry_run || eval '$ECHO "$include_expsyms" | $SP2NL >> "$tmp_export_symbols"' |
| 8907 | fi |
| 8908 | |
| 8909 | if test -n "$orig_export_symbols"; then |
| 8910 | # The given exports_symbols file has to be filtered, so filter it. |
| 8911 | func_verbose "filter symbol list for \`$libname.la' to tag DATA exports" |
| 8912 | # FIXME: $output_objdir/$libname.filter potentially contains lots of |
| 8913 | # 's' commands which not all seds can handle. GNU sed should be fine |
| 8914 | # though. Also, the filter scales superlinearly with the number of |
| 8915 | # global variables. join(1) would be nice here, but unfortunately |
| 8916 | # isn't a blessed tool. |
| 8917 | $opt_dry_run || $SED -e '/[ ,]DATA/!d;s,\(.*\)\([ \,].*\),s|^\1$|\1\2|,' < $export_symbols > $output_objdir/$libname.filter |
| 8918 | delfiles+=" $export_symbols $output_objdir/$libname.filter" |
| 8919 | export_symbols=$output_objdir/$libname.def |
| 8920 | $opt_dry_run || $SED -f $output_objdir/$libname.filter < $orig_export_symbols > $export_symbols |
| 8921 | fi |
| 8922 | fi |
| 8923 | |
| 8924 | libobjs=$output |
| 8925 | # Restore the value of output. |
| 8926 | output=$save_output |
| 8927 | |
| 8928 | if test -n "$convenience" && test -n "$whole_archive_flag_spec"; then |
| 8929 | eval libobjs=\"\$libobjs $whole_archive_flag_spec\" |
| 8930 | test "X$libobjs" = "X " && libobjs= |
| 8931 | fi |
| 8932 | # Expand the library linking commands again to reset the |
| 8933 | # value of $libobjs for piecewise linking. |
| 8934 | |
| 8935 | # Do each of the archive commands. |
| 8936 | if test "$module" = yes && test -n "$module_cmds" ; then |
| 8937 | if test -n "$export_symbols" && test -n "$module_expsym_cmds"; then |
| 8938 | cmds=$module_expsym_cmds |
| 8939 | else |
| 8940 | cmds=$module_cmds |
| 8941 | fi |
| 8942 | else |
| 8943 | if test -n "$export_symbols" && test -n "$archive_expsym_cmds"; then |
| 8944 | cmds=$archive_expsym_cmds |
| 8945 | else |
| 8946 | cmds=$archive_cmds |
| 8947 | fi |
| 8948 | fi |
| 8949 | fi |
| 8950 | |
| 8951 | if test -n "$delfiles"; then |
| 8952 | # Append the command to remove temporary files to $cmds. |
| 8953 | eval cmds=\"\$cmds~\$RM $delfiles\" |
| 8954 | fi |
| 8955 | |
| 8956 | # Add any objects from preloaded convenience libraries |
| 8957 | if test -n "$dlprefiles"; then |
| 8958 | gentop="$output_objdir/${outputname}x" |
| 8959 | generated+=" $gentop" |
| 8960 | |
| 8961 | func_extract_archives $gentop $dlprefiles |
| 8962 | libobjs+=" $func_extract_archives_result" |
| 8963 | test "X$libobjs" = "X " && libobjs= |
| 8964 | fi |
| 8965 | |
| 8966 | save_ifs="$IFS"; IFS='~' |
| 8967 | for cmd in $cmds; do |
| 8968 | IFS="$save_ifs" |
| 8969 | eval cmd=\"$cmd\" |
| 8970 | $opt_silent || { |
| 8971 | func_quote_for_expand "$cmd" |
| 8972 | eval "func_echo $func_quote_for_expand_result" |
| 8973 | } |
| 8974 | $opt_dry_run || eval "$cmd" || { |
| 8975 | lt_exit=$? |
| 8976 | |
| 8977 | # Restore the uninstalled library and exit |
| 8978 | if test "$opt_mode" = relink; then |
| 8979 | ( cd "$output_objdir" && \ |
| 8980 | $RM "${realname}T" && \ |
| 8981 | $MV "${realname}U" "$realname" ) |
| 8982 | fi |
| 8983 | |
| 8984 | exit $lt_exit |
| 8985 | } |
| 8986 | done |
| 8987 | IFS="$save_ifs" |
| 8988 | |
| 8989 | # Restore the uninstalled library and exit |
| 8990 | if test "$opt_mode" = relink; then |
| 8991 | $opt_dry_run || eval '(cd $output_objdir && $RM ${realname}T && $MV $realname ${realname}T && $MV ${realname}U $realname)' || exit $? |
| 8992 | |
| 8993 | if test -n "$convenience"; then |
| 8994 | if test -z "$whole_archive_flag_spec"; then |
| 8995 | func_show_eval '${RM}r "$gentop"' |
| 8996 | fi |
| 8997 | fi |
| 8998 | |
| 8999 | exit $EXIT_SUCCESS |
| 9000 | fi |
| 9001 | |
| 9002 | # Create links to the real library. |
| 9003 | for linkname in $linknames; do |
| 9004 | if test "$realname" != "$linkname"; then |
| 9005 | func_show_eval '(cd "$output_objdir" && $RM "$linkname" && $LN_S "$realname" "$linkname")' 'exit $?' |
| 9006 | fi |
| 9007 | done |
| 9008 | |
| 9009 | # If -module or -export-dynamic was specified, set the dlname. |
| 9010 | if test "$module" = yes || test "$export_dynamic" = yes; then |
| 9011 | # On all known operating systems, these are identical. |
| 9012 | dlname="$soname" |
| 9013 | fi |
| 9014 | fi |
| 9015 | ;; |
| 9016 | |
| 9017 | obj) |
| 9018 | if test -n "$dlfiles$dlprefiles" || test "$dlself" != no; then |
| 9019 | func_warning "\`-dlopen' is ignored for objects" |
| 9020 | fi |
| 9021 | |
| 9022 | case " $deplibs" in |
| 9023 | *\ -l* | *\ -L*) |
| 9024 | func_warning "\`-l' and \`-L' are ignored for objects" ;; |
| 9025 | esac |
| 9026 | |
| 9027 | test -n "$rpath" && \ |
| 9028 | func_warning "\`-rpath' is ignored for objects" |
| 9029 | |
| 9030 | test -n "$xrpath" && \ |
| 9031 | func_warning "\`-R' is ignored for objects" |
| 9032 | |
| 9033 | test -n "$vinfo" && \ |
| 9034 | func_warning "\`-version-info' is ignored for objects" |
| 9035 | |
| 9036 | test -n "$release" && \ |
| 9037 | func_warning "\`-release' is ignored for objects" |
| 9038 | |
| 9039 | case $output in |
| 9040 | *.lo) |
| 9041 | test -n "$objs$old_deplibs" && \ |
| 9042 | func_fatal_error "cannot build library object \`$output' from non-libtool objects" |
| 9043 | |
| 9044 | libobj=$output |
| 9045 | func_lo2o "$libobj" |
| 9046 | obj=$func_lo2o_result |
| 9047 | ;; |
| 9048 | *) |
| 9049 | libobj= |
| 9050 | obj="$output" |
| 9051 | ;; |
| 9052 | esac |
| 9053 | |
| 9054 | # Delete the old objects. |
| 9055 | $opt_dry_run || $RM $obj $libobj |
| 9056 | |
| 9057 | # Objects from convenience libraries. This assumes |
| 9058 | # single-version convenience libraries. Whenever we create |
| 9059 | # different ones for PIC/non-PIC, this we'll have to duplicate |
| 9060 | # the extraction. |
| 9061 | reload_conv_objs= |
| 9062 | gentop= |
| 9063 | # reload_cmds runs $LD directly, so let us get rid of |
| 9064 | # -Wl from whole_archive_flag_spec and hope we can get by with |
| 9065 | # turning comma into space.. |
| 9066 | wl= |
| 9067 | |
| 9068 | if test -n "$convenience"; then |
| 9069 | if test -n "$whole_archive_flag_spec"; then |
| 9070 | eval tmp_whole_archive_flags=\"$whole_archive_flag_spec\" |
| 9071 | reload_conv_objs=$reload_objs\ `$ECHO "$tmp_whole_archive_flags" | $SED 's|,| |g'` |
| 9072 | else |
| 9073 | gentop="$output_objdir/${obj}x" |
| 9074 | generated+=" $gentop" |
| 9075 | |
| 9076 | func_extract_archives $gentop $convenience |
| 9077 | reload_conv_objs="$reload_objs $func_extract_archives_result" |
| 9078 | fi |
| 9079 | fi |
| 9080 | |
| 9081 | # If we're not building shared, we need to use non_pic_objs |
| 9082 | test "$build_libtool_libs" != yes && libobjs="$non_pic_objects" |
| 9083 | |
| 9084 | # Create the old-style object. |
| 9085 | reload_objs="$objs$old_deplibs "`$ECHO "$libobjs" | $SP2NL | $SED "/\.${libext}$/d; /\.lib$/d; $lo2o" | $NL2SP`" $reload_conv_objs" ### testsuite: skip nested quoting test |
| 9086 | |
| 9087 | output="$obj" |
| 9088 | func_execute_cmds "$reload_cmds" 'exit $?' |
| 9089 | |
| 9090 | # Exit if we aren't doing a library object file. |
| 9091 | if test -z "$libobj"; then |
| 9092 | if test -n "$gentop"; then |
| 9093 | func_show_eval '${RM}r "$gentop"' |
| 9094 | fi |
| 9095 | |
| 9096 | exit $EXIT_SUCCESS |
| 9097 | fi |
| 9098 | |
| 9099 | if test "$build_libtool_libs" != yes; then |
| 9100 | if test -n "$gentop"; then |
| 9101 | func_show_eval '${RM}r "$gentop"' |
| 9102 | fi |
| 9103 | |
| 9104 | # Create an invalid libtool object if no PIC, so that we don't |
| 9105 | # accidentally link it into a program. |
| 9106 | # $show "echo timestamp > $libobj" |
| 9107 | # $opt_dry_run || eval "echo timestamp > $libobj" || exit $? |
| 9108 | exit $EXIT_SUCCESS |
| 9109 | fi |
| 9110 | |
| 9111 | if test -n "$pic_flag" || test "$pic_mode" != default; then |
| 9112 | # Only do commands if we really have different PIC objects. |
| 9113 | reload_objs="$libobjs $reload_conv_objs" |
| 9114 | output="$libobj" |
| 9115 | func_execute_cmds "$reload_cmds" 'exit $?' |
| 9116 | fi |
| 9117 | |
| 9118 | if test -n "$gentop"; then |
| 9119 | func_show_eval '${RM}r "$gentop"' |
| 9120 | fi |
| 9121 | |
| 9122 | exit $EXIT_SUCCESS |
| 9123 | ;; |
| 9124 | |
| 9125 | prog) |
| 9126 | case $host in |
| 9127 | *cygwin*) func_stripname '' '.exe' "$output" |
| 9128 | output=$func_stripname_result.exe;; |
| 9129 | esac |
| 9130 | test -n "$vinfo" && \ |
| 9131 | func_warning "\`-version-info' is ignored for programs" |
| 9132 | |
| 9133 | test -n "$release" && \ |
| 9134 | func_warning "\`-release' is ignored for programs" |
| 9135 | |
| 9136 | test "$preload" = yes \ |
| 9137 | && test "$dlopen_support" = unknown \ |
| 9138 | && test "$dlopen_self" = unknown \ |
| 9139 | && test "$dlopen_self_static" = unknown && \ |
| 9140 | func_warning "\`LT_INIT([dlopen])' not used. Assuming no dlopen support." |
| 9141 | |
| 9142 | case $host in |
| 9143 | *-*-rhapsody* | *-*-darwin1.[012]) |
| 9144 | # On Rhapsody replace the C library is the System framework |
| 9145 | compile_deplibs=`$ECHO " $compile_deplibs" | $SED 's/ -lc / System.ltframework /'` |
| 9146 | finalize_deplibs=`$ECHO " $finalize_deplibs" | $SED 's/ -lc / System.ltframework /'` |
| 9147 | ;; |
| 9148 | esac |
| 9149 | |
| 9150 | case $host in |
| 9151 | *-*-darwin*) |
| 9152 | # Don't allow lazy linking, it breaks C++ global constructors |
| 9153 | # But is supposedly fixed on 10.4 or later (yay!). |
| 9154 | if test "$tagname" = CXX ; then |
| 9155 | case ${MACOSX_DEPLOYMENT_TARGET-10.0} in |
| 9156 | 10.[0123]) |
| 9157 | compile_command+=" ${wl}-bind_at_load" |
| 9158 | finalize_command+=" ${wl}-bind_at_load" |
| 9159 | ;; |
| 9160 | esac |
| 9161 | fi |
| 9162 | # Time to change all our "foo.ltframework" stuff back to "-framework foo" |
| 9163 | compile_deplibs=`$ECHO " $compile_deplibs" | $SED 's% \([^ $]*\).ltframework% -framework \1%g'` |
| 9164 | finalize_deplibs=`$ECHO " $finalize_deplibs" | $SED 's% \([^ $]*\).ltframework% -framework \1%g'` |
| 9165 | ;; |
| 9166 | esac |
| 9167 | |
| 9168 | |
| 9169 | # move library search paths that coincide with paths to not yet |
| 9170 | # installed libraries to the beginning of the library search list |
| 9171 | new_libs= |
| 9172 | for path in $notinst_path; do |
| 9173 | case " $new_libs " in |
| 9174 | *" -L$path/$objdir "*) ;; |
| 9175 | *) |
| 9176 | case " $compile_deplibs " in |
| 9177 | *" -L$path/$objdir "*) |
| 9178 | new_libs+=" -L$path/$objdir" ;; |
| 9179 | esac |
| 9180 | ;; |
| 9181 | esac |
| 9182 | done |
| 9183 | for deplib in $compile_deplibs; do |
| 9184 | case $deplib in |
| 9185 | -L*) |
| 9186 | case " $new_libs " in |
| 9187 | *" $deplib "*) ;; |
| 9188 | *) new_libs+=" $deplib" ;; |
| 9189 | esac |
| 9190 | ;; |
| 9191 | *) new_libs+=" $deplib" ;; |
| 9192 | esac |
| 9193 | done |
| 9194 | compile_deplibs="$new_libs" |
| 9195 | |
| 9196 | |
| 9197 | compile_command+=" $compile_deplibs" |
| 9198 | finalize_command+=" $finalize_deplibs" |
| 9199 | |
| 9200 | if test -n "$rpath$xrpath"; then |
| 9201 | # If the user specified any rpath flags, then add them. |
| 9202 | for libdir in $rpath $xrpath; do |
| 9203 | # This is the magic to use -rpath. |
| 9204 | case "$finalize_rpath " in |
| 9205 | *" $libdir "*) ;; |
| 9206 | *) finalize_rpath+=" $libdir" ;; |
| 9207 | esac |
| 9208 | done |
| 9209 | fi |
| 9210 | |
| 9211 | # Now hardcode the library paths |
| 9212 | rpath= |
| 9213 | hardcode_libdirs= |
| 9214 | for libdir in $compile_rpath $finalize_rpath; do |
| 9215 | if test -n "$hardcode_libdir_flag_spec"; then |
| 9216 | if test -n "$hardcode_libdir_separator"; then |
| 9217 | if test -z "$hardcode_libdirs"; then |
| 9218 | hardcode_libdirs="$libdir" |
| 9219 | else |
| 9220 | # Just accumulate the unique libdirs. |
| 9221 | case $hardcode_libdir_separator$hardcode_libdirs$hardcode_libdir_separator in |
| 9222 | *"$hardcode_libdir_separator$libdir$hardcode_libdir_separator"*) |
| 9223 | ;; |
| 9224 | *) |
| 9225 | hardcode_libdirs+="$hardcode_libdir_separator$libdir" |
| 9226 | ;; |
| 9227 | esac |
| 9228 | fi |
| 9229 | else |
| 9230 | eval flag=\"$hardcode_libdir_flag_spec\" |
| 9231 | rpath+=" $flag" |
| 9232 | fi |
| 9233 | elif test -n "$runpath_var"; then |
| 9234 | case "$perm_rpath " in |
| 9235 | *" $libdir "*) ;; |
| 9236 | *) perm_rpath+=" $libdir" ;; |
| 9237 | esac |
| 9238 | fi |
| 9239 | case $host in |
| 9240 | *-*-cygwin* | *-*-mingw* | *-*-pw32* | *-*-os2* | *-cegcc*) |
| 9241 | testbindir=`${ECHO} "$libdir" | ${SED} -e 's*/lib$*/bin*'` |
| 9242 | case :$dllsearchpath: in |
| 9243 | *":$libdir:"*) ;; |
| 9244 | ::) dllsearchpath=$libdir;; |
| 9245 | *) dllsearchpath+=":$libdir";; |
| 9246 | esac |
| 9247 | case :$dllsearchpath: in |
| 9248 | *":$testbindir:"*) ;; |
| 9249 | ::) dllsearchpath=$testbindir;; |
| 9250 | *) dllsearchpath+=":$testbindir";; |
| 9251 | esac |
| 9252 | ;; |
| 9253 | esac |
| 9254 | done |
| 9255 | # Substitute the hardcoded libdirs into the rpath. |
| 9256 | if test -n "$hardcode_libdir_separator" && |
| 9257 | test -n "$hardcode_libdirs"; then |
| 9258 | libdir="$hardcode_libdirs" |
| 9259 | eval rpath=\" $hardcode_libdir_flag_spec\" |
| 9260 | fi |
| 9261 | compile_rpath="$rpath" |
| 9262 | |
| 9263 | rpath= |
| 9264 | hardcode_libdirs= |
| 9265 | for libdir in $finalize_rpath; do |
| 9266 | if test -n "$hardcode_libdir_flag_spec"; then |
| 9267 | if test -n "$hardcode_libdir_separator"; then |
| 9268 | if test -z "$hardcode_libdirs"; then |
| 9269 | hardcode_libdirs="$libdir" |
| 9270 | else |
| 9271 | # Just accumulate the unique libdirs. |
| 9272 | case $hardcode_libdir_separator$hardcode_libdirs$hardcode_libdir_separator in |
| 9273 | *"$hardcode_libdir_separator$libdir$hardcode_libdir_separator"*) |
| 9274 | ;; |
| 9275 | *) |
| 9276 | hardcode_libdirs+="$hardcode_libdir_separator$libdir" |
| 9277 | ;; |
| 9278 | esac |
| 9279 | fi |
| 9280 | else |
| 9281 | eval flag=\"$hardcode_libdir_flag_spec\" |
| 9282 | rpath+=" $flag" |
| 9283 | fi |
| 9284 | elif test -n "$runpath_var"; then |
| 9285 | case "$finalize_perm_rpath " in |
| 9286 | *" $libdir "*) ;; |
| 9287 | *) finalize_perm_rpath+=" $libdir" ;; |
| 9288 | esac |
| 9289 | fi |
| 9290 | done |
| 9291 | # Substitute the hardcoded libdirs into the rpath. |
| 9292 | if test -n "$hardcode_libdir_separator" && |
| 9293 | test -n "$hardcode_libdirs"; then |
| 9294 | libdir="$hardcode_libdirs" |
| 9295 | eval rpath=\" $hardcode_libdir_flag_spec\" |
| 9296 | fi |
| 9297 | finalize_rpath="$rpath" |
| 9298 | |
| 9299 | if test -n "$libobjs" && test "$build_old_libs" = yes; then |
| 9300 | # Transform all the library objects into standard objects. |
| 9301 | compile_command=`$ECHO "$compile_command" | $SP2NL | $SED "$lo2o" | $NL2SP` |
| 9302 | finalize_command=`$ECHO "$finalize_command" | $SP2NL | $SED "$lo2o" | $NL2SP` |
| 9303 | fi |
| 9304 | |
| 9305 | func_generate_dlsyms "$outputname" "@PROGRAM@" "no" |
| 9306 | |
| 9307 | # template prelinking step |
| 9308 | if test -n "$prelink_cmds"; then |
| 9309 | func_execute_cmds "$prelink_cmds" 'exit $?' |
| 9310 | fi |
| 9311 | |
| 9312 | wrappers_required=yes |
| 9313 | case $host in |
| 9314 | *cegcc* | *mingw32ce*) |
| 9315 | # Disable wrappers for cegcc and mingw32ce hosts, we are cross compiling anyway. |
| 9316 | wrappers_required=no |
| 9317 | ;; |
| 9318 | *cygwin* | *mingw* ) |
| 9319 | if test "$build_libtool_libs" != yes; then |
| 9320 | wrappers_required=no |
| 9321 | fi |
| 9322 | ;; |
| 9323 | *) |
| 9324 | if test "$need_relink" = no || test "$build_libtool_libs" != yes; then |
| 9325 | wrappers_required=no |
| 9326 | fi |
| 9327 | ;; |
| 9328 | esac |
| 9329 | if test "$wrappers_required" = no; then |
| 9330 | # Replace the output file specification. |
| 9331 | compile_command=`$ECHO "$compile_command" | $SED 's%@OUTPUT@%'"$output"'%g'` |
| 9332 | link_command="$compile_command$compile_rpath" |
| 9333 | |
| 9334 | # We have no uninstalled library dependencies, so finalize right now. |
| 9335 | exit_status=0 |
| 9336 | func_show_eval "$link_command" 'exit_status=$?' |
| 9337 | |
| 9338 | if test -n "$postlink_cmds"; then |
| 9339 | func_to_tool_file "$output" |
| 9340 | postlink_cmds=`func_echo_all "$postlink_cmds" | $SED -e 's%@OUTPUT@%'"$output"'%g' -e 's%@TOOL_OUTPUT@%'"$func_to_tool_file_result"'%g'` |
| 9341 | func_execute_cmds "$postlink_cmds" 'exit $?' |
| 9342 | fi |
| 9343 | |
| 9344 | # Delete the generated files. |
| 9345 | if test -f "$output_objdir/${outputname}S.${objext}"; then |
| 9346 | func_show_eval '$RM "$output_objdir/${outputname}S.${objext}"' |
| 9347 | fi |
| 9348 | |
| 9349 | exit $exit_status |
| 9350 | fi |
| 9351 | |
| 9352 | if test -n "$compile_shlibpath$finalize_shlibpath"; then |
| 9353 | compile_command="$shlibpath_var=\"$compile_shlibpath$finalize_shlibpath\$$shlibpath_var\" $compile_command" |
| 9354 | fi |
| 9355 | if test -n "$finalize_shlibpath"; then |
| 9356 | finalize_command="$shlibpath_var=\"$finalize_shlibpath\$$shlibpath_var\" $finalize_command" |
| 9357 | fi |
| 9358 | |
| 9359 | compile_var= |
| 9360 | finalize_var= |
| 9361 | if test -n "$runpath_var"; then |
| 9362 | if test -n "$perm_rpath"; then |
| 9363 | # We should set the runpath_var. |
| 9364 | rpath= |
| 9365 | for dir in $perm_rpath; do |
| 9366 | rpath+="$dir:" |
| 9367 | done |
| 9368 | compile_var="$runpath_var=\"$rpath\$$runpath_var\" " |
| 9369 | fi |
| 9370 | if test -n "$finalize_perm_rpath"; then |
| 9371 | # We should set the runpath_var. |
| 9372 | rpath= |
| 9373 | for dir in $finalize_perm_rpath; do |
| 9374 | rpath+="$dir:" |
| 9375 | done |
| 9376 | finalize_var="$runpath_var=\"$rpath\$$runpath_var\" " |
| 9377 | fi |
| 9378 | fi |
| 9379 | |
| 9380 | if test "$no_install" = yes; then |
| 9381 | # We don't need to create a wrapper script. |
| 9382 | link_command="$compile_var$compile_command$compile_rpath" |
| 9383 | # Replace the output file specification. |
| 9384 | link_command=`$ECHO "$link_command" | $SED 's%@OUTPUT@%'"$output"'%g'` |
| 9385 | # Delete the old output file. |
| 9386 | $opt_dry_run || $RM $output |
| 9387 | # Link the executable and exit |
| 9388 | func_show_eval "$link_command" 'exit $?' |
| 9389 | |
| 9390 | if test -n "$postlink_cmds"; then |
| 9391 | func_to_tool_file "$output" |
| 9392 | postlink_cmds=`func_echo_all "$postlink_cmds" | $SED -e 's%@OUTPUT@%'"$output"'%g' -e 's%@TOOL_OUTPUT@%'"$func_to_tool_file_result"'%g'` |
| 9393 | func_execute_cmds "$postlink_cmds" 'exit $?' |
| 9394 | fi |
| 9395 | |
| 9396 | exit $EXIT_SUCCESS |
| 9397 | fi |
| 9398 | |
| 9399 | if test "$hardcode_action" = relink; then |
| 9400 | # Fast installation is not supported |
| 9401 | link_command="$compile_var$compile_command$compile_rpath" |
| 9402 | relink_command="$finalize_var$finalize_command$finalize_rpath" |
| 9403 | |
| 9404 | func_warning "this platform does not like uninstalled shared libraries" |
| 9405 | func_warning "\`$output' will be relinked during installation" |
| 9406 | else |
| 9407 | if test "$fast_install" != no; then |
| 9408 | link_command="$finalize_var$compile_command$finalize_rpath" |
| 9409 | if test "$fast_install" = yes; then |
| 9410 | relink_command=`$ECHO "$compile_var$compile_command$compile_rpath" | $SED 's%@OUTPUT@%\$progdir/\$file%g'` |
| 9411 | else |
| 9412 | # fast_install is set to needless |
| 9413 | relink_command= |
| 9414 | fi |
| 9415 | else |
| 9416 | link_command="$compile_var$compile_command$compile_rpath" |
| 9417 | relink_command="$finalize_var$finalize_command$finalize_rpath" |
| 9418 | fi |
| 9419 | fi |
| 9420 | |
| 9421 | # Replace the output file specification. |
| 9422 | link_command=`$ECHO "$link_command" | $SED 's%@OUTPUT@%'"$output_objdir/$outputname"'%g'` |
| 9423 | |
| 9424 | # Delete the old output files. |
| 9425 | $opt_dry_run || $RM $output $output_objdir/$outputname $output_objdir/lt-$outputname |
| 9426 | |
| 9427 | func_show_eval "$link_command" 'exit $?' |
| 9428 | |
| 9429 | if test -n "$postlink_cmds"; then |
| 9430 | func_to_tool_file "$output_objdir/$outputname" |
| 9431 | postlink_cmds=`func_echo_all "$postlink_cmds" | $SED -e 's%@OUTPUT@%'"$output_objdir/$outputname"'%g' -e 's%@TOOL_OUTPUT@%'"$func_to_tool_file_result"'%g'` |
| 9432 | func_execute_cmds "$postlink_cmds" 'exit $?' |
| 9433 | fi |
| 9434 | |
| 9435 | # Now create the wrapper script. |
| 9436 | func_verbose "creating $output" |
| 9437 | |
| 9438 | # Quote the relink command for shipping. |
| 9439 | if test -n "$relink_command"; then |
| 9440 | # Preserve any variables that may affect compiler behavior |
| 9441 | for var in $variables_saved_for_relink; do |
| 9442 | if eval test -z \"\${$var+set}\"; then |
| 9443 | relink_command="{ test -z \"\${$var+set}\" || $lt_unset $var || { $var=; export $var; }; }; $relink_command" |
| 9444 | elif eval var_value=\$$var; test -z "$var_value"; then |
| 9445 | relink_command="$var=; export $var; $relink_command" |
| 9446 | else |
| 9447 | func_quote_for_eval "$var_value" |
| 9448 | relink_command="$var=$func_quote_for_eval_result; export $var; $relink_command" |
| 9449 | fi |
| 9450 | done |
| 9451 | relink_command="(cd `pwd`; $relink_command)" |
| 9452 | relink_command=`$ECHO "$relink_command" | $SED "$sed_quote_subst"` |
| 9453 | fi |
| 9454 | |
| 9455 | # Only actually do things if not in dry run mode. |
| 9456 | $opt_dry_run || { |
| 9457 | # win32 will think the script is a binary if it has |
| 9458 | # a .exe suffix, so we strip it off here. |
| 9459 | case $output in |
| 9460 | *.exe) func_stripname '' '.exe' "$output" |
| 9461 | output=$func_stripname_result ;; |
| 9462 | esac |
| 9463 | # test for cygwin because mv fails w/o .exe extensions |
| 9464 | case $host in |
| 9465 | *cygwin*) |
| 9466 | exeext=.exe |
| 9467 | func_stripname '' '.exe' "$outputname" |
| 9468 | outputname=$func_stripname_result ;; |
| 9469 | *) exeext= ;; |
| 9470 | esac |
| 9471 | case $host in |
| 9472 | *cygwin* | *mingw* ) |
| 9473 | func_dirname_and_basename "$output" "" "." |
| 9474 | output_name=$func_basename_result |
| 9475 | output_path=$func_dirname_result |
| 9476 | cwrappersource="$output_path/$objdir/lt-$output_name.c" |
| 9477 | cwrapper="$output_path/$output_name.exe" |
| 9478 | $RM $cwrappersource $cwrapper |
| 9479 | trap "$RM $cwrappersource $cwrapper; exit $EXIT_FAILURE" 1 2 15 |
| 9480 | |
| 9481 | func_emit_cwrapperexe_src > $cwrappersource |
| 9482 | |
| 9483 | # The wrapper executable is built using the $host compiler, |
| 9484 | # because it contains $host paths and files. If cross- |
| 9485 | # compiling, it, like the target executable, must be |
| 9486 | # executed on the $host or under an emulation environment. |
| 9487 | $opt_dry_run || { |
| 9488 | $LTCC $LTCFLAGS -o $cwrapper $cwrappersource |
| 9489 | $STRIP $cwrapper |
| 9490 | } |
| 9491 | |
| 9492 | # Now, create the wrapper script for func_source use: |
| 9493 | func_ltwrapper_scriptname $cwrapper |
| 9494 | $RM $func_ltwrapper_scriptname_result |
| 9495 | trap "$RM $func_ltwrapper_scriptname_result; exit $EXIT_FAILURE" 1 2 15 |
| 9496 | $opt_dry_run || { |
| 9497 | # note: this script will not be executed, so do not chmod. |
| 9498 | if test "x$build" = "x$host" ; then |
| 9499 | $cwrapper --lt-dump-script > $func_ltwrapper_scriptname_result |
| 9500 | else |
| 9501 | func_emit_wrapper no > $func_ltwrapper_scriptname_result |
| 9502 | fi |
| 9503 | } |
| 9504 | ;; |
| 9505 | * ) |
| 9506 | $RM $output |
| 9507 | trap "$RM $output; exit $EXIT_FAILURE" 1 2 15 |
| 9508 | |
| 9509 | func_emit_wrapper no > $output |
| 9510 | chmod +x $output |
| 9511 | ;; |
| 9512 | esac |
| 9513 | } |
| 9514 | exit $EXIT_SUCCESS |
| 9515 | ;; |
| 9516 | esac |
| 9517 | |
| 9518 | # See if we need to build an old-fashioned archive. |
| 9519 | for oldlib in $oldlibs; do |
| 9520 | |
| 9521 | if test "$build_libtool_libs" = convenience; then |
| 9522 | oldobjs="$libobjs_save $symfileobj" |
| 9523 | addlibs="$convenience" |
| 9524 | build_libtool_libs=no |
| 9525 | else |
| 9526 | if test "$build_libtool_libs" = module; then |
| 9527 | oldobjs="$libobjs_save" |
| 9528 | build_libtool_libs=no |
| 9529 | else |
| 9530 | oldobjs="$old_deplibs $non_pic_objects" |
| 9531 | if test "$preload" = yes && test -f "$symfileobj"; then |
| 9532 | oldobjs+=" $symfileobj" |
| 9533 | fi |
| 9534 | fi |
| 9535 | addlibs="$old_convenience" |
| 9536 | fi |
| 9537 | |
| 9538 | if test -n "$addlibs"; then |
| 9539 | gentop="$output_objdir/${outputname}x" |
| 9540 | generated+=" $gentop" |
| 9541 | |
| 9542 | func_extract_archives $gentop $addlibs |
| 9543 | oldobjs+=" $func_extract_archives_result" |
| 9544 | fi |
| 9545 | |
| 9546 | # Do each command in the archive commands. |
| 9547 | if test -n "$old_archive_from_new_cmds" && test "$build_libtool_libs" = yes; then |
| 9548 | cmds=$old_archive_from_new_cmds |
| 9549 | else |
| 9550 | |
| 9551 | # Add any objects from preloaded convenience libraries |
| 9552 | if test -n "$dlprefiles"; then |
| 9553 | gentop="$output_objdir/${outputname}x" |
| 9554 | generated+=" $gentop" |
| 9555 | |
| 9556 | func_extract_archives $gentop $dlprefiles |
| 9557 | oldobjs+=" $func_extract_archives_result" |
| 9558 | fi |
| 9559 | |
| 9560 | # POSIX demands no paths to be encoded in archives. We have |
| 9561 | # to avoid creating archives with duplicate basenames if we |
| 9562 | # might have to extract them afterwards, e.g., when creating a |
| 9563 | # static archive out of a convenience library, or when linking |
| 9564 | # the entirety of a libtool archive into another (currently |
| 9565 | # not supported by libtool). |
| 9566 | if (for obj in $oldobjs |
| 9567 | do |
| 9568 | func_basename "$obj" |
| 9569 | $ECHO "$func_basename_result" |
| 9570 | done | sort | sort -uc >/dev/null 2>&1); then |
| 9571 | : |
| 9572 | else |
| 9573 | echo "copying selected object files to avoid basename conflicts..." |
| 9574 | gentop="$output_objdir/${outputname}x" |
| 9575 | generated+=" $gentop" |
| 9576 | func_mkdir_p "$gentop" |
| 9577 | save_oldobjs=$oldobjs |
| 9578 | oldobjs= |
| 9579 | counter=1 |
| 9580 | for obj in $save_oldobjs |
| 9581 | do |
| 9582 | func_basename "$obj" |
| 9583 | objbase="$func_basename_result" |
| 9584 | case " $oldobjs " in |
| 9585 | " ") oldobjs=$obj ;; |
| 9586 | *[\ /]"$objbase "*) |
| 9587 | while :; do |
| 9588 | # Make sure we don't pick an alternate name that also |
| 9589 | # overlaps. |
| 9590 | newobj=lt$counter-$objbase |
| 9591 | func_arith $counter + 1 |
| 9592 | counter=$func_arith_result |
| 9593 | case " $oldobjs " in |
| 9594 | *[\ /]"$newobj "*) ;; |
| 9595 | *) if test ! -f "$gentop/$newobj"; then break; fi ;; |
| 9596 | esac |
| 9597 | done |
| 9598 | func_show_eval "ln $obj $gentop/$newobj || cp $obj $gentop/$newobj" |
| 9599 | oldobjs+=" $gentop/$newobj" |
| 9600 | ;; |
| 9601 | *) oldobjs+=" $obj" ;; |
| 9602 | esac |
| 9603 | done |
| 9604 | fi |
| 9605 | func_to_tool_file "$oldlib" func_convert_file_msys_to_w32 |
| 9606 | tool_oldlib=$func_to_tool_file_result |
| 9607 | eval cmds=\"$old_archive_cmds\" |
| 9608 | |
| 9609 | func_len " $cmds" |
| 9610 | len=$func_len_result |
| 9611 | if test "$len" -lt "$max_cmd_len" || test "$max_cmd_len" -le -1; then |
| 9612 | cmds=$old_archive_cmds |
| 9613 | elif test -n "$archiver_list_spec"; then |
| 9614 | func_verbose "using command file archive linking..." |
| 9615 | for obj in $oldobjs |
| 9616 | do |
| 9617 | func_to_tool_file "$obj" |
| 9618 | $ECHO "$func_to_tool_file_result" |
| 9619 | done > $output_objdir/$libname.libcmd |
| 9620 | func_to_tool_file "$output_objdir/$libname.libcmd" |
| 9621 | oldobjs=" $archiver_list_spec$func_to_tool_file_result" |
| 9622 | cmds=$old_archive_cmds |
| 9623 | else |
| 9624 | # the command line is too long to link in one step, link in parts |
| 9625 | func_verbose "using piecewise archive linking..." |
| 9626 | save_RANLIB=$RANLIB |
| 9627 | RANLIB=: |
| 9628 | objlist= |
| 9629 | concat_cmds= |
| 9630 | save_oldobjs=$oldobjs |
| 9631 | oldobjs= |
| 9632 | # Is there a better way of finding the last object in the list? |
| 9633 | for obj in $save_oldobjs |
| 9634 | do |
| 9635 | last_oldobj=$obj |
| 9636 | done |
| 9637 | eval test_cmds=\"$old_archive_cmds\" |
| 9638 | func_len " $test_cmds" |
| 9639 | len0=$func_len_result |
| 9640 | len=$len0 |
| 9641 | for obj in $save_oldobjs |
| 9642 | do |
| 9643 | func_len " $obj" |
| 9644 | func_arith $len + $func_len_result |
| 9645 | len=$func_arith_result |
| 9646 | objlist+=" $obj" |
| 9647 | if test "$len" -lt "$max_cmd_len"; then |
| 9648 | : |
| 9649 | else |
| 9650 | # the above command should be used before it gets too long |
| 9651 | oldobjs=$objlist |
| 9652 | if test "$obj" = "$last_oldobj" ; then |
| 9653 | RANLIB=$save_RANLIB |
| 9654 | fi |
| 9655 | test -z "$concat_cmds" || concat_cmds=$concat_cmds~ |
| 9656 | eval concat_cmds=\"\${concat_cmds}$old_archive_cmds\" |
| 9657 | objlist= |
| 9658 | len=$len0 |
| 9659 | fi |
| 9660 | done |
| 9661 | RANLIB=$save_RANLIB |
| 9662 | oldobjs=$objlist |
| 9663 | if test "X$oldobjs" = "X" ; then |
| 9664 | eval cmds=\"\$concat_cmds\" |
| 9665 | else |
| 9666 | eval cmds=\"\$concat_cmds~\$old_archive_cmds\" |
| 9667 | fi |
| 9668 | fi |
| 9669 | fi |
| 9670 | func_execute_cmds "$cmds" 'exit $?' |
| 9671 | done |
| 9672 | |
| 9673 | test -n "$generated" && \ |
| 9674 | func_show_eval "${RM}r$generated" |
| 9675 | |
| 9676 | # Now create the libtool archive. |
| 9677 | case $output in |
| 9678 | *.la) |
| 9679 | old_library= |
| 9680 | test "$build_old_libs" = yes && old_library="$libname.$libext" |
| 9681 | func_verbose "creating $output" |
| 9682 | |
| 9683 | # Preserve any variables that may affect compiler behavior |
| 9684 | for var in $variables_saved_for_relink; do |
| 9685 | if eval test -z \"\${$var+set}\"; then |
| 9686 | relink_command="{ test -z \"\${$var+set}\" || $lt_unset $var || { $var=; export $var; }; }; $relink_command" |
| 9687 | elif eval var_value=\$$var; test -z "$var_value"; then |
| 9688 | relink_command="$var=; export $var; $relink_command" |
| 9689 | else |
| 9690 | func_quote_for_eval "$var_value" |
| 9691 | relink_command="$var=$func_quote_for_eval_result; export $var; $relink_command" |
| 9692 | fi |
| 9693 | done |
| 9694 | # Quote the link command for shipping. |
| 9695 | relink_command="(cd `pwd`; $SHELL $progpath $preserve_args --mode=relink $libtool_args @inst_prefix_dir@)" |
| 9696 | relink_command=`$ECHO "$relink_command" | $SED "$sed_quote_subst"` |
| 9697 | if test "$hardcode_automatic" = yes ; then |
| 9698 | relink_command= |
| 9699 | fi |
| 9700 | |
| 9701 | # Only create the output if not a dry run. |
| 9702 | $opt_dry_run || { |
| 9703 | for installed in no yes; do |
| 9704 | if test "$installed" = yes; then |
| 9705 | if test -z "$install_libdir"; then |
| 9706 | break |
| 9707 | fi |
| 9708 | output="$output_objdir/$outputname"i |
| 9709 | # Replace all uninstalled libtool libraries with the installed ones |
| 9710 | newdependency_libs= |
| 9711 | for deplib in $dependency_libs; do |
| 9712 | case $deplib in |
| 9713 | *.la) |
| 9714 | func_basename "$deplib" |
| 9715 | name="$func_basename_result" |
| 9716 | func_resolve_sysroot "$deplib" |
| 9717 | eval libdir=`${SED} -n -e 's/^libdir=\(.*\)$/\1/p' $func_resolve_sysroot_result` |
| 9718 | test -z "$libdir" && \ |
| 9719 | func_fatal_error "\`$deplib' is not a valid libtool archive" |
| 9720 | newdependency_libs+=" ${lt_sysroot:+=}$libdir/$name" |
| 9721 | ;; |
| 9722 | -L*) |
| 9723 | func_stripname -L '' "$deplib" |
| 9724 | func_replace_sysroot "$func_stripname_result" |
| 9725 | newdependency_libs+=" -L$func_replace_sysroot_result" |
| 9726 | ;; |
| 9727 | -R*) |
| 9728 | func_stripname -R '' "$deplib" |
| 9729 | func_replace_sysroot "$func_stripname_result" |
| 9730 | newdependency_libs+=" -R$func_replace_sysroot_result" |
| 9731 | ;; |
| 9732 | *) newdependency_libs+=" $deplib" ;; |
| 9733 | esac |
| 9734 | done |
| 9735 | dependency_libs="$newdependency_libs" |
| 9736 | newdlfiles= |
| 9737 | |
| 9738 | for lib in $dlfiles; do |
| 9739 | case $lib in |
| 9740 | *.la) |
| 9741 | func_basename "$lib" |
| 9742 | name="$func_basename_result" |
| 9743 | eval libdir=`${SED} -n -e 's/^libdir=\(.*\)$/\1/p' $lib` |
| 9744 | test -z "$libdir" && \ |
| 9745 | func_fatal_error "\`$lib' is not a valid libtool archive" |
| 9746 | newdlfiles+=" ${lt_sysroot:+=}$libdir/$name" |
| 9747 | ;; |
| 9748 | *) newdlfiles+=" $lib" ;; |
| 9749 | esac |
| 9750 | done |
| 9751 | dlfiles="$newdlfiles" |
| 9752 | newdlprefiles= |
| 9753 | for lib in $dlprefiles; do |
| 9754 | case $lib in |
| 9755 | *.la) |
| 9756 | # Only pass preopened files to the pseudo-archive (for |
| 9757 | # eventual linking with the app. that links it) if we |
| 9758 | # didn't already link the preopened objects directly into |
| 9759 | # the library: |
| 9760 | func_basename "$lib" |
| 9761 | name="$func_basename_result" |
| 9762 | eval libdir=`${SED} -n -e 's/^libdir=\(.*\)$/\1/p' $lib` |
| 9763 | test -z "$libdir" && \ |
| 9764 | func_fatal_error "\`$lib' is not a valid libtool archive" |
| 9765 | newdlprefiles+=" ${lt_sysroot:+=}$libdir/$name" |
| 9766 | ;; |
| 9767 | esac |
| 9768 | done |
| 9769 | dlprefiles="$newdlprefiles" |
| 9770 | else |
| 9771 | newdlfiles= |
| 9772 | for lib in $dlfiles; do |
| 9773 | case $lib in |
| 9774 | [\\/]* | [A-Za-z]:[\\/]*) abs="$lib" ;; |
| 9775 | *) abs=`pwd`"/$lib" ;; |
| 9776 | esac |
| 9777 | newdlfiles+=" $abs" |
| 9778 | done |
| 9779 | dlfiles="$newdlfiles" |
| 9780 | newdlprefiles= |
| 9781 | for lib in $dlprefiles; do |
| 9782 | case $lib in |
| 9783 | [\\/]* | [A-Za-z]:[\\/]*) abs="$lib" ;; |
| 9784 | *) abs=`pwd`"/$lib" ;; |
| 9785 | esac |
| 9786 | newdlprefiles+=" $abs" |
| 9787 | done |
| 9788 | dlprefiles="$newdlprefiles" |
| 9789 | fi |
| 9790 | $RM $output |
| 9791 | # place dlname in correct position for cygwin |
| 9792 | # In fact, it would be nice if we could use this code for all target |
| 9793 | # systems that can't hard-code library paths into their executables |
| 9794 | # and that have no shared library path variable independent of PATH, |
| 9795 | # but it turns out we can't easily determine that from inspecting |
| 9796 | # libtool variables, so we have to hard-code the OSs to which it |
| 9797 | # applies here; at the moment, that means platforms that use the PE |
| 9798 | # object format with DLL files. See the long comment at the top of |
| 9799 | # tests/bindir.at for full details. |
| 9800 | tdlname=$dlname |
| 9801 | case $host,$output,$installed,$module,$dlname in |
| 9802 | *cygwin*,*lai,yes,no,*.dll | *mingw*,*lai,yes,no,*.dll | *cegcc*,*lai,yes,no,*.dll) |
| 9803 | # If a -bindir argument was supplied, place the dll there. |
| 9804 | if test "x$bindir" != x ; |
| 9805 | then |
| 9806 | func_relative_path "$install_libdir" "$bindir" |
| 9807 | tdlname=$func_relative_path_result$dlname |
| 9808 | else |
| 9809 | # Otherwise fall back on heuristic. |
| 9810 | tdlname=../bin/$dlname |
| 9811 | fi |
| 9812 | ;; |
| 9813 | esac |
| 9814 | $ECHO > $output "\ |
| 9815 | # $outputname - a libtool library file |
| 9816 | # Generated by $PROGRAM (GNU $PACKAGE$TIMESTAMP) $VERSION |
| 9817 | # |
| 9818 | # Please DO NOT delete this file! |
| 9819 | # It is necessary for linking the library. |
| 9820 | |
| 9821 | # The name that we can dlopen(3). |
| 9822 | dlname='$tdlname' |
| 9823 | |
| 9824 | # Names of this library. |
| 9825 | library_names='$library_names' |
| 9826 | |
| 9827 | # The name of the static archive. |
| 9828 | old_library='$old_library' |
| 9829 | |
| 9830 | # Linker flags that can not go in dependency_libs. |
| 9831 | inherited_linker_flags='$new_inherited_linker_flags' |
| 9832 | |
| 9833 | # Libraries that this one depends upon. |
| 9834 | dependency_libs='$dependency_libs' |
| 9835 | |
| 9836 | # Names of additional weak libraries provided by this library |
| 9837 | weak_library_names='$weak_libs' |
| 9838 | |
| 9839 | # Version information for $libname. |
| 9840 | current=$current |
| 9841 | age=$age |
| 9842 | revision=$revision |
| 9843 | |
| 9844 | # Is this an already installed library? |
| 9845 | installed=$installed |
| 9846 | |
| 9847 | # Should we warn about portability when linking against -modules? |
| 9848 | shouldnotlink=$module |
| 9849 | |
| 9850 | # Files to dlopen/dlpreopen |
| 9851 | dlopen='$dlfiles' |
| 9852 | dlpreopen='$dlprefiles' |
| 9853 | |
| 9854 | # Directory that this library needs to be installed in: |
| 9855 | libdir='$install_libdir'" |
| 9856 | if test "$installed" = no && test "$need_relink" = yes; then |
| 9857 | $ECHO >> $output "\ |
| 9858 | relink_command=\"$relink_command\"" |
| 9859 | fi |
| 9860 | done |
| 9861 | } |
| 9862 | |
| 9863 | # Do a symbolic link so that the libtool archive can be found in |
| 9864 | # LD_LIBRARY_PATH before the program is installed. |
| 9865 | func_show_eval '( cd "$output_objdir" && $RM "$outputname" && $LN_S "../$outputname" "$outputname" )' 'exit $?' |
| 9866 | ;; |
| 9867 | esac |
| 9868 | exit $EXIT_SUCCESS |
| 9869 | } |
| 9870 | |
| 9871 | { test "$opt_mode" = link || test "$opt_mode" = relink; } && |
| 9872 | func_mode_link ${1+"$@"} |
| 9873 | |
| 9874 | |
| 9875 | # func_mode_uninstall arg... |
| 9876 | func_mode_uninstall () |
| 9877 | { |
| 9878 | $opt_debug |
| 9879 | RM="$nonopt" |
| 9880 | files= |
| 9881 | rmforce= |
| 9882 | exit_status=0 |
| 9883 | |
| 9884 | # This variable tells wrapper scripts just to set variables rather |
| 9885 | # than running their programs. |
| 9886 | libtool_install_magic="$magic" |
| 9887 | |
| 9888 | for arg |
| 9889 | do |
| 9890 | case $arg in |
| 9891 | -f) RM+=" $arg"; rmforce=yes ;; |
| 9892 | -*) RM+=" $arg" ;; |
| 9893 | *) files+=" $arg" ;; |
| 9894 | esac |
| 9895 | done |
| 9896 | |
| 9897 | test -z "$RM" && \ |
| 9898 | func_fatal_help "you must specify an RM program" |
| 9899 | |
| 9900 | rmdirs= |
| 9901 | |
| 9902 | for file in $files; do |
| 9903 | func_dirname "$file" "" "." |
| 9904 | dir="$func_dirname_result" |
| 9905 | if test "X$dir" = X.; then |
| 9906 | odir="$objdir" |
| 9907 | else |
| 9908 | odir="$dir/$objdir" |
| 9909 | fi |
| 9910 | func_basename "$file" |
| 9911 | name="$func_basename_result" |
| 9912 | test "$opt_mode" = uninstall && odir="$dir" |
| 9913 | |
| 9914 | # Remember odir for removal later, being careful to avoid duplicates |
| 9915 | if test "$opt_mode" = clean; then |
| 9916 | case " $rmdirs " in |
| 9917 | *" $odir "*) ;; |
| 9918 | *) rmdirs+=" $odir" ;; |
| 9919 | esac |
| 9920 | fi |
| 9921 | |
| 9922 | # Don't error if the file doesn't exist and rm -f was used. |
| 9923 | if { test -L "$file"; } >/dev/null 2>&1 || |
| 9924 | { test -h "$file"; } >/dev/null 2>&1 || |
| 9925 | test -f "$file"; then |
| 9926 | : |
| 9927 | elif test -d "$file"; then |
| 9928 | exit_status=1 |
| 9929 | continue |
| 9930 | elif test "$rmforce" = yes; then |
| 9931 | continue |
| 9932 | fi |
| 9933 | |
| 9934 | rmfiles="$file" |
| 9935 | |
| 9936 | case $name in |
| 9937 | *.la) |
| 9938 | # Possibly a libtool archive, so verify it. |
| 9939 | if func_lalib_p "$file"; then |
| 9940 | func_source $dir/$name |
| 9941 | |
| 9942 | # Delete the libtool libraries and symlinks. |
| 9943 | for n in $library_names; do |
| 9944 | rmfiles+=" $odir/$n" |
| 9945 | done |
| 9946 | test -n "$old_library" && rmfiles+=" $odir/$old_library" |
| 9947 | |
| 9948 | case "$opt_mode" in |
| 9949 | clean) |
| 9950 | case " $library_names " in |
| 9951 | *" $dlname "*) ;; |
| 9952 | *) test -n "$dlname" && rmfiles+=" $odir/$dlname" ;; |
| 9953 | esac |
| 9954 | test -n "$libdir" && rmfiles+=" $odir/$name $odir/${name}i" |
| 9955 | ;; |
| 9956 | uninstall) |
| 9957 | if test -n "$library_names"; then |
| 9958 | # Do each command in the postuninstall commands. |
| 9959 | func_execute_cmds "$postuninstall_cmds" 'test "$rmforce" = yes || exit_status=1' |
| 9960 | fi |
| 9961 | |
| 9962 | if test -n "$old_library"; then |
| 9963 | # Do each command in the old_postuninstall commands. |
| 9964 | func_execute_cmds "$old_postuninstall_cmds" 'test "$rmforce" = yes || exit_status=1' |
| 9965 | fi |
| 9966 | # FIXME: should reinstall the best remaining shared library. |
| 9967 | ;; |
| 9968 | esac |
| 9969 | fi |
| 9970 | ;; |
| 9971 | |
| 9972 | *.lo) |
| 9973 | # Possibly a libtool object, so verify it. |
| 9974 | if func_lalib_p "$file"; then |
| 9975 | |
| 9976 | # Read the .lo file |
| 9977 | func_source $dir/$name |
| 9978 | |
| 9979 | # Add PIC object to the list of files to remove. |
| 9980 | if test -n "$pic_object" && |
| 9981 | test "$pic_object" != none; then |
| 9982 | rmfiles+=" $dir/$pic_object" |
| 9983 | fi |
| 9984 | |
| 9985 | # Add non-PIC object to the list of files to remove. |
| 9986 | if test -n "$non_pic_object" && |
| 9987 | test "$non_pic_object" != none; then |
| 9988 | rmfiles+=" $dir/$non_pic_object" |
| 9989 | fi |
| 9990 | fi |
| 9991 | ;; |
| 9992 | |
| 9993 | *) |
| 9994 | if test "$opt_mode" = clean ; then |
| 9995 | noexename=$name |
| 9996 | case $file in |
| 9997 | *.exe) |
| 9998 | func_stripname '' '.exe' "$file" |
| 9999 | file=$func_stripname_result |
| 10000 | func_stripname '' '.exe' "$name" |
| 10001 | noexename=$func_stripname_result |
| 10002 | # $file with .exe has already been added to rmfiles, |
| 10003 | # add $file without .exe |
| 10004 | rmfiles+=" $file" |
| 10005 | ;; |
| 10006 | esac |
| 10007 | # Do a test to see if this is a libtool program. |
| 10008 | if func_ltwrapper_p "$file"; then |
| 10009 | if func_ltwrapper_executable_p "$file"; then |
| 10010 | func_ltwrapper_scriptname "$file" |
| 10011 | relink_command= |
| 10012 | func_source $func_ltwrapper_scriptname_result |
| 10013 | rmfiles+=" $func_ltwrapper_scriptname_result" |
| 10014 | else |
| 10015 | relink_command= |
| 10016 | func_source $dir/$noexename |
| 10017 | fi |
| 10018 | |
| 10019 | # note $name still contains .exe if it was in $file originally |
| 10020 | # as does the version of $file that was added into $rmfiles |
| 10021 | rmfiles+=" $odir/$name $odir/${name}S.${objext}" |
| 10022 | if test "$fast_install" = yes && test -n "$relink_command"; then |
| 10023 | rmfiles+=" $odir/lt-$name" |
| 10024 | fi |
| 10025 | if test "X$noexename" != "X$name" ; then |
| 10026 | rmfiles+=" $odir/lt-${noexename}.c" |
| 10027 | fi |
| 10028 | fi |
| 10029 | fi |
| 10030 | ;; |
| 10031 | esac |
| 10032 | func_show_eval "$RM $rmfiles" 'exit_status=1' |
| 10033 | done |
| 10034 | |
| 10035 | # Try to remove the ${objdir}s in the directories where we deleted files |
| 10036 | for dir in $rmdirs; do |
| 10037 | if test -d "$dir"; then |
| 10038 | func_show_eval "rmdir $dir >/dev/null 2>&1" |
| 10039 | fi |
| 10040 | done |
| 10041 | |
| 10042 | exit $exit_status |
| 10043 | } |
| 10044 | |
| 10045 | { test "$opt_mode" = uninstall || test "$opt_mode" = clean; } && |
| 10046 | func_mode_uninstall ${1+"$@"} |
| 10047 | |
| 10048 | test -z "$opt_mode" && { |
| 10049 | help="$generic_help" |
| 10050 | func_fatal_help "you must specify a MODE" |
| 10051 | } |
| 10052 | |
| 10053 | test -z "$exec_cmd" && \ |
| 10054 | func_fatal_help "invalid operation mode \`$opt_mode'" |
| 10055 | |
| 10056 | if test -n "$exec_cmd"; then |
| 10057 | eval exec "$exec_cmd" |
| 10058 | exit $EXIT_FAILURE |
| 10059 | fi |
| 10060 | |
| 10061 | exit $exit_status |
| 10062 | |
| 10063 | |
| 10064 | # The TAGs below are defined such that we never get into a situation |
| 10065 | # in which we disable both kinds of libraries. Given conflicting |
| 10066 | # choices, we go for a static library, that is the most portable, |
| 10067 | # since we can't tell whether shared libraries were disabled because |
| 10068 | # the user asked for that or because the platform doesn't support |
| 10069 | # them. This is particularly important on AIX, because we don't |
| 10070 | # support having both static and shared libraries enabled at the same |
| 10071 | # time on that platform, so we default to a shared-only configuration. |
| 10072 | # If a disable-shared tag is given, we'll fallback to a static-only |
| 10073 | # configuration. But we'll never go from static-only to shared-only. |
| 10074 | |
| 10075 | # ### BEGIN LIBTOOL TAG CONFIG: disable-shared |
| 10076 | build_libtool_libs=no |
| 10077 | build_old_libs=yes |
| 10078 | # ### END LIBTOOL TAG CONFIG: disable-shared |
| 10079 | |
| 10080 | # ### BEGIN LIBTOOL TAG CONFIG: disable-static |
| 10081 | build_old_libs=`case $build_libtool_libs in yes) echo no;; *) echo yes;; esac` |
| 10082 | # ### END LIBTOOL TAG CONFIG: disable-static |
| 10083 | |
| 10084 | # Local Variables: |
| 10085 | # mode:shell-script |
| 10086 | # sh-indentation:2 |
| 10087 | # End: |
| 10088 | # vi:sw=2 |
| 10089 | |
| 10090 | |
| 10091 | # ### BEGIN LIBTOOL TAG CONFIG: CXX |
| 10092 | |
| 10093 | # The linker used to build libraries. |
| 10094 | LD="/usr/llvm-gcc-4.2/libexec/gcc/i686-apple-darwin11/4.2.1/ld" |
| 10095 | |
| 10096 | # How to create reloadable object files. |
| 10097 | reload_flag=" -r" |
| 10098 | reload_cmds="\$LTCC \$LTCFLAGS -nostdlib \${wl}-r -o \$output\$reload_objs" |
| 10099 | |
| 10100 | # Commands used to build an old-style archive. |
| 10101 | old_archive_cmds="\$AR \$AR_FLAGS \$oldlib\$oldobjs~\$RANLIB \$tool_oldlib" |
| 10102 | |
| 10103 | # A language specific compiler. |
| 10104 | CC="g++" |
| 10105 | |
| 10106 | # Is the compiler the GNU compiler? |
| 10107 | with_gcc=yes |
| 10108 | |
| 10109 | # Compiler flag to turn off builtin functions. |
| 10110 | no_builtin_flag=" -fno-builtin" |
| 10111 | |
| 10112 | # Additional compiler flags for building library objects. |
| 10113 | pic_flag=" -fno-common -DPIC" |
| 10114 | |
| 10115 | # How to pass a linker flag through the compiler. |
| 10116 | wl="-Wl," |
| 10117 | |
| 10118 | # Compiler flag to prevent dynamic linking. |
| 10119 | link_static_flag="" |
| 10120 | |
| 10121 | # Does compiler simultaneously support -c and -o options? |
| 10122 | compiler_c_o="yes" |
| 10123 | |
| 10124 | # Whether or not to add -lc for building shared libraries. |
| 10125 | build_libtool_need_lc=no |
| 10126 | |
| 10127 | # Whether or not to disallow shared libs when runtime libs are static. |
| 10128 | allow_libtool_libs_with_static_runtimes=no |
| 10129 | |
| 10130 | # Compiler flag to allow reflexive dlopens. |
| 10131 | export_dynamic_flag_spec="" |
| 10132 | |
| 10133 | # Compiler flag to generate shared objects directly from archives. |
| 10134 | whole_archive_flag_spec="\`for conv in \$convenience\\\"\\\"; do test -n \\\"\$conv\\\" && new_convenience=\\\"\$new_convenience \${wl}-force_load,\$conv\\\"; done; func_echo_all \\\"\$new_convenience\\\"\`" |
| 10135 | |
| 10136 | # Whether the compiler copes with passing no objects directly. |
| 10137 | compiler_needs_object="no" |
| 10138 | |
| 10139 | # Create an old-style archive from a shared archive. |
| 10140 | old_archive_from_new_cmds="" |
| 10141 | |
| 10142 | # Create a temporary old-style archive to link instead of a shared archive. |
| 10143 | old_archive_from_expsyms_cmds="" |
| 10144 | |
| 10145 | # Commands used to build a shared archive. |
| 10146 | archive_cmds="\$CC -dynamiclib \$allow_undefined_flag -o \$lib \$libobjs \$deplibs \$compiler_flags -install_name \$rpath/\$soname \$verstring \$single_module" |
| 10147 | archive_expsym_cmds="sed 's,^,_,' < \$export_symbols > \$output_objdir/\${libname}-symbols.expsym~\$CC -dynamiclib \$allow_undefined_flag -o \$lib \$libobjs \$deplibs \$compiler_flags -install_name \$rpath/\$soname \$verstring \$single_module \${wl}-exported_symbols_list,\$output_objdir/\${libname}-symbols.expsym" |
| 10148 | |
| 10149 | # Commands used to build a loadable module if different from building |
| 10150 | # a shared archive. |
| 10151 | module_cmds="\$CC \$allow_undefined_flag -o \$lib -bundle \$libobjs \$deplibs \$compiler_flags" |
| 10152 | module_expsym_cmds="sed -e 's,^,_,' < \$export_symbols > \$output_objdir/\${libname}-symbols.expsym~\$CC \$allow_undefined_flag -o \$lib -bundle \$libobjs \$deplibs \$compiler_flags \${wl}-exported_symbols_list,\$output_objdir/\${libname}-symbols.expsym" |
| 10153 | |
| 10154 | # Whether we are building with GNU ld or not. |
| 10155 | with_gnu_ld="no" |
| 10156 | |
| 10157 | # Flag that allows shared libraries with undefined symbols to be built. |
| 10158 | allow_undefined_flag="\${wl}-undefined \${wl}dynamic_lookup" |
| 10159 | |
| 10160 | # Flag that enforces no undefined symbols. |
| 10161 | no_undefined_flag="" |
| 10162 | |
| 10163 | # Flag to hardcode $libdir into a binary during linking. |
| 10164 | # This must work even if $libdir does not exist |
| 10165 | hardcode_libdir_flag_spec="" |
| 10166 | |
| 10167 | # Whether we need a single "-rpath" flag with a separated argument. |
| 10168 | hardcode_libdir_separator="" |
| 10169 | |
| 10170 | # Set to "yes" if using DIR/libNAME${shared_ext} during linking hardcodes |
| 10171 | # DIR into the resulting binary. |
| 10172 | hardcode_direct=no |
| 10173 | |
| 10174 | # Set to "yes" if using DIR/libNAME${shared_ext} during linking hardcodes |
| 10175 | # DIR into the resulting binary and the resulting library dependency is |
| 10176 | # "absolute",i.e impossible to change by setting ${shlibpath_var} if the |
| 10177 | # library is relocated. |
| 10178 | hardcode_direct_absolute=no |
| 10179 | |
| 10180 | # Set to "yes" if using the -LDIR flag during linking hardcodes DIR |
| 10181 | # into the resulting binary. |
| 10182 | hardcode_minus_L=no |
| 10183 | |
| 10184 | # Set to "yes" if using SHLIBPATH_VAR=DIR during linking hardcodes DIR |
| 10185 | # into the resulting binary. |
| 10186 | hardcode_shlibpath_var=unsupported |
| 10187 | |
| 10188 | # Set to "yes" if building a shared library automatically hardcodes DIR |
| 10189 | # into the library and all subsequent libraries and executables linked |
| 10190 | # against it. |
| 10191 | hardcode_automatic=yes |
| 10192 | |
| 10193 | # Set to yes if linker adds runtime paths of dependent libraries |
| 10194 | # to runtime path list. |
| 10195 | inherit_rpath=no |
| 10196 | |
| 10197 | # Whether libtool must link a program against all its dependency libraries. |
| 10198 | link_all_deplibs=yes |
| 10199 | |
| 10200 | # Set to "yes" if exported symbols are required. |
| 10201 | always_export_symbols=no |
| 10202 | |
| 10203 | # The commands to list exported symbols. |
| 10204 | export_symbols_cmds="\$NM \$libobjs \$convenience | \$global_symbol_pipe | \$SED 's/.* //' | sort | uniq > \$export_symbols" |
| 10205 | |
| 10206 | # Symbols that should not be listed in the preloaded symbols. |
| 10207 | exclude_expsyms="_GLOBAL_OFFSET_TABLE_|_GLOBAL__F[ID]_.*" |
| 10208 | |
| 10209 | # Symbols that must always be exported. |
| 10210 | include_expsyms="" |
| 10211 | |
| 10212 | # Commands necessary for linking programs (against libraries) with templates. |
| 10213 | prelink_cmds="" |
| 10214 | |
| 10215 | # Commands necessary for finishing linking programs. |
| 10216 | postlink_cmds="" |
| 10217 | |
| 10218 | # Specify filename containing input files. |
| 10219 | file_list_spec="" |
| 10220 | |
| 10221 | # How to hardcode a shared library path into an executable. |
| 10222 | hardcode_action=immediate |
| 10223 | |
| 10224 | # The directories searched by this compiler when creating a shared library. |
| 10225 | compiler_lib_search_dirs="" |
| 10226 | |
| 10227 | # Dependencies to place before and after the objects being linked to |
| 10228 | # create a shared library. |
| 10229 | predep_objects="" |
| 10230 | postdep_objects="" |
| 10231 | predeps="" |
| 10232 | postdeps="" |
| 10233 | |
| 10234 | # The library search path used internally by the compiler when linking |
| 10235 | # a shared library. |
| 10236 | compiler_lib_search_path="" |
| 10237 | |
| 10238 | # ### END LIBTOOL TAG CONFIG: CXX |