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