Ticket #23431: libtool

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