annotate src/liblo-0.26/libtool @ 89:8a15ff55d9af

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