blob: fe473c5b6ca953d11d4a7610b268b05c9fbb4605 [file] [log] [blame]
cristyae56d442011-05-10 21:10:20 +00001#! /bin/sh
cristy3ed852e2009-09-05 21:47:34 +00002
3# libtool - Provide generalized library-building support services.
cristy29eb34e2011-10-16 00:46:08 +00004# Generated automatically by config.status (ImageMagick) 7.0.0-0
cristyae56d442011-05-10 21:10:20 +00005# Libtool was configured on host magick.imagemagick.org:
cristy3ed852e2009-09-05 21:47:34 +00006# 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,
cristy99bd5232011-12-07 14:38:20 +00009# 2006, 2007, 2008, 2009, 2010, 2011 Free Software
10# Foundation, Inc.
cristy3ed852e2009-09-05 21:47:34 +000011# 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.
38available_tags="CXX "
39
40# ### BEGIN LIBTOOL CONFIG
41
42# A sed program that does not truncate output.
43SED="/bin/sed"
44
45# Sed that helps us avoid accidentally triggering echo(1) options like -n.
46Xsed="$SED -e 1s/^X//"
47
48# A grep program that handles long lines.
49GREP="/bin/grep"
50
51# An ERE matcher.
52EGREP="/bin/grep -E"
53
54# A literal string matcher.
55FGREP="/bin/grep -F"
56
cristy0c60a692010-11-04 01:09:47 +000057# Shell to use when invoking shell scripts.
cristyae56d442011-05-10 21:10:20 +000058SHELL="/bin/sh"
cristy0c60a692010-11-04 01:09:47 +000059
60# An echo program that protects backslashes.
61ECHO="printf %s\\n"
62
cristy3ed852e2009-09-05 21:47:34 +000063# Which release of libtool.m4 was used?
cristy99bd5232011-12-07 14:38:20 +000064macro_version=2.4.2
65macro_revision=1.3337
cristy3ed852e2009-09-05 21:47:34 +000066
67# Assembler program.
cristy0c60a692010-11-04 01:09:47 +000068AS="as"
cristy3ed852e2009-09-05 21:47:34 +000069
70# DLL creation program.
cristyda16f162011-02-19 23:52:17 +000071DLLTOOL="false"
cristy3ed852e2009-09-05 21:47:34 +000072
73# Object dumper program.
cristy0c60a692010-11-04 01:09:47 +000074OBJDUMP="objdump"
cristy3ed852e2009-09-05 21:47:34 +000075
76# Whether or not to build shared libraries.
cristybd4fb6e2011-10-26 13:10:01 +000077build_libtool_libs=yes
cristy3ed852e2009-09-05 21:47:34 +000078
79# Whether or not to build static libraries.
80build_old_libs=yes
81
82# What type of objects to build.
83pic_mode=default
84
85# Whether or not to optimize for fast installation.
cristybd4fb6e2011-10-26 13:10:01 +000086fast_install=yes
cristy3ed852e2009-09-05 21:47:34 +000087
cristy99bd5232011-12-07 14:38:20 +000088# The PATH separator for the build system.
89PATH_SEPARATOR=":"
90
cristy3ed852e2009-09-05 21:47:34 +000091# The host system.
92host_alias=
93host=x86_64-unknown-linux-gnu
94host_os=linux-gnu
95
96# The build system.
97build_alias=
98build=x86_64-unknown-linux-gnu
99build_os=linux-gnu
100
101# A BSD- or MS-compatible name lister.
102NM="/usr/bin/nm -B"
103
104# Whether we need soft or hard links.
105LN_S="ln -s"
106
107# What is the maximum length of a command?
cristy98dddb52010-11-04 00:30:15 +0000108max_cmd_len=1572864
cristy3ed852e2009-09-05 21:47:34 +0000109
110# Object file suffix (normally "o").
111objext=o
112
113# Executable file suffix (normally "").
114exeext=
115
116# whether the shell understands "unset".
117lt_unset=unset
118
119# turn spaces into newlines.
120SP2NL="tr \\040 \\012"
121
122# turn newlines into spaces.
123NL2SP="tr \\015\\012 \\040\\040"
124
cristyda16f162011-02-19 23:52:17 +0000125# convert $build file names to $host format.
126to_host_file_cmd=func_convert_file_noop
127
128# convert $build files to toolchain format.
129to_tool_file_cmd=func_convert_file_noop
130
cristy3ed852e2009-09-05 21:47:34 +0000131# Method to check whether dependent libraries are shared objects.
132deplibs_check_method="pass_all"
133
cristyda16f162011-02-19 23:52:17 +0000134# Command to use when deplibs_check_method = "file_magic".
cristy3ed852e2009-09-05 21:47:34 +0000135file_magic_cmd="\$MAGIC_CMD"
136
cristyda16f162011-02-19 23:52:17 +0000137# How to find potential files when deplibs_check_method = "file_magic".
138file_magic_glob=""
139
140# Find potential files using nocaseglob when deplibs_check_method = "file_magic".
141want_nocaseglob="no"
142
143# Command to associate shared and link libraries.
144sharedlib_from_linklib_cmd="printf %s\\n"
145
cristy3ed852e2009-09-05 21:47:34 +0000146# The archiver.
147AR="ar"
cristyda16f162011-02-19 23:52:17 +0000148
149# Flags to create an archive.
cristy3ed852e2009-09-05 21:47:34 +0000150AR_FLAGS="cru"
151
cristyda16f162011-02-19 23:52:17 +0000152# How to feed a file listing to the archiver.
153archiver_list_spec="@"
154
cristy3ed852e2009-09-05 21:47:34 +0000155# A symbol stripping program.
156STRIP="strip"
157
158# Commands used to install an old-style archive.
159RANLIB="ranlib"
cristy99bd5232011-12-07 14:38:20 +0000160old_postinstall_cmds="chmod 644 \$oldlib~\$RANLIB \$tool_oldlib"
cristy3ed852e2009-09-05 21:47:34 +0000161old_postuninstall_cmds=""
162
cristy0c60a692010-11-04 01:09:47 +0000163# Whether to use a lock for old archive extraction.
164lock_old_archive_extraction=no
165
cristy3ed852e2009-09-05 21:47:34 +0000166# A C compiler.
cristy439c4df2011-05-25 23:05:49 +0000167LTCC="gcc -std=gnu99 -std=gnu99"
cristy3ed852e2009-09-05 21:47:34 +0000168
169# LTCC compiler flags.
cristya32d1812012-03-02 19:24:21 +0000170LTCFLAGS="-fopenmp -g -O2 -Wall -pthread"
cristy3ed852e2009-09-05 21:47:34 +0000171
172# Take the output of nm and produce a listing of raw symbols and C names.
cristyda16f162011-02-19 23:52:17 +0000173global_symbol_pipe="sed -n -e 's/^.*[ ]\\([ABCDGIRSTW][ABCDGIRSTW]*\\)[ ][ ]*\\([_A-Za-z][_A-Za-z0-9]*\\)\$/\\1 \\2 \\2/p' | sed '/ __gnu_lto/d'"
cristy3ed852e2009-09-05 21:47:34 +0000174
175# Transform the output of nm in a proper C declaration.
176global_symbol_to_cdecl="sed -n -e 's/^T .* \\(.*\\)\$/extern int \\1();/p' -e 's/^[ABCDGIRSTW]* .* \\(.*\\)\$/extern char \\1;/p'"
177
178# Transform the output of nm in a C name address pair.
cristyda16f162011-02-19 23:52:17 +0000179global_symbol_to_c_name_address="sed -n -e 's/^: \\([^ ]*\\)[ ]*\$/ {\\\"\\1\\\", (void *) 0},/p' -e 's/^[ABCDGIRSTW]* \\([^ ]*\\) \\([^ ]*\\)\$/ {\"\\2\", (void *) \\&\\2},/p'"
cristy3ed852e2009-09-05 21:47:34 +0000180
181# Transform the output of nm in a C name address pair when lib prefix is needed.
cristyda16f162011-02-19 23:52:17 +0000182global_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'"
183
184# Specify filename containing input files for $NM.
185nm_file_list_spec="@"
186
187# The root where to search for dependent libraries,and in which our libraries should be installed.
188lt_sysroot=
cristy3ed852e2009-09-05 21:47:34 +0000189
190# The name of the directory that contains temporary libtool files.
191objdir=.libs
192
cristy3ed852e2009-09-05 21:47:34 +0000193# Used to examine libraries when file_magic_cmd begins with "file".
194MAGIC_CMD=file
195
196# Must we lock files when doing compilation?
197need_locks="no"
198
cristyda16f162011-02-19 23:52:17 +0000199# Manifest tool.
200MANIFEST_TOOL=":"
201
cristy3ed852e2009-09-05 21:47:34 +0000202# Tool to manipulate archived DWARF debug symbol files on Mac OS X.
203DSYMUTIL=""
204
205# Tool to change global to local symbols on Mac OS X.
206NMEDIT=""
207
208# Tool to manipulate fat objects and archives on Mac OS X.
209LIPO=""
210
211# ldd/readelf like tool for Mach-O binaries on Mac OS X.
212OTOOL=""
213
214# ldd/readelf like tool for 64 bit Mach-O binaries on Mac OS X 10.4.
215OTOOL64=""
216
217# Old archive suffix (normally "a").
218libext=a
219
220# Shared library suffix (normally ".so").
221shrext_cmds=".so"
222
223# The commands to extract the exported symbol list from a shared archive.
224extract_expsyms_cmds=""
225
226# Variables whose values should be saved in libtool wrapper scripts and
227# restored at link time.
228variables_saved_for_relink="PATH LD_LIBRARY_PATH LD_RUN_PATH GCC_EXEC_PREFIX COMPILER_PATH LIBRARY_PATH"
229
230# Do we need the "lib" prefix for modules?
231need_lib_prefix=no
232
233# Do we need a version for libraries?
234need_version=no
235
236# Library versioning type.
237version_type=linux
238
239# Shared library runtime path variable.
240runpath_var=LD_RUN_PATH
241
242# Shared library path variable.
243shlibpath_var=LD_LIBRARY_PATH
244
245# Is shlibpath searched before the hard-coded library search path?
246shlibpath_overrides_runpath=no
247
248# Format of library name prefix.
249libname_spec="lib\$name"
250
251# List of archive names. First name is the real one, the rest are links.
252# The last name is the one that the linker finds with -lNAME
253library_names_spec="\${libname}\${release}\${shared_ext}\$versuffix \${libname}\${release}\${shared_ext}\$major \$libname\${shared_ext}"
254
255# The coded name of the library, if different from the real name.
256soname_spec="\${libname}\${release}\${shared_ext}\$major"
257
cristy0c60a692010-11-04 01:09:47 +0000258# Permission mode override for installation of shared libraries.
259install_override_mode=""
260
cristy3ed852e2009-09-05 21:47:34 +0000261# Command to use after installation of a shared archive.
262postinstall_cmds=""
263
264# Command to use after uninstallation of a shared archive.
265postuninstall_cmds=""
266
267# Commands used to finish a libtool library installation in a directory.
268finish_cmds="PATH=\\\"\\\$PATH:/sbin\\\" ldconfig -n \$libdir"
269
270# As "finish_cmds", except a single script fragment to be evaled but
271# not shown.
272finish_eval=""
273
274# Whether we should hardcode library paths into libraries.
275hardcode_into_libs=yes
276
277# Compile-time system search path for libraries.
cristy84d09e22012-01-11 20:17:27 +0000278sys_lib_search_path_spec="/usr/lib/gcc/x86_64-redhat-linux/4.7.0 /usr/lib64 /lib64 "
cristy3ed852e2009-09-05 21:47:34 +0000279
280# Run-time system search path for libraries.
cristy987feef2011-11-17 12:24:56 +0000281sys_lib_dlsearch_path_spec="/lib64 /usr/lib64 /lib /usr/lib /usr/lib64/atlas /usr/lib/llvm /usr/lib64/llvm /usr/local/lib /usr/lib64/mysql /usr/lib64/qt-3.3/lib /usr/lib64/tcl8.5/tclx8.4 /usr/lib64/tcl8.5 /usr/lib64/tracker-0.12 /usr/lib/wine/ /usr/lib64/wine/ /usr/lib64/xulrunner-2 "
cristy3ed852e2009-09-05 21:47:34 +0000282
283# Whether dlopen is supported.
284dlopen_support=yes
285
286# Whether dlopen of programs is supported.
cristy439c4df2011-05-25 23:05:49 +0000287dlopen_self=yes
cristy3ed852e2009-09-05 21:47:34 +0000288
289# Whether dlopen of statically linked programs is supported.
cristy439c4df2011-05-25 23:05:49 +0000290dlopen_self_static=yes
cristy3ed852e2009-09-05 21:47:34 +0000291
292# Commands to strip libraries.
293old_striplib="strip --strip-debug"
294striplib="strip --strip-unneeded"
295
296
297# The linker used to build libraries.
298LD="/usr/bin/ld -m elf_x86_64"
299
cristy0c60a692010-11-04 01:09:47 +0000300# How to create reloadable object files.
301reload_flag=" -r"
302reload_cmds="\$LD\$reload_flag -o \$output\$reload_objs"
303
cristy3ed852e2009-09-05 21:47:34 +0000304# Commands used to build an old-style archive.
cristy99bd5232011-12-07 14:38:20 +0000305old_archive_cmds="\$AR \$AR_FLAGS \$oldlib\$oldobjs~\$RANLIB \$tool_oldlib"
cristy3ed852e2009-09-05 21:47:34 +0000306
307# A language specific compiler.
cristy439c4df2011-05-25 23:05:49 +0000308CC="gcc -std=gnu99 -std=gnu99"
cristy3ed852e2009-09-05 21:47:34 +0000309
310# Is the compiler the GNU compiler?
311with_gcc=yes
312
313# Compiler flag to turn off builtin functions.
cristy439c4df2011-05-25 23:05:49 +0000314no_builtin_flag=" -fno-builtin"
cristy3ed852e2009-09-05 21:47:34 +0000315
cristy3ed852e2009-09-05 21:47:34 +0000316# Additional compiler flags for building library objects.
317pic_flag=" -fPIC -DPIC"
318
cristyda16f162011-02-19 23:52:17 +0000319# How to pass a linker flag through the compiler.
320wl="-Wl,"
321
cristy3ed852e2009-09-05 21:47:34 +0000322# Compiler flag to prevent dynamic linking.
cristyae56d442011-05-10 21:10:20 +0000323link_static_flag=""
cristy3ed852e2009-09-05 21:47:34 +0000324
325# Does compiler simultaneously support -c and -o options?
326compiler_c_o="yes"
327
328# Whether or not to add -lc for building shared libraries.
cristybd4fb6e2011-10-26 13:10:01 +0000329build_libtool_need_lc=no
cristy3ed852e2009-09-05 21:47:34 +0000330
331# Whether or not to disallow shared libs when runtime libs are static.
332allow_libtool_libs_with_static_runtimes=no
333
334# Compiler flag to allow reflexive dlopens.
335export_dynamic_flag_spec="\${wl}--export-dynamic"
336
337# Compiler flag to generate shared objects directly from archives.
338whole_archive_flag_spec="\${wl}--whole-archive\$convenience \${wl}--no-whole-archive"
339
340# Whether the compiler copes with passing no objects directly.
341compiler_needs_object="no"
342
343# Create an old-style archive from a shared archive.
344old_archive_from_new_cmds=""
345
346# Create a temporary old-style archive to link instead of a shared archive.
347old_archive_from_expsyms_cmds=""
348
349# Commands used to build a shared archive.
cristyda16f162011-02-19 23:52:17 +0000350archive_cmds="\$CC -shared \$pic_flag \$libobjs \$deplibs \$compiler_flags \${wl}-soname \$wl\$soname -o \$lib"
cristy3ed852e2009-09-05 21:47:34 +0000351archive_expsym_cmds="echo \\\"{ global:\\\" > \$output_objdir/\$libname.ver~
352 cat \$export_symbols | sed -e \\\"s/\\\\(.*\\\\)/\\\\1;/\\\" >> \$output_objdir/\$libname.ver~
353 echo \\\"local: *; };\\\" >> \$output_objdir/\$libname.ver~
cristyda16f162011-02-19 23:52:17 +0000354 \$CC -shared \$pic_flag \$libobjs \$deplibs \$compiler_flags \${wl}-soname \$wl\$soname \${wl}-version-script \${wl}\$output_objdir/\$libname.ver -o \$lib"
cristy3ed852e2009-09-05 21:47:34 +0000355
356# Commands used to build a loadable module if different from building
357# a shared archive.
358module_cmds=""
359module_expsym_cmds=""
360
361# Whether we are building with GNU ld or not.
362with_gnu_ld="yes"
363
364# Flag that allows shared libraries with undefined symbols to be built.
365allow_undefined_flag=""
366
367# Flag that enforces no undefined symbols.
368no_undefined_flag=""
369
370# Flag to hardcode $libdir into a binary during linking.
371# This must work even if $libdir does not exist
372hardcode_libdir_flag_spec="\${wl}-rpath \${wl}\$libdir"
373
cristy3ed852e2009-09-05 21:47:34 +0000374# Whether we need a single "-rpath" flag with a separated argument.
375hardcode_libdir_separator=""
376
377# Set to "yes" if using DIR/libNAME${shared_ext} during linking hardcodes
378# DIR into the resulting binary.
379hardcode_direct=no
380
381# Set to "yes" if using DIR/libNAME${shared_ext} during linking hardcodes
382# DIR into the resulting binary and the resulting library dependency is
383# "absolute",i.e impossible to change by setting ${shlibpath_var} if the
384# library is relocated.
385hardcode_direct_absolute=no
386
387# Set to "yes" if using the -LDIR flag during linking hardcodes DIR
388# into the resulting binary.
389hardcode_minus_L=no
390
391# Set to "yes" if using SHLIBPATH_VAR=DIR during linking hardcodes DIR
392# into the resulting binary.
393hardcode_shlibpath_var=unsupported
394
395# Set to "yes" if building a shared library automatically hardcodes DIR
396# into the library and all subsequent libraries and executables linked
397# against it.
398hardcode_automatic=no
399
400# Set to yes if linker adds runtime paths of dependent libraries
401# to runtime path list.
402inherit_rpath=no
403
404# Whether libtool must link a program against all its dependency libraries.
405link_all_deplibs=unknown
406
cristy3ed852e2009-09-05 21:47:34 +0000407# Set to "yes" if exported symbols are required.
408always_export_symbols=no
409
410# The commands to list exported symbols.
411export_symbols_cmds="\$NM \$libobjs \$convenience | \$global_symbol_pipe | \$SED 's/.* //' | sort | uniq > \$export_symbols"
412
413# Symbols that should not be listed in the preloaded symbols.
414exclude_expsyms="_GLOBAL_OFFSET_TABLE_|_GLOBAL__F[ID]_.*"
415
416# Symbols that must always be exported.
417include_expsyms=""
418
419# Commands necessary for linking programs (against libraries) with templates.
420prelink_cmds=""
421
cristyda16f162011-02-19 23:52:17 +0000422# Commands necessary for finishing linking programs.
423postlink_cmds=""
424
cristy3ed852e2009-09-05 21:47:34 +0000425# Specify filename containing input files.
426file_list_spec=""
427
428# How to hardcode a shared library path into an executable.
429hardcode_action=immediate
430
431# The directories searched by this compiler when creating a shared library.
432compiler_lib_search_dirs=""
433
434# Dependencies to place before and after the objects being linked to
435# create a shared library.
436predep_objects=""
437postdep_objects=""
438predeps=""
439postdeps=""
440
441# The library search path used internally by the compiler when linking
442# a shared library.
443compiler_lib_search_path=""
444
445# ### END LIBTOOL CONFIG
446
cristy3ed852e2009-09-05 21:47:34 +0000447
cristy2542fc62011-12-06 17:50:25 +0000448# libtool (GNU libtool) 2.4.2
cristy3ed852e2009-09-05 21:47:34 +0000449# Written by Gordon Matzigkeit <gord@gnu.ai.mit.edu>, 1996
450
cristy98dddb52010-11-04 00:30:15 +0000451# Copyright (C) 1996, 1997, 1998, 1999, 2000, 2001, 2003, 2004, 2005, 2006,
cristy2542fc62011-12-06 17:50:25 +0000452# 2007, 2008, 2009, 2010, 2011 Free Software Foundation, Inc.
cristy3ed852e2009-09-05 21:47:34 +0000453# This is free software; see the source for copying conditions. There is NO
454# warranty; not even for MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
455
456# GNU Libtool is free software; you can redistribute it and/or modify
457# it under the terms of the GNU General Public License as published by
458# the Free Software Foundation; either version 2 of the License, or
459# (at your option) any later version.
460#
461# As a special exception to the GNU General Public License,
462# if you distribute this file as part of a program or library that
463# is built using GNU Libtool, you may include this file under the
464# same distribution terms that you use for the rest of that program.
465#
466# GNU Libtool is distributed in the hope that it will be useful, but
467# WITHOUT ANY WARRANTY; without even the implied warranty of
468# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
469# General Public License for more details.
470#
471# You should have received a copy of the GNU General Public License
472# along with GNU Libtool; see the file COPYING. If not, a copy
473# can be downloaded from http://www.gnu.org/licenses/gpl.html,
474# or obtained by writing to the Free Software Foundation, Inc.,
475# 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
476
477# Usage: $progname [OPTION]... [MODE-ARG]...
478#
479# Provide generalized library-building support services.
480#
cristy98dddb52010-11-04 00:30:15 +0000481# --config show all configuration variables
482# --debug enable verbose shell tracing
483# -n, --dry-run display commands without modifying any files
484# --features display basic configuration information and exit
485# --mode=MODE use operation mode MODE
486# --preserve-dup-deps don't remove duplicate dependency libraries
487# --quiet, --silent don't print informational messages
488# --no-quiet, --no-silent
489# print informational messages (default)
cristy2542fc62011-12-06 17:50:25 +0000490# --no-warn don't display warning messages
cristy98dddb52010-11-04 00:30:15 +0000491# --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
cristy3ed852e2009-09-05 21:47:34 +0000496#
497# MODE must be one of the following:
498#
cristy98dddb52010-11-04 00:30:15 +0000499# 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
cristy3ed852e2009-09-05 21:47:34 +0000506#
cristy98dddb52010-11-04 00:30:15 +0000507# 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.
cristy3ed852e2009-09-05 21:47:34 +0000509# 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#
cristy98dddb52010-11-04 00:30:15 +0000514# host-triplet: $host
515# shell: $SHELL
516# compiler: $LTCC
517# compiler flags: $LTCFLAGS
518# linker: $LD (gnu? $with_gnu_ld)
cristy2542fc62011-12-06 17:50:25 +0000519# $progname: (GNU libtool) 2.4.2
cristy98dddb52010-11-04 00:30:15 +0000520# automake: $automake_version
521# autoconf: $autoconf_version
cristy3ed852e2009-09-05 21:47:34 +0000522#
523# Report bugs to <bug-libtool@gnu.org>.
cristyda16f162011-02-19 23:52:17 +0000524# GNU libtool home page: <http://www.gnu.org/software/libtool/>.
525# General help using GNU software: <http://www.gnu.org/gethelp/>.
cristy3ed852e2009-09-05 21:47:34 +0000526
cristy98dddb52010-11-04 00:30:15 +0000527PROGRAM=libtool
cristy3ed852e2009-09-05 21:47:34 +0000528PACKAGE=libtool
cristy2542fc62011-12-06 17:50:25 +0000529VERSION=2.4.2
cristycd4c5312009-11-22 01:19:08 +0000530TIMESTAMP=""
cristy2542fc62011-12-06 17:50:25 +0000531package_revision=1.3337
cristy3ed852e2009-09-05 21:47:34 +0000532
533# Be Bourne compatible
534if 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
541else
542 case `(set -o) 2>/dev/null` in *posix*) set -o posix;; esac
543fi
544BIN_SH=xpg4; export BIN_SH # for Tru64
545DUALCASE=1; export DUALCASE # for MKS sh
546
cristy98dddb52010-11-04 00:30:15 +0000547# A function that is used when there is no print builtin or printf.
548func_fallback_echo ()
549{
550 eval 'cat <<_LTECHO_EOF
551$1
552_LTECHO_EOF'
553}
554
cristy3ed852e2009-09-05 21:47:34 +0000555# NLS nuisances: We save the old values to restore during execute mode.
cristy3ed852e2009-09-05 21:47:34 +0000556lt_user_locale=
557lt_safe_locale=
558for lt_var in LANG LANGUAGE LC_ALL LC_CTYPE LC_COLLATE LC_MESSAGES
559do
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"
567done
cristy98dddb52010-11-04 00:30:15 +0000568LC_ALL=C
569LANGUAGE=C
570export LANGUAGE LC_ALL
cristy3ed852e2009-09-05 21:47:34 +0000571
572$lt_unset CDPATH
573
574
cristy98dddb52010-11-04 00:30:15 +0000575# 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.
580progpath="$0"
cristy3ed852e2009-09-05 21:47:34 +0000581
582
583
584: ${CP="cp -f"}
cristy98dddb52010-11-04 00:30:15 +0000585test "${ECHO+set}" = set || ECHO=${as_echo-'printf %s\n'}
cristy3ed852e2009-09-05 21:47:34 +0000586: ${MAKE="make"}
587: ${MKDIR="mkdir"}
588: ${MV="mv -f"}
589: ${RM="rm -f"}
cristy3ed852e2009-09-05 21:47:34 +0000590: ${SHELL="${CONFIG_SHELL-/bin/sh}"}
591: ${Xsed="$SED -e 1s/^X//"}
592
593# Global variables:
594EXIT_SUCCESS=0
595EXIT_FAILURE=1
596EXIT_MISMATCH=63 # $? = 63 is used to indicate version mismatch to missing.
597EXIT_SKIP=77 # $? = 77 is used to indicate a skipped test to automake.
598
599exit_status=$EXIT_SUCCESS
600
601# Make sure IFS has a sensible default
602lt_nl='
603'
604IFS=" $lt_nl"
605
606dirname="s,/[^/]*$,,"
607basename="s,^.*/,,"
608
cristy3ed852e2009-09-05 21:47:34 +0000609# func_dirname file append nondir_replacement
610# Compute the dirname of FILE. If nonempty, add APPEND to the result,
611# otherwise set result to NONDIR_REPLACEMENT.
612func_dirname ()
613{
cristyda16f162011-02-19 23:52:17 +0000614 case ${1} in
615 */*) func_dirname_result="${1%/*}${2}" ;;
616 * ) func_dirname_result="${3}" ;;
617 esac
618} # Extended-shell func_dirname implementation
619
cristy3ed852e2009-09-05 21:47:34 +0000620
621# func_basename file
622func_basename ()
623{
cristyda16f162011-02-19 23:52:17 +0000624 func_basename_result="${1##*/}"
625} # Extended-shell func_basename implementation
626
cristy3ed852e2009-09-05 21:47:34 +0000627
628# func_dirname_and_basename file append nondir_replacement
629# perform func_basename and func_dirname in a single function
630# call:
631# dirname: Compute the dirname of FILE. If nonempty,
632# add APPEND to the result, otherwise set result
633# to NONDIR_REPLACEMENT.
634# value returned in "$func_dirname_result"
635# basename: Compute filename of FILE.
636# value retuned in "$func_basename_result"
637# Implementation must be kept synchronized with func_dirname
638# and func_basename. For efficiency, we do not delegate to
639# those functions but instead duplicate the functionality here.
640func_dirname_and_basename ()
641{
cristyda16f162011-02-19 23:52:17 +0000642 case ${1} in
643 */*) func_dirname_result="${1%/*}${2}" ;;
644 * ) func_dirname_result="${3}" ;;
645 esac
646 func_basename_result="${1##*/}"
647} # Extended-shell func_dirname_and_basename implementation
648
cristy3ed852e2009-09-05 21:47:34 +0000649
650# func_stripname prefix suffix name
651# strip PREFIX and SUFFIX off of NAME.
652# PREFIX and SUFFIX must not contain globbing or regex special
653# characters, hashes, percent signs, but SUFFIX may contain a leading
654# dot (in which case that matches only a dot).
cristyda16f162011-02-19 23:52:17 +0000655# func_strip_suffix prefix name
cristy3ed852e2009-09-05 21:47:34 +0000656func_stripname ()
657{
cristyda16f162011-02-19 23:52:17 +0000658 # pdksh 5.2.14 does not do ${X%$Y} correctly if both X and Y are
659 # positional parameters, so assign one to ordinary parameter first.
660 func_stripname_result=${3}
661 func_stripname_result=${func_stripname_result#"${1}"}
662 func_stripname_result=${func_stripname_result%"${2}"}
663} # Extended-shell func_stripname implementation
cristy3ed852e2009-09-05 21:47:34 +0000664
cristy3ed852e2009-09-05 21:47:34 +0000665
cristy98dddb52010-11-04 00:30:15 +0000666# These SED scripts presuppose an absolute path with a trailing slash.
667pathcar='s,^/\([^/]*\).*$,\1,'
668pathcdr='s,^/[^/]*,,'
669removedotparts=':dotsl
670 s@/\./@/@g
671 t dotsl
672 s,/\.$,/,'
673collapseslashes='s@/\{1,\}@/@g'
674finalslash='s,/*$,/,'
675
676# func_normal_abspath PATH
677# Remove doubled-up and trailing slashes, "." path components,
678# and cancel out any ".." path components in PATH after making
679# it an absolute path.
680# value returned in "$func_normal_abspath_result"
681func_normal_abspath ()
682{
683 # Start from root dir and reassemble the path.
684 func_normal_abspath_result=
685 func_normal_abspath_tpath=$1
686 func_normal_abspath_altnamespace=
687 case $func_normal_abspath_tpath in
688 "")
689 # Empty path, that just means $cwd.
690 func_stripname '' '/' "`pwd`"
691 func_normal_abspath_result=$func_stripname_result
692 return
693 ;;
694 # The next three entries are used to spot a run of precisely
695 # two leading slashes without using negated character classes;
696 # we take advantage of case's first-match behaviour.
697 ///*)
698 # Unusual form of absolute path, do nothing.
699 ;;
700 //*)
701 # Not necessarily an ordinary path; POSIX reserves leading '//'
702 # and for example Cygwin uses it to access remote file shares
703 # over CIFS/SMB, so we conserve a leading double slash if found.
704 func_normal_abspath_altnamespace=/
705 ;;
706 /*)
707 # Absolute path, do nothing.
708 ;;
709 *)
710 # Relative path, prepend $cwd.
711 func_normal_abspath_tpath=`pwd`/$func_normal_abspath_tpath
712 ;;
713 esac
714 # Cancel out all the simple stuff to save iterations. We also want
715 # the path to end with a slash for ease of parsing, so make sure
716 # there is one (and only one) here.
717 func_normal_abspath_tpath=`$ECHO "$func_normal_abspath_tpath" | $SED \
718 -e "$removedotparts" -e "$collapseslashes" -e "$finalslash"`
719 while :; do
720 # Processed it all yet?
721 if test "$func_normal_abspath_tpath" = / ; then
722 # If we ascended to the root using ".." the result may be empty now.
723 if test -z "$func_normal_abspath_result" ; then
724 func_normal_abspath_result=/
725 fi
726 break
727 fi
728 func_normal_abspath_tcomponent=`$ECHO "$func_normal_abspath_tpath" | $SED \
729 -e "$pathcar"`
730 func_normal_abspath_tpath=`$ECHO "$func_normal_abspath_tpath" | $SED \
731 -e "$pathcdr"`
732 # Figure out what to do with it
733 case $func_normal_abspath_tcomponent in
734 "")
735 # Trailing empty path component, ignore it.
736 ;;
737 ..)
738 # Parent dir; strip last assembled component from result.
739 func_dirname "$func_normal_abspath_result"
740 func_normal_abspath_result=$func_dirname_result
741 ;;
742 *)
743 # Actual path component, append it.
744 func_normal_abspath_result=$func_normal_abspath_result/$func_normal_abspath_tcomponent
745 ;;
746 esac
747 done
748 # Restore leading double-slash if one was found on entry.
749 func_normal_abspath_result=$func_normal_abspath_altnamespace$func_normal_abspath_result
750}
751
752# func_relative_path SRCDIR DSTDIR
753# generates a relative path from SRCDIR to DSTDIR, with a trailing
754# slash if non-empty, suitable for immediately appending a filename
755# without needing to append a separator.
756# value returned in "$func_relative_path_result"
757func_relative_path ()
758{
759 func_relative_path_result=
760 func_normal_abspath "$1"
761 func_relative_path_tlibdir=$func_normal_abspath_result
762 func_normal_abspath "$2"
763 func_relative_path_tbindir=$func_normal_abspath_result
764
765 # Ascend the tree starting from libdir
766 while :; do
767 # check if we have found a prefix of bindir
768 case $func_relative_path_tbindir in
769 $func_relative_path_tlibdir)
770 # found an exact match
771 func_relative_path_tcancelled=
772 break
773 ;;
774 $func_relative_path_tlibdir*)
775 # found a matching prefix
776 func_stripname "$func_relative_path_tlibdir" '' "$func_relative_path_tbindir"
777 func_relative_path_tcancelled=$func_stripname_result
778 if test -z "$func_relative_path_result"; then
779 func_relative_path_result=.
780 fi
781 break
782 ;;
783 *)
784 func_dirname $func_relative_path_tlibdir
785 func_relative_path_tlibdir=${func_dirname_result}
786 if test "x$func_relative_path_tlibdir" = x ; then
787 # Have to descend all the way to the root!
788 func_relative_path_result=../$func_relative_path_result
789 func_relative_path_tcancelled=$func_relative_path_tbindir
790 break
791 fi
792 func_relative_path_result=../$func_relative_path_result
793 ;;
794 esac
795 done
796
797 # Now calculate path; take care to avoid doubling-up slashes.
798 func_stripname '' '/' "$func_relative_path_result"
799 func_relative_path_result=$func_stripname_result
800 func_stripname '/' '/' "$func_relative_path_tcancelled"
801 if test "x$func_stripname_result" != x ; then
802 func_relative_path_result=${func_relative_path_result}/${func_stripname_result}
803 fi
804
805 # Normalisation. If bindir is libdir, return empty string,
806 # else relative path ending with a slash; either way, target
807 # file name can be directly appended.
808 if test ! -z "$func_relative_path_result"; then
809 func_stripname './' '' "$func_relative_path_result/"
810 func_relative_path_result=$func_stripname_result
811 fi
812}
cristy3ed852e2009-09-05 21:47:34 +0000813
814# The name of this program:
cristy3ed852e2009-09-05 21:47:34 +0000815func_dirname_and_basename "$progpath"
816progname=$func_basename_result
cristy3ed852e2009-09-05 21:47:34 +0000817
818# Make sure we have an absolute path for reexecution:
819case $progpath in
820 [\\/]*|[A-Za-z]:\\*) ;;
821 *[\\/]*)
822 progdir=$func_dirname_result
823 progdir=`cd "$progdir" && pwd`
824 progpath="$progdir/$progname"
825 ;;
826 *)
827 save_IFS="$IFS"
cristy2542fc62011-12-06 17:50:25 +0000828 IFS=${PATH_SEPARATOR-:}
cristy3ed852e2009-09-05 21:47:34 +0000829 for progdir in $PATH; do
830 IFS="$save_IFS"
831 test -x "$progdir/$progname" && break
832 done
833 IFS="$save_IFS"
834 test -n "$progdir" || progdir=`pwd`
835 progpath="$progdir/$progname"
836 ;;
837esac
838
839# Sed substitution that helps us do robust quoting. It backslashifies
840# metacharacters that are still active within double-quoted strings.
841Xsed="${SED}"' -e 1s/^X//'
842sed_quote_subst='s/\([`"$\\]\)/\\\1/g'
843
844# Same as above, but do not quote variable references.
845double_quote_subst='s/\(["`\\]\)/\\\1/g'
846
cristyda16f162011-02-19 23:52:17 +0000847# Sed substitution that turns a string into a regex matching for the
848# string literally.
849sed_make_literal_regex='s,[].[^$\\*\/],\\&,g'
850
851# Sed substitution that converts a w32 file name or path
852# which contains forward slashes, into one that contains
853# (escaped) backslashes. A very naive implementation.
854lt_sed_naive_backslashify='s|\\\\*|\\|g;s|/|\\|g;s|\\|\\\\|g'
855
cristy3ed852e2009-09-05 21:47:34 +0000856# Re-`\' parameter expansions in output of double_quote_subst that were
857# `\'-ed in input to the same. If an odd number of `\' preceded a '$'
858# in input to double_quote_subst, that '$' was protected from expansion.
859# Since each input `\' is now two `\'s, look for any number of runs of
860# four `\'s followed by two `\'s and then a '$'. `\' that '$'.
861bs='\\'
862bs2='\\\\'
863bs4='\\\\\\\\'
864dollar='\$'
865sed_double_backslash="\
866 s/$bs4/&\\
867/g
868 s/^$bs2$dollar/$bs&/
869 s/\\([^$bs]\\)$bs2$dollar/\\1$bs2$bs$dollar/g
870 s/\n//g"
871
872# Standard options:
873opt_dry_run=false
874opt_help=false
875opt_quiet=false
876opt_verbose=false
877opt_warning=:
878
879# func_echo arg...
880# Echo program name prefixed message, along with the current mode
881# name if it has been set yet.
882func_echo ()
883{
cristyda16f162011-02-19 23:52:17 +0000884 $ECHO "$progname: ${opt_mode+$opt_mode: }$*"
cristy3ed852e2009-09-05 21:47:34 +0000885}
886
887# func_verbose arg...
888# Echo program name prefixed message in verbose mode only.
889func_verbose ()
890{
891 $opt_verbose && func_echo ${1+"$@"}
892
893 # A bug in bash halts the script if the last line of a function
894 # fails when set -e is in force, so we need another command to
895 # work around that:
896 :
897}
898
cristy98dddb52010-11-04 00:30:15 +0000899# func_echo_all arg...
900# Invoke $ECHO with all args, space-separated.
901func_echo_all ()
902{
903 $ECHO "$*"
904}
905
cristy3ed852e2009-09-05 21:47:34 +0000906# func_error arg...
907# Echo program name prefixed message to standard error.
908func_error ()
909{
cristyda16f162011-02-19 23:52:17 +0000910 $ECHO "$progname: ${opt_mode+$opt_mode: }"${1+"$@"} 1>&2
cristy3ed852e2009-09-05 21:47:34 +0000911}
912
913# func_warning arg...
914# Echo program name prefixed warning message to standard error.
915func_warning ()
916{
cristyda16f162011-02-19 23:52:17 +0000917 $opt_warning && $ECHO "$progname: ${opt_mode+$opt_mode: }warning: "${1+"$@"} 1>&2
cristy3ed852e2009-09-05 21:47:34 +0000918
919 # bash bug again:
920 :
921}
922
923# func_fatal_error arg...
924# Echo program name prefixed message to standard error, and exit.
925func_fatal_error ()
926{
927 func_error ${1+"$@"}
928 exit $EXIT_FAILURE
929}
930
931# func_fatal_help arg...
932# Echo program name prefixed message to standard error, followed by
933# a help hint, and exit.
934func_fatal_help ()
935{
936 func_error ${1+"$@"}
937 func_fatal_error "$help"
938}
939help="Try \`$progname --help' for more information." ## default
940
941
942# func_grep expression filename
943# Check whether EXPRESSION matches any line of FILENAME, without output.
944func_grep ()
945{
946 $GREP "$1" "$2" >/dev/null 2>&1
947}
948
949
950# func_mkdir_p directory-path
951# Make sure the entire path to DIRECTORY-PATH is available.
952func_mkdir_p ()
953{
954 my_directory_path="$1"
955 my_dir_list=
956
957 if test -n "$my_directory_path" && test "$opt_dry_run" != ":"; then
958
959 # Protect directory names starting with `-'
960 case $my_directory_path in
961 -*) my_directory_path="./$my_directory_path" ;;
962 esac
963
964 # While some portion of DIR does not yet exist...
965 while test ! -d "$my_directory_path"; do
966 # ...make a list in topmost first order. Use a colon delimited
967 # list incase some portion of path contains whitespace.
968 my_dir_list="$my_directory_path:$my_dir_list"
969
970 # If the last portion added has no slash in it, the list is done
971 case $my_directory_path in */*) ;; *) break ;; esac
972
973 # ...otherwise throw away the child directory and loop
cristy98dddb52010-11-04 00:30:15 +0000974 my_directory_path=`$ECHO "$my_directory_path" | $SED -e "$dirname"`
cristy3ed852e2009-09-05 21:47:34 +0000975 done
cristy98dddb52010-11-04 00:30:15 +0000976 my_dir_list=`$ECHO "$my_dir_list" | $SED 's,:*$,,'`
cristy3ed852e2009-09-05 21:47:34 +0000977
978 save_mkdir_p_IFS="$IFS"; IFS=':'
979 for my_dir in $my_dir_list; do
980 IFS="$save_mkdir_p_IFS"
981 # mkdir can fail with a `File exist' error if two processes
982 # try to create one of the directories concurrently. Don't
983 # stop in that case!
984 $MKDIR "$my_dir" 2>/dev/null || :
985 done
986 IFS="$save_mkdir_p_IFS"
987
988 # Bail out if we (or some other process) failed to create a directory.
989 test -d "$my_directory_path" || \
990 func_fatal_error "Failed to create \`$1'"
991 fi
992}
993
994
995# func_mktempdir [string]
996# Make a temporary directory that won't clash with other running
997# libtool processes, and avoids race conditions if possible. If
998# given, STRING is the basename for that directory.
999func_mktempdir ()
1000{
1001 my_template="${TMPDIR-/tmp}/${1-$progname}"
1002
1003 if test "$opt_dry_run" = ":"; then
1004 # Return a directory name, but don't create it in dry-run mode
1005 my_tmpdir="${my_template}-$$"
1006 else
1007
1008 # If mktemp works, use that first and foremost
1009 my_tmpdir=`mktemp -d "${my_template}-XXXXXXXX" 2>/dev/null`
1010
1011 if test ! -d "$my_tmpdir"; then
1012 # Failing that, at least try and use $RANDOM to avoid a race
1013 my_tmpdir="${my_template}-${RANDOM-0}$$"
1014
1015 save_mktempdir_umask=`umask`
1016 umask 0077
1017 $MKDIR "$my_tmpdir"
1018 umask $save_mktempdir_umask
1019 fi
1020
1021 # If we're not in dry-run mode, bomb out on failure
1022 test -d "$my_tmpdir" || \
1023 func_fatal_error "cannot create temporary directory \`$my_tmpdir'"
1024 fi
1025
cristy98dddb52010-11-04 00:30:15 +00001026 $ECHO "$my_tmpdir"
cristy3ed852e2009-09-05 21:47:34 +00001027}
1028
1029
1030# func_quote_for_eval arg
1031# Aesthetically quote ARG to be evaled later.
1032# This function returns two values: FUNC_QUOTE_FOR_EVAL_RESULT
1033# is double-quoted, suitable for a subsequent eval, whereas
1034# FUNC_QUOTE_FOR_EVAL_UNQUOTED_RESULT has merely all characters
1035# which are still active within double quotes backslashified.
1036func_quote_for_eval ()
1037{
1038 case $1 in
1039 *[\\\`\"\$]*)
cristy98dddb52010-11-04 00:30:15 +00001040 func_quote_for_eval_unquoted_result=`$ECHO "$1" | $SED "$sed_quote_subst"` ;;
cristy3ed852e2009-09-05 21:47:34 +00001041 *)
1042 func_quote_for_eval_unquoted_result="$1" ;;
1043 esac
1044
1045 case $func_quote_for_eval_unquoted_result in
1046 # Double-quote args containing shell metacharacters to delay
1047 # word splitting, command substitution and and variable
1048 # expansion for a subsequent eval.
1049 # Many Bourne shells cannot handle close brackets correctly
1050 # in scan sets, so we specify it separately.
1051 *[\[\~\#\^\&\*\(\)\{\}\|\;\<\>\?\'\ \ ]*|*]*|"")
1052 func_quote_for_eval_result="\"$func_quote_for_eval_unquoted_result\""
1053 ;;
1054 *)
1055 func_quote_for_eval_result="$func_quote_for_eval_unquoted_result"
1056 esac
1057}
1058
1059
1060# func_quote_for_expand arg
1061# Aesthetically quote ARG to be evaled later; same as above,
1062# but do not quote variable references.
1063func_quote_for_expand ()
1064{
1065 case $1 in
1066 *[\\\`\"]*)
cristy98dddb52010-11-04 00:30:15 +00001067 my_arg=`$ECHO "$1" | $SED \
cristy3ed852e2009-09-05 21:47:34 +00001068 -e "$double_quote_subst" -e "$sed_double_backslash"` ;;
1069 *)
1070 my_arg="$1" ;;
1071 esac
1072
1073 case $my_arg in
1074 # Double-quote args containing shell metacharacters to delay
1075 # word splitting and command substitution for a subsequent eval.
1076 # Many Bourne shells cannot handle close brackets correctly
1077 # in scan sets, so we specify it separately.
1078 *[\[\~\#\^\&\*\(\)\{\}\|\;\<\>\?\'\ \ ]*|*]*|"")
1079 my_arg="\"$my_arg\""
1080 ;;
1081 esac
1082
1083 func_quote_for_expand_result="$my_arg"
1084}
1085
1086
1087# func_show_eval cmd [fail_exp]
1088# Unless opt_silent is true, then output CMD. Then, if opt_dryrun is
1089# not true, evaluate CMD. If the evaluation of CMD fails, and FAIL_EXP
1090# is given, then evaluate it.
1091func_show_eval ()
1092{
1093 my_cmd="$1"
1094 my_fail_exp="${2-:}"
1095
1096 ${opt_silent-false} || {
1097 func_quote_for_expand "$my_cmd"
1098 eval "func_echo $func_quote_for_expand_result"
1099 }
1100
1101 if ${opt_dry_run-false}; then :; else
1102 eval "$my_cmd"
1103 my_status=$?
1104 if test "$my_status" -eq 0; then :; else
1105 eval "(exit $my_status); $my_fail_exp"
1106 fi
1107 fi
1108}
1109
1110
1111# func_show_eval_locale cmd [fail_exp]
1112# Unless opt_silent is true, then output CMD. Then, if opt_dryrun is
1113# not true, evaluate CMD. If the evaluation of CMD fails, and FAIL_EXP
1114# is given, then evaluate it. Use the saved locale for evaluation.
1115func_show_eval_locale ()
1116{
1117 my_cmd="$1"
1118 my_fail_exp="${2-:}"
1119
1120 ${opt_silent-false} || {
1121 func_quote_for_expand "$my_cmd"
1122 eval "func_echo $func_quote_for_expand_result"
1123 }
1124
1125 if ${opt_dry_run-false}; then :; else
1126 eval "$lt_user_locale
1127 $my_cmd"
1128 my_status=$?
1129 eval "$lt_safe_locale"
1130 if test "$my_status" -eq 0; then :; else
1131 eval "(exit $my_status); $my_fail_exp"
1132 fi
1133 fi
1134}
1135
cristyda16f162011-02-19 23:52:17 +00001136# func_tr_sh
1137# Turn $1 into a string suitable for a shell variable name.
1138# Result is stored in $func_tr_sh_result. All characters
1139# not in the set a-zA-Z0-9_ are replaced with '_'. Further,
1140# if $1 begins with a digit, a '_' is prepended as well.
1141func_tr_sh ()
1142{
1143 case $1 in
1144 [0-9]* | *[!a-zA-Z0-9_]*)
1145 func_tr_sh_result=`$ECHO "$1" | $SED 's/^\([0-9]\)/_\1/; s/[^a-zA-Z0-9_]/_/g'`
1146 ;;
1147 * )
1148 func_tr_sh_result=$1
1149 ;;
1150 esac
1151}
1152
cristy3ed852e2009-09-05 21:47:34 +00001153
cristy3ed852e2009-09-05 21:47:34 +00001154# func_version
1155# Echo version message to standard output and exit.
1156func_version ()
1157{
cristyda16f162011-02-19 23:52:17 +00001158 $opt_debug
1159
cristy98dddb52010-11-04 00:30:15 +00001160 $SED -n '/(C)/!b go
1161 :more
1162 /\./!{
1163 N
1164 s/\n# / /
1165 b more
1166 }
1167 :go
1168 /^# '$PROGRAM' (GNU /,/# warranty; / {
cristy3ed852e2009-09-05 21:47:34 +00001169 s/^# //
1170 s/^# *$//
1171 s/\((C)\)[ 0-9,-]*\( [1-9][0-9]*\)/\1\2/
1172 p
1173 }' < "$progpath"
1174 exit $?
1175}
1176
1177# func_usage
1178# Echo short help message to standard output and exit.
1179func_usage ()
1180{
cristyda16f162011-02-19 23:52:17 +00001181 $opt_debug
1182
cristy98dddb52010-11-04 00:30:15 +00001183 $SED -n '/^# Usage:/,/^# *.*--help/ {
cristy3ed852e2009-09-05 21:47:34 +00001184 s/^# //
1185 s/^# *$//
1186 s/\$progname/'$progname'/
1187 p
1188 }' < "$progpath"
cristy98dddb52010-11-04 00:30:15 +00001189 echo
cristy3ed852e2009-09-05 21:47:34 +00001190 $ECHO "run \`$progname --help | more' for full usage"
1191 exit $?
1192}
1193
cristy98dddb52010-11-04 00:30:15 +00001194# func_help [NOEXIT]
1195# Echo long help message to standard output and exit,
1196# unless 'noexit' is passed as argument.
cristy3ed852e2009-09-05 21:47:34 +00001197func_help ()
1198{
cristyda16f162011-02-19 23:52:17 +00001199 $opt_debug
1200
cristy3ed852e2009-09-05 21:47:34 +00001201 $SED -n '/^# Usage:/,/# Report bugs to/ {
cristyda16f162011-02-19 23:52:17 +00001202 :print
cristy3ed852e2009-09-05 21:47:34 +00001203 s/^# //
1204 s/^# *$//
1205 s*\$progname*'$progname'*
1206 s*\$host*'"$host"'*
1207 s*\$SHELL*'"$SHELL"'*
1208 s*\$LTCC*'"$LTCC"'*
1209 s*\$LTCFLAGS*'"$LTCFLAGS"'*
1210 s*\$LD*'"$LD"'*
1211 s/\$with_gnu_ld/'"$with_gnu_ld"'/
cristy2542fc62011-12-06 17:50:25 +00001212 s/\$automake_version/'"`(${AUTOMAKE-automake} --version) 2>/dev/null |$SED 1q`"'/
1213 s/\$autoconf_version/'"`(${AUTOCONF-autoconf} --version) 2>/dev/null |$SED 1q`"'/
cristy3ed852e2009-09-05 21:47:34 +00001214 p
cristyda16f162011-02-19 23:52:17 +00001215 d
1216 }
1217 /^# .* home page:/b print
1218 /^# General help using/b print
1219 ' < "$progpath"
cristy98dddb52010-11-04 00:30:15 +00001220 ret=$?
1221 if test -z "$1"; then
1222 exit $ret
1223 fi
cristy3ed852e2009-09-05 21:47:34 +00001224}
1225
1226# func_missing_arg argname
1227# Echo program name prefixed message to standard error and set global
1228# exit_cmd.
1229func_missing_arg ()
1230{
cristyda16f162011-02-19 23:52:17 +00001231 $opt_debug
1232
cristy98dddb52010-11-04 00:30:15 +00001233 func_error "missing argument for $1."
cristy3ed852e2009-09-05 21:47:34 +00001234 exit_cmd=exit
1235}
1236
cristy3ed852e2009-09-05 21:47:34 +00001237
cristyda16f162011-02-19 23:52:17 +00001238# func_split_short_opt shortopt
1239# Set func_split_short_opt_name and func_split_short_opt_arg shell
1240# variables after splitting SHORTOPT after the 2nd character.
1241func_split_short_opt ()
1242{
1243 func_split_short_opt_arg=${1#??}
1244 func_split_short_opt_name=${1%"$func_split_short_opt_arg"}
1245} # Extended-shell func_split_short_opt implementation
1246
1247
1248# func_split_long_opt longopt
1249# Set func_split_long_opt_name and func_split_long_opt_arg shell
1250# variables after splitting LONGOPT at the `=' sign.
1251func_split_long_opt ()
1252{
1253 func_split_long_opt_name=${1%%=*}
1254 func_split_long_opt_arg=${1#*=}
1255} # Extended-shell func_split_long_opt implementation
1256
1257exit_cmd=:
cristy3ed852e2009-09-05 21:47:34 +00001258
1259
1260
1261
cristy3ed852e2009-09-05 21:47:34 +00001262
1263magic="%%%MAGIC variable%%%"
1264magic_exe="%%%MAGIC EXE variable%%%"
1265
1266# Global variables.
cristy3ed852e2009-09-05 21:47:34 +00001267nonopt=
cristy3ed852e2009-09-05 21:47:34 +00001268preserve_args=
1269lo2o="s/\\.lo\$/.${objext}/"
1270o2lo="s/\\.${objext}\$/.lo/"
1271extracted_archives=
1272extracted_serial=0
1273
cristy3ed852e2009-09-05 21:47:34 +00001274# If this variable is set in any of the actions, the command in it
1275# will be execed at the end. This prevents here-documents from being
1276# left over by shells.
1277exec_cmd=
1278
cristyda16f162011-02-19 23:52:17 +00001279# func_append var value
1280# Append VALUE to the end of shell variable VAR.
1281func_append ()
1282{
1283 eval "${1}+=\${2}"
1284} # Extended-shell func_append implementation
1285
1286# func_append_quoted var value
1287# Quote VALUE and append to the end of shell variable VAR, separated
1288# by a space.
1289func_append_quoted ()
1290{
1291 func_quote_for_eval "${2}"
1292 eval "${1}+=\\ \$func_quote_for_eval_result"
1293} # Extended-shell func_append_quoted implementation
1294
1295
1296# func_arith arithmetic-term...
1297func_arith ()
1298{
1299 func_arith_result=$(( $* ))
1300} # Extended-shell func_arith implementation
1301
1302
1303# func_len string
1304# STRING may not start with a hyphen.
1305func_len ()
1306{
1307 func_len_result=${#1}
1308} # Extended-shell func_len implementation
1309
1310
1311# func_lo2o object
1312func_lo2o ()
1313{
1314 case ${1} in
1315 *.lo) func_lo2o_result=${1%.lo}.${objext} ;;
1316 *) func_lo2o_result=${1} ;;
1317 esac
1318} # Extended-shell func_lo2o implementation
1319
1320
1321# func_xform libobj-or-source
1322func_xform ()
1323{
1324 func_xform_result=${1%.*}.lo
1325} # Extended-shell func_xform implementation
1326
1327
cristy3ed852e2009-09-05 21:47:34 +00001328# func_fatal_configuration arg...
1329# Echo program name prefixed message to standard error, followed by
1330# a configuration failure hint, and exit.
1331func_fatal_configuration ()
1332{
1333 func_error ${1+"$@"}
1334 func_error "See the $PACKAGE documentation for more information."
1335 func_fatal_error "Fatal configuration error."
1336}
1337
1338
1339# func_config
1340# Display the configuration for all the tags in this script.
1341func_config ()
1342{
1343 re_begincf='^# ### BEGIN LIBTOOL'
1344 re_endcf='^# ### END LIBTOOL'
1345
1346 # Default configuration.
1347 $SED "1,/$re_begincf CONFIG/d;/$re_endcf CONFIG/,\$d" < "$progpath"
1348
1349 # Now print the configurations for the tags.
1350 for tagname in $taglist; do
1351 $SED -n "/$re_begincf TAG CONFIG: $tagname\$/,/$re_endcf TAG CONFIG: $tagname\$/p" < "$progpath"
1352 done
1353
1354 exit $?
1355}
1356
1357# func_features
1358# Display the features supported by this script.
1359func_features ()
1360{
cristy98dddb52010-11-04 00:30:15 +00001361 echo "host: $host"
cristy3ed852e2009-09-05 21:47:34 +00001362 if test "$build_libtool_libs" = yes; then
cristy98dddb52010-11-04 00:30:15 +00001363 echo "enable shared libraries"
cristy3ed852e2009-09-05 21:47:34 +00001364 else
cristy98dddb52010-11-04 00:30:15 +00001365 echo "disable shared libraries"
cristy3ed852e2009-09-05 21:47:34 +00001366 fi
1367 if test "$build_old_libs" = yes; then
cristy98dddb52010-11-04 00:30:15 +00001368 echo "enable static libraries"
cristy3ed852e2009-09-05 21:47:34 +00001369 else
cristy98dddb52010-11-04 00:30:15 +00001370 echo "disable static libraries"
cristy3ed852e2009-09-05 21:47:34 +00001371 fi
1372
1373 exit $?
1374}
1375
1376# func_enable_tag tagname
1377# Verify that TAGNAME is valid, and either flag an error and exit, or
1378# enable the TAGNAME tag. We also add TAGNAME to the global $taglist
1379# variable here.
1380func_enable_tag ()
1381{
1382 # Global variable:
1383 tagname="$1"
1384
1385 re_begincf="^# ### BEGIN LIBTOOL TAG CONFIG: $tagname\$"
1386 re_endcf="^# ### END LIBTOOL TAG CONFIG: $tagname\$"
1387 sed_extractcf="/$re_begincf/,/$re_endcf/p"
1388
1389 # Validate tagname.
1390 case $tagname in
1391 *[!-_A-Za-z0-9,/]*)
1392 func_fatal_error "invalid tag name: $tagname"
1393 ;;
1394 esac
1395
1396 # Don't test for the "default" C tag, as we know it's
1397 # there but not specially marked.
1398 case $tagname in
1399 CC) ;;
1400 *)
1401 if $GREP "$re_begincf" "$progpath" >/dev/null 2>&1; then
1402 taglist="$taglist $tagname"
1403
1404 # Evaluate the configuration. Be careful to quote the path
1405 # and the sed script, to avoid splitting on whitespace, but
1406 # also don't use non-portable quotes within backquotes within
1407 # quotes we have to do it in 2 steps:
1408 extractedcf=`$SED -n -e "$sed_extractcf" < "$progpath"`
1409 eval "$extractedcf"
1410 else
1411 func_error "ignoring unknown tag $tagname"
1412 fi
1413 ;;
1414 esac
1415}
1416
cristy3ed852e2009-09-05 21:47:34 +00001417# func_check_version_match
1418# Ensure that we are using m4 macros, and libtool script from the same
1419# release of libtool.
1420func_check_version_match ()
1421{
1422 if test "$package_revision" != "$macro_revision"; then
1423 if test "$VERSION" != "$macro_version"; then
1424 if test -z "$macro_version"; then
1425 cat >&2 <<_LT_EOF
1426$progname: Version mismatch error. This is $PACKAGE $VERSION, but the
1427$progname: definition of this LT_INIT comes from an older release.
1428$progname: You should recreate aclocal.m4 with macros from $PACKAGE $VERSION
1429$progname: and run autoconf again.
1430_LT_EOF
1431 else
1432 cat >&2 <<_LT_EOF
1433$progname: Version mismatch error. This is $PACKAGE $VERSION, but the
1434$progname: definition of this LT_INIT comes from $PACKAGE $macro_version.
1435$progname: You should recreate aclocal.m4 with macros from $PACKAGE $VERSION
1436$progname: and run autoconf again.
1437_LT_EOF
1438 fi
1439 else
1440 cat >&2 <<_LT_EOF
1441$progname: Version mismatch error. This is $PACKAGE $VERSION, revision $package_revision,
1442$progname: but the definition of this LT_INIT comes from revision $macro_revision.
1443$progname: You should recreate aclocal.m4 with macros from revision $package_revision
1444$progname: of $PACKAGE $VERSION and run autoconf again.
1445_LT_EOF
1446 fi
1447
1448 exit $EXIT_MISMATCH
1449 fi
1450}
1451
1452
cristyda16f162011-02-19 23:52:17 +00001453# Shorthand for --mode=foo, only valid as the first argument
1454case $1 in
1455clean|clea|cle|cl)
1456 shift; set dummy --mode clean ${1+"$@"}; shift
1457 ;;
1458compile|compil|compi|comp|com|co|c)
1459 shift; set dummy --mode compile ${1+"$@"}; shift
1460 ;;
1461execute|execut|execu|exec|exe|ex|e)
1462 shift; set dummy --mode execute ${1+"$@"}; shift
1463 ;;
1464finish|finis|fini|fin|fi|f)
1465 shift; set dummy --mode finish ${1+"$@"}; shift
1466 ;;
1467install|instal|insta|inst|ins|in|i)
1468 shift; set dummy --mode install ${1+"$@"}; shift
1469 ;;
1470link|lin|li|l)
1471 shift; set dummy --mode link ${1+"$@"}; shift
1472 ;;
1473uninstall|uninstal|uninsta|uninst|unins|unin|uni|un|u)
1474 shift; set dummy --mode uninstall ${1+"$@"}; shift
1475 ;;
1476esac
1477
1478
1479
1480# Option defaults:
1481opt_debug=:
1482opt_dry_run=false
1483opt_config=false
1484opt_preserve_dup_deps=false
1485opt_features=false
1486opt_finish=false
1487opt_help=false
1488opt_help_all=false
1489opt_silent=:
cristy2542fc62011-12-06 17:50:25 +00001490opt_warning=:
cristyda16f162011-02-19 23:52:17 +00001491opt_verbose=:
1492opt_silent=false
1493opt_verbose=false
1494
1495
1496# Parse options once, thoroughly. This comes as soon as possible in the
1497# script to make things like `--version' happen as quickly as we can.
1498{
1499 # this just eases exit handling
1500 while test $# -gt 0; do
1501 opt="$1"
1502 shift
1503 case $opt in
1504 --debug|-x) opt_debug='set -x'
1505 func_echo "enabling shell trace mode"
1506 $opt_debug
1507 ;;
1508 --dry-run|--dryrun|-n)
1509 opt_dry_run=:
1510 ;;
1511 --config)
1512 opt_config=:
1513func_config
1514 ;;
1515 --dlopen|-dlopen)
1516 optarg="$1"
1517 opt_dlopen="${opt_dlopen+$opt_dlopen
1518}$optarg"
1519 shift
1520 ;;
1521 --preserve-dup-deps)
1522 opt_preserve_dup_deps=:
1523 ;;
1524 --features)
1525 opt_features=:
1526func_features
1527 ;;
1528 --finish)
1529 opt_finish=:
1530set dummy --mode finish ${1+"$@"}; shift
1531 ;;
1532 --help)
1533 opt_help=:
1534 ;;
1535 --help-all)
1536 opt_help_all=:
1537opt_help=': help-all'
1538 ;;
1539 --mode)
1540 test $# = 0 && func_missing_arg $opt && break
1541 optarg="$1"
1542 opt_mode="$optarg"
1543case $optarg in
1544 # Valid mode arguments:
1545 clean|compile|execute|finish|install|link|relink|uninstall) ;;
1546
1547 # Catch anything else as an error
1548 *) func_error "invalid argument for $opt"
1549 exit_cmd=exit
1550 break
1551 ;;
1552esac
1553 shift
1554 ;;
1555 --no-silent|--no-quiet)
1556 opt_silent=false
1557preserve_args+=" $opt"
1558 ;;
cristy2542fc62011-12-06 17:50:25 +00001559 --no-warning|--no-warn)
1560 opt_warning=false
1561preserve_args+=" $opt"
1562 ;;
cristyda16f162011-02-19 23:52:17 +00001563 --no-verbose)
1564 opt_verbose=false
1565preserve_args+=" $opt"
1566 ;;
1567 --silent|--quiet)
1568 opt_silent=:
1569preserve_args+=" $opt"
1570 opt_verbose=false
1571 ;;
1572 --verbose|-v)
1573 opt_verbose=:
1574preserve_args+=" $opt"
1575opt_silent=false
1576 ;;
1577 --tag)
1578 test $# = 0 && func_missing_arg $opt && break
1579 optarg="$1"
1580 opt_tag="$optarg"
1581preserve_args+=" $opt $optarg"
1582func_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
cristy3ed852e2009-09-05 21:47:34 +00001662## ----------- ##
1663## Main. ##
1664## ----------- ##
1665
cristy3ed852e2009-09-05 21:47:34 +00001666# 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.
1670func_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.
1684func_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.
1704func_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.
1713func_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.
1727func_ltwrapper_scriptname ()
1728{
cristyda16f162011-02-19 23:52:17 +00001729 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"
cristy3ed852e2009-09-05 21:47:34 +00001732}
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.
1738func_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!
1748func_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.
1767func_source ()
1768{
1769 $opt_debug
1770 case $1 in
1771 */* | *\\*) . "$1" ;;
1772 *) . "./$1" ;;
1773 esac
1774}
1775
1776
cristyda16f162011-02-19 23:52:17 +00001777# func_resolve_sysroot PATH
1778# Replace a leading = in PATH with a sysroot. Store the result into
1779# func_resolve_sysroot_result
1780func_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.
1794func_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
cristy3ed852e2009-09-05 21:47:34 +00001808# 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 ...'
1814func_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
cristyda16f162011-02-19 23:52:17 +00001820 func_append_quoted CC_quoted "$arg"
cristy3ed852e2009-09-05 21:47:34 +00001821 done
cristy98dddb52010-11-04 00:30:15 +00001822 CC_expanded=`func_echo_all $CC`
1823 CC_quoted_expanded=`func_echo_all $CC_quoted`
cristy3ed852e2009-09-05 21:47:34 +00001824 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.
cristy98dddb52010-11-04 00:30:15 +00001827 " $CC "* | "$CC "* | " $CC_expanded "* | "$CC_expanded "* | \
1828 " $CC_quoted"* | "$CC_quoted "* | " $CC_quoted_expanded "* | "$CC_quoted_expanded "*) ;;
cristy3ed852e2009-09-05 21:47:34 +00001829 # 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.
cristyda16f162011-02-19 23:52:17 +00001839 func_append_quoted CC_quoted "$arg"
cristy3ed852e2009-09-05 21:47:34 +00001840 done
cristy98dddb52010-11-04 00:30:15 +00001841 CC_expanded=`func_echo_all $CC`
1842 CC_quoted_expanded=`func_echo_all $CC_quoted`
cristy3ed852e2009-09-05 21:47:34 +00001843 case "$@ " in
cristy98dddb52010-11-04 00:30:15 +00001844 " $CC "* | "$CC "* | " $CC_expanded "* | "$CC_expanded "* | \
1845 " $CC_quoted"* | "$CC_quoted "* | " $CC_quoted_expanded "* | "$CC_quoted_expanded "*)
cristy3ed852e2009-09-05 21:47:34 +00001846 # 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.
1874func_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.
1898pic_object=$write_lobj
1899
1900# Name of the non-PIC object
1901non_pic_object=$write_oldobj
1902
1903EOF
1904 $MV "${write_libobj}T" "${write_libobj}"
1905 }
1906}
1907
cristyda16f162011-02-19 23:52:17 +00001908
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)
1922func_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.
1954func_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.
1994func_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.
2014func_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).
2028func_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).
2046func_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.
2070func_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.
2097func_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.
2109func_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.
2127func_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.
2138func_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.
2154func_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.
2171func_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.
2187func_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.
2205func_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.
2244to_host_path_cmd=
2245func_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.
2258func_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.
2269func_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.
2280func_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.
2303func_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.
2323func_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.
2344func_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.
2367func_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
cristy3ed852e2009-09-05 21:47:34 +00002388# func_mode_compile arg...
2389func_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)
cristyda16f162011-02-19 23:52:17 +00002428 pie_flag+=" $arg"
cristy3ed852e2009-09-05 21:47:34 +00002429 continue
2430 ;;
2431
2432 -shared | -static | -prefer-pic | -prefer-non-pic)
cristyda16f162011-02-19 23:52:17 +00002433 later+=" $arg"
cristy3ed852e2009-09-05 21:47:34 +00002434 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"
cristyda16f162011-02-19 23:52:17 +00002454 func_append_quoted lastarg "$arg"
cristy3ed852e2009-09-05 21:47:34 +00002455 done
2456 IFS="$save_ifs"
2457 func_stripname ' ' '' "$lastarg"
2458 lastarg=$func_stripname_result
2459
2460 # Add the arguments to base_compile.
cristyda16f162011-02-19 23:52:17 +00002461 base_compile+=" $lastarg"
cristy3ed852e2009-09-05 21:47:34 +00002462 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.
cristyda16f162011-02-19 23:52:17 +00002477 func_append_quoted base_compile "$lastarg"
cristy3ed852e2009-09-05 21:47:34 +00002478 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 | \
cristy2542fc62011-12-06 17:50:25 +00002502 *.[fF][09]? | *.for | *.java | *.go | *.obj | *.sx | *.cu | *.cup)
cristy3ed852e2009-09-05 21:47:34 +00002503 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
cristy98dddb52010-11-04 00:30:15 +00002577 output_obj=`$ECHO "$srcfile" | $SED 's%^.*/%%; s%\.[^.]*$%%'`.${objext}
cristy3ed852e2009-09-05 21:47:34 +00002578 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
2598This indicates that another process is trying to use the same
2599temporary object file, and libtool could not work around it because
2600your compiler does not support \`-c' and \`-o' together. If you
2601repeat this compilation, it may succeed, by chance, but you had better
2602avoid parallel builds (make -j) in this platform, or get a better
2603compiler."
2604
2605 $opt_dry_run || $RM $removelist
2606 exit $EXIT_FAILURE
2607 fi
cristyda16f162011-02-19 23:52:17 +00002608 removelist+=" $output_obj"
cristy3ed852e2009-09-05 21:47:34 +00002609 $ECHO "$srcfile" > "$lockfile"
2610 fi
2611
2612 $opt_dry_run || $RM $removelist
cristyda16f162011-02-19 23:52:17 +00002613 removelist+=" $lockfile"
cristy3ed852e2009-09-05 21:47:34 +00002614 trap '$opt_dry_run || $RM $removelist; exit $EXIT_FAILURE' 1 2 15
2615
cristyda16f162011-02-19 23:52:17 +00002616 func_to_tool_file "$srcfile" func_convert_file_msys_to_w32
2617 srcfile=$func_to_tool_file_result
cristy3ed852e2009-09-05 21:47:34 +00002618 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
cristyda16f162011-02-19 23:52:17 +00002637 command+=" -o $lobj"
cristy3ed852e2009-09-05 21:47:34 +00002638 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
2649but it should contain:
2650$srcfile
2651
2652This indicates that another process is trying to use the same
2653temporary object file, and libtool could not work around it because
2654your compiler does not support \`-c' and \`-o' together. If you
2655repeat this compilation, it may succeed, by chance, but you had better
2656avoid parallel builds (make -j) in this platform, or get a better
2657compiler."
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
cristyda16f162011-02-19 23:52:17 +00002684 command+=" -o $obj"
cristy3ed852e2009-09-05 21:47:34 +00002685 fi
2686
2687 # Suppress compiler output if we already did a PIC compilation.
cristyda16f162011-02-19 23:52:17 +00002688 command+="$suppress_output"
cristy3ed852e2009-09-05 21:47:34 +00002689 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
2698but it should contain:
2699$srcfile
2700
2701This indicates that another process is trying to use the same
2702temporary object file, and libtool could not work around it because
2703your compiler does not support \`-c' and \`-o' together. If you
2704repeat this compilation, it may succeed, by chance, but you had better
2705avoid parallel builds (make -j) in this platform, or get a better
2706compiler."
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 || {
cristyda16f162011-02-19 23:52:17 +00002733 test "$opt_mode" = compile && func_mode_compile ${1+"$@"}
cristy3ed852e2009-09-05 21:47:34 +00002734}
2735
2736func_mode_help ()
2737{
2738 # We need to display help for each of the modes.
cristyda16f162011-02-19 23:52:17 +00002739 case $opt_mode in
cristy3ed852e2009-09-05 21:47:34 +00002740 "")
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
2750Remove files from the build directory.
2751
2752RM 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
2754to RM.
2755
2756If FILE is a libtool library, object or program, all the files associated
2757with 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
2764Compile a source file into a libtool library object.
2765
2766This 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
cristy98dddb52010-11-04 00:30:15 +00002770 -prefer-pic try to build PIC objects only
2771 -prefer-non-pic try to build non-PIC objects only
cristy3ed852e2009-09-05 21:47:34 +00002772 -shared do not build a \`.o' file suitable for static linking
2773 -static only build a \`.o' file suitable for static linking
cristy98dddb52010-11-04 00:30:15 +00002774 -Wc,FLAG pass FLAG directly to the compiler
cristy3ed852e2009-09-05 21:47:34 +00002775
2776COMPILE-COMMAND is a command to be used in creating a \`standard' object file
2777from the given SOURCEFILE.
2778
2779The output file name is determined by removing the directory component from
2780SOURCEFILE, then substituting the C source code suffix \`.c' with the
2781library object suffix, \`.lo'."
2782 ;;
2783
2784 execute)
2785 $ECHO \
2786"Usage: $progname [OPTION]... --mode=execute COMMAND [ARGS]...
2787
2788Automatically set library path, then run a program.
2789
2790This mode accepts the following additional options:
2791
2792 -dlopen FILE add the directory containing FILE to the library path
2793
2794This mode sets the library path environment variable according to \`-dlopen'
2795flags.
2796
2797If any of the ARGS are libtool executable wrappers, then they are translated
2798into their corresponding uninstalled binary, and any of their required library
2799directories are added to the library path.
2800
2801Then, COMMAND is executed, with ARGS as arguments."
2802 ;;
2803
2804 finish)
2805 $ECHO \
2806"Usage: $progname [OPTION]... --mode=finish [LIBDIR]...
2807
2808Complete the installation of libtool libraries.
2809
2810Each LIBDIR is a directory that contains libtool libraries.
2811
2812The commands that this mode executes may require superuser privileges. Use
2813the \`--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
2820Install executables or libraries.
2821
2822INSTALL-COMMAND is the installation command. The first component should be
2823either the \`install' or \`cp' program.
2824
2825The following components of INSTALL-COMMAND are treated specially:
2826
cristy98dddb52010-11-04 00:30:15 +00002827 -inst-prefix-dir PREFIX-DIR Use PREFIX-DIR as a staging area for installation
cristy3ed852e2009-09-05 21:47:34 +00002828
2829The rest of the components are interpreted as arguments to that command (only
2830BSD-compatible install options are recognized)."
2831 ;;
2832
2833 link)
2834 $ECHO \
2835"Usage: $progname [OPTION]... --mode=link LINK-COMMAND...
2836
2837Link object files or libraries together to form another library, or to
2838create an executable program.
2839
2840LINK-COMMAND is a command using the C compiler that you would use to create
2841a program from several object files.
2842
2843The 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
cristy98dddb52010-11-04 00:30:15 +00002847 -bindir BINDIR specify path to binaries directory (for systems where
2848 libraries must be found in the PATH setting at runtime)
cristy3ed852e2009-09-05 21:47:34 +00002849 -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
cristy98dddb52010-11-04 00:30:15 +00002877 -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)
cristy3ed852e2009-09-05 21:47:34 +00002882
2883All other options (arguments beginning with \`-') are ignored.
2884
2885Every other argument is treated as a filename. Files ending in \`.la' are
2886treated as uninstalled libtool libraries, other files are standard or library
2887object files.
2888
2889If the OUTPUT-FILE ends in \`.la', then a libtool library is created,
2890only library objects (\`.lo' files) may be specified, and \`-rpath' is
2891required, except when creating a convenience library.
2892
2893If OUTPUT-FILE ends in \`.a' or \`.lib', then a standard library is created
2894using \`ar' and \`ranlib', or on Windows using \`lib'.
2895
2896If OUTPUT-FILE ends in \`.lo' or \`.${objext}', then a reloadable object file
2897is created, otherwise an executable program is created."
2898 ;;
2899
2900 uninstall)
2901 $ECHO \
2902"Usage: $progname [OPTION]... --mode=uninstall RM [RM-OPTION]... FILE...
2903
2904Remove libraries from an installation directory.
2905
2906RM 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
2908to RM.
2909
2910If FILE is a libtool library, all the files associated with it are deleted.
2911Otherwise, only FILE itself is deleted using RM."
2912 ;;
2913
2914 *)
cristyda16f162011-02-19 23:52:17 +00002915 func_fatal_help "invalid operation mode \`$opt_mode'"
cristy3ed852e2009-09-05 21:47:34 +00002916 ;;
2917 esac
2918
cristy98dddb52010-11-04 00:30:15 +00002919 echo
cristy3ed852e2009-09-05 21:47:34 +00002920 $ECHO "Try \`$progname --help' for more information about other modes."
cristy3ed852e2009-09-05 21:47:34 +00002921}
2922
cristy98dddb52010-11-04 00:30:15 +00002923# Now that we've collected a possible --mode arg, show help if necessary
2924if $opt_help; then
2925 if test "$opt_help" = :; then
2926 func_mode_help
2927 else
2928 {
2929 func_help noexit
cristyda16f162011-02-19 23:52:17 +00002930 for opt_mode in compile link execute install finish uninstall clean; do
cristy98dddb52010-11-04 00:30:15 +00002931 func_mode_help
2932 done
2933 } | sed -n '1p; 2,$s/^Usage:/ or: /p'
2934 {
2935 func_help noexit
cristyda16f162011-02-19 23:52:17 +00002936 for opt_mode in compile link execute install finish uninstall clean; do
cristy98dddb52010-11-04 00:30:15 +00002937 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 $?
2952fi
cristy3ed852e2009-09-05 21:47:34 +00002953
2954
2955# func_mode_execute arg...
2956func_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.
cristyda16f162011-02-19 23:52:17 +00002965 for file in $opt_dlopen; do
cristy3ed852e2009-09-05 21:47:34 +00002966 test -f "$file" \
2967 || func_fatal_help "\`$file' is not a file"
2968
2969 dir=
2970 case $file in
2971 *.la)
cristyda16f162011-02-19 23:52:17 +00002972 func_resolve_sysroot "$file"
2973 file=$func_resolve_sysroot_result
2974
cristy3ed852e2009-09-05 21:47:34 +00002975 # 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
cristyda16f162011-02-19 23:52:17 +00002996 dir+="/$objdir"
cristy3ed852e2009-09-05 21:47:34 +00002997 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
cristy98dddb52010-11-04 00:30:15 +00003037 -* | *.la | *.lo ) ;;
cristy3ed852e2009-09-05 21:47:34 +00003038 *)
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).
cristyda16f162011-02-19 23:52:17 +00003053 func_append_quoted args "$file"
cristy3ed852e2009-09-05 21:47:34 +00003054 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\""
cristy98dddb52010-11-04 00:30:15 +00003078 echo "export $shlibpath_var"
cristy3ed852e2009-09-05 21:47:34 +00003079 fi
3080 $ECHO "$cmd$args"
3081 exit $EXIT_SUCCESS
3082 fi
3083}
3084
cristyda16f162011-02-19 23:52:17 +00003085test "$opt_mode" = execute && func_mode_execute ${1+"$@"}
cristy3ed852e2009-09-05 21:47:34 +00003086
3087
3088# func_mode_finish arg...
3089func_mode_finish ()
3090{
3091 $opt_debug
cristyda16f162011-02-19 23:52:17 +00003092 libs=
3093 libdirs=
cristy3ed852e2009-09-05 21:47:34 +00003094 admincmds=
3095
cristyda16f162011-02-19 23:52:17 +00003096 for opt in "$nonopt" ${1+"$@"}
3097 do
3098 if test -d "$opt"; then
3099 libdirs+=" $opt"
cristy3ed852e2009-09-05 21:47:34 +00003100
cristyda16f162011-02-19 23:52:17 +00003101 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
cristy3ed852e2009-09-05 21:47:34 +00003138 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\"
cristyda16f162011-02-19 23:52:17 +00003147 $opt_dry_run || eval "$cmds" || admincmds+="
cristy3ed852e2009-09-05 21:47:34 +00003148 $cmds"
3149 fi
3150 done
3151 fi
3152
3153 # Exit here if they wanted silent mode.
3154 $opt_silent && exit $EXIT_SUCCESS
3155
cristyda16f162011-02-19 23:52:17 +00003156 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\"
cristy3ed852e2009-09-05 21:47:34 +00003178
cristyda16f162011-02-19 23:52:17 +00003179 $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
cristy3ed852e2009-09-05 21:47:34 +00003188
cristyda16f162011-02-19 23:52:17 +00003189 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
cristy3ed852e2009-09-05 21:47:34 +00003201 exit $EXIT_SUCCESS
3202}
3203
cristyda16f162011-02-19 23:52:17 +00003204test "$opt_mode" = finish && func_mode_finish ${1+"$@"}
cristy3ed852e2009-09-05 21:47:34 +00003205
3206
3207# func_mode_install arg...
3208func_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.
cristy98dddb52010-11-04 00:30:15 +00003215 case $nonopt in *shtool*) :;; *) false;; esac; then
cristy3ed852e2009-09-05 21:47:34 +00003216 # 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"
cristyda16f162011-02-19 23:52:17 +00003229 install_prog+="$func_quote_for_eval_result"
cristy98dddb52010-11-04 00:30:15 +00003230 install_shared_prog=$install_prog
3231 case " $install_prog " in
3232 *[\\\ /]cp\ *) install_cp=: ;;
3233 *) install_cp=false ;;
3234 esac
cristy3ed852e2009-09-05 21:47:34 +00003235
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=
cristy98dddb52010-11-04 00:30:15 +00003244 no_mode=:
cristy3ed852e2009-09-05 21:47:34 +00003245 for arg
3246 do
cristy98dddb52010-11-04 00:30:15 +00003247 arg2=
cristy3ed852e2009-09-05 21:47:34 +00003248 if test -n "$dest"; then
cristyda16f162011-02-19 23:52:17 +00003249 files+=" $dest"
cristy3ed852e2009-09-05 21:47:34 +00003250 dest=$arg
3251 continue
3252 fi
3253
3254 case $arg in
3255 -d) isdir=yes ;;
3256 -f)
cristy98dddb52010-11-04 00:30:15 +00003257 if $install_cp; then :; else
3258 prev=$arg
3259 fi
cristy3ed852e2009-09-05 21:47:34 +00003260 ;;
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
cristy98dddb52010-11-04 00:30:15 +00003273 if test "x$prev" = x-m && test -n "$install_override_mode"; then
3274 arg2=$install_override_mode
3275 no_mode=false
3276 fi
cristy3ed852e2009-09-05 21:47:34 +00003277 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"
cristyda16f162011-02-19 23:52:17 +00003287 install_prog+=" $func_quote_for_eval_result"
cristy98dddb52010-11-04 00:30:15 +00003288 if test -n "$arg2"; then
3289 func_quote_for_eval "$arg2"
3290 fi
cristyda16f162011-02-19 23:52:17 +00003291 install_shared_prog+=" $func_quote_for_eval_result"
cristy3ed852e2009-09-05 21:47:34 +00003292 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
cristy98dddb52010-11-04 00:30:15 +00003300 if test -n "$install_override_mode" && $no_mode; then
3301 if $install_cp; then :; else
3302 func_quote_for_eval "$install_override_mode"
cristyda16f162011-02-19 23:52:17 +00003303 install_shared_prog+=" -m $func_quote_for_eval_result"
cristy98dddb52010-11-04 00:30:15 +00003304 fi
3305 fi
3306
cristy3ed852e2009-09-05 21:47:34 +00003307 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.
cristyda16f162011-02-19 23:52:17 +00003361 staticlibs+=" $file"
cristy3ed852e2009-09-05 21:47:34 +00003362 ;;
3363
3364 *.la)
cristyda16f162011-02-19 23:52:17 +00003365 func_resolve_sysroot "$file"
3366 file=$func_resolve_sysroot_result
3367
cristy3ed852e2009-09-05 21:47:34 +00003368 # 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 "*) ;;
cristyda16f162011-02-19 23:52:17 +00003381 *) current_libdirs+=" $libdir" ;;
cristy3ed852e2009-09-05 21:47:34 +00003382 esac
3383 else
3384 # Note the libdir as a future libdir.
3385 case "$future_libdirs " in
3386 *" $libdir "*) ;;
cristyda16f162011-02-19 23:52:17 +00003387 *) future_libdirs+=" $libdir" ;;
cristy3ed852e2009-09-05 21:47:34 +00003388 esac
3389 fi
3390
3391 func_dirname "$file" "/" ""
3392 dir="$func_dirname_result"
cristyda16f162011-02-19 23:52:17 +00003393 dir+="$objdir"
cristy3ed852e2009-09-05 21:47:34 +00003394
3395 if test -n "$relink_command"; then
3396 # Determine the prefix the user has applied to our future dir.
cristy98dddb52010-11-04 00:30:15 +00003397 inst_prefix_dir=`$ECHO "$destdir" | $SED -e "s%$libdir\$%%"`
cristy3ed852e2009-09-05 21:47:34 +00003398
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.
cristy98dddb52010-11-04 00:30:15 +00003410 relink_command=`$ECHO "$relink_command" | $SED "s%@inst_prefix_dir@%-inst-prefix-dir $inst_prefix_dir%"`
cristy3ed852e2009-09-05 21:47:34 +00003411 else
cristy98dddb52010-11-04 00:30:15 +00003412 relink_command=`$ECHO "$relink_command" | $SED "s%@inst_prefix_dir@%%"`
cristy3ed852e2009-09-05 21:47:34 +00003413 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.
cristy98dddb52010-11-04 00:30:15 +00003430 func_show_eval "$install_shared_prog $dir/$srcname $destdir/$realname" \
cristy3ed852e2009-09-05 21:47:34 +00003431 '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.
cristyda16f162011-02-19 23:52:17 +00003470 test -n "$old_library" && staticlibs+=" $dir/$old_library"
cristy3ed852e2009-09-05 21:47:34 +00003471 ;;
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
cristy98dddb52010-11-04 00:30:15 +00003570 libfile="$libdir/"`$ECHO "$lib" | $SED 's%^.*/%%g'` ### testsuite: skip nested quoting test
cristy3ed852e2009-09-05 21:47:34 +00003571 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.
cristy98dddb52010-11-04 00:30:15 +00003589 relink_command=`$ECHO "$relink_command" | $SED 's%@OUTPUT@%'"$outputname"'%g'`
cristy3ed852e2009-09-05 21:47:34 +00003590
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.
cristy98dddb52010-11-04 00:30:15 +00003608 file=`$ECHO "$file$stripped_ext" | $SED "s%\([^/]*\)$%$objdir/\1%"`
cristy3ed852e2009-09-05 21:47:34 +00003609 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"
cristy2542fc62011-12-06 17:50:25 +00003644 func_to_tool_file "$oldlib" func_convert_file_msys_to_w32
3645 tool_oldlib=$func_to_tool_file_result
cristy3ed852e2009-09-05 21:47:34 +00003646
3647 func_show_eval "$install_prog \$file \$oldlib" 'exit $?'
3648
3649 if test -n "$stripme" && test -n "$old_striplib"; then
cristy2542fc62011-12-06 17:50:25 +00003650 func_show_eval "$old_striplib $tool_oldlib" 'exit $?'
cristy3ed852e2009-09-05 21:47:34 +00003651 fi
3652
3653 # Do each command in the postinstall commands.
3654 func_execute_cmds "$old_postinstall_cmds" 'exit $?'
3655 done
3656
3657 test -n "$future_libdirs" && \
3658 func_warning "remember to run \`$progname --finish$future_libdirs'"
3659
3660 if test -n "$current_libdirs"; then
3661 # Maybe just do a dry run.
3662 $opt_dry_run && current_libdirs=" -n$current_libdirs"
3663 exec_cmd='$SHELL $progpath $preserve_args --finish$current_libdirs'
3664 else
3665 exit $EXIT_SUCCESS
3666 fi
3667}
3668
cristyda16f162011-02-19 23:52:17 +00003669test "$opt_mode" = install && func_mode_install ${1+"$@"}
cristy3ed852e2009-09-05 21:47:34 +00003670
3671
3672# func_generate_dlsyms outputname originator pic_p
3673# Extract symbols from dlprefiles and create ${outputname}S.o with
3674# a dlpreopen symbol table.
3675func_generate_dlsyms ()
3676{
3677 $opt_debug
3678 my_outputname="$1"
3679 my_originator="$2"
3680 my_pic_p="${3-no}"
3681 my_prefix=`$ECHO "$my_originator" | sed 's%[^a-zA-Z0-9]%_%g'`
3682 my_dlsyms=
3683
3684 if test -n "$dlfiles$dlprefiles" || test "$dlself" != no; then
3685 if test -n "$NM" && test -n "$global_symbol_pipe"; then
3686 my_dlsyms="${my_outputname}S.c"
3687 else
3688 func_error "not configured to extract global symbols from dlpreopened files"
3689 fi
3690 fi
3691
3692 if test -n "$my_dlsyms"; then
3693 case $my_dlsyms in
3694 "") ;;
3695 *.c)
3696 # Discover the nlist of each of the dlfiles.
3697 nlist="$output_objdir/${my_outputname}.nm"
3698
3699 func_show_eval "$RM $nlist ${nlist}S ${nlist}T"
3700
3701 # Parse the name list into a source file.
3702 func_verbose "creating $output_objdir/$my_dlsyms"
3703
3704 $opt_dry_run || $ECHO > "$output_objdir/$my_dlsyms" "\
3705/* $my_dlsyms - symbol resolution table for \`$my_outputname' dlsym emulation. */
3706/* Generated by $PROGRAM (GNU $PACKAGE$TIMESTAMP) $VERSION */
3707
3708#ifdef __cplusplus
3709extern \"C\" {
3710#endif
3711
cristy98dddb52010-11-04 00:30:15 +00003712#if defined(__GNUC__) && (((__GNUC__ == 4) && (__GNUC_MINOR__ >= 4)) || (__GNUC__ > 4))
3713#pragma GCC diagnostic ignored \"-Wstrict-prototypes\"
3714#endif
3715
cristyda16f162011-02-19 23:52:17 +00003716/* Keep this code in sync between libtool.m4, ltmain, lt_system.h, and tests. */
3717#if defined(_WIN32) || defined(__CYGWIN__) || defined(_WIN32_WCE)
3718/* DATA imports from DLLs on WIN32 con't be const, because runtime
3719 relocations are performed -- see ld's documentation on pseudo-relocs. */
3720# define LT_DLSYM_CONST
3721#elif defined(__osf__)
3722/* This system does not cope well with relocations in const data. */
3723# define LT_DLSYM_CONST
3724#else
3725# define LT_DLSYM_CONST const
3726#endif
3727
cristy3ed852e2009-09-05 21:47:34 +00003728/* External symbol declarations for the compiler. */\
3729"
3730
3731 if test "$dlself" = yes; then
3732 func_verbose "generating symbol list for \`$output'"
3733
3734 $opt_dry_run || echo ': @PROGRAM@ ' > "$nlist"
3735
3736 # Add our own program objects to the symbol list.
cristy98dddb52010-11-04 00:30:15 +00003737 progfiles=`$ECHO "$objs$old_deplibs" | $SP2NL | $SED "$lo2o" | $NL2SP`
cristy3ed852e2009-09-05 21:47:34 +00003738 for progfile in $progfiles; do
cristyda16f162011-02-19 23:52:17 +00003739 func_to_tool_file "$progfile" func_convert_file_msys_to_w32
3740 func_verbose "extracting global C symbols from \`$func_to_tool_file_result'"
3741 $opt_dry_run || eval "$NM $func_to_tool_file_result | $global_symbol_pipe >> '$nlist'"
cristy3ed852e2009-09-05 21:47:34 +00003742 done
3743
3744 if test -n "$exclude_expsyms"; then
3745 $opt_dry_run || {
3746 eval '$EGREP -v " ($exclude_expsyms)$" "$nlist" > "$nlist"T'
3747 eval '$MV "$nlist"T "$nlist"'
3748 }
3749 fi
3750
3751 if test -n "$export_symbols_regex"; then
3752 $opt_dry_run || {
3753 eval '$EGREP -e "$export_symbols_regex" "$nlist" > "$nlist"T'
3754 eval '$MV "$nlist"T "$nlist"'
3755 }
3756 fi
3757
3758 # Prepare the list of exported symbols
3759 if test -z "$export_symbols"; then
3760 export_symbols="$output_objdir/$outputname.exp"
3761 $opt_dry_run || {
3762 $RM $export_symbols
3763 eval "${SED} -n -e '/^: @PROGRAM@ $/d' -e 's/^.* \(.*\)$/\1/p' "'< "$nlist" > "$export_symbols"'
3764 case $host in
3765 *cygwin* | *mingw* | *cegcc* )
3766 eval "echo EXPORTS "'> "$output_objdir/$outputname.def"'
3767 eval 'cat "$export_symbols" >> "$output_objdir/$outputname.def"'
3768 ;;
3769 esac
3770 }
3771 else
3772 $opt_dry_run || {
3773 eval "${SED} -e 's/\([].[*^$]\)/\\\\\1/g' -e 's/^/ /' -e 's/$/$/'"' < "$export_symbols" > "$output_objdir/$outputname.exp"'
3774 eval '$GREP -f "$output_objdir/$outputname.exp" < "$nlist" > "$nlist"T'
3775 eval '$MV "$nlist"T "$nlist"'
3776 case $host in
cristy98dddb52010-11-04 00:30:15 +00003777 *cygwin* | *mingw* | *cegcc* )
cristy3ed852e2009-09-05 21:47:34 +00003778 eval "echo EXPORTS "'> "$output_objdir/$outputname.def"'
3779 eval 'cat "$nlist" >> "$output_objdir/$outputname.def"'
3780 ;;
3781 esac
3782 }
3783 fi
3784 fi
3785
3786 for dlprefile in $dlprefiles; do
3787 func_verbose "extracting global C symbols from \`$dlprefile'"
3788 func_basename "$dlprefile"
3789 name="$func_basename_result"
cristyda16f162011-02-19 23:52:17 +00003790 case $host in
3791 *cygwin* | *mingw* | *cegcc* )
3792 # if an import library, we need to obtain dlname
3793 if func_win32_import_lib_p "$dlprefile"; then
3794 func_tr_sh "$dlprefile"
3795 eval "curr_lafile=\$libfile_$func_tr_sh_result"
3796 dlprefile_dlbasename=""
3797 if test -n "$curr_lafile" && func_lalib_p "$curr_lafile"; then
3798 # Use subshell, to avoid clobbering current variable values
3799 dlprefile_dlname=`source "$curr_lafile" && echo "$dlname"`
3800 if test -n "$dlprefile_dlname" ; then
3801 func_basename "$dlprefile_dlname"
3802 dlprefile_dlbasename="$func_basename_result"
3803 else
3804 # no lafile. user explicitly requested -dlpreopen <import library>.
3805 $sharedlib_from_linklib_cmd "$dlprefile"
3806 dlprefile_dlbasename=$sharedlib_from_linklib_result
3807 fi
3808 fi
3809 $opt_dry_run || {
3810 if test -n "$dlprefile_dlbasename" ; then
3811 eval '$ECHO ": $dlprefile_dlbasename" >> "$nlist"'
3812 else
3813 func_warning "Could not compute DLL name from $name"
3814 eval '$ECHO ": $name " >> "$nlist"'
3815 fi
3816 func_to_tool_file "$dlprefile" func_convert_file_msys_to_w32
3817 eval "$NM \"$func_to_tool_file_result\" 2>/dev/null | $global_symbol_pipe |
3818 $SED -e '/I __imp/d' -e 's/I __nm_/D /;s/_nm__//' >> '$nlist'"
3819 }
3820 else # not an import lib
3821 $opt_dry_run || {
3822 eval '$ECHO ": $name " >> "$nlist"'
3823 func_to_tool_file "$dlprefile" func_convert_file_msys_to_w32
3824 eval "$NM \"$func_to_tool_file_result\" 2>/dev/null | $global_symbol_pipe >> '$nlist'"
3825 }
3826 fi
3827 ;;
3828 *)
3829 $opt_dry_run || {
3830 eval '$ECHO ": $name " >> "$nlist"'
3831 func_to_tool_file "$dlprefile" func_convert_file_msys_to_w32
3832 eval "$NM \"$func_to_tool_file_result\" 2>/dev/null | $global_symbol_pipe >> '$nlist'"
3833 }
3834 ;;
3835 esac
cristy3ed852e2009-09-05 21:47:34 +00003836 done
3837
3838 $opt_dry_run || {
3839 # Make sure we have at least an empty file.
3840 test -f "$nlist" || : > "$nlist"
3841
3842 if test -n "$exclude_expsyms"; then
3843 $EGREP -v " ($exclude_expsyms)$" "$nlist" > "$nlist"T
3844 $MV "$nlist"T "$nlist"
3845 fi
3846
3847 # Try sorting and uniquifying the output.
3848 if $GREP -v "^: " < "$nlist" |
3849 if sort -k 3 </dev/null >/dev/null 2>&1; then
3850 sort -k 3
3851 else
3852 sort +2
3853 fi |
3854 uniq > "$nlist"S; then
3855 :
3856 else
3857 $GREP -v "^: " < "$nlist" > "$nlist"S
3858 fi
3859
3860 if test -f "$nlist"S; then
3861 eval "$global_symbol_to_cdecl"' < "$nlist"S >> "$output_objdir/$my_dlsyms"'
3862 else
cristy98dddb52010-11-04 00:30:15 +00003863 echo '/* NONE */' >> "$output_objdir/$my_dlsyms"
cristy3ed852e2009-09-05 21:47:34 +00003864 fi
3865
cristy98dddb52010-11-04 00:30:15 +00003866 echo >> "$output_objdir/$my_dlsyms" "\
cristy3ed852e2009-09-05 21:47:34 +00003867
3868/* The mapping between symbol names and symbols. */
3869typedef struct {
3870 const char *name;
3871 void *address;
3872} lt_dlsymlist;
cristyda16f162011-02-19 23:52:17 +00003873extern LT_DLSYM_CONST lt_dlsymlist
cristy3ed852e2009-09-05 21:47:34 +00003874lt_${my_prefix}_LTX_preloaded_symbols[];
cristyda16f162011-02-19 23:52:17 +00003875LT_DLSYM_CONST lt_dlsymlist
cristy3ed852e2009-09-05 21:47:34 +00003876lt_${my_prefix}_LTX_preloaded_symbols[] =
3877{\
3878 { \"$my_originator\", (void *) 0 },"
3879
3880 case $need_lib_prefix in
3881 no)
3882 eval "$global_symbol_to_c_name_address" < "$nlist" >> "$output_objdir/$my_dlsyms"
3883 ;;
3884 *)
3885 eval "$global_symbol_to_c_name_address_lib_prefix" < "$nlist" >> "$output_objdir/$my_dlsyms"
3886 ;;
3887 esac
cristy98dddb52010-11-04 00:30:15 +00003888 echo >> "$output_objdir/$my_dlsyms" "\
cristy3ed852e2009-09-05 21:47:34 +00003889 {0, (void *) 0}
3890};
3891
3892/* This works around a problem in FreeBSD linker */
3893#ifdef FREEBSD_WORKAROUND
3894static const void *lt_preloaded_setup() {
3895 return lt_${my_prefix}_LTX_preloaded_symbols;
3896}
3897#endif
3898
3899#ifdef __cplusplus
3900}
3901#endif\
3902"
3903 } # !$opt_dry_run
3904
3905 pic_flag_for_symtable=
3906 case "$compile_command " in
3907 *" -static "*) ;;
3908 *)
3909 case $host in
3910 # compiling the symbol table file with pic_flag works around
3911 # a FreeBSD bug that causes programs to crash when -lm is
3912 # linked before any other PIC object. But we must not use
3913 # pic_flag when linking with -static. The problem exists in
3914 # FreeBSD 2.2.6 and is fixed in FreeBSD 3.1.
cristy2542fc62011-12-06 17:50:25 +00003915 *-*-freebsd2.*|*-*-freebsd3.0*|*-*-freebsdelf3.0*)
cristy3ed852e2009-09-05 21:47:34 +00003916 pic_flag_for_symtable=" $pic_flag -DFREEBSD_WORKAROUND" ;;
3917 *-*-hpux*)
3918 pic_flag_for_symtable=" $pic_flag" ;;
3919 *)
3920 if test "X$my_pic_p" != Xno; then
3921 pic_flag_for_symtable=" $pic_flag"
3922 fi
3923 ;;
3924 esac
3925 ;;
3926 esac
3927 symtab_cflags=
3928 for arg in $LTCFLAGS; do
3929 case $arg in
3930 -pie | -fpie | -fPIE) ;;
cristyda16f162011-02-19 23:52:17 +00003931 *) symtab_cflags+=" $arg" ;;
cristy3ed852e2009-09-05 21:47:34 +00003932 esac
3933 done
3934
3935 # Now compile the dynamic symbol file.
3936 func_show_eval '(cd $output_objdir && $LTCC$symtab_cflags -c$no_builtin_flag$pic_flag_for_symtable "$my_dlsyms")' 'exit $?'
3937
3938 # Clean up the generated files.
3939 func_show_eval '$RM "$output_objdir/$my_dlsyms" "$nlist" "${nlist}S" "${nlist}T"'
3940
3941 # Transform the symbol file into the correct name.
3942 symfileobj="$output_objdir/${my_outputname}S.$objext"
3943 case $host in
3944 *cygwin* | *mingw* | *cegcc* )
3945 if test -f "$output_objdir/$my_outputname.def"; then
cristy98dddb52010-11-04 00:30:15 +00003946 compile_command=`$ECHO "$compile_command" | $SED "s%@SYMFILE@%$output_objdir/$my_outputname.def $symfileobj%"`
3947 finalize_command=`$ECHO "$finalize_command" | $SED "s%@SYMFILE@%$output_objdir/$my_outputname.def $symfileobj%"`
cristy3ed852e2009-09-05 21:47:34 +00003948 else
cristy98dddb52010-11-04 00:30:15 +00003949 compile_command=`$ECHO "$compile_command" | $SED "s%@SYMFILE@%$symfileobj%"`
3950 finalize_command=`$ECHO "$finalize_command" | $SED "s%@SYMFILE@%$symfileobj%"`
cristy3ed852e2009-09-05 21:47:34 +00003951 fi
3952 ;;
3953 *)
cristy98dddb52010-11-04 00:30:15 +00003954 compile_command=`$ECHO "$compile_command" | $SED "s%@SYMFILE@%$symfileobj%"`
3955 finalize_command=`$ECHO "$finalize_command" | $SED "s%@SYMFILE@%$symfileobj%"`
cristy3ed852e2009-09-05 21:47:34 +00003956 ;;
3957 esac
3958 ;;
3959 *)
3960 func_fatal_error "unknown suffix for \`$my_dlsyms'"
3961 ;;
3962 esac
3963 else
3964 # We keep going just in case the user didn't refer to
3965 # lt_preloaded_symbols. The linker will fail if global_symbol_pipe
3966 # really was required.
3967
3968 # Nullify the symbol file.
cristy98dddb52010-11-04 00:30:15 +00003969 compile_command=`$ECHO "$compile_command" | $SED "s% @SYMFILE@%%"`
3970 finalize_command=`$ECHO "$finalize_command" | $SED "s% @SYMFILE@%%"`
cristy3ed852e2009-09-05 21:47:34 +00003971 fi
3972}
3973
3974# func_win32_libid arg
3975# return the library type of file 'arg'
3976#
3977# Need a lot of goo to handle *both* DLLs and import libs
3978# Has to be a shell function in order to 'eat' the argument
3979# that is supplied when $file_magic_command is called.
cristy98dddb52010-11-04 00:30:15 +00003980# Despite the name, also deal with 64 bit binaries.
cristy3ed852e2009-09-05 21:47:34 +00003981func_win32_libid ()
3982{
3983 $opt_debug
3984 win32_libid_type="unknown"
3985 win32_fileres=`file -L $1 2>/dev/null`
3986 case $win32_fileres in
3987 *ar\ archive\ import\ library*) # definitely import
3988 win32_libid_type="x86 archive import"
3989 ;;
3990 *ar\ archive*) # could be an import, or static
cristy98dddb52010-11-04 00:30:15 +00003991 # Keep the egrep pattern in sync with the one in _LT_CHECK_MAGIC_METHOD.
cristy3ed852e2009-09-05 21:47:34 +00003992 if eval $OBJDUMP -f $1 | $SED -e '10q' 2>/dev/null |
cristy98dddb52010-11-04 00:30:15 +00003993 $EGREP 'file format (pei*-i386(.*architecture: i386)?|pe-arm-wince|pe-x86-64)' >/dev/null; then
cristyda16f162011-02-19 23:52:17 +00003994 func_to_tool_file "$1" func_convert_file_msys_to_w32
3995 win32_nmres=`eval $NM -f posix -A \"$func_to_tool_file_result\" |
cristy3ed852e2009-09-05 21:47:34 +00003996 $SED -n -e '
3997 1,100{
3998 / I /{
3999 s,.*,import,
4000 p
4001 q
4002 }
4003 }'`
4004 case $win32_nmres in
4005 import*) win32_libid_type="x86 archive import";;
4006 *) win32_libid_type="x86 archive static";;
4007 esac
4008 fi
4009 ;;
4010 *DLL*)
4011 win32_libid_type="x86 DLL"
4012 ;;
4013 *executable*) # but shell scripts are "executable" too...
4014 case $win32_fileres in
4015 *MS\ Windows\ PE\ Intel*)
4016 win32_libid_type="x86 DLL"
4017 ;;
4018 esac
4019 ;;
4020 esac
4021 $ECHO "$win32_libid_type"
4022}
4023
cristyda16f162011-02-19 23:52:17 +00004024# func_cygming_dll_for_implib ARG
4025#
4026# Platform-specific function to extract the
4027# name of the DLL associated with the specified
4028# import library ARG.
4029# Invoked by eval'ing the libtool variable
4030# $sharedlib_from_linklib_cmd
4031# Result is available in the variable
4032# $sharedlib_from_linklib_result
4033func_cygming_dll_for_implib ()
4034{
4035 $opt_debug
4036 sharedlib_from_linklib_result=`$DLLTOOL --identify-strict --identify "$1"`
4037}
4038
4039# func_cygming_dll_for_implib_fallback_core SECTION_NAME LIBNAMEs
4040#
4041# The is the core of a fallback implementation of a
4042# platform-specific function to extract the name of the
4043# DLL associated with the specified import library LIBNAME.
4044#
4045# SECTION_NAME is either .idata$6 or .idata$7, depending
4046# on the platform and compiler that created the implib.
4047#
4048# Echos the name of the DLL associated with the
4049# specified import library.
4050func_cygming_dll_for_implib_fallback_core ()
4051{
4052 $opt_debug
4053 match_literal=`$ECHO "$1" | $SED "$sed_make_literal_regex"`
4054 $OBJDUMP -s --section "$1" "$2" 2>/dev/null |
4055 $SED '/^Contents of section '"$match_literal"':/{
4056 # Place marker at beginning of archive member dllname section
4057 s/.*/====MARK====/
4058 p
4059 d
4060 }
4061 # These lines can sometimes be longer than 43 characters, but
4062 # are always uninteresting
4063 /:[ ]*file format pe[i]\{,1\}-/d
4064 /^In archive [^:]*:/d
4065 # Ensure marker is printed
4066 /^====MARK====/p
4067 # Remove all lines with less than 43 characters
4068 /^.\{43\}/!d
4069 # From remaining lines, remove first 43 characters
4070 s/^.\{43\}//' |
4071 $SED -n '
4072 # Join marker and all lines until next marker into a single line
4073 /^====MARK====/ b para
4074 H
4075 $ b para
4076 b
4077 :para
4078 x
4079 s/\n//g
4080 # Remove the marker
4081 s/^====MARK====//
4082 # Remove trailing dots and whitespace
4083 s/[\. \t]*$//
4084 # Print
4085 /./p' |
4086 # we now have a list, one entry per line, of the stringified
4087 # contents of the appropriate section of all members of the
4088 # archive which possess that section. Heuristic: eliminate
4089 # all those which have a first or second character that is
4090 # a '.' (that is, objdump's representation of an unprintable
4091 # character.) This should work for all archives with less than
4092 # 0x302f exports -- but will fail for DLLs whose name actually
4093 # begins with a literal '.' or a single character followed by
4094 # a '.'.
4095 #
4096 # Of those that remain, print the first one.
4097 $SED -e '/^\./d;/^.\./d;q'
4098}
4099
4100# func_cygming_gnu_implib_p ARG
4101# This predicate returns with zero status (TRUE) if
4102# ARG is a GNU/binutils-style import library. Returns
4103# with nonzero status (FALSE) otherwise.
4104func_cygming_gnu_implib_p ()
4105{
4106 $opt_debug
4107 func_to_tool_file "$1" func_convert_file_msys_to_w32
4108 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)$'`
4109 test -n "$func_cygming_gnu_implib_tmp"
4110}
4111
4112# func_cygming_ms_implib_p ARG
4113# This predicate returns with zero status (TRUE) if
4114# ARG is an MS-style import library. Returns
4115# with nonzero status (FALSE) otherwise.
4116func_cygming_ms_implib_p ()
4117{
4118 $opt_debug
4119 func_to_tool_file "$1" func_convert_file_msys_to_w32
4120 func_cygming_ms_implib_tmp=`$NM "$func_to_tool_file_result" | eval "$global_symbol_pipe" | $GREP '_NULL_IMPORT_DESCRIPTOR'`
4121 test -n "$func_cygming_ms_implib_tmp"
4122}
4123
4124# func_cygming_dll_for_implib_fallback ARG
4125# Platform-specific function to extract the
4126# name of the DLL associated with the specified
4127# import library ARG.
4128#
4129# This fallback implementation is for use when $DLLTOOL
4130# does not support the --identify-strict option.
4131# Invoked by eval'ing the libtool variable
4132# $sharedlib_from_linklib_cmd
4133# Result is available in the variable
4134# $sharedlib_from_linklib_result
4135func_cygming_dll_for_implib_fallback ()
4136{
4137 $opt_debug
4138 if func_cygming_gnu_implib_p "$1" ; then
4139 # binutils import library
4140 sharedlib_from_linklib_result=`func_cygming_dll_for_implib_fallback_core '.idata$7' "$1"`
4141 elif func_cygming_ms_implib_p "$1" ; then
4142 # ms-generated import library
4143 sharedlib_from_linklib_result=`func_cygming_dll_for_implib_fallback_core '.idata$6' "$1"`
4144 else
4145 # unknown
4146 sharedlib_from_linklib_result=""
4147 fi
4148}
cristy3ed852e2009-09-05 21:47:34 +00004149
4150
4151# func_extract_an_archive dir oldlib
4152func_extract_an_archive ()
4153{
4154 $opt_debug
4155 f_ex_an_ar_dir="$1"; shift
4156 f_ex_an_ar_oldlib="$1"
cristy98dddb52010-11-04 00:30:15 +00004157 if test "$lock_old_archive_extraction" = yes; then
4158 lockfile=$f_ex_an_ar_oldlib.lock
4159 until $opt_dry_run || ln "$progpath" "$lockfile" 2>/dev/null; do
4160 func_echo "Waiting for $lockfile to be removed"
4161 sleep 2
4162 done
4163 fi
4164 func_show_eval "(cd \$f_ex_an_ar_dir && $AR x \"\$f_ex_an_ar_oldlib\")" \
4165 'stat=$?; rm -f "$lockfile"; exit $stat'
4166 if test "$lock_old_archive_extraction" = yes; then
4167 $opt_dry_run || rm -f "$lockfile"
4168 fi
cristy3ed852e2009-09-05 21:47:34 +00004169 if ($AR t "$f_ex_an_ar_oldlib" | sort | sort -uc >/dev/null 2>&1); then
4170 :
4171 else
4172 func_fatal_error "object name conflicts in archive: $f_ex_an_ar_dir/$f_ex_an_ar_oldlib"
4173 fi
4174}
4175
4176
4177# func_extract_archives gentop oldlib ...
4178func_extract_archives ()
4179{
4180 $opt_debug
4181 my_gentop="$1"; shift
4182 my_oldlibs=${1+"$@"}
4183 my_oldobjs=""
4184 my_xlib=""
4185 my_xabs=""
4186 my_xdir=""
4187
4188 for my_xlib in $my_oldlibs; do
4189 # Extract the objects.
4190 case $my_xlib in
4191 [\\/]* | [A-Za-z]:[\\/]*) my_xabs="$my_xlib" ;;
4192 *) my_xabs=`pwd`"/$my_xlib" ;;
4193 esac
4194 func_basename "$my_xlib"
4195 my_xlib="$func_basename_result"
4196 my_xlib_u=$my_xlib
4197 while :; do
4198 case " $extracted_archives " in
4199 *" $my_xlib_u "*)
4200 func_arith $extracted_serial + 1
4201 extracted_serial=$func_arith_result
4202 my_xlib_u=lt$extracted_serial-$my_xlib ;;
4203 *) break ;;
4204 esac
4205 done
4206 extracted_archives="$extracted_archives $my_xlib_u"
4207 my_xdir="$my_gentop/$my_xlib_u"
4208
4209 func_mkdir_p "$my_xdir"
4210
4211 case $host in
4212 *-darwin*)
4213 func_verbose "Extracting $my_xabs"
4214 # Do not bother doing anything if just a dry run
4215 $opt_dry_run || {
4216 darwin_orig_dir=`pwd`
4217 cd $my_xdir || exit $?
4218 darwin_archive=$my_xabs
4219 darwin_curdir=`pwd`
4220 darwin_base_archive=`basename "$darwin_archive"`
4221 darwin_arches=`$LIPO -info "$darwin_archive" 2>/dev/null | $GREP Architectures 2>/dev/null || true`
4222 if test -n "$darwin_arches"; then
4223 darwin_arches=`$ECHO "$darwin_arches" | $SED -e 's/.*are://'`
4224 darwin_arch=
4225 func_verbose "$darwin_base_archive has multiple architectures $darwin_arches"
4226 for darwin_arch in $darwin_arches ; do
4227 func_mkdir_p "unfat-$$/${darwin_base_archive}-${darwin_arch}"
4228 $LIPO -thin $darwin_arch -output "unfat-$$/${darwin_base_archive}-${darwin_arch}/${darwin_base_archive}" "${darwin_archive}"
4229 cd "unfat-$$/${darwin_base_archive}-${darwin_arch}"
4230 func_extract_an_archive "`pwd`" "${darwin_base_archive}"
4231 cd "$darwin_curdir"
4232 $RM "unfat-$$/${darwin_base_archive}-${darwin_arch}/${darwin_base_archive}"
4233 done # $darwin_arches
4234 ## Okay now we've a bunch of thin objects, gotta fatten them up :)
4235 darwin_filelist=`find unfat-$$ -type f -name \*.o -print -o -name \*.lo -print | $SED -e "$basename" | sort -u`
4236 darwin_file=
4237 darwin_files=
4238 for darwin_file in $darwin_filelist; do
cristy98dddb52010-11-04 00:30:15 +00004239 darwin_files=`find unfat-$$ -name $darwin_file -print | sort | $NL2SP`
cristy3ed852e2009-09-05 21:47:34 +00004240 $LIPO -create -output "$darwin_file" $darwin_files
4241 done # $darwin_filelist
4242 $RM -rf unfat-$$
4243 cd "$darwin_orig_dir"
4244 else
4245 cd $darwin_orig_dir
4246 func_extract_an_archive "$my_xdir" "$my_xabs"
4247 fi # $darwin_arches
4248 } # !$opt_dry_run
4249 ;;
4250 *)
4251 func_extract_an_archive "$my_xdir" "$my_xabs"
4252 ;;
4253 esac
cristy98dddb52010-11-04 00:30:15 +00004254 my_oldobjs="$my_oldobjs "`find $my_xdir -name \*.$objext -print -o -name \*.lo -print | sort | $NL2SP`
cristy3ed852e2009-09-05 21:47:34 +00004255 done
4256
4257 func_extract_archives_result="$my_oldobjs"
4258}
4259
4260
cristy98dddb52010-11-04 00:30:15 +00004261# func_emit_wrapper [arg=no]
cristy3ed852e2009-09-05 21:47:34 +00004262#
cristy98dddb52010-11-04 00:30:15 +00004263# Emit a libtool wrapper script on stdout.
4264# Don't directly open a file because we may want to
4265# incorporate the script contents within a cygwin/mingw
4266# wrapper executable. Must ONLY be called from within
4267# func_mode_link because it depends on a number of variables
4268# set therein.
4269#
4270# ARG is the value that the WRAPPER_SCRIPT_BELONGS_IN_OBJDIR
4271# variable will take. If 'yes', then the emitted script
4272# will assume that the directory in which it is stored is
4273# the $objdir directory. This is a cygwin/mingw-specific
4274# behavior.
4275func_emit_wrapper ()
cristy3ed852e2009-09-05 21:47:34 +00004276{
cristy98dddb52010-11-04 00:30:15 +00004277 func_emit_wrapper_arg1=${1-no}
cristy3ed852e2009-09-05 21:47:34 +00004278
4279 $ECHO "\
4280#! $SHELL
4281
4282# $output - temporary wrapper script for $objdir/$outputname
4283# Generated by $PROGRAM (GNU $PACKAGE$TIMESTAMP) $VERSION
4284#
4285# The $output program cannot be directly executed until all the libtool
4286# libraries that it depends on are installed.
4287#
4288# This wrapper script should never be moved out of the build directory.
4289# If it is, it will not operate correctly.
4290
4291# Sed substitution that helps us do robust quoting. It backslashifies
4292# metacharacters that are still active within double-quoted strings.
cristy3ed852e2009-09-05 21:47:34 +00004293sed_quote_subst='$sed_quote_subst'
4294
4295# Be Bourne compatible
4296if test -n \"\${ZSH_VERSION+set}\" && (emulate sh) >/dev/null 2>&1; then
4297 emulate sh
4298 NULLCMD=:
4299 # Zsh 3.x and 4.x performs word splitting on \${1+\"\$@\"}, which
4300 # is contrary to our usage. Disable this feature.
4301 alias -g '\${1+\"\$@\"}'='\"\$@\"'
4302 setopt NO_GLOB_SUBST
4303else
4304 case \`(set -o) 2>/dev/null\` in *posix*) set -o posix;; esac
4305fi
4306BIN_SH=xpg4; export BIN_SH # for Tru64
4307DUALCASE=1; export DUALCASE # for MKS sh
4308
4309# The HP-UX ksh and POSIX shell print the target directory to stdout
4310# if CDPATH is set.
4311(unset CDPATH) >/dev/null 2>&1 && unset CDPATH
4312
4313relink_command=\"$relink_command\"
4314
4315# This environment variable determines our operation mode.
4316if test \"\$libtool_install_magic\" = \"$magic\"; then
4317 # install mode needs the following variables:
4318 generated_by_libtool_version='$macro_version'
4319 notinst_deplibs='$notinst_deplibs'
4320else
4321 # When we are sourced in execute mode, \$file and \$ECHO are already set.
4322 if test \"\$libtool_execute_magic\" != \"$magic\"; then
cristy98dddb52010-11-04 00:30:15 +00004323 file=\"\$0\""
4324
4325 qECHO=`$ECHO "$ECHO" | $SED "$sed_quote_subst"`
4326 $ECHO "\
4327
4328# A function that is used when there is no print builtin or printf.
4329func_fallback_echo ()
4330{
4331 eval 'cat <<_LTECHO_EOF
4332\$1
4333_LTECHO_EOF'
4334}
4335 ECHO=\"$qECHO\"
4336 fi
4337
4338# Very basic option parsing. These options are (a) specific to
4339# the libtool wrapper, (b) are identical between the wrapper
4340# /script/ and the wrapper /executable/ which is used only on
4341# windows platforms, and (c) all begin with the string "--lt-"
4342# (application programs are unlikely to have options which match
4343# this pattern).
4344#
4345# There are only two supported options: --lt-debug and
4346# --lt-dump-script. There is, deliberately, no --lt-help.
4347#
4348# The first argument to this parsing function should be the
4349# script's $0 value, followed by "$@".
4350lt_option_debug=
4351func_parse_lt_options ()
4352{
4353 lt_script_arg0=\$0
4354 shift
4355 for lt_opt
4356 do
4357 case \"\$lt_opt\" in
4358 --lt-debug) lt_option_debug=1 ;;
4359 --lt-dump-script)
4360 lt_dump_D=\`\$ECHO \"X\$lt_script_arg0\" | $SED -e 's/^X//' -e 's%/[^/]*$%%'\`
4361 test \"X\$lt_dump_D\" = \"X\$lt_script_arg0\" && lt_dump_D=.
4362 lt_dump_F=\`\$ECHO \"X\$lt_script_arg0\" | $SED -e 's/^X//' -e 's%^.*/%%'\`
4363 cat \"\$lt_dump_D/\$lt_dump_F\"
4364 exit 0
4365 ;;
4366 --lt-*)
4367 \$ECHO \"Unrecognized --lt- option: '\$lt_opt'\" 1>&2
4368 exit 1
4369 ;;
4370 esac
4371 done
4372
4373 # Print the debug banner immediately:
4374 if test -n \"\$lt_option_debug\"; then
4375 echo \"${outputname}:${output}:\${LINENO}: libtool wrapper (GNU $PACKAGE$TIMESTAMP) $VERSION\" 1>&2
4376 fi
4377}
4378
4379# Used when --lt-debug. Prints its arguments to stdout
4380# (redirection is the responsibility of the caller)
4381func_lt_dump_args ()
4382{
4383 lt_dump_args_N=1;
4384 for lt_arg
4385 do
4386 \$ECHO \"${outputname}:${output}:\${LINENO}: newargv[\$lt_dump_args_N]: \$lt_arg\"
4387 lt_dump_args_N=\`expr \$lt_dump_args_N + 1\`
4388 done
4389}
4390
4391# Core function for launching the target application
4392func_exec_program_core ()
4393{
cristycd4c5312009-11-22 01:19:08 +00004394"
cristy98dddb52010-11-04 00:30:15 +00004395 case $host in
4396 # Backslashes separate directories on plain windows
4397 *-*-mingw | *-*-os2* | *-cegcc*)
4398 $ECHO "\
4399 if test -n \"\$lt_option_debug\"; then
4400 \$ECHO \"${outputname}:${output}:\${LINENO}: newargv[0]: \$progdir\\\\\$program\" 1>&2
4401 func_lt_dump_args \${1+\"\$@\"} 1>&2
4402 fi
4403 exec \"\$progdir\\\\\$program\" \${1+\"\$@\"}
4404"
4405 ;;
4406
4407 *)
4408 $ECHO "\
4409 if test -n \"\$lt_option_debug\"; then
4410 \$ECHO \"${outputname}:${output}:\${LINENO}: newargv[0]: \$progdir/\$program\" 1>&2
4411 func_lt_dump_args \${1+\"\$@\"} 1>&2
4412 fi
4413 exec \"\$progdir/\$program\" \${1+\"\$@\"}
4414"
4415 ;;
4416 esac
4417 $ECHO "\
4418 \$ECHO \"\$0: cannot exec \$program \$*\" 1>&2
4419 exit 1
4420}
4421
4422# A function to encapsulate launching the target application
4423# Strips options in the --lt-* namespace from \$@ and
4424# launches target application with the remaining arguments.
4425func_exec_program ()
4426{
cristy2542fc62011-12-06 17:50:25 +00004427 case \" \$* \" in
4428 *\\ --lt-*)
4429 for lt_wr_arg
4430 do
4431 case \$lt_wr_arg in
4432 --lt-*) ;;
4433 *) set x \"\$@\" \"\$lt_wr_arg\"; shift;;
4434 esac
4435 shift
4436 done ;;
4437 esac
cristy98dddb52010-11-04 00:30:15 +00004438 func_exec_program_core \${1+\"\$@\"}
4439}
4440
4441 # Parse options
4442 func_parse_lt_options \"\$0\" \${1+\"\$@\"}
cristy3ed852e2009-09-05 21:47:34 +00004443
4444 # Find the directory that this script lives in.
cristy98dddb52010-11-04 00:30:15 +00004445 thisdir=\`\$ECHO \"\$file\" | $SED 's%/[^/]*$%%'\`
cristy3ed852e2009-09-05 21:47:34 +00004446 test \"x\$thisdir\" = \"x\$file\" && thisdir=.
4447
4448 # Follow symbolic links until we get to the real thisdir.
cristy98dddb52010-11-04 00:30:15 +00004449 file=\`ls -ld \"\$file\" | $SED -n 's/.*-> //p'\`
cristy3ed852e2009-09-05 21:47:34 +00004450 while test -n \"\$file\"; do
cristy98dddb52010-11-04 00:30:15 +00004451 destdir=\`\$ECHO \"\$file\" | $SED 's%/[^/]*\$%%'\`
cristy3ed852e2009-09-05 21:47:34 +00004452
4453 # If there was a directory component, then change thisdir.
4454 if test \"x\$destdir\" != \"x\$file\"; then
4455 case \"\$destdir\" in
4456 [\\\\/]* | [A-Za-z]:[\\\\/]*) thisdir=\"\$destdir\" ;;
4457 *) thisdir=\"\$thisdir/\$destdir\" ;;
4458 esac
4459 fi
4460
cristy98dddb52010-11-04 00:30:15 +00004461 file=\`\$ECHO \"\$file\" | $SED 's%^.*/%%'\`
4462 file=\`ls -ld \"\$thisdir/\$file\" | $SED -n 's/.*-> //p'\`
cristy3ed852e2009-09-05 21:47:34 +00004463 done
cristy3ed852e2009-09-05 21:47:34 +00004464
4465 # Usually 'no', except on cygwin/mingw when embedded into
4466 # the cwrapper.
cristy98dddb52010-11-04 00:30:15 +00004467 WRAPPER_SCRIPT_BELONGS_IN_OBJDIR=$func_emit_wrapper_arg1
cristy3ed852e2009-09-05 21:47:34 +00004468 if test \"\$WRAPPER_SCRIPT_BELONGS_IN_OBJDIR\" = \"yes\"; then
4469 # special case for '.'
4470 if test \"\$thisdir\" = \".\"; then
4471 thisdir=\`pwd\`
4472 fi
4473 # remove .libs from thisdir
4474 case \"\$thisdir\" in
cristy98dddb52010-11-04 00:30:15 +00004475 *[\\\\/]$objdir ) thisdir=\`\$ECHO \"\$thisdir\" | $SED 's%[\\\\/][^\\\\/]*$%%'\` ;;
cristy3ed852e2009-09-05 21:47:34 +00004476 $objdir ) thisdir=. ;;
4477 esac
4478 fi
4479
4480 # Try to get the absolute directory name.
4481 absdir=\`cd \"\$thisdir\" && pwd\`
4482 test -n \"\$absdir\" && thisdir=\"\$absdir\"
4483"
4484
4485 if test "$fast_install" = yes; then
4486 $ECHO "\
4487 program=lt-'$outputname'$exeext
4488 progdir=\"\$thisdir/$objdir\"
4489
4490 if test ! -f \"\$progdir/\$program\" ||
4491 { file=\`ls -1dt \"\$progdir/\$program\" \"\$progdir/../\$program\" 2>/dev/null | ${SED} 1q\`; \\
4492 test \"X\$file\" != \"X\$progdir/\$program\"; }; then
4493
4494 file=\"\$\$-\$program\"
4495
4496 if test ! -d \"\$progdir\"; then
4497 $MKDIR \"\$progdir\"
4498 else
4499 $RM \"\$progdir/\$file\"
4500 fi"
4501
4502 $ECHO "\
4503
4504 # relink executable if necessary
4505 if test -n \"\$relink_command\"; then
4506 if relink_command_output=\`eval \$relink_command 2>&1\`; then :
4507 else
4508 $ECHO \"\$relink_command_output\" >&2
4509 $RM \"\$progdir/\$file\"
4510 exit 1
4511 fi
4512 fi
4513
4514 $MV \"\$progdir/\$file\" \"\$progdir/\$program\" 2>/dev/null ||
4515 { $RM \"\$progdir/\$program\";
4516 $MV \"\$progdir/\$file\" \"\$progdir/\$program\"; }
4517 $RM \"\$progdir/\$file\"
4518 fi"
4519 else
4520 $ECHO "\
4521 program='$outputname'
4522 progdir=\"\$thisdir/$objdir\"
4523"
4524 fi
4525
4526 $ECHO "\
4527
4528 if test -f \"\$progdir/\$program\"; then"
4529
cristyda16f162011-02-19 23:52:17 +00004530 # fixup the dll searchpath if we need to.
4531 #
4532 # Fix the DLL searchpath if we need to. Do this before prepending
4533 # to shlibpath, because on Windows, both are PATH and uninstalled
4534 # libraries must come first.
4535 if test -n "$dllsearchpath"; then
4536 $ECHO "\
4537 # Add the dll search path components to the executable PATH
4538 PATH=$dllsearchpath:\$PATH
4539"
4540 fi
4541
cristy3ed852e2009-09-05 21:47:34 +00004542 # Export our shlibpath_var if we have one.
4543 if test "$shlibpath_overrides_runpath" = yes && test -n "$shlibpath_var" && test -n "$temp_rpath"; then
4544 $ECHO "\
4545 # Add our own library path to $shlibpath_var
4546 $shlibpath_var=\"$temp_rpath\$$shlibpath_var\"
4547
4548 # Some systems cannot cope with colon-terminated $shlibpath_var
4549 # The second colon is a workaround for a bug in BeOS R4 sed
cristy98dddb52010-11-04 00:30:15 +00004550 $shlibpath_var=\`\$ECHO \"\$$shlibpath_var\" | $SED 's/::*\$//'\`
cristy3ed852e2009-09-05 21:47:34 +00004551
4552 export $shlibpath_var
4553"
4554 fi
4555
cristy3ed852e2009-09-05 21:47:34 +00004556 $ECHO "\
4557 if test \"\$libtool_execute_magic\" != \"$magic\"; then
4558 # Run the actual program with our arguments.
cristy98dddb52010-11-04 00:30:15 +00004559 func_exec_program \${1+\"\$@\"}
cristy3ed852e2009-09-05 21:47:34 +00004560 fi
4561 else
4562 # The program doesn't exist.
4563 \$ECHO \"\$0: error: \\\`\$progdir/\$program' does not exist\" 1>&2
4564 \$ECHO \"This script is just a wrapper for \$program.\" 1>&2
cristy98dddb52010-11-04 00:30:15 +00004565 \$ECHO \"See the $PACKAGE documentation for more information.\" 1>&2
cristy3ed852e2009-09-05 21:47:34 +00004566 exit 1
4567 fi
4568fi\
4569"
4570}
cristy3ed852e2009-09-05 21:47:34 +00004571
4572
cristy3ed852e2009-09-05 21:47:34 +00004573# func_emit_cwrapperexe_src
4574# emit the source code for a wrapper executable on stdout
4575# Must ONLY be called from within func_mode_link because
4576# it depends on a number of variable set therein.
4577func_emit_cwrapperexe_src ()
4578{
4579 cat <<EOF
4580
4581/* $cwrappersource - temporary wrapper executable for $objdir/$outputname
4582 Generated by $PROGRAM (GNU $PACKAGE$TIMESTAMP) $VERSION
4583
4584 The $output program cannot be directly executed until all the libtool
4585 libraries that it depends on are installed.
4586
4587 This wrapper executable should never be moved out of the build directory.
4588 If it is, it will not operate correctly.
cristy3ed852e2009-09-05 21:47:34 +00004589*/
4590EOF
4591 cat <<"EOF"
cristy98dddb52010-11-04 00:30:15 +00004592#ifdef _MSC_VER
4593# define _CRT_SECURE_NO_DEPRECATE 1
4594#endif
cristy3ed852e2009-09-05 21:47:34 +00004595#include <stdio.h>
4596#include <stdlib.h>
4597#ifdef _MSC_VER
4598# include <direct.h>
4599# include <process.h>
4600# include <io.h>
cristy3ed852e2009-09-05 21:47:34 +00004601#else
4602# include <unistd.h>
4603# include <stdint.h>
4604# ifdef __CYGWIN__
4605# include <io.h>
cristy3ed852e2009-09-05 21:47:34 +00004606# endif
4607#endif
4608#include <malloc.h>
4609#include <stdarg.h>
4610#include <assert.h>
4611#include <string.h>
4612#include <ctype.h>
4613#include <errno.h>
4614#include <fcntl.h>
4615#include <sys/stat.h>
4616
cristy98dddb52010-11-04 00:30:15 +00004617/* declarations of non-ANSI functions */
4618#if defined(__MINGW32__)
4619# ifdef __STRICT_ANSI__
4620int _putenv (const char *);
4621# endif
4622#elif defined(__CYGWIN__)
4623# ifdef __STRICT_ANSI__
4624char *realpath (const char *, char *);
4625int putenv (char *);
4626int setenv (const char *, const char *, int);
4627# endif
4628/* #elif defined (other platforms) ... */
4629#endif
4630
4631/* portability defines, excluding path handling macros */
4632#if defined(_MSC_VER)
4633# define setmode _setmode
4634# define stat _stat
4635# define chmod _chmod
4636# define getcwd _getcwd
4637# define putenv _putenv
4638# define S_IXUSR _S_IEXEC
4639# ifndef _INTPTR_T_DEFINED
4640# define _INTPTR_T_DEFINED
4641# define intptr_t int
4642# endif
4643#elif defined(__MINGW32__)
4644# define setmode _setmode
4645# define stat _stat
4646# define chmod _chmod
4647# define getcwd _getcwd
4648# define putenv _putenv
4649#elif defined(__CYGWIN__)
4650# define HAVE_SETENV
4651# define FOPEN_WB "wb"
4652/* #elif defined (other platforms) ... */
4653#endif
4654
cristy3ed852e2009-09-05 21:47:34 +00004655#if defined(PATH_MAX)
4656# define LT_PATHMAX PATH_MAX
4657#elif defined(MAXPATHLEN)
4658# define LT_PATHMAX MAXPATHLEN
4659#else
4660# define LT_PATHMAX 1024
4661#endif
4662
4663#ifndef S_IXOTH
4664# define S_IXOTH 0
4665#endif
4666#ifndef S_IXGRP
4667# define S_IXGRP 0
4668#endif
4669
cristy98dddb52010-11-04 00:30:15 +00004670/* path handling portability macros */
cristy3ed852e2009-09-05 21:47:34 +00004671#ifndef DIR_SEPARATOR
4672# define DIR_SEPARATOR '/'
4673# define PATH_SEPARATOR ':'
4674#endif
4675
4676#if defined (_WIN32) || defined (__MSDOS__) || defined (__DJGPP__) || \
4677 defined (__OS2__)
4678# define HAVE_DOS_BASED_FILE_SYSTEM
4679# define FOPEN_WB "wb"
4680# ifndef DIR_SEPARATOR_2
4681# define DIR_SEPARATOR_2 '\\'
4682# endif
4683# ifndef PATH_SEPARATOR_2
4684# define PATH_SEPARATOR_2 ';'
4685# endif
4686#endif
4687
4688#ifndef DIR_SEPARATOR_2
4689# define IS_DIR_SEPARATOR(ch) ((ch) == DIR_SEPARATOR)
4690#else /* DIR_SEPARATOR_2 */
4691# define IS_DIR_SEPARATOR(ch) \
4692 (((ch) == DIR_SEPARATOR) || ((ch) == DIR_SEPARATOR_2))
4693#endif /* DIR_SEPARATOR_2 */
4694
4695#ifndef PATH_SEPARATOR_2
4696# define IS_PATH_SEPARATOR(ch) ((ch) == PATH_SEPARATOR)
4697#else /* PATH_SEPARATOR_2 */
4698# define IS_PATH_SEPARATOR(ch) ((ch) == PATH_SEPARATOR_2)
4699#endif /* PATH_SEPARATOR_2 */
4700
cristy3ed852e2009-09-05 21:47:34 +00004701#ifndef FOPEN_WB
4702# define FOPEN_WB "w"
4703#endif
4704#ifndef _O_BINARY
4705# define _O_BINARY 0
4706#endif
4707
4708#define XMALLOC(type, num) ((type *) xmalloc ((num) * sizeof(type)))
4709#define XFREE(stale) do { \
4710 if (stale) { free ((void *) stale); stale = 0; } \
4711} while (0)
4712
cristy98dddb52010-11-04 00:30:15 +00004713#if defined(LT_DEBUGWRAPPER)
4714static int lt_debug = 1;
cristy3ed852e2009-09-05 21:47:34 +00004715#else
cristy98dddb52010-11-04 00:30:15 +00004716static int lt_debug = 0;
cristy3ed852e2009-09-05 21:47:34 +00004717#endif
4718
cristy98dddb52010-11-04 00:30:15 +00004719const char *program_name = "libtool-wrapper"; /* in case xstrdup fails */
cristy3ed852e2009-09-05 21:47:34 +00004720
4721void *xmalloc (size_t num);
4722char *xstrdup (const char *string);
4723const char *base_name (const char *name);
4724char *find_executable (const char *wrapper);
4725char *chase_symlinks (const char *pathspec);
4726int make_executable (const char *path);
4727int check_executable (const char *path);
4728char *strendzap (char *str, const char *pat);
cristy98dddb52010-11-04 00:30:15 +00004729void lt_debugprintf (const char *file, int line, const char *fmt, ...);
4730void lt_fatal (const char *file, int line, const char *message, ...);
4731static const char *nonnull (const char *s);
4732static const char *nonempty (const char *s);
cristy3ed852e2009-09-05 21:47:34 +00004733void lt_setenv (const char *name, const char *value);
4734char *lt_extend_str (const char *orig_value, const char *add, int to_end);
cristy3ed852e2009-09-05 21:47:34 +00004735void lt_update_exe_path (const char *name, const char *value);
4736void lt_update_lib_path (const char *name, const char *value);
cristy98dddb52010-11-04 00:30:15 +00004737char **prepare_spawn (char **argv);
4738void lt_dump_script (FILE *f);
cristy3ed852e2009-09-05 21:47:34 +00004739EOF
4740
cristy3ed852e2009-09-05 21:47:34 +00004741 cat <<EOF
cristyda16f162011-02-19 23:52:17 +00004742volatile const char * MAGIC_EXE = "$magic_exe";
cristy3ed852e2009-09-05 21:47:34 +00004743const char * LIB_PATH_VARNAME = "$shlibpath_var";
4744EOF
4745
4746 if test "$shlibpath_overrides_runpath" = yes && test -n "$shlibpath_var" && test -n "$temp_rpath"; then
cristyda16f162011-02-19 23:52:17 +00004747 func_to_host_path "$temp_rpath"
cristy3ed852e2009-09-05 21:47:34 +00004748 cat <<EOF
cristyda16f162011-02-19 23:52:17 +00004749const char * LIB_PATH_VALUE = "$func_to_host_path_result";
cristy3ed852e2009-09-05 21:47:34 +00004750EOF
4751 else
4752 cat <<"EOF"
4753const char * LIB_PATH_VALUE = "";
4754EOF
4755 fi
4756
4757 if test -n "$dllsearchpath"; then
cristyda16f162011-02-19 23:52:17 +00004758 func_to_host_path "$dllsearchpath:"
cristy3ed852e2009-09-05 21:47:34 +00004759 cat <<EOF
4760const char * EXE_PATH_VARNAME = "PATH";
cristyda16f162011-02-19 23:52:17 +00004761const char * EXE_PATH_VALUE = "$func_to_host_path_result";
cristy3ed852e2009-09-05 21:47:34 +00004762EOF
4763 else
4764 cat <<"EOF"
4765const char * EXE_PATH_VARNAME = "";
4766const char * EXE_PATH_VALUE = "";
4767EOF
4768 fi
4769
4770 if test "$fast_install" = yes; then
4771 cat <<EOF
4772const char * TARGET_PROGRAM_NAME = "lt-$outputname"; /* hopefully, no .exe */
4773EOF
4774 else
4775 cat <<EOF
4776const char * TARGET_PROGRAM_NAME = "$outputname"; /* hopefully, no .exe */
4777EOF
4778 fi
4779
4780
4781 cat <<"EOF"
4782
4783#define LTWRAPPER_OPTION_PREFIX "--lt-"
cristy3ed852e2009-09-05 21:47:34 +00004784
cristy3ed852e2009-09-05 21:47:34 +00004785static const char *ltwrapper_option_prefix = LTWRAPPER_OPTION_PREFIX;
cristy3ed852e2009-09-05 21:47:34 +00004786static const char *dumpscript_opt = LTWRAPPER_OPTION_PREFIX "dump-script";
cristy98dddb52010-11-04 00:30:15 +00004787static const char *debug_opt = LTWRAPPER_OPTION_PREFIX "debug";
cristycd4c5312009-11-22 01:19:08 +00004788
cristy3ed852e2009-09-05 21:47:34 +00004789int
4790main (int argc, char *argv[])
4791{
4792 char **newargz;
4793 int newargc;
4794 char *tmp_pathspec;
4795 char *actual_cwrapper_path;
4796 char *actual_cwrapper_name;
4797 char *target_name;
4798 char *lt_argv_zero;
4799 intptr_t rval = 127;
4800
4801 int i;
4802
4803 program_name = (char *) xstrdup (base_name (argv[0]));
cristy98dddb52010-11-04 00:30:15 +00004804 newargz = XMALLOC (char *, argc + 1);
cristy3ed852e2009-09-05 21:47:34 +00004805
cristy98dddb52010-11-04 00:30:15 +00004806 /* very simple arg parsing; don't want to rely on getopt
4807 * also, copy all non cwrapper options to newargz, except
4808 * argz[0], which is handled differently
4809 */
4810 newargc=0;
cristy3ed852e2009-09-05 21:47:34 +00004811 for (i = 1; i < argc; i++)
4812 {
4813 if (strcmp (argv[i], dumpscript_opt) == 0)
4814 {
4815EOF
4816 case "$host" in
4817 *mingw* | *cygwin* )
4818 # make stdout use "unix" line endings
4819 echo " setmode(1,_O_BINARY);"
4820 ;;
4821 esac
4822
4823 cat <<"EOF"
cristy98dddb52010-11-04 00:30:15 +00004824 lt_dump_script (stdout);
cristy3ed852e2009-09-05 21:47:34 +00004825 return 0;
4826 }
cristy98dddb52010-11-04 00:30:15 +00004827 if (strcmp (argv[i], debug_opt) == 0)
4828 {
4829 lt_debug = 1;
4830 continue;
4831 }
4832 if (strcmp (argv[i], ltwrapper_option_prefix) == 0)
4833 {
4834 /* however, if there is an option in the LTWRAPPER_OPTION_PREFIX
4835 namespace, but it is not one of the ones we know about and
4836 have already dealt with, above (inluding dump-script), then
4837 report an error. Otherwise, targets might begin to believe
4838 they are allowed to use options in the LTWRAPPER_OPTION_PREFIX
4839 namespace. The first time any user complains about this, we'll
4840 need to make LTWRAPPER_OPTION_PREFIX a configure-time option
4841 or a configure.ac-settable value.
4842 */
4843 lt_fatal (__FILE__, __LINE__,
4844 "unrecognized %s option: '%s'",
4845 ltwrapper_option_prefix, argv[i]);
4846 }
4847 /* otherwise ... */
4848 newargz[++newargc] = xstrdup (argv[i]);
cristy3ed852e2009-09-05 21:47:34 +00004849 }
cristy98dddb52010-11-04 00:30:15 +00004850 newargz[++newargc] = NULL;
cristy3ed852e2009-09-05 21:47:34 +00004851
cristy98dddb52010-11-04 00:30:15 +00004852EOF
4853 cat <<EOF
4854 /* The GNU banner must be the first non-error debug message */
4855 lt_debugprintf (__FILE__, __LINE__, "libtool wrapper (GNU $PACKAGE$TIMESTAMP) $VERSION\n");
4856EOF
4857 cat <<"EOF"
4858 lt_debugprintf (__FILE__, __LINE__, "(main) argv[0]: %s\n", argv[0]);
4859 lt_debugprintf (__FILE__, __LINE__, "(main) program_name: %s\n", program_name);
4860
cristy3ed852e2009-09-05 21:47:34 +00004861 tmp_pathspec = find_executable (argv[0]);
4862 if (tmp_pathspec == NULL)
cristy98dddb52010-11-04 00:30:15 +00004863 lt_fatal (__FILE__, __LINE__, "couldn't find %s", argv[0]);
4864 lt_debugprintf (__FILE__, __LINE__,
4865 "(main) found exe (before symlink chase) at: %s\n",
4866 tmp_pathspec);
cristy3ed852e2009-09-05 21:47:34 +00004867
4868 actual_cwrapper_path = chase_symlinks (tmp_pathspec);
cristy98dddb52010-11-04 00:30:15 +00004869 lt_debugprintf (__FILE__, __LINE__,
4870 "(main) found exe (after symlink chase) at: %s\n",
4871 actual_cwrapper_path);
cristy3ed852e2009-09-05 21:47:34 +00004872 XFREE (tmp_pathspec);
4873
cristy98dddb52010-11-04 00:30:15 +00004874 actual_cwrapper_name = xstrdup (base_name (actual_cwrapper_path));
cristy3ed852e2009-09-05 21:47:34 +00004875 strendzap (actual_cwrapper_path, actual_cwrapper_name);
4876
4877 /* wrapper name transforms */
4878 strendzap (actual_cwrapper_name, ".exe");
4879 tmp_pathspec = lt_extend_str (actual_cwrapper_name, ".exe", 1);
4880 XFREE (actual_cwrapper_name);
4881 actual_cwrapper_name = tmp_pathspec;
4882 tmp_pathspec = 0;
4883
4884 /* target_name transforms -- use actual target program name; might have lt- prefix */
4885 target_name = xstrdup (base_name (TARGET_PROGRAM_NAME));
4886 strendzap (target_name, ".exe");
4887 tmp_pathspec = lt_extend_str (target_name, ".exe", 1);
4888 XFREE (target_name);
4889 target_name = tmp_pathspec;
4890 tmp_pathspec = 0;
4891
cristy98dddb52010-11-04 00:30:15 +00004892 lt_debugprintf (__FILE__, __LINE__,
4893 "(main) libtool target name: %s\n",
4894 target_name);
cristy3ed852e2009-09-05 21:47:34 +00004895EOF
4896
4897 cat <<EOF
4898 newargz[0] =
4899 XMALLOC (char, (strlen (actual_cwrapper_path) +
4900 strlen ("$objdir") + 1 + strlen (actual_cwrapper_name) + 1));
4901 strcpy (newargz[0], actual_cwrapper_path);
4902 strcat (newargz[0], "$objdir");
4903 strcat (newargz[0], "/");
4904EOF
4905
4906 cat <<"EOF"
4907 /* stop here, and copy so we don't have to do this twice */
4908 tmp_pathspec = xstrdup (newargz[0]);
4909
4910 /* do NOT want the lt- prefix here, so use actual_cwrapper_name */
4911 strcat (newargz[0], actual_cwrapper_name);
4912
4913 /* DO want the lt- prefix here if it exists, so use target_name */
4914 lt_argv_zero = lt_extend_str (tmp_pathspec, target_name, 1);
4915 XFREE (tmp_pathspec);
4916 tmp_pathspec = NULL;
4917EOF
4918
4919 case $host_os in
4920 mingw*)
4921 cat <<"EOF"
4922 {
4923 char* p;
4924 while ((p = strchr (newargz[0], '\\')) != NULL)
4925 {
4926 *p = '/';
4927 }
4928 while ((p = strchr (lt_argv_zero, '\\')) != NULL)
4929 {
4930 *p = '/';
4931 }
4932 }
4933EOF
4934 ;;
4935 esac
4936
4937 cat <<"EOF"
4938 XFREE (target_name);
4939 XFREE (actual_cwrapper_path);
4940 XFREE (actual_cwrapper_name);
4941
4942 lt_setenv ("BIN_SH", "xpg4"); /* for Tru64 */
4943 lt_setenv ("DUALCASE", "1"); /* for MSK sh */
cristyda16f162011-02-19 23:52:17 +00004944 /* Update the DLL searchpath. EXE_PATH_VALUE ($dllsearchpath) must
4945 be prepended before (that is, appear after) LIB_PATH_VALUE ($temp_rpath)
4946 because on Windows, both *_VARNAMEs are PATH but uninstalled
4947 libraries must come first. */
cristy3ed852e2009-09-05 21:47:34 +00004948 lt_update_exe_path (EXE_PATH_VARNAME, EXE_PATH_VALUE);
cristyda16f162011-02-19 23:52:17 +00004949 lt_update_lib_path (LIB_PATH_VARNAME, LIB_PATH_VALUE);
cristy3ed852e2009-09-05 21:47:34 +00004950
cristy98dddb52010-11-04 00:30:15 +00004951 lt_debugprintf (__FILE__, __LINE__, "(main) lt_argv_zero: %s\n",
4952 nonnull (lt_argv_zero));
cristy3ed852e2009-09-05 21:47:34 +00004953 for (i = 0; i < newargc; i++)
4954 {
cristy98dddb52010-11-04 00:30:15 +00004955 lt_debugprintf (__FILE__, __LINE__, "(main) newargz[%d]: %s\n",
4956 i, nonnull (newargz[i]));
cristy3ed852e2009-09-05 21:47:34 +00004957 }
4958
4959EOF
4960
4961 case $host_os in
4962 mingw*)
4963 cat <<"EOF"
4964 /* execv doesn't actually work on mingw as expected on unix */
cristy98dddb52010-11-04 00:30:15 +00004965 newargz = prepare_spawn (newargz);
cristy3ed852e2009-09-05 21:47:34 +00004966 rval = _spawnv (_P_WAIT, lt_argv_zero, (const char * const *) newargz);
4967 if (rval == -1)
4968 {
4969 /* failed to start process */
cristy98dddb52010-11-04 00:30:15 +00004970 lt_debugprintf (__FILE__, __LINE__,
4971 "(main) failed to launch target \"%s\": %s\n",
4972 lt_argv_zero, nonnull (strerror (errno)));
cristy3ed852e2009-09-05 21:47:34 +00004973 return 127;
4974 }
4975 return rval;
4976EOF
4977 ;;
4978 *)
4979 cat <<"EOF"
4980 execv (lt_argv_zero, newargz);
4981 return rval; /* =127, but avoids unused variable warning */
4982EOF
4983 ;;
4984 esac
4985
4986 cat <<"EOF"
4987}
4988
4989void *
4990xmalloc (size_t num)
4991{
4992 void *p = (void *) malloc (num);
4993 if (!p)
cristy98dddb52010-11-04 00:30:15 +00004994 lt_fatal (__FILE__, __LINE__, "memory exhausted");
cristy3ed852e2009-09-05 21:47:34 +00004995
4996 return p;
4997}
4998
4999char *
5000xstrdup (const char *string)
5001{
5002 return string ? strcpy ((char *) xmalloc (strlen (string) + 1),
5003 string) : NULL;
5004}
5005
5006const char *
5007base_name (const char *name)
5008{
5009 const char *base;
5010
5011#if defined (HAVE_DOS_BASED_FILE_SYSTEM)
5012 /* Skip over the disk name in MSDOS pathnames. */
5013 if (isalpha ((unsigned char) name[0]) && name[1] == ':')
5014 name += 2;
5015#endif
5016
5017 for (base = name; *name; name++)
5018 if (IS_DIR_SEPARATOR (*name))
5019 base = name + 1;
5020 return base;
5021}
5022
5023int
5024check_executable (const char *path)
5025{
5026 struct stat st;
5027
cristy98dddb52010-11-04 00:30:15 +00005028 lt_debugprintf (__FILE__, __LINE__, "(check_executable): %s\n",
5029 nonempty (path));
cristy3ed852e2009-09-05 21:47:34 +00005030 if ((!path) || (!*path))
5031 return 0;
5032
5033 if ((stat (path, &st) >= 0)
5034 && (st.st_mode & (S_IXUSR | S_IXGRP | S_IXOTH)))
5035 return 1;
5036 else
5037 return 0;
5038}
5039
5040int
5041make_executable (const char *path)
5042{
5043 int rval = 0;
5044 struct stat st;
5045
cristy98dddb52010-11-04 00:30:15 +00005046 lt_debugprintf (__FILE__, __LINE__, "(make_executable): %s\n",
5047 nonempty (path));
cristy3ed852e2009-09-05 21:47:34 +00005048 if ((!path) || (!*path))
5049 return 0;
5050
5051 if (stat (path, &st) >= 0)
5052 {
5053 rval = chmod (path, st.st_mode | S_IXOTH | S_IXGRP | S_IXUSR);
5054 }
5055 return rval;
5056}
5057
5058/* Searches for the full path of the wrapper. Returns
5059 newly allocated full path name if found, NULL otherwise
5060 Does not chase symlinks, even on platforms that support them.
5061*/
5062char *
5063find_executable (const char *wrapper)
5064{
5065 int has_slash = 0;
5066 const char *p;
5067 const char *p_next;
5068 /* static buffer for getcwd */
5069 char tmp[LT_PATHMAX + 1];
5070 int tmp_len;
5071 char *concat_name;
5072
cristy98dddb52010-11-04 00:30:15 +00005073 lt_debugprintf (__FILE__, __LINE__, "(find_executable): %s\n",
5074 nonempty (wrapper));
cristy3ed852e2009-09-05 21:47:34 +00005075
5076 if ((wrapper == NULL) || (*wrapper == '\0'))
5077 return NULL;
5078
5079 /* Absolute path? */
5080#if defined (HAVE_DOS_BASED_FILE_SYSTEM)
5081 if (isalpha ((unsigned char) wrapper[0]) && wrapper[1] == ':')
5082 {
5083 concat_name = xstrdup (wrapper);
5084 if (check_executable (concat_name))
5085 return concat_name;
5086 XFREE (concat_name);
5087 }
5088 else
5089 {
5090#endif
5091 if (IS_DIR_SEPARATOR (wrapper[0]))
5092 {
5093 concat_name = xstrdup (wrapper);
5094 if (check_executable (concat_name))
5095 return concat_name;
5096 XFREE (concat_name);
5097 }
5098#if defined (HAVE_DOS_BASED_FILE_SYSTEM)
5099 }
5100#endif
5101
5102 for (p = wrapper; *p; p++)
5103 if (*p == '/')
5104 {
5105 has_slash = 1;
5106 break;
5107 }
5108 if (!has_slash)
5109 {
5110 /* no slashes; search PATH */
5111 const char *path = getenv ("PATH");
5112 if (path != NULL)
5113 {
5114 for (p = path; *p; p = p_next)
5115 {
5116 const char *q;
5117 size_t p_len;
5118 for (q = p; *q; q++)
5119 if (IS_PATH_SEPARATOR (*q))
5120 break;
5121 p_len = q - p;
5122 p_next = (*q == '\0' ? q : q + 1);
5123 if (p_len == 0)
5124 {
5125 /* empty path: current directory */
5126 if (getcwd (tmp, LT_PATHMAX) == NULL)
cristy98dddb52010-11-04 00:30:15 +00005127 lt_fatal (__FILE__, __LINE__, "getcwd failed: %s",
5128 nonnull (strerror (errno)));
cristy3ed852e2009-09-05 21:47:34 +00005129 tmp_len = strlen (tmp);
5130 concat_name =
5131 XMALLOC (char, tmp_len + 1 + strlen (wrapper) + 1);
5132 memcpy (concat_name, tmp, tmp_len);
5133 concat_name[tmp_len] = '/';
5134 strcpy (concat_name + tmp_len + 1, wrapper);
5135 }
5136 else
5137 {
5138 concat_name =
5139 XMALLOC (char, p_len + 1 + strlen (wrapper) + 1);
5140 memcpy (concat_name, p, p_len);
5141 concat_name[p_len] = '/';
5142 strcpy (concat_name + p_len + 1, wrapper);
5143 }
5144 if (check_executable (concat_name))
5145 return concat_name;
5146 XFREE (concat_name);
5147 }
5148 }
5149 /* not found in PATH; assume curdir */
5150 }
5151 /* Relative path | not found in path: prepend cwd */
5152 if (getcwd (tmp, LT_PATHMAX) == NULL)
cristy98dddb52010-11-04 00:30:15 +00005153 lt_fatal (__FILE__, __LINE__, "getcwd failed: %s",
5154 nonnull (strerror (errno)));
cristy3ed852e2009-09-05 21:47:34 +00005155 tmp_len = strlen (tmp);
5156 concat_name = XMALLOC (char, tmp_len + 1 + strlen (wrapper) + 1);
5157 memcpy (concat_name, tmp, tmp_len);
5158 concat_name[tmp_len] = '/';
5159 strcpy (concat_name + tmp_len + 1, wrapper);
5160
5161 if (check_executable (concat_name))
5162 return concat_name;
5163 XFREE (concat_name);
5164 return NULL;
5165}
5166
5167char *
5168chase_symlinks (const char *pathspec)
5169{
5170#ifndef S_ISLNK
5171 return xstrdup (pathspec);
5172#else
5173 char buf[LT_PATHMAX];
5174 struct stat s;
5175 char *tmp_pathspec = xstrdup (pathspec);
5176 char *p;
5177 int has_symlinks = 0;
5178 while (strlen (tmp_pathspec) && !has_symlinks)
5179 {
cristy98dddb52010-11-04 00:30:15 +00005180 lt_debugprintf (__FILE__, __LINE__,
5181 "checking path component for symlinks: %s\n",
5182 tmp_pathspec);
cristy3ed852e2009-09-05 21:47:34 +00005183 if (lstat (tmp_pathspec, &s) == 0)
5184 {
5185 if (S_ISLNK (s.st_mode) != 0)
5186 {
5187 has_symlinks = 1;
5188 break;
5189 }
5190
5191 /* search backwards for last DIR_SEPARATOR */
5192 p = tmp_pathspec + strlen (tmp_pathspec) - 1;
5193 while ((p > tmp_pathspec) && (!IS_DIR_SEPARATOR (*p)))
5194 p--;
5195 if ((p == tmp_pathspec) && (!IS_DIR_SEPARATOR (*p)))
5196 {
5197 /* no more DIR_SEPARATORS left */
5198 break;
5199 }
5200 *p = '\0';
5201 }
5202 else
5203 {
cristy98dddb52010-11-04 00:30:15 +00005204 lt_fatal (__FILE__, __LINE__,
5205 "error accessing file \"%s\": %s",
5206 tmp_pathspec, nonnull (strerror (errno)));
cristy3ed852e2009-09-05 21:47:34 +00005207 }
5208 }
5209 XFREE (tmp_pathspec);
5210
5211 if (!has_symlinks)
5212 {
5213 return xstrdup (pathspec);
5214 }
5215
5216 tmp_pathspec = realpath (pathspec, buf);
5217 if (tmp_pathspec == 0)
5218 {
cristy98dddb52010-11-04 00:30:15 +00005219 lt_fatal (__FILE__, __LINE__,
5220 "could not follow symlinks for %s", pathspec);
cristy3ed852e2009-09-05 21:47:34 +00005221 }
5222 return xstrdup (tmp_pathspec);
5223#endif
5224}
5225
5226char *
5227strendzap (char *str, const char *pat)
5228{
5229 size_t len, patlen;
5230
5231 assert (str != NULL);
5232 assert (pat != NULL);
5233
5234 len = strlen (str);
5235 patlen = strlen (pat);
5236
5237 if (patlen <= len)
5238 {
5239 str += len - patlen;
5240 if (strcmp (str, pat) == 0)
5241 *str = '\0';
5242 }
5243 return str;
5244}
5245
cristy98dddb52010-11-04 00:30:15 +00005246void
5247lt_debugprintf (const char *file, int line, const char *fmt, ...)
5248{
5249 va_list args;
5250 if (lt_debug)
5251 {
5252 (void) fprintf (stderr, "%s:%s:%d: ", program_name, file, line);
5253 va_start (args, fmt);
5254 (void) vfprintf (stderr, fmt, args);
5255 va_end (args);
5256 }
5257}
5258
cristy3ed852e2009-09-05 21:47:34 +00005259static void
cristy98dddb52010-11-04 00:30:15 +00005260lt_error_core (int exit_status, const char *file,
5261 int line, const char *mode,
cristy3ed852e2009-09-05 21:47:34 +00005262 const char *message, va_list ap)
5263{
cristy98dddb52010-11-04 00:30:15 +00005264 fprintf (stderr, "%s:%s:%d: %s: ", program_name, file, line, mode);
cristy3ed852e2009-09-05 21:47:34 +00005265 vfprintf (stderr, message, ap);
5266 fprintf (stderr, ".\n");
5267
5268 if (exit_status >= 0)
5269 exit (exit_status);
5270}
5271
5272void
cristy98dddb52010-11-04 00:30:15 +00005273lt_fatal (const char *file, int line, const char *message, ...)
cristy3ed852e2009-09-05 21:47:34 +00005274{
5275 va_list ap;
5276 va_start (ap, message);
cristy98dddb52010-11-04 00:30:15 +00005277 lt_error_core (EXIT_FAILURE, file, line, "FATAL", message, ap);
cristy3ed852e2009-09-05 21:47:34 +00005278 va_end (ap);
5279}
5280
cristy98dddb52010-11-04 00:30:15 +00005281static const char *
5282nonnull (const char *s)
5283{
5284 return s ? s : "(null)";
5285}
5286
5287static const char *
5288nonempty (const char *s)
5289{
5290 return (s && !*s) ? "(empty)" : nonnull (s);
5291}
5292
cristy3ed852e2009-09-05 21:47:34 +00005293void
5294lt_setenv (const char *name, const char *value)
5295{
cristy98dddb52010-11-04 00:30:15 +00005296 lt_debugprintf (__FILE__, __LINE__,
5297 "(lt_setenv) setting '%s' to '%s'\n",
5298 nonnull (name), nonnull (value));
cristy3ed852e2009-09-05 21:47:34 +00005299 {
5300#ifdef HAVE_SETENV
5301 /* always make a copy, for consistency with !HAVE_SETENV */
5302 char *str = xstrdup (value);
5303 setenv (name, str, 1);
5304#else
5305 int len = strlen (name) + 1 + strlen (value) + 1;
5306 char *str = XMALLOC (char, len);
5307 sprintf (str, "%s=%s", name, value);
5308 if (putenv (str) != EXIT_SUCCESS)
5309 {
5310 XFREE (str);
5311 }
5312#endif
5313 }
5314}
5315
5316char *
5317lt_extend_str (const char *orig_value, const char *add, int to_end)
5318{
5319 char *new_value;
5320 if (orig_value && *orig_value)
5321 {
5322 int orig_value_len = strlen (orig_value);
5323 int add_len = strlen (add);
5324 new_value = XMALLOC (char, add_len + orig_value_len + 1);
5325 if (to_end)
5326 {
5327 strcpy (new_value, orig_value);
5328 strcpy (new_value + orig_value_len, add);
5329 }
5330 else
5331 {
5332 strcpy (new_value, add);
5333 strcpy (new_value + add_len, orig_value);
5334 }
5335 }
5336 else
5337 {
5338 new_value = xstrdup (add);
5339 }
5340 return new_value;
5341}
5342
cristy3ed852e2009-09-05 21:47:34 +00005343void
5344lt_update_exe_path (const char *name, const char *value)
5345{
cristy98dddb52010-11-04 00:30:15 +00005346 lt_debugprintf (__FILE__, __LINE__,
5347 "(lt_update_exe_path) modifying '%s' by prepending '%s'\n",
5348 nonnull (name), nonnull (value));
cristy3ed852e2009-09-05 21:47:34 +00005349
5350 if (name && *name && value && *value)
5351 {
5352 char *new_value = lt_extend_str (getenv (name), value, 0);
5353 /* some systems can't cope with a ':'-terminated path #' */
5354 int len = strlen (new_value);
5355 while (((len = strlen (new_value)) > 0) && IS_PATH_SEPARATOR (new_value[len-1]))
5356 {
5357 new_value[len-1] = '\0';
5358 }
5359 lt_setenv (name, new_value);
5360 XFREE (new_value);
5361 }
5362}
5363
5364void
5365lt_update_lib_path (const char *name, const char *value)
5366{
cristy98dddb52010-11-04 00:30:15 +00005367 lt_debugprintf (__FILE__, __LINE__,
5368 "(lt_update_lib_path) modifying '%s' by prepending '%s'\n",
5369 nonnull (name), nonnull (value));
cristy3ed852e2009-09-05 21:47:34 +00005370
5371 if (name && *name && value && *value)
5372 {
5373 char *new_value = lt_extend_str (getenv (name), value, 0);
5374 lt_setenv (name, new_value);
5375 XFREE (new_value);
5376 }
5377}
5378
cristy98dddb52010-11-04 00:30:15 +00005379EOF
5380 case $host_os in
5381 mingw*)
5382 cat <<"EOF"
cristy3ed852e2009-09-05 21:47:34 +00005383
cristy98dddb52010-11-04 00:30:15 +00005384/* Prepares an argument vector before calling spawn().
5385 Note that spawn() does not by itself call the command interpreter
5386 (getenv ("COMSPEC") != NULL ? getenv ("COMSPEC") :
5387 ({ OSVERSIONINFO v; v.dwOSVersionInfoSize = sizeof(OSVERSIONINFO);
5388 GetVersionEx(&v);
5389 v.dwPlatformId == VER_PLATFORM_WIN32_NT;
5390 }) ? "cmd.exe" : "command.com").
5391 Instead it simply concatenates the arguments, separated by ' ', and calls
5392 CreateProcess(). We must quote the arguments since Win32 CreateProcess()
5393 interprets characters like ' ', '\t', '\\', '"' (but not '<' and '>') in a
5394 special way:
5395 - Space and tab are interpreted as delimiters. They are not treated as
5396 delimiters if they are surrounded by double quotes: "...".
5397 - Unescaped double quotes are removed from the input. Their only effect is
5398 that within double quotes, space and tab are treated like normal
5399 characters.
5400 - Backslashes not followed by double quotes are not special.
5401 - But 2*n+1 backslashes followed by a double quote become
5402 n backslashes followed by a double quote (n >= 0):
5403 \" -> "
5404 \\\" -> \"
5405 \\\\\" -> \\"
5406 */
5407#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"
5408#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"
5409char **
5410prepare_spawn (char **argv)
5411{
5412 size_t argc;
5413 char **new_argv;
5414 size_t i;
5415
5416 /* Count number of arguments. */
5417 for (argc = 0; argv[argc] != NULL; argc++)
5418 ;
5419
5420 /* Allocate new argument vector. */
5421 new_argv = XMALLOC (char *, argc + 1);
5422
5423 /* Put quoted arguments into the new argument vector. */
5424 for (i = 0; i < argc; i++)
5425 {
5426 const char *string = argv[i];
5427
5428 if (string[0] == '\0')
5429 new_argv[i] = xstrdup ("\"\"");
5430 else if (strpbrk (string, SHELL_SPECIAL_CHARS) != NULL)
5431 {
5432 int quote_around = (strpbrk (string, SHELL_SPACE_CHARS) != NULL);
5433 size_t length;
5434 unsigned int backslashes;
5435 const char *s;
5436 char *quoted_string;
5437 char *p;
5438
5439 length = 0;
5440 backslashes = 0;
5441 if (quote_around)
5442 length++;
5443 for (s = string; *s != '\0'; s++)
5444 {
5445 char c = *s;
5446 if (c == '"')
5447 length += backslashes + 1;
5448 length++;
5449 if (c == '\\')
5450 backslashes++;
5451 else
5452 backslashes = 0;
5453 }
5454 if (quote_around)
5455 length += backslashes + 1;
5456
5457 quoted_string = XMALLOC (char, length + 1);
5458
5459 p = quoted_string;
5460 backslashes = 0;
5461 if (quote_around)
5462 *p++ = '"';
5463 for (s = string; *s != '\0'; s++)
5464 {
5465 char c = *s;
5466 if (c == '"')
5467 {
5468 unsigned int j;
5469 for (j = backslashes + 1; j > 0; j--)
5470 *p++ = '\\';
5471 }
5472 *p++ = c;
5473 if (c == '\\')
5474 backslashes++;
5475 else
5476 backslashes = 0;
5477 }
5478 if (quote_around)
5479 {
5480 unsigned int j;
5481 for (j = backslashes; j > 0; j--)
5482 *p++ = '\\';
5483 *p++ = '"';
5484 }
5485 *p = '\0';
5486
5487 new_argv[i] = quoted_string;
5488 }
5489 else
5490 new_argv[i] = (char *) string;
5491 }
5492 new_argv[argc] = NULL;
5493
5494 return new_argv;
5495}
5496EOF
5497 ;;
5498 esac
5499
5500 cat <<"EOF"
5501void lt_dump_script (FILE* f)
5502{
5503EOF
5504 func_emit_wrapper yes |
cristy2542fc62011-12-06 17:50:25 +00005505 $SED -n -e '
5506s/^\(.\{79\}\)\(..*\)/\1\
5507\2/
5508h
5509s/\([\\"]\)/\\\1/g
5510s/$/\\n/
5511s/\([^\n]*\).*/ fputs ("\1", f);/p
5512g
5513D'
cristy98dddb52010-11-04 00:30:15 +00005514 cat <<"EOF"
5515}
cristy3ed852e2009-09-05 21:47:34 +00005516EOF
5517}
5518# end: func_emit_cwrapperexe_src
5519
cristy98dddb52010-11-04 00:30:15 +00005520# func_win32_import_lib_p ARG
5521# True if ARG is an import lib, as indicated by $file_magic_cmd
5522func_win32_import_lib_p ()
5523{
5524 $opt_debug
5525 case `eval $file_magic_cmd \"\$1\" 2>/dev/null | $SED -e 10q` in
5526 *import*) : ;;
5527 *) false ;;
5528 esac
5529}
5530
cristy3ed852e2009-09-05 21:47:34 +00005531# func_mode_link arg...
5532func_mode_link ()
5533{
5534 $opt_debug
5535 case $host in
5536 *-*-cygwin* | *-*-mingw* | *-*-pw32* | *-*-os2* | *-cegcc*)
5537 # It is impossible to link a dll without this setting, and
5538 # we shouldn't force the makefile maintainer to figure out
5539 # which system we are compiling for in order to pass an extra
5540 # flag for every libtool invocation.
5541 # allow_undefined=no
5542
5543 # FIXME: Unfortunately, there are problems with the above when trying
5544 # to make a dll which has undefined symbols, in which case not
5545 # even a static library is built. For now, we need to specify
5546 # -no-undefined on the libtool link line when we can be certain
5547 # that all symbols are satisfied, otherwise we get a static library.
5548 allow_undefined=yes
5549 ;;
5550 *)
5551 allow_undefined=yes
5552 ;;
5553 esac
5554 libtool_args=$nonopt
5555 base_compile="$nonopt $@"
5556 compile_command=$nonopt
5557 finalize_command=$nonopt
5558
5559 compile_rpath=
5560 finalize_rpath=
5561 compile_shlibpath=
5562 finalize_shlibpath=
5563 convenience=
5564 old_convenience=
5565 deplibs=
5566 old_deplibs=
5567 compiler_flags=
5568 linker_flags=
5569 dllsearchpath=
5570 lib_search_path=`pwd`
5571 inst_prefix_dir=
5572 new_inherited_linker_flags=
5573
5574 avoid_version=no
cristy98dddb52010-11-04 00:30:15 +00005575 bindir=
cristy3ed852e2009-09-05 21:47:34 +00005576 dlfiles=
5577 dlprefiles=
5578 dlself=no
5579 export_dynamic=no
5580 export_symbols=
5581 export_symbols_regex=
5582 generated=
5583 libobjs=
5584 ltlibs=
5585 module=no
5586 no_install=no
5587 objs=
5588 non_pic_objects=
5589 precious_files_regex=
5590 prefer_static_libs=no
5591 preload=no
5592 prev=
5593 prevarg=
5594 release=
5595 rpath=
5596 xrpath=
5597 perm_rpath=
5598 temp_rpath=
5599 thread_safe=no
5600 vinfo=
5601 vinfo_number=no
5602 weak_libs=
5603 single_module="${wl}-single_module"
5604 func_infer_tag $base_compile
5605
5606 # We need to know -static, to get the right output filenames.
5607 for arg
5608 do
5609 case $arg in
5610 -shared)
5611 test "$build_libtool_libs" != yes && \
5612 func_fatal_configuration "can not build a shared library"
5613 build_old_libs=no
5614 break
5615 ;;
5616 -all-static | -static | -static-libtool-libs)
5617 case $arg in
5618 -all-static)
5619 if test "$build_libtool_libs" = yes && test -z "$link_static_flag"; then
5620 func_warning "complete static linking is impossible in this configuration"
5621 fi
5622 if test -n "$link_static_flag"; then
5623 dlopen_self=$dlopen_self_static
5624 fi
5625 prefer_static_libs=yes
5626 ;;
5627 -static)
5628 if test -z "$pic_flag" && test -n "$link_static_flag"; then
5629 dlopen_self=$dlopen_self_static
5630 fi
5631 prefer_static_libs=built
5632 ;;
5633 -static-libtool-libs)
5634 if test -z "$pic_flag" && test -n "$link_static_flag"; then
5635 dlopen_self=$dlopen_self_static
5636 fi
5637 prefer_static_libs=yes
5638 ;;
5639 esac
5640 build_libtool_libs=no
5641 build_old_libs=yes
5642 break
5643 ;;
5644 esac
5645 done
5646
5647 # See if our shared archives depend on static archives.
5648 test -n "$old_archive_from_new_cmds" && build_old_libs=yes
5649
5650 # Go through the arguments, transforming them on the way.
5651 while test "$#" -gt 0; do
5652 arg="$1"
5653 shift
5654 func_quote_for_eval "$arg"
5655 qarg=$func_quote_for_eval_unquoted_result
cristyda16f162011-02-19 23:52:17 +00005656 libtool_args+=" $func_quote_for_eval_result"
cristy3ed852e2009-09-05 21:47:34 +00005657
5658 # If the previous option needs an argument, assign it.
5659 if test -n "$prev"; then
5660 case $prev in
5661 output)
cristyda16f162011-02-19 23:52:17 +00005662 compile_command+=" @OUTPUT@"
5663 finalize_command+=" @OUTPUT@"
cristy3ed852e2009-09-05 21:47:34 +00005664 ;;
5665 esac
5666
5667 case $prev in
cristy98dddb52010-11-04 00:30:15 +00005668 bindir)
5669 bindir="$arg"
5670 prev=
5671 continue
5672 ;;
cristy3ed852e2009-09-05 21:47:34 +00005673 dlfiles|dlprefiles)
5674 if test "$preload" = no; then
5675 # Add the symbol object into the linking commands.
cristyda16f162011-02-19 23:52:17 +00005676 compile_command+=" @SYMFILE@"
5677 finalize_command+=" @SYMFILE@"
cristy3ed852e2009-09-05 21:47:34 +00005678 preload=yes
5679 fi
5680 case $arg in
5681 *.la | *.lo) ;; # We handle these cases below.
5682 force)
5683 if test "$dlself" = no; then
5684 dlself=needless
5685 export_dynamic=yes
5686 fi
5687 prev=
5688 continue
5689 ;;
5690 self)
5691 if test "$prev" = dlprefiles; then
5692 dlself=yes
5693 elif test "$prev" = dlfiles && test "$dlopen_self" != yes; then
5694 dlself=yes
5695 else
5696 dlself=needless
5697 export_dynamic=yes
5698 fi
5699 prev=
5700 continue
5701 ;;
5702 *)
5703 if test "$prev" = dlfiles; then
cristyda16f162011-02-19 23:52:17 +00005704 dlfiles+=" $arg"
cristy3ed852e2009-09-05 21:47:34 +00005705 else
cristyda16f162011-02-19 23:52:17 +00005706 dlprefiles+=" $arg"
cristy3ed852e2009-09-05 21:47:34 +00005707 fi
5708 prev=
5709 continue
5710 ;;
5711 esac
5712 ;;
5713 expsyms)
5714 export_symbols="$arg"
5715 test -f "$arg" \
5716 || func_fatal_error "symbol file \`$arg' does not exist"
5717 prev=
5718 continue
5719 ;;
5720 expsyms_regex)
5721 export_symbols_regex="$arg"
5722 prev=
5723 continue
5724 ;;
5725 framework)
5726 case $host in
5727 *-*-darwin*)
5728 case "$deplibs " in
5729 *" $qarg.ltframework "*) ;;
cristyda16f162011-02-19 23:52:17 +00005730 *) deplibs+=" $qarg.ltframework" # this is fixed later
cristy3ed852e2009-09-05 21:47:34 +00005731 ;;
5732 esac
5733 ;;
5734 esac
5735 prev=
5736 continue
5737 ;;
5738 inst_prefix)
5739 inst_prefix_dir="$arg"
5740 prev=
5741 continue
5742 ;;
5743 objectlist)
5744 if test -f "$arg"; then
5745 save_arg=$arg
5746 moreargs=
5747 for fil in `cat "$save_arg"`
5748 do
cristyda16f162011-02-19 23:52:17 +00005749# moreargs+=" $fil"
cristy3ed852e2009-09-05 21:47:34 +00005750 arg=$fil
5751 # A libtool-controlled object.
5752
5753 # Check to see that this really is a libtool object.
5754 if func_lalib_unsafe_p "$arg"; then
5755 pic_object=
5756 non_pic_object=
5757
5758 # Read the .lo file
5759 func_source "$arg"
5760
5761 if test -z "$pic_object" ||
5762 test -z "$non_pic_object" ||
5763 test "$pic_object" = none &&
5764 test "$non_pic_object" = none; then
5765 func_fatal_error "cannot find name of object for \`$arg'"
5766 fi
5767
5768 # Extract subdirectory from the argument.
5769 func_dirname "$arg" "/" ""
5770 xdir="$func_dirname_result"
5771
5772 if test "$pic_object" != none; then
5773 # Prepend the subdirectory the object is found in.
5774 pic_object="$xdir$pic_object"
5775
5776 if test "$prev" = dlfiles; then
5777 if test "$build_libtool_libs" = yes && test "$dlopen_support" = yes; then
cristyda16f162011-02-19 23:52:17 +00005778 dlfiles+=" $pic_object"
cristy3ed852e2009-09-05 21:47:34 +00005779 prev=
5780 continue
5781 else
5782 # If libtool objects are unsupported, then we need to preload.
5783 prev=dlprefiles
5784 fi
5785 fi
5786
5787 # CHECK ME: I think I busted this. -Ossama
5788 if test "$prev" = dlprefiles; then
5789 # Preload the old-style object.
cristyda16f162011-02-19 23:52:17 +00005790 dlprefiles+=" $pic_object"
cristy3ed852e2009-09-05 21:47:34 +00005791 prev=
5792 fi
5793
5794 # A PIC object.
cristyda16f162011-02-19 23:52:17 +00005795 libobjs+=" $pic_object"
cristy3ed852e2009-09-05 21:47:34 +00005796 arg="$pic_object"
5797 fi
5798
5799 # Non-PIC object.
5800 if test "$non_pic_object" != none; then
5801 # Prepend the subdirectory the object is found in.
5802 non_pic_object="$xdir$non_pic_object"
5803
5804 # A standard non-PIC object
cristyda16f162011-02-19 23:52:17 +00005805 non_pic_objects+=" $non_pic_object"
cristy3ed852e2009-09-05 21:47:34 +00005806 if test -z "$pic_object" || test "$pic_object" = none ; then
5807 arg="$non_pic_object"
5808 fi
5809 else
5810 # If the PIC object exists, use it instead.
5811 # $xdir was prepended to $pic_object above.
5812 non_pic_object="$pic_object"
cristyda16f162011-02-19 23:52:17 +00005813 non_pic_objects+=" $non_pic_object"
cristy3ed852e2009-09-05 21:47:34 +00005814 fi
5815 else
5816 # Only an error if not doing a dry-run.
5817 if $opt_dry_run; then
5818 # Extract subdirectory from the argument.
5819 func_dirname "$arg" "/" ""
5820 xdir="$func_dirname_result"
5821
5822 func_lo2o "$arg"
5823 pic_object=$xdir$objdir/$func_lo2o_result
5824 non_pic_object=$xdir$func_lo2o_result
cristyda16f162011-02-19 23:52:17 +00005825 libobjs+=" $pic_object"
5826 non_pic_objects+=" $non_pic_object"
cristy3ed852e2009-09-05 21:47:34 +00005827 else
5828 func_fatal_error "\`$arg' is not a valid libtool object"
5829 fi
5830 fi
5831 done
5832 else
5833 func_fatal_error "link input file \`$arg' does not exist"
5834 fi
5835 arg=$save_arg
5836 prev=
5837 continue
5838 ;;
5839 precious_regex)
5840 precious_files_regex="$arg"
5841 prev=
5842 continue
5843 ;;
5844 release)
5845 release="-$arg"
5846 prev=
5847 continue
5848 ;;
5849 rpath | xrpath)
5850 # We need an absolute path.
5851 case $arg in
5852 [\\/]* | [A-Za-z]:[\\/]*) ;;
5853 *)
5854 func_fatal_error "only absolute run-paths are allowed"
5855 ;;
5856 esac
5857 if test "$prev" = rpath; then
5858 case "$rpath " in
5859 *" $arg "*) ;;
cristyda16f162011-02-19 23:52:17 +00005860 *) rpath+=" $arg" ;;
cristy3ed852e2009-09-05 21:47:34 +00005861 esac
5862 else
5863 case "$xrpath " in
5864 *" $arg "*) ;;
cristyda16f162011-02-19 23:52:17 +00005865 *) xrpath+=" $arg" ;;
cristy3ed852e2009-09-05 21:47:34 +00005866 esac
5867 fi
5868 prev=
5869 continue
5870 ;;
5871 shrext)
5872 shrext_cmds="$arg"
5873 prev=
5874 continue
5875 ;;
5876 weak)
cristyda16f162011-02-19 23:52:17 +00005877 weak_libs+=" $arg"
cristy3ed852e2009-09-05 21:47:34 +00005878 prev=
5879 continue
5880 ;;
5881 xcclinker)
cristyda16f162011-02-19 23:52:17 +00005882 linker_flags+=" $qarg"
5883 compiler_flags+=" $qarg"
cristy3ed852e2009-09-05 21:47:34 +00005884 prev=
cristyda16f162011-02-19 23:52:17 +00005885 compile_command+=" $qarg"
5886 finalize_command+=" $qarg"
cristy3ed852e2009-09-05 21:47:34 +00005887 continue
5888 ;;
5889 xcompiler)
cristyda16f162011-02-19 23:52:17 +00005890 compiler_flags+=" $qarg"
cristy3ed852e2009-09-05 21:47:34 +00005891 prev=
cristyda16f162011-02-19 23:52:17 +00005892 compile_command+=" $qarg"
5893 finalize_command+=" $qarg"
cristy3ed852e2009-09-05 21:47:34 +00005894 continue
5895 ;;
5896 xlinker)
cristyda16f162011-02-19 23:52:17 +00005897 linker_flags+=" $qarg"
5898 compiler_flags+=" $wl$qarg"
cristy3ed852e2009-09-05 21:47:34 +00005899 prev=
cristyda16f162011-02-19 23:52:17 +00005900 compile_command+=" $wl$qarg"
5901 finalize_command+=" $wl$qarg"
cristy3ed852e2009-09-05 21:47:34 +00005902 continue
5903 ;;
5904 *)
5905 eval "$prev=\"\$arg\""
5906 prev=
5907 continue
5908 ;;
5909 esac
5910 fi # test -n "$prev"
5911
5912 prevarg="$arg"
5913
5914 case $arg in
5915 -all-static)
5916 if test -n "$link_static_flag"; then
5917 # See comment for -static flag below, for more details.
cristyda16f162011-02-19 23:52:17 +00005918 compile_command+=" $link_static_flag"
5919 finalize_command+=" $link_static_flag"
cristy3ed852e2009-09-05 21:47:34 +00005920 fi
5921 continue
5922 ;;
5923
5924 -allow-undefined)
5925 # FIXME: remove this flag sometime in the future.
5926 func_fatal_error "\`-allow-undefined' must not be used because it is the default"
5927 ;;
5928
5929 -avoid-version)
5930 avoid_version=yes
5931 continue
5932 ;;
5933
cristy98dddb52010-11-04 00:30:15 +00005934 -bindir)
5935 prev=bindir
5936 continue
5937 ;;
5938
cristy3ed852e2009-09-05 21:47:34 +00005939 -dlopen)
5940 prev=dlfiles
5941 continue
5942 ;;
5943
5944 -dlpreopen)
5945 prev=dlprefiles
5946 continue
5947 ;;
5948
5949 -export-dynamic)
5950 export_dynamic=yes
5951 continue
5952 ;;
5953
5954 -export-symbols | -export-symbols-regex)
5955 if test -n "$export_symbols" || test -n "$export_symbols_regex"; then
5956 func_fatal_error "more than one -exported-symbols argument is not allowed"
5957 fi
5958 if test "X$arg" = "X-export-symbols"; then
5959 prev=expsyms
5960 else
5961 prev=expsyms_regex
5962 fi
5963 continue
5964 ;;
5965
5966 -framework)
5967 prev=framework
5968 continue
5969 ;;
5970
5971 -inst-prefix-dir)
5972 prev=inst_prefix
5973 continue
5974 ;;
5975
5976 # The native IRIX linker understands -LANG:*, -LIST:* and -LNO:*
5977 # so, if we see these flags be careful not to treat them like -L
5978 -L[A-Z][A-Z]*:*)
5979 case $with_gcc/$host in
5980 no/*-*-irix* | /*-*-irix*)
cristyda16f162011-02-19 23:52:17 +00005981 compile_command+=" $arg"
5982 finalize_command+=" $arg"
cristy3ed852e2009-09-05 21:47:34 +00005983 ;;
5984 esac
5985 continue
5986 ;;
5987
5988 -L*)
cristyda16f162011-02-19 23:52:17 +00005989 func_stripname "-L" '' "$arg"
5990 if test -z "$func_stripname_result"; then
cristy3ed852e2009-09-05 21:47:34 +00005991 if test "$#" -gt 0; then
5992 func_fatal_error "require no space between \`-L' and \`$1'"
5993 else
5994 func_fatal_error "need path for \`-L' option"
5995 fi
5996 fi
cristyda16f162011-02-19 23:52:17 +00005997 func_resolve_sysroot "$func_stripname_result"
5998 dir=$func_resolve_sysroot_result
cristy3ed852e2009-09-05 21:47:34 +00005999 # We need an absolute path.
6000 case $dir in
6001 [\\/]* | [A-Za-z]:[\\/]*) ;;
6002 *)
6003 absdir=`cd "$dir" && pwd`
6004 test -z "$absdir" && \
6005 func_fatal_error "cannot determine absolute directory name of \`$dir'"
6006 dir="$absdir"
6007 ;;
6008 esac
6009 case "$deplibs " in
cristyda16f162011-02-19 23:52:17 +00006010 *" -L$dir "* | *" $arg "*)
6011 # Will only happen for absolute or sysroot arguments
6012 ;;
cristy3ed852e2009-09-05 21:47:34 +00006013 *)
cristyda16f162011-02-19 23:52:17 +00006014 # Preserve sysroot, but never include relative directories
6015 case $dir in
6016 [\\/]* | [A-Za-z]:[\\/]* | =*) deplibs+=" $arg" ;;
6017 *) deplibs+=" -L$dir" ;;
6018 esac
6019 lib_search_path+=" $dir"
cristy3ed852e2009-09-05 21:47:34 +00006020 ;;
6021 esac
6022 case $host in
6023 *-*-cygwin* | *-*-mingw* | *-*-pw32* | *-*-os2* | *-cegcc*)
cristy98dddb52010-11-04 00:30:15 +00006024 testbindir=`$ECHO "$dir" | $SED 's*/lib$*/bin*'`
cristy3ed852e2009-09-05 21:47:34 +00006025 case :$dllsearchpath: in
6026 *":$dir:"*) ;;
6027 ::) dllsearchpath=$dir;;
cristyda16f162011-02-19 23:52:17 +00006028 *) dllsearchpath+=":$dir";;
cristy3ed852e2009-09-05 21:47:34 +00006029 esac
6030 case :$dllsearchpath: in
6031 *":$testbindir:"*) ;;
6032 ::) dllsearchpath=$testbindir;;
cristyda16f162011-02-19 23:52:17 +00006033 *) dllsearchpath+=":$testbindir";;
cristy3ed852e2009-09-05 21:47:34 +00006034 esac
6035 ;;
6036 esac
6037 continue
6038 ;;
6039
6040 -l*)
6041 if test "X$arg" = "X-lc" || test "X$arg" = "X-lm"; then
6042 case $host in
cristy98dddb52010-11-04 00:30:15 +00006043 *-*-cygwin* | *-*-mingw* | *-*-pw32* | *-*-beos* | *-cegcc* | *-*-haiku*)
cristy3ed852e2009-09-05 21:47:34 +00006044 # These systems don't actually have a C or math library (as such)
6045 continue
6046 ;;
6047 *-*-os2*)
6048 # These systems don't actually have a C library (as such)
6049 test "X$arg" = "X-lc" && continue
6050 ;;
6051 *-*-openbsd* | *-*-freebsd* | *-*-dragonfly*)
6052 # Do not include libc due to us having libc/libc_r.
6053 test "X$arg" = "X-lc" && continue
6054 ;;
6055 *-*-rhapsody* | *-*-darwin1.[012])
6056 # Rhapsody C and math libraries are in the System framework
cristyda16f162011-02-19 23:52:17 +00006057 deplibs+=" System.ltframework"
cristy3ed852e2009-09-05 21:47:34 +00006058 continue
6059 ;;
6060 *-*-sco3.2v5* | *-*-sco5v6*)
6061 # Causes problems with __ctype
6062 test "X$arg" = "X-lc" && continue
6063 ;;
6064 *-*-sysv4.2uw2* | *-*-sysv5* | *-*-unixware* | *-*-OpenUNIX*)
6065 # Compiler inserts libc in the correct place for threads to work
6066 test "X$arg" = "X-lc" && continue
6067 ;;
6068 esac
6069 elif test "X$arg" = "X-lc_r"; then
6070 case $host in
6071 *-*-openbsd* | *-*-freebsd* | *-*-dragonfly*)
6072 # Do not include libc_r directly, use -pthread flag.
6073 continue
6074 ;;
6075 esac
6076 fi
cristyda16f162011-02-19 23:52:17 +00006077 deplibs+=" $arg"
cristy3ed852e2009-09-05 21:47:34 +00006078 continue
6079 ;;
6080
6081 -module)
6082 module=yes
6083 continue
6084 ;;
6085
6086 # Tru64 UNIX uses -model [arg] to determine the layout of C++
6087 # classes, name mangling, and exception handling.
6088 # Darwin uses the -arch flag to determine output architecture.
cristyda16f162011-02-19 23:52:17 +00006089 -model|-arch|-isysroot|--sysroot)
6090 compiler_flags+=" $arg"
6091 compile_command+=" $arg"
6092 finalize_command+=" $arg"
cristy3ed852e2009-09-05 21:47:34 +00006093 prev=xcompiler
6094 continue
6095 ;;
6096
cristy2542fc62011-12-06 17:50:25 +00006097 -mt|-mthreads|-kthread|-Kthread|-pthread|-pthreads|--thread-safe \
6098 |-threads|-fopenmp|-openmp|-mp|-xopenmp|-omp|-qsmp=*)
cristyda16f162011-02-19 23:52:17 +00006099 compiler_flags+=" $arg"
6100 compile_command+=" $arg"
6101 finalize_command+=" $arg"
cristy3ed852e2009-09-05 21:47:34 +00006102 case "$new_inherited_linker_flags " in
6103 *" $arg "*) ;;
cristyda16f162011-02-19 23:52:17 +00006104 * ) new_inherited_linker_flags+=" $arg" ;;
cristy3ed852e2009-09-05 21:47:34 +00006105 esac
6106 continue
6107 ;;
6108
6109 -multi_module)
6110 single_module="${wl}-multi_module"
6111 continue
6112 ;;
6113
6114 -no-fast-install)
6115 fast_install=no
6116 continue
6117 ;;
6118
6119 -no-install)
6120 case $host in
6121 *-*-cygwin* | *-*-mingw* | *-*-pw32* | *-*-os2* | *-*-darwin* | *-cegcc*)
6122 # The PATH hackery in wrapper scripts is required on Windows
6123 # and Darwin in order for the loader to find any dlls it needs.
6124 func_warning "\`-no-install' is ignored for $host"
6125 func_warning "assuming \`-no-fast-install' instead"
6126 fast_install=no
6127 ;;
6128 *) no_install=yes ;;
6129 esac
6130 continue
6131 ;;
6132
6133 -no-undefined)
6134 allow_undefined=no
6135 continue
6136 ;;
6137
6138 -objectlist)
6139 prev=objectlist
6140 continue
6141 ;;
6142
6143 -o) prev=output ;;
6144
6145 -precious-files-regex)
6146 prev=precious_regex
6147 continue
6148 ;;
6149
6150 -release)
6151 prev=release
6152 continue
6153 ;;
6154
6155 -rpath)
6156 prev=rpath
6157 continue
6158 ;;
6159
6160 -R)
6161 prev=xrpath
6162 continue
6163 ;;
6164
6165 -R*)
6166 func_stripname '-R' '' "$arg"
6167 dir=$func_stripname_result
6168 # We need an absolute path.
6169 case $dir in
6170 [\\/]* | [A-Za-z]:[\\/]*) ;;
cristyda16f162011-02-19 23:52:17 +00006171 =*)
6172 func_stripname '=' '' "$dir"
6173 dir=$lt_sysroot$func_stripname_result
6174 ;;
cristy3ed852e2009-09-05 21:47:34 +00006175 *)
6176 func_fatal_error "only absolute run-paths are allowed"
6177 ;;
6178 esac
6179 case "$xrpath " in
6180 *" $dir "*) ;;
cristyda16f162011-02-19 23:52:17 +00006181 *) xrpath+=" $dir" ;;
cristy3ed852e2009-09-05 21:47:34 +00006182 esac
6183 continue
6184 ;;
6185
6186 -shared)
6187 # The effects of -shared are defined in a previous loop.
6188 continue
6189 ;;
6190
6191 -shrext)
6192 prev=shrext
6193 continue
6194 ;;
6195
6196 -static | -static-libtool-libs)
6197 # The effects of -static are defined in a previous loop.
6198 # We used to do the same as -all-static on platforms that
6199 # didn't have a PIC flag, but the assumption that the effects
6200 # would be equivalent was wrong. It would break on at least
6201 # Digital Unix and AIX.
6202 continue
6203 ;;
6204
6205 -thread-safe)
6206 thread_safe=yes
6207 continue
6208 ;;
6209
6210 -version-info)
6211 prev=vinfo
6212 continue
6213 ;;
6214
6215 -version-number)
6216 prev=vinfo
6217 vinfo_number=yes
6218 continue
6219 ;;
6220
6221 -weak)
6222 prev=weak
6223 continue
6224 ;;
6225
6226 -Wc,*)
6227 func_stripname '-Wc,' '' "$arg"
6228 args=$func_stripname_result
6229 arg=
6230 save_ifs="$IFS"; IFS=','
6231 for flag in $args; do
6232 IFS="$save_ifs"
6233 func_quote_for_eval "$flag"
cristyda16f162011-02-19 23:52:17 +00006234 arg+=" $func_quote_for_eval_result"
6235 compiler_flags+=" $func_quote_for_eval_result"
cristy3ed852e2009-09-05 21:47:34 +00006236 done
6237 IFS="$save_ifs"
6238 func_stripname ' ' '' "$arg"
6239 arg=$func_stripname_result
6240 ;;
6241
6242 -Wl,*)
6243 func_stripname '-Wl,' '' "$arg"
6244 args=$func_stripname_result
6245 arg=
6246 save_ifs="$IFS"; IFS=','
6247 for flag in $args; do
6248 IFS="$save_ifs"
6249 func_quote_for_eval "$flag"
cristyda16f162011-02-19 23:52:17 +00006250 arg+=" $wl$func_quote_for_eval_result"
6251 compiler_flags+=" $wl$func_quote_for_eval_result"
6252 linker_flags+=" $func_quote_for_eval_result"
cristy3ed852e2009-09-05 21:47:34 +00006253 done
6254 IFS="$save_ifs"
6255 func_stripname ' ' '' "$arg"
6256 arg=$func_stripname_result
6257 ;;
6258
6259 -Xcompiler)
6260 prev=xcompiler
6261 continue
6262 ;;
6263
6264 -Xlinker)
6265 prev=xlinker
6266 continue
6267 ;;
6268
6269 -XCClinker)
6270 prev=xcclinker
6271 continue
6272 ;;
6273
6274 # -msg_* for osf cc
6275 -msg_*)
6276 func_quote_for_eval "$arg"
6277 arg="$func_quote_for_eval_result"
6278 ;;
6279
cristy98dddb52010-11-04 00:30:15 +00006280 # Flags to be passed through unchanged, with rationale:
6281 # -64, -mips[0-9] enable 64-bit mode for the SGI compiler
6282 # -r[0-9][0-9]* specify processor for the SGI compiler
6283 # -xarch=*, -xtarget=* enable 64-bit mode for the Sun compiler
6284 # +DA*, +DD* enable 64-bit mode for the HP compiler
6285 # -q* compiler args for the IBM compiler
6286 # -m*, -t[45]*, -txscale* architecture-specific flags for GCC
6287 # -F/path path to uninstalled frameworks, gcc on darwin
6288 # -p, -pg, --coverage, -fprofile-* profiling flags for GCC
6289 # @file GCC response files
6290 # -tp=* Portland pgcc target processor selection
cristyda16f162011-02-19 23:52:17 +00006291 # --sysroot=* for sysroot support
6292 # -O*, -flto*, -fwhopr*, -fuse-linker-plugin GCC link-time optimization
cristy3ed852e2009-09-05 21:47:34 +00006293 -64|-mips[0-9]|-r[0-9][0-9]*|-xarch=*|-xtarget=*|+DA*|+DD*|-q*|-m*| \
cristyda16f162011-02-19 23:52:17 +00006294 -t[45]*|-txscale*|-p|-pg|--coverage|-fprofile-*|-F*|@*|-tp=*|--sysroot=*| \
6295 -O*|-flto*|-fwhopr*|-fuse-linker-plugin)
cristy3ed852e2009-09-05 21:47:34 +00006296 func_quote_for_eval "$arg"
6297 arg="$func_quote_for_eval_result"
cristyda16f162011-02-19 23:52:17 +00006298 compile_command+=" $arg"
6299 finalize_command+=" $arg"
6300 compiler_flags+=" $arg"
cristy3ed852e2009-09-05 21:47:34 +00006301 continue
6302 ;;
6303
6304 # Some other compiler flag.
6305 -* | +*)
6306 func_quote_for_eval "$arg"
6307 arg="$func_quote_for_eval_result"
6308 ;;
6309
6310 *.$objext)
6311 # A standard object.
cristyda16f162011-02-19 23:52:17 +00006312 objs+=" $arg"
cristy3ed852e2009-09-05 21:47:34 +00006313 ;;
6314
6315 *.lo)
6316 # A libtool-controlled object.
6317
6318 # Check to see that this really is a libtool object.
6319 if func_lalib_unsafe_p "$arg"; then
6320 pic_object=
6321 non_pic_object=
6322
6323 # Read the .lo file
6324 func_source "$arg"
6325
6326 if test -z "$pic_object" ||
6327 test -z "$non_pic_object" ||
6328 test "$pic_object" = none &&
6329 test "$non_pic_object" = none; then
6330 func_fatal_error "cannot find name of object for \`$arg'"
6331 fi
6332
6333 # Extract subdirectory from the argument.
6334 func_dirname "$arg" "/" ""
6335 xdir="$func_dirname_result"
6336
6337 if test "$pic_object" != none; then
6338 # Prepend the subdirectory the object is found in.
6339 pic_object="$xdir$pic_object"
6340
6341 if test "$prev" = dlfiles; then
6342 if test "$build_libtool_libs" = yes && test "$dlopen_support" = yes; then
cristyda16f162011-02-19 23:52:17 +00006343 dlfiles+=" $pic_object"
cristy3ed852e2009-09-05 21:47:34 +00006344 prev=
6345 continue
6346 else
6347 # If libtool objects are unsupported, then we need to preload.
6348 prev=dlprefiles
6349 fi
6350 fi
6351
6352 # CHECK ME: I think I busted this. -Ossama
6353 if test "$prev" = dlprefiles; then
6354 # Preload the old-style object.
cristyda16f162011-02-19 23:52:17 +00006355 dlprefiles+=" $pic_object"
cristy3ed852e2009-09-05 21:47:34 +00006356 prev=
6357 fi
6358
6359 # A PIC object.
cristyda16f162011-02-19 23:52:17 +00006360 libobjs+=" $pic_object"
cristy3ed852e2009-09-05 21:47:34 +00006361 arg="$pic_object"
6362 fi
6363
6364 # Non-PIC object.
6365 if test "$non_pic_object" != none; then
6366 # Prepend the subdirectory the object is found in.
6367 non_pic_object="$xdir$non_pic_object"
6368
6369 # A standard non-PIC object
cristyda16f162011-02-19 23:52:17 +00006370 non_pic_objects+=" $non_pic_object"
cristy3ed852e2009-09-05 21:47:34 +00006371 if test -z "$pic_object" || test "$pic_object" = none ; then
6372 arg="$non_pic_object"
6373 fi
6374 else
6375 # If the PIC object exists, use it instead.
6376 # $xdir was prepended to $pic_object above.
6377 non_pic_object="$pic_object"
cristyda16f162011-02-19 23:52:17 +00006378 non_pic_objects+=" $non_pic_object"
cristy3ed852e2009-09-05 21:47:34 +00006379 fi
6380 else
6381 # Only an error if not doing a dry-run.
6382 if $opt_dry_run; then
6383 # Extract subdirectory from the argument.
6384 func_dirname "$arg" "/" ""
6385 xdir="$func_dirname_result"
6386
6387 func_lo2o "$arg"
6388 pic_object=$xdir$objdir/$func_lo2o_result
6389 non_pic_object=$xdir$func_lo2o_result
cristyda16f162011-02-19 23:52:17 +00006390 libobjs+=" $pic_object"
6391 non_pic_objects+=" $non_pic_object"
cristy3ed852e2009-09-05 21:47:34 +00006392 else
6393 func_fatal_error "\`$arg' is not a valid libtool object"
6394 fi
6395 fi
6396 ;;
6397
6398 *.$libext)
6399 # An archive.
cristyda16f162011-02-19 23:52:17 +00006400 deplibs+=" $arg"
6401 old_deplibs+=" $arg"
cristy3ed852e2009-09-05 21:47:34 +00006402 continue
6403 ;;
6404
6405 *.la)
6406 # A libtool-controlled library.
6407
cristyda16f162011-02-19 23:52:17 +00006408 func_resolve_sysroot "$arg"
cristy3ed852e2009-09-05 21:47:34 +00006409 if test "$prev" = dlfiles; then
6410 # This library was specified with -dlopen.
cristyda16f162011-02-19 23:52:17 +00006411 dlfiles+=" $func_resolve_sysroot_result"
cristy3ed852e2009-09-05 21:47:34 +00006412 prev=
6413 elif test "$prev" = dlprefiles; then
6414 # The library was specified with -dlpreopen.
cristyda16f162011-02-19 23:52:17 +00006415 dlprefiles+=" $func_resolve_sysroot_result"
cristy3ed852e2009-09-05 21:47:34 +00006416 prev=
6417 else
cristyda16f162011-02-19 23:52:17 +00006418 deplibs+=" $func_resolve_sysroot_result"
cristy3ed852e2009-09-05 21:47:34 +00006419 fi
6420 continue
6421 ;;
6422
6423 # Some other compiler argument.
6424 *)
6425 # Unknown arguments in both finalize_command and compile_command need
6426 # to be aesthetically quoted because they are evaled later.
6427 func_quote_for_eval "$arg"
6428 arg="$func_quote_for_eval_result"
6429 ;;
6430 esac # arg
6431
6432 # Now actually substitute the argument into the commands.
6433 if test -n "$arg"; then
cristyda16f162011-02-19 23:52:17 +00006434 compile_command+=" $arg"
6435 finalize_command+=" $arg"
cristy3ed852e2009-09-05 21:47:34 +00006436 fi
6437 done # argument parsing loop
6438
6439 test -n "$prev" && \
6440 func_fatal_help "the \`$prevarg' option requires an argument"
6441
6442 if test "$export_dynamic" = yes && test -n "$export_dynamic_flag_spec"; then
6443 eval arg=\"$export_dynamic_flag_spec\"
cristyda16f162011-02-19 23:52:17 +00006444 compile_command+=" $arg"
6445 finalize_command+=" $arg"
cristy3ed852e2009-09-05 21:47:34 +00006446 fi
6447
6448 oldlibs=
6449 # calculate the name of the file, without its directory
6450 func_basename "$output"
6451 outputname="$func_basename_result"
6452 libobjs_save="$libobjs"
6453
6454 if test -n "$shlibpath_var"; then
6455 # get the directories listed in $shlibpath_var
cristy98dddb52010-11-04 00:30:15 +00006456 eval shlib_search_path=\`\$ECHO \"\${$shlibpath_var}\" \| \$SED \'s/:/ /g\'\`
cristy3ed852e2009-09-05 21:47:34 +00006457 else
6458 shlib_search_path=
6459 fi
6460 eval sys_lib_search_path=\"$sys_lib_search_path_spec\"
6461 eval sys_lib_dlsearch_path=\"$sys_lib_dlsearch_path_spec\"
6462
6463 func_dirname "$output" "/" ""
6464 output_objdir="$func_dirname_result$objdir"
cristyda16f162011-02-19 23:52:17 +00006465 func_to_tool_file "$output_objdir/"
6466 tool_output_objdir=$func_to_tool_file_result
cristy3ed852e2009-09-05 21:47:34 +00006467 # Create the object directory.
6468 func_mkdir_p "$output_objdir"
6469
6470 # Determine the type of output
6471 case $output in
6472 "")
6473 func_fatal_help "you must specify an output file"
6474 ;;
6475 *.$libext) linkmode=oldlib ;;
6476 *.lo | *.$objext) linkmode=obj ;;
6477 *.la) linkmode=lib ;;
6478 *) linkmode=prog ;; # Anything else should be a program.
6479 esac
6480
6481 specialdeplibs=
6482
6483 libs=
6484 # Find all interdependent deplibs by searching for libraries
6485 # that are linked more than once (e.g. -la -lb -la)
6486 for deplib in $deplibs; do
cristyda16f162011-02-19 23:52:17 +00006487 if $opt_preserve_dup_deps ; then
cristy3ed852e2009-09-05 21:47:34 +00006488 case "$libs " in
cristyda16f162011-02-19 23:52:17 +00006489 *" $deplib "*) specialdeplibs+=" $deplib" ;;
cristy3ed852e2009-09-05 21:47:34 +00006490 esac
6491 fi
cristyda16f162011-02-19 23:52:17 +00006492 libs+=" $deplib"
cristy3ed852e2009-09-05 21:47:34 +00006493 done
6494
6495 if test "$linkmode" = lib; then
6496 libs="$predeps $libs $compiler_lib_search_path $postdeps"
6497
6498 # Compute libraries that are listed more than once in $predeps
6499 # $postdeps and mark them as special (i.e., whose duplicates are
6500 # not to be eliminated).
6501 pre_post_deps=
6502 if $opt_duplicate_compiler_generated_deps; then
6503 for pre_post_dep in $predeps $postdeps; do
6504 case "$pre_post_deps " in
cristyda16f162011-02-19 23:52:17 +00006505 *" $pre_post_dep "*) specialdeplibs+=" $pre_post_deps" ;;
cristy3ed852e2009-09-05 21:47:34 +00006506 esac
cristyda16f162011-02-19 23:52:17 +00006507 pre_post_deps+=" $pre_post_dep"
cristy3ed852e2009-09-05 21:47:34 +00006508 done
6509 fi
6510 pre_post_deps=
6511 fi
6512
6513 deplibs=
6514 newdependency_libs=
6515 newlib_search_path=
6516 need_relink=no # whether we're linking any uninstalled libtool libraries
6517 notinst_deplibs= # not-installed libtool libraries
6518 notinst_path= # paths that contain not-installed libtool libraries
6519
6520 case $linkmode in
6521 lib)
6522 passes="conv dlpreopen link"
6523 for file in $dlfiles $dlprefiles; do
6524 case $file in
6525 *.la) ;;
6526 *)
6527 func_fatal_help "libraries can \`-dlopen' only libtool libraries: $file"
6528 ;;
6529 esac
6530 done
6531 ;;
6532 prog)
6533 compile_deplibs=
6534 finalize_deplibs=
6535 alldeplibs=no
6536 newdlfiles=
6537 newdlprefiles=
6538 passes="conv scan dlopen dlpreopen link"
6539 ;;
6540 *) passes="conv"
6541 ;;
6542 esac
6543
6544 for pass in $passes; do
6545 # The preopen pass in lib mode reverses $deplibs; put it back here
6546 # so that -L comes before libs that need it for instance...
6547 if test "$linkmode,$pass" = "lib,link"; then
6548 ## FIXME: Find the place where the list is rebuilt in the wrong
6549 ## order, and fix it there properly
6550 tmp_deplibs=
6551 for deplib in $deplibs; do
6552 tmp_deplibs="$deplib $tmp_deplibs"
6553 done
6554 deplibs="$tmp_deplibs"
6555 fi
6556
6557 if test "$linkmode,$pass" = "lib,link" ||
6558 test "$linkmode,$pass" = "prog,scan"; then
6559 libs="$deplibs"
6560 deplibs=
6561 fi
6562 if test "$linkmode" = prog; then
6563 case $pass in
6564 dlopen) libs="$dlfiles" ;;
6565 dlpreopen) libs="$dlprefiles" ;;
6566 link) libs="$deplibs %DEPLIBS% $dependency_libs" ;;
6567 esac
6568 fi
6569 if test "$linkmode,$pass" = "lib,dlpreopen"; then
6570 # Collect and forward deplibs of preopened libtool libs
6571 for lib in $dlprefiles; do
6572 # Ignore non-libtool-libs
6573 dependency_libs=
cristyda16f162011-02-19 23:52:17 +00006574 func_resolve_sysroot "$lib"
cristy3ed852e2009-09-05 21:47:34 +00006575 case $lib in
cristyda16f162011-02-19 23:52:17 +00006576 *.la) func_source "$func_resolve_sysroot_result" ;;
cristy3ed852e2009-09-05 21:47:34 +00006577 esac
6578
6579 # Collect preopened libtool deplibs, except any this library
6580 # has declared as weak libs
6581 for deplib in $dependency_libs; do
cristy98dddb52010-11-04 00:30:15 +00006582 func_basename "$deplib"
6583 deplib_base=$func_basename_result
cristy3ed852e2009-09-05 21:47:34 +00006584 case " $weak_libs " in
6585 *" $deplib_base "*) ;;
cristyda16f162011-02-19 23:52:17 +00006586 *) deplibs+=" $deplib" ;;
cristy3ed852e2009-09-05 21:47:34 +00006587 esac
6588 done
6589 done
6590 libs="$dlprefiles"
6591 fi
6592 if test "$pass" = dlopen; then
6593 # Collect dlpreopened libraries
6594 save_deplibs="$deplibs"
6595 deplibs=
6596 fi
6597
6598 for deplib in $libs; do
6599 lib=
6600 found=no
6601 case $deplib in
cristy2542fc62011-12-06 17:50:25 +00006602 -mt|-mthreads|-kthread|-Kthread|-pthread|-pthreads|--thread-safe \
6603 |-threads|-fopenmp|-openmp|-mp|-xopenmp|-omp|-qsmp=*)
cristy3ed852e2009-09-05 21:47:34 +00006604 if test "$linkmode,$pass" = "prog,link"; then
6605 compile_deplibs="$deplib $compile_deplibs"
6606 finalize_deplibs="$deplib $finalize_deplibs"
6607 else
cristyda16f162011-02-19 23:52:17 +00006608 compiler_flags+=" $deplib"
cristy3ed852e2009-09-05 21:47:34 +00006609 if test "$linkmode" = lib ; then
6610 case "$new_inherited_linker_flags " in
6611 *" $deplib "*) ;;
cristyda16f162011-02-19 23:52:17 +00006612 * ) new_inherited_linker_flags+=" $deplib" ;;
cristy3ed852e2009-09-05 21:47:34 +00006613 esac
6614 fi
6615 fi
6616 continue
6617 ;;
6618 -l*)
6619 if test "$linkmode" != lib && test "$linkmode" != prog; then
6620 func_warning "\`-l' is ignored for archives/objects"
6621 continue
6622 fi
6623 func_stripname '-l' '' "$deplib"
6624 name=$func_stripname_result
6625 if test "$linkmode" = lib; then
6626 searchdirs="$newlib_search_path $lib_search_path $compiler_lib_search_dirs $sys_lib_search_path $shlib_search_path"
6627 else
6628 searchdirs="$newlib_search_path $lib_search_path $sys_lib_search_path $shlib_search_path"
6629 fi
6630 for searchdir in $searchdirs; do
6631 for search_ext in .la $std_shrext .so .a; do
6632 # Search the libtool library
6633 lib="$searchdir/lib${name}${search_ext}"
6634 if test -f "$lib"; then
6635 if test "$search_ext" = ".la"; then
6636 found=yes
6637 else
6638 found=no
6639 fi
6640 break 2
6641 fi
6642 done
6643 done
6644 if test "$found" != yes; then
6645 # deplib doesn't seem to be a libtool library
6646 if test "$linkmode,$pass" = "prog,link"; then
6647 compile_deplibs="$deplib $compile_deplibs"
6648 finalize_deplibs="$deplib $finalize_deplibs"
6649 else
6650 deplibs="$deplib $deplibs"
6651 test "$linkmode" = lib && newdependency_libs="$deplib $newdependency_libs"
6652 fi
6653 continue
6654 else # deplib is a libtool library
6655 # If $allow_libtool_libs_with_static_runtimes && $deplib is a stdlib,
6656 # We need to do some special things here, and not later.
6657 if test "X$allow_libtool_libs_with_static_runtimes" = "Xyes" ; then
6658 case " $predeps $postdeps " in
6659 *" $deplib "*)
6660 if func_lalib_p "$lib"; then
6661 library_names=
6662 old_library=
6663 func_source "$lib"
6664 for l in $old_library $library_names; do
6665 ll="$l"
6666 done
6667 if test "X$ll" = "X$old_library" ; then # only static version available
6668 found=no
6669 func_dirname "$lib" "" "."
6670 ladir="$func_dirname_result"
6671 lib=$ladir/$old_library
6672 if test "$linkmode,$pass" = "prog,link"; then
6673 compile_deplibs="$deplib $compile_deplibs"
6674 finalize_deplibs="$deplib $finalize_deplibs"
6675 else
6676 deplibs="$deplib $deplibs"
6677 test "$linkmode" = lib && newdependency_libs="$deplib $newdependency_libs"
6678 fi
6679 continue
6680 fi
6681 fi
6682 ;;
6683 *) ;;
6684 esac
6685 fi
6686 fi
6687 ;; # -l
6688 *.ltframework)
6689 if test "$linkmode,$pass" = "prog,link"; then
6690 compile_deplibs="$deplib $compile_deplibs"
6691 finalize_deplibs="$deplib $finalize_deplibs"
6692 else
6693 deplibs="$deplib $deplibs"
6694 if test "$linkmode" = lib ; then
6695 case "$new_inherited_linker_flags " in
6696 *" $deplib "*) ;;
cristyda16f162011-02-19 23:52:17 +00006697 * ) new_inherited_linker_flags+=" $deplib" ;;
cristy3ed852e2009-09-05 21:47:34 +00006698 esac
6699 fi
6700 fi
6701 continue
6702 ;;
6703 -L*)
6704 case $linkmode in
6705 lib)
6706 deplibs="$deplib $deplibs"
6707 test "$pass" = conv && continue
6708 newdependency_libs="$deplib $newdependency_libs"
6709 func_stripname '-L' '' "$deplib"
cristyda16f162011-02-19 23:52:17 +00006710 func_resolve_sysroot "$func_stripname_result"
6711 newlib_search_path+=" $func_resolve_sysroot_result"
cristy3ed852e2009-09-05 21:47:34 +00006712 ;;
6713 prog)
6714 if test "$pass" = conv; then
6715 deplibs="$deplib $deplibs"
6716 continue
6717 fi
6718 if test "$pass" = scan; then
6719 deplibs="$deplib $deplibs"
6720 else
6721 compile_deplibs="$deplib $compile_deplibs"
6722 finalize_deplibs="$deplib $finalize_deplibs"
6723 fi
6724 func_stripname '-L' '' "$deplib"
cristyda16f162011-02-19 23:52:17 +00006725 func_resolve_sysroot "$func_stripname_result"
6726 newlib_search_path+=" $func_resolve_sysroot_result"
cristy3ed852e2009-09-05 21:47:34 +00006727 ;;
6728 *)
6729 func_warning "\`-L' is ignored for archives/objects"
6730 ;;
6731 esac # linkmode
6732 continue
6733 ;; # -L
6734 -R*)
6735 if test "$pass" = link; then
6736 func_stripname '-R' '' "$deplib"
cristyda16f162011-02-19 23:52:17 +00006737 func_resolve_sysroot "$func_stripname_result"
6738 dir=$func_resolve_sysroot_result
cristy3ed852e2009-09-05 21:47:34 +00006739 # Make sure the xrpath contains only unique directories.
6740 case "$xrpath " in
6741 *" $dir "*) ;;
cristyda16f162011-02-19 23:52:17 +00006742 *) xrpath+=" $dir" ;;
cristy3ed852e2009-09-05 21:47:34 +00006743 esac
6744 fi
6745 deplibs="$deplib $deplibs"
6746 continue
6747 ;;
cristyda16f162011-02-19 23:52:17 +00006748 *.la)
6749 func_resolve_sysroot "$deplib"
6750 lib=$func_resolve_sysroot_result
6751 ;;
cristy3ed852e2009-09-05 21:47:34 +00006752 *.$libext)
6753 if test "$pass" = conv; then
6754 deplibs="$deplib $deplibs"
6755 continue
6756 fi
6757 case $linkmode in
6758 lib)
6759 # Linking convenience modules into shared libraries is allowed,
6760 # but linking other static libraries is non-portable.
6761 case " $dlpreconveniencelibs " in
6762 *" $deplib "*) ;;
6763 *)
6764 valid_a_lib=no
6765 case $deplibs_check_method in
6766 match_pattern*)
6767 set dummy $deplibs_check_method; shift
6768 match_pattern_regex=`expr "$deplibs_check_method" : "$1 \(.*\)"`
cristy98dddb52010-11-04 00:30:15 +00006769 if eval "\$ECHO \"$deplib\"" 2>/dev/null | $SED 10q \
cristy3ed852e2009-09-05 21:47:34 +00006770 | $EGREP "$match_pattern_regex" > /dev/null; then
6771 valid_a_lib=yes
6772 fi
6773 ;;
6774 pass_all)
6775 valid_a_lib=yes
6776 ;;
6777 esac
6778 if test "$valid_a_lib" != yes; then
cristy98dddb52010-11-04 00:30:15 +00006779 echo
cristy3ed852e2009-09-05 21:47:34 +00006780 $ECHO "*** Warning: Trying to link with static lib archive $deplib."
cristy98dddb52010-11-04 00:30:15 +00006781 echo "*** I have the capability to make that library automatically link in when"
6782 echo "*** you link to this library. But I can only do this if you have a"
6783 echo "*** shared version of the library, which you do not appear to have"
6784 echo "*** because the file extensions .$libext of this argument makes me believe"
6785 echo "*** that it is just a static archive that I should not use here."
cristy3ed852e2009-09-05 21:47:34 +00006786 else
cristy98dddb52010-11-04 00:30:15 +00006787 echo
cristy3ed852e2009-09-05 21:47:34 +00006788 $ECHO "*** Warning: Linking the shared library $output against the"
6789 $ECHO "*** static library $deplib is not portable!"
6790 deplibs="$deplib $deplibs"
6791 fi
6792 ;;
6793 esac
6794 continue
6795 ;;
6796 prog)
6797 if test "$pass" != link; then
6798 deplibs="$deplib $deplibs"
6799 else
6800 compile_deplibs="$deplib $compile_deplibs"
6801 finalize_deplibs="$deplib $finalize_deplibs"
6802 fi
6803 continue
6804 ;;
6805 esac # linkmode
6806 ;; # *.$libext
6807 *.lo | *.$objext)
6808 if test "$pass" = conv; then
6809 deplibs="$deplib $deplibs"
6810 elif test "$linkmode" = prog; then
6811 if test "$pass" = dlpreopen || test "$dlopen_support" != yes || test "$build_libtool_libs" = no; then
6812 # If there is no dlopen support or we're linking statically,
6813 # we need to preload.
cristyda16f162011-02-19 23:52:17 +00006814 newdlprefiles+=" $deplib"
cristy3ed852e2009-09-05 21:47:34 +00006815 compile_deplibs="$deplib $compile_deplibs"
6816 finalize_deplibs="$deplib $finalize_deplibs"
6817 else
cristyda16f162011-02-19 23:52:17 +00006818 newdlfiles+=" $deplib"
cristy3ed852e2009-09-05 21:47:34 +00006819 fi
6820 fi
6821 continue
6822 ;;
6823 %DEPLIBS%)
6824 alldeplibs=yes
6825 continue
6826 ;;
6827 esac # case $deplib
6828
6829 if test "$found" = yes || test -f "$lib"; then :
6830 else
6831 func_fatal_error "cannot find the library \`$lib' or unhandled argument \`$deplib'"
6832 fi
6833
6834 # Check to see that this really is a libtool archive.
6835 func_lalib_unsafe_p "$lib" \
6836 || func_fatal_error "\`$lib' is not a valid libtool archive"
6837
6838 func_dirname "$lib" "" "."
6839 ladir="$func_dirname_result"
6840
6841 dlname=
6842 dlopen=
6843 dlpreopen=
6844 libdir=
6845 library_names=
6846 old_library=
6847 inherited_linker_flags=
6848 # If the library was installed with an old release of libtool,
6849 # it will not redefine variables installed, or shouldnotlink
6850 installed=yes
6851 shouldnotlink=no
6852 avoidtemprpath=
6853
6854
6855 # Read the .la file
6856 func_source "$lib"
6857
6858 # Convert "-framework foo" to "foo.ltframework"
6859 if test -n "$inherited_linker_flags"; then
cristy98dddb52010-11-04 00:30:15 +00006860 tmp_inherited_linker_flags=`$ECHO "$inherited_linker_flags" | $SED 's/-framework \([^ $]*\)/\1.ltframework/g'`
cristy3ed852e2009-09-05 21:47:34 +00006861 for tmp_inherited_linker_flag in $tmp_inherited_linker_flags; do
6862 case " $new_inherited_linker_flags " in
6863 *" $tmp_inherited_linker_flag "*) ;;
cristyda16f162011-02-19 23:52:17 +00006864 *) new_inherited_linker_flags+=" $tmp_inherited_linker_flag";;
cristy3ed852e2009-09-05 21:47:34 +00006865 esac
6866 done
6867 fi
cristy98dddb52010-11-04 00:30:15 +00006868 dependency_libs=`$ECHO " $dependency_libs" | $SED 's% \([^ $]*\).ltframework% -framework \1%g'`
cristy3ed852e2009-09-05 21:47:34 +00006869 if test "$linkmode,$pass" = "lib,link" ||
6870 test "$linkmode,$pass" = "prog,scan" ||
6871 { test "$linkmode" != prog && test "$linkmode" != lib; }; then
cristyda16f162011-02-19 23:52:17 +00006872 test -n "$dlopen" && dlfiles+=" $dlopen"
6873 test -n "$dlpreopen" && dlprefiles+=" $dlpreopen"
cristy3ed852e2009-09-05 21:47:34 +00006874 fi
6875
6876 if test "$pass" = conv; then
6877 # Only check for convenience libraries
6878 deplibs="$lib $deplibs"
6879 if test -z "$libdir"; then
6880 if test -z "$old_library"; then
6881 func_fatal_error "cannot find name of link library for \`$lib'"
6882 fi
6883 # It is a libtool convenience library, so add in its objects.
cristyda16f162011-02-19 23:52:17 +00006884 convenience+=" $ladir/$objdir/$old_library"
6885 old_convenience+=" $ladir/$objdir/$old_library"
cristy3ed852e2009-09-05 21:47:34 +00006886 elif test "$linkmode" != prog && test "$linkmode" != lib; then
6887 func_fatal_error "\`$lib' is not a convenience library"
6888 fi
6889 tmp_libs=
6890 for deplib in $dependency_libs; do
6891 deplibs="$deplib $deplibs"
cristyda16f162011-02-19 23:52:17 +00006892 if $opt_preserve_dup_deps ; then
cristy3ed852e2009-09-05 21:47:34 +00006893 case "$tmp_libs " in
cristyda16f162011-02-19 23:52:17 +00006894 *" $deplib "*) specialdeplibs+=" $deplib" ;;
cristy3ed852e2009-09-05 21:47:34 +00006895 esac
6896 fi
cristyda16f162011-02-19 23:52:17 +00006897 tmp_libs+=" $deplib"
cristy3ed852e2009-09-05 21:47:34 +00006898 done
6899 continue
6900 fi # $pass = conv
6901
6902
6903 # Get the name of the library we link against.
6904 linklib=
cristyda16f162011-02-19 23:52:17 +00006905 if test -n "$old_library" &&
6906 { test "$prefer_static_libs" = yes ||
6907 test "$prefer_static_libs,$installed" = "built,no"; }; then
6908 linklib=$old_library
6909 else
6910 for l in $old_library $library_names; do
6911 linklib="$l"
6912 done
6913 fi
cristy3ed852e2009-09-05 21:47:34 +00006914 if test -z "$linklib"; then
6915 func_fatal_error "cannot find name of link library for \`$lib'"
6916 fi
6917
6918 # This library was specified with -dlopen.
6919 if test "$pass" = dlopen; then
6920 if test -z "$libdir"; then
6921 func_fatal_error "cannot -dlopen a convenience library: \`$lib'"
6922 fi
6923 if test -z "$dlname" ||
6924 test "$dlopen_support" != yes ||
6925 test "$build_libtool_libs" = no; then
6926 # If there is no dlname, no dlopen support or we're linking
6927 # statically, we need to preload. We also need to preload any
6928 # dependent libraries so libltdl's deplib preloader doesn't
6929 # bomb out in the load deplibs phase.
cristyda16f162011-02-19 23:52:17 +00006930 dlprefiles+=" $lib $dependency_libs"
cristy3ed852e2009-09-05 21:47:34 +00006931 else
cristyda16f162011-02-19 23:52:17 +00006932 newdlfiles+=" $lib"
cristy3ed852e2009-09-05 21:47:34 +00006933 fi
6934 continue
6935 fi # $pass = dlopen
6936
6937 # We need an absolute path.
6938 case $ladir in
6939 [\\/]* | [A-Za-z]:[\\/]*) abs_ladir="$ladir" ;;
6940 *)
6941 abs_ladir=`cd "$ladir" && pwd`
6942 if test -z "$abs_ladir"; then
6943 func_warning "cannot determine absolute directory name of \`$ladir'"
6944 func_warning "passing it literally to the linker, although it might fail"
6945 abs_ladir="$ladir"
6946 fi
6947 ;;
6948 esac
6949 func_basename "$lib"
6950 laname="$func_basename_result"
6951
6952 # Find the relevant object directory and library name.
6953 if test "X$installed" = Xyes; then
cristyda16f162011-02-19 23:52:17 +00006954 if test ! -f "$lt_sysroot$libdir/$linklib" && test -f "$abs_ladir/$linklib"; then
cristy3ed852e2009-09-05 21:47:34 +00006955 func_warning "library \`$lib' was moved."
6956 dir="$ladir"
6957 absdir="$abs_ladir"
6958 libdir="$abs_ladir"
6959 else
cristyda16f162011-02-19 23:52:17 +00006960 dir="$lt_sysroot$libdir"
6961 absdir="$lt_sysroot$libdir"
cristy3ed852e2009-09-05 21:47:34 +00006962 fi
6963 test "X$hardcode_automatic" = Xyes && avoidtemprpath=yes
6964 else
6965 if test ! -f "$ladir/$objdir/$linklib" && test -f "$abs_ladir/$linklib"; then
6966 dir="$ladir"
6967 absdir="$abs_ladir"
6968 # Remove this search path later
cristyda16f162011-02-19 23:52:17 +00006969 notinst_path+=" $abs_ladir"
cristy3ed852e2009-09-05 21:47:34 +00006970 else
6971 dir="$ladir/$objdir"
6972 absdir="$abs_ladir/$objdir"
6973 # Remove this search path later
cristyda16f162011-02-19 23:52:17 +00006974 notinst_path+=" $abs_ladir"
cristy3ed852e2009-09-05 21:47:34 +00006975 fi
6976 fi # $installed = yes
6977 func_stripname 'lib' '.la' "$laname"
6978 name=$func_stripname_result
6979
6980 # This library was specified with -dlpreopen.
6981 if test "$pass" = dlpreopen; then
6982 if test -z "$libdir" && test "$linkmode" = prog; then
6983 func_fatal_error "only libraries may -dlpreopen a convenience library: \`$lib'"
6984 fi
cristyda16f162011-02-19 23:52:17 +00006985 case "$host" in
6986 # special handling for platforms with PE-DLLs.
6987 *cygwin* | *mingw* | *cegcc* )
6988 # Linker will automatically link against shared library if both
6989 # static and shared are present. Therefore, ensure we extract
6990 # symbols from the import library if a shared library is present
6991 # (otherwise, the dlopen module name will be incorrect). We do
6992 # this by putting the import library name into $newdlprefiles.
6993 # We recover the dlopen module name by 'saving' the la file
6994 # name in a special purpose variable, and (later) extracting the
6995 # dlname from the la file.
6996 if test -n "$dlname"; then
6997 func_tr_sh "$dir/$linklib"
6998 eval "libfile_$func_tr_sh_result=\$abs_ladir/\$laname"
6999 newdlprefiles+=" $dir/$linklib"
7000 else
7001 newdlprefiles+=" $dir/$old_library"
7002 # Keep a list of preopened convenience libraries to check
7003 # that they are being used correctly in the link pass.
7004 test -z "$libdir" && \
7005 dlpreconveniencelibs+=" $dir/$old_library"
7006 fi
7007 ;;
7008 * )
7009 # Prefer using a static library (so that no silly _DYNAMIC symbols
7010 # are required to link).
7011 if test -n "$old_library"; then
7012 newdlprefiles+=" $dir/$old_library"
7013 # Keep a list of preopened convenience libraries to check
7014 # that they are being used correctly in the link pass.
7015 test -z "$libdir" && \
7016 dlpreconveniencelibs+=" $dir/$old_library"
7017 # Otherwise, use the dlname, so that lt_dlopen finds it.
7018 elif test -n "$dlname"; then
7019 newdlprefiles+=" $dir/$dlname"
7020 else
7021 newdlprefiles+=" $dir/$linklib"
7022 fi
7023 ;;
7024 esac
cristy3ed852e2009-09-05 21:47:34 +00007025 fi # $pass = dlpreopen
7026
7027 if test -z "$libdir"; then
7028 # Link the convenience library
7029 if test "$linkmode" = lib; then
7030 deplibs="$dir/$old_library $deplibs"
7031 elif test "$linkmode,$pass" = "prog,link"; then
7032 compile_deplibs="$dir/$old_library $compile_deplibs"
7033 finalize_deplibs="$dir/$old_library $finalize_deplibs"
7034 else
7035 deplibs="$lib $deplibs" # used for prog,scan pass
7036 fi
7037 continue
7038 fi
7039
7040
7041 if test "$linkmode" = prog && test "$pass" != link; then
cristyda16f162011-02-19 23:52:17 +00007042 newlib_search_path+=" $ladir"
cristy3ed852e2009-09-05 21:47:34 +00007043 deplibs="$lib $deplibs"
7044
7045 linkalldeplibs=no
7046 if test "$link_all_deplibs" != no || test -z "$library_names" ||
7047 test "$build_libtool_libs" = no; then
7048 linkalldeplibs=yes
7049 fi
7050
7051 tmp_libs=
7052 for deplib in $dependency_libs; do
7053 case $deplib in
7054 -L*) func_stripname '-L' '' "$deplib"
cristyda16f162011-02-19 23:52:17 +00007055 func_resolve_sysroot "$func_stripname_result"
7056 newlib_search_path+=" $func_resolve_sysroot_result"
cristy3ed852e2009-09-05 21:47:34 +00007057 ;;
7058 esac
7059 # Need to link against all dependency_libs?
7060 if test "$linkalldeplibs" = yes; then
7061 deplibs="$deplib $deplibs"
7062 else
7063 # Need to hardcode shared library paths
7064 # or/and link against static libraries
7065 newdependency_libs="$deplib $newdependency_libs"
7066 fi
cristyda16f162011-02-19 23:52:17 +00007067 if $opt_preserve_dup_deps ; then
cristy3ed852e2009-09-05 21:47:34 +00007068 case "$tmp_libs " in
cristyda16f162011-02-19 23:52:17 +00007069 *" $deplib "*) specialdeplibs+=" $deplib" ;;
cristy3ed852e2009-09-05 21:47:34 +00007070 esac
7071 fi
cristyda16f162011-02-19 23:52:17 +00007072 tmp_libs+=" $deplib"
cristy3ed852e2009-09-05 21:47:34 +00007073 done # for deplib
7074 continue
7075 fi # $linkmode = prog...
7076
7077 if test "$linkmode,$pass" = "prog,link"; then
7078 if test -n "$library_names" &&
7079 { { test "$prefer_static_libs" = no ||
7080 test "$prefer_static_libs,$installed" = "built,yes"; } ||
7081 test -z "$old_library"; }; then
7082 # We need to hardcode the library path
7083 if test -n "$shlibpath_var" && test -z "$avoidtemprpath" ; then
7084 # Make sure the rpath contains only unique directories.
7085 case "$temp_rpath:" in
7086 *"$absdir:"*) ;;
cristyda16f162011-02-19 23:52:17 +00007087 *) temp_rpath+="$absdir:" ;;
cristy3ed852e2009-09-05 21:47:34 +00007088 esac
7089 fi
7090
7091 # Hardcode the library path.
7092 # Skip directories that are in the system default run-time
7093 # search path.
7094 case " $sys_lib_dlsearch_path " in
7095 *" $absdir "*) ;;
7096 *)
7097 case "$compile_rpath " in
7098 *" $absdir "*) ;;
cristyda16f162011-02-19 23:52:17 +00007099 *) compile_rpath+=" $absdir" ;;
cristy3ed852e2009-09-05 21:47:34 +00007100 esac
7101 ;;
7102 esac
7103 case " $sys_lib_dlsearch_path " in
7104 *" $libdir "*) ;;
7105 *)
7106 case "$finalize_rpath " in
7107 *" $libdir "*) ;;
cristyda16f162011-02-19 23:52:17 +00007108 *) finalize_rpath+=" $libdir" ;;
cristy3ed852e2009-09-05 21:47:34 +00007109 esac
7110 ;;
7111 esac
7112 fi # $linkmode,$pass = prog,link...
7113
7114 if test "$alldeplibs" = yes &&
7115 { test "$deplibs_check_method" = pass_all ||
7116 { test "$build_libtool_libs" = yes &&
7117 test -n "$library_names"; }; }; then
7118 # We only need to search for static libraries
7119 continue
7120 fi
7121 fi
7122
7123 link_static=no # Whether the deplib will be linked statically
7124 use_static_libs=$prefer_static_libs
7125 if test "$use_static_libs" = built && test "$installed" = yes; then
7126 use_static_libs=no
7127 fi
7128 if test -n "$library_names" &&
7129 { test "$use_static_libs" = no || test -z "$old_library"; }; then
7130 case $host in
7131 *cygwin* | *mingw* | *cegcc*)
7132 # No point in relinking DLLs because paths are not encoded
cristyda16f162011-02-19 23:52:17 +00007133 notinst_deplibs+=" $lib"
cristy3ed852e2009-09-05 21:47:34 +00007134 need_relink=no
7135 ;;
7136 *)
7137 if test "$installed" = no; then
cristyda16f162011-02-19 23:52:17 +00007138 notinst_deplibs+=" $lib"
cristy3ed852e2009-09-05 21:47:34 +00007139 need_relink=yes
7140 fi
7141 ;;
7142 esac
7143 # This is a shared library
7144
7145 # Warn about portability, can't link against -module's on some
7146 # systems (darwin). Don't bleat about dlopened modules though!
7147 dlopenmodule=""
7148 for dlpremoduletest in $dlprefiles; do
7149 if test "X$dlpremoduletest" = "X$lib"; then
7150 dlopenmodule="$dlpremoduletest"
7151 break
7152 fi
7153 done
7154 if test -z "$dlopenmodule" && test "$shouldnotlink" = yes && test "$pass" = link; then
cristy98dddb52010-11-04 00:30:15 +00007155 echo
cristy3ed852e2009-09-05 21:47:34 +00007156 if test "$linkmode" = prog; then
7157 $ECHO "*** Warning: Linking the executable $output against the loadable module"
7158 else
7159 $ECHO "*** Warning: Linking the shared library $output against the loadable module"
7160 fi
7161 $ECHO "*** $linklib is not portable!"
7162 fi
7163 if test "$linkmode" = lib &&
7164 test "$hardcode_into_libs" = yes; then
7165 # Hardcode the library path.
7166 # Skip directories that are in the system default run-time
7167 # search path.
7168 case " $sys_lib_dlsearch_path " in
7169 *" $absdir "*) ;;
7170 *)
7171 case "$compile_rpath " in
7172 *" $absdir "*) ;;
cristyda16f162011-02-19 23:52:17 +00007173 *) compile_rpath+=" $absdir" ;;
cristy3ed852e2009-09-05 21:47:34 +00007174 esac
7175 ;;
7176 esac
7177 case " $sys_lib_dlsearch_path " in
7178 *" $libdir "*) ;;
7179 *)
7180 case "$finalize_rpath " in
7181 *" $libdir "*) ;;
cristyda16f162011-02-19 23:52:17 +00007182 *) finalize_rpath+=" $libdir" ;;
cristy3ed852e2009-09-05 21:47:34 +00007183 esac
7184 ;;
7185 esac
7186 fi
7187
7188 if test -n "$old_archive_from_expsyms_cmds"; then
7189 # figure out the soname
7190 set dummy $library_names
7191 shift
7192 realname="$1"
7193 shift
7194 libname=`eval "\\$ECHO \"$libname_spec\""`
7195 # use dlname if we got it. it's perfectly good, no?
7196 if test -n "$dlname"; then
7197 soname="$dlname"
7198 elif test -n "$soname_spec"; then
7199 # bleh windows
7200 case $host in
7201 *cygwin* | mingw* | *cegcc*)
7202 func_arith $current - $age
7203 major=$func_arith_result
7204 versuffix="-$major"
7205 ;;
7206 esac
7207 eval soname=\"$soname_spec\"
7208 else
7209 soname="$realname"
7210 fi
7211
7212 # Make a new name for the extract_expsyms_cmds to use
7213 soroot="$soname"
7214 func_basename "$soroot"
7215 soname="$func_basename_result"
7216 func_stripname 'lib' '.dll' "$soname"
7217 newlib=libimp-$func_stripname_result.a
7218
7219 # If the library has no export list, then create one now
7220 if test -f "$output_objdir/$soname-def"; then :
7221 else
7222 func_verbose "extracting exported symbol list from \`$soname'"
7223 func_execute_cmds "$extract_expsyms_cmds" 'exit $?'
7224 fi
7225
7226 # Create $newlib
7227 if test -f "$output_objdir/$newlib"; then :; else
7228 func_verbose "generating import library for \`$soname'"
7229 func_execute_cmds "$old_archive_from_expsyms_cmds" 'exit $?'
7230 fi
7231 # make sure the library variables are pointing to the new library
7232 dir=$output_objdir
7233 linklib=$newlib
7234 fi # test -n "$old_archive_from_expsyms_cmds"
7235
cristyda16f162011-02-19 23:52:17 +00007236 if test "$linkmode" = prog || test "$opt_mode" != relink; then
cristy3ed852e2009-09-05 21:47:34 +00007237 add_shlibpath=
7238 add_dir=
7239 add=
7240 lib_linked=yes
7241 case $hardcode_action in
7242 immediate | unsupported)
7243 if test "$hardcode_direct" = no; then
7244 add="$dir/$linklib"
7245 case $host in
7246 *-*-sco3.2v5.0.[024]*) add_dir="-L$dir" ;;
7247 *-*-sysv4*uw2*) add_dir="-L$dir" ;;
7248 *-*-sysv5OpenUNIX* | *-*-sysv5UnixWare7.[01].[10]* | \
7249 *-*-unixware7*) add_dir="-L$dir" ;;
7250 *-*-darwin* )
7251 # if the lib is a (non-dlopened) module then we can not
7252 # link against it, someone is ignoring the earlier warnings
7253 if /usr/bin/file -L $add 2> /dev/null |
7254 $GREP ": [^:]* bundle" >/dev/null ; then
7255 if test "X$dlopenmodule" != "X$lib"; then
7256 $ECHO "*** Warning: lib $linklib is a module, not a shared library"
7257 if test -z "$old_library" ; then
cristy98dddb52010-11-04 00:30:15 +00007258 echo
7259 echo "*** And there doesn't seem to be a static archive available"
7260 echo "*** The link will probably fail, sorry"
cristy3ed852e2009-09-05 21:47:34 +00007261 else
7262 add="$dir/$old_library"
7263 fi
7264 elif test -n "$old_library"; then
7265 add="$dir/$old_library"
7266 fi
7267 fi
7268 esac
7269 elif test "$hardcode_minus_L" = no; then
7270 case $host in
7271 *-*-sunos*) add_shlibpath="$dir" ;;
7272 esac
7273 add_dir="-L$dir"
7274 add="-l$name"
7275 elif test "$hardcode_shlibpath_var" = no; then
7276 add_shlibpath="$dir"
7277 add="-l$name"
7278 else
7279 lib_linked=no
7280 fi
7281 ;;
7282 relink)
7283 if test "$hardcode_direct" = yes &&
7284 test "$hardcode_direct_absolute" = no; then
7285 add="$dir/$linklib"
7286 elif test "$hardcode_minus_L" = yes; then
cristy2542fc62011-12-06 17:50:25 +00007287 add_dir="-L$absdir"
cristy3ed852e2009-09-05 21:47:34 +00007288 # Try looking first in the location we're being installed to.
7289 if test -n "$inst_prefix_dir"; then
7290 case $libdir in
7291 [\\/]*)
cristyda16f162011-02-19 23:52:17 +00007292 add_dir+=" -L$inst_prefix_dir$libdir"
cristy3ed852e2009-09-05 21:47:34 +00007293 ;;
7294 esac
7295 fi
7296 add="-l$name"
7297 elif test "$hardcode_shlibpath_var" = yes; then
7298 add_shlibpath="$dir"
7299 add="-l$name"
7300 else
7301 lib_linked=no
7302 fi
7303 ;;
7304 *) lib_linked=no ;;
7305 esac
7306
cristyf6fcb5d2010-09-24 01:19:13 +00007307 if test "$lib_linked" != yes; then
7308 func_fatal_configuration "unsupported hardcode properties"
7309 fi
7310
cristy3ed852e2009-09-05 21:47:34 +00007311 if test -n "$add_shlibpath"; then
7312 case :$compile_shlibpath: in
7313 *":$add_shlibpath:"*) ;;
cristyda16f162011-02-19 23:52:17 +00007314 *) compile_shlibpath+="$add_shlibpath:" ;;
cristy3ed852e2009-09-05 21:47:34 +00007315 esac
7316 fi
7317 if test "$linkmode" = prog; then
7318 test -n "$add_dir" && compile_deplibs="$add_dir $compile_deplibs"
7319 test -n "$add" && compile_deplibs="$add $compile_deplibs"
7320 else
7321 test -n "$add_dir" && deplibs="$add_dir $deplibs"
7322 test -n "$add" && deplibs="$add $deplibs"
7323 if test "$hardcode_direct" != yes &&
7324 test "$hardcode_minus_L" != yes &&
7325 test "$hardcode_shlibpath_var" = yes; then
7326 case :$finalize_shlibpath: in
7327 *":$libdir:"*) ;;
cristyda16f162011-02-19 23:52:17 +00007328 *) finalize_shlibpath+="$libdir:" ;;
cristy3ed852e2009-09-05 21:47:34 +00007329 esac
7330 fi
7331 fi
7332 fi
7333
cristyda16f162011-02-19 23:52:17 +00007334 if test "$linkmode" = prog || test "$opt_mode" = relink; then
cristy3ed852e2009-09-05 21:47:34 +00007335 add_shlibpath=
7336 add_dir=
7337 add=
7338 # Finalize command for both is simple: just hardcode it.
7339 if test "$hardcode_direct" = yes &&
7340 test "$hardcode_direct_absolute" = no; then
7341 add="$libdir/$linklib"
7342 elif test "$hardcode_minus_L" = yes; then
7343 add_dir="-L$libdir"
7344 add="-l$name"
7345 elif test "$hardcode_shlibpath_var" = yes; then
7346 case :$finalize_shlibpath: in
7347 *":$libdir:"*) ;;
cristyda16f162011-02-19 23:52:17 +00007348 *) finalize_shlibpath+="$libdir:" ;;
cristy3ed852e2009-09-05 21:47:34 +00007349 esac
7350 add="-l$name"
7351 elif test "$hardcode_automatic" = yes; then
7352 if test -n "$inst_prefix_dir" &&
7353 test -f "$inst_prefix_dir$libdir/$linklib" ; then
7354 add="$inst_prefix_dir$libdir/$linklib"
7355 else
7356 add="$libdir/$linklib"
7357 fi
7358 else
7359 # We cannot seem to hardcode it, guess we'll fake it.
7360 add_dir="-L$libdir"
7361 # Try looking first in the location we're being installed to.
7362 if test -n "$inst_prefix_dir"; then
7363 case $libdir in
7364 [\\/]*)
cristyda16f162011-02-19 23:52:17 +00007365 add_dir+=" -L$inst_prefix_dir$libdir"
cristy3ed852e2009-09-05 21:47:34 +00007366 ;;
7367 esac
7368 fi
7369 add="-l$name"
7370 fi
7371
7372 if test "$linkmode" = prog; then
7373 test -n "$add_dir" && finalize_deplibs="$add_dir $finalize_deplibs"
7374 test -n "$add" && finalize_deplibs="$add $finalize_deplibs"
7375 else
7376 test -n "$add_dir" && deplibs="$add_dir $deplibs"
7377 test -n "$add" && deplibs="$add $deplibs"
7378 fi
7379 fi
7380 elif test "$linkmode" = prog; then
7381 # Here we assume that one of hardcode_direct or hardcode_minus_L
7382 # is not unsupported. This is valid on all known static and
7383 # shared platforms.
7384 if test "$hardcode_direct" != unsupported; then
7385 test -n "$old_library" && linklib="$old_library"
7386 compile_deplibs="$dir/$linklib $compile_deplibs"
7387 finalize_deplibs="$dir/$linklib $finalize_deplibs"
7388 else
7389 compile_deplibs="-l$name -L$dir $compile_deplibs"
7390 finalize_deplibs="-l$name -L$dir $finalize_deplibs"
7391 fi
7392 elif test "$build_libtool_libs" = yes; then
7393 # Not a shared library
7394 if test "$deplibs_check_method" != pass_all; then
7395 # We're trying link a shared library against a static one
7396 # but the system doesn't support it.
7397
7398 # Just print a warning and add the library to dependency_libs so
7399 # that the program can be linked against the static library.
cristy98dddb52010-11-04 00:30:15 +00007400 echo
cristy3ed852e2009-09-05 21:47:34 +00007401 $ECHO "*** Warning: This system can not link to static lib archive $lib."
cristy98dddb52010-11-04 00:30:15 +00007402 echo "*** I have the capability to make that library automatically link in when"
7403 echo "*** you link to this library. But I can only do this if you have a"
7404 echo "*** shared version of the library, which you do not appear to have."
cristy3ed852e2009-09-05 21:47:34 +00007405 if test "$module" = yes; then
cristy98dddb52010-11-04 00:30:15 +00007406 echo "*** But as you try to build a module library, libtool will still create "
7407 echo "*** a static module, that should work as long as the dlopening application"
7408 echo "*** is linked with the -dlopen flag to resolve symbols at runtime."
cristy3ed852e2009-09-05 21:47:34 +00007409 if test -z "$global_symbol_pipe"; then
cristy98dddb52010-11-04 00:30:15 +00007410 echo
7411 echo "*** However, this would only work if libtool was able to extract symbol"
7412 echo "*** lists from a program, using \`nm' or equivalent, but libtool could"
7413 echo "*** not find such a program. So, this module is probably useless."
7414 echo "*** \`nm' from GNU binutils and a full rebuild may help."
cristy3ed852e2009-09-05 21:47:34 +00007415 fi
7416 if test "$build_old_libs" = no; then
7417 build_libtool_libs=module
7418 build_old_libs=yes
7419 else
7420 build_libtool_libs=no
7421 fi
7422 fi
7423 else
7424 deplibs="$dir/$old_library $deplibs"
7425 link_static=yes
7426 fi
7427 fi # link shared/static library?
7428
7429 if test "$linkmode" = lib; then
7430 if test -n "$dependency_libs" &&
7431 { test "$hardcode_into_libs" != yes ||
7432 test "$build_old_libs" = yes ||
7433 test "$link_static" = yes; }; then
7434 # Extract -R from dependency_libs
7435 temp_deplibs=
7436 for libdir in $dependency_libs; do
7437 case $libdir in
7438 -R*) func_stripname '-R' '' "$libdir"
7439 temp_xrpath=$func_stripname_result
7440 case " $xrpath " in
7441 *" $temp_xrpath "*) ;;
cristyda16f162011-02-19 23:52:17 +00007442 *) xrpath+=" $temp_xrpath";;
cristy3ed852e2009-09-05 21:47:34 +00007443 esac;;
cristyda16f162011-02-19 23:52:17 +00007444 *) temp_deplibs+=" $libdir";;
cristy3ed852e2009-09-05 21:47:34 +00007445 esac
7446 done
7447 dependency_libs="$temp_deplibs"
7448 fi
7449
cristyda16f162011-02-19 23:52:17 +00007450 newlib_search_path+=" $absdir"
cristy3ed852e2009-09-05 21:47:34 +00007451 # Link against this library
7452 test "$link_static" = no && newdependency_libs="$abs_ladir/$laname $newdependency_libs"
7453 # ... and its dependency_libs
7454 tmp_libs=
7455 for deplib in $dependency_libs; do
7456 newdependency_libs="$deplib $newdependency_libs"
cristyda16f162011-02-19 23:52:17 +00007457 case $deplib in
7458 -L*) func_stripname '-L' '' "$deplib"
7459 func_resolve_sysroot "$func_stripname_result";;
7460 *) func_resolve_sysroot "$deplib" ;;
7461 esac
7462 if $opt_preserve_dup_deps ; then
cristy3ed852e2009-09-05 21:47:34 +00007463 case "$tmp_libs " in
cristyda16f162011-02-19 23:52:17 +00007464 *" $func_resolve_sysroot_result "*)
7465 specialdeplibs+=" $func_resolve_sysroot_result" ;;
cristy3ed852e2009-09-05 21:47:34 +00007466 esac
7467 fi
cristyda16f162011-02-19 23:52:17 +00007468 tmp_libs+=" $func_resolve_sysroot_result"
cristy3ed852e2009-09-05 21:47:34 +00007469 done
7470
7471 if test "$link_all_deplibs" != no; then
7472 # Add the search paths of all dependency libraries
7473 for deplib in $dependency_libs; do
cristy98dddb52010-11-04 00:30:15 +00007474 path=
cristy3ed852e2009-09-05 21:47:34 +00007475 case $deplib in
7476 -L*) path="$deplib" ;;
7477 *.la)
cristyda16f162011-02-19 23:52:17 +00007478 func_resolve_sysroot "$deplib"
7479 deplib=$func_resolve_sysroot_result
cristy3ed852e2009-09-05 21:47:34 +00007480 func_dirname "$deplib" "" "."
cristyda16f162011-02-19 23:52:17 +00007481 dir=$func_dirname_result
cristy3ed852e2009-09-05 21:47:34 +00007482 # We need an absolute path.
7483 case $dir in
7484 [\\/]* | [A-Za-z]:[\\/]*) absdir="$dir" ;;
7485 *)
7486 absdir=`cd "$dir" && pwd`
7487 if test -z "$absdir"; then
7488 func_warning "cannot determine absolute directory name of \`$dir'"
7489 absdir="$dir"
7490 fi
7491 ;;
7492 esac
7493 if $GREP "^installed=no" $deplib > /dev/null; then
7494 case $host in
7495 *-*-darwin*)
7496 depdepl=
7497 eval deplibrary_names=`${SED} -n -e 's/^library_names=\(.*\)$/\1/p' $deplib`
7498 if test -n "$deplibrary_names" ; then
7499 for tmp in $deplibrary_names ; do
7500 depdepl=$tmp
7501 done
7502 if test -f "$absdir/$objdir/$depdepl" ; then
7503 depdepl="$absdir/$objdir/$depdepl"
7504 darwin_install_name=`${OTOOL} -L $depdepl | awk '{if (NR == 2) {print $1;exit}}'`
7505 if test -z "$darwin_install_name"; then
7506 darwin_install_name=`${OTOOL64} -L $depdepl | awk '{if (NR == 2) {print $1;exit}}'`
7507 fi
cristyda16f162011-02-19 23:52:17 +00007508 compiler_flags+=" ${wl}-dylib_file ${wl}${darwin_install_name}:${depdepl}"
7509 linker_flags+=" -dylib_file ${darwin_install_name}:${depdepl}"
cristy3ed852e2009-09-05 21:47:34 +00007510 path=
7511 fi
7512 fi
7513 ;;
7514 *)
7515 path="-L$absdir/$objdir"
7516 ;;
7517 esac
7518 else
7519 eval libdir=`${SED} -n -e 's/^libdir=\(.*\)$/\1/p' $deplib`
7520 test -z "$libdir" && \
7521 func_fatal_error "\`$deplib' is not a valid libtool archive"
7522 test "$absdir" != "$libdir" && \
7523 func_warning "\`$deplib' seems to be moved"
7524
7525 path="-L$absdir"
7526 fi
7527 ;;
7528 esac
7529 case " $deplibs " in
7530 *" $path "*) ;;
7531 *) deplibs="$path $deplibs" ;;
7532 esac
7533 done
7534 fi # link_all_deplibs != no
7535 fi # linkmode = lib
7536 done # for deplib in $libs
7537 if test "$pass" = link; then
7538 if test "$linkmode" = "prog"; then
7539 compile_deplibs="$new_inherited_linker_flags $compile_deplibs"
7540 finalize_deplibs="$new_inherited_linker_flags $finalize_deplibs"
7541 else
cristy98dddb52010-11-04 00:30:15 +00007542 compiler_flags="$compiler_flags "`$ECHO " $new_inherited_linker_flags" | $SED 's% \([^ $]*\).ltframework% -framework \1%g'`
cristy3ed852e2009-09-05 21:47:34 +00007543 fi
7544 fi
7545 dependency_libs="$newdependency_libs"
7546 if test "$pass" = dlpreopen; then
7547 # Link the dlpreopened libraries before other libraries
7548 for deplib in $save_deplibs; do
7549 deplibs="$deplib $deplibs"
7550 done
7551 fi
7552 if test "$pass" != dlopen; then
7553 if test "$pass" != conv; then
7554 # Make sure lib_search_path contains only unique directories.
7555 lib_search_path=
7556 for dir in $newlib_search_path; do
7557 case "$lib_search_path " in
7558 *" $dir "*) ;;
cristyda16f162011-02-19 23:52:17 +00007559 *) lib_search_path+=" $dir" ;;
cristy3ed852e2009-09-05 21:47:34 +00007560 esac
7561 done
7562 newlib_search_path=
7563 fi
7564
7565 if test "$linkmode,$pass" != "prog,link"; then
7566 vars="deplibs"
7567 else
7568 vars="compile_deplibs finalize_deplibs"
7569 fi
7570 for var in $vars dependency_libs; do
7571 # Add libraries to $var in reverse order
7572 eval tmp_libs=\"\$$var\"
7573 new_libs=
7574 for deplib in $tmp_libs; do
7575 # FIXME: Pedantically, this is the right thing to do, so
7576 # that some nasty dependency loop isn't accidentally
7577 # broken:
7578 #new_libs="$deplib $new_libs"
7579 # Pragmatically, this seems to cause very few problems in
7580 # practice:
7581 case $deplib in
7582 -L*) new_libs="$deplib $new_libs" ;;
7583 -R*) ;;
7584 *)
7585 # And here is the reason: when a library appears more
7586 # than once as an explicit dependence of a library, or
7587 # is implicitly linked in more than once by the
7588 # compiler, it is considered special, and multiple
7589 # occurrences thereof are not removed. Compare this
7590 # with having the same library being listed as a
7591 # dependency of multiple other libraries: in this case,
7592 # we know (pedantically, we assume) the library does not
7593 # need to be listed more than once, so we keep only the
7594 # last copy. This is not always right, but it is rare
7595 # enough that we require users that really mean to play
7596 # such unportable linking tricks to link the library
7597 # using -Wl,-lname, so that libtool does not consider it
7598 # for duplicate removal.
7599 case " $specialdeplibs " in
7600 *" $deplib "*) new_libs="$deplib $new_libs" ;;
7601 *)
7602 case " $new_libs " in
7603 *" $deplib "*) ;;
7604 *) new_libs="$deplib $new_libs" ;;
7605 esac
7606 ;;
7607 esac
7608 ;;
7609 esac
7610 done
7611 tmp_libs=
7612 for deplib in $new_libs; do
7613 case $deplib in
7614 -L*)
7615 case " $tmp_libs " in
7616 *" $deplib "*) ;;
cristyda16f162011-02-19 23:52:17 +00007617 *) tmp_libs+=" $deplib" ;;
cristy3ed852e2009-09-05 21:47:34 +00007618 esac
7619 ;;
cristyda16f162011-02-19 23:52:17 +00007620 *) tmp_libs+=" $deplib" ;;
cristy3ed852e2009-09-05 21:47:34 +00007621 esac
7622 done
7623 eval $var=\"$tmp_libs\"
7624 done # for var
7625 fi
7626 # Last step: remove runtime libs from dependency_libs
7627 # (they stay in deplibs)
7628 tmp_libs=
7629 for i in $dependency_libs ; do
7630 case " $predeps $postdeps $compiler_lib_search_path " in
7631 *" $i "*)
7632 i=""
7633 ;;
7634 esac
7635 if test -n "$i" ; then
cristyda16f162011-02-19 23:52:17 +00007636 tmp_libs+=" $i"
cristy3ed852e2009-09-05 21:47:34 +00007637 fi
7638 done
7639 dependency_libs=$tmp_libs
7640 done # for pass
7641 if test "$linkmode" = prog; then
7642 dlfiles="$newdlfiles"
7643 fi
7644 if test "$linkmode" = prog || test "$linkmode" = lib; then
7645 dlprefiles="$newdlprefiles"
7646 fi
7647
7648 case $linkmode in
7649 oldlib)
7650 if test -n "$dlfiles$dlprefiles" || test "$dlself" != no; then
7651 func_warning "\`-dlopen' is ignored for archives"
7652 fi
7653
7654 case " $deplibs" in
7655 *\ -l* | *\ -L*)
7656 func_warning "\`-l' and \`-L' are ignored for archives" ;;
7657 esac
7658
7659 test -n "$rpath" && \
7660 func_warning "\`-rpath' is ignored for archives"
7661
7662 test -n "$xrpath" && \
7663 func_warning "\`-R' is ignored for archives"
7664
7665 test -n "$vinfo" && \
7666 func_warning "\`-version-info/-version-number' is ignored for archives"
7667
7668 test -n "$release" && \
7669 func_warning "\`-release' is ignored for archives"
7670
7671 test -n "$export_symbols$export_symbols_regex" && \
7672 func_warning "\`-export-symbols' is ignored for archives"
7673
7674 # Now set the variables for building old libraries.
7675 build_libtool_libs=no
7676 oldlibs="$output"
cristyda16f162011-02-19 23:52:17 +00007677 objs+="$old_deplibs"
cristy3ed852e2009-09-05 21:47:34 +00007678 ;;
7679
7680 lib)
7681 # Make sure we only generate libraries of the form `libNAME.la'.
7682 case $outputname in
7683 lib*)
7684 func_stripname 'lib' '.la' "$outputname"
7685 name=$func_stripname_result
7686 eval shared_ext=\"$shrext_cmds\"
7687 eval libname=\"$libname_spec\"
7688 ;;
7689 *)
7690 test "$module" = no && \
7691 func_fatal_help "libtool library \`$output' must begin with \`lib'"
7692
7693 if test "$need_lib_prefix" != no; then
7694 # Add the "lib" prefix for modules if required
7695 func_stripname '' '.la' "$outputname"
7696 name=$func_stripname_result
7697 eval shared_ext=\"$shrext_cmds\"
7698 eval libname=\"$libname_spec\"
7699 else
7700 func_stripname '' '.la' "$outputname"
7701 libname=$func_stripname_result
7702 fi
7703 ;;
7704 esac
7705
7706 if test -n "$objs"; then
7707 if test "$deplibs_check_method" != pass_all; then
7708 func_fatal_error "cannot build libtool library \`$output' from non-libtool objects on this host:$objs"
7709 else
cristy98dddb52010-11-04 00:30:15 +00007710 echo
cristy3ed852e2009-09-05 21:47:34 +00007711 $ECHO "*** Warning: Linking the shared library $output against the non-libtool"
7712 $ECHO "*** objects $objs is not portable!"
cristyda16f162011-02-19 23:52:17 +00007713 libobjs+=" $objs"
cristy3ed852e2009-09-05 21:47:34 +00007714 fi
7715 fi
7716
7717 test "$dlself" != no && \
7718 func_warning "\`-dlopen self' is ignored for libtool libraries"
7719
7720 set dummy $rpath
7721 shift
7722 test "$#" -gt 1 && \
7723 func_warning "ignoring multiple \`-rpath's for a libtool library"
7724
7725 install_libdir="$1"
7726
7727 oldlibs=
7728 if test -z "$rpath"; then
7729 if test "$build_libtool_libs" = yes; then
7730 # Building a libtool convenience library.
7731 # Some compilers have problems with a `.al' extension so
7732 # convenience libraries should have the same extension an
7733 # archive normally would.
7734 oldlibs="$output_objdir/$libname.$libext $oldlibs"
7735 build_libtool_libs=convenience
7736 build_old_libs=yes
7737 fi
7738
7739 test -n "$vinfo" && \
7740 func_warning "\`-version-info/-version-number' is ignored for convenience libraries"
7741
7742 test -n "$release" && \
7743 func_warning "\`-release' is ignored for convenience libraries"
7744 else
7745
7746 # Parse the version information argument.
7747 save_ifs="$IFS"; IFS=':'
7748 set dummy $vinfo 0 0 0
7749 shift
7750 IFS="$save_ifs"
7751
7752 test -n "$7" && \
7753 func_fatal_help "too many parameters to \`-version-info'"
7754
7755 # convert absolute version numbers to libtool ages
7756 # this retains compatibility with .la files and attempts
7757 # to make the code below a bit more comprehensible
7758
7759 case $vinfo_number in
7760 yes)
7761 number_major="$1"
7762 number_minor="$2"
7763 number_revision="$3"
7764 #
7765 # There are really only two kinds -- those that
7766 # use the current revision as the major version
7767 # and those that subtract age and use age as
7768 # a minor version. But, then there is irix
7769 # which has an extra 1 added just for fun
7770 #
7771 case $version_type in
cristy2542fc62011-12-06 17:50:25 +00007772 # correct linux to gnu/linux during the next big refactor
cristy3ed852e2009-09-05 21:47:34 +00007773 darwin|linux|osf|windows|none)
7774 func_arith $number_major + $number_minor
7775 current=$func_arith_result
7776 age="$number_minor"
7777 revision="$number_revision"
7778 ;;
cristy98dddb52010-11-04 00:30:15 +00007779 freebsd-aout|freebsd-elf|qnx|sunos)
cristy3ed852e2009-09-05 21:47:34 +00007780 current="$number_major"
7781 revision="$number_minor"
7782 age="0"
7783 ;;
7784 irix|nonstopux)
7785 func_arith $number_major + $number_minor
7786 current=$func_arith_result
7787 age="$number_minor"
7788 revision="$number_minor"
7789 lt_irix_increment=no
7790 ;;
7791 esac
7792 ;;
7793 no)
7794 current="$1"
7795 revision="$2"
7796 age="$3"
7797 ;;
7798 esac
7799
7800 # Check that each of the things are valid numbers.
7801 case $current in
7802 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]) ;;
7803 *)
7804 func_error "CURRENT \`$current' must be a nonnegative integer"
7805 func_fatal_error "\`$vinfo' is not valid version information"
7806 ;;
7807 esac
7808
7809 case $revision in
7810 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]) ;;
7811 *)
7812 func_error "REVISION \`$revision' must be a nonnegative integer"
7813 func_fatal_error "\`$vinfo' is not valid version information"
7814 ;;
7815 esac
7816
7817 case $age in
7818 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]) ;;
7819 *)
7820 func_error "AGE \`$age' must be a nonnegative integer"
7821 func_fatal_error "\`$vinfo' is not valid version information"
7822 ;;
7823 esac
7824
7825 if test "$age" -gt "$current"; then
7826 func_error "AGE \`$age' is greater than the current interface number \`$current'"
7827 func_fatal_error "\`$vinfo' is not valid version information"
7828 fi
7829
7830 # Calculate the version variables.
7831 major=
7832 versuffix=
7833 verstring=
7834 case $version_type in
7835 none) ;;
7836
7837 darwin)
7838 # Like Linux, but with the current version available in
7839 # verstring for coding it into the library header
7840 func_arith $current - $age
7841 major=.$func_arith_result
7842 versuffix="$major.$age.$revision"
7843 # Darwin ld doesn't like 0 for these options...
7844 func_arith $current + 1
7845 minor_current=$func_arith_result
7846 xlcverstring="${wl}-compatibility_version ${wl}$minor_current ${wl}-current_version ${wl}$minor_current.$revision"
7847 verstring="-compatibility_version $minor_current -current_version $minor_current.$revision"
7848 ;;
7849
7850 freebsd-aout)
7851 major=".$current"
7852 versuffix=".$current.$revision";
7853 ;;
7854
7855 freebsd-elf)
7856 major=".$current"
7857 versuffix=".$current"
7858 ;;
7859
7860 irix | nonstopux)
7861 if test "X$lt_irix_increment" = "Xno"; then
7862 func_arith $current - $age
7863 else
7864 func_arith $current - $age + 1
7865 fi
7866 major=$func_arith_result
7867
7868 case $version_type in
7869 nonstopux) verstring_prefix=nonstopux ;;
7870 *) verstring_prefix=sgi ;;
7871 esac
7872 verstring="$verstring_prefix$major.$revision"
7873
7874 # Add in all the interfaces that we are compatible with.
7875 loop=$revision
7876 while test "$loop" -ne 0; do
7877 func_arith $revision - $loop
7878 iface=$func_arith_result
7879 func_arith $loop - 1
7880 loop=$func_arith_result
7881 verstring="$verstring_prefix$major.$iface:$verstring"
7882 done
7883
7884 # Before this point, $major must not contain `.'.
7885 major=.$major
7886 versuffix="$major.$revision"
7887 ;;
7888
cristy2542fc62011-12-06 17:50:25 +00007889 linux) # correct to gnu/linux during the next big refactor
cristy3ed852e2009-09-05 21:47:34 +00007890 func_arith $current - $age
7891 major=.$func_arith_result
7892 versuffix="$major.$age.$revision"
7893 ;;
7894
7895 osf)
7896 func_arith $current - $age
7897 major=.$func_arith_result
7898 versuffix=".$current.$age.$revision"
7899 verstring="$current.$age.$revision"
7900
7901 # Add in all the interfaces that we are compatible with.
7902 loop=$age
7903 while test "$loop" -ne 0; do
7904 func_arith $current - $loop
7905 iface=$func_arith_result
7906 func_arith $loop - 1
7907 loop=$func_arith_result
7908 verstring="$verstring:${iface}.0"
7909 done
7910
7911 # Make executables depend on our current version.
cristyda16f162011-02-19 23:52:17 +00007912 verstring+=":${current}.0"
cristy3ed852e2009-09-05 21:47:34 +00007913 ;;
7914
7915 qnx)
7916 major=".$current"
7917 versuffix=".$current"
7918 ;;
7919
7920 sunos)
7921 major=".$current"
7922 versuffix=".$current.$revision"
7923 ;;
7924
7925 windows)
7926 # Use '-' rather than '.', since we only want one
7927 # extension on DOS 8.3 filesystems.
7928 func_arith $current - $age
7929 major=$func_arith_result
7930 versuffix="-$major"
7931 ;;
7932
7933 *)
7934 func_fatal_configuration "unknown library version type \`$version_type'"
7935 ;;
7936 esac
7937
7938 # Clear the version info if we defaulted, and they specified a release.
7939 if test -z "$vinfo" && test -n "$release"; then
7940 major=
7941 case $version_type in
7942 darwin)
7943 # we can't check for "0.0" in archive_cmds due to quoting
7944 # problems, so we reset it completely
7945 verstring=
7946 ;;
7947 *)
7948 verstring="0.0"
7949 ;;
7950 esac
7951 if test "$need_version" = no; then
7952 versuffix=
7953 else
7954 versuffix=".0.0"
7955 fi
7956 fi
7957
7958 # Remove version info from name if versioning should be avoided
7959 if test "$avoid_version" = yes && test "$need_version" = no; then
7960 major=
7961 versuffix=
7962 verstring=""
7963 fi
7964
7965 # Check to see if the archive will have undefined symbols.
7966 if test "$allow_undefined" = yes; then
7967 if test "$allow_undefined_flag" = unsupported; then
7968 func_warning "undefined symbols not allowed in $host shared libraries"
7969 build_libtool_libs=no
7970 build_old_libs=yes
7971 fi
7972 else
7973 # Don't allow undefined symbols.
7974 allow_undefined_flag="$no_undefined_flag"
7975 fi
7976
7977 fi
7978
7979 func_generate_dlsyms "$libname" "$libname" "yes"
cristyda16f162011-02-19 23:52:17 +00007980 libobjs+=" $symfileobj"
cristy3ed852e2009-09-05 21:47:34 +00007981 test "X$libobjs" = "X " && libobjs=
7982
cristyda16f162011-02-19 23:52:17 +00007983 if test "$opt_mode" != relink; then
cristy3ed852e2009-09-05 21:47:34 +00007984 # Remove our outputs, but don't remove object files since they
7985 # may have been created when compiling PIC objects.
7986 removelist=
7987 tempremovelist=`$ECHO "$output_objdir/*"`
7988 for p in $tempremovelist; do
7989 case $p in
7990 *.$objext | *.gcno)
7991 ;;
7992 $output_objdir/$outputname | $output_objdir/$libname.* | $output_objdir/${libname}${release}.*)
7993 if test "X$precious_files_regex" != "X"; then
7994 if $ECHO "$p" | $EGREP -e "$precious_files_regex" >/dev/null 2>&1
7995 then
7996 continue
7997 fi
7998 fi
cristyda16f162011-02-19 23:52:17 +00007999 removelist+=" $p"
cristy3ed852e2009-09-05 21:47:34 +00008000 ;;
8001 *) ;;
8002 esac
8003 done
8004 test -n "$removelist" && \
8005 func_show_eval "${RM}r \$removelist"
8006 fi
8007
8008 # Now set the variables for building old libraries.
8009 if test "$build_old_libs" = yes && test "$build_libtool_libs" != convenience ; then
cristyda16f162011-02-19 23:52:17 +00008010 oldlibs+=" $output_objdir/$libname.$libext"
cristy3ed852e2009-09-05 21:47:34 +00008011
8012 # Transform .lo files to .o files.
cristy98dddb52010-11-04 00:30:15 +00008013 oldobjs="$objs "`$ECHO "$libobjs" | $SP2NL | $SED "/\.${libext}$/d; $lo2o" | $NL2SP`
cristy3ed852e2009-09-05 21:47:34 +00008014 fi
8015
8016 # Eliminate all temporary directories.
8017 #for path in $notinst_path; do
cristy98dddb52010-11-04 00:30:15 +00008018 # lib_search_path=`$ECHO "$lib_search_path " | $SED "s% $path % %g"`
8019 # deplibs=`$ECHO "$deplibs " | $SED "s% -L$path % %g"`
8020 # dependency_libs=`$ECHO "$dependency_libs " | $SED "s% -L$path % %g"`
cristy3ed852e2009-09-05 21:47:34 +00008021 #done
8022
8023 if test -n "$xrpath"; then
8024 # If the user specified any rpath flags, then add them.
8025 temp_xrpath=
8026 for libdir in $xrpath; do
cristyda16f162011-02-19 23:52:17 +00008027 func_replace_sysroot "$libdir"
8028 temp_xrpath+=" -R$func_replace_sysroot_result"
cristy3ed852e2009-09-05 21:47:34 +00008029 case "$finalize_rpath " in
8030 *" $libdir "*) ;;
cristyda16f162011-02-19 23:52:17 +00008031 *) finalize_rpath+=" $libdir" ;;
cristy3ed852e2009-09-05 21:47:34 +00008032 esac
8033 done
8034 if test "$hardcode_into_libs" != yes || test "$build_old_libs" = yes; then
8035 dependency_libs="$temp_xrpath $dependency_libs"
8036 fi
8037 fi
8038
8039 # Make sure dlfiles contains only unique files that won't be dlpreopened
8040 old_dlfiles="$dlfiles"
8041 dlfiles=
8042 for lib in $old_dlfiles; do
8043 case " $dlprefiles $dlfiles " in
8044 *" $lib "*) ;;
cristyda16f162011-02-19 23:52:17 +00008045 *) dlfiles+=" $lib" ;;
cristy3ed852e2009-09-05 21:47:34 +00008046 esac
8047 done
8048
8049 # Make sure dlprefiles contains only unique files
8050 old_dlprefiles="$dlprefiles"
8051 dlprefiles=
8052 for lib in $old_dlprefiles; do
8053 case "$dlprefiles " in
8054 *" $lib "*) ;;
cristyda16f162011-02-19 23:52:17 +00008055 *) dlprefiles+=" $lib" ;;
cristy3ed852e2009-09-05 21:47:34 +00008056 esac
8057 done
8058
8059 if test "$build_libtool_libs" = yes; then
8060 if test -n "$rpath"; then
8061 case $host in
cristy98dddb52010-11-04 00:30:15 +00008062 *-*-cygwin* | *-*-mingw* | *-*-pw32* | *-*-os2* | *-*-beos* | *-cegcc* | *-*-haiku*)
cristy3ed852e2009-09-05 21:47:34 +00008063 # these systems don't actually have a c library (as such)!
8064 ;;
8065 *-*-rhapsody* | *-*-darwin1.[012])
8066 # Rhapsody C library is in the System framework
cristyda16f162011-02-19 23:52:17 +00008067 deplibs+=" System.ltframework"
cristy3ed852e2009-09-05 21:47:34 +00008068 ;;
8069 *-*-netbsd*)
8070 # Don't link with libc until the a.out ld.so is fixed.
8071 ;;
8072 *-*-openbsd* | *-*-freebsd* | *-*-dragonfly*)
8073 # Do not include libc due to us having libc/libc_r.
8074 ;;
8075 *-*-sco3.2v5* | *-*-sco5v6*)
8076 # Causes problems with __ctype
8077 ;;
8078 *-*-sysv4.2uw2* | *-*-sysv5* | *-*-unixware* | *-*-OpenUNIX*)
8079 # Compiler inserts libc in the correct place for threads to work
8080 ;;
8081 *)
8082 # Add libc to deplibs on all other systems if necessary.
8083 if test "$build_libtool_need_lc" = "yes"; then
cristyda16f162011-02-19 23:52:17 +00008084 deplibs+=" -lc"
cristy3ed852e2009-09-05 21:47:34 +00008085 fi
8086 ;;
8087 esac
8088 fi
8089
8090 # Transform deplibs into only deplibs that can be linked in shared.
8091 name_save=$name
8092 libname_save=$libname
8093 release_save=$release
8094 versuffix_save=$versuffix
8095 major_save=$major
8096 # I'm not sure if I'm treating the release correctly. I think
8097 # release should show up in the -l (ie -lgmp5) so we don't want to
8098 # add it in twice. Is that correct?
8099 release=""
8100 versuffix=""
8101 major=""
8102 newdeplibs=
8103 droppeddeps=no
8104 case $deplibs_check_method in
8105 pass_all)
8106 # Don't check for shared/static. Everything works.
8107 # This might be a little naive. We might want to check
8108 # whether the library exists or not. But this is on
8109 # osf3 & osf4 and I'm not really sure... Just
8110 # implementing what was already the behavior.
8111 newdeplibs=$deplibs
8112 ;;
8113 test_compile)
8114 # This code stresses the "libraries are programs" paradigm to its
8115 # limits. Maybe even breaks it. We compile a program, linking it
8116 # against the deplibs as a proxy for the library. Then we can check
8117 # whether they linked in statically or dynamically with ldd.
8118 $opt_dry_run || $RM conftest.c
8119 cat > conftest.c <<EOF
8120 int main() { return 0; }
8121EOF
8122 $opt_dry_run || $RM conftest
8123 if $LTCC $LTCFLAGS -o conftest conftest.c $deplibs; then
8124 ldd_output=`ldd conftest`
8125 for i in $deplibs; do
8126 case $i in
8127 -l*)
8128 func_stripname -l '' "$i"
8129 name=$func_stripname_result
8130 if test "X$allow_libtool_libs_with_static_runtimes" = "Xyes" ; then
8131 case " $predeps $postdeps " in
8132 *" $i "*)
cristyda16f162011-02-19 23:52:17 +00008133 newdeplibs+=" $i"
cristy3ed852e2009-09-05 21:47:34 +00008134 i=""
8135 ;;
8136 esac
8137 fi
8138 if test -n "$i" ; then
8139 libname=`eval "\\$ECHO \"$libname_spec\""`
8140 deplib_matches=`eval "\\$ECHO \"$library_names_spec\""`
8141 set dummy $deplib_matches; shift
8142 deplib_match=$1
8143 if test `expr "$ldd_output" : ".*$deplib_match"` -ne 0 ; then
cristyda16f162011-02-19 23:52:17 +00008144 newdeplibs+=" $i"
cristy3ed852e2009-09-05 21:47:34 +00008145 else
8146 droppeddeps=yes
cristy98dddb52010-11-04 00:30:15 +00008147 echo
cristy3ed852e2009-09-05 21:47:34 +00008148 $ECHO "*** Warning: dynamic linker does not accept needed library $i."
cristy98dddb52010-11-04 00:30:15 +00008149 echo "*** I have the capability to make that library automatically link in when"
8150 echo "*** you link to this library. But I can only do this if you have a"
8151 echo "*** shared version of the library, which I believe you do not have"
8152 echo "*** because a test_compile did reveal that the linker did not use it for"
8153 echo "*** its dynamic dependency list that programs get resolved with at runtime."
cristy3ed852e2009-09-05 21:47:34 +00008154 fi
8155 fi
8156 ;;
8157 *)
cristyda16f162011-02-19 23:52:17 +00008158 newdeplibs+=" $i"
cristy3ed852e2009-09-05 21:47:34 +00008159 ;;
8160 esac
8161 done
8162 else
8163 # Error occurred in the first compile. Let's try to salvage
8164 # the situation: Compile a separate program for each library.
8165 for i in $deplibs; do
8166 case $i in
8167 -l*)
8168 func_stripname -l '' "$i"
8169 name=$func_stripname_result
8170 $opt_dry_run || $RM conftest
8171 if $LTCC $LTCFLAGS -o conftest conftest.c $i; then
8172 ldd_output=`ldd conftest`
8173 if test "X$allow_libtool_libs_with_static_runtimes" = "Xyes" ; then
8174 case " $predeps $postdeps " in
8175 *" $i "*)
cristyda16f162011-02-19 23:52:17 +00008176 newdeplibs+=" $i"
cristy3ed852e2009-09-05 21:47:34 +00008177 i=""
8178 ;;
8179 esac
8180 fi
8181 if test -n "$i" ; then
8182 libname=`eval "\\$ECHO \"$libname_spec\""`
8183 deplib_matches=`eval "\\$ECHO \"$library_names_spec\""`
8184 set dummy $deplib_matches; shift
8185 deplib_match=$1
8186 if test `expr "$ldd_output" : ".*$deplib_match"` -ne 0 ; then
cristyda16f162011-02-19 23:52:17 +00008187 newdeplibs+=" $i"
cristy3ed852e2009-09-05 21:47:34 +00008188 else
8189 droppeddeps=yes
cristy98dddb52010-11-04 00:30:15 +00008190 echo
cristy3ed852e2009-09-05 21:47:34 +00008191 $ECHO "*** Warning: dynamic linker does not accept needed library $i."
cristy98dddb52010-11-04 00:30:15 +00008192 echo "*** I have the capability to make that library automatically link in when"
8193 echo "*** you link to this library. But I can only do this if you have a"
8194 echo "*** shared version of the library, which you do not appear to have"
8195 echo "*** because a test_compile did reveal that the linker did not use this one"
8196 echo "*** as a dynamic dependency that programs can get resolved with at runtime."
cristy3ed852e2009-09-05 21:47:34 +00008197 fi
8198 fi
8199 else
8200 droppeddeps=yes
cristy98dddb52010-11-04 00:30:15 +00008201 echo
cristy3ed852e2009-09-05 21:47:34 +00008202 $ECHO "*** Warning! Library $i is needed by this library but I was not able to"
cristy98dddb52010-11-04 00:30:15 +00008203 echo "*** make it link in! You will probably need to install it or some"
8204 echo "*** library that it depends on before this library will be fully"
8205 echo "*** functional. Installing it before continuing would be even better."
cristy3ed852e2009-09-05 21:47:34 +00008206 fi
8207 ;;
8208 *)
cristyda16f162011-02-19 23:52:17 +00008209 newdeplibs+=" $i"
cristy3ed852e2009-09-05 21:47:34 +00008210 ;;
8211 esac
8212 done
8213 fi
8214 ;;
8215 file_magic*)
8216 set dummy $deplibs_check_method; shift
8217 file_magic_regex=`expr "$deplibs_check_method" : "$1 \(.*\)"`
8218 for a_deplib in $deplibs; do
8219 case $a_deplib in
8220 -l*)
8221 func_stripname -l '' "$a_deplib"
8222 name=$func_stripname_result
8223 if test "X$allow_libtool_libs_with_static_runtimes" = "Xyes" ; then
8224 case " $predeps $postdeps " in
8225 *" $a_deplib "*)
cristyda16f162011-02-19 23:52:17 +00008226 newdeplibs+=" $a_deplib"
cristy3ed852e2009-09-05 21:47:34 +00008227 a_deplib=""
8228 ;;
8229 esac
8230 fi
8231 if test -n "$a_deplib" ; then
8232 libname=`eval "\\$ECHO \"$libname_spec\""`
cristyda16f162011-02-19 23:52:17 +00008233 if test -n "$file_magic_glob"; then
8234 libnameglob=`func_echo_all "$libname" | $SED -e $file_magic_glob`
8235 else
8236 libnameglob=$libname
8237 fi
8238 test "$want_nocaseglob" = yes && nocaseglob=`shopt -p nocaseglob`
cristy3ed852e2009-09-05 21:47:34 +00008239 for i in $lib_search_path $sys_lib_search_path $shlib_search_path; do
cristyda16f162011-02-19 23:52:17 +00008240 if test "$want_nocaseglob" = yes; then
8241 shopt -s nocaseglob
8242 potential_libs=`ls $i/$libnameglob[.-]* 2>/dev/null`
8243 $nocaseglob
8244 else
8245 potential_libs=`ls $i/$libnameglob[.-]* 2>/dev/null`
8246 fi
cristy3ed852e2009-09-05 21:47:34 +00008247 for potent_lib in $potential_libs; do
8248 # Follow soft links.
8249 if ls -lLd "$potent_lib" 2>/dev/null |
8250 $GREP " -> " >/dev/null; then
8251 continue
8252 fi
8253 # The statement above tries to avoid entering an
8254 # endless loop below, in case of cyclic links.
8255 # We might still enter an endless loop, since a link
8256 # loop can be closed while we follow links,
8257 # but so what?
8258 potlib="$potent_lib"
8259 while test -h "$potlib" 2>/dev/null; do
8260 potliblink=`ls -ld $potlib | ${SED} 's/.* -> //'`
8261 case $potliblink in
8262 [\\/]* | [A-Za-z]:[\\/]*) potlib="$potliblink";;
cristy98dddb52010-11-04 00:30:15 +00008263 *) potlib=`$ECHO "$potlib" | $SED 's,[^/]*$,,'`"$potliblink";;
cristy3ed852e2009-09-05 21:47:34 +00008264 esac
8265 done
8266 if eval $file_magic_cmd \"\$potlib\" 2>/dev/null |
8267 $SED -e 10q |
8268 $EGREP "$file_magic_regex" > /dev/null; then
cristyda16f162011-02-19 23:52:17 +00008269 newdeplibs+=" $a_deplib"
cristy3ed852e2009-09-05 21:47:34 +00008270 a_deplib=""
8271 break 2
8272 fi
8273 done
8274 done
8275 fi
8276 if test -n "$a_deplib" ; then
8277 droppeddeps=yes
cristy98dddb52010-11-04 00:30:15 +00008278 echo
cristy3ed852e2009-09-05 21:47:34 +00008279 $ECHO "*** Warning: linker path does not have real file for library $a_deplib."
cristy98dddb52010-11-04 00:30:15 +00008280 echo "*** I have the capability to make that library automatically link in when"
8281 echo "*** you link to this library. But I can only do this if you have a"
8282 echo "*** shared version of the library, which you do not appear to have"
8283 echo "*** because I did check the linker path looking for a file starting"
cristy3ed852e2009-09-05 21:47:34 +00008284 if test -z "$potlib" ; then
8285 $ECHO "*** with $libname but no candidates were found. (...for file magic test)"
8286 else
8287 $ECHO "*** with $libname and none of the candidates passed a file format test"
8288 $ECHO "*** using a file magic. Last file checked: $potlib"
8289 fi
8290 fi
8291 ;;
8292 *)
8293 # Add a -L argument.
cristyda16f162011-02-19 23:52:17 +00008294 newdeplibs+=" $a_deplib"
cristy3ed852e2009-09-05 21:47:34 +00008295 ;;
8296 esac
8297 done # Gone through all deplibs.
8298 ;;
8299 match_pattern*)
8300 set dummy $deplibs_check_method; shift
8301 match_pattern_regex=`expr "$deplibs_check_method" : "$1 \(.*\)"`
8302 for a_deplib in $deplibs; do
8303 case $a_deplib in
8304 -l*)
8305 func_stripname -l '' "$a_deplib"
8306 name=$func_stripname_result
8307 if test "X$allow_libtool_libs_with_static_runtimes" = "Xyes" ; then
8308 case " $predeps $postdeps " in
8309 *" $a_deplib "*)
cristyda16f162011-02-19 23:52:17 +00008310 newdeplibs+=" $a_deplib"
cristy3ed852e2009-09-05 21:47:34 +00008311 a_deplib=""
8312 ;;
8313 esac
8314 fi
8315 if test -n "$a_deplib" ; then
8316 libname=`eval "\\$ECHO \"$libname_spec\""`
8317 for i in $lib_search_path $sys_lib_search_path $shlib_search_path; do
8318 potential_libs=`ls $i/$libname[.-]* 2>/dev/null`
8319 for potent_lib in $potential_libs; do
8320 potlib="$potent_lib" # see symlink-check above in file_magic test
cristy98dddb52010-11-04 00:30:15 +00008321 if eval "\$ECHO \"$potent_lib\"" 2>/dev/null | $SED 10q | \
cristy3ed852e2009-09-05 21:47:34 +00008322 $EGREP "$match_pattern_regex" > /dev/null; then
cristyda16f162011-02-19 23:52:17 +00008323 newdeplibs+=" $a_deplib"
cristy3ed852e2009-09-05 21:47:34 +00008324 a_deplib=""
8325 break 2
8326 fi
8327 done
8328 done
8329 fi
8330 if test -n "$a_deplib" ; then
8331 droppeddeps=yes
cristy98dddb52010-11-04 00:30:15 +00008332 echo
cristy3ed852e2009-09-05 21:47:34 +00008333 $ECHO "*** Warning: linker path does not have real file for library $a_deplib."
cristy98dddb52010-11-04 00:30:15 +00008334 echo "*** I have the capability to make that library automatically link in when"
8335 echo "*** you link to this library. But I can only do this if you have a"
8336 echo "*** shared version of the library, which you do not appear to have"
8337 echo "*** because I did check the linker path looking for a file starting"
cristy3ed852e2009-09-05 21:47:34 +00008338 if test -z "$potlib" ; then
8339 $ECHO "*** with $libname but no candidates were found. (...for regex pattern test)"
8340 else
8341 $ECHO "*** with $libname and none of the candidates passed a file format test"
8342 $ECHO "*** using a regex pattern. Last file checked: $potlib"
8343 fi
8344 fi
8345 ;;
8346 *)
8347 # Add a -L argument.
cristyda16f162011-02-19 23:52:17 +00008348 newdeplibs+=" $a_deplib"
cristy3ed852e2009-09-05 21:47:34 +00008349 ;;
8350 esac
8351 done # Gone through all deplibs.
8352 ;;
8353 none | unknown | *)
8354 newdeplibs=""
cristy98dddb52010-11-04 00:30:15 +00008355 tmp_deplibs=`$ECHO " $deplibs" | $SED 's/ -lc$//; s/ -[LR][^ ]*//g'`
cristy3ed852e2009-09-05 21:47:34 +00008356 if test "X$allow_libtool_libs_with_static_runtimes" = "Xyes" ; then
8357 for i in $predeps $postdeps ; do
8358 # can't use Xsed below, because $i might contain '/'
cristy98dddb52010-11-04 00:30:15 +00008359 tmp_deplibs=`$ECHO " $tmp_deplibs" | $SED "s,$i,,"`
cristy3ed852e2009-09-05 21:47:34 +00008360 done
8361 fi
cristy98dddb52010-11-04 00:30:15 +00008362 case $tmp_deplibs in
8363 *[!\ \ ]*)
8364 echo
cristy3ed852e2009-09-05 21:47:34 +00008365 if test "X$deplibs_check_method" = "Xnone"; then
cristy98dddb52010-11-04 00:30:15 +00008366 echo "*** Warning: inter-library dependencies are not supported in this platform."
cristy3ed852e2009-09-05 21:47:34 +00008367 else
cristy98dddb52010-11-04 00:30:15 +00008368 echo "*** Warning: inter-library dependencies are not known to be supported."
cristy3ed852e2009-09-05 21:47:34 +00008369 fi
cristy98dddb52010-11-04 00:30:15 +00008370 echo "*** All declared inter-library dependencies are being dropped."
cristy3ed852e2009-09-05 21:47:34 +00008371 droppeddeps=yes
cristy98dddb52010-11-04 00:30:15 +00008372 ;;
8373 esac
cristy3ed852e2009-09-05 21:47:34 +00008374 ;;
8375 esac
8376 versuffix=$versuffix_save
8377 major=$major_save
8378 release=$release_save
8379 libname=$libname_save
8380 name=$name_save
8381
8382 case $host in
8383 *-*-rhapsody* | *-*-darwin1.[012])
8384 # On Rhapsody replace the C library with the System framework
cristy98dddb52010-11-04 00:30:15 +00008385 newdeplibs=`$ECHO " $newdeplibs" | $SED 's/ -lc / System.ltframework /'`
cristy3ed852e2009-09-05 21:47:34 +00008386 ;;
8387 esac
8388
8389 if test "$droppeddeps" = yes; then
8390 if test "$module" = yes; then
cristy98dddb52010-11-04 00:30:15 +00008391 echo
8392 echo "*** Warning: libtool could not satisfy all declared inter-library"
cristy3ed852e2009-09-05 21:47:34 +00008393 $ECHO "*** dependencies of module $libname. Therefore, libtool will create"
cristy98dddb52010-11-04 00:30:15 +00008394 echo "*** a static module, that should work as long as the dlopening"
8395 echo "*** application is linked with the -dlopen flag."
cristy3ed852e2009-09-05 21:47:34 +00008396 if test -z "$global_symbol_pipe"; then
cristy98dddb52010-11-04 00:30:15 +00008397 echo
8398 echo "*** However, this would only work if libtool was able to extract symbol"
8399 echo "*** lists from a program, using \`nm' or equivalent, but libtool could"
8400 echo "*** not find such a program. So, this module is probably useless."
8401 echo "*** \`nm' from GNU binutils and a full rebuild may help."
cristy3ed852e2009-09-05 21:47:34 +00008402 fi
8403 if test "$build_old_libs" = no; then
8404 oldlibs="$output_objdir/$libname.$libext"
8405 build_libtool_libs=module
8406 build_old_libs=yes
8407 else
8408 build_libtool_libs=no
8409 fi
8410 else
cristy98dddb52010-11-04 00:30:15 +00008411 echo "*** The inter-library dependencies that have been dropped here will be"
8412 echo "*** automatically added whenever a program is linked with this library"
8413 echo "*** or is declared to -dlopen it."
cristy3ed852e2009-09-05 21:47:34 +00008414
8415 if test "$allow_undefined" = no; then
cristy98dddb52010-11-04 00:30:15 +00008416 echo
8417 echo "*** Since this library must not contain undefined symbols,"
8418 echo "*** because either the platform does not support them or"
8419 echo "*** it was explicitly requested with -no-undefined,"
8420 echo "*** libtool will only create a static version of it."
cristy3ed852e2009-09-05 21:47:34 +00008421 if test "$build_old_libs" = no; then
8422 oldlibs="$output_objdir/$libname.$libext"
8423 build_libtool_libs=module
8424 build_old_libs=yes
8425 else
8426 build_libtool_libs=no
8427 fi
8428 fi
8429 fi
8430 fi
8431 # Done checking deplibs!
8432 deplibs=$newdeplibs
8433 fi
8434 # Time to change all our "foo.ltframework" stuff back to "-framework foo"
8435 case $host in
8436 *-*-darwin*)
cristy98dddb52010-11-04 00:30:15 +00008437 newdeplibs=`$ECHO " $newdeplibs" | $SED 's% \([^ $]*\).ltframework% -framework \1%g'`
8438 new_inherited_linker_flags=`$ECHO " $new_inherited_linker_flags" | $SED 's% \([^ $]*\).ltframework% -framework \1%g'`
8439 deplibs=`$ECHO " $deplibs" | $SED 's% \([^ $]*\).ltframework% -framework \1%g'`
cristy3ed852e2009-09-05 21:47:34 +00008440 ;;
8441 esac
8442
8443 # move library search paths that coincide with paths to not yet
8444 # installed libraries to the beginning of the library search list
8445 new_libs=
8446 for path in $notinst_path; do
8447 case " $new_libs " in
8448 *" -L$path/$objdir "*) ;;
8449 *)
8450 case " $deplibs " in
8451 *" -L$path/$objdir "*)
cristyda16f162011-02-19 23:52:17 +00008452 new_libs+=" -L$path/$objdir" ;;
cristy3ed852e2009-09-05 21:47:34 +00008453 esac
8454 ;;
8455 esac
8456 done
8457 for deplib in $deplibs; do
8458 case $deplib in
8459 -L*)
8460 case " $new_libs " in
8461 *" $deplib "*) ;;
cristyda16f162011-02-19 23:52:17 +00008462 *) new_libs+=" $deplib" ;;
cristy3ed852e2009-09-05 21:47:34 +00008463 esac
8464 ;;
cristyda16f162011-02-19 23:52:17 +00008465 *) new_libs+=" $deplib" ;;
cristy3ed852e2009-09-05 21:47:34 +00008466 esac
8467 done
8468 deplibs="$new_libs"
8469
8470 # All the library-specific variables (install_libdir is set above).
8471 library_names=
8472 old_library=
8473 dlname=
8474
8475 # Test again, we may have decided not to build it any more
8476 if test "$build_libtool_libs" = yes; then
cristy2542fc62011-12-06 17:50:25 +00008477 # Remove ${wl} instances when linking with ld.
8478 # FIXME: should test the right _cmds variable.
8479 case $archive_cmds in
8480 *\$LD\ *) wl= ;;
8481 esac
cristy3ed852e2009-09-05 21:47:34 +00008482 if test "$hardcode_into_libs" = yes; then
8483 # Hardcode the library paths
8484 hardcode_libdirs=
8485 dep_rpath=
8486 rpath="$finalize_rpath"
cristyda16f162011-02-19 23:52:17 +00008487 test "$opt_mode" != relink && rpath="$compile_rpath$rpath"
cristy3ed852e2009-09-05 21:47:34 +00008488 for libdir in $rpath; do
8489 if test -n "$hardcode_libdir_flag_spec"; then
8490 if test -n "$hardcode_libdir_separator"; then
cristyda16f162011-02-19 23:52:17 +00008491 func_replace_sysroot "$libdir"
8492 libdir=$func_replace_sysroot_result
cristy3ed852e2009-09-05 21:47:34 +00008493 if test -z "$hardcode_libdirs"; then
8494 hardcode_libdirs="$libdir"
8495 else
8496 # Just accumulate the unique libdirs.
8497 case $hardcode_libdir_separator$hardcode_libdirs$hardcode_libdir_separator in
8498 *"$hardcode_libdir_separator$libdir$hardcode_libdir_separator"*)
8499 ;;
8500 *)
cristyda16f162011-02-19 23:52:17 +00008501 hardcode_libdirs+="$hardcode_libdir_separator$libdir"
cristy3ed852e2009-09-05 21:47:34 +00008502 ;;
8503 esac
8504 fi
8505 else
8506 eval flag=\"$hardcode_libdir_flag_spec\"
cristyda16f162011-02-19 23:52:17 +00008507 dep_rpath+=" $flag"
cristy3ed852e2009-09-05 21:47:34 +00008508 fi
8509 elif test -n "$runpath_var"; then
8510 case "$perm_rpath " in
8511 *" $libdir "*) ;;
cristy987feef2011-11-17 12:24:56 +00008512 *) perm_rpath+=" $libdir" ;;
cristy3ed852e2009-09-05 21:47:34 +00008513 esac
8514 fi
8515 done
8516 # Substitute the hardcoded libdirs into the rpath.
8517 if test -n "$hardcode_libdir_separator" &&
8518 test -n "$hardcode_libdirs"; then
8519 libdir="$hardcode_libdirs"
cristy2542fc62011-12-06 17:50:25 +00008520 eval "dep_rpath=\"$hardcode_libdir_flag_spec\""
cristy3ed852e2009-09-05 21:47:34 +00008521 fi
8522 if test -n "$runpath_var" && test -n "$perm_rpath"; then
8523 # We should set the runpath_var.
8524 rpath=
8525 for dir in $perm_rpath; do
cristyda16f162011-02-19 23:52:17 +00008526 rpath+="$dir:"
cristy3ed852e2009-09-05 21:47:34 +00008527 done
8528 eval "$runpath_var='$rpath\$$runpath_var'; export $runpath_var"
8529 fi
8530 test -n "$dep_rpath" && deplibs="$dep_rpath $deplibs"
8531 fi
8532
8533 shlibpath="$finalize_shlibpath"
cristyda16f162011-02-19 23:52:17 +00008534 test "$opt_mode" != relink && shlibpath="$compile_shlibpath$shlibpath"
cristy3ed852e2009-09-05 21:47:34 +00008535 if test -n "$shlibpath"; then
8536 eval "$shlibpath_var='$shlibpath\$$shlibpath_var'; export $shlibpath_var"
8537 fi
8538
8539 # Get the real and link names of the library.
8540 eval shared_ext=\"$shrext_cmds\"
8541 eval library_names=\"$library_names_spec\"
8542 set dummy $library_names
8543 shift
8544 realname="$1"
8545 shift
8546
8547 if test -n "$soname_spec"; then
8548 eval soname=\"$soname_spec\"
8549 else
8550 soname="$realname"
8551 fi
8552 if test -z "$dlname"; then
8553 dlname=$soname
8554 fi
8555
8556 lib="$output_objdir/$realname"
8557 linknames=
8558 for link
8559 do
cristyda16f162011-02-19 23:52:17 +00008560 linknames+=" $link"
cristy3ed852e2009-09-05 21:47:34 +00008561 done
8562
8563 # Use standard objects if they are pic
cristy98dddb52010-11-04 00:30:15 +00008564 test -z "$pic_flag" && libobjs=`$ECHO "$libobjs" | $SP2NL | $SED "$lo2o" | $NL2SP`
cristy3ed852e2009-09-05 21:47:34 +00008565 test "X$libobjs" = "X " && libobjs=
8566
8567 delfiles=
8568 if test -n "$export_symbols" && test -n "$include_expsyms"; then
8569 $opt_dry_run || cp "$export_symbols" "$output_objdir/$libname.uexp"
8570 export_symbols="$output_objdir/$libname.uexp"
cristyda16f162011-02-19 23:52:17 +00008571 delfiles+=" $export_symbols"
cristy3ed852e2009-09-05 21:47:34 +00008572 fi
8573
8574 orig_export_symbols=
8575 case $host_os in
8576 cygwin* | mingw* | cegcc*)
8577 if test -n "$export_symbols" && test -z "$export_symbols_regex"; then
8578 # exporting using user supplied symfile
8579 if test "x`$SED 1q $export_symbols`" != xEXPORTS; then
8580 # and it's NOT already a .def file. Must figure out
8581 # which of the given symbols are data symbols and tag
8582 # them as such. So, trigger use of export_symbols_cmds.
8583 # export_symbols gets reassigned inside the "prepare
8584 # the list of exported symbols" if statement, so the
8585 # include_expsyms logic still works.
8586 orig_export_symbols="$export_symbols"
8587 export_symbols=
8588 always_export_symbols=yes
8589 fi
8590 fi
8591 ;;
8592 esac
8593
8594 # Prepare the list of exported symbols
8595 if test -z "$export_symbols"; then
8596 if test "$always_export_symbols" = yes || test -n "$export_symbols_regex"; then
8597 func_verbose "generating symbol list for \`$libname.la'"
8598 export_symbols="$output_objdir/$libname.exp"
8599 $opt_dry_run || $RM $export_symbols
8600 cmds=$export_symbols_cmds
8601 save_ifs="$IFS"; IFS='~'
cristyda16f162011-02-19 23:52:17 +00008602 for cmd1 in $cmds; do
cristy3ed852e2009-09-05 21:47:34 +00008603 IFS="$save_ifs"
cristyda16f162011-02-19 23:52:17 +00008604 # Take the normal branch if the nm_file_list_spec branch
8605 # doesn't work or if tool conversion is not needed.
8606 case $nm_file_list_spec~$to_tool_file_cmd in
8607 *~func_convert_file_noop | *~func_convert_file_msys_to_w32 | ~*)
8608 try_normal_branch=yes
8609 eval cmd=\"$cmd1\"
8610 func_len " $cmd"
8611 len=$func_len_result
8612 ;;
8613 *)
8614 try_normal_branch=no
8615 ;;
8616 esac
8617 if test "$try_normal_branch" = yes \
8618 && { test "$len" -lt "$max_cmd_len" \
8619 || test "$max_cmd_len" -le -1; }
8620 then
cristy3ed852e2009-09-05 21:47:34 +00008621 func_show_eval "$cmd" 'exit $?'
8622 skipped_export=false
cristyda16f162011-02-19 23:52:17 +00008623 elif test -n "$nm_file_list_spec"; then
8624 func_basename "$output"
8625 output_la=$func_basename_result
8626 save_libobjs=$libobjs
8627 save_output=$output
8628 output=${output_objdir}/${output_la}.nm
8629 func_to_tool_file "$output"
8630 libobjs=$nm_file_list_spec$func_to_tool_file_result
8631 delfiles+=" $output"
8632 func_verbose "creating $NM input file list: $output"
8633 for obj in $save_libobjs; do
8634 func_to_tool_file "$obj"
8635 $ECHO "$func_to_tool_file_result"
8636 done > "$output"
8637 eval cmd=\"$cmd1\"
8638 func_show_eval "$cmd" 'exit $?'
8639 output=$save_output
8640 libobjs=$save_libobjs
8641 skipped_export=false
cristy3ed852e2009-09-05 21:47:34 +00008642 else
8643 # The command line is too long to execute in one step.
8644 func_verbose "using reloadable object file for export list..."
8645 skipped_export=:
8646 # Break out early, otherwise skipped_export may be
8647 # set to false by a later but shorter cmd.
8648 break
8649 fi
8650 done
8651 IFS="$save_ifs"
8652 if test -n "$export_symbols_regex" && test "X$skipped_export" != "X:"; then
8653 func_show_eval '$EGREP -e "$export_symbols_regex" "$export_symbols" > "${export_symbols}T"'
8654 func_show_eval '$MV "${export_symbols}T" "$export_symbols"'
8655 fi
8656 fi
8657 fi
8658
8659 if test -n "$export_symbols" && test -n "$include_expsyms"; then
8660 tmp_export_symbols="$export_symbols"
8661 test -n "$orig_export_symbols" && tmp_export_symbols="$orig_export_symbols"
cristy98dddb52010-11-04 00:30:15 +00008662 $opt_dry_run || eval '$ECHO "$include_expsyms" | $SP2NL >> "$tmp_export_symbols"'
cristy3ed852e2009-09-05 21:47:34 +00008663 fi
8664
8665 if test "X$skipped_export" != "X:" && test -n "$orig_export_symbols"; then
8666 # The given exports_symbols file has to be filtered, so filter it.
8667 func_verbose "filter symbol list for \`$libname.la' to tag DATA exports"
8668 # FIXME: $output_objdir/$libname.filter potentially contains lots of
8669 # 's' commands which not all seds can handle. GNU sed should be fine
8670 # though. Also, the filter scales superlinearly with the number of
8671 # global variables. join(1) would be nice here, but unfortunately
8672 # isn't a blessed tool.
8673 $opt_dry_run || $SED -e '/[ ,]DATA/!d;s,\(.*\)\([ \,].*\),s|^\1$|\1\2|,' < $export_symbols > $output_objdir/$libname.filter
cristyda16f162011-02-19 23:52:17 +00008674 delfiles+=" $export_symbols $output_objdir/$libname.filter"
cristy3ed852e2009-09-05 21:47:34 +00008675 export_symbols=$output_objdir/$libname.def
8676 $opt_dry_run || $SED -f $output_objdir/$libname.filter < $orig_export_symbols > $export_symbols
8677 fi
8678
8679 tmp_deplibs=
8680 for test_deplib in $deplibs; do
8681 case " $convenience " in
8682 *" $test_deplib "*) ;;
8683 *)
cristyda16f162011-02-19 23:52:17 +00008684 tmp_deplibs+=" $test_deplib"
cristy3ed852e2009-09-05 21:47:34 +00008685 ;;
8686 esac
8687 done
8688 deplibs="$tmp_deplibs"
8689
8690 if test -n "$convenience"; then
8691 if test -n "$whole_archive_flag_spec" &&
8692 test "$compiler_needs_object" = yes &&
8693 test -z "$libobjs"; then
8694 # extract the archives, so we have objects to list.
8695 # TODO: could optimize this to just extract one archive.
8696 whole_archive_flag_spec=
8697 fi
8698 if test -n "$whole_archive_flag_spec"; then
8699 save_libobjs=$libobjs
8700 eval libobjs=\"\$libobjs $whole_archive_flag_spec\"
8701 test "X$libobjs" = "X " && libobjs=
8702 else
8703 gentop="$output_objdir/${outputname}x"
cristyda16f162011-02-19 23:52:17 +00008704 generated+=" $gentop"
cristy3ed852e2009-09-05 21:47:34 +00008705
8706 func_extract_archives $gentop $convenience
cristyda16f162011-02-19 23:52:17 +00008707 libobjs+=" $func_extract_archives_result"
cristy3ed852e2009-09-05 21:47:34 +00008708 test "X$libobjs" = "X " && libobjs=
8709 fi
8710 fi
8711
8712 if test "$thread_safe" = yes && test -n "$thread_safe_flag_spec"; then
8713 eval flag=\"$thread_safe_flag_spec\"
cristyda16f162011-02-19 23:52:17 +00008714 linker_flags+=" $flag"
cristy3ed852e2009-09-05 21:47:34 +00008715 fi
8716
8717 # Make a backup of the uninstalled library when relinking
cristyda16f162011-02-19 23:52:17 +00008718 if test "$opt_mode" = relink; then
cristy3ed852e2009-09-05 21:47:34 +00008719 $opt_dry_run || eval '(cd $output_objdir && $RM ${realname}U && $MV $realname ${realname}U)' || exit $?
8720 fi
8721
8722 # Do each of the archive commands.
8723 if test "$module" = yes && test -n "$module_cmds" ; then
8724 if test -n "$export_symbols" && test -n "$module_expsym_cmds"; then
8725 eval test_cmds=\"$module_expsym_cmds\"
8726 cmds=$module_expsym_cmds
8727 else
8728 eval test_cmds=\"$module_cmds\"
8729 cmds=$module_cmds
8730 fi
8731 else
8732 if test -n "$export_symbols" && test -n "$archive_expsym_cmds"; then
8733 eval test_cmds=\"$archive_expsym_cmds\"
8734 cmds=$archive_expsym_cmds
8735 else
8736 eval test_cmds=\"$archive_cmds\"
8737 cmds=$archive_cmds
8738 fi
8739 fi
8740
8741 if test "X$skipped_export" != "X:" &&
8742 func_len " $test_cmds" &&
8743 len=$func_len_result &&
8744 test "$len" -lt "$max_cmd_len" || test "$max_cmd_len" -le -1; then
8745 :
8746 else
8747 # The command line is too long to link in one step, link piecewise
8748 # or, if using GNU ld and skipped_export is not :, use a linker
8749 # script.
8750
8751 # Save the value of $output and $libobjs because we want to
8752 # use them later. If we have whole_archive_flag_spec, we
8753 # want to use save_libobjs as it was before
8754 # whole_archive_flag_spec was expanded, because we can't
8755 # assume the linker understands whole_archive_flag_spec.
8756 # This may have to be revisited, in case too many
8757 # convenience libraries get linked in and end up exceeding
8758 # the spec.
8759 if test -z "$convenience" || test -z "$whole_archive_flag_spec"; then
8760 save_libobjs=$libobjs
8761 fi
8762 save_output=$output
cristy98dddb52010-11-04 00:30:15 +00008763 func_basename "$output"
8764 output_la=$func_basename_result
cristy3ed852e2009-09-05 21:47:34 +00008765
8766 # Clear the reloadable object creation command queue and
8767 # initialize k to one.
8768 test_cmds=
8769 concat_cmds=
8770 objlist=
8771 last_robj=
8772 k=1
8773
8774 if test -n "$save_libobjs" && test "X$skipped_export" != "X:" && test "$with_gnu_ld" = yes; then
8775 output=${output_objdir}/${output_la}.lnkscript
8776 func_verbose "creating GNU ld script: $output"
cristy98dddb52010-11-04 00:30:15 +00008777 echo 'INPUT (' > $output
cristy3ed852e2009-09-05 21:47:34 +00008778 for obj in $save_libobjs
8779 do
cristyda16f162011-02-19 23:52:17 +00008780 func_to_tool_file "$obj"
8781 $ECHO "$func_to_tool_file_result" >> $output
cristy3ed852e2009-09-05 21:47:34 +00008782 done
cristy98dddb52010-11-04 00:30:15 +00008783 echo ')' >> $output
cristyda16f162011-02-19 23:52:17 +00008784 delfiles+=" $output"
8785 func_to_tool_file "$output"
8786 output=$func_to_tool_file_result
cristy3ed852e2009-09-05 21:47:34 +00008787 elif test -n "$save_libobjs" && test "X$skipped_export" != "X:" && test "X$file_list_spec" != X; then
8788 output=${output_objdir}/${output_la}.lnk
8789 func_verbose "creating linker input file list: $output"
8790 : > $output
8791 set x $save_libobjs
8792 shift
8793 firstobj=
8794 if test "$compiler_needs_object" = yes; then
8795 firstobj="$1 "
8796 shift
8797 fi
8798 for obj
8799 do
cristyda16f162011-02-19 23:52:17 +00008800 func_to_tool_file "$obj"
8801 $ECHO "$func_to_tool_file_result" >> $output
cristy3ed852e2009-09-05 21:47:34 +00008802 done
cristyda16f162011-02-19 23:52:17 +00008803 delfiles+=" $output"
8804 func_to_tool_file "$output"
8805 output=$firstobj\"$file_list_spec$func_to_tool_file_result\"
cristy3ed852e2009-09-05 21:47:34 +00008806 else
8807 if test -n "$save_libobjs"; then
8808 func_verbose "creating reloadable object files..."
8809 output=$output_objdir/$output_la-${k}.$objext
8810 eval test_cmds=\"$reload_cmds\"
8811 func_len " $test_cmds"
8812 len0=$func_len_result
8813 len=$len0
8814
8815 # Loop over the list of objects to be linked.
8816 for obj in $save_libobjs
8817 do
8818 func_len " $obj"
8819 func_arith $len + $func_len_result
8820 len=$func_arith_result
8821 if test "X$objlist" = X ||
8822 test "$len" -lt "$max_cmd_len"; then
cristyda16f162011-02-19 23:52:17 +00008823 objlist+=" $obj"
cristy3ed852e2009-09-05 21:47:34 +00008824 else
8825 # The command $test_cmds is almost too long, add a
8826 # command to the queue.
8827 if test "$k" -eq 1 ; then
8828 # The first file doesn't have a previous command to add.
cristy98dddb52010-11-04 00:30:15 +00008829 reload_objs=$objlist
8830 eval concat_cmds=\"$reload_cmds\"
cristy3ed852e2009-09-05 21:47:34 +00008831 else
8832 # All subsequent reloadable object files will link in
8833 # the last one created.
cristy98dddb52010-11-04 00:30:15 +00008834 reload_objs="$objlist $last_robj"
8835 eval concat_cmds=\"\$concat_cmds~$reload_cmds~\$RM $last_robj\"
cristy3ed852e2009-09-05 21:47:34 +00008836 fi
8837 last_robj=$output_objdir/$output_la-${k}.$objext
8838 func_arith $k + 1
8839 k=$func_arith_result
8840 output=$output_objdir/$output_la-${k}.$objext
cristy98dddb52010-11-04 00:30:15 +00008841 objlist=" $obj"
cristy3ed852e2009-09-05 21:47:34 +00008842 func_len " $last_robj"
8843 func_arith $len0 + $func_len_result
8844 len=$func_arith_result
8845 fi
8846 done
8847 # Handle the remaining objects by creating one last
8848 # reloadable object file. All subsequent reloadable object
8849 # files will link in the last one created.
8850 test -z "$concat_cmds" || concat_cmds=$concat_cmds~
cristy98dddb52010-11-04 00:30:15 +00008851 reload_objs="$objlist $last_robj"
8852 eval concat_cmds=\"\${concat_cmds}$reload_cmds\"
cristy3ed852e2009-09-05 21:47:34 +00008853 if test -n "$last_robj"; then
8854 eval concat_cmds=\"\${concat_cmds}~\$RM $last_robj\"
8855 fi
cristyda16f162011-02-19 23:52:17 +00008856 delfiles+=" $output"
cristy3ed852e2009-09-05 21:47:34 +00008857
8858 else
8859 output=
8860 fi
8861
8862 if ${skipped_export-false}; then
8863 func_verbose "generating symbol list for \`$libname.la'"
8864 export_symbols="$output_objdir/$libname.exp"
8865 $opt_dry_run || $RM $export_symbols
8866 libobjs=$output
8867 # Append the command to create the export file.
8868 test -z "$concat_cmds" || concat_cmds=$concat_cmds~
8869 eval concat_cmds=\"\$concat_cmds$export_symbols_cmds\"
8870 if test -n "$last_robj"; then
8871 eval concat_cmds=\"\$concat_cmds~\$RM $last_robj\"
8872 fi
8873 fi
8874
8875 test -n "$save_libobjs" &&
8876 func_verbose "creating a temporary reloadable object file: $output"
8877
8878 # Loop through the commands generated above and execute them.
8879 save_ifs="$IFS"; IFS='~'
8880 for cmd in $concat_cmds; do
8881 IFS="$save_ifs"
8882 $opt_silent || {
8883 func_quote_for_expand "$cmd"
8884 eval "func_echo $func_quote_for_expand_result"
8885 }
8886 $opt_dry_run || eval "$cmd" || {
8887 lt_exit=$?
8888
8889 # Restore the uninstalled library and exit
cristyda16f162011-02-19 23:52:17 +00008890 if test "$opt_mode" = relink; then
cristy3ed852e2009-09-05 21:47:34 +00008891 ( cd "$output_objdir" && \
8892 $RM "${realname}T" && \
8893 $MV "${realname}U" "$realname" )
8894 fi
8895
8896 exit $lt_exit
8897 }
8898 done
8899 IFS="$save_ifs"
8900
8901 if test -n "$export_symbols_regex" && ${skipped_export-false}; then
8902 func_show_eval '$EGREP -e "$export_symbols_regex" "$export_symbols" > "${export_symbols}T"'
8903 func_show_eval '$MV "${export_symbols}T" "$export_symbols"'
8904 fi
8905 fi
8906
8907 if ${skipped_export-false}; then
8908 if test -n "$export_symbols" && test -n "$include_expsyms"; then
8909 tmp_export_symbols="$export_symbols"
8910 test -n "$orig_export_symbols" && tmp_export_symbols="$orig_export_symbols"
cristy98dddb52010-11-04 00:30:15 +00008911 $opt_dry_run || eval '$ECHO "$include_expsyms" | $SP2NL >> "$tmp_export_symbols"'
cristy3ed852e2009-09-05 21:47:34 +00008912 fi
8913
8914 if test -n "$orig_export_symbols"; then
8915 # The given exports_symbols file has to be filtered, so filter it.
8916 func_verbose "filter symbol list for \`$libname.la' to tag DATA exports"
8917 # FIXME: $output_objdir/$libname.filter potentially contains lots of
8918 # 's' commands which not all seds can handle. GNU sed should be fine
8919 # though. Also, the filter scales superlinearly with the number of
8920 # global variables. join(1) would be nice here, but unfortunately
8921 # isn't a blessed tool.
8922 $opt_dry_run || $SED -e '/[ ,]DATA/!d;s,\(.*\)\([ \,].*\),s|^\1$|\1\2|,' < $export_symbols > $output_objdir/$libname.filter
cristyda16f162011-02-19 23:52:17 +00008923 delfiles+=" $export_symbols $output_objdir/$libname.filter"
cristy3ed852e2009-09-05 21:47:34 +00008924 export_symbols=$output_objdir/$libname.def
8925 $opt_dry_run || $SED -f $output_objdir/$libname.filter < $orig_export_symbols > $export_symbols
8926 fi
8927 fi
8928
8929 libobjs=$output
8930 # Restore the value of output.
8931 output=$save_output
8932
8933 if test -n "$convenience" && test -n "$whole_archive_flag_spec"; then
8934 eval libobjs=\"\$libobjs $whole_archive_flag_spec\"
8935 test "X$libobjs" = "X " && libobjs=
8936 fi
8937 # Expand the library linking commands again to reset the
8938 # value of $libobjs for piecewise linking.
8939
8940 # Do each of the archive commands.
8941 if test "$module" = yes && test -n "$module_cmds" ; then
8942 if test -n "$export_symbols" && test -n "$module_expsym_cmds"; then
8943 cmds=$module_expsym_cmds
8944 else
8945 cmds=$module_cmds
8946 fi
8947 else
8948 if test -n "$export_symbols" && test -n "$archive_expsym_cmds"; then
8949 cmds=$archive_expsym_cmds
8950 else
8951 cmds=$archive_cmds
8952 fi
8953 fi
8954 fi
8955
8956 if test -n "$delfiles"; then
8957 # Append the command to remove temporary files to $cmds.
8958 eval cmds=\"\$cmds~\$RM $delfiles\"
8959 fi
8960
8961 # Add any objects from preloaded convenience libraries
8962 if test -n "$dlprefiles"; then
8963 gentop="$output_objdir/${outputname}x"
cristyda16f162011-02-19 23:52:17 +00008964 generated+=" $gentop"
cristy3ed852e2009-09-05 21:47:34 +00008965
8966 func_extract_archives $gentop $dlprefiles
cristyda16f162011-02-19 23:52:17 +00008967 libobjs+=" $func_extract_archives_result"
cristy3ed852e2009-09-05 21:47:34 +00008968 test "X$libobjs" = "X " && libobjs=
8969 fi
8970
8971 save_ifs="$IFS"; IFS='~'
8972 for cmd in $cmds; do
8973 IFS="$save_ifs"
8974 eval cmd=\"$cmd\"
8975 $opt_silent || {
8976 func_quote_for_expand "$cmd"
8977 eval "func_echo $func_quote_for_expand_result"
8978 }
8979 $opt_dry_run || eval "$cmd" || {
8980 lt_exit=$?
8981
8982 # Restore the uninstalled library and exit
cristyda16f162011-02-19 23:52:17 +00008983 if test "$opt_mode" = relink; then
cristy3ed852e2009-09-05 21:47:34 +00008984 ( cd "$output_objdir" && \
8985 $RM "${realname}T" && \
8986 $MV "${realname}U" "$realname" )
8987 fi
8988
8989 exit $lt_exit
8990 }
8991 done
8992 IFS="$save_ifs"
8993
8994 # Restore the uninstalled library and exit
cristyda16f162011-02-19 23:52:17 +00008995 if test "$opt_mode" = relink; then
cristy3ed852e2009-09-05 21:47:34 +00008996 $opt_dry_run || eval '(cd $output_objdir && $RM ${realname}T && $MV $realname ${realname}T && $MV ${realname}U $realname)' || exit $?
8997
8998 if test -n "$convenience"; then
8999 if test -z "$whole_archive_flag_spec"; then
9000 func_show_eval '${RM}r "$gentop"'
9001 fi
9002 fi
9003
9004 exit $EXIT_SUCCESS
9005 fi
9006
9007 # Create links to the real library.
9008 for linkname in $linknames; do
9009 if test "$realname" != "$linkname"; then
9010 func_show_eval '(cd "$output_objdir" && $RM "$linkname" && $LN_S "$realname" "$linkname")' 'exit $?'
9011 fi
9012 done
9013
9014 # If -module or -export-dynamic was specified, set the dlname.
9015 if test "$module" = yes || test "$export_dynamic" = yes; then
9016 # On all known operating systems, these are identical.
9017 dlname="$soname"
9018 fi
9019 fi
9020 ;;
9021
9022 obj)
9023 if test -n "$dlfiles$dlprefiles" || test "$dlself" != no; then
9024 func_warning "\`-dlopen' is ignored for objects"
9025 fi
9026
9027 case " $deplibs" in
9028 *\ -l* | *\ -L*)
9029 func_warning "\`-l' and \`-L' are ignored for objects" ;;
9030 esac
9031
9032 test -n "$rpath" && \
9033 func_warning "\`-rpath' is ignored for objects"
9034
9035 test -n "$xrpath" && \
9036 func_warning "\`-R' is ignored for objects"
9037
9038 test -n "$vinfo" && \
9039 func_warning "\`-version-info' is ignored for objects"
9040
9041 test -n "$release" && \
9042 func_warning "\`-release' is ignored for objects"
9043
9044 case $output in
9045 *.lo)
9046 test -n "$objs$old_deplibs" && \
9047 func_fatal_error "cannot build library object \`$output' from non-libtool objects"
9048
9049 libobj=$output
9050 func_lo2o "$libobj"
9051 obj=$func_lo2o_result
9052 ;;
9053 *)
9054 libobj=
9055 obj="$output"
9056 ;;
9057 esac
9058
9059 # Delete the old objects.
9060 $opt_dry_run || $RM $obj $libobj
9061
9062 # Objects from convenience libraries. This assumes
9063 # single-version convenience libraries. Whenever we create
9064 # different ones for PIC/non-PIC, this we'll have to duplicate
9065 # the extraction.
9066 reload_conv_objs=
9067 gentop=
9068 # reload_cmds runs $LD directly, so let us get rid of
9069 # -Wl from whole_archive_flag_spec and hope we can get by with
9070 # turning comma into space..
9071 wl=
9072
9073 if test -n "$convenience"; then
9074 if test -n "$whole_archive_flag_spec"; then
9075 eval tmp_whole_archive_flags=\"$whole_archive_flag_spec\"
cristy98dddb52010-11-04 00:30:15 +00009076 reload_conv_objs=$reload_objs\ `$ECHO "$tmp_whole_archive_flags" | $SED 's|,| |g'`
cristy3ed852e2009-09-05 21:47:34 +00009077 else
9078 gentop="$output_objdir/${obj}x"
cristyda16f162011-02-19 23:52:17 +00009079 generated+=" $gentop"
cristy3ed852e2009-09-05 21:47:34 +00009080
9081 func_extract_archives $gentop $convenience
9082 reload_conv_objs="$reload_objs $func_extract_archives_result"
9083 fi
9084 fi
9085
cristyda16f162011-02-19 23:52:17 +00009086 # If we're not building shared, we need to use non_pic_objs
9087 test "$build_libtool_libs" != yes && libobjs="$non_pic_objects"
9088
cristy3ed852e2009-09-05 21:47:34 +00009089 # Create the old-style object.
cristy98dddb52010-11-04 00:30:15 +00009090 reload_objs="$objs$old_deplibs "`$ECHO "$libobjs" | $SP2NL | $SED "/\.${libext}$/d; /\.lib$/d; $lo2o" | $NL2SP`" $reload_conv_objs" ### testsuite: skip nested quoting test
cristy3ed852e2009-09-05 21:47:34 +00009091
9092 output="$obj"
9093 func_execute_cmds "$reload_cmds" 'exit $?'
9094
9095 # Exit if we aren't doing a library object file.
9096 if test -z "$libobj"; then
9097 if test -n "$gentop"; then
9098 func_show_eval '${RM}r "$gentop"'
9099 fi
9100
9101 exit $EXIT_SUCCESS
9102 fi
9103
9104 if test "$build_libtool_libs" != yes; then
9105 if test -n "$gentop"; then
9106 func_show_eval '${RM}r "$gentop"'
9107 fi
9108
9109 # Create an invalid libtool object if no PIC, so that we don't
9110 # accidentally link it into a program.
9111 # $show "echo timestamp > $libobj"
9112 # $opt_dry_run || eval "echo timestamp > $libobj" || exit $?
9113 exit $EXIT_SUCCESS
9114 fi
9115
9116 if test -n "$pic_flag" || test "$pic_mode" != default; then
9117 # Only do commands if we really have different PIC objects.
9118 reload_objs="$libobjs $reload_conv_objs"
9119 output="$libobj"
9120 func_execute_cmds "$reload_cmds" 'exit $?'
9121 fi
9122
9123 if test -n "$gentop"; then
9124 func_show_eval '${RM}r "$gentop"'
9125 fi
9126
9127 exit $EXIT_SUCCESS
9128 ;;
9129
9130 prog)
9131 case $host in
9132 *cygwin*) func_stripname '' '.exe' "$output"
9133 output=$func_stripname_result.exe;;
9134 esac
9135 test -n "$vinfo" && \
9136 func_warning "\`-version-info' is ignored for programs"
9137
9138 test -n "$release" && \
9139 func_warning "\`-release' is ignored for programs"
9140
9141 test "$preload" = yes \
9142 && test "$dlopen_support" = unknown \
9143 && test "$dlopen_self" = unknown \
9144 && test "$dlopen_self_static" = unknown && \
9145 func_warning "\`LT_INIT([dlopen])' not used. Assuming no dlopen support."
9146
9147 case $host in
9148 *-*-rhapsody* | *-*-darwin1.[012])
9149 # On Rhapsody replace the C library is the System framework
cristy98dddb52010-11-04 00:30:15 +00009150 compile_deplibs=`$ECHO " $compile_deplibs" | $SED 's/ -lc / System.ltframework /'`
9151 finalize_deplibs=`$ECHO " $finalize_deplibs" | $SED 's/ -lc / System.ltframework /'`
cristy3ed852e2009-09-05 21:47:34 +00009152 ;;
9153 esac
9154
9155 case $host in
9156 *-*-darwin*)
9157 # Don't allow lazy linking, it breaks C++ global constructors
9158 # But is supposedly fixed on 10.4 or later (yay!).
9159 if test "$tagname" = CXX ; then
9160 case ${MACOSX_DEPLOYMENT_TARGET-10.0} in
9161 10.[0123])
cristyda16f162011-02-19 23:52:17 +00009162 compile_command+=" ${wl}-bind_at_load"
9163 finalize_command+=" ${wl}-bind_at_load"
cristy3ed852e2009-09-05 21:47:34 +00009164 ;;
9165 esac
9166 fi
9167 # Time to change all our "foo.ltframework" stuff back to "-framework foo"
cristy98dddb52010-11-04 00:30:15 +00009168 compile_deplibs=`$ECHO " $compile_deplibs" | $SED 's% \([^ $]*\).ltframework% -framework \1%g'`
9169 finalize_deplibs=`$ECHO " $finalize_deplibs" | $SED 's% \([^ $]*\).ltframework% -framework \1%g'`
cristy3ed852e2009-09-05 21:47:34 +00009170 ;;
9171 esac
9172
9173
9174 # move library search paths that coincide with paths to not yet
9175 # installed libraries to the beginning of the library search list
9176 new_libs=
9177 for path in $notinst_path; do
9178 case " $new_libs " in
9179 *" -L$path/$objdir "*) ;;
9180 *)
9181 case " $compile_deplibs " in
9182 *" -L$path/$objdir "*)
cristyda16f162011-02-19 23:52:17 +00009183 new_libs+=" -L$path/$objdir" ;;
cristy3ed852e2009-09-05 21:47:34 +00009184 esac
9185 ;;
9186 esac
9187 done
9188 for deplib in $compile_deplibs; do
9189 case $deplib in
9190 -L*)
9191 case " $new_libs " in
9192 *" $deplib "*) ;;
cristyda16f162011-02-19 23:52:17 +00009193 *) new_libs+=" $deplib" ;;
cristy3ed852e2009-09-05 21:47:34 +00009194 esac
9195 ;;
cristyda16f162011-02-19 23:52:17 +00009196 *) new_libs+=" $deplib" ;;
cristy3ed852e2009-09-05 21:47:34 +00009197 esac
9198 done
9199 compile_deplibs="$new_libs"
9200
9201
cristyda16f162011-02-19 23:52:17 +00009202 compile_command+=" $compile_deplibs"
9203 finalize_command+=" $finalize_deplibs"
cristy3ed852e2009-09-05 21:47:34 +00009204
9205 if test -n "$rpath$xrpath"; then
9206 # If the user specified any rpath flags, then add them.
9207 for libdir in $rpath $xrpath; do
9208 # This is the magic to use -rpath.
9209 case "$finalize_rpath " in
9210 *" $libdir "*) ;;
cristyda16f162011-02-19 23:52:17 +00009211 *) finalize_rpath+=" $libdir" ;;
cristy3ed852e2009-09-05 21:47:34 +00009212 esac
9213 done
9214 fi
9215
9216 # Now hardcode the library paths
9217 rpath=
9218 hardcode_libdirs=
9219 for libdir in $compile_rpath $finalize_rpath; do
9220 if test -n "$hardcode_libdir_flag_spec"; then
9221 if test -n "$hardcode_libdir_separator"; then
9222 if test -z "$hardcode_libdirs"; then
9223 hardcode_libdirs="$libdir"
9224 else
9225 # Just accumulate the unique libdirs.
9226 case $hardcode_libdir_separator$hardcode_libdirs$hardcode_libdir_separator in
9227 *"$hardcode_libdir_separator$libdir$hardcode_libdir_separator"*)
9228 ;;
9229 *)
cristyda16f162011-02-19 23:52:17 +00009230 hardcode_libdirs+="$hardcode_libdir_separator$libdir"
cristy3ed852e2009-09-05 21:47:34 +00009231 ;;
9232 esac
9233 fi
9234 else
9235 eval flag=\"$hardcode_libdir_flag_spec\"
cristyda16f162011-02-19 23:52:17 +00009236 rpath+=" $flag"
cristy3ed852e2009-09-05 21:47:34 +00009237 fi
9238 elif test -n "$runpath_var"; then
9239 case "$perm_rpath " in
9240 *" $libdir "*) ;;
cristyda16f162011-02-19 23:52:17 +00009241 *) perm_rpath+=" $libdir" ;;
cristy3ed852e2009-09-05 21:47:34 +00009242 esac
9243 fi
9244 case $host in
9245 *-*-cygwin* | *-*-mingw* | *-*-pw32* | *-*-os2* | *-cegcc*)
9246 testbindir=`${ECHO} "$libdir" | ${SED} -e 's*/lib$*/bin*'`
9247 case :$dllsearchpath: in
9248 *":$libdir:"*) ;;
9249 ::) dllsearchpath=$libdir;;
cristyda16f162011-02-19 23:52:17 +00009250 *) dllsearchpath+=":$libdir";;
cristy3ed852e2009-09-05 21:47:34 +00009251 esac
9252 case :$dllsearchpath: in
9253 *":$testbindir:"*) ;;
9254 ::) dllsearchpath=$testbindir;;
cristyda16f162011-02-19 23:52:17 +00009255 *) dllsearchpath+=":$testbindir";;
cristy3ed852e2009-09-05 21:47:34 +00009256 esac
9257 ;;
9258 esac
9259 done
9260 # Substitute the hardcoded libdirs into the rpath.
9261 if test -n "$hardcode_libdir_separator" &&
9262 test -n "$hardcode_libdirs"; then
9263 libdir="$hardcode_libdirs"
9264 eval rpath=\" $hardcode_libdir_flag_spec\"
9265 fi
9266 compile_rpath="$rpath"
9267
9268 rpath=
9269 hardcode_libdirs=
9270 for libdir in $finalize_rpath; do
9271 if test -n "$hardcode_libdir_flag_spec"; then
9272 if test -n "$hardcode_libdir_separator"; then
9273 if test -z "$hardcode_libdirs"; then
9274 hardcode_libdirs="$libdir"
9275 else
9276 # Just accumulate the unique libdirs.
9277 case $hardcode_libdir_separator$hardcode_libdirs$hardcode_libdir_separator in
9278 *"$hardcode_libdir_separator$libdir$hardcode_libdir_separator"*)
9279 ;;
9280 *)
cristyda16f162011-02-19 23:52:17 +00009281 hardcode_libdirs+="$hardcode_libdir_separator$libdir"
cristy3ed852e2009-09-05 21:47:34 +00009282 ;;
9283 esac
9284 fi
9285 else
9286 eval flag=\"$hardcode_libdir_flag_spec\"
cristyda16f162011-02-19 23:52:17 +00009287 rpath+=" $flag"
cristy3ed852e2009-09-05 21:47:34 +00009288 fi
9289 elif test -n "$runpath_var"; then
9290 case "$finalize_perm_rpath " in
9291 *" $libdir "*) ;;
cristyda16f162011-02-19 23:52:17 +00009292 *) finalize_perm_rpath+=" $libdir" ;;
cristy3ed852e2009-09-05 21:47:34 +00009293 esac
9294 fi
9295 done
9296 # Substitute the hardcoded libdirs into the rpath.
9297 if test -n "$hardcode_libdir_separator" &&
9298 test -n "$hardcode_libdirs"; then
9299 libdir="$hardcode_libdirs"
9300 eval rpath=\" $hardcode_libdir_flag_spec\"
9301 fi
9302 finalize_rpath="$rpath"
9303
9304 if test -n "$libobjs" && test "$build_old_libs" = yes; then
9305 # Transform all the library objects into standard objects.
cristy98dddb52010-11-04 00:30:15 +00009306 compile_command=`$ECHO "$compile_command" | $SP2NL | $SED "$lo2o" | $NL2SP`
9307 finalize_command=`$ECHO "$finalize_command" | $SP2NL | $SED "$lo2o" | $NL2SP`
cristy3ed852e2009-09-05 21:47:34 +00009308 fi
9309
9310 func_generate_dlsyms "$outputname" "@PROGRAM@" "no"
9311
9312 # template prelinking step
9313 if test -n "$prelink_cmds"; then
9314 func_execute_cmds "$prelink_cmds" 'exit $?'
9315 fi
9316
9317 wrappers_required=yes
9318 case $host in
cristy98dddb52010-11-04 00:30:15 +00009319 *cegcc* | *mingw32ce*)
9320 # Disable wrappers for cegcc and mingw32ce hosts, we are cross compiling anyway.
9321 wrappers_required=no
9322 ;;
cristy3ed852e2009-09-05 21:47:34 +00009323 *cygwin* | *mingw* )
9324 if test "$build_libtool_libs" != yes; then
9325 wrappers_required=no
9326 fi
9327 ;;
cristy3ed852e2009-09-05 21:47:34 +00009328 *)
9329 if test "$need_relink" = no || test "$build_libtool_libs" != yes; then
9330 wrappers_required=no
9331 fi
9332 ;;
9333 esac
9334 if test "$wrappers_required" = no; then
9335 # Replace the output file specification.
cristy98dddb52010-11-04 00:30:15 +00009336 compile_command=`$ECHO "$compile_command" | $SED 's%@OUTPUT@%'"$output"'%g'`
cristy3ed852e2009-09-05 21:47:34 +00009337 link_command="$compile_command$compile_rpath"
9338
9339 # We have no uninstalled library dependencies, so finalize right now.
9340 exit_status=0
9341 func_show_eval "$link_command" 'exit_status=$?'
9342
cristyda16f162011-02-19 23:52:17 +00009343 if test -n "$postlink_cmds"; then
9344 func_to_tool_file "$output"
9345 postlink_cmds=`func_echo_all "$postlink_cmds" | $SED -e 's%@OUTPUT@%'"$output"'%g' -e 's%@TOOL_OUTPUT@%'"$func_to_tool_file_result"'%g'`
9346 func_execute_cmds "$postlink_cmds" 'exit $?'
9347 fi
9348
cristy3ed852e2009-09-05 21:47:34 +00009349 # Delete the generated files.
9350 if test -f "$output_objdir/${outputname}S.${objext}"; then
9351 func_show_eval '$RM "$output_objdir/${outputname}S.${objext}"'
9352 fi
9353
9354 exit $exit_status
9355 fi
9356
9357 if test -n "$compile_shlibpath$finalize_shlibpath"; then
9358 compile_command="$shlibpath_var=\"$compile_shlibpath$finalize_shlibpath\$$shlibpath_var\" $compile_command"
9359 fi
9360 if test -n "$finalize_shlibpath"; then
9361 finalize_command="$shlibpath_var=\"$finalize_shlibpath\$$shlibpath_var\" $finalize_command"
9362 fi
9363
9364 compile_var=
9365 finalize_var=
9366 if test -n "$runpath_var"; then
9367 if test -n "$perm_rpath"; then
9368 # We should set the runpath_var.
9369 rpath=
9370 for dir in $perm_rpath; do
cristyda16f162011-02-19 23:52:17 +00009371 rpath+="$dir:"
cristy3ed852e2009-09-05 21:47:34 +00009372 done
9373 compile_var="$runpath_var=\"$rpath\$$runpath_var\" "
9374 fi
9375 if test -n "$finalize_perm_rpath"; then
9376 # We should set the runpath_var.
9377 rpath=
9378 for dir in $finalize_perm_rpath; do
cristyda16f162011-02-19 23:52:17 +00009379 rpath+="$dir:"
cristy3ed852e2009-09-05 21:47:34 +00009380 done
9381 finalize_var="$runpath_var=\"$rpath\$$runpath_var\" "
9382 fi
9383 fi
9384
9385 if test "$no_install" = yes; then
9386 # We don't need to create a wrapper script.
9387 link_command="$compile_var$compile_command$compile_rpath"
9388 # Replace the output file specification.
cristy98dddb52010-11-04 00:30:15 +00009389 link_command=`$ECHO "$link_command" | $SED 's%@OUTPUT@%'"$output"'%g'`
cristy3ed852e2009-09-05 21:47:34 +00009390 # Delete the old output file.
9391 $opt_dry_run || $RM $output
9392 # Link the executable and exit
9393 func_show_eval "$link_command" 'exit $?'
cristyda16f162011-02-19 23:52:17 +00009394
9395 if test -n "$postlink_cmds"; then
9396 func_to_tool_file "$output"
9397 postlink_cmds=`func_echo_all "$postlink_cmds" | $SED -e 's%@OUTPUT@%'"$output"'%g' -e 's%@TOOL_OUTPUT@%'"$func_to_tool_file_result"'%g'`
9398 func_execute_cmds "$postlink_cmds" 'exit $?'
9399 fi
9400
cristy3ed852e2009-09-05 21:47:34 +00009401 exit $EXIT_SUCCESS
9402 fi
9403
9404 if test "$hardcode_action" = relink; then
9405 # Fast installation is not supported
9406 link_command="$compile_var$compile_command$compile_rpath"
9407 relink_command="$finalize_var$finalize_command$finalize_rpath"
9408
9409 func_warning "this platform does not like uninstalled shared libraries"
9410 func_warning "\`$output' will be relinked during installation"
9411 else
9412 if test "$fast_install" != no; then
9413 link_command="$finalize_var$compile_command$finalize_rpath"
9414 if test "$fast_install" = yes; then
cristy98dddb52010-11-04 00:30:15 +00009415 relink_command=`$ECHO "$compile_var$compile_command$compile_rpath" | $SED 's%@OUTPUT@%\$progdir/\$file%g'`
cristy3ed852e2009-09-05 21:47:34 +00009416 else
9417 # fast_install is set to needless
9418 relink_command=
9419 fi
9420 else
9421 link_command="$compile_var$compile_command$compile_rpath"
9422 relink_command="$finalize_var$finalize_command$finalize_rpath"
9423 fi
9424 fi
9425
9426 # Replace the output file specification.
cristy98dddb52010-11-04 00:30:15 +00009427 link_command=`$ECHO "$link_command" | $SED 's%@OUTPUT@%'"$output_objdir/$outputname"'%g'`
cristy3ed852e2009-09-05 21:47:34 +00009428
9429 # Delete the old output files.
9430 $opt_dry_run || $RM $output $output_objdir/$outputname $output_objdir/lt-$outputname
9431
9432 func_show_eval "$link_command" 'exit $?'
9433
cristyda16f162011-02-19 23:52:17 +00009434 if test -n "$postlink_cmds"; then
9435 func_to_tool_file "$output_objdir/$outputname"
9436 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'`
9437 func_execute_cmds "$postlink_cmds" 'exit $?'
9438 fi
9439
cristy3ed852e2009-09-05 21:47:34 +00009440 # Now create the wrapper script.
9441 func_verbose "creating $output"
9442
9443 # Quote the relink command for shipping.
9444 if test -n "$relink_command"; then
9445 # Preserve any variables that may affect compiler behavior
9446 for var in $variables_saved_for_relink; do
9447 if eval test -z \"\${$var+set}\"; then
9448 relink_command="{ test -z \"\${$var+set}\" || $lt_unset $var || { $var=; export $var; }; }; $relink_command"
9449 elif eval var_value=\$$var; test -z "$var_value"; then
9450 relink_command="$var=; export $var; $relink_command"
9451 else
9452 func_quote_for_eval "$var_value"
9453 relink_command="$var=$func_quote_for_eval_result; export $var; $relink_command"
9454 fi
9455 done
9456 relink_command="(cd `pwd`; $relink_command)"
cristy98dddb52010-11-04 00:30:15 +00009457 relink_command=`$ECHO "$relink_command" | $SED "$sed_quote_subst"`
cristy3ed852e2009-09-05 21:47:34 +00009458 fi
9459
9460 # Only actually do things if not in dry run mode.
9461 $opt_dry_run || {
9462 # win32 will think the script is a binary if it has
9463 # a .exe suffix, so we strip it off here.
9464 case $output in
9465 *.exe) func_stripname '' '.exe' "$output"
9466 output=$func_stripname_result ;;
9467 esac
9468 # test for cygwin because mv fails w/o .exe extensions
9469 case $host in
9470 *cygwin*)
9471 exeext=.exe
9472 func_stripname '' '.exe' "$outputname"
9473 outputname=$func_stripname_result ;;
9474 *) exeext= ;;
9475 esac
9476 case $host in
9477 *cygwin* | *mingw* )
9478 func_dirname_and_basename "$output" "" "."
9479 output_name=$func_basename_result
9480 output_path=$func_dirname_result
9481 cwrappersource="$output_path/$objdir/lt-$output_name.c"
9482 cwrapper="$output_path/$output_name.exe"
9483 $RM $cwrappersource $cwrapper
9484 trap "$RM $cwrappersource $cwrapper; exit $EXIT_FAILURE" 1 2 15
9485
9486 func_emit_cwrapperexe_src > $cwrappersource
9487
9488 # The wrapper executable is built using the $host compiler,
9489 # because it contains $host paths and files. If cross-
9490 # compiling, it, like the target executable, must be
9491 # executed on the $host or under an emulation environment.
9492 $opt_dry_run || {
9493 $LTCC $LTCFLAGS -o $cwrapper $cwrappersource
9494 $STRIP $cwrapper
9495 }
9496
9497 # Now, create the wrapper script for func_source use:
9498 func_ltwrapper_scriptname $cwrapper
9499 $RM $func_ltwrapper_scriptname_result
9500 trap "$RM $func_ltwrapper_scriptname_result; exit $EXIT_FAILURE" 1 2 15
9501 $opt_dry_run || {
9502 # note: this script will not be executed, so do not chmod.
9503 if test "x$build" = "x$host" ; then
9504 $cwrapper --lt-dump-script > $func_ltwrapper_scriptname_result
9505 else
9506 func_emit_wrapper no > $func_ltwrapper_scriptname_result
9507 fi
9508 }
9509 ;;
9510 * )
9511 $RM $output
9512 trap "$RM $output; exit $EXIT_FAILURE" 1 2 15
9513
9514 func_emit_wrapper no > $output
9515 chmod +x $output
9516 ;;
9517 esac
9518 }
9519 exit $EXIT_SUCCESS
9520 ;;
9521 esac
9522
9523 # See if we need to build an old-fashioned archive.
9524 for oldlib in $oldlibs; do
9525
9526 if test "$build_libtool_libs" = convenience; then
9527 oldobjs="$libobjs_save $symfileobj"
9528 addlibs="$convenience"
9529 build_libtool_libs=no
9530 else
9531 if test "$build_libtool_libs" = module; then
9532 oldobjs="$libobjs_save"
9533 build_libtool_libs=no
9534 else
9535 oldobjs="$old_deplibs $non_pic_objects"
9536 if test "$preload" = yes && test -f "$symfileobj"; then
cristyda16f162011-02-19 23:52:17 +00009537 oldobjs+=" $symfileobj"
cristy3ed852e2009-09-05 21:47:34 +00009538 fi
9539 fi
9540 addlibs="$old_convenience"
9541 fi
9542
9543 if test -n "$addlibs"; then
9544 gentop="$output_objdir/${outputname}x"
cristyda16f162011-02-19 23:52:17 +00009545 generated+=" $gentop"
cristy3ed852e2009-09-05 21:47:34 +00009546
9547 func_extract_archives $gentop $addlibs
cristyda16f162011-02-19 23:52:17 +00009548 oldobjs+=" $func_extract_archives_result"
cristy3ed852e2009-09-05 21:47:34 +00009549 fi
9550
9551 # Do each command in the archive commands.
9552 if test -n "$old_archive_from_new_cmds" && test "$build_libtool_libs" = yes; then
9553 cmds=$old_archive_from_new_cmds
9554 else
9555
9556 # Add any objects from preloaded convenience libraries
9557 if test -n "$dlprefiles"; then
9558 gentop="$output_objdir/${outputname}x"
cristyda16f162011-02-19 23:52:17 +00009559 generated+=" $gentop"
cristy3ed852e2009-09-05 21:47:34 +00009560
9561 func_extract_archives $gentop $dlprefiles
cristyda16f162011-02-19 23:52:17 +00009562 oldobjs+=" $func_extract_archives_result"
cristy3ed852e2009-09-05 21:47:34 +00009563 fi
9564
9565 # POSIX demands no paths to be encoded in archives. We have
9566 # to avoid creating archives with duplicate basenames if we
9567 # might have to extract them afterwards, e.g., when creating a
9568 # static archive out of a convenience library, or when linking
9569 # the entirety of a libtool archive into another (currently
9570 # not supported by libtool).
9571 if (for obj in $oldobjs
9572 do
9573 func_basename "$obj"
9574 $ECHO "$func_basename_result"
9575 done | sort | sort -uc >/dev/null 2>&1); then
9576 :
9577 else
cristy98dddb52010-11-04 00:30:15 +00009578 echo "copying selected object files to avoid basename conflicts..."
cristy3ed852e2009-09-05 21:47:34 +00009579 gentop="$output_objdir/${outputname}x"
cristyda16f162011-02-19 23:52:17 +00009580 generated+=" $gentop"
cristy3ed852e2009-09-05 21:47:34 +00009581 func_mkdir_p "$gentop"
9582 save_oldobjs=$oldobjs
9583 oldobjs=
9584 counter=1
9585 for obj in $save_oldobjs
9586 do
9587 func_basename "$obj"
9588 objbase="$func_basename_result"
9589 case " $oldobjs " in
9590 " ") oldobjs=$obj ;;
9591 *[\ /]"$objbase "*)
9592 while :; do
9593 # Make sure we don't pick an alternate name that also
9594 # overlaps.
9595 newobj=lt$counter-$objbase
9596 func_arith $counter + 1
9597 counter=$func_arith_result
9598 case " $oldobjs " in
9599 *[\ /]"$newobj "*) ;;
9600 *) if test ! -f "$gentop/$newobj"; then break; fi ;;
9601 esac
9602 done
9603 func_show_eval "ln $obj $gentop/$newobj || cp $obj $gentop/$newobj"
cristyda16f162011-02-19 23:52:17 +00009604 oldobjs+=" $gentop/$newobj"
cristy3ed852e2009-09-05 21:47:34 +00009605 ;;
cristyda16f162011-02-19 23:52:17 +00009606 *) oldobjs+=" $obj" ;;
cristy3ed852e2009-09-05 21:47:34 +00009607 esac
9608 done
9609 fi
cristy2542fc62011-12-06 17:50:25 +00009610 func_to_tool_file "$oldlib" func_convert_file_msys_to_w32
9611 tool_oldlib=$func_to_tool_file_result
cristy3ed852e2009-09-05 21:47:34 +00009612 eval cmds=\"$old_archive_cmds\"
9613
9614 func_len " $cmds"
9615 len=$func_len_result
9616 if test "$len" -lt "$max_cmd_len" || test "$max_cmd_len" -le -1; then
9617 cmds=$old_archive_cmds
cristyda16f162011-02-19 23:52:17 +00009618 elif test -n "$archiver_list_spec"; then
9619 func_verbose "using command file archive linking..."
9620 for obj in $oldobjs
9621 do
9622 func_to_tool_file "$obj"
9623 $ECHO "$func_to_tool_file_result"
9624 done > $output_objdir/$libname.libcmd
9625 func_to_tool_file "$output_objdir/$libname.libcmd"
9626 oldobjs=" $archiver_list_spec$func_to_tool_file_result"
9627 cmds=$old_archive_cmds
cristy3ed852e2009-09-05 21:47:34 +00009628 else
9629 # the command line is too long to link in one step, link in parts
9630 func_verbose "using piecewise archive linking..."
9631 save_RANLIB=$RANLIB
9632 RANLIB=:
9633 objlist=
9634 concat_cmds=
9635 save_oldobjs=$oldobjs
9636 oldobjs=
9637 # Is there a better way of finding the last object in the list?
9638 for obj in $save_oldobjs
9639 do
9640 last_oldobj=$obj
9641 done
9642 eval test_cmds=\"$old_archive_cmds\"
9643 func_len " $test_cmds"
9644 len0=$func_len_result
9645 len=$len0
9646 for obj in $save_oldobjs
9647 do
9648 func_len " $obj"
9649 func_arith $len + $func_len_result
9650 len=$func_arith_result
cristyda16f162011-02-19 23:52:17 +00009651 objlist+=" $obj"
cristy3ed852e2009-09-05 21:47:34 +00009652 if test "$len" -lt "$max_cmd_len"; then
9653 :
9654 else
9655 # the above command should be used before it gets too long
9656 oldobjs=$objlist
9657 if test "$obj" = "$last_oldobj" ; then
9658 RANLIB=$save_RANLIB
9659 fi
9660 test -z "$concat_cmds" || concat_cmds=$concat_cmds~
9661 eval concat_cmds=\"\${concat_cmds}$old_archive_cmds\"
9662 objlist=
9663 len=$len0
9664 fi
9665 done
9666 RANLIB=$save_RANLIB
9667 oldobjs=$objlist
9668 if test "X$oldobjs" = "X" ; then
9669 eval cmds=\"\$concat_cmds\"
9670 else
9671 eval cmds=\"\$concat_cmds~\$old_archive_cmds\"
9672 fi
9673 fi
9674 fi
9675 func_execute_cmds "$cmds" 'exit $?'
9676 done
9677
9678 test -n "$generated" && \
9679 func_show_eval "${RM}r$generated"
9680
9681 # Now create the libtool archive.
9682 case $output in
9683 *.la)
9684 old_library=
9685 test "$build_old_libs" = yes && old_library="$libname.$libext"
9686 func_verbose "creating $output"
9687
9688 # Preserve any variables that may affect compiler behavior
9689 for var in $variables_saved_for_relink; do
9690 if eval test -z \"\${$var+set}\"; then
9691 relink_command="{ test -z \"\${$var+set}\" || $lt_unset $var || { $var=; export $var; }; }; $relink_command"
9692 elif eval var_value=\$$var; test -z "$var_value"; then
9693 relink_command="$var=; export $var; $relink_command"
9694 else
9695 func_quote_for_eval "$var_value"
9696 relink_command="$var=$func_quote_for_eval_result; export $var; $relink_command"
9697 fi
9698 done
9699 # Quote the link command for shipping.
9700 relink_command="(cd `pwd`; $SHELL $progpath $preserve_args --mode=relink $libtool_args @inst_prefix_dir@)"
cristy98dddb52010-11-04 00:30:15 +00009701 relink_command=`$ECHO "$relink_command" | $SED "$sed_quote_subst"`
cristy3ed852e2009-09-05 21:47:34 +00009702 if test "$hardcode_automatic" = yes ; then
9703 relink_command=
9704 fi
9705
9706 # Only create the output if not a dry run.
9707 $opt_dry_run || {
9708 for installed in no yes; do
9709 if test "$installed" = yes; then
9710 if test -z "$install_libdir"; then
9711 break
9712 fi
9713 output="$output_objdir/$outputname"i
9714 # Replace all uninstalled libtool libraries with the installed ones
9715 newdependency_libs=
9716 for deplib in $dependency_libs; do
9717 case $deplib in
9718 *.la)
9719 func_basename "$deplib"
9720 name="$func_basename_result"
cristy2542fc62011-12-06 17:50:25 +00009721 func_resolve_sysroot "$deplib"
9722 eval libdir=`${SED} -n -e 's/^libdir=\(.*\)$/\1/p' $func_resolve_sysroot_result`
cristy3ed852e2009-09-05 21:47:34 +00009723 test -z "$libdir" && \
9724 func_fatal_error "\`$deplib' is not a valid libtool archive"
cristyda16f162011-02-19 23:52:17 +00009725 newdependency_libs+=" ${lt_sysroot:+=}$libdir/$name"
cristy3ed852e2009-09-05 21:47:34 +00009726 ;;
cristyda16f162011-02-19 23:52:17 +00009727 -L*)
9728 func_stripname -L '' "$deplib"
9729 func_replace_sysroot "$func_stripname_result"
9730 newdependency_libs+=" -L$func_replace_sysroot_result"
9731 ;;
9732 -R*)
9733 func_stripname -R '' "$deplib"
9734 func_replace_sysroot "$func_stripname_result"
9735 newdependency_libs+=" -R$func_replace_sysroot_result"
9736 ;;
9737 *) newdependency_libs+=" $deplib" ;;
cristy3ed852e2009-09-05 21:47:34 +00009738 esac
9739 done
9740 dependency_libs="$newdependency_libs"
9741 newdlfiles=
9742
9743 for lib in $dlfiles; do
9744 case $lib in
9745 *.la)
9746 func_basename "$lib"
9747 name="$func_basename_result"
9748 eval libdir=`${SED} -n -e 's/^libdir=\(.*\)$/\1/p' $lib`
9749 test -z "$libdir" && \
9750 func_fatal_error "\`$lib' is not a valid libtool archive"
cristyda16f162011-02-19 23:52:17 +00009751 newdlfiles+=" ${lt_sysroot:+=}$libdir/$name"
cristy3ed852e2009-09-05 21:47:34 +00009752 ;;
cristyda16f162011-02-19 23:52:17 +00009753 *) newdlfiles+=" $lib" ;;
cristy3ed852e2009-09-05 21:47:34 +00009754 esac
9755 done
9756 dlfiles="$newdlfiles"
9757 newdlprefiles=
9758 for lib in $dlprefiles; do
9759 case $lib in
9760 *.la)
9761 # Only pass preopened files to the pseudo-archive (for
9762 # eventual linking with the app. that links it) if we
9763 # didn't already link the preopened objects directly into
9764 # the library:
9765 func_basename "$lib"
9766 name="$func_basename_result"
9767 eval libdir=`${SED} -n -e 's/^libdir=\(.*\)$/\1/p' $lib`
9768 test -z "$libdir" && \
9769 func_fatal_error "\`$lib' is not a valid libtool archive"
cristyda16f162011-02-19 23:52:17 +00009770 newdlprefiles+=" ${lt_sysroot:+=}$libdir/$name"
cristy3ed852e2009-09-05 21:47:34 +00009771 ;;
9772 esac
9773 done
9774 dlprefiles="$newdlprefiles"
9775 else
9776 newdlfiles=
9777 for lib in $dlfiles; do
9778 case $lib in
9779 [\\/]* | [A-Za-z]:[\\/]*) abs="$lib" ;;
9780 *) abs=`pwd`"/$lib" ;;
9781 esac
cristyda16f162011-02-19 23:52:17 +00009782 newdlfiles+=" $abs"
cristy3ed852e2009-09-05 21:47:34 +00009783 done
9784 dlfiles="$newdlfiles"
9785 newdlprefiles=
9786 for lib in $dlprefiles; do
9787 case $lib in
9788 [\\/]* | [A-Za-z]:[\\/]*) abs="$lib" ;;
9789 *) abs=`pwd`"/$lib" ;;
9790 esac
cristyda16f162011-02-19 23:52:17 +00009791 newdlprefiles+=" $abs"
cristy3ed852e2009-09-05 21:47:34 +00009792 done
9793 dlprefiles="$newdlprefiles"
9794 fi
9795 $RM $output
9796 # place dlname in correct position for cygwin
cristy98dddb52010-11-04 00:30:15 +00009797 # In fact, it would be nice if we could use this code for all target
9798 # systems that can't hard-code library paths into their executables
9799 # and that have no shared library path variable independent of PATH,
9800 # but it turns out we can't easily determine that from inspecting
9801 # libtool variables, so we have to hard-code the OSs to which it
9802 # applies here; at the moment, that means platforms that use the PE
9803 # object format with DLL files. See the long comment at the top of
9804 # tests/bindir.at for full details.
cristy3ed852e2009-09-05 21:47:34 +00009805 tdlname=$dlname
9806 case $host,$output,$installed,$module,$dlname in
cristy98dddb52010-11-04 00:30:15 +00009807 *cygwin*,*lai,yes,no,*.dll | *mingw*,*lai,yes,no,*.dll | *cegcc*,*lai,yes,no,*.dll)
9808 # If a -bindir argument was supplied, place the dll there.
9809 if test "x$bindir" != x ;
9810 then
9811 func_relative_path "$install_libdir" "$bindir"
9812 tdlname=$func_relative_path_result$dlname
9813 else
9814 # Otherwise fall back on heuristic.
9815 tdlname=../bin/$dlname
9816 fi
9817 ;;
cristy3ed852e2009-09-05 21:47:34 +00009818 esac
9819 $ECHO > $output "\
9820# $outputname - a libtool library file
9821# Generated by $PROGRAM (GNU $PACKAGE$TIMESTAMP) $VERSION
9822#
9823# Please DO NOT delete this file!
9824# It is necessary for linking the library.
9825
9826# The name that we can dlopen(3).
9827dlname='$tdlname'
9828
9829# Names of this library.
9830library_names='$library_names'
9831
9832# The name of the static archive.
9833old_library='$old_library'
9834
9835# Linker flags that can not go in dependency_libs.
9836inherited_linker_flags='$new_inherited_linker_flags'
9837
9838# Libraries that this one depends upon.
9839dependency_libs='$dependency_libs'
9840
9841# Names of additional weak libraries provided by this library
9842weak_library_names='$weak_libs'
9843
9844# Version information for $libname.
9845current=$current
9846age=$age
9847revision=$revision
9848
9849# Is this an already installed library?
9850installed=$installed
9851
9852# Should we warn about portability when linking against -modules?
9853shouldnotlink=$module
9854
9855# Files to dlopen/dlpreopen
9856dlopen='$dlfiles'
9857dlpreopen='$dlprefiles'
9858
9859# Directory that this library needs to be installed in:
9860libdir='$install_libdir'"
9861 if test "$installed" = no && test "$need_relink" = yes; then
9862 $ECHO >> $output "\
9863relink_command=\"$relink_command\""
9864 fi
9865 done
9866 }
9867
9868 # Do a symbolic link so that the libtool archive can be found in
9869 # LD_LIBRARY_PATH before the program is installed.
9870 func_show_eval '( cd "$output_objdir" && $RM "$outputname" && $LN_S "../$outputname" "$outputname" )' 'exit $?'
9871 ;;
9872 esac
9873 exit $EXIT_SUCCESS
9874}
9875
cristyda16f162011-02-19 23:52:17 +00009876{ test "$opt_mode" = link || test "$opt_mode" = relink; } &&
cristy3ed852e2009-09-05 21:47:34 +00009877 func_mode_link ${1+"$@"}
9878
9879
9880# func_mode_uninstall arg...
9881func_mode_uninstall ()
9882{
9883 $opt_debug
9884 RM="$nonopt"
9885 files=
9886 rmforce=
9887 exit_status=0
9888
9889 # This variable tells wrapper scripts just to set variables rather
9890 # than running their programs.
9891 libtool_install_magic="$magic"
9892
9893 for arg
9894 do
9895 case $arg in
cristyda16f162011-02-19 23:52:17 +00009896 -f) RM+=" $arg"; rmforce=yes ;;
9897 -*) RM+=" $arg" ;;
9898 *) files+=" $arg" ;;
cristy3ed852e2009-09-05 21:47:34 +00009899 esac
9900 done
9901
9902 test -z "$RM" && \
9903 func_fatal_help "you must specify an RM program"
9904
9905 rmdirs=
9906
cristy3ed852e2009-09-05 21:47:34 +00009907 for file in $files; do
9908 func_dirname "$file" "" "."
9909 dir="$func_dirname_result"
9910 if test "X$dir" = X.; then
cristyda16f162011-02-19 23:52:17 +00009911 odir="$objdir"
cristy3ed852e2009-09-05 21:47:34 +00009912 else
cristyda16f162011-02-19 23:52:17 +00009913 odir="$dir/$objdir"
cristy3ed852e2009-09-05 21:47:34 +00009914 fi
9915 func_basename "$file"
9916 name="$func_basename_result"
cristyda16f162011-02-19 23:52:17 +00009917 test "$opt_mode" = uninstall && odir="$dir"
cristy3ed852e2009-09-05 21:47:34 +00009918
cristyda16f162011-02-19 23:52:17 +00009919 # Remember odir for removal later, being careful to avoid duplicates
9920 if test "$opt_mode" = clean; then
cristy3ed852e2009-09-05 21:47:34 +00009921 case " $rmdirs " in
cristyda16f162011-02-19 23:52:17 +00009922 *" $odir "*) ;;
9923 *) rmdirs+=" $odir" ;;
cristy3ed852e2009-09-05 21:47:34 +00009924 esac
9925 fi
9926
9927 # Don't error if the file doesn't exist and rm -f was used.
9928 if { test -L "$file"; } >/dev/null 2>&1 ||
9929 { test -h "$file"; } >/dev/null 2>&1 ||
9930 test -f "$file"; then
9931 :
9932 elif test -d "$file"; then
9933 exit_status=1
9934 continue
9935 elif test "$rmforce" = yes; then
9936 continue
9937 fi
9938
9939 rmfiles="$file"
9940
9941 case $name in
9942 *.la)
9943 # Possibly a libtool archive, so verify it.
9944 if func_lalib_p "$file"; then
9945 func_source $dir/$name
9946
9947 # Delete the libtool libraries and symlinks.
9948 for n in $library_names; do
cristyda16f162011-02-19 23:52:17 +00009949 rmfiles+=" $odir/$n"
cristy3ed852e2009-09-05 21:47:34 +00009950 done
cristyda16f162011-02-19 23:52:17 +00009951 test -n "$old_library" && rmfiles+=" $odir/$old_library"
cristy3ed852e2009-09-05 21:47:34 +00009952
cristyda16f162011-02-19 23:52:17 +00009953 case "$opt_mode" in
cristy3ed852e2009-09-05 21:47:34 +00009954 clean)
cristyda16f162011-02-19 23:52:17 +00009955 case " $library_names " in
cristy3ed852e2009-09-05 21:47:34 +00009956 *" $dlname "*) ;;
cristyda16f162011-02-19 23:52:17 +00009957 *) test -n "$dlname" && rmfiles+=" $odir/$dlname" ;;
cristy3ed852e2009-09-05 21:47:34 +00009958 esac
cristyda16f162011-02-19 23:52:17 +00009959 test -n "$libdir" && rmfiles+=" $odir/$name $odir/${name}i"
cristy3ed852e2009-09-05 21:47:34 +00009960 ;;
9961 uninstall)
9962 if test -n "$library_names"; then
9963 # Do each command in the postuninstall commands.
9964 func_execute_cmds "$postuninstall_cmds" 'test "$rmforce" = yes || exit_status=1'
9965 fi
9966
9967 if test -n "$old_library"; then
9968 # Do each command in the old_postuninstall commands.
9969 func_execute_cmds "$old_postuninstall_cmds" 'test "$rmforce" = yes || exit_status=1'
9970 fi
9971 # FIXME: should reinstall the best remaining shared library.
9972 ;;
9973 esac
9974 fi
9975 ;;
9976
9977 *.lo)
9978 # Possibly a libtool object, so verify it.
9979 if func_lalib_p "$file"; then
9980
9981 # Read the .lo file
9982 func_source $dir/$name
9983
9984 # Add PIC object to the list of files to remove.
9985 if test -n "$pic_object" &&
9986 test "$pic_object" != none; then
cristyda16f162011-02-19 23:52:17 +00009987 rmfiles+=" $dir/$pic_object"
cristy3ed852e2009-09-05 21:47:34 +00009988 fi
9989
9990 # Add non-PIC object to the list of files to remove.
9991 if test -n "$non_pic_object" &&
9992 test "$non_pic_object" != none; then
cristyda16f162011-02-19 23:52:17 +00009993 rmfiles+=" $dir/$non_pic_object"
cristy3ed852e2009-09-05 21:47:34 +00009994 fi
9995 fi
9996 ;;
9997
9998 *)
cristyda16f162011-02-19 23:52:17 +00009999 if test "$opt_mode" = clean ; then
cristy3ed852e2009-09-05 21:47:34 +000010000 noexename=$name
10001 case $file in
10002 *.exe)
10003 func_stripname '' '.exe' "$file"
10004 file=$func_stripname_result
10005 func_stripname '' '.exe' "$name"
10006 noexename=$func_stripname_result
10007 # $file with .exe has already been added to rmfiles,
10008 # add $file without .exe
cristyda16f162011-02-19 23:52:17 +000010009 rmfiles+=" $file"
cristy3ed852e2009-09-05 21:47:34 +000010010 ;;
10011 esac
10012 # Do a test to see if this is a libtool program.
10013 if func_ltwrapper_p "$file"; then
10014 if func_ltwrapper_executable_p "$file"; then
10015 func_ltwrapper_scriptname "$file"
10016 relink_command=
10017 func_source $func_ltwrapper_scriptname_result
cristyda16f162011-02-19 23:52:17 +000010018 rmfiles+=" $func_ltwrapper_scriptname_result"
cristy3ed852e2009-09-05 21:47:34 +000010019 else
10020 relink_command=
10021 func_source $dir/$noexename
10022 fi
10023
10024 # note $name still contains .exe if it was in $file originally
10025 # as does the version of $file that was added into $rmfiles
cristyda16f162011-02-19 23:52:17 +000010026 rmfiles+=" $odir/$name $odir/${name}S.${objext}"
cristy3ed852e2009-09-05 21:47:34 +000010027 if test "$fast_install" = yes && test -n "$relink_command"; then
cristyda16f162011-02-19 23:52:17 +000010028 rmfiles+=" $odir/lt-$name"
cristy3ed852e2009-09-05 21:47:34 +000010029 fi
10030 if test "X$noexename" != "X$name" ; then
cristyda16f162011-02-19 23:52:17 +000010031 rmfiles+=" $odir/lt-${noexename}.c"
cristy3ed852e2009-09-05 21:47:34 +000010032 fi
10033 fi
10034 fi
10035 ;;
10036 esac
10037 func_show_eval "$RM $rmfiles" 'exit_status=1'
10038 done
cristy3ed852e2009-09-05 21:47:34 +000010039
10040 # Try to remove the ${objdir}s in the directories where we deleted files
10041 for dir in $rmdirs; do
10042 if test -d "$dir"; then
10043 func_show_eval "rmdir $dir >/dev/null 2>&1"
10044 fi
10045 done
10046
10047 exit $exit_status
10048}
10049
cristyda16f162011-02-19 23:52:17 +000010050{ test "$opt_mode" = uninstall || test "$opt_mode" = clean; } &&
cristy3ed852e2009-09-05 21:47:34 +000010051 func_mode_uninstall ${1+"$@"}
10052
cristyda16f162011-02-19 23:52:17 +000010053test -z "$opt_mode" && {
cristy3ed852e2009-09-05 21:47:34 +000010054 help="$generic_help"
10055 func_fatal_help "you must specify a MODE"
10056}
10057
10058test -z "$exec_cmd" && \
cristyda16f162011-02-19 23:52:17 +000010059 func_fatal_help "invalid operation mode \`$opt_mode'"
cristy3ed852e2009-09-05 21:47:34 +000010060
10061if test -n "$exec_cmd"; then
10062 eval exec "$exec_cmd"
10063 exit $EXIT_FAILURE
10064fi
10065
10066exit $exit_status
10067
10068
10069# The TAGs below are defined such that we never get into a situation
10070# in which we disable both kinds of libraries. Given conflicting
10071# choices, we go for a static library, that is the most portable,
10072# since we can't tell whether shared libraries were disabled because
10073# the user asked for that or because the platform doesn't support
10074# them. This is particularly important on AIX, because we don't
10075# support having both static and shared libraries enabled at the same
10076# time on that platform, so we default to a shared-only configuration.
10077# If a disable-shared tag is given, we'll fallback to a static-only
10078# configuration. But we'll never go from static-only to shared-only.
10079
10080# ### BEGIN LIBTOOL TAG CONFIG: disable-shared
10081build_libtool_libs=no
10082build_old_libs=yes
10083# ### END LIBTOOL TAG CONFIG: disable-shared
10084
10085# ### BEGIN LIBTOOL TAG CONFIG: disable-static
10086build_old_libs=`case $build_libtool_libs in yes) echo no;; *) echo yes;; esac`
10087# ### END LIBTOOL TAG CONFIG: disable-static
10088
10089# Local Variables:
10090# mode:shell-script
10091# sh-indentation:2
10092# End:
10093# vi:sw=2
10094
10095
10096# ### BEGIN LIBTOOL TAG CONFIG: CXX
10097
10098# The linker used to build libraries.
nicolas6237c462010-10-05 06:11:49 +000010099LD="/usr/bin/ld -m elf_x86_64"
cristy3ed852e2009-09-05 21:47:34 +000010100
cristy0c60a692010-11-04 01:09:47 +000010101# How to create reloadable object files.
10102reload_flag=" -r"
10103reload_cmds="\$LD\$reload_flag -o \$output\$reload_objs"
10104
cristy3ed852e2009-09-05 21:47:34 +000010105# Commands used to build an old-style archive.
cristy99bd5232011-12-07 14:38:20 +000010106old_archive_cmds="\$AR \$AR_FLAGS \$oldlib\$oldobjs~\$RANLIB \$tool_oldlib"
cristy3ed852e2009-09-05 21:47:34 +000010107
10108# A language specific compiler.
nicolas6237c462010-10-05 06:11:49 +000010109CC="g++"
cristy3ed852e2009-09-05 21:47:34 +000010110
10111# Is the compiler the GNU compiler?
nicolas6237c462010-10-05 06:11:49 +000010112with_gcc=yes
cristy3ed852e2009-09-05 21:47:34 +000010113
10114# Compiler flag to turn off builtin functions.
nicolas6237c462010-10-05 06:11:49 +000010115no_builtin_flag=" -fno-builtin"
cristy3ed852e2009-09-05 21:47:34 +000010116
cristy3ed852e2009-09-05 21:47:34 +000010117# Additional compiler flags for building library objects.
nicolas6237c462010-10-05 06:11:49 +000010118pic_flag=" -fPIC -DPIC"
cristy3ed852e2009-09-05 21:47:34 +000010119
cristyda16f162011-02-19 23:52:17 +000010120# How to pass a linker flag through the compiler.
10121wl="-Wl,"
10122
cristy3ed852e2009-09-05 21:47:34 +000010123# Compiler flag to prevent dynamic linking.
cristyae56d442011-05-10 21:10:20 +000010124link_static_flag=""
cristy3ed852e2009-09-05 21:47:34 +000010125
10126# Does compiler simultaneously support -c and -o options?
nicolas6237c462010-10-05 06:11:49 +000010127compiler_c_o="yes"
cristy3ed852e2009-09-05 21:47:34 +000010128
10129# Whether or not to add -lc for building shared libraries.
10130build_libtool_need_lc=no
10131
10132# Whether or not to disallow shared libs when runtime libs are static.
10133allow_libtool_libs_with_static_runtimes=no
10134
10135# Compiler flag to allow reflexive dlopens.
nicolas6237c462010-10-05 06:11:49 +000010136export_dynamic_flag_spec="\${wl}--export-dynamic"
cristy3ed852e2009-09-05 21:47:34 +000010137
10138# Compiler flag to generate shared objects directly from archives.
nicolas6237c462010-10-05 06:11:49 +000010139whole_archive_flag_spec="\${wl}--whole-archive\$convenience \${wl}--no-whole-archive"
cristy3ed852e2009-09-05 21:47:34 +000010140
10141# Whether the compiler copes with passing no objects directly.
10142compiler_needs_object="no"
10143
10144# Create an old-style archive from a shared archive.
10145old_archive_from_new_cmds=""
10146
10147# Create a temporary old-style archive to link instead of a shared archive.
10148old_archive_from_expsyms_cmds=""
10149
10150# Commands used to build a shared archive.
cristyda16f162011-02-19 23:52:17 +000010151archive_cmds="\$CC \$pic_flag -shared -nostdlib \$predep_objects \$libobjs \$deplibs \$postdep_objects \$compiler_flags \${wl}-soname \$wl\$soname -o \$lib"
10152archive_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"
cristy3ed852e2009-09-05 21:47:34 +000010153
10154# Commands used to build a loadable module if different from building
10155# a shared archive.
10156module_cmds=""
10157module_expsym_cmds=""
10158
10159# Whether we are building with GNU ld or not.
nicolas6237c462010-10-05 06:11:49 +000010160with_gnu_ld="yes"
cristy3ed852e2009-09-05 21:47:34 +000010161
10162# Flag that allows shared libraries with undefined symbols to be built.
10163allow_undefined_flag=""
10164
10165# Flag that enforces no undefined symbols.
10166no_undefined_flag=""
10167
10168# Flag to hardcode $libdir into a binary during linking.
10169# This must work even if $libdir does not exist
nicolas6237c462010-10-05 06:11:49 +000010170hardcode_libdir_flag_spec="\${wl}-rpath \${wl}\$libdir"
cristy3ed852e2009-09-05 21:47:34 +000010171
cristy3ed852e2009-09-05 21:47:34 +000010172# Whether we need a single "-rpath" flag with a separated argument.
10173hardcode_libdir_separator=""
10174
10175# Set to "yes" if using DIR/libNAME${shared_ext} during linking hardcodes
10176# DIR into the resulting binary.
10177hardcode_direct=no
10178
10179# Set to "yes" if using DIR/libNAME${shared_ext} during linking hardcodes
10180# DIR into the resulting binary and the resulting library dependency is
10181# "absolute",i.e impossible to change by setting ${shlibpath_var} if the
10182# library is relocated.
10183hardcode_direct_absolute=no
10184
10185# Set to "yes" if using the -LDIR flag during linking hardcodes DIR
10186# into the resulting binary.
10187hardcode_minus_L=no
10188
10189# Set to "yes" if using SHLIBPATH_VAR=DIR during linking hardcodes DIR
10190# into the resulting binary.
10191hardcode_shlibpath_var=unsupported
10192
10193# Set to "yes" if building a shared library automatically hardcodes DIR
10194# into the library and all subsequent libraries and executables linked
10195# against it.
10196hardcode_automatic=no
10197
10198# Set to yes if linker adds runtime paths of dependent libraries
10199# to runtime path list.
10200inherit_rpath=no
10201
10202# Whether libtool must link a program against all its dependency libraries.
10203link_all_deplibs=unknown
10204
cristy3ed852e2009-09-05 21:47:34 +000010205# Set to "yes" if exported symbols are required.
10206always_export_symbols=no
10207
10208# The commands to list exported symbols.
nicolas6237c462010-10-05 06:11:49 +000010209export_symbols_cmds="\$NM \$libobjs \$convenience | \$global_symbol_pipe | \$SED 's/.* //' | sort | uniq > \$export_symbols"
cristy3ed852e2009-09-05 21:47:34 +000010210
10211# Symbols that should not be listed in the preloaded symbols.
nicolas6237c462010-10-05 06:11:49 +000010212exclude_expsyms="_GLOBAL_OFFSET_TABLE_|_GLOBAL__F[ID]_.*"
cristy3ed852e2009-09-05 21:47:34 +000010213
10214# Symbols that must always be exported.
10215include_expsyms=""
10216
10217# Commands necessary for linking programs (against libraries) with templates.
10218prelink_cmds=""
10219
cristyda16f162011-02-19 23:52:17 +000010220# Commands necessary for finishing linking programs.
10221postlink_cmds=""
10222
cristy3ed852e2009-09-05 21:47:34 +000010223# Specify filename containing input files.
10224file_list_spec=""
10225
10226# How to hardcode a shared library path into an executable.
nicolas6237c462010-10-05 06:11:49 +000010227hardcode_action=immediate
cristy3ed852e2009-09-05 21:47:34 +000010228
10229# The directories searched by this compiler when creating a shared library.
cristy84d09e22012-01-11 20:17:27 +000010230compiler_lib_search_dirs="/usr/lib/gcc/x86_64-redhat-linux/4.7.0 /usr/lib/gcc/x86_64-redhat-linux/4.7.0/../../../../lib64 /lib/../lib64 /usr/lib/../lib64 /usr/lib/gcc/x86_64-redhat-linux/4.7.0/../../.."
cristy3ed852e2009-09-05 21:47:34 +000010231
10232# Dependencies to place before and after the objects being linked to
10233# create a shared library.
cristy84d09e22012-01-11 20:17:27 +000010234predep_objects="/usr/lib/gcc/x86_64-redhat-linux/4.7.0/../../../../lib64/crti.o /usr/lib/gcc/x86_64-redhat-linux/4.7.0/crtbeginS.o"
10235postdep_objects="/usr/lib/gcc/x86_64-redhat-linux/4.7.0/crtendS.o /usr/lib/gcc/x86_64-redhat-linux/4.7.0/../../../../lib64/crtn.o"
cristy3ed852e2009-09-05 21:47:34 +000010236predeps=""
cristyb1860752011-03-14 00:27:46 +000010237postdeps="-lstdc++ -lm -lgcc_s -lpthread -lc -lgcc_s"
cristy3ed852e2009-09-05 21:47:34 +000010238
10239# The library search path used internally by the compiler when linking
10240# a shared library.
cristy84d09e22012-01-11 20:17:27 +000010241compiler_lib_search_path="-L/usr/lib/gcc/x86_64-redhat-linux/4.7.0 -L/usr/lib/gcc/x86_64-redhat-linux/4.7.0/../../../../lib64 -L/lib/../lib64 -L/usr/lib/../lib64 -L/usr/lib/gcc/x86_64-redhat-linux/4.7.0/../../.."
cristy3ed852e2009-09-05 21:47:34 +000010242
10243# ### END LIBTOOL TAG CONFIG: CXX