cristy | ae56d44 | 2011-05-10 21:10:20 +0000 | [diff] [blame^] | 1 | #! /bin/sh |
cristy | 3ed852e | 2009-09-05 21:47:34 +0000 | [diff] [blame] | 2 | |
| 3 | # libtool - Provide generalized library-building support services. |
cristy | fbbafc9 | 2011-05-05 01:22:11 +0000 | [diff] [blame] | 4 | # Generated automatically by config.status (ImageMagick) 6.6.9-9 |
cristy | ae56d44 | 2011-05-10 21:10:20 +0000 | [diff] [blame^] | 5 | # Libtool was configured on host magick.imagemagick.org: |
cristy | 3ed852e | 2009-09-05 21:47:34 +0000 | [diff] [blame] | 6 | # NOTE: Changes made to this file will be lost: look at ltmain.sh. |
| 7 | # |
| 8 | # Copyright (C) 1996, 1997, 1998, 1999, 2000, 2001, 2003, 2004, 2005, |
cristy | 0c60a69 | 2010-11-04 01:09:47 +0000 | [diff] [blame] | 9 | # 2006, 2007, 2008, 2009, 2010 Free Software Foundation, |
| 10 | # Inc. |
cristy | 3ed852e | 2009-09-05 21:47:34 +0000 | [diff] [blame] | 11 | # Written by Gordon Matzigkeit, 1996 |
| 12 | # |
| 13 | # This file is part of GNU Libtool. |
| 14 | # |
| 15 | # GNU Libtool is free software; you can redistribute it and/or |
| 16 | # modify it under the terms of the GNU General Public License as |
| 17 | # published by the Free Software Foundation; either version 2 of |
| 18 | # the License, or (at your option) any later version. |
| 19 | # |
| 20 | # As a special exception to the GNU General Public License, |
| 21 | # if you distribute this file as part of a program or library that |
| 22 | # is built using GNU Libtool, you may include this file under the |
| 23 | # same distribution terms that you use for the rest of that program. |
| 24 | # |
| 25 | # GNU Libtool is distributed in the hope that it will be useful, |
| 26 | # but WITHOUT ANY WARRANTY; without even the implied warranty of |
| 27 | # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
| 28 | # GNU General Public License for more details. |
| 29 | # |
| 30 | # You should have received a copy of the GNU General Public License |
| 31 | # along with GNU Libtool; see the file COPYING. If not, a copy |
| 32 | # can be downloaded from http://www.gnu.org/licenses/gpl.html, or |
| 33 | # obtained by writing to the Free Software Foundation, Inc., |
| 34 | # 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. |
| 35 | |
| 36 | |
| 37 | # The names of the tagged configurations supported by this script. |
| 38 | available_tags="CXX " |
| 39 | |
| 40 | # ### BEGIN LIBTOOL CONFIG |
| 41 | |
| 42 | # A sed program that does not truncate output. |
| 43 | SED="/bin/sed" |
| 44 | |
| 45 | # Sed that helps us avoid accidentally triggering echo(1) options like -n. |
| 46 | Xsed="$SED -e 1s/^X//" |
| 47 | |
| 48 | # A grep program that handles long lines. |
| 49 | GREP="/bin/grep" |
| 50 | |
| 51 | # An ERE matcher. |
| 52 | EGREP="/bin/grep -E" |
| 53 | |
| 54 | # A literal string matcher. |
| 55 | FGREP="/bin/grep -F" |
| 56 | |
cristy | 0c60a69 | 2010-11-04 01:09:47 +0000 | [diff] [blame] | 57 | # Shell to use when invoking shell scripts. |
cristy | ae56d44 | 2011-05-10 21:10:20 +0000 | [diff] [blame^] | 58 | SHELL="/bin/sh" |
cristy | 0c60a69 | 2010-11-04 01:09:47 +0000 | [diff] [blame] | 59 | |
| 60 | # An echo program that protects backslashes. |
| 61 | ECHO="printf %s\\n" |
| 62 | |
cristy | 3ed852e | 2009-09-05 21:47:34 +0000 | [diff] [blame] | 63 | # Which release of libtool.m4 was used? |
cristy | da16f16 | 2011-02-19 23:52:17 +0000 | [diff] [blame] | 64 | macro_version=2.4 |
| 65 | macro_revision=1.3293 |
cristy | 3ed852e | 2009-09-05 21:47:34 +0000 | [diff] [blame] | 66 | |
| 67 | # Assembler program. |
cristy | 0c60a69 | 2010-11-04 01:09:47 +0000 | [diff] [blame] | 68 | AS="as" |
cristy | 3ed852e | 2009-09-05 21:47:34 +0000 | [diff] [blame] | 69 | |
| 70 | # DLL creation program. |
cristy | da16f16 | 2011-02-19 23:52:17 +0000 | [diff] [blame] | 71 | DLLTOOL="false" |
cristy | 3ed852e | 2009-09-05 21:47:34 +0000 | [diff] [blame] | 72 | |
| 73 | # Object dumper program. |
cristy | 0c60a69 | 2010-11-04 01:09:47 +0000 | [diff] [blame] | 74 | OBJDUMP="objdump" |
cristy | 3ed852e | 2009-09-05 21:47:34 +0000 | [diff] [blame] | 75 | |
| 76 | # Whether or not to build shared libraries. |
cristy | 2d1e59e | 2011-05-01 02:36:10 +0000 | [diff] [blame] | 77 | build_libtool_libs=yes |
cristy | 3ed852e | 2009-09-05 21:47:34 +0000 | [diff] [blame] | 78 | |
| 79 | # Whether or not to build static libraries. |
| 80 | build_old_libs=yes |
| 81 | |
| 82 | # What type of objects to build. |
| 83 | pic_mode=default |
| 84 | |
| 85 | # Whether or not to optimize for fast installation. |
cristy | 2d1e59e | 2011-05-01 02:36:10 +0000 | [diff] [blame] | 86 | fast_install=yes |
cristy | 3ed852e | 2009-09-05 21:47:34 +0000 | [diff] [blame] | 87 | |
| 88 | # The host system. |
| 89 | host_alias= |
| 90 | host=x86_64-unknown-linux-gnu |
| 91 | host_os=linux-gnu |
| 92 | |
| 93 | # The build system. |
| 94 | build_alias= |
| 95 | build=x86_64-unknown-linux-gnu |
| 96 | build_os=linux-gnu |
| 97 | |
| 98 | # A BSD- or MS-compatible name lister. |
| 99 | NM="/usr/bin/nm -B" |
| 100 | |
| 101 | # Whether we need soft or hard links. |
| 102 | LN_S="ln -s" |
| 103 | |
| 104 | # What is the maximum length of a command? |
cristy | 98dddb5 | 2010-11-04 00:30:15 +0000 | [diff] [blame] | 105 | max_cmd_len=1572864 |
cristy | 3ed852e | 2009-09-05 21:47:34 +0000 | [diff] [blame] | 106 | |
| 107 | # Object file suffix (normally "o"). |
| 108 | objext=o |
| 109 | |
| 110 | # Executable file suffix (normally ""). |
| 111 | exeext= |
| 112 | |
| 113 | # whether the shell understands "unset". |
| 114 | lt_unset=unset |
| 115 | |
| 116 | # turn spaces into newlines. |
| 117 | SP2NL="tr \\040 \\012" |
| 118 | |
| 119 | # turn newlines into spaces. |
| 120 | NL2SP="tr \\015\\012 \\040\\040" |
| 121 | |
cristy | da16f16 | 2011-02-19 23:52:17 +0000 | [diff] [blame] | 122 | # convert $build file names to $host format. |
| 123 | to_host_file_cmd=func_convert_file_noop |
| 124 | |
| 125 | # convert $build files to toolchain format. |
| 126 | to_tool_file_cmd=func_convert_file_noop |
| 127 | |
cristy | 3ed852e | 2009-09-05 21:47:34 +0000 | [diff] [blame] | 128 | # Method to check whether dependent libraries are shared objects. |
| 129 | deplibs_check_method="pass_all" |
| 130 | |
cristy | da16f16 | 2011-02-19 23:52:17 +0000 | [diff] [blame] | 131 | # Command to use when deplibs_check_method = "file_magic". |
cristy | 3ed852e | 2009-09-05 21:47:34 +0000 | [diff] [blame] | 132 | file_magic_cmd="\$MAGIC_CMD" |
| 133 | |
cristy | da16f16 | 2011-02-19 23:52:17 +0000 | [diff] [blame] | 134 | # How to find potential files when deplibs_check_method = "file_magic". |
| 135 | file_magic_glob="" |
| 136 | |
| 137 | # Find potential files using nocaseglob when deplibs_check_method = "file_magic". |
| 138 | want_nocaseglob="no" |
| 139 | |
| 140 | # Command to associate shared and link libraries. |
| 141 | sharedlib_from_linklib_cmd="printf %s\\n" |
| 142 | |
cristy | 3ed852e | 2009-09-05 21:47:34 +0000 | [diff] [blame] | 143 | # The archiver. |
| 144 | AR="ar" |
cristy | da16f16 | 2011-02-19 23:52:17 +0000 | [diff] [blame] | 145 | |
| 146 | # Flags to create an archive. |
cristy | 3ed852e | 2009-09-05 21:47:34 +0000 | [diff] [blame] | 147 | AR_FLAGS="cru" |
| 148 | |
cristy | da16f16 | 2011-02-19 23:52:17 +0000 | [diff] [blame] | 149 | # How to feed a file listing to the archiver. |
| 150 | archiver_list_spec="@" |
| 151 | |
cristy | 3ed852e | 2009-09-05 21:47:34 +0000 | [diff] [blame] | 152 | # A symbol stripping program. |
| 153 | STRIP="strip" |
| 154 | |
| 155 | # Commands used to install an old-style archive. |
| 156 | RANLIB="ranlib" |
| 157 | old_postinstall_cmds="chmod 644 \$oldlib~\$RANLIB \$oldlib" |
| 158 | old_postuninstall_cmds="" |
| 159 | |
cristy | 0c60a69 | 2010-11-04 01:09:47 +0000 | [diff] [blame] | 160 | # Whether to use a lock for old archive extraction. |
| 161 | lock_old_archive_extraction=no |
| 162 | |
cristy | 3ed852e | 2009-09-05 21:47:34 +0000 | [diff] [blame] | 163 | # A C compiler. |
cristy | 2d1e59e | 2011-05-01 02:36:10 +0000 | [diff] [blame] | 164 | LTCC="gcc -std=gnu99 -std=gnu99" |
cristy | 3ed852e | 2009-09-05 21:47:34 +0000 | [diff] [blame] | 165 | |
| 166 | # LTCC compiler flags. |
cristy | ae56d44 | 2011-05-10 21:10:20 +0000 | [diff] [blame^] | 167 | LTCFLAGS="-fopenmp -g -O2 -Wall -pthread" |
cristy | 3ed852e | 2009-09-05 21:47:34 +0000 | [diff] [blame] | 168 | |
| 169 | # Take the output of nm and produce a listing of raw symbols and C names. |
cristy | da16f16 | 2011-02-19 23:52:17 +0000 | [diff] [blame] | 170 | global_symbol_pipe="sed -n -e 's/^.*[ ]\\([ABCDGIRSTW][ABCDGIRSTW]*\\)[ ][ ]*\\([_A-Za-z][_A-Za-z0-9]*\\)\$/\\1 \\2 \\2/p' | sed '/ __gnu_lto/d'" |
cristy | 3ed852e | 2009-09-05 21:47:34 +0000 | [diff] [blame] | 171 | |
| 172 | # Transform the output of nm in a proper C declaration. |
| 173 | global_symbol_to_cdecl="sed -n -e 's/^T .* \\(.*\\)\$/extern int \\1();/p' -e 's/^[ABCDGIRSTW]* .* \\(.*\\)\$/extern char \\1;/p'" |
| 174 | |
| 175 | # Transform the output of nm in a C name address pair. |
cristy | da16f16 | 2011-02-19 23:52:17 +0000 | [diff] [blame] | 176 | global_symbol_to_c_name_address="sed -n -e 's/^: \\([^ ]*\\)[ ]*\$/ {\\\"\\1\\\", (void *) 0},/p' -e 's/^[ABCDGIRSTW]* \\([^ ]*\\) \\([^ ]*\\)\$/ {\"\\2\", (void *) \\&\\2},/p'" |
cristy | 3ed852e | 2009-09-05 21:47:34 +0000 | [diff] [blame] | 177 | |
| 178 | # Transform the output of nm in a C name address pair when lib prefix is needed. |
cristy | da16f16 | 2011-02-19 23:52:17 +0000 | [diff] [blame] | 179 | global_symbol_to_c_name_address_lib_prefix="sed -n -e 's/^: \\([^ ]*\\)[ ]*\$/ {\\\"\\1\\\", (void *) 0},/p' -e 's/^[ABCDGIRSTW]* \\([^ ]*\\) \\(lib[^ ]*\\)\$/ {\"\\2\", (void *) \\&\\2},/p' -e 's/^[ABCDGIRSTW]* \\([^ ]*\\) \\([^ ]*\\)\$/ {\"lib\\2\", (void *) \\&\\2},/p'" |
| 180 | |
| 181 | # Specify filename containing input files for $NM. |
| 182 | nm_file_list_spec="@" |
| 183 | |
| 184 | # The root where to search for dependent libraries,and in which our libraries should be installed. |
| 185 | lt_sysroot= |
cristy | 3ed852e | 2009-09-05 21:47:34 +0000 | [diff] [blame] | 186 | |
| 187 | # The name of the directory that contains temporary libtool files. |
| 188 | objdir=.libs |
| 189 | |
cristy | 3ed852e | 2009-09-05 21:47:34 +0000 | [diff] [blame] | 190 | # Used to examine libraries when file_magic_cmd begins with "file". |
| 191 | MAGIC_CMD=file |
| 192 | |
| 193 | # Must we lock files when doing compilation? |
| 194 | need_locks="no" |
| 195 | |
cristy | da16f16 | 2011-02-19 23:52:17 +0000 | [diff] [blame] | 196 | # Manifest tool. |
| 197 | MANIFEST_TOOL=":" |
| 198 | |
cristy | 3ed852e | 2009-09-05 21:47:34 +0000 | [diff] [blame] | 199 | # Tool to manipulate archived DWARF debug symbol files on Mac OS X. |
| 200 | DSYMUTIL="" |
| 201 | |
| 202 | # Tool to change global to local symbols on Mac OS X. |
| 203 | NMEDIT="" |
| 204 | |
| 205 | # Tool to manipulate fat objects and archives on Mac OS X. |
| 206 | LIPO="" |
| 207 | |
| 208 | # ldd/readelf like tool for Mach-O binaries on Mac OS X. |
| 209 | OTOOL="" |
| 210 | |
| 211 | # ldd/readelf like tool for 64 bit Mach-O binaries on Mac OS X 10.4. |
| 212 | OTOOL64="" |
| 213 | |
| 214 | # Old archive suffix (normally "a"). |
| 215 | libext=a |
| 216 | |
| 217 | # Shared library suffix (normally ".so"). |
| 218 | shrext_cmds=".so" |
| 219 | |
| 220 | # The commands to extract the exported symbol list from a shared archive. |
| 221 | extract_expsyms_cmds="" |
| 222 | |
| 223 | # Variables whose values should be saved in libtool wrapper scripts and |
| 224 | # restored at link time. |
| 225 | variables_saved_for_relink="PATH LD_LIBRARY_PATH LD_RUN_PATH GCC_EXEC_PREFIX COMPILER_PATH LIBRARY_PATH" |
| 226 | |
| 227 | # Do we need the "lib" prefix for modules? |
| 228 | need_lib_prefix=no |
| 229 | |
| 230 | # Do we need a version for libraries? |
| 231 | need_version=no |
| 232 | |
| 233 | # Library versioning type. |
| 234 | version_type=linux |
| 235 | |
| 236 | # Shared library runtime path variable. |
| 237 | runpath_var=LD_RUN_PATH |
| 238 | |
| 239 | # Shared library path variable. |
| 240 | shlibpath_var=LD_LIBRARY_PATH |
| 241 | |
| 242 | # Is shlibpath searched before the hard-coded library search path? |
| 243 | shlibpath_overrides_runpath=no |
| 244 | |
| 245 | # Format of library name prefix. |
| 246 | libname_spec="lib\$name" |
| 247 | |
| 248 | # List of archive names. First name is the real one, the rest are links. |
| 249 | # The last name is the one that the linker finds with -lNAME |
| 250 | library_names_spec="\${libname}\${release}\${shared_ext}\$versuffix \${libname}\${release}\${shared_ext}\$major \$libname\${shared_ext}" |
| 251 | |
| 252 | # The coded name of the library, if different from the real name. |
| 253 | soname_spec="\${libname}\${release}\${shared_ext}\$major" |
| 254 | |
cristy | 0c60a69 | 2010-11-04 01:09:47 +0000 | [diff] [blame] | 255 | # Permission mode override for installation of shared libraries. |
| 256 | install_override_mode="" |
| 257 | |
cristy | 3ed852e | 2009-09-05 21:47:34 +0000 | [diff] [blame] | 258 | # Command to use after installation of a shared archive. |
| 259 | postinstall_cmds="" |
| 260 | |
| 261 | # Command to use after uninstallation of a shared archive. |
| 262 | postuninstall_cmds="" |
| 263 | |
| 264 | # Commands used to finish a libtool library installation in a directory. |
| 265 | finish_cmds="PATH=\\\"\\\$PATH:/sbin\\\" ldconfig -n \$libdir" |
| 266 | |
| 267 | # As "finish_cmds", except a single script fragment to be evaled but |
| 268 | # not shown. |
| 269 | finish_eval="" |
| 270 | |
| 271 | # Whether we should hardcode library paths into libraries. |
| 272 | hardcode_into_libs=yes |
| 273 | |
| 274 | # Compile-time system search path for libraries. |
cristy | ae56d44 | 2011-05-10 21:10:20 +0000 | [diff] [blame^] | 275 | sys_lib_search_path_spec="/usr/lib/gcc/x86_64-redhat-linux/4.6.0 /usr/lib64 /lib64 " |
cristy | 3ed852e | 2009-09-05 21:47:34 +0000 | [diff] [blame] | 276 | |
| 277 | # Run-time system search path for libraries. |
cristy | ae56d44 | 2011-05-10 21:10:20 +0000 | [diff] [blame^] | 278 | sys_lib_dlsearch_path_spec="/lib64 /usr/lib64 /lib /usr/lib /usr/lib64/atlas /usr/lib64/mysql /usr/lib64/qt-3.3/lib /usr/lib64/tcl8.5/tclx8.4 /usr/lib64/tcl8.5 /usr/lib/wine/ /usr/lib64/wine/ /usr/lib64/xulrunner-2 " |
cristy | 3ed852e | 2009-09-05 21:47:34 +0000 | [diff] [blame] | 279 | |
| 280 | # Whether dlopen is supported. |
| 281 | dlopen_support=yes |
| 282 | |
| 283 | # Whether dlopen of programs is supported. |
cristy | 2d1e59e | 2011-05-01 02:36:10 +0000 | [diff] [blame] | 284 | dlopen_self=yes |
cristy | 3ed852e | 2009-09-05 21:47:34 +0000 | [diff] [blame] | 285 | |
| 286 | # Whether dlopen of statically linked programs is supported. |
cristy | ae56d44 | 2011-05-10 21:10:20 +0000 | [diff] [blame^] | 287 | dlopen_self_static=yes |
cristy | 3ed852e | 2009-09-05 21:47:34 +0000 | [diff] [blame] | 288 | |
| 289 | # Commands to strip libraries. |
| 290 | old_striplib="strip --strip-debug" |
| 291 | striplib="strip --strip-unneeded" |
| 292 | |
| 293 | |
| 294 | # The linker used to build libraries. |
| 295 | LD="/usr/bin/ld -m elf_x86_64" |
| 296 | |
cristy | 0c60a69 | 2010-11-04 01:09:47 +0000 | [diff] [blame] | 297 | # How to create reloadable object files. |
| 298 | reload_flag=" -r" |
| 299 | reload_cmds="\$LD\$reload_flag -o \$output\$reload_objs" |
| 300 | |
cristy | 3ed852e | 2009-09-05 21:47:34 +0000 | [diff] [blame] | 301 | # Commands used to build an old-style archive. |
| 302 | old_archive_cmds="\$AR \$AR_FLAGS \$oldlib\$oldobjs~\$RANLIB \$oldlib" |
| 303 | |
| 304 | # A language specific compiler. |
cristy | 2d1e59e | 2011-05-01 02:36:10 +0000 | [diff] [blame] | 305 | CC="gcc -std=gnu99 -std=gnu99" |
cristy | 3ed852e | 2009-09-05 21:47:34 +0000 | [diff] [blame] | 306 | |
| 307 | # Is the compiler the GNU compiler? |
| 308 | with_gcc=yes |
| 309 | |
| 310 | # Compiler flag to turn off builtin functions. |
cristy | 2d1e59e | 2011-05-01 02:36:10 +0000 | [diff] [blame] | 311 | no_builtin_flag=" -fno-builtin" |
cristy | 3ed852e | 2009-09-05 21:47:34 +0000 | [diff] [blame] | 312 | |
cristy | 3ed852e | 2009-09-05 21:47:34 +0000 | [diff] [blame] | 313 | # Additional compiler flags for building library objects. |
| 314 | pic_flag=" -fPIC -DPIC" |
| 315 | |
cristy | da16f16 | 2011-02-19 23:52:17 +0000 | [diff] [blame] | 316 | # How to pass a linker flag through the compiler. |
| 317 | wl="-Wl," |
| 318 | |
cristy | 3ed852e | 2009-09-05 21:47:34 +0000 | [diff] [blame] | 319 | # Compiler flag to prevent dynamic linking. |
cristy | ae56d44 | 2011-05-10 21:10:20 +0000 | [diff] [blame^] | 320 | link_static_flag="" |
cristy | 3ed852e | 2009-09-05 21:47:34 +0000 | [diff] [blame] | 321 | |
| 322 | # Does compiler simultaneously support -c and -o options? |
| 323 | compiler_c_o="yes" |
| 324 | |
| 325 | # Whether or not to add -lc for building shared libraries. |
cristy | 2d1e59e | 2011-05-01 02:36:10 +0000 | [diff] [blame] | 326 | build_libtool_need_lc=no |
cristy | 3ed852e | 2009-09-05 21:47:34 +0000 | [diff] [blame] | 327 | |
| 328 | # Whether or not to disallow shared libs when runtime libs are static. |
| 329 | allow_libtool_libs_with_static_runtimes=no |
| 330 | |
| 331 | # Compiler flag to allow reflexive dlopens. |
| 332 | export_dynamic_flag_spec="\${wl}--export-dynamic" |
| 333 | |
| 334 | # Compiler flag to generate shared objects directly from archives. |
| 335 | whole_archive_flag_spec="\${wl}--whole-archive\$convenience \${wl}--no-whole-archive" |
| 336 | |
| 337 | # Whether the compiler copes with passing no objects directly. |
| 338 | compiler_needs_object="no" |
| 339 | |
| 340 | # Create an old-style archive from a shared archive. |
| 341 | old_archive_from_new_cmds="" |
| 342 | |
| 343 | # Create a temporary old-style archive to link instead of a shared archive. |
| 344 | old_archive_from_expsyms_cmds="" |
| 345 | |
| 346 | # Commands used to build a shared archive. |
cristy | da16f16 | 2011-02-19 23:52:17 +0000 | [diff] [blame] | 347 | archive_cmds="\$CC -shared \$pic_flag \$libobjs \$deplibs \$compiler_flags \${wl}-soname \$wl\$soname -o \$lib" |
cristy | 3ed852e | 2009-09-05 21:47:34 +0000 | [diff] [blame] | 348 | archive_expsym_cmds="echo \\\"{ global:\\\" > \$output_objdir/\$libname.ver~ |
| 349 | cat \$export_symbols | sed -e \\\"s/\\\\(.*\\\\)/\\\\1;/\\\" >> \$output_objdir/\$libname.ver~ |
| 350 | echo \\\"local: *; };\\\" >> \$output_objdir/\$libname.ver~ |
cristy | da16f16 | 2011-02-19 23:52:17 +0000 | [diff] [blame] | 351 | \$CC -shared \$pic_flag \$libobjs \$deplibs \$compiler_flags \${wl}-soname \$wl\$soname \${wl}-version-script \${wl}\$output_objdir/\$libname.ver -o \$lib" |
cristy | 3ed852e | 2009-09-05 21:47:34 +0000 | [diff] [blame] | 352 | |
| 353 | # Commands used to build a loadable module if different from building |
| 354 | # a shared archive. |
| 355 | module_cmds="" |
| 356 | module_expsym_cmds="" |
| 357 | |
| 358 | # Whether we are building with GNU ld or not. |
| 359 | with_gnu_ld="yes" |
| 360 | |
| 361 | # Flag that allows shared libraries with undefined symbols to be built. |
| 362 | allow_undefined_flag="" |
| 363 | |
| 364 | # Flag that enforces no undefined symbols. |
| 365 | no_undefined_flag="" |
| 366 | |
| 367 | # Flag to hardcode $libdir into a binary during linking. |
| 368 | # This must work even if $libdir does not exist |
| 369 | hardcode_libdir_flag_spec="\${wl}-rpath \${wl}\$libdir" |
| 370 | |
| 371 | # If ld is used when linking, flag to hardcode $libdir into a binary |
| 372 | # during linking. This must work even if $libdir does not exist. |
| 373 | hardcode_libdir_flag_spec_ld="" |
| 374 | |
| 375 | # Whether we need a single "-rpath" flag with a separated argument. |
| 376 | hardcode_libdir_separator="" |
| 377 | |
| 378 | # Set to "yes" if using DIR/libNAME${shared_ext} during linking hardcodes |
| 379 | # DIR into the resulting binary. |
| 380 | hardcode_direct=no |
| 381 | |
| 382 | # Set to "yes" if using DIR/libNAME${shared_ext} during linking hardcodes |
| 383 | # DIR into the resulting binary and the resulting library dependency is |
| 384 | # "absolute",i.e impossible to change by setting ${shlibpath_var} if the |
| 385 | # library is relocated. |
| 386 | hardcode_direct_absolute=no |
| 387 | |
| 388 | # Set to "yes" if using the -LDIR flag during linking hardcodes DIR |
| 389 | # into the resulting binary. |
| 390 | hardcode_minus_L=no |
| 391 | |
| 392 | # Set to "yes" if using SHLIBPATH_VAR=DIR during linking hardcodes DIR |
| 393 | # into the resulting binary. |
| 394 | hardcode_shlibpath_var=unsupported |
| 395 | |
| 396 | # Set to "yes" if building a shared library automatically hardcodes DIR |
| 397 | # into the library and all subsequent libraries and executables linked |
| 398 | # against it. |
| 399 | hardcode_automatic=no |
| 400 | |
| 401 | # Set to yes if linker adds runtime paths of dependent libraries |
| 402 | # to runtime path list. |
| 403 | inherit_rpath=no |
| 404 | |
| 405 | # Whether libtool must link a program against all its dependency libraries. |
| 406 | link_all_deplibs=unknown |
| 407 | |
cristy | 3ed852e | 2009-09-05 21:47:34 +0000 | [diff] [blame] | 408 | # Set to "yes" if exported symbols are required. |
| 409 | always_export_symbols=no |
| 410 | |
| 411 | # The commands to list exported symbols. |
| 412 | export_symbols_cmds="\$NM \$libobjs \$convenience | \$global_symbol_pipe | \$SED 's/.* //' | sort | uniq > \$export_symbols" |
| 413 | |
| 414 | # Symbols that should not be listed in the preloaded symbols. |
| 415 | exclude_expsyms="_GLOBAL_OFFSET_TABLE_|_GLOBAL__F[ID]_.*" |
| 416 | |
| 417 | # Symbols that must always be exported. |
| 418 | include_expsyms="" |
| 419 | |
| 420 | # Commands necessary for linking programs (against libraries) with templates. |
| 421 | prelink_cmds="" |
| 422 | |
cristy | da16f16 | 2011-02-19 23:52:17 +0000 | [diff] [blame] | 423 | # Commands necessary for finishing linking programs. |
| 424 | postlink_cmds="" |
| 425 | |
cristy | 3ed852e | 2009-09-05 21:47:34 +0000 | [diff] [blame] | 426 | # Specify filename containing input files. |
| 427 | file_list_spec="" |
| 428 | |
| 429 | # How to hardcode a shared library path into an executable. |
| 430 | hardcode_action=immediate |
| 431 | |
| 432 | # The directories searched by this compiler when creating a shared library. |
| 433 | compiler_lib_search_dirs="" |
| 434 | |
| 435 | # Dependencies to place before and after the objects being linked to |
| 436 | # create a shared library. |
| 437 | predep_objects="" |
| 438 | postdep_objects="" |
| 439 | predeps="" |
| 440 | postdeps="" |
| 441 | |
| 442 | # The library search path used internally by the compiler when linking |
| 443 | # a shared library. |
| 444 | compiler_lib_search_path="" |
| 445 | |
| 446 | # ### END LIBTOOL CONFIG |
| 447 | |
cristy | 3ed852e | 2009-09-05 21:47:34 +0000 | [diff] [blame] | 448 | |
cristy | da16f16 | 2011-02-19 23:52:17 +0000 | [diff] [blame] | 449 | # libtool (GNU libtool) 2.4 |
cristy | 3ed852e | 2009-09-05 21:47:34 +0000 | [diff] [blame] | 450 | # Written by Gordon Matzigkeit <gord@gnu.ai.mit.edu>, 1996 |
| 451 | |
cristy | 98dddb5 | 2010-11-04 00:30:15 +0000 | [diff] [blame] | 452 | # Copyright (C) 1996, 1997, 1998, 1999, 2000, 2001, 2003, 2004, 2005, 2006, |
| 453 | # 2007, 2008, 2009, 2010 Free Software Foundation, Inc. |
cristy | 3ed852e | 2009-09-05 21:47:34 +0000 | [diff] [blame] | 454 | # This is free software; see the source for copying conditions. There is NO |
| 455 | # warranty; not even for MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. |
| 456 | |
| 457 | # GNU Libtool is free software; you can redistribute it and/or modify |
| 458 | # it under the terms of the GNU General Public License as published by |
| 459 | # the Free Software Foundation; either version 2 of the License, or |
| 460 | # (at your option) any later version. |
| 461 | # |
| 462 | # As a special exception to the GNU General Public License, |
| 463 | # if you distribute this file as part of a program or library that |
| 464 | # is built using GNU Libtool, you may include this file under the |
| 465 | # same distribution terms that you use for the rest of that program. |
| 466 | # |
| 467 | # GNU Libtool is distributed in the hope that it will be useful, but |
| 468 | # WITHOUT ANY WARRANTY; without even the implied warranty of |
| 469 | # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU |
| 470 | # General Public License for more details. |
| 471 | # |
| 472 | # You should have received a copy of the GNU General Public License |
| 473 | # along with GNU Libtool; see the file COPYING. If not, a copy |
| 474 | # can be downloaded from http://www.gnu.org/licenses/gpl.html, |
| 475 | # or obtained by writing to the Free Software Foundation, Inc., |
| 476 | # 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. |
| 477 | |
| 478 | # Usage: $progname [OPTION]... [MODE-ARG]... |
| 479 | # |
| 480 | # Provide generalized library-building support services. |
| 481 | # |
cristy | 98dddb5 | 2010-11-04 00:30:15 +0000 | [diff] [blame] | 482 | # --config show all configuration variables |
| 483 | # --debug enable verbose shell tracing |
| 484 | # -n, --dry-run display commands without modifying any files |
| 485 | # --features display basic configuration information and exit |
| 486 | # --mode=MODE use operation mode MODE |
| 487 | # --preserve-dup-deps don't remove duplicate dependency libraries |
| 488 | # --quiet, --silent don't print informational messages |
| 489 | # --no-quiet, --no-silent |
| 490 | # print informational messages (default) |
| 491 | # --tag=TAG use configuration variables from tag TAG |
| 492 | # -v, --verbose print more informational messages than default |
| 493 | # --no-verbose don't print the extra informational messages |
| 494 | # --version print version information |
| 495 | # -h, --help, --help-all print short, long, or detailed help message |
cristy | 3ed852e | 2009-09-05 21:47:34 +0000 | [diff] [blame] | 496 | # |
| 497 | # MODE must be one of the following: |
| 498 | # |
cristy | 98dddb5 | 2010-11-04 00:30:15 +0000 | [diff] [blame] | 499 | # clean remove files from the build directory |
| 500 | # compile compile a source file into a libtool object |
| 501 | # execute automatically set library path, then run a program |
| 502 | # finish complete the installation of libtool libraries |
| 503 | # install install libraries or executables |
| 504 | # link create a library or an executable |
| 505 | # uninstall remove libraries from an installed directory |
cristy | 3ed852e | 2009-09-05 21:47:34 +0000 | [diff] [blame] | 506 | # |
cristy | 98dddb5 | 2010-11-04 00:30:15 +0000 | [diff] [blame] | 507 | # MODE-ARGS vary depending on the MODE. When passed as first option, |
| 508 | # `--mode=MODE' may be abbreviated as `MODE' or a unique abbreviation of that. |
cristy | 3ed852e | 2009-09-05 21:47:34 +0000 | [diff] [blame] | 509 | # Try `$progname --help --mode=MODE' for a more detailed description of MODE. |
| 510 | # |
| 511 | # When reporting a bug, please describe a test case to reproduce it and |
| 512 | # include the following information: |
| 513 | # |
cristy | 98dddb5 | 2010-11-04 00:30:15 +0000 | [diff] [blame] | 514 | # host-triplet: $host |
| 515 | # shell: $SHELL |
| 516 | # compiler: $LTCC |
| 517 | # compiler flags: $LTCFLAGS |
| 518 | # linker: $LD (gnu? $with_gnu_ld) |
cristy | da16f16 | 2011-02-19 23:52:17 +0000 | [diff] [blame] | 519 | # $progname: (GNU libtool) 2.4 |
cristy | 98dddb5 | 2010-11-04 00:30:15 +0000 | [diff] [blame] | 520 | # automake: $automake_version |
| 521 | # autoconf: $autoconf_version |
cristy | 3ed852e | 2009-09-05 21:47:34 +0000 | [diff] [blame] | 522 | # |
| 523 | # Report bugs to <bug-libtool@gnu.org>. |
cristy | da16f16 | 2011-02-19 23:52:17 +0000 | [diff] [blame] | 524 | # GNU libtool home page: <http://www.gnu.org/software/libtool/>. |
| 525 | # General help using GNU software: <http://www.gnu.org/gethelp/>. |
cristy | 3ed852e | 2009-09-05 21:47:34 +0000 | [diff] [blame] | 526 | |
cristy | 98dddb5 | 2010-11-04 00:30:15 +0000 | [diff] [blame] | 527 | PROGRAM=libtool |
cristy | 3ed852e | 2009-09-05 21:47:34 +0000 | [diff] [blame] | 528 | PACKAGE=libtool |
cristy | da16f16 | 2011-02-19 23:52:17 +0000 | [diff] [blame] | 529 | VERSION=2.4 |
cristy | cd4c531 | 2009-11-22 01:19:08 +0000 | [diff] [blame] | 530 | TIMESTAMP="" |
cristy | da16f16 | 2011-02-19 23:52:17 +0000 | [diff] [blame] | 531 | package_revision=1.3293 |
cristy | 3ed852e | 2009-09-05 21:47:34 +0000 | [diff] [blame] | 532 | |
| 533 | # Be Bourne compatible |
| 534 | if test -n "${ZSH_VERSION+set}" && (emulate sh) >/dev/null 2>&1; then |
| 535 | emulate sh |
| 536 | NULLCMD=: |
| 537 | # Zsh 3.x and 4.x performs word splitting on ${1+"$@"}, which |
| 538 | # is contrary to our usage. Disable this feature. |
| 539 | alias -g '${1+"$@"}'='"$@"' |
| 540 | setopt NO_GLOB_SUBST |
| 541 | else |
| 542 | case `(set -o) 2>/dev/null` in *posix*) set -o posix;; esac |
| 543 | fi |
| 544 | BIN_SH=xpg4; export BIN_SH # for Tru64 |
| 545 | DUALCASE=1; export DUALCASE # for MKS sh |
| 546 | |
cristy | 98dddb5 | 2010-11-04 00:30:15 +0000 | [diff] [blame] | 547 | # A function that is used when there is no print builtin or printf. |
| 548 | func_fallback_echo () |
| 549 | { |
| 550 | eval 'cat <<_LTECHO_EOF |
| 551 | $1 |
| 552 | _LTECHO_EOF' |
| 553 | } |
| 554 | |
cristy | 3ed852e | 2009-09-05 21:47:34 +0000 | [diff] [blame] | 555 | # NLS nuisances: We save the old values to restore during execute mode. |
cristy | 3ed852e | 2009-09-05 21:47:34 +0000 | [diff] [blame] | 556 | lt_user_locale= |
| 557 | lt_safe_locale= |
| 558 | for lt_var in LANG LANGUAGE LC_ALL LC_CTYPE LC_COLLATE LC_MESSAGES |
| 559 | do |
| 560 | eval "if test \"\${$lt_var+set}\" = set; then |
| 561 | save_$lt_var=\$$lt_var |
| 562 | $lt_var=C |
| 563 | export $lt_var |
| 564 | lt_user_locale=\"$lt_var=\\\$save_\$lt_var; \$lt_user_locale\" |
| 565 | lt_safe_locale=\"$lt_var=C; \$lt_safe_locale\" |
| 566 | fi" |
| 567 | done |
cristy | 98dddb5 | 2010-11-04 00:30:15 +0000 | [diff] [blame] | 568 | LC_ALL=C |
| 569 | LANGUAGE=C |
| 570 | export LANGUAGE LC_ALL |
cristy | 3ed852e | 2009-09-05 21:47:34 +0000 | [diff] [blame] | 571 | |
| 572 | $lt_unset CDPATH |
| 573 | |
| 574 | |
cristy | 98dddb5 | 2010-11-04 00:30:15 +0000 | [diff] [blame] | 575 | # Work around backward compatibility issue on IRIX 6.5. On IRIX 6.4+, sh |
| 576 | # is ksh but when the shell is invoked as "sh" and the current value of |
| 577 | # the _XPG environment variable is not equal to 1 (one), the special |
| 578 | # positional parameter $0, within a function call, is the name of the |
| 579 | # function. |
| 580 | progpath="$0" |
cristy | 3ed852e | 2009-09-05 21:47:34 +0000 | [diff] [blame] | 581 | |
| 582 | |
| 583 | |
| 584 | : ${CP="cp -f"} |
cristy | 98dddb5 | 2010-11-04 00:30:15 +0000 | [diff] [blame] | 585 | test "${ECHO+set}" = set || ECHO=${as_echo-'printf %s\n'} |
cristy | cd4c531 | 2009-11-22 01:19:08 +0000 | [diff] [blame] | 586 | : ${EGREP="/bin/grep -E"} |
| 587 | : ${FGREP="/bin/grep -F"} |
| 588 | : ${GREP="/bin/grep"} |
cristy | 3ed852e | 2009-09-05 21:47:34 +0000 | [diff] [blame] | 589 | : ${LN_S="ln -s"} |
| 590 | : ${MAKE="make"} |
| 591 | : ${MKDIR="mkdir"} |
| 592 | : ${MV="mv -f"} |
| 593 | : ${RM="rm -f"} |
cristy | cd4c531 | 2009-11-22 01:19:08 +0000 | [diff] [blame] | 594 | : ${SED="/bin/sed"} |
cristy | 3ed852e | 2009-09-05 21:47:34 +0000 | [diff] [blame] | 595 | : ${SHELL="${CONFIG_SHELL-/bin/sh}"} |
| 596 | : ${Xsed="$SED -e 1s/^X//"} |
| 597 | |
| 598 | # Global variables: |
| 599 | EXIT_SUCCESS=0 |
| 600 | EXIT_FAILURE=1 |
| 601 | EXIT_MISMATCH=63 # $? = 63 is used to indicate version mismatch to missing. |
| 602 | EXIT_SKIP=77 # $? = 77 is used to indicate a skipped test to automake. |
| 603 | |
| 604 | exit_status=$EXIT_SUCCESS |
| 605 | |
| 606 | # Make sure IFS has a sensible default |
| 607 | lt_nl=' |
| 608 | ' |
| 609 | IFS=" $lt_nl" |
| 610 | |
| 611 | dirname="s,/[^/]*$,," |
| 612 | basename="s,^.*/,," |
| 613 | |
cristy | 3ed852e | 2009-09-05 21:47:34 +0000 | [diff] [blame] | 614 | # func_dirname file append nondir_replacement |
| 615 | # Compute the dirname of FILE. If nonempty, add APPEND to the result, |
| 616 | # otherwise set result to NONDIR_REPLACEMENT. |
| 617 | func_dirname () |
| 618 | { |
cristy | da16f16 | 2011-02-19 23:52:17 +0000 | [diff] [blame] | 619 | case ${1} in |
| 620 | */*) func_dirname_result="${1%/*}${2}" ;; |
| 621 | * ) func_dirname_result="${3}" ;; |
| 622 | esac |
| 623 | } # Extended-shell func_dirname implementation |
| 624 | |
cristy | 3ed852e | 2009-09-05 21:47:34 +0000 | [diff] [blame] | 625 | |
| 626 | # func_basename file |
| 627 | func_basename () |
| 628 | { |
cristy | da16f16 | 2011-02-19 23:52:17 +0000 | [diff] [blame] | 629 | func_basename_result="${1##*/}" |
| 630 | } # Extended-shell func_basename implementation |
| 631 | |
cristy | 3ed852e | 2009-09-05 21:47:34 +0000 | [diff] [blame] | 632 | |
| 633 | # func_dirname_and_basename file append nondir_replacement |
| 634 | # perform func_basename and func_dirname in a single function |
| 635 | # call: |
| 636 | # dirname: Compute the dirname of FILE. If nonempty, |
| 637 | # add APPEND to the result, otherwise set result |
| 638 | # to NONDIR_REPLACEMENT. |
| 639 | # value returned in "$func_dirname_result" |
| 640 | # basename: Compute filename of FILE. |
| 641 | # value retuned in "$func_basename_result" |
| 642 | # Implementation must be kept synchronized with func_dirname |
| 643 | # and func_basename. For efficiency, we do not delegate to |
| 644 | # those functions but instead duplicate the functionality here. |
| 645 | func_dirname_and_basename () |
| 646 | { |
cristy | da16f16 | 2011-02-19 23:52:17 +0000 | [diff] [blame] | 647 | case ${1} in |
| 648 | */*) func_dirname_result="${1%/*}${2}" ;; |
| 649 | * ) func_dirname_result="${3}" ;; |
| 650 | esac |
| 651 | func_basename_result="${1##*/}" |
| 652 | } # Extended-shell func_dirname_and_basename implementation |
| 653 | |
cristy | 3ed852e | 2009-09-05 21:47:34 +0000 | [diff] [blame] | 654 | |
| 655 | # func_stripname prefix suffix name |
| 656 | # strip PREFIX and SUFFIX off of NAME. |
| 657 | # PREFIX and SUFFIX must not contain globbing or regex special |
| 658 | # characters, hashes, percent signs, but SUFFIX may contain a leading |
| 659 | # dot (in which case that matches only a dot). |
cristy | da16f16 | 2011-02-19 23:52:17 +0000 | [diff] [blame] | 660 | # func_strip_suffix prefix name |
cristy | 3ed852e | 2009-09-05 21:47:34 +0000 | [diff] [blame] | 661 | func_stripname () |
| 662 | { |
cristy | da16f16 | 2011-02-19 23:52:17 +0000 | [diff] [blame] | 663 | # pdksh 5.2.14 does not do ${X%$Y} correctly if both X and Y are |
| 664 | # positional parameters, so assign one to ordinary parameter first. |
| 665 | func_stripname_result=${3} |
| 666 | func_stripname_result=${func_stripname_result#"${1}"} |
| 667 | func_stripname_result=${func_stripname_result%"${2}"} |
| 668 | } # Extended-shell func_stripname implementation |
cristy | 3ed852e | 2009-09-05 21:47:34 +0000 | [diff] [blame] | 669 | |
cristy | 3ed852e | 2009-09-05 21:47:34 +0000 | [diff] [blame] | 670 | |
cristy | 98dddb5 | 2010-11-04 00:30:15 +0000 | [diff] [blame] | 671 | # These SED scripts presuppose an absolute path with a trailing slash. |
| 672 | pathcar='s,^/\([^/]*\).*$,\1,' |
| 673 | pathcdr='s,^/[^/]*,,' |
| 674 | removedotparts=':dotsl |
| 675 | s@/\./@/@g |
| 676 | t dotsl |
| 677 | s,/\.$,/,' |
| 678 | collapseslashes='s@/\{1,\}@/@g' |
| 679 | finalslash='s,/*$,/,' |
| 680 | |
| 681 | # func_normal_abspath PATH |
| 682 | # Remove doubled-up and trailing slashes, "." path components, |
| 683 | # and cancel out any ".." path components in PATH after making |
| 684 | # it an absolute path. |
| 685 | # value returned in "$func_normal_abspath_result" |
| 686 | func_normal_abspath () |
| 687 | { |
| 688 | # Start from root dir and reassemble the path. |
| 689 | func_normal_abspath_result= |
| 690 | func_normal_abspath_tpath=$1 |
| 691 | func_normal_abspath_altnamespace= |
| 692 | case $func_normal_abspath_tpath in |
| 693 | "") |
| 694 | # Empty path, that just means $cwd. |
| 695 | func_stripname '' '/' "`pwd`" |
| 696 | func_normal_abspath_result=$func_stripname_result |
| 697 | return |
| 698 | ;; |
| 699 | # The next three entries are used to spot a run of precisely |
| 700 | # two leading slashes without using negated character classes; |
| 701 | # we take advantage of case's first-match behaviour. |
| 702 | ///*) |
| 703 | # Unusual form of absolute path, do nothing. |
| 704 | ;; |
| 705 | //*) |
| 706 | # Not necessarily an ordinary path; POSIX reserves leading '//' |
| 707 | # and for example Cygwin uses it to access remote file shares |
| 708 | # over CIFS/SMB, so we conserve a leading double slash if found. |
| 709 | func_normal_abspath_altnamespace=/ |
| 710 | ;; |
| 711 | /*) |
| 712 | # Absolute path, do nothing. |
| 713 | ;; |
| 714 | *) |
| 715 | # Relative path, prepend $cwd. |
| 716 | func_normal_abspath_tpath=`pwd`/$func_normal_abspath_tpath |
| 717 | ;; |
| 718 | esac |
| 719 | # Cancel out all the simple stuff to save iterations. We also want |
| 720 | # the path to end with a slash for ease of parsing, so make sure |
| 721 | # there is one (and only one) here. |
| 722 | func_normal_abspath_tpath=`$ECHO "$func_normal_abspath_tpath" | $SED \ |
| 723 | -e "$removedotparts" -e "$collapseslashes" -e "$finalslash"` |
| 724 | while :; do |
| 725 | # Processed it all yet? |
| 726 | if test "$func_normal_abspath_tpath" = / ; then |
| 727 | # If we ascended to the root using ".." the result may be empty now. |
| 728 | if test -z "$func_normal_abspath_result" ; then |
| 729 | func_normal_abspath_result=/ |
| 730 | fi |
| 731 | break |
| 732 | fi |
| 733 | func_normal_abspath_tcomponent=`$ECHO "$func_normal_abspath_tpath" | $SED \ |
| 734 | -e "$pathcar"` |
| 735 | func_normal_abspath_tpath=`$ECHO "$func_normal_abspath_tpath" | $SED \ |
| 736 | -e "$pathcdr"` |
| 737 | # Figure out what to do with it |
| 738 | case $func_normal_abspath_tcomponent in |
| 739 | "") |
| 740 | # Trailing empty path component, ignore it. |
| 741 | ;; |
| 742 | ..) |
| 743 | # Parent dir; strip last assembled component from result. |
| 744 | func_dirname "$func_normal_abspath_result" |
| 745 | func_normal_abspath_result=$func_dirname_result |
| 746 | ;; |
| 747 | *) |
| 748 | # Actual path component, append it. |
| 749 | func_normal_abspath_result=$func_normal_abspath_result/$func_normal_abspath_tcomponent |
| 750 | ;; |
| 751 | esac |
| 752 | done |
| 753 | # Restore leading double-slash if one was found on entry. |
| 754 | func_normal_abspath_result=$func_normal_abspath_altnamespace$func_normal_abspath_result |
| 755 | } |
| 756 | |
| 757 | # func_relative_path SRCDIR DSTDIR |
| 758 | # generates a relative path from SRCDIR to DSTDIR, with a trailing |
| 759 | # slash if non-empty, suitable for immediately appending a filename |
| 760 | # without needing to append a separator. |
| 761 | # value returned in "$func_relative_path_result" |
| 762 | func_relative_path () |
| 763 | { |
| 764 | func_relative_path_result= |
| 765 | func_normal_abspath "$1" |
| 766 | func_relative_path_tlibdir=$func_normal_abspath_result |
| 767 | func_normal_abspath "$2" |
| 768 | func_relative_path_tbindir=$func_normal_abspath_result |
| 769 | |
| 770 | # Ascend the tree starting from libdir |
| 771 | while :; do |
| 772 | # check if we have found a prefix of bindir |
| 773 | case $func_relative_path_tbindir in |
| 774 | $func_relative_path_tlibdir) |
| 775 | # found an exact match |
| 776 | func_relative_path_tcancelled= |
| 777 | break |
| 778 | ;; |
| 779 | $func_relative_path_tlibdir*) |
| 780 | # found a matching prefix |
| 781 | func_stripname "$func_relative_path_tlibdir" '' "$func_relative_path_tbindir" |
| 782 | func_relative_path_tcancelled=$func_stripname_result |
| 783 | if test -z "$func_relative_path_result"; then |
| 784 | func_relative_path_result=. |
| 785 | fi |
| 786 | break |
| 787 | ;; |
| 788 | *) |
| 789 | func_dirname $func_relative_path_tlibdir |
| 790 | func_relative_path_tlibdir=${func_dirname_result} |
| 791 | if test "x$func_relative_path_tlibdir" = x ; then |
| 792 | # Have to descend all the way to the root! |
| 793 | func_relative_path_result=../$func_relative_path_result |
| 794 | func_relative_path_tcancelled=$func_relative_path_tbindir |
| 795 | break |
| 796 | fi |
| 797 | func_relative_path_result=../$func_relative_path_result |
| 798 | ;; |
| 799 | esac |
| 800 | done |
| 801 | |
| 802 | # Now calculate path; take care to avoid doubling-up slashes. |
| 803 | func_stripname '' '/' "$func_relative_path_result" |
| 804 | func_relative_path_result=$func_stripname_result |
| 805 | func_stripname '/' '/' "$func_relative_path_tcancelled" |
| 806 | if test "x$func_stripname_result" != x ; then |
| 807 | func_relative_path_result=${func_relative_path_result}/${func_stripname_result} |
| 808 | fi |
| 809 | |
| 810 | # Normalisation. If bindir is libdir, return empty string, |
| 811 | # else relative path ending with a slash; either way, target |
| 812 | # file name can be directly appended. |
| 813 | if test ! -z "$func_relative_path_result"; then |
| 814 | func_stripname './' '' "$func_relative_path_result/" |
| 815 | func_relative_path_result=$func_stripname_result |
| 816 | fi |
| 817 | } |
cristy | 3ed852e | 2009-09-05 21:47:34 +0000 | [diff] [blame] | 818 | |
| 819 | # The name of this program: |
cristy | 3ed852e | 2009-09-05 21:47:34 +0000 | [diff] [blame] | 820 | func_dirname_and_basename "$progpath" |
| 821 | progname=$func_basename_result |
cristy | 3ed852e | 2009-09-05 21:47:34 +0000 | [diff] [blame] | 822 | |
| 823 | # Make sure we have an absolute path for reexecution: |
| 824 | case $progpath in |
| 825 | [\\/]*|[A-Za-z]:\\*) ;; |
| 826 | *[\\/]*) |
| 827 | progdir=$func_dirname_result |
| 828 | progdir=`cd "$progdir" && pwd` |
| 829 | progpath="$progdir/$progname" |
| 830 | ;; |
| 831 | *) |
| 832 | save_IFS="$IFS" |
| 833 | IFS=: |
| 834 | for progdir in $PATH; do |
| 835 | IFS="$save_IFS" |
| 836 | test -x "$progdir/$progname" && break |
| 837 | done |
| 838 | IFS="$save_IFS" |
| 839 | test -n "$progdir" || progdir=`pwd` |
| 840 | progpath="$progdir/$progname" |
| 841 | ;; |
| 842 | esac |
| 843 | |
| 844 | # Sed substitution that helps us do robust quoting. It backslashifies |
| 845 | # metacharacters that are still active within double-quoted strings. |
| 846 | Xsed="${SED}"' -e 1s/^X//' |
| 847 | sed_quote_subst='s/\([`"$\\]\)/\\\1/g' |
| 848 | |
| 849 | # Same as above, but do not quote variable references. |
| 850 | double_quote_subst='s/\(["`\\]\)/\\\1/g' |
| 851 | |
cristy | da16f16 | 2011-02-19 23:52:17 +0000 | [diff] [blame] | 852 | # Sed substitution that turns a string into a regex matching for the |
| 853 | # string literally. |
| 854 | sed_make_literal_regex='s,[].[^$\\*\/],\\&,g' |
| 855 | |
| 856 | # Sed substitution that converts a w32 file name or path |
| 857 | # which contains forward slashes, into one that contains |
| 858 | # (escaped) backslashes. A very naive implementation. |
| 859 | lt_sed_naive_backslashify='s|\\\\*|\\|g;s|/|\\|g;s|\\|\\\\|g' |
| 860 | |
cristy | 3ed852e | 2009-09-05 21:47:34 +0000 | [diff] [blame] | 861 | # Re-`\' parameter expansions in output of double_quote_subst that were |
| 862 | # `\'-ed in input to the same. If an odd number of `\' preceded a '$' |
| 863 | # in input to double_quote_subst, that '$' was protected from expansion. |
| 864 | # Since each input `\' is now two `\'s, look for any number of runs of |
| 865 | # four `\'s followed by two `\'s and then a '$'. `\' that '$'. |
| 866 | bs='\\' |
| 867 | bs2='\\\\' |
| 868 | bs4='\\\\\\\\' |
| 869 | dollar='\$' |
| 870 | sed_double_backslash="\ |
| 871 | s/$bs4/&\\ |
| 872 | /g |
| 873 | s/^$bs2$dollar/$bs&/ |
| 874 | s/\\([^$bs]\\)$bs2$dollar/\\1$bs2$bs$dollar/g |
| 875 | s/\n//g" |
| 876 | |
| 877 | # Standard options: |
| 878 | opt_dry_run=false |
| 879 | opt_help=false |
| 880 | opt_quiet=false |
| 881 | opt_verbose=false |
| 882 | opt_warning=: |
| 883 | |
| 884 | # func_echo arg... |
| 885 | # Echo program name prefixed message, along with the current mode |
| 886 | # name if it has been set yet. |
| 887 | func_echo () |
| 888 | { |
cristy | da16f16 | 2011-02-19 23:52:17 +0000 | [diff] [blame] | 889 | $ECHO "$progname: ${opt_mode+$opt_mode: }$*" |
cristy | 3ed852e | 2009-09-05 21:47:34 +0000 | [diff] [blame] | 890 | } |
| 891 | |
| 892 | # func_verbose arg... |
| 893 | # Echo program name prefixed message in verbose mode only. |
| 894 | func_verbose () |
| 895 | { |
| 896 | $opt_verbose && func_echo ${1+"$@"} |
| 897 | |
| 898 | # A bug in bash halts the script if the last line of a function |
| 899 | # fails when set -e is in force, so we need another command to |
| 900 | # work around that: |
| 901 | : |
| 902 | } |
| 903 | |
cristy | 98dddb5 | 2010-11-04 00:30:15 +0000 | [diff] [blame] | 904 | # func_echo_all arg... |
| 905 | # Invoke $ECHO with all args, space-separated. |
| 906 | func_echo_all () |
| 907 | { |
| 908 | $ECHO "$*" |
| 909 | } |
| 910 | |
cristy | 3ed852e | 2009-09-05 21:47:34 +0000 | [diff] [blame] | 911 | # func_error arg... |
| 912 | # Echo program name prefixed message to standard error. |
| 913 | func_error () |
| 914 | { |
cristy | da16f16 | 2011-02-19 23:52:17 +0000 | [diff] [blame] | 915 | $ECHO "$progname: ${opt_mode+$opt_mode: }"${1+"$@"} 1>&2 |
cristy | 3ed852e | 2009-09-05 21:47:34 +0000 | [diff] [blame] | 916 | } |
| 917 | |
| 918 | # func_warning arg... |
| 919 | # Echo program name prefixed warning message to standard error. |
| 920 | func_warning () |
| 921 | { |
cristy | da16f16 | 2011-02-19 23:52:17 +0000 | [diff] [blame] | 922 | $opt_warning && $ECHO "$progname: ${opt_mode+$opt_mode: }warning: "${1+"$@"} 1>&2 |
cristy | 3ed852e | 2009-09-05 21:47:34 +0000 | [diff] [blame] | 923 | |
| 924 | # bash bug again: |
| 925 | : |
| 926 | } |
| 927 | |
| 928 | # func_fatal_error arg... |
| 929 | # Echo program name prefixed message to standard error, and exit. |
| 930 | func_fatal_error () |
| 931 | { |
| 932 | func_error ${1+"$@"} |
| 933 | exit $EXIT_FAILURE |
| 934 | } |
| 935 | |
| 936 | # func_fatal_help arg... |
| 937 | # Echo program name prefixed message to standard error, followed by |
| 938 | # a help hint, and exit. |
| 939 | func_fatal_help () |
| 940 | { |
| 941 | func_error ${1+"$@"} |
| 942 | func_fatal_error "$help" |
| 943 | } |
| 944 | help="Try \`$progname --help' for more information." ## default |
| 945 | |
| 946 | |
| 947 | # func_grep expression filename |
| 948 | # Check whether EXPRESSION matches any line of FILENAME, without output. |
| 949 | func_grep () |
| 950 | { |
| 951 | $GREP "$1" "$2" >/dev/null 2>&1 |
| 952 | } |
| 953 | |
| 954 | |
| 955 | # func_mkdir_p directory-path |
| 956 | # Make sure the entire path to DIRECTORY-PATH is available. |
| 957 | func_mkdir_p () |
| 958 | { |
| 959 | my_directory_path="$1" |
| 960 | my_dir_list= |
| 961 | |
| 962 | if test -n "$my_directory_path" && test "$opt_dry_run" != ":"; then |
| 963 | |
| 964 | # Protect directory names starting with `-' |
| 965 | case $my_directory_path in |
| 966 | -*) my_directory_path="./$my_directory_path" ;; |
| 967 | esac |
| 968 | |
| 969 | # While some portion of DIR does not yet exist... |
| 970 | while test ! -d "$my_directory_path"; do |
| 971 | # ...make a list in topmost first order. Use a colon delimited |
| 972 | # list incase some portion of path contains whitespace. |
| 973 | my_dir_list="$my_directory_path:$my_dir_list" |
| 974 | |
| 975 | # If the last portion added has no slash in it, the list is done |
| 976 | case $my_directory_path in */*) ;; *) break ;; esac |
| 977 | |
| 978 | # ...otherwise throw away the child directory and loop |
cristy | 98dddb5 | 2010-11-04 00:30:15 +0000 | [diff] [blame] | 979 | my_directory_path=`$ECHO "$my_directory_path" | $SED -e "$dirname"` |
cristy | 3ed852e | 2009-09-05 21:47:34 +0000 | [diff] [blame] | 980 | done |
cristy | 98dddb5 | 2010-11-04 00:30:15 +0000 | [diff] [blame] | 981 | my_dir_list=`$ECHO "$my_dir_list" | $SED 's,:*$,,'` |
cristy | 3ed852e | 2009-09-05 21:47:34 +0000 | [diff] [blame] | 982 | |
| 983 | save_mkdir_p_IFS="$IFS"; IFS=':' |
| 984 | for my_dir in $my_dir_list; do |
| 985 | IFS="$save_mkdir_p_IFS" |
| 986 | # mkdir can fail with a `File exist' error if two processes |
| 987 | # try to create one of the directories concurrently. Don't |
| 988 | # stop in that case! |
| 989 | $MKDIR "$my_dir" 2>/dev/null || : |
| 990 | done |
| 991 | IFS="$save_mkdir_p_IFS" |
| 992 | |
| 993 | # Bail out if we (or some other process) failed to create a directory. |
| 994 | test -d "$my_directory_path" || \ |
| 995 | func_fatal_error "Failed to create \`$1'" |
| 996 | fi |
| 997 | } |
| 998 | |
| 999 | |
| 1000 | # func_mktempdir [string] |
| 1001 | # Make a temporary directory that won't clash with other running |
| 1002 | # libtool processes, and avoids race conditions if possible. If |
| 1003 | # given, STRING is the basename for that directory. |
| 1004 | func_mktempdir () |
| 1005 | { |
| 1006 | my_template="${TMPDIR-/tmp}/${1-$progname}" |
| 1007 | |
| 1008 | if test "$opt_dry_run" = ":"; then |
| 1009 | # Return a directory name, but don't create it in dry-run mode |
| 1010 | my_tmpdir="${my_template}-$$" |
| 1011 | else |
| 1012 | |
| 1013 | # If mktemp works, use that first and foremost |
| 1014 | my_tmpdir=`mktemp -d "${my_template}-XXXXXXXX" 2>/dev/null` |
| 1015 | |
| 1016 | if test ! -d "$my_tmpdir"; then |
| 1017 | # Failing that, at least try and use $RANDOM to avoid a race |
| 1018 | my_tmpdir="${my_template}-${RANDOM-0}$$" |
| 1019 | |
| 1020 | save_mktempdir_umask=`umask` |
| 1021 | umask 0077 |
| 1022 | $MKDIR "$my_tmpdir" |
| 1023 | umask $save_mktempdir_umask |
| 1024 | fi |
| 1025 | |
| 1026 | # If we're not in dry-run mode, bomb out on failure |
| 1027 | test -d "$my_tmpdir" || \ |
| 1028 | func_fatal_error "cannot create temporary directory \`$my_tmpdir'" |
| 1029 | fi |
| 1030 | |
cristy | 98dddb5 | 2010-11-04 00:30:15 +0000 | [diff] [blame] | 1031 | $ECHO "$my_tmpdir" |
cristy | 3ed852e | 2009-09-05 21:47:34 +0000 | [diff] [blame] | 1032 | } |
| 1033 | |
| 1034 | |
| 1035 | # func_quote_for_eval arg |
| 1036 | # Aesthetically quote ARG to be evaled later. |
| 1037 | # This function returns two values: FUNC_QUOTE_FOR_EVAL_RESULT |
| 1038 | # is double-quoted, suitable for a subsequent eval, whereas |
| 1039 | # FUNC_QUOTE_FOR_EVAL_UNQUOTED_RESULT has merely all characters |
| 1040 | # which are still active within double quotes backslashified. |
| 1041 | func_quote_for_eval () |
| 1042 | { |
| 1043 | case $1 in |
| 1044 | *[\\\`\"\$]*) |
cristy | 98dddb5 | 2010-11-04 00:30:15 +0000 | [diff] [blame] | 1045 | func_quote_for_eval_unquoted_result=`$ECHO "$1" | $SED "$sed_quote_subst"` ;; |
cristy | 3ed852e | 2009-09-05 21:47:34 +0000 | [diff] [blame] | 1046 | *) |
| 1047 | func_quote_for_eval_unquoted_result="$1" ;; |
| 1048 | esac |
| 1049 | |
| 1050 | case $func_quote_for_eval_unquoted_result in |
| 1051 | # Double-quote args containing shell metacharacters to delay |
| 1052 | # word splitting, command substitution and and variable |
| 1053 | # expansion for a subsequent eval. |
| 1054 | # Many Bourne shells cannot handle close brackets correctly |
| 1055 | # in scan sets, so we specify it separately. |
| 1056 | *[\[\~\#\^\&\*\(\)\{\}\|\;\<\>\?\'\ \ ]*|*]*|"") |
| 1057 | func_quote_for_eval_result="\"$func_quote_for_eval_unquoted_result\"" |
| 1058 | ;; |
| 1059 | *) |
| 1060 | func_quote_for_eval_result="$func_quote_for_eval_unquoted_result" |
| 1061 | esac |
| 1062 | } |
| 1063 | |
| 1064 | |
| 1065 | # func_quote_for_expand arg |
| 1066 | # Aesthetically quote ARG to be evaled later; same as above, |
| 1067 | # but do not quote variable references. |
| 1068 | func_quote_for_expand () |
| 1069 | { |
| 1070 | case $1 in |
| 1071 | *[\\\`\"]*) |
cristy | 98dddb5 | 2010-11-04 00:30:15 +0000 | [diff] [blame] | 1072 | my_arg=`$ECHO "$1" | $SED \ |
cristy | 3ed852e | 2009-09-05 21:47:34 +0000 | [diff] [blame] | 1073 | -e "$double_quote_subst" -e "$sed_double_backslash"` ;; |
| 1074 | *) |
| 1075 | my_arg="$1" ;; |
| 1076 | esac |
| 1077 | |
| 1078 | case $my_arg in |
| 1079 | # Double-quote args containing shell metacharacters to delay |
| 1080 | # word splitting and command substitution for a subsequent eval. |
| 1081 | # Many Bourne shells cannot handle close brackets correctly |
| 1082 | # in scan sets, so we specify it separately. |
| 1083 | *[\[\~\#\^\&\*\(\)\{\}\|\;\<\>\?\'\ \ ]*|*]*|"") |
| 1084 | my_arg="\"$my_arg\"" |
| 1085 | ;; |
| 1086 | esac |
| 1087 | |
| 1088 | func_quote_for_expand_result="$my_arg" |
| 1089 | } |
| 1090 | |
| 1091 | |
| 1092 | # func_show_eval cmd [fail_exp] |
| 1093 | # Unless opt_silent is true, then output CMD. Then, if opt_dryrun is |
| 1094 | # not true, evaluate CMD. If the evaluation of CMD fails, and FAIL_EXP |
| 1095 | # is given, then evaluate it. |
| 1096 | func_show_eval () |
| 1097 | { |
| 1098 | my_cmd="$1" |
| 1099 | my_fail_exp="${2-:}" |
| 1100 | |
| 1101 | ${opt_silent-false} || { |
| 1102 | func_quote_for_expand "$my_cmd" |
| 1103 | eval "func_echo $func_quote_for_expand_result" |
| 1104 | } |
| 1105 | |
| 1106 | if ${opt_dry_run-false}; then :; else |
| 1107 | eval "$my_cmd" |
| 1108 | my_status=$? |
| 1109 | if test "$my_status" -eq 0; then :; else |
| 1110 | eval "(exit $my_status); $my_fail_exp" |
| 1111 | fi |
| 1112 | fi |
| 1113 | } |
| 1114 | |
| 1115 | |
| 1116 | # func_show_eval_locale cmd [fail_exp] |
| 1117 | # Unless opt_silent is true, then output CMD. Then, if opt_dryrun is |
| 1118 | # not true, evaluate CMD. If the evaluation of CMD fails, and FAIL_EXP |
| 1119 | # is given, then evaluate it. Use the saved locale for evaluation. |
| 1120 | func_show_eval_locale () |
| 1121 | { |
| 1122 | my_cmd="$1" |
| 1123 | my_fail_exp="${2-:}" |
| 1124 | |
| 1125 | ${opt_silent-false} || { |
| 1126 | func_quote_for_expand "$my_cmd" |
| 1127 | eval "func_echo $func_quote_for_expand_result" |
| 1128 | } |
| 1129 | |
| 1130 | if ${opt_dry_run-false}; then :; else |
| 1131 | eval "$lt_user_locale |
| 1132 | $my_cmd" |
| 1133 | my_status=$? |
| 1134 | eval "$lt_safe_locale" |
| 1135 | if test "$my_status" -eq 0; then :; else |
| 1136 | eval "(exit $my_status); $my_fail_exp" |
| 1137 | fi |
| 1138 | fi |
| 1139 | } |
| 1140 | |
cristy | da16f16 | 2011-02-19 23:52:17 +0000 | [diff] [blame] | 1141 | # func_tr_sh |
| 1142 | # Turn $1 into a string suitable for a shell variable name. |
| 1143 | # Result is stored in $func_tr_sh_result. All characters |
| 1144 | # not in the set a-zA-Z0-9_ are replaced with '_'. Further, |
| 1145 | # if $1 begins with a digit, a '_' is prepended as well. |
| 1146 | func_tr_sh () |
| 1147 | { |
| 1148 | case $1 in |
| 1149 | [0-9]* | *[!a-zA-Z0-9_]*) |
| 1150 | func_tr_sh_result=`$ECHO "$1" | $SED 's/^\([0-9]\)/_\1/; s/[^a-zA-Z0-9_]/_/g'` |
| 1151 | ;; |
| 1152 | * ) |
| 1153 | func_tr_sh_result=$1 |
| 1154 | ;; |
| 1155 | esac |
| 1156 | } |
| 1157 | |
cristy | 3ed852e | 2009-09-05 21:47:34 +0000 | [diff] [blame] | 1158 | |
cristy | 3ed852e | 2009-09-05 21:47:34 +0000 | [diff] [blame] | 1159 | # func_version |
| 1160 | # Echo version message to standard output and exit. |
| 1161 | func_version () |
| 1162 | { |
cristy | da16f16 | 2011-02-19 23:52:17 +0000 | [diff] [blame] | 1163 | $opt_debug |
| 1164 | |
cristy | 98dddb5 | 2010-11-04 00:30:15 +0000 | [diff] [blame] | 1165 | $SED -n '/(C)/!b go |
| 1166 | :more |
| 1167 | /\./!{ |
| 1168 | N |
| 1169 | s/\n# / / |
| 1170 | b more |
| 1171 | } |
| 1172 | :go |
| 1173 | /^# '$PROGRAM' (GNU /,/# warranty; / { |
cristy | 3ed852e | 2009-09-05 21:47:34 +0000 | [diff] [blame] | 1174 | s/^# // |
| 1175 | s/^# *$// |
| 1176 | s/\((C)\)[ 0-9,-]*\( [1-9][0-9]*\)/\1\2/ |
| 1177 | p |
| 1178 | }' < "$progpath" |
| 1179 | exit $? |
| 1180 | } |
| 1181 | |
| 1182 | # func_usage |
| 1183 | # Echo short help message to standard output and exit. |
| 1184 | func_usage () |
| 1185 | { |
cristy | da16f16 | 2011-02-19 23:52:17 +0000 | [diff] [blame] | 1186 | $opt_debug |
| 1187 | |
cristy | 98dddb5 | 2010-11-04 00:30:15 +0000 | [diff] [blame] | 1188 | $SED -n '/^# Usage:/,/^# *.*--help/ { |
cristy | 3ed852e | 2009-09-05 21:47:34 +0000 | [diff] [blame] | 1189 | s/^# // |
| 1190 | s/^# *$// |
| 1191 | s/\$progname/'$progname'/ |
| 1192 | p |
| 1193 | }' < "$progpath" |
cristy | 98dddb5 | 2010-11-04 00:30:15 +0000 | [diff] [blame] | 1194 | echo |
cristy | 3ed852e | 2009-09-05 21:47:34 +0000 | [diff] [blame] | 1195 | $ECHO "run \`$progname --help | more' for full usage" |
| 1196 | exit $? |
| 1197 | } |
| 1198 | |
cristy | 98dddb5 | 2010-11-04 00:30:15 +0000 | [diff] [blame] | 1199 | # func_help [NOEXIT] |
| 1200 | # Echo long help message to standard output and exit, |
| 1201 | # unless 'noexit' is passed as argument. |
cristy | 3ed852e | 2009-09-05 21:47:34 +0000 | [diff] [blame] | 1202 | func_help () |
| 1203 | { |
cristy | da16f16 | 2011-02-19 23:52:17 +0000 | [diff] [blame] | 1204 | $opt_debug |
| 1205 | |
cristy | 3ed852e | 2009-09-05 21:47:34 +0000 | [diff] [blame] | 1206 | $SED -n '/^# Usage:/,/# Report bugs to/ { |
cristy | da16f16 | 2011-02-19 23:52:17 +0000 | [diff] [blame] | 1207 | :print |
cristy | 3ed852e | 2009-09-05 21:47:34 +0000 | [diff] [blame] | 1208 | s/^# // |
| 1209 | s/^# *$// |
| 1210 | s*\$progname*'$progname'* |
| 1211 | s*\$host*'"$host"'* |
| 1212 | s*\$SHELL*'"$SHELL"'* |
| 1213 | s*\$LTCC*'"$LTCC"'* |
| 1214 | s*\$LTCFLAGS*'"$LTCFLAGS"'* |
| 1215 | s*\$LD*'"$LD"'* |
| 1216 | s/\$with_gnu_ld/'"$with_gnu_ld"'/ |
| 1217 | s/\$automake_version/'"`(automake --version) 2>/dev/null |$SED 1q`"'/ |
| 1218 | s/\$autoconf_version/'"`(autoconf --version) 2>/dev/null |$SED 1q`"'/ |
| 1219 | p |
cristy | da16f16 | 2011-02-19 23:52:17 +0000 | [diff] [blame] | 1220 | d |
| 1221 | } |
| 1222 | /^# .* home page:/b print |
| 1223 | /^# General help using/b print |
| 1224 | ' < "$progpath" |
cristy | 98dddb5 | 2010-11-04 00:30:15 +0000 | [diff] [blame] | 1225 | ret=$? |
| 1226 | if test -z "$1"; then |
| 1227 | exit $ret |
| 1228 | fi |
cristy | 3ed852e | 2009-09-05 21:47:34 +0000 | [diff] [blame] | 1229 | } |
| 1230 | |
| 1231 | # func_missing_arg argname |
| 1232 | # Echo program name prefixed message to standard error and set global |
| 1233 | # exit_cmd. |
| 1234 | func_missing_arg () |
| 1235 | { |
cristy | da16f16 | 2011-02-19 23:52:17 +0000 | [diff] [blame] | 1236 | $opt_debug |
| 1237 | |
cristy | 98dddb5 | 2010-11-04 00:30:15 +0000 | [diff] [blame] | 1238 | func_error "missing argument for $1." |
cristy | 3ed852e | 2009-09-05 21:47:34 +0000 | [diff] [blame] | 1239 | exit_cmd=exit |
| 1240 | } |
| 1241 | |
cristy | 3ed852e | 2009-09-05 21:47:34 +0000 | [diff] [blame] | 1242 | |
cristy | da16f16 | 2011-02-19 23:52:17 +0000 | [diff] [blame] | 1243 | # func_split_short_opt shortopt |
| 1244 | # Set func_split_short_opt_name and func_split_short_opt_arg shell |
| 1245 | # variables after splitting SHORTOPT after the 2nd character. |
| 1246 | func_split_short_opt () |
| 1247 | { |
| 1248 | func_split_short_opt_arg=${1#??} |
| 1249 | func_split_short_opt_name=${1%"$func_split_short_opt_arg"} |
| 1250 | } # Extended-shell func_split_short_opt implementation |
| 1251 | |
| 1252 | |
| 1253 | # func_split_long_opt longopt |
| 1254 | # Set func_split_long_opt_name and func_split_long_opt_arg shell |
| 1255 | # variables after splitting LONGOPT at the `=' sign. |
| 1256 | func_split_long_opt () |
| 1257 | { |
| 1258 | func_split_long_opt_name=${1%%=*} |
| 1259 | func_split_long_opt_arg=${1#*=} |
| 1260 | } # Extended-shell func_split_long_opt implementation |
| 1261 | |
| 1262 | exit_cmd=: |
cristy | 3ed852e | 2009-09-05 21:47:34 +0000 | [diff] [blame] | 1263 | |
| 1264 | |
| 1265 | |
| 1266 | |
cristy | 3ed852e | 2009-09-05 21:47:34 +0000 | [diff] [blame] | 1267 | |
| 1268 | magic="%%%MAGIC variable%%%" |
| 1269 | magic_exe="%%%MAGIC EXE variable%%%" |
| 1270 | |
| 1271 | # Global variables. |
cristy | 3ed852e | 2009-09-05 21:47:34 +0000 | [diff] [blame] | 1272 | nonopt= |
cristy | 3ed852e | 2009-09-05 21:47:34 +0000 | [diff] [blame] | 1273 | preserve_args= |
| 1274 | lo2o="s/\\.lo\$/.${objext}/" |
| 1275 | o2lo="s/\\.${objext}\$/.lo/" |
| 1276 | extracted_archives= |
| 1277 | extracted_serial=0 |
| 1278 | |
cristy | 3ed852e | 2009-09-05 21:47:34 +0000 | [diff] [blame] | 1279 | # If this variable is set in any of the actions, the command in it |
| 1280 | # will be execed at the end. This prevents here-documents from being |
| 1281 | # left over by shells. |
| 1282 | exec_cmd= |
| 1283 | |
cristy | da16f16 | 2011-02-19 23:52:17 +0000 | [diff] [blame] | 1284 | # func_append var value |
| 1285 | # Append VALUE to the end of shell variable VAR. |
| 1286 | func_append () |
| 1287 | { |
| 1288 | eval "${1}+=\${2}" |
| 1289 | } # Extended-shell func_append implementation |
| 1290 | |
| 1291 | # func_append_quoted var value |
| 1292 | # Quote VALUE and append to the end of shell variable VAR, separated |
| 1293 | # by a space. |
| 1294 | func_append_quoted () |
| 1295 | { |
| 1296 | func_quote_for_eval "${2}" |
| 1297 | eval "${1}+=\\ \$func_quote_for_eval_result" |
| 1298 | } # Extended-shell func_append_quoted implementation |
| 1299 | |
| 1300 | |
| 1301 | # func_arith arithmetic-term... |
| 1302 | func_arith () |
| 1303 | { |
| 1304 | func_arith_result=$(( $* )) |
| 1305 | } # Extended-shell func_arith implementation |
| 1306 | |
| 1307 | |
| 1308 | # func_len string |
| 1309 | # STRING may not start with a hyphen. |
| 1310 | func_len () |
| 1311 | { |
| 1312 | func_len_result=${#1} |
| 1313 | } # Extended-shell func_len implementation |
| 1314 | |
| 1315 | |
| 1316 | # func_lo2o object |
| 1317 | func_lo2o () |
| 1318 | { |
| 1319 | case ${1} in |
| 1320 | *.lo) func_lo2o_result=${1%.lo}.${objext} ;; |
| 1321 | *) func_lo2o_result=${1} ;; |
| 1322 | esac |
| 1323 | } # Extended-shell func_lo2o implementation |
| 1324 | |
| 1325 | |
| 1326 | # func_xform libobj-or-source |
| 1327 | func_xform () |
| 1328 | { |
| 1329 | func_xform_result=${1%.*}.lo |
| 1330 | } # Extended-shell func_xform implementation |
| 1331 | |
| 1332 | |
cristy | 3ed852e | 2009-09-05 21:47:34 +0000 | [diff] [blame] | 1333 | # func_fatal_configuration arg... |
| 1334 | # Echo program name prefixed message to standard error, followed by |
| 1335 | # a configuration failure hint, and exit. |
| 1336 | func_fatal_configuration () |
| 1337 | { |
| 1338 | func_error ${1+"$@"} |
| 1339 | func_error "See the $PACKAGE documentation for more information." |
| 1340 | func_fatal_error "Fatal configuration error." |
| 1341 | } |
| 1342 | |
| 1343 | |
| 1344 | # func_config |
| 1345 | # Display the configuration for all the tags in this script. |
| 1346 | func_config () |
| 1347 | { |
| 1348 | re_begincf='^# ### BEGIN LIBTOOL' |
| 1349 | re_endcf='^# ### END LIBTOOL' |
| 1350 | |
| 1351 | # Default configuration. |
| 1352 | $SED "1,/$re_begincf CONFIG/d;/$re_endcf CONFIG/,\$d" < "$progpath" |
| 1353 | |
| 1354 | # Now print the configurations for the tags. |
| 1355 | for tagname in $taglist; do |
| 1356 | $SED -n "/$re_begincf TAG CONFIG: $tagname\$/,/$re_endcf TAG CONFIG: $tagname\$/p" < "$progpath" |
| 1357 | done |
| 1358 | |
| 1359 | exit $? |
| 1360 | } |
| 1361 | |
| 1362 | # func_features |
| 1363 | # Display the features supported by this script. |
| 1364 | func_features () |
| 1365 | { |
cristy | 98dddb5 | 2010-11-04 00:30:15 +0000 | [diff] [blame] | 1366 | echo "host: $host" |
cristy | 3ed852e | 2009-09-05 21:47:34 +0000 | [diff] [blame] | 1367 | if test "$build_libtool_libs" = yes; then |
cristy | 98dddb5 | 2010-11-04 00:30:15 +0000 | [diff] [blame] | 1368 | echo "enable shared libraries" |
cristy | 3ed852e | 2009-09-05 21:47:34 +0000 | [diff] [blame] | 1369 | else |
cristy | 98dddb5 | 2010-11-04 00:30:15 +0000 | [diff] [blame] | 1370 | echo "disable shared libraries" |
cristy | 3ed852e | 2009-09-05 21:47:34 +0000 | [diff] [blame] | 1371 | fi |
| 1372 | if test "$build_old_libs" = yes; then |
cristy | 98dddb5 | 2010-11-04 00:30:15 +0000 | [diff] [blame] | 1373 | echo "enable static libraries" |
cristy | 3ed852e | 2009-09-05 21:47:34 +0000 | [diff] [blame] | 1374 | else |
cristy | 98dddb5 | 2010-11-04 00:30:15 +0000 | [diff] [blame] | 1375 | echo "disable static libraries" |
cristy | 3ed852e | 2009-09-05 21:47:34 +0000 | [diff] [blame] | 1376 | fi |
| 1377 | |
| 1378 | exit $? |
| 1379 | } |
| 1380 | |
| 1381 | # func_enable_tag tagname |
| 1382 | # Verify that TAGNAME is valid, and either flag an error and exit, or |
| 1383 | # enable the TAGNAME tag. We also add TAGNAME to the global $taglist |
| 1384 | # variable here. |
| 1385 | func_enable_tag () |
| 1386 | { |
| 1387 | # Global variable: |
| 1388 | tagname="$1" |
| 1389 | |
| 1390 | re_begincf="^# ### BEGIN LIBTOOL TAG CONFIG: $tagname\$" |
| 1391 | re_endcf="^# ### END LIBTOOL TAG CONFIG: $tagname\$" |
| 1392 | sed_extractcf="/$re_begincf/,/$re_endcf/p" |
| 1393 | |
| 1394 | # Validate tagname. |
| 1395 | case $tagname in |
| 1396 | *[!-_A-Za-z0-9,/]*) |
| 1397 | func_fatal_error "invalid tag name: $tagname" |
| 1398 | ;; |
| 1399 | esac |
| 1400 | |
| 1401 | # Don't test for the "default" C tag, as we know it's |
| 1402 | # there but not specially marked. |
| 1403 | case $tagname in |
| 1404 | CC) ;; |
| 1405 | *) |
| 1406 | if $GREP "$re_begincf" "$progpath" >/dev/null 2>&1; then |
| 1407 | taglist="$taglist $tagname" |
| 1408 | |
| 1409 | # Evaluate the configuration. Be careful to quote the path |
| 1410 | # and the sed script, to avoid splitting on whitespace, but |
| 1411 | # also don't use non-portable quotes within backquotes within |
| 1412 | # quotes we have to do it in 2 steps: |
| 1413 | extractedcf=`$SED -n -e "$sed_extractcf" < "$progpath"` |
| 1414 | eval "$extractedcf" |
| 1415 | else |
| 1416 | func_error "ignoring unknown tag $tagname" |
| 1417 | fi |
| 1418 | ;; |
| 1419 | esac |
| 1420 | } |
| 1421 | |
cristy | 3ed852e | 2009-09-05 21:47:34 +0000 | [diff] [blame] | 1422 | # func_check_version_match |
| 1423 | # Ensure that we are using m4 macros, and libtool script from the same |
| 1424 | # release of libtool. |
| 1425 | func_check_version_match () |
| 1426 | { |
| 1427 | if test "$package_revision" != "$macro_revision"; then |
| 1428 | if test "$VERSION" != "$macro_version"; then |
| 1429 | if test -z "$macro_version"; then |
| 1430 | cat >&2 <<_LT_EOF |
| 1431 | $progname: Version mismatch error. This is $PACKAGE $VERSION, but the |
| 1432 | $progname: definition of this LT_INIT comes from an older release. |
| 1433 | $progname: You should recreate aclocal.m4 with macros from $PACKAGE $VERSION |
| 1434 | $progname: and run autoconf again. |
| 1435 | _LT_EOF |
| 1436 | else |
| 1437 | cat >&2 <<_LT_EOF |
| 1438 | $progname: Version mismatch error. This is $PACKAGE $VERSION, but the |
| 1439 | $progname: definition of this LT_INIT comes from $PACKAGE $macro_version. |
| 1440 | $progname: You should recreate aclocal.m4 with macros from $PACKAGE $VERSION |
| 1441 | $progname: and run autoconf again. |
| 1442 | _LT_EOF |
| 1443 | fi |
| 1444 | else |
| 1445 | cat >&2 <<_LT_EOF |
| 1446 | $progname: Version mismatch error. This is $PACKAGE $VERSION, revision $package_revision, |
| 1447 | $progname: but the definition of this LT_INIT comes from revision $macro_revision. |
| 1448 | $progname: You should recreate aclocal.m4 with macros from revision $package_revision |
| 1449 | $progname: of $PACKAGE $VERSION and run autoconf again. |
| 1450 | _LT_EOF |
| 1451 | fi |
| 1452 | |
| 1453 | exit $EXIT_MISMATCH |
| 1454 | fi |
| 1455 | } |
| 1456 | |
| 1457 | |
cristy | da16f16 | 2011-02-19 23:52:17 +0000 | [diff] [blame] | 1458 | # Shorthand for --mode=foo, only valid as the first argument |
| 1459 | case $1 in |
| 1460 | clean|clea|cle|cl) |
| 1461 | shift; set dummy --mode clean ${1+"$@"}; shift |
| 1462 | ;; |
| 1463 | compile|compil|compi|comp|com|co|c) |
| 1464 | shift; set dummy --mode compile ${1+"$@"}; shift |
| 1465 | ;; |
| 1466 | execute|execut|execu|exec|exe|ex|e) |
| 1467 | shift; set dummy --mode execute ${1+"$@"}; shift |
| 1468 | ;; |
| 1469 | finish|finis|fini|fin|fi|f) |
| 1470 | shift; set dummy --mode finish ${1+"$@"}; shift |
| 1471 | ;; |
| 1472 | install|instal|insta|inst|ins|in|i) |
| 1473 | shift; set dummy --mode install ${1+"$@"}; shift |
| 1474 | ;; |
| 1475 | link|lin|li|l) |
| 1476 | shift; set dummy --mode link ${1+"$@"}; shift |
| 1477 | ;; |
| 1478 | uninstall|uninstal|uninsta|uninst|unins|unin|uni|un|u) |
| 1479 | shift; set dummy --mode uninstall ${1+"$@"}; shift |
| 1480 | ;; |
| 1481 | esac |
| 1482 | |
| 1483 | |
| 1484 | |
| 1485 | # Option defaults: |
| 1486 | opt_debug=: |
| 1487 | opt_dry_run=false |
| 1488 | opt_config=false |
| 1489 | opt_preserve_dup_deps=false |
| 1490 | opt_features=false |
| 1491 | opt_finish=false |
| 1492 | opt_help=false |
| 1493 | opt_help_all=false |
| 1494 | opt_silent=: |
| 1495 | opt_verbose=: |
| 1496 | opt_silent=false |
| 1497 | opt_verbose=false |
| 1498 | |
| 1499 | |
| 1500 | # Parse options once, thoroughly. This comes as soon as possible in the |
| 1501 | # script to make things like `--version' happen as quickly as we can. |
| 1502 | { |
| 1503 | # this just eases exit handling |
| 1504 | while test $# -gt 0; do |
| 1505 | opt="$1" |
| 1506 | shift |
| 1507 | case $opt in |
| 1508 | --debug|-x) opt_debug='set -x' |
| 1509 | func_echo "enabling shell trace mode" |
| 1510 | $opt_debug |
| 1511 | ;; |
| 1512 | --dry-run|--dryrun|-n) |
| 1513 | opt_dry_run=: |
| 1514 | ;; |
| 1515 | --config) |
| 1516 | opt_config=: |
| 1517 | func_config |
| 1518 | ;; |
| 1519 | --dlopen|-dlopen) |
| 1520 | optarg="$1" |
| 1521 | opt_dlopen="${opt_dlopen+$opt_dlopen |
| 1522 | }$optarg" |
| 1523 | shift |
| 1524 | ;; |
| 1525 | --preserve-dup-deps) |
| 1526 | opt_preserve_dup_deps=: |
| 1527 | ;; |
| 1528 | --features) |
| 1529 | opt_features=: |
| 1530 | func_features |
| 1531 | ;; |
| 1532 | --finish) |
| 1533 | opt_finish=: |
| 1534 | set dummy --mode finish ${1+"$@"}; shift |
| 1535 | ;; |
| 1536 | --help) |
| 1537 | opt_help=: |
| 1538 | ;; |
| 1539 | --help-all) |
| 1540 | opt_help_all=: |
| 1541 | opt_help=': help-all' |
| 1542 | ;; |
| 1543 | --mode) |
| 1544 | test $# = 0 && func_missing_arg $opt && break |
| 1545 | optarg="$1" |
| 1546 | opt_mode="$optarg" |
| 1547 | case $optarg in |
| 1548 | # Valid mode arguments: |
| 1549 | clean|compile|execute|finish|install|link|relink|uninstall) ;; |
| 1550 | |
| 1551 | # Catch anything else as an error |
| 1552 | *) func_error "invalid argument for $opt" |
| 1553 | exit_cmd=exit |
| 1554 | break |
| 1555 | ;; |
| 1556 | esac |
| 1557 | shift |
| 1558 | ;; |
| 1559 | --no-silent|--no-quiet) |
| 1560 | opt_silent=false |
| 1561 | preserve_args+=" $opt" |
| 1562 | ;; |
| 1563 | --no-verbose) |
| 1564 | opt_verbose=false |
| 1565 | preserve_args+=" $opt" |
| 1566 | ;; |
| 1567 | --silent|--quiet) |
| 1568 | opt_silent=: |
| 1569 | preserve_args+=" $opt" |
| 1570 | opt_verbose=false |
| 1571 | ;; |
| 1572 | --verbose|-v) |
| 1573 | opt_verbose=: |
| 1574 | preserve_args+=" $opt" |
| 1575 | opt_silent=false |
| 1576 | ;; |
| 1577 | --tag) |
| 1578 | test $# = 0 && func_missing_arg $opt && break |
| 1579 | optarg="$1" |
| 1580 | opt_tag="$optarg" |
| 1581 | preserve_args+=" $opt $optarg" |
| 1582 | func_enable_tag "$optarg" |
| 1583 | shift |
| 1584 | ;; |
| 1585 | |
| 1586 | -\?|-h) func_usage ;; |
| 1587 | --help) func_help ;; |
| 1588 | --version) func_version ;; |
| 1589 | |
| 1590 | # Separate optargs to long options: |
| 1591 | --*=*) |
| 1592 | func_split_long_opt "$opt" |
| 1593 | set dummy "$func_split_long_opt_name" "$func_split_long_opt_arg" ${1+"$@"} |
| 1594 | shift |
| 1595 | ;; |
| 1596 | |
| 1597 | # Separate non-argument short options: |
| 1598 | -\?*|-h*|-n*|-v*) |
| 1599 | func_split_short_opt "$opt" |
| 1600 | set dummy "$func_split_short_opt_name" "-$func_split_short_opt_arg" ${1+"$@"} |
| 1601 | shift |
| 1602 | ;; |
| 1603 | |
| 1604 | --) break ;; |
| 1605 | -*) func_fatal_help "unrecognized option \`$opt'" ;; |
| 1606 | *) set dummy "$opt" ${1+"$@"}; shift; break ;; |
| 1607 | esac |
| 1608 | done |
| 1609 | |
| 1610 | # Validate options: |
| 1611 | |
| 1612 | # save first non-option argument |
| 1613 | if test "$#" -gt 0; then |
| 1614 | nonopt="$opt" |
| 1615 | shift |
| 1616 | fi |
| 1617 | |
| 1618 | # preserve --debug |
| 1619 | test "$opt_debug" = : || preserve_args+=" --debug" |
| 1620 | |
| 1621 | case $host in |
| 1622 | *cygwin* | *mingw* | *pw32* | *cegcc*) |
| 1623 | # don't eliminate duplications in $postdeps and $predeps |
| 1624 | opt_duplicate_compiler_generated_deps=: |
| 1625 | ;; |
| 1626 | *) |
| 1627 | opt_duplicate_compiler_generated_deps=$opt_preserve_dup_deps |
| 1628 | ;; |
| 1629 | esac |
| 1630 | |
| 1631 | $opt_help || { |
| 1632 | # Sanity checks first: |
| 1633 | func_check_version_match |
| 1634 | |
| 1635 | if test "$build_libtool_libs" != yes && test "$build_old_libs" != yes; then |
| 1636 | func_fatal_configuration "not configured to build any kind of library" |
| 1637 | fi |
| 1638 | |
| 1639 | # Darwin sucks |
| 1640 | eval std_shrext=\"$shrext_cmds\" |
| 1641 | |
| 1642 | # Only execute mode is allowed to have -dlopen flags. |
| 1643 | if test -n "$opt_dlopen" && test "$opt_mode" != execute; then |
| 1644 | func_error "unrecognized option \`-dlopen'" |
| 1645 | $ECHO "$help" 1>&2 |
| 1646 | exit $EXIT_FAILURE |
| 1647 | fi |
| 1648 | |
| 1649 | # Change the help message to a mode-specific one. |
| 1650 | generic_help="$help" |
| 1651 | help="Try \`$progname --help --mode=$opt_mode' for more information." |
| 1652 | } |
| 1653 | |
| 1654 | |
| 1655 | # Bail if the options were screwed |
| 1656 | $exit_cmd $EXIT_FAILURE |
| 1657 | } |
| 1658 | |
| 1659 | |
| 1660 | |
| 1661 | |
cristy | 3ed852e | 2009-09-05 21:47:34 +0000 | [diff] [blame] | 1662 | ## ----------- ## |
| 1663 | ## Main. ## |
| 1664 | ## ----------- ## |
| 1665 | |
cristy | 3ed852e | 2009-09-05 21:47:34 +0000 | [diff] [blame] | 1666 | # func_lalib_p file |
| 1667 | # True iff FILE is a libtool `.la' library or `.lo' object file. |
| 1668 | # This function is only a basic sanity check; it will hardly flush out |
| 1669 | # determined imposters. |
| 1670 | func_lalib_p () |
| 1671 | { |
| 1672 | test -f "$1" && |
| 1673 | $SED -e 4q "$1" 2>/dev/null \ |
| 1674 | | $GREP "^# Generated by .*$PACKAGE" > /dev/null 2>&1 |
| 1675 | } |
| 1676 | |
| 1677 | # func_lalib_unsafe_p file |
| 1678 | # True iff FILE is a libtool `.la' library or `.lo' object file. |
| 1679 | # This function implements the same check as func_lalib_p without |
| 1680 | # resorting to external programs. To this end, it redirects stdin and |
| 1681 | # closes it afterwards, without saving the original file descriptor. |
| 1682 | # As a safety measure, use it only where a negative result would be |
| 1683 | # fatal anyway. Works if `file' does not exist. |
| 1684 | func_lalib_unsafe_p () |
| 1685 | { |
| 1686 | lalib_p=no |
| 1687 | if test -f "$1" && test -r "$1" && exec 5<&0 <"$1"; then |
| 1688 | for lalib_p_l in 1 2 3 4 |
| 1689 | do |
| 1690 | read lalib_p_line |
| 1691 | case "$lalib_p_line" in |
| 1692 | \#\ Generated\ by\ *$PACKAGE* ) lalib_p=yes; break;; |
| 1693 | esac |
| 1694 | done |
| 1695 | exec 0<&5 5<&- |
| 1696 | fi |
| 1697 | test "$lalib_p" = yes |
| 1698 | } |
| 1699 | |
| 1700 | # func_ltwrapper_script_p file |
| 1701 | # True iff FILE is a libtool wrapper script |
| 1702 | # This function is only a basic sanity check; it will hardly flush out |
| 1703 | # determined imposters. |
| 1704 | func_ltwrapper_script_p () |
| 1705 | { |
| 1706 | func_lalib_p "$1" |
| 1707 | } |
| 1708 | |
| 1709 | # func_ltwrapper_executable_p file |
| 1710 | # True iff FILE is a libtool wrapper executable |
| 1711 | # This function is only a basic sanity check; it will hardly flush out |
| 1712 | # determined imposters. |
| 1713 | func_ltwrapper_executable_p () |
| 1714 | { |
| 1715 | func_ltwrapper_exec_suffix= |
| 1716 | case $1 in |
| 1717 | *.exe) ;; |
| 1718 | *) func_ltwrapper_exec_suffix=.exe ;; |
| 1719 | esac |
| 1720 | $GREP "$magic_exe" "$1$func_ltwrapper_exec_suffix" >/dev/null 2>&1 |
| 1721 | } |
| 1722 | |
| 1723 | # func_ltwrapper_scriptname file |
| 1724 | # Assumes file is an ltwrapper_executable |
| 1725 | # uses $file to determine the appropriate filename for a |
| 1726 | # temporary ltwrapper_script. |
| 1727 | func_ltwrapper_scriptname () |
| 1728 | { |
cristy | da16f16 | 2011-02-19 23:52:17 +0000 | [diff] [blame] | 1729 | func_dirname_and_basename "$1" "" "." |
| 1730 | func_stripname '' '.exe' "$func_basename_result" |
| 1731 | func_ltwrapper_scriptname_result="$func_dirname_result/$objdir/${func_stripname_result}_ltshwrapper" |
cristy | 3ed852e | 2009-09-05 21:47:34 +0000 | [diff] [blame] | 1732 | } |
| 1733 | |
| 1734 | # func_ltwrapper_p file |
| 1735 | # True iff FILE is a libtool wrapper script or wrapper executable |
| 1736 | # This function is only a basic sanity check; it will hardly flush out |
| 1737 | # determined imposters. |
| 1738 | func_ltwrapper_p () |
| 1739 | { |
| 1740 | func_ltwrapper_script_p "$1" || func_ltwrapper_executable_p "$1" |
| 1741 | } |
| 1742 | |
| 1743 | |
| 1744 | # func_execute_cmds commands fail_cmd |
| 1745 | # Execute tilde-delimited COMMANDS. |
| 1746 | # If FAIL_CMD is given, eval that upon failure. |
| 1747 | # FAIL_CMD may read-access the current command in variable CMD! |
| 1748 | func_execute_cmds () |
| 1749 | { |
| 1750 | $opt_debug |
| 1751 | save_ifs=$IFS; IFS='~' |
| 1752 | for cmd in $1; do |
| 1753 | IFS=$save_ifs |
| 1754 | eval cmd=\"$cmd\" |
| 1755 | func_show_eval "$cmd" "${2-:}" |
| 1756 | done |
| 1757 | IFS=$save_ifs |
| 1758 | } |
| 1759 | |
| 1760 | |
| 1761 | # func_source file |
| 1762 | # Source FILE, adding directory component if necessary. |
| 1763 | # Note that it is not necessary on cygwin/mingw to append a dot to |
| 1764 | # FILE even if both FILE and FILE.exe exist: automatic-append-.exe |
| 1765 | # behavior happens only for exec(3), not for open(2)! Also, sourcing |
| 1766 | # `FILE.' does not work on cygwin managed mounts. |
| 1767 | func_source () |
| 1768 | { |
| 1769 | $opt_debug |
| 1770 | case $1 in |
| 1771 | */* | *\\*) . "$1" ;; |
| 1772 | *) . "./$1" ;; |
| 1773 | esac |
| 1774 | } |
| 1775 | |
| 1776 | |
cristy | da16f16 | 2011-02-19 23:52:17 +0000 | [diff] [blame] | 1777 | # func_resolve_sysroot PATH |
| 1778 | # Replace a leading = in PATH with a sysroot. Store the result into |
| 1779 | # func_resolve_sysroot_result |
| 1780 | func_resolve_sysroot () |
| 1781 | { |
| 1782 | func_resolve_sysroot_result=$1 |
| 1783 | case $func_resolve_sysroot_result in |
| 1784 | =*) |
| 1785 | func_stripname '=' '' "$func_resolve_sysroot_result" |
| 1786 | func_resolve_sysroot_result=$lt_sysroot$func_stripname_result |
| 1787 | ;; |
| 1788 | esac |
| 1789 | } |
| 1790 | |
| 1791 | # func_replace_sysroot PATH |
| 1792 | # If PATH begins with the sysroot, replace it with = and |
| 1793 | # store the result into func_replace_sysroot_result. |
| 1794 | func_replace_sysroot () |
| 1795 | { |
| 1796 | case "$lt_sysroot:$1" in |
| 1797 | ?*:"$lt_sysroot"*) |
| 1798 | func_stripname "$lt_sysroot" '' "$1" |
| 1799 | func_replace_sysroot_result="=$func_stripname_result" |
| 1800 | ;; |
| 1801 | *) |
| 1802 | # Including no sysroot. |
| 1803 | func_replace_sysroot_result=$1 |
| 1804 | ;; |
| 1805 | esac |
| 1806 | } |
| 1807 | |
cristy | 3ed852e | 2009-09-05 21:47:34 +0000 | [diff] [blame] | 1808 | # func_infer_tag arg |
| 1809 | # Infer tagged configuration to use if any are available and |
| 1810 | # if one wasn't chosen via the "--tag" command line option. |
| 1811 | # Only attempt this if the compiler in the base compile |
| 1812 | # command doesn't match the default compiler. |
| 1813 | # arg is usually of the form 'gcc ...' |
| 1814 | func_infer_tag () |
| 1815 | { |
| 1816 | $opt_debug |
| 1817 | if test -n "$available_tags" && test -z "$tagname"; then |
| 1818 | CC_quoted= |
| 1819 | for arg in $CC; do |
cristy | da16f16 | 2011-02-19 23:52:17 +0000 | [diff] [blame] | 1820 | func_append_quoted CC_quoted "$arg" |
cristy | 3ed852e | 2009-09-05 21:47:34 +0000 | [diff] [blame] | 1821 | done |
cristy | 98dddb5 | 2010-11-04 00:30:15 +0000 | [diff] [blame] | 1822 | CC_expanded=`func_echo_all $CC` |
| 1823 | CC_quoted_expanded=`func_echo_all $CC_quoted` |
cristy | 3ed852e | 2009-09-05 21:47:34 +0000 | [diff] [blame] | 1824 | case $@ in |
| 1825 | # Blanks in the command may have been stripped by the calling shell, |
| 1826 | # but not from the CC environment variable when configure was run. |
cristy | 98dddb5 | 2010-11-04 00:30:15 +0000 | [diff] [blame] | 1827 | " $CC "* | "$CC "* | " $CC_expanded "* | "$CC_expanded "* | \ |
| 1828 | " $CC_quoted"* | "$CC_quoted "* | " $CC_quoted_expanded "* | "$CC_quoted_expanded "*) ;; |
cristy | 3ed852e | 2009-09-05 21:47:34 +0000 | [diff] [blame] | 1829 | # Blanks at the start of $base_compile will cause this to fail |
| 1830 | # if we don't check for them as well. |
| 1831 | *) |
| 1832 | for z in $available_tags; do |
| 1833 | if $GREP "^# ### BEGIN LIBTOOL TAG CONFIG: $z$" < "$progpath" > /dev/null; then |
| 1834 | # Evaluate the configuration. |
| 1835 | eval "`${SED} -n -e '/^# ### BEGIN LIBTOOL TAG CONFIG: '$z'$/,/^# ### END LIBTOOL TAG CONFIG: '$z'$/p' < $progpath`" |
| 1836 | CC_quoted= |
| 1837 | for arg in $CC; do |
| 1838 | # Double-quote args containing other shell metacharacters. |
cristy | da16f16 | 2011-02-19 23:52:17 +0000 | [diff] [blame] | 1839 | func_append_quoted CC_quoted "$arg" |
cristy | 3ed852e | 2009-09-05 21:47:34 +0000 | [diff] [blame] | 1840 | done |
cristy | 98dddb5 | 2010-11-04 00:30:15 +0000 | [diff] [blame] | 1841 | CC_expanded=`func_echo_all $CC` |
| 1842 | CC_quoted_expanded=`func_echo_all $CC_quoted` |
cristy | 3ed852e | 2009-09-05 21:47:34 +0000 | [diff] [blame] | 1843 | case "$@ " in |
cristy | 98dddb5 | 2010-11-04 00:30:15 +0000 | [diff] [blame] | 1844 | " $CC "* | "$CC "* | " $CC_expanded "* | "$CC_expanded "* | \ |
| 1845 | " $CC_quoted"* | "$CC_quoted "* | " $CC_quoted_expanded "* | "$CC_quoted_expanded "*) |
cristy | 3ed852e | 2009-09-05 21:47:34 +0000 | [diff] [blame] | 1846 | # The compiler in the base compile command matches |
| 1847 | # the one in the tagged configuration. |
| 1848 | # Assume this is the tagged configuration we want. |
| 1849 | tagname=$z |
| 1850 | break |
| 1851 | ;; |
| 1852 | esac |
| 1853 | fi |
| 1854 | done |
| 1855 | # If $tagname still isn't set, then no tagged configuration |
| 1856 | # was found and let the user know that the "--tag" command |
| 1857 | # line option must be used. |
| 1858 | if test -z "$tagname"; then |
| 1859 | func_echo "unable to infer tagged configuration" |
| 1860 | func_fatal_error "specify a tag with \`--tag'" |
| 1861 | # else |
| 1862 | # func_verbose "using $tagname tagged configuration" |
| 1863 | fi |
| 1864 | ;; |
| 1865 | esac |
| 1866 | fi |
| 1867 | } |
| 1868 | |
| 1869 | |
| 1870 | |
| 1871 | # func_write_libtool_object output_name pic_name nonpic_name |
| 1872 | # Create a libtool object file (analogous to a ".la" file), |
| 1873 | # but don't create it if we're doing a dry run. |
| 1874 | func_write_libtool_object () |
| 1875 | { |
| 1876 | write_libobj=${1} |
| 1877 | if test "$build_libtool_libs" = yes; then |
| 1878 | write_lobj=\'${2}\' |
| 1879 | else |
| 1880 | write_lobj=none |
| 1881 | fi |
| 1882 | |
| 1883 | if test "$build_old_libs" = yes; then |
| 1884 | write_oldobj=\'${3}\' |
| 1885 | else |
| 1886 | write_oldobj=none |
| 1887 | fi |
| 1888 | |
| 1889 | $opt_dry_run || { |
| 1890 | cat >${write_libobj}T <<EOF |
| 1891 | # $write_libobj - a libtool object file |
| 1892 | # Generated by $PROGRAM (GNU $PACKAGE$TIMESTAMP) $VERSION |
| 1893 | # |
| 1894 | # Please DO NOT delete this file! |
| 1895 | # It is necessary for linking the library. |
| 1896 | |
| 1897 | # Name of the PIC object. |
| 1898 | pic_object=$write_lobj |
| 1899 | |
| 1900 | # Name of the non-PIC object |
| 1901 | non_pic_object=$write_oldobj |
| 1902 | |
| 1903 | EOF |
| 1904 | $MV "${write_libobj}T" "${write_libobj}" |
| 1905 | } |
| 1906 | } |
| 1907 | |
cristy | da16f16 | 2011-02-19 23:52:17 +0000 | [diff] [blame] | 1908 | |
| 1909 | ################################################## |
| 1910 | # FILE NAME AND PATH CONVERSION HELPER FUNCTIONS # |
| 1911 | ################################################## |
| 1912 | |
| 1913 | # func_convert_core_file_wine_to_w32 ARG |
| 1914 | # Helper function used by file name conversion functions when $build is *nix, |
| 1915 | # and $host is mingw, cygwin, or some other w32 environment. Relies on a |
| 1916 | # correctly configured wine environment available, with the winepath program |
| 1917 | # in $build's $PATH. |
| 1918 | # |
| 1919 | # ARG is the $build file name to be converted to w32 format. |
| 1920 | # Result is available in $func_convert_core_file_wine_to_w32_result, and will |
| 1921 | # be empty on error (or when ARG is empty) |
| 1922 | func_convert_core_file_wine_to_w32 () |
| 1923 | { |
| 1924 | $opt_debug |
| 1925 | func_convert_core_file_wine_to_w32_result="$1" |
| 1926 | if test -n "$1"; then |
| 1927 | # Unfortunately, winepath does not exit with a non-zero error code, so we |
| 1928 | # are forced to check the contents of stdout. On the other hand, if the |
| 1929 | # command is not found, the shell will set an exit code of 127 and print |
| 1930 | # *an error message* to stdout. So we must check for both error code of |
| 1931 | # zero AND non-empty stdout, which explains the odd construction: |
| 1932 | func_convert_core_file_wine_to_w32_tmp=`winepath -w "$1" 2>/dev/null` |
| 1933 | if test "$?" -eq 0 && test -n "${func_convert_core_file_wine_to_w32_tmp}"; then |
| 1934 | func_convert_core_file_wine_to_w32_result=`$ECHO "$func_convert_core_file_wine_to_w32_tmp" | |
| 1935 | $SED -e "$lt_sed_naive_backslashify"` |
| 1936 | else |
| 1937 | func_convert_core_file_wine_to_w32_result= |
| 1938 | fi |
| 1939 | fi |
| 1940 | } |
| 1941 | # end: func_convert_core_file_wine_to_w32 |
| 1942 | |
| 1943 | |
| 1944 | # func_convert_core_path_wine_to_w32 ARG |
| 1945 | # Helper function used by path conversion functions when $build is *nix, and |
| 1946 | # $host is mingw, cygwin, or some other w32 environment. Relies on a correctly |
| 1947 | # configured wine environment available, with the winepath program in $build's |
| 1948 | # $PATH. Assumes ARG has no leading or trailing path separator characters. |
| 1949 | # |
| 1950 | # ARG is path to be converted from $build format to win32. |
| 1951 | # Result is available in $func_convert_core_path_wine_to_w32_result. |
| 1952 | # Unconvertible file (directory) names in ARG are skipped; if no directory names |
| 1953 | # are convertible, then the result may be empty. |
| 1954 | func_convert_core_path_wine_to_w32 () |
| 1955 | { |
| 1956 | $opt_debug |
| 1957 | # unfortunately, winepath doesn't convert paths, only file names |
| 1958 | func_convert_core_path_wine_to_w32_result="" |
| 1959 | if test -n "$1"; then |
| 1960 | oldIFS=$IFS |
| 1961 | IFS=: |
| 1962 | for func_convert_core_path_wine_to_w32_f in $1; do |
| 1963 | IFS=$oldIFS |
| 1964 | func_convert_core_file_wine_to_w32 "$func_convert_core_path_wine_to_w32_f" |
| 1965 | if test -n "$func_convert_core_file_wine_to_w32_result" ; then |
| 1966 | if test -z "$func_convert_core_path_wine_to_w32_result"; then |
| 1967 | func_convert_core_path_wine_to_w32_result="$func_convert_core_file_wine_to_w32_result" |
| 1968 | else |
| 1969 | func_append func_convert_core_path_wine_to_w32_result ";$func_convert_core_file_wine_to_w32_result" |
| 1970 | fi |
| 1971 | fi |
| 1972 | done |
| 1973 | IFS=$oldIFS |
| 1974 | fi |
| 1975 | } |
| 1976 | # end: func_convert_core_path_wine_to_w32 |
| 1977 | |
| 1978 | |
| 1979 | # func_cygpath ARGS... |
| 1980 | # Wrapper around calling the cygpath program via LT_CYGPATH. This is used when |
| 1981 | # when (1) $build is *nix and Cygwin is hosted via a wine environment; or (2) |
| 1982 | # $build is MSYS and $host is Cygwin, or (3) $build is Cygwin. In case (1) or |
| 1983 | # (2), returns the Cygwin file name or path in func_cygpath_result (input |
| 1984 | # file name or path is assumed to be in w32 format, as previously converted |
| 1985 | # from $build's *nix or MSYS format). In case (3), returns the w32 file name |
| 1986 | # or path in func_cygpath_result (input file name or path is assumed to be in |
| 1987 | # Cygwin format). Returns an empty string on error. |
| 1988 | # |
| 1989 | # ARGS are passed to cygpath, with the last one being the file name or path to |
| 1990 | # be converted. |
| 1991 | # |
| 1992 | # Specify the absolute *nix (or w32) name to cygpath in the LT_CYGPATH |
| 1993 | # environment variable; do not put it in $PATH. |
| 1994 | func_cygpath () |
| 1995 | { |
| 1996 | $opt_debug |
| 1997 | if test -n "$LT_CYGPATH" && test -f "$LT_CYGPATH"; then |
| 1998 | func_cygpath_result=`$LT_CYGPATH "$@" 2>/dev/null` |
| 1999 | if test "$?" -ne 0; then |
| 2000 | # on failure, ensure result is empty |
| 2001 | func_cygpath_result= |
| 2002 | fi |
| 2003 | else |
| 2004 | func_cygpath_result= |
| 2005 | func_error "LT_CYGPATH is empty or specifies non-existent file: \`$LT_CYGPATH'" |
| 2006 | fi |
| 2007 | } |
| 2008 | #end: func_cygpath |
| 2009 | |
| 2010 | |
| 2011 | # func_convert_core_msys_to_w32 ARG |
| 2012 | # Convert file name or path ARG from MSYS format to w32 format. Return |
| 2013 | # result in func_convert_core_msys_to_w32_result. |
| 2014 | func_convert_core_msys_to_w32 () |
| 2015 | { |
| 2016 | $opt_debug |
| 2017 | # awkward: cmd appends spaces to result |
| 2018 | func_convert_core_msys_to_w32_result=`( cmd //c echo "$1" ) 2>/dev/null | |
| 2019 | $SED -e 's/[ ]*$//' -e "$lt_sed_naive_backslashify"` |
| 2020 | } |
| 2021 | #end: func_convert_core_msys_to_w32 |
| 2022 | |
| 2023 | |
| 2024 | # func_convert_file_check ARG1 ARG2 |
| 2025 | # Verify that ARG1 (a file name in $build format) was converted to $host |
| 2026 | # format in ARG2. Otherwise, emit an error message, but continue (resetting |
| 2027 | # func_to_host_file_result to ARG1). |
| 2028 | func_convert_file_check () |
| 2029 | { |
| 2030 | $opt_debug |
| 2031 | if test -z "$2" && test -n "$1" ; then |
| 2032 | func_error "Could not determine host file name corresponding to" |
| 2033 | func_error " \`$1'" |
| 2034 | func_error "Continuing, but uninstalled executables may not work." |
| 2035 | # Fallback: |
| 2036 | func_to_host_file_result="$1" |
| 2037 | fi |
| 2038 | } |
| 2039 | # end func_convert_file_check |
| 2040 | |
| 2041 | |
| 2042 | # func_convert_path_check FROM_PATHSEP TO_PATHSEP FROM_PATH TO_PATH |
| 2043 | # Verify that FROM_PATH (a path in $build format) was converted to $host |
| 2044 | # format in TO_PATH. Otherwise, emit an error message, but continue, resetting |
| 2045 | # func_to_host_file_result to a simplistic fallback value (see below). |
| 2046 | func_convert_path_check () |
| 2047 | { |
| 2048 | $opt_debug |
| 2049 | if test -z "$4" && test -n "$3"; then |
| 2050 | func_error "Could not determine the host path corresponding to" |
| 2051 | func_error " \`$3'" |
| 2052 | func_error "Continuing, but uninstalled executables may not work." |
| 2053 | # Fallback. This is a deliberately simplistic "conversion" and |
| 2054 | # should not be "improved". See libtool.info. |
| 2055 | if test "x$1" != "x$2"; then |
| 2056 | lt_replace_pathsep_chars="s|$1|$2|g" |
| 2057 | func_to_host_path_result=`echo "$3" | |
| 2058 | $SED -e "$lt_replace_pathsep_chars"` |
| 2059 | else |
| 2060 | func_to_host_path_result="$3" |
| 2061 | fi |
| 2062 | fi |
| 2063 | } |
| 2064 | # end func_convert_path_check |
| 2065 | |
| 2066 | |
| 2067 | # func_convert_path_front_back_pathsep FRONTPAT BACKPAT REPL ORIG |
| 2068 | # Modifies func_to_host_path_result by prepending REPL if ORIG matches FRONTPAT |
| 2069 | # and appending REPL if ORIG matches BACKPAT. |
| 2070 | func_convert_path_front_back_pathsep () |
| 2071 | { |
| 2072 | $opt_debug |
| 2073 | case $4 in |
| 2074 | $1 ) func_to_host_path_result="$3$func_to_host_path_result" |
| 2075 | ;; |
| 2076 | esac |
| 2077 | case $4 in |
| 2078 | $2 ) func_to_host_path_result+="$3" |
| 2079 | ;; |
| 2080 | esac |
| 2081 | } |
| 2082 | # end func_convert_path_front_back_pathsep |
| 2083 | |
| 2084 | |
| 2085 | ################################################## |
| 2086 | # $build to $host FILE NAME CONVERSION FUNCTIONS # |
| 2087 | ################################################## |
| 2088 | # invoked via `$to_host_file_cmd ARG' |
| 2089 | # |
| 2090 | # In each case, ARG is the path to be converted from $build to $host format. |
| 2091 | # Result will be available in $func_to_host_file_result. |
| 2092 | |
| 2093 | |
| 2094 | # func_to_host_file ARG |
| 2095 | # Converts the file name ARG from $build format to $host format. Return result |
| 2096 | # in func_to_host_file_result. |
| 2097 | func_to_host_file () |
| 2098 | { |
| 2099 | $opt_debug |
| 2100 | $to_host_file_cmd "$1" |
| 2101 | } |
| 2102 | # end func_to_host_file |
| 2103 | |
| 2104 | |
| 2105 | # func_to_tool_file ARG LAZY |
| 2106 | # converts the file name ARG from $build format to toolchain format. Return |
| 2107 | # result in func_to_tool_file_result. If the conversion in use is listed |
| 2108 | # in (the comma separated) LAZY, no conversion takes place. |
| 2109 | func_to_tool_file () |
| 2110 | { |
| 2111 | $opt_debug |
| 2112 | case ,$2, in |
| 2113 | *,"$to_tool_file_cmd",*) |
| 2114 | func_to_tool_file_result=$1 |
| 2115 | ;; |
| 2116 | *) |
| 2117 | $to_tool_file_cmd "$1" |
| 2118 | func_to_tool_file_result=$func_to_host_file_result |
| 2119 | ;; |
| 2120 | esac |
| 2121 | } |
| 2122 | # end func_to_tool_file |
| 2123 | |
| 2124 | |
| 2125 | # func_convert_file_noop ARG |
| 2126 | # Copy ARG to func_to_host_file_result. |
| 2127 | func_convert_file_noop () |
| 2128 | { |
| 2129 | func_to_host_file_result="$1" |
| 2130 | } |
| 2131 | # end func_convert_file_noop |
| 2132 | |
| 2133 | |
| 2134 | # func_convert_file_msys_to_w32 ARG |
| 2135 | # Convert file name ARG from (mingw) MSYS to (mingw) w32 format; automatic |
| 2136 | # conversion to w32 is not available inside the cwrapper. Returns result in |
| 2137 | # func_to_host_file_result. |
| 2138 | func_convert_file_msys_to_w32 () |
| 2139 | { |
| 2140 | $opt_debug |
| 2141 | func_to_host_file_result="$1" |
| 2142 | if test -n "$1"; then |
| 2143 | func_convert_core_msys_to_w32 "$1" |
| 2144 | func_to_host_file_result="$func_convert_core_msys_to_w32_result" |
| 2145 | fi |
| 2146 | func_convert_file_check "$1" "$func_to_host_file_result" |
| 2147 | } |
| 2148 | # end func_convert_file_msys_to_w32 |
| 2149 | |
| 2150 | |
| 2151 | # func_convert_file_cygwin_to_w32 ARG |
| 2152 | # Convert file name ARG from Cygwin to w32 format. Returns result in |
| 2153 | # func_to_host_file_result. |
| 2154 | func_convert_file_cygwin_to_w32 () |
| 2155 | { |
| 2156 | $opt_debug |
| 2157 | func_to_host_file_result="$1" |
| 2158 | if test -n "$1"; then |
| 2159 | # because $build is cygwin, we call "the" cygpath in $PATH; no need to use |
| 2160 | # LT_CYGPATH in this case. |
| 2161 | func_to_host_file_result=`cygpath -m "$1"` |
| 2162 | fi |
| 2163 | func_convert_file_check "$1" "$func_to_host_file_result" |
| 2164 | } |
| 2165 | # end func_convert_file_cygwin_to_w32 |
| 2166 | |
| 2167 | |
| 2168 | # func_convert_file_nix_to_w32 ARG |
| 2169 | # Convert file name ARG from *nix to w32 format. Requires a wine environment |
| 2170 | # and a working winepath. Returns result in func_to_host_file_result. |
| 2171 | func_convert_file_nix_to_w32 () |
| 2172 | { |
| 2173 | $opt_debug |
| 2174 | func_to_host_file_result="$1" |
| 2175 | if test -n "$1"; then |
| 2176 | func_convert_core_file_wine_to_w32 "$1" |
| 2177 | func_to_host_file_result="$func_convert_core_file_wine_to_w32_result" |
| 2178 | fi |
| 2179 | func_convert_file_check "$1" "$func_to_host_file_result" |
| 2180 | } |
| 2181 | # end func_convert_file_nix_to_w32 |
| 2182 | |
| 2183 | |
| 2184 | # func_convert_file_msys_to_cygwin ARG |
| 2185 | # Convert file name ARG from MSYS to Cygwin format. Requires LT_CYGPATH set. |
| 2186 | # Returns result in func_to_host_file_result. |
| 2187 | func_convert_file_msys_to_cygwin () |
| 2188 | { |
| 2189 | $opt_debug |
| 2190 | func_to_host_file_result="$1" |
| 2191 | if test -n "$1"; then |
| 2192 | func_convert_core_msys_to_w32 "$1" |
| 2193 | func_cygpath -u "$func_convert_core_msys_to_w32_result" |
| 2194 | func_to_host_file_result="$func_cygpath_result" |
| 2195 | fi |
| 2196 | func_convert_file_check "$1" "$func_to_host_file_result" |
| 2197 | } |
| 2198 | # end func_convert_file_msys_to_cygwin |
| 2199 | |
| 2200 | |
| 2201 | # func_convert_file_nix_to_cygwin ARG |
| 2202 | # Convert file name ARG from *nix to Cygwin format. Requires Cygwin installed |
| 2203 | # in a wine environment, working winepath, and LT_CYGPATH set. Returns result |
| 2204 | # in func_to_host_file_result. |
| 2205 | func_convert_file_nix_to_cygwin () |
| 2206 | { |
| 2207 | $opt_debug |
| 2208 | func_to_host_file_result="$1" |
| 2209 | if test -n "$1"; then |
| 2210 | # convert from *nix to w32, then use cygpath to convert from w32 to cygwin. |
| 2211 | func_convert_core_file_wine_to_w32 "$1" |
| 2212 | func_cygpath -u "$func_convert_core_file_wine_to_w32_result" |
| 2213 | func_to_host_file_result="$func_cygpath_result" |
| 2214 | fi |
| 2215 | func_convert_file_check "$1" "$func_to_host_file_result" |
| 2216 | } |
| 2217 | # end func_convert_file_nix_to_cygwin |
| 2218 | |
| 2219 | |
| 2220 | ############################################# |
| 2221 | # $build to $host PATH CONVERSION FUNCTIONS # |
| 2222 | ############################################# |
| 2223 | # invoked via `$to_host_path_cmd ARG' |
| 2224 | # |
| 2225 | # In each case, ARG is the path to be converted from $build to $host format. |
| 2226 | # The result will be available in $func_to_host_path_result. |
| 2227 | # |
| 2228 | # Path separators are also converted from $build format to $host format. If |
| 2229 | # ARG begins or ends with a path separator character, it is preserved (but |
| 2230 | # converted to $host format) on output. |
| 2231 | # |
| 2232 | # All path conversion functions are named using the following convention: |
| 2233 | # file name conversion function : func_convert_file_X_to_Y () |
| 2234 | # path conversion function : func_convert_path_X_to_Y () |
| 2235 | # where, for any given $build/$host combination the 'X_to_Y' value is the |
| 2236 | # same. If conversion functions are added for new $build/$host combinations, |
| 2237 | # the two new functions must follow this pattern, or func_init_to_host_path_cmd |
| 2238 | # will break. |
| 2239 | |
| 2240 | |
| 2241 | # func_init_to_host_path_cmd |
| 2242 | # Ensures that function "pointer" variable $to_host_path_cmd is set to the |
| 2243 | # appropriate value, based on the value of $to_host_file_cmd. |
| 2244 | to_host_path_cmd= |
| 2245 | func_init_to_host_path_cmd () |
| 2246 | { |
| 2247 | $opt_debug |
| 2248 | if test -z "$to_host_path_cmd"; then |
| 2249 | func_stripname 'func_convert_file_' '' "$to_host_file_cmd" |
| 2250 | to_host_path_cmd="func_convert_path_${func_stripname_result}" |
| 2251 | fi |
| 2252 | } |
| 2253 | |
| 2254 | |
| 2255 | # func_to_host_path ARG |
| 2256 | # Converts the path ARG from $build format to $host format. Return result |
| 2257 | # in func_to_host_path_result. |
| 2258 | func_to_host_path () |
| 2259 | { |
| 2260 | $opt_debug |
| 2261 | func_init_to_host_path_cmd |
| 2262 | $to_host_path_cmd "$1" |
| 2263 | } |
| 2264 | # end func_to_host_path |
| 2265 | |
| 2266 | |
| 2267 | # func_convert_path_noop ARG |
| 2268 | # Copy ARG to func_to_host_path_result. |
| 2269 | func_convert_path_noop () |
| 2270 | { |
| 2271 | func_to_host_path_result="$1" |
| 2272 | } |
| 2273 | # end func_convert_path_noop |
| 2274 | |
| 2275 | |
| 2276 | # func_convert_path_msys_to_w32 ARG |
| 2277 | # Convert path ARG from (mingw) MSYS to (mingw) w32 format; automatic |
| 2278 | # conversion to w32 is not available inside the cwrapper. Returns result in |
| 2279 | # func_to_host_path_result. |
| 2280 | func_convert_path_msys_to_w32 () |
| 2281 | { |
| 2282 | $opt_debug |
| 2283 | func_to_host_path_result="$1" |
| 2284 | if test -n "$1"; then |
| 2285 | # Remove leading and trailing path separator characters from ARG. MSYS |
| 2286 | # behavior is inconsistent here; cygpath turns them into '.;' and ';.'; |
| 2287 | # and winepath ignores them completely. |
| 2288 | func_stripname : : "$1" |
| 2289 | func_to_host_path_tmp1=$func_stripname_result |
| 2290 | func_convert_core_msys_to_w32 "$func_to_host_path_tmp1" |
| 2291 | func_to_host_path_result="$func_convert_core_msys_to_w32_result" |
| 2292 | func_convert_path_check : ";" \ |
| 2293 | "$func_to_host_path_tmp1" "$func_to_host_path_result" |
| 2294 | func_convert_path_front_back_pathsep ":*" "*:" ";" "$1" |
| 2295 | fi |
| 2296 | } |
| 2297 | # end func_convert_path_msys_to_w32 |
| 2298 | |
| 2299 | |
| 2300 | # func_convert_path_cygwin_to_w32 ARG |
| 2301 | # Convert path ARG from Cygwin to w32 format. Returns result in |
| 2302 | # func_to_host_file_result. |
| 2303 | func_convert_path_cygwin_to_w32 () |
| 2304 | { |
| 2305 | $opt_debug |
| 2306 | func_to_host_path_result="$1" |
| 2307 | if test -n "$1"; then |
| 2308 | # See func_convert_path_msys_to_w32: |
| 2309 | func_stripname : : "$1" |
| 2310 | func_to_host_path_tmp1=$func_stripname_result |
| 2311 | func_to_host_path_result=`cygpath -m -p "$func_to_host_path_tmp1"` |
| 2312 | func_convert_path_check : ";" \ |
| 2313 | "$func_to_host_path_tmp1" "$func_to_host_path_result" |
| 2314 | func_convert_path_front_back_pathsep ":*" "*:" ";" "$1" |
| 2315 | fi |
| 2316 | } |
| 2317 | # end func_convert_path_cygwin_to_w32 |
| 2318 | |
| 2319 | |
| 2320 | # func_convert_path_nix_to_w32 ARG |
| 2321 | # Convert path ARG from *nix to w32 format. Requires a wine environment and |
| 2322 | # a working winepath. Returns result in func_to_host_file_result. |
| 2323 | func_convert_path_nix_to_w32 () |
| 2324 | { |
| 2325 | $opt_debug |
| 2326 | func_to_host_path_result="$1" |
| 2327 | if test -n "$1"; then |
| 2328 | # See func_convert_path_msys_to_w32: |
| 2329 | func_stripname : : "$1" |
| 2330 | func_to_host_path_tmp1=$func_stripname_result |
| 2331 | func_convert_core_path_wine_to_w32 "$func_to_host_path_tmp1" |
| 2332 | func_to_host_path_result="$func_convert_core_path_wine_to_w32_result" |
| 2333 | func_convert_path_check : ";" \ |
| 2334 | "$func_to_host_path_tmp1" "$func_to_host_path_result" |
| 2335 | func_convert_path_front_back_pathsep ":*" "*:" ";" "$1" |
| 2336 | fi |
| 2337 | } |
| 2338 | # end func_convert_path_nix_to_w32 |
| 2339 | |
| 2340 | |
| 2341 | # func_convert_path_msys_to_cygwin ARG |
| 2342 | # Convert path ARG from MSYS to Cygwin format. Requires LT_CYGPATH set. |
| 2343 | # Returns result in func_to_host_file_result. |
| 2344 | func_convert_path_msys_to_cygwin () |
| 2345 | { |
| 2346 | $opt_debug |
| 2347 | func_to_host_path_result="$1" |
| 2348 | if test -n "$1"; then |
| 2349 | # See func_convert_path_msys_to_w32: |
| 2350 | func_stripname : : "$1" |
| 2351 | func_to_host_path_tmp1=$func_stripname_result |
| 2352 | func_convert_core_msys_to_w32 "$func_to_host_path_tmp1" |
| 2353 | func_cygpath -u -p "$func_convert_core_msys_to_w32_result" |
| 2354 | func_to_host_path_result="$func_cygpath_result" |
| 2355 | func_convert_path_check : : \ |
| 2356 | "$func_to_host_path_tmp1" "$func_to_host_path_result" |
| 2357 | func_convert_path_front_back_pathsep ":*" "*:" : "$1" |
| 2358 | fi |
| 2359 | } |
| 2360 | # end func_convert_path_msys_to_cygwin |
| 2361 | |
| 2362 | |
| 2363 | # func_convert_path_nix_to_cygwin ARG |
| 2364 | # Convert path ARG from *nix to Cygwin format. Requires Cygwin installed in a |
| 2365 | # a wine environment, working winepath, and LT_CYGPATH set. Returns result in |
| 2366 | # func_to_host_file_result. |
| 2367 | func_convert_path_nix_to_cygwin () |
| 2368 | { |
| 2369 | $opt_debug |
| 2370 | func_to_host_path_result="$1" |
| 2371 | if test -n "$1"; then |
| 2372 | # Remove leading and trailing path separator characters from |
| 2373 | # ARG. msys behavior is inconsistent here, cygpath turns them |
| 2374 | # into '.;' and ';.', and winepath ignores them completely. |
| 2375 | func_stripname : : "$1" |
| 2376 | func_to_host_path_tmp1=$func_stripname_result |
| 2377 | func_convert_core_path_wine_to_w32 "$func_to_host_path_tmp1" |
| 2378 | func_cygpath -u -p "$func_convert_core_path_wine_to_w32_result" |
| 2379 | func_to_host_path_result="$func_cygpath_result" |
| 2380 | func_convert_path_check : : \ |
| 2381 | "$func_to_host_path_tmp1" "$func_to_host_path_result" |
| 2382 | func_convert_path_front_back_pathsep ":*" "*:" : "$1" |
| 2383 | fi |
| 2384 | } |
| 2385 | # end func_convert_path_nix_to_cygwin |
| 2386 | |
| 2387 | |
cristy | 3ed852e | 2009-09-05 21:47:34 +0000 | [diff] [blame] | 2388 | # func_mode_compile arg... |
| 2389 | func_mode_compile () |
| 2390 | { |
| 2391 | $opt_debug |
| 2392 | # Get the compilation command and the source file. |
| 2393 | base_compile= |
| 2394 | srcfile="$nonopt" # always keep a non-empty value in "srcfile" |
| 2395 | suppress_opt=yes |
| 2396 | suppress_output= |
| 2397 | arg_mode=normal |
| 2398 | libobj= |
| 2399 | later= |
| 2400 | pie_flag= |
| 2401 | |
| 2402 | for arg |
| 2403 | do |
| 2404 | case $arg_mode in |
| 2405 | arg ) |
| 2406 | # do not "continue". Instead, add this to base_compile |
| 2407 | lastarg="$arg" |
| 2408 | arg_mode=normal |
| 2409 | ;; |
| 2410 | |
| 2411 | target ) |
| 2412 | libobj="$arg" |
| 2413 | arg_mode=normal |
| 2414 | continue |
| 2415 | ;; |
| 2416 | |
| 2417 | normal ) |
| 2418 | # Accept any command-line options. |
| 2419 | case $arg in |
| 2420 | -o) |
| 2421 | test -n "$libobj" && \ |
| 2422 | func_fatal_error "you cannot specify \`-o' more than once" |
| 2423 | arg_mode=target |
| 2424 | continue |
| 2425 | ;; |
| 2426 | |
| 2427 | -pie | -fpie | -fPIE) |
cristy | da16f16 | 2011-02-19 23:52:17 +0000 | [diff] [blame] | 2428 | pie_flag+=" $arg" |
cristy | 3ed852e | 2009-09-05 21:47:34 +0000 | [diff] [blame] | 2429 | continue |
| 2430 | ;; |
| 2431 | |
| 2432 | -shared | -static | -prefer-pic | -prefer-non-pic) |
cristy | da16f16 | 2011-02-19 23:52:17 +0000 | [diff] [blame] | 2433 | later+=" $arg" |
cristy | 3ed852e | 2009-09-05 21:47:34 +0000 | [diff] [blame] | 2434 | continue |
| 2435 | ;; |
| 2436 | |
| 2437 | -no-suppress) |
| 2438 | suppress_opt=no |
| 2439 | continue |
| 2440 | ;; |
| 2441 | |
| 2442 | -Xcompiler) |
| 2443 | arg_mode=arg # the next one goes into the "base_compile" arg list |
| 2444 | continue # The current "srcfile" will either be retained or |
| 2445 | ;; # replaced later. I would guess that would be a bug. |
| 2446 | |
| 2447 | -Wc,*) |
| 2448 | func_stripname '-Wc,' '' "$arg" |
| 2449 | args=$func_stripname_result |
| 2450 | lastarg= |
| 2451 | save_ifs="$IFS"; IFS=',' |
| 2452 | for arg in $args; do |
| 2453 | IFS="$save_ifs" |
cristy | da16f16 | 2011-02-19 23:52:17 +0000 | [diff] [blame] | 2454 | func_append_quoted lastarg "$arg" |
cristy | 3ed852e | 2009-09-05 21:47:34 +0000 | [diff] [blame] | 2455 | done |
| 2456 | IFS="$save_ifs" |
| 2457 | func_stripname ' ' '' "$lastarg" |
| 2458 | lastarg=$func_stripname_result |
| 2459 | |
| 2460 | # Add the arguments to base_compile. |
cristy | da16f16 | 2011-02-19 23:52:17 +0000 | [diff] [blame] | 2461 | base_compile+=" $lastarg" |
cristy | 3ed852e | 2009-09-05 21:47:34 +0000 | [diff] [blame] | 2462 | continue |
| 2463 | ;; |
| 2464 | |
| 2465 | *) |
| 2466 | # Accept the current argument as the source file. |
| 2467 | # The previous "srcfile" becomes the current argument. |
| 2468 | # |
| 2469 | lastarg="$srcfile" |
| 2470 | srcfile="$arg" |
| 2471 | ;; |
| 2472 | esac # case $arg |
| 2473 | ;; |
| 2474 | esac # case $arg_mode |
| 2475 | |
| 2476 | # Aesthetically quote the previous argument. |
cristy | da16f16 | 2011-02-19 23:52:17 +0000 | [diff] [blame] | 2477 | func_append_quoted base_compile "$lastarg" |
cristy | 3ed852e | 2009-09-05 21:47:34 +0000 | [diff] [blame] | 2478 | done # for arg |
| 2479 | |
| 2480 | case $arg_mode in |
| 2481 | arg) |
| 2482 | func_fatal_error "you must specify an argument for -Xcompile" |
| 2483 | ;; |
| 2484 | target) |
| 2485 | func_fatal_error "you must specify a target with \`-o'" |
| 2486 | ;; |
| 2487 | *) |
| 2488 | # Get the name of the library object. |
| 2489 | test -z "$libobj" && { |
| 2490 | func_basename "$srcfile" |
| 2491 | libobj="$func_basename_result" |
| 2492 | } |
| 2493 | ;; |
| 2494 | esac |
| 2495 | |
| 2496 | # Recognize several different file suffixes. |
| 2497 | # If the user specifies -o file.o, it is replaced with file.lo |
| 2498 | case $libobj in |
| 2499 | *.[cCFSifmso] | \ |
| 2500 | *.ada | *.adb | *.ads | *.asm | \ |
| 2501 | *.c++ | *.cc | *.ii | *.class | *.cpp | *.cxx | \ |
cristy | 98dddb5 | 2010-11-04 00:30:15 +0000 | [diff] [blame] | 2502 | *.[fF][09]? | *.for | *.java | *.obj | *.sx | *.cu | *.cup) |
cristy | 3ed852e | 2009-09-05 21:47:34 +0000 | [diff] [blame] | 2503 | func_xform "$libobj" |
| 2504 | libobj=$func_xform_result |
| 2505 | ;; |
| 2506 | esac |
| 2507 | |
| 2508 | case $libobj in |
| 2509 | *.lo) func_lo2o "$libobj"; obj=$func_lo2o_result ;; |
| 2510 | *) |
| 2511 | func_fatal_error "cannot determine name of library object from \`$libobj'" |
| 2512 | ;; |
| 2513 | esac |
| 2514 | |
| 2515 | func_infer_tag $base_compile |
| 2516 | |
| 2517 | for arg in $later; do |
| 2518 | case $arg in |
| 2519 | -shared) |
| 2520 | test "$build_libtool_libs" != yes && \ |
| 2521 | func_fatal_configuration "can not build a shared library" |
| 2522 | build_old_libs=no |
| 2523 | continue |
| 2524 | ;; |
| 2525 | |
| 2526 | -static) |
| 2527 | build_libtool_libs=no |
| 2528 | build_old_libs=yes |
| 2529 | continue |
| 2530 | ;; |
| 2531 | |
| 2532 | -prefer-pic) |
| 2533 | pic_mode=yes |
| 2534 | continue |
| 2535 | ;; |
| 2536 | |
| 2537 | -prefer-non-pic) |
| 2538 | pic_mode=no |
| 2539 | continue |
| 2540 | ;; |
| 2541 | esac |
| 2542 | done |
| 2543 | |
| 2544 | func_quote_for_eval "$libobj" |
| 2545 | test "X$libobj" != "X$func_quote_for_eval_result" \ |
| 2546 | && $ECHO "X$libobj" | $GREP '[]~#^*{};<>?"'"'"' &()|`$[]' \ |
| 2547 | && func_warning "libobj name \`$libobj' may not contain shell special characters." |
| 2548 | func_dirname_and_basename "$obj" "/" "" |
| 2549 | objname="$func_basename_result" |
| 2550 | xdir="$func_dirname_result" |
| 2551 | lobj=${xdir}$objdir/$objname |
| 2552 | |
| 2553 | test -z "$base_compile" && \ |
| 2554 | func_fatal_help "you must specify a compilation command" |
| 2555 | |
| 2556 | # Delete any leftover library objects. |
| 2557 | if test "$build_old_libs" = yes; then |
| 2558 | removelist="$obj $lobj $libobj ${libobj}T" |
| 2559 | else |
| 2560 | removelist="$lobj $libobj ${libobj}T" |
| 2561 | fi |
| 2562 | |
| 2563 | # On Cygwin there's no "real" PIC flag so we must build both object types |
| 2564 | case $host_os in |
| 2565 | cygwin* | mingw* | pw32* | os2* | cegcc*) |
| 2566 | pic_mode=default |
| 2567 | ;; |
| 2568 | esac |
| 2569 | if test "$pic_mode" = no && test "$deplibs_check_method" != pass_all; then |
| 2570 | # non-PIC code in shared libraries is not supported |
| 2571 | pic_mode=default |
| 2572 | fi |
| 2573 | |
| 2574 | # Calculate the filename of the output object if compiler does |
| 2575 | # not support -o with -c |
| 2576 | if test "$compiler_c_o" = no; then |
cristy | 98dddb5 | 2010-11-04 00:30:15 +0000 | [diff] [blame] | 2577 | output_obj=`$ECHO "$srcfile" | $SED 's%^.*/%%; s%\.[^.]*$%%'`.${objext} |
cristy | 3ed852e | 2009-09-05 21:47:34 +0000 | [diff] [blame] | 2578 | lockfile="$output_obj.lock" |
| 2579 | else |
| 2580 | output_obj= |
| 2581 | need_locks=no |
| 2582 | lockfile= |
| 2583 | fi |
| 2584 | |
| 2585 | # Lock this critical section if it is needed |
| 2586 | # We use this script file to make the link, it avoids creating a new file |
| 2587 | if test "$need_locks" = yes; then |
| 2588 | until $opt_dry_run || ln "$progpath" "$lockfile" 2>/dev/null; do |
| 2589 | func_echo "Waiting for $lockfile to be removed" |
| 2590 | sleep 2 |
| 2591 | done |
| 2592 | elif test "$need_locks" = warn; then |
| 2593 | if test -f "$lockfile"; then |
| 2594 | $ECHO "\ |
| 2595 | *** ERROR, $lockfile exists and contains: |
| 2596 | `cat $lockfile 2>/dev/null` |
| 2597 | |
| 2598 | This indicates that another process is trying to use the same |
| 2599 | temporary object file, and libtool could not work around it because |
| 2600 | your compiler does not support \`-c' and \`-o' together. If you |
| 2601 | repeat this compilation, it may succeed, by chance, but you had better |
| 2602 | avoid parallel builds (make -j) in this platform, or get a better |
| 2603 | compiler." |
| 2604 | |
| 2605 | $opt_dry_run || $RM $removelist |
| 2606 | exit $EXIT_FAILURE |
| 2607 | fi |
cristy | da16f16 | 2011-02-19 23:52:17 +0000 | [diff] [blame] | 2608 | removelist+=" $output_obj" |
cristy | 3ed852e | 2009-09-05 21:47:34 +0000 | [diff] [blame] | 2609 | $ECHO "$srcfile" > "$lockfile" |
| 2610 | fi |
| 2611 | |
| 2612 | $opt_dry_run || $RM $removelist |
cristy | da16f16 | 2011-02-19 23:52:17 +0000 | [diff] [blame] | 2613 | removelist+=" $lockfile" |
cristy | 3ed852e | 2009-09-05 21:47:34 +0000 | [diff] [blame] | 2614 | trap '$opt_dry_run || $RM $removelist; exit $EXIT_FAILURE' 1 2 15 |
| 2615 | |
cristy | da16f16 | 2011-02-19 23:52:17 +0000 | [diff] [blame] | 2616 | func_to_tool_file "$srcfile" func_convert_file_msys_to_w32 |
| 2617 | srcfile=$func_to_tool_file_result |
cristy | 3ed852e | 2009-09-05 21:47:34 +0000 | [diff] [blame] | 2618 | func_quote_for_eval "$srcfile" |
| 2619 | qsrcfile=$func_quote_for_eval_result |
| 2620 | |
| 2621 | # Only build a PIC object if we are building libtool libraries. |
| 2622 | if test "$build_libtool_libs" = yes; then |
| 2623 | # Without this assignment, base_compile gets emptied. |
| 2624 | fbsd_hideous_sh_bug=$base_compile |
| 2625 | |
| 2626 | if test "$pic_mode" != no; then |
| 2627 | command="$base_compile $qsrcfile $pic_flag" |
| 2628 | else |
| 2629 | # Don't build PIC code |
| 2630 | command="$base_compile $qsrcfile" |
| 2631 | fi |
| 2632 | |
| 2633 | func_mkdir_p "$xdir$objdir" |
| 2634 | |
| 2635 | if test -z "$output_obj"; then |
| 2636 | # Place PIC objects in $objdir |
cristy | da16f16 | 2011-02-19 23:52:17 +0000 | [diff] [blame] | 2637 | command+=" -o $lobj" |
cristy | 3ed852e | 2009-09-05 21:47:34 +0000 | [diff] [blame] | 2638 | fi |
| 2639 | |
| 2640 | func_show_eval_locale "$command" \ |
| 2641 | 'test -n "$output_obj" && $RM $removelist; exit $EXIT_FAILURE' |
| 2642 | |
| 2643 | if test "$need_locks" = warn && |
| 2644 | test "X`cat $lockfile 2>/dev/null`" != "X$srcfile"; then |
| 2645 | $ECHO "\ |
| 2646 | *** ERROR, $lockfile contains: |
| 2647 | `cat $lockfile 2>/dev/null` |
| 2648 | |
| 2649 | but it should contain: |
| 2650 | $srcfile |
| 2651 | |
| 2652 | This indicates that another process is trying to use the same |
| 2653 | temporary object file, and libtool could not work around it because |
| 2654 | your compiler does not support \`-c' and \`-o' together. If you |
| 2655 | repeat this compilation, it may succeed, by chance, but you had better |
| 2656 | avoid parallel builds (make -j) in this platform, or get a better |
| 2657 | compiler." |
| 2658 | |
| 2659 | $opt_dry_run || $RM $removelist |
| 2660 | exit $EXIT_FAILURE |
| 2661 | fi |
| 2662 | |
| 2663 | # Just move the object if needed, then go on to compile the next one |
| 2664 | if test -n "$output_obj" && test "X$output_obj" != "X$lobj"; then |
| 2665 | func_show_eval '$MV "$output_obj" "$lobj"' \ |
| 2666 | 'error=$?; $opt_dry_run || $RM $removelist; exit $error' |
| 2667 | fi |
| 2668 | |
| 2669 | # Allow error messages only from the first compilation. |
| 2670 | if test "$suppress_opt" = yes; then |
| 2671 | suppress_output=' >/dev/null 2>&1' |
| 2672 | fi |
| 2673 | fi |
| 2674 | |
| 2675 | # Only build a position-dependent object if we build old libraries. |
| 2676 | if test "$build_old_libs" = yes; then |
| 2677 | if test "$pic_mode" != yes; then |
| 2678 | # Don't build PIC code |
| 2679 | command="$base_compile $qsrcfile$pie_flag" |
| 2680 | else |
| 2681 | command="$base_compile $qsrcfile $pic_flag" |
| 2682 | fi |
| 2683 | if test "$compiler_c_o" = yes; then |
cristy | da16f16 | 2011-02-19 23:52:17 +0000 | [diff] [blame] | 2684 | command+=" -o $obj" |
cristy | 3ed852e | 2009-09-05 21:47:34 +0000 | [diff] [blame] | 2685 | fi |
| 2686 | |
| 2687 | # Suppress compiler output if we already did a PIC compilation. |
cristy | da16f16 | 2011-02-19 23:52:17 +0000 | [diff] [blame] | 2688 | command+="$suppress_output" |
cristy | 3ed852e | 2009-09-05 21:47:34 +0000 | [diff] [blame] | 2689 | func_show_eval_locale "$command" \ |
| 2690 | '$opt_dry_run || $RM $removelist; exit $EXIT_FAILURE' |
| 2691 | |
| 2692 | if test "$need_locks" = warn && |
| 2693 | test "X`cat $lockfile 2>/dev/null`" != "X$srcfile"; then |
| 2694 | $ECHO "\ |
| 2695 | *** ERROR, $lockfile contains: |
| 2696 | `cat $lockfile 2>/dev/null` |
| 2697 | |
| 2698 | but it should contain: |
| 2699 | $srcfile |
| 2700 | |
| 2701 | This indicates that another process is trying to use the same |
| 2702 | temporary object file, and libtool could not work around it because |
| 2703 | your compiler does not support \`-c' and \`-o' together. If you |
| 2704 | repeat this compilation, it may succeed, by chance, but you had better |
| 2705 | avoid parallel builds (make -j) in this platform, or get a better |
| 2706 | compiler." |
| 2707 | |
| 2708 | $opt_dry_run || $RM $removelist |
| 2709 | exit $EXIT_FAILURE |
| 2710 | fi |
| 2711 | |
| 2712 | # Just move the object if needed |
| 2713 | if test -n "$output_obj" && test "X$output_obj" != "X$obj"; then |
| 2714 | func_show_eval '$MV "$output_obj" "$obj"' \ |
| 2715 | 'error=$?; $opt_dry_run || $RM $removelist; exit $error' |
| 2716 | fi |
| 2717 | fi |
| 2718 | |
| 2719 | $opt_dry_run || { |
| 2720 | func_write_libtool_object "$libobj" "$objdir/$objname" "$objname" |
| 2721 | |
| 2722 | # Unlock the critical section if it was locked |
| 2723 | if test "$need_locks" != no; then |
| 2724 | removelist=$lockfile |
| 2725 | $RM "$lockfile" |
| 2726 | fi |
| 2727 | } |
| 2728 | |
| 2729 | exit $EXIT_SUCCESS |
| 2730 | } |
| 2731 | |
| 2732 | $opt_help || { |
cristy | da16f16 | 2011-02-19 23:52:17 +0000 | [diff] [blame] | 2733 | test "$opt_mode" = compile && func_mode_compile ${1+"$@"} |
cristy | 3ed852e | 2009-09-05 21:47:34 +0000 | [diff] [blame] | 2734 | } |
| 2735 | |
| 2736 | func_mode_help () |
| 2737 | { |
| 2738 | # We need to display help for each of the modes. |
cristy | da16f16 | 2011-02-19 23:52:17 +0000 | [diff] [blame] | 2739 | case $opt_mode in |
cristy | 3ed852e | 2009-09-05 21:47:34 +0000 | [diff] [blame] | 2740 | "") |
| 2741 | # Generic help is extracted from the usage comments |
| 2742 | # at the start of this file. |
| 2743 | func_help |
| 2744 | ;; |
| 2745 | |
| 2746 | clean) |
| 2747 | $ECHO \ |
| 2748 | "Usage: $progname [OPTION]... --mode=clean RM [RM-OPTION]... FILE... |
| 2749 | |
| 2750 | Remove files from the build directory. |
| 2751 | |
| 2752 | RM is the name of the program to use to delete files associated with each FILE |
| 2753 | (typically \`/bin/rm'). RM-OPTIONS are options (such as \`-f') to be passed |
| 2754 | to RM. |
| 2755 | |
| 2756 | If FILE is a libtool library, object or program, all the files associated |
| 2757 | with it are deleted. Otherwise, only FILE itself is deleted using RM." |
| 2758 | ;; |
| 2759 | |
| 2760 | compile) |
| 2761 | $ECHO \ |
| 2762 | "Usage: $progname [OPTION]... --mode=compile COMPILE-COMMAND... SOURCEFILE |
| 2763 | |
| 2764 | Compile a source file into a libtool library object. |
| 2765 | |
| 2766 | This mode accepts the following additional options: |
| 2767 | |
| 2768 | -o OUTPUT-FILE set the output file name to OUTPUT-FILE |
| 2769 | -no-suppress do not suppress compiler output for multiple passes |
cristy | 98dddb5 | 2010-11-04 00:30:15 +0000 | [diff] [blame] | 2770 | -prefer-pic try to build PIC objects only |
| 2771 | -prefer-non-pic try to build non-PIC objects only |
cristy | 3ed852e | 2009-09-05 21:47:34 +0000 | [diff] [blame] | 2772 | -shared do not build a \`.o' file suitable for static linking |
| 2773 | -static only build a \`.o' file suitable for static linking |
cristy | 98dddb5 | 2010-11-04 00:30:15 +0000 | [diff] [blame] | 2774 | -Wc,FLAG pass FLAG directly to the compiler |
cristy | 3ed852e | 2009-09-05 21:47:34 +0000 | [diff] [blame] | 2775 | |
| 2776 | COMPILE-COMMAND is a command to be used in creating a \`standard' object file |
| 2777 | from the given SOURCEFILE. |
| 2778 | |
| 2779 | The output file name is determined by removing the directory component from |
| 2780 | SOURCEFILE, then substituting the C source code suffix \`.c' with the |
| 2781 | library object suffix, \`.lo'." |
| 2782 | ;; |
| 2783 | |
| 2784 | execute) |
| 2785 | $ECHO \ |
| 2786 | "Usage: $progname [OPTION]... --mode=execute COMMAND [ARGS]... |
| 2787 | |
| 2788 | Automatically set library path, then run a program. |
| 2789 | |
| 2790 | This mode accepts the following additional options: |
| 2791 | |
| 2792 | -dlopen FILE add the directory containing FILE to the library path |
| 2793 | |
| 2794 | This mode sets the library path environment variable according to \`-dlopen' |
| 2795 | flags. |
| 2796 | |
| 2797 | If any of the ARGS are libtool executable wrappers, then they are translated |
| 2798 | into their corresponding uninstalled binary, and any of their required library |
| 2799 | directories are added to the library path. |
| 2800 | |
| 2801 | Then, COMMAND is executed, with ARGS as arguments." |
| 2802 | ;; |
| 2803 | |
| 2804 | finish) |
| 2805 | $ECHO \ |
| 2806 | "Usage: $progname [OPTION]... --mode=finish [LIBDIR]... |
| 2807 | |
| 2808 | Complete the installation of libtool libraries. |
| 2809 | |
| 2810 | Each LIBDIR is a directory that contains libtool libraries. |
| 2811 | |
| 2812 | The commands that this mode executes may require superuser privileges. Use |
| 2813 | the \`--dry-run' option if you just want to see what would be executed." |
| 2814 | ;; |
| 2815 | |
| 2816 | install) |
| 2817 | $ECHO \ |
| 2818 | "Usage: $progname [OPTION]... --mode=install INSTALL-COMMAND... |
| 2819 | |
| 2820 | Install executables or libraries. |
| 2821 | |
| 2822 | INSTALL-COMMAND is the installation command. The first component should be |
| 2823 | either the \`install' or \`cp' program. |
| 2824 | |
| 2825 | The following components of INSTALL-COMMAND are treated specially: |
| 2826 | |
cristy | 98dddb5 | 2010-11-04 00:30:15 +0000 | [diff] [blame] | 2827 | -inst-prefix-dir PREFIX-DIR Use PREFIX-DIR as a staging area for installation |
cristy | 3ed852e | 2009-09-05 21:47:34 +0000 | [diff] [blame] | 2828 | |
| 2829 | The rest of the components are interpreted as arguments to that command (only |
| 2830 | BSD-compatible install options are recognized)." |
| 2831 | ;; |
| 2832 | |
| 2833 | link) |
| 2834 | $ECHO \ |
| 2835 | "Usage: $progname [OPTION]... --mode=link LINK-COMMAND... |
| 2836 | |
| 2837 | Link object files or libraries together to form another library, or to |
| 2838 | create an executable program. |
| 2839 | |
| 2840 | LINK-COMMAND is a command using the C compiler that you would use to create |
| 2841 | a program from several object files. |
| 2842 | |
| 2843 | The following components of LINK-COMMAND are treated specially: |
| 2844 | |
| 2845 | -all-static do not do any dynamic linking at all |
| 2846 | -avoid-version do not add a version suffix if possible |
cristy | 98dddb5 | 2010-11-04 00:30:15 +0000 | [diff] [blame] | 2847 | -bindir BINDIR specify path to binaries directory (for systems where |
| 2848 | libraries must be found in the PATH setting at runtime) |
cristy | 3ed852e | 2009-09-05 21:47:34 +0000 | [diff] [blame] | 2849 | -dlopen FILE \`-dlpreopen' FILE if it cannot be dlopened at runtime |
| 2850 | -dlpreopen FILE link in FILE and add its symbols to lt_preloaded_symbols |
| 2851 | -export-dynamic allow symbols from OUTPUT-FILE to be resolved with dlsym(3) |
| 2852 | -export-symbols SYMFILE |
| 2853 | try to export only the symbols listed in SYMFILE |
| 2854 | -export-symbols-regex REGEX |
| 2855 | try to export only the symbols matching REGEX |
| 2856 | -LLIBDIR search LIBDIR for required installed libraries |
| 2857 | -lNAME OUTPUT-FILE requires the installed library libNAME |
| 2858 | -module build a library that can dlopened |
| 2859 | -no-fast-install disable the fast-install mode |
| 2860 | -no-install link a not-installable executable |
| 2861 | -no-undefined declare that a library does not refer to external symbols |
| 2862 | -o OUTPUT-FILE create OUTPUT-FILE from the specified objects |
| 2863 | -objectlist FILE Use a list of object files found in FILE to specify objects |
| 2864 | -precious-files-regex REGEX |
| 2865 | don't remove output files matching REGEX |
| 2866 | -release RELEASE specify package release information |
| 2867 | -rpath LIBDIR the created library will eventually be installed in LIBDIR |
| 2868 | -R[ ]LIBDIR add LIBDIR to the runtime path of programs and libraries |
| 2869 | -shared only do dynamic linking of libtool libraries |
| 2870 | -shrext SUFFIX override the standard shared library file extension |
| 2871 | -static do not do any dynamic linking of uninstalled libtool libraries |
| 2872 | -static-libtool-libs |
| 2873 | do not do any dynamic linking of libtool libraries |
| 2874 | -version-info CURRENT[:REVISION[:AGE]] |
| 2875 | specify library version info [each variable defaults to 0] |
| 2876 | -weak LIBNAME declare that the target provides the LIBNAME interface |
cristy | 98dddb5 | 2010-11-04 00:30:15 +0000 | [diff] [blame] | 2877 | -Wc,FLAG |
| 2878 | -Xcompiler FLAG pass linker-specific FLAG directly to the compiler |
| 2879 | -Wl,FLAG |
| 2880 | -Xlinker FLAG pass linker-specific FLAG directly to the linker |
| 2881 | -XCClinker FLAG pass link-specific FLAG to the compiler driver (CC) |
cristy | 3ed852e | 2009-09-05 21:47:34 +0000 | [diff] [blame] | 2882 | |
| 2883 | All other options (arguments beginning with \`-') are ignored. |
| 2884 | |
| 2885 | Every other argument is treated as a filename. Files ending in \`.la' are |
| 2886 | treated as uninstalled libtool libraries, other files are standard or library |
| 2887 | object files. |
| 2888 | |
| 2889 | If the OUTPUT-FILE ends in \`.la', then a libtool library is created, |
| 2890 | only library objects (\`.lo' files) may be specified, and \`-rpath' is |
| 2891 | required, except when creating a convenience library. |
| 2892 | |
| 2893 | If OUTPUT-FILE ends in \`.a' or \`.lib', then a standard library is created |
| 2894 | using \`ar' and \`ranlib', or on Windows using \`lib'. |
| 2895 | |
| 2896 | If OUTPUT-FILE ends in \`.lo' or \`.${objext}', then a reloadable object file |
| 2897 | is created, otherwise an executable program is created." |
| 2898 | ;; |
| 2899 | |
| 2900 | uninstall) |
| 2901 | $ECHO \ |
| 2902 | "Usage: $progname [OPTION]... --mode=uninstall RM [RM-OPTION]... FILE... |
| 2903 | |
| 2904 | Remove libraries from an installation directory. |
| 2905 | |
| 2906 | RM is the name of the program to use to delete files associated with each FILE |
| 2907 | (typically \`/bin/rm'). RM-OPTIONS are options (such as \`-f') to be passed |
| 2908 | to RM. |
| 2909 | |
| 2910 | If FILE is a libtool library, all the files associated with it are deleted. |
| 2911 | Otherwise, only FILE itself is deleted using RM." |
| 2912 | ;; |
| 2913 | |
| 2914 | *) |
cristy | da16f16 | 2011-02-19 23:52:17 +0000 | [diff] [blame] | 2915 | func_fatal_help "invalid operation mode \`$opt_mode'" |
cristy | 3ed852e | 2009-09-05 21:47:34 +0000 | [diff] [blame] | 2916 | ;; |
| 2917 | esac |
| 2918 | |
cristy | 98dddb5 | 2010-11-04 00:30:15 +0000 | [diff] [blame] | 2919 | echo |
cristy | 3ed852e | 2009-09-05 21:47:34 +0000 | [diff] [blame] | 2920 | $ECHO "Try \`$progname --help' for more information about other modes." |
cristy | 3ed852e | 2009-09-05 21:47:34 +0000 | [diff] [blame] | 2921 | } |
| 2922 | |
cristy | 98dddb5 | 2010-11-04 00:30:15 +0000 | [diff] [blame] | 2923 | # Now that we've collected a possible --mode arg, show help if necessary |
| 2924 | if $opt_help; then |
| 2925 | if test "$opt_help" = :; then |
| 2926 | func_mode_help |
| 2927 | else |
| 2928 | { |
| 2929 | func_help noexit |
cristy | da16f16 | 2011-02-19 23:52:17 +0000 | [diff] [blame] | 2930 | for opt_mode in compile link execute install finish uninstall clean; do |
cristy | 98dddb5 | 2010-11-04 00:30:15 +0000 | [diff] [blame] | 2931 | func_mode_help |
| 2932 | done |
| 2933 | } | sed -n '1p; 2,$s/^Usage:/ or: /p' |
| 2934 | { |
| 2935 | func_help noexit |
cristy | da16f16 | 2011-02-19 23:52:17 +0000 | [diff] [blame] | 2936 | for opt_mode in compile link execute install finish uninstall clean; do |
cristy | 98dddb5 | 2010-11-04 00:30:15 +0000 | [diff] [blame] | 2937 | echo |
| 2938 | func_mode_help |
| 2939 | done |
| 2940 | } | |
| 2941 | sed '1d |
| 2942 | /^When reporting/,/^Report/{ |
| 2943 | H |
| 2944 | d |
| 2945 | } |
| 2946 | $x |
| 2947 | /information about other modes/d |
| 2948 | /more detailed .*MODE/d |
| 2949 | s/^Usage:.*--mode=\([^ ]*\) .*/Description of \1 mode:/' |
| 2950 | fi |
| 2951 | exit $? |
| 2952 | fi |
cristy | 3ed852e | 2009-09-05 21:47:34 +0000 | [diff] [blame] | 2953 | |
| 2954 | |
| 2955 | # func_mode_execute arg... |
| 2956 | func_mode_execute () |
| 2957 | { |
| 2958 | $opt_debug |
| 2959 | # The first argument is the command name. |
| 2960 | cmd="$nonopt" |
| 2961 | test -z "$cmd" && \ |
| 2962 | func_fatal_help "you must specify a COMMAND" |
| 2963 | |
| 2964 | # Handle -dlopen flags immediately. |
cristy | da16f16 | 2011-02-19 23:52:17 +0000 | [diff] [blame] | 2965 | for file in $opt_dlopen; do |
cristy | 3ed852e | 2009-09-05 21:47:34 +0000 | [diff] [blame] | 2966 | test -f "$file" \ |
| 2967 | || func_fatal_help "\`$file' is not a file" |
| 2968 | |
| 2969 | dir= |
| 2970 | case $file in |
| 2971 | *.la) |
cristy | da16f16 | 2011-02-19 23:52:17 +0000 | [diff] [blame] | 2972 | func_resolve_sysroot "$file" |
| 2973 | file=$func_resolve_sysroot_result |
| 2974 | |
cristy | 3ed852e | 2009-09-05 21:47:34 +0000 | [diff] [blame] | 2975 | # Check to see that this really is a libtool archive. |
| 2976 | func_lalib_unsafe_p "$file" \ |
| 2977 | || func_fatal_help "\`$lib' is not a valid libtool archive" |
| 2978 | |
| 2979 | # Read the libtool library. |
| 2980 | dlname= |
| 2981 | library_names= |
| 2982 | func_source "$file" |
| 2983 | |
| 2984 | # Skip this library if it cannot be dlopened. |
| 2985 | if test -z "$dlname"; then |
| 2986 | # Warn if it was a shared library. |
| 2987 | test -n "$library_names" && \ |
| 2988 | func_warning "\`$file' was not linked with \`-export-dynamic'" |
| 2989 | continue |
| 2990 | fi |
| 2991 | |
| 2992 | func_dirname "$file" "" "." |
| 2993 | dir="$func_dirname_result" |
| 2994 | |
| 2995 | if test -f "$dir/$objdir/$dlname"; then |
cristy | da16f16 | 2011-02-19 23:52:17 +0000 | [diff] [blame] | 2996 | dir+="/$objdir" |
cristy | 3ed852e | 2009-09-05 21:47:34 +0000 | [diff] [blame] | 2997 | else |
| 2998 | if test ! -f "$dir/$dlname"; then |
| 2999 | func_fatal_error "cannot find \`$dlname' in \`$dir' or \`$dir/$objdir'" |
| 3000 | fi |
| 3001 | fi |
| 3002 | ;; |
| 3003 | |
| 3004 | *.lo) |
| 3005 | # Just add the directory containing the .lo file. |
| 3006 | func_dirname "$file" "" "." |
| 3007 | dir="$func_dirname_result" |
| 3008 | ;; |
| 3009 | |
| 3010 | *) |
| 3011 | func_warning "\`-dlopen' is ignored for non-libtool libraries and objects" |
| 3012 | continue |
| 3013 | ;; |
| 3014 | esac |
| 3015 | |
| 3016 | # Get the absolute pathname. |
| 3017 | absdir=`cd "$dir" && pwd` |
| 3018 | test -n "$absdir" && dir="$absdir" |
| 3019 | |
| 3020 | # Now add the directory to shlibpath_var. |
| 3021 | if eval "test -z \"\$$shlibpath_var\""; then |
| 3022 | eval "$shlibpath_var=\"\$dir\"" |
| 3023 | else |
| 3024 | eval "$shlibpath_var=\"\$dir:\$$shlibpath_var\"" |
| 3025 | fi |
| 3026 | done |
| 3027 | |
| 3028 | # This variable tells wrapper scripts just to set shlibpath_var |
| 3029 | # rather than running their programs. |
| 3030 | libtool_execute_magic="$magic" |
| 3031 | |
| 3032 | # Check if any of the arguments is a wrapper script. |
| 3033 | args= |
| 3034 | for file |
| 3035 | do |
| 3036 | case $file in |
cristy | 98dddb5 | 2010-11-04 00:30:15 +0000 | [diff] [blame] | 3037 | -* | *.la | *.lo ) ;; |
cristy | 3ed852e | 2009-09-05 21:47:34 +0000 | [diff] [blame] | 3038 | *) |
| 3039 | # Do a test to see if this is really a libtool program. |
| 3040 | if func_ltwrapper_script_p "$file"; then |
| 3041 | func_source "$file" |
| 3042 | # Transform arg to wrapped name. |
| 3043 | file="$progdir/$program" |
| 3044 | elif func_ltwrapper_executable_p "$file"; then |
| 3045 | func_ltwrapper_scriptname "$file" |
| 3046 | func_source "$func_ltwrapper_scriptname_result" |
| 3047 | # Transform arg to wrapped name. |
| 3048 | file="$progdir/$program" |
| 3049 | fi |
| 3050 | ;; |
| 3051 | esac |
| 3052 | # Quote arguments (to preserve shell metacharacters). |
cristy | da16f16 | 2011-02-19 23:52:17 +0000 | [diff] [blame] | 3053 | func_append_quoted args "$file" |
cristy | 3ed852e | 2009-09-05 21:47:34 +0000 | [diff] [blame] | 3054 | done |
| 3055 | |
| 3056 | if test "X$opt_dry_run" = Xfalse; then |
| 3057 | if test -n "$shlibpath_var"; then |
| 3058 | # Export the shlibpath_var. |
| 3059 | eval "export $shlibpath_var" |
| 3060 | fi |
| 3061 | |
| 3062 | # Restore saved environment variables |
| 3063 | for lt_var in LANG LANGUAGE LC_ALL LC_CTYPE LC_COLLATE LC_MESSAGES |
| 3064 | do |
| 3065 | eval "if test \"\${save_$lt_var+set}\" = set; then |
| 3066 | $lt_var=\$save_$lt_var; export $lt_var |
| 3067 | else |
| 3068 | $lt_unset $lt_var |
| 3069 | fi" |
| 3070 | done |
| 3071 | |
| 3072 | # Now prepare to actually exec the command. |
| 3073 | exec_cmd="\$cmd$args" |
| 3074 | else |
| 3075 | # Display what would be done. |
| 3076 | if test -n "$shlibpath_var"; then |
| 3077 | eval "\$ECHO \"\$shlibpath_var=\$$shlibpath_var\"" |
cristy | 98dddb5 | 2010-11-04 00:30:15 +0000 | [diff] [blame] | 3078 | echo "export $shlibpath_var" |
cristy | 3ed852e | 2009-09-05 21:47:34 +0000 | [diff] [blame] | 3079 | fi |
| 3080 | $ECHO "$cmd$args" |
| 3081 | exit $EXIT_SUCCESS |
| 3082 | fi |
| 3083 | } |
| 3084 | |
cristy | da16f16 | 2011-02-19 23:52:17 +0000 | [diff] [blame] | 3085 | test "$opt_mode" = execute && func_mode_execute ${1+"$@"} |
cristy | 3ed852e | 2009-09-05 21:47:34 +0000 | [diff] [blame] | 3086 | |
| 3087 | |
| 3088 | # func_mode_finish arg... |
| 3089 | func_mode_finish () |
| 3090 | { |
| 3091 | $opt_debug |
cristy | da16f16 | 2011-02-19 23:52:17 +0000 | [diff] [blame] | 3092 | libs= |
| 3093 | libdirs= |
cristy | 3ed852e | 2009-09-05 21:47:34 +0000 | [diff] [blame] | 3094 | admincmds= |
| 3095 | |
cristy | da16f16 | 2011-02-19 23:52:17 +0000 | [diff] [blame] | 3096 | for opt in "$nonopt" ${1+"$@"} |
| 3097 | do |
| 3098 | if test -d "$opt"; then |
| 3099 | libdirs+=" $opt" |
cristy | 3ed852e | 2009-09-05 21:47:34 +0000 | [diff] [blame] | 3100 | |
cristy | da16f16 | 2011-02-19 23:52:17 +0000 | [diff] [blame] | 3101 | elif test -f "$opt"; then |
| 3102 | if func_lalib_unsafe_p "$opt"; then |
| 3103 | libs+=" $opt" |
| 3104 | else |
| 3105 | func_warning "\`$opt' is not a valid libtool archive" |
| 3106 | fi |
| 3107 | |
| 3108 | else |
| 3109 | func_fatal_error "invalid argument \`$opt'" |
| 3110 | fi |
| 3111 | done |
| 3112 | |
| 3113 | if test -n "$libs"; then |
| 3114 | if test -n "$lt_sysroot"; then |
| 3115 | sysroot_regex=`$ECHO "$lt_sysroot" | $SED "$sed_make_literal_regex"` |
| 3116 | sysroot_cmd="s/\([ ']\)$sysroot_regex/\1/g;" |
| 3117 | else |
| 3118 | sysroot_cmd= |
| 3119 | fi |
| 3120 | |
| 3121 | # Remove sysroot references |
| 3122 | if $opt_dry_run; then |
| 3123 | for lib in $libs; do |
| 3124 | echo "removing references to $lt_sysroot and \`=' prefixes from $lib" |
| 3125 | done |
| 3126 | else |
| 3127 | tmpdir=`func_mktempdir` |
| 3128 | for lib in $libs; do |
| 3129 | sed -e "${sysroot_cmd} s/\([ ']-[LR]\)=/\1/g; s/\([ ']\)=/\1/g" $lib \ |
| 3130 | > $tmpdir/tmp-la |
| 3131 | mv -f $tmpdir/tmp-la $lib |
| 3132 | done |
| 3133 | ${RM}r "$tmpdir" |
| 3134 | fi |
| 3135 | fi |
| 3136 | |
| 3137 | if test -n "$finish_cmds$finish_eval" && test -n "$libdirs"; then |
cristy | 3ed852e | 2009-09-05 21:47:34 +0000 | [diff] [blame] | 3138 | for libdir in $libdirs; do |
| 3139 | if test -n "$finish_cmds"; then |
| 3140 | # Do each command in the finish commands. |
| 3141 | func_execute_cmds "$finish_cmds" 'admincmds="$admincmds |
| 3142 | '"$cmd"'"' |
| 3143 | fi |
| 3144 | if test -n "$finish_eval"; then |
| 3145 | # Do the single finish_eval. |
| 3146 | eval cmds=\"$finish_eval\" |
cristy | da16f16 | 2011-02-19 23:52:17 +0000 | [diff] [blame] | 3147 | $opt_dry_run || eval "$cmds" || admincmds+=" |
cristy | 3ed852e | 2009-09-05 21:47:34 +0000 | [diff] [blame] | 3148 | $cmds" |
| 3149 | fi |
| 3150 | done |
| 3151 | fi |
| 3152 | |
| 3153 | # Exit here if they wanted silent mode. |
| 3154 | $opt_silent && exit $EXIT_SUCCESS |
| 3155 | |
cristy | da16f16 | 2011-02-19 23:52:17 +0000 | [diff] [blame] | 3156 | if test -n "$finish_cmds$finish_eval" && test -n "$libdirs"; then |
| 3157 | echo "----------------------------------------------------------------------" |
| 3158 | echo "Libraries have been installed in:" |
| 3159 | for libdir in $libdirs; do |
| 3160 | $ECHO " $libdir" |
| 3161 | done |
| 3162 | echo |
| 3163 | echo "If you ever happen to want to link against installed libraries" |
| 3164 | echo "in a given directory, LIBDIR, you must either use libtool, and" |
| 3165 | echo "specify the full pathname of the library, or use the \`-LLIBDIR'" |
| 3166 | echo "flag during linking and do at least one of the following:" |
| 3167 | if test -n "$shlibpath_var"; then |
| 3168 | echo " - add LIBDIR to the \`$shlibpath_var' environment variable" |
| 3169 | echo " during execution" |
| 3170 | fi |
| 3171 | if test -n "$runpath_var"; then |
| 3172 | echo " - add LIBDIR to the \`$runpath_var' environment variable" |
| 3173 | echo " during linking" |
| 3174 | fi |
| 3175 | if test -n "$hardcode_libdir_flag_spec"; then |
| 3176 | libdir=LIBDIR |
| 3177 | eval flag=\"$hardcode_libdir_flag_spec\" |
cristy | 3ed852e | 2009-09-05 21:47:34 +0000 | [diff] [blame] | 3178 | |
cristy | da16f16 | 2011-02-19 23:52:17 +0000 | [diff] [blame] | 3179 | $ECHO " - use the \`$flag' linker flag" |
| 3180 | fi |
| 3181 | if test -n "$admincmds"; then |
| 3182 | $ECHO " - have your system administrator run these commands:$admincmds" |
| 3183 | fi |
| 3184 | if test -f /etc/ld.so.conf; then |
| 3185 | echo " - have your system administrator add LIBDIR to \`/etc/ld.so.conf'" |
| 3186 | fi |
| 3187 | echo |
cristy | 3ed852e | 2009-09-05 21:47:34 +0000 | [diff] [blame] | 3188 | |
cristy | da16f16 | 2011-02-19 23:52:17 +0000 | [diff] [blame] | 3189 | echo "See any operating system documentation about shared libraries for" |
| 3190 | case $host in |
| 3191 | solaris2.[6789]|solaris2.1[0-9]) |
| 3192 | echo "more information, such as the ld(1), crle(1) and ld.so(8) manual" |
| 3193 | echo "pages." |
| 3194 | ;; |
| 3195 | *) |
| 3196 | echo "more information, such as the ld(1) and ld.so(8) manual pages." |
| 3197 | ;; |
| 3198 | esac |
| 3199 | echo "----------------------------------------------------------------------" |
| 3200 | fi |
cristy | 3ed852e | 2009-09-05 21:47:34 +0000 | [diff] [blame] | 3201 | exit $EXIT_SUCCESS |
| 3202 | } |
| 3203 | |
cristy | da16f16 | 2011-02-19 23:52:17 +0000 | [diff] [blame] | 3204 | test "$opt_mode" = finish && func_mode_finish ${1+"$@"} |
cristy | 3ed852e | 2009-09-05 21:47:34 +0000 | [diff] [blame] | 3205 | |
| 3206 | |
| 3207 | # func_mode_install arg... |
| 3208 | func_mode_install () |
| 3209 | { |
| 3210 | $opt_debug |
| 3211 | # There may be an optional sh(1) argument at the beginning of |
| 3212 | # install_prog (especially on Windows NT). |
| 3213 | if test "$nonopt" = "$SHELL" || test "$nonopt" = /bin/sh || |
| 3214 | # Allow the use of GNU shtool's install command. |
cristy | 98dddb5 | 2010-11-04 00:30:15 +0000 | [diff] [blame] | 3215 | case $nonopt in *shtool*) :;; *) false;; esac; then |
cristy | 3ed852e | 2009-09-05 21:47:34 +0000 | [diff] [blame] | 3216 | # Aesthetically quote it. |
| 3217 | func_quote_for_eval "$nonopt" |
| 3218 | install_prog="$func_quote_for_eval_result " |
| 3219 | arg=$1 |
| 3220 | shift |
| 3221 | else |
| 3222 | install_prog= |
| 3223 | arg=$nonopt |
| 3224 | fi |
| 3225 | |
| 3226 | # The real first argument should be the name of the installation program. |
| 3227 | # Aesthetically quote it. |
| 3228 | func_quote_for_eval "$arg" |
cristy | da16f16 | 2011-02-19 23:52:17 +0000 | [diff] [blame] | 3229 | install_prog+="$func_quote_for_eval_result" |
cristy | 98dddb5 | 2010-11-04 00:30:15 +0000 | [diff] [blame] | 3230 | install_shared_prog=$install_prog |
| 3231 | case " $install_prog " in |
| 3232 | *[\\\ /]cp\ *) install_cp=: ;; |
| 3233 | *) install_cp=false ;; |
| 3234 | esac |
cristy | 3ed852e | 2009-09-05 21:47:34 +0000 | [diff] [blame] | 3235 | |
| 3236 | # We need to accept at least all the BSD install flags. |
| 3237 | dest= |
| 3238 | files= |
| 3239 | opts= |
| 3240 | prev= |
| 3241 | install_type= |
| 3242 | isdir=no |
| 3243 | stripme= |
cristy | 98dddb5 | 2010-11-04 00:30:15 +0000 | [diff] [blame] | 3244 | no_mode=: |
cristy | 3ed852e | 2009-09-05 21:47:34 +0000 | [diff] [blame] | 3245 | for arg |
| 3246 | do |
cristy | 98dddb5 | 2010-11-04 00:30:15 +0000 | [diff] [blame] | 3247 | arg2= |
cristy | 3ed852e | 2009-09-05 21:47:34 +0000 | [diff] [blame] | 3248 | if test -n "$dest"; then |
cristy | da16f16 | 2011-02-19 23:52:17 +0000 | [diff] [blame] | 3249 | files+=" $dest" |
cristy | 3ed852e | 2009-09-05 21:47:34 +0000 | [diff] [blame] | 3250 | dest=$arg |
| 3251 | continue |
| 3252 | fi |
| 3253 | |
| 3254 | case $arg in |
| 3255 | -d) isdir=yes ;; |
| 3256 | -f) |
cristy | 98dddb5 | 2010-11-04 00:30:15 +0000 | [diff] [blame] | 3257 | if $install_cp; then :; else |
| 3258 | prev=$arg |
| 3259 | fi |
cristy | 3ed852e | 2009-09-05 21:47:34 +0000 | [diff] [blame] | 3260 | ;; |
| 3261 | -g | -m | -o) |
| 3262 | prev=$arg |
| 3263 | ;; |
| 3264 | -s) |
| 3265 | stripme=" -s" |
| 3266 | continue |
| 3267 | ;; |
| 3268 | -*) |
| 3269 | ;; |
| 3270 | *) |
| 3271 | # If the previous option needed an argument, then skip it. |
| 3272 | if test -n "$prev"; then |
cristy | 98dddb5 | 2010-11-04 00:30:15 +0000 | [diff] [blame] | 3273 | if test "x$prev" = x-m && test -n "$install_override_mode"; then |
| 3274 | arg2=$install_override_mode |
| 3275 | no_mode=false |
| 3276 | fi |
cristy | 3ed852e | 2009-09-05 21:47:34 +0000 | [diff] [blame] | 3277 | prev= |
| 3278 | else |
| 3279 | dest=$arg |
| 3280 | continue |
| 3281 | fi |
| 3282 | ;; |
| 3283 | esac |
| 3284 | |
| 3285 | # Aesthetically quote the argument. |
| 3286 | func_quote_for_eval "$arg" |
cristy | da16f16 | 2011-02-19 23:52:17 +0000 | [diff] [blame] | 3287 | install_prog+=" $func_quote_for_eval_result" |
cristy | 98dddb5 | 2010-11-04 00:30:15 +0000 | [diff] [blame] | 3288 | if test -n "$arg2"; then |
| 3289 | func_quote_for_eval "$arg2" |
| 3290 | fi |
cristy | da16f16 | 2011-02-19 23:52:17 +0000 | [diff] [blame] | 3291 | install_shared_prog+=" $func_quote_for_eval_result" |
cristy | 3ed852e | 2009-09-05 21:47:34 +0000 | [diff] [blame] | 3292 | done |
| 3293 | |
| 3294 | test -z "$install_prog" && \ |
| 3295 | func_fatal_help "you must specify an install program" |
| 3296 | |
| 3297 | test -n "$prev" && \ |
| 3298 | func_fatal_help "the \`$prev' option requires an argument" |
| 3299 | |
cristy | 98dddb5 | 2010-11-04 00:30:15 +0000 | [diff] [blame] | 3300 | if test -n "$install_override_mode" && $no_mode; then |
| 3301 | if $install_cp; then :; else |
| 3302 | func_quote_for_eval "$install_override_mode" |
cristy | da16f16 | 2011-02-19 23:52:17 +0000 | [diff] [blame] | 3303 | install_shared_prog+=" -m $func_quote_for_eval_result" |
cristy | 98dddb5 | 2010-11-04 00:30:15 +0000 | [diff] [blame] | 3304 | fi |
| 3305 | fi |
| 3306 | |
cristy | 3ed852e | 2009-09-05 21:47:34 +0000 | [diff] [blame] | 3307 | if test -z "$files"; then |
| 3308 | if test -z "$dest"; then |
| 3309 | func_fatal_help "no file or destination specified" |
| 3310 | else |
| 3311 | func_fatal_help "you must specify a destination" |
| 3312 | fi |
| 3313 | fi |
| 3314 | |
| 3315 | # Strip any trailing slash from the destination. |
| 3316 | func_stripname '' '/' "$dest" |
| 3317 | dest=$func_stripname_result |
| 3318 | |
| 3319 | # Check to see that the destination is a directory. |
| 3320 | test -d "$dest" && isdir=yes |
| 3321 | if test "$isdir" = yes; then |
| 3322 | destdir="$dest" |
| 3323 | destname= |
| 3324 | else |
| 3325 | func_dirname_and_basename "$dest" "" "." |
| 3326 | destdir="$func_dirname_result" |
| 3327 | destname="$func_basename_result" |
| 3328 | |
| 3329 | # Not a directory, so check to see that there is only one file specified. |
| 3330 | set dummy $files; shift |
| 3331 | test "$#" -gt 1 && \ |
| 3332 | func_fatal_help "\`$dest' is not a directory" |
| 3333 | fi |
| 3334 | case $destdir in |
| 3335 | [\\/]* | [A-Za-z]:[\\/]*) ;; |
| 3336 | *) |
| 3337 | for file in $files; do |
| 3338 | case $file in |
| 3339 | *.lo) ;; |
| 3340 | *) |
| 3341 | func_fatal_help "\`$destdir' must be an absolute directory name" |
| 3342 | ;; |
| 3343 | esac |
| 3344 | done |
| 3345 | ;; |
| 3346 | esac |
| 3347 | |
| 3348 | # This variable tells wrapper scripts just to set variables rather |
| 3349 | # than running their programs. |
| 3350 | libtool_install_magic="$magic" |
| 3351 | |
| 3352 | staticlibs= |
| 3353 | future_libdirs= |
| 3354 | current_libdirs= |
| 3355 | for file in $files; do |
| 3356 | |
| 3357 | # Do each installation. |
| 3358 | case $file in |
| 3359 | *.$libext) |
| 3360 | # Do the static libraries later. |
cristy | da16f16 | 2011-02-19 23:52:17 +0000 | [diff] [blame] | 3361 | staticlibs+=" $file" |
cristy | 3ed852e | 2009-09-05 21:47:34 +0000 | [diff] [blame] | 3362 | ;; |
| 3363 | |
| 3364 | *.la) |
cristy | da16f16 | 2011-02-19 23:52:17 +0000 | [diff] [blame] | 3365 | func_resolve_sysroot "$file" |
| 3366 | file=$func_resolve_sysroot_result |
| 3367 | |
cristy | 3ed852e | 2009-09-05 21:47:34 +0000 | [diff] [blame] | 3368 | # Check to see that this really is a libtool archive. |
| 3369 | func_lalib_unsafe_p "$file" \ |
| 3370 | || func_fatal_help "\`$file' is not a valid libtool archive" |
| 3371 | |
| 3372 | library_names= |
| 3373 | old_library= |
| 3374 | relink_command= |
| 3375 | func_source "$file" |
| 3376 | |
| 3377 | # Add the libdir to current_libdirs if it is the destination. |
| 3378 | if test "X$destdir" = "X$libdir"; then |
| 3379 | case "$current_libdirs " in |
| 3380 | *" $libdir "*) ;; |
cristy | da16f16 | 2011-02-19 23:52:17 +0000 | [diff] [blame] | 3381 | *) current_libdirs+=" $libdir" ;; |
cristy | 3ed852e | 2009-09-05 21:47:34 +0000 | [diff] [blame] | 3382 | esac |
| 3383 | else |
| 3384 | # Note the libdir as a future libdir. |
| 3385 | case "$future_libdirs " in |
| 3386 | *" $libdir "*) ;; |
cristy | da16f16 | 2011-02-19 23:52:17 +0000 | [diff] [blame] | 3387 | *) future_libdirs+=" $libdir" ;; |
cristy | 3ed852e | 2009-09-05 21:47:34 +0000 | [diff] [blame] | 3388 | esac |
| 3389 | fi |
| 3390 | |
| 3391 | func_dirname "$file" "/" "" |
| 3392 | dir="$func_dirname_result" |
cristy | da16f16 | 2011-02-19 23:52:17 +0000 | [diff] [blame] | 3393 | dir+="$objdir" |
cristy | 3ed852e | 2009-09-05 21:47:34 +0000 | [diff] [blame] | 3394 | |
| 3395 | if test -n "$relink_command"; then |
| 3396 | # Determine the prefix the user has applied to our future dir. |
cristy | 98dddb5 | 2010-11-04 00:30:15 +0000 | [diff] [blame] | 3397 | inst_prefix_dir=`$ECHO "$destdir" | $SED -e "s%$libdir\$%%"` |
cristy | 3ed852e | 2009-09-05 21:47:34 +0000 | [diff] [blame] | 3398 | |
| 3399 | # Don't allow the user to place us outside of our expected |
| 3400 | # location b/c this prevents finding dependent libraries that |
| 3401 | # are installed to the same prefix. |
| 3402 | # At present, this check doesn't affect windows .dll's that |
| 3403 | # are installed into $libdir/../bin (currently, that works fine) |
| 3404 | # but it's something to keep an eye on. |
| 3405 | test "$inst_prefix_dir" = "$destdir" && \ |
| 3406 | func_fatal_error "error: cannot install \`$file' to a directory not ending in $libdir" |
| 3407 | |
| 3408 | if test -n "$inst_prefix_dir"; then |
| 3409 | # Stick the inst_prefix_dir data into the link command. |
cristy | 98dddb5 | 2010-11-04 00:30:15 +0000 | [diff] [blame] | 3410 | relink_command=`$ECHO "$relink_command" | $SED "s%@inst_prefix_dir@%-inst-prefix-dir $inst_prefix_dir%"` |
cristy | 3ed852e | 2009-09-05 21:47:34 +0000 | [diff] [blame] | 3411 | else |
cristy | 98dddb5 | 2010-11-04 00:30:15 +0000 | [diff] [blame] | 3412 | relink_command=`$ECHO "$relink_command" | $SED "s%@inst_prefix_dir@%%"` |
cristy | 3ed852e | 2009-09-05 21:47:34 +0000 | [diff] [blame] | 3413 | fi |
| 3414 | |
| 3415 | func_warning "relinking \`$file'" |
| 3416 | func_show_eval "$relink_command" \ |
| 3417 | 'func_fatal_error "error: relink \`$file'\'' with the above command before installing it"' |
| 3418 | fi |
| 3419 | |
| 3420 | # See the names of the shared library. |
| 3421 | set dummy $library_names; shift |
| 3422 | if test -n "$1"; then |
| 3423 | realname="$1" |
| 3424 | shift |
| 3425 | |
| 3426 | srcname="$realname" |
| 3427 | test -n "$relink_command" && srcname="$realname"T |
| 3428 | |
| 3429 | # Install the shared library and build the symlinks. |
cristy | 98dddb5 | 2010-11-04 00:30:15 +0000 | [diff] [blame] | 3430 | func_show_eval "$install_shared_prog $dir/$srcname $destdir/$realname" \ |
cristy | 3ed852e | 2009-09-05 21:47:34 +0000 | [diff] [blame] | 3431 | 'exit $?' |
| 3432 | tstripme="$stripme" |
| 3433 | case $host_os in |
| 3434 | cygwin* | mingw* | pw32* | cegcc*) |
| 3435 | case $realname in |
| 3436 | *.dll.a) |
| 3437 | tstripme="" |
| 3438 | ;; |
| 3439 | esac |
| 3440 | ;; |
| 3441 | esac |
| 3442 | if test -n "$tstripme" && test -n "$striplib"; then |
| 3443 | func_show_eval "$striplib $destdir/$realname" 'exit $?' |
| 3444 | fi |
| 3445 | |
| 3446 | if test "$#" -gt 0; then |
| 3447 | # Delete the old symlinks, and create new ones. |
| 3448 | # Try `ln -sf' first, because the `ln' binary might depend on |
| 3449 | # the symlink we replace! Solaris /bin/ln does not understand -f, |
| 3450 | # so we also need to try rm && ln -s. |
| 3451 | for linkname |
| 3452 | do |
| 3453 | test "$linkname" != "$realname" \ |
| 3454 | && func_show_eval "(cd $destdir && { $LN_S -f $realname $linkname || { $RM $linkname && $LN_S $realname $linkname; }; })" |
| 3455 | done |
| 3456 | fi |
| 3457 | |
| 3458 | # Do each command in the postinstall commands. |
| 3459 | lib="$destdir/$realname" |
| 3460 | func_execute_cmds "$postinstall_cmds" 'exit $?' |
| 3461 | fi |
| 3462 | |
| 3463 | # Install the pseudo-library for information purposes. |
| 3464 | func_basename "$file" |
| 3465 | name="$func_basename_result" |
| 3466 | instname="$dir/$name"i |
| 3467 | func_show_eval "$install_prog $instname $destdir/$name" 'exit $?' |
| 3468 | |
| 3469 | # Maybe install the static library, too. |
cristy | da16f16 | 2011-02-19 23:52:17 +0000 | [diff] [blame] | 3470 | test -n "$old_library" && staticlibs+=" $dir/$old_library" |
cristy | 3ed852e | 2009-09-05 21:47:34 +0000 | [diff] [blame] | 3471 | ;; |
| 3472 | |
| 3473 | *.lo) |
| 3474 | # Install (i.e. copy) a libtool object. |
| 3475 | |
| 3476 | # Figure out destination file name, if it wasn't already specified. |
| 3477 | if test -n "$destname"; then |
| 3478 | destfile="$destdir/$destname" |
| 3479 | else |
| 3480 | func_basename "$file" |
| 3481 | destfile="$func_basename_result" |
| 3482 | destfile="$destdir/$destfile" |
| 3483 | fi |
| 3484 | |
| 3485 | # Deduce the name of the destination old-style object file. |
| 3486 | case $destfile in |
| 3487 | *.lo) |
| 3488 | func_lo2o "$destfile" |
| 3489 | staticdest=$func_lo2o_result |
| 3490 | ;; |
| 3491 | *.$objext) |
| 3492 | staticdest="$destfile" |
| 3493 | destfile= |
| 3494 | ;; |
| 3495 | *) |
| 3496 | func_fatal_help "cannot copy a libtool object to \`$destfile'" |
| 3497 | ;; |
| 3498 | esac |
| 3499 | |
| 3500 | # Install the libtool object if requested. |
| 3501 | test -n "$destfile" && \ |
| 3502 | func_show_eval "$install_prog $file $destfile" 'exit $?' |
| 3503 | |
| 3504 | # Install the old object if enabled. |
| 3505 | if test "$build_old_libs" = yes; then |
| 3506 | # Deduce the name of the old-style object file. |
| 3507 | func_lo2o "$file" |
| 3508 | staticobj=$func_lo2o_result |
| 3509 | func_show_eval "$install_prog \$staticobj \$staticdest" 'exit $?' |
| 3510 | fi |
| 3511 | exit $EXIT_SUCCESS |
| 3512 | ;; |
| 3513 | |
| 3514 | *) |
| 3515 | # Figure out destination file name, if it wasn't already specified. |
| 3516 | if test -n "$destname"; then |
| 3517 | destfile="$destdir/$destname" |
| 3518 | else |
| 3519 | func_basename "$file" |
| 3520 | destfile="$func_basename_result" |
| 3521 | destfile="$destdir/$destfile" |
| 3522 | fi |
| 3523 | |
| 3524 | # If the file is missing, and there is a .exe on the end, strip it |
| 3525 | # because it is most likely a libtool script we actually want to |
| 3526 | # install |
| 3527 | stripped_ext="" |
| 3528 | case $file in |
| 3529 | *.exe) |
| 3530 | if test ! -f "$file"; then |
| 3531 | func_stripname '' '.exe' "$file" |
| 3532 | file=$func_stripname_result |
| 3533 | stripped_ext=".exe" |
| 3534 | fi |
| 3535 | ;; |
| 3536 | esac |
| 3537 | |
| 3538 | # Do a test to see if this is really a libtool program. |
| 3539 | case $host in |
| 3540 | *cygwin* | *mingw*) |
| 3541 | if func_ltwrapper_executable_p "$file"; then |
| 3542 | func_ltwrapper_scriptname "$file" |
| 3543 | wrapper=$func_ltwrapper_scriptname_result |
| 3544 | else |
| 3545 | func_stripname '' '.exe' "$file" |
| 3546 | wrapper=$func_stripname_result |
| 3547 | fi |
| 3548 | ;; |
| 3549 | *) |
| 3550 | wrapper=$file |
| 3551 | ;; |
| 3552 | esac |
| 3553 | if func_ltwrapper_script_p "$wrapper"; then |
| 3554 | notinst_deplibs= |
| 3555 | relink_command= |
| 3556 | |
| 3557 | func_source "$wrapper" |
| 3558 | |
| 3559 | # Check the variables that should have been set. |
| 3560 | test -z "$generated_by_libtool_version" && \ |
| 3561 | func_fatal_error "invalid libtool wrapper script \`$wrapper'" |
| 3562 | |
| 3563 | finalize=yes |
| 3564 | for lib in $notinst_deplibs; do |
| 3565 | # Check to see that each library is installed. |
| 3566 | libdir= |
| 3567 | if test -f "$lib"; then |
| 3568 | func_source "$lib" |
| 3569 | fi |
cristy | 98dddb5 | 2010-11-04 00:30:15 +0000 | [diff] [blame] | 3570 | libfile="$libdir/"`$ECHO "$lib" | $SED 's%^.*/%%g'` ### testsuite: skip nested quoting test |
cristy | 3ed852e | 2009-09-05 21:47:34 +0000 | [diff] [blame] | 3571 | if test -n "$libdir" && test ! -f "$libfile"; then |
| 3572 | func_warning "\`$lib' has not been installed in \`$libdir'" |
| 3573 | finalize=no |
| 3574 | fi |
| 3575 | done |
| 3576 | |
| 3577 | relink_command= |
| 3578 | func_source "$wrapper" |
| 3579 | |
| 3580 | outputname= |
| 3581 | if test "$fast_install" = no && test -n "$relink_command"; then |
| 3582 | $opt_dry_run || { |
| 3583 | if test "$finalize" = yes; then |
| 3584 | tmpdir=`func_mktempdir` |
| 3585 | func_basename "$file$stripped_ext" |
| 3586 | file="$func_basename_result" |
| 3587 | outputname="$tmpdir/$file" |
| 3588 | # Replace the output file specification. |
cristy | 98dddb5 | 2010-11-04 00:30:15 +0000 | [diff] [blame] | 3589 | relink_command=`$ECHO "$relink_command" | $SED 's%@OUTPUT@%'"$outputname"'%g'` |
cristy | 3ed852e | 2009-09-05 21:47:34 +0000 | [diff] [blame] | 3590 | |
| 3591 | $opt_silent || { |
| 3592 | func_quote_for_expand "$relink_command" |
| 3593 | eval "func_echo $func_quote_for_expand_result" |
| 3594 | } |
| 3595 | if eval "$relink_command"; then : |
| 3596 | else |
| 3597 | func_error "error: relink \`$file' with the above command before installing it" |
| 3598 | $opt_dry_run || ${RM}r "$tmpdir" |
| 3599 | continue |
| 3600 | fi |
| 3601 | file="$outputname" |
| 3602 | else |
| 3603 | func_warning "cannot relink \`$file'" |
| 3604 | fi |
| 3605 | } |
| 3606 | else |
| 3607 | # Install the binary that we compiled earlier. |
cristy | 98dddb5 | 2010-11-04 00:30:15 +0000 | [diff] [blame] | 3608 | file=`$ECHO "$file$stripped_ext" | $SED "s%\([^/]*\)$%$objdir/\1%"` |
cristy | 3ed852e | 2009-09-05 21:47:34 +0000 | [diff] [blame] | 3609 | fi |
| 3610 | fi |
| 3611 | |
| 3612 | # remove .exe since cygwin /usr/bin/install will append another |
| 3613 | # one anyway |
| 3614 | case $install_prog,$host in |
| 3615 | */usr/bin/install*,*cygwin*) |
| 3616 | case $file:$destfile in |
| 3617 | *.exe:*.exe) |
| 3618 | # this is ok |
| 3619 | ;; |
| 3620 | *.exe:*) |
| 3621 | destfile=$destfile.exe |
| 3622 | ;; |
| 3623 | *:*.exe) |
| 3624 | func_stripname '' '.exe' "$destfile" |
| 3625 | destfile=$func_stripname_result |
| 3626 | ;; |
| 3627 | esac |
| 3628 | ;; |
| 3629 | esac |
| 3630 | func_show_eval "$install_prog\$stripme \$file \$destfile" 'exit $?' |
| 3631 | $opt_dry_run || if test -n "$outputname"; then |
| 3632 | ${RM}r "$tmpdir" |
| 3633 | fi |
| 3634 | ;; |
| 3635 | esac |
| 3636 | done |
| 3637 | |
| 3638 | for file in $staticlibs; do |
| 3639 | func_basename "$file" |
| 3640 | name="$func_basename_result" |
| 3641 | |
| 3642 | # Set up the ranlib parameters. |
| 3643 | oldlib="$destdir/$name" |
| 3644 | |
| 3645 | func_show_eval "$install_prog \$file \$oldlib" 'exit $?' |
| 3646 | |
| 3647 | if test -n "$stripme" && test -n "$old_striplib"; then |
| 3648 | func_show_eval "$old_striplib $oldlib" 'exit $?' |
| 3649 | fi |
| 3650 | |
| 3651 | # Do each command in the postinstall commands. |
| 3652 | func_execute_cmds "$old_postinstall_cmds" 'exit $?' |
| 3653 | done |
| 3654 | |
| 3655 | test -n "$future_libdirs" && \ |
| 3656 | func_warning "remember to run \`$progname --finish$future_libdirs'" |
| 3657 | |
| 3658 | if test -n "$current_libdirs"; then |
| 3659 | # Maybe just do a dry run. |
| 3660 | $opt_dry_run && current_libdirs=" -n$current_libdirs" |
| 3661 | exec_cmd='$SHELL $progpath $preserve_args --finish$current_libdirs' |
| 3662 | else |
| 3663 | exit $EXIT_SUCCESS |
| 3664 | fi |
| 3665 | } |
| 3666 | |
cristy | da16f16 | 2011-02-19 23:52:17 +0000 | [diff] [blame] | 3667 | test "$opt_mode" = install && func_mode_install ${1+"$@"} |
cristy | 3ed852e | 2009-09-05 21:47:34 +0000 | [diff] [blame] | 3668 | |
| 3669 | |
| 3670 | # func_generate_dlsyms outputname originator pic_p |
| 3671 | # Extract symbols from dlprefiles and create ${outputname}S.o with |
| 3672 | # a dlpreopen symbol table. |
| 3673 | func_generate_dlsyms () |
| 3674 | { |
| 3675 | $opt_debug |
| 3676 | my_outputname="$1" |
| 3677 | my_originator="$2" |
| 3678 | my_pic_p="${3-no}" |
| 3679 | my_prefix=`$ECHO "$my_originator" | sed 's%[^a-zA-Z0-9]%_%g'` |
| 3680 | my_dlsyms= |
| 3681 | |
| 3682 | if test -n "$dlfiles$dlprefiles" || test "$dlself" != no; then |
| 3683 | if test -n "$NM" && test -n "$global_symbol_pipe"; then |
| 3684 | my_dlsyms="${my_outputname}S.c" |
| 3685 | else |
| 3686 | func_error "not configured to extract global symbols from dlpreopened files" |
| 3687 | fi |
| 3688 | fi |
| 3689 | |
| 3690 | if test -n "$my_dlsyms"; then |
| 3691 | case $my_dlsyms in |
| 3692 | "") ;; |
| 3693 | *.c) |
| 3694 | # Discover the nlist of each of the dlfiles. |
| 3695 | nlist="$output_objdir/${my_outputname}.nm" |
| 3696 | |
| 3697 | func_show_eval "$RM $nlist ${nlist}S ${nlist}T" |
| 3698 | |
| 3699 | # Parse the name list into a source file. |
| 3700 | func_verbose "creating $output_objdir/$my_dlsyms" |
| 3701 | |
| 3702 | $opt_dry_run || $ECHO > "$output_objdir/$my_dlsyms" "\ |
| 3703 | /* $my_dlsyms - symbol resolution table for \`$my_outputname' dlsym emulation. */ |
| 3704 | /* Generated by $PROGRAM (GNU $PACKAGE$TIMESTAMP) $VERSION */ |
| 3705 | |
| 3706 | #ifdef __cplusplus |
| 3707 | extern \"C\" { |
| 3708 | #endif |
| 3709 | |
cristy | 98dddb5 | 2010-11-04 00:30:15 +0000 | [diff] [blame] | 3710 | #if defined(__GNUC__) && (((__GNUC__ == 4) && (__GNUC_MINOR__ >= 4)) || (__GNUC__ > 4)) |
| 3711 | #pragma GCC diagnostic ignored \"-Wstrict-prototypes\" |
| 3712 | #endif |
| 3713 | |
cristy | da16f16 | 2011-02-19 23:52:17 +0000 | [diff] [blame] | 3714 | /* Keep this code in sync between libtool.m4, ltmain, lt_system.h, and tests. */ |
| 3715 | #if defined(_WIN32) || defined(__CYGWIN__) || defined(_WIN32_WCE) |
| 3716 | /* DATA imports from DLLs on WIN32 con't be const, because runtime |
| 3717 | relocations are performed -- see ld's documentation on pseudo-relocs. */ |
| 3718 | # define LT_DLSYM_CONST |
| 3719 | #elif defined(__osf__) |
| 3720 | /* This system does not cope well with relocations in const data. */ |
| 3721 | # define LT_DLSYM_CONST |
| 3722 | #else |
| 3723 | # define LT_DLSYM_CONST const |
| 3724 | #endif |
| 3725 | |
cristy | 3ed852e | 2009-09-05 21:47:34 +0000 | [diff] [blame] | 3726 | /* External symbol declarations for the compiler. */\ |
| 3727 | " |
| 3728 | |
| 3729 | if test "$dlself" = yes; then |
| 3730 | func_verbose "generating symbol list for \`$output'" |
| 3731 | |
| 3732 | $opt_dry_run || echo ': @PROGRAM@ ' > "$nlist" |
| 3733 | |
| 3734 | # Add our own program objects to the symbol list. |
cristy | 98dddb5 | 2010-11-04 00:30:15 +0000 | [diff] [blame] | 3735 | progfiles=`$ECHO "$objs$old_deplibs" | $SP2NL | $SED "$lo2o" | $NL2SP` |
cristy | 3ed852e | 2009-09-05 21:47:34 +0000 | [diff] [blame] | 3736 | for progfile in $progfiles; do |
cristy | da16f16 | 2011-02-19 23:52:17 +0000 | [diff] [blame] | 3737 | func_to_tool_file "$progfile" func_convert_file_msys_to_w32 |
| 3738 | func_verbose "extracting global C symbols from \`$func_to_tool_file_result'" |
| 3739 | $opt_dry_run || eval "$NM $func_to_tool_file_result | $global_symbol_pipe >> '$nlist'" |
cristy | 3ed852e | 2009-09-05 21:47:34 +0000 | [diff] [blame] | 3740 | done |
| 3741 | |
| 3742 | if test -n "$exclude_expsyms"; then |
| 3743 | $opt_dry_run || { |
| 3744 | eval '$EGREP -v " ($exclude_expsyms)$" "$nlist" > "$nlist"T' |
| 3745 | eval '$MV "$nlist"T "$nlist"' |
| 3746 | } |
| 3747 | fi |
| 3748 | |
| 3749 | if test -n "$export_symbols_regex"; then |
| 3750 | $opt_dry_run || { |
| 3751 | eval '$EGREP -e "$export_symbols_regex" "$nlist" > "$nlist"T' |
| 3752 | eval '$MV "$nlist"T "$nlist"' |
| 3753 | } |
| 3754 | fi |
| 3755 | |
| 3756 | # Prepare the list of exported symbols |
| 3757 | if test -z "$export_symbols"; then |
| 3758 | export_symbols="$output_objdir/$outputname.exp" |
| 3759 | $opt_dry_run || { |
| 3760 | $RM $export_symbols |
| 3761 | eval "${SED} -n -e '/^: @PROGRAM@ $/d' -e 's/^.* \(.*\)$/\1/p' "'< "$nlist" > "$export_symbols"' |
| 3762 | case $host in |
| 3763 | *cygwin* | *mingw* | *cegcc* ) |
| 3764 | eval "echo EXPORTS "'> "$output_objdir/$outputname.def"' |
| 3765 | eval 'cat "$export_symbols" >> "$output_objdir/$outputname.def"' |
| 3766 | ;; |
| 3767 | esac |
| 3768 | } |
| 3769 | else |
| 3770 | $opt_dry_run || { |
| 3771 | eval "${SED} -e 's/\([].[*^$]\)/\\\\\1/g' -e 's/^/ /' -e 's/$/$/'"' < "$export_symbols" > "$output_objdir/$outputname.exp"' |
| 3772 | eval '$GREP -f "$output_objdir/$outputname.exp" < "$nlist" > "$nlist"T' |
| 3773 | eval '$MV "$nlist"T "$nlist"' |
| 3774 | case $host in |
cristy | 98dddb5 | 2010-11-04 00:30:15 +0000 | [diff] [blame] | 3775 | *cygwin* | *mingw* | *cegcc* ) |
cristy | 3ed852e | 2009-09-05 21:47:34 +0000 | [diff] [blame] | 3776 | eval "echo EXPORTS "'> "$output_objdir/$outputname.def"' |
| 3777 | eval 'cat "$nlist" >> "$output_objdir/$outputname.def"' |
| 3778 | ;; |
| 3779 | esac |
| 3780 | } |
| 3781 | fi |
| 3782 | fi |
| 3783 | |
| 3784 | for dlprefile in $dlprefiles; do |
| 3785 | func_verbose "extracting global C symbols from \`$dlprefile'" |
| 3786 | func_basename "$dlprefile" |
| 3787 | name="$func_basename_result" |
cristy | da16f16 | 2011-02-19 23:52:17 +0000 | [diff] [blame] | 3788 | case $host in |
| 3789 | *cygwin* | *mingw* | *cegcc* ) |
| 3790 | # if an import library, we need to obtain dlname |
| 3791 | if func_win32_import_lib_p "$dlprefile"; then |
| 3792 | func_tr_sh "$dlprefile" |
| 3793 | eval "curr_lafile=\$libfile_$func_tr_sh_result" |
| 3794 | dlprefile_dlbasename="" |
| 3795 | if test -n "$curr_lafile" && func_lalib_p "$curr_lafile"; then |
| 3796 | # Use subshell, to avoid clobbering current variable values |
| 3797 | dlprefile_dlname=`source "$curr_lafile" && echo "$dlname"` |
| 3798 | if test -n "$dlprefile_dlname" ; then |
| 3799 | func_basename "$dlprefile_dlname" |
| 3800 | dlprefile_dlbasename="$func_basename_result" |
| 3801 | else |
| 3802 | # no lafile. user explicitly requested -dlpreopen <import library>. |
| 3803 | $sharedlib_from_linklib_cmd "$dlprefile" |
| 3804 | dlprefile_dlbasename=$sharedlib_from_linklib_result |
| 3805 | fi |
| 3806 | fi |
| 3807 | $opt_dry_run || { |
| 3808 | if test -n "$dlprefile_dlbasename" ; then |
| 3809 | eval '$ECHO ": $dlprefile_dlbasename" >> "$nlist"' |
| 3810 | else |
| 3811 | func_warning "Could not compute DLL name from $name" |
| 3812 | eval '$ECHO ": $name " >> "$nlist"' |
| 3813 | fi |
| 3814 | func_to_tool_file "$dlprefile" func_convert_file_msys_to_w32 |
| 3815 | eval "$NM \"$func_to_tool_file_result\" 2>/dev/null | $global_symbol_pipe | |
| 3816 | $SED -e '/I __imp/d' -e 's/I __nm_/D /;s/_nm__//' >> '$nlist'" |
| 3817 | } |
| 3818 | else # not an import lib |
| 3819 | $opt_dry_run || { |
| 3820 | eval '$ECHO ": $name " >> "$nlist"' |
| 3821 | func_to_tool_file "$dlprefile" func_convert_file_msys_to_w32 |
| 3822 | eval "$NM \"$func_to_tool_file_result\" 2>/dev/null | $global_symbol_pipe >> '$nlist'" |
| 3823 | } |
| 3824 | fi |
| 3825 | ;; |
| 3826 | *) |
| 3827 | $opt_dry_run || { |
| 3828 | eval '$ECHO ": $name " >> "$nlist"' |
| 3829 | func_to_tool_file "$dlprefile" func_convert_file_msys_to_w32 |
| 3830 | eval "$NM \"$func_to_tool_file_result\" 2>/dev/null | $global_symbol_pipe >> '$nlist'" |
| 3831 | } |
| 3832 | ;; |
| 3833 | esac |
cristy | 3ed852e | 2009-09-05 21:47:34 +0000 | [diff] [blame] | 3834 | done |
| 3835 | |
| 3836 | $opt_dry_run || { |
| 3837 | # Make sure we have at least an empty file. |
| 3838 | test -f "$nlist" || : > "$nlist" |
| 3839 | |
| 3840 | if test -n "$exclude_expsyms"; then |
| 3841 | $EGREP -v " ($exclude_expsyms)$" "$nlist" > "$nlist"T |
| 3842 | $MV "$nlist"T "$nlist" |
| 3843 | fi |
| 3844 | |
| 3845 | # Try sorting and uniquifying the output. |
| 3846 | if $GREP -v "^: " < "$nlist" | |
| 3847 | if sort -k 3 </dev/null >/dev/null 2>&1; then |
| 3848 | sort -k 3 |
| 3849 | else |
| 3850 | sort +2 |
| 3851 | fi | |
| 3852 | uniq > "$nlist"S; then |
| 3853 | : |
| 3854 | else |
| 3855 | $GREP -v "^: " < "$nlist" > "$nlist"S |
| 3856 | fi |
| 3857 | |
| 3858 | if test -f "$nlist"S; then |
| 3859 | eval "$global_symbol_to_cdecl"' < "$nlist"S >> "$output_objdir/$my_dlsyms"' |
| 3860 | else |
cristy | 98dddb5 | 2010-11-04 00:30:15 +0000 | [diff] [blame] | 3861 | echo '/* NONE */' >> "$output_objdir/$my_dlsyms" |
cristy | 3ed852e | 2009-09-05 21:47:34 +0000 | [diff] [blame] | 3862 | fi |
| 3863 | |
cristy | 98dddb5 | 2010-11-04 00:30:15 +0000 | [diff] [blame] | 3864 | echo >> "$output_objdir/$my_dlsyms" "\ |
cristy | 3ed852e | 2009-09-05 21:47:34 +0000 | [diff] [blame] | 3865 | |
| 3866 | /* The mapping between symbol names and symbols. */ |
| 3867 | typedef struct { |
| 3868 | const char *name; |
| 3869 | void *address; |
| 3870 | } lt_dlsymlist; |
cristy | da16f16 | 2011-02-19 23:52:17 +0000 | [diff] [blame] | 3871 | extern LT_DLSYM_CONST lt_dlsymlist |
cristy | 3ed852e | 2009-09-05 21:47:34 +0000 | [diff] [blame] | 3872 | lt_${my_prefix}_LTX_preloaded_symbols[]; |
cristy | da16f16 | 2011-02-19 23:52:17 +0000 | [diff] [blame] | 3873 | LT_DLSYM_CONST lt_dlsymlist |
cristy | 3ed852e | 2009-09-05 21:47:34 +0000 | [diff] [blame] | 3874 | lt_${my_prefix}_LTX_preloaded_symbols[] = |
| 3875 | {\ |
| 3876 | { \"$my_originator\", (void *) 0 }," |
| 3877 | |
| 3878 | case $need_lib_prefix in |
| 3879 | no) |
| 3880 | eval "$global_symbol_to_c_name_address" < "$nlist" >> "$output_objdir/$my_dlsyms" |
| 3881 | ;; |
| 3882 | *) |
| 3883 | eval "$global_symbol_to_c_name_address_lib_prefix" < "$nlist" >> "$output_objdir/$my_dlsyms" |
| 3884 | ;; |
| 3885 | esac |
cristy | 98dddb5 | 2010-11-04 00:30:15 +0000 | [diff] [blame] | 3886 | echo >> "$output_objdir/$my_dlsyms" "\ |
cristy | 3ed852e | 2009-09-05 21:47:34 +0000 | [diff] [blame] | 3887 | {0, (void *) 0} |
| 3888 | }; |
| 3889 | |
| 3890 | /* This works around a problem in FreeBSD linker */ |
| 3891 | #ifdef FREEBSD_WORKAROUND |
| 3892 | static const void *lt_preloaded_setup() { |
| 3893 | return lt_${my_prefix}_LTX_preloaded_symbols; |
| 3894 | } |
| 3895 | #endif |
| 3896 | |
| 3897 | #ifdef __cplusplus |
| 3898 | } |
| 3899 | #endif\ |
| 3900 | " |
| 3901 | } # !$opt_dry_run |
| 3902 | |
| 3903 | pic_flag_for_symtable= |
| 3904 | case "$compile_command " in |
| 3905 | *" -static "*) ;; |
| 3906 | *) |
| 3907 | case $host in |
| 3908 | # compiling the symbol table file with pic_flag works around |
| 3909 | # a FreeBSD bug that causes programs to crash when -lm is |
| 3910 | # linked before any other PIC object. But we must not use |
| 3911 | # pic_flag when linking with -static. The problem exists in |
| 3912 | # FreeBSD 2.2.6 and is fixed in FreeBSD 3.1. |
| 3913 | *-*-freebsd2*|*-*-freebsd3.0*|*-*-freebsdelf3.0*) |
| 3914 | pic_flag_for_symtable=" $pic_flag -DFREEBSD_WORKAROUND" ;; |
| 3915 | *-*-hpux*) |
| 3916 | pic_flag_for_symtable=" $pic_flag" ;; |
| 3917 | *) |
| 3918 | if test "X$my_pic_p" != Xno; then |
| 3919 | pic_flag_for_symtable=" $pic_flag" |
| 3920 | fi |
| 3921 | ;; |
| 3922 | esac |
| 3923 | ;; |
| 3924 | esac |
| 3925 | symtab_cflags= |
| 3926 | for arg in $LTCFLAGS; do |
| 3927 | case $arg in |
| 3928 | -pie | -fpie | -fPIE) ;; |
cristy | da16f16 | 2011-02-19 23:52:17 +0000 | [diff] [blame] | 3929 | *) symtab_cflags+=" $arg" ;; |
cristy | 3ed852e | 2009-09-05 21:47:34 +0000 | [diff] [blame] | 3930 | esac |
| 3931 | done |
| 3932 | |
| 3933 | # Now compile the dynamic symbol file. |
| 3934 | func_show_eval '(cd $output_objdir && $LTCC$symtab_cflags -c$no_builtin_flag$pic_flag_for_symtable "$my_dlsyms")' 'exit $?' |
| 3935 | |
| 3936 | # Clean up the generated files. |
| 3937 | func_show_eval '$RM "$output_objdir/$my_dlsyms" "$nlist" "${nlist}S" "${nlist}T"' |
| 3938 | |
| 3939 | # Transform the symbol file into the correct name. |
| 3940 | symfileobj="$output_objdir/${my_outputname}S.$objext" |
| 3941 | case $host in |
| 3942 | *cygwin* | *mingw* | *cegcc* ) |
| 3943 | if test -f "$output_objdir/$my_outputname.def"; then |
cristy | 98dddb5 | 2010-11-04 00:30:15 +0000 | [diff] [blame] | 3944 | compile_command=`$ECHO "$compile_command" | $SED "s%@SYMFILE@%$output_objdir/$my_outputname.def $symfileobj%"` |
| 3945 | finalize_command=`$ECHO "$finalize_command" | $SED "s%@SYMFILE@%$output_objdir/$my_outputname.def $symfileobj%"` |
cristy | 3ed852e | 2009-09-05 21:47:34 +0000 | [diff] [blame] | 3946 | else |
cristy | 98dddb5 | 2010-11-04 00:30:15 +0000 | [diff] [blame] | 3947 | compile_command=`$ECHO "$compile_command" | $SED "s%@SYMFILE@%$symfileobj%"` |
| 3948 | finalize_command=`$ECHO "$finalize_command" | $SED "s%@SYMFILE@%$symfileobj%"` |
cristy | 3ed852e | 2009-09-05 21:47:34 +0000 | [diff] [blame] | 3949 | fi |
| 3950 | ;; |
| 3951 | *) |
cristy | 98dddb5 | 2010-11-04 00:30:15 +0000 | [diff] [blame] | 3952 | compile_command=`$ECHO "$compile_command" | $SED "s%@SYMFILE@%$symfileobj%"` |
| 3953 | finalize_command=`$ECHO "$finalize_command" | $SED "s%@SYMFILE@%$symfileobj%"` |
cristy | 3ed852e | 2009-09-05 21:47:34 +0000 | [diff] [blame] | 3954 | ;; |
| 3955 | esac |
| 3956 | ;; |
| 3957 | *) |
| 3958 | func_fatal_error "unknown suffix for \`$my_dlsyms'" |
| 3959 | ;; |
| 3960 | esac |
| 3961 | else |
| 3962 | # We keep going just in case the user didn't refer to |
| 3963 | # lt_preloaded_symbols. The linker will fail if global_symbol_pipe |
| 3964 | # really was required. |
| 3965 | |
| 3966 | # Nullify the symbol file. |
cristy | 98dddb5 | 2010-11-04 00:30:15 +0000 | [diff] [blame] | 3967 | compile_command=`$ECHO "$compile_command" | $SED "s% @SYMFILE@%%"` |
| 3968 | finalize_command=`$ECHO "$finalize_command" | $SED "s% @SYMFILE@%%"` |
cristy | 3ed852e | 2009-09-05 21:47:34 +0000 | [diff] [blame] | 3969 | fi |
| 3970 | } |
| 3971 | |
| 3972 | # func_win32_libid arg |
| 3973 | # return the library type of file 'arg' |
| 3974 | # |
| 3975 | # Need a lot of goo to handle *both* DLLs and import libs |
| 3976 | # Has to be a shell function in order to 'eat' the argument |
| 3977 | # that is supplied when $file_magic_command is called. |
cristy | 98dddb5 | 2010-11-04 00:30:15 +0000 | [diff] [blame] | 3978 | # Despite the name, also deal with 64 bit binaries. |
cristy | 3ed852e | 2009-09-05 21:47:34 +0000 | [diff] [blame] | 3979 | func_win32_libid () |
| 3980 | { |
| 3981 | $opt_debug |
| 3982 | win32_libid_type="unknown" |
| 3983 | win32_fileres=`file -L $1 2>/dev/null` |
| 3984 | case $win32_fileres in |
| 3985 | *ar\ archive\ import\ library*) # definitely import |
| 3986 | win32_libid_type="x86 archive import" |
| 3987 | ;; |
| 3988 | *ar\ archive*) # could be an import, or static |
cristy | 98dddb5 | 2010-11-04 00:30:15 +0000 | [diff] [blame] | 3989 | # Keep the egrep pattern in sync with the one in _LT_CHECK_MAGIC_METHOD. |
cristy | 3ed852e | 2009-09-05 21:47:34 +0000 | [diff] [blame] | 3990 | if eval $OBJDUMP -f $1 | $SED -e '10q' 2>/dev/null | |
cristy | 98dddb5 | 2010-11-04 00:30:15 +0000 | [diff] [blame] | 3991 | $EGREP 'file format (pei*-i386(.*architecture: i386)?|pe-arm-wince|pe-x86-64)' >/dev/null; then |
cristy | da16f16 | 2011-02-19 23:52:17 +0000 | [diff] [blame] | 3992 | func_to_tool_file "$1" func_convert_file_msys_to_w32 |
| 3993 | win32_nmres=`eval $NM -f posix -A \"$func_to_tool_file_result\" | |
cristy | 3ed852e | 2009-09-05 21:47:34 +0000 | [diff] [blame] | 3994 | $SED -n -e ' |
| 3995 | 1,100{ |
| 3996 | / I /{ |
| 3997 | s,.*,import, |
| 3998 | p |
| 3999 | q |
| 4000 | } |
| 4001 | }'` |
| 4002 | case $win32_nmres in |
| 4003 | import*) win32_libid_type="x86 archive import";; |
| 4004 | *) win32_libid_type="x86 archive static";; |
| 4005 | esac |
| 4006 | fi |
| 4007 | ;; |
| 4008 | *DLL*) |
| 4009 | win32_libid_type="x86 DLL" |
| 4010 | ;; |
| 4011 | *executable*) # but shell scripts are "executable" too... |
| 4012 | case $win32_fileres in |
| 4013 | *MS\ Windows\ PE\ Intel*) |
| 4014 | win32_libid_type="x86 DLL" |
| 4015 | ;; |
| 4016 | esac |
| 4017 | ;; |
| 4018 | esac |
| 4019 | $ECHO "$win32_libid_type" |
| 4020 | } |
| 4021 | |
cristy | da16f16 | 2011-02-19 23:52:17 +0000 | [diff] [blame] | 4022 | # func_cygming_dll_for_implib ARG |
| 4023 | # |
| 4024 | # Platform-specific function to extract the |
| 4025 | # name of the DLL associated with the specified |
| 4026 | # import library ARG. |
| 4027 | # Invoked by eval'ing the libtool variable |
| 4028 | # $sharedlib_from_linklib_cmd |
| 4029 | # Result is available in the variable |
| 4030 | # $sharedlib_from_linklib_result |
| 4031 | func_cygming_dll_for_implib () |
| 4032 | { |
| 4033 | $opt_debug |
| 4034 | sharedlib_from_linklib_result=`$DLLTOOL --identify-strict --identify "$1"` |
| 4035 | } |
| 4036 | |
| 4037 | # func_cygming_dll_for_implib_fallback_core SECTION_NAME LIBNAMEs |
| 4038 | # |
| 4039 | # The is the core of a fallback implementation of a |
| 4040 | # platform-specific function to extract the name of the |
| 4041 | # DLL associated with the specified import library LIBNAME. |
| 4042 | # |
| 4043 | # SECTION_NAME is either .idata$6 or .idata$7, depending |
| 4044 | # on the platform and compiler that created the implib. |
| 4045 | # |
| 4046 | # Echos the name of the DLL associated with the |
| 4047 | # specified import library. |
| 4048 | func_cygming_dll_for_implib_fallback_core () |
| 4049 | { |
| 4050 | $opt_debug |
| 4051 | match_literal=`$ECHO "$1" | $SED "$sed_make_literal_regex"` |
| 4052 | $OBJDUMP -s --section "$1" "$2" 2>/dev/null | |
| 4053 | $SED '/^Contents of section '"$match_literal"':/{ |
| 4054 | # Place marker at beginning of archive member dllname section |
| 4055 | s/.*/====MARK====/ |
| 4056 | p |
| 4057 | d |
| 4058 | } |
| 4059 | # These lines can sometimes be longer than 43 characters, but |
| 4060 | # are always uninteresting |
| 4061 | /:[ ]*file format pe[i]\{,1\}-/d |
| 4062 | /^In archive [^:]*:/d |
| 4063 | # Ensure marker is printed |
| 4064 | /^====MARK====/p |
| 4065 | # Remove all lines with less than 43 characters |
| 4066 | /^.\{43\}/!d |
| 4067 | # From remaining lines, remove first 43 characters |
| 4068 | s/^.\{43\}//' | |
| 4069 | $SED -n ' |
| 4070 | # Join marker and all lines until next marker into a single line |
| 4071 | /^====MARK====/ b para |
| 4072 | H |
| 4073 | $ b para |
| 4074 | b |
| 4075 | :para |
| 4076 | x |
| 4077 | s/\n//g |
| 4078 | # Remove the marker |
| 4079 | s/^====MARK====// |
| 4080 | # Remove trailing dots and whitespace |
| 4081 | s/[\. \t]*$// |
| 4082 | # Print |
| 4083 | /./p' | |
| 4084 | # we now have a list, one entry per line, of the stringified |
| 4085 | # contents of the appropriate section of all members of the |
| 4086 | # archive which possess that section. Heuristic: eliminate |
| 4087 | # all those which have a first or second character that is |
| 4088 | # a '.' (that is, objdump's representation of an unprintable |
| 4089 | # character.) This should work for all archives with less than |
| 4090 | # 0x302f exports -- but will fail for DLLs whose name actually |
| 4091 | # begins with a literal '.' or a single character followed by |
| 4092 | # a '.'. |
| 4093 | # |
| 4094 | # Of those that remain, print the first one. |
| 4095 | $SED -e '/^\./d;/^.\./d;q' |
| 4096 | } |
| 4097 | |
| 4098 | # func_cygming_gnu_implib_p ARG |
| 4099 | # This predicate returns with zero status (TRUE) if |
| 4100 | # ARG is a GNU/binutils-style import library. Returns |
| 4101 | # with nonzero status (FALSE) otherwise. |
| 4102 | func_cygming_gnu_implib_p () |
| 4103 | { |
| 4104 | $opt_debug |
| 4105 | func_to_tool_file "$1" func_convert_file_msys_to_w32 |
| 4106 | func_cygming_gnu_implib_tmp=`$NM "$func_to_tool_file_result" | eval "$global_symbol_pipe" | $EGREP ' (_head_[A-Za-z0-9_]+_[ad]l*|[A-Za-z0-9_]+_[ad]l*_iname)$'` |
| 4107 | test -n "$func_cygming_gnu_implib_tmp" |
| 4108 | } |
| 4109 | |
| 4110 | # func_cygming_ms_implib_p ARG |
| 4111 | # This predicate returns with zero status (TRUE) if |
| 4112 | # ARG is an MS-style import library. Returns |
| 4113 | # with nonzero status (FALSE) otherwise. |
| 4114 | func_cygming_ms_implib_p () |
| 4115 | { |
| 4116 | $opt_debug |
| 4117 | func_to_tool_file "$1" func_convert_file_msys_to_w32 |
| 4118 | func_cygming_ms_implib_tmp=`$NM "$func_to_tool_file_result" | eval "$global_symbol_pipe" | $GREP '_NULL_IMPORT_DESCRIPTOR'` |
| 4119 | test -n "$func_cygming_ms_implib_tmp" |
| 4120 | } |
| 4121 | |
| 4122 | # func_cygming_dll_for_implib_fallback ARG |
| 4123 | # Platform-specific function to extract the |
| 4124 | # name of the DLL associated with the specified |
| 4125 | # import library ARG. |
| 4126 | # |
| 4127 | # This fallback implementation is for use when $DLLTOOL |
| 4128 | # does not support the --identify-strict option. |
| 4129 | # Invoked by eval'ing the libtool variable |
| 4130 | # $sharedlib_from_linklib_cmd |
| 4131 | # Result is available in the variable |
| 4132 | # $sharedlib_from_linklib_result |
| 4133 | func_cygming_dll_for_implib_fallback () |
| 4134 | { |
| 4135 | $opt_debug |
| 4136 | if func_cygming_gnu_implib_p "$1" ; then |
| 4137 | # binutils import library |
| 4138 | sharedlib_from_linklib_result=`func_cygming_dll_for_implib_fallback_core '.idata$7' "$1"` |
| 4139 | elif func_cygming_ms_implib_p "$1" ; then |
| 4140 | # ms-generated import library |
| 4141 | sharedlib_from_linklib_result=`func_cygming_dll_for_implib_fallback_core '.idata$6' "$1"` |
| 4142 | else |
| 4143 | # unknown |
| 4144 | sharedlib_from_linklib_result="" |
| 4145 | fi |
| 4146 | } |
cristy | 3ed852e | 2009-09-05 21:47:34 +0000 | [diff] [blame] | 4147 | |
| 4148 | |
| 4149 | # func_extract_an_archive dir oldlib |
| 4150 | func_extract_an_archive () |
| 4151 | { |
| 4152 | $opt_debug |
| 4153 | f_ex_an_ar_dir="$1"; shift |
| 4154 | f_ex_an_ar_oldlib="$1" |
cristy | 98dddb5 | 2010-11-04 00:30:15 +0000 | [diff] [blame] | 4155 | if test "$lock_old_archive_extraction" = yes; then |
| 4156 | lockfile=$f_ex_an_ar_oldlib.lock |
| 4157 | until $opt_dry_run || ln "$progpath" "$lockfile" 2>/dev/null; do |
| 4158 | func_echo "Waiting for $lockfile to be removed" |
| 4159 | sleep 2 |
| 4160 | done |
| 4161 | fi |
| 4162 | func_show_eval "(cd \$f_ex_an_ar_dir && $AR x \"\$f_ex_an_ar_oldlib\")" \ |
| 4163 | 'stat=$?; rm -f "$lockfile"; exit $stat' |
| 4164 | if test "$lock_old_archive_extraction" = yes; then |
| 4165 | $opt_dry_run || rm -f "$lockfile" |
| 4166 | fi |
cristy | 3ed852e | 2009-09-05 21:47:34 +0000 | [diff] [blame] | 4167 | if ($AR t "$f_ex_an_ar_oldlib" | sort | sort -uc >/dev/null 2>&1); then |
| 4168 | : |
| 4169 | else |
| 4170 | func_fatal_error "object name conflicts in archive: $f_ex_an_ar_dir/$f_ex_an_ar_oldlib" |
| 4171 | fi |
| 4172 | } |
| 4173 | |
| 4174 | |
| 4175 | # func_extract_archives gentop oldlib ... |
| 4176 | func_extract_archives () |
| 4177 | { |
| 4178 | $opt_debug |
| 4179 | my_gentop="$1"; shift |
| 4180 | my_oldlibs=${1+"$@"} |
| 4181 | my_oldobjs="" |
| 4182 | my_xlib="" |
| 4183 | my_xabs="" |
| 4184 | my_xdir="" |
| 4185 | |
| 4186 | for my_xlib in $my_oldlibs; do |
| 4187 | # Extract the objects. |
| 4188 | case $my_xlib in |
| 4189 | [\\/]* | [A-Za-z]:[\\/]*) my_xabs="$my_xlib" ;; |
| 4190 | *) my_xabs=`pwd`"/$my_xlib" ;; |
| 4191 | esac |
| 4192 | func_basename "$my_xlib" |
| 4193 | my_xlib="$func_basename_result" |
| 4194 | my_xlib_u=$my_xlib |
| 4195 | while :; do |
| 4196 | case " $extracted_archives " in |
| 4197 | *" $my_xlib_u "*) |
| 4198 | func_arith $extracted_serial + 1 |
| 4199 | extracted_serial=$func_arith_result |
| 4200 | my_xlib_u=lt$extracted_serial-$my_xlib ;; |
| 4201 | *) break ;; |
| 4202 | esac |
| 4203 | done |
| 4204 | extracted_archives="$extracted_archives $my_xlib_u" |
| 4205 | my_xdir="$my_gentop/$my_xlib_u" |
| 4206 | |
| 4207 | func_mkdir_p "$my_xdir" |
| 4208 | |
| 4209 | case $host in |
| 4210 | *-darwin*) |
| 4211 | func_verbose "Extracting $my_xabs" |
| 4212 | # Do not bother doing anything if just a dry run |
| 4213 | $opt_dry_run || { |
| 4214 | darwin_orig_dir=`pwd` |
| 4215 | cd $my_xdir || exit $? |
| 4216 | darwin_archive=$my_xabs |
| 4217 | darwin_curdir=`pwd` |
| 4218 | darwin_base_archive=`basename "$darwin_archive"` |
| 4219 | darwin_arches=`$LIPO -info "$darwin_archive" 2>/dev/null | $GREP Architectures 2>/dev/null || true` |
| 4220 | if test -n "$darwin_arches"; then |
| 4221 | darwin_arches=`$ECHO "$darwin_arches" | $SED -e 's/.*are://'` |
| 4222 | darwin_arch= |
| 4223 | func_verbose "$darwin_base_archive has multiple architectures $darwin_arches" |
| 4224 | for darwin_arch in $darwin_arches ; do |
| 4225 | func_mkdir_p "unfat-$$/${darwin_base_archive}-${darwin_arch}" |
| 4226 | $LIPO -thin $darwin_arch -output "unfat-$$/${darwin_base_archive}-${darwin_arch}/${darwin_base_archive}" "${darwin_archive}" |
| 4227 | cd "unfat-$$/${darwin_base_archive}-${darwin_arch}" |
| 4228 | func_extract_an_archive "`pwd`" "${darwin_base_archive}" |
| 4229 | cd "$darwin_curdir" |
| 4230 | $RM "unfat-$$/${darwin_base_archive}-${darwin_arch}/${darwin_base_archive}" |
| 4231 | done # $darwin_arches |
| 4232 | ## Okay now we've a bunch of thin objects, gotta fatten them up :) |
| 4233 | darwin_filelist=`find unfat-$$ -type f -name \*.o -print -o -name \*.lo -print | $SED -e "$basename" | sort -u` |
| 4234 | darwin_file= |
| 4235 | darwin_files= |
| 4236 | for darwin_file in $darwin_filelist; do |
cristy | 98dddb5 | 2010-11-04 00:30:15 +0000 | [diff] [blame] | 4237 | darwin_files=`find unfat-$$ -name $darwin_file -print | sort | $NL2SP` |
cristy | 3ed852e | 2009-09-05 21:47:34 +0000 | [diff] [blame] | 4238 | $LIPO -create -output "$darwin_file" $darwin_files |
| 4239 | done # $darwin_filelist |
| 4240 | $RM -rf unfat-$$ |
| 4241 | cd "$darwin_orig_dir" |
| 4242 | else |
| 4243 | cd $darwin_orig_dir |
| 4244 | func_extract_an_archive "$my_xdir" "$my_xabs" |
| 4245 | fi # $darwin_arches |
| 4246 | } # !$opt_dry_run |
| 4247 | ;; |
| 4248 | *) |
| 4249 | func_extract_an_archive "$my_xdir" "$my_xabs" |
| 4250 | ;; |
| 4251 | esac |
cristy | 98dddb5 | 2010-11-04 00:30:15 +0000 | [diff] [blame] | 4252 | my_oldobjs="$my_oldobjs "`find $my_xdir -name \*.$objext -print -o -name \*.lo -print | sort | $NL2SP` |
cristy | 3ed852e | 2009-09-05 21:47:34 +0000 | [diff] [blame] | 4253 | done |
| 4254 | |
| 4255 | func_extract_archives_result="$my_oldobjs" |
| 4256 | } |
| 4257 | |
| 4258 | |
cristy | 98dddb5 | 2010-11-04 00:30:15 +0000 | [diff] [blame] | 4259 | # func_emit_wrapper [arg=no] |
cristy | 3ed852e | 2009-09-05 21:47:34 +0000 | [diff] [blame] | 4260 | # |
cristy | 98dddb5 | 2010-11-04 00:30:15 +0000 | [diff] [blame] | 4261 | # Emit a libtool wrapper script on stdout. |
| 4262 | # Don't directly open a file because we may want to |
| 4263 | # incorporate the script contents within a cygwin/mingw |
| 4264 | # wrapper executable. Must ONLY be called from within |
| 4265 | # func_mode_link because it depends on a number of variables |
| 4266 | # set therein. |
| 4267 | # |
| 4268 | # ARG is the value that the WRAPPER_SCRIPT_BELONGS_IN_OBJDIR |
| 4269 | # variable will take. If 'yes', then the emitted script |
| 4270 | # will assume that the directory in which it is stored is |
| 4271 | # the $objdir directory. This is a cygwin/mingw-specific |
| 4272 | # behavior. |
| 4273 | func_emit_wrapper () |
cristy | 3ed852e | 2009-09-05 21:47:34 +0000 | [diff] [blame] | 4274 | { |
cristy | 98dddb5 | 2010-11-04 00:30:15 +0000 | [diff] [blame] | 4275 | func_emit_wrapper_arg1=${1-no} |
cristy | 3ed852e | 2009-09-05 21:47:34 +0000 | [diff] [blame] | 4276 | |
| 4277 | $ECHO "\ |
| 4278 | #! $SHELL |
| 4279 | |
| 4280 | # $output - temporary wrapper script for $objdir/$outputname |
| 4281 | # Generated by $PROGRAM (GNU $PACKAGE$TIMESTAMP) $VERSION |
| 4282 | # |
| 4283 | # The $output program cannot be directly executed until all the libtool |
| 4284 | # libraries that it depends on are installed. |
| 4285 | # |
| 4286 | # This wrapper script should never be moved out of the build directory. |
| 4287 | # If it is, it will not operate correctly. |
| 4288 | |
| 4289 | # Sed substitution that helps us do robust quoting. It backslashifies |
| 4290 | # metacharacters that are still active within double-quoted strings. |
cristy | 3ed852e | 2009-09-05 21:47:34 +0000 | [diff] [blame] | 4291 | sed_quote_subst='$sed_quote_subst' |
| 4292 | |
| 4293 | # Be Bourne compatible |
| 4294 | if test -n \"\${ZSH_VERSION+set}\" && (emulate sh) >/dev/null 2>&1; then |
| 4295 | emulate sh |
| 4296 | NULLCMD=: |
| 4297 | # Zsh 3.x and 4.x performs word splitting on \${1+\"\$@\"}, which |
| 4298 | # is contrary to our usage. Disable this feature. |
| 4299 | alias -g '\${1+\"\$@\"}'='\"\$@\"' |
| 4300 | setopt NO_GLOB_SUBST |
| 4301 | else |
| 4302 | case \`(set -o) 2>/dev/null\` in *posix*) set -o posix;; esac |
| 4303 | fi |
| 4304 | BIN_SH=xpg4; export BIN_SH # for Tru64 |
| 4305 | DUALCASE=1; export DUALCASE # for MKS sh |
| 4306 | |
| 4307 | # The HP-UX ksh and POSIX shell print the target directory to stdout |
| 4308 | # if CDPATH is set. |
| 4309 | (unset CDPATH) >/dev/null 2>&1 && unset CDPATH |
| 4310 | |
| 4311 | relink_command=\"$relink_command\" |
| 4312 | |
| 4313 | # This environment variable determines our operation mode. |
| 4314 | if test \"\$libtool_install_magic\" = \"$magic\"; then |
| 4315 | # install mode needs the following variables: |
| 4316 | generated_by_libtool_version='$macro_version' |
| 4317 | notinst_deplibs='$notinst_deplibs' |
| 4318 | else |
| 4319 | # When we are sourced in execute mode, \$file and \$ECHO are already set. |
| 4320 | if test \"\$libtool_execute_magic\" != \"$magic\"; then |
cristy | 98dddb5 | 2010-11-04 00:30:15 +0000 | [diff] [blame] | 4321 | file=\"\$0\"" |
| 4322 | |
| 4323 | qECHO=`$ECHO "$ECHO" | $SED "$sed_quote_subst"` |
| 4324 | $ECHO "\ |
| 4325 | |
| 4326 | # A function that is used when there is no print builtin or printf. |
| 4327 | func_fallback_echo () |
| 4328 | { |
| 4329 | eval 'cat <<_LTECHO_EOF |
| 4330 | \$1 |
| 4331 | _LTECHO_EOF' |
| 4332 | } |
| 4333 | ECHO=\"$qECHO\" |
| 4334 | fi |
| 4335 | |
| 4336 | # Very basic option parsing. These options are (a) specific to |
| 4337 | # the libtool wrapper, (b) are identical between the wrapper |
| 4338 | # /script/ and the wrapper /executable/ which is used only on |
| 4339 | # windows platforms, and (c) all begin with the string "--lt-" |
| 4340 | # (application programs are unlikely to have options which match |
| 4341 | # this pattern). |
| 4342 | # |
| 4343 | # There are only two supported options: --lt-debug and |
| 4344 | # --lt-dump-script. There is, deliberately, no --lt-help. |
| 4345 | # |
| 4346 | # The first argument to this parsing function should be the |
| 4347 | # script's $0 value, followed by "$@". |
| 4348 | lt_option_debug= |
| 4349 | func_parse_lt_options () |
| 4350 | { |
| 4351 | lt_script_arg0=\$0 |
| 4352 | shift |
| 4353 | for lt_opt |
| 4354 | do |
| 4355 | case \"\$lt_opt\" in |
| 4356 | --lt-debug) lt_option_debug=1 ;; |
| 4357 | --lt-dump-script) |
| 4358 | lt_dump_D=\`\$ECHO \"X\$lt_script_arg0\" | $SED -e 's/^X//' -e 's%/[^/]*$%%'\` |
| 4359 | test \"X\$lt_dump_D\" = \"X\$lt_script_arg0\" && lt_dump_D=. |
| 4360 | lt_dump_F=\`\$ECHO \"X\$lt_script_arg0\" | $SED -e 's/^X//' -e 's%^.*/%%'\` |
| 4361 | cat \"\$lt_dump_D/\$lt_dump_F\" |
| 4362 | exit 0 |
| 4363 | ;; |
| 4364 | --lt-*) |
| 4365 | \$ECHO \"Unrecognized --lt- option: '\$lt_opt'\" 1>&2 |
| 4366 | exit 1 |
| 4367 | ;; |
| 4368 | esac |
| 4369 | done |
| 4370 | |
| 4371 | # Print the debug banner immediately: |
| 4372 | if test -n \"\$lt_option_debug\"; then |
| 4373 | echo \"${outputname}:${output}:\${LINENO}: libtool wrapper (GNU $PACKAGE$TIMESTAMP) $VERSION\" 1>&2 |
| 4374 | fi |
| 4375 | } |
| 4376 | |
| 4377 | # Used when --lt-debug. Prints its arguments to stdout |
| 4378 | # (redirection is the responsibility of the caller) |
| 4379 | func_lt_dump_args () |
| 4380 | { |
| 4381 | lt_dump_args_N=1; |
| 4382 | for lt_arg |
| 4383 | do |
| 4384 | \$ECHO \"${outputname}:${output}:\${LINENO}: newargv[\$lt_dump_args_N]: \$lt_arg\" |
| 4385 | lt_dump_args_N=\`expr \$lt_dump_args_N + 1\` |
| 4386 | done |
| 4387 | } |
| 4388 | |
| 4389 | # Core function for launching the target application |
| 4390 | func_exec_program_core () |
| 4391 | { |
cristy | cd4c531 | 2009-11-22 01:19:08 +0000 | [diff] [blame] | 4392 | " |
cristy | 98dddb5 | 2010-11-04 00:30:15 +0000 | [diff] [blame] | 4393 | case $host in |
| 4394 | # Backslashes separate directories on plain windows |
| 4395 | *-*-mingw | *-*-os2* | *-cegcc*) |
| 4396 | $ECHO "\ |
| 4397 | if test -n \"\$lt_option_debug\"; then |
| 4398 | \$ECHO \"${outputname}:${output}:\${LINENO}: newargv[0]: \$progdir\\\\\$program\" 1>&2 |
| 4399 | func_lt_dump_args \${1+\"\$@\"} 1>&2 |
| 4400 | fi |
| 4401 | exec \"\$progdir\\\\\$program\" \${1+\"\$@\"} |
| 4402 | " |
| 4403 | ;; |
| 4404 | |
| 4405 | *) |
| 4406 | $ECHO "\ |
| 4407 | if test -n \"\$lt_option_debug\"; then |
| 4408 | \$ECHO \"${outputname}:${output}:\${LINENO}: newargv[0]: \$progdir/\$program\" 1>&2 |
| 4409 | func_lt_dump_args \${1+\"\$@\"} 1>&2 |
| 4410 | fi |
| 4411 | exec \"\$progdir/\$program\" \${1+\"\$@\"} |
| 4412 | " |
| 4413 | ;; |
| 4414 | esac |
| 4415 | $ECHO "\ |
| 4416 | \$ECHO \"\$0: cannot exec \$program \$*\" 1>&2 |
| 4417 | exit 1 |
| 4418 | } |
| 4419 | |
| 4420 | # A function to encapsulate launching the target application |
| 4421 | # Strips options in the --lt-* namespace from \$@ and |
| 4422 | # launches target application with the remaining arguments. |
| 4423 | func_exec_program () |
| 4424 | { |
| 4425 | for lt_wr_arg |
| 4426 | do |
| 4427 | case \$lt_wr_arg in |
| 4428 | --lt-*) ;; |
| 4429 | *) set x \"\$@\" \"\$lt_wr_arg\"; shift;; |
| 4430 | esac |
| 4431 | shift |
| 4432 | done |
| 4433 | func_exec_program_core \${1+\"\$@\"} |
| 4434 | } |
| 4435 | |
| 4436 | # Parse options |
| 4437 | func_parse_lt_options \"\$0\" \${1+\"\$@\"} |
cristy | 3ed852e | 2009-09-05 21:47:34 +0000 | [diff] [blame] | 4438 | |
| 4439 | # Find the directory that this script lives in. |
cristy | 98dddb5 | 2010-11-04 00:30:15 +0000 | [diff] [blame] | 4440 | thisdir=\`\$ECHO \"\$file\" | $SED 's%/[^/]*$%%'\` |
cristy | 3ed852e | 2009-09-05 21:47:34 +0000 | [diff] [blame] | 4441 | test \"x\$thisdir\" = \"x\$file\" && thisdir=. |
| 4442 | |
| 4443 | # Follow symbolic links until we get to the real thisdir. |
cristy | 98dddb5 | 2010-11-04 00:30:15 +0000 | [diff] [blame] | 4444 | file=\`ls -ld \"\$file\" | $SED -n 's/.*-> //p'\` |
cristy | 3ed852e | 2009-09-05 21:47:34 +0000 | [diff] [blame] | 4445 | while test -n \"\$file\"; do |
cristy | 98dddb5 | 2010-11-04 00:30:15 +0000 | [diff] [blame] | 4446 | destdir=\`\$ECHO \"\$file\" | $SED 's%/[^/]*\$%%'\` |
cristy | 3ed852e | 2009-09-05 21:47:34 +0000 | [diff] [blame] | 4447 | |
| 4448 | # If there was a directory component, then change thisdir. |
| 4449 | if test \"x\$destdir\" != \"x\$file\"; then |
| 4450 | case \"\$destdir\" in |
| 4451 | [\\\\/]* | [A-Za-z]:[\\\\/]*) thisdir=\"\$destdir\" ;; |
| 4452 | *) thisdir=\"\$thisdir/\$destdir\" ;; |
| 4453 | esac |
| 4454 | fi |
| 4455 | |
cristy | 98dddb5 | 2010-11-04 00:30:15 +0000 | [diff] [blame] | 4456 | file=\`\$ECHO \"\$file\" | $SED 's%^.*/%%'\` |
| 4457 | file=\`ls -ld \"\$thisdir/\$file\" | $SED -n 's/.*-> //p'\` |
cristy | 3ed852e | 2009-09-05 21:47:34 +0000 | [diff] [blame] | 4458 | done |
cristy | 3ed852e | 2009-09-05 21:47:34 +0000 | [diff] [blame] | 4459 | |
| 4460 | # Usually 'no', except on cygwin/mingw when embedded into |
| 4461 | # the cwrapper. |
cristy | 98dddb5 | 2010-11-04 00:30:15 +0000 | [diff] [blame] | 4462 | WRAPPER_SCRIPT_BELONGS_IN_OBJDIR=$func_emit_wrapper_arg1 |
cristy | 3ed852e | 2009-09-05 21:47:34 +0000 | [diff] [blame] | 4463 | if test \"\$WRAPPER_SCRIPT_BELONGS_IN_OBJDIR\" = \"yes\"; then |
| 4464 | # special case for '.' |
| 4465 | if test \"\$thisdir\" = \".\"; then |
| 4466 | thisdir=\`pwd\` |
| 4467 | fi |
| 4468 | # remove .libs from thisdir |
| 4469 | case \"\$thisdir\" in |
cristy | 98dddb5 | 2010-11-04 00:30:15 +0000 | [diff] [blame] | 4470 | *[\\\\/]$objdir ) thisdir=\`\$ECHO \"\$thisdir\" | $SED 's%[\\\\/][^\\\\/]*$%%'\` ;; |
cristy | 3ed852e | 2009-09-05 21:47:34 +0000 | [diff] [blame] | 4471 | $objdir ) thisdir=. ;; |
| 4472 | esac |
| 4473 | fi |
| 4474 | |
| 4475 | # Try to get the absolute directory name. |
| 4476 | absdir=\`cd \"\$thisdir\" && pwd\` |
| 4477 | test -n \"\$absdir\" && thisdir=\"\$absdir\" |
| 4478 | " |
| 4479 | |
| 4480 | if test "$fast_install" = yes; then |
| 4481 | $ECHO "\ |
| 4482 | program=lt-'$outputname'$exeext |
| 4483 | progdir=\"\$thisdir/$objdir\" |
| 4484 | |
| 4485 | if test ! -f \"\$progdir/\$program\" || |
| 4486 | { file=\`ls -1dt \"\$progdir/\$program\" \"\$progdir/../\$program\" 2>/dev/null | ${SED} 1q\`; \\ |
| 4487 | test \"X\$file\" != \"X\$progdir/\$program\"; }; then |
| 4488 | |
| 4489 | file=\"\$\$-\$program\" |
| 4490 | |
| 4491 | if test ! -d \"\$progdir\"; then |
| 4492 | $MKDIR \"\$progdir\" |
| 4493 | else |
| 4494 | $RM \"\$progdir/\$file\" |
| 4495 | fi" |
| 4496 | |
| 4497 | $ECHO "\ |
| 4498 | |
| 4499 | # relink executable if necessary |
| 4500 | if test -n \"\$relink_command\"; then |
| 4501 | if relink_command_output=\`eval \$relink_command 2>&1\`; then : |
| 4502 | else |
| 4503 | $ECHO \"\$relink_command_output\" >&2 |
| 4504 | $RM \"\$progdir/\$file\" |
| 4505 | exit 1 |
| 4506 | fi |
| 4507 | fi |
| 4508 | |
| 4509 | $MV \"\$progdir/\$file\" \"\$progdir/\$program\" 2>/dev/null || |
| 4510 | { $RM \"\$progdir/\$program\"; |
| 4511 | $MV \"\$progdir/\$file\" \"\$progdir/\$program\"; } |
| 4512 | $RM \"\$progdir/\$file\" |
| 4513 | fi" |
| 4514 | else |
| 4515 | $ECHO "\ |
| 4516 | program='$outputname' |
| 4517 | progdir=\"\$thisdir/$objdir\" |
| 4518 | " |
| 4519 | fi |
| 4520 | |
| 4521 | $ECHO "\ |
| 4522 | |
| 4523 | if test -f \"\$progdir/\$program\"; then" |
| 4524 | |
cristy | da16f16 | 2011-02-19 23:52:17 +0000 | [diff] [blame] | 4525 | # fixup the dll searchpath if we need to. |
| 4526 | # |
| 4527 | # Fix the DLL searchpath if we need to. Do this before prepending |
| 4528 | # to shlibpath, because on Windows, both are PATH and uninstalled |
| 4529 | # libraries must come first. |
| 4530 | if test -n "$dllsearchpath"; then |
| 4531 | $ECHO "\ |
| 4532 | # Add the dll search path components to the executable PATH |
| 4533 | PATH=$dllsearchpath:\$PATH |
| 4534 | " |
| 4535 | fi |
| 4536 | |
cristy | 3ed852e | 2009-09-05 21:47:34 +0000 | [diff] [blame] | 4537 | # Export our shlibpath_var if we have one. |
| 4538 | if test "$shlibpath_overrides_runpath" = yes && test -n "$shlibpath_var" && test -n "$temp_rpath"; then |
| 4539 | $ECHO "\ |
| 4540 | # Add our own library path to $shlibpath_var |
| 4541 | $shlibpath_var=\"$temp_rpath\$$shlibpath_var\" |
| 4542 | |
| 4543 | # Some systems cannot cope with colon-terminated $shlibpath_var |
| 4544 | # The second colon is a workaround for a bug in BeOS R4 sed |
cristy | 98dddb5 | 2010-11-04 00:30:15 +0000 | [diff] [blame] | 4545 | $shlibpath_var=\`\$ECHO \"\$$shlibpath_var\" | $SED 's/::*\$//'\` |
cristy | 3ed852e | 2009-09-05 21:47:34 +0000 | [diff] [blame] | 4546 | |
| 4547 | export $shlibpath_var |
| 4548 | " |
| 4549 | fi |
| 4550 | |
cristy | 3ed852e | 2009-09-05 21:47:34 +0000 | [diff] [blame] | 4551 | $ECHO "\ |
| 4552 | if test \"\$libtool_execute_magic\" != \"$magic\"; then |
| 4553 | # Run the actual program with our arguments. |
cristy | 98dddb5 | 2010-11-04 00:30:15 +0000 | [diff] [blame] | 4554 | func_exec_program \${1+\"\$@\"} |
cristy | 3ed852e | 2009-09-05 21:47:34 +0000 | [diff] [blame] | 4555 | fi |
| 4556 | else |
| 4557 | # The program doesn't exist. |
| 4558 | \$ECHO \"\$0: error: \\\`\$progdir/\$program' does not exist\" 1>&2 |
| 4559 | \$ECHO \"This script is just a wrapper for \$program.\" 1>&2 |
cristy | 98dddb5 | 2010-11-04 00:30:15 +0000 | [diff] [blame] | 4560 | \$ECHO \"See the $PACKAGE documentation for more information.\" 1>&2 |
cristy | 3ed852e | 2009-09-05 21:47:34 +0000 | [diff] [blame] | 4561 | exit 1 |
| 4562 | fi |
| 4563 | fi\ |
| 4564 | " |
| 4565 | } |
cristy | 3ed852e | 2009-09-05 21:47:34 +0000 | [diff] [blame] | 4566 | |
| 4567 | |
cristy | 3ed852e | 2009-09-05 21:47:34 +0000 | [diff] [blame] | 4568 | # func_emit_cwrapperexe_src |
| 4569 | # emit the source code for a wrapper executable on stdout |
| 4570 | # Must ONLY be called from within func_mode_link because |
| 4571 | # it depends on a number of variable set therein. |
| 4572 | func_emit_cwrapperexe_src () |
| 4573 | { |
| 4574 | cat <<EOF |
| 4575 | |
| 4576 | /* $cwrappersource - temporary wrapper executable for $objdir/$outputname |
| 4577 | Generated by $PROGRAM (GNU $PACKAGE$TIMESTAMP) $VERSION |
| 4578 | |
| 4579 | The $output program cannot be directly executed until all the libtool |
| 4580 | libraries that it depends on are installed. |
| 4581 | |
| 4582 | This wrapper executable should never be moved out of the build directory. |
| 4583 | If it is, it will not operate correctly. |
cristy | 3ed852e | 2009-09-05 21:47:34 +0000 | [diff] [blame] | 4584 | */ |
| 4585 | EOF |
| 4586 | cat <<"EOF" |
cristy | 98dddb5 | 2010-11-04 00:30:15 +0000 | [diff] [blame] | 4587 | #ifdef _MSC_VER |
| 4588 | # define _CRT_SECURE_NO_DEPRECATE 1 |
| 4589 | #endif |
cristy | 3ed852e | 2009-09-05 21:47:34 +0000 | [diff] [blame] | 4590 | #include <stdio.h> |
| 4591 | #include <stdlib.h> |
| 4592 | #ifdef _MSC_VER |
| 4593 | # include <direct.h> |
| 4594 | # include <process.h> |
| 4595 | # include <io.h> |
cristy | 3ed852e | 2009-09-05 21:47:34 +0000 | [diff] [blame] | 4596 | #else |
| 4597 | # include <unistd.h> |
| 4598 | # include <stdint.h> |
| 4599 | # ifdef __CYGWIN__ |
| 4600 | # include <io.h> |
cristy | 3ed852e | 2009-09-05 21:47:34 +0000 | [diff] [blame] | 4601 | # endif |
| 4602 | #endif |
| 4603 | #include <malloc.h> |
| 4604 | #include <stdarg.h> |
| 4605 | #include <assert.h> |
| 4606 | #include <string.h> |
| 4607 | #include <ctype.h> |
| 4608 | #include <errno.h> |
| 4609 | #include <fcntl.h> |
| 4610 | #include <sys/stat.h> |
| 4611 | |
cristy | 98dddb5 | 2010-11-04 00:30:15 +0000 | [diff] [blame] | 4612 | /* declarations of non-ANSI functions */ |
| 4613 | #if defined(__MINGW32__) |
| 4614 | # ifdef __STRICT_ANSI__ |
| 4615 | int _putenv (const char *); |
| 4616 | # endif |
| 4617 | #elif defined(__CYGWIN__) |
| 4618 | # ifdef __STRICT_ANSI__ |
| 4619 | char *realpath (const char *, char *); |
| 4620 | int putenv (char *); |
| 4621 | int setenv (const char *, const char *, int); |
| 4622 | # endif |
| 4623 | /* #elif defined (other platforms) ... */ |
| 4624 | #endif |
| 4625 | |
| 4626 | /* portability defines, excluding path handling macros */ |
| 4627 | #if defined(_MSC_VER) |
| 4628 | # define setmode _setmode |
| 4629 | # define stat _stat |
| 4630 | # define chmod _chmod |
| 4631 | # define getcwd _getcwd |
| 4632 | # define putenv _putenv |
| 4633 | # define S_IXUSR _S_IEXEC |
| 4634 | # ifndef _INTPTR_T_DEFINED |
| 4635 | # define _INTPTR_T_DEFINED |
| 4636 | # define intptr_t int |
| 4637 | # endif |
| 4638 | #elif defined(__MINGW32__) |
| 4639 | # define setmode _setmode |
| 4640 | # define stat _stat |
| 4641 | # define chmod _chmod |
| 4642 | # define getcwd _getcwd |
| 4643 | # define putenv _putenv |
| 4644 | #elif defined(__CYGWIN__) |
| 4645 | # define HAVE_SETENV |
| 4646 | # define FOPEN_WB "wb" |
| 4647 | /* #elif defined (other platforms) ... */ |
| 4648 | #endif |
| 4649 | |
cristy | 3ed852e | 2009-09-05 21:47:34 +0000 | [diff] [blame] | 4650 | #if defined(PATH_MAX) |
| 4651 | # define LT_PATHMAX PATH_MAX |
| 4652 | #elif defined(MAXPATHLEN) |
| 4653 | # define LT_PATHMAX MAXPATHLEN |
| 4654 | #else |
| 4655 | # define LT_PATHMAX 1024 |
| 4656 | #endif |
| 4657 | |
| 4658 | #ifndef S_IXOTH |
| 4659 | # define S_IXOTH 0 |
| 4660 | #endif |
| 4661 | #ifndef S_IXGRP |
| 4662 | # define S_IXGRP 0 |
| 4663 | #endif |
| 4664 | |
cristy | 98dddb5 | 2010-11-04 00:30:15 +0000 | [diff] [blame] | 4665 | /* path handling portability macros */ |
cristy | 3ed852e | 2009-09-05 21:47:34 +0000 | [diff] [blame] | 4666 | #ifndef DIR_SEPARATOR |
| 4667 | # define DIR_SEPARATOR '/' |
| 4668 | # define PATH_SEPARATOR ':' |
| 4669 | #endif |
| 4670 | |
| 4671 | #if defined (_WIN32) || defined (__MSDOS__) || defined (__DJGPP__) || \ |
| 4672 | defined (__OS2__) |
| 4673 | # define HAVE_DOS_BASED_FILE_SYSTEM |
| 4674 | # define FOPEN_WB "wb" |
| 4675 | # ifndef DIR_SEPARATOR_2 |
| 4676 | # define DIR_SEPARATOR_2 '\\' |
| 4677 | # endif |
| 4678 | # ifndef PATH_SEPARATOR_2 |
| 4679 | # define PATH_SEPARATOR_2 ';' |
| 4680 | # endif |
| 4681 | #endif |
| 4682 | |
| 4683 | #ifndef DIR_SEPARATOR_2 |
| 4684 | # define IS_DIR_SEPARATOR(ch) ((ch) == DIR_SEPARATOR) |
| 4685 | #else /* DIR_SEPARATOR_2 */ |
| 4686 | # define IS_DIR_SEPARATOR(ch) \ |
| 4687 | (((ch) == DIR_SEPARATOR) || ((ch) == DIR_SEPARATOR_2)) |
| 4688 | #endif /* DIR_SEPARATOR_2 */ |
| 4689 | |
| 4690 | #ifndef PATH_SEPARATOR_2 |
| 4691 | # define IS_PATH_SEPARATOR(ch) ((ch) == PATH_SEPARATOR) |
| 4692 | #else /* PATH_SEPARATOR_2 */ |
| 4693 | # define IS_PATH_SEPARATOR(ch) ((ch) == PATH_SEPARATOR_2) |
| 4694 | #endif /* PATH_SEPARATOR_2 */ |
| 4695 | |
cristy | 3ed852e | 2009-09-05 21:47:34 +0000 | [diff] [blame] | 4696 | #ifndef FOPEN_WB |
| 4697 | # define FOPEN_WB "w" |
| 4698 | #endif |
| 4699 | #ifndef _O_BINARY |
| 4700 | # define _O_BINARY 0 |
| 4701 | #endif |
| 4702 | |
| 4703 | #define XMALLOC(type, num) ((type *) xmalloc ((num) * sizeof(type))) |
| 4704 | #define XFREE(stale) do { \ |
| 4705 | if (stale) { free ((void *) stale); stale = 0; } \ |
| 4706 | } while (0) |
| 4707 | |
cristy | 98dddb5 | 2010-11-04 00:30:15 +0000 | [diff] [blame] | 4708 | #if defined(LT_DEBUGWRAPPER) |
| 4709 | static int lt_debug = 1; |
cristy | 3ed852e | 2009-09-05 21:47:34 +0000 | [diff] [blame] | 4710 | #else |
cristy | 98dddb5 | 2010-11-04 00:30:15 +0000 | [diff] [blame] | 4711 | static int lt_debug = 0; |
cristy | 3ed852e | 2009-09-05 21:47:34 +0000 | [diff] [blame] | 4712 | #endif |
| 4713 | |
cristy | 98dddb5 | 2010-11-04 00:30:15 +0000 | [diff] [blame] | 4714 | const char *program_name = "libtool-wrapper"; /* in case xstrdup fails */ |
cristy | 3ed852e | 2009-09-05 21:47:34 +0000 | [diff] [blame] | 4715 | |
| 4716 | void *xmalloc (size_t num); |
| 4717 | char *xstrdup (const char *string); |
| 4718 | const char *base_name (const char *name); |
| 4719 | char *find_executable (const char *wrapper); |
| 4720 | char *chase_symlinks (const char *pathspec); |
| 4721 | int make_executable (const char *path); |
| 4722 | int check_executable (const char *path); |
| 4723 | char *strendzap (char *str, const char *pat); |
cristy | 98dddb5 | 2010-11-04 00:30:15 +0000 | [diff] [blame] | 4724 | void lt_debugprintf (const char *file, int line, const char *fmt, ...); |
| 4725 | void lt_fatal (const char *file, int line, const char *message, ...); |
| 4726 | static const char *nonnull (const char *s); |
| 4727 | static const char *nonempty (const char *s); |
cristy | 3ed852e | 2009-09-05 21:47:34 +0000 | [diff] [blame] | 4728 | void lt_setenv (const char *name, const char *value); |
| 4729 | char *lt_extend_str (const char *orig_value, const char *add, int to_end); |
cristy | 3ed852e | 2009-09-05 21:47:34 +0000 | [diff] [blame] | 4730 | void lt_update_exe_path (const char *name, const char *value); |
| 4731 | void lt_update_lib_path (const char *name, const char *value); |
cristy | 98dddb5 | 2010-11-04 00:30:15 +0000 | [diff] [blame] | 4732 | char **prepare_spawn (char **argv); |
| 4733 | void lt_dump_script (FILE *f); |
cristy | 3ed852e | 2009-09-05 21:47:34 +0000 | [diff] [blame] | 4734 | EOF |
| 4735 | |
cristy | 3ed852e | 2009-09-05 21:47:34 +0000 | [diff] [blame] | 4736 | cat <<EOF |
cristy | da16f16 | 2011-02-19 23:52:17 +0000 | [diff] [blame] | 4737 | volatile const char * MAGIC_EXE = "$magic_exe"; |
cristy | 3ed852e | 2009-09-05 21:47:34 +0000 | [diff] [blame] | 4738 | const char * LIB_PATH_VARNAME = "$shlibpath_var"; |
| 4739 | EOF |
| 4740 | |
| 4741 | if test "$shlibpath_overrides_runpath" = yes && test -n "$shlibpath_var" && test -n "$temp_rpath"; then |
cristy | da16f16 | 2011-02-19 23:52:17 +0000 | [diff] [blame] | 4742 | func_to_host_path "$temp_rpath" |
cristy | 3ed852e | 2009-09-05 21:47:34 +0000 | [diff] [blame] | 4743 | cat <<EOF |
cristy | da16f16 | 2011-02-19 23:52:17 +0000 | [diff] [blame] | 4744 | const char * LIB_PATH_VALUE = "$func_to_host_path_result"; |
cristy | 3ed852e | 2009-09-05 21:47:34 +0000 | [diff] [blame] | 4745 | EOF |
| 4746 | else |
| 4747 | cat <<"EOF" |
| 4748 | const char * LIB_PATH_VALUE = ""; |
| 4749 | EOF |
| 4750 | fi |
| 4751 | |
| 4752 | if test -n "$dllsearchpath"; then |
cristy | da16f16 | 2011-02-19 23:52:17 +0000 | [diff] [blame] | 4753 | func_to_host_path "$dllsearchpath:" |
cristy | 3ed852e | 2009-09-05 21:47:34 +0000 | [diff] [blame] | 4754 | cat <<EOF |
| 4755 | const char * EXE_PATH_VARNAME = "PATH"; |
cristy | da16f16 | 2011-02-19 23:52:17 +0000 | [diff] [blame] | 4756 | const char * EXE_PATH_VALUE = "$func_to_host_path_result"; |
cristy | 3ed852e | 2009-09-05 21:47:34 +0000 | [diff] [blame] | 4757 | EOF |
| 4758 | else |
| 4759 | cat <<"EOF" |
| 4760 | const char * EXE_PATH_VARNAME = ""; |
| 4761 | const char * EXE_PATH_VALUE = ""; |
| 4762 | EOF |
| 4763 | fi |
| 4764 | |
| 4765 | if test "$fast_install" = yes; then |
| 4766 | cat <<EOF |
| 4767 | const char * TARGET_PROGRAM_NAME = "lt-$outputname"; /* hopefully, no .exe */ |
| 4768 | EOF |
| 4769 | else |
| 4770 | cat <<EOF |
| 4771 | const char * TARGET_PROGRAM_NAME = "$outputname"; /* hopefully, no .exe */ |
| 4772 | EOF |
| 4773 | fi |
| 4774 | |
| 4775 | |
| 4776 | cat <<"EOF" |
| 4777 | |
| 4778 | #define LTWRAPPER_OPTION_PREFIX "--lt-" |
cristy | 3ed852e | 2009-09-05 21:47:34 +0000 | [diff] [blame] | 4779 | |
cristy | 3ed852e | 2009-09-05 21:47:34 +0000 | [diff] [blame] | 4780 | static const char *ltwrapper_option_prefix = LTWRAPPER_OPTION_PREFIX; |
cristy | 3ed852e | 2009-09-05 21:47:34 +0000 | [diff] [blame] | 4781 | static const char *dumpscript_opt = LTWRAPPER_OPTION_PREFIX "dump-script"; |
cristy | 98dddb5 | 2010-11-04 00:30:15 +0000 | [diff] [blame] | 4782 | static const char *debug_opt = LTWRAPPER_OPTION_PREFIX "debug"; |
cristy | cd4c531 | 2009-11-22 01:19:08 +0000 | [diff] [blame] | 4783 | |
cristy | 3ed852e | 2009-09-05 21:47:34 +0000 | [diff] [blame] | 4784 | int |
| 4785 | main (int argc, char *argv[]) |
| 4786 | { |
| 4787 | char **newargz; |
| 4788 | int newargc; |
| 4789 | char *tmp_pathspec; |
| 4790 | char *actual_cwrapper_path; |
| 4791 | char *actual_cwrapper_name; |
| 4792 | char *target_name; |
| 4793 | char *lt_argv_zero; |
| 4794 | intptr_t rval = 127; |
| 4795 | |
| 4796 | int i; |
| 4797 | |
| 4798 | program_name = (char *) xstrdup (base_name (argv[0])); |
cristy | 98dddb5 | 2010-11-04 00:30:15 +0000 | [diff] [blame] | 4799 | newargz = XMALLOC (char *, argc + 1); |
cristy | 3ed852e | 2009-09-05 21:47:34 +0000 | [diff] [blame] | 4800 | |
cristy | 98dddb5 | 2010-11-04 00:30:15 +0000 | [diff] [blame] | 4801 | /* very simple arg parsing; don't want to rely on getopt |
| 4802 | * also, copy all non cwrapper options to newargz, except |
| 4803 | * argz[0], which is handled differently |
| 4804 | */ |
| 4805 | newargc=0; |
cristy | 3ed852e | 2009-09-05 21:47:34 +0000 | [diff] [blame] | 4806 | for (i = 1; i < argc; i++) |
| 4807 | { |
| 4808 | if (strcmp (argv[i], dumpscript_opt) == 0) |
| 4809 | { |
| 4810 | EOF |
| 4811 | case "$host" in |
| 4812 | *mingw* | *cygwin* ) |
| 4813 | # make stdout use "unix" line endings |
| 4814 | echo " setmode(1,_O_BINARY);" |
| 4815 | ;; |
| 4816 | esac |
| 4817 | |
| 4818 | cat <<"EOF" |
cristy | 98dddb5 | 2010-11-04 00:30:15 +0000 | [diff] [blame] | 4819 | lt_dump_script (stdout); |
cristy | 3ed852e | 2009-09-05 21:47:34 +0000 | [diff] [blame] | 4820 | return 0; |
| 4821 | } |
cristy | 98dddb5 | 2010-11-04 00:30:15 +0000 | [diff] [blame] | 4822 | if (strcmp (argv[i], debug_opt) == 0) |
| 4823 | { |
| 4824 | lt_debug = 1; |
| 4825 | continue; |
| 4826 | } |
| 4827 | if (strcmp (argv[i], ltwrapper_option_prefix) == 0) |
| 4828 | { |
| 4829 | /* however, if there is an option in the LTWRAPPER_OPTION_PREFIX |
| 4830 | namespace, but it is not one of the ones we know about and |
| 4831 | have already dealt with, above (inluding dump-script), then |
| 4832 | report an error. Otherwise, targets might begin to believe |
| 4833 | they are allowed to use options in the LTWRAPPER_OPTION_PREFIX |
| 4834 | namespace. The first time any user complains about this, we'll |
| 4835 | need to make LTWRAPPER_OPTION_PREFIX a configure-time option |
| 4836 | or a configure.ac-settable value. |
| 4837 | */ |
| 4838 | lt_fatal (__FILE__, __LINE__, |
| 4839 | "unrecognized %s option: '%s'", |
| 4840 | ltwrapper_option_prefix, argv[i]); |
| 4841 | } |
| 4842 | /* otherwise ... */ |
| 4843 | newargz[++newargc] = xstrdup (argv[i]); |
cristy | 3ed852e | 2009-09-05 21:47:34 +0000 | [diff] [blame] | 4844 | } |
cristy | 98dddb5 | 2010-11-04 00:30:15 +0000 | [diff] [blame] | 4845 | newargz[++newargc] = NULL; |
cristy | 3ed852e | 2009-09-05 21:47:34 +0000 | [diff] [blame] | 4846 | |
cristy | 98dddb5 | 2010-11-04 00:30:15 +0000 | [diff] [blame] | 4847 | EOF |
| 4848 | cat <<EOF |
| 4849 | /* The GNU banner must be the first non-error debug message */ |
| 4850 | lt_debugprintf (__FILE__, __LINE__, "libtool wrapper (GNU $PACKAGE$TIMESTAMP) $VERSION\n"); |
| 4851 | EOF |
| 4852 | cat <<"EOF" |
| 4853 | lt_debugprintf (__FILE__, __LINE__, "(main) argv[0]: %s\n", argv[0]); |
| 4854 | lt_debugprintf (__FILE__, __LINE__, "(main) program_name: %s\n", program_name); |
| 4855 | |
cristy | 3ed852e | 2009-09-05 21:47:34 +0000 | [diff] [blame] | 4856 | tmp_pathspec = find_executable (argv[0]); |
| 4857 | if (tmp_pathspec == NULL) |
cristy | 98dddb5 | 2010-11-04 00:30:15 +0000 | [diff] [blame] | 4858 | lt_fatal (__FILE__, __LINE__, "couldn't find %s", argv[0]); |
| 4859 | lt_debugprintf (__FILE__, __LINE__, |
| 4860 | "(main) found exe (before symlink chase) at: %s\n", |
| 4861 | tmp_pathspec); |
cristy | 3ed852e | 2009-09-05 21:47:34 +0000 | [diff] [blame] | 4862 | |
| 4863 | actual_cwrapper_path = chase_symlinks (tmp_pathspec); |
cristy | 98dddb5 | 2010-11-04 00:30:15 +0000 | [diff] [blame] | 4864 | lt_debugprintf (__FILE__, __LINE__, |
| 4865 | "(main) found exe (after symlink chase) at: %s\n", |
| 4866 | actual_cwrapper_path); |
cristy | 3ed852e | 2009-09-05 21:47:34 +0000 | [diff] [blame] | 4867 | XFREE (tmp_pathspec); |
| 4868 | |
cristy | 98dddb5 | 2010-11-04 00:30:15 +0000 | [diff] [blame] | 4869 | actual_cwrapper_name = xstrdup (base_name (actual_cwrapper_path)); |
cristy | 3ed852e | 2009-09-05 21:47:34 +0000 | [diff] [blame] | 4870 | strendzap (actual_cwrapper_path, actual_cwrapper_name); |
| 4871 | |
| 4872 | /* wrapper name transforms */ |
| 4873 | strendzap (actual_cwrapper_name, ".exe"); |
| 4874 | tmp_pathspec = lt_extend_str (actual_cwrapper_name, ".exe", 1); |
| 4875 | XFREE (actual_cwrapper_name); |
| 4876 | actual_cwrapper_name = tmp_pathspec; |
| 4877 | tmp_pathspec = 0; |
| 4878 | |
| 4879 | /* target_name transforms -- use actual target program name; might have lt- prefix */ |
| 4880 | target_name = xstrdup (base_name (TARGET_PROGRAM_NAME)); |
| 4881 | strendzap (target_name, ".exe"); |
| 4882 | tmp_pathspec = lt_extend_str (target_name, ".exe", 1); |
| 4883 | XFREE (target_name); |
| 4884 | target_name = tmp_pathspec; |
| 4885 | tmp_pathspec = 0; |
| 4886 | |
cristy | 98dddb5 | 2010-11-04 00:30:15 +0000 | [diff] [blame] | 4887 | lt_debugprintf (__FILE__, __LINE__, |
| 4888 | "(main) libtool target name: %s\n", |
| 4889 | target_name); |
cristy | 3ed852e | 2009-09-05 21:47:34 +0000 | [diff] [blame] | 4890 | EOF |
| 4891 | |
| 4892 | cat <<EOF |
| 4893 | newargz[0] = |
| 4894 | XMALLOC (char, (strlen (actual_cwrapper_path) + |
| 4895 | strlen ("$objdir") + 1 + strlen (actual_cwrapper_name) + 1)); |
| 4896 | strcpy (newargz[0], actual_cwrapper_path); |
| 4897 | strcat (newargz[0], "$objdir"); |
| 4898 | strcat (newargz[0], "/"); |
| 4899 | EOF |
| 4900 | |
| 4901 | cat <<"EOF" |
| 4902 | /* stop here, and copy so we don't have to do this twice */ |
| 4903 | tmp_pathspec = xstrdup (newargz[0]); |
| 4904 | |
| 4905 | /* do NOT want the lt- prefix here, so use actual_cwrapper_name */ |
| 4906 | strcat (newargz[0], actual_cwrapper_name); |
| 4907 | |
| 4908 | /* DO want the lt- prefix here if it exists, so use target_name */ |
| 4909 | lt_argv_zero = lt_extend_str (tmp_pathspec, target_name, 1); |
| 4910 | XFREE (tmp_pathspec); |
| 4911 | tmp_pathspec = NULL; |
| 4912 | EOF |
| 4913 | |
| 4914 | case $host_os in |
| 4915 | mingw*) |
| 4916 | cat <<"EOF" |
| 4917 | { |
| 4918 | char* p; |
| 4919 | while ((p = strchr (newargz[0], '\\')) != NULL) |
| 4920 | { |
| 4921 | *p = '/'; |
| 4922 | } |
| 4923 | while ((p = strchr (lt_argv_zero, '\\')) != NULL) |
| 4924 | { |
| 4925 | *p = '/'; |
| 4926 | } |
| 4927 | } |
| 4928 | EOF |
| 4929 | ;; |
| 4930 | esac |
| 4931 | |
| 4932 | cat <<"EOF" |
| 4933 | XFREE (target_name); |
| 4934 | XFREE (actual_cwrapper_path); |
| 4935 | XFREE (actual_cwrapper_name); |
| 4936 | |
| 4937 | lt_setenv ("BIN_SH", "xpg4"); /* for Tru64 */ |
| 4938 | lt_setenv ("DUALCASE", "1"); /* for MSK sh */ |
cristy | da16f16 | 2011-02-19 23:52:17 +0000 | [diff] [blame] | 4939 | /* Update the DLL searchpath. EXE_PATH_VALUE ($dllsearchpath) must |
| 4940 | be prepended before (that is, appear after) LIB_PATH_VALUE ($temp_rpath) |
| 4941 | because on Windows, both *_VARNAMEs are PATH but uninstalled |
| 4942 | libraries must come first. */ |
cristy | 3ed852e | 2009-09-05 21:47:34 +0000 | [diff] [blame] | 4943 | lt_update_exe_path (EXE_PATH_VARNAME, EXE_PATH_VALUE); |
cristy | da16f16 | 2011-02-19 23:52:17 +0000 | [diff] [blame] | 4944 | lt_update_lib_path (LIB_PATH_VARNAME, LIB_PATH_VALUE); |
cristy | 3ed852e | 2009-09-05 21:47:34 +0000 | [diff] [blame] | 4945 | |
cristy | 98dddb5 | 2010-11-04 00:30:15 +0000 | [diff] [blame] | 4946 | lt_debugprintf (__FILE__, __LINE__, "(main) lt_argv_zero: %s\n", |
| 4947 | nonnull (lt_argv_zero)); |
cristy | 3ed852e | 2009-09-05 21:47:34 +0000 | [diff] [blame] | 4948 | for (i = 0; i < newargc; i++) |
| 4949 | { |
cristy | 98dddb5 | 2010-11-04 00:30:15 +0000 | [diff] [blame] | 4950 | lt_debugprintf (__FILE__, __LINE__, "(main) newargz[%d]: %s\n", |
| 4951 | i, nonnull (newargz[i])); |
cristy | 3ed852e | 2009-09-05 21:47:34 +0000 | [diff] [blame] | 4952 | } |
| 4953 | |
| 4954 | EOF |
| 4955 | |
| 4956 | case $host_os in |
| 4957 | mingw*) |
| 4958 | cat <<"EOF" |
| 4959 | /* execv doesn't actually work on mingw as expected on unix */ |
cristy | 98dddb5 | 2010-11-04 00:30:15 +0000 | [diff] [blame] | 4960 | newargz = prepare_spawn (newargz); |
cristy | 3ed852e | 2009-09-05 21:47:34 +0000 | [diff] [blame] | 4961 | rval = _spawnv (_P_WAIT, lt_argv_zero, (const char * const *) newargz); |
| 4962 | if (rval == -1) |
| 4963 | { |
| 4964 | /* failed to start process */ |
cristy | 98dddb5 | 2010-11-04 00:30:15 +0000 | [diff] [blame] | 4965 | lt_debugprintf (__FILE__, __LINE__, |
| 4966 | "(main) failed to launch target \"%s\": %s\n", |
| 4967 | lt_argv_zero, nonnull (strerror (errno))); |
cristy | 3ed852e | 2009-09-05 21:47:34 +0000 | [diff] [blame] | 4968 | return 127; |
| 4969 | } |
| 4970 | return rval; |
| 4971 | EOF |
| 4972 | ;; |
| 4973 | *) |
| 4974 | cat <<"EOF" |
| 4975 | execv (lt_argv_zero, newargz); |
| 4976 | return rval; /* =127, but avoids unused variable warning */ |
| 4977 | EOF |
| 4978 | ;; |
| 4979 | esac |
| 4980 | |
| 4981 | cat <<"EOF" |
| 4982 | } |
| 4983 | |
| 4984 | void * |
| 4985 | xmalloc (size_t num) |
| 4986 | { |
| 4987 | void *p = (void *) malloc (num); |
| 4988 | if (!p) |
cristy | 98dddb5 | 2010-11-04 00:30:15 +0000 | [diff] [blame] | 4989 | lt_fatal (__FILE__, __LINE__, "memory exhausted"); |
cristy | 3ed852e | 2009-09-05 21:47:34 +0000 | [diff] [blame] | 4990 | |
| 4991 | return p; |
| 4992 | } |
| 4993 | |
| 4994 | char * |
| 4995 | xstrdup (const char *string) |
| 4996 | { |
| 4997 | return string ? strcpy ((char *) xmalloc (strlen (string) + 1), |
| 4998 | string) : NULL; |
| 4999 | } |
| 5000 | |
| 5001 | const char * |
| 5002 | base_name (const char *name) |
| 5003 | { |
| 5004 | const char *base; |
| 5005 | |
| 5006 | #if defined (HAVE_DOS_BASED_FILE_SYSTEM) |
| 5007 | /* Skip over the disk name in MSDOS pathnames. */ |
| 5008 | if (isalpha ((unsigned char) name[0]) && name[1] == ':') |
| 5009 | name += 2; |
| 5010 | #endif |
| 5011 | |
| 5012 | for (base = name; *name; name++) |
| 5013 | if (IS_DIR_SEPARATOR (*name)) |
| 5014 | base = name + 1; |
| 5015 | return base; |
| 5016 | } |
| 5017 | |
| 5018 | int |
| 5019 | check_executable (const char *path) |
| 5020 | { |
| 5021 | struct stat st; |
| 5022 | |
cristy | 98dddb5 | 2010-11-04 00:30:15 +0000 | [diff] [blame] | 5023 | lt_debugprintf (__FILE__, __LINE__, "(check_executable): %s\n", |
| 5024 | nonempty (path)); |
cristy | 3ed852e | 2009-09-05 21:47:34 +0000 | [diff] [blame] | 5025 | if ((!path) || (!*path)) |
| 5026 | return 0; |
| 5027 | |
| 5028 | if ((stat (path, &st) >= 0) |
| 5029 | && (st.st_mode & (S_IXUSR | S_IXGRP | S_IXOTH))) |
| 5030 | return 1; |
| 5031 | else |
| 5032 | return 0; |
| 5033 | } |
| 5034 | |
| 5035 | int |
| 5036 | make_executable (const char *path) |
| 5037 | { |
| 5038 | int rval = 0; |
| 5039 | struct stat st; |
| 5040 | |
cristy | 98dddb5 | 2010-11-04 00:30:15 +0000 | [diff] [blame] | 5041 | lt_debugprintf (__FILE__, __LINE__, "(make_executable): %s\n", |
| 5042 | nonempty (path)); |
cristy | 3ed852e | 2009-09-05 21:47:34 +0000 | [diff] [blame] | 5043 | if ((!path) || (!*path)) |
| 5044 | return 0; |
| 5045 | |
| 5046 | if (stat (path, &st) >= 0) |
| 5047 | { |
| 5048 | rval = chmod (path, st.st_mode | S_IXOTH | S_IXGRP | S_IXUSR); |
| 5049 | } |
| 5050 | return rval; |
| 5051 | } |
| 5052 | |
| 5053 | /* Searches for the full path of the wrapper. Returns |
| 5054 | newly allocated full path name if found, NULL otherwise |
| 5055 | Does not chase symlinks, even on platforms that support them. |
| 5056 | */ |
| 5057 | char * |
| 5058 | find_executable (const char *wrapper) |
| 5059 | { |
| 5060 | int has_slash = 0; |
| 5061 | const char *p; |
| 5062 | const char *p_next; |
| 5063 | /* static buffer for getcwd */ |
| 5064 | char tmp[LT_PATHMAX + 1]; |
| 5065 | int tmp_len; |
| 5066 | char *concat_name; |
| 5067 | |
cristy | 98dddb5 | 2010-11-04 00:30:15 +0000 | [diff] [blame] | 5068 | lt_debugprintf (__FILE__, __LINE__, "(find_executable): %s\n", |
| 5069 | nonempty (wrapper)); |
cristy | 3ed852e | 2009-09-05 21:47:34 +0000 | [diff] [blame] | 5070 | |
| 5071 | if ((wrapper == NULL) || (*wrapper == '\0')) |
| 5072 | return NULL; |
| 5073 | |
| 5074 | /* Absolute path? */ |
| 5075 | #if defined (HAVE_DOS_BASED_FILE_SYSTEM) |
| 5076 | if (isalpha ((unsigned char) wrapper[0]) && wrapper[1] == ':') |
| 5077 | { |
| 5078 | concat_name = xstrdup (wrapper); |
| 5079 | if (check_executable (concat_name)) |
| 5080 | return concat_name; |
| 5081 | XFREE (concat_name); |
| 5082 | } |
| 5083 | else |
| 5084 | { |
| 5085 | #endif |
| 5086 | if (IS_DIR_SEPARATOR (wrapper[0])) |
| 5087 | { |
| 5088 | concat_name = xstrdup (wrapper); |
| 5089 | if (check_executable (concat_name)) |
| 5090 | return concat_name; |
| 5091 | XFREE (concat_name); |
| 5092 | } |
| 5093 | #if defined (HAVE_DOS_BASED_FILE_SYSTEM) |
| 5094 | } |
| 5095 | #endif |
| 5096 | |
| 5097 | for (p = wrapper; *p; p++) |
| 5098 | if (*p == '/') |
| 5099 | { |
| 5100 | has_slash = 1; |
| 5101 | break; |
| 5102 | } |
| 5103 | if (!has_slash) |
| 5104 | { |
| 5105 | /* no slashes; search PATH */ |
| 5106 | const char *path = getenv ("PATH"); |
| 5107 | if (path != NULL) |
| 5108 | { |
| 5109 | for (p = path; *p; p = p_next) |
| 5110 | { |
| 5111 | const char *q; |
| 5112 | size_t p_len; |
| 5113 | for (q = p; *q; q++) |
| 5114 | if (IS_PATH_SEPARATOR (*q)) |
| 5115 | break; |
| 5116 | p_len = q - p; |
| 5117 | p_next = (*q == '\0' ? q : q + 1); |
| 5118 | if (p_len == 0) |
| 5119 | { |
| 5120 | /* empty path: current directory */ |
| 5121 | if (getcwd (tmp, LT_PATHMAX) == NULL) |
cristy | 98dddb5 | 2010-11-04 00:30:15 +0000 | [diff] [blame] | 5122 | lt_fatal (__FILE__, __LINE__, "getcwd failed: %s", |
| 5123 | nonnull (strerror (errno))); |
cristy | 3ed852e | 2009-09-05 21:47:34 +0000 | [diff] [blame] | 5124 | tmp_len = strlen (tmp); |
| 5125 | concat_name = |
| 5126 | XMALLOC (char, tmp_len + 1 + strlen (wrapper) + 1); |
| 5127 | memcpy (concat_name, tmp, tmp_len); |
| 5128 | concat_name[tmp_len] = '/'; |
| 5129 | strcpy (concat_name + tmp_len + 1, wrapper); |
| 5130 | } |
| 5131 | else |
| 5132 | { |
| 5133 | concat_name = |
| 5134 | XMALLOC (char, p_len + 1 + strlen (wrapper) + 1); |
| 5135 | memcpy (concat_name, p, p_len); |
| 5136 | concat_name[p_len] = '/'; |
| 5137 | strcpy (concat_name + p_len + 1, wrapper); |
| 5138 | } |
| 5139 | if (check_executable (concat_name)) |
| 5140 | return concat_name; |
| 5141 | XFREE (concat_name); |
| 5142 | } |
| 5143 | } |
| 5144 | /* not found in PATH; assume curdir */ |
| 5145 | } |
| 5146 | /* Relative path | not found in path: prepend cwd */ |
| 5147 | if (getcwd (tmp, LT_PATHMAX) == NULL) |
cristy | 98dddb5 | 2010-11-04 00:30:15 +0000 | [diff] [blame] | 5148 | lt_fatal (__FILE__, __LINE__, "getcwd failed: %s", |
| 5149 | nonnull (strerror (errno))); |
cristy | 3ed852e | 2009-09-05 21:47:34 +0000 | [diff] [blame] | 5150 | tmp_len = strlen (tmp); |
| 5151 | concat_name = XMALLOC (char, tmp_len + 1 + strlen (wrapper) + 1); |
| 5152 | memcpy (concat_name, tmp, tmp_len); |
| 5153 | concat_name[tmp_len] = '/'; |
| 5154 | strcpy (concat_name + tmp_len + 1, wrapper); |
| 5155 | |
| 5156 | if (check_executable (concat_name)) |
| 5157 | return concat_name; |
| 5158 | XFREE (concat_name); |
| 5159 | return NULL; |
| 5160 | } |
| 5161 | |
| 5162 | char * |
| 5163 | chase_symlinks (const char *pathspec) |
| 5164 | { |
| 5165 | #ifndef S_ISLNK |
| 5166 | return xstrdup (pathspec); |
| 5167 | #else |
| 5168 | char buf[LT_PATHMAX]; |
| 5169 | struct stat s; |
| 5170 | char *tmp_pathspec = xstrdup (pathspec); |
| 5171 | char *p; |
| 5172 | int has_symlinks = 0; |
| 5173 | while (strlen (tmp_pathspec) && !has_symlinks) |
| 5174 | { |
cristy | 98dddb5 | 2010-11-04 00:30:15 +0000 | [diff] [blame] | 5175 | lt_debugprintf (__FILE__, __LINE__, |
| 5176 | "checking path component for symlinks: %s\n", |
| 5177 | tmp_pathspec); |
cristy | 3ed852e | 2009-09-05 21:47:34 +0000 | [diff] [blame] | 5178 | if (lstat (tmp_pathspec, &s) == 0) |
| 5179 | { |
| 5180 | if (S_ISLNK (s.st_mode) != 0) |
| 5181 | { |
| 5182 | has_symlinks = 1; |
| 5183 | break; |
| 5184 | } |
| 5185 | |
| 5186 | /* search backwards for last DIR_SEPARATOR */ |
| 5187 | p = tmp_pathspec + strlen (tmp_pathspec) - 1; |
| 5188 | while ((p > tmp_pathspec) && (!IS_DIR_SEPARATOR (*p))) |
| 5189 | p--; |
| 5190 | if ((p == tmp_pathspec) && (!IS_DIR_SEPARATOR (*p))) |
| 5191 | { |
| 5192 | /* no more DIR_SEPARATORS left */ |
| 5193 | break; |
| 5194 | } |
| 5195 | *p = '\0'; |
| 5196 | } |
| 5197 | else |
| 5198 | { |
cristy | 98dddb5 | 2010-11-04 00:30:15 +0000 | [diff] [blame] | 5199 | lt_fatal (__FILE__, __LINE__, |
| 5200 | "error accessing file \"%s\": %s", |
| 5201 | tmp_pathspec, nonnull (strerror (errno))); |
cristy | 3ed852e | 2009-09-05 21:47:34 +0000 | [diff] [blame] | 5202 | } |
| 5203 | } |
| 5204 | XFREE (tmp_pathspec); |
| 5205 | |
| 5206 | if (!has_symlinks) |
| 5207 | { |
| 5208 | return xstrdup (pathspec); |
| 5209 | } |
| 5210 | |
| 5211 | tmp_pathspec = realpath (pathspec, buf); |
| 5212 | if (tmp_pathspec == 0) |
| 5213 | { |
cristy | 98dddb5 | 2010-11-04 00:30:15 +0000 | [diff] [blame] | 5214 | lt_fatal (__FILE__, __LINE__, |
| 5215 | "could not follow symlinks for %s", pathspec); |
cristy | 3ed852e | 2009-09-05 21:47:34 +0000 | [diff] [blame] | 5216 | } |
| 5217 | return xstrdup (tmp_pathspec); |
| 5218 | #endif |
| 5219 | } |
| 5220 | |
| 5221 | char * |
| 5222 | strendzap (char *str, const char *pat) |
| 5223 | { |
| 5224 | size_t len, patlen; |
| 5225 | |
| 5226 | assert (str != NULL); |
| 5227 | assert (pat != NULL); |
| 5228 | |
| 5229 | len = strlen (str); |
| 5230 | patlen = strlen (pat); |
| 5231 | |
| 5232 | if (patlen <= len) |
| 5233 | { |
| 5234 | str += len - patlen; |
| 5235 | if (strcmp (str, pat) == 0) |
| 5236 | *str = '\0'; |
| 5237 | } |
| 5238 | return str; |
| 5239 | } |
| 5240 | |
cristy | 98dddb5 | 2010-11-04 00:30:15 +0000 | [diff] [blame] | 5241 | void |
| 5242 | lt_debugprintf (const char *file, int line, const char *fmt, ...) |
| 5243 | { |
| 5244 | va_list args; |
| 5245 | if (lt_debug) |
| 5246 | { |
| 5247 | (void) fprintf (stderr, "%s:%s:%d: ", program_name, file, line); |
| 5248 | va_start (args, fmt); |
| 5249 | (void) vfprintf (stderr, fmt, args); |
| 5250 | va_end (args); |
| 5251 | } |
| 5252 | } |
| 5253 | |
cristy | 3ed852e | 2009-09-05 21:47:34 +0000 | [diff] [blame] | 5254 | static void |
cristy | 98dddb5 | 2010-11-04 00:30:15 +0000 | [diff] [blame] | 5255 | lt_error_core (int exit_status, const char *file, |
| 5256 | int line, const char *mode, |
cristy | 3ed852e | 2009-09-05 21:47:34 +0000 | [diff] [blame] | 5257 | const char *message, va_list ap) |
| 5258 | { |
cristy | 98dddb5 | 2010-11-04 00:30:15 +0000 | [diff] [blame] | 5259 | fprintf (stderr, "%s:%s:%d: %s: ", program_name, file, line, mode); |
cristy | 3ed852e | 2009-09-05 21:47:34 +0000 | [diff] [blame] | 5260 | vfprintf (stderr, message, ap); |
| 5261 | fprintf (stderr, ".\n"); |
| 5262 | |
| 5263 | if (exit_status >= 0) |
| 5264 | exit (exit_status); |
| 5265 | } |
| 5266 | |
| 5267 | void |
cristy | 98dddb5 | 2010-11-04 00:30:15 +0000 | [diff] [blame] | 5268 | lt_fatal (const char *file, int line, const char *message, ...) |
cristy | 3ed852e | 2009-09-05 21:47:34 +0000 | [diff] [blame] | 5269 | { |
| 5270 | va_list ap; |
| 5271 | va_start (ap, message); |
cristy | 98dddb5 | 2010-11-04 00:30:15 +0000 | [diff] [blame] | 5272 | lt_error_core (EXIT_FAILURE, file, line, "FATAL", message, ap); |
cristy | 3ed852e | 2009-09-05 21:47:34 +0000 | [diff] [blame] | 5273 | va_end (ap); |
| 5274 | } |
| 5275 | |
cristy | 98dddb5 | 2010-11-04 00:30:15 +0000 | [diff] [blame] | 5276 | static const char * |
| 5277 | nonnull (const char *s) |
| 5278 | { |
| 5279 | return s ? s : "(null)"; |
| 5280 | } |
| 5281 | |
| 5282 | static const char * |
| 5283 | nonempty (const char *s) |
| 5284 | { |
| 5285 | return (s && !*s) ? "(empty)" : nonnull (s); |
| 5286 | } |
| 5287 | |
cristy | 3ed852e | 2009-09-05 21:47:34 +0000 | [diff] [blame] | 5288 | void |
| 5289 | lt_setenv (const char *name, const char *value) |
| 5290 | { |
cristy | 98dddb5 | 2010-11-04 00:30:15 +0000 | [diff] [blame] | 5291 | lt_debugprintf (__FILE__, __LINE__, |
| 5292 | "(lt_setenv) setting '%s' to '%s'\n", |
| 5293 | nonnull (name), nonnull (value)); |
cristy | 3ed852e | 2009-09-05 21:47:34 +0000 | [diff] [blame] | 5294 | { |
| 5295 | #ifdef HAVE_SETENV |
| 5296 | /* always make a copy, for consistency with !HAVE_SETENV */ |
| 5297 | char *str = xstrdup (value); |
| 5298 | setenv (name, str, 1); |
| 5299 | #else |
| 5300 | int len = strlen (name) + 1 + strlen (value) + 1; |
| 5301 | char *str = XMALLOC (char, len); |
| 5302 | sprintf (str, "%s=%s", name, value); |
| 5303 | if (putenv (str) != EXIT_SUCCESS) |
| 5304 | { |
| 5305 | XFREE (str); |
| 5306 | } |
| 5307 | #endif |
| 5308 | } |
| 5309 | } |
| 5310 | |
| 5311 | char * |
| 5312 | lt_extend_str (const char *orig_value, const char *add, int to_end) |
| 5313 | { |
| 5314 | char *new_value; |
| 5315 | if (orig_value && *orig_value) |
| 5316 | { |
| 5317 | int orig_value_len = strlen (orig_value); |
| 5318 | int add_len = strlen (add); |
| 5319 | new_value = XMALLOC (char, add_len + orig_value_len + 1); |
| 5320 | if (to_end) |
| 5321 | { |
| 5322 | strcpy (new_value, orig_value); |
| 5323 | strcpy (new_value + orig_value_len, add); |
| 5324 | } |
| 5325 | else |
| 5326 | { |
| 5327 | strcpy (new_value, add); |
| 5328 | strcpy (new_value + add_len, orig_value); |
| 5329 | } |
| 5330 | } |
| 5331 | else |
| 5332 | { |
| 5333 | new_value = xstrdup (add); |
| 5334 | } |
| 5335 | return new_value; |
| 5336 | } |
| 5337 | |
cristy | 3ed852e | 2009-09-05 21:47:34 +0000 | [diff] [blame] | 5338 | void |
| 5339 | lt_update_exe_path (const char *name, const char *value) |
| 5340 | { |
cristy | 98dddb5 | 2010-11-04 00:30:15 +0000 | [diff] [blame] | 5341 | lt_debugprintf (__FILE__, __LINE__, |
| 5342 | "(lt_update_exe_path) modifying '%s' by prepending '%s'\n", |
| 5343 | nonnull (name), nonnull (value)); |
cristy | 3ed852e | 2009-09-05 21:47:34 +0000 | [diff] [blame] | 5344 | |
| 5345 | if (name && *name && value && *value) |
| 5346 | { |
| 5347 | char *new_value = lt_extend_str (getenv (name), value, 0); |
| 5348 | /* some systems can't cope with a ':'-terminated path #' */ |
| 5349 | int len = strlen (new_value); |
| 5350 | while (((len = strlen (new_value)) > 0) && IS_PATH_SEPARATOR (new_value[len-1])) |
| 5351 | { |
| 5352 | new_value[len-1] = '\0'; |
| 5353 | } |
| 5354 | lt_setenv (name, new_value); |
| 5355 | XFREE (new_value); |
| 5356 | } |
| 5357 | } |
| 5358 | |
| 5359 | void |
| 5360 | lt_update_lib_path (const char *name, const char *value) |
| 5361 | { |
cristy | 98dddb5 | 2010-11-04 00:30:15 +0000 | [diff] [blame] | 5362 | lt_debugprintf (__FILE__, __LINE__, |
| 5363 | "(lt_update_lib_path) modifying '%s' by prepending '%s'\n", |
| 5364 | nonnull (name), nonnull (value)); |
cristy | 3ed852e | 2009-09-05 21:47:34 +0000 | [diff] [blame] | 5365 | |
| 5366 | if (name && *name && value && *value) |
| 5367 | { |
| 5368 | char *new_value = lt_extend_str (getenv (name), value, 0); |
| 5369 | lt_setenv (name, new_value); |
| 5370 | XFREE (new_value); |
| 5371 | } |
| 5372 | } |
| 5373 | |
cristy | 98dddb5 | 2010-11-04 00:30:15 +0000 | [diff] [blame] | 5374 | EOF |
| 5375 | case $host_os in |
| 5376 | mingw*) |
| 5377 | cat <<"EOF" |
cristy | 3ed852e | 2009-09-05 21:47:34 +0000 | [diff] [blame] | 5378 | |
cristy | 98dddb5 | 2010-11-04 00:30:15 +0000 | [diff] [blame] | 5379 | /* Prepares an argument vector before calling spawn(). |
| 5380 | Note that spawn() does not by itself call the command interpreter |
| 5381 | (getenv ("COMSPEC") != NULL ? getenv ("COMSPEC") : |
| 5382 | ({ OSVERSIONINFO v; v.dwOSVersionInfoSize = sizeof(OSVERSIONINFO); |
| 5383 | GetVersionEx(&v); |
| 5384 | v.dwPlatformId == VER_PLATFORM_WIN32_NT; |
| 5385 | }) ? "cmd.exe" : "command.com"). |
| 5386 | Instead it simply concatenates the arguments, separated by ' ', and calls |
| 5387 | CreateProcess(). We must quote the arguments since Win32 CreateProcess() |
| 5388 | interprets characters like ' ', '\t', '\\', '"' (but not '<' and '>') in a |
| 5389 | special way: |
| 5390 | - Space and tab are interpreted as delimiters. They are not treated as |
| 5391 | delimiters if they are surrounded by double quotes: "...". |
| 5392 | - Unescaped double quotes are removed from the input. Their only effect is |
| 5393 | that within double quotes, space and tab are treated like normal |
| 5394 | characters. |
| 5395 | - Backslashes not followed by double quotes are not special. |
| 5396 | - But 2*n+1 backslashes followed by a double quote become |
| 5397 | n backslashes followed by a double quote (n >= 0): |
| 5398 | \" -> " |
| 5399 | \\\" -> \" |
| 5400 | \\\\\" -> \\" |
| 5401 | */ |
| 5402 | #define SHELL_SPECIAL_CHARS "\"\\ \001\002\003\004\005\006\007\010\011\012\013\014\015\016\017\020\021\022\023\024\025\026\027\030\031\032\033\034\035\036\037" |
| 5403 | #define SHELL_SPACE_CHARS " \001\002\003\004\005\006\007\010\011\012\013\014\015\016\017\020\021\022\023\024\025\026\027\030\031\032\033\034\035\036\037" |
| 5404 | char ** |
| 5405 | prepare_spawn (char **argv) |
| 5406 | { |
| 5407 | size_t argc; |
| 5408 | char **new_argv; |
| 5409 | size_t i; |
| 5410 | |
| 5411 | /* Count number of arguments. */ |
| 5412 | for (argc = 0; argv[argc] != NULL; argc++) |
| 5413 | ; |
| 5414 | |
| 5415 | /* Allocate new argument vector. */ |
| 5416 | new_argv = XMALLOC (char *, argc + 1); |
| 5417 | |
| 5418 | /* Put quoted arguments into the new argument vector. */ |
| 5419 | for (i = 0; i < argc; i++) |
| 5420 | { |
| 5421 | const char *string = argv[i]; |
| 5422 | |
| 5423 | if (string[0] == '\0') |
| 5424 | new_argv[i] = xstrdup ("\"\""); |
| 5425 | else if (strpbrk (string, SHELL_SPECIAL_CHARS) != NULL) |
| 5426 | { |
| 5427 | int quote_around = (strpbrk (string, SHELL_SPACE_CHARS) != NULL); |
| 5428 | size_t length; |
| 5429 | unsigned int backslashes; |
| 5430 | const char *s; |
| 5431 | char *quoted_string; |
| 5432 | char *p; |
| 5433 | |
| 5434 | length = 0; |
| 5435 | backslashes = 0; |
| 5436 | if (quote_around) |
| 5437 | length++; |
| 5438 | for (s = string; *s != '\0'; s++) |
| 5439 | { |
| 5440 | char c = *s; |
| 5441 | if (c == '"') |
| 5442 | length += backslashes + 1; |
| 5443 | length++; |
| 5444 | if (c == '\\') |
| 5445 | backslashes++; |
| 5446 | else |
| 5447 | backslashes = 0; |
| 5448 | } |
| 5449 | if (quote_around) |
| 5450 | length += backslashes + 1; |
| 5451 | |
| 5452 | quoted_string = XMALLOC (char, length + 1); |
| 5453 | |
| 5454 | p = quoted_string; |
| 5455 | backslashes = 0; |
| 5456 | if (quote_around) |
| 5457 | *p++ = '"'; |
| 5458 | for (s = string; *s != '\0'; s++) |
| 5459 | { |
| 5460 | char c = *s; |
| 5461 | if (c == '"') |
| 5462 | { |
| 5463 | unsigned int j; |
| 5464 | for (j = backslashes + 1; j > 0; j--) |
| 5465 | *p++ = '\\'; |
| 5466 | } |
| 5467 | *p++ = c; |
| 5468 | if (c == '\\') |
| 5469 | backslashes++; |
| 5470 | else |
| 5471 | backslashes = 0; |
| 5472 | } |
| 5473 | if (quote_around) |
| 5474 | { |
| 5475 | unsigned int j; |
| 5476 | for (j = backslashes; j > 0; j--) |
| 5477 | *p++ = '\\'; |
| 5478 | *p++ = '"'; |
| 5479 | } |
| 5480 | *p = '\0'; |
| 5481 | |
| 5482 | new_argv[i] = quoted_string; |
| 5483 | } |
| 5484 | else |
| 5485 | new_argv[i] = (char *) string; |
| 5486 | } |
| 5487 | new_argv[argc] = NULL; |
| 5488 | |
| 5489 | return new_argv; |
| 5490 | } |
| 5491 | EOF |
| 5492 | ;; |
| 5493 | esac |
| 5494 | |
| 5495 | cat <<"EOF" |
| 5496 | void lt_dump_script (FILE* f) |
| 5497 | { |
| 5498 | EOF |
| 5499 | func_emit_wrapper yes | |
| 5500 | $SED -e 's/\([\\"]\)/\\\1/g' \ |
| 5501 | -e 's/^/ fputs ("/' -e 's/$/\\n", f);/' |
| 5502 | |
| 5503 | cat <<"EOF" |
| 5504 | } |
cristy | 3ed852e | 2009-09-05 21:47:34 +0000 | [diff] [blame] | 5505 | EOF |
| 5506 | } |
| 5507 | # end: func_emit_cwrapperexe_src |
| 5508 | |
cristy | 98dddb5 | 2010-11-04 00:30:15 +0000 | [diff] [blame] | 5509 | # func_win32_import_lib_p ARG |
| 5510 | # True if ARG is an import lib, as indicated by $file_magic_cmd |
| 5511 | func_win32_import_lib_p () |
| 5512 | { |
| 5513 | $opt_debug |
| 5514 | case `eval $file_magic_cmd \"\$1\" 2>/dev/null | $SED -e 10q` in |
| 5515 | *import*) : ;; |
| 5516 | *) false ;; |
| 5517 | esac |
| 5518 | } |
| 5519 | |
cristy | 3ed852e | 2009-09-05 21:47:34 +0000 | [diff] [blame] | 5520 | # func_mode_link arg... |
| 5521 | func_mode_link () |
| 5522 | { |
| 5523 | $opt_debug |
| 5524 | case $host in |
| 5525 | *-*-cygwin* | *-*-mingw* | *-*-pw32* | *-*-os2* | *-cegcc*) |
| 5526 | # It is impossible to link a dll without this setting, and |
| 5527 | # we shouldn't force the makefile maintainer to figure out |
| 5528 | # which system we are compiling for in order to pass an extra |
| 5529 | # flag for every libtool invocation. |
| 5530 | # allow_undefined=no |
| 5531 | |
| 5532 | # FIXME: Unfortunately, there are problems with the above when trying |
| 5533 | # to make a dll which has undefined symbols, in which case not |
| 5534 | # even a static library is built. For now, we need to specify |
| 5535 | # -no-undefined on the libtool link line when we can be certain |
| 5536 | # that all symbols are satisfied, otherwise we get a static library. |
| 5537 | allow_undefined=yes |
| 5538 | ;; |
| 5539 | *) |
| 5540 | allow_undefined=yes |
| 5541 | ;; |
| 5542 | esac |
| 5543 | libtool_args=$nonopt |
| 5544 | base_compile="$nonopt $@" |
| 5545 | compile_command=$nonopt |
| 5546 | finalize_command=$nonopt |
| 5547 | |
| 5548 | compile_rpath= |
| 5549 | finalize_rpath= |
| 5550 | compile_shlibpath= |
| 5551 | finalize_shlibpath= |
| 5552 | convenience= |
| 5553 | old_convenience= |
| 5554 | deplibs= |
| 5555 | old_deplibs= |
| 5556 | compiler_flags= |
| 5557 | linker_flags= |
| 5558 | dllsearchpath= |
| 5559 | lib_search_path=`pwd` |
| 5560 | inst_prefix_dir= |
| 5561 | new_inherited_linker_flags= |
| 5562 | |
| 5563 | avoid_version=no |
cristy | 98dddb5 | 2010-11-04 00:30:15 +0000 | [diff] [blame] | 5564 | bindir= |
cristy | 3ed852e | 2009-09-05 21:47:34 +0000 | [diff] [blame] | 5565 | dlfiles= |
| 5566 | dlprefiles= |
| 5567 | dlself=no |
| 5568 | export_dynamic=no |
| 5569 | export_symbols= |
| 5570 | export_symbols_regex= |
| 5571 | generated= |
| 5572 | libobjs= |
| 5573 | ltlibs= |
| 5574 | module=no |
| 5575 | no_install=no |
| 5576 | objs= |
| 5577 | non_pic_objects= |
| 5578 | precious_files_regex= |
| 5579 | prefer_static_libs=no |
| 5580 | preload=no |
| 5581 | prev= |
| 5582 | prevarg= |
| 5583 | release= |
| 5584 | rpath= |
| 5585 | xrpath= |
| 5586 | perm_rpath= |
| 5587 | temp_rpath= |
| 5588 | thread_safe=no |
| 5589 | vinfo= |
| 5590 | vinfo_number=no |
| 5591 | weak_libs= |
| 5592 | single_module="${wl}-single_module" |
| 5593 | func_infer_tag $base_compile |
| 5594 | |
| 5595 | # We need to know -static, to get the right output filenames. |
| 5596 | for arg |
| 5597 | do |
| 5598 | case $arg in |
| 5599 | -shared) |
| 5600 | test "$build_libtool_libs" != yes && \ |
| 5601 | func_fatal_configuration "can not build a shared library" |
| 5602 | build_old_libs=no |
| 5603 | break |
| 5604 | ;; |
| 5605 | -all-static | -static | -static-libtool-libs) |
| 5606 | case $arg in |
| 5607 | -all-static) |
| 5608 | if test "$build_libtool_libs" = yes && test -z "$link_static_flag"; then |
| 5609 | func_warning "complete static linking is impossible in this configuration" |
| 5610 | fi |
| 5611 | if test -n "$link_static_flag"; then |
| 5612 | dlopen_self=$dlopen_self_static |
| 5613 | fi |
| 5614 | prefer_static_libs=yes |
| 5615 | ;; |
| 5616 | -static) |
| 5617 | if test -z "$pic_flag" && test -n "$link_static_flag"; then |
| 5618 | dlopen_self=$dlopen_self_static |
| 5619 | fi |
| 5620 | prefer_static_libs=built |
| 5621 | ;; |
| 5622 | -static-libtool-libs) |
| 5623 | if test -z "$pic_flag" && test -n "$link_static_flag"; then |
| 5624 | dlopen_self=$dlopen_self_static |
| 5625 | fi |
| 5626 | prefer_static_libs=yes |
| 5627 | ;; |
| 5628 | esac |
| 5629 | build_libtool_libs=no |
| 5630 | build_old_libs=yes |
| 5631 | break |
| 5632 | ;; |
| 5633 | esac |
| 5634 | done |
| 5635 | |
| 5636 | # See if our shared archives depend on static archives. |
| 5637 | test -n "$old_archive_from_new_cmds" && build_old_libs=yes |
| 5638 | |
| 5639 | # Go through the arguments, transforming them on the way. |
| 5640 | while test "$#" -gt 0; do |
| 5641 | arg="$1" |
| 5642 | shift |
| 5643 | func_quote_for_eval "$arg" |
| 5644 | qarg=$func_quote_for_eval_unquoted_result |
cristy | da16f16 | 2011-02-19 23:52:17 +0000 | [diff] [blame] | 5645 | libtool_args+=" $func_quote_for_eval_result" |
cristy | 3ed852e | 2009-09-05 21:47:34 +0000 | [diff] [blame] | 5646 | |
| 5647 | # If the previous option needs an argument, assign it. |
| 5648 | if test -n "$prev"; then |
| 5649 | case $prev in |
| 5650 | output) |
cristy | da16f16 | 2011-02-19 23:52:17 +0000 | [diff] [blame] | 5651 | compile_command+=" @OUTPUT@" |
| 5652 | finalize_command+=" @OUTPUT@" |
cristy | 3ed852e | 2009-09-05 21:47:34 +0000 | [diff] [blame] | 5653 | ;; |
| 5654 | esac |
| 5655 | |
| 5656 | case $prev in |
cristy | 98dddb5 | 2010-11-04 00:30:15 +0000 | [diff] [blame] | 5657 | bindir) |
| 5658 | bindir="$arg" |
| 5659 | prev= |
| 5660 | continue |
| 5661 | ;; |
cristy | 3ed852e | 2009-09-05 21:47:34 +0000 | [diff] [blame] | 5662 | dlfiles|dlprefiles) |
| 5663 | if test "$preload" = no; then |
| 5664 | # Add the symbol object into the linking commands. |
cristy | da16f16 | 2011-02-19 23:52:17 +0000 | [diff] [blame] | 5665 | compile_command+=" @SYMFILE@" |
| 5666 | finalize_command+=" @SYMFILE@" |
cristy | 3ed852e | 2009-09-05 21:47:34 +0000 | [diff] [blame] | 5667 | preload=yes |
| 5668 | fi |
| 5669 | case $arg in |
| 5670 | *.la | *.lo) ;; # We handle these cases below. |
| 5671 | force) |
| 5672 | if test "$dlself" = no; then |
| 5673 | dlself=needless |
| 5674 | export_dynamic=yes |
| 5675 | fi |
| 5676 | prev= |
| 5677 | continue |
| 5678 | ;; |
| 5679 | self) |
| 5680 | if test "$prev" = dlprefiles; then |
| 5681 | dlself=yes |
| 5682 | elif test "$prev" = dlfiles && test "$dlopen_self" != yes; then |
| 5683 | dlself=yes |
| 5684 | else |
| 5685 | dlself=needless |
| 5686 | export_dynamic=yes |
| 5687 | fi |
| 5688 | prev= |
| 5689 | continue |
| 5690 | ;; |
| 5691 | *) |
| 5692 | if test "$prev" = dlfiles; then |
cristy | da16f16 | 2011-02-19 23:52:17 +0000 | [diff] [blame] | 5693 | dlfiles+=" $arg" |
cristy | 3ed852e | 2009-09-05 21:47:34 +0000 | [diff] [blame] | 5694 | else |
cristy | da16f16 | 2011-02-19 23:52:17 +0000 | [diff] [blame] | 5695 | dlprefiles+=" $arg" |
cristy | 3ed852e | 2009-09-05 21:47:34 +0000 | [diff] [blame] | 5696 | fi |
| 5697 | prev= |
| 5698 | continue |
| 5699 | ;; |
| 5700 | esac |
| 5701 | ;; |
| 5702 | expsyms) |
| 5703 | export_symbols="$arg" |
| 5704 | test -f "$arg" \ |
| 5705 | || func_fatal_error "symbol file \`$arg' does not exist" |
| 5706 | prev= |
| 5707 | continue |
| 5708 | ;; |
| 5709 | expsyms_regex) |
| 5710 | export_symbols_regex="$arg" |
| 5711 | prev= |
| 5712 | continue |
| 5713 | ;; |
| 5714 | framework) |
| 5715 | case $host in |
| 5716 | *-*-darwin*) |
| 5717 | case "$deplibs " in |
| 5718 | *" $qarg.ltframework "*) ;; |
cristy | da16f16 | 2011-02-19 23:52:17 +0000 | [diff] [blame] | 5719 | *) deplibs+=" $qarg.ltframework" # this is fixed later |
cristy | 3ed852e | 2009-09-05 21:47:34 +0000 | [diff] [blame] | 5720 | ;; |
| 5721 | esac |
| 5722 | ;; |
| 5723 | esac |
| 5724 | prev= |
| 5725 | continue |
| 5726 | ;; |
| 5727 | inst_prefix) |
| 5728 | inst_prefix_dir="$arg" |
| 5729 | prev= |
| 5730 | continue |
| 5731 | ;; |
| 5732 | objectlist) |
| 5733 | if test -f "$arg"; then |
| 5734 | save_arg=$arg |
| 5735 | moreargs= |
| 5736 | for fil in `cat "$save_arg"` |
| 5737 | do |
cristy | da16f16 | 2011-02-19 23:52:17 +0000 | [diff] [blame] | 5738 | # moreargs+=" $fil" |
cristy | 3ed852e | 2009-09-05 21:47:34 +0000 | [diff] [blame] | 5739 | arg=$fil |
| 5740 | # A libtool-controlled object. |
| 5741 | |
| 5742 | # Check to see that this really is a libtool object. |
| 5743 | if func_lalib_unsafe_p "$arg"; then |
| 5744 | pic_object= |
| 5745 | non_pic_object= |
| 5746 | |
| 5747 | # Read the .lo file |
| 5748 | func_source "$arg" |
| 5749 | |
| 5750 | if test -z "$pic_object" || |
| 5751 | test -z "$non_pic_object" || |
| 5752 | test "$pic_object" = none && |
| 5753 | test "$non_pic_object" = none; then |
| 5754 | func_fatal_error "cannot find name of object for \`$arg'" |
| 5755 | fi |
| 5756 | |
| 5757 | # Extract subdirectory from the argument. |
| 5758 | func_dirname "$arg" "/" "" |
| 5759 | xdir="$func_dirname_result" |
| 5760 | |
| 5761 | if test "$pic_object" != none; then |
| 5762 | # Prepend the subdirectory the object is found in. |
| 5763 | pic_object="$xdir$pic_object" |
| 5764 | |
| 5765 | if test "$prev" = dlfiles; then |
| 5766 | if test "$build_libtool_libs" = yes && test "$dlopen_support" = yes; then |
cristy | da16f16 | 2011-02-19 23:52:17 +0000 | [diff] [blame] | 5767 | dlfiles+=" $pic_object" |
cristy | 3ed852e | 2009-09-05 21:47:34 +0000 | [diff] [blame] | 5768 | prev= |
| 5769 | continue |
| 5770 | else |
| 5771 | # If libtool objects are unsupported, then we need to preload. |
| 5772 | prev=dlprefiles |
| 5773 | fi |
| 5774 | fi |
| 5775 | |
| 5776 | # CHECK ME: I think I busted this. -Ossama |
| 5777 | if test "$prev" = dlprefiles; then |
| 5778 | # Preload the old-style object. |
cristy | da16f16 | 2011-02-19 23:52:17 +0000 | [diff] [blame] | 5779 | dlprefiles+=" $pic_object" |
cristy | 3ed852e | 2009-09-05 21:47:34 +0000 | [diff] [blame] | 5780 | prev= |
| 5781 | fi |
| 5782 | |
| 5783 | # A PIC object. |
cristy | da16f16 | 2011-02-19 23:52:17 +0000 | [diff] [blame] | 5784 | libobjs+=" $pic_object" |
cristy | 3ed852e | 2009-09-05 21:47:34 +0000 | [diff] [blame] | 5785 | arg="$pic_object" |
| 5786 | fi |
| 5787 | |
| 5788 | # Non-PIC object. |
| 5789 | if test "$non_pic_object" != none; then |
| 5790 | # Prepend the subdirectory the object is found in. |
| 5791 | non_pic_object="$xdir$non_pic_object" |
| 5792 | |
| 5793 | # A standard non-PIC object |
cristy | da16f16 | 2011-02-19 23:52:17 +0000 | [diff] [blame] | 5794 | non_pic_objects+=" $non_pic_object" |
cristy | 3ed852e | 2009-09-05 21:47:34 +0000 | [diff] [blame] | 5795 | if test -z "$pic_object" || test "$pic_object" = none ; then |
| 5796 | arg="$non_pic_object" |
| 5797 | fi |
| 5798 | else |
| 5799 | # If the PIC object exists, use it instead. |
| 5800 | # $xdir was prepended to $pic_object above. |
| 5801 | non_pic_object="$pic_object" |
cristy | da16f16 | 2011-02-19 23:52:17 +0000 | [diff] [blame] | 5802 | non_pic_objects+=" $non_pic_object" |
cristy | 3ed852e | 2009-09-05 21:47:34 +0000 | [diff] [blame] | 5803 | fi |
| 5804 | else |
| 5805 | # Only an error if not doing a dry-run. |
| 5806 | if $opt_dry_run; then |
| 5807 | # Extract subdirectory from the argument. |
| 5808 | func_dirname "$arg" "/" "" |
| 5809 | xdir="$func_dirname_result" |
| 5810 | |
| 5811 | func_lo2o "$arg" |
| 5812 | pic_object=$xdir$objdir/$func_lo2o_result |
| 5813 | non_pic_object=$xdir$func_lo2o_result |
cristy | da16f16 | 2011-02-19 23:52:17 +0000 | [diff] [blame] | 5814 | libobjs+=" $pic_object" |
| 5815 | non_pic_objects+=" $non_pic_object" |
cristy | 3ed852e | 2009-09-05 21:47:34 +0000 | [diff] [blame] | 5816 | else |
| 5817 | func_fatal_error "\`$arg' is not a valid libtool object" |
| 5818 | fi |
| 5819 | fi |
| 5820 | done |
| 5821 | else |
| 5822 | func_fatal_error "link input file \`$arg' does not exist" |
| 5823 | fi |
| 5824 | arg=$save_arg |
| 5825 | prev= |
| 5826 | continue |
| 5827 | ;; |
| 5828 | precious_regex) |
| 5829 | precious_files_regex="$arg" |
| 5830 | prev= |
| 5831 | continue |
| 5832 | ;; |
| 5833 | release) |
| 5834 | release="-$arg" |
| 5835 | prev= |
| 5836 | continue |
| 5837 | ;; |
| 5838 | rpath | xrpath) |
| 5839 | # We need an absolute path. |
| 5840 | case $arg in |
| 5841 | [\\/]* | [A-Za-z]:[\\/]*) ;; |
| 5842 | *) |
| 5843 | func_fatal_error "only absolute run-paths are allowed" |
| 5844 | ;; |
| 5845 | esac |
| 5846 | if test "$prev" = rpath; then |
| 5847 | case "$rpath " in |
| 5848 | *" $arg "*) ;; |
cristy | da16f16 | 2011-02-19 23:52:17 +0000 | [diff] [blame] | 5849 | *) rpath+=" $arg" ;; |
cristy | 3ed852e | 2009-09-05 21:47:34 +0000 | [diff] [blame] | 5850 | esac |
| 5851 | else |
| 5852 | case "$xrpath " in |
| 5853 | *" $arg "*) ;; |
cristy | da16f16 | 2011-02-19 23:52:17 +0000 | [diff] [blame] | 5854 | *) xrpath+=" $arg" ;; |
cristy | 3ed852e | 2009-09-05 21:47:34 +0000 | [diff] [blame] | 5855 | esac |
| 5856 | fi |
| 5857 | prev= |
| 5858 | continue |
| 5859 | ;; |
| 5860 | shrext) |
| 5861 | shrext_cmds="$arg" |
| 5862 | prev= |
| 5863 | continue |
| 5864 | ;; |
| 5865 | weak) |
cristy | da16f16 | 2011-02-19 23:52:17 +0000 | [diff] [blame] | 5866 | weak_libs+=" $arg" |
cristy | 3ed852e | 2009-09-05 21:47:34 +0000 | [diff] [blame] | 5867 | prev= |
| 5868 | continue |
| 5869 | ;; |
| 5870 | xcclinker) |
cristy | da16f16 | 2011-02-19 23:52:17 +0000 | [diff] [blame] | 5871 | linker_flags+=" $qarg" |
| 5872 | compiler_flags+=" $qarg" |
cristy | 3ed852e | 2009-09-05 21:47:34 +0000 | [diff] [blame] | 5873 | prev= |
cristy | da16f16 | 2011-02-19 23:52:17 +0000 | [diff] [blame] | 5874 | compile_command+=" $qarg" |
| 5875 | finalize_command+=" $qarg" |
cristy | 3ed852e | 2009-09-05 21:47:34 +0000 | [diff] [blame] | 5876 | continue |
| 5877 | ;; |
| 5878 | xcompiler) |
cristy | da16f16 | 2011-02-19 23:52:17 +0000 | [diff] [blame] | 5879 | compiler_flags+=" $qarg" |
cristy | 3ed852e | 2009-09-05 21:47:34 +0000 | [diff] [blame] | 5880 | prev= |
cristy | da16f16 | 2011-02-19 23:52:17 +0000 | [diff] [blame] | 5881 | compile_command+=" $qarg" |
| 5882 | finalize_command+=" $qarg" |
cristy | 3ed852e | 2009-09-05 21:47:34 +0000 | [diff] [blame] | 5883 | continue |
| 5884 | ;; |
| 5885 | xlinker) |
cristy | da16f16 | 2011-02-19 23:52:17 +0000 | [diff] [blame] | 5886 | linker_flags+=" $qarg" |
| 5887 | compiler_flags+=" $wl$qarg" |
cristy | 3ed852e | 2009-09-05 21:47:34 +0000 | [diff] [blame] | 5888 | prev= |
cristy | da16f16 | 2011-02-19 23:52:17 +0000 | [diff] [blame] | 5889 | compile_command+=" $wl$qarg" |
| 5890 | finalize_command+=" $wl$qarg" |
cristy | 3ed852e | 2009-09-05 21:47:34 +0000 | [diff] [blame] | 5891 | continue |
| 5892 | ;; |
| 5893 | *) |
| 5894 | eval "$prev=\"\$arg\"" |
| 5895 | prev= |
| 5896 | continue |
| 5897 | ;; |
| 5898 | esac |
| 5899 | fi # test -n "$prev" |
| 5900 | |
| 5901 | prevarg="$arg" |
| 5902 | |
| 5903 | case $arg in |
| 5904 | -all-static) |
| 5905 | if test -n "$link_static_flag"; then |
| 5906 | # See comment for -static flag below, for more details. |
cristy | da16f16 | 2011-02-19 23:52:17 +0000 | [diff] [blame] | 5907 | compile_command+=" $link_static_flag" |
| 5908 | finalize_command+=" $link_static_flag" |
cristy | 3ed852e | 2009-09-05 21:47:34 +0000 | [diff] [blame] | 5909 | fi |
| 5910 | continue |
| 5911 | ;; |
| 5912 | |
| 5913 | -allow-undefined) |
| 5914 | # FIXME: remove this flag sometime in the future. |
| 5915 | func_fatal_error "\`-allow-undefined' must not be used because it is the default" |
| 5916 | ;; |
| 5917 | |
| 5918 | -avoid-version) |
| 5919 | avoid_version=yes |
| 5920 | continue |
| 5921 | ;; |
| 5922 | |
cristy | 98dddb5 | 2010-11-04 00:30:15 +0000 | [diff] [blame] | 5923 | -bindir) |
| 5924 | prev=bindir |
| 5925 | continue |
| 5926 | ;; |
| 5927 | |
cristy | 3ed852e | 2009-09-05 21:47:34 +0000 | [diff] [blame] | 5928 | -dlopen) |
| 5929 | prev=dlfiles |
| 5930 | continue |
| 5931 | ;; |
| 5932 | |
| 5933 | -dlpreopen) |
| 5934 | prev=dlprefiles |
| 5935 | continue |
| 5936 | ;; |
| 5937 | |
| 5938 | -export-dynamic) |
| 5939 | export_dynamic=yes |
| 5940 | continue |
| 5941 | ;; |
| 5942 | |
| 5943 | -export-symbols | -export-symbols-regex) |
| 5944 | if test -n "$export_symbols" || test -n "$export_symbols_regex"; then |
| 5945 | func_fatal_error "more than one -exported-symbols argument is not allowed" |
| 5946 | fi |
| 5947 | if test "X$arg" = "X-export-symbols"; then |
| 5948 | prev=expsyms |
| 5949 | else |
| 5950 | prev=expsyms_regex |
| 5951 | fi |
| 5952 | continue |
| 5953 | ;; |
| 5954 | |
| 5955 | -framework) |
| 5956 | prev=framework |
| 5957 | continue |
| 5958 | ;; |
| 5959 | |
| 5960 | -inst-prefix-dir) |
| 5961 | prev=inst_prefix |
| 5962 | continue |
| 5963 | ;; |
| 5964 | |
| 5965 | # The native IRIX linker understands -LANG:*, -LIST:* and -LNO:* |
| 5966 | # so, if we see these flags be careful not to treat them like -L |
| 5967 | -L[A-Z][A-Z]*:*) |
| 5968 | case $with_gcc/$host in |
| 5969 | no/*-*-irix* | /*-*-irix*) |
cristy | da16f16 | 2011-02-19 23:52:17 +0000 | [diff] [blame] | 5970 | compile_command+=" $arg" |
| 5971 | finalize_command+=" $arg" |
cristy | 3ed852e | 2009-09-05 21:47:34 +0000 | [diff] [blame] | 5972 | ;; |
| 5973 | esac |
| 5974 | continue |
| 5975 | ;; |
| 5976 | |
| 5977 | -L*) |
cristy | da16f16 | 2011-02-19 23:52:17 +0000 | [diff] [blame] | 5978 | func_stripname "-L" '' "$arg" |
| 5979 | if test -z "$func_stripname_result"; then |
cristy | 3ed852e | 2009-09-05 21:47:34 +0000 | [diff] [blame] | 5980 | if test "$#" -gt 0; then |
| 5981 | func_fatal_error "require no space between \`-L' and \`$1'" |
| 5982 | else |
| 5983 | func_fatal_error "need path for \`-L' option" |
| 5984 | fi |
| 5985 | fi |
cristy | da16f16 | 2011-02-19 23:52:17 +0000 | [diff] [blame] | 5986 | func_resolve_sysroot "$func_stripname_result" |
| 5987 | dir=$func_resolve_sysroot_result |
cristy | 3ed852e | 2009-09-05 21:47:34 +0000 | [diff] [blame] | 5988 | # We need an absolute path. |
| 5989 | case $dir in |
| 5990 | [\\/]* | [A-Za-z]:[\\/]*) ;; |
| 5991 | *) |
| 5992 | absdir=`cd "$dir" && pwd` |
| 5993 | test -z "$absdir" && \ |
| 5994 | func_fatal_error "cannot determine absolute directory name of \`$dir'" |
| 5995 | dir="$absdir" |
| 5996 | ;; |
| 5997 | esac |
| 5998 | case "$deplibs " in |
cristy | da16f16 | 2011-02-19 23:52:17 +0000 | [diff] [blame] | 5999 | *" -L$dir "* | *" $arg "*) |
| 6000 | # Will only happen for absolute or sysroot arguments |
| 6001 | ;; |
cristy | 3ed852e | 2009-09-05 21:47:34 +0000 | [diff] [blame] | 6002 | *) |
cristy | da16f16 | 2011-02-19 23:52:17 +0000 | [diff] [blame] | 6003 | # Preserve sysroot, but never include relative directories |
| 6004 | case $dir in |
| 6005 | [\\/]* | [A-Za-z]:[\\/]* | =*) deplibs+=" $arg" ;; |
| 6006 | *) deplibs+=" -L$dir" ;; |
| 6007 | esac |
| 6008 | lib_search_path+=" $dir" |
cristy | 3ed852e | 2009-09-05 21:47:34 +0000 | [diff] [blame] | 6009 | ;; |
| 6010 | esac |
| 6011 | case $host in |
| 6012 | *-*-cygwin* | *-*-mingw* | *-*-pw32* | *-*-os2* | *-cegcc*) |
cristy | 98dddb5 | 2010-11-04 00:30:15 +0000 | [diff] [blame] | 6013 | testbindir=`$ECHO "$dir" | $SED 's*/lib$*/bin*'` |
cristy | 3ed852e | 2009-09-05 21:47:34 +0000 | [diff] [blame] | 6014 | case :$dllsearchpath: in |
| 6015 | *":$dir:"*) ;; |
| 6016 | ::) dllsearchpath=$dir;; |
cristy | da16f16 | 2011-02-19 23:52:17 +0000 | [diff] [blame] | 6017 | *) dllsearchpath+=":$dir";; |
cristy | 3ed852e | 2009-09-05 21:47:34 +0000 | [diff] [blame] | 6018 | esac |
| 6019 | case :$dllsearchpath: in |
| 6020 | *":$testbindir:"*) ;; |
| 6021 | ::) dllsearchpath=$testbindir;; |
cristy | da16f16 | 2011-02-19 23:52:17 +0000 | [diff] [blame] | 6022 | *) dllsearchpath+=":$testbindir";; |
cristy | 3ed852e | 2009-09-05 21:47:34 +0000 | [diff] [blame] | 6023 | esac |
| 6024 | ;; |
| 6025 | esac |
| 6026 | continue |
| 6027 | ;; |
| 6028 | |
| 6029 | -l*) |
| 6030 | if test "X$arg" = "X-lc" || test "X$arg" = "X-lm"; then |
| 6031 | case $host in |
cristy | 98dddb5 | 2010-11-04 00:30:15 +0000 | [diff] [blame] | 6032 | *-*-cygwin* | *-*-mingw* | *-*-pw32* | *-*-beos* | *-cegcc* | *-*-haiku*) |
cristy | 3ed852e | 2009-09-05 21:47:34 +0000 | [diff] [blame] | 6033 | # These systems don't actually have a C or math library (as such) |
| 6034 | continue |
| 6035 | ;; |
| 6036 | *-*-os2*) |
| 6037 | # These systems don't actually have a C library (as such) |
| 6038 | test "X$arg" = "X-lc" && continue |
| 6039 | ;; |
| 6040 | *-*-openbsd* | *-*-freebsd* | *-*-dragonfly*) |
| 6041 | # Do not include libc due to us having libc/libc_r. |
| 6042 | test "X$arg" = "X-lc" && continue |
| 6043 | ;; |
| 6044 | *-*-rhapsody* | *-*-darwin1.[012]) |
| 6045 | # Rhapsody C and math libraries are in the System framework |
cristy | da16f16 | 2011-02-19 23:52:17 +0000 | [diff] [blame] | 6046 | deplibs+=" System.ltframework" |
cristy | 3ed852e | 2009-09-05 21:47:34 +0000 | [diff] [blame] | 6047 | continue |
| 6048 | ;; |
| 6049 | *-*-sco3.2v5* | *-*-sco5v6*) |
| 6050 | # Causes problems with __ctype |
| 6051 | test "X$arg" = "X-lc" && continue |
| 6052 | ;; |
| 6053 | *-*-sysv4.2uw2* | *-*-sysv5* | *-*-unixware* | *-*-OpenUNIX*) |
| 6054 | # Compiler inserts libc in the correct place for threads to work |
| 6055 | test "X$arg" = "X-lc" && continue |
| 6056 | ;; |
| 6057 | esac |
| 6058 | elif test "X$arg" = "X-lc_r"; then |
| 6059 | case $host in |
| 6060 | *-*-openbsd* | *-*-freebsd* | *-*-dragonfly*) |
| 6061 | # Do not include libc_r directly, use -pthread flag. |
| 6062 | continue |
| 6063 | ;; |
| 6064 | esac |
| 6065 | fi |
cristy | da16f16 | 2011-02-19 23:52:17 +0000 | [diff] [blame] | 6066 | deplibs+=" $arg" |
cristy | 3ed852e | 2009-09-05 21:47:34 +0000 | [diff] [blame] | 6067 | continue |
| 6068 | ;; |
| 6069 | |
| 6070 | -module) |
| 6071 | module=yes |
| 6072 | continue |
| 6073 | ;; |
| 6074 | |
| 6075 | # Tru64 UNIX uses -model [arg] to determine the layout of C++ |
| 6076 | # classes, name mangling, and exception handling. |
| 6077 | # Darwin uses the -arch flag to determine output architecture. |
cristy | da16f16 | 2011-02-19 23:52:17 +0000 | [diff] [blame] | 6078 | -model|-arch|-isysroot|--sysroot) |
| 6079 | compiler_flags+=" $arg" |
| 6080 | compile_command+=" $arg" |
| 6081 | finalize_command+=" $arg" |
cristy | 3ed852e | 2009-09-05 21:47:34 +0000 | [diff] [blame] | 6082 | prev=xcompiler |
| 6083 | continue |
| 6084 | ;; |
| 6085 | |
| 6086 | -mt|-mthreads|-kthread|-Kthread|-pthread|-pthreads|--thread-safe|-threads) |
cristy | da16f16 | 2011-02-19 23:52:17 +0000 | [diff] [blame] | 6087 | compiler_flags+=" $arg" |
| 6088 | compile_command+=" $arg" |
| 6089 | finalize_command+=" $arg" |
cristy | 3ed852e | 2009-09-05 21:47:34 +0000 | [diff] [blame] | 6090 | case "$new_inherited_linker_flags " in |
| 6091 | *" $arg "*) ;; |
cristy | da16f16 | 2011-02-19 23:52:17 +0000 | [diff] [blame] | 6092 | * ) new_inherited_linker_flags+=" $arg" ;; |
cristy | 3ed852e | 2009-09-05 21:47:34 +0000 | [diff] [blame] | 6093 | esac |
| 6094 | continue |
| 6095 | ;; |
| 6096 | |
| 6097 | -multi_module) |
| 6098 | single_module="${wl}-multi_module" |
| 6099 | continue |
| 6100 | ;; |
| 6101 | |
| 6102 | -no-fast-install) |
| 6103 | fast_install=no |
| 6104 | continue |
| 6105 | ;; |
| 6106 | |
| 6107 | -no-install) |
| 6108 | case $host in |
| 6109 | *-*-cygwin* | *-*-mingw* | *-*-pw32* | *-*-os2* | *-*-darwin* | *-cegcc*) |
| 6110 | # The PATH hackery in wrapper scripts is required on Windows |
| 6111 | # and Darwin in order for the loader to find any dlls it needs. |
| 6112 | func_warning "\`-no-install' is ignored for $host" |
| 6113 | func_warning "assuming \`-no-fast-install' instead" |
| 6114 | fast_install=no |
| 6115 | ;; |
| 6116 | *) no_install=yes ;; |
| 6117 | esac |
| 6118 | continue |
| 6119 | ;; |
| 6120 | |
| 6121 | -no-undefined) |
| 6122 | allow_undefined=no |
| 6123 | continue |
| 6124 | ;; |
| 6125 | |
| 6126 | -objectlist) |
| 6127 | prev=objectlist |
| 6128 | continue |
| 6129 | ;; |
| 6130 | |
| 6131 | -o) prev=output ;; |
| 6132 | |
| 6133 | -precious-files-regex) |
| 6134 | prev=precious_regex |
| 6135 | continue |
| 6136 | ;; |
| 6137 | |
| 6138 | -release) |
| 6139 | prev=release |
| 6140 | continue |
| 6141 | ;; |
| 6142 | |
| 6143 | -rpath) |
| 6144 | prev=rpath |
| 6145 | continue |
| 6146 | ;; |
| 6147 | |
| 6148 | -R) |
| 6149 | prev=xrpath |
| 6150 | continue |
| 6151 | ;; |
| 6152 | |
| 6153 | -R*) |
| 6154 | func_stripname '-R' '' "$arg" |
| 6155 | dir=$func_stripname_result |
| 6156 | # We need an absolute path. |
| 6157 | case $dir in |
| 6158 | [\\/]* | [A-Za-z]:[\\/]*) ;; |
cristy | da16f16 | 2011-02-19 23:52:17 +0000 | [diff] [blame] | 6159 | =*) |
| 6160 | func_stripname '=' '' "$dir" |
| 6161 | dir=$lt_sysroot$func_stripname_result |
| 6162 | ;; |
cristy | 3ed852e | 2009-09-05 21:47:34 +0000 | [diff] [blame] | 6163 | *) |
| 6164 | func_fatal_error "only absolute run-paths are allowed" |
| 6165 | ;; |
| 6166 | esac |
| 6167 | case "$xrpath " in |
| 6168 | *" $dir "*) ;; |
cristy | da16f16 | 2011-02-19 23:52:17 +0000 | [diff] [blame] | 6169 | *) xrpath+=" $dir" ;; |
cristy | 3ed852e | 2009-09-05 21:47:34 +0000 | [diff] [blame] | 6170 | esac |
| 6171 | continue |
| 6172 | ;; |
| 6173 | |
| 6174 | -shared) |
| 6175 | # The effects of -shared are defined in a previous loop. |
| 6176 | continue |
| 6177 | ;; |
| 6178 | |
| 6179 | -shrext) |
| 6180 | prev=shrext |
| 6181 | continue |
| 6182 | ;; |
| 6183 | |
| 6184 | -static | -static-libtool-libs) |
| 6185 | # The effects of -static are defined in a previous loop. |
| 6186 | # We used to do the same as -all-static on platforms that |
| 6187 | # didn't have a PIC flag, but the assumption that the effects |
| 6188 | # would be equivalent was wrong. It would break on at least |
| 6189 | # Digital Unix and AIX. |
| 6190 | continue |
| 6191 | ;; |
| 6192 | |
| 6193 | -thread-safe) |
| 6194 | thread_safe=yes |
| 6195 | continue |
| 6196 | ;; |
| 6197 | |
| 6198 | -version-info) |
| 6199 | prev=vinfo |
| 6200 | continue |
| 6201 | ;; |
| 6202 | |
| 6203 | -version-number) |
| 6204 | prev=vinfo |
| 6205 | vinfo_number=yes |
| 6206 | continue |
| 6207 | ;; |
| 6208 | |
| 6209 | -weak) |
| 6210 | prev=weak |
| 6211 | continue |
| 6212 | ;; |
| 6213 | |
| 6214 | -Wc,*) |
| 6215 | func_stripname '-Wc,' '' "$arg" |
| 6216 | args=$func_stripname_result |
| 6217 | arg= |
| 6218 | save_ifs="$IFS"; IFS=',' |
| 6219 | for flag in $args; do |
| 6220 | IFS="$save_ifs" |
| 6221 | func_quote_for_eval "$flag" |
cristy | da16f16 | 2011-02-19 23:52:17 +0000 | [diff] [blame] | 6222 | arg+=" $func_quote_for_eval_result" |
| 6223 | compiler_flags+=" $func_quote_for_eval_result" |
cristy | 3ed852e | 2009-09-05 21:47:34 +0000 | [diff] [blame] | 6224 | done |
| 6225 | IFS="$save_ifs" |
| 6226 | func_stripname ' ' '' "$arg" |
| 6227 | arg=$func_stripname_result |
| 6228 | ;; |
| 6229 | |
| 6230 | -Wl,*) |
| 6231 | func_stripname '-Wl,' '' "$arg" |
| 6232 | args=$func_stripname_result |
| 6233 | arg= |
| 6234 | save_ifs="$IFS"; IFS=',' |
| 6235 | for flag in $args; do |
| 6236 | IFS="$save_ifs" |
| 6237 | func_quote_for_eval "$flag" |
cristy | da16f16 | 2011-02-19 23:52:17 +0000 | [diff] [blame] | 6238 | arg+=" $wl$func_quote_for_eval_result" |
| 6239 | compiler_flags+=" $wl$func_quote_for_eval_result" |
| 6240 | linker_flags+=" $func_quote_for_eval_result" |
cristy | 3ed852e | 2009-09-05 21:47:34 +0000 | [diff] [blame] | 6241 | done |
| 6242 | IFS="$save_ifs" |
| 6243 | func_stripname ' ' '' "$arg" |
| 6244 | arg=$func_stripname_result |
| 6245 | ;; |
| 6246 | |
| 6247 | -Xcompiler) |
| 6248 | prev=xcompiler |
| 6249 | continue |
| 6250 | ;; |
| 6251 | |
| 6252 | -Xlinker) |
| 6253 | prev=xlinker |
| 6254 | continue |
| 6255 | ;; |
| 6256 | |
| 6257 | -XCClinker) |
| 6258 | prev=xcclinker |
| 6259 | continue |
| 6260 | ;; |
| 6261 | |
| 6262 | # -msg_* for osf cc |
| 6263 | -msg_*) |
| 6264 | func_quote_for_eval "$arg" |
| 6265 | arg="$func_quote_for_eval_result" |
| 6266 | ;; |
| 6267 | |
cristy | 98dddb5 | 2010-11-04 00:30:15 +0000 | [diff] [blame] | 6268 | # Flags to be passed through unchanged, with rationale: |
| 6269 | # -64, -mips[0-9] enable 64-bit mode for the SGI compiler |
| 6270 | # -r[0-9][0-9]* specify processor for the SGI compiler |
| 6271 | # -xarch=*, -xtarget=* enable 64-bit mode for the Sun compiler |
| 6272 | # +DA*, +DD* enable 64-bit mode for the HP compiler |
| 6273 | # -q* compiler args for the IBM compiler |
| 6274 | # -m*, -t[45]*, -txscale* architecture-specific flags for GCC |
| 6275 | # -F/path path to uninstalled frameworks, gcc on darwin |
| 6276 | # -p, -pg, --coverage, -fprofile-* profiling flags for GCC |
| 6277 | # @file GCC response files |
| 6278 | # -tp=* Portland pgcc target processor selection |
cristy | da16f16 | 2011-02-19 23:52:17 +0000 | [diff] [blame] | 6279 | # --sysroot=* for sysroot support |
| 6280 | # -O*, -flto*, -fwhopr*, -fuse-linker-plugin GCC link-time optimization |
cristy | 3ed852e | 2009-09-05 21:47:34 +0000 | [diff] [blame] | 6281 | -64|-mips[0-9]|-r[0-9][0-9]*|-xarch=*|-xtarget=*|+DA*|+DD*|-q*|-m*| \ |
cristy | da16f16 | 2011-02-19 23:52:17 +0000 | [diff] [blame] | 6282 | -t[45]*|-txscale*|-p|-pg|--coverage|-fprofile-*|-F*|@*|-tp=*|--sysroot=*| \ |
| 6283 | -O*|-flto*|-fwhopr*|-fuse-linker-plugin) |
cristy | 3ed852e | 2009-09-05 21:47:34 +0000 | [diff] [blame] | 6284 | func_quote_for_eval "$arg" |
| 6285 | arg="$func_quote_for_eval_result" |
cristy | da16f16 | 2011-02-19 23:52:17 +0000 | [diff] [blame] | 6286 | compile_command+=" $arg" |
| 6287 | finalize_command+=" $arg" |
| 6288 | compiler_flags+=" $arg" |
cristy | 3ed852e | 2009-09-05 21:47:34 +0000 | [diff] [blame] | 6289 | continue |
| 6290 | ;; |
| 6291 | |
| 6292 | # Some other compiler flag. |
| 6293 | -* | +*) |
| 6294 | func_quote_for_eval "$arg" |
| 6295 | arg="$func_quote_for_eval_result" |
| 6296 | ;; |
| 6297 | |
| 6298 | *.$objext) |
| 6299 | # A standard object. |
cristy | da16f16 | 2011-02-19 23:52:17 +0000 | [diff] [blame] | 6300 | objs+=" $arg" |
cristy | 3ed852e | 2009-09-05 21:47:34 +0000 | [diff] [blame] | 6301 | ;; |
| 6302 | |
| 6303 | *.lo) |
| 6304 | # A libtool-controlled object. |
| 6305 | |
| 6306 | # Check to see that this really is a libtool object. |
| 6307 | if func_lalib_unsafe_p "$arg"; then |
| 6308 | pic_object= |
| 6309 | non_pic_object= |
| 6310 | |
| 6311 | # Read the .lo file |
| 6312 | func_source "$arg" |
| 6313 | |
| 6314 | if test -z "$pic_object" || |
| 6315 | test -z "$non_pic_object" || |
| 6316 | test "$pic_object" = none && |
| 6317 | test "$non_pic_object" = none; then |
| 6318 | func_fatal_error "cannot find name of object for \`$arg'" |
| 6319 | fi |
| 6320 | |
| 6321 | # Extract subdirectory from the argument. |
| 6322 | func_dirname "$arg" "/" "" |
| 6323 | xdir="$func_dirname_result" |
| 6324 | |
| 6325 | if test "$pic_object" != none; then |
| 6326 | # Prepend the subdirectory the object is found in. |
| 6327 | pic_object="$xdir$pic_object" |
| 6328 | |
| 6329 | if test "$prev" = dlfiles; then |
| 6330 | if test "$build_libtool_libs" = yes && test "$dlopen_support" = yes; then |
cristy | da16f16 | 2011-02-19 23:52:17 +0000 | [diff] [blame] | 6331 | dlfiles+=" $pic_object" |
cristy | 3ed852e | 2009-09-05 21:47:34 +0000 | [diff] [blame] | 6332 | prev= |
| 6333 | continue |
| 6334 | else |
| 6335 | # If libtool objects are unsupported, then we need to preload. |
| 6336 | prev=dlprefiles |
| 6337 | fi |
| 6338 | fi |
| 6339 | |
| 6340 | # CHECK ME: I think I busted this. -Ossama |
| 6341 | if test "$prev" = dlprefiles; then |
| 6342 | # Preload the old-style object. |
cristy | da16f16 | 2011-02-19 23:52:17 +0000 | [diff] [blame] | 6343 | dlprefiles+=" $pic_object" |
cristy | 3ed852e | 2009-09-05 21:47:34 +0000 | [diff] [blame] | 6344 | prev= |
| 6345 | fi |
| 6346 | |
| 6347 | # A PIC object. |
cristy | da16f16 | 2011-02-19 23:52:17 +0000 | [diff] [blame] | 6348 | libobjs+=" $pic_object" |
cristy | 3ed852e | 2009-09-05 21:47:34 +0000 | [diff] [blame] | 6349 | arg="$pic_object" |
| 6350 | fi |
| 6351 | |
| 6352 | # Non-PIC object. |
| 6353 | if test "$non_pic_object" != none; then |
| 6354 | # Prepend the subdirectory the object is found in. |
| 6355 | non_pic_object="$xdir$non_pic_object" |
| 6356 | |
| 6357 | # A standard non-PIC object |
cristy | da16f16 | 2011-02-19 23:52:17 +0000 | [diff] [blame] | 6358 | non_pic_objects+=" $non_pic_object" |
cristy | 3ed852e | 2009-09-05 21:47:34 +0000 | [diff] [blame] | 6359 | if test -z "$pic_object" || test "$pic_object" = none ; then |
| 6360 | arg="$non_pic_object" |
| 6361 | fi |
| 6362 | else |
| 6363 | # If the PIC object exists, use it instead. |
| 6364 | # $xdir was prepended to $pic_object above. |
| 6365 | non_pic_object="$pic_object" |
cristy | da16f16 | 2011-02-19 23:52:17 +0000 | [diff] [blame] | 6366 | non_pic_objects+=" $non_pic_object" |
cristy | 3ed852e | 2009-09-05 21:47:34 +0000 | [diff] [blame] | 6367 | fi |
| 6368 | else |
| 6369 | # Only an error if not doing a dry-run. |
| 6370 | if $opt_dry_run; then |
| 6371 | # Extract subdirectory from the argument. |
| 6372 | func_dirname "$arg" "/" "" |
| 6373 | xdir="$func_dirname_result" |
| 6374 | |
| 6375 | func_lo2o "$arg" |
| 6376 | pic_object=$xdir$objdir/$func_lo2o_result |
| 6377 | non_pic_object=$xdir$func_lo2o_result |
cristy | da16f16 | 2011-02-19 23:52:17 +0000 | [diff] [blame] | 6378 | libobjs+=" $pic_object" |
| 6379 | non_pic_objects+=" $non_pic_object" |
cristy | 3ed852e | 2009-09-05 21:47:34 +0000 | [diff] [blame] | 6380 | else |
| 6381 | func_fatal_error "\`$arg' is not a valid libtool object" |
| 6382 | fi |
| 6383 | fi |
| 6384 | ;; |
| 6385 | |
| 6386 | *.$libext) |
| 6387 | # An archive. |
cristy | da16f16 | 2011-02-19 23:52:17 +0000 | [diff] [blame] | 6388 | deplibs+=" $arg" |
| 6389 | old_deplibs+=" $arg" |
cristy | 3ed852e | 2009-09-05 21:47:34 +0000 | [diff] [blame] | 6390 | continue |
| 6391 | ;; |
| 6392 | |
| 6393 | *.la) |
| 6394 | # A libtool-controlled library. |
| 6395 | |
cristy | da16f16 | 2011-02-19 23:52:17 +0000 | [diff] [blame] | 6396 | func_resolve_sysroot "$arg" |
cristy | 3ed852e | 2009-09-05 21:47:34 +0000 | [diff] [blame] | 6397 | if test "$prev" = dlfiles; then |
| 6398 | # This library was specified with -dlopen. |
cristy | da16f16 | 2011-02-19 23:52:17 +0000 | [diff] [blame] | 6399 | dlfiles+=" $func_resolve_sysroot_result" |
cristy | 3ed852e | 2009-09-05 21:47:34 +0000 | [diff] [blame] | 6400 | prev= |
| 6401 | elif test "$prev" = dlprefiles; then |
| 6402 | # The library was specified with -dlpreopen. |
cristy | da16f16 | 2011-02-19 23:52:17 +0000 | [diff] [blame] | 6403 | dlprefiles+=" $func_resolve_sysroot_result" |
cristy | 3ed852e | 2009-09-05 21:47:34 +0000 | [diff] [blame] | 6404 | prev= |
| 6405 | else |
cristy | da16f16 | 2011-02-19 23:52:17 +0000 | [diff] [blame] | 6406 | deplibs+=" $func_resolve_sysroot_result" |
cristy | 3ed852e | 2009-09-05 21:47:34 +0000 | [diff] [blame] | 6407 | fi |
| 6408 | continue |
| 6409 | ;; |
| 6410 | |
| 6411 | # Some other compiler argument. |
| 6412 | *) |
| 6413 | # Unknown arguments in both finalize_command and compile_command need |
| 6414 | # to be aesthetically quoted because they are evaled later. |
| 6415 | func_quote_for_eval "$arg" |
| 6416 | arg="$func_quote_for_eval_result" |
| 6417 | ;; |
| 6418 | esac # arg |
| 6419 | |
| 6420 | # Now actually substitute the argument into the commands. |
| 6421 | if test -n "$arg"; then |
cristy | da16f16 | 2011-02-19 23:52:17 +0000 | [diff] [blame] | 6422 | compile_command+=" $arg" |
| 6423 | finalize_command+=" $arg" |
cristy | 3ed852e | 2009-09-05 21:47:34 +0000 | [diff] [blame] | 6424 | fi |
| 6425 | done # argument parsing loop |
| 6426 | |
| 6427 | test -n "$prev" && \ |
| 6428 | func_fatal_help "the \`$prevarg' option requires an argument" |
| 6429 | |
| 6430 | if test "$export_dynamic" = yes && test -n "$export_dynamic_flag_spec"; then |
| 6431 | eval arg=\"$export_dynamic_flag_spec\" |
cristy | da16f16 | 2011-02-19 23:52:17 +0000 | [diff] [blame] | 6432 | compile_command+=" $arg" |
| 6433 | finalize_command+=" $arg" |
cristy | 3ed852e | 2009-09-05 21:47:34 +0000 | [diff] [blame] | 6434 | fi |
| 6435 | |
| 6436 | oldlibs= |
| 6437 | # calculate the name of the file, without its directory |
| 6438 | func_basename "$output" |
| 6439 | outputname="$func_basename_result" |
| 6440 | libobjs_save="$libobjs" |
| 6441 | |
| 6442 | if test -n "$shlibpath_var"; then |
| 6443 | # get the directories listed in $shlibpath_var |
cristy | 98dddb5 | 2010-11-04 00:30:15 +0000 | [diff] [blame] | 6444 | eval shlib_search_path=\`\$ECHO \"\${$shlibpath_var}\" \| \$SED \'s/:/ /g\'\` |
cristy | 3ed852e | 2009-09-05 21:47:34 +0000 | [diff] [blame] | 6445 | else |
| 6446 | shlib_search_path= |
| 6447 | fi |
| 6448 | eval sys_lib_search_path=\"$sys_lib_search_path_spec\" |
| 6449 | eval sys_lib_dlsearch_path=\"$sys_lib_dlsearch_path_spec\" |
| 6450 | |
| 6451 | func_dirname "$output" "/" "" |
| 6452 | output_objdir="$func_dirname_result$objdir" |
cristy | da16f16 | 2011-02-19 23:52:17 +0000 | [diff] [blame] | 6453 | func_to_tool_file "$output_objdir/" |
| 6454 | tool_output_objdir=$func_to_tool_file_result |
cristy | 3ed852e | 2009-09-05 21:47:34 +0000 | [diff] [blame] | 6455 | # Create the object directory. |
| 6456 | func_mkdir_p "$output_objdir" |
| 6457 | |
| 6458 | # Determine the type of output |
| 6459 | case $output in |
| 6460 | "") |
| 6461 | func_fatal_help "you must specify an output file" |
| 6462 | ;; |
| 6463 | *.$libext) linkmode=oldlib ;; |
| 6464 | *.lo | *.$objext) linkmode=obj ;; |
| 6465 | *.la) linkmode=lib ;; |
| 6466 | *) linkmode=prog ;; # Anything else should be a program. |
| 6467 | esac |
| 6468 | |
| 6469 | specialdeplibs= |
| 6470 | |
| 6471 | libs= |
| 6472 | # Find all interdependent deplibs by searching for libraries |
| 6473 | # that are linked more than once (e.g. -la -lb -la) |
| 6474 | for deplib in $deplibs; do |
cristy | da16f16 | 2011-02-19 23:52:17 +0000 | [diff] [blame] | 6475 | if $opt_preserve_dup_deps ; then |
cristy | 3ed852e | 2009-09-05 21:47:34 +0000 | [diff] [blame] | 6476 | case "$libs " in |
cristy | da16f16 | 2011-02-19 23:52:17 +0000 | [diff] [blame] | 6477 | *" $deplib "*) specialdeplibs+=" $deplib" ;; |
cristy | 3ed852e | 2009-09-05 21:47:34 +0000 | [diff] [blame] | 6478 | esac |
| 6479 | fi |
cristy | da16f16 | 2011-02-19 23:52:17 +0000 | [diff] [blame] | 6480 | libs+=" $deplib" |
cristy | 3ed852e | 2009-09-05 21:47:34 +0000 | [diff] [blame] | 6481 | done |
| 6482 | |
| 6483 | if test "$linkmode" = lib; then |
| 6484 | libs="$predeps $libs $compiler_lib_search_path $postdeps" |
| 6485 | |
| 6486 | # Compute libraries that are listed more than once in $predeps |
| 6487 | # $postdeps and mark them as special (i.e., whose duplicates are |
| 6488 | # not to be eliminated). |
| 6489 | pre_post_deps= |
| 6490 | if $opt_duplicate_compiler_generated_deps; then |
| 6491 | for pre_post_dep in $predeps $postdeps; do |
| 6492 | case "$pre_post_deps " in |
cristy | da16f16 | 2011-02-19 23:52:17 +0000 | [diff] [blame] | 6493 | *" $pre_post_dep "*) specialdeplibs+=" $pre_post_deps" ;; |
cristy | 3ed852e | 2009-09-05 21:47:34 +0000 | [diff] [blame] | 6494 | esac |
cristy | da16f16 | 2011-02-19 23:52:17 +0000 | [diff] [blame] | 6495 | pre_post_deps+=" $pre_post_dep" |
cristy | 3ed852e | 2009-09-05 21:47:34 +0000 | [diff] [blame] | 6496 | done |
| 6497 | fi |
| 6498 | pre_post_deps= |
| 6499 | fi |
| 6500 | |
| 6501 | deplibs= |
| 6502 | newdependency_libs= |
| 6503 | newlib_search_path= |
| 6504 | need_relink=no # whether we're linking any uninstalled libtool libraries |
| 6505 | notinst_deplibs= # not-installed libtool libraries |
| 6506 | notinst_path= # paths that contain not-installed libtool libraries |
| 6507 | |
| 6508 | case $linkmode in |
| 6509 | lib) |
| 6510 | passes="conv dlpreopen link" |
| 6511 | for file in $dlfiles $dlprefiles; do |
| 6512 | case $file in |
| 6513 | *.la) ;; |
| 6514 | *) |
| 6515 | func_fatal_help "libraries can \`-dlopen' only libtool libraries: $file" |
| 6516 | ;; |
| 6517 | esac |
| 6518 | done |
| 6519 | ;; |
| 6520 | prog) |
| 6521 | compile_deplibs= |
| 6522 | finalize_deplibs= |
| 6523 | alldeplibs=no |
| 6524 | newdlfiles= |
| 6525 | newdlprefiles= |
| 6526 | passes="conv scan dlopen dlpreopen link" |
| 6527 | ;; |
| 6528 | *) passes="conv" |
| 6529 | ;; |
| 6530 | esac |
| 6531 | |
| 6532 | for pass in $passes; do |
| 6533 | # The preopen pass in lib mode reverses $deplibs; put it back here |
| 6534 | # so that -L comes before libs that need it for instance... |
| 6535 | if test "$linkmode,$pass" = "lib,link"; then |
| 6536 | ## FIXME: Find the place where the list is rebuilt in the wrong |
| 6537 | ## order, and fix it there properly |
| 6538 | tmp_deplibs= |
| 6539 | for deplib in $deplibs; do |
| 6540 | tmp_deplibs="$deplib $tmp_deplibs" |
| 6541 | done |
| 6542 | deplibs="$tmp_deplibs" |
| 6543 | fi |
| 6544 | |
| 6545 | if test "$linkmode,$pass" = "lib,link" || |
| 6546 | test "$linkmode,$pass" = "prog,scan"; then |
| 6547 | libs="$deplibs" |
| 6548 | deplibs= |
| 6549 | fi |
| 6550 | if test "$linkmode" = prog; then |
| 6551 | case $pass in |
| 6552 | dlopen) libs="$dlfiles" ;; |
| 6553 | dlpreopen) libs="$dlprefiles" ;; |
| 6554 | link) libs="$deplibs %DEPLIBS% $dependency_libs" ;; |
| 6555 | esac |
| 6556 | fi |
| 6557 | if test "$linkmode,$pass" = "lib,dlpreopen"; then |
| 6558 | # Collect and forward deplibs of preopened libtool libs |
| 6559 | for lib in $dlprefiles; do |
| 6560 | # Ignore non-libtool-libs |
| 6561 | dependency_libs= |
cristy | da16f16 | 2011-02-19 23:52:17 +0000 | [diff] [blame] | 6562 | func_resolve_sysroot "$lib" |
cristy | 3ed852e | 2009-09-05 21:47:34 +0000 | [diff] [blame] | 6563 | case $lib in |
cristy | da16f16 | 2011-02-19 23:52:17 +0000 | [diff] [blame] | 6564 | *.la) func_source "$func_resolve_sysroot_result" ;; |
cristy | 3ed852e | 2009-09-05 21:47:34 +0000 | [diff] [blame] | 6565 | esac |
| 6566 | |
| 6567 | # Collect preopened libtool deplibs, except any this library |
| 6568 | # has declared as weak libs |
| 6569 | for deplib in $dependency_libs; do |
cristy | 98dddb5 | 2010-11-04 00:30:15 +0000 | [diff] [blame] | 6570 | func_basename "$deplib" |
| 6571 | deplib_base=$func_basename_result |
cristy | 3ed852e | 2009-09-05 21:47:34 +0000 | [diff] [blame] | 6572 | case " $weak_libs " in |
| 6573 | *" $deplib_base "*) ;; |
cristy | da16f16 | 2011-02-19 23:52:17 +0000 | [diff] [blame] | 6574 | *) deplibs+=" $deplib" ;; |
cristy | 3ed852e | 2009-09-05 21:47:34 +0000 | [diff] [blame] | 6575 | esac |
| 6576 | done |
| 6577 | done |
| 6578 | libs="$dlprefiles" |
| 6579 | fi |
| 6580 | if test "$pass" = dlopen; then |
| 6581 | # Collect dlpreopened libraries |
| 6582 | save_deplibs="$deplibs" |
| 6583 | deplibs= |
| 6584 | fi |
| 6585 | |
| 6586 | for deplib in $libs; do |
| 6587 | lib= |
| 6588 | found=no |
| 6589 | case $deplib in |
| 6590 | -mt|-mthreads|-kthread|-Kthread|-pthread|-pthreads|--thread-safe|-threads) |
| 6591 | if test "$linkmode,$pass" = "prog,link"; then |
| 6592 | compile_deplibs="$deplib $compile_deplibs" |
| 6593 | finalize_deplibs="$deplib $finalize_deplibs" |
| 6594 | else |
cristy | da16f16 | 2011-02-19 23:52:17 +0000 | [diff] [blame] | 6595 | compiler_flags+=" $deplib" |
cristy | 3ed852e | 2009-09-05 21:47:34 +0000 | [diff] [blame] | 6596 | if test "$linkmode" = lib ; then |
| 6597 | case "$new_inherited_linker_flags " in |
| 6598 | *" $deplib "*) ;; |
cristy | da16f16 | 2011-02-19 23:52:17 +0000 | [diff] [blame] | 6599 | * ) new_inherited_linker_flags+=" $deplib" ;; |
cristy | 3ed852e | 2009-09-05 21:47:34 +0000 | [diff] [blame] | 6600 | esac |
| 6601 | fi |
| 6602 | fi |
| 6603 | continue |
| 6604 | ;; |
| 6605 | -l*) |
| 6606 | if test "$linkmode" != lib && test "$linkmode" != prog; then |
| 6607 | func_warning "\`-l' is ignored for archives/objects" |
| 6608 | continue |
| 6609 | fi |
| 6610 | func_stripname '-l' '' "$deplib" |
| 6611 | name=$func_stripname_result |
| 6612 | if test "$linkmode" = lib; then |
| 6613 | searchdirs="$newlib_search_path $lib_search_path $compiler_lib_search_dirs $sys_lib_search_path $shlib_search_path" |
| 6614 | else |
| 6615 | searchdirs="$newlib_search_path $lib_search_path $sys_lib_search_path $shlib_search_path" |
| 6616 | fi |
| 6617 | for searchdir in $searchdirs; do |
| 6618 | for search_ext in .la $std_shrext .so .a; do |
| 6619 | # Search the libtool library |
| 6620 | lib="$searchdir/lib${name}${search_ext}" |
| 6621 | if test -f "$lib"; then |
| 6622 | if test "$search_ext" = ".la"; then |
| 6623 | found=yes |
| 6624 | else |
| 6625 | found=no |
| 6626 | fi |
| 6627 | break 2 |
| 6628 | fi |
| 6629 | done |
| 6630 | done |
| 6631 | if test "$found" != yes; then |
| 6632 | # deplib doesn't seem to be a libtool library |
| 6633 | if test "$linkmode,$pass" = "prog,link"; then |
| 6634 | compile_deplibs="$deplib $compile_deplibs" |
| 6635 | finalize_deplibs="$deplib $finalize_deplibs" |
| 6636 | else |
| 6637 | deplibs="$deplib $deplibs" |
| 6638 | test "$linkmode" = lib && newdependency_libs="$deplib $newdependency_libs" |
| 6639 | fi |
| 6640 | continue |
| 6641 | else # deplib is a libtool library |
| 6642 | # If $allow_libtool_libs_with_static_runtimes && $deplib is a stdlib, |
| 6643 | # We need to do some special things here, and not later. |
| 6644 | if test "X$allow_libtool_libs_with_static_runtimes" = "Xyes" ; then |
| 6645 | case " $predeps $postdeps " in |
| 6646 | *" $deplib "*) |
| 6647 | if func_lalib_p "$lib"; then |
| 6648 | library_names= |
| 6649 | old_library= |
| 6650 | func_source "$lib" |
| 6651 | for l in $old_library $library_names; do |
| 6652 | ll="$l" |
| 6653 | done |
| 6654 | if test "X$ll" = "X$old_library" ; then # only static version available |
| 6655 | found=no |
| 6656 | func_dirname "$lib" "" "." |
| 6657 | ladir="$func_dirname_result" |
| 6658 | lib=$ladir/$old_library |
| 6659 | if test "$linkmode,$pass" = "prog,link"; then |
| 6660 | compile_deplibs="$deplib $compile_deplibs" |
| 6661 | finalize_deplibs="$deplib $finalize_deplibs" |
| 6662 | else |
| 6663 | deplibs="$deplib $deplibs" |
| 6664 | test "$linkmode" = lib && newdependency_libs="$deplib $newdependency_libs" |
| 6665 | fi |
| 6666 | continue |
| 6667 | fi |
| 6668 | fi |
| 6669 | ;; |
| 6670 | *) ;; |
| 6671 | esac |
| 6672 | fi |
| 6673 | fi |
| 6674 | ;; # -l |
| 6675 | *.ltframework) |
| 6676 | if test "$linkmode,$pass" = "prog,link"; then |
| 6677 | compile_deplibs="$deplib $compile_deplibs" |
| 6678 | finalize_deplibs="$deplib $finalize_deplibs" |
| 6679 | else |
| 6680 | deplibs="$deplib $deplibs" |
| 6681 | if test "$linkmode" = lib ; then |
| 6682 | case "$new_inherited_linker_flags " in |
| 6683 | *" $deplib "*) ;; |
cristy | da16f16 | 2011-02-19 23:52:17 +0000 | [diff] [blame] | 6684 | * ) new_inherited_linker_flags+=" $deplib" ;; |
cristy | 3ed852e | 2009-09-05 21:47:34 +0000 | [diff] [blame] | 6685 | esac |
| 6686 | fi |
| 6687 | fi |
| 6688 | continue |
| 6689 | ;; |
| 6690 | -L*) |
| 6691 | case $linkmode in |
| 6692 | lib) |
| 6693 | deplibs="$deplib $deplibs" |
| 6694 | test "$pass" = conv && continue |
| 6695 | newdependency_libs="$deplib $newdependency_libs" |
| 6696 | func_stripname '-L' '' "$deplib" |
cristy | da16f16 | 2011-02-19 23:52:17 +0000 | [diff] [blame] | 6697 | func_resolve_sysroot "$func_stripname_result" |
| 6698 | newlib_search_path+=" $func_resolve_sysroot_result" |
cristy | 3ed852e | 2009-09-05 21:47:34 +0000 | [diff] [blame] | 6699 | ;; |
| 6700 | prog) |
| 6701 | if test "$pass" = conv; then |
| 6702 | deplibs="$deplib $deplibs" |
| 6703 | continue |
| 6704 | fi |
| 6705 | if test "$pass" = scan; then |
| 6706 | deplibs="$deplib $deplibs" |
| 6707 | else |
| 6708 | compile_deplibs="$deplib $compile_deplibs" |
| 6709 | finalize_deplibs="$deplib $finalize_deplibs" |
| 6710 | fi |
| 6711 | func_stripname '-L' '' "$deplib" |
cristy | da16f16 | 2011-02-19 23:52:17 +0000 | [diff] [blame] | 6712 | func_resolve_sysroot "$func_stripname_result" |
| 6713 | newlib_search_path+=" $func_resolve_sysroot_result" |
cristy | 3ed852e | 2009-09-05 21:47:34 +0000 | [diff] [blame] | 6714 | ;; |
| 6715 | *) |
| 6716 | func_warning "\`-L' is ignored for archives/objects" |
| 6717 | ;; |
| 6718 | esac # linkmode |
| 6719 | continue |
| 6720 | ;; # -L |
| 6721 | -R*) |
| 6722 | if test "$pass" = link; then |
| 6723 | func_stripname '-R' '' "$deplib" |
cristy | da16f16 | 2011-02-19 23:52:17 +0000 | [diff] [blame] | 6724 | func_resolve_sysroot "$func_stripname_result" |
| 6725 | dir=$func_resolve_sysroot_result |
cristy | 3ed852e | 2009-09-05 21:47:34 +0000 | [diff] [blame] | 6726 | # Make sure the xrpath contains only unique directories. |
| 6727 | case "$xrpath " in |
| 6728 | *" $dir "*) ;; |
cristy | da16f16 | 2011-02-19 23:52:17 +0000 | [diff] [blame] | 6729 | *) xrpath+=" $dir" ;; |
cristy | 3ed852e | 2009-09-05 21:47:34 +0000 | [diff] [blame] | 6730 | esac |
| 6731 | fi |
| 6732 | deplibs="$deplib $deplibs" |
| 6733 | continue |
| 6734 | ;; |
cristy | da16f16 | 2011-02-19 23:52:17 +0000 | [diff] [blame] | 6735 | *.la) |
| 6736 | func_resolve_sysroot "$deplib" |
| 6737 | lib=$func_resolve_sysroot_result |
| 6738 | ;; |
cristy | 3ed852e | 2009-09-05 21:47:34 +0000 | [diff] [blame] | 6739 | *.$libext) |
| 6740 | if test "$pass" = conv; then |
| 6741 | deplibs="$deplib $deplibs" |
| 6742 | continue |
| 6743 | fi |
| 6744 | case $linkmode in |
| 6745 | lib) |
| 6746 | # Linking convenience modules into shared libraries is allowed, |
| 6747 | # but linking other static libraries is non-portable. |
| 6748 | case " $dlpreconveniencelibs " in |
| 6749 | *" $deplib "*) ;; |
| 6750 | *) |
| 6751 | valid_a_lib=no |
| 6752 | case $deplibs_check_method in |
| 6753 | match_pattern*) |
| 6754 | set dummy $deplibs_check_method; shift |
| 6755 | match_pattern_regex=`expr "$deplibs_check_method" : "$1 \(.*\)"` |
cristy | 98dddb5 | 2010-11-04 00:30:15 +0000 | [diff] [blame] | 6756 | if eval "\$ECHO \"$deplib\"" 2>/dev/null | $SED 10q \ |
cristy | 3ed852e | 2009-09-05 21:47:34 +0000 | [diff] [blame] | 6757 | | $EGREP "$match_pattern_regex" > /dev/null; then |
| 6758 | valid_a_lib=yes |
| 6759 | fi |
| 6760 | ;; |
| 6761 | pass_all) |
| 6762 | valid_a_lib=yes |
| 6763 | ;; |
| 6764 | esac |
| 6765 | if test "$valid_a_lib" != yes; then |
cristy | 98dddb5 | 2010-11-04 00:30:15 +0000 | [diff] [blame] | 6766 | echo |
cristy | 3ed852e | 2009-09-05 21:47:34 +0000 | [diff] [blame] | 6767 | $ECHO "*** Warning: Trying to link with static lib archive $deplib." |
cristy | 98dddb5 | 2010-11-04 00:30:15 +0000 | [diff] [blame] | 6768 | echo "*** I have the capability to make that library automatically link in when" |
| 6769 | echo "*** you link to this library. But I can only do this if you have a" |
| 6770 | echo "*** shared version of the library, which you do not appear to have" |
| 6771 | echo "*** because the file extensions .$libext of this argument makes me believe" |
| 6772 | echo "*** that it is just a static archive that I should not use here." |
cristy | 3ed852e | 2009-09-05 21:47:34 +0000 | [diff] [blame] | 6773 | else |
cristy | 98dddb5 | 2010-11-04 00:30:15 +0000 | [diff] [blame] | 6774 | echo |
cristy | 3ed852e | 2009-09-05 21:47:34 +0000 | [diff] [blame] | 6775 | $ECHO "*** Warning: Linking the shared library $output against the" |
| 6776 | $ECHO "*** static library $deplib is not portable!" |
| 6777 | deplibs="$deplib $deplibs" |
| 6778 | fi |
| 6779 | ;; |
| 6780 | esac |
| 6781 | continue |
| 6782 | ;; |
| 6783 | prog) |
| 6784 | if test "$pass" != link; then |
| 6785 | deplibs="$deplib $deplibs" |
| 6786 | else |
| 6787 | compile_deplibs="$deplib $compile_deplibs" |
| 6788 | finalize_deplibs="$deplib $finalize_deplibs" |
| 6789 | fi |
| 6790 | continue |
| 6791 | ;; |
| 6792 | esac # linkmode |
| 6793 | ;; # *.$libext |
| 6794 | *.lo | *.$objext) |
| 6795 | if test "$pass" = conv; then |
| 6796 | deplibs="$deplib $deplibs" |
| 6797 | elif test "$linkmode" = prog; then |
| 6798 | if test "$pass" = dlpreopen || test "$dlopen_support" != yes || test "$build_libtool_libs" = no; then |
| 6799 | # If there is no dlopen support or we're linking statically, |
| 6800 | # we need to preload. |
cristy | da16f16 | 2011-02-19 23:52:17 +0000 | [diff] [blame] | 6801 | newdlprefiles+=" $deplib" |
cristy | 3ed852e | 2009-09-05 21:47:34 +0000 | [diff] [blame] | 6802 | compile_deplibs="$deplib $compile_deplibs" |
| 6803 | finalize_deplibs="$deplib $finalize_deplibs" |
| 6804 | else |
cristy | da16f16 | 2011-02-19 23:52:17 +0000 | [diff] [blame] | 6805 | newdlfiles+=" $deplib" |
cristy | 3ed852e | 2009-09-05 21:47:34 +0000 | [diff] [blame] | 6806 | fi |
| 6807 | fi |
| 6808 | continue |
| 6809 | ;; |
| 6810 | %DEPLIBS%) |
| 6811 | alldeplibs=yes |
| 6812 | continue |
| 6813 | ;; |
| 6814 | esac # case $deplib |
| 6815 | |
| 6816 | if test "$found" = yes || test -f "$lib"; then : |
| 6817 | else |
| 6818 | func_fatal_error "cannot find the library \`$lib' or unhandled argument \`$deplib'" |
| 6819 | fi |
| 6820 | |
| 6821 | # Check to see that this really is a libtool archive. |
| 6822 | func_lalib_unsafe_p "$lib" \ |
| 6823 | || func_fatal_error "\`$lib' is not a valid libtool archive" |
| 6824 | |
| 6825 | func_dirname "$lib" "" "." |
| 6826 | ladir="$func_dirname_result" |
| 6827 | |
| 6828 | dlname= |
| 6829 | dlopen= |
| 6830 | dlpreopen= |
| 6831 | libdir= |
| 6832 | library_names= |
| 6833 | old_library= |
| 6834 | inherited_linker_flags= |
| 6835 | # If the library was installed with an old release of libtool, |
| 6836 | # it will not redefine variables installed, or shouldnotlink |
| 6837 | installed=yes |
| 6838 | shouldnotlink=no |
| 6839 | avoidtemprpath= |
| 6840 | |
| 6841 | |
| 6842 | # Read the .la file |
| 6843 | func_source "$lib" |
| 6844 | |
| 6845 | # Convert "-framework foo" to "foo.ltframework" |
| 6846 | if test -n "$inherited_linker_flags"; then |
cristy | 98dddb5 | 2010-11-04 00:30:15 +0000 | [diff] [blame] | 6847 | tmp_inherited_linker_flags=`$ECHO "$inherited_linker_flags" | $SED 's/-framework \([^ $]*\)/\1.ltframework/g'` |
cristy | 3ed852e | 2009-09-05 21:47:34 +0000 | [diff] [blame] | 6848 | for tmp_inherited_linker_flag in $tmp_inherited_linker_flags; do |
| 6849 | case " $new_inherited_linker_flags " in |
| 6850 | *" $tmp_inherited_linker_flag "*) ;; |
cristy | da16f16 | 2011-02-19 23:52:17 +0000 | [diff] [blame] | 6851 | *) new_inherited_linker_flags+=" $tmp_inherited_linker_flag";; |
cristy | 3ed852e | 2009-09-05 21:47:34 +0000 | [diff] [blame] | 6852 | esac |
| 6853 | done |
| 6854 | fi |
cristy | 98dddb5 | 2010-11-04 00:30:15 +0000 | [diff] [blame] | 6855 | dependency_libs=`$ECHO " $dependency_libs" | $SED 's% \([^ $]*\).ltframework% -framework \1%g'` |
cristy | 3ed852e | 2009-09-05 21:47:34 +0000 | [diff] [blame] | 6856 | if test "$linkmode,$pass" = "lib,link" || |
| 6857 | test "$linkmode,$pass" = "prog,scan" || |
| 6858 | { test "$linkmode" != prog && test "$linkmode" != lib; }; then |
cristy | da16f16 | 2011-02-19 23:52:17 +0000 | [diff] [blame] | 6859 | test -n "$dlopen" && dlfiles+=" $dlopen" |
| 6860 | test -n "$dlpreopen" && dlprefiles+=" $dlpreopen" |
cristy | 3ed852e | 2009-09-05 21:47:34 +0000 | [diff] [blame] | 6861 | fi |
| 6862 | |
| 6863 | if test "$pass" = conv; then |
| 6864 | # Only check for convenience libraries |
| 6865 | deplibs="$lib $deplibs" |
| 6866 | if test -z "$libdir"; then |
| 6867 | if test -z "$old_library"; then |
| 6868 | func_fatal_error "cannot find name of link library for \`$lib'" |
| 6869 | fi |
| 6870 | # It is a libtool convenience library, so add in its objects. |
cristy | da16f16 | 2011-02-19 23:52:17 +0000 | [diff] [blame] | 6871 | convenience+=" $ladir/$objdir/$old_library" |
| 6872 | old_convenience+=" $ladir/$objdir/$old_library" |
cristy | 3ed852e | 2009-09-05 21:47:34 +0000 | [diff] [blame] | 6873 | elif test "$linkmode" != prog && test "$linkmode" != lib; then |
| 6874 | func_fatal_error "\`$lib' is not a convenience library" |
| 6875 | fi |
| 6876 | tmp_libs= |
| 6877 | for deplib in $dependency_libs; do |
| 6878 | deplibs="$deplib $deplibs" |
cristy | da16f16 | 2011-02-19 23:52:17 +0000 | [diff] [blame] | 6879 | if $opt_preserve_dup_deps ; then |
cristy | 3ed852e | 2009-09-05 21:47:34 +0000 | [diff] [blame] | 6880 | case "$tmp_libs " in |
cristy | da16f16 | 2011-02-19 23:52:17 +0000 | [diff] [blame] | 6881 | *" $deplib "*) specialdeplibs+=" $deplib" ;; |
cristy | 3ed852e | 2009-09-05 21:47:34 +0000 | [diff] [blame] | 6882 | esac |
| 6883 | fi |
cristy | da16f16 | 2011-02-19 23:52:17 +0000 | [diff] [blame] | 6884 | tmp_libs+=" $deplib" |
cristy | 3ed852e | 2009-09-05 21:47:34 +0000 | [diff] [blame] | 6885 | done |
| 6886 | continue |
| 6887 | fi # $pass = conv |
| 6888 | |
| 6889 | |
| 6890 | # Get the name of the library we link against. |
| 6891 | linklib= |
cristy | da16f16 | 2011-02-19 23:52:17 +0000 | [diff] [blame] | 6892 | if test -n "$old_library" && |
| 6893 | { test "$prefer_static_libs" = yes || |
| 6894 | test "$prefer_static_libs,$installed" = "built,no"; }; then |
| 6895 | linklib=$old_library |
| 6896 | else |
| 6897 | for l in $old_library $library_names; do |
| 6898 | linklib="$l" |
| 6899 | done |
| 6900 | fi |
cristy | 3ed852e | 2009-09-05 21:47:34 +0000 | [diff] [blame] | 6901 | if test -z "$linklib"; then |
| 6902 | func_fatal_error "cannot find name of link library for \`$lib'" |
| 6903 | fi |
| 6904 | |
| 6905 | # This library was specified with -dlopen. |
| 6906 | if test "$pass" = dlopen; then |
| 6907 | if test -z "$libdir"; then |
| 6908 | func_fatal_error "cannot -dlopen a convenience library: \`$lib'" |
| 6909 | fi |
| 6910 | if test -z "$dlname" || |
| 6911 | test "$dlopen_support" != yes || |
| 6912 | test "$build_libtool_libs" = no; then |
| 6913 | # If there is no dlname, no dlopen support or we're linking |
| 6914 | # statically, we need to preload. We also need to preload any |
| 6915 | # dependent libraries so libltdl's deplib preloader doesn't |
| 6916 | # bomb out in the load deplibs phase. |
cristy | da16f16 | 2011-02-19 23:52:17 +0000 | [diff] [blame] | 6917 | dlprefiles+=" $lib $dependency_libs" |
cristy | 3ed852e | 2009-09-05 21:47:34 +0000 | [diff] [blame] | 6918 | else |
cristy | da16f16 | 2011-02-19 23:52:17 +0000 | [diff] [blame] | 6919 | newdlfiles+=" $lib" |
cristy | 3ed852e | 2009-09-05 21:47:34 +0000 | [diff] [blame] | 6920 | fi |
| 6921 | continue |
| 6922 | fi # $pass = dlopen |
| 6923 | |
| 6924 | # We need an absolute path. |
| 6925 | case $ladir in |
| 6926 | [\\/]* | [A-Za-z]:[\\/]*) abs_ladir="$ladir" ;; |
| 6927 | *) |
| 6928 | abs_ladir=`cd "$ladir" && pwd` |
| 6929 | if test -z "$abs_ladir"; then |
| 6930 | func_warning "cannot determine absolute directory name of \`$ladir'" |
| 6931 | func_warning "passing it literally to the linker, although it might fail" |
| 6932 | abs_ladir="$ladir" |
| 6933 | fi |
| 6934 | ;; |
| 6935 | esac |
| 6936 | func_basename "$lib" |
| 6937 | laname="$func_basename_result" |
| 6938 | |
| 6939 | # Find the relevant object directory and library name. |
| 6940 | if test "X$installed" = Xyes; then |
cristy | da16f16 | 2011-02-19 23:52:17 +0000 | [diff] [blame] | 6941 | if test ! -f "$lt_sysroot$libdir/$linklib" && test -f "$abs_ladir/$linklib"; then |
cristy | 3ed852e | 2009-09-05 21:47:34 +0000 | [diff] [blame] | 6942 | func_warning "library \`$lib' was moved." |
| 6943 | dir="$ladir" |
| 6944 | absdir="$abs_ladir" |
| 6945 | libdir="$abs_ladir" |
| 6946 | else |
cristy | da16f16 | 2011-02-19 23:52:17 +0000 | [diff] [blame] | 6947 | dir="$lt_sysroot$libdir" |
| 6948 | absdir="$lt_sysroot$libdir" |
cristy | 3ed852e | 2009-09-05 21:47:34 +0000 | [diff] [blame] | 6949 | fi |
| 6950 | test "X$hardcode_automatic" = Xyes && avoidtemprpath=yes |
| 6951 | else |
| 6952 | if test ! -f "$ladir/$objdir/$linklib" && test -f "$abs_ladir/$linklib"; then |
| 6953 | dir="$ladir" |
| 6954 | absdir="$abs_ladir" |
| 6955 | # Remove this search path later |
cristy | da16f16 | 2011-02-19 23:52:17 +0000 | [diff] [blame] | 6956 | notinst_path+=" $abs_ladir" |
cristy | 3ed852e | 2009-09-05 21:47:34 +0000 | [diff] [blame] | 6957 | else |
| 6958 | dir="$ladir/$objdir" |
| 6959 | absdir="$abs_ladir/$objdir" |
| 6960 | # Remove this search path later |
cristy | da16f16 | 2011-02-19 23:52:17 +0000 | [diff] [blame] | 6961 | notinst_path+=" $abs_ladir" |
cristy | 3ed852e | 2009-09-05 21:47:34 +0000 | [diff] [blame] | 6962 | fi |
| 6963 | fi # $installed = yes |
| 6964 | func_stripname 'lib' '.la' "$laname" |
| 6965 | name=$func_stripname_result |
| 6966 | |
| 6967 | # This library was specified with -dlpreopen. |
| 6968 | if test "$pass" = dlpreopen; then |
| 6969 | if test -z "$libdir" && test "$linkmode" = prog; then |
| 6970 | func_fatal_error "only libraries may -dlpreopen a convenience library: \`$lib'" |
| 6971 | fi |
cristy | da16f16 | 2011-02-19 23:52:17 +0000 | [diff] [blame] | 6972 | case "$host" in |
| 6973 | # special handling for platforms with PE-DLLs. |
| 6974 | *cygwin* | *mingw* | *cegcc* ) |
| 6975 | # Linker will automatically link against shared library if both |
| 6976 | # static and shared are present. Therefore, ensure we extract |
| 6977 | # symbols from the import library if a shared library is present |
| 6978 | # (otherwise, the dlopen module name will be incorrect). We do |
| 6979 | # this by putting the import library name into $newdlprefiles. |
| 6980 | # We recover the dlopen module name by 'saving' the la file |
| 6981 | # name in a special purpose variable, and (later) extracting the |
| 6982 | # dlname from the la file. |
| 6983 | if test -n "$dlname"; then |
| 6984 | func_tr_sh "$dir/$linklib" |
| 6985 | eval "libfile_$func_tr_sh_result=\$abs_ladir/\$laname" |
| 6986 | newdlprefiles+=" $dir/$linklib" |
| 6987 | else |
| 6988 | newdlprefiles+=" $dir/$old_library" |
| 6989 | # Keep a list of preopened convenience libraries to check |
| 6990 | # that they are being used correctly in the link pass. |
| 6991 | test -z "$libdir" && \ |
| 6992 | dlpreconveniencelibs+=" $dir/$old_library" |
| 6993 | fi |
| 6994 | ;; |
| 6995 | * ) |
| 6996 | # Prefer using a static library (so that no silly _DYNAMIC symbols |
| 6997 | # are required to link). |
| 6998 | if test -n "$old_library"; then |
| 6999 | newdlprefiles+=" $dir/$old_library" |
| 7000 | # Keep a list of preopened convenience libraries to check |
| 7001 | # that they are being used correctly in the link pass. |
| 7002 | test -z "$libdir" && \ |
| 7003 | dlpreconveniencelibs+=" $dir/$old_library" |
| 7004 | # Otherwise, use the dlname, so that lt_dlopen finds it. |
| 7005 | elif test -n "$dlname"; then |
| 7006 | newdlprefiles+=" $dir/$dlname" |
| 7007 | else |
| 7008 | newdlprefiles+=" $dir/$linklib" |
| 7009 | fi |
| 7010 | ;; |
| 7011 | esac |
cristy | 3ed852e | 2009-09-05 21:47:34 +0000 | [diff] [blame] | 7012 | fi # $pass = dlpreopen |
| 7013 | |
| 7014 | if test -z "$libdir"; then |
| 7015 | # Link the convenience library |
| 7016 | if test "$linkmode" = lib; then |
| 7017 | deplibs="$dir/$old_library $deplibs" |
| 7018 | elif test "$linkmode,$pass" = "prog,link"; then |
| 7019 | compile_deplibs="$dir/$old_library $compile_deplibs" |
| 7020 | finalize_deplibs="$dir/$old_library $finalize_deplibs" |
| 7021 | else |
| 7022 | deplibs="$lib $deplibs" # used for prog,scan pass |
| 7023 | fi |
| 7024 | continue |
| 7025 | fi |
| 7026 | |
| 7027 | |
| 7028 | if test "$linkmode" = prog && test "$pass" != link; then |
cristy | da16f16 | 2011-02-19 23:52:17 +0000 | [diff] [blame] | 7029 | newlib_search_path+=" $ladir" |
cristy | 3ed852e | 2009-09-05 21:47:34 +0000 | [diff] [blame] | 7030 | deplibs="$lib $deplibs" |
| 7031 | |
| 7032 | linkalldeplibs=no |
| 7033 | if test "$link_all_deplibs" != no || test -z "$library_names" || |
| 7034 | test "$build_libtool_libs" = no; then |
| 7035 | linkalldeplibs=yes |
| 7036 | fi |
| 7037 | |
| 7038 | tmp_libs= |
| 7039 | for deplib in $dependency_libs; do |
| 7040 | case $deplib in |
| 7041 | -L*) func_stripname '-L' '' "$deplib" |
cristy | da16f16 | 2011-02-19 23:52:17 +0000 | [diff] [blame] | 7042 | func_resolve_sysroot "$func_stripname_result" |
| 7043 | newlib_search_path+=" $func_resolve_sysroot_result" |
cristy | 3ed852e | 2009-09-05 21:47:34 +0000 | [diff] [blame] | 7044 | ;; |
| 7045 | esac |
| 7046 | # Need to link against all dependency_libs? |
| 7047 | if test "$linkalldeplibs" = yes; then |
| 7048 | deplibs="$deplib $deplibs" |
| 7049 | else |
| 7050 | # Need to hardcode shared library paths |
| 7051 | # or/and link against static libraries |
| 7052 | newdependency_libs="$deplib $newdependency_libs" |
| 7053 | fi |
cristy | da16f16 | 2011-02-19 23:52:17 +0000 | [diff] [blame] | 7054 | if $opt_preserve_dup_deps ; then |
cristy | 3ed852e | 2009-09-05 21:47:34 +0000 | [diff] [blame] | 7055 | case "$tmp_libs " in |
cristy | da16f16 | 2011-02-19 23:52:17 +0000 | [diff] [blame] | 7056 | *" $deplib "*) specialdeplibs+=" $deplib" ;; |
cristy | 3ed852e | 2009-09-05 21:47:34 +0000 | [diff] [blame] | 7057 | esac |
| 7058 | fi |
cristy | da16f16 | 2011-02-19 23:52:17 +0000 | [diff] [blame] | 7059 | tmp_libs+=" $deplib" |
cristy | 3ed852e | 2009-09-05 21:47:34 +0000 | [diff] [blame] | 7060 | done # for deplib |
| 7061 | continue |
| 7062 | fi # $linkmode = prog... |
| 7063 | |
| 7064 | if test "$linkmode,$pass" = "prog,link"; then |
| 7065 | if test -n "$library_names" && |
| 7066 | { { test "$prefer_static_libs" = no || |
| 7067 | test "$prefer_static_libs,$installed" = "built,yes"; } || |
| 7068 | test -z "$old_library"; }; then |
| 7069 | # We need to hardcode the library path |
| 7070 | if test -n "$shlibpath_var" && test -z "$avoidtemprpath" ; then |
| 7071 | # Make sure the rpath contains only unique directories. |
| 7072 | case "$temp_rpath:" in |
| 7073 | *"$absdir:"*) ;; |
cristy | da16f16 | 2011-02-19 23:52:17 +0000 | [diff] [blame] | 7074 | *) temp_rpath+="$absdir:" ;; |
cristy | 3ed852e | 2009-09-05 21:47:34 +0000 | [diff] [blame] | 7075 | esac |
| 7076 | fi |
| 7077 | |
| 7078 | # Hardcode the library path. |
| 7079 | # Skip directories that are in the system default run-time |
| 7080 | # search path. |
| 7081 | case " $sys_lib_dlsearch_path " in |
| 7082 | *" $absdir "*) ;; |
| 7083 | *) |
| 7084 | case "$compile_rpath " in |
| 7085 | *" $absdir "*) ;; |
cristy | da16f16 | 2011-02-19 23:52:17 +0000 | [diff] [blame] | 7086 | *) compile_rpath+=" $absdir" ;; |
cristy | 3ed852e | 2009-09-05 21:47:34 +0000 | [diff] [blame] | 7087 | esac |
| 7088 | ;; |
| 7089 | esac |
| 7090 | case " $sys_lib_dlsearch_path " in |
| 7091 | *" $libdir "*) ;; |
| 7092 | *) |
| 7093 | case "$finalize_rpath " in |
| 7094 | *" $libdir "*) ;; |
cristy | da16f16 | 2011-02-19 23:52:17 +0000 | [diff] [blame] | 7095 | *) finalize_rpath+=" $libdir" ;; |
cristy | 3ed852e | 2009-09-05 21:47:34 +0000 | [diff] [blame] | 7096 | esac |
| 7097 | ;; |
| 7098 | esac |
| 7099 | fi # $linkmode,$pass = prog,link... |
| 7100 | |
| 7101 | if test "$alldeplibs" = yes && |
| 7102 | { test "$deplibs_check_method" = pass_all || |
| 7103 | { test "$build_libtool_libs" = yes && |
| 7104 | test -n "$library_names"; }; }; then |
| 7105 | # We only need to search for static libraries |
| 7106 | continue |
| 7107 | fi |
| 7108 | fi |
| 7109 | |
| 7110 | link_static=no # Whether the deplib will be linked statically |
| 7111 | use_static_libs=$prefer_static_libs |
| 7112 | if test "$use_static_libs" = built && test "$installed" = yes; then |
| 7113 | use_static_libs=no |
| 7114 | fi |
| 7115 | if test -n "$library_names" && |
| 7116 | { test "$use_static_libs" = no || test -z "$old_library"; }; then |
| 7117 | case $host in |
| 7118 | *cygwin* | *mingw* | *cegcc*) |
| 7119 | # No point in relinking DLLs because paths are not encoded |
cristy | da16f16 | 2011-02-19 23:52:17 +0000 | [diff] [blame] | 7120 | notinst_deplibs+=" $lib" |
cristy | 3ed852e | 2009-09-05 21:47:34 +0000 | [diff] [blame] | 7121 | need_relink=no |
| 7122 | ;; |
| 7123 | *) |
| 7124 | if test "$installed" = no; then |
cristy | da16f16 | 2011-02-19 23:52:17 +0000 | [diff] [blame] | 7125 | notinst_deplibs+=" $lib" |
cristy | 3ed852e | 2009-09-05 21:47:34 +0000 | [diff] [blame] | 7126 | need_relink=yes |
| 7127 | fi |
| 7128 | ;; |
| 7129 | esac |
| 7130 | # This is a shared library |
| 7131 | |
| 7132 | # Warn about portability, can't link against -module's on some |
| 7133 | # systems (darwin). Don't bleat about dlopened modules though! |
| 7134 | dlopenmodule="" |
| 7135 | for dlpremoduletest in $dlprefiles; do |
| 7136 | if test "X$dlpremoduletest" = "X$lib"; then |
| 7137 | dlopenmodule="$dlpremoduletest" |
| 7138 | break |
| 7139 | fi |
| 7140 | done |
| 7141 | if test -z "$dlopenmodule" && test "$shouldnotlink" = yes && test "$pass" = link; then |
cristy | 98dddb5 | 2010-11-04 00:30:15 +0000 | [diff] [blame] | 7142 | echo |
cristy | 3ed852e | 2009-09-05 21:47:34 +0000 | [diff] [blame] | 7143 | if test "$linkmode" = prog; then |
| 7144 | $ECHO "*** Warning: Linking the executable $output against the loadable module" |
| 7145 | else |
| 7146 | $ECHO "*** Warning: Linking the shared library $output against the loadable module" |
| 7147 | fi |
| 7148 | $ECHO "*** $linklib is not portable!" |
| 7149 | fi |
| 7150 | if test "$linkmode" = lib && |
| 7151 | test "$hardcode_into_libs" = yes; then |
| 7152 | # Hardcode the library path. |
| 7153 | # Skip directories that are in the system default run-time |
| 7154 | # search path. |
| 7155 | case " $sys_lib_dlsearch_path " in |
| 7156 | *" $absdir "*) ;; |
| 7157 | *) |
| 7158 | case "$compile_rpath " in |
| 7159 | *" $absdir "*) ;; |
cristy | da16f16 | 2011-02-19 23:52:17 +0000 | [diff] [blame] | 7160 | *) compile_rpath+=" $absdir" ;; |
cristy | 3ed852e | 2009-09-05 21:47:34 +0000 | [diff] [blame] | 7161 | esac |
| 7162 | ;; |
| 7163 | esac |
| 7164 | case " $sys_lib_dlsearch_path " in |
| 7165 | *" $libdir "*) ;; |
| 7166 | *) |
| 7167 | case "$finalize_rpath " in |
| 7168 | *" $libdir "*) ;; |
cristy | da16f16 | 2011-02-19 23:52:17 +0000 | [diff] [blame] | 7169 | *) finalize_rpath+=" $libdir" ;; |
cristy | 3ed852e | 2009-09-05 21:47:34 +0000 | [diff] [blame] | 7170 | esac |
| 7171 | ;; |
| 7172 | esac |
| 7173 | fi |
| 7174 | |
| 7175 | if test -n "$old_archive_from_expsyms_cmds"; then |
| 7176 | # figure out the soname |
| 7177 | set dummy $library_names |
| 7178 | shift |
| 7179 | realname="$1" |
| 7180 | shift |
| 7181 | libname=`eval "\\$ECHO \"$libname_spec\""` |
| 7182 | # use dlname if we got it. it's perfectly good, no? |
| 7183 | if test -n "$dlname"; then |
| 7184 | soname="$dlname" |
| 7185 | elif test -n "$soname_spec"; then |
| 7186 | # bleh windows |
| 7187 | case $host in |
| 7188 | *cygwin* | mingw* | *cegcc*) |
| 7189 | func_arith $current - $age |
| 7190 | major=$func_arith_result |
| 7191 | versuffix="-$major" |
| 7192 | ;; |
| 7193 | esac |
| 7194 | eval soname=\"$soname_spec\" |
| 7195 | else |
| 7196 | soname="$realname" |
| 7197 | fi |
| 7198 | |
| 7199 | # Make a new name for the extract_expsyms_cmds to use |
| 7200 | soroot="$soname" |
| 7201 | func_basename "$soroot" |
| 7202 | soname="$func_basename_result" |
| 7203 | func_stripname 'lib' '.dll' "$soname" |
| 7204 | newlib=libimp-$func_stripname_result.a |
| 7205 | |
| 7206 | # If the library has no export list, then create one now |
| 7207 | if test -f "$output_objdir/$soname-def"; then : |
| 7208 | else |
| 7209 | func_verbose "extracting exported symbol list from \`$soname'" |
| 7210 | func_execute_cmds "$extract_expsyms_cmds" 'exit $?' |
| 7211 | fi |
| 7212 | |
| 7213 | # Create $newlib |
| 7214 | if test -f "$output_objdir/$newlib"; then :; else |
| 7215 | func_verbose "generating import library for \`$soname'" |
| 7216 | func_execute_cmds "$old_archive_from_expsyms_cmds" 'exit $?' |
| 7217 | fi |
| 7218 | # make sure the library variables are pointing to the new library |
| 7219 | dir=$output_objdir |
| 7220 | linklib=$newlib |
| 7221 | fi # test -n "$old_archive_from_expsyms_cmds" |
| 7222 | |
cristy | da16f16 | 2011-02-19 23:52:17 +0000 | [diff] [blame] | 7223 | if test "$linkmode" = prog || test "$opt_mode" != relink; then |
cristy | 3ed852e | 2009-09-05 21:47:34 +0000 | [diff] [blame] | 7224 | add_shlibpath= |
| 7225 | add_dir= |
| 7226 | add= |
| 7227 | lib_linked=yes |
| 7228 | case $hardcode_action in |
| 7229 | immediate | unsupported) |
| 7230 | if test "$hardcode_direct" = no; then |
| 7231 | add="$dir/$linklib" |
| 7232 | case $host in |
| 7233 | *-*-sco3.2v5.0.[024]*) add_dir="-L$dir" ;; |
| 7234 | *-*-sysv4*uw2*) add_dir="-L$dir" ;; |
| 7235 | *-*-sysv5OpenUNIX* | *-*-sysv5UnixWare7.[01].[10]* | \ |
| 7236 | *-*-unixware7*) add_dir="-L$dir" ;; |
| 7237 | *-*-darwin* ) |
| 7238 | # if the lib is a (non-dlopened) module then we can not |
| 7239 | # link against it, someone is ignoring the earlier warnings |
| 7240 | if /usr/bin/file -L $add 2> /dev/null | |
| 7241 | $GREP ": [^:]* bundle" >/dev/null ; then |
| 7242 | if test "X$dlopenmodule" != "X$lib"; then |
| 7243 | $ECHO "*** Warning: lib $linklib is a module, not a shared library" |
| 7244 | if test -z "$old_library" ; then |
cristy | 98dddb5 | 2010-11-04 00:30:15 +0000 | [diff] [blame] | 7245 | echo |
| 7246 | echo "*** And there doesn't seem to be a static archive available" |
| 7247 | echo "*** The link will probably fail, sorry" |
cristy | 3ed852e | 2009-09-05 21:47:34 +0000 | [diff] [blame] | 7248 | else |
| 7249 | add="$dir/$old_library" |
| 7250 | fi |
| 7251 | elif test -n "$old_library"; then |
| 7252 | add="$dir/$old_library" |
| 7253 | fi |
| 7254 | fi |
| 7255 | esac |
| 7256 | elif test "$hardcode_minus_L" = no; then |
| 7257 | case $host in |
| 7258 | *-*-sunos*) add_shlibpath="$dir" ;; |
| 7259 | esac |
| 7260 | add_dir="-L$dir" |
| 7261 | add="-l$name" |
| 7262 | elif test "$hardcode_shlibpath_var" = no; then |
| 7263 | add_shlibpath="$dir" |
| 7264 | add="-l$name" |
| 7265 | else |
| 7266 | lib_linked=no |
| 7267 | fi |
| 7268 | ;; |
| 7269 | relink) |
| 7270 | if test "$hardcode_direct" = yes && |
| 7271 | test "$hardcode_direct_absolute" = no; then |
| 7272 | add="$dir/$linklib" |
| 7273 | elif test "$hardcode_minus_L" = yes; then |
| 7274 | add_dir="-L$dir" |
| 7275 | # Try looking first in the location we're being installed to. |
| 7276 | if test -n "$inst_prefix_dir"; then |
| 7277 | case $libdir in |
| 7278 | [\\/]*) |
cristy | da16f16 | 2011-02-19 23:52:17 +0000 | [diff] [blame] | 7279 | add_dir+=" -L$inst_prefix_dir$libdir" |
cristy | 3ed852e | 2009-09-05 21:47:34 +0000 | [diff] [blame] | 7280 | ;; |
| 7281 | esac |
| 7282 | fi |
| 7283 | add="-l$name" |
| 7284 | elif test "$hardcode_shlibpath_var" = yes; then |
| 7285 | add_shlibpath="$dir" |
| 7286 | add="-l$name" |
| 7287 | else |
| 7288 | lib_linked=no |
| 7289 | fi |
| 7290 | ;; |
| 7291 | *) lib_linked=no ;; |
| 7292 | esac |
| 7293 | |
cristy | f6fcb5d | 2010-09-24 01:19:13 +0000 | [diff] [blame] | 7294 | if test "$lib_linked" != yes; then |
| 7295 | func_fatal_configuration "unsupported hardcode properties" |
| 7296 | fi |
| 7297 | |
cristy | 3ed852e | 2009-09-05 21:47:34 +0000 | [diff] [blame] | 7298 | if test -n "$add_shlibpath"; then |
| 7299 | case :$compile_shlibpath: in |
| 7300 | *":$add_shlibpath:"*) ;; |
cristy | da16f16 | 2011-02-19 23:52:17 +0000 | [diff] [blame] | 7301 | *) compile_shlibpath+="$add_shlibpath:" ;; |
cristy | 3ed852e | 2009-09-05 21:47:34 +0000 | [diff] [blame] | 7302 | esac |
| 7303 | fi |
| 7304 | if test "$linkmode" = prog; then |
| 7305 | test -n "$add_dir" && compile_deplibs="$add_dir $compile_deplibs" |
| 7306 | test -n "$add" && compile_deplibs="$add $compile_deplibs" |
| 7307 | else |
| 7308 | test -n "$add_dir" && deplibs="$add_dir $deplibs" |
| 7309 | test -n "$add" && deplibs="$add $deplibs" |
| 7310 | if test "$hardcode_direct" != yes && |
| 7311 | test "$hardcode_minus_L" != yes && |
| 7312 | test "$hardcode_shlibpath_var" = yes; then |
| 7313 | case :$finalize_shlibpath: in |
| 7314 | *":$libdir:"*) ;; |
cristy | da16f16 | 2011-02-19 23:52:17 +0000 | [diff] [blame] | 7315 | *) finalize_shlibpath+="$libdir:" ;; |
cristy | 3ed852e | 2009-09-05 21:47:34 +0000 | [diff] [blame] | 7316 | esac |
| 7317 | fi |
| 7318 | fi |
| 7319 | fi |
| 7320 | |
cristy | da16f16 | 2011-02-19 23:52:17 +0000 | [diff] [blame] | 7321 | if test "$linkmode" = prog || test "$opt_mode" = relink; then |
cristy | 3ed852e | 2009-09-05 21:47:34 +0000 | [diff] [blame] | 7322 | add_shlibpath= |
| 7323 | add_dir= |
| 7324 | add= |
| 7325 | # Finalize command for both is simple: just hardcode it. |
| 7326 | if test "$hardcode_direct" = yes && |
| 7327 | test "$hardcode_direct_absolute" = no; then |
| 7328 | add="$libdir/$linklib" |
| 7329 | elif test "$hardcode_minus_L" = yes; then |
| 7330 | add_dir="-L$libdir" |
| 7331 | add="-l$name" |
| 7332 | elif test "$hardcode_shlibpath_var" = yes; then |
| 7333 | case :$finalize_shlibpath: in |
| 7334 | *":$libdir:"*) ;; |
cristy | da16f16 | 2011-02-19 23:52:17 +0000 | [diff] [blame] | 7335 | *) finalize_shlibpath+="$libdir:" ;; |
cristy | 3ed852e | 2009-09-05 21:47:34 +0000 | [diff] [blame] | 7336 | esac |
| 7337 | add="-l$name" |
| 7338 | elif test "$hardcode_automatic" = yes; then |
| 7339 | if test -n "$inst_prefix_dir" && |
| 7340 | test -f "$inst_prefix_dir$libdir/$linklib" ; then |
| 7341 | add="$inst_prefix_dir$libdir/$linklib" |
| 7342 | else |
| 7343 | add="$libdir/$linklib" |
| 7344 | fi |
| 7345 | else |
| 7346 | # We cannot seem to hardcode it, guess we'll fake it. |
| 7347 | add_dir="-L$libdir" |
| 7348 | # Try looking first in the location we're being installed to. |
| 7349 | if test -n "$inst_prefix_dir"; then |
| 7350 | case $libdir in |
| 7351 | [\\/]*) |
cristy | da16f16 | 2011-02-19 23:52:17 +0000 | [diff] [blame] | 7352 | add_dir+=" -L$inst_prefix_dir$libdir" |
cristy | 3ed852e | 2009-09-05 21:47:34 +0000 | [diff] [blame] | 7353 | ;; |
| 7354 | esac |
| 7355 | fi |
| 7356 | add="-l$name" |
| 7357 | fi |
| 7358 | |
| 7359 | if test "$linkmode" = prog; then |
| 7360 | test -n "$add_dir" && finalize_deplibs="$add_dir $finalize_deplibs" |
| 7361 | test -n "$add" && finalize_deplibs="$add $finalize_deplibs" |
| 7362 | else |
| 7363 | test -n "$add_dir" && deplibs="$add_dir $deplibs" |
| 7364 | test -n "$add" && deplibs="$add $deplibs" |
| 7365 | fi |
| 7366 | fi |
| 7367 | elif test "$linkmode" = prog; then |
| 7368 | # Here we assume that one of hardcode_direct or hardcode_minus_L |
| 7369 | # is not unsupported. This is valid on all known static and |
| 7370 | # shared platforms. |
| 7371 | if test "$hardcode_direct" != unsupported; then |
| 7372 | test -n "$old_library" && linklib="$old_library" |
| 7373 | compile_deplibs="$dir/$linklib $compile_deplibs" |
| 7374 | finalize_deplibs="$dir/$linklib $finalize_deplibs" |
| 7375 | else |
| 7376 | compile_deplibs="-l$name -L$dir $compile_deplibs" |
| 7377 | finalize_deplibs="-l$name -L$dir $finalize_deplibs" |
| 7378 | fi |
| 7379 | elif test "$build_libtool_libs" = yes; then |
| 7380 | # Not a shared library |
| 7381 | if test "$deplibs_check_method" != pass_all; then |
| 7382 | # We're trying link a shared library against a static one |
| 7383 | # but the system doesn't support it. |
| 7384 | |
| 7385 | # Just print a warning and add the library to dependency_libs so |
| 7386 | # that the program can be linked against the static library. |
cristy | 98dddb5 | 2010-11-04 00:30:15 +0000 | [diff] [blame] | 7387 | echo |
cristy | 3ed852e | 2009-09-05 21:47:34 +0000 | [diff] [blame] | 7388 | $ECHO "*** Warning: This system can not link to static lib archive $lib." |
cristy | 98dddb5 | 2010-11-04 00:30:15 +0000 | [diff] [blame] | 7389 | echo "*** I have the capability to make that library automatically link in when" |
| 7390 | echo "*** you link to this library. But I can only do this if you have a" |
| 7391 | echo "*** shared version of the library, which you do not appear to have." |
cristy | 3ed852e | 2009-09-05 21:47:34 +0000 | [diff] [blame] | 7392 | if test "$module" = yes; then |
cristy | 98dddb5 | 2010-11-04 00:30:15 +0000 | [diff] [blame] | 7393 | echo "*** But as you try to build a module library, libtool will still create " |
| 7394 | echo "*** a static module, that should work as long as the dlopening application" |
| 7395 | echo "*** is linked with the -dlopen flag to resolve symbols at runtime." |
cristy | 3ed852e | 2009-09-05 21:47:34 +0000 | [diff] [blame] | 7396 | if test -z "$global_symbol_pipe"; then |
cristy | 98dddb5 | 2010-11-04 00:30:15 +0000 | [diff] [blame] | 7397 | echo |
| 7398 | echo "*** However, this would only work if libtool was able to extract symbol" |
| 7399 | echo "*** lists from a program, using \`nm' or equivalent, but libtool could" |
| 7400 | echo "*** not find such a program. So, this module is probably useless." |
| 7401 | echo "*** \`nm' from GNU binutils and a full rebuild may help." |
cristy | 3ed852e | 2009-09-05 21:47:34 +0000 | [diff] [blame] | 7402 | fi |
| 7403 | if test "$build_old_libs" = no; then |
| 7404 | build_libtool_libs=module |
| 7405 | build_old_libs=yes |
| 7406 | else |
| 7407 | build_libtool_libs=no |
| 7408 | fi |
| 7409 | fi |
| 7410 | else |
| 7411 | deplibs="$dir/$old_library $deplibs" |
| 7412 | link_static=yes |
| 7413 | fi |
| 7414 | fi # link shared/static library? |
| 7415 | |
| 7416 | if test "$linkmode" = lib; then |
| 7417 | if test -n "$dependency_libs" && |
| 7418 | { test "$hardcode_into_libs" != yes || |
| 7419 | test "$build_old_libs" = yes || |
| 7420 | test "$link_static" = yes; }; then |
| 7421 | # Extract -R from dependency_libs |
| 7422 | temp_deplibs= |
| 7423 | for libdir in $dependency_libs; do |
| 7424 | case $libdir in |
| 7425 | -R*) func_stripname '-R' '' "$libdir" |
| 7426 | temp_xrpath=$func_stripname_result |
| 7427 | case " $xrpath " in |
| 7428 | *" $temp_xrpath "*) ;; |
cristy | da16f16 | 2011-02-19 23:52:17 +0000 | [diff] [blame] | 7429 | *) xrpath+=" $temp_xrpath";; |
cristy | 3ed852e | 2009-09-05 21:47:34 +0000 | [diff] [blame] | 7430 | esac;; |
cristy | da16f16 | 2011-02-19 23:52:17 +0000 | [diff] [blame] | 7431 | *) temp_deplibs+=" $libdir";; |
cristy | 3ed852e | 2009-09-05 21:47:34 +0000 | [diff] [blame] | 7432 | esac |
| 7433 | done |
| 7434 | dependency_libs="$temp_deplibs" |
| 7435 | fi |
| 7436 | |
cristy | da16f16 | 2011-02-19 23:52:17 +0000 | [diff] [blame] | 7437 | newlib_search_path+=" $absdir" |
cristy | 3ed852e | 2009-09-05 21:47:34 +0000 | [diff] [blame] | 7438 | # Link against this library |
| 7439 | test "$link_static" = no && newdependency_libs="$abs_ladir/$laname $newdependency_libs" |
| 7440 | # ... and its dependency_libs |
| 7441 | tmp_libs= |
| 7442 | for deplib in $dependency_libs; do |
| 7443 | newdependency_libs="$deplib $newdependency_libs" |
cristy | da16f16 | 2011-02-19 23:52:17 +0000 | [diff] [blame] | 7444 | case $deplib in |
| 7445 | -L*) func_stripname '-L' '' "$deplib" |
| 7446 | func_resolve_sysroot "$func_stripname_result";; |
| 7447 | *) func_resolve_sysroot "$deplib" ;; |
| 7448 | esac |
| 7449 | if $opt_preserve_dup_deps ; then |
cristy | 3ed852e | 2009-09-05 21:47:34 +0000 | [diff] [blame] | 7450 | case "$tmp_libs " in |
cristy | da16f16 | 2011-02-19 23:52:17 +0000 | [diff] [blame] | 7451 | *" $func_resolve_sysroot_result "*) |
| 7452 | specialdeplibs+=" $func_resolve_sysroot_result" ;; |
cristy | 3ed852e | 2009-09-05 21:47:34 +0000 | [diff] [blame] | 7453 | esac |
| 7454 | fi |
cristy | da16f16 | 2011-02-19 23:52:17 +0000 | [diff] [blame] | 7455 | tmp_libs+=" $func_resolve_sysroot_result" |
cristy | 3ed852e | 2009-09-05 21:47:34 +0000 | [diff] [blame] | 7456 | done |
| 7457 | |
| 7458 | if test "$link_all_deplibs" != no; then |
| 7459 | # Add the search paths of all dependency libraries |
| 7460 | for deplib in $dependency_libs; do |
cristy | 98dddb5 | 2010-11-04 00:30:15 +0000 | [diff] [blame] | 7461 | path= |
cristy | 3ed852e | 2009-09-05 21:47:34 +0000 | [diff] [blame] | 7462 | case $deplib in |
| 7463 | -L*) path="$deplib" ;; |
| 7464 | *.la) |
cristy | da16f16 | 2011-02-19 23:52:17 +0000 | [diff] [blame] | 7465 | func_resolve_sysroot "$deplib" |
| 7466 | deplib=$func_resolve_sysroot_result |
cristy | 3ed852e | 2009-09-05 21:47:34 +0000 | [diff] [blame] | 7467 | func_dirname "$deplib" "" "." |
cristy | da16f16 | 2011-02-19 23:52:17 +0000 | [diff] [blame] | 7468 | dir=$func_dirname_result |
cristy | 3ed852e | 2009-09-05 21:47:34 +0000 | [diff] [blame] | 7469 | # We need an absolute path. |
| 7470 | case $dir in |
| 7471 | [\\/]* | [A-Za-z]:[\\/]*) absdir="$dir" ;; |
| 7472 | *) |
| 7473 | absdir=`cd "$dir" && pwd` |
| 7474 | if test -z "$absdir"; then |
| 7475 | func_warning "cannot determine absolute directory name of \`$dir'" |
| 7476 | absdir="$dir" |
| 7477 | fi |
| 7478 | ;; |
| 7479 | esac |
| 7480 | if $GREP "^installed=no" $deplib > /dev/null; then |
| 7481 | case $host in |
| 7482 | *-*-darwin*) |
| 7483 | depdepl= |
| 7484 | eval deplibrary_names=`${SED} -n -e 's/^library_names=\(.*\)$/\1/p' $deplib` |
| 7485 | if test -n "$deplibrary_names" ; then |
| 7486 | for tmp in $deplibrary_names ; do |
| 7487 | depdepl=$tmp |
| 7488 | done |
| 7489 | if test -f "$absdir/$objdir/$depdepl" ; then |
| 7490 | depdepl="$absdir/$objdir/$depdepl" |
| 7491 | darwin_install_name=`${OTOOL} -L $depdepl | awk '{if (NR == 2) {print $1;exit}}'` |
| 7492 | if test -z "$darwin_install_name"; then |
| 7493 | darwin_install_name=`${OTOOL64} -L $depdepl | awk '{if (NR == 2) {print $1;exit}}'` |
| 7494 | fi |
cristy | da16f16 | 2011-02-19 23:52:17 +0000 | [diff] [blame] | 7495 | compiler_flags+=" ${wl}-dylib_file ${wl}${darwin_install_name}:${depdepl}" |
| 7496 | linker_flags+=" -dylib_file ${darwin_install_name}:${depdepl}" |
cristy | 3ed852e | 2009-09-05 21:47:34 +0000 | [diff] [blame] | 7497 | path= |
| 7498 | fi |
| 7499 | fi |
| 7500 | ;; |
| 7501 | *) |
| 7502 | path="-L$absdir/$objdir" |
| 7503 | ;; |
| 7504 | esac |
| 7505 | else |
| 7506 | eval libdir=`${SED} -n -e 's/^libdir=\(.*\)$/\1/p' $deplib` |
| 7507 | test -z "$libdir" && \ |
| 7508 | func_fatal_error "\`$deplib' is not a valid libtool archive" |
| 7509 | test "$absdir" != "$libdir" && \ |
| 7510 | func_warning "\`$deplib' seems to be moved" |
| 7511 | |
| 7512 | path="-L$absdir" |
| 7513 | fi |
| 7514 | ;; |
| 7515 | esac |
| 7516 | case " $deplibs " in |
| 7517 | *" $path "*) ;; |
| 7518 | *) deplibs="$path $deplibs" ;; |
| 7519 | esac |
| 7520 | done |
| 7521 | fi # link_all_deplibs != no |
| 7522 | fi # linkmode = lib |
| 7523 | done # for deplib in $libs |
| 7524 | if test "$pass" = link; then |
| 7525 | if test "$linkmode" = "prog"; then |
| 7526 | compile_deplibs="$new_inherited_linker_flags $compile_deplibs" |
| 7527 | finalize_deplibs="$new_inherited_linker_flags $finalize_deplibs" |
| 7528 | else |
cristy | 98dddb5 | 2010-11-04 00:30:15 +0000 | [diff] [blame] | 7529 | compiler_flags="$compiler_flags "`$ECHO " $new_inherited_linker_flags" | $SED 's% \([^ $]*\).ltframework% -framework \1%g'` |
cristy | 3ed852e | 2009-09-05 21:47:34 +0000 | [diff] [blame] | 7530 | fi |
| 7531 | fi |
| 7532 | dependency_libs="$newdependency_libs" |
| 7533 | if test "$pass" = dlpreopen; then |
| 7534 | # Link the dlpreopened libraries before other libraries |
| 7535 | for deplib in $save_deplibs; do |
| 7536 | deplibs="$deplib $deplibs" |
| 7537 | done |
| 7538 | fi |
| 7539 | if test "$pass" != dlopen; then |
| 7540 | if test "$pass" != conv; then |
| 7541 | # Make sure lib_search_path contains only unique directories. |
| 7542 | lib_search_path= |
| 7543 | for dir in $newlib_search_path; do |
| 7544 | case "$lib_search_path " in |
| 7545 | *" $dir "*) ;; |
cristy | da16f16 | 2011-02-19 23:52:17 +0000 | [diff] [blame] | 7546 | *) lib_search_path+=" $dir" ;; |
cristy | 3ed852e | 2009-09-05 21:47:34 +0000 | [diff] [blame] | 7547 | esac |
| 7548 | done |
| 7549 | newlib_search_path= |
| 7550 | fi |
| 7551 | |
| 7552 | if test "$linkmode,$pass" != "prog,link"; then |
| 7553 | vars="deplibs" |
| 7554 | else |
| 7555 | vars="compile_deplibs finalize_deplibs" |
| 7556 | fi |
| 7557 | for var in $vars dependency_libs; do |
| 7558 | # Add libraries to $var in reverse order |
| 7559 | eval tmp_libs=\"\$$var\" |
| 7560 | new_libs= |
| 7561 | for deplib in $tmp_libs; do |
| 7562 | # FIXME: Pedantically, this is the right thing to do, so |
| 7563 | # that some nasty dependency loop isn't accidentally |
| 7564 | # broken: |
| 7565 | #new_libs="$deplib $new_libs" |
| 7566 | # Pragmatically, this seems to cause very few problems in |
| 7567 | # practice: |
| 7568 | case $deplib in |
| 7569 | -L*) new_libs="$deplib $new_libs" ;; |
| 7570 | -R*) ;; |
| 7571 | *) |
| 7572 | # And here is the reason: when a library appears more |
| 7573 | # than once as an explicit dependence of a library, or |
| 7574 | # is implicitly linked in more than once by the |
| 7575 | # compiler, it is considered special, and multiple |
| 7576 | # occurrences thereof are not removed. Compare this |
| 7577 | # with having the same library being listed as a |
| 7578 | # dependency of multiple other libraries: in this case, |
| 7579 | # we know (pedantically, we assume) the library does not |
| 7580 | # need to be listed more than once, so we keep only the |
| 7581 | # last copy. This is not always right, but it is rare |
| 7582 | # enough that we require users that really mean to play |
| 7583 | # such unportable linking tricks to link the library |
| 7584 | # using -Wl,-lname, so that libtool does not consider it |
| 7585 | # for duplicate removal. |
| 7586 | case " $specialdeplibs " in |
| 7587 | *" $deplib "*) new_libs="$deplib $new_libs" ;; |
| 7588 | *) |
| 7589 | case " $new_libs " in |
| 7590 | *" $deplib "*) ;; |
| 7591 | *) new_libs="$deplib $new_libs" ;; |
| 7592 | esac |
| 7593 | ;; |
| 7594 | esac |
| 7595 | ;; |
| 7596 | esac |
| 7597 | done |
| 7598 | tmp_libs= |
| 7599 | for deplib in $new_libs; do |
| 7600 | case $deplib in |
| 7601 | -L*) |
| 7602 | case " $tmp_libs " in |
| 7603 | *" $deplib "*) ;; |
cristy | da16f16 | 2011-02-19 23:52:17 +0000 | [diff] [blame] | 7604 | *) tmp_libs+=" $deplib" ;; |
cristy | 3ed852e | 2009-09-05 21:47:34 +0000 | [diff] [blame] | 7605 | esac |
| 7606 | ;; |
cristy | da16f16 | 2011-02-19 23:52:17 +0000 | [diff] [blame] | 7607 | *) tmp_libs+=" $deplib" ;; |
cristy | 3ed852e | 2009-09-05 21:47:34 +0000 | [diff] [blame] | 7608 | esac |
| 7609 | done |
| 7610 | eval $var=\"$tmp_libs\" |
| 7611 | done # for var |
| 7612 | fi |
| 7613 | # Last step: remove runtime libs from dependency_libs |
| 7614 | # (they stay in deplibs) |
| 7615 | tmp_libs= |
| 7616 | for i in $dependency_libs ; do |
| 7617 | case " $predeps $postdeps $compiler_lib_search_path " in |
| 7618 | *" $i "*) |
| 7619 | i="" |
| 7620 | ;; |
| 7621 | esac |
| 7622 | if test -n "$i" ; then |
cristy | da16f16 | 2011-02-19 23:52:17 +0000 | [diff] [blame] | 7623 | tmp_libs+=" $i" |
cristy | 3ed852e | 2009-09-05 21:47:34 +0000 | [diff] [blame] | 7624 | fi |
| 7625 | done |
| 7626 | dependency_libs=$tmp_libs |
| 7627 | done # for pass |
| 7628 | if test "$linkmode" = prog; then |
| 7629 | dlfiles="$newdlfiles" |
| 7630 | fi |
| 7631 | if test "$linkmode" = prog || test "$linkmode" = lib; then |
| 7632 | dlprefiles="$newdlprefiles" |
| 7633 | fi |
| 7634 | |
| 7635 | case $linkmode in |
| 7636 | oldlib) |
| 7637 | if test -n "$dlfiles$dlprefiles" || test "$dlself" != no; then |
| 7638 | func_warning "\`-dlopen' is ignored for archives" |
| 7639 | fi |
| 7640 | |
| 7641 | case " $deplibs" in |
| 7642 | *\ -l* | *\ -L*) |
| 7643 | func_warning "\`-l' and \`-L' are ignored for archives" ;; |
| 7644 | esac |
| 7645 | |
| 7646 | test -n "$rpath" && \ |
| 7647 | func_warning "\`-rpath' is ignored for archives" |
| 7648 | |
| 7649 | test -n "$xrpath" && \ |
| 7650 | func_warning "\`-R' is ignored for archives" |
| 7651 | |
| 7652 | test -n "$vinfo" && \ |
| 7653 | func_warning "\`-version-info/-version-number' is ignored for archives" |
| 7654 | |
| 7655 | test -n "$release" && \ |
| 7656 | func_warning "\`-release' is ignored for archives" |
| 7657 | |
| 7658 | test -n "$export_symbols$export_symbols_regex" && \ |
| 7659 | func_warning "\`-export-symbols' is ignored for archives" |
| 7660 | |
| 7661 | # Now set the variables for building old libraries. |
| 7662 | build_libtool_libs=no |
| 7663 | oldlibs="$output" |
cristy | da16f16 | 2011-02-19 23:52:17 +0000 | [diff] [blame] | 7664 | objs+="$old_deplibs" |
cristy | 3ed852e | 2009-09-05 21:47:34 +0000 | [diff] [blame] | 7665 | ;; |
| 7666 | |
| 7667 | lib) |
| 7668 | # Make sure we only generate libraries of the form `libNAME.la'. |
| 7669 | case $outputname in |
| 7670 | lib*) |
| 7671 | func_stripname 'lib' '.la' "$outputname" |
| 7672 | name=$func_stripname_result |
| 7673 | eval shared_ext=\"$shrext_cmds\" |
| 7674 | eval libname=\"$libname_spec\" |
| 7675 | ;; |
| 7676 | *) |
| 7677 | test "$module" = no && \ |
| 7678 | func_fatal_help "libtool library \`$output' must begin with \`lib'" |
| 7679 | |
| 7680 | if test "$need_lib_prefix" != no; then |
| 7681 | # Add the "lib" prefix for modules if required |
| 7682 | func_stripname '' '.la' "$outputname" |
| 7683 | name=$func_stripname_result |
| 7684 | eval shared_ext=\"$shrext_cmds\" |
| 7685 | eval libname=\"$libname_spec\" |
| 7686 | else |
| 7687 | func_stripname '' '.la' "$outputname" |
| 7688 | libname=$func_stripname_result |
| 7689 | fi |
| 7690 | ;; |
| 7691 | esac |
| 7692 | |
| 7693 | if test -n "$objs"; then |
| 7694 | if test "$deplibs_check_method" != pass_all; then |
| 7695 | func_fatal_error "cannot build libtool library \`$output' from non-libtool objects on this host:$objs" |
| 7696 | else |
cristy | 98dddb5 | 2010-11-04 00:30:15 +0000 | [diff] [blame] | 7697 | echo |
cristy | 3ed852e | 2009-09-05 21:47:34 +0000 | [diff] [blame] | 7698 | $ECHO "*** Warning: Linking the shared library $output against the non-libtool" |
| 7699 | $ECHO "*** objects $objs is not portable!" |
cristy | da16f16 | 2011-02-19 23:52:17 +0000 | [diff] [blame] | 7700 | libobjs+=" $objs" |
cristy | 3ed852e | 2009-09-05 21:47:34 +0000 | [diff] [blame] | 7701 | fi |
| 7702 | fi |
| 7703 | |
| 7704 | test "$dlself" != no && \ |
| 7705 | func_warning "\`-dlopen self' is ignored for libtool libraries" |
| 7706 | |
| 7707 | set dummy $rpath |
| 7708 | shift |
| 7709 | test "$#" -gt 1 && \ |
| 7710 | func_warning "ignoring multiple \`-rpath's for a libtool library" |
| 7711 | |
| 7712 | install_libdir="$1" |
| 7713 | |
| 7714 | oldlibs= |
| 7715 | if test -z "$rpath"; then |
| 7716 | if test "$build_libtool_libs" = yes; then |
| 7717 | # Building a libtool convenience library. |
| 7718 | # Some compilers have problems with a `.al' extension so |
| 7719 | # convenience libraries should have the same extension an |
| 7720 | # archive normally would. |
| 7721 | oldlibs="$output_objdir/$libname.$libext $oldlibs" |
| 7722 | build_libtool_libs=convenience |
| 7723 | build_old_libs=yes |
| 7724 | fi |
| 7725 | |
| 7726 | test -n "$vinfo" && \ |
| 7727 | func_warning "\`-version-info/-version-number' is ignored for convenience libraries" |
| 7728 | |
| 7729 | test -n "$release" && \ |
| 7730 | func_warning "\`-release' is ignored for convenience libraries" |
| 7731 | else |
| 7732 | |
| 7733 | # Parse the version information argument. |
| 7734 | save_ifs="$IFS"; IFS=':' |
| 7735 | set dummy $vinfo 0 0 0 |
| 7736 | shift |
| 7737 | IFS="$save_ifs" |
| 7738 | |
| 7739 | test -n "$7" && \ |
| 7740 | func_fatal_help "too many parameters to \`-version-info'" |
| 7741 | |
| 7742 | # convert absolute version numbers to libtool ages |
| 7743 | # this retains compatibility with .la files and attempts |
| 7744 | # to make the code below a bit more comprehensible |
| 7745 | |
| 7746 | case $vinfo_number in |
| 7747 | yes) |
| 7748 | number_major="$1" |
| 7749 | number_minor="$2" |
| 7750 | number_revision="$3" |
| 7751 | # |
| 7752 | # There are really only two kinds -- those that |
| 7753 | # use the current revision as the major version |
| 7754 | # and those that subtract age and use age as |
| 7755 | # a minor version. But, then there is irix |
| 7756 | # which has an extra 1 added just for fun |
| 7757 | # |
| 7758 | case $version_type in |
| 7759 | darwin|linux|osf|windows|none) |
| 7760 | func_arith $number_major + $number_minor |
| 7761 | current=$func_arith_result |
| 7762 | age="$number_minor" |
| 7763 | revision="$number_revision" |
| 7764 | ;; |
cristy | 98dddb5 | 2010-11-04 00:30:15 +0000 | [diff] [blame] | 7765 | freebsd-aout|freebsd-elf|qnx|sunos) |
cristy | 3ed852e | 2009-09-05 21:47:34 +0000 | [diff] [blame] | 7766 | current="$number_major" |
| 7767 | revision="$number_minor" |
| 7768 | age="0" |
| 7769 | ;; |
| 7770 | irix|nonstopux) |
| 7771 | func_arith $number_major + $number_minor |
| 7772 | current=$func_arith_result |
| 7773 | age="$number_minor" |
| 7774 | revision="$number_minor" |
| 7775 | lt_irix_increment=no |
| 7776 | ;; |
| 7777 | esac |
| 7778 | ;; |
| 7779 | no) |
| 7780 | current="$1" |
| 7781 | revision="$2" |
| 7782 | age="$3" |
| 7783 | ;; |
| 7784 | esac |
| 7785 | |
| 7786 | # Check that each of the things are valid numbers. |
| 7787 | case $current in |
| 7788 | 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]) ;; |
| 7789 | *) |
| 7790 | func_error "CURRENT \`$current' must be a nonnegative integer" |
| 7791 | func_fatal_error "\`$vinfo' is not valid version information" |
| 7792 | ;; |
| 7793 | esac |
| 7794 | |
| 7795 | case $revision in |
| 7796 | 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]) ;; |
| 7797 | *) |
| 7798 | func_error "REVISION \`$revision' must be a nonnegative integer" |
| 7799 | func_fatal_error "\`$vinfo' is not valid version information" |
| 7800 | ;; |
| 7801 | esac |
| 7802 | |
| 7803 | case $age in |
| 7804 | 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]) ;; |
| 7805 | *) |
| 7806 | func_error "AGE \`$age' must be a nonnegative integer" |
| 7807 | func_fatal_error "\`$vinfo' is not valid version information" |
| 7808 | ;; |
| 7809 | esac |
| 7810 | |
| 7811 | if test "$age" -gt "$current"; then |
| 7812 | func_error "AGE \`$age' is greater than the current interface number \`$current'" |
| 7813 | func_fatal_error "\`$vinfo' is not valid version information" |
| 7814 | fi |
| 7815 | |
| 7816 | # Calculate the version variables. |
| 7817 | major= |
| 7818 | versuffix= |
| 7819 | verstring= |
| 7820 | case $version_type in |
| 7821 | none) ;; |
| 7822 | |
| 7823 | darwin) |
| 7824 | # Like Linux, but with the current version available in |
| 7825 | # verstring for coding it into the library header |
| 7826 | func_arith $current - $age |
| 7827 | major=.$func_arith_result |
| 7828 | versuffix="$major.$age.$revision" |
| 7829 | # Darwin ld doesn't like 0 for these options... |
| 7830 | func_arith $current + 1 |
| 7831 | minor_current=$func_arith_result |
| 7832 | xlcverstring="${wl}-compatibility_version ${wl}$minor_current ${wl}-current_version ${wl}$minor_current.$revision" |
| 7833 | verstring="-compatibility_version $minor_current -current_version $minor_current.$revision" |
| 7834 | ;; |
| 7835 | |
| 7836 | freebsd-aout) |
| 7837 | major=".$current" |
| 7838 | versuffix=".$current.$revision"; |
| 7839 | ;; |
| 7840 | |
| 7841 | freebsd-elf) |
| 7842 | major=".$current" |
| 7843 | versuffix=".$current" |
| 7844 | ;; |
| 7845 | |
| 7846 | irix | nonstopux) |
| 7847 | if test "X$lt_irix_increment" = "Xno"; then |
| 7848 | func_arith $current - $age |
| 7849 | else |
| 7850 | func_arith $current - $age + 1 |
| 7851 | fi |
| 7852 | major=$func_arith_result |
| 7853 | |
| 7854 | case $version_type in |
| 7855 | nonstopux) verstring_prefix=nonstopux ;; |
| 7856 | *) verstring_prefix=sgi ;; |
| 7857 | esac |
| 7858 | verstring="$verstring_prefix$major.$revision" |
| 7859 | |
| 7860 | # Add in all the interfaces that we are compatible with. |
| 7861 | loop=$revision |
| 7862 | while test "$loop" -ne 0; do |
| 7863 | func_arith $revision - $loop |
| 7864 | iface=$func_arith_result |
| 7865 | func_arith $loop - 1 |
| 7866 | loop=$func_arith_result |
| 7867 | verstring="$verstring_prefix$major.$iface:$verstring" |
| 7868 | done |
| 7869 | |
| 7870 | # Before this point, $major must not contain `.'. |
| 7871 | major=.$major |
| 7872 | versuffix="$major.$revision" |
| 7873 | ;; |
| 7874 | |
| 7875 | linux) |
| 7876 | func_arith $current - $age |
| 7877 | major=.$func_arith_result |
| 7878 | versuffix="$major.$age.$revision" |
| 7879 | ;; |
| 7880 | |
| 7881 | osf) |
| 7882 | func_arith $current - $age |
| 7883 | major=.$func_arith_result |
| 7884 | versuffix=".$current.$age.$revision" |
| 7885 | verstring="$current.$age.$revision" |
| 7886 | |
| 7887 | # Add in all the interfaces that we are compatible with. |
| 7888 | loop=$age |
| 7889 | while test "$loop" -ne 0; do |
| 7890 | func_arith $current - $loop |
| 7891 | iface=$func_arith_result |
| 7892 | func_arith $loop - 1 |
| 7893 | loop=$func_arith_result |
| 7894 | verstring="$verstring:${iface}.0" |
| 7895 | done |
| 7896 | |
| 7897 | # Make executables depend on our current version. |
cristy | da16f16 | 2011-02-19 23:52:17 +0000 | [diff] [blame] | 7898 | verstring+=":${current}.0" |
cristy | 3ed852e | 2009-09-05 21:47:34 +0000 | [diff] [blame] | 7899 | ;; |
| 7900 | |
| 7901 | qnx) |
| 7902 | major=".$current" |
| 7903 | versuffix=".$current" |
| 7904 | ;; |
| 7905 | |
| 7906 | sunos) |
| 7907 | major=".$current" |
| 7908 | versuffix=".$current.$revision" |
| 7909 | ;; |
| 7910 | |
| 7911 | windows) |
| 7912 | # Use '-' rather than '.', since we only want one |
| 7913 | # extension on DOS 8.3 filesystems. |
| 7914 | func_arith $current - $age |
| 7915 | major=$func_arith_result |
| 7916 | versuffix="-$major" |
| 7917 | ;; |
| 7918 | |
| 7919 | *) |
| 7920 | func_fatal_configuration "unknown library version type \`$version_type'" |
| 7921 | ;; |
| 7922 | esac |
| 7923 | |
| 7924 | # Clear the version info if we defaulted, and they specified a release. |
| 7925 | if test -z "$vinfo" && test -n "$release"; then |
| 7926 | major= |
| 7927 | case $version_type in |
| 7928 | darwin) |
| 7929 | # we can't check for "0.0" in archive_cmds due to quoting |
| 7930 | # problems, so we reset it completely |
| 7931 | verstring= |
| 7932 | ;; |
| 7933 | *) |
| 7934 | verstring="0.0" |
| 7935 | ;; |
| 7936 | esac |
| 7937 | if test "$need_version" = no; then |
| 7938 | versuffix= |
| 7939 | else |
| 7940 | versuffix=".0.0" |
| 7941 | fi |
| 7942 | fi |
| 7943 | |
| 7944 | # Remove version info from name if versioning should be avoided |
| 7945 | if test "$avoid_version" = yes && test "$need_version" = no; then |
| 7946 | major= |
| 7947 | versuffix= |
| 7948 | verstring="" |
| 7949 | fi |
| 7950 | |
| 7951 | # Check to see if the archive will have undefined symbols. |
| 7952 | if test "$allow_undefined" = yes; then |
| 7953 | if test "$allow_undefined_flag" = unsupported; then |
| 7954 | func_warning "undefined symbols not allowed in $host shared libraries" |
| 7955 | build_libtool_libs=no |
| 7956 | build_old_libs=yes |
| 7957 | fi |
| 7958 | else |
| 7959 | # Don't allow undefined symbols. |
| 7960 | allow_undefined_flag="$no_undefined_flag" |
| 7961 | fi |
| 7962 | |
| 7963 | fi |
| 7964 | |
| 7965 | func_generate_dlsyms "$libname" "$libname" "yes" |
cristy | da16f16 | 2011-02-19 23:52:17 +0000 | [diff] [blame] | 7966 | libobjs+=" $symfileobj" |
cristy | 3ed852e | 2009-09-05 21:47:34 +0000 | [diff] [blame] | 7967 | test "X$libobjs" = "X " && libobjs= |
| 7968 | |
cristy | da16f16 | 2011-02-19 23:52:17 +0000 | [diff] [blame] | 7969 | if test "$opt_mode" != relink; then |
cristy | 3ed852e | 2009-09-05 21:47:34 +0000 | [diff] [blame] | 7970 | # Remove our outputs, but don't remove object files since they |
| 7971 | # may have been created when compiling PIC objects. |
| 7972 | removelist= |
| 7973 | tempremovelist=`$ECHO "$output_objdir/*"` |
| 7974 | for p in $tempremovelist; do |
| 7975 | case $p in |
| 7976 | *.$objext | *.gcno) |
| 7977 | ;; |
| 7978 | $output_objdir/$outputname | $output_objdir/$libname.* | $output_objdir/${libname}${release}.*) |
| 7979 | if test "X$precious_files_regex" != "X"; then |
| 7980 | if $ECHO "$p" | $EGREP -e "$precious_files_regex" >/dev/null 2>&1 |
| 7981 | then |
| 7982 | continue |
| 7983 | fi |
| 7984 | fi |
cristy | da16f16 | 2011-02-19 23:52:17 +0000 | [diff] [blame] | 7985 | removelist+=" $p" |
cristy | 3ed852e | 2009-09-05 21:47:34 +0000 | [diff] [blame] | 7986 | ;; |
| 7987 | *) ;; |
| 7988 | esac |
| 7989 | done |
| 7990 | test -n "$removelist" && \ |
| 7991 | func_show_eval "${RM}r \$removelist" |
| 7992 | fi |
| 7993 | |
| 7994 | # Now set the variables for building old libraries. |
| 7995 | if test "$build_old_libs" = yes && test "$build_libtool_libs" != convenience ; then |
cristy | da16f16 | 2011-02-19 23:52:17 +0000 | [diff] [blame] | 7996 | oldlibs+=" $output_objdir/$libname.$libext" |
cristy | 3ed852e | 2009-09-05 21:47:34 +0000 | [diff] [blame] | 7997 | |
| 7998 | # Transform .lo files to .o files. |
cristy | 98dddb5 | 2010-11-04 00:30:15 +0000 | [diff] [blame] | 7999 | oldobjs="$objs "`$ECHO "$libobjs" | $SP2NL | $SED "/\.${libext}$/d; $lo2o" | $NL2SP` |
cristy | 3ed852e | 2009-09-05 21:47:34 +0000 | [diff] [blame] | 8000 | fi |
| 8001 | |
| 8002 | # Eliminate all temporary directories. |
| 8003 | #for path in $notinst_path; do |
cristy | 98dddb5 | 2010-11-04 00:30:15 +0000 | [diff] [blame] | 8004 | # lib_search_path=`$ECHO "$lib_search_path " | $SED "s% $path % %g"` |
| 8005 | # deplibs=`$ECHO "$deplibs " | $SED "s% -L$path % %g"` |
| 8006 | # dependency_libs=`$ECHO "$dependency_libs " | $SED "s% -L$path % %g"` |
cristy | 3ed852e | 2009-09-05 21:47:34 +0000 | [diff] [blame] | 8007 | #done |
| 8008 | |
| 8009 | if test -n "$xrpath"; then |
| 8010 | # If the user specified any rpath flags, then add them. |
| 8011 | temp_xrpath= |
| 8012 | for libdir in $xrpath; do |
cristy | da16f16 | 2011-02-19 23:52:17 +0000 | [diff] [blame] | 8013 | func_replace_sysroot "$libdir" |
| 8014 | temp_xrpath+=" -R$func_replace_sysroot_result" |
cristy | 3ed852e | 2009-09-05 21:47:34 +0000 | [diff] [blame] | 8015 | case "$finalize_rpath " in |
| 8016 | *" $libdir "*) ;; |
cristy | da16f16 | 2011-02-19 23:52:17 +0000 | [diff] [blame] | 8017 | *) finalize_rpath+=" $libdir" ;; |
cristy | 3ed852e | 2009-09-05 21:47:34 +0000 | [diff] [blame] | 8018 | esac |
| 8019 | done |
| 8020 | if test "$hardcode_into_libs" != yes || test "$build_old_libs" = yes; then |
| 8021 | dependency_libs="$temp_xrpath $dependency_libs" |
| 8022 | fi |
| 8023 | fi |
| 8024 | |
| 8025 | # Make sure dlfiles contains only unique files that won't be dlpreopened |
| 8026 | old_dlfiles="$dlfiles" |
| 8027 | dlfiles= |
| 8028 | for lib in $old_dlfiles; do |
| 8029 | case " $dlprefiles $dlfiles " in |
| 8030 | *" $lib "*) ;; |
cristy | da16f16 | 2011-02-19 23:52:17 +0000 | [diff] [blame] | 8031 | *) dlfiles+=" $lib" ;; |
cristy | 3ed852e | 2009-09-05 21:47:34 +0000 | [diff] [blame] | 8032 | esac |
| 8033 | done |
| 8034 | |
| 8035 | # Make sure dlprefiles contains only unique files |
| 8036 | old_dlprefiles="$dlprefiles" |
| 8037 | dlprefiles= |
| 8038 | for lib in $old_dlprefiles; do |
| 8039 | case "$dlprefiles " in |
| 8040 | *" $lib "*) ;; |
cristy | da16f16 | 2011-02-19 23:52:17 +0000 | [diff] [blame] | 8041 | *) dlprefiles+=" $lib" ;; |
cristy | 3ed852e | 2009-09-05 21:47:34 +0000 | [diff] [blame] | 8042 | esac |
| 8043 | done |
| 8044 | |
| 8045 | if test "$build_libtool_libs" = yes; then |
| 8046 | if test -n "$rpath"; then |
| 8047 | case $host in |
cristy | 98dddb5 | 2010-11-04 00:30:15 +0000 | [diff] [blame] | 8048 | *-*-cygwin* | *-*-mingw* | *-*-pw32* | *-*-os2* | *-*-beos* | *-cegcc* | *-*-haiku*) |
cristy | 3ed852e | 2009-09-05 21:47:34 +0000 | [diff] [blame] | 8049 | # these systems don't actually have a c library (as such)! |
| 8050 | ;; |
| 8051 | *-*-rhapsody* | *-*-darwin1.[012]) |
| 8052 | # Rhapsody C library is in the System framework |
cristy | da16f16 | 2011-02-19 23:52:17 +0000 | [diff] [blame] | 8053 | deplibs+=" System.ltframework" |
cristy | 3ed852e | 2009-09-05 21:47:34 +0000 | [diff] [blame] | 8054 | ;; |
| 8055 | *-*-netbsd*) |
| 8056 | # Don't link with libc until the a.out ld.so is fixed. |
| 8057 | ;; |
| 8058 | *-*-openbsd* | *-*-freebsd* | *-*-dragonfly*) |
| 8059 | # Do not include libc due to us having libc/libc_r. |
| 8060 | ;; |
| 8061 | *-*-sco3.2v5* | *-*-sco5v6*) |
| 8062 | # Causes problems with __ctype |
| 8063 | ;; |
| 8064 | *-*-sysv4.2uw2* | *-*-sysv5* | *-*-unixware* | *-*-OpenUNIX*) |
| 8065 | # Compiler inserts libc in the correct place for threads to work |
| 8066 | ;; |
| 8067 | *) |
| 8068 | # Add libc to deplibs on all other systems if necessary. |
| 8069 | if test "$build_libtool_need_lc" = "yes"; then |
cristy | da16f16 | 2011-02-19 23:52:17 +0000 | [diff] [blame] | 8070 | deplibs+=" -lc" |
cristy | 3ed852e | 2009-09-05 21:47:34 +0000 | [diff] [blame] | 8071 | fi |
| 8072 | ;; |
| 8073 | esac |
| 8074 | fi |
| 8075 | |
| 8076 | # Transform deplibs into only deplibs that can be linked in shared. |
| 8077 | name_save=$name |
| 8078 | libname_save=$libname |
| 8079 | release_save=$release |
| 8080 | versuffix_save=$versuffix |
| 8081 | major_save=$major |
| 8082 | # I'm not sure if I'm treating the release correctly. I think |
| 8083 | # release should show up in the -l (ie -lgmp5) so we don't want to |
| 8084 | # add it in twice. Is that correct? |
| 8085 | release="" |
| 8086 | versuffix="" |
| 8087 | major="" |
| 8088 | newdeplibs= |
| 8089 | droppeddeps=no |
| 8090 | case $deplibs_check_method in |
| 8091 | pass_all) |
| 8092 | # Don't check for shared/static. Everything works. |
| 8093 | # This might be a little naive. We might want to check |
| 8094 | # whether the library exists or not. But this is on |
| 8095 | # osf3 & osf4 and I'm not really sure... Just |
| 8096 | # implementing what was already the behavior. |
| 8097 | newdeplibs=$deplibs |
| 8098 | ;; |
| 8099 | test_compile) |
| 8100 | # This code stresses the "libraries are programs" paradigm to its |
| 8101 | # limits. Maybe even breaks it. We compile a program, linking it |
| 8102 | # against the deplibs as a proxy for the library. Then we can check |
| 8103 | # whether they linked in statically or dynamically with ldd. |
| 8104 | $opt_dry_run || $RM conftest.c |
| 8105 | cat > conftest.c <<EOF |
| 8106 | int main() { return 0; } |
| 8107 | EOF |
| 8108 | $opt_dry_run || $RM conftest |
| 8109 | if $LTCC $LTCFLAGS -o conftest conftest.c $deplibs; then |
| 8110 | ldd_output=`ldd conftest` |
| 8111 | for i in $deplibs; do |
| 8112 | case $i in |
| 8113 | -l*) |
| 8114 | func_stripname -l '' "$i" |
| 8115 | name=$func_stripname_result |
| 8116 | if test "X$allow_libtool_libs_with_static_runtimes" = "Xyes" ; then |
| 8117 | case " $predeps $postdeps " in |
| 8118 | *" $i "*) |
cristy | da16f16 | 2011-02-19 23:52:17 +0000 | [diff] [blame] | 8119 | newdeplibs+=" $i" |
cristy | 3ed852e | 2009-09-05 21:47:34 +0000 | [diff] [blame] | 8120 | i="" |
| 8121 | ;; |
| 8122 | esac |
| 8123 | fi |
| 8124 | if test -n "$i" ; then |
| 8125 | libname=`eval "\\$ECHO \"$libname_spec\""` |
| 8126 | deplib_matches=`eval "\\$ECHO \"$library_names_spec\""` |
| 8127 | set dummy $deplib_matches; shift |
| 8128 | deplib_match=$1 |
| 8129 | if test `expr "$ldd_output" : ".*$deplib_match"` -ne 0 ; then |
cristy | da16f16 | 2011-02-19 23:52:17 +0000 | [diff] [blame] | 8130 | newdeplibs+=" $i" |
cristy | 3ed852e | 2009-09-05 21:47:34 +0000 | [diff] [blame] | 8131 | else |
| 8132 | droppeddeps=yes |
cristy | 98dddb5 | 2010-11-04 00:30:15 +0000 | [diff] [blame] | 8133 | echo |
cristy | 3ed852e | 2009-09-05 21:47:34 +0000 | [diff] [blame] | 8134 | $ECHO "*** Warning: dynamic linker does not accept needed library $i." |
cristy | 98dddb5 | 2010-11-04 00:30:15 +0000 | [diff] [blame] | 8135 | echo "*** I have the capability to make that library automatically link in when" |
| 8136 | echo "*** you link to this library. But I can only do this if you have a" |
| 8137 | echo "*** shared version of the library, which I believe you do not have" |
| 8138 | echo "*** because a test_compile did reveal that the linker did not use it for" |
| 8139 | echo "*** its dynamic dependency list that programs get resolved with at runtime." |
cristy | 3ed852e | 2009-09-05 21:47:34 +0000 | [diff] [blame] | 8140 | fi |
| 8141 | fi |
| 8142 | ;; |
| 8143 | *) |
cristy | da16f16 | 2011-02-19 23:52:17 +0000 | [diff] [blame] | 8144 | newdeplibs+=" $i" |
cristy | 3ed852e | 2009-09-05 21:47:34 +0000 | [diff] [blame] | 8145 | ;; |
| 8146 | esac |
| 8147 | done |
| 8148 | else |
| 8149 | # Error occurred in the first compile. Let's try to salvage |
| 8150 | # the situation: Compile a separate program for each library. |
| 8151 | for i in $deplibs; do |
| 8152 | case $i in |
| 8153 | -l*) |
| 8154 | func_stripname -l '' "$i" |
| 8155 | name=$func_stripname_result |
| 8156 | $opt_dry_run || $RM conftest |
| 8157 | if $LTCC $LTCFLAGS -o conftest conftest.c $i; then |
| 8158 | ldd_output=`ldd conftest` |
| 8159 | if test "X$allow_libtool_libs_with_static_runtimes" = "Xyes" ; then |
| 8160 | case " $predeps $postdeps " in |
| 8161 | *" $i "*) |
cristy | da16f16 | 2011-02-19 23:52:17 +0000 | [diff] [blame] | 8162 | newdeplibs+=" $i" |
cristy | 3ed852e | 2009-09-05 21:47:34 +0000 | [diff] [blame] | 8163 | i="" |
| 8164 | ;; |
| 8165 | esac |
| 8166 | fi |
| 8167 | if test -n "$i" ; then |
| 8168 | libname=`eval "\\$ECHO \"$libname_spec\""` |
| 8169 | deplib_matches=`eval "\\$ECHO \"$library_names_spec\""` |
| 8170 | set dummy $deplib_matches; shift |
| 8171 | deplib_match=$1 |
| 8172 | if test `expr "$ldd_output" : ".*$deplib_match"` -ne 0 ; then |
cristy | da16f16 | 2011-02-19 23:52:17 +0000 | [diff] [blame] | 8173 | newdeplibs+=" $i" |
cristy | 3ed852e | 2009-09-05 21:47:34 +0000 | [diff] [blame] | 8174 | else |
| 8175 | droppeddeps=yes |
cristy | 98dddb5 | 2010-11-04 00:30:15 +0000 | [diff] [blame] | 8176 | echo |
cristy | 3ed852e | 2009-09-05 21:47:34 +0000 | [diff] [blame] | 8177 | $ECHO "*** Warning: dynamic linker does not accept needed library $i." |
cristy | 98dddb5 | 2010-11-04 00:30:15 +0000 | [diff] [blame] | 8178 | echo "*** I have the capability to make that library automatically link in when" |
| 8179 | echo "*** you link to this library. But I can only do this if you have a" |
| 8180 | echo "*** shared version of the library, which you do not appear to have" |
| 8181 | echo "*** because a test_compile did reveal that the linker did not use this one" |
| 8182 | echo "*** as a dynamic dependency that programs can get resolved with at runtime." |
cristy | 3ed852e | 2009-09-05 21:47:34 +0000 | [diff] [blame] | 8183 | fi |
| 8184 | fi |
| 8185 | else |
| 8186 | droppeddeps=yes |
cristy | 98dddb5 | 2010-11-04 00:30:15 +0000 | [diff] [blame] | 8187 | echo |
cristy | 3ed852e | 2009-09-05 21:47:34 +0000 | [diff] [blame] | 8188 | $ECHO "*** Warning! Library $i is needed by this library but I was not able to" |
cristy | 98dddb5 | 2010-11-04 00:30:15 +0000 | [diff] [blame] | 8189 | echo "*** make it link in! You will probably need to install it or some" |
| 8190 | echo "*** library that it depends on before this library will be fully" |
| 8191 | echo "*** functional. Installing it before continuing would be even better." |
cristy | 3ed852e | 2009-09-05 21:47:34 +0000 | [diff] [blame] | 8192 | fi |
| 8193 | ;; |
| 8194 | *) |
cristy | da16f16 | 2011-02-19 23:52:17 +0000 | [diff] [blame] | 8195 | newdeplibs+=" $i" |
cristy | 3ed852e | 2009-09-05 21:47:34 +0000 | [diff] [blame] | 8196 | ;; |
| 8197 | esac |
| 8198 | done |
| 8199 | fi |
| 8200 | ;; |
| 8201 | file_magic*) |
| 8202 | set dummy $deplibs_check_method; shift |
| 8203 | file_magic_regex=`expr "$deplibs_check_method" : "$1 \(.*\)"` |
| 8204 | for a_deplib in $deplibs; do |
| 8205 | case $a_deplib in |
| 8206 | -l*) |
| 8207 | func_stripname -l '' "$a_deplib" |
| 8208 | name=$func_stripname_result |
| 8209 | if test "X$allow_libtool_libs_with_static_runtimes" = "Xyes" ; then |
| 8210 | case " $predeps $postdeps " in |
| 8211 | *" $a_deplib "*) |
cristy | da16f16 | 2011-02-19 23:52:17 +0000 | [diff] [blame] | 8212 | newdeplibs+=" $a_deplib" |
cristy | 3ed852e | 2009-09-05 21:47:34 +0000 | [diff] [blame] | 8213 | a_deplib="" |
| 8214 | ;; |
| 8215 | esac |
| 8216 | fi |
| 8217 | if test -n "$a_deplib" ; then |
| 8218 | libname=`eval "\\$ECHO \"$libname_spec\""` |
cristy | da16f16 | 2011-02-19 23:52:17 +0000 | [diff] [blame] | 8219 | if test -n "$file_magic_glob"; then |
| 8220 | libnameglob=`func_echo_all "$libname" | $SED -e $file_magic_glob` |
| 8221 | else |
| 8222 | libnameglob=$libname |
| 8223 | fi |
| 8224 | test "$want_nocaseglob" = yes && nocaseglob=`shopt -p nocaseglob` |
cristy | 3ed852e | 2009-09-05 21:47:34 +0000 | [diff] [blame] | 8225 | for i in $lib_search_path $sys_lib_search_path $shlib_search_path; do |
cristy | da16f16 | 2011-02-19 23:52:17 +0000 | [diff] [blame] | 8226 | if test "$want_nocaseglob" = yes; then |
| 8227 | shopt -s nocaseglob |
| 8228 | potential_libs=`ls $i/$libnameglob[.-]* 2>/dev/null` |
| 8229 | $nocaseglob |
| 8230 | else |
| 8231 | potential_libs=`ls $i/$libnameglob[.-]* 2>/dev/null` |
| 8232 | fi |
cristy | 3ed852e | 2009-09-05 21:47:34 +0000 | [diff] [blame] | 8233 | for potent_lib in $potential_libs; do |
| 8234 | # Follow soft links. |
| 8235 | if ls -lLd "$potent_lib" 2>/dev/null | |
| 8236 | $GREP " -> " >/dev/null; then |
| 8237 | continue |
| 8238 | fi |
| 8239 | # The statement above tries to avoid entering an |
| 8240 | # endless loop below, in case of cyclic links. |
| 8241 | # We might still enter an endless loop, since a link |
| 8242 | # loop can be closed while we follow links, |
| 8243 | # but so what? |
| 8244 | potlib="$potent_lib" |
| 8245 | while test -h "$potlib" 2>/dev/null; do |
| 8246 | potliblink=`ls -ld $potlib | ${SED} 's/.* -> //'` |
| 8247 | case $potliblink in |
| 8248 | [\\/]* | [A-Za-z]:[\\/]*) potlib="$potliblink";; |
cristy | 98dddb5 | 2010-11-04 00:30:15 +0000 | [diff] [blame] | 8249 | *) potlib=`$ECHO "$potlib" | $SED 's,[^/]*$,,'`"$potliblink";; |
cristy | 3ed852e | 2009-09-05 21:47:34 +0000 | [diff] [blame] | 8250 | esac |
| 8251 | done |
| 8252 | if eval $file_magic_cmd \"\$potlib\" 2>/dev/null | |
| 8253 | $SED -e 10q | |
| 8254 | $EGREP "$file_magic_regex" > /dev/null; then |
cristy | da16f16 | 2011-02-19 23:52:17 +0000 | [diff] [blame] | 8255 | newdeplibs+=" $a_deplib" |
cristy | 3ed852e | 2009-09-05 21:47:34 +0000 | [diff] [blame] | 8256 | a_deplib="" |
| 8257 | break 2 |
| 8258 | fi |
| 8259 | done |
| 8260 | done |
| 8261 | fi |
| 8262 | if test -n "$a_deplib" ; then |
| 8263 | droppeddeps=yes |
cristy | 98dddb5 | 2010-11-04 00:30:15 +0000 | [diff] [blame] | 8264 | echo |
cristy | 3ed852e | 2009-09-05 21:47:34 +0000 | [diff] [blame] | 8265 | $ECHO "*** Warning: linker path does not have real file for library $a_deplib." |
cristy | 98dddb5 | 2010-11-04 00:30:15 +0000 | [diff] [blame] | 8266 | echo "*** I have the capability to make that library automatically link in when" |
| 8267 | echo "*** you link to this library. But I can only do this if you have a" |
| 8268 | echo "*** shared version of the library, which you do not appear to have" |
| 8269 | echo "*** because I did check the linker path looking for a file starting" |
cristy | 3ed852e | 2009-09-05 21:47:34 +0000 | [diff] [blame] | 8270 | if test -z "$potlib" ; then |
| 8271 | $ECHO "*** with $libname but no candidates were found. (...for file magic test)" |
| 8272 | else |
| 8273 | $ECHO "*** with $libname and none of the candidates passed a file format test" |
| 8274 | $ECHO "*** using a file magic. Last file checked: $potlib" |
| 8275 | fi |
| 8276 | fi |
| 8277 | ;; |
| 8278 | *) |
| 8279 | # Add a -L argument. |
cristy | da16f16 | 2011-02-19 23:52:17 +0000 | [diff] [blame] | 8280 | newdeplibs+=" $a_deplib" |
cristy | 3ed852e | 2009-09-05 21:47:34 +0000 | [diff] [blame] | 8281 | ;; |
| 8282 | esac |
| 8283 | done # Gone through all deplibs. |
| 8284 | ;; |
| 8285 | match_pattern*) |
| 8286 | set dummy $deplibs_check_method; shift |
| 8287 | match_pattern_regex=`expr "$deplibs_check_method" : "$1 \(.*\)"` |
| 8288 | for a_deplib in $deplibs; do |
| 8289 | case $a_deplib in |
| 8290 | -l*) |
| 8291 | func_stripname -l '' "$a_deplib" |
| 8292 | name=$func_stripname_result |
| 8293 | if test "X$allow_libtool_libs_with_static_runtimes" = "Xyes" ; then |
| 8294 | case " $predeps $postdeps " in |
| 8295 | *" $a_deplib "*) |
cristy | da16f16 | 2011-02-19 23:52:17 +0000 | [diff] [blame] | 8296 | newdeplibs+=" $a_deplib" |
cristy | 3ed852e | 2009-09-05 21:47:34 +0000 | [diff] [blame] | 8297 | a_deplib="" |
| 8298 | ;; |
| 8299 | esac |
| 8300 | fi |
| 8301 | if test -n "$a_deplib" ; then |
| 8302 | libname=`eval "\\$ECHO \"$libname_spec\""` |
| 8303 | for i in $lib_search_path $sys_lib_search_path $shlib_search_path; do |
| 8304 | potential_libs=`ls $i/$libname[.-]* 2>/dev/null` |
| 8305 | for potent_lib in $potential_libs; do |
| 8306 | potlib="$potent_lib" # see symlink-check above in file_magic test |
cristy | 98dddb5 | 2010-11-04 00:30:15 +0000 | [diff] [blame] | 8307 | if eval "\$ECHO \"$potent_lib\"" 2>/dev/null | $SED 10q | \ |
cristy | 3ed852e | 2009-09-05 21:47:34 +0000 | [diff] [blame] | 8308 | $EGREP "$match_pattern_regex" > /dev/null; then |
cristy | da16f16 | 2011-02-19 23:52:17 +0000 | [diff] [blame] | 8309 | newdeplibs+=" $a_deplib" |
cristy | 3ed852e | 2009-09-05 21:47:34 +0000 | [diff] [blame] | 8310 | a_deplib="" |
| 8311 | break 2 |
| 8312 | fi |
| 8313 | done |
| 8314 | done |
| 8315 | fi |
| 8316 | if test -n "$a_deplib" ; then |
| 8317 | droppeddeps=yes |
cristy | 98dddb5 | 2010-11-04 00:30:15 +0000 | [diff] [blame] | 8318 | echo |
cristy | 3ed852e | 2009-09-05 21:47:34 +0000 | [diff] [blame] | 8319 | $ECHO "*** Warning: linker path does not have real file for library $a_deplib." |
cristy | 98dddb5 | 2010-11-04 00:30:15 +0000 | [diff] [blame] | 8320 | echo "*** I have the capability to make that library automatically link in when" |
| 8321 | echo "*** you link to this library. But I can only do this if you have a" |
| 8322 | echo "*** shared version of the library, which you do not appear to have" |
| 8323 | echo "*** because I did check the linker path looking for a file starting" |
cristy | 3ed852e | 2009-09-05 21:47:34 +0000 | [diff] [blame] | 8324 | if test -z "$potlib" ; then |
| 8325 | $ECHO "*** with $libname but no candidates were found. (...for regex pattern test)" |
| 8326 | else |
| 8327 | $ECHO "*** with $libname and none of the candidates passed a file format test" |
| 8328 | $ECHO "*** using a regex pattern. Last file checked: $potlib" |
| 8329 | fi |
| 8330 | fi |
| 8331 | ;; |
| 8332 | *) |
| 8333 | # Add a -L argument. |
cristy | da16f16 | 2011-02-19 23:52:17 +0000 | [diff] [blame] | 8334 | newdeplibs+=" $a_deplib" |
cristy | 3ed852e | 2009-09-05 21:47:34 +0000 | [diff] [blame] | 8335 | ;; |
| 8336 | esac |
| 8337 | done # Gone through all deplibs. |
| 8338 | ;; |
| 8339 | none | unknown | *) |
| 8340 | newdeplibs="" |
cristy | 98dddb5 | 2010-11-04 00:30:15 +0000 | [diff] [blame] | 8341 | tmp_deplibs=`$ECHO " $deplibs" | $SED 's/ -lc$//; s/ -[LR][^ ]*//g'` |
cristy | 3ed852e | 2009-09-05 21:47:34 +0000 | [diff] [blame] | 8342 | if test "X$allow_libtool_libs_with_static_runtimes" = "Xyes" ; then |
| 8343 | for i in $predeps $postdeps ; do |
| 8344 | # can't use Xsed below, because $i might contain '/' |
cristy | 98dddb5 | 2010-11-04 00:30:15 +0000 | [diff] [blame] | 8345 | tmp_deplibs=`$ECHO " $tmp_deplibs" | $SED "s,$i,,"` |
cristy | 3ed852e | 2009-09-05 21:47:34 +0000 | [diff] [blame] | 8346 | done |
| 8347 | fi |
cristy | 98dddb5 | 2010-11-04 00:30:15 +0000 | [diff] [blame] | 8348 | case $tmp_deplibs in |
| 8349 | *[!\ \ ]*) |
| 8350 | echo |
cristy | 3ed852e | 2009-09-05 21:47:34 +0000 | [diff] [blame] | 8351 | if test "X$deplibs_check_method" = "Xnone"; then |
cristy | 98dddb5 | 2010-11-04 00:30:15 +0000 | [diff] [blame] | 8352 | echo "*** Warning: inter-library dependencies are not supported in this platform." |
cristy | 3ed852e | 2009-09-05 21:47:34 +0000 | [diff] [blame] | 8353 | else |
cristy | 98dddb5 | 2010-11-04 00:30:15 +0000 | [diff] [blame] | 8354 | echo "*** Warning: inter-library dependencies are not known to be supported." |
cristy | 3ed852e | 2009-09-05 21:47:34 +0000 | [diff] [blame] | 8355 | fi |
cristy | 98dddb5 | 2010-11-04 00:30:15 +0000 | [diff] [blame] | 8356 | echo "*** All declared inter-library dependencies are being dropped." |
cristy | 3ed852e | 2009-09-05 21:47:34 +0000 | [diff] [blame] | 8357 | droppeddeps=yes |
cristy | 98dddb5 | 2010-11-04 00:30:15 +0000 | [diff] [blame] | 8358 | ;; |
| 8359 | esac |
cristy | 3ed852e | 2009-09-05 21:47:34 +0000 | [diff] [blame] | 8360 | ;; |
| 8361 | esac |
| 8362 | versuffix=$versuffix_save |
| 8363 | major=$major_save |
| 8364 | release=$release_save |
| 8365 | libname=$libname_save |
| 8366 | name=$name_save |
| 8367 | |
| 8368 | case $host in |
| 8369 | *-*-rhapsody* | *-*-darwin1.[012]) |
| 8370 | # On Rhapsody replace the C library with the System framework |
cristy | 98dddb5 | 2010-11-04 00:30:15 +0000 | [diff] [blame] | 8371 | newdeplibs=`$ECHO " $newdeplibs" | $SED 's/ -lc / System.ltframework /'` |
cristy | 3ed852e | 2009-09-05 21:47:34 +0000 | [diff] [blame] | 8372 | ;; |
| 8373 | esac |
| 8374 | |
| 8375 | if test "$droppeddeps" = yes; then |
| 8376 | if test "$module" = yes; then |
cristy | 98dddb5 | 2010-11-04 00:30:15 +0000 | [diff] [blame] | 8377 | echo |
| 8378 | echo "*** Warning: libtool could not satisfy all declared inter-library" |
cristy | 3ed852e | 2009-09-05 21:47:34 +0000 | [diff] [blame] | 8379 | $ECHO "*** dependencies of module $libname. Therefore, libtool will create" |
cristy | 98dddb5 | 2010-11-04 00:30:15 +0000 | [diff] [blame] | 8380 | echo "*** a static module, that should work as long as the dlopening" |
| 8381 | echo "*** application is linked with the -dlopen flag." |
cristy | 3ed852e | 2009-09-05 21:47:34 +0000 | [diff] [blame] | 8382 | if test -z "$global_symbol_pipe"; then |
cristy | 98dddb5 | 2010-11-04 00:30:15 +0000 | [diff] [blame] | 8383 | echo |
| 8384 | echo "*** However, this would only work if libtool was able to extract symbol" |
| 8385 | echo "*** lists from a program, using \`nm' or equivalent, but libtool could" |
| 8386 | echo "*** not find such a program. So, this module is probably useless." |
| 8387 | echo "*** \`nm' from GNU binutils and a full rebuild may help." |
cristy | 3ed852e | 2009-09-05 21:47:34 +0000 | [diff] [blame] | 8388 | fi |
| 8389 | if test "$build_old_libs" = no; then |
| 8390 | oldlibs="$output_objdir/$libname.$libext" |
| 8391 | build_libtool_libs=module |
| 8392 | build_old_libs=yes |
| 8393 | else |
| 8394 | build_libtool_libs=no |
| 8395 | fi |
| 8396 | else |
cristy | 98dddb5 | 2010-11-04 00:30:15 +0000 | [diff] [blame] | 8397 | echo "*** The inter-library dependencies that have been dropped here will be" |
| 8398 | echo "*** automatically added whenever a program is linked with this library" |
| 8399 | echo "*** or is declared to -dlopen it." |
cristy | 3ed852e | 2009-09-05 21:47:34 +0000 | [diff] [blame] | 8400 | |
| 8401 | if test "$allow_undefined" = no; then |
cristy | 98dddb5 | 2010-11-04 00:30:15 +0000 | [diff] [blame] | 8402 | echo |
| 8403 | echo "*** Since this library must not contain undefined symbols," |
| 8404 | echo "*** because either the platform does not support them or" |
| 8405 | echo "*** it was explicitly requested with -no-undefined," |
| 8406 | echo "*** libtool will only create a static version of it." |
cristy | 3ed852e | 2009-09-05 21:47:34 +0000 | [diff] [blame] | 8407 | if test "$build_old_libs" = no; then |
| 8408 | oldlibs="$output_objdir/$libname.$libext" |
| 8409 | build_libtool_libs=module |
| 8410 | build_old_libs=yes |
| 8411 | else |
| 8412 | build_libtool_libs=no |
| 8413 | fi |
| 8414 | fi |
| 8415 | fi |
| 8416 | fi |
| 8417 | # Done checking deplibs! |
| 8418 | deplibs=$newdeplibs |
| 8419 | fi |
| 8420 | # Time to change all our "foo.ltframework" stuff back to "-framework foo" |
| 8421 | case $host in |
| 8422 | *-*-darwin*) |
cristy | 98dddb5 | 2010-11-04 00:30:15 +0000 | [diff] [blame] | 8423 | newdeplibs=`$ECHO " $newdeplibs" | $SED 's% \([^ $]*\).ltframework% -framework \1%g'` |
| 8424 | new_inherited_linker_flags=`$ECHO " $new_inherited_linker_flags" | $SED 's% \([^ $]*\).ltframework% -framework \1%g'` |
| 8425 | deplibs=`$ECHO " $deplibs" | $SED 's% \([^ $]*\).ltframework% -framework \1%g'` |
cristy | 3ed852e | 2009-09-05 21:47:34 +0000 | [diff] [blame] | 8426 | ;; |
| 8427 | esac |
| 8428 | |
| 8429 | # move library search paths that coincide with paths to not yet |
| 8430 | # installed libraries to the beginning of the library search list |
| 8431 | new_libs= |
| 8432 | for path in $notinst_path; do |
| 8433 | case " $new_libs " in |
| 8434 | *" -L$path/$objdir "*) ;; |
| 8435 | *) |
| 8436 | case " $deplibs " in |
| 8437 | *" -L$path/$objdir "*) |
cristy | da16f16 | 2011-02-19 23:52:17 +0000 | [diff] [blame] | 8438 | new_libs+=" -L$path/$objdir" ;; |
cristy | 3ed852e | 2009-09-05 21:47:34 +0000 | [diff] [blame] | 8439 | esac |
| 8440 | ;; |
| 8441 | esac |
| 8442 | done |
| 8443 | for deplib in $deplibs; do |
| 8444 | case $deplib in |
| 8445 | -L*) |
| 8446 | case " $new_libs " in |
| 8447 | *" $deplib "*) ;; |
cristy | da16f16 | 2011-02-19 23:52:17 +0000 | [diff] [blame] | 8448 | *) new_libs+=" $deplib" ;; |
cristy | 3ed852e | 2009-09-05 21:47:34 +0000 | [diff] [blame] | 8449 | esac |
| 8450 | ;; |
cristy | da16f16 | 2011-02-19 23:52:17 +0000 | [diff] [blame] | 8451 | *) new_libs+=" $deplib" ;; |
cristy | 3ed852e | 2009-09-05 21:47:34 +0000 | [diff] [blame] | 8452 | esac |
| 8453 | done |
| 8454 | deplibs="$new_libs" |
| 8455 | |
| 8456 | # All the library-specific variables (install_libdir is set above). |
| 8457 | library_names= |
| 8458 | old_library= |
| 8459 | dlname= |
| 8460 | |
| 8461 | # Test again, we may have decided not to build it any more |
| 8462 | if test "$build_libtool_libs" = yes; then |
| 8463 | if test "$hardcode_into_libs" = yes; then |
| 8464 | # Hardcode the library paths |
| 8465 | hardcode_libdirs= |
| 8466 | dep_rpath= |
| 8467 | rpath="$finalize_rpath" |
cristy | da16f16 | 2011-02-19 23:52:17 +0000 | [diff] [blame] | 8468 | test "$opt_mode" != relink && rpath="$compile_rpath$rpath" |
cristy | 3ed852e | 2009-09-05 21:47:34 +0000 | [diff] [blame] | 8469 | for libdir in $rpath; do |
| 8470 | if test -n "$hardcode_libdir_flag_spec"; then |
| 8471 | if test -n "$hardcode_libdir_separator"; then |
cristy | da16f16 | 2011-02-19 23:52:17 +0000 | [diff] [blame] | 8472 | func_replace_sysroot "$libdir" |
| 8473 | libdir=$func_replace_sysroot_result |
cristy | 3ed852e | 2009-09-05 21:47:34 +0000 | [diff] [blame] | 8474 | if test -z "$hardcode_libdirs"; then |
| 8475 | hardcode_libdirs="$libdir" |
| 8476 | else |
| 8477 | # Just accumulate the unique libdirs. |
| 8478 | case $hardcode_libdir_separator$hardcode_libdirs$hardcode_libdir_separator in |
| 8479 | *"$hardcode_libdir_separator$libdir$hardcode_libdir_separator"*) |
| 8480 | ;; |
| 8481 | *) |
cristy | da16f16 | 2011-02-19 23:52:17 +0000 | [diff] [blame] | 8482 | hardcode_libdirs+="$hardcode_libdir_separator$libdir" |
cristy | 3ed852e | 2009-09-05 21:47:34 +0000 | [diff] [blame] | 8483 | ;; |
| 8484 | esac |
| 8485 | fi |
| 8486 | else |
| 8487 | eval flag=\"$hardcode_libdir_flag_spec\" |
cristy | da16f16 | 2011-02-19 23:52:17 +0000 | [diff] [blame] | 8488 | dep_rpath+=" $flag" |
cristy | 3ed852e | 2009-09-05 21:47:34 +0000 | [diff] [blame] | 8489 | fi |
| 8490 | elif test -n "$runpath_var"; then |
| 8491 | case "$perm_rpath " in |
| 8492 | *" $libdir "*) ;; |
cristy | 56a80ee | 2011-02-20 03:42:00 +0000 | [diff] [blame] | 8493 | *) perm_rpath+=" $libdir" ;; |
cristy | 3ed852e | 2009-09-05 21:47:34 +0000 | [diff] [blame] | 8494 | esac |
| 8495 | fi |
| 8496 | done |
| 8497 | # Substitute the hardcoded libdirs into the rpath. |
| 8498 | if test -n "$hardcode_libdir_separator" && |
| 8499 | test -n "$hardcode_libdirs"; then |
| 8500 | libdir="$hardcode_libdirs" |
| 8501 | if test -n "$hardcode_libdir_flag_spec_ld"; then |
| 8502 | eval dep_rpath=\"$hardcode_libdir_flag_spec_ld\" |
| 8503 | else |
| 8504 | eval dep_rpath=\"$hardcode_libdir_flag_spec\" |
| 8505 | fi |
| 8506 | fi |
| 8507 | if test -n "$runpath_var" && test -n "$perm_rpath"; then |
| 8508 | # We should set the runpath_var. |
| 8509 | rpath= |
| 8510 | for dir in $perm_rpath; do |
cristy | da16f16 | 2011-02-19 23:52:17 +0000 | [diff] [blame] | 8511 | rpath+="$dir:" |
cristy | 3ed852e | 2009-09-05 21:47:34 +0000 | [diff] [blame] | 8512 | done |
| 8513 | eval "$runpath_var='$rpath\$$runpath_var'; export $runpath_var" |
| 8514 | fi |
| 8515 | test -n "$dep_rpath" && deplibs="$dep_rpath $deplibs" |
| 8516 | fi |
| 8517 | |
| 8518 | shlibpath="$finalize_shlibpath" |
cristy | da16f16 | 2011-02-19 23:52:17 +0000 | [diff] [blame] | 8519 | test "$opt_mode" != relink && shlibpath="$compile_shlibpath$shlibpath" |
cristy | 3ed852e | 2009-09-05 21:47:34 +0000 | [diff] [blame] | 8520 | if test -n "$shlibpath"; then |
| 8521 | eval "$shlibpath_var='$shlibpath\$$shlibpath_var'; export $shlibpath_var" |
| 8522 | fi |
| 8523 | |
| 8524 | # Get the real and link names of the library. |
| 8525 | eval shared_ext=\"$shrext_cmds\" |
| 8526 | eval library_names=\"$library_names_spec\" |
| 8527 | set dummy $library_names |
| 8528 | shift |
| 8529 | realname="$1" |
| 8530 | shift |
| 8531 | |
| 8532 | if test -n "$soname_spec"; then |
| 8533 | eval soname=\"$soname_spec\" |
| 8534 | else |
| 8535 | soname="$realname" |
| 8536 | fi |
| 8537 | if test -z "$dlname"; then |
| 8538 | dlname=$soname |
| 8539 | fi |
| 8540 | |
| 8541 | lib="$output_objdir/$realname" |
| 8542 | linknames= |
| 8543 | for link |
| 8544 | do |
cristy | da16f16 | 2011-02-19 23:52:17 +0000 | [diff] [blame] | 8545 | linknames+=" $link" |
cristy | 3ed852e | 2009-09-05 21:47:34 +0000 | [diff] [blame] | 8546 | done |
| 8547 | |
| 8548 | # Use standard objects if they are pic |
cristy | 98dddb5 | 2010-11-04 00:30:15 +0000 | [diff] [blame] | 8549 | test -z "$pic_flag" && libobjs=`$ECHO "$libobjs" | $SP2NL | $SED "$lo2o" | $NL2SP` |
cristy | 3ed852e | 2009-09-05 21:47:34 +0000 | [diff] [blame] | 8550 | test "X$libobjs" = "X " && libobjs= |
| 8551 | |
| 8552 | delfiles= |
| 8553 | if test -n "$export_symbols" && test -n "$include_expsyms"; then |
| 8554 | $opt_dry_run || cp "$export_symbols" "$output_objdir/$libname.uexp" |
| 8555 | export_symbols="$output_objdir/$libname.uexp" |
cristy | da16f16 | 2011-02-19 23:52:17 +0000 | [diff] [blame] | 8556 | delfiles+=" $export_symbols" |
cristy | 3ed852e | 2009-09-05 21:47:34 +0000 | [diff] [blame] | 8557 | fi |
| 8558 | |
| 8559 | orig_export_symbols= |
| 8560 | case $host_os in |
| 8561 | cygwin* | mingw* | cegcc*) |
| 8562 | if test -n "$export_symbols" && test -z "$export_symbols_regex"; then |
| 8563 | # exporting using user supplied symfile |
| 8564 | if test "x`$SED 1q $export_symbols`" != xEXPORTS; then |
| 8565 | # and it's NOT already a .def file. Must figure out |
| 8566 | # which of the given symbols are data symbols and tag |
| 8567 | # them as such. So, trigger use of export_symbols_cmds. |
| 8568 | # export_symbols gets reassigned inside the "prepare |
| 8569 | # the list of exported symbols" if statement, so the |
| 8570 | # include_expsyms logic still works. |
| 8571 | orig_export_symbols="$export_symbols" |
| 8572 | export_symbols= |
| 8573 | always_export_symbols=yes |
| 8574 | fi |
| 8575 | fi |
| 8576 | ;; |
| 8577 | esac |
| 8578 | |
| 8579 | # Prepare the list of exported symbols |
| 8580 | if test -z "$export_symbols"; then |
| 8581 | if test "$always_export_symbols" = yes || test -n "$export_symbols_regex"; then |
| 8582 | func_verbose "generating symbol list for \`$libname.la'" |
| 8583 | export_symbols="$output_objdir/$libname.exp" |
| 8584 | $opt_dry_run || $RM $export_symbols |
| 8585 | cmds=$export_symbols_cmds |
| 8586 | save_ifs="$IFS"; IFS='~' |
cristy | da16f16 | 2011-02-19 23:52:17 +0000 | [diff] [blame] | 8587 | for cmd1 in $cmds; do |
cristy | 3ed852e | 2009-09-05 21:47:34 +0000 | [diff] [blame] | 8588 | IFS="$save_ifs" |
cristy | da16f16 | 2011-02-19 23:52:17 +0000 | [diff] [blame] | 8589 | # Take the normal branch if the nm_file_list_spec branch |
| 8590 | # doesn't work or if tool conversion is not needed. |
| 8591 | case $nm_file_list_spec~$to_tool_file_cmd in |
| 8592 | *~func_convert_file_noop | *~func_convert_file_msys_to_w32 | ~*) |
| 8593 | try_normal_branch=yes |
| 8594 | eval cmd=\"$cmd1\" |
| 8595 | func_len " $cmd" |
| 8596 | len=$func_len_result |
| 8597 | ;; |
| 8598 | *) |
| 8599 | try_normal_branch=no |
| 8600 | ;; |
| 8601 | esac |
| 8602 | if test "$try_normal_branch" = yes \ |
| 8603 | && { test "$len" -lt "$max_cmd_len" \ |
| 8604 | || test "$max_cmd_len" -le -1; } |
| 8605 | then |
cristy | 3ed852e | 2009-09-05 21:47:34 +0000 | [diff] [blame] | 8606 | func_show_eval "$cmd" 'exit $?' |
| 8607 | skipped_export=false |
cristy | da16f16 | 2011-02-19 23:52:17 +0000 | [diff] [blame] | 8608 | elif test -n "$nm_file_list_spec"; then |
| 8609 | func_basename "$output" |
| 8610 | output_la=$func_basename_result |
| 8611 | save_libobjs=$libobjs |
| 8612 | save_output=$output |
| 8613 | output=${output_objdir}/${output_la}.nm |
| 8614 | func_to_tool_file "$output" |
| 8615 | libobjs=$nm_file_list_spec$func_to_tool_file_result |
| 8616 | delfiles+=" $output" |
| 8617 | func_verbose "creating $NM input file list: $output" |
| 8618 | for obj in $save_libobjs; do |
| 8619 | func_to_tool_file "$obj" |
| 8620 | $ECHO "$func_to_tool_file_result" |
| 8621 | done > "$output" |
| 8622 | eval cmd=\"$cmd1\" |
| 8623 | func_show_eval "$cmd" 'exit $?' |
| 8624 | output=$save_output |
| 8625 | libobjs=$save_libobjs |
| 8626 | skipped_export=false |
cristy | 3ed852e | 2009-09-05 21:47:34 +0000 | [diff] [blame] | 8627 | else |
| 8628 | # The command line is too long to execute in one step. |
| 8629 | func_verbose "using reloadable object file for export list..." |
| 8630 | skipped_export=: |
| 8631 | # Break out early, otherwise skipped_export may be |
| 8632 | # set to false by a later but shorter cmd. |
| 8633 | break |
| 8634 | fi |
| 8635 | done |
| 8636 | IFS="$save_ifs" |
| 8637 | if test -n "$export_symbols_regex" && test "X$skipped_export" != "X:"; then |
| 8638 | func_show_eval '$EGREP -e "$export_symbols_regex" "$export_symbols" > "${export_symbols}T"' |
| 8639 | func_show_eval '$MV "${export_symbols}T" "$export_symbols"' |
| 8640 | fi |
| 8641 | fi |
| 8642 | fi |
| 8643 | |
| 8644 | if test -n "$export_symbols" && test -n "$include_expsyms"; then |
| 8645 | tmp_export_symbols="$export_symbols" |
| 8646 | test -n "$orig_export_symbols" && tmp_export_symbols="$orig_export_symbols" |
cristy | 98dddb5 | 2010-11-04 00:30:15 +0000 | [diff] [blame] | 8647 | $opt_dry_run || eval '$ECHO "$include_expsyms" | $SP2NL >> "$tmp_export_symbols"' |
cristy | 3ed852e | 2009-09-05 21:47:34 +0000 | [diff] [blame] | 8648 | fi |
| 8649 | |
| 8650 | if test "X$skipped_export" != "X:" && test -n "$orig_export_symbols"; then |
| 8651 | # The given exports_symbols file has to be filtered, so filter it. |
| 8652 | func_verbose "filter symbol list for \`$libname.la' to tag DATA exports" |
| 8653 | # FIXME: $output_objdir/$libname.filter potentially contains lots of |
| 8654 | # 's' commands which not all seds can handle. GNU sed should be fine |
| 8655 | # though. Also, the filter scales superlinearly with the number of |
| 8656 | # global variables. join(1) would be nice here, but unfortunately |
| 8657 | # isn't a blessed tool. |
| 8658 | $opt_dry_run || $SED -e '/[ ,]DATA/!d;s,\(.*\)\([ \,].*\),s|^\1$|\1\2|,' < $export_symbols > $output_objdir/$libname.filter |
cristy | da16f16 | 2011-02-19 23:52:17 +0000 | [diff] [blame] | 8659 | delfiles+=" $export_symbols $output_objdir/$libname.filter" |
cristy | 3ed852e | 2009-09-05 21:47:34 +0000 | [diff] [blame] | 8660 | export_symbols=$output_objdir/$libname.def |
| 8661 | $opt_dry_run || $SED -f $output_objdir/$libname.filter < $orig_export_symbols > $export_symbols |
| 8662 | fi |
| 8663 | |
| 8664 | tmp_deplibs= |
| 8665 | for test_deplib in $deplibs; do |
| 8666 | case " $convenience " in |
| 8667 | *" $test_deplib "*) ;; |
| 8668 | *) |
cristy | da16f16 | 2011-02-19 23:52:17 +0000 | [diff] [blame] | 8669 | tmp_deplibs+=" $test_deplib" |
cristy | 3ed852e | 2009-09-05 21:47:34 +0000 | [diff] [blame] | 8670 | ;; |
| 8671 | esac |
| 8672 | done |
| 8673 | deplibs="$tmp_deplibs" |
| 8674 | |
| 8675 | if test -n "$convenience"; then |
| 8676 | if test -n "$whole_archive_flag_spec" && |
| 8677 | test "$compiler_needs_object" = yes && |
| 8678 | test -z "$libobjs"; then |
| 8679 | # extract the archives, so we have objects to list. |
| 8680 | # TODO: could optimize this to just extract one archive. |
| 8681 | whole_archive_flag_spec= |
| 8682 | fi |
| 8683 | if test -n "$whole_archive_flag_spec"; then |
| 8684 | save_libobjs=$libobjs |
| 8685 | eval libobjs=\"\$libobjs $whole_archive_flag_spec\" |
| 8686 | test "X$libobjs" = "X " && libobjs= |
| 8687 | else |
| 8688 | gentop="$output_objdir/${outputname}x" |
cristy | da16f16 | 2011-02-19 23:52:17 +0000 | [diff] [blame] | 8689 | generated+=" $gentop" |
cristy | 3ed852e | 2009-09-05 21:47:34 +0000 | [diff] [blame] | 8690 | |
| 8691 | func_extract_archives $gentop $convenience |
cristy | da16f16 | 2011-02-19 23:52:17 +0000 | [diff] [blame] | 8692 | libobjs+=" $func_extract_archives_result" |
cristy | 3ed852e | 2009-09-05 21:47:34 +0000 | [diff] [blame] | 8693 | test "X$libobjs" = "X " && libobjs= |
| 8694 | fi |
| 8695 | fi |
| 8696 | |
| 8697 | if test "$thread_safe" = yes && test -n "$thread_safe_flag_spec"; then |
| 8698 | eval flag=\"$thread_safe_flag_spec\" |
cristy | da16f16 | 2011-02-19 23:52:17 +0000 | [diff] [blame] | 8699 | linker_flags+=" $flag" |
cristy | 3ed852e | 2009-09-05 21:47:34 +0000 | [diff] [blame] | 8700 | fi |
| 8701 | |
| 8702 | # Make a backup of the uninstalled library when relinking |
cristy | da16f16 | 2011-02-19 23:52:17 +0000 | [diff] [blame] | 8703 | if test "$opt_mode" = relink; then |
cristy | 3ed852e | 2009-09-05 21:47:34 +0000 | [diff] [blame] | 8704 | $opt_dry_run || eval '(cd $output_objdir && $RM ${realname}U && $MV $realname ${realname}U)' || exit $? |
| 8705 | fi |
| 8706 | |
| 8707 | # Do each of the archive commands. |
| 8708 | if test "$module" = yes && test -n "$module_cmds" ; then |
| 8709 | if test -n "$export_symbols" && test -n "$module_expsym_cmds"; then |
| 8710 | eval test_cmds=\"$module_expsym_cmds\" |
| 8711 | cmds=$module_expsym_cmds |
| 8712 | else |
| 8713 | eval test_cmds=\"$module_cmds\" |
| 8714 | cmds=$module_cmds |
| 8715 | fi |
| 8716 | else |
| 8717 | if test -n "$export_symbols" && test -n "$archive_expsym_cmds"; then |
| 8718 | eval test_cmds=\"$archive_expsym_cmds\" |
| 8719 | cmds=$archive_expsym_cmds |
| 8720 | else |
| 8721 | eval test_cmds=\"$archive_cmds\" |
| 8722 | cmds=$archive_cmds |
| 8723 | fi |
| 8724 | fi |
| 8725 | |
| 8726 | if test "X$skipped_export" != "X:" && |
| 8727 | func_len " $test_cmds" && |
| 8728 | len=$func_len_result && |
| 8729 | test "$len" -lt "$max_cmd_len" || test "$max_cmd_len" -le -1; then |
| 8730 | : |
| 8731 | else |
| 8732 | # The command line is too long to link in one step, link piecewise |
| 8733 | # or, if using GNU ld and skipped_export is not :, use a linker |
| 8734 | # script. |
| 8735 | |
| 8736 | # Save the value of $output and $libobjs because we want to |
| 8737 | # use them later. If we have whole_archive_flag_spec, we |
| 8738 | # want to use save_libobjs as it was before |
| 8739 | # whole_archive_flag_spec was expanded, because we can't |
| 8740 | # assume the linker understands whole_archive_flag_spec. |
| 8741 | # This may have to be revisited, in case too many |
| 8742 | # convenience libraries get linked in and end up exceeding |
| 8743 | # the spec. |
| 8744 | if test -z "$convenience" || test -z "$whole_archive_flag_spec"; then |
| 8745 | save_libobjs=$libobjs |
| 8746 | fi |
| 8747 | save_output=$output |
cristy | 98dddb5 | 2010-11-04 00:30:15 +0000 | [diff] [blame] | 8748 | func_basename "$output" |
| 8749 | output_la=$func_basename_result |
cristy | 3ed852e | 2009-09-05 21:47:34 +0000 | [diff] [blame] | 8750 | |
| 8751 | # Clear the reloadable object creation command queue and |
| 8752 | # initialize k to one. |
| 8753 | test_cmds= |
| 8754 | concat_cmds= |
| 8755 | objlist= |
| 8756 | last_robj= |
| 8757 | k=1 |
| 8758 | |
| 8759 | if test -n "$save_libobjs" && test "X$skipped_export" != "X:" && test "$with_gnu_ld" = yes; then |
| 8760 | output=${output_objdir}/${output_la}.lnkscript |
| 8761 | func_verbose "creating GNU ld script: $output" |
cristy | 98dddb5 | 2010-11-04 00:30:15 +0000 | [diff] [blame] | 8762 | echo 'INPUT (' > $output |
cristy | 3ed852e | 2009-09-05 21:47:34 +0000 | [diff] [blame] | 8763 | for obj in $save_libobjs |
| 8764 | do |
cristy | da16f16 | 2011-02-19 23:52:17 +0000 | [diff] [blame] | 8765 | func_to_tool_file "$obj" |
| 8766 | $ECHO "$func_to_tool_file_result" >> $output |
cristy | 3ed852e | 2009-09-05 21:47:34 +0000 | [diff] [blame] | 8767 | done |
cristy | 98dddb5 | 2010-11-04 00:30:15 +0000 | [diff] [blame] | 8768 | echo ')' >> $output |
cristy | da16f16 | 2011-02-19 23:52:17 +0000 | [diff] [blame] | 8769 | delfiles+=" $output" |
| 8770 | func_to_tool_file "$output" |
| 8771 | output=$func_to_tool_file_result |
cristy | 3ed852e | 2009-09-05 21:47:34 +0000 | [diff] [blame] | 8772 | elif test -n "$save_libobjs" && test "X$skipped_export" != "X:" && test "X$file_list_spec" != X; then |
| 8773 | output=${output_objdir}/${output_la}.lnk |
| 8774 | func_verbose "creating linker input file list: $output" |
| 8775 | : > $output |
| 8776 | set x $save_libobjs |
| 8777 | shift |
| 8778 | firstobj= |
| 8779 | if test "$compiler_needs_object" = yes; then |
| 8780 | firstobj="$1 " |
| 8781 | shift |
| 8782 | fi |
| 8783 | for obj |
| 8784 | do |
cristy | da16f16 | 2011-02-19 23:52:17 +0000 | [diff] [blame] | 8785 | func_to_tool_file "$obj" |
| 8786 | $ECHO "$func_to_tool_file_result" >> $output |
cristy | 3ed852e | 2009-09-05 21:47:34 +0000 | [diff] [blame] | 8787 | done |
cristy | da16f16 | 2011-02-19 23:52:17 +0000 | [diff] [blame] | 8788 | delfiles+=" $output" |
| 8789 | func_to_tool_file "$output" |
| 8790 | output=$firstobj\"$file_list_spec$func_to_tool_file_result\" |
cristy | 3ed852e | 2009-09-05 21:47:34 +0000 | [diff] [blame] | 8791 | else |
| 8792 | if test -n "$save_libobjs"; then |
| 8793 | func_verbose "creating reloadable object files..." |
| 8794 | output=$output_objdir/$output_la-${k}.$objext |
| 8795 | eval test_cmds=\"$reload_cmds\" |
| 8796 | func_len " $test_cmds" |
| 8797 | len0=$func_len_result |
| 8798 | len=$len0 |
| 8799 | |
| 8800 | # Loop over the list of objects to be linked. |
| 8801 | for obj in $save_libobjs |
| 8802 | do |
| 8803 | func_len " $obj" |
| 8804 | func_arith $len + $func_len_result |
| 8805 | len=$func_arith_result |
| 8806 | if test "X$objlist" = X || |
| 8807 | test "$len" -lt "$max_cmd_len"; then |
cristy | da16f16 | 2011-02-19 23:52:17 +0000 | [diff] [blame] | 8808 | objlist+=" $obj" |
cristy | 3ed852e | 2009-09-05 21:47:34 +0000 | [diff] [blame] | 8809 | else |
| 8810 | # The command $test_cmds is almost too long, add a |
| 8811 | # command to the queue. |
| 8812 | if test "$k" -eq 1 ; then |
| 8813 | # The first file doesn't have a previous command to add. |
cristy | 98dddb5 | 2010-11-04 00:30:15 +0000 | [diff] [blame] | 8814 | reload_objs=$objlist |
| 8815 | eval concat_cmds=\"$reload_cmds\" |
cristy | 3ed852e | 2009-09-05 21:47:34 +0000 | [diff] [blame] | 8816 | else |
| 8817 | # All subsequent reloadable object files will link in |
| 8818 | # the last one created. |
cristy | 98dddb5 | 2010-11-04 00:30:15 +0000 | [diff] [blame] | 8819 | reload_objs="$objlist $last_robj" |
| 8820 | eval concat_cmds=\"\$concat_cmds~$reload_cmds~\$RM $last_robj\" |
cristy | 3ed852e | 2009-09-05 21:47:34 +0000 | [diff] [blame] | 8821 | fi |
| 8822 | last_robj=$output_objdir/$output_la-${k}.$objext |
| 8823 | func_arith $k + 1 |
| 8824 | k=$func_arith_result |
| 8825 | output=$output_objdir/$output_la-${k}.$objext |
cristy | 98dddb5 | 2010-11-04 00:30:15 +0000 | [diff] [blame] | 8826 | objlist=" $obj" |
cristy | 3ed852e | 2009-09-05 21:47:34 +0000 | [diff] [blame] | 8827 | func_len " $last_robj" |
| 8828 | func_arith $len0 + $func_len_result |
| 8829 | len=$func_arith_result |
| 8830 | fi |
| 8831 | done |
| 8832 | # Handle the remaining objects by creating one last |
| 8833 | # reloadable object file. All subsequent reloadable object |
| 8834 | # files will link in the last one created. |
| 8835 | test -z "$concat_cmds" || concat_cmds=$concat_cmds~ |
cristy | 98dddb5 | 2010-11-04 00:30:15 +0000 | [diff] [blame] | 8836 | reload_objs="$objlist $last_robj" |
| 8837 | eval concat_cmds=\"\${concat_cmds}$reload_cmds\" |
cristy | 3ed852e | 2009-09-05 21:47:34 +0000 | [diff] [blame] | 8838 | if test -n "$last_robj"; then |
| 8839 | eval concat_cmds=\"\${concat_cmds}~\$RM $last_robj\" |
| 8840 | fi |
cristy | da16f16 | 2011-02-19 23:52:17 +0000 | [diff] [blame] | 8841 | delfiles+=" $output" |
cristy | 3ed852e | 2009-09-05 21:47:34 +0000 | [diff] [blame] | 8842 | |
| 8843 | else |
| 8844 | output= |
| 8845 | fi |
| 8846 | |
| 8847 | if ${skipped_export-false}; then |
| 8848 | func_verbose "generating symbol list for \`$libname.la'" |
| 8849 | export_symbols="$output_objdir/$libname.exp" |
| 8850 | $opt_dry_run || $RM $export_symbols |
| 8851 | libobjs=$output |
| 8852 | # Append the command to create the export file. |
| 8853 | test -z "$concat_cmds" || concat_cmds=$concat_cmds~ |
| 8854 | eval concat_cmds=\"\$concat_cmds$export_symbols_cmds\" |
| 8855 | if test -n "$last_robj"; then |
| 8856 | eval concat_cmds=\"\$concat_cmds~\$RM $last_robj\" |
| 8857 | fi |
| 8858 | fi |
| 8859 | |
| 8860 | test -n "$save_libobjs" && |
| 8861 | func_verbose "creating a temporary reloadable object file: $output" |
| 8862 | |
| 8863 | # Loop through the commands generated above and execute them. |
| 8864 | save_ifs="$IFS"; IFS='~' |
| 8865 | for cmd in $concat_cmds; do |
| 8866 | IFS="$save_ifs" |
| 8867 | $opt_silent || { |
| 8868 | func_quote_for_expand "$cmd" |
| 8869 | eval "func_echo $func_quote_for_expand_result" |
| 8870 | } |
| 8871 | $opt_dry_run || eval "$cmd" || { |
| 8872 | lt_exit=$? |
| 8873 | |
| 8874 | # Restore the uninstalled library and exit |
cristy | da16f16 | 2011-02-19 23:52:17 +0000 | [diff] [blame] | 8875 | if test "$opt_mode" = relink; then |
cristy | 3ed852e | 2009-09-05 21:47:34 +0000 | [diff] [blame] | 8876 | ( cd "$output_objdir" && \ |
| 8877 | $RM "${realname}T" && \ |
| 8878 | $MV "${realname}U" "$realname" ) |
| 8879 | fi |
| 8880 | |
| 8881 | exit $lt_exit |
| 8882 | } |
| 8883 | done |
| 8884 | IFS="$save_ifs" |
| 8885 | |
| 8886 | if test -n "$export_symbols_regex" && ${skipped_export-false}; then |
| 8887 | func_show_eval '$EGREP -e "$export_symbols_regex" "$export_symbols" > "${export_symbols}T"' |
| 8888 | func_show_eval '$MV "${export_symbols}T" "$export_symbols"' |
| 8889 | fi |
| 8890 | fi |
| 8891 | |
| 8892 | if ${skipped_export-false}; then |
| 8893 | if test -n "$export_symbols" && test -n "$include_expsyms"; then |
| 8894 | tmp_export_symbols="$export_symbols" |
| 8895 | test -n "$orig_export_symbols" && tmp_export_symbols="$orig_export_symbols" |
cristy | 98dddb5 | 2010-11-04 00:30:15 +0000 | [diff] [blame] | 8896 | $opt_dry_run || eval '$ECHO "$include_expsyms" | $SP2NL >> "$tmp_export_symbols"' |
cristy | 3ed852e | 2009-09-05 21:47:34 +0000 | [diff] [blame] | 8897 | fi |
| 8898 | |
| 8899 | if test -n "$orig_export_symbols"; then |
| 8900 | # The given exports_symbols file has to be filtered, so filter it. |
| 8901 | func_verbose "filter symbol list for \`$libname.la' to tag DATA exports" |
| 8902 | # FIXME: $output_objdir/$libname.filter potentially contains lots of |
| 8903 | # 's' commands which not all seds can handle. GNU sed should be fine |
| 8904 | # though. Also, the filter scales superlinearly with the number of |
| 8905 | # global variables. join(1) would be nice here, but unfortunately |
| 8906 | # isn't a blessed tool. |
| 8907 | $opt_dry_run || $SED -e '/[ ,]DATA/!d;s,\(.*\)\([ \,].*\),s|^\1$|\1\2|,' < $export_symbols > $output_objdir/$libname.filter |
cristy | da16f16 | 2011-02-19 23:52:17 +0000 | [diff] [blame] | 8908 | delfiles+=" $export_symbols $output_objdir/$libname.filter" |
cristy | 3ed852e | 2009-09-05 21:47:34 +0000 | [diff] [blame] | 8909 | export_symbols=$output_objdir/$libname.def |
| 8910 | $opt_dry_run || $SED -f $output_objdir/$libname.filter < $orig_export_symbols > $export_symbols |
| 8911 | fi |
| 8912 | fi |
| 8913 | |
| 8914 | libobjs=$output |
| 8915 | # Restore the value of output. |
| 8916 | output=$save_output |
| 8917 | |
| 8918 | if test -n "$convenience" && test -n "$whole_archive_flag_spec"; then |
| 8919 | eval libobjs=\"\$libobjs $whole_archive_flag_spec\" |
| 8920 | test "X$libobjs" = "X " && libobjs= |
| 8921 | fi |
| 8922 | # Expand the library linking commands again to reset the |
| 8923 | # value of $libobjs for piecewise linking. |
| 8924 | |
| 8925 | # Do each of the archive commands. |
| 8926 | if test "$module" = yes && test -n "$module_cmds" ; then |
| 8927 | if test -n "$export_symbols" && test -n "$module_expsym_cmds"; then |
| 8928 | cmds=$module_expsym_cmds |
| 8929 | else |
| 8930 | cmds=$module_cmds |
| 8931 | fi |
| 8932 | else |
| 8933 | if test -n "$export_symbols" && test -n "$archive_expsym_cmds"; then |
| 8934 | cmds=$archive_expsym_cmds |
| 8935 | else |
| 8936 | cmds=$archive_cmds |
| 8937 | fi |
| 8938 | fi |
| 8939 | fi |
| 8940 | |
| 8941 | if test -n "$delfiles"; then |
| 8942 | # Append the command to remove temporary files to $cmds. |
| 8943 | eval cmds=\"\$cmds~\$RM $delfiles\" |
| 8944 | fi |
| 8945 | |
| 8946 | # Add any objects from preloaded convenience libraries |
| 8947 | if test -n "$dlprefiles"; then |
| 8948 | gentop="$output_objdir/${outputname}x" |
cristy | da16f16 | 2011-02-19 23:52:17 +0000 | [diff] [blame] | 8949 | generated+=" $gentop" |
cristy | 3ed852e | 2009-09-05 21:47:34 +0000 | [diff] [blame] | 8950 | |
| 8951 | func_extract_archives $gentop $dlprefiles |
cristy | da16f16 | 2011-02-19 23:52:17 +0000 | [diff] [blame] | 8952 | libobjs+=" $func_extract_archives_result" |
cristy | 3ed852e | 2009-09-05 21:47:34 +0000 | [diff] [blame] | 8953 | test "X$libobjs" = "X " && libobjs= |
| 8954 | fi |
| 8955 | |
| 8956 | save_ifs="$IFS"; IFS='~' |
| 8957 | for cmd in $cmds; do |
| 8958 | IFS="$save_ifs" |
| 8959 | eval cmd=\"$cmd\" |
| 8960 | $opt_silent || { |
| 8961 | func_quote_for_expand "$cmd" |
| 8962 | eval "func_echo $func_quote_for_expand_result" |
| 8963 | } |
| 8964 | $opt_dry_run || eval "$cmd" || { |
| 8965 | lt_exit=$? |
| 8966 | |
| 8967 | # Restore the uninstalled library and exit |
cristy | da16f16 | 2011-02-19 23:52:17 +0000 | [diff] [blame] | 8968 | if test "$opt_mode" = relink; then |
cristy | 3ed852e | 2009-09-05 21:47:34 +0000 | [diff] [blame] | 8969 | ( cd "$output_objdir" && \ |
| 8970 | $RM "${realname}T" && \ |
| 8971 | $MV "${realname}U" "$realname" ) |
| 8972 | fi |
| 8973 | |
| 8974 | exit $lt_exit |
| 8975 | } |
| 8976 | done |
| 8977 | IFS="$save_ifs" |
| 8978 | |
| 8979 | # Restore the uninstalled library and exit |
cristy | da16f16 | 2011-02-19 23:52:17 +0000 | [diff] [blame] | 8980 | if test "$opt_mode" = relink; then |
cristy | 3ed852e | 2009-09-05 21:47:34 +0000 | [diff] [blame] | 8981 | $opt_dry_run || eval '(cd $output_objdir && $RM ${realname}T && $MV $realname ${realname}T && $MV ${realname}U $realname)' || exit $? |
| 8982 | |
| 8983 | if test -n "$convenience"; then |
| 8984 | if test -z "$whole_archive_flag_spec"; then |
| 8985 | func_show_eval '${RM}r "$gentop"' |
| 8986 | fi |
| 8987 | fi |
| 8988 | |
| 8989 | exit $EXIT_SUCCESS |
| 8990 | fi |
| 8991 | |
| 8992 | # Create links to the real library. |
| 8993 | for linkname in $linknames; do |
| 8994 | if test "$realname" != "$linkname"; then |
| 8995 | func_show_eval '(cd "$output_objdir" && $RM "$linkname" && $LN_S "$realname" "$linkname")' 'exit $?' |
| 8996 | fi |
| 8997 | done |
| 8998 | |
| 8999 | # If -module or -export-dynamic was specified, set the dlname. |
| 9000 | if test "$module" = yes || test "$export_dynamic" = yes; then |
| 9001 | # On all known operating systems, these are identical. |
| 9002 | dlname="$soname" |
| 9003 | fi |
| 9004 | fi |
| 9005 | ;; |
| 9006 | |
| 9007 | obj) |
| 9008 | if test -n "$dlfiles$dlprefiles" || test "$dlself" != no; then |
| 9009 | func_warning "\`-dlopen' is ignored for objects" |
| 9010 | fi |
| 9011 | |
| 9012 | case " $deplibs" in |
| 9013 | *\ -l* | *\ -L*) |
| 9014 | func_warning "\`-l' and \`-L' are ignored for objects" ;; |
| 9015 | esac |
| 9016 | |
| 9017 | test -n "$rpath" && \ |
| 9018 | func_warning "\`-rpath' is ignored for objects" |
| 9019 | |
| 9020 | test -n "$xrpath" && \ |
| 9021 | func_warning "\`-R' is ignored for objects" |
| 9022 | |
| 9023 | test -n "$vinfo" && \ |
| 9024 | func_warning "\`-version-info' is ignored for objects" |
| 9025 | |
| 9026 | test -n "$release" && \ |
| 9027 | func_warning "\`-release' is ignored for objects" |
| 9028 | |
| 9029 | case $output in |
| 9030 | *.lo) |
| 9031 | test -n "$objs$old_deplibs" && \ |
| 9032 | func_fatal_error "cannot build library object \`$output' from non-libtool objects" |
| 9033 | |
| 9034 | libobj=$output |
| 9035 | func_lo2o "$libobj" |
| 9036 | obj=$func_lo2o_result |
| 9037 | ;; |
| 9038 | *) |
| 9039 | libobj= |
| 9040 | obj="$output" |
| 9041 | ;; |
| 9042 | esac |
| 9043 | |
| 9044 | # Delete the old objects. |
| 9045 | $opt_dry_run || $RM $obj $libobj |
| 9046 | |
| 9047 | # Objects from convenience libraries. This assumes |
| 9048 | # single-version convenience libraries. Whenever we create |
| 9049 | # different ones for PIC/non-PIC, this we'll have to duplicate |
| 9050 | # the extraction. |
| 9051 | reload_conv_objs= |
| 9052 | gentop= |
| 9053 | # reload_cmds runs $LD directly, so let us get rid of |
| 9054 | # -Wl from whole_archive_flag_spec and hope we can get by with |
| 9055 | # turning comma into space.. |
| 9056 | wl= |
| 9057 | |
| 9058 | if test -n "$convenience"; then |
| 9059 | if test -n "$whole_archive_flag_spec"; then |
| 9060 | eval tmp_whole_archive_flags=\"$whole_archive_flag_spec\" |
cristy | 98dddb5 | 2010-11-04 00:30:15 +0000 | [diff] [blame] | 9061 | reload_conv_objs=$reload_objs\ `$ECHO "$tmp_whole_archive_flags" | $SED 's|,| |g'` |
cristy | 3ed852e | 2009-09-05 21:47:34 +0000 | [diff] [blame] | 9062 | else |
| 9063 | gentop="$output_objdir/${obj}x" |
cristy | da16f16 | 2011-02-19 23:52:17 +0000 | [diff] [blame] | 9064 | generated+=" $gentop" |
cristy | 3ed852e | 2009-09-05 21:47:34 +0000 | [diff] [blame] | 9065 | |
| 9066 | func_extract_archives $gentop $convenience |
| 9067 | reload_conv_objs="$reload_objs $func_extract_archives_result" |
| 9068 | fi |
| 9069 | fi |
| 9070 | |
cristy | da16f16 | 2011-02-19 23:52:17 +0000 | [diff] [blame] | 9071 | # If we're not building shared, we need to use non_pic_objs |
| 9072 | test "$build_libtool_libs" != yes && libobjs="$non_pic_objects" |
| 9073 | |
cristy | 3ed852e | 2009-09-05 21:47:34 +0000 | [diff] [blame] | 9074 | # Create the old-style object. |
cristy | 98dddb5 | 2010-11-04 00:30:15 +0000 | [diff] [blame] | 9075 | reload_objs="$objs$old_deplibs "`$ECHO "$libobjs" | $SP2NL | $SED "/\.${libext}$/d; /\.lib$/d; $lo2o" | $NL2SP`" $reload_conv_objs" ### testsuite: skip nested quoting test |
cristy | 3ed852e | 2009-09-05 21:47:34 +0000 | [diff] [blame] | 9076 | |
| 9077 | output="$obj" |
| 9078 | func_execute_cmds "$reload_cmds" 'exit $?' |
| 9079 | |
| 9080 | # Exit if we aren't doing a library object file. |
| 9081 | if test -z "$libobj"; then |
| 9082 | if test -n "$gentop"; then |
| 9083 | func_show_eval '${RM}r "$gentop"' |
| 9084 | fi |
| 9085 | |
| 9086 | exit $EXIT_SUCCESS |
| 9087 | fi |
| 9088 | |
| 9089 | if test "$build_libtool_libs" != yes; then |
| 9090 | if test -n "$gentop"; then |
| 9091 | func_show_eval '${RM}r "$gentop"' |
| 9092 | fi |
| 9093 | |
| 9094 | # Create an invalid libtool object if no PIC, so that we don't |
| 9095 | # accidentally link it into a program. |
| 9096 | # $show "echo timestamp > $libobj" |
| 9097 | # $opt_dry_run || eval "echo timestamp > $libobj" || exit $? |
| 9098 | exit $EXIT_SUCCESS |
| 9099 | fi |
| 9100 | |
| 9101 | if test -n "$pic_flag" || test "$pic_mode" != default; then |
| 9102 | # Only do commands if we really have different PIC objects. |
| 9103 | reload_objs="$libobjs $reload_conv_objs" |
| 9104 | output="$libobj" |
| 9105 | func_execute_cmds "$reload_cmds" 'exit $?' |
| 9106 | fi |
| 9107 | |
| 9108 | if test -n "$gentop"; then |
| 9109 | func_show_eval '${RM}r "$gentop"' |
| 9110 | fi |
| 9111 | |
| 9112 | exit $EXIT_SUCCESS |
| 9113 | ;; |
| 9114 | |
| 9115 | prog) |
| 9116 | case $host in |
| 9117 | *cygwin*) func_stripname '' '.exe' "$output" |
| 9118 | output=$func_stripname_result.exe;; |
| 9119 | esac |
| 9120 | test -n "$vinfo" && \ |
| 9121 | func_warning "\`-version-info' is ignored for programs" |
| 9122 | |
| 9123 | test -n "$release" && \ |
| 9124 | func_warning "\`-release' is ignored for programs" |
| 9125 | |
| 9126 | test "$preload" = yes \ |
| 9127 | && test "$dlopen_support" = unknown \ |
| 9128 | && test "$dlopen_self" = unknown \ |
| 9129 | && test "$dlopen_self_static" = unknown && \ |
| 9130 | func_warning "\`LT_INIT([dlopen])' not used. Assuming no dlopen support." |
| 9131 | |
| 9132 | case $host in |
| 9133 | *-*-rhapsody* | *-*-darwin1.[012]) |
| 9134 | # On Rhapsody replace the C library is the System framework |
cristy | 98dddb5 | 2010-11-04 00:30:15 +0000 | [diff] [blame] | 9135 | compile_deplibs=`$ECHO " $compile_deplibs" | $SED 's/ -lc / System.ltframework /'` |
| 9136 | finalize_deplibs=`$ECHO " $finalize_deplibs" | $SED 's/ -lc / System.ltframework /'` |
cristy | 3ed852e | 2009-09-05 21:47:34 +0000 | [diff] [blame] | 9137 | ;; |
| 9138 | esac |
| 9139 | |
| 9140 | case $host in |
| 9141 | *-*-darwin*) |
| 9142 | # Don't allow lazy linking, it breaks C++ global constructors |
| 9143 | # But is supposedly fixed on 10.4 or later (yay!). |
| 9144 | if test "$tagname" = CXX ; then |
| 9145 | case ${MACOSX_DEPLOYMENT_TARGET-10.0} in |
| 9146 | 10.[0123]) |
cristy | da16f16 | 2011-02-19 23:52:17 +0000 | [diff] [blame] | 9147 | compile_command+=" ${wl}-bind_at_load" |
| 9148 | finalize_command+=" ${wl}-bind_at_load" |
cristy | 3ed852e | 2009-09-05 21:47:34 +0000 | [diff] [blame] | 9149 | ;; |
| 9150 | esac |
| 9151 | fi |
| 9152 | # Time to change all our "foo.ltframework" stuff back to "-framework foo" |
cristy | 98dddb5 | 2010-11-04 00:30:15 +0000 | [diff] [blame] | 9153 | compile_deplibs=`$ECHO " $compile_deplibs" | $SED 's% \([^ $]*\).ltframework% -framework \1%g'` |
| 9154 | finalize_deplibs=`$ECHO " $finalize_deplibs" | $SED 's% \([^ $]*\).ltframework% -framework \1%g'` |
cristy | 3ed852e | 2009-09-05 21:47:34 +0000 | [diff] [blame] | 9155 | ;; |
| 9156 | esac |
| 9157 | |
| 9158 | |
| 9159 | # move library search paths that coincide with paths to not yet |
| 9160 | # installed libraries to the beginning of the library search list |
| 9161 | new_libs= |
| 9162 | for path in $notinst_path; do |
| 9163 | case " $new_libs " in |
| 9164 | *" -L$path/$objdir "*) ;; |
| 9165 | *) |
| 9166 | case " $compile_deplibs " in |
| 9167 | *" -L$path/$objdir "*) |
cristy | da16f16 | 2011-02-19 23:52:17 +0000 | [diff] [blame] | 9168 | new_libs+=" -L$path/$objdir" ;; |
cristy | 3ed852e | 2009-09-05 21:47:34 +0000 | [diff] [blame] | 9169 | esac |
| 9170 | ;; |
| 9171 | esac |
| 9172 | done |
| 9173 | for deplib in $compile_deplibs; do |
| 9174 | case $deplib in |
| 9175 | -L*) |
| 9176 | case " $new_libs " in |
| 9177 | *" $deplib "*) ;; |
cristy | da16f16 | 2011-02-19 23:52:17 +0000 | [diff] [blame] | 9178 | *) new_libs+=" $deplib" ;; |
cristy | 3ed852e | 2009-09-05 21:47:34 +0000 | [diff] [blame] | 9179 | esac |
| 9180 | ;; |
cristy | da16f16 | 2011-02-19 23:52:17 +0000 | [diff] [blame] | 9181 | *) new_libs+=" $deplib" ;; |
cristy | 3ed852e | 2009-09-05 21:47:34 +0000 | [diff] [blame] | 9182 | esac |
| 9183 | done |
| 9184 | compile_deplibs="$new_libs" |
| 9185 | |
| 9186 | |
cristy | da16f16 | 2011-02-19 23:52:17 +0000 | [diff] [blame] | 9187 | compile_command+=" $compile_deplibs" |
| 9188 | finalize_command+=" $finalize_deplibs" |
cristy | 3ed852e | 2009-09-05 21:47:34 +0000 | [diff] [blame] | 9189 | |
| 9190 | if test -n "$rpath$xrpath"; then |
| 9191 | # If the user specified any rpath flags, then add them. |
| 9192 | for libdir in $rpath $xrpath; do |
| 9193 | # This is the magic to use -rpath. |
| 9194 | case "$finalize_rpath " in |
| 9195 | *" $libdir "*) ;; |
cristy | da16f16 | 2011-02-19 23:52:17 +0000 | [diff] [blame] | 9196 | *) finalize_rpath+=" $libdir" ;; |
cristy | 3ed852e | 2009-09-05 21:47:34 +0000 | [diff] [blame] | 9197 | esac |
| 9198 | done |
| 9199 | fi |
| 9200 | |
| 9201 | # Now hardcode the library paths |
| 9202 | rpath= |
| 9203 | hardcode_libdirs= |
| 9204 | for libdir in $compile_rpath $finalize_rpath; do |
| 9205 | if test -n "$hardcode_libdir_flag_spec"; then |
| 9206 | if test -n "$hardcode_libdir_separator"; then |
| 9207 | if test -z "$hardcode_libdirs"; then |
| 9208 | hardcode_libdirs="$libdir" |
| 9209 | else |
| 9210 | # Just accumulate the unique libdirs. |
| 9211 | case $hardcode_libdir_separator$hardcode_libdirs$hardcode_libdir_separator in |
| 9212 | *"$hardcode_libdir_separator$libdir$hardcode_libdir_separator"*) |
| 9213 | ;; |
| 9214 | *) |
cristy | da16f16 | 2011-02-19 23:52:17 +0000 | [diff] [blame] | 9215 | hardcode_libdirs+="$hardcode_libdir_separator$libdir" |
cristy | 3ed852e | 2009-09-05 21:47:34 +0000 | [diff] [blame] | 9216 | ;; |
| 9217 | esac |
| 9218 | fi |
| 9219 | else |
| 9220 | eval flag=\"$hardcode_libdir_flag_spec\" |
cristy | da16f16 | 2011-02-19 23:52:17 +0000 | [diff] [blame] | 9221 | rpath+=" $flag" |
cristy | 3ed852e | 2009-09-05 21:47:34 +0000 | [diff] [blame] | 9222 | fi |
| 9223 | elif test -n "$runpath_var"; then |
| 9224 | case "$perm_rpath " in |
| 9225 | *" $libdir "*) ;; |
cristy | da16f16 | 2011-02-19 23:52:17 +0000 | [diff] [blame] | 9226 | *) perm_rpath+=" $libdir" ;; |
cristy | 3ed852e | 2009-09-05 21:47:34 +0000 | [diff] [blame] | 9227 | esac |
| 9228 | fi |
| 9229 | case $host in |
| 9230 | *-*-cygwin* | *-*-mingw* | *-*-pw32* | *-*-os2* | *-cegcc*) |
| 9231 | testbindir=`${ECHO} "$libdir" | ${SED} -e 's*/lib$*/bin*'` |
| 9232 | case :$dllsearchpath: in |
| 9233 | *":$libdir:"*) ;; |
| 9234 | ::) dllsearchpath=$libdir;; |
cristy | da16f16 | 2011-02-19 23:52:17 +0000 | [diff] [blame] | 9235 | *) dllsearchpath+=":$libdir";; |
cristy | 3ed852e | 2009-09-05 21:47:34 +0000 | [diff] [blame] | 9236 | esac |
| 9237 | case :$dllsearchpath: in |
| 9238 | *":$testbindir:"*) ;; |
| 9239 | ::) dllsearchpath=$testbindir;; |
cristy | da16f16 | 2011-02-19 23:52:17 +0000 | [diff] [blame] | 9240 | *) dllsearchpath+=":$testbindir";; |
cristy | 3ed852e | 2009-09-05 21:47:34 +0000 | [diff] [blame] | 9241 | esac |
| 9242 | ;; |
| 9243 | esac |
| 9244 | done |
| 9245 | # Substitute the hardcoded libdirs into the rpath. |
| 9246 | if test -n "$hardcode_libdir_separator" && |
| 9247 | test -n "$hardcode_libdirs"; then |
| 9248 | libdir="$hardcode_libdirs" |
| 9249 | eval rpath=\" $hardcode_libdir_flag_spec\" |
| 9250 | fi |
| 9251 | compile_rpath="$rpath" |
| 9252 | |
| 9253 | rpath= |
| 9254 | hardcode_libdirs= |
| 9255 | for libdir in $finalize_rpath; do |
| 9256 | if test -n "$hardcode_libdir_flag_spec"; then |
| 9257 | if test -n "$hardcode_libdir_separator"; then |
| 9258 | if test -z "$hardcode_libdirs"; then |
| 9259 | hardcode_libdirs="$libdir" |
| 9260 | else |
| 9261 | # Just accumulate the unique libdirs. |
| 9262 | case $hardcode_libdir_separator$hardcode_libdirs$hardcode_libdir_separator in |
| 9263 | *"$hardcode_libdir_separator$libdir$hardcode_libdir_separator"*) |
| 9264 | ;; |
| 9265 | *) |
cristy | da16f16 | 2011-02-19 23:52:17 +0000 | [diff] [blame] | 9266 | hardcode_libdirs+="$hardcode_libdir_separator$libdir" |
cristy | 3ed852e | 2009-09-05 21:47:34 +0000 | [diff] [blame] | 9267 | ;; |
| 9268 | esac |
| 9269 | fi |
| 9270 | else |
| 9271 | eval flag=\"$hardcode_libdir_flag_spec\" |
cristy | da16f16 | 2011-02-19 23:52:17 +0000 | [diff] [blame] | 9272 | rpath+=" $flag" |
cristy | 3ed852e | 2009-09-05 21:47:34 +0000 | [diff] [blame] | 9273 | fi |
| 9274 | elif test -n "$runpath_var"; then |
| 9275 | case "$finalize_perm_rpath " in |
| 9276 | *" $libdir "*) ;; |
cristy | da16f16 | 2011-02-19 23:52:17 +0000 | [diff] [blame] | 9277 | *) finalize_perm_rpath+=" $libdir" ;; |
cristy | 3ed852e | 2009-09-05 21:47:34 +0000 | [diff] [blame] | 9278 | esac |
| 9279 | fi |
| 9280 | done |
| 9281 | # Substitute the hardcoded libdirs into the rpath. |
| 9282 | if test -n "$hardcode_libdir_separator" && |
| 9283 | test -n "$hardcode_libdirs"; then |
| 9284 | libdir="$hardcode_libdirs" |
| 9285 | eval rpath=\" $hardcode_libdir_flag_spec\" |
| 9286 | fi |
| 9287 | finalize_rpath="$rpath" |
| 9288 | |
| 9289 | if test -n "$libobjs" && test "$build_old_libs" = yes; then |
| 9290 | # Transform all the library objects into standard objects. |
cristy | 98dddb5 | 2010-11-04 00:30:15 +0000 | [diff] [blame] | 9291 | compile_command=`$ECHO "$compile_command" | $SP2NL | $SED "$lo2o" | $NL2SP` |
| 9292 | finalize_command=`$ECHO "$finalize_command" | $SP2NL | $SED "$lo2o" | $NL2SP` |
cristy | 3ed852e | 2009-09-05 21:47:34 +0000 | [diff] [blame] | 9293 | fi |
| 9294 | |
| 9295 | func_generate_dlsyms "$outputname" "@PROGRAM@" "no" |
| 9296 | |
| 9297 | # template prelinking step |
| 9298 | if test -n "$prelink_cmds"; then |
| 9299 | func_execute_cmds "$prelink_cmds" 'exit $?' |
| 9300 | fi |
| 9301 | |
| 9302 | wrappers_required=yes |
| 9303 | case $host in |
cristy | 98dddb5 | 2010-11-04 00:30:15 +0000 | [diff] [blame] | 9304 | *cegcc* | *mingw32ce*) |
| 9305 | # Disable wrappers for cegcc and mingw32ce hosts, we are cross compiling anyway. |
| 9306 | wrappers_required=no |
| 9307 | ;; |
cristy | 3ed852e | 2009-09-05 21:47:34 +0000 | [diff] [blame] | 9308 | *cygwin* | *mingw* ) |
| 9309 | if test "$build_libtool_libs" != yes; then |
| 9310 | wrappers_required=no |
| 9311 | fi |
| 9312 | ;; |
cristy | 3ed852e | 2009-09-05 21:47:34 +0000 | [diff] [blame] | 9313 | *) |
| 9314 | if test "$need_relink" = no || test "$build_libtool_libs" != yes; then |
| 9315 | wrappers_required=no |
| 9316 | fi |
| 9317 | ;; |
| 9318 | esac |
| 9319 | if test "$wrappers_required" = no; then |
| 9320 | # Replace the output file specification. |
cristy | 98dddb5 | 2010-11-04 00:30:15 +0000 | [diff] [blame] | 9321 | compile_command=`$ECHO "$compile_command" | $SED 's%@OUTPUT@%'"$output"'%g'` |
cristy | 3ed852e | 2009-09-05 21:47:34 +0000 | [diff] [blame] | 9322 | link_command="$compile_command$compile_rpath" |
| 9323 | |
| 9324 | # We have no uninstalled library dependencies, so finalize right now. |
| 9325 | exit_status=0 |
| 9326 | func_show_eval "$link_command" 'exit_status=$?' |
| 9327 | |
cristy | da16f16 | 2011-02-19 23:52:17 +0000 | [diff] [blame] | 9328 | if test -n "$postlink_cmds"; then |
| 9329 | func_to_tool_file "$output" |
| 9330 | postlink_cmds=`func_echo_all "$postlink_cmds" | $SED -e 's%@OUTPUT@%'"$output"'%g' -e 's%@TOOL_OUTPUT@%'"$func_to_tool_file_result"'%g'` |
| 9331 | func_execute_cmds "$postlink_cmds" 'exit $?' |
| 9332 | fi |
| 9333 | |
cristy | 3ed852e | 2009-09-05 21:47:34 +0000 | [diff] [blame] | 9334 | # Delete the generated files. |
| 9335 | if test -f "$output_objdir/${outputname}S.${objext}"; then |
| 9336 | func_show_eval '$RM "$output_objdir/${outputname}S.${objext}"' |
| 9337 | fi |
| 9338 | |
| 9339 | exit $exit_status |
| 9340 | fi |
| 9341 | |
| 9342 | if test -n "$compile_shlibpath$finalize_shlibpath"; then |
| 9343 | compile_command="$shlibpath_var=\"$compile_shlibpath$finalize_shlibpath\$$shlibpath_var\" $compile_command" |
| 9344 | fi |
| 9345 | if test -n "$finalize_shlibpath"; then |
| 9346 | finalize_command="$shlibpath_var=\"$finalize_shlibpath\$$shlibpath_var\" $finalize_command" |
| 9347 | fi |
| 9348 | |
| 9349 | compile_var= |
| 9350 | finalize_var= |
| 9351 | if test -n "$runpath_var"; then |
| 9352 | if test -n "$perm_rpath"; then |
| 9353 | # We should set the runpath_var. |
| 9354 | rpath= |
| 9355 | for dir in $perm_rpath; do |
cristy | da16f16 | 2011-02-19 23:52:17 +0000 | [diff] [blame] | 9356 | rpath+="$dir:" |
cristy | 3ed852e | 2009-09-05 21:47:34 +0000 | [diff] [blame] | 9357 | done |
| 9358 | compile_var="$runpath_var=\"$rpath\$$runpath_var\" " |
| 9359 | fi |
| 9360 | if test -n "$finalize_perm_rpath"; then |
| 9361 | # We should set the runpath_var. |
| 9362 | rpath= |
| 9363 | for dir in $finalize_perm_rpath; do |
cristy | da16f16 | 2011-02-19 23:52:17 +0000 | [diff] [blame] | 9364 | rpath+="$dir:" |
cristy | 3ed852e | 2009-09-05 21:47:34 +0000 | [diff] [blame] | 9365 | done |
| 9366 | finalize_var="$runpath_var=\"$rpath\$$runpath_var\" " |
| 9367 | fi |
| 9368 | fi |
| 9369 | |
| 9370 | if test "$no_install" = yes; then |
| 9371 | # We don't need to create a wrapper script. |
| 9372 | link_command="$compile_var$compile_command$compile_rpath" |
| 9373 | # Replace the output file specification. |
cristy | 98dddb5 | 2010-11-04 00:30:15 +0000 | [diff] [blame] | 9374 | link_command=`$ECHO "$link_command" | $SED 's%@OUTPUT@%'"$output"'%g'` |
cristy | 3ed852e | 2009-09-05 21:47:34 +0000 | [diff] [blame] | 9375 | # Delete the old output file. |
| 9376 | $opt_dry_run || $RM $output |
| 9377 | # Link the executable and exit |
| 9378 | func_show_eval "$link_command" 'exit $?' |
cristy | da16f16 | 2011-02-19 23:52:17 +0000 | [diff] [blame] | 9379 | |
| 9380 | if test -n "$postlink_cmds"; then |
| 9381 | func_to_tool_file "$output" |
| 9382 | postlink_cmds=`func_echo_all "$postlink_cmds" | $SED -e 's%@OUTPUT@%'"$output"'%g' -e 's%@TOOL_OUTPUT@%'"$func_to_tool_file_result"'%g'` |
| 9383 | func_execute_cmds "$postlink_cmds" 'exit $?' |
| 9384 | fi |
| 9385 | |
cristy | 3ed852e | 2009-09-05 21:47:34 +0000 | [diff] [blame] | 9386 | exit $EXIT_SUCCESS |
| 9387 | fi |
| 9388 | |
| 9389 | if test "$hardcode_action" = relink; then |
| 9390 | # Fast installation is not supported |
| 9391 | link_command="$compile_var$compile_command$compile_rpath" |
| 9392 | relink_command="$finalize_var$finalize_command$finalize_rpath" |
| 9393 | |
| 9394 | func_warning "this platform does not like uninstalled shared libraries" |
| 9395 | func_warning "\`$output' will be relinked during installation" |
| 9396 | else |
| 9397 | if test "$fast_install" != no; then |
| 9398 | link_command="$finalize_var$compile_command$finalize_rpath" |
| 9399 | if test "$fast_install" = yes; then |
cristy | 98dddb5 | 2010-11-04 00:30:15 +0000 | [diff] [blame] | 9400 | relink_command=`$ECHO "$compile_var$compile_command$compile_rpath" | $SED 's%@OUTPUT@%\$progdir/\$file%g'` |
cristy | 3ed852e | 2009-09-05 21:47:34 +0000 | [diff] [blame] | 9401 | else |
| 9402 | # fast_install is set to needless |
| 9403 | relink_command= |
| 9404 | fi |
| 9405 | else |
| 9406 | link_command="$compile_var$compile_command$compile_rpath" |
| 9407 | relink_command="$finalize_var$finalize_command$finalize_rpath" |
| 9408 | fi |
| 9409 | fi |
| 9410 | |
| 9411 | # Replace the output file specification. |
cristy | 98dddb5 | 2010-11-04 00:30:15 +0000 | [diff] [blame] | 9412 | link_command=`$ECHO "$link_command" | $SED 's%@OUTPUT@%'"$output_objdir/$outputname"'%g'` |
cristy | 3ed852e | 2009-09-05 21:47:34 +0000 | [diff] [blame] | 9413 | |
| 9414 | # Delete the old output files. |
| 9415 | $opt_dry_run || $RM $output $output_objdir/$outputname $output_objdir/lt-$outputname |
| 9416 | |
| 9417 | func_show_eval "$link_command" 'exit $?' |
| 9418 | |
cristy | da16f16 | 2011-02-19 23:52:17 +0000 | [diff] [blame] | 9419 | if test -n "$postlink_cmds"; then |
| 9420 | func_to_tool_file "$output_objdir/$outputname" |
| 9421 | postlink_cmds=`func_echo_all "$postlink_cmds" | $SED -e 's%@OUTPUT@%'"$output_objdir/$outputname"'%g' -e 's%@TOOL_OUTPUT@%'"$func_to_tool_file_result"'%g'` |
| 9422 | func_execute_cmds "$postlink_cmds" 'exit $?' |
| 9423 | fi |
| 9424 | |
cristy | 3ed852e | 2009-09-05 21:47:34 +0000 | [diff] [blame] | 9425 | # Now create the wrapper script. |
| 9426 | func_verbose "creating $output" |
| 9427 | |
| 9428 | # Quote the relink command for shipping. |
| 9429 | if test -n "$relink_command"; then |
| 9430 | # Preserve any variables that may affect compiler behavior |
| 9431 | for var in $variables_saved_for_relink; do |
| 9432 | if eval test -z \"\${$var+set}\"; then |
| 9433 | relink_command="{ test -z \"\${$var+set}\" || $lt_unset $var || { $var=; export $var; }; }; $relink_command" |
| 9434 | elif eval var_value=\$$var; test -z "$var_value"; then |
| 9435 | relink_command="$var=; export $var; $relink_command" |
| 9436 | else |
| 9437 | func_quote_for_eval "$var_value" |
| 9438 | relink_command="$var=$func_quote_for_eval_result; export $var; $relink_command" |
| 9439 | fi |
| 9440 | done |
| 9441 | relink_command="(cd `pwd`; $relink_command)" |
cristy | 98dddb5 | 2010-11-04 00:30:15 +0000 | [diff] [blame] | 9442 | relink_command=`$ECHO "$relink_command" | $SED "$sed_quote_subst"` |
cristy | 3ed852e | 2009-09-05 21:47:34 +0000 | [diff] [blame] | 9443 | fi |
| 9444 | |
| 9445 | # Only actually do things if not in dry run mode. |
| 9446 | $opt_dry_run || { |
| 9447 | # win32 will think the script is a binary if it has |
| 9448 | # a .exe suffix, so we strip it off here. |
| 9449 | case $output in |
| 9450 | *.exe) func_stripname '' '.exe' "$output" |
| 9451 | output=$func_stripname_result ;; |
| 9452 | esac |
| 9453 | # test for cygwin because mv fails w/o .exe extensions |
| 9454 | case $host in |
| 9455 | *cygwin*) |
| 9456 | exeext=.exe |
| 9457 | func_stripname '' '.exe' "$outputname" |
| 9458 | outputname=$func_stripname_result ;; |
| 9459 | *) exeext= ;; |
| 9460 | esac |
| 9461 | case $host in |
| 9462 | *cygwin* | *mingw* ) |
| 9463 | func_dirname_and_basename "$output" "" "." |
| 9464 | output_name=$func_basename_result |
| 9465 | output_path=$func_dirname_result |
| 9466 | cwrappersource="$output_path/$objdir/lt-$output_name.c" |
| 9467 | cwrapper="$output_path/$output_name.exe" |
| 9468 | $RM $cwrappersource $cwrapper |
| 9469 | trap "$RM $cwrappersource $cwrapper; exit $EXIT_FAILURE" 1 2 15 |
| 9470 | |
| 9471 | func_emit_cwrapperexe_src > $cwrappersource |
| 9472 | |
| 9473 | # The wrapper executable is built using the $host compiler, |
| 9474 | # because it contains $host paths and files. If cross- |
| 9475 | # compiling, it, like the target executable, must be |
| 9476 | # executed on the $host or under an emulation environment. |
| 9477 | $opt_dry_run || { |
| 9478 | $LTCC $LTCFLAGS -o $cwrapper $cwrappersource |
| 9479 | $STRIP $cwrapper |
| 9480 | } |
| 9481 | |
| 9482 | # Now, create the wrapper script for func_source use: |
| 9483 | func_ltwrapper_scriptname $cwrapper |
| 9484 | $RM $func_ltwrapper_scriptname_result |
| 9485 | trap "$RM $func_ltwrapper_scriptname_result; exit $EXIT_FAILURE" 1 2 15 |
| 9486 | $opt_dry_run || { |
| 9487 | # note: this script will not be executed, so do not chmod. |
| 9488 | if test "x$build" = "x$host" ; then |
| 9489 | $cwrapper --lt-dump-script > $func_ltwrapper_scriptname_result |
| 9490 | else |
| 9491 | func_emit_wrapper no > $func_ltwrapper_scriptname_result |
| 9492 | fi |
| 9493 | } |
| 9494 | ;; |
| 9495 | * ) |
| 9496 | $RM $output |
| 9497 | trap "$RM $output; exit $EXIT_FAILURE" 1 2 15 |
| 9498 | |
| 9499 | func_emit_wrapper no > $output |
| 9500 | chmod +x $output |
| 9501 | ;; |
| 9502 | esac |
| 9503 | } |
| 9504 | exit $EXIT_SUCCESS |
| 9505 | ;; |
| 9506 | esac |
| 9507 | |
| 9508 | # See if we need to build an old-fashioned archive. |
| 9509 | for oldlib in $oldlibs; do |
| 9510 | |
| 9511 | if test "$build_libtool_libs" = convenience; then |
| 9512 | oldobjs="$libobjs_save $symfileobj" |
| 9513 | addlibs="$convenience" |
| 9514 | build_libtool_libs=no |
| 9515 | else |
| 9516 | if test "$build_libtool_libs" = module; then |
| 9517 | oldobjs="$libobjs_save" |
| 9518 | build_libtool_libs=no |
| 9519 | else |
| 9520 | oldobjs="$old_deplibs $non_pic_objects" |
| 9521 | if test "$preload" = yes && test -f "$symfileobj"; then |
cristy | da16f16 | 2011-02-19 23:52:17 +0000 | [diff] [blame] | 9522 | oldobjs+=" $symfileobj" |
cristy | 3ed852e | 2009-09-05 21:47:34 +0000 | [diff] [blame] | 9523 | fi |
| 9524 | fi |
| 9525 | addlibs="$old_convenience" |
| 9526 | fi |
| 9527 | |
| 9528 | if test -n "$addlibs"; then |
| 9529 | gentop="$output_objdir/${outputname}x" |
cristy | da16f16 | 2011-02-19 23:52:17 +0000 | [diff] [blame] | 9530 | generated+=" $gentop" |
cristy | 3ed852e | 2009-09-05 21:47:34 +0000 | [diff] [blame] | 9531 | |
| 9532 | func_extract_archives $gentop $addlibs |
cristy | da16f16 | 2011-02-19 23:52:17 +0000 | [diff] [blame] | 9533 | oldobjs+=" $func_extract_archives_result" |
cristy | 3ed852e | 2009-09-05 21:47:34 +0000 | [diff] [blame] | 9534 | fi |
| 9535 | |
| 9536 | # Do each command in the archive commands. |
| 9537 | if test -n "$old_archive_from_new_cmds" && test "$build_libtool_libs" = yes; then |
| 9538 | cmds=$old_archive_from_new_cmds |
| 9539 | else |
| 9540 | |
| 9541 | # Add any objects from preloaded convenience libraries |
| 9542 | if test -n "$dlprefiles"; then |
| 9543 | gentop="$output_objdir/${outputname}x" |
cristy | da16f16 | 2011-02-19 23:52:17 +0000 | [diff] [blame] | 9544 | generated+=" $gentop" |
cristy | 3ed852e | 2009-09-05 21:47:34 +0000 | [diff] [blame] | 9545 | |
| 9546 | func_extract_archives $gentop $dlprefiles |
cristy | da16f16 | 2011-02-19 23:52:17 +0000 | [diff] [blame] | 9547 | oldobjs+=" $func_extract_archives_result" |
cristy | 3ed852e | 2009-09-05 21:47:34 +0000 | [diff] [blame] | 9548 | fi |
| 9549 | |
| 9550 | # POSIX demands no paths to be encoded in archives. We have |
| 9551 | # to avoid creating archives with duplicate basenames if we |
| 9552 | # might have to extract them afterwards, e.g., when creating a |
| 9553 | # static archive out of a convenience library, or when linking |
| 9554 | # the entirety of a libtool archive into another (currently |
| 9555 | # not supported by libtool). |
| 9556 | if (for obj in $oldobjs |
| 9557 | do |
| 9558 | func_basename "$obj" |
| 9559 | $ECHO "$func_basename_result" |
| 9560 | done | sort | sort -uc >/dev/null 2>&1); then |
| 9561 | : |
| 9562 | else |
cristy | 98dddb5 | 2010-11-04 00:30:15 +0000 | [diff] [blame] | 9563 | echo "copying selected object files to avoid basename conflicts..." |
cristy | 3ed852e | 2009-09-05 21:47:34 +0000 | [diff] [blame] | 9564 | gentop="$output_objdir/${outputname}x" |
cristy | da16f16 | 2011-02-19 23:52:17 +0000 | [diff] [blame] | 9565 | generated+=" $gentop" |
cristy | 3ed852e | 2009-09-05 21:47:34 +0000 | [diff] [blame] | 9566 | func_mkdir_p "$gentop" |
| 9567 | save_oldobjs=$oldobjs |
| 9568 | oldobjs= |
| 9569 | counter=1 |
| 9570 | for obj in $save_oldobjs |
| 9571 | do |
| 9572 | func_basename "$obj" |
| 9573 | objbase="$func_basename_result" |
| 9574 | case " $oldobjs " in |
| 9575 | " ") oldobjs=$obj ;; |
| 9576 | *[\ /]"$objbase "*) |
| 9577 | while :; do |
| 9578 | # Make sure we don't pick an alternate name that also |
| 9579 | # overlaps. |
| 9580 | newobj=lt$counter-$objbase |
| 9581 | func_arith $counter + 1 |
| 9582 | counter=$func_arith_result |
| 9583 | case " $oldobjs " in |
| 9584 | *[\ /]"$newobj "*) ;; |
| 9585 | *) if test ! -f "$gentop/$newobj"; then break; fi ;; |
| 9586 | esac |
| 9587 | done |
| 9588 | func_show_eval "ln $obj $gentop/$newobj || cp $obj $gentop/$newobj" |
cristy | da16f16 | 2011-02-19 23:52:17 +0000 | [diff] [blame] | 9589 | oldobjs+=" $gentop/$newobj" |
cristy | 3ed852e | 2009-09-05 21:47:34 +0000 | [diff] [blame] | 9590 | ;; |
cristy | da16f16 | 2011-02-19 23:52:17 +0000 | [diff] [blame] | 9591 | *) oldobjs+=" $obj" ;; |
cristy | 3ed852e | 2009-09-05 21:47:34 +0000 | [diff] [blame] | 9592 | esac |
| 9593 | done |
| 9594 | fi |
| 9595 | eval cmds=\"$old_archive_cmds\" |
| 9596 | |
| 9597 | func_len " $cmds" |
| 9598 | len=$func_len_result |
| 9599 | if test "$len" -lt "$max_cmd_len" || test "$max_cmd_len" -le -1; then |
| 9600 | cmds=$old_archive_cmds |
cristy | da16f16 | 2011-02-19 23:52:17 +0000 | [diff] [blame] | 9601 | elif test -n "$archiver_list_spec"; then |
| 9602 | func_verbose "using command file archive linking..." |
| 9603 | for obj in $oldobjs |
| 9604 | do |
| 9605 | func_to_tool_file "$obj" |
| 9606 | $ECHO "$func_to_tool_file_result" |
| 9607 | done > $output_objdir/$libname.libcmd |
| 9608 | func_to_tool_file "$output_objdir/$libname.libcmd" |
| 9609 | oldobjs=" $archiver_list_spec$func_to_tool_file_result" |
| 9610 | cmds=$old_archive_cmds |
cristy | 3ed852e | 2009-09-05 21:47:34 +0000 | [diff] [blame] | 9611 | else |
| 9612 | # the command line is too long to link in one step, link in parts |
| 9613 | func_verbose "using piecewise archive linking..." |
| 9614 | save_RANLIB=$RANLIB |
| 9615 | RANLIB=: |
| 9616 | objlist= |
| 9617 | concat_cmds= |
| 9618 | save_oldobjs=$oldobjs |
| 9619 | oldobjs= |
| 9620 | # Is there a better way of finding the last object in the list? |
| 9621 | for obj in $save_oldobjs |
| 9622 | do |
| 9623 | last_oldobj=$obj |
| 9624 | done |
| 9625 | eval test_cmds=\"$old_archive_cmds\" |
| 9626 | func_len " $test_cmds" |
| 9627 | len0=$func_len_result |
| 9628 | len=$len0 |
| 9629 | for obj in $save_oldobjs |
| 9630 | do |
| 9631 | func_len " $obj" |
| 9632 | func_arith $len + $func_len_result |
| 9633 | len=$func_arith_result |
cristy | da16f16 | 2011-02-19 23:52:17 +0000 | [diff] [blame] | 9634 | objlist+=" $obj" |
cristy | 3ed852e | 2009-09-05 21:47:34 +0000 | [diff] [blame] | 9635 | if test "$len" -lt "$max_cmd_len"; then |
| 9636 | : |
| 9637 | else |
| 9638 | # the above command should be used before it gets too long |
| 9639 | oldobjs=$objlist |
| 9640 | if test "$obj" = "$last_oldobj" ; then |
| 9641 | RANLIB=$save_RANLIB |
| 9642 | fi |
| 9643 | test -z "$concat_cmds" || concat_cmds=$concat_cmds~ |
| 9644 | eval concat_cmds=\"\${concat_cmds}$old_archive_cmds\" |
| 9645 | objlist= |
| 9646 | len=$len0 |
| 9647 | fi |
| 9648 | done |
| 9649 | RANLIB=$save_RANLIB |
| 9650 | oldobjs=$objlist |
| 9651 | if test "X$oldobjs" = "X" ; then |
| 9652 | eval cmds=\"\$concat_cmds\" |
| 9653 | else |
| 9654 | eval cmds=\"\$concat_cmds~\$old_archive_cmds\" |
| 9655 | fi |
| 9656 | fi |
| 9657 | fi |
| 9658 | func_execute_cmds "$cmds" 'exit $?' |
| 9659 | done |
| 9660 | |
| 9661 | test -n "$generated" && \ |
| 9662 | func_show_eval "${RM}r$generated" |
| 9663 | |
| 9664 | # Now create the libtool archive. |
| 9665 | case $output in |
| 9666 | *.la) |
| 9667 | old_library= |
| 9668 | test "$build_old_libs" = yes && old_library="$libname.$libext" |
| 9669 | func_verbose "creating $output" |
| 9670 | |
| 9671 | # Preserve any variables that may affect compiler behavior |
| 9672 | for var in $variables_saved_for_relink; do |
| 9673 | if eval test -z \"\${$var+set}\"; then |
| 9674 | relink_command="{ test -z \"\${$var+set}\" || $lt_unset $var || { $var=; export $var; }; }; $relink_command" |
| 9675 | elif eval var_value=\$$var; test -z "$var_value"; then |
| 9676 | relink_command="$var=; export $var; $relink_command" |
| 9677 | else |
| 9678 | func_quote_for_eval "$var_value" |
| 9679 | relink_command="$var=$func_quote_for_eval_result; export $var; $relink_command" |
| 9680 | fi |
| 9681 | done |
| 9682 | # Quote the link command for shipping. |
| 9683 | relink_command="(cd `pwd`; $SHELL $progpath $preserve_args --mode=relink $libtool_args @inst_prefix_dir@)" |
cristy | 98dddb5 | 2010-11-04 00:30:15 +0000 | [diff] [blame] | 9684 | relink_command=`$ECHO "$relink_command" | $SED "$sed_quote_subst"` |
cristy | 3ed852e | 2009-09-05 21:47:34 +0000 | [diff] [blame] | 9685 | if test "$hardcode_automatic" = yes ; then |
| 9686 | relink_command= |
| 9687 | fi |
| 9688 | |
| 9689 | # Only create the output if not a dry run. |
| 9690 | $opt_dry_run || { |
| 9691 | for installed in no yes; do |
| 9692 | if test "$installed" = yes; then |
| 9693 | if test -z "$install_libdir"; then |
| 9694 | break |
| 9695 | fi |
| 9696 | output="$output_objdir/$outputname"i |
| 9697 | # Replace all uninstalled libtool libraries with the installed ones |
| 9698 | newdependency_libs= |
| 9699 | for deplib in $dependency_libs; do |
| 9700 | case $deplib in |
| 9701 | *.la) |
| 9702 | func_basename "$deplib" |
| 9703 | name="$func_basename_result" |
| 9704 | eval libdir=`${SED} -n -e 's/^libdir=\(.*\)$/\1/p' $deplib` |
| 9705 | test -z "$libdir" && \ |
| 9706 | func_fatal_error "\`$deplib' is not a valid libtool archive" |
cristy | da16f16 | 2011-02-19 23:52:17 +0000 | [diff] [blame] | 9707 | newdependency_libs+=" ${lt_sysroot:+=}$libdir/$name" |
cristy | 3ed852e | 2009-09-05 21:47:34 +0000 | [diff] [blame] | 9708 | ;; |
cristy | da16f16 | 2011-02-19 23:52:17 +0000 | [diff] [blame] | 9709 | -L*) |
| 9710 | func_stripname -L '' "$deplib" |
| 9711 | func_replace_sysroot "$func_stripname_result" |
| 9712 | newdependency_libs+=" -L$func_replace_sysroot_result" |
| 9713 | ;; |
| 9714 | -R*) |
| 9715 | func_stripname -R '' "$deplib" |
| 9716 | func_replace_sysroot "$func_stripname_result" |
| 9717 | newdependency_libs+=" -R$func_replace_sysroot_result" |
| 9718 | ;; |
| 9719 | *) newdependency_libs+=" $deplib" ;; |
cristy | 3ed852e | 2009-09-05 21:47:34 +0000 | [diff] [blame] | 9720 | esac |
| 9721 | done |
| 9722 | dependency_libs="$newdependency_libs" |
| 9723 | newdlfiles= |
| 9724 | |
| 9725 | for lib in $dlfiles; do |
| 9726 | case $lib in |
| 9727 | *.la) |
| 9728 | func_basename "$lib" |
| 9729 | name="$func_basename_result" |
| 9730 | eval libdir=`${SED} -n -e 's/^libdir=\(.*\)$/\1/p' $lib` |
| 9731 | test -z "$libdir" && \ |
| 9732 | func_fatal_error "\`$lib' is not a valid libtool archive" |
cristy | da16f16 | 2011-02-19 23:52:17 +0000 | [diff] [blame] | 9733 | newdlfiles+=" ${lt_sysroot:+=}$libdir/$name" |
cristy | 3ed852e | 2009-09-05 21:47:34 +0000 | [diff] [blame] | 9734 | ;; |
cristy | da16f16 | 2011-02-19 23:52:17 +0000 | [diff] [blame] | 9735 | *) newdlfiles+=" $lib" ;; |
cristy | 3ed852e | 2009-09-05 21:47:34 +0000 | [diff] [blame] | 9736 | esac |
| 9737 | done |
| 9738 | dlfiles="$newdlfiles" |
| 9739 | newdlprefiles= |
| 9740 | for lib in $dlprefiles; do |
| 9741 | case $lib in |
| 9742 | *.la) |
| 9743 | # Only pass preopened files to the pseudo-archive (for |
| 9744 | # eventual linking with the app. that links it) if we |
| 9745 | # didn't already link the preopened objects directly into |
| 9746 | # the library: |
| 9747 | func_basename "$lib" |
| 9748 | name="$func_basename_result" |
| 9749 | eval libdir=`${SED} -n -e 's/^libdir=\(.*\)$/\1/p' $lib` |
| 9750 | test -z "$libdir" && \ |
| 9751 | func_fatal_error "\`$lib' is not a valid libtool archive" |
cristy | da16f16 | 2011-02-19 23:52:17 +0000 | [diff] [blame] | 9752 | newdlprefiles+=" ${lt_sysroot:+=}$libdir/$name" |
cristy | 3ed852e | 2009-09-05 21:47:34 +0000 | [diff] [blame] | 9753 | ;; |
| 9754 | esac |
| 9755 | done |
| 9756 | dlprefiles="$newdlprefiles" |
| 9757 | else |
| 9758 | newdlfiles= |
| 9759 | for lib in $dlfiles; do |
| 9760 | case $lib in |
| 9761 | [\\/]* | [A-Za-z]:[\\/]*) abs="$lib" ;; |
| 9762 | *) abs=`pwd`"/$lib" ;; |
| 9763 | esac |
cristy | da16f16 | 2011-02-19 23:52:17 +0000 | [diff] [blame] | 9764 | newdlfiles+=" $abs" |
cristy | 3ed852e | 2009-09-05 21:47:34 +0000 | [diff] [blame] | 9765 | done |
| 9766 | dlfiles="$newdlfiles" |
| 9767 | newdlprefiles= |
| 9768 | for lib in $dlprefiles; do |
| 9769 | case $lib in |
| 9770 | [\\/]* | [A-Za-z]:[\\/]*) abs="$lib" ;; |
| 9771 | *) abs=`pwd`"/$lib" ;; |
| 9772 | esac |
cristy | da16f16 | 2011-02-19 23:52:17 +0000 | [diff] [blame] | 9773 | newdlprefiles+=" $abs" |
cristy | 3ed852e | 2009-09-05 21:47:34 +0000 | [diff] [blame] | 9774 | done |
| 9775 | dlprefiles="$newdlprefiles" |
| 9776 | fi |
| 9777 | $RM $output |
| 9778 | # place dlname in correct position for cygwin |
cristy | 98dddb5 | 2010-11-04 00:30:15 +0000 | [diff] [blame] | 9779 | # In fact, it would be nice if we could use this code for all target |
| 9780 | # systems that can't hard-code library paths into their executables |
| 9781 | # and that have no shared library path variable independent of PATH, |
| 9782 | # but it turns out we can't easily determine that from inspecting |
| 9783 | # libtool variables, so we have to hard-code the OSs to which it |
| 9784 | # applies here; at the moment, that means platforms that use the PE |
| 9785 | # object format with DLL files. See the long comment at the top of |
| 9786 | # tests/bindir.at for full details. |
cristy | 3ed852e | 2009-09-05 21:47:34 +0000 | [diff] [blame] | 9787 | tdlname=$dlname |
| 9788 | case $host,$output,$installed,$module,$dlname in |
cristy | 98dddb5 | 2010-11-04 00:30:15 +0000 | [diff] [blame] | 9789 | *cygwin*,*lai,yes,no,*.dll | *mingw*,*lai,yes,no,*.dll | *cegcc*,*lai,yes,no,*.dll) |
| 9790 | # If a -bindir argument was supplied, place the dll there. |
| 9791 | if test "x$bindir" != x ; |
| 9792 | then |
| 9793 | func_relative_path "$install_libdir" "$bindir" |
| 9794 | tdlname=$func_relative_path_result$dlname |
| 9795 | else |
| 9796 | # Otherwise fall back on heuristic. |
| 9797 | tdlname=../bin/$dlname |
| 9798 | fi |
| 9799 | ;; |
cristy | 3ed852e | 2009-09-05 21:47:34 +0000 | [diff] [blame] | 9800 | esac |
| 9801 | $ECHO > $output "\ |
| 9802 | # $outputname - a libtool library file |
| 9803 | # Generated by $PROGRAM (GNU $PACKAGE$TIMESTAMP) $VERSION |
| 9804 | # |
| 9805 | # Please DO NOT delete this file! |
| 9806 | # It is necessary for linking the library. |
| 9807 | |
| 9808 | # The name that we can dlopen(3). |
| 9809 | dlname='$tdlname' |
| 9810 | |
| 9811 | # Names of this library. |
| 9812 | library_names='$library_names' |
| 9813 | |
| 9814 | # The name of the static archive. |
| 9815 | old_library='$old_library' |
| 9816 | |
| 9817 | # Linker flags that can not go in dependency_libs. |
| 9818 | inherited_linker_flags='$new_inherited_linker_flags' |
| 9819 | |
| 9820 | # Libraries that this one depends upon. |
| 9821 | dependency_libs='$dependency_libs' |
| 9822 | |
| 9823 | # Names of additional weak libraries provided by this library |
| 9824 | weak_library_names='$weak_libs' |
| 9825 | |
| 9826 | # Version information for $libname. |
| 9827 | current=$current |
| 9828 | age=$age |
| 9829 | revision=$revision |
| 9830 | |
| 9831 | # Is this an already installed library? |
| 9832 | installed=$installed |
| 9833 | |
| 9834 | # Should we warn about portability when linking against -modules? |
| 9835 | shouldnotlink=$module |
| 9836 | |
| 9837 | # Files to dlopen/dlpreopen |
| 9838 | dlopen='$dlfiles' |
| 9839 | dlpreopen='$dlprefiles' |
| 9840 | |
| 9841 | # Directory that this library needs to be installed in: |
| 9842 | libdir='$install_libdir'" |
| 9843 | if test "$installed" = no && test "$need_relink" = yes; then |
| 9844 | $ECHO >> $output "\ |
| 9845 | relink_command=\"$relink_command\"" |
| 9846 | fi |
| 9847 | done |
| 9848 | } |
| 9849 | |
| 9850 | # Do a symbolic link so that the libtool archive can be found in |
| 9851 | # LD_LIBRARY_PATH before the program is installed. |
| 9852 | func_show_eval '( cd "$output_objdir" && $RM "$outputname" && $LN_S "../$outputname" "$outputname" )' 'exit $?' |
| 9853 | ;; |
| 9854 | esac |
| 9855 | exit $EXIT_SUCCESS |
| 9856 | } |
| 9857 | |
cristy | da16f16 | 2011-02-19 23:52:17 +0000 | [diff] [blame] | 9858 | { test "$opt_mode" = link || test "$opt_mode" = relink; } && |
cristy | 3ed852e | 2009-09-05 21:47:34 +0000 | [diff] [blame] | 9859 | func_mode_link ${1+"$@"} |
| 9860 | |
| 9861 | |
| 9862 | # func_mode_uninstall arg... |
| 9863 | func_mode_uninstall () |
| 9864 | { |
| 9865 | $opt_debug |
| 9866 | RM="$nonopt" |
| 9867 | files= |
| 9868 | rmforce= |
| 9869 | exit_status=0 |
| 9870 | |
| 9871 | # This variable tells wrapper scripts just to set variables rather |
| 9872 | # than running their programs. |
| 9873 | libtool_install_magic="$magic" |
| 9874 | |
| 9875 | for arg |
| 9876 | do |
| 9877 | case $arg in |
cristy | da16f16 | 2011-02-19 23:52:17 +0000 | [diff] [blame] | 9878 | -f) RM+=" $arg"; rmforce=yes ;; |
| 9879 | -*) RM+=" $arg" ;; |
| 9880 | *) files+=" $arg" ;; |
cristy | 3ed852e | 2009-09-05 21:47:34 +0000 | [diff] [blame] | 9881 | esac |
| 9882 | done |
| 9883 | |
| 9884 | test -z "$RM" && \ |
| 9885 | func_fatal_help "you must specify an RM program" |
| 9886 | |
| 9887 | rmdirs= |
| 9888 | |
cristy | 3ed852e | 2009-09-05 21:47:34 +0000 | [diff] [blame] | 9889 | for file in $files; do |
| 9890 | func_dirname "$file" "" "." |
| 9891 | dir="$func_dirname_result" |
| 9892 | if test "X$dir" = X.; then |
cristy | da16f16 | 2011-02-19 23:52:17 +0000 | [diff] [blame] | 9893 | odir="$objdir" |
cristy | 3ed852e | 2009-09-05 21:47:34 +0000 | [diff] [blame] | 9894 | else |
cristy | da16f16 | 2011-02-19 23:52:17 +0000 | [diff] [blame] | 9895 | odir="$dir/$objdir" |
cristy | 3ed852e | 2009-09-05 21:47:34 +0000 | [diff] [blame] | 9896 | fi |
| 9897 | func_basename "$file" |
| 9898 | name="$func_basename_result" |
cristy | da16f16 | 2011-02-19 23:52:17 +0000 | [diff] [blame] | 9899 | test "$opt_mode" = uninstall && odir="$dir" |
cristy | 3ed852e | 2009-09-05 21:47:34 +0000 | [diff] [blame] | 9900 | |
cristy | da16f16 | 2011-02-19 23:52:17 +0000 | [diff] [blame] | 9901 | # Remember odir for removal later, being careful to avoid duplicates |
| 9902 | if test "$opt_mode" = clean; then |
cristy | 3ed852e | 2009-09-05 21:47:34 +0000 | [diff] [blame] | 9903 | case " $rmdirs " in |
cristy | da16f16 | 2011-02-19 23:52:17 +0000 | [diff] [blame] | 9904 | *" $odir "*) ;; |
| 9905 | *) rmdirs+=" $odir" ;; |
cristy | 3ed852e | 2009-09-05 21:47:34 +0000 | [diff] [blame] | 9906 | esac |
| 9907 | fi |
| 9908 | |
| 9909 | # Don't error if the file doesn't exist and rm -f was used. |
| 9910 | if { test -L "$file"; } >/dev/null 2>&1 || |
| 9911 | { test -h "$file"; } >/dev/null 2>&1 || |
| 9912 | test -f "$file"; then |
| 9913 | : |
| 9914 | elif test -d "$file"; then |
| 9915 | exit_status=1 |
| 9916 | continue |
| 9917 | elif test "$rmforce" = yes; then |
| 9918 | continue |
| 9919 | fi |
| 9920 | |
| 9921 | rmfiles="$file" |
| 9922 | |
| 9923 | case $name in |
| 9924 | *.la) |
| 9925 | # Possibly a libtool archive, so verify it. |
| 9926 | if func_lalib_p "$file"; then |
| 9927 | func_source $dir/$name |
| 9928 | |
| 9929 | # Delete the libtool libraries and symlinks. |
| 9930 | for n in $library_names; do |
cristy | da16f16 | 2011-02-19 23:52:17 +0000 | [diff] [blame] | 9931 | rmfiles+=" $odir/$n" |
cristy | 3ed852e | 2009-09-05 21:47:34 +0000 | [diff] [blame] | 9932 | done |
cristy | da16f16 | 2011-02-19 23:52:17 +0000 | [diff] [blame] | 9933 | test -n "$old_library" && rmfiles+=" $odir/$old_library" |
cristy | 3ed852e | 2009-09-05 21:47:34 +0000 | [diff] [blame] | 9934 | |
cristy | da16f16 | 2011-02-19 23:52:17 +0000 | [diff] [blame] | 9935 | case "$opt_mode" in |
cristy | 3ed852e | 2009-09-05 21:47:34 +0000 | [diff] [blame] | 9936 | clean) |
cristy | da16f16 | 2011-02-19 23:52:17 +0000 | [diff] [blame] | 9937 | case " $library_names " in |
cristy | 3ed852e | 2009-09-05 21:47:34 +0000 | [diff] [blame] | 9938 | *" $dlname "*) ;; |
cristy | da16f16 | 2011-02-19 23:52:17 +0000 | [diff] [blame] | 9939 | *) test -n "$dlname" && rmfiles+=" $odir/$dlname" ;; |
cristy | 3ed852e | 2009-09-05 21:47:34 +0000 | [diff] [blame] | 9940 | esac |
cristy | da16f16 | 2011-02-19 23:52:17 +0000 | [diff] [blame] | 9941 | test -n "$libdir" && rmfiles+=" $odir/$name $odir/${name}i" |
cristy | 3ed852e | 2009-09-05 21:47:34 +0000 | [diff] [blame] | 9942 | ;; |
| 9943 | uninstall) |
| 9944 | if test -n "$library_names"; then |
| 9945 | # Do each command in the postuninstall commands. |
| 9946 | func_execute_cmds "$postuninstall_cmds" 'test "$rmforce" = yes || exit_status=1' |
| 9947 | fi |
| 9948 | |
| 9949 | if test -n "$old_library"; then |
| 9950 | # Do each command in the old_postuninstall commands. |
| 9951 | func_execute_cmds "$old_postuninstall_cmds" 'test "$rmforce" = yes || exit_status=1' |
| 9952 | fi |
| 9953 | # FIXME: should reinstall the best remaining shared library. |
| 9954 | ;; |
| 9955 | esac |
| 9956 | fi |
| 9957 | ;; |
| 9958 | |
| 9959 | *.lo) |
| 9960 | # Possibly a libtool object, so verify it. |
| 9961 | if func_lalib_p "$file"; then |
| 9962 | |
| 9963 | # Read the .lo file |
| 9964 | func_source $dir/$name |
| 9965 | |
| 9966 | # Add PIC object to the list of files to remove. |
| 9967 | if test -n "$pic_object" && |
| 9968 | test "$pic_object" != none; then |
cristy | da16f16 | 2011-02-19 23:52:17 +0000 | [diff] [blame] | 9969 | rmfiles+=" $dir/$pic_object" |
cristy | 3ed852e | 2009-09-05 21:47:34 +0000 | [diff] [blame] | 9970 | fi |
| 9971 | |
| 9972 | # Add non-PIC object to the list of files to remove. |
| 9973 | if test -n "$non_pic_object" && |
| 9974 | test "$non_pic_object" != none; then |
cristy | da16f16 | 2011-02-19 23:52:17 +0000 | [diff] [blame] | 9975 | rmfiles+=" $dir/$non_pic_object" |
cristy | 3ed852e | 2009-09-05 21:47:34 +0000 | [diff] [blame] | 9976 | fi |
| 9977 | fi |
| 9978 | ;; |
| 9979 | |
| 9980 | *) |
cristy | da16f16 | 2011-02-19 23:52:17 +0000 | [diff] [blame] | 9981 | if test "$opt_mode" = clean ; then |
cristy | 3ed852e | 2009-09-05 21:47:34 +0000 | [diff] [blame] | 9982 | noexename=$name |
| 9983 | case $file in |
| 9984 | *.exe) |
| 9985 | func_stripname '' '.exe' "$file" |
| 9986 | file=$func_stripname_result |
| 9987 | func_stripname '' '.exe' "$name" |
| 9988 | noexename=$func_stripname_result |
| 9989 | # $file with .exe has already been added to rmfiles, |
| 9990 | # add $file without .exe |
cristy | da16f16 | 2011-02-19 23:52:17 +0000 | [diff] [blame] | 9991 | rmfiles+=" $file" |
cristy | 3ed852e | 2009-09-05 21:47:34 +0000 | [diff] [blame] | 9992 | ;; |
| 9993 | esac |
| 9994 | # Do a test to see if this is a libtool program. |
| 9995 | if func_ltwrapper_p "$file"; then |
| 9996 | if func_ltwrapper_executable_p "$file"; then |
| 9997 | func_ltwrapper_scriptname "$file" |
| 9998 | relink_command= |
| 9999 | func_source $func_ltwrapper_scriptname_result |
cristy | da16f16 | 2011-02-19 23:52:17 +0000 | [diff] [blame] | 10000 | rmfiles+=" $func_ltwrapper_scriptname_result" |
cristy | 3ed852e | 2009-09-05 21:47:34 +0000 | [diff] [blame] | 10001 | else |
| 10002 | relink_command= |
| 10003 | func_source $dir/$noexename |
| 10004 | fi |
| 10005 | |
| 10006 | # note $name still contains .exe if it was in $file originally |
| 10007 | # as does the version of $file that was added into $rmfiles |
cristy | da16f16 | 2011-02-19 23:52:17 +0000 | [diff] [blame] | 10008 | rmfiles+=" $odir/$name $odir/${name}S.${objext}" |
cristy | 3ed852e | 2009-09-05 21:47:34 +0000 | [diff] [blame] | 10009 | if test "$fast_install" = yes && test -n "$relink_command"; then |
cristy | da16f16 | 2011-02-19 23:52:17 +0000 | [diff] [blame] | 10010 | rmfiles+=" $odir/lt-$name" |
cristy | 3ed852e | 2009-09-05 21:47:34 +0000 | [diff] [blame] | 10011 | fi |
| 10012 | if test "X$noexename" != "X$name" ; then |
cristy | da16f16 | 2011-02-19 23:52:17 +0000 | [diff] [blame] | 10013 | rmfiles+=" $odir/lt-${noexename}.c" |
cristy | 3ed852e | 2009-09-05 21:47:34 +0000 | [diff] [blame] | 10014 | fi |
| 10015 | fi |
| 10016 | fi |
| 10017 | ;; |
| 10018 | esac |
| 10019 | func_show_eval "$RM $rmfiles" 'exit_status=1' |
| 10020 | done |
cristy | 3ed852e | 2009-09-05 21:47:34 +0000 | [diff] [blame] | 10021 | |
| 10022 | # Try to remove the ${objdir}s in the directories where we deleted files |
| 10023 | for dir in $rmdirs; do |
| 10024 | if test -d "$dir"; then |
| 10025 | func_show_eval "rmdir $dir >/dev/null 2>&1" |
| 10026 | fi |
| 10027 | done |
| 10028 | |
| 10029 | exit $exit_status |
| 10030 | } |
| 10031 | |
cristy | da16f16 | 2011-02-19 23:52:17 +0000 | [diff] [blame] | 10032 | { test "$opt_mode" = uninstall || test "$opt_mode" = clean; } && |
cristy | 3ed852e | 2009-09-05 21:47:34 +0000 | [diff] [blame] | 10033 | func_mode_uninstall ${1+"$@"} |
| 10034 | |
cristy | da16f16 | 2011-02-19 23:52:17 +0000 | [diff] [blame] | 10035 | test -z "$opt_mode" && { |
cristy | 3ed852e | 2009-09-05 21:47:34 +0000 | [diff] [blame] | 10036 | help="$generic_help" |
| 10037 | func_fatal_help "you must specify a MODE" |
| 10038 | } |
| 10039 | |
| 10040 | test -z "$exec_cmd" && \ |
cristy | da16f16 | 2011-02-19 23:52:17 +0000 | [diff] [blame] | 10041 | func_fatal_help "invalid operation mode \`$opt_mode'" |
cristy | 3ed852e | 2009-09-05 21:47:34 +0000 | [diff] [blame] | 10042 | |
| 10043 | if test -n "$exec_cmd"; then |
| 10044 | eval exec "$exec_cmd" |
| 10045 | exit $EXIT_FAILURE |
| 10046 | fi |
| 10047 | |
| 10048 | exit $exit_status |
| 10049 | |
| 10050 | |
| 10051 | # The TAGs below are defined such that we never get into a situation |
| 10052 | # in which we disable both kinds of libraries. Given conflicting |
| 10053 | # choices, we go for a static library, that is the most portable, |
| 10054 | # since we can't tell whether shared libraries were disabled because |
| 10055 | # the user asked for that or because the platform doesn't support |
| 10056 | # them. This is particularly important on AIX, because we don't |
| 10057 | # support having both static and shared libraries enabled at the same |
| 10058 | # time on that platform, so we default to a shared-only configuration. |
| 10059 | # If a disable-shared tag is given, we'll fallback to a static-only |
| 10060 | # configuration. But we'll never go from static-only to shared-only. |
| 10061 | |
| 10062 | # ### BEGIN LIBTOOL TAG CONFIG: disable-shared |
| 10063 | build_libtool_libs=no |
| 10064 | build_old_libs=yes |
| 10065 | # ### END LIBTOOL TAG CONFIG: disable-shared |
| 10066 | |
| 10067 | # ### BEGIN LIBTOOL TAG CONFIG: disable-static |
| 10068 | build_old_libs=`case $build_libtool_libs in yes) echo no;; *) echo yes;; esac` |
| 10069 | # ### END LIBTOOL TAG CONFIG: disable-static |
| 10070 | |
| 10071 | # Local Variables: |
| 10072 | # mode:shell-script |
| 10073 | # sh-indentation:2 |
| 10074 | # End: |
| 10075 | # vi:sw=2 |
| 10076 | |
| 10077 | |
| 10078 | # ### BEGIN LIBTOOL TAG CONFIG: CXX |
| 10079 | |
| 10080 | # The linker used to build libraries. |
nicolas | 6237c46 | 2010-10-05 06:11:49 +0000 | [diff] [blame] | 10081 | LD="/usr/bin/ld -m elf_x86_64" |
cristy | 3ed852e | 2009-09-05 21:47:34 +0000 | [diff] [blame] | 10082 | |
cristy | 0c60a69 | 2010-11-04 01:09:47 +0000 | [diff] [blame] | 10083 | # How to create reloadable object files. |
| 10084 | reload_flag=" -r" |
| 10085 | reload_cmds="\$LD\$reload_flag -o \$output\$reload_objs" |
| 10086 | |
cristy | 3ed852e | 2009-09-05 21:47:34 +0000 | [diff] [blame] | 10087 | # Commands used to build an old-style archive. |
| 10088 | old_archive_cmds="\$AR \$AR_FLAGS \$oldlib\$oldobjs~\$RANLIB \$oldlib" |
| 10089 | |
| 10090 | # A language specific compiler. |
nicolas | 6237c46 | 2010-10-05 06:11:49 +0000 | [diff] [blame] | 10091 | CC="g++" |
cristy | 3ed852e | 2009-09-05 21:47:34 +0000 | [diff] [blame] | 10092 | |
| 10093 | # Is the compiler the GNU compiler? |
nicolas | 6237c46 | 2010-10-05 06:11:49 +0000 | [diff] [blame] | 10094 | with_gcc=yes |
cristy | 3ed852e | 2009-09-05 21:47:34 +0000 | [diff] [blame] | 10095 | |
| 10096 | # Compiler flag to turn off builtin functions. |
nicolas | 6237c46 | 2010-10-05 06:11:49 +0000 | [diff] [blame] | 10097 | no_builtin_flag=" -fno-builtin" |
cristy | 3ed852e | 2009-09-05 21:47:34 +0000 | [diff] [blame] | 10098 | |
cristy | 3ed852e | 2009-09-05 21:47:34 +0000 | [diff] [blame] | 10099 | # Additional compiler flags for building library objects. |
nicolas | 6237c46 | 2010-10-05 06:11:49 +0000 | [diff] [blame] | 10100 | pic_flag=" -fPIC -DPIC" |
cristy | 3ed852e | 2009-09-05 21:47:34 +0000 | [diff] [blame] | 10101 | |
cristy | da16f16 | 2011-02-19 23:52:17 +0000 | [diff] [blame] | 10102 | # How to pass a linker flag through the compiler. |
| 10103 | wl="-Wl," |
| 10104 | |
cristy | 3ed852e | 2009-09-05 21:47:34 +0000 | [diff] [blame] | 10105 | # Compiler flag to prevent dynamic linking. |
cristy | ae56d44 | 2011-05-10 21:10:20 +0000 | [diff] [blame^] | 10106 | link_static_flag="" |
cristy | 3ed852e | 2009-09-05 21:47:34 +0000 | [diff] [blame] | 10107 | |
| 10108 | # Does compiler simultaneously support -c and -o options? |
nicolas | 6237c46 | 2010-10-05 06:11:49 +0000 | [diff] [blame] | 10109 | compiler_c_o="yes" |
cristy | 3ed852e | 2009-09-05 21:47:34 +0000 | [diff] [blame] | 10110 | |
| 10111 | # Whether or not to add -lc for building shared libraries. |
| 10112 | build_libtool_need_lc=no |
| 10113 | |
| 10114 | # Whether or not to disallow shared libs when runtime libs are static. |
| 10115 | allow_libtool_libs_with_static_runtimes=no |
| 10116 | |
| 10117 | # Compiler flag to allow reflexive dlopens. |
nicolas | 6237c46 | 2010-10-05 06:11:49 +0000 | [diff] [blame] | 10118 | export_dynamic_flag_spec="\${wl}--export-dynamic" |
cristy | 3ed852e | 2009-09-05 21:47:34 +0000 | [diff] [blame] | 10119 | |
| 10120 | # Compiler flag to generate shared objects directly from archives. |
nicolas | 6237c46 | 2010-10-05 06:11:49 +0000 | [diff] [blame] | 10121 | whole_archive_flag_spec="\${wl}--whole-archive\$convenience \${wl}--no-whole-archive" |
cristy | 3ed852e | 2009-09-05 21:47:34 +0000 | [diff] [blame] | 10122 | |
| 10123 | # Whether the compiler copes with passing no objects directly. |
| 10124 | compiler_needs_object="no" |
| 10125 | |
| 10126 | # Create an old-style archive from a shared archive. |
| 10127 | old_archive_from_new_cmds="" |
| 10128 | |
| 10129 | # Create a temporary old-style archive to link instead of a shared archive. |
| 10130 | old_archive_from_expsyms_cmds="" |
| 10131 | |
| 10132 | # Commands used to build a shared archive. |
cristy | da16f16 | 2011-02-19 23:52:17 +0000 | [diff] [blame] | 10133 | archive_cmds="\$CC \$pic_flag -shared -nostdlib \$predep_objects \$libobjs \$deplibs \$postdep_objects \$compiler_flags \${wl}-soname \$wl\$soname -o \$lib" |
| 10134 | archive_expsym_cmds="\$CC \$pic_flag -shared -nostdlib \$predep_objects \$libobjs \$deplibs \$postdep_objects \$compiler_flags \${wl}-soname \$wl\$soname \${wl}-retain-symbols-file \$wl\$export_symbols -o \$lib" |
cristy | 3ed852e | 2009-09-05 21:47:34 +0000 | [diff] [blame] | 10135 | |
| 10136 | # Commands used to build a loadable module if different from building |
| 10137 | # a shared archive. |
| 10138 | module_cmds="" |
| 10139 | module_expsym_cmds="" |
| 10140 | |
| 10141 | # Whether we are building with GNU ld or not. |
nicolas | 6237c46 | 2010-10-05 06:11:49 +0000 | [diff] [blame] | 10142 | with_gnu_ld="yes" |
cristy | 3ed852e | 2009-09-05 21:47:34 +0000 | [diff] [blame] | 10143 | |
| 10144 | # Flag that allows shared libraries with undefined symbols to be built. |
| 10145 | allow_undefined_flag="" |
| 10146 | |
| 10147 | # Flag that enforces no undefined symbols. |
| 10148 | no_undefined_flag="" |
| 10149 | |
| 10150 | # Flag to hardcode $libdir into a binary during linking. |
| 10151 | # This must work even if $libdir does not exist |
nicolas | 6237c46 | 2010-10-05 06:11:49 +0000 | [diff] [blame] | 10152 | hardcode_libdir_flag_spec="\${wl}-rpath \${wl}\$libdir" |
cristy | 3ed852e | 2009-09-05 21:47:34 +0000 | [diff] [blame] | 10153 | |
| 10154 | # If ld is used when linking, flag to hardcode $libdir into a binary |
| 10155 | # during linking. This must work even if $libdir does not exist. |
| 10156 | hardcode_libdir_flag_spec_ld="" |
| 10157 | |
| 10158 | # Whether we need a single "-rpath" flag with a separated argument. |
| 10159 | hardcode_libdir_separator="" |
| 10160 | |
| 10161 | # Set to "yes" if using DIR/libNAME${shared_ext} during linking hardcodes |
| 10162 | # DIR into the resulting binary. |
| 10163 | hardcode_direct=no |
| 10164 | |
| 10165 | # Set to "yes" if using DIR/libNAME${shared_ext} during linking hardcodes |
| 10166 | # DIR into the resulting binary and the resulting library dependency is |
| 10167 | # "absolute",i.e impossible to change by setting ${shlibpath_var} if the |
| 10168 | # library is relocated. |
| 10169 | hardcode_direct_absolute=no |
| 10170 | |
| 10171 | # Set to "yes" if using the -LDIR flag during linking hardcodes DIR |
| 10172 | # into the resulting binary. |
| 10173 | hardcode_minus_L=no |
| 10174 | |
| 10175 | # Set to "yes" if using SHLIBPATH_VAR=DIR during linking hardcodes DIR |
| 10176 | # into the resulting binary. |
| 10177 | hardcode_shlibpath_var=unsupported |
| 10178 | |
| 10179 | # Set to "yes" if building a shared library automatically hardcodes DIR |
| 10180 | # into the library and all subsequent libraries and executables linked |
| 10181 | # against it. |
| 10182 | hardcode_automatic=no |
| 10183 | |
| 10184 | # Set to yes if linker adds runtime paths of dependent libraries |
| 10185 | # to runtime path list. |
| 10186 | inherit_rpath=no |
| 10187 | |
| 10188 | # Whether libtool must link a program against all its dependency libraries. |
| 10189 | link_all_deplibs=unknown |
| 10190 | |
cristy | 3ed852e | 2009-09-05 21:47:34 +0000 | [diff] [blame] | 10191 | # Set to "yes" if exported symbols are required. |
| 10192 | always_export_symbols=no |
| 10193 | |
| 10194 | # The commands to list exported symbols. |
nicolas | 6237c46 | 2010-10-05 06:11:49 +0000 | [diff] [blame] | 10195 | export_symbols_cmds="\$NM \$libobjs \$convenience | \$global_symbol_pipe | \$SED 's/.* //' | sort | uniq > \$export_symbols" |
cristy | 3ed852e | 2009-09-05 21:47:34 +0000 | [diff] [blame] | 10196 | |
| 10197 | # Symbols that should not be listed in the preloaded symbols. |
nicolas | 6237c46 | 2010-10-05 06:11:49 +0000 | [diff] [blame] | 10198 | exclude_expsyms="_GLOBAL_OFFSET_TABLE_|_GLOBAL__F[ID]_.*" |
cristy | 3ed852e | 2009-09-05 21:47:34 +0000 | [diff] [blame] | 10199 | |
| 10200 | # Symbols that must always be exported. |
| 10201 | include_expsyms="" |
| 10202 | |
| 10203 | # Commands necessary for linking programs (against libraries) with templates. |
| 10204 | prelink_cmds="" |
| 10205 | |
cristy | da16f16 | 2011-02-19 23:52:17 +0000 | [diff] [blame] | 10206 | # Commands necessary for finishing linking programs. |
| 10207 | postlink_cmds="" |
| 10208 | |
cristy | 3ed852e | 2009-09-05 21:47:34 +0000 | [diff] [blame] | 10209 | # Specify filename containing input files. |
| 10210 | file_list_spec="" |
| 10211 | |
| 10212 | # How to hardcode a shared library path into an executable. |
nicolas | 6237c46 | 2010-10-05 06:11:49 +0000 | [diff] [blame] | 10213 | hardcode_action=immediate |
cristy | 3ed852e | 2009-09-05 21:47:34 +0000 | [diff] [blame] | 10214 | |
| 10215 | # The directories searched by this compiler when creating a shared library. |
cristy | ae56d44 | 2011-05-10 21:10:20 +0000 | [diff] [blame^] | 10216 | compiler_lib_search_dirs="/usr/lib/gcc/x86_64-redhat-linux/4.6.0 /usr/lib/gcc/x86_64-redhat-linux/4.6.0/../../../../lib64 /lib/../lib64 /usr/lib/../lib64 /usr/lib/gcc/x86_64-redhat-linux/4.6.0/../../.." |
cristy | 3ed852e | 2009-09-05 21:47:34 +0000 | [diff] [blame] | 10217 | |
| 10218 | # Dependencies to place before and after the objects being linked to |
| 10219 | # create a shared library. |
cristy | ae56d44 | 2011-05-10 21:10:20 +0000 | [diff] [blame^] | 10220 | predep_objects="/usr/lib/gcc/x86_64-redhat-linux/4.6.0/../../../../lib64/crti.o /usr/lib/gcc/x86_64-redhat-linux/4.6.0/crtbeginS.o" |
| 10221 | postdep_objects="/usr/lib/gcc/x86_64-redhat-linux/4.6.0/crtendS.o /usr/lib/gcc/x86_64-redhat-linux/4.6.0/../../../../lib64/crtn.o" |
cristy | 3ed852e | 2009-09-05 21:47:34 +0000 | [diff] [blame] | 10222 | predeps="" |
cristy | b186075 | 2011-03-14 00:27:46 +0000 | [diff] [blame] | 10223 | postdeps="-lstdc++ -lm -lgcc_s -lpthread -lc -lgcc_s" |
cristy | 3ed852e | 2009-09-05 21:47:34 +0000 | [diff] [blame] | 10224 | |
| 10225 | # The library search path used internally by the compiler when linking |
| 10226 | # a shared library. |
cristy | ae56d44 | 2011-05-10 21:10:20 +0000 | [diff] [blame^] | 10227 | compiler_lib_search_path="-L/usr/lib/gcc/x86_64-redhat-linux/4.6.0 -L/usr/lib/gcc/x86_64-redhat-linux/4.6.0/../../../../lib64 -L/lib/../lib64 -L/usr/lib/../lib64 -L/usr/lib/gcc/x86_64-redhat-linux/4.6.0/../../.." |
cristy | 3ed852e | 2009-09-05 21:47:34 +0000 | [diff] [blame] | 10228 | |
| 10229 | # ### END LIBTOOL TAG CONFIG: CXX |