blob: c22881cc3a1679cf5ea6e511db2dc7f103cfdf5e [file] [log] [blame]
cristyde8bd6e2010-09-21 15:34:51 +00001#! /bin/sh
cristy3ed852e2009-09-05 21:47:34 +00002
3# libtool - Provide generalized library-building support services.
cristyd0bda5e2010-09-21 16:22:45 +00004# Generated automatically by config.status (ImageMagick) 6.6.4-6
cristyde8bd6e2010-09-21 15:34:51 +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,
cristyfd9dcd42010-08-08 18:07:02 +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
cristyfd9dcd42010-08-08 18:07:02 +000057# Shell to use when invoking shell scripts.
cristyde8bd6e2010-09-21 15:34:51 +000058SHELL="/bin/sh"
cristyfd9dcd42010-08-08 18:07:02 +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?
cristyfd9dcd42010-08-08 18:07:02 +000064macro_version=2.2.10
65macro_revision=1.3175
cristy3ed852e2009-09-05 21:47:34 +000066
67# Assembler program.
cristyfd9dcd42010-08-08 18:07:02 +000068AS="as"
cristy3ed852e2009-09-05 21:47:34 +000069
70# DLL creation program.
cristyfd9dcd42010-08-08 18:07:02 +000071DLLTOOL="dlltool"
cristy3ed852e2009-09-05 21:47:34 +000072
73# Object dumper program.
cristyfd9dcd42010-08-08 18:07:02 +000074OBJDUMP="objdump"
cristy3ed852e2009-09-05 21:47:34 +000075
76# Whether or not to build shared libraries.
cristy40e685d2010-04-23 14:44:08 +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.
cristy40e685d2010-04-23 14:44:08 +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?
cristyde8bd6e2010-09-21 15:34:51 +0000105max_cmd_len=1966080
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
cristy3ed852e2009-09-05 21:47:34 +0000122# Method to check whether dependent libraries are shared objects.
123deplibs_check_method="pass_all"
124
125# Command to use when deplibs_check_method == "file_magic".
126file_magic_cmd="\$MAGIC_CMD"
127
128# The archiver.
129AR="ar"
130AR_FLAGS="cru"
131
132# A symbol stripping program.
133STRIP="strip"
134
135# Commands used to install an old-style archive.
136RANLIB="ranlib"
137old_postinstall_cmds="chmod 644 \$oldlib~\$RANLIB \$oldlib"
138old_postuninstall_cmds=""
139
cristyfd9dcd42010-08-08 18:07:02 +0000140# Whether to use a lock for old archive extraction.
141lock_old_archive_extraction=no
142
cristy3ed852e2009-09-05 21:47:34 +0000143# A C compiler.
cristy40e685d2010-04-23 14:44:08 +0000144LTCC="gcc -std=gnu99 -std=gnu99"
cristy3ed852e2009-09-05 21:47:34 +0000145
146# LTCC compiler flags.
cristy55bf91c2010-09-24 00:29:41 +0000147LTCFLAGS="-fopenmp -g -O2 -Wall -pthread"
cristy3ed852e2009-09-05 21:47:34 +0000148
149# Take the output of nm and produce a listing of raw symbols and C names.
150global_symbol_pipe="sed -n -e 's/^.*[ ]\\([ABCDGIRSTW][ABCDGIRSTW]*\\)[ ][ ]*\\([_A-Za-z][_A-Za-z0-9]*\\)\$/\\1 \\2 \\2/p'"
151
152# Transform the output of nm in a proper C declaration.
153global_symbol_to_cdecl="sed -n -e 's/^T .* \\(.*\\)\$/extern int \\1();/p' -e 's/^[ABCDGIRSTW]* .* \\(.*\\)\$/extern char \\1;/p'"
154
155# Transform the output of nm in a C name address pair.
156global_symbol_to_c_name_address="sed -n -e 's/^: \\([^ ]*\\) \$/ {\\\"\\1\\\", (void *) 0},/p' -e 's/^[ABCDGIRSTW]* \\([^ ]*\\) \\([^ ]*\\)\$/ {\"\\2\", (void *) \\&\\2},/p'"
157
158# Transform the output of nm in a C name address pair when lib prefix is needed.
159global_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'"
160
161# The name of the directory that contains temporary libtool files.
162objdir=.libs
163
cristy3ed852e2009-09-05 21:47:34 +0000164# Used to examine libraries when file_magic_cmd begins with "file".
165MAGIC_CMD=file
166
167# Must we lock files when doing compilation?
168need_locks="no"
169
170# Tool to manipulate archived DWARF debug symbol files on Mac OS X.
171DSYMUTIL=""
172
173# Tool to change global to local symbols on Mac OS X.
174NMEDIT=""
175
176# Tool to manipulate fat objects and archives on Mac OS X.
177LIPO=""
178
179# ldd/readelf like tool for Mach-O binaries on Mac OS X.
180OTOOL=""
181
182# ldd/readelf like tool for 64 bit Mach-O binaries on Mac OS X 10.4.
183OTOOL64=""
184
185# Old archive suffix (normally "a").
186libext=a
187
188# Shared library suffix (normally ".so").
189shrext_cmds=".so"
190
191# The commands to extract the exported symbol list from a shared archive.
192extract_expsyms_cmds=""
193
194# Variables whose values should be saved in libtool wrapper scripts and
195# restored at link time.
196variables_saved_for_relink="PATH LD_LIBRARY_PATH LD_RUN_PATH GCC_EXEC_PREFIX COMPILER_PATH LIBRARY_PATH"
197
198# Do we need the "lib" prefix for modules?
199need_lib_prefix=no
200
201# Do we need a version for libraries?
202need_version=no
203
204# Library versioning type.
205version_type=linux
206
207# Shared library runtime path variable.
208runpath_var=LD_RUN_PATH
209
210# Shared library path variable.
211shlibpath_var=LD_LIBRARY_PATH
212
213# Is shlibpath searched before the hard-coded library search path?
214shlibpath_overrides_runpath=no
215
216# Format of library name prefix.
217libname_spec="lib\$name"
218
219# List of archive names. First name is the real one, the rest are links.
220# The last name is the one that the linker finds with -lNAME
221library_names_spec="\${libname}\${release}\${shared_ext}\$versuffix \${libname}\${release}\${shared_ext}\$major \$libname\${shared_ext}"
222
223# The coded name of the library, if different from the real name.
224soname_spec="\${libname}\${release}\${shared_ext}\$major"
225
cristyfd9dcd42010-08-08 18:07:02 +0000226# Permission mode override for installation of shared libraries.
227install_override_mode=""
228
cristy3ed852e2009-09-05 21:47:34 +0000229# Command to use after installation of a shared archive.
230postinstall_cmds=""
231
232# Command to use after uninstallation of a shared archive.
233postuninstall_cmds=""
234
235# Commands used to finish a libtool library installation in a directory.
236finish_cmds="PATH=\\\"\\\$PATH:/sbin\\\" ldconfig -n \$libdir"
237
238# As "finish_cmds", except a single script fragment to be evaled but
239# not shown.
240finish_eval=""
241
242# Whether we should hardcode library paths into libraries.
243hardcode_into_libs=yes
244
245# Compile-time system search path for libraries.
cristyde8bd6e2010-09-21 15:34:51 +0000246sys_lib_search_path_spec="/usr/lib/gcc/x86_64-redhat-linux/4.5.1 /usr/lib64 /lib64 "
cristy3ed852e2009-09-05 21:47:34 +0000247
248# Run-time system search path for libraries.
cristyde8bd6e2010-09-21 15:34:51 +0000249sys_lib_dlsearch_path_spec="/lib64 /usr/lib64 /lib /usr/lib /usr/lib64/atlas /usr/lib64/mysql /usr/lib64/qt-3.3/lib /usr/lib/wine/ /usr/lib64/wine/ /usr/lib64/xulrunner-1.9.2 "
cristy3ed852e2009-09-05 21:47:34 +0000250
251# Whether dlopen is supported.
252dlopen_support=yes
253
254# Whether dlopen of programs is supported.
cristy40e685d2010-04-23 14:44:08 +0000255dlopen_self=yes
cristy3ed852e2009-09-05 21:47:34 +0000256
257# Whether dlopen of statically linked programs is supported.
cristyde8bd6e2010-09-21 15:34:51 +0000258dlopen_self_static=yes
cristy3ed852e2009-09-05 21:47:34 +0000259
260# Commands to strip libraries.
261old_striplib="strip --strip-debug"
262striplib="strip --strip-unneeded"
263
264
265# The linker used to build libraries.
266LD="/usr/bin/ld -m elf_x86_64"
267
cristyfd9dcd42010-08-08 18:07:02 +0000268# How to create reloadable object files.
269reload_flag=" -r"
270reload_cmds="\$LD\$reload_flag -o \$output\$reload_objs"
271
cristy3ed852e2009-09-05 21:47:34 +0000272# Commands used to build an old-style archive.
273old_archive_cmds="\$AR \$AR_FLAGS \$oldlib\$oldobjs~\$RANLIB \$oldlib"
274
275# A language specific compiler.
cristy40e685d2010-04-23 14:44:08 +0000276CC="gcc -std=gnu99 -std=gnu99"
cristy3ed852e2009-09-05 21:47:34 +0000277
278# Is the compiler the GNU compiler?
279with_gcc=yes
280
281# Compiler flag to turn off builtin functions.
cristy40e685d2010-04-23 14:44:08 +0000282no_builtin_flag=" -fno-builtin"
cristy3ed852e2009-09-05 21:47:34 +0000283
284# How to pass a linker flag through the compiler.
285wl="-Wl,"
286
287# Additional compiler flags for building library objects.
288pic_flag=" -fPIC -DPIC"
289
290# Compiler flag to prevent dynamic linking.
cristyde8bd6e2010-09-21 15:34:51 +0000291link_static_flag=""
cristy3ed852e2009-09-05 21:47:34 +0000292
293# Does compiler simultaneously support -c and -o options?
294compiler_c_o="yes"
295
296# Whether or not to add -lc for building shared libraries.
cristy40e685d2010-04-23 14:44:08 +0000297build_libtool_need_lc=no
cristy3ed852e2009-09-05 21:47:34 +0000298
299# Whether or not to disallow shared libs when runtime libs are static.
300allow_libtool_libs_with_static_runtimes=no
301
302# Compiler flag to allow reflexive dlopens.
303export_dynamic_flag_spec="\${wl}--export-dynamic"
304
305# Compiler flag to generate shared objects directly from archives.
306whole_archive_flag_spec="\${wl}--whole-archive\$convenience \${wl}--no-whole-archive"
307
308# Whether the compiler copes with passing no objects directly.
309compiler_needs_object="no"
310
311# Create an old-style archive from a shared archive.
312old_archive_from_new_cmds=""
313
314# Create a temporary old-style archive to link instead of a shared archive.
315old_archive_from_expsyms_cmds=""
316
317# Commands used to build a shared archive.
318archive_cmds="\$CC -shared \$libobjs \$deplibs \$compiler_flags \${wl}-soname \$wl\$soname -o \$lib"
319archive_expsym_cmds="echo \\\"{ global:\\\" > \$output_objdir/\$libname.ver~
320 cat \$export_symbols | sed -e \\\"s/\\\\(.*\\\\)/\\\\1;/\\\" >> \$output_objdir/\$libname.ver~
321 echo \\\"local: *; };\\\" >> \$output_objdir/\$libname.ver~
322 \$CC -shared \$libobjs \$deplibs \$compiler_flags \${wl}-soname \$wl\$soname \${wl}-version-script \${wl}\$output_objdir/\$libname.ver -o \$lib"
323
324# Commands used to build a loadable module if different from building
325# a shared archive.
326module_cmds=""
327module_expsym_cmds=""
328
329# Whether we are building with GNU ld or not.
330with_gnu_ld="yes"
331
332# Flag that allows shared libraries with undefined symbols to be built.
333allow_undefined_flag=""
334
335# Flag that enforces no undefined symbols.
336no_undefined_flag=""
337
338# Flag to hardcode $libdir into a binary during linking.
339# This must work even if $libdir does not exist
340hardcode_libdir_flag_spec="\${wl}-rpath \${wl}\$libdir"
341
342# If ld is used when linking, flag to hardcode $libdir into a binary
343# during linking. This must work even if $libdir does not exist.
344hardcode_libdir_flag_spec_ld=""
345
346# Whether we need a single "-rpath" flag with a separated argument.
347hardcode_libdir_separator=""
348
349# Set to "yes" if using DIR/libNAME${shared_ext} during linking hardcodes
350# DIR into the resulting binary.
351hardcode_direct=no
352
353# Set to "yes" if using DIR/libNAME${shared_ext} during linking hardcodes
354# DIR into the resulting binary and the resulting library dependency is
355# "absolute",i.e impossible to change by setting ${shlibpath_var} if the
356# library is relocated.
357hardcode_direct_absolute=no
358
359# Set to "yes" if using the -LDIR flag during linking hardcodes DIR
360# into the resulting binary.
361hardcode_minus_L=no
362
363# Set to "yes" if using SHLIBPATH_VAR=DIR during linking hardcodes DIR
364# into the resulting binary.
365hardcode_shlibpath_var=unsupported
366
367# Set to "yes" if building a shared library automatically hardcodes DIR
368# into the library and all subsequent libraries and executables linked
369# against it.
370hardcode_automatic=no
371
372# Set to yes if linker adds runtime paths of dependent libraries
373# to runtime path list.
374inherit_rpath=no
375
376# Whether libtool must link a program against all its dependency libraries.
377link_all_deplibs=unknown
378
379# Fix the shell variable $srcfile for the compiler.
380fix_srcfile_path=""
381
382# Set to "yes" if exported symbols are required.
383always_export_symbols=no
384
385# The commands to list exported symbols.
386export_symbols_cmds="\$NM \$libobjs \$convenience | \$global_symbol_pipe | \$SED 's/.* //' | sort | uniq > \$export_symbols"
387
388# Symbols that should not be listed in the preloaded symbols.
389exclude_expsyms="_GLOBAL_OFFSET_TABLE_|_GLOBAL__F[ID]_.*"
390
391# Symbols that must always be exported.
392include_expsyms=""
393
394# Commands necessary for linking programs (against libraries) with templates.
395prelink_cmds=""
396
397# Specify filename containing input files.
398file_list_spec=""
399
400# How to hardcode a shared library path into an executable.
401hardcode_action=immediate
402
403# The directories searched by this compiler when creating a shared library.
404compiler_lib_search_dirs=""
405
406# Dependencies to place before and after the objects being linked to
407# create a shared library.
408predep_objects=""
409postdep_objects=""
410predeps=""
411postdeps=""
412
413# The library search path used internally by the compiler when linking
414# a shared library.
415compiler_lib_search_path=""
416
417# ### END LIBTOOL CONFIG
418
419# Generated from ltmain.m4sh.
420
cristyfd9dcd42010-08-08 18:07:02 +0000421# libtool (GNU libtool) 2.2.10
cristy3ed852e2009-09-05 21:47:34 +0000422# Written by Gordon Matzigkeit <gord@gnu.ai.mit.edu>, 1996
423
cristyfd9dcd42010-08-08 18:07:02 +0000424# Copyright (C) 1996, 1997, 1998, 1999, 2000, 2001, 2003, 2004, 2005, 2006,
425# 2007, 2008, 2009, 2010 Free Software Foundation, Inc.
cristy3ed852e2009-09-05 21:47:34 +0000426# This is free software; see the source for copying conditions. There is NO
427# warranty; not even for MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
428
429# GNU Libtool is free software; you can redistribute it and/or modify
430# it under the terms of the GNU General Public License as published by
431# the Free Software Foundation; either version 2 of the License, or
432# (at your option) any later version.
433#
434# As a special exception to the GNU General Public License,
435# if you distribute this file as part of a program or library that
436# is built using GNU Libtool, you may include this file under the
437# same distribution terms that you use for the rest of that program.
438#
439# GNU Libtool is distributed in the hope that it will be useful, but
440# WITHOUT ANY WARRANTY; without even the implied warranty of
441# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
442# General Public License for more details.
443#
444# You should have received a copy of the GNU General Public License
445# along with GNU Libtool; see the file COPYING. If not, a copy
446# can be downloaded from http://www.gnu.org/licenses/gpl.html,
447# or obtained by writing to the Free Software Foundation, Inc.,
448# 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
449
450# Usage: $progname [OPTION]... [MODE-ARG]...
451#
452# Provide generalized library-building support services.
453#
cristyfd9dcd42010-08-08 18:07:02 +0000454# --config show all configuration variables
455# --debug enable verbose shell tracing
456# -n, --dry-run display commands without modifying any files
457# --features display basic configuration information and exit
458# --mode=MODE use operation mode MODE
459# --preserve-dup-deps don't remove duplicate dependency libraries
460# --quiet, --silent don't print informational messages
461# --no-quiet, --no-silent
462# print informational messages (default)
463# --tag=TAG use configuration variables from tag TAG
464# -v, --verbose print more informational messages than default
465# --no-verbose don't print the extra informational messages
466# --version print version information
467# -h, --help, --help-all print short, long, or detailed help message
cristy3ed852e2009-09-05 21:47:34 +0000468#
469# MODE must be one of the following:
470#
cristyfd9dcd42010-08-08 18:07:02 +0000471# clean remove files from the build directory
472# compile compile a source file into a libtool object
473# execute automatically set library path, then run a program
474# finish complete the installation of libtool libraries
475# install install libraries or executables
476# link create a library or an executable
477# uninstall remove libraries from an installed directory
cristy3ed852e2009-09-05 21:47:34 +0000478#
cristyfd9dcd42010-08-08 18:07:02 +0000479# MODE-ARGS vary depending on the MODE. When passed as first option,
480# `--mode=MODE' may be abbreviated as `MODE' or a unique abbreviation of that.
cristy3ed852e2009-09-05 21:47:34 +0000481# Try `$progname --help --mode=MODE' for a more detailed description of MODE.
482#
483# When reporting a bug, please describe a test case to reproduce it and
484# include the following information:
485#
cristyfd9dcd42010-08-08 18:07:02 +0000486# host-triplet: $host
487# shell: $SHELL
488# compiler: $LTCC
489# compiler flags: $LTCFLAGS
490# linker: $LD (gnu? $with_gnu_ld)
491# $progname: (GNU libtool) 2.2.10
492# automake: $automake_version
493# autoconf: $autoconf_version
cristy3ed852e2009-09-05 21:47:34 +0000494#
495# Report bugs to <bug-libtool@gnu.org>.
496
cristyfd9dcd42010-08-08 18:07:02 +0000497PROGRAM=libtool
cristy3ed852e2009-09-05 21:47:34 +0000498PACKAGE=libtool
cristyfd9dcd42010-08-08 18:07:02 +0000499VERSION=2.2.10
cristycd4c5312009-11-22 01:19:08 +0000500TIMESTAMP=""
cristyfd9dcd42010-08-08 18:07:02 +0000501package_revision=1.3175
cristy3ed852e2009-09-05 21:47:34 +0000502
503# Be Bourne compatible
504if test -n "${ZSH_VERSION+set}" && (emulate sh) >/dev/null 2>&1; then
505 emulate sh
506 NULLCMD=:
507 # Zsh 3.x and 4.x performs word splitting on ${1+"$@"}, which
508 # is contrary to our usage. Disable this feature.
509 alias -g '${1+"$@"}'='"$@"'
510 setopt NO_GLOB_SUBST
511else
512 case `(set -o) 2>/dev/null` in *posix*) set -o posix;; esac
513fi
514BIN_SH=xpg4; export BIN_SH # for Tru64
515DUALCASE=1; export DUALCASE # for MKS sh
516
cristyfd9dcd42010-08-08 18:07:02 +0000517# A function that is used when there is no print builtin or printf.
518func_fallback_echo ()
519{
520 eval 'cat <<_LTECHO_EOF
521$1
522_LTECHO_EOF'
523}
524
cristy3ed852e2009-09-05 21:47:34 +0000525# NLS nuisances: We save the old values to restore during execute mode.
cristy3ed852e2009-09-05 21:47:34 +0000526lt_user_locale=
527lt_safe_locale=
528for lt_var in LANG LANGUAGE LC_ALL LC_CTYPE LC_COLLATE LC_MESSAGES
529do
530 eval "if test \"\${$lt_var+set}\" = set; then
531 save_$lt_var=\$$lt_var
532 $lt_var=C
533 export $lt_var
534 lt_user_locale=\"$lt_var=\\\$save_\$lt_var; \$lt_user_locale\"
535 lt_safe_locale=\"$lt_var=C; \$lt_safe_locale\"
536 fi"
537done
cristyfd9dcd42010-08-08 18:07:02 +0000538LC_ALL=C
539LANGUAGE=C
540export LANGUAGE LC_ALL
cristy3ed852e2009-09-05 21:47:34 +0000541
542$lt_unset CDPATH
543
544
cristyfd9dcd42010-08-08 18:07:02 +0000545# Work around backward compatibility issue on IRIX 6.5. On IRIX 6.4+, sh
546# is ksh but when the shell is invoked as "sh" and the current value of
547# the _XPG environment variable is not equal to 1 (one), the special
548# positional parameter $0, within a function call, is the name of the
549# function.
550progpath="$0"
cristy3ed852e2009-09-05 21:47:34 +0000551
552
553
554: ${CP="cp -f"}
cristyfd9dcd42010-08-08 18:07:02 +0000555test "${ECHO+set}" = set || ECHO=${as_echo-'printf %s\n'}
cristycd4c5312009-11-22 01:19:08 +0000556: ${EGREP="/bin/grep -E"}
557: ${FGREP="/bin/grep -F"}
558: ${GREP="/bin/grep"}
cristy3ed852e2009-09-05 21:47:34 +0000559: ${LN_S="ln -s"}
560: ${MAKE="make"}
561: ${MKDIR="mkdir"}
562: ${MV="mv -f"}
563: ${RM="rm -f"}
cristycd4c5312009-11-22 01:19:08 +0000564: ${SED="/bin/sed"}
cristy3ed852e2009-09-05 21:47:34 +0000565: ${SHELL="${CONFIG_SHELL-/bin/sh}"}
566: ${Xsed="$SED -e 1s/^X//"}
567
568# Global variables:
569EXIT_SUCCESS=0
570EXIT_FAILURE=1
571EXIT_MISMATCH=63 # $? = 63 is used to indicate version mismatch to missing.
572EXIT_SKIP=77 # $? = 77 is used to indicate a skipped test to automake.
573
574exit_status=$EXIT_SUCCESS
575
576# Make sure IFS has a sensible default
577lt_nl='
578'
579IFS=" $lt_nl"
580
581dirname="s,/[^/]*$,,"
582basename="s,^.*/,,"
583
584# func_dirname_and_basename file append nondir_replacement
585# perform func_basename and func_dirname in a single function
586# call:
587# dirname: Compute the dirname of FILE. If nonempty,
588# add APPEND to the result, otherwise set result
589# to NONDIR_REPLACEMENT.
590# value returned in "$func_dirname_result"
591# basename: Compute filename of FILE.
592# value retuned in "$func_basename_result"
593# Implementation must be kept synchronized with func_dirname
594# and func_basename. For efficiency, we do not delegate to
595# those functions but instead duplicate the functionality here.
596func_dirname_and_basename ()
597{
598 # Extract subdirectory from the argument.
cristyfd9dcd42010-08-08 18:07:02 +0000599 func_dirname_result=`$ECHO "${1}" | $SED -e "$dirname"`
cristy3ed852e2009-09-05 21:47:34 +0000600 if test "X$func_dirname_result" = "X${1}"; then
601 func_dirname_result="${3}"
602 else
603 func_dirname_result="$func_dirname_result${2}"
604 fi
cristyfd9dcd42010-08-08 18:07:02 +0000605 func_basename_result=`$ECHO "${1}" | $SED -e "$basename"`
cristy3ed852e2009-09-05 21:47:34 +0000606}
607
608# Generated shell functions inserted here.
609
610# 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{
615 case ${1} in
616 */*) func_dirname_result="${1%/*}${2}" ;;
617 * ) func_dirname_result="${3}" ;;
618 esac
619}
620
621# func_basename file
622func_basename ()
623{
624 func_basename_result="${1##*/}"
625}
626
627# func_dirname_and_basename file append nondir_replacement
628# perform func_basename and func_dirname in a single function
629# call:
630# dirname: Compute the dirname of FILE. If nonempty,
631# add APPEND to the result, otherwise set result
632# to NONDIR_REPLACEMENT.
633# value returned in "$func_dirname_result"
634# basename: Compute filename of FILE.
635# value retuned in "$func_basename_result"
636# Implementation must be kept synchronized with func_dirname
637# and func_basename. For efficiency, we do not delegate to
638# those functions but instead duplicate the functionality here.
639func_dirname_and_basename ()
640{
641 case ${1} in
642 */*) func_dirname_result="${1%/*}${2}" ;;
643 * ) func_dirname_result="${3}" ;;
644 esac
645 func_basename_result="${1##*/}"
646}
647
648# func_stripname prefix suffix name
649# strip PREFIX and SUFFIX off of NAME.
650# PREFIX and SUFFIX must not contain globbing or regex special
651# characters, hashes, percent signs, but SUFFIX may contain a leading
652# dot (in which case that matches only a dot).
653func_stripname ()
654{
655 # pdksh 5.2.14 does not do ${X%$Y} correctly if both X and Y are
656 # positional parameters, so assign one to ordinary parameter first.
657 func_stripname_result=${3}
658 func_stripname_result=${func_stripname_result#"${1}"}
659 func_stripname_result=${func_stripname_result%"${2}"}
660}
661
662# func_opt_split
663func_opt_split ()
664{
665 func_opt_split_opt=${1%%=*}
666 func_opt_split_arg=${1#*=}
667}
668
669# func_lo2o object
670func_lo2o ()
671{
672 case ${1} in
673 *.lo) func_lo2o_result=${1%.lo}.${objext} ;;
674 *) func_lo2o_result=${1} ;;
675 esac
676}
677
678# func_xform libobj-or-source
679func_xform ()
680{
681 func_xform_result=${1%.*}.lo
682}
683
684# func_arith arithmetic-term...
685func_arith ()
686{
687 func_arith_result=$(( $* ))
688}
689
690# func_len string
691# STRING may not start with a hyphen.
692func_len ()
693{
694 func_len_result=${#1}
695}
696
697
698# func_append var value
699# Append VALUE to the end of shell variable VAR.
700func_append ()
701{
702 eval "$1+=\$2"
703}
704# Generated shell functions inserted here.
705
cristyfd9dcd42010-08-08 18:07:02 +0000706# These SED scripts presuppose an absolute path with a trailing slash.
707pathcar='s,^/\([^/]*\).*$,\1,'
708pathcdr='s,^/[^/]*,,'
709removedotparts=':dotsl
710 s@/\./@/@g
711 t dotsl
712 s,/\.$,/,'
713collapseslashes='s@/\{1,\}@/@g'
714finalslash='s,/*$,/,'
715
716# func_normal_abspath PATH
717# Remove doubled-up and trailing slashes, "." path components,
718# and cancel out any ".." path components in PATH after making
719# it an absolute path.
720# value returned in "$func_normal_abspath_result"
721func_normal_abspath ()
722{
723 # Start from root dir and reassemble the path.
724 func_normal_abspath_result=
725 func_normal_abspath_tpath=$1
726 func_normal_abspath_altnamespace=
727 case $func_normal_abspath_tpath in
728 "")
729 # Empty path, that just means $cwd.
730 func_stripname '' '/' "`pwd`"
731 func_normal_abspath_result=$func_stripname_result
732 return
733 ;;
734 # The next three entries are used to spot a run of precisely
735 # two leading slashes without using negated character classes;
736 # we take advantage of case's first-match behaviour.
737 ///*)
738 # Unusual form of absolute path, do nothing.
739 ;;
740 //*)
741 # Not necessarily an ordinary path; POSIX reserves leading '//'
742 # and for example Cygwin uses it to access remote file shares
743 # over CIFS/SMB, so we conserve a leading double slash if found.
744 func_normal_abspath_altnamespace=/
745 ;;
746 /*)
747 # Absolute path, do nothing.
748 ;;
749 *)
750 # Relative path, prepend $cwd.
751 func_normal_abspath_tpath=`pwd`/$func_normal_abspath_tpath
752 ;;
753 esac
754 # Cancel out all the simple stuff to save iterations. We also want
755 # the path to end with a slash for ease of parsing, so make sure
756 # there is one (and only one) here.
757 func_normal_abspath_tpath=`$ECHO "$func_normal_abspath_tpath" | $SED \
758 -e "$removedotparts" -e "$collapseslashes" -e "$finalslash"`
759 while :; do
760 # Processed it all yet?
761 if test "$func_normal_abspath_tpath" = / ; then
762 # If we ascended to the root using ".." the result may be empty now.
763 if test -z "$func_normal_abspath_result" ; then
764 func_normal_abspath_result=/
765 fi
766 break
767 fi
768 func_normal_abspath_tcomponent=`$ECHO "$func_normal_abspath_tpath" | $SED \
769 -e "$pathcar"`
770 func_normal_abspath_tpath=`$ECHO "$func_normal_abspath_tpath" | $SED \
771 -e "$pathcdr"`
772 # Figure out what to do with it
773 case $func_normal_abspath_tcomponent in
774 "")
775 # Trailing empty path component, ignore it.
776 ;;
777 ..)
778 # Parent dir; strip last assembled component from result.
779 func_dirname "$func_normal_abspath_result"
780 func_normal_abspath_result=$func_dirname_result
781 ;;
782 *)
783 # Actual path component, append it.
784 func_normal_abspath_result=$func_normal_abspath_result/$func_normal_abspath_tcomponent
785 ;;
786 esac
787 done
788 # Restore leading double-slash if one was found on entry.
789 func_normal_abspath_result=$func_normal_abspath_altnamespace$func_normal_abspath_result
790}
791
792# func_relative_path SRCDIR DSTDIR
793# generates a relative path from SRCDIR to DSTDIR, with a trailing
794# slash if non-empty, suitable for immediately appending a filename
795# without needing to append a separator.
796# value returned in "$func_relative_path_result"
797func_relative_path ()
798{
799 func_relative_path_result=
800 func_normal_abspath "$1"
801 func_relative_path_tlibdir=$func_normal_abspath_result
802 func_normal_abspath "$2"
803 func_relative_path_tbindir=$func_normal_abspath_result
804
805 # Ascend the tree starting from libdir
806 while :; do
807 # check if we have found a prefix of bindir
808 case $func_relative_path_tbindir in
809 $func_relative_path_tlibdir)
810 # found an exact match
811 func_relative_path_tcancelled=
812 break
813 ;;
814 $func_relative_path_tlibdir*)
815 # found a matching prefix
816 func_stripname "$func_relative_path_tlibdir" '' "$func_relative_path_tbindir"
817 func_relative_path_tcancelled=$func_stripname_result
818 if test -z "$func_relative_path_result"; then
819 func_relative_path_result=.
820 fi
821 break
822 ;;
823 *)
824 func_dirname $func_relative_path_tlibdir
825 func_relative_path_tlibdir=${func_dirname_result}
826 if test "x$func_relative_path_tlibdir" = x ; then
827 # Have to descend all the way to the root!
828 func_relative_path_result=../$func_relative_path_result
829 func_relative_path_tcancelled=$func_relative_path_tbindir
830 break
831 fi
832 func_relative_path_result=../$func_relative_path_result
833 ;;
834 esac
835 done
836
837 # Now calculate path; take care to avoid doubling-up slashes.
838 func_stripname '' '/' "$func_relative_path_result"
839 func_relative_path_result=$func_stripname_result
840 func_stripname '/' '/' "$func_relative_path_tcancelled"
841 if test "x$func_stripname_result" != x ; then
842 func_relative_path_result=${func_relative_path_result}/${func_stripname_result}
843 fi
844
845 # Normalisation. If bindir is libdir, return empty string,
846 # else relative path ending with a slash; either way, target
847 # file name can be directly appended.
848 if test ! -z "$func_relative_path_result"; then
849 func_stripname './' '' "$func_relative_path_result/"
850 func_relative_path_result=$func_stripname_result
851 fi
852}
cristy3ed852e2009-09-05 21:47:34 +0000853
854# The name of this program:
cristy3ed852e2009-09-05 21:47:34 +0000855func_dirname_and_basename "$progpath"
856progname=$func_basename_result
cristy3ed852e2009-09-05 21:47:34 +0000857
858# Make sure we have an absolute path for reexecution:
859case $progpath in
860 [\\/]*|[A-Za-z]:\\*) ;;
861 *[\\/]*)
862 progdir=$func_dirname_result
863 progdir=`cd "$progdir" && pwd`
864 progpath="$progdir/$progname"
865 ;;
866 *)
867 save_IFS="$IFS"
868 IFS=:
869 for progdir in $PATH; do
870 IFS="$save_IFS"
871 test -x "$progdir/$progname" && break
872 done
873 IFS="$save_IFS"
874 test -n "$progdir" || progdir=`pwd`
875 progpath="$progdir/$progname"
876 ;;
877esac
878
879# Sed substitution that helps us do robust quoting. It backslashifies
880# metacharacters that are still active within double-quoted strings.
881Xsed="${SED}"' -e 1s/^X//'
882sed_quote_subst='s/\([`"$\\]\)/\\\1/g'
883
884# Same as above, but do not quote variable references.
885double_quote_subst='s/\(["`\\]\)/\\\1/g'
886
887# Re-`\' parameter expansions in output of double_quote_subst that were
888# `\'-ed in input to the same. If an odd number of `\' preceded a '$'
889# in input to double_quote_subst, that '$' was protected from expansion.
890# Since each input `\' is now two `\'s, look for any number of runs of
891# four `\'s followed by two `\'s and then a '$'. `\' that '$'.
892bs='\\'
893bs2='\\\\'
894bs4='\\\\\\\\'
895dollar='\$'
896sed_double_backslash="\
897 s/$bs4/&\\
898/g
899 s/^$bs2$dollar/$bs&/
900 s/\\([^$bs]\\)$bs2$dollar/\\1$bs2$bs$dollar/g
901 s/\n//g"
902
903# Standard options:
904opt_dry_run=false
905opt_help=false
906opt_quiet=false
907opt_verbose=false
908opt_warning=:
909
910# func_echo arg...
911# Echo program name prefixed message, along with the current mode
912# name if it has been set yet.
913func_echo ()
914{
915 $ECHO "$progname${mode+: }$mode: $*"
916}
917
918# func_verbose arg...
919# Echo program name prefixed message in verbose mode only.
920func_verbose ()
921{
922 $opt_verbose && func_echo ${1+"$@"}
923
924 # A bug in bash halts the script if the last line of a function
925 # fails when set -e is in force, so we need another command to
926 # work around that:
927 :
928}
929
cristyfd9dcd42010-08-08 18:07:02 +0000930# func_echo_all arg...
931# Invoke $ECHO with all args, space-separated.
932func_echo_all ()
933{
934 $ECHO "$*"
935}
936
cristy3ed852e2009-09-05 21:47:34 +0000937# func_error arg...
938# Echo program name prefixed message to standard error.
939func_error ()
940{
941 $ECHO "$progname${mode+: }$mode: "${1+"$@"} 1>&2
942}
943
944# func_warning arg...
945# Echo program name prefixed warning message to standard error.
946func_warning ()
947{
948 $opt_warning && $ECHO "$progname${mode+: }$mode: warning: "${1+"$@"} 1>&2
949
950 # bash bug again:
951 :
952}
953
954# func_fatal_error arg...
955# Echo program name prefixed message to standard error, and exit.
956func_fatal_error ()
957{
958 func_error ${1+"$@"}
959 exit $EXIT_FAILURE
960}
961
962# func_fatal_help arg...
963# Echo program name prefixed message to standard error, followed by
964# a help hint, and exit.
965func_fatal_help ()
966{
967 func_error ${1+"$@"}
968 func_fatal_error "$help"
969}
970help="Try \`$progname --help' for more information." ## default
971
972
973# func_grep expression filename
974# Check whether EXPRESSION matches any line of FILENAME, without output.
975func_grep ()
976{
977 $GREP "$1" "$2" >/dev/null 2>&1
978}
979
980
981# func_mkdir_p directory-path
982# Make sure the entire path to DIRECTORY-PATH is available.
983func_mkdir_p ()
984{
985 my_directory_path="$1"
986 my_dir_list=
987
988 if test -n "$my_directory_path" && test "$opt_dry_run" != ":"; then
989
990 # Protect directory names starting with `-'
991 case $my_directory_path in
992 -*) my_directory_path="./$my_directory_path" ;;
993 esac
994
995 # While some portion of DIR does not yet exist...
996 while test ! -d "$my_directory_path"; do
997 # ...make a list in topmost first order. Use a colon delimited
998 # list incase some portion of path contains whitespace.
999 my_dir_list="$my_directory_path:$my_dir_list"
1000
1001 # If the last portion added has no slash in it, the list is done
1002 case $my_directory_path in */*) ;; *) break ;; esac
1003
1004 # ...otherwise throw away the child directory and loop
cristyfd9dcd42010-08-08 18:07:02 +00001005 my_directory_path=`$ECHO "$my_directory_path" | $SED -e "$dirname"`
cristy3ed852e2009-09-05 21:47:34 +00001006 done
cristyfd9dcd42010-08-08 18:07:02 +00001007 my_dir_list=`$ECHO "$my_dir_list" | $SED 's,:*$,,'`
cristy3ed852e2009-09-05 21:47:34 +00001008
1009 save_mkdir_p_IFS="$IFS"; IFS=':'
1010 for my_dir in $my_dir_list; do
1011 IFS="$save_mkdir_p_IFS"
1012 # mkdir can fail with a `File exist' error if two processes
1013 # try to create one of the directories concurrently. Don't
1014 # stop in that case!
1015 $MKDIR "$my_dir" 2>/dev/null || :
1016 done
1017 IFS="$save_mkdir_p_IFS"
1018
1019 # Bail out if we (or some other process) failed to create a directory.
1020 test -d "$my_directory_path" || \
1021 func_fatal_error "Failed to create \`$1'"
1022 fi
1023}
1024
1025
1026# func_mktempdir [string]
1027# Make a temporary directory that won't clash with other running
1028# libtool processes, and avoids race conditions if possible. If
1029# given, STRING is the basename for that directory.
1030func_mktempdir ()
1031{
1032 my_template="${TMPDIR-/tmp}/${1-$progname}"
1033
1034 if test "$opt_dry_run" = ":"; then
1035 # Return a directory name, but don't create it in dry-run mode
1036 my_tmpdir="${my_template}-$$"
1037 else
1038
1039 # If mktemp works, use that first and foremost
1040 my_tmpdir=`mktemp -d "${my_template}-XXXXXXXX" 2>/dev/null`
1041
1042 if test ! -d "$my_tmpdir"; then
1043 # Failing that, at least try and use $RANDOM to avoid a race
1044 my_tmpdir="${my_template}-${RANDOM-0}$$"
1045
1046 save_mktempdir_umask=`umask`
1047 umask 0077
1048 $MKDIR "$my_tmpdir"
1049 umask $save_mktempdir_umask
1050 fi
1051
1052 # If we're not in dry-run mode, bomb out on failure
1053 test -d "$my_tmpdir" || \
1054 func_fatal_error "cannot create temporary directory \`$my_tmpdir'"
1055 fi
1056
cristyfd9dcd42010-08-08 18:07:02 +00001057 $ECHO "$my_tmpdir"
cristy3ed852e2009-09-05 21:47:34 +00001058}
1059
1060
1061# func_quote_for_eval arg
1062# Aesthetically quote ARG to be evaled later.
1063# This function returns two values: FUNC_QUOTE_FOR_EVAL_RESULT
1064# is double-quoted, suitable for a subsequent eval, whereas
1065# FUNC_QUOTE_FOR_EVAL_UNQUOTED_RESULT has merely all characters
1066# which are still active within double quotes backslashified.
1067func_quote_for_eval ()
1068{
1069 case $1 in
1070 *[\\\`\"\$]*)
cristyfd9dcd42010-08-08 18:07:02 +00001071 func_quote_for_eval_unquoted_result=`$ECHO "$1" | $SED "$sed_quote_subst"` ;;
cristy3ed852e2009-09-05 21:47:34 +00001072 *)
1073 func_quote_for_eval_unquoted_result="$1" ;;
1074 esac
1075
1076 case $func_quote_for_eval_unquoted_result in
1077 # Double-quote args containing shell metacharacters to delay
1078 # word splitting, command substitution and and variable
1079 # expansion for a subsequent eval.
1080 # Many Bourne shells cannot handle close brackets correctly
1081 # in scan sets, so we specify it separately.
1082 *[\[\~\#\^\&\*\(\)\{\}\|\;\<\>\?\'\ \ ]*|*]*|"")
1083 func_quote_for_eval_result="\"$func_quote_for_eval_unquoted_result\""
1084 ;;
1085 *)
1086 func_quote_for_eval_result="$func_quote_for_eval_unquoted_result"
1087 esac
1088}
1089
1090
1091# func_quote_for_expand arg
1092# Aesthetically quote ARG to be evaled later; same as above,
1093# but do not quote variable references.
1094func_quote_for_expand ()
1095{
1096 case $1 in
1097 *[\\\`\"]*)
cristyfd9dcd42010-08-08 18:07:02 +00001098 my_arg=`$ECHO "$1" | $SED \
cristy3ed852e2009-09-05 21:47:34 +00001099 -e "$double_quote_subst" -e "$sed_double_backslash"` ;;
1100 *)
1101 my_arg="$1" ;;
1102 esac
1103
1104 case $my_arg in
1105 # Double-quote args containing shell metacharacters to delay
1106 # word splitting and command substitution for a subsequent eval.
1107 # Many Bourne shells cannot handle close brackets correctly
1108 # in scan sets, so we specify it separately.
1109 *[\[\~\#\^\&\*\(\)\{\}\|\;\<\>\?\'\ \ ]*|*]*|"")
1110 my_arg="\"$my_arg\""
1111 ;;
1112 esac
1113
1114 func_quote_for_expand_result="$my_arg"
1115}
1116
1117
1118# func_show_eval cmd [fail_exp]
1119# Unless opt_silent is true, then output CMD. Then, if opt_dryrun is
1120# not true, evaluate CMD. If the evaluation of CMD fails, and FAIL_EXP
1121# is given, then evaluate it.
1122func_show_eval ()
1123{
1124 my_cmd="$1"
1125 my_fail_exp="${2-:}"
1126
1127 ${opt_silent-false} || {
1128 func_quote_for_expand "$my_cmd"
1129 eval "func_echo $func_quote_for_expand_result"
1130 }
1131
1132 if ${opt_dry_run-false}; then :; else
1133 eval "$my_cmd"
1134 my_status=$?
1135 if test "$my_status" -eq 0; then :; else
1136 eval "(exit $my_status); $my_fail_exp"
1137 fi
1138 fi
1139}
1140
1141
1142# func_show_eval_locale cmd [fail_exp]
1143# Unless opt_silent is true, then output CMD. Then, if opt_dryrun is
1144# not true, evaluate CMD. If the evaluation of CMD fails, and FAIL_EXP
1145# is given, then evaluate it. Use the saved locale for evaluation.
1146func_show_eval_locale ()
1147{
1148 my_cmd="$1"
1149 my_fail_exp="${2-:}"
1150
1151 ${opt_silent-false} || {
1152 func_quote_for_expand "$my_cmd"
1153 eval "func_echo $func_quote_for_expand_result"
1154 }
1155
1156 if ${opt_dry_run-false}; then :; else
1157 eval "$lt_user_locale
1158 $my_cmd"
1159 my_status=$?
1160 eval "$lt_safe_locale"
1161 if test "$my_status" -eq 0; then :; else
1162 eval "(exit $my_status); $my_fail_exp"
1163 fi
1164 fi
1165}
1166
1167
cristy3ed852e2009-09-05 21:47:34 +00001168# func_version
1169# Echo version message to standard output and exit.
1170func_version ()
1171{
cristyfd9dcd42010-08-08 18:07:02 +00001172 $SED -n '/(C)/!b go
1173 :more
1174 /\./!{
1175 N
1176 s/\n# / /
1177 b more
1178 }
1179 :go
1180 /^# '$PROGRAM' (GNU /,/# warranty; / {
cristy3ed852e2009-09-05 21:47:34 +00001181 s/^# //
1182 s/^# *$//
1183 s/\((C)\)[ 0-9,-]*\( [1-9][0-9]*\)/\1\2/
1184 p
1185 }' < "$progpath"
1186 exit $?
1187}
1188
1189# func_usage
1190# Echo short help message to standard output and exit.
1191func_usage ()
1192{
cristyfd9dcd42010-08-08 18:07:02 +00001193 $SED -n '/^# Usage:/,/^# *.*--help/ {
cristy3ed852e2009-09-05 21:47:34 +00001194 s/^# //
1195 s/^# *$//
1196 s/\$progname/'$progname'/
1197 p
1198 }' < "$progpath"
cristyfd9dcd42010-08-08 18:07:02 +00001199 echo
cristy3ed852e2009-09-05 21:47:34 +00001200 $ECHO "run \`$progname --help | more' for full usage"
1201 exit $?
1202}
1203
cristyfd9dcd42010-08-08 18:07:02 +00001204# func_help [NOEXIT]
1205# Echo long help message to standard output and exit,
1206# unless 'noexit' is passed as argument.
cristy3ed852e2009-09-05 21:47:34 +00001207func_help ()
1208{
1209 $SED -n '/^# Usage:/,/# Report bugs to/ {
1210 s/^# //
1211 s/^# *$//
1212 s*\$progname*'$progname'*
1213 s*\$host*'"$host"'*
1214 s*\$SHELL*'"$SHELL"'*
1215 s*\$LTCC*'"$LTCC"'*
1216 s*\$LTCFLAGS*'"$LTCFLAGS"'*
1217 s*\$LD*'"$LD"'*
1218 s/\$with_gnu_ld/'"$with_gnu_ld"'/
1219 s/\$automake_version/'"`(automake --version) 2>/dev/null |$SED 1q`"'/
1220 s/\$autoconf_version/'"`(autoconf --version) 2>/dev/null |$SED 1q`"'/
1221 p
1222 }' < "$progpath"
cristyfd9dcd42010-08-08 18:07:02 +00001223 ret=$?
1224 if test -z "$1"; then
1225 exit $ret
1226 fi
cristy3ed852e2009-09-05 21:47:34 +00001227}
1228
1229# func_missing_arg argname
1230# Echo program name prefixed message to standard error and set global
1231# exit_cmd.
1232func_missing_arg ()
1233{
cristyfd9dcd42010-08-08 18:07:02 +00001234 func_error "missing argument for $1."
cristy3ed852e2009-09-05 21:47:34 +00001235 exit_cmd=exit
1236}
1237
1238exit_cmd=:
1239
1240
1241
1242
1243
cristy3ed852e2009-09-05 21:47:34 +00001244
1245magic="%%%MAGIC variable%%%"
1246magic_exe="%%%MAGIC EXE variable%%%"
1247
1248# Global variables.
1249# $mode is unset
1250nonopt=
1251execute_dlfiles=
1252preserve_args=
1253lo2o="s/\\.lo\$/.${objext}/"
1254o2lo="s/\\.${objext}\$/.lo/"
1255extracted_archives=
1256extracted_serial=0
1257
1258opt_dry_run=false
1259opt_duplicate_deps=false
1260opt_silent=false
1261opt_debug=:
1262
1263# If this variable is set in any of the actions, the command in it
1264# will be execed at the end. This prevents here-documents from being
1265# left over by shells.
1266exec_cmd=
1267
1268# func_fatal_configuration arg...
1269# Echo program name prefixed message to standard error, followed by
1270# a configuration failure hint, and exit.
1271func_fatal_configuration ()
1272{
1273 func_error ${1+"$@"}
1274 func_error "See the $PACKAGE documentation for more information."
1275 func_fatal_error "Fatal configuration error."
1276}
1277
1278
1279# func_config
1280# Display the configuration for all the tags in this script.
1281func_config ()
1282{
1283 re_begincf='^# ### BEGIN LIBTOOL'
1284 re_endcf='^# ### END LIBTOOL'
1285
1286 # Default configuration.
1287 $SED "1,/$re_begincf CONFIG/d;/$re_endcf CONFIG/,\$d" < "$progpath"
1288
1289 # Now print the configurations for the tags.
1290 for tagname in $taglist; do
1291 $SED -n "/$re_begincf TAG CONFIG: $tagname\$/,/$re_endcf TAG CONFIG: $tagname\$/p" < "$progpath"
1292 done
1293
1294 exit $?
1295}
1296
1297# func_features
1298# Display the features supported by this script.
1299func_features ()
1300{
cristyfd9dcd42010-08-08 18:07:02 +00001301 echo "host: $host"
cristy3ed852e2009-09-05 21:47:34 +00001302 if test "$build_libtool_libs" = yes; then
cristyfd9dcd42010-08-08 18:07:02 +00001303 echo "enable shared libraries"
cristy3ed852e2009-09-05 21:47:34 +00001304 else
cristyfd9dcd42010-08-08 18:07:02 +00001305 echo "disable shared libraries"
cristy3ed852e2009-09-05 21:47:34 +00001306 fi
1307 if test "$build_old_libs" = yes; then
cristyfd9dcd42010-08-08 18:07:02 +00001308 echo "enable static libraries"
cristy3ed852e2009-09-05 21:47:34 +00001309 else
cristyfd9dcd42010-08-08 18:07:02 +00001310 echo "disable static libraries"
cristy3ed852e2009-09-05 21:47:34 +00001311 fi
1312
1313 exit $?
1314}
1315
1316# func_enable_tag tagname
1317# Verify that TAGNAME is valid, and either flag an error and exit, or
1318# enable the TAGNAME tag. We also add TAGNAME to the global $taglist
1319# variable here.
1320func_enable_tag ()
1321{
1322 # Global variable:
1323 tagname="$1"
1324
1325 re_begincf="^# ### BEGIN LIBTOOL TAG CONFIG: $tagname\$"
1326 re_endcf="^# ### END LIBTOOL TAG CONFIG: $tagname\$"
1327 sed_extractcf="/$re_begincf/,/$re_endcf/p"
1328
1329 # Validate tagname.
1330 case $tagname in
1331 *[!-_A-Za-z0-9,/]*)
1332 func_fatal_error "invalid tag name: $tagname"
1333 ;;
1334 esac
1335
1336 # Don't test for the "default" C tag, as we know it's
1337 # there but not specially marked.
1338 case $tagname in
1339 CC) ;;
1340 *)
1341 if $GREP "$re_begincf" "$progpath" >/dev/null 2>&1; then
1342 taglist="$taglist $tagname"
1343
1344 # Evaluate the configuration. Be careful to quote the path
1345 # and the sed script, to avoid splitting on whitespace, but
1346 # also don't use non-portable quotes within backquotes within
1347 # quotes we have to do it in 2 steps:
1348 extractedcf=`$SED -n -e "$sed_extractcf" < "$progpath"`
1349 eval "$extractedcf"
1350 else
1351 func_error "ignoring unknown tag $tagname"
1352 fi
1353 ;;
1354 esac
1355}
1356
1357# Parse options once, thoroughly. This comes as soon as possible in
1358# the script to make things like `libtool --version' happen quickly.
1359{
1360
1361 # Shorthand for --mode=foo, only valid as the first argument
1362 case $1 in
1363 clean|clea|cle|cl)
1364 shift; set dummy --mode clean ${1+"$@"}; shift
1365 ;;
1366 compile|compil|compi|comp|com|co|c)
1367 shift; set dummy --mode compile ${1+"$@"}; shift
1368 ;;
1369 execute|execut|execu|exec|exe|ex|e)
1370 shift; set dummy --mode execute ${1+"$@"}; shift
1371 ;;
1372 finish|finis|fini|fin|fi|f)
1373 shift; set dummy --mode finish ${1+"$@"}; shift
1374 ;;
1375 install|instal|insta|inst|ins|in|i)
1376 shift; set dummy --mode install ${1+"$@"}; shift
1377 ;;
1378 link|lin|li|l)
1379 shift; set dummy --mode link ${1+"$@"}; shift
1380 ;;
1381 uninstall|uninstal|uninsta|uninst|unins|unin|uni|un|u)
1382 shift; set dummy --mode uninstall ${1+"$@"}; shift
1383 ;;
1384 esac
1385
1386 # Parse non-mode specific arguments:
1387 while test "$#" -gt 0; do
1388 opt="$1"
1389 shift
1390
1391 case $opt in
1392 --config) func_config ;;
1393
1394 --debug) preserve_args="$preserve_args $opt"
1395 func_echo "enabling shell trace mode"
1396 opt_debug='set -x'
1397 $opt_debug
1398 ;;
1399
1400 -dlopen) test "$#" -eq 0 && func_missing_arg "$opt" && break
1401 execute_dlfiles="$execute_dlfiles $1"
1402 shift
1403 ;;
1404
1405 --dry-run | -n) opt_dry_run=: ;;
1406 --features) func_features ;;
1407 --finish) mode="finish" ;;
1408
1409 --mode) test "$#" -eq 0 && func_missing_arg "$opt" && break
1410 case $1 in
1411 # Valid mode arguments:
1412 clean) ;;
1413 compile) ;;
1414 execute) ;;
1415 finish) ;;
1416 install) ;;
1417 link) ;;
1418 relink) ;;
1419 uninstall) ;;
1420
1421 # Catch anything else as an error
1422 *) func_error "invalid argument for $opt"
1423 exit_cmd=exit
1424 break
1425 ;;
1426 esac
1427
1428 mode="$1"
1429 shift
1430 ;;
1431
1432 --preserve-dup-deps)
1433 opt_duplicate_deps=: ;;
1434
1435 --quiet|--silent) preserve_args="$preserve_args $opt"
1436 opt_silent=:
cristyfd9dcd42010-08-08 18:07:02 +00001437 opt_verbose=false
1438 ;;
1439
1440 --no-quiet|--no-silent)
1441 preserve_args="$preserve_args $opt"
1442 opt_silent=false
cristy3ed852e2009-09-05 21:47:34 +00001443 ;;
1444
1445 --verbose| -v) preserve_args="$preserve_args $opt"
1446 opt_silent=false
cristyfd9dcd42010-08-08 18:07:02 +00001447 opt_verbose=:
1448 ;;
1449
1450 --no-verbose) preserve_args="$preserve_args $opt"
1451 opt_verbose=false
cristy3ed852e2009-09-05 21:47:34 +00001452 ;;
1453
1454 --tag) test "$#" -eq 0 && func_missing_arg "$opt" && break
1455 preserve_args="$preserve_args $opt $1"
1456 func_enable_tag "$1" # tagname is set here
1457 shift
1458 ;;
1459
1460 # Separate optargs to long options:
1461 -dlopen=*|--mode=*|--tag=*)
1462 func_opt_split "$opt"
1463 set dummy "$func_opt_split_opt" "$func_opt_split_arg" ${1+"$@"}
1464 shift
1465 ;;
1466
1467 -\?|-h) func_usage ;;
1468 --help) opt_help=: ;;
cristyfd9dcd42010-08-08 18:07:02 +00001469 --help-all) opt_help=': help-all' ;;
cristy3ed852e2009-09-05 21:47:34 +00001470 --version) func_version ;;
1471
1472 -*) func_fatal_help "unrecognized option \`$opt'" ;;
1473
1474 *) nonopt="$opt"
1475 break
1476 ;;
1477 esac
1478 done
1479
1480
1481 case $host in
1482 *cygwin* | *mingw* | *pw32* | *cegcc*)
1483 # don't eliminate duplications in $postdeps and $predeps
1484 opt_duplicate_compiler_generated_deps=:
1485 ;;
1486 *)
1487 opt_duplicate_compiler_generated_deps=$opt_duplicate_deps
1488 ;;
1489 esac
1490
1491 # Having warned about all mis-specified options, bail out if
1492 # anything was wrong.
1493 $exit_cmd $EXIT_FAILURE
1494}
1495
1496# func_check_version_match
1497# Ensure that we are using m4 macros, and libtool script from the same
1498# release of libtool.
1499func_check_version_match ()
1500{
1501 if test "$package_revision" != "$macro_revision"; then
1502 if test "$VERSION" != "$macro_version"; then
1503 if test -z "$macro_version"; then
1504 cat >&2 <<_LT_EOF
1505$progname: Version mismatch error. This is $PACKAGE $VERSION, but the
1506$progname: definition of this LT_INIT comes from an older release.
1507$progname: You should recreate aclocal.m4 with macros from $PACKAGE $VERSION
1508$progname: and run autoconf again.
1509_LT_EOF
1510 else
1511 cat >&2 <<_LT_EOF
1512$progname: Version mismatch error. This is $PACKAGE $VERSION, but the
1513$progname: definition of this LT_INIT comes from $PACKAGE $macro_version.
1514$progname: You should recreate aclocal.m4 with macros from $PACKAGE $VERSION
1515$progname: and run autoconf again.
1516_LT_EOF
1517 fi
1518 else
1519 cat >&2 <<_LT_EOF
1520$progname: Version mismatch error. This is $PACKAGE $VERSION, revision $package_revision,
1521$progname: but the definition of this LT_INIT comes from revision $macro_revision.
1522$progname: You should recreate aclocal.m4 with macros from revision $package_revision
1523$progname: of $PACKAGE $VERSION and run autoconf again.
1524_LT_EOF
1525 fi
1526
1527 exit $EXIT_MISMATCH
1528 fi
1529}
1530
1531
1532## ----------- ##
1533## Main. ##
1534## ----------- ##
1535
1536$opt_help || {
1537 # Sanity checks first:
1538 func_check_version_match
1539
1540 if test "$build_libtool_libs" != yes && test "$build_old_libs" != yes; then
1541 func_fatal_configuration "not configured to build any kind of library"
1542 fi
1543
1544 test -z "$mode" && func_fatal_error "error: you must specify a MODE."
1545
1546
1547 # Darwin sucks
1548 eval std_shrext=\"$shrext_cmds\"
1549
1550
1551 # Only execute mode is allowed to have -dlopen flags.
1552 if test -n "$execute_dlfiles" && test "$mode" != execute; then
1553 func_error "unrecognized option \`-dlopen'"
1554 $ECHO "$help" 1>&2
1555 exit $EXIT_FAILURE
1556 fi
1557
1558 # Change the help message to a mode-specific one.
1559 generic_help="$help"
1560 help="Try \`$progname --help --mode=$mode' for more information."
1561}
1562
1563
1564# func_lalib_p file
1565# True iff FILE is a libtool `.la' library or `.lo' object file.
1566# This function is only a basic sanity check; it will hardly flush out
1567# determined imposters.
1568func_lalib_p ()
1569{
1570 test -f "$1" &&
1571 $SED -e 4q "$1" 2>/dev/null \
1572 | $GREP "^# Generated by .*$PACKAGE" > /dev/null 2>&1
1573}
1574
1575# func_lalib_unsafe_p file
1576# True iff FILE is a libtool `.la' library or `.lo' object file.
1577# This function implements the same check as func_lalib_p without
1578# resorting to external programs. To this end, it redirects stdin and
1579# closes it afterwards, without saving the original file descriptor.
1580# As a safety measure, use it only where a negative result would be
1581# fatal anyway. Works if `file' does not exist.
1582func_lalib_unsafe_p ()
1583{
1584 lalib_p=no
1585 if test -f "$1" && test -r "$1" && exec 5<&0 <"$1"; then
1586 for lalib_p_l in 1 2 3 4
1587 do
1588 read lalib_p_line
1589 case "$lalib_p_line" in
1590 \#\ Generated\ by\ *$PACKAGE* ) lalib_p=yes; break;;
1591 esac
1592 done
1593 exec 0<&5 5<&-
1594 fi
1595 test "$lalib_p" = yes
1596}
1597
1598# func_ltwrapper_script_p file
1599# True iff FILE is a libtool wrapper script
1600# This function is only a basic sanity check; it will hardly flush out
1601# determined imposters.
1602func_ltwrapper_script_p ()
1603{
1604 func_lalib_p "$1"
1605}
1606
1607# func_ltwrapper_executable_p file
1608# True iff FILE is a libtool wrapper executable
1609# This function is only a basic sanity check; it will hardly flush out
1610# determined imposters.
1611func_ltwrapper_executable_p ()
1612{
1613 func_ltwrapper_exec_suffix=
1614 case $1 in
1615 *.exe) ;;
1616 *) func_ltwrapper_exec_suffix=.exe ;;
1617 esac
1618 $GREP "$magic_exe" "$1$func_ltwrapper_exec_suffix" >/dev/null 2>&1
1619}
1620
1621# func_ltwrapper_scriptname file
1622# Assumes file is an ltwrapper_executable
1623# uses $file to determine the appropriate filename for a
1624# temporary ltwrapper_script.
1625func_ltwrapper_scriptname ()
1626{
1627 func_ltwrapper_scriptname_result=""
1628 if func_ltwrapper_executable_p "$1"; then
1629 func_dirname_and_basename "$1" "" "."
1630 func_stripname '' '.exe' "$func_basename_result"
1631 func_ltwrapper_scriptname_result="$func_dirname_result/$objdir/${func_stripname_result}_ltshwrapper"
1632 fi
1633}
1634
1635# func_ltwrapper_p file
1636# True iff FILE is a libtool wrapper script or wrapper executable
1637# This function is only a basic sanity check; it will hardly flush out
1638# determined imposters.
1639func_ltwrapper_p ()
1640{
1641 func_ltwrapper_script_p "$1" || func_ltwrapper_executable_p "$1"
1642}
1643
1644
1645# func_execute_cmds commands fail_cmd
1646# Execute tilde-delimited COMMANDS.
1647# If FAIL_CMD is given, eval that upon failure.
1648# FAIL_CMD may read-access the current command in variable CMD!
1649func_execute_cmds ()
1650{
1651 $opt_debug
1652 save_ifs=$IFS; IFS='~'
1653 for cmd in $1; do
1654 IFS=$save_ifs
1655 eval cmd=\"$cmd\"
1656 func_show_eval "$cmd" "${2-:}"
1657 done
1658 IFS=$save_ifs
1659}
1660
1661
1662# func_source file
1663# Source FILE, adding directory component if necessary.
1664# Note that it is not necessary on cygwin/mingw to append a dot to
1665# FILE even if both FILE and FILE.exe exist: automatic-append-.exe
1666# behavior happens only for exec(3), not for open(2)! Also, sourcing
1667# `FILE.' does not work on cygwin managed mounts.
1668func_source ()
1669{
1670 $opt_debug
1671 case $1 in
1672 */* | *\\*) . "$1" ;;
1673 *) . "./$1" ;;
1674 esac
1675}
1676
1677
1678# func_infer_tag arg
1679# Infer tagged configuration to use if any are available and
1680# if one wasn't chosen via the "--tag" command line option.
1681# Only attempt this if the compiler in the base compile
1682# command doesn't match the default compiler.
1683# arg is usually of the form 'gcc ...'
1684func_infer_tag ()
1685{
1686 $opt_debug
1687 if test -n "$available_tags" && test -z "$tagname"; then
1688 CC_quoted=
1689 for arg in $CC; do
1690 func_quote_for_eval "$arg"
1691 CC_quoted="$CC_quoted $func_quote_for_eval_result"
1692 done
cristyfd9dcd42010-08-08 18:07:02 +00001693 CC_expanded=`func_echo_all $CC`
1694 CC_quoted_expanded=`func_echo_all $CC_quoted`
cristy3ed852e2009-09-05 21:47:34 +00001695 case $@ in
1696 # Blanks in the command may have been stripped by the calling shell,
1697 # but not from the CC environment variable when configure was run.
cristyfd9dcd42010-08-08 18:07:02 +00001698 " $CC "* | "$CC "* | " $CC_expanded "* | "$CC_expanded "* | \
1699 " $CC_quoted"* | "$CC_quoted "* | " $CC_quoted_expanded "* | "$CC_quoted_expanded "*) ;;
cristy3ed852e2009-09-05 21:47:34 +00001700 # Blanks at the start of $base_compile will cause this to fail
1701 # if we don't check for them as well.
1702 *)
1703 for z in $available_tags; do
1704 if $GREP "^# ### BEGIN LIBTOOL TAG CONFIG: $z$" < "$progpath" > /dev/null; then
1705 # Evaluate the configuration.
1706 eval "`${SED} -n -e '/^# ### BEGIN LIBTOOL TAG CONFIG: '$z'$/,/^# ### END LIBTOOL TAG CONFIG: '$z'$/p' < $progpath`"
1707 CC_quoted=
1708 for arg in $CC; do
1709 # Double-quote args containing other shell metacharacters.
1710 func_quote_for_eval "$arg"
1711 CC_quoted="$CC_quoted $func_quote_for_eval_result"
1712 done
cristyfd9dcd42010-08-08 18:07:02 +00001713 CC_expanded=`func_echo_all $CC`
1714 CC_quoted_expanded=`func_echo_all $CC_quoted`
cristy3ed852e2009-09-05 21:47:34 +00001715 case "$@ " in
cristyfd9dcd42010-08-08 18:07:02 +00001716 " $CC "* | "$CC "* | " $CC_expanded "* | "$CC_expanded "* | \
1717 " $CC_quoted"* | "$CC_quoted "* | " $CC_quoted_expanded "* | "$CC_quoted_expanded "*)
cristy3ed852e2009-09-05 21:47:34 +00001718 # The compiler in the base compile command matches
1719 # the one in the tagged configuration.
1720 # Assume this is the tagged configuration we want.
1721 tagname=$z
1722 break
1723 ;;
1724 esac
1725 fi
1726 done
1727 # If $tagname still isn't set, then no tagged configuration
1728 # was found and let the user know that the "--tag" command
1729 # line option must be used.
1730 if test -z "$tagname"; then
1731 func_echo "unable to infer tagged configuration"
1732 func_fatal_error "specify a tag with \`--tag'"
1733# else
1734# func_verbose "using $tagname tagged configuration"
1735 fi
1736 ;;
1737 esac
1738 fi
1739}
1740
1741
1742
1743# func_write_libtool_object output_name pic_name nonpic_name
1744# Create a libtool object file (analogous to a ".la" file),
1745# but don't create it if we're doing a dry run.
1746func_write_libtool_object ()
1747{
1748 write_libobj=${1}
1749 if test "$build_libtool_libs" = yes; then
1750 write_lobj=\'${2}\'
1751 else
1752 write_lobj=none
1753 fi
1754
1755 if test "$build_old_libs" = yes; then
1756 write_oldobj=\'${3}\'
1757 else
1758 write_oldobj=none
1759 fi
1760
1761 $opt_dry_run || {
1762 cat >${write_libobj}T <<EOF
1763# $write_libobj - a libtool object file
1764# Generated by $PROGRAM (GNU $PACKAGE$TIMESTAMP) $VERSION
1765#
1766# Please DO NOT delete this file!
1767# It is necessary for linking the library.
1768
1769# Name of the PIC object.
1770pic_object=$write_lobj
1771
1772# Name of the non-PIC object
1773non_pic_object=$write_oldobj
1774
1775EOF
1776 $MV "${write_libobj}T" "${write_libobj}"
1777 }
1778}
1779
1780# func_mode_compile arg...
1781func_mode_compile ()
1782{
1783 $opt_debug
1784 # Get the compilation command and the source file.
1785 base_compile=
1786 srcfile="$nonopt" # always keep a non-empty value in "srcfile"
1787 suppress_opt=yes
1788 suppress_output=
1789 arg_mode=normal
1790 libobj=
1791 later=
1792 pie_flag=
1793
1794 for arg
1795 do
1796 case $arg_mode in
1797 arg )
1798 # do not "continue". Instead, add this to base_compile
1799 lastarg="$arg"
1800 arg_mode=normal
1801 ;;
1802
1803 target )
1804 libobj="$arg"
1805 arg_mode=normal
1806 continue
1807 ;;
1808
1809 normal )
1810 # Accept any command-line options.
1811 case $arg in
1812 -o)
1813 test -n "$libobj" && \
1814 func_fatal_error "you cannot specify \`-o' more than once"
1815 arg_mode=target
1816 continue
1817 ;;
1818
1819 -pie | -fpie | -fPIE)
1820 pie_flag="$pie_flag $arg"
1821 continue
1822 ;;
1823
1824 -shared | -static | -prefer-pic | -prefer-non-pic)
1825 later="$later $arg"
1826 continue
1827 ;;
1828
1829 -no-suppress)
1830 suppress_opt=no
1831 continue
1832 ;;
1833
1834 -Xcompiler)
1835 arg_mode=arg # the next one goes into the "base_compile" arg list
1836 continue # The current "srcfile" will either be retained or
1837 ;; # replaced later. I would guess that would be a bug.
1838
1839 -Wc,*)
1840 func_stripname '-Wc,' '' "$arg"
1841 args=$func_stripname_result
1842 lastarg=
1843 save_ifs="$IFS"; IFS=','
1844 for arg in $args; do
1845 IFS="$save_ifs"
1846 func_quote_for_eval "$arg"
1847 lastarg="$lastarg $func_quote_for_eval_result"
1848 done
1849 IFS="$save_ifs"
1850 func_stripname ' ' '' "$lastarg"
1851 lastarg=$func_stripname_result
1852
1853 # Add the arguments to base_compile.
1854 base_compile="$base_compile $lastarg"
1855 continue
1856 ;;
1857
1858 *)
1859 # Accept the current argument as the source file.
1860 # The previous "srcfile" becomes the current argument.
1861 #
1862 lastarg="$srcfile"
1863 srcfile="$arg"
1864 ;;
1865 esac # case $arg
1866 ;;
1867 esac # case $arg_mode
1868
1869 # Aesthetically quote the previous argument.
1870 func_quote_for_eval "$lastarg"
1871 base_compile="$base_compile $func_quote_for_eval_result"
1872 done # for arg
1873
1874 case $arg_mode in
1875 arg)
1876 func_fatal_error "you must specify an argument for -Xcompile"
1877 ;;
1878 target)
1879 func_fatal_error "you must specify a target with \`-o'"
1880 ;;
1881 *)
1882 # Get the name of the library object.
1883 test -z "$libobj" && {
1884 func_basename "$srcfile"
1885 libobj="$func_basename_result"
1886 }
1887 ;;
1888 esac
1889
1890 # Recognize several different file suffixes.
1891 # If the user specifies -o file.o, it is replaced with file.lo
1892 case $libobj in
1893 *.[cCFSifmso] | \
1894 *.ada | *.adb | *.ads | *.asm | \
1895 *.c++ | *.cc | *.ii | *.class | *.cpp | *.cxx | \
cristyfd9dcd42010-08-08 18:07:02 +00001896 *.[fF][09]? | *.for | *.java | *.obj | *.sx | *.cu | *.cup)
cristy3ed852e2009-09-05 21:47:34 +00001897 func_xform "$libobj"
1898 libobj=$func_xform_result
1899 ;;
1900 esac
1901
1902 case $libobj in
1903 *.lo) func_lo2o "$libobj"; obj=$func_lo2o_result ;;
1904 *)
1905 func_fatal_error "cannot determine name of library object from \`$libobj'"
1906 ;;
1907 esac
1908
1909 func_infer_tag $base_compile
1910
1911 for arg in $later; do
1912 case $arg in
1913 -shared)
1914 test "$build_libtool_libs" != yes && \
1915 func_fatal_configuration "can not build a shared library"
1916 build_old_libs=no
1917 continue
1918 ;;
1919
1920 -static)
1921 build_libtool_libs=no
1922 build_old_libs=yes
1923 continue
1924 ;;
1925
1926 -prefer-pic)
1927 pic_mode=yes
1928 continue
1929 ;;
1930
1931 -prefer-non-pic)
1932 pic_mode=no
1933 continue
1934 ;;
1935 esac
1936 done
1937
1938 func_quote_for_eval "$libobj"
1939 test "X$libobj" != "X$func_quote_for_eval_result" \
1940 && $ECHO "X$libobj" | $GREP '[]~#^*{};<>?"'"'"' &()|`$[]' \
1941 && func_warning "libobj name \`$libobj' may not contain shell special characters."
1942 func_dirname_and_basename "$obj" "/" ""
1943 objname="$func_basename_result"
1944 xdir="$func_dirname_result"
1945 lobj=${xdir}$objdir/$objname
1946
1947 test -z "$base_compile" && \
1948 func_fatal_help "you must specify a compilation command"
1949
1950 # Delete any leftover library objects.
1951 if test "$build_old_libs" = yes; then
1952 removelist="$obj $lobj $libobj ${libobj}T"
1953 else
1954 removelist="$lobj $libobj ${libobj}T"
1955 fi
1956
1957 # On Cygwin there's no "real" PIC flag so we must build both object types
1958 case $host_os in
1959 cygwin* | mingw* | pw32* | os2* | cegcc*)
1960 pic_mode=default
1961 ;;
1962 esac
1963 if test "$pic_mode" = no && test "$deplibs_check_method" != pass_all; then
1964 # non-PIC code in shared libraries is not supported
1965 pic_mode=default
1966 fi
1967
1968 # Calculate the filename of the output object if compiler does
1969 # not support -o with -c
1970 if test "$compiler_c_o" = no; then
cristyfd9dcd42010-08-08 18:07:02 +00001971 output_obj=`$ECHO "$srcfile" | $SED 's%^.*/%%; s%\.[^.]*$%%'`.${objext}
cristy3ed852e2009-09-05 21:47:34 +00001972 lockfile="$output_obj.lock"
1973 else
1974 output_obj=
1975 need_locks=no
1976 lockfile=
1977 fi
1978
1979 # Lock this critical section if it is needed
1980 # We use this script file to make the link, it avoids creating a new file
1981 if test "$need_locks" = yes; then
1982 until $opt_dry_run || ln "$progpath" "$lockfile" 2>/dev/null; do
1983 func_echo "Waiting for $lockfile to be removed"
1984 sleep 2
1985 done
1986 elif test "$need_locks" = warn; then
1987 if test -f "$lockfile"; then
1988 $ECHO "\
1989*** ERROR, $lockfile exists and contains:
1990`cat $lockfile 2>/dev/null`
1991
1992This indicates that another process is trying to use the same
1993temporary object file, and libtool could not work around it because
1994your compiler does not support \`-c' and \`-o' together. If you
1995repeat this compilation, it may succeed, by chance, but you had better
1996avoid parallel builds (make -j) in this platform, or get a better
1997compiler."
1998
1999 $opt_dry_run || $RM $removelist
2000 exit $EXIT_FAILURE
2001 fi
2002 removelist="$removelist $output_obj"
2003 $ECHO "$srcfile" > "$lockfile"
2004 fi
2005
2006 $opt_dry_run || $RM $removelist
2007 removelist="$removelist $lockfile"
2008 trap '$opt_dry_run || $RM $removelist; exit $EXIT_FAILURE' 1 2 15
2009
2010 if test -n "$fix_srcfile_path"; then
2011 eval srcfile=\"$fix_srcfile_path\"
2012 fi
2013 func_quote_for_eval "$srcfile"
2014 qsrcfile=$func_quote_for_eval_result
2015
2016 # Only build a PIC object if we are building libtool libraries.
2017 if test "$build_libtool_libs" = yes; then
2018 # Without this assignment, base_compile gets emptied.
2019 fbsd_hideous_sh_bug=$base_compile
2020
2021 if test "$pic_mode" != no; then
2022 command="$base_compile $qsrcfile $pic_flag"
2023 else
2024 # Don't build PIC code
2025 command="$base_compile $qsrcfile"
2026 fi
2027
2028 func_mkdir_p "$xdir$objdir"
2029
2030 if test -z "$output_obj"; then
2031 # Place PIC objects in $objdir
2032 command="$command -o $lobj"
2033 fi
2034
2035 func_show_eval_locale "$command" \
2036 'test -n "$output_obj" && $RM $removelist; exit $EXIT_FAILURE'
2037
2038 if test "$need_locks" = warn &&
2039 test "X`cat $lockfile 2>/dev/null`" != "X$srcfile"; then
2040 $ECHO "\
2041*** ERROR, $lockfile contains:
2042`cat $lockfile 2>/dev/null`
2043
2044but it should contain:
2045$srcfile
2046
2047This indicates that another process is trying to use the same
2048temporary object file, and libtool could not work around it because
2049your compiler does not support \`-c' and \`-o' together. If you
2050repeat this compilation, it may succeed, by chance, but you had better
2051avoid parallel builds (make -j) in this platform, or get a better
2052compiler."
2053
2054 $opt_dry_run || $RM $removelist
2055 exit $EXIT_FAILURE
2056 fi
2057
2058 # Just move the object if needed, then go on to compile the next one
2059 if test -n "$output_obj" && test "X$output_obj" != "X$lobj"; then
2060 func_show_eval '$MV "$output_obj" "$lobj"' \
2061 'error=$?; $opt_dry_run || $RM $removelist; exit $error'
2062 fi
2063
2064 # Allow error messages only from the first compilation.
2065 if test "$suppress_opt" = yes; then
2066 suppress_output=' >/dev/null 2>&1'
2067 fi
2068 fi
2069
2070 # Only build a position-dependent object if we build old libraries.
2071 if test "$build_old_libs" = yes; then
2072 if test "$pic_mode" != yes; then
2073 # Don't build PIC code
2074 command="$base_compile $qsrcfile$pie_flag"
2075 else
2076 command="$base_compile $qsrcfile $pic_flag"
2077 fi
2078 if test "$compiler_c_o" = yes; then
2079 command="$command -o $obj"
2080 fi
2081
2082 # Suppress compiler output if we already did a PIC compilation.
2083 command="$command$suppress_output"
2084 func_show_eval_locale "$command" \
2085 '$opt_dry_run || $RM $removelist; exit $EXIT_FAILURE'
2086
2087 if test "$need_locks" = warn &&
2088 test "X`cat $lockfile 2>/dev/null`" != "X$srcfile"; then
2089 $ECHO "\
2090*** ERROR, $lockfile contains:
2091`cat $lockfile 2>/dev/null`
2092
2093but it should contain:
2094$srcfile
2095
2096This indicates that another process is trying to use the same
2097temporary object file, and libtool could not work around it because
2098your compiler does not support \`-c' and \`-o' together. If you
2099repeat this compilation, it may succeed, by chance, but you had better
2100avoid parallel builds (make -j) in this platform, or get a better
2101compiler."
2102
2103 $opt_dry_run || $RM $removelist
2104 exit $EXIT_FAILURE
2105 fi
2106
2107 # Just move the object if needed
2108 if test -n "$output_obj" && test "X$output_obj" != "X$obj"; then
2109 func_show_eval '$MV "$output_obj" "$obj"' \
2110 'error=$?; $opt_dry_run || $RM $removelist; exit $error'
2111 fi
2112 fi
2113
2114 $opt_dry_run || {
2115 func_write_libtool_object "$libobj" "$objdir/$objname" "$objname"
2116
2117 # Unlock the critical section if it was locked
2118 if test "$need_locks" != no; then
2119 removelist=$lockfile
2120 $RM "$lockfile"
2121 fi
2122 }
2123
2124 exit $EXIT_SUCCESS
2125}
2126
2127$opt_help || {
cristyfd9dcd42010-08-08 18:07:02 +00002128 test "$mode" = compile && func_mode_compile ${1+"$@"}
cristy3ed852e2009-09-05 21:47:34 +00002129}
2130
2131func_mode_help ()
2132{
2133 # We need to display help for each of the modes.
2134 case $mode in
2135 "")
2136 # Generic help is extracted from the usage comments
2137 # at the start of this file.
2138 func_help
2139 ;;
2140
2141 clean)
2142 $ECHO \
2143"Usage: $progname [OPTION]... --mode=clean RM [RM-OPTION]... FILE...
2144
2145Remove files from the build directory.
2146
2147RM is the name of the program to use to delete files associated with each FILE
2148(typically \`/bin/rm'). RM-OPTIONS are options (such as \`-f') to be passed
2149to RM.
2150
2151If FILE is a libtool library, object or program, all the files associated
2152with it are deleted. Otherwise, only FILE itself is deleted using RM."
2153 ;;
2154
2155 compile)
2156 $ECHO \
2157"Usage: $progname [OPTION]... --mode=compile COMPILE-COMMAND... SOURCEFILE
2158
2159Compile a source file into a libtool library object.
2160
2161This mode accepts the following additional options:
2162
2163 -o OUTPUT-FILE set the output file name to OUTPUT-FILE
2164 -no-suppress do not suppress compiler output for multiple passes
cristyfd9dcd42010-08-08 18:07:02 +00002165 -prefer-pic try to build PIC objects only
2166 -prefer-non-pic try to build non-PIC objects only
cristy3ed852e2009-09-05 21:47:34 +00002167 -shared do not build a \`.o' file suitable for static linking
2168 -static only build a \`.o' file suitable for static linking
cristyfd9dcd42010-08-08 18:07:02 +00002169 -Wc,FLAG pass FLAG directly to the compiler
cristy3ed852e2009-09-05 21:47:34 +00002170
2171COMPILE-COMMAND is a command to be used in creating a \`standard' object file
2172from the given SOURCEFILE.
2173
2174The output file name is determined by removing the directory component from
2175SOURCEFILE, then substituting the C source code suffix \`.c' with the
2176library object suffix, \`.lo'."
2177 ;;
2178
2179 execute)
2180 $ECHO \
2181"Usage: $progname [OPTION]... --mode=execute COMMAND [ARGS]...
2182
2183Automatically set library path, then run a program.
2184
2185This mode accepts the following additional options:
2186
2187 -dlopen FILE add the directory containing FILE to the library path
2188
2189This mode sets the library path environment variable according to \`-dlopen'
2190flags.
2191
2192If any of the ARGS are libtool executable wrappers, then they are translated
2193into their corresponding uninstalled binary, and any of their required library
2194directories are added to the library path.
2195
2196Then, COMMAND is executed, with ARGS as arguments."
2197 ;;
2198
2199 finish)
2200 $ECHO \
2201"Usage: $progname [OPTION]... --mode=finish [LIBDIR]...
2202
2203Complete the installation of libtool libraries.
2204
2205Each LIBDIR is a directory that contains libtool libraries.
2206
2207The commands that this mode executes may require superuser privileges. Use
2208the \`--dry-run' option if you just want to see what would be executed."
2209 ;;
2210
2211 install)
2212 $ECHO \
2213"Usage: $progname [OPTION]... --mode=install INSTALL-COMMAND...
2214
2215Install executables or libraries.
2216
2217INSTALL-COMMAND is the installation command. The first component should be
2218either the \`install' or \`cp' program.
2219
2220The following components of INSTALL-COMMAND are treated specially:
2221
cristyfd9dcd42010-08-08 18:07:02 +00002222 -inst-prefix-dir PREFIX-DIR Use PREFIX-DIR as a staging area for installation
cristy3ed852e2009-09-05 21:47:34 +00002223
2224The rest of the components are interpreted as arguments to that command (only
2225BSD-compatible install options are recognized)."
2226 ;;
2227
2228 link)
2229 $ECHO \
2230"Usage: $progname [OPTION]... --mode=link LINK-COMMAND...
2231
2232Link object files or libraries together to form another library, or to
2233create an executable program.
2234
2235LINK-COMMAND is a command using the C compiler that you would use to create
2236a program from several object files.
2237
2238The following components of LINK-COMMAND are treated specially:
2239
2240 -all-static do not do any dynamic linking at all
2241 -avoid-version do not add a version suffix if possible
cristyfd9dcd42010-08-08 18:07:02 +00002242 -bindir BINDIR specify path to binaries directory (for systems where
2243 libraries must be found in the PATH setting at runtime)
cristy3ed852e2009-09-05 21:47:34 +00002244 -dlopen FILE \`-dlpreopen' FILE if it cannot be dlopened at runtime
2245 -dlpreopen FILE link in FILE and add its symbols to lt_preloaded_symbols
2246 -export-dynamic allow symbols from OUTPUT-FILE to be resolved with dlsym(3)
2247 -export-symbols SYMFILE
2248 try to export only the symbols listed in SYMFILE
2249 -export-symbols-regex REGEX
2250 try to export only the symbols matching REGEX
2251 -LLIBDIR search LIBDIR for required installed libraries
2252 -lNAME OUTPUT-FILE requires the installed library libNAME
2253 -module build a library that can dlopened
2254 -no-fast-install disable the fast-install mode
2255 -no-install link a not-installable executable
2256 -no-undefined declare that a library does not refer to external symbols
2257 -o OUTPUT-FILE create OUTPUT-FILE from the specified objects
2258 -objectlist FILE Use a list of object files found in FILE to specify objects
2259 -precious-files-regex REGEX
2260 don't remove output files matching REGEX
2261 -release RELEASE specify package release information
2262 -rpath LIBDIR the created library will eventually be installed in LIBDIR
2263 -R[ ]LIBDIR add LIBDIR to the runtime path of programs and libraries
2264 -shared only do dynamic linking of libtool libraries
2265 -shrext SUFFIX override the standard shared library file extension
2266 -static do not do any dynamic linking of uninstalled libtool libraries
2267 -static-libtool-libs
2268 do not do any dynamic linking of libtool libraries
2269 -version-info CURRENT[:REVISION[:AGE]]
2270 specify library version info [each variable defaults to 0]
2271 -weak LIBNAME declare that the target provides the LIBNAME interface
cristyfd9dcd42010-08-08 18:07:02 +00002272 -Wc,FLAG
2273 -Xcompiler FLAG pass linker-specific FLAG directly to the compiler
2274 -Wl,FLAG
2275 -Xlinker FLAG pass linker-specific FLAG directly to the linker
2276 -XCClinker FLAG pass link-specific FLAG to the compiler driver (CC)
cristy3ed852e2009-09-05 21:47:34 +00002277
2278All other options (arguments beginning with \`-') are ignored.
2279
2280Every other argument is treated as a filename. Files ending in \`.la' are
2281treated as uninstalled libtool libraries, other files are standard or library
2282object files.
2283
2284If the OUTPUT-FILE ends in \`.la', then a libtool library is created,
2285only library objects (\`.lo' files) may be specified, and \`-rpath' is
2286required, except when creating a convenience library.
2287
2288If OUTPUT-FILE ends in \`.a' or \`.lib', then a standard library is created
2289using \`ar' and \`ranlib', or on Windows using \`lib'.
2290
2291If OUTPUT-FILE ends in \`.lo' or \`.${objext}', then a reloadable object file
2292is created, otherwise an executable program is created."
2293 ;;
2294
2295 uninstall)
2296 $ECHO \
2297"Usage: $progname [OPTION]... --mode=uninstall RM [RM-OPTION]... FILE...
2298
2299Remove libraries from an installation directory.
2300
2301RM is the name of the program to use to delete files associated with each FILE
2302(typically \`/bin/rm'). RM-OPTIONS are options (such as \`-f') to be passed
2303to RM.
2304
2305If FILE is a libtool library, all the files associated with it are deleted.
2306Otherwise, only FILE itself is deleted using RM."
2307 ;;
2308
2309 *)
2310 func_fatal_help "invalid operation mode \`$mode'"
2311 ;;
2312 esac
2313
cristyfd9dcd42010-08-08 18:07:02 +00002314 echo
cristy3ed852e2009-09-05 21:47:34 +00002315 $ECHO "Try \`$progname --help' for more information about other modes."
cristy3ed852e2009-09-05 21:47:34 +00002316}
2317
cristyfd9dcd42010-08-08 18:07:02 +00002318# Now that we've collected a possible --mode arg, show help if necessary
2319if $opt_help; then
2320 if test "$opt_help" = :; then
2321 func_mode_help
2322 else
2323 {
2324 func_help noexit
2325 for mode in compile link execute install finish uninstall clean; do
2326 func_mode_help
2327 done
2328 } | sed -n '1p; 2,$s/^Usage:/ or: /p'
2329 {
2330 func_help noexit
2331 for mode in compile link execute install finish uninstall clean; do
2332 echo
2333 func_mode_help
2334 done
2335 } |
2336 sed '1d
2337 /^When reporting/,/^Report/{
2338 H
2339 d
2340 }
2341 $x
2342 /information about other modes/d
2343 /more detailed .*MODE/d
2344 s/^Usage:.*--mode=\([^ ]*\) .*/Description of \1 mode:/'
2345 fi
2346 exit $?
2347fi
cristy3ed852e2009-09-05 21:47:34 +00002348
2349
2350# func_mode_execute arg...
2351func_mode_execute ()
2352{
2353 $opt_debug
2354 # The first argument is the command name.
2355 cmd="$nonopt"
2356 test -z "$cmd" && \
2357 func_fatal_help "you must specify a COMMAND"
2358
2359 # Handle -dlopen flags immediately.
2360 for file in $execute_dlfiles; do
2361 test -f "$file" \
2362 || func_fatal_help "\`$file' is not a file"
2363
2364 dir=
2365 case $file in
2366 *.la)
2367 # Check to see that this really is a libtool archive.
2368 func_lalib_unsafe_p "$file" \
2369 || func_fatal_help "\`$lib' is not a valid libtool archive"
2370
2371 # Read the libtool library.
2372 dlname=
2373 library_names=
2374 func_source "$file"
2375
2376 # Skip this library if it cannot be dlopened.
2377 if test -z "$dlname"; then
2378 # Warn if it was a shared library.
2379 test -n "$library_names" && \
2380 func_warning "\`$file' was not linked with \`-export-dynamic'"
2381 continue
2382 fi
2383
2384 func_dirname "$file" "" "."
2385 dir="$func_dirname_result"
2386
2387 if test -f "$dir/$objdir/$dlname"; then
2388 dir="$dir/$objdir"
2389 else
2390 if test ! -f "$dir/$dlname"; then
2391 func_fatal_error "cannot find \`$dlname' in \`$dir' or \`$dir/$objdir'"
2392 fi
2393 fi
2394 ;;
2395
2396 *.lo)
2397 # Just add the directory containing the .lo file.
2398 func_dirname "$file" "" "."
2399 dir="$func_dirname_result"
2400 ;;
2401
2402 *)
2403 func_warning "\`-dlopen' is ignored for non-libtool libraries and objects"
2404 continue
2405 ;;
2406 esac
2407
2408 # Get the absolute pathname.
2409 absdir=`cd "$dir" && pwd`
2410 test -n "$absdir" && dir="$absdir"
2411
2412 # Now add the directory to shlibpath_var.
2413 if eval "test -z \"\$$shlibpath_var\""; then
2414 eval "$shlibpath_var=\"\$dir\""
2415 else
2416 eval "$shlibpath_var=\"\$dir:\$$shlibpath_var\""
2417 fi
2418 done
2419
2420 # This variable tells wrapper scripts just to set shlibpath_var
2421 # rather than running their programs.
2422 libtool_execute_magic="$magic"
2423
2424 # Check if any of the arguments is a wrapper script.
2425 args=
2426 for file
2427 do
2428 case $file in
cristyfd9dcd42010-08-08 18:07:02 +00002429 -* | *.la | *.lo ) ;;
cristy3ed852e2009-09-05 21:47:34 +00002430 *)
2431 # Do a test to see if this is really a libtool program.
2432 if func_ltwrapper_script_p "$file"; then
2433 func_source "$file"
2434 # Transform arg to wrapped name.
2435 file="$progdir/$program"
2436 elif func_ltwrapper_executable_p "$file"; then
2437 func_ltwrapper_scriptname "$file"
2438 func_source "$func_ltwrapper_scriptname_result"
2439 # Transform arg to wrapped name.
2440 file="$progdir/$program"
2441 fi
2442 ;;
2443 esac
2444 # Quote arguments (to preserve shell metacharacters).
2445 func_quote_for_eval "$file"
2446 args="$args $func_quote_for_eval_result"
2447 done
2448
2449 if test "X$opt_dry_run" = Xfalse; then
2450 if test -n "$shlibpath_var"; then
2451 # Export the shlibpath_var.
2452 eval "export $shlibpath_var"
2453 fi
2454
2455 # Restore saved environment variables
2456 for lt_var in LANG LANGUAGE LC_ALL LC_CTYPE LC_COLLATE LC_MESSAGES
2457 do
2458 eval "if test \"\${save_$lt_var+set}\" = set; then
2459 $lt_var=\$save_$lt_var; export $lt_var
2460 else
2461 $lt_unset $lt_var
2462 fi"
2463 done
2464
2465 # Now prepare to actually exec the command.
2466 exec_cmd="\$cmd$args"
2467 else
2468 # Display what would be done.
2469 if test -n "$shlibpath_var"; then
2470 eval "\$ECHO \"\$shlibpath_var=\$$shlibpath_var\""
cristyfd9dcd42010-08-08 18:07:02 +00002471 echo "export $shlibpath_var"
cristy3ed852e2009-09-05 21:47:34 +00002472 fi
2473 $ECHO "$cmd$args"
2474 exit $EXIT_SUCCESS
2475 fi
2476}
2477
2478test "$mode" = execute && func_mode_execute ${1+"$@"}
2479
2480
2481# func_mode_finish arg...
2482func_mode_finish ()
2483{
2484 $opt_debug
2485 libdirs="$nonopt"
2486 admincmds=
2487
2488 if test -n "$finish_cmds$finish_eval" && test -n "$libdirs"; then
2489 for dir
2490 do
2491 libdirs="$libdirs $dir"
2492 done
2493
2494 for libdir in $libdirs; do
2495 if test -n "$finish_cmds"; then
2496 # Do each command in the finish commands.
2497 func_execute_cmds "$finish_cmds" 'admincmds="$admincmds
2498'"$cmd"'"'
2499 fi
2500 if test -n "$finish_eval"; then
2501 # Do the single finish_eval.
2502 eval cmds=\"$finish_eval\"
2503 $opt_dry_run || eval "$cmds" || admincmds="$admincmds
2504 $cmds"
2505 fi
2506 done
2507 fi
2508
2509 # Exit here if they wanted silent mode.
2510 $opt_silent && exit $EXIT_SUCCESS
2511
cristyfd9dcd42010-08-08 18:07:02 +00002512 echo "----------------------------------------------------------------------"
2513 echo "Libraries have been installed in:"
cristy3ed852e2009-09-05 21:47:34 +00002514 for libdir in $libdirs; do
2515 $ECHO " $libdir"
2516 done
cristyfd9dcd42010-08-08 18:07:02 +00002517 echo
2518 echo "If you ever happen to want to link against installed libraries"
2519 echo "in a given directory, LIBDIR, you must either use libtool, and"
2520 echo "specify the full pathname of the library, or use the \`-LLIBDIR'"
2521 echo "flag during linking and do at least one of the following:"
cristy3ed852e2009-09-05 21:47:34 +00002522 if test -n "$shlibpath_var"; then
cristyfd9dcd42010-08-08 18:07:02 +00002523 echo " - add LIBDIR to the \`$shlibpath_var' environment variable"
2524 echo " during execution"
cristy3ed852e2009-09-05 21:47:34 +00002525 fi
2526 if test -n "$runpath_var"; then
cristyfd9dcd42010-08-08 18:07:02 +00002527 echo " - add LIBDIR to the \`$runpath_var' environment variable"
2528 echo " during linking"
cristy3ed852e2009-09-05 21:47:34 +00002529 fi
2530 if test -n "$hardcode_libdir_flag_spec"; then
2531 libdir=LIBDIR
2532 eval flag=\"$hardcode_libdir_flag_spec\"
2533
2534 $ECHO " - use the \`$flag' linker flag"
2535 fi
2536 if test -n "$admincmds"; then
2537 $ECHO " - have your system administrator run these commands:$admincmds"
2538 fi
2539 if test -f /etc/ld.so.conf; then
cristyfd9dcd42010-08-08 18:07:02 +00002540 echo " - have your system administrator add LIBDIR to \`/etc/ld.so.conf'"
cristy3ed852e2009-09-05 21:47:34 +00002541 fi
cristyfd9dcd42010-08-08 18:07:02 +00002542 echo
cristy3ed852e2009-09-05 21:47:34 +00002543
cristyfd9dcd42010-08-08 18:07:02 +00002544 echo "See any operating system documentation about shared libraries for"
cristy3ed852e2009-09-05 21:47:34 +00002545 case $host in
2546 solaris2.[6789]|solaris2.1[0-9])
cristyfd9dcd42010-08-08 18:07:02 +00002547 echo "more information, such as the ld(1), crle(1) and ld.so(8) manual"
2548 echo "pages."
cristy3ed852e2009-09-05 21:47:34 +00002549 ;;
2550 *)
cristyfd9dcd42010-08-08 18:07:02 +00002551 echo "more information, such as the ld(1) and ld.so(8) manual pages."
cristy3ed852e2009-09-05 21:47:34 +00002552 ;;
2553 esac
cristyfd9dcd42010-08-08 18:07:02 +00002554 echo "----------------------------------------------------------------------"
cristy3ed852e2009-09-05 21:47:34 +00002555 exit $EXIT_SUCCESS
2556}
2557
2558test "$mode" = finish && func_mode_finish ${1+"$@"}
2559
2560
2561# func_mode_install arg...
2562func_mode_install ()
2563{
2564 $opt_debug
2565 # There may be an optional sh(1) argument at the beginning of
2566 # install_prog (especially on Windows NT).
2567 if test "$nonopt" = "$SHELL" || test "$nonopt" = /bin/sh ||
2568 # Allow the use of GNU shtool's install command.
cristyfd9dcd42010-08-08 18:07:02 +00002569 case $nonopt in *shtool*) :;; *) false;; esac; then
cristy3ed852e2009-09-05 21:47:34 +00002570 # Aesthetically quote it.
2571 func_quote_for_eval "$nonopt"
2572 install_prog="$func_quote_for_eval_result "
2573 arg=$1
2574 shift
2575 else
2576 install_prog=
2577 arg=$nonopt
2578 fi
2579
2580 # The real first argument should be the name of the installation program.
2581 # Aesthetically quote it.
2582 func_quote_for_eval "$arg"
2583 install_prog="$install_prog$func_quote_for_eval_result"
cristyfd9dcd42010-08-08 18:07:02 +00002584 install_shared_prog=$install_prog
2585 case " $install_prog " in
2586 *[\\\ /]cp\ *) install_cp=: ;;
2587 *) install_cp=false ;;
2588 esac
cristy3ed852e2009-09-05 21:47:34 +00002589
2590 # We need to accept at least all the BSD install flags.
2591 dest=
2592 files=
2593 opts=
2594 prev=
2595 install_type=
2596 isdir=no
2597 stripme=
cristyfd9dcd42010-08-08 18:07:02 +00002598 no_mode=:
cristy3ed852e2009-09-05 21:47:34 +00002599 for arg
2600 do
cristyfd9dcd42010-08-08 18:07:02 +00002601 arg2=
cristy3ed852e2009-09-05 21:47:34 +00002602 if test -n "$dest"; then
2603 files="$files $dest"
2604 dest=$arg
2605 continue
2606 fi
2607
2608 case $arg in
2609 -d) isdir=yes ;;
2610 -f)
cristyfd9dcd42010-08-08 18:07:02 +00002611 if $install_cp; then :; else
2612 prev=$arg
2613 fi
cristy3ed852e2009-09-05 21:47:34 +00002614 ;;
2615 -g | -m | -o)
2616 prev=$arg
2617 ;;
2618 -s)
2619 stripme=" -s"
2620 continue
2621 ;;
2622 -*)
2623 ;;
2624 *)
2625 # If the previous option needed an argument, then skip it.
2626 if test -n "$prev"; then
cristyfd9dcd42010-08-08 18:07:02 +00002627 if test "x$prev" = x-m && test -n "$install_override_mode"; then
2628 arg2=$install_override_mode
2629 no_mode=false
2630 fi
cristy3ed852e2009-09-05 21:47:34 +00002631 prev=
2632 else
2633 dest=$arg
2634 continue
2635 fi
2636 ;;
2637 esac
2638
2639 # Aesthetically quote the argument.
2640 func_quote_for_eval "$arg"
2641 install_prog="$install_prog $func_quote_for_eval_result"
cristyfd9dcd42010-08-08 18:07:02 +00002642 if test -n "$arg2"; then
2643 func_quote_for_eval "$arg2"
2644 fi
2645 install_shared_prog="$install_shared_prog $func_quote_for_eval_result"
cristy3ed852e2009-09-05 21:47:34 +00002646 done
2647
2648 test -z "$install_prog" && \
2649 func_fatal_help "you must specify an install program"
2650
2651 test -n "$prev" && \
2652 func_fatal_help "the \`$prev' option requires an argument"
2653
cristyfd9dcd42010-08-08 18:07:02 +00002654 if test -n "$install_override_mode" && $no_mode; then
2655 if $install_cp; then :; else
2656 func_quote_for_eval "$install_override_mode"
2657 install_shared_prog="$install_shared_prog -m $func_quote_for_eval_result"
2658 fi
2659 fi
2660
cristy3ed852e2009-09-05 21:47:34 +00002661 if test -z "$files"; then
2662 if test -z "$dest"; then
2663 func_fatal_help "no file or destination specified"
2664 else
2665 func_fatal_help "you must specify a destination"
2666 fi
2667 fi
2668
2669 # Strip any trailing slash from the destination.
2670 func_stripname '' '/' "$dest"
2671 dest=$func_stripname_result
2672
2673 # Check to see that the destination is a directory.
2674 test -d "$dest" && isdir=yes
2675 if test "$isdir" = yes; then
2676 destdir="$dest"
2677 destname=
2678 else
2679 func_dirname_and_basename "$dest" "" "."
2680 destdir="$func_dirname_result"
2681 destname="$func_basename_result"
2682
2683 # Not a directory, so check to see that there is only one file specified.
2684 set dummy $files; shift
2685 test "$#" -gt 1 && \
2686 func_fatal_help "\`$dest' is not a directory"
2687 fi
2688 case $destdir in
2689 [\\/]* | [A-Za-z]:[\\/]*) ;;
2690 *)
2691 for file in $files; do
2692 case $file in
2693 *.lo) ;;
2694 *)
2695 func_fatal_help "\`$destdir' must be an absolute directory name"
2696 ;;
2697 esac
2698 done
2699 ;;
2700 esac
2701
2702 # This variable tells wrapper scripts just to set variables rather
2703 # than running their programs.
2704 libtool_install_magic="$magic"
2705
2706 staticlibs=
2707 future_libdirs=
2708 current_libdirs=
2709 for file in $files; do
2710
2711 # Do each installation.
2712 case $file in
2713 *.$libext)
2714 # Do the static libraries later.
2715 staticlibs="$staticlibs $file"
2716 ;;
2717
2718 *.la)
2719 # Check to see that this really is a libtool archive.
2720 func_lalib_unsafe_p "$file" \
2721 || func_fatal_help "\`$file' is not a valid libtool archive"
2722
2723 library_names=
2724 old_library=
2725 relink_command=
2726 func_source "$file"
2727
2728 # Add the libdir to current_libdirs if it is the destination.
2729 if test "X$destdir" = "X$libdir"; then
2730 case "$current_libdirs " in
2731 *" $libdir "*) ;;
2732 *) current_libdirs="$current_libdirs $libdir" ;;
2733 esac
2734 else
2735 # Note the libdir as a future libdir.
2736 case "$future_libdirs " in
2737 *" $libdir "*) ;;
2738 *) future_libdirs="$future_libdirs $libdir" ;;
2739 esac
2740 fi
2741
2742 func_dirname "$file" "/" ""
2743 dir="$func_dirname_result"
2744 dir="$dir$objdir"
2745
2746 if test -n "$relink_command"; then
2747 # Determine the prefix the user has applied to our future dir.
cristyfd9dcd42010-08-08 18:07:02 +00002748 inst_prefix_dir=`$ECHO "$destdir" | $SED -e "s%$libdir\$%%"`
cristy3ed852e2009-09-05 21:47:34 +00002749
2750 # Don't allow the user to place us outside of our expected
2751 # location b/c this prevents finding dependent libraries that
2752 # are installed to the same prefix.
2753 # At present, this check doesn't affect windows .dll's that
2754 # are installed into $libdir/../bin (currently, that works fine)
2755 # but it's something to keep an eye on.
2756 test "$inst_prefix_dir" = "$destdir" && \
2757 func_fatal_error "error: cannot install \`$file' to a directory not ending in $libdir"
2758
2759 if test -n "$inst_prefix_dir"; then
2760 # Stick the inst_prefix_dir data into the link command.
cristyfd9dcd42010-08-08 18:07:02 +00002761 relink_command=`$ECHO "$relink_command" | $SED "s%@inst_prefix_dir@%-inst-prefix-dir $inst_prefix_dir%"`
cristy3ed852e2009-09-05 21:47:34 +00002762 else
cristyfd9dcd42010-08-08 18:07:02 +00002763 relink_command=`$ECHO "$relink_command" | $SED "s%@inst_prefix_dir@%%"`
cristy3ed852e2009-09-05 21:47:34 +00002764 fi
2765
2766 func_warning "relinking \`$file'"
2767 func_show_eval "$relink_command" \
2768 'func_fatal_error "error: relink \`$file'\'' with the above command before installing it"'
2769 fi
2770
2771 # See the names of the shared library.
2772 set dummy $library_names; shift
2773 if test -n "$1"; then
2774 realname="$1"
2775 shift
2776
2777 srcname="$realname"
2778 test -n "$relink_command" && srcname="$realname"T
2779
2780 # Install the shared library and build the symlinks.
cristyfd9dcd42010-08-08 18:07:02 +00002781 func_show_eval "$install_shared_prog $dir/$srcname $destdir/$realname" \
cristy3ed852e2009-09-05 21:47:34 +00002782 'exit $?'
2783 tstripme="$stripme"
2784 case $host_os in
2785 cygwin* | mingw* | pw32* | cegcc*)
2786 case $realname in
2787 *.dll.a)
2788 tstripme=""
2789 ;;
2790 esac
2791 ;;
2792 esac
2793 if test -n "$tstripme" && test -n "$striplib"; then
2794 func_show_eval "$striplib $destdir/$realname" 'exit $?'
2795 fi
2796
2797 if test "$#" -gt 0; then
2798 # Delete the old symlinks, and create new ones.
2799 # Try `ln -sf' first, because the `ln' binary might depend on
2800 # the symlink we replace! Solaris /bin/ln does not understand -f,
2801 # so we also need to try rm && ln -s.
2802 for linkname
2803 do
2804 test "$linkname" != "$realname" \
2805 && func_show_eval "(cd $destdir && { $LN_S -f $realname $linkname || { $RM $linkname && $LN_S $realname $linkname; }; })"
2806 done
2807 fi
2808
2809 # Do each command in the postinstall commands.
2810 lib="$destdir/$realname"
2811 func_execute_cmds "$postinstall_cmds" 'exit $?'
2812 fi
2813
2814 # Install the pseudo-library for information purposes.
2815 func_basename "$file"
2816 name="$func_basename_result"
2817 instname="$dir/$name"i
2818 func_show_eval "$install_prog $instname $destdir/$name" 'exit $?'
2819
2820 # Maybe install the static library, too.
2821 test -n "$old_library" && staticlibs="$staticlibs $dir/$old_library"
2822 ;;
2823
2824 *.lo)
2825 # Install (i.e. copy) a libtool object.
2826
2827 # Figure out destination file name, if it wasn't already specified.
2828 if test -n "$destname"; then
2829 destfile="$destdir/$destname"
2830 else
2831 func_basename "$file"
2832 destfile="$func_basename_result"
2833 destfile="$destdir/$destfile"
2834 fi
2835
2836 # Deduce the name of the destination old-style object file.
2837 case $destfile in
2838 *.lo)
2839 func_lo2o "$destfile"
2840 staticdest=$func_lo2o_result
2841 ;;
2842 *.$objext)
2843 staticdest="$destfile"
2844 destfile=
2845 ;;
2846 *)
2847 func_fatal_help "cannot copy a libtool object to \`$destfile'"
2848 ;;
2849 esac
2850
2851 # Install the libtool object if requested.
2852 test -n "$destfile" && \
2853 func_show_eval "$install_prog $file $destfile" 'exit $?'
2854
2855 # Install the old object if enabled.
2856 if test "$build_old_libs" = yes; then
2857 # Deduce the name of the old-style object file.
2858 func_lo2o "$file"
2859 staticobj=$func_lo2o_result
2860 func_show_eval "$install_prog \$staticobj \$staticdest" 'exit $?'
2861 fi
2862 exit $EXIT_SUCCESS
2863 ;;
2864
2865 *)
2866 # Figure out destination file name, if it wasn't already specified.
2867 if test -n "$destname"; then
2868 destfile="$destdir/$destname"
2869 else
2870 func_basename "$file"
2871 destfile="$func_basename_result"
2872 destfile="$destdir/$destfile"
2873 fi
2874
2875 # If the file is missing, and there is a .exe on the end, strip it
2876 # because it is most likely a libtool script we actually want to
2877 # install
2878 stripped_ext=""
2879 case $file in
2880 *.exe)
2881 if test ! -f "$file"; then
2882 func_stripname '' '.exe' "$file"
2883 file=$func_stripname_result
2884 stripped_ext=".exe"
2885 fi
2886 ;;
2887 esac
2888
2889 # Do a test to see if this is really a libtool program.
2890 case $host in
2891 *cygwin* | *mingw*)
2892 if func_ltwrapper_executable_p "$file"; then
2893 func_ltwrapper_scriptname "$file"
2894 wrapper=$func_ltwrapper_scriptname_result
2895 else
2896 func_stripname '' '.exe' "$file"
2897 wrapper=$func_stripname_result
2898 fi
2899 ;;
2900 *)
2901 wrapper=$file
2902 ;;
2903 esac
2904 if func_ltwrapper_script_p "$wrapper"; then
2905 notinst_deplibs=
2906 relink_command=
2907
2908 func_source "$wrapper"
2909
2910 # Check the variables that should have been set.
2911 test -z "$generated_by_libtool_version" && \
2912 func_fatal_error "invalid libtool wrapper script \`$wrapper'"
2913
2914 finalize=yes
2915 for lib in $notinst_deplibs; do
2916 # Check to see that each library is installed.
2917 libdir=
2918 if test -f "$lib"; then
2919 func_source "$lib"
2920 fi
cristyfd9dcd42010-08-08 18:07:02 +00002921 libfile="$libdir/"`$ECHO "$lib" | $SED 's%^.*/%%g'` ### testsuite: skip nested quoting test
cristy3ed852e2009-09-05 21:47:34 +00002922 if test -n "$libdir" && test ! -f "$libfile"; then
2923 func_warning "\`$lib' has not been installed in \`$libdir'"
2924 finalize=no
2925 fi
2926 done
2927
2928 relink_command=
2929 func_source "$wrapper"
2930
2931 outputname=
2932 if test "$fast_install" = no && test -n "$relink_command"; then
2933 $opt_dry_run || {
2934 if test "$finalize" = yes; then
2935 tmpdir=`func_mktempdir`
2936 func_basename "$file$stripped_ext"
2937 file="$func_basename_result"
2938 outputname="$tmpdir/$file"
2939 # Replace the output file specification.
cristyfd9dcd42010-08-08 18:07:02 +00002940 relink_command=`$ECHO "$relink_command" | $SED 's%@OUTPUT@%'"$outputname"'%g'`
cristy3ed852e2009-09-05 21:47:34 +00002941
2942 $opt_silent || {
2943 func_quote_for_expand "$relink_command"
2944 eval "func_echo $func_quote_for_expand_result"
2945 }
2946 if eval "$relink_command"; then :
2947 else
2948 func_error "error: relink \`$file' with the above command before installing it"
2949 $opt_dry_run || ${RM}r "$tmpdir"
2950 continue
2951 fi
2952 file="$outputname"
2953 else
2954 func_warning "cannot relink \`$file'"
2955 fi
2956 }
2957 else
2958 # Install the binary that we compiled earlier.
cristyfd9dcd42010-08-08 18:07:02 +00002959 file=`$ECHO "$file$stripped_ext" | $SED "s%\([^/]*\)$%$objdir/\1%"`
cristy3ed852e2009-09-05 21:47:34 +00002960 fi
2961 fi
2962
2963 # remove .exe since cygwin /usr/bin/install will append another
2964 # one anyway
2965 case $install_prog,$host in
2966 */usr/bin/install*,*cygwin*)
2967 case $file:$destfile in
2968 *.exe:*.exe)
2969 # this is ok
2970 ;;
2971 *.exe:*)
2972 destfile=$destfile.exe
2973 ;;
2974 *:*.exe)
2975 func_stripname '' '.exe' "$destfile"
2976 destfile=$func_stripname_result
2977 ;;
2978 esac
2979 ;;
2980 esac
2981 func_show_eval "$install_prog\$stripme \$file \$destfile" 'exit $?'
2982 $opt_dry_run || if test -n "$outputname"; then
2983 ${RM}r "$tmpdir"
2984 fi
2985 ;;
2986 esac
2987 done
2988
2989 for file in $staticlibs; do
2990 func_basename "$file"
2991 name="$func_basename_result"
2992
2993 # Set up the ranlib parameters.
2994 oldlib="$destdir/$name"
2995
2996 func_show_eval "$install_prog \$file \$oldlib" 'exit $?'
2997
2998 if test -n "$stripme" && test -n "$old_striplib"; then
2999 func_show_eval "$old_striplib $oldlib" 'exit $?'
3000 fi
3001
3002 # Do each command in the postinstall commands.
3003 func_execute_cmds "$old_postinstall_cmds" 'exit $?'
3004 done
3005
3006 test -n "$future_libdirs" && \
3007 func_warning "remember to run \`$progname --finish$future_libdirs'"
3008
3009 if test -n "$current_libdirs"; then
3010 # Maybe just do a dry run.
3011 $opt_dry_run && current_libdirs=" -n$current_libdirs"
3012 exec_cmd='$SHELL $progpath $preserve_args --finish$current_libdirs'
3013 else
3014 exit $EXIT_SUCCESS
3015 fi
3016}
3017
3018test "$mode" = install && func_mode_install ${1+"$@"}
3019
3020
3021# func_generate_dlsyms outputname originator pic_p
3022# Extract symbols from dlprefiles and create ${outputname}S.o with
3023# a dlpreopen symbol table.
3024func_generate_dlsyms ()
3025{
3026 $opt_debug
3027 my_outputname="$1"
3028 my_originator="$2"
3029 my_pic_p="${3-no}"
3030 my_prefix=`$ECHO "$my_originator" | sed 's%[^a-zA-Z0-9]%_%g'`
3031 my_dlsyms=
3032
3033 if test -n "$dlfiles$dlprefiles" || test "$dlself" != no; then
3034 if test -n "$NM" && test -n "$global_symbol_pipe"; then
3035 my_dlsyms="${my_outputname}S.c"
3036 else
3037 func_error "not configured to extract global symbols from dlpreopened files"
3038 fi
3039 fi
3040
3041 if test -n "$my_dlsyms"; then
3042 case $my_dlsyms in
3043 "") ;;
3044 *.c)
3045 # Discover the nlist of each of the dlfiles.
3046 nlist="$output_objdir/${my_outputname}.nm"
3047
3048 func_show_eval "$RM $nlist ${nlist}S ${nlist}T"
3049
3050 # Parse the name list into a source file.
3051 func_verbose "creating $output_objdir/$my_dlsyms"
3052
3053 $opt_dry_run || $ECHO > "$output_objdir/$my_dlsyms" "\
3054/* $my_dlsyms - symbol resolution table for \`$my_outputname' dlsym emulation. */
3055/* Generated by $PROGRAM (GNU $PACKAGE$TIMESTAMP) $VERSION */
3056
3057#ifdef __cplusplus
3058extern \"C\" {
3059#endif
3060
cristyfd9dcd42010-08-08 18:07:02 +00003061#if defined(__GNUC__) && (((__GNUC__ == 4) && (__GNUC_MINOR__ >= 4)) || (__GNUC__ > 4))
3062#pragma GCC diagnostic ignored \"-Wstrict-prototypes\"
3063#endif
3064
cristy3ed852e2009-09-05 21:47:34 +00003065/* External symbol declarations for the compiler. */\
3066"
3067
3068 if test "$dlself" = yes; then
3069 func_verbose "generating symbol list for \`$output'"
3070
3071 $opt_dry_run || echo ': @PROGRAM@ ' > "$nlist"
3072
3073 # Add our own program objects to the symbol list.
cristyfd9dcd42010-08-08 18:07:02 +00003074 progfiles=`$ECHO "$objs$old_deplibs" | $SP2NL | $SED "$lo2o" | $NL2SP`
cristy3ed852e2009-09-05 21:47:34 +00003075 for progfile in $progfiles; do
3076 func_verbose "extracting global C symbols from \`$progfile'"
3077 $opt_dry_run || eval "$NM $progfile | $global_symbol_pipe >> '$nlist'"
3078 done
3079
3080 if test -n "$exclude_expsyms"; then
3081 $opt_dry_run || {
3082 eval '$EGREP -v " ($exclude_expsyms)$" "$nlist" > "$nlist"T'
3083 eval '$MV "$nlist"T "$nlist"'
3084 }
3085 fi
3086
3087 if test -n "$export_symbols_regex"; then
3088 $opt_dry_run || {
3089 eval '$EGREP -e "$export_symbols_regex" "$nlist" > "$nlist"T'
3090 eval '$MV "$nlist"T "$nlist"'
3091 }
3092 fi
3093
3094 # Prepare the list of exported symbols
3095 if test -z "$export_symbols"; then
3096 export_symbols="$output_objdir/$outputname.exp"
3097 $opt_dry_run || {
3098 $RM $export_symbols
3099 eval "${SED} -n -e '/^: @PROGRAM@ $/d' -e 's/^.* \(.*\)$/\1/p' "'< "$nlist" > "$export_symbols"'
3100 case $host in
3101 *cygwin* | *mingw* | *cegcc* )
3102 eval "echo EXPORTS "'> "$output_objdir/$outputname.def"'
3103 eval 'cat "$export_symbols" >> "$output_objdir/$outputname.def"'
3104 ;;
3105 esac
3106 }
3107 else
3108 $opt_dry_run || {
3109 eval "${SED} -e 's/\([].[*^$]\)/\\\\\1/g' -e 's/^/ /' -e 's/$/$/'"' < "$export_symbols" > "$output_objdir/$outputname.exp"'
3110 eval '$GREP -f "$output_objdir/$outputname.exp" < "$nlist" > "$nlist"T'
3111 eval '$MV "$nlist"T "$nlist"'
3112 case $host in
cristyfd9dcd42010-08-08 18:07:02 +00003113 *cygwin* | *mingw* | *cegcc* )
cristy3ed852e2009-09-05 21:47:34 +00003114 eval "echo EXPORTS "'> "$output_objdir/$outputname.def"'
3115 eval 'cat "$nlist" >> "$output_objdir/$outputname.def"'
3116 ;;
3117 esac
3118 }
3119 fi
3120 fi
3121
3122 for dlprefile in $dlprefiles; do
3123 func_verbose "extracting global C symbols from \`$dlprefile'"
3124 func_basename "$dlprefile"
3125 name="$func_basename_result"
3126 $opt_dry_run || {
3127 eval '$ECHO ": $name " >> "$nlist"'
3128 eval "$NM $dlprefile 2>/dev/null | $global_symbol_pipe >> '$nlist'"
3129 }
3130 done
3131
3132 $opt_dry_run || {
3133 # Make sure we have at least an empty file.
3134 test -f "$nlist" || : > "$nlist"
3135
3136 if test -n "$exclude_expsyms"; then
3137 $EGREP -v " ($exclude_expsyms)$" "$nlist" > "$nlist"T
3138 $MV "$nlist"T "$nlist"
3139 fi
3140
3141 # Try sorting and uniquifying the output.
3142 if $GREP -v "^: " < "$nlist" |
3143 if sort -k 3 </dev/null >/dev/null 2>&1; then
3144 sort -k 3
3145 else
3146 sort +2
3147 fi |
3148 uniq > "$nlist"S; then
3149 :
3150 else
3151 $GREP -v "^: " < "$nlist" > "$nlist"S
3152 fi
3153
3154 if test -f "$nlist"S; then
3155 eval "$global_symbol_to_cdecl"' < "$nlist"S >> "$output_objdir/$my_dlsyms"'
3156 else
cristyfd9dcd42010-08-08 18:07:02 +00003157 echo '/* NONE */' >> "$output_objdir/$my_dlsyms"
cristy3ed852e2009-09-05 21:47:34 +00003158 fi
3159
cristyfd9dcd42010-08-08 18:07:02 +00003160 echo >> "$output_objdir/$my_dlsyms" "\
cristy3ed852e2009-09-05 21:47:34 +00003161
3162/* The mapping between symbol names and symbols. */
3163typedef struct {
3164 const char *name;
3165 void *address;
3166} lt_dlsymlist;
3167"
3168 case $host in
3169 *cygwin* | *mingw* | *cegcc* )
cristyfd9dcd42010-08-08 18:07:02 +00003170 echo >> "$output_objdir/$my_dlsyms" "\
cristy3ed852e2009-09-05 21:47:34 +00003171/* DATA imports from DLLs on WIN32 con't be const, because
3172 runtime relocations are performed -- see ld's documentation
3173 on pseudo-relocs. */"
3174 lt_dlsym_const= ;;
3175 *osf5*)
3176 echo >> "$output_objdir/$my_dlsyms" "\
3177/* This system does not cope well with relocations in const data */"
3178 lt_dlsym_const= ;;
3179 *)
3180 lt_dlsym_const=const ;;
3181 esac
3182
cristyfd9dcd42010-08-08 18:07:02 +00003183 echo >> "$output_objdir/$my_dlsyms" "\
cristy3ed852e2009-09-05 21:47:34 +00003184extern $lt_dlsym_const lt_dlsymlist
3185lt_${my_prefix}_LTX_preloaded_symbols[];
3186$lt_dlsym_const lt_dlsymlist
3187lt_${my_prefix}_LTX_preloaded_symbols[] =
3188{\
3189 { \"$my_originator\", (void *) 0 },"
3190
3191 case $need_lib_prefix in
3192 no)
3193 eval "$global_symbol_to_c_name_address" < "$nlist" >> "$output_objdir/$my_dlsyms"
3194 ;;
3195 *)
3196 eval "$global_symbol_to_c_name_address_lib_prefix" < "$nlist" >> "$output_objdir/$my_dlsyms"
3197 ;;
3198 esac
cristyfd9dcd42010-08-08 18:07:02 +00003199 echo >> "$output_objdir/$my_dlsyms" "\
cristy3ed852e2009-09-05 21:47:34 +00003200 {0, (void *) 0}
3201};
3202
3203/* This works around a problem in FreeBSD linker */
3204#ifdef FREEBSD_WORKAROUND
3205static const void *lt_preloaded_setup() {
3206 return lt_${my_prefix}_LTX_preloaded_symbols;
3207}
3208#endif
3209
3210#ifdef __cplusplus
3211}
3212#endif\
3213"
3214 } # !$opt_dry_run
3215
3216 pic_flag_for_symtable=
3217 case "$compile_command " in
3218 *" -static "*) ;;
3219 *)
3220 case $host in
3221 # compiling the symbol table file with pic_flag works around
3222 # a FreeBSD bug that causes programs to crash when -lm is
3223 # linked before any other PIC object. But we must not use
3224 # pic_flag when linking with -static. The problem exists in
3225 # FreeBSD 2.2.6 and is fixed in FreeBSD 3.1.
3226 *-*-freebsd2*|*-*-freebsd3.0*|*-*-freebsdelf3.0*)
3227 pic_flag_for_symtable=" $pic_flag -DFREEBSD_WORKAROUND" ;;
3228 *-*-hpux*)
3229 pic_flag_for_symtable=" $pic_flag" ;;
3230 *)
3231 if test "X$my_pic_p" != Xno; then
3232 pic_flag_for_symtable=" $pic_flag"
3233 fi
3234 ;;
3235 esac
3236 ;;
3237 esac
3238 symtab_cflags=
3239 for arg in $LTCFLAGS; do
3240 case $arg in
3241 -pie | -fpie | -fPIE) ;;
3242 *) symtab_cflags="$symtab_cflags $arg" ;;
3243 esac
3244 done
3245
3246 # Now compile the dynamic symbol file.
3247 func_show_eval '(cd $output_objdir && $LTCC$symtab_cflags -c$no_builtin_flag$pic_flag_for_symtable "$my_dlsyms")' 'exit $?'
3248
3249 # Clean up the generated files.
3250 func_show_eval '$RM "$output_objdir/$my_dlsyms" "$nlist" "${nlist}S" "${nlist}T"'
3251
3252 # Transform the symbol file into the correct name.
3253 symfileobj="$output_objdir/${my_outputname}S.$objext"
3254 case $host in
3255 *cygwin* | *mingw* | *cegcc* )
3256 if test -f "$output_objdir/$my_outputname.def"; then
cristyfd9dcd42010-08-08 18:07:02 +00003257 compile_command=`$ECHO "$compile_command" | $SED "s%@SYMFILE@%$output_objdir/$my_outputname.def $symfileobj%"`
3258 finalize_command=`$ECHO "$finalize_command" | $SED "s%@SYMFILE@%$output_objdir/$my_outputname.def $symfileobj%"`
cristy3ed852e2009-09-05 21:47:34 +00003259 else
cristyfd9dcd42010-08-08 18:07:02 +00003260 compile_command=`$ECHO "$compile_command" | $SED "s%@SYMFILE@%$symfileobj%"`
3261 finalize_command=`$ECHO "$finalize_command" | $SED "s%@SYMFILE@%$symfileobj%"`
cristy3ed852e2009-09-05 21:47:34 +00003262 fi
3263 ;;
3264 *)
cristyfd9dcd42010-08-08 18:07:02 +00003265 compile_command=`$ECHO "$compile_command" | $SED "s%@SYMFILE@%$symfileobj%"`
3266 finalize_command=`$ECHO "$finalize_command" | $SED "s%@SYMFILE@%$symfileobj%"`
cristy3ed852e2009-09-05 21:47:34 +00003267 ;;
3268 esac
3269 ;;
3270 *)
3271 func_fatal_error "unknown suffix for \`$my_dlsyms'"
3272 ;;
3273 esac
3274 else
3275 # We keep going just in case the user didn't refer to
3276 # lt_preloaded_symbols. The linker will fail if global_symbol_pipe
3277 # really was required.
3278
3279 # Nullify the symbol file.
cristyfd9dcd42010-08-08 18:07:02 +00003280 compile_command=`$ECHO "$compile_command" | $SED "s% @SYMFILE@%%"`
3281 finalize_command=`$ECHO "$finalize_command" | $SED "s% @SYMFILE@%%"`
cristy3ed852e2009-09-05 21:47:34 +00003282 fi
3283}
3284
3285# func_win32_libid arg
3286# return the library type of file 'arg'
3287#
3288# Need a lot of goo to handle *both* DLLs and import libs
3289# Has to be a shell function in order to 'eat' the argument
3290# that is supplied when $file_magic_command is called.
cristyfd9dcd42010-08-08 18:07:02 +00003291# Despite the name, also deal with 64 bit binaries.
cristy3ed852e2009-09-05 21:47:34 +00003292func_win32_libid ()
3293{
3294 $opt_debug
3295 win32_libid_type="unknown"
3296 win32_fileres=`file -L $1 2>/dev/null`
3297 case $win32_fileres in
3298 *ar\ archive\ import\ library*) # definitely import
3299 win32_libid_type="x86 archive import"
3300 ;;
3301 *ar\ archive*) # could be an import, or static
cristyfd9dcd42010-08-08 18:07:02 +00003302 # Keep the egrep pattern in sync with the one in _LT_CHECK_MAGIC_METHOD.
cristy3ed852e2009-09-05 21:47:34 +00003303 if eval $OBJDUMP -f $1 | $SED -e '10q' 2>/dev/null |
cristyfd9dcd42010-08-08 18:07:02 +00003304 $EGREP 'file format (pei*-i386(.*architecture: i386)?|pe-arm-wince|pe-x86-64)' >/dev/null; then
cristy3ed852e2009-09-05 21:47:34 +00003305 win32_nmres=`eval $NM -f posix -A $1 |
3306 $SED -n -e '
3307 1,100{
3308 / I /{
3309 s,.*,import,
3310 p
3311 q
3312 }
3313 }'`
3314 case $win32_nmres in
3315 import*) win32_libid_type="x86 archive import";;
3316 *) win32_libid_type="x86 archive static";;
3317 esac
3318 fi
3319 ;;
3320 *DLL*)
3321 win32_libid_type="x86 DLL"
3322 ;;
3323 *executable*) # but shell scripts are "executable" too...
3324 case $win32_fileres in
3325 *MS\ Windows\ PE\ Intel*)
3326 win32_libid_type="x86 DLL"
3327 ;;
3328 esac
3329 ;;
3330 esac
3331 $ECHO "$win32_libid_type"
3332}
3333
3334
3335
3336# func_extract_an_archive dir oldlib
3337func_extract_an_archive ()
3338{
3339 $opt_debug
3340 f_ex_an_ar_dir="$1"; shift
3341 f_ex_an_ar_oldlib="$1"
cristyfd9dcd42010-08-08 18:07:02 +00003342 if test "$lock_old_archive_extraction" = yes; then
3343 lockfile=$f_ex_an_ar_oldlib.lock
3344 until $opt_dry_run || ln "$progpath" "$lockfile" 2>/dev/null; do
3345 func_echo "Waiting for $lockfile to be removed"
3346 sleep 2
3347 done
3348 fi
3349 func_show_eval "(cd \$f_ex_an_ar_dir && $AR x \"\$f_ex_an_ar_oldlib\")" \
3350 'stat=$?; rm -f "$lockfile"; exit $stat'
3351 if test "$lock_old_archive_extraction" = yes; then
3352 $opt_dry_run || rm -f "$lockfile"
3353 fi
cristy3ed852e2009-09-05 21:47:34 +00003354 if ($AR t "$f_ex_an_ar_oldlib" | sort | sort -uc >/dev/null 2>&1); then
3355 :
3356 else
3357 func_fatal_error "object name conflicts in archive: $f_ex_an_ar_dir/$f_ex_an_ar_oldlib"
3358 fi
3359}
3360
3361
3362# func_extract_archives gentop oldlib ...
3363func_extract_archives ()
3364{
3365 $opt_debug
3366 my_gentop="$1"; shift
3367 my_oldlibs=${1+"$@"}
3368 my_oldobjs=""
3369 my_xlib=""
3370 my_xabs=""
3371 my_xdir=""
3372
3373 for my_xlib in $my_oldlibs; do
3374 # Extract the objects.
3375 case $my_xlib in
3376 [\\/]* | [A-Za-z]:[\\/]*) my_xabs="$my_xlib" ;;
3377 *) my_xabs=`pwd`"/$my_xlib" ;;
3378 esac
3379 func_basename "$my_xlib"
3380 my_xlib="$func_basename_result"
3381 my_xlib_u=$my_xlib
3382 while :; do
3383 case " $extracted_archives " in
3384 *" $my_xlib_u "*)
3385 func_arith $extracted_serial + 1
3386 extracted_serial=$func_arith_result
3387 my_xlib_u=lt$extracted_serial-$my_xlib ;;
3388 *) break ;;
3389 esac
3390 done
3391 extracted_archives="$extracted_archives $my_xlib_u"
3392 my_xdir="$my_gentop/$my_xlib_u"
3393
3394 func_mkdir_p "$my_xdir"
3395
3396 case $host in
3397 *-darwin*)
3398 func_verbose "Extracting $my_xabs"
3399 # Do not bother doing anything if just a dry run
3400 $opt_dry_run || {
3401 darwin_orig_dir=`pwd`
3402 cd $my_xdir || exit $?
3403 darwin_archive=$my_xabs
3404 darwin_curdir=`pwd`
3405 darwin_base_archive=`basename "$darwin_archive"`
3406 darwin_arches=`$LIPO -info "$darwin_archive" 2>/dev/null | $GREP Architectures 2>/dev/null || true`
3407 if test -n "$darwin_arches"; then
3408 darwin_arches=`$ECHO "$darwin_arches" | $SED -e 's/.*are://'`
3409 darwin_arch=
3410 func_verbose "$darwin_base_archive has multiple architectures $darwin_arches"
3411 for darwin_arch in $darwin_arches ; do
3412 func_mkdir_p "unfat-$$/${darwin_base_archive}-${darwin_arch}"
3413 $LIPO -thin $darwin_arch -output "unfat-$$/${darwin_base_archive}-${darwin_arch}/${darwin_base_archive}" "${darwin_archive}"
3414 cd "unfat-$$/${darwin_base_archive}-${darwin_arch}"
3415 func_extract_an_archive "`pwd`" "${darwin_base_archive}"
3416 cd "$darwin_curdir"
3417 $RM "unfat-$$/${darwin_base_archive}-${darwin_arch}/${darwin_base_archive}"
3418 done # $darwin_arches
3419 ## Okay now we've a bunch of thin objects, gotta fatten them up :)
3420 darwin_filelist=`find unfat-$$ -type f -name \*.o -print -o -name \*.lo -print | $SED -e "$basename" | sort -u`
3421 darwin_file=
3422 darwin_files=
3423 for darwin_file in $darwin_filelist; do
cristyfd9dcd42010-08-08 18:07:02 +00003424 darwin_files=`find unfat-$$ -name $darwin_file -print | sort | $NL2SP`
cristy3ed852e2009-09-05 21:47:34 +00003425 $LIPO -create -output "$darwin_file" $darwin_files
3426 done # $darwin_filelist
3427 $RM -rf unfat-$$
3428 cd "$darwin_orig_dir"
3429 else
3430 cd $darwin_orig_dir
3431 func_extract_an_archive "$my_xdir" "$my_xabs"
3432 fi # $darwin_arches
3433 } # !$opt_dry_run
3434 ;;
3435 *)
3436 func_extract_an_archive "$my_xdir" "$my_xabs"
3437 ;;
3438 esac
cristyfd9dcd42010-08-08 18:07:02 +00003439 my_oldobjs="$my_oldobjs "`find $my_xdir -name \*.$objext -print -o -name \*.lo -print | sort | $NL2SP`
cristy3ed852e2009-09-05 21:47:34 +00003440 done
3441
3442 func_extract_archives_result="$my_oldobjs"
3443}
3444
3445
cristyfd9dcd42010-08-08 18:07:02 +00003446# func_emit_wrapper [arg=no]
cristy3ed852e2009-09-05 21:47:34 +00003447#
cristyfd9dcd42010-08-08 18:07:02 +00003448# Emit a libtool wrapper script on stdout.
3449# Don't directly open a file because we may want to
3450# incorporate the script contents within a cygwin/mingw
3451# wrapper executable. Must ONLY be called from within
3452# func_mode_link because it depends on a number of variables
3453# set therein.
3454#
3455# ARG is the value that the WRAPPER_SCRIPT_BELONGS_IN_OBJDIR
3456# variable will take. If 'yes', then the emitted script
3457# will assume that the directory in which it is stored is
3458# the $objdir directory. This is a cygwin/mingw-specific
3459# behavior.
3460func_emit_wrapper ()
cristy3ed852e2009-09-05 21:47:34 +00003461{
cristyfd9dcd42010-08-08 18:07:02 +00003462 func_emit_wrapper_arg1=${1-no}
cristy3ed852e2009-09-05 21:47:34 +00003463
3464 $ECHO "\
3465#! $SHELL
3466
3467# $output - temporary wrapper script for $objdir/$outputname
3468# Generated by $PROGRAM (GNU $PACKAGE$TIMESTAMP) $VERSION
3469#
3470# The $output program cannot be directly executed until all the libtool
3471# libraries that it depends on are installed.
3472#
3473# This wrapper script should never be moved out of the build directory.
3474# If it is, it will not operate correctly.
3475
3476# Sed substitution that helps us do robust quoting. It backslashifies
3477# metacharacters that are still active within double-quoted strings.
cristy3ed852e2009-09-05 21:47:34 +00003478sed_quote_subst='$sed_quote_subst'
3479
3480# Be Bourne compatible
3481if test -n \"\${ZSH_VERSION+set}\" && (emulate sh) >/dev/null 2>&1; then
3482 emulate sh
3483 NULLCMD=:
3484 # Zsh 3.x and 4.x performs word splitting on \${1+\"\$@\"}, which
3485 # is contrary to our usage. Disable this feature.
3486 alias -g '\${1+\"\$@\"}'='\"\$@\"'
3487 setopt NO_GLOB_SUBST
3488else
3489 case \`(set -o) 2>/dev/null\` in *posix*) set -o posix;; esac
3490fi
3491BIN_SH=xpg4; export BIN_SH # for Tru64
3492DUALCASE=1; export DUALCASE # for MKS sh
3493
3494# The HP-UX ksh and POSIX shell print the target directory to stdout
3495# if CDPATH is set.
3496(unset CDPATH) >/dev/null 2>&1 && unset CDPATH
3497
3498relink_command=\"$relink_command\"
3499
3500# This environment variable determines our operation mode.
3501if test \"\$libtool_install_magic\" = \"$magic\"; then
3502 # install mode needs the following variables:
3503 generated_by_libtool_version='$macro_version'
3504 notinst_deplibs='$notinst_deplibs'
3505else
3506 # When we are sourced in execute mode, \$file and \$ECHO are already set.
3507 if test \"\$libtool_execute_magic\" != \"$magic\"; then
cristyfd9dcd42010-08-08 18:07:02 +00003508 file=\"\$0\""
3509
3510 qECHO=`$ECHO "$ECHO" | $SED "$sed_quote_subst"`
3511 $ECHO "\
3512
3513# A function that is used when there is no print builtin or printf.
3514func_fallback_echo ()
3515{
3516 eval 'cat <<_LTECHO_EOF
3517\$1
3518_LTECHO_EOF'
3519}
3520 ECHO=\"$qECHO\"
3521 fi
3522
3523# Very basic option parsing. These options are (a) specific to
3524# the libtool wrapper, (b) are identical between the wrapper
3525# /script/ and the wrapper /executable/ which is used only on
3526# windows platforms, and (c) all begin with the string "--lt-"
3527# (application programs are unlikely to have options which match
3528# this pattern).
3529#
3530# There are only two supported options: --lt-debug and
3531# --lt-dump-script. There is, deliberately, no --lt-help.
3532#
3533# The first argument to this parsing function should be the
3534# script's $0 value, followed by "$@".
3535lt_option_debug=
3536func_parse_lt_options ()
3537{
3538 lt_script_arg0=\$0
3539 shift
3540 for lt_opt
3541 do
3542 case \"\$lt_opt\" in
3543 --lt-debug) lt_option_debug=1 ;;
3544 --lt-dump-script)
3545 lt_dump_D=\`\$ECHO \"X\$lt_script_arg0\" | $SED -e 's/^X//' -e 's%/[^/]*$%%'\`
3546 test \"X\$lt_dump_D\" = \"X\$lt_script_arg0\" && lt_dump_D=.
3547 lt_dump_F=\`\$ECHO \"X\$lt_script_arg0\" | $SED -e 's/^X//' -e 's%^.*/%%'\`
3548 cat \"\$lt_dump_D/\$lt_dump_F\"
3549 exit 0
3550 ;;
3551 --lt-*)
3552 \$ECHO \"Unrecognized --lt- option: '\$lt_opt'\" 1>&2
3553 exit 1
3554 ;;
3555 esac
3556 done
3557
3558 # Print the debug banner immediately:
3559 if test -n \"\$lt_option_debug\"; then
3560 echo \"${outputname}:${output}:\${LINENO}: libtool wrapper (GNU $PACKAGE$TIMESTAMP) $VERSION\" 1>&2
3561 fi
3562}
3563
3564# Used when --lt-debug. Prints its arguments to stdout
3565# (redirection is the responsibility of the caller)
3566func_lt_dump_args ()
3567{
3568 lt_dump_args_N=1;
3569 for lt_arg
3570 do
3571 \$ECHO \"${outputname}:${output}:\${LINENO}: newargv[\$lt_dump_args_N]: \$lt_arg\"
3572 lt_dump_args_N=\`expr \$lt_dump_args_N + 1\`
3573 done
3574}
3575
3576# Core function for launching the target application
3577func_exec_program_core ()
3578{
cristycd4c5312009-11-22 01:19:08 +00003579"
cristyfd9dcd42010-08-08 18:07:02 +00003580 case $host in
3581 # Backslashes separate directories on plain windows
3582 *-*-mingw | *-*-os2* | *-cegcc*)
3583 $ECHO "\
3584 if test -n \"\$lt_option_debug\"; then
3585 \$ECHO \"${outputname}:${output}:\${LINENO}: newargv[0]: \$progdir\\\\\$program\" 1>&2
3586 func_lt_dump_args \${1+\"\$@\"} 1>&2
3587 fi
3588 exec \"\$progdir\\\\\$program\" \${1+\"\$@\"}
3589"
3590 ;;
3591
3592 *)
3593 $ECHO "\
3594 if test -n \"\$lt_option_debug\"; then
3595 \$ECHO \"${outputname}:${output}:\${LINENO}: newargv[0]: \$progdir/\$program\" 1>&2
3596 func_lt_dump_args \${1+\"\$@\"} 1>&2
3597 fi
3598 exec \"\$progdir/\$program\" \${1+\"\$@\"}
3599"
3600 ;;
3601 esac
3602 $ECHO "\
3603 \$ECHO \"\$0: cannot exec \$program \$*\" 1>&2
3604 exit 1
3605}
3606
3607# A function to encapsulate launching the target application
3608# Strips options in the --lt-* namespace from \$@ and
3609# launches target application with the remaining arguments.
3610func_exec_program ()
3611{
3612 for lt_wr_arg
3613 do
3614 case \$lt_wr_arg in
3615 --lt-*) ;;
3616 *) set x \"\$@\" \"\$lt_wr_arg\"; shift;;
3617 esac
3618 shift
3619 done
3620 func_exec_program_core \${1+\"\$@\"}
3621}
3622
3623 # Parse options
3624 func_parse_lt_options \"\$0\" \${1+\"\$@\"}
cristy3ed852e2009-09-05 21:47:34 +00003625
3626 # Find the directory that this script lives in.
cristyfd9dcd42010-08-08 18:07:02 +00003627 thisdir=\`\$ECHO \"\$file\" | $SED 's%/[^/]*$%%'\`
cristy3ed852e2009-09-05 21:47:34 +00003628 test \"x\$thisdir\" = \"x\$file\" && thisdir=.
3629
3630 # Follow symbolic links until we get to the real thisdir.
cristyfd9dcd42010-08-08 18:07:02 +00003631 file=\`ls -ld \"\$file\" | $SED -n 's/.*-> //p'\`
cristy3ed852e2009-09-05 21:47:34 +00003632 while test -n \"\$file\"; do
cristyfd9dcd42010-08-08 18:07:02 +00003633 destdir=\`\$ECHO \"\$file\" | $SED 's%/[^/]*\$%%'\`
cristy3ed852e2009-09-05 21:47:34 +00003634
3635 # If there was a directory component, then change thisdir.
3636 if test \"x\$destdir\" != \"x\$file\"; then
3637 case \"\$destdir\" in
3638 [\\\\/]* | [A-Za-z]:[\\\\/]*) thisdir=\"\$destdir\" ;;
3639 *) thisdir=\"\$thisdir/\$destdir\" ;;
3640 esac
3641 fi
3642
cristyfd9dcd42010-08-08 18:07:02 +00003643 file=\`\$ECHO \"\$file\" | $SED 's%^.*/%%'\`
3644 file=\`ls -ld \"\$thisdir/\$file\" | $SED -n 's/.*-> //p'\`
cristy3ed852e2009-09-05 21:47:34 +00003645 done
cristy3ed852e2009-09-05 21:47:34 +00003646
3647 # Usually 'no', except on cygwin/mingw when embedded into
3648 # the cwrapper.
cristyfd9dcd42010-08-08 18:07:02 +00003649 WRAPPER_SCRIPT_BELONGS_IN_OBJDIR=$func_emit_wrapper_arg1
cristy3ed852e2009-09-05 21:47:34 +00003650 if test \"\$WRAPPER_SCRIPT_BELONGS_IN_OBJDIR\" = \"yes\"; then
3651 # special case for '.'
3652 if test \"\$thisdir\" = \".\"; then
3653 thisdir=\`pwd\`
3654 fi
3655 # remove .libs from thisdir
3656 case \"\$thisdir\" in
cristyfd9dcd42010-08-08 18:07:02 +00003657 *[\\\\/]$objdir ) thisdir=\`\$ECHO \"\$thisdir\" | $SED 's%[\\\\/][^\\\\/]*$%%'\` ;;
cristy3ed852e2009-09-05 21:47:34 +00003658 $objdir ) thisdir=. ;;
3659 esac
3660 fi
3661
3662 # Try to get the absolute directory name.
3663 absdir=\`cd \"\$thisdir\" && pwd\`
3664 test -n \"\$absdir\" && thisdir=\"\$absdir\"
3665"
3666
3667 if test "$fast_install" = yes; then
3668 $ECHO "\
3669 program=lt-'$outputname'$exeext
3670 progdir=\"\$thisdir/$objdir\"
3671
3672 if test ! -f \"\$progdir/\$program\" ||
3673 { file=\`ls -1dt \"\$progdir/\$program\" \"\$progdir/../\$program\" 2>/dev/null | ${SED} 1q\`; \\
3674 test \"X\$file\" != \"X\$progdir/\$program\"; }; then
3675
3676 file=\"\$\$-\$program\"
3677
3678 if test ! -d \"\$progdir\"; then
3679 $MKDIR \"\$progdir\"
3680 else
3681 $RM \"\$progdir/\$file\"
3682 fi"
3683
3684 $ECHO "\
3685
3686 # relink executable if necessary
3687 if test -n \"\$relink_command\"; then
3688 if relink_command_output=\`eval \$relink_command 2>&1\`; then :
3689 else
3690 $ECHO \"\$relink_command_output\" >&2
3691 $RM \"\$progdir/\$file\"
3692 exit 1
3693 fi
3694 fi
3695
3696 $MV \"\$progdir/\$file\" \"\$progdir/\$program\" 2>/dev/null ||
3697 { $RM \"\$progdir/\$program\";
3698 $MV \"\$progdir/\$file\" \"\$progdir/\$program\"; }
3699 $RM \"\$progdir/\$file\"
3700 fi"
3701 else
3702 $ECHO "\
3703 program='$outputname'
3704 progdir=\"\$thisdir/$objdir\"
3705"
3706 fi
3707
3708 $ECHO "\
3709
3710 if test -f \"\$progdir/\$program\"; then"
3711
3712 # Export our shlibpath_var if we have one.
3713 if test "$shlibpath_overrides_runpath" = yes && test -n "$shlibpath_var" && test -n "$temp_rpath"; then
3714 $ECHO "\
3715 # Add our own library path to $shlibpath_var
3716 $shlibpath_var=\"$temp_rpath\$$shlibpath_var\"
3717
3718 # Some systems cannot cope with colon-terminated $shlibpath_var
3719 # The second colon is a workaround for a bug in BeOS R4 sed
cristyfd9dcd42010-08-08 18:07:02 +00003720 $shlibpath_var=\`\$ECHO \"\$$shlibpath_var\" | $SED 's/::*\$//'\`
cristy3ed852e2009-09-05 21:47:34 +00003721
3722 export $shlibpath_var
3723"
3724 fi
3725
3726 # fixup the dll searchpath if we need to.
3727 if test -n "$dllsearchpath"; then
3728 $ECHO "\
3729 # Add the dll search path components to the executable PATH
3730 PATH=$dllsearchpath:\$PATH
3731"
3732 fi
3733
3734 $ECHO "\
3735 if test \"\$libtool_execute_magic\" != \"$magic\"; then
3736 # Run the actual program with our arguments.
cristyfd9dcd42010-08-08 18:07:02 +00003737 func_exec_program \${1+\"\$@\"}
cristy3ed852e2009-09-05 21:47:34 +00003738 fi
3739 else
3740 # The program doesn't exist.
3741 \$ECHO \"\$0: error: \\\`\$progdir/\$program' does not exist\" 1>&2
3742 \$ECHO \"This script is just a wrapper for \$program.\" 1>&2
cristyfd9dcd42010-08-08 18:07:02 +00003743 \$ECHO \"See the $PACKAGE documentation for more information.\" 1>&2
cristy3ed852e2009-09-05 21:47:34 +00003744 exit 1
3745 fi
3746fi\
3747"
3748}
cristy3ed852e2009-09-05 21:47:34 +00003749
3750
3751# func_to_host_path arg
3752#
3753# Convert paths to host format when used with build tools.
3754# Intended for use with "native" mingw (where libtool itself
3755# is running under the msys shell), or in the following cross-
3756# build environments:
3757# $build $host
3758# mingw (msys) mingw [e.g. native]
3759# cygwin mingw
3760# *nix + wine mingw
3761# where wine is equipped with the `winepath' executable.
3762# In the native mingw case, the (msys) shell automatically
3763# converts paths for any non-msys applications it launches,
3764# but that facility isn't available from inside the cwrapper.
3765# Similar accommodations are necessary for $host mingw and
3766# $build cygwin. Calling this function does no harm for other
3767# $host/$build combinations not listed above.
3768#
3769# ARG is the path (on $build) that should be converted to
3770# the proper representation for $host. The result is stored
3771# in $func_to_host_path_result.
3772func_to_host_path ()
3773{
3774 func_to_host_path_result="$1"
cristyfd9dcd42010-08-08 18:07:02 +00003775 if test -n "$1"; then
cristy3ed852e2009-09-05 21:47:34 +00003776 case $host in
3777 *mingw* )
3778 lt_sed_naive_backslashify='s|\\\\*|\\|g;s|/|\\|g;s|\\|\\\\|g'
3779 case $build in
3780 *mingw* ) # actually, msys
3781 # awkward: cmd appends spaces to result
cristyfd9dcd42010-08-08 18:07:02 +00003782 func_to_host_path_result=`( cmd //c echo "$1" ) 2>/dev/null |
3783 $SED -e 's/[ ]*$//' -e "$lt_sed_naive_backslashify"`
cristy3ed852e2009-09-05 21:47:34 +00003784 ;;
3785 *cygwin* )
cristyfd9dcd42010-08-08 18:07:02 +00003786 func_to_host_path_result=`cygpath -w "$1" |
3787 $SED -e "$lt_sed_naive_backslashify"`
cristy3ed852e2009-09-05 21:47:34 +00003788 ;;
3789 * )
3790 # Unfortunately, winepath does not exit with a non-zero
3791 # error code, so we are forced to check the contents of
3792 # stdout. On the other hand, if the command is not
3793 # found, the shell will set an exit code of 127 and print
3794 # *an error message* to stdout. So we must check for both
3795 # error code of zero AND non-empty stdout, which explains
3796 # the odd construction:
3797 func_to_host_path_tmp1=`winepath -w "$1" 2>/dev/null`
3798 if test "$?" -eq 0 && test -n "${func_to_host_path_tmp1}"; then
cristyfd9dcd42010-08-08 18:07:02 +00003799 func_to_host_path_result=`$ECHO "$func_to_host_path_tmp1" |
cristy3ed852e2009-09-05 21:47:34 +00003800 $SED -e "$lt_sed_naive_backslashify"`
3801 else
3802 # Allow warning below.
cristyfd9dcd42010-08-08 18:07:02 +00003803 func_to_host_path_result=
cristy3ed852e2009-09-05 21:47:34 +00003804 fi
3805 ;;
3806 esac
3807 if test -z "$func_to_host_path_result" ; then
3808 func_error "Could not determine host path corresponding to"
cristyfd9dcd42010-08-08 18:07:02 +00003809 func_error " \`$1'"
cristy3ed852e2009-09-05 21:47:34 +00003810 func_error "Continuing, but uninstalled executables may not work."
3811 # Fallback:
3812 func_to_host_path_result="$1"
3813 fi
3814 ;;
3815 esac
3816 fi
3817}
3818# end: func_to_host_path
3819
3820# func_to_host_pathlist arg
3821#
3822# Convert pathlists to host format when used with build tools.
3823# See func_to_host_path(), above. This function supports the
3824# following $build/$host combinations (but does no harm for
3825# combinations not listed here):
3826# $build $host
3827# mingw (msys) mingw [e.g. native]
3828# cygwin mingw
3829# *nix + wine mingw
3830#
3831# Path separators are also converted from $build format to
3832# $host format. If ARG begins or ends with a path separator
3833# character, it is preserved (but converted to $host format)
3834# on output.
3835#
3836# ARG is a pathlist (on $build) that should be converted to
3837# the proper representation on $host. The result is stored
3838# in $func_to_host_pathlist_result.
3839func_to_host_pathlist ()
3840{
3841 func_to_host_pathlist_result="$1"
cristyfd9dcd42010-08-08 18:07:02 +00003842 if test -n "$1"; then
cristy3ed852e2009-09-05 21:47:34 +00003843 case $host in
3844 *mingw* )
3845 lt_sed_naive_backslashify='s|\\\\*|\\|g;s|/|\\|g;s|\\|\\\\|g'
3846 # Remove leading and trailing path separator characters from
3847 # ARG. msys behavior is inconsistent here, cygpath turns them
3848 # into '.;' and ';.', and winepath ignores them completely.
cristyfd9dcd42010-08-08 18:07:02 +00003849 func_stripname : : "$1"
3850 func_to_host_pathlist_tmp1=$func_stripname_result
cristy3ed852e2009-09-05 21:47:34 +00003851 case $build in
3852 *mingw* ) # Actually, msys.
3853 # Awkward: cmd appends spaces to result.
cristyfd9dcd42010-08-08 18:07:02 +00003854 func_to_host_pathlist_result=`
3855 ( cmd //c echo "$func_to_host_pathlist_tmp1" ) 2>/dev/null |
3856 $SED -e 's/[ ]*$//' -e "$lt_sed_naive_backslashify"`
cristy3ed852e2009-09-05 21:47:34 +00003857 ;;
3858 *cygwin* )
cristyfd9dcd42010-08-08 18:07:02 +00003859 func_to_host_pathlist_result=`cygpath -w -p "$func_to_host_pathlist_tmp1" |
cristy3ed852e2009-09-05 21:47:34 +00003860 $SED -e "$lt_sed_naive_backslashify"`
3861 ;;
3862 * )
3863 # unfortunately, winepath doesn't convert pathlists
3864 func_to_host_pathlist_result=""
3865 func_to_host_pathlist_oldIFS=$IFS
3866 IFS=:
3867 for func_to_host_pathlist_f in $func_to_host_pathlist_tmp1 ; do
3868 IFS=$func_to_host_pathlist_oldIFS
3869 if test -n "$func_to_host_pathlist_f" ; then
3870 func_to_host_path "$func_to_host_pathlist_f"
3871 if test -n "$func_to_host_path_result" ; then
3872 if test -z "$func_to_host_pathlist_result" ; then
3873 func_to_host_pathlist_result="$func_to_host_path_result"
3874 else
cristyfd9dcd42010-08-08 18:07:02 +00003875 func_append func_to_host_pathlist_result ";$func_to_host_path_result"
cristy3ed852e2009-09-05 21:47:34 +00003876 fi
3877 fi
3878 fi
cristy3ed852e2009-09-05 21:47:34 +00003879 done
3880 IFS=$func_to_host_pathlist_oldIFS
3881 ;;
3882 esac
cristyfd9dcd42010-08-08 18:07:02 +00003883 if test -z "$func_to_host_pathlist_result"; then
cristy3ed852e2009-09-05 21:47:34 +00003884 func_error "Could not determine the host path(s) corresponding to"
cristyfd9dcd42010-08-08 18:07:02 +00003885 func_error " \`$1'"
cristy3ed852e2009-09-05 21:47:34 +00003886 func_error "Continuing, but uninstalled executables may not work."
3887 # Fallback. This may break if $1 contains DOS-style drive
3888 # specifications. The fix is not to complicate the expression
3889 # below, but for the user to provide a working wine installation
3890 # with winepath so that path translation in the cross-to-mingw
3891 # case works properly.
3892 lt_replace_pathsep_nix_to_dos="s|:|;|g"
3893 func_to_host_pathlist_result=`echo "$func_to_host_pathlist_tmp1" |\
3894 $SED -e "$lt_replace_pathsep_nix_to_dos"`
3895 fi
3896 # Now, add the leading and trailing path separators back
3897 case "$1" in
3898 :* ) func_to_host_pathlist_result=";$func_to_host_pathlist_result"
3899 ;;
3900 esac
3901 case "$1" in
cristyfd9dcd42010-08-08 18:07:02 +00003902 *: ) func_append func_to_host_pathlist_result ";"
cristy3ed852e2009-09-05 21:47:34 +00003903 ;;
3904 esac
3905 ;;
3906 esac
3907 fi
3908}
3909# end: func_to_host_pathlist
3910
3911# func_emit_cwrapperexe_src
3912# emit the source code for a wrapper executable on stdout
3913# Must ONLY be called from within func_mode_link because
3914# it depends on a number of variable set therein.
3915func_emit_cwrapperexe_src ()
3916{
3917 cat <<EOF
3918
3919/* $cwrappersource - temporary wrapper executable for $objdir/$outputname
3920 Generated by $PROGRAM (GNU $PACKAGE$TIMESTAMP) $VERSION
3921
3922 The $output program cannot be directly executed until all the libtool
3923 libraries that it depends on are installed.
3924
3925 This wrapper executable should never be moved out of the build directory.
3926 If it is, it will not operate correctly.
cristy3ed852e2009-09-05 21:47:34 +00003927*/
3928EOF
3929 cat <<"EOF"
cristyfd9dcd42010-08-08 18:07:02 +00003930#ifdef _MSC_VER
3931# define _CRT_SECURE_NO_DEPRECATE 1
3932#endif
cristy3ed852e2009-09-05 21:47:34 +00003933#include <stdio.h>
3934#include <stdlib.h>
3935#ifdef _MSC_VER
3936# include <direct.h>
3937# include <process.h>
3938# include <io.h>
cristy3ed852e2009-09-05 21:47:34 +00003939#else
3940# include <unistd.h>
3941# include <stdint.h>
3942# ifdef __CYGWIN__
3943# include <io.h>
cristy3ed852e2009-09-05 21:47:34 +00003944# endif
3945#endif
3946#include <malloc.h>
3947#include <stdarg.h>
3948#include <assert.h>
3949#include <string.h>
3950#include <ctype.h>
3951#include <errno.h>
3952#include <fcntl.h>
3953#include <sys/stat.h>
3954
cristyfd9dcd42010-08-08 18:07:02 +00003955/* declarations of non-ANSI functions */
3956#if defined(__MINGW32__)
3957# ifdef __STRICT_ANSI__
3958int _putenv (const char *);
3959# endif
3960#elif defined(__CYGWIN__)
3961# ifdef __STRICT_ANSI__
3962char *realpath (const char *, char *);
3963int putenv (char *);
3964int setenv (const char *, const char *, int);
3965# endif
3966/* #elif defined (other platforms) ... */
3967#endif
3968
3969/* portability defines, excluding path handling macros */
3970#if defined(_MSC_VER)
3971# define setmode _setmode
3972# define stat _stat
3973# define chmod _chmod
3974# define getcwd _getcwd
3975# define putenv _putenv
3976# define S_IXUSR _S_IEXEC
3977# ifndef _INTPTR_T_DEFINED
3978# define _INTPTR_T_DEFINED
3979# define intptr_t int
3980# endif
3981#elif defined(__MINGW32__)
3982# define setmode _setmode
3983# define stat _stat
3984# define chmod _chmod
3985# define getcwd _getcwd
3986# define putenv _putenv
3987#elif defined(__CYGWIN__)
3988# define HAVE_SETENV
3989# define FOPEN_WB "wb"
3990/* #elif defined (other platforms) ... */
3991#endif
3992
cristy3ed852e2009-09-05 21:47:34 +00003993#if defined(PATH_MAX)
3994# define LT_PATHMAX PATH_MAX
3995#elif defined(MAXPATHLEN)
3996# define LT_PATHMAX MAXPATHLEN
3997#else
3998# define LT_PATHMAX 1024
3999#endif
4000
4001#ifndef S_IXOTH
4002# define S_IXOTH 0
4003#endif
4004#ifndef S_IXGRP
4005# define S_IXGRP 0
4006#endif
4007
cristyfd9dcd42010-08-08 18:07:02 +00004008/* path handling portability macros */
cristy3ed852e2009-09-05 21:47:34 +00004009#ifndef DIR_SEPARATOR
4010# define DIR_SEPARATOR '/'
4011# define PATH_SEPARATOR ':'
4012#endif
4013
4014#if defined (_WIN32) || defined (__MSDOS__) || defined (__DJGPP__) || \
4015 defined (__OS2__)
4016# define HAVE_DOS_BASED_FILE_SYSTEM
4017# define FOPEN_WB "wb"
4018# ifndef DIR_SEPARATOR_2
4019# define DIR_SEPARATOR_2 '\\'
4020# endif
4021# ifndef PATH_SEPARATOR_2
4022# define PATH_SEPARATOR_2 ';'
4023# endif
4024#endif
4025
4026#ifndef DIR_SEPARATOR_2
4027# define IS_DIR_SEPARATOR(ch) ((ch) == DIR_SEPARATOR)
4028#else /* DIR_SEPARATOR_2 */
4029# define IS_DIR_SEPARATOR(ch) \
4030 (((ch) == DIR_SEPARATOR) || ((ch) == DIR_SEPARATOR_2))
4031#endif /* DIR_SEPARATOR_2 */
4032
4033#ifndef PATH_SEPARATOR_2
4034# define IS_PATH_SEPARATOR(ch) ((ch) == PATH_SEPARATOR)
4035#else /* PATH_SEPARATOR_2 */
4036# define IS_PATH_SEPARATOR(ch) ((ch) == PATH_SEPARATOR_2)
4037#endif /* PATH_SEPARATOR_2 */
4038
cristy3ed852e2009-09-05 21:47:34 +00004039#ifndef FOPEN_WB
4040# define FOPEN_WB "w"
4041#endif
4042#ifndef _O_BINARY
4043# define _O_BINARY 0
4044#endif
4045
4046#define XMALLOC(type, num) ((type *) xmalloc ((num) * sizeof(type)))
4047#define XFREE(stale) do { \
4048 if (stale) { free ((void *) stale); stale = 0; } \
4049} while (0)
4050
cristyfd9dcd42010-08-08 18:07:02 +00004051#if defined(LT_DEBUGWRAPPER)
4052static int lt_debug = 1;
cristy3ed852e2009-09-05 21:47:34 +00004053#else
cristyfd9dcd42010-08-08 18:07:02 +00004054static int lt_debug = 0;
cristy3ed852e2009-09-05 21:47:34 +00004055#endif
4056
cristyfd9dcd42010-08-08 18:07:02 +00004057const char *program_name = "libtool-wrapper"; /* in case xstrdup fails */
cristy3ed852e2009-09-05 21:47:34 +00004058
4059void *xmalloc (size_t num);
4060char *xstrdup (const char *string);
4061const char *base_name (const char *name);
4062char *find_executable (const char *wrapper);
4063char *chase_symlinks (const char *pathspec);
4064int make_executable (const char *path);
4065int check_executable (const char *path);
4066char *strendzap (char *str, const char *pat);
cristyfd9dcd42010-08-08 18:07:02 +00004067void lt_debugprintf (const char *file, int line, const char *fmt, ...);
4068void lt_fatal (const char *file, int line, const char *message, ...);
4069static const char *nonnull (const char *s);
4070static const char *nonempty (const char *s);
cristy3ed852e2009-09-05 21:47:34 +00004071void lt_setenv (const char *name, const char *value);
4072char *lt_extend_str (const char *orig_value, const char *add, int to_end);
cristy3ed852e2009-09-05 21:47:34 +00004073void lt_update_exe_path (const char *name, const char *value);
4074void lt_update_lib_path (const char *name, const char *value);
cristyfd9dcd42010-08-08 18:07:02 +00004075char **prepare_spawn (char **argv);
4076void lt_dump_script (FILE *f);
cristy3ed852e2009-09-05 21:47:34 +00004077EOF
4078
cristy3ed852e2009-09-05 21:47:34 +00004079 cat <<EOF
4080const char * MAGIC_EXE = "$magic_exe";
4081const char * LIB_PATH_VARNAME = "$shlibpath_var";
4082EOF
4083
4084 if test "$shlibpath_overrides_runpath" = yes && test -n "$shlibpath_var" && test -n "$temp_rpath"; then
4085 func_to_host_pathlist "$temp_rpath"
4086 cat <<EOF
4087const char * LIB_PATH_VALUE = "$func_to_host_pathlist_result";
4088EOF
4089 else
4090 cat <<"EOF"
4091const char * LIB_PATH_VALUE = "";
4092EOF
4093 fi
4094
4095 if test -n "$dllsearchpath"; then
4096 func_to_host_pathlist "$dllsearchpath:"
4097 cat <<EOF
4098const char * EXE_PATH_VARNAME = "PATH";
4099const char * EXE_PATH_VALUE = "$func_to_host_pathlist_result";
4100EOF
4101 else
4102 cat <<"EOF"
4103const char * EXE_PATH_VARNAME = "";
4104const char * EXE_PATH_VALUE = "";
4105EOF
4106 fi
4107
4108 if test "$fast_install" = yes; then
4109 cat <<EOF
4110const char * TARGET_PROGRAM_NAME = "lt-$outputname"; /* hopefully, no .exe */
4111EOF
4112 else
4113 cat <<EOF
4114const char * TARGET_PROGRAM_NAME = "$outputname"; /* hopefully, no .exe */
4115EOF
4116 fi
4117
4118
4119 cat <<"EOF"
4120
4121#define LTWRAPPER_OPTION_PREFIX "--lt-"
cristy3ed852e2009-09-05 21:47:34 +00004122
cristy3ed852e2009-09-05 21:47:34 +00004123static const char *ltwrapper_option_prefix = LTWRAPPER_OPTION_PREFIX;
cristy3ed852e2009-09-05 21:47:34 +00004124static const char *dumpscript_opt = LTWRAPPER_OPTION_PREFIX "dump-script";
cristyfd9dcd42010-08-08 18:07:02 +00004125static const char *debug_opt = LTWRAPPER_OPTION_PREFIX "debug";
cristycd4c5312009-11-22 01:19:08 +00004126
cristy3ed852e2009-09-05 21:47:34 +00004127int
4128main (int argc, char *argv[])
4129{
4130 char **newargz;
4131 int newargc;
4132 char *tmp_pathspec;
4133 char *actual_cwrapper_path;
4134 char *actual_cwrapper_name;
4135 char *target_name;
4136 char *lt_argv_zero;
4137 intptr_t rval = 127;
4138
4139 int i;
4140
4141 program_name = (char *) xstrdup (base_name (argv[0]));
cristyfd9dcd42010-08-08 18:07:02 +00004142 newargz = XMALLOC (char *, argc + 1);
cristy3ed852e2009-09-05 21:47:34 +00004143
cristyfd9dcd42010-08-08 18:07:02 +00004144 /* very simple arg parsing; don't want to rely on getopt
4145 * also, copy all non cwrapper options to newargz, except
4146 * argz[0], which is handled differently
4147 */
4148 newargc=0;
cristy3ed852e2009-09-05 21:47:34 +00004149 for (i = 1; i < argc; i++)
4150 {
4151 if (strcmp (argv[i], dumpscript_opt) == 0)
4152 {
4153EOF
4154 case "$host" in
4155 *mingw* | *cygwin* )
4156 # make stdout use "unix" line endings
4157 echo " setmode(1,_O_BINARY);"
4158 ;;
4159 esac
4160
4161 cat <<"EOF"
cristyfd9dcd42010-08-08 18:07:02 +00004162 lt_dump_script (stdout);
cristy3ed852e2009-09-05 21:47:34 +00004163 return 0;
4164 }
cristyfd9dcd42010-08-08 18:07:02 +00004165 if (strcmp (argv[i], debug_opt) == 0)
4166 {
4167 lt_debug = 1;
4168 continue;
4169 }
4170 if (strcmp (argv[i], ltwrapper_option_prefix) == 0)
4171 {
4172 /* however, if there is an option in the LTWRAPPER_OPTION_PREFIX
4173 namespace, but it is not one of the ones we know about and
4174 have already dealt with, above (inluding dump-script), then
4175 report an error. Otherwise, targets might begin to believe
4176 they are allowed to use options in the LTWRAPPER_OPTION_PREFIX
4177 namespace. The first time any user complains about this, we'll
4178 need to make LTWRAPPER_OPTION_PREFIX a configure-time option
4179 or a configure.ac-settable value.
4180 */
4181 lt_fatal (__FILE__, __LINE__,
4182 "unrecognized %s option: '%s'",
4183 ltwrapper_option_prefix, argv[i]);
4184 }
4185 /* otherwise ... */
4186 newargz[++newargc] = xstrdup (argv[i]);
cristy3ed852e2009-09-05 21:47:34 +00004187 }
cristyfd9dcd42010-08-08 18:07:02 +00004188 newargz[++newargc] = NULL;
cristy3ed852e2009-09-05 21:47:34 +00004189
cristyfd9dcd42010-08-08 18:07:02 +00004190EOF
4191 cat <<EOF
4192 /* The GNU banner must be the first non-error debug message */
4193 lt_debugprintf (__FILE__, __LINE__, "libtool wrapper (GNU $PACKAGE$TIMESTAMP) $VERSION\n");
4194EOF
4195 cat <<"EOF"
4196 lt_debugprintf (__FILE__, __LINE__, "(main) argv[0]: %s\n", argv[0]);
4197 lt_debugprintf (__FILE__, __LINE__, "(main) program_name: %s\n", program_name);
4198
cristy3ed852e2009-09-05 21:47:34 +00004199 tmp_pathspec = find_executable (argv[0]);
4200 if (tmp_pathspec == NULL)
cristyfd9dcd42010-08-08 18:07:02 +00004201 lt_fatal (__FILE__, __LINE__, "couldn't find %s", argv[0]);
4202 lt_debugprintf (__FILE__, __LINE__,
4203 "(main) found exe (before symlink chase) at: %s\n",
4204 tmp_pathspec);
cristy3ed852e2009-09-05 21:47:34 +00004205
4206 actual_cwrapper_path = chase_symlinks (tmp_pathspec);
cristyfd9dcd42010-08-08 18:07:02 +00004207 lt_debugprintf (__FILE__, __LINE__,
4208 "(main) found exe (after symlink chase) at: %s\n",
4209 actual_cwrapper_path);
cristy3ed852e2009-09-05 21:47:34 +00004210 XFREE (tmp_pathspec);
4211
cristyfd9dcd42010-08-08 18:07:02 +00004212 actual_cwrapper_name = xstrdup (base_name (actual_cwrapper_path));
cristy3ed852e2009-09-05 21:47:34 +00004213 strendzap (actual_cwrapper_path, actual_cwrapper_name);
4214
4215 /* wrapper name transforms */
4216 strendzap (actual_cwrapper_name, ".exe");
4217 tmp_pathspec = lt_extend_str (actual_cwrapper_name, ".exe", 1);
4218 XFREE (actual_cwrapper_name);
4219 actual_cwrapper_name = tmp_pathspec;
4220 tmp_pathspec = 0;
4221
4222 /* target_name transforms -- use actual target program name; might have lt- prefix */
4223 target_name = xstrdup (base_name (TARGET_PROGRAM_NAME));
4224 strendzap (target_name, ".exe");
4225 tmp_pathspec = lt_extend_str (target_name, ".exe", 1);
4226 XFREE (target_name);
4227 target_name = tmp_pathspec;
4228 tmp_pathspec = 0;
4229
cristyfd9dcd42010-08-08 18:07:02 +00004230 lt_debugprintf (__FILE__, __LINE__,
4231 "(main) libtool target name: %s\n",
4232 target_name);
cristy3ed852e2009-09-05 21:47:34 +00004233EOF
4234
4235 cat <<EOF
4236 newargz[0] =
4237 XMALLOC (char, (strlen (actual_cwrapper_path) +
4238 strlen ("$objdir") + 1 + strlen (actual_cwrapper_name) + 1));
4239 strcpy (newargz[0], actual_cwrapper_path);
4240 strcat (newargz[0], "$objdir");
4241 strcat (newargz[0], "/");
4242EOF
4243
4244 cat <<"EOF"
4245 /* stop here, and copy so we don't have to do this twice */
4246 tmp_pathspec = xstrdup (newargz[0]);
4247
4248 /* do NOT want the lt- prefix here, so use actual_cwrapper_name */
4249 strcat (newargz[0], actual_cwrapper_name);
4250
4251 /* DO want the lt- prefix here if it exists, so use target_name */
4252 lt_argv_zero = lt_extend_str (tmp_pathspec, target_name, 1);
4253 XFREE (tmp_pathspec);
4254 tmp_pathspec = NULL;
4255EOF
4256
4257 case $host_os in
4258 mingw*)
4259 cat <<"EOF"
4260 {
4261 char* p;
4262 while ((p = strchr (newargz[0], '\\')) != NULL)
4263 {
4264 *p = '/';
4265 }
4266 while ((p = strchr (lt_argv_zero, '\\')) != NULL)
4267 {
4268 *p = '/';
4269 }
4270 }
4271EOF
4272 ;;
4273 esac
4274
4275 cat <<"EOF"
4276 XFREE (target_name);
4277 XFREE (actual_cwrapper_path);
4278 XFREE (actual_cwrapper_name);
4279
4280 lt_setenv ("BIN_SH", "xpg4"); /* for Tru64 */
4281 lt_setenv ("DUALCASE", "1"); /* for MSK sh */
4282 lt_update_lib_path (LIB_PATH_VARNAME, LIB_PATH_VALUE);
4283 lt_update_exe_path (EXE_PATH_VARNAME, EXE_PATH_VALUE);
4284
cristyfd9dcd42010-08-08 18:07:02 +00004285 lt_debugprintf (__FILE__, __LINE__, "(main) lt_argv_zero: %s\n",
4286 nonnull (lt_argv_zero));
cristy3ed852e2009-09-05 21:47:34 +00004287 for (i = 0; i < newargc; i++)
4288 {
cristyfd9dcd42010-08-08 18:07:02 +00004289 lt_debugprintf (__FILE__, __LINE__, "(main) newargz[%d]: %s\n",
4290 i, nonnull (newargz[i]));
cristy3ed852e2009-09-05 21:47:34 +00004291 }
4292
4293EOF
4294
4295 case $host_os in
4296 mingw*)
4297 cat <<"EOF"
4298 /* execv doesn't actually work on mingw as expected on unix */
cristyfd9dcd42010-08-08 18:07:02 +00004299 newargz = prepare_spawn (newargz);
cristy3ed852e2009-09-05 21:47:34 +00004300 rval = _spawnv (_P_WAIT, lt_argv_zero, (const char * const *) newargz);
4301 if (rval == -1)
4302 {
4303 /* failed to start process */
cristyfd9dcd42010-08-08 18:07:02 +00004304 lt_debugprintf (__FILE__, __LINE__,
4305 "(main) failed to launch target \"%s\": %s\n",
4306 lt_argv_zero, nonnull (strerror (errno)));
cristy3ed852e2009-09-05 21:47:34 +00004307 return 127;
4308 }
4309 return rval;
4310EOF
4311 ;;
4312 *)
4313 cat <<"EOF"
4314 execv (lt_argv_zero, newargz);
4315 return rval; /* =127, but avoids unused variable warning */
4316EOF
4317 ;;
4318 esac
4319
4320 cat <<"EOF"
4321}
4322
4323void *
4324xmalloc (size_t num)
4325{
4326 void *p = (void *) malloc (num);
4327 if (!p)
cristyfd9dcd42010-08-08 18:07:02 +00004328 lt_fatal (__FILE__, __LINE__, "memory exhausted");
cristy3ed852e2009-09-05 21:47:34 +00004329
4330 return p;
4331}
4332
4333char *
4334xstrdup (const char *string)
4335{
4336 return string ? strcpy ((char *) xmalloc (strlen (string) + 1),
4337 string) : NULL;
4338}
4339
4340const char *
4341base_name (const char *name)
4342{
4343 const char *base;
4344
4345#if defined (HAVE_DOS_BASED_FILE_SYSTEM)
4346 /* Skip over the disk name in MSDOS pathnames. */
4347 if (isalpha ((unsigned char) name[0]) && name[1] == ':')
4348 name += 2;
4349#endif
4350
4351 for (base = name; *name; name++)
4352 if (IS_DIR_SEPARATOR (*name))
4353 base = name + 1;
4354 return base;
4355}
4356
4357int
4358check_executable (const char *path)
4359{
4360 struct stat st;
4361
cristyfd9dcd42010-08-08 18:07:02 +00004362 lt_debugprintf (__FILE__, __LINE__, "(check_executable): %s\n",
4363 nonempty (path));
cristy3ed852e2009-09-05 21:47:34 +00004364 if ((!path) || (!*path))
4365 return 0;
4366
4367 if ((stat (path, &st) >= 0)
4368 && (st.st_mode & (S_IXUSR | S_IXGRP | S_IXOTH)))
4369 return 1;
4370 else
4371 return 0;
4372}
4373
4374int
4375make_executable (const char *path)
4376{
4377 int rval = 0;
4378 struct stat st;
4379
cristyfd9dcd42010-08-08 18:07:02 +00004380 lt_debugprintf (__FILE__, __LINE__, "(make_executable): %s\n",
4381 nonempty (path));
cristy3ed852e2009-09-05 21:47:34 +00004382 if ((!path) || (!*path))
4383 return 0;
4384
4385 if (stat (path, &st) >= 0)
4386 {
4387 rval = chmod (path, st.st_mode | S_IXOTH | S_IXGRP | S_IXUSR);
4388 }
4389 return rval;
4390}
4391
4392/* Searches for the full path of the wrapper. Returns
4393 newly allocated full path name if found, NULL otherwise
4394 Does not chase symlinks, even on platforms that support them.
4395*/
4396char *
4397find_executable (const char *wrapper)
4398{
4399 int has_slash = 0;
4400 const char *p;
4401 const char *p_next;
4402 /* static buffer for getcwd */
4403 char tmp[LT_PATHMAX + 1];
4404 int tmp_len;
4405 char *concat_name;
4406
cristyfd9dcd42010-08-08 18:07:02 +00004407 lt_debugprintf (__FILE__, __LINE__, "(find_executable): %s\n",
4408 nonempty (wrapper));
cristy3ed852e2009-09-05 21:47:34 +00004409
4410 if ((wrapper == NULL) || (*wrapper == '\0'))
4411 return NULL;
4412
4413 /* Absolute path? */
4414#if defined (HAVE_DOS_BASED_FILE_SYSTEM)
4415 if (isalpha ((unsigned char) wrapper[0]) && wrapper[1] == ':')
4416 {
4417 concat_name = xstrdup (wrapper);
4418 if (check_executable (concat_name))
4419 return concat_name;
4420 XFREE (concat_name);
4421 }
4422 else
4423 {
4424#endif
4425 if (IS_DIR_SEPARATOR (wrapper[0]))
4426 {
4427 concat_name = xstrdup (wrapper);
4428 if (check_executable (concat_name))
4429 return concat_name;
4430 XFREE (concat_name);
4431 }
4432#if defined (HAVE_DOS_BASED_FILE_SYSTEM)
4433 }
4434#endif
4435
4436 for (p = wrapper; *p; p++)
4437 if (*p == '/')
4438 {
4439 has_slash = 1;
4440 break;
4441 }
4442 if (!has_slash)
4443 {
4444 /* no slashes; search PATH */
4445 const char *path = getenv ("PATH");
4446 if (path != NULL)
4447 {
4448 for (p = path; *p; p = p_next)
4449 {
4450 const char *q;
4451 size_t p_len;
4452 for (q = p; *q; q++)
4453 if (IS_PATH_SEPARATOR (*q))
4454 break;
4455 p_len = q - p;
4456 p_next = (*q == '\0' ? q : q + 1);
4457 if (p_len == 0)
4458 {
4459 /* empty path: current directory */
4460 if (getcwd (tmp, LT_PATHMAX) == NULL)
cristyfd9dcd42010-08-08 18:07:02 +00004461 lt_fatal (__FILE__, __LINE__, "getcwd failed: %s",
4462 nonnull (strerror (errno)));
cristy3ed852e2009-09-05 21:47:34 +00004463 tmp_len = strlen (tmp);
4464 concat_name =
4465 XMALLOC (char, tmp_len + 1 + strlen (wrapper) + 1);
4466 memcpy (concat_name, tmp, tmp_len);
4467 concat_name[tmp_len] = '/';
4468 strcpy (concat_name + tmp_len + 1, wrapper);
4469 }
4470 else
4471 {
4472 concat_name =
4473 XMALLOC (char, p_len + 1 + strlen (wrapper) + 1);
4474 memcpy (concat_name, p, p_len);
4475 concat_name[p_len] = '/';
4476 strcpy (concat_name + p_len + 1, wrapper);
4477 }
4478 if (check_executable (concat_name))
4479 return concat_name;
4480 XFREE (concat_name);
4481 }
4482 }
4483 /* not found in PATH; assume curdir */
4484 }
4485 /* Relative path | not found in path: prepend cwd */
4486 if (getcwd (tmp, LT_PATHMAX) == NULL)
cristyfd9dcd42010-08-08 18:07:02 +00004487 lt_fatal (__FILE__, __LINE__, "getcwd failed: %s",
4488 nonnull (strerror (errno)));
cristy3ed852e2009-09-05 21:47:34 +00004489 tmp_len = strlen (tmp);
4490 concat_name = XMALLOC (char, tmp_len + 1 + strlen (wrapper) + 1);
4491 memcpy (concat_name, tmp, tmp_len);
4492 concat_name[tmp_len] = '/';
4493 strcpy (concat_name + tmp_len + 1, wrapper);
4494
4495 if (check_executable (concat_name))
4496 return concat_name;
4497 XFREE (concat_name);
4498 return NULL;
4499}
4500
4501char *
4502chase_symlinks (const char *pathspec)
4503{
4504#ifndef S_ISLNK
4505 return xstrdup (pathspec);
4506#else
4507 char buf[LT_PATHMAX];
4508 struct stat s;
4509 char *tmp_pathspec = xstrdup (pathspec);
4510 char *p;
4511 int has_symlinks = 0;
4512 while (strlen (tmp_pathspec) && !has_symlinks)
4513 {
cristyfd9dcd42010-08-08 18:07:02 +00004514 lt_debugprintf (__FILE__, __LINE__,
4515 "checking path component for symlinks: %s\n",
4516 tmp_pathspec);
cristy3ed852e2009-09-05 21:47:34 +00004517 if (lstat (tmp_pathspec, &s) == 0)
4518 {
4519 if (S_ISLNK (s.st_mode) != 0)
4520 {
4521 has_symlinks = 1;
4522 break;
4523 }
4524
4525 /* search backwards for last DIR_SEPARATOR */
4526 p = tmp_pathspec + strlen (tmp_pathspec) - 1;
4527 while ((p > tmp_pathspec) && (!IS_DIR_SEPARATOR (*p)))
4528 p--;
4529 if ((p == tmp_pathspec) && (!IS_DIR_SEPARATOR (*p)))
4530 {
4531 /* no more DIR_SEPARATORS left */
4532 break;
4533 }
4534 *p = '\0';
4535 }
4536 else
4537 {
cristyfd9dcd42010-08-08 18:07:02 +00004538 lt_fatal (__FILE__, __LINE__,
4539 "error accessing file \"%s\": %s",
4540 tmp_pathspec, nonnull (strerror (errno)));
cristy3ed852e2009-09-05 21:47:34 +00004541 }
4542 }
4543 XFREE (tmp_pathspec);
4544
4545 if (!has_symlinks)
4546 {
4547 return xstrdup (pathspec);
4548 }
4549
4550 tmp_pathspec = realpath (pathspec, buf);
4551 if (tmp_pathspec == 0)
4552 {
cristyfd9dcd42010-08-08 18:07:02 +00004553 lt_fatal (__FILE__, __LINE__,
4554 "could not follow symlinks for %s", pathspec);
cristy3ed852e2009-09-05 21:47:34 +00004555 }
4556 return xstrdup (tmp_pathspec);
4557#endif
4558}
4559
4560char *
4561strendzap (char *str, const char *pat)
4562{
4563 size_t len, patlen;
4564
4565 assert (str != NULL);
4566 assert (pat != NULL);
4567
4568 len = strlen (str);
4569 patlen = strlen (pat);
4570
4571 if (patlen <= len)
4572 {
4573 str += len - patlen;
4574 if (strcmp (str, pat) == 0)
4575 *str = '\0';
4576 }
4577 return str;
4578}
4579
cristyfd9dcd42010-08-08 18:07:02 +00004580void
4581lt_debugprintf (const char *file, int line, const char *fmt, ...)
4582{
4583 va_list args;
4584 if (lt_debug)
4585 {
4586 (void) fprintf (stderr, "%s:%s:%d: ", program_name, file, line);
4587 va_start (args, fmt);
4588 (void) vfprintf (stderr, fmt, args);
4589 va_end (args);
4590 }
4591}
4592
cristy3ed852e2009-09-05 21:47:34 +00004593static void
cristyfd9dcd42010-08-08 18:07:02 +00004594lt_error_core (int exit_status, const char *file,
4595 int line, const char *mode,
cristy3ed852e2009-09-05 21:47:34 +00004596 const char *message, va_list ap)
4597{
cristyfd9dcd42010-08-08 18:07:02 +00004598 fprintf (stderr, "%s:%s:%d: %s: ", program_name, file, line, mode);
cristy3ed852e2009-09-05 21:47:34 +00004599 vfprintf (stderr, message, ap);
4600 fprintf (stderr, ".\n");
4601
4602 if (exit_status >= 0)
4603 exit (exit_status);
4604}
4605
4606void
cristyfd9dcd42010-08-08 18:07:02 +00004607lt_fatal (const char *file, int line, const char *message, ...)
cristy3ed852e2009-09-05 21:47:34 +00004608{
4609 va_list ap;
4610 va_start (ap, message);
cristyfd9dcd42010-08-08 18:07:02 +00004611 lt_error_core (EXIT_FAILURE, file, line, "FATAL", message, ap);
cristy3ed852e2009-09-05 21:47:34 +00004612 va_end (ap);
4613}
4614
cristyfd9dcd42010-08-08 18:07:02 +00004615static const char *
4616nonnull (const char *s)
4617{
4618 return s ? s : "(null)";
4619}
4620
4621static const char *
4622nonempty (const char *s)
4623{
4624 return (s && !*s) ? "(empty)" : nonnull (s);
4625}
4626
cristy3ed852e2009-09-05 21:47:34 +00004627void
4628lt_setenv (const char *name, const char *value)
4629{
cristyfd9dcd42010-08-08 18:07:02 +00004630 lt_debugprintf (__FILE__, __LINE__,
4631 "(lt_setenv) setting '%s' to '%s'\n",
4632 nonnull (name), nonnull (value));
cristy3ed852e2009-09-05 21:47:34 +00004633 {
4634#ifdef HAVE_SETENV
4635 /* always make a copy, for consistency with !HAVE_SETENV */
4636 char *str = xstrdup (value);
4637 setenv (name, str, 1);
4638#else
4639 int len = strlen (name) + 1 + strlen (value) + 1;
4640 char *str = XMALLOC (char, len);
4641 sprintf (str, "%s=%s", name, value);
4642 if (putenv (str) != EXIT_SUCCESS)
4643 {
4644 XFREE (str);
4645 }
4646#endif
4647 }
4648}
4649
4650char *
4651lt_extend_str (const char *orig_value, const char *add, int to_end)
4652{
4653 char *new_value;
4654 if (orig_value && *orig_value)
4655 {
4656 int orig_value_len = strlen (orig_value);
4657 int add_len = strlen (add);
4658 new_value = XMALLOC (char, add_len + orig_value_len + 1);
4659 if (to_end)
4660 {
4661 strcpy (new_value, orig_value);
4662 strcpy (new_value + orig_value_len, add);
4663 }
4664 else
4665 {
4666 strcpy (new_value, add);
4667 strcpy (new_value + add_len, orig_value);
4668 }
4669 }
4670 else
4671 {
4672 new_value = xstrdup (add);
4673 }
4674 return new_value;
4675}
4676
cristy3ed852e2009-09-05 21:47:34 +00004677void
4678lt_update_exe_path (const char *name, const char *value)
4679{
cristyfd9dcd42010-08-08 18:07:02 +00004680 lt_debugprintf (__FILE__, __LINE__,
4681 "(lt_update_exe_path) modifying '%s' by prepending '%s'\n",
4682 nonnull (name), nonnull (value));
cristy3ed852e2009-09-05 21:47:34 +00004683
4684 if (name && *name && value && *value)
4685 {
4686 char *new_value = lt_extend_str (getenv (name), value, 0);
4687 /* some systems can't cope with a ':'-terminated path #' */
4688 int len = strlen (new_value);
4689 while (((len = strlen (new_value)) > 0) && IS_PATH_SEPARATOR (new_value[len-1]))
4690 {
4691 new_value[len-1] = '\0';
4692 }
4693 lt_setenv (name, new_value);
4694 XFREE (new_value);
4695 }
4696}
4697
4698void
4699lt_update_lib_path (const char *name, const char *value)
4700{
cristyfd9dcd42010-08-08 18:07:02 +00004701 lt_debugprintf (__FILE__, __LINE__,
4702 "(lt_update_lib_path) modifying '%s' by prepending '%s'\n",
4703 nonnull (name), nonnull (value));
cristy3ed852e2009-09-05 21:47:34 +00004704
4705 if (name && *name && value && *value)
4706 {
4707 char *new_value = lt_extend_str (getenv (name), value, 0);
4708 lt_setenv (name, new_value);
4709 XFREE (new_value);
4710 }
4711}
4712
cristyfd9dcd42010-08-08 18:07:02 +00004713EOF
4714 case $host_os in
4715 mingw*)
4716 cat <<"EOF"
cristy3ed852e2009-09-05 21:47:34 +00004717
cristyfd9dcd42010-08-08 18:07:02 +00004718/* Prepares an argument vector before calling spawn().
4719 Note that spawn() does not by itself call the command interpreter
4720 (getenv ("COMSPEC") != NULL ? getenv ("COMSPEC") :
4721 ({ OSVERSIONINFO v; v.dwOSVersionInfoSize = sizeof(OSVERSIONINFO);
4722 GetVersionEx(&v);
4723 v.dwPlatformId == VER_PLATFORM_WIN32_NT;
4724 }) ? "cmd.exe" : "command.com").
4725 Instead it simply concatenates the arguments, separated by ' ', and calls
4726 CreateProcess(). We must quote the arguments since Win32 CreateProcess()
4727 interprets characters like ' ', '\t', '\\', '"' (but not '<' and '>') in a
4728 special way:
4729 - Space and tab are interpreted as delimiters. They are not treated as
4730 delimiters if they are surrounded by double quotes: "...".
4731 - Unescaped double quotes are removed from the input. Their only effect is
4732 that within double quotes, space and tab are treated like normal
4733 characters.
4734 - Backslashes not followed by double quotes are not special.
4735 - But 2*n+1 backslashes followed by a double quote become
4736 n backslashes followed by a double quote (n >= 0):
4737 \" -> "
4738 \\\" -> \"
4739 \\\\\" -> \\"
4740 */
4741#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"
4742#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"
4743char **
4744prepare_spawn (char **argv)
4745{
4746 size_t argc;
4747 char **new_argv;
4748 size_t i;
4749
4750 /* Count number of arguments. */
4751 for (argc = 0; argv[argc] != NULL; argc++)
4752 ;
4753
4754 /* Allocate new argument vector. */
4755 new_argv = XMALLOC (char *, argc + 1);
4756
4757 /* Put quoted arguments into the new argument vector. */
4758 for (i = 0; i < argc; i++)
4759 {
4760 const char *string = argv[i];
4761
4762 if (string[0] == '\0')
4763 new_argv[i] = xstrdup ("\"\"");
4764 else if (strpbrk (string, SHELL_SPECIAL_CHARS) != NULL)
4765 {
4766 int quote_around = (strpbrk (string, SHELL_SPACE_CHARS) != NULL);
4767 size_t length;
4768 unsigned int backslashes;
4769 const char *s;
4770 char *quoted_string;
4771 char *p;
4772
4773 length = 0;
4774 backslashes = 0;
4775 if (quote_around)
4776 length++;
4777 for (s = string; *s != '\0'; s++)
4778 {
4779 char c = *s;
4780 if (c == '"')
4781 length += backslashes + 1;
4782 length++;
4783 if (c == '\\')
4784 backslashes++;
4785 else
4786 backslashes = 0;
4787 }
4788 if (quote_around)
4789 length += backslashes + 1;
4790
4791 quoted_string = XMALLOC (char, length + 1);
4792
4793 p = quoted_string;
4794 backslashes = 0;
4795 if (quote_around)
4796 *p++ = '"';
4797 for (s = string; *s != '\0'; s++)
4798 {
4799 char c = *s;
4800 if (c == '"')
4801 {
4802 unsigned int j;
4803 for (j = backslashes + 1; j > 0; j--)
4804 *p++ = '\\';
4805 }
4806 *p++ = c;
4807 if (c == '\\')
4808 backslashes++;
4809 else
4810 backslashes = 0;
4811 }
4812 if (quote_around)
4813 {
4814 unsigned int j;
4815 for (j = backslashes; j > 0; j--)
4816 *p++ = '\\';
4817 *p++ = '"';
4818 }
4819 *p = '\0';
4820
4821 new_argv[i] = quoted_string;
4822 }
4823 else
4824 new_argv[i] = (char *) string;
4825 }
4826 new_argv[argc] = NULL;
4827
4828 return new_argv;
4829}
4830EOF
4831 ;;
4832 esac
4833
4834 cat <<"EOF"
4835void lt_dump_script (FILE* f)
4836{
4837EOF
4838 func_emit_wrapper yes |
4839 $SED -e 's/\([\\"]\)/\\\1/g' \
4840 -e 's/^/ fputs ("/' -e 's/$/\\n", f);/'
4841
4842 cat <<"EOF"
4843}
cristy3ed852e2009-09-05 21:47:34 +00004844EOF
4845}
4846# end: func_emit_cwrapperexe_src
4847
cristyfd9dcd42010-08-08 18:07:02 +00004848# func_win32_import_lib_p ARG
4849# True if ARG is an import lib, as indicated by $file_magic_cmd
4850func_win32_import_lib_p ()
4851{
4852 $opt_debug
4853 case `eval $file_magic_cmd \"\$1\" 2>/dev/null | $SED -e 10q` in
4854 *import*) : ;;
4855 *) false ;;
4856 esac
4857}
4858
cristy3ed852e2009-09-05 21:47:34 +00004859# func_mode_link arg...
4860func_mode_link ()
4861{
4862 $opt_debug
4863 case $host in
4864 *-*-cygwin* | *-*-mingw* | *-*-pw32* | *-*-os2* | *-cegcc*)
4865 # It is impossible to link a dll without this setting, and
4866 # we shouldn't force the makefile maintainer to figure out
4867 # which system we are compiling for in order to pass an extra
4868 # flag for every libtool invocation.
4869 # allow_undefined=no
4870
4871 # FIXME: Unfortunately, there are problems with the above when trying
4872 # to make a dll which has undefined symbols, in which case not
4873 # even a static library is built. For now, we need to specify
4874 # -no-undefined on the libtool link line when we can be certain
4875 # that all symbols are satisfied, otherwise we get a static library.
4876 allow_undefined=yes
4877 ;;
4878 *)
4879 allow_undefined=yes
4880 ;;
4881 esac
4882 libtool_args=$nonopt
4883 base_compile="$nonopt $@"
4884 compile_command=$nonopt
4885 finalize_command=$nonopt
4886
4887 compile_rpath=
4888 finalize_rpath=
4889 compile_shlibpath=
4890 finalize_shlibpath=
4891 convenience=
4892 old_convenience=
4893 deplibs=
4894 old_deplibs=
4895 compiler_flags=
4896 linker_flags=
4897 dllsearchpath=
4898 lib_search_path=`pwd`
4899 inst_prefix_dir=
4900 new_inherited_linker_flags=
4901
4902 avoid_version=no
cristyfd9dcd42010-08-08 18:07:02 +00004903 bindir=
cristy3ed852e2009-09-05 21:47:34 +00004904 dlfiles=
4905 dlprefiles=
4906 dlself=no
4907 export_dynamic=no
4908 export_symbols=
4909 export_symbols_regex=
4910 generated=
4911 libobjs=
4912 ltlibs=
4913 module=no
4914 no_install=no
4915 objs=
4916 non_pic_objects=
4917 precious_files_regex=
4918 prefer_static_libs=no
4919 preload=no
4920 prev=
4921 prevarg=
4922 release=
4923 rpath=
4924 xrpath=
4925 perm_rpath=
4926 temp_rpath=
4927 thread_safe=no
4928 vinfo=
4929 vinfo_number=no
4930 weak_libs=
4931 single_module="${wl}-single_module"
4932 func_infer_tag $base_compile
4933
4934 # We need to know -static, to get the right output filenames.
4935 for arg
4936 do
4937 case $arg in
4938 -shared)
4939 test "$build_libtool_libs" != yes && \
4940 func_fatal_configuration "can not build a shared library"
4941 build_old_libs=no
4942 break
4943 ;;
4944 -all-static | -static | -static-libtool-libs)
4945 case $arg in
4946 -all-static)
4947 if test "$build_libtool_libs" = yes && test -z "$link_static_flag"; then
4948 func_warning "complete static linking is impossible in this configuration"
4949 fi
4950 if test -n "$link_static_flag"; then
4951 dlopen_self=$dlopen_self_static
4952 fi
4953 prefer_static_libs=yes
4954 ;;
4955 -static)
4956 if test -z "$pic_flag" && test -n "$link_static_flag"; then
4957 dlopen_self=$dlopen_self_static
4958 fi
4959 prefer_static_libs=built
4960 ;;
4961 -static-libtool-libs)
4962 if test -z "$pic_flag" && test -n "$link_static_flag"; then
4963 dlopen_self=$dlopen_self_static
4964 fi
4965 prefer_static_libs=yes
4966 ;;
4967 esac
4968 build_libtool_libs=no
4969 build_old_libs=yes
4970 break
4971 ;;
4972 esac
4973 done
4974
4975 # See if our shared archives depend on static archives.
4976 test -n "$old_archive_from_new_cmds" && build_old_libs=yes
4977
4978 # Go through the arguments, transforming them on the way.
4979 while test "$#" -gt 0; do
4980 arg="$1"
4981 shift
4982 func_quote_for_eval "$arg"
4983 qarg=$func_quote_for_eval_unquoted_result
4984 func_append libtool_args " $func_quote_for_eval_result"
4985
4986 # If the previous option needs an argument, assign it.
4987 if test -n "$prev"; then
4988 case $prev in
4989 output)
4990 func_append compile_command " @OUTPUT@"
4991 func_append finalize_command " @OUTPUT@"
4992 ;;
4993 esac
4994
4995 case $prev in
cristyfd9dcd42010-08-08 18:07:02 +00004996 bindir)
4997 bindir="$arg"
4998 prev=
4999 continue
5000 ;;
cristy3ed852e2009-09-05 21:47:34 +00005001 dlfiles|dlprefiles)
5002 if test "$preload" = no; then
5003 # Add the symbol object into the linking commands.
5004 func_append compile_command " @SYMFILE@"
5005 func_append finalize_command " @SYMFILE@"
5006 preload=yes
5007 fi
5008 case $arg in
5009 *.la | *.lo) ;; # We handle these cases below.
5010 force)
5011 if test "$dlself" = no; then
5012 dlself=needless
5013 export_dynamic=yes
5014 fi
5015 prev=
5016 continue
5017 ;;
5018 self)
5019 if test "$prev" = dlprefiles; then
5020 dlself=yes
5021 elif test "$prev" = dlfiles && test "$dlopen_self" != yes; then
5022 dlself=yes
5023 else
5024 dlself=needless
5025 export_dynamic=yes
5026 fi
5027 prev=
5028 continue
5029 ;;
5030 *)
5031 if test "$prev" = dlfiles; then
5032 dlfiles="$dlfiles $arg"
5033 else
5034 dlprefiles="$dlprefiles $arg"
5035 fi
5036 prev=
5037 continue
5038 ;;
5039 esac
5040 ;;
5041 expsyms)
5042 export_symbols="$arg"
5043 test -f "$arg" \
5044 || func_fatal_error "symbol file \`$arg' does not exist"
5045 prev=
5046 continue
5047 ;;
5048 expsyms_regex)
5049 export_symbols_regex="$arg"
5050 prev=
5051 continue
5052 ;;
5053 framework)
5054 case $host in
5055 *-*-darwin*)
5056 case "$deplibs " in
5057 *" $qarg.ltframework "*) ;;
5058 *) deplibs="$deplibs $qarg.ltframework" # this is fixed later
5059 ;;
5060 esac
5061 ;;
5062 esac
5063 prev=
5064 continue
5065 ;;
5066 inst_prefix)
5067 inst_prefix_dir="$arg"
5068 prev=
5069 continue
5070 ;;
5071 objectlist)
5072 if test -f "$arg"; then
5073 save_arg=$arg
5074 moreargs=
5075 for fil in `cat "$save_arg"`
5076 do
5077# moreargs="$moreargs $fil"
5078 arg=$fil
5079 # A libtool-controlled object.
5080
5081 # Check to see that this really is a libtool object.
5082 if func_lalib_unsafe_p "$arg"; then
5083 pic_object=
5084 non_pic_object=
5085
5086 # Read the .lo file
5087 func_source "$arg"
5088
5089 if test -z "$pic_object" ||
5090 test -z "$non_pic_object" ||
5091 test "$pic_object" = none &&
5092 test "$non_pic_object" = none; then
5093 func_fatal_error "cannot find name of object for \`$arg'"
5094 fi
5095
5096 # Extract subdirectory from the argument.
5097 func_dirname "$arg" "/" ""
5098 xdir="$func_dirname_result"
5099
5100 if test "$pic_object" != none; then
5101 # Prepend the subdirectory the object is found in.
5102 pic_object="$xdir$pic_object"
5103
5104 if test "$prev" = dlfiles; then
5105 if test "$build_libtool_libs" = yes && test "$dlopen_support" = yes; then
5106 dlfiles="$dlfiles $pic_object"
5107 prev=
5108 continue
5109 else
5110 # If libtool objects are unsupported, then we need to preload.
5111 prev=dlprefiles
5112 fi
5113 fi
5114
5115 # CHECK ME: I think I busted this. -Ossama
5116 if test "$prev" = dlprefiles; then
5117 # Preload the old-style object.
5118 dlprefiles="$dlprefiles $pic_object"
5119 prev=
5120 fi
5121
5122 # A PIC object.
5123 func_append libobjs " $pic_object"
5124 arg="$pic_object"
5125 fi
5126
5127 # Non-PIC object.
5128 if test "$non_pic_object" != none; then
5129 # Prepend the subdirectory the object is found in.
5130 non_pic_object="$xdir$non_pic_object"
5131
5132 # A standard non-PIC object
5133 func_append non_pic_objects " $non_pic_object"
5134 if test -z "$pic_object" || test "$pic_object" = none ; then
5135 arg="$non_pic_object"
5136 fi
5137 else
5138 # If the PIC object exists, use it instead.
5139 # $xdir was prepended to $pic_object above.
5140 non_pic_object="$pic_object"
5141 func_append non_pic_objects " $non_pic_object"
5142 fi
5143 else
5144 # Only an error if not doing a dry-run.
5145 if $opt_dry_run; then
5146 # Extract subdirectory from the argument.
5147 func_dirname "$arg" "/" ""
5148 xdir="$func_dirname_result"
5149
5150 func_lo2o "$arg"
5151 pic_object=$xdir$objdir/$func_lo2o_result
5152 non_pic_object=$xdir$func_lo2o_result
5153 func_append libobjs " $pic_object"
5154 func_append non_pic_objects " $non_pic_object"
5155 else
5156 func_fatal_error "\`$arg' is not a valid libtool object"
5157 fi
5158 fi
5159 done
5160 else
5161 func_fatal_error "link input file \`$arg' does not exist"
5162 fi
5163 arg=$save_arg
5164 prev=
5165 continue
5166 ;;
5167 precious_regex)
5168 precious_files_regex="$arg"
5169 prev=
5170 continue
5171 ;;
5172 release)
5173 release="-$arg"
5174 prev=
5175 continue
5176 ;;
5177 rpath | xrpath)
5178 # We need an absolute path.
5179 case $arg in
5180 [\\/]* | [A-Za-z]:[\\/]*) ;;
5181 *)
5182 func_fatal_error "only absolute run-paths are allowed"
5183 ;;
5184 esac
5185 if test "$prev" = rpath; then
5186 case "$rpath " in
5187 *" $arg "*) ;;
5188 *) rpath="$rpath $arg" ;;
5189 esac
5190 else
5191 case "$xrpath " in
5192 *" $arg "*) ;;
5193 *) xrpath="$xrpath $arg" ;;
5194 esac
5195 fi
5196 prev=
5197 continue
5198 ;;
5199 shrext)
5200 shrext_cmds="$arg"
5201 prev=
5202 continue
5203 ;;
5204 weak)
5205 weak_libs="$weak_libs $arg"
5206 prev=
5207 continue
5208 ;;
5209 xcclinker)
5210 linker_flags="$linker_flags $qarg"
5211 compiler_flags="$compiler_flags $qarg"
5212 prev=
5213 func_append compile_command " $qarg"
5214 func_append finalize_command " $qarg"
5215 continue
5216 ;;
5217 xcompiler)
5218 compiler_flags="$compiler_flags $qarg"
5219 prev=
5220 func_append compile_command " $qarg"
5221 func_append finalize_command " $qarg"
5222 continue
5223 ;;
5224 xlinker)
5225 linker_flags="$linker_flags $qarg"
5226 compiler_flags="$compiler_flags $wl$qarg"
5227 prev=
5228 func_append compile_command " $wl$qarg"
5229 func_append finalize_command " $wl$qarg"
5230 continue
5231 ;;
5232 *)
5233 eval "$prev=\"\$arg\""
5234 prev=
5235 continue
5236 ;;
5237 esac
5238 fi # test -n "$prev"
5239
5240 prevarg="$arg"
5241
5242 case $arg in
5243 -all-static)
5244 if test -n "$link_static_flag"; then
5245 # See comment for -static flag below, for more details.
5246 func_append compile_command " $link_static_flag"
5247 func_append finalize_command " $link_static_flag"
5248 fi
5249 continue
5250 ;;
5251
5252 -allow-undefined)
5253 # FIXME: remove this flag sometime in the future.
5254 func_fatal_error "\`-allow-undefined' must not be used because it is the default"
5255 ;;
5256
5257 -avoid-version)
5258 avoid_version=yes
5259 continue
5260 ;;
5261
cristyfd9dcd42010-08-08 18:07:02 +00005262 -bindir)
5263 prev=bindir
5264 continue
5265 ;;
5266
cristy3ed852e2009-09-05 21:47:34 +00005267 -dlopen)
5268 prev=dlfiles
5269 continue
5270 ;;
5271
5272 -dlpreopen)
5273 prev=dlprefiles
5274 continue
5275 ;;
5276
5277 -export-dynamic)
5278 export_dynamic=yes
5279 continue
5280 ;;
5281
5282 -export-symbols | -export-symbols-regex)
5283 if test -n "$export_symbols" || test -n "$export_symbols_regex"; then
5284 func_fatal_error "more than one -exported-symbols argument is not allowed"
5285 fi
5286 if test "X$arg" = "X-export-symbols"; then
5287 prev=expsyms
5288 else
5289 prev=expsyms_regex
5290 fi
5291 continue
5292 ;;
5293
5294 -framework)
5295 prev=framework
5296 continue
5297 ;;
5298
5299 -inst-prefix-dir)
5300 prev=inst_prefix
5301 continue
5302 ;;
5303
5304 # The native IRIX linker understands -LANG:*, -LIST:* and -LNO:*
5305 # so, if we see these flags be careful not to treat them like -L
5306 -L[A-Z][A-Z]*:*)
5307 case $with_gcc/$host in
5308 no/*-*-irix* | /*-*-irix*)
5309 func_append compile_command " $arg"
5310 func_append finalize_command " $arg"
5311 ;;
5312 esac
5313 continue
5314 ;;
5315
5316 -L*)
5317 func_stripname '-L' '' "$arg"
5318 dir=$func_stripname_result
5319 if test -z "$dir"; then
5320 if test "$#" -gt 0; then
5321 func_fatal_error "require no space between \`-L' and \`$1'"
5322 else
5323 func_fatal_error "need path for \`-L' option"
5324 fi
5325 fi
5326 # We need an absolute path.
5327 case $dir in
5328 [\\/]* | [A-Za-z]:[\\/]*) ;;
5329 *)
5330 absdir=`cd "$dir" && pwd`
5331 test -z "$absdir" && \
5332 func_fatal_error "cannot determine absolute directory name of \`$dir'"
5333 dir="$absdir"
5334 ;;
5335 esac
5336 case "$deplibs " in
5337 *" -L$dir "*) ;;
5338 *)
5339 deplibs="$deplibs -L$dir"
5340 lib_search_path="$lib_search_path $dir"
5341 ;;
5342 esac
5343 case $host in
5344 *-*-cygwin* | *-*-mingw* | *-*-pw32* | *-*-os2* | *-cegcc*)
cristyfd9dcd42010-08-08 18:07:02 +00005345 testbindir=`$ECHO "$dir" | $SED 's*/lib$*/bin*'`
cristy3ed852e2009-09-05 21:47:34 +00005346 case :$dllsearchpath: in
5347 *":$dir:"*) ;;
5348 ::) dllsearchpath=$dir;;
5349 *) dllsearchpath="$dllsearchpath:$dir";;
5350 esac
5351 case :$dllsearchpath: in
5352 *":$testbindir:"*) ;;
5353 ::) dllsearchpath=$testbindir;;
5354 *) dllsearchpath="$dllsearchpath:$testbindir";;
5355 esac
5356 ;;
5357 esac
5358 continue
5359 ;;
5360
5361 -l*)
5362 if test "X$arg" = "X-lc" || test "X$arg" = "X-lm"; then
5363 case $host in
cristyfd9dcd42010-08-08 18:07:02 +00005364 *-*-cygwin* | *-*-mingw* | *-*-pw32* | *-*-beos* | *-cegcc* | *-*-haiku*)
cristy3ed852e2009-09-05 21:47:34 +00005365 # These systems don't actually have a C or math library (as such)
5366 continue
5367 ;;
5368 *-*-os2*)
5369 # These systems don't actually have a C library (as such)
5370 test "X$arg" = "X-lc" && continue
5371 ;;
5372 *-*-openbsd* | *-*-freebsd* | *-*-dragonfly*)
5373 # Do not include libc due to us having libc/libc_r.
5374 test "X$arg" = "X-lc" && continue
5375 ;;
5376 *-*-rhapsody* | *-*-darwin1.[012])
5377 # Rhapsody C and math libraries are in the System framework
5378 deplibs="$deplibs System.ltframework"
5379 continue
5380 ;;
5381 *-*-sco3.2v5* | *-*-sco5v6*)
5382 # Causes problems with __ctype
5383 test "X$arg" = "X-lc" && continue
5384 ;;
5385 *-*-sysv4.2uw2* | *-*-sysv5* | *-*-unixware* | *-*-OpenUNIX*)
5386 # Compiler inserts libc in the correct place for threads to work
5387 test "X$arg" = "X-lc" && continue
5388 ;;
5389 esac
5390 elif test "X$arg" = "X-lc_r"; then
5391 case $host in
5392 *-*-openbsd* | *-*-freebsd* | *-*-dragonfly*)
5393 # Do not include libc_r directly, use -pthread flag.
5394 continue
5395 ;;
5396 esac
5397 fi
5398 deplibs="$deplibs $arg"
5399 continue
5400 ;;
5401
5402 -module)
5403 module=yes
5404 continue
5405 ;;
5406
5407 # Tru64 UNIX uses -model [arg] to determine the layout of C++
5408 # classes, name mangling, and exception handling.
5409 # Darwin uses the -arch flag to determine output architecture.
5410 -model|-arch|-isysroot)
5411 compiler_flags="$compiler_flags $arg"
5412 func_append compile_command " $arg"
5413 func_append finalize_command " $arg"
5414 prev=xcompiler
5415 continue
5416 ;;
5417
5418 -mt|-mthreads|-kthread|-Kthread|-pthread|-pthreads|--thread-safe|-threads)
5419 compiler_flags="$compiler_flags $arg"
5420 func_append compile_command " $arg"
5421 func_append finalize_command " $arg"
5422 case "$new_inherited_linker_flags " in
5423 *" $arg "*) ;;
5424 * ) new_inherited_linker_flags="$new_inherited_linker_flags $arg" ;;
5425 esac
5426 continue
5427 ;;
5428
5429 -multi_module)
5430 single_module="${wl}-multi_module"
5431 continue
5432 ;;
5433
5434 -no-fast-install)
5435 fast_install=no
5436 continue
5437 ;;
5438
5439 -no-install)
5440 case $host in
5441 *-*-cygwin* | *-*-mingw* | *-*-pw32* | *-*-os2* | *-*-darwin* | *-cegcc*)
5442 # The PATH hackery in wrapper scripts is required on Windows
5443 # and Darwin in order for the loader to find any dlls it needs.
5444 func_warning "\`-no-install' is ignored for $host"
5445 func_warning "assuming \`-no-fast-install' instead"
5446 fast_install=no
5447 ;;
5448 *) no_install=yes ;;
5449 esac
5450 continue
5451 ;;
5452
5453 -no-undefined)
5454 allow_undefined=no
5455 continue
5456 ;;
5457
5458 -objectlist)
5459 prev=objectlist
5460 continue
5461 ;;
5462
5463 -o) prev=output ;;
5464
5465 -precious-files-regex)
5466 prev=precious_regex
5467 continue
5468 ;;
5469
5470 -release)
5471 prev=release
5472 continue
5473 ;;
5474
5475 -rpath)
5476 prev=rpath
5477 continue
5478 ;;
5479
5480 -R)
5481 prev=xrpath
5482 continue
5483 ;;
5484
5485 -R*)
5486 func_stripname '-R' '' "$arg"
5487 dir=$func_stripname_result
5488 # We need an absolute path.
5489 case $dir in
5490 [\\/]* | [A-Za-z]:[\\/]*) ;;
5491 *)
5492 func_fatal_error "only absolute run-paths are allowed"
5493 ;;
5494 esac
5495 case "$xrpath " in
5496 *" $dir "*) ;;
5497 *) xrpath="$xrpath $dir" ;;
5498 esac
5499 continue
5500 ;;
5501
5502 -shared)
5503 # The effects of -shared are defined in a previous loop.
5504 continue
5505 ;;
5506
5507 -shrext)
5508 prev=shrext
5509 continue
5510 ;;
5511
5512 -static | -static-libtool-libs)
5513 # The effects of -static are defined in a previous loop.
5514 # We used to do the same as -all-static on platforms that
5515 # didn't have a PIC flag, but the assumption that the effects
5516 # would be equivalent was wrong. It would break on at least
5517 # Digital Unix and AIX.
5518 continue
5519 ;;
5520
5521 -thread-safe)
5522 thread_safe=yes
5523 continue
5524 ;;
5525
5526 -version-info)
5527 prev=vinfo
5528 continue
5529 ;;
5530
5531 -version-number)
5532 prev=vinfo
5533 vinfo_number=yes
5534 continue
5535 ;;
5536
5537 -weak)
5538 prev=weak
5539 continue
5540 ;;
5541
5542 -Wc,*)
5543 func_stripname '-Wc,' '' "$arg"
5544 args=$func_stripname_result
5545 arg=
5546 save_ifs="$IFS"; IFS=','
5547 for flag in $args; do
5548 IFS="$save_ifs"
5549 func_quote_for_eval "$flag"
cristyfd9dcd42010-08-08 18:07:02 +00005550 arg="$arg $func_quote_for_eval_result"
cristy3ed852e2009-09-05 21:47:34 +00005551 compiler_flags="$compiler_flags $func_quote_for_eval_result"
5552 done
5553 IFS="$save_ifs"
5554 func_stripname ' ' '' "$arg"
5555 arg=$func_stripname_result
5556 ;;
5557
5558 -Wl,*)
5559 func_stripname '-Wl,' '' "$arg"
5560 args=$func_stripname_result
5561 arg=
5562 save_ifs="$IFS"; IFS=','
5563 for flag in $args; do
5564 IFS="$save_ifs"
5565 func_quote_for_eval "$flag"
5566 arg="$arg $wl$func_quote_for_eval_result"
5567 compiler_flags="$compiler_flags $wl$func_quote_for_eval_result"
5568 linker_flags="$linker_flags $func_quote_for_eval_result"
5569 done
5570 IFS="$save_ifs"
5571 func_stripname ' ' '' "$arg"
5572 arg=$func_stripname_result
5573 ;;
5574
5575 -Xcompiler)
5576 prev=xcompiler
5577 continue
5578 ;;
5579
5580 -Xlinker)
5581 prev=xlinker
5582 continue
5583 ;;
5584
5585 -XCClinker)
5586 prev=xcclinker
5587 continue
5588 ;;
5589
5590 # -msg_* for osf cc
5591 -msg_*)
5592 func_quote_for_eval "$arg"
5593 arg="$func_quote_for_eval_result"
5594 ;;
5595
cristyfd9dcd42010-08-08 18:07:02 +00005596 # Flags to be passed through unchanged, with rationale:
5597 # -64, -mips[0-9] enable 64-bit mode for the SGI compiler
5598 # -r[0-9][0-9]* specify processor for the SGI compiler
5599 # -xarch=*, -xtarget=* enable 64-bit mode for the Sun compiler
5600 # +DA*, +DD* enable 64-bit mode for the HP compiler
5601 # -q* compiler args for the IBM compiler
5602 # -m*, -t[45]*, -txscale* architecture-specific flags for GCC
5603 # -F/path path to uninstalled frameworks, gcc on darwin
5604 # -p, -pg, --coverage, -fprofile-* profiling flags for GCC
5605 # @file GCC response files
5606 # -tp=* Portland pgcc target processor selection
cristy3ed852e2009-09-05 21:47:34 +00005607 -64|-mips[0-9]|-r[0-9][0-9]*|-xarch=*|-xtarget=*|+DA*|+DD*|-q*|-m*| \
cristyfd9dcd42010-08-08 18:07:02 +00005608 -t[45]*|-txscale*|-p|-pg|--coverage|-fprofile-*|-F*|@*|-tp=*)
cristy3ed852e2009-09-05 21:47:34 +00005609 func_quote_for_eval "$arg"
5610 arg="$func_quote_for_eval_result"
5611 func_append compile_command " $arg"
5612 func_append finalize_command " $arg"
5613 compiler_flags="$compiler_flags $arg"
5614 continue
5615 ;;
5616
5617 # Some other compiler flag.
5618 -* | +*)
5619 func_quote_for_eval "$arg"
5620 arg="$func_quote_for_eval_result"
5621 ;;
5622
5623 *.$objext)
5624 # A standard object.
5625 objs="$objs $arg"
5626 ;;
5627
5628 *.lo)
5629 # A libtool-controlled object.
5630
5631 # Check to see that this really is a libtool object.
5632 if func_lalib_unsafe_p "$arg"; then
5633 pic_object=
5634 non_pic_object=
5635
5636 # Read the .lo file
5637 func_source "$arg"
5638
5639 if test -z "$pic_object" ||
5640 test -z "$non_pic_object" ||
5641 test "$pic_object" = none &&
5642 test "$non_pic_object" = none; then
5643 func_fatal_error "cannot find name of object for \`$arg'"
5644 fi
5645
5646 # Extract subdirectory from the argument.
5647 func_dirname "$arg" "/" ""
5648 xdir="$func_dirname_result"
5649
5650 if test "$pic_object" != none; then
5651 # Prepend the subdirectory the object is found in.
5652 pic_object="$xdir$pic_object"
5653
5654 if test "$prev" = dlfiles; then
5655 if test "$build_libtool_libs" = yes && test "$dlopen_support" = yes; then
5656 dlfiles="$dlfiles $pic_object"
5657 prev=
5658 continue
5659 else
5660 # If libtool objects are unsupported, then we need to preload.
5661 prev=dlprefiles
5662 fi
5663 fi
5664
5665 # CHECK ME: I think I busted this. -Ossama
5666 if test "$prev" = dlprefiles; then
5667 # Preload the old-style object.
5668 dlprefiles="$dlprefiles $pic_object"
5669 prev=
5670 fi
5671
5672 # A PIC object.
5673 func_append libobjs " $pic_object"
5674 arg="$pic_object"
5675 fi
5676
5677 # Non-PIC object.
5678 if test "$non_pic_object" != none; then
5679 # Prepend the subdirectory the object is found in.
5680 non_pic_object="$xdir$non_pic_object"
5681
5682 # A standard non-PIC object
5683 func_append non_pic_objects " $non_pic_object"
5684 if test -z "$pic_object" || test "$pic_object" = none ; then
5685 arg="$non_pic_object"
5686 fi
5687 else
5688 # If the PIC object exists, use it instead.
5689 # $xdir was prepended to $pic_object above.
5690 non_pic_object="$pic_object"
5691 func_append non_pic_objects " $non_pic_object"
5692 fi
5693 else
5694 # Only an error if not doing a dry-run.
5695 if $opt_dry_run; then
5696 # Extract subdirectory from the argument.
5697 func_dirname "$arg" "/" ""
5698 xdir="$func_dirname_result"
5699
5700 func_lo2o "$arg"
5701 pic_object=$xdir$objdir/$func_lo2o_result
5702 non_pic_object=$xdir$func_lo2o_result
5703 func_append libobjs " $pic_object"
5704 func_append non_pic_objects " $non_pic_object"
5705 else
5706 func_fatal_error "\`$arg' is not a valid libtool object"
5707 fi
5708 fi
5709 ;;
5710
5711 *.$libext)
5712 # An archive.
5713 deplibs="$deplibs $arg"
5714 old_deplibs="$old_deplibs $arg"
5715 continue
5716 ;;
5717
5718 *.la)
5719 # A libtool-controlled library.
5720
5721 if test "$prev" = dlfiles; then
5722 # This library was specified with -dlopen.
5723 dlfiles="$dlfiles $arg"
5724 prev=
5725 elif test "$prev" = dlprefiles; then
5726 # The library was specified with -dlpreopen.
5727 dlprefiles="$dlprefiles $arg"
5728 prev=
5729 else
5730 deplibs="$deplibs $arg"
5731 fi
5732 continue
5733 ;;
5734
5735 # Some other compiler argument.
5736 *)
5737 # Unknown arguments in both finalize_command and compile_command need
5738 # to be aesthetically quoted because they are evaled later.
5739 func_quote_for_eval "$arg"
5740 arg="$func_quote_for_eval_result"
5741 ;;
5742 esac # arg
5743
5744 # Now actually substitute the argument into the commands.
5745 if test -n "$arg"; then
5746 func_append compile_command " $arg"
5747 func_append finalize_command " $arg"
5748 fi
5749 done # argument parsing loop
5750
5751 test -n "$prev" && \
5752 func_fatal_help "the \`$prevarg' option requires an argument"
5753
5754 if test "$export_dynamic" = yes && test -n "$export_dynamic_flag_spec"; then
5755 eval arg=\"$export_dynamic_flag_spec\"
5756 func_append compile_command " $arg"
5757 func_append finalize_command " $arg"
5758 fi
5759
5760 oldlibs=
5761 # calculate the name of the file, without its directory
5762 func_basename "$output"
5763 outputname="$func_basename_result"
5764 libobjs_save="$libobjs"
5765
5766 if test -n "$shlibpath_var"; then
5767 # get the directories listed in $shlibpath_var
cristyfd9dcd42010-08-08 18:07:02 +00005768 eval shlib_search_path=\`\$ECHO \"\${$shlibpath_var}\" \| \$SED \'s/:/ /g\'\`
cristy3ed852e2009-09-05 21:47:34 +00005769 else
5770 shlib_search_path=
5771 fi
5772 eval sys_lib_search_path=\"$sys_lib_search_path_spec\"
5773 eval sys_lib_dlsearch_path=\"$sys_lib_dlsearch_path_spec\"
5774
5775 func_dirname "$output" "/" ""
5776 output_objdir="$func_dirname_result$objdir"
5777 # Create the object directory.
5778 func_mkdir_p "$output_objdir"
5779
5780 # Determine the type of output
5781 case $output in
5782 "")
5783 func_fatal_help "you must specify an output file"
5784 ;;
5785 *.$libext) linkmode=oldlib ;;
5786 *.lo | *.$objext) linkmode=obj ;;
5787 *.la) linkmode=lib ;;
5788 *) linkmode=prog ;; # Anything else should be a program.
5789 esac
5790
5791 specialdeplibs=
5792
5793 libs=
5794 # Find all interdependent deplibs by searching for libraries
5795 # that are linked more than once (e.g. -la -lb -la)
5796 for deplib in $deplibs; do
5797 if $opt_duplicate_deps ; then
5798 case "$libs " in
5799 *" $deplib "*) specialdeplibs="$specialdeplibs $deplib" ;;
5800 esac
5801 fi
5802 libs="$libs $deplib"
5803 done
5804
5805 if test "$linkmode" = lib; then
5806 libs="$predeps $libs $compiler_lib_search_path $postdeps"
5807
5808 # Compute libraries that are listed more than once in $predeps
5809 # $postdeps and mark them as special (i.e., whose duplicates are
5810 # not to be eliminated).
5811 pre_post_deps=
5812 if $opt_duplicate_compiler_generated_deps; then
5813 for pre_post_dep in $predeps $postdeps; do
5814 case "$pre_post_deps " in
5815 *" $pre_post_dep "*) specialdeplibs="$specialdeplibs $pre_post_deps" ;;
5816 esac
5817 pre_post_deps="$pre_post_deps $pre_post_dep"
5818 done
5819 fi
5820 pre_post_deps=
5821 fi
5822
5823 deplibs=
5824 newdependency_libs=
5825 newlib_search_path=
5826 need_relink=no # whether we're linking any uninstalled libtool libraries
5827 notinst_deplibs= # not-installed libtool libraries
5828 notinst_path= # paths that contain not-installed libtool libraries
5829
5830 case $linkmode in
5831 lib)
5832 passes="conv dlpreopen link"
5833 for file in $dlfiles $dlprefiles; do
5834 case $file in
5835 *.la) ;;
5836 *)
5837 func_fatal_help "libraries can \`-dlopen' only libtool libraries: $file"
5838 ;;
5839 esac
5840 done
5841 ;;
5842 prog)
5843 compile_deplibs=
5844 finalize_deplibs=
5845 alldeplibs=no
5846 newdlfiles=
5847 newdlprefiles=
5848 passes="conv scan dlopen dlpreopen link"
5849 ;;
5850 *) passes="conv"
5851 ;;
5852 esac
5853
5854 for pass in $passes; do
5855 # The preopen pass in lib mode reverses $deplibs; put it back here
5856 # so that -L comes before libs that need it for instance...
5857 if test "$linkmode,$pass" = "lib,link"; then
5858 ## FIXME: Find the place where the list is rebuilt in the wrong
5859 ## order, and fix it there properly
5860 tmp_deplibs=
5861 for deplib in $deplibs; do
5862 tmp_deplibs="$deplib $tmp_deplibs"
5863 done
5864 deplibs="$tmp_deplibs"
5865 fi
5866
5867 if test "$linkmode,$pass" = "lib,link" ||
5868 test "$linkmode,$pass" = "prog,scan"; then
5869 libs="$deplibs"
5870 deplibs=
5871 fi
5872 if test "$linkmode" = prog; then
5873 case $pass in
5874 dlopen) libs="$dlfiles" ;;
5875 dlpreopen) libs="$dlprefiles" ;;
5876 link) libs="$deplibs %DEPLIBS% $dependency_libs" ;;
5877 esac
5878 fi
5879 if test "$linkmode,$pass" = "lib,dlpreopen"; then
5880 # Collect and forward deplibs of preopened libtool libs
5881 for lib in $dlprefiles; do
5882 # Ignore non-libtool-libs
5883 dependency_libs=
5884 case $lib in
5885 *.la) func_source "$lib" ;;
5886 esac
5887
5888 # Collect preopened libtool deplibs, except any this library
5889 # has declared as weak libs
5890 for deplib in $dependency_libs; do
cristyfd9dcd42010-08-08 18:07:02 +00005891 func_basename "$deplib"
5892 deplib_base=$func_basename_result
cristy3ed852e2009-09-05 21:47:34 +00005893 case " $weak_libs " in
5894 *" $deplib_base "*) ;;
5895 *) deplibs="$deplibs $deplib" ;;
5896 esac
5897 done
5898 done
5899 libs="$dlprefiles"
5900 fi
5901 if test "$pass" = dlopen; then
5902 # Collect dlpreopened libraries
5903 save_deplibs="$deplibs"
5904 deplibs=
5905 fi
5906
5907 for deplib in $libs; do
5908 lib=
5909 found=no
5910 case $deplib in
5911 -mt|-mthreads|-kthread|-Kthread|-pthread|-pthreads|--thread-safe|-threads)
5912 if test "$linkmode,$pass" = "prog,link"; then
5913 compile_deplibs="$deplib $compile_deplibs"
5914 finalize_deplibs="$deplib $finalize_deplibs"
5915 else
5916 compiler_flags="$compiler_flags $deplib"
5917 if test "$linkmode" = lib ; then
5918 case "$new_inherited_linker_flags " in
5919 *" $deplib "*) ;;
5920 * ) new_inherited_linker_flags="$new_inherited_linker_flags $deplib" ;;
5921 esac
5922 fi
5923 fi
5924 continue
5925 ;;
5926 -l*)
5927 if test "$linkmode" != lib && test "$linkmode" != prog; then
5928 func_warning "\`-l' is ignored for archives/objects"
5929 continue
5930 fi
5931 func_stripname '-l' '' "$deplib"
5932 name=$func_stripname_result
5933 if test "$linkmode" = lib; then
5934 searchdirs="$newlib_search_path $lib_search_path $compiler_lib_search_dirs $sys_lib_search_path $shlib_search_path"
5935 else
5936 searchdirs="$newlib_search_path $lib_search_path $sys_lib_search_path $shlib_search_path"
5937 fi
5938 for searchdir in $searchdirs; do
5939 for search_ext in .la $std_shrext .so .a; do
5940 # Search the libtool library
5941 lib="$searchdir/lib${name}${search_ext}"
5942 if test -f "$lib"; then
5943 if test "$search_ext" = ".la"; then
5944 found=yes
5945 else
5946 found=no
5947 fi
5948 break 2
5949 fi
5950 done
5951 done
5952 if test "$found" != yes; then
5953 # deplib doesn't seem to be a libtool library
5954 if test "$linkmode,$pass" = "prog,link"; then
5955 compile_deplibs="$deplib $compile_deplibs"
5956 finalize_deplibs="$deplib $finalize_deplibs"
5957 else
5958 deplibs="$deplib $deplibs"
5959 test "$linkmode" = lib && newdependency_libs="$deplib $newdependency_libs"
5960 fi
5961 continue
5962 else # deplib is a libtool library
5963 # If $allow_libtool_libs_with_static_runtimes && $deplib is a stdlib,
5964 # We need to do some special things here, and not later.
5965 if test "X$allow_libtool_libs_with_static_runtimes" = "Xyes" ; then
5966 case " $predeps $postdeps " in
5967 *" $deplib "*)
5968 if func_lalib_p "$lib"; then
5969 library_names=
5970 old_library=
5971 func_source "$lib"
5972 for l in $old_library $library_names; do
5973 ll="$l"
5974 done
5975 if test "X$ll" = "X$old_library" ; then # only static version available
5976 found=no
5977 func_dirname "$lib" "" "."
5978 ladir="$func_dirname_result"
5979 lib=$ladir/$old_library
5980 if test "$linkmode,$pass" = "prog,link"; then
5981 compile_deplibs="$deplib $compile_deplibs"
5982 finalize_deplibs="$deplib $finalize_deplibs"
5983 else
5984 deplibs="$deplib $deplibs"
5985 test "$linkmode" = lib && newdependency_libs="$deplib $newdependency_libs"
5986 fi
5987 continue
5988 fi
5989 fi
5990 ;;
5991 *) ;;
5992 esac
5993 fi
5994 fi
5995 ;; # -l
5996 *.ltframework)
5997 if test "$linkmode,$pass" = "prog,link"; then
5998 compile_deplibs="$deplib $compile_deplibs"
5999 finalize_deplibs="$deplib $finalize_deplibs"
6000 else
6001 deplibs="$deplib $deplibs"
6002 if test "$linkmode" = lib ; then
6003 case "$new_inherited_linker_flags " in
6004 *" $deplib "*) ;;
6005 * ) new_inherited_linker_flags="$new_inherited_linker_flags $deplib" ;;
6006 esac
6007 fi
6008 fi
6009 continue
6010 ;;
6011 -L*)
6012 case $linkmode in
6013 lib)
6014 deplibs="$deplib $deplibs"
6015 test "$pass" = conv && continue
6016 newdependency_libs="$deplib $newdependency_libs"
6017 func_stripname '-L' '' "$deplib"
6018 newlib_search_path="$newlib_search_path $func_stripname_result"
6019 ;;
6020 prog)
6021 if test "$pass" = conv; then
6022 deplibs="$deplib $deplibs"
6023 continue
6024 fi
6025 if test "$pass" = scan; then
6026 deplibs="$deplib $deplibs"
6027 else
6028 compile_deplibs="$deplib $compile_deplibs"
6029 finalize_deplibs="$deplib $finalize_deplibs"
6030 fi
6031 func_stripname '-L' '' "$deplib"
6032 newlib_search_path="$newlib_search_path $func_stripname_result"
6033 ;;
6034 *)
6035 func_warning "\`-L' is ignored for archives/objects"
6036 ;;
6037 esac # linkmode
6038 continue
6039 ;; # -L
6040 -R*)
6041 if test "$pass" = link; then
6042 func_stripname '-R' '' "$deplib"
6043 dir=$func_stripname_result
6044 # Make sure the xrpath contains only unique directories.
6045 case "$xrpath " in
6046 *" $dir "*) ;;
6047 *) xrpath="$xrpath $dir" ;;
6048 esac
6049 fi
6050 deplibs="$deplib $deplibs"
6051 continue
6052 ;;
6053 *.la) lib="$deplib" ;;
6054 *.$libext)
6055 if test "$pass" = conv; then
6056 deplibs="$deplib $deplibs"
6057 continue
6058 fi
6059 case $linkmode in
6060 lib)
6061 # Linking convenience modules into shared libraries is allowed,
6062 # but linking other static libraries is non-portable.
6063 case " $dlpreconveniencelibs " in
6064 *" $deplib "*) ;;
6065 *)
6066 valid_a_lib=no
6067 case $deplibs_check_method in
6068 match_pattern*)
6069 set dummy $deplibs_check_method; shift
6070 match_pattern_regex=`expr "$deplibs_check_method" : "$1 \(.*\)"`
cristyfd9dcd42010-08-08 18:07:02 +00006071 if eval "\$ECHO \"$deplib\"" 2>/dev/null | $SED 10q \
cristy3ed852e2009-09-05 21:47:34 +00006072 | $EGREP "$match_pattern_regex" > /dev/null; then
6073 valid_a_lib=yes
6074 fi
6075 ;;
6076 pass_all)
6077 valid_a_lib=yes
6078 ;;
6079 esac
6080 if test "$valid_a_lib" != yes; then
cristyfd9dcd42010-08-08 18:07:02 +00006081 echo
cristy3ed852e2009-09-05 21:47:34 +00006082 $ECHO "*** Warning: Trying to link with static lib archive $deplib."
cristyfd9dcd42010-08-08 18:07:02 +00006083 echo "*** I have the capability to make that library automatically link in when"
6084 echo "*** you link to this library. But I can only do this if you have a"
6085 echo "*** shared version of the library, which you do not appear to have"
6086 echo "*** because the file extensions .$libext of this argument makes me believe"
6087 echo "*** that it is just a static archive that I should not use here."
cristy3ed852e2009-09-05 21:47:34 +00006088 else
cristyfd9dcd42010-08-08 18:07:02 +00006089 echo
cristy3ed852e2009-09-05 21:47:34 +00006090 $ECHO "*** Warning: Linking the shared library $output against the"
6091 $ECHO "*** static library $deplib is not portable!"
6092 deplibs="$deplib $deplibs"
6093 fi
6094 ;;
6095 esac
6096 continue
6097 ;;
6098 prog)
6099 if test "$pass" != link; then
6100 deplibs="$deplib $deplibs"
6101 else
6102 compile_deplibs="$deplib $compile_deplibs"
6103 finalize_deplibs="$deplib $finalize_deplibs"
6104 fi
6105 continue
6106 ;;
6107 esac # linkmode
6108 ;; # *.$libext
6109 *.lo | *.$objext)
6110 if test "$pass" = conv; then
6111 deplibs="$deplib $deplibs"
6112 elif test "$linkmode" = prog; then
6113 if test "$pass" = dlpreopen || test "$dlopen_support" != yes || test "$build_libtool_libs" = no; then
6114 # If there is no dlopen support or we're linking statically,
6115 # we need to preload.
6116 newdlprefiles="$newdlprefiles $deplib"
6117 compile_deplibs="$deplib $compile_deplibs"
6118 finalize_deplibs="$deplib $finalize_deplibs"
6119 else
6120 newdlfiles="$newdlfiles $deplib"
6121 fi
6122 fi
6123 continue
6124 ;;
6125 %DEPLIBS%)
6126 alldeplibs=yes
6127 continue
6128 ;;
6129 esac # case $deplib
6130
6131 if test "$found" = yes || test -f "$lib"; then :
6132 else
6133 func_fatal_error "cannot find the library \`$lib' or unhandled argument \`$deplib'"
6134 fi
6135
6136 # Check to see that this really is a libtool archive.
6137 func_lalib_unsafe_p "$lib" \
6138 || func_fatal_error "\`$lib' is not a valid libtool archive"
6139
6140 func_dirname "$lib" "" "."
6141 ladir="$func_dirname_result"
6142
6143 dlname=
6144 dlopen=
6145 dlpreopen=
6146 libdir=
6147 library_names=
6148 old_library=
6149 inherited_linker_flags=
6150 # If the library was installed with an old release of libtool,
6151 # it will not redefine variables installed, or shouldnotlink
6152 installed=yes
6153 shouldnotlink=no
6154 avoidtemprpath=
6155
6156
6157 # Read the .la file
6158 func_source "$lib"
6159
6160 # Convert "-framework foo" to "foo.ltframework"
6161 if test -n "$inherited_linker_flags"; then
cristyfd9dcd42010-08-08 18:07:02 +00006162 tmp_inherited_linker_flags=`$ECHO "$inherited_linker_flags" | $SED 's/-framework \([^ $]*\)/\1.ltframework/g'`
cristy3ed852e2009-09-05 21:47:34 +00006163 for tmp_inherited_linker_flag in $tmp_inherited_linker_flags; do
6164 case " $new_inherited_linker_flags " in
6165 *" $tmp_inherited_linker_flag "*) ;;
6166 *) new_inherited_linker_flags="$new_inherited_linker_flags $tmp_inherited_linker_flag";;
6167 esac
6168 done
6169 fi
cristyfd9dcd42010-08-08 18:07:02 +00006170 dependency_libs=`$ECHO " $dependency_libs" | $SED 's% \([^ $]*\).ltframework% -framework \1%g'`
cristy3ed852e2009-09-05 21:47:34 +00006171 if test "$linkmode,$pass" = "lib,link" ||
6172 test "$linkmode,$pass" = "prog,scan" ||
6173 { test "$linkmode" != prog && test "$linkmode" != lib; }; then
6174 test -n "$dlopen" && dlfiles="$dlfiles $dlopen"
6175 test -n "$dlpreopen" && dlprefiles="$dlprefiles $dlpreopen"
6176 fi
6177
6178 if test "$pass" = conv; then
6179 # Only check for convenience libraries
6180 deplibs="$lib $deplibs"
6181 if test -z "$libdir"; then
6182 if test -z "$old_library"; then
6183 func_fatal_error "cannot find name of link library for \`$lib'"
6184 fi
6185 # It is a libtool convenience library, so add in its objects.
6186 convenience="$convenience $ladir/$objdir/$old_library"
6187 old_convenience="$old_convenience $ladir/$objdir/$old_library"
6188 elif test "$linkmode" != prog && test "$linkmode" != lib; then
6189 func_fatal_error "\`$lib' is not a convenience library"
6190 fi
6191 tmp_libs=
6192 for deplib in $dependency_libs; do
6193 deplibs="$deplib $deplibs"
6194 if $opt_duplicate_deps ; then
6195 case "$tmp_libs " in
6196 *" $deplib "*) specialdeplibs="$specialdeplibs $deplib" ;;
6197 esac
6198 fi
6199 tmp_libs="$tmp_libs $deplib"
6200 done
6201 continue
6202 fi # $pass = conv
6203
6204
6205 # Get the name of the library we link against.
6206 linklib=
6207 for l in $old_library $library_names; do
6208 linklib="$l"
6209 done
6210 if test -z "$linklib"; then
6211 func_fatal_error "cannot find name of link library for \`$lib'"
6212 fi
6213
6214 # This library was specified with -dlopen.
6215 if test "$pass" = dlopen; then
6216 if test -z "$libdir"; then
6217 func_fatal_error "cannot -dlopen a convenience library: \`$lib'"
6218 fi
6219 if test -z "$dlname" ||
6220 test "$dlopen_support" != yes ||
6221 test "$build_libtool_libs" = no; then
6222 # If there is no dlname, no dlopen support or we're linking
6223 # statically, we need to preload. We also need to preload any
6224 # dependent libraries so libltdl's deplib preloader doesn't
6225 # bomb out in the load deplibs phase.
6226 dlprefiles="$dlprefiles $lib $dependency_libs"
6227 else
6228 newdlfiles="$newdlfiles $lib"
6229 fi
6230 continue
6231 fi # $pass = dlopen
6232
6233 # We need an absolute path.
6234 case $ladir in
6235 [\\/]* | [A-Za-z]:[\\/]*) abs_ladir="$ladir" ;;
6236 *)
6237 abs_ladir=`cd "$ladir" && pwd`
6238 if test -z "$abs_ladir"; then
6239 func_warning "cannot determine absolute directory name of \`$ladir'"
6240 func_warning "passing it literally to the linker, although it might fail"
6241 abs_ladir="$ladir"
6242 fi
6243 ;;
6244 esac
6245 func_basename "$lib"
6246 laname="$func_basename_result"
6247
6248 # Find the relevant object directory and library name.
6249 if test "X$installed" = Xyes; then
6250 if test ! -f "$libdir/$linklib" && test -f "$abs_ladir/$linklib"; then
6251 func_warning "library \`$lib' was moved."
6252 dir="$ladir"
6253 absdir="$abs_ladir"
6254 libdir="$abs_ladir"
6255 else
6256 dir="$libdir"
6257 absdir="$libdir"
6258 fi
6259 test "X$hardcode_automatic" = Xyes && avoidtemprpath=yes
6260 else
6261 if test ! -f "$ladir/$objdir/$linklib" && test -f "$abs_ladir/$linklib"; then
6262 dir="$ladir"
6263 absdir="$abs_ladir"
6264 # Remove this search path later
6265 notinst_path="$notinst_path $abs_ladir"
6266 else
6267 dir="$ladir/$objdir"
6268 absdir="$abs_ladir/$objdir"
6269 # Remove this search path later
6270 notinst_path="$notinst_path $abs_ladir"
6271 fi
6272 fi # $installed = yes
6273 func_stripname 'lib' '.la' "$laname"
6274 name=$func_stripname_result
6275
6276 # This library was specified with -dlpreopen.
6277 if test "$pass" = dlpreopen; then
6278 if test -z "$libdir" && test "$linkmode" = prog; then
6279 func_fatal_error "only libraries may -dlpreopen a convenience library: \`$lib'"
6280 fi
6281 # Prefer using a static library (so that no silly _DYNAMIC symbols
6282 # are required to link).
6283 if test -n "$old_library"; then
6284 newdlprefiles="$newdlprefiles $dir/$old_library"
6285 # Keep a list of preopened convenience libraries to check
6286 # that they are being used correctly in the link pass.
6287 test -z "$libdir" && \
6288 dlpreconveniencelibs="$dlpreconveniencelibs $dir/$old_library"
6289 # Otherwise, use the dlname, so that lt_dlopen finds it.
6290 elif test -n "$dlname"; then
6291 newdlprefiles="$newdlprefiles $dir/$dlname"
6292 else
6293 newdlprefiles="$newdlprefiles $dir/$linklib"
6294 fi
6295 fi # $pass = dlpreopen
6296
6297 if test -z "$libdir"; then
6298 # Link the convenience library
6299 if test "$linkmode" = lib; then
6300 deplibs="$dir/$old_library $deplibs"
6301 elif test "$linkmode,$pass" = "prog,link"; then
6302 compile_deplibs="$dir/$old_library $compile_deplibs"
6303 finalize_deplibs="$dir/$old_library $finalize_deplibs"
6304 else
6305 deplibs="$lib $deplibs" # used for prog,scan pass
6306 fi
6307 continue
6308 fi
6309
6310
6311 if test "$linkmode" = prog && test "$pass" != link; then
6312 newlib_search_path="$newlib_search_path $ladir"
6313 deplibs="$lib $deplibs"
6314
6315 linkalldeplibs=no
6316 if test "$link_all_deplibs" != no || test -z "$library_names" ||
6317 test "$build_libtool_libs" = no; then
6318 linkalldeplibs=yes
6319 fi
6320
6321 tmp_libs=
6322 for deplib in $dependency_libs; do
6323 case $deplib in
6324 -L*) func_stripname '-L' '' "$deplib"
6325 newlib_search_path="$newlib_search_path $func_stripname_result"
6326 ;;
6327 esac
6328 # Need to link against all dependency_libs?
6329 if test "$linkalldeplibs" = yes; then
6330 deplibs="$deplib $deplibs"
6331 else
6332 # Need to hardcode shared library paths
6333 # or/and link against static libraries
6334 newdependency_libs="$deplib $newdependency_libs"
6335 fi
6336 if $opt_duplicate_deps ; then
6337 case "$tmp_libs " in
6338 *" $deplib "*) specialdeplibs="$specialdeplibs $deplib" ;;
6339 esac
6340 fi
6341 tmp_libs="$tmp_libs $deplib"
6342 done # for deplib
6343 continue
6344 fi # $linkmode = prog...
6345
6346 if test "$linkmode,$pass" = "prog,link"; then
6347 if test -n "$library_names" &&
6348 { { test "$prefer_static_libs" = no ||
6349 test "$prefer_static_libs,$installed" = "built,yes"; } ||
6350 test -z "$old_library"; }; then
6351 # We need to hardcode the library path
6352 if test -n "$shlibpath_var" && test -z "$avoidtemprpath" ; then
6353 # Make sure the rpath contains only unique directories.
6354 case "$temp_rpath:" in
6355 *"$absdir:"*) ;;
6356 *) temp_rpath="$temp_rpath$absdir:" ;;
6357 esac
6358 fi
6359
6360 # Hardcode the library path.
6361 # Skip directories that are in the system default run-time
6362 # search path.
6363 case " $sys_lib_dlsearch_path " in
6364 *" $absdir "*) ;;
6365 *)
6366 case "$compile_rpath " in
6367 *" $absdir "*) ;;
6368 *) compile_rpath="$compile_rpath $absdir"
6369 esac
6370 ;;
6371 esac
6372 case " $sys_lib_dlsearch_path " in
6373 *" $libdir "*) ;;
6374 *)
6375 case "$finalize_rpath " in
6376 *" $libdir "*) ;;
6377 *) finalize_rpath="$finalize_rpath $libdir"
6378 esac
6379 ;;
6380 esac
6381 fi # $linkmode,$pass = prog,link...
6382
6383 if test "$alldeplibs" = yes &&
6384 { test "$deplibs_check_method" = pass_all ||
6385 { test "$build_libtool_libs" = yes &&
6386 test -n "$library_names"; }; }; then
6387 # We only need to search for static libraries
6388 continue
6389 fi
6390 fi
6391
6392 link_static=no # Whether the deplib will be linked statically
6393 use_static_libs=$prefer_static_libs
6394 if test "$use_static_libs" = built && test "$installed" = yes; then
6395 use_static_libs=no
6396 fi
6397 if test -n "$library_names" &&
6398 { test "$use_static_libs" = no || test -z "$old_library"; }; then
6399 case $host in
6400 *cygwin* | *mingw* | *cegcc*)
6401 # No point in relinking DLLs because paths are not encoded
6402 notinst_deplibs="$notinst_deplibs $lib"
6403 need_relink=no
6404 ;;
6405 *)
6406 if test "$installed" = no; then
6407 notinst_deplibs="$notinst_deplibs $lib"
6408 need_relink=yes
6409 fi
6410 ;;
6411 esac
6412 # This is a shared library
6413
6414 # Warn about portability, can't link against -module's on some
6415 # systems (darwin). Don't bleat about dlopened modules though!
6416 dlopenmodule=""
6417 for dlpremoduletest in $dlprefiles; do
6418 if test "X$dlpremoduletest" = "X$lib"; then
6419 dlopenmodule="$dlpremoduletest"
6420 break
6421 fi
6422 done
6423 if test -z "$dlopenmodule" && test "$shouldnotlink" = yes && test "$pass" = link; then
cristyfd9dcd42010-08-08 18:07:02 +00006424 echo
cristy3ed852e2009-09-05 21:47:34 +00006425 if test "$linkmode" = prog; then
6426 $ECHO "*** Warning: Linking the executable $output against the loadable module"
6427 else
6428 $ECHO "*** Warning: Linking the shared library $output against the loadable module"
6429 fi
6430 $ECHO "*** $linklib is not portable!"
6431 fi
6432 if test "$linkmode" = lib &&
6433 test "$hardcode_into_libs" = yes; then
6434 # Hardcode the library path.
6435 # Skip directories that are in the system default run-time
6436 # search path.
6437 case " $sys_lib_dlsearch_path " in
6438 *" $absdir "*) ;;
6439 *)
6440 case "$compile_rpath " in
6441 *" $absdir "*) ;;
6442 *) compile_rpath="$compile_rpath $absdir"
6443 esac
6444 ;;
6445 esac
6446 case " $sys_lib_dlsearch_path " in
6447 *" $libdir "*) ;;
6448 *)
6449 case "$finalize_rpath " in
6450 *" $libdir "*) ;;
6451 *) finalize_rpath="$finalize_rpath $libdir"
6452 esac
6453 ;;
6454 esac
6455 fi
6456
6457 if test -n "$old_archive_from_expsyms_cmds"; then
6458 # figure out the soname
6459 set dummy $library_names
6460 shift
6461 realname="$1"
6462 shift
6463 libname=`eval "\\$ECHO \"$libname_spec\""`
6464 # use dlname if we got it. it's perfectly good, no?
6465 if test -n "$dlname"; then
6466 soname="$dlname"
6467 elif test -n "$soname_spec"; then
6468 # bleh windows
6469 case $host in
6470 *cygwin* | mingw* | *cegcc*)
6471 func_arith $current - $age
6472 major=$func_arith_result
6473 versuffix="-$major"
6474 ;;
6475 esac
6476 eval soname=\"$soname_spec\"
6477 else
6478 soname="$realname"
6479 fi
6480
6481 # Make a new name for the extract_expsyms_cmds to use
6482 soroot="$soname"
6483 func_basename "$soroot"
6484 soname="$func_basename_result"
6485 func_stripname 'lib' '.dll' "$soname"
6486 newlib=libimp-$func_stripname_result.a
6487
6488 # If the library has no export list, then create one now
6489 if test -f "$output_objdir/$soname-def"; then :
6490 else
6491 func_verbose "extracting exported symbol list from \`$soname'"
6492 func_execute_cmds "$extract_expsyms_cmds" 'exit $?'
6493 fi
6494
6495 # Create $newlib
6496 if test -f "$output_objdir/$newlib"; then :; else
6497 func_verbose "generating import library for \`$soname'"
6498 func_execute_cmds "$old_archive_from_expsyms_cmds" 'exit $?'
6499 fi
6500 # make sure the library variables are pointing to the new library
6501 dir=$output_objdir
6502 linklib=$newlib
6503 fi # test -n "$old_archive_from_expsyms_cmds"
6504
6505 if test "$linkmode" = prog || test "$mode" != relink; then
6506 add_shlibpath=
6507 add_dir=
6508 add=
6509 lib_linked=yes
6510 case $hardcode_action in
6511 immediate | unsupported)
6512 if test "$hardcode_direct" = no; then
6513 add="$dir/$linklib"
6514 case $host in
6515 *-*-sco3.2v5.0.[024]*) add_dir="-L$dir" ;;
6516 *-*-sysv4*uw2*) add_dir="-L$dir" ;;
6517 *-*-sysv5OpenUNIX* | *-*-sysv5UnixWare7.[01].[10]* | \
6518 *-*-unixware7*) add_dir="-L$dir" ;;
6519 *-*-darwin* )
6520 # if the lib is a (non-dlopened) module then we can not
6521 # link against it, someone is ignoring the earlier warnings
6522 if /usr/bin/file -L $add 2> /dev/null |
6523 $GREP ": [^:]* bundle" >/dev/null ; then
6524 if test "X$dlopenmodule" != "X$lib"; then
6525 $ECHO "*** Warning: lib $linklib is a module, not a shared library"
6526 if test -z "$old_library" ; then
cristyfd9dcd42010-08-08 18:07:02 +00006527 echo
6528 echo "*** And there doesn't seem to be a static archive available"
6529 echo "*** The link will probably fail, sorry"
cristy3ed852e2009-09-05 21:47:34 +00006530 else
6531 add="$dir/$old_library"
6532 fi
6533 elif test -n "$old_library"; then
6534 add="$dir/$old_library"
6535 fi
6536 fi
6537 esac
6538 elif test "$hardcode_minus_L" = no; then
6539 case $host in
6540 *-*-sunos*) add_shlibpath="$dir" ;;
6541 esac
6542 add_dir="-L$dir"
6543 add="-l$name"
6544 elif test "$hardcode_shlibpath_var" = no; then
6545 add_shlibpath="$dir"
6546 add="-l$name"
6547 else
6548 lib_linked=no
6549 fi
6550 ;;
6551 relink)
6552 if test "$hardcode_direct" = yes &&
6553 test "$hardcode_direct_absolute" = no; then
6554 add="$dir/$linklib"
6555 elif test "$hardcode_minus_L" = yes; then
6556 add_dir="-L$dir"
6557 # Try looking first in the location we're being installed to.
6558 if test -n "$inst_prefix_dir"; then
6559 case $libdir in
6560 [\\/]*)
6561 add_dir="$add_dir -L$inst_prefix_dir$libdir"
6562 ;;
6563 esac
6564 fi
6565 add="-l$name"
6566 elif test "$hardcode_shlibpath_var" = yes; then
6567 add_shlibpath="$dir"
6568 add="-l$name"
6569 else
6570 lib_linked=no
6571 fi
6572 ;;
6573 *) lib_linked=no ;;
6574 esac
6575
cristy3ed852e2009-09-05 21:47:34 +00006576 if test -n "$add_shlibpath"; then
6577 case :$compile_shlibpath: in
6578 *":$add_shlibpath:"*) ;;
6579 *) compile_shlibpath="$compile_shlibpath$add_shlibpath:" ;;
6580 esac
6581 fi
6582 if test "$linkmode" = prog; then
6583 test -n "$add_dir" && compile_deplibs="$add_dir $compile_deplibs"
6584 test -n "$add" && compile_deplibs="$add $compile_deplibs"
6585 else
6586 test -n "$add_dir" && deplibs="$add_dir $deplibs"
6587 test -n "$add" && deplibs="$add $deplibs"
6588 if test "$hardcode_direct" != yes &&
6589 test "$hardcode_minus_L" != yes &&
6590 test "$hardcode_shlibpath_var" = yes; then
6591 case :$finalize_shlibpath: in
6592 *":$libdir:"*) ;;
6593 *) finalize_shlibpath="$finalize_shlibpath$libdir:" ;;
6594 esac
6595 fi
6596 fi
6597 fi
6598
6599 if test "$linkmode" = prog || test "$mode" = relink; then
6600 add_shlibpath=
6601 add_dir=
6602 add=
6603 # Finalize command for both is simple: just hardcode it.
6604 if test "$hardcode_direct" = yes &&
6605 test "$hardcode_direct_absolute" = no; then
6606 add="$libdir/$linklib"
6607 elif test "$hardcode_minus_L" = yes; then
6608 add_dir="-L$libdir"
6609 add="-l$name"
6610 elif test "$hardcode_shlibpath_var" = yes; then
6611 case :$finalize_shlibpath: in
6612 *":$libdir:"*) ;;
6613 *) finalize_shlibpath="$finalize_shlibpath$libdir:" ;;
6614 esac
6615 add="-l$name"
6616 elif test "$hardcode_automatic" = yes; then
6617 if test -n "$inst_prefix_dir" &&
6618 test -f "$inst_prefix_dir$libdir/$linklib" ; then
6619 add="$inst_prefix_dir$libdir/$linklib"
6620 else
6621 add="$libdir/$linklib"
6622 fi
6623 else
6624 # We cannot seem to hardcode it, guess we'll fake it.
6625 add_dir="-L$libdir"
6626 # Try looking first in the location we're being installed to.
6627 if test -n "$inst_prefix_dir"; then
6628 case $libdir in
6629 [\\/]*)
6630 add_dir="$add_dir -L$inst_prefix_dir$libdir"
6631 ;;
6632 esac
6633 fi
6634 add="-l$name"
6635 fi
6636
6637 if test "$linkmode" = prog; then
6638 test -n "$add_dir" && finalize_deplibs="$add_dir $finalize_deplibs"
6639 test -n "$add" && finalize_deplibs="$add $finalize_deplibs"
6640 else
6641 test -n "$add_dir" && deplibs="$add_dir $deplibs"
6642 test -n "$add" && deplibs="$add $deplibs"
6643 fi
6644 fi
6645 elif test "$linkmode" = prog; then
6646 # Here we assume that one of hardcode_direct or hardcode_minus_L
6647 # is not unsupported. This is valid on all known static and
6648 # shared platforms.
6649 if test "$hardcode_direct" != unsupported; then
6650 test -n "$old_library" && linklib="$old_library"
6651 compile_deplibs="$dir/$linklib $compile_deplibs"
6652 finalize_deplibs="$dir/$linklib $finalize_deplibs"
6653 else
6654 compile_deplibs="-l$name -L$dir $compile_deplibs"
6655 finalize_deplibs="-l$name -L$dir $finalize_deplibs"
6656 fi
6657 elif test "$build_libtool_libs" = yes; then
6658 # Not a shared library
6659 if test "$deplibs_check_method" != pass_all; then
6660 # We're trying link a shared library against a static one
6661 # but the system doesn't support it.
6662
6663 # Just print a warning and add the library to dependency_libs so
6664 # that the program can be linked against the static library.
cristyfd9dcd42010-08-08 18:07:02 +00006665 echo
cristy3ed852e2009-09-05 21:47:34 +00006666 $ECHO "*** Warning: This system can not link to static lib archive $lib."
cristyfd9dcd42010-08-08 18:07:02 +00006667 echo "*** I have the capability to make that library automatically link in when"
6668 echo "*** you link to this library. But I can only do this if you have a"
6669 echo "*** shared version of the library, which you do not appear to have."
cristy3ed852e2009-09-05 21:47:34 +00006670 if test "$module" = yes; then
cristyfd9dcd42010-08-08 18:07:02 +00006671 echo "*** But as you try to build a module library, libtool will still create "
6672 echo "*** a static module, that should work as long as the dlopening application"
6673 echo "*** is linked with the -dlopen flag to resolve symbols at runtime."
cristy3ed852e2009-09-05 21:47:34 +00006674 if test -z "$global_symbol_pipe"; then
cristyfd9dcd42010-08-08 18:07:02 +00006675 echo
6676 echo "*** However, this would only work if libtool was able to extract symbol"
6677 echo "*** lists from a program, using \`nm' or equivalent, but libtool could"
6678 echo "*** not find such a program. So, this module is probably useless."
6679 echo "*** \`nm' from GNU binutils and a full rebuild may help."
cristy3ed852e2009-09-05 21:47:34 +00006680 fi
6681 if test "$build_old_libs" = no; then
6682 build_libtool_libs=module
6683 build_old_libs=yes
6684 else
6685 build_libtool_libs=no
6686 fi
6687 fi
6688 else
6689 deplibs="$dir/$old_library $deplibs"
6690 link_static=yes
6691 fi
6692 fi # link shared/static library?
6693
6694 if test "$linkmode" = lib; then
6695 if test -n "$dependency_libs" &&
6696 { test "$hardcode_into_libs" != yes ||
6697 test "$build_old_libs" = yes ||
6698 test "$link_static" = yes; }; then
6699 # Extract -R from dependency_libs
6700 temp_deplibs=
6701 for libdir in $dependency_libs; do
6702 case $libdir in
6703 -R*) func_stripname '-R' '' "$libdir"
6704 temp_xrpath=$func_stripname_result
6705 case " $xrpath " in
6706 *" $temp_xrpath "*) ;;
6707 *) xrpath="$xrpath $temp_xrpath";;
6708 esac;;
6709 *) temp_deplibs="$temp_deplibs $libdir";;
6710 esac
6711 done
6712 dependency_libs="$temp_deplibs"
6713 fi
6714
6715 newlib_search_path="$newlib_search_path $absdir"
6716 # Link against this library
6717 test "$link_static" = no && newdependency_libs="$abs_ladir/$laname $newdependency_libs"
6718 # ... and its dependency_libs
6719 tmp_libs=
6720 for deplib in $dependency_libs; do
6721 newdependency_libs="$deplib $newdependency_libs"
6722 if $opt_duplicate_deps ; then
6723 case "$tmp_libs " in
6724 *" $deplib "*) specialdeplibs="$specialdeplibs $deplib" ;;
6725 esac
6726 fi
6727 tmp_libs="$tmp_libs $deplib"
6728 done
6729
6730 if test "$link_all_deplibs" != no; then
6731 # Add the search paths of all dependency libraries
6732 for deplib in $dependency_libs; do
cristyfd9dcd42010-08-08 18:07:02 +00006733 path=
cristy3ed852e2009-09-05 21:47:34 +00006734 case $deplib in
6735 -L*) path="$deplib" ;;
6736 *.la)
6737 func_dirname "$deplib" "" "."
6738 dir="$func_dirname_result"
6739 # We need an absolute path.
6740 case $dir in
6741 [\\/]* | [A-Za-z]:[\\/]*) absdir="$dir" ;;
6742 *)
6743 absdir=`cd "$dir" && pwd`
6744 if test -z "$absdir"; then
6745 func_warning "cannot determine absolute directory name of \`$dir'"
6746 absdir="$dir"
6747 fi
6748 ;;
6749 esac
6750 if $GREP "^installed=no" $deplib > /dev/null; then
6751 case $host in
6752 *-*-darwin*)
6753 depdepl=
6754 eval deplibrary_names=`${SED} -n -e 's/^library_names=\(.*\)$/\1/p' $deplib`
6755 if test -n "$deplibrary_names" ; then
6756 for tmp in $deplibrary_names ; do
6757 depdepl=$tmp
6758 done
6759 if test -f "$absdir/$objdir/$depdepl" ; then
6760 depdepl="$absdir/$objdir/$depdepl"
6761 darwin_install_name=`${OTOOL} -L $depdepl | awk '{if (NR == 2) {print $1;exit}}'`
6762 if test -z "$darwin_install_name"; then
6763 darwin_install_name=`${OTOOL64} -L $depdepl | awk '{if (NR == 2) {print $1;exit}}'`
6764 fi
6765 compiler_flags="$compiler_flags ${wl}-dylib_file ${wl}${darwin_install_name}:${depdepl}"
6766 linker_flags="$linker_flags -dylib_file ${darwin_install_name}:${depdepl}"
6767 path=
6768 fi
6769 fi
6770 ;;
6771 *)
6772 path="-L$absdir/$objdir"
6773 ;;
6774 esac
6775 else
6776 eval libdir=`${SED} -n -e 's/^libdir=\(.*\)$/\1/p' $deplib`
6777 test -z "$libdir" && \
6778 func_fatal_error "\`$deplib' is not a valid libtool archive"
6779 test "$absdir" != "$libdir" && \
6780 func_warning "\`$deplib' seems to be moved"
6781
6782 path="-L$absdir"
6783 fi
6784 ;;
6785 esac
6786 case " $deplibs " in
6787 *" $path "*) ;;
6788 *) deplibs="$path $deplibs" ;;
6789 esac
6790 done
6791 fi # link_all_deplibs != no
6792 fi # linkmode = lib
6793 done # for deplib in $libs
6794 if test "$pass" = link; then
6795 if test "$linkmode" = "prog"; then
6796 compile_deplibs="$new_inherited_linker_flags $compile_deplibs"
6797 finalize_deplibs="$new_inherited_linker_flags $finalize_deplibs"
6798 else
cristyfd9dcd42010-08-08 18:07:02 +00006799 compiler_flags="$compiler_flags "`$ECHO " $new_inherited_linker_flags" | $SED 's% \([^ $]*\).ltframework% -framework \1%g'`
cristy3ed852e2009-09-05 21:47:34 +00006800 fi
6801 fi
6802 dependency_libs="$newdependency_libs"
6803 if test "$pass" = dlpreopen; then
6804 # Link the dlpreopened libraries before other libraries
6805 for deplib in $save_deplibs; do
6806 deplibs="$deplib $deplibs"
6807 done
6808 fi
6809 if test "$pass" != dlopen; then
6810 if test "$pass" != conv; then
6811 # Make sure lib_search_path contains only unique directories.
6812 lib_search_path=
6813 for dir in $newlib_search_path; do
6814 case "$lib_search_path " in
6815 *" $dir "*) ;;
6816 *) lib_search_path="$lib_search_path $dir" ;;
6817 esac
6818 done
6819 newlib_search_path=
6820 fi
6821
6822 if test "$linkmode,$pass" != "prog,link"; then
6823 vars="deplibs"
6824 else
6825 vars="compile_deplibs finalize_deplibs"
6826 fi
6827 for var in $vars dependency_libs; do
6828 # Add libraries to $var in reverse order
6829 eval tmp_libs=\"\$$var\"
6830 new_libs=
6831 for deplib in $tmp_libs; do
6832 # FIXME: Pedantically, this is the right thing to do, so
6833 # that some nasty dependency loop isn't accidentally
6834 # broken:
6835 #new_libs="$deplib $new_libs"
6836 # Pragmatically, this seems to cause very few problems in
6837 # practice:
6838 case $deplib in
6839 -L*) new_libs="$deplib $new_libs" ;;
6840 -R*) ;;
6841 *)
6842 # And here is the reason: when a library appears more
6843 # than once as an explicit dependence of a library, or
6844 # is implicitly linked in more than once by the
6845 # compiler, it is considered special, and multiple
6846 # occurrences thereof are not removed. Compare this
6847 # with having the same library being listed as a
6848 # dependency of multiple other libraries: in this case,
6849 # we know (pedantically, we assume) the library does not
6850 # need to be listed more than once, so we keep only the
6851 # last copy. This is not always right, but it is rare
6852 # enough that we require users that really mean to play
6853 # such unportable linking tricks to link the library
6854 # using -Wl,-lname, so that libtool does not consider it
6855 # for duplicate removal.
6856 case " $specialdeplibs " in
6857 *" $deplib "*) new_libs="$deplib $new_libs" ;;
6858 *)
6859 case " $new_libs " in
6860 *" $deplib "*) ;;
6861 *) new_libs="$deplib $new_libs" ;;
6862 esac
6863 ;;
6864 esac
6865 ;;
6866 esac
6867 done
6868 tmp_libs=
6869 for deplib in $new_libs; do
6870 case $deplib in
6871 -L*)
6872 case " $tmp_libs " in
6873 *" $deplib "*) ;;
6874 *) tmp_libs="$tmp_libs $deplib" ;;
6875 esac
6876 ;;
6877 *) tmp_libs="$tmp_libs $deplib" ;;
6878 esac
6879 done
6880 eval $var=\"$tmp_libs\"
6881 done # for var
6882 fi
6883 # Last step: remove runtime libs from dependency_libs
6884 # (they stay in deplibs)
6885 tmp_libs=
6886 for i in $dependency_libs ; do
6887 case " $predeps $postdeps $compiler_lib_search_path " in
6888 *" $i "*)
6889 i=""
6890 ;;
6891 esac
6892 if test -n "$i" ; then
6893 tmp_libs="$tmp_libs $i"
6894 fi
6895 done
6896 dependency_libs=$tmp_libs
6897 done # for pass
6898 if test "$linkmode" = prog; then
6899 dlfiles="$newdlfiles"
6900 fi
6901 if test "$linkmode" = prog || test "$linkmode" = lib; then
6902 dlprefiles="$newdlprefiles"
6903 fi
6904
6905 case $linkmode in
6906 oldlib)
6907 if test -n "$dlfiles$dlprefiles" || test "$dlself" != no; then
6908 func_warning "\`-dlopen' is ignored for archives"
6909 fi
6910
6911 case " $deplibs" in
6912 *\ -l* | *\ -L*)
6913 func_warning "\`-l' and \`-L' are ignored for archives" ;;
6914 esac
6915
6916 test -n "$rpath" && \
6917 func_warning "\`-rpath' is ignored for archives"
6918
6919 test -n "$xrpath" && \
6920 func_warning "\`-R' is ignored for archives"
6921
6922 test -n "$vinfo" && \
6923 func_warning "\`-version-info/-version-number' is ignored for archives"
6924
6925 test -n "$release" && \
6926 func_warning "\`-release' is ignored for archives"
6927
6928 test -n "$export_symbols$export_symbols_regex" && \
6929 func_warning "\`-export-symbols' is ignored for archives"
6930
6931 # Now set the variables for building old libraries.
6932 build_libtool_libs=no
6933 oldlibs="$output"
6934 objs="$objs$old_deplibs"
6935 ;;
6936
6937 lib)
6938 # Make sure we only generate libraries of the form `libNAME.la'.
6939 case $outputname in
6940 lib*)
6941 func_stripname 'lib' '.la' "$outputname"
6942 name=$func_stripname_result
6943 eval shared_ext=\"$shrext_cmds\"
6944 eval libname=\"$libname_spec\"
6945 ;;
6946 *)
6947 test "$module" = no && \
6948 func_fatal_help "libtool library \`$output' must begin with \`lib'"
6949
6950 if test "$need_lib_prefix" != no; then
6951 # Add the "lib" prefix for modules if required
6952 func_stripname '' '.la' "$outputname"
6953 name=$func_stripname_result
6954 eval shared_ext=\"$shrext_cmds\"
6955 eval libname=\"$libname_spec\"
6956 else
6957 func_stripname '' '.la' "$outputname"
6958 libname=$func_stripname_result
6959 fi
6960 ;;
6961 esac
6962
6963 if test -n "$objs"; then
6964 if test "$deplibs_check_method" != pass_all; then
6965 func_fatal_error "cannot build libtool library \`$output' from non-libtool objects on this host:$objs"
6966 else
cristyfd9dcd42010-08-08 18:07:02 +00006967 echo
cristy3ed852e2009-09-05 21:47:34 +00006968 $ECHO "*** Warning: Linking the shared library $output against the non-libtool"
6969 $ECHO "*** objects $objs is not portable!"
6970 libobjs="$libobjs $objs"
6971 fi
6972 fi
6973
6974 test "$dlself" != no && \
6975 func_warning "\`-dlopen self' is ignored for libtool libraries"
6976
6977 set dummy $rpath
6978 shift
6979 test "$#" -gt 1 && \
6980 func_warning "ignoring multiple \`-rpath's for a libtool library"
6981
6982 install_libdir="$1"
6983
6984 oldlibs=
6985 if test -z "$rpath"; then
6986 if test "$build_libtool_libs" = yes; then
6987 # Building a libtool convenience library.
6988 # Some compilers have problems with a `.al' extension so
6989 # convenience libraries should have the same extension an
6990 # archive normally would.
6991 oldlibs="$output_objdir/$libname.$libext $oldlibs"
6992 build_libtool_libs=convenience
6993 build_old_libs=yes
6994 fi
6995
6996 test -n "$vinfo" && \
6997 func_warning "\`-version-info/-version-number' is ignored for convenience libraries"
6998
6999 test -n "$release" && \
7000 func_warning "\`-release' is ignored for convenience libraries"
7001 else
7002
7003 # Parse the version information argument.
7004 save_ifs="$IFS"; IFS=':'
7005 set dummy $vinfo 0 0 0
7006 shift
7007 IFS="$save_ifs"
7008
7009 test -n "$7" && \
7010 func_fatal_help "too many parameters to \`-version-info'"
7011
7012 # convert absolute version numbers to libtool ages
7013 # this retains compatibility with .la files and attempts
7014 # to make the code below a bit more comprehensible
7015
7016 case $vinfo_number in
7017 yes)
7018 number_major="$1"
7019 number_minor="$2"
7020 number_revision="$3"
7021 #
7022 # There are really only two kinds -- those that
7023 # use the current revision as the major version
7024 # and those that subtract age and use age as
7025 # a minor version. But, then there is irix
7026 # which has an extra 1 added just for fun
7027 #
7028 case $version_type in
7029 darwin|linux|osf|windows|none)
7030 func_arith $number_major + $number_minor
7031 current=$func_arith_result
7032 age="$number_minor"
7033 revision="$number_revision"
7034 ;;
cristyfd9dcd42010-08-08 18:07:02 +00007035 freebsd-aout|freebsd-elf|qnx|sunos)
cristy3ed852e2009-09-05 21:47:34 +00007036 current="$number_major"
7037 revision="$number_minor"
7038 age="0"
7039 ;;
7040 irix|nonstopux)
7041 func_arith $number_major + $number_minor
7042 current=$func_arith_result
7043 age="$number_minor"
7044 revision="$number_minor"
7045 lt_irix_increment=no
7046 ;;
7047 esac
7048 ;;
7049 no)
7050 current="$1"
7051 revision="$2"
7052 age="$3"
7053 ;;
7054 esac
7055
7056 # Check that each of the things are valid numbers.
7057 case $current in
7058 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]) ;;
7059 *)
7060 func_error "CURRENT \`$current' must be a nonnegative integer"
7061 func_fatal_error "\`$vinfo' is not valid version information"
7062 ;;
7063 esac
7064
7065 case $revision in
7066 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]) ;;
7067 *)
7068 func_error "REVISION \`$revision' must be a nonnegative integer"
7069 func_fatal_error "\`$vinfo' is not valid version information"
7070 ;;
7071 esac
7072
7073 case $age in
7074 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]) ;;
7075 *)
7076 func_error "AGE \`$age' must be a nonnegative integer"
7077 func_fatal_error "\`$vinfo' is not valid version information"
7078 ;;
7079 esac
7080
7081 if test "$age" -gt "$current"; then
7082 func_error "AGE \`$age' is greater than the current interface number \`$current'"
7083 func_fatal_error "\`$vinfo' is not valid version information"
7084 fi
7085
7086 # Calculate the version variables.
7087 major=
7088 versuffix=
7089 verstring=
7090 case $version_type in
7091 none) ;;
7092
7093 darwin)
7094 # Like Linux, but with the current version available in
7095 # verstring for coding it into the library header
7096 func_arith $current - $age
7097 major=.$func_arith_result
7098 versuffix="$major.$age.$revision"
7099 # Darwin ld doesn't like 0 for these options...
7100 func_arith $current + 1
7101 minor_current=$func_arith_result
7102 xlcverstring="${wl}-compatibility_version ${wl}$minor_current ${wl}-current_version ${wl}$minor_current.$revision"
7103 verstring="-compatibility_version $minor_current -current_version $minor_current.$revision"
7104 ;;
7105
7106 freebsd-aout)
7107 major=".$current"
7108 versuffix=".$current.$revision";
7109 ;;
7110
7111 freebsd-elf)
7112 major=".$current"
7113 versuffix=".$current"
7114 ;;
7115
7116 irix | nonstopux)
7117 if test "X$lt_irix_increment" = "Xno"; then
7118 func_arith $current - $age
7119 else
7120 func_arith $current - $age + 1
7121 fi
7122 major=$func_arith_result
7123
7124 case $version_type in
7125 nonstopux) verstring_prefix=nonstopux ;;
7126 *) verstring_prefix=sgi ;;
7127 esac
7128 verstring="$verstring_prefix$major.$revision"
7129
7130 # Add in all the interfaces that we are compatible with.
7131 loop=$revision
7132 while test "$loop" -ne 0; do
7133 func_arith $revision - $loop
7134 iface=$func_arith_result
7135 func_arith $loop - 1
7136 loop=$func_arith_result
7137 verstring="$verstring_prefix$major.$iface:$verstring"
7138 done
7139
7140 # Before this point, $major must not contain `.'.
7141 major=.$major
7142 versuffix="$major.$revision"
7143 ;;
7144
7145 linux)
7146 func_arith $current - $age
7147 major=.$func_arith_result
7148 versuffix="$major.$age.$revision"
7149 ;;
7150
7151 osf)
7152 func_arith $current - $age
7153 major=.$func_arith_result
7154 versuffix=".$current.$age.$revision"
7155 verstring="$current.$age.$revision"
7156
7157 # Add in all the interfaces that we are compatible with.
7158 loop=$age
7159 while test "$loop" -ne 0; do
7160 func_arith $current - $loop
7161 iface=$func_arith_result
7162 func_arith $loop - 1
7163 loop=$func_arith_result
7164 verstring="$verstring:${iface}.0"
7165 done
7166
7167 # Make executables depend on our current version.
7168 verstring="$verstring:${current}.0"
7169 ;;
7170
7171 qnx)
7172 major=".$current"
7173 versuffix=".$current"
7174 ;;
7175
7176 sunos)
7177 major=".$current"
7178 versuffix=".$current.$revision"
7179 ;;
7180
7181 windows)
7182 # Use '-' rather than '.', since we only want one
7183 # extension on DOS 8.3 filesystems.
7184 func_arith $current - $age
7185 major=$func_arith_result
7186 versuffix="-$major"
7187 ;;
7188
7189 *)
7190 func_fatal_configuration "unknown library version type \`$version_type'"
7191 ;;
7192 esac
7193
7194 # Clear the version info if we defaulted, and they specified a release.
7195 if test -z "$vinfo" && test -n "$release"; then
7196 major=
7197 case $version_type in
7198 darwin)
7199 # we can't check for "0.0" in archive_cmds due to quoting
7200 # problems, so we reset it completely
7201 verstring=
7202 ;;
7203 *)
7204 verstring="0.0"
7205 ;;
7206 esac
7207 if test "$need_version" = no; then
7208 versuffix=
7209 else
7210 versuffix=".0.0"
7211 fi
7212 fi
7213
7214 # Remove version info from name if versioning should be avoided
7215 if test "$avoid_version" = yes && test "$need_version" = no; then
7216 major=
7217 versuffix=
7218 verstring=""
7219 fi
7220
7221 # Check to see if the archive will have undefined symbols.
7222 if test "$allow_undefined" = yes; then
7223 if test "$allow_undefined_flag" = unsupported; then
7224 func_warning "undefined symbols not allowed in $host shared libraries"
7225 build_libtool_libs=no
7226 build_old_libs=yes
7227 fi
7228 else
7229 # Don't allow undefined symbols.
7230 allow_undefined_flag="$no_undefined_flag"
7231 fi
7232
7233 fi
7234
7235 func_generate_dlsyms "$libname" "$libname" "yes"
7236 libobjs="$libobjs $symfileobj"
7237 test "X$libobjs" = "X " && libobjs=
7238
7239 if test "$mode" != relink; then
7240 # Remove our outputs, but don't remove object files since they
7241 # may have been created when compiling PIC objects.
7242 removelist=
7243 tempremovelist=`$ECHO "$output_objdir/*"`
7244 for p in $tempremovelist; do
7245 case $p in
7246 *.$objext | *.gcno)
7247 ;;
7248 $output_objdir/$outputname | $output_objdir/$libname.* | $output_objdir/${libname}${release}.*)
7249 if test "X$precious_files_regex" != "X"; then
7250 if $ECHO "$p" | $EGREP -e "$precious_files_regex" >/dev/null 2>&1
7251 then
7252 continue
7253 fi
7254 fi
7255 removelist="$removelist $p"
7256 ;;
7257 *) ;;
7258 esac
7259 done
7260 test -n "$removelist" && \
7261 func_show_eval "${RM}r \$removelist"
7262 fi
7263
7264 # Now set the variables for building old libraries.
7265 if test "$build_old_libs" = yes && test "$build_libtool_libs" != convenience ; then
7266 oldlibs="$oldlibs $output_objdir/$libname.$libext"
7267
7268 # Transform .lo files to .o files.
cristyfd9dcd42010-08-08 18:07:02 +00007269 oldobjs="$objs "`$ECHO "$libobjs" | $SP2NL | $SED "/\.${libext}$/d; $lo2o" | $NL2SP`
cristy3ed852e2009-09-05 21:47:34 +00007270 fi
7271
7272 # Eliminate all temporary directories.
7273 #for path in $notinst_path; do
cristyfd9dcd42010-08-08 18:07:02 +00007274 # lib_search_path=`$ECHO "$lib_search_path " | $SED "s% $path % %g"`
7275 # deplibs=`$ECHO "$deplibs " | $SED "s% -L$path % %g"`
7276 # dependency_libs=`$ECHO "$dependency_libs " | $SED "s% -L$path % %g"`
cristy3ed852e2009-09-05 21:47:34 +00007277 #done
7278
7279 if test -n "$xrpath"; then
7280 # If the user specified any rpath flags, then add them.
7281 temp_xrpath=
7282 for libdir in $xrpath; do
7283 temp_xrpath="$temp_xrpath -R$libdir"
7284 case "$finalize_rpath " in
7285 *" $libdir "*) ;;
7286 *) finalize_rpath="$finalize_rpath $libdir" ;;
7287 esac
7288 done
7289 if test "$hardcode_into_libs" != yes || test "$build_old_libs" = yes; then
7290 dependency_libs="$temp_xrpath $dependency_libs"
7291 fi
7292 fi
7293
7294 # Make sure dlfiles contains only unique files that won't be dlpreopened
7295 old_dlfiles="$dlfiles"
7296 dlfiles=
7297 for lib in $old_dlfiles; do
7298 case " $dlprefiles $dlfiles " in
7299 *" $lib "*) ;;
7300 *) dlfiles="$dlfiles $lib" ;;
7301 esac
7302 done
7303
7304 # Make sure dlprefiles contains only unique files
7305 old_dlprefiles="$dlprefiles"
7306 dlprefiles=
7307 for lib in $old_dlprefiles; do
7308 case "$dlprefiles " in
7309 *" $lib "*) ;;
7310 *) dlprefiles="$dlprefiles $lib" ;;
7311 esac
7312 done
7313
7314 if test "$build_libtool_libs" = yes; then
7315 if test -n "$rpath"; then
7316 case $host in
cristyfd9dcd42010-08-08 18:07:02 +00007317 *-*-cygwin* | *-*-mingw* | *-*-pw32* | *-*-os2* | *-*-beos* | *-cegcc* | *-*-haiku*)
cristy3ed852e2009-09-05 21:47:34 +00007318 # these systems don't actually have a c library (as such)!
7319 ;;
7320 *-*-rhapsody* | *-*-darwin1.[012])
7321 # Rhapsody C library is in the System framework
7322 deplibs="$deplibs System.ltframework"
7323 ;;
7324 *-*-netbsd*)
7325 # Don't link with libc until the a.out ld.so is fixed.
7326 ;;
7327 *-*-openbsd* | *-*-freebsd* | *-*-dragonfly*)
7328 # Do not include libc due to us having libc/libc_r.
7329 ;;
7330 *-*-sco3.2v5* | *-*-sco5v6*)
7331 # Causes problems with __ctype
7332 ;;
7333 *-*-sysv4.2uw2* | *-*-sysv5* | *-*-unixware* | *-*-OpenUNIX*)
7334 # Compiler inserts libc in the correct place for threads to work
7335 ;;
7336 *)
7337 # Add libc to deplibs on all other systems if necessary.
7338 if test "$build_libtool_need_lc" = "yes"; then
7339 deplibs="$deplibs -lc"
7340 fi
7341 ;;
7342 esac
7343 fi
7344
7345 # Transform deplibs into only deplibs that can be linked in shared.
7346 name_save=$name
7347 libname_save=$libname
7348 release_save=$release
7349 versuffix_save=$versuffix
7350 major_save=$major
7351 # I'm not sure if I'm treating the release correctly. I think
7352 # release should show up in the -l (ie -lgmp5) so we don't want to
7353 # add it in twice. Is that correct?
7354 release=""
7355 versuffix=""
7356 major=""
7357 newdeplibs=
7358 droppeddeps=no
7359 case $deplibs_check_method in
7360 pass_all)
7361 # Don't check for shared/static. Everything works.
7362 # This might be a little naive. We might want to check
7363 # whether the library exists or not. But this is on
7364 # osf3 & osf4 and I'm not really sure... Just
7365 # implementing what was already the behavior.
7366 newdeplibs=$deplibs
7367 ;;
7368 test_compile)
7369 # This code stresses the "libraries are programs" paradigm to its
7370 # limits. Maybe even breaks it. We compile a program, linking it
7371 # against the deplibs as a proxy for the library. Then we can check
7372 # whether they linked in statically or dynamically with ldd.
7373 $opt_dry_run || $RM conftest.c
7374 cat > conftest.c <<EOF
7375 int main() { return 0; }
7376EOF
7377 $opt_dry_run || $RM conftest
7378 if $LTCC $LTCFLAGS -o conftest conftest.c $deplibs; then
7379 ldd_output=`ldd conftest`
7380 for i in $deplibs; do
7381 case $i in
7382 -l*)
7383 func_stripname -l '' "$i"
7384 name=$func_stripname_result
7385 if test "X$allow_libtool_libs_with_static_runtimes" = "Xyes" ; then
7386 case " $predeps $postdeps " in
7387 *" $i "*)
7388 newdeplibs="$newdeplibs $i"
7389 i=""
7390 ;;
7391 esac
7392 fi
7393 if test -n "$i" ; then
7394 libname=`eval "\\$ECHO \"$libname_spec\""`
7395 deplib_matches=`eval "\\$ECHO \"$library_names_spec\""`
7396 set dummy $deplib_matches; shift
7397 deplib_match=$1
7398 if test `expr "$ldd_output" : ".*$deplib_match"` -ne 0 ; then
7399 newdeplibs="$newdeplibs $i"
7400 else
7401 droppeddeps=yes
cristyfd9dcd42010-08-08 18:07:02 +00007402 echo
cristy3ed852e2009-09-05 21:47:34 +00007403 $ECHO "*** Warning: dynamic linker does not accept needed library $i."
cristyfd9dcd42010-08-08 18:07:02 +00007404 echo "*** I have the capability to make that library automatically link in when"
7405 echo "*** you link to this library. But I can only do this if you have a"
7406 echo "*** shared version of the library, which I believe you do not have"
7407 echo "*** because a test_compile did reveal that the linker did not use it for"
7408 echo "*** its dynamic dependency list that programs get resolved with at runtime."
cristy3ed852e2009-09-05 21:47:34 +00007409 fi
7410 fi
7411 ;;
7412 *)
7413 newdeplibs="$newdeplibs $i"
7414 ;;
7415 esac
7416 done
7417 else
7418 # Error occurred in the first compile. Let's try to salvage
7419 # the situation: Compile a separate program for each library.
7420 for i in $deplibs; do
7421 case $i in
7422 -l*)
7423 func_stripname -l '' "$i"
7424 name=$func_stripname_result
7425 $opt_dry_run || $RM conftest
7426 if $LTCC $LTCFLAGS -o conftest conftest.c $i; then
7427 ldd_output=`ldd conftest`
7428 if test "X$allow_libtool_libs_with_static_runtimes" = "Xyes" ; then
7429 case " $predeps $postdeps " in
7430 *" $i "*)
7431 newdeplibs="$newdeplibs $i"
7432 i=""
7433 ;;
7434 esac
7435 fi
7436 if test -n "$i" ; then
7437 libname=`eval "\\$ECHO \"$libname_spec\""`
7438 deplib_matches=`eval "\\$ECHO \"$library_names_spec\""`
7439 set dummy $deplib_matches; shift
7440 deplib_match=$1
7441 if test `expr "$ldd_output" : ".*$deplib_match"` -ne 0 ; then
7442 newdeplibs="$newdeplibs $i"
7443 else
7444 droppeddeps=yes
cristyfd9dcd42010-08-08 18:07:02 +00007445 echo
cristy3ed852e2009-09-05 21:47:34 +00007446 $ECHO "*** Warning: dynamic linker does not accept needed library $i."
cristyfd9dcd42010-08-08 18:07:02 +00007447 echo "*** I have the capability to make that library automatically link in when"
7448 echo "*** you link to this library. But I can only do this if you have a"
7449 echo "*** shared version of the library, which you do not appear to have"
7450 echo "*** because a test_compile did reveal that the linker did not use this one"
7451 echo "*** as a dynamic dependency that programs can get resolved with at runtime."
cristy3ed852e2009-09-05 21:47:34 +00007452 fi
7453 fi
7454 else
7455 droppeddeps=yes
cristyfd9dcd42010-08-08 18:07:02 +00007456 echo
cristy3ed852e2009-09-05 21:47:34 +00007457 $ECHO "*** Warning! Library $i is needed by this library but I was not able to"
cristyfd9dcd42010-08-08 18:07:02 +00007458 echo "*** make it link in! You will probably need to install it or some"
7459 echo "*** library that it depends on before this library will be fully"
7460 echo "*** functional. Installing it before continuing would be even better."
cristy3ed852e2009-09-05 21:47:34 +00007461 fi
7462 ;;
7463 *)
7464 newdeplibs="$newdeplibs $i"
7465 ;;
7466 esac
7467 done
7468 fi
7469 ;;
7470 file_magic*)
7471 set dummy $deplibs_check_method; shift
7472 file_magic_regex=`expr "$deplibs_check_method" : "$1 \(.*\)"`
7473 for a_deplib in $deplibs; do
7474 case $a_deplib in
7475 -l*)
7476 func_stripname -l '' "$a_deplib"
7477 name=$func_stripname_result
7478 if test "X$allow_libtool_libs_with_static_runtimes" = "Xyes" ; then
7479 case " $predeps $postdeps " in
7480 *" $a_deplib "*)
7481 newdeplibs="$newdeplibs $a_deplib"
7482 a_deplib=""
7483 ;;
7484 esac
7485 fi
7486 if test -n "$a_deplib" ; then
7487 libname=`eval "\\$ECHO \"$libname_spec\""`
7488 for i in $lib_search_path $sys_lib_search_path $shlib_search_path; do
7489 potential_libs=`ls $i/$libname[.-]* 2>/dev/null`
7490 for potent_lib in $potential_libs; do
7491 # Follow soft links.
7492 if ls -lLd "$potent_lib" 2>/dev/null |
7493 $GREP " -> " >/dev/null; then
7494 continue
7495 fi
7496 # The statement above tries to avoid entering an
7497 # endless loop below, in case of cyclic links.
7498 # We might still enter an endless loop, since a link
7499 # loop can be closed while we follow links,
7500 # but so what?
7501 potlib="$potent_lib"
7502 while test -h "$potlib" 2>/dev/null; do
7503 potliblink=`ls -ld $potlib | ${SED} 's/.* -> //'`
7504 case $potliblink in
7505 [\\/]* | [A-Za-z]:[\\/]*) potlib="$potliblink";;
cristyfd9dcd42010-08-08 18:07:02 +00007506 *) potlib=`$ECHO "$potlib" | $SED 's,[^/]*$,,'`"$potliblink";;
cristy3ed852e2009-09-05 21:47:34 +00007507 esac
7508 done
7509 if eval $file_magic_cmd \"\$potlib\" 2>/dev/null |
7510 $SED -e 10q |
7511 $EGREP "$file_magic_regex" > /dev/null; then
7512 newdeplibs="$newdeplibs $a_deplib"
7513 a_deplib=""
7514 break 2
7515 fi
7516 done
7517 done
7518 fi
7519 if test -n "$a_deplib" ; then
7520 droppeddeps=yes
cristyfd9dcd42010-08-08 18:07:02 +00007521 echo
cristy3ed852e2009-09-05 21:47:34 +00007522 $ECHO "*** Warning: linker path does not have real file for library $a_deplib."
cristyfd9dcd42010-08-08 18:07:02 +00007523 echo "*** I have the capability to make that library automatically link in when"
7524 echo "*** you link to this library. But I can only do this if you have a"
7525 echo "*** shared version of the library, which you do not appear to have"
7526 echo "*** because I did check the linker path looking for a file starting"
cristy3ed852e2009-09-05 21:47:34 +00007527 if test -z "$potlib" ; then
7528 $ECHO "*** with $libname but no candidates were found. (...for file magic test)"
7529 else
7530 $ECHO "*** with $libname and none of the candidates passed a file format test"
7531 $ECHO "*** using a file magic. Last file checked: $potlib"
7532 fi
7533 fi
7534 ;;
7535 *)
7536 # Add a -L argument.
7537 newdeplibs="$newdeplibs $a_deplib"
7538 ;;
7539 esac
7540 done # Gone through all deplibs.
7541 ;;
7542 match_pattern*)
7543 set dummy $deplibs_check_method; shift
7544 match_pattern_regex=`expr "$deplibs_check_method" : "$1 \(.*\)"`
7545 for a_deplib in $deplibs; do
7546 case $a_deplib in
7547 -l*)
7548 func_stripname -l '' "$a_deplib"
7549 name=$func_stripname_result
7550 if test "X$allow_libtool_libs_with_static_runtimes" = "Xyes" ; then
7551 case " $predeps $postdeps " in
7552 *" $a_deplib "*)
7553 newdeplibs="$newdeplibs $a_deplib"
7554 a_deplib=""
7555 ;;
7556 esac
7557 fi
7558 if test -n "$a_deplib" ; then
7559 libname=`eval "\\$ECHO \"$libname_spec\""`
7560 for i in $lib_search_path $sys_lib_search_path $shlib_search_path; do
7561 potential_libs=`ls $i/$libname[.-]* 2>/dev/null`
7562 for potent_lib in $potential_libs; do
7563 potlib="$potent_lib" # see symlink-check above in file_magic test
cristyfd9dcd42010-08-08 18:07:02 +00007564 if eval "\$ECHO \"$potent_lib\"" 2>/dev/null | $SED 10q | \
cristy3ed852e2009-09-05 21:47:34 +00007565 $EGREP "$match_pattern_regex" > /dev/null; then
7566 newdeplibs="$newdeplibs $a_deplib"
7567 a_deplib=""
7568 break 2
7569 fi
7570 done
7571 done
7572 fi
7573 if test -n "$a_deplib" ; then
7574 droppeddeps=yes
cristyfd9dcd42010-08-08 18:07:02 +00007575 echo
cristy3ed852e2009-09-05 21:47:34 +00007576 $ECHO "*** Warning: linker path does not have real file for library $a_deplib."
cristyfd9dcd42010-08-08 18:07:02 +00007577 echo "*** I have the capability to make that library automatically link in when"
7578 echo "*** you link to this library. But I can only do this if you have a"
7579 echo "*** shared version of the library, which you do not appear to have"
7580 echo "*** because I did check the linker path looking for a file starting"
cristy3ed852e2009-09-05 21:47:34 +00007581 if test -z "$potlib" ; then
7582 $ECHO "*** with $libname but no candidates were found. (...for regex pattern test)"
7583 else
7584 $ECHO "*** with $libname and none of the candidates passed a file format test"
7585 $ECHO "*** using a regex pattern. Last file checked: $potlib"
7586 fi
7587 fi
7588 ;;
7589 *)
7590 # Add a -L argument.
7591 newdeplibs="$newdeplibs $a_deplib"
7592 ;;
7593 esac
7594 done # Gone through all deplibs.
7595 ;;
7596 none | unknown | *)
7597 newdeplibs=""
cristyfd9dcd42010-08-08 18:07:02 +00007598 tmp_deplibs=`$ECHO " $deplibs" | $SED 's/ -lc$//; s/ -[LR][^ ]*//g'`
cristy3ed852e2009-09-05 21:47:34 +00007599 if test "X$allow_libtool_libs_with_static_runtimes" = "Xyes" ; then
7600 for i in $predeps $postdeps ; do
7601 # can't use Xsed below, because $i might contain '/'
cristyfd9dcd42010-08-08 18:07:02 +00007602 tmp_deplibs=`$ECHO " $tmp_deplibs" | $SED "s,$i,,"`
cristy3ed852e2009-09-05 21:47:34 +00007603 done
7604 fi
cristyfd9dcd42010-08-08 18:07:02 +00007605 case $tmp_deplibs in
7606 *[!\ \ ]*)
7607 echo
cristy3ed852e2009-09-05 21:47:34 +00007608 if test "X$deplibs_check_method" = "Xnone"; then
cristyfd9dcd42010-08-08 18:07:02 +00007609 echo "*** Warning: inter-library dependencies are not supported in this platform."
cristy3ed852e2009-09-05 21:47:34 +00007610 else
cristyfd9dcd42010-08-08 18:07:02 +00007611 echo "*** Warning: inter-library dependencies are not known to be supported."
cristy3ed852e2009-09-05 21:47:34 +00007612 fi
cristyfd9dcd42010-08-08 18:07:02 +00007613 echo "*** All declared inter-library dependencies are being dropped."
cristy3ed852e2009-09-05 21:47:34 +00007614 droppeddeps=yes
cristyfd9dcd42010-08-08 18:07:02 +00007615 ;;
7616 esac
cristy3ed852e2009-09-05 21:47:34 +00007617 ;;
7618 esac
7619 versuffix=$versuffix_save
7620 major=$major_save
7621 release=$release_save
7622 libname=$libname_save
7623 name=$name_save
7624
7625 case $host in
7626 *-*-rhapsody* | *-*-darwin1.[012])
7627 # On Rhapsody replace the C library with the System framework
cristyfd9dcd42010-08-08 18:07:02 +00007628 newdeplibs=`$ECHO " $newdeplibs" | $SED 's/ -lc / System.ltframework /'`
cristy3ed852e2009-09-05 21:47:34 +00007629 ;;
7630 esac
7631
7632 if test "$droppeddeps" = yes; then
7633 if test "$module" = yes; then
cristyfd9dcd42010-08-08 18:07:02 +00007634 echo
7635 echo "*** Warning: libtool could not satisfy all declared inter-library"
cristy3ed852e2009-09-05 21:47:34 +00007636 $ECHO "*** dependencies of module $libname. Therefore, libtool will create"
cristyfd9dcd42010-08-08 18:07:02 +00007637 echo "*** a static module, that should work as long as the dlopening"
7638 echo "*** application is linked with the -dlopen flag."
cristy3ed852e2009-09-05 21:47:34 +00007639 if test -z "$global_symbol_pipe"; then
cristyfd9dcd42010-08-08 18:07:02 +00007640 echo
7641 echo "*** However, this would only work if libtool was able to extract symbol"
7642 echo "*** lists from a program, using \`nm' or equivalent, but libtool could"
7643 echo "*** not find such a program. So, this module is probably useless."
7644 echo "*** \`nm' from GNU binutils and a full rebuild may help."
cristy3ed852e2009-09-05 21:47:34 +00007645 fi
7646 if test "$build_old_libs" = no; then
7647 oldlibs="$output_objdir/$libname.$libext"
7648 build_libtool_libs=module
7649 build_old_libs=yes
7650 else
7651 build_libtool_libs=no
7652 fi
7653 else
cristyfd9dcd42010-08-08 18:07:02 +00007654 echo "*** The inter-library dependencies that have been dropped here will be"
7655 echo "*** automatically added whenever a program is linked with this library"
7656 echo "*** or is declared to -dlopen it."
cristy3ed852e2009-09-05 21:47:34 +00007657
7658 if test "$allow_undefined" = no; then
cristyfd9dcd42010-08-08 18:07:02 +00007659 echo
7660 echo "*** Since this library must not contain undefined symbols,"
7661 echo "*** because either the platform does not support them or"
7662 echo "*** it was explicitly requested with -no-undefined,"
7663 echo "*** libtool will only create a static version of it."
cristy3ed852e2009-09-05 21:47:34 +00007664 if test "$build_old_libs" = no; then
7665 oldlibs="$output_objdir/$libname.$libext"
7666 build_libtool_libs=module
7667 build_old_libs=yes
7668 else
7669 build_libtool_libs=no
7670 fi
7671 fi
7672 fi
7673 fi
7674 # Done checking deplibs!
7675 deplibs=$newdeplibs
7676 fi
7677 # Time to change all our "foo.ltframework" stuff back to "-framework foo"
7678 case $host in
7679 *-*-darwin*)
cristyfd9dcd42010-08-08 18:07:02 +00007680 newdeplibs=`$ECHO " $newdeplibs" | $SED 's% \([^ $]*\).ltframework% -framework \1%g'`
7681 new_inherited_linker_flags=`$ECHO " $new_inherited_linker_flags" | $SED 's% \([^ $]*\).ltframework% -framework \1%g'`
7682 deplibs=`$ECHO " $deplibs" | $SED 's% \([^ $]*\).ltframework% -framework \1%g'`
cristy3ed852e2009-09-05 21:47:34 +00007683 ;;
7684 esac
7685
7686 # move library search paths that coincide with paths to not yet
7687 # installed libraries to the beginning of the library search list
7688 new_libs=
7689 for path in $notinst_path; do
7690 case " $new_libs " in
7691 *" -L$path/$objdir "*) ;;
7692 *)
7693 case " $deplibs " in
7694 *" -L$path/$objdir "*)
7695 new_libs="$new_libs -L$path/$objdir" ;;
7696 esac
7697 ;;
7698 esac
7699 done
7700 for deplib in $deplibs; do
7701 case $deplib in
7702 -L*)
7703 case " $new_libs " in
7704 *" $deplib "*) ;;
7705 *) new_libs="$new_libs $deplib" ;;
7706 esac
7707 ;;
7708 *) new_libs="$new_libs $deplib" ;;
7709 esac
7710 done
7711 deplibs="$new_libs"
7712
7713 # All the library-specific variables (install_libdir is set above).
7714 library_names=
7715 old_library=
7716 dlname=
7717
7718 # Test again, we may have decided not to build it any more
7719 if test "$build_libtool_libs" = yes; then
7720 if test "$hardcode_into_libs" = yes; then
7721 # Hardcode the library paths
7722 hardcode_libdirs=
7723 dep_rpath=
7724 rpath="$finalize_rpath"
7725 test "$mode" != relink && rpath="$compile_rpath$rpath"
7726 for libdir in $rpath; do
7727 if test -n "$hardcode_libdir_flag_spec"; then
7728 if test -n "$hardcode_libdir_separator"; then
7729 if test -z "$hardcode_libdirs"; then
7730 hardcode_libdirs="$libdir"
7731 else
7732 # Just accumulate the unique libdirs.
7733 case $hardcode_libdir_separator$hardcode_libdirs$hardcode_libdir_separator in
7734 *"$hardcode_libdir_separator$libdir$hardcode_libdir_separator"*)
7735 ;;
7736 *)
7737 hardcode_libdirs="$hardcode_libdirs$hardcode_libdir_separator$libdir"
7738 ;;
7739 esac
7740 fi
7741 else
7742 eval flag=\"$hardcode_libdir_flag_spec\"
7743 dep_rpath="$dep_rpath $flag"
7744 fi
7745 elif test -n "$runpath_var"; then
7746 case "$perm_rpath " in
7747 *" $libdir "*) ;;
7748 *) perm_rpath="$perm_rpath $libdir" ;;
7749 esac
7750 fi
7751 done
7752 # Substitute the hardcoded libdirs into the rpath.
7753 if test -n "$hardcode_libdir_separator" &&
7754 test -n "$hardcode_libdirs"; then
7755 libdir="$hardcode_libdirs"
7756 if test -n "$hardcode_libdir_flag_spec_ld"; then
7757 eval dep_rpath=\"$hardcode_libdir_flag_spec_ld\"
7758 else
7759 eval dep_rpath=\"$hardcode_libdir_flag_spec\"
7760 fi
7761 fi
7762 if test -n "$runpath_var" && test -n "$perm_rpath"; then
7763 # We should set the runpath_var.
7764 rpath=
7765 for dir in $perm_rpath; do
7766 rpath="$rpath$dir:"
7767 done
7768 eval "$runpath_var='$rpath\$$runpath_var'; export $runpath_var"
7769 fi
7770 test -n "$dep_rpath" && deplibs="$dep_rpath $deplibs"
7771 fi
7772
7773 shlibpath="$finalize_shlibpath"
7774 test "$mode" != relink && shlibpath="$compile_shlibpath$shlibpath"
7775 if test -n "$shlibpath"; then
7776 eval "$shlibpath_var='$shlibpath\$$shlibpath_var'; export $shlibpath_var"
7777 fi
7778
7779 # Get the real and link names of the library.
7780 eval shared_ext=\"$shrext_cmds\"
7781 eval library_names=\"$library_names_spec\"
7782 set dummy $library_names
7783 shift
7784 realname="$1"
7785 shift
7786
7787 if test -n "$soname_spec"; then
7788 eval soname=\"$soname_spec\"
7789 else
7790 soname="$realname"
7791 fi
7792 if test -z "$dlname"; then
7793 dlname=$soname
7794 fi
7795
7796 lib="$output_objdir/$realname"
7797 linknames=
7798 for link
7799 do
7800 linknames="$linknames $link"
7801 done
7802
7803 # Use standard objects if they are pic
cristyfd9dcd42010-08-08 18:07:02 +00007804 test -z "$pic_flag" && libobjs=`$ECHO "$libobjs" | $SP2NL | $SED "$lo2o" | $NL2SP`
cristy3ed852e2009-09-05 21:47:34 +00007805 test "X$libobjs" = "X " && libobjs=
7806
7807 delfiles=
7808 if test -n "$export_symbols" && test -n "$include_expsyms"; then
7809 $opt_dry_run || cp "$export_symbols" "$output_objdir/$libname.uexp"
7810 export_symbols="$output_objdir/$libname.uexp"
7811 delfiles="$delfiles $export_symbols"
7812 fi
7813
7814 orig_export_symbols=
7815 case $host_os in
7816 cygwin* | mingw* | cegcc*)
7817 if test -n "$export_symbols" && test -z "$export_symbols_regex"; then
7818 # exporting using user supplied symfile
7819 if test "x`$SED 1q $export_symbols`" != xEXPORTS; then
7820 # and it's NOT already a .def file. Must figure out
7821 # which of the given symbols are data symbols and tag
7822 # them as such. So, trigger use of export_symbols_cmds.
7823 # export_symbols gets reassigned inside the "prepare
7824 # the list of exported symbols" if statement, so the
7825 # include_expsyms logic still works.
7826 orig_export_symbols="$export_symbols"
7827 export_symbols=
7828 always_export_symbols=yes
7829 fi
7830 fi
7831 ;;
7832 esac
7833
7834 # Prepare the list of exported symbols
7835 if test -z "$export_symbols"; then
7836 if test "$always_export_symbols" = yes || test -n "$export_symbols_regex"; then
7837 func_verbose "generating symbol list for \`$libname.la'"
7838 export_symbols="$output_objdir/$libname.exp"
7839 $opt_dry_run || $RM $export_symbols
7840 cmds=$export_symbols_cmds
7841 save_ifs="$IFS"; IFS='~'
7842 for cmd in $cmds; do
7843 IFS="$save_ifs"
7844 eval cmd=\"$cmd\"
7845 func_len " $cmd"
7846 len=$func_len_result
7847 if test "$len" -lt "$max_cmd_len" || test "$max_cmd_len" -le -1; then
7848 func_show_eval "$cmd" 'exit $?'
7849 skipped_export=false
7850 else
7851 # The command line is too long to execute in one step.
7852 func_verbose "using reloadable object file for export list..."
7853 skipped_export=:
7854 # Break out early, otherwise skipped_export may be
7855 # set to false by a later but shorter cmd.
7856 break
7857 fi
7858 done
7859 IFS="$save_ifs"
7860 if test -n "$export_symbols_regex" && test "X$skipped_export" != "X:"; then
7861 func_show_eval '$EGREP -e "$export_symbols_regex" "$export_symbols" > "${export_symbols}T"'
7862 func_show_eval '$MV "${export_symbols}T" "$export_symbols"'
7863 fi
7864 fi
7865 fi
7866
7867 if test -n "$export_symbols" && test -n "$include_expsyms"; then
7868 tmp_export_symbols="$export_symbols"
7869 test -n "$orig_export_symbols" && tmp_export_symbols="$orig_export_symbols"
cristyfd9dcd42010-08-08 18:07:02 +00007870 $opt_dry_run || eval '$ECHO "$include_expsyms" | $SP2NL >> "$tmp_export_symbols"'
cristy3ed852e2009-09-05 21:47:34 +00007871 fi
7872
7873 if test "X$skipped_export" != "X:" && test -n "$orig_export_symbols"; then
7874 # The given exports_symbols file has to be filtered, so filter it.
7875 func_verbose "filter symbol list for \`$libname.la' to tag DATA exports"
7876 # FIXME: $output_objdir/$libname.filter potentially contains lots of
7877 # 's' commands which not all seds can handle. GNU sed should be fine
7878 # though. Also, the filter scales superlinearly with the number of
7879 # global variables. join(1) would be nice here, but unfortunately
7880 # isn't a blessed tool.
7881 $opt_dry_run || $SED -e '/[ ,]DATA/!d;s,\(.*\)\([ \,].*\),s|^\1$|\1\2|,' < $export_symbols > $output_objdir/$libname.filter
7882 delfiles="$delfiles $export_symbols $output_objdir/$libname.filter"
7883 export_symbols=$output_objdir/$libname.def
7884 $opt_dry_run || $SED -f $output_objdir/$libname.filter < $orig_export_symbols > $export_symbols
7885 fi
7886
7887 tmp_deplibs=
7888 for test_deplib in $deplibs; do
7889 case " $convenience " in
7890 *" $test_deplib "*) ;;
7891 *)
7892 tmp_deplibs="$tmp_deplibs $test_deplib"
7893 ;;
7894 esac
7895 done
7896 deplibs="$tmp_deplibs"
7897
7898 if test -n "$convenience"; then
7899 if test -n "$whole_archive_flag_spec" &&
7900 test "$compiler_needs_object" = yes &&
7901 test -z "$libobjs"; then
7902 # extract the archives, so we have objects to list.
7903 # TODO: could optimize this to just extract one archive.
7904 whole_archive_flag_spec=
7905 fi
7906 if test -n "$whole_archive_flag_spec"; then
7907 save_libobjs=$libobjs
7908 eval libobjs=\"\$libobjs $whole_archive_flag_spec\"
7909 test "X$libobjs" = "X " && libobjs=
7910 else
7911 gentop="$output_objdir/${outputname}x"
7912 generated="$generated $gentop"
7913
7914 func_extract_archives $gentop $convenience
7915 libobjs="$libobjs $func_extract_archives_result"
7916 test "X$libobjs" = "X " && libobjs=
7917 fi
7918 fi
7919
7920 if test "$thread_safe" = yes && test -n "$thread_safe_flag_spec"; then
7921 eval flag=\"$thread_safe_flag_spec\"
7922 linker_flags="$linker_flags $flag"
7923 fi
7924
7925 # Make a backup of the uninstalled library when relinking
7926 if test "$mode" = relink; then
7927 $opt_dry_run || eval '(cd $output_objdir && $RM ${realname}U && $MV $realname ${realname}U)' || exit $?
7928 fi
7929
7930 # Do each of the archive commands.
7931 if test "$module" = yes && test -n "$module_cmds" ; then
7932 if test -n "$export_symbols" && test -n "$module_expsym_cmds"; then
7933 eval test_cmds=\"$module_expsym_cmds\"
7934 cmds=$module_expsym_cmds
7935 else
7936 eval test_cmds=\"$module_cmds\"
7937 cmds=$module_cmds
7938 fi
7939 else
7940 if test -n "$export_symbols" && test -n "$archive_expsym_cmds"; then
7941 eval test_cmds=\"$archive_expsym_cmds\"
7942 cmds=$archive_expsym_cmds
7943 else
7944 eval test_cmds=\"$archive_cmds\"
7945 cmds=$archive_cmds
7946 fi
7947 fi
7948
7949 if test "X$skipped_export" != "X:" &&
7950 func_len " $test_cmds" &&
7951 len=$func_len_result &&
7952 test "$len" -lt "$max_cmd_len" || test "$max_cmd_len" -le -1; then
7953 :
7954 else
7955 # The command line is too long to link in one step, link piecewise
7956 # or, if using GNU ld and skipped_export is not :, use a linker
7957 # script.
7958
7959 # Save the value of $output and $libobjs because we want to
7960 # use them later. If we have whole_archive_flag_spec, we
7961 # want to use save_libobjs as it was before
7962 # whole_archive_flag_spec was expanded, because we can't
7963 # assume the linker understands whole_archive_flag_spec.
7964 # This may have to be revisited, in case too many
7965 # convenience libraries get linked in and end up exceeding
7966 # the spec.
7967 if test -z "$convenience" || test -z "$whole_archive_flag_spec"; then
7968 save_libobjs=$libobjs
7969 fi
7970 save_output=$output
cristyfd9dcd42010-08-08 18:07:02 +00007971 func_basename "$output"
7972 output_la=$func_basename_result
cristy3ed852e2009-09-05 21:47:34 +00007973
7974 # Clear the reloadable object creation command queue and
7975 # initialize k to one.
7976 test_cmds=
7977 concat_cmds=
7978 objlist=
7979 last_robj=
7980 k=1
7981
7982 if test -n "$save_libobjs" && test "X$skipped_export" != "X:" && test "$with_gnu_ld" = yes; then
7983 output=${output_objdir}/${output_la}.lnkscript
7984 func_verbose "creating GNU ld script: $output"
cristyfd9dcd42010-08-08 18:07:02 +00007985 echo 'INPUT (' > $output
cristy3ed852e2009-09-05 21:47:34 +00007986 for obj in $save_libobjs
7987 do
7988 $ECHO "$obj" >> $output
7989 done
cristyfd9dcd42010-08-08 18:07:02 +00007990 echo ')' >> $output
cristy3ed852e2009-09-05 21:47:34 +00007991 delfiles="$delfiles $output"
7992 elif test -n "$save_libobjs" && test "X$skipped_export" != "X:" && test "X$file_list_spec" != X; then
7993 output=${output_objdir}/${output_la}.lnk
7994 func_verbose "creating linker input file list: $output"
7995 : > $output
7996 set x $save_libobjs
7997 shift
7998 firstobj=
7999 if test "$compiler_needs_object" = yes; then
8000 firstobj="$1 "
8001 shift
8002 fi
8003 for obj
8004 do
8005 $ECHO "$obj" >> $output
8006 done
8007 delfiles="$delfiles $output"
8008 output=$firstobj\"$file_list_spec$output\"
8009 else
8010 if test -n "$save_libobjs"; then
8011 func_verbose "creating reloadable object files..."
8012 output=$output_objdir/$output_la-${k}.$objext
8013 eval test_cmds=\"$reload_cmds\"
8014 func_len " $test_cmds"
8015 len0=$func_len_result
8016 len=$len0
8017
8018 # Loop over the list of objects to be linked.
8019 for obj in $save_libobjs
8020 do
8021 func_len " $obj"
8022 func_arith $len + $func_len_result
8023 len=$func_arith_result
8024 if test "X$objlist" = X ||
8025 test "$len" -lt "$max_cmd_len"; then
8026 func_append objlist " $obj"
8027 else
8028 # The command $test_cmds is almost too long, add a
8029 # command to the queue.
8030 if test "$k" -eq 1 ; then
8031 # The first file doesn't have a previous command to add.
cristyfd9dcd42010-08-08 18:07:02 +00008032 reload_objs=$objlist
8033 eval concat_cmds=\"$reload_cmds\"
cristy3ed852e2009-09-05 21:47:34 +00008034 else
8035 # All subsequent reloadable object files will link in
8036 # the last one created.
cristyfd9dcd42010-08-08 18:07:02 +00008037 reload_objs="$objlist $last_robj"
8038 eval concat_cmds=\"\$concat_cmds~$reload_cmds~\$RM $last_robj\"
cristy3ed852e2009-09-05 21:47:34 +00008039 fi
8040 last_robj=$output_objdir/$output_la-${k}.$objext
8041 func_arith $k + 1
8042 k=$func_arith_result
8043 output=$output_objdir/$output_la-${k}.$objext
cristyfd9dcd42010-08-08 18:07:02 +00008044 objlist=" $obj"
cristy3ed852e2009-09-05 21:47:34 +00008045 func_len " $last_robj"
8046 func_arith $len0 + $func_len_result
8047 len=$func_arith_result
8048 fi
8049 done
8050 # Handle the remaining objects by creating one last
8051 # reloadable object file. All subsequent reloadable object
8052 # files will link in the last one created.
8053 test -z "$concat_cmds" || concat_cmds=$concat_cmds~
cristyfd9dcd42010-08-08 18:07:02 +00008054 reload_objs="$objlist $last_robj"
8055 eval concat_cmds=\"\${concat_cmds}$reload_cmds\"
cristy3ed852e2009-09-05 21:47:34 +00008056 if test -n "$last_robj"; then
8057 eval concat_cmds=\"\${concat_cmds}~\$RM $last_robj\"
8058 fi
8059 delfiles="$delfiles $output"
8060
8061 else
8062 output=
8063 fi
8064
8065 if ${skipped_export-false}; then
8066 func_verbose "generating symbol list for \`$libname.la'"
8067 export_symbols="$output_objdir/$libname.exp"
8068 $opt_dry_run || $RM $export_symbols
8069 libobjs=$output
8070 # Append the command to create the export file.
8071 test -z "$concat_cmds" || concat_cmds=$concat_cmds~
8072 eval concat_cmds=\"\$concat_cmds$export_symbols_cmds\"
8073 if test -n "$last_robj"; then
8074 eval concat_cmds=\"\$concat_cmds~\$RM $last_robj\"
8075 fi
8076 fi
8077
8078 test -n "$save_libobjs" &&
8079 func_verbose "creating a temporary reloadable object file: $output"
8080
8081 # Loop through the commands generated above and execute them.
8082 save_ifs="$IFS"; IFS='~'
8083 for cmd in $concat_cmds; do
8084 IFS="$save_ifs"
8085 $opt_silent || {
8086 func_quote_for_expand "$cmd"
8087 eval "func_echo $func_quote_for_expand_result"
8088 }
8089 $opt_dry_run || eval "$cmd" || {
8090 lt_exit=$?
8091
8092 # Restore the uninstalled library and exit
8093 if test "$mode" = relink; then
8094 ( cd "$output_objdir" && \
8095 $RM "${realname}T" && \
8096 $MV "${realname}U" "$realname" )
8097 fi
8098
8099 exit $lt_exit
8100 }
8101 done
8102 IFS="$save_ifs"
8103
8104 if test -n "$export_symbols_regex" && ${skipped_export-false}; then
8105 func_show_eval '$EGREP -e "$export_symbols_regex" "$export_symbols" > "${export_symbols}T"'
8106 func_show_eval '$MV "${export_symbols}T" "$export_symbols"'
8107 fi
8108 fi
8109
8110 if ${skipped_export-false}; then
8111 if test -n "$export_symbols" && test -n "$include_expsyms"; then
8112 tmp_export_symbols="$export_symbols"
8113 test -n "$orig_export_symbols" && tmp_export_symbols="$orig_export_symbols"
cristyfd9dcd42010-08-08 18:07:02 +00008114 $opt_dry_run || eval '$ECHO "$include_expsyms" | $SP2NL >> "$tmp_export_symbols"'
cristy3ed852e2009-09-05 21:47:34 +00008115 fi
8116
8117 if test -n "$orig_export_symbols"; then
8118 # The given exports_symbols file has to be filtered, so filter it.
8119 func_verbose "filter symbol list for \`$libname.la' to tag DATA exports"
8120 # FIXME: $output_objdir/$libname.filter potentially contains lots of
8121 # 's' commands which not all seds can handle. GNU sed should be fine
8122 # though. Also, the filter scales superlinearly with the number of
8123 # global variables. join(1) would be nice here, but unfortunately
8124 # isn't a blessed tool.
8125 $opt_dry_run || $SED -e '/[ ,]DATA/!d;s,\(.*\)\([ \,].*\),s|^\1$|\1\2|,' < $export_symbols > $output_objdir/$libname.filter
8126 delfiles="$delfiles $export_symbols $output_objdir/$libname.filter"
8127 export_symbols=$output_objdir/$libname.def
8128 $opt_dry_run || $SED -f $output_objdir/$libname.filter < $orig_export_symbols > $export_symbols
8129 fi
8130 fi
8131
8132 libobjs=$output
8133 # Restore the value of output.
8134 output=$save_output
8135
8136 if test -n "$convenience" && test -n "$whole_archive_flag_spec"; then
8137 eval libobjs=\"\$libobjs $whole_archive_flag_spec\"
8138 test "X$libobjs" = "X " && libobjs=
8139 fi
8140 # Expand the library linking commands again to reset the
8141 # value of $libobjs for piecewise linking.
8142
8143 # Do each of the archive commands.
8144 if test "$module" = yes && test -n "$module_cmds" ; then
8145 if test -n "$export_symbols" && test -n "$module_expsym_cmds"; then
8146 cmds=$module_expsym_cmds
8147 else
8148 cmds=$module_cmds
8149 fi
8150 else
8151 if test -n "$export_symbols" && test -n "$archive_expsym_cmds"; then
8152 cmds=$archive_expsym_cmds
8153 else
8154 cmds=$archive_cmds
8155 fi
8156 fi
8157 fi
8158
8159 if test -n "$delfiles"; then
8160 # Append the command to remove temporary files to $cmds.
8161 eval cmds=\"\$cmds~\$RM $delfiles\"
8162 fi
8163
8164 # Add any objects from preloaded convenience libraries
8165 if test -n "$dlprefiles"; then
8166 gentop="$output_objdir/${outputname}x"
8167 generated="$generated $gentop"
8168
8169 func_extract_archives $gentop $dlprefiles
8170 libobjs="$libobjs $func_extract_archives_result"
8171 test "X$libobjs" = "X " && libobjs=
8172 fi
8173
8174 save_ifs="$IFS"; IFS='~'
8175 for cmd in $cmds; do
8176 IFS="$save_ifs"
8177 eval cmd=\"$cmd\"
8178 $opt_silent || {
8179 func_quote_for_expand "$cmd"
8180 eval "func_echo $func_quote_for_expand_result"
8181 }
8182 $opt_dry_run || eval "$cmd" || {
8183 lt_exit=$?
8184
8185 # Restore the uninstalled library and exit
8186 if test "$mode" = relink; then
8187 ( cd "$output_objdir" && \
8188 $RM "${realname}T" && \
8189 $MV "${realname}U" "$realname" )
8190 fi
8191
8192 exit $lt_exit
8193 }
8194 done
8195 IFS="$save_ifs"
8196
8197 # Restore the uninstalled library and exit
8198 if test "$mode" = relink; then
8199 $opt_dry_run || eval '(cd $output_objdir && $RM ${realname}T && $MV $realname ${realname}T && $MV ${realname}U $realname)' || exit $?
8200
8201 if test -n "$convenience"; then
8202 if test -z "$whole_archive_flag_spec"; then
8203 func_show_eval '${RM}r "$gentop"'
8204 fi
8205 fi
8206
8207 exit $EXIT_SUCCESS
8208 fi
8209
8210 # Create links to the real library.
8211 for linkname in $linknames; do
8212 if test "$realname" != "$linkname"; then
8213 func_show_eval '(cd "$output_objdir" && $RM "$linkname" && $LN_S "$realname" "$linkname")' 'exit $?'
8214 fi
8215 done
8216
8217 # If -module or -export-dynamic was specified, set the dlname.
8218 if test "$module" = yes || test "$export_dynamic" = yes; then
8219 # On all known operating systems, these are identical.
8220 dlname="$soname"
8221 fi
8222 fi
8223 ;;
8224
8225 obj)
8226 if test -n "$dlfiles$dlprefiles" || test "$dlself" != no; then
8227 func_warning "\`-dlopen' is ignored for objects"
8228 fi
8229
8230 case " $deplibs" in
8231 *\ -l* | *\ -L*)
8232 func_warning "\`-l' and \`-L' are ignored for objects" ;;
8233 esac
8234
8235 test -n "$rpath" && \
8236 func_warning "\`-rpath' is ignored for objects"
8237
8238 test -n "$xrpath" && \
8239 func_warning "\`-R' is ignored for objects"
8240
8241 test -n "$vinfo" && \
8242 func_warning "\`-version-info' is ignored for objects"
8243
8244 test -n "$release" && \
8245 func_warning "\`-release' is ignored for objects"
8246
8247 case $output in
8248 *.lo)
8249 test -n "$objs$old_deplibs" && \
8250 func_fatal_error "cannot build library object \`$output' from non-libtool objects"
8251
8252 libobj=$output
8253 func_lo2o "$libobj"
8254 obj=$func_lo2o_result
8255 ;;
8256 *)
8257 libobj=
8258 obj="$output"
8259 ;;
8260 esac
8261
8262 # Delete the old objects.
8263 $opt_dry_run || $RM $obj $libobj
8264
8265 # Objects from convenience libraries. This assumes
8266 # single-version convenience libraries. Whenever we create
8267 # different ones for PIC/non-PIC, this we'll have to duplicate
8268 # the extraction.
8269 reload_conv_objs=
8270 gentop=
8271 # reload_cmds runs $LD directly, so let us get rid of
8272 # -Wl from whole_archive_flag_spec and hope we can get by with
8273 # turning comma into space..
8274 wl=
8275
8276 if test -n "$convenience"; then
8277 if test -n "$whole_archive_flag_spec"; then
8278 eval tmp_whole_archive_flags=\"$whole_archive_flag_spec\"
cristyfd9dcd42010-08-08 18:07:02 +00008279 reload_conv_objs=$reload_objs\ `$ECHO "$tmp_whole_archive_flags" | $SED 's|,| |g'`
cristy3ed852e2009-09-05 21:47:34 +00008280 else
8281 gentop="$output_objdir/${obj}x"
8282 generated="$generated $gentop"
8283
8284 func_extract_archives $gentop $convenience
8285 reload_conv_objs="$reload_objs $func_extract_archives_result"
8286 fi
8287 fi
8288
8289 # Create the old-style object.
cristyfd9dcd42010-08-08 18:07:02 +00008290 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 +00008291
8292 output="$obj"
8293 func_execute_cmds "$reload_cmds" 'exit $?'
8294
8295 # Exit if we aren't doing a library object file.
8296 if test -z "$libobj"; then
8297 if test -n "$gentop"; then
8298 func_show_eval '${RM}r "$gentop"'
8299 fi
8300
8301 exit $EXIT_SUCCESS
8302 fi
8303
8304 if test "$build_libtool_libs" != yes; then
8305 if test -n "$gentop"; then
8306 func_show_eval '${RM}r "$gentop"'
8307 fi
8308
8309 # Create an invalid libtool object if no PIC, so that we don't
8310 # accidentally link it into a program.
8311 # $show "echo timestamp > $libobj"
8312 # $opt_dry_run || eval "echo timestamp > $libobj" || exit $?
8313 exit $EXIT_SUCCESS
8314 fi
8315
8316 if test -n "$pic_flag" || test "$pic_mode" != default; then
8317 # Only do commands if we really have different PIC objects.
8318 reload_objs="$libobjs $reload_conv_objs"
8319 output="$libobj"
8320 func_execute_cmds "$reload_cmds" 'exit $?'
8321 fi
8322
8323 if test -n "$gentop"; then
8324 func_show_eval '${RM}r "$gentop"'
8325 fi
8326
8327 exit $EXIT_SUCCESS
8328 ;;
8329
8330 prog)
8331 case $host in
8332 *cygwin*) func_stripname '' '.exe' "$output"
8333 output=$func_stripname_result.exe;;
8334 esac
8335 test -n "$vinfo" && \
8336 func_warning "\`-version-info' is ignored for programs"
8337
8338 test -n "$release" && \
8339 func_warning "\`-release' is ignored for programs"
8340
8341 test "$preload" = yes \
8342 && test "$dlopen_support" = unknown \
8343 && test "$dlopen_self" = unknown \
8344 && test "$dlopen_self_static" = unknown && \
8345 func_warning "\`LT_INIT([dlopen])' not used. Assuming no dlopen support."
8346
8347 case $host in
8348 *-*-rhapsody* | *-*-darwin1.[012])
8349 # On Rhapsody replace the C library is the System framework
cristyfd9dcd42010-08-08 18:07:02 +00008350 compile_deplibs=`$ECHO " $compile_deplibs" | $SED 's/ -lc / System.ltframework /'`
8351 finalize_deplibs=`$ECHO " $finalize_deplibs" | $SED 's/ -lc / System.ltframework /'`
cristy3ed852e2009-09-05 21:47:34 +00008352 ;;
8353 esac
8354
8355 case $host in
8356 *-*-darwin*)
8357 # Don't allow lazy linking, it breaks C++ global constructors
8358 # But is supposedly fixed on 10.4 or later (yay!).
8359 if test "$tagname" = CXX ; then
8360 case ${MACOSX_DEPLOYMENT_TARGET-10.0} in
8361 10.[0123])
8362 compile_command="$compile_command ${wl}-bind_at_load"
8363 finalize_command="$finalize_command ${wl}-bind_at_load"
8364 ;;
8365 esac
8366 fi
8367 # Time to change all our "foo.ltframework" stuff back to "-framework foo"
cristyfd9dcd42010-08-08 18:07:02 +00008368 compile_deplibs=`$ECHO " $compile_deplibs" | $SED 's% \([^ $]*\).ltframework% -framework \1%g'`
8369 finalize_deplibs=`$ECHO " $finalize_deplibs" | $SED 's% \([^ $]*\).ltframework% -framework \1%g'`
cristy3ed852e2009-09-05 21:47:34 +00008370 ;;
8371 esac
8372
8373
8374 # move library search paths that coincide with paths to not yet
8375 # installed libraries to the beginning of the library search list
8376 new_libs=
8377 for path in $notinst_path; do
8378 case " $new_libs " in
8379 *" -L$path/$objdir "*) ;;
8380 *)
8381 case " $compile_deplibs " in
8382 *" -L$path/$objdir "*)
8383 new_libs="$new_libs -L$path/$objdir" ;;
8384 esac
8385 ;;
8386 esac
8387 done
8388 for deplib in $compile_deplibs; do
8389 case $deplib in
8390 -L*)
8391 case " $new_libs " in
8392 *" $deplib "*) ;;
8393 *) new_libs="$new_libs $deplib" ;;
8394 esac
8395 ;;
8396 *) new_libs="$new_libs $deplib" ;;
8397 esac
8398 done
8399 compile_deplibs="$new_libs"
8400
8401
8402 compile_command="$compile_command $compile_deplibs"
8403 finalize_command="$finalize_command $finalize_deplibs"
8404
8405 if test -n "$rpath$xrpath"; then
8406 # If the user specified any rpath flags, then add them.
8407 for libdir in $rpath $xrpath; do
8408 # This is the magic to use -rpath.
8409 case "$finalize_rpath " in
8410 *" $libdir "*) ;;
8411 *) finalize_rpath="$finalize_rpath $libdir" ;;
8412 esac
8413 done
8414 fi
8415
8416 # Now hardcode the library paths
8417 rpath=
8418 hardcode_libdirs=
8419 for libdir in $compile_rpath $finalize_rpath; do
8420 if test -n "$hardcode_libdir_flag_spec"; then
8421 if test -n "$hardcode_libdir_separator"; then
8422 if test -z "$hardcode_libdirs"; then
8423 hardcode_libdirs="$libdir"
8424 else
8425 # Just accumulate the unique libdirs.
8426 case $hardcode_libdir_separator$hardcode_libdirs$hardcode_libdir_separator in
8427 *"$hardcode_libdir_separator$libdir$hardcode_libdir_separator"*)
8428 ;;
8429 *)
8430 hardcode_libdirs="$hardcode_libdirs$hardcode_libdir_separator$libdir"
8431 ;;
8432 esac
8433 fi
8434 else
8435 eval flag=\"$hardcode_libdir_flag_spec\"
8436 rpath="$rpath $flag"
8437 fi
8438 elif test -n "$runpath_var"; then
8439 case "$perm_rpath " in
8440 *" $libdir "*) ;;
8441 *) perm_rpath="$perm_rpath $libdir" ;;
8442 esac
8443 fi
8444 case $host in
8445 *-*-cygwin* | *-*-mingw* | *-*-pw32* | *-*-os2* | *-cegcc*)
8446 testbindir=`${ECHO} "$libdir" | ${SED} -e 's*/lib$*/bin*'`
8447 case :$dllsearchpath: in
8448 *":$libdir:"*) ;;
8449 ::) dllsearchpath=$libdir;;
8450 *) dllsearchpath="$dllsearchpath:$libdir";;
8451 esac
8452 case :$dllsearchpath: in
8453 *":$testbindir:"*) ;;
8454 ::) dllsearchpath=$testbindir;;
8455 *) dllsearchpath="$dllsearchpath:$testbindir";;
8456 esac
8457 ;;
8458 esac
8459 done
8460 # Substitute the hardcoded libdirs into the rpath.
8461 if test -n "$hardcode_libdir_separator" &&
8462 test -n "$hardcode_libdirs"; then
8463 libdir="$hardcode_libdirs"
8464 eval rpath=\" $hardcode_libdir_flag_spec\"
8465 fi
8466 compile_rpath="$rpath"
8467
8468 rpath=
8469 hardcode_libdirs=
8470 for libdir in $finalize_rpath; do
8471 if test -n "$hardcode_libdir_flag_spec"; then
8472 if test -n "$hardcode_libdir_separator"; then
8473 if test -z "$hardcode_libdirs"; then
8474 hardcode_libdirs="$libdir"
8475 else
8476 # Just accumulate the unique libdirs.
8477 case $hardcode_libdir_separator$hardcode_libdirs$hardcode_libdir_separator in
8478 *"$hardcode_libdir_separator$libdir$hardcode_libdir_separator"*)
8479 ;;
8480 *)
8481 hardcode_libdirs="$hardcode_libdirs$hardcode_libdir_separator$libdir"
8482 ;;
8483 esac
8484 fi
8485 else
8486 eval flag=\"$hardcode_libdir_flag_spec\"
8487 rpath="$rpath $flag"
8488 fi
8489 elif test -n "$runpath_var"; then
8490 case "$finalize_perm_rpath " in
8491 *" $libdir "*) ;;
8492 *) finalize_perm_rpath="$finalize_perm_rpath $libdir" ;;
8493 esac
8494 fi
8495 done
8496 # Substitute the hardcoded libdirs into the rpath.
8497 if test -n "$hardcode_libdir_separator" &&
8498 test -n "$hardcode_libdirs"; then
8499 libdir="$hardcode_libdirs"
8500 eval rpath=\" $hardcode_libdir_flag_spec\"
8501 fi
8502 finalize_rpath="$rpath"
8503
8504 if test -n "$libobjs" && test "$build_old_libs" = yes; then
8505 # Transform all the library objects into standard objects.
cristyfd9dcd42010-08-08 18:07:02 +00008506 compile_command=`$ECHO "$compile_command" | $SP2NL | $SED "$lo2o" | $NL2SP`
8507 finalize_command=`$ECHO "$finalize_command" | $SP2NL | $SED "$lo2o" | $NL2SP`
cristy3ed852e2009-09-05 21:47:34 +00008508 fi
8509
8510 func_generate_dlsyms "$outputname" "@PROGRAM@" "no"
8511
8512 # template prelinking step
8513 if test -n "$prelink_cmds"; then
8514 func_execute_cmds "$prelink_cmds" 'exit $?'
8515 fi
8516
8517 wrappers_required=yes
8518 case $host in
cristyfd9dcd42010-08-08 18:07:02 +00008519 *cegcc* | *mingw32ce*)
8520 # Disable wrappers for cegcc and mingw32ce hosts, we are cross compiling anyway.
8521 wrappers_required=no
8522 ;;
cristy3ed852e2009-09-05 21:47:34 +00008523 *cygwin* | *mingw* )
8524 if test "$build_libtool_libs" != yes; then
8525 wrappers_required=no
8526 fi
8527 ;;
cristy3ed852e2009-09-05 21:47:34 +00008528 *)
8529 if test "$need_relink" = no || test "$build_libtool_libs" != yes; then
8530 wrappers_required=no
8531 fi
8532 ;;
8533 esac
8534 if test "$wrappers_required" = no; then
8535 # Replace the output file specification.
cristyfd9dcd42010-08-08 18:07:02 +00008536 compile_command=`$ECHO "$compile_command" | $SED 's%@OUTPUT@%'"$output"'%g'`
cristy3ed852e2009-09-05 21:47:34 +00008537 link_command="$compile_command$compile_rpath"
8538
8539 # We have no uninstalled library dependencies, so finalize right now.
8540 exit_status=0
8541 func_show_eval "$link_command" 'exit_status=$?'
8542
8543 # Delete the generated files.
8544 if test -f "$output_objdir/${outputname}S.${objext}"; then
8545 func_show_eval '$RM "$output_objdir/${outputname}S.${objext}"'
8546 fi
8547
8548 exit $exit_status
8549 fi
8550
8551 if test -n "$compile_shlibpath$finalize_shlibpath"; then
8552 compile_command="$shlibpath_var=\"$compile_shlibpath$finalize_shlibpath\$$shlibpath_var\" $compile_command"
8553 fi
8554 if test -n "$finalize_shlibpath"; then
8555 finalize_command="$shlibpath_var=\"$finalize_shlibpath\$$shlibpath_var\" $finalize_command"
8556 fi
8557
8558 compile_var=
8559 finalize_var=
8560 if test -n "$runpath_var"; then
8561 if test -n "$perm_rpath"; then
8562 # We should set the runpath_var.
8563 rpath=
8564 for dir in $perm_rpath; do
8565 rpath="$rpath$dir:"
8566 done
8567 compile_var="$runpath_var=\"$rpath\$$runpath_var\" "
8568 fi
8569 if test -n "$finalize_perm_rpath"; then
8570 # We should set the runpath_var.
8571 rpath=
8572 for dir in $finalize_perm_rpath; do
8573 rpath="$rpath$dir:"
8574 done
8575 finalize_var="$runpath_var=\"$rpath\$$runpath_var\" "
8576 fi
8577 fi
8578
8579 if test "$no_install" = yes; then
8580 # We don't need to create a wrapper script.
8581 link_command="$compile_var$compile_command$compile_rpath"
8582 # Replace the output file specification.
cristyfd9dcd42010-08-08 18:07:02 +00008583 link_command=`$ECHO "$link_command" | $SED 's%@OUTPUT@%'"$output"'%g'`
cristy3ed852e2009-09-05 21:47:34 +00008584 # Delete the old output file.
8585 $opt_dry_run || $RM $output
8586 # Link the executable and exit
8587 func_show_eval "$link_command" 'exit $?'
8588 exit $EXIT_SUCCESS
8589 fi
8590
8591 if test "$hardcode_action" = relink; then
8592 # Fast installation is not supported
8593 link_command="$compile_var$compile_command$compile_rpath"
8594 relink_command="$finalize_var$finalize_command$finalize_rpath"
8595
8596 func_warning "this platform does not like uninstalled shared libraries"
8597 func_warning "\`$output' will be relinked during installation"
8598 else
8599 if test "$fast_install" != no; then
8600 link_command="$finalize_var$compile_command$finalize_rpath"
8601 if test "$fast_install" = yes; then
cristyfd9dcd42010-08-08 18:07:02 +00008602 relink_command=`$ECHO "$compile_var$compile_command$compile_rpath" | $SED 's%@OUTPUT@%\$progdir/\$file%g'`
cristy3ed852e2009-09-05 21:47:34 +00008603 else
8604 # fast_install is set to needless
8605 relink_command=
8606 fi
8607 else
8608 link_command="$compile_var$compile_command$compile_rpath"
8609 relink_command="$finalize_var$finalize_command$finalize_rpath"
8610 fi
8611 fi
8612
8613 # Replace the output file specification.
cristyfd9dcd42010-08-08 18:07:02 +00008614 link_command=`$ECHO "$link_command" | $SED 's%@OUTPUT@%'"$output_objdir/$outputname"'%g'`
cristy3ed852e2009-09-05 21:47:34 +00008615
8616 # Delete the old output files.
8617 $opt_dry_run || $RM $output $output_objdir/$outputname $output_objdir/lt-$outputname
8618
8619 func_show_eval "$link_command" 'exit $?'
8620
8621 # Now create the wrapper script.
8622 func_verbose "creating $output"
8623
8624 # Quote the relink command for shipping.
8625 if test -n "$relink_command"; then
8626 # Preserve any variables that may affect compiler behavior
8627 for var in $variables_saved_for_relink; do
8628 if eval test -z \"\${$var+set}\"; then
8629 relink_command="{ test -z \"\${$var+set}\" || $lt_unset $var || { $var=; export $var; }; }; $relink_command"
8630 elif eval var_value=\$$var; test -z "$var_value"; then
8631 relink_command="$var=; export $var; $relink_command"
8632 else
8633 func_quote_for_eval "$var_value"
8634 relink_command="$var=$func_quote_for_eval_result; export $var; $relink_command"
8635 fi
8636 done
8637 relink_command="(cd `pwd`; $relink_command)"
cristyfd9dcd42010-08-08 18:07:02 +00008638 relink_command=`$ECHO "$relink_command" | $SED "$sed_quote_subst"`
cristy3ed852e2009-09-05 21:47:34 +00008639 fi
8640
8641 # Only actually do things if not in dry run mode.
8642 $opt_dry_run || {
8643 # win32 will think the script is a binary if it has
8644 # a .exe suffix, so we strip it off here.
8645 case $output in
8646 *.exe) func_stripname '' '.exe' "$output"
8647 output=$func_stripname_result ;;
8648 esac
8649 # test for cygwin because mv fails w/o .exe extensions
8650 case $host in
8651 *cygwin*)
8652 exeext=.exe
8653 func_stripname '' '.exe' "$outputname"
8654 outputname=$func_stripname_result ;;
8655 *) exeext= ;;
8656 esac
8657 case $host in
8658 *cygwin* | *mingw* )
8659 func_dirname_and_basename "$output" "" "."
8660 output_name=$func_basename_result
8661 output_path=$func_dirname_result
8662 cwrappersource="$output_path/$objdir/lt-$output_name.c"
8663 cwrapper="$output_path/$output_name.exe"
8664 $RM $cwrappersource $cwrapper
8665 trap "$RM $cwrappersource $cwrapper; exit $EXIT_FAILURE" 1 2 15
8666
8667 func_emit_cwrapperexe_src > $cwrappersource
8668
8669 # The wrapper executable is built using the $host compiler,
8670 # because it contains $host paths and files. If cross-
8671 # compiling, it, like the target executable, must be
8672 # executed on the $host or under an emulation environment.
8673 $opt_dry_run || {
8674 $LTCC $LTCFLAGS -o $cwrapper $cwrappersource
8675 $STRIP $cwrapper
8676 }
8677
8678 # Now, create the wrapper script for func_source use:
8679 func_ltwrapper_scriptname $cwrapper
8680 $RM $func_ltwrapper_scriptname_result
8681 trap "$RM $func_ltwrapper_scriptname_result; exit $EXIT_FAILURE" 1 2 15
8682 $opt_dry_run || {
8683 # note: this script will not be executed, so do not chmod.
8684 if test "x$build" = "x$host" ; then
8685 $cwrapper --lt-dump-script > $func_ltwrapper_scriptname_result
8686 else
8687 func_emit_wrapper no > $func_ltwrapper_scriptname_result
8688 fi
8689 }
8690 ;;
8691 * )
8692 $RM $output
8693 trap "$RM $output; exit $EXIT_FAILURE" 1 2 15
8694
8695 func_emit_wrapper no > $output
8696 chmod +x $output
8697 ;;
8698 esac
8699 }
8700 exit $EXIT_SUCCESS
8701 ;;
8702 esac
8703
8704 # See if we need to build an old-fashioned archive.
8705 for oldlib in $oldlibs; do
8706
8707 if test "$build_libtool_libs" = convenience; then
8708 oldobjs="$libobjs_save $symfileobj"
8709 addlibs="$convenience"
8710 build_libtool_libs=no
8711 else
8712 if test "$build_libtool_libs" = module; then
8713 oldobjs="$libobjs_save"
8714 build_libtool_libs=no
8715 else
8716 oldobjs="$old_deplibs $non_pic_objects"
8717 if test "$preload" = yes && test -f "$symfileobj"; then
8718 oldobjs="$oldobjs $symfileobj"
8719 fi
8720 fi
8721 addlibs="$old_convenience"
8722 fi
8723
8724 if test -n "$addlibs"; then
8725 gentop="$output_objdir/${outputname}x"
8726 generated="$generated $gentop"
8727
8728 func_extract_archives $gentop $addlibs
8729 oldobjs="$oldobjs $func_extract_archives_result"
8730 fi
8731
8732 # Do each command in the archive commands.
8733 if test -n "$old_archive_from_new_cmds" && test "$build_libtool_libs" = yes; then
8734 cmds=$old_archive_from_new_cmds
8735 else
8736
8737 # Add any objects from preloaded convenience libraries
8738 if test -n "$dlprefiles"; then
8739 gentop="$output_objdir/${outputname}x"
8740 generated="$generated $gentop"
8741
8742 func_extract_archives $gentop $dlprefiles
8743 oldobjs="$oldobjs $func_extract_archives_result"
8744 fi
8745
8746 # POSIX demands no paths to be encoded in archives. We have
8747 # to avoid creating archives with duplicate basenames if we
8748 # might have to extract them afterwards, e.g., when creating a
8749 # static archive out of a convenience library, or when linking
8750 # the entirety of a libtool archive into another (currently
8751 # not supported by libtool).
8752 if (for obj in $oldobjs
8753 do
8754 func_basename "$obj"
8755 $ECHO "$func_basename_result"
8756 done | sort | sort -uc >/dev/null 2>&1); then
8757 :
8758 else
cristyfd9dcd42010-08-08 18:07:02 +00008759 echo "copying selected object files to avoid basename conflicts..."
cristy3ed852e2009-09-05 21:47:34 +00008760 gentop="$output_objdir/${outputname}x"
8761 generated="$generated $gentop"
8762 func_mkdir_p "$gentop"
8763 save_oldobjs=$oldobjs
8764 oldobjs=
8765 counter=1
8766 for obj in $save_oldobjs
8767 do
8768 func_basename "$obj"
8769 objbase="$func_basename_result"
8770 case " $oldobjs " in
8771 " ") oldobjs=$obj ;;
8772 *[\ /]"$objbase "*)
8773 while :; do
8774 # Make sure we don't pick an alternate name that also
8775 # overlaps.
8776 newobj=lt$counter-$objbase
8777 func_arith $counter + 1
8778 counter=$func_arith_result
8779 case " $oldobjs " in
8780 *[\ /]"$newobj "*) ;;
8781 *) if test ! -f "$gentop/$newobj"; then break; fi ;;
8782 esac
8783 done
8784 func_show_eval "ln $obj $gentop/$newobj || cp $obj $gentop/$newobj"
8785 oldobjs="$oldobjs $gentop/$newobj"
8786 ;;
8787 *) oldobjs="$oldobjs $obj" ;;
8788 esac
8789 done
8790 fi
8791 eval cmds=\"$old_archive_cmds\"
8792
8793 func_len " $cmds"
8794 len=$func_len_result
8795 if test "$len" -lt "$max_cmd_len" || test "$max_cmd_len" -le -1; then
8796 cmds=$old_archive_cmds
8797 else
8798 # the command line is too long to link in one step, link in parts
8799 func_verbose "using piecewise archive linking..."
8800 save_RANLIB=$RANLIB
8801 RANLIB=:
8802 objlist=
8803 concat_cmds=
8804 save_oldobjs=$oldobjs
8805 oldobjs=
8806 # Is there a better way of finding the last object in the list?
8807 for obj in $save_oldobjs
8808 do
8809 last_oldobj=$obj
8810 done
8811 eval test_cmds=\"$old_archive_cmds\"
8812 func_len " $test_cmds"
8813 len0=$func_len_result
8814 len=$len0
8815 for obj in $save_oldobjs
8816 do
8817 func_len " $obj"
8818 func_arith $len + $func_len_result
8819 len=$func_arith_result
8820 func_append objlist " $obj"
8821 if test "$len" -lt "$max_cmd_len"; then
8822 :
8823 else
8824 # the above command should be used before it gets too long
8825 oldobjs=$objlist
8826 if test "$obj" = "$last_oldobj" ; then
8827 RANLIB=$save_RANLIB
8828 fi
8829 test -z "$concat_cmds" || concat_cmds=$concat_cmds~
8830 eval concat_cmds=\"\${concat_cmds}$old_archive_cmds\"
8831 objlist=
8832 len=$len0
8833 fi
8834 done
8835 RANLIB=$save_RANLIB
8836 oldobjs=$objlist
8837 if test "X$oldobjs" = "X" ; then
8838 eval cmds=\"\$concat_cmds\"
8839 else
8840 eval cmds=\"\$concat_cmds~\$old_archive_cmds\"
8841 fi
8842 fi
8843 fi
8844 func_execute_cmds "$cmds" 'exit $?'
8845 done
8846
8847 test -n "$generated" && \
8848 func_show_eval "${RM}r$generated"
8849
8850 # Now create the libtool archive.
8851 case $output in
8852 *.la)
8853 old_library=
8854 test "$build_old_libs" = yes && old_library="$libname.$libext"
8855 func_verbose "creating $output"
8856
8857 # Preserve any variables that may affect compiler behavior
8858 for var in $variables_saved_for_relink; do
8859 if eval test -z \"\${$var+set}\"; then
8860 relink_command="{ test -z \"\${$var+set}\" || $lt_unset $var || { $var=; export $var; }; }; $relink_command"
8861 elif eval var_value=\$$var; test -z "$var_value"; then
8862 relink_command="$var=; export $var; $relink_command"
8863 else
8864 func_quote_for_eval "$var_value"
8865 relink_command="$var=$func_quote_for_eval_result; export $var; $relink_command"
8866 fi
8867 done
8868 # Quote the link command for shipping.
8869 relink_command="(cd `pwd`; $SHELL $progpath $preserve_args --mode=relink $libtool_args @inst_prefix_dir@)"
cristyfd9dcd42010-08-08 18:07:02 +00008870 relink_command=`$ECHO "$relink_command" | $SED "$sed_quote_subst"`
cristy3ed852e2009-09-05 21:47:34 +00008871 if test "$hardcode_automatic" = yes ; then
8872 relink_command=
8873 fi
8874
8875 # Only create the output if not a dry run.
8876 $opt_dry_run || {
8877 for installed in no yes; do
8878 if test "$installed" = yes; then
8879 if test -z "$install_libdir"; then
8880 break
8881 fi
8882 output="$output_objdir/$outputname"i
8883 # Replace all uninstalled libtool libraries with the installed ones
8884 newdependency_libs=
8885 for deplib in $dependency_libs; do
8886 case $deplib in
8887 *.la)
8888 func_basename "$deplib"
8889 name="$func_basename_result"
8890 eval libdir=`${SED} -n -e 's/^libdir=\(.*\)$/\1/p' $deplib`
8891 test -z "$libdir" && \
8892 func_fatal_error "\`$deplib' is not a valid libtool archive"
8893 newdependency_libs="$newdependency_libs $libdir/$name"
8894 ;;
8895 *) newdependency_libs="$newdependency_libs $deplib" ;;
8896 esac
8897 done
8898 dependency_libs="$newdependency_libs"
8899 newdlfiles=
8900
8901 for lib in $dlfiles; do
8902 case $lib in
8903 *.la)
8904 func_basename "$lib"
8905 name="$func_basename_result"
8906 eval libdir=`${SED} -n -e 's/^libdir=\(.*\)$/\1/p' $lib`
8907 test -z "$libdir" && \
8908 func_fatal_error "\`$lib' is not a valid libtool archive"
8909 newdlfiles="$newdlfiles $libdir/$name"
8910 ;;
8911 *) newdlfiles="$newdlfiles $lib" ;;
8912 esac
8913 done
8914 dlfiles="$newdlfiles"
8915 newdlprefiles=
8916 for lib in $dlprefiles; do
8917 case $lib in
8918 *.la)
8919 # Only pass preopened files to the pseudo-archive (for
8920 # eventual linking with the app. that links it) if we
8921 # didn't already link the preopened objects directly into
8922 # the library:
8923 func_basename "$lib"
8924 name="$func_basename_result"
8925 eval libdir=`${SED} -n -e 's/^libdir=\(.*\)$/\1/p' $lib`
8926 test -z "$libdir" && \
8927 func_fatal_error "\`$lib' is not a valid libtool archive"
8928 newdlprefiles="$newdlprefiles $libdir/$name"
8929 ;;
8930 esac
8931 done
8932 dlprefiles="$newdlprefiles"
8933 else
8934 newdlfiles=
8935 for lib in $dlfiles; do
8936 case $lib in
8937 [\\/]* | [A-Za-z]:[\\/]*) abs="$lib" ;;
8938 *) abs=`pwd`"/$lib" ;;
8939 esac
8940 newdlfiles="$newdlfiles $abs"
8941 done
8942 dlfiles="$newdlfiles"
8943 newdlprefiles=
8944 for lib in $dlprefiles; do
8945 case $lib in
8946 [\\/]* | [A-Za-z]:[\\/]*) abs="$lib" ;;
8947 *) abs=`pwd`"/$lib" ;;
8948 esac
8949 newdlprefiles="$newdlprefiles $abs"
8950 done
8951 dlprefiles="$newdlprefiles"
8952 fi
8953 $RM $output
8954 # place dlname in correct position for cygwin
cristyfd9dcd42010-08-08 18:07:02 +00008955 # In fact, it would be nice if we could use this code for all target
8956 # systems that can't hard-code library paths into their executables
8957 # and that have no shared library path variable independent of PATH,
8958 # but it turns out we can't easily determine that from inspecting
8959 # libtool variables, so we have to hard-code the OSs to which it
8960 # applies here; at the moment, that means platforms that use the PE
8961 # object format with DLL files. See the long comment at the top of
8962 # tests/bindir.at for full details.
cristy3ed852e2009-09-05 21:47:34 +00008963 tdlname=$dlname
8964 case $host,$output,$installed,$module,$dlname in
cristyfd9dcd42010-08-08 18:07:02 +00008965 *cygwin*,*lai,yes,no,*.dll | *mingw*,*lai,yes,no,*.dll | *cegcc*,*lai,yes,no,*.dll)
8966 # If a -bindir argument was supplied, place the dll there.
8967 if test "x$bindir" != x ;
8968 then
8969 func_relative_path "$install_libdir" "$bindir"
8970 tdlname=$func_relative_path_result$dlname
8971 else
8972 # Otherwise fall back on heuristic.
8973 tdlname=../bin/$dlname
8974 fi
8975 ;;
cristy3ed852e2009-09-05 21:47:34 +00008976 esac
8977 $ECHO > $output "\
8978# $outputname - a libtool library file
8979# Generated by $PROGRAM (GNU $PACKAGE$TIMESTAMP) $VERSION
8980#
8981# Please DO NOT delete this file!
8982# It is necessary for linking the library.
8983
8984# The name that we can dlopen(3).
8985dlname='$tdlname'
8986
8987# Names of this library.
8988library_names='$library_names'
8989
8990# The name of the static archive.
8991old_library='$old_library'
8992
8993# Linker flags that can not go in dependency_libs.
8994inherited_linker_flags='$new_inherited_linker_flags'
8995
8996# Libraries that this one depends upon.
8997dependency_libs='$dependency_libs'
8998
8999# Names of additional weak libraries provided by this library
9000weak_library_names='$weak_libs'
9001
9002# Version information for $libname.
9003current=$current
9004age=$age
9005revision=$revision
9006
9007# Is this an already installed library?
9008installed=$installed
9009
9010# Should we warn about portability when linking against -modules?
9011shouldnotlink=$module
9012
9013# Files to dlopen/dlpreopen
9014dlopen='$dlfiles'
9015dlpreopen='$dlprefiles'
9016
9017# Directory that this library needs to be installed in:
9018libdir='$install_libdir'"
9019 if test "$installed" = no && test "$need_relink" = yes; then
9020 $ECHO >> $output "\
9021relink_command=\"$relink_command\""
9022 fi
9023 done
9024 }
9025
9026 # Do a symbolic link so that the libtool archive can be found in
9027 # LD_LIBRARY_PATH before the program is installed.
9028 func_show_eval '( cd "$output_objdir" && $RM "$outputname" && $LN_S "../$outputname" "$outputname" )' 'exit $?'
9029 ;;
9030 esac
9031 exit $EXIT_SUCCESS
9032}
9033
9034{ test "$mode" = link || test "$mode" = relink; } &&
9035 func_mode_link ${1+"$@"}
9036
9037
9038# func_mode_uninstall arg...
9039func_mode_uninstall ()
9040{
9041 $opt_debug
9042 RM="$nonopt"
9043 files=
9044 rmforce=
9045 exit_status=0
9046
9047 # This variable tells wrapper scripts just to set variables rather
9048 # than running their programs.
9049 libtool_install_magic="$magic"
9050
9051 for arg
9052 do
9053 case $arg in
9054 -f) RM="$RM $arg"; rmforce=yes ;;
9055 -*) RM="$RM $arg" ;;
9056 *) files="$files $arg" ;;
9057 esac
9058 done
9059
9060 test -z "$RM" && \
9061 func_fatal_help "you must specify an RM program"
9062
9063 rmdirs=
9064
9065 origobjdir="$objdir"
9066 for file in $files; do
9067 func_dirname "$file" "" "."
9068 dir="$func_dirname_result"
9069 if test "X$dir" = X.; then
9070 objdir="$origobjdir"
9071 else
9072 objdir="$dir/$origobjdir"
9073 fi
9074 func_basename "$file"
9075 name="$func_basename_result"
9076 test "$mode" = uninstall && objdir="$dir"
9077
9078 # Remember objdir for removal later, being careful to avoid duplicates
9079 if test "$mode" = clean; then
9080 case " $rmdirs " in
9081 *" $objdir "*) ;;
9082 *) rmdirs="$rmdirs $objdir" ;;
9083 esac
9084 fi
9085
9086 # Don't error if the file doesn't exist and rm -f was used.
9087 if { test -L "$file"; } >/dev/null 2>&1 ||
9088 { test -h "$file"; } >/dev/null 2>&1 ||
9089 test -f "$file"; then
9090 :
9091 elif test -d "$file"; then
9092 exit_status=1
9093 continue
9094 elif test "$rmforce" = yes; then
9095 continue
9096 fi
9097
9098 rmfiles="$file"
9099
9100 case $name in
9101 *.la)
9102 # Possibly a libtool archive, so verify it.
9103 if func_lalib_p "$file"; then
9104 func_source $dir/$name
9105
9106 # Delete the libtool libraries and symlinks.
9107 for n in $library_names; do
9108 rmfiles="$rmfiles $objdir/$n"
9109 done
9110 test -n "$old_library" && rmfiles="$rmfiles $objdir/$old_library"
9111
9112 case "$mode" in
9113 clean)
9114 case " $library_names " in
9115 # " " in the beginning catches empty $dlname
9116 *" $dlname "*) ;;
9117 *) rmfiles="$rmfiles $objdir/$dlname" ;;
9118 esac
9119 test -n "$libdir" && rmfiles="$rmfiles $objdir/$name $objdir/${name}i"
9120 ;;
9121 uninstall)
9122 if test -n "$library_names"; then
9123 # Do each command in the postuninstall commands.
9124 func_execute_cmds "$postuninstall_cmds" 'test "$rmforce" = yes || exit_status=1'
9125 fi
9126
9127 if test -n "$old_library"; then
9128 # Do each command in the old_postuninstall commands.
9129 func_execute_cmds "$old_postuninstall_cmds" 'test "$rmforce" = yes || exit_status=1'
9130 fi
9131 # FIXME: should reinstall the best remaining shared library.
9132 ;;
9133 esac
9134 fi
9135 ;;
9136
9137 *.lo)
9138 # Possibly a libtool object, so verify it.
9139 if func_lalib_p "$file"; then
9140
9141 # Read the .lo file
9142 func_source $dir/$name
9143
9144 # Add PIC object to the list of files to remove.
9145 if test -n "$pic_object" &&
9146 test "$pic_object" != none; then
9147 rmfiles="$rmfiles $dir/$pic_object"
9148 fi
9149
9150 # Add non-PIC object to the list of files to remove.
9151 if test -n "$non_pic_object" &&
9152 test "$non_pic_object" != none; then
9153 rmfiles="$rmfiles $dir/$non_pic_object"
9154 fi
9155 fi
9156 ;;
9157
9158 *)
9159 if test "$mode" = clean ; then
9160 noexename=$name
9161 case $file in
9162 *.exe)
9163 func_stripname '' '.exe' "$file"
9164 file=$func_stripname_result
9165 func_stripname '' '.exe' "$name"
9166 noexename=$func_stripname_result
9167 # $file with .exe has already been added to rmfiles,
9168 # add $file without .exe
9169 rmfiles="$rmfiles $file"
9170 ;;
9171 esac
9172 # Do a test to see if this is a libtool program.
9173 if func_ltwrapper_p "$file"; then
9174 if func_ltwrapper_executable_p "$file"; then
9175 func_ltwrapper_scriptname "$file"
9176 relink_command=
9177 func_source $func_ltwrapper_scriptname_result
9178 rmfiles="$rmfiles $func_ltwrapper_scriptname_result"
9179 else
9180 relink_command=
9181 func_source $dir/$noexename
9182 fi
9183
9184 # note $name still contains .exe if it was in $file originally
9185 # as does the version of $file that was added into $rmfiles
9186 rmfiles="$rmfiles $objdir/$name $objdir/${name}S.${objext}"
9187 if test "$fast_install" = yes && test -n "$relink_command"; then
9188 rmfiles="$rmfiles $objdir/lt-$name"
9189 fi
9190 if test "X$noexename" != "X$name" ; then
9191 rmfiles="$rmfiles $objdir/lt-${noexename}.c"
9192 fi
9193 fi
9194 fi
9195 ;;
9196 esac
9197 func_show_eval "$RM $rmfiles" 'exit_status=1'
9198 done
9199 objdir="$origobjdir"
9200
9201 # Try to remove the ${objdir}s in the directories where we deleted files
9202 for dir in $rmdirs; do
9203 if test -d "$dir"; then
9204 func_show_eval "rmdir $dir >/dev/null 2>&1"
9205 fi
9206 done
9207
9208 exit $exit_status
9209}
9210
9211{ test "$mode" = uninstall || test "$mode" = clean; } &&
9212 func_mode_uninstall ${1+"$@"}
9213
9214test -z "$mode" && {
9215 help="$generic_help"
9216 func_fatal_help "you must specify a MODE"
9217}
9218
9219test -z "$exec_cmd" && \
9220 func_fatal_help "invalid operation mode \`$mode'"
9221
9222if test -n "$exec_cmd"; then
9223 eval exec "$exec_cmd"
9224 exit $EXIT_FAILURE
9225fi
9226
9227exit $exit_status
9228
9229
9230# The TAGs below are defined such that we never get into a situation
9231# in which we disable both kinds of libraries. Given conflicting
9232# choices, we go for a static library, that is the most portable,
9233# since we can't tell whether shared libraries were disabled because
9234# the user asked for that or because the platform doesn't support
9235# them. This is particularly important on AIX, because we don't
9236# support having both static and shared libraries enabled at the same
9237# time on that platform, so we default to a shared-only configuration.
9238# If a disable-shared tag is given, we'll fallback to a static-only
9239# configuration. But we'll never go from static-only to shared-only.
9240
9241# ### BEGIN LIBTOOL TAG CONFIG: disable-shared
9242build_libtool_libs=no
9243build_old_libs=yes
9244# ### END LIBTOOL TAG CONFIG: disable-shared
9245
9246# ### BEGIN LIBTOOL TAG CONFIG: disable-static
9247build_old_libs=`case $build_libtool_libs in yes) echo no;; *) echo yes;; esac`
9248# ### END LIBTOOL TAG CONFIG: disable-static
9249
9250# Local Variables:
9251# mode:shell-script
9252# sh-indentation:2
9253# End:
9254# vi:sw=2
9255
9256
9257# ### BEGIN LIBTOOL TAG CONFIG: CXX
9258
9259# The linker used to build libraries.
cristy55bf91c2010-09-24 00:29:41 +00009260LD=""
cristy3ed852e2009-09-05 21:47:34 +00009261
cristyfd9dcd42010-08-08 18:07:02 +00009262# How to create reloadable object files.
9263reload_flag=" -r"
9264reload_cmds="\$LD\$reload_flag -o \$output\$reload_objs"
9265
cristy3ed852e2009-09-05 21:47:34 +00009266# Commands used to build an old-style archive.
9267old_archive_cmds="\$AR \$AR_FLAGS \$oldlib\$oldobjs~\$RANLIB \$oldlib"
9268
9269# A language specific compiler.
cristy55bf91c2010-09-24 00:29:41 +00009270CC=""
cristy3ed852e2009-09-05 21:47:34 +00009271
9272# Is the compiler the GNU compiler?
cristy55bf91c2010-09-24 00:29:41 +00009273with_gcc=
cristy3ed852e2009-09-05 21:47:34 +00009274
9275# Compiler flag to turn off builtin functions.
cristy55bf91c2010-09-24 00:29:41 +00009276no_builtin_flag=""
cristy3ed852e2009-09-05 21:47:34 +00009277
9278# How to pass a linker flag through the compiler.
cristy55bf91c2010-09-24 00:29:41 +00009279wl=""
cristy3ed852e2009-09-05 21:47:34 +00009280
9281# Additional compiler flags for building library objects.
cristy55bf91c2010-09-24 00:29:41 +00009282pic_flag=""
cristy3ed852e2009-09-05 21:47:34 +00009283
9284# Compiler flag to prevent dynamic linking.
cristyde8bd6e2010-09-21 15:34:51 +00009285link_static_flag=""
cristy3ed852e2009-09-05 21:47:34 +00009286
9287# Does compiler simultaneously support -c and -o options?
cristy55bf91c2010-09-24 00:29:41 +00009288compiler_c_o=""
cristy3ed852e2009-09-05 21:47:34 +00009289
9290# Whether or not to add -lc for building shared libraries.
9291build_libtool_need_lc=no
9292
9293# Whether or not to disallow shared libs when runtime libs are static.
9294allow_libtool_libs_with_static_runtimes=no
9295
9296# Compiler flag to allow reflexive dlopens.
cristy55bf91c2010-09-24 00:29:41 +00009297export_dynamic_flag_spec=""
cristy3ed852e2009-09-05 21:47:34 +00009298
9299# Compiler flag to generate shared objects directly from archives.
cristy55bf91c2010-09-24 00:29:41 +00009300whole_archive_flag_spec=""
cristy3ed852e2009-09-05 21:47:34 +00009301
9302# Whether the compiler copes with passing no objects directly.
9303compiler_needs_object="no"
9304
9305# Create an old-style archive from a shared archive.
9306old_archive_from_new_cmds=""
9307
9308# Create a temporary old-style archive to link instead of a shared archive.
9309old_archive_from_expsyms_cmds=""
9310
9311# Commands used to build a shared archive.
cristy55bf91c2010-09-24 00:29:41 +00009312archive_cmds=""
9313archive_expsym_cmds=""
cristy3ed852e2009-09-05 21:47:34 +00009314
9315# Commands used to build a loadable module if different from building
9316# a shared archive.
9317module_cmds=""
9318module_expsym_cmds=""
9319
9320# Whether we are building with GNU ld or not.
cristy55bf91c2010-09-24 00:29:41 +00009321with_gnu_ld=""
cristy3ed852e2009-09-05 21:47:34 +00009322
9323# Flag that allows shared libraries with undefined symbols to be built.
9324allow_undefined_flag=""
9325
9326# Flag that enforces no undefined symbols.
9327no_undefined_flag=""
9328
9329# Flag to hardcode $libdir into a binary during linking.
9330# This must work even if $libdir does not exist
cristy55bf91c2010-09-24 00:29:41 +00009331hardcode_libdir_flag_spec=""
cristy3ed852e2009-09-05 21:47:34 +00009332
9333# If ld is used when linking, flag to hardcode $libdir into a binary
9334# during linking. This must work even if $libdir does not exist.
9335hardcode_libdir_flag_spec_ld=""
9336
9337# Whether we need a single "-rpath" flag with a separated argument.
9338hardcode_libdir_separator=""
9339
9340# Set to "yes" if using DIR/libNAME${shared_ext} during linking hardcodes
9341# DIR into the resulting binary.
9342hardcode_direct=no
9343
9344# Set to "yes" if using DIR/libNAME${shared_ext} during linking hardcodes
9345# DIR into the resulting binary and the resulting library dependency is
9346# "absolute",i.e impossible to change by setting ${shlibpath_var} if the
9347# library is relocated.
9348hardcode_direct_absolute=no
9349
9350# Set to "yes" if using the -LDIR flag during linking hardcodes DIR
9351# into the resulting binary.
9352hardcode_minus_L=no
9353
9354# Set to "yes" if using SHLIBPATH_VAR=DIR during linking hardcodes DIR
9355# into the resulting binary.
9356hardcode_shlibpath_var=unsupported
9357
9358# Set to "yes" if building a shared library automatically hardcodes DIR
9359# into the library and all subsequent libraries and executables linked
9360# against it.
9361hardcode_automatic=no
9362
9363# Set to yes if linker adds runtime paths of dependent libraries
9364# to runtime path list.
9365inherit_rpath=no
9366
9367# Whether libtool must link a program against all its dependency libraries.
9368link_all_deplibs=unknown
9369
9370# Fix the shell variable $srcfile for the compiler.
9371fix_srcfile_path=""
9372
9373# Set to "yes" if exported symbols are required.
9374always_export_symbols=no
9375
9376# The commands to list exported symbols.
cristy55bf91c2010-09-24 00:29:41 +00009377export_symbols_cmds=""
cristy3ed852e2009-09-05 21:47:34 +00009378
9379# Symbols that should not be listed in the preloaded symbols.
cristy55bf91c2010-09-24 00:29:41 +00009380exclude_expsyms=""
cristy3ed852e2009-09-05 21:47:34 +00009381
9382# Symbols that must always be exported.
9383include_expsyms=""
9384
9385# Commands necessary for linking programs (against libraries) with templates.
9386prelink_cmds=""
9387
9388# Specify filename containing input files.
9389file_list_spec=""
9390
9391# How to hardcode a shared library path into an executable.
cristy55bf91c2010-09-24 00:29:41 +00009392hardcode_action=
cristy3ed852e2009-09-05 21:47:34 +00009393
9394# The directories searched by this compiler when creating a shared library.
cristy55bf91c2010-09-24 00:29:41 +00009395compiler_lib_search_dirs=""
cristy3ed852e2009-09-05 21:47:34 +00009396
9397# Dependencies to place before and after the objects being linked to
9398# create a shared library.
cristy55bf91c2010-09-24 00:29:41 +00009399predep_objects=""
9400postdep_objects=""
cristy3ed852e2009-09-05 21:47:34 +00009401predeps=""
cristy55bf91c2010-09-24 00:29:41 +00009402postdeps=""
cristy3ed852e2009-09-05 21:47:34 +00009403
9404# The library search path used internally by the compiler when linking
9405# a shared library.
cristy55bf91c2010-09-24 00:29:41 +00009406compiler_lib_search_path=""
cristy3ed852e2009-09-05 21:47:34 +00009407
9408# ### END LIBTOOL TAG CONFIG: CXX