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