annotate src/liblo-0.26/libtool @ 101:62d01b0205cc

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