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