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