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