Ticket #8752: glibtool

File glibtool, 224.3 KB (added by armando@…, 19 years ago)

The entire broken glibtool file from libtool-devel

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