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