3 # libtool - Provide generalized library-building support services.
4 # Generated automatically by config.status (gc) 7.2
5 # Libtool was configured on host arrow:
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 Free Software Foundation,
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 # Whether or not to build shared libraries.
43 build_libtool_libs=yes
45 # Which release of libtool.m4 was used?
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.
66 host=i686-pc-linux-gnu
71 build=i686-pc-linux-gnu
74 # A sed program that does not truncate output.
77 # Sed that helps us avoid accidentally triggering echo(1) options like -n.
78 Xsed="$SED -e 1s/^X//"
80 # A grep program that handles long lines.
86 # A literal string matcher.
89 # A BSD- or MS-compatible name lister.
92 # Whether we need soft or hard links.
95 # What is the maximum length of a command?
98 # Object file suffix (normally "o").
101 # Executable file suffix (normally "").
104 # whether the shell understands "unset".
107 # turn spaces into newlines.
108 SP2NL="tr \\040 \\012"
110 # turn newlines into spaces.
111 NL2SP="tr \\015\\012 \\040\\040"
113 # convert $build file names to $host format.
114 to_host_file_cmd=func_convert_file_noop
116 # convert $build files to toolchain format.
117 to_tool_file_cmd=func_convert_file_noop
119 # An object symbol dumper.
122 # Method to check whether dependent libraries are shared objects.
123 deplibs_check_method="pass_all"
125 # Command to use when deplibs_check_method = "file_magic".
126 file_magic_cmd="\$MAGIC_CMD"
128 # How to find potential files when deplibs_check_method = "file_magic".
131 # Find potential files using nocaseglob when deplibs_check_method = "file_magic".
134 # DLL creation program.
137 # Command to associate shared and link libraries.
138 sharedlib_from_linklib_cmd="printf %s\\n"
143 # Flags to create an archive.
146 # How to feed a file listing to the archiver.
147 archiver_list_spec="@"
149 # A symbol stripping program.
152 # Commands used to install an old-style archive.
154 old_postinstall_cmds="chmod 644 \$oldlib~\$RANLIB \$oldlib"
155 old_postuninstall_cmds=""
157 # Whether to use a lock for old archive extraction.
158 lock_old_archive_extraction=no
163 # LTCC compiler flags.
164 LTCFLAGS="-g -O2 -fno-strict-aliasing"
166 # Take the output of nm and produce a listing of raw symbols and C names.
167 global_symbol_pipe="sed -n -e 's/^.*[ ]\\([ABCDGIRSTW][ABCDGIRSTW]*\\)[ ][ ]*\\([_A-Za-z][_A-Za-z0-9]*\\)\$/\\1 \\2 \\2/p' | sed '/ __gnu_lto/d'"
169 # Transform the output of nm in a proper C declaration.
170 global_symbol_to_cdecl="sed -n -e 's/^T .* \\(.*\\)\$/extern int \\1();/p' -e 's/^[ABCDGIRSTW]* .* \\(.*\\)\$/extern char \\1;/p'"
172 # Transform the output of nm in a C name address pair.
173 global_symbol_to_c_name_address="sed -n -e 's/^: \\([^ ]*\\)[ ]*\$/ {\\\"\\1\\\", (void *) 0},/p' -e 's/^[ABCDGIRSTW]* \\([^ ]*\\) \\([^ ]*\\)\$/ {\"\\2\", (void *) \\&\\2},/p'"
175 # Transform the output of nm in a C name address pair when lib prefix is needed.
176 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'"
178 # Specify filename containing input files for $NM.
179 nm_file_list_spec="@"
181 # The root where to search for dependent libraries,and in which our libraries should be installed.
184 # The name of the directory that contains temporary libtool files.
187 # Used to examine libraries when file_magic_cmd begins with "file".
190 # Must we lock files when doing compilation?
196 # Tool to manipulate archived DWARF debug symbol files on Mac OS X.
199 # Tool to change global to local symbols on Mac OS X.
202 # Tool to manipulate fat objects and archives on Mac OS X.
205 # ldd/readelf like tool for Mach-O binaries on Mac OS X.
208 # ldd/readelf like tool for 64 bit Mach-O binaries on Mac OS X 10.4.
211 # Old archive suffix (normally "a").
214 # Shared library suffix (normally ".so").
217 # The commands to extract the exported symbol list from a shared archive.
218 extract_expsyms_cmds=""
220 # Variables whose values should be saved in libtool wrapper scripts and
221 # restored at link time.
222 variables_saved_for_relink="PATH LD_LIBRARY_PATH LD_RUN_PATH GCC_EXEC_PREFIX COMPILER_PATH LIBRARY_PATH"
224 # Do we need the "lib" prefix for modules?
227 # Do we need a version for libraries?
230 # Library versioning type.
233 # Shared library runtime path variable.
234 runpath_var=LD_RUN_PATH
236 # Shared library path variable.
237 shlibpath_var=LD_LIBRARY_PATH
239 # Is shlibpath searched before the hard-coded library search path?
240 shlibpath_overrides_runpath=no
242 # Format of library name prefix.
243 libname_spec="lib\$name"
245 # List of archive names. First name is the real one, the rest are links.
246 # The last name is the one that the linker finds with -lNAME
247 library_names_spec="\${libname}\${release}\${shared_ext}\$versuffix \${libname}\${release}\${shared_ext}\$major \$libname\${shared_ext}"
249 # The coded name of the library, if different from the real name.
250 soname_spec="\${libname}\${release}\${shared_ext}\$major"
252 # Permission mode override for installation of shared libraries.
253 install_override_mode=""
255 # Command to use after installation of a shared archive.
258 # Command to use after uninstallation of a shared archive.
259 postuninstall_cmds=""
261 # Commands used to finish a libtool library installation in a directory.
262 finish_cmds="PATH=\\\"\\\$PATH:/sbin\\\" ldconfig -n \$libdir"
264 # As "finish_cmds", except a single script fragment to be evaled but
268 # Whether we should hardcode library paths into libraries.
269 hardcode_into_libs=yes
271 # Compile-time system search path for libraries.
272 sys_lib_search_path_spec="/usr/lib/gcc/i686-linux-gnu/4.6.1 /usr/lib/i386-linux-gnu /usr/lib /lib/i386-linux-gnu /lib "
274 # Run-time system search path for libraries.
275 sys_lib_dlsearch_path_spec="/lib /usr/lib /lib64 /usr/lib64 /usr/lib/i386-linux-gnu/mesa /lib/i386-linux-gnu /usr/lib/i386-linux-gnu /lib/i686-linux-gnu /usr/lib/i686-linux-gnu /usr/local/lib "
277 # Whether dlopen is supported.
278 dlopen_support=unknown
280 # Whether dlopen of programs is supported.
283 # Whether dlopen of statically linked programs is supported.
284 dlopen_self_static=unknown
286 # Commands to strip libraries.
287 old_striplib="strip --strip-debug"
288 striplib="strip --strip-unneeded"
291 # The linker used to build libraries.
294 # How to create reloadable object files.
296 reload_cmds="\$LD\$reload_flag -o \$output\$reload_objs"
298 # Commands used to build an old-style archive.
299 old_archive_cmds="\$AR \$AR_FLAGS \$oldlib\$oldobjs~\$RANLIB \$oldlib"
301 # A language specific compiler.
304 # Is the compiler the GNU compiler?
307 # Compiler flag to turn off builtin functions.
308 no_builtin_flag=" -fno-builtin"
310 # Additional compiler flags for building library objects.
311 pic_flag=" -fPIC -DPIC"
313 # How to pass a linker flag through the compiler.
316 # Compiler flag to prevent dynamic linking.
317 link_static_flag="-static"
319 # Does compiler simultaneously support -c and -o options?
322 # Whether or not to add -lc for building shared libraries.
323 build_libtool_need_lc=no
325 # Whether or not to disallow shared libs when runtime libs are static.
326 allow_libtool_libs_with_static_runtimes=no
328 # Compiler flag to allow reflexive dlopens.
329 export_dynamic_flag_spec="\${wl}--export-dynamic"
331 # Compiler flag to generate shared objects directly from archives.
332 whole_archive_flag_spec="\${wl}--whole-archive\$convenience \${wl}--no-whole-archive"
334 # Whether the compiler copes with passing no objects directly.
335 compiler_needs_object="no"
337 # Create an old-style archive from a shared archive.
338 old_archive_from_new_cmds=""
340 # Create a temporary old-style archive to link instead of a shared archive.
341 old_archive_from_expsyms_cmds=""
343 # Commands used to build a shared archive.
344 archive_cmds="\$CC -shared \$pic_flag \$libobjs \$deplibs \$compiler_flags \${wl}-soname \$wl\$soname -o \$lib"
345 archive_expsym_cmds="echo \\\"{ global:\\\" > \$output_objdir/\$libname.ver~
346 cat \$export_symbols | sed -e \\\"s/\\\\(.*\\\\)/\\\\1;/\\\" >> \$output_objdir/\$libname.ver~
347 echo \\\"local: *; };\\\" >> \$output_objdir/\$libname.ver~
348 \$CC -shared \$pic_flag \$libobjs \$deplibs \$compiler_flags \${wl}-soname \$wl\$soname \${wl}-version-script \${wl}\$output_objdir/\$libname.ver -o \$lib"
350 # Commands used to build a loadable module if different from building
353 module_expsym_cmds=""
355 # Whether we are building with GNU ld or not.
358 # Flag that allows shared libraries with undefined symbols to be built.
359 allow_undefined_flag=""
361 # Flag that enforces no undefined symbols.
364 # Flag to hardcode $libdir into a binary during linking.
365 # This must work even if $libdir does not exist
366 hardcode_libdir_flag_spec="\${wl}-rpath \${wl}\$libdir"
368 # If ld is used when linking, flag to hardcode $libdir into a binary
369 # during linking. This must work even if $libdir does not exist.
370 hardcode_libdir_flag_spec_ld=""
372 # Whether we need a single "-rpath" flag with a separated argument.
373 hardcode_libdir_separator=""
375 # Set to "yes" if using DIR/libNAME${shared_ext} during linking hardcodes
376 # DIR into the resulting binary.
379 # Set to "yes" if using DIR/libNAME${shared_ext} during linking hardcodes
380 # DIR into the resulting binary and the resulting library dependency is
381 # "absolute",i.e impossible to change by setting ${shlibpath_var} if the
382 # library is relocated.
383 hardcode_direct_absolute=no
385 # Set to "yes" if using the -LDIR flag during linking hardcodes DIR
386 # into the resulting binary.
389 # Set to "yes" if using SHLIBPATH_VAR=DIR during linking hardcodes DIR
390 # into the resulting binary.
391 hardcode_shlibpath_var=unsupported
393 # Set to "yes" if building a shared library automatically hardcodes DIR
394 # into the library and all subsequent libraries and executables linked
396 hardcode_automatic=no
398 # Set to yes if linker adds runtime paths of dependent libraries
399 # to runtime path list.
402 # Whether libtool must link a program against all its dependency libraries.
403 link_all_deplibs=unknown
405 # Set to "yes" if exported symbols are required.
406 always_export_symbols=no
408 # The commands to list exported symbols.
409 export_symbols_cmds="\$NM \$libobjs \$convenience | \$global_symbol_pipe | \$SED 's/.* //' | sort | uniq > \$export_symbols"
411 # Symbols that should not be listed in the preloaded symbols.
412 exclude_expsyms="_GLOBAL_OFFSET_TABLE_|_GLOBAL__F[ID]_.*"
414 # Symbols that must always be exported.
417 # Commands necessary for linking programs (against libraries) with templates.
420 # Commands necessary for finishing linking programs.
423 # Specify filename containing input files.
426 # How to hardcode a shared library path into an executable.
427 hardcode_action=immediate
429 # The directories searched by this compiler when creating a shared library.
430 compiler_lib_search_dirs=""
432 # Dependencies to place before and after the objects being linked to
433 # create a shared library.
439 # The library search path used internally by the compiler when linking
441 compiler_lib_search_path=""
443 # ### END LIBTOOL CONFIG
446 # libtool (GNU libtool) 2.4
447 # Written by Gordon Matzigkeit <gord@gnu.ai.mit.edu>, 1996
449 # Copyright (C) 1996, 1997, 1998, 1999, 2000, 2001, 2003, 2004, 2005, 2006,
450 # 2007, 2008, 2009, 2010 Free Software Foundation, Inc.
451 # This is free software; see the source for copying conditions. There is NO
452 # warranty; not even for MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
454 # GNU Libtool is free software; you can redistribute it and/or modify
455 # it under the terms of the GNU General Public License as published by
456 # the Free Software Foundation; either version 2 of the License, or
457 # (at your option) any later version.
459 # As a special exception to the GNU General Public License,
460 # if you distribute this file as part of a program or library that
461 # is built using GNU Libtool, you may include this file under the
462 # same distribution terms that you use for the rest of that program.
464 # GNU Libtool is distributed in the hope that it will be useful, but
465 # WITHOUT ANY WARRANTY; without even the implied warranty of
466 # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
467 # General Public License for more details.
469 # You should have received a copy of the GNU General Public License
470 # along with GNU Libtool; see the file COPYING. If not, a copy
471 # can be downloaded from http://www.gnu.org/licenses/gpl.html,
472 # or obtained by writing to the Free Software Foundation, Inc.,
473 # 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
475 # Usage: $progname [OPTION]... [MODE-ARG]...
477 # Provide generalized library-building support services.
479 # --config show all configuration variables
480 # --debug enable verbose shell tracing
481 # -n, --dry-run display commands without modifying any files
482 # --features display basic configuration information and exit
483 # --mode=MODE use operation mode MODE
484 # --preserve-dup-deps don't remove duplicate dependency libraries
485 # --quiet, --silent don't print informational messages
486 # --no-quiet, --no-silent
487 # print informational messages (default)
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
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.3293
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'}
592 : ${SHELL="${CONFIG_SHELL-/bin/sh}"}
593 : ${Xsed="$SED -e 1s/^X//"}
598 EXIT_MISMATCH=63 # $? = 63 is used to indicate version mismatch to missing.
599 EXIT_SKIP=77 # $? = 77 is used to indicate a skipped test to automake.
601 exit_status=$EXIT_SUCCESS
603 # Make sure IFS has a sensible default
608 dirname="s,/[^/]*$,,"
611 # func_dirname file append nondir_replacement
612 # Compute the dirname of FILE. If nonempty, add APPEND to the result,
613 # otherwise set result to NONDIR_REPLACEMENT.
617 */*) func_dirname_result="${1%/*}${2}" ;;
618 * ) func_dirname_result="${3}" ;;
620 } # Extended-shell func_dirname implementation
626 func_basename_result="${1##*/}"
627 } # Extended-shell func_basename implementation
630 # func_dirname_and_basename file append nondir_replacement
631 # perform func_basename and func_dirname in a single function
633 # dirname: Compute the dirname of FILE. If nonempty,
634 # add APPEND to the result, otherwise set result
635 # to NONDIR_REPLACEMENT.
636 # value returned in "$func_dirname_result"
637 # basename: Compute filename of FILE.
638 # value retuned in "$func_basename_result"
639 # Implementation must be kept synchronized with func_dirname
640 # and func_basename. For efficiency, we do not delegate to
641 # those functions but instead duplicate the functionality here.
642 func_dirname_and_basename ()
645 */*) func_dirname_result="${1%/*}${2}" ;;
646 * ) func_dirname_result="${3}" ;;
648 func_basename_result="${1##*/}"
649 } # Extended-shell func_dirname_and_basename implementation
652 # func_stripname prefix suffix name
653 # strip PREFIX and SUFFIX off of NAME.
654 # PREFIX and SUFFIX must not contain globbing or regex special
655 # characters, hashes, percent signs, but SUFFIX may contain a leading
656 # dot (in which case that matches only a dot).
657 # func_strip_suffix prefix name
660 # pdksh 5.2.14 does not do ${X%$Y} correctly if both X and Y are
661 # positional parameters, so assign one to ordinary parameter first.
662 func_stripname_result=${3}
663 func_stripname_result=${func_stripname_result#"${1}"}
664 func_stripname_result=${func_stripname_result%"${2}"}
665 } # Extended-shell func_stripname implementation
668 # These SED scripts presuppose an absolute path with a trailing slash.
669 pathcar='s,^/\([^/]*\).*$,\1,'
670 pathcdr='s,^/[^/]*,,'
671 removedotparts=':dotsl
675 collapseslashes='s@/\{1,\}@/@g'
676 finalslash='s,/*$,/,'
678 # func_normal_abspath PATH
679 # Remove doubled-up and trailing slashes, "." path components,
680 # and cancel out any ".." path components in PATH after making
681 # it an absolute path.
682 # value returned in "$func_normal_abspath_result"
683 func_normal_abspath ()
685 # Start from root dir and reassemble the path.
686 func_normal_abspath_result=
687 func_normal_abspath_tpath=$1
688 func_normal_abspath_altnamespace=
689 case $func_normal_abspath_tpath in
691 # Empty path, that just means $cwd.
692 func_stripname '' '/' "`pwd`"
693 func_normal_abspath_result=$func_stripname_result
696 # The next three entries are used to spot a run of precisely
697 # two leading slashes without using negated character classes;
698 # we take advantage of case's first-match behaviour.
700 # Unusual form of absolute path, do nothing.
703 # Not necessarily an ordinary path; POSIX reserves leading '//'
704 # and for example Cygwin uses it to access remote file shares
705 # over CIFS/SMB, so we conserve a leading double slash if found.
706 func_normal_abspath_altnamespace=/
709 # Absolute path, do nothing.
712 # Relative path, prepend $cwd.
713 func_normal_abspath_tpath=`pwd`/$func_normal_abspath_tpath
716 # Cancel out all the simple stuff to save iterations. We also want
717 # the path to end with a slash for ease of parsing, so make sure
718 # there is one (and only one) here.
719 func_normal_abspath_tpath=`$ECHO "$func_normal_abspath_tpath" | $SED \
720 -e "$removedotparts" -e "$collapseslashes" -e "$finalslash"`
722 # Processed it all yet?
723 if test "$func_normal_abspath_tpath" = / ; then
724 # If we ascended to the root using ".." the result may be empty now.
725 if test -z "$func_normal_abspath_result" ; then
726 func_normal_abspath_result=/
730 func_normal_abspath_tcomponent=`$ECHO "$func_normal_abspath_tpath" | $SED \
732 func_normal_abspath_tpath=`$ECHO "$func_normal_abspath_tpath" | $SED \
734 # Figure out what to do with it
735 case $func_normal_abspath_tcomponent in
737 # Trailing empty path component, ignore it.
740 # Parent dir; strip last assembled component from result.
741 func_dirname "$func_normal_abspath_result"
742 func_normal_abspath_result=$func_dirname_result
745 # Actual path component, append it.
746 func_normal_abspath_result=$func_normal_abspath_result/$func_normal_abspath_tcomponent
750 # Restore leading double-slash if one was found on entry.
751 func_normal_abspath_result=$func_normal_abspath_altnamespace$func_normal_abspath_result
754 # func_relative_path SRCDIR DSTDIR
755 # generates a relative path from SRCDIR to DSTDIR, with a trailing
756 # slash if non-empty, suitable for immediately appending a filename
757 # without needing to append a separator.
758 # value returned in "$func_relative_path_result"
759 func_relative_path ()
761 func_relative_path_result=
762 func_normal_abspath "$1"
763 func_relative_path_tlibdir=$func_normal_abspath_result
764 func_normal_abspath "$2"
765 func_relative_path_tbindir=$func_normal_abspath_result
767 # Ascend the tree starting from libdir
769 # check if we have found a prefix of bindir
770 case $func_relative_path_tbindir in
771 $func_relative_path_tlibdir)
772 # found an exact match
773 func_relative_path_tcancelled=
776 $func_relative_path_tlibdir*)
777 # found a matching prefix
778 func_stripname "$func_relative_path_tlibdir" '' "$func_relative_path_tbindir"
779 func_relative_path_tcancelled=$func_stripname_result
780 if test -z "$func_relative_path_result"; then
781 func_relative_path_result=.
786 func_dirname $func_relative_path_tlibdir
787 func_relative_path_tlibdir=${func_dirname_result}
788 if test "x$func_relative_path_tlibdir" = x ; then
789 # Have to descend all the way to the root!
790 func_relative_path_result=../$func_relative_path_result
791 func_relative_path_tcancelled=$func_relative_path_tbindir
794 func_relative_path_result=../$func_relative_path_result
799 # Now calculate path; take care to avoid doubling-up slashes.
800 func_stripname '' '/' "$func_relative_path_result"
801 func_relative_path_result=$func_stripname_result
802 func_stripname '/' '/' "$func_relative_path_tcancelled"
803 if test "x$func_stripname_result" != x ; then
804 func_relative_path_result=${func_relative_path_result}/${func_stripname_result}
807 # Normalisation. If bindir is libdir, return empty string,
808 # else relative path ending with a slash; either way, target
809 # file name can be directly appended.
810 if test ! -z "$func_relative_path_result"; then
811 func_stripname './' '' "$func_relative_path_result/"
812 func_relative_path_result=$func_stripname_result
816 # The name of this program:
817 func_dirname_and_basename "$progpath"
818 progname=$func_basename_result
820 # Make sure we have an absolute path for reexecution:
822 [\\/]*|[A-Za-z]:\\*) ;;
824 progdir=$func_dirname_result
825 progdir=`cd "$progdir" && pwd`
826 progpath="$progdir/$progname"
831 for progdir in $PATH; do
833 test -x "$progdir/$progname" && break
836 test -n "$progdir" || progdir=`pwd`
837 progpath="$progdir/$progname"
841 # Sed substitution that helps us do robust quoting. It backslashifies
842 # metacharacters that are still active within double-quoted strings.
843 Xsed="${SED}"' -e 1s/^X//'
844 sed_quote_subst='s/\([`"$\\]\)/\\\1/g'
846 # Same as above, but do not quote variable references.
847 double_quote_subst='s/\(["`\\]\)/\\\1/g'
849 # Sed substitution that turns a string into a regex matching for the
851 sed_make_literal_regex='s,[].[^$\\*\/],\\&,g'
853 # Sed substitution that converts a w32 file name or path
854 # which contains forward slashes, into one that contains
855 # (escaped) backslashes. A very naive implementation.
856 lt_sed_naive_backslashify='s|\\\\*|\\|g;s|/|\\|g;s|\\|\\\\|g'
858 # Re-`\' parameter expansions in output of double_quote_subst that were
859 # `\'-ed in input to the same. If an odd number of `\' preceded a '$'
860 # in input to double_quote_subst, that '$' was protected from expansion.
861 # Since each input `\' is now two `\'s, look for any number of runs of
862 # four `\'s followed by two `\'s and then a '$'. `\' that '$'.
867 sed_double_backslash="\
871 s/\\([^$bs]\\)$bs2$dollar/\\1$bs2$bs$dollar/g
882 # Echo program name prefixed message, along with the current mode
883 # name if it has been set yet.
886 $ECHO "$progname: ${opt_mode+$opt_mode: }$*"
889 # func_verbose arg...
890 # Echo program name prefixed message in verbose mode only.
893 $opt_verbose && func_echo ${1+"$@"}
895 # A bug in bash halts the script if the last line of a function
896 # fails when set -e is in force, so we need another command to
901 # func_echo_all arg...
902 # Invoke $ECHO with all args, space-separated.
909 # Echo program name prefixed message to standard error.
912 $ECHO "$progname: ${opt_mode+$opt_mode: }"${1+"$@"} 1>&2
915 # func_warning arg...
916 # Echo program name prefixed warning message to standard error.
919 $opt_warning && $ECHO "$progname: ${opt_mode+$opt_mode: }warning: "${1+"$@"} 1>&2
925 # func_fatal_error arg...
926 # Echo program name prefixed message to standard error, and exit.
933 # func_fatal_help arg...
934 # Echo program name prefixed message to standard error, followed by
935 # a help hint, and exit.
939 func_fatal_error "$help"
941 help="Try \`$progname --help' for more information." ## default
944 # func_grep expression filename
945 # Check whether EXPRESSION matches any line of FILENAME, without output.
948 $GREP "$1" "$2" >/dev/null 2>&1
952 # func_mkdir_p directory-path
953 # Make sure the entire path to DIRECTORY-PATH is available.
956 my_directory_path="$1"
959 if test -n "$my_directory_path" && test "$opt_dry_run" != ":"; then
961 # Protect directory names starting with `-'
962 case $my_directory_path in
963 -*) my_directory_path="./$my_directory_path" ;;
966 # While some portion of DIR does not yet exist...
967 while test ! -d "$my_directory_path"; do
968 # ...make a list in topmost first order. Use a colon delimited
969 # list incase some portion of path contains whitespace.
970 my_dir_list="$my_directory_path:$my_dir_list"
972 # If the last portion added has no slash in it, the list is done
973 case $my_directory_path in */*) ;; *) break ;; esac
975 # ...otherwise throw away the child directory and loop
976 my_directory_path=`$ECHO "$my_directory_path" | $SED -e "$dirname"`
978 my_dir_list=`$ECHO "$my_dir_list" | $SED 's,:*$,,'`
980 save_mkdir_p_IFS="$IFS"; IFS=':'
981 for my_dir in $my_dir_list; do
982 IFS="$save_mkdir_p_IFS"
983 # mkdir can fail with a `File exist' error if two processes
984 # try to create one of the directories concurrently. Don't
986 $MKDIR "$my_dir" 2>/dev/null || :
988 IFS="$save_mkdir_p_IFS"
990 # Bail out if we (or some other process) failed to create a directory.
991 test -d "$my_directory_path" || \
992 func_fatal_error "Failed to create \`$1'"
997 # func_mktempdir [string]
998 # Make a temporary directory that won't clash with other running
999 # libtool processes, and avoids race conditions if possible. If
1000 # given, STRING is the basename for that directory.
1003 my_template="${TMPDIR-/tmp}/${1-$progname}"
1005 if test "$opt_dry_run" = ":"; then
1006 # Return a directory name, but don't create it in dry-run mode
1007 my_tmpdir="${my_template}-$$"
1010 # If mktemp works, use that first and foremost
1011 my_tmpdir=`mktemp -d "${my_template}-XXXXXXXX" 2>/dev/null`
1013 if test ! -d "$my_tmpdir"; then
1014 # Failing that, at least try and use $RANDOM to avoid a race
1015 my_tmpdir="${my_template}-${RANDOM-0}$$"
1017 save_mktempdir_umask=`umask`
1020 umask $save_mktempdir_umask
1023 # If we're not in dry-run mode, bomb out on failure
1024 test -d "$my_tmpdir" || \
1025 func_fatal_error "cannot create temporary directory \`$my_tmpdir'"
1032 # func_quote_for_eval arg
1033 # Aesthetically quote ARG to be evaled later.
1034 # This function returns two values: FUNC_QUOTE_FOR_EVAL_RESULT
1035 # is double-quoted, suitable for a subsequent eval, whereas
1036 # FUNC_QUOTE_FOR_EVAL_UNQUOTED_RESULT has merely all characters
1037 # which are still active within double quotes backslashified.
1038 func_quote_for_eval ()
1042 func_quote_for_eval_unquoted_result=`$ECHO "$1" | $SED "$sed_quote_subst"` ;;
1044 func_quote_for_eval_unquoted_result="$1" ;;
1047 case $func_quote_for_eval_unquoted_result in
1048 # Double-quote args containing shell metacharacters to delay
1049 # word splitting, command substitution and and variable
1050 # expansion for a subsequent eval.
1051 # Many Bourne shells cannot handle close brackets correctly
1052 # in scan sets, so we specify it separately.
1053 *[\[\~\#\^\&\*\(\)\{\}\|\;\<\>\?\'\ \ ]*|*]*|"")
1054 func_quote_for_eval_result="\"$func_quote_for_eval_unquoted_result\""
1057 func_quote_for_eval_result="$func_quote_for_eval_unquoted_result"
1062 # func_quote_for_expand arg
1063 # Aesthetically quote ARG to be evaled later; same as above,
1064 # but do not quote variable references.
1065 func_quote_for_expand ()
1069 my_arg=`$ECHO "$1" | $SED \
1070 -e "$double_quote_subst" -e "$sed_double_backslash"` ;;
1076 # Double-quote args containing shell metacharacters to delay
1077 # word splitting and command substitution for a subsequent eval.
1078 # Many Bourne shells cannot handle close brackets correctly
1079 # in scan sets, so we specify it separately.
1080 *[\[\~\#\^\&\*\(\)\{\}\|\;\<\>\?\'\ \ ]*|*]*|"")
1081 my_arg="\"$my_arg\""
1085 func_quote_for_expand_result="$my_arg"
1089 # func_show_eval cmd [fail_exp]
1090 # Unless opt_silent is true, then output CMD. Then, if opt_dryrun is
1091 # not true, evaluate CMD. If the evaluation of CMD fails, and FAIL_EXP
1092 # is given, then evaluate it.
1096 my_fail_exp="${2-:}"
1098 ${opt_silent-false} || {
1099 func_quote_for_expand "$my_cmd"
1100 eval "func_echo $func_quote_for_expand_result"
1103 if ${opt_dry_run-false}; then :; else
1106 if test "$my_status" -eq 0; then :; else
1107 eval "(exit $my_status); $my_fail_exp"
1113 # func_show_eval_locale cmd [fail_exp]
1114 # Unless opt_silent is true, then output CMD. Then, if opt_dryrun is
1115 # not true, evaluate CMD. If the evaluation of CMD fails, and FAIL_EXP
1116 # is given, then evaluate it. Use the saved locale for evaluation.
1117 func_show_eval_locale ()
1120 my_fail_exp="${2-:}"
1122 ${opt_silent-false} || {
1123 func_quote_for_expand "$my_cmd"
1124 eval "func_echo $func_quote_for_expand_result"
1127 if ${opt_dry_run-false}; then :; else
1128 eval "$lt_user_locale
1131 eval "$lt_safe_locale"
1132 if test "$my_status" -eq 0; then :; else
1133 eval "(exit $my_status); $my_fail_exp"
1139 # Turn $1 into a string suitable for a shell variable name.
1140 # Result is stored in $func_tr_sh_result. All characters
1141 # not in the set a-zA-Z0-9_ are replaced with '_'. Further,
1142 # if $1 begins with a digit, a '_' is prepended as well.
1146 [0-9]* | *[!a-zA-Z0-9_]*)
1147 func_tr_sh_result=`$ECHO "$1" | $SED 's/^\([0-9]\)/_\1/; s/[^a-zA-Z0-9_]/_/g'`
1150 func_tr_sh_result=$1
1157 # Echo version message to standard output and exit.
1170 /^# '$PROGRAM' (GNU /,/# warranty; / {
1173 s/\((C)\)[ 0-9,-]*\( [1-9][0-9]*\)/\1\2/
1180 # Echo short help message to standard output and exit.
1185 $SED -n '/^# Usage:/,/^# *.*--help/ {
1188 s/\$progname/'$progname'/
1192 $ECHO "run \`$progname --help | more' for full usage"
1196 # func_help [NOEXIT]
1197 # Echo long help message to standard output and exit,
1198 # unless 'noexit' is passed as argument.
1203 $SED -n '/^# Usage:/,/# Report bugs to/ {
1207 s*\$progname*'$progname'*
1209 s*\$SHELL*'"$SHELL"'*
1211 s*\$LTCFLAGS*'"$LTCFLAGS"'*
1213 s/\$with_gnu_ld/'"$with_gnu_ld"'/
1214 s/\$automake_version/'"`(automake --version) 2>/dev/null |$SED 1q`"'/
1215 s/\$autoconf_version/'"`(autoconf --version) 2>/dev/null |$SED 1q`"'/
1219 /^# .* home page:/b print
1220 /^# General help using/b print
1223 if test -z "$1"; then
1228 # func_missing_arg argname
1229 # Echo program name prefixed message to standard error and set global
1235 func_error "missing argument for $1."
1240 # func_split_short_opt shortopt
1241 # Set func_split_short_opt_name and func_split_short_opt_arg shell
1242 # variables after splitting SHORTOPT after the 2nd character.
1243 func_split_short_opt ()
1245 func_split_short_opt_arg=${1#??}
1246 func_split_short_opt_name=${1%"$func_split_short_opt_arg"}
1247 } # Extended-shell func_split_short_opt implementation
1250 # func_split_long_opt longopt
1251 # Set func_split_long_opt_name and func_split_long_opt_arg shell
1252 # variables after splitting LONGOPT at the `=' sign.
1253 func_split_long_opt ()
1255 func_split_long_opt_name=${1%%=*}
1256 func_split_long_opt_arg=${1#*=}
1257 } # Extended-shell func_split_long_opt implementation
1265 magic="%%%MAGIC variable%%%"
1266 magic_exe="%%%MAGIC EXE variable%%%"
1271 lo2o="s/\\.lo\$/.${objext}/"
1272 o2lo="s/\\.${objext}\$/.lo/"
1276 # If this variable is set in any of the actions, the command in it
1277 # will be execed at the end. This prevents here-documents from being
1278 # left over by shells.
1281 # func_append var value
1282 # Append VALUE to the end of shell variable VAR.
1286 } # Extended-shell func_append implementation
1288 # func_append_quoted var value
1289 # Quote VALUE and append to the end of shell variable VAR, separated
1291 func_append_quoted ()
1293 func_quote_for_eval "${2}"
1294 eval "${1}+=\\ \$func_quote_for_eval_result"
1295 } # Extended-shell func_append_quoted implementation
1298 # func_arith arithmetic-term...
1301 func_arith_result=$(( $* ))
1302 } # Extended-shell func_arith implementation
1306 # STRING may not start with a hyphen.
1309 func_len_result=${#1}
1310 } # Extended-shell func_len implementation
1317 *.lo) func_lo2o_result=${1%.lo}.${objext} ;;
1318 *) func_lo2o_result=${1} ;;
1320 } # Extended-shell func_lo2o implementation
1323 # func_xform libobj-or-source
1326 func_xform_result=${1%.*}.lo
1327 } # Extended-shell func_xform implementation
1330 # func_fatal_configuration arg...
1331 # Echo program name prefixed message to standard error, followed by
1332 # a configuration failure hint, and exit.
1333 func_fatal_configuration ()
1335 func_error ${1+"$@"}
1336 func_error "See the $PACKAGE documentation for more information."
1337 func_fatal_error "Fatal configuration error."
1342 # Display the configuration for all the tags in this script.
1345 re_begincf='^# ### BEGIN LIBTOOL'
1346 re_endcf='^# ### END LIBTOOL'
1348 # Default configuration.
1349 $SED "1,/$re_begincf CONFIG/d;/$re_endcf CONFIG/,\$d" < "$progpath"
1351 # Now print the configurations for the tags.
1352 for tagname in $taglist; do
1353 $SED -n "/$re_begincf TAG CONFIG: $tagname\$/,/$re_endcf TAG CONFIG: $tagname\$/p" < "$progpath"
1360 # Display the features supported by this script.
1364 if test "$build_libtool_libs" = yes; then
1365 echo "enable shared libraries"
1367 echo "disable shared libraries"
1369 if test "$build_old_libs" = yes; then
1370 echo "enable static libraries"
1372 echo "disable static libraries"
1378 # func_enable_tag tagname
1379 # Verify that TAGNAME is valid, and either flag an error and exit, or
1380 # enable the TAGNAME tag. We also add TAGNAME to the global $taglist
1387 re_begincf="^# ### BEGIN LIBTOOL TAG CONFIG: $tagname\$"
1388 re_endcf="^# ### END LIBTOOL TAG CONFIG: $tagname\$"
1389 sed_extractcf="/$re_begincf/,/$re_endcf/p"
1394 func_fatal_error "invalid tag name: $tagname"
1398 # Don't test for the "default" C tag, as we know it's
1399 # there but not specially marked.
1403 if $GREP "$re_begincf" "$progpath" >/dev/null 2>&1; then
1404 taglist="$taglist $tagname"
1406 # Evaluate the configuration. Be careful to quote the path
1407 # and the sed script, to avoid splitting on whitespace, but
1408 # also don't use non-portable quotes within backquotes within
1409 # quotes we have to do it in 2 steps:
1410 extractedcf=`$SED -n -e "$sed_extractcf" < "$progpath"`
1413 func_error "ignoring unknown tag $tagname"
1419 # func_check_version_match
1420 # Ensure that we are using m4 macros, and libtool script from the same
1421 # release of libtool.
1422 func_check_version_match ()
1424 if test "$package_revision" != "$macro_revision"; then
1425 if test "$VERSION" != "$macro_version"; then
1426 if test -z "$macro_version"; then
1428 $progname: Version mismatch error. This is $PACKAGE $VERSION, but the
1429 $progname: definition of this LT_INIT comes from an older release.
1430 $progname: You should recreate aclocal.m4 with macros from $PACKAGE $VERSION
1431 $progname: and run autoconf again.
1435 $progname: Version mismatch error. This is $PACKAGE $VERSION, but the
1436 $progname: definition of this LT_INIT comes from $PACKAGE $macro_version.
1437 $progname: You should recreate aclocal.m4 with macros from $PACKAGE $VERSION
1438 $progname: and run autoconf again.
1443 $progname: Version mismatch error. This is $PACKAGE $VERSION, revision $package_revision,
1444 $progname: but the definition of this LT_INIT comes from revision $macro_revision.
1445 $progname: You should recreate aclocal.m4 with macros from revision $package_revision
1446 $progname: of $PACKAGE $VERSION and run autoconf again.
1455 # Shorthand for --mode=foo, only valid as the first argument
1458 shift; set dummy --mode clean ${1+"$@"}; shift
1460 compile|compil|compi|comp|com|co|c)
1461 shift; set dummy --mode compile ${1+"$@"}; shift
1463 execute|execut|execu|exec|exe|ex|e)
1464 shift; set dummy --mode execute ${1+"$@"}; shift
1466 finish|finis|fini|fin|fi|f)
1467 shift; set dummy --mode finish ${1+"$@"}; shift
1469 install|instal|insta|inst|ins|in|i)
1470 shift; set dummy --mode install ${1+"$@"}; shift
1473 shift; set dummy --mode link ${1+"$@"}; shift
1475 uninstall|uninstal|uninsta|uninst|unins|unin|uni|un|u)
1476 shift; set dummy --mode uninstall ${1+"$@"}; shift
1486 opt_preserve_dup_deps=false
1497 # Parse options once, thoroughly. This comes as soon as possible in the
1498 # script to make things like `--version' happen as quickly as we can.
1500 # this just eases exit handling
1501 while test $# -gt 0; do
1505 --debug|-x) opt_debug='set -x'
1506 func_echo "enabling shell trace mode"
1509 --dry-run|--dryrun|-n)
1518 opt_dlopen="${opt_dlopen+$opt_dlopen
1522 --preserve-dup-deps)
1523 opt_preserve_dup_deps=:
1531 set dummy --mode finish ${1+"$@"}; shift
1538 opt_help=': help-all'
1541 test $# = 0 && func_missing_arg $opt && break
1545 # Valid mode arguments:
1546 clean|compile|execute|finish|install|link|relink|uninstall) ;;
1548 # Catch anything else as an error
1549 *) func_error "invalid argument for $opt"
1556 --no-silent|--no-quiet)
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 | *.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"
3642 func_show_eval "$install_prog \$file \$oldlib" 'exit $?'
3644 if test -n "$stripme" && test -n "$old_striplib"; then
3645 func_show_eval "$old_striplib $oldlib" 'exit $?'
3648 # Do each command in the postinstall commands.
3649 func_execute_cmds "$old_postinstall_cmds" 'exit $?'
3652 test -n "$future_libdirs" && \
3653 func_warning "remember to run \`$progname --finish$future_libdirs'"
3655 if test -n "$current_libdirs"; then
3656 # Maybe just do a dry run.
3657 $opt_dry_run && current_libdirs=" -n$current_libdirs"
3658 exec_cmd='$SHELL $progpath $preserve_args --finish$current_libdirs'
3664 test "$opt_mode" = install && func_mode_install ${1+"$@"}
3667 # func_generate_dlsyms outputname originator pic_p
3668 # Extract symbols from dlprefiles and create ${outputname}S.o with
3669 # a dlpreopen symbol table.
3670 func_generate_dlsyms ()
3676 my_prefix=`$ECHO "$my_originator" | sed 's%[^a-zA-Z0-9]%_%g'`
3679 if test -n "$dlfiles$dlprefiles" || test "$dlself" != no; then
3680 if test -n "$NM" && test -n "$global_symbol_pipe"; then
3681 my_dlsyms="${my_outputname}S.c"
3683 func_error "not configured to extract global symbols from dlpreopened files"
3687 if test -n "$my_dlsyms"; then
3691 # Discover the nlist of each of the dlfiles.
3692 nlist="$output_objdir/${my_outputname}.nm"
3694 func_show_eval "$RM $nlist ${nlist}S ${nlist}T"
3696 # Parse the name list into a source file.
3697 func_verbose "creating $output_objdir/$my_dlsyms"
3699 $opt_dry_run || $ECHO > "$output_objdir/$my_dlsyms" "\
3700 /* $my_dlsyms - symbol resolution table for \`$my_outputname' dlsym emulation. */
3701 /* Generated by $PROGRAM (GNU $PACKAGE$TIMESTAMP) $VERSION */
3707 #if defined(__GNUC__) && (((__GNUC__ == 4) && (__GNUC_MINOR__ >= 4)) || (__GNUC__ > 4))
3708 #pragma GCC diagnostic ignored \"-Wstrict-prototypes\"
3711 /* Keep this code in sync between libtool.m4, ltmain, lt_system.h, and tests. */
3712 #if defined(_WIN32) || defined(__CYGWIN__) || defined(_WIN32_WCE)
3713 /* DATA imports from DLLs on WIN32 con't be const, because runtime
3714 relocations are performed -- see ld's documentation on pseudo-relocs. */
3715 # define LT_DLSYM_CONST
3716 #elif defined(__osf__)
3717 /* This system does not cope well with relocations in const data. */
3718 # define LT_DLSYM_CONST
3720 # define LT_DLSYM_CONST const
3723 /* External symbol declarations for the compiler. */\
3726 if test "$dlself" = yes; then
3727 func_verbose "generating symbol list for \`$output'"
3729 $opt_dry_run || echo ': @PROGRAM@ ' > "$nlist"
3731 # Add our own program objects to the symbol list.
3732 progfiles=`$ECHO "$objs$old_deplibs" | $SP2NL | $SED "$lo2o" | $NL2SP`
3733 for progfile in $progfiles; do
3734 func_to_tool_file "$progfile" func_convert_file_msys_to_w32
3735 func_verbose "extracting global C symbols from \`$func_to_tool_file_result'"
3736 $opt_dry_run || eval "$NM $func_to_tool_file_result | $global_symbol_pipe >> '$nlist'"
3739 if test -n "$exclude_expsyms"; then
3741 eval '$EGREP -v " ($exclude_expsyms)$" "$nlist" > "$nlist"T'
3742 eval '$MV "$nlist"T "$nlist"'
3746 if test -n "$export_symbols_regex"; then
3748 eval '$EGREP -e "$export_symbols_regex" "$nlist" > "$nlist"T'
3749 eval '$MV "$nlist"T "$nlist"'
3753 # Prepare the list of exported symbols
3754 if test -z "$export_symbols"; then
3755 export_symbols="$output_objdir/$outputname.exp"
3758 eval "${SED} -n -e '/^: @PROGRAM@ $/d' -e 's/^.* \(.*\)$/\1/p' "'< "$nlist" > "$export_symbols"'
3760 *cygwin* | *mingw* | *cegcc* )
3761 eval "echo EXPORTS "'> "$output_objdir/$outputname.def"'
3762 eval 'cat "$export_symbols" >> "$output_objdir/$outputname.def"'
3768 eval "${SED} -e 's/\([].[*^$]\)/\\\\\1/g' -e 's/^/ /' -e 's/$/$/'"' < "$export_symbols" > "$output_objdir/$outputname.exp"'
3769 eval '$GREP -f "$output_objdir/$outputname.exp" < "$nlist" > "$nlist"T'
3770 eval '$MV "$nlist"T "$nlist"'
3772 *cygwin* | *mingw* | *cegcc* )
3773 eval "echo EXPORTS "'> "$output_objdir/$outputname.def"'
3774 eval 'cat "$nlist" >> "$output_objdir/$outputname.def"'
3781 for dlprefile in $dlprefiles; do
3782 func_verbose "extracting global C symbols from \`$dlprefile'"
3783 func_basename "$dlprefile"
3784 name="$func_basename_result"
3786 *cygwin* | *mingw* | *cegcc* )
3787 # if an import library, we need to obtain dlname
3788 if func_win32_import_lib_p "$dlprefile"; then
3789 func_tr_sh "$dlprefile"
3790 eval "curr_lafile=\$libfile_$func_tr_sh_result"
3791 dlprefile_dlbasename=""
3792 if test -n "$curr_lafile" && func_lalib_p "$curr_lafile"; then
3793 # Use subshell, to avoid clobbering current variable values
3794 dlprefile_dlname=`source "$curr_lafile" && echo "$dlname"`
3795 if test -n "$dlprefile_dlname" ; then
3796 func_basename "$dlprefile_dlname"
3797 dlprefile_dlbasename="$func_basename_result"
3799 # no lafile. user explicitly requested -dlpreopen <import library>.
3800 $sharedlib_from_linklib_cmd "$dlprefile"
3801 dlprefile_dlbasename=$sharedlib_from_linklib_result
3805 if test -n "$dlprefile_dlbasename" ; then
3806 eval '$ECHO ": $dlprefile_dlbasename" >> "$nlist"'
3808 func_warning "Could not compute DLL name from $name"
3809 eval '$ECHO ": $name " >> "$nlist"'
3811 func_to_tool_file "$dlprefile" func_convert_file_msys_to_w32
3812 eval "$NM \"$func_to_tool_file_result\" 2>/dev/null | $global_symbol_pipe |
3813 $SED -e '/I __imp/d' -e 's/I __nm_/D /;s/_nm__//' >> '$nlist'"
3815 else # not an import lib
3817 eval '$ECHO ": $name " >> "$nlist"'
3818 func_to_tool_file "$dlprefile" func_convert_file_msys_to_w32
3819 eval "$NM \"$func_to_tool_file_result\" 2>/dev/null | $global_symbol_pipe >> '$nlist'"
3825 eval '$ECHO ": $name " >> "$nlist"'
3826 func_to_tool_file "$dlprefile" func_convert_file_msys_to_w32
3827 eval "$NM \"$func_to_tool_file_result\" 2>/dev/null | $global_symbol_pipe >> '$nlist'"
3834 # Make sure we have at least an empty file.
3835 test -f "$nlist" || : > "$nlist"
3837 if test -n "$exclude_expsyms"; then
3838 $EGREP -v " ($exclude_expsyms)$" "$nlist" > "$nlist"T
3839 $MV "$nlist"T "$nlist"
3842 # Try sorting and uniquifying the output.
3843 if $GREP -v "^: " < "$nlist" |
3844 if sort -k 3 </dev/null >/dev/null 2>&1; then
3849 uniq > "$nlist"S; then
3852 $GREP -v "^: " < "$nlist" > "$nlist"S
3855 if test -f "$nlist"S; then
3856 eval "$global_symbol_to_cdecl"' < "$nlist"S >> "$output_objdir/$my_dlsyms"'
3858 echo '/* NONE */' >> "$output_objdir/$my_dlsyms"
3861 echo >> "$output_objdir/$my_dlsyms" "\
3863 /* The mapping between symbol names and symbols. */
3868 extern LT_DLSYM_CONST lt_dlsymlist
3869 lt_${my_prefix}_LTX_preloaded_symbols[];
3870 LT_DLSYM_CONST lt_dlsymlist
3871 lt_${my_prefix}_LTX_preloaded_symbols[] =
3873 { \"$my_originator\", (void *) 0 },"
3875 case $need_lib_prefix in
3877 eval "$global_symbol_to_c_name_address" < "$nlist" >> "$output_objdir/$my_dlsyms"
3880 eval "$global_symbol_to_c_name_address_lib_prefix" < "$nlist" >> "$output_objdir/$my_dlsyms"
3883 echo >> "$output_objdir/$my_dlsyms" "\
3887 /* This works around a problem in FreeBSD linker */
3888 #ifdef FREEBSD_WORKAROUND
3889 static const void *lt_preloaded_setup() {
3890 return lt_${my_prefix}_LTX_preloaded_symbols;
3900 pic_flag_for_symtable=
3901 case "$compile_command " in
3905 # compiling the symbol table file with pic_flag works around
3906 # a FreeBSD bug that causes programs to crash when -lm is
3907 # linked before any other PIC object. But we must not use
3908 # pic_flag when linking with -static. The problem exists in
3909 # FreeBSD 2.2.6 and is fixed in FreeBSD 3.1.
3910 *-*-freebsd2*|*-*-freebsd3.0*|*-*-freebsdelf3.0*)
3911 pic_flag_for_symtable=" $pic_flag -DFREEBSD_WORKAROUND" ;;
3913 pic_flag_for_symtable=" $pic_flag" ;;
3915 if test "X$my_pic_p" != Xno; then
3916 pic_flag_for_symtable=" $pic_flag"
3923 for arg in $LTCFLAGS; do
3925 -pie | -fpie | -fPIE) ;;
3926 *) symtab_cflags+=" $arg" ;;
3930 # Now compile the dynamic symbol file.
3931 func_show_eval '(cd $output_objdir && $LTCC$symtab_cflags -c$no_builtin_flag$pic_flag_for_symtable "$my_dlsyms")' 'exit $?'
3933 # Clean up the generated files.
3934 func_show_eval '$RM "$output_objdir/$my_dlsyms" "$nlist" "${nlist}S" "${nlist}T"'
3936 # Transform the symbol file into the correct name.
3937 symfileobj="$output_objdir/${my_outputname}S.$objext"
3939 *cygwin* | *mingw* | *cegcc* )
3940 if test -f "$output_objdir/$my_outputname.def"; then
3941 compile_command=`$ECHO "$compile_command" | $SED "s%@SYMFILE@%$output_objdir/$my_outputname.def $symfileobj%"`
3942 finalize_command=`$ECHO "$finalize_command" | $SED "s%@SYMFILE@%$output_objdir/$my_outputname.def $symfileobj%"`
3944 compile_command=`$ECHO "$compile_command" | $SED "s%@SYMFILE@%$symfileobj%"`
3945 finalize_command=`$ECHO "$finalize_command" | $SED "s%@SYMFILE@%$symfileobj%"`
3949 compile_command=`$ECHO "$compile_command" | $SED "s%@SYMFILE@%$symfileobj%"`
3950 finalize_command=`$ECHO "$finalize_command" | $SED "s%@SYMFILE@%$symfileobj%"`
3955 func_fatal_error "unknown suffix for \`$my_dlsyms'"
3959 # We keep going just in case the user didn't refer to
3960 # lt_preloaded_symbols. The linker will fail if global_symbol_pipe
3961 # really was required.
3963 # Nullify the symbol file.
3964 compile_command=`$ECHO "$compile_command" | $SED "s% @SYMFILE@%%"`
3965 finalize_command=`$ECHO "$finalize_command" | $SED "s% @SYMFILE@%%"`
3969 # func_win32_libid arg
3970 # return the library type of file 'arg'
3972 # Need a lot of goo to handle *both* DLLs and import libs
3973 # Has to be a shell function in order to 'eat' the argument
3974 # that is supplied when $file_magic_command is called.
3975 # Despite the name, also deal with 64 bit binaries.
3979 win32_libid_type="unknown"
3980 win32_fileres=`file -L $1 2>/dev/null`
3981 case $win32_fileres in
3982 *ar\ archive\ import\ library*) # definitely import
3983 win32_libid_type="x86 archive import"
3985 *ar\ archive*) # could be an import, or static
3986 # Keep the egrep pattern in sync with the one in _LT_CHECK_MAGIC_METHOD.
3987 if eval $OBJDUMP -f $1 | $SED -e '10q' 2>/dev/null |
3988 $EGREP 'file format (pei*-i386(.*architecture: i386)?|pe-arm-wince|pe-x86-64)' >/dev/null; then
3989 func_to_tool_file "$1" func_convert_file_msys_to_w32
3990 win32_nmres=`eval $NM -f posix -A \"$func_to_tool_file_result\" |
3999 case $win32_nmres in
4000 import*) win32_libid_type="x86 archive import";;
4001 *) win32_libid_type="x86 archive static";;
4006 win32_libid_type="x86 DLL"
4008 *executable*) # but shell scripts are "executable" too...
4009 case $win32_fileres in
4010 *MS\ Windows\ PE\ Intel*)
4011 win32_libid_type="x86 DLL"
4016 $ECHO "$win32_libid_type"
4019 # func_cygming_dll_for_implib ARG
4021 # Platform-specific function to extract the
4022 # name of the DLL associated with the specified
4023 # import library ARG.
4024 # Invoked by eval'ing the libtool variable
4025 # $sharedlib_from_linklib_cmd
4026 # Result is available in the variable
4027 # $sharedlib_from_linklib_result
4028 func_cygming_dll_for_implib ()
4031 sharedlib_from_linklib_result=`$DLLTOOL --identify-strict --identify "$1"`
4034 # func_cygming_dll_for_implib_fallback_core SECTION_NAME LIBNAMEs
4036 # The is the core of a fallback implementation of a
4037 # platform-specific function to extract the name of the
4038 # DLL associated with the specified import library LIBNAME.
4040 # SECTION_NAME is either .idata$6 or .idata$7, depending
4041 # on the platform and compiler that created the implib.
4043 # Echos the name of the DLL associated with the
4044 # specified import library.
4045 func_cygming_dll_for_implib_fallback_core ()
4048 match_literal=`$ECHO "$1" | $SED "$sed_make_literal_regex"`
4049 $OBJDUMP -s --section "$1" "$2" 2>/dev/null |
4050 $SED '/^Contents of section '"$match_literal"':/{
4051 # Place marker at beginning of archive member dllname section
4056 # These lines can sometimes be longer than 43 characters, but
4057 # are always uninteresting
4058 /:[ ]*file format pe[i]\{,1\}-/d
4059 /^In archive [^:]*:/d
4060 # Ensure marker is printed
4062 # Remove all lines with less than 43 characters
4064 # From remaining lines, remove first 43 characters
4067 # Join marker and all lines until next marker into a single line
4068 /^====MARK====/ b para
4077 # Remove trailing dots and whitespace
4081 # we now have a list, one entry per line, of the stringified
4082 # contents of the appropriate section of all members of the
4083 # archive which possess that section. Heuristic: eliminate
4084 # all those which have a first or second character that is
4085 # a '.' (that is, objdump's representation of an unprintable
4086 # character.) This should work for all archives with less than
4087 # 0x302f exports -- but will fail for DLLs whose name actually
4088 # begins with a literal '.' or a single character followed by
4091 # Of those that remain, print the first one.
4092 $SED -e '/^\./d;/^.\./d;q'
4095 # func_cygming_gnu_implib_p ARG
4096 # This predicate returns with zero status (TRUE) if
4097 # ARG is a GNU/binutils-style import library. Returns
4098 # with nonzero status (FALSE) otherwise.
4099 func_cygming_gnu_implib_p ()
4102 func_to_tool_file "$1" func_convert_file_msys_to_w32
4103 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)$'`
4104 test -n "$func_cygming_gnu_implib_tmp"
4107 # func_cygming_ms_implib_p ARG
4108 # This predicate returns with zero status (TRUE) if
4109 # ARG is an MS-style import library. Returns
4110 # with nonzero status (FALSE) otherwise.
4111 func_cygming_ms_implib_p ()
4114 func_to_tool_file "$1" func_convert_file_msys_to_w32
4115 func_cygming_ms_implib_tmp=`$NM "$func_to_tool_file_result" | eval "$global_symbol_pipe" | $GREP '_NULL_IMPORT_DESCRIPTOR'`
4116 test -n "$func_cygming_ms_implib_tmp"
4119 # func_cygming_dll_for_implib_fallback ARG
4120 # Platform-specific function to extract the
4121 # name of the DLL associated with the specified
4122 # import library ARG.
4124 # This fallback implementation is for use when $DLLTOOL
4125 # does not support the --identify-strict option.
4126 # Invoked by eval'ing the libtool variable
4127 # $sharedlib_from_linklib_cmd
4128 # Result is available in the variable
4129 # $sharedlib_from_linklib_result
4130 func_cygming_dll_for_implib_fallback ()
4133 if func_cygming_gnu_implib_p "$1" ; then
4134 # binutils import library
4135 sharedlib_from_linklib_result=`func_cygming_dll_for_implib_fallback_core '.idata$7' "$1"`
4136 elif func_cygming_ms_implib_p "$1" ; then
4137 # ms-generated import library
4138 sharedlib_from_linklib_result=`func_cygming_dll_for_implib_fallback_core '.idata$6' "$1"`
4141 sharedlib_from_linklib_result=""
4146 # func_extract_an_archive dir oldlib
4147 func_extract_an_archive ()
4150 f_ex_an_ar_dir="$1"; shift
4151 f_ex_an_ar_oldlib="$1"
4152 if test "$lock_old_archive_extraction" = yes; then
4153 lockfile=$f_ex_an_ar_oldlib.lock
4154 until $opt_dry_run || ln "$progpath" "$lockfile" 2>/dev/null; do
4155 func_echo "Waiting for $lockfile to be removed"
4159 func_show_eval "(cd \$f_ex_an_ar_dir && $AR x \"\$f_ex_an_ar_oldlib\")" \
4160 'stat=$?; rm -f "$lockfile"; exit $stat'
4161 if test "$lock_old_archive_extraction" = yes; then
4162 $opt_dry_run || rm -f "$lockfile"
4164 if ($AR t "$f_ex_an_ar_oldlib" | sort | sort -uc >/dev/null 2>&1); then
4167 func_fatal_error "object name conflicts in archive: $f_ex_an_ar_dir/$f_ex_an_ar_oldlib"
4172 # func_extract_archives gentop oldlib ...
4173 func_extract_archives ()
4176 my_gentop="$1"; shift
4177 my_oldlibs=${1+"$@"}
4183 for my_xlib in $my_oldlibs; do
4184 # Extract the objects.
4186 [\\/]* | [A-Za-z]:[\\/]*) my_xabs="$my_xlib" ;;
4187 *) my_xabs=`pwd`"/$my_xlib" ;;
4189 func_basename "$my_xlib"
4190 my_xlib="$func_basename_result"
4193 case " $extracted_archives " in
4195 func_arith $extracted_serial + 1
4196 extracted_serial=$func_arith_result
4197 my_xlib_u=lt$extracted_serial-$my_xlib ;;
4201 extracted_archives="$extracted_archives $my_xlib_u"
4202 my_xdir="$my_gentop/$my_xlib_u"
4204 func_mkdir_p "$my_xdir"
4208 func_verbose "Extracting $my_xabs"
4209 # Do not bother doing anything if just a dry run
4211 darwin_orig_dir=`pwd`
4212 cd $my_xdir || exit $?
4213 darwin_archive=$my_xabs
4215 darwin_base_archive=`basename "$darwin_archive"`
4216 darwin_arches=`$LIPO -info "$darwin_archive" 2>/dev/null | $GREP Architectures 2>/dev/null || true`
4217 if test -n "$darwin_arches"; then
4218 darwin_arches=`$ECHO "$darwin_arches" | $SED -e 's/.*are://'`
4220 func_verbose "$darwin_base_archive has multiple architectures $darwin_arches"
4221 for darwin_arch in $darwin_arches ; do
4222 func_mkdir_p "unfat-$$/${darwin_base_archive}-${darwin_arch}"
4223 $LIPO -thin $darwin_arch -output "unfat-$$/${darwin_base_archive}-${darwin_arch}/${darwin_base_archive}" "${darwin_archive}"
4224 cd "unfat-$$/${darwin_base_archive}-${darwin_arch}"
4225 func_extract_an_archive "`pwd`" "${darwin_base_archive}"
4227 $RM "unfat-$$/${darwin_base_archive}-${darwin_arch}/${darwin_base_archive}"
4228 done # $darwin_arches
4229 ## Okay now we've a bunch of thin objects, gotta fatten them up :)
4230 darwin_filelist=`find unfat-$$ -type f -name \*.o -print -o -name \*.lo -print | $SED -e "$basename" | sort -u`
4233 for darwin_file in $darwin_filelist; do
4234 darwin_files=`find unfat-$$ -name $darwin_file -print | sort | $NL2SP`
4235 $LIPO -create -output "$darwin_file" $darwin_files
4236 done # $darwin_filelist
4238 cd "$darwin_orig_dir"
4241 func_extract_an_archive "$my_xdir" "$my_xabs"
4246 func_extract_an_archive "$my_xdir" "$my_xabs"
4249 my_oldobjs="$my_oldobjs "`find $my_xdir -name \*.$objext -print -o -name \*.lo -print | sort | $NL2SP`
4252 func_extract_archives_result="$my_oldobjs"
4256 # func_emit_wrapper [arg=no]
4258 # Emit a libtool wrapper script on stdout.
4259 # Don't directly open a file because we may want to
4260 # incorporate the script contents within a cygwin/mingw
4261 # wrapper executable. Must ONLY be called from within
4262 # func_mode_link because it depends on a number of variables
4265 # ARG is the value that the WRAPPER_SCRIPT_BELONGS_IN_OBJDIR
4266 # variable will take. If 'yes', then the emitted script
4267 # will assume that the directory in which it is stored is
4268 # the $objdir directory. This is a cygwin/mingw-specific
4270 func_emit_wrapper ()
4272 func_emit_wrapper_arg1=${1-no}
4277 # $output - temporary wrapper script for $objdir/$outputname
4278 # Generated by $PROGRAM (GNU $PACKAGE$TIMESTAMP) $VERSION
4280 # The $output program cannot be directly executed until all the libtool
4281 # libraries that it depends on are installed.
4283 # This wrapper script should never be moved out of the build directory.
4284 # If it is, it will not operate correctly.
4286 # Sed substitution that helps us do robust quoting. It backslashifies
4287 # metacharacters that are still active within double-quoted strings.
4288 sed_quote_subst='$sed_quote_subst'
4290 # Be Bourne compatible
4291 if test -n \"\${ZSH_VERSION+set}\" && (emulate sh) >/dev/null 2>&1; then
4294 # Zsh 3.x and 4.x performs word splitting on \${1+\"\$@\"}, which
4295 # is contrary to our usage. Disable this feature.
4296 alias -g '\${1+\"\$@\"}'='\"\$@\"'
4297 setopt NO_GLOB_SUBST
4299 case \`(set -o) 2>/dev/null\` in *posix*) set -o posix;; esac
4301 BIN_SH=xpg4; export BIN_SH # for Tru64
4302 DUALCASE=1; export DUALCASE # for MKS sh
4304 # The HP-UX ksh and POSIX shell print the target directory to stdout
4306 (unset CDPATH) >/dev/null 2>&1 && unset CDPATH
4308 relink_command=\"$relink_command\"
4310 # This environment variable determines our operation mode.
4311 if test \"\$libtool_install_magic\" = \"$magic\"; then
4312 # install mode needs the following variables:
4313 generated_by_libtool_version='$macro_version'
4314 notinst_deplibs='$notinst_deplibs'
4316 # When we are sourced in execute mode, \$file and \$ECHO are already set.
4317 if test \"\$libtool_execute_magic\" != \"$magic\"; then
4320 qECHO=`$ECHO "$ECHO" | $SED "$sed_quote_subst"`
4323 # A function that is used when there is no print builtin or printf.
4324 func_fallback_echo ()
4326 eval 'cat <<_LTECHO_EOF
4333 # Very basic option parsing. These options are (a) specific to
4334 # the libtool wrapper, (b) are identical between the wrapper
4335 # /script/ and the wrapper /executable/ which is used only on
4336 # windows platforms, and (c) all begin with the string "--lt-"
4337 # (application programs are unlikely to have options which match
4340 # There are only two supported options: --lt-debug and
4341 # --lt-dump-script. There is, deliberately, no --lt-help.
4343 # The first argument to this parsing function should be the
4344 # script's $0 value, followed by "$@".
4346 func_parse_lt_options ()
4352 case \"\$lt_opt\" in
4353 --lt-debug) lt_option_debug=1 ;;
4355 lt_dump_D=\`\$ECHO \"X\$lt_script_arg0\" | $SED -e 's/^X//' -e 's%/[^/]*$%%'\`
4356 test \"X\$lt_dump_D\" = \"X\$lt_script_arg0\" && lt_dump_D=.
4357 lt_dump_F=\`\$ECHO \"X\$lt_script_arg0\" | $SED -e 's/^X//' -e 's%^.*/%%'\`
4358 cat \"\$lt_dump_D/\$lt_dump_F\"
4362 \$ECHO \"Unrecognized --lt- option: '\$lt_opt'\" 1>&2
4368 # Print the debug banner immediately:
4369 if test -n \"\$lt_option_debug\"; then
4370 echo \"${outputname}:${output}:\${LINENO}: libtool wrapper (GNU $PACKAGE$TIMESTAMP) $VERSION\" 1>&2
4374 # Used when --lt-debug. Prints its arguments to stdout
4375 # (redirection is the responsibility of the caller)
4376 func_lt_dump_args ()
4381 \$ECHO \"${outputname}:${output}:\${LINENO}: newargv[\$lt_dump_args_N]: \$lt_arg\"
4382 lt_dump_args_N=\`expr \$lt_dump_args_N + 1\`
4386 # Core function for launching the target application
4387 func_exec_program_core ()
4391 # Backslashes separate directories on plain windows
4392 *-*-mingw | *-*-os2* | *-cegcc*)
4394 if test -n \"\$lt_option_debug\"; then
4395 \$ECHO \"${outputname}:${output}:\${LINENO}: newargv[0]: \$progdir\\\\\$program\" 1>&2
4396 func_lt_dump_args \${1+\"\$@\"} 1>&2
4398 exec \"\$progdir\\\\\$program\" \${1+\"\$@\"}
4404 if test -n \"\$lt_option_debug\"; then
4405 \$ECHO \"${outputname}:${output}:\${LINENO}: newargv[0]: \$progdir/\$program\" 1>&2
4406 func_lt_dump_args \${1+\"\$@\"} 1>&2
4408 exec \"\$progdir/\$program\" \${1+\"\$@\"}
4413 \$ECHO \"\$0: cannot exec \$program \$*\" 1>&2
4417 # A function to encapsulate launching the target application
4418 # Strips options in the --lt-* namespace from \$@ and
4419 # launches target application with the remaining arguments.
4420 func_exec_program ()
4426 *) set x \"\$@\" \"\$lt_wr_arg\"; shift;;
4430 func_exec_program_core \${1+\"\$@\"}
4434 func_parse_lt_options \"\$0\" \${1+\"\$@\"}
4436 # Find the directory that this script lives in.
4437 thisdir=\`\$ECHO \"\$file\" | $SED 's%/[^/]*$%%'\`
4438 test \"x\$thisdir\" = \"x\$file\" && thisdir=.
4440 # Follow symbolic links until we get to the real thisdir.
4441 file=\`ls -ld \"\$file\" | $SED -n 's/.*-> //p'\`
4442 while test -n \"\$file\"; do
4443 destdir=\`\$ECHO \"\$file\" | $SED 's%/[^/]*\$%%'\`
4445 # If there was a directory component, then change thisdir.
4446 if test \"x\$destdir\" != \"x\$file\"; then
4447 case \"\$destdir\" in
4448 [\\\\/]* | [A-Za-z]:[\\\\/]*) thisdir=\"\$destdir\" ;;
4449 *) thisdir=\"\$thisdir/\$destdir\" ;;
4453 file=\`\$ECHO \"\$file\" | $SED 's%^.*/%%'\`
4454 file=\`ls -ld \"\$thisdir/\$file\" | $SED -n 's/.*-> //p'\`
4457 # Usually 'no', except on cygwin/mingw when embedded into
4459 WRAPPER_SCRIPT_BELONGS_IN_OBJDIR=$func_emit_wrapper_arg1
4460 if test \"\$WRAPPER_SCRIPT_BELONGS_IN_OBJDIR\" = \"yes\"; then
4461 # special case for '.'
4462 if test \"\$thisdir\" = \".\"; then
4465 # remove .libs from thisdir
4466 case \"\$thisdir\" in
4467 *[\\\\/]$objdir ) thisdir=\`\$ECHO \"\$thisdir\" | $SED 's%[\\\\/][^\\\\/]*$%%'\` ;;
4468 $objdir ) thisdir=. ;;
4472 # Try to get the absolute directory name.
4473 absdir=\`cd \"\$thisdir\" && pwd\`
4474 test -n \"\$absdir\" && thisdir=\"\$absdir\"
4477 if test "$fast_install" = yes; then
4479 program=lt-'$outputname'$exeext
4480 progdir=\"\$thisdir/$objdir\"
4482 if test ! -f \"\$progdir/\$program\" ||
4483 { file=\`ls -1dt \"\$progdir/\$program\" \"\$progdir/../\$program\" 2>/dev/null | ${SED} 1q\`; \\
4484 test \"X\$file\" != \"X\$progdir/\$program\"; }; then
4486 file=\"\$\$-\$program\"
4488 if test ! -d \"\$progdir\"; then
4489 $MKDIR \"\$progdir\"
4491 $RM \"\$progdir/\$file\"
4496 # relink executable if necessary
4497 if test -n \"\$relink_command\"; then
4498 if relink_command_output=\`eval \$relink_command 2>&1\`; then :
4500 $ECHO \"\$relink_command_output\" >&2
4501 $RM \"\$progdir/\$file\"
4506 $MV \"\$progdir/\$file\" \"\$progdir/\$program\" 2>/dev/null ||
4507 { $RM \"\$progdir/\$program\";
4508 $MV \"\$progdir/\$file\" \"\$progdir/\$program\"; }
4509 $RM \"\$progdir/\$file\"
4513 program='$outputname'
4514 progdir=\"\$thisdir/$objdir\"
4520 if test -f \"\$progdir/\$program\"; then"
4522 # fixup the dll searchpath if we need to.
4524 # Fix the DLL searchpath if we need to. Do this before prepending
4525 # to shlibpath, because on Windows, both are PATH and uninstalled
4526 # libraries must come first.
4527 if test -n "$dllsearchpath"; then
4529 # Add the dll search path components to the executable PATH
4530 PATH=$dllsearchpath:\$PATH
4534 # Export our shlibpath_var if we have one.
4535 if test "$shlibpath_overrides_runpath" = yes && test -n "$shlibpath_var" && test -n "$temp_rpath"; then
4537 # Add our own library path to $shlibpath_var
4538 $shlibpath_var=\"$temp_rpath\$$shlibpath_var\"
4540 # Some systems cannot cope with colon-terminated $shlibpath_var
4541 # The second colon is a workaround for a bug in BeOS R4 sed
4542 $shlibpath_var=\`\$ECHO \"\$$shlibpath_var\" | $SED 's/::*\$//'\`
4544 export $shlibpath_var
4549 if test \"\$libtool_execute_magic\" != \"$magic\"; then
4550 # Run the actual program with our arguments.
4551 func_exec_program \${1+\"\$@\"}
4554 # The program doesn't exist.
4555 \$ECHO \"\$0: error: \\\`\$progdir/\$program' does not exist\" 1>&2
4556 \$ECHO \"This script is just a wrapper for \$program.\" 1>&2
4557 \$ECHO \"See the $PACKAGE documentation for more information.\" 1>&2
4565 # func_emit_cwrapperexe_src
4566 # emit the source code for a wrapper executable on stdout
4567 # Must ONLY be called from within func_mode_link because
4568 # it depends on a number of variable set therein.
4569 func_emit_cwrapperexe_src ()
4573 /* $cwrappersource - temporary wrapper executable for $objdir/$outputname
4574 Generated by $PROGRAM (GNU $PACKAGE$TIMESTAMP) $VERSION
4576 The $output program cannot be directly executed until all the libtool
4577 libraries that it depends on are installed.
4579 This wrapper executable should never be moved out of the build directory.
4580 If it is, it will not operate correctly.
4585 # define _CRT_SECURE_NO_DEPRECATE 1
4590 # include <direct.h>
4591 # include <process.h>
4594 # include <unistd.h>
4595 # include <stdint.h>
4607 #include <sys/stat.h>
4609 /* declarations of non-ANSI functions */
4610 #if defined(__MINGW32__)
4611 # ifdef __STRICT_ANSI__
4612 int _putenv (const char *);
4614 #elif defined(__CYGWIN__)
4615 # ifdef __STRICT_ANSI__
4616 char *realpath (const char *, char *);
4617 int putenv (char *);
4618 int setenv (const char *, const char *, int);
4620 /* #elif defined (other platforms) ... */
4623 /* portability defines, excluding path handling macros */
4624 #if defined(_MSC_VER)
4625 # define setmode _setmode
4627 # define chmod _chmod
4628 # define getcwd _getcwd
4629 # define putenv _putenv
4630 # define S_IXUSR _S_IEXEC
4631 # ifndef _INTPTR_T_DEFINED
4632 # define _INTPTR_T_DEFINED
4633 # define intptr_t int
4635 #elif defined(__MINGW32__)
4636 # define setmode _setmode
4638 # define chmod _chmod
4639 # define getcwd _getcwd
4640 # define putenv _putenv
4641 #elif defined(__CYGWIN__)
4642 # define HAVE_SETENV
4643 # define FOPEN_WB "wb"
4644 /* #elif defined (other platforms) ... */
4647 #if defined(PATH_MAX)
4648 # define LT_PATHMAX PATH_MAX
4649 #elif defined(MAXPATHLEN)
4650 # define LT_PATHMAX MAXPATHLEN
4652 # define LT_PATHMAX 1024
4662 /* path handling portability macros */
4663 #ifndef DIR_SEPARATOR
4664 # define DIR_SEPARATOR '/'
4665 # define PATH_SEPARATOR ':'
4668 #if defined (_WIN32) || defined (__MSDOS__) || defined (__DJGPP__) || \
4670 # define HAVE_DOS_BASED_FILE_SYSTEM
4671 # define FOPEN_WB "wb"
4672 # ifndef DIR_SEPARATOR_2
4673 # define DIR_SEPARATOR_2 '\\'
4675 # ifndef PATH_SEPARATOR_2
4676 # define PATH_SEPARATOR_2 ';'
4680 #ifndef DIR_SEPARATOR_2
4681 # define IS_DIR_SEPARATOR(ch) ((ch) == DIR_SEPARATOR)
4682 #else /* DIR_SEPARATOR_2 */
4683 # define IS_DIR_SEPARATOR(ch) \
4684 (((ch) == DIR_SEPARATOR) || ((ch) == DIR_SEPARATOR_2))
4685 #endif /* DIR_SEPARATOR_2 */
4687 #ifndef PATH_SEPARATOR_2
4688 # define IS_PATH_SEPARATOR(ch) ((ch) == PATH_SEPARATOR)
4689 #else /* PATH_SEPARATOR_2 */
4690 # define IS_PATH_SEPARATOR(ch) ((ch) == PATH_SEPARATOR_2)
4691 #endif /* PATH_SEPARATOR_2 */
4694 # define FOPEN_WB "w"
4697 # define _O_BINARY 0
4700 #define XMALLOC(type, num) ((type *) xmalloc ((num) * sizeof(type)))
4701 #define XFREE(stale) do { \
4702 if (stale) { free ((void *) stale); stale = 0; } \
4705 #if defined(LT_DEBUGWRAPPER)
4706 static int lt_debug = 1;
4708 static int lt_debug = 0;
4711 const char *program_name = "libtool-wrapper"; /* in case xstrdup fails */
4713 void *xmalloc (size_t num);
4714 char *xstrdup (const char *string);
4715 const char *base_name (const char *name);
4716 char *find_executable (const char *wrapper);
4717 char *chase_symlinks (const char *pathspec);
4718 int make_executable (const char *path);
4719 int check_executable (const char *path);
4720 char *strendzap (char *str, const char *pat);
4721 void lt_debugprintf (const char *file, int line, const char *fmt, ...);
4722 void lt_fatal (const char *file, int line, const char *message, ...);
4723 static const char *nonnull (const char *s);
4724 static const char *nonempty (const char *s);
4725 void lt_setenv (const char *name, const char *value);
4726 char *lt_extend_str (const char *orig_value, const char *add, int to_end);
4727 void lt_update_exe_path (const char *name, const char *value);
4728 void lt_update_lib_path (const char *name, const char *value);
4729 char **prepare_spawn (char **argv);
4730 void lt_dump_script (FILE *f);
4734 volatile const char * MAGIC_EXE = "$magic_exe";
4735 const char * LIB_PATH_VARNAME = "$shlibpath_var";
4738 if test "$shlibpath_overrides_runpath" = yes && test -n "$shlibpath_var" && test -n "$temp_rpath"; then
4739 func_to_host_path "$temp_rpath"
4741 const char * LIB_PATH_VALUE = "$func_to_host_path_result";
4745 const char * LIB_PATH_VALUE = "";
4749 if test -n "$dllsearchpath"; then
4750 func_to_host_path "$dllsearchpath:"
4752 const char * EXE_PATH_VARNAME = "PATH";
4753 const char * EXE_PATH_VALUE = "$func_to_host_path_result";
4757 const char * EXE_PATH_VARNAME = "";
4758 const char * EXE_PATH_VALUE = "";
4762 if test "$fast_install" = yes; then
4764 const char * TARGET_PROGRAM_NAME = "lt-$outputname"; /* hopefully, no .exe */
4768 const char * TARGET_PROGRAM_NAME = "$outputname"; /* hopefully, no .exe */
4775 #define LTWRAPPER_OPTION_PREFIX "--lt-"
4777 static const char *ltwrapper_option_prefix = LTWRAPPER_OPTION_PREFIX;
4778 static const char *dumpscript_opt = LTWRAPPER_OPTION_PREFIX "dump-script";
4779 static const char *debug_opt = LTWRAPPER_OPTION_PREFIX "debug";
4782 main (int argc, char *argv[])
4787 char *actual_cwrapper_path;
4788 char *actual_cwrapper_name;
4791 intptr_t rval = 127;
4795 program_name = (char *) xstrdup (base_name (argv[0]));
4796 newargz = XMALLOC (char *, argc + 1);
4798 /* very simple arg parsing; don't want to rely on getopt
4799 * also, copy all non cwrapper options to newargz, except
4800 * argz[0], which is handled differently
4803 for (i = 1; i < argc; i++)
4805 if (strcmp (argv[i], dumpscript_opt) == 0)
4809 *mingw* | *cygwin* )
4810 # make stdout use "unix" line endings
4811 echo " setmode(1,_O_BINARY);"
4816 lt_dump_script (stdout);
4819 if (strcmp (argv[i], debug_opt) == 0)
4824 if (strcmp (argv[i], ltwrapper_option_prefix) == 0)
4826 /* however, if there is an option in the LTWRAPPER_OPTION_PREFIX
4827 namespace, but it is not one of the ones we know about and
4828 have already dealt with, above (inluding dump-script), then
4829 report an error. Otherwise, targets might begin to believe
4830 they are allowed to use options in the LTWRAPPER_OPTION_PREFIX
4831 namespace. The first time any user complains about this, we'll
4832 need to make LTWRAPPER_OPTION_PREFIX a configure-time option
4833 or a configure.ac-settable value.
4835 lt_fatal (__FILE__, __LINE__,
4836 "unrecognized %s option: '%s'",
4837 ltwrapper_option_prefix, argv[i]);
4840 newargz[++newargc] = xstrdup (argv[i]);
4842 newargz[++newargc] = NULL;
4846 /* The GNU banner must be the first non-error debug message */
4847 lt_debugprintf (__FILE__, __LINE__, "libtool wrapper (GNU $PACKAGE$TIMESTAMP) $VERSION\n");
4850 lt_debugprintf (__FILE__, __LINE__, "(main) argv[0]: %s\n", argv[0]);
4851 lt_debugprintf (__FILE__, __LINE__, "(main) program_name: %s\n", program_name);
4853 tmp_pathspec = find_executable (argv[0]);
4854 if (tmp_pathspec == NULL)
4855 lt_fatal (__FILE__, __LINE__, "couldn't find %s", argv[0]);
4856 lt_debugprintf (__FILE__, __LINE__,
4857 "(main) found exe (before symlink chase) at: %s\n",
4860 actual_cwrapper_path = chase_symlinks (tmp_pathspec);
4861 lt_debugprintf (__FILE__, __LINE__,
4862 "(main) found exe (after symlink chase) at: %s\n",
4863 actual_cwrapper_path);
4864 XFREE (tmp_pathspec);
4866 actual_cwrapper_name = xstrdup (base_name (actual_cwrapper_path));
4867 strendzap (actual_cwrapper_path, actual_cwrapper_name);
4869 /* wrapper name transforms */
4870 strendzap (actual_cwrapper_name, ".exe");
4871 tmp_pathspec = lt_extend_str (actual_cwrapper_name, ".exe", 1);
4872 XFREE (actual_cwrapper_name);
4873 actual_cwrapper_name = tmp_pathspec;
4876 /* target_name transforms -- use actual target program name; might have lt- prefix */
4877 target_name = xstrdup (base_name (TARGET_PROGRAM_NAME));
4878 strendzap (target_name, ".exe");
4879 tmp_pathspec = lt_extend_str (target_name, ".exe", 1);
4880 XFREE (target_name);
4881 target_name = tmp_pathspec;
4884 lt_debugprintf (__FILE__, __LINE__,
4885 "(main) libtool target name: %s\n",
4891 XMALLOC (char, (strlen (actual_cwrapper_path) +
4892 strlen ("$objdir") + 1 + strlen (actual_cwrapper_name) + 1));
4893 strcpy (newargz[0], actual_cwrapper_path);
4894 strcat (newargz[0], "$objdir");
4895 strcat (newargz[0], "/");
4899 /* stop here, and copy so we don't have to do this twice */
4900 tmp_pathspec = xstrdup (newargz[0]);
4902 /* do NOT want the lt- prefix here, so use actual_cwrapper_name */
4903 strcat (newargz[0], actual_cwrapper_name);
4905 /* DO want the lt- prefix here if it exists, so use target_name */
4906 lt_argv_zero = lt_extend_str (tmp_pathspec, target_name, 1);
4907 XFREE (tmp_pathspec);
4908 tmp_pathspec = NULL;
4916 while ((p = strchr (newargz[0], '\\')) != NULL)
4920 while ((p = strchr (lt_argv_zero, '\\')) != NULL)
4930 XFREE (target_name);
4931 XFREE (actual_cwrapper_path);
4932 XFREE (actual_cwrapper_name);
4934 lt_setenv ("BIN_SH", "xpg4"); /* for Tru64 */
4935 lt_setenv ("DUALCASE", "1"); /* for MSK sh */
4936 /* Update the DLL searchpath. EXE_PATH_VALUE ($dllsearchpath) must
4937 be prepended before (that is, appear after) LIB_PATH_VALUE ($temp_rpath)
4938 because on Windows, both *_VARNAMEs are PATH but uninstalled
4939 libraries must come first. */
4940 lt_update_exe_path (EXE_PATH_VARNAME, EXE_PATH_VALUE);
4941 lt_update_lib_path (LIB_PATH_VARNAME, LIB_PATH_VALUE);
4943 lt_debugprintf (__FILE__, __LINE__, "(main) lt_argv_zero: %s\n",
4944 nonnull (lt_argv_zero));
4945 for (i = 0; i < newargc; i++)
4947 lt_debugprintf (__FILE__, __LINE__, "(main) newargz[%d]: %s\n",
4948 i, nonnull (newargz[i]));
4956 /* execv doesn't actually work on mingw as expected on unix */
4957 newargz = prepare_spawn (newargz);
4958 rval = _spawnv (_P_WAIT, lt_argv_zero, (const char * const *) newargz);
4961 /* failed to start process */
4962 lt_debugprintf (__FILE__, __LINE__,
4963 "(main) failed to launch target \"%s\": %s\n",
4964 lt_argv_zero, nonnull (strerror (errno)));
4972 execv (lt_argv_zero, newargz);
4973 return rval; /* =127, but avoids unused variable warning */
4982 xmalloc (size_t num)
4984 void *p = (void *) malloc (num);
4986 lt_fatal (__FILE__, __LINE__, "memory exhausted");
4992 xstrdup (const char *string)
4994 return string ? strcpy ((char *) xmalloc (strlen (string) + 1),
4999 base_name (const char *name)
5003 #if defined (HAVE_DOS_BASED_FILE_SYSTEM)
5004 /* Skip over the disk name in MSDOS pathnames. */
5005 if (isalpha ((unsigned char) name[0]) && name[1] == ':')
5009 for (base = name; *name; name++)
5010 if (IS_DIR_SEPARATOR (*name))
5016 check_executable (const char *path)
5020 lt_debugprintf (__FILE__, __LINE__, "(check_executable): %s\n",
5022 if ((!path) || (!*path))
5025 if ((stat (path, &st) >= 0)
5026 && (st.st_mode & (S_IXUSR | S_IXGRP | S_IXOTH)))
5033 make_executable (const char *path)
5038 lt_debugprintf (__FILE__, __LINE__, "(make_executable): %s\n",
5040 if ((!path) || (!*path))
5043 if (stat (path, &st) >= 0)
5045 rval = chmod (path, st.st_mode | S_IXOTH | S_IXGRP | S_IXUSR);
5050 /* Searches for the full path of the wrapper. Returns
5051 newly allocated full path name if found, NULL otherwise
5052 Does not chase symlinks, even on platforms that support them.
5055 find_executable (const char *wrapper)
5060 /* static buffer for getcwd */
5061 char tmp[LT_PATHMAX + 1];
5065 lt_debugprintf (__FILE__, __LINE__, "(find_executable): %s\n",
5066 nonempty (wrapper));
5068 if ((wrapper == NULL) || (*wrapper == '\0'))
5071 /* Absolute path? */
5072 #if defined (HAVE_DOS_BASED_FILE_SYSTEM)
5073 if (isalpha ((unsigned char) wrapper[0]) && wrapper[1] == ':')
5075 concat_name = xstrdup (wrapper);
5076 if (check_executable (concat_name))
5078 XFREE (concat_name);
5083 if (IS_DIR_SEPARATOR (wrapper[0]))
5085 concat_name = xstrdup (wrapper);
5086 if (check_executable (concat_name))
5088 XFREE (concat_name);
5090 #if defined (HAVE_DOS_BASED_FILE_SYSTEM)
5094 for (p = wrapper; *p; p++)
5102 /* no slashes; search PATH */
5103 const char *path = getenv ("PATH");
5106 for (p = path; *p; p = p_next)
5110 for (q = p; *q; q++)
5111 if (IS_PATH_SEPARATOR (*q))
5114 p_next = (*q == '\0' ? q : q + 1);
5117 /* empty path: current directory */
5118 if (getcwd (tmp, LT_PATHMAX) == NULL)
5119 lt_fatal (__FILE__, __LINE__, "getcwd failed: %s",
5120 nonnull (strerror (errno)));
5121 tmp_len = strlen (tmp);
5123 XMALLOC (char, tmp_len + 1 + strlen (wrapper) + 1);
5124 memcpy (concat_name, tmp, tmp_len);
5125 concat_name[tmp_len] = '/';
5126 strcpy (concat_name + tmp_len + 1, wrapper);
5131 XMALLOC (char, p_len + 1 + strlen (wrapper) + 1);
5132 memcpy (concat_name, p, p_len);
5133 concat_name[p_len] = '/';
5134 strcpy (concat_name + p_len + 1, wrapper);
5136 if (check_executable (concat_name))
5138 XFREE (concat_name);
5141 /* not found in PATH; assume curdir */
5143 /* Relative path | not found in path: prepend cwd */
5144 if (getcwd (tmp, LT_PATHMAX) == NULL)
5145 lt_fatal (__FILE__, __LINE__, "getcwd failed: %s",
5146 nonnull (strerror (errno)));
5147 tmp_len = strlen (tmp);
5148 concat_name = XMALLOC (char, tmp_len + 1 + strlen (wrapper) + 1);
5149 memcpy (concat_name, tmp, tmp_len);
5150 concat_name[tmp_len] = '/';
5151 strcpy (concat_name + tmp_len + 1, wrapper);
5153 if (check_executable (concat_name))
5155 XFREE (concat_name);
5160 chase_symlinks (const char *pathspec)
5163 return xstrdup (pathspec);
5165 char buf[LT_PATHMAX];
5167 char *tmp_pathspec = xstrdup (pathspec);
5169 int has_symlinks = 0;
5170 while (strlen (tmp_pathspec) && !has_symlinks)
5172 lt_debugprintf (__FILE__, __LINE__,
5173 "checking path component for symlinks: %s\n",
5175 if (lstat (tmp_pathspec, &s) == 0)
5177 if (S_ISLNK (s.st_mode) != 0)
5183 /* search backwards for last DIR_SEPARATOR */
5184 p = tmp_pathspec + strlen (tmp_pathspec) - 1;
5185 while ((p > tmp_pathspec) && (!IS_DIR_SEPARATOR (*p)))
5187 if ((p == tmp_pathspec) && (!IS_DIR_SEPARATOR (*p)))
5189 /* no more DIR_SEPARATORS left */
5196 lt_fatal (__FILE__, __LINE__,
5197 "error accessing file \"%s\": %s",
5198 tmp_pathspec, nonnull (strerror (errno)));
5201 XFREE (tmp_pathspec);
5205 return xstrdup (pathspec);
5208 tmp_pathspec = realpath (pathspec, buf);
5209 if (tmp_pathspec == 0)
5211 lt_fatal (__FILE__, __LINE__,
5212 "could not follow symlinks for %s", pathspec);
5214 return xstrdup (tmp_pathspec);
5219 strendzap (char *str, const char *pat)
5223 assert (str != NULL);
5224 assert (pat != NULL);
5227 patlen = strlen (pat);
5231 str += len - patlen;
5232 if (strcmp (str, pat) == 0)
5239 lt_debugprintf (const char *file, int line, const char *fmt, ...)
5244 (void) fprintf (stderr, "%s:%s:%d: ", program_name, file, line);
5245 va_start (args, fmt);
5246 (void) vfprintf (stderr, fmt, args);
5252 lt_error_core (int exit_status, const char *file,
5253 int line, const char *mode,
5254 const char *message, va_list ap)
5256 fprintf (stderr, "%s:%s:%d: %s: ", program_name, file, line, mode);
5257 vfprintf (stderr, message, ap);
5258 fprintf (stderr, ".\n");
5260 if (exit_status >= 0)
5265 lt_fatal (const char *file, int line, const char *message, ...)
5268 va_start (ap, message);
5269 lt_error_core (EXIT_FAILURE, file, line, "FATAL", message, ap);
5274 nonnull (const char *s)
5276 return s ? s : "(null)";
5280 nonempty (const char *s)
5282 return (s && !*s) ? "(empty)" : nonnull (s);
5286 lt_setenv (const char *name, const char *value)
5288 lt_debugprintf (__FILE__, __LINE__,
5289 "(lt_setenv) setting '%s' to '%s'\n",
5290 nonnull (name), nonnull (value));
5293 /* always make a copy, for consistency with !HAVE_SETENV */
5294 char *str = xstrdup (value);
5295 setenv (name, str, 1);
5297 int len = strlen (name) + 1 + strlen (value) + 1;
5298 char *str = XMALLOC (char, len);
5299 sprintf (str, "%s=%s", name, value);
5300 if (putenv (str) != EXIT_SUCCESS)
5309 lt_extend_str (const char *orig_value, const char *add, int to_end)
5312 if (orig_value && *orig_value)
5314 int orig_value_len = strlen (orig_value);
5315 int add_len = strlen (add);
5316 new_value = XMALLOC (char, add_len + orig_value_len + 1);
5319 strcpy (new_value, orig_value);
5320 strcpy (new_value + orig_value_len, add);
5324 strcpy (new_value, add);
5325 strcpy (new_value + add_len, orig_value);
5330 new_value = xstrdup (add);
5336 lt_update_exe_path (const char *name, const char *value)
5338 lt_debugprintf (__FILE__, __LINE__,
5339 "(lt_update_exe_path) modifying '%s' by prepending '%s'\n",
5340 nonnull (name), nonnull (value));
5342 if (name && *name && value && *value)
5344 char *new_value = lt_extend_str (getenv (name), value, 0);
5345 /* some systems can't cope with a ':'-terminated path #' */
5346 int len = strlen (new_value);
5347 while (((len = strlen (new_value)) > 0) && IS_PATH_SEPARATOR (new_value[len-1]))
5349 new_value[len-1] = '\0';
5351 lt_setenv (name, new_value);
5357 lt_update_lib_path (const char *name, const char *value)
5359 lt_debugprintf (__FILE__, __LINE__,
5360 "(lt_update_lib_path) modifying '%s' by prepending '%s'\n",
5361 nonnull (name), nonnull (value));
5363 if (name && *name && value && *value)
5365 char *new_value = lt_extend_str (getenv (name), value, 0);
5366 lt_setenv (name, new_value);
5376 /* Prepares an argument vector before calling spawn().
5377 Note that spawn() does not by itself call the command interpreter
5378 (getenv ("COMSPEC") != NULL ? getenv ("COMSPEC") :
5379 ({ OSVERSIONINFO v; v.dwOSVersionInfoSize = sizeof(OSVERSIONINFO);
5381 v.dwPlatformId == VER_PLATFORM_WIN32_NT;
5382 }) ? "cmd.exe" : "command.com").
5383 Instead it simply concatenates the arguments, separated by ' ', and calls
5384 CreateProcess(). We must quote the arguments since Win32 CreateProcess()
5385 interprets characters like ' ', '\t', '\\', '"' (but not '<' and '>') in a
5387 - Space and tab are interpreted as delimiters. They are not treated as
5388 delimiters if they are surrounded by double quotes: "...".
5389 - Unescaped double quotes are removed from the input. Their only effect is
5390 that within double quotes, space and tab are treated like normal
5392 - Backslashes not followed by double quotes are not special.
5393 - But 2*n+1 backslashes followed by a double quote become
5394 n backslashes followed by a double quote (n >= 0):
5399 #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"
5400 #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"
5402 prepare_spawn (char **argv)
5408 /* Count number of arguments. */
5409 for (argc = 0; argv[argc] != NULL; argc++)
5412 /* Allocate new argument vector. */
5413 new_argv = XMALLOC (char *, argc + 1);
5415 /* Put quoted arguments into the new argument vector. */
5416 for (i = 0; i < argc; i++)
5418 const char *string = argv[i];
5420 if (string[0] == '\0')
5421 new_argv[i] = xstrdup ("\"\"");
5422 else if (strpbrk (string, SHELL_SPECIAL_CHARS) != NULL)
5424 int quote_around = (strpbrk (string, SHELL_SPACE_CHARS) != NULL);
5426 unsigned int backslashes;
5428 char *quoted_string;
5435 for (s = string; *s != '\0'; s++)
5439 length += backslashes + 1;
5447 length += backslashes + 1;
5449 quoted_string = XMALLOC (char, length + 1);
5455 for (s = string; *s != '\0'; s++)
5461 for (j = backslashes + 1; j > 0; j--)
5473 for (j = backslashes; j > 0; j--)
5479 new_argv[i] = quoted_string;
5482 new_argv[i] = (char *) string;
5484 new_argv[argc] = NULL;
5493 void lt_dump_script (FILE* f)
5496 func_emit_wrapper yes |
5497 $SED -e 's/\([\\"]\)/\\\1/g' \
5498 -e 's/^/ fputs ("/' -e 's/$/\\n", f);/'
5504 # end: func_emit_cwrapperexe_src
5506 # func_win32_import_lib_p ARG
5507 # True if ARG is an import lib, as indicated by $file_magic_cmd
5508 func_win32_import_lib_p ()
5511 case `eval $file_magic_cmd \"\$1\" 2>/dev/null | $SED -e 10q` in
5517 # func_mode_link arg...
5522 *-*-cygwin* | *-*-mingw* | *-*-pw32* | *-*-os2* | *-cegcc*)
5523 # It is impossible to link a dll without this setting, and
5524 # we shouldn't force the makefile maintainer to figure out
5525 # which system we are compiling for in order to pass an extra
5526 # flag for every libtool invocation.
5527 # allow_undefined=no
5529 # FIXME: Unfortunately, there are problems with the above when trying
5530 # to make a dll which has undefined symbols, in which case not
5531 # even a static library is built. For now, we need to specify
5532 # -no-undefined on the libtool link line when we can be certain
5533 # that all symbols are satisfied, otherwise we get a static library.
5540 libtool_args=$nonopt
5541 base_compile="$nonopt $@"
5542 compile_command=$nonopt
5543 finalize_command=$nonopt
5556 lib_search_path=`pwd`
5558 new_inherited_linker_flags=
5567 export_symbols_regex=
5575 precious_files_regex=
5576 prefer_static_libs=no
5589 single_module="${wl}-single_module"
5590 func_infer_tag $base_compile
5592 # We need to know -static, to get the right output filenames.
5597 test "$build_libtool_libs" != yes && \
5598 func_fatal_configuration "can not build a shared library"
5602 -all-static | -static | -static-libtool-libs)
5605 if test "$build_libtool_libs" = yes && test -z "$link_static_flag"; then
5606 func_warning "complete static linking is impossible in this configuration"
5608 if test -n "$link_static_flag"; then
5609 dlopen_self=$dlopen_self_static
5611 prefer_static_libs=yes
5614 if test -z "$pic_flag" && test -n "$link_static_flag"; then
5615 dlopen_self=$dlopen_self_static
5617 prefer_static_libs=built
5619 -static-libtool-libs)
5620 if test -z "$pic_flag" && test -n "$link_static_flag"; then
5621 dlopen_self=$dlopen_self_static
5623 prefer_static_libs=yes
5626 build_libtool_libs=no
5633 # See if our shared archives depend on static archives.
5634 test -n "$old_archive_from_new_cmds" && build_old_libs=yes
5636 # Go through the arguments, transforming them on the way.
5637 while test "$#" -gt 0; do
5640 func_quote_for_eval "$arg"
5641 qarg=$func_quote_for_eval_unquoted_result
5642 libtool_args+=" $func_quote_for_eval_result"
5644 # If the previous option needs an argument, assign it.
5645 if test -n "$prev"; then
5648 compile_command+=" @OUTPUT@"
5649 finalize_command+=" @OUTPUT@"
5660 if test "$preload" = no; then
5661 # Add the symbol object into the linking commands.
5662 compile_command+=" @SYMFILE@"
5663 finalize_command+=" @SYMFILE@"
5667 *.la | *.lo) ;; # We handle these cases below.
5669 if test "$dlself" = no; then
5677 if test "$prev" = dlprefiles; then
5679 elif test "$prev" = dlfiles && test "$dlopen_self" != yes; then
5689 if test "$prev" = dlfiles; then
5700 export_symbols="$arg"
5702 || func_fatal_error "symbol file \`$arg' does not exist"
5707 export_symbols_regex="$arg"
5715 *" $qarg.ltframework "*) ;;
5716 *) deplibs+=" $qarg.ltframework" # this is fixed later
5725 inst_prefix_dir="$arg"
5730 if test -f "$arg"; then
5733 for fil in `cat "$save_arg"`
5737 # A libtool-controlled object.
5739 # Check to see that this really is a libtool object.
5740 if func_lalib_unsafe_p "$arg"; then
5747 if test -z "$pic_object" ||
5748 test -z "$non_pic_object" ||
5749 test "$pic_object" = none &&
5750 test "$non_pic_object" = none; then
5751 func_fatal_error "cannot find name of object for \`$arg'"
5754 # Extract subdirectory from the argument.
5755 func_dirname "$arg" "/" ""
5756 xdir="$func_dirname_result"
5758 if test "$pic_object" != none; then
5759 # Prepend the subdirectory the object is found in.
5760 pic_object="$xdir$pic_object"
5762 if test "$prev" = dlfiles; then
5763 if test "$build_libtool_libs" = yes && test "$dlopen_support" = yes; then
5764 dlfiles+=" $pic_object"
5768 # If libtool objects are unsupported, then we need to preload.
5773 # CHECK ME: I think I busted this. -Ossama
5774 if test "$prev" = dlprefiles; then
5775 # Preload the old-style object.
5776 dlprefiles+=" $pic_object"
5781 libobjs+=" $pic_object"
5786 if test "$non_pic_object" != none; then
5787 # Prepend the subdirectory the object is found in.
5788 non_pic_object="$xdir$non_pic_object"
5790 # A standard non-PIC object
5791 non_pic_objects+=" $non_pic_object"
5792 if test -z "$pic_object" || test "$pic_object" = none ; then
5793 arg="$non_pic_object"
5796 # If the PIC object exists, use it instead.
5797 # $xdir was prepended to $pic_object above.
5798 non_pic_object="$pic_object"
5799 non_pic_objects+=" $non_pic_object"
5802 # Only an error if not doing a dry-run.
5803 if $opt_dry_run; then
5804 # Extract subdirectory from the argument.
5805 func_dirname "$arg" "/" ""
5806 xdir="$func_dirname_result"
5809 pic_object=$xdir$objdir/$func_lo2o_result
5810 non_pic_object=$xdir$func_lo2o_result
5811 libobjs+=" $pic_object"
5812 non_pic_objects+=" $non_pic_object"
5814 func_fatal_error "\`$arg' is not a valid libtool object"
5819 func_fatal_error "link input file \`$arg' does not exist"
5826 precious_files_regex="$arg"
5836 # We need an absolute path.
5838 [\\/]* | [A-Za-z]:[\\/]*) ;;
5840 func_fatal_error "only absolute run-paths are allowed"
5843 if test "$prev" = rpath; then
5846 *) rpath+=" $arg" ;;
5851 *) xrpath+=" $arg" ;;
5868 linker_flags+=" $qarg"
5869 compiler_flags+=" $qarg"
5871 compile_command+=" $qarg"
5872 finalize_command+=" $qarg"
5876 compiler_flags+=" $qarg"
5878 compile_command+=" $qarg"
5879 finalize_command+=" $qarg"
5883 linker_flags+=" $qarg"
5884 compiler_flags+=" $wl$qarg"
5886 compile_command+=" $wl$qarg"
5887 finalize_command+=" $wl$qarg"
5891 eval "$prev=\"\$arg\""
5896 fi # test -n "$prev"
5902 if test -n "$link_static_flag"; then
5903 # See comment for -static flag below, for more details.
5904 compile_command+=" $link_static_flag"
5905 finalize_command+=" $link_static_flag"
5911 # FIXME: remove this flag sometime in the future.
5912 func_fatal_error "\`-allow-undefined' must not be used because it is the default"
5940 -export-symbols | -export-symbols-regex)
5941 if test -n "$export_symbols" || test -n "$export_symbols_regex"; then
5942 func_fatal_error "more than one -exported-symbols argument is not allowed"
5944 if test "X$arg" = "X-export-symbols"; then
5962 # The native IRIX linker understands -LANG:*, -LIST:* and -LNO:*
5963 # so, if we see these flags be careful not to treat them like -L
5965 case $with_gcc/$host in
5966 no/*-*-irix* | /*-*-irix*)
5967 compile_command+=" $arg"
5968 finalize_command+=" $arg"
5975 func_stripname "-L" '' "$arg"
5976 if test -z "$func_stripname_result"; then
5977 if test "$#" -gt 0; then
5978 func_fatal_error "require no space between \`-L' and \`$1'"
5980 func_fatal_error "need path for \`-L' option"
5983 func_resolve_sysroot "$func_stripname_result"
5984 dir=$func_resolve_sysroot_result
5985 # We need an absolute path.
5987 [\\/]* | [A-Za-z]:[\\/]*) ;;
5989 absdir=`cd "$dir" && pwd`
5990 test -z "$absdir" && \
5991 func_fatal_error "cannot determine absolute directory name of \`$dir'"
5996 *" -L$dir "* | *" $arg "*)
5997 # Will only happen for absolute or sysroot arguments
6000 # Preserve sysroot, but never include relative directories
6002 [\\/]* | [A-Za-z]:[\\/]* | =*) deplibs+=" $arg" ;;
6003 *) deplibs+=" -L$dir" ;;
6005 lib_search_path+=" $dir"
6009 *-*-cygwin* | *-*-mingw* | *-*-pw32* | *-*-os2* | *-cegcc*)
6010 testbindir=`$ECHO "$dir" | $SED 's*/lib$*/bin*'`
6011 case :$dllsearchpath: in
6013 ::) dllsearchpath=$dir;;
6014 *) dllsearchpath+=":$dir";;
6016 case :$dllsearchpath: in
6017 *":$testbindir:"*) ;;
6018 ::) dllsearchpath=$testbindir;;
6019 *) dllsearchpath+=":$testbindir";;
6027 if test "X$arg" = "X-lc" || test "X$arg" = "X-lm"; then
6029 *-*-cygwin* | *-*-mingw* | *-*-pw32* | *-*-beos* | *-cegcc* | *-*-haiku*)
6030 # These systems don't actually have a C or math library (as such)
6034 # These systems don't actually have a C library (as such)
6035 test "X$arg" = "X-lc" && continue
6037 *-*-openbsd* | *-*-freebsd* | *-*-dragonfly*)
6038 # Do not include libc due to us having libc/libc_r.
6039 test "X$arg" = "X-lc" && continue
6041 *-*-rhapsody* | *-*-darwin1.[012])
6042 # Rhapsody C and math libraries are in the System framework
6043 deplibs+=" System.ltframework"
6046 *-*-sco3.2v5* | *-*-sco5v6*)
6047 # Causes problems with __ctype
6048 test "X$arg" = "X-lc" && continue
6050 *-*-sysv4.2uw2* | *-*-sysv5* | *-*-unixware* | *-*-OpenUNIX*)
6051 # Compiler inserts libc in the correct place for threads to work
6052 test "X$arg" = "X-lc" && continue
6055 elif test "X$arg" = "X-lc_r"; then
6057 *-*-openbsd* | *-*-freebsd* | *-*-dragonfly*)
6058 # Do not include libc_r directly, use -pthread flag.
6072 # Tru64 UNIX uses -model [arg] to determine the layout of C++
6073 # classes, name mangling, and exception handling.
6074 # Darwin uses the -arch flag to determine output architecture.
6075 -model|-arch|-isysroot|--sysroot)
6076 compiler_flags+=" $arg"
6077 compile_command+=" $arg"
6078 finalize_command+=" $arg"
6083 -mt|-mthreads|-kthread|-Kthread|-pthread|-pthreads|--thread-safe|-threads)
6084 compiler_flags+=" $arg"
6085 compile_command+=" $arg"
6086 finalize_command+=" $arg"
6087 case "$new_inherited_linker_flags " in
6089 * ) new_inherited_linker_flags+=" $arg" ;;
6095 single_module="${wl}-multi_module"
6106 *-*-cygwin* | *-*-mingw* | *-*-pw32* | *-*-os2* | *-*-darwin* | *-cegcc*)
6107 # The PATH hackery in wrapper scripts is required on Windows
6108 # and Darwin in order for the loader to find any dlls it needs.
6109 func_warning "\`-no-install' is ignored for $host"
6110 func_warning "assuming \`-no-fast-install' instead"
6113 *) no_install=yes ;;
6130 -precious-files-regex)
6151 func_stripname '-R' '' "$arg"
6152 dir=$func_stripname_result
6153 # We need an absolute path.
6155 [\\/]* | [A-Za-z]:[\\/]*) ;;
6157 func_stripname '=' '' "$dir"
6158 dir=$lt_sysroot$func_stripname_result
6161 func_fatal_error "only absolute run-paths are allowed"
6166 *) xrpath+=" $dir" ;;
6172 # The effects of -shared are defined in a previous loop.
6181 -static | -static-libtool-libs)
6182 # The effects of -static are defined in a previous loop.
6183 # We used to do the same as -all-static on platforms that
6184 # didn't have a PIC flag, but the assumption that the effects
6185 # would be equivalent was wrong. It would break on at least
6186 # Digital Unix and AIX.
6212 func_stripname '-Wc,' '' "$arg"
6213 args=$func_stripname_result
6215 save_ifs="$IFS"; IFS=','
6216 for flag in $args; do
6218 func_quote_for_eval "$flag"
6219 arg+=" $func_quote_for_eval_result"
6220 compiler_flags+=" $func_quote_for_eval_result"
6223 func_stripname ' ' '' "$arg"
6224 arg=$func_stripname_result
6228 func_stripname '-Wl,' '' "$arg"
6229 args=$func_stripname_result
6231 save_ifs="$IFS"; IFS=','
6232 for flag in $args; do
6234 func_quote_for_eval "$flag"
6235 arg+=" $wl$func_quote_for_eval_result"
6236 compiler_flags+=" $wl$func_quote_for_eval_result"
6237 linker_flags+=" $func_quote_for_eval_result"
6240 func_stripname ' ' '' "$arg"
6241 arg=$func_stripname_result
6261 func_quote_for_eval "$arg"
6262 arg="$func_quote_for_eval_result"
6265 # Flags to be passed through unchanged, with rationale:
6266 # -64, -mips[0-9] enable 64-bit mode for the SGI compiler
6267 # -r[0-9][0-9]* specify processor for the SGI compiler
6268 # -xarch=*, -xtarget=* enable 64-bit mode for the Sun compiler
6269 # +DA*, +DD* enable 64-bit mode for the HP compiler
6270 # -q* compiler args for the IBM compiler
6271 # -m*, -t[45]*, -txscale* architecture-specific flags for GCC
6272 # -F/path path to uninstalled frameworks, gcc on darwin
6273 # -p, -pg, --coverage, -fprofile-* profiling flags for GCC
6274 # @file GCC response files
6275 # -tp=* Portland pgcc target processor selection
6276 # --sysroot=* for sysroot support
6277 # -O*, -flto*, -fwhopr*, -fuse-linker-plugin GCC link-time optimization
6278 -64|-mips[0-9]|-r[0-9][0-9]*|-xarch=*|-xtarget=*|+DA*|+DD*|-q*|-m*| \
6279 -t[45]*|-txscale*|-p|-pg|--coverage|-fprofile-*|-F*|@*|-tp=*|--sysroot=*| \
6280 -O*|-flto*|-fwhopr*|-fuse-linker-plugin)
6281 func_quote_for_eval "$arg"
6282 arg="$func_quote_for_eval_result"
6283 compile_command+=" $arg"
6284 finalize_command+=" $arg"
6285 compiler_flags+=" $arg"
6289 # Some other compiler flag.
6291 func_quote_for_eval "$arg"
6292 arg="$func_quote_for_eval_result"
6296 # A standard object.
6301 # A libtool-controlled object.
6303 # Check to see that this really is a libtool object.
6304 if func_lalib_unsafe_p "$arg"; then
6311 if test -z "$pic_object" ||
6312 test -z "$non_pic_object" ||
6313 test "$pic_object" = none &&
6314 test "$non_pic_object" = none; then
6315 func_fatal_error "cannot find name of object for \`$arg'"
6318 # Extract subdirectory from the argument.
6319 func_dirname "$arg" "/" ""
6320 xdir="$func_dirname_result"
6322 if test "$pic_object" != none; then
6323 # Prepend the subdirectory the object is found in.
6324 pic_object="$xdir$pic_object"
6326 if test "$prev" = dlfiles; then
6327 if test "$build_libtool_libs" = yes && test "$dlopen_support" = yes; then
6328 dlfiles+=" $pic_object"
6332 # If libtool objects are unsupported, then we need to preload.
6337 # CHECK ME: I think I busted this. -Ossama
6338 if test "$prev" = dlprefiles; then
6339 # Preload the old-style object.
6340 dlprefiles+=" $pic_object"
6345 libobjs+=" $pic_object"
6350 if test "$non_pic_object" != none; then
6351 # Prepend the subdirectory the object is found in.
6352 non_pic_object="$xdir$non_pic_object"
6354 # A standard non-PIC object
6355 non_pic_objects+=" $non_pic_object"
6356 if test -z "$pic_object" || test "$pic_object" = none ; then
6357 arg="$non_pic_object"
6360 # If the PIC object exists, use it instead.
6361 # $xdir was prepended to $pic_object above.
6362 non_pic_object="$pic_object"
6363 non_pic_objects+=" $non_pic_object"
6366 # Only an error if not doing a dry-run.
6367 if $opt_dry_run; then
6368 # Extract subdirectory from the argument.
6369 func_dirname "$arg" "/" ""
6370 xdir="$func_dirname_result"
6373 pic_object=$xdir$objdir/$func_lo2o_result
6374 non_pic_object=$xdir$func_lo2o_result
6375 libobjs+=" $pic_object"
6376 non_pic_objects+=" $non_pic_object"
6378 func_fatal_error "\`$arg' is not a valid libtool object"
6386 old_deplibs+=" $arg"
6391 # A libtool-controlled library.
6393 func_resolve_sysroot "$arg"
6394 if test "$prev" = dlfiles; then
6395 # This library was specified with -dlopen.
6396 dlfiles+=" $func_resolve_sysroot_result"
6398 elif test "$prev" = dlprefiles; then
6399 # The library was specified with -dlpreopen.
6400 dlprefiles+=" $func_resolve_sysroot_result"
6403 deplibs+=" $func_resolve_sysroot_result"
6408 # Some other compiler argument.
6410 # Unknown arguments in both finalize_command and compile_command need
6411 # to be aesthetically quoted because they are evaled later.
6412 func_quote_for_eval "$arg"
6413 arg="$func_quote_for_eval_result"
6417 # Now actually substitute the argument into the commands.
6418 if test -n "$arg"; then
6419 compile_command+=" $arg"
6420 finalize_command+=" $arg"
6422 done # argument parsing loop
6424 test -n "$prev" && \
6425 func_fatal_help "the \`$prevarg' option requires an argument"
6427 if test "$export_dynamic" = yes && test -n "$export_dynamic_flag_spec"; then
6428 eval arg=\"$export_dynamic_flag_spec\"
6429 compile_command+=" $arg"
6430 finalize_command+=" $arg"
6434 # calculate the name of the file, without its directory
6435 func_basename "$output"
6436 outputname="$func_basename_result"
6437 libobjs_save="$libobjs"
6439 if test -n "$shlibpath_var"; then
6440 # get the directories listed in $shlibpath_var
6441 eval shlib_search_path=\`\$ECHO \"\${$shlibpath_var}\" \| \$SED \'s/:/ /g\'\`
6445 eval sys_lib_search_path=\"$sys_lib_search_path_spec\"
6446 eval sys_lib_dlsearch_path=\"$sys_lib_dlsearch_path_spec\"
6448 func_dirname "$output" "/" ""
6449 output_objdir="$func_dirname_result$objdir"
6450 func_to_tool_file "$output_objdir/"
6451 tool_output_objdir=$func_to_tool_file_result
6452 # Create the object directory.
6453 func_mkdir_p "$output_objdir"
6455 # Determine the type of output
6458 func_fatal_help "you must specify an output file"
6460 *.$libext) linkmode=oldlib ;;
6461 *.lo | *.$objext) linkmode=obj ;;
6462 *.la) linkmode=lib ;;
6463 *) linkmode=prog ;; # Anything else should be a program.
6469 # Find all interdependent deplibs by searching for libraries
6470 # that are linked more than once (e.g. -la -lb -la)
6471 for deplib in $deplibs; do
6472 if $opt_preserve_dup_deps ; then
6474 *" $deplib "*) specialdeplibs+=" $deplib" ;;
6480 if test "$linkmode" = lib; then
6481 libs="$predeps $libs $compiler_lib_search_path $postdeps"
6483 # Compute libraries that are listed more than once in $predeps
6484 # $postdeps and mark them as special (i.e., whose duplicates are
6485 # not to be eliminated).
6487 if $opt_duplicate_compiler_generated_deps; then
6488 for pre_post_dep in $predeps $postdeps; do
6489 case "$pre_post_deps " in
6490 *" $pre_post_dep "*) specialdeplibs+=" $pre_post_deps" ;;
6492 pre_post_deps+=" $pre_post_dep"
6501 need_relink=no # whether we're linking any uninstalled libtool libraries
6502 notinst_deplibs= # not-installed libtool libraries
6503 notinst_path= # paths that contain not-installed libtool libraries
6507 passes="conv dlpreopen link"
6508 for file in $dlfiles $dlprefiles; do
6512 func_fatal_help "libraries can \`-dlopen' only libtool libraries: $file"
6523 passes="conv scan dlopen dlpreopen link"
6529 for pass in $passes; do
6530 # The preopen pass in lib mode reverses $deplibs; put it back here
6531 # so that -L comes before libs that need it for instance...
6532 if test "$linkmode,$pass" = "lib,link"; then
6533 ## FIXME: Find the place where the list is rebuilt in the wrong
6534 ## order, and fix it there properly
6536 for deplib in $deplibs; do
6537 tmp_deplibs="$deplib $tmp_deplibs"
6539 deplibs="$tmp_deplibs"
6542 if test "$linkmode,$pass" = "lib,link" ||
6543 test "$linkmode,$pass" = "prog,scan"; then
6547 if test "$linkmode" = prog; then
6549 dlopen) libs="$dlfiles" ;;
6550 dlpreopen) libs="$dlprefiles" ;;
6551 link) libs="$deplibs %DEPLIBS% $dependency_libs" ;;
6554 if test "$linkmode,$pass" = "lib,dlpreopen"; then
6555 # Collect and forward deplibs of preopened libtool libs
6556 for lib in $dlprefiles; do
6557 # Ignore non-libtool-libs
6559 func_resolve_sysroot "$lib"
6561 *.la) func_source "$func_resolve_sysroot_result" ;;
6564 # Collect preopened libtool deplibs, except any this library
6565 # has declared as weak libs
6566 for deplib in $dependency_libs; do
6567 func_basename "$deplib"
6568 deplib_base=$func_basename_result
6569 case " $weak_libs " in
6570 *" $deplib_base "*) ;;
6571 *) deplibs+=" $deplib" ;;
6577 if test "$pass" = dlopen; then
6578 # Collect dlpreopened libraries
6579 save_deplibs="$deplibs"
6583 for deplib in $libs; do
6587 -mt|-mthreads|-kthread|-Kthread|-pthread|-pthreads|--thread-safe|-threads)
6588 if test "$linkmode,$pass" = "prog,link"; then
6589 compile_deplibs="$deplib $compile_deplibs"
6590 finalize_deplibs="$deplib $finalize_deplibs"
6592 compiler_flags+=" $deplib"
6593 if test "$linkmode" = lib ; then
6594 case "$new_inherited_linker_flags " in
6596 * ) new_inherited_linker_flags+=" $deplib" ;;
6603 if test "$linkmode" != lib && test "$linkmode" != prog; then
6604 func_warning "\`-l' is ignored for archives/objects"
6607 func_stripname '-l' '' "$deplib"
6608 name=$func_stripname_result
6609 if test "$linkmode" = lib; then
6610 searchdirs="$newlib_search_path $lib_search_path $compiler_lib_search_dirs $sys_lib_search_path $shlib_search_path"
6612 searchdirs="$newlib_search_path $lib_search_path $sys_lib_search_path $shlib_search_path"
6614 for searchdir in $searchdirs; do
6615 for search_ext in .la $std_shrext .so .a; do
6616 # Search the libtool library
6617 lib="$searchdir/lib${name}${search_ext}"
6618 if test -f "$lib"; then
6619 if test "$search_ext" = ".la"; then
6628 if test "$found" != yes; then
6629 # deplib doesn't seem to be a libtool library
6630 if test "$linkmode,$pass" = "prog,link"; then
6631 compile_deplibs="$deplib $compile_deplibs"
6632 finalize_deplibs="$deplib $finalize_deplibs"
6634 deplibs="$deplib $deplibs"
6635 test "$linkmode" = lib && newdependency_libs="$deplib $newdependency_libs"
6638 else # deplib is a libtool library
6639 # If $allow_libtool_libs_with_static_runtimes && $deplib is a stdlib,
6640 # We need to do some special things here, and not later.
6641 if test "X$allow_libtool_libs_with_static_runtimes" = "Xyes" ; then
6642 case " $predeps $postdeps " in
6644 if func_lalib_p "$lib"; then
6648 for l in $old_library $library_names; do
6651 if test "X$ll" = "X$old_library" ; then # only static version available
6653 func_dirname "$lib" "" "."
6654 ladir="$func_dirname_result"
6655 lib=$ladir/$old_library
6656 if test "$linkmode,$pass" = "prog,link"; then
6657 compile_deplibs="$deplib $compile_deplibs"
6658 finalize_deplibs="$deplib $finalize_deplibs"
6660 deplibs="$deplib $deplibs"
6661 test "$linkmode" = lib && newdependency_libs="$deplib $newdependency_libs"
6673 if test "$linkmode,$pass" = "prog,link"; then
6674 compile_deplibs="$deplib $compile_deplibs"
6675 finalize_deplibs="$deplib $finalize_deplibs"
6677 deplibs="$deplib $deplibs"
6678 if test "$linkmode" = lib ; then
6679 case "$new_inherited_linker_flags " in
6681 * ) new_inherited_linker_flags+=" $deplib" ;;
6690 deplibs="$deplib $deplibs"
6691 test "$pass" = conv && continue
6692 newdependency_libs="$deplib $newdependency_libs"
6693 func_stripname '-L' '' "$deplib"
6694 func_resolve_sysroot "$func_stripname_result"
6695 newlib_search_path+=" $func_resolve_sysroot_result"
6698 if test "$pass" = conv; then
6699 deplibs="$deplib $deplibs"
6702 if test "$pass" = scan; then
6703 deplibs="$deplib $deplibs"
6705 compile_deplibs="$deplib $compile_deplibs"
6706 finalize_deplibs="$deplib $finalize_deplibs"
6708 func_stripname '-L' '' "$deplib"
6709 func_resolve_sysroot "$func_stripname_result"
6710 newlib_search_path+=" $func_resolve_sysroot_result"
6713 func_warning "\`-L' is ignored for archives/objects"
6719 if test "$pass" = link; then
6720 func_stripname '-R' '' "$deplib"
6721 func_resolve_sysroot "$func_stripname_result"
6722 dir=$func_resolve_sysroot_result
6723 # Make sure the xrpath contains only unique directories.
6726 *) xrpath+=" $dir" ;;
6729 deplibs="$deplib $deplibs"
6733 func_resolve_sysroot "$deplib"
6734 lib=$func_resolve_sysroot_result
6737 if test "$pass" = conv; then
6738 deplibs="$deplib $deplibs"
6743 # Linking convenience modules into shared libraries is allowed,
6744 # but linking other static libraries is non-portable.
6745 case " $dlpreconveniencelibs " in
6749 case $deplibs_check_method in
6751 set dummy $deplibs_check_method; shift
6752 match_pattern_regex=`expr "$deplibs_check_method" : "$1 \(.*\)"`
6753 if eval "\$ECHO \"$deplib\"" 2>/dev/null | $SED 10q \
6754 | $EGREP "$match_pattern_regex" > /dev/null; then
6762 if test "$valid_a_lib" != yes; then
6764 $ECHO "*** Warning: Trying to link with static lib archive $deplib."
6765 echo "*** I have the capability to make that library automatically link in when"
6766 echo "*** you link to this library. But I can only do this if you have a"
6767 echo "*** shared version of the library, which you do not appear to have"
6768 echo "*** because the file extensions .$libext of this argument makes me believe"
6769 echo "*** that it is just a static archive that I should not use here."
6772 $ECHO "*** Warning: Linking the shared library $output against the"
6773 $ECHO "*** static library $deplib is not portable!"
6774 deplibs="$deplib $deplibs"
6781 if test "$pass" != link; then
6782 deplibs="$deplib $deplibs"
6784 compile_deplibs="$deplib $compile_deplibs"
6785 finalize_deplibs="$deplib $finalize_deplibs"
6792 if test "$pass" = conv; then
6793 deplibs="$deplib $deplibs"
6794 elif test "$linkmode" = prog; then
6795 if test "$pass" = dlpreopen || test "$dlopen_support" != yes || test "$build_libtool_libs" = no; then
6796 # If there is no dlopen support or we're linking statically,
6797 # we need to preload.
6798 newdlprefiles+=" $deplib"
6799 compile_deplibs="$deplib $compile_deplibs"
6800 finalize_deplibs="$deplib $finalize_deplibs"
6802 newdlfiles+=" $deplib"
6813 if test "$found" = yes || test -f "$lib"; then :
6815 func_fatal_error "cannot find the library \`$lib' or unhandled argument \`$deplib'"
6818 # Check to see that this really is a libtool archive.
6819 func_lalib_unsafe_p "$lib" \
6820 || func_fatal_error "\`$lib' is not a valid libtool archive"
6822 func_dirname "$lib" "" "."
6823 ladir="$func_dirname_result"
6831 inherited_linker_flags=
6832 # If the library was installed with an old release of libtool,
6833 # it will not redefine variables installed, or shouldnotlink
6842 # Convert "-framework foo" to "foo.ltframework"
6843 if test -n "$inherited_linker_flags"; then
6844 tmp_inherited_linker_flags=`$ECHO "$inherited_linker_flags" | $SED 's/-framework \([^ $]*\)/\1.ltframework/g'`
6845 for tmp_inherited_linker_flag in $tmp_inherited_linker_flags; do
6846 case " $new_inherited_linker_flags " in
6847 *" $tmp_inherited_linker_flag "*) ;;
6848 *) new_inherited_linker_flags+=" $tmp_inherited_linker_flag";;
6852 dependency_libs=`$ECHO " $dependency_libs" | $SED 's% \([^ $]*\).ltframework% -framework \1%g'`
6853 if test "$linkmode,$pass" = "lib,link" ||
6854 test "$linkmode,$pass" = "prog,scan" ||
6855 { test "$linkmode" != prog && test "$linkmode" != lib; }; then
6856 test -n "$dlopen" && dlfiles+=" $dlopen"
6857 test -n "$dlpreopen" && dlprefiles+=" $dlpreopen"
6860 if test "$pass" = conv; then
6861 # Only check for convenience libraries
6862 deplibs="$lib $deplibs"
6863 if test -z "$libdir"; then
6864 if test -z "$old_library"; then
6865 func_fatal_error "cannot find name of link library for \`$lib'"
6867 # It is a libtool convenience library, so add in its objects.
6868 convenience+=" $ladir/$objdir/$old_library"
6869 old_convenience+=" $ladir/$objdir/$old_library"
6870 elif test "$linkmode" != prog && test "$linkmode" != lib; then
6871 func_fatal_error "\`$lib' is not a convenience library"
6874 for deplib in $dependency_libs; do
6875 deplibs="$deplib $deplibs"
6876 if $opt_preserve_dup_deps ; then
6877 case "$tmp_libs " in
6878 *" $deplib "*) specialdeplibs+=" $deplib" ;;
6881 tmp_libs+=" $deplib"
6887 # Get the name of the library we link against.
6889 if test -n "$old_library" &&
6890 { test "$prefer_static_libs" = yes ||
6891 test "$prefer_static_libs,$installed" = "built,no"; }; then
6892 linklib=$old_library
6894 for l in $old_library $library_names; do
6898 if test -z "$linklib"; then
6899 func_fatal_error "cannot find name of link library for \`$lib'"
6902 # This library was specified with -dlopen.
6903 if test "$pass" = dlopen; then
6904 if test -z "$libdir"; then
6905 func_fatal_error "cannot -dlopen a convenience library: \`$lib'"
6907 if test -z "$dlname" ||
6908 test "$dlopen_support" != yes ||
6909 test "$build_libtool_libs" = no; then
6910 # If there is no dlname, no dlopen support or we're linking
6911 # statically, we need to preload. We also need to preload any
6912 # dependent libraries so libltdl's deplib preloader doesn't
6913 # bomb out in the load deplibs phase.
6914 dlprefiles+=" $lib $dependency_libs"
6921 # We need an absolute path.
6923 [\\/]* | [A-Za-z]:[\\/]*) abs_ladir="$ladir" ;;
6925 abs_ladir=`cd "$ladir" && pwd`
6926 if test -z "$abs_ladir"; then
6927 func_warning "cannot determine absolute directory name of \`$ladir'"
6928 func_warning "passing it literally to the linker, although it might fail"
6933 func_basename "$lib"
6934 laname="$func_basename_result"
6936 # Find the relevant object directory and library name.
6937 if test "X$installed" = Xyes; then
6938 if test ! -f "$lt_sysroot$libdir/$linklib" && test -f "$abs_ladir/$linklib"; then
6939 func_warning "library \`$lib' was moved."
6944 dir="$lt_sysroot$libdir"
6945 absdir="$lt_sysroot$libdir"
6947 test "X$hardcode_automatic" = Xyes && avoidtemprpath=yes
6949 if test ! -f "$ladir/$objdir/$linklib" && test -f "$abs_ladir/$linklib"; then
6952 # Remove this search path later
6953 notinst_path+=" $abs_ladir"
6955 dir="$ladir/$objdir"
6956 absdir="$abs_ladir/$objdir"
6957 # Remove this search path later
6958 notinst_path+=" $abs_ladir"
6960 fi # $installed = yes
6961 func_stripname 'lib' '.la' "$laname"
6962 name=$func_stripname_result
6964 # This library was specified with -dlpreopen.
6965 if test "$pass" = dlpreopen; then
6966 if test -z "$libdir" && test "$linkmode" = prog; then
6967 func_fatal_error "only libraries may -dlpreopen a convenience library: \`$lib'"
6970 # special handling for platforms with PE-DLLs.
6971 *cygwin* | *mingw* | *cegcc* )
6972 # Linker will automatically link against shared library if both
6973 # static and shared are present. Therefore, ensure we extract
6974 # symbols from the import library if a shared library is present
6975 # (otherwise, the dlopen module name will be incorrect). We do
6976 # this by putting the import library name into $newdlprefiles.
6977 # We recover the dlopen module name by 'saving' the la file
6978 # name in a special purpose variable, and (later) extracting the
6979 # dlname from the la file.
6980 if test -n "$dlname"; then
6981 func_tr_sh "$dir/$linklib"
6982 eval "libfile_$func_tr_sh_result=\$abs_ladir/\$laname"
6983 newdlprefiles+=" $dir/$linklib"
6985 newdlprefiles+=" $dir/$old_library"
6986 # Keep a list of preopened convenience libraries to check
6987 # that they are being used correctly in the link pass.
6988 test -z "$libdir" && \
6989 dlpreconveniencelibs+=" $dir/$old_library"
6993 # Prefer using a static library (so that no silly _DYNAMIC symbols
6994 # are required to link).
6995 if test -n "$old_library"; then
6996 newdlprefiles+=" $dir/$old_library"
6997 # Keep a list of preopened convenience libraries to check
6998 # that they are being used correctly in the link pass.
6999 test -z "$libdir" && \
7000 dlpreconveniencelibs+=" $dir/$old_library"
7001 # Otherwise, use the dlname, so that lt_dlopen finds it.
7002 elif test -n "$dlname"; then
7003 newdlprefiles+=" $dir/$dlname"
7005 newdlprefiles+=" $dir/$linklib"
7009 fi # $pass = dlpreopen
7011 if test -z "$libdir"; then
7012 # Link the convenience library
7013 if test "$linkmode" = lib; then
7014 deplibs="$dir/$old_library $deplibs"
7015 elif test "$linkmode,$pass" = "prog,link"; then
7016 compile_deplibs="$dir/$old_library $compile_deplibs"
7017 finalize_deplibs="$dir/$old_library $finalize_deplibs"
7019 deplibs="$lib $deplibs" # used for prog,scan pass
7025 if test "$linkmode" = prog && test "$pass" != link; then
7026 newlib_search_path+=" $ladir"
7027 deplibs="$lib $deplibs"
7030 if test "$link_all_deplibs" != no || test -z "$library_names" ||
7031 test "$build_libtool_libs" = no; then
7036 for deplib in $dependency_libs; do
7038 -L*) func_stripname '-L' '' "$deplib"
7039 func_resolve_sysroot "$func_stripname_result"
7040 newlib_search_path+=" $func_resolve_sysroot_result"
7043 # Need to link against all dependency_libs?
7044 if test "$linkalldeplibs" = yes; then
7045 deplibs="$deplib $deplibs"
7047 # Need to hardcode shared library paths
7048 # or/and link against static libraries
7049 newdependency_libs="$deplib $newdependency_libs"
7051 if $opt_preserve_dup_deps ; then
7052 case "$tmp_libs " in
7053 *" $deplib "*) specialdeplibs+=" $deplib" ;;
7056 tmp_libs+=" $deplib"
7059 fi # $linkmode = prog...
7061 if test "$linkmode,$pass" = "prog,link"; then
7062 if test -n "$library_names" &&
7063 { { test "$prefer_static_libs" = no ||
7064 test "$prefer_static_libs,$installed" = "built,yes"; } ||
7065 test -z "$old_library"; }; then
7066 # We need to hardcode the library path
7067 if test -n "$shlibpath_var" && test -z "$avoidtemprpath" ; then
7068 # Make sure the rpath contains only unique directories.
7069 case "$temp_rpath:" in
7071 *) temp_rpath+="$absdir:" ;;
7075 # Hardcode the library path.
7076 # Skip directories that are in the system default run-time
7078 case " $sys_lib_dlsearch_path " in
7081 case "$compile_rpath " in
7083 *) compile_rpath+=" $absdir" ;;
7087 case " $sys_lib_dlsearch_path " in
7090 case "$finalize_rpath " in
7092 *) finalize_rpath+=" $libdir" ;;
7096 fi # $linkmode,$pass = prog,link...
7098 if test "$alldeplibs" = yes &&
7099 { test "$deplibs_check_method" = pass_all ||
7100 { test "$build_libtool_libs" = yes &&
7101 test -n "$library_names"; }; }; then
7102 # We only need to search for static libraries
7107 link_static=no # Whether the deplib will be linked statically
7108 use_static_libs=$prefer_static_libs
7109 if test "$use_static_libs" = built && test "$installed" = yes; then
7112 if test -n "$library_names" &&
7113 { test "$use_static_libs" = no || test -z "$old_library"; }; then
7115 *cygwin* | *mingw* | *cegcc*)
7116 # No point in relinking DLLs because paths are not encoded
7117 notinst_deplibs+=" $lib"
7121 if test "$installed" = no; then
7122 notinst_deplibs+=" $lib"
7127 # This is a shared library
7129 # Warn about portability, can't link against -module's on some
7130 # systems (darwin). Don't bleat about dlopened modules though!
7132 for dlpremoduletest in $dlprefiles; do
7133 if test "X$dlpremoduletest" = "X$lib"; then
7134 dlopenmodule="$dlpremoduletest"
7138 if test -z "$dlopenmodule" && test "$shouldnotlink" = yes && test "$pass" = link; then
7140 if test "$linkmode" = prog; then
7141 $ECHO "*** Warning: Linking the executable $output against the loadable module"
7143 $ECHO "*** Warning: Linking the shared library $output against the loadable module"
7145 $ECHO "*** $linklib is not portable!"
7147 if test "$linkmode" = lib &&
7148 test "$hardcode_into_libs" = yes; then
7149 # Hardcode the library path.
7150 # Skip directories that are in the system default run-time
7152 case " $sys_lib_dlsearch_path " in
7155 case "$compile_rpath " in
7157 *) compile_rpath+=" $absdir" ;;
7161 case " $sys_lib_dlsearch_path " in
7164 case "$finalize_rpath " in
7166 *) finalize_rpath+=" $libdir" ;;
7172 if test -n "$old_archive_from_expsyms_cmds"; then
7173 # figure out the soname
7174 set dummy $library_names
7178 libname=`eval "\\$ECHO \"$libname_spec\""`
7179 # use dlname if we got it. it's perfectly good, no?
7180 if test -n "$dlname"; then
7182 elif test -n "$soname_spec"; then
7185 *cygwin* | mingw* | *cegcc*)
7186 func_arith $current - $age
7187 major=$func_arith_result
7191 eval soname=\"$soname_spec\"
7196 # Make a new name for the extract_expsyms_cmds to use
7198 func_basename "$soroot"
7199 soname="$func_basename_result"
7200 func_stripname 'lib' '.dll' "$soname"
7201 newlib=libimp-$func_stripname_result.a
7203 # If the library has no export list, then create one now
7204 if test -f "$output_objdir/$soname-def"; then :
7206 func_verbose "extracting exported symbol list from \`$soname'"
7207 func_execute_cmds "$extract_expsyms_cmds" 'exit $?'
7211 if test -f "$output_objdir/$newlib"; then :; else
7212 func_verbose "generating import library for \`$soname'"
7213 func_execute_cmds "$old_archive_from_expsyms_cmds" 'exit $?'
7215 # make sure the library variables are pointing to the new library
7218 fi # test -n "$old_archive_from_expsyms_cmds"
7220 if test "$linkmode" = prog || test "$opt_mode" != relink; then
7225 case $hardcode_action in
7226 immediate | unsupported)
7227 if test "$hardcode_direct" = no; then
7230 *-*-sco3.2v5.0.[024]*) add_dir="-L$dir" ;;
7231 *-*-sysv4*uw2*) add_dir="-L$dir" ;;
7232 *-*-sysv5OpenUNIX* | *-*-sysv5UnixWare7.[01].[10]* | \
7233 *-*-unixware7*) add_dir="-L$dir" ;;
7235 # if the lib is a (non-dlopened) module then we can not
7236 # link against it, someone is ignoring the earlier warnings
7237 if /usr/bin/file -L $add 2> /dev/null |
7238 $GREP ": [^:]* bundle" >/dev/null ; then
7239 if test "X$dlopenmodule" != "X$lib"; then
7240 $ECHO "*** Warning: lib $linklib is a module, not a shared library"
7241 if test -z "$old_library" ; then
7243 echo "*** And there doesn't seem to be a static archive available"
7244 echo "*** The link will probably fail, sorry"
7246 add="$dir/$old_library"
7248 elif test -n "$old_library"; then
7249 add="$dir/$old_library"
7253 elif test "$hardcode_minus_L" = no; then
7255 *-*-sunos*) add_shlibpath="$dir" ;;
7259 elif test "$hardcode_shlibpath_var" = no; then
7260 add_shlibpath="$dir"
7267 if test "$hardcode_direct" = yes &&
7268 test "$hardcode_direct_absolute" = no; then
7270 elif test "$hardcode_minus_L" = yes; then
7272 # Try looking first in the location we're being installed to.
7273 if test -n "$inst_prefix_dir"; then
7276 add_dir+=" -L$inst_prefix_dir$libdir"
7281 elif test "$hardcode_shlibpath_var" = yes; then
7282 add_shlibpath="$dir"
7291 if test "$lib_linked" != yes; then
7292 func_fatal_configuration "unsupported hardcode properties"
7295 if test -n "$add_shlibpath"; then
7296 case :$compile_shlibpath: in
7297 *":$add_shlibpath:"*) ;;
7298 *) compile_shlibpath+="$add_shlibpath:" ;;
7301 if test "$linkmode" = prog; then
7302 test -n "$add_dir" && compile_deplibs="$add_dir $compile_deplibs"
7303 test -n "$add" && compile_deplibs="$add $compile_deplibs"
7305 test -n "$add_dir" && deplibs="$add_dir $deplibs"
7306 test -n "$add" && deplibs="$add $deplibs"
7307 if test "$hardcode_direct" != yes &&
7308 test "$hardcode_minus_L" != yes &&
7309 test "$hardcode_shlibpath_var" = yes; then
7310 case :$finalize_shlibpath: in
7312 *) finalize_shlibpath+="$libdir:" ;;
7318 if test "$linkmode" = prog || test "$opt_mode" = relink; then
7322 # Finalize command for both is simple: just hardcode it.
7323 if test "$hardcode_direct" = yes &&
7324 test "$hardcode_direct_absolute" = no; then
7325 add="$libdir/$linklib"
7326 elif test "$hardcode_minus_L" = yes; then
7329 elif test "$hardcode_shlibpath_var" = yes; then
7330 case :$finalize_shlibpath: in
7332 *) finalize_shlibpath+="$libdir:" ;;
7335 elif test "$hardcode_automatic" = yes; then
7336 if test -n "$inst_prefix_dir" &&
7337 test -f "$inst_prefix_dir$libdir/$linklib" ; then
7338 add="$inst_prefix_dir$libdir/$linklib"
7340 add="$libdir/$linklib"
7343 # We cannot seem to hardcode it, guess we'll fake it.
7345 # Try looking first in the location we're being installed to.
7346 if test -n "$inst_prefix_dir"; then
7349 add_dir+=" -L$inst_prefix_dir$libdir"
7356 if test "$linkmode" = prog; then
7357 test -n "$add_dir" && finalize_deplibs="$add_dir $finalize_deplibs"
7358 test -n "$add" && finalize_deplibs="$add $finalize_deplibs"
7360 test -n "$add_dir" && deplibs="$add_dir $deplibs"
7361 test -n "$add" && deplibs="$add $deplibs"
7364 elif test "$linkmode" = prog; then
7365 # Here we assume that one of hardcode_direct or hardcode_minus_L
7366 # is not unsupported. This is valid on all known static and
7368 if test "$hardcode_direct" != unsupported; then
7369 test -n "$old_library" && linklib="$old_library"
7370 compile_deplibs="$dir/$linklib $compile_deplibs"
7371 finalize_deplibs="$dir/$linklib $finalize_deplibs"
7373 compile_deplibs="-l$name -L$dir $compile_deplibs"
7374 finalize_deplibs="-l$name -L$dir $finalize_deplibs"
7376 elif test "$build_libtool_libs" = yes; then
7377 # Not a shared library
7378 if test "$deplibs_check_method" != pass_all; then
7379 # We're trying link a shared library against a static one
7380 # but the system doesn't support it.
7382 # Just print a warning and add the library to dependency_libs so
7383 # that the program can be linked against the static library.
7385 $ECHO "*** Warning: This system can not link to static lib archive $lib."
7386 echo "*** I have the capability to make that library automatically link in when"
7387 echo "*** you link to this library. But I can only do this if you have a"
7388 echo "*** shared version of the library, which you do not appear to have."
7389 if test "$module" = yes; then
7390 echo "*** But as you try to build a module library, libtool will still create "
7391 echo "*** a static module, that should work as long as the dlopening application"
7392 echo "*** is linked with the -dlopen flag to resolve symbols at runtime."
7393 if test -z "$global_symbol_pipe"; then
7395 echo "*** However, this would only work if libtool was able to extract symbol"
7396 echo "*** lists from a program, using \`nm' or equivalent, but libtool could"
7397 echo "*** not find such a program. So, this module is probably useless."
7398 echo "*** \`nm' from GNU binutils and a full rebuild may help."
7400 if test "$build_old_libs" = no; then
7401 build_libtool_libs=module
7404 build_libtool_libs=no
7408 deplibs="$dir/$old_library $deplibs"
7411 fi # link shared/static library?
7413 if test "$linkmode" = lib; then
7414 if test -n "$dependency_libs" &&
7415 { test "$hardcode_into_libs" != yes ||
7416 test "$build_old_libs" = yes ||
7417 test "$link_static" = yes; }; then
7418 # Extract -R from dependency_libs
7420 for libdir in $dependency_libs; do
7422 -R*) func_stripname '-R' '' "$libdir"
7423 temp_xrpath=$func_stripname_result
7425 *" $temp_xrpath "*) ;;
7426 *) xrpath+=" $temp_xrpath";;
7428 *) temp_deplibs+=" $libdir";;
7431 dependency_libs="$temp_deplibs"
7434 newlib_search_path+=" $absdir"
7435 # Link against this library
7436 test "$link_static" = no && newdependency_libs="$abs_ladir/$laname $newdependency_libs"
7437 # ... and its dependency_libs
7439 for deplib in $dependency_libs; do
7440 newdependency_libs="$deplib $newdependency_libs"
7442 -L*) func_stripname '-L' '' "$deplib"
7443 func_resolve_sysroot "$func_stripname_result";;
7444 *) func_resolve_sysroot "$deplib" ;;
7446 if $opt_preserve_dup_deps ; then
7447 case "$tmp_libs " in
7448 *" $func_resolve_sysroot_result "*)
7449 specialdeplibs+=" $func_resolve_sysroot_result" ;;
7452 tmp_libs+=" $func_resolve_sysroot_result"
7455 if test "$link_all_deplibs" != no; then
7456 # Add the search paths of all dependency libraries
7457 for deplib in $dependency_libs; do
7460 -L*) path="$deplib" ;;
7462 func_resolve_sysroot "$deplib"
7463 deplib=$func_resolve_sysroot_result
7464 func_dirname "$deplib" "" "."
7465 dir=$func_dirname_result
7466 # We need an absolute path.
7468 [\\/]* | [A-Za-z]:[\\/]*) absdir="$dir" ;;
7470 absdir=`cd "$dir" && pwd`
7471 if test -z "$absdir"; then
7472 func_warning "cannot determine absolute directory name of \`$dir'"
7477 if $GREP "^installed=no" $deplib > /dev/null; then
7481 eval deplibrary_names=`${SED} -n -e 's/^library_names=\(.*\)$/\1/p' $deplib`
7482 if test -n "$deplibrary_names" ; then
7483 for tmp in $deplibrary_names ; do
7486 if test -f "$absdir/$objdir/$depdepl" ; then
7487 depdepl="$absdir/$objdir/$depdepl"
7488 darwin_install_name=`${OTOOL} -L $depdepl | awk '{if (NR == 2) {print $1;exit}}'`
7489 if test -z "$darwin_install_name"; then
7490 darwin_install_name=`${OTOOL64} -L $depdepl | awk '{if (NR == 2) {print $1;exit}}'`
7492 compiler_flags+=" ${wl}-dylib_file ${wl}${darwin_install_name}:${depdepl}"
7493 linker_flags+=" -dylib_file ${darwin_install_name}:${depdepl}"
7499 path="-L$absdir/$objdir"
7503 eval libdir=`${SED} -n -e 's/^libdir=\(.*\)$/\1/p' $deplib`
7504 test -z "$libdir" && \
7505 func_fatal_error "\`$deplib' is not a valid libtool archive"
7506 test "$absdir" != "$libdir" && \
7507 func_warning "\`$deplib' seems to be moved"
7513 case " $deplibs " in
7515 *) deplibs="$path $deplibs" ;;
7518 fi # link_all_deplibs != no
7520 done # for deplib in $libs
7521 if test "$pass" = link; then
7522 if test "$linkmode" = "prog"; then
7523 compile_deplibs="$new_inherited_linker_flags $compile_deplibs"
7524 finalize_deplibs="$new_inherited_linker_flags $finalize_deplibs"
7526 compiler_flags="$compiler_flags "`$ECHO " $new_inherited_linker_flags" | $SED 's% \([^ $]*\).ltframework% -framework \1%g'`
7529 dependency_libs="$newdependency_libs"
7530 if test "$pass" = dlpreopen; then
7531 # Link the dlpreopened libraries before other libraries
7532 for deplib in $save_deplibs; do
7533 deplibs="$deplib $deplibs"
7536 if test "$pass" != dlopen; then
7537 if test "$pass" != conv; then
7538 # Make sure lib_search_path contains only unique directories.
7540 for dir in $newlib_search_path; do
7541 case "$lib_search_path " in
7543 *) lib_search_path+=" $dir" ;;
7549 if test "$linkmode,$pass" != "prog,link"; then
7552 vars="compile_deplibs finalize_deplibs"
7554 for var in $vars dependency_libs; do
7555 # Add libraries to $var in reverse order
7556 eval tmp_libs=\"\$$var\"
7558 for deplib in $tmp_libs; do
7559 # FIXME: Pedantically, this is the right thing to do, so
7560 # that some nasty dependency loop isn't accidentally
7562 #new_libs="$deplib $new_libs"
7563 # Pragmatically, this seems to cause very few problems in
7566 -L*) new_libs="$deplib $new_libs" ;;
7569 # And here is the reason: when a library appears more
7570 # than once as an explicit dependence of a library, or
7571 # is implicitly linked in more than once by the
7572 # compiler, it is considered special, and multiple
7573 # occurrences thereof are not removed. Compare this
7574 # with having the same library being listed as a
7575 # dependency of multiple other libraries: in this case,
7576 # we know (pedantically, we assume) the library does not
7577 # need to be listed more than once, so we keep only the
7578 # last copy. This is not always right, but it is rare
7579 # enough that we require users that really mean to play
7580 # such unportable linking tricks to link the library
7581 # using -Wl,-lname, so that libtool does not consider it
7582 # for duplicate removal.
7583 case " $specialdeplibs " in
7584 *" $deplib "*) new_libs="$deplib $new_libs" ;;
7586 case " $new_libs " in
7588 *) new_libs="$deplib $new_libs" ;;
7596 for deplib in $new_libs; do
7599 case " $tmp_libs " in
7601 *) tmp_libs+=" $deplib" ;;
7604 *) tmp_libs+=" $deplib" ;;
7607 eval $var=\"$tmp_libs\"
7610 # Last step: remove runtime libs from dependency_libs
7611 # (they stay in deplibs)
7613 for i in $dependency_libs ; do
7614 case " $predeps $postdeps $compiler_lib_search_path " in
7619 if test -n "$i" ; then
7623 dependency_libs=$tmp_libs
7625 if test "$linkmode" = prog; then
7626 dlfiles="$newdlfiles"
7628 if test "$linkmode" = prog || test "$linkmode" = lib; then
7629 dlprefiles="$newdlprefiles"
7634 if test -n "$dlfiles$dlprefiles" || test "$dlself" != no; then
7635 func_warning "\`-dlopen' is ignored for archives"
7640 func_warning "\`-l' and \`-L' are ignored for archives" ;;
7643 test -n "$rpath" && \
7644 func_warning "\`-rpath' is ignored for archives"
7646 test -n "$xrpath" && \
7647 func_warning "\`-R' is ignored for archives"
7649 test -n "$vinfo" && \
7650 func_warning "\`-version-info/-version-number' is ignored for archives"
7652 test -n "$release" && \
7653 func_warning "\`-release' is ignored for archives"
7655 test -n "$export_symbols$export_symbols_regex" && \
7656 func_warning "\`-export-symbols' is ignored for archives"
7658 # Now set the variables for building old libraries.
7659 build_libtool_libs=no
7661 objs+="$old_deplibs"
7665 # Make sure we only generate libraries of the form `libNAME.la'.
7668 func_stripname 'lib' '.la' "$outputname"
7669 name=$func_stripname_result
7670 eval shared_ext=\"$shrext_cmds\"
7671 eval libname=\"$libname_spec\"
7674 test "$module" = no && \
7675 func_fatal_help "libtool library \`$output' must begin with \`lib'"
7677 if test "$need_lib_prefix" != no; then
7678 # Add the "lib" prefix for modules if required
7679 func_stripname '' '.la' "$outputname"
7680 name=$func_stripname_result
7681 eval shared_ext=\"$shrext_cmds\"
7682 eval libname=\"$libname_spec\"
7684 func_stripname '' '.la' "$outputname"
7685 libname=$func_stripname_result
7690 if test -n "$objs"; then
7691 if test "$deplibs_check_method" != pass_all; then
7692 func_fatal_error "cannot build libtool library \`$output' from non-libtool objects on this host:$objs"
7695 $ECHO "*** Warning: Linking the shared library $output against the non-libtool"
7696 $ECHO "*** objects $objs is not portable!"
7701 test "$dlself" != no && \
7702 func_warning "\`-dlopen self' is ignored for libtool libraries"
7706 test "$#" -gt 1 && \
7707 func_warning "ignoring multiple \`-rpath's for a libtool library"
7712 if test -z "$rpath"; then
7713 if test "$build_libtool_libs" = yes; then
7714 # Building a libtool convenience library.
7715 # Some compilers have problems with a `.al' extension so
7716 # convenience libraries should have the same extension an
7717 # archive normally would.
7718 oldlibs="$output_objdir/$libname.$libext $oldlibs"
7719 build_libtool_libs=convenience
7723 test -n "$vinfo" && \
7724 func_warning "\`-version-info/-version-number' is ignored for convenience libraries"
7726 test -n "$release" && \
7727 func_warning "\`-release' is ignored for convenience libraries"
7730 # Parse the version information argument.
7731 save_ifs="$IFS"; IFS=':'
7732 set dummy $vinfo 0 0 0
7737 func_fatal_help "too many parameters to \`-version-info'"
7739 # convert absolute version numbers to libtool ages
7740 # this retains compatibility with .la files and attempts
7741 # to make the code below a bit more comprehensible
7743 case $vinfo_number in
7747 number_revision="$3"
7749 # There are really only two kinds -- those that
7750 # use the current revision as the major version
7751 # and those that subtract age and use age as
7752 # a minor version. But, then there is irix
7753 # which has an extra 1 added just for fun
7755 case $version_type in
7756 darwin|linux|osf|windows|none)
7757 func_arith $number_major + $number_minor
7758 current=$func_arith_result
7760 revision="$number_revision"
7762 freebsd-aout|freebsd-elf|qnx|sunos)
7763 current="$number_major"
7764 revision="$number_minor"
7768 func_arith $number_major + $number_minor
7769 current=$func_arith_result
7771 revision="$number_minor"
7772 lt_irix_increment=no
7783 # Check that each of the things are valid numbers.
7785 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]) ;;
7787 func_error "CURRENT \`$current' must be a nonnegative integer"
7788 func_fatal_error "\`$vinfo' is not valid version information"
7793 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]) ;;
7795 func_error "REVISION \`$revision' must be a nonnegative integer"
7796 func_fatal_error "\`$vinfo' is not valid version information"
7801 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]) ;;
7803 func_error "AGE \`$age' must be a nonnegative integer"
7804 func_fatal_error "\`$vinfo' is not valid version information"
7808 if test "$age" -gt "$current"; then
7809 func_error "AGE \`$age' is greater than the current interface number \`$current'"
7810 func_fatal_error "\`$vinfo' is not valid version information"
7813 # Calculate the version variables.
7817 case $version_type in
7821 # Like Linux, but with the current version available in
7822 # verstring for coding it into the library header
7823 func_arith $current - $age
7824 major=.$func_arith_result
7825 versuffix="$major.$age.$revision"
7826 # Darwin ld doesn't like 0 for these options...
7827 func_arith $current + 1
7828 minor_current=$func_arith_result
7829 xlcverstring="${wl}-compatibility_version ${wl}$minor_current ${wl}-current_version ${wl}$minor_current.$revision"
7830 verstring="-compatibility_version $minor_current -current_version $minor_current.$revision"
7835 versuffix=".$current.$revision";
7840 versuffix=".$current"
7844 if test "X$lt_irix_increment" = "Xno"; then
7845 func_arith $current - $age
7847 func_arith $current - $age + 1
7849 major=$func_arith_result
7851 case $version_type in
7852 nonstopux) verstring_prefix=nonstopux ;;
7853 *) verstring_prefix=sgi ;;
7855 verstring="$verstring_prefix$major.$revision"
7857 # Add in all the interfaces that we are compatible with.
7859 while test "$loop" -ne 0; do
7860 func_arith $revision - $loop
7861 iface=$func_arith_result
7862 func_arith $loop - 1
7863 loop=$func_arith_result
7864 verstring="$verstring_prefix$major.$iface:$verstring"
7867 # Before this point, $major must not contain `.'.
7869 versuffix="$major.$revision"
7873 func_arith $current - $age
7874 major=.$func_arith_result
7875 versuffix="$major.$age.$revision"
7879 func_arith $current - $age
7880 major=.$func_arith_result
7881 versuffix=".$current.$age.$revision"
7882 verstring="$current.$age.$revision"
7884 # Add in all the interfaces that we are compatible with.
7886 while test "$loop" -ne 0; do
7887 func_arith $current - $loop
7888 iface=$func_arith_result
7889 func_arith $loop - 1
7890 loop=$func_arith_result
7891 verstring="$verstring:${iface}.0"
7894 # Make executables depend on our current version.
7895 verstring+=":${current}.0"
7900 versuffix=".$current"
7905 versuffix=".$current.$revision"
7909 # Use '-' rather than '.', since we only want one
7910 # extension on DOS 8.3 filesystems.
7911 func_arith $current - $age
7912 major=$func_arith_result
7917 func_fatal_configuration "unknown library version type \`$version_type'"
7921 # Clear the version info if we defaulted, and they specified a release.
7922 if test -z "$vinfo" && test -n "$release"; then
7924 case $version_type in
7926 # we can't check for "0.0" in archive_cmds due to quoting
7927 # problems, so we reset it completely
7934 if test "$need_version" = no; then
7941 # Remove version info from name if versioning should be avoided
7942 if test "$avoid_version" = yes && test "$need_version" = no; then
7948 # Check to see if the archive will have undefined symbols.
7949 if test "$allow_undefined" = yes; then
7950 if test "$allow_undefined_flag" = unsupported; then
7951 func_warning "undefined symbols not allowed in $host shared libraries"
7952 build_libtool_libs=no
7956 # Don't allow undefined symbols.
7957 allow_undefined_flag="$no_undefined_flag"
7962 func_generate_dlsyms "$libname" "$libname" "yes"
7963 libobjs+=" $symfileobj"
7964 test "X$libobjs" = "X " && libobjs=
7966 if test "$opt_mode" != relink; then
7967 # Remove our outputs, but don't remove object files since they
7968 # may have been created when compiling PIC objects.
7970 tempremovelist=`$ECHO "$output_objdir/*"`
7971 for p in $tempremovelist; do
7975 $output_objdir/$outputname | $output_objdir/$libname.* | $output_objdir/${libname}${release}.*)
7976 if test "X$precious_files_regex" != "X"; then
7977 if $ECHO "$p" | $EGREP -e "$precious_files_regex" >/dev/null 2>&1
7987 test -n "$removelist" && \
7988 func_show_eval "${RM}r \$removelist"
7991 # Now set the variables for building old libraries.
7992 if test "$build_old_libs" = yes && test "$build_libtool_libs" != convenience ; then
7993 oldlibs+=" $output_objdir/$libname.$libext"
7995 # Transform .lo files to .o files.
7996 oldobjs="$objs "`$ECHO "$libobjs" | $SP2NL | $SED "/\.${libext}$/d; $lo2o" | $NL2SP`
7999 # Eliminate all temporary directories.
8000 #for path in $notinst_path; do
8001 # lib_search_path=`$ECHO "$lib_search_path " | $SED "s% $path % %g"`
8002 # deplibs=`$ECHO "$deplibs " | $SED "s% -L$path % %g"`
8003 # dependency_libs=`$ECHO "$dependency_libs " | $SED "s% -L$path % %g"`
8006 if test -n "$xrpath"; then
8007 # If the user specified any rpath flags, then add them.
8009 for libdir in $xrpath; do
8010 func_replace_sysroot "$libdir"
8011 temp_xrpath+=" -R$func_replace_sysroot_result"
8012 case "$finalize_rpath " in
8014 *) finalize_rpath+=" $libdir" ;;
8017 if test "$hardcode_into_libs" != yes || test "$build_old_libs" = yes; then
8018 dependency_libs="$temp_xrpath $dependency_libs"
8022 # Make sure dlfiles contains only unique files that won't be dlpreopened
8023 old_dlfiles="$dlfiles"
8025 for lib in $old_dlfiles; do
8026 case " $dlprefiles $dlfiles " in
8028 *) dlfiles+=" $lib" ;;
8032 # Make sure dlprefiles contains only unique files
8033 old_dlprefiles="$dlprefiles"
8035 for lib in $old_dlprefiles; do
8036 case "$dlprefiles " in
8038 *) dlprefiles+=" $lib" ;;
8042 if test "$build_libtool_libs" = yes; then
8043 if test -n "$rpath"; then
8045 *-*-cygwin* | *-*-mingw* | *-*-pw32* | *-*-os2* | *-*-beos* | *-cegcc* | *-*-haiku*)
8046 # these systems don't actually have a c library (as such)!
8048 *-*-rhapsody* | *-*-darwin1.[012])
8049 # Rhapsody C library is in the System framework
8050 deplibs+=" System.ltframework"
8053 # Don't link with libc until the a.out ld.so is fixed.
8055 *-*-openbsd* | *-*-freebsd* | *-*-dragonfly*)
8056 # Do not include libc due to us having libc/libc_r.
8058 *-*-sco3.2v5* | *-*-sco5v6*)
8059 # Causes problems with __ctype
8061 *-*-sysv4.2uw2* | *-*-sysv5* | *-*-unixware* | *-*-OpenUNIX*)
8062 # Compiler inserts libc in the correct place for threads to work
8065 # Add libc to deplibs on all other systems if necessary.
8066 if test "$build_libtool_need_lc" = "yes"; then
8073 # Transform deplibs into only deplibs that can be linked in shared.
8075 libname_save=$libname
8076 release_save=$release
8077 versuffix_save=$versuffix
8079 # I'm not sure if I'm treating the release correctly. I think
8080 # release should show up in the -l (ie -lgmp5) so we don't want to
8081 # add it in twice. Is that correct?
8087 case $deplibs_check_method in
8089 # Don't check for shared/static. Everything works.
8090 # This might be a little naive. We might want to check
8091 # whether the library exists or not. But this is on
8092 # osf3 & osf4 and I'm not really sure... Just
8093 # implementing what was already the behavior.
8097 # This code stresses the "libraries are programs" paradigm to its
8098 # limits. Maybe even breaks it. We compile a program, linking it
8099 # against the deplibs as a proxy for the library. Then we can check
8100 # whether they linked in statically or dynamically with ldd.
8101 $opt_dry_run || $RM conftest.c
8102 cat > conftest.c <<EOF
8103 int main() { return 0; }
8105 $opt_dry_run || $RM conftest
8106 if $LTCC $LTCFLAGS -o conftest conftest.c $deplibs; then
8107 ldd_output=`ldd conftest`
8108 for i in $deplibs; do
8111 func_stripname -l '' "$i"
8112 name=$func_stripname_result
8113 if test "X$allow_libtool_libs_with_static_runtimes" = "Xyes" ; then
8114 case " $predeps $postdeps " in
8121 if test -n "$i" ; then
8122 libname=`eval "\\$ECHO \"$libname_spec\""`
8123 deplib_matches=`eval "\\$ECHO \"$library_names_spec\""`
8124 set dummy $deplib_matches; shift
8126 if test `expr "$ldd_output" : ".*$deplib_match"` -ne 0 ; then
8131 $ECHO "*** Warning: dynamic linker does not accept needed library $i."
8132 echo "*** I have the capability to make that library automatically link in when"
8133 echo "*** you link to this library. But I can only do this if you have a"
8134 echo "*** shared version of the library, which I believe you do not have"
8135 echo "*** because a test_compile did reveal that the linker did not use it for"
8136 echo "*** its dynamic dependency list that programs get resolved with at runtime."
8146 # Error occurred in the first compile. Let's try to salvage
8147 # the situation: Compile a separate program for each library.
8148 for i in $deplibs; do
8151 func_stripname -l '' "$i"
8152 name=$func_stripname_result
8153 $opt_dry_run || $RM conftest
8154 if $LTCC $LTCFLAGS -o conftest conftest.c $i; then
8155 ldd_output=`ldd conftest`
8156 if test "X$allow_libtool_libs_with_static_runtimes" = "Xyes" ; then
8157 case " $predeps $postdeps " in
8164 if test -n "$i" ; then
8165 libname=`eval "\\$ECHO \"$libname_spec\""`
8166 deplib_matches=`eval "\\$ECHO \"$library_names_spec\""`
8167 set dummy $deplib_matches; shift
8169 if test `expr "$ldd_output" : ".*$deplib_match"` -ne 0 ; then
8174 $ECHO "*** Warning: dynamic linker does not accept needed library $i."
8175 echo "*** I have the capability to make that library automatically link in when"
8176 echo "*** you link to this library. But I can only do this if you have a"
8177 echo "*** shared version of the library, which you do not appear to have"
8178 echo "*** because a test_compile did reveal that the linker did not use this one"
8179 echo "*** as a dynamic dependency that programs can get resolved with at runtime."
8185 $ECHO "*** Warning! Library $i is needed by this library but I was not able to"
8186 echo "*** make it link in! You will probably need to install it or some"
8187 echo "*** library that it depends on before this library will be fully"
8188 echo "*** functional. Installing it before continuing would be even better."
8199 set dummy $deplibs_check_method; shift
8200 file_magic_regex=`expr "$deplibs_check_method" : "$1 \(.*\)"`
8201 for a_deplib in $deplibs; do
8204 func_stripname -l '' "$a_deplib"
8205 name=$func_stripname_result
8206 if test "X$allow_libtool_libs_with_static_runtimes" = "Xyes" ; then
8207 case " $predeps $postdeps " in
8209 newdeplibs+=" $a_deplib"
8214 if test -n "$a_deplib" ; then
8215 libname=`eval "\\$ECHO \"$libname_spec\""`
8216 if test -n "$file_magic_glob"; then
8217 libnameglob=`func_echo_all "$libname" | $SED -e $file_magic_glob`
8219 libnameglob=$libname
8221 test "$want_nocaseglob" = yes && nocaseglob=`shopt -p nocaseglob`
8222 for i in $lib_search_path $sys_lib_search_path $shlib_search_path; do
8223 if test "$want_nocaseglob" = yes; then
8225 potential_libs=`ls $i/$libnameglob[.-]* 2>/dev/null`
8228 potential_libs=`ls $i/$libnameglob[.-]* 2>/dev/null`
8230 for potent_lib in $potential_libs; do
8231 # Follow soft links.
8232 if ls -lLd "$potent_lib" 2>/dev/null |
8233 $GREP " -> " >/dev/null; then
8236 # The statement above tries to avoid entering an
8237 # endless loop below, in case of cyclic links.
8238 # We might still enter an endless loop, since a link
8239 # loop can be closed while we follow links,
8241 potlib="$potent_lib"
8242 while test -h "$potlib" 2>/dev/null; do
8243 potliblink=`ls -ld $potlib | ${SED} 's/.* -> //'`
8245 [\\/]* | [A-Za-z]:[\\/]*) potlib="$potliblink";;
8246 *) potlib=`$ECHO "$potlib" | $SED 's,[^/]*$,,'`"$potliblink";;
8249 if eval $file_magic_cmd \"\$potlib\" 2>/dev/null |
8251 $EGREP "$file_magic_regex" > /dev/null; then
8252 newdeplibs+=" $a_deplib"
8259 if test -n "$a_deplib" ; then
8262 $ECHO "*** Warning: linker path does not have real file for library $a_deplib."
8263 echo "*** I have the capability to make that library automatically link in when"
8264 echo "*** you link to this library. But I can only do this if you have a"
8265 echo "*** shared version of the library, which you do not appear to have"
8266 echo "*** because I did check the linker path looking for a file starting"
8267 if test -z "$potlib" ; then
8268 $ECHO "*** with $libname but no candidates were found. (...for file magic test)"
8270 $ECHO "*** with $libname and none of the candidates passed a file format test"
8271 $ECHO "*** using a file magic. Last file checked: $potlib"
8276 # Add a -L argument.
8277 newdeplibs+=" $a_deplib"
8280 done # Gone through all deplibs.
8283 set dummy $deplibs_check_method; shift
8284 match_pattern_regex=`expr "$deplibs_check_method" : "$1 \(.*\)"`
8285 for a_deplib in $deplibs; do
8288 func_stripname -l '' "$a_deplib"
8289 name=$func_stripname_result
8290 if test "X$allow_libtool_libs_with_static_runtimes" = "Xyes" ; then
8291 case " $predeps $postdeps " in
8293 newdeplibs+=" $a_deplib"
8298 if test -n "$a_deplib" ; then
8299 libname=`eval "\\$ECHO \"$libname_spec\""`
8300 for i in $lib_search_path $sys_lib_search_path $shlib_search_path; do
8301 potential_libs=`ls $i/$libname[.-]* 2>/dev/null`
8302 for potent_lib in $potential_libs; do
8303 potlib="$potent_lib" # see symlink-check above in file_magic test
8304 if eval "\$ECHO \"$potent_lib\"" 2>/dev/null | $SED 10q | \
8305 $EGREP "$match_pattern_regex" > /dev/null; then
8306 newdeplibs+=" $a_deplib"
8313 if test -n "$a_deplib" ; then
8316 $ECHO "*** Warning: linker path does not have real file for library $a_deplib."
8317 echo "*** I have the capability to make that library automatically link in when"
8318 echo "*** you link to this library. But I can only do this if you have a"
8319 echo "*** shared version of the library, which you do not appear to have"
8320 echo "*** because I did check the linker path looking for a file starting"
8321 if test -z "$potlib" ; then
8322 $ECHO "*** with $libname but no candidates were found. (...for regex pattern test)"
8324 $ECHO "*** with $libname and none of the candidates passed a file format test"
8325 $ECHO "*** using a regex pattern. Last file checked: $potlib"
8330 # Add a -L argument.
8331 newdeplibs+=" $a_deplib"
8334 done # Gone through all deplibs.
8338 tmp_deplibs=`$ECHO " $deplibs" | $SED 's/ -lc$//; s/ -[LR][^ ]*//g'`
8339 if test "X$allow_libtool_libs_with_static_runtimes" = "Xyes" ; then
8340 for i in $predeps $postdeps ; do
8341 # can't use Xsed below, because $i might contain '/'
8342 tmp_deplibs=`$ECHO " $tmp_deplibs" | $SED "s,$i,,"`
8345 case $tmp_deplibs in
8348 if test "X$deplibs_check_method" = "Xnone"; then
8349 echo "*** Warning: inter-library dependencies are not supported in this platform."
8351 echo "*** Warning: inter-library dependencies are not known to be supported."
8353 echo "*** All declared inter-library dependencies are being dropped."
8359 versuffix=$versuffix_save
8361 release=$release_save
8362 libname=$libname_save
8366 *-*-rhapsody* | *-*-darwin1.[012])
8367 # On Rhapsody replace the C library with the System framework
8368 newdeplibs=`$ECHO " $newdeplibs" | $SED 's/ -lc / System.ltframework /'`
8372 if test "$droppeddeps" = yes; then
8373 if test "$module" = yes; then
8375 echo "*** Warning: libtool could not satisfy all declared inter-library"
8376 $ECHO "*** dependencies of module $libname. Therefore, libtool will create"
8377 echo "*** a static module, that should work as long as the dlopening"
8378 echo "*** application is linked with the -dlopen flag."
8379 if test -z "$global_symbol_pipe"; then
8381 echo "*** However, this would only work if libtool was able to extract symbol"
8382 echo "*** lists from a program, using \`nm' or equivalent, but libtool could"
8383 echo "*** not find such a program. So, this module is probably useless."
8384 echo "*** \`nm' from GNU binutils and a full rebuild may help."
8386 if test "$build_old_libs" = no; then
8387 oldlibs="$output_objdir/$libname.$libext"
8388 build_libtool_libs=module
8391 build_libtool_libs=no
8394 echo "*** The inter-library dependencies that have been dropped here will be"
8395 echo "*** automatically added whenever a program is linked with this library"
8396 echo "*** or is declared to -dlopen it."
8398 if test "$allow_undefined" = no; then
8400 echo "*** Since this library must not contain undefined symbols,"
8401 echo "*** because either the platform does not support them or"
8402 echo "*** it was explicitly requested with -no-undefined,"
8403 echo "*** libtool will only create a static version of it."
8404 if test "$build_old_libs" = no; then
8405 oldlibs="$output_objdir/$libname.$libext"
8406 build_libtool_libs=module
8409 build_libtool_libs=no
8414 # Done checking deplibs!
8417 # Time to change all our "foo.ltframework" stuff back to "-framework foo"
8420 newdeplibs=`$ECHO " $newdeplibs" | $SED 's% \([^ $]*\).ltframework% -framework \1%g'`
8421 new_inherited_linker_flags=`$ECHO " $new_inherited_linker_flags" | $SED 's% \([^ $]*\).ltframework% -framework \1%g'`
8422 deplibs=`$ECHO " $deplibs" | $SED 's% \([^ $]*\).ltframework% -framework \1%g'`
8426 # move library search paths that coincide with paths to not yet
8427 # installed libraries to the beginning of the library search list
8429 for path in $notinst_path; do
8430 case " $new_libs " in
8431 *" -L$path/$objdir "*) ;;
8433 case " $deplibs " in
8434 *" -L$path/$objdir "*)
8435 new_libs+=" -L$path/$objdir" ;;
8440 for deplib in $deplibs; do
8443 case " $new_libs " in
8445 *) new_libs+=" $deplib" ;;
8448 *) new_libs+=" $deplib" ;;
8453 # All the library-specific variables (install_libdir is set above).
8458 # Test again, we may have decided not to build it any more
8459 if test "$build_libtool_libs" = yes; then
8460 if test "$hardcode_into_libs" = yes; then
8461 # Hardcode the library paths
8464 rpath="$finalize_rpath"
8465 test "$opt_mode" != relink && rpath="$compile_rpath$rpath"
8466 for libdir in $rpath; do
8467 if test -n "$hardcode_libdir_flag_spec"; then
8468 if test -n "$hardcode_libdir_separator"; then
8469 func_replace_sysroot "$libdir"
8470 libdir=$func_replace_sysroot_result
8471 if test -z "$hardcode_libdirs"; then
8472 hardcode_libdirs="$libdir"
8474 # Just accumulate the unique libdirs.
8475 case $hardcode_libdir_separator$hardcode_libdirs$hardcode_libdir_separator in
8476 *"$hardcode_libdir_separator$libdir$hardcode_libdir_separator"*)
8479 hardcode_libdirs+="$hardcode_libdir_separator$libdir"
8484 eval flag=\"$hardcode_libdir_flag_spec\"
8487 elif test -n "$runpath_var"; then
8488 case "$perm_rpath " in
8490 *) func_apped perm_rpath " $libdir" ;;
8494 # Substitute the hardcoded libdirs into the rpath.
8495 if test -n "$hardcode_libdir_separator" &&
8496 test -n "$hardcode_libdirs"; then
8497 libdir="$hardcode_libdirs"
8498 if test -n "$hardcode_libdir_flag_spec_ld"; then
8499 eval dep_rpath=\"$hardcode_libdir_flag_spec_ld\"
8501 eval dep_rpath=\"$hardcode_libdir_flag_spec\"
8504 if test -n "$runpath_var" && test -n "$perm_rpath"; then
8505 # We should set the runpath_var.
8507 for dir in $perm_rpath; do
8510 eval "$runpath_var='$rpath\$$runpath_var'; export $runpath_var"
8512 test -n "$dep_rpath" && deplibs="$dep_rpath $deplibs"
8515 shlibpath="$finalize_shlibpath"
8516 test "$opt_mode" != relink && shlibpath="$compile_shlibpath$shlibpath"
8517 if test -n "$shlibpath"; then
8518 eval "$shlibpath_var='$shlibpath\$$shlibpath_var'; export $shlibpath_var"
8521 # Get the real and link names of the library.
8522 eval shared_ext=\"$shrext_cmds\"
8523 eval library_names=\"$library_names_spec\"
8524 set dummy $library_names
8529 if test -n "$soname_spec"; then
8530 eval soname=\"$soname_spec\"
8534 if test -z "$dlname"; then
8538 lib="$output_objdir/$realname"
8545 # Use standard objects if they are pic
8546 test -z "$pic_flag" && libobjs=`$ECHO "$libobjs" | $SP2NL | $SED "$lo2o" | $NL2SP`
8547 test "X$libobjs" = "X " && libobjs=
8550 if test -n "$export_symbols" && test -n "$include_expsyms"; then
8551 $opt_dry_run || cp "$export_symbols" "$output_objdir/$libname.uexp"
8552 export_symbols="$output_objdir/$libname.uexp"
8553 delfiles+=" $export_symbols"
8556 orig_export_symbols=
8558 cygwin* | mingw* | cegcc*)
8559 if test -n "$export_symbols" && test -z "$export_symbols_regex"; then
8560 # exporting using user supplied symfile
8561 if test "x`$SED 1q $export_symbols`" != xEXPORTS; then
8562 # and it's NOT already a .def file. Must figure out
8563 # which of the given symbols are data symbols and tag
8564 # them as such. So, trigger use of export_symbols_cmds.
8565 # export_symbols gets reassigned inside the "prepare
8566 # the list of exported symbols" if statement, so the
8567 # include_expsyms logic still works.
8568 orig_export_symbols="$export_symbols"
8570 always_export_symbols=yes
8576 # Prepare the list of exported symbols
8577 if test -z "$export_symbols"; then
8578 if test "$always_export_symbols" = yes || test -n "$export_symbols_regex"; then
8579 func_verbose "generating symbol list for \`$libname.la'"
8580 export_symbols="$output_objdir/$libname.exp"
8581 $opt_dry_run || $RM $export_symbols
8582 cmds=$export_symbols_cmds
8583 save_ifs="$IFS"; IFS='~'
8584 for cmd1 in $cmds; do
8586 # Take the normal branch if the nm_file_list_spec branch
8587 # doesn't work or if tool conversion is not needed.
8588 case $nm_file_list_spec~$to_tool_file_cmd in
8589 *~func_convert_file_noop | *~func_convert_file_msys_to_w32 | ~*)
8590 try_normal_branch=yes
8593 len=$func_len_result
8596 try_normal_branch=no
8599 if test "$try_normal_branch" = yes \
8600 && { test "$len" -lt "$max_cmd_len" \
8601 || test "$max_cmd_len" -le -1; }
8603 func_show_eval "$cmd" 'exit $?'
8604 skipped_export=false
8605 elif test -n "$nm_file_list_spec"; then
8606 func_basename "$output"
8607 output_la=$func_basename_result
8608 save_libobjs=$libobjs
8610 output=${output_objdir}/${output_la}.nm
8611 func_to_tool_file "$output"
8612 libobjs=$nm_file_list_spec$func_to_tool_file_result
8613 delfiles+=" $output"
8614 func_verbose "creating $NM input file list: $output"
8615 for obj in $save_libobjs; do
8616 func_to_tool_file "$obj"
8617 $ECHO "$func_to_tool_file_result"
8620 func_show_eval "$cmd" 'exit $?'
8622 libobjs=$save_libobjs
8623 skipped_export=false
8625 # The command line is too long to execute in one step.
8626 func_verbose "using reloadable object file for export list..."
8628 # Break out early, otherwise skipped_export may be
8629 # set to false by a later but shorter cmd.
8634 if test -n "$export_symbols_regex" && test "X$skipped_export" != "X:"; then
8635 func_show_eval '$EGREP -e "$export_symbols_regex" "$export_symbols" > "${export_symbols}T"'
8636 func_show_eval '$MV "${export_symbols}T" "$export_symbols"'
8641 if test -n "$export_symbols" && test -n "$include_expsyms"; then
8642 tmp_export_symbols="$export_symbols"
8643 test -n "$orig_export_symbols" && tmp_export_symbols="$orig_export_symbols"
8644 $opt_dry_run || eval '$ECHO "$include_expsyms" | $SP2NL >> "$tmp_export_symbols"'
8647 if test "X$skipped_export" != "X:" && test -n "$orig_export_symbols"; then
8648 # The given exports_symbols file has to be filtered, so filter it.
8649 func_verbose "filter symbol list for \`$libname.la' to tag DATA exports"
8650 # FIXME: $output_objdir/$libname.filter potentially contains lots of
8651 # 's' commands which not all seds can handle. GNU sed should be fine
8652 # though. Also, the filter scales superlinearly with the number of
8653 # global variables. join(1) would be nice here, but unfortunately
8654 # isn't a blessed tool.
8655 $opt_dry_run || $SED -e '/[ ,]DATA/!d;s,\(.*\)\([ \,].*\),s|^\1$|\1\2|,' < $export_symbols > $output_objdir/$libname.filter
8656 delfiles+=" $export_symbols $output_objdir/$libname.filter"
8657 export_symbols=$output_objdir/$libname.def
8658 $opt_dry_run || $SED -f $output_objdir/$libname.filter < $orig_export_symbols > $export_symbols
8662 for test_deplib in $deplibs; do
8663 case " $convenience " in
8664 *" $test_deplib "*) ;;
8666 tmp_deplibs+=" $test_deplib"
8670 deplibs="$tmp_deplibs"
8672 if test -n "$convenience"; then
8673 if test -n "$whole_archive_flag_spec" &&
8674 test "$compiler_needs_object" = yes &&
8675 test -z "$libobjs"; then
8676 # extract the archives, so we have objects to list.
8677 # TODO: could optimize this to just extract one archive.
8678 whole_archive_flag_spec=
8680 if test -n "$whole_archive_flag_spec"; then
8681 save_libobjs=$libobjs
8682 eval libobjs=\"\$libobjs $whole_archive_flag_spec\"
8683 test "X$libobjs" = "X " && libobjs=
8685 gentop="$output_objdir/${outputname}x"
8686 generated+=" $gentop"
8688 func_extract_archives $gentop $convenience
8689 libobjs+=" $func_extract_archives_result"
8690 test "X$libobjs" = "X " && libobjs=
8694 if test "$thread_safe" = yes && test -n "$thread_safe_flag_spec"; then
8695 eval flag=\"$thread_safe_flag_spec\"
8696 linker_flags+=" $flag"
8699 # Make a backup of the uninstalled library when relinking
8700 if test "$opt_mode" = relink; then
8701 $opt_dry_run || eval '(cd $output_objdir && $RM ${realname}U && $MV $realname ${realname}U)' || exit $?
8704 # Do each of the archive commands.
8705 if test "$module" = yes && test -n "$module_cmds" ; then
8706 if test -n "$export_symbols" && test -n "$module_expsym_cmds"; then
8707 eval test_cmds=\"$module_expsym_cmds\"
8708 cmds=$module_expsym_cmds
8710 eval test_cmds=\"$module_cmds\"
8714 if test -n "$export_symbols" && test -n "$archive_expsym_cmds"; then
8715 eval test_cmds=\"$archive_expsym_cmds\"
8716 cmds=$archive_expsym_cmds
8718 eval test_cmds=\"$archive_cmds\"
8723 if test "X$skipped_export" != "X:" &&
8724 func_len " $test_cmds" &&
8725 len=$func_len_result &&
8726 test "$len" -lt "$max_cmd_len" || test "$max_cmd_len" -le -1; then
8729 # The command line is too long to link in one step, link piecewise
8730 # or, if using GNU ld and skipped_export is not :, use a linker
8733 # Save the value of $output and $libobjs because we want to
8734 # use them later. If we have whole_archive_flag_spec, we
8735 # want to use save_libobjs as it was before
8736 # whole_archive_flag_spec was expanded, because we can't
8737 # assume the linker understands whole_archive_flag_spec.
8738 # This may have to be revisited, in case too many
8739 # convenience libraries get linked in and end up exceeding
8741 if test -z "$convenience" || test -z "$whole_archive_flag_spec"; then
8742 save_libobjs=$libobjs
8745 func_basename "$output"
8746 output_la=$func_basename_result
8748 # Clear the reloadable object creation command queue and
8749 # initialize k to one.
8756 if test -n "$save_libobjs" && test "X$skipped_export" != "X:" && test "$with_gnu_ld" = yes; then
8757 output=${output_objdir}/${output_la}.lnkscript
8758 func_verbose "creating GNU ld script: $output"
8759 echo 'INPUT (' > $output
8760 for obj in $save_libobjs
8762 func_to_tool_file "$obj"
8763 $ECHO "$func_to_tool_file_result" >> $output
8766 delfiles+=" $output"
8767 func_to_tool_file "$output"
8768 output=$func_to_tool_file_result
8769 elif test -n "$save_libobjs" && test "X$skipped_export" != "X:" && test "X$file_list_spec" != X; then
8770 output=${output_objdir}/${output_la}.lnk
8771 func_verbose "creating linker input file list: $output"
8776 if test "$compiler_needs_object" = yes; then
8782 func_to_tool_file "$obj"
8783 $ECHO "$func_to_tool_file_result" >> $output
8785 delfiles+=" $output"
8786 func_to_tool_file "$output"
8787 output=$firstobj\"$file_list_spec$func_to_tool_file_result\"
8789 if test -n "$save_libobjs"; then
8790 func_verbose "creating reloadable object files..."
8791 output=$output_objdir/$output_la-${k}.$objext
8792 eval test_cmds=\"$reload_cmds\"
8793 func_len " $test_cmds"
8794 len0=$func_len_result
8797 # Loop over the list of objects to be linked.
8798 for obj in $save_libobjs
8801 func_arith $len + $func_len_result
8802 len=$func_arith_result
8803 if test "X$objlist" = X ||
8804 test "$len" -lt "$max_cmd_len"; then
8807 # The command $test_cmds is almost too long, add a
8808 # command to the queue.
8809 if test "$k" -eq 1 ; then
8810 # The first file doesn't have a previous command to add.
8811 reload_objs=$objlist
8812 eval concat_cmds=\"$reload_cmds\"
8814 # All subsequent reloadable object files will link in
8815 # the last one created.
8816 reload_objs="$objlist $last_robj"
8817 eval concat_cmds=\"\$concat_cmds~$reload_cmds~\$RM $last_robj\"
8819 last_robj=$output_objdir/$output_la-${k}.$objext
8821 k=$func_arith_result
8822 output=$output_objdir/$output_la-${k}.$objext
8824 func_len " $last_robj"
8825 func_arith $len0 + $func_len_result
8826 len=$func_arith_result
8829 # Handle the remaining objects by creating one last
8830 # reloadable object file. All subsequent reloadable object
8831 # files will link in the last one created.
8832 test -z "$concat_cmds" || concat_cmds=$concat_cmds~
8833 reload_objs="$objlist $last_robj"
8834 eval concat_cmds=\"\${concat_cmds}$reload_cmds\"
8835 if test -n "$last_robj"; then
8836 eval concat_cmds=\"\${concat_cmds}~\$RM $last_robj\"
8838 delfiles+=" $output"
8844 if ${skipped_export-false}; then
8845 func_verbose "generating symbol list for \`$libname.la'"
8846 export_symbols="$output_objdir/$libname.exp"
8847 $opt_dry_run || $RM $export_symbols
8849 # Append the command to create the export file.
8850 test -z "$concat_cmds" || concat_cmds=$concat_cmds~
8851 eval concat_cmds=\"\$concat_cmds$export_symbols_cmds\"
8852 if test -n "$last_robj"; then
8853 eval concat_cmds=\"\$concat_cmds~\$RM $last_robj\"
8857 test -n "$save_libobjs" &&
8858 func_verbose "creating a temporary reloadable object file: $output"
8860 # Loop through the commands generated above and execute them.
8861 save_ifs="$IFS"; IFS='~'
8862 for cmd in $concat_cmds; do
8865 func_quote_for_expand "$cmd"
8866 eval "func_echo $func_quote_for_expand_result"
8868 $opt_dry_run || eval "$cmd" || {
8871 # Restore the uninstalled library and exit
8872 if test "$opt_mode" = relink; then
8873 ( cd "$output_objdir" && \
8874 $RM "${realname}T" && \
8875 $MV "${realname}U" "$realname" )
8883 if test -n "$export_symbols_regex" && ${skipped_export-false}; then
8884 func_show_eval '$EGREP -e "$export_symbols_regex" "$export_symbols" > "${export_symbols}T"'
8885 func_show_eval '$MV "${export_symbols}T" "$export_symbols"'
8889 if ${skipped_export-false}; then
8890 if test -n "$export_symbols" && test -n "$include_expsyms"; then
8891 tmp_export_symbols="$export_symbols"
8892 test -n "$orig_export_symbols" && tmp_export_symbols="$orig_export_symbols"
8893 $opt_dry_run || eval '$ECHO "$include_expsyms" | $SP2NL >> "$tmp_export_symbols"'
8896 if test -n "$orig_export_symbols"; then
8897 # The given exports_symbols file has to be filtered, so filter it.
8898 func_verbose "filter symbol list for \`$libname.la' to tag DATA exports"
8899 # FIXME: $output_objdir/$libname.filter potentially contains lots of
8900 # 's' commands which not all seds can handle. GNU sed should be fine
8901 # though. Also, the filter scales superlinearly with the number of
8902 # global variables. join(1) would be nice here, but unfortunately
8903 # isn't a blessed tool.
8904 $opt_dry_run || $SED -e '/[ ,]DATA/!d;s,\(.*\)\([ \,].*\),s|^\1$|\1\2|,' < $export_symbols > $output_objdir/$libname.filter
8905 delfiles+=" $export_symbols $output_objdir/$libname.filter"
8906 export_symbols=$output_objdir/$libname.def
8907 $opt_dry_run || $SED -f $output_objdir/$libname.filter < $orig_export_symbols > $export_symbols
8912 # Restore the value of output.
8915 if test -n "$convenience" && test -n "$whole_archive_flag_spec"; then
8916 eval libobjs=\"\$libobjs $whole_archive_flag_spec\"
8917 test "X$libobjs" = "X " && libobjs=
8919 # Expand the library linking commands again to reset the
8920 # value of $libobjs for piecewise linking.
8922 # Do each of the archive commands.
8923 if test "$module" = yes && test -n "$module_cmds" ; then
8924 if test -n "$export_symbols" && test -n "$module_expsym_cmds"; then
8925 cmds=$module_expsym_cmds
8930 if test -n "$export_symbols" && test -n "$archive_expsym_cmds"; then
8931 cmds=$archive_expsym_cmds
8938 if test -n "$delfiles"; then
8939 # Append the command to remove temporary files to $cmds.
8940 eval cmds=\"\$cmds~\$RM $delfiles\"
8943 # Add any objects from preloaded convenience libraries
8944 if test -n "$dlprefiles"; then
8945 gentop="$output_objdir/${outputname}x"
8946 generated+=" $gentop"
8948 func_extract_archives $gentop $dlprefiles
8949 libobjs+=" $func_extract_archives_result"
8950 test "X$libobjs" = "X " && libobjs=
8953 save_ifs="$IFS"; IFS='~'
8954 for cmd in $cmds; do
8958 func_quote_for_expand "$cmd"
8959 eval "func_echo $func_quote_for_expand_result"
8961 $opt_dry_run || eval "$cmd" || {
8964 # Restore the uninstalled library and exit
8965 if test "$opt_mode" = relink; then
8966 ( cd "$output_objdir" && \
8967 $RM "${realname}T" && \
8968 $MV "${realname}U" "$realname" )
8976 # Restore the uninstalled library and exit
8977 if test "$opt_mode" = relink; then
8978 $opt_dry_run || eval '(cd $output_objdir && $RM ${realname}T && $MV $realname ${realname}T && $MV ${realname}U $realname)' || exit $?
8980 if test -n "$convenience"; then
8981 if test -z "$whole_archive_flag_spec"; then
8982 func_show_eval '${RM}r "$gentop"'
8989 # Create links to the real library.
8990 for linkname in $linknames; do
8991 if test "$realname" != "$linkname"; then
8992 func_show_eval '(cd "$output_objdir" && $RM "$linkname" && $LN_S "$realname" "$linkname")' 'exit $?'
8996 # If -module or -export-dynamic was specified, set the dlname.
8997 if test "$module" = yes || test "$export_dynamic" = yes; then
8998 # On all known operating systems, these are identical.
9005 if test -n "$dlfiles$dlprefiles" || test "$dlself" != no; then
9006 func_warning "\`-dlopen' is ignored for objects"
9011 func_warning "\`-l' and \`-L' are ignored for objects" ;;
9014 test -n "$rpath" && \
9015 func_warning "\`-rpath' is ignored for objects"
9017 test -n "$xrpath" && \
9018 func_warning "\`-R' is ignored for objects"
9020 test -n "$vinfo" && \
9021 func_warning "\`-version-info' is ignored for objects"
9023 test -n "$release" && \
9024 func_warning "\`-release' is ignored for objects"
9028 test -n "$objs$old_deplibs" && \
9029 func_fatal_error "cannot build library object \`$output' from non-libtool objects"
9033 obj=$func_lo2o_result
9041 # Delete the old objects.
9042 $opt_dry_run || $RM $obj $libobj
9044 # Objects from convenience libraries. This assumes
9045 # single-version convenience libraries. Whenever we create
9046 # different ones for PIC/non-PIC, this we'll have to duplicate
9050 # reload_cmds runs $LD directly, so let us get rid of
9051 # -Wl from whole_archive_flag_spec and hope we can get by with
9052 # turning comma into space..
9055 if test -n "$convenience"; then
9056 if test -n "$whole_archive_flag_spec"; then
9057 eval tmp_whole_archive_flags=\"$whole_archive_flag_spec\"
9058 reload_conv_objs=$reload_objs\ `$ECHO "$tmp_whole_archive_flags" | $SED 's|,| |g'`
9060 gentop="$output_objdir/${obj}x"
9061 generated+=" $gentop"
9063 func_extract_archives $gentop $convenience
9064 reload_conv_objs="$reload_objs $func_extract_archives_result"
9068 # If we're not building shared, we need to use non_pic_objs
9069 test "$build_libtool_libs" != yes && libobjs="$non_pic_objects"
9071 # Create the old-style object.
9072 reload_objs="$objs$old_deplibs "`$ECHO "$libobjs" | $SP2NL | $SED "/\.${libext}$/d; /\.lib$/d; $lo2o" | $NL2SP`" $reload_conv_objs" ### testsuite: skip nested quoting test
9075 func_execute_cmds "$reload_cmds" 'exit $?'
9077 # Exit if we aren't doing a library object file.
9078 if test -z "$libobj"; then
9079 if test -n "$gentop"; then
9080 func_show_eval '${RM}r "$gentop"'
9086 if test "$build_libtool_libs" != yes; then
9087 if test -n "$gentop"; then
9088 func_show_eval '${RM}r "$gentop"'
9091 # Create an invalid libtool object if no PIC, so that we don't
9092 # accidentally link it into a program.
9093 # $show "echo timestamp > $libobj"
9094 # $opt_dry_run || eval "echo timestamp > $libobj" || exit $?
9098 if test -n "$pic_flag" || test "$pic_mode" != default; then
9099 # Only do commands if we really have different PIC objects.
9100 reload_objs="$libobjs $reload_conv_objs"
9102 func_execute_cmds "$reload_cmds" 'exit $?'
9105 if test -n "$gentop"; then
9106 func_show_eval '${RM}r "$gentop"'
9114 *cygwin*) func_stripname '' '.exe' "$output"
9115 output=$func_stripname_result.exe;;
9117 test -n "$vinfo" && \
9118 func_warning "\`-version-info' is ignored for programs"
9120 test -n "$release" && \
9121 func_warning "\`-release' is ignored for programs"
9123 test "$preload" = yes \
9124 && test "$dlopen_support" = unknown \
9125 && test "$dlopen_self" = unknown \
9126 && test "$dlopen_self_static" = unknown && \
9127 func_warning "\`LT_INIT([dlopen])' not used. Assuming no dlopen support."
9130 *-*-rhapsody* | *-*-darwin1.[012])
9131 # On Rhapsody replace the C library is the System framework
9132 compile_deplibs=`$ECHO " $compile_deplibs" | $SED 's/ -lc / System.ltframework /'`
9133 finalize_deplibs=`$ECHO " $finalize_deplibs" | $SED 's/ -lc / System.ltframework /'`
9139 # Don't allow lazy linking, it breaks C++ global constructors
9140 # But is supposedly fixed on 10.4 or later (yay!).
9141 if test "$tagname" = CXX ; then
9142 case ${MACOSX_DEPLOYMENT_TARGET-10.0} in
9144 compile_command+=" ${wl}-bind_at_load"
9145 finalize_command+=" ${wl}-bind_at_load"
9149 # Time to change all our "foo.ltframework" stuff back to "-framework foo"
9150 compile_deplibs=`$ECHO " $compile_deplibs" | $SED 's% \([^ $]*\).ltframework% -framework \1%g'`
9151 finalize_deplibs=`$ECHO " $finalize_deplibs" | $SED 's% \([^ $]*\).ltframework% -framework \1%g'`
9156 # move library search paths that coincide with paths to not yet
9157 # installed libraries to the beginning of the library search list
9159 for path in $notinst_path; do
9160 case " $new_libs " in
9161 *" -L$path/$objdir "*) ;;
9163 case " $compile_deplibs " in
9164 *" -L$path/$objdir "*)
9165 new_libs+=" -L$path/$objdir" ;;
9170 for deplib in $compile_deplibs; do
9173 case " $new_libs " in
9175 *) new_libs+=" $deplib" ;;
9178 *) new_libs+=" $deplib" ;;
9181 compile_deplibs="$new_libs"
9184 compile_command+=" $compile_deplibs"
9185 finalize_command+=" $finalize_deplibs"
9187 if test -n "$rpath$xrpath"; then
9188 # If the user specified any rpath flags, then add them.
9189 for libdir in $rpath $xrpath; do
9190 # This is the magic to use -rpath.
9191 case "$finalize_rpath " in
9193 *) finalize_rpath+=" $libdir" ;;
9198 # Now hardcode the library paths
9201 for libdir in $compile_rpath $finalize_rpath; do
9202 if test -n "$hardcode_libdir_flag_spec"; then
9203 if test -n "$hardcode_libdir_separator"; then
9204 if test -z "$hardcode_libdirs"; then
9205 hardcode_libdirs="$libdir"
9207 # Just accumulate the unique libdirs.
9208 case $hardcode_libdir_separator$hardcode_libdirs$hardcode_libdir_separator in
9209 *"$hardcode_libdir_separator$libdir$hardcode_libdir_separator"*)
9212 hardcode_libdirs+="$hardcode_libdir_separator$libdir"
9217 eval flag=\"$hardcode_libdir_flag_spec\"
9220 elif test -n "$runpath_var"; then
9221 case "$perm_rpath " in
9223 *) perm_rpath+=" $libdir" ;;
9227 *-*-cygwin* | *-*-mingw* | *-*-pw32* | *-*-os2* | *-cegcc*)
9228 testbindir=`${ECHO} "$libdir" | ${SED} -e 's*/lib$*/bin*'`
9229 case :$dllsearchpath: in
9231 ::) dllsearchpath=$libdir;;
9232 *) dllsearchpath+=":$libdir";;
9234 case :$dllsearchpath: in
9235 *":$testbindir:"*) ;;
9236 ::) dllsearchpath=$testbindir;;
9237 *) dllsearchpath+=":$testbindir";;
9242 # Substitute the hardcoded libdirs into the rpath.
9243 if test -n "$hardcode_libdir_separator" &&
9244 test -n "$hardcode_libdirs"; then
9245 libdir="$hardcode_libdirs"
9246 eval rpath=\" $hardcode_libdir_flag_spec\"
9248 compile_rpath="$rpath"
9252 for libdir in $finalize_rpath; do
9253 if test -n "$hardcode_libdir_flag_spec"; then
9254 if test -n "$hardcode_libdir_separator"; then
9255 if test -z "$hardcode_libdirs"; then
9256 hardcode_libdirs="$libdir"
9258 # Just accumulate the unique libdirs.
9259 case $hardcode_libdir_separator$hardcode_libdirs$hardcode_libdir_separator in
9260 *"$hardcode_libdir_separator$libdir$hardcode_libdir_separator"*)
9263 hardcode_libdirs+="$hardcode_libdir_separator$libdir"
9268 eval flag=\"$hardcode_libdir_flag_spec\"
9271 elif test -n "$runpath_var"; then
9272 case "$finalize_perm_rpath " in
9274 *) finalize_perm_rpath+=" $libdir" ;;
9278 # Substitute the hardcoded libdirs into the rpath.
9279 if test -n "$hardcode_libdir_separator" &&
9280 test -n "$hardcode_libdirs"; then
9281 libdir="$hardcode_libdirs"
9282 eval rpath=\" $hardcode_libdir_flag_spec\"
9284 finalize_rpath="$rpath"
9286 if test -n "$libobjs" && test "$build_old_libs" = yes; then
9287 # Transform all the library objects into standard objects.
9288 compile_command=`$ECHO "$compile_command" | $SP2NL | $SED "$lo2o" | $NL2SP`
9289 finalize_command=`$ECHO "$finalize_command" | $SP2NL | $SED "$lo2o" | $NL2SP`
9292 func_generate_dlsyms "$outputname" "@PROGRAM@" "no"
9294 # template prelinking step
9295 if test -n "$prelink_cmds"; then
9296 func_execute_cmds "$prelink_cmds" 'exit $?'
9299 wrappers_required=yes
9301 *cegcc* | *mingw32ce*)
9302 # Disable wrappers for cegcc and mingw32ce hosts, we are cross compiling anyway.
9303 wrappers_required=no
9305 *cygwin* | *mingw* )
9306 if test "$build_libtool_libs" != yes; then
9307 wrappers_required=no
9311 if test "$need_relink" = no || test "$build_libtool_libs" != yes; then
9312 wrappers_required=no
9316 if test "$wrappers_required" = no; then
9317 # Replace the output file specification.
9318 compile_command=`$ECHO "$compile_command" | $SED 's%@OUTPUT@%'"$output"'%g'`
9319 link_command="$compile_command$compile_rpath"
9321 # We have no uninstalled library dependencies, so finalize right now.
9323 func_show_eval "$link_command" 'exit_status=$?'
9325 if test -n "$postlink_cmds"; then
9326 func_to_tool_file "$output"
9327 postlink_cmds=`func_echo_all "$postlink_cmds" | $SED -e 's%@OUTPUT@%'"$output"'%g' -e 's%@TOOL_OUTPUT@%'"$func_to_tool_file_result"'%g'`
9328 func_execute_cmds "$postlink_cmds" 'exit $?'
9331 # Delete the generated files.
9332 if test -f "$output_objdir/${outputname}S.${objext}"; then
9333 func_show_eval '$RM "$output_objdir/${outputname}S.${objext}"'
9339 if test -n "$compile_shlibpath$finalize_shlibpath"; then
9340 compile_command="$shlibpath_var=\"$compile_shlibpath$finalize_shlibpath\$$shlibpath_var\" $compile_command"
9342 if test -n "$finalize_shlibpath"; then
9343 finalize_command="$shlibpath_var=\"$finalize_shlibpath\$$shlibpath_var\" $finalize_command"
9348 if test -n "$runpath_var"; then
9349 if test -n "$perm_rpath"; then
9350 # We should set the runpath_var.
9352 for dir in $perm_rpath; do
9355 compile_var="$runpath_var=\"$rpath\$$runpath_var\" "
9357 if test -n "$finalize_perm_rpath"; then
9358 # We should set the runpath_var.
9360 for dir in $finalize_perm_rpath; do
9363 finalize_var="$runpath_var=\"$rpath\$$runpath_var\" "
9367 if test "$no_install" = yes; then
9368 # We don't need to create a wrapper script.
9369 link_command="$compile_var$compile_command$compile_rpath"
9370 # Replace the output file specification.
9371 link_command=`$ECHO "$link_command" | $SED 's%@OUTPUT@%'"$output"'%g'`
9372 # Delete the old output file.
9373 $opt_dry_run || $RM $output
9374 # Link the executable and exit
9375 func_show_eval "$link_command" 'exit $?'
9377 if test -n "$postlink_cmds"; then
9378 func_to_tool_file "$output"
9379 postlink_cmds=`func_echo_all "$postlink_cmds" | $SED -e 's%@OUTPUT@%'"$output"'%g' -e 's%@TOOL_OUTPUT@%'"$func_to_tool_file_result"'%g'`
9380 func_execute_cmds "$postlink_cmds" 'exit $?'
9386 if test "$hardcode_action" = relink; then
9387 # Fast installation is not supported
9388 link_command="$compile_var$compile_command$compile_rpath"
9389 relink_command="$finalize_var$finalize_command$finalize_rpath"
9391 func_warning "this platform does not like uninstalled shared libraries"
9392 func_warning "\`$output' will be relinked during installation"
9394 if test "$fast_install" != no; then
9395 link_command="$finalize_var$compile_command$finalize_rpath"
9396 if test "$fast_install" = yes; then
9397 relink_command=`$ECHO "$compile_var$compile_command$compile_rpath" | $SED 's%@OUTPUT@%\$progdir/\$file%g'`
9399 # fast_install is set to needless
9403 link_command="$compile_var$compile_command$compile_rpath"
9404 relink_command="$finalize_var$finalize_command$finalize_rpath"
9408 # Replace the output file specification.
9409 link_command=`$ECHO "$link_command" | $SED 's%@OUTPUT@%'"$output_objdir/$outputname"'%g'`
9411 # Delete the old output files.
9412 $opt_dry_run || $RM $output $output_objdir/$outputname $output_objdir/lt-$outputname
9414 func_show_eval "$link_command" 'exit $?'
9416 if test -n "$postlink_cmds"; then
9417 func_to_tool_file "$output_objdir/$outputname"
9418 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'`
9419 func_execute_cmds "$postlink_cmds" 'exit $?'
9422 # Now create the wrapper script.
9423 func_verbose "creating $output"
9425 # Quote the relink command for shipping.
9426 if test -n "$relink_command"; then
9427 # Preserve any variables that may affect compiler behavior
9428 for var in $variables_saved_for_relink; do
9429 if eval test -z \"\${$var+set}\"; then
9430 relink_command="{ test -z \"\${$var+set}\" || $lt_unset $var || { $var=; export $var; }; }; $relink_command"
9431 elif eval var_value=\$$var; test -z "$var_value"; then
9432 relink_command="$var=; export $var; $relink_command"
9434 func_quote_for_eval "$var_value"
9435 relink_command="$var=$func_quote_for_eval_result; export $var; $relink_command"
9438 relink_command="(cd `pwd`; $relink_command)"
9439 relink_command=`$ECHO "$relink_command" | $SED "$sed_quote_subst"`
9442 # Only actually do things if not in dry run mode.
9444 # win32 will think the script is a binary if it has
9445 # a .exe suffix, so we strip it off here.
9447 *.exe) func_stripname '' '.exe' "$output"
9448 output=$func_stripname_result ;;
9450 # test for cygwin because mv fails w/o .exe extensions
9454 func_stripname '' '.exe' "$outputname"
9455 outputname=$func_stripname_result ;;
9459 *cygwin* | *mingw* )
9460 func_dirname_and_basename "$output" "" "."
9461 output_name=$func_basename_result
9462 output_path=$func_dirname_result
9463 cwrappersource="$output_path/$objdir/lt-$output_name.c"
9464 cwrapper="$output_path/$output_name.exe"
9465 $RM $cwrappersource $cwrapper
9466 trap "$RM $cwrappersource $cwrapper; exit $EXIT_FAILURE" 1 2 15
9468 func_emit_cwrapperexe_src > $cwrappersource
9470 # The wrapper executable is built using the $host compiler,
9471 # because it contains $host paths and files. If cross-
9472 # compiling, it, like the target executable, must be
9473 # executed on the $host or under an emulation environment.
9475 $LTCC $LTCFLAGS -o $cwrapper $cwrappersource
9479 # Now, create the wrapper script for func_source use:
9480 func_ltwrapper_scriptname $cwrapper
9481 $RM $func_ltwrapper_scriptname_result
9482 trap "$RM $func_ltwrapper_scriptname_result; exit $EXIT_FAILURE" 1 2 15
9484 # note: this script will not be executed, so do not chmod.
9485 if test "x$build" = "x$host" ; then
9486 $cwrapper --lt-dump-script > $func_ltwrapper_scriptname_result
9488 func_emit_wrapper no > $func_ltwrapper_scriptname_result
9494 trap "$RM $output; exit $EXIT_FAILURE" 1 2 15
9496 func_emit_wrapper no > $output
9505 # See if we need to build an old-fashioned archive.
9506 for oldlib in $oldlibs; do
9508 if test "$build_libtool_libs" = convenience; then
9509 oldobjs="$libobjs_save $symfileobj"
9510 addlibs="$convenience"
9511 build_libtool_libs=no
9513 if test "$build_libtool_libs" = module; then
9514 oldobjs="$libobjs_save"
9515 build_libtool_libs=no
9517 oldobjs="$old_deplibs $non_pic_objects"
9518 if test "$preload" = yes && test -f "$symfileobj"; then
9519 oldobjs+=" $symfileobj"
9522 addlibs="$old_convenience"
9525 if test -n "$addlibs"; then
9526 gentop="$output_objdir/${outputname}x"
9527 generated+=" $gentop"
9529 func_extract_archives $gentop $addlibs
9530 oldobjs+=" $func_extract_archives_result"
9533 # Do each command in the archive commands.
9534 if test -n "$old_archive_from_new_cmds" && test "$build_libtool_libs" = yes; then
9535 cmds=$old_archive_from_new_cmds
9538 # Add any objects from preloaded convenience libraries
9539 if test -n "$dlprefiles"; then
9540 gentop="$output_objdir/${outputname}x"
9541 generated+=" $gentop"
9543 func_extract_archives $gentop $dlprefiles
9544 oldobjs+=" $func_extract_archives_result"
9547 # POSIX demands no paths to be encoded in archives. We have
9548 # to avoid creating archives with duplicate basenames if we
9549 # might have to extract them afterwards, e.g., when creating a
9550 # static archive out of a convenience library, or when linking
9551 # the entirety of a libtool archive into another (currently
9552 # not supported by libtool).
9553 if (for obj in $oldobjs
9555 func_basename "$obj"
9556 $ECHO "$func_basename_result"
9557 done | sort | sort -uc >/dev/null 2>&1); then
9560 echo "copying selected object files to avoid basename conflicts..."
9561 gentop="$output_objdir/${outputname}x"
9562 generated+=" $gentop"
9563 func_mkdir_p "$gentop"
9564 save_oldobjs=$oldobjs
9567 for obj in $save_oldobjs
9569 func_basename "$obj"
9570 objbase="$func_basename_result"
9571 case " $oldobjs " in
9572 " ") oldobjs=$obj ;;
9575 # Make sure we don't pick an alternate name that also
9577 newobj=lt$counter-$objbase
9578 func_arith $counter + 1
9579 counter=$func_arith_result
9580 case " $oldobjs " in
9581 *[\ /]"$newobj "*) ;;
9582 *) if test ! -f "$gentop/$newobj"; then break; fi ;;
9585 func_show_eval "ln $obj $gentop/$newobj || cp $obj $gentop/$newobj"
9586 oldobjs+=" $gentop/$newobj"
9588 *) oldobjs+=" $obj" ;;
9592 eval cmds=\"$old_archive_cmds\"
9595 len=$func_len_result
9596 if test "$len" -lt "$max_cmd_len" || test "$max_cmd_len" -le -1; then
9597 cmds=$old_archive_cmds
9598 elif test -n "$archiver_list_spec"; then
9599 func_verbose "using command file archive linking..."
9602 func_to_tool_file "$obj"
9603 $ECHO "$func_to_tool_file_result"
9604 done > $output_objdir/$libname.libcmd
9605 func_to_tool_file "$output_objdir/$libname.libcmd"
9606 oldobjs=" $archiver_list_spec$func_to_tool_file_result"
9607 cmds=$old_archive_cmds
9609 # the command line is too long to link in one step, link in parts
9610 func_verbose "using piecewise archive linking..."
9615 save_oldobjs=$oldobjs
9617 # Is there a better way of finding the last object in the list?
9618 for obj in $save_oldobjs
9622 eval test_cmds=\"$old_archive_cmds\"
9623 func_len " $test_cmds"
9624 len0=$func_len_result
9626 for obj in $save_oldobjs
9629 func_arith $len + $func_len_result
9630 len=$func_arith_result
9632 if test "$len" -lt "$max_cmd_len"; then
9635 # the above command should be used before it gets too long
9637 if test "$obj" = "$last_oldobj" ; then
9640 test -z "$concat_cmds" || concat_cmds=$concat_cmds~
9641 eval concat_cmds=\"\${concat_cmds}$old_archive_cmds\"
9648 if test "X$oldobjs" = "X" ; then
9649 eval cmds=\"\$concat_cmds\"
9651 eval cmds=\"\$concat_cmds~\$old_archive_cmds\"
9655 func_execute_cmds "$cmds" 'exit $?'
9658 test -n "$generated" && \
9659 func_show_eval "${RM}r$generated"
9661 # Now create the libtool archive.
9665 test "$build_old_libs" = yes && old_library="$libname.$libext"
9666 func_verbose "creating $output"
9668 # Preserve any variables that may affect compiler behavior
9669 for var in $variables_saved_for_relink; do
9670 if eval test -z \"\${$var+set}\"; then
9671 relink_command="{ test -z \"\${$var+set}\" || $lt_unset $var || { $var=; export $var; }; }; $relink_command"
9672 elif eval var_value=\$$var; test -z "$var_value"; then
9673 relink_command="$var=; export $var; $relink_command"
9675 func_quote_for_eval "$var_value"
9676 relink_command="$var=$func_quote_for_eval_result; export $var; $relink_command"
9679 # Quote the link command for shipping.
9680 relink_command="(cd `pwd`; $SHELL $progpath $preserve_args --mode=relink $libtool_args @inst_prefix_dir@)"
9681 relink_command=`$ECHO "$relink_command" | $SED "$sed_quote_subst"`
9682 if test "$hardcode_automatic" = yes ; then
9686 # Only create the output if not a dry run.
9688 for installed in no yes; do
9689 if test "$installed" = yes; then
9690 if test -z "$install_libdir"; then
9693 output="$output_objdir/$outputname"i
9694 # Replace all uninstalled libtool libraries with the installed ones
9696 for deplib in $dependency_libs; do
9699 func_basename "$deplib"
9700 name="$func_basename_result"
9701 eval libdir=`${SED} -n -e 's/^libdir=\(.*\)$/\1/p' $deplib`
9702 test -z "$libdir" && \
9703 func_fatal_error "\`$deplib' is not a valid libtool archive"
9704 newdependency_libs+=" ${lt_sysroot:+=}$libdir/$name"
9707 func_stripname -L '' "$deplib"
9708 func_replace_sysroot "$func_stripname_result"
9709 newdependency_libs+=" -L$func_replace_sysroot_result"
9712 func_stripname -R '' "$deplib"
9713 func_replace_sysroot "$func_stripname_result"
9714 newdependency_libs+=" -R$func_replace_sysroot_result"
9716 *) newdependency_libs+=" $deplib" ;;
9719 dependency_libs="$newdependency_libs"
9722 for lib in $dlfiles; do
9725 func_basename "$lib"
9726 name="$func_basename_result"
9727 eval libdir=`${SED} -n -e 's/^libdir=\(.*\)$/\1/p' $lib`
9728 test -z "$libdir" && \
9729 func_fatal_error "\`$lib' is not a valid libtool archive"
9730 newdlfiles+=" ${lt_sysroot:+=}$libdir/$name"
9732 *) newdlfiles+=" $lib" ;;
9735 dlfiles="$newdlfiles"
9737 for lib in $dlprefiles; do
9740 # Only pass preopened files to the pseudo-archive (for
9741 # eventual linking with the app. that links it) if we
9742 # didn't already link the preopened objects directly into
9744 func_basename "$lib"
9745 name="$func_basename_result"
9746 eval libdir=`${SED} -n -e 's/^libdir=\(.*\)$/\1/p' $lib`
9747 test -z "$libdir" && \
9748 func_fatal_error "\`$lib' is not a valid libtool archive"
9749 newdlprefiles+=" ${lt_sysroot:+=}$libdir/$name"
9753 dlprefiles="$newdlprefiles"
9756 for lib in $dlfiles; do
9758 [\\/]* | [A-Za-z]:[\\/]*) abs="$lib" ;;
9759 *) abs=`pwd`"/$lib" ;;
9763 dlfiles="$newdlfiles"
9765 for lib in $dlprefiles; do
9767 [\\/]* | [A-Za-z]:[\\/]*) abs="$lib" ;;
9768 *) abs=`pwd`"/$lib" ;;
9770 newdlprefiles+=" $abs"
9772 dlprefiles="$newdlprefiles"
9775 # place dlname in correct position for cygwin
9776 # In fact, it would be nice if we could use this code for all target
9777 # systems that can't hard-code library paths into their executables
9778 # and that have no shared library path variable independent of PATH,
9779 # but it turns out we can't easily determine that from inspecting
9780 # libtool variables, so we have to hard-code the OSs to which it
9781 # applies here; at the moment, that means platforms that use the PE
9782 # object format with DLL files. See the long comment at the top of
9783 # tests/bindir.at for full details.
9785 case $host,$output,$installed,$module,$dlname in
9786 *cygwin*,*lai,yes,no,*.dll | *mingw*,*lai,yes,no,*.dll | *cegcc*,*lai,yes,no,*.dll)
9787 # If a -bindir argument was supplied, place the dll there.
9788 if test "x$bindir" != x ;
9790 func_relative_path "$install_libdir" "$bindir"
9791 tdlname=$func_relative_path_result$dlname
9793 # Otherwise fall back on heuristic.
9794 tdlname=../bin/$dlname
9799 # $outputname - a libtool library file
9800 # Generated by $PROGRAM (GNU $PACKAGE$TIMESTAMP) $VERSION
9802 # Please DO NOT delete this file!
9803 # It is necessary for linking the library.
9805 # The name that we can dlopen(3).
9808 # Names of this library.
9809 library_names='$library_names'
9811 # The name of the static archive.
9812 old_library='$old_library'
9814 # Linker flags that can not go in dependency_libs.
9815 inherited_linker_flags='$new_inherited_linker_flags'
9817 # Libraries that this one depends upon.
9818 dependency_libs='$dependency_libs'
9820 # Names of additional weak libraries provided by this library
9821 weak_library_names='$weak_libs'
9823 # Version information for $libname.
9828 # Is this an already installed library?
9829 installed=$installed
9831 # Should we warn about portability when linking against -modules?
9832 shouldnotlink=$module
9834 # Files to dlopen/dlpreopen
9836 dlpreopen='$dlprefiles'
9838 # Directory that this library needs to be installed in:
9839 libdir='$install_libdir'"
9840 if test "$installed" = no && test "$need_relink" = yes; then
9842 relink_command=\"$relink_command\""
9847 # Do a symbolic link so that the libtool archive can be found in
9848 # LD_LIBRARY_PATH before the program is installed.
9849 func_show_eval '( cd "$output_objdir" && $RM "$outputname" && $LN_S "../$outputname" "$outputname" )' 'exit $?'
9855 { test "$opt_mode" = link || test "$opt_mode" = relink; } &&
9856 func_mode_link ${1+"$@"}
9859 # func_mode_uninstall arg...
9860 func_mode_uninstall ()
9868 # This variable tells wrapper scripts just to set variables rather
9869 # than running their programs.
9870 libtool_install_magic="$magic"
9875 -f) RM+=" $arg"; rmforce=yes ;;
9877 *) files+=" $arg" ;;
9882 func_fatal_help "you must specify an RM program"
9886 for file in $files; do
9887 func_dirname "$file" "" "."
9888 dir="$func_dirname_result"
9889 if test "X$dir" = X.; then
9894 func_basename "$file"
9895 name="$func_basename_result"
9896 test "$opt_mode" = uninstall && odir="$dir"
9898 # Remember odir for removal later, being careful to avoid duplicates
9899 if test "$opt_mode" = clean; then
9902 *) rmdirs+=" $odir" ;;
9906 # Don't error if the file doesn't exist and rm -f was used.
9907 if { test -L "$file"; } >/dev/null 2>&1 ||
9908 { test -h "$file"; } >/dev/null 2>&1 ||
9909 test -f "$file"; then
9911 elif test -d "$file"; then
9914 elif test "$rmforce" = yes; then
9922 # Possibly a libtool archive, so verify it.
9923 if func_lalib_p "$file"; then
9924 func_source $dir/$name
9926 # Delete the libtool libraries and symlinks.
9927 for n in $library_names; do
9928 rmfiles+=" $odir/$n"
9930 test -n "$old_library" && rmfiles+=" $odir/$old_library"
9934 case " $library_names " in
9936 *) test -n "$dlname" && rmfiles+=" $odir/$dlname" ;;
9938 test -n "$libdir" && rmfiles+=" $odir/$name $odir/${name}i"
9941 if test -n "$library_names"; then
9942 # Do each command in the postuninstall commands.
9943 func_execute_cmds "$postuninstall_cmds" 'test "$rmforce" = yes || exit_status=1'
9946 if test -n "$old_library"; then
9947 # Do each command in the old_postuninstall commands.
9948 func_execute_cmds "$old_postuninstall_cmds" 'test "$rmforce" = yes || exit_status=1'
9950 # FIXME: should reinstall the best remaining shared library.
9957 # Possibly a libtool object, so verify it.
9958 if func_lalib_p "$file"; then
9961 func_source $dir/$name
9963 # Add PIC object to the list of files to remove.
9964 if test -n "$pic_object" &&
9965 test "$pic_object" != none; then
9966 rmfiles+=" $dir/$pic_object"
9969 # Add non-PIC object to the list of files to remove.
9970 if test -n "$non_pic_object" &&
9971 test "$non_pic_object" != none; then
9972 rmfiles+=" $dir/$non_pic_object"
9978 if test "$opt_mode" = clean ; then
9982 func_stripname '' '.exe' "$file"
9983 file=$func_stripname_result
9984 func_stripname '' '.exe' "$name"
9985 noexename=$func_stripname_result
9986 # $file with .exe has already been added to rmfiles,
9987 # add $file without .exe
9991 # Do a test to see if this is a libtool program.
9992 if func_ltwrapper_p "$file"; then
9993 if func_ltwrapper_executable_p "$file"; then
9994 func_ltwrapper_scriptname "$file"
9996 func_source $func_ltwrapper_scriptname_result
9997 rmfiles+=" $func_ltwrapper_scriptname_result"
10000 func_source $dir/$noexename
10003 # note $name still contains .exe if it was in $file originally
10004 # as does the version of $file that was added into $rmfiles
10005 rmfiles+=" $odir/$name $odir/${name}S.${objext}"
10006 if test "$fast_install" = yes && test -n "$relink_command"; then
10007 rmfiles+=" $odir/lt-$name"
10009 if test "X$noexename" != "X$name" ; then
10010 rmfiles+=" $odir/lt-${noexename}.c"
10016 func_show_eval "$RM $rmfiles" 'exit_status=1'
10019 # Try to remove the ${objdir}s in the directories where we deleted files
10020 for dir in $rmdirs; do
10021 if test -d "$dir"; then
10022 func_show_eval "rmdir $dir >/dev/null 2>&1"
10029 { test "$opt_mode" = uninstall || test "$opt_mode" = clean; } &&
10030 func_mode_uninstall ${1+"$@"}
10032 test -z "$opt_mode" && {
10033 help="$generic_help"
10034 func_fatal_help "you must specify a MODE"
10037 test -z "$exec_cmd" && \
10038 func_fatal_help "invalid operation mode \`$opt_mode'"
10040 if test -n "$exec_cmd"; then
10041 eval exec "$exec_cmd"
10048 # The TAGs below are defined such that we never get into a situation
10049 # in which we disable both kinds of libraries. Given conflicting
10050 # choices, we go for a static library, that is the most portable,
10051 # since we can't tell whether shared libraries were disabled because
10052 # the user asked for that or because the platform doesn't support
10053 # them. This is particularly important on AIX, because we don't
10054 # support having both static and shared libraries enabled at the same
10055 # time on that platform, so we default to a shared-only configuration.
10056 # If a disable-shared tag is given, we'll fallback to a static-only
10057 # configuration. But we'll never go from static-only to shared-only.
10059 # ### BEGIN LIBTOOL TAG CONFIG: disable-shared
10060 build_libtool_libs=no
10062 # ### END LIBTOOL TAG CONFIG: disable-shared
10064 # ### BEGIN LIBTOOL TAG CONFIG: disable-static
10065 build_old_libs=`case $build_libtool_libs in yes) echo no;; *) echo yes;; esac`
10066 # ### END LIBTOOL TAG CONFIG: disable-static
10069 # mode:shell-script
10075 # ### BEGIN LIBTOOL TAG CONFIG: CXX
10077 # The linker used to build libraries.
10080 # How to create reloadable object files.
10082 reload_cmds="\$LD\$reload_flag -o \$output\$reload_objs"
10084 # Commands used to build an old-style archive.
10085 old_archive_cmds="\$AR \$AR_FLAGS \$oldlib\$oldobjs~\$RANLIB \$oldlib"
10087 # A language specific compiler.
10090 # Is the compiler the GNU compiler?
10093 # Compiler flag to turn off builtin functions.
10094 no_builtin_flag=" -fno-builtin"
10096 # Additional compiler flags for building library objects.
10097 pic_flag=" -fPIC -DPIC"
10099 # How to pass a linker flag through the compiler.
10102 # Compiler flag to prevent dynamic linking.
10103 link_static_flag="-static"
10105 # Does compiler simultaneously support -c and -o options?
10108 # Whether or not to add -lc for building shared libraries.
10109 build_libtool_need_lc=no
10111 # Whether or not to disallow shared libs when runtime libs are static.
10112 allow_libtool_libs_with_static_runtimes=no
10114 # Compiler flag to allow reflexive dlopens.
10115 export_dynamic_flag_spec="\${wl}--export-dynamic"
10117 # Compiler flag to generate shared objects directly from archives.
10118 whole_archive_flag_spec="\${wl}--whole-archive\$convenience \${wl}--no-whole-archive"
10120 # Whether the compiler copes with passing no objects directly.
10121 compiler_needs_object="no"
10123 # Create an old-style archive from a shared archive.
10124 old_archive_from_new_cmds=""
10126 # Create a temporary old-style archive to link instead of a shared archive.
10127 old_archive_from_expsyms_cmds=""
10129 # Commands used to build a shared archive.
10130 archive_cmds="\$CC \$pic_flag -shared -nostdlib \$predep_objects \$libobjs \$deplibs \$postdep_objects \$compiler_flags \${wl}-soname \$wl\$soname -o \$lib"
10131 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"
10133 # Commands used to build a loadable module if different from building
10134 # a shared archive.
10136 module_expsym_cmds=""
10138 # Whether we are building with GNU ld or not.
10141 # Flag that allows shared libraries with undefined symbols to be built.
10142 allow_undefined_flag=""
10144 # Flag that enforces no undefined symbols.
10145 no_undefined_flag=""
10147 # Flag to hardcode $libdir into a binary during linking.
10148 # This must work even if $libdir does not exist
10149 hardcode_libdir_flag_spec="\${wl}-rpath \${wl}\$libdir"
10151 # If ld is used when linking, flag to hardcode $libdir into a binary
10152 # during linking. This must work even if $libdir does not exist.
10153 hardcode_libdir_flag_spec_ld=""
10155 # Whether we need a single "-rpath" flag with a separated argument.
10156 hardcode_libdir_separator=""
10158 # Set to "yes" if using DIR/libNAME${shared_ext} during linking hardcodes
10159 # DIR into the resulting binary.
10162 # Set to "yes" if using DIR/libNAME${shared_ext} during linking hardcodes
10163 # DIR into the resulting binary and the resulting library dependency is
10164 # "absolute",i.e impossible to change by setting ${shlibpath_var} if the
10165 # library is relocated.
10166 hardcode_direct_absolute=no
10168 # Set to "yes" if using the -LDIR flag during linking hardcodes DIR
10169 # into the resulting binary.
10170 hardcode_minus_L=no
10172 # Set to "yes" if using SHLIBPATH_VAR=DIR during linking hardcodes DIR
10173 # into the resulting binary.
10174 hardcode_shlibpath_var=unsupported
10176 # Set to "yes" if building a shared library automatically hardcodes DIR
10177 # into the library and all subsequent libraries and executables linked
10179 hardcode_automatic=no
10181 # Set to yes if linker adds runtime paths of dependent libraries
10182 # to runtime path list.
10185 # Whether libtool must link a program against all its dependency libraries.
10186 link_all_deplibs=unknown
10188 # Set to "yes" if exported symbols are required.
10189 always_export_symbols=no
10191 # The commands to list exported symbols.
10192 export_symbols_cmds="\$NM \$libobjs \$convenience | \$global_symbol_pipe | \$SED 's/.* //' | sort | uniq > \$export_symbols"
10194 # Symbols that should not be listed in the preloaded symbols.
10195 exclude_expsyms="_GLOBAL_OFFSET_TABLE_|_GLOBAL__F[ID]_.*"
10197 # Symbols that must always be exported.
10200 # Commands necessary for linking programs (against libraries) with templates.
10203 # Commands necessary for finishing linking programs.
10206 # Specify filename containing input files.
10209 # How to hardcode a shared library path into an executable.
10210 hardcode_action=immediate
10212 # The directories searched by this compiler when creating a shared library.
10213 compiler_lib_search_dirs="/usr/lib/gcc/i686-linux-gnu/4.6.1 /usr/lib/gcc/i686-linux-gnu/4.6.1/../../../i386-linux-gnu /usr/lib/gcc/i686-linux-gnu/4.6.1/../../../../lib /lib/i386-linux-gnu /lib/../lib /usr/lib/i386-linux-gnu /usr/lib/../lib /usr/lib/gcc/i686-linux-gnu/4.6.1/../../.."
10215 # Dependencies to place before and after the objects being linked to
10216 # create a shared library.
10217 predep_objects="/usr/lib/gcc/i686-linux-gnu/4.6.1/../../../i386-linux-gnu/crti.o /usr/lib/gcc/i686-linux-gnu/4.6.1/crtbeginS.o"
10218 postdep_objects="/usr/lib/gcc/i686-linux-gnu/4.6.1/crtendS.o /usr/lib/gcc/i686-linux-gnu/4.6.1/../../../i386-linux-gnu/crtn.o"
10220 postdeps="-lstdc++ -lm -lgcc_s -lc -lgcc_s"
10222 # The library search path used internally by the compiler when linking
10223 # a shared library.
10224 compiler_lib_search_path="-L/usr/lib/gcc/i686-linux-gnu/4.6.1 -L/usr/lib/gcc/i686-linux-gnu/4.6.1/../../../i386-linux-gnu -L/usr/lib/gcc/i686-linux-gnu/4.6.1/../../../../lib -L/lib/i386-linux-gnu -L/lib/../lib -L/usr/lib/i386-linux-gnu -L/usr/lib/../lib -L/usr/lib/gcc/i686-linux-gnu/4.6.1/../../.."
10226 # ### END LIBTOOL TAG CONFIG: CXX