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