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