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