Code

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