OSDN Git Service

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