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