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