3 # libtool - Provide generalized library-building support services.
4 # Generated automatically by config.status (nfs-utils) 1.2.8
5 # Libtool was configured on host bighat.boston.devel.redhat.com:
6 # NOTE: Changes made to this file will be lost: look at ltmain.sh.
8 # Copyright (C) 1996, 1997, 1998, 1999, 2000, 2001, 2003, 2004, 2005,
9 # 2006, 2007, 2008, 2009, 2010, 2011 Free Software
11 # Written by Gordon Matzigkeit, 1996
13 # This file is part of GNU Libtool.
15 # GNU Libtool is free software; you can redistribute it and/or
16 # modify it under the terms of the GNU General Public License as
17 # published by the Free Software Foundation; either version 2 of
18 # the License, or (at your option) any later version.
20 # As a special exception to the GNU General Public License,
21 # if you distribute this file as part of a program or library that
22 # is built using GNU Libtool, you may include this file under the
23 # same distribution terms that you use for the rest of that program.
25 # GNU Libtool is distributed in the hope that it will be useful,
26 # but WITHOUT ANY WARRANTY; without even the implied warranty of
27 # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
28 # GNU General Public License for more details.
30 # You should have received a copy of the GNU General Public License
31 # along with GNU Libtool; see the file COPYING. If not, a copy
32 # can be downloaded from http://www.gnu.org/licenses/gpl.html, or
33 # obtained by writing to the Free Software Foundation, Inc.,
34 # 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
37 # The names of the tagged configurations supported by this script.
40 # ### BEGIN LIBTOOL CONFIG
42 # Which release of libtool.m4 was used?
46 # Whether or not to build shared libraries.
47 build_libtool_libs=yes
49 # Whether or not to build static libraries.
52 # What type of objects to build.
55 # Whether or not to optimize for fast installation.
58 # Shell to use when invoking shell scripts.
61 # An echo program that protects backslashes.
64 # The PATH separator for the build system.
69 host=x86_64-unknown-linux-gnu
74 build=x86_64-unknown-linux-gnu
77 # A sed program that does not truncate output.
80 # Sed that helps us avoid accidentally triggering echo(1) options like -n.
81 Xsed="$SED -e 1s/^X//"
83 # A grep program that handles long lines.
87 EGREP="/usr/bin/grep -E"
89 # A literal string matcher.
90 FGREP="/usr/bin/grep -F"
92 # A BSD- or MS-compatible name lister.
95 # Whether we need soft or hard links.
98 # What is the maximum length of a command?
101 # Object file suffix (normally "o").
104 # Executable file suffix (normally "").
107 # whether the shell understands "unset".
110 # turn spaces into newlines.
111 SP2NL="tr \\040 \\012"
113 # turn newlines into spaces.
114 NL2SP="tr \\015\\012 \\040\\040"
116 # convert $build file names to $host format.
117 to_host_file_cmd=func_convert_file_noop
119 # convert $build files to toolchain format.
120 to_tool_file_cmd=func_convert_file_noop
122 # An object symbol dumper.
125 # Method to check whether dependent libraries are shared objects.
126 deplibs_check_method="pass_all"
128 # Command to use when deplibs_check_method = "file_magic".
129 file_magic_cmd="\$MAGIC_CMD"
131 # How to find potential files when deplibs_check_method = "file_magic".
134 # Find potential files using nocaseglob when deplibs_check_method = "file_magic".
137 # DLL creation program.
140 # Command to associate shared and link libraries.
141 sharedlib_from_linklib_cmd="printf %s\\n"
146 # Flags to create an archive.
149 # How to feed a file listing to the archiver.
150 archiver_list_spec="@"
152 # A symbol stripping program.
155 # Commands used to install an old-style archive.
157 old_postinstall_cmds="chmod 644 \$oldlib~\$RANLIB \$tool_oldlib"
158 old_postuninstall_cmds=""
160 # Whether to use a lock for old archive extraction.
161 lock_old_archive_extraction=no
166 # LTCC compiler flags.
169 # Take the output of nm and produce a listing of raw symbols and C names.
170 global_symbol_pipe="sed -n -e 's/^.*[ ]\\([ABCDGIRSTW][ABCDGIRSTW]*\\)[ ][ ]*\\([_A-Za-z][_A-Za-z0-9]*\\)\$/\\1 \\2 \\2/p' | sed '/ __gnu_lto/d'"
172 # Transform the output of nm in a proper C declaration.
173 global_symbol_to_cdecl="sed -n -e 's/^T .* \\(.*\\)\$/extern int \\1();/p' -e 's/^[ABCDGIRSTW]* .* \\(.*\\)\$/extern char \\1;/p'"
175 # Transform the output of nm in a C name address pair.
176 global_symbol_to_c_name_address="sed -n -e 's/^: \\([^ ]*\\)[ ]*\$/ {\\\"\\1\\\", (void *) 0},/p' -e 's/^[ABCDGIRSTW]* \\([^ ]*\\) \\([^ ]*\\)\$/ {\"\\2\", (void *) \\&\\2},/p'"
178 # Transform the output of nm in a C name address pair when lib prefix is needed.
179 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'"
181 # Specify filename containing input files for $NM.
182 nm_file_list_spec="@"
184 # The root where to search for dependent libraries,and in which our libraries should be installed.
187 # The name of the directory that contains temporary libtool files.
190 # Used to examine libraries when file_magic_cmd begins with "file".
193 # Must we lock files when doing compilation?
199 # Tool to manipulate archived DWARF debug symbol files on Mac OS X.
202 # Tool to change global to local symbols on Mac OS X.
205 # Tool to manipulate fat objects and archives on Mac OS X.
208 # ldd/readelf like tool for Mach-O binaries on Mac OS X.
211 # ldd/readelf like tool for 64 bit Mach-O binaries on Mac OS X 10.4.
214 # Old archive suffix (normally "a").
217 # Shared library suffix (normally ".so").
220 # The commands to extract the exported symbol list from a shared archive.
221 extract_expsyms_cmds=""
223 # Variables whose values should be saved in libtool wrapper scripts and
224 # restored at link time.
225 variables_saved_for_relink="PATH LD_LIBRARY_PATH LD_RUN_PATH GCC_EXEC_PREFIX COMPILER_PATH LIBRARY_PATH"
227 # Do we need the "lib" prefix for modules?
230 # Do we need a version for libraries?
233 # Library versioning type.
236 # Shared library runtime path variable.
237 runpath_var=LD_RUN_PATH
239 # Shared library path variable.
240 shlibpath_var=LD_LIBRARY_PATH
242 # Is shlibpath searched before the hard-coded library search path?
243 shlibpath_overrides_runpath=no
245 # Format of library name prefix.
246 libname_spec="lib\$name"
248 # List of archive names. First name is the real one, the rest are links.
249 # The last name is the one that the linker finds with -lNAME
250 library_names_spec="\${libname}\${release}\${shared_ext}\$versuffix \${libname}\${release}\${shared_ext}\$major \$libname\${shared_ext}"
252 # The coded name of the library, if different from the real name.
253 soname_spec="\${libname}\${release}\${shared_ext}\$major"
255 # Permission mode override for installation of shared libraries.
256 install_override_mode=""
258 # Command to use after installation of a shared archive.
261 # Command to use after uninstallation of a shared archive.
262 postuninstall_cmds=""
264 # Commands used to finish a libtool library installation in a directory.
265 finish_cmds="PATH=\\\"\\\$PATH:/sbin\\\" ldconfig -n \$libdir"
267 # As "finish_cmds", except a single script fragment to be evaled but
271 # Whether we should hardcode library paths into libraries.
272 hardcode_into_libs=yes
274 # Compile-time system search path for libraries.
275 sys_lib_search_path_spec="/usr/lib/gcc/x86_64-redhat-linux/4.7.2 /usr/lib64 /lib64 "
277 # Run-time system search path for libraries.
278 sys_lib_dlsearch_path_spec="/lib64 /usr/lib64 /lib /usr/lib /usr/lib64/atlas /usr/lib64/dyninst /usr/lib64/iscsi /usr/lib64/llvm /usr/lib64/mysql /usr/lib64/qt-3.3/lib /usr/lib64/tcl8.5 /usr/lib64/tracker-0.14 /usr/lib64/xulrunner "
280 # Whether dlopen is supported.
281 dlopen_support=unknown
283 # Whether dlopen of programs is supported.
286 # Whether dlopen of statically linked programs is supported.
287 dlopen_self_static=unknown
289 # Commands to strip libraries.
290 old_striplib="strip --strip-debug"
291 striplib="strip --strip-unneeded"
294 # The linker used to build libraries.
295 LD="/usr/bin/ld -m elf_x86_64"
297 # How to create reloadable object files.
299 reload_cmds="\$LD\$reload_flag -o \$output\$reload_objs"
301 # Commands used to build an old-style archive.
302 old_archive_cmds="\$AR \$AR_FLAGS \$oldlib\$oldobjs~\$RANLIB \$tool_oldlib"
304 # A language specific compiler.
307 # Is the compiler the GNU compiler?
310 # Compiler flag to turn off builtin functions.
311 no_builtin_flag=" -fno-builtin"
313 # Additional compiler flags for building library objects.
314 pic_flag=" -fPIC -DPIC"
316 # How to pass a linker flag through the compiler.
319 # Compiler flag to prevent dynamic linking.
322 # Does compiler simultaneously support -c and -o options?
325 # Whether or not to add -lc for building shared libraries.
326 build_libtool_need_lc=no
328 # Whether or not to disallow shared libs when runtime libs are static.
329 allow_libtool_libs_with_static_runtimes=no
331 # Compiler flag to allow reflexive dlopens.
332 export_dynamic_flag_spec="\${wl}--export-dynamic"
334 # Compiler flag to generate shared objects directly from archives.
335 whole_archive_flag_spec="\${wl}--whole-archive\$convenience \${wl}--no-whole-archive"
337 # Whether the compiler copes with passing no objects directly.
338 compiler_needs_object="no"
340 # Create an old-style archive from a shared archive.
341 old_archive_from_new_cmds=""
343 # Create a temporary old-style archive to link instead of a shared archive.
344 old_archive_from_expsyms_cmds=""
346 # Commands used to build a shared archive.
347 archive_cmds="\$CC -shared \$pic_flag \$libobjs \$deplibs \$compiler_flags \${wl}-soname \$wl\$soname -o \$lib"
348 archive_expsym_cmds="echo \\\"{ global:\\\" > \$output_objdir/\$libname.ver~
349 cat \$export_symbols | sed -e \\\"s/\\\\(.*\\\\)/\\\\1;/\\\" >> \$output_objdir/\$libname.ver~
350 echo \\\"local: *; };\\\" >> \$output_objdir/\$libname.ver~
351 \$CC -shared \$pic_flag \$libobjs \$deplibs \$compiler_flags \${wl}-soname \$wl\$soname \${wl}-version-script \${wl}\$output_objdir/\$libname.ver -o \$lib"
353 # Commands used to build a loadable module if different from building
356 module_expsym_cmds=""
358 # Whether we are building with GNU ld or not.
361 # Flag that allows shared libraries with undefined symbols to be built.
362 allow_undefined_flag=""
364 # Flag that enforces no undefined symbols.
367 # Flag to hardcode $libdir into a binary during linking.
368 # This must work even if $libdir does not exist
369 hardcode_libdir_flag_spec="\${wl}-rpath \${wl}\$libdir"
371 # Whether we need a single "-rpath" flag with a separated argument.
372 hardcode_libdir_separator=""
374 # Set to "yes" if using DIR/libNAME${shared_ext} during linking hardcodes
375 # DIR into the resulting binary.
378 # Set to "yes" if using DIR/libNAME${shared_ext} during linking hardcodes
379 # DIR into the resulting binary and the resulting library dependency is
380 # "absolute",i.e impossible to change by setting ${shlibpath_var} if the
381 # library is relocated.
382 hardcode_direct_absolute=no
384 # Set to "yes" if using the -LDIR flag during linking hardcodes DIR
385 # into the resulting binary.
388 # Set to "yes" if using SHLIBPATH_VAR=DIR during linking hardcodes DIR
389 # into the resulting binary.
390 hardcode_shlibpath_var=unsupported
392 # Set to "yes" if building a shared library automatically hardcodes DIR
393 # into the library and all subsequent libraries and executables linked
395 hardcode_automatic=no
397 # Set to yes if linker adds runtime paths of dependent libraries
398 # to runtime path list.
401 # Whether libtool must link a program against all its dependency libraries.
402 link_all_deplibs=unknown
404 # Set to "yes" if exported symbols are required.
405 always_export_symbols=no
407 # The commands to list exported symbols.
408 export_symbols_cmds="\$NM \$libobjs \$convenience | \$global_symbol_pipe | \$SED 's/.* //' | sort | uniq > \$export_symbols"
410 # Symbols that should not be listed in the preloaded symbols.
411 exclude_expsyms="_GLOBAL_OFFSET_TABLE_|_GLOBAL__F[ID]_.*"
413 # Symbols that must always be exported.
416 # Commands necessary for linking programs (against libraries) with templates.
419 # Commands necessary for finishing linking programs.
422 # Specify filename containing input files.
425 # How to hardcode a shared library path into an executable.
426 hardcode_action=immediate
428 # The directories searched by this compiler when creating a shared library.
429 compiler_lib_search_dirs=""
431 # Dependencies to place before and after the objects being linked to
432 # create a shared library.
438 # The library search path used internally by the compiler when linking
440 compiler_lib_search_path=""
442 # ### END LIBTOOL CONFIG
445 # libtool (GNU libtool) 2.4.2
446 # Written by Gordon Matzigkeit <gord@gnu.ai.mit.edu>, 1996
448 # Copyright (C) 1996, 1997, 1998, 1999, 2000, 2001, 2003, 2004, 2005, 2006,
449 # 2007, 2008, 2009, 2010, 2011 Free Software Foundation, Inc.
450 # This is free software; see the source for copying conditions. There is NO
451 # warranty; not even for MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
453 # GNU Libtool is free software; you can redistribute it and/or modify
454 # it under the terms of the GNU General Public License as published by
455 # the Free Software Foundation; either version 2 of the License, or
456 # (at your option) any later version.
458 # As a special exception to the GNU General Public License,
459 # if you distribute this file as part of a program or library that
460 # is built using GNU Libtool, you may include this file under the
461 # same distribution terms that you use for the rest of that program.
463 # GNU Libtool is distributed in the hope that it will be useful, but
464 # WITHOUT ANY WARRANTY; without even the implied warranty of
465 # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
466 # General Public License for more details.
468 # You should have received a copy of the GNU General Public License
469 # along with GNU Libtool; see the file COPYING. If not, a copy
470 # can be downloaded from http://www.gnu.org/licenses/gpl.html,
471 # or obtained by writing to the Free Software Foundation, Inc.,
472 # 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
474 # Usage: $progname [OPTION]... [MODE-ARG]...
476 # Provide generalized library-building support services.
478 # --config show all configuration variables
479 # --debug enable verbose shell tracing
480 # -n, --dry-run display commands without modifying any files
481 # --features display basic configuration information and exit
482 # --mode=MODE use operation mode MODE
483 # --preserve-dup-deps don't remove duplicate dependency libraries
484 # --quiet, --silent don't print informational messages
485 # --no-quiet, --no-silent
486 # print informational messages (default)
487 # --no-warn don't display warning messages
488 # --tag=TAG use configuration variables from tag TAG
489 # -v, --verbose print more informational messages than default
490 # --no-verbose don't print the extra informational messages
491 # --version print version information
492 # -h, --help, --help-all print short, long, or detailed help message
494 # MODE must be one of the following:
496 # clean remove files from the build directory
497 # compile compile a source file into a libtool object
498 # execute automatically set library path, then run a program
499 # finish complete the installation of libtool libraries
500 # install install libraries or executables
501 # link create a library or an executable
502 # uninstall remove libraries from an installed directory
504 # MODE-ARGS vary depending on the MODE. When passed as first option,
505 # `--mode=MODE' may be abbreviated as `MODE' or a unique abbreviation of that.
506 # Try `$progname --help --mode=MODE' for a more detailed description of MODE.
508 # When reporting a bug, please describe a test case to reproduce it and
509 # include the following information:
511 # host-triplet: $host
514 # compiler flags: $LTCFLAGS
515 # linker: $LD (gnu? $with_gnu_ld)
516 # $progname: (GNU libtool) 2.4.2
517 # automake: $automake_version
518 # autoconf: $autoconf_version
520 # Report bugs to <bug-libtool@gnu.org>.
521 # GNU libtool home page: <http://www.gnu.org/software/libtool/>.
522 # General help using GNU software: <http://www.gnu.org/gethelp/>.
528 package_revision=1.3337
530 # Be Bourne compatible
531 if test -n "${ZSH_VERSION+set}" && (emulate sh) >/dev/null 2>&1; then
534 # Zsh 3.x and 4.x performs word splitting on ${1+"$@"}, which
535 # is contrary to our usage. Disable this feature.
536 alias -g '${1+"$@"}'='"$@"'
539 case `(set -o) 2>/dev/null` in *posix*) set -o posix;; esac
541 BIN_SH=xpg4; export BIN_SH # for Tru64
542 DUALCASE=1; export DUALCASE # for MKS sh
544 # A function that is used when there is no print builtin or printf.
545 func_fallback_echo ()
547 eval 'cat <<_LTECHO_EOF
552 # NLS nuisances: We save the old values to restore during execute mode.
555 for lt_var in LANG LANGUAGE LC_ALL LC_CTYPE LC_COLLATE LC_MESSAGES
557 eval "if test \"\${$lt_var+set}\" = set; then
558 save_$lt_var=\$$lt_var
561 lt_user_locale=\"$lt_var=\\\$save_\$lt_var; \$lt_user_locale\"
562 lt_safe_locale=\"$lt_var=C; \$lt_safe_locale\"
567 export LANGUAGE LC_ALL
572 # Work around backward compatibility issue on IRIX 6.5. On IRIX 6.4+, sh
573 # is ksh but when the shell is invoked as "sh" and the current value of
574 # the _XPG environment variable is not equal to 1 (one), the special
575 # positional parameter $0, within a function call, is the name of the
582 test "${ECHO+set}" = set || ECHO=${as_echo-'printf %s\n'}
587 : ${SHELL="${CONFIG_SHELL-/bin/sh}"}
588 : ${Xsed="$SED -e 1s/^X//"}
593 EXIT_MISMATCH=63 # $? = 63 is used to indicate version mismatch to missing.
594 EXIT_SKIP=77 # $? = 77 is used to indicate a skipped test to automake.
596 exit_status=$EXIT_SUCCESS
598 # Make sure IFS has a sensible default
603 dirname="s,/[^/]*$,,"
606 # func_dirname file append nondir_replacement
607 # Compute the dirname of FILE. If nonempty, add APPEND to the result,
608 # otherwise set result to NONDIR_REPLACEMENT.
612 */*) func_dirname_result="${1%/*}${2}" ;;
613 * ) func_dirname_result="${3}" ;;
615 } # Extended-shell func_dirname implementation
621 func_basename_result="${1##*/}"
622 } # Extended-shell func_basename implementation
625 # func_dirname_and_basename file append nondir_replacement
626 # perform func_basename and func_dirname in a single function
628 # dirname: Compute the dirname of FILE. If nonempty,
629 # add APPEND to the result, otherwise set result
630 # to NONDIR_REPLACEMENT.
631 # value returned in "$func_dirname_result"
632 # basename: Compute filename of FILE.
633 # value retuned in "$func_basename_result"
634 # Implementation must be kept synchronized with func_dirname
635 # and func_basename. For efficiency, we do not delegate to
636 # those functions but instead duplicate the functionality here.
637 func_dirname_and_basename ()
640 */*) func_dirname_result="${1%/*}${2}" ;;
641 * ) func_dirname_result="${3}" ;;
643 func_basename_result="${1##*/}"
644 } # Extended-shell func_dirname_and_basename implementation
647 # func_stripname prefix suffix name
648 # strip PREFIX and SUFFIX off of NAME.
649 # PREFIX and SUFFIX must not contain globbing or regex special
650 # characters, hashes, percent signs, but SUFFIX may contain a leading
651 # dot (in which case that matches only a dot).
652 # func_strip_suffix prefix name
655 # pdksh 5.2.14 does not do ${X%$Y} correctly if both X and Y are
656 # positional parameters, so assign one to ordinary parameter first.
657 func_stripname_result=${3}
658 func_stripname_result=${func_stripname_result#"${1}"}
659 func_stripname_result=${func_stripname_result%"${2}"}
660 } # Extended-shell func_stripname implementation
663 # These SED scripts presuppose an absolute path with a trailing slash.
664 pathcar='s,^/\([^/]*\).*$,\1,'
665 pathcdr='s,^/[^/]*,,'
666 removedotparts=':dotsl
670 collapseslashes='s@/\{1,\}@/@g'
671 finalslash='s,/*$,/,'
673 # func_normal_abspath PATH
674 # Remove doubled-up and trailing slashes, "." path components,
675 # and cancel out any ".." path components in PATH after making
676 # it an absolute path.
677 # value returned in "$func_normal_abspath_result"
678 func_normal_abspath ()
680 # Start from root dir and reassemble the path.
681 func_normal_abspath_result=
682 func_normal_abspath_tpath=$1
683 func_normal_abspath_altnamespace=
684 case $func_normal_abspath_tpath in
686 # Empty path, that just means $cwd.
687 func_stripname '' '/' "`pwd`"
688 func_normal_abspath_result=$func_stripname_result
691 # The next three entries are used to spot a run of precisely
692 # two leading slashes without using negated character classes;
693 # we take advantage of case's first-match behaviour.
695 # Unusual form of absolute path, do nothing.
698 # Not necessarily an ordinary path; POSIX reserves leading '//'
699 # and for example Cygwin uses it to access remote file shares
700 # over CIFS/SMB, so we conserve a leading double slash if found.
701 func_normal_abspath_altnamespace=/
704 # Absolute path, do nothing.
707 # Relative path, prepend $cwd.
708 func_normal_abspath_tpath=`pwd`/$func_normal_abspath_tpath
711 # Cancel out all the simple stuff to save iterations. We also want
712 # the path to end with a slash for ease of parsing, so make sure
713 # there is one (and only one) here.
714 func_normal_abspath_tpath=`$ECHO "$func_normal_abspath_tpath" | $SED \
715 -e "$removedotparts" -e "$collapseslashes" -e "$finalslash"`
717 # Processed it all yet?
718 if test "$func_normal_abspath_tpath" = / ; then
719 # If we ascended to the root using ".." the result may be empty now.
720 if test -z "$func_normal_abspath_result" ; then
721 func_normal_abspath_result=/
725 func_normal_abspath_tcomponent=`$ECHO "$func_normal_abspath_tpath" | $SED \
727 func_normal_abspath_tpath=`$ECHO "$func_normal_abspath_tpath" | $SED \
729 # Figure out what to do with it
730 case $func_normal_abspath_tcomponent in
732 # Trailing empty path component, ignore it.
735 # Parent dir; strip last assembled component from result.
736 func_dirname "$func_normal_abspath_result"
737 func_normal_abspath_result=$func_dirname_result
740 # Actual path component, append it.
741 func_normal_abspath_result=$func_normal_abspath_result/$func_normal_abspath_tcomponent
745 # Restore leading double-slash if one was found on entry.
746 func_normal_abspath_result=$func_normal_abspath_altnamespace$func_normal_abspath_result
749 # func_relative_path SRCDIR DSTDIR
750 # generates a relative path from SRCDIR to DSTDIR, with a trailing
751 # slash if non-empty, suitable for immediately appending a filename
752 # without needing to append a separator.
753 # value returned in "$func_relative_path_result"
754 func_relative_path ()
756 func_relative_path_result=
757 func_normal_abspath "$1"
758 func_relative_path_tlibdir=$func_normal_abspath_result
759 func_normal_abspath "$2"
760 func_relative_path_tbindir=$func_normal_abspath_result
762 # Ascend the tree starting from libdir
764 # check if we have found a prefix of bindir
765 case $func_relative_path_tbindir in
766 $func_relative_path_tlibdir)
767 # found an exact match
768 func_relative_path_tcancelled=
771 $func_relative_path_tlibdir*)
772 # found a matching prefix
773 func_stripname "$func_relative_path_tlibdir" '' "$func_relative_path_tbindir"
774 func_relative_path_tcancelled=$func_stripname_result
775 if test -z "$func_relative_path_result"; then
776 func_relative_path_result=.
781 func_dirname $func_relative_path_tlibdir
782 func_relative_path_tlibdir=${func_dirname_result}
783 if test "x$func_relative_path_tlibdir" = x ; then
784 # Have to descend all the way to the root!
785 func_relative_path_result=../$func_relative_path_result
786 func_relative_path_tcancelled=$func_relative_path_tbindir
789 func_relative_path_result=../$func_relative_path_result
794 # Now calculate path; take care to avoid doubling-up slashes.
795 func_stripname '' '/' "$func_relative_path_result"
796 func_relative_path_result=$func_stripname_result
797 func_stripname '/' '/' "$func_relative_path_tcancelled"
798 if test "x$func_stripname_result" != x ; then
799 func_relative_path_result=${func_relative_path_result}/${func_stripname_result}
802 # Normalisation. If bindir is libdir, return empty string,
803 # else relative path ending with a slash; either way, target
804 # file name can be directly appended.
805 if test ! -z "$func_relative_path_result"; then
806 func_stripname './' '' "$func_relative_path_result/"
807 func_relative_path_result=$func_stripname_result
811 # The name of this program:
812 func_dirname_and_basename "$progpath"
813 progname=$func_basename_result
815 # Make sure we have an absolute path for reexecution:
817 [\\/]*|[A-Za-z]:\\*) ;;
819 progdir=$func_dirname_result
820 progdir=`cd "$progdir" && pwd`
821 progpath="$progdir/$progname"
825 IFS=${PATH_SEPARATOR-:}
826 for progdir in $PATH; do
828 test -x "$progdir/$progname" && break
831 test -n "$progdir" || progdir=`pwd`
832 progpath="$progdir/$progname"
836 # Sed substitution that helps us do robust quoting. It backslashifies
837 # metacharacters that are still active within double-quoted strings.
838 Xsed="${SED}"' -e 1s/^X//'
839 sed_quote_subst='s/\([`"$\\]\)/\\\1/g'
841 # Same as above, but do not quote variable references.
842 double_quote_subst='s/\(["`\\]\)/\\\1/g'
844 # Sed substitution that turns a string into a regex matching for the
846 sed_make_literal_regex='s,[].[^$\\*\/],\\&,g'
848 # Sed substitution that converts a w32 file name or path
849 # which contains forward slashes, into one that contains
850 # (escaped) backslashes. A very naive implementation.
851 lt_sed_naive_backslashify='s|\\\\*|\\|g;s|/|\\|g;s|\\|\\\\|g'
853 # Re-`\' parameter expansions in output of double_quote_subst that were
854 # `\'-ed in input to the same. If an odd number of `\' preceded a '$'
855 # in input to double_quote_subst, that '$' was protected from expansion.
856 # Since each input `\' is now two `\'s, look for any number of runs of
857 # four `\'s followed by two `\'s and then a '$'. `\' that '$'.
862 sed_double_backslash="\
866 s/\\([^$bs]\\)$bs2$dollar/\\1$bs2$bs$dollar/g
877 # Echo program name prefixed message, along with the current mode
878 # name if it has been set yet.
881 $ECHO "$progname: ${opt_mode+$opt_mode: }$*"
884 # func_verbose arg...
885 # Echo program name prefixed message in verbose mode only.
888 $opt_verbose && func_echo ${1+"$@"}
890 # A bug in bash halts the script if the last line of a function
891 # fails when set -e is in force, so we need another command to
896 # func_echo_all arg...
897 # Invoke $ECHO with all args, space-separated.
904 # Echo program name prefixed message to standard error.
907 $ECHO "$progname: ${opt_mode+$opt_mode: }"${1+"$@"} 1>&2
910 # func_warning arg...
911 # Echo program name prefixed warning message to standard error.
914 $opt_warning && $ECHO "$progname: ${opt_mode+$opt_mode: }warning: "${1+"$@"} 1>&2
920 # func_fatal_error arg...
921 # Echo program name prefixed message to standard error, and exit.
928 # func_fatal_help arg...
929 # Echo program name prefixed message to standard error, followed by
930 # a help hint, and exit.
934 func_fatal_error "$help"
936 help="Try \`$progname --help' for more information." ## default
939 # func_grep expression filename
940 # Check whether EXPRESSION matches any line of FILENAME, without output.
943 $GREP "$1" "$2" >/dev/null 2>&1
947 # func_mkdir_p directory-path
948 # Make sure the entire path to DIRECTORY-PATH is available.
951 my_directory_path="$1"
954 if test -n "$my_directory_path" && test "$opt_dry_run" != ":"; then
956 # Protect directory names starting with `-'
957 case $my_directory_path in
958 -*) my_directory_path="./$my_directory_path" ;;
961 # While some portion of DIR does not yet exist...
962 while test ! -d "$my_directory_path"; do
963 # ...make a list in topmost first order. Use a colon delimited
964 # list incase some portion of path contains whitespace.
965 my_dir_list="$my_directory_path:$my_dir_list"
967 # If the last portion added has no slash in it, the list is done
968 case $my_directory_path in */*) ;; *) break ;; esac
970 # ...otherwise throw away the child directory and loop
971 my_directory_path=`$ECHO "$my_directory_path" | $SED -e "$dirname"`
973 my_dir_list=`$ECHO "$my_dir_list" | $SED 's,:*$,,'`
975 save_mkdir_p_IFS="$IFS"; IFS=':'
976 for my_dir in $my_dir_list; do
977 IFS="$save_mkdir_p_IFS"
978 # mkdir can fail with a `File exist' error if two processes
979 # try to create one of the directories concurrently. Don't
981 $MKDIR "$my_dir" 2>/dev/null || :
983 IFS="$save_mkdir_p_IFS"
985 # Bail out if we (or some other process) failed to create a directory.
986 test -d "$my_directory_path" || \
987 func_fatal_error "Failed to create \`$1'"
992 # func_mktempdir [string]
993 # Make a temporary directory that won't clash with other running
994 # libtool processes, and avoids race conditions if possible. If
995 # given, STRING is the basename for that directory.
998 my_template="${TMPDIR-/tmp}/${1-$progname}"
1000 if test "$opt_dry_run" = ":"; then
1001 # Return a directory name, but don't create it in dry-run mode
1002 my_tmpdir="${my_template}-$$"
1005 # If mktemp works, use that first and foremost
1006 my_tmpdir=`mktemp -d "${my_template}-XXXXXXXX" 2>/dev/null`
1008 if test ! -d "$my_tmpdir"; then
1009 # Failing that, at least try and use $RANDOM to avoid a race
1010 my_tmpdir="${my_template}-${RANDOM-0}$$"
1012 save_mktempdir_umask=`umask`
1015 umask $save_mktempdir_umask
1018 # If we're not in dry-run mode, bomb out on failure
1019 test -d "$my_tmpdir" || \
1020 func_fatal_error "cannot create temporary directory \`$my_tmpdir'"
1027 # func_quote_for_eval arg
1028 # Aesthetically quote ARG to be evaled later.
1029 # This function returns two values: FUNC_QUOTE_FOR_EVAL_RESULT
1030 # is double-quoted, suitable for a subsequent eval, whereas
1031 # FUNC_QUOTE_FOR_EVAL_UNQUOTED_RESULT has merely all characters
1032 # which are still active within double quotes backslashified.
1033 func_quote_for_eval ()
1037 func_quote_for_eval_unquoted_result=`$ECHO "$1" | $SED "$sed_quote_subst"` ;;
1039 func_quote_for_eval_unquoted_result="$1" ;;
1042 case $func_quote_for_eval_unquoted_result in
1043 # Double-quote args containing shell metacharacters to delay
1044 # word splitting, command substitution and and variable
1045 # expansion for a subsequent eval.
1046 # Many Bourne shells cannot handle close brackets correctly
1047 # in scan sets, so we specify it separately.
1048 *[\[\~\#\^\&\*\(\)\{\}\|\;\<\>\?\'\ \ ]*|*]*|"")
1049 func_quote_for_eval_result="\"$func_quote_for_eval_unquoted_result\""
1052 func_quote_for_eval_result="$func_quote_for_eval_unquoted_result"
1057 # func_quote_for_expand arg
1058 # Aesthetically quote ARG to be evaled later; same as above,
1059 # but do not quote variable references.
1060 func_quote_for_expand ()
1064 my_arg=`$ECHO "$1" | $SED \
1065 -e "$double_quote_subst" -e "$sed_double_backslash"` ;;
1071 # Double-quote args containing shell metacharacters to delay
1072 # word splitting and command substitution for a subsequent eval.
1073 # Many Bourne shells cannot handle close brackets correctly
1074 # in scan sets, so we specify it separately.
1075 *[\[\~\#\^\&\*\(\)\{\}\|\;\<\>\?\'\ \ ]*|*]*|"")
1076 my_arg="\"$my_arg\""
1080 func_quote_for_expand_result="$my_arg"
1084 # func_show_eval cmd [fail_exp]
1085 # Unless opt_silent is true, then output CMD. Then, if opt_dryrun is
1086 # not true, evaluate CMD. If the evaluation of CMD fails, and FAIL_EXP
1087 # is given, then evaluate it.
1091 my_fail_exp="${2-:}"
1093 ${opt_silent-false} || {
1094 func_quote_for_expand "$my_cmd"
1095 eval "func_echo $func_quote_for_expand_result"
1098 if ${opt_dry_run-false}; then :; else
1101 if test "$my_status" -eq 0; then :; else
1102 eval "(exit $my_status); $my_fail_exp"
1108 # func_show_eval_locale cmd [fail_exp]
1109 # Unless opt_silent is true, then output CMD. Then, if opt_dryrun is
1110 # not true, evaluate CMD. If the evaluation of CMD fails, and FAIL_EXP
1111 # is given, then evaluate it. Use the saved locale for evaluation.
1112 func_show_eval_locale ()
1115 my_fail_exp="${2-:}"
1117 ${opt_silent-false} || {
1118 func_quote_for_expand "$my_cmd"
1119 eval "func_echo $func_quote_for_expand_result"
1122 if ${opt_dry_run-false}; then :; else
1123 eval "$lt_user_locale
1126 eval "$lt_safe_locale"
1127 if test "$my_status" -eq 0; then :; else
1128 eval "(exit $my_status); $my_fail_exp"
1134 # Turn $1 into a string suitable for a shell variable name.
1135 # Result is stored in $func_tr_sh_result. All characters
1136 # not in the set a-zA-Z0-9_ are replaced with '_'. Further,
1137 # if $1 begins with a digit, a '_' is prepended as well.
1141 [0-9]* | *[!a-zA-Z0-9_]*)
1142 func_tr_sh_result=`$ECHO "$1" | $SED 's/^\([0-9]\)/_\1/; s/[^a-zA-Z0-9_]/_/g'`
1145 func_tr_sh_result=$1
1152 # Echo version message to standard output and exit.
1165 /^# '$PROGRAM' (GNU /,/# warranty; / {
1168 s/\((C)\)[ 0-9,-]*\( [1-9][0-9]*\)/\1\2/
1175 # Echo short help message to standard output and exit.
1180 $SED -n '/^# Usage:/,/^# *.*--help/ {
1183 s/\$progname/'$progname'/
1187 $ECHO "run \`$progname --help | more' for full usage"
1191 # func_help [NOEXIT]
1192 # Echo long help message to standard output and exit,
1193 # unless 'noexit' is passed as argument.
1198 $SED -n '/^# Usage:/,/# Report bugs to/ {
1202 s*\$progname*'$progname'*
1204 s*\$SHELL*'"$SHELL"'*
1206 s*\$LTCFLAGS*'"$LTCFLAGS"'*
1208 s/\$with_gnu_ld/'"$with_gnu_ld"'/
1209 s/\$automake_version/'"`(${AUTOMAKE-automake} --version) 2>/dev/null |$SED 1q`"'/
1210 s/\$autoconf_version/'"`(${AUTOCONF-autoconf} --version) 2>/dev/null |$SED 1q`"'/
1214 /^# .* home page:/b print
1215 /^# General help using/b print
1218 if test -z "$1"; then
1223 # func_missing_arg argname
1224 # Echo program name prefixed message to standard error and set global
1230 func_error "missing argument for $1."
1235 # func_split_short_opt shortopt
1236 # Set func_split_short_opt_name and func_split_short_opt_arg shell
1237 # variables after splitting SHORTOPT after the 2nd character.
1238 func_split_short_opt ()
1240 func_split_short_opt_arg=${1#??}
1241 func_split_short_opt_name=${1%"$func_split_short_opt_arg"}
1242 } # Extended-shell func_split_short_opt implementation
1245 # func_split_long_opt longopt
1246 # Set func_split_long_opt_name and func_split_long_opt_arg shell
1247 # variables after splitting LONGOPT at the `=' sign.
1248 func_split_long_opt ()
1250 func_split_long_opt_name=${1%%=*}
1251 func_split_long_opt_arg=${1#*=}
1252 } # Extended-shell func_split_long_opt implementation
1260 magic="%%%MAGIC variable%%%"
1261 magic_exe="%%%MAGIC EXE variable%%%"
1266 lo2o="s/\\.lo\$/.${objext}/"
1267 o2lo="s/\\.${objext}\$/.lo/"
1271 # If this variable is set in any of the actions, the command in it
1272 # will be execed at the end. This prevents here-documents from being
1273 # left over by shells.
1276 # func_append var value
1277 # Append VALUE to the end of shell variable VAR.
1281 } # Extended-shell func_append implementation
1283 # func_append_quoted var value
1284 # Quote VALUE and append to the end of shell variable VAR, separated
1286 func_append_quoted ()
1288 func_quote_for_eval "${2}"
1289 eval "${1}+=\\ \$func_quote_for_eval_result"
1290 } # Extended-shell func_append_quoted implementation
1293 # func_arith arithmetic-term...
1296 func_arith_result=$(( $* ))
1297 } # Extended-shell func_arith implementation
1301 # STRING may not start with a hyphen.
1304 func_len_result=${#1}
1305 } # Extended-shell func_len implementation
1312 *.lo) func_lo2o_result=${1%.lo}.${objext} ;;
1313 *) func_lo2o_result=${1} ;;
1315 } # Extended-shell func_lo2o implementation
1318 # func_xform libobj-or-source
1321 func_xform_result=${1%.*}.lo
1322 } # Extended-shell func_xform implementation
1325 # func_fatal_configuration arg...
1326 # Echo program name prefixed message to standard error, followed by
1327 # a configuration failure hint, and exit.
1328 func_fatal_configuration ()
1330 func_error ${1+"$@"}
1331 func_error "See the $PACKAGE documentation for more information."
1332 func_fatal_error "Fatal configuration error."
1337 # Display the configuration for all the tags in this script.
1340 re_begincf='^# ### BEGIN LIBTOOL'
1341 re_endcf='^# ### END LIBTOOL'
1343 # Default configuration.
1344 $SED "1,/$re_begincf CONFIG/d;/$re_endcf CONFIG/,\$d" < "$progpath"
1346 # Now print the configurations for the tags.
1347 for tagname in $taglist; do
1348 $SED -n "/$re_begincf TAG CONFIG: $tagname\$/,/$re_endcf TAG CONFIG: $tagname\$/p" < "$progpath"
1355 # Display the features supported by this script.
1359 if test "$build_libtool_libs" = yes; then
1360 echo "enable shared libraries"
1362 echo "disable shared libraries"
1364 if test "$build_old_libs" = yes; then
1365 echo "enable static libraries"
1367 echo "disable static libraries"
1373 # func_enable_tag tagname
1374 # Verify that TAGNAME is valid, and either flag an error and exit, or
1375 # enable the TAGNAME tag. We also add TAGNAME to the global $taglist
1382 re_begincf="^# ### BEGIN LIBTOOL TAG CONFIG: $tagname\$"
1383 re_endcf="^# ### END LIBTOOL TAG CONFIG: $tagname\$"
1384 sed_extractcf="/$re_begincf/,/$re_endcf/p"
1389 func_fatal_error "invalid tag name: $tagname"
1393 # Don't test for the "default" C tag, as we know it's
1394 # there but not specially marked.
1398 if $GREP "$re_begincf" "$progpath" >/dev/null 2>&1; then
1399 taglist="$taglist $tagname"
1401 # Evaluate the configuration. Be careful to quote the path
1402 # and the sed script, to avoid splitting on whitespace, but
1403 # also don't use non-portable quotes within backquotes within
1404 # quotes we have to do it in 2 steps:
1405 extractedcf=`$SED -n -e "$sed_extractcf" < "$progpath"`
1408 func_error "ignoring unknown tag $tagname"
1414 # func_check_version_match
1415 # Ensure that we are using m4 macros, and libtool script from the same
1416 # release of libtool.
1417 func_check_version_match ()
1419 if test "$package_revision" != "$macro_revision"; then
1420 if test "$VERSION" != "$macro_version"; then
1421 if test -z "$macro_version"; then
1423 $progname: Version mismatch error. This is $PACKAGE $VERSION, but the
1424 $progname: definition of this LT_INIT comes from an older release.
1425 $progname: You should recreate aclocal.m4 with macros from $PACKAGE $VERSION
1426 $progname: and run autoconf again.
1430 $progname: Version mismatch error. This is $PACKAGE $VERSION, but the
1431 $progname: definition of this LT_INIT comes from $PACKAGE $macro_version.
1432 $progname: You should recreate aclocal.m4 with macros from $PACKAGE $VERSION
1433 $progname: and run autoconf again.
1438 $progname: Version mismatch error. This is $PACKAGE $VERSION, revision $package_revision,
1439 $progname: but the definition of this LT_INIT comes from revision $macro_revision.
1440 $progname: You should recreate aclocal.m4 with macros from revision $package_revision
1441 $progname: of $PACKAGE $VERSION and run autoconf again.
1450 # Shorthand for --mode=foo, only valid as the first argument
1453 shift; set dummy --mode clean ${1+"$@"}; shift
1455 compile|compil|compi|comp|com|co|c)
1456 shift; set dummy --mode compile ${1+"$@"}; shift
1458 execute|execut|execu|exec|exe|ex|e)
1459 shift; set dummy --mode execute ${1+"$@"}; shift
1461 finish|finis|fini|fin|fi|f)
1462 shift; set dummy --mode finish ${1+"$@"}; shift
1464 install|instal|insta|inst|ins|in|i)
1465 shift; set dummy --mode install ${1+"$@"}; shift
1468 shift; set dummy --mode link ${1+"$@"}; shift
1470 uninstall|uninstal|uninsta|uninst|unins|unin|uni|un|u)
1471 shift; set dummy --mode uninstall ${1+"$@"}; shift
1481 opt_preserve_dup_deps=false
1493 # Parse options once, thoroughly. This comes as soon as possible in the
1494 # script to make things like `--version' happen as quickly as we can.
1496 # this just eases exit handling
1497 while test $# -gt 0; do
1501 --debug|-x) opt_debug='set -x'
1502 func_echo "enabling shell trace mode"
1505 --dry-run|--dryrun|-n)
1514 opt_dlopen="${opt_dlopen+$opt_dlopen
1518 --preserve-dup-deps)
1519 opt_preserve_dup_deps=:
1527 set dummy --mode finish ${1+"$@"}; shift
1534 opt_help=': help-all'
1537 test $# = 0 && func_missing_arg $opt && break
1541 # Valid mode arguments:
1542 clean|compile|execute|finish|install|link|relink|uninstall) ;;
1544 # Catch anything else as an error
1545 *) func_error "invalid argument for $opt"
1552 --no-silent|--no-quiet)
1554 preserve_args+=" $opt"
1556 --no-warning|--no-warn)
1558 preserve_args+=" $opt"
1562 preserve_args+=" $opt"
1566 preserve_args+=" $opt"
1571 preserve_args+=" $opt"
1575 test $# = 0 && func_missing_arg $opt && break
1578 preserve_args+=" $opt $optarg"
1579 func_enable_tag "$optarg"
1583 -\?|-h) func_usage ;;
1584 --help) func_help ;;
1585 --version) func_version ;;
1587 # Separate optargs to long options:
1589 func_split_long_opt "$opt"
1590 set dummy "$func_split_long_opt_name" "$func_split_long_opt_arg" ${1+"$@"}
1594 # Separate non-argument short options:
1596 func_split_short_opt "$opt"
1597 set dummy "$func_split_short_opt_name" "-$func_split_short_opt_arg" ${1+"$@"}
1602 -*) func_fatal_help "unrecognized option \`$opt'" ;;
1603 *) set dummy "$opt" ${1+"$@"}; shift; break ;;
1609 # save first non-option argument
1610 if test "$#" -gt 0; then
1616 test "$opt_debug" = : || preserve_args+=" --debug"
1619 *cygwin* | *mingw* | *pw32* | *cegcc*)
1620 # don't eliminate duplications in $postdeps and $predeps
1621 opt_duplicate_compiler_generated_deps=:
1624 opt_duplicate_compiler_generated_deps=$opt_preserve_dup_deps
1629 # Sanity checks first:
1630 func_check_version_match
1632 if test "$build_libtool_libs" != yes && test "$build_old_libs" != yes; then
1633 func_fatal_configuration "not configured to build any kind of library"
1637 eval std_shrext=\"$shrext_cmds\"
1639 # Only execute mode is allowed to have -dlopen flags.
1640 if test -n "$opt_dlopen" && test "$opt_mode" != execute; then
1641 func_error "unrecognized option \`-dlopen'"
1646 # Change the help message to a mode-specific one.
1647 generic_help="$help"
1648 help="Try \`$progname --help --mode=$opt_mode' for more information."
1652 # Bail if the options were screwed
1653 $exit_cmd $EXIT_FAILURE
1664 # True iff FILE is a libtool `.la' library or `.lo' object file.
1665 # This function is only a basic sanity check; it will hardly flush out
1666 # determined imposters.
1670 $SED -e 4q "$1" 2>/dev/null \
1671 | $GREP "^# Generated by .*$PACKAGE" > /dev/null 2>&1
1674 # func_lalib_unsafe_p file
1675 # True iff FILE is a libtool `.la' library or `.lo' object file.
1676 # This function implements the same check as func_lalib_p without
1677 # resorting to external programs. To this end, it redirects stdin and
1678 # closes it afterwards, without saving the original file descriptor.
1679 # As a safety measure, use it only where a negative result would be
1680 # fatal anyway. Works if `file' does not exist.
1681 func_lalib_unsafe_p ()
1684 if test -f "$1" && test -r "$1" && exec 5<&0 <"$1"; then
1685 for lalib_p_l in 1 2 3 4
1688 case "$lalib_p_line" in
1689 \#\ Generated\ by\ *$PACKAGE* ) lalib_p=yes; break;;
1694 test "$lalib_p" = yes
1697 # func_ltwrapper_script_p file
1698 # True iff FILE is a libtool wrapper script
1699 # This function is only a basic sanity check; it will hardly flush out
1700 # determined imposters.
1701 func_ltwrapper_script_p ()
1706 # func_ltwrapper_executable_p file
1707 # True iff FILE is a libtool wrapper executable
1708 # This function is only a basic sanity check; it will hardly flush out
1709 # determined imposters.
1710 func_ltwrapper_executable_p ()
1712 func_ltwrapper_exec_suffix=
1715 *) func_ltwrapper_exec_suffix=.exe ;;
1717 $GREP "$magic_exe" "$1$func_ltwrapper_exec_suffix" >/dev/null 2>&1
1720 # func_ltwrapper_scriptname file
1721 # Assumes file is an ltwrapper_executable
1722 # uses $file to determine the appropriate filename for a
1723 # temporary ltwrapper_script.
1724 func_ltwrapper_scriptname ()
1726 func_dirname_and_basename "$1" "" "."
1727 func_stripname '' '.exe' "$func_basename_result"
1728 func_ltwrapper_scriptname_result="$func_dirname_result/$objdir/${func_stripname_result}_ltshwrapper"
1731 # func_ltwrapper_p file
1732 # True iff FILE is a libtool wrapper script or wrapper executable
1733 # This function is only a basic sanity check; it will hardly flush out
1734 # determined imposters.
1737 func_ltwrapper_script_p "$1" || func_ltwrapper_executable_p "$1"
1741 # func_execute_cmds commands fail_cmd
1742 # Execute tilde-delimited COMMANDS.
1743 # If FAIL_CMD is given, eval that upon failure.
1744 # FAIL_CMD may read-access the current command in variable CMD!
1745 func_execute_cmds ()
1748 save_ifs=$IFS; IFS='~'
1752 func_show_eval "$cmd" "${2-:}"
1759 # Source FILE, adding directory component if necessary.
1760 # Note that it is not necessary on cygwin/mingw to append a dot to
1761 # FILE even if both FILE and FILE.exe exist: automatic-append-.exe
1762 # behavior happens only for exec(3), not for open(2)! Also, sourcing
1763 # `FILE.' does not work on cygwin managed mounts.
1768 */* | *\\*) . "$1" ;;
1774 # func_resolve_sysroot PATH
1775 # Replace a leading = in PATH with a sysroot. Store the result into
1776 # func_resolve_sysroot_result
1777 func_resolve_sysroot ()
1779 func_resolve_sysroot_result=$1
1780 case $func_resolve_sysroot_result in
1782 func_stripname '=' '' "$func_resolve_sysroot_result"
1783 func_resolve_sysroot_result=$lt_sysroot$func_stripname_result
1788 # func_replace_sysroot PATH
1789 # If PATH begins with the sysroot, replace it with = and
1790 # store the result into func_replace_sysroot_result.
1791 func_replace_sysroot ()
1793 case "$lt_sysroot:$1" in
1795 func_stripname "$lt_sysroot" '' "$1"
1796 func_replace_sysroot_result="=$func_stripname_result"
1799 # Including no sysroot.
1800 func_replace_sysroot_result=$1
1805 # func_infer_tag arg
1806 # Infer tagged configuration to use if any are available and
1807 # if one wasn't chosen via the "--tag" command line option.
1808 # Only attempt this if the compiler in the base compile
1809 # command doesn't match the default compiler.
1810 # arg is usually of the form 'gcc ...'
1814 if test -n "$available_tags" && test -z "$tagname"; then
1817 func_append_quoted CC_quoted "$arg"
1819 CC_expanded=`func_echo_all $CC`
1820 CC_quoted_expanded=`func_echo_all $CC_quoted`
1822 # Blanks in the command may have been stripped by the calling shell,
1823 # but not from the CC environment variable when configure was run.
1824 " $CC "* | "$CC "* | " $CC_expanded "* | "$CC_expanded "* | \
1825 " $CC_quoted"* | "$CC_quoted "* | " $CC_quoted_expanded "* | "$CC_quoted_expanded "*) ;;
1826 # Blanks at the start of $base_compile will cause this to fail
1827 # if we don't check for them as well.
1829 for z in $available_tags; do
1830 if $GREP "^# ### BEGIN LIBTOOL TAG CONFIG: $z$" < "$progpath" > /dev/null; then
1831 # Evaluate the configuration.
1832 eval "`${SED} -n -e '/^# ### BEGIN LIBTOOL TAG CONFIG: '$z'$/,/^# ### END LIBTOOL TAG CONFIG: '$z'$/p' < $progpath`"
1835 # Double-quote args containing other shell metacharacters.
1836 func_append_quoted CC_quoted "$arg"
1838 CC_expanded=`func_echo_all $CC`
1839 CC_quoted_expanded=`func_echo_all $CC_quoted`
1841 " $CC "* | "$CC "* | " $CC_expanded "* | "$CC_expanded "* | \
1842 " $CC_quoted"* | "$CC_quoted "* | " $CC_quoted_expanded "* | "$CC_quoted_expanded "*)
1843 # The compiler in the base compile command matches
1844 # the one in the tagged configuration.
1845 # Assume this is the tagged configuration we want.
1852 # If $tagname still isn't set, then no tagged configuration
1853 # was found and let the user know that the "--tag" command
1854 # line option must be used.
1855 if test -z "$tagname"; then
1856 func_echo "unable to infer tagged configuration"
1857 func_fatal_error "specify a tag with \`--tag'"
1859 # func_verbose "using $tagname tagged configuration"
1868 # func_write_libtool_object output_name pic_name nonpic_name
1869 # Create a libtool object file (analogous to a ".la" file),
1870 # but don't create it if we're doing a dry run.
1871 func_write_libtool_object ()
1874 if test "$build_libtool_libs" = yes; then
1880 if test "$build_old_libs" = yes; then
1881 write_oldobj=\'${3}\'
1887 cat >${write_libobj}T <<EOF
1888 # $write_libobj - a libtool object file
1889 # Generated by $PROGRAM (GNU $PACKAGE$TIMESTAMP) $VERSION
1891 # Please DO NOT delete this file!
1892 # It is necessary for linking the library.
1894 # Name of the PIC object.
1895 pic_object=$write_lobj
1897 # Name of the non-PIC object
1898 non_pic_object=$write_oldobj
1901 $MV "${write_libobj}T" "${write_libobj}"
1906 ##################################################
1907 # FILE NAME AND PATH CONVERSION HELPER FUNCTIONS #
1908 ##################################################
1910 # func_convert_core_file_wine_to_w32 ARG
1911 # Helper function used by file name conversion functions when $build is *nix,
1912 # and $host is mingw, cygwin, or some other w32 environment. Relies on a
1913 # correctly configured wine environment available, with the winepath program
1914 # in $build's $PATH.
1916 # ARG is the $build file name to be converted to w32 format.
1917 # Result is available in $func_convert_core_file_wine_to_w32_result, and will
1918 # be empty on error (or when ARG is empty)
1919 func_convert_core_file_wine_to_w32 ()
1922 func_convert_core_file_wine_to_w32_result="$1"
1923 if test -n "$1"; then
1924 # Unfortunately, winepath does not exit with a non-zero error code, so we
1925 # are forced to check the contents of stdout. On the other hand, if the
1926 # command is not found, the shell will set an exit code of 127 and print
1927 # *an error message* to stdout. So we must check for both error code of
1928 # zero AND non-empty stdout, which explains the odd construction:
1929 func_convert_core_file_wine_to_w32_tmp=`winepath -w "$1" 2>/dev/null`
1930 if test "$?" -eq 0 && test -n "${func_convert_core_file_wine_to_w32_tmp}"; then
1931 func_convert_core_file_wine_to_w32_result=`$ECHO "$func_convert_core_file_wine_to_w32_tmp" |
1932 $SED -e "$lt_sed_naive_backslashify"`
1934 func_convert_core_file_wine_to_w32_result=
1938 # end: func_convert_core_file_wine_to_w32
1941 # func_convert_core_path_wine_to_w32 ARG
1942 # Helper function used by path conversion functions when $build is *nix, and
1943 # $host is mingw, cygwin, or some other w32 environment. Relies on a correctly
1944 # configured wine environment available, with the winepath program in $build's
1945 # $PATH. Assumes ARG has no leading or trailing path separator characters.
1947 # ARG is path to be converted from $build format to win32.
1948 # Result is available in $func_convert_core_path_wine_to_w32_result.
1949 # Unconvertible file (directory) names in ARG are skipped; if no directory names
1950 # are convertible, then the result may be empty.
1951 func_convert_core_path_wine_to_w32 ()
1954 # unfortunately, winepath doesn't convert paths, only file names
1955 func_convert_core_path_wine_to_w32_result=""
1956 if test -n "$1"; then
1959 for func_convert_core_path_wine_to_w32_f in $1; do
1961 func_convert_core_file_wine_to_w32 "$func_convert_core_path_wine_to_w32_f"
1962 if test -n "$func_convert_core_file_wine_to_w32_result" ; then
1963 if test -z "$func_convert_core_path_wine_to_w32_result"; then
1964 func_convert_core_path_wine_to_w32_result="$func_convert_core_file_wine_to_w32_result"
1966 func_append func_convert_core_path_wine_to_w32_result ";$func_convert_core_file_wine_to_w32_result"
1973 # end: func_convert_core_path_wine_to_w32
1976 # func_cygpath ARGS...
1977 # Wrapper around calling the cygpath program via LT_CYGPATH. This is used when
1978 # when (1) $build is *nix and Cygwin is hosted via a wine environment; or (2)
1979 # $build is MSYS and $host is Cygwin, or (3) $build is Cygwin. In case (1) or
1980 # (2), returns the Cygwin file name or path in func_cygpath_result (input
1981 # file name or path is assumed to be in w32 format, as previously converted
1982 # from $build's *nix or MSYS format). In case (3), returns the w32 file name
1983 # or path in func_cygpath_result (input file name or path is assumed to be in
1984 # Cygwin format). Returns an empty string on error.
1986 # ARGS are passed to cygpath, with the last one being the file name or path to
1989 # Specify the absolute *nix (or w32) name to cygpath in the LT_CYGPATH
1990 # environment variable; do not put it in $PATH.
1994 if test -n "$LT_CYGPATH" && test -f "$LT_CYGPATH"; then
1995 func_cygpath_result=`$LT_CYGPATH "$@" 2>/dev/null`
1996 if test "$?" -ne 0; then
1997 # on failure, ensure result is empty
1998 func_cygpath_result=
2001 func_cygpath_result=
2002 func_error "LT_CYGPATH is empty or specifies non-existent file: \`$LT_CYGPATH'"
2008 # func_convert_core_msys_to_w32 ARG
2009 # Convert file name or path ARG from MSYS format to w32 format. Return
2010 # result in func_convert_core_msys_to_w32_result.
2011 func_convert_core_msys_to_w32 ()
2014 # awkward: cmd appends spaces to result
2015 func_convert_core_msys_to_w32_result=`( cmd //c echo "$1" ) 2>/dev/null |
2016 $SED -e 's/[ ]*$//' -e "$lt_sed_naive_backslashify"`
2018 #end: func_convert_core_msys_to_w32
2021 # func_convert_file_check ARG1 ARG2
2022 # Verify that ARG1 (a file name in $build format) was converted to $host
2023 # format in ARG2. Otherwise, emit an error message, but continue (resetting
2024 # func_to_host_file_result to ARG1).
2025 func_convert_file_check ()
2028 if test -z "$2" && test -n "$1" ; then
2029 func_error "Could not determine host file name corresponding to"
2031 func_error "Continuing, but uninstalled executables may not work."
2033 func_to_host_file_result="$1"
2036 # end func_convert_file_check
2039 # func_convert_path_check FROM_PATHSEP TO_PATHSEP FROM_PATH TO_PATH
2040 # Verify that FROM_PATH (a path in $build format) was converted to $host
2041 # format in TO_PATH. Otherwise, emit an error message, but continue, resetting
2042 # func_to_host_file_result to a simplistic fallback value (see below).
2043 func_convert_path_check ()
2046 if test -z "$4" && test -n "$3"; then
2047 func_error "Could not determine the host path corresponding to"
2049 func_error "Continuing, but uninstalled executables may not work."
2050 # Fallback. This is a deliberately simplistic "conversion" and
2051 # should not be "improved". See libtool.info.
2052 if test "x$1" != "x$2"; then
2053 lt_replace_pathsep_chars="s|$1|$2|g"
2054 func_to_host_path_result=`echo "$3" |
2055 $SED -e "$lt_replace_pathsep_chars"`
2057 func_to_host_path_result="$3"
2061 # end func_convert_path_check
2064 # func_convert_path_front_back_pathsep FRONTPAT BACKPAT REPL ORIG
2065 # Modifies func_to_host_path_result by prepending REPL if ORIG matches FRONTPAT
2066 # and appending REPL if ORIG matches BACKPAT.
2067 func_convert_path_front_back_pathsep ()
2071 $1 ) func_to_host_path_result="$3$func_to_host_path_result"
2075 $2 ) func_to_host_path_result+="$3"
2079 # end func_convert_path_front_back_pathsep
2082 ##################################################
2083 # $build to $host FILE NAME CONVERSION FUNCTIONS #
2084 ##################################################
2085 # invoked via `$to_host_file_cmd ARG'
2087 # In each case, ARG is the path to be converted from $build to $host format.
2088 # Result will be available in $func_to_host_file_result.
2091 # func_to_host_file ARG
2092 # Converts the file name ARG from $build format to $host format. Return result
2093 # in func_to_host_file_result.
2094 func_to_host_file ()
2097 $to_host_file_cmd "$1"
2099 # end func_to_host_file
2102 # func_to_tool_file ARG LAZY
2103 # converts the file name ARG from $build format to toolchain format. Return
2104 # result in func_to_tool_file_result. If the conversion in use is listed
2105 # in (the comma separated) LAZY, no conversion takes place.
2106 func_to_tool_file ()
2110 *,"$to_tool_file_cmd",*)
2111 func_to_tool_file_result=$1
2114 $to_tool_file_cmd "$1"
2115 func_to_tool_file_result=$func_to_host_file_result
2119 # end func_to_tool_file
2122 # func_convert_file_noop ARG
2123 # Copy ARG to func_to_host_file_result.
2124 func_convert_file_noop ()
2126 func_to_host_file_result="$1"
2128 # end func_convert_file_noop
2131 # func_convert_file_msys_to_w32 ARG
2132 # Convert file name ARG from (mingw) MSYS to (mingw) w32 format; automatic
2133 # conversion to w32 is not available inside the cwrapper. Returns result in
2134 # func_to_host_file_result.
2135 func_convert_file_msys_to_w32 ()
2138 func_to_host_file_result="$1"
2139 if test -n "$1"; then
2140 func_convert_core_msys_to_w32 "$1"
2141 func_to_host_file_result="$func_convert_core_msys_to_w32_result"
2143 func_convert_file_check "$1" "$func_to_host_file_result"
2145 # end func_convert_file_msys_to_w32
2148 # func_convert_file_cygwin_to_w32 ARG
2149 # Convert file name ARG from Cygwin to w32 format. Returns result in
2150 # func_to_host_file_result.
2151 func_convert_file_cygwin_to_w32 ()
2154 func_to_host_file_result="$1"
2155 if test -n "$1"; then
2156 # because $build is cygwin, we call "the" cygpath in $PATH; no need to use
2157 # LT_CYGPATH in this case.
2158 func_to_host_file_result=`cygpath -m "$1"`
2160 func_convert_file_check "$1" "$func_to_host_file_result"
2162 # end func_convert_file_cygwin_to_w32
2165 # func_convert_file_nix_to_w32 ARG
2166 # Convert file name ARG from *nix to w32 format. Requires a wine environment
2167 # and a working winepath. Returns result in func_to_host_file_result.
2168 func_convert_file_nix_to_w32 ()
2171 func_to_host_file_result="$1"
2172 if test -n "$1"; then
2173 func_convert_core_file_wine_to_w32 "$1"
2174 func_to_host_file_result="$func_convert_core_file_wine_to_w32_result"
2176 func_convert_file_check "$1" "$func_to_host_file_result"
2178 # end func_convert_file_nix_to_w32
2181 # func_convert_file_msys_to_cygwin ARG
2182 # Convert file name ARG from MSYS to Cygwin format. Requires LT_CYGPATH set.
2183 # Returns result in func_to_host_file_result.
2184 func_convert_file_msys_to_cygwin ()
2187 func_to_host_file_result="$1"
2188 if test -n "$1"; then
2189 func_convert_core_msys_to_w32 "$1"
2190 func_cygpath -u "$func_convert_core_msys_to_w32_result"
2191 func_to_host_file_result="$func_cygpath_result"
2193 func_convert_file_check "$1" "$func_to_host_file_result"
2195 # end func_convert_file_msys_to_cygwin
2198 # func_convert_file_nix_to_cygwin ARG
2199 # Convert file name ARG from *nix to Cygwin format. Requires Cygwin installed
2200 # in a wine environment, working winepath, and LT_CYGPATH set. Returns result
2201 # in func_to_host_file_result.
2202 func_convert_file_nix_to_cygwin ()
2205 func_to_host_file_result="$1"
2206 if test -n "$1"; then
2207 # convert from *nix to w32, then use cygpath to convert from w32 to cygwin.
2208 func_convert_core_file_wine_to_w32 "$1"
2209 func_cygpath -u "$func_convert_core_file_wine_to_w32_result"
2210 func_to_host_file_result="$func_cygpath_result"
2212 func_convert_file_check "$1" "$func_to_host_file_result"
2214 # end func_convert_file_nix_to_cygwin
2217 #############################################
2218 # $build to $host PATH CONVERSION FUNCTIONS #
2219 #############################################
2220 # invoked via `$to_host_path_cmd ARG'
2222 # In each case, ARG is the path to be converted from $build to $host format.
2223 # The result will be available in $func_to_host_path_result.
2225 # Path separators are also converted from $build format to $host format. If
2226 # ARG begins or ends with a path separator character, it is preserved (but
2227 # converted to $host format) on output.
2229 # All path conversion functions are named using the following convention:
2230 # file name conversion function : func_convert_file_X_to_Y ()
2231 # path conversion function : func_convert_path_X_to_Y ()
2232 # where, for any given $build/$host combination the 'X_to_Y' value is the
2233 # same. If conversion functions are added for new $build/$host combinations,
2234 # the two new functions must follow this pattern, or func_init_to_host_path_cmd
2238 # func_init_to_host_path_cmd
2239 # Ensures that function "pointer" variable $to_host_path_cmd is set to the
2240 # appropriate value, based on the value of $to_host_file_cmd.
2242 func_init_to_host_path_cmd ()
2245 if test -z "$to_host_path_cmd"; then
2246 func_stripname 'func_convert_file_' '' "$to_host_file_cmd"
2247 to_host_path_cmd="func_convert_path_${func_stripname_result}"
2252 # func_to_host_path ARG
2253 # Converts the path ARG from $build format to $host format. Return result
2254 # in func_to_host_path_result.
2255 func_to_host_path ()
2258 func_init_to_host_path_cmd
2259 $to_host_path_cmd "$1"
2261 # end func_to_host_path
2264 # func_convert_path_noop ARG
2265 # Copy ARG to func_to_host_path_result.
2266 func_convert_path_noop ()
2268 func_to_host_path_result="$1"
2270 # end func_convert_path_noop
2273 # func_convert_path_msys_to_w32 ARG
2274 # Convert path ARG from (mingw) MSYS to (mingw) w32 format; automatic
2275 # conversion to w32 is not available inside the cwrapper. Returns result in
2276 # func_to_host_path_result.
2277 func_convert_path_msys_to_w32 ()
2280 func_to_host_path_result="$1"
2281 if test -n "$1"; then
2282 # Remove leading and trailing path separator characters from ARG. MSYS
2283 # behavior is inconsistent here; cygpath turns them into '.;' and ';.';
2284 # and winepath ignores them completely.
2285 func_stripname : : "$1"
2286 func_to_host_path_tmp1=$func_stripname_result
2287 func_convert_core_msys_to_w32 "$func_to_host_path_tmp1"
2288 func_to_host_path_result="$func_convert_core_msys_to_w32_result"
2289 func_convert_path_check : ";" \
2290 "$func_to_host_path_tmp1" "$func_to_host_path_result"
2291 func_convert_path_front_back_pathsep ":*" "*:" ";" "$1"
2294 # end func_convert_path_msys_to_w32
2297 # func_convert_path_cygwin_to_w32 ARG
2298 # Convert path ARG from Cygwin to w32 format. Returns result in
2299 # func_to_host_file_result.
2300 func_convert_path_cygwin_to_w32 ()
2303 func_to_host_path_result="$1"
2304 if test -n "$1"; then
2305 # See func_convert_path_msys_to_w32:
2306 func_stripname : : "$1"
2307 func_to_host_path_tmp1=$func_stripname_result
2308 func_to_host_path_result=`cygpath -m -p "$func_to_host_path_tmp1"`
2309 func_convert_path_check : ";" \
2310 "$func_to_host_path_tmp1" "$func_to_host_path_result"
2311 func_convert_path_front_back_pathsep ":*" "*:" ";" "$1"
2314 # end func_convert_path_cygwin_to_w32
2317 # func_convert_path_nix_to_w32 ARG
2318 # Convert path ARG from *nix to w32 format. Requires a wine environment and
2319 # a working winepath. Returns result in func_to_host_file_result.
2320 func_convert_path_nix_to_w32 ()
2323 func_to_host_path_result="$1"
2324 if test -n "$1"; then
2325 # See func_convert_path_msys_to_w32:
2326 func_stripname : : "$1"
2327 func_to_host_path_tmp1=$func_stripname_result
2328 func_convert_core_path_wine_to_w32 "$func_to_host_path_tmp1"
2329 func_to_host_path_result="$func_convert_core_path_wine_to_w32_result"
2330 func_convert_path_check : ";" \
2331 "$func_to_host_path_tmp1" "$func_to_host_path_result"
2332 func_convert_path_front_back_pathsep ":*" "*:" ";" "$1"
2335 # end func_convert_path_nix_to_w32
2338 # func_convert_path_msys_to_cygwin ARG
2339 # Convert path ARG from MSYS to Cygwin format. Requires LT_CYGPATH set.
2340 # Returns result in func_to_host_file_result.
2341 func_convert_path_msys_to_cygwin ()
2344 func_to_host_path_result="$1"
2345 if test -n "$1"; then
2346 # See func_convert_path_msys_to_w32:
2347 func_stripname : : "$1"
2348 func_to_host_path_tmp1=$func_stripname_result
2349 func_convert_core_msys_to_w32 "$func_to_host_path_tmp1"
2350 func_cygpath -u -p "$func_convert_core_msys_to_w32_result"
2351 func_to_host_path_result="$func_cygpath_result"
2352 func_convert_path_check : : \
2353 "$func_to_host_path_tmp1" "$func_to_host_path_result"
2354 func_convert_path_front_back_pathsep ":*" "*:" : "$1"
2357 # end func_convert_path_msys_to_cygwin
2360 # func_convert_path_nix_to_cygwin ARG
2361 # Convert path ARG from *nix to Cygwin format. Requires Cygwin installed in a
2362 # a wine environment, working winepath, and LT_CYGPATH set. Returns result in
2363 # func_to_host_file_result.
2364 func_convert_path_nix_to_cygwin ()
2367 func_to_host_path_result="$1"
2368 if test -n "$1"; then
2369 # Remove leading and trailing path separator characters from
2370 # ARG. msys behavior is inconsistent here, cygpath turns them
2371 # into '.;' and ';.', and winepath ignores them completely.
2372 func_stripname : : "$1"
2373 func_to_host_path_tmp1=$func_stripname_result
2374 func_convert_core_path_wine_to_w32 "$func_to_host_path_tmp1"
2375 func_cygpath -u -p "$func_convert_core_path_wine_to_w32_result"
2376 func_to_host_path_result="$func_cygpath_result"
2377 func_convert_path_check : : \
2378 "$func_to_host_path_tmp1" "$func_to_host_path_result"
2379 func_convert_path_front_back_pathsep ":*" "*:" : "$1"
2382 # end func_convert_path_nix_to_cygwin
2385 # func_mode_compile arg...
2386 func_mode_compile ()
2389 # Get the compilation command and the source file.
2391 srcfile="$nonopt" # always keep a non-empty value in "srcfile"
2403 # do not "continue". Instead, add this to base_compile
2415 # Accept any command-line options.
2418 test -n "$libobj" && \
2419 func_fatal_error "you cannot specify \`-o' more than once"
2424 -pie | -fpie | -fPIE)
2429 -shared | -static | -prefer-pic | -prefer-non-pic)
2440 arg_mode=arg # the next one goes into the "base_compile" arg list
2441 continue # The current "srcfile" will either be retained or
2442 ;; # replaced later. I would guess that would be a bug.
2445 func_stripname '-Wc,' '' "$arg"
2446 args=$func_stripname_result
2448 save_ifs="$IFS"; IFS=','
2449 for arg in $args; do
2451 func_append_quoted lastarg "$arg"
2454 func_stripname ' ' '' "$lastarg"
2455 lastarg=$func_stripname_result
2457 # Add the arguments to base_compile.
2458 base_compile+=" $lastarg"
2463 # Accept the current argument as the source file.
2464 # The previous "srcfile" becomes the current argument.
2471 esac # case $arg_mode
2473 # Aesthetically quote the previous argument.
2474 func_append_quoted base_compile "$lastarg"
2479 func_fatal_error "you must specify an argument for -Xcompile"
2482 func_fatal_error "you must specify a target with \`-o'"
2485 # Get the name of the library object.
2486 test -z "$libobj" && {
2487 func_basename "$srcfile"
2488 libobj="$func_basename_result"
2493 # Recognize several different file suffixes.
2494 # If the user specifies -o file.o, it is replaced with file.lo
2497 *.ada | *.adb | *.ads | *.asm | \
2498 *.c++ | *.cc | *.ii | *.class | *.cpp | *.cxx | \
2499 *.[fF][09]? | *.for | *.java | *.go | *.obj | *.sx | *.cu | *.cup)
2500 func_xform "$libobj"
2501 libobj=$func_xform_result
2506 *.lo) func_lo2o "$libobj"; obj=$func_lo2o_result ;;
2508 func_fatal_error "cannot determine name of library object from \`$libobj'"
2512 func_infer_tag $base_compile
2514 for arg in $later; do
2517 test "$build_libtool_libs" != yes && \
2518 func_fatal_configuration "can not build a shared library"
2524 build_libtool_libs=no
2541 func_quote_for_eval "$libobj"
2542 test "X$libobj" != "X$func_quote_for_eval_result" \
2543 && $ECHO "X$libobj" | $GREP '[]~#^*{};<>?"'"'"' &()|`$[]' \
2544 && func_warning "libobj name \`$libobj' may not contain shell special characters."
2545 func_dirname_and_basename "$obj" "/" ""
2546 objname="$func_basename_result"
2547 xdir="$func_dirname_result"
2548 lobj=${xdir}$objdir/$objname
2550 test -z "$base_compile" && \
2551 func_fatal_help "you must specify a compilation command"
2553 # Delete any leftover library objects.
2554 if test "$build_old_libs" = yes; then
2555 removelist="$obj $lobj $libobj ${libobj}T"
2557 removelist="$lobj $libobj ${libobj}T"
2560 # On Cygwin there's no "real" PIC flag so we must build both object types
2562 cygwin* | mingw* | pw32* | os2* | cegcc*)
2566 if test "$pic_mode" = no && test "$deplibs_check_method" != pass_all; then
2567 # non-PIC code in shared libraries is not supported
2571 # Calculate the filename of the output object if compiler does
2572 # not support -o with -c
2573 if test "$compiler_c_o" = no; then
2574 output_obj=`$ECHO "$srcfile" | $SED 's%^.*/%%; s%\.[^.]*$%%'`.${objext}
2575 lockfile="$output_obj.lock"
2582 # Lock this critical section if it is needed
2583 # We use this script file to make the link, it avoids creating a new file
2584 if test "$need_locks" = yes; then
2585 until $opt_dry_run || ln "$progpath" "$lockfile" 2>/dev/null; do
2586 func_echo "Waiting for $lockfile to be removed"
2589 elif test "$need_locks" = warn; then
2590 if test -f "$lockfile"; then
2592 *** ERROR, $lockfile exists and contains:
2593 `cat $lockfile 2>/dev/null`
2595 This indicates that another process is trying to use the same
2596 temporary object file, and libtool could not work around it because
2597 your compiler does not support \`-c' and \`-o' together. If you
2598 repeat this compilation, it may succeed, by chance, but you had better
2599 avoid parallel builds (make -j) in this platform, or get a better
2602 $opt_dry_run || $RM $removelist
2605 removelist+=" $output_obj"
2606 $ECHO "$srcfile" > "$lockfile"
2609 $opt_dry_run || $RM $removelist
2610 removelist+=" $lockfile"
2611 trap '$opt_dry_run || $RM $removelist; exit $EXIT_FAILURE' 1 2 15
2613 func_to_tool_file "$srcfile" func_convert_file_msys_to_w32
2614 srcfile=$func_to_tool_file_result
2615 func_quote_for_eval "$srcfile"
2616 qsrcfile=$func_quote_for_eval_result
2618 # Only build a PIC object if we are building libtool libraries.
2619 if test "$build_libtool_libs" = yes; then
2620 # Without this assignment, base_compile gets emptied.
2621 fbsd_hideous_sh_bug=$base_compile
2623 if test "$pic_mode" != no; then
2624 command="$base_compile $qsrcfile $pic_flag"
2626 # Don't build PIC code
2627 command="$base_compile $qsrcfile"
2630 func_mkdir_p "$xdir$objdir"
2632 if test -z "$output_obj"; then
2633 # Place PIC objects in $objdir
2634 command+=" -o $lobj"
2637 func_show_eval_locale "$command" \
2638 'test -n "$output_obj" && $RM $removelist; exit $EXIT_FAILURE'
2640 if test "$need_locks" = warn &&
2641 test "X`cat $lockfile 2>/dev/null`" != "X$srcfile"; then
2643 *** ERROR, $lockfile contains:
2644 `cat $lockfile 2>/dev/null`
2646 but it should contain:
2649 This indicates that another process is trying to use the same
2650 temporary object file, and libtool could not work around it because
2651 your compiler does not support \`-c' and \`-o' together. If you
2652 repeat this compilation, it may succeed, by chance, but you had better
2653 avoid parallel builds (make -j) in this platform, or get a better
2656 $opt_dry_run || $RM $removelist
2660 # Just move the object if needed, then go on to compile the next one
2661 if test -n "$output_obj" && test "X$output_obj" != "X$lobj"; then
2662 func_show_eval '$MV "$output_obj" "$lobj"' \
2663 'error=$?; $opt_dry_run || $RM $removelist; exit $error'
2666 # Allow error messages only from the first compilation.
2667 if test "$suppress_opt" = yes; then
2668 suppress_output=' >/dev/null 2>&1'
2672 # Only build a position-dependent object if we build old libraries.
2673 if test "$build_old_libs" = yes; then
2674 if test "$pic_mode" != yes; then
2675 # Don't build PIC code
2676 command="$base_compile $qsrcfile$pie_flag"
2678 command="$base_compile $qsrcfile $pic_flag"
2680 if test "$compiler_c_o" = yes; then
2684 # Suppress compiler output if we already did a PIC compilation.
2685 command+="$suppress_output"
2686 func_show_eval_locale "$command" \
2687 '$opt_dry_run || $RM $removelist; exit $EXIT_FAILURE'
2689 if test "$need_locks" = warn &&
2690 test "X`cat $lockfile 2>/dev/null`" != "X$srcfile"; then
2692 *** ERROR, $lockfile contains:
2693 `cat $lockfile 2>/dev/null`
2695 but it should contain:
2698 This indicates that another process is trying to use the same
2699 temporary object file, and libtool could not work around it because
2700 your compiler does not support \`-c' and \`-o' together. If you
2701 repeat this compilation, it may succeed, by chance, but you had better
2702 avoid parallel builds (make -j) in this platform, or get a better
2705 $opt_dry_run || $RM $removelist
2709 # Just move the object if needed
2710 if test -n "$output_obj" && test "X$output_obj" != "X$obj"; then
2711 func_show_eval '$MV "$output_obj" "$obj"' \
2712 'error=$?; $opt_dry_run || $RM $removelist; exit $error'
2717 func_write_libtool_object "$libobj" "$objdir/$objname" "$objname"
2719 # Unlock the critical section if it was locked
2720 if test "$need_locks" != no; then
2721 removelist=$lockfile
2730 test "$opt_mode" = compile && func_mode_compile ${1+"$@"}
2735 # We need to display help for each of the modes.
2738 # Generic help is extracted from the usage comments
2739 # at the start of this file.
2745 "Usage: $progname [OPTION]... --mode=clean RM [RM-OPTION]... FILE...
2747 Remove files from the build directory.
2749 RM is the name of the program to use to delete files associated with each FILE
2750 (typically \`/bin/rm'). RM-OPTIONS are options (such as \`-f') to be passed
2753 If FILE is a libtool library, object or program, all the files associated
2754 with it are deleted. Otherwise, only FILE itself is deleted using RM."
2759 "Usage: $progname [OPTION]... --mode=compile COMPILE-COMMAND... SOURCEFILE
2761 Compile a source file into a libtool library object.
2763 This mode accepts the following additional options:
2765 -o OUTPUT-FILE set the output file name to OUTPUT-FILE
2766 -no-suppress do not suppress compiler output for multiple passes
2767 -prefer-pic try to build PIC objects only
2768 -prefer-non-pic try to build non-PIC objects only
2769 -shared do not build a \`.o' file suitable for static linking
2770 -static only build a \`.o' file suitable for static linking
2771 -Wc,FLAG pass FLAG directly to the compiler
2773 COMPILE-COMMAND is a command to be used in creating a \`standard' object file
2774 from the given SOURCEFILE.
2776 The output file name is determined by removing the directory component from
2777 SOURCEFILE, then substituting the C source code suffix \`.c' with the
2778 library object suffix, \`.lo'."
2783 "Usage: $progname [OPTION]... --mode=execute COMMAND [ARGS]...
2785 Automatically set library path, then run a program.
2787 This mode accepts the following additional options:
2789 -dlopen FILE add the directory containing FILE to the library path
2791 This mode sets the library path environment variable according to \`-dlopen'
2794 If any of the ARGS are libtool executable wrappers, then they are translated
2795 into their corresponding uninstalled binary, and any of their required library
2796 directories are added to the library path.
2798 Then, COMMAND is executed, with ARGS as arguments."
2803 "Usage: $progname [OPTION]... --mode=finish [LIBDIR]...
2805 Complete the installation of libtool libraries.
2807 Each LIBDIR is a directory that contains libtool libraries.
2809 The commands that this mode executes may require superuser privileges. Use
2810 the \`--dry-run' option if you just want to see what would be executed."
2815 "Usage: $progname [OPTION]... --mode=install INSTALL-COMMAND...
2817 Install executables or libraries.
2819 INSTALL-COMMAND is the installation command. The first component should be
2820 either the \`install' or \`cp' program.
2822 The following components of INSTALL-COMMAND are treated specially:
2824 -inst-prefix-dir PREFIX-DIR Use PREFIX-DIR as a staging area for installation
2826 The rest of the components are interpreted as arguments to that command (only
2827 BSD-compatible install options are recognized)."
2832 "Usage: $progname [OPTION]... --mode=link LINK-COMMAND...
2834 Link object files or libraries together to form another library, or to
2835 create an executable program.
2837 LINK-COMMAND is a command using the C compiler that you would use to create
2838 a program from several object files.
2840 The following components of LINK-COMMAND are treated specially:
2842 -all-static do not do any dynamic linking at all
2843 -avoid-version do not add a version suffix if possible
2844 -bindir BINDIR specify path to binaries directory (for systems where
2845 libraries must be found in the PATH setting at runtime)
2846 -dlopen FILE \`-dlpreopen' FILE if it cannot be dlopened at runtime
2847 -dlpreopen FILE link in FILE and add its symbols to lt_preloaded_symbols
2848 -export-dynamic allow symbols from OUTPUT-FILE to be resolved with dlsym(3)
2849 -export-symbols SYMFILE
2850 try to export only the symbols listed in SYMFILE
2851 -export-symbols-regex REGEX
2852 try to export only the symbols matching REGEX
2853 -LLIBDIR search LIBDIR for required installed libraries
2854 -lNAME OUTPUT-FILE requires the installed library libNAME
2855 -module build a library that can dlopened
2856 -no-fast-install disable the fast-install mode
2857 -no-install link a not-installable executable
2858 -no-undefined declare that a library does not refer to external symbols
2859 -o OUTPUT-FILE create OUTPUT-FILE from the specified objects
2860 -objectlist FILE Use a list of object files found in FILE to specify objects
2861 -precious-files-regex REGEX
2862 don't remove output files matching REGEX
2863 -release RELEASE specify package release information
2864 -rpath LIBDIR the created library will eventually be installed in LIBDIR
2865 -R[ ]LIBDIR add LIBDIR to the runtime path of programs and libraries
2866 -shared only do dynamic linking of libtool libraries
2867 -shrext SUFFIX override the standard shared library file extension
2868 -static do not do any dynamic linking of uninstalled libtool libraries
2869 -static-libtool-libs
2870 do not do any dynamic linking of libtool libraries
2871 -version-info CURRENT[:REVISION[:AGE]]
2872 specify library version info [each variable defaults to 0]
2873 -weak LIBNAME declare that the target provides the LIBNAME interface
2875 -Xcompiler FLAG pass linker-specific FLAG directly to the compiler
2877 -Xlinker FLAG pass linker-specific FLAG directly to the linker
2878 -XCClinker FLAG pass link-specific FLAG to the compiler driver (CC)
2880 All other options (arguments beginning with \`-') are ignored.
2882 Every other argument is treated as a filename. Files ending in \`.la' are
2883 treated as uninstalled libtool libraries, other files are standard or library
2886 If the OUTPUT-FILE ends in \`.la', then a libtool library is created,
2887 only library objects (\`.lo' files) may be specified, and \`-rpath' is
2888 required, except when creating a convenience library.
2890 If OUTPUT-FILE ends in \`.a' or \`.lib', then a standard library is created
2891 using \`ar' and \`ranlib', or on Windows using \`lib'.
2893 If OUTPUT-FILE ends in \`.lo' or \`.${objext}', then a reloadable object file
2894 is created, otherwise an executable program is created."
2899 "Usage: $progname [OPTION]... --mode=uninstall RM [RM-OPTION]... FILE...
2901 Remove libraries from an installation directory.
2903 RM is the name of the program to use to delete files associated with each FILE
2904 (typically \`/bin/rm'). RM-OPTIONS are options (such as \`-f') to be passed
2907 If FILE is a libtool library, all the files associated with it are deleted.
2908 Otherwise, only FILE itself is deleted using RM."
2912 func_fatal_help "invalid operation mode \`$opt_mode'"
2917 $ECHO "Try \`$progname --help' for more information about other modes."
2920 # Now that we've collected a possible --mode arg, show help if necessary
2922 if test "$opt_help" = :; then
2927 for opt_mode in compile link execute install finish uninstall clean; do
2930 } | sed -n '1p; 2,$s/^Usage:/ or: /p'
2933 for opt_mode in compile link execute install finish uninstall clean; do
2939 /^When reporting/,/^Report/{
2944 /information about other modes/d
2945 /more detailed .*MODE/d
2946 s/^Usage:.*--mode=\([^ ]*\) .*/Description of \1 mode:/'
2952 # func_mode_execute arg...
2953 func_mode_execute ()
2956 # The first argument is the command name.
2959 func_fatal_help "you must specify a COMMAND"
2961 # Handle -dlopen flags immediately.
2962 for file in $opt_dlopen; do
2964 || func_fatal_help "\`$file' is not a file"
2969 func_resolve_sysroot "$file"
2970 file=$func_resolve_sysroot_result
2972 # Check to see that this really is a libtool archive.
2973 func_lalib_unsafe_p "$file" \
2974 || func_fatal_help "\`$lib' is not a valid libtool archive"
2976 # Read the libtool library.
2981 # Skip this library if it cannot be dlopened.
2982 if test -z "$dlname"; then
2983 # Warn if it was a shared library.
2984 test -n "$library_names" && \
2985 func_warning "\`$file' was not linked with \`-export-dynamic'"
2989 func_dirname "$file" "" "."
2990 dir="$func_dirname_result"
2992 if test -f "$dir/$objdir/$dlname"; then
2995 if test ! -f "$dir/$dlname"; then
2996 func_fatal_error "cannot find \`$dlname' in \`$dir' or \`$dir/$objdir'"
3002 # Just add the directory containing the .lo file.
3003 func_dirname "$file" "" "."
3004 dir="$func_dirname_result"
3008 func_warning "\`-dlopen' is ignored for non-libtool libraries and objects"
3013 # Get the absolute pathname.
3014 absdir=`cd "$dir" && pwd`
3015 test -n "$absdir" && dir="$absdir"
3017 # Now add the directory to shlibpath_var.
3018 if eval "test -z \"\$$shlibpath_var\""; then
3019 eval "$shlibpath_var=\"\$dir\""
3021 eval "$shlibpath_var=\"\$dir:\$$shlibpath_var\""
3025 # This variable tells wrapper scripts just to set shlibpath_var
3026 # rather than running their programs.
3027 libtool_execute_magic="$magic"
3029 # Check if any of the arguments is a wrapper script.
3034 -* | *.la | *.lo ) ;;
3036 # Do a test to see if this is really a libtool program.
3037 if func_ltwrapper_script_p "$file"; then
3039 # Transform arg to wrapped name.
3040 file="$progdir/$program"
3041 elif func_ltwrapper_executable_p "$file"; then
3042 func_ltwrapper_scriptname "$file"
3043 func_source "$func_ltwrapper_scriptname_result"
3044 # Transform arg to wrapped name.
3045 file="$progdir/$program"
3049 # Quote arguments (to preserve shell metacharacters).
3050 func_append_quoted args "$file"
3053 if test "X$opt_dry_run" = Xfalse; then
3054 if test -n "$shlibpath_var"; then
3055 # Export the shlibpath_var.
3056 eval "export $shlibpath_var"
3059 # Restore saved environment variables
3060 for lt_var in LANG LANGUAGE LC_ALL LC_CTYPE LC_COLLATE LC_MESSAGES
3062 eval "if test \"\${save_$lt_var+set}\" = set; then
3063 $lt_var=\$save_$lt_var; export $lt_var
3069 # Now prepare to actually exec the command.
3070 exec_cmd="\$cmd$args"
3072 # Display what would be done.
3073 if test -n "$shlibpath_var"; then
3074 eval "\$ECHO \"\$shlibpath_var=\$$shlibpath_var\""
3075 echo "export $shlibpath_var"
3082 test "$opt_mode" = execute && func_mode_execute ${1+"$@"}
3085 # func_mode_finish arg...
3093 for opt in "$nonopt" ${1+"$@"}
3095 if test -d "$opt"; then
3098 elif test -f "$opt"; then
3099 if func_lalib_unsafe_p "$opt"; then
3102 func_warning "\`$opt' is not a valid libtool archive"
3106 func_fatal_error "invalid argument \`$opt'"
3110 if test -n "$libs"; then
3111 if test -n "$lt_sysroot"; then
3112 sysroot_regex=`$ECHO "$lt_sysroot" | $SED "$sed_make_literal_regex"`
3113 sysroot_cmd="s/\([ ']\)$sysroot_regex/\1/g;"
3118 # Remove sysroot references
3119 if $opt_dry_run; then
3120 for lib in $libs; do
3121 echo "removing references to $lt_sysroot and \`=' prefixes from $lib"
3124 tmpdir=`func_mktempdir`
3125 for lib in $libs; do
3126 sed -e "${sysroot_cmd} s/\([ ']-[LR]\)=/\1/g; s/\([ ']\)=/\1/g" $lib \
3128 mv -f $tmpdir/tmp-la $lib
3134 if test -n "$finish_cmds$finish_eval" && test -n "$libdirs"; then
3135 for libdir in $libdirs; do
3136 if test -n "$finish_cmds"; then
3137 # Do each command in the finish commands.
3138 func_execute_cmds "$finish_cmds" 'admincmds="$admincmds
3141 if test -n "$finish_eval"; then
3142 # Do the single finish_eval.
3143 eval cmds=\"$finish_eval\"
3144 $opt_dry_run || eval "$cmds" || admincmds+="
3150 # Exit here if they wanted silent mode.
3151 $opt_silent && exit $EXIT_SUCCESS
3153 if test -n "$finish_cmds$finish_eval" && test -n "$libdirs"; then
3154 echo "----------------------------------------------------------------------"
3155 echo "Libraries have been installed in:"
3156 for libdir in $libdirs; do
3160 echo "If you ever happen to want to link against installed libraries"
3161 echo "in a given directory, LIBDIR, you must either use libtool, and"
3162 echo "specify the full pathname of the library, or use the \`-LLIBDIR'"
3163 echo "flag during linking and do at least one of the following:"
3164 if test -n "$shlibpath_var"; then
3165 echo " - add LIBDIR to the \`$shlibpath_var' environment variable"
3166 echo " during execution"
3168 if test -n "$runpath_var"; then
3169 echo " - add LIBDIR to the \`$runpath_var' environment variable"
3170 echo " during linking"
3172 if test -n "$hardcode_libdir_flag_spec"; then
3174 eval flag=\"$hardcode_libdir_flag_spec\"
3176 $ECHO " - use the \`$flag' linker flag"
3178 if test -n "$admincmds"; then
3179 $ECHO " - have your system administrator run these commands:$admincmds"
3181 if test -f /etc/ld.so.conf; then
3182 echo " - have your system administrator add LIBDIR to \`/etc/ld.so.conf'"
3186 echo "See any operating system documentation about shared libraries for"
3188 solaris2.[6789]|solaris2.1[0-9])
3189 echo "more information, such as the ld(1), crle(1) and ld.so(8) manual"
3193 echo "more information, such as the ld(1) and ld.so(8) manual pages."
3196 echo "----------------------------------------------------------------------"
3201 test "$opt_mode" = finish && func_mode_finish ${1+"$@"}
3204 # func_mode_install arg...
3205 func_mode_install ()
3208 # There may be an optional sh(1) argument at the beginning of
3209 # install_prog (especially on Windows NT).
3210 if test "$nonopt" = "$SHELL" || test "$nonopt" = /bin/sh ||
3211 # Allow the use of GNU shtool's install command.
3212 case $nonopt in *shtool*) :;; *) false;; esac; then
3213 # Aesthetically quote it.
3214 func_quote_for_eval "$nonopt"
3215 install_prog="$func_quote_for_eval_result "
3223 # The real first argument should be the name of the installation program.
3224 # Aesthetically quote it.
3225 func_quote_for_eval "$arg"
3226 install_prog+="$func_quote_for_eval_result"
3227 install_shared_prog=$install_prog
3228 case " $install_prog " in
3229 *[\\\ /]cp\ *) install_cp=: ;;
3230 *) install_cp=false ;;
3233 # We need to accept at least all the BSD install flags.
3245 if test -n "$dest"; then
3254 if $install_cp; then :; else
3268 # If the previous option needed an argument, then skip it.
3269 if test -n "$prev"; then
3270 if test "x$prev" = x-m && test -n "$install_override_mode"; then
3271 arg2=$install_override_mode
3282 # Aesthetically quote the argument.
3283 func_quote_for_eval "$arg"
3284 install_prog+=" $func_quote_for_eval_result"
3285 if test -n "$arg2"; then
3286 func_quote_for_eval "$arg2"
3288 install_shared_prog+=" $func_quote_for_eval_result"
3291 test -z "$install_prog" && \
3292 func_fatal_help "you must specify an install program"
3294 test -n "$prev" && \
3295 func_fatal_help "the \`$prev' option requires an argument"
3297 if test -n "$install_override_mode" && $no_mode; then
3298 if $install_cp; then :; else
3299 func_quote_for_eval "$install_override_mode"
3300 install_shared_prog+=" -m $func_quote_for_eval_result"
3304 if test -z "$files"; then
3305 if test -z "$dest"; then
3306 func_fatal_help "no file or destination specified"
3308 func_fatal_help "you must specify a destination"
3312 # Strip any trailing slash from the destination.
3313 func_stripname '' '/' "$dest"
3314 dest=$func_stripname_result
3316 # Check to see that the destination is a directory.
3317 test -d "$dest" && isdir=yes
3318 if test "$isdir" = yes; then
3322 func_dirname_and_basename "$dest" "" "."
3323 destdir="$func_dirname_result"
3324 destname="$func_basename_result"
3326 # Not a directory, so check to see that there is only one file specified.
3327 set dummy $files; shift
3328 test "$#" -gt 1 && \
3329 func_fatal_help "\`$dest' is not a directory"
3332 [\\/]* | [A-Za-z]:[\\/]*) ;;
3334 for file in $files; do
3338 func_fatal_help "\`$destdir' must be an absolute directory name"
3345 # This variable tells wrapper scripts just to set variables rather
3346 # than running their programs.
3347 libtool_install_magic="$magic"
3352 for file in $files; do
3354 # Do each installation.
3357 # Do the static libraries later.
3358 staticlibs+=" $file"
3362 func_resolve_sysroot "$file"
3363 file=$func_resolve_sysroot_result
3365 # Check to see that this really is a libtool archive.
3366 func_lalib_unsafe_p "$file" \
3367 || func_fatal_help "\`$file' is not a valid libtool archive"
3374 # Add the libdir to current_libdirs if it is the destination.
3375 if test "X$destdir" = "X$libdir"; then
3376 case "$current_libdirs " in
3378 *) current_libdirs+=" $libdir" ;;
3381 # Note the libdir as a future libdir.
3382 case "$future_libdirs " in
3384 *) future_libdirs+=" $libdir" ;;
3388 func_dirname "$file" "/" ""
3389 dir="$func_dirname_result"
3392 if test -n "$relink_command"; then
3393 # Determine the prefix the user has applied to our future dir.
3394 inst_prefix_dir=`$ECHO "$destdir" | $SED -e "s%$libdir\$%%"`
3396 # Don't allow the user to place us outside of our expected
3397 # location b/c this prevents finding dependent libraries that
3398 # are installed to the same prefix.
3399 # At present, this check doesn't affect windows .dll's that
3400 # are installed into $libdir/../bin (currently, that works fine)
3401 # but it's something to keep an eye on.
3402 test "$inst_prefix_dir" = "$destdir" && \
3403 func_fatal_error "error: cannot install \`$file' to a directory not ending in $libdir"
3405 if test -n "$inst_prefix_dir"; then
3406 # Stick the inst_prefix_dir data into the link command.
3407 relink_command=`$ECHO "$relink_command" | $SED "s%@inst_prefix_dir@%-inst-prefix-dir $inst_prefix_dir%"`
3409 relink_command=`$ECHO "$relink_command" | $SED "s%@inst_prefix_dir@%%"`
3412 func_warning "relinking \`$file'"
3413 func_show_eval "$relink_command" \
3414 'func_fatal_error "error: relink \`$file'\'' with the above command before installing it"'
3417 # See the names of the shared library.
3418 set dummy $library_names; shift
3419 if test -n "$1"; then
3424 test -n "$relink_command" && srcname="$realname"T
3426 # Install the shared library and build the symlinks.
3427 func_show_eval "$install_shared_prog $dir/$srcname $destdir/$realname" \
3431 cygwin* | mingw* | pw32* | cegcc*)
3439 if test -n "$tstripme" && test -n "$striplib"; then
3440 func_show_eval "$striplib $destdir/$realname" 'exit $?'
3443 if test "$#" -gt 0; then
3444 # Delete the old symlinks, and create new ones.
3445 # Try `ln -sf' first, because the `ln' binary might depend on
3446 # the symlink we replace! Solaris /bin/ln does not understand -f,
3447 # so we also need to try rm && ln -s.
3450 test "$linkname" != "$realname" \
3451 && func_show_eval "(cd $destdir && { $LN_S -f $realname $linkname || { $RM $linkname && $LN_S $realname $linkname; }; })"
3455 # Do each command in the postinstall commands.
3456 lib="$destdir/$realname"
3457 func_execute_cmds "$postinstall_cmds" 'exit $?'
3460 # Install the pseudo-library for information purposes.
3461 func_basename "$file"
3462 name="$func_basename_result"
3463 instname="$dir/$name"i
3464 func_show_eval "$install_prog $instname $destdir/$name" 'exit $?'
3466 # Maybe install the static library, too.
3467 test -n "$old_library" && staticlibs+=" $dir/$old_library"
3471 # Install (i.e. copy) a libtool object.
3473 # Figure out destination file name, if it wasn't already specified.
3474 if test -n "$destname"; then
3475 destfile="$destdir/$destname"
3477 func_basename "$file"
3478 destfile="$func_basename_result"
3479 destfile="$destdir/$destfile"
3482 # Deduce the name of the destination old-style object file.
3485 func_lo2o "$destfile"
3486 staticdest=$func_lo2o_result
3489 staticdest="$destfile"
3493 func_fatal_help "cannot copy a libtool object to \`$destfile'"
3497 # Install the libtool object if requested.
3498 test -n "$destfile" && \
3499 func_show_eval "$install_prog $file $destfile" 'exit $?'
3501 # Install the old object if enabled.
3502 if test "$build_old_libs" = yes; then
3503 # Deduce the name of the old-style object file.
3505 staticobj=$func_lo2o_result
3506 func_show_eval "$install_prog \$staticobj \$staticdest" 'exit $?'
3512 # Figure out destination file name, if it wasn't already specified.
3513 if test -n "$destname"; then
3514 destfile="$destdir/$destname"
3516 func_basename "$file"
3517 destfile="$func_basename_result"
3518 destfile="$destdir/$destfile"
3521 # If the file is missing, and there is a .exe on the end, strip it
3522 # because it is most likely a libtool script we actually want to
3527 if test ! -f "$file"; then
3528 func_stripname '' '.exe' "$file"
3529 file=$func_stripname_result
3535 # Do a test to see if this is really a libtool program.
3538 if func_ltwrapper_executable_p "$file"; then
3539 func_ltwrapper_scriptname "$file"
3540 wrapper=$func_ltwrapper_scriptname_result
3542 func_stripname '' '.exe' "$file"
3543 wrapper=$func_stripname_result
3550 if func_ltwrapper_script_p "$wrapper"; then
3554 func_source "$wrapper"
3556 # Check the variables that should have been set.
3557 test -z "$generated_by_libtool_version" && \
3558 func_fatal_error "invalid libtool wrapper script \`$wrapper'"
3561 for lib in $notinst_deplibs; do
3562 # Check to see that each library is installed.
3564 if test -f "$lib"; then
3567 libfile="$libdir/"`$ECHO "$lib" | $SED 's%^.*/%%g'` ### testsuite: skip nested quoting test
3568 if test -n "$libdir" && test ! -f "$libfile"; then
3569 func_warning "\`$lib' has not been installed in \`$libdir'"
3575 func_source "$wrapper"
3578 if test "$fast_install" = no && test -n "$relink_command"; then
3580 if test "$finalize" = yes; then
3581 tmpdir=`func_mktempdir`
3582 func_basename "$file$stripped_ext"
3583 file="$func_basename_result"
3584 outputname="$tmpdir/$file"
3585 # Replace the output file specification.
3586 relink_command=`$ECHO "$relink_command" | $SED 's%@OUTPUT@%'"$outputname"'%g'`
3589 func_quote_for_expand "$relink_command"
3590 eval "func_echo $func_quote_for_expand_result"
3592 if eval "$relink_command"; then :
3594 func_error "error: relink \`$file' with the above command before installing it"
3595 $opt_dry_run || ${RM}r "$tmpdir"
3600 func_warning "cannot relink \`$file'"
3604 # Install the binary that we compiled earlier.
3605 file=`$ECHO "$file$stripped_ext" | $SED "s%\([^/]*\)$%$objdir/\1%"`
3609 # remove .exe since cygwin /usr/bin/install will append another
3611 case $install_prog,$host in
3612 */usr/bin/install*,*cygwin*)
3613 case $file:$destfile in
3618 destfile=$destfile.exe
3621 func_stripname '' '.exe' "$destfile"
3622 destfile=$func_stripname_result
3627 func_show_eval "$install_prog\$stripme \$file \$destfile" 'exit $?'
3628 $opt_dry_run || if test -n "$outputname"; then
3635 for file in $staticlibs; do
3636 func_basename "$file"
3637 name="$func_basename_result"
3639 # Set up the ranlib parameters.
3640 oldlib="$destdir/$name"
3641 func_to_tool_file "$oldlib" func_convert_file_msys_to_w32
3642 tool_oldlib=$func_to_tool_file_result
3644 func_show_eval "$install_prog \$file \$oldlib" 'exit $?'
3646 if test -n "$stripme" && test -n "$old_striplib"; then
3647 func_show_eval "$old_striplib $tool_oldlib" 'exit $?'
3650 # Do each command in the postinstall commands.
3651 func_execute_cmds "$old_postinstall_cmds" 'exit $?'
3654 test -n "$future_libdirs" && \
3655 func_warning "remember to run \`$progname --finish$future_libdirs'"
3657 if test -n "$current_libdirs"; then
3658 # Maybe just do a dry run.
3659 $opt_dry_run && current_libdirs=" -n$current_libdirs"
3660 exec_cmd='$SHELL $progpath $preserve_args --finish$current_libdirs'
3666 test "$opt_mode" = install && func_mode_install ${1+"$@"}
3669 # func_generate_dlsyms outputname originator pic_p
3670 # Extract symbols from dlprefiles and create ${outputname}S.o with
3671 # a dlpreopen symbol table.
3672 func_generate_dlsyms ()
3678 my_prefix=`$ECHO "$my_originator" | sed 's%[^a-zA-Z0-9]%_%g'`
3681 if test -n "$dlfiles$dlprefiles" || test "$dlself" != no; then
3682 if test -n "$NM" && test -n "$global_symbol_pipe"; then
3683 my_dlsyms="${my_outputname}S.c"
3685 func_error "not configured to extract global symbols from dlpreopened files"
3689 if test -n "$my_dlsyms"; then
3693 # Discover the nlist of each of the dlfiles.
3694 nlist="$output_objdir/${my_outputname}.nm"
3696 func_show_eval "$RM $nlist ${nlist}S ${nlist}T"
3698 # Parse the name list into a source file.
3699 func_verbose "creating $output_objdir/$my_dlsyms"
3701 $opt_dry_run || $ECHO > "$output_objdir/$my_dlsyms" "\
3702 /* $my_dlsyms - symbol resolution table for \`$my_outputname' dlsym emulation. */
3703 /* Generated by $PROGRAM (GNU $PACKAGE$TIMESTAMP) $VERSION */
3709 #if defined(__GNUC__) && (((__GNUC__ == 4) && (__GNUC_MINOR__ >= 4)) || (__GNUC__ > 4))
3710 #pragma GCC diagnostic ignored \"-Wstrict-prototypes\"
3713 /* Keep this code in sync between libtool.m4, ltmain, lt_system.h, and tests. */
3714 #if defined(_WIN32) || defined(__CYGWIN__) || defined(_WIN32_WCE)
3715 /* DATA imports from DLLs on WIN32 con't be const, because runtime
3716 relocations are performed -- see ld's documentation on pseudo-relocs. */
3717 # define LT_DLSYM_CONST
3718 #elif defined(__osf__)
3719 /* This system does not cope well with relocations in const data. */
3720 # define LT_DLSYM_CONST
3722 # define LT_DLSYM_CONST const
3725 /* External symbol declarations for the compiler. */\
3728 if test "$dlself" = yes; then
3729 func_verbose "generating symbol list for \`$output'"
3731 $opt_dry_run || echo ': @PROGRAM@ ' > "$nlist"
3733 # Add our own program objects to the symbol list.
3734 progfiles=`$ECHO "$objs$old_deplibs" | $SP2NL | $SED "$lo2o" | $NL2SP`
3735 for progfile in $progfiles; do
3736 func_to_tool_file "$progfile" func_convert_file_msys_to_w32
3737 func_verbose "extracting global C symbols from \`$func_to_tool_file_result'"
3738 $opt_dry_run || eval "$NM $func_to_tool_file_result | $global_symbol_pipe >> '$nlist'"
3741 if test -n "$exclude_expsyms"; then
3743 eval '$EGREP -v " ($exclude_expsyms)$" "$nlist" > "$nlist"T'
3744 eval '$MV "$nlist"T "$nlist"'
3748 if test -n "$export_symbols_regex"; then
3750 eval '$EGREP -e "$export_symbols_regex" "$nlist" > "$nlist"T'
3751 eval '$MV "$nlist"T "$nlist"'
3755 # Prepare the list of exported symbols
3756 if test -z "$export_symbols"; then
3757 export_symbols="$output_objdir/$outputname.exp"
3760 eval "${SED} -n -e '/^: @PROGRAM@ $/d' -e 's/^.* \(.*\)$/\1/p' "'< "$nlist" > "$export_symbols"'
3762 *cygwin* | *mingw* | *cegcc* )
3763 eval "echo EXPORTS "'> "$output_objdir/$outputname.def"'
3764 eval 'cat "$export_symbols" >> "$output_objdir/$outputname.def"'
3770 eval "${SED} -e 's/\([].[*^$]\)/\\\\\1/g' -e 's/^/ /' -e 's/$/$/'"' < "$export_symbols" > "$output_objdir/$outputname.exp"'
3771 eval '$GREP -f "$output_objdir/$outputname.exp" < "$nlist" > "$nlist"T'
3772 eval '$MV "$nlist"T "$nlist"'
3774 *cygwin* | *mingw* | *cegcc* )
3775 eval "echo EXPORTS "'> "$output_objdir/$outputname.def"'
3776 eval 'cat "$nlist" >> "$output_objdir/$outputname.def"'
3783 for dlprefile in $dlprefiles; do
3784 func_verbose "extracting global C symbols from \`$dlprefile'"
3785 func_basename "$dlprefile"
3786 name="$func_basename_result"
3788 *cygwin* | *mingw* | *cegcc* )
3789 # if an import library, we need to obtain dlname
3790 if func_win32_import_lib_p "$dlprefile"; then
3791 func_tr_sh "$dlprefile"
3792 eval "curr_lafile=\$libfile_$func_tr_sh_result"
3793 dlprefile_dlbasename=""
3794 if test -n "$curr_lafile" && func_lalib_p "$curr_lafile"; then
3795 # Use subshell, to avoid clobbering current variable values
3796 dlprefile_dlname=`source "$curr_lafile" && echo "$dlname"`
3797 if test -n "$dlprefile_dlname" ; then
3798 func_basename "$dlprefile_dlname"
3799 dlprefile_dlbasename="$func_basename_result"
3801 # no lafile. user explicitly requested -dlpreopen <import library>.
3802 $sharedlib_from_linklib_cmd "$dlprefile"
3803 dlprefile_dlbasename=$sharedlib_from_linklib_result
3807 if test -n "$dlprefile_dlbasename" ; then
3808 eval '$ECHO ": $dlprefile_dlbasename" >> "$nlist"'
3810 func_warning "Could not compute DLL name from $name"
3811 eval '$ECHO ": $name " >> "$nlist"'
3813 func_to_tool_file "$dlprefile" func_convert_file_msys_to_w32
3814 eval "$NM \"$func_to_tool_file_result\" 2>/dev/null | $global_symbol_pipe |
3815 $SED -e '/I __imp/d' -e 's/I __nm_/D /;s/_nm__//' >> '$nlist'"
3817 else # not an import lib
3819 eval '$ECHO ": $name " >> "$nlist"'
3820 func_to_tool_file "$dlprefile" func_convert_file_msys_to_w32
3821 eval "$NM \"$func_to_tool_file_result\" 2>/dev/null | $global_symbol_pipe >> '$nlist'"
3827 eval '$ECHO ": $name " >> "$nlist"'
3828 func_to_tool_file "$dlprefile" func_convert_file_msys_to_w32
3829 eval "$NM \"$func_to_tool_file_result\" 2>/dev/null | $global_symbol_pipe >> '$nlist'"
3836 # Make sure we have at least an empty file.
3837 test -f "$nlist" || : > "$nlist"
3839 if test -n "$exclude_expsyms"; then
3840 $EGREP -v " ($exclude_expsyms)$" "$nlist" > "$nlist"T
3841 $MV "$nlist"T "$nlist"
3844 # Try sorting and uniquifying the output.
3845 if $GREP -v "^: " < "$nlist" |
3846 if sort -k 3 </dev/null >/dev/null 2>&1; then
3851 uniq > "$nlist"S; then
3854 $GREP -v "^: " < "$nlist" > "$nlist"S
3857 if test -f "$nlist"S; then
3858 eval "$global_symbol_to_cdecl"' < "$nlist"S >> "$output_objdir/$my_dlsyms"'
3860 echo '/* NONE */' >> "$output_objdir/$my_dlsyms"
3863 echo >> "$output_objdir/$my_dlsyms" "\
3865 /* The mapping between symbol names and symbols. */
3870 extern LT_DLSYM_CONST lt_dlsymlist
3871 lt_${my_prefix}_LTX_preloaded_symbols[];
3872 LT_DLSYM_CONST lt_dlsymlist
3873 lt_${my_prefix}_LTX_preloaded_symbols[] =
3875 { \"$my_originator\", (void *) 0 },"
3877 case $need_lib_prefix in
3879 eval "$global_symbol_to_c_name_address" < "$nlist" >> "$output_objdir/$my_dlsyms"
3882 eval "$global_symbol_to_c_name_address_lib_prefix" < "$nlist" >> "$output_objdir/$my_dlsyms"
3885 echo >> "$output_objdir/$my_dlsyms" "\
3889 /* This works around a problem in FreeBSD linker */
3890 #ifdef FREEBSD_WORKAROUND
3891 static const void *lt_preloaded_setup() {
3892 return lt_${my_prefix}_LTX_preloaded_symbols;
3902 pic_flag_for_symtable=
3903 case "$compile_command " in
3907 # compiling the symbol table file with pic_flag works around
3908 # a FreeBSD bug that causes programs to crash when -lm is
3909 # linked before any other PIC object. But we must not use
3910 # pic_flag when linking with -static. The problem exists in
3911 # FreeBSD 2.2.6 and is fixed in FreeBSD 3.1.
3912 *-*-freebsd2.*|*-*-freebsd3.0*|*-*-freebsdelf3.0*)
3913 pic_flag_for_symtable=" $pic_flag -DFREEBSD_WORKAROUND" ;;
3915 pic_flag_for_symtable=" $pic_flag" ;;
3917 if test "X$my_pic_p" != Xno; then
3918 pic_flag_for_symtable=" $pic_flag"
3925 for arg in $LTCFLAGS; do
3927 -pie | -fpie | -fPIE) ;;
3928 *) symtab_cflags+=" $arg" ;;
3932 # Now compile the dynamic symbol file.
3933 func_show_eval '(cd $output_objdir && $LTCC$symtab_cflags -c$no_builtin_flag$pic_flag_for_symtable "$my_dlsyms")' 'exit $?'
3935 # Clean up the generated files.
3936 func_show_eval '$RM "$output_objdir/$my_dlsyms" "$nlist" "${nlist}S" "${nlist}T"'
3938 # Transform the symbol file into the correct name.
3939 symfileobj="$output_objdir/${my_outputname}S.$objext"
3941 *cygwin* | *mingw* | *cegcc* )
3942 if test -f "$output_objdir/$my_outputname.def"; then
3943 compile_command=`$ECHO "$compile_command" | $SED "s%@SYMFILE@%$output_objdir/$my_outputname.def $symfileobj%"`
3944 finalize_command=`$ECHO "$finalize_command" | $SED "s%@SYMFILE@%$output_objdir/$my_outputname.def $symfileobj%"`
3946 compile_command=`$ECHO "$compile_command" | $SED "s%@SYMFILE@%$symfileobj%"`
3947 finalize_command=`$ECHO "$finalize_command" | $SED "s%@SYMFILE@%$symfileobj%"`
3951 compile_command=`$ECHO "$compile_command" | $SED "s%@SYMFILE@%$symfileobj%"`
3952 finalize_command=`$ECHO "$finalize_command" | $SED "s%@SYMFILE@%$symfileobj%"`
3957 func_fatal_error "unknown suffix for \`$my_dlsyms'"
3961 # We keep going just in case the user didn't refer to
3962 # lt_preloaded_symbols. The linker will fail if global_symbol_pipe
3963 # really was required.
3965 # Nullify the symbol file.
3966 compile_command=`$ECHO "$compile_command" | $SED "s% @SYMFILE@%%"`
3967 finalize_command=`$ECHO "$finalize_command" | $SED "s% @SYMFILE@%%"`
3971 # func_win32_libid arg
3972 # return the library type of file 'arg'
3974 # Need a lot of goo to handle *both* DLLs and import libs
3975 # Has to be a shell function in order to 'eat' the argument
3976 # that is supplied when $file_magic_command is called.
3977 # Despite the name, also deal with 64 bit binaries.
3981 win32_libid_type="unknown"
3982 win32_fileres=`file -L $1 2>/dev/null`
3983 case $win32_fileres in
3984 *ar\ archive\ import\ library*) # definitely import
3985 win32_libid_type="x86 archive import"
3987 *ar\ archive*) # could be an import, or static
3988 # Keep the egrep pattern in sync with the one in _LT_CHECK_MAGIC_METHOD.
3989 if eval $OBJDUMP -f $1 | $SED -e '10q' 2>/dev/null |
3990 $EGREP 'file format (pei*-i386(.*architecture: i386)?|pe-arm-wince|pe-x86-64)' >/dev/null; then
3991 func_to_tool_file "$1" func_convert_file_msys_to_w32
3992 win32_nmres=`eval $NM -f posix -A \"$func_to_tool_file_result\" |
4001 case $win32_nmres in
4002 import*) win32_libid_type="x86 archive import";;
4003 *) win32_libid_type="x86 archive static";;
4008 win32_libid_type="x86 DLL"
4010 *executable*) # but shell scripts are "executable" too...
4011 case $win32_fileres in
4012 *MS\ Windows\ PE\ Intel*)
4013 win32_libid_type="x86 DLL"
4018 $ECHO "$win32_libid_type"
4021 # func_cygming_dll_for_implib ARG
4023 # Platform-specific function to extract the
4024 # name of the DLL associated with the specified
4025 # import library ARG.
4026 # Invoked by eval'ing the libtool variable
4027 # $sharedlib_from_linklib_cmd
4028 # Result is available in the variable
4029 # $sharedlib_from_linklib_result
4030 func_cygming_dll_for_implib ()
4033 sharedlib_from_linklib_result=`$DLLTOOL --identify-strict --identify "$1"`
4036 # func_cygming_dll_for_implib_fallback_core SECTION_NAME LIBNAMEs
4038 # The is the core of a fallback implementation of a
4039 # platform-specific function to extract the name of the
4040 # DLL associated with the specified import library LIBNAME.
4042 # SECTION_NAME is either .idata$6 or .idata$7, depending
4043 # on the platform and compiler that created the implib.
4045 # Echos the name of the DLL associated with the
4046 # specified import library.
4047 func_cygming_dll_for_implib_fallback_core ()
4050 match_literal=`$ECHO "$1" | $SED "$sed_make_literal_regex"`
4051 $OBJDUMP -s --section "$1" "$2" 2>/dev/null |
4052 $SED '/^Contents of section '"$match_literal"':/{
4053 # Place marker at beginning of archive member dllname section
4058 # These lines can sometimes be longer than 43 characters, but
4059 # are always uninteresting
4060 /:[ ]*file format pe[i]\{,1\}-/d
4061 /^In archive [^:]*:/d
4062 # Ensure marker is printed
4064 # Remove all lines with less than 43 characters
4066 # From remaining lines, remove first 43 characters
4069 # Join marker and all lines until next marker into a single line
4070 /^====MARK====/ b para
4079 # Remove trailing dots and whitespace
4083 # we now have a list, one entry per line, of the stringified
4084 # contents of the appropriate section of all members of the
4085 # archive which possess that section. Heuristic: eliminate
4086 # all those which have a first or second character that is
4087 # a '.' (that is, objdump's representation of an unprintable
4088 # character.) This should work for all archives with less than
4089 # 0x302f exports -- but will fail for DLLs whose name actually
4090 # begins with a literal '.' or a single character followed by
4093 # Of those that remain, print the first one.
4094 $SED -e '/^\./d;/^.\./d;q'
4097 # func_cygming_gnu_implib_p ARG
4098 # This predicate returns with zero status (TRUE) if
4099 # ARG is a GNU/binutils-style import library. Returns
4100 # with nonzero status (FALSE) otherwise.
4101 func_cygming_gnu_implib_p ()
4104 func_to_tool_file "$1" func_convert_file_msys_to_w32
4105 func_cygming_gnu_implib_tmp=`$NM "$func_to_tool_file_result" | eval "$global_symbol_pipe" | $EGREP ' (_head_[A-Za-z0-9_]+_[ad]l*|[A-Za-z0-9_]+_[ad]l*_iname)$'`
4106 test -n "$func_cygming_gnu_implib_tmp"
4109 # func_cygming_ms_implib_p ARG
4110 # This predicate returns with zero status (TRUE) if
4111 # ARG is an MS-style import library. Returns
4112 # with nonzero status (FALSE) otherwise.
4113 func_cygming_ms_implib_p ()
4116 func_to_tool_file "$1" func_convert_file_msys_to_w32
4117 func_cygming_ms_implib_tmp=`$NM "$func_to_tool_file_result" | eval "$global_symbol_pipe" | $GREP '_NULL_IMPORT_DESCRIPTOR'`
4118 test -n "$func_cygming_ms_implib_tmp"
4121 # func_cygming_dll_for_implib_fallback ARG
4122 # Platform-specific function to extract the
4123 # name of the DLL associated with the specified
4124 # import library ARG.
4126 # This fallback implementation is for use when $DLLTOOL
4127 # does not support the --identify-strict option.
4128 # Invoked by eval'ing the libtool variable
4129 # $sharedlib_from_linklib_cmd
4130 # Result is available in the variable
4131 # $sharedlib_from_linklib_result
4132 func_cygming_dll_for_implib_fallback ()
4135 if func_cygming_gnu_implib_p "$1" ; then
4136 # binutils import library
4137 sharedlib_from_linklib_result=`func_cygming_dll_for_implib_fallback_core '.idata$7' "$1"`
4138 elif func_cygming_ms_implib_p "$1" ; then
4139 # ms-generated import library
4140 sharedlib_from_linklib_result=`func_cygming_dll_for_implib_fallback_core '.idata$6' "$1"`
4143 sharedlib_from_linklib_result=""
4148 # func_extract_an_archive dir oldlib
4149 func_extract_an_archive ()
4152 f_ex_an_ar_dir="$1"; shift
4153 f_ex_an_ar_oldlib="$1"
4154 if test "$lock_old_archive_extraction" = yes; then
4155 lockfile=$f_ex_an_ar_oldlib.lock
4156 until $opt_dry_run || ln "$progpath" "$lockfile" 2>/dev/null; do
4157 func_echo "Waiting for $lockfile to be removed"
4161 func_show_eval "(cd \$f_ex_an_ar_dir && $AR x \"\$f_ex_an_ar_oldlib\")" \
4162 'stat=$?; rm -f "$lockfile"; exit $stat'
4163 if test "$lock_old_archive_extraction" = yes; then
4164 $opt_dry_run || rm -f "$lockfile"
4166 if ($AR t "$f_ex_an_ar_oldlib" | sort | sort -uc >/dev/null 2>&1); then
4169 func_fatal_error "object name conflicts in archive: $f_ex_an_ar_dir/$f_ex_an_ar_oldlib"
4174 # func_extract_archives gentop oldlib ...
4175 func_extract_archives ()
4178 my_gentop="$1"; shift
4179 my_oldlibs=${1+"$@"}
4185 for my_xlib in $my_oldlibs; do
4186 # Extract the objects.
4188 [\\/]* | [A-Za-z]:[\\/]*) my_xabs="$my_xlib" ;;
4189 *) my_xabs=`pwd`"/$my_xlib" ;;
4191 func_basename "$my_xlib"
4192 my_xlib="$func_basename_result"
4195 case " $extracted_archives " in
4197 func_arith $extracted_serial + 1
4198 extracted_serial=$func_arith_result
4199 my_xlib_u=lt$extracted_serial-$my_xlib ;;
4203 extracted_archives="$extracted_archives $my_xlib_u"
4204 my_xdir="$my_gentop/$my_xlib_u"
4206 func_mkdir_p "$my_xdir"
4210 func_verbose "Extracting $my_xabs"
4211 # Do not bother doing anything if just a dry run
4213 darwin_orig_dir=`pwd`
4214 cd $my_xdir || exit $?
4215 darwin_archive=$my_xabs
4217 darwin_base_archive=`basename "$darwin_archive"`
4218 darwin_arches=`$LIPO -info "$darwin_archive" 2>/dev/null | $GREP Architectures 2>/dev/null || true`
4219 if test -n "$darwin_arches"; then
4220 darwin_arches=`$ECHO "$darwin_arches" | $SED -e 's/.*are://'`
4222 func_verbose "$darwin_base_archive has multiple architectures $darwin_arches"
4223 for darwin_arch in $darwin_arches ; do
4224 func_mkdir_p "unfat-$$/${darwin_base_archive}-${darwin_arch}"
4225 $LIPO -thin $darwin_arch -output "unfat-$$/${darwin_base_archive}-${darwin_arch}/${darwin_base_archive}" "${darwin_archive}"
4226 cd "unfat-$$/${darwin_base_archive}-${darwin_arch}"
4227 func_extract_an_archive "`pwd`" "${darwin_base_archive}"
4229 $RM "unfat-$$/${darwin_base_archive}-${darwin_arch}/${darwin_base_archive}"
4230 done # $darwin_arches
4231 ## Okay now we've a bunch of thin objects, gotta fatten them up :)
4232 darwin_filelist=`find unfat-$$ -type f -name \*.o -print -o -name \*.lo -print | $SED -e "$basename" | sort -u`
4235 for darwin_file in $darwin_filelist; do
4236 darwin_files=`find unfat-$$ -name $darwin_file -print | sort | $NL2SP`
4237 $LIPO -create -output "$darwin_file" $darwin_files
4238 done # $darwin_filelist
4240 cd "$darwin_orig_dir"
4243 func_extract_an_archive "$my_xdir" "$my_xabs"
4248 func_extract_an_archive "$my_xdir" "$my_xabs"
4251 my_oldobjs="$my_oldobjs "`find $my_xdir -name \*.$objext -print -o -name \*.lo -print | sort | $NL2SP`
4254 func_extract_archives_result="$my_oldobjs"
4258 # func_emit_wrapper [arg=no]
4260 # Emit a libtool wrapper script on stdout.
4261 # Don't directly open a file because we may want to
4262 # incorporate the script contents within a cygwin/mingw
4263 # wrapper executable. Must ONLY be called from within
4264 # func_mode_link because it depends on a number of variables
4267 # ARG is the value that the WRAPPER_SCRIPT_BELONGS_IN_OBJDIR
4268 # variable will take. If 'yes', then the emitted script
4269 # will assume that the directory in which it is stored is
4270 # the $objdir directory. This is a cygwin/mingw-specific
4272 func_emit_wrapper ()
4274 func_emit_wrapper_arg1=${1-no}
4279 # $output - temporary wrapper script for $objdir/$outputname
4280 # Generated by $PROGRAM (GNU $PACKAGE$TIMESTAMP) $VERSION
4282 # The $output program cannot be directly executed until all the libtool
4283 # libraries that it depends on are installed.
4285 # This wrapper script should never be moved out of the build directory.
4286 # If it is, it will not operate correctly.
4288 # Sed substitution that helps us do robust quoting. It backslashifies
4289 # metacharacters that are still active within double-quoted strings.
4290 sed_quote_subst='$sed_quote_subst'
4292 # Be Bourne compatible
4293 if test -n \"\${ZSH_VERSION+set}\" && (emulate sh) >/dev/null 2>&1; then
4296 # Zsh 3.x and 4.x performs word splitting on \${1+\"\$@\"}, which
4297 # is contrary to our usage. Disable this feature.
4298 alias -g '\${1+\"\$@\"}'='\"\$@\"'
4299 setopt NO_GLOB_SUBST
4301 case \`(set -o) 2>/dev/null\` in *posix*) set -o posix;; esac
4303 BIN_SH=xpg4; export BIN_SH # for Tru64
4304 DUALCASE=1; export DUALCASE # for MKS sh
4306 # The HP-UX ksh and POSIX shell print the target directory to stdout
4308 (unset CDPATH) >/dev/null 2>&1 && unset CDPATH
4310 relink_command=\"$relink_command\"
4312 # This environment variable determines our operation mode.
4313 if test \"\$libtool_install_magic\" = \"$magic\"; then
4314 # install mode needs the following variables:
4315 generated_by_libtool_version='$macro_version'
4316 notinst_deplibs='$notinst_deplibs'
4318 # When we are sourced in execute mode, \$file and \$ECHO are already set.
4319 if test \"\$libtool_execute_magic\" != \"$magic\"; then
4322 qECHO=`$ECHO "$ECHO" | $SED "$sed_quote_subst"`
4325 # A function that is used when there is no print builtin or printf.
4326 func_fallback_echo ()
4328 eval 'cat <<_LTECHO_EOF
4335 # Very basic option parsing. These options are (a) specific to
4336 # the libtool wrapper, (b) are identical between the wrapper
4337 # /script/ and the wrapper /executable/ which is used only on
4338 # windows platforms, and (c) all begin with the string "--lt-"
4339 # (application programs are unlikely to have options which match
4342 # There are only two supported options: --lt-debug and
4343 # --lt-dump-script. There is, deliberately, no --lt-help.
4345 # The first argument to this parsing function should be the
4346 # script's $0 value, followed by "$@".
4348 func_parse_lt_options ()
4354 case \"\$lt_opt\" in
4355 --lt-debug) lt_option_debug=1 ;;
4357 lt_dump_D=\`\$ECHO \"X\$lt_script_arg0\" | $SED -e 's/^X//' -e 's%/[^/]*$%%'\`
4358 test \"X\$lt_dump_D\" = \"X\$lt_script_arg0\" && lt_dump_D=.
4359 lt_dump_F=\`\$ECHO \"X\$lt_script_arg0\" | $SED -e 's/^X//' -e 's%^.*/%%'\`
4360 cat \"\$lt_dump_D/\$lt_dump_F\"
4364 \$ECHO \"Unrecognized --lt- option: '\$lt_opt'\" 1>&2
4370 # Print the debug banner immediately:
4371 if test -n \"\$lt_option_debug\"; then
4372 echo \"${outputname}:${output}:\${LINENO}: libtool wrapper (GNU $PACKAGE$TIMESTAMP) $VERSION\" 1>&2
4376 # Used when --lt-debug. Prints its arguments to stdout
4377 # (redirection is the responsibility of the caller)
4378 func_lt_dump_args ()
4383 \$ECHO \"${outputname}:${output}:\${LINENO}: newargv[\$lt_dump_args_N]: \$lt_arg\"
4384 lt_dump_args_N=\`expr \$lt_dump_args_N + 1\`
4388 # Core function for launching the target application
4389 func_exec_program_core ()
4393 # Backslashes separate directories on plain windows
4394 *-*-mingw | *-*-os2* | *-cegcc*)
4396 if test -n \"\$lt_option_debug\"; then
4397 \$ECHO \"${outputname}:${output}:\${LINENO}: newargv[0]: \$progdir\\\\\$program\" 1>&2
4398 func_lt_dump_args \${1+\"\$@\"} 1>&2
4400 exec \"\$progdir\\\\\$program\" \${1+\"\$@\"}
4406 if test -n \"\$lt_option_debug\"; then
4407 \$ECHO \"${outputname}:${output}:\${LINENO}: newargv[0]: \$progdir/\$program\" 1>&2
4408 func_lt_dump_args \${1+\"\$@\"} 1>&2
4410 exec \"\$progdir/\$program\" \${1+\"\$@\"}
4415 \$ECHO \"\$0: cannot exec \$program \$*\" 1>&2
4419 # A function to encapsulate launching the target application
4420 # Strips options in the --lt-* namespace from \$@ and
4421 # launches target application with the remaining arguments.
4422 func_exec_program ()
4430 *) set x \"\$@\" \"\$lt_wr_arg\"; shift;;
4435 func_exec_program_core \${1+\"\$@\"}
4439 func_parse_lt_options \"\$0\" \${1+\"\$@\"}
4441 # Find the directory that this script lives in.
4442 thisdir=\`\$ECHO \"\$file\" | $SED 's%/[^/]*$%%'\`
4443 test \"x\$thisdir\" = \"x\$file\" && thisdir=.
4445 # Follow symbolic links until we get to the real thisdir.
4446 file=\`ls -ld \"\$file\" | $SED -n 's/.*-> //p'\`
4447 while test -n \"\$file\"; do
4448 destdir=\`\$ECHO \"\$file\" | $SED 's%/[^/]*\$%%'\`
4450 # If there was a directory component, then change thisdir.
4451 if test \"x\$destdir\" != \"x\$file\"; then
4452 case \"\$destdir\" in
4453 [\\\\/]* | [A-Za-z]:[\\\\/]*) thisdir=\"\$destdir\" ;;
4454 *) thisdir=\"\$thisdir/\$destdir\" ;;
4458 file=\`\$ECHO \"\$file\" | $SED 's%^.*/%%'\`
4459 file=\`ls -ld \"\$thisdir/\$file\" | $SED -n 's/.*-> //p'\`
4462 # Usually 'no', except on cygwin/mingw when embedded into
4464 WRAPPER_SCRIPT_BELONGS_IN_OBJDIR=$func_emit_wrapper_arg1
4465 if test \"\$WRAPPER_SCRIPT_BELONGS_IN_OBJDIR\" = \"yes\"; then
4466 # special case for '.'
4467 if test \"\$thisdir\" = \".\"; then
4470 # remove .libs from thisdir
4471 case \"\$thisdir\" in
4472 *[\\\\/]$objdir ) thisdir=\`\$ECHO \"\$thisdir\" | $SED 's%[\\\\/][^\\\\/]*$%%'\` ;;
4473 $objdir ) thisdir=. ;;
4477 # Try to get the absolute directory name.
4478 absdir=\`cd \"\$thisdir\" && pwd\`
4479 test -n \"\$absdir\" && thisdir=\"\$absdir\"
4482 if test "$fast_install" = yes; then
4484 program=lt-'$outputname'$exeext
4485 progdir=\"\$thisdir/$objdir\"
4487 if test ! -f \"\$progdir/\$program\" ||
4488 { file=\`ls -1dt \"\$progdir/\$program\" \"\$progdir/../\$program\" 2>/dev/null | ${SED} 1q\`; \\
4489 test \"X\$file\" != \"X\$progdir/\$program\"; }; then
4491 file=\"\$\$-\$program\"
4493 if test ! -d \"\$progdir\"; then
4494 $MKDIR \"\$progdir\"
4496 $RM \"\$progdir/\$file\"
4501 # relink executable if necessary
4502 if test -n \"\$relink_command\"; then
4503 if relink_command_output=\`eval \$relink_command 2>&1\`; then :
4505 $ECHO \"\$relink_command_output\" >&2
4506 $RM \"\$progdir/\$file\"
4511 $MV \"\$progdir/\$file\" \"\$progdir/\$program\" 2>/dev/null ||
4512 { $RM \"\$progdir/\$program\";
4513 $MV \"\$progdir/\$file\" \"\$progdir/\$program\"; }
4514 $RM \"\$progdir/\$file\"
4518 program='$outputname'
4519 progdir=\"\$thisdir/$objdir\"
4525 if test -f \"\$progdir/\$program\"; then"
4527 # fixup the dll searchpath if we need to.
4529 # Fix the DLL searchpath if we need to. Do this before prepending
4530 # to shlibpath, because on Windows, both are PATH and uninstalled
4531 # libraries must come first.
4532 if test -n "$dllsearchpath"; then
4534 # Add the dll search path components to the executable PATH
4535 PATH=$dllsearchpath:\$PATH
4539 # Export our shlibpath_var if we have one.
4540 if test "$shlibpath_overrides_runpath" = yes && test -n "$shlibpath_var" && test -n "$temp_rpath"; then
4542 # Add our own library path to $shlibpath_var
4543 $shlibpath_var=\"$temp_rpath\$$shlibpath_var\"
4545 # Some systems cannot cope with colon-terminated $shlibpath_var
4546 # The second colon is a workaround for a bug in BeOS R4 sed
4547 $shlibpath_var=\`\$ECHO \"\$$shlibpath_var\" | $SED 's/::*\$//'\`
4549 export $shlibpath_var
4554 if test \"\$libtool_execute_magic\" != \"$magic\"; then
4555 # Run the actual program with our arguments.
4556 func_exec_program \${1+\"\$@\"}
4559 # The program doesn't exist.
4560 \$ECHO \"\$0: error: \\\`\$progdir/\$program' does not exist\" 1>&2
4561 \$ECHO \"This script is just a wrapper for \$program.\" 1>&2
4562 \$ECHO \"See the $PACKAGE documentation for more information.\" 1>&2
4570 # func_emit_cwrapperexe_src
4571 # emit the source code for a wrapper executable on stdout
4572 # Must ONLY be called from within func_mode_link because
4573 # it depends on a number of variable set therein.
4574 func_emit_cwrapperexe_src ()
4578 /* $cwrappersource - temporary wrapper executable for $objdir/$outputname
4579 Generated by $PROGRAM (GNU $PACKAGE$TIMESTAMP) $VERSION
4581 The $output program cannot be directly executed until all the libtool
4582 libraries that it depends on are installed.
4584 This wrapper executable should never be moved out of the build directory.
4585 If it is, it will not operate correctly.
4590 # define _CRT_SECURE_NO_DEPRECATE 1
4595 # include <direct.h>
4596 # include <process.h>
4599 # include <unistd.h>
4600 # include <stdint.h>
4612 #include <sys/stat.h>
4614 /* declarations of non-ANSI functions */
4615 #if defined(__MINGW32__)
4616 # ifdef __STRICT_ANSI__
4617 int _putenv (const char *);
4619 #elif defined(__CYGWIN__)
4620 # ifdef __STRICT_ANSI__
4621 char *realpath (const char *, char *);
4622 int putenv (char *);
4623 int setenv (const char *, const char *, int);
4625 /* #elif defined (other platforms) ... */
4628 /* portability defines, excluding path handling macros */
4629 #if defined(_MSC_VER)
4630 # define setmode _setmode
4632 # define chmod _chmod
4633 # define getcwd _getcwd
4634 # define putenv _putenv
4635 # define S_IXUSR _S_IEXEC
4636 # ifndef _INTPTR_T_DEFINED
4637 # define _INTPTR_T_DEFINED
4638 # define intptr_t int
4640 #elif defined(__MINGW32__)
4641 # define setmode _setmode
4643 # define chmod _chmod
4644 # define getcwd _getcwd
4645 # define putenv _putenv
4646 #elif defined(__CYGWIN__)
4647 # define HAVE_SETENV
4648 # define FOPEN_WB "wb"
4649 /* #elif defined (other platforms) ... */
4652 #if defined(PATH_MAX)
4653 # define LT_PATHMAX PATH_MAX
4654 #elif defined(MAXPATHLEN)
4655 # define LT_PATHMAX MAXPATHLEN
4657 # define LT_PATHMAX 1024
4667 /* path handling portability macros */
4668 #ifndef DIR_SEPARATOR
4669 # define DIR_SEPARATOR '/'
4670 # define PATH_SEPARATOR ':'
4673 #if defined (_WIN32) || defined (__MSDOS__) || defined (__DJGPP__) || \
4675 # define HAVE_DOS_BASED_FILE_SYSTEM
4676 # define FOPEN_WB "wb"
4677 # ifndef DIR_SEPARATOR_2
4678 # define DIR_SEPARATOR_2 '\\'
4680 # ifndef PATH_SEPARATOR_2
4681 # define PATH_SEPARATOR_2 ';'
4685 #ifndef DIR_SEPARATOR_2
4686 # define IS_DIR_SEPARATOR(ch) ((ch) == DIR_SEPARATOR)
4687 #else /* DIR_SEPARATOR_2 */
4688 # define IS_DIR_SEPARATOR(ch) \
4689 (((ch) == DIR_SEPARATOR) || ((ch) == DIR_SEPARATOR_2))
4690 #endif /* DIR_SEPARATOR_2 */
4692 #ifndef PATH_SEPARATOR_2
4693 # define IS_PATH_SEPARATOR(ch) ((ch) == PATH_SEPARATOR)
4694 #else /* PATH_SEPARATOR_2 */
4695 # define IS_PATH_SEPARATOR(ch) ((ch) == PATH_SEPARATOR_2)
4696 #endif /* PATH_SEPARATOR_2 */
4699 # define FOPEN_WB "w"
4702 # define _O_BINARY 0
4705 #define XMALLOC(type, num) ((type *) xmalloc ((num) * sizeof(type)))
4706 #define XFREE(stale) do { \
4707 if (stale) { free ((void *) stale); stale = 0; } \
4710 #if defined(LT_DEBUGWRAPPER)
4711 static int lt_debug = 1;
4713 static int lt_debug = 0;
4716 const char *program_name = "libtool-wrapper"; /* in case xstrdup fails */
4718 void *xmalloc (size_t num);
4719 char *xstrdup (const char *string);
4720 const char *base_name (const char *name);
4721 char *find_executable (const char *wrapper);
4722 char *chase_symlinks (const char *pathspec);
4723 int make_executable (const char *path);
4724 int check_executable (const char *path);
4725 char *strendzap (char *str, const char *pat);
4726 void lt_debugprintf (const char *file, int line, const char *fmt, ...);
4727 void lt_fatal (const char *file, int line, const char *message, ...);
4728 static const char *nonnull (const char *s);
4729 static const char *nonempty (const char *s);
4730 void lt_setenv (const char *name, const char *value);
4731 char *lt_extend_str (const char *orig_value, const char *add, int to_end);
4732 void lt_update_exe_path (const char *name, const char *value);
4733 void lt_update_lib_path (const char *name, const char *value);
4734 char **prepare_spawn (char **argv);
4735 void lt_dump_script (FILE *f);
4739 volatile const char * MAGIC_EXE = "$magic_exe";
4740 const char * LIB_PATH_VARNAME = "$shlibpath_var";
4743 if test "$shlibpath_overrides_runpath" = yes && test -n "$shlibpath_var" && test -n "$temp_rpath"; then
4744 func_to_host_path "$temp_rpath"
4746 const char * LIB_PATH_VALUE = "$func_to_host_path_result";
4750 const char * LIB_PATH_VALUE = "";
4754 if test -n "$dllsearchpath"; then
4755 func_to_host_path "$dllsearchpath:"
4757 const char * EXE_PATH_VARNAME = "PATH";
4758 const char * EXE_PATH_VALUE = "$func_to_host_path_result";
4762 const char * EXE_PATH_VARNAME = "";
4763 const char * EXE_PATH_VALUE = "";
4767 if test "$fast_install" = yes; then
4769 const char * TARGET_PROGRAM_NAME = "lt-$outputname"; /* hopefully, no .exe */
4773 const char * TARGET_PROGRAM_NAME = "$outputname"; /* hopefully, no .exe */
4780 #define LTWRAPPER_OPTION_PREFIX "--lt-"
4782 static const char *ltwrapper_option_prefix = LTWRAPPER_OPTION_PREFIX;
4783 static const char *dumpscript_opt = LTWRAPPER_OPTION_PREFIX "dump-script";
4784 static const char *debug_opt = LTWRAPPER_OPTION_PREFIX "debug";
4787 main (int argc, char *argv[])
4792 char *actual_cwrapper_path;
4793 char *actual_cwrapper_name;
4796 intptr_t rval = 127;
4800 program_name = (char *) xstrdup (base_name (argv[0]));
4801 newargz = XMALLOC (char *, argc + 1);
4803 /* very simple arg parsing; don't want to rely on getopt
4804 * also, copy all non cwrapper options to newargz, except
4805 * argz[0], which is handled differently
4808 for (i = 1; i < argc; i++)
4810 if (strcmp (argv[i], dumpscript_opt) == 0)
4814 *mingw* | *cygwin* )
4815 # make stdout use "unix" line endings
4816 echo " setmode(1,_O_BINARY);"
4821 lt_dump_script (stdout);
4824 if (strcmp (argv[i], debug_opt) == 0)
4829 if (strcmp (argv[i], ltwrapper_option_prefix) == 0)
4831 /* however, if there is an option in the LTWRAPPER_OPTION_PREFIX
4832 namespace, but it is not one of the ones we know about and
4833 have already dealt with, above (inluding dump-script), then
4834 report an error. Otherwise, targets might begin to believe
4835 they are allowed to use options in the LTWRAPPER_OPTION_PREFIX
4836 namespace. The first time any user complains about this, we'll
4837 need to make LTWRAPPER_OPTION_PREFIX a configure-time option
4838 or a configure.ac-settable value.
4840 lt_fatal (__FILE__, __LINE__,
4841 "unrecognized %s option: '%s'",
4842 ltwrapper_option_prefix, argv[i]);
4845 newargz[++newargc] = xstrdup (argv[i]);
4847 newargz[++newargc] = NULL;
4851 /* The GNU banner must be the first non-error debug message */
4852 lt_debugprintf (__FILE__, __LINE__, "libtool wrapper (GNU $PACKAGE$TIMESTAMP) $VERSION\n");
4855 lt_debugprintf (__FILE__, __LINE__, "(main) argv[0]: %s\n", argv[0]);
4856 lt_debugprintf (__FILE__, __LINE__, "(main) program_name: %s\n", program_name);
4858 tmp_pathspec = find_executable (argv[0]);
4859 if (tmp_pathspec == NULL)
4860 lt_fatal (__FILE__, __LINE__, "couldn't find %s", argv[0]);
4861 lt_debugprintf (__FILE__, __LINE__,
4862 "(main) found exe (before symlink chase) at: %s\n",
4865 actual_cwrapper_path = chase_symlinks (tmp_pathspec);
4866 lt_debugprintf (__FILE__, __LINE__,
4867 "(main) found exe (after symlink chase) at: %s\n",
4868 actual_cwrapper_path);
4869 XFREE (tmp_pathspec);
4871 actual_cwrapper_name = xstrdup (base_name (actual_cwrapper_path));
4872 strendzap (actual_cwrapper_path, actual_cwrapper_name);
4874 /* wrapper name transforms */
4875 strendzap (actual_cwrapper_name, ".exe");
4876 tmp_pathspec = lt_extend_str (actual_cwrapper_name, ".exe", 1);
4877 XFREE (actual_cwrapper_name);
4878 actual_cwrapper_name = tmp_pathspec;
4881 /* target_name transforms -- use actual target program name; might have lt- prefix */
4882 target_name = xstrdup (base_name (TARGET_PROGRAM_NAME));
4883 strendzap (target_name, ".exe");
4884 tmp_pathspec = lt_extend_str (target_name, ".exe", 1);
4885 XFREE (target_name);
4886 target_name = tmp_pathspec;
4889 lt_debugprintf (__FILE__, __LINE__,
4890 "(main) libtool target name: %s\n",
4896 XMALLOC (char, (strlen (actual_cwrapper_path) +
4897 strlen ("$objdir") + 1 + strlen (actual_cwrapper_name) + 1));
4898 strcpy (newargz[0], actual_cwrapper_path);
4899 strcat (newargz[0], "$objdir");
4900 strcat (newargz[0], "/");
4904 /* stop here, and copy so we don't have to do this twice */
4905 tmp_pathspec = xstrdup (newargz[0]);
4907 /* do NOT want the lt- prefix here, so use actual_cwrapper_name */
4908 strcat (newargz[0], actual_cwrapper_name);
4910 /* DO want the lt- prefix here if it exists, so use target_name */
4911 lt_argv_zero = lt_extend_str (tmp_pathspec, target_name, 1);
4912 XFREE (tmp_pathspec);
4913 tmp_pathspec = NULL;
4921 while ((p = strchr (newargz[0], '\\')) != NULL)
4925 while ((p = strchr (lt_argv_zero, '\\')) != NULL)
4935 XFREE (target_name);
4936 XFREE (actual_cwrapper_path);
4937 XFREE (actual_cwrapper_name);
4939 lt_setenv ("BIN_SH", "xpg4"); /* for Tru64 */
4940 lt_setenv ("DUALCASE", "1"); /* for MSK sh */
4941 /* Update the DLL searchpath. EXE_PATH_VALUE ($dllsearchpath) must
4942 be prepended before (that is, appear after) LIB_PATH_VALUE ($temp_rpath)
4943 because on Windows, both *_VARNAMEs are PATH but uninstalled
4944 libraries must come first. */
4945 lt_update_exe_path (EXE_PATH_VARNAME, EXE_PATH_VALUE);
4946 lt_update_lib_path (LIB_PATH_VARNAME, LIB_PATH_VALUE);
4948 lt_debugprintf (__FILE__, __LINE__, "(main) lt_argv_zero: %s\n",
4949 nonnull (lt_argv_zero));
4950 for (i = 0; i < newargc; i++)
4952 lt_debugprintf (__FILE__, __LINE__, "(main) newargz[%d]: %s\n",
4953 i, nonnull (newargz[i]));
4961 /* execv doesn't actually work on mingw as expected on unix */
4962 newargz = prepare_spawn (newargz);
4963 rval = _spawnv (_P_WAIT, lt_argv_zero, (const char * const *) newargz);
4966 /* failed to start process */
4967 lt_debugprintf (__FILE__, __LINE__,
4968 "(main) failed to launch target \"%s\": %s\n",
4969 lt_argv_zero, nonnull (strerror (errno)));
4977 execv (lt_argv_zero, newargz);
4978 return rval; /* =127, but avoids unused variable warning */
4987 xmalloc (size_t num)
4989 void *p = (void *) malloc (num);
4991 lt_fatal (__FILE__, __LINE__, "memory exhausted");
4997 xstrdup (const char *string)
4999 return string ? strcpy ((char *) xmalloc (strlen (string) + 1),
5004 base_name (const char *name)
5008 #if defined (HAVE_DOS_BASED_FILE_SYSTEM)
5009 /* Skip over the disk name in MSDOS pathnames. */
5010 if (isalpha ((unsigned char) name[0]) && name[1] == ':')
5014 for (base = name; *name; name++)
5015 if (IS_DIR_SEPARATOR (*name))
5021 check_executable (const char *path)
5025 lt_debugprintf (__FILE__, __LINE__, "(check_executable): %s\n",
5027 if ((!path) || (!*path))
5030 if ((stat (path, &st) >= 0)
5031 && (st.st_mode & (S_IXUSR | S_IXGRP | S_IXOTH)))
5038 make_executable (const char *path)
5043 lt_debugprintf (__FILE__, __LINE__, "(make_executable): %s\n",
5045 if ((!path) || (!*path))
5048 if (stat (path, &st) >= 0)
5050 rval = chmod (path, st.st_mode | S_IXOTH | S_IXGRP | S_IXUSR);
5055 /* Searches for the full path of the wrapper. Returns
5056 newly allocated full path name if found, NULL otherwise
5057 Does not chase symlinks, even on platforms that support them.
5060 find_executable (const char *wrapper)
5065 /* static buffer for getcwd */
5066 char tmp[LT_PATHMAX + 1];
5070 lt_debugprintf (__FILE__, __LINE__, "(find_executable): %s\n",
5071 nonempty (wrapper));
5073 if ((wrapper == NULL) || (*wrapper == '\0'))
5076 /* Absolute path? */
5077 #if defined (HAVE_DOS_BASED_FILE_SYSTEM)
5078 if (isalpha ((unsigned char) wrapper[0]) && wrapper[1] == ':')
5080 concat_name = xstrdup (wrapper);
5081 if (check_executable (concat_name))
5083 XFREE (concat_name);
5088 if (IS_DIR_SEPARATOR (wrapper[0]))
5090 concat_name = xstrdup (wrapper);
5091 if (check_executable (concat_name))
5093 XFREE (concat_name);
5095 #if defined (HAVE_DOS_BASED_FILE_SYSTEM)
5099 for (p = wrapper; *p; p++)
5107 /* no slashes; search PATH */
5108 const char *path = getenv ("PATH");
5111 for (p = path; *p; p = p_next)
5115 for (q = p; *q; q++)
5116 if (IS_PATH_SEPARATOR (*q))
5119 p_next = (*q == '\0' ? q : q + 1);
5122 /* empty path: current directory */
5123 if (getcwd (tmp, LT_PATHMAX) == NULL)
5124 lt_fatal (__FILE__, __LINE__, "getcwd failed: %s",
5125 nonnull (strerror (errno)));
5126 tmp_len = strlen (tmp);
5128 XMALLOC (char, tmp_len + 1 + strlen (wrapper) + 1);
5129 memcpy (concat_name, tmp, tmp_len);
5130 concat_name[tmp_len] = '/';
5131 strcpy (concat_name + tmp_len + 1, wrapper);
5136 XMALLOC (char, p_len + 1 + strlen (wrapper) + 1);
5137 memcpy (concat_name, p, p_len);
5138 concat_name[p_len] = '/';
5139 strcpy (concat_name + p_len + 1, wrapper);
5141 if (check_executable (concat_name))
5143 XFREE (concat_name);
5146 /* not found in PATH; assume curdir */
5148 /* Relative path | not found in path: prepend cwd */
5149 if (getcwd (tmp, LT_PATHMAX) == NULL)
5150 lt_fatal (__FILE__, __LINE__, "getcwd failed: %s",
5151 nonnull (strerror (errno)));
5152 tmp_len = strlen (tmp);
5153 concat_name = XMALLOC (char, tmp_len + 1 + strlen (wrapper) + 1);
5154 memcpy (concat_name, tmp, tmp_len);
5155 concat_name[tmp_len] = '/';
5156 strcpy (concat_name + tmp_len + 1, wrapper);
5158 if (check_executable (concat_name))
5160 XFREE (concat_name);
5165 chase_symlinks (const char *pathspec)
5168 return xstrdup (pathspec);
5170 char buf[LT_PATHMAX];
5172 char *tmp_pathspec = xstrdup (pathspec);
5174 int has_symlinks = 0;
5175 while (strlen (tmp_pathspec) && !has_symlinks)
5177 lt_debugprintf (__FILE__, __LINE__,
5178 "checking path component for symlinks: %s\n",
5180 if (lstat (tmp_pathspec, &s) == 0)
5182 if (S_ISLNK (s.st_mode) != 0)
5188 /* search backwards for last DIR_SEPARATOR */
5189 p = tmp_pathspec + strlen (tmp_pathspec) - 1;
5190 while ((p > tmp_pathspec) && (!IS_DIR_SEPARATOR (*p)))
5192 if ((p == tmp_pathspec) && (!IS_DIR_SEPARATOR (*p)))
5194 /* no more DIR_SEPARATORS left */
5201 lt_fatal (__FILE__, __LINE__,
5202 "error accessing file \"%s\": %s",
5203 tmp_pathspec, nonnull (strerror (errno)));
5206 XFREE (tmp_pathspec);
5210 return xstrdup (pathspec);
5213 tmp_pathspec = realpath (pathspec, buf);
5214 if (tmp_pathspec == 0)
5216 lt_fatal (__FILE__, __LINE__,
5217 "could not follow symlinks for %s", pathspec);
5219 return xstrdup (tmp_pathspec);
5224 strendzap (char *str, const char *pat)
5228 assert (str != NULL);
5229 assert (pat != NULL);
5232 patlen = strlen (pat);
5236 str += len - patlen;
5237 if (strcmp (str, pat) == 0)
5244 lt_debugprintf (const char *file, int line, const char *fmt, ...)
5249 (void) fprintf (stderr, "%s:%s:%d: ", program_name, file, line);
5250 va_start (args, fmt);
5251 (void) vfprintf (stderr, fmt, args);
5257 lt_error_core (int exit_status, const char *file,
5258 int line, const char *mode,
5259 const char *message, va_list ap)
5261 fprintf (stderr, "%s:%s:%d: %s: ", program_name, file, line, mode);
5262 vfprintf (stderr, message, ap);
5263 fprintf (stderr, ".\n");
5265 if (exit_status >= 0)
5270 lt_fatal (const char *file, int line, const char *message, ...)
5273 va_start (ap, message);
5274 lt_error_core (EXIT_FAILURE, file, line, "FATAL", message, ap);
5279 nonnull (const char *s)
5281 return s ? s : "(null)";
5285 nonempty (const char *s)
5287 return (s && !*s) ? "(empty)" : nonnull (s);
5291 lt_setenv (const char *name, const char *value)
5293 lt_debugprintf (__FILE__, __LINE__,
5294 "(lt_setenv) setting '%s' to '%s'\n",
5295 nonnull (name), nonnull (value));
5298 /* always make a copy, for consistency with !HAVE_SETENV */
5299 char *str = xstrdup (value);
5300 setenv (name, str, 1);
5302 int len = strlen (name) + 1 + strlen (value) + 1;
5303 char *str = XMALLOC (char, len);
5304 sprintf (str, "%s=%s", name, value);
5305 if (putenv (str) != EXIT_SUCCESS)
5314 lt_extend_str (const char *orig_value, const char *add, int to_end)
5317 if (orig_value && *orig_value)
5319 int orig_value_len = strlen (orig_value);
5320 int add_len = strlen (add);
5321 new_value = XMALLOC (char, add_len + orig_value_len + 1);
5324 strcpy (new_value, orig_value);
5325 strcpy (new_value + orig_value_len, add);
5329 strcpy (new_value, add);
5330 strcpy (new_value + add_len, orig_value);
5335 new_value = xstrdup (add);
5341 lt_update_exe_path (const char *name, const char *value)
5343 lt_debugprintf (__FILE__, __LINE__,
5344 "(lt_update_exe_path) modifying '%s' by prepending '%s'\n",
5345 nonnull (name), nonnull (value));
5347 if (name && *name && value && *value)
5349 char *new_value = lt_extend_str (getenv (name), value, 0);
5350 /* some systems can't cope with a ':'-terminated path #' */
5351 int len = strlen (new_value);
5352 while (((len = strlen (new_value)) > 0) && IS_PATH_SEPARATOR (new_value[len-1]))
5354 new_value[len-1] = '\0';
5356 lt_setenv (name, new_value);
5362 lt_update_lib_path (const char *name, const char *value)
5364 lt_debugprintf (__FILE__, __LINE__,
5365 "(lt_update_lib_path) modifying '%s' by prepending '%s'\n",
5366 nonnull (name), nonnull (value));
5368 if (name && *name && value && *value)
5370 char *new_value = lt_extend_str (getenv (name), value, 0);
5371 lt_setenv (name, new_value);
5381 /* Prepares an argument vector before calling spawn().
5382 Note that spawn() does not by itself call the command interpreter
5383 (getenv ("COMSPEC") != NULL ? getenv ("COMSPEC") :
5384 ({ OSVERSIONINFO v; v.dwOSVersionInfoSize = sizeof(OSVERSIONINFO);
5386 v.dwPlatformId == VER_PLATFORM_WIN32_NT;
5387 }) ? "cmd.exe" : "command.com").
5388 Instead it simply concatenates the arguments, separated by ' ', and calls
5389 CreateProcess(). We must quote the arguments since Win32 CreateProcess()
5390 interprets characters like ' ', '\t', '\\', '"' (but not '<' and '>') in a
5392 - Space and tab are interpreted as delimiters. They are not treated as
5393 delimiters if they are surrounded by double quotes: "...".
5394 - Unescaped double quotes are removed from the input. Their only effect is
5395 that within double quotes, space and tab are treated like normal
5397 - Backslashes not followed by double quotes are not special.
5398 - But 2*n+1 backslashes followed by a double quote become
5399 n backslashes followed by a double quote (n >= 0):
5404 #define SHELL_SPECIAL_CHARS "\"\\ \001\002\003\004\005\006\007\010\011\012\013\014\015\016\017\020\021\022\023\024\025\026\027\030\031\032\033\034\035\036\037"
5405 #define SHELL_SPACE_CHARS " \001\002\003\004\005\006\007\010\011\012\013\014\015\016\017\020\021\022\023\024\025\026\027\030\031\032\033\034\035\036\037"
5407 prepare_spawn (char **argv)
5413 /* Count number of arguments. */
5414 for (argc = 0; argv[argc] != NULL; argc++)
5417 /* Allocate new argument vector. */
5418 new_argv = XMALLOC (char *, argc + 1);
5420 /* Put quoted arguments into the new argument vector. */
5421 for (i = 0; i < argc; i++)
5423 const char *string = argv[i];
5425 if (string[0] == '\0')
5426 new_argv[i] = xstrdup ("\"\"");
5427 else if (strpbrk (string, SHELL_SPECIAL_CHARS) != NULL)
5429 int quote_around = (strpbrk (string, SHELL_SPACE_CHARS) != NULL);
5431 unsigned int backslashes;
5433 char *quoted_string;
5440 for (s = string; *s != '\0'; s++)
5444 length += backslashes + 1;
5452 length += backslashes + 1;
5454 quoted_string = XMALLOC (char, length + 1);
5460 for (s = string; *s != '\0'; s++)
5466 for (j = backslashes + 1; j > 0; j--)
5478 for (j = backslashes; j > 0; j--)
5484 new_argv[i] = quoted_string;
5487 new_argv[i] = (char *) string;
5489 new_argv[argc] = NULL;
5498 void lt_dump_script (FILE* f)
5501 func_emit_wrapper yes |
5503 s/^\(.\{79\}\)\(..*\)/\1\
5508 s/\([^\n]*\).*/ fputs ("\1", f);/p
5515 # end: func_emit_cwrapperexe_src
5517 # func_win32_import_lib_p ARG
5518 # True if ARG is an import lib, as indicated by $file_magic_cmd
5519 func_win32_import_lib_p ()
5522 case `eval $file_magic_cmd \"\$1\" 2>/dev/null | $SED -e 10q` in
5528 # func_mode_link arg...
5533 *-*-cygwin* | *-*-mingw* | *-*-pw32* | *-*-os2* | *-cegcc*)
5534 # It is impossible to link a dll without this setting, and
5535 # we shouldn't force the makefile maintainer to figure out
5536 # which system we are compiling for in order to pass an extra
5537 # flag for every libtool invocation.
5538 # allow_undefined=no
5540 # FIXME: Unfortunately, there are problems with the above when trying
5541 # to make a dll which has undefined symbols, in which case not
5542 # even a static library is built. For now, we need to specify
5543 # -no-undefined on the libtool link line when we can be certain
5544 # that all symbols are satisfied, otherwise we get a static library.
5551 libtool_args=$nonopt
5552 base_compile="$nonopt $@"
5553 compile_command=$nonopt
5554 finalize_command=$nonopt
5567 lib_search_path=`pwd`
5569 new_inherited_linker_flags=
5578 export_symbols_regex=
5586 precious_files_regex=
5587 prefer_static_libs=no
5600 single_module="${wl}-single_module"
5601 func_infer_tag $base_compile
5603 # We need to know -static, to get the right output filenames.
5608 test "$build_libtool_libs" != yes && \
5609 func_fatal_configuration "can not build a shared library"
5613 -all-static | -static | -static-libtool-libs)
5616 if test "$build_libtool_libs" = yes && test -z "$link_static_flag"; then
5617 func_warning "complete static linking is impossible in this configuration"
5619 if test -n "$link_static_flag"; then
5620 dlopen_self=$dlopen_self_static
5622 prefer_static_libs=yes
5625 if test -z "$pic_flag" && test -n "$link_static_flag"; then
5626 dlopen_self=$dlopen_self_static
5628 prefer_static_libs=built
5630 -static-libtool-libs)
5631 if test -z "$pic_flag" && test -n "$link_static_flag"; then
5632 dlopen_self=$dlopen_self_static
5634 prefer_static_libs=yes
5637 build_libtool_libs=no
5644 # See if our shared archives depend on static archives.
5645 test -n "$old_archive_from_new_cmds" && build_old_libs=yes
5647 # Go through the arguments, transforming them on the way.
5648 while test "$#" -gt 0; do
5651 func_quote_for_eval "$arg"
5652 qarg=$func_quote_for_eval_unquoted_result
5653 libtool_args+=" $func_quote_for_eval_result"
5655 # If the previous option needs an argument, assign it.
5656 if test -n "$prev"; then
5659 compile_command+=" @OUTPUT@"
5660 finalize_command+=" @OUTPUT@"
5671 if test "$preload" = no; then
5672 # Add the symbol object into the linking commands.
5673 compile_command+=" @SYMFILE@"
5674 finalize_command+=" @SYMFILE@"
5678 *.la | *.lo) ;; # We handle these cases below.
5680 if test "$dlself" = no; then
5688 if test "$prev" = dlprefiles; then
5690 elif test "$prev" = dlfiles && test "$dlopen_self" != yes; then
5700 if test "$prev" = dlfiles; then
5711 export_symbols="$arg"
5713 || func_fatal_error "symbol file \`$arg' does not exist"
5718 export_symbols_regex="$arg"
5726 *" $qarg.ltframework "*) ;;
5727 *) deplibs+=" $qarg.ltframework" # this is fixed later
5736 inst_prefix_dir="$arg"
5741 if test -f "$arg"; then
5744 for fil in `cat "$save_arg"`
5748 # A libtool-controlled object.
5750 # Check to see that this really is a libtool object.
5751 if func_lalib_unsafe_p "$arg"; then
5758 if test -z "$pic_object" ||
5759 test -z "$non_pic_object" ||
5760 test "$pic_object" = none &&
5761 test "$non_pic_object" = none; then
5762 func_fatal_error "cannot find name of object for \`$arg'"
5765 # Extract subdirectory from the argument.
5766 func_dirname "$arg" "/" ""
5767 xdir="$func_dirname_result"
5769 if test "$pic_object" != none; then
5770 # Prepend the subdirectory the object is found in.
5771 pic_object="$xdir$pic_object"
5773 if test "$prev" = dlfiles; then
5774 if test "$build_libtool_libs" = yes && test "$dlopen_support" = yes; then
5775 dlfiles+=" $pic_object"
5779 # If libtool objects are unsupported, then we need to preload.
5784 # CHECK ME: I think I busted this. -Ossama
5785 if test "$prev" = dlprefiles; then
5786 # Preload the old-style object.
5787 dlprefiles+=" $pic_object"
5792 libobjs+=" $pic_object"
5797 if test "$non_pic_object" != none; then
5798 # Prepend the subdirectory the object is found in.
5799 non_pic_object="$xdir$non_pic_object"
5801 # A standard non-PIC object
5802 non_pic_objects+=" $non_pic_object"
5803 if test -z "$pic_object" || test "$pic_object" = none ; then
5804 arg="$non_pic_object"
5807 # If the PIC object exists, use it instead.
5808 # $xdir was prepended to $pic_object above.
5809 non_pic_object="$pic_object"
5810 non_pic_objects+=" $non_pic_object"
5813 # Only an error if not doing a dry-run.
5814 if $opt_dry_run; then
5815 # Extract subdirectory from the argument.
5816 func_dirname "$arg" "/" ""
5817 xdir="$func_dirname_result"
5820 pic_object=$xdir$objdir/$func_lo2o_result
5821 non_pic_object=$xdir$func_lo2o_result
5822 libobjs+=" $pic_object"
5823 non_pic_objects+=" $non_pic_object"
5825 func_fatal_error "\`$arg' is not a valid libtool object"
5830 func_fatal_error "link input file \`$arg' does not exist"
5837 precious_files_regex="$arg"
5847 # We need an absolute path.
5849 [\\/]* | [A-Za-z]:[\\/]*) ;;
5851 func_fatal_error "only absolute run-paths are allowed"
5854 if test "$prev" = rpath; then
5857 *) rpath+=" $arg" ;;
5862 *) xrpath+=" $arg" ;;
5879 linker_flags+=" $qarg"
5880 compiler_flags+=" $qarg"
5882 compile_command+=" $qarg"
5883 finalize_command+=" $qarg"
5887 compiler_flags+=" $qarg"
5889 compile_command+=" $qarg"
5890 finalize_command+=" $qarg"
5894 linker_flags+=" $qarg"
5895 compiler_flags+=" $wl$qarg"
5897 compile_command+=" $wl$qarg"
5898 finalize_command+=" $wl$qarg"
5902 eval "$prev=\"\$arg\""
5907 fi # test -n "$prev"
5913 if test -n "$link_static_flag"; then
5914 # See comment for -static flag below, for more details.
5915 compile_command+=" $link_static_flag"
5916 finalize_command+=" $link_static_flag"
5922 # FIXME: remove this flag sometime in the future.
5923 func_fatal_error "\`-allow-undefined' must not be used because it is the default"
5951 -export-symbols | -export-symbols-regex)
5952 if test -n "$export_symbols" || test -n "$export_symbols_regex"; then
5953 func_fatal_error "more than one -exported-symbols argument is not allowed"
5955 if test "X$arg" = "X-export-symbols"; then
5973 # The native IRIX linker understands -LANG:*, -LIST:* and -LNO:*
5974 # so, if we see these flags be careful not to treat them like -L
5976 case $with_gcc/$host in
5977 no/*-*-irix* | /*-*-irix*)
5978 compile_command+=" $arg"
5979 finalize_command+=" $arg"
5986 func_stripname "-L" '' "$arg"
5987 if test -z "$func_stripname_result"; then
5988 if test "$#" -gt 0; then
5989 func_fatal_error "require no space between \`-L' and \`$1'"
5991 func_fatal_error "need path for \`-L' option"
5994 func_resolve_sysroot "$func_stripname_result"
5995 dir=$func_resolve_sysroot_result
5996 # We need an absolute path.
5998 [\\/]* | [A-Za-z]:[\\/]*) ;;
6000 absdir=`cd "$dir" && pwd`
6001 test -z "$absdir" && \
6002 func_fatal_error "cannot determine absolute directory name of \`$dir'"
6007 *" -L$dir "* | *" $arg "*)
6008 # Will only happen for absolute or sysroot arguments
6011 # Preserve sysroot, but never include relative directories
6013 [\\/]* | [A-Za-z]:[\\/]* | =*) deplibs+=" $arg" ;;
6014 *) deplibs+=" -L$dir" ;;
6016 lib_search_path+=" $dir"
6020 *-*-cygwin* | *-*-mingw* | *-*-pw32* | *-*-os2* | *-cegcc*)
6021 testbindir=`$ECHO "$dir" | $SED 's*/lib$*/bin*'`
6022 case :$dllsearchpath: in
6024 ::) dllsearchpath=$dir;;
6025 *) dllsearchpath+=":$dir";;
6027 case :$dllsearchpath: in
6028 *":$testbindir:"*) ;;
6029 ::) dllsearchpath=$testbindir;;
6030 *) dllsearchpath+=":$testbindir";;
6038 if test "X$arg" = "X-lc" || test "X$arg" = "X-lm"; then
6040 *-*-cygwin* | *-*-mingw* | *-*-pw32* | *-*-beos* | *-cegcc* | *-*-haiku*)
6041 # These systems don't actually have a C or math library (as such)
6045 # These systems don't actually have a C library (as such)
6046 test "X$arg" = "X-lc" && continue
6048 *-*-openbsd* | *-*-freebsd* | *-*-dragonfly*)
6049 # Do not include libc due to us having libc/libc_r.
6050 test "X$arg" = "X-lc" && continue
6052 *-*-rhapsody* | *-*-darwin1.[012])
6053 # Rhapsody C and math libraries are in the System framework
6054 deplibs+=" System.ltframework"
6057 *-*-sco3.2v5* | *-*-sco5v6*)
6058 # Causes problems with __ctype
6059 test "X$arg" = "X-lc" && continue
6061 *-*-sysv4.2uw2* | *-*-sysv5* | *-*-unixware* | *-*-OpenUNIX*)
6062 # Compiler inserts libc in the correct place for threads to work
6063 test "X$arg" = "X-lc" && continue
6066 elif test "X$arg" = "X-lc_r"; then
6068 *-*-openbsd* | *-*-freebsd* | *-*-dragonfly*)
6069 # Do not include libc_r directly, use -pthread flag.
6083 # Tru64 UNIX uses -model [arg] to determine the layout of C++
6084 # classes, name mangling, and exception handling.
6085 # Darwin uses the -arch flag to determine output architecture.
6086 -model|-arch|-isysroot|--sysroot)
6087 compiler_flags+=" $arg"
6088 compile_command+=" $arg"
6089 finalize_command+=" $arg"
6094 -mt|-mthreads|-kthread|-Kthread|-pthread|-pthreads|--thread-safe \
6095 |-threads|-fopenmp|-openmp|-mp|-xopenmp|-omp|-qsmp=*)
6096 compiler_flags+=" $arg"
6097 compile_command+=" $arg"
6098 finalize_command+=" $arg"
6099 case "$new_inherited_linker_flags " in
6101 * ) new_inherited_linker_flags+=" $arg" ;;
6107 single_module="${wl}-multi_module"
6118 *-*-cygwin* | *-*-mingw* | *-*-pw32* | *-*-os2* | *-*-darwin* | *-cegcc*)
6119 # The PATH hackery in wrapper scripts is required on Windows
6120 # and Darwin in order for the loader to find any dlls it needs.
6121 func_warning "\`-no-install' is ignored for $host"
6122 func_warning "assuming \`-no-fast-install' instead"
6125 *) no_install=yes ;;
6142 -precious-files-regex)
6163 func_stripname '-R' '' "$arg"
6164 dir=$func_stripname_result
6165 # We need an absolute path.
6167 [\\/]* | [A-Za-z]:[\\/]*) ;;
6169 func_stripname '=' '' "$dir"
6170 dir=$lt_sysroot$func_stripname_result
6173 func_fatal_error "only absolute run-paths are allowed"
6178 *) xrpath+=" $dir" ;;
6184 # The effects of -shared are defined in a previous loop.
6193 -static | -static-libtool-libs)
6194 # The effects of -static are defined in a previous loop.
6195 # We used to do the same as -all-static on platforms that
6196 # didn't have a PIC flag, but the assumption that the effects
6197 # would be equivalent was wrong. It would break on at least
6198 # Digital Unix and AIX.
6224 func_stripname '-Wc,' '' "$arg"
6225 args=$func_stripname_result
6227 save_ifs="$IFS"; IFS=','
6228 for flag in $args; do
6230 func_quote_for_eval "$flag"
6231 arg+=" $func_quote_for_eval_result"
6232 compiler_flags+=" $func_quote_for_eval_result"
6235 func_stripname ' ' '' "$arg"
6236 arg=$func_stripname_result
6240 func_stripname '-Wl,' '' "$arg"
6241 args=$func_stripname_result
6243 save_ifs="$IFS"; IFS=','
6244 for flag in $args; do
6246 func_quote_for_eval "$flag"
6247 arg+=" $wl$func_quote_for_eval_result"
6248 compiler_flags+=" $wl$func_quote_for_eval_result"
6249 linker_flags+=" $func_quote_for_eval_result"
6252 func_stripname ' ' '' "$arg"
6253 arg=$func_stripname_result
6273 func_quote_for_eval "$arg"
6274 arg="$func_quote_for_eval_result"
6277 # Flags to be passed through unchanged, with rationale:
6278 # -64, -mips[0-9] enable 64-bit mode for the SGI compiler
6279 # -r[0-9][0-9]* specify processor for the SGI compiler
6280 # -xarch=*, -xtarget=* enable 64-bit mode for the Sun compiler
6281 # +DA*, +DD* enable 64-bit mode for the HP compiler
6282 # -q* compiler args for the IBM compiler
6283 # -m*, -t[45]*, -txscale* architecture-specific flags for GCC
6284 # -F/path path to uninstalled frameworks, gcc on darwin
6285 # -p, -pg, --coverage, -fprofile-* profiling flags for GCC
6286 # @file GCC response files
6287 # -tp=* Portland pgcc target processor selection
6288 # --sysroot=* for sysroot support
6289 # -O*, -flto*, -fwhopr*, -fuse-linker-plugin GCC link-time optimization
6290 -64|-mips[0-9]|-r[0-9][0-9]*|-xarch=*|-xtarget=*|+DA*|+DD*|-q*|-m*| \
6291 -t[45]*|-txscale*|-p|-pg|--coverage|-fprofile-*|-F*|@*|-tp=*|--sysroot=*| \
6292 -O*|-flto*|-fwhopr*|-fuse-linker-plugin)
6293 func_quote_for_eval "$arg"
6294 arg="$func_quote_for_eval_result"
6295 compile_command+=" $arg"
6296 finalize_command+=" $arg"
6297 compiler_flags+=" $arg"
6301 # Some other compiler flag.
6303 func_quote_for_eval "$arg"
6304 arg="$func_quote_for_eval_result"
6308 # A standard object.
6313 # A libtool-controlled object.
6315 # Check to see that this really is a libtool object.
6316 if func_lalib_unsafe_p "$arg"; then
6323 if test -z "$pic_object" ||
6324 test -z "$non_pic_object" ||
6325 test "$pic_object" = none &&
6326 test "$non_pic_object" = none; then
6327 func_fatal_error "cannot find name of object for \`$arg'"
6330 # Extract subdirectory from the argument.
6331 func_dirname "$arg" "/" ""
6332 xdir="$func_dirname_result"
6334 if test "$pic_object" != none; then
6335 # Prepend the subdirectory the object is found in.
6336 pic_object="$xdir$pic_object"
6338 if test "$prev" = dlfiles; then
6339 if test "$build_libtool_libs" = yes && test "$dlopen_support" = yes; then
6340 dlfiles+=" $pic_object"
6344 # If libtool objects are unsupported, then we need to preload.
6349 # CHECK ME: I think I busted this. -Ossama
6350 if test "$prev" = dlprefiles; then
6351 # Preload the old-style object.
6352 dlprefiles+=" $pic_object"
6357 libobjs+=" $pic_object"
6362 if test "$non_pic_object" != none; then
6363 # Prepend the subdirectory the object is found in.
6364 non_pic_object="$xdir$non_pic_object"
6366 # A standard non-PIC object
6367 non_pic_objects+=" $non_pic_object"
6368 if test -z "$pic_object" || test "$pic_object" = none ; then
6369 arg="$non_pic_object"
6372 # If the PIC object exists, use it instead.
6373 # $xdir was prepended to $pic_object above.
6374 non_pic_object="$pic_object"
6375 non_pic_objects+=" $non_pic_object"
6378 # Only an error if not doing a dry-run.
6379 if $opt_dry_run; then
6380 # Extract subdirectory from the argument.
6381 func_dirname "$arg" "/" ""
6382 xdir="$func_dirname_result"
6385 pic_object=$xdir$objdir/$func_lo2o_result
6386 non_pic_object=$xdir$func_lo2o_result
6387 libobjs+=" $pic_object"
6388 non_pic_objects+=" $non_pic_object"
6390 func_fatal_error "\`$arg' is not a valid libtool object"
6398 old_deplibs+=" $arg"
6403 # A libtool-controlled library.
6405 func_resolve_sysroot "$arg"
6406 if test "$prev" = dlfiles; then
6407 # This library was specified with -dlopen.
6408 dlfiles+=" $func_resolve_sysroot_result"
6410 elif test "$prev" = dlprefiles; then
6411 # The library was specified with -dlpreopen.
6412 dlprefiles+=" $func_resolve_sysroot_result"
6415 deplibs+=" $func_resolve_sysroot_result"
6420 # Some other compiler argument.
6422 # Unknown arguments in both finalize_command and compile_command need
6423 # to be aesthetically quoted because they are evaled later.
6424 func_quote_for_eval "$arg"
6425 arg="$func_quote_for_eval_result"
6429 # Now actually substitute the argument into the commands.
6430 if test -n "$arg"; then
6431 compile_command+=" $arg"
6432 finalize_command+=" $arg"
6434 done # argument parsing loop
6436 test -n "$prev" && \
6437 func_fatal_help "the \`$prevarg' option requires an argument"
6439 if test "$export_dynamic" = yes && test -n "$export_dynamic_flag_spec"; then
6440 eval arg=\"$export_dynamic_flag_spec\"
6441 compile_command+=" $arg"
6442 finalize_command+=" $arg"
6446 # calculate the name of the file, without its directory
6447 func_basename "$output"
6448 outputname="$func_basename_result"
6449 libobjs_save="$libobjs"
6451 if test -n "$shlibpath_var"; then
6452 # get the directories listed in $shlibpath_var
6453 eval shlib_search_path=\`\$ECHO \"\${$shlibpath_var}\" \| \$SED \'s/:/ /g\'\`
6457 eval sys_lib_search_path=\"$sys_lib_search_path_spec\"
6458 eval sys_lib_dlsearch_path=\"$sys_lib_dlsearch_path_spec\"
6460 func_dirname "$output" "/" ""
6461 output_objdir="$func_dirname_result$objdir"
6462 func_to_tool_file "$output_objdir/"
6463 tool_output_objdir=$func_to_tool_file_result
6464 # Create the object directory.
6465 func_mkdir_p "$output_objdir"
6467 # Determine the type of output
6470 func_fatal_help "you must specify an output file"
6472 *.$libext) linkmode=oldlib ;;
6473 *.lo | *.$objext) linkmode=obj ;;
6474 *.la) linkmode=lib ;;
6475 *) linkmode=prog ;; # Anything else should be a program.
6481 # Find all interdependent deplibs by searching for libraries
6482 # that are linked more than once (e.g. -la -lb -la)
6483 for deplib in $deplibs; do
6484 if $opt_preserve_dup_deps ; then
6486 *" $deplib "*) specialdeplibs+=" $deplib" ;;
6492 if test "$linkmode" = lib; then
6493 libs="$predeps $libs $compiler_lib_search_path $postdeps"
6495 # Compute libraries that are listed more than once in $predeps
6496 # $postdeps and mark them as special (i.e., whose duplicates are
6497 # not to be eliminated).
6499 if $opt_duplicate_compiler_generated_deps; then
6500 for pre_post_dep in $predeps $postdeps; do
6501 case "$pre_post_deps " in
6502 *" $pre_post_dep "*) specialdeplibs+=" $pre_post_deps" ;;
6504 pre_post_deps+=" $pre_post_dep"
6513 need_relink=no # whether we're linking any uninstalled libtool libraries
6514 notinst_deplibs= # not-installed libtool libraries
6515 notinst_path= # paths that contain not-installed libtool libraries
6519 passes="conv dlpreopen link"
6520 for file in $dlfiles $dlprefiles; do
6524 func_fatal_help "libraries can \`-dlopen' only libtool libraries: $file"
6535 passes="conv scan dlopen dlpreopen link"
6541 for pass in $passes; do
6542 # The preopen pass in lib mode reverses $deplibs; put it back here
6543 # so that -L comes before libs that need it for instance...
6544 if test "$linkmode,$pass" = "lib,link"; then
6545 ## FIXME: Find the place where the list is rebuilt in the wrong
6546 ## order, and fix it there properly
6548 for deplib in $deplibs; do
6549 tmp_deplibs="$deplib $tmp_deplibs"
6551 deplibs="$tmp_deplibs"
6554 if test "$linkmode,$pass" = "lib,link" ||
6555 test "$linkmode,$pass" = "prog,scan"; then
6559 if test "$linkmode" = prog; then
6561 dlopen) libs="$dlfiles" ;;
6562 dlpreopen) libs="$dlprefiles" ;;
6563 link) libs="$deplibs %DEPLIBS% $dependency_libs" ;;
6566 if test "$linkmode,$pass" = "lib,dlpreopen"; then
6567 # Collect and forward deplibs of preopened libtool libs
6568 for lib in $dlprefiles; do
6569 # Ignore non-libtool-libs
6571 func_resolve_sysroot "$lib"
6573 *.la) func_source "$func_resolve_sysroot_result" ;;
6576 # Collect preopened libtool deplibs, except any this library
6577 # has declared as weak libs
6578 for deplib in $dependency_libs; do
6579 func_basename "$deplib"
6580 deplib_base=$func_basename_result
6581 case " $weak_libs " in
6582 *" $deplib_base "*) ;;
6583 *) deplibs+=" $deplib" ;;
6589 if test "$pass" = dlopen; then
6590 # Collect dlpreopened libraries
6591 save_deplibs="$deplibs"
6595 for deplib in $libs; do
6599 -mt|-mthreads|-kthread|-Kthread|-pthread|-pthreads|--thread-safe \
6600 |-threads|-fopenmp|-openmp|-mp|-xopenmp|-omp|-qsmp=*)
6601 if test "$linkmode,$pass" = "prog,link"; then
6602 compile_deplibs="$deplib $compile_deplibs"
6603 finalize_deplibs="$deplib $finalize_deplibs"
6605 compiler_flags+=" $deplib"
6606 if test "$linkmode" = lib ; then
6607 case "$new_inherited_linker_flags " in
6609 * ) new_inherited_linker_flags+=" $deplib" ;;
6616 if test "$linkmode" != lib && test "$linkmode" != prog; then
6617 func_warning "\`-l' is ignored for archives/objects"
6620 func_stripname '-l' '' "$deplib"
6621 name=$func_stripname_result
6622 if test "$linkmode" = lib; then
6623 searchdirs="$newlib_search_path $lib_search_path $compiler_lib_search_dirs $sys_lib_search_path $shlib_search_path"
6625 searchdirs="$newlib_search_path $lib_search_path $sys_lib_search_path $shlib_search_path"
6627 for searchdir in $searchdirs; do
6628 for search_ext in .la $std_shrext .so .a; do
6629 # Search the libtool library
6630 lib="$searchdir/lib${name}${search_ext}"
6631 if test -f "$lib"; then
6632 if test "$search_ext" = ".la"; then
6641 if test "$found" != yes; then
6642 # deplib doesn't seem to be a libtool library
6643 if test "$linkmode,$pass" = "prog,link"; then
6644 compile_deplibs="$deplib $compile_deplibs"
6645 finalize_deplibs="$deplib $finalize_deplibs"
6647 deplibs="$deplib $deplibs"
6648 test "$linkmode" = lib && newdependency_libs="$deplib $newdependency_libs"
6651 else # deplib is a libtool library
6652 # If $allow_libtool_libs_with_static_runtimes && $deplib is a stdlib,
6653 # We need to do some special things here, and not later.
6654 if test "X$allow_libtool_libs_with_static_runtimes" = "Xyes" ; then
6655 case " $predeps $postdeps " in
6657 if func_lalib_p "$lib"; then
6661 for l in $old_library $library_names; do
6664 if test "X$ll" = "X$old_library" ; then # only static version available
6666 func_dirname "$lib" "" "."
6667 ladir="$func_dirname_result"
6668 lib=$ladir/$old_library
6669 if test "$linkmode,$pass" = "prog,link"; then
6670 compile_deplibs="$deplib $compile_deplibs"
6671 finalize_deplibs="$deplib $finalize_deplibs"
6673 deplibs="$deplib $deplibs"
6674 test "$linkmode" = lib && newdependency_libs="$deplib $newdependency_libs"
6686 if test "$linkmode,$pass" = "prog,link"; then
6687 compile_deplibs="$deplib $compile_deplibs"
6688 finalize_deplibs="$deplib $finalize_deplibs"
6690 deplibs="$deplib $deplibs"
6691 if test "$linkmode" = lib ; then
6692 case "$new_inherited_linker_flags " in
6694 * ) new_inherited_linker_flags+=" $deplib" ;;
6703 deplibs="$deplib $deplibs"
6704 test "$pass" = conv && continue
6705 newdependency_libs="$deplib $newdependency_libs"
6706 func_stripname '-L' '' "$deplib"
6707 func_resolve_sysroot "$func_stripname_result"
6708 newlib_search_path+=" $func_resolve_sysroot_result"
6711 if test "$pass" = conv; then
6712 deplibs="$deplib $deplibs"
6715 if test "$pass" = scan; then
6716 deplibs="$deplib $deplibs"
6718 compile_deplibs="$deplib $compile_deplibs"
6719 finalize_deplibs="$deplib $finalize_deplibs"
6721 func_stripname '-L' '' "$deplib"
6722 func_resolve_sysroot "$func_stripname_result"
6723 newlib_search_path+=" $func_resolve_sysroot_result"
6726 func_warning "\`-L' is ignored for archives/objects"
6732 if test "$pass" = link; then
6733 func_stripname '-R' '' "$deplib"
6734 func_resolve_sysroot "$func_stripname_result"
6735 dir=$func_resolve_sysroot_result
6736 # Make sure the xrpath contains only unique directories.
6739 *) xrpath+=" $dir" ;;
6742 deplibs="$deplib $deplibs"
6746 func_resolve_sysroot "$deplib"
6747 lib=$func_resolve_sysroot_result
6750 if test "$pass" = conv; then
6751 deplibs="$deplib $deplibs"
6756 # Linking convenience modules into shared libraries is allowed,
6757 # but linking other static libraries is non-portable.
6758 case " $dlpreconveniencelibs " in
6762 case $deplibs_check_method in
6764 set dummy $deplibs_check_method; shift
6765 match_pattern_regex=`expr "$deplibs_check_method" : "$1 \(.*\)"`
6766 if eval "\$ECHO \"$deplib\"" 2>/dev/null | $SED 10q \
6767 | $EGREP "$match_pattern_regex" > /dev/null; then
6775 if test "$valid_a_lib" != yes; then
6777 $ECHO "*** Warning: Trying to link with static lib archive $deplib."
6778 echo "*** I have the capability to make that library automatically link in when"
6779 echo "*** you link to this library. But I can only do this if you have a"
6780 echo "*** shared version of the library, which you do not appear to have"
6781 echo "*** because the file extensions .$libext of this argument makes me believe"
6782 echo "*** that it is just a static archive that I should not use here."
6785 $ECHO "*** Warning: Linking the shared library $output against the"
6786 $ECHO "*** static library $deplib is not portable!"
6787 deplibs="$deplib $deplibs"
6794 if test "$pass" != link; then
6795 deplibs="$deplib $deplibs"
6797 compile_deplibs="$deplib $compile_deplibs"
6798 finalize_deplibs="$deplib $finalize_deplibs"
6805 if test "$pass" = conv; then
6806 deplibs="$deplib $deplibs"
6807 elif test "$linkmode" = prog; then
6808 if test "$pass" = dlpreopen || test "$dlopen_support" != yes || test "$build_libtool_libs" = no; then
6809 # If there is no dlopen support or we're linking statically,
6810 # we need to preload.
6811 newdlprefiles+=" $deplib"
6812 compile_deplibs="$deplib $compile_deplibs"
6813 finalize_deplibs="$deplib $finalize_deplibs"
6815 newdlfiles+=" $deplib"
6826 if test "$found" = yes || test -f "$lib"; then :
6828 func_fatal_error "cannot find the library \`$lib' or unhandled argument \`$deplib'"
6831 # Check to see that this really is a libtool archive.
6832 func_lalib_unsafe_p "$lib" \
6833 || func_fatal_error "\`$lib' is not a valid libtool archive"
6835 func_dirname "$lib" "" "."
6836 ladir="$func_dirname_result"
6844 inherited_linker_flags=
6845 # If the library was installed with an old release of libtool,
6846 # it will not redefine variables installed, or shouldnotlink
6855 # Convert "-framework foo" to "foo.ltframework"
6856 if test -n "$inherited_linker_flags"; then
6857 tmp_inherited_linker_flags=`$ECHO "$inherited_linker_flags" | $SED 's/-framework \([^ $]*\)/\1.ltframework/g'`
6858 for tmp_inherited_linker_flag in $tmp_inherited_linker_flags; do
6859 case " $new_inherited_linker_flags " in
6860 *" $tmp_inherited_linker_flag "*) ;;
6861 *) new_inherited_linker_flags+=" $tmp_inherited_linker_flag";;
6865 dependency_libs=`$ECHO " $dependency_libs" | $SED 's% \([^ $]*\).ltframework% -framework \1%g'`
6866 if test "$linkmode,$pass" = "lib,link" ||
6867 test "$linkmode,$pass" = "prog,scan" ||
6868 { test "$linkmode" != prog && test "$linkmode" != lib; }; then
6869 test -n "$dlopen" && dlfiles+=" $dlopen"
6870 test -n "$dlpreopen" && dlprefiles+=" $dlpreopen"
6873 if test "$pass" = conv; then
6874 # Only check for convenience libraries
6875 deplibs="$lib $deplibs"
6876 if test -z "$libdir"; then
6877 if test -z "$old_library"; then
6878 func_fatal_error "cannot find name of link library for \`$lib'"
6880 # It is a libtool convenience library, so add in its objects.
6881 convenience+=" $ladir/$objdir/$old_library"
6882 old_convenience+=" $ladir/$objdir/$old_library"
6883 elif test "$linkmode" != prog && test "$linkmode" != lib; then
6884 func_fatal_error "\`$lib' is not a convenience library"
6887 for deplib in $dependency_libs; do
6888 deplibs="$deplib $deplibs"
6889 if $opt_preserve_dup_deps ; then
6890 case "$tmp_libs " in
6891 *" $deplib "*) specialdeplibs+=" $deplib" ;;
6894 tmp_libs+=" $deplib"
6900 # Get the name of the library we link against.
6902 if test -n "$old_library" &&
6903 { test "$prefer_static_libs" = yes ||
6904 test "$prefer_static_libs,$installed" = "built,no"; }; then
6905 linklib=$old_library
6907 for l in $old_library $library_names; do
6911 if test -z "$linklib"; then
6912 func_fatal_error "cannot find name of link library for \`$lib'"
6915 # This library was specified with -dlopen.
6916 if test "$pass" = dlopen; then
6917 if test -z "$libdir"; then
6918 func_fatal_error "cannot -dlopen a convenience library: \`$lib'"
6920 if test -z "$dlname" ||
6921 test "$dlopen_support" != yes ||
6922 test "$build_libtool_libs" = no; then
6923 # If there is no dlname, no dlopen support or we're linking
6924 # statically, we need to preload. We also need to preload any
6925 # dependent libraries so libltdl's deplib preloader doesn't
6926 # bomb out in the load deplibs phase.
6927 dlprefiles+=" $lib $dependency_libs"
6934 # We need an absolute path.
6936 [\\/]* | [A-Za-z]:[\\/]*) abs_ladir="$ladir" ;;
6938 abs_ladir=`cd "$ladir" && pwd`
6939 if test -z "$abs_ladir"; then
6940 func_warning "cannot determine absolute directory name of \`$ladir'"
6941 func_warning "passing it literally to the linker, although it might fail"
6946 func_basename "$lib"
6947 laname="$func_basename_result"
6949 # Find the relevant object directory and library name.
6950 if test "X$installed" = Xyes; then
6951 if test ! -f "$lt_sysroot$libdir/$linklib" && test -f "$abs_ladir/$linklib"; then
6952 func_warning "library \`$lib' was moved."
6957 dir="$lt_sysroot$libdir"
6958 absdir="$lt_sysroot$libdir"
6960 test "X$hardcode_automatic" = Xyes && avoidtemprpath=yes
6962 if test ! -f "$ladir/$objdir/$linklib" && test -f "$abs_ladir/$linklib"; then
6965 # Remove this search path later
6966 notinst_path+=" $abs_ladir"
6968 dir="$ladir/$objdir"
6969 absdir="$abs_ladir/$objdir"
6970 # Remove this search path later
6971 notinst_path+=" $abs_ladir"
6973 fi # $installed = yes
6974 func_stripname 'lib' '.la' "$laname"
6975 name=$func_stripname_result
6977 # This library was specified with -dlpreopen.
6978 if test "$pass" = dlpreopen; then
6979 if test -z "$libdir" && test "$linkmode" = prog; then
6980 func_fatal_error "only libraries may -dlpreopen a convenience library: \`$lib'"
6983 # special handling for platforms with PE-DLLs.
6984 *cygwin* | *mingw* | *cegcc* )
6985 # Linker will automatically link against shared library if both
6986 # static and shared are present. Therefore, ensure we extract
6987 # symbols from the import library if a shared library is present
6988 # (otherwise, the dlopen module name will be incorrect). We do
6989 # this by putting the import library name into $newdlprefiles.
6990 # We recover the dlopen module name by 'saving' the la file
6991 # name in a special purpose variable, and (later) extracting the
6992 # dlname from the la file.
6993 if test -n "$dlname"; then
6994 func_tr_sh "$dir/$linklib"
6995 eval "libfile_$func_tr_sh_result=\$abs_ladir/\$laname"
6996 newdlprefiles+=" $dir/$linklib"
6998 newdlprefiles+=" $dir/$old_library"
6999 # Keep a list of preopened convenience libraries to check
7000 # that they are being used correctly in the link pass.
7001 test -z "$libdir" && \
7002 dlpreconveniencelibs+=" $dir/$old_library"
7006 # Prefer using a static library (so that no silly _DYNAMIC symbols
7007 # are required to link).
7008 if test -n "$old_library"; then
7009 newdlprefiles+=" $dir/$old_library"
7010 # Keep a list of preopened convenience libraries to check
7011 # that they are being used correctly in the link pass.
7012 test -z "$libdir" && \
7013 dlpreconveniencelibs+=" $dir/$old_library"
7014 # Otherwise, use the dlname, so that lt_dlopen finds it.
7015 elif test -n "$dlname"; then
7016 newdlprefiles+=" $dir/$dlname"
7018 newdlprefiles+=" $dir/$linklib"
7022 fi # $pass = dlpreopen
7024 if test -z "$libdir"; then
7025 # Link the convenience library
7026 if test "$linkmode" = lib; then
7027 deplibs="$dir/$old_library $deplibs"
7028 elif test "$linkmode,$pass" = "prog,link"; then
7029 compile_deplibs="$dir/$old_library $compile_deplibs"
7030 finalize_deplibs="$dir/$old_library $finalize_deplibs"
7032 deplibs="$lib $deplibs" # used for prog,scan pass
7038 if test "$linkmode" = prog && test "$pass" != link; then
7039 newlib_search_path+=" $ladir"
7040 deplibs="$lib $deplibs"
7043 if test "$link_all_deplibs" != no || test -z "$library_names" ||
7044 test "$build_libtool_libs" = no; then
7049 for deplib in $dependency_libs; do
7051 -L*) func_stripname '-L' '' "$deplib"
7052 func_resolve_sysroot "$func_stripname_result"
7053 newlib_search_path+=" $func_resolve_sysroot_result"
7056 # Need to link against all dependency_libs?
7057 if test "$linkalldeplibs" = yes; then
7058 deplibs="$deplib $deplibs"
7060 # Need to hardcode shared library paths
7061 # or/and link against static libraries
7062 newdependency_libs="$deplib $newdependency_libs"
7064 if $opt_preserve_dup_deps ; then
7065 case "$tmp_libs " in
7066 *" $deplib "*) specialdeplibs+=" $deplib" ;;
7069 tmp_libs+=" $deplib"
7072 fi # $linkmode = prog...
7074 if test "$linkmode,$pass" = "prog,link"; then
7075 if test -n "$library_names" &&
7076 { { test "$prefer_static_libs" = no ||
7077 test "$prefer_static_libs,$installed" = "built,yes"; } ||
7078 test -z "$old_library"; }; then
7079 # We need to hardcode the library path
7080 if test -n "$shlibpath_var" && test -z "$avoidtemprpath" ; then
7081 # Make sure the rpath contains only unique directories.
7082 case "$temp_rpath:" in
7084 *) temp_rpath+="$absdir:" ;;
7088 # Hardcode the library path.
7089 # Skip directories that are in the system default run-time
7091 case " $sys_lib_dlsearch_path " in
7094 case "$compile_rpath " in
7096 *) compile_rpath+=" $absdir" ;;
7100 case " $sys_lib_dlsearch_path " in
7103 case "$finalize_rpath " in
7105 *) finalize_rpath+=" $libdir" ;;
7109 fi # $linkmode,$pass = prog,link...
7111 if test "$alldeplibs" = yes &&
7112 { test "$deplibs_check_method" = pass_all ||
7113 { test "$build_libtool_libs" = yes &&
7114 test -n "$library_names"; }; }; then
7115 # We only need to search for static libraries
7120 link_static=no # Whether the deplib will be linked statically
7121 use_static_libs=$prefer_static_libs
7122 if test "$use_static_libs" = built && test "$installed" = yes; then
7125 if test -n "$library_names" &&
7126 { test "$use_static_libs" = no || test -z "$old_library"; }; then
7128 *cygwin* | *mingw* | *cegcc*)
7129 # No point in relinking DLLs because paths are not encoded
7130 notinst_deplibs+=" $lib"
7134 if test "$installed" = no; then
7135 notinst_deplibs+=" $lib"
7140 # This is a shared library
7142 # Warn about portability, can't link against -module's on some
7143 # systems (darwin). Don't bleat about dlopened modules though!
7145 for dlpremoduletest in $dlprefiles; do
7146 if test "X$dlpremoduletest" = "X$lib"; then
7147 dlopenmodule="$dlpremoduletest"
7151 if test -z "$dlopenmodule" && test "$shouldnotlink" = yes && test "$pass" = link; then
7153 if test "$linkmode" = prog; then
7154 $ECHO "*** Warning: Linking the executable $output against the loadable module"
7156 $ECHO "*** Warning: Linking the shared library $output against the loadable module"
7158 $ECHO "*** $linklib is not portable!"
7160 if test "$linkmode" = lib &&
7161 test "$hardcode_into_libs" = yes; then
7162 # Hardcode the library path.
7163 # Skip directories that are in the system default run-time
7165 case " $sys_lib_dlsearch_path " in
7168 case "$compile_rpath " in
7170 *) compile_rpath+=" $absdir" ;;
7174 case " $sys_lib_dlsearch_path " in
7177 case "$finalize_rpath " in
7179 *) finalize_rpath+=" $libdir" ;;
7185 if test -n "$old_archive_from_expsyms_cmds"; then
7186 # figure out the soname
7187 set dummy $library_names
7191 libname=`eval "\\$ECHO \"$libname_spec\""`
7192 # use dlname if we got it. it's perfectly good, no?
7193 if test -n "$dlname"; then
7195 elif test -n "$soname_spec"; then
7198 *cygwin* | mingw* | *cegcc*)
7199 func_arith $current - $age
7200 major=$func_arith_result
7204 eval soname=\"$soname_spec\"
7209 # Make a new name for the extract_expsyms_cmds to use
7211 func_basename "$soroot"
7212 soname="$func_basename_result"
7213 func_stripname 'lib' '.dll' "$soname"
7214 newlib=libimp-$func_stripname_result.a
7216 # If the library has no export list, then create one now
7217 if test -f "$output_objdir/$soname-def"; then :
7219 func_verbose "extracting exported symbol list from \`$soname'"
7220 func_execute_cmds "$extract_expsyms_cmds" 'exit $?'
7224 if test -f "$output_objdir/$newlib"; then :; else
7225 func_verbose "generating import library for \`$soname'"
7226 func_execute_cmds "$old_archive_from_expsyms_cmds" 'exit $?'
7228 # make sure the library variables are pointing to the new library
7231 fi # test -n "$old_archive_from_expsyms_cmds"
7233 if test "$linkmode" = prog || test "$opt_mode" != relink; then
7238 case $hardcode_action in
7239 immediate | unsupported)
7240 if test "$hardcode_direct" = no; then
7243 *-*-sco3.2v5.0.[024]*) add_dir="-L$dir" ;;
7244 *-*-sysv4*uw2*) add_dir="-L$dir" ;;
7245 *-*-sysv5OpenUNIX* | *-*-sysv5UnixWare7.[01].[10]* | \
7246 *-*-unixware7*) add_dir="-L$dir" ;;
7248 # if the lib is a (non-dlopened) module then we can not
7249 # link against it, someone is ignoring the earlier warnings
7250 if /usr/bin/file -L $add 2> /dev/null |
7251 $GREP ": [^:]* bundle" >/dev/null ; then
7252 if test "X$dlopenmodule" != "X$lib"; then
7253 $ECHO "*** Warning: lib $linklib is a module, not a shared library"
7254 if test -z "$old_library" ; then
7256 echo "*** And there doesn't seem to be a static archive available"
7257 echo "*** The link will probably fail, sorry"
7259 add="$dir/$old_library"
7261 elif test -n "$old_library"; then
7262 add="$dir/$old_library"
7266 elif test "$hardcode_minus_L" = no; then
7268 *-*-sunos*) add_shlibpath="$dir" ;;
7272 elif test "$hardcode_shlibpath_var" = no; then
7273 add_shlibpath="$dir"
7280 if test "$hardcode_direct" = yes &&
7281 test "$hardcode_direct_absolute" = no; then
7283 elif test "$hardcode_minus_L" = yes; then
7285 # Try looking first in the location we're being installed to.
7286 if test -n "$inst_prefix_dir"; then
7289 add_dir+=" -L$inst_prefix_dir$libdir"
7294 elif test "$hardcode_shlibpath_var" = yes; then
7295 add_shlibpath="$dir"
7304 if test "$lib_linked" != yes; then
7305 func_fatal_configuration "unsupported hardcode properties"
7308 if test -n "$add_shlibpath"; then
7309 case :$compile_shlibpath: in
7310 *":$add_shlibpath:"*) ;;
7311 *) compile_shlibpath+="$add_shlibpath:" ;;
7314 if test "$linkmode" = prog; then
7315 test -n "$add_dir" && compile_deplibs="$add_dir $compile_deplibs"
7316 test -n "$add" && compile_deplibs="$add $compile_deplibs"
7318 test -n "$add_dir" && deplibs="$add_dir $deplibs"
7319 test -n "$add" && deplibs="$add $deplibs"
7320 if test "$hardcode_direct" != yes &&
7321 test "$hardcode_minus_L" != yes &&
7322 test "$hardcode_shlibpath_var" = yes; then
7323 case :$finalize_shlibpath: in
7325 *) finalize_shlibpath+="$libdir:" ;;
7331 if test "$linkmode" = prog || test "$opt_mode" = relink; then
7335 # Finalize command for both is simple: just hardcode it.
7336 if test "$hardcode_direct" = yes &&
7337 test "$hardcode_direct_absolute" = no; then
7338 add="$libdir/$linklib"
7339 elif test "$hardcode_minus_L" = yes; then
7342 elif test "$hardcode_shlibpath_var" = yes; then
7343 case :$finalize_shlibpath: in
7345 *) finalize_shlibpath+="$libdir:" ;;
7348 elif test "$hardcode_automatic" = yes; then
7349 if test -n "$inst_prefix_dir" &&
7350 test -f "$inst_prefix_dir$libdir/$linklib" ; then
7351 add="$inst_prefix_dir$libdir/$linklib"
7353 add="$libdir/$linklib"
7356 # We cannot seem to hardcode it, guess we'll fake it.
7358 # Try looking first in the location we're being installed to.
7359 if test -n "$inst_prefix_dir"; then
7362 add_dir+=" -L$inst_prefix_dir$libdir"
7369 if test "$linkmode" = prog; then
7370 test -n "$add_dir" && finalize_deplibs="$add_dir $finalize_deplibs"
7371 test -n "$add" && finalize_deplibs="$add $finalize_deplibs"
7373 test -n "$add_dir" && deplibs="$add_dir $deplibs"
7374 test -n "$add" && deplibs="$add $deplibs"
7377 elif test "$linkmode" = prog; then
7378 # Here we assume that one of hardcode_direct or hardcode_minus_L
7379 # is not unsupported. This is valid on all known static and
7381 if test "$hardcode_direct" != unsupported; then
7382 test -n "$old_library" && linklib="$old_library"
7383 compile_deplibs="$dir/$linklib $compile_deplibs"
7384 finalize_deplibs="$dir/$linklib $finalize_deplibs"
7386 compile_deplibs="-l$name -L$dir $compile_deplibs"
7387 finalize_deplibs="-l$name -L$dir $finalize_deplibs"
7389 elif test "$build_libtool_libs" = yes; then
7390 # Not a shared library
7391 if test "$deplibs_check_method" != pass_all; then
7392 # We're trying link a shared library against a static one
7393 # but the system doesn't support it.
7395 # Just print a warning and add the library to dependency_libs so
7396 # that the program can be linked against the static library.
7398 $ECHO "*** Warning: This system can not link to static lib archive $lib."
7399 echo "*** I have the capability to make that library automatically link in when"
7400 echo "*** you link to this library. But I can only do this if you have a"
7401 echo "*** shared version of the library, which you do not appear to have."
7402 if test "$module" = yes; then
7403 echo "*** But as you try to build a module library, libtool will still create "
7404 echo "*** a static module, that should work as long as the dlopening application"
7405 echo "*** is linked with the -dlopen flag to resolve symbols at runtime."
7406 if test -z "$global_symbol_pipe"; then
7408 echo "*** However, this would only work if libtool was able to extract symbol"
7409 echo "*** lists from a program, using \`nm' or equivalent, but libtool could"
7410 echo "*** not find such a program. So, this module is probably useless."
7411 echo "*** \`nm' from GNU binutils and a full rebuild may help."
7413 if test "$build_old_libs" = no; then
7414 build_libtool_libs=module
7417 build_libtool_libs=no
7421 deplibs="$dir/$old_library $deplibs"
7424 fi # link shared/static library?
7426 if test "$linkmode" = lib; then
7427 if test -n "$dependency_libs" &&
7428 { test "$hardcode_into_libs" != yes ||
7429 test "$build_old_libs" = yes ||
7430 test "$link_static" = yes; }; then
7431 # Extract -R from dependency_libs
7433 for libdir in $dependency_libs; do
7435 -R*) func_stripname '-R' '' "$libdir"
7436 temp_xrpath=$func_stripname_result
7438 *" $temp_xrpath "*) ;;
7439 *) xrpath+=" $temp_xrpath";;
7441 *) temp_deplibs+=" $libdir";;
7444 dependency_libs="$temp_deplibs"
7447 newlib_search_path+=" $absdir"
7448 # Link against this library
7449 test "$link_static" = no && newdependency_libs="$abs_ladir/$laname $newdependency_libs"
7450 # ... and its dependency_libs
7452 for deplib in $dependency_libs; do
7453 newdependency_libs="$deplib $newdependency_libs"
7455 -L*) func_stripname '-L' '' "$deplib"
7456 func_resolve_sysroot "$func_stripname_result";;
7457 *) func_resolve_sysroot "$deplib" ;;
7459 if $opt_preserve_dup_deps ; then
7460 case "$tmp_libs " in
7461 *" $func_resolve_sysroot_result "*)
7462 specialdeplibs+=" $func_resolve_sysroot_result" ;;
7465 tmp_libs+=" $func_resolve_sysroot_result"
7468 if test "$link_all_deplibs" != no; then
7469 # Add the search paths of all dependency libraries
7470 for deplib in $dependency_libs; do
7473 -L*) path="$deplib" ;;
7475 func_resolve_sysroot "$deplib"
7476 deplib=$func_resolve_sysroot_result
7477 func_dirname "$deplib" "" "."
7478 dir=$func_dirname_result
7479 # We need an absolute path.
7481 [\\/]* | [A-Za-z]:[\\/]*) absdir="$dir" ;;
7483 absdir=`cd "$dir" && pwd`
7484 if test -z "$absdir"; then
7485 func_warning "cannot determine absolute directory name of \`$dir'"
7490 if $GREP "^installed=no" $deplib > /dev/null; then
7494 eval deplibrary_names=`${SED} -n -e 's/^library_names=\(.*\)$/\1/p' $deplib`
7495 if test -n "$deplibrary_names" ; then
7496 for tmp in $deplibrary_names ; do
7499 if test -f "$absdir/$objdir/$depdepl" ; then
7500 depdepl="$absdir/$objdir/$depdepl"
7501 darwin_install_name=`${OTOOL} -L $depdepl | awk '{if (NR == 2) {print $1;exit}}'`
7502 if test -z "$darwin_install_name"; then
7503 darwin_install_name=`${OTOOL64} -L $depdepl | awk '{if (NR == 2) {print $1;exit}}'`
7505 compiler_flags+=" ${wl}-dylib_file ${wl}${darwin_install_name}:${depdepl}"
7506 linker_flags+=" -dylib_file ${darwin_install_name}:${depdepl}"
7512 path="-L$absdir/$objdir"
7516 eval libdir=`${SED} -n -e 's/^libdir=\(.*\)$/\1/p' $deplib`
7517 test -z "$libdir" && \
7518 func_fatal_error "\`$deplib' is not a valid libtool archive"
7519 test "$absdir" != "$libdir" && \
7520 func_warning "\`$deplib' seems to be moved"
7526 case " $deplibs " in
7528 *) deplibs="$path $deplibs" ;;
7531 fi # link_all_deplibs != no
7533 done # for deplib in $libs
7534 if test "$pass" = link; then
7535 if test "$linkmode" = "prog"; then
7536 compile_deplibs="$new_inherited_linker_flags $compile_deplibs"
7537 finalize_deplibs="$new_inherited_linker_flags $finalize_deplibs"
7539 compiler_flags="$compiler_flags "`$ECHO " $new_inherited_linker_flags" | $SED 's% \([^ $]*\).ltframework% -framework \1%g'`
7542 dependency_libs="$newdependency_libs"
7543 if test "$pass" = dlpreopen; then
7544 # Link the dlpreopened libraries before other libraries
7545 for deplib in $save_deplibs; do
7546 deplibs="$deplib $deplibs"
7549 if test "$pass" != dlopen; then
7550 if test "$pass" != conv; then
7551 # Make sure lib_search_path contains only unique directories.
7553 for dir in $newlib_search_path; do
7554 case "$lib_search_path " in
7556 *) lib_search_path+=" $dir" ;;
7562 if test "$linkmode,$pass" != "prog,link"; then
7565 vars="compile_deplibs finalize_deplibs"
7567 for var in $vars dependency_libs; do
7568 # Add libraries to $var in reverse order
7569 eval tmp_libs=\"\$$var\"
7571 for deplib in $tmp_libs; do
7572 # FIXME: Pedantically, this is the right thing to do, so
7573 # that some nasty dependency loop isn't accidentally
7575 #new_libs="$deplib $new_libs"
7576 # Pragmatically, this seems to cause very few problems in
7579 -L*) new_libs="$deplib $new_libs" ;;
7582 # And here is the reason: when a library appears more
7583 # than once as an explicit dependence of a library, or
7584 # is implicitly linked in more than once by the
7585 # compiler, it is considered special, and multiple
7586 # occurrences thereof are not removed. Compare this
7587 # with having the same library being listed as a
7588 # dependency of multiple other libraries: in this case,
7589 # we know (pedantically, we assume) the library does not
7590 # need to be listed more than once, so we keep only the
7591 # last copy. This is not always right, but it is rare
7592 # enough that we require users that really mean to play
7593 # such unportable linking tricks to link the library
7594 # using -Wl,-lname, so that libtool does not consider it
7595 # for duplicate removal.
7596 case " $specialdeplibs " in
7597 *" $deplib "*) new_libs="$deplib $new_libs" ;;
7599 case " $new_libs " in
7601 *) new_libs="$deplib $new_libs" ;;
7609 for deplib in $new_libs; do
7612 case " $tmp_libs " in
7614 *) tmp_libs+=" $deplib" ;;
7617 *) tmp_libs+=" $deplib" ;;
7620 eval $var=\"$tmp_libs\"
7623 # Last step: remove runtime libs from dependency_libs
7624 # (they stay in deplibs)
7626 for i in $dependency_libs ; do
7627 case " $predeps $postdeps $compiler_lib_search_path " in
7632 if test -n "$i" ; then
7636 dependency_libs=$tmp_libs
7638 if test "$linkmode" = prog; then
7639 dlfiles="$newdlfiles"
7641 if test "$linkmode" = prog || test "$linkmode" = lib; then
7642 dlprefiles="$newdlprefiles"
7647 if test -n "$dlfiles$dlprefiles" || test "$dlself" != no; then
7648 func_warning "\`-dlopen' is ignored for archives"
7653 func_warning "\`-l' and \`-L' are ignored for archives" ;;
7656 test -n "$rpath" && \
7657 func_warning "\`-rpath' is ignored for archives"
7659 test -n "$xrpath" && \
7660 func_warning "\`-R' is ignored for archives"
7662 test -n "$vinfo" && \
7663 func_warning "\`-version-info/-version-number' is ignored for archives"
7665 test -n "$release" && \
7666 func_warning "\`-release' is ignored for archives"
7668 test -n "$export_symbols$export_symbols_regex" && \
7669 func_warning "\`-export-symbols' is ignored for archives"
7671 # Now set the variables for building old libraries.
7672 build_libtool_libs=no
7674 objs+="$old_deplibs"
7678 # Make sure we only generate libraries of the form `libNAME.la'.
7681 func_stripname 'lib' '.la' "$outputname"
7682 name=$func_stripname_result
7683 eval shared_ext=\"$shrext_cmds\"
7684 eval libname=\"$libname_spec\"
7687 test "$module" = no && \
7688 func_fatal_help "libtool library \`$output' must begin with \`lib'"
7690 if test "$need_lib_prefix" != no; then
7691 # Add the "lib" prefix for modules if required
7692 func_stripname '' '.la' "$outputname"
7693 name=$func_stripname_result
7694 eval shared_ext=\"$shrext_cmds\"
7695 eval libname=\"$libname_spec\"
7697 func_stripname '' '.la' "$outputname"
7698 libname=$func_stripname_result
7703 if test -n "$objs"; then
7704 if test "$deplibs_check_method" != pass_all; then
7705 func_fatal_error "cannot build libtool library \`$output' from non-libtool objects on this host:$objs"
7708 $ECHO "*** Warning: Linking the shared library $output against the non-libtool"
7709 $ECHO "*** objects $objs is not portable!"
7714 test "$dlself" != no && \
7715 func_warning "\`-dlopen self' is ignored for libtool libraries"
7719 test "$#" -gt 1 && \
7720 func_warning "ignoring multiple \`-rpath's for a libtool library"
7725 if test -z "$rpath"; then
7726 if test "$build_libtool_libs" = yes; then
7727 # Building a libtool convenience library.
7728 # Some compilers have problems with a `.al' extension so
7729 # convenience libraries should have the same extension an
7730 # archive normally would.
7731 oldlibs="$output_objdir/$libname.$libext $oldlibs"
7732 build_libtool_libs=convenience
7736 test -n "$vinfo" && \
7737 func_warning "\`-version-info/-version-number' is ignored for convenience libraries"
7739 test -n "$release" && \
7740 func_warning "\`-release' is ignored for convenience libraries"
7743 # Parse the version information argument.
7744 save_ifs="$IFS"; IFS=':'
7745 set dummy $vinfo 0 0 0
7750 func_fatal_help "too many parameters to \`-version-info'"
7752 # convert absolute version numbers to libtool ages
7753 # this retains compatibility with .la files and attempts
7754 # to make the code below a bit more comprehensible
7756 case $vinfo_number in
7760 number_revision="$3"
7762 # There are really only two kinds -- those that
7763 # use the current revision as the major version
7764 # and those that subtract age and use age as
7765 # a minor version. But, then there is irix
7766 # which has an extra 1 added just for fun
7768 case $version_type in
7769 # correct linux to gnu/linux during the next big refactor
7770 darwin|linux|osf|windows|none)
7771 func_arith $number_major + $number_minor
7772 current=$func_arith_result
7774 revision="$number_revision"
7776 freebsd-aout|freebsd-elf|qnx|sunos)
7777 current="$number_major"
7778 revision="$number_minor"
7782 func_arith $number_major + $number_minor
7783 current=$func_arith_result
7785 revision="$number_minor"
7786 lt_irix_increment=no
7797 # Check that each of the things are valid numbers.
7799 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]) ;;
7801 func_error "CURRENT \`$current' must be a nonnegative integer"
7802 func_fatal_error "\`$vinfo' is not valid version information"
7807 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]) ;;
7809 func_error "REVISION \`$revision' must be a nonnegative integer"
7810 func_fatal_error "\`$vinfo' is not valid version information"
7815 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]) ;;
7817 func_error "AGE \`$age' must be a nonnegative integer"
7818 func_fatal_error "\`$vinfo' is not valid version information"
7822 if test "$age" -gt "$current"; then
7823 func_error "AGE \`$age' is greater than the current interface number \`$current'"
7824 func_fatal_error "\`$vinfo' is not valid version information"
7827 # Calculate the version variables.
7831 case $version_type in
7835 # Like Linux, but with the current version available in
7836 # verstring for coding it into the library header
7837 func_arith $current - $age
7838 major=.$func_arith_result
7839 versuffix="$major.$age.$revision"
7840 # Darwin ld doesn't like 0 for these options...
7841 func_arith $current + 1
7842 minor_current=$func_arith_result
7843 xlcverstring="${wl}-compatibility_version ${wl}$minor_current ${wl}-current_version ${wl}$minor_current.$revision"
7844 verstring="-compatibility_version $minor_current -current_version $minor_current.$revision"
7849 versuffix=".$current.$revision";
7854 versuffix=".$current"
7858 if test "X$lt_irix_increment" = "Xno"; then
7859 func_arith $current - $age
7861 func_arith $current - $age + 1
7863 major=$func_arith_result
7865 case $version_type in
7866 nonstopux) verstring_prefix=nonstopux ;;
7867 *) verstring_prefix=sgi ;;
7869 verstring="$verstring_prefix$major.$revision"
7871 # Add in all the interfaces that we are compatible with.
7873 while test "$loop" -ne 0; do
7874 func_arith $revision - $loop
7875 iface=$func_arith_result
7876 func_arith $loop - 1
7877 loop=$func_arith_result
7878 verstring="$verstring_prefix$major.$iface:$verstring"
7881 # Before this point, $major must not contain `.'.
7883 versuffix="$major.$revision"
7886 linux) # correct to gnu/linux during the next big refactor
7887 func_arith $current - $age
7888 major=.$func_arith_result
7889 versuffix="$major.$age.$revision"
7893 func_arith $current - $age
7894 major=.$func_arith_result
7895 versuffix=".$current.$age.$revision"
7896 verstring="$current.$age.$revision"
7898 # Add in all the interfaces that we are compatible with.
7900 while test "$loop" -ne 0; do
7901 func_arith $current - $loop
7902 iface=$func_arith_result
7903 func_arith $loop - 1
7904 loop=$func_arith_result
7905 verstring="$verstring:${iface}.0"
7908 # Make executables depend on our current version.
7909 verstring+=":${current}.0"
7914 versuffix=".$current"
7919 versuffix=".$current.$revision"
7923 # Use '-' rather than '.', since we only want one
7924 # extension on DOS 8.3 filesystems.
7925 func_arith $current - $age
7926 major=$func_arith_result
7931 func_fatal_configuration "unknown library version type \`$version_type'"
7935 # Clear the version info if we defaulted, and they specified a release.
7936 if test -z "$vinfo" && test -n "$release"; then
7938 case $version_type in
7940 # we can't check for "0.0" in archive_cmds due to quoting
7941 # problems, so we reset it completely
7948 if test "$need_version" = no; then
7955 # Remove version info from name if versioning should be avoided
7956 if test "$avoid_version" = yes && test "$need_version" = no; then
7962 # Check to see if the archive will have undefined symbols.
7963 if test "$allow_undefined" = yes; then
7964 if test "$allow_undefined_flag" = unsupported; then
7965 func_warning "undefined symbols not allowed in $host shared libraries"
7966 build_libtool_libs=no
7970 # Don't allow undefined symbols.
7971 allow_undefined_flag="$no_undefined_flag"
7976 func_generate_dlsyms "$libname" "$libname" "yes"
7977 libobjs+=" $symfileobj"
7978 test "X$libobjs" = "X " && libobjs=
7980 if test "$opt_mode" != relink; then
7981 # Remove our outputs, but don't remove object files since they
7982 # may have been created when compiling PIC objects.
7984 tempremovelist=`$ECHO "$output_objdir/*"`
7985 for p in $tempremovelist; do
7989 $output_objdir/$outputname | $output_objdir/$libname.* | $output_objdir/${libname}${release}.*)
7990 if test "X$precious_files_regex" != "X"; then
7991 if $ECHO "$p" | $EGREP -e "$precious_files_regex" >/dev/null 2>&1
8001 test -n "$removelist" && \
8002 func_show_eval "${RM}r \$removelist"
8005 # Now set the variables for building old libraries.
8006 if test "$build_old_libs" = yes && test "$build_libtool_libs" != convenience ; then
8007 oldlibs+=" $output_objdir/$libname.$libext"
8009 # Transform .lo files to .o files.
8010 oldobjs="$objs "`$ECHO "$libobjs" | $SP2NL | $SED "/\.${libext}$/d; $lo2o" | $NL2SP`
8013 # Eliminate all temporary directories.
8014 #for path in $notinst_path; do
8015 # lib_search_path=`$ECHO "$lib_search_path " | $SED "s% $path % %g"`
8016 # deplibs=`$ECHO "$deplibs " | $SED "s% -L$path % %g"`
8017 # dependency_libs=`$ECHO "$dependency_libs " | $SED "s% -L$path % %g"`
8020 if test -n "$xrpath"; then
8021 # If the user specified any rpath flags, then add them.
8023 for libdir in $xrpath; do
8024 func_replace_sysroot "$libdir"
8025 temp_xrpath+=" -R$func_replace_sysroot_result"
8026 case "$finalize_rpath " in
8028 *) finalize_rpath+=" $libdir" ;;
8031 if test "$hardcode_into_libs" != yes || test "$build_old_libs" = yes; then
8032 dependency_libs="$temp_xrpath $dependency_libs"
8036 # Make sure dlfiles contains only unique files that won't be dlpreopened
8037 old_dlfiles="$dlfiles"
8039 for lib in $old_dlfiles; do
8040 case " $dlprefiles $dlfiles " in
8042 *) dlfiles+=" $lib" ;;
8046 # Make sure dlprefiles contains only unique files
8047 old_dlprefiles="$dlprefiles"
8049 for lib in $old_dlprefiles; do
8050 case "$dlprefiles " in
8052 *) dlprefiles+=" $lib" ;;
8056 if test "$build_libtool_libs" = yes; then
8057 if test -n "$rpath"; then
8059 *-*-cygwin* | *-*-mingw* | *-*-pw32* | *-*-os2* | *-*-beos* | *-cegcc* | *-*-haiku*)
8060 # these systems don't actually have a c library (as such)!
8062 *-*-rhapsody* | *-*-darwin1.[012])
8063 # Rhapsody C library is in the System framework
8064 deplibs+=" System.ltframework"
8067 # Don't link with libc until the a.out ld.so is fixed.
8069 *-*-openbsd* | *-*-freebsd* | *-*-dragonfly*)
8070 # Do not include libc due to us having libc/libc_r.
8072 *-*-sco3.2v5* | *-*-sco5v6*)
8073 # Causes problems with __ctype
8075 *-*-sysv4.2uw2* | *-*-sysv5* | *-*-unixware* | *-*-OpenUNIX*)
8076 # Compiler inserts libc in the correct place for threads to work
8079 # Add libc to deplibs on all other systems if necessary.
8080 if test "$build_libtool_need_lc" = "yes"; then
8087 # Transform deplibs into only deplibs that can be linked in shared.
8089 libname_save=$libname
8090 release_save=$release
8091 versuffix_save=$versuffix
8093 # I'm not sure if I'm treating the release correctly. I think
8094 # release should show up in the -l (ie -lgmp5) so we don't want to
8095 # add it in twice. Is that correct?
8101 case $deplibs_check_method in
8103 # Don't check for shared/static. Everything works.
8104 # This might be a little naive. We might want to check
8105 # whether the library exists or not. But this is on
8106 # osf3 & osf4 and I'm not really sure... Just
8107 # implementing what was already the behavior.
8111 # This code stresses the "libraries are programs" paradigm to its
8112 # limits. Maybe even breaks it. We compile a program, linking it
8113 # against the deplibs as a proxy for the library. Then we can check
8114 # whether they linked in statically or dynamically with ldd.
8115 $opt_dry_run || $RM conftest.c
8116 cat > conftest.c <<EOF
8117 int main() { return 0; }
8119 $opt_dry_run || $RM conftest
8120 if $LTCC $LTCFLAGS -o conftest conftest.c $deplibs; then
8121 ldd_output=`ldd conftest`
8122 for i in $deplibs; do
8125 func_stripname -l '' "$i"
8126 name=$func_stripname_result
8127 if test "X$allow_libtool_libs_with_static_runtimes" = "Xyes" ; then
8128 case " $predeps $postdeps " in
8135 if test -n "$i" ; then
8136 libname=`eval "\\$ECHO \"$libname_spec\""`
8137 deplib_matches=`eval "\\$ECHO \"$library_names_spec\""`
8138 set dummy $deplib_matches; shift
8140 if test `expr "$ldd_output" : ".*$deplib_match"` -ne 0 ; then
8145 $ECHO "*** Warning: dynamic linker does not accept needed library $i."
8146 echo "*** I have the capability to make that library automatically link in when"
8147 echo "*** you link to this library. But I can only do this if you have a"
8148 echo "*** shared version of the library, which I believe you do not have"
8149 echo "*** because a test_compile did reveal that the linker did not use it for"
8150 echo "*** its dynamic dependency list that programs get resolved with at runtime."
8160 # Error occurred in the first compile. Let's try to salvage
8161 # the situation: Compile a separate program for each library.
8162 for i in $deplibs; do
8165 func_stripname -l '' "$i"
8166 name=$func_stripname_result
8167 $opt_dry_run || $RM conftest
8168 if $LTCC $LTCFLAGS -o conftest conftest.c $i; then
8169 ldd_output=`ldd conftest`
8170 if test "X$allow_libtool_libs_with_static_runtimes" = "Xyes" ; then
8171 case " $predeps $postdeps " in
8178 if test -n "$i" ; then
8179 libname=`eval "\\$ECHO \"$libname_spec\""`
8180 deplib_matches=`eval "\\$ECHO \"$library_names_spec\""`
8181 set dummy $deplib_matches; shift
8183 if test `expr "$ldd_output" : ".*$deplib_match"` -ne 0 ; then
8188 $ECHO "*** Warning: dynamic linker does not accept needed library $i."
8189 echo "*** I have the capability to make that library automatically link in when"
8190 echo "*** you link to this library. But I can only do this if you have a"
8191 echo "*** shared version of the library, which you do not appear to have"
8192 echo "*** because a test_compile did reveal that the linker did not use this one"
8193 echo "*** as a dynamic dependency that programs can get resolved with at runtime."
8199 $ECHO "*** Warning! Library $i is needed by this library but I was not able to"
8200 echo "*** make it link in! You will probably need to install it or some"
8201 echo "*** library that it depends on before this library will be fully"
8202 echo "*** functional. Installing it before continuing would be even better."
8213 set dummy $deplibs_check_method; shift
8214 file_magic_regex=`expr "$deplibs_check_method" : "$1 \(.*\)"`
8215 for a_deplib in $deplibs; do
8218 func_stripname -l '' "$a_deplib"
8219 name=$func_stripname_result
8220 if test "X$allow_libtool_libs_with_static_runtimes" = "Xyes" ; then
8221 case " $predeps $postdeps " in
8223 newdeplibs+=" $a_deplib"
8228 if test -n "$a_deplib" ; then
8229 libname=`eval "\\$ECHO \"$libname_spec\""`
8230 if test -n "$file_magic_glob"; then
8231 libnameglob=`func_echo_all "$libname" | $SED -e $file_magic_glob`
8233 libnameglob=$libname
8235 test "$want_nocaseglob" = yes && nocaseglob=`shopt -p nocaseglob`
8236 for i in $lib_search_path $sys_lib_search_path $shlib_search_path; do
8237 if test "$want_nocaseglob" = yes; then
8239 potential_libs=`ls $i/$libnameglob[.-]* 2>/dev/null`
8242 potential_libs=`ls $i/$libnameglob[.-]* 2>/dev/null`
8244 for potent_lib in $potential_libs; do
8245 # Follow soft links.
8246 if ls -lLd "$potent_lib" 2>/dev/null |
8247 $GREP " -> " >/dev/null; then
8250 # The statement above tries to avoid entering an
8251 # endless loop below, in case of cyclic links.
8252 # We might still enter an endless loop, since a link
8253 # loop can be closed while we follow links,
8255 potlib="$potent_lib"
8256 while test -h "$potlib" 2>/dev/null; do
8257 potliblink=`ls -ld $potlib | ${SED} 's/.* -> //'`
8259 [\\/]* | [A-Za-z]:[\\/]*) potlib="$potliblink";;
8260 *) potlib=`$ECHO "$potlib" | $SED 's,[^/]*$,,'`"$potliblink";;
8263 if eval $file_magic_cmd \"\$potlib\" 2>/dev/null |
8265 $EGREP "$file_magic_regex" > /dev/null; then
8266 newdeplibs+=" $a_deplib"
8273 if test -n "$a_deplib" ; then
8276 $ECHO "*** Warning: linker path does not have real file for library $a_deplib."
8277 echo "*** I have the capability to make that library automatically link in when"
8278 echo "*** you link to this library. But I can only do this if you have a"
8279 echo "*** shared version of the library, which you do not appear to have"
8280 echo "*** because I did check the linker path looking for a file starting"
8281 if test -z "$potlib" ; then
8282 $ECHO "*** with $libname but no candidates were found. (...for file magic test)"
8284 $ECHO "*** with $libname and none of the candidates passed a file format test"
8285 $ECHO "*** using a file magic. Last file checked: $potlib"
8290 # Add a -L argument.
8291 newdeplibs+=" $a_deplib"
8294 done # Gone through all deplibs.
8297 set dummy $deplibs_check_method; shift
8298 match_pattern_regex=`expr "$deplibs_check_method" : "$1 \(.*\)"`
8299 for a_deplib in $deplibs; do
8302 func_stripname -l '' "$a_deplib"
8303 name=$func_stripname_result
8304 if test "X$allow_libtool_libs_with_static_runtimes" = "Xyes" ; then
8305 case " $predeps $postdeps " in
8307 newdeplibs+=" $a_deplib"
8312 if test -n "$a_deplib" ; then
8313 libname=`eval "\\$ECHO \"$libname_spec\""`
8314 for i in $lib_search_path $sys_lib_search_path $shlib_search_path; do
8315 potential_libs=`ls $i/$libname[.-]* 2>/dev/null`
8316 for potent_lib in $potential_libs; do
8317 potlib="$potent_lib" # see symlink-check above in file_magic test
8318 if eval "\$ECHO \"$potent_lib\"" 2>/dev/null | $SED 10q | \
8319 $EGREP "$match_pattern_regex" > /dev/null; then
8320 newdeplibs+=" $a_deplib"
8327 if test -n "$a_deplib" ; then
8330 $ECHO "*** Warning: linker path does not have real file for library $a_deplib."
8331 echo "*** I have the capability to make that library automatically link in when"
8332 echo "*** you link to this library. But I can only do this if you have a"
8333 echo "*** shared version of the library, which you do not appear to have"
8334 echo "*** because I did check the linker path looking for a file starting"
8335 if test -z "$potlib" ; then
8336 $ECHO "*** with $libname but no candidates were found. (...for regex pattern test)"
8338 $ECHO "*** with $libname and none of the candidates passed a file format test"
8339 $ECHO "*** using a regex pattern. Last file checked: $potlib"
8344 # Add a -L argument.
8345 newdeplibs+=" $a_deplib"
8348 done # Gone through all deplibs.
8352 tmp_deplibs=`$ECHO " $deplibs" | $SED 's/ -lc$//; s/ -[LR][^ ]*//g'`
8353 if test "X$allow_libtool_libs_with_static_runtimes" = "Xyes" ; then
8354 for i in $predeps $postdeps ; do
8355 # can't use Xsed below, because $i might contain '/'
8356 tmp_deplibs=`$ECHO " $tmp_deplibs" | $SED "s,$i,,"`
8359 case $tmp_deplibs in
8362 if test "X$deplibs_check_method" = "Xnone"; then
8363 echo "*** Warning: inter-library dependencies are not supported in this platform."
8365 echo "*** Warning: inter-library dependencies are not known to be supported."
8367 echo "*** All declared inter-library dependencies are being dropped."
8373 versuffix=$versuffix_save
8375 release=$release_save
8376 libname=$libname_save
8380 *-*-rhapsody* | *-*-darwin1.[012])
8381 # On Rhapsody replace the C library with the System framework
8382 newdeplibs=`$ECHO " $newdeplibs" | $SED 's/ -lc / System.ltframework /'`
8386 if test "$droppeddeps" = yes; then
8387 if test "$module" = yes; then
8389 echo "*** Warning: libtool could not satisfy all declared inter-library"
8390 $ECHO "*** dependencies of module $libname. Therefore, libtool will create"
8391 echo "*** a static module, that should work as long as the dlopening"
8392 echo "*** application is linked with the -dlopen flag."
8393 if test -z "$global_symbol_pipe"; then
8395 echo "*** However, this would only work if libtool was able to extract symbol"
8396 echo "*** lists from a program, using \`nm' or equivalent, but libtool could"
8397 echo "*** not find such a program. So, this module is probably useless."
8398 echo "*** \`nm' from GNU binutils and a full rebuild may help."
8400 if test "$build_old_libs" = no; then
8401 oldlibs="$output_objdir/$libname.$libext"
8402 build_libtool_libs=module
8405 build_libtool_libs=no
8408 echo "*** The inter-library dependencies that have been dropped here will be"
8409 echo "*** automatically added whenever a program is linked with this library"
8410 echo "*** or is declared to -dlopen it."
8412 if test "$allow_undefined" = no; then
8414 echo "*** Since this library must not contain undefined symbols,"
8415 echo "*** because either the platform does not support them or"
8416 echo "*** it was explicitly requested with -no-undefined,"
8417 echo "*** libtool will only create a static version of it."
8418 if test "$build_old_libs" = no; then
8419 oldlibs="$output_objdir/$libname.$libext"
8420 build_libtool_libs=module
8423 build_libtool_libs=no
8428 # Done checking deplibs!
8431 # Time to change all our "foo.ltframework" stuff back to "-framework foo"
8434 newdeplibs=`$ECHO " $newdeplibs" | $SED 's% \([^ $]*\).ltframework% -framework \1%g'`
8435 new_inherited_linker_flags=`$ECHO " $new_inherited_linker_flags" | $SED 's% \([^ $]*\).ltframework% -framework \1%g'`
8436 deplibs=`$ECHO " $deplibs" | $SED 's% \([^ $]*\).ltframework% -framework \1%g'`
8440 # move library search paths that coincide with paths to not yet
8441 # installed libraries to the beginning of the library search list
8443 for path in $notinst_path; do
8444 case " $new_libs " in
8445 *" -L$path/$objdir "*) ;;
8447 case " $deplibs " in
8448 *" -L$path/$objdir "*)
8449 new_libs+=" -L$path/$objdir" ;;
8454 for deplib in $deplibs; do
8457 case " $new_libs " in
8459 *) new_libs+=" $deplib" ;;
8462 *) new_libs+=" $deplib" ;;
8467 # All the library-specific variables (install_libdir is set above).
8472 # Test again, we may have decided not to build it any more
8473 if test "$build_libtool_libs" = yes; then
8474 # Remove ${wl} instances when linking with ld.
8475 # FIXME: should test the right _cmds variable.
8476 case $archive_cmds in
8479 if test "$hardcode_into_libs" = yes; then
8480 # Hardcode the library paths
8483 rpath="$finalize_rpath"
8484 test "$opt_mode" != relink && rpath="$compile_rpath$rpath"
8485 for libdir in $rpath; do
8486 if test -n "$hardcode_libdir_flag_spec"; then
8487 if test -n "$hardcode_libdir_separator"; then
8488 func_replace_sysroot "$libdir"
8489 libdir=$func_replace_sysroot_result
8490 if test -z "$hardcode_libdirs"; then
8491 hardcode_libdirs="$libdir"
8493 # Just accumulate the unique libdirs.
8494 case $hardcode_libdir_separator$hardcode_libdirs$hardcode_libdir_separator in
8495 *"$hardcode_libdir_separator$libdir$hardcode_libdir_separator"*)
8498 hardcode_libdirs+="$hardcode_libdir_separator$libdir"
8503 eval flag=\"$hardcode_libdir_flag_spec\"
8506 elif test -n "$runpath_var"; then
8507 case "$perm_rpath " in
8509 *) perm_rpath+=" $libdir" ;;
8513 # Substitute the hardcoded libdirs into the rpath.
8514 if test -n "$hardcode_libdir_separator" &&
8515 test -n "$hardcode_libdirs"; then
8516 libdir="$hardcode_libdirs"
8517 eval "dep_rpath=\"$hardcode_libdir_flag_spec\""
8519 if test -n "$runpath_var" && test -n "$perm_rpath"; then
8520 # We should set the runpath_var.
8522 for dir in $perm_rpath; do
8525 eval "$runpath_var='$rpath\$$runpath_var'; export $runpath_var"
8527 test -n "$dep_rpath" && deplibs="$dep_rpath $deplibs"
8530 shlibpath="$finalize_shlibpath"
8531 test "$opt_mode" != relink && shlibpath="$compile_shlibpath$shlibpath"
8532 if test -n "$shlibpath"; then
8533 eval "$shlibpath_var='$shlibpath\$$shlibpath_var'; export $shlibpath_var"
8536 # Get the real and link names of the library.
8537 eval shared_ext=\"$shrext_cmds\"
8538 eval library_names=\"$library_names_spec\"
8539 set dummy $library_names
8544 if test -n "$soname_spec"; then
8545 eval soname=\"$soname_spec\"
8549 if test -z "$dlname"; then
8553 lib="$output_objdir/$realname"
8560 # Use standard objects if they are pic
8561 test -z "$pic_flag" && libobjs=`$ECHO "$libobjs" | $SP2NL | $SED "$lo2o" | $NL2SP`
8562 test "X$libobjs" = "X " && libobjs=
8565 if test -n "$export_symbols" && test -n "$include_expsyms"; then
8566 $opt_dry_run || cp "$export_symbols" "$output_objdir/$libname.uexp"
8567 export_symbols="$output_objdir/$libname.uexp"
8568 delfiles+=" $export_symbols"
8571 orig_export_symbols=
8573 cygwin* | mingw* | cegcc*)
8574 if test -n "$export_symbols" && test -z "$export_symbols_regex"; then
8575 # exporting using user supplied symfile
8576 if test "x`$SED 1q $export_symbols`" != xEXPORTS; then
8577 # and it's NOT already a .def file. Must figure out
8578 # which of the given symbols are data symbols and tag
8579 # them as such. So, trigger use of export_symbols_cmds.
8580 # export_symbols gets reassigned inside the "prepare
8581 # the list of exported symbols" if statement, so the
8582 # include_expsyms logic still works.
8583 orig_export_symbols="$export_symbols"
8585 always_export_symbols=yes
8591 # Prepare the list of exported symbols
8592 if test -z "$export_symbols"; then
8593 if test "$always_export_symbols" = yes || test -n "$export_symbols_regex"; then
8594 func_verbose "generating symbol list for \`$libname.la'"
8595 export_symbols="$output_objdir/$libname.exp"
8596 $opt_dry_run || $RM $export_symbols
8597 cmds=$export_symbols_cmds
8598 save_ifs="$IFS"; IFS='~'
8599 for cmd1 in $cmds; do
8601 # Take the normal branch if the nm_file_list_spec branch
8602 # doesn't work or if tool conversion is not needed.
8603 case $nm_file_list_spec~$to_tool_file_cmd in
8604 *~func_convert_file_noop | *~func_convert_file_msys_to_w32 | ~*)
8605 try_normal_branch=yes
8608 len=$func_len_result
8611 try_normal_branch=no
8614 if test "$try_normal_branch" = yes \
8615 && { test "$len" -lt "$max_cmd_len" \
8616 || test "$max_cmd_len" -le -1; }
8618 func_show_eval "$cmd" 'exit $?'
8619 skipped_export=false
8620 elif test -n "$nm_file_list_spec"; then
8621 func_basename "$output"
8622 output_la=$func_basename_result
8623 save_libobjs=$libobjs
8625 output=${output_objdir}/${output_la}.nm
8626 func_to_tool_file "$output"
8627 libobjs=$nm_file_list_spec$func_to_tool_file_result
8628 delfiles+=" $output"
8629 func_verbose "creating $NM input file list: $output"
8630 for obj in $save_libobjs; do
8631 func_to_tool_file "$obj"
8632 $ECHO "$func_to_tool_file_result"
8635 func_show_eval "$cmd" 'exit $?'
8637 libobjs=$save_libobjs
8638 skipped_export=false
8640 # The command line is too long to execute in one step.
8641 func_verbose "using reloadable object file for export list..."
8643 # Break out early, otherwise skipped_export may be
8644 # set to false by a later but shorter cmd.
8649 if test -n "$export_symbols_regex" && test "X$skipped_export" != "X:"; then
8650 func_show_eval '$EGREP -e "$export_symbols_regex" "$export_symbols" > "${export_symbols}T"'
8651 func_show_eval '$MV "${export_symbols}T" "$export_symbols"'
8656 if test -n "$export_symbols" && test -n "$include_expsyms"; then
8657 tmp_export_symbols="$export_symbols"
8658 test -n "$orig_export_symbols" && tmp_export_symbols="$orig_export_symbols"
8659 $opt_dry_run || eval '$ECHO "$include_expsyms" | $SP2NL >> "$tmp_export_symbols"'
8662 if test "X$skipped_export" != "X:" && test -n "$orig_export_symbols"; then
8663 # The given exports_symbols file has to be filtered, so filter it.
8664 func_verbose "filter symbol list for \`$libname.la' to tag DATA exports"
8665 # FIXME: $output_objdir/$libname.filter potentially contains lots of
8666 # 's' commands which not all seds can handle. GNU sed should be fine
8667 # though. Also, the filter scales superlinearly with the number of
8668 # global variables. join(1) would be nice here, but unfortunately
8669 # isn't a blessed tool.
8670 $opt_dry_run || $SED -e '/[ ,]DATA/!d;s,\(.*\)\([ \,].*\),s|^\1$|\1\2|,' < $export_symbols > $output_objdir/$libname.filter
8671 delfiles+=" $export_symbols $output_objdir/$libname.filter"
8672 export_symbols=$output_objdir/$libname.def
8673 $opt_dry_run || $SED -f $output_objdir/$libname.filter < $orig_export_symbols > $export_symbols
8677 for test_deplib in $deplibs; do
8678 case " $convenience " in
8679 *" $test_deplib "*) ;;
8681 tmp_deplibs+=" $test_deplib"
8685 deplibs="$tmp_deplibs"
8687 if test -n "$convenience"; then
8688 if test -n "$whole_archive_flag_spec" &&
8689 test "$compiler_needs_object" = yes &&
8690 test -z "$libobjs"; then
8691 # extract the archives, so we have objects to list.
8692 # TODO: could optimize this to just extract one archive.
8693 whole_archive_flag_spec=
8695 if test -n "$whole_archive_flag_spec"; then
8696 save_libobjs=$libobjs
8697 eval libobjs=\"\$libobjs $whole_archive_flag_spec\"
8698 test "X$libobjs" = "X " && libobjs=
8700 gentop="$output_objdir/${outputname}x"
8701 generated+=" $gentop"
8703 func_extract_archives $gentop $convenience
8704 libobjs+=" $func_extract_archives_result"
8705 test "X$libobjs" = "X " && libobjs=
8709 if test "$thread_safe" = yes && test -n "$thread_safe_flag_spec"; then
8710 eval flag=\"$thread_safe_flag_spec\"
8711 linker_flags+=" $flag"
8714 # Make a backup of the uninstalled library when relinking
8715 if test "$opt_mode" = relink; then
8716 $opt_dry_run || eval '(cd $output_objdir && $RM ${realname}U && $MV $realname ${realname}U)' || exit $?
8719 # Do each of the archive commands.
8720 if test "$module" = yes && test -n "$module_cmds" ; then
8721 if test -n "$export_symbols" && test -n "$module_expsym_cmds"; then
8722 eval test_cmds=\"$module_expsym_cmds\"
8723 cmds=$module_expsym_cmds
8725 eval test_cmds=\"$module_cmds\"
8729 if test -n "$export_symbols" && test -n "$archive_expsym_cmds"; then
8730 eval test_cmds=\"$archive_expsym_cmds\"
8731 cmds=$archive_expsym_cmds
8733 eval test_cmds=\"$archive_cmds\"
8738 if test "X$skipped_export" != "X:" &&
8739 func_len " $test_cmds" &&
8740 len=$func_len_result &&
8741 test "$len" -lt "$max_cmd_len" || test "$max_cmd_len" -le -1; then
8744 # The command line is too long to link in one step, link piecewise
8745 # or, if using GNU ld and skipped_export is not :, use a linker
8748 # Save the value of $output and $libobjs because we want to
8749 # use them later. If we have whole_archive_flag_spec, we
8750 # want to use save_libobjs as it was before
8751 # whole_archive_flag_spec was expanded, because we can't
8752 # assume the linker understands whole_archive_flag_spec.
8753 # This may have to be revisited, in case too many
8754 # convenience libraries get linked in and end up exceeding
8756 if test -z "$convenience" || test -z "$whole_archive_flag_spec"; then
8757 save_libobjs=$libobjs
8760 func_basename "$output"
8761 output_la=$func_basename_result
8763 # Clear the reloadable object creation command queue and
8764 # initialize k to one.
8771 if test -n "$save_libobjs" && test "X$skipped_export" != "X:" && test "$with_gnu_ld" = yes; then
8772 output=${output_objdir}/${output_la}.lnkscript
8773 func_verbose "creating GNU ld script: $output"
8774 echo 'INPUT (' > $output
8775 for obj in $save_libobjs
8777 func_to_tool_file "$obj"
8778 $ECHO "$func_to_tool_file_result" >> $output
8781 delfiles+=" $output"
8782 func_to_tool_file "$output"
8783 output=$func_to_tool_file_result
8784 elif test -n "$save_libobjs" && test "X$skipped_export" != "X:" && test "X$file_list_spec" != X; then
8785 output=${output_objdir}/${output_la}.lnk
8786 func_verbose "creating linker input file list: $output"
8791 if test "$compiler_needs_object" = yes; then
8797 func_to_tool_file "$obj"
8798 $ECHO "$func_to_tool_file_result" >> $output
8800 delfiles+=" $output"
8801 func_to_tool_file "$output"
8802 output=$firstobj\"$file_list_spec$func_to_tool_file_result\"
8804 if test -n "$save_libobjs"; then
8805 func_verbose "creating reloadable object files..."
8806 output=$output_objdir/$output_la-${k}.$objext
8807 eval test_cmds=\"$reload_cmds\"
8808 func_len " $test_cmds"
8809 len0=$func_len_result
8812 # Loop over the list of objects to be linked.
8813 for obj in $save_libobjs
8816 func_arith $len + $func_len_result
8817 len=$func_arith_result
8818 if test "X$objlist" = X ||
8819 test "$len" -lt "$max_cmd_len"; then
8822 # The command $test_cmds is almost too long, add a
8823 # command to the queue.
8824 if test "$k" -eq 1 ; then
8825 # The first file doesn't have a previous command to add.
8826 reload_objs=$objlist
8827 eval concat_cmds=\"$reload_cmds\"
8829 # All subsequent reloadable object files will link in
8830 # the last one created.
8831 reload_objs="$objlist $last_robj"
8832 eval concat_cmds=\"\$concat_cmds~$reload_cmds~\$RM $last_robj\"
8834 last_robj=$output_objdir/$output_la-${k}.$objext
8836 k=$func_arith_result
8837 output=$output_objdir/$output_la-${k}.$objext
8839 func_len " $last_robj"
8840 func_arith $len0 + $func_len_result
8841 len=$func_arith_result
8844 # Handle the remaining objects by creating one last
8845 # reloadable object file. All subsequent reloadable object
8846 # files will link in the last one created.
8847 test -z "$concat_cmds" || concat_cmds=$concat_cmds~
8848 reload_objs="$objlist $last_robj"
8849 eval concat_cmds=\"\${concat_cmds}$reload_cmds\"
8850 if test -n "$last_robj"; then
8851 eval concat_cmds=\"\${concat_cmds}~\$RM $last_robj\"
8853 delfiles+=" $output"
8859 if ${skipped_export-false}; then
8860 func_verbose "generating symbol list for \`$libname.la'"
8861 export_symbols="$output_objdir/$libname.exp"
8862 $opt_dry_run || $RM $export_symbols
8864 # Append the command to create the export file.
8865 test -z "$concat_cmds" || concat_cmds=$concat_cmds~
8866 eval concat_cmds=\"\$concat_cmds$export_symbols_cmds\"
8867 if test -n "$last_robj"; then
8868 eval concat_cmds=\"\$concat_cmds~\$RM $last_robj\"
8872 test -n "$save_libobjs" &&
8873 func_verbose "creating a temporary reloadable object file: $output"
8875 # Loop through the commands generated above and execute them.
8876 save_ifs="$IFS"; IFS='~'
8877 for cmd in $concat_cmds; do
8880 func_quote_for_expand "$cmd"
8881 eval "func_echo $func_quote_for_expand_result"
8883 $opt_dry_run || eval "$cmd" || {
8886 # Restore the uninstalled library and exit
8887 if test "$opt_mode" = relink; then
8888 ( cd "$output_objdir" && \
8889 $RM "${realname}T" && \
8890 $MV "${realname}U" "$realname" )
8898 if test -n "$export_symbols_regex" && ${skipped_export-false}; then
8899 func_show_eval '$EGREP -e "$export_symbols_regex" "$export_symbols" > "${export_symbols}T"'
8900 func_show_eval '$MV "${export_symbols}T" "$export_symbols"'
8904 if ${skipped_export-false}; then
8905 if test -n "$export_symbols" && test -n "$include_expsyms"; then
8906 tmp_export_symbols="$export_symbols"
8907 test -n "$orig_export_symbols" && tmp_export_symbols="$orig_export_symbols"
8908 $opt_dry_run || eval '$ECHO "$include_expsyms" | $SP2NL >> "$tmp_export_symbols"'
8911 if test -n "$orig_export_symbols"; then
8912 # The given exports_symbols file has to be filtered, so filter it.
8913 func_verbose "filter symbol list for \`$libname.la' to tag DATA exports"
8914 # FIXME: $output_objdir/$libname.filter potentially contains lots of
8915 # 's' commands which not all seds can handle. GNU sed should be fine
8916 # though. Also, the filter scales superlinearly with the number of
8917 # global variables. join(1) would be nice here, but unfortunately
8918 # isn't a blessed tool.
8919 $opt_dry_run || $SED -e '/[ ,]DATA/!d;s,\(.*\)\([ \,].*\),s|^\1$|\1\2|,' < $export_symbols > $output_objdir/$libname.filter
8920 delfiles+=" $export_symbols $output_objdir/$libname.filter"
8921 export_symbols=$output_objdir/$libname.def
8922 $opt_dry_run || $SED -f $output_objdir/$libname.filter < $orig_export_symbols > $export_symbols
8927 # Restore the value of output.
8930 if test -n "$convenience" && test -n "$whole_archive_flag_spec"; then
8931 eval libobjs=\"\$libobjs $whole_archive_flag_spec\"
8932 test "X$libobjs" = "X " && libobjs=
8934 # Expand the library linking commands again to reset the
8935 # value of $libobjs for piecewise linking.
8937 # Do each of the archive commands.
8938 if test "$module" = yes && test -n "$module_cmds" ; then
8939 if test -n "$export_symbols" && test -n "$module_expsym_cmds"; then
8940 cmds=$module_expsym_cmds
8945 if test -n "$export_symbols" && test -n "$archive_expsym_cmds"; then
8946 cmds=$archive_expsym_cmds
8953 if test -n "$delfiles"; then
8954 # Append the command to remove temporary files to $cmds.
8955 eval cmds=\"\$cmds~\$RM $delfiles\"
8958 # Add any objects from preloaded convenience libraries
8959 if test -n "$dlprefiles"; then
8960 gentop="$output_objdir/${outputname}x"
8961 generated+=" $gentop"
8963 func_extract_archives $gentop $dlprefiles
8964 libobjs+=" $func_extract_archives_result"
8965 test "X$libobjs" = "X " && libobjs=
8968 save_ifs="$IFS"; IFS='~'
8969 for cmd in $cmds; do
8973 func_quote_for_expand "$cmd"
8974 eval "func_echo $func_quote_for_expand_result"
8976 $opt_dry_run || eval "$cmd" || {
8979 # Restore the uninstalled library and exit
8980 if test "$opt_mode" = relink; then
8981 ( cd "$output_objdir" && \
8982 $RM "${realname}T" && \
8983 $MV "${realname}U" "$realname" )
8991 # Restore the uninstalled library and exit
8992 if test "$opt_mode" = relink; then
8993 $opt_dry_run || eval '(cd $output_objdir && $RM ${realname}T && $MV $realname ${realname}T && $MV ${realname}U $realname)' || exit $?
8995 if test -n "$convenience"; then
8996 if test -z "$whole_archive_flag_spec"; then
8997 func_show_eval '${RM}r "$gentop"'
9004 # Create links to the real library.
9005 for linkname in $linknames; do
9006 if test "$realname" != "$linkname"; then
9007 func_show_eval '(cd "$output_objdir" && $RM "$linkname" && $LN_S "$realname" "$linkname")' 'exit $?'
9011 # If -module or -export-dynamic was specified, set the dlname.
9012 if test "$module" = yes || test "$export_dynamic" = yes; then
9013 # On all known operating systems, these are identical.
9020 if test -n "$dlfiles$dlprefiles" || test "$dlself" != no; then
9021 func_warning "\`-dlopen' is ignored for objects"
9026 func_warning "\`-l' and \`-L' are ignored for objects" ;;
9029 test -n "$rpath" && \
9030 func_warning "\`-rpath' is ignored for objects"
9032 test -n "$xrpath" && \
9033 func_warning "\`-R' is ignored for objects"
9035 test -n "$vinfo" && \
9036 func_warning "\`-version-info' is ignored for objects"
9038 test -n "$release" && \
9039 func_warning "\`-release' is ignored for objects"
9043 test -n "$objs$old_deplibs" && \
9044 func_fatal_error "cannot build library object \`$output' from non-libtool objects"
9048 obj=$func_lo2o_result
9056 # Delete the old objects.
9057 $opt_dry_run || $RM $obj $libobj
9059 # Objects from convenience libraries. This assumes
9060 # single-version convenience libraries. Whenever we create
9061 # different ones for PIC/non-PIC, this we'll have to duplicate
9065 # reload_cmds runs $LD directly, so let us get rid of
9066 # -Wl from whole_archive_flag_spec and hope we can get by with
9067 # turning comma into space..
9070 if test -n "$convenience"; then
9071 if test -n "$whole_archive_flag_spec"; then
9072 eval tmp_whole_archive_flags=\"$whole_archive_flag_spec\"
9073 reload_conv_objs=$reload_objs\ `$ECHO "$tmp_whole_archive_flags" | $SED 's|,| |g'`
9075 gentop="$output_objdir/${obj}x"
9076 generated+=" $gentop"
9078 func_extract_archives $gentop $convenience
9079 reload_conv_objs="$reload_objs $func_extract_archives_result"
9083 # If we're not building shared, we need to use non_pic_objs
9084 test "$build_libtool_libs" != yes && libobjs="$non_pic_objects"
9086 # Create the old-style object.
9087 reload_objs="$objs$old_deplibs "`$ECHO "$libobjs" | $SP2NL | $SED "/\.${libext}$/d; /\.lib$/d; $lo2o" | $NL2SP`" $reload_conv_objs" ### testsuite: skip nested quoting test
9090 func_execute_cmds "$reload_cmds" 'exit $?'
9092 # Exit if we aren't doing a library object file.
9093 if test -z "$libobj"; then
9094 if test -n "$gentop"; then
9095 func_show_eval '${RM}r "$gentop"'
9101 if test "$build_libtool_libs" != yes; then
9102 if test -n "$gentop"; then
9103 func_show_eval '${RM}r "$gentop"'
9106 # Create an invalid libtool object if no PIC, so that we don't
9107 # accidentally link it into a program.
9108 # $show "echo timestamp > $libobj"
9109 # $opt_dry_run || eval "echo timestamp > $libobj" || exit $?
9113 if test -n "$pic_flag" || test "$pic_mode" != default; then
9114 # Only do commands if we really have different PIC objects.
9115 reload_objs="$libobjs $reload_conv_objs"
9117 func_execute_cmds "$reload_cmds" 'exit $?'
9120 if test -n "$gentop"; then
9121 func_show_eval '${RM}r "$gentop"'
9129 *cygwin*) func_stripname '' '.exe' "$output"
9130 output=$func_stripname_result.exe;;
9132 test -n "$vinfo" && \
9133 func_warning "\`-version-info' is ignored for programs"
9135 test -n "$release" && \
9136 func_warning "\`-release' is ignored for programs"
9138 test "$preload" = yes \
9139 && test "$dlopen_support" = unknown \
9140 && test "$dlopen_self" = unknown \
9141 && test "$dlopen_self_static" = unknown && \
9142 func_warning "\`LT_INIT([dlopen])' not used. Assuming no dlopen support."
9145 *-*-rhapsody* | *-*-darwin1.[012])
9146 # On Rhapsody replace the C library is the System framework
9147 compile_deplibs=`$ECHO " $compile_deplibs" | $SED 's/ -lc / System.ltframework /'`
9148 finalize_deplibs=`$ECHO " $finalize_deplibs" | $SED 's/ -lc / System.ltframework /'`
9154 # Don't allow lazy linking, it breaks C++ global constructors
9155 # But is supposedly fixed on 10.4 or later (yay!).
9156 if test "$tagname" = CXX ; then
9157 case ${MACOSX_DEPLOYMENT_TARGET-10.0} in
9159 compile_command+=" ${wl}-bind_at_load"
9160 finalize_command+=" ${wl}-bind_at_load"
9164 # Time to change all our "foo.ltframework" stuff back to "-framework foo"
9165 compile_deplibs=`$ECHO " $compile_deplibs" | $SED 's% \([^ $]*\).ltframework% -framework \1%g'`
9166 finalize_deplibs=`$ECHO " $finalize_deplibs" | $SED 's% \([^ $]*\).ltframework% -framework \1%g'`
9171 # move library search paths that coincide with paths to not yet
9172 # installed libraries to the beginning of the library search list
9174 for path in $notinst_path; do
9175 case " $new_libs " in
9176 *" -L$path/$objdir "*) ;;
9178 case " $compile_deplibs " in
9179 *" -L$path/$objdir "*)
9180 new_libs+=" -L$path/$objdir" ;;
9185 for deplib in $compile_deplibs; do
9188 case " $new_libs " in
9190 *) new_libs+=" $deplib" ;;
9193 *) new_libs+=" $deplib" ;;
9196 compile_deplibs="$new_libs"
9199 compile_command+=" $compile_deplibs"
9200 finalize_command+=" $finalize_deplibs"
9202 if test -n "$rpath$xrpath"; then
9203 # If the user specified any rpath flags, then add them.
9204 for libdir in $rpath $xrpath; do
9205 # This is the magic to use -rpath.
9206 case "$finalize_rpath " in
9208 *) finalize_rpath+=" $libdir" ;;
9213 # Now hardcode the library paths
9216 for libdir in $compile_rpath $finalize_rpath; do
9217 if test -n "$hardcode_libdir_flag_spec"; then
9218 if test -n "$hardcode_libdir_separator"; then
9219 if test -z "$hardcode_libdirs"; then
9220 hardcode_libdirs="$libdir"
9222 # Just accumulate the unique libdirs.
9223 case $hardcode_libdir_separator$hardcode_libdirs$hardcode_libdir_separator in
9224 *"$hardcode_libdir_separator$libdir$hardcode_libdir_separator"*)
9227 hardcode_libdirs+="$hardcode_libdir_separator$libdir"
9232 eval flag=\"$hardcode_libdir_flag_spec\"
9235 elif test -n "$runpath_var"; then
9236 case "$perm_rpath " in
9238 *) perm_rpath+=" $libdir" ;;
9242 *-*-cygwin* | *-*-mingw* | *-*-pw32* | *-*-os2* | *-cegcc*)
9243 testbindir=`${ECHO} "$libdir" | ${SED} -e 's*/lib$*/bin*'`
9244 case :$dllsearchpath: in
9246 ::) dllsearchpath=$libdir;;
9247 *) dllsearchpath+=":$libdir";;
9249 case :$dllsearchpath: in
9250 *":$testbindir:"*) ;;
9251 ::) dllsearchpath=$testbindir;;
9252 *) dllsearchpath+=":$testbindir";;
9257 # Substitute the hardcoded libdirs into the rpath.
9258 if test -n "$hardcode_libdir_separator" &&
9259 test -n "$hardcode_libdirs"; then
9260 libdir="$hardcode_libdirs"
9261 eval rpath=\" $hardcode_libdir_flag_spec\"
9263 compile_rpath="$rpath"
9267 for libdir in $finalize_rpath; do
9268 if test -n "$hardcode_libdir_flag_spec"; then
9269 if test -n "$hardcode_libdir_separator"; then
9270 if test -z "$hardcode_libdirs"; then
9271 hardcode_libdirs="$libdir"
9273 # Just accumulate the unique libdirs.
9274 case $hardcode_libdir_separator$hardcode_libdirs$hardcode_libdir_separator in
9275 *"$hardcode_libdir_separator$libdir$hardcode_libdir_separator"*)
9278 hardcode_libdirs+="$hardcode_libdir_separator$libdir"
9283 eval flag=\"$hardcode_libdir_flag_spec\"
9286 elif test -n "$runpath_var"; then
9287 case "$finalize_perm_rpath " in
9289 *) finalize_perm_rpath+=" $libdir" ;;
9293 # Substitute the hardcoded libdirs into the rpath.
9294 if test -n "$hardcode_libdir_separator" &&
9295 test -n "$hardcode_libdirs"; then
9296 libdir="$hardcode_libdirs"
9297 eval rpath=\" $hardcode_libdir_flag_spec\"
9299 finalize_rpath="$rpath"
9301 if test -n "$libobjs" && test "$build_old_libs" = yes; then
9302 # Transform all the library objects into standard objects.
9303 compile_command=`$ECHO "$compile_command" | $SP2NL | $SED "$lo2o" | $NL2SP`
9304 finalize_command=`$ECHO "$finalize_command" | $SP2NL | $SED "$lo2o" | $NL2SP`
9307 func_generate_dlsyms "$outputname" "@PROGRAM@" "no"
9309 # template prelinking step
9310 if test -n "$prelink_cmds"; then
9311 func_execute_cmds "$prelink_cmds" 'exit $?'
9314 wrappers_required=yes
9316 *cegcc* | *mingw32ce*)
9317 # Disable wrappers for cegcc and mingw32ce hosts, we are cross compiling anyway.
9318 wrappers_required=no
9320 *cygwin* | *mingw* )
9321 if test "$build_libtool_libs" != yes; then
9322 wrappers_required=no
9326 if test "$need_relink" = no || test "$build_libtool_libs" != yes; then
9327 wrappers_required=no
9331 if test "$wrappers_required" = no; then
9332 # Replace the output file specification.
9333 compile_command=`$ECHO "$compile_command" | $SED 's%@OUTPUT@%'"$output"'%g'`
9334 link_command="$compile_command$compile_rpath"
9336 # We have no uninstalled library dependencies, so finalize right now.
9338 func_show_eval "$link_command" 'exit_status=$?'
9340 if test -n "$postlink_cmds"; then
9341 func_to_tool_file "$output"
9342 postlink_cmds=`func_echo_all "$postlink_cmds" | $SED -e 's%@OUTPUT@%'"$output"'%g' -e 's%@TOOL_OUTPUT@%'"$func_to_tool_file_result"'%g'`
9343 func_execute_cmds "$postlink_cmds" 'exit $?'
9346 # Delete the generated files.
9347 if test -f "$output_objdir/${outputname}S.${objext}"; then
9348 func_show_eval '$RM "$output_objdir/${outputname}S.${objext}"'
9354 if test -n "$compile_shlibpath$finalize_shlibpath"; then
9355 compile_command="$shlibpath_var=\"$compile_shlibpath$finalize_shlibpath\$$shlibpath_var\" $compile_command"
9357 if test -n "$finalize_shlibpath"; then
9358 finalize_command="$shlibpath_var=\"$finalize_shlibpath\$$shlibpath_var\" $finalize_command"
9363 if test -n "$runpath_var"; then
9364 if test -n "$perm_rpath"; then
9365 # We should set the runpath_var.
9367 for dir in $perm_rpath; do
9370 compile_var="$runpath_var=\"$rpath\$$runpath_var\" "
9372 if test -n "$finalize_perm_rpath"; then
9373 # We should set the runpath_var.
9375 for dir in $finalize_perm_rpath; do
9378 finalize_var="$runpath_var=\"$rpath\$$runpath_var\" "
9382 if test "$no_install" = yes; then
9383 # We don't need to create a wrapper script.
9384 link_command="$compile_var$compile_command$compile_rpath"
9385 # Replace the output file specification.
9386 link_command=`$ECHO "$link_command" | $SED 's%@OUTPUT@%'"$output"'%g'`
9387 # Delete the old output file.
9388 $opt_dry_run || $RM $output
9389 # Link the executable and exit
9390 func_show_eval "$link_command" 'exit $?'
9392 if test -n "$postlink_cmds"; then
9393 func_to_tool_file "$output"
9394 postlink_cmds=`func_echo_all "$postlink_cmds" | $SED -e 's%@OUTPUT@%'"$output"'%g' -e 's%@TOOL_OUTPUT@%'"$func_to_tool_file_result"'%g'`
9395 func_execute_cmds "$postlink_cmds" 'exit $?'
9401 if test "$hardcode_action" = relink; then
9402 # Fast installation is not supported
9403 link_command="$compile_var$compile_command$compile_rpath"
9404 relink_command="$finalize_var$finalize_command$finalize_rpath"
9406 func_warning "this platform does not like uninstalled shared libraries"
9407 func_warning "\`$output' will be relinked during installation"
9409 if test "$fast_install" != no; then
9410 link_command="$finalize_var$compile_command$finalize_rpath"
9411 if test "$fast_install" = yes; then
9412 relink_command=`$ECHO "$compile_var$compile_command$compile_rpath" | $SED 's%@OUTPUT@%\$progdir/\$file%g'`
9414 # fast_install is set to needless
9418 link_command="$compile_var$compile_command$compile_rpath"
9419 relink_command="$finalize_var$finalize_command$finalize_rpath"
9423 # Replace the output file specification.
9424 link_command=`$ECHO "$link_command" | $SED 's%@OUTPUT@%'"$output_objdir/$outputname"'%g'`
9426 # Delete the old output files.
9427 $opt_dry_run || $RM $output $output_objdir/$outputname $output_objdir/lt-$outputname
9429 func_show_eval "$link_command" 'exit $?'
9431 if test -n "$postlink_cmds"; then
9432 func_to_tool_file "$output_objdir/$outputname"
9433 postlink_cmds=`func_echo_all "$postlink_cmds" | $SED -e 's%@OUTPUT@%'"$output_objdir/$outputname"'%g' -e 's%@TOOL_OUTPUT@%'"$func_to_tool_file_result"'%g'`
9434 func_execute_cmds "$postlink_cmds" 'exit $?'
9437 # Now create the wrapper script.
9438 func_verbose "creating $output"
9440 # Quote the relink command for shipping.
9441 if test -n "$relink_command"; then
9442 # Preserve any variables that may affect compiler behavior
9443 for var in $variables_saved_for_relink; do
9444 if eval test -z \"\${$var+set}\"; then
9445 relink_command="{ test -z \"\${$var+set}\" || $lt_unset $var || { $var=; export $var; }; }; $relink_command"
9446 elif eval var_value=\$$var; test -z "$var_value"; then
9447 relink_command="$var=; export $var; $relink_command"
9449 func_quote_for_eval "$var_value"
9450 relink_command="$var=$func_quote_for_eval_result; export $var; $relink_command"
9453 relink_command="(cd `pwd`; $relink_command)"
9454 relink_command=`$ECHO "$relink_command" | $SED "$sed_quote_subst"`
9457 # Only actually do things if not in dry run mode.
9459 # win32 will think the script is a binary if it has
9460 # a .exe suffix, so we strip it off here.
9462 *.exe) func_stripname '' '.exe' "$output"
9463 output=$func_stripname_result ;;
9465 # test for cygwin because mv fails w/o .exe extensions
9469 func_stripname '' '.exe' "$outputname"
9470 outputname=$func_stripname_result ;;
9474 *cygwin* | *mingw* )
9475 func_dirname_and_basename "$output" "" "."
9476 output_name=$func_basename_result
9477 output_path=$func_dirname_result
9478 cwrappersource="$output_path/$objdir/lt-$output_name.c"
9479 cwrapper="$output_path/$output_name.exe"
9480 $RM $cwrappersource $cwrapper
9481 trap "$RM $cwrappersource $cwrapper; exit $EXIT_FAILURE" 1 2 15
9483 func_emit_cwrapperexe_src > $cwrappersource
9485 # The wrapper executable is built using the $host compiler,
9486 # because it contains $host paths and files. If cross-
9487 # compiling, it, like the target executable, must be
9488 # executed on the $host or under an emulation environment.
9490 $LTCC $LTCFLAGS -o $cwrapper $cwrappersource
9494 # Now, create the wrapper script for func_source use:
9495 func_ltwrapper_scriptname $cwrapper
9496 $RM $func_ltwrapper_scriptname_result
9497 trap "$RM $func_ltwrapper_scriptname_result; exit $EXIT_FAILURE" 1 2 15
9499 # note: this script will not be executed, so do not chmod.
9500 if test "x$build" = "x$host" ; then
9501 $cwrapper --lt-dump-script > $func_ltwrapper_scriptname_result
9503 func_emit_wrapper no > $func_ltwrapper_scriptname_result
9509 trap "$RM $output; exit $EXIT_FAILURE" 1 2 15
9511 func_emit_wrapper no > $output
9520 # See if we need to build an old-fashioned archive.
9521 for oldlib in $oldlibs; do
9523 if test "$build_libtool_libs" = convenience; then
9524 oldobjs="$libobjs_save $symfileobj"
9525 addlibs="$convenience"
9526 build_libtool_libs=no
9528 if test "$build_libtool_libs" = module; then
9529 oldobjs="$libobjs_save"
9530 build_libtool_libs=no
9532 oldobjs="$old_deplibs $non_pic_objects"
9533 if test "$preload" = yes && test -f "$symfileobj"; then
9534 oldobjs+=" $symfileobj"
9537 addlibs="$old_convenience"
9540 if test -n "$addlibs"; then
9541 gentop="$output_objdir/${outputname}x"
9542 generated+=" $gentop"
9544 func_extract_archives $gentop $addlibs
9545 oldobjs+=" $func_extract_archives_result"
9548 # Do each command in the archive commands.
9549 if test -n "$old_archive_from_new_cmds" && test "$build_libtool_libs" = yes; then
9550 cmds=$old_archive_from_new_cmds
9553 # Add any objects from preloaded convenience libraries
9554 if test -n "$dlprefiles"; then
9555 gentop="$output_objdir/${outputname}x"
9556 generated+=" $gentop"
9558 func_extract_archives $gentop $dlprefiles
9559 oldobjs+=" $func_extract_archives_result"
9562 # POSIX demands no paths to be encoded in archives. We have
9563 # to avoid creating archives with duplicate basenames if we
9564 # might have to extract them afterwards, e.g., when creating a
9565 # static archive out of a convenience library, or when linking
9566 # the entirety of a libtool archive into another (currently
9567 # not supported by libtool).
9568 if (for obj in $oldobjs
9570 func_basename "$obj"
9571 $ECHO "$func_basename_result"
9572 done | sort | sort -uc >/dev/null 2>&1); then
9575 echo "copying selected object files to avoid basename conflicts..."
9576 gentop="$output_objdir/${outputname}x"
9577 generated+=" $gentop"
9578 func_mkdir_p "$gentop"
9579 save_oldobjs=$oldobjs
9582 for obj in $save_oldobjs
9584 func_basename "$obj"
9585 objbase="$func_basename_result"
9586 case " $oldobjs " in
9587 " ") oldobjs=$obj ;;
9590 # Make sure we don't pick an alternate name that also
9592 newobj=lt$counter-$objbase
9593 func_arith $counter + 1
9594 counter=$func_arith_result
9595 case " $oldobjs " in
9596 *[\ /]"$newobj "*) ;;
9597 *) if test ! -f "$gentop/$newobj"; then break; fi ;;
9600 func_show_eval "ln $obj $gentop/$newobj || cp $obj $gentop/$newobj"
9601 oldobjs+=" $gentop/$newobj"
9603 *) oldobjs+=" $obj" ;;
9607 func_to_tool_file "$oldlib" func_convert_file_msys_to_w32
9608 tool_oldlib=$func_to_tool_file_result
9609 eval cmds=\"$old_archive_cmds\"
9612 len=$func_len_result
9613 if test "$len" -lt "$max_cmd_len" || test "$max_cmd_len" -le -1; then
9614 cmds=$old_archive_cmds
9615 elif test -n "$archiver_list_spec"; then
9616 func_verbose "using command file archive linking..."
9619 func_to_tool_file "$obj"
9620 $ECHO "$func_to_tool_file_result"
9621 done > $output_objdir/$libname.libcmd
9622 func_to_tool_file "$output_objdir/$libname.libcmd"
9623 oldobjs=" $archiver_list_spec$func_to_tool_file_result"
9624 cmds=$old_archive_cmds
9626 # the command line is too long to link in one step, link in parts
9627 func_verbose "using piecewise archive linking..."
9632 save_oldobjs=$oldobjs
9634 # Is there a better way of finding the last object in the list?
9635 for obj in $save_oldobjs
9639 eval test_cmds=\"$old_archive_cmds\"
9640 func_len " $test_cmds"
9641 len0=$func_len_result
9643 for obj in $save_oldobjs
9646 func_arith $len + $func_len_result
9647 len=$func_arith_result
9649 if test "$len" -lt "$max_cmd_len"; then
9652 # the above command should be used before it gets too long
9654 if test "$obj" = "$last_oldobj" ; then
9657 test -z "$concat_cmds" || concat_cmds=$concat_cmds~
9658 eval concat_cmds=\"\${concat_cmds}$old_archive_cmds\"
9665 if test "X$oldobjs" = "X" ; then
9666 eval cmds=\"\$concat_cmds\"
9668 eval cmds=\"\$concat_cmds~\$old_archive_cmds\"
9672 func_execute_cmds "$cmds" 'exit $?'
9675 test -n "$generated" && \
9676 func_show_eval "${RM}r$generated"
9678 # Now create the libtool archive.
9682 test "$build_old_libs" = yes && old_library="$libname.$libext"
9683 func_verbose "creating $output"
9685 # Preserve any variables that may affect compiler behavior
9686 for var in $variables_saved_for_relink; do
9687 if eval test -z \"\${$var+set}\"; then
9688 relink_command="{ test -z \"\${$var+set}\" || $lt_unset $var || { $var=; export $var; }; }; $relink_command"
9689 elif eval var_value=\$$var; test -z "$var_value"; then
9690 relink_command="$var=; export $var; $relink_command"
9692 func_quote_for_eval "$var_value"
9693 relink_command="$var=$func_quote_for_eval_result; export $var; $relink_command"
9696 # Quote the link command for shipping.
9697 relink_command="(cd `pwd`; $SHELL $progpath $preserve_args --mode=relink $libtool_args @inst_prefix_dir@)"
9698 relink_command=`$ECHO "$relink_command" | $SED "$sed_quote_subst"`
9699 if test "$hardcode_automatic" = yes ; then
9703 # Only create the output if not a dry run.
9705 for installed in no yes; do
9706 if test "$installed" = yes; then
9707 if test -z "$install_libdir"; then
9710 output="$output_objdir/$outputname"i
9711 # Replace all uninstalled libtool libraries with the installed ones
9713 for deplib in $dependency_libs; do
9716 func_basename "$deplib"
9717 name="$func_basename_result"
9718 func_resolve_sysroot "$deplib"
9719 eval libdir=`${SED} -n -e 's/^libdir=\(.*\)$/\1/p' $func_resolve_sysroot_result`
9720 test -z "$libdir" && \
9721 func_fatal_error "\`$deplib' is not a valid libtool archive"
9722 newdependency_libs+=" ${lt_sysroot:+=}$libdir/$name"
9725 func_stripname -L '' "$deplib"
9726 func_replace_sysroot "$func_stripname_result"
9727 newdependency_libs+=" -L$func_replace_sysroot_result"
9730 func_stripname -R '' "$deplib"
9731 func_replace_sysroot "$func_stripname_result"
9732 newdependency_libs+=" -R$func_replace_sysroot_result"
9734 *) newdependency_libs+=" $deplib" ;;
9737 dependency_libs="$newdependency_libs"
9740 for lib in $dlfiles; do
9743 func_basename "$lib"
9744 name="$func_basename_result"
9745 eval libdir=`${SED} -n -e 's/^libdir=\(.*\)$/\1/p' $lib`
9746 test -z "$libdir" && \
9747 func_fatal_error "\`$lib' is not a valid libtool archive"
9748 newdlfiles+=" ${lt_sysroot:+=}$libdir/$name"
9750 *) newdlfiles+=" $lib" ;;
9753 dlfiles="$newdlfiles"
9755 for lib in $dlprefiles; do
9758 # Only pass preopened files to the pseudo-archive (for
9759 # eventual linking with the app. that links it) if we
9760 # didn't already link the preopened objects directly into
9762 func_basename "$lib"
9763 name="$func_basename_result"
9764 eval libdir=`${SED} -n -e 's/^libdir=\(.*\)$/\1/p' $lib`
9765 test -z "$libdir" && \
9766 func_fatal_error "\`$lib' is not a valid libtool archive"
9767 newdlprefiles+=" ${lt_sysroot:+=}$libdir/$name"
9771 dlprefiles="$newdlprefiles"
9774 for lib in $dlfiles; do
9776 [\\/]* | [A-Za-z]:[\\/]*) abs="$lib" ;;
9777 *) abs=`pwd`"/$lib" ;;
9781 dlfiles="$newdlfiles"
9783 for lib in $dlprefiles; do
9785 [\\/]* | [A-Za-z]:[\\/]*) abs="$lib" ;;
9786 *) abs=`pwd`"/$lib" ;;
9788 newdlprefiles+=" $abs"
9790 dlprefiles="$newdlprefiles"
9793 # place dlname in correct position for cygwin
9794 # In fact, it would be nice if we could use this code for all target
9795 # systems that can't hard-code library paths into their executables
9796 # and that have no shared library path variable independent of PATH,
9797 # but it turns out we can't easily determine that from inspecting
9798 # libtool variables, so we have to hard-code the OSs to which it
9799 # applies here; at the moment, that means platforms that use the PE
9800 # object format with DLL files. See the long comment at the top of
9801 # tests/bindir.at for full details.
9803 case $host,$output,$installed,$module,$dlname in
9804 *cygwin*,*lai,yes,no,*.dll | *mingw*,*lai,yes,no,*.dll | *cegcc*,*lai,yes,no,*.dll)
9805 # If a -bindir argument was supplied, place the dll there.
9806 if test "x$bindir" != x ;
9808 func_relative_path "$install_libdir" "$bindir"
9809 tdlname=$func_relative_path_result$dlname
9811 # Otherwise fall back on heuristic.
9812 tdlname=../bin/$dlname
9817 # $outputname - a libtool library file
9818 # Generated by $PROGRAM (GNU $PACKAGE$TIMESTAMP) $VERSION
9820 # Please DO NOT delete this file!
9821 # It is necessary for linking the library.
9823 # The name that we can dlopen(3).
9826 # Names of this library.
9827 library_names='$library_names'
9829 # The name of the static archive.
9830 old_library='$old_library'
9832 # Linker flags that can not go in dependency_libs.
9833 inherited_linker_flags='$new_inherited_linker_flags'
9835 # Libraries that this one depends upon.
9836 dependency_libs='$dependency_libs'
9838 # Names of additional weak libraries provided by this library
9839 weak_library_names='$weak_libs'
9841 # Version information for $libname.
9846 # Is this an already installed library?
9847 installed=$installed
9849 # Should we warn about portability when linking against -modules?
9850 shouldnotlink=$module
9852 # Files to dlopen/dlpreopen
9854 dlpreopen='$dlprefiles'
9856 # Directory that this library needs to be installed in:
9857 libdir='$install_libdir'"
9858 if test "$installed" = no && test "$need_relink" = yes; then
9860 relink_command=\"$relink_command\""
9865 # Do a symbolic link so that the libtool archive can be found in
9866 # LD_LIBRARY_PATH before the program is installed.
9867 func_show_eval '( cd "$output_objdir" && $RM "$outputname" && $LN_S "../$outputname" "$outputname" )' 'exit $?'
9873 { test "$opt_mode" = link || test "$opt_mode" = relink; } &&
9874 func_mode_link ${1+"$@"}
9877 # func_mode_uninstall arg...
9878 func_mode_uninstall ()
9886 # This variable tells wrapper scripts just to set variables rather
9887 # than running their programs.
9888 libtool_install_magic="$magic"
9893 -f) RM+=" $arg"; rmforce=yes ;;
9895 *) files+=" $arg" ;;
9900 func_fatal_help "you must specify an RM program"
9904 for file in $files; do
9905 func_dirname "$file" "" "."
9906 dir="$func_dirname_result"
9907 if test "X$dir" = X.; then
9912 func_basename "$file"
9913 name="$func_basename_result"
9914 test "$opt_mode" = uninstall && odir="$dir"
9916 # Remember odir for removal later, being careful to avoid duplicates
9917 if test "$opt_mode" = clean; then
9920 *) rmdirs+=" $odir" ;;
9924 # Don't error if the file doesn't exist and rm -f was used.
9925 if { test -L "$file"; } >/dev/null 2>&1 ||
9926 { test -h "$file"; } >/dev/null 2>&1 ||
9927 test -f "$file"; then
9929 elif test -d "$file"; then
9932 elif test "$rmforce" = yes; then
9940 # Possibly a libtool archive, so verify it.
9941 if func_lalib_p "$file"; then
9942 func_source $dir/$name
9944 # Delete the libtool libraries and symlinks.
9945 for n in $library_names; do
9946 rmfiles+=" $odir/$n"
9948 test -n "$old_library" && rmfiles+=" $odir/$old_library"
9952 case " $library_names " in
9954 *) test -n "$dlname" && rmfiles+=" $odir/$dlname" ;;
9956 test -n "$libdir" && rmfiles+=" $odir/$name $odir/${name}i"
9959 if test -n "$library_names"; then
9960 # Do each command in the postuninstall commands.
9961 func_execute_cmds "$postuninstall_cmds" 'test "$rmforce" = yes || exit_status=1'
9964 if test -n "$old_library"; then
9965 # Do each command in the old_postuninstall commands.
9966 func_execute_cmds "$old_postuninstall_cmds" 'test "$rmforce" = yes || exit_status=1'
9968 # FIXME: should reinstall the best remaining shared library.
9975 # Possibly a libtool object, so verify it.
9976 if func_lalib_p "$file"; then
9979 func_source $dir/$name
9981 # Add PIC object to the list of files to remove.
9982 if test -n "$pic_object" &&
9983 test "$pic_object" != none; then
9984 rmfiles+=" $dir/$pic_object"
9987 # Add non-PIC object to the list of files to remove.
9988 if test -n "$non_pic_object" &&
9989 test "$non_pic_object" != none; then
9990 rmfiles+=" $dir/$non_pic_object"
9996 if test "$opt_mode" = clean ; then
10000 func_stripname '' '.exe' "$file"
10001 file=$func_stripname_result
10002 func_stripname '' '.exe' "$name"
10003 noexename=$func_stripname_result
10004 # $file with .exe has already been added to rmfiles,
10005 # add $file without .exe
10009 # Do a test to see if this is a libtool program.
10010 if func_ltwrapper_p "$file"; then
10011 if func_ltwrapper_executable_p "$file"; then
10012 func_ltwrapper_scriptname "$file"
10014 func_source $func_ltwrapper_scriptname_result
10015 rmfiles+=" $func_ltwrapper_scriptname_result"
10018 func_source $dir/$noexename
10021 # note $name still contains .exe if it was in $file originally
10022 # as does the version of $file that was added into $rmfiles
10023 rmfiles+=" $odir/$name $odir/${name}S.${objext}"
10024 if test "$fast_install" = yes && test -n "$relink_command"; then
10025 rmfiles+=" $odir/lt-$name"
10027 if test "X$noexename" != "X$name" ; then
10028 rmfiles+=" $odir/lt-${noexename}.c"
10034 func_show_eval "$RM $rmfiles" 'exit_status=1'
10037 # Try to remove the ${objdir}s in the directories where we deleted files
10038 for dir in $rmdirs; do
10039 if test -d "$dir"; then
10040 func_show_eval "rmdir $dir >/dev/null 2>&1"
10047 { test "$opt_mode" = uninstall || test "$opt_mode" = clean; } &&
10048 func_mode_uninstall ${1+"$@"}
10050 test -z "$opt_mode" && {
10051 help="$generic_help"
10052 func_fatal_help "you must specify a MODE"
10055 test -z "$exec_cmd" && \
10056 func_fatal_help "invalid operation mode \`$opt_mode'"
10058 if test -n "$exec_cmd"; then
10059 eval exec "$exec_cmd"
10066 # The TAGs below are defined such that we never get into a situation
10067 # in which we disable both kinds of libraries. Given conflicting
10068 # choices, we go for a static library, that is the most portable,
10069 # since we can't tell whether shared libraries were disabled because
10070 # the user asked for that or because the platform doesn't support
10071 # them. This is particularly important on AIX, because we don't
10072 # support having both static and shared libraries enabled at the same
10073 # time on that platform, so we default to a shared-only configuration.
10074 # If a disable-shared tag is given, we'll fallback to a static-only
10075 # configuration. But we'll never go from static-only to shared-only.
10077 # ### BEGIN LIBTOOL TAG CONFIG: disable-shared
10078 build_libtool_libs=no
10080 # ### END LIBTOOL TAG CONFIG: disable-shared
10082 # ### BEGIN LIBTOOL TAG CONFIG: disable-static
10083 build_old_libs=`case $build_libtool_libs in yes) echo no;; *) echo yes;; esac`
10084 # ### END LIBTOOL TAG CONFIG: disable-static
10087 # mode:shell-script
10093 # ### BEGIN LIBTOOL TAG CONFIG: CXX
10095 # The linker used to build libraries.
10096 LD="/usr/bin/ld -m elf_x86_64"
10098 # How to create reloadable object files.
10100 reload_cmds="\$LD\$reload_flag -o \$output\$reload_objs"
10102 # Commands used to build an old-style archive.
10103 old_archive_cmds="\$AR \$AR_FLAGS \$oldlib\$oldobjs~\$RANLIB \$tool_oldlib"
10105 # A language specific compiler.
10108 # Is the compiler the GNU compiler?
10111 # Compiler flag to turn off builtin functions.
10112 no_builtin_flag=" -fno-builtin"
10114 # Additional compiler flags for building library objects.
10115 pic_flag=" -fPIC -DPIC"
10117 # How to pass a linker flag through the compiler.
10120 # Compiler flag to prevent dynamic linking.
10121 link_static_flag=""
10123 # Does compiler simultaneously support -c and -o options?
10126 # Whether or not to add -lc for building shared libraries.
10127 build_libtool_need_lc=no
10129 # Whether or not to disallow shared libs when runtime libs are static.
10130 allow_libtool_libs_with_static_runtimes=no
10132 # Compiler flag to allow reflexive dlopens.
10133 export_dynamic_flag_spec="\${wl}--export-dynamic"
10135 # Compiler flag to generate shared objects directly from archives.
10136 whole_archive_flag_spec="\${wl}--whole-archive\$convenience \${wl}--no-whole-archive"
10138 # Whether the compiler copes with passing no objects directly.
10139 compiler_needs_object="no"
10141 # Create an old-style archive from a shared archive.
10142 old_archive_from_new_cmds=""
10144 # Create a temporary old-style archive to link instead of a shared archive.
10145 old_archive_from_expsyms_cmds=""
10147 # Commands used to build a shared archive.
10148 archive_cmds="\$CC \$pic_flag -shared -nostdlib \$predep_objects \$libobjs \$deplibs \$postdep_objects \$compiler_flags \${wl}-soname \$wl\$soname -o \$lib"
10149 archive_expsym_cmds="\$CC \$pic_flag -shared -nostdlib \$predep_objects \$libobjs \$deplibs \$postdep_objects \$compiler_flags \${wl}-soname \$wl\$soname \${wl}-retain-symbols-file \$wl\$export_symbols -o \$lib"
10151 # Commands used to build a loadable module if different from building
10152 # a shared archive.
10154 module_expsym_cmds=""
10156 # Whether we are building with GNU ld or not.
10159 # Flag that allows shared libraries with undefined symbols to be built.
10160 allow_undefined_flag=""
10162 # Flag that enforces no undefined symbols.
10163 no_undefined_flag=""
10165 # Flag to hardcode $libdir into a binary during linking.
10166 # This must work even if $libdir does not exist
10167 hardcode_libdir_flag_spec="\${wl}-rpath \${wl}\$libdir"
10169 # Whether we need a single "-rpath" flag with a separated argument.
10170 hardcode_libdir_separator=""
10172 # Set to "yes" if using DIR/libNAME${shared_ext} during linking hardcodes
10173 # DIR into the resulting binary.
10176 # Set to "yes" if using DIR/libNAME${shared_ext} during linking hardcodes
10177 # DIR into the resulting binary and the resulting library dependency is
10178 # "absolute",i.e impossible to change by setting ${shlibpath_var} if the
10179 # library is relocated.
10180 hardcode_direct_absolute=no
10182 # Set to "yes" if using the -LDIR flag during linking hardcodes DIR
10183 # into the resulting binary.
10184 hardcode_minus_L=no
10186 # Set to "yes" if using SHLIBPATH_VAR=DIR during linking hardcodes DIR
10187 # into the resulting binary.
10188 hardcode_shlibpath_var=unsupported
10190 # Set to "yes" if building a shared library automatically hardcodes DIR
10191 # into the library and all subsequent libraries and executables linked
10193 hardcode_automatic=no
10195 # Set to yes if linker adds runtime paths of dependent libraries
10196 # to runtime path list.
10199 # Whether libtool must link a program against all its dependency libraries.
10200 link_all_deplibs=unknown
10202 # Set to "yes" if exported symbols are required.
10203 always_export_symbols=no
10205 # The commands to list exported symbols.
10206 export_symbols_cmds="\$NM \$libobjs \$convenience | \$global_symbol_pipe | \$SED 's/.* //' | sort | uniq > \$export_symbols"
10208 # Symbols that should not be listed in the preloaded symbols.
10209 exclude_expsyms="_GLOBAL_OFFSET_TABLE_|_GLOBAL__F[ID]_.*"
10211 # Symbols that must always be exported.
10214 # Commands necessary for linking programs (against libraries) with templates.
10217 # Commands necessary for finishing linking programs.
10220 # Specify filename containing input files.
10223 # How to hardcode a shared library path into an executable.
10224 hardcode_action=immediate
10226 # The directories searched by this compiler when creating a shared library.
10227 compiler_lib_search_dirs="/usr/lib/gcc/x86_64-redhat-linux/4.7.2 /usr/lib/gcc/x86_64-redhat-linux/4.7.2/../../../../lib64 /lib/../lib64 /usr/lib/../lib64 /usr/lib/gcc/x86_64-redhat-linux/4.7.2/../../.."
10229 # Dependencies to place before and after the objects being linked to
10230 # create a shared library.
10231 predep_objects="/usr/lib/gcc/x86_64-redhat-linux/4.7.2/../../../../lib64/crti.o /usr/lib/gcc/x86_64-redhat-linux/4.7.2/crtbeginS.o"
10232 postdep_objects="/usr/lib/gcc/x86_64-redhat-linux/4.7.2/crtendS.o /usr/lib/gcc/x86_64-redhat-linux/4.7.2/../../../../lib64/crtn.o"
10234 postdeps="-lstdc++ -lm -lgcc_s -lc -lgcc_s"
10236 # The library search path used internally by the compiler when linking
10237 # a shared library.
10238 compiler_lib_search_path="-L/usr/lib/gcc/x86_64-redhat-linux/4.7.2 -L/usr/lib/gcc/x86_64-redhat-linux/4.7.2/../../../../lib64 -L/lib/../lib64 -L/usr/lib/../lib64 -L/usr/lib/gcc/x86_64-redhat-linux/4.7.2/../../.."
10240 # ### END LIBTOOL TAG CONFIG: CXX