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