blob: 440cc861b6a78505a7085ee4470f47618a1d3b2a [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,
cristy0c60a692010-11-04 01:09:47 +00009# 2006, 2007, 2008, 2009, 2010 Free Software Foundation,
10# 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?
cristyda16f162011-02-19 23:52:17 +000064macro_version=2.4
65macro_revision=1.3293
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
88# The host system.
89host_alias=
90host=x86_64-unknown-linux-gnu
91host_os=linux-gnu
92
93# The build system.
94build_alias=
95build=x86_64-unknown-linux-gnu
96build_os=linux-gnu
97
98# A BSD- or MS-compatible name lister.
99NM="/usr/bin/nm -B"
100
101# Whether we need soft or hard links.
102LN_S="ln -s"
103
104# What is the maximum length of a command?
cristy98dddb52010-11-04 00:30:15 +0000105max_cmd_len=1572864
cristy3ed852e2009-09-05 21:47:34 +0000106
107# Object file suffix (normally "o").
108objext=o
109
110# Executable file suffix (normally "").
111exeext=
112
113# whether the shell understands "unset".
114lt_unset=unset
115
116# turn spaces into newlines.
117SP2NL="tr \\040 \\012"
118
119# turn newlines into spaces.
120NL2SP="tr \\015\\012 \\040\\040"
121
cristyda16f162011-02-19 23:52:17 +0000122# convert $build file names to $host format.
123to_host_file_cmd=func_convert_file_noop
124
125# convert $build files to toolchain format.
126to_tool_file_cmd=func_convert_file_noop
127
cristy3ed852e2009-09-05 21:47:34 +0000128# Method to check whether dependent libraries are shared objects.
129deplibs_check_method="pass_all"
130
cristyda16f162011-02-19 23:52:17 +0000131# Command to use when deplibs_check_method = "file_magic".
cristy3ed852e2009-09-05 21:47:34 +0000132file_magic_cmd="\$MAGIC_CMD"
133
cristyda16f162011-02-19 23:52:17 +0000134# How to find potential files when deplibs_check_method = "file_magic".
135file_magic_glob=""
136
137# Find potential files using nocaseglob when deplibs_check_method = "file_magic".
138want_nocaseglob="no"
139
140# Command to associate shared and link libraries.
141sharedlib_from_linklib_cmd="printf %s\\n"
142
cristy3ed852e2009-09-05 21:47:34 +0000143# The archiver.
144AR="ar"
cristyda16f162011-02-19 23:52:17 +0000145
146# Flags to create an archive.
cristy3ed852e2009-09-05 21:47:34 +0000147AR_FLAGS="cru"
148
cristyda16f162011-02-19 23:52:17 +0000149# How to feed a file listing to the archiver.
150archiver_list_spec="@"
151
cristy3ed852e2009-09-05 21:47:34 +0000152# A symbol stripping program.
153STRIP="strip"
154
155# Commands used to install an old-style archive.
156RANLIB="ranlib"
157old_postinstall_cmds="chmod 644 \$oldlib~\$RANLIB \$oldlib"
158old_postuninstall_cmds=""
159
cristy0c60a692010-11-04 01:09:47 +0000160# Whether to use a lock for old archive extraction.
161lock_old_archive_extraction=no
162
cristy3ed852e2009-09-05 21:47:34 +0000163# A C compiler.
cristy439c4df2011-05-25 23:05:49 +0000164LTCC="gcc -std=gnu99 -std=gnu99"
cristy3ed852e2009-09-05 21:47:34 +0000165
166# LTCC compiler flags.
cristya940a8e2011-10-15 23:37:40 +0000167LTCFLAGS="-fopenmp -g -O2 -Wall -pthread"
cristy3ed852e2009-09-05 21:47:34 +0000168
169# Take the output of nm and produce a listing of raw symbols and C names.
cristyda16f162011-02-19 23:52:17 +0000170global_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 +0000171
172# Transform the output of nm in a proper C declaration.
173global_symbol_to_cdecl="sed -n -e 's/^T .* \\(.*\\)\$/extern int \\1();/p' -e 's/^[ABCDGIRSTW]* .* \\(.*\\)\$/extern char \\1;/p'"
174
175# Transform the output of nm in a C name address pair.
cristyda16f162011-02-19 23:52:17 +0000176global_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 +0000177
178# Transform the output of nm in a C name address pair when lib prefix is needed.
cristyda16f162011-02-19 23:52:17 +0000179global_symbol_to_c_name_address_lib_prefix="sed -n -e 's/^: \\([^ ]*\\)[ ]*\$/ {\\\"\\1\\\", (void *) 0},/p' -e 's/^[ABCDGIRSTW]* \\([^ ]*\\) \\(lib[^ ]*\\)\$/ {\"\\2\", (void *) \\&\\2},/p' -e 's/^[ABCDGIRSTW]* \\([^ ]*\\) \\([^ ]*\\)\$/ {\"lib\\2\", (void *) \\&\\2},/p'"
180
181# Specify filename containing input files for $NM.
182nm_file_list_spec="@"
183
184# The root where to search for dependent libraries,and in which our libraries should be installed.
185lt_sysroot=
cristy3ed852e2009-09-05 21:47:34 +0000186
187# The name of the directory that contains temporary libtool files.
188objdir=.libs
189
cristy3ed852e2009-09-05 21:47:34 +0000190# Used to examine libraries when file_magic_cmd begins with "file".
191MAGIC_CMD=file
192
193# Must we lock files when doing compilation?
194need_locks="no"
195
cristyda16f162011-02-19 23:52:17 +0000196# Manifest tool.
197MANIFEST_TOOL=":"
198
cristy3ed852e2009-09-05 21:47:34 +0000199# Tool to manipulate archived DWARF debug symbol files on Mac OS X.
200DSYMUTIL=""
201
202# Tool to change global to local symbols on Mac OS X.
203NMEDIT=""
204
205# Tool to manipulate fat objects and archives on Mac OS X.
206LIPO=""
207
208# ldd/readelf like tool for Mach-O binaries on Mac OS X.
209OTOOL=""
210
211# ldd/readelf like tool for 64 bit Mach-O binaries on Mac OS X 10.4.
212OTOOL64=""
213
214# Old archive suffix (normally "a").
215libext=a
216
217# Shared library suffix (normally ".so").
218shrext_cmds=".so"
219
220# The commands to extract the exported symbol list from a shared archive.
221extract_expsyms_cmds=""
222
223# Variables whose values should be saved in libtool wrapper scripts and
224# restored at link time.
225variables_saved_for_relink="PATH LD_LIBRARY_PATH LD_RUN_PATH GCC_EXEC_PREFIX COMPILER_PATH LIBRARY_PATH"
226
227# Do we need the "lib" prefix for modules?
228need_lib_prefix=no
229
230# Do we need a version for libraries?
231need_version=no
232
233# Library versioning type.
234version_type=linux
235
236# Shared library runtime path variable.
237runpath_var=LD_RUN_PATH
238
239# Shared library path variable.
240shlibpath_var=LD_LIBRARY_PATH
241
242# Is shlibpath searched before the hard-coded library search path?
243shlibpath_overrides_runpath=no
244
245# Format of library name prefix.
246libname_spec="lib\$name"
247
248# List of archive names. First name is the real one, the rest are links.
249# The last name is the one that the linker finds with -lNAME
250library_names_spec="\${libname}\${release}\${shared_ext}\$versuffix \${libname}\${release}\${shared_ext}\$major \$libname\${shared_ext}"
251
252# The coded name of the library, if different from the real name.
253soname_spec="\${libname}\${release}\${shared_ext}\$major"
254
cristy0c60a692010-11-04 01:09:47 +0000255# Permission mode override for installation of shared libraries.
256install_override_mode=""
257
cristy3ed852e2009-09-05 21:47:34 +0000258# Command to use after installation of a shared archive.
259postinstall_cmds=""
260
261# Command to use after uninstallation of a shared archive.
262postuninstall_cmds=""
263
264# Commands used to finish a libtool library installation in a directory.
265finish_cmds="PATH=\\\"\\\$PATH:/sbin\\\" ldconfig -n \$libdir"
266
267# As "finish_cmds", except a single script fragment to be evaled but
268# not shown.
269finish_eval=""
270
271# Whether we should hardcode library paths into libraries.
272hardcode_into_libs=yes
273
274# Compile-time system search path for libraries.
cristya44f6232011-10-30 00:20:44 +0000275sys_lib_search_path_spec="/usr/lib/gcc/x86_64-redhat-linux/4.6.2 /usr/lib64 /lib64 "
cristy3ed852e2009-09-05 21:47:34 +0000276
277# Run-time system search path for libraries.
cristy987feef2011-11-17 12:24:56 +0000278sys_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 +0000279
280# Whether dlopen is supported.
281dlopen_support=yes
282
283# Whether dlopen of programs is supported.
cristy439c4df2011-05-25 23:05:49 +0000284dlopen_self=yes
cristy3ed852e2009-09-05 21:47:34 +0000285
286# Whether dlopen of statically linked programs is supported.
cristy439c4df2011-05-25 23:05:49 +0000287dlopen_self_static=yes
cristy3ed852e2009-09-05 21:47:34 +0000288
289# Commands to strip libraries.
290old_striplib="strip --strip-debug"
291striplib="strip --strip-unneeded"
292
293
294# The linker used to build libraries.
295LD="/usr/bin/ld -m elf_x86_64"
296
cristy0c60a692010-11-04 01:09:47 +0000297# How to create reloadable object files.
298reload_flag=" -r"
299reload_cmds="\$LD\$reload_flag -o \$output\$reload_objs"
300
cristy3ed852e2009-09-05 21:47:34 +0000301# Commands used to build an old-style archive.
302old_archive_cmds="\$AR \$AR_FLAGS \$oldlib\$oldobjs~\$RANLIB \$oldlib"
303
304# A language specific compiler.
cristy439c4df2011-05-25 23:05:49 +0000305CC="gcc -std=gnu99 -std=gnu99"
cristy3ed852e2009-09-05 21:47:34 +0000306
307# Is the compiler the GNU compiler?
308with_gcc=yes
309
310# Compiler flag to turn off builtin functions.
cristy439c4df2011-05-25 23:05:49 +0000311no_builtin_flag=" -fno-builtin"
cristy3ed852e2009-09-05 21:47:34 +0000312
cristy3ed852e2009-09-05 21:47:34 +0000313# Additional compiler flags for building library objects.
314pic_flag=" -fPIC -DPIC"
315
cristyda16f162011-02-19 23:52:17 +0000316# How to pass a linker flag through the compiler.
317wl="-Wl,"
318
cristy3ed852e2009-09-05 21:47:34 +0000319# Compiler flag to prevent dynamic linking.
cristyae56d442011-05-10 21:10:20 +0000320link_static_flag=""
cristy3ed852e2009-09-05 21:47:34 +0000321
322# Does compiler simultaneously support -c and -o options?
323compiler_c_o="yes"
324
325# Whether or not to add -lc for building shared libraries.
cristybd4fb6e2011-10-26 13:10:01 +0000326build_libtool_need_lc=no
cristy3ed852e2009-09-05 21:47:34 +0000327
328# Whether or not to disallow shared libs when runtime libs are static.
329allow_libtool_libs_with_static_runtimes=no
330
331# Compiler flag to allow reflexive dlopens.
332export_dynamic_flag_spec="\${wl}--export-dynamic"
333
334# Compiler flag to generate shared objects directly from archives.
335whole_archive_flag_spec="\${wl}--whole-archive\$convenience \${wl}--no-whole-archive"
336
337# Whether the compiler copes with passing no objects directly.
338compiler_needs_object="no"
339
340# Create an old-style archive from a shared archive.
341old_archive_from_new_cmds=""
342
343# Create a temporary old-style archive to link instead of a shared archive.
344old_archive_from_expsyms_cmds=""
345
346# Commands used to build a shared archive.
cristyda16f162011-02-19 23:52:17 +0000347archive_cmds="\$CC -shared \$pic_flag \$libobjs \$deplibs \$compiler_flags \${wl}-soname \$wl\$soname -o \$lib"
cristy3ed852e2009-09-05 21:47:34 +0000348archive_expsym_cmds="echo \\\"{ global:\\\" > \$output_objdir/\$libname.ver~
349 cat \$export_symbols | sed -e \\\"s/\\\\(.*\\\\)/\\\\1;/\\\" >> \$output_objdir/\$libname.ver~
350 echo \\\"local: *; };\\\" >> \$output_objdir/\$libname.ver~
cristyda16f162011-02-19 23:52:17 +0000351 \$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 +0000352
353# Commands used to build a loadable module if different from building
354# a shared archive.
355module_cmds=""
356module_expsym_cmds=""
357
358# Whether we are building with GNU ld or not.
359with_gnu_ld="yes"
360
361# Flag that allows shared libraries with undefined symbols to be built.
362allow_undefined_flag=""
363
364# Flag that enforces no undefined symbols.
365no_undefined_flag=""
366
367# Flag to hardcode $libdir into a binary during linking.
368# This must work even if $libdir does not exist
369hardcode_libdir_flag_spec="\${wl}-rpath \${wl}\$libdir"
370
371# If ld is used when linking, flag to hardcode $libdir into a binary
372# during linking. This must work even if $libdir does not exist.
373hardcode_libdir_flag_spec_ld=""
374
375# Whether we need a single "-rpath" flag with a separated argument.
376hardcode_libdir_separator=""
377
378# Set to "yes" if using DIR/libNAME${shared_ext} during linking hardcodes
379# DIR into the resulting binary.
380hardcode_direct=no
381
382# Set to "yes" if using DIR/libNAME${shared_ext} during linking hardcodes
383# DIR into the resulting binary and the resulting library dependency is
384# "absolute",i.e impossible to change by setting ${shlibpath_var} if the
385# library is relocated.
386hardcode_direct_absolute=no
387
388# Set to "yes" if using the -LDIR flag during linking hardcodes DIR
389# into the resulting binary.
390hardcode_minus_L=no
391
392# Set to "yes" if using SHLIBPATH_VAR=DIR during linking hardcodes DIR
393# into the resulting binary.
394hardcode_shlibpath_var=unsupported
395
396# Set to "yes" if building a shared library automatically hardcodes DIR
397# into the library and all subsequent libraries and executables linked
398# against it.
399hardcode_automatic=no
400
401# Set to yes if linker adds runtime paths of dependent libraries
402# to runtime path list.
403inherit_rpath=no
404
405# Whether libtool must link a program against all its dependency libraries.
406link_all_deplibs=unknown
407
cristy3ed852e2009-09-05 21:47:34 +0000408# Set to "yes" if exported symbols are required.
409always_export_symbols=no
410
411# The commands to list exported symbols.
412export_symbols_cmds="\$NM \$libobjs \$convenience | \$global_symbol_pipe | \$SED 's/.* //' | sort | uniq > \$export_symbols"
413
414# Symbols that should not be listed in the preloaded symbols.
415exclude_expsyms="_GLOBAL_OFFSET_TABLE_|_GLOBAL__F[ID]_.*"
416
417# Symbols that must always be exported.
418include_expsyms=""
419
420# Commands necessary for linking programs (against libraries) with templates.
421prelink_cmds=""
422
cristyda16f162011-02-19 23:52:17 +0000423# Commands necessary for finishing linking programs.
424postlink_cmds=""
425
cristy3ed852e2009-09-05 21:47:34 +0000426# Specify filename containing input files.
427file_list_spec=""
428
429# How to hardcode a shared library path into an executable.
430hardcode_action=immediate
431
432# The directories searched by this compiler when creating a shared library.
433compiler_lib_search_dirs=""
434
435# Dependencies to place before and after the objects being linked to
436# create a shared library.
437predep_objects=""
438postdep_objects=""
439predeps=""
440postdeps=""
441
442# The library search path used internally by the compiler when linking
443# a shared library.
444compiler_lib_search_path=""
445
446# ### END LIBTOOL CONFIG
447
cristy3ed852e2009-09-05 21:47:34 +0000448
cristy2542fc62011-12-06 17:50:25 +0000449# libtool (GNU libtool) 2.4.2
cristy3ed852e2009-09-05 21:47:34 +0000450# Written by Gordon Matzigkeit <gord@gnu.ai.mit.edu>, 1996
451
cristy98dddb52010-11-04 00:30:15 +0000452# Copyright (C) 1996, 1997, 1998, 1999, 2000, 2001, 2003, 2004, 2005, 2006,
cristy2542fc62011-12-06 17:50:25 +0000453# 2007, 2008, 2009, 2010, 2011 Free Software Foundation, Inc.
cristy3ed852e2009-09-05 21:47:34 +0000454# This is free software; see the source for copying conditions. There is NO
455# warranty; not even for MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
456
457# GNU Libtool is free software; you can redistribute it and/or modify
458# it under the terms of the GNU General Public License as published by
459# the Free Software Foundation; either version 2 of the License, or
460# (at your option) any later version.
461#
462# As a special exception to the GNU General Public License,
463# if you distribute this file as part of a program or library that
464# is built using GNU Libtool, you may include this file under the
465# same distribution terms that you use for the rest of that program.
466#
467# GNU Libtool is distributed in the hope that it will be useful, but
468# WITHOUT ANY WARRANTY; without even the implied warranty of
469# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
470# General Public License for more details.
471#
472# You should have received a copy of the GNU General Public License
473# along with GNU Libtool; see the file COPYING. If not, a copy
474# can be downloaded from http://www.gnu.org/licenses/gpl.html,
475# or obtained by writing to the Free Software Foundation, Inc.,
476# 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
477
478# Usage: $progname [OPTION]... [MODE-ARG]...
479#
480# Provide generalized library-building support services.
481#
cristy98dddb52010-11-04 00:30:15 +0000482# --config show all configuration variables
483# --debug enable verbose shell tracing
484# -n, --dry-run display commands without modifying any files
485# --features display basic configuration information and exit
486# --mode=MODE use operation mode MODE
487# --preserve-dup-deps don't remove duplicate dependency libraries
488# --quiet, --silent don't print informational messages
489# --no-quiet, --no-silent
490# print informational messages (default)
cristy2542fc62011-12-06 17:50:25 +0000491# --no-warn don't display warning messages
cristy98dddb52010-11-04 00:30:15 +0000492# --tag=TAG use configuration variables from tag TAG
493# -v, --verbose print more informational messages than default
494# --no-verbose don't print the extra informational messages
495# --version print version information
496# -h, --help, --help-all print short, long, or detailed help message
cristy3ed852e2009-09-05 21:47:34 +0000497#
498# MODE must be one of the following:
499#
cristy98dddb52010-11-04 00:30:15 +0000500# clean remove files from the build directory
501# compile compile a source file into a libtool object
502# execute automatically set library path, then run a program
503# finish complete the installation of libtool libraries
504# install install libraries or executables
505# link create a library or an executable
506# uninstall remove libraries from an installed directory
cristy3ed852e2009-09-05 21:47:34 +0000507#
cristy98dddb52010-11-04 00:30:15 +0000508# MODE-ARGS vary depending on the MODE. When passed as first option,
509# `--mode=MODE' may be abbreviated as `MODE' or a unique abbreviation of that.
cristy3ed852e2009-09-05 21:47:34 +0000510# Try `$progname --help --mode=MODE' for a more detailed description of MODE.
511#
512# When reporting a bug, please describe a test case to reproduce it and
513# include the following information:
514#
cristy98dddb52010-11-04 00:30:15 +0000515# host-triplet: $host
516# shell: $SHELL
517# compiler: $LTCC
518# compiler flags: $LTCFLAGS
519# linker: $LD (gnu? $with_gnu_ld)
cristy2542fc62011-12-06 17:50:25 +0000520# $progname: (GNU libtool) 2.4.2
cristy98dddb52010-11-04 00:30:15 +0000521# automake: $automake_version
522# autoconf: $autoconf_version
cristy3ed852e2009-09-05 21:47:34 +0000523#
524# Report bugs to <bug-libtool@gnu.org>.
cristyda16f162011-02-19 23:52:17 +0000525# GNU libtool home page: <http://www.gnu.org/software/libtool/>.
526# General help using GNU software: <http://www.gnu.org/gethelp/>.
cristy3ed852e2009-09-05 21:47:34 +0000527
cristy98dddb52010-11-04 00:30:15 +0000528PROGRAM=libtool
cristy3ed852e2009-09-05 21:47:34 +0000529PACKAGE=libtool
cristy2542fc62011-12-06 17:50:25 +0000530VERSION=2.4.2
cristycd4c5312009-11-22 01:19:08 +0000531TIMESTAMP=""
cristy2542fc62011-12-06 17:50:25 +0000532package_revision=1.3337
cristy3ed852e2009-09-05 21:47:34 +0000533
534# Be Bourne compatible
535if test -n "${ZSH_VERSION+set}" && (emulate sh) >/dev/null 2>&1; then
536 emulate sh
537 NULLCMD=:
538 # Zsh 3.x and 4.x performs word splitting on ${1+"$@"}, which
539 # is contrary to our usage. Disable this feature.
540 alias -g '${1+"$@"}'='"$@"'
541 setopt NO_GLOB_SUBST
542else
543 case `(set -o) 2>/dev/null` in *posix*) set -o posix;; esac
544fi
545BIN_SH=xpg4; export BIN_SH # for Tru64
546DUALCASE=1; export DUALCASE # for MKS sh
547
cristy98dddb52010-11-04 00:30:15 +0000548# A function that is used when there is no print builtin or printf.
549func_fallback_echo ()
550{
551 eval 'cat <<_LTECHO_EOF
552$1
553_LTECHO_EOF'
554}
555
cristy3ed852e2009-09-05 21:47:34 +0000556# NLS nuisances: We save the old values to restore during execute mode.
cristy3ed852e2009-09-05 21:47:34 +0000557lt_user_locale=
558lt_safe_locale=
559for lt_var in LANG LANGUAGE LC_ALL LC_CTYPE LC_COLLATE LC_MESSAGES
560do
561 eval "if test \"\${$lt_var+set}\" = set; then
562 save_$lt_var=\$$lt_var
563 $lt_var=C
564 export $lt_var
565 lt_user_locale=\"$lt_var=\\\$save_\$lt_var; \$lt_user_locale\"
566 lt_safe_locale=\"$lt_var=C; \$lt_safe_locale\"
567 fi"
568done
cristy98dddb52010-11-04 00:30:15 +0000569LC_ALL=C
570LANGUAGE=C
571export LANGUAGE LC_ALL
cristy3ed852e2009-09-05 21:47:34 +0000572
573$lt_unset CDPATH
574
575
cristy98dddb52010-11-04 00:30:15 +0000576# Work around backward compatibility issue on IRIX 6.5. On IRIX 6.4+, sh
577# is ksh but when the shell is invoked as "sh" and the current value of
578# the _XPG environment variable is not equal to 1 (one), the special
579# positional parameter $0, within a function call, is the name of the
580# function.
581progpath="$0"
cristy3ed852e2009-09-05 21:47:34 +0000582
583
584
585: ${CP="cp -f"}
cristy98dddb52010-11-04 00:30:15 +0000586test "${ECHO+set}" = set || ECHO=${as_echo-'printf %s\n'}
cristy3ed852e2009-09-05 21:47:34 +0000587: ${MAKE="make"}
588: ${MKDIR="mkdir"}
589: ${MV="mv -f"}
590: ${RM="rm -f"}
cristy3ed852e2009-09-05 21:47:34 +0000591: ${SHELL="${CONFIG_SHELL-/bin/sh}"}
592: ${Xsed="$SED -e 1s/^X//"}
593
594# Global variables:
595EXIT_SUCCESS=0
596EXIT_FAILURE=1
597EXIT_MISMATCH=63 # $? = 63 is used to indicate version mismatch to missing.
598EXIT_SKIP=77 # $? = 77 is used to indicate a skipped test to automake.
599
600exit_status=$EXIT_SUCCESS
601
602# Make sure IFS has a sensible default
603lt_nl='
604'
605IFS=" $lt_nl"
606
607dirname="s,/[^/]*$,,"
608basename="s,^.*/,,"
609
cristy3ed852e2009-09-05 21:47:34 +0000610# func_dirname file append nondir_replacement
611# Compute the dirname of FILE. If nonempty, add APPEND to the result,
612# otherwise set result to NONDIR_REPLACEMENT.
613func_dirname ()
614{
cristyda16f162011-02-19 23:52:17 +0000615 case ${1} in
616 */*) func_dirname_result="${1%/*}${2}" ;;
617 * ) func_dirname_result="${3}" ;;
618 esac
619} # Extended-shell func_dirname implementation
620
cristy3ed852e2009-09-05 21:47:34 +0000621
622# func_basename file
623func_basename ()
624{
cristyda16f162011-02-19 23:52:17 +0000625 func_basename_result="${1##*/}"
626} # Extended-shell func_basename implementation
627
cristy3ed852e2009-09-05 21:47:34 +0000628
629# func_dirname_and_basename file append nondir_replacement
630# perform func_basename and func_dirname in a single function
631# call:
632# dirname: Compute the dirname of FILE. If nonempty,
633# add APPEND to the result, otherwise set result
634# to NONDIR_REPLACEMENT.
635# value returned in "$func_dirname_result"
636# basename: Compute filename of FILE.
637# value retuned in "$func_basename_result"
638# Implementation must be kept synchronized with func_dirname
639# and func_basename. For efficiency, we do not delegate to
640# those functions but instead duplicate the functionality here.
641func_dirname_and_basename ()
642{
cristyda16f162011-02-19 23:52:17 +0000643 case ${1} in
644 */*) func_dirname_result="${1%/*}${2}" ;;
645 * ) func_dirname_result="${3}" ;;
646 esac
647 func_basename_result="${1##*/}"
648} # Extended-shell func_dirname_and_basename implementation
649
cristy3ed852e2009-09-05 21:47:34 +0000650
651# func_stripname prefix suffix name
652# strip PREFIX and SUFFIX off of NAME.
653# PREFIX and SUFFIX must not contain globbing or regex special
654# characters, hashes, percent signs, but SUFFIX may contain a leading
655# dot (in which case that matches only a dot).
cristyda16f162011-02-19 23:52:17 +0000656# func_strip_suffix prefix name
cristy3ed852e2009-09-05 21:47:34 +0000657func_stripname ()
658{
cristyda16f162011-02-19 23:52:17 +0000659 # pdksh 5.2.14 does not do ${X%$Y} correctly if both X and Y are
660 # positional parameters, so assign one to ordinary parameter first.
661 func_stripname_result=${3}
662 func_stripname_result=${func_stripname_result#"${1}"}
663 func_stripname_result=${func_stripname_result%"${2}"}
664} # Extended-shell func_stripname implementation
cristy3ed852e2009-09-05 21:47:34 +0000665
cristy3ed852e2009-09-05 21:47:34 +0000666
cristy98dddb52010-11-04 00:30:15 +0000667# These SED scripts presuppose an absolute path with a trailing slash.
668pathcar='s,^/\([^/]*\).*$,\1,'
669pathcdr='s,^/[^/]*,,'
670removedotparts=':dotsl
671 s@/\./@/@g
672 t dotsl
673 s,/\.$,/,'
674collapseslashes='s@/\{1,\}@/@g'
675finalslash='s,/*$,/,'
676
677# func_normal_abspath PATH
678# Remove doubled-up and trailing slashes, "." path components,
679# and cancel out any ".." path components in PATH after making
680# it an absolute path.
681# value returned in "$func_normal_abspath_result"
682func_normal_abspath ()
683{
684 # Start from root dir and reassemble the path.
685 func_normal_abspath_result=
686 func_normal_abspath_tpath=$1
687 func_normal_abspath_altnamespace=
688 case $func_normal_abspath_tpath in
689 "")
690 # Empty path, that just means $cwd.
691 func_stripname '' '/' "`pwd`"
692 func_normal_abspath_result=$func_stripname_result
693 return
694 ;;
695 # The next three entries are used to spot a run of precisely
696 # two leading slashes without using negated character classes;
697 # we take advantage of case's first-match behaviour.
698 ///*)
699 # Unusual form of absolute path, do nothing.
700 ;;
701 //*)
702 # Not necessarily an ordinary path; POSIX reserves leading '//'
703 # and for example Cygwin uses it to access remote file shares
704 # over CIFS/SMB, so we conserve a leading double slash if found.
705 func_normal_abspath_altnamespace=/
706 ;;
707 /*)
708 # Absolute path, do nothing.
709 ;;
710 *)
711 # Relative path, prepend $cwd.
712 func_normal_abspath_tpath=`pwd`/$func_normal_abspath_tpath
713 ;;
714 esac
715 # Cancel out all the simple stuff to save iterations. We also want
716 # the path to end with a slash for ease of parsing, so make sure
717 # there is one (and only one) here.
718 func_normal_abspath_tpath=`$ECHO "$func_normal_abspath_tpath" | $SED \
719 -e "$removedotparts" -e "$collapseslashes" -e "$finalslash"`
720 while :; do
721 # Processed it all yet?
722 if test "$func_normal_abspath_tpath" = / ; then
723 # If we ascended to the root using ".." the result may be empty now.
724 if test -z "$func_normal_abspath_result" ; then
725 func_normal_abspath_result=/
726 fi
727 break
728 fi
729 func_normal_abspath_tcomponent=`$ECHO "$func_normal_abspath_tpath" | $SED \
730 -e "$pathcar"`
731 func_normal_abspath_tpath=`$ECHO "$func_normal_abspath_tpath" | $SED \
732 -e "$pathcdr"`
733 # Figure out what to do with it
734 case $func_normal_abspath_tcomponent in
735 "")
736 # Trailing empty path component, ignore it.
737 ;;
738 ..)
739 # Parent dir; strip last assembled component from result.
740 func_dirname "$func_normal_abspath_result"
741 func_normal_abspath_result=$func_dirname_result
742 ;;
743 *)
744 # Actual path component, append it.
745 func_normal_abspath_result=$func_normal_abspath_result/$func_normal_abspath_tcomponent
746 ;;
747 esac
748 done
749 # Restore leading double-slash if one was found on entry.
750 func_normal_abspath_result=$func_normal_abspath_altnamespace$func_normal_abspath_result
751}
752
753# func_relative_path SRCDIR DSTDIR
754# generates a relative path from SRCDIR to DSTDIR, with a trailing
755# slash if non-empty, suitable for immediately appending a filename
756# without needing to append a separator.
757# value returned in "$func_relative_path_result"
758func_relative_path ()
759{
760 func_relative_path_result=
761 func_normal_abspath "$1"
762 func_relative_path_tlibdir=$func_normal_abspath_result
763 func_normal_abspath "$2"
764 func_relative_path_tbindir=$func_normal_abspath_result
765
766 # Ascend the tree starting from libdir
767 while :; do
768 # check if we have found a prefix of bindir
769 case $func_relative_path_tbindir in
770 $func_relative_path_tlibdir)
771 # found an exact match
772 func_relative_path_tcancelled=
773 break
774 ;;
775 $func_relative_path_tlibdir*)
776 # found a matching prefix
777 func_stripname "$func_relative_path_tlibdir" '' "$func_relative_path_tbindir"
778 func_relative_path_tcancelled=$func_stripname_result
779 if test -z "$func_relative_path_result"; then
780 func_relative_path_result=.
781 fi
782 break
783 ;;
784 *)
785 func_dirname $func_relative_path_tlibdir
786 func_relative_path_tlibdir=${func_dirname_result}
787 if test "x$func_relative_path_tlibdir" = x ; then
788 # Have to descend all the way to the root!
789 func_relative_path_result=../$func_relative_path_result
790 func_relative_path_tcancelled=$func_relative_path_tbindir
791 break
792 fi
793 func_relative_path_result=../$func_relative_path_result
794 ;;
795 esac
796 done
797
798 # Now calculate path; take care to avoid doubling-up slashes.
799 func_stripname '' '/' "$func_relative_path_result"
800 func_relative_path_result=$func_stripname_result
801 func_stripname '/' '/' "$func_relative_path_tcancelled"
802 if test "x$func_stripname_result" != x ; then
803 func_relative_path_result=${func_relative_path_result}/${func_stripname_result}
804 fi
805
806 # Normalisation. If bindir is libdir, return empty string,
807 # else relative path ending with a slash; either way, target
808 # file name can be directly appended.
809 if test ! -z "$func_relative_path_result"; then
810 func_stripname './' '' "$func_relative_path_result/"
811 func_relative_path_result=$func_stripname_result
812 fi
813}
cristy3ed852e2009-09-05 21:47:34 +0000814
815# The name of this program:
cristy3ed852e2009-09-05 21:47:34 +0000816func_dirname_and_basename "$progpath"
817progname=$func_basename_result
cristy3ed852e2009-09-05 21:47:34 +0000818
819# Make sure we have an absolute path for reexecution:
820case $progpath in
821 [\\/]*|[A-Za-z]:\\*) ;;
822 *[\\/]*)
823 progdir=$func_dirname_result
824 progdir=`cd "$progdir" && pwd`
825 progpath="$progdir/$progname"
826 ;;
827 *)
828 save_IFS="$IFS"
cristy2542fc62011-12-06 17:50:25 +0000829 IFS=${PATH_SEPARATOR-:}
cristy3ed852e2009-09-05 21:47:34 +0000830 for progdir in $PATH; do
831 IFS="$save_IFS"
832 test -x "$progdir/$progname" && break
833 done
834 IFS="$save_IFS"
835 test -n "$progdir" || progdir=`pwd`
836 progpath="$progdir/$progname"
837 ;;
838esac
839
840# Sed substitution that helps us do robust quoting. It backslashifies
841# metacharacters that are still active within double-quoted strings.
842Xsed="${SED}"' -e 1s/^X//'
843sed_quote_subst='s/\([`"$\\]\)/\\\1/g'
844
845# Same as above, but do not quote variable references.
846double_quote_subst='s/\(["`\\]\)/\\\1/g'
847
cristyda16f162011-02-19 23:52:17 +0000848# Sed substitution that turns a string into a regex matching for the
849# string literally.
850sed_make_literal_regex='s,[].[^$\\*\/],\\&,g'
851
852# Sed substitution that converts a w32 file name or path
853# which contains forward slashes, into one that contains
854# (escaped) backslashes. A very naive implementation.
855lt_sed_naive_backslashify='s|\\\\*|\\|g;s|/|\\|g;s|\\|\\\\|g'
856
cristy3ed852e2009-09-05 21:47:34 +0000857# Re-`\' parameter expansions in output of double_quote_subst that were
858# `\'-ed in input to the same. If an odd number of `\' preceded a '$'
859# in input to double_quote_subst, that '$' was protected from expansion.
860# Since each input `\' is now two `\'s, look for any number of runs of
861# four `\'s followed by two `\'s and then a '$'. `\' that '$'.
862bs='\\'
863bs2='\\\\'
864bs4='\\\\\\\\'
865dollar='\$'
866sed_double_backslash="\
867 s/$bs4/&\\
868/g
869 s/^$bs2$dollar/$bs&/
870 s/\\([^$bs]\\)$bs2$dollar/\\1$bs2$bs$dollar/g
871 s/\n//g"
872
873# Standard options:
874opt_dry_run=false
875opt_help=false
876opt_quiet=false
877opt_verbose=false
878opt_warning=:
879
880# func_echo arg...
881# Echo program name prefixed message, along with the current mode
882# name if it has been set yet.
883func_echo ()
884{
cristyda16f162011-02-19 23:52:17 +0000885 $ECHO "$progname: ${opt_mode+$opt_mode: }$*"
cristy3ed852e2009-09-05 21:47:34 +0000886}
887
888# func_verbose arg...
889# Echo program name prefixed message in verbose mode only.
890func_verbose ()
891{
892 $opt_verbose && func_echo ${1+"$@"}
893
894 # A bug in bash halts the script if the last line of a function
895 # fails when set -e is in force, so we need another command to
896 # work around that:
897 :
898}
899
cristy98dddb52010-11-04 00:30:15 +0000900# func_echo_all arg...
901# Invoke $ECHO with all args, space-separated.
902func_echo_all ()
903{
904 $ECHO "$*"
905}
906
cristy3ed852e2009-09-05 21:47:34 +0000907# func_error arg...
908# Echo program name prefixed message to standard error.
909func_error ()
910{
cristyda16f162011-02-19 23:52:17 +0000911 $ECHO "$progname: ${opt_mode+$opt_mode: }"${1+"$@"} 1>&2
cristy3ed852e2009-09-05 21:47:34 +0000912}
913
914# func_warning arg...
915# Echo program name prefixed warning message to standard error.
916func_warning ()
917{
cristyda16f162011-02-19 23:52:17 +0000918 $opt_warning && $ECHO "$progname: ${opt_mode+$opt_mode: }warning: "${1+"$@"} 1>&2
cristy3ed852e2009-09-05 21:47:34 +0000919
920 # bash bug again:
921 :
922}
923
924# func_fatal_error arg...
925# Echo program name prefixed message to standard error, and exit.
926func_fatal_error ()
927{
928 func_error ${1+"$@"}
929 exit $EXIT_FAILURE
930}
931
932# func_fatal_help arg...
933# Echo program name prefixed message to standard error, followed by
934# a help hint, and exit.
935func_fatal_help ()
936{
937 func_error ${1+"$@"}
938 func_fatal_error "$help"
939}
940help="Try \`$progname --help' for more information." ## default
941
942
943# func_grep expression filename
944# Check whether EXPRESSION matches any line of FILENAME, without output.
945func_grep ()
946{
947 $GREP "$1" "$2" >/dev/null 2>&1
948}
949
950
951# func_mkdir_p directory-path
952# Make sure the entire path to DIRECTORY-PATH is available.
953func_mkdir_p ()
954{
955 my_directory_path="$1"
956 my_dir_list=
957
958 if test -n "$my_directory_path" && test "$opt_dry_run" != ":"; then
959
960 # Protect directory names starting with `-'
961 case $my_directory_path in
962 -*) my_directory_path="./$my_directory_path" ;;
963 esac
964
965 # While some portion of DIR does not yet exist...
966 while test ! -d "$my_directory_path"; do
967 # ...make a list in topmost first order. Use a colon delimited
968 # list incase some portion of path contains whitespace.
969 my_dir_list="$my_directory_path:$my_dir_list"
970
971 # If the last portion added has no slash in it, the list is done
972 case $my_directory_path in */*) ;; *) break ;; esac
973
974 # ...otherwise throw away the child directory and loop
cristy98dddb52010-11-04 00:30:15 +0000975 my_directory_path=`$ECHO "$my_directory_path" | $SED -e "$dirname"`
cristy3ed852e2009-09-05 21:47:34 +0000976 done
cristy98dddb52010-11-04 00:30:15 +0000977 my_dir_list=`$ECHO "$my_dir_list" | $SED 's,:*$,,'`
cristy3ed852e2009-09-05 21:47:34 +0000978
979 save_mkdir_p_IFS="$IFS"; IFS=':'
980 for my_dir in $my_dir_list; do
981 IFS="$save_mkdir_p_IFS"
982 # mkdir can fail with a `File exist' error if two processes
983 # try to create one of the directories concurrently. Don't
984 # stop in that case!
985 $MKDIR "$my_dir" 2>/dev/null || :
986 done
987 IFS="$save_mkdir_p_IFS"
988
989 # Bail out if we (or some other process) failed to create a directory.
990 test -d "$my_directory_path" || \
991 func_fatal_error "Failed to create \`$1'"
992 fi
993}
994
995
996# func_mktempdir [string]
997# Make a temporary directory that won't clash with other running
998# libtool processes, and avoids race conditions if possible. If
999# given, STRING is the basename for that directory.
1000func_mktempdir ()
1001{
1002 my_template="${TMPDIR-/tmp}/${1-$progname}"
1003
1004 if test "$opt_dry_run" = ":"; then
1005 # Return a directory name, but don't create it in dry-run mode
1006 my_tmpdir="${my_template}-$$"
1007 else
1008
1009 # If mktemp works, use that first and foremost
1010 my_tmpdir=`mktemp -d "${my_template}-XXXXXXXX" 2>/dev/null`
1011
1012 if test ! -d "$my_tmpdir"; then
1013 # Failing that, at least try and use $RANDOM to avoid a race
1014 my_tmpdir="${my_template}-${RANDOM-0}$$"
1015
1016 save_mktempdir_umask=`umask`
1017 umask 0077
1018 $MKDIR "$my_tmpdir"
1019 umask $save_mktempdir_umask
1020 fi
1021
1022 # If we're not in dry-run mode, bomb out on failure
1023 test -d "$my_tmpdir" || \
1024 func_fatal_error "cannot create temporary directory \`$my_tmpdir'"
1025 fi
1026
cristy98dddb52010-11-04 00:30:15 +00001027 $ECHO "$my_tmpdir"
cristy3ed852e2009-09-05 21:47:34 +00001028}
1029
1030
1031# func_quote_for_eval arg
1032# Aesthetically quote ARG to be evaled later.
1033# This function returns two values: FUNC_QUOTE_FOR_EVAL_RESULT
1034# is double-quoted, suitable for a subsequent eval, whereas
1035# FUNC_QUOTE_FOR_EVAL_UNQUOTED_RESULT has merely all characters
1036# which are still active within double quotes backslashified.
1037func_quote_for_eval ()
1038{
1039 case $1 in
1040 *[\\\`\"\$]*)
cristy98dddb52010-11-04 00:30:15 +00001041 func_quote_for_eval_unquoted_result=`$ECHO "$1" | $SED "$sed_quote_subst"` ;;
cristy3ed852e2009-09-05 21:47:34 +00001042 *)
1043 func_quote_for_eval_unquoted_result="$1" ;;
1044 esac
1045
1046 case $func_quote_for_eval_unquoted_result in
1047 # Double-quote args containing shell metacharacters to delay
1048 # word splitting, command substitution and and variable
1049 # expansion for a subsequent eval.
1050 # Many Bourne shells cannot handle close brackets correctly
1051 # in scan sets, so we specify it separately.
1052 *[\[\~\#\^\&\*\(\)\{\}\|\;\<\>\?\'\ \ ]*|*]*|"")
1053 func_quote_for_eval_result="\"$func_quote_for_eval_unquoted_result\""
1054 ;;
1055 *)
1056 func_quote_for_eval_result="$func_quote_for_eval_unquoted_result"
1057 esac
1058}
1059
1060
1061# func_quote_for_expand arg
1062# Aesthetically quote ARG to be evaled later; same as above,
1063# but do not quote variable references.
1064func_quote_for_expand ()
1065{
1066 case $1 in
1067 *[\\\`\"]*)
cristy98dddb52010-11-04 00:30:15 +00001068 my_arg=`$ECHO "$1" | $SED \
cristy3ed852e2009-09-05 21:47:34 +00001069 -e "$double_quote_subst" -e "$sed_double_backslash"` ;;
1070 *)
1071 my_arg="$1" ;;
1072 esac
1073
1074 case $my_arg in
1075 # Double-quote args containing shell metacharacters to delay
1076 # word splitting and command substitution for a subsequent eval.
1077 # Many Bourne shells cannot handle close brackets correctly
1078 # in scan sets, so we specify it separately.
1079 *[\[\~\#\^\&\*\(\)\{\}\|\;\<\>\?\'\ \ ]*|*]*|"")
1080 my_arg="\"$my_arg\""
1081 ;;
1082 esac
1083
1084 func_quote_for_expand_result="$my_arg"
1085}
1086
1087
1088# func_show_eval cmd [fail_exp]
1089# Unless opt_silent is true, then output CMD. Then, if opt_dryrun is
1090# not true, evaluate CMD. If the evaluation of CMD fails, and FAIL_EXP
1091# is given, then evaluate it.
1092func_show_eval ()
1093{
1094 my_cmd="$1"
1095 my_fail_exp="${2-:}"
1096
1097 ${opt_silent-false} || {
1098 func_quote_for_expand "$my_cmd"
1099 eval "func_echo $func_quote_for_expand_result"
1100 }
1101
1102 if ${opt_dry_run-false}; then :; else
1103 eval "$my_cmd"
1104 my_status=$?
1105 if test "$my_status" -eq 0; then :; else
1106 eval "(exit $my_status); $my_fail_exp"
1107 fi
1108 fi
1109}
1110
1111
1112# func_show_eval_locale cmd [fail_exp]
1113# Unless opt_silent is true, then output CMD. Then, if opt_dryrun is
1114# not true, evaluate CMD. If the evaluation of CMD fails, and FAIL_EXP
1115# is given, then evaluate it. Use the saved locale for evaluation.
1116func_show_eval_locale ()
1117{
1118 my_cmd="$1"
1119 my_fail_exp="${2-:}"
1120
1121 ${opt_silent-false} || {
1122 func_quote_for_expand "$my_cmd"
1123 eval "func_echo $func_quote_for_expand_result"
1124 }
1125
1126 if ${opt_dry_run-false}; then :; else
1127 eval "$lt_user_locale
1128 $my_cmd"
1129 my_status=$?
1130 eval "$lt_safe_locale"
1131 if test "$my_status" -eq 0; then :; else
1132 eval "(exit $my_status); $my_fail_exp"
1133 fi
1134 fi
1135}
1136
cristyda16f162011-02-19 23:52:17 +00001137# func_tr_sh
1138# Turn $1 into a string suitable for a shell variable name.
1139# Result is stored in $func_tr_sh_result. All characters
1140# not in the set a-zA-Z0-9_ are replaced with '_'. Further,
1141# if $1 begins with a digit, a '_' is prepended as well.
1142func_tr_sh ()
1143{
1144 case $1 in
1145 [0-9]* | *[!a-zA-Z0-9_]*)
1146 func_tr_sh_result=`$ECHO "$1" | $SED 's/^\([0-9]\)/_\1/; s/[^a-zA-Z0-9_]/_/g'`
1147 ;;
1148 * )
1149 func_tr_sh_result=$1
1150 ;;
1151 esac
1152}
1153
cristy3ed852e2009-09-05 21:47:34 +00001154
cristy3ed852e2009-09-05 21:47:34 +00001155# func_version
1156# Echo version message to standard output and exit.
1157func_version ()
1158{
cristyda16f162011-02-19 23:52:17 +00001159 $opt_debug
1160
cristy98dddb52010-11-04 00:30:15 +00001161 $SED -n '/(C)/!b go
1162 :more
1163 /\./!{
1164 N
1165 s/\n# / /
1166 b more
1167 }
1168 :go
1169 /^# '$PROGRAM' (GNU /,/# warranty; / {
cristy3ed852e2009-09-05 21:47:34 +00001170 s/^# //
1171 s/^# *$//
1172 s/\((C)\)[ 0-9,-]*\( [1-9][0-9]*\)/\1\2/
1173 p
1174 }' < "$progpath"
1175 exit $?
1176}
1177
1178# func_usage
1179# Echo short help message to standard output and exit.
1180func_usage ()
1181{
cristyda16f162011-02-19 23:52:17 +00001182 $opt_debug
1183
cristy98dddb52010-11-04 00:30:15 +00001184 $SED -n '/^# Usage:/,/^# *.*--help/ {
cristy3ed852e2009-09-05 21:47:34 +00001185 s/^# //
1186 s/^# *$//
1187 s/\$progname/'$progname'/
1188 p
1189 }' < "$progpath"
cristy98dddb52010-11-04 00:30:15 +00001190 echo
cristy3ed852e2009-09-05 21:47:34 +00001191 $ECHO "run \`$progname --help | more' for full usage"
1192 exit $?
1193}
1194
cristy98dddb52010-11-04 00:30:15 +00001195# func_help [NOEXIT]
1196# Echo long help message to standard output and exit,
1197# unless 'noexit' is passed as argument.
cristy3ed852e2009-09-05 21:47:34 +00001198func_help ()
1199{
cristyda16f162011-02-19 23:52:17 +00001200 $opt_debug
1201
cristy3ed852e2009-09-05 21:47:34 +00001202 $SED -n '/^# Usage:/,/# Report bugs to/ {
cristyda16f162011-02-19 23:52:17 +00001203 :print
cristy3ed852e2009-09-05 21:47:34 +00001204 s/^# //
1205 s/^# *$//
1206 s*\$progname*'$progname'*
1207 s*\$host*'"$host"'*
1208 s*\$SHELL*'"$SHELL"'*
1209 s*\$LTCC*'"$LTCC"'*
1210 s*\$LTCFLAGS*'"$LTCFLAGS"'*
1211 s*\$LD*'"$LD"'*
1212 s/\$with_gnu_ld/'"$with_gnu_ld"'/
cristy2542fc62011-12-06 17:50:25 +00001213 s/\$automake_version/'"`(${AUTOMAKE-automake} --version) 2>/dev/null |$SED 1q`"'/
1214 s/\$autoconf_version/'"`(${AUTOCONF-autoconf} --version) 2>/dev/null |$SED 1q`"'/
cristy3ed852e2009-09-05 21:47:34 +00001215 p
cristyda16f162011-02-19 23:52:17 +00001216 d
1217 }
1218 /^# .* home page:/b print
1219 /^# General help using/b print
1220 ' < "$progpath"
cristy98dddb52010-11-04 00:30:15 +00001221 ret=$?
1222 if test -z "$1"; then
1223 exit $ret
1224 fi
cristy3ed852e2009-09-05 21:47:34 +00001225}
1226
1227# func_missing_arg argname
1228# Echo program name prefixed message to standard error and set global
1229# exit_cmd.
1230func_missing_arg ()
1231{
cristyda16f162011-02-19 23:52:17 +00001232 $opt_debug
1233
cristy98dddb52010-11-04 00:30:15 +00001234 func_error "missing argument for $1."
cristy3ed852e2009-09-05 21:47:34 +00001235 exit_cmd=exit
1236}
1237
cristy3ed852e2009-09-05 21:47:34 +00001238
cristyda16f162011-02-19 23:52:17 +00001239# func_split_short_opt shortopt
1240# Set func_split_short_opt_name and func_split_short_opt_arg shell
1241# variables after splitting SHORTOPT after the 2nd character.
1242func_split_short_opt ()
1243{
1244 func_split_short_opt_arg=${1#??}
1245 func_split_short_opt_name=${1%"$func_split_short_opt_arg"}
1246} # Extended-shell func_split_short_opt implementation
1247
1248
1249# func_split_long_opt longopt
1250# Set func_split_long_opt_name and func_split_long_opt_arg shell
1251# variables after splitting LONGOPT at the `=' sign.
1252func_split_long_opt ()
1253{
1254 func_split_long_opt_name=${1%%=*}
1255 func_split_long_opt_arg=${1#*=}
1256} # Extended-shell func_split_long_opt implementation
1257
1258exit_cmd=:
cristy3ed852e2009-09-05 21:47:34 +00001259
1260
1261
1262
cristy3ed852e2009-09-05 21:47:34 +00001263
1264magic="%%%MAGIC variable%%%"
1265magic_exe="%%%MAGIC EXE variable%%%"
1266
1267# Global variables.
cristy3ed852e2009-09-05 21:47:34 +00001268nonopt=
cristy3ed852e2009-09-05 21:47:34 +00001269preserve_args=
1270lo2o="s/\\.lo\$/.${objext}/"
1271o2lo="s/\\.${objext}\$/.lo/"
1272extracted_archives=
1273extracted_serial=0
1274
cristy3ed852e2009-09-05 21:47:34 +00001275# If this variable is set in any of the actions, the command in it
1276# will be execed at the end. This prevents here-documents from being
1277# left over by shells.
1278exec_cmd=
1279
cristyda16f162011-02-19 23:52:17 +00001280# func_append var value
1281# Append VALUE to the end of shell variable VAR.
1282func_append ()
1283{
1284 eval "${1}+=\${2}"
1285} # Extended-shell func_append implementation
1286
1287# func_append_quoted var value
1288# Quote VALUE and append to the end of shell variable VAR, separated
1289# by a space.
1290func_append_quoted ()
1291{
1292 func_quote_for_eval "${2}"
1293 eval "${1}+=\\ \$func_quote_for_eval_result"
1294} # Extended-shell func_append_quoted implementation
1295
1296
1297# func_arith arithmetic-term...
1298func_arith ()
1299{
1300 func_arith_result=$(( $* ))
1301} # Extended-shell func_arith implementation
1302
1303
1304# func_len string
1305# STRING may not start with a hyphen.
1306func_len ()
1307{
1308 func_len_result=${#1}
1309} # Extended-shell func_len implementation
1310
1311
1312# func_lo2o object
1313func_lo2o ()
1314{
1315 case ${1} in
1316 *.lo) func_lo2o_result=${1%.lo}.${objext} ;;
1317 *) func_lo2o_result=${1} ;;
1318 esac
1319} # Extended-shell func_lo2o implementation
1320
1321
1322# func_xform libobj-or-source
1323func_xform ()
1324{
1325 func_xform_result=${1%.*}.lo
1326} # Extended-shell func_xform implementation
1327
1328
cristy3ed852e2009-09-05 21:47:34 +00001329# func_fatal_configuration arg...
1330# Echo program name prefixed message to standard error, followed by
1331# a configuration failure hint, and exit.
1332func_fatal_configuration ()
1333{
1334 func_error ${1+"$@"}
1335 func_error "See the $PACKAGE documentation for more information."
1336 func_fatal_error "Fatal configuration error."
1337}
1338
1339
1340# func_config
1341# Display the configuration for all the tags in this script.
1342func_config ()
1343{
1344 re_begincf='^# ### BEGIN LIBTOOL'
1345 re_endcf='^# ### END LIBTOOL'
1346
1347 # Default configuration.
1348 $SED "1,/$re_begincf CONFIG/d;/$re_endcf CONFIG/,\$d" < "$progpath"
1349
1350 # Now print the configurations for the tags.
1351 for tagname in $taglist; do
1352 $SED -n "/$re_begincf TAG CONFIG: $tagname\$/,/$re_endcf TAG CONFIG: $tagname\$/p" < "$progpath"
1353 done
1354
1355 exit $?
1356}
1357
1358# func_features
1359# Display the features supported by this script.
1360func_features ()
1361{
cristy98dddb52010-11-04 00:30:15 +00001362 echo "host: $host"
cristy3ed852e2009-09-05 21:47:34 +00001363 if test "$build_libtool_libs" = yes; then
cristy98dddb52010-11-04 00:30:15 +00001364 echo "enable shared libraries"
cristy3ed852e2009-09-05 21:47:34 +00001365 else
cristy98dddb52010-11-04 00:30:15 +00001366 echo "disable shared libraries"
cristy3ed852e2009-09-05 21:47:34 +00001367 fi
1368 if test "$build_old_libs" = yes; then
cristy98dddb52010-11-04 00:30:15 +00001369 echo "enable static libraries"
cristy3ed852e2009-09-05 21:47:34 +00001370 else
cristy98dddb52010-11-04 00:30:15 +00001371 echo "disable static libraries"
cristy3ed852e2009-09-05 21:47:34 +00001372 fi
1373
1374 exit $?
1375}
1376
1377# func_enable_tag tagname
1378# Verify that TAGNAME is valid, and either flag an error and exit, or
1379# enable the TAGNAME tag. We also add TAGNAME to the global $taglist
1380# variable here.
1381func_enable_tag ()
1382{
1383 # Global variable:
1384 tagname="$1"
1385
1386 re_begincf="^# ### BEGIN LIBTOOL TAG CONFIG: $tagname\$"
1387 re_endcf="^# ### END LIBTOOL TAG CONFIG: $tagname\$"
1388 sed_extractcf="/$re_begincf/,/$re_endcf/p"
1389
1390 # Validate tagname.
1391 case $tagname in
1392 *[!-_A-Za-z0-9,/]*)
1393 func_fatal_error "invalid tag name: $tagname"
1394 ;;
1395 esac
1396
1397 # Don't test for the "default" C tag, as we know it's
1398 # there but not specially marked.
1399 case $tagname in
1400 CC) ;;
1401 *)
1402 if $GREP "$re_begincf" "$progpath" >/dev/null 2>&1; then
1403 taglist="$taglist $tagname"
1404
1405 # Evaluate the configuration. Be careful to quote the path
1406 # and the sed script, to avoid splitting on whitespace, but
1407 # also don't use non-portable quotes within backquotes within
1408 # quotes we have to do it in 2 steps:
1409 extractedcf=`$SED -n -e "$sed_extractcf" < "$progpath"`
1410 eval "$extractedcf"
1411 else
1412 func_error "ignoring unknown tag $tagname"
1413 fi
1414 ;;
1415 esac
1416}
1417
cristy3ed852e2009-09-05 21:47:34 +00001418# func_check_version_match
1419# Ensure that we are using m4 macros, and libtool script from the same
1420# release of libtool.
1421func_check_version_match ()
1422{
1423 if test "$package_revision" != "$macro_revision"; then
1424 if test "$VERSION" != "$macro_version"; then
1425 if test -z "$macro_version"; then
1426 cat >&2 <<_LT_EOF
1427$progname: Version mismatch error. This is $PACKAGE $VERSION, but the
1428$progname: definition of this LT_INIT comes from an older release.
1429$progname: You should recreate aclocal.m4 with macros from $PACKAGE $VERSION
1430$progname: and run autoconf again.
1431_LT_EOF
1432 else
1433 cat >&2 <<_LT_EOF
1434$progname: Version mismatch error. This is $PACKAGE $VERSION, but the
1435$progname: definition of this LT_INIT comes from $PACKAGE $macro_version.
1436$progname: You should recreate aclocal.m4 with macros from $PACKAGE $VERSION
1437$progname: and run autoconf again.
1438_LT_EOF
1439 fi
1440 else
1441 cat >&2 <<_LT_EOF
1442$progname: Version mismatch error. This is $PACKAGE $VERSION, revision $package_revision,
1443$progname: but the definition of this LT_INIT comes from revision $macro_revision.
1444$progname: You should recreate aclocal.m4 with macros from revision $package_revision
1445$progname: of $PACKAGE $VERSION and run autoconf again.
1446_LT_EOF
1447 fi
1448
1449 exit $EXIT_MISMATCH
1450 fi
1451}
1452
1453
cristyda16f162011-02-19 23:52:17 +00001454# Shorthand for --mode=foo, only valid as the first argument
1455case $1 in
1456clean|clea|cle|cl)
1457 shift; set dummy --mode clean ${1+"$@"}; shift
1458 ;;
1459compile|compil|compi|comp|com|co|c)
1460 shift; set dummy --mode compile ${1+"$@"}; shift
1461 ;;
1462execute|execut|execu|exec|exe|ex|e)
1463 shift; set dummy --mode execute ${1+"$@"}; shift
1464 ;;
1465finish|finis|fini|fin|fi|f)
1466 shift; set dummy --mode finish ${1+"$@"}; shift
1467 ;;
1468install|instal|insta|inst|ins|in|i)
1469 shift; set dummy --mode install ${1+"$@"}; shift
1470 ;;
1471link|lin|li|l)
1472 shift; set dummy --mode link ${1+"$@"}; shift
1473 ;;
1474uninstall|uninstal|uninsta|uninst|unins|unin|uni|un|u)
1475 shift; set dummy --mode uninstall ${1+"$@"}; shift
1476 ;;
1477esac
1478
1479
1480
1481# Option defaults:
1482opt_debug=:
1483opt_dry_run=false
1484opt_config=false
1485opt_preserve_dup_deps=false
1486opt_features=false
1487opt_finish=false
1488opt_help=false
1489opt_help_all=false
1490opt_silent=:
cristy2542fc62011-12-06 17:50:25 +00001491opt_warning=:
cristyda16f162011-02-19 23:52:17 +00001492opt_verbose=:
1493opt_silent=false
1494opt_verbose=false
1495
1496
1497# Parse options once, thoroughly. This comes as soon as possible in the
1498# script to make things like `--version' happen as quickly as we can.
1499{
1500 # this just eases exit handling
1501 while test $# -gt 0; do
1502 opt="$1"
1503 shift
1504 case $opt in
1505 --debug|-x) opt_debug='set -x'
1506 func_echo "enabling shell trace mode"
1507 $opt_debug
1508 ;;
1509 --dry-run|--dryrun|-n)
1510 opt_dry_run=:
1511 ;;
1512 --config)
1513 opt_config=:
1514func_config
1515 ;;
1516 --dlopen|-dlopen)
1517 optarg="$1"
1518 opt_dlopen="${opt_dlopen+$opt_dlopen
1519}$optarg"
1520 shift
1521 ;;
1522 --preserve-dup-deps)
1523 opt_preserve_dup_deps=:
1524 ;;
1525 --features)
1526 opt_features=:
1527func_features
1528 ;;
1529 --finish)
1530 opt_finish=:
1531set dummy --mode finish ${1+"$@"}; shift
1532 ;;
1533 --help)
1534 opt_help=:
1535 ;;
1536 --help-all)
1537 opt_help_all=:
1538opt_help=': help-all'
1539 ;;
1540 --mode)
1541 test $# = 0 && func_missing_arg $opt && break
1542 optarg="$1"
1543 opt_mode="$optarg"
1544case $optarg in
1545 # Valid mode arguments:
1546 clean|compile|execute|finish|install|link|relink|uninstall) ;;
1547
1548 # Catch anything else as an error
1549 *) func_error "invalid argument for $opt"
1550 exit_cmd=exit
1551 break
1552 ;;
1553esac
1554 shift
1555 ;;
1556 --no-silent|--no-quiet)
1557 opt_silent=false
1558preserve_args+=" $opt"
1559 ;;
cristy2542fc62011-12-06 17:50:25 +00001560 --no-warning|--no-warn)
1561 opt_warning=false
1562preserve_args+=" $opt"
1563 ;;
cristyda16f162011-02-19 23:52:17 +00001564 --no-verbose)
1565 opt_verbose=false
1566preserve_args+=" $opt"
1567 ;;
1568 --silent|--quiet)
1569 opt_silent=:
1570preserve_args+=" $opt"
1571 opt_verbose=false
1572 ;;
1573 --verbose|-v)
1574 opt_verbose=:
1575preserve_args+=" $opt"
1576opt_silent=false
1577 ;;
1578 --tag)
1579 test $# = 0 && func_missing_arg $opt && break
1580 optarg="$1"
1581 opt_tag="$optarg"
1582preserve_args+=" $opt $optarg"
1583func_enable_tag "$optarg"
1584 shift
1585 ;;
1586
1587 -\?|-h) func_usage ;;
1588 --help) func_help ;;
1589 --version) func_version ;;
1590
1591 # Separate optargs to long options:
1592 --*=*)
1593 func_split_long_opt "$opt"
1594 set dummy "$func_split_long_opt_name" "$func_split_long_opt_arg" ${1+"$@"}
1595 shift
1596 ;;
1597
1598 # Separate non-argument short options:
1599 -\?*|-h*|-n*|-v*)
1600 func_split_short_opt "$opt"
1601 set dummy "$func_split_short_opt_name" "-$func_split_short_opt_arg" ${1+"$@"}
1602 shift
1603 ;;
1604
1605 --) break ;;
1606 -*) func_fatal_help "unrecognized option \`$opt'" ;;
1607 *) set dummy "$opt" ${1+"$@"}; shift; break ;;
1608 esac
1609 done
1610
1611 # Validate options:
1612
1613 # save first non-option argument
1614 if test "$#" -gt 0; then
1615 nonopt="$opt"
1616 shift
1617 fi
1618
1619 # preserve --debug
1620 test "$opt_debug" = : || preserve_args+=" --debug"
1621
1622 case $host in
1623 *cygwin* | *mingw* | *pw32* | *cegcc*)
1624 # don't eliminate duplications in $postdeps and $predeps
1625 opt_duplicate_compiler_generated_deps=:
1626 ;;
1627 *)
1628 opt_duplicate_compiler_generated_deps=$opt_preserve_dup_deps
1629 ;;
1630 esac
1631
1632 $opt_help || {
1633 # Sanity checks first:
1634 func_check_version_match
1635
1636 if test "$build_libtool_libs" != yes && test "$build_old_libs" != yes; then
1637 func_fatal_configuration "not configured to build any kind of library"
1638 fi
1639
1640 # Darwin sucks
1641 eval std_shrext=\"$shrext_cmds\"
1642
1643 # Only execute mode is allowed to have -dlopen flags.
1644 if test -n "$opt_dlopen" && test "$opt_mode" != execute; then
1645 func_error "unrecognized option \`-dlopen'"
1646 $ECHO "$help" 1>&2
1647 exit $EXIT_FAILURE
1648 fi
1649
1650 # Change the help message to a mode-specific one.
1651 generic_help="$help"
1652 help="Try \`$progname --help --mode=$opt_mode' for more information."
1653 }
1654
1655
1656 # Bail if the options were screwed
1657 $exit_cmd $EXIT_FAILURE
1658}
1659
1660
1661
1662
cristy3ed852e2009-09-05 21:47:34 +00001663## ----------- ##
1664## Main. ##
1665## ----------- ##
1666
cristy3ed852e2009-09-05 21:47:34 +00001667# func_lalib_p file
1668# True iff FILE is a libtool `.la' library or `.lo' object file.
1669# This function is only a basic sanity check; it will hardly flush out
1670# determined imposters.
1671func_lalib_p ()
1672{
1673 test -f "$1" &&
1674 $SED -e 4q "$1" 2>/dev/null \
1675 | $GREP "^# Generated by .*$PACKAGE" > /dev/null 2>&1
1676}
1677
1678# func_lalib_unsafe_p file
1679# True iff FILE is a libtool `.la' library or `.lo' object file.
1680# This function implements the same check as func_lalib_p without
1681# resorting to external programs. To this end, it redirects stdin and
1682# closes it afterwards, without saving the original file descriptor.
1683# As a safety measure, use it only where a negative result would be
1684# fatal anyway. Works if `file' does not exist.
1685func_lalib_unsafe_p ()
1686{
1687 lalib_p=no
1688 if test -f "$1" && test -r "$1" && exec 5<&0 <"$1"; then
1689 for lalib_p_l in 1 2 3 4
1690 do
1691 read lalib_p_line
1692 case "$lalib_p_line" in
1693 \#\ Generated\ by\ *$PACKAGE* ) lalib_p=yes; break;;
1694 esac
1695 done
1696 exec 0<&5 5<&-
1697 fi
1698 test "$lalib_p" = yes
1699}
1700
1701# func_ltwrapper_script_p file
1702# True iff FILE is a libtool wrapper script
1703# This function is only a basic sanity check; it will hardly flush out
1704# determined imposters.
1705func_ltwrapper_script_p ()
1706{
1707 func_lalib_p "$1"
1708}
1709
1710# func_ltwrapper_executable_p file
1711# True iff FILE is a libtool wrapper executable
1712# This function is only a basic sanity check; it will hardly flush out
1713# determined imposters.
1714func_ltwrapper_executable_p ()
1715{
1716 func_ltwrapper_exec_suffix=
1717 case $1 in
1718 *.exe) ;;
1719 *) func_ltwrapper_exec_suffix=.exe ;;
1720 esac
1721 $GREP "$magic_exe" "$1$func_ltwrapper_exec_suffix" >/dev/null 2>&1
1722}
1723
1724# func_ltwrapper_scriptname file
1725# Assumes file is an ltwrapper_executable
1726# uses $file to determine the appropriate filename for a
1727# temporary ltwrapper_script.
1728func_ltwrapper_scriptname ()
1729{
cristyda16f162011-02-19 23:52:17 +00001730 func_dirname_and_basename "$1" "" "."
1731 func_stripname '' '.exe' "$func_basename_result"
1732 func_ltwrapper_scriptname_result="$func_dirname_result/$objdir/${func_stripname_result}_ltshwrapper"
cristy3ed852e2009-09-05 21:47:34 +00001733}
1734
1735# func_ltwrapper_p file
1736# True iff FILE is a libtool wrapper script or wrapper executable
1737# This function is only a basic sanity check; it will hardly flush out
1738# determined imposters.
1739func_ltwrapper_p ()
1740{
1741 func_ltwrapper_script_p "$1" || func_ltwrapper_executable_p "$1"
1742}
1743
1744
1745# func_execute_cmds commands fail_cmd
1746# Execute tilde-delimited COMMANDS.
1747# If FAIL_CMD is given, eval that upon failure.
1748# FAIL_CMD may read-access the current command in variable CMD!
1749func_execute_cmds ()
1750{
1751 $opt_debug
1752 save_ifs=$IFS; IFS='~'
1753 for cmd in $1; do
1754 IFS=$save_ifs
1755 eval cmd=\"$cmd\"
1756 func_show_eval "$cmd" "${2-:}"
1757 done
1758 IFS=$save_ifs
1759}
1760
1761
1762# func_source file
1763# Source FILE, adding directory component if necessary.
1764# Note that it is not necessary on cygwin/mingw to append a dot to
1765# FILE even if both FILE and FILE.exe exist: automatic-append-.exe
1766# behavior happens only for exec(3), not for open(2)! Also, sourcing
1767# `FILE.' does not work on cygwin managed mounts.
1768func_source ()
1769{
1770 $opt_debug
1771 case $1 in
1772 */* | *\\*) . "$1" ;;
1773 *) . "./$1" ;;
1774 esac
1775}
1776
1777
cristyda16f162011-02-19 23:52:17 +00001778# func_resolve_sysroot PATH
1779# Replace a leading = in PATH with a sysroot. Store the result into
1780# func_resolve_sysroot_result
1781func_resolve_sysroot ()
1782{
1783 func_resolve_sysroot_result=$1
1784 case $func_resolve_sysroot_result in
1785 =*)
1786 func_stripname '=' '' "$func_resolve_sysroot_result"
1787 func_resolve_sysroot_result=$lt_sysroot$func_stripname_result
1788 ;;
1789 esac
1790}
1791
1792# func_replace_sysroot PATH
1793# If PATH begins with the sysroot, replace it with = and
1794# store the result into func_replace_sysroot_result.
1795func_replace_sysroot ()
1796{
1797 case "$lt_sysroot:$1" in
1798 ?*:"$lt_sysroot"*)
1799 func_stripname "$lt_sysroot" '' "$1"
1800 func_replace_sysroot_result="=$func_stripname_result"
1801 ;;
1802 *)
1803 # Including no sysroot.
1804 func_replace_sysroot_result=$1
1805 ;;
1806 esac
1807}
1808
cristy3ed852e2009-09-05 21:47:34 +00001809# func_infer_tag arg
1810# Infer tagged configuration to use if any are available and
1811# if one wasn't chosen via the "--tag" command line option.
1812# Only attempt this if the compiler in the base compile
1813# command doesn't match the default compiler.
1814# arg is usually of the form 'gcc ...'
1815func_infer_tag ()
1816{
1817 $opt_debug
1818 if test -n "$available_tags" && test -z "$tagname"; then
1819 CC_quoted=
1820 for arg in $CC; do
cristyda16f162011-02-19 23:52:17 +00001821 func_append_quoted CC_quoted "$arg"
cristy3ed852e2009-09-05 21:47:34 +00001822 done
cristy98dddb52010-11-04 00:30:15 +00001823 CC_expanded=`func_echo_all $CC`
1824 CC_quoted_expanded=`func_echo_all $CC_quoted`
cristy3ed852e2009-09-05 21:47:34 +00001825 case $@ in
1826 # Blanks in the command may have been stripped by the calling shell,
1827 # but not from the CC environment variable when configure was run.
cristy98dddb52010-11-04 00:30:15 +00001828 " $CC "* | "$CC "* | " $CC_expanded "* | "$CC_expanded "* | \
1829 " $CC_quoted"* | "$CC_quoted "* | " $CC_quoted_expanded "* | "$CC_quoted_expanded "*) ;;
cristy3ed852e2009-09-05 21:47:34 +00001830 # Blanks at the start of $base_compile will cause this to fail
1831 # if we don't check for them as well.
1832 *)
1833 for z in $available_tags; do
1834 if $GREP "^# ### BEGIN LIBTOOL TAG CONFIG: $z$" < "$progpath" > /dev/null; then
1835 # Evaluate the configuration.
1836 eval "`${SED} -n -e '/^# ### BEGIN LIBTOOL TAG CONFIG: '$z'$/,/^# ### END LIBTOOL TAG CONFIG: '$z'$/p' < $progpath`"
1837 CC_quoted=
1838 for arg in $CC; do
1839 # Double-quote args containing other shell metacharacters.
cristyda16f162011-02-19 23:52:17 +00001840 func_append_quoted CC_quoted "$arg"
cristy3ed852e2009-09-05 21:47:34 +00001841 done
cristy98dddb52010-11-04 00:30:15 +00001842 CC_expanded=`func_echo_all $CC`
1843 CC_quoted_expanded=`func_echo_all $CC_quoted`
cristy3ed852e2009-09-05 21:47:34 +00001844 case "$@ " in
cristy98dddb52010-11-04 00:30:15 +00001845 " $CC "* | "$CC "* | " $CC_expanded "* | "$CC_expanded "* | \
1846 " $CC_quoted"* | "$CC_quoted "* | " $CC_quoted_expanded "* | "$CC_quoted_expanded "*)
cristy3ed852e2009-09-05 21:47:34 +00001847 # The compiler in the base compile command matches
1848 # the one in the tagged configuration.
1849 # Assume this is the tagged configuration we want.
1850 tagname=$z
1851 break
1852 ;;
1853 esac
1854 fi
1855 done
1856 # If $tagname still isn't set, then no tagged configuration
1857 # was found and let the user know that the "--tag" command
1858 # line option must be used.
1859 if test -z "$tagname"; then
1860 func_echo "unable to infer tagged configuration"
1861 func_fatal_error "specify a tag with \`--tag'"
1862# else
1863# func_verbose "using $tagname tagged configuration"
1864 fi
1865 ;;
1866 esac
1867 fi
1868}
1869
1870
1871
1872# func_write_libtool_object output_name pic_name nonpic_name
1873# Create a libtool object file (analogous to a ".la" file),
1874# but don't create it if we're doing a dry run.
1875func_write_libtool_object ()
1876{
1877 write_libobj=${1}
1878 if test "$build_libtool_libs" = yes; then
1879 write_lobj=\'${2}\'
1880 else
1881 write_lobj=none
1882 fi
1883
1884 if test "$build_old_libs" = yes; then
1885 write_oldobj=\'${3}\'
1886 else
1887 write_oldobj=none
1888 fi
1889
1890 $opt_dry_run || {
1891 cat >${write_libobj}T <<EOF
1892# $write_libobj - a libtool object file
1893# Generated by $PROGRAM (GNU $PACKAGE$TIMESTAMP) $VERSION
1894#
1895# Please DO NOT delete this file!
1896# It is necessary for linking the library.
1897
1898# Name of the PIC object.
1899pic_object=$write_lobj
1900
1901# Name of the non-PIC object
1902non_pic_object=$write_oldobj
1903
1904EOF
1905 $MV "${write_libobj}T" "${write_libobj}"
1906 }
1907}
1908
cristyda16f162011-02-19 23:52:17 +00001909
1910##################################################
1911# FILE NAME AND PATH CONVERSION HELPER FUNCTIONS #
1912##################################################
1913
1914# func_convert_core_file_wine_to_w32 ARG
1915# Helper function used by file name conversion functions when $build is *nix,
1916# and $host is mingw, cygwin, or some other w32 environment. Relies on a
1917# correctly configured wine environment available, with the winepath program
1918# in $build's $PATH.
1919#
1920# ARG is the $build file name to be converted to w32 format.
1921# Result is available in $func_convert_core_file_wine_to_w32_result, and will
1922# be empty on error (or when ARG is empty)
1923func_convert_core_file_wine_to_w32 ()
1924{
1925 $opt_debug
1926 func_convert_core_file_wine_to_w32_result="$1"
1927 if test -n "$1"; then
1928 # Unfortunately, winepath does not exit with a non-zero error code, so we
1929 # are forced to check the contents of stdout. On the other hand, if the
1930 # command is not found, the shell will set an exit code of 127 and print
1931 # *an error message* to stdout. So we must check for both error code of
1932 # zero AND non-empty stdout, which explains the odd construction:
1933 func_convert_core_file_wine_to_w32_tmp=`winepath -w "$1" 2>/dev/null`
1934 if test "$?" -eq 0 && test -n "${func_convert_core_file_wine_to_w32_tmp}"; then
1935 func_convert_core_file_wine_to_w32_result=`$ECHO "$func_convert_core_file_wine_to_w32_tmp" |
1936 $SED -e "$lt_sed_naive_backslashify"`
1937 else
1938 func_convert_core_file_wine_to_w32_result=
1939 fi
1940 fi
1941}
1942# end: func_convert_core_file_wine_to_w32
1943
1944
1945# func_convert_core_path_wine_to_w32 ARG
1946# Helper function used by path conversion functions when $build is *nix, and
1947# $host is mingw, cygwin, or some other w32 environment. Relies on a correctly
1948# configured wine environment available, with the winepath program in $build's
1949# $PATH. Assumes ARG has no leading or trailing path separator characters.
1950#
1951# ARG is path to be converted from $build format to win32.
1952# Result is available in $func_convert_core_path_wine_to_w32_result.
1953# Unconvertible file (directory) names in ARG are skipped; if no directory names
1954# are convertible, then the result may be empty.
1955func_convert_core_path_wine_to_w32 ()
1956{
1957 $opt_debug
1958 # unfortunately, winepath doesn't convert paths, only file names
1959 func_convert_core_path_wine_to_w32_result=""
1960 if test -n "$1"; then
1961 oldIFS=$IFS
1962 IFS=:
1963 for func_convert_core_path_wine_to_w32_f in $1; do
1964 IFS=$oldIFS
1965 func_convert_core_file_wine_to_w32 "$func_convert_core_path_wine_to_w32_f"
1966 if test -n "$func_convert_core_file_wine_to_w32_result" ; then
1967 if test -z "$func_convert_core_path_wine_to_w32_result"; then
1968 func_convert_core_path_wine_to_w32_result="$func_convert_core_file_wine_to_w32_result"
1969 else
1970 func_append func_convert_core_path_wine_to_w32_result ";$func_convert_core_file_wine_to_w32_result"
1971 fi
1972 fi
1973 done
1974 IFS=$oldIFS
1975 fi
1976}
1977# end: func_convert_core_path_wine_to_w32
1978
1979
1980# func_cygpath ARGS...
1981# Wrapper around calling the cygpath program via LT_CYGPATH. This is used when
1982# when (1) $build is *nix and Cygwin is hosted via a wine environment; or (2)
1983# $build is MSYS and $host is Cygwin, or (3) $build is Cygwin. In case (1) or
1984# (2), returns the Cygwin file name or path in func_cygpath_result (input
1985# file name or path is assumed to be in w32 format, as previously converted
1986# from $build's *nix or MSYS format). In case (3), returns the w32 file name
1987# or path in func_cygpath_result (input file name or path is assumed to be in
1988# Cygwin format). Returns an empty string on error.
1989#
1990# ARGS are passed to cygpath, with the last one being the file name or path to
1991# be converted.
1992#
1993# Specify the absolute *nix (or w32) name to cygpath in the LT_CYGPATH
1994# environment variable; do not put it in $PATH.
1995func_cygpath ()
1996{
1997 $opt_debug
1998 if test -n "$LT_CYGPATH" && test -f "$LT_CYGPATH"; then
1999 func_cygpath_result=`$LT_CYGPATH "$@" 2>/dev/null`
2000 if test "$?" -ne 0; then
2001 # on failure, ensure result is empty
2002 func_cygpath_result=
2003 fi
2004 else
2005 func_cygpath_result=
2006 func_error "LT_CYGPATH is empty or specifies non-existent file: \`$LT_CYGPATH'"
2007 fi
2008}
2009#end: func_cygpath
2010
2011
2012# func_convert_core_msys_to_w32 ARG
2013# Convert file name or path ARG from MSYS format to w32 format. Return
2014# result in func_convert_core_msys_to_w32_result.
2015func_convert_core_msys_to_w32 ()
2016{
2017 $opt_debug
2018 # awkward: cmd appends spaces to result
2019 func_convert_core_msys_to_w32_result=`( cmd //c echo "$1" ) 2>/dev/null |
2020 $SED -e 's/[ ]*$//' -e "$lt_sed_naive_backslashify"`
2021}
2022#end: func_convert_core_msys_to_w32
2023
2024
2025# func_convert_file_check ARG1 ARG2
2026# Verify that ARG1 (a file name in $build format) was converted to $host
2027# format in ARG2. Otherwise, emit an error message, but continue (resetting
2028# func_to_host_file_result to ARG1).
2029func_convert_file_check ()
2030{
2031 $opt_debug
2032 if test -z "$2" && test -n "$1" ; then
2033 func_error "Could not determine host file name corresponding to"
2034 func_error " \`$1'"
2035 func_error "Continuing, but uninstalled executables may not work."
2036 # Fallback:
2037 func_to_host_file_result="$1"
2038 fi
2039}
2040# end func_convert_file_check
2041
2042
2043# func_convert_path_check FROM_PATHSEP TO_PATHSEP FROM_PATH TO_PATH
2044# Verify that FROM_PATH (a path in $build format) was converted to $host
2045# format in TO_PATH. Otherwise, emit an error message, but continue, resetting
2046# func_to_host_file_result to a simplistic fallback value (see below).
2047func_convert_path_check ()
2048{
2049 $opt_debug
2050 if test -z "$4" && test -n "$3"; then
2051 func_error "Could not determine the host path corresponding to"
2052 func_error " \`$3'"
2053 func_error "Continuing, but uninstalled executables may not work."
2054 # Fallback. This is a deliberately simplistic "conversion" and
2055 # should not be "improved". See libtool.info.
2056 if test "x$1" != "x$2"; then
2057 lt_replace_pathsep_chars="s|$1|$2|g"
2058 func_to_host_path_result=`echo "$3" |
2059 $SED -e "$lt_replace_pathsep_chars"`
2060 else
2061 func_to_host_path_result="$3"
2062 fi
2063 fi
2064}
2065# end func_convert_path_check
2066
2067
2068# func_convert_path_front_back_pathsep FRONTPAT BACKPAT REPL ORIG
2069# Modifies func_to_host_path_result by prepending REPL if ORIG matches FRONTPAT
2070# and appending REPL if ORIG matches BACKPAT.
2071func_convert_path_front_back_pathsep ()
2072{
2073 $opt_debug
2074 case $4 in
2075 $1 ) func_to_host_path_result="$3$func_to_host_path_result"
2076 ;;
2077 esac
2078 case $4 in
2079 $2 ) func_to_host_path_result+="$3"
2080 ;;
2081 esac
2082}
2083# end func_convert_path_front_back_pathsep
2084
2085
2086##################################################
2087# $build to $host FILE NAME CONVERSION FUNCTIONS #
2088##################################################
2089# invoked via `$to_host_file_cmd ARG'
2090#
2091# In each case, ARG is the path to be converted from $build to $host format.
2092# Result will be available in $func_to_host_file_result.
2093
2094
2095# func_to_host_file ARG
2096# Converts the file name ARG from $build format to $host format. Return result
2097# in func_to_host_file_result.
2098func_to_host_file ()
2099{
2100 $opt_debug
2101 $to_host_file_cmd "$1"
2102}
2103# end func_to_host_file
2104
2105
2106# func_to_tool_file ARG LAZY
2107# converts the file name ARG from $build format to toolchain format. Return
2108# result in func_to_tool_file_result. If the conversion in use is listed
2109# in (the comma separated) LAZY, no conversion takes place.
2110func_to_tool_file ()
2111{
2112 $opt_debug
2113 case ,$2, in
2114 *,"$to_tool_file_cmd",*)
2115 func_to_tool_file_result=$1
2116 ;;
2117 *)
2118 $to_tool_file_cmd "$1"
2119 func_to_tool_file_result=$func_to_host_file_result
2120 ;;
2121 esac
2122}
2123# end func_to_tool_file
2124
2125
2126# func_convert_file_noop ARG
2127# Copy ARG to func_to_host_file_result.
2128func_convert_file_noop ()
2129{
2130 func_to_host_file_result="$1"
2131}
2132# end func_convert_file_noop
2133
2134
2135# func_convert_file_msys_to_w32 ARG
2136# Convert file name ARG from (mingw) MSYS to (mingw) w32 format; automatic
2137# conversion to w32 is not available inside the cwrapper. Returns result in
2138# func_to_host_file_result.
2139func_convert_file_msys_to_w32 ()
2140{
2141 $opt_debug
2142 func_to_host_file_result="$1"
2143 if test -n "$1"; then
2144 func_convert_core_msys_to_w32 "$1"
2145 func_to_host_file_result="$func_convert_core_msys_to_w32_result"
2146 fi
2147 func_convert_file_check "$1" "$func_to_host_file_result"
2148}
2149# end func_convert_file_msys_to_w32
2150
2151
2152# func_convert_file_cygwin_to_w32 ARG
2153# Convert file name ARG from Cygwin to w32 format. Returns result in
2154# func_to_host_file_result.
2155func_convert_file_cygwin_to_w32 ()
2156{
2157 $opt_debug
2158 func_to_host_file_result="$1"
2159 if test -n "$1"; then
2160 # because $build is cygwin, we call "the" cygpath in $PATH; no need to use
2161 # LT_CYGPATH in this case.
2162 func_to_host_file_result=`cygpath -m "$1"`
2163 fi
2164 func_convert_file_check "$1" "$func_to_host_file_result"
2165}
2166# end func_convert_file_cygwin_to_w32
2167
2168
2169# func_convert_file_nix_to_w32 ARG
2170# Convert file name ARG from *nix to w32 format. Requires a wine environment
2171# and a working winepath. Returns result in func_to_host_file_result.
2172func_convert_file_nix_to_w32 ()
2173{
2174 $opt_debug
2175 func_to_host_file_result="$1"
2176 if test -n "$1"; then
2177 func_convert_core_file_wine_to_w32 "$1"
2178 func_to_host_file_result="$func_convert_core_file_wine_to_w32_result"
2179 fi
2180 func_convert_file_check "$1" "$func_to_host_file_result"
2181}
2182# end func_convert_file_nix_to_w32
2183
2184
2185# func_convert_file_msys_to_cygwin ARG
2186# Convert file name ARG from MSYS to Cygwin format. Requires LT_CYGPATH set.
2187# Returns result in func_to_host_file_result.
2188func_convert_file_msys_to_cygwin ()
2189{
2190 $opt_debug
2191 func_to_host_file_result="$1"
2192 if test -n "$1"; then
2193 func_convert_core_msys_to_w32 "$1"
2194 func_cygpath -u "$func_convert_core_msys_to_w32_result"
2195 func_to_host_file_result="$func_cygpath_result"
2196 fi
2197 func_convert_file_check "$1" "$func_to_host_file_result"
2198}
2199# end func_convert_file_msys_to_cygwin
2200
2201
2202# func_convert_file_nix_to_cygwin ARG
2203# Convert file name ARG from *nix to Cygwin format. Requires Cygwin installed
2204# in a wine environment, working winepath, and LT_CYGPATH set. Returns result
2205# in func_to_host_file_result.
2206func_convert_file_nix_to_cygwin ()
2207{
2208 $opt_debug
2209 func_to_host_file_result="$1"
2210 if test -n "$1"; then
2211 # convert from *nix to w32, then use cygpath to convert from w32 to cygwin.
2212 func_convert_core_file_wine_to_w32 "$1"
2213 func_cygpath -u "$func_convert_core_file_wine_to_w32_result"
2214 func_to_host_file_result="$func_cygpath_result"
2215 fi
2216 func_convert_file_check "$1" "$func_to_host_file_result"
2217}
2218# end func_convert_file_nix_to_cygwin
2219
2220
2221#############################################
2222# $build to $host PATH CONVERSION FUNCTIONS #
2223#############################################
2224# invoked via `$to_host_path_cmd ARG'
2225#
2226# In each case, ARG is the path to be converted from $build to $host format.
2227# The result will be available in $func_to_host_path_result.
2228#
2229# Path separators are also converted from $build format to $host format. If
2230# ARG begins or ends with a path separator character, it is preserved (but
2231# converted to $host format) on output.
2232#
2233# All path conversion functions are named using the following convention:
2234# file name conversion function : func_convert_file_X_to_Y ()
2235# path conversion function : func_convert_path_X_to_Y ()
2236# where, for any given $build/$host combination the 'X_to_Y' value is the
2237# same. If conversion functions are added for new $build/$host combinations,
2238# the two new functions must follow this pattern, or func_init_to_host_path_cmd
2239# will break.
2240
2241
2242# func_init_to_host_path_cmd
2243# Ensures that function "pointer" variable $to_host_path_cmd is set to the
2244# appropriate value, based on the value of $to_host_file_cmd.
2245to_host_path_cmd=
2246func_init_to_host_path_cmd ()
2247{
2248 $opt_debug
2249 if test -z "$to_host_path_cmd"; then
2250 func_stripname 'func_convert_file_' '' "$to_host_file_cmd"
2251 to_host_path_cmd="func_convert_path_${func_stripname_result}"
2252 fi
2253}
2254
2255
2256# func_to_host_path ARG
2257# Converts the path ARG from $build format to $host format. Return result
2258# in func_to_host_path_result.
2259func_to_host_path ()
2260{
2261 $opt_debug
2262 func_init_to_host_path_cmd
2263 $to_host_path_cmd "$1"
2264}
2265# end func_to_host_path
2266
2267
2268# func_convert_path_noop ARG
2269# Copy ARG to func_to_host_path_result.
2270func_convert_path_noop ()
2271{
2272 func_to_host_path_result="$1"
2273}
2274# end func_convert_path_noop
2275
2276
2277# func_convert_path_msys_to_w32 ARG
2278# Convert path ARG from (mingw) MSYS to (mingw) w32 format; automatic
2279# conversion to w32 is not available inside the cwrapper. Returns result in
2280# func_to_host_path_result.
2281func_convert_path_msys_to_w32 ()
2282{
2283 $opt_debug
2284 func_to_host_path_result="$1"
2285 if test -n "$1"; then
2286 # Remove leading and trailing path separator characters from ARG. MSYS
2287 # behavior is inconsistent here; cygpath turns them into '.;' and ';.';
2288 # and winepath ignores them completely.
2289 func_stripname : : "$1"
2290 func_to_host_path_tmp1=$func_stripname_result
2291 func_convert_core_msys_to_w32 "$func_to_host_path_tmp1"
2292 func_to_host_path_result="$func_convert_core_msys_to_w32_result"
2293 func_convert_path_check : ";" \
2294 "$func_to_host_path_tmp1" "$func_to_host_path_result"
2295 func_convert_path_front_back_pathsep ":*" "*:" ";" "$1"
2296 fi
2297}
2298# end func_convert_path_msys_to_w32
2299
2300
2301# func_convert_path_cygwin_to_w32 ARG
2302# Convert path ARG from Cygwin to w32 format. Returns result in
2303# func_to_host_file_result.
2304func_convert_path_cygwin_to_w32 ()
2305{
2306 $opt_debug
2307 func_to_host_path_result="$1"
2308 if test -n "$1"; then
2309 # See func_convert_path_msys_to_w32:
2310 func_stripname : : "$1"
2311 func_to_host_path_tmp1=$func_stripname_result
2312 func_to_host_path_result=`cygpath -m -p "$func_to_host_path_tmp1"`
2313 func_convert_path_check : ";" \
2314 "$func_to_host_path_tmp1" "$func_to_host_path_result"
2315 func_convert_path_front_back_pathsep ":*" "*:" ";" "$1"
2316 fi
2317}
2318# end func_convert_path_cygwin_to_w32
2319
2320
2321# func_convert_path_nix_to_w32 ARG
2322# Convert path ARG from *nix to w32 format. Requires a wine environment and
2323# a working winepath. Returns result in func_to_host_file_result.
2324func_convert_path_nix_to_w32 ()
2325{
2326 $opt_debug
2327 func_to_host_path_result="$1"
2328 if test -n "$1"; then
2329 # See func_convert_path_msys_to_w32:
2330 func_stripname : : "$1"
2331 func_to_host_path_tmp1=$func_stripname_result
2332 func_convert_core_path_wine_to_w32 "$func_to_host_path_tmp1"
2333 func_to_host_path_result="$func_convert_core_path_wine_to_w32_result"
2334 func_convert_path_check : ";" \
2335 "$func_to_host_path_tmp1" "$func_to_host_path_result"
2336 func_convert_path_front_back_pathsep ":*" "*:" ";" "$1"
2337 fi
2338}
2339# end func_convert_path_nix_to_w32
2340
2341
2342# func_convert_path_msys_to_cygwin ARG
2343# Convert path ARG from MSYS to Cygwin format. Requires LT_CYGPATH set.
2344# Returns result in func_to_host_file_result.
2345func_convert_path_msys_to_cygwin ()
2346{
2347 $opt_debug
2348 func_to_host_path_result="$1"
2349 if test -n "$1"; then
2350 # See func_convert_path_msys_to_w32:
2351 func_stripname : : "$1"
2352 func_to_host_path_tmp1=$func_stripname_result
2353 func_convert_core_msys_to_w32 "$func_to_host_path_tmp1"
2354 func_cygpath -u -p "$func_convert_core_msys_to_w32_result"
2355 func_to_host_path_result="$func_cygpath_result"
2356 func_convert_path_check : : \
2357 "$func_to_host_path_tmp1" "$func_to_host_path_result"
2358 func_convert_path_front_back_pathsep ":*" "*:" : "$1"
2359 fi
2360}
2361# end func_convert_path_msys_to_cygwin
2362
2363
2364# func_convert_path_nix_to_cygwin ARG
2365# Convert path ARG from *nix to Cygwin format. Requires Cygwin installed in a
2366# a wine environment, working winepath, and LT_CYGPATH set. Returns result in
2367# func_to_host_file_result.
2368func_convert_path_nix_to_cygwin ()
2369{
2370 $opt_debug
2371 func_to_host_path_result="$1"
2372 if test -n "$1"; then
2373 # Remove leading and trailing path separator characters from
2374 # ARG. msys behavior is inconsistent here, cygpath turns them
2375 # into '.;' and ';.', and winepath ignores them completely.
2376 func_stripname : : "$1"
2377 func_to_host_path_tmp1=$func_stripname_result
2378 func_convert_core_path_wine_to_w32 "$func_to_host_path_tmp1"
2379 func_cygpath -u -p "$func_convert_core_path_wine_to_w32_result"
2380 func_to_host_path_result="$func_cygpath_result"
2381 func_convert_path_check : : \
2382 "$func_to_host_path_tmp1" "$func_to_host_path_result"
2383 func_convert_path_front_back_pathsep ":*" "*:" : "$1"
2384 fi
2385}
2386# end func_convert_path_nix_to_cygwin
2387
2388
cristy3ed852e2009-09-05 21:47:34 +00002389# func_mode_compile arg...
2390func_mode_compile ()
2391{
2392 $opt_debug
2393 # Get the compilation command and the source file.
2394 base_compile=
2395 srcfile="$nonopt" # always keep a non-empty value in "srcfile"
2396 suppress_opt=yes
2397 suppress_output=
2398 arg_mode=normal
2399 libobj=
2400 later=
2401 pie_flag=
2402
2403 for arg
2404 do
2405 case $arg_mode in
2406 arg )
2407 # do not "continue". Instead, add this to base_compile
2408 lastarg="$arg"
2409 arg_mode=normal
2410 ;;
2411
2412 target )
2413 libobj="$arg"
2414 arg_mode=normal
2415 continue
2416 ;;
2417
2418 normal )
2419 # Accept any command-line options.
2420 case $arg in
2421 -o)
2422 test -n "$libobj" && \
2423 func_fatal_error "you cannot specify \`-o' more than once"
2424 arg_mode=target
2425 continue
2426 ;;
2427
2428 -pie | -fpie | -fPIE)
cristyda16f162011-02-19 23:52:17 +00002429 pie_flag+=" $arg"
cristy3ed852e2009-09-05 21:47:34 +00002430 continue
2431 ;;
2432
2433 -shared | -static | -prefer-pic | -prefer-non-pic)
cristyda16f162011-02-19 23:52:17 +00002434 later+=" $arg"
cristy3ed852e2009-09-05 21:47:34 +00002435 continue
2436 ;;
2437
2438 -no-suppress)
2439 suppress_opt=no
2440 continue
2441 ;;
2442
2443 -Xcompiler)
2444 arg_mode=arg # the next one goes into the "base_compile" arg list
2445 continue # The current "srcfile" will either be retained or
2446 ;; # replaced later. I would guess that would be a bug.
2447
2448 -Wc,*)
2449 func_stripname '-Wc,' '' "$arg"
2450 args=$func_stripname_result
2451 lastarg=
2452 save_ifs="$IFS"; IFS=','
2453 for arg in $args; do
2454 IFS="$save_ifs"
cristyda16f162011-02-19 23:52:17 +00002455 func_append_quoted lastarg "$arg"
cristy3ed852e2009-09-05 21:47:34 +00002456 done
2457 IFS="$save_ifs"
2458 func_stripname ' ' '' "$lastarg"
2459 lastarg=$func_stripname_result
2460
2461 # Add the arguments to base_compile.
cristyda16f162011-02-19 23:52:17 +00002462 base_compile+=" $lastarg"
cristy3ed852e2009-09-05 21:47:34 +00002463 continue
2464 ;;
2465
2466 *)
2467 # Accept the current argument as the source file.
2468 # The previous "srcfile" becomes the current argument.
2469 #
2470 lastarg="$srcfile"
2471 srcfile="$arg"
2472 ;;
2473 esac # case $arg
2474 ;;
2475 esac # case $arg_mode
2476
2477 # Aesthetically quote the previous argument.
cristyda16f162011-02-19 23:52:17 +00002478 func_append_quoted base_compile "$lastarg"
cristy3ed852e2009-09-05 21:47:34 +00002479 done # for arg
2480
2481 case $arg_mode in
2482 arg)
2483 func_fatal_error "you must specify an argument for -Xcompile"
2484 ;;
2485 target)
2486 func_fatal_error "you must specify a target with \`-o'"
2487 ;;
2488 *)
2489 # Get the name of the library object.
2490 test -z "$libobj" && {
2491 func_basename "$srcfile"
2492 libobj="$func_basename_result"
2493 }
2494 ;;
2495 esac
2496
2497 # Recognize several different file suffixes.
2498 # If the user specifies -o file.o, it is replaced with file.lo
2499 case $libobj in
2500 *.[cCFSifmso] | \
2501 *.ada | *.adb | *.ads | *.asm | \
2502 *.c++ | *.cc | *.ii | *.class | *.cpp | *.cxx | \
cristy2542fc62011-12-06 17:50:25 +00002503 *.[fF][09]? | *.for | *.java | *.go | *.obj | *.sx | *.cu | *.cup)
cristy3ed852e2009-09-05 21:47:34 +00002504 func_xform "$libobj"
2505 libobj=$func_xform_result
2506 ;;
2507 esac
2508
2509 case $libobj in
2510 *.lo) func_lo2o "$libobj"; obj=$func_lo2o_result ;;
2511 *)
2512 func_fatal_error "cannot determine name of library object from \`$libobj'"
2513 ;;
2514 esac
2515
2516 func_infer_tag $base_compile
2517
2518 for arg in $later; do
2519 case $arg in
2520 -shared)
2521 test "$build_libtool_libs" != yes && \
2522 func_fatal_configuration "can not build a shared library"
2523 build_old_libs=no
2524 continue
2525 ;;
2526
2527 -static)
2528 build_libtool_libs=no
2529 build_old_libs=yes
2530 continue
2531 ;;
2532
2533 -prefer-pic)
2534 pic_mode=yes
2535 continue
2536 ;;
2537
2538 -prefer-non-pic)
2539 pic_mode=no
2540 continue
2541 ;;
2542 esac
2543 done
2544
2545 func_quote_for_eval "$libobj"
2546 test "X$libobj" != "X$func_quote_for_eval_result" \
2547 && $ECHO "X$libobj" | $GREP '[]~#^*{};<>?"'"'"' &()|`$[]' \
2548 && func_warning "libobj name \`$libobj' may not contain shell special characters."
2549 func_dirname_and_basename "$obj" "/" ""
2550 objname="$func_basename_result"
2551 xdir="$func_dirname_result"
2552 lobj=${xdir}$objdir/$objname
2553
2554 test -z "$base_compile" && \
2555 func_fatal_help "you must specify a compilation command"
2556
2557 # Delete any leftover library objects.
2558 if test "$build_old_libs" = yes; then
2559 removelist="$obj $lobj $libobj ${libobj}T"
2560 else
2561 removelist="$lobj $libobj ${libobj}T"
2562 fi
2563
2564 # On Cygwin there's no "real" PIC flag so we must build both object types
2565 case $host_os in
2566 cygwin* | mingw* | pw32* | os2* | cegcc*)
2567 pic_mode=default
2568 ;;
2569 esac
2570 if test "$pic_mode" = no && test "$deplibs_check_method" != pass_all; then
2571 # non-PIC code in shared libraries is not supported
2572 pic_mode=default
2573 fi
2574
2575 # Calculate the filename of the output object if compiler does
2576 # not support -o with -c
2577 if test "$compiler_c_o" = no; then
cristy98dddb52010-11-04 00:30:15 +00002578 output_obj=`$ECHO "$srcfile" | $SED 's%^.*/%%; s%\.[^.]*$%%'`.${objext}
cristy3ed852e2009-09-05 21:47:34 +00002579 lockfile="$output_obj.lock"
2580 else
2581 output_obj=
2582 need_locks=no
2583 lockfile=
2584 fi
2585
2586 # Lock this critical section if it is needed
2587 # We use this script file to make the link, it avoids creating a new file
2588 if test "$need_locks" = yes; then
2589 until $opt_dry_run || ln "$progpath" "$lockfile" 2>/dev/null; do
2590 func_echo "Waiting for $lockfile to be removed"
2591 sleep 2
2592 done
2593 elif test "$need_locks" = warn; then
2594 if test -f "$lockfile"; then
2595 $ECHO "\
2596*** ERROR, $lockfile exists and contains:
2597`cat $lockfile 2>/dev/null`
2598
2599This indicates that another process is trying to use the same
2600temporary object file, and libtool could not work around it because
2601your compiler does not support \`-c' and \`-o' together. If you
2602repeat this compilation, it may succeed, by chance, but you had better
2603avoid parallel builds (make -j) in this platform, or get a better
2604compiler."
2605
2606 $opt_dry_run || $RM $removelist
2607 exit $EXIT_FAILURE
2608 fi
cristyda16f162011-02-19 23:52:17 +00002609 removelist+=" $output_obj"
cristy3ed852e2009-09-05 21:47:34 +00002610 $ECHO "$srcfile" > "$lockfile"
2611 fi
2612
2613 $opt_dry_run || $RM $removelist
cristyda16f162011-02-19 23:52:17 +00002614 removelist+=" $lockfile"
cristy3ed852e2009-09-05 21:47:34 +00002615 trap '$opt_dry_run || $RM $removelist; exit $EXIT_FAILURE' 1 2 15
2616
cristyda16f162011-02-19 23:52:17 +00002617 func_to_tool_file "$srcfile" func_convert_file_msys_to_w32
2618 srcfile=$func_to_tool_file_result
cristy3ed852e2009-09-05 21:47:34 +00002619 func_quote_for_eval "$srcfile"
2620 qsrcfile=$func_quote_for_eval_result
2621
2622 # Only build a PIC object if we are building libtool libraries.
2623 if test "$build_libtool_libs" = yes; then
2624 # Without this assignment, base_compile gets emptied.
2625 fbsd_hideous_sh_bug=$base_compile
2626
2627 if test "$pic_mode" != no; then
2628 command="$base_compile $qsrcfile $pic_flag"
2629 else
2630 # Don't build PIC code
2631 command="$base_compile $qsrcfile"
2632 fi
2633
2634 func_mkdir_p "$xdir$objdir"
2635
2636 if test -z "$output_obj"; then
2637 # Place PIC objects in $objdir
cristyda16f162011-02-19 23:52:17 +00002638 command+=" -o $lobj"
cristy3ed852e2009-09-05 21:47:34 +00002639 fi
2640
2641 func_show_eval_locale "$command" \
2642 'test -n "$output_obj" && $RM $removelist; exit $EXIT_FAILURE'
2643
2644 if test "$need_locks" = warn &&
2645 test "X`cat $lockfile 2>/dev/null`" != "X$srcfile"; then
2646 $ECHO "\
2647*** ERROR, $lockfile contains:
2648`cat $lockfile 2>/dev/null`
2649
2650but it should contain:
2651$srcfile
2652
2653This indicates that another process is trying to use the same
2654temporary object file, and libtool could not work around it because
2655your compiler does not support \`-c' and \`-o' together. If you
2656repeat this compilation, it may succeed, by chance, but you had better
2657avoid parallel builds (make -j) in this platform, or get a better
2658compiler."
2659
2660 $opt_dry_run || $RM $removelist
2661 exit $EXIT_FAILURE
2662 fi
2663
2664 # Just move the object if needed, then go on to compile the next one
2665 if test -n "$output_obj" && test "X$output_obj" != "X$lobj"; then
2666 func_show_eval '$MV "$output_obj" "$lobj"' \
2667 'error=$?; $opt_dry_run || $RM $removelist; exit $error'
2668 fi
2669
2670 # Allow error messages only from the first compilation.
2671 if test "$suppress_opt" = yes; then
2672 suppress_output=' >/dev/null 2>&1'
2673 fi
2674 fi
2675
2676 # Only build a position-dependent object if we build old libraries.
2677 if test "$build_old_libs" = yes; then
2678 if test "$pic_mode" != yes; then
2679 # Don't build PIC code
2680 command="$base_compile $qsrcfile$pie_flag"
2681 else
2682 command="$base_compile $qsrcfile $pic_flag"
2683 fi
2684 if test "$compiler_c_o" = yes; then
cristyda16f162011-02-19 23:52:17 +00002685 command+=" -o $obj"
cristy3ed852e2009-09-05 21:47:34 +00002686 fi
2687
2688 # Suppress compiler output if we already did a PIC compilation.
cristyda16f162011-02-19 23:52:17 +00002689 command+="$suppress_output"
cristy3ed852e2009-09-05 21:47:34 +00002690 func_show_eval_locale "$command" \
2691 '$opt_dry_run || $RM $removelist; exit $EXIT_FAILURE'
2692
2693 if test "$need_locks" = warn &&
2694 test "X`cat $lockfile 2>/dev/null`" != "X$srcfile"; then
2695 $ECHO "\
2696*** ERROR, $lockfile contains:
2697`cat $lockfile 2>/dev/null`
2698
2699but it should contain:
2700$srcfile
2701
2702This indicates that another process is trying to use the same
2703temporary object file, and libtool could not work around it because
2704your compiler does not support \`-c' and \`-o' together. If you
2705repeat this compilation, it may succeed, by chance, but you had better
2706avoid parallel builds (make -j) in this platform, or get a better
2707compiler."
2708
2709 $opt_dry_run || $RM $removelist
2710 exit $EXIT_FAILURE
2711 fi
2712
2713 # Just move the object if needed
2714 if test -n "$output_obj" && test "X$output_obj" != "X$obj"; then
2715 func_show_eval '$MV "$output_obj" "$obj"' \
2716 'error=$?; $opt_dry_run || $RM $removelist; exit $error'
2717 fi
2718 fi
2719
2720 $opt_dry_run || {
2721 func_write_libtool_object "$libobj" "$objdir/$objname" "$objname"
2722
2723 # Unlock the critical section if it was locked
2724 if test "$need_locks" != no; then
2725 removelist=$lockfile
2726 $RM "$lockfile"
2727 fi
2728 }
2729
2730 exit $EXIT_SUCCESS
2731}
2732
2733$opt_help || {
cristyda16f162011-02-19 23:52:17 +00002734 test "$opt_mode" = compile && func_mode_compile ${1+"$@"}
cristy3ed852e2009-09-05 21:47:34 +00002735}
2736
2737func_mode_help ()
2738{
2739 # We need to display help for each of the modes.
cristyda16f162011-02-19 23:52:17 +00002740 case $opt_mode in
cristy3ed852e2009-09-05 21:47:34 +00002741 "")
2742 # Generic help is extracted from the usage comments
2743 # at the start of this file.
2744 func_help
2745 ;;
2746
2747 clean)
2748 $ECHO \
2749"Usage: $progname [OPTION]... --mode=clean RM [RM-OPTION]... FILE...
2750
2751Remove files from the build directory.
2752
2753RM is the name of the program to use to delete files associated with each FILE
2754(typically \`/bin/rm'). RM-OPTIONS are options (such as \`-f') to be passed
2755to RM.
2756
2757If FILE is a libtool library, object or program, all the files associated
2758with it are deleted. Otherwise, only FILE itself is deleted using RM."
2759 ;;
2760
2761 compile)
2762 $ECHO \
2763"Usage: $progname [OPTION]... --mode=compile COMPILE-COMMAND... SOURCEFILE
2764
2765Compile a source file into a libtool library object.
2766
2767This mode accepts the following additional options:
2768
2769 -o OUTPUT-FILE set the output file name to OUTPUT-FILE
2770 -no-suppress do not suppress compiler output for multiple passes
cristy98dddb52010-11-04 00:30:15 +00002771 -prefer-pic try to build PIC objects only
2772 -prefer-non-pic try to build non-PIC objects only
cristy3ed852e2009-09-05 21:47:34 +00002773 -shared do not build a \`.o' file suitable for static linking
2774 -static only build a \`.o' file suitable for static linking
cristy98dddb52010-11-04 00:30:15 +00002775 -Wc,FLAG pass FLAG directly to the compiler
cristy3ed852e2009-09-05 21:47:34 +00002776
2777COMPILE-COMMAND is a command to be used in creating a \`standard' object file
2778from the given SOURCEFILE.
2779
2780The output file name is determined by removing the directory component from
2781SOURCEFILE, then substituting the C source code suffix \`.c' with the
2782library object suffix, \`.lo'."
2783 ;;
2784
2785 execute)
2786 $ECHO \
2787"Usage: $progname [OPTION]... --mode=execute COMMAND [ARGS]...
2788
2789Automatically set library path, then run a program.
2790
2791This mode accepts the following additional options:
2792
2793 -dlopen FILE add the directory containing FILE to the library path
2794
2795This mode sets the library path environment variable according to \`-dlopen'
2796flags.
2797
2798If any of the ARGS are libtool executable wrappers, then they are translated
2799into their corresponding uninstalled binary, and any of their required library
2800directories are added to the library path.
2801
2802Then, COMMAND is executed, with ARGS as arguments."
2803 ;;
2804
2805 finish)
2806 $ECHO \
2807"Usage: $progname [OPTION]... --mode=finish [LIBDIR]...
2808
2809Complete the installation of libtool libraries.
2810
2811Each LIBDIR is a directory that contains libtool libraries.
2812
2813The commands that this mode executes may require superuser privileges. Use
2814the \`--dry-run' option if you just want to see what would be executed."
2815 ;;
2816
2817 install)
2818 $ECHO \
2819"Usage: $progname [OPTION]... --mode=install INSTALL-COMMAND...
2820
2821Install executables or libraries.
2822
2823INSTALL-COMMAND is the installation command. The first component should be
2824either the \`install' or \`cp' program.
2825
2826The following components of INSTALL-COMMAND are treated specially:
2827
cristy98dddb52010-11-04 00:30:15 +00002828 -inst-prefix-dir PREFIX-DIR Use PREFIX-DIR as a staging area for installation
cristy3ed852e2009-09-05 21:47:34 +00002829
2830The rest of the components are interpreted as arguments to that command (only
2831BSD-compatible install options are recognized)."
2832 ;;
2833
2834 link)
2835 $ECHO \
2836"Usage: $progname [OPTION]... --mode=link LINK-COMMAND...
2837
2838Link object files or libraries together to form another library, or to
2839create an executable program.
2840
2841LINK-COMMAND is a command using the C compiler that you would use to create
2842a program from several object files.
2843
2844The following components of LINK-COMMAND are treated specially:
2845
2846 -all-static do not do any dynamic linking at all
2847 -avoid-version do not add a version suffix if possible
cristy98dddb52010-11-04 00:30:15 +00002848 -bindir BINDIR specify path to binaries directory (for systems where
2849 libraries must be found in the PATH setting at runtime)
cristy3ed852e2009-09-05 21:47:34 +00002850 -dlopen FILE \`-dlpreopen' FILE if it cannot be dlopened at runtime
2851 -dlpreopen FILE link in FILE and add its symbols to lt_preloaded_symbols
2852 -export-dynamic allow symbols from OUTPUT-FILE to be resolved with dlsym(3)
2853 -export-symbols SYMFILE
2854 try to export only the symbols listed in SYMFILE
2855 -export-symbols-regex REGEX
2856 try to export only the symbols matching REGEX
2857 -LLIBDIR search LIBDIR for required installed libraries
2858 -lNAME OUTPUT-FILE requires the installed library libNAME
2859 -module build a library that can dlopened
2860 -no-fast-install disable the fast-install mode
2861 -no-install link a not-installable executable
2862 -no-undefined declare that a library does not refer to external symbols
2863 -o OUTPUT-FILE create OUTPUT-FILE from the specified objects
2864 -objectlist FILE Use a list of object files found in FILE to specify objects
2865 -precious-files-regex REGEX
2866 don't remove output files matching REGEX
2867 -release RELEASE specify package release information
2868 -rpath LIBDIR the created library will eventually be installed in LIBDIR
2869 -R[ ]LIBDIR add LIBDIR to the runtime path of programs and libraries
2870 -shared only do dynamic linking of libtool libraries
2871 -shrext SUFFIX override the standard shared library file extension
2872 -static do not do any dynamic linking of uninstalled libtool libraries
2873 -static-libtool-libs
2874 do not do any dynamic linking of libtool libraries
2875 -version-info CURRENT[:REVISION[:AGE]]
2876 specify library version info [each variable defaults to 0]
2877 -weak LIBNAME declare that the target provides the LIBNAME interface
cristy98dddb52010-11-04 00:30:15 +00002878 -Wc,FLAG
2879 -Xcompiler FLAG pass linker-specific FLAG directly to the compiler
2880 -Wl,FLAG
2881 -Xlinker FLAG pass linker-specific FLAG directly to the linker
2882 -XCClinker FLAG pass link-specific FLAG to the compiler driver (CC)
cristy3ed852e2009-09-05 21:47:34 +00002883
2884All other options (arguments beginning with \`-') are ignored.
2885
2886Every other argument is treated as a filename. Files ending in \`.la' are
2887treated as uninstalled libtool libraries, other files are standard or library
2888object files.
2889
2890If the OUTPUT-FILE ends in \`.la', then a libtool library is created,
2891only library objects (\`.lo' files) may be specified, and \`-rpath' is
2892required, except when creating a convenience library.
2893
2894If OUTPUT-FILE ends in \`.a' or \`.lib', then a standard library is created
2895using \`ar' and \`ranlib', or on Windows using \`lib'.
2896
2897If OUTPUT-FILE ends in \`.lo' or \`.${objext}', then a reloadable object file
2898is created, otherwise an executable program is created."
2899 ;;
2900
2901 uninstall)
2902 $ECHO \
2903"Usage: $progname [OPTION]... --mode=uninstall RM [RM-OPTION]... FILE...
2904
2905Remove libraries from an installation directory.
2906
2907RM is the name of the program to use to delete files associated with each FILE
2908(typically \`/bin/rm'). RM-OPTIONS are options (such as \`-f') to be passed
2909to RM.
2910
2911If FILE is a libtool library, all the files associated with it are deleted.
2912Otherwise, only FILE itself is deleted using RM."
2913 ;;
2914
2915 *)
cristyda16f162011-02-19 23:52:17 +00002916 func_fatal_help "invalid operation mode \`$opt_mode'"
cristy3ed852e2009-09-05 21:47:34 +00002917 ;;
2918 esac
2919
cristy98dddb52010-11-04 00:30:15 +00002920 echo
cristy3ed852e2009-09-05 21:47:34 +00002921 $ECHO "Try \`$progname --help' for more information about other modes."
cristy3ed852e2009-09-05 21:47:34 +00002922}
2923
cristy98dddb52010-11-04 00:30:15 +00002924# Now that we've collected a possible --mode arg, show help if necessary
2925if $opt_help; then
2926 if test "$opt_help" = :; then
2927 func_mode_help
2928 else
2929 {
2930 func_help noexit
cristyda16f162011-02-19 23:52:17 +00002931 for opt_mode in compile link execute install finish uninstall clean; do
cristy98dddb52010-11-04 00:30:15 +00002932 func_mode_help
2933 done
2934 } | sed -n '1p; 2,$s/^Usage:/ or: /p'
2935 {
2936 func_help noexit
cristyda16f162011-02-19 23:52:17 +00002937 for opt_mode in compile link execute install finish uninstall clean; do
cristy98dddb52010-11-04 00:30:15 +00002938 echo
2939 func_mode_help
2940 done
2941 } |
2942 sed '1d
2943 /^When reporting/,/^Report/{
2944 H
2945 d
2946 }
2947 $x
2948 /information about other modes/d
2949 /more detailed .*MODE/d
2950 s/^Usage:.*--mode=\([^ ]*\) .*/Description of \1 mode:/'
2951 fi
2952 exit $?
2953fi
cristy3ed852e2009-09-05 21:47:34 +00002954
2955
2956# func_mode_execute arg...
2957func_mode_execute ()
2958{
2959 $opt_debug
2960 # The first argument is the command name.
2961 cmd="$nonopt"
2962 test -z "$cmd" && \
2963 func_fatal_help "you must specify a COMMAND"
2964
2965 # Handle -dlopen flags immediately.
cristyda16f162011-02-19 23:52:17 +00002966 for file in $opt_dlopen; do
cristy3ed852e2009-09-05 21:47:34 +00002967 test -f "$file" \
2968 || func_fatal_help "\`$file' is not a file"
2969
2970 dir=
2971 case $file in
2972 *.la)
cristyda16f162011-02-19 23:52:17 +00002973 func_resolve_sysroot "$file"
2974 file=$func_resolve_sysroot_result
2975
cristy3ed852e2009-09-05 21:47:34 +00002976 # Check to see that this really is a libtool archive.
2977 func_lalib_unsafe_p "$file" \
2978 || func_fatal_help "\`$lib' is not a valid libtool archive"
2979
2980 # Read the libtool library.
2981 dlname=
2982 library_names=
2983 func_source "$file"
2984
2985 # Skip this library if it cannot be dlopened.
2986 if test -z "$dlname"; then
2987 # Warn if it was a shared library.
2988 test -n "$library_names" && \
2989 func_warning "\`$file' was not linked with \`-export-dynamic'"
2990 continue
2991 fi
2992
2993 func_dirname "$file" "" "."
2994 dir="$func_dirname_result"
2995
2996 if test -f "$dir/$objdir/$dlname"; then
cristyda16f162011-02-19 23:52:17 +00002997 dir+="/$objdir"
cristy3ed852e2009-09-05 21:47:34 +00002998 else
2999 if test ! -f "$dir/$dlname"; then
3000 func_fatal_error "cannot find \`$dlname' in \`$dir' or \`$dir/$objdir'"
3001 fi
3002 fi
3003 ;;
3004
3005 *.lo)
3006 # Just add the directory containing the .lo file.
3007 func_dirname "$file" "" "."
3008 dir="$func_dirname_result"
3009 ;;
3010
3011 *)
3012 func_warning "\`-dlopen' is ignored for non-libtool libraries and objects"
3013 continue
3014 ;;
3015 esac
3016
3017 # Get the absolute pathname.
3018 absdir=`cd "$dir" && pwd`
3019 test -n "$absdir" && dir="$absdir"
3020
3021 # Now add the directory to shlibpath_var.
3022 if eval "test -z \"\$$shlibpath_var\""; then
3023 eval "$shlibpath_var=\"\$dir\""
3024 else
3025 eval "$shlibpath_var=\"\$dir:\$$shlibpath_var\""
3026 fi
3027 done
3028
3029 # This variable tells wrapper scripts just to set shlibpath_var
3030 # rather than running their programs.
3031 libtool_execute_magic="$magic"
3032
3033 # Check if any of the arguments is a wrapper script.
3034 args=
3035 for file
3036 do
3037 case $file in
cristy98dddb52010-11-04 00:30:15 +00003038 -* | *.la | *.lo ) ;;
cristy3ed852e2009-09-05 21:47:34 +00003039 *)
3040 # Do a test to see if this is really a libtool program.
3041 if func_ltwrapper_script_p "$file"; then
3042 func_source "$file"
3043 # Transform arg to wrapped name.
3044 file="$progdir/$program"
3045 elif func_ltwrapper_executable_p "$file"; then
3046 func_ltwrapper_scriptname "$file"
3047 func_source "$func_ltwrapper_scriptname_result"
3048 # Transform arg to wrapped name.
3049 file="$progdir/$program"
3050 fi
3051 ;;
3052 esac
3053 # Quote arguments (to preserve shell metacharacters).
cristyda16f162011-02-19 23:52:17 +00003054 func_append_quoted args "$file"
cristy3ed852e2009-09-05 21:47:34 +00003055 done
3056
3057 if test "X$opt_dry_run" = Xfalse; then
3058 if test -n "$shlibpath_var"; then
3059 # Export the shlibpath_var.
3060 eval "export $shlibpath_var"
3061 fi
3062
3063 # Restore saved environment variables
3064 for lt_var in LANG LANGUAGE LC_ALL LC_CTYPE LC_COLLATE LC_MESSAGES
3065 do
3066 eval "if test \"\${save_$lt_var+set}\" = set; then
3067 $lt_var=\$save_$lt_var; export $lt_var
3068 else
3069 $lt_unset $lt_var
3070 fi"
3071 done
3072
3073 # Now prepare to actually exec the command.
3074 exec_cmd="\$cmd$args"
3075 else
3076 # Display what would be done.
3077 if test -n "$shlibpath_var"; then
3078 eval "\$ECHO \"\$shlibpath_var=\$$shlibpath_var\""
cristy98dddb52010-11-04 00:30:15 +00003079 echo "export $shlibpath_var"
cristy3ed852e2009-09-05 21:47:34 +00003080 fi
3081 $ECHO "$cmd$args"
3082 exit $EXIT_SUCCESS
3083 fi
3084}
3085
cristyda16f162011-02-19 23:52:17 +00003086test "$opt_mode" = execute && func_mode_execute ${1+"$@"}
cristy3ed852e2009-09-05 21:47:34 +00003087
3088
3089# func_mode_finish arg...
3090func_mode_finish ()
3091{
3092 $opt_debug
cristyda16f162011-02-19 23:52:17 +00003093 libs=
3094 libdirs=
cristy3ed852e2009-09-05 21:47:34 +00003095 admincmds=
3096
cristyda16f162011-02-19 23:52:17 +00003097 for opt in "$nonopt" ${1+"$@"}
3098 do
3099 if test -d "$opt"; then
3100 libdirs+=" $opt"
cristy3ed852e2009-09-05 21:47:34 +00003101
cristyda16f162011-02-19 23:52:17 +00003102 elif test -f "$opt"; then
3103 if func_lalib_unsafe_p "$opt"; then
3104 libs+=" $opt"
3105 else
3106 func_warning "\`$opt' is not a valid libtool archive"
3107 fi
3108
3109 else
3110 func_fatal_error "invalid argument \`$opt'"
3111 fi
3112 done
3113
3114 if test -n "$libs"; then
3115 if test -n "$lt_sysroot"; then
3116 sysroot_regex=`$ECHO "$lt_sysroot" | $SED "$sed_make_literal_regex"`
3117 sysroot_cmd="s/\([ ']\)$sysroot_regex/\1/g;"
3118 else
3119 sysroot_cmd=
3120 fi
3121
3122 # Remove sysroot references
3123 if $opt_dry_run; then
3124 for lib in $libs; do
3125 echo "removing references to $lt_sysroot and \`=' prefixes from $lib"
3126 done
3127 else
3128 tmpdir=`func_mktempdir`
3129 for lib in $libs; do
3130 sed -e "${sysroot_cmd} s/\([ ']-[LR]\)=/\1/g; s/\([ ']\)=/\1/g" $lib \
3131 > $tmpdir/tmp-la
3132 mv -f $tmpdir/tmp-la $lib
3133 done
3134 ${RM}r "$tmpdir"
3135 fi
3136 fi
3137
3138 if test -n "$finish_cmds$finish_eval" && test -n "$libdirs"; then
cristy3ed852e2009-09-05 21:47:34 +00003139 for libdir in $libdirs; do
3140 if test -n "$finish_cmds"; then
3141 # Do each command in the finish commands.
3142 func_execute_cmds "$finish_cmds" 'admincmds="$admincmds
3143'"$cmd"'"'
3144 fi
3145 if test -n "$finish_eval"; then
3146 # Do the single finish_eval.
3147 eval cmds=\"$finish_eval\"
cristyda16f162011-02-19 23:52:17 +00003148 $opt_dry_run || eval "$cmds" || admincmds+="
cristy3ed852e2009-09-05 21:47:34 +00003149 $cmds"
3150 fi
3151 done
3152 fi
3153
3154 # Exit here if they wanted silent mode.
3155 $opt_silent && exit $EXIT_SUCCESS
3156
cristyda16f162011-02-19 23:52:17 +00003157 if test -n "$finish_cmds$finish_eval" && test -n "$libdirs"; then
3158 echo "----------------------------------------------------------------------"
3159 echo "Libraries have been installed in:"
3160 for libdir in $libdirs; do
3161 $ECHO " $libdir"
3162 done
3163 echo
3164 echo "If you ever happen to want to link against installed libraries"
3165 echo "in a given directory, LIBDIR, you must either use libtool, and"
3166 echo "specify the full pathname of the library, or use the \`-LLIBDIR'"
3167 echo "flag during linking and do at least one of the following:"
3168 if test -n "$shlibpath_var"; then
3169 echo " - add LIBDIR to the \`$shlibpath_var' environment variable"
3170 echo " during execution"
3171 fi
3172 if test -n "$runpath_var"; then
3173 echo " - add LIBDIR to the \`$runpath_var' environment variable"
3174 echo " during linking"
3175 fi
3176 if test -n "$hardcode_libdir_flag_spec"; then
3177 libdir=LIBDIR
3178 eval flag=\"$hardcode_libdir_flag_spec\"
cristy3ed852e2009-09-05 21:47:34 +00003179
cristyda16f162011-02-19 23:52:17 +00003180 $ECHO " - use the \`$flag' linker flag"
3181 fi
3182 if test -n "$admincmds"; then
3183 $ECHO " - have your system administrator run these commands:$admincmds"
3184 fi
3185 if test -f /etc/ld.so.conf; then
3186 echo " - have your system administrator add LIBDIR to \`/etc/ld.so.conf'"
3187 fi
3188 echo
cristy3ed852e2009-09-05 21:47:34 +00003189
cristyda16f162011-02-19 23:52:17 +00003190 echo "See any operating system documentation about shared libraries for"
3191 case $host in
3192 solaris2.[6789]|solaris2.1[0-9])
3193 echo "more information, such as the ld(1), crle(1) and ld.so(8) manual"
3194 echo "pages."
3195 ;;
3196 *)
3197 echo "more information, such as the ld(1) and ld.so(8) manual pages."
3198 ;;
3199 esac
3200 echo "----------------------------------------------------------------------"
3201 fi
cristy3ed852e2009-09-05 21:47:34 +00003202 exit $EXIT_SUCCESS
3203}
3204
cristyda16f162011-02-19 23:52:17 +00003205test "$opt_mode" = finish && func_mode_finish ${1+"$@"}
cristy3ed852e2009-09-05 21:47:34 +00003206
3207
3208# func_mode_install arg...
3209func_mode_install ()
3210{
3211 $opt_debug
3212 # There may be an optional sh(1) argument at the beginning of
3213 # install_prog (especially on Windows NT).
3214 if test "$nonopt" = "$SHELL" || test "$nonopt" = /bin/sh ||
3215 # Allow the use of GNU shtool's install command.
cristy98dddb52010-11-04 00:30:15 +00003216 case $nonopt in *shtool*) :;; *) false;; esac; then
cristy3ed852e2009-09-05 21:47:34 +00003217 # Aesthetically quote it.
3218 func_quote_for_eval "$nonopt"
3219 install_prog="$func_quote_for_eval_result "
3220 arg=$1
3221 shift
3222 else
3223 install_prog=
3224 arg=$nonopt
3225 fi
3226
3227 # The real first argument should be the name of the installation program.
3228 # Aesthetically quote it.
3229 func_quote_for_eval "$arg"
cristyda16f162011-02-19 23:52:17 +00003230 install_prog+="$func_quote_for_eval_result"
cristy98dddb52010-11-04 00:30:15 +00003231 install_shared_prog=$install_prog
3232 case " $install_prog " in
3233 *[\\\ /]cp\ *) install_cp=: ;;
3234 *) install_cp=false ;;
3235 esac
cristy3ed852e2009-09-05 21:47:34 +00003236
3237 # We need to accept at least all the BSD install flags.
3238 dest=
3239 files=
3240 opts=
3241 prev=
3242 install_type=
3243 isdir=no
3244 stripme=
cristy98dddb52010-11-04 00:30:15 +00003245 no_mode=:
cristy3ed852e2009-09-05 21:47:34 +00003246 for arg
3247 do
cristy98dddb52010-11-04 00:30:15 +00003248 arg2=
cristy3ed852e2009-09-05 21:47:34 +00003249 if test -n "$dest"; then
cristyda16f162011-02-19 23:52:17 +00003250 files+=" $dest"
cristy3ed852e2009-09-05 21:47:34 +00003251 dest=$arg
3252 continue
3253 fi
3254
3255 case $arg in
3256 -d) isdir=yes ;;
3257 -f)
cristy98dddb52010-11-04 00:30:15 +00003258 if $install_cp; then :; else
3259 prev=$arg
3260 fi
cristy3ed852e2009-09-05 21:47:34 +00003261 ;;
3262 -g | -m | -o)
3263 prev=$arg
3264 ;;
3265 -s)
3266 stripme=" -s"
3267 continue
3268 ;;
3269 -*)
3270 ;;
3271 *)
3272 # If the previous option needed an argument, then skip it.
3273 if test -n "$prev"; then
cristy98dddb52010-11-04 00:30:15 +00003274 if test "x$prev" = x-m && test -n "$install_override_mode"; then
3275 arg2=$install_override_mode
3276 no_mode=false
3277 fi
cristy3ed852e2009-09-05 21:47:34 +00003278 prev=
3279 else
3280 dest=$arg
3281 continue
3282 fi
3283 ;;
3284 esac
3285
3286 # Aesthetically quote the argument.
3287 func_quote_for_eval "$arg"
cristyda16f162011-02-19 23:52:17 +00003288 install_prog+=" $func_quote_for_eval_result"
cristy98dddb52010-11-04 00:30:15 +00003289 if test -n "$arg2"; then
3290 func_quote_for_eval "$arg2"
3291 fi
cristyda16f162011-02-19 23:52:17 +00003292 install_shared_prog+=" $func_quote_for_eval_result"
cristy3ed852e2009-09-05 21:47:34 +00003293 done
3294
3295 test -z "$install_prog" && \
3296 func_fatal_help "you must specify an install program"
3297
3298 test -n "$prev" && \
3299 func_fatal_help "the \`$prev' option requires an argument"
3300
cristy98dddb52010-11-04 00:30:15 +00003301 if test -n "$install_override_mode" && $no_mode; then
3302 if $install_cp; then :; else
3303 func_quote_for_eval "$install_override_mode"
cristyda16f162011-02-19 23:52:17 +00003304 install_shared_prog+=" -m $func_quote_for_eval_result"
cristy98dddb52010-11-04 00:30:15 +00003305 fi
3306 fi
3307
cristy3ed852e2009-09-05 21:47:34 +00003308 if test -z "$files"; then
3309 if test -z "$dest"; then
3310 func_fatal_help "no file or destination specified"
3311 else
3312 func_fatal_help "you must specify a destination"
3313 fi
3314 fi
3315
3316 # Strip any trailing slash from the destination.
3317 func_stripname '' '/' "$dest"
3318 dest=$func_stripname_result
3319
3320 # Check to see that the destination is a directory.
3321 test -d "$dest" && isdir=yes
3322 if test "$isdir" = yes; then
3323 destdir="$dest"
3324 destname=
3325 else
3326 func_dirname_and_basename "$dest" "" "."
3327 destdir="$func_dirname_result"
3328 destname="$func_basename_result"
3329
3330 # Not a directory, so check to see that there is only one file specified.
3331 set dummy $files; shift
3332 test "$#" -gt 1 && \
3333 func_fatal_help "\`$dest' is not a directory"
3334 fi
3335 case $destdir in
3336 [\\/]* | [A-Za-z]:[\\/]*) ;;
3337 *)
3338 for file in $files; do
3339 case $file in
3340 *.lo) ;;
3341 *)
3342 func_fatal_help "\`$destdir' must be an absolute directory name"
3343 ;;
3344 esac
3345 done
3346 ;;
3347 esac
3348
3349 # This variable tells wrapper scripts just to set variables rather
3350 # than running their programs.
3351 libtool_install_magic="$magic"
3352
3353 staticlibs=
3354 future_libdirs=
3355 current_libdirs=
3356 for file in $files; do
3357
3358 # Do each installation.
3359 case $file in
3360 *.$libext)
3361 # Do the static libraries later.
cristyda16f162011-02-19 23:52:17 +00003362 staticlibs+=" $file"
cristy3ed852e2009-09-05 21:47:34 +00003363 ;;
3364
3365 *.la)
cristyda16f162011-02-19 23:52:17 +00003366 func_resolve_sysroot "$file"
3367 file=$func_resolve_sysroot_result
3368
cristy3ed852e2009-09-05 21:47:34 +00003369 # Check to see that this really is a libtool archive.
3370 func_lalib_unsafe_p "$file" \
3371 || func_fatal_help "\`$file' is not a valid libtool archive"
3372
3373 library_names=
3374 old_library=
3375 relink_command=
3376 func_source "$file"
3377
3378 # Add the libdir to current_libdirs if it is the destination.
3379 if test "X$destdir" = "X$libdir"; then
3380 case "$current_libdirs " in
3381 *" $libdir "*) ;;
cristyda16f162011-02-19 23:52:17 +00003382 *) current_libdirs+=" $libdir" ;;
cristy3ed852e2009-09-05 21:47:34 +00003383 esac
3384 else
3385 # Note the libdir as a future libdir.
3386 case "$future_libdirs " in
3387 *" $libdir "*) ;;
cristyda16f162011-02-19 23:52:17 +00003388 *) future_libdirs+=" $libdir" ;;
cristy3ed852e2009-09-05 21:47:34 +00003389 esac
3390 fi
3391
3392 func_dirname "$file" "/" ""
3393 dir="$func_dirname_result"
cristyda16f162011-02-19 23:52:17 +00003394 dir+="$objdir"
cristy3ed852e2009-09-05 21:47:34 +00003395
3396 if test -n "$relink_command"; then
3397 # Determine the prefix the user has applied to our future dir.
cristy98dddb52010-11-04 00:30:15 +00003398 inst_prefix_dir=`$ECHO "$destdir" | $SED -e "s%$libdir\$%%"`
cristy3ed852e2009-09-05 21:47:34 +00003399
3400 # Don't allow the user to place us outside of our expected
3401 # location b/c this prevents finding dependent libraries that
3402 # are installed to the same prefix.
3403 # At present, this check doesn't affect windows .dll's that
3404 # are installed into $libdir/../bin (currently, that works fine)
3405 # but it's something to keep an eye on.
3406 test "$inst_prefix_dir" = "$destdir" && \
3407 func_fatal_error "error: cannot install \`$file' to a directory not ending in $libdir"
3408
3409 if test -n "$inst_prefix_dir"; then
3410 # Stick the inst_prefix_dir data into the link command.
cristy98dddb52010-11-04 00:30:15 +00003411 relink_command=`$ECHO "$relink_command" | $SED "s%@inst_prefix_dir@%-inst-prefix-dir $inst_prefix_dir%"`
cristy3ed852e2009-09-05 21:47:34 +00003412 else
cristy98dddb52010-11-04 00:30:15 +00003413 relink_command=`$ECHO "$relink_command" | $SED "s%@inst_prefix_dir@%%"`
cristy3ed852e2009-09-05 21:47:34 +00003414 fi
3415
3416 func_warning "relinking \`$file'"
3417 func_show_eval "$relink_command" \
3418 'func_fatal_error "error: relink \`$file'\'' with the above command before installing it"'
3419 fi
3420
3421 # See the names of the shared library.
3422 set dummy $library_names; shift
3423 if test -n "$1"; then
3424 realname="$1"
3425 shift
3426
3427 srcname="$realname"
3428 test -n "$relink_command" && srcname="$realname"T
3429
3430 # Install the shared library and build the symlinks.
cristy98dddb52010-11-04 00:30:15 +00003431 func_show_eval "$install_shared_prog $dir/$srcname $destdir/$realname" \
cristy3ed852e2009-09-05 21:47:34 +00003432 'exit $?'
3433 tstripme="$stripme"
3434 case $host_os in
3435 cygwin* | mingw* | pw32* | cegcc*)
3436 case $realname in
3437 *.dll.a)
3438 tstripme=""
3439 ;;
3440 esac
3441 ;;
3442 esac
3443 if test -n "$tstripme" && test -n "$striplib"; then
3444 func_show_eval "$striplib $destdir/$realname" 'exit $?'
3445 fi
3446
3447 if test "$#" -gt 0; then
3448 # Delete the old symlinks, and create new ones.
3449 # Try `ln -sf' first, because the `ln' binary might depend on
3450 # the symlink we replace! Solaris /bin/ln does not understand -f,
3451 # so we also need to try rm && ln -s.
3452 for linkname
3453 do
3454 test "$linkname" != "$realname" \
3455 && func_show_eval "(cd $destdir && { $LN_S -f $realname $linkname || { $RM $linkname && $LN_S $realname $linkname; }; })"
3456 done
3457 fi
3458
3459 # Do each command in the postinstall commands.
3460 lib="$destdir/$realname"
3461 func_execute_cmds "$postinstall_cmds" 'exit $?'
3462 fi
3463
3464 # Install the pseudo-library for information purposes.
3465 func_basename "$file"
3466 name="$func_basename_result"
3467 instname="$dir/$name"i
3468 func_show_eval "$install_prog $instname $destdir/$name" 'exit $?'
3469
3470 # Maybe install the static library, too.
cristyda16f162011-02-19 23:52:17 +00003471 test -n "$old_library" && staticlibs+=" $dir/$old_library"
cristy3ed852e2009-09-05 21:47:34 +00003472 ;;
3473
3474 *.lo)
3475 # Install (i.e. copy) a libtool object.
3476
3477 # Figure out destination file name, if it wasn't already specified.
3478 if test -n "$destname"; then
3479 destfile="$destdir/$destname"
3480 else
3481 func_basename "$file"
3482 destfile="$func_basename_result"
3483 destfile="$destdir/$destfile"
3484 fi
3485
3486 # Deduce the name of the destination old-style object file.
3487 case $destfile in
3488 *.lo)
3489 func_lo2o "$destfile"
3490 staticdest=$func_lo2o_result
3491 ;;
3492 *.$objext)
3493 staticdest="$destfile"
3494 destfile=
3495 ;;
3496 *)
3497 func_fatal_help "cannot copy a libtool object to \`$destfile'"
3498 ;;
3499 esac
3500
3501 # Install the libtool object if requested.
3502 test -n "$destfile" && \
3503 func_show_eval "$install_prog $file $destfile" 'exit $?'
3504
3505 # Install the old object if enabled.
3506 if test "$build_old_libs" = yes; then
3507 # Deduce the name of the old-style object file.
3508 func_lo2o "$file"
3509 staticobj=$func_lo2o_result
3510 func_show_eval "$install_prog \$staticobj \$staticdest" 'exit $?'
3511 fi
3512 exit $EXIT_SUCCESS
3513 ;;
3514
3515 *)
3516 # Figure out destination file name, if it wasn't already specified.
3517 if test -n "$destname"; then
3518 destfile="$destdir/$destname"
3519 else
3520 func_basename "$file"
3521 destfile="$func_basename_result"
3522 destfile="$destdir/$destfile"
3523 fi
3524
3525 # If the file is missing, and there is a .exe on the end, strip it
3526 # because it is most likely a libtool script we actually want to
3527 # install
3528 stripped_ext=""
3529 case $file in
3530 *.exe)
3531 if test ! -f "$file"; then
3532 func_stripname '' '.exe' "$file"
3533 file=$func_stripname_result
3534 stripped_ext=".exe"
3535 fi
3536 ;;
3537 esac
3538
3539 # Do a test to see if this is really a libtool program.
3540 case $host in
3541 *cygwin* | *mingw*)
3542 if func_ltwrapper_executable_p "$file"; then
3543 func_ltwrapper_scriptname "$file"
3544 wrapper=$func_ltwrapper_scriptname_result
3545 else
3546 func_stripname '' '.exe' "$file"
3547 wrapper=$func_stripname_result
3548 fi
3549 ;;
3550 *)
3551 wrapper=$file
3552 ;;
3553 esac
3554 if func_ltwrapper_script_p "$wrapper"; then
3555 notinst_deplibs=
3556 relink_command=
3557
3558 func_source "$wrapper"
3559
3560 # Check the variables that should have been set.
3561 test -z "$generated_by_libtool_version" && \
3562 func_fatal_error "invalid libtool wrapper script \`$wrapper'"
3563
3564 finalize=yes
3565 for lib in $notinst_deplibs; do
3566 # Check to see that each library is installed.
3567 libdir=
3568 if test -f "$lib"; then
3569 func_source "$lib"
3570 fi
cristy98dddb52010-11-04 00:30:15 +00003571 libfile="$libdir/"`$ECHO "$lib" | $SED 's%^.*/%%g'` ### testsuite: skip nested quoting test
cristy3ed852e2009-09-05 21:47:34 +00003572 if test -n "$libdir" && test ! -f "$libfile"; then
3573 func_warning "\`$lib' has not been installed in \`$libdir'"
3574 finalize=no
3575 fi
3576 done
3577
3578 relink_command=
3579 func_source "$wrapper"
3580
3581 outputname=
3582 if test "$fast_install" = no && test -n "$relink_command"; then
3583 $opt_dry_run || {
3584 if test "$finalize" = yes; then
3585 tmpdir=`func_mktempdir`
3586 func_basename "$file$stripped_ext"
3587 file="$func_basename_result"
3588 outputname="$tmpdir/$file"
3589 # Replace the output file specification.
cristy98dddb52010-11-04 00:30:15 +00003590 relink_command=`$ECHO "$relink_command" | $SED 's%@OUTPUT@%'"$outputname"'%g'`
cristy3ed852e2009-09-05 21:47:34 +00003591
3592 $opt_silent || {
3593 func_quote_for_expand "$relink_command"
3594 eval "func_echo $func_quote_for_expand_result"
3595 }
3596 if eval "$relink_command"; then :
3597 else
3598 func_error "error: relink \`$file' with the above command before installing it"
3599 $opt_dry_run || ${RM}r "$tmpdir"
3600 continue
3601 fi
3602 file="$outputname"
3603 else
3604 func_warning "cannot relink \`$file'"
3605 fi
3606 }
3607 else
3608 # Install the binary that we compiled earlier.
cristy98dddb52010-11-04 00:30:15 +00003609 file=`$ECHO "$file$stripped_ext" | $SED "s%\([^/]*\)$%$objdir/\1%"`
cristy3ed852e2009-09-05 21:47:34 +00003610 fi
3611 fi
3612
3613 # remove .exe since cygwin /usr/bin/install will append another
3614 # one anyway
3615 case $install_prog,$host in
3616 */usr/bin/install*,*cygwin*)
3617 case $file:$destfile in
3618 *.exe:*.exe)
3619 # this is ok
3620 ;;
3621 *.exe:*)
3622 destfile=$destfile.exe
3623 ;;
3624 *:*.exe)
3625 func_stripname '' '.exe' "$destfile"
3626 destfile=$func_stripname_result
3627 ;;
3628 esac
3629 ;;
3630 esac
3631 func_show_eval "$install_prog\$stripme \$file \$destfile" 'exit $?'
3632 $opt_dry_run || if test -n "$outputname"; then
3633 ${RM}r "$tmpdir"
3634 fi
3635 ;;
3636 esac
3637 done
3638
3639 for file in $staticlibs; do
3640 func_basename "$file"
3641 name="$func_basename_result"
3642
3643 # Set up the ranlib parameters.
3644 oldlib="$destdir/$name"
cristy2542fc62011-12-06 17:50:25 +00003645 func_to_tool_file "$oldlib" func_convert_file_msys_to_w32
3646 tool_oldlib=$func_to_tool_file_result
cristy3ed852e2009-09-05 21:47:34 +00003647
3648 func_show_eval "$install_prog \$file \$oldlib" 'exit $?'
3649
3650 if test -n "$stripme" && test -n "$old_striplib"; then
cristy2542fc62011-12-06 17:50:25 +00003651 func_show_eval "$old_striplib $tool_oldlib" 'exit $?'
cristy3ed852e2009-09-05 21:47:34 +00003652 fi
3653
3654 # Do each command in the postinstall commands.
3655 func_execute_cmds "$old_postinstall_cmds" 'exit $?'
3656 done
3657
3658 test -n "$future_libdirs" && \
3659 func_warning "remember to run \`$progname --finish$future_libdirs'"
3660
3661 if test -n "$current_libdirs"; then
3662 # Maybe just do a dry run.
3663 $opt_dry_run && current_libdirs=" -n$current_libdirs"
3664 exec_cmd='$SHELL $progpath $preserve_args --finish$current_libdirs'
3665 else
3666 exit $EXIT_SUCCESS
3667 fi
3668}
3669
cristyda16f162011-02-19 23:52:17 +00003670test "$opt_mode" = install && func_mode_install ${1+"$@"}
cristy3ed852e2009-09-05 21:47:34 +00003671
3672
3673# func_generate_dlsyms outputname originator pic_p
3674# Extract symbols from dlprefiles and create ${outputname}S.o with
3675# a dlpreopen symbol table.
3676func_generate_dlsyms ()
3677{
3678 $opt_debug
3679 my_outputname="$1"
3680 my_originator="$2"
3681 my_pic_p="${3-no}"
3682 my_prefix=`$ECHO "$my_originator" | sed 's%[^a-zA-Z0-9]%_%g'`
3683 my_dlsyms=
3684
3685 if test -n "$dlfiles$dlprefiles" || test "$dlself" != no; then
3686 if test -n "$NM" && test -n "$global_symbol_pipe"; then
3687 my_dlsyms="${my_outputname}S.c"
3688 else
3689 func_error "not configured to extract global symbols from dlpreopened files"
3690 fi
3691 fi
3692
3693 if test -n "$my_dlsyms"; then
3694 case $my_dlsyms in
3695 "") ;;
3696 *.c)
3697 # Discover the nlist of each of the dlfiles.
3698 nlist="$output_objdir/${my_outputname}.nm"
3699
3700 func_show_eval "$RM $nlist ${nlist}S ${nlist}T"
3701
3702 # Parse the name list into a source file.
3703 func_verbose "creating $output_objdir/$my_dlsyms"
3704
3705 $opt_dry_run || $ECHO > "$output_objdir/$my_dlsyms" "\
3706/* $my_dlsyms - symbol resolution table for \`$my_outputname' dlsym emulation. */
3707/* Generated by $PROGRAM (GNU $PACKAGE$TIMESTAMP) $VERSION */
3708
3709#ifdef __cplusplus
3710extern \"C\" {
3711#endif
3712
cristy98dddb52010-11-04 00:30:15 +00003713#if defined(__GNUC__) && (((__GNUC__ == 4) && (__GNUC_MINOR__ >= 4)) || (__GNUC__ > 4))
3714#pragma GCC diagnostic ignored \"-Wstrict-prototypes\"
3715#endif
3716
cristyda16f162011-02-19 23:52:17 +00003717/* Keep this code in sync between libtool.m4, ltmain, lt_system.h, and tests. */
3718#if defined(_WIN32) || defined(__CYGWIN__) || defined(_WIN32_WCE)
3719/* DATA imports from DLLs on WIN32 con't be const, because runtime
3720 relocations are performed -- see ld's documentation on pseudo-relocs. */
3721# define LT_DLSYM_CONST
3722#elif defined(__osf__)
3723/* This system does not cope well with relocations in const data. */
3724# define LT_DLSYM_CONST
3725#else
3726# define LT_DLSYM_CONST const
3727#endif
3728
cristy3ed852e2009-09-05 21:47:34 +00003729/* External symbol declarations for the compiler. */\
3730"
3731
3732 if test "$dlself" = yes; then
3733 func_verbose "generating symbol list for \`$output'"
3734
3735 $opt_dry_run || echo ': @PROGRAM@ ' > "$nlist"
3736
3737 # Add our own program objects to the symbol list.
cristy98dddb52010-11-04 00:30:15 +00003738 progfiles=`$ECHO "$objs$old_deplibs" | $SP2NL | $SED "$lo2o" | $NL2SP`
cristy3ed852e2009-09-05 21:47:34 +00003739 for progfile in $progfiles; do
cristyda16f162011-02-19 23:52:17 +00003740 func_to_tool_file "$progfile" func_convert_file_msys_to_w32
3741 func_verbose "extracting global C symbols from \`$func_to_tool_file_result'"
3742 $opt_dry_run || eval "$NM $func_to_tool_file_result | $global_symbol_pipe >> '$nlist'"
cristy3ed852e2009-09-05 21:47:34 +00003743 done
3744
3745 if test -n "$exclude_expsyms"; then
3746 $opt_dry_run || {
3747 eval '$EGREP -v " ($exclude_expsyms)$" "$nlist" > "$nlist"T'
3748 eval '$MV "$nlist"T "$nlist"'
3749 }
3750 fi
3751
3752 if test -n "$export_symbols_regex"; then
3753 $opt_dry_run || {
3754 eval '$EGREP -e "$export_symbols_regex" "$nlist" > "$nlist"T'
3755 eval '$MV "$nlist"T "$nlist"'
3756 }
3757 fi
3758
3759 # Prepare the list of exported symbols
3760 if test -z "$export_symbols"; then
3761 export_symbols="$output_objdir/$outputname.exp"
3762 $opt_dry_run || {
3763 $RM $export_symbols
3764 eval "${SED} -n -e '/^: @PROGRAM@ $/d' -e 's/^.* \(.*\)$/\1/p' "'< "$nlist" > "$export_symbols"'
3765 case $host in
3766 *cygwin* | *mingw* | *cegcc* )
3767 eval "echo EXPORTS "'> "$output_objdir/$outputname.def"'
3768 eval 'cat "$export_symbols" >> "$output_objdir/$outputname.def"'
3769 ;;
3770 esac
3771 }
3772 else
3773 $opt_dry_run || {
3774 eval "${SED} -e 's/\([].[*^$]\)/\\\\\1/g' -e 's/^/ /' -e 's/$/$/'"' < "$export_symbols" > "$output_objdir/$outputname.exp"'
3775 eval '$GREP -f "$output_objdir/$outputname.exp" < "$nlist" > "$nlist"T'
3776 eval '$MV "$nlist"T "$nlist"'
3777 case $host in
cristy98dddb52010-11-04 00:30:15 +00003778 *cygwin* | *mingw* | *cegcc* )
cristy3ed852e2009-09-05 21:47:34 +00003779 eval "echo EXPORTS "'> "$output_objdir/$outputname.def"'
3780 eval 'cat "$nlist" >> "$output_objdir/$outputname.def"'
3781 ;;
3782 esac
3783 }
3784 fi
3785 fi
3786
3787 for dlprefile in $dlprefiles; do
3788 func_verbose "extracting global C symbols from \`$dlprefile'"
3789 func_basename "$dlprefile"
3790 name="$func_basename_result"
cristyda16f162011-02-19 23:52:17 +00003791 case $host in
3792 *cygwin* | *mingw* | *cegcc* )
3793 # if an import library, we need to obtain dlname
3794 if func_win32_import_lib_p "$dlprefile"; then
3795 func_tr_sh "$dlprefile"
3796 eval "curr_lafile=\$libfile_$func_tr_sh_result"
3797 dlprefile_dlbasename=""
3798 if test -n "$curr_lafile" && func_lalib_p "$curr_lafile"; then
3799 # Use subshell, to avoid clobbering current variable values
3800 dlprefile_dlname=`source "$curr_lafile" && echo "$dlname"`
3801 if test -n "$dlprefile_dlname" ; then
3802 func_basename "$dlprefile_dlname"
3803 dlprefile_dlbasename="$func_basename_result"
3804 else
3805 # no lafile. user explicitly requested -dlpreopen <import library>.
3806 $sharedlib_from_linklib_cmd "$dlprefile"
3807 dlprefile_dlbasename=$sharedlib_from_linklib_result
3808 fi
3809 fi
3810 $opt_dry_run || {
3811 if test -n "$dlprefile_dlbasename" ; then
3812 eval '$ECHO ": $dlprefile_dlbasename" >> "$nlist"'
3813 else
3814 func_warning "Could not compute DLL name from $name"
3815 eval '$ECHO ": $name " >> "$nlist"'
3816 fi
3817 func_to_tool_file "$dlprefile" func_convert_file_msys_to_w32
3818 eval "$NM \"$func_to_tool_file_result\" 2>/dev/null | $global_symbol_pipe |
3819 $SED -e '/I __imp/d' -e 's/I __nm_/D /;s/_nm__//' >> '$nlist'"
3820 }
3821 else # not an import lib
3822 $opt_dry_run || {
3823 eval '$ECHO ": $name " >> "$nlist"'
3824 func_to_tool_file "$dlprefile" func_convert_file_msys_to_w32
3825 eval "$NM \"$func_to_tool_file_result\" 2>/dev/null | $global_symbol_pipe >> '$nlist'"
3826 }
3827 fi
3828 ;;
3829 *)
3830 $opt_dry_run || {
3831 eval '$ECHO ": $name " >> "$nlist"'
3832 func_to_tool_file "$dlprefile" func_convert_file_msys_to_w32
3833 eval "$NM \"$func_to_tool_file_result\" 2>/dev/null | $global_symbol_pipe >> '$nlist'"
3834 }
3835 ;;
3836 esac
cristy3ed852e2009-09-05 21:47:34 +00003837 done
3838
3839 $opt_dry_run || {
3840 # Make sure we have at least an empty file.
3841 test -f "$nlist" || : > "$nlist"
3842
3843 if test -n "$exclude_expsyms"; then
3844 $EGREP -v " ($exclude_expsyms)$" "$nlist" > "$nlist"T
3845 $MV "$nlist"T "$nlist"
3846 fi
3847
3848 # Try sorting and uniquifying the output.
3849 if $GREP -v "^: " < "$nlist" |
3850 if sort -k 3 </dev/null >/dev/null 2>&1; then
3851 sort -k 3
3852 else
3853 sort +2
3854 fi |
3855 uniq > "$nlist"S; then
3856 :
3857 else
3858 $GREP -v "^: " < "$nlist" > "$nlist"S
3859 fi
3860
3861 if test -f "$nlist"S; then
3862 eval "$global_symbol_to_cdecl"' < "$nlist"S >> "$output_objdir/$my_dlsyms"'
3863 else
cristy98dddb52010-11-04 00:30:15 +00003864 echo '/* NONE */' >> "$output_objdir/$my_dlsyms"
cristy3ed852e2009-09-05 21:47:34 +00003865 fi
3866
cristy98dddb52010-11-04 00:30:15 +00003867 echo >> "$output_objdir/$my_dlsyms" "\
cristy3ed852e2009-09-05 21:47:34 +00003868
3869/* The mapping between symbol names and symbols. */
3870typedef struct {
3871 const char *name;
3872 void *address;
3873} lt_dlsymlist;
cristyda16f162011-02-19 23:52:17 +00003874extern LT_DLSYM_CONST lt_dlsymlist
cristy3ed852e2009-09-05 21:47:34 +00003875lt_${my_prefix}_LTX_preloaded_symbols[];
cristyda16f162011-02-19 23:52:17 +00003876LT_DLSYM_CONST lt_dlsymlist
cristy3ed852e2009-09-05 21:47:34 +00003877lt_${my_prefix}_LTX_preloaded_symbols[] =
3878{\
3879 { \"$my_originator\", (void *) 0 },"
3880
3881 case $need_lib_prefix in
3882 no)
3883 eval "$global_symbol_to_c_name_address" < "$nlist" >> "$output_objdir/$my_dlsyms"
3884 ;;
3885 *)
3886 eval "$global_symbol_to_c_name_address_lib_prefix" < "$nlist" >> "$output_objdir/$my_dlsyms"
3887 ;;
3888 esac
cristy98dddb52010-11-04 00:30:15 +00003889 echo >> "$output_objdir/$my_dlsyms" "\
cristy3ed852e2009-09-05 21:47:34 +00003890 {0, (void *) 0}
3891};
3892
3893/* This works around a problem in FreeBSD linker */
3894#ifdef FREEBSD_WORKAROUND
3895static const void *lt_preloaded_setup() {
3896 return lt_${my_prefix}_LTX_preloaded_symbols;
3897}
3898#endif
3899
3900#ifdef __cplusplus
3901}
3902#endif\
3903"
3904 } # !$opt_dry_run
3905
3906 pic_flag_for_symtable=
3907 case "$compile_command " in
3908 *" -static "*) ;;
3909 *)
3910 case $host in
3911 # compiling the symbol table file with pic_flag works around
3912 # a FreeBSD bug that causes programs to crash when -lm is
3913 # linked before any other PIC object. But we must not use
3914 # pic_flag when linking with -static. The problem exists in
3915 # FreeBSD 2.2.6 and is fixed in FreeBSD 3.1.
cristy2542fc62011-12-06 17:50:25 +00003916 *-*-freebsd2.*|*-*-freebsd3.0*|*-*-freebsdelf3.0*)
cristy3ed852e2009-09-05 21:47:34 +00003917 pic_flag_for_symtable=" $pic_flag -DFREEBSD_WORKAROUND" ;;
3918 *-*-hpux*)
3919 pic_flag_for_symtable=" $pic_flag" ;;
3920 *)
3921 if test "X$my_pic_p" != Xno; then
3922 pic_flag_for_symtable=" $pic_flag"
3923 fi
3924 ;;
3925 esac
3926 ;;
3927 esac
3928 symtab_cflags=
3929 for arg in $LTCFLAGS; do
3930 case $arg in
3931 -pie | -fpie | -fPIE) ;;
cristyda16f162011-02-19 23:52:17 +00003932 *) symtab_cflags+=" $arg" ;;
cristy3ed852e2009-09-05 21:47:34 +00003933 esac
3934 done
3935
3936 # Now compile the dynamic symbol file.
3937 func_show_eval '(cd $output_objdir && $LTCC$symtab_cflags -c$no_builtin_flag$pic_flag_for_symtable "$my_dlsyms")' 'exit $?'
3938
3939 # Clean up the generated files.
3940 func_show_eval '$RM "$output_objdir/$my_dlsyms" "$nlist" "${nlist}S" "${nlist}T"'
3941
3942 # Transform the symbol file into the correct name.
3943 symfileobj="$output_objdir/${my_outputname}S.$objext"
3944 case $host in
3945 *cygwin* | *mingw* | *cegcc* )
3946 if test -f "$output_objdir/$my_outputname.def"; then
cristy98dddb52010-11-04 00:30:15 +00003947 compile_command=`$ECHO "$compile_command" | $SED "s%@SYMFILE@%$output_objdir/$my_outputname.def $symfileobj%"`
3948 finalize_command=`$ECHO "$finalize_command" | $SED "s%@SYMFILE@%$output_objdir/$my_outputname.def $symfileobj%"`
cristy3ed852e2009-09-05 21:47:34 +00003949 else
cristy98dddb52010-11-04 00:30:15 +00003950 compile_command=`$ECHO "$compile_command" | $SED "s%@SYMFILE@%$symfileobj%"`
3951 finalize_command=`$ECHO "$finalize_command" | $SED "s%@SYMFILE@%$symfileobj%"`
cristy3ed852e2009-09-05 21:47:34 +00003952 fi
3953 ;;
3954 *)
cristy98dddb52010-11-04 00:30:15 +00003955 compile_command=`$ECHO "$compile_command" | $SED "s%@SYMFILE@%$symfileobj%"`
3956 finalize_command=`$ECHO "$finalize_command" | $SED "s%@SYMFILE@%$symfileobj%"`
cristy3ed852e2009-09-05 21:47:34 +00003957 ;;
3958 esac
3959 ;;
3960 *)
3961 func_fatal_error "unknown suffix for \`$my_dlsyms'"
3962 ;;
3963 esac
3964 else
3965 # We keep going just in case the user didn't refer to
3966 # lt_preloaded_symbols. The linker will fail if global_symbol_pipe
3967 # really was required.
3968
3969 # Nullify the symbol file.
cristy98dddb52010-11-04 00:30:15 +00003970 compile_command=`$ECHO "$compile_command" | $SED "s% @SYMFILE@%%"`
3971 finalize_command=`$ECHO "$finalize_command" | $SED "s% @SYMFILE@%%"`
cristy3ed852e2009-09-05 21:47:34 +00003972 fi
3973}
3974
3975# func_win32_libid arg
3976# return the library type of file 'arg'
3977#
3978# Need a lot of goo to handle *both* DLLs and import libs
3979# Has to be a shell function in order to 'eat' the argument
3980# that is supplied when $file_magic_command is called.
cristy98dddb52010-11-04 00:30:15 +00003981# Despite the name, also deal with 64 bit binaries.
cristy3ed852e2009-09-05 21:47:34 +00003982func_win32_libid ()
3983{
3984 $opt_debug
3985 win32_libid_type="unknown"
3986 win32_fileres=`file -L $1 2>/dev/null`
3987 case $win32_fileres in
3988 *ar\ archive\ import\ library*) # definitely import
3989 win32_libid_type="x86 archive import"
3990 ;;
3991 *ar\ archive*) # could be an import, or static
cristy98dddb52010-11-04 00:30:15 +00003992 # Keep the egrep pattern in sync with the one in _LT_CHECK_MAGIC_METHOD.
cristy3ed852e2009-09-05 21:47:34 +00003993 if eval $OBJDUMP -f $1 | $SED -e '10q' 2>/dev/null |
cristy98dddb52010-11-04 00:30:15 +00003994 $EGREP 'file format (pei*-i386(.*architecture: i386)?|pe-arm-wince|pe-x86-64)' >/dev/null; then
cristyda16f162011-02-19 23:52:17 +00003995 func_to_tool_file "$1" func_convert_file_msys_to_w32
3996 win32_nmres=`eval $NM -f posix -A \"$func_to_tool_file_result\" |
cristy3ed852e2009-09-05 21:47:34 +00003997 $SED -n -e '
3998 1,100{
3999 / I /{
4000 s,.*,import,
4001 p
4002 q
4003 }
4004 }'`
4005 case $win32_nmres in
4006 import*) win32_libid_type="x86 archive import";;
4007 *) win32_libid_type="x86 archive static";;
4008 esac
4009 fi
4010 ;;
4011 *DLL*)
4012 win32_libid_type="x86 DLL"
4013 ;;
4014 *executable*) # but shell scripts are "executable" too...
4015 case $win32_fileres in
4016 *MS\ Windows\ PE\ Intel*)
4017 win32_libid_type="x86 DLL"
4018 ;;
4019 esac
4020 ;;
4021 esac
4022 $ECHO "$win32_libid_type"
4023}
4024
cristyda16f162011-02-19 23:52:17 +00004025# func_cygming_dll_for_implib ARG
4026#
4027# Platform-specific function to extract the
4028# name of the DLL associated with the specified
4029# import library ARG.
4030# Invoked by eval'ing the libtool variable
4031# $sharedlib_from_linklib_cmd
4032# Result is available in the variable
4033# $sharedlib_from_linklib_result
4034func_cygming_dll_for_implib ()
4035{
4036 $opt_debug
4037 sharedlib_from_linklib_result=`$DLLTOOL --identify-strict --identify "$1"`
4038}
4039
4040# func_cygming_dll_for_implib_fallback_core SECTION_NAME LIBNAMEs
4041#
4042# The is the core of a fallback implementation of a
4043# platform-specific function to extract the name of the
4044# DLL associated with the specified import library LIBNAME.
4045#
4046# SECTION_NAME is either .idata$6 or .idata$7, depending
4047# on the platform and compiler that created the implib.
4048#
4049# Echos the name of the DLL associated with the
4050# specified import library.
4051func_cygming_dll_for_implib_fallback_core ()
4052{
4053 $opt_debug
4054 match_literal=`$ECHO "$1" | $SED "$sed_make_literal_regex"`
4055 $OBJDUMP -s --section "$1" "$2" 2>/dev/null |
4056 $SED '/^Contents of section '"$match_literal"':/{
4057 # Place marker at beginning of archive member dllname section
4058 s/.*/====MARK====/
4059 p
4060 d
4061 }
4062 # These lines can sometimes be longer than 43 characters, but
4063 # are always uninteresting
4064 /:[ ]*file format pe[i]\{,1\}-/d
4065 /^In archive [^:]*:/d
4066 # Ensure marker is printed
4067 /^====MARK====/p
4068 # Remove all lines with less than 43 characters
4069 /^.\{43\}/!d
4070 # From remaining lines, remove first 43 characters
4071 s/^.\{43\}//' |
4072 $SED -n '
4073 # Join marker and all lines until next marker into a single line
4074 /^====MARK====/ b para
4075 H
4076 $ b para
4077 b
4078 :para
4079 x
4080 s/\n//g
4081 # Remove the marker
4082 s/^====MARK====//
4083 # Remove trailing dots and whitespace
4084 s/[\. \t]*$//
4085 # Print
4086 /./p' |
4087 # we now have a list, one entry per line, of the stringified
4088 # contents of the appropriate section of all members of the
4089 # archive which possess that section. Heuristic: eliminate
4090 # all those which have a first or second character that is
4091 # a '.' (that is, objdump's representation of an unprintable
4092 # character.) This should work for all archives with less than
4093 # 0x302f exports -- but will fail for DLLs whose name actually
4094 # begins with a literal '.' or a single character followed by
4095 # a '.'.
4096 #
4097 # Of those that remain, print the first one.
4098 $SED -e '/^\./d;/^.\./d;q'
4099}
4100
4101# func_cygming_gnu_implib_p ARG
4102# This predicate returns with zero status (TRUE) if
4103# ARG is a GNU/binutils-style import library. Returns
4104# with nonzero status (FALSE) otherwise.
4105func_cygming_gnu_implib_p ()
4106{
4107 $opt_debug
4108 func_to_tool_file "$1" func_convert_file_msys_to_w32
4109 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)$'`
4110 test -n "$func_cygming_gnu_implib_tmp"
4111}
4112
4113# func_cygming_ms_implib_p ARG
4114# This predicate returns with zero status (TRUE) if
4115# ARG is an MS-style import library. Returns
4116# with nonzero status (FALSE) otherwise.
4117func_cygming_ms_implib_p ()
4118{
4119 $opt_debug
4120 func_to_tool_file "$1" func_convert_file_msys_to_w32
4121 func_cygming_ms_implib_tmp=`$NM "$func_to_tool_file_result" | eval "$global_symbol_pipe" | $GREP '_NULL_IMPORT_DESCRIPTOR'`
4122 test -n "$func_cygming_ms_implib_tmp"
4123}
4124
4125# func_cygming_dll_for_implib_fallback ARG
4126# Platform-specific function to extract the
4127# name of the DLL associated with the specified
4128# import library ARG.
4129#
4130# This fallback implementation is for use when $DLLTOOL
4131# does not support the --identify-strict option.
4132# Invoked by eval'ing the libtool variable
4133# $sharedlib_from_linklib_cmd
4134# Result is available in the variable
4135# $sharedlib_from_linklib_result
4136func_cygming_dll_for_implib_fallback ()
4137{
4138 $opt_debug
4139 if func_cygming_gnu_implib_p "$1" ; then
4140 # binutils import library
4141 sharedlib_from_linklib_result=`func_cygming_dll_for_implib_fallback_core '.idata$7' "$1"`
4142 elif func_cygming_ms_implib_p "$1" ; then
4143 # ms-generated import library
4144 sharedlib_from_linklib_result=`func_cygming_dll_for_implib_fallback_core '.idata$6' "$1"`
4145 else
4146 # unknown
4147 sharedlib_from_linklib_result=""
4148 fi
4149}
cristy3ed852e2009-09-05 21:47:34 +00004150
4151
4152# func_extract_an_archive dir oldlib
4153func_extract_an_archive ()
4154{
4155 $opt_debug
4156 f_ex_an_ar_dir="$1"; shift
4157 f_ex_an_ar_oldlib="$1"
cristy98dddb52010-11-04 00:30:15 +00004158 if test "$lock_old_archive_extraction" = yes; then
4159 lockfile=$f_ex_an_ar_oldlib.lock
4160 until $opt_dry_run || ln "$progpath" "$lockfile" 2>/dev/null; do
4161 func_echo "Waiting for $lockfile to be removed"
4162 sleep 2
4163 done
4164 fi
4165 func_show_eval "(cd \$f_ex_an_ar_dir && $AR x \"\$f_ex_an_ar_oldlib\")" \
4166 'stat=$?; rm -f "$lockfile"; exit $stat'
4167 if test "$lock_old_archive_extraction" = yes; then
4168 $opt_dry_run || rm -f "$lockfile"
4169 fi
cristy3ed852e2009-09-05 21:47:34 +00004170 if ($AR t "$f_ex_an_ar_oldlib" | sort | sort -uc >/dev/null 2>&1); then
4171 :
4172 else
4173 func_fatal_error "object name conflicts in archive: $f_ex_an_ar_dir/$f_ex_an_ar_oldlib"
4174 fi
4175}
4176
4177
4178# func_extract_archives gentop oldlib ...
4179func_extract_archives ()
4180{
4181 $opt_debug
4182 my_gentop="$1"; shift
4183 my_oldlibs=${1+"$@"}
4184 my_oldobjs=""
4185 my_xlib=""
4186 my_xabs=""
4187 my_xdir=""
4188
4189 for my_xlib in $my_oldlibs; do
4190 # Extract the objects.
4191 case $my_xlib in
4192 [\\/]* | [A-Za-z]:[\\/]*) my_xabs="$my_xlib" ;;
4193 *) my_xabs=`pwd`"/$my_xlib" ;;
4194 esac
4195 func_basename "$my_xlib"
4196 my_xlib="$func_basename_result"
4197 my_xlib_u=$my_xlib
4198 while :; do
4199 case " $extracted_archives " in
4200 *" $my_xlib_u "*)
4201 func_arith $extracted_serial + 1
4202 extracted_serial=$func_arith_result
4203 my_xlib_u=lt$extracted_serial-$my_xlib ;;
4204 *) break ;;
4205 esac
4206 done
4207 extracted_archives="$extracted_archives $my_xlib_u"
4208 my_xdir="$my_gentop/$my_xlib_u"
4209
4210 func_mkdir_p "$my_xdir"
4211
4212 case $host in
4213 *-darwin*)
4214 func_verbose "Extracting $my_xabs"
4215 # Do not bother doing anything if just a dry run
4216 $opt_dry_run || {
4217 darwin_orig_dir=`pwd`
4218 cd $my_xdir || exit $?
4219 darwin_archive=$my_xabs
4220 darwin_curdir=`pwd`
4221 darwin_base_archive=`basename "$darwin_archive"`
4222 darwin_arches=`$LIPO -info "$darwin_archive" 2>/dev/null | $GREP Architectures 2>/dev/null || true`
4223 if test -n "$darwin_arches"; then
4224 darwin_arches=`$ECHO "$darwin_arches" | $SED -e 's/.*are://'`
4225 darwin_arch=
4226 func_verbose "$darwin_base_archive has multiple architectures $darwin_arches"
4227 for darwin_arch in $darwin_arches ; do
4228 func_mkdir_p "unfat-$$/${darwin_base_archive}-${darwin_arch}"
4229 $LIPO -thin $darwin_arch -output "unfat-$$/${darwin_base_archive}-${darwin_arch}/${darwin_base_archive}" "${darwin_archive}"
4230 cd "unfat-$$/${darwin_base_archive}-${darwin_arch}"
4231 func_extract_an_archive "`pwd`" "${darwin_base_archive}"
4232 cd "$darwin_curdir"
4233 $RM "unfat-$$/${darwin_base_archive}-${darwin_arch}/${darwin_base_archive}"
4234 done # $darwin_arches
4235 ## Okay now we've a bunch of thin objects, gotta fatten them up :)
4236 darwin_filelist=`find unfat-$$ -type f -name \*.o -print -o -name \*.lo -print | $SED -e "$basename" | sort -u`
4237 darwin_file=
4238 darwin_files=
4239 for darwin_file in $darwin_filelist; do
cristy98dddb52010-11-04 00:30:15 +00004240 darwin_files=`find unfat-$$ -name $darwin_file -print | sort | $NL2SP`
cristy3ed852e2009-09-05 21:47:34 +00004241 $LIPO -create -output "$darwin_file" $darwin_files
4242 done # $darwin_filelist
4243 $RM -rf unfat-$$
4244 cd "$darwin_orig_dir"
4245 else
4246 cd $darwin_orig_dir
4247 func_extract_an_archive "$my_xdir" "$my_xabs"
4248 fi # $darwin_arches
4249 } # !$opt_dry_run
4250 ;;
4251 *)
4252 func_extract_an_archive "$my_xdir" "$my_xabs"
4253 ;;
4254 esac
cristy98dddb52010-11-04 00:30:15 +00004255 my_oldobjs="$my_oldobjs "`find $my_xdir -name \*.$objext -print -o -name \*.lo -print | sort | $NL2SP`
cristy3ed852e2009-09-05 21:47:34 +00004256 done
4257
4258 func_extract_archives_result="$my_oldobjs"
4259}
4260
4261
cristy98dddb52010-11-04 00:30:15 +00004262# func_emit_wrapper [arg=no]
cristy3ed852e2009-09-05 21:47:34 +00004263#
cristy98dddb52010-11-04 00:30:15 +00004264# Emit a libtool wrapper script on stdout.
4265# Don't directly open a file because we may want to
4266# incorporate the script contents within a cygwin/mingw
4267# wrapper executable. Must ONLY be called from within
4268# func_mode_link because it depends on a number of variables
4269# set therein.
4270#
4271# ARG is the value that the WRAPPER_SCRIPT_BELONGS_IN_OBJDIR
4272# variable will take. If 'yes', then the emitted script
4273# will assume that the directory in which it is stored is
4274# the $objdir directory. This is a cygwin/mingw-specific
4275# behavior.
4276func_emit_wrapper ()
cristy3ed852e2009-09-05 21:47:34 +00004277{
cristy98dddb52010-11-04 00:30:15 +00004278 func_emit_wrapper_arg1=${1-no}
cristy3ed852e2009-09-05 21:47:34 +00004279
4280 $ECHO "\
4281#! $SHELL
4282
4283# $output - temporary wrapper script for $objdir/$outputname
4284# Generated by $PROGRAM (GNU $PACKAGE$TIMESTAMP) $VERSION
4285#
4286# The $output program cannot be directly executed until all the libtool
4287# libraries that it depends on are installed.
4288#
4289# This wrapper script should never be moved out of the build directory.
4290# If it is, it will not operate correctly.
4291
4292# Sed substitution that helps us do robust quoting. It backslashifies
4293# metacharacters that are still active within double-quoted strings.
cristy3ed852e2009-09-05 21:47:34 +00004294sed_quote_subst='$sed_quote_subst'
4295
4296# Be Bourne compatible
4297if test -n \"\${ZSH_VERSION+set}\" && (emulate sh) >/dev/null 2>&1; then
4298 emulate sh
4299 NULLCMD=:
4300 # Zsh 3.x and 4.x performs word splitting on \${1+\"\$@\"}, which
4301 # is contrary to our usage. Disable this feature.
4302 alias -g '\${1+\"\$@\"}'='\"\$@\"'
4303 setopt NO_GLOB_SUBST
4304else
4305 case \`(set -o) 2>/dev/null\` in *posix*) set -o posix;; esac
4306fi
4307BIN_SH=xpg4; export BIN_SH # for Tru64
4308DUALCASE=1; export DUALCASE # for MKS sh
4309
4310# The HP-UX ksh and POSIX shell print the target directory to stdout
4311# if CDPATH is set.
4312(unset CDPATH) >/dev/null 2>&1 && unset CDPATH
4313
4314relink_command=\"$relink_command\"
4315
4316# This environment variable determines our operation mode.
4317if test \"\$libtool_install_magic\" = \"$magic\"; then
4318 # install mode needs the following variables:
4319 generated_by_libtool_version='$macro_version'
4320 notinst_deplibs='$notinst_deplibs'
4321else
4322 # When we are sourced in execute mode, \$file and \$ECHO are already set.
4323 if test \"\$libtool_execute_magic\" != \"$magic\"; then
cristy98dddb52010-11-04 00:30:15 +00004324 file=\"\$0\""
4325
4326 qECHO=`$ECHO "$ECHO" | $SED "$sed_quote_subst"`
4327 $ECHO "\
4328
4329# A function that is used when there is no print builtin or printf.
4330func_fallback_echo ()
4331{
4332 eval 'cat <<_LTECHO_EOF
4333\$1
4334_LTECHO_EOF'
4335}
4336 ECHO=\"$qECHO\"
4337 fi
4338
4339# Very basic option parsing. These options are (a) specific to
4340# the libtool wrapper, (b) are identical between the wrapper
4341# /script/ and the wrapper /executable/ which is used only on
4342# windows platforms, and (c) all begin with the string "--lt-"
4343# (application programs are unlikely to have options which match
4344# this pattern).
4345#
4346# There are only two supported options: --lt-debug and
4347# --lt-dump-script. There is, deliberately, no --lt-help.
4348#
4349# The first argument to this parsing function should be the
4350# script's $0 value, followed by "$@".
4351lt_option_debug=
4352func_parse_lt_options ()
4353{
4354 lt_script_arg0=\$0
4355 shift
4356 for lt_opt
4357 do
4358 case \"\$lt_opt\" in
4359 --lt-debug) lt_option_debug=1 ;;
4360 --lt-dump-script)
4361 lt_dump_D=\`\$ECHO \"X\$lt_script_arg0\" | $SED -e 's/^X//' -e 's%/[^/]*$%%'\`
4362 test \"X\$lt_dump_D\" = \"X\$lt_script_arg0\" && lt_dump_D=.
4363 lt_dump_F=\`\$ECHO \"X\$lt_script_arg0\" | $SED -e 's/^X//' -e 's%^.*/%%'\`
4364 cat \"\$lt_dump_D/\$lt_dump_F\"
4365 exit 0
4366 ;;
4367 --lt-*)
4368 \$ECHO \"Unrecognized --lt- option: '\$lt_opt'\" 1>&2
4369 exit 1
4370 ;;
4371 esac
4372 done
4373
4374 # Print the debug banner immediately:
4375 if test -n \"\$lt_option_debug\"; then
4376 echo \"${outputname}:${output}:\${LINENO}: libtool wrapper (GNU $PACKAGE$TIMESTAMP) $VERSION\" 1>&2
4377 fi
4378}
4379
4380# Used when --lt-debug. Prints its arguments to stdout
4381# (redirection is the responsibility of the caller)
4382func_lt_dump_args ()
4383{
4384 lt_dump_args_N=1;
4385 for lt_arg
4386 do
4387 \$ECHO \"${outputname}:${output}:\${LINENO}: newargv[\$lt_dump_args_N]: \$lt_arg\"
4388 lt_dump_args_N=\`expr \$lt_dump_args_N + 1\`
4389 done
4390}
4391
4392# Core function for launching the target application
4393func_exec_program_core ()
4394{
cristycd4c5312009-11-22 01:19:08 +00004395"
cristy98dddb52010-11-04 00:30:15 +00004396 case $host in
4397 # Backslashes separate directories on plain windows
4398 *-*-mingw | *-*-os2* | *-cegcc*)
4399 $ECHO "\
4400 if test -n \"\$lt_option_debug\"; then
4401 \$ECHO \"${outputname}:${output}:\${LINENO}: newargv[0]: \$progdir\\\\\$program\" 1>&2
4402 func_lt_dump_args \${1+\"\$@\"} 1>&2
4403 fi
4404 exec \"\$progdir\\\\\$program\" \${1+\"\$@\"}
4405"
4406 ;;
4407
4408 *)
4409 $ECHO "\
4410 if test -n \"\$lt_option_debug\"; then
4411 \$ECHO \"${outputname}:${output}:\${LINENO}: newargv[0]: \$progdir/\$program\" 1>&2
4412 func_lt_dump_args \${1+\"\$@\"} 1>&2
4413 fi
4414 exec \"\$progdir/\$program\" \${1+\"\$@\"}
4415"
4416 ;;
4417 esac
4418 $ECHO "\
4419 \$ECHO \"\$0: cannot exec \$program \$*\" 1>&2
4420 exit 1
4421}
4422
4423# A function to encapsulate launching the target application
4424# Strips options in the --lt-* namespace from \$@ and
4425# launches target application with the remaining arguments.
4426func_exec_program ()
4427{
cristy2542fc62011-12-06 17:50:25 +00004428 case \" \$* \" in
4429 *\\ --lt-*)
4430 for lt_wr_arg
4431 do
4432 case \$lt_wr_arg in
4433 --lt-*) ;;
4434 *) set x \"\$@\" \"\$lt_wr_arg\"; shift;;
4435 esac
4436 shift
4437 done ;;
4438 esac
cristy98dddb52010-11-04 00:30:15 +00004439 func_exec_program_core \${1+\"\$@\"}
4440}
4441
4442 # Parse options
4443 func_parse_lt_options \"\$0\" \${1+\"\$@\"}
cristy3ed852e2009-09-05 21:47:34 +00004444
4445 # Find the directory that this script lives in.
cristy98dddb52010-11-04 00:30:15 +00004446 thisdir=\`\$ECHO \"\$file\" | $SED 's%/[^/]*$%%'\`
cristy3ed852e2009-09-05 21:47:34 +00004447 test \"x\$thisdir\" = \"x\$file\" && thisdir=.
4448
4449 # Follow symbolic links until we get to the real thisdir.
cristy98dddb52010-11-04 00:30:15 +00004450 file=\`ls -ld \"\$file\" | $SED -n 's/.*-> //p'\`
cristy3ed852e2009-09-05 21:47:34 +00004451 while test -n \"\$file\"; do
cristy98dddb52010-11-04 00:30:15 +00004452 destdir=\`\$ECHO \"\$file\" | $SED 's%/[^/]*\$%%'\`
cristy3ed852e2009-09-05 21:47:34 +00004453
4454 # If there was a directory component, then change thisdir.
4455 if test \"x\$destdir\" != \"x\$file\"; then
4456 case \"\$destdir\" in
4457 [\\\\/]* | [A-Za-z]:[\\\\/]*) thisdir=\"\$destdir\" ;;
4458 *) thisdir=\"\$thisdir/\$destdir\" ;;
4459 esac
4460 fi
4461
cristy98dddb52010-11-04 00:30:15 +00004462 file=\`\$ECHO \"\$file\" | $SED 's%^.*/%%'\`
4463 file=\`ls -ld \"\$thisdir/\$file\" | $SED -n 's/.*-> //p'\`
cristy3ed852e2009-09-05 21:47:34 +00004464 done
cristy3ed852e2009-09-05 21:47:34 +00004465
4466 # Usually 'no', except on cygwin/mingw when embedded into
4467 # the cwrapper.
cristy98dddb52010-11-04 00:30:15 +00004468 WRAPPER_SCRIPT_BELONGS_IN_OBJDIR=$func_emit_wrapper_arg1
cristy3ed852e2009-09-05 21:47:34 +00004469 if test \"\$WRAPPER_SCRIPT_BELONGS_IN_OBJDIR\" = \"yes\"; then
4470 # special case for '.'
4471 if test \"\$thisdir\" = \".\"; then
4472 thisdir=\`pwd\`
4473 fi
4474 # remove .libs from thisdir
4475 case \"\$thisdir\" in
cristy98dddb52010-11-04 00:30:15 +00004476 *[\\\\/]$objdir ) thisdir=\`\$ECHO \"\$thisdir\" | $SED 's%[\\\\/][^\\\\/]*$%%'\` ;;
cristy3ed852e2009-09-05 21:47:34 +00004477 $objdir ) thisdir=. ;;
4478 esac
4479 fi
4480
4481 # Try to get the absolute directory name.
4482 absdir=\`cd \"\$thisdir\" && pwd\`
4483 test -n \"\$absdir\" && thisdir=\"\$absdir\"
4484"
4485
4486 if test "$fast_install" = yes; then
4487 $ECHO "\
4488 program=lt-'$outputname'$exeext
4489 progdir=\"\$thisdir/$objdir\"
4490
4491 if test ! -f \"\$progdir/\$program\" ||
4492 { file=\`ls -1dt \"\$progdir/\$program\" \"\$progdir/../\$program\" 2>/dev/null | ${SED} 1q\`; \\
4493 test \"X\$file\" != \"X\$progdir/\$program\"; }; then
4494
4495 file=\"\$\$-\$program\"
4496
4497 if test ! -d \"\$progdir\"; then
4498 $MKDIR \"\$progdir\"
4499 else
4500 $RM \"\$progdir/\$file\"
4501 fi"
4502
4503 $ECHO "\
4504
4505 # relink executable if necessary
4506 if test -n \"\$relink_command\"; then
4507 if relink_command_output=\`eval \$relink_command 2>&1\`; then :
4508 else
4509 $ECHO \"\$relink_command_output\" >&2
4510 $RM \"\$progdir/\$file\"
4511 exit 1
4512 fi
4513 fi
4514
4515 $MV \"\$progdir/\$file\" \"\$progdir/\$program\" 2>/dev/null ||
4516 { $RM \"\$progdir/\$program\";
4517 $MV \"\$progdir/\$file\" \"\$progdir/\$program\"; }
4518 $RM \"\$progdir/\$file\"
4519 fi"
4520 else
4521 $ECHO "\
4522 program='$outputname'
4523 progdir=\"\$thisdir/$objdir\"
4524"
4525 fi
4526
4527 $ECHO "\
4528
4529 if test -f \"\$progdir/\$program\"; then"
4530
cristyda16f162011-02-19 23:52:17 +00004531 # fixup the dll searchpath if we need to.
4532 #
4533 # Fix the DLL searchpath if we need to. Do this before prepending
4534 # to shlibpath, because on Windows, both are PATH and uninstalled
4535 # libraries must come first.
4536 if test -n "$dllsearchpath"; then
4537 $ECHO "\
4538 # Add the dll search path components to the executable PATH
4539 PATH=$dllsearchpath:\$PATH
4540"
4541 fi
4542
cristy3ed852e2009-09-05 21:47:34 +00004543 # Export our shlibpath_var if we have one.
4544 if test "$shlibpath_overrides_runpath" = yes && test -n "$shlibpath_var" && test -n "$temp_rpath"; then
4545 $ECHO "\
4546 # Add our own library path to $shlibpath_var
4547 $shlibpath_var=\"$temp_rpath\$$shlibpath_var\"
4548
4549 # Some systems cannot cope with colon-terminated $shlibpath_var
4550 # The second colon is a workaround for a bug in BeOS R4 sed
cristy98dddb52010-11-04 00:30:15 +00004551 $shlibpath_var=\`\$ECHO \"\$$shlibpath_var\" | $SED 's/::*\$//'\`
cristy3ed852e2009-09-05 21:47:34 +00004552
4553 export $shlibpath_var
4554"
4555 fi
4556
cristy3ed852e2009-09-05 21:47:34 +00004557 $ECHO "\
4558 if test \"\$libtool_execute_magic\" != \"$magic\"; then
4559 # Run the actual program with our arguments.
cristy98dddb52010-11-04 00:30:15 +00004560 func_exec_program \${1+\"\$@\"}
cristy3ed852e2009-09-05 21:47:34 +00004561 fi
4562 else
4563 # The program doesn't exist.
4564 \$ECHO \"\$0: error: \\\`\$progdir/\$program' does not exist\" 1>&2
4565 \$ECHO \"This script is just a wrapper for \$program.\" 1>&2
cristy98dddb52010-11-04 00:30:15 +00004566 \$ECHO \"See the $PACKAGE documentation for more information.\" 1>&2
cristy3ed852e2009-09-05 21:47:34 +00004567 exit 1
4568 fi
4569fi\
4570"
4571}
cristy3ed852e2009-09-05 21:47:34 +00004572
4573
cristy3ed852e2009-09-05 21:47:34 +00004574# func_emit_cwrapperexe_src
4575# emit the source code for a wrapper executable on stdout
4576# Must ONLY be called from within func_mode_link because
4577# it depends on a number of variable set therein.
4578func_emit_cwrapperexe_src ()
4579{
4580 cat <<EOF
4581
4582/* $cwrappersource - temporary wrapper executable for $objdir/$outputname
4583 Generated by $PROGRAM (GNU $PACKAGE$TIMESTAMP) $VERSION
4584
4585 The $output program cannot be directly executed until all the libtool
4586 libraries that it depends on are installed.
4587
4588 This wrapper executable should never be moved out of the build directory.
4589 If it is, it will not operate correctly.
cristy3ed852e2009-09-05 21:47:34 +00004590*/
4591EOF
4592 cat <<"EOF"
cristy98dddb52010-11-04 00:30:15 +00004593#ifdef _MSC_VER
4594# define _CRT_SECURE_NO_DEPRECATE 1
4595#endif
cristy3ed852e2009-09-05 21:47:34 +00004596#include <stdio.h>
4597#include <stdlib.h>
4598#ifdef _MSC_VER
4599# include <direct.h>
4600# include <process.h>
4601# include <io.h>
cristy3ed852e2009-09-05 21:47:34 +00004602#else
4603# include <unistd.h>
4604# include <stdint.h>
4605# ifdef __CYGWIN__
4606# include <io.h>
cristy3ed852e2009-09-05 21:47:34 +00004607# endif
4608#endif
4609#include <malloc.h>
4610#include <stdarg.h>
4611#include <assert.h>
4612#include <string.h>
4613#include <ctype.h>
4614#include <errno.h>
4615#include <fcntl.h>
4616#include <sys/stat.h>
4617
cristy98dddb52010-11-04 00:30:15 +00004618/* declarations of non-ANSI functions */
4619#if defined(__MINGW32__)
4620# ifdef __STRICT_ANSI__
4621int _putenv (const char *);
4622# endif
4623#elif defined(__CYGWIN__)
4624# ifdef __STRICT_ANSI__
4625char *realpath (const char *, char *);
4626int putenv (char *);
4627int setenv (const char *, const char *, int);
4628# endif
4629/* #elif defined (other platforms) ... */
4630#endif
4631
4632/* portability defines, excluding path handling macros */
4633#if defined(_MSC_VER)
4634# define setmode _setmode
4635# define stat _stat
4636# define chmod _chmod
4637# define getcwd _getcwd
4638# define putenv _putenv
4639# define S_IXUSR _S_IEXEC
4640# ifndef _INTPTR_T_DEFINED
4641# define _INTPTR_T_DEFINED
4642# define intptr_t int
4643# endif
4644#elif defined(__MINGW32__)
4645# define setmode _setmode
4646# define stat _stat
4647# define chmod _chmod
4648# define getcwd _getcwd
4649# define putenv _putenv
4650#elif defined(__CYGWIN__)
4651# define HAVE_SETENV
4652# define FOPEN_WB "wb"
4653/* #elif defined (other platforms) ... */
4654#endif
4655
cristy3ed852e2009-09-05 21:47:34 +00004656#if defined(PATH_MAX)
4657# define LT_PATHMAX PATH_MAX
4658#elif defined(MAXPATHLEN)
4659# define LT_PATHMAX MAXPATHLEN
4660#else
4661# define LT_PATHMAX 1024
4662#endif
4663
4664#ifndef S_IXOTH
4665# define S_IXOTH 0
4666#endif
4667#ifndef S_IXGRP
4668# define S_IXGRP 0
4669#endif
4670
cristy98dddb52010-11-04 00:30:15 +00004671/* path handling portability macros */
cristy3ed852e2009-09-05 21:47:34 +00004672#ifndef DIR_SEPARATOR
4673# define DIR_SEPARATOR '/'
4674# define PATH_SEPARATOR ':'
4675#endif
4676
4677#if defined (_WIN32) || defined (__MSDOS__) || defined (__DJGPP__) || \
4678 defined (__OS2__)
4679# define HAVE_DOS_BASED_FILE_SYSTEM
4680# define FOPEN_WB "wb"
4681# ifndef DIR_SEPARATOR_2
4682# define DIR_SEPARATOR_2 '\\'
4683# endif
4684# ifndef PATH_SEPARATOR_2
4685# define PATH_SEPARATOR_2 ';'
4686# endif
4687#endif
4688
4689#ifndef DIR_SEPARATOR_2
4690# define IS_DIR_SEPARATOR(ch) ((ch) == DIR_SEPARATOR)
4691#else /* DIR_SEPARATOR_2 */
4692# define IS_DIR_SEPARATOR(ch) \
4693 (((ch) == DIR_SEPARATOR) || ((ch) == DIR_SEPARATOR_2))
4694#endif /* DIR_SEPARATOR_2 */
4695
4696#ifndef PATH_SEPARATOR_2
4697# define IS_PATH_SEPARATOR(ch) ((ch) == PATH_SEPARATOR)
4698#else /* PATH_SEPARATOR_2 */
4699# define IS_PATH_SEPARATOR(ch) ((ch) == PATH_SEPARATOR_2)
4700#endif /* PATH_SEPARATOR_2 */
4701
cristy3ed852e2009-09-05 21:47:34 +00004702#ifndef FOPEN_WB
4703# define FOPEN_WB "w"
4704#endif
4705#ifndef _O_BINARY
4706# define _O_BINARY 0
4707#endif
4708
4709#define XMALLOC(type, num) ((type *) xmalloc ((num) * sizeof(type)))
4710#define XFREE(stale) do { \
4711 if (stale) { free ((void *) stale); stale = 0; } \
4712} while (0)
4713
cristy98dddb52010-11-04 00:30:15 +00004714#if defined(LT_DEBUGWRAPPER)
4715static int lt_debug = 1;
cristy3ed852e2009-09-05 21:47:34 +00004716#else
cristy98dddb52010-11-04 00:30:15 +00004717static int lt_debug = 0;
cristy3ed852e2009-09-05 21:47:34 +00004718#endif
4719
cristy98dddb52010-11-04 00:30:15 +00004720const char *program_name = "libtool-wrapper"; /* in case xstrdup fails */
cristy3ed852e2009-09-05 21:47:34 +00004721
4722void *xmalloc (size_t num);
4723char *xstrdup (const char *string);
4724const char *base_name (const char *name);
4725char *find_executable (const char *wrapper);
4726char *chase_symlinks (const char *pathspec);
4727int make_executable (const char *path);
4728int check_executable (const char *path);
4729char *strendzap (char *str, const char *pat);
cristy98dddb52010-11-04 00:30:15 +00004730void lt_debugprintf (const char *file, int line, const char *fmt, ...);
4731void lt_fatal (const char *file, int line, const char *message, ...);
4732static const char *nonnull (const char *s);
4733static const char *nonempty (const char *s);
cristy3ed852e2009-09-05 21:47:34 +00004734void lt_setenv (const char *name, const char *value);
4735char *lt_extend_str (const char *orig_value, const char *add, int to_end);
cristy3ed852e2009-09-05 21:47:34 +00004736void lt_update_exe_path (const char *name, const char *value);
4737void lt_update_lib_path (const char *name, const char *value);
cristy98dddb52010-11-04 00:30:15 +00004738char **prepare_spawn (char **argv);
4739void lt_dump_script (FILE *f);
cristy3ed852e2009-09-05 21:47:34 +00004740EOF
4741
cristy3ed852e2009-09-05 21:47:34 +00004742 cat <<EOF
cristyda16f162011-02-19 23:52:17 +00004743volatile const char * MAGIC_EXE = "$magic_exe";
cristy3ed852e2009-09-05 21:47:34 +00004744const char * LIB_PATH_VARNAME = "$shlibpath_var";
4745EOF
4746
4747 if test "$shlibpath_overrides_runpath" = yes && test -n "$shlibpath_var" && test -n "$temp_rpath"; then
cristyda16f162011-02-19 23:52:17 +00004748 func_to_host_path "$temp_rpath"
cristy3ed852e2009-09-05 21:47:34 +00004749 cat <<EOF
cristyda16f162011-02-19 23:52:17 +00004750const char * LIB_PATH_VALUE = "$func_to_host_path_result";
cristy3ed852e2009-09-05 21:47:34 +00004751EOF
4752 else
4753 cat <<"EOF"
4754const char * LIB_PATH_VALUE = "";
4755EOF
4756 fi
4757
4758 if test -n "$dllsearchpath"; then
cristyda16f162011-02-19 23:52:17 +00004759 func_to_host_path "$dllsearchpath:"
cristy3ed852e2009-09-05 21:47:34 +00004760 cat <<EOF
4761const char * EXE_PATH_VARNAME = "PATH";
cristyda16f162011-02-19 23:52:17 +00004762const char * EXE_PATH_VALUE = "$func_to_host_path_result";
cristy3ed852e2009-09-05 21:47:34 +00004763EOF
4764 else
4765 cat <<"EOF"
4766const char * EXE_PATH_VARNAME = "";
4767const char * EXE_PATH_VALUE = "";
4768EOF
4769 fi
4770
4771 if test "$fast_install" = yes; then
4772 cat <<EOF
4773const char * TARGET_PROGRAM_NAME = "lt-$outputname"; /* hopefully, no .exe */
4774EOF
4775 else
4776 cat <<EOF
4777const char * TARGET_PROGRAM_NAME = "$outputname"; /* hopefully, no .exe */
4778EOF
4779 fi
4780
4781
4782 cat <<"EOF"
4783
4784#define LTWRAPPER_OPTION_PREFIX "--lt-"
cristy3ed852e2009-09-05 21:47:34 +00004785
cristy3ed852e2009-09-05 21:47:34 +00004786static const char *ltwrapper_option_prefix = LTWRAPPER_OPTION_PREFIX;
cristy3ed852e2009-09-05 21:47:34 +00004787static const char *dumpscript_opt = LTWRAPPER_OPTION_PREFIX "dump-script";
cristy98dddb52010-11-04 00:30:15 +00004788static const char *debug_opt = LTWRAPPER_OPTION_PREFIX "debug";
cristycd4c5312009-11-22 01:19:08 +00004789
cristy3ed852e2009-09-05 21:47:34 +00004790int
4791main (int argc, char *argv[])
4792{
4793 char **newargz;
4794 int newargc;
4795 char *tmp_pathspec;
4796 char *actual_cwrapper_path;
4797 char *actual_cwrapper_name;
4798 char *target_name;
4799 char *lt_argv_zero;
4800 intptr_t rval = 127;
4801
4802 int i;
4803
4804 program_name = (char *) xstrdup (base_name (argv[0]));
cristy98dddb52010-11-04 00:30:15 +00004805 newargz = XMALLOC (char *, argc + 1);
cristy3ed852e2009-09-05 21:47:34 +00004806
cristy98dddb52010-11-04 00:30:15 +00004807 /* very simple arg parsing; don't want to rely on getopt
4808 * also, copy all non cwrapper options to newargz, except
4809 * argz[0], which is handled differently
4810 */
4811 newargc=0;
cristy3ed852e2009-09-05 21:47:34 +00004812 for (i = 1; i < argc; i++)
4813 {
4814 if (strcmp (argv[i], dumpscript_opt) == 0)
4815 {
4816EOF
4817 case "$host" in
4818 *mingw* | *cygwin* )
4819 # make stdout use "unix" line endings
4820 echo " setmode(1,_O_BINARY);"
4821 ;;
4822 esac
4823
4824 cat <<"EOF"
cristy98dddb52010-11-04 00:30:15 +00004825 lt_dump_script (stdout);
cristy3ed852e2009-09-05 21:47:34 +00004826 return 0;
4827 }
cristy98dddb52010-11-04 00:30:15 +00004828 if (strcmp (argv[i], debug_opt) == 0)
4829 {
4830 lt_debug = 1;
4831 continue;
4832 }
4833 if (strcmp (argv[i], ltwrapper_option_prefix) == 0)
4834 {
4835 /* however, if there is an option in the LTWRAPPER_OPTION_PREFIX
4836 namespace, but it is not one of the ones we know about and
4837 have already dealt with, above (inluding dump-script), then
4838 report an error. Otherwise, targets might begin to believe
4839 they are allowed to use options in the LTWRAPPER_OPTION_PREFIX
4840 namespace. The first time any user complains about this, we'll
4841 need to make LTWRAPPER_OPTION_PREFIX a configure-time option
4842 or a configure.ac-settable value.
4843 */
4844 lt_fatal (__FILE__, __LINE__,
4845 "unrecognized %s option: '%s'",
4846 ltwrapper_option_prefix, argv[i]);
4847 }
4848 /* otherwise ... */
4849 newargz[++newargc] = xstrdup (argv[i]);
cristy3ed852e2009-09-05 21:47:34 +00004850 }
cristy98dddb52010-11-04 00:30:15 +00004851 newargz[++newargc] = NULL;
cristy3ed852e2009-09-05 21:47:34 +00004852
cristy98dddb52010-11-04 00:30:15 +00004853EOF
4854 cat <<EOF
4855 /* The GNU banner must be the first non-error debug message */
4856 lt_debugprintf (__FILE__, __LINE__, "libtool wrapper (GNU $PACKAGE$TIMESTAMP) $VERSION\n");
4857EOF
4858 cat <<"EOF"
4859 lt_debugprintf (__FILE__, __LINE__, "(main) argv[0]: %s\n", argv[0]);
4860 lt_debugprintf (__FILE__, __LINE__, "(main) program_name: %s\n", program_name);
4861
cristy3ed852e2009-09-05 21:47:34 +00004862 tmp_pathspec = find_executable (argv[0]);
4863 if (tmp_pathspec == NULL)
cristy98dddb52010-11-04 00:30:15 +00004864 lt_fatal (__FILE__, __LINE__, "couldn't find %s", argv[0]);
4865 lt_debugprintf (__FILE__, __LINE__,
4866 "(main) found exe (before symlink chase) at: %s\n",
4867 tmp_pathspec);
cristy3ed852e2009-09-05 21:47:34 +00004868
4869 actual_cwrapper_path = chase_symlinks (tmp_pathspec);
cristy98dddb52010-11-04 00:30:15 +00004870 lt_debugprintf (__FILE__, __LINE__,
4871 "(main) found exe (after symlink chase) at: %s\n",
4872 actual_cwrapper_path);
cristy3ed852e2009-09-05 21:47:34 +00004873 XFREE (tmp_pathspec);
4874
cristy98dddb52010-11-04 00:30:15 +00004875 actual_cwrapper_name = xstrdup (base_name (actual_cwrapper_path));
cristy3ed852e2009-09-05 21:47:34 +00004876 strendzap (actual_cwrapper_path, actual_cwrapper_name);
4877
4878 /* wrapper name transforms */
4879 strendzap (actual_cwrapper_name, ".exe");
4880 tmp_pathspec = lt_extend_str (actual_cwrapper_name, ".exe", 1);
4881 XFREE (actual_cwrapper_name);
4882 actual_cwrapper_name = tmp_pathspec;
4883 tmp_pathspec = 0;
4884
4885 /* target_name transforms -- use actual target program name; might have lt- prefix */
4886 target_name = xstrdup (base_name (TARGET_PROGRAM_NAME));
4887 strendzap (target_name, ".exe");
4888 tmp_pathspec = lt_extend_str (target_name, ".exe", 1);
4889 XFREE (target_name);
4890 target_name = tmp_pathspec;
4891 tmp_pathspec = 0;
4892
cristy98dddb52010-11-04 00:30:15 +00004893 lt_debugprintf (__FILE__, __LINE__,
4894 "(main) libtool target name: %s\n",
4895 target_name);
cristy3ed852e2009-09-05 21:47:34 +00004896EOF
4897
4898 cat <<EOF
4899 newargz[0] =
4900 XMALLOC (char, (strlen (actual_cwrapper_path) +
4901 strlen ("$objdir") + 1 + strlen (actual_cwrapper_name) + 1));
4902 strcpy (newargz[0], actual_cwrapper_path);
4903 strcat (newargz[0], "$objdir");
4904 strcat (newargz[0], "/");
4905EOF
4906
4907 cat <<"EOF"
4908 /* stop here, and copy so we don't have to do this twice */
4909 tmp_pathspec = xstrdup (newargz[0]);
4910
4911 /* do NOT want the lt- prefix here, so use actual_cwrapper_name */
4912 strcat (newargz[0], actual_cwrapper_name);
4913
4914 /* DO want the lt- prefix here if it exists, so use target_name */
4915 lt_argv_zero = lt_extend_str (tmp_pathspec, target_name, 1);
4916 XFREE (tmp_pathspec);
4917 tmp_pathspec = NULL;
4918EOF
4919
4920 case $host_os in
4921 mingw*)
4922 cat <<"EOF"
4923 {
4924 char* p;
4925 while ((p = strchr (newargz[0], '\\')) != NULL)
4926 {
4927 *p = '/';
4928 }
4929 while ((p = strchr (lt_argv_zero, '\\')) != NULL)
4930 {
4931 *p = '/';
4932 }
4933 }
4934EOF
4935 ;;
4936 esac
4937
4938 cat <<"EOF"
4939 XFREE (target_name);
4940 XFREE (actual_cwrapper_path);
4941 XFREE (actual_cwrapper_name);
4942
4943 lt_setenv ("BIN_SH", "xpg4"); /* for Tru64 */
4944 lt_setenv ("DUALCASE", "1"); /* for MSK sh */
cristyda16f162011-02-19 23:52:17 +00004945 /* Update the DLL searchpath. EXE_PATH_VALUE ($dllsearchpath) must
4946 be prepended before (that is, appear after) LIB_PATH_VALUE ($temp_rpath)
4947 because on Windows, both *_VARNAMEs are PATH but uninstalled
4948 libraries must come first. */
cristy3ed852e2009-09-05 21:47:34 +00004949 lt_update_exe_path (EXE_PATH_VARNAME, EXE_PATH_VALUE);
cristyda16f162011-02-19 23:52:17 +00004950 lt_update_lib_path (LIB_PATH_VARNAME, LIB_PATH_VALUE);
cristy3ed852e2009-09-05 21:47:34 +00004951
cristy98dddb52010-11-04 00:30:15 +00004952 lt_debugprintf (__FILE__, __LINE__, "(main) lt_argv_zero: %s\n",
4953 nonnull (lt_argv_zero));
cristy3ed852e2009-09-05 21:47:34 +00004954 for (i = 0; i < newargc; i++)
4955 {
cristy98dddb52010-11-04 00:30:15 +00004956 lt_debugprintf (__FILE__, __LINE__, "(main) newargz[%d]: %s\n",
4957 i, nonnull (newargz[i]));
cristy3ed852e2009-09-05 21:47:34 +00004958 }
4959
4960EOF
4961
4962 case $host_os in
4963 mingw*)
4964 cat <<"EOF"
4965 /* execv doesn't actually work on mingw as expected on unix */
cristy98dddb52010-11-04 00:30:15 +00004966 newargz = prepare_spawn (newargz);
cristy3ed852e2009-09-05 21:47:34 +00004967 rval = _spawnv (_P_WAIT, lt_argv_zero, (const char * const *) newargz);
4968 if (rval == -1)
4969 {
4970 /* failed to start process */
cristy98dddb52010-11-04 00:30:15 +00004971 lt_debugprintf (__FILE__, __LINE__,
4972 "(main) failed to launch target \"%s\": %s\n",
4973 lt_argv_zero, nonnull (strerror (errno)));
cristy3ed852e2009-09-05 21:47:34 +00004974 return 127;
4975 }
4976 return rval;
4977EOF
4978 ;;
4979 *)
4980 cat <<"EOF"
4981 execv (lt_argv_zero, newargz);
4982 return rval; /* =127, but avoids unused variable warning */
4983EOF
4984 ;;
4985 esac
4986
4987 cat <<"EOF"
4988}
4989
4990void *
4991xmalloc (size_t num)
4992{
4993 void *p = (void *) malloc (num);
4994 if (!p)
cristy98dddb52010-11-04 00:30:15 +00004995 lt_fatal (__FILE__, __LINE__, "memory exhausted");
cristy3ed852e2009-09-05 21:47:34 +00004996
4997 return p;
4998}
4999
5000char *
5001xstrdup (const char *string)
5002{
5003 return string ? strcpy ((char *) xmalloc (strlen (string) + 1),
5004 string) : NULL;
5005}
5006
5007const char *
5008base_name (const char *name)
5009{
5010 const char *base;
5011
5012#if defined (HAVE_DOS_BASED_FILE_SYSTEM)
5013 /* Skip over the disk name in MSDOS pathnames. */
5014 if (isalpha ((unsigned char) name[0]) && name[1] == ':')
5015 name += 2;
5016#endif
5017
5018 for (base = name; *name; name++)
5019 if (IS_DIR_SEPARATOR (*name))
5020 base = name + 1;
5021 return base;
5022}
5023
5024int
5025check_executable (const char *path)
5026{
5027 struct stat st;
5028
cristy98dddb52010-11-04 00:30:15 +00005029 lt_debugprintf (__FILE__, __LINE__, "(check_executable): %s\n",
5030 nonempty (path));
cristy3ed852e2009-09-05 21:47:34 +00005031 if ((!path) || (!*path))
5032 return 0;
5033
5034 if ((stat (path, &st) >= 0)
5035 && (st.st_mode & (S_IXUSR | S_IXGRP | S_IXOTH)))
5036 return 1;
5037 else
5038 return 0;
5039}
5040
5041int
5042make_executable (const char *path)
5043{
5044 int rval = 0;
5045 struct stat st;
5046
cristy98dddb52010-11-04 00:30:15 +00005047 lt_debugprintf (__FILE__, __LINE__, "(make_executable): %s\n",
5048 nonempty (path));
cristy3ed852e2009-09-05 21:47:34 +00005049 if ((!path) || (!*path))
5050 return 0;
5051
5052 if (stat (path, &st) >= 0)
5053 {
5054 rval = chmod (path, st.st_mode | S_IXOTH | S_IXGRP | S_IXUSR);
5055 }
5056 return rval;
5057}
5058
5059/* Searches for the full path of the wrapper. Returns
5060 newly allocated full path name if found, NULL otherwise
5061 Does not chase symlinks, even on platforms that support them.
5062*/
5063char *
5064find_executable (const char *wrapper)
5065{
5066 int has_slash = 0;
5067 const char *p;
5068 const char *p_next;
5069 /* static buffer for getcwd */
5070 char tmp[LT_PATHMAX + 1];
5071 int tmp_len;
5072 char *concat_name;
5073
cristy98dddb52010-11-04 00:30:15 +00005074 lt_debugprintf (__FILE__, __LINE__, "(find_executable): %s\n",
5075 nonempty (wrapper));
cristy3ed852e2009-09-05 21:47:34 +00005076
5077 if ((wrapper == NULL) || (*wrapper == '\0'))
5078 return NULL;
5079
5080 /* Absolute path? */
5081#if defined (HAVE_DOS_BASED_FILE_SYSTEM)
5082 if (isalpha ((unsigned char) wrapper[0]) && wrapper[1] == ':')
5083 {
5084 concat_name = xstrdup (wrapper);
5085 if (check_executable (concat_name))
5086 return concat_name;
5087 XFREE (concat_name);
5088 }
5089 else
5090 {
5091#endif
5092 if (IS_DIR_SEPARATOR (wrapper[0]))
5093 {
5094 concat_name = xstrdup (wrapper);
5095 if (check_executable (concat_name))
5096 return concat_name;
5097 XFREE (concat_name);
5098 }
5099#if defined (HAVE_DOS_BASED_FILE_SYSTEM)
5100 }
5101#endif
5102
5103 for (p = wrapper; *p; p++)
5104 if (*p == '/')
5105 {
5106 has_slash = 1;
5107 break;
5108 }
5109 if (!has_slash)
5110 {
5111 /* no slashes; search PATH */
5112 const char *path = getenv ("PATH");
5113 if (path != NULL)
5114 {
5115 for (p = path; *p; p = p_next)
5116 {
5117 const char *q;
5118 size_t p_len;
5119 for (q = p; *q; q++)
5120 if (IS_PATH_SEPARATOR (*q))
5121 break;
5122 p_len = q - p;
5123 p_next = (*q == '\0' ? q : q + 1);
5124 if (p_len == 0)
5125 {
5126 /* empty path: current directory */
5127 if (getcwd (tmp, LT_PATHMAX) == NULL)
cristy98dddb52010-11-04 00:30:15 +00005128 lt_fatal (__FILE__, __LINE__, "getcwd failed: %s",
5129 nonnull (strerror (errno)));
cristy3ed852e2009-09-05 21:47:34 +00005130 tmp_len = strlen (tmp);
5131 concat_name =
5132 XMALLOC (char, tmp_len + 1 + strlen (wrapper) + 1);
5133 memcpy (concat_name, tmp, tmp_len);
5134 concat_name[tmp_len] = '/';
5135 strcpy (concat_name + tmp_len + 1, wrapper);
5136 }
5137 else
5138 {
5139 concat_name =
5140 XMALLOC (char, p_len + 1 + strlen (wrapper) + 1);
5141 memcpy (concat_name, p, p_len);
5142 concat_name[p_len] = '/';
5143 strcpy (concat_name + p_len + 1, wrapper);
5144 }
5145 if (check_executable (concat_name))
5146 return concat_name;
5147 XFREE (concat_name);
5148 }
5149 }
5150 /* not found in PATH; assume curdir */
5151 }
5152 /* Relative path | not found in path: prepend cwd */
5153 if (getcwd (tmp, LT_PATHMAX) == NULL)
cristy98dddb52010-11-04 00:30:15 +00005154 lt_fatal (__FILE__, __LINE__, "getcwd failed: %s",
5155 nonnull (strerror (errno)));
cristy3ed852e2009-09-05 21:47:34 +00005156 tmp_len = strlen (tmp);
5157 concat_name = XMALLOC (char, tmp_len + 1 + strlen (wrapper) + 1);
5158 memcpy (concat_name, tmp, tmp_len);
5159 concat_name[tmp_len] = '/';
5160 strcpy (concat_name + tmp_len + 1, wrapper);
5161
5162 if (check_executable (concat_name))
5163 return concat_name;
5164 XFREE (concat_name);
5165 return NULL;
5166}
5167
5168char *
5169chase_symlinks (const char *pathspec)
5170{
5171#ifndef S_ISLNK
5172 return xstrdup (pathspec);
5173#else
5174 char buf[LT_PATHMAX];
5175 struct stat s;
5176 char *tmp_pathspec = xstrdup (pathspec);
5177 char *p;
5178 int has_symlinks = 0;
5179 while (strlen (tmp_pathspec) && !has_symlinks)
5180 {
cristy98dddb52010-11-04 00:30:15 +00005181 lt_debugprintf (__FILE__, __LINE__,
5182 "checking path component for symlinks: %s\n",
5183 tmp_pathspec);
cristy3ed852e2009-09-05 21:47:34 +00005184 if (lstat (tmp_pathspec, &s) == 0)
5185 {
5186 if (S_ISLNK (s.st_mode) != 0)
5187 {
5188 has_symlinks = 1;
5189 break;
5190 }
5191
5192 /* search backwards for last DIR_SEPARATOR */
5193 p = tmp_pathspec + strlen (tmp_pathspec) - 1;
5194 while ((p > tmp_pathspec) && (!IS_DIR_SEPARATOR (*p)))
5195 p--;
5196 if ((p == tmp_pathspec) && (!IS_DIR_SEPARATOR (*p)))
5197 {
5198 /* no more DIR_SEPARATORS left */
5199 break;
5200 }
5201 *p = '\0';
5202 }
5203 else
5204 {
cristy98dddb52010-11-04 00:30:15 +00005205 lt_fatal (__FILE__, __LINE__,
5206 "error accessing file \"%s\": %s",
5207 tmp_pathspec, nonnull (strerror (errno)));
cristy3ed852e2009-09-05 21:47:34 +00005208 }
5209 }
5210 XFREE (tmp_pathspec);
5211
5212 if (!has_symlinks)
5213 {
5214 return xstrdup (pathspec);
5215 }
5216
5217 tmp_pathspec = realpath (pathspec, buf);
5218 if (tmp_pathspec == 0)
5219 {
cristy98dddb52010-11-04 00:30:15 +00005220 lt_fatal (__FILE__, __LINE__,
5221 "could not follow symlinks for %s", pathspec);
cristy3ed852e2009-09-05 21:47:34 +00005222 }
5223 return xstrdup (tmp_pathspec);
5224#endif
5225}
5226
5227char *
5228strendzap (char *str, const char *pat)
5229{
5230 size_t len, patlen;
5231
5232 assert (str != NULL);
5233 assert (pat != NULL);
5234
5235 len = strlen (str);
5236 patlen = strlen (pat);
5237
5238 if (patlen <= len)
5239 {
5240 str += len - patlen;
5241 if (strcmp (str, pat) == 0)
5242 *str = '\0';
5243 }
5244 return str;
5245}
5246
cristy98dddb52010-11-04 00:30:15 +00005247void
5248lt_debugprintf (const char *file, int line, const char *fmt, ...)
5249{
5250 va_list args;
5251 if (lt_debug)
5252 {
5253 (void) fprintf (stderr, "%s:%s:%d: ", program_name, file, line);
5254 va_start (args, fmt);
5255 (void) vfprintf (stderr, fmt, args);
5256 va_end (args);
5257 }
5258}
5259
cristy3ed852e2009-09-05 21:47:34 +00005260static void
cristy98dddb52010-11-04 00:30:15 +00005261lt_error_core (int exit_status, const char *file,
5262 int line, const char *mode,
cristy3ed852e2009-09-05 21:47:34 +00005263 const char *message, va_list ap)
5264{
cristy98dddb52010-11-04 00:30:15 +00005265 fprintf (stderr, "%s:%s:%d: %s: ", program_name, file, line, mode);
cristy3ed852e2009-09-05 21:47:34 +00005266 vfprintf (stderr, message, ap);
5267 fprintf (stderr, ".\n");
5268
5269 if (exit_status >= 0)
5270 exit (exit_status);
5271}
5272
5273void
cristy98dddb52010-11-04 00:30:15 +00005274lt_fatal (const char *file, int line, const char *message, ...)
cristy3ed852e2009-09-05 21:47:34 +00005275{
5276 va_list ap;
5277 va_start (ap, message);
cristy98dddb52010-11-04 00:30:15 +00005278 lt_error_core (EXIT_FAILURE, file, line, "FATAL", message, ap);
cristy3ed852e2009-09-05 21:47:34 +00005279 va_end (ap);
5280}
5281
cristy98dddb52010-11-04 00:30:15 +00005282static const char *
5283nonnull (const char *s)
5284{
5285 return s ? s : "(null)";
5286}
5287
5288static const char *
5289nonempty (const char *s)
5290{
5291 return (s && !*s) ? "(empty)" : nonnull (s);
5292}
5293
cristy3ed852e2009-09-05 21:47:34 +00005294void
5295lt_setenv (const char *name, const char *value)
5296{
cristy98dddb52010-11-04 00:30:15 +00005297 lt_debugprintf (__FILE__, __LINE__,
5298 "(lt_setenv) setting '%s' to '%s'\n",
5299 nonnull (name), nonnull (value));
cristy3ed852e2009-09-05 21:47:34 +00005300 {
5301#ifdef HAVE_SETENV
5302 /* always make a copy, for consistency with !HAVE_SETENV */
5303 char *str = xstrdup (value);
5304 setenv (name, str, 1);
5305#else
5306 int len = strlen (name) + 1 + strlen (value) + 1;
5307 char *str = XMALLOC (char, len);
5308 sprintf (str, "%s=%s", name, value);
5309 if (putenv (str) != EXIT_SUCCESS)
5310 {
5311 XFREE (str);
5312 }
5313#endif
5314 }
5315}
5316
5317char *
5318lt_extend_str (const char *orig_value, const char *add, int to_end)
5319{
5320 char *new_value;
5321 if (orig_value && *orig_value)
5322 {
5323 int orig_value_len = strlen (orig_value);
5324 int add_len = strlen (add);
5325 new_value = XMALLOC (char, add_len + orig_value_len + 1);
5326 if (to_end)
5327 {
5328 strcpy (new_value, orig_value);
5329 strcpy (new_value + orig_value_len, add);
5330 }
5331 else
5332 {
5333 strcpy (new_value, add);
5334 strcpy (new_value + add_len, orig_value);
5335 }
5336 }
5337 else
5338 {
5339 new_value = xstrdup (add);
5340 }
5341 return new_value;
5342}
5343
cristy3ed852e2009-09-05 21:47:34 +00005344void
5345lt_update_exe_path (const char *name, const char *value)
5346{
cristy98dddb52010-11-04 00:30:15 +00005347 lt_debugprintf (__FILE__, __LINE__,
5348 "(lt_update_exe_path) modifying '%s' by prepending '%s'\n",
5349 nonnull (name), nonnull (value));
cristy3ed852e2009-09-05 21:47:34 +00005350
5351 if (name && *name && value && *value)
5352 {
5353 char *new_value = lt_extend_str (getenv (name), value, 0);
5354 /* some systems can't cope with a ':'-terminated path #' */
5355 int len = strlen (new_value);
5356 while (((len = strlen (new_value)) > 0) && IS_PATH_SEPARATOR (new_value[len-1]))
5357 {
5358 new_value[len-1] = '\0';
5359 }
5360 lt_setenv (name, new_value);
5361 XFREE (new_value);
5362 }
5363}
5364
5365void
5366lt_update_lib_path (const char *name, const char *value)
5367{
cristy98dddb52010-11-04 00:30:15 +00005368 lt_debugprintf (__FILE__, __LINE__,
5369 "(lt_update_lib_path) modifying '%s' by prepending '%s'\n",
5370 nonnull (name), nonnull (value));
cristy3ed852e2009-09-05 21:47:34 +00005371
5372 if (name && *name && value && *value)
5373 {
5374 char *new_value = lt_extend_str (getenv (name), value, 0);
5375 lt_setenv (name, new_value);
5376 XFREE (new_value);
5377 }
5378}
5379
cristy98dddb52010-11-04 00:30:15 +00005380EOF
5381 case $host_os in
5382 mingw*)
5383 cat <<"EOF"
cristy3ed852e2009-09-05 21:47:34 +00005384
cristy98dddb52010-11-04 00:30:15 +00005385/* Prepares an argument vector before calling spawn().
5386 Note that spawn() does not by itself call the command interpreter
5387 (getenv ("COMSPEC") != NULL ? getenv ("COMSPEC") :
5388 ({ OSVERSIONINFO v; v.dwOSVersionInfoSize = sizeof(OSVERSIONINFO);
5389 GetVersionEx(&v);
5390 v.dwPlatformId == VER_PLATFORM_WIN32_NT;
5391 }) ? "cmd.exe" : "command.com").
5392 Instead it simply concatenates the arguments, separated by ' ', and calls
5393 CreateProcess(). We must quote the arguments since Win32 CreateProcess()
5394 interprets characters like ' ', '\t', '\\', '"' (but not '<' and '>') in a
5395 special way:
5396 - Space and tab are interpreted as delimiters. They are not treated as
5397 delimiters if they are surrounded by double quotes: "...".
5398 - Unescaped double quotes are removed from the input. Their only effect is
5399 that within double quotes, space and tab are treated like normal
5400 characters.
5401 - Backslashes not followed by double quotes are not special.
5402 - But 2*n+1 backslashes followed by a double quote become
5403 n backslashes followed by a double quote (n >= 0):
5404 \" -> "
5405 \\\" -> \"
5406 \\\\\" -> \\"
5407 */
5408#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"
5409#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"
5410char **
5411prepare_spawn (char **argv)
5412{
5413 size_t argc;
5414 char **new_argv;
5415 size_t i;
5416
5417 /* Count number of arguments. */
5418 for (argc = 0; argv[argc] != NULL; argc++)
5419 ;
5420
5421 /* Allocate new argument vector. */
5422 new_argv = XMALLOC (char *, argc + 1);
5423
5424 /* Put quoted arguments into the new argument vector. */
5425 for (i = 0; i < argc; i++)
5426 {
5427 const char *string = argv[i];
5428
5429 if (string[0] == '\0')
5430 new_argv[i] = xstrdup ("\"\"");
5431 else if (strpbrk (string, SHELL_SPECIAL_CHARS) != NULL)
5432 {
5433 int quote_around = (strpbrk (string, SHELL_SPACE_CHARS) != NULL);
5434 size_t length;
5435 unsigned int backslashes;
5436 const char *s;
5437 char *quoted_string;
5438 char *p;
5439
5440 length = 0;
5441 backslashes = 0;
5442 if (quote_around)
5443 length++;
5444 for (s = string; *s != '\0'; s++)
5445 {
5446 char c = *s;
5447 if (c == '"')
5448 length += backslashes + 1;
5449 length++;
5450 if (c == '\\')
5451 backslashes++;
5452 else
5453 backslashes = 0;
5454 }
5455 if (quote_around)
5456 length += backslashes + 1;
5457
5458 quoted_string = XMALLOC (char, length + 1);
5459
5460 p = quoted_string;
5461 backslashes = 0;
5462 if (quote_around)
5463 *p++ = '"';
5464 for (s = string; *s != '\0'; s++)
5465 {
5466 char c = *s;
5467 if (c == '"')
5468 {
5469 unsigned int j;
5470 for (j = backslashes + 1; j > 0; j--)
5471 *p++ = '\\';
5472 }
5473 *p++ = c;
5474 if (c == '\\')
5475 backslashes++;
5476 else
5477 backslashes = 0;
5478 }
5479 if (quote_around)
5480 {
5481 unsigned int j;
5482 for (j = backslashes; j > 0; j--)
5483 *p++ = '\\';
5484 *p++ = '"';
5485 }
5486 *p = '\0';
5487
5488 new_argv[i] = quoted_string;
5489 }
5490 else
5491 new_argv[i] = (char *) string;
5492 }
5493 new_argv[argc] = NULL;
5494
5495 return new_argv;
5496}
5497EOF
5498 ;;
5499 esac
5500
5501 cat <<"EOF"
5502void lt_dump_script (FILE* f)
5503{
5504EOF
5505 func_emit_wrapper yes |
cristy2542fc62011-12-06 17:50:25 +00005506 $SED -n -e '
5507s/^\(.\{79\}\)\(..*\)/\1\
5508\2/
5509h
5510s/\([\\"]\)/\\\1/g
5511s/$/\\n/
5512s/\([^\n]*\).*/ fputs ("\1", f);/p
5513g
5514D'
cristy98dddb52010-11-04 00:30:15 +00005515 cat <<"EOF"
5516}
cristy3ed852e2009-09-05 21:47:34 +00005517EOF
5518}
5519# end: func_emit_cwrapperexe_src
5520
cristy98dddb52010-11-04 00:30:15 +00005521# func_win32_import_lib_p ARG
5522# True if ARG is an import lib, as indicated by $file_magic_cmd
5523func_win32_import_lib_p ()
5524{
5525 $opt_debug
5526 case `eval $file_magic_cmd \"\$1\" 2>/dev/null | $SED -e 10q` in
5527 *import*) : ;;
5528 *) false ;;
5529 esac
5530}
5531
cristy3ed852e2009-09-05 21:47:34 +00005532# func_mode_link arg...
5533func_mode_link ()
5534{
5535 $opt_debug
5536 case $host in
5537 *-*-cygwin* | *-*-mingw* | *-*-pw32* | *-*-os2* | *-cegcc*)
5538 # It is impossible to link a dll without this setting, and
5539 # we shouldn't force the makefile maintainer to figure out
5540 # which system we are compiling for in order to pass an extra
5541 # flag for every libtool invocation.
5542 # allow_undefined=no
5543
5544 # FIXME: Unfortunately, there are problems with the above when trying
5545 # to make a dll which has undefined symbols, in which case not
5546 # even a static library is built. For now, we need to specify
5547 # -no-undefined on the libtool link line when we can be certain
5548 # that all symbols are satisfied, otherwise we get a static library.
5549 allow_undefined=yes
5550 ;;
5551 *)
5552 allow_undefined=yes
5553 ;;
5554 esac
5555 libtool_args=$nonopt
5556 base_compile="$nonopt $@"
5557 compile_command=$nonopt
5558 finalize_command=$nonopt
5559
5560 compile_rpath=
5561 finalize_rpath=
5562 compile_shlibpath=
5563 finalize_shlibpath=
5564 convenience=
5565 old_convenience=
5566 deplibs=
5567 old_deplibs=
5568 compiler_flags=
5569 linker_flags=
5570 dllsearchpath=
5571 lib_search_path=`pwd`
5572 inst_prefix_dir=
5573 new_inherited_linker_flags=
5574
5575 avoid_version=no
cristy98dddb52010-11-04 00:30:15 +00005576 bindir=
cristy3ed852e2009-09-05 21:47:34 +00005577 dlfiles=
5578 dlprefiles=
5579 dlself=no
5580 export_dynamic=no
5581 export_symbols=
5582 export_symbols_regex=
5583 generated=
5584 libobjs=
5585 ltlibs=
5586 module=no
5587 no_install=no
5588 objs=
5589 non_pic_objects=
5590 precious_files_regex=
5591 prefer_static_libs=no
5592 preload=no
5593 prev=
5594 prevarg=
5595 release=
5596 rpath=
5597 xrpath=
5598 perm_rpath=
5599 temp_rpath=
5600 thread_safe=no
5601 vinfo=
5602 vinfo_number=no
5603 weak_libs=
5604 single_module="${wl}-single_module"
5605 func_infer_tag $base_compile
5606
5607 # We need to know -static, to get the right output filenames.
5608 for arg
5609 do
5610 case $arg in
5611 -shared)
5612 test "$build_libtool_libs" != yes && \
5613 func_fatal_configuration "can not build a shared library"
5614 build_old_libs=no
5615 break
5616 ;;
5617 -all-static | -static | -static-libtool-libs)
5618 case $arg in
5619 -all-static)
5620 if test "$build_libtool_libs" = yes && test -z "$link_static_flag"; then
5621 func_warning "complete static linking is impossible in this configuration"
5622 fi
5623 if test -n "$link_static_flag"; then
5624 dlopen_self=$dlopen_self_static
5625 fi
5626 prefer_static_libs=yes
5627 ;;
5628 -static)
5629 if test -z "$pic_flag" && test -n "$link_static_flag"; then
5630 dlopen_self=$dlopen_self_static
5631 fi
5632 prefer_static_libs=built
5633 ;;
5634 -static-libtool-libs)
5635 if test -z "$pic_flag" && test -n "$link_static_flag"; then
5636 dlopen_self=$dlopen_self_static
5637 fi
5638 prefer_static_libs=yes
5639 ;;
5640 esac
5641 build_libtool_libs=no
5642 build_old_libs=yes
5643 break
5644 ;;
5645 esac
5646 done
5647
5648 # See if our shared archives depend on static archives.
5649 test -n "$old_archive_from_new_cmds" && build_old_libs=yes
5650
5651 # Go through the arguments, transforming them on the way.
5652 while test "$#" -gt 0; do
5653 arg="$1"
5654 shift
5655 func_quote_for_eval "$arg"
5656 qarg=$func_quote_for_eval_unquoted_result
cristyda16f162011-02-19 23:52:17 +00005657 libtool_args+=" $func_quote_for_eval_result"
cristy3ed852e2009-09-05 21:47:34 +00005658
5659 # If the previous option needs an argument, assign it.
5660 if test -n "$prev"; then
5661 case $prev in
5662 output)
cristyda16f162011-02-19 23:52:17 +00005663 compile_command+=" @OUTPUT@"
5664 finalize_command+=" @OUTPUT@"
cristy3ed852e2009-09-05 21:47:34 +00005665 ;;
5666 esac
5667
5668 case $prev in
cristy98dddb52010-11-04 00:30:15 +00005669 bindir)
5670 bindir="$arg"
5671 prev=
5672 continue
5673 ;;
cristy3ed852e2009-09-05 21:47:34 +00005674 dlfiles|dlprefiles)
5675 if test "$preload" = no; then
5676 # Add the symbol object into the linking commands.
cristyda16f162011-02-19 23:52:17 +00005677 compile_command+=" @SYMFILE@"
5678 finalize_command+=" @SYMFILE@"
cristy3ed852e2009-09-05 21:47:34 +00005679 preload=yes
5680 fi
5681 case $arg in
5682 *.la | *.lo) ;; # We handle these cases below.
5683 force)
5684 if test "$dlself" = no; then
5685 dlself=needless
5686 export_dynamic=yes
5687 fi
5688 prev=
5689 continue
5690 ;;
5691 self)
5692 if test "$prev" = dlprefiles; then
5693 dlself=yes
5694 elif test "$prev" = dlfiles && test "$dlopen_self" != yes; then
5695 dlself=yes
5696 else
5697 dlself=needless
5698 export_dynamic=yes
5699 fi
5700 prev=
5701 continue
5702 ;;
5703 *)
5704 if test "$prev" = dlfiles; then
cristyda16f162011-02-19 23:52:17 +00005705 dlfiles+=" $arg"
cristy3ed852e2009-09-05 21:47:34 +00005706 else
cristyda16f162011-02-19 23:52:17 +00005707 dlprefiles+=" $arg"
cristy3ed852e2009-09-05 21:47:34 +00005708 fi
5709 prev=
5710 continue
5711 ;;
5712 esac
5713 ;;
5714 expsyms)
5715 export_symbols="$arg"
5716 test -f "$arg" \
5717 || func_fatal_error "symbol file \`$arg' does not exist"
5718 prev=
5719 continue
5720 ;;
5721 expsyms_regex)
5722 export_symbols_regex="$arg"
5723 prev=
5724 continue
5725 ;;
5726 framework)
5727 case $host in
5728 *-*-darwin*)
5729 case "$deplibs " in
5730 *" $qarg.ltframework "*) ;;
cristyda16f162011-02-19 23:52:17 +00005731 *) deplibs+=" $qarg.ltframework" # this is fixed later
cristy3ed852e2009-09-05 21:47:34 +00005732 ;;
5733 esac
5734 ;;
5735 esac
5736 prev=
5737 continue
5738 ;;
5739 inst_prefix)
5740 inst_prefix_dir="$arg"
5741 prev=
5742 continue
5743 ;;
5744 objectlist)
5745 if test -f "$arg"; then
5746 save_arg=$arg
5747 moreargs=
5748 for fil in `cat "$save_arg"`
5749 do
cristyda16f162011-02-19 23:52:17 +00005750# moreargs+=" $fil"
cristy3ed852e2009-09-05 21:47:34 +00005751 arg=$fil
5752 # A libtool-controlled object.
5753
5754 # Check to see that this really is a libtool object.
5755 if func_lalib_unsafe_p "$arg"; then
5756 pic_object=
5757 non_pic_object=
5758
5759 # Read the .lo file
5760 func_source "$arg"
5761
5762 if test -z "$pic_object" ||
5763 test -z "$non_pic_object" ||
5764 test "$pic_object" = none &&
5765 test "$non_pic_object" = none; then
5766 func_fatal_error "cannot find name of object for \`$arg'"
5767 fi
5768
5769 # Extract subdirectory from the argument.
5770 func_dirname "$arg" "/" ""
5771 xdir="$func_dirname_result"
5772
5773 if test "$pic_object" != none; then
5774 # Prepend the subdirectory the object is found in.
5775 pic_object="$xdir$pic_object"
5776
5777 if test "$prev" = dlfiles; then
5778 if test "$build_libtool_libs" = yes && test "$dlopen_support" = yes; then
cristyda16f162011-02-19 23:52:17 +00005779 dlfiles+=" $pic_object"
cristy3ed852e2009-09-05 21:47:34 +00005780 prev=
5781 continue
5782 else
5783 # If libtool objects are unsupported, then we need to preload.
5784 prev=dlprefiles
5785 fi
5786 fi
5787
5788 # CHECK ME: I think I busted this. -Ossama
5789 if test "$prev" = dlprefiles; then
5790 # Preload the old-style object.
cristyda16f162011-02-19 23:52:17 +00005791 dlprefiles+=" $pic_object"
cristy3ed852e2009-09-05 21:47:34 +00005792 prev=
5793 fi
5794
5795 # A PIC object.
cristyda16f162011-02-19 23:52:17 +00005796 libobjs+=" $pic_object"
cristy3ed852e2009-09-05 21:47:34 +00005797 arg="$pic_object"
5798 fi
5799
5800 # Non-PIC object.
5801 if test "$non_pic_object" != none; then
5802 # Prepend the subdirectory the object is found in.
5803 non_pic_object="$xdir$non_pic_object"
5804
5805 # A standard non-PIC object
cristyda16f162011-02-19 23:52:17 +00005806 non_pic_objects+=" $non_pic_object"
cristy3ed852e2009-09-05 21:47:34 +00005807 if test -z "$pic_object" || test "$pic_object" = none ; then
5808 arg="$non_pic_object"
5809 fi
5810 else
5811 # If the PIC object exists, use it instead.
5812 # $xdir was prepended to $pic_object above.
5813 non_pic_object="$pic_object"
cristyda16f162011-02-19 23:52:17 +00005814 non_pic_objects+=" $non_pic_object"
cristy3ed852e2009-09-05 21:47:34 +00005815 fi
5816 else
5817 # Only an error if not doing a dry-run.
5818 if $opt_dry_run; then
5819 # Extract subdirectory from the argument.
5820 func_dirname "$arg" "/" ""
5821 xdir="$func_dirname_result"
5822
5823 func_lo2o "$arg"
5824 pic_object=$xdir$objdir/$func_lo2o_result
5825 non_pic_object=$xdir$func_lo2o_result
cristyda16f162011-02-19 23:52:17 +00005826 libobjs+=" $pic_object"
5827 non_pic_objects+=" $non_pic_object"
cristy3ed852e2009-09-05 21:47:34 +00005828 else
5829 func_fatal_error "\`$arg' is not a valid libtool object"
5830 fi
5831 fi
5832 done
5833 else
5834 func_fatal_error "link input file \`$arg' does not exist"
5835 fi
5836 arg=$save_arg
5837 prev=
5838 continue
5839 ;;
5840 precious_regex)
5841 precious_files_regex="$arg"
5842 prev=
5843 continue
5844 ;;
5845 release)
5846 release="-$arg"
5847 prev=
5848 continue
5849 ;;
5850 rpath | xrpath)
5851 # We need an absolute path.
5852 case $arg in
5853 [\\/]* | [A-Za-z]:[\\/]*) ;;
5854 *)
5855 func_fatal_error "only absolute run-paths are allowed"
5856 ;;
5857 esac
5858 if test "$prev" = rpath; then
5859 case "$rpath " in
5860 *" $arg "*) ;;
cristyda16f162011-02-19 23:52:17 +00005861 *) rpath+=" $arg" ;;
cristy3ed852e2009-09-05 21:47:34 +00005862 esac
5863 else
5864 case "$xrpath " in
5865 *" $arg "*) ;;
cristyda16f162011-02-19 23:52:17 +00005866 *) xrpath+=" $arg" ;;
cristy3ed852e2009-09-05 21:47:34 +00005867 esac
5868 fi
5869 prev=
5870 continue
5871 ;;
5872 shrext)
5873 shrext_cmds="$arg"
5874 prev=
5875 continue
5876 ;;
5877 weak)
cristyda16f162011-02-19 23:52:17 +00005878 weak_libs+=" $arg"
cristy3ed852e2009-09-05 21:47:34 +00005879 prev=
5880 continue
5881 ;;
5882 xcclinker)
cristyda16f162011-02-19 23:52:17 +00005883 linker_flags+=" $qarg"
5884 compiler_flags+=" $qarg"
cristy3ed852e2009-09-05 21:47:34 +00005885 prev=
cristyda16f162011-02-19 23:52:17 +00005886 compile_command+=" $qarg"
5887 finalize_command+=" $qarg"
cristy3ed852e2009-09-05 21:47:34 +00005888 continue
5889 ;;
5890 xcompiler)
cristyda16f162011-02-19 23:52:17 +00005891 compiler_flags+=" $qarg"
cristy3ed852e2009-09-05 21:47:34 +00005892 prev=
cristyda16f162011-02-19 23:52:17 +00005893 compile_command+=" $qarg"
5894 finalize_command+=" $qarg"
cristy3ed852e2009-09-05 21:47:34 +00005895 continue
5896 ;;
5897 xlinker)
cristyda16f162011-02-19 23:52:17 +00005898 linker_flags+=" $qarg"
5899 compiler_flags+=" $wl$qarg"
cristy3ed852e2009-09-05 21:47:34 +00005900 prev=
cristyda16f162011-02-19 23:52:17 +00005901 compile_command+=" $wl$qarg"
5902 finalize_command+=" $wl$qarg"
cristy3ed852e2009-09-05 21:47:34 +00005903 continue
5904 ;;
5905 *)
5906 eval "$prev=\"\$arg\""
5907 prev=
5908 continue
5909 ;;
5910 esac
5911 fi # test -n "$prev"
5912
5913 prevarg="$arg"
5914
5915 case $arg in
5916 -all-static)
5917 if test -n "$link_static_flag"; then
5918 # See comment for -static flag below, for more details.
cristyda16f162011-02-19 23:52:17 +00005919 compile_command+=" $link_static_flag"
5920 finalize_command+=" $link_static_flag"
cristy3ed852e2009-09-05 21:47:34 +00005921 fi
5922 continue
5923 ;;
5924
5925 -allow-undefined)
5926 # FIXME: remove this flag sometime in the future.
5927 func_fatal_error "\`-allow-undefined' must not be used because it is the default"
5928 ;;
5929
5930 -avoid-version)
5931 avoid_version=yes
5932 continue
5933 ;;
5934
cristy98dddb52010-11-04 00:30:15 +00005935 -bindir)
5936 prev=bindir
5937 continue
5938 ;;
5939
cristy3ed852e2009-09-05 21:47:34 +00005940 -dlopen)
5941 prev=dlfiles
5942 continue
5943 ;;
5944
5945 -dlpreopen)
5946 prev=dlprefiles
5947 continue
5948 ;;
5949
5950 -export-dynamic)
5951 export_dynamic=yes
5952 continue
5953 ;;
5954
5955 -export-symbols | -export-symbols-regex)
5956 if test -n "$export_symbols" || test -n "$export_symbols_regex"; then
5957 func_fatal_error "more than one -exported-symbols argument is not allowed"
5958 fi
5959 if test "X$arg" = "X-export-symbols"; then
5960 prev=expsyms
5961 else
5962 prev=expsyms_regex
5963 fi
5964 continue
5965 ;;
5966
5967 -framework)
5968 prev=framework
5969 continue
5970 ;;
5971
5972 -inst-prefix-dir)
5973 prev=inst_prefix
5974 continue
5975 ;;
5976
5977 # The native IRIX linker understands -LANG:*, -LIST:* and -LNO:*
5978 # so, if we see these flags be careful not to treat them like -L
5979 -L[A-Z][A-Z]*:*)
5980 case $with_gcc/$host in
5981 no/*-*-irix* | /*-*-irix*)
cristyda16f162011-02-19 23:52:17 +00005982 compile_command+=" $arg"
5983 finalize_command+=" $arg"
cristy3ed852e2009-09-05 21:47:34 +00005984 ;;
5985 esac
5986 continue
5987 ;;
5988
5989 -L*)
cristyda16f162011-02-19 23:52:17 +00005990 func_stripname "-L" '' "$arg"
5991 if test -z "$func_stripname_result"; then
cristy3ed852e2009-09-05 21:47:34 +00005992 if test "$#" -gt 0; then
5993 func_fatal_error "require no space between \`-L' and \`$1'"
5994 else
5995 func_fatal_error "need path for \`-L' option"
5996 fi
5997 fi
cristyda16f162011-02-19 23:52:17 +00005998 func_resolve_sysroot "$func_stripname_result"
5999 dir=$func_resolve_sysroot_result
cristy3ed852e2009-09-05 21:47:34 +00006000 # We need an absolute path.
6001 case $dir in
6002 [\\/]* | [A-Za-z]:[\\/]*) ;;
6003 *)
6004 absdir=`cd "$dir" && pwd`
6005 test -z "$absdir" && \
6006 func_fatal_error "cannot determine absolute directory name of \`$dir'"
6007 dir="$absdir"
6008 ;;
6009 esac
6010 case "$deplibs " in
cristyda16f162011-02-19 23:52:17 +00006011 *" -L$dir "* | *" $arg "*)
6012 # Will only happen for absolute or sysroot arguments
6013 ;;
cristy3ed852e2009-09-05 21:47:34 +00006014 *)
cristyda16f162011-02-19 23:52:17 +00006015 # Preserve sysroot, but never include relative directories
6016 case $dir in
6017 [\\/]* | [A-Za-z]:[\\/]* | =*) deplibs+=" $arg" ;;
6018 *) deplibs+=" -L$dir" ;;
6019 esac
6020 lib_search_path+=" $dir"
cristy3ed852e2009-09-05 21:47:34 +00006021 ;;
6022 esac
6023 case $host in
6024 *-*-cygwin* | *-*-mingw* | *-*-pw32* | *-*-os2* | *-cegcc*)
cristy98dddb52010-11-04 00:30:15 +00006025 testbindir=`$ECHO "$dir" | $SED 's*/lib$*/bin*'`
cristy3ed852e2009-09-05 21:47:34 +00006026 case :$dllsearchpath: in
6027 *":$dir:"*) ;;
6028 ::) dllsearchpath=$dir;;
cristyda16f162011-02-19 23:52:17 +00006029 *) dllsearchpath+=":$dir";;
cristy3ed852e2009-09-05 21:47:34 +00006030 esac
6031 case :$dllsearchpath: in
6032 *":$testbindir:"*) ;;
6033 ::) dllsearchpath=$testbindir;;
cristyda16f162011-02-19 23:52:17 +00006034 *) dllsearchpath+=":$testbindir";;
cristy3ed852e2009-09-05 21:47:34 +00006035 esac
6036 ;;
6037 esac
6038 continue
6039 ;;
6040
6041 -l*)
6042 if test "X$arg" = "X-lc" || test "X$arg" = "X-lm"; then
6043 case $host in
cristy98dddb52010-11-04 00:30:15 +00006044 *-*-cygwin* | *-*-mingw* | *-*-pw32* | *-*-beos* | *-cegcc* | *-*-haiku*)
cristy3ed852e2009-09-05 21:47:34 +00006045 # These systems don't actually have a C or math library (as such)
6046 continue
6047 ;;
6048 *-*-os2*)
6049 # These systems don't actually have a C library (as such)
6050 test "X$arg" = "X-lc" && continue
6051 ;;
6052 *-*-openbsd* | *-*-freebsd* | *-*-dragonfly*)
6053 # Do not include libc due to us having libc/libc_r.
6054 test "X$arg" = "X-lc" && continue
6055 ;;
6056 *-*-rhapsody* | *-*-darwin1.[012])
6057 # Rhapsody C and math libraries are in the System framework
cristyda16f162011-02-19 23:52:17 +00006058 deplibs+=" System.ltframework"
cristy3ed852e2009-09-05 21:47:34 +00006059 continue
6060 ;;
6061 *-*-sco3.2v5* | *-*-sco5v6*)
6062 # Causes problems with __ctype
6063 test "X$arg" = "X-lc" && continue
6064 ;;
6065 *-*-sysv4.2uw2* | *-*-sysv5* | *-*-unixware* | *-*-OpenUNIX*)
6066 # Compiler inserts libc in the correct place for threads to work
6067 test "X$arg" = "X-lc" && continue
6068 ;;
6069 esac
6070 elif test "X$arg" = "X-lc_r"; then
6071 case $host in
6072 *-*-openbsd* | *-*-freebsd* | *-*-dragonfly*)
6073 # Do not include libc_r directly, use -pthread flag.
6074 continue
6075 ;;
6076 esac
6077 fi
cristyda16f162011-02-19 23:52:17 +00006078 deplibs+=" $arg"
cristy3ed852e2009-09-05 21:47:34 +00006079 continue
6080 ;;
6081
6082 -module)
6083 module=yes
6084 continue
6085 ;;
6086
6087 # Tru64 UNIX uses -model [arg] to determine the layout of C++
6088 # classes, name mangling, and exception handling.
6089 # Darwin uses the -arch flag to determine output architecture.
cristyda16f162011-02-19 23:52:17 +00006090 -model|-arch|-isysroot|--sysroot)
6091 compiler_flags+=" $arg"
6092 compile_command+=" $arg"
6093 finalize_command+=" $arg"
cristy3ed852e2009-09-05 21:47:34 +00006094 prev=xcompiler
6095 continue
6096 ;;
6097
cristy2542fc62011-12-06 17:50:25 +00006098 -mt|-mthreads|-kthread|-Kthread|-pthread|-pthreads|--thread-safe \
6099 |-threads|-fopenmp|-openmp|-mp|-xopenmp|-omp|-qsmp=*)
cristyda16f162011-02-19 23:52:17 +00006100 compiler_flags+=" $arg"
6101 compile_command+=" $arg"
6102 finalize_command+=" $arg"
cristy3ed852e2009-09-05 21:47:34 +00006103 case "$new_inherited_linker_flags " in
6104 *" $arg "*) ;;
cristyda16f162011-02-19 23:52:17 +00006105 * ) new_inherited_linker_flags+=" $arg" ;;
cristy3ed852e2009-09-05 21:47:34 +00006106 esac
6107 continue
6108 ;;
6109
6110 -multi_module)
6111 single_module="${wl}-multi_module"
6112 continue
6113 ;;
6114
6115 -no-fast-install)
6116 fast_install=no
6117 continue
6118 ;;
6119
6120 -no-install)
6121 case $host in
6122 *-*-cygwin* | *-*-mingw* | *-*-pw32* | *-*-os2* | *-*-darwin* | *-cegcc*)
6123 # The PATH hackery in wrapper scripts is required on Windows
6124 # and Darwin in order for the loader to find any dlls it needs.
6125 func_warning "\`-no-install' is ignored for $host"
6126 func_warning "assuming \`-no-fast-install' instead"
6127 fast_install=no
6128 ;;
6129 *) no_install=yes ;;
6130 esac
6131 continue
6132 ;;
6133
6134 -no-undefined)
6135 allow_undefined=no
6136 continue
6137 ;;
6138
6139 -objectlist)
6140 prev=objectlist
6141 continue
6142 ;;
6143
6144 -o) prev=output ;;
6145
6146 -precious-files-regex)
6147 prev=precious_regex
6148 continue
6149 ;;
6150
6151 -release)
6152 prev=release
6153 continue
6154 ;;
6155
6156 -rpath)
6157 prev=rpath
6158 continue
6159 ;;
6160
6161 -R)
6162 prev=xrpath
6163 continue
6164 ;;
6165
6166 -R*)
6167 func_stripname '-R' '' "$arg"
6168 dir=$func_stripname_result
6169 # We need an absolute path.
6170 case $dir in
6171 [\\/]* | [A-Za-z]:[\\/]*) ;;
cristyda16f162011-02-19 23:52:17 +00006172 =*)
6173 func_stripname '=' '' "$dir"
6174 dir=$lt_sysroot$func_stripname_result
6175 ;;
cristy3ed852e2009-09-05 21:47:34 +00006176 *)
6177 func_fatal_error "only absolute run-paths are allowed"
6178 ;;
6179 esac
6180 case "$xrpath " in
6181 *" $dir "*) ;;
cristyda16f162011-02-19 23:52:17 +00006182 *) xrpath+=" $dir" ;;
cristy3ed852e2009-09-05 21:47:34 +00006183 esac
6184 continue
6185 ;;
6186
6187 -shared)
6188 # The effects of -shared are defined in a previous loop.
6189 continue
6190 ;;
6191
6192 -shrext)
6193 prev=shrext
6194 continue
6195 ;;
6196
6197 -static | -static-libtool-libs)
6198 # The effects of -static are defined in a previous loop.
6199 # We used to do the same as -all-static on platforms that
6200 # didn't have a PIC flag, but the assumption that the effects
6201 # would be equivalent was wrong. It would break on at least
6202 # Digital Unix and AIX.
6203 continue
6204 ;;
6205
6206 -thread-safe)
6207 thread_safe=yes
6208 continue
6209 ;;
6210
6211 -version-info)
6212 prev=vinfo
6213 continue
6214 ;;
6215
6216 -version-number)
6217 prev=vinfo
6218 vinfo_number=yes
6219 continue
6220 ;;
6221
6222 -weak)
6223 prev=weak
6224 continue
6225 ;;
6226
6227 -Wc,*)
6228 func_stripname '-Wc,' '' "$arg"
6229 args=$func_stripname_result
6230 arg=
6231 save_ifs="$IFS"; IFS=','
6232 for flag in $args; do
6233 IFS="$save_ifs"
6234 func_quote_for_eval "$flag"
cristyda16f162011-02-19 23:52:17 +00006235 arg+=" $func_quote_for_eval_result"
6236 compiler_flags+=" $func_quote_for_eval_result"
cristy3ed852e2009-09-05 21:47:34 +00006237 done
6238 IFS="$save_ifs"
6239 func_stripname ' ' '' "$arg"
6240 arg=$func_stripname_result
6241 ;;
6242
6243 -Wl,*)
6244 func_stripname '-Wl,' '' "$arg"
6245 args=$func_stripname_result
6246 arg=
6247 save_ifs="$IFS"; IFS=','
6248 for flag in $args; do
6249 IFS="$save_ifs"
6250 func_quote_for_eval "$flag"
cristyda16f162011-02-19 23:52:17 +00006251 arg+=" $wl$func_quote_for_eval_result"
6252 compiler_flags+=" $wl$func_quote_for_eval_result"
6253 linker_flags+=" $func_quote_for_eval_result"
cristy3ed852e2009-09-05 21:47:34 +00006254 done
6255 IFS="$save_ifs"
6256 func_stripname ' ' '' "$arg"
6257 arg=$func_stripname_result
6258 ;;
6259
6260 -Xcompiler)
6261 prev=xcompiler
6262 continue
6263 ;;
6264
6265 -Xlinker)
6266 prev=xlinker
6267 continue
6268 ;;
6269
6270 -XCClinker)
6271 prev=xcclinker
6272 continue
6273 ;;
6274
6275 # -msg_* for osf cc
6276 -msg_*)
6277 func_quote_for_eval "$arg"
6278 arg="$func_quote_for_eval_result"
6279 ;;
6280
cristy98dddb52010-11-04 00:30:15 +00006281 # Flags to be passed through unchanged, with rationale:
6282 # -64, -mips[0-9] enable 64-bit mode for the SGI compiler
6283 # -r[0-9][0-9]* specify processor for the SGI compiler
6284 # -xarch=*, -xtarget=* enable 64-bit mode for the Sun compiler
6285 # +DA*, +DD* enable 64-bit mode for the HP compiler
6286 # -q* compiler args for the IBM compiler
6287 # -m*, -t[45]*, -txscale* architecture-specific flags for GCC
6288 # -F/path path to uninstalled frameworks, gcc on darwin
6289 # -p, -pg, --coverage, -fprofile-* profiling flags for GCC
6290 # @file GCC response files
6291 # -tp=* Portland pgcc target processor selection
cristyda16f162011-02-19 23:52:17 +00006292 # --sysroot=* for sysroot support
6293 # -O*, -flto*, -fwhopr*, -fuse-linker-plugin GCC link-time optimization
cristy3ed852e2009-09-05 21:47:34 +00006294 -64|-mips[0-9]|-r[0-9][0-9]*|-xarch=*|-xtarget=*|+DA*|+DD*|-q*|-m*| \
cristyda16f162011-02-19 23:52:17 +00006295 -t[45]*|-txscale*|-p|-pg|--coverage|-fprofile-*|-F*|@*|-tp=*|--sysroot=*| \
6296 -O*|-flto*|-fwhopr*|-fuse-linker-plugin)
cristy3ed852e2009-09-05 21:47:34 +00006297 func_quote_for_eval "$arg"
6298 arg="$func_quote_for_eval_result"
cristyda16f162011-02-19 23:52:17 +00006299 compile_command+=" $arg"
6300 finalize_command+=" $arg"
6301 compiler_flags+=" $arg"
cristy3ed852e2009-09-05 21:47:34 +00006302 continue
6303 ;;
6304
6305 # Some other compiler flag.
6306 -* | +*)
6307 func_quote_for_eval "$arg"
6308 arg="$func_quote_for_eval_result"
6309 ;;
6310
6311 *.$objext)
6312 # A standard object.
cristyda16f162011-02-19 23:52:17 +00006313 objs+=" $arg"
cristy3ed852e2009-09-05 21:47:34 +00006314 ;;
6315
6316 *.lo)
6317 # A libtool-controlled object.
6318
6319 # Check to see that this really is a libtool object.
6320 if func_lalib_unsafe_p "$arg"; then
6321 pic_object=
6322 non_pic_object=
6323
6324 # Read the .lo file
6325 func_source "$arg"
6326
6327 if test -z "$pic_object" ||
6328 test -z "$non_pic_object" ||
6329 test "$pic_object" = none &&
6330 test "$non_pic_object" = none; then
6331 func_fatal_error "cannot find name of object for \`$arg'"
6332 fi
6333
6334 # Extract subdirectory from the argument.
6335 func_dirname "$arg" "/" ""
6336 xdir="$func_dirname_result"
6337
6338 if test "$pic_object" != none; then
6339 # Prepend the subdirectory the object is found in.
6340 pic_object="$xdir$pic_object"
6341
6342 if test "$prev" = dlfiles; then
6343 if test "$build_libtool_libs" = yes && test "$dlopen_support" = yes; then
cristyda16f162011-02-19 23:52:17 +00006344 dlfiles+=" $pic_object"
cristy3ed852e2009-09-05 21:47:34 +00006345 prev=
6346 continue
6347 else
6348 # If libtool objects are unsupported, then we need to preload.
6349 prev=dlprefiles
6350 fi
6351 fi
6352
6353 # CHECK ME: I think I busted this. -Ossama
6354 if test "$prev" = dlprefiles; then
6355 # Preload the old-style object.
cristyda16f162011-02-19 23:52:17 +00006356 dlprefiles+=" $pic_object"
cristy3ed852e2009-09-05 21:47:34 +00006357 prev=
6358 fi
6359
6360 # A PIC object.
cristyda16f162011-02-19 23:52:17 +00006361 libobjs+=" $pic_object"
cristy3ed852e2009-09-05 21:47:34 +00006362 arg="$pic_object"
6363 fi
6364
6365 # Non-PIC object.
6366 if test "$non_pic_object" != none; then
6367 # Prepend the subdirectory the object is found in.
6368 non_pic_object="$xdir$non_pic_object"
6369
6370 # A standard non-PIC object
cristyda16f162011-02-19 23:52:17 +00006371 non_pic_objects+=" $non_pic_object"
cristy3ed852e2009-09-05 21:47:34 +00006372 if test -z "$pic_object" || test "$pic_object" = none ; then
6373 arg="$non_pic_object"
6374 fi
6375 else
6376 # If the PIC object exists, use it instead.
6377 # $xdir was prepended to $pic_object above.
6378 non_pic_object="$pic_object"
cristyda16f162011-02-19 23:52:17 +00006379 non_pic_objects+=" $non_pic_object"
cristy3ed852e2009-09-05 21:47:34 +00006380 fi
6381 else
6382 # Only an error if not doing a dry-run.
6383 if $opt_dry_run; then
6384 # Extract subdirectory from the argument.
6385 func_dirname "$arg" "/" ""
6386 xdir="$func_dirname_result"
6387
6388 func_lo2o "$arg"
6389 pic_object=$xdir$objdir/$func_lo2o_result
6390 non_pic_object=$xdir$func_lo2o_result
cristyda16f162011-02-19 23:52:17 +00006391 libobjs+=" $pic_object"
6392 non_pic_objects+=" $non_pic_object"
cristy3ed852e2009-09-05 21:47:34 +00006393 else
6394 func_fatal_error "\`$arg' is not a valid libtool object"
6395 fi
6396 fi
6397 ;;
6398
6399 *.$libext)
6400 # An archive.
cristyda16f162011-02-19 23:52:17 +00006401 deplibs+=" $arg"
6402 old_deplibs+=" $arg"
cristy3ed852e2009-09-05 21:47:34 +00006403 continue
6404 ;;
6405
6406 *.la)
6407 # A libtool-controlled library.
6408
cristyda16f162011-02-19 23:52:17 +00006409 func_resolve_sysroot "$arg"
cristy3ed852e2009-09-05 21:47:34 +00006410 if test "$prev" = dlfiles; then
6411 # This library was specified with -dlopen.
cristyda16f162011-02-19 23:52:17 +00006412 dlfiles+=" $func_resolve_sysroot_result"
cristy3ed852e2009-09-05 21:47:34 +00006413 prev=
6414 elif test "$prev" = dlprefiles; then
6415 # The library was specified with -dlpreopen.
cristyda16f162011-02-19 23:52:17 +00006416 dlprefiles+=" $func_resolve_sysroot_result"
cristy3ed852e2009-09-05 21:47:34 +00006417 prev=
6418 else
cristyda16f162011-02-19 23:52:17 +00006419 deplibs+=" $func_resolve_sysroot_result"
cristy3ed852e2009-09-05 21:47:34 +00006420 fi
6421 continue
6422 ;;
6423
6424 # Some other compiler argument.
6425 *)
6426 # Unknown arguments in both finalize_command and compile_command need
6427 # to be aesthetically quoted because they are evaled later.
6428 func_quote_for_eval "$arg"
6429 arg="$func_quote_for_eval_result"
6430 ;;
6431 esac # arg
6432
6433 # Now actually substitute the argument into the commands.
6434 if test -n "$arg"; then
cristyda16f162011-02-19 23:52:17 +00006435 compile_command+=" $arg"
6436 finalize_command+=" $arg"
cristy3ed852e2009-09-05 21:47:34 +00006437 fi
6438 done # argument parsing loop
6439
6440 test -n "$prev" && \
6441 func_fatal_help "the \`$prevarg' option requires an argument"
6442
6443 if test "$export_dynamic" = yes && test -n "$export_dynamic_flag_spec"; then
6444 eval arg=\"$export_dynamic_flag_spec\"
cristyda16f162011-02-19 23:52:17 +00006445 compile_command+=" $arg"
6446 finalize_command+=" $arg"
cristy3ed852e2009-09-05 21:47:34 +00006447 fi
6448
6449 oldlibs=
6450 # calculate the name of the file, without its directory
6451 func_basename "$output"
6452 outputname="$func_basename_result"
6453 libobjs_save="$libobjs"
6454
6455 if test -n "$shlibpath_var"; then
6456 # get the directories listed in $shlibpath_var
cristy98dddb52010-11-04 00:30:15 +00006457 eval shlib_search_path=\`\$ECHO \"\${$shlibpath_var}\" \| \$SED \'s/:/ /g\'\`
cristy3ed852e2009-09-05 21:47:34 +00006458 else
6459 shlib_search_path=
6460 fi
6461 eval sys_lib_search_path=\"$sys_lib_search_path_spec\"
6462 eval sys_lib_dlsearch_path=\"$sys_lib_dlsearch_path_spec\"
6463
6464 func_dirname "$output" "/" ""
6465 output_objdir="$func_dirname_result$objdir"
cristyda16f162011-02-19 23:52:17 +00006466 func_to_tool_file "$output_objdir/"
6467 tool_output_objdir=$func_to_tool_file_result
cristy3ed852e2009-09-05 21:47:34 +00006468 # Create the object directory.
6469 func_mkdir_p "$output_objdir"
6470
6471 # Determine the type of output
6472 case $output in
6473 "")
6474 func_fatal_help "you must specify an output file"
6475 ;;
6476 *.$libext) linkmode=oldlib ;;
6477 *.lo | *.$objext) linkmode=obj ;;
6478 *.la) linkmode=lib ;;
6479 *) linkmode=prog ;; # Anything else should be a program.
6480 esac
6481
6482 specialdeplibs=
6483
6484 libs=
6485 # Find all interdependent deplibs by searching for libraries
6486 # that are linked more than once (e.g. -la -lb -la)
6487 for deplib in $deplibs; do
cristyda16f162011-02-19 23:52:17 +00006488 if $opt_preserve_dup_deps ; then
cristy3ed852e2009-09-05 21:47:34 +00006489 case "$libs " in
cristyda16f162011-02-19 23:52:17 +00006490 *" $deplib "*) specialdeplibs+=" $deplib" ;;
cristy3ed852e2009-09-05 21:47:34 +00006491 esac
6492 fi
cristyda16f162011-02-19 23:52:17 +00006493 libs+=" $deplib"
cristy3ed852e2009-09-05 21:47:34 +00006494 done
6495
6496 if test "$linkmode" = lib; then
6497 libs="$predeps $libs $compiler_lib_search_path $postdeps"
6498
6499 # Compute libraries that are listed more than once in $predeps
6500 # $postdeps and mark them as special (i.e., whose duplicates are
6501 # not to be eliminated).
6502 pre_post_deps=
6503 if $opt_duplicate_compiler_generated_deps; then
6504 for pre_post_dep in $predeps $postdeps; do
6505 case "$pre_post_deps " in
cristyda16f162011-02-19 23:52:17 +00006506 *" $pre_post_dep "*) specialdeplibs+=" $pre_post_deps" ;;
cristy3ed852e2009-09-05 21:47:34 +00006507 esac
cristyda16f162011-02-19 23:52:17 +00006508 pre_post_deps+=" $pre_post_dep"
cristy3ed852e2009-09-05 21:47:34 +00006509 done
6510 fi
6511 pre_post_deps=
6512 fi
6513
6514 deplibs=
6515 newdependency_libs=
6516 newlib_search_path=
6517 need_relink=no # whether we're linking any uninstalled libtool libraries
6518 notinst_deplibs= # not-installed libtool libraries
6519 notinst_path= # paths that contain not-installed libtool libraries
6520
6521 case $linkmode in
6522 lib)
6523 passes="conv dlpreopen link"
6524 for file in $dlfiles $dlprefiles; do
6525 case $file in
6526 *.la) ;;
6527 *)
6528 func_fatal_help "libraries can \`-dlopen' only libtool libraries: $file"
6529 ;;
6530 esac
6531 done
6532 ;;
6533 prog)
6534 compile_deplibs=
6535 finalize_deplibs=
6536 alldeplibs=no
6537 newdlfiles=
6538 newdlprefiles=
6539 passes="conv scan dlopen dlpreopen link"
6540 ;;
6541 *) passes="conv"
6542 ;;
6543 esac
6544
6545 for pass in $passes; do
6546 # The preopen pass in lib mode reverses $deplibs; put it back here
6547 # so that -L comes before libs that need it for instance...
6548 if test "$linkmode,$pass" = "lib,link"; then
6549 ## FIXME: Find the place where the list is rebuilt in the wrong
6550 ## order, and fix it there properly
6551 tmp_deplibs=
6552 for deplib in $deplibs; do
6553 tmp_deplibs="$deplib $tmp_deplibs"
6554 done
6555 deplibs="$tmp_deplibs"
6556 fi
6557
6558 if test "$linkmode,$pass" = "lib,link" ||
6559 test "$linkmode,$pass" = "prog,scan"; then
6560 libs="$deplibs"
6561 deplibs=
6562 fi
6563 if test "$linkmode" = prog; then
6564 case $pass in
6565 dlopen) libs="$dlfiles" ;;
6566 dlpreopen) libs="$dlprefiles" ;;
6567 link) libs="$deplibs %DEPLIBS% $dependency_libs" ;;
6568 esac
6569 fi
6570 if test "$linkmode,$pass" = "lib,dlpreopen"; then
6571 # Collect and forward deplibs of preopened libtool libs
6572 for lib in $dlprefiles; do
6573 # Ignore non-libtool-libs
6574 dependency_libs=
cristyda16f162011-02-19 23:52:17 +00006575 func_resolve_sysroot "$lib"
cristy3ed852e2009-09-05 21:47:34 +00006576 case $lib in
cristyda16f162011-02-19 23:52:17 +00006577 *.la) func_source "$func_resolve_sysroot_result" ;;
cristy3ed852e2009-09-05 21:47:34 +00006578 esac
6579
6580 # Collect preopened libtool deplibs, except any this library
6581 # has declared as weak libs
6582 for deplib in $dependency_libs; do
cristy98dddb52010-11-04 00:30:15 +00006583 func_basename "$deplib"
6584 deplib_base=$func_basename_result
cristy3ed852e2009-09-05 21:47:34 +00006585 case " $weak_libs " in
6586 *" $deplib_base "*) ;;
cristyda16f162011-02-19 23:52:17 +00006587 *) deplibs+=" $deplib" ;;
cristy3ed852e2009-09-05 21:47:34 +00006588 esac
6589 done
6590 done
6591 libs="$dlprefiles"
6592 fi
6593 if test "$pass" = dlopen; then
6594 # Collect dlpreopened libraries
6595 save_deplibs="$deplibs"
6596 deplibs=
6597 fi
6598
6599 for deplib in $libs; do
6600 lib=
6601 found=no
6602 case $deplib in
cristy2542fc62011-12-06 17:50:25 +00006603 -mt|-mthreads|-kthread|-Kthread|-pthread|-pthreads|--thread-safe \
6604 |-threads|-fopenmp|-openmp|-mp|-xopenmp|-omp|-qsmp=*)
cristy3ed852e2009-09-05 21:47:34 +00006605 if test "$linkmode,$pass" = "prog,link"; then
6606 compile_deplibs="$deplib $compile_deplibs"
6607 finalize_deplibs="$deplib $finalize_deplibs"
6608 else
cristyda16f162011-02-19 23:52:17 +00006609 compiler_flags+=" $deplib"
cristy3ed852e2009-09-05 21:47:34 +00006610 if test "$linkmode" = lib ; then
6611 case "$new_inherited_linker_flags " in
6612 *" $deplib "*) ;;
cristyda16f162011-02-19 23:52:17 +00006613 * ) new_inherited_linker_flags+=" $deplib" ;;
cristy3ed852e2009-09-05 21:47:34 +00006614 esac
6615 fi
6616 fi
6617 continue
6618 ;;
6619 -l*)
6620 if test "$linkmode" != lib && test "$linkmode" != prog; then
6621 func_warning "\`-l' is ignored for archives/objects"
6622 continue
6623 fi
6624 func_stripname '-l' '' "$deplib"
6625 name=$func_stripname_result
6626 if test "$linkmode" = lib; then
6627 searchdirs="$newlib_search_path $lib_search_path $compiler_lib_search_dirs $sys_lib_search_path $shlib_search_path"
6628 else
6629 searchdirs="$newlib_search_path $lib_search_path $sys_lib_search_path $shlib_search_path"
6630 fi
6631 for searchdir in $searchdirs; do
6632 for search_ext in .la $std_shrext .so .a; do
6633 # Search the libtool library
6634 lib="$searchdir/lib${name}${search_ext}"
6635 if test -f "$lib"; then
6636 if test "$search_ext" = ".la"; then
6637 found=yes
6638 else
6639 found=no
6640 fi
6641 break 2
6642 fi
6643 done
6644 done
6645 if test "$found" != yes; then
6646 # deplib doesn't seem to be a libtool library
6647 if test "$linkmode,$pass" = "prog,link"; then
6648 compile_deplibs="$deplib $compile_deplibs"
6649 finalize_deplibs="$deplib $finalize_deplibs"
6650 else
6651 deplibs="$deplib $deplibs"
6652 test "$linkmode" = lib && newdependency_libs="$deplib $newdependency_libs"
6653 fi
6654 continue
6655 else # deplib is a libtool library
6656 # If $allow_libtool_libs_with_static_runtimes && $deplib is a stdlib,
6657 # We need to do some special things here, and not later.
6658 if test "X$allow_libtool_libs_with_static_runtimes" = "Xyes" ; then
6659 case " $predeps $postdeps " in
6660 *" $deplib "*)
6661 if func_lalib_p "$lib"; then
6662 library_names=
6663 old_library=
6664 func_source "$lib"
6665 for l in $old_library $library_names; do
6666 ll="$l"
6667 done
6668 if test "X$ll" = "X$old_library" ; then # only static version available
6669 found=no
6670 func_dirname "$lib" "" "."
6671 ladir="$func_dirname_result"
6672 lib=$ladir/$old_library
6673 if test "$linkmode,$pass" = "prog,link"; then
6674 compile_deplibs="$deplib $compile_deplibs"
6675 finalize_deplibs="$deplib $finalize_deplibs"
6676 else
6677 deplibs="$deplib $deplibs"
6678 test "$linkmode" = lib && newdependency_libs="$deplib $newdependency_libs"
6679 fi
6680 continue
6681 fi
6682 fi
6683 ;;
6684 *) ;;
6685 esac
6686 fi
6687 fi
6688 ;; # -l
6689 *.ltframework)
6690 if test "$linkmode,$pass" = "prog,link"; then
6691 compile_deplibs="$deplib $compile_deplibs"
6692 finalize_deplibs="$deplib $finalize_deplibs"
6693 else
6694 deplibs="$deplib $deplibs"
6695 if test "$linkmode" = lib ; then
6696 case "$new_inherited_linker_flags " in
6697 *" $deplib "*) ;;
cristyda16f162011-02-19 23:52:17 +00006698 * ) new_inherited_linker_flags+=" $deplib" ;;
cristy3ed852e2009-09-05 21:47:34 +00006699 esac
6700 fi
6701 fi
6702 continue
6703 ;;
6704 -L*)
6705 case $linkmode in
6706 lib)
6707 deplibs="$deplib $deplibs"
6708 test "$pass" = conv && continue
6709 newdependency_libs="$deplib $newdependency_libs"
6710 func_stripname '-L' '' "$deplib"
cristyda16f162011-02-19 23:52:17 +00006711 func_resolve_sysroot "$func_stripname_result"
6712 newlib_search_path+=" $func_resolve_sysroot_result"
cristy3ed852e2009-09-05 21:47:34 +00006713 ;;
6714 prog)
6715 if test "$pass" = conv; then
6716 deplibs="$deplib $deplibs"
6717 continue
6718 fi
6719 if test "$pass" = scan; then
6720 deplibs="$deplib $deplibs"
6721 else
6722 compile_deplibs="$deplib $compile_deplibs"
6723 finalize_deplibs="$deplib $finalize_deplibs"
6724 fi
6725 func_stripname '-L' '' "$deplib"
cristyda16f162011-02-19 23:52:17 +00006726 func_resolve_sysroot "$func_stripname_result"
6727 newlib_search_path+=" $func_resolve_sysroot_result"
cristy3ed852e2009-09-05 21:47:34 +00006728 ;;
6729 *)
6730 func_warning "\`-L' is ignored for archives/objects"
6731 ;;
6732 esac # linkmode
6733 continue
6734 ;; # -L
6735 -R*)
6736 if test "$pass" = link; then
6737 func_stripname '-R' '' "$deplib"
cristyda16f162011-02-19 23:52:17 +00006738 func_resolve_sysroot "$func_stripname_result"
6739 dir=$func_resolve_sysroot_result
cristy3ed852e2009-09-05 21:47:34 +00006740 # Make sure the xrpath contains only unique directories.
6741 case "$xrpath " in
6742 *" $dir "*) ;;
cristyda16f162011-02-19 23:52:17 +00006743 *) xrpath+=" $dir" ;;
cristy3ed852e2009-09-05 21:47:34 +00006744 esac
6745 fi
6746 deplibs="$deplib $deplibs"
6747 continue
6748 ;;
cristyda16f162011-02-19 23:52:17 +00006749 *.la)
6750 func_resolve_sysroot "$deplib"
6751 lib=$func_resolve_sysroot_result
6752 ;;
cristy3ed852e2009-09-05 21:47:34 +00006753 *.$libext)
6754 if test "$pass" = conv; then
6755 deplibs="$deplib $deplibs"
6756 continue
6757 fi
6758 case $linkmode in
6759 lib)
6760 # Linking convenience modules into shared libraries is allowed,
6761 # but linking other static libraries is non-portable.
6762 case " $dlpreconveniencelibs " in
6763 *" $deplib "*) ;;
6764 *)
6765 valid_a_lib=no
6766 case $deplibs_check_method in
6767 match_pattern*)
6768 set dummy $deplibs_check_method; shift
6769 match_pattern_regex=`expr "$deplibs_check_method" : "$1 \(.*\)"`
cristy98dddb52010-11-04 00:30:15 +00006770 if eval "\$ECHO \"$deplib\"" 2>/dev/null | $SED 10q \
cristy3ed852e2009-09-05 21:47:34 +00006771 | $EGREP "$match_pattern_regex" > /dev/null; then
6772 valid_a_lib=yes
6773 fi
6774 ;;
6775 pass_all)
6776 valid_a_lib=yes
6777 ;;
6778 esac
6779 if test "$valid_a_lib" != yes; then
cristy98dddb52010-11-04 00:30:15 +00006780 echo
cristy3ed852e2009-09-05 21:47:34 +00006781 $ECHO "*** Warning: Trying to link with static lib archive $deplib."
cristy98dddb52010-11-04 00:30:15 +00006782 echo "*** I have the capability to make that library automatically link in when"
6783 echo "*** you link to this library. But I can only do this if you have a"
6784 echo "*** shared version of the library, which you do not appear to have"
6785 echo "*** because the file extensions .$libext of this argument makes me believe"
6786 echo "*** that it is just a static archive that I should not use here."
cristy3ed852e2009-09-05 21:47:34 +00006787 else
cristy98dddb52010-11-04 00:30:15 +00006788 echo
cristy3ed852e2009-09-05 21:47:34 +00006789 $ECHO "*** Warning: Linking the shared library $output against the"
6790 $ECHO "*** static library $deplib is not portable!"
6791 deplibs="$deplib $deplibs"
6792 fi
6793 ;;
6794 esac
6795 continue
6796 ;;
6797 prog)
6798 if test "$pass" != link; then
6799 deplibs="$deplib $deplibs"
6800 else
6801 compile_deplibs="$deplib $compile_deplibs"
6802 finalize_deplibs="$deplib $finalize_deplibs"
6803 fi
6804 continue
6805 ;;
6806 esac # linkmode
6807 ;; # *.$libext
6808 *.lo | *.$objext)
6809 if test "$pass" = conv; then
6810 deplibs="$deplib $deplibs"
6811 elif test "$linkmode" = prog; then
6812 if test "$pass" = dlpreopen || test "$dlopen_support" != yes || test "$build_libtool_libs" = no; then
6813 # If there is no dlopen support or we're linking statically,
6814 # we need to preload.
cristyda16f162011-02-19 23:52:17 +00006815 newdlprefiles+=" $deplib"
cristy3ed852e2009-09-05 21:47:34 +00006816 compile_deplibs="$deplib $compile_deplibs"
6817 finalize_deplibs="$deplib $finalize_deplibs"
6818 else
cristyda16f162011-02-19 23:52:17 +00006819 newdlfiles+=" $deplib"
cristy3ed852e2009-09-05 21:47:34 +00006820 fi
6821 fi
6822 continue
6823 ;;
6824 %DEPLIBS%)
6825 alldeplibs=yes
6826 continue
6827 ;;
6828 esac # case $deplib
6829
6830 if test "$found" = yes || test -f "$lib"; then :
6831 else
6832 func_fatal_error "cannot find the library \`$lib' or unhandled argument \`$deplib'"
6833 fi
6834
6835 # Check to see that this really is a libtool archive.
6836 func_lalib_unsafe_p "$lib" \
6837 || func_fatal_error "\`$lib' is not a valid libtool archive"
6838
6839 func_dirname "$lib" "" "."
6840 ladir="$func_dirname_result"
6841
6842 dlname=
6843 dlopen=
6844 dlpreopen=
6845 libdir=
6846 library_names=
6847 old_library=
6848 inherited_linker_flags=
6849 # If the library was installed with an old release of libtool,
6850 # it will not redefine variables installed, or shouldnotlink
6851 installed=yes
6852 shouldnotlink=no
6853 avoidtemprpath=
6854
6855
6856 # Read the .la file
6857 func_source "$lib"
6858
6859 # Convert "-framework foo" to "foo.ltframework"
6860 if test -n "$inherited_linker_flags"; then
cristy98dddb52010-11-04 00:30:15 +00006861 tmp_inherited_linker_flags=`$ECHO "$inherited_linker_flags" | $SED 's/-framework \([^ $]*\)/\1.ltframework/g'`
cristy3ed852e2009-09-05 21:47:34 +00006862 for tmp_inherited_linker_flag in $tmp_inherited_linker_flags; do
6863 case " $new_inherited_linker_flags " in
6864 *" $tmp_inherited_linker_flag "*) ;;
cristyda16f162011-02-19 23:52:17 +00006865 *) new_inherited_linker_flags+=" $tmp_inherited_linker_flag";;
cristy3ed852e2009-09-05 21:47:34 +00006866 esac
6867 done
6868 fi
cristy98dddb52010-11-04 00:30:15 +00006869 dependency_libs=`$ECHO " $dependency_libs" | $SED 's% \([^ $]*\).ltframework% -framework \1%g'`
cristy3ed852e2009-09-05 21:47:34 +00006870 if test "$linkmode,$pass" = "lib,link" ||
6871 test "$linkmode,$pass" = "prog,scan" ||
6872 { test "$linkmode" != prog && test "$linkmode" != lib; }; then
cristyda16f162011-02-19 23:52:17 +00006873 test -n "$dlopen" && dlfiles+=" $dlopen"
6874 test -n "$dlpreopen" && dlprefiles+=" $dlpreopen"
cristy3ed852e2009-09-05 21:47:34 +00006875 fi
6876
6877 if test "$pass" = conv; then
6878 # Only check for convenience libraries
6879 deplibs="$lib $deplibs"
6880 if test -z "$libdir"; then
6881 if test -z "$old_library"; then
6882 func_fatal_error "cannot find name of link library for \`$lib'"
6883 fi
6884 # It is a libtool convenience library, so add in its objects.
cristyda16f162011-02-19 23:52:17 +00006885 convenience+=" $ladir/$objdir/$old_library"
6886 old_convenience+=" $ladir/$objdir/$old_library"
cristy3ed852e2009-09-05 21:47:34 +00006887 elif test "$linkmode" != prog && test "$linkmode" != lib; then
6888 func_fatal_error "\`$lib' is not a convenience library"
6889 fi
6890 tmp_libs=
6891 for deplib in $dependency_libs; do
6892 deplibs="$deplib $deplibs"
cristyda16f162011-02-19 23:52:17 +00006893 if $opt_preserve_dup_deps ; then
cristy3ed852e2009-09-05 21:47:34 +00006894 case "$tmp_libs " in
cristyda16f162011-02-19 23:52:17 +00006895 *" $deplib "*) specialdeplibs+=" $deplib" ;;
cristy3ed852e2009-09-05 21:47:34 +00006896 esac
6897 fi
cristyda16f162011-02-19 23:52:17 +00006898 tmp_libs+=" $deplib"
cristy3ed852e2009-09-05 21:47:34 +00006899 done
6900 continue
6901 fi # $pass = conv
6902
6903
6904 # Get the name of the library we link against.
6905 linklib=
cristyda16f162011-02-19 23:52:17 +00006906 if test -n "$old_library" &&
6907 { test "$prefer_static_libs" = yes ||
6908 test "$prefer_static_libs,$installed" = "built,no"; }; then
6909 linklib=$old_library
6910 else
6911 for l in $old_library $library_names; do
6912 linklib="$l"
6913 done
6914 fi
cristy3ed852e2009-09-05 21:47:34 +00006915 if test -z "$linklib"; then
6916 func_fatal_error "cannot find name of link library for \`$lib'"
6917 fi
6918
6919 # This library was specified with -dlopen.
6920 if test "$pass" = dlopen; then
6921 if test -z "$libdir"; then
6922 func_fatal_error "cannot -dlopen a convenience library: \`$lib'"
6923 fi
6924 if test -z "$dlname" ||
6925 test "$dlopen_support" != yes ||
6926 test "$build_libtool_libs" = no; then
6927 # If there is no dlname, no dlopen support or we're linking
6928 # statically, we need to preload. We also need to preload any
6929 # dependent libraries so libltdl's deplib preloader doesn't
6930 # bomb out in the load deplibs phase.
cristyda16f162011-02-19 23:52:17 +00006931 dlprefiles+=" $lib $dependency_libs"
cristy3ed852e2009-09-05 21:47:34 +00006932 else
cristyda16f162011-02-19 23:52:17 +00006933 newdlfiles+=" $lib"
cristy3ed852e2009-09-05 21:47:34 +00006934 fi
6935 continue
6936 fi # $pass = dlopen
6937
6938 # We need an absolute path.
6939 case $ladir in
6940 [\\/]* | [A-Za-z]:[\\/]*) abs_ladir="$ladir" ;;
6941 *)
6942 abs_ladir=`cd "$ladir" && pwd`
6943 if test -z "$abs_ladir"; then
6944 func_warning "cannot determine absolute directory name of \`$ladir'"
6945 func_warning "passing it literally to the linker, although it might fail"
6946 abs_ladir="$ladir"
6947 fi
6948 ;;
6949 esac
6950 func_basename "$lib"
6951 laname="$func_basename_result"
6952
6953 # Find the relevant object directory and library name.
6954 if test "X$installed" = Xyes; then
cristyda16f162011-02-19 23:52:17 +00006955 if test ! -f "$lt_sysroot$libdir/$linklib" && test -f "$abs_ladir/$linklib"; then
cristy3ed852e2009-09-05 21:47:34 +00006956 func_warning "library \`$lib' was moved."
6957 dir="$ladir"
6958 absdir="$abs_ladir"
6959 libdir="$abs_ladir"
6960 else
cristyda16f162011-02-19 23:52:17 +00006961 dir="$lt_sysroot$libdir"
6962 absdir="$lt_sysroot$libdir"
cristy3ed852e2009-09-05 21:47:34 +00006963 fi
6964 test "X$hardcode_automatic" = Xyes && avoidtemprpath=yes
6965 else
6966 if test ! -f "$ladir/$objdir/$linklib" && test -f "$abs_ladir/$linklib"; then
6967 dir="$ladir"
6968 absdir="$abs_ladir"
6969 # Remove this search path later
cristyda16f162011-02-19 23:52:17 +00006970 notinst_path+=" $abs_ladir"
cristy3ed852e2009-09-05 21:47:34 +00006971 else
6972 dir="$ladir/$objdir"
6973 absdir="$abs_ladir/$objdir"
6974 # Remove this search path later
cristyda16f162011-02-19 23:52:17 +00006975 notinst_path+=" $abs_ladir"
cristy3ed852e2009-09-05 21:47:34 +00006976 fi
6977 fi # $installed = yes
6978 func_stripname 'lib' '.la' "$laname"
6979 name=$func_stripname_result
6980
6981 # This library was specified with -dlpreopen.
6982 if test "$pass" = dlpreopen; then
6983 if test -z "$libdir" && test "$linkmode" = prog; then
6984 func_fatal_error "only libraries may -dlpreopen a convenience library: \`$lib'"
6985 fi
cristyda16f162011-02-19 23:52:17 +00006986 case "$host" in
6987 # special handling for platforms with PE-DLLs.
6988 *cygwin* | *mingw* | *cegcc* )
6989 # Linker will automatically link against shared library if both
6990 # static and shared are present. Therefore, ensure we extract
6991 # symbols from the import library if a shared library is present
6992 # (otherwise, the dlopen module name will be incorrect). We do
6993 # this by putting the import library name into $newdlprefiles.
6994 # We recover the dlopen module name by 'saving' the la file
6995 # name in a special purpose variable, and (later) extracting the
6996 # dlname from the la file.
6997 if test -n "$dlname"; then
6998 func_tr_sh "$dir/$linklib"
6999 eval "libfile_$func_tr_sh_result=\$abs_ladir/\$laname"
7000 newdlprefiles+=" $dir/$linklib"
7001 else
7002 newdlprefiles+=" $dir/$old_library"
7003 # Keep a list of preopened convenience libraries to check
7004 # that they are being used correctly in the link pass.
7005 test -z "$libdir" && \
7006 dlpreconveniencelibs+=" $dir/$old_library"
7007 fi
7008 ;;
7009 * )
7010 # Prefer using a static library (so that no silly _DYNAMIC symbols
7011 # are required to link).
7012 if test -n "$old_library"; then
7013 newdlprefiles+=" $dir/$old_library"
7014 # Keep a list of preopened convenience libraries to check
7015 # that they are being used correctly in the link pass.
7016 test -z "$libdir" && \
7017 dlpreconveniencelibs+=" $dir/$old_library"
7018 # Otherwise, use the dlname, so that lt_dlopen finds it.
7019 elif test -n "$dlname"; then
7020 newdlprefiles+=" $dir/$dlname"
7021 else
7022 newdlprefiles+=" $dir/$linklib"
7023 fi
7024 ;;
7025 esac
cristy3ed852e2009-09-05 21:47:34 +00007026 fi # $pass = dlpreopen
7027
7028 if test -z "$libdir"; then
7029 # Link the convenience library
7030 if test "$linkmode" = lib; then
7031 deplibs="$dir/$old_library $deplibs"
7032 elif test "$linkmode,$pass" = "prog,link"; then
7033 compile_deplibs="$dir/$old_library $compile_deplibs"
7034 finalize_deplibs="$dir/$old_library $finalize_deplibs"
7035 else
7036 deplibs="$lib $deplibs" # used for prog,scan pass
7037 fi
7038 continue
7039 fi
7040
7041
7042 if test "$linkmode" = prog && test "$pass" != link; then
cristyda16f162011-02-19 23:52:17 +00007043 newlib_search_path+=" $ladir"
cristy3ed852e2009-09-05 21:47:34 +00007044 deplibs="$lib $deplibs"
7045
7046 linkalldeplibs=no
7047 if test "$link_all_deplibs" != no || test -z "$library_names" ||
7048 test "$build_libtool_libs" = no; then
7049 linkalldeplibs=yes
7050 fi
7051
7052 tmp_libs=
7053 for deplib in $dependency_libs; do
7054 case $deplib in
7055 -L*) func_stripname '-L' '' "$deplib"
cristyda16f162011-02-19 23:52:17 +00007056 func_resolve_sysroot "$func_stripname_result"
7057 newlib_search_path+=" $func_resolve_sysroot_result"
cristy3ed852e2009-09-05 21:47:34 +00007058 ;;
7059 esac
7060 # Need to link against all dependency_libs?
7061 if test "$linkalldeplibs" = yes; then
7062 deplibs="$deplib $deplibs"
7063 else
7064 # Need to hardcode shared library paths
7065 # or/and link against static libraries
7066 newdependency_libs="$deplib $newdependency_libs"
7067 fi
cristyda16f162011-02-19 23:52:17 +00007068 if $opt_preserve_dup_deps ; then
cristy3ed852e2009-09-05 21:47:34 +00007069 case "$tmp_libs " in
cristyda16f162011-02-19 23:52:17 +00007070 *" $deplib "*) specialdeplibs+=" $deplib" ;;
cristy3ed852e2009-09-05 21:47:34 +00007071 esac
7072 fi
cristyda16f162011-02-19 23:52:17 +00007073 tmp_libs+=" $deplib"
cristy3ed852e2009-09-05 21:47:34 +00007074 done # for deplib
7075 continue
7076 fi # $linkmode = prog...
7077
7078 if test "$linkmode,$pass" = "prog,link"; then
7079 if test -n "$library_names" &&
7080 { { test "$prefer_static_libs" = no ||
7081 test "$prefer_static_libs,$installed" = "built,yes"; } ||
7082 test -z "$old_library"; }; then
7083 # We need to hardcode the library path
7084 if test -n "$shlibpath_var" && test -z "$avoidtemprpath" ; then
7085 # Make sure the rpath contains only unique directories.
7086 case "$temp_rpath:" in
7087 *"$absdir:"*) ;;
cristyda16f162011-02-19 23:52:17 +00007088 *) temp_rpath+="$absdir:" ;;
cristy3ed852e2009-09-05 21:47:34 +00007089 esac
7090 fi
7091
7092 # Hardcode the library path.
7093 # Skip directories that are in the system default run-time
7094 # search path.
7095 case " $sys_lib_dlsearch_path " in
7096 *" $absdir "*) ;;
7097 *)
7098 case "$compile_rpath " in
7099 *" $absdir "*) ;;
cristyda16f162011-02-19 23:52:17 +00007100 *) compile_rpath+=" $absdir" ;;
cristy3ed852e2009-09-05 21:47:34 +00007101 esac
7102 ;;
7103 esac
7104 case " $sys_lib_dlsearch_path " in
7105 *" $libdir "*) ;;
7106 *)
7107 case "$finalize_rpath " in
7108 *" $libdir "*) ;;
cristyda16f162011-02-19 23:52:17 +00007109 *) finalize_rpath+=" $libdir" ;;
cristy3ed852e2009-09-05 21:47:34 +00007110 esac
7111 ;;
7112 esac
7113 fi # $linkmode,$pass = prog,link...
7114
7115 if test "$alldeplibs" = yes &&
7116 { test "$deplibs_check_method" = pass_all ||
7117 { test "$build_libtool_libs" = yes &&
7118 test -n "$library_names"; }; }; then
7119 # We only need to search for static libraries
7120 continue
7121 fi
7122 fi
7123
7124 link_static=no # Whether the deplib will be linked statically
7125 use_static_libs=$prefer_static_libs
7126 if test "$use_static_libs" = built && test "$installed" = yes; then
7127 use_static_libs=no
7128 fi
7129 if test -n "$library_names" &&
7130 { test "$use_static_libs" = no || test -z "$old_library"; }; then
7131 case $host in
7132 *cygwin* | *mingw* | *cegcc*)
7133 # No point in relinking DLLs because paths are not encoded
cristyda16f162011-02-19 23:52:17 +00007134 notinst_deplibs+=" $lib"
cristy3ed852e2009-09-05 21:47:34 +00007135 need_relink=no
7136 ;;
7137 *)
7138 if test "$installed" = no; then
cristyda16f162011-02-19 23:52:17 +00007139 notinst_deplibs+=" $lib"
cristy3ed852e2009-09-05 21:47:34 +00007140 need_relink=yes
7141 fi
7142 ;;
7143 esac
7144 # This is a shared library
7145
7146 # Warn about portability, can't link against -module's on some
7147 # systems (darwin). Don't bleat about dlopened modules though!
7148 dlopenmodule=""
7149 for dlpremoduletest in $dlprefiles; do
7150 if test "X$dlpremoduletest" = "X$lib"; then
7151 dlopenmodule="$dlpremoduletest"
7152 break
7153 fi
7154 done
7155 if test -z "$dlopenmodule" && test "$shouldnotlink" = yes && test "$pass" = link; then
cristy98dddb52010-11-04 00:30:15 +00007156 echo
cristy3ed852e2009-09-05 21:47:34 +00007157 if test "$linkmode" = prog; then
7158 $ECHO "*** Warning: Linking the executable $output against the loadable module"
7159 else
7160 $ECHO "*** Warning: Linking the shared library $output against the loadable module"
7161 fi
7162 $ECHO "*** $linklib is not portable!"
7163 fi
7164 if test "$linkmode" = lib &&
7165 test "$hardcode_into_libs" = yes; then
7166 # Hardcode the library path.
7167 # Skip directories that are in the system default run-time
7168 # search path.
7169 case " $sys_lib_dlsearch_path " in
7170 *" $absdir "*) ;;
7171 *)
7172 case "$compile_rpath " in
7173 *" $absdir "*) ;;
cristyda16f162011-02-19 23:52:17 +00007174 *) compile_rpath+=" $absdir" ;;
cristy3ed852e2009-09-05 21:47:34 +00007175 esac
7176 ;;
7177 esac
7178 case " $sys_lib_dlsearch_path " in
7179 *" $libdir "*) ;;
7180 *)
7181 case "$finalize_rpath " in
7182 *" $libdir "*) ;;
cristyda16f162011-02-19 23:52:17 +00007183 *) finalize_rpath+=" $libdir" ;;
cristy3ed852e2009-09-05 21:47:34 +00007184 esac
7185 ;;
7186 esac
7187 fi
7188
7189 if test -n "$old_archive_from_expsyms_cmds"; then
7190 # figure out the soname
7191 set dummy $library_names
7192 shift
7193 realname="$1"
7194 shift
7195 libname=`eval "\\$ECHO \"$libname_spec\""`
7196 # use dlname if we got it. it's perfectly good, no?
7197 if test -n "$dlname"; then
7198 soname="$dlname"
7199 elif test -n "$soname_spec"; then
7200 # bleh windows
7201 case $host in
7202 *cygwin* | mingw* | *cegcc*)
7203 func_arith $current - $age
7204 major=$func_arith_result
7205 versuffix="-$major"
7206 ;;
7207 esac
7208 eval soname=\"$soname_spec\"
7209 else
7210 soname="$realname"
7211 fi
7212
7213 # Make a new name for the extract_expsyms_cmds to use
7214 soroot="$soname"
7215 func_basename "$soroot"
7216 soname="$func_basename_result"
7217 func_stripname 'lib' '.dll' "$soname"
7218 newlib=libimp-$func_stripname_result.a
7219
7220 # If the library has no export list, then create one now
7221 if test -f "$output_objdir/$soname-def"; then :
7222 else
7223 func_verbose "extracting exported symbol list from \`$soname'"
7224 func_execute_cmds "$extract_expsyms_cmds" 'exit $?'
7225 fi
7226
7227 # Create $newlib
7228 if test -f "$output_objdir/$newlib"; then :; else
7229 func_verbose "generating import library for \`$soname'"
7230 func_execute_cmds "$old_archive_from_expsyms_cmds" 'exit $?'
7231 fi
7232 # make sure the library variables are pointing to the new library
7233 dir=$output_objdir
7234 linklib=$newlib
7235 fi # test -n "$old_archive_from_expsyms_cmds"
7236
cristyda16f162011-02-19 23:52:17 +00007237 if test "$linkmode" = prog || test "$opt_mode" != relink; then
cristy3ed852e2009-09-05 21:47:34 +00007238 add_shlibpath=
7239 add_dir=
7240 add=
7241 lib_linked=yes
7242 case $hardcode_action in
7243 immediate | unsupported)
7244 if test "$hardcode_direct" = no; then
7245 add="$dir/$linklib"
7246 case $host in
7247 *-*-sco3.2v5.0.[024]*) add_dir="-L$dir" ;;
7248 *-*-sysv4*uw2*) add_dir="-L$dir" ;;
7249 *-*-sysv5OpenUNIX* | *-*-sysv5UnixWare7.[01].[10]* | \
7250 *-*-unixware7*) add_dir="-L$dir" ;;
7251 *-*-darwin* )
7252 # if the lib is a (non-dlopened) module then we can not
7253 # link against it, someone is ignoring the earlier warnings
7254 if /usr/bin/file -L $add 2> /dev/null |
7255 $GREP ": [^:]* bundle" >/dev/null ; then
7256 if test "X$dlopenmodule" != "X$lib"; then
7257 $ECHO "*** Warning: lib $linklib is a module, not a shared library"
7258 if test -z "$old_library" ; then
cristy98dddb52010-11-04 00:30:15 +00007259 echo
7260 echo "*** And there doesn't seem to be a static archive available"
7261 echo "*** The link will probably fail, sorry"
cristy3ed852e2009-09-05 21:47:34 +00007262 else
7263 add="$dir/$old_library"
7264 fi
7265 elif test -n "$old_library"; then
7266 add="$dir/$old_library"
7267 fi
7268 fi
7269 esac
7270 elif test "$hardcode_minus_L" = no; then
7271 case $host in
7272 *-*-sunos*) add_shlibpath="$dir" ;;
7273 esac
7274 add_dir="-L$dir"
7275 add="-l$name"
7276 elif test "$hardcode_shlibpath_var" = no; then
7277 add_shlibpath="$dir"
7278 add="-l$name"
7279 else
7280 lib_linked=no
7281 fi
7282 ;;
7283 relink)
7284 if test "$hardcode_direct" = yes &&
7285 test "$hardcode_direct_absolute" = no; then
7286 add="$dir/$linklib"
7287 elif test "$hardcode_minus_L" = yes; then
cristy2542fc62011-12-06 17:50:25 +00007288 add_dir="-L$absdir"
cristy3ed852e2009-09-05 21:47:34 +00007289 # Try looking first in the location we're being installed to.
7290 if test -n "$inst_prefix_dir"; then
7291 case $libdir in
7292 [\\/]*)
cristyda16f162011-02-19 23:52:17 +00007293 add_dir+=" -L$inst_prefix_dir$libdir"
cristy3ed852e2009-09-05 21:47:34 +00007294 ;;
7295 esac
7296 fi
7297 add="-l$name"
7298 elif test "$hardcode_shlibpath_var" = yes; then
7299 add_shlibpath="$dir"
7300 add="-l$name"
7301 else
7302 lib_linked=no
7303 fi
7304 ;;
7305 *) lib_linked=no ;;
7306 esac
7307
cristyf6fcb5d2010-09-24 01:19:13 +00007308 if test "$lib_linked" != yes; then
7309 func_fatal_configuration "unsupported hardcode properties"
7310 fi
7311
cristy3ed852e2009-09-05 21:47:34 +00007312 if test -n "$add_shlibpath"; then
7313 case :$compile_shlibpath: in
7314 *":$add_shlibpath:"*) ;;
cristyda16f162011-02-19 23:52:17 +00007315 *) compile_shlibpath+="$add_shlibpath:" ;;
cristy3ed852e2009-09-05 21:47:34 +00007316 esac
7317 fi
7318 if test "$linkmode" = prog; then
7319 test -n "$add_dir" && compile_deplibs="$add_dir $compile_deplibs"
7320 test -n "$add" && compile_deplibs="$add $compile_deplibs"
7321 else
7322 test -n "$add_dir" && deplibs="$add_dir $deplibs"
7323 test -n "$add" && deplibs="$add $deplibs"
7324 if test "$hardcode_direct" != yes &&
7325 test "$hardcode_minus_L" != yes &&
7326 test "$hardcode_shlibpath_var" = yes; then
7327 case :$finalize_shlibpath: in
7328 *":$libdir:"*) ;;
cristyda16f162011-02-19 23:52:17 +00007329 *) finalize_shlibpath+="$libdir:" ;;
cristy3ed852e2009-09-05 21:47:34 +00007330 esac
7331 fi
7332 fi
7333 fi
7334
cristyda16f162011-02-19 23:52:17 +00007335 if test "$linkmode" = prog || test "$opt_mode" = relink; then
cristy3ed852e2009-09-05 21:47:34 +00007336 add_shlibpath=
7337 add_dir=
7338 add=
7339 # Finalize command for both is simple: just hardcode it.
7340 if test "$hardcode_direct" = yes &&
7341 test "$hardcode_direct_absolute" = no; then
7342 add="$libdir/$linklib"
7343 elif test "$hardcode_minus_L" = yes; then
7344 add_dir="-L$libdir"
7345 add="-l$name"
7346 elif test "$hardcode_shlibpath_var" = yes; then
7347 case :$finalize_shlibpath: in
7348 *":$libdir:"*) ;;
cristyda16f162011-02-19 23:52:17 +00007349 *) finalize_shlibpath+="$libdir:" ;;
cristy3ed852e2009-09-05 21:47:34 +00007350 esac
7351 add="-l$name"
7352 elif test "$hardcode_automatic" = yes; then
7353 if test -n "$inst_prefix_dir" &&
7354 test -f "$inst_prefix_dir$libdir/$linklib" ; then
7355 add="$inst_prefix_dir$libdir/$linklib"
7356 else
7357 add="$libdir/$linklib"
7358 fi
7359 else
7360 # We cannot seem to hardcode it, guess we'll fake it.
7361 add_dir="-L$libdir"
7362 # Try looking first in the location we're being installed to.
7363 if test -n "$inst_prefix_dir"; then
7364 case $libdir in
7365 [\\/]*)
cristyda16f162011-02-19 23:52:17 +00007366 add_dir+=" -L$inst_prefix_dir$libdir"
cristy3ed852e2009-09-05 21:47:34 +00007367 ;;
7368 esac
7369 fi
7370 add="-l$name"
7371 fi
7372
7373 if test "$linkmode" = prog; then
7374 test -n "$add_dir" && finalize_deplibs="$add_dir $finalize_deplibs"
7375 test -n "$add" && finalize_deplibs="$add $finalize_deplibs"
7376 else
7377 test -n "$add_dir" && deplibs="$add_dir $deplibs"
7378 test -n "$add" && deplibs="$add $deplibs"
7379 fi
7380 fi
7381 elif test "$linkmode" = prog; then
7382 # Here we assume that one of hardcode_direct or hardcode_minus_L
7383 # is not unsupported. This is valid on all known static and
7384 # shared platforms.
7385 if test "$hardcode_direct" != unsupported; then
7386 test -n "$old_library" && linklib="$old_library"
7387 compile_deplibs="$dir/$linklib $compile_deplibs"
7388 finalize_deplibs="$dir/$linklib $finalize_deplibs"
7389 else
7390 compile_deplibs="-l$name -L$dir $compile_deplibs"
7391 finalize_deplibs="-l$name -L$dir $finalize_deplibs"
7392 fi
7393 elif test "$build_libtool_libs" = yes; then
7394 # Not a shared library
7395 if test "$deplibs_check_method" != pass_all; then
7396 # We're trying link a shared library against a static one
7397 # but the system doesn't support it.
7398
7399 # Just print a warning and add the library to dependency_libs so
7400 # that the program can be linked against the static library.
cristy98dddb52010-11-04 00:30:15 +00007401 echo
cristy3ed852e2009-09-05 21:47:34 +00007402 $ECHO "*** Warning: This system can not link to static lib archive $lib."
cristy98dddb52010-11-04 00:30:15 +00007403 echo "*** I have the capability to make that library automatically link in when"
7404 echo "*** you link to this library. But I can only do this if you have a"
7405 echo "*** shared version of the library, which you do not appear to have."
cristy3ed852e2009-09-05 21:47:34 +00007406 if test "$module" = yes; then
cristy98dddb52010-11-04 00:30:15 +00007407 echo "*** But as you try to build a module library, libtool will still create "
7408 echo "*** a static module, that should work as long as the dlopening application"
7409 echo "*** is linked with the -dlopen flag to resolve symbols at runtime."
cristy3ed852e2009-09-05 21:47:34 +00007410 if test -z "$global_symbol_pipe"; then
cristy98dddb52010-11-04 00:30:15 +00007411 echo
7412 echo "*** However, this would only work if libtool was able to extract symbol"
7413 echo "*** lists from a program, using \`nm' or equivalent, but libtool could"
7414 echo "*** not find such a program. So, this module is probably useless."
7415 echo "*** \`nm' from GNU binutils and a full rebuild may help."
cristy3ed852e2009-09-05 21:47:34 +00007416 fi
7417 if test "$build_old_libs" = no; then
7418 build_libtool_libs=module
7419 build_old_libs=yes
7420 else
7421 build_libtool_libs=no
7422 fi
7423 fi
7424 else
7425 deplibs="$dir/$old_library $deplibs"
7426 link_static=yes
7427 fi
7428 fi # link shared/static library?
7429
7430 if test "$linkmode" = lib; then
7431 if test -n "$dependency_libs" &&
7432 { test "$hardcode_into_libs" != yes ||
7433 test "$build_old_libs" = yes ||
7434 test "$link_static" = yes; }; then
7435 # Extract -R from dependency_libs
7436 temp_deplibs=
7437 for libdir in $dependency_libs; do
7438 case $libdir in
7439 -R*) func_stripname '-R' '' "$libdir"
7440 temp_xrpath=$func_stripname_result
7441 case " $xrpath " in
7442 *" $temp_xrpath "*) ;;
cristyda16f162011-02-19 23:52:17 +00007443 *) xrpath+=" $temp_xrpath";;
cristy3ed852e2009-09-05 21:47:34 +00007444 esac;;
cristyda16f162011-02-19 23:52:17 +00007445 *) temp_deplibs+=" $libdir";;
cristy3ed852e2009-09-05 21:47:34 +00007446 esac
7447 done
7448 dependency_libs="$temp_deplibs"
7449 fi
7450
cristyda16f162011-02-19 23:52:17 +00007451 newlib_search_path+=" $absdir"
cristy3ed852e2009-09-05 21:47:34 +00007452 # Link against this library
7453 test "$link_static" = no && newdependency_libs="$abs_ladir/$laname $newdependency_libs"
7454 # ... and its dependency_libs
7455 tmp_libs=
7456 for deplib in $dependency_libs; do
7457 newdependency_libs="$deplib $newdependency_libs"
cristyda16f162011-02-19 23:52:17 +00007458 case $deplib in
7459 -L*) func_stripname '-L' '' "$deplib"
7460 func_resolve_sysroot "$func_stripname_result";;
7461 *) func_resolve_sysroot "$deplib" ;;
7462 esac
7463 if $opt_preserve_dup_deps ; then
cristy3ed852e2009-09-05 21:47:34 +00007464 case "$tmp_libs " in
cristyda16f162011-02-19 23:52:17 +00007465 *" $func_resolve_sysroot_result "*)
7466 specialdeplibs+=" $func_resolve_sysroot_result" ;;
cristy3ed852e2009-09-05 21:47:34 +00007467 esac
7468 fi
cristyda16f162011-02-19 23:52:17 +00007469 tmp_libs+=" $func_resolve_sysroot_result"
cristy3ed852e2009-09-05 21:47:34 +00007470 done
7471
7472 if test "$link_all_deplibs" != no; then
7473 # Add the search paths of all dependency libraries
7474 for deplib in $dependency_libs; do
cristy98dddb52010-11-04 00:30:15 +00007475 path=
cristy3ed852e2009-09-05 21:47:34 +00007476 case $deplib in
7477 -L*) path="$deplib" ;;
7478 *.la)
cristyda16f162011-02-19 23:52:17 +00007479 func_resolve_sysroot "$deplib"
7480 deplib=$func_resolve_sysroot_result
cristy3ed852e2009-09-05 21:47:34 +00007481 func_dirname "$deplib" "" "."
cristyda16f162011-02-19 23:52:17 +00007482 dir=$func_dirname_result
cristy3ed852e2009-09-05 21:47:34 +00007483 # We need an absolute path.
7484 case $dir in
7485 [\\/]* | [A-Za-z]:[\\/]*) absdir="$dir" ;;
7486 *)
7487 absdir=`cd "$dir" && pwd`
7488 if test -z "$absdir"; then
7489 func_warning "cannot determine absolute directory name of \`$dir'"
7490 absdir="$dir"
7491 fi
7492 ;;
7493 esac
7494 if $GREP "^installed=no" $deplib > /dev/null; then
7495 case $host in
7496 *-*-darwin*)
7497 depdepl=
7498 eval deplibrary_names=`${SED} -n -e 's/^library_names=\(.*\)$/\1/p' $deplib`
7499 if test -n "$deplibrary_names" ; then
7500 for tmp in $deplibrary_names ; do
7501 depdepl=$tmp
7502 done
7503 if test -f "$absdir/$objdir/$depdepl" ; then
7504 depdepl="$absdir/$objdir/$depdepl"
7505 darwin_install_name=`${OTOOL} -L $depdepl | awk '{if (NR == 2) {print $1;exit}}'`
7506 if test -z "$darwin_install_name"; then
7507 darwin_install_name=`${OTOOL64} -L $depdepl | awk '{if (NR == 2) {print $1;exit}}'`
7508 fi
cristyda16f162011-02-19 23:52:17 +00007509 compiler_flags+=" ${wl}-dylib_file ${wl}${darwin_install_name}:${depdepl}"
7510 linker_flags+=" -dylib_file ${darwin_install_name}:${depdepl}"
cristy3ed852e2009-09-05 21:47:34 +00007511 path=
7512 fi
7513 fi
7514 ;;
7515 *)
7516 path="-L$absdir/$objdir"
7517 ;;
7518 esac
7519 else
7520 eval libdir=`${SED} -n -e 's/^libdir=\(.*\)$/\1/p' $deplib`
7521 test -z "$libdir" && \
7522 func_fatal_error "\`$deplib' is not a valid libtool archive"
7523 test "$absdir" != "$libdir" && \
7524 func_warning "\`$deplib' seems to be moved"
7525
7526 path="-L$absdir"
7527 fi
7528 ;;
7529 esac
7530 case " $deplibs " in
7531 *" $path "*) ;;
7532 *) deplibs="$path $deplibs" ;;
7533 esac
7534 done
7535 fi # link_all_deplibs != no
7536 fi # linkmode = lib
7537 done # for deplib in $libs
7538 if test "$pass" = link; then
7539 if test "$linkmode" = "prog"; then
7540 compile_deplibs="$new_inherited_linker_flags $compile_deplibs"
7541 finalize_deplibs="$new_inherited_linker_flags $finalize_deplibs"
7542 else
cristy98dddb52010-11-04 00:30:15 +00007543 compiler_flags="$compiler_flags "`$ECHO " $new_inherited_linker_flags" | $SED 's% \([^ $]*\).ltframework% -framework \1%g'`
cristy3ed852e2009-09-05 21:47:34 +00007544 fi
7545 fi
7546 dependency_libs="$newdependency_libs"
7547 if test "$pass" = dlpreopen; then
7548 # Link the dlpreopened libraries before other libraries
7549 for deplib in $save_deplibs; do
7550 deplibs="$deplib $deplibs"
7551 done
7552 fi
7553 if test "$pass" != dlopen; then
7554 if test "$pass" != conv; then
7555 # Make sure lib_search_path contains only unique directories.
7556 lib_search_path=
7557 for dir in $newlib_search_path; do
7558 case "$lib_search_path " in
7559 *" $dir "*) ;;
cristyda16f162011-02-19 23:52:17 +00007560 *) lib_search_path+=" $dir" ;;
cristy3ed852e2009-09-05 21:47:34 +00007561 esac
7562 done
7563 newlib_search_path=
7564 fi
7565
7566 if test "$linkmode,$pass" != "prog,link"; then
7567 vars="deplibs"
7568 else
7569 vars="compile_deplibs finalize_deplibs"
7570 fi
7571 for var in $vars dependency_libs; do
7572 # Add libraries to $var in reverse order
7573 eval tmp_libs=\"\$$var\"
7574 new_libs=
7575 for deplib in $tmp_libs; do
7576 # FIXME: Pedantically, this is the right thing to do, so
7577 # that some nasty dependency loop isn't accidentally
7578 # broken:
7579 #new_libs="$deplib $new_libs"
7580 # Pragmatically, this seems to cause very few problems in
7581 # practice:
7582 case $deplib in
7583 -L*) new_libs="$deplib $new_libs" ;;
7584 -R*) ;;
7585 *)
7586 # And here is the reason: when a library appears more
7587 # than once as an explicit dependence of a library, or
7588 # is implicitly linked in more than once by the
7589 # compiler, it is considered special, and multiple
7590 # occurrences thereof are not removed. Compare this
7591 # with having the same library being listed as a
7592 # dependency of multiple other libraries: in this case,
7593 # we know (pedantically, we assume) the library does not
7594 # need to be listed more than once, so we keep only the
7595 # last copy. This is not always right, but it is rare
7596 # enough that we require users that really mean to play
7597 # such unportable linking tricks to link the library
7598 # using -Wl,-lname, so that libtool does not consider it
7599 # for duplicate removal.
7600 case " $specialdeplibs " in
7601 *" $deplib "*) new_libs="$deplib $new_libs" ;;
7602 *)
7603 case " $new_libs " in
7604 *" $deplib "*) ;;
7605 *) new_libs="$deplib $new_libs" ;;
7606 esac
7607 ;;
7608 esac
7609 ;;
7610 esac
7611 done
7612 tmp_libs=
7613 for deplib in $new_libs; do
7614 case $deplib in
7615 -L*)
7616 case " $tmp_libs " in
7617 *" $deplib "*) ;;
cristyda16f162011-02-19 23:52:17 +00007618 *) tmp_libs+=" $deplib" ;;
cristy3ed852e2009-09-05 21:47:34 +00007619 esac
7620 ;;
cristyda16f162011-02-19 23:52:17 +00007621 *) tmp_libs+=" $deplib" ;;
cristy3ed852e2009-09-05 21:47:34 +00007622 esac
7623 done
7624 eval $var=\"$tmp_libs\"
7625 done # for var
7626 fi
7627 # Last step: remove runtime libs from dependency_libs
7628 # (they stay in deplibs)
7629 tmp_libs=
7630 for i in $dependency_libs ; do
7631 case " $predeps $postdeps $compiler_lib_search_path " in
7632 *" $i "*)
7633 i=""
7634 ;;
7635 esac
7636 if test -n "$i" ; then
cristyda16f162011-02-19 23:52:17 +00007637 tmp_libs+=" $i"
cristy3ed852e2009-09-05 21:47:34 +00007638 fi
7639 done
7640 dependency_libs=$tmp_libs
7641 done # for pass
7642 if test "$linkmode" = prog; then
7643 dlfiles="$newdlfiles"
7644 fi
7645 if test "$linkmode" = prog || test "$linkmode" = lib; then
7646 dlprefiles="$newdlprefiles"
7647 fi
7648
7649 case $linkmode in
7650 oldlib)
7651 if test -n "$dlfiles$dlprefiles" || test "$dlself" != no; then
7652 func_warning "\`-dlopen' is ignored for archives"
7653 fi
7654
7655 case " $deplibs" in
7656 *\ -l* | *\ -L*)
7657 func_warning "\`-l' and \`-L' are ignored for archives" ;;
7658 esac
7659
7660 test -n "$rpath" && \
7661 func_warning "\`-rpath' is ignored for archives"
7662
7663 test -n "$xrpath" && \
7664 func_warning "\`-R' is ignored for archives"
7665
7666 test -n "$vinfo" && \
7667 func_warning "\`-version-info/-version-number' is ignored for archives"
7668
7669 test -n "$release" && \
7670 func_warning "\`-release' is ignored for archives"
7671
7672 test -n "$export_symbols$export_symbols_regex" && \
7673 func_warning "\`-export-symbols' is ignored for archives"
7674
7675 # Now set the variables for building old libraries.
7676 build_libtool_libs=no
7677 oldlibs="$output"
cristyda16f162011-02-19 23:52:17 +00007678 objs+="$old_deplibs"
cristy3ed852e2009-09-05 21:47:34 +00007679 ;;
7680
7681 lib)
7682 # Make sure we only generate libraries of the form `libNAME.la'.
7683 case $outputname in
7684 lib*)
7685 func_stripname 'lib' '.la' "$outputname"
7686 name=$func_stripname_result
7687 eval shared_ext=\"$shrext_cmds\"
7688 eval libname=\"$libname_spec\"
7689 ;;
7690 *)
7691 test "$module" = no && \
7692 func_fatal_help "libtool library \`$output' must begin with \`lib'"
7693
7694 if test "$need_lib_prefix" != no; then
7695 # Add the "lib" prefix for modules if required
7696 func_stripname '' '.la' "$outputname"
7697 name=$func_stripname_result
7698 eval shared_ext=\"$shrext_cmds\"
7699 eval libname=\"$libname_spec\"
7700 else
7701 func_stripname '' '.la' "$outputname"
7702 libname=$func_stripname_result
7703 fi
7704 ;;
7705 esac
7706
7707 if test -n "$objs"; then
7708 if test "$deplibs_check_method" != pass_all; then
7709 func_fatal_error "cannot build libtool library \`$output' from non-libtool objects on this host:$objs"
7710 else
cristy98dddb52010-11-04 00:30:15 +00007711 echo
cristy3ed852e2009-09-05 21:47:34 +00007712 $ECHO "*** Warning: Linking the shared library $output against the non-libtool"
7713 $ECHO "*** objects $objs is not portable!"
cristyda16f162011-02-19 23:52:17 +00007714 libobjs+=" $objs"
cristy3ed852e2009-09-05 21:47:34 +00007715 fi
7716 fi
7717
7718 test "$dlself" != no && \
7719 func_warning "\`-dlopen self' is ignored for libtool libraries"
7720
7721 set dummy $rpath
7722 shift
7723 test "$#" -gt 1 && \
7724 func_warning "ignoring multiple \`-rpath's for a libtool library"
7725
7726 install_libdir="$1"
7727
7728 oldlibs=
7729 if test -z "$rpath"; then
7730 if test "$build_libtool_libs" = yes; then
7731 # Building a libtool convenience library.
7732 # Some compilers have problems with a `.al' extension so
7733 # convenience libraries should have the same extension an
7734 # archive normally would.
7735 oldlibs="$output_objdir/$libname.$libext $oldlibs"
7736 build_libtool_libs=convenience
7737 build_old_libs=yes
7738 fi
7739
7740 test -n "$vinfo" && \
7741 func_warning "\`-version-info/-version-number' is ignored for convenience libraries"
7742
7743 test -n "$release" && \
7744 func_warning "\`-release' is ignored for convenience libraries"
7745 else
7746
7747 # Parse the version information argument.
7748 save_ifs="$IFS"; IFS=':'
7749 set dummy $vinfo 0 0 0
7750 shift
7751 IFS="$save_ifs"
7752
7753 test -n "$7" && \
7754 func_fatal_help "too many parameters to \`-version-info'"
7755
7756 # convert absolute version numbers to libtool ages
7757 # this retains compatibility with .la files and attempts
7758 # to make the code below a bit more comprehensible
7759
7760 case $vinfo_number in
7761 yes)
7762 number_major="$1"
7763 number_minor="$2"
7764 number_revision="$3"
7765 #
7766 # There are really only two kinds -- those that
7767 # use the current revision as the major version
7768 # and those that subtract age and use age as
7769 # a minor version. But, then there is irix
7770 # which has an extra 1 added just for fun
7771 #
7772 case $version_type in
cristy2542fc62011-12-06 17:50:25 +00007773 # correct linux to gnu/linux during the next big refactor
cristy3ed852e2009-09-05 21:47:34 +00007774 darwin|linux|osf|windows|none)
7775 func_arith $number_major + $number_minor
7776 current=$func_arith_result
7777 age="$number_minor"
7778 revision="$number_revision"
7779 ;;
cristy98dddb52010-11-04 00:30:15 +00007780 freebsd-aout|freebsd-elf|qnx|sunos)
cristy3ed852e2009-09-05 21:47:34 +00007781 current="$number_major"
7782 revision="$number_minor"
7783 age="0"
7784 ;;
7785 irix|nonstopux)
7786 func_arith $number_major + $number_minor
7787 current=$func_arith_result
7788 age="$number_minor"
7789 revision="$number_minor"
7790 lt_irix_increment=no
7791 ;;
7792 esac
7793 ;;
7794 no)
7795 current="$1"
7796 revision="$2"
7797 age="$3"
7798 ;;
7799 esac
7800
7801 # Check that each of the things are valid numbers.
7802 case $current in
7803 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]) ;;
7804 *)
7805 func_error "CURRENT \`$current' must be a nonnegative integer"
7806 func_fatal_error "\`$vinfo' is not valid version information"
7807 ;;
7808 esac
7809
7810 case $revision in
7811 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]) ;;
7812 *)
7813 func_error "REVISION \`$revision' must be a nonnegative integer"
7814 func_fatal_error "\`$vinfo' is not valid version information"
7815 ;;
7816 esac
7817
7818 case $age in
7819 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]) ;;
7820 *)
7821 func_error "AGE \`$age' must be a nonnegative integer"
7822 func_fatal_error "\`$vinfo' is not valid version information"
7823 ;;
7824 esac
7825
7826 if test "$age" -gt "$current"; then
7827 func_error "AGE \`$age' is greater than the current interface number \`$current'"
7828 func_fatal_error "\`$vinfo' is not valid version information"
7829 fi
7830
7831 # Calculate the version variables.
7832 major=
7833 versuffix=
7834 verstring=
7835 case $version_type in
7836 none) ;;
7837
7838 darwin)
7839 # Like Linux, but with the current version available in
7840 # verstring for coding it into the library header
7841 func_arith $current - $age
7842 major=.$func_arith_result
7843 versuffix="$major.$age.$revision"
7844 # Darwin ld doesn't like 0 for these options...
7845 func_arith $current + 1
7846 minor_current=$func_arith_result
7847 xlcverstring="${wl}-compatibility_version ${wl}$minor_current ${wl}-current_version ${wl}$minor_current.$revision"
7848 verstring="-compatibility_version $minor_current -current_version $minor_current.$revision"
7849 ;;
7850
7851 freebsd-aout)
7852 major=".$current"
7853 versuffix=".$current.$revision";
7854 ;;
7855
7856 freebsd-elf)
7857 major=".$current"
7858 versuffix=".$current"
7859 ;;
7860
7861 irix | nonstopux)
7862 if test "X$lt_irix_increment" = "Xno"; then
7863 func_arith $current - $age
7864 else
7865 func_arith $current - $age + 1
7866 fi
7867 major=$func_arith_result
7868
7869 case $version_type in
7870 nonstopux) verstring_prefix=nonstopux ;;
7871 *) verstring_prefix=sgi ;;
7872 esac
7873 verstring="$verstring_prefix$major.$revision"
7874
7875 # Add in all the interfaces that we are compatible with.
7876 loop=$revision
7877 while test "$loop" -ne 0; do
7878 func_arith $revision - $loop
7879 iface=$func_arith_result
7880 func_arith $loop - 1
7881 loop=$func_arith_result
7882 verstring="$verstring_prefix$major.$iface:$verstring"
7883 done
7884
7885 # Before this point, $major must not contain `.'.
7886 major=.$major
7887 versuffix="$major.$revision"
7888 ;;
7889
cristy2542fc62011-12-06 17:50:25 +00007890 linux) # correct to gnu/linux during the next big refactor
cristy3ed852e2009-09-05 21:47:34 +00007891 func_arith $current - $age
7892 major=.$func_arith_result
7893 versuffix="$major.$age.$revision"
7894 ;;
7895
7896 osf)
7897 func_arith $current - $age
7898 major=.$func_arith_result
7899 versuffix=".$current.$age.$revision"
7900 verstring="$current.$age.$revision"
7901
7902 # Add in all the interfaces that we are compatible with.
7903 loop=$age
7904 while test "$loop" -ne 0; do
7905 func_arith $current - $loop
7906 iface=$func_arith_result
7907 func_arith $loop - 1
7908 loop=$func_arith_result
7909 verstring="$verstring:${iface}.0"
7910 done
7911
7912 # Make executables depend on our current version.
cristyda16f162011-02-19 23:52:17 +00007913 verstring+=":${current}.0"
cristy3ed852e2009-09-05 21:47:34 +00007914 ;;
7915
7916 qnx)
7917 major=".$current"
7918 versuffix=".$current"
7919 ;;
7920
7921 sunos)
7922 major=".$current"
7923 versuffix=".$current.$revision"
7924 ;;
7925
7926 windows)
7927 # Use '-' rather than '.', since we only want one
7928 # extension on DOS 8.3 filesystems.
7929 func_arith $current - $age
7930 major=$func_arith_result
7931 versuffix="-$major"
7932 ;;
7933
7934 *)
7935 func_fatal_configuration "unknown library version type \`$version_type'"
7936 ;;
7937 esac
7938
7939 # Clear the version info if we defaulted, and they specified a release.
7940 if test -z "$vinfo" && test -n "$release"; then
7941 major=
7942 case $version_type in
7943 darwin)
7944 # we can't check for "0.0" in archive_cmds due to quoting
7945 # problems, so we reset it completely
7946 verstring=
7947 ;;
7948 *)
7949 verstring="0.0"
7950 ;;
7951 esac
7952 if test "$need_version" = no; then
7953 versuffix=
7954 else
7955 versuffix=".0.0"
7956 fi
7957 fi
7958
7959 # Remove version info from name if versioning should be avoided
7960 if test "$avoid_version" = yes && test "$need_version" = no; then
7961 major=
7962 versuffix=
7963 verstring=""
7964 fi
7965
7966 # Check to see if the archive will have undefined symbols.
7967 if test "$allow_undefined" = yes; then
7968 if test "$allow_undefined_flag" = unsupported; then
7969 func_warning "undefined symbols not allowed in $host shared libraries"
7970 build_libtool_libs=no
7971 build_old_libs=yes
7972 fi
7973 else
7974 # Don't allow undefined symbols.
7975 allow_undefined_flag="$no_undefined_flag"
7976 fi
7977
7978 fi
7979
7980 func_generate_dlsyms "$libname" "$libname" "yes"
cristyda16f162011-02-19 23:52:17 +00007981 libobjs+=" $symfileobj"
cristy3ed852e2009-09-05 21:47:34 +00007982 test "X$libobjs" = "X " && libobjs=
7983
cristyda16f162011-02-19 23:52:17 +00007984 if test "$opt_mode" != relink; then
cristy3ed852e2009-09-05 21:47:34 +00007985 # Remove our outputs, but don't remove object files since they
7986 # may have been created when compiling PIC objects.
7987 removelist=
7988 tempremovelist=`$ECHO "$output_objdir/*"`
7989 for p in $tempremovelist; do
7990 case $p in
7991 *.$objext | *.gcno)
7992 ;;
7993 $output_objdir/$outputname | $output_objdir/$libname.* | $output_objdir/${libname}${release}.*)
7994 if test "X$precious_files_regex" != "X"; then
7995 if $ECHO "$p" | $EGREP -e "$precious_files_regex" >/dev/null 2>&1
7996 then
7997 continue
7998 fi
7999 fi
cristyda16f162011-02-19 23:52:17 +00008000 removelist+=" $p"
cristy3ed852e2009-09-05 21:47:34 +00008001 ;;
8002 *) ;;
8003 esac
8004 done
8005 test -n "$removelist" && \
8006 func_show_eval "${RM}r \$removelist"
8007 fi
8008
8009 # Now set the variables for building old libraries.
8010 if test "$build_old_libs" = yes && test "$build_libtool_libs" != convenience ; then
cristyda16f162011-02-19 23:52:17 +00008011 oldlibs+=" $output_objdir/$libname.$libext"
cristy3ed852e2009-09-05 21:47:34 +00008012
8013 # Transform .lo files to .o files.
cristy98dddb52010-11-04 00:30:15 +00008014 oldobjs="$objs "`$ECHO "$libobjs" | $SP2NL | $SED "/\.${libext}$/d; $lo2o" | $NL2SP`
cristy3ed852e2009-09-05 21:47:34 +00008015 fi
8016
8017 # Eliminate all temporary directories.
8018 #for path in $notinst_path; do
cristy98dddb52010-11-04 00:30:15 +00008019 # lib_search_path=`$ECHO "$lib_search_path " | $SED "s% $path % %g"`
8020 # deplibs=`$ECHO "$deplibs " | $SED "s% -L$path % %g"`
8021 # dependency_libs=`$ECHO "$dependency_libs " | $SED "s% -L$path % %g"`
cristy3ed852e2009-09-05 21:47:34 +00008022 #done
8023
8024 if test -n "$xrpath"; then
8025 # If the user specified any rpath flags, then add them.
8026 temp_xrpath=
8027 for libdir in $xrpath; do
cristyda16f162011-02-19 23:52:17 +00008028 func_replace_sysroot "$libdir"
8029 temp_xrpath+=" -R$func_replace_sysroot_result"
cristy3ed852e2009-09-05 21:47:34 +00008030 case "$finalize_rpath " in
8031 *" $libdir "*) ;;
cristyda16f162011-02-19 23:52:17 +00008032 *) finalize_rpath+=" $libdir" ;;
cristy3ed852e2009-09-05 21:47:34 +00008033 esac
8034 done
8035 if test "$hardcode_into_libs" != yes || test "$build_old_libs" = yes; then
8036 dependency_libs="$temp_xrpath $dependency_libs"
8037 fi
8038 fi
8039
8040 # Make sure dlfiles contains only unique files that won't be dlpreopened
8041 old_dlfiles="$dlfiles"
8042 dlfiles=
8043 for lib in $old_dlfiles; do
8044 case " $dlprefiles $dlfiles " in
8045 *" $lib "*) ;;
cristyda16f162011-02-19 23:52:17 +00008046 *) dlfiles+=" $lib" ;;
cristy3ed852e2009-09-05 21:47:34 +00008047 esac
8048 done
8049
8050 # Make sure dlprefiles contains only unique files
8051 old_dlprefiles="$dlprefiles"
8052 dlprefiles=
8053 for lib in $old_dlprefiles; do
8054 case "$dlprefiles " in
8055 *" $lib "*) ;;
cristyda16f162011-02-19 23:52:17 +00008056 *) dlprefiles+=" $lib" ;;
cristy3ed852e2009-09-05 21:47:34 +00008057 esac
8058 done
8059
8060 if test "$build_libtool_libs" = yes; then
8061 if test -n "$rpath"; then
8062 case $host in
cristy98dddb52010-11-04 00:30:15 +00008063 *-*-cygwin* | *-*-mingw* | *-*-pw32* | *-*-os2* | *-*-beos* | *-cegcc* | *-*-haiku*)
cristy3ed852e2009-09-05 21:47:34 +00008064 # these systems don't actually have a c library (as such)!
8065 ;;
8066 *-*-rhapsody* | *-*-darwin1.[012])
8067 # Rhapsody C library is in the System framework
cristyda16f162011-02-19 23:52:17 +00008068 deplibs+=" System.ltframework"
cristy3ed852e2009-09-05 21:47:34 +00008069 ;;
8070 *-*-netbsd*)
8071 # Don't link with libc until the a.out ld.so is fixed.
8072 ;;
8073 *-*-openbsd* | *-*-freebsd* | *-*-dragonfly*)
8074 # Do not include libc due to us having libc/libc_r.
8075 ;;
8076 *-*-sco3.2v5* | *-*-sco5v6*)
8077 # Causes problems with __ctype
8078 ;;
8079 *-*-sysv4.2uw2* | *-*-sysv5* | *-*-unixware* | *-*-OpenUNIX*)
8080 # Compiler inserts libc in the correct place for threads to work
8081 ;;
8082 *)
8083 # Add libc to deplibs on all other systems if necessary.
8084 if test "$build_libtool_need_lc" = "yes"; then
cristyda16f162011-02-19 23:52:17 +00008085 deplibs+=" -lc"
cristy3ed852e2009-09-05 21:47:34 +00008086 fi
8087 ;;
8088 esac
8089 fi
8090
8091 # Transform deplibs into only deplibs that can be linked in shared.
8092 name_save=$name
8093 libname_save=$libname
8094 release_save=$release
8095 versuffix_save=$versuffix
8096 major_save=$major
8097 # I'm not sure if I'm treating the release correctly. I think
8098 # release should show up in the -l (ie -lgmp5) so we don't want to
8099 # add it in twice. Is that correct?
8100 release=""
8101 versuffix=""
8102 major=""
8103 newdeplibs=
8104 droppeddeps=no
8105 case $deplibs_check_method in
8106 pass_all)
8107 # Don't check for shared/static. Everything works.
8108 # This might be a little naive. We might want to check
8109 # whether the library exists or not. But this is on
8110 # osf3 & osf4 and I'm not really sure... Just
8111 # implementing what was already the behavior.
8112 newdeplibs=$deplibs
8113 ;;
8114 test_compile)
8115 # This code stresses the "libraries are programs" paradigm to its
8116 # limits. Maybe even breaks it. We compile a program, linking it
8117 # against the deplibs as a proxy for the library. Then we can check
8118 # whether they linked in statically or dynamically with ldd.
8119 $opt_dry_run || $RM conftest.c
8120 cat > conftest.c <<EOF
8121 int main() { return 0; }
8122EOF
8123 $opt_dry_run || $RM conftest
8124 if $LTCC $LTCFLAGS -o conftest conftest.c $deplibs; then
8125 ldd_output=`ldd conftest`
8126 for i in $deplibs; do
8127 case $i in
8128 -l*)
8129 func_stripname -l '' "$i"
8130 name=$func_stripname_result
8131 if test "X$allow_libtool_libs_with_static_runtimes" = "Xyes" ; then
8132 case " $predeps $postdeps " in
8133 *" $i "*)
cristyda16f162011-02-19 23:52:17 +00008134 newdeplibs+=" $i"
cristy3ed852e2009-09-05 21:47:34 +00008135 i=""
8136 ;;
8137 esac
8138 fi
8139 if test -n "$i" ; then
8140 libname=`eval "\\$ECHO \"$libname_spec\""`
8141 deplib_matches=`eval "\\$ECHO \"$library_names_spec\""`
8142 set dummy $deplib_matches; shift
8143 deplib_match=$1
8144 if test `expr "$ldd_output" : ".*$deplib_match"` -ne 0 ; then
cristyda16f162011-02-19 23:52:17 +00008145 newdeplibs+=" $i"
cristy3ed852e2009-09-05 21:47:34 +00008146 else
8147 droppeddeps=yes
cristy98dddb52010-11-04 00:30:15 +00008148 echo
cristy3ed852e2009-09-05 21:47:34 +00008149 $ECHO "*** Warning: dynamic linker does not accept needed library $i."
cristy98dddb52010-11-04 00:30:15 +00008150 echo "*** I have the capability to make that library automatically link in when"
8151 echo "*** you link to this library. But I can only do this if you have a"
8152 echo "*** shared version of the library, which I believe you do not have"
8153 echo "*** because a test_compile did reveal that the linker did not use it for"
8154 echo "*** its dynamic dependency list that programs get resolved with at runtime."
cristy3ed852e2009-09-05 21:47:34 +00008155 fi
8156 fi
8157 ;;
8158 *)
cristyda16f162011-02-19 23:52:17 +00008159 newdeplibs+=" $i"
cristy3ed852e2009-09-05 21:47:34 +00008160 ;;
8161 esac
8162 done
8163 else
8164 # Error occurred in the first compile. Let's try to salvage
8165 # the situation: Compile a separate program for each library.
8166 for i in $deplibs; do
8167 case $i in
8168 -l*)
8169 func_stripname -l '' "$i"
8170 name=$func_stripname_result
8171 $opt_dry_run || $RM conftest
8172 if $LTCC $LTCFLAGS -o conftest conftest.c $i; then
8173 ldd_output=`ldd conftest`
8174 if test "X$allow_libtool_libs_with_static_runtimes" = "Xyes" ; then
8175 case " $predeps $postdeps " in
8176 *" $i "*)
cristyda16f162011-02-19 23:52:17 +00008177 newdeplibs+=" $i"
cristy3ed852e2009-09-05 21:47:34 +00008178 i=""
8179 ;;
8180 esac
8181 fi
8182 if test -n "$i" ; then
8183 libname=`eval "\\$ECHO \"$libname_spec\""`
8184 deplib_matches=`eval "\\$ECHO \"$library_names_spec\""`
8185 set dummy $deplib_matches; shift
8186 deplib_match=$1
8187 if test `expr "$ldd_output" : ".*$deplib_match"` -ne 0 ; then
cristyda16f162011-02-19 23:52:17 +00008188 newdeplibs+=" $i"
cristy3ed852e2009-09-05 21:47:34 +00008189 else
8190 droppeddeps=yes
cristy98dddb52010-11-04 00:30:15 +00008191 echo
cristy3ed852e2009-09-05 21:47:34 +00008192 $ECHO "*** Warning: dynamic linker does not accept needed library $i."
cristy98dddb52010-11-04 00:30:15 +00008193 echo "*** I have the capability to make that library automatically link in when"
8194 echo "*** you link to this library. But I can only do this if you have a"
8195 echo "*** shared version of the library, which you do not appear to have"
8196 echo "*** because a test_compile did reveal that the linker did not use this one"
8197 echo "*** as a dynamic dependency that programs can get resolved with at runtime."
cristy3ed852e2009-09-05 21:47:34 +00008198 fi
8199 fi
8200 else
8201 droppeddeps=yes
cristy98dddb52010-11-04 00:30:15 +00008202 echo
cristy3ed852e2009-09-05 21:47:34 +00008203 $ECHO "*** Warning! Library $i is needed by this library but I was not able to"
cristy98dddb52010-11-04 00:30:15 +00008204 echo "*** make it link in! You will probably need to install it or some"
8205 echo "*** library that it depends on before this library will be fully"
8206 echo "*** functional. Installing it before continuing would be even better."
cristy3ed852e2009-09-05 21:47:34 +00008207 fi
8208 ;;
8209 *)
cristyda16f162011-02-19 23:52:17 +00008210 newdeplibs+=" $i"
cristy3ed852e2009-09-05 21:47:34 +00008211 ;;
8212 esac
8213 done
8214 fi
8215 ;;
8216 file_magic*)
8217 set dummy $deplibs_check_method; shift
8218 file_magic_regex=`expr "$deplibs_check_method" : "$1 \(.*\)"`
8219 for a_deplib in $deplibs; do
8220 case $a_deplib in
8221 -l*)
8222 func_stripname -l '' "$a_deplib"
8223 name=$func_stripname_result
8224 if test "X$allow_libtool_libs_with_static_runtimes" = "Xyes" ; then
8225 case " $predeps $postdeps " in
8226 *" $a_deplib "*)
cristyda16f162011-02-19 23:52:17 +00008227 newdeplibs+=" $a_deplib"
cristy3ed852e2009-09-05 21:47:34 +00008228 a_deplib=""
8229 ;;
8230 esac
8231 fi
8232 if test -n "$a_deplib" ; then
8233 libname=`eval "\\$ECHO \"$libname_spec\""`
cristyda16f162011-02-19 23:52:17 +00008234 if test -n "$file_magic_glob"; then
8235 libnameglob=`func_echo_all "$libname" | $SED -e $file_magic_glob`
8236 else
8237 libnameglob=$libname
8238 fi
8239 test "$want_nocaseglob" = yes && nocaseglob=`shopt -p nocaseglob`
cristy3ed852e2009-09-05 21:47:34 +00008240 for i in $lib_search_path $sys_lib_search_path $shlib_search_path; do
cristyda16f162011-02-19 23:52:17 +00008241 if test "$want_nocaseglob" = yes; then
8242 shopt -s nocaseglob
8243 potential_libs=`ls $i/$libnameglob[.-]* 2>/dev/null`
8244 $nocaseglob
8245 else
8246 potential_libs=`ls $i/$libnameglob[.-]* 2>/dev/null`
8247 fi
cristy3ed852e2009-09-05 21:47:34 +00008248 for potent_lib in $potential_libs; do
8249 # Follow soft links.
8250 if ls -lLd "$potent_lib" 2>/dev/null |
8251 $GREP " -> " >/dev/null; then
8252 continue
8253 fi
8254 # The statement above tries to avoid entering an
8255 # endless loop below, in case of cyclic links.
8256 # We might still enter an endless loop, since a link
8257 # loop can be closed while we follow links,
8258 # but so what?
8259 potlib="$potent_lib"
8260 while test -h "$potlib" 2>/dev/null; do
8261 potliblink=`ls -ld $potlib | ${SED} 's/.* -> //'`
8262 case $potliblink in
8263 [\\/]* | [A-Za-z]:[\\/]*) potlib="$potliblink";;
cristy98dddb52010-11-04 00:30:15 +00008264 *) potlib=`$ECHO "$potlib" | $SED 's,[^/]*$,,'`"$potliblink";;
cristy3ed852e2009-09-05 21:47:34 +00008265 esac
8266 done
8267 if eval $file_magic_cmd \"\$potlib\" 2>/dev/null |
8268 $SED -e 10q |
8269 $EGREP "$file_magic_regex" > /dev/null; then
cristyda16f162011-02-19 23:52:17 +00008270 newdeplibs+=" $a_deplib"
cristy3ed852e2009-09-05 21:47:34 +00008271 a_deplib=""
8272 break 2
8273 fi
8274 done
8275 done
8276 fi
8277 if test -n "$a_deplib" ; then
8278 droppeddeps=yes
cristy98dddb52010-11-04 00:30:15 +00008279 echo
cristy3ed852e2009-09-05 21:47:34 +00008280 $ECHO "*** Warning: linker path does not have real file for library $a_deplib."
cristy98dddb52010-11-04 00:30:15 +00008281 echo "*** I have the capability to make that library automatically link in when"
8282 echo "*** you link to this library. But I can only do this if you have a"
8283 echo "*** shared version of the library, which you do not appear to have"
8284 echo "*** because I did check the linker path looking for a file starting"
cristy3ed852e2009-09-05 21:47:34 +00008285 if test -z "$potlib" ; then
8286 $ECHO "*** with $libname but no candidates were found. (...for file magic test)"
8287 else
8288 $ECHO "*** with $libname and none of the candidates passed a file format test"
8289 $ECHO "*** using a file magic. Last file checked: $potlib"
8290 fi
8291 fi
8292 ;;
8293 *)
8294 # Add a -L argument.
cristyda16f162011-02-19 23:52:17 +00008295 newdeplibs+=" $a_deplib"
cristy3ed852e2009-09-05 21:47:34 +00008296 ;;
8297 esac
8298 done # Gone through all deplibs.
8299 ;;
8300 match_pattern*)
8301 set dummy $deplibs_check_method; shift
8302 match_pattern_regex=`expr "$deplibs_check_method" : "$1 \(.*\)"`
8303 for a_deplib in $deplibs; do
8304 case $a_deplib in
8305 -l*)
8306 func_stripname -l '' "$a_deplib"
8307 name=$func_stripname_result
8308 if test "X$allow_libtool_libs_with_static_runtimes" = "Xyes" ; then
8309 case " $predeps $postdeps " in
8310 *" $a_deplib "*)
cristyda16f162011-02-19 23:52:17 +00008311 newdeplibs+=" $a_deplib"
cristy3ed852e2009-09-05 21:47:34 +00008312 a_deplib=""
8313 ;;
8314 esac
8315 fi
8316 if test -n "$a_deplib" ; then
8317 libname=`eval "\\$ECHO \"$libname_spec\""`
8318 for i in $lib_search_path $sys_lib_search_path $shlib_search_path; do
8319 potential_libs=`ls $i/$libname[.-]* 2>/dev/null`
8320 for potent_lib in $potential_libs; do
8321 potlib="$potent_lib" # see symlink-check above in file_magic test
cristy98dddb52010-11-04 00:30:15 +00008322 if eval "\$ECHO \"$potent_lib\"" 2>/dev/null | $SED 10q | \
cristy3ed852e2009-09-05 21:47:34 +00008323 $EGREP "$match_pattern_regex" > /dev/null; then
cristyda16f162011-02-19 23:52:17 +00008324 newdeplibs+=" $a_deplib"
cristy3ed852e2009-09-05 21:47:34 +00008325 a_deplib=""
8326 break 2
8327 fi
8328 done
8329 done
8330 fi
8331 if test -n "$a_deplib" ; then
8332 droppeddeps=yes
cristy98dddb52010-11-04 00:30:15 +00008333 echo
cristy3ed852e2009-09-05 21:47:34 +00008334 $ECHO "*** Warning: linker path does not have real file for library $a_deplib."
cristy98dddb52010-11-04 00:30:15 +00008335 echo "*** I have the capability to make that library automatically link in when"
8336 echo "*** you link to this library. But I can only do this if you have a"
8337 echo "*** shared version of the library, which you do not appear to have"
8338 echo "*** because I did check the linker path looking for a file starting"
cristy3ed852e2009-09-05 21:47:34 +00008339 if test -z "$potlib" ; then
8340 $ECHO "*** with $libname but no candidates were found. (...for regex pattern test)"
8341 else
8342 $ECHO "*** with $libname and none of the candidates passed a file format test"
8343 $ECHO "*** using a regex pattern. Last file checked: $potlib"
8344 fi
8345 fi
8346 ;;
8347 *)
8348 # Add a -L argument.
cristyda16f162011-02-19 23:52:17 +00008349 newdeplibs+=" $a_deplib"
cristy3ed852e2009-09-05 21:47:34 +00008350 ;;
8351 esac
8352 done # Gone through all deplibs.
8353 ;;
8354 none | unknown | *)
8355 newdeplibs=""
cristy98dddb52010-11-04 00:30:15 +00008356 tmp_deplibs=`$ECHO " $deplibs" | $SED 's/ -lc$//; s/ -[LR][^ ]*//g'`
cristy3ed852e2009-09-05 21:47:34 +00008357 if test "X$allow_libtool_libs_with_static_runtimes" = "Xyes" ; then
8358 for i in $predeps $postdeps ; do
8359 # can't use Xsed below, because $i might contain '/'
cristy98dddb52010-11-04 00:30:15 +00008360 tmp_deplibs=`$ECHO " $tmp_deplibs" | $SED "s,$i,,"`
cristy3ed852e2009-09-05 21:47:34 +00008361 done
8362 fi
cristy98dddb52010-11-04 00:30:15 +00008363 case $tmp_deplibs in
8364 *[!\ \ ]*)
8365 echo
cristy3ed852e2009-09-05 21:47:34 +00008366 if test "X$deplibs_check_method" = "Xnone"; then
cristy98dddb52010-11-04 00:30:15 +00008367 echo "*** Warning: inter-library dependencies are not supported in this platform."
cristy3ed852e2009-09-05 21:47:34 +00008368 else
cristy98dddb52010-11-04 00:30:15 +00008369 echo "*** Warning: inter-library dependencies are not known to be supported."
cristy3ed852e2009-09-05 21:47:34 +00008370 fi
cristy98dddb52010-11-04 00:30:15 +00008371 echo "*** All declared inter-library dependencies are being dropped."
cristy3ed852e2009-09-05 21:47:34 +00008372 droppeddeps=yes
cristy98dddb52010-11-04 00:30:15 +00008373 ;;
8374 esac
cristy3ed852e2009-09-05 21:47:34 +00008375 ;;
8376 esac
8377 versuffix=$versuffix_save
8378 major=$major_save
8379 release=$release_save
8380 libname=$libname_save
8381 name=$name_save
8382
8383 case $host in
8384 *-*-rhapsody* | *-*-darwin1.[012])
8385 # On Rhapsody replace the C library with the System framework
cristy98dddb52010-11-04 00:30:15 +00008386 newdeplibs=`$ECHO " $newdeplibs" | $SED 's/ -lc / System.ltframework /'`
cristy3ed852e2009-09-05 21:47:34 +00008387 ;;
8388 esac
8389
8390 if test "$droppeddeps" = yes; then
8391 if test "$module" = yes; then
cristy98dddb52010-11-04 00:30:15 +00008392 echo
8393 echo "*** Warning: libtool could not satisfy all declared inter-library"
cristy3ed852e2009-09-05 21:47:34 +00008394 $ECHO "*** dependencies of module $libname. Therefore, libtool will create"
cristy98dddb52010-11-04 00:30:15 +00008395 echo "*** a static module, that should work as long as the dlopening"
8396 echo "*** application is linked with the -dlopen flag."
cristy3ed852e2009-09-05 21:47:34 +00008397 if test -z "$global_symbol_pipe"; then
cristy98dddb52010-11-04 00:30:15 +00008398 echo
8399 echo "*** However, this would only work if libtool was able to extract symbol"
8400 echo "*** lists from a program, using \`nm' or equivalent, but libtool could"
8401 echo "*** not find such a program. So, this module is probably useless."
8402 echo "*** \`nm' from GNU binutils and a full rebuild may help."
cristy3ed852e2009-09-05 21:47:34 +00008403 fi
8404 if test "$build_old_libs" = no; then
8405 oldlibs="$output_objdir/$libname.$libext"
8406 build_libtool_libs=module
8407 build_old_libs=yes
8408 else
8409 build_libtool_libs=no
8410 fi
8411 else
cristy98dddb52010-11-04 00:30:15 +00008412 echo "*** The inter-library dependencies that have been dropped here will be"
8413 echo "*** automatically added whenever a program is linked with this library"
8414 echo "*** or is declared to -dlopen it."
cristy3ed852e2009-09-05 21:47:34 +00008415
8416 if test "$allow_undefined" = no; then
cristy98dddb52010-11-04 00:30:15 +00008417 echo
8418 echo "*** Since this library must not contain undefined symbols,"
8419 echo "*** because either the platform does not support them or"
8420 echo "*** it was explicitly requested with -no-undefined,"
8421 echo "*** libtool will only create a static version of it."
cristy3ed852e2009-09-05 21:47:34 +00008422 if test "$build_old_libs" = no; then
8423 oldlibs="$output_objdir/$libname.$libext"
8424 build_libtool_libs=module
8425 build_old_libs=yes
8426 else
8427 build_libtool_libs=no
8428 fi
8429 fi
8430 fi
8431 fi
8432 # Done checking deplibs!
8433 deplibs=$newdeplibs
8434 fi
8435 # Time to change all our "foo.ltframework" stuff back to "-framework foo"
8436 case $host in
8437 *-*-darwin*)
cristy98dddb52010-11-04 00:30:15 +00008438 newdeplibs=`$ECHO " $newdeplibs" | $SED 's% \([^ $]*\).ltframework% -framework \1%g'`
8439 new_inherited_linker_flags=`$ECHO " $new_inherited_linker_flags" | $SED 's% \([^ $]*\).ltframework% -framework \1%g'`
8440 deplibs=`$ECHO " $deplibs" | $SED 's% \([^ $]*\).ltframework% -framework \1%g'`
cristy3ed852e2009-09-05 21:47:34 +00008441 ;;
8442 esac
8443
8444 # move library search paths that coincide with paths to not yet
8445 # installed libraries to the beginning of the library search list
8446 new_libs=
8447 for path in $notinst_path; do
8448 case " $new_libs " in
8449 *" -L$path/$objdir "*) ;;
8450 *)
8451 case " $deplibs " in
8452 *" -L$path/$objdir "*)
cristyda16f162011-02-19 23:52:17 +00008453 new_libs+=" -L$path/$objdir" ;;
cristy3ed852e2009-09-05 21:47:34 +00008454 esac
8455 ;;
8456 esac
8457 done
8458 for deplib in $deplibs; do
8459 case $deplib in
8460 -L*)
8461 case " $new_libs " in
8462 *" $deplib "*) ;;
cristyda16f162011-02-19 23:52:17 +00008463 *) new_libs+=" $deplib" ;;
cristy3ed852e2009-09-05 21:47:34 +00008464 esac
8465 ;;
cristyda16f162011-02-19 23:52:17 +00008466 *) new_libs+=" $deplib" ;;
cristy3ed852e2009-09-05 21:47:34 +00008467 esac
8468 done
8469 deplibs="$new_libs"
8470
8471 # All the library-specific variables (install_libdir is set above).
8472 library_names=
8473 old_library=
8474 dlname=
8475
8476 # Test again, we may have decided not to build it any more
8477 if test "$build_libtool_libs" = yes; then
cristy2542fc62011-12-06 17:50:25 +00008478 # Remove ${wl} instances when linking with ld.
8479 # FIXME: should test the right _cmds variable.
8480 case $archive_cmds in
8481 *\$LD\ *) wl= ;;
8482 esac
cristy3ed852e2009-09-05 21:47:34 +00008483 if test "$hardcode_into_libs" = yes; then
8484 # Hardcode the library paths
8485 hardcode_libdirs=
8486 dep_rpath=
8487 rpath="$finalize_rpath"
cristyda16f162011-02-19 23:52:17 +00008488 test "$opt_mode" != relink && rpath="$compile_rpath$rpath"
cristy3ed852e2009-09-05 21:47:34 +00008489 for libdir in $rpath; do
8490 if test -n "$hardcode_libdir_flag_spec"; then
8491 if test -n "$hardcode_libdir_separator"; then
cristyda16f162011-02-19 23:52:17 +00008492 func_replace_sysroot "$libdir"
8493 libdir=$func_replace_sysroot_result
cristy3ed852e2009-09-05 21:47:34 +00008494 if test -z "$hardcode_libdirs"; then
8495 hardcode_libdirs="$libdir"
8496 else
8497 # Just accumulate the unique libdirs.
8498 case $hardcode_libdir_separator$hardcode_libdirs$hardcode_libdir_separator in
8499 *"$hardcode_libdir_separator$libdir$hardcode_libdir_separator"*)
8500 ;;
8501 *)
cristyda16f162011-02-19 23:52:17 +00008502 hardcode_libdirs+="$hardcode_libdir_separator$libdir"
cristy3ed852e2009-09-05 21:47:34 +00008503 ;;
8504 esac
8505 fi
8506 else
8507 eval flag=\"$hardcode_libdir_flag_spec\"
cristyda16f162011-02-19 23:52:17 +00008508 dep_rpath+=" $flag"
cristy3ed852e2009-09-05 21:47:34 +00008509 fi
8510 elif test -n "$runpath_var"; then
8511 case "$perm_rpath " in
8512 *" $libdir "*) ;;
cristy987feef2011-11-17 12:24:56 +00008513 *) perm_rpath+=" $libdir" ;;
cristy3ed852e2009-09-05 21:47:34 +00008514 esac
8515 fi
8516 done
8517 # Substitute the hardcoded libdirs into the rpath.
8518 if test -n "$hardcode_libdir_separator" &&
8519 test -n "$hardcode_libdirs"; then
8520 libdir="$hardcode_libdirs"
cristy2542fc62011-12-06 17:50:25 +00008521 eval "dep_rpath=\"$hardcode_libdir_flag_spec\""
cristy3ed852e2009-09-05 21:47:34 +00008522 fi
8523 if test -n "$runpath_var" && test -n "$perm_rpath"; then
8524 # We should set the runpath_var.
8525 rpath=
8526 for dir in $perm_rpath; do
cristyda16f162011-02-19 23:52:17 +00008527 rpath+="$dir:"
cristy3ed852e2009-09-05 21:47:34 +00008528 done
8529 eval "$runpath_var='$rpath\$$runpath_var'; export $runpath_var"
8530 fi
8531 test -n "$dep_rpath" && deplibs="$dep_rpath $deplibs"
8532 fi
8533
8534 shlibpath="$finalize_shlibpath"
cristyda16f162011-02-19 23:52:17 +00008535 test "$opt_mode" != relink && shlibpath="$compile_shlibpath$shlibpath"
cristy3ed852e2009-09-05 21:47:34 +00008536 if test -n "$shlibpath"; then
8537 eval "$shlibpath_var='$shlibpath\$$shlibpath_var'; export $shlibpath_var"
8538 fi
8539
8540 # Get the real and link names of the library.
8541 eval shared_ext=\"$shrext_cmds\"
8542 eval library_names=\"$library_names_spec\"
8543 set dummy $library_names
8544 shift
8545 realname="$1"
8546 shift
8547
8548 if test -n "$soname_spec"; then
8549 eval soname=\"$soname_spec\"
8550 else
8551 soname="$realname"
8552 fi
8553 if test -z "$dlname"; then
8554 dlname=$soname
8555 fi
8556
8557 lib="$output_objdir/$realname"
8558 linknames=
8559 for link
8560 do
cristyda16f162011-02-19 23:52:17 +00008561 linknames+=" $link"
cristy3ed852e2009-09-05 21:47:34 +00008562 done
8563
8564 # Use standard objects if they are pic
cristy98dddb52010-11-04 00:30:15 +00008565 test -z "$pic_flag" && libobjs=`$ECHO "$libobjs" | $SP2NL | $SED "$lo2o" | $NL2SP`
cristy3ed852e2009-09-05 21:47:34 +00008566 test "X$libobjs" = "X " && libobjs=
8567
8568 delfiles=
8569 if test -n "$export_symbols" && test -n "$include_expsyms"; then
8570 $opt_dry_run || cp "$export_symbols" "$output_objdir/$libname.uexp"
8571 export_symbols="$output_objdir/$libname.uexp"
cristyda16f162011-02-19 23:52:17 +00008572 delfiles+=" $export_symbols"
cristy3ed852e2009-09-05 21:47:34 +00008573 fi
8574
8575 orig_export_symbols=
8576 case $host_os in
8577 cygwin* | mingw* | cegcc*)
8578 if test -n "$export_symbols" && test -z "$export_symbols_regex"; then
8579 # exporting using user supplied symfile
8580 if test "x`$SED 1q $export_symbols`" != xEXPORTS; then
8581 # and it's NOT already a .def file. Must figure out
8582 # which of the given symbols are data symbols and tag
8583 # them as such. So, trigger use of export_symbols_cmds.
8584 # export_symbols gets reassigned inside the "prepare
8585 # the list of exported symbols" if statement, so the
8586 # include_expsyms logic still works.
8587 orig_export_symbols="$export_symbols"
8588 export_symbols=
8589 always_export_symbols=yes
8590 fi
8591 fi
8592 ;;
8593 esac
8594
8595 # Prepare the list of exported symbols
8596 if test -z "$export_symbols"; then
8597 if test "$always_export_symbols" = yes || test -n "$export_symbols_regex"; then
8598 func_verbose "generating symbol list for \`$libname.la'"
8599 export_symbols="$output_objdir/$libname.exp"
8600 $opt_dry_run || $RM $export_symbols
8601 cmds=$export_symbols_cmds
8602 save_ifs="$IFS"; IFS='~'
cristyda16f162011-02-19 23:52:17 +00008603 for cmd1 in $cmds; do
cristy3ed852e2009-09-05 21:47:34 +00008604 IFS="$save_ifs"
cristyda16f162011-02-19 23:52:17 +00008605 # Take the normal branch if the nm_file_list_spec branch
8606 # doesn't work or if tool conversion is not needed.
8607 case $nm_file_list_spec~$to_tool_file_cmd in
8608 *~func_convert_file_noop | *~func_convert_file_msys_to_w32 | ~*)
8609 try_normal_branch=yes
8610 eval cmd=\"$cmd1\"
8611 func_len " $cmd"
8612 len=$func_len_result
8613 ;;
8614 *)
8615 try_normal_branch=no
8616 ;;
8617 esac
8618 if test "$try_normal_branch" = yes \
8619 && { test "$len" -lt "$max_cmd_len" \
8620 || test "$max_cmd_len" -le -1; }
8621 then
cristy3ed852e2009-09-05 21:47:34 +00008622 func_show_eval "$cmd" 'exit $?'
8623 skipped_export=false
cristyda16f162011-02-19 23:52:17 +00008624 elif test -n "$nm_file_list_spec"; then
8625 func_basename "$output"
8626 output_la=$func_basename_result
8627 save_libobjs=$libobjs
8628 save_output=$output
8629 output=${output_objdir}/${output_la}.nm
8630 func_to_tool_file "$output"
8631 libobjs=$nm_file_list_spec$func_to_tool_file_result
8632 delfiles+=" $output"
8633 func_verbose "creating $NM input file list: $output"
8634 for obj in $save_libobjs; do
8635 func_to_tool_file "$obj"
8636 $ECHO "$func_to_tool_file_result"
8637 done > "$output"
8638 eval cmd=\"$cmd1\"
8639 func_show_eval "$cmd" 'exit $?'
8640 output=$save_output
8641 libobjs=$save_libobjs
8642 skipped_export=false
cristy3ed852e2009-09-05 21:47:34 +00008643 else
8644 # The command line is too long to execute in one step.
8645 func_verbose "using reloadable object file for export list..."
8646 skipped_export=:
8647 # Break out early, otherwise skipped_export may be
8648 # set to false by a later but shorter cmd.
8649 break
8650 fi
8651 done
8652 IFS="$save_ifs"
8653 if test -n "$export_symbols_regex" && test "X$skipped_export" != "X:"; then
8654 func_show_eval '$EGREP -e "$export_symbols_regex" "$export_symbols" > "${export_symbols}T"'
8655 func_show_eval '$MV "${export_symbols}T" "$export_symbols"'
8656 fi
8657 fi
8658 fi
8659
8660 if test -n "$export_symbols" && test -n "$include_expsyms"; then
8661 tmp_export_symbols="$export_symbols"
8662 test -n "$orig_export_symbols" && tmp_export_symbols="$orig_export_symbols"
cristy98dddb52010-11-04 00:30:15 +00008663 $opt_dry_run || eval '$ECHO "$include_expsyms" | $SP2NL >> "$tmp_export_symbols"'
cristy3ed852e2009-09-05 21:47:34 +00008664 fi
8665
8666 if test "X$skipped_export" != "X:" && test -n "$orig_export_symbols"; then
8667 # The given exports_symbols file has to be filtered, so filter it.
8668 func_verbose "filter symbol list for \`$libname.la' to tag DATA exports"
8669 # FIXME: $output_objdir/$libname.filter potentially contains lots of
8670 # 's' commands which not all seds can handle. GNU sed should be fine
8671 # though. Also, the filter scales superlinearly with the number of
8672 # global variables. join(1) would be nice here, but unfortunately
8673 # isn't a blessed tool.
8674 $opt_dry_run || $SED -e '/[ ,]DATA/!d;s,\(.*\)\([ \,].*\),s|^\1$|\1\2|,' < $export_symbols > $output_objdir/$libname.filter
cristyda16f162011-02-19 23:52:17 +00008675 delfiles+=" $export_symbols $output_objdir/$libname.filter"
cristy3ed852e2009-09-05 21:47:34 +00008676 export_symbols=$output_objdir/$libname.def
8677 $opt_dry_run || $SED -f $output_objdir/$libname.filter < $orig_export_symbols > $export_symbols
8678 fi
8679
8680 tmp_deplibs=
8681 for test_deplib in $deplibs; do
8682 case " $convenience " in
8683 *" $test_deplib "*) ;;
8684 *)
cristyda16f162011-02-19 23:52:17 +00008685 tmp_deplibs+=" $test_deplib"
cristy3ed852e2009-09-05 21:47:34 +00008686 ;;
8687 esac
8688 done
8689 deplibs="$tmp_deplibs"
8690
8691 if test -n "$convenience"; then
8692 if test -n "$whole_archive_flag_spec" &&
8693 test "$compiler_needs_object" = yes &&
8694 test -z "$libobjs"; then
8695 # extract the archives, so we have objects to list.
8696 # TODO: could optimize this to just extract one archive.
8697 whole_archive_flag_spec=
8698 fi
8699 if test -n "$whole_archive_flag_spec"; then
8700 save_libobjs=$libobjs
8701 eval libobjs=\"\$libobjs $whole_archive_flag_spec\"
8702 test "X$libobjs" = "X " && libobjs=
8703 else
8704 gentop="$output_objdir/${outputname}x"
cristyda16f162011-02-19 23:52:17 +00008705 generated+=" $gentop"
cristy3ed852e2009-09-05 21:47:34 +00008706
8707 func_extract_archives $gentop $convenience
cristyda16f162011-02-19 23:52:17 +00008708 libobjs+=" $func_extract_archives_result"
cristy3ed852e2009-09-05 21:47:34 +00008709 test "X$libobjs" = "X " && libobjs=
8710 fi
8711 fi
8712
8713 if test "$thread_safe" = yes && test -n "$thread_safe_flag_spec"; then
8714 eval flag=\"$thread_safe_flag_spec\"
cristyda16f162011-02-19 23:52:17 +00008715 linker_flags+=" $flag"
cristy3ed852e2009-09-05 21:47:34 +00008716 fi
8717
8718 # Make a backup of the uninstalled library when relinking
cristyda16f162011-02-19 23:52:17 +00008719 if test "$opt_mode" = relink; then
cristy3ed852e2009-09-05 21:47:34 +00008720 $opt_dry_run || eval '(cd $output_objdir && $RM ${realname}U && $MV $realname ${realname}U)' || exit $?
8721 fi
8722
8723 # Do each of the archive commands.
8724 if test "$module" = yes && test -n "$module_cmds" ; then
8725 if test -n "$export_symbols" && test -n "$module_expsym_cmds"; then
8726 eval test_cmds=\"$module_expsym_cmds\"
8727 cmds=$module_expsym_cmds
8728 else
8729 eval test_cmds=\"$module_cmds\"
8730 cmds=$module_cmds
8731 fi
8732 else
8733 if test -n "$export_symbols" && test -n "$archive_expsym_cmds"; then
8734 eval test_cmds=\"$archive_expsym_cmds\"
8735 cmds=$archive_expsym_cmds
8736 else
8737 eval test_cmds=\"$archive_cmds\"
8738 cmds=$archive_cmds
8739 fi
8740 fi
8741
8742 if test "X$skipped_export" != "X:" &&
8743 func_len " $test_cmds" &&
8744 len=$func_len_result &&
8745 test "$len" -lt "$max_cmd_len" || test "$max_cmd_len" -le -1; then
8746 :
8747 else
8748 # The command line is too long to link in one step, link piecewise
8749 # or, if using GNU ld and skipped_export is not :, use a linker
8750 # script.
8751
8752 # Save the value of $output and $libobjs because we want to
8753 # use them later. If we have whole_archive_flag_spec, we
8754 # want to use save_libobjs as it was before
8755 # whole_archive_flag_spec was expanded, because we can't
8756 # assume the linker understands whole_archive_flag_spec.
8757 # This may have to be revisited, in case too many
8758 # convenience libraries get linked in and end up exceeding
8759 # the spec.
8760 if test -z "$convenience" || test -z "$whole_archive_flag_spec"; then
8761 save_libobjs=$libobjs
8762 fi
8763 save_output=$output
cristy98dddb52010-11-04 00:30:15 +00008764 func_basename "$output"
8765 output_la=$func_basename_result
cristy3ed852e2009-09-05 21:47:34 +00008766
8767 # Clear the reloadable object creation command queue and
8768 # initialize k to one.
8769 test_cmds=
8770 concat_cmds=
8771 objlist=
8772 last_robj=
8773 k=1
8774
8775 if test -n "$save_libobjs" && test "X$skipped_export" != "X:" && test "$with_gnu_ld" = yes; then
8776 output=${output_objdir}/${output_la}.lnkscript
8777 func_verbose "creating GNU ld script: $output"
cristy98dddb52010-11-04 00:30:15 +00008778 echo 'INPUT (' > $output
cristy3ed852e2009-09-05 21:47:34 +00008779 for obj in $save_libobjs
8780 do
cristyda16f162011-02-19 23:52:17 +00008781 func_to_tool_file "$obj"
8782 $ECHO "$func_to_tool_file_result" >> $output
cristy3ed852e2009-09-05 21:47:34 +00008783 done
cristy98dddb52010-11-04 00:30:15 +00008784 echo ')' >> $output
cristyda16f162011-02-19 23:52:17 +00008785 delfiles+=" $output"
8786 func_to_tool_file "$output"
8787 output=$func_to_tool_file_result
cristy3ed852e2009-09-05 21:47:34 +00008788 elif test -n "$save_libobjs" && test "X$skipped_export" != "X:" && test "X$file_list_spec" != X; then
8789 output=${output_objdir}/${output_la}.lnk
8790 func_verbose "creating linker input file list: $output"
8791 : > $output
8792 set x $save_libobjs
8793 shift
8794 firstobj=
8795 if test "$compiler_needs_object" = yes; then
8796 firstobj="$1 "
8797 shift
8798 fi
8799 for obj
8800 do
cristyda16f162011-02-19 23:52:17 +00008801 func_to_tool_file "$obj"
8802 $ECHO "$func_to_tool_file_result" >> $output
cristy3ed852e2009-09-05 21:47:34 +00008803 done
cristyda16f162011-02-19 23:52:17 +00008804 delfiles+=" $output"
8805 func_to_tool_file "$output"
8806 output=$firstobj\"$file_list_spec$func_to_tool_file_result\"
cristy3ed852e2009-09-05 21:47:34 +00008807 else
8808 if test -n "$save_libobjs"; then
8809 func_verbose "creating reloadable object files..."
8810 output=$output_objdir/$output_la-${k}.$objext
8811 eval test_cmds=\"$reload_cmds\"
8812 func_len " $test_cmds"
8813 len0=$func_len_result
8814 len=$len0
8815
8816 # Loop over the list of objects to be linked.
8817 for obj in $save_libobjs
8818 do
8819 func_len " $obj"
8820 func_arith $len + $func_len_result
8821 len=$func_arith_result
8822 if test "X$objlist" = X ||
8823 test "$len" -lt "$max_cmd_len"; then
cristyda16f162011-02-19 23:52:17 +00008824 objlist+=" $obj"
cristy3ed852e2009-09-05 21:47:34 +00008825 else
8826 # The command $test_cmds is almost too long, add a
8827 # command to the queue.
8828 if test "$k" -eq 1 ; then
8829 # The first file doesn't have a previous command to add.
cristy98dddb52010-11-04 00:30:15 +00008830 reload_objs=$objlist
8831 eval concat_cmds=\"$reload_cmds\"
cristy3ed852e2009-09-05 21:47:34 +00008832 else
8833 # All subsequent reloadable object files will link in
8834 # the last one created.
cristy98dddb52010-11-04 00:30:15 +00008835 reload_objs="$objlist $last_robj"
8836 eval concat_cmds=\"\$concat_cmds~$reload_cmds~\$RM $last_robj\"
cristy3ed852e2009-09-05 21:47:34 +00008837 fi
8838 last_robj=$output_objdir/$output_la-${k}.$objext
8839 func_arith $k + 1
8840 k=$func_arith_result
8841 output=$output_objdir/$output_la-${k}.$objext
cristy98dddb52010-11-04 00:30:15 +00008842 objlist=" $obj"
cristy3ed852e2009-09-05 21:47:34 +00008843 func_len " $last_robj"
8844 func_arith $len0 + $func_len_result
8845 len=$func_arith_result
8846 fi
8847 done
8848 # Handle the remaining objects by creating one last
8849 # reloadable object file. All subsequent reloadable object
8850 # files will link in the last one created.
8851 test -z "$concat_cmds" || concat_cmds=$concat_cmds~
cristy98dddb52010-11-04 00:30:15 +00008852 reload_objs="$objlist $last_robj"
8853 eval concat_cmds=\"\${concat_cmds}$reload_cmds\"
cristy3ed852e2009-09-05 21:47:34 +00008854 if test -n "$last_robj"; then
8855 eval concat_cmds=\"\${concat_cmds}~\$RM $last_robj\"
8856 fi
cristyda16f162011-02-19 23:52:17 +00008857 delfiles+=" $output"
cristy3ed852e2009-09-05 21:47:34 +00008858
8859 else
8860 output=
8861 fi
8862
8863 if ${skipped_export-false}; then
8864 func_verbose "generating symbol list for \`$libname.la'"
8865 export_symbols="$output_objdir/$libname.exp"
8866 $opt_dry_run || $RM $export_symbols
8867 libobjs=$output
8868 # Append the command to create the export file.
8869 test -z "$concat_cmds" || concat_cmds=$concat_cmds~
8870 eval concat_cmds=\"\$concat_cmds$export_symbols_cmds\"
8871 if test -n "$last_robj"; then
8872 eval concat_cmds=\"\$concat_cmds~\$RM $last_robj\"
8873 fi
8874 fi
8875
8876 test -n "$save_libobjs" &&
8877 func_verbose "creating a temporary reloadable object file: $output"
8878
8879 # Loop through the commands generated above and execute them.
8880 save_ifs="$IFS"; IFS='~'
8881 for cmd in $concat_cmds; do
8882 IFS="$save_ifs"
8883 $opt_silent || {
8884 func_quote_for_expand "$cmd"
8885 eval "func_echo $func_quote_for_expand_result"
8886 }
8887 $opt_dry_run || eval "$cmd" || {
8888 lt_exit=$?
8889
8890 # Restore the uninstalled library and exit
cristyda16f162011-02-19 23:52:17 +00008891 if test "$opt_mode" = relink; then
cristy3ed852e2009-09-05 21:47:34 +00008892 ( cd "$output_objdir" && \
8893 $RM "${realname}T" && \
8894 $MV "${realname}U" "$realname" )
8895 fi
8896
8897 exit $lt_exit
8898 }
8899 done
8900 IFS="$save_ifs"
8901
8902 if test -n "$export_symbols_regex" && ${skipped_export-false}; then
8903 func_show_eval '$EGREP -e "$export_symbols_regex" "$export_symbols" > "${export_symbols}T"'
8904 func_show_eval '$MV "${export_symbols}T" "$export_symbols"'
8905 fi
8906 fi
8907
8908 if ${skipped_export-false}; then
8909 if test -n "$export_symbols" && test -n "$include_expsyms"; then
8910 tmp_export_symbols="$export_symbols"
8911 test -n "$orig_export_symbols" && tmp_export_symbols="$orig_export_symbols"
cristy98dddb52010-11-04 00:30:15 +00008912 $opt_dry_run || eval '$ECHO "$include_expsyms" | $SP2NL >> "$tmp_export_symbols"'
cristy3ed852e2009-09-05 21:47:34 +00008913 fi
8914
8915 if test -n "$orig_export_symbols"; then
8916 # The given exports_symbols file has to be filtered, so filter it.
8917 func_verbose "filter symbol list for \`$libname.la' to tag DATA exports"
8918 # FIXME: $output_objdir/$libname.filter potentially contains lots of
8919 # 's' commands which not all seds can handle. GNU sed should be fine
8920 # though. Also, the filter scales superlinearly with the number of
8921 # global variables. join(1) would be nice here, but unfortunately
8922 # isn't a blessed tool.
8923 $opt_dry_run || $SED -e '/[ ,]DATA/!d;s,\(.*\)\([ \,].*\),s|^\1$|\1\2|,' < $export_symbols > $output_objdir/$libname.filter
cristyda16f162011-02-19 23:52:17 +00008924 delfiles+=" $export_symbols $output_objdir/$libname.filter"
cristy3ed852e2009-09-05 21:47:34 +00008925 export_symbols=$output_objdir/$libname.def
8926 $opt_dry_run || $SED -f $output_objdir/$libname.filter < $orig_export_symbols > $export_symbols
8927 fi
8928 fi
8929
8930 libobjs=$output
8931 # Restore the value of output.
8932 output=$save_output
8933
8934 if test -n "$convenience" && test -n "$whole_archive_flag_spec"; then
8935 eval libobjs=\"\$libobjs $whole_archive_flag_spec\"
8936 test "X$libobjs" = "X " && libobjs=
8937 fi
8938 # Expand the library linking commands again to reset the
8939 # value of $libobjs for piecewise linking.
8940
8941 # Do each of the archive commands.
8942 if test "$module" = yes && test -n "$module_cmds" ; then
8943 if test -n "$export_symbols" && test -n "$module_expsym_cmds"; then
8944 cmds=$module_expsym_cmds
8945 else
8946 cmds=$module_cmds
8947 fi
8948 else
8949 if test -n "$export_symbols" && test -n "$archive_expsym_cmds"; then
8950 cmds=$archive_expsym_cmds
8951 else
8952 cmds=$archive_cmds
8953 fi
8954 fi
8955 fi
8956
8957 if test -n "$delfiles"; then
8958 # Append the command to remove temporary files to $cmds.
8959 eval cmds=\"\$cmds~\$RM $delfiles\"
8960 fi
8961
8962 # Add any objects from preloaded convenience libraries
8963 if test -n "$dlprefiles"; then
8964 gentop="$output_objdir/${outputname}x"
cristyda16f162011-02-19 23:52:17 +00008965 generated+=" $gentop"
cristy3ed852e2009-09-05 21:47:34 +00008966
8967 func_extract_archives $gentop $dlprefiles
cristyda16f162011-02-19 23:52:17 +00008968 libobjs+=" $func_extract_archives_result"
cristy3ed852e2009-09-05 21:47:34 +00008969 test "X$libobjs" = "X " && libobjs=
8970 fi
8971
8972 save_ifs="$IFS"; IFS='~'
8973 for cmd in $cmds; do
8974 IFS="$save_ifs"
8975 eval cmd=\"$cmd\"
8976 $opt_silent || {
8977 func_quote_for_expand "$cmd"
8978 eval "func_echo $func_quote_for_expand_result"
8979 }
8980 $opt_dry_run || eval "$cmd" || {
8981 lt_exit=$?
8982
8983 # Restore the uninstalled library and exit
cristyda16f162011-02-19 23:52:17 +00008984 if test "$opt_mode" = relink; then
cristy3ed852e2009-09-05 21:47:34 +00008985 ( cd "$output_objdir" && \
8986 $RM "${realname}T" && \
8987 $MV "${realname}U" "$realname" )
8988 fi
8989
8990 exit $lt_exit
8991 }
8992 done
8993 IFS="$save_ifs"
8994
8995 # Restore the uninstalled library and exit
cristyda16f162011-02-19 23:52:17 +00008996 if test "$opt_mode" = relink; then
cristy3ed852e2009-09-05 21:47:34 +00008997 $opt_dry_run || eval '(cd $output_objdir && $RM ${realname}T && $MV $realname ${realname}T && $MV ${realname}U $realname)' || exit $?
8998
8999 if test -n "$convenience"; then
9000 if test -z "$whole_archive_flag_spec"; then
9001 func_show_eval '${RM}r "$gentop"'
9002 fi
9003 fi
9004
9005 exit $EXIT_SUCCESS
9006 fi
9007
9008 # Create links to the real library.
9009 for linkname in $linknames; do
9010 if test "$realname" != "$linkname"; then
9011 func_show_eval '(cd "$output_objdir" && $RM "$linkname" && $LN_S "$realname" "$linkname")' 'exit $?'
9012 fi
9013 done
9014
9015 # If -module or -export-dynamic was specified, set the dlname.
9016 if test "$module" = yes || test "$export_dynamic" = yes; then
9017 # On all known operating systems, these are identical.
9018 dlname="$soname"
9019 fi
9020 fi
9021 ;;
9022
9023 obj)
9024 if test -n "$dlfiles$dlprefiles" || test "$dlself" != no; then
9025 func_warning "\`-dlopen' is ignored for objects"
9026 fi
9027
9028 case " $deplibs" in
9029 *\ -l* | *\ -L*)
9030 func_warning "\`-l' and \`-L' are ignored for objects" ;;
9031 esac
9032
9033 test -n "$rpath" && \
9034 func_warning "\`-rpath' is ignored for objects"
9035
9036 test -n "$xrpath" && \
9037 func_warning "\`-R' is ignored for objects"
9038
9039 test -n "$vinfo" && \
9040 func_warning "\`-version-info' is ignored for objects"
9041
9042 test -n "$release" && \
9043 func_warning "\`-release' is ignored for objects"
9044
9045 case $output in
9046 *.lo)
9047 test -n "$objs$old_deplibs" && \
9048 func_fatal_error "cannot build library object \`$output' from non-libtool objects"
9049
9050 libobj=$output
9051 func_lo2o "$libobj"
9052 obj=$func_lo2o_result
9053 ;;
9054 *)
9055 libobj=
9056 obj="$output"
9057 ;;
9058 esac
9059
9060 # Delete the old objects.
9061 $opt_dry_run || $RM $obj $libobj
9062
9063 # Objects from convenience libraries. This assumes
9064 # single-version convenience libraries. Whenever we create
9065 # different ones for PIC/non-PIC, this we'll have to duplicate
9066 # the extraction.
9067 reload_conv_objs=
9068 gentop=
9069 # reload_cmds runs $LD directly, so let us get rid of
9070 # -Wl from whole_archive_flag_spec and hope we can get by with
9071 # turning comma into space..
9072 wl=
9073
9074 if test -n "$convenience"; then
9075 if test -n "$whole_archive_flag_spec"; then
9076 eval tmp_whole_archive_flags=\"$whole_archive_flag_spec\"
cristy98dddb52010-11-04 00:30:15 +00009077 reload_conv_objs=$reload_objs\ `$ECHO "$tmp_whole_archive_flags" | $SED 's|,| |g'`
cristy3ed852e2009-09-05 21:47:34 +00009078 else
9079 gentop="$output_objdir/${obj}x"
cristyda16f162011-02-19 23:52:17 +00009080 generated+=" $gentop"
cristy3ed852e2009-09-05 21:47:34 +00009081
9082 func_extract_archives $gentop $convenience
9083 reload_conv_objs="$reload_objs $func_extract_archives_result"
9084 fi
9085 fi
9086
cristyda16f162011-02-19 23:52:17 +00009087 # If we're not building shared, we need to use non_pic_objs
9088 test "$build_libtool_libs" != yes && libobjs="$non_pic_objects"
9089
cristy3ed852e2009-09-05 21:47:34 +00009090 # Create the old-style object.
cristy98dddb52010-11-04 00:30:15 +00009091 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 +00009092
9093 output="$obj"
9094 func_execute_cmds "$reload_cmds" 'exit $?'
9095
9096 # Exit if we aren't doing a library object file.
9097 if test -z "$libobj"; then
9098 if test -n "$gentop"; then
9099 func_show_eval '${RM}r "$gentop"'
9100 fi
9101
9102 exit $EXIT_SUCCESS
9103 fi
9104
9105 if test "$build_libtool_libs" != yes; then
9106 if test -n "$gentop"; then
9107 func_show_eval '${RM}r "$gentop"'
9108 fi
9109
9110 # Create an invalid libtool object if no PIC, so that we don't
9111 # accidentally link it into a program.
9112 # $show "echo timestamp > $libobj"
9113 # $opt_dry_run || eval "echo timestamp > $libobj" || exit $?
9114 exit $EXIT_SUCCESS
9115 fi
9116
9117 if test -n "$pic_flag" || test "$pic_mode" != default; then
9118 # Only do commands if we really have different PIC objects.
9119 reload_objs="$libobjs $reload_conv_objs"
9120 output="$libobj"
9121 func_execute_cmds "$reload_cmds" 'exit $?'
9122 fi
9123
9124 if test -n "$gentop"; then
9125 func_show_eval '${RM}r "$gentop"'
9126 fi
9127
9128 exit $EXIT_SUCCESS
9129 ;;
9130
9131 prog)
9132 case $host in
9133 *cygwin*) func_stripname '' '.exe' "$output"
9134 output=$func_stripname_result.exe;;
9135 esac
9136 test -n "$vinfo" && \
9137 func_warning "\`-version-info' is ignored for programs"
9138
9139 test -n "$release" && \
9140 func_warning "\`-release' is ignored for programs"
9141
9142 test "$preload" = yes \
9143 && test "$dlopen_support" = unknown \
9144 && test "$dlopen_self" = unknown \
9145 && test "$dlopen_self_static" = unknown && \
9146 func_warning "\`LT_INIT([dlopen])' not used. Assuming no dlopen support."
9147
9148 case $host in
9149 *-*-rhapsody* | *-*-darwin1.[012])
9150 # On Rhapsody replace the C library is the System framework
cristy98dddb52010-11-04 00:30:15 +00009151 compile_deplibs=`$ECHO " $compile_deplibs" | $SED 's/ -lc / System.ltframework /'`
9152 finalize_deplibs=`$ECHO " $finalize_deplibs" | $SED 's/ -lc / System.ltframework /'`
cristy3ed852e2009-09-05 21:47:34 +00009153 ;;
9154 esac
9155
9156 case $host in
9157 *-*-darwin*)
9158 # Don't allow lazy linking, it breaks C++ global constructors
9159 # But is supposedly fixed on 10.4 or later (yay!).
9160 if test "$tagname" = CXX ; then
9161 case ${MACOSX_DEPLOYMENT_TARGET-10.0} in
9162 10.[0123])
cristyda16f162011-02-19 23:52:17 +00009163 compile_command+=" ${wl}-bind_at_load"
9164 finalize_command+=" ${wl}-bind_at_load"
cristy3ed852e2009-09-05 21:47:34 +00009165 ;;
9166 esac
9167 fi
9168 # Time to change all our "foo.ltframework" stuff back to "-framework foo"
cristy98dddb52010-11-04 00:30:15 +00009169 compile_deplibs=`$ECHO " $compile_deplibs" | $SED 's% \([^ $]*\).ltframework% -framework \1%g'`
9170 finalize_deplibs=`$ECHO " $finalize_deplibs" | $SED 's% \([^ $]*\).ltframework% -framework \1%g'`
cristy3ed852e2009-09-05 21:47:34 +00009171 ;;
9172 esac
9173
9174
9175 # move library search paths that coincide with paths to not yet
9176 # installed libraries to the beginning of the library search list
9177 new_libs=
9178 for path in $notinst_path; do
9179 case " $new_libs " in
9180 *" -L$path/$objdir "*) ;;
9181 *)
9182 case " $compile_deplibs " in
9183 *" -L$path/$objdir "*)
cristyda16f162011-02-19 23:52:17 +00009184 new_libs+=" -L$path/$objdir" ;;
cristy3ed852e2009-09-05 21:47:34 +00009185 esac
9186 ;;
9187 esac
9188 done
9189 for deplib in $compile_deplibs; do
9190 case $deplib in
9191 -L*)
9192 case " $new_libs " in
9193 *" $deplib "*) ;;
cristyda16f162011-02-19 23:52:17 +00009194 *) new_libs+=" $deplib" ;;
cristy3ed852e2009-09-05 21:47:34 +00009195 esac
9196 ;;
cristyda16f162011-02-19 23:52:17 +00009197 *) new_libs+=" $deplib" ;;
cristy3ed852e2009-09-05 21:47:34 +00009198 esac
9199 done
9200 compile_deplibs="$new_libs"
9201
9202
cristyda16f162011-02-19 23:52:17 +00009203 compile_command+=" $compile_deplibs"
9204 finalize_command+=" $finalize_deplibs"
cristy3ed852e2009-09-05 21:47:34 +00009205
9206 if test -n "$rpath$xrpath"; then
9207 # If the user specified any rpath flags, then add them.
9208 for libdir in $rpath $xrpath; do
9209 # This is the magic to use -rpath.
9210 case "$finalize_rpath " in
9211 *" $libdir "*) ;;
cristyda16f162011-02-19 23:52:17 +00009212 *) finalize_rpath+=" $libdir" ;;
cristy3ed852e2009-09-05 21:47:34 +00009213 esac
9214 done
9215 fi
9216
9217 # Now hardcode the library paths
9218 rpath=
9219 hardcode_libdirs=
9220 for libdir in $compile_rpath $finalize_rpath; do
9221 if test -n "$hardcode_libdir_flag_spec"; then
9222 if test -n "$hardcode_libdir_separator"; then
9223 if test -z "$hardcode_libdirs"; then
9224 hardcode_libdirs="$libdir"
9225 else
9226 # Just accumulate the unique libdirs.
9227 case $hardcode_libdir_separator$hardcode_libdirs$hardcode_libdir_separator in
9228 *"$hardcode_libdir_separator$libdir$hardcode_libdir_separator"*)
9229 ;;
9230 *)
cristyda16f162011-02-19 23:52:17 +00009231 hardcode_libdirs+="$hardcode_libdir_separator$libdir"
cristy3ed852e2009-09-05 21:47:34 +00009232 ;;
9233 esac
9234 fi
9235 else
9236 eval flag=\"$hardcode_libdir_flag_spec\"
cristyda16f162011-02-19 23:52:17 +00009237 rpath+=" $flag"
cristy3ed852e2009-09-05 21:47:34 +00009238 fi
9239 elif test -n "$runpath_var"; then
9240 case "$perm_rpath " in
9241 *" $libdir "*) ;;
cristyda16f162011-02-19 23:52:17 +00009242 *) perm_rpath+=" $libdir" ;;
cristy3ed852e2009-09-05 21:47:34 +00009243 esac
9244 fi
9245 case $host in
9246 *-*-cygwin* | *-*-mingw* | *-*-pw32* | *-*-os2* | *-cegcc*)
9247 testbindir=`${ECHO} "$libdir" | ${SED} -e 's*/lib$*/bin*'`
9248 case :$dllsearchpath: in
9249 *":$libdir:"*) ;;
9250 ::) dllsearchpath=$libdir;;
cristyda16f162011-02-19 23:52:17 +00009251 *) dllsearchpath+=":$libdir";;
cristy3ed852e2009-09-05 21:47:34 +00009252 esac
9253 case :$dllsearchpath: in
9254 *":$testbindir:"*) ;;
9255 ::) dllsearchpath=$testbindir;;
cristyda16f162011-02-19 23:52:17 +00009256 *) dllsearchpath+=":$testbindir";;
cristy3ed852e2009-09-05 21:47:34 +00009257 esac
9258 ;;
9259 esac
9260 done
9261 # Substitute the hardcoded libdirs into the rpath.
9262 if test -n "$hardcode_libdir_separator" &&
9263 test -n "$hardcode_libdirs"; then
9264 libdir="$hardcode_libdirs"
9265 eval rpath=\" $hardcode_libdir_flag_spec\"
9266 fi
9267 compile_rpath="$rpath"
9268
9269 rpath=
9270 hardcode_libdirs=
9271 for libdir in $finalize_rpath; do
9272 if test -n "$hardcode_libdir_flag_spec"; then
9273 if test -n "$hardcode_libdir_separator"; then
9274 if test -z "$hardcode_libdirs"; then
9275 hardcode_libdirs="$libdir"
9276 else
9277 # Just accumulate the unique libdirs.
9278 case $hardcode_libdir_separator$hardcode_libdirs$hardcode_libdir_separator in
9279 *"$hardcode_libdir_separator$libdir$hardcode_libdir_separator"*)
9280 ;;
9281 *)
cristyda16f162011-02-19 23:52:17 +00009282 hardcode_libdirs+="$hardcode_libdir_separator$libdir"
cristy3ed852e2009-09-05 21:47:34 +00009283 ;;
9284 esac
9285 fi
9286 else
9287 eval flag=\"$hardcode_libdir_flag_spec\"
cristyda16f162011-02-19 23:52:17 +00009288 rpath+=" $flag"
cristy3ed852e2009-09-05 21:47:34 +00009289 fi
9290 elif test -n "$runpath_var"; then
9291 case "$finalize_perm_rpath " in
9292 *" $libdir "*) ;;
cristyda16f162011-02-19 23:52:17 +00009293 *) finalize_perm_rpath+=" $libdir" ;;
cristy3ed852e2009-09-05 21:47:34 +00009294 esac
9295 fi
9296 done
9297 # Substitute the hardcoded libdirs into the rpath.
9298 if test -n "$hardcode_libdir_separator" &&
9299 test -n "$hardcode_libdirs"; then
9300 libdir="$hardcode_libdirs"
9301 eval rpath=\" $hardcode_libdir_flag_spec\"
9302 fi
9303 finalize_rpath="$rpath"
9304
9305 if test -n "$libobjs" && test "$build_old_libs" = yes; then
9306 # Transform all the library objects into standard objects.
cristy98dddb52010-11-04 00:30:15 +00009307 compile_command=`$ECHO "$compile_command" | $SP2NL | $SED "$lo2o" | $NL2SP`
9308 finalize_command=`$ECHO "$finalize_command" | $SP2NL | $SED "$lo2o" | $NL2SP`
cristy3ed852e2009-09-05 21:47:34 +00009309 fi
9310
9311 func_generate_dlsyms "$outputname" "@PROGRAM@" "no"
9312
9313 # template prelinking step
9314 if test -n "$prelink_cmds"; then
9315 func_execute_cmds "$prelink_cmds" 'exit $?'
9316 fi
9317
9318 wrappers_required=yes
9319 case $host in
cristy98dddb52010-11-04 00:30:15 +00009320 *cegcc* | *mingw32ce*)
9321 # Disable wrappers for cegcc and mingw32ce hosts, we are cross compiling anyway.
9322 wrappers_required=no
9323 ;;
cristy3ed852e2009-09-05 21:47:34 +00009324 *cygwin* | *mingw* )
9325 if test "$build_libtool_libs" != yes; then
9326 wrappers_required=no
9327 fi
9328 ;;
cristy3ed852e2009-09-05 21:47:34 +00009329 *)
9330 if test "$need_relink" = no || test "$build_libtool_libs" != yes; then
9331 wrappers_required=no
9332 fi
9333 ;;
9334 esac
9335 if test "$wrappers_required" = no; then
9336 # Replace the output file specification.
cristy98dddb52010-11-04 00:30:15 +00009337 compile_command=`$ECHO "$compile_command" | $SED 's%@OUTPUT@%'"$output"'%g'`
cristy3ed852e2009-09-05 21:47:34 +00009338 link_command="$compile_command$compile_rpath"
9339
9340 # We have no uninstalled library dependencies, so finalize right now.
9341 exit_status=0
9342 func_show_eval "$link_command" 'exit_status=$?'
9343
cristyda16f162011-02-19 23:52:17 +00009344 if test -n "$postlink_cmds"; then
9345 func_to_tool_file "$output"
9346 postlink_cmds=`func_echo_all "$postlink_cmds" | $SED -e 's%@OUTPUT@%'"$output"'%g' -e 's%@TOOL_OUTPUT@%'"$func_to_tool_file_result"'%g'`
9347 func_execute_cmds "$postlink_cmds" 'exit $?'
9348 fi
9349
cristy3ed852e2009-09-05 21:47:34 +00009350 # Delete the generated files.
9351 if test -f "$output_objdir/${outputname}S.${objext}"; then
9352 func_show_eval '$RM "$output_objdir/${outputname}S.${objext}"'
9353 fi
9354
9355 exit $exit_status
9356 fi
9357
9358 if test -n "$compile_shlibpath$finalize_shlibpath"; then
9359 compile_command="$shlibpath_var=\"$compile_shlibpath$finalize_shlibpath\$$shlibpath_var\" $compile_command"
9360 fi
9361 if test -n "$finalize_shlibpath"; then
9362 finalize_command="$shlibpath_var=\"$finalize_shlibpath\$$shlibpath_var\" $finalize_command"
9363 fi
9364
9365 compile_var=
9366 finalize_var=
9367 if test -n "$runpath_var"; then
9368 if test -n "$perm_rpath"; then
9369 # We should set the runpath_var.
9370 rpath=
9371 for dir in $perm_rpath; do
cristyda16f162011-02-19 23:52:17 +00009372 rpath+="$dir:"
cristy3ed852e2009-09-05 21:47:34 +00009373 done
9374 compile_var="$runpath_var=\"$rpath\$$runpath_var\" "
9375 fi
9376 if test -n "$finalize_perm_rpath"; then
9377 # We should set the runpath_var.
9378 rpath=
9379 for dir in $finalize_perm_rpath; do
cristyda16f162011-02-19 23:52:17 +00009380 rpath+="$dir:"
cristy3ed852e2009-09-05 21:47:34 +00009381 done
9382 finalize_var="$runpath_var=\"$rpath\$$runpath_var\" "
9383 fi
9384 fi
9385
9386 if test "$no_install" = yes; then
9387 # We don't need to create a wrapper script.
9388 link_command="$compile_var$compile_command$compile_rpath"
9389 # Replace the output file specification.
cristy98dddb52010-11-04 00:30:15 +00009390 link_command=`$ECHO "$link_command" | $SED 's%@OUTPUT@%'"$output"'%g'`
cristy3ed852e2009-09-05 21:47:34 +00009391 # Delete the old output file.
9392 $opt_dry_run || $RM $output
9393 # Link the executable and exit
9394 func_show_eval "$link_command" 'exit $?'
cristyda16f162011-02-19 23:52:17 +00009395
9396 if test -n "$postlink_cmds"; then
9397 func_to_tool_file "$output"
9398 postlink_cmds=`func_echo_all "$postlink_cmds" | $SED -e 's%@OUTPUT@%'"$output"'%g' -e 's%@TOOL_OUTPUT@%'"$func_to_tool_file_result"'%g'`
9399 func_execute_cmds "$postlink_cmds" 'exit $?'
9400 fi
9401
cristy3ed852e2009-09-05 21:47:34 +00009402 exit $EXIT_SUCCESS
9403 fi
9404
9405 if test "$hardcode_action" = relink; then
9406 # Fast installation is not supported
9407 link_command="$compile_var$compile_command$compile_rpath"
9408 relink_command="$finalize_var$finalize_command$finalize_rpath"
9409
9410 func_warning "this platform does not like uninstalled shared libraries"
9411 func_warning "\`$output' will be relinked during installation"
9412 else
9413 if test "$fast_install" != no; then
9414 link_command="$finalize_var$compile_command$finalize_rpath"
9415 if test "$fast_install" = yes; then
cristy98dddb52010-11-04 00:30:15 +00009416 relink_command=`$ECHO "$compile_var$compile_command$compile_rpath" | $SED 's%@OUTPUT@%\$progdir/\$file%g'`
cristy3ed852e2009-09-05 21:47:34 +00009417 else
9418 # fast_install is set to needless
9419 relink_command=
9420 fi
9421 else
9422 link_command="$compile_var$compile_command$compile_rpath"
9423 relink_command="$finalize_var$finalize_command$finalize_rpath"
9424 fi
9425 fi
9426
9427 # Replace the output file specification.
cristy98dddb52010-11-04 00:30:15 +00009428 link_command=`$ECHO "$link_command" | $SED 's%@OUTPUT@%'"$output_objdir/$outputname"'%g'`
cristy3ed852e2009-09-05 21:47:34 +00009429
9430 # Delete the old output files.
9431 $opt_dry_run || $RM $output $output_objdir/$outputname $output_objdir/lt-$outputname
9432
9433 func_show_eval "$link_command" 'exit $?'
9434
cristyda16f162011-02-19 23:52:17 +00009435 if test -n "$postlink_cmds"; then
9436 func_to_tool_file "$output_objdir/$outputname"
9437 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'`
9438 func_execute_cmds "$postlink_cmds" 'exit $?'
9439 fi
9440
cristy3ed852e2009-09-05 21:47:34 +00009441 # Now create the wrapper script.
9442 func_verbose "creating $output"
9443
9444 # Quote the relink command for shipping.
9445 if test -n "$relink_command"; then
9446 # Preserve any variables that may affect compiler behavior
9447 for var in $variables_saved_for_relink; do
9448 if eval test -z \"\${$var+set}\"; then
9449 relink_command="{ test -z \"\${$var+set}\" || $lt_unset $var || { $var=; export $var; }; }; $relink_command"
9450 elif eval var_value=\$$var; test -z "$var_value"; then
9451 relink_command="$var=; export $var; $relink_command"
9452 else
9453 func_quote_for_eval "$var_value"
9454 relink_command="$var=$func_quote_for_eval_result; export $var; $relink_command"
9455 fi
9456 done
9457 relink_command="(cd `pwd`; $relink_command)"
cristy98dddb52010-11-04 00:30:15 +00009458 relink_command=`$ECHO "$relink_command" | $SED "$sed_quote_subst"`
cristy3ed852e2009-09-05 21:47:34 +00009459 fi
9460
9461 # Only actually do things if not in dry run mode.
9462 $opt_dry_run || {
9463 # win32 will think the script is a binary if it has
9464 # a .exe suffix, so we strip it off here.
9465 case $output in
9466 *.exe) func_stripname '' '.exe' "$output"
9467 output=$func_stripname_result ;;
9468 esac
9469 # test for cygwin because mv fails w/o .exe extensions
9470 case $host in
9471 *cygwin*)
9472 exeext=.exe
9473 func_stripname '' '.exe' "$outputname"
9474 outputname=$func_stripname_result ;;
9475 *) exeext= ;;
9476 esac
9477 case $host in
9478 *cygwin* | *mingw* )
9479 func_dirname_and_basename "$output" "" "."
9480 output_name=$func_basename_result
9481 output_path=$func_dirname_result
9482 cwrappersource="$output_path/$objdir/lt-$output_name.c"
9483 cwrapper="$output_path/$output_name.exe"
9484 $RM $cwrappersource $cwrapper
9485 trap "$RM $cwrappersource $cwrapper; exit $EXIT_FAILURE" 1 2 15
9486
9487 func_emit_cwrapperexe_src > $cwrappersource
9488
9489 # The wrapper executable is built using the $host compiler,
9490 # because it contains $host paths and files. If cross-
9491 # compiling, it, like the target executable, must be
9492 # executed on the $host or under an emulation environment.
9493 $opt_dry_run || {
9494 $LTCC $LTCFLAGS -o $cwrapper $cwrappersource
9495 $STRIP $cwrapper
9496 }
9497
9498 # Now, create the wrapper script for func_source use:
9499 func_ltwrapper_scriptname $cwrapper
9500 $RM $func_ltwrapper_scriptname_result
9501 trap "$RM $func_ltwrapper_scriptname_result; exit $EXIT_FAILURE" 1 2 15
9502 $opt_dry_run || {
9503 # note: this script will not be executed, so do not chmod.
9504 if test "x$build" = "x$host" ; then
9505 $cwrapper --lt-dump-script > $func_ltwrapper_scriptname_result
9506 else
9507 func_emit_wrapper no > $func_ltwrapper_scriptname_result
9508 fi
9509 }
9510 ;;
9511 * )
9512 $RM $output
9513 trap "$RM $output; exit $EXIT_FAILURE" 1 2 15
9514
9515 func_emit_wrapper no > $output
9516 chmod +x $output
9517 ;;
9518 esac
9519 }
9520 exit $EXIT_SUCCESS
9521 ;;
9522 esac
9523
9524 # See if we need to build an old-fashioned archive.
9525 for oldlib in $oldlibs; do
9526
9527 if test "$build_libtool_libs" = convenience; then
9528 oldobjs="$libobjs_save $symfileobj"
9529 addlibs="$convenience"
9530 build_libtool_libs=no
9531 else
9532 if test "$build_libtool_libs" = module; then
9533 oldobjs="$libobjs_save"
9534 build_libtool_libs=no
9535 else
9536 oldobjs="$old_deplibs $non_pic_objects"
9537 if test "$preload" = yes && test -f "$symfileobj"; then
cristyda16f162011-02-19 23:52:17 +00009538 oldobjs+=" $symfileobj"
cristy3ed852e2009-09-05 21:47:34 +00009539 fi
9540 fi
9541 addlibs="$old_convenience"
9542 fi
9543
9544 if test -n "$addlibs"; then
9545 gentop="$output_objdir/${outputname}x"
cristyda16f162011-02-19 23:52:17 +00009546 generated+=" $gentop"
cristy3ed852e2009-09-05 21:47:34 +00009547
9548 func_extract_archives $gentop $addlibs
cristyda16f162011-02-19 23:52:17 +00009549 oldobjs+=" $func_extract_archives_result"
cristy3ed852e2009-09-05 21:47:34 +00009550 fi
9551
9552 # Do each command in the archive commands.
9553 if test -n "$old_archive_from_new_cmds" && test "$build_libtool_libs" = yes; then
9554 cmds=$old_archive_from_new_cmds
9555 else
9556
9557 # Add any objects from preloaded convenience libraries
9558 if test -n "$dlprefiles"; then
9559 gentop="$output_objdir/${outputname}x"
cristyda16f162011-02-19 23:52:17 +00009560 generated+=" $gentop"
cristy3ed852e2009-09-05 21:47:34 +00009561
9562 func_extract_archives $gentop $dlprefiles
cristyda16f162011-02-19 23:52:17 +00009563 oldobjs+=" $func_extract_archives_result"
cristy3ed852e2009-09-05 21:47:34 +00009564 fi
9565
9566 # POSIX demands no paths to be encoded in archives. We have
9567 # to avoid creating archives with duplicate basenames if we
9568 # might have to extract them afterwards, e.g., when creating a
9569 # static archive out of a convenience library, or when linking
9570 # the entirety of a libtool archive into another (currently
9571 # not supported by libtool).
9572 if (for obj in $oldobjs
9573 do
9574 func_basename "$obj"
9575 $ECHO "$func_basename_result"
9576 done | sort | sort -uc >/dev/null 2>&1); then
9577 :
9578 else
cristy98dddb52010-11-04 00:30:15 +00009579 echo "copying selected object files to avoid basename conflicts..."
cristy3ed852e2009-09-05 21:47:34 +00009580 gentop="$output_objdir/${outputname}x"
cristyda16f162011-02-19 23:52:17 +00009581 generated+=" $gentop"
cristy3ed852e2009-09-05 21:47:34 +00009582 func_mkdir_p "$gentop"
9583 save_oldobjs=$oldobjs
9584 oldobjs=
9585 counter=1
9586 for obj in $save_oldobjs
9587 do
9588 func_basename "$obj"
9589 objbase="$func_basename_result"
9590 case " $oldobjs " in
9591 " ") oldobjs=$obj ;;
9592 *[\ /]"$objbase "*)
9593 while :; do
9594 # Make sure we don't pick an alternate name that also
9595 # overlaps.
9596 newobj=lt$counter-$objbase
9597 func_arith $counter + 1
9598 counter=$func_arith_result
9599 case " $oldobjs " in
9600 *[\ /]"$newobj "*) ;;
9601 *) if test ! -f "$gentop/$newobj"; then break; fi ;;
9602 esac
9603 done
9604 func_show_eval "ln $obj $gentop/$newobj || cp $obj $gentop/$newobj"
cristyda16f162011-02-19 23:52:17 +00009605 oldobjs+=" $gentop/$newobj"
cristy3ed852e2009-09-05 21:47:34 +00009606 ;;
cristyda16f162011-02-19 23:52:17 +00009607 *) oldobjs+=" $obj" ;;
cristy3ed852e2009-09-05 21:47:34 +00009608 esac
9609 done
9610 fi
cristy2542fc62011-12-06 17:50:25 +00009611 func_to_tool_file "$oldlib" func_convert_file_msys_to_w32
9612 tool_oldlib=$func_to_tool_file_result
cristy3ed852e2009-09-05 21:47:34 +00009613 eval cmds=\"$old_archive_cmds\"
9614
9615 func_len " $cmds"
9616 len=$func_len_result
9617 if test "$len" -lt "$max_cmd_len" || test "$max_cmd_len" -le -1; then
9618 cmds=$old_archive_cmds
cristyda16f162011-02-19 23:52:17 +00009619 elif test -n "$archiver_list_spec"; then
9620 func_verbose "using command file archive linking..."
9621 for obj in $oldobjs
9622 do
9623 func_to_tool_file "$obj"
9624 $ECHO "$func_to_tool_file_result"
9625 done > $output_objdir/$libname.libcmd
9626 func_to_tool_file "$output_objdir/$libname.libcmd"
9627 oldobjs=" $archiver_list_spec$func_to_tool_file_result"
9628 cmds=$old_archive_cmds
cristy3ed852e2009-09-05 21:47:34 +00009629 else
9630 # the command line is too long to link in one step, link in parts
9631 func_verbose "using piecewise archive linking..."
9632 save_RANLIB=$RANLIB
9633 RANLIB=:
9634 objlist=
9635 concat_cmds=
9636 save_oldobjs=$oldobjs
9637 oldobjs=
9638 # Is there a better way of finding the last object in the list?
9639 for obj in $save_oldobjs
9640 do
9641 last_oldobj=$obj
9642 done
9643 eval test_cmds=\"$old_archive_cmds\"
9644 func_len " $test_cmds"
9645 len0=$func_len_result
9646 len=$len0
9647 for obj in $save_oldobjs
9648 do
9649 func_len " $obj"
9650 func_arith $len + $func_len_result
9651 len=$func_arith_result
cristyda16f162011-02-19 23:52:17 +00009652 objlist+=" $obj"
cristy3ed852e2009-09-05 21:47:34 +00009653 if test "$len" -lt "$max_cmd_len"; then
9654 :
9655 else
9656 # the above command should be used before it gets too long
9657 oldobjs=$objlist
9658 if test "$obj" = "$last_oldobj" ; then
9659 RANLIB=$save_RANLIB
9660 fi
9661 test -z "$concat_cmds" || concat_cmds=$concat_cmds~
9662 eval concat_cmds=\"\${concat_cmds}$old_archive_cmds\"
9663 objlist=
9664 len=$len0
9665 fi
9666 done
9667 RANLIB=$save_RANLIB
9668 oldobjs=$objlist
9669 if test "X$oldobjs" = "X" ; then
9670 eval cmds=\"\$concat_cmds\"
9671 else
9672 eval cmds=\"\$concat_cmds~\$old_archive_cmds\"
9673 fi
9674 fi
9675 fi
9676 func_execute_cmds "$cmds" 'exit $?'
9677 done
9678
9679 test -n "$generated" && \
9680 func_show_eval "${RM}r$generated"
9681
9682 # Now create the libtool archive.
9683 case $output in
9684 *.la)
9685 old_library=
9686 test "$build_old_libs" = yes && old_library="$libname.$libext"
9687 func_verbose "creating $output"
9688
9689 # Preserve any variables that may affect compiler behavior
9690 for var in $variables_saved_for_relink; do
9691 if eval test -z \"\${$var+set}\"; then
9692 relink_command="{ test -z \"\${$var+set}\" || $lt_unset $var || { $var=; export $var; }; }; $relink_command"
9693 elif eval var_value=\$$var; test -z "$var_value"; then
9694 relink_command="$var=; export $var; $relink_command"
9695 else
9696 func_quote_for_eval "$var_value"
9697 relink_command="$var=$func_quote_for_eval_result; export $var; $relink_command"
9698 fi
9699 done
9700 # Quote the link command for shipping.
9701 relink_command="(cd `pwd`; $SHELL $progpath $preserve_args --mode=relink $libtool_args @inst_prefix_dir@)"
cristy98dddb52010-11-04 00:30:15 +00009702 relink_command=`$ECHO "$relink_command" | $SED "$sed_quote_subst"`
cristy3ed852e2009-09-05 21:47:34 +00009703 if test "$hardcode_automatic" = yes ; then
9704 relink_command=
9705 fi
9706
9707 # Only create the output if not a dry run.
9708 $opt_dry_run || {
9709 for installed in no yes; do
9710 if test "$installed" = yes; then
9711 if test -z "$install_libdir"; then
9712 break
9713 fi
9714 output="$output_objdir/$outputname"i
9715 # Replace all uninstalled libtool libraries with the installed ones
9716 newdependency_libs=
9717 for deplib in $dependency_libs; do
9718 case $deplib in
9719 *.la)
9720 func_basename "$deplib"
9721 name="$func_basename_result"
cristy2542fc62011-12-06 17:50:25 +00009722 func_resolve_sysroot "$deplib"
9723 eval libdir=`${SED} -n -e 's/^libdir=\(.*\)$/\1/p' $func_resolve_sysroot_result`
cristy3ed852e2009-09-05 21:47:34 +00009724 test -z "$libdir" && \
9725 func_fatal_error "\`$deplib' is not a valid libtool archive"
cristyda16f162011-02-19 23:52:17 +00009726 newdependency_libs+=" ${lt_sysroot:+=}$libdir/$name"
cristy3ed852e2009-09-05 21:47:34 +00009727 ;;
cristyda16f162011-02-19 23:52:17 +00009728 -L*)
9729 func_stripname -L '' "$deplib"
9730 func_replace_sysroot "$func_stripname_result"
9731 newdependency_libs+=" -L$func_replace_sysroot_result"
9732 ;;
9733 -R*)
9734 func_stripname -R '' "$deplib"
9735 func_replace_sysroot "$func_stripname_result"
9736 newdependency_libs+=" -R$func_replace_sysroot_result"
9737 ;;
9738 *) newdependency_libs+=" $deplib" ;;
cristy3ed852e2009-09-05 21:47:34 +00009739 esac
9740 done
9741 dependency_libs="$newdependency_libs"
9742 newdlfiles=
9743
9744 for lib in $dlfiles; do
9745 case $lib in
9746 *.la)
9747 func_basename "$lib"
9748 name="$func_basename_result"
9749 eval libdir=`${SED} -n -e 's/^libdir=\(.*\)$/\1/p' $lib`
9750 test -z "$libdir" && \
9751 func_fatal_error "\`$lib' is not a valid libtool archive"
cristyda16f162011-02-19 23:52:17 +00009752 newdlfiles+=" ${lt_sysroot:+=}$libdir/$name"
cristy3ed852e2009-09-05 21:47:34 +00009753 ;;
cristyda16f162011-02-19 23:52:17 +00009754 *) newdlfiles+=" $lib" ;;
cristy3ed852e2009-09-05 21:47:34 +00009755 esac
9756 done
9757 dlfiles="$newdlfiles"
9758 newdlprefiles=
9759 for lib in $dlprefiles; do
9760 case $lib in
9761 *.la)
9762 # Only pass preopened files to the pseudo-archive (for
9763 # eventual linking with the app. that links it) if we
9764 # didn't already link the preopened objects directly into
9765 # the library:
9766 func_basename "$lib"
9767 name="$func_basename_result"
9768 eval libdir=`${SED} -n -e 's/^libdir=\(.*\)$/\1/p' $lib`
9769 test -z "$libdir" && \
9770 func_fatal_error "\`$lib' is not a valid libtool archive"
cristyda16f162011-02-19 23:52:17 +00009771 newdlprefiles+=" ${lt_sysroot:+=}$libdir/$name"
cristy3ed852e2009-09-05 21:47:34 +00009772 ;;
9773 esac
9774 done
9775 dlprefiles="$newdlprefiles"
9776 else
9777 newdlfiles=
9778 for lib in $dlfiles; do
9779 case $lib in
9780 [\\/]* | [A-Za-z]:[\\/]*) abs="$lib" ;;
9781 *) abs=`pwd`"/$lib" ;;
9782 esac
cristyda16f162011-02-19 23:52:17 +00009783 newdlfiles+=" $abs"
cristy3ed852e2009-09-05 21:47:34 +00009784 done
9785 dlfiles="$newdlfiles"
9786 newdlprefiles=
9787 for lib in $dlprefiles; do
9788 case $lib in
9789 [\\/]* | [A-Za-z]:[\\/]*) abs="$lib" ;;
9790 *) abs=`pwd`"/$lib" ;;
9791 esac
cristyda16f162011-02-19 23:52:17 +00009792 newdlprefiles+=" $abs"
cristy3ed852e2009-09-05 21:47:34 +00009793 done
9794 dlprefiles="$newdlprefiles"
9795 fi
9796 $RM $output
9797 # place dlname in correct position for cygwin
cristy98dddb52010-11-04 00:30:15 +00009798 # In fact, it would be nice if we could use this code for all target
9799 # systems that can't hard-code library paths into their executables
9800 # and that have no shared library path variable independent of PATH,
9801 # but it turns out we can't easily determine that from inspecting
9802 # libtool variables, so we have to hard-code the OSs to which it
9803 # applies here; at the moment, that means platforms that use the PE
9804 # object format with DLL files. See the long comment at the top of
9805 # tests/bindir.at for full details.
cristy3ed852e2009-09-05 21:47:34 +00009806 tdlname=$dlname
9807 case $host,$output,$installed,$module,$dlname in
cristy98dddb52010-11-04 00:30:15 +00009808 *cygwin*,*lai,yes,no,*.dll | *mingw*,*lai,yes,no,*.dll | *cegcc*,*lai,yes,no,*.dll)
9809 # If a -bindir argument was supplied, place the dll there.
9810 if test "x$bindir" != x ;
9811 then
9812 func_relative_path "$install_libdir" "$bindir"
9813 tdlname=$func_relative_path_result$dlname
9814 else
9815 # Otherwise fall back on heuristic.
9816 tdlname=../bin/$dlname
9817 fi
9818 ;;
cristy3ed852e2009-09-05 21:47:34 +00009819 esac
9820 $ECHO > $output "\
9821# $outputname - a libtool library file
9822# Generated by $PROGRAM (GNU $PACKAGE$TIMESTAMP) $VERSION
9823#
9824# Please DO NOT delete this file!
9825# It is necessary for linking the library.
9826
9827# The name that we can dlopen(3).
9828dlname='$tdlname'
9829
9830# Names of this library.
9831library_names='$library_names'
9832
9833# The name of the static archive.
9834old_library='$old_library'
9835
9836# Linker flags that can not go in dependency_libs.
9837inherited_linker_flags='$new_inherited_linker_flags'
9838
9839# Libraries that this one depends upon.
9840dependency_libs='$dependency_libs'
9841
9842# Names of additional weak libraries provided by this library
9843weak_library_names='$weak_libs'
9844
9845# Version information for $libname.
9846current=$current
9847age=$age
9848revision=$revision
9849
9850# Is this an already installed library?
9851installed=$installed
9852
9853# Should we warn about portability when linking against -modules?
9854shouldnotlink=$module
9855
9856# Files to dlopen/dlpreopen
9857dlopen='$dlfiles'
9858dlpreopen='$dlprefiles'
9859
9860# Directory that this library needs to be installed in:
9861libdir='$install_libdir'"
9862 if test "$installed" = no && test "$need_relink" = yes; then
9863 $ECHO >> $output "\
9864relink_command=\"$relink_command\""
9865 fi
9866 done
9867 }
9868
9869 # Do a symbolic link so that the libtool archive can be found in
9870 # LD_LIBRARY_PATH before the program is installed.
9871 func_show_eval '( cd "$output_objdir" && $RM "$outputname" && $LN_S "../$outputname" "$outputname" )' 'exit $?'
9872 ;;
9873 esac
9874 exit $EXIT_SUCCESS
9875}
9876
cristyda16f162011-02-19 23:52:17 +00009877{ test "$opt_mode" = link || test "$opt_mode" = relink; } &&
cristy3ed852e2009-09-05 21:47:34 +00009878 func_mode_link ${1+"$@"}
9879
9880
9881# func_mode_uninstall arg...
9882func_mode_uninstall ()
9883{
9884 $opt_debug
9885 RM="$nonopt"
9886 files=
9887 rmforce=
9888 exit_status=0
9889
9890 # This variable tells wrapper scripts just to set variables rather
9891 # than running their programs.
9892 libtool_install_magic="$magic"
9893
9894 for arg
9895 do
9896 case $arg in
cristyda16f162011-02-19 23:52:17 +00009897 -f) RM+=" $arg"; rmforce=yes ;;
9898 -*) RM+=" $arg" ;;
9899 *) files+=" $arg" ;;
cristy3ed852e2009-09-05 21:47:34 +00009900 esac
9901 done
9902
9903 test -z "$RM" && \
9904 func_fatal_help "you must specify an RM program"
9905
9906 rmdirs=
9907
cristy3ed852e2009-09-05 21:47:34 +00009908 for file in $files; do
9909 func_dirname "$file" "" "."
9910 dir="$func_dirname_result"
9911 if test "X$dir" = X.; then
cristyda16f162011-02-19 23:52:17 +00009912 odir="$objdir"
cristy3ed852e2009-09-05 21:47:34 +00009913 else
cristyda16f162011-02-19 23:52:17 +00009914 odir="$dir/$objdir"
cristy3ed852e2009-09-05 21:47:34 +00009915 fi
9916 func_basename "$file"
9917 name="$func_basename_result"
cristyda16f162011-02-19 23:52:17 +00009918 test "$opt_mode" = uninstall && odir="$dir"
cristy3ed852e2009-09-05 21:47:34 +00009919
cristyda16f162011-02-19 23:52:17 +00009920 # Remember odir for removal later, being careful to avoid duplicates
9921 if test "$opt_mode" = clean; then
cristy3ed852e2009-09-05 21:47:34 +00009922 case " $rmdirs " in
cristyda16f162011-02-19 23:52:17 +00009923 *" $odir "*) ;;
9924 *) rmdirs+=" $odir" ;;
cristy3ed852e2009-09-05 21:47:34 +00009925 esac
9926 fi
9927
9928 # Don't error if the file doesn't exist and rm -f was used.
9929 if { test -L "$file"; } >/dev/null 2>&1 ||
9930 { test -h "$file"; } >/dev/null 2>&1 ||
9931 test -f "$file"; then
9932 :
9933 elif test -d "$file"; then
9934 exit_status=1
9935 continue
9936 elif test "$rmforce" = yes; then
9937 continue
9938 fi
9939
9940 rmfiles="$file"
9941
9942 case $name in
9943 *.la)
9944 # Possibly a libtool archive, so verify it.
9945 if func_lalib_p "$file"; then
9946 func_source $dir/$name
9947
9948 # Delete the libtool libraries and symlinks.
9949 for n in $library_names; do
cristyda16f162011-02-19 23:52:17 +00009950 rmfiles+=" $odir/$n"
cristy3ed852e2009-09-05 21:47:34 +00009951 done
cristyda16f162011-02-19 23:52:17 +00009952 test -n "$old_library" && rmfiles+=" $odir/$old_library"
cristy3ed852e2009-09-05 21:47:34 +00009953
cristyda16f162011-02-19 23:52:17 +00009954 case "$opt_mode" in
cristy3ed852e2009-09-05 21:47:34 +00009955 clean)
cristyda16f162011-02-19 23:52:17 +00009956 case " $library_names " in
cristy3ed852e2009-09-05 21:47:34 +00009957 *" $dlname "*) ;;
cristyda16f162011-02-19 23:52:17 +00009958 *) test -n "$dlname" && rmfiles+=" $odir/$dlname" ;;
cristy3ed852e2009-09-05 21:47:34 +00009959 esac
cristyda16f162011-02-19 23:52:17 +00009960 test -n "$libdir" && rmfiles+=" $odir/$name $odir/${name}i"
cristy3ed852e2009-09-05 21:47:34 +00009961 ;;
9962 uninstall)
9963 if test -n "$library_names"; then
9964 # Do each command in the postuninstall commands.
9965 func_execute_cmds "$postuninstall_cmds" 'test "$rmforce" = yes || exit_status=1'
9966 fi
9967
9968 if test -n "$old_library"; then
9969 # Do each command in the old_postuninstall commands.
9970 func_execute_cmds "$old_postuninstall_cmds" 'test "$rmforce" = yes || exit_status=1'
9971 fi
9972 # FIXME: should reinstall the best remaining shared library.
9973 ;;
9974 esac
9975 fi
9976 ;;
9977
9978 *.lo)
9979 # Possibly a libtool object, so verify it.
9980 if func_lalib_p "$file"; then
9981
9982 # Read the .lo file
9983 func_source $dir/$name
9984
9985 # Add PIC object to the list of files to remove.
9986 if test -n "$pic_object" &&
9987 test "$pic_object" != none; then
cristyda16f162011-02-19 23:52:17 +00009988 rmfiles+=" $dir/$pic_object"
cristy3ed852e2009-09-05 21:47:34 +00009989 fi
9990
9991 # Add non-PIC object to the list of files to remove.
9992 if test -n "$non_pic_object" &&
9993 test "$non_pic_object" != none; then
cristyda16f162011-02-19 23:52:17 +00009994 rmfiles+=" $dir/$non_pic_object"
cristy3ed852e2009-09-05 21:47:34 +00009995 fi
9996 fi
9997 ;;
9998
9999 *)
cristyda16f162011-02-19 23:52:17 +000010000 if test "$opt_mode" = clean ; then
cristy3ed852e2009-09-05 21:47:34 +000010001 noexename=$name
10002 case $file in
10003 *.exe)
10004 func_stripname '' '.exe' "$file"
10005 file=$func_stripname_result
10006 func_stripname '' '.exe' "$name"
10007 noexename=$func_stripname_result
10008 # $file with .exe has already been added to rmfiles,
10009 # add $file without .exe
cristyda16f162011-02-19 23:52:17 +000010010 rmfiles+=" $file"
cristy3ed852e2009-09-05 21:47:34 +000010011 ;;
10012 esac
10013 # Do a test to see if this is a libtool program.
10014 if func_ltwrapper_p "$file"; then
10015 if func_ltwrapper_executable_p "$file"; then
10016 func_ltwrapper_scriptname "$file"
10017 relink_command=
10018 func_source $func_ltwrapper_scriptname_result
cristyda16f162011-02-19 23:52:17 +000010019 rmfiles+=" $func_ltwrapper_scriptname_result"
cristy3ed852e2009-09-05 21:47:34 +000010020 else
10021 relink_command=
10022 func_source $dir/$noexename
10023 fi
10024
10025 # note $name still contains .exe if it was in $file originally
10026 # as does the version of $file that was added into $rmfiles
cristyda16f162011-02-19 23:52:17 +000010027 rmfiles+=" $odir/$name $odir/${name}S.${objext}"
cristy3ed852e2009-09-05 21:47:34 +000010028 if test "$fast_install" = yes && test -n "$relink_command"; then
cristyda16f162011-02-19 23:52:17 +000010029 rmfiles+=" $odir/lt-$name"
cristy3ed852e2009-09-05 21:47:34 +000010030 fi
10031 if test "X$noexename" != "X$name" ; then
cristyda16f162011-02-19 23:52:17 +000010032 rmfiles+=" $odir/lt-${noexename}.c"
cristy3ed852e2009-09-05 21:47:34 +000010033 fi
10034 fi
10035 fi
10036 ;;
10037 esac
10038 func_show_eval "$RM $rmfiles" 'exit_status=1'
10039 done
cristy3ed852e2009-09-05 21:47:34 +000010040
10041 # Try to remove the ${objdir}s in the directories where we deleted files
10042 for dir in $rmdirs; do
10043 if test -d "$dir"; then
10044 func_show_eval "rmdir $dir >/dev/null 2>&1"
10045 fi
10046 done
10047
10048 exit $exit_status
10049}
10050
cristyda16f162011-02-19 23:52:17 +000010051{ test "$opt_mode" = uninstall || test "$opt_mode" = clean; } &&
cristy3ed852e2009-09-05 21:47:34 +000010052 func_mode_uninstall ${1+"$@"}
10053
cristyda16f162011-02-19 23:52:17 +000010054test -z "$opt_mode" && {
cristy3ed852e2009-09-05 21:47:34 +000010055 help="$generic_help"
10056 func_fatal_help "you must specify a MODE"
10057}
10058
10059test -z "$exec_cmd" && \
cristyda16f162011-02-19 23:52:17 +000010060 func_fatal_help "invalid operation mode \`$opt_mode'"
cristy3ed852e2009-09-05 21:47:34 +000010061
10062if test -n "$exec_cmd"; then
10063 eval exec "$exec_cmd"
10064 exit $EXIT_FAILURE
10065fi
10066
10067exit $exit_status
10068
10069
10070# The TAGs below are defined such that we never get into a situation
10071# in which we disable both kinds of libraries. Given conflicting
10072# choices, we go for a static library, that is the most portable,
10073# since we can't tell whether shared libraries were disabled because
10074# the user asked for that or because the platform doesn't support
10075# them. This is particularly important on AIX, because we don't
10076# support having both static and shared libraries enabled at the same
10077# time on that platform, so we default to a shared-only configuration.
10078# If a disable-shared tag is given, we'll fallback to a static-only
10079# configuration. But we'll never go from static-only to shared-only.
10080
10081# ### BEGIN LIBTOOL TAG CONFIG: disable-shared
10082build_libtool_libs=no
10083build_old_libs=yes
10084# ### END LIBTOOL TAG CONFIG: disable-shared
10085
10086# ### BEGIN LIBTOOL TAG CONFIG: disable-static
10087build_old_libs=`case $build_libtool_libs in yes) echo no;; *) echo yes;; esac`
10088# ### END LIBTOOL TAG CONFIG: disable-static
10089
10090# Local Variables:
10091# mode:shell-script
10092# sh-indentation:2
10093# End:
10094# vi:sw=2
10095
10096
10097# ### BEGIN LIBTOOL TAG CONFIG: CXX
10098
10099# The linker used to build libraries.
nicolas6237c462010-10-05 06:11:49 +000010100LD="/usr/bin/ld -m elf_x86_64"
cristy3ed852e2009-09-05 21:47:34 +000010101
cristy0c60a692010-11-04 01:09:47 +000010102# How to create reloadable object files.
10103reload_flag=" -r"
10104reload_cmds="\$LD\$reload_flag -o \$output\$reload_objs"
10105
cristy3ed852e2009-09-05 21:47:34 +000010106# Commands used to build an old-style archive.
10107old_archive_cmds="\$AR \$AR_FLAGS \$oldlib\$oldobjs~\$RANLIB \$oldlib"
10108
10109# A language specific compiler.
nicolas6237c462010-10-05 06:11:49 +000010110CC="g++"
cristy3ed852e2009-09-05 21:47:34 +000010111
10112# Is the compiler the GNU compiler?
nicolas6237c462010-10-05 06:11:49 +000010113with_gcc=yes
cristy3ed852e2009-09-05 21:47:34 +000010114
10115# Compiler flag to turn off builtin functions.
nicolas6237c462010-10-05 06:11:49 +000010116no_builtin_flag=" -fno-builtin"
cristy3ed852e2009-09-05 21:47:34 +000010117
cristy3ed852e2009-09-05 21:47:34 +000010118# Additional compiler flags for building library objects.
nicolas6237c462010-10-05 06:11:49 +000010119pic_flag=" -fPIC -DPIC"
cristy3ed852e2009-09-05 21:47:34 +000010120
cristyda16f162011-02-19 23:52:17 +000010121# How to pass a linker flag through the compiler.
10122wl="-Wl,"
10123
cristy3ed852e2009-09-05 21:47:34 +000010124# Compiler flag to prevent dynamic linking.
cristyae56d442011-05-10 21:10:20 +000010125link_static_flag=""
cristy3ed852e2009-09-05 21:47:34 +000010126
10127# Does compiler simultaneously support -c and -o options?
nicolas6237c462010-10-05 06:11:49 +000010128compiler_c_o="yes"
cristy3ed852e2009-09-05 21:47:34 +000010129
10130# Whether or not to add -lc for building shared libraries.
10131build_libtool_need_lc=no
10132
10133# Whether or not to disallow shared libs when runtime libs are static.
10134allow_libtool_libs_with_static_runtimes=no
10135
10136# Compiler flag to allow reflexive dlopens.
nicolas6237c462010-10-05 06:11:49 +000010137export_dynamic_flag_spec="\${wl}--export-dynamic"
cristy3ed852e2009-09-05 21:47:34 +000010138
10139# Compiler flag to generate shared objects directly from archives.
nicolas6237c462010-10-05 06:11:49 +000010140whole_archive_flag_spec="\${wl}--whole-archive\$convenience \${wl}--no-whole-archive"
cristy3ed852e2009-09-05 21:47:34 +000010141
10142# Whether the compiler copes with passing no objects directly.
10143compiler_needs_object="no"
10144
10145# Create an old-style archive from a shared archive.
10146old_archive_from_new_cmds=""
10147
10148# Create a temporary old-style archive to link instead of a shared archive.
10149old_archive_from_expsyms_cmds=""
10150
10151# Commands used to build a shared archive.
cristyda16f162011-02-19 23:52:17 +000010152archive_cmds="\$CC \$pic_flag -shared -nostdlib \$predep_objects \$libobjs \$deplibs \$postdep_objects \$compiler_flags \${wl}-soname \$wl\$soname -o \$lib"
10153archive_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 +000010154
10155# Commands used to build a loadable module if different from building
10156# a shared archive.
10157module_cmds=""
10158module_expsym_cmds=""
10159
10160# Whether we are building with GNU ld or not.
nicolas6237c462010-10-05 06:11:49 +000010161with_gnu_ld="yes"
cristy3ed852e2009-09-05 21:47:34 +000010162
10163# Flag that allows shared libraries with undefined symbols to be built.
10164allow_undefined_flag=""
10165
10166# Flag that enforces no undefined symbols.
10167no_undefined_flag=""
10168
10169# Flag to hardcode $libdir into a binary during linking.
10170# This must work even if $libdir does not exist
nicolas6237c462010-10-05 06:11:49 +000010171hardcode_libdir_flag_spec="\${wl}-rpath \${wl}\$libdir"
cristy3ed852e2009-09-05 21:47:34 +000010172
10173# If ld is used when linking, flag to hardcode $libdir into a binary
10174# during linking. This must work even if $libdir does not exist.
10175hardcode_libdir_flag_spec_ld=""
10176
10177# Whether we need a single "-rpath" flag with a separated argument.
10178hardcode_libdir_separator=""
10179
10180# Set to "yes" if using DIR/libNAME${shared_ext} during linking hardcodes
10181# DIR into the resulting binary.
10182hardcode_direct=no
10183
10184# Set to "yes" if using DIR/libNAME${shared_ext} during linking hardcodes
10185# DIR into the resulting binary and the resulting library dependency is
10186# "absolute",i.e impossible to change by setting ${shlibpath_var} if the
10187# library is relocated.
10188hardcode_direct_absolute=no
10189
10190# Set to "yes" if using the -LDIR flag during linking hardcodes DIR
10191# into the resulting binary.
10192hardcode_minus_L=no
10193
10194# Set to "yes" if using SHLIBPATH_VAR=DIR during linking hardcodes DIR
10195# into the resulting binary.
10196hardcode_shlibpath_var=unsupported
10197
10198# Set to "yes" if building a shared library automatically hardcodes DIR
10199# into the library and all subsequent libraries and executables linked
10200# against it.
10201hardcode_automatic=no
10202
10203# Set to yes if linker adds runtime paths of dependent libraries
10204# to runtime path list.
10205inherit_rpath=no
10206
10207# Whether libtool must link a program against all its dependency libraries.
10208link_all_deplibs=unknown
10209
cristy3ed852e2009-09-05 21:47:34 +000010210# Set to "yes" if exported symbols are required.
10211always_export_symbols=no
10212
10213# The commands to list exported symbols.
nicolas6237c462010-10-05 06:11:49 +000010214export_symbols_cmds="\$NM \$libobjs \$convenience | \$global_symbol_pipe | \$SED 's/.* //' | sort | uniq > \$export_symbols"
cristy3ed852e2009-09-05 21:47:34 +000010215
10216# Symbols that should not be listed in the preloaded symbols.
nicolas6237c462010-10-05 06:11:49 +000010217exclude_expsyms="_GLOBAL_OFFSET_TABLE_|_GLOBAL__F[ID]_.*"
cristy3ed852e2009-09-05 21:47:34 +000010218
10219# Symbols that must always be exported.
10220include_expsyms=""
10221
10222# Commands necessary for linking programs (against libraries) with templates.
10223prelink_cmds=""
10224
cristyda16f162011-02-19 23:52:17 +000010225# Commands necessary for finishing linking programs.
10226postlink_cmds=""
10227
cristy3ed852e2009-09-05 21:47:34 +000010228# Specify filename containing input files.
10229file_list_spec=""
10230
10231# How to hardcode a shared library path into an executable.
nicolas6237c462010-10-05 06:11:49 +000010232hardcode_action=immediate
cristy3ed852e2009-09-05 21:47:34 +000010233
10234# The directories searched by this compiler when creating a shared library.
cristya44f6232011-10-30 00:20:44 +000010235compiler_lib_search_dirs="/usr/lib/gcc/x86_64-redhat-linux/4.6.2 /usr/lib/gcc/x86_64-redhat-linux/4.6.2/../../../../lib64 /lib/../lib64 /usr/lib/../lib64 /usr/lib/gcc/x86_64-redhat-linux/4.6.2/../../.."
cristy3ed852e2009-09-05 21:47:34 +000010236
10237# Dependencies to place before and after the objects being linked to
10238# create a shared library.
cristya44f6232011-10-30 00:20:44 +000010239predep_objects="/usr/lib/gcc/x86_64-redhat-linux/4.6.2/../../../../lib64/crti.o /usr/lib/gcc/x86_64-redhat-linux/4.6.2/crtbeginS.o"
10240postdep_objects="/usr/lib/gcc/x86_64-redhat-linux/4.6.2/crtendS.o /usr/lib/gcc/x86_64-redhat-linux/4.6.2/../../../../lib64/crtn.o"
cristy3ed852e2009-09-05 21:47:34 +000010241predeps=""
cristyb1860752011-03-14 00:27:46 +000010242postdeps="-lstdc++ -lm -lgcc_s -lpthread -lc -lgcc_s"
cristy3ed852e2009-09-05 21:47:34 +000010243
10244# The library search path used internally by the compiler when linking
10245# a shared library.
cristya44f6232011-10-30 00:20:44 +000010246compiler_lib_search_path="-L/usr/lib/gcc/x86_64-redhat-linux/4.6.2 -L/usr/lib/gcc/x86_64-redhat-linux/4.6.2/../../../../lib64 -L/lib/../lib64 -L/usr/lib/../lib64 -L/usr/lib/gcc/x86_64-redhat-linux/4.6.2/../../.."
cristy3ed852e2009-09-05 21:47:34 +000010247
10248# ### END LIBTOOL TAG CONFIG: CXX