3 # libtool - Provide generalized library-building support services.
4 # Generated automatically by config.status (ImageMagick) 6.5.7-9
5 # Libtool was configured on host magick.imagemagick.org:
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 Free Software Foundation, Inc.
10 # Written by Gordon Matzigkeit, 1996
12 # This file is part of GNU Libtool.
14 # GNU Libtool is free software; you can redistribute it and/or
15 # modify it under the terms of the GNU General Public License as
16 # published by the Free Software Foundation; either version 2 of
17 # the License, or (at your option) any later version.
19 # As a special exception to the GNU General Public License,
20 # if you distribute this file as part of a program or library that
21 # is built using GNU Libtool, you may include this file under the
22 # same distribution terms that you use for the rest of that program.
24 # GNU Libtool is distributed in the hope that it will be useful,
25 # but WITHOUT ANY WARRANTY; without even the implied warranty of
26 # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
27 # GNU General Public License for more details.
29 # You should have received a copy of the GNU General Public License
30 # along with GNU Libtool; see the file COPYING. If not, a copy
31 # can be downloaded from http://www.gnu.org/licenses/gpl.html, or
32 # obtained by writing to the Free Software Foundation, Inc.,
33 # 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
36 # The names of the tagged configurations supported by this script.
39 # ### BEGIN LIBTOOL CONFIG
41 # A sed program that does not truncate output.
44 # Sed that helps us avoid accidentally triggering echo(1) options like -n.
45 Xsed="$SED -e 1s/^X//"
47 # A grep program that handles long lines.
53 # A literal string matcher.
56 # Shell to use when invoking shell scripts.
59 # An echo program that protects backslashes.
62 # Which release of libtool.m4 was used?
69 # DLL creation program.
72 # Object dumper program.
75 # Whether or not to build shared libraries.
76 build_libtool_libs=yes
78 # Whether or not to build static libraries.
81 # What type of objects to build.
84 # Whether or not to optimize for fast installation.
89 host=x86_64-unknown-linux-gnu
94 build=x86_64-unknown-linux-gnu
97 # A BSD- or MS-compatible name lister.
100 # Whether we need soft or hard links.
103 # What is the maximum length of a command?
106 # Object file suffix (normally "o").
109 # Executable file suffix (normally "").
112 # whether the shell understands "unset".
115 # turn spaces into newlines.
116 SP2NL="tr \\040 \\012"
118 # turn newlines into spaces.
119 NL2SP="tr \\015\\012 \\040\\040"
121 # Method to check whether dependent libraries are shared objects.
122 deplibs_check_method="pass_all"
124 # Command to use when deplibs_check_method == "file_magic".
125 file_magic_cmd="\$MAGIC_CMD"
131 # A symbol stripping program.
134 # Commands used to install an old-style archive.
136 old_postinstall_cmds="chmod 644 \$oldlib~\$RANLIB \$oldlib"
137 old_postuninstall_cmds=""
139 # Whether to use a lock for old archive extraction.
140 lock_old_archive_extraction=no
143 LTCC="gcc -std=gnu99"
145 # LTCC compiler flags.
146 LTCFLAGS="-fopenmp -g -O2 -Wall -W -pthread"
148 # Take the output of nm and produce a listing of raw symbols and C names.
149 global_symbol_pipe="sed -n -e 's/^.*[ ]\\([ABCDGIRSTW][ABCDGIRSTW]*\\)[ ][ ]*\\([_A-Za-z][_A-Za-z0-9]*\\)\$/\\1 \\2 \\2/p'"
151 # Transform the output of nm in a proper C declaration.
152 global_symbol_to_cdecl="sed -n -e 's/^T .* \\(.*\\)\$/extern int \\1();/p' -e 's/^[ABCDGIRSTW]* .* \\(.*\\)\$/extern char \\1;/p'"
154 # Transform the output of nm in a C name address pair.
155 global_symbol_to_c_name_address="sed -n -e 's/^: \\([^ ]*\\) \$/ {\\\"\\1\\\", (void *) 0},/p' -e 's/^[ABCDGIRSTW]* \\([^ ]*\\) \\([^ ]*\\)\$/ {\"\\2\", (void *) \\&\\2},/p'"
157 # Transform the output of nm in a C name address pair when lib prefix is needed.
158 global_symbol_to_c_name_address_lib_prefix="sed -n -e 's/^: \\([^ ]*\\) \$/ {\\\"\\1\\\", (void *) 0},/p' -e 's/^[ABCDGIRSTW]* \\([^ ]*\\) \\(lib[^ ]*\\)\$/ {\"\\2\", (void *) \\&\\2},/p' -e 's/^[ABCDGIRSTW]* \\([^ ]*\\) \\([^ ]*\\)\$/ {\"lib\\2\", (void *) \\&\\2},/p'"
160 # The name of the directory that contains temporary libtool files.
163 # Used to examine libraries when file_magic_cmd begins with "file".
166 # Must we lock files when doing compilation?
169 # Tool to manipulate archived DWARF debug symbol files on Mac OS X.
172 # Tool to change global to local symbols on Mac OS X.
175 # Tool to manipulate fat objects and archives on Mac OS X.
178 # ldd/readelf like tool for Mach-O binaries on Mac OS X.
181 # ldd/readelf like tool for 64 bit Mach-O binaries on Mac OS X 10.4.
184 # Old archive suffix (normally "a").
187 # Shared library suffix (normally ".so").
190 # The commands to extract the exported symbol list from a shared archive.
191 extract_expsyms_cmds=""
193 # Variables whose values should be saved in libtool wrapper scripts and
194 # restored at link time.
195 variables_saved_for_relink="PATH LD_LIBRARY_PATH LD_RUN_PATH GCC_EXEC_PREFIX COMPILER_PATH LIBRARY_PATH"
197 # Do we need the "lib" prefix for modules?
200 # Do we need a version for libraries?
203 # Library versioning type.
206 # Shared library runtime path variable.
207 runpath_var=LD_RUN_PATH
209 # Shared library path variable.
210 shlibpath_var=LD_LIBRARY_PATH
212 # Is shlibpath searched before the hard-coded library search path?
213 shlibpath_overrides_runpath=no
215 # Format of library name prefix.
216 libname_spec="lib\$name"
218 # List of archive names. First name is the real one, the rest are links.
219 # The last name is the one that the linker finds with -lNAME
220 library_names_spec="\${libname}\${release}\${shared_ext}\$versuffix \${libname}\${release}\${shared_ext}\$major \$libname\${shared_ext}"
222 # The coded name of the library, if different from the real name.
223 soname_spec="\${libname}\${release}\${shared_ext}\$major"
225 # Permission mode override for installation of shared libraries.
226 install_override_mode=""
228 # Command to use after installation of a shared archive.
231 # Command to use after uninstallation of a shared archive.
232 postuninstall_cmds=""
234 # Commands used to finish a libtool library installation in a directory.
235 finish_cmds="PATH=\\\"\\\$PATH:/sbin\\\" ldconfig -n \$libdir"
237 # As "finish_cmds", except a single script fragment to be evaled but
241 # Whether we should hardcode library paths into libraries.
242 hardcode_into_libs=yes
244 # Compile-time system search path for libraries.
245 sys_lib_search_path_spec="/usr/lib/gcc/x86_64-redhat-linux/4.4.2 /usr/lib64 /lib64 "
247 # Run-time system search path for libraries.
248 sys_lib_dlsearch_path_spec="/lib /usr/lib /usr/lib64/atlas /usr/lib64/mysql /usr/lib64/openmotif /usr/lib64/qt-3.3/lib /usr/lib64/xulrunner-1.9.1 "
250 # Whether dlopen is supported.
253 # Whether dlopen of programs is supported.
256 # Whether dlopen of statically linked programs is supported.
257 dlopen_self_static=yes
259 # Commands to strip libraries.
260 old_striplib="strip --strip-debug"
261 striplib="strip --strip-unneeded"
264 # The linker used to build libraries.
265 LD="/usr/bin/ld -m elf_x86_64"
267 # How to create reloadable object files.
269 reload_cmds="\$LD\$reload_flag -o \$output\$reload_objs"
271 # Commands used to build an old-style archive.
272 old_archive_cmds="\$AR \$AR_FLAGS \$oldlib\$oldobjs~\$RANLIB \$oldlib"
274 # A language specific compiler.
277 # Is the compiler the GNU compiler?
280 # Compiler flag to turn off builtin functions.
281 no_builtin_flag=" -fno-builtin"
283 # How to pass a linker flag through the compiler.
286 # Additional compiler flags for building library objects.
287 pic_flag=" -fPIC -DPIC"
289 # Compiler flag to prevent dynamic linking.
292 # Does compiler simultaneously support -c and -o options?
295 # Whether or not to add -lc for building shared libraries.
296 build_libtool_need_lc=no
298 # Whether or not to disallow shared libs when runtime libs are static.
299 allow_libtool_libs_with_static_runtimes=no
301 # Compiler flag to allow reflexive dlopens.
302 export_dynamic_flag_spec="\${wl}--export-dynamic"
304 # Compiler flag to generate shared objects directly from archives.
305 whole_archive_flag_spec="\${wl}--whole-archive\$convenience \${wl}--no-whole-archive"
307 # Whether the compiler copes with passing no objects directly.
308 compiler_needs_object="no"
310 # Create an old-style archive from a shared archive.
311 old_archive_from_new_cmds=""
313 # Create a temporary old-style archive to link instead of a shared archive.
314 old_archive_from_expsyms_cmds=""
316 # Commands used to build a shared archive.
317 archive_cmds="\$CC -shared \$libobjs \$deplibs \$compiler_flags \${wl}-soname \$wl\$soname -o \$lib"
318 archive_expsym_cmds="echo \\\"{ global:\\\" > \$output_objdir/\$libname.ver~
319 cat \$export_symbols | sed -e \\\"s/\\\\(.*\\\\)/\\\\1;/\\\" >> \$output_objdir/\$libname.ver~
320 echo \\\"local: *; };\\\" >> \$output_objdir/\$libname.ver~
321 \$CC -shared \$libobjs \$deplibs \$compiler_flags \${wl}-soname \$wl\$soname \${wl}-version-script \${wl}\$output_objdir/\$libname.ver -o \$lib"
323 # Commands used to build a loadable module if different from building
326 module_expsym_cmds=""
328 # Whether we are building with GNU ld or not.
331 # Flag that allows shared libraries with undefined symbols to be built.
332 allow_undefined_flag=""
334 # Flag that enforces no undefined symbols.
337 # Flag to hardcode $libdir into a binary during linking.
338 # This must work even if $libdir does not exist
339 hardcode_libdir_flag_spec="\${wl}-rpath \${wl}\$libdir"
341 # If ld is used when linking, flag to hardcode $libdir into a binary
342 # during linking. This must work even if $libdir does not exist.
343 hardcode_libdir_flag_spec_ld=""
345 # Whether we need a single "-rpath" flag with a separated argument.
346 hardcode_libdir_separator=""
348 # Set to "yes" if using DIR/libNAME${shared_ext} during linking hardcodes
349 # DIR into the resulting binary.
352 # Set to "yes" if using DIR/libNAME${shared_ext} during linking hardcodes
353 # DIR into the resulting binary and the resulting library dependency is
354 # "absolute",i.e impossible to change by setting ${shlibpath_var} if the
355 # library is relocated.
356 hardcode_direct_absolute=no
358 # Set to "yes" if using the -LDIR flag during linking hardcodes DIR
359 # into the resulting binary.
362 # Set to "yes" if using SHLIBPATH_VAR=DIR during linking hardcodes DIR
363 # into the resulting binary.
364 hardcode_shlibpath_var=unsupported
366 # Set to "yes" if building a shared library automatically hardcodes DIR
367 # into the library and all subsequent libraries and executables linked
369 hardcode_automatic=no
371 # Set to yes if linker adds runtime paths of dependent libraries
372 # to runtime path list.
375 # Whether libtool must link a program against all its dependency libraries.
376 link_all_deplibs=unknown
378 # Fix the shell variable $srcfile for the compiler.
381 # Set to "yes" if exported symbols are required.
382 always_export_symbols=no
384 # The commands to list exported symbols.
385 export_symbols_cmds="\$NM \$libobjs \$convenience | \$global_symbol_pipe | \$SED 's/.* //' | sort | uniq > \$export_symbols"
387 # Symbols that should not be listed in the preloaded symbols.
388 exclude_expsyms="_GLOBAL_OFFSET_TABLE_|_GLOBAL__F[ID]_.*"
390 # Symbols that must always be exported.
393 # Commands necessary for linking programs (against libraries) with templates.
396 # Specify filename containing input files.
399 # How to hardcode a shared library path into an executable.
400 hardcode_action=immediate
402 # The directories searched by this compiler when creating a shared library.
403 compiler_lib_search_dirs=""
405 # Dependencies to place before and after the objects being linked to
406 # create a shared library.
412 # The library search path used internally by the compiler when linking
414 compiler_lib_search_path=""
416 # ### END LIBTOOL CONFIG
418 # Generated from ltmain.m4sh.
420 # libtool (GNU libtool 1.3130 2009-11-16) 2.2.7a
421 # Written by Gordon Matzigkeit <gord@gnu.ai.mit.edu>, 1996
423 # Copyright (C) 1996, 1997, 1998, 1999, 2000, 2001, 2003, 2004, 2005, 2006,
424 # 2007, 2008, 2009 Free Software Foundation, Inc.
425 # This is free software; see the source for copying conditions. There is NO
426 # warranty; not even for MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
428 # GNU Libtool is free software; you can redistribute it and/or modify
429 # it under the terms of the GNU General Public License as published by
430 # the Free Software Foundation; either version 2 of the License, or
431 # (at your option) any later version.
433 # As a special exception to the GNU General Public License,
434 # if you distribute this file as part of a program or library that
435 # is built using GNU Libtool, you may include this file under the
436 # same distribution terms that you use for the rest of that program.
438 # GNU Libtool is distributed in the hope that it will be useful, but
439 # WITHOUT ANY WARRANTY; without even the implied warranty of
440 # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
441 # General Public License for more details.
443 # You should have received a copy of the GNU General Public License
444 # along with GNU Libtool; see the file COPYING. If not, a copy
445 # can be downloaded from http://www.gnu.org/licenses/gpl.html,
446 # or obtained by writing to the Free Software Foundation, Inc.,
447 # 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
449 # Usage: $progname [OPTION]... [MODE-ARG]...
451 # Provide generalized library-building support services.
453 # --config show all configuration variables
454 # --debug enable verbose shell tracing
455 # -n, --dry-run display commands without modifying any files
456 # --features display basic configuration information and exit
457 # --mode=MODE use operation mode MODE
458 # --preserve-dup-deps don't remove duplicate dependency libraries
459 # --quiet, --silent don't print informational messages
460 # --no-quiet, --no-silent
461 # print informational messages (default)
462 # --tag=TAG use configuration variables from tag TAG
463 # -v, --verbose print more informational messages than default
464 # --no-verbose don't print the extra informational messages
465 # --version print version information
466 # -h, --help, --help-all print short, long, or detailed help message
468 # MODE must be one of the following:
470 # clean remove files from the build directory
471 # compile compile a source file into a libtool object
472 # execute automatically set library path, then run a program
473 # finish complete the installation of libtool libraries
474 # install install libraries or executables
475 # link create a library or an executable
476 # uninstall remove libraries from an installed directory
478 # MODE-ARGS vary depending on the MODE. When passed as first option,
479 # `--mode=MODE' may be abbreviated as `MODE' or a unique abbreviation of that.
480 # Try `$progname --help --mode=MODE' for a more detailed description of MODE.
482 # When reporting a bug, please describe a test case to reproduce it and
483 # include the following information:
485 # host-triplet: $host
488 # compiler flags: $LTCFLAGS
489 # linker: $LD (gnu? $with_gnu_ld)
490 # $progname: (GNU libtool 1.3130 2009-11-16) 2.2.7a
491 # automake: $automake_version
492 # autoconf: $autoconf_version
494 # Report bugs to <bug-libtool@gnu.org>.
499 TIMESTAMP=" 1.3130 2009-11-16"
500 package_revision=1.3130
502 # Be Bourne compatible
503 if test -n "${ZSH_VERSION+set}" && (emulate sh) >/dev/null 2>&1; then
506 # Zsh 3.x and 4.x performs word splitting on ${1+"$@"}, which
507 # is contrary to our usage. Disable this feature.
508 alias -g '${1+"$@"}'='"$@"'
511 case `(set -o) 2>/dev/null` in *posix*) set -o posix;; esac
513 BIN_SH=xpg4; export BIN_SH # for Tru64
514 DUALCASE=1; export DUALCASE # for MKS sh
516 # A function that is used when there is no print builtin or printf.
517 func_fallback_echo ()
519 eval 'cat <<_LTECHO_EOF
524 # NLS nuisances: We save the old values to restore during execute mode.
525 # Only set LANG and LC_ALL to C if already set.
526 # These must not be set unconditionally because not all systems understand
527 # e.g. LANG=C (notably SCO).
530 for lt_var in LANG LANGUAGE LC_ALL LC_CTYPE LC_COLLATE LC_MESSAGES
532 eval "if test \"\${$lt_var+set}\" = set; then
533 save_$lt_var=\$$lt_var
536 lt_user_locale=\"$lt_var=\\\$save_\$lt_var; \$lt_user_locale\"
537 lt_safe_locale=\"$lt_var=C; \$lt_safe_locale\"
549 # Work around backward compatibility issue on IRIX 6.5. On IRIX 6.4+, sh
550 # is ksh but when the shell is invoked as "sh" and the current value of
551 # the _XPG environment variable is not equal to 1 (one), the special
552 # positional parameter $0, within a function call, is the name of the
569 : ${SHELL="${CONFIG_SHELL-/bin/sh}"}
570 : ${Xsed="$SED -e 1s/^X//"}
575 EXIT_MISMATCH=63 # $? = 63 is used to indicate version mismatch to missing.
576 EXIT_SKIP=77 # $? = 77 is used to indicate a skipped test to automake.
578 exit_status=$EXIT_SUCCESS
580 # Make sure IFS has a sensible default
585 dirname="s,/[^/]*$,,"
588 # func_dirname_and_basename file append nondir_replacement
589 # perform func_basename and func_dirname in a single function
591 # dirname: Compute the dirname of FILE. If nonempty,
592 # add APPEND to the result, otherwise set result
593 # to NONDIR_REPLACEMENT.
594 # value returned in "$func_dirname_result"
595 # basename: Compute filename of FILE.
596 # value retuned in "$func_basename_result"
597 # Implementation must be kept synchronized with func_dirname
598 # and func_basename. For efficiency, we do not delegate to
599 # those functions but instead duplicate the functionality here.
600 func_dirname_and_basename ()
602 # Extract subdirectory from the argument.
603 func_dirname_result=`$ECHO "${1}" | $SED -e "$dirname"`
604 if test "X$func_dirname_result" = "X${1}"; then
605 func_dirname_result="${3}"
607 func_dirname_result="$func_dirname_result${2}"
609 func_basename_result=`$ECHO "${1}" | $SED -e "$basename"`
612 # Generated shell functions inserted here.
614 # func_dirname file append nondir_replacement
615 # Compute the dirname of FILE. If nonempty, add APPEND to the result,
616 # otherwise set result to NONDIR_REPLACEMENT.
620 */*) func_dirname_result="${1%/*}${2}" ;;
621 * ) func_dirname_result="${3}" ;;
628 func_basename_result="${1##*/}"
631 # func_dirname_and_basename file append nondir_replacement
632 # perform func_basename and func_dirname in a single function
634 # dirname: Compute the dirname of FILE. If nonempty,
635 # add APPEND to the result, otherwise set result
636 # to NONDIR_REPLACEMENT.
637 # value returned in "$func_dirname_result"
638 # basename: Compute filename of FILE.
639 # value retuned in "$func_basename_result"
640 # Implementation must be kept synchronized with func_dirname
641 # and func_basename. For efficiency, we do not delegate to
642 # those functions but instead duplicate the functionality here.
643 func_dirname_and_basename ()
646 */*) func_dirname_result="${1%/*}${2}" ;;
647 * ) func_dirname_result="${3}" ;;
649 func_basename_result="${1##*/}"
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).
659 # pdksh 5.2.14 does not do ${X%$Y} correctly if both X and Y are
660 # positional parameters, so assign one to ordinary parameter first.
661 func_stripname_result=${3}
662 func_stripname_result=${func_stripname_result#"${1}"}
663 func_stripname_result=${func_stripname_result%"${2}"}
669 func_opt_split_opt=${1%%=*}
670 func_opt_split_arg=${1#*=}
677 *.lo) func_lo2o_result=${1%.lo}.${objext} ;;
678 *) func_lo2o_result=${1} ;;
682 # func_xform libobj-or-source
685 func_xform_result=${1%.*}.lo
688 # func_arith arithmetic-term...
691 func_arith_result=$(( $* ))
695 # STRING may not start with a hyphen.
698 func_len_result=${#1}
702 # func_append var value
703 # Append VALUE to the end of shell variable VAR.
708 # Generated shell functions inserted here.
710 # These SED scripts presuppose an absolute path with a trailing slash.
711 pathcar='s,^/\([^/]*\).*$,\1,'
712 pathcdr='s,^/[^/]*,,'
713 removedotparts=':dotsl
717 collapseslashes='s@/\{1,\}@/@g'
718 finalslash='s,/*$,/,'
720 # func_normal_abspath PATH
721 # Remove doubled-up and trailing slashes, "." path components,
722 # and cancel out any ".." path components in PATH after making
723 # it an absolute path.
724 # value returned in "$func_normal_abspath_result"
725 func_normal_abspath ()
727 # Start from root dir and reassemble the path.
728 func_normal_abspath_result=
729 func_normal_abspath_tpath=$1
730 func_normal_abspath_altnamespace=
731 case $func_normal_abspath_tpath in
733 # Empty path, that just means $cwd.
734 func_stripname '' '/' "`pwd`"
735 func_normal_abspath_result=$func_stripname_result
738 # The next three entries are used to spot a run of precisely
739 # two leading slashes without using negated character classes;
740 # we take advantage of case's first-match behaviour.
742 # Unusual form of absolute path, do nothing.
745 # Not necessarily an ordinary path; POSIX reserves leading '//'
746 # and for example Cygwin uses it to access remote file shares
747 # over CIFS/SMB, so we conserve a leading double slash if found.
748 func_normal_abspath_altnamespace=/
751 # Absolute path, do nothing.
754 # Relative path, prepend $cwd.
755 func_normal_abspath_tpath=`pwd`/$func_normal_abspath_tpath
758 # Cancel out all the simple stuff to save iterations. We also want
759 # the path to end with a slash for ease of parsing, so make sure
760 # there is one (and only one) here.
761 func_normal_abspath_tpath=`$ECHO "$func_normal_abspath_tpath" | $SED \
762 -e "$removedotparts" -e "$collapseslashes" -e "$finalslash"`
764 # Processed it all yet?
765 if test "$func_normal_abspath_tpath" = / ; then
766 # If we ascended to the root using ".." the result may be empty now.
767 if test -z "$func_normal_abspath_result" ; then
768 func_normal_abspath_result=/
772 func_normal_abspath_tcomponent=`$ECHO "$func_normal_abspath_tpath" | $SED \
774 func_normal_abspath_tpath=`$ECHO "$func_normal_abspath_tpath" | $SED \
776 # Figure out what to do with it
777 case $func_normal_abspath_tcomponent in
779 # Trailing empty path component, ignore it.
782 # Parent dir; strip last assembled component from result.
783 func_dirname "$func_normal_abspath_result"
784 func_normal_abspath_result=$func_dirname_result
787 # Actual path component, append it.
788 func_normal_abspath_result=$func_normal_abspath_result/$func_normal_abspath_tcomponent
792 # Restore leading double-slash if one was found on entry.
793 func_normal_abspath_result=$func_normal_abspath_altnamespace$func_normal_abspath_result
796 # func_relative_path SRCDIR DSTDIR
797 # generates a relative path from SRCDIR to DSTDIR, with a trailing
798 # slash if non-empty, suitable for immediately appending a filename
799 # without needing to append a separator.
800 # value returned in "$func_relative_path_result"
801 func_relative_path ()
803 func_relative_path_result=
804 func_normal_abspath "$1"
805 func_relative_path_tlibdir=$func_normal_abspath_result
806 func_normal_abspath "$2"
807 func_relative_path_tbindir=$func_normal_abspath_result
809 # Ascend the tree starting from libdir
811 # check if we have found a prefix of bindir
812 case $func_relative_path_tbindir in
813 $func_relative_path_tlibdir)
814 # found an exact match
815 func_relative_path_tcancelled=
818 $func_relative_path_tlibdir*)
819 # found a matching prefix
820 func_stripname "$func_relative_path_tlibdir" '' "$func_relative_path_tbindir"
821 func_relative_path_tcancelled=$func_stripname_result
822 if test -z "$func_relative_path_result"; then
823 func_relative_path_result=.
828 func_dirname $func_relative_path_tlibdir
829 func_relative_path_tlibdir=${func_dirname_result}
830 if test "x$func_relative_path_tlibdir" = x ; then
831 # Have to descend all the way to the root!
832 func_relative_path_result=../$func_relative_path_result
833 func_relative_path_tcancelled=$func_relative_path_tbindir
836 func_relative_path_result=../$func_relative_path_result
841 # Now calculate path; take care to avoid doubling-up slashes.
842 func_stripname '' '/' "$func_relative_path_result"
843 func_relative_path_result=$func_stripname_result
844 func_stripname '/' '/' "$func_relative_path_tcancelled"
845 if test "x$func_stripname_result" != x ; then
846 func_relative_path_result=${func_relative_path_result}/${func_stripname_result}
849 # Normalisation. If bindir is libdir, return empty string,
850 # else relative path ending with a slash; either way, target
851 # file name can be directly appended.
852 if test ! -z "$func_relative_path_result"; then
853 func_stripname './' '' "$func_relative_path_result/"
854 func_relative_path_result=$func_stripname_result
858 # The name of this program:
859 func_dirname_and_basename "$progpath"
860 progname=$func_basename_result
862 # Make sure we have an absolute path for reexecution:
864 [\\/]*|[A-Za-z]:\\*) ;;
866 progdir=$func_dirname_result
867 progdir=`cd "$progdir" && pwd`
868 progpath="$progdir/$progname"
873 for progdir in $PATH; do
875 test -x "$progdir/$progname" && break
878 test -n "$progdir" || progdir=`pwd`
879 progpath="$progdir/$progname"
883 # Sed substitution that helps us do robust quoting. It backslashifies
884 # metacharacters that are still active within double-quoted strings.
885 Xsed="${SED}"' -e 1s/^X//'
886 sed_quote_subst='s/\([`"$\\]\)/\\\1/g'
888 # Same as above, but do not quote variable references.
889 double_quote_subst='s/\(["`\\]\)/\\\1/g'
891 # Re-`\' parameter expansions in output of double_quote_subst that were
892 # `\'-ed in input to the same. If an odd number of `\' preceded a '$'
893 # in input to double_quote_subst, that '$' was protected from expansion.
894 # Since each input `\' is now two `\'s, look for any number of runs of
895 # four `\'s followed by two `\'s and then a '$'. `\' that '$'.
900 sed_double_backslash="\
904 s/\\([^$bs]\\)$bs2$dollar/\\1$bs2$bs$dollar/g
915 # Echo program name prefixed message, along with the current mode
916 # name if it has been set yet.
919 $ECHO "$progname${mode+: }$mode: $*"
922 # func_verbose arg...
923 # Echo program name prefixed message in verbose mode only.
926 $opt_verbose && func_echo ${1+"$@"}
928 # A bug in bash halts the script if the last line of a function
929 # fails when set -e is in force, so we need another command to
934 # func_echo_all arg...
935 # Invoke $ECHO with all args, space-separated.
942 # Echo program name prefixed message to standard error.
945 $ECHO "$progname${mode+: }$mode: "${1+"$@"} 1>&2
948 # func_warning arg...
949 # Echo program name prefixed warning message to standard error.
952 $opt_warning && $ECHO "$progname${mode+: }$mode: warning: "${1+"$@"} 1>&2
958 # func_fatal_error arg...
959 # Echo program name prefixed message to standard error, and exit.
966 # func_fatal_help arg...
967 # Echo program name prefixed message to standard error, followed by
968 # a help hint, and exit.
972 func_fatal_error "$help"
974 help="Try \`$progname --help' for more information." ## default
977 # func_grep expression filename
978 # Check whether EXPRESSION matches any line of FILENAME, without output.
981 $GREP "$1" "$2" >/dev/null 2>&1
985 # func_mkdir_p directory-path
986 # Make sure the entire path to DIRECTORY-PATH is available.
989 my_directory_path="$1"
992 if test -n "$my_directory_path" && test "$opt_dry_run" != ":"; then
994 # Protect directory names starting with `-'
995 case $my_directory_path in
996 -*) my_directory_path="./$my_directory_path" ;;
999 # While some portion of DIR does not yet exist...
1000 while test ! -d "$my_directory_path"; do
1001 # ...make a list in topmost first order. Use a colon delimited
1002 # list incase some portion of path contains whitespace.
1003 my_dir_list="$my_directory_path:$my_dir_list"
1005 # If the last portion added has no slash in it, the list is done
1006 case $my_directory_path in */*) ;; *) break ;; esac
1008 # ...otherwise throw away the child directory and loop
1009 my_directory_path=`$ECHO "$my_directory_path" | $SED -e "$dirname"`
1011 my_dir_list=`$ECHO "$my_dir_list" | $SED 's,:*$,,'`
1013 save_mkdir_p_IFS="$IFS"; IFS=':'
1014 for my_dir in $my_dir_list; do
1015 IFS="$save_mkdir_p_IFS"
1016 # mkdir can fail with a `File exist' error if two processes
1017 # try to create one of the directories concurrently. Don't
1018 # stop in that case!
1019 $MKDIR "$my_dir" 2>/dev/null || :
1021 IFS="$save_mkdir_p_IFS"
1023 # Bail out if we (or some other process) failed to create a directory.
1024 test -d "$my_directory_path" || \
1025 func_fatal_error "Failed to create \`$1'"
1030 # func_mktempdir [string]
1031 # Make a temporary directory that won't clash with other running
1032 # libtool processes, and avoids race conditions if possible. If
1033 # given, STRING is the basename for that directory.
1036 my_template="${TMPDIR-/tmp}/${1-$progname}"
1038 if test "$opt_dry_run" = ":"; then
1039 # Return a directory name, but don't create it in dry-run mode
1040 my_tmpdir="${my_template}-$$"
1043 # If mktemp works, use that first and foremost
1044 my_tmpdir=`mktemp -d "${my_template}-XXXXXXXX" 2>/dev/null`
1046 if test ! -d "$my_tmpdir"; then
1047 # Failing that, at least try and use $RANDOM to avoid a race
1048 my_tmpdir="${my_template}-${RANDOM-0}$$"
1050 save_mktempdir_umask=`umask`
1053 umask $save_mktempdir_umask
1056 # If we're not in dry-run mode, bomb out on failure
1057 test -d "$my_tmpdir" || \
1058 func_fatal_error "cannot create temporary directory \`$my_tmpdir'"
1065 # func_quote_for_eval arg
1066 # Aesthetically quote ARG to be evaled later.
1067 # This function returns two values: FUNC_QUOTE_FOR_EVAL_RESULT
1068 # is double-quoted, suitable for a subsequent eval, whereas
1069 # FUNC_QUOTE_FOR_EVAL_UNQUOTED_RESULT has merely all characters
1070 # which are still active within double quotes backslashified.
1071 func_quote_for_eval ()
1075 func_quote_for_eval_unquoted_result=`$ECHO "$1" | $SED "$sed_quote_subst"` ;;
1077 func_quote_for_eval_unquoted_result="$1" ;;
1080 case $func_quote_for_eval_unquoted_result in
1081 # Double-quote args containing shell metacharacters to delay
1082 # word splitting, command substitution and and variable
1083 # expansion for a subsequent eval.
1084 # Many Bourne shells cannot handle close brackets correctly
1085 # in scan sets, so we specify it separately.
1086 *[\[\~\#\^\&\*\(\)\{\}\|\;\<\>\?\'\ \ ]*|*]*|"")
1087 func_quote_for_eval_result="\"$func_quote_for_eval_unquoted_result\""
1090 func_quote_for_eval_result="$func_quote_for_eval_unquoted_result"
1095 # func_quote_for_expand arg
1096 # Aesthetically quote ARG to be evaled later; same as above,
1097 # but do not quote variable references.
1098 func_quote_for_expand ()
1102 my_arg=`$ECHO "$1" | $SED \
1103 -e "$double_quote_subst" -e "$sed_double_backslash"` ;;
1109 # Double-quote args containing shell metacharacters to delay
1110 # word splitting and command substitution for a subsequent eval.
1111 # Many Bourne shells cannot handle close brackets correctly
1112 # in scan sets, so we specify it separately.
1113 *[\[\~\#\^\&\*\(\)\{\}\|\;\<\>\?\'\ \ ]*|*]*|"")
1114 my_arg="\"$my_arg\""
1118 func_quote_for_expand_result="$my_arg"
1122 # func_show_eval cmd [fail_exp]
1123 # Unless opt_silent is true, then output CMD. Then, if opt_dryrun is
1124 # not true, evaluate CMD. If the evaluation of CMD fails, and FAIL_EXP
1125 # is given, then evaluate it.
1129 my_fail_exp="${2-:}"
1131 ${opt_silent-false} || {
1132 func_quote_for_expand "$my_cmd"
1133 eval "func_echo $func_quote_for_expand_result"
1136 if ${opt_dry_run-false}; then :; else
1139 if test "$my_status" -eq 0; then :; else
1140 eval "(exit $my_status); $my_fail_exp"
1146 # func_show_eval_locale cmd [fail_exp]
1147 # Unless opt_silent is true, then output CMD. Then, if opt_dryrun is
1148 # not true, evaluate CMD. If the evaluation of CMD fails, and FAIL_EXP
1149 # is given, then evaluate it. Use the saved locale for evaluation.
1150 func_show_eval_locale ()
1153 my_fail_exp="${2-:}"
1155 ${opt_silent-false} || {
1156 func_quote_for_expand "$my_cmd"
1157 eval "func_echo $func_quote_for_expand_result"
1160 if ${opt_dry_run-false}; then :; else
1161 eval "$lt_user_locale
1164 eval "$lt_safe_locale"
1165 if test "$my_status" -eq 0; then :; else
1166 eval "(exit $my_status); $my_fail_exp"
1176 # Echo version message to standard output and exit.
1187 /^# '$PROGRAM' (GNU /,/# warranty; / {
1190 s/\((C)\)[ 0-9,-]*\( [1-9][0-9]*\)/\1\2/
1197 # Echo short help message to standard output and exit.
1200 $SED -n '/^# Usage:/,/^# *-h/ {
1203 s/\$progname/'$progname'/
1207 $ECHO "run \`$progname --help | more' for full usage"
1211 # func_help [NOEXIT]
1212 # Echo long help message to standard output and exit,
1213 # unless 'noexit' is passed as argument.
1216 $SED -n '/^# Usage:/,/# Report bugs to/ {
1219 s*\$progname*'$progname'*
1221 s*\$SHELL*'"$SHELL"'*
1223 s*\$LTCFLAGS*'"$LTCFLAGS"'*
1225 s/\$with_gnu_ld/'"$with_gnu_ld"'/
1226 s/\$automake_version/'"`(automake --version) 2>/dev/null |$SED 1q`"'/
1227 s/\$autoconf_version/'"`(autoconf --version) 2>/dev/null |$SED 1q`"'/
1231 if test -z "$1"; then
1236 # func_missing_arg argname
1237 # Echo program name prefixed message to standard error and set global
1241 func_error "missing argument for $1"
1252 magic="%%%MAGIC variable%%%"
1253 magic_exe="%%%MAGIC EXE variable%%%"
1260 lo2o="s/\\.lo\$/.${objext}/"
1261 o2lo="s/\\.${objext}\$/.lo/"
1266 opt_duplicate_deps=false
1270 # If this variable is set in any of the actions, the command in it
1271 # will be execed at the end. This prevents here-documents from being
1272 # left over by shells.
1275 # func_fatal_configuration arg...
1276 # Echo program name prefixed message to standard error, followed by
1277 # a configuration failure hint, and exit.
1278 func_fatal_configuration ()
1280 func_error ${1+"$@"}
1281 func_error "See the $PACKAGE documentation for more information."
1282 func_fatal_error "Fatal configuration error."
1287 # Display the configuration for all the tags in this script.
1290 re_begincf='^# ### BEGIN LIBTOOL'
1291 re_endcf='^# ### END LIBTOOL'
1293 # Default configuration.
1294 $SED "1,/$re_begincf CONFIG/d;/$re_endcf CONFIG/,\$d" < "$progpath"
1296 # Now print the configurations for the tags.
1297 for tagname in $taglist; do
1298 $SED -n "/$re_begincf TAG CONFIG: $tagname\$/,/$re_endcf TAG CONFIG: $tagname\$/p" < "$progpath"
1305 # Display the features supported by this script.
1309 if test "$build_libtool_libs" = yes; then
1310 echo "enable shared libraries"
1312 echo "disable shared libraries"
1314 if test "$build_old_libs" = yes; then
1315 echo "enable static libraries"
1317 echo "disable static libraries"
1323 # func_enable_tag tagname
1324 # Verify that TAGNAME is valid, and either flag an error and exit, or
1325 # enable the TAGNAME tag. We also add TAGNAME to the global $taglist
1332 re_begincf="^# ### BEGIN LIBTOOL TAG CONFIG: $tagname\$"
1333 re_endcf="^# ### END LIBTOOL TAG CONFIG: $tagname\$"
1334 sed_extractcf="/$re_begincf/,/$re_endcf/p"
1339 func_fatal_error "invalid tag name: $tagname"
1343 # Don't test for the "default" C tag, as we know it's
1344 # there but not specially marked.
1348 if $GREP "$re_begincf" "$progpath" >/dev/null 2>&1; then
1349 taglist="$taglist $tagname"
1351 # Evaluate the configuration. Be careful to quote the path
1352 # and the sed script, to avoid splitting on whitespace, but
1353 # also don't use non-portable quotes within backquotes within
1354 # quotes we have to do it in 2 steps:
1355 extractedcf=`$SED -n -e "$sed_extractcf" < "$progpath"`
1358 func_error "ignoring unknown tag $tagname"
1364 # Parse options once, thoroughly. This comes as soon as possible in
1365 # the script to make things like `libtool --version' happen quickly.
1368 # Shorthand for --mode=foo, only valid as the first argument
1371 shift; set dummy --mode clean ${1+"$@"}; shift
1373 compile|compil|compi|comp|com|co|c)
1374 shift; set dummy --mode compile ${1+"$@"}; shift
1376 execute|execut|execu|exec|exe|ex|e)
1377 shift; set dummy --mode execute ${1+"$@"}; shift
1379 finish|finis|fini|fin|fi|f)
1380 shift; set dummy --mode finish ${1+"$@"}; shift
1382 install|instal|insta|inst|ins|in|i)
1383 shift; set dummy --mode install ${1+"$@"}; shift
1386 shift; set dummy --mode link ${1+"$@"}; shift
1388 uninstall|uninstal|uninsta|uninst|unins|unin|uni|un|u)
1389 shift; set dummy --mode uninstall ${1+"$@"}; shift
1393 # Parse non-mode specific arguments:
1394 while test "$#" -gt 0; do
1399 --config) func_config ;;
1401 --debug) preserve_args="$preserve_args $opt"
1402 func_echo "enabling shell trace mode"
1407 -dlopen) test "$#" -eq 0 && func_missing_arg "$opt" && break
1408 execute_dlfiles="$execute_dlfiles $1"
1412 --dry-run | -n) opt_dry_run=: ;;
1413 --features) func_features ;;
1414 --finish) mode="finish" ;;
1416 --mode) test "$#" -eq 0 && func_missing_arg "$opt" && break
1418 # Valid mode arguments:
1428 # Catch anything else as an error
1429 *) func_error "invalid argument for $opt"
1439 --preserve-dup-deps)
1440 opt_duplicate_deps=: ;;
1442 --quiet|--silent) preserve_args="$preserve_args $opt"
1447 --no-quiet|--no-silent)
1448 preserve_args="$preserve_args $opt"
1452 --verbose| -v) preserve_args="$preserve_args $opt"
1457 --no-verbose) preserve_args="$preserve_args $opt"
1461 --tag) test "$#" -eq 0 && func_missing_arg "$opt" && break
1462 preserve_args="$preserve_args $opt $1"
1463 func_enable_tag "$1" # tagname is set here
1467 # Separate optargs to long options:
1468 -dlopen=*|--mode=*|--tag=*)
1469 func_opt_split "$opt"
1470 set dummy "$func_opt_split_opt" "$func_opt_split_arg" ${1+"$@"}
1474 -\?|-h) func_usage ;;
1475 --help) opt_help=: ;;
1476 --help-all) opt_help=': help-all' ;;
1477 --version) func_version ;;
1479 -*) func_fatal_help "unrecognized option \`$opt'" ;;
1489 *cygwin* | *mingw* | *pw32* | *cegcc*)
1490 # don't eliminate duplications in $postdeps and $predeps
1491 opt_duplicate_compiler_generated_deps=:
1494 opt_duplicate_compiler_generated_deps=$opt_duplicate_deps
1498 # Having warned about all mis-specified options, bail out if
1499 # anything was wrong.
1500 $exit_cmd $EXIT_FAILURE
1503 # func_check_version_match
1504 # Ensure that we are using m4 macros, and libtool script from the same
1505 # release of libtool.
1506 func_check_version_match ()
1508 if test "$package_revision" != "$macro_revision"; then
1509 if test "$VERSION" != "$macro_version"; then
1510 if test -z "$macro_version"; then
1512 $progname: Version mismatch error. This is $PACKAGE $VERSION, but the
1513 $progname: definition of this LT_INIT comes from an older release.
1514 $progname: You should recreate aclocal.m4 with macros from $PACKAGE $VERSION
1515 $progname: and run autoconf again.
1519 $progname: Version mismatch error. This is $PACKAGE $VERSION, but the
1520 $progname: definition of this LT_INIT comes from $PACKAGE $macro_version.
1521 $progname: You should recreate aclocal.m4 with macros from $PACKAGE $VERSION
1522 $progname: and run autoconf again.
1527 $progname: Version mismatch error. This is $PACKAGE $VERSION, revision $package_revision,
1528 $progname: but the definition of this LT_INIT comes from revision $macro_revision.
1529 $progname: You should recreate aclocal.m4 with macros from revision $package_revision
1530 $progname: of $PACKAGE $VERSION and run autoconf again.
1544 # Sanity checks first:
1545 func_check_version_match
1547 if test "$build_libtool_libs" != yes && test "$build_old_libs" != yes; then
1548 func_fatal_configuration "not configured to build any kind of library"
1551 test -z "$mode" && func_fatal_error "error: you must specify a MODE."
1555 eval std_shrext=\"$shrext_cmds\"
1558 # Only execute mode is allowed to have -dlopen flags.
1559 if test -n "$execute_dlfiles" && test "$mode" != execute; then
1560 func_error "unrecognized option \`-dlopen'"
1565 # Change the help message to a mode-specific one.
1566 generic_help="$help"
1567 help="Try \`$progname --help --mode=$mode' for more information."
1572 # True iff FILE is a libtool `.la' library or `.lo' object file.
1573 # This function is only a basic sanity check; it will hardly flush out
1574 # determined imposters.
1578 $SED -e 4q "$1" 2>/dev/null \
1579 | $GREP "^# Generated by .*$PACKAGE" > /dev/null 2>&1
1582 # func_lalib_unsafe_p file
1583 # True iff FILE is a libtool `.la' library or `.lo' object file.
1584 # This function implements the same check as func_lalib_p without
1585 # resorting to external programs. To this end, it redirects stdin and
1586 # closes it afterwards, without saving the original file descriptor.
1587 # As a safety measure, use it only where a negative result would be
1588 # fatal anyway. Works if `file' does not exist.
1589 func_lalib_unsafe_p ()
1592 if test -f "$1" && test -r "$1" && exec 5<&0 <"$1"; then
1593 for lalib_p_l in 1 2 3 4
1596 case "$lalib_p_line" in
1597 \#\ Generated\ by\ *$PACKAGE* ) lalib_p=yes; break;;
1602 test "$lalib_p" = yes
1605 # func_ltwrapper_script_p file
1606 # True iff FILE is a libtool wrapper script
1607 # This function is only a basic sanity check; it will hardly flush out
1608 # determined imposters.
1609 func_ltwrapper_script_p ()
1614 # func_ltwrapper_executable_p file
1615 # True iff FILE is a libtool wrapper executable
1616 # This function is only a basic sanity check; it will hardly flush out
1617 # determined imposters.
1618 func_ltwrapper_executable_p ()
1620 func_ltwrapper_exec_suffix=
1623 *) func_ltwrapper_exec_suffix=.exe ;;
1625 $GREP "$magic_exe" "$1$func_ltwrapper_exec_suffix" >/dev/null 2>&1
1628 # func_ltwrapper_scriptname file
1629 # Assumes file is an ltwrapper_executable
1630 # uses $file to determine the appropriate filename for a
1631 # temporary ltwrapper_script.
1632 func_ltwrapper_scriptname ()
1634 func_ltwrapper_scriptname_result=""
1635 if func_ltwrapper_executable_p "$1"; then
1636 func_dirname_and_basename "$1" "" "."
1637 func_stripname '' '.exe' "$func_basename_result"
1638 func_ltwrapper_scriptname_result="$func_dirname_result/$objdir/${func_stripname_result}_ltshwrapper"
1642 # func_ltwrapper_p file
1643 # True iff FILE is a libtool wrapper script or wrapper executable
1644 # This function is only a basic sanity check; it will hardly flush out
1645 # determined imposters.
1648 func_ltwrapper_script_p "$1" || func_ltwrapper_executable_p "$1"
1652 # func_execute_cmds commands fail_cmd
1653 # Execute tilde-delimited COMMANDS.
1654 # If FAIL_CMD is given, eval that upon failure.
1655 # FAIL_CMD may read-access the current command in variable CMD!
1656 func_execute_cmds ()
1659 save_ifs=$IFS; IFS='~'
1663 func_show_eval "$cmd" "${2-:}"
1670 # Source FILE, adding directory component if necessary.
1671 # Note that it is not necessary on cygwin/mingw to append a dot to
1672 # FILE even if both FILE and FILE.exe exist: automatic-append-.exe
1673 # behavior happens only for exec(3), not for open(2)! Also, sourcing
1674 # `FILE.' does not work on cygwin managed mounts.
1679 */* | *\\*) . "$1" ;;
1685 # func_infer_tag arg
1686 # Infer tagged configuration to use if any are available and
1687 # if one wasn't chosen via the "--tag" command line option.
1688 # Only attempt this if the compiler in the base compile
1689 # command doesn't match the default compiler.
1690 # arg is usually of the form 'gcc ...'
1694 if test -n "$available_tags" && test -z "$tagname"; then
1697 func_quote_for_eval "$arg"
1698 CC_quoted="$CC_quoted $func_quote_for_eval_result"
1700 CC_expanded=`func_echo_all $CC`
1701 CC_quoted_expanded=`func_echo_all $CC_quoted`
1703 # Blanks in the command may have been stripped by the calling shell,
1704 # but not from the CC environment variable when configure was run.
1705 " $CC "* | "$CC "* | " $CC_expanded "* | "$CC_expanded "* | \
1706 " $CC_quoted"* | "$CC_quoted "* | " $CC_quoted_expanded "* | "$CC_quoted_expanded "*) ;;
1707 # Blanks at the start of $base_compile will cause this to fail
1708 # if we don't check for them as well.
1710 for z in $available_tags; do
1711 if $GREP "^# ### BEGIN LIBTOOL TAG CONFIG: $z$" < "$progpath" > /dev/null; then
1712 # Evaluate the configuration.
1713 eval "`${SED} -n -e '/^# ### BEGIN LIBTOOL TAG CONFIG: '$z'$/,/^# ### END LIBTOOL TAG CONFIG: '$z'$/p' < $progpath`"
1716 # Double-quote args containing other shell metacharacters.
1717 func_quote_for_eval "$arg"
1718 CC_quoted="$CC_quoted $func_quote_for_eval_result"
1720 CC_expanded=`func_echo_all $CC`
1721 CC_quoted_expanded=`func_echo_all $CC_quoted`
1723 " $CC "* | "$CC "* | " $CC_expanded "* | "$CC_expanded "* | \
1724 " $CC_quoted"* | "$CC_quoted "* | " $CC_quoted_expanded "* | "$CC_quoted_expanded "*)
1725 # The compiler in the base compile command matches
1726 # the one in the tagged configuration.
1727 # Assume this is the tagged configuration we want.
1734 # If $tagname still isn't set, then no tagged configuration
1735 # was found and let the user know that the "--tag" command
1736 # line option must be used.
1737 if test -z "$tagname"; then
1738 func_echo "unable to infer tagged configuration"
1739 func_fatal_error "specify a tag with \`--tag'"
1741 # func_verbose "using $tagname tagged configuration"
1750 # func_write_libtool_object output_name pic_name nonpic_name
1751 # Create a libtool object file (analogous to a ".la" file),
1752 # but don't create it if we're doing a dry run.
1753 func_write_libtool_object ()
1756 if test "$build_libtool_libs" = yes; then
1762 if test "$build_old_libs" = yes; then
1763 write_oldobj=\'${3}\'
1769 cat >${write_libobj}T <<EOF
1770 # $write_libobj - a libtool object file
1771 # Generated by $PROGRAM (GNU $PACKAGE$TIMESTAMP) $VERSION
1773 # Please DO NOT delete this file!
1774 # It is necessary for linking the library.
1776 # Name of the PIC object.
1777 pic_object=$write_lobj
1779 # Name of the non-PIC object
1780 non_pic_object=$write_oldobj
1783 $MV "${write_libobj}T" "${write_libobj}"
1787 # func_mode_compile arg...
1788 func_mode_compile ()
1791 # Get the compilation command and the source file.
1793 srcfile="$nonopt" # always keep a non-empty value in "srcfile"
1805 # do not "continue". Instead, add this to base_compile
1817 # Accept any command-line options.
1820 test -n "$libobj" && \
1821 func_fatal_error "you cannot specify \`-o' more than once"
1826 -pie | -fpie | -fPIE)
1827 pie_flag="$pie_flag $arg"
1831 -shared | -static | -prefer-pic | -prefer-non-pic)
1842 arg_mode=arg # the next one goes into the "base_compile" arg list
1843 continue # The current "srcfile" will either be retained or
1844 ;; # replaced later. I would guess that would be a bug.
1847 func_stripname '-Wc,' '' "$arg"
1848 args=$func_stripname_result
1850 save_ifs="$IFS"; IFS=','
1851 for arg in $args; do
1853 func_quote_for_eval "$arg"
1854 lastarg="$lastarg $func_quote_for_eval_result"
1857 func_stripname ' ' '' "$lastarg"
1858 lastarg=$func_stripname_result
1860 # Add the arguments to base_compile.
1861 base_compile="$base_compile $lastarg"
1866 # Accept the current argument as the source file.
1867 # The previous "srcfile" becomes the current argument.
1874 esac # case $arg_mode
1876 # Aesthetically quote the previous argument.
1877 func_quote_for_eval "$lastarg"
1878 base_compile="$base_compile $func_quote_for_eval_result"
1883 func_fatal_error "you must specify an argument for -Xcompile"
1886 func_fatal_error "you must specify a target with \`-o'"
1889 # Get the name of the library object.
1890 test -z "$libobj" && {
1891 func_basename "$srcfile"
1892 libobj="$func_basename_result"
1897 # Recognize several different file suffixes.
1898 # If the user specifies -o file.o, it is replaced with file.lo
1901 *.ada | *.adb | *.ads | *.asm | \
1902 *.c++ | *.cc | *.ii | *.class | *.cpp | *.cxx | \
1903 *.[fF][09]? | *.for | *.java | *.obj | *.sx | *.cu | *.cup)
1904 func_xform "$libobj"
1905 libobj=$func_xform_result
1910 *.lo) func_lo2o "$libobj"; obj=$func_lo2o_result ;;
1912 func_fatal_error "cannot determine name of library object from \`$libobj'"
1916 func_infer_tag $base_compile
1918 for arg in $later; do
1921 test "$build_libtool_libs" != yes && \
1922 func_fatal_configuration "can not build a shared library"
1928 build_libtool_libs=no
1945 func_quote_for_eval "$libobj"
1946 test "X$libobj" != "X$func_quote_for_eval_result" \
1947 && $ECHO "X$libobj" | $GREP '[]~#^*{};<>?"'"'"' &()|`$[]' \
1948 && func_warning "libobj name \`$libobj' may not contain shell special characters."
1949 func_dirname_and_basename "$obj" "/" ""
1950 objname="$func_basename_result"
1951 xdir="$func_dirname_result"
1952 lobj=${xdir}$objdir/$objname
1954 test -z "$base_compile" && \
1955 func_fatal_help "you must specify a compilation command"
1957 # Delete any leftover library objects.
1958 if test "$build_old_libs" = yes; then
1959 removelist="$obj $lobj $libobj ${libobj}T"
1961 removelist="$lobj $libobj ${libobj}T"
1964 # On Cygwin there's no "real" PIC flag so we must build both object types
1966 cygwin* | mingw* | pw32* | os2* | cegcc*)
1970 if test "$pic_mode" = no && test "$deplibs_check_method" != pass_all; then
1971 # non-PIC code in shared libraries is not supported
1975 # Calculate the filename of the output object if compiler does
1976 # not support -o with -c
1977 if test "$compiler_c_o" = no; then
1978 output_obj=`$ECHO "$srcfile" | $SED 's%^.*/%%; s%\.[^.]*$%%'`.${objext}
1979 lockfile="$output_obj.lock"
1986 # Lock this critical section if it is needed
1987 # We use this script file to make the link, it avoids creating a new file
1988 if test "$need_locks" = yes; then
1989 until $opt_dry_run || ln "$progpath" "$lockfile" 2>/dev/null; do
1990 func_echo "Waiting for $lockfile to be removed"
1993 elif test "$need_locks" = warn; then
1994 if test -f "$lockfile"; then
1996 *** ERROR, $lockfile exists and contains:
1997 `cat $lockfile 2>/dev/null`
1999 This indicates that another process is trying to use the same
2000 temporary object file, and libtool could not work around it because
2001 your compiler does not support \`-c' and \`-o' together. If you
2002 repeat this compilation, it may succeed, by chance, but you had better
2003 avoid parallel builds (make -j) in this platform, or get a better
2006 $opt_dry_run || $RM $removelist
2009 removelist="$removelist $output_obj"
2010 $ECHO "$srcfile" > "$lockfile"
2013 $opt_dry_run || $RM $removelist
2014 removelist="$removelist $lockfile"
2015 trap '$opt_dry_run || $RM $removelist; exit $EXIT_FAILURE' 1 2 15
2017 if test -n "$fix_srcfile_path"; then
2018 eval srcfile=\"$fix_srcfile_path\"
2020 func_quote_for_eval "$srcfile"
2021 qsrcfile=$func_quote_for_eval_result
2023 # Only build a PIC object if we are building libtool libraries.
2024 if test "$build_libtool_libs" = yes; then
2025 # Without this assignment, base_compile gets emptied.
2026 fbsd_hideous_sh_bug=$base_compile
2028 if test "$pic_mode" != no; then
2029 command="$base_compile $qsrcfile $pic_flag"
2031 # Don't build PIC code
2032 command="$base_compile $qsrcfile"
2035 func_mkdir_p "$xdir$objdir"
2037 if test -z "$output_obj"; then
2038 # Place PIC objects in $objdir
2039 command="$command -o $lobj"
2042 func_show_eval_locale "$command" \
2043 'test -n "$output_obj" && $RM $removelist; exit $EXIT_FAILURE'
2045 if test "$need_locks" = warn &&
2046 test "X`cat $lockfile 2>/dev/null`" != "X$srcfile"; then
2048 *** ERROR, $lockfile contains:
2049 `cat $lockfile 2>/dev/null`
2051 but it should contain:
2054 This indicates that another process is trying to use the same
2055 temporary object file, and libtool could not work around it because
2056 your compiler does not support \`-c' and \`-o' together. If you
2057 repeat this compilation, it may succeed, by chance, but you had better
2058 avoid parallel builds (make -j) in this platform, or get a better
2061 $opt_dry_run || $RM $removelist
2065 # Just move the object if needed, then go on to compile the next one
2066 if test -n "$output_obj" && test "X$output_obj" != "X$lobj"; then
2067 func_show_eval '$MV "$output_obj" "$lobj"' \
2068 'error=$?; $opt_dry_run || $RM $removelist; exit $error'
2071 # Allow error messages only from the first compilation.
2072 if test "$suppress_opt" = yes; then
2073 suppress_output=' >/dev/null 2>&1'
2077 # Only build a position-dependent object if we build old libraries.
2078 if test "$build_old_libs" = yes; then
2079 if test "$pic_mode" != yes; then
2080 # Don't build PIC code
2081 command="$base_compile $qsrcfile$pie_flag"
2083 command="$base_compile $qsrcfile $pic_flag"
2085 if test "$compiler_c_o" = yes; then
2086 command="$command -o $obj"
2089 # Suppress compiler output if we already did a PIC compilation.
2090 command="$command$suppress_output"
2091 func_show_eval_locale "$command" \
2092 '$opt_dry_run || $RM $removelist; exit $EXIT_FAILURE'
2094 if test "$need_locks" = warn &&
2095 test "X`cat $lockfile 2>/dev/null`" != "X$srcfile"; then
2097 *** ERROR, $lockfile contains:
2098 `cat $lockfile 2>/dev/null`
2100 but it should contain:
2103 This indicates that another process is trying to use the same
2104 temporary object file, and libtool could not work around it because
2105 your compiler does not support \`-c' and \`-o' together. If you
2106 repeat this compilation, it may succeed, by chance, but you had better
2107 avoid parallel builds (make -j) in this platform, or get a better
2110 $opt_dry_run || $RM $removelist
2114 # Just move the object if needed
2115 if test -n "$output_obj" && test "X$output_obj" != "X$obj"; then
2116 func_show_eval '$MV "$output_obj" "$obj"' \
2117 'error=$?; $opt_dry_run || $RM $removelist; exit $error'
2122 func_write_libtool_object "$libobj" "$objdir/$objname" "$objname"
2124 # Unlock the critical section if it was locked
2125 if test "$need_locks" != no; then
2126 removelist=$lockfile
2135 test "$mode" = compile && func_mode_compile ${1+"$@"}
2140 # We need to display help for each of the modes.
2143 # Generic help is extracted from the usage comments
2144 # at the start of this file.
2150 "Usage: $progname [OPTION]... --mode=clean RM [RM-OPTION]... FILE...
2152 Remove files from the build directory.
2154 RM is the name of the program to use to delete files associated with each FILE
2155 (typically \`/bin/rm'). RM-OPTIONS are options (such as \`-f') to be passed
2158 If FILE is a libtool library, object or program, all the files associated
2159 with it are deleted. Otherwise, only FILE itself is deleted using RM."
2164 "Usage: $progname [OPTION]... --mode=compile COMPILE-COMMAND... SOURCEFILE
2166 Compile a source file into a libtool library object.
2168 This mode accepts the following additional options:
2170 -o OUTPUT-FILE set the output file name to OUTPUT-FILE
2171 -no-suppress do not suppress compiler output for multiple passes
2172 -prefer-pic try to building PIC objects only
2173 -prefer-non-pic try to building non-PIC objects only
2174 -shared do not build a \`.o' file suitable for static linking
2175 -static only build a \`.o' file suitable for static linking
2176 -Wc,FLAG pass FLAG directly to the compiler
2178 COMPILE-COMMAND is a command to be used in creating a \`standard' object file
2179 from the given SOURCEFILE.
2181 The output file name is determined by removing the directory component from
2182 SOURCEFILE, then substituting the C source code suffix \`.c' with the
2183 library object suffix, \`.lo'."
2188 "Usage: $progname [OPTION]... --mode=execute COMMAND [ARGS]...
2190 Automatically set library path, then run a program.
2192 This mode accepts the following additional options:
2194 -dlopen FILE add the directory containing FILE to the library path
2196 This mode sets the library path environment variable according to \`-dlopen'
2199 If any of the ARGS are libtool executable wrappers, then they are translated
2200 into their corresponding uninstalled binary, and any of their required library
2201 directories are added to the library path.
2203 Then, COMMAND is executed, with ARGS as arguments."
2208 "Usage: $progname [OPTION]... --mode=finish [LIBDIR]...
2210 Complete the installation of libtool libraries.
2212 Each LIBDIR is a directory that contains libtool libraries.
2214 The commands that this mode executes may require superuser privileges. Use
2215 the \`--dry-run' option if you just want to see what would be executed."
2220 "Usage: $progname [OPTION]... --mode=install INSTALL-COMMAND...
2222 Install executables or libraries.
2224 INSTALL-COMMAND is the installation command. The first component should be
2225 either the \`install' or \`cp' program.
2227 The following components of INSTALL-COMMAND are treated specially:
2229 -inst-prefix-dir PREFIX-DIR Use PREFIX-DIR as a staging area for installation
2231 The rest of the components are interpreted as arguments to that command (only
2232 BSD-compatible install options are recognized)."
2237 "Usage: $progname [OPTION]... --mode=link LINK-COMMAND...
2239 Link object files or libraries together to form another library, or to
2240 create an executable program.
2242 LINK-COMMAND is a command using the C compiler that you would use to create
2243 a program from several object files.
2245 The following components of LINK-COMMAND are treated specially:
2247 -all-static do not do any dynamic linking at all
2248 -avoid-version do not add a version suffix if possible
2249 -bindir BINDIR specify path to binaries directory (for systems where
2250 libraries must be found in the PATH setting at runtime)
2251 -dlopen FILE \`-dlpreopen' FILE if it cannot be dlopened at runtime
2252 -dlpreopen FILE link in FILE and add its symbols to lt_preloaded_symbols
2253 -export-dynamic allow symbols from OUTPUT-FILE to be resolved with dlsym(3)
2254 -export-symbols SYMFILE
2255 try to export only the symbols listed in SYMFILE
2256 -export-symbols-regex REGEX
2257 try to export only the symbols matching REGEX
2258 -LLIBDIR search LIBDIR for required installed libraries
2259 -lNAME OUTPUT-FILE requires the installed library libNAME
2260 -module build a library that can dlopened
2261 -no-fast-install disable the fast-install mode
2262 -no-install link a not-installable executable
2263 -no-undefined declare that a library does not refer to external symbols
2264 -o OUTPUT-FILE create OUTPUT-FILE from the specified objects
2265 -objectlist FILE Use a list of object files found in FILE to specify objects
2266 -precious-files-regex REGEX
2267 don't remove output files matching REGEX
2268 -release RELEASE specify package release information
2269 -rpath LIBDIR the created library will eventually be installed in LIBDIR
2270 -R[ ]LIBDIR add LIBDIR to the runtime path of programs and libraries
2271 -shared only do dynamic linking of libtool libraries
2272 -shrext SUFFIX override the standard shared library file extension
2273 -static do not do any dynamic linking of uninstalled libtool libraries
2274 -static-libtool-libs
2275 do not do any dynamic linking of libtool libraries
2276 -version-info CURRENT[:REVISION[:AGE]]
2277 specify library version info [each variable defaults to 0]
2278 -weak LIBNAME declare that the target provides the LIBNAME interface
2280 -Xcompiler FLAG pass linker-specific FLAG directly to the compiler
2282 -Xlinker FLAG pass linker-specific FLAG directly to the linker
2283 -XCClinker FLAG pass link-specific FLAG to the compiler driver (CC)
2285 All other options (arguments beginning with \`-') are ignored.
2287 Every other argument is treated as a filename. Files ending in \`.la' are
2288 treated as uninstalled libtool libraries, other files are standard or library
2291 If the OUTPUT-FILE ends in \`.la', then a libtool library is created,
2292 only library objects (\`.lo' files) may be specified, and \`-rpath' is
2293 required, except when creating a convenience library.
2295 If OUTPUT-FILE ends in \`.a' or \`.lib', then a standard library is created
2296 using \`ar' and \`ranlib', or on Windows using \`lib'.
2298 If OUTPUT-FILE ends in \`.lo' or \`.${objext}', then a reloadable object file
2299 is created, otherwise an executable program is created."
2304 "Usage: $progname [OPTION]... --mode=uninstall RM [RM-OPTION]... FILE...
2306 Remove libraries from an installation directory.
2308 RM is the name of the program to use to delete files associated with each FILE
2309 (typically \`/bin/rm'). RM-OPTIONS are options (such as \`-f') to be passed
2312 If FILE is a libtool library, all the files associated with it are deleted.
2313 Otherwise, only FILE itself is deleted using RM."
2317 func_fatal_help "invalid operation mode \`$mode'"
2322 $ECHO "Try \`$progname --help' for more information about other modes."
2325 # Now that we've collected a possible --mode arg, show help if necessary
2327 if test "$opt_help" = :; then
2332 for mode in compile link execute install finish uninstall clean; do
2335 } | sed -n '1p; 2,$s/^Usage:/ or: /p'
2338 for mode in compile link execute install finish uninstall clean; do
2344 /^When reporting/,/^Report/{
2349 /information about other modes/d
2350 /more detailed .*MODE/d
2351 s/^Usage:.*--mode=\([^ ]*\) .*/Description of \1 mode:/'
2357 # func_mode_execute arg...
2358 func_mode_execute ()
2361 # The first argument is the command name.
2364 func_fatal_help "you must specify a COMMAND"
2366 # Handle -dlopen flags immediately.
2367 for file in $execute_dlfiles; do
2369 || func_fatal_help "\`$file' is not a file"
2374 # Check to see that this really is a libtool archive.
2375 func_lalib_unsafe_p "$file" \
2376 || func_fatal_help "\`$lib' is not a valid libtool archive"
2378 # Read the libtool library.
2383 # Skip this library if it cannot be dlopened.
2384 if test -z "$dlname"; then
2385 # Warn if it was a shared library.
2386 test -n "$library_names" && \
2387 func_warning "\`$file' was not linked with \`-export-dynamic'"
2391 func_dirname "$file" "" "."
2392 dir="$func_dirname_result"
2394 if test -f "$dir/$objdir/$dlname"; then
2397 if test ! -f "$dir/$dlname"; then
2398 func_fatal_error "cannot find \`$dlname' in \`$dir' or \`$dir/$objdir'"
2404 # Just add the directory containing the .lo file.
2405 func_dirname "$file" "" "."
2406 dir="$func_dirname_result"
2410 func_warning "\`-dlopen' is ignored for non-libtool libraries and objects"
2415 # Get the absolute pathname.
2416 absdir=`cd "$dir" && pwd`
2417 test -n "$absdir" && dir="$absdir"
2419 # Now add the directory to shlibpath_var.
2420 if eval "test -z \"\$$shlibpath_var\""; then
2421 eval "$shlibpath_var=\"\$dir\""
2423 eval "$shlibpath_var=\"\$dir:\$$shlibpath_var\""
2427 # This variable tells wrapper scripts just to set shlibpath_var
2428 # rather than running their programs.
2429 libtool_execute_magic="$magic"
2431 # Check if any of the arguments is a wrapper script.
2436 -* | *.la | *.lo ) ;;
2438 # Do a test to see if this is really a libtool program.
2439 if func_ltwrapper_script_p "$file"; then
2441 # Transform arg to wrapped name.
2442 file="$progdir/$program"
2443 elif func_ltwrapper_executable_p "$file"; then
2444 func_ltwrapper_scriptname "$file"
2445 func_source "$func_ltwrapper_scriptname_result"
2446 # Transform arg to wrapped name.
2447 file="$progdir/$program"
2451 # Quote arguments (to preserve shell metacharacters).
2452 func_quote_for_eval "$file"
2453 args="$args $func_quote_for_eval_result"
2456 if test "X$opt_dry_run" = Xfalse; then
2457 if test -n "$shlibpath_var"; then
2458 # Export the shlibpath_var.
2459 eval "export $shlibpath_var"
2462 # Restore saved environment variables
2463 for lt_var in LANG LANGUAGE LC_ALL LC_CTYPE LC_COLLATE LC_MESSAGES
2465 eval "if test \"\${save_$lt_var+set}\" = set; then
2466 $lt_var=\$save_$lt_var; export $lt_var
2472 # Now prepare to actually exec the command.
2473 exec_cmd="\$cmd$args"
2475 # Display what would be done.
2476 if test -n "$shlibpath_var"; then
2477 eval "\$ECHO \"\$shlibpath_var=\$$shlibpath_var\""
2478 echo "export $shlibpath_var"
2485 test "$mode" = execute && func_mode_execute ${1+"$@"}
2488 # func_mode_finish arg...
2495 if test -n "$finish_cmds$finish_eval" && test -n "$libdirs"; then
2498 libdirs="$libdirs $dir"
2501 for libdir in $libdirs; do
2502 if test -n "$finish_cmds"; then
2503 # Do each command in the finish commands.
2504 func_execute_cmds "$finish_cmds" 'admincmds="$admincmds
2507 if test -n "$finish_eval"; then
2508 # Do the single finish_eval.
2509 eval cmds=\"$finish_eval\"
2510 $opt_dry_run || eval "$cmds" || admincmds="$admincmds
2516 # Exit here if they wanted silent mode.
2517 $opt_silent && exit $EXIT_SUCCESS
2519 echo "----------------------------------------------------------------------"
2520 echo "Libraries have been installed in:"
2521 for libdir in $libdirs; do
2525 echo "If you ever happen to want to link against installed libraries"
2526 echo "in a given directory, LIBDIR, you must either use libtool, and"
2527 echo "specify the full pathname of the library, or use the \`-LLIBDIR'"
2528 echo "flag during linking and do at least one of the following:"
2529 if test -n "$shlibpath_var"; then
2530 echo " - add LIBDIR to the \`$shlibpath_var' environment variable"
2531 echo " during execution"
2533 if test -n "$runpath_var"; then
2534 echo " - add LIBDIR to the \`$runpath_var' environment variable"
2535 echo " during linking"
2537 if test -n "$hardcode_libdir_flag_spec"; then
2539 eval flag=\"$hardcode_libdir_flag_spec\"
2541 $ECHO " - use the \`$flag' linker flag"
2543 if test -n "$admincmds"; then
2544 $ECHO " - have your system administrator run these commands:$admincmds"
2546 if test -f /etc/ld.so.conf; then
2547 echo " - have your system administrator add LIBDIR to \`/etc/ld.so.conf'"
2551 echo "See any operating system documentation about shared libraries for"
2553 solaris2.[6789]|solaris2.1[0-9])
2554 echo "more information, such as the ld(1), crle(1) and ld.so(8) manual"
2558 echo "more information, such as the ld(1) and ld.so(8) manual pages."
2561 echo "----------------------------------------------------------------------"
2565 test "$mode" = finish && func_mode_finish ${1+"$@"}
2568 # func_mode_install arg...
2569 func_mode_install ()
2572 # There may be an optional sh(1) argument at the beginning of
2573 # install_prog (especially on Windows NT).
2574 if test "$nonopt" = "$SHELL" || test "$nonopt" = /bin/sh ||
2575 # Allow the use of GNU shtool's install command.
2576 case $nonopt in *shtool*) :;; *) false;; esac; then
2577 # Aesthetically quote it.
2578 func_quote_for_eval "$nonopt"
2579 install_prog="$func_quote_for_eval_result "
2587 # The real first argument should be the name of the installation program.
2588 # Aesthetically quote it.
2589 func_quote_for_eval "$arg"
2590 install_prog="$install_prog$func_quote_for_eval_result"
2591 install_shared_prog=$install_prog
2592 case " $install_prog " in
2593 *[\\\ /]cp\ *) install_cp=: ;;
2594 *) install_cp=false ;;
2597 # We need to accept at least all the BSD install flags.
2609 if test -n "$dest"; then
2610 files="$files $dest"
2618 if $install_cp; then :; else
2632 # If the previous option needed an argument, then skip it.
2633 if test -n "$prev"; then
2634 if test "x$prev" = x-m && test -n "$install_override_mode"; then
2635 arg2=$install_override_mode
2646 # Aesthetically quote the argument.
2647 func_quote_for_eval "$arg"
2648 install_prog="$install_prog $func_quote_for_eval_result"
2649 if test -n "$arg2"; then
2650 func_quote_for_eval "$arg2"
2652 install_shared_prog="$install_shared_prog $func_quote_for_eval_result"
2655 test -z "$install_prog" && \
2656 func_fatal_help "you must specify an install program"
2658 test -n "$prev" && \
2659 func_fatal_help "the \`$prev' option requires an argument"
2661 if test -n "$install_override_mode" && $no_mode; then
2662 if $install_cp; then :; else
2663 func_quote_for_eval "$install_override_mode"
2664 install_shared_prog="$install_shared_prog -m $func_quote_for_eval_result"
2668 if test -z "$files"; then
2669 if test -z "$dest"; then
2670 func_fatal_help "no file or destination specified"
2672 func_fatal_help "you must specify a destination"
2676 # Strip any trailing slash from the destination.
2677 func_stripname '' '/' "$dest"
2678 dest=$func_stripname_result
2680 # Check to see that the destination is a directory.
2681 test -d "$dest" && isdir=yes
2682 if test "$isdir" = yes; then
2686 func_dirname_and_basename "$dest" "" "."
2687 destdir="$func_dirname_result"
2688 destname="$func_basename_result"
2690 # Not a directory, so check to see that there is only one file specified.
2691 set dummy $files; shift
2692 test "$#" -gt 1 && \
2693 func_fatal_help "\`$dest' is not a directory"
2696 [\\/]* | [A-Za-z]:[\\/]*) ;;
2698 for file in $files; do
2702 func_fatal_help "\`$destdir' must be an absolute directory name"
2709 # This variable tells wrapper scripts just to set variables rather
2710 # than running their programs.
2711 libtool_install_magic="$magic"
2716 for file in $files; do
2718 # Do each installation.
2721 # Do the static libraries later.
2722 staticlibs="$staticlibs $file"
2726 # Check to see that this really is a libtool archive.
2727 func_lalib_unsafe_p "$file" \
2728 || func_fatal_help "\`$file' is not a valid libtool archive"
2735 # Add the libdir to current_libdirs if it is the destination.
2736 if test "X$destdir" = "X$libdir"; then
2737 case "$current_libdirs " in
2739 *) current_libdirs="$current_libdirs $libdir" ;;
2742 # Note the libdir as a future libdir.
2743 case "$future_libdirs " in
2745 *) future_libdirs="$future_libdirs $libdir" ;;
2749 func_dirname "$file" "/" ""
2750 dir="$func_dirname_result"
2753 if test -n "$relink_command"; then
2754 # Determine the prefix the user has applied to our future dir.
2755 inst_prefix_dir=`$ECHO "$destdir" | $SED -e "s%$libdir\$%%"`
2757 # Don't allow the user to place us outside of our expected
2758 # location b/c this prevents finding dependent libraries that
2759 # are installed to the same prefix.
2760 # At present, this check doesn't affect windows .dll's that
2761 # are installed into $libdir/../bin (currently, that works fine)
2762 # but it's something to keep an eye on.
2763 test "$inst_prefix_dir" = "$destdir" && \
2764 func_fatal_error "error: cannot install \`$file' to a directory not ending in $libdir"
2766 if test -n "$inst_prefix_dir"; then
2767 # Stick the inst_prefix_dir data into the link command.
2768 relink_command=`$ECHO "$relink_command" | $SED "s%@inst_prefix_dir@%-inst-prefix-dir $inst_prefix_dir%"`
2770 relink_command=`$ECHO "$relink_command" | $SED "s%@inst_prefix_dir@%%"`
2773 func_warning "relinking \`$file'"
2774 func_show_eval "$relink_command" \
2775 'func_fatal_error "error: relink \`$file'\'' with the above command before installing it"'
2778 # See the names of the shared library.
2779 set dummy $library_names; shift
2780 if test -n "$1"; then
2785 test -n "$relink_command" && srcname="$realname"T
2787 # Install the shared library and build the symlinks.
2788 func_show_eval "$install_shared_prog $dir/$srcname $destdir/$realname" \
2792 cygwin* | mingw* | pw32* | cegcc*)
2800 if test -n "$tstripme" && test -n "$striplib"; then
2801 func_show_eval "$striplib $destdir/$realname" 'exit $?'
2804 if test "$#" -gt 0; then
2805 # Delete the old symlinks, and create new ones.
2806 # Try `ln -sf' first, because the `ln' binary might depend on
2807 # the symlink we replace! Solaris /bin/ln does not understand -f,
2808 # so we also need to try rm && ln -s.
2811 test "$linkname" != "$realname" \
2812 && func_show_eval "(cd $destdir && { $LN_S -f $realname $linkname || { $RM $linkname && $LN_S $realname $linkname; }; })"
2816 # Do each command in the postinstall commands.
2817 lib="$destdir/$realname"
2818 func_execute_cmds "$postinstall_cmds" 'exit $?'
2821 # Install the pseudo-library for information purposes.
2822 func_basename "$file"
2823 name="$func_basename_result"
2824 instname="$dir/$name"i
2825 func_show_eval "$install_prog $instname $destdir/$name" 'exit $?'
2827 # Maybe install the static library, too.
2828 test -n "$old_library" && staticlibs="$staticlibs $dir/$old_library"
2832 # Install (i.e. copy) a libtool object.
2834 # Figure out destination file name, if it wasn't already specified.
2835 if test -n "$destname"; then
2836 destfile="$destdir/$destname"
2838 func_basename "$file"
2839 destfile="$func_basename_result"
2840 destfile="$destdir/$destfile"
2843 # Deduce the name of the destination old-style object file.
2846 func_lo2o "$destfile"
2847 staticdest=$func_lo2o_result
2850 staticdest="$destfile"
2854 func_fatal_help "cannot copy a libtool object to \`$destfile'"
2858 # Install the libtool object if requested.
2859 test -n "$destfile" && \
2860 func_show_eval "$install_prog $file $destfile" 'exit $?'
2862 # Install the old object if enabled.
2863 if test "$build_old_libs" = yes; then
2864 # Deduce the name of the old-style object file.
2866 staticobj=$func_lo2o_result
2867 func_show_eval "$install_prog \$staticobj \$staticdest" 'exit $?'
2873 # Figure out destination file name, if it wasn't already specified.
2874 if test -n "$destname"; then
2875 destfile="$destdir/$destname"
2877 func_basename "$file"
2878 destfile="$func_basename_result"
2879 destfile="$destdir/$destfile"
2882 # If the file is missing, and there is a .exe on the end, strip it
2883 # because it is most likely a libtool script we actually want to
2888 if test ! -f "$file"; then
2889 func_stripname '' '.exe' "$file"
2890 file=$func_stripname_result
2896 # Do a test to see if this is really a libtool program.
2899 if func_ltwrapper_executable_p "$file"; then
2900 func_ltwrapper_scriptname "$file"
2901 wrapper=$func_ltwrapper_scriptname_result
2903 func_stripname '' '.exe' "$file"
2904 wrapper=$func_stripname_result
2911 if func_ltwrapper_script_p "$wrapper"; then
2915 func_source "$wrapper"
2917 # Check the variables that should have been set.
2918 test -z "$generated_by_libtool_version" && \
2919 func_fatal_error "invalid libtool wrapper script \`$wrapper'"
2922 for lib in $notinst_deplibs; do
2923 # Check to see that each library is installed.
2925 if test -f "$lib"; then
2928 libfile="$libdir/"`$ECHO "$lib" | $SED 's%^.*/%%g'` ### testsuite: skip nested quoting test
2929 if test -n "$libdir" && test ! -f "$libfile"; then
2930 func_warning "\`$lib' has not been installed in \`$libdir'"
2936 func_source "$wrapper"
2939 if test "$fast_install" = no && test -n "$relink_command"; then
2941 if test "$finalize" = yes; then
2942 tmpdir=`func_mktempdir`
2943 func_basename "$file$stripped_ext"
2944 file="$func_basename_result"
2945 outputname="$tmpdir/$file"
2946 # Replace the output file specification.
2947 relink_command=`$ECHO "$relink_command" | $SED 's%@OUTPUT@%'"$outputname"'%g'`
2950 func_quote_for_expand "$relink_command"
2951 eval "func_echo $func_quote_for_expand_result"
2953 if eval "$relink_command"; then :
2955 func_error "error: relink \`$file' with the above command before installing it"
2956 $opt_dry_run || ${RM}r "$tmpdir"
2961 func_warning "cannot relink \`$file'"
2965 # Install the binary that we compiled earlier.
2966 file=`$ECHO "$file$stripped_ext" | $SED "s%\([^/]*\)$%$objdir/\1%"`
2970 # remove .exe since cygwin /usr/bin/install will append another
2972 case $install_prog,$host in
2973 */usr/bin/install*,*cygwin*)
2974 case $file:$destfile in
2979 destfile=$destfile.exe
2982 func_stripname '' '.exe' "$destfile"
2983 destfile=$func_stripname_result
2988 func_show_eval "$install_prog\$stripme \$file \$destfile" 'exit $?'
2989 $opt_dry_run || if test -n "$outputname"; then
2996 for file in $staticlibs; do
2997 func_basename "$file"
2998 name="$func_basename_result"
3000 # Set up the ranlib parameters.
3001 oldlib="$destdir/$name"
3003 func_show_eval "$install_prog \$file \$oldlib" 'exit $?'
3005 if test -n "$stripme" && test -n "$old_striplib"; then
3006 func_show_eval "$old_striplib $oldlib" 'exit $?'
3009 # Do each command in the postinstall commands.
3010 func_execute_cmds "$old_postinstall_cmds" 'exit $?'
3013 test -n "$future_libdirs" && \
3014 func_warning "remember to run \`$progname --finish$future_libdirs'"
3016 if test -n "$current_libdirs"; then
3017 # Maybe just do a dry run.
3018 $opt_dry_run && current_libdirs=" -n$current_libdirs"
3019 exec_cmd='$SHELL $progpath $preserve_args --finish$current_libdirs'
3025 test "$mode" = install && func_mode_install ${1+"$@"}
3028 # func_generate_dlsyms outputname originator pic_p
3029 # Extract symbols from dlprefiles and create ${outputname}S.o with
3030 # a dlpreopen symbol table.
3031 func_generate_dlsyms ()
3037 my_prefix=`$ECHO "$my_originator" | sed 's%[^a-zA-Z0-9]%_%g'`
3040 if test -n "$dlfiles$dlprefiles" || test "$dlself" != no; then
3041 if test -n "$NM" && test -n "$global_symbol_pipe"; then
3042 my_dlsyms="${my_outputname}S.c"
3044 func_error "not configured to extract global symbols from dlpreopened files"
3048 if test -n "$my_dlsyms"; then
3052 # Discover the nlist of each of the dlfiles.
3053 nlist="$output_objdir/${my_outputname}.nm"
3055 func_show_eval "$RM $nlist ${nlist}S ${nlist}T"
3057 # Parse the name list into a source file.
3058 func_verbose "creating $output_objdir/$my_dlsyms"
3060 $opt_dry_run || $ECHO > "$output_objdir/$my_dlsyms" "\
3061 /* $my_dlsyms - symbol resolution table for \`$my_outputname' dlsym emulation. */
3062 /* Generated by $PROGRAM (GNU $PACKAGE$TIMESTAMP) $VERSION */
3068 #if defined(__GNUC__) && (((__GNUC__ == 4) && (__GNUC_MINOR__ >= 4)) || (__GNUC__ > 4))
3069 #pragma GCC diagnostic ignored \"-Wstrict-prototypes\"
3072 /* External symbol declarations for the compiler. */\
3075 if test "$dlself" = yes; then
3076 func_verbose "generating symbol list for \`$output'"
3078 $opt_dry_run || echo ': @PROGRAM@ ' > "$nlist"
3080 # Add our own program objects to the symbol list.
3081 progfiles=`$ECHO "$objs$old_deplibs" | $SP2NL | $SED "$lo2o" | $NL2SP`
3082 for progfile in $progfiles; do
3083 func_verbose "extracting global C symbols from \`$progfile'"
3084 $opt_dry_run || eval "$NM $progfile | $global_symbol_pipe >> '$nlist'"
3087 if test -n "$exclude_expsyms"; then
3089 eval '$EGREP -v " ($exclude_expsyms)$" "$nlist" > "$nlist"T'
3090 eval '$MV "$nlist"T "$nlist"'
3094 if test -n "$export_symbols_regex"; then
3096 eval '$EGREP -e "$export_symbols_regex" "$nlist" > "$nlist"T'
3097 eval '$MV "$nlist"T "$nlist"'
3101 # Prepare the list of exported symbols
3102 if test -z "$export_symbols"; then
3103 export_symbols="$output_objdir/$outputname.exp"
3106 eval "${SED} -n -e '/^: @PROGRAM@ $/d' -e 's/^.* \(.*\)$/\1/p' "'< "$nlist" > "$export_symbols"'
3108 *cygwin* | *mingw* | *cegcc* )
3109 eval "echo EXPORTS "'> "$output_objdir/$outputname.def"'
3110 eval 'cat "$export_symbols" >> "$output_objdir/$outputname.def"'
3116 eval "${SED} -e 's/\([].[*^$]\)/\\\\\1/g' -e 's/^/ /' -e 's/$/$/'"' < "$export_symbols" > "$output_objdir/$outputname.exp"'
3117 eval '$GREP -f "$output_objdir/$outputname.exp" < "$nlist" > "$nlist"T'
3118 eval '$MV "$nlist"T "$nlist"'
3120 *cygwin* | *mingw* | *cegcc* )
3121 eval "echo EXPORTS "'> "$output_objdir/$outputname.def"'
3122 eval 'cat "$nlist" >> "$output_objdir/$outputname.def"'
3129 for dlprefile in $dlprefiles; do
3130 func_verbose "extracting global C symbols from \`$dlprefile'"
3131 func_basename "$dlprefile"
3132 name="$func_basename_result"
3134 eval '$ECHO ": $name " >> "$nlist"'
3135 eval "$NM $dlprefile 2>/dev/null | $global_symbol_pipe >> '$nlist'"
3140 # Make sure we have at least an empty file.
3141 test -f "$nlist" || : > "$nlist"
3143 if test -n "$exclude_expsyms"; then
3144 $EGREP -v " ($exclude_expsyms)$" "$nlist" > "$nlist"T
3145 $MV "$nlist"T "$nlist"
3148 # Try sorting and uniquifying the output.
3149 if $GREP -v "^: " < "$nlist" |
3150 if sort -k 3 </dev/null >/dev/null 2>&1; then
3155 uniq > "$nlist"S; then
3158 $GREP -v "^: " < "$nlist" > "$nlist"S
3161 if test -f "$nlist"S; then
3162 eval "$global_symbol_to_cdecl"' < "$nlist"S >> "$output_objdir/$my_dlsyms"'
3164 echo '/* NONE */' >> "$output_objdir/$my_dlsyms"
3167 echo >> "$output_objdir/$my_dlsyms" "\
3169 /* The mapping between symbol names and symbols. */
3176 *cygwin* | *mingw* | *cegcc* )
3177 echo >> "$output_objdir/$my_dlsyms" "\
3178 /* DATA imports from DLLs on WIN32 con't be const, because
3179 runtime relocations are performed -- see ld's documentation
3180 on pseudo-relocs. */"
3183 echo >> "$output_objdir/$my_dlsyms" "\
3184 /* This system does not cope well with relocations in const data */"
3187 lt_dlsym_const=const ;;
3190 echo >> "$output_objdir/$my_dlsyms" "\
3191 extern $lt_dlsym_const lt_dlsymlist
3192 lt_${my_prefix}_LTX_preloaded_symbols[];
3193 $lt_dlsym_const lt_dlsymlist
3194 lt_${my_prefix}_LTX_preloaded_symbols[] =
3196 { \"$my_originator\", (void *) 0 },"
3198 case $need_lib_prefix in
3200 eval "$global_symbol_to_c_name_address" < "$nlist" >> "$output_objdir/$my_dlsyms"
3203 eval "$global_symbol_to_c_name_address_lib_prefix" < "$nlist" >> "$output_objdir/$my_dlsyms"
3206 echo >> "$output_objdir/$my_dlsyms" "\
3210 /* This works around a problem in FreeBSD linker */
3211 #ifdef FREEBSD_WORKAROUND
3212 static const void *lt_preloaded_setup() {
3213 return lt_${my_prefix}_LTX_preloaded_symbols;
3223 pic_flag_for_symtable=
3224 case "$compile_command " in
3228 # compiling the symbol table file with pic_flag works around
3229 # a FreeBSD bug that causes programs to crash when -lm is
3230 # linked before any other PIC object. But we must not use
3231 # pic_flag when linking with -static. The problem exists in
3232 # FreeBSD 2.2.6 and is fixed in FreeBSD 3.1.
3233 *-*-freebsd2*|*-*-freebsd3.0*|*-*-freebsdelf3.0*)
3234 pic_flag_for_symtable=" $pic_flag -DFREEBSD_WORKAROUND" ;;
3236 pic_flag_for_symtable=" $pic_flag" ;;
3238 if test "X$my_pic_p" != Xno; then
3239 pic_flag_for_symtable=" $pic_flag"
3246 for arg in $LTCFLAGS; do
3248 -pie | -fpie | -fPIE) ;;
3249 *) symtab_cflags="$symtab_cflags $arg" ;;
3253 # Now compile the dynamic symbol file.
3254 func_show_eval '(cd $output_objdir && $LTCC$symtab_cflags -c$no_builtin_flag$pic_flag_for_symtable "$my_dlsyms")' 'exit $?'
3256 # Clean up the generated files.
3257 func_show_eval '$RM "$output_objdir/$my_dlsyms" "$nlist" "${nlist}S" "${nlist}T"'
3259 # Transform the symbol file into the correct name.
3260 symfileobj="$output_objdir/${my_outputname}S.$objext"
3262 *cygwin* | *mingw* | *cegcc* )
3263 if test -f "$output_objdir/$my_outputname.def"; then
3264 compile_command=`$ECHO "$compile_command" | $SED "s%@SYMFILE@%$output_objdir/$my_outputname.def $symfileobj%"`
3265 finalize_command=`$ECHO "$finalize_command" | $SED "s%@SYMFILE@%$output_objdir/$my_outputname.def $symfileobj%"`
3267 compile_command=`$ECHO "$compile_command" | $SED "s%@SYMFILE@%$symfileobj%"`
3268 finalize_command=`$ECHO "$finalize_command" | $SED "s%@SYMFILE@%$symfileobj%"`
3272 compile_command=`$ECHO "$compile_command" | $SED "s%@SYMFILE@%$symfileobj%"`
3273 finalize_command=`$ECHO "$finalize_command" | $SED "s%@SYMFILE@%$symfileobj%"`
3278 func_fatal_error "unknown suffix for \`$my_dlsyms'"
3282 # We keep going just in case the user didn't refer to
3283 # lt_preloaded_symbols. The linker will fail if global_symbol_pipe
3284 # really was required.
3286 # Nullify the symbol file.
3287 compile_command=`$ECHO "$compile_command" | $SED "s% @SYMFILE@%%"`
3288 finalize_command=`$ECHO "$finalize_command" | $SED "s% @SYMFILE@%%"`
3292 # func_win32_libid arg
3293 # return the library type of file 'arg'
3295 # Need a lot of goo to handle *both* DLLs and import libs
3296 # Has to be a shell function in order to 'eat' the argument
3297 # that is supplied when $file_magic_command is called.
3298 # Despite the name, also deal with 64 bit binaries.
3302 win32_libid_type="unknown"
3303 win32_fileres=`file -L $1 2>/dev/null`
3304 case $win32_fileres in
3305 *ar\ archive\ import\ library*) # definitely import
3306 win32_libid_type="x86 archive import"
3308 *ar\ archive*) # could be an import, or static
3309 if eval $OBJDUMP -f $1 | $SED -e '10q' 2>/dev/null |
3310 $EGREP 'file format (pe-i386(.*architecture: i386)?|pe-arm-wince|pe-x86-64)' >/dev/null; then
3311 win32_nmres=`eval $NM -f posix -A $1 |
3320 case $win32_nmres in
3321 import*) win32_libid_type="x86 archive import";;
3322 *) win32_libid_type="x86 archive static";;
3327 win32_libid_type="x86 DLL"
3329 *executable*) # but shell scripts are "executable" too...
3330 case $win32_fileres in
3331 *MS\ Windows\ PE\ Intel*)
3332 win32_libid_type="x86 DLL"
3337 $ECHO "$win32_libid_type"
3342 # func_extract_an_archive dir oldlib
3343 func_extract_an_archive ()
3346 f_ex_an_ar_dir="$1"; shift
3347 f_ex_an_ar_oldlib="$1"
3348 if test "$lock_old_archive_extraction" = yes; then
3349 lockfile=$f_ex_an_ar_oldlib.lock
3350 until $opt_dry_run || ln "$progpath" "$lockfile" 2>/dev/null; do
3351 func_echo "Waiting for $lockfile to be removed"
3355 func_show_eval "(cd \$f_ex_an_ar_dir && $AR x \"\$f_ex_an_ar_oldlib\")" \
3356 'stat=$?; rm -f "$lockfile"; exit $stat'
3357 if test "$lock_old_archive_extraction" = yes; then
3358 $opt_dry_run || rm -f "$lockfile"
3360 if ($AR t "$f_ex_an_ar_oldlib" | sort | sort -uc >/dev/null 2>&1); then
3363 func_fatal_error "object name conflicts in archive: $f_ex_an_ar_dir/$f_ex_an_ar_oldlib"
3368 # func_extract_archives gentop oldlib ...
3369 func_extract_archives ()
3372 my_gentop="$1"; shift
3373 my_oldlibs=${1+"$@"}
3379 for my_xlib in $my_oldlibs; do
3380 # Extract the objects.
3382 [\\/]* | [A-Za-z]:[\\/]*) my_xabs="$my_xlib" ;;
3383 *) my_xabs=`pwd`"/$my_xlib" ;;
3385 func_basename "$my_xlib"
3386 my_xlib="$func_basename_result"
3389 case " $extracted_archives " in
3391 func_arith $extracted_serial + 1
3392 extracted_serial=$func_arith_result
3393 my_xlib_u=lt$extracted_serial-$my_xlib ;;
3397 extracted_archives="$extracted_archives $my_xlib_u"
3398 my_xdir="$my_gentop/$my_xlib_u"
3400 func_mkdir_p "$my_xdir"
3404 func_verbose "Extracting $my_xabs"
3405 # Do not bother doing anything if just a dry run
3407 darwin_orig_dir=`pwd`
3408 cd $my_xdir || exit $?
3409 darwin_archive=$my_xabs
3411 darwin_base_archive=`basename "$darwin_archive"`
3412 darwin_arches=`$LIPO -info "$darwin_archive" 2>/dev/null | $GREP Architectures 2>/dev/null || true`
3413 if test -n "$darwin_arches"; then
3414 darwin_arches=`$ECHO "$darwin_arches" | $SED -e 's/.*are://'`
3416 func_verbose "$darwin_base_archive has multiple architectures $darwin_arches"
3417 for darwin_arch in $darwin_arches ; do
3418 func_mkdir_p "unfat-$$/${darwin_base_archive}-${darwin_arch}"
3419 $LIPO -thin $darwin_arch -output "unfat-$$/${darwin_base_archive}-${darwin_arch}/${darwin_base_archive}" "${darwin_archive}"
3420 cd "unfat-$$/${darwin_base_archive}-${darwin_arch}"
3421 func_extract_an_archive "`pwd`" "${darwin_base_archive}"
3423 $RM "unfat-$$/${darwin_base_archive}-${darwin_arch}/${darwin_base_archive}"
3424 done # $darwin_arches
3425 ## Okay now we've a bunch of thin objects, gotta fatten them up :)
3426 darwin_filelist=`find unfat-$$ -type f -name \*.o -print -o -name \*.lo -print | $SED -e "$basename" | sort -u`
3429 for darwin_file in $darwin_filelist; do
3430 darwin_files=`find unfat-$$ -name $darwin_file -print | $NL2SP`
3431 $LIPO -create -output "$darwin_file" $darwin_files
3432 done # $darwin_filelist
3434 cd "$darwin_orig_dir"
3437 func_extract_an_archive "$my_xdir" "$my_xabs"
3442 func_extract_an_archive "$my_xdir" "$my_xabs"
3445 my_oldobjs="$my_oldobjs "`find $my_xdir -name \*.$objext -print -o -name \*.lo -print | $NL2SP`
3448 func_extract_archives_result="$my_oldobjs"
3452 # func_emit_wrapper [arg=no]
3454 # Emit a libtool wrapper script on stdout.
3455 # Don't directly open a file because we may want to
3456 # incorporate the script contents within a cygwin/mingw
3457 # wrapper executable. Must ONLY be called from within
3458 # func_mode_link because it depends on a number of variables
3461 # ARG is the value that the WRAPPER_SCRIPT_BELONGS_IN_OBJDIR
3462 # variable will take. If 'yes', then the emitted script
3463 # will assume that the directory in which it is stored is
3464 # the $objdir directory. This is a cygwin/mingw-specific
3466 func_emit_wrapper ()
3468 func_emit_wrapper_arg1=${1-no}
3473 # $output - temporary wrapper script for $objdir/$outputname
3474 # Generated by $PROGRAM (GNU $PACKAGE$TIMESTAMP) $VERSION
3476 # The $output program cannot be directly executed until all the libtool
3477 # libraries that it depends on are installed.
3479 # This wrapper script should never be moved out of the build directory.
3480 # If it is, it will not operate correctly.
3482 # Sed substitution that helps us do robust quoting. It backslashifies
3483 # metacharacters that are still active within double-quoted strings.
3484 sed_quote_subst='$sed_quote_subst'
3486 # Be Bourne compatible
3487 if test -n \"\${ZSH_VERSION+set}\" && (emulate sh) >/dev/null 2>&1; then
3490 # Zsh 3.x and 4.x performs word splitting on \${1+\"\$@\"}, which
3491 # is contrary to our usage. Disable this feature.
3492 alias -g '\${1+\"\$@\"}'='\"\$@\"'
3493 setopt NO_GLOB_SUBST
3495 case \`(set -o) 2>/dev/null\` in *posix*) set -o posix;; esac
3497 BIN_SH=xpg4; export BIN_SH # for Tru64
3498 DUALCASE=1; export DUALCASE # for MKS sh
3500 # The HP-UX ksh and POSIX shell print the target directory to stdout
3502 (unset CDPATH) >/dev/null 2>&1 && unset CDPATH
3504 relink_command=\"$relink_command\"
3506 # This environment variable determines our operation mode.
3507 if test \"\$libtool_install_magic\" = \"$magic\"; then
3508 # install mode needs the following variables:
3509 generated_by_libtool_version='$macro_version'
3510 notinst_deplibs='$notinst_deplibs'
3512 # When we are sourced in execute mode, \$file and \$ECHO are already set.
3513 if test \"\$libtool_execute_magic\" != \"$magic\"; then
3516 qECHO=`$ECHO "$ECHO" | $SED "$sed_quote_subst"`
3519 # A function that is used when there is no print builtin or printf.
3520 func_fallback_echo ()
3522 eval 'cat <<_LTECHO_EOF
3529 # Find the directory that this script lives in.
3530 thisdir=\`\$ECHO \"\$file\" | $SED 's%/[^/]*$%%'\`
3531 test \"x\$thisdir\" = \"x\$file\" && thisdir=.
3533 # Follow symbolic links until we get to the real thisdir.
3534 file=\`ls -ld \"\$file\" | $SED -n 's/.*-> //p'\`
3535 while test -n \"\$file\"; do
3536 destdir=\`\$ECHO \"\$file\" | $SED 's%/[^/]*\$%%'\`
3538 # If there was a directory component, then change thisdir.
3539 if test \"x\$destdir\" != \"x\$file\"; then
3540 case \"\$destdir\" in
3541 [\\\\/]* | [A-Za-z]:[\\\\/]*) thisdir=\"\$destdir\" ;;
3542 *) thisdir=\"\$thisdir/\$destdir\" ;;
3546 file=\`\$ECHO \"\$file\" | $SED 's%^.*/%%'\`
3547 file=\`ls -ld \"\$thisdir/\$file\" | $SED -n 's/.*-> //p'\`
3550 # Usually 'no', except on cygwin/mingw when embedded into
3552 WRAPPER_SCRIPT_BELONGS_IN_OBJDIR=$func_emit_wrapper_arg1
3553 if test \"\$WRAPPER_SCRIPT_BELONGS_IN_OBJDIR\" = \"yes\"; then
3554 # special case for '.'
3555 if test \"\$thisdir\" = \".\"; then
3558 # remove .libs from thisdir
3559 case \"\$thisdir\" in
3560 *[\\\\/]$objdir ) thisdir=\`\$ECHO \"\$thisdir\" | $SED 's%[\\\\/][^\\\\/]*$%%'\` ;;
3561 $objdir ) thisdir=. ;;
3565 # Try to get the absolute directory name.
3566 absdir=\`cd \"\$thisdir\" && pwd\`
3567 test -n \"\$absdir\" && thisdir=\"\$absdir\"
3570 if test "$fast_install" = yes; then
3572 program=lt-'$outputname'$exeext
3573 progdir=\"\$thisdir/$objdir\"
3575 if test ! -f \"\$progdir/\$program\" ||
3576 { file=\`ls -1dt \"\$progdir/\$program\" \"\$progdir/../\$program\" 2>/dev/null | ${SED} 1q\`; \\
3577 test \"X\$file\" != \"X\$progdir/\$program\"; }; then
3579 file=\"\$\$-\$program\"
3581 if test ! -d \"\$progdir\"; then
3582 $MKDIR \"\$progdir\"
3584 $RM \"\$progdir/\$file\"
3589 # relink executable if necessary
3590 if test -n \"\$relink_command\"; then
3591 if relink_command_output=\`eval \$relink_command 2>&1\`; then :
3593 $ECHO \"\$relink_command_output\" >&2
3594 $RM \"\$progdir/\$file\"
3599 $MV \"\$progdir/\$file\" \"\$progdir/\$program\" 2>/dev/null ||
3600 { $RM \"\$progdir/\$program\";
3601 $MV \"\$progdir/\$file\" \"\$progdir/\$program\"; }
3602 $RM \"\$progdir/\$file\"
3606 program='$outputname'
3607 progdir=\"\$thisdir/$objdir\"
3613 if test -f \"\$progdir/\$program\"; then"
3615 # Export our shlibpath_var if we have one.
3616 if test "$shlibpath_overrides_runpath" = yes && test -n "$shlibpath_var" && test -n "$temp_rpath"; then
3618 # Add our own library path to $shlibpath_var
3619 $shlibpath_var=\"$temp_rpath\$$shlibpath_var\"
3621 # Some systems cannot cope with colon-terminated $shlibpath_var
3622 # The second colon is a workaround for a bug in BeOS R4 sed
3623 $shlibpath_var=\`\$ECHO \"\$$shlibpath_var\" | $SED 's/::*\$//'\`
3625 export $shlibpath_var
3629 # fixup the dll searchpath if we need to.
3630 if test -n "$dllsearchpath"; then
3632 # Add the dll search path components to the executable PATH
3633 PATH=$dllsearchpath:\$PATH
3638 if test \"\$libtool_execute_magic\" != \"$magic\"; then
3639 # Run the actual program with our arguments.
3642 # Backslashes separate directories on plain windows
3643 *-*-mingw | *-*-os2* | *-cegcc*)
3645 exec \"\$progdir\\\\\$program\" \${1+\"\$@\"}
3651 exec \"\$progdir/\$program\" \${1+\"\$@\"}
3656 \$ECHO \"\$0: cannot exec \$program \$*\" 1>&2
3660 # The program doesn't exist.
3661 \$ECHO \"\$0: error: \\\`\$progdir/\$program' does not exist\" 1>&2
3662 \$ECHO \"This script is just a wrapper for \$program.\" 1>&2
3663 \$ECHO \"See the $PACKAGE documentation for more information.\" 1>&2
3671 # func_to_host_path arg
3673 # Convert paths to host format when used with build tools.
3674 # Intended for use with "native" mingw (where libtool itself
3675 # is running under the msys shell), or in the following cross-
3676 # build environments:
3678 # mingw (msys) mingw [e.g. native]
3681 # where wine is equipped with the `winepath' executable.
3682 # In the native mingw case, the (msys) shell automatically
3683 # converts paths for any non-msys applications it launches,
3684 # but that facility isn't available from inside the cwrapper.
3685 # Similar accommodations are necessary for $host mingw and
3686 # $build cygwin. Calling this function does no harm for other
3687 # $host/$build combinations not listed above.
3689 # ARG is the path (on $build) that should be converted to
3690 # the proper representation for $host. The result is stored
3691 # in $func_to_host_path_result.
3692 func_to_host_path ()
3694 func_to_host_path_result="$1"
3695 if test -n "$1"; then
3698 lt_sed_naive_backslashify='s|\\\\*|\\|g;s|/|\\|g;s|\\|\\\\|g'
3700 *mingw* ) # actually, msys
3701 # awkward: cmd appends spaces to result
3702 func_to_host_path_result=`( cmd //c echo "$1" ) 2>/dev/null |
3703 $SED -e 's/[ ]*$//' -e "$lt_sed_naive_backslashify"`
3706 func_to_host_path_result=`cygpath -w "$1" |
3707 $SED -e "$lt_sed_naive_backslashify"`
3710 # Unfortunately, winepath does not exit with a non-zero
3711 # error code, so we are forced to check the contents of
3712 # stdout. On the other hand, if the command is not
3713 # found, the shell will set an exit code of 127 and print
3714 # *an error message* to stdout. So we must check for both
3715 # error code of zero AND non-empty stdout, which explains
3716 # the odd construction:
3717 func_to_host_path_tmp1=`winepath -w "$1" 2>/dev/null`
3718 if test "$?" -eq 0 && test -n "${func_to_host_path_tmp1}"; then
3719 func_to_host_path_result=`$ECHO "$func_to_host_path_tmp1" |
3720 $SED -e "$lt_sed_naive_backslashify"`
3722 # Allow warning below.
3723 func_to_host_path_result=
3727 if test -z "$func_to_host_path_result" ; then
3728 func_error "Could not determine host path corresponding to"
3730 func_error "Continuing, but uninstalled executables may not work."
3732 func_to_host_path_result="$1"
3738 # end: func_to_host_path
3740 # func_to_host_pathlist arg
3742 # Convert pathlists to host format when used with build tools.
3743 # See func_to_host_path(), above. This function supports the
3744 # following $build/$host combinations (but does no harm for
3745 # combinations not listed here):
3747 # mingw (msys) mingw [e.g. native]
3751 # Path separators are also converted from $build format to
3752 # $host format. If ARG begins or ends with a path separator
3753 # character, it is preserved (but converted to $host format)
3756 # ARG is a pathlist (on $build) that should be converted to
3757 # the proper representation on $host. The result is stored
3758 # in $func_to_host_pathlist_result.
3759 func_to_host_pathlist ()
3761 func_to_host_pathlist_result="$1"
3762 if test -n "$1"; then
3765 lt_sed_naive_backslashify='s|\\\\*|\\|g;s|/|\\|g;s|\\|\\\\|g'
3766 # Remove leading and trailing path separator characters from
3767 # ARG. msys behavior is inconsistent here, cygpath turns them
3768 # into '.;' and ';.', and winepath ignores them completely.
3769 func_stripname : : "$1"
3770 func_to_host_pathlist_tmp1=$func_stripname_result
3772 *mingw* ) # Actually, msys.
3773 # Awkward: cmd appends spaces to result.
3774 func_to_host_pathlist_result=`
3775 ( cmd //c echo "$func_to_host_pathlist_tmp1" ) 2>/dev/null |
3776 $SED -e 's/[ ]*$//' -e "$lt_sed_naive_backslashify"`
3779 func_to_host_pathlist_result=`cygpath -w -p "$func_to_host_pathlist_tmp1" |
3780 $SED -e "$lt_sed_naive_backslashify"`
3783 # unfortunately, winepath doesn't convert pathlists
3784 func_to_host_pathlist_result=""
3785 func_to_host_pathlist_oldIFS=$IFS
3787 for func_to_host_pathlist_f in $func_to_host_pathlist_tmp1 ; do
3788 IFS=$func_to_host_pathlist_oldIFS
3789 if test -n "$func_to_host_pathlist_f" ; then
3790 func_to_host_path "$func_to_host_pathlist_f"
3791 if test -n "$func_to_host_path_result" ; then
3792 if test -z "$func_to_host_pathlist_result" ; then
3793 func_to_host_pathlist_result="$func_to_host_path_result"
3795 func_append func_to_host_pathlist_result ";$func_to_host_path_result"
3800 IFS=$func_to_host_pathlist_oldIFS
3803 if test -z "$func_to_host_pathlist_result"; then
3804 func_error "Could not determine the host path(s) corresponding to"
3806 func_error "Continuing, but uninstalled executables may not work."
3807 # Fallback. This may break if $1 contains DOS-style drive
3808 # specifications. The fix is not to complicate the expression
3809 # below, but for the user to provide a working wine installation
3810 # with winepath so that path translation in the cross-to-mingw
3811 # case works properly.
3812 lt_replace_pathsep_nix_to_dos="s|:|;|g"
3813 func_to_host_pathlist_result=`echo "$func_to_host_pathlist_tmp1" |\
3814 $SED -e "$lt_replace_pathsep_nix_to_dos"`
3816 # Now, add the leading and trailing path separators back
3818 :* ) func_to_host_pathlist_result=";$func_to_host_pathlist_result"
3822 *: ) func_append func_to_host_pathlist_result ";"
3829 # end: func_to_host_pathlist
3831 # func_emit_cwrapperexe_src
3832 # emit the source code for a wrapper executable on stdout
3833 # Must ONLY be called from within func_mode_link because
3834 # it depends on a number of variable set therein.
3835 func_emit_cwrapperexe_src ()
3839 /* $cwrappersource - temporary wrapper executable for $objdir/$outputname
3840 Generated by $PROGRAM (GNU $PACKAGE$TIMESTAMP) $VERSION
3842 The $output program cannot be directly executed until all the libtool
3843 libraries that it depends on are installed.
3845 This wrapper executable should never be moved out of the build directory.
3846 If it is, it will not operate correctly.
3848 Currently, it simply execs the wrapper *script* "$SHELL $output",
3849 but could eventually absorb all of the scripts functionality and
3850 exec $objdir/$outputname directly.
3855 # define _CRT_SECURE_NO_DEPRECATE 1
3860 # include <direct.h>
3861 # include <process.h>
3864 # include <unistd.h>
3865 # include <stdint.h>
3877 #include <sys/stat.h>
3879 /* declarations of non-ANSI functions */
3880 #if defined(__MINGW32__)
3881 # ifdef __STRICT_ANSI__
3882 int _putenv (const char *);
3884 #elif defined(__CYGWIN__)
3885 # ifdef __STRICT_ANSI__
3886 char *realpath (const char *, char *);
3887 int putenv (char *);
3888 int setenv (const char *, const char *, int);
3890 /* #elif defined (other platforms) ... */
3893 /* portability defines, excluding path handling macros */
3894 #if defined(_MSC_VER)
3895 # define setmode _setmode
3897 # define chmod _chmod
3898 # define getcwd _getcwd
3899 # define putenv _putenv
3900 # define S_IXUSR _S_IEXEC
3901 # ifndef _INTPTR_T_DEFINED
3902 # define _INTPTR_T_DEFINED
3903 # define intptr_t int
3905 #elif defined(__MINGW32__)
3906 # define setmode _setmode
3908 # define chmod _chmod
3909 # define getcwd _getcwd
3910 # define putenv _putenv
3911 #elif defined(__CYGWIN__)
3912 # define HAVE_SETENV
3913 # define FOPEN_WB "wb"
3914 /* #elif defined (other platforms) ... */
3917 #if defined(PATH_MAX)
3918 # define LT_PATHMAX PATH_MAX
3919 #elif defined(MAXPATHLEN)
3920 # define LT_PATHMAX MAXPATHLEN
3922 # define LT_PATHMAX 1024
3932 /* path handling portability macros */
3933 #ifndef DIR_SEPARATOR
3934 # define DIR_SEPARATOR '/'
3935 # define PATH_SEPARATOR ':'
3938 #if defined (_WIN32) || defined (__MSDOS__) || defined (__DJGPP__) || \
3940 # define HAVE_DOS_BASED_FILE_SYSTEM
3941 # define FOPEN_WB "wb"
3942 # ifndef DIR_SEPARATOR_2
3943 # define DIR_SEPARATOR_2 '\\'
3945 # ifndef PATH_SEPARATOR_2
3946 # define PATH_SEPARATOR_2 ';'
3950 #ifndef DIR_SEPARATOR_2
3951 # define IS_DIR_SEPARATOR(ch) ((ch) == DIR_SEPARATOR)
3952 #else /* DIR_SEPARATOR_2 */
3953 # define IS_DIR_SEPARATOR(ch) \
3954 (((ch) == DIR_SEPARATOR) || ((ch) == DIR_SEPARATOR_2))
3955 #endif /* DIR_SEPARATOR_2 */
3957 #ifndef PATH_SEPARATOR_2
3958 # define IS_PATH_SEPARATOR(ch) ((ch) == PATH_SEPARATOR)
3959 #else /* PATH_SEPARATOR_2 */
3960 # define IS_PATH_SEPARATOR(ch) ((ch) == PATH_SEPARATOR_2)
3961 #endif /* PATH_SEPARATOR_2 */
3964 # define FOPEN_WB "w"
3967 # define _O_BINARY 0
3970 #define XMALLOC(type, num) ((type *) xmalloc ((num) * sizeof(type)))
3971 #define XFREE(stale) do { \
3972 if (stale) { free ((void *) stale); stale = 0; } \
3975 #undef LTWRAPPER_DEBUGPRINTF
3976 #if defined LT_DEBUGWRAPPER
3977 # define LTWRAPPER_DEBUGPRINTF(args) ltwrapper_debugprintf args
3979 ltwrapper_debugprintf (const char *fmt, ...)
3982 va_start (args, fmt);
3983 (void) vfprintf (stderr, fmt, args);
3987 # define LTWRAPPER_DEBUGPRINTF(args)
3990 const char *program_name = NULL;
3992 void *xmalloc (size_t num);
3993 char *xstrdup (const char *string);
3994 const char *base_name (const char *name);
3995 char *find_executable (const char *wrapper);
3996 char *chase_symlinks (const char *pathspec);
3997 int make_executable (const char *path);
3998 int check_executable (const char *path);
3999 char *strendzap (char *str, const char *pat);
4000 void lt_fatal (const char *message, ...);
4001 void lt_setenv (const char *name, const char *value);
4002 char *lt_extend_str (const char *orig_value, const char *add, int to_end);
4003 void lt_update_exe_path (const char *name, const char *value);
4004 void lt_update_lib_path (const char *name, const char *value);
4005 char **prepare_spawn (char **argv);
4006 void lt_dump_script (FILE *f);
4010 const char * MAGIC_EXE = "$magic_exe";
4011 const char * LIB_PATH_VARNAME = "$shlibpath_var";
4014 if test "$shlibpath_overrides_runpath" = yes && test -n "$shlibpath_var" && test -n "$temp_rpath"; then
4015 func_to_host_pathlist "$temp_rpath"
4017 const char * LIB_PATH_VALUE = "$func_to_host_pathlist_result";
4021 const char * LIB_PATH_VALUE = "";
4025 if test -n "$dllsearchpath"; then
4026 func_to_host_pathlist "$dllsearchpath:"
4028 const char * EXE_PATH_VARNAME = "PATH";
4029 const char * EXE_PATH_VALUE = "$func_to_host_pathlist_result";
4033 const char * EXE_PATH_VARNAME = "";
4034 const char * EXE_PATH_VALUE = "";
4038 if test "$fast_install" = yes; then
4040 const char * TARGET_PROGRAM_NAME = "lt-$outputname"; /* hopefully, no .exe */
4044 const char * TARGET_PROGRAM_NAME = "$outputname"; /* hopefully, no .exe */
4051 #define LTWRAPPER_OPTION_PREFIX "--lt-"
4052 #define LTWRAPPER_OPTION_PREFIX_LENGTH 5
4054 static const size_t opt_prefix_len = LTWRAPPER_OPTION_PREFIX_LENGTH;
4055 static const char *ltwrapper_option_prefix = LTWRAPPER_OPTION_PREFIX;
4057 static const char *dumpscript_opt = LTWRAPPER_OPTION_PREFIX "dump-script";
4060 main (int argc, char *argv[])
4065 char *actual_cwrapper_path;
4066 char *actual_cwrapper_name;
4069 intptr_t rval = 127;
4073 program_name = (char *) xstrdup (base_name (argv[0]));
4074 LTWRAPPER_DEBUGPRINTF (("(main) argv[0] : %s\n", argv[0]));
4075 LTWRAPPER_DEBUGPRINTF (("(main) program_name : %s\n", program_name));
4077 /* very simple arg parsing; don't want to rely on getopt */
4078 for (i = 1; i < argc; i++)
4080 if (strcmp (argv[i], dumpscript_opt) == 0)
4084 *mingw* | *cygwin* )
4085 # make stdout use "unix" line endings
4086 echo " setmode(1,_O_BINARY);"
4091 lt_dump_script (stdout);
4096 newargz = XMALLOC (char *, argc + 1);
4097 tmp_pathspec = find_executable (argv[0]);
4098 if (tmp_pathspec == NULL)
4099 lt_fatal ("Couldn't find %s", argv[0]);
4100 LTWRAPPER_DEBUGPRINTF (("(main) found exe (before symlink chase) at : %s\n",
4103 actual_cwrapper_path = chase_symlinks (tmp_pathspec);
4104 LTWRAPPER_DEBUGPRINTF (("(main) found exe (after symlink chase) at : %s\n",
4105 actual_cwrapper_path));
4106 XFREE (tmp_pathspec);
4108 actual_cwrapper_name = xstrdup( base_name (actual_cwrapper_path));
4109 strendzap (actual_cwrapper_path, actual_cwrapper_name);
4111 /* wrapper name transforms */
4112 strendzap (actual_cwrapper_name, ".exe");
4113 tmp_pathspec = lt_extend_str (actual_cwrapper_name, ".exe", 1);
4114 XFREE (actual_cwrapper_name);
4115 actual_cwrapper_name = tmp_pathspec;
4118 /* target_name transforms -- use actual target program name; might have lt- prefix */
4119 target_name = xstrdup (base_name (TARGET_PROGRAM_NAME));
4120 strendzap (target_name, ".exe");
4121 tmp_pathspec = lt_extend_str (target_name, ".exe", 1);
4122 XFREE (target_name);
4123 target_name = tmp_pathspec;
4126 LTWRAPPER_DEBUGPRINTF (("(main) libtool target name: %s\n",
4132 XMALLOC (char, (strlen (actual_cwrapper_path) +
4133 strlen ("$objdir") + 1 + strlen (actual_cwrapper_name) + 1));
4134 strcpy (newargz[0], actual_cwrapper_path);
4135 strcat (newargz[0], "$objdir");
4136 strcat (newargz[0], "/");
4140 /* stop here, and copy so we don't have to do this twice */
4141 tmp_pathspec = xstrdup (newargz[0]);
4143 /* do NOT want the lt- prefix here, so use actual_cwrapper_name */
4144 strcat (newargz[0], actual_cwrapper_name);
4146 /* DO want the lt- prefix here if it exists, so use target_name */
4147 lt_argv_zero = lt_extend_str (tmp_pathspec, target_name, 1);
4148 XFREE (tmp_pathspec);
4149 tmp_pathspec = NULL;
4157 while ((p = strchr (newargz[0], '\\')) != NULL)
4161 while ((p = strchr (lt_argv_zero, '\\')) != NULL)
4171 XFREE (target_name);
4172 XFREE (actual_cwrapper_path);
4173 XFREE (actual_cwrapper_name);
4175 lt_setenv ("BIN_SH", "xpg4"); /* for Tru64 */
4176 lt_setenv ("DUALCASE", "1"); /* for MSK sh */
4177 lt_update_lib_path (LIB_PATH_VARNAME, LIB_PATH_VALUE);
4178 lt_update_exe_path (EXE_PATH_VARNAME, EXE_PATH_VALUE);
4181 for (i = 1; i < argc; i++)
4183 if (strncmp (argv[i], ltwrapper_option_prefix, opt_prefix_len) == 0)
4185 /* however, if there is an option in the LTWRAPPER_OPTION_PREFIX
4186 namespace, but it is not one of the ones we know about and
4187 have already dealt with, above (inluding dump-script), then
4188 report an error. Otherwise, targets might begin to believe
4189 they are allowed to use options in the LTWRAPPER_OPTION_PREFIX
4190 namespace. The first time any user complains about this, we'll
4191 need to make LTWRAPPER_OPTION_PREFIX a configure-time option
4192 or a configure.ac-settable value.
4194 lt_fatal ("Unrecognized option in %s namespace: '%s'",
4195 ltwrapper_option_prefix, argv[i]);
4198 newargz[++newargc] = xstrdup (argv[i]);
4200 newargz[++newargc] = NULL;
4202 LTWRAPPER_DEBUGPRINTF (("(main) lt_argv_zero : %s\n", (lt_argv_zero ? lt_argv_zero : "<NULL>")));
4203 for (i = 0; i < newargc; i++)
4205 LTWRAPPER_DEBUGPRINTF (("(main) newargz[%d] : %s\n", i, (newargz[i] ? newargz[i] : "<NULL>")));
4213 /* execv doesn't actually work on mingw as expected on unix */
4214 newargz = prepare_spawn (newargz);
4215 rval = _spawnv (_P_WAIT, lt_argv_zero, (const char * const *) newargz);
4218 /* failed to start process */
4219 LTWRAPPER_DEBUGPRINTF (("(main) failed to launch target \"%s\": errno = %d\n", lt_argv_zero, errno));
4227 execv (lt_argv_zero, newargz);
4228 return rval; /* =127, but avoids unused variable warning */
4237 xmalloc (size_t num)
4239 void *p = (void *) malloc (num);
4241 lt_fatal ("Memory exhausted");
4247 xstrdup (const char *string)
4249 return string ? strcpy ((char *) xmalloc (strlen (string) + 1),
4254 base_name (const char *name)
4258 #if defined (HAVE_DOS_BASED_FILE_SYSTEM)
4259 /* Skip over the disk name in MSDOS pathnames. */
4260 if (isalpha ((unsigned char) name[0]) && name[1] == ':')
4264 for (base = name; *name; name++)
4265 if (IS_DIR_SEPARATOR (*name))
4271 check_executable (const char *path)
4275 LTWRAPPER_DEBUGPRINTF (("(check_executable) : %s\n",
4276 path ? (*path ? path : "EMPTY!") : "NULL!"));
4277 if ((!path) || (!*path))
4280 if ((stat (path, &st) >= 0)
4281 && (st.st_mode & (S_IXUSR | S_IXGRP | S_IXOTH)))
4288 make_executable (const char *path)
4293 LTWRAPPER_DEBUGPRINTF (("(make_executable) : %s\n",
4294 path ? (*path ? path : "EMPTY!") : "NULL!"));
4295 if ((!path) || (!*path))
4298 if (stat (path, &st) >= 0)
4300 rval = chmod (path, st.st_mode | S_IXOTH | S_IXGRP | S_IXUSR);
4305 /* Searches for the full path of the wrapper. Returns
4306 newly allocated full path name if found, NULL otherwise
4307 Does not chase symlinks, even on platforms that support them.
4310 find_executable (const char *wrapper)
4315 /* static buffer for getcwd */
4316 char tmp[LT_PATHMAX + 1];
4320 LTWRAPPER_DEBUGPRINTF (("(find_executable) : %s\n",
4321 wrapper ? (*wrapper ? wrapper : "EMPTY!") : "NULL!"));
4323 if ((wrapper == NULL) || (*wrapper == '\0'))
4326 /* Absolute path? */
4327 #if defined (HAVE_DOS_BASED_FILE_SYSTEM)
4328 if (isalpha ((unsigned char) wrapper[0]) && wrapper[1] == ':')
4330 concat_name = xstrdup (wrapper);
4331 if (check_executable (concat_name))
4333 XFREE (concat_name);
4338 if (IS_DIR_SEPARATOR (wrapper[0]))
4340 concat_name = xstrdup (wrapper);
4341 if (check_executable (concat_name))
4343 XFREE (concat_name);
4345 #if defined (HAVE_DOS_BASED_FILE_SYSTEM)
4349 for (p = wrapper; *p; p++)
4357 /* no slashes; search PATH */
4358 const char *path = getenv ("PATH");
4361 for (p = path; *p; p = p_next)
4365 for (q = p; *q; q++)
4366 if (IS_PATH_SEPARATOR (*q))
4369 p_next = (*q == '\0' ? q : q + 1);
4372 /* empty path: current directory */
4373 if (getcwd (tmp, LT_PATHMAX) == NULL)
4374 lt_fatal ("getcwd failed");
4375 tmp_len = strlen (tmp);
4377 XMALLOC (char, tmp_len + 1 + strlen (wrapper) + 1);
4378 memcpy (concat_name, tmp, tmp_len);
4379 concat_name[tmp_len] = '/';
4380 strcpy (concat_name + tmp_len + 1, wrapper);
4385 XMALLOC (char, p_len + 1 + strlen (wrapper) + 1);
4386 memcpy (concat_name, p, p_len);
4387 concat_name[p_len] = '/';
4388 strcpy (concat_name + p_len + 1, wrapper);
4390 if (check_executable (concat_name))
4392 XFREE (concat_name);
4395 /* not found in PATH; assume curdir */
4397 /* Relative path | not found in path: prepend cwd */
4398 if (getcwd (tmp, LT_PATHMAX) == NULL)
4399 lt_fatal ("getcwd failed");
4400 tmp_len = strlen (tmp);
4401 concat_name = XMALLOC (char, tmp_len + 1 + strlen (wrapper) + 1);
4402 memcpy (concat_name, tmp, tmp_len);
4403 concat_name[tmp_len] = '/';
4404 strcpy (concat_name + tmp_len + 1, wrapper);
4406 if (check_executable (concat_name))
4408 XFREE (concat_name);
4413 chase_symlinks (const char *pathspec)
4416 return xstrdup (pathspec);
4418 char buf[LT_PATHMAX];
4420 char *tmp_pathspec = xstrdup (pathspec);
4422 int has_symlinks = 0;
4423 while (strlen (tmp_pathspec) && !has_symlinks)
4425 LTWRAPPER_DEBUGPRINTF (("checking path component for symlinks: %s\n",
4427 if (lstat (tmp_pathspec, &s) == 0)
4429 if (S_ISLNK (s.st_mode) != 0)
4435 /* search backwards for last DIR_SEPARATOR */
4436 p = tmp_pathspec + strlen (tmp_pathspec) - 1;
4437 while ((p > tmp_pathspec) && (!IS_DIR_SEPARATOR (*p)))
4439 if ((p == tmp_pathspec) && (!IS_DIR_SEPARATOR (*p)))
4441 /* no more DIR_SEPARATORS left */
4448 char *errstr = strerror (errno);
4449 lt_fatal ("Error accessing file %s (%s)", tmp_pathspec, errstr);
4452 XFREE (tmp_pathspec);
4456 return xstrdup (pathspec);
4459 tmp_pathspec = realpath (pathspec, buf);
4460 if (tmp_pathspec == 0)
4462 lt_fatal ("Could not follow symlinks for %s", pathspec);
4464 return xstrdup (tmp_pathspec);
4469 strendzap (char *str, const char *pat)
4473 assert (str != NULL);
4474 assert (pat != NULL);
4477 patlen = strlen (pat);
4481 str += len - patlen;
4482 if (strcmp (str, pat) == 0)
4489 lt_error_core (int exit_status, const char *mode,
4490 const char *message, va_list ap)
4492 fprintf (stderr, "%s: %s: ", program_name, mode);
4493 vfprintf (stderr, message, ap);
4494 fprintf (stderr, ".\n");
4496 if (exit_status >= 0)
4501 lt_fatal (const char *message, ...)
4504 va_start (ap, message);
4505 lt_error_core (EXIT_FAILURE, "FATAL", message, ap);
4510 lt_setenv (const char *name, const char *value)
4512 LTWRAPPER_DEBUGPRINTF (("(lt_setenv) setting '%s' to '%s'\n",
4513 (name ? name : "<NULL>"),
4514 (value ? value : "<NULL>")));
4517 /* always make a copy, for consistency with !HAVE_SETENV */
4518 char *str = xstrdup (value);
4519 setenv (name, str, 1);
4521 int len = strlen (name) + 1 + strlen (value) + 1;
4522 char *str = XMALLOC (char, len);
4523 sprintf (str, "%s=%s", name, value);
4524 if (putenv (str) != EXIT_SUCCESS)
4533 lt_extend_str (const char *orig_value, const char *add, int to_end)
4536 if (orig_value && *orig_value)
4538 int orig_value_len = strlen (orig_value);
4539 int add_len = strlen (add);
4540 new_value = XMALLOC (char, add_len + orig_value_len + 1);
4543 strcpy (new_value, orig_value);
4544 strcpy (new_value + orig_value_len, add);
4548 strcpy (new_value, add);
4549 strcpy (new_value + add_len, orig_value);
4554 new_value = xstrdup (add);
4560 lt_update_exe_path (const char *name, const char *value)
4562 LTWRAPPER_DEBUGPRINTF (("(lt_update_exe_path) modifying '%s' by prepending '%s'\n",
4563 (name ? name : "<NULL>"),
4564 (value ? value : "<NULL>")));
4566 if (name && *name && value && *value)
4568 char *new_value = lt_extend_str (getenv (name), value, 0);
4569 /* some systems can't cope with a ':'-terminated path #' */
4570 int len = strlen (new_value);
4571 while (((len = strlen (new_value)) > 0) && IS_PATH_SEPARATOR (new_value[len-1]))
4573 new_value[len-1] = '\0';
4575 lt_setenv (name, new_value);
4581 lt_update_lib_path (const char *name, const char *value)
4583 LTWRAPPER_DEBUGPRINTF (("(lt_update_lib_path) modifying '%s' by prepending '%s'\n",
4584 (name ? name : "<NULL>"),
4585 (value ? value : "<NULL>")));
4587 if (name && *name && value && *value)
4589 char *new_value = lt_extend_str (getenv (name), value, 0);
4590 lt_setenv (name, new_value);
4600 /* Prepares an argument vector before calling spawn().
4601 Note that spawn() does not by itself call the command interpreter
4602 (getenv ("COMSPEC") != NULL ? getenv ("COMSPEC") :
4603 ({ OSVERSIONINFO v; v.dwOSVersionInfoSize = sizeof(OSVERSIONINFO);
4605 v.dwPlatformId == VER_PLATFORM_WIN32_NT;
4606 }) ? "cmd.exe" : "command.com").
4607 Instead it simply concatenates the arguments, separated by ' ', and calls
4608 CreateProcess(). We must quote the arguments since Win32 CreateProcess()
4609 interprets characters like ' ', '\t', '\\', '"' (but not '<' and '>') in a
4611 - Space and tab are interpreted as delimiters. They are not treated as
4612 delimiters if they are surrounded by double quotes: "...".
4613 - Unescaped double quotes are removed from the input. Their only effect is
4614 that within double quotes, space and tab are treated like normal
4616 - Backslashes not followed by double quotes are not special.
4617 - But 2*n+1 backslashes followed by a double quote become
4618 n backslashes followed by a double quote (n >= 0):
4623 #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"
4624 #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"
4626 prepare_spawn (char **argv)
4632 /* Count number of arguments. */
4633 for (argc = 0; argv[argc] != NULL; argc++)
4636 /* Allocate new argument vector. */
4637 new_argv = XMALLOC (char *, argc + 1);
4639 /* Put quoted arguments into the new argument vector. */
4640 for (i = 0; i < argc; i++)
4642 const char *string = argv[i];
4644 if (string[0] == '\0')
4645 new_argv[i] = xstrdup ("\"\"");
4646 else if (strpbrk (string, SHELL_SPECIAL_CHARS) != NULL)
4648 int quote_around = (strpbrk (string, SHELL_SPACE_CHARS) != NULL);
4650 unsigned int backslashes;
4652 char *quoted_string;
4659 for (s = string; *s != '\0'; s++)
4663 length += backslashes + 1;
4671 length += backslashes + 1;
4673 quoted_string = XMALLOC (char, length + 1);
4679 for (s = string; *s != '\0'; s++)
4685 for (j = backslashes + 1; j > 0; j--)
4697 for (j = backslashes; j > 0; j--)
4703 new_argv[i] = quoted_string;
4706 new_argv[i] = (char *) string;
4708 new_argv[argc] = NULL;
4717 void lt_dump_script (FILE* f)
4720 func_emit_wrapper yes |
4721 $SED -e 's/\([\\"]\)/\\\1/g' \
4722 -e 's/^/ fputs ("/' -e 's/$/\\n", f);/'
4728 # end: func_emit_cwrapperexe_src
4730 # func_win32_import_lib_p ARG
4731 # True if ARG is an import lib, as indicated by $file_magic_cmd
4732 func_win32_import_lib_p ()
4735 case `eval $file_magic_cmd \"\$1\" 2>/dev/null | $SED -e 10q` in
4741 # func_mode_link arg...
4746 *-*-cygwin* | *-*-mingw* | *-*-pw32* | *-*-os2* | *-cegcc*)
4747 # It is impossible to link a dll without this setting, and
4748 # we shouldn't force the makefile maintainer to figure out
4749 # which system we are compiling for in order to pass an extra
4750 # flag for every libtool invocation.
4751 # allow_undefined=no
4753 # FIXME: Unfortunately, there are problems with the above when trying
4754 # to make a dll which has undefined symbols, in which case not
4755 # even a static library is built. For now, we need to specify
4756 # -no-undefined on the libtool link line when we can be certain
4757 # that all symbols are satisfied, otherwise we get a static library.
4764 libtool_args=$nonopt
4765 base_compile="$nonopt $@"
4766 compile_command=$nonopt
4767 finalize_command=$nonopt
4780 lib_search_path=`pwd`
4782 new_inherited_linker_flags=
4791 export_symbols_regex=
4799 precious_files_regex=
4800 prefer_static_libs=no
4813 single_module="${wl}-single_module"
4814 func_infer_tag $base_compile
4816 # We need to know -static, to get the right output filenames.
4821 test "$build_libtool_libs" != yes && \
4822 func_fatal_configuration "can not build a shared library"
4826 -all-static | -static | -static-libtool-libs)
4829 if test "$build_libtool_libs" = yes && test -z "$link_static_flag"; then
4830 func_warning "complete static linking is impossible in this configuration"
4832 if test -n "$link_static_flag"; then
4833 dlopen_self=$dlopen_self_static
4835 prefer_static_libs=yes
4838 if test -z "$pic_flag" && test -n "$link_static_flag"; then
4839 dlopen_self=$dlopen_self_static
4841 prefer_static_libs=built
4843 -static-libtool-libs)
4844 if test -z "$pic_flag" && test -n "$link_static_flag"; then
4845 dlopen_self=$dlopen_self_static
4847 prefer_static_libs=yes
4850 build_libtool_libs=no
4857 # See if our shared archives depend on static archives.
4858 test -n "$old_archive_from_new_cmds" && build_old_libs=yes
4860 # Go through the arguments, transforming them on the way.
4861 while test "$#" -gt 0; do
4864 func_quote_for_eval "$arg"
4865 qarg=$func_quote_for_eval_unquoted_result
4866 func_append libtool_args " $func_quote_for_eval_result"
4868 # If the previous option needs an argument, assign it.
4869 if test -n "$prev"; then
4872 func_append compile_command " @OUTPUT@"
4873 func_append finalize_command " @OUTPUT@"
4884 if test "$preload" = no; then
4885 # Add the symbol object into the linking commands.
4886 func_append compile_command " @SYMFILE@"
4887 func_append finalize_command " @SYMFILE@"
4891 *.la | *.lo) ;; # We handle these cases below.
4893 if test "$dlself" = no; then
4901 if test "$prev" = dlprefiles; then
4903 elif test "$prev" = dlfiles && test "$dlopen_self" != yes; then
4913 if test "$prev" = dlfiles; then
4914 dlfiles="$dlfiles $arg"
4916 dlprefiles="$dlprefiles $arg"
4924 export_symbols="$arg"
4926 || func_fatal_error "symbol file \`$arg' does not exist"
4931 export_symbols_regex="$arg"
4939 *" $qarg.ltframework "*) ;;
4940 *) deplibs="$deplibs $qarg.ltframework" # this is fixed later
4949 inst_prefix_dir="$arg"
4954 if test -f "$arg"; then
4957 for fil in `cat "$save_arg"`
4959 # moreargs="$moreargs $fil"
4961 # A libtool-controlled object.
4963 # Check to see that this really is a libtool object.
4964 if func_lalib_unsafe_p "$arg"; then
4971 if test -z "$pic_object" ||
4972 test -z "$non_pic_object" ||
4973 test "$pic_object" = none &&
4974 test "$non_pic_object" = none; then
4975 func_fatal_error "cannot find name of object for \`$arg'"
4978 # Extract subdirectory from the argument.
4979 func_dirname "$arg" "/" ""
4980 xdir="$func_dirname_result"
4982 if test "$pic_object" != none; then
4983 # Prepend the subdirectory the object is found in.
4984 pic_object="$xdir$pic_object"
4986 if test "$prev" = dlfiles; then
4987 if test "$build_libtool_libs" = yes && test "$dlopen_support" = yes; then
4988 dlfiles="$dlfiles $pic_object"
4992 # If libtool objects are unsupported, then we need to preload.
4997 # CHECK ME: I think I busted this. -Ossama
4998 if test "$prev" = dlprefiles; then
4999 # Preload the old-style object.
5000 dlprefiles="$dlprefiles $pic_object"
5005 func_append libobjs " $pic_object"
5010 if test "$non_pic_object" != none; then
5011 # Prepend the subdirectory the object is found in.
5012 non_pic_object="$xdir$non_pic_object"
5014 # A standard non-PIC object
5015 func_append non_pic_objects " $non_pic_object"
5016 if test -z "$pic_object" || test "$pic_object" = none ; then
5017 arg="$non_pic_object"
5020 # If the PIC object exists, use it instead.
5021 # $xdir was prepended to $pic_object above.
5022 non_pic_object="$pic_object"
5023 func_append non_pic_objects " $non_pic_object"
5026 # Only an error if not doing a dry-run.
5027 if $opt_dry_run; then
5028 # Extract subdirectory from the argument.
5029 func_dirname "$arg" "/" ""
5030 xdir="$func_dirname_result"
5033 pic_object=$xdir$objdir/$func_lo2o_result
5034 non_pic_object=$xdir$func_lo2o_result
5035 func_append libobjs " $pic_object"
5036 func_append non_pic_objects " $non_pic_object"
5038 func_fatal_error "\`$arg' is not a valid libtool object"
5043 func_fatal_error "link input file \`$arg' does not exist"
5050 precious_files_regex="$arg"
5060 # We need an absolute path.
5062 [\\/]* | [A-Za-z]:[\\/]*) ;;
5064 func_fatal_error "only absolute run-paths are allowed"
5067 if test "$prev" = rpath; then
5070 *) rpath="$rpath $arg" ;;
5075 *) xrpath="$xrpath $arg" ;;
5087 weak_libs="$weak_libs $arg"
5092 linker_flags="$linker_flags $qarg"
5093 compiler_flags="$compiler_flags $qarg"
5095 func_append compile_command " $qarg"
5096 func_append finalize_command " $qarg"
5100 compiler_flags="$compiler_flags $qarg"
5102 func_append compile_command " $qarg"
5103 func_append finalize_command " $qarg"
5107 linker_flags="$linker_flags $qarg"
5108 compiler_flags="$compiler_flags $wl$qarg"
5110 func_append compile_command " $wl$qarg"
5111 func_append finalize_command " $wl$qarg"
5115 eval "$prev=\"\$arg\""
5120 fi # test -n "$prev"
5126 if test -n "$link_static_flag"; then
5127 # See comment for -static flag below, for more details.
5128 func_append compile_command " $link_static_flag"
5129 func_append finalize_command " $link_static_flag"
5135 # FIXME: remove this flag sometime in the future.
5136 func_fatal_error "\`-allow-undefined' must not be used because it is the default"
5164 -export-symbols | -export-symbols-regex)
5165 if test -n "$export_symbols" || test -n "$export_symbols_regex"; then
5166 func_fatal_error "more than one -exported-symbols argument is not allowed"
5168 if test "X$arg" = "X-export-symbols"; then
5186 # The native IRIX linker understands -LANG:*, -LIST:* and -LNO:*
5187 # so, if we see these flags be careful not to treat them like -L
5189 case $with_gcc/$host in
5190 no/*-*-irix* | /*-*-irix*)
5191 func_append compile_command " $arg"
5192 func_append finalize_command " $arg"
5199 func_stripname '-L' '' "$arg"
5200 dir=$func_stripname_result
5201 if test -z "$dir"; then
5202 if test "$#" -gt 0; then
5203 func_fatal_error "require no space between \`-L' and \`$1'"
5205 func_fatal_error "need path for \`-L' option"
5208 # We need an absolute path.
5210 [\\/]* | [A-Za-z]:[\\/]*) ;;
5212 absdir=`cd "$dir" && pwd`
5213 test -z "$absdir" && \
5214 func_fatal_error "cannot determine absolute directory name of \`$dir'"
5221 deplibs="$deplibs -L$dir"
5222 lib_search_path="$lib_search_path $dir"
5226 *-*-cygwin* | *-*-mingw* | *-*-pw32* | *-*-os2* | *-cegcc*)
5227 testbindir=`$ECHO "$dir" | $SED 's*/lib$*/bin*'`
5228 case :$dllsearchpath: in
5230 ::) dllsearchpath=$dir;;
5231 *) dllsearchpath="$dllsearchpath:$dir";;
5233 case :$dllsearchpath: in
5234 *":$testbindir:"*) ;;
5235 ::) dllsearchpath=$testbindir;;
5236 *) dllsearchpath="$dllsearchpath:$testbindir";;
5244 if test "X$arg" = "X-lc" || test "X$arg" = "X-lm"; then
5246 *-*-cygwin* | *-*-mingw* | *-*-pw32* | *-*-beos* | *-cegcc* | *-*-haiku*)
5247 # These systems don't actually have a C or math library (as such)
5251 # These systems don't actually have a C library (as such)
5252 test "X$arg" = "X-lc" && continue
5254 *-*-openbsd* | *-*-freebsd* | *-*-dragonfly*)
5255 # Do not include libc due to us having libc/libc_r.
5256 test "X$arg" = "X-lc" && continue
5258 *-*-rhapsody* | *-*-darwin1.[012])
5259 # Rhapsody C and math libraries are in the System framework
5260 deplibs="$deplibs System.ltframework"
5263 *-*-sco3.2v5* | *-*-sco5v6*)
5264 # Causes problems with __ctype
5265 test "X$arg" = "X-lc" && continue
5267 *-*-sysv4.2uw2* | *-*-sysv5* | *-*-unixware* | *-*-OpenUNIX*)
5268 # Compiler inserts libc in the correct place for threads to work
5269 test "X$arg" = "X-lc" && continue
5272 elif test "X$arg" = "X-lc_r"; then
5274 *-*-openbsd* | *-*-freebsd* | *-*-dragonfly*)
5275 # Do not include libc_r directly, use -pthread flag.
5280 deplibs="$deplibs $arg"
5289 # Tru64 UNIX uses -model [arg] to determine the layout of C++
5290 # classes, name mangling, and exception handling.
5291 # Darwin uses the -arch flag to determine output architecture.
5292 -model|-arch|-isysroot)
5293 compiler_flags="$compiler_flags $arg"
5294 func_append compile_command " $arg"
5295 func_append finalize_command " $arg"
5300 -mt|-mthreads|-kthread|-Kthread|-pthread|-pthreads|--thread-safe|-threads)
5301 compiler_flags="$compiler_flags $arg"
5302 func_append compile_command " $arg"
5303 func_append finalize_command " $arg"
5304 case "$new_inherited_linker_flags " in
5306 * ) new_inherited_linker_flags="$new_inherited_linker_flags $arg" ;;
5312 single_module="${wl}-multi_module"
5323 *-*-cygwin* | *-*-mingw* | *-*-pw32* | *-*-os2* | *-*-darwin* | *-cegcc*)
5324 # The PATH hackery in wrapper scripts is required on Windows
5325 # and Darwin in order for the loader to find any dlls it needs.
5326 func_warning "\`-no-install' is ignored for $host"
5327 func_warning "assuming \`-no-fast-install' instead"
5330 *) no_install=yes ;;
5347 -precious-files-regex)
5368 func_stripname '-R' '' "$arg"
5369 dir=$func_stripname_result
5370 # We need an absolute path.
5372 [\\/]* | [A-Za-z]:[\\/]*) ;;
5374 func_fatal_error "only absolute run-paths are allowed"
5379 *) xrpath="$xrpath $dir" ;;
5385 # The effects of -shared are defined in a previous loop.
5394 -static | -static-libtool-libs)
5395 # The effects of -static are defined in a previous loop.
5396 # We used to do the same as -all-static on platforms that
5397 # didn't have a PIC flag, but the assumption that the effects
5398 # would be equivalent was wrong. It would break on at least
5399 # Digital Unix and AIX.
5425 func_stripname '-Wc,' '' "$arg"
5426 args=$func_stripname_result
5428 save_ifs="$IFS"; IFS=','
5429 for flag in $args; do
5431 func_quote_for_eval "$flag"
5432 arg="$arg $func_quote_for_eval_result"
5433 compiler_flags="$compiler_flags $func_quote_for_eval_result"
5436 func_stripname ' ' '' "$arg"
5437 arg=$func_stripname_result
5441 func_stripname '-Wl,' '' "$arg"
5442 args=$func_stripname_result
5444 save_ifs="$IFS"; IFS=','
5445 for flag in $args; do
5447 func_quote_for_eval "$flag"
5448 arg="$arg $wl$func_quote_for_eval_result"
5449 compiler_flags="$compiler_flags $wl$func_quote_for_eval_result"
5450 linker_flags="$linker_flags $func_quote_for_eval_result"
5453 func_stripname ' ' '' "$arg"
5454 arg=$func_stripname_result
5474 func_quote_for_eval "$arg"
5475 arg="$func_quote_for_eval_result"
5478 # -64, -mips[0-9] enable 64-bit mode on the SGI compiler
5479 # -r[0-9][0-9]* specifies the processor on the SGI compiler
5480 # -xarch=*, -xtarget=* enable 64-bit mode on the Sun compiler
5481 # +DA*, +DD* enable 64-bit mode on the HP compiler
5482 # -q* pass through compiler args for the IBM compiler
5483 # -m*, -t[45]*, -txscale* pass through architecture-specific
5484 # compiler args for GCC
5485 # -F/path gives path to uninstalled frameworks, gcc on darwin
5486 # -p, -pg, --coverage, -fprofile-* pass through profiling flag for GCC
5487 # @file GCC response files
5488 # -tp=* Portland pgcc target processor selection
5489 -64|-mips[0-9]|-r[0-9][0-9]*|-xarch=*|-xtarget=*|+DA*|+DD*|-q*|-m*| \
5490 -t[45]*|-txscale*|-p|-pg|--coverage|-fprofile-*|-F*|@*|-tp=*)
5491 func_quote_for_eval "$arg"
5492 arg="$func_quote_for_eval_result"
5493 func_append compile_command " $arg"
5494 func_append finalize_command " $arg"
5495 compiler_flags="$compiler_flags $arg"
5499 # Some other compiler flag.
5501 func_quote_for_eval "$arg"
5502 arg="$func_quote_for_eval_result"
5506 # A standard object.
5511 # A libtool-controlled object.
5513 # Check to see that this really is a libtool object.
5514 if func_lalib_unsafe_p "$arg"; then
5521 if test -z "$pic_object" ||
5522 test -z "$non_pic_object" ||
5523 test "$pic_object" = none &&
5524 test "$non_pic_object" = none; then
5525 func_fatal_error "cannot find name of object for \`$arg'"
5528 # Extract subdirectory from the argument.
5529 func_dirname "$arg" "/" ""
5530 xdir="$func_dirname_result"
5532 if test "$pic_object" != none; then
5533 # Prepend the subdirectory the object is found in.
5534 pic_object="$xdir$pic_object"
5536 if test "$prev" = dlfiles; then
5537 if test "$build_libtool_libs" = yes && test "$dlopen_support" = yes; then
5538 dlfiles="$dlfiles $pic_object"
5542 # If libtool objects are unsupported, then we need to preload.
5547 # CHECK ME: I think I busted this. -Ossama
5548 if test "$prev" = dlprefiles; then
5549 # Preload the old-style object.
5550 dlprefiles="$dlprefiles $pic_object"
5555 func_append libobjs " $pic_object"
5560 if test "$non_pic_object" != none; then
5561 # Prepend the subdirectory the object is found in.
5562 non_pic_object="$xdir$non_pic_object"
5564 # A standard non-PIC object
5565 func_append non_pic_objects " $non_pic_object"
5566 if test -z "$pic_object" || test "$pic_object" = none ; then
5567 arg="$non_pic_object"
5570 # If the PIC object exists, use it instead.
5571 # $xdir was prepended to $pic_object above.
5572 non_pic_object="$pic_object"
5573 func_append non_pic_objects " $non_pic_object"
5576 # Only an error if not doing a dry-run.
5577 if $opt_dry_run; then
5578 # Extract subdirectory from the argument.
5579 func_dirname "$arg" "/" ""
5580 xdir="$func_dirname_result"
5583 pic_object=$xdir$objdir/$func_lo2o_result
5584 non_pic_object=$xdir$func_lo2o_result
5585 func_append libobjs " $pic_object"
5586 func_append non_pic_objects " $non_pic_object"
5588 func_fatal_error "\`$arg' is not a valid libtool object"
5595 deplibs="$deplibs $arg"
5596 old_deplibs="$old_deplibs $arg"
5601 # A libtool-controlled library.
5603 if test "$prev" = dlfiles; then
5604 # This library was specified with -dlopen.
5605 dlfiles="$dlfiles $arg"
5607 elif test "$prev" = dlprefiles; then
5608 # The library was specified with -dlpreopen.
5609 dlprefiles="$dlprefiles $arg"
5612 deplibs="$deplibs $arg"
5617 # Some other compiler argument.
5619 # Unknown arguments in both finalize_command and compile_command need
5620 # to be aesthetically quoted because they are evaled later.
5621 func_quote_for_eval "$arg"
5622 arg="$func_quote_for_eval_result"
5626 # Now actually substitute the argument into the commands.
5627 if test -n "$arg"; then
5628 func_append compile_command " $arg"
5629 func_append finalize_command " $arg"
5631 done # argument parsing loop
5633 test -n "$prev" && \
5634 func_fatal_help "the \`$prevarg' option requires an argument"
5636 if test "$export_dynamic" = yes && test -n "$export_dynamic_flag_spec"; then
5637 eval arg=\"$export_dynamic_flag_spec\"
5638 func_append compile_command " $arg"
5639 func_append finalize_command " $arg"
5643 # calculate the name of the file, without its directory
5644 func_basename "$output"
5645 outputname="$func_basename_result"
5646 libobjs_save="$libobjs"
5648 if test -n "$shlibpath_var"; then
5649 # get the directories listed in $shlibpath_var
5650 eval shlib_search_path=\`\$ECHO \"\${$shlibpath_var}\" \| \$SED \'s/:/ /g\'\`
5654 eval sys_lib_search_path=\"$sys_lib_search_path_spec\"
5655 eval sys_lib_dlsearch_path=\"$sys_lib_dlsearch_path_spec\"
5657 func_dirname "$output" "/" ""
5658 output_objdir="$func_dirname_result$objdir"
5659 # Create the object directory.
5660 func_mkdir_p "$output_objdir"
5662 # Determine the type of output
5665 func_fatal_help "you must specify an output file"
5667 *.$libext) linkmode=oldlib ;;
5668 *.lo | *.$objext) linkmode=obj ;;
5669 *.la) linkmode=lib ;;
5670 *) linkmode=prog ;; # Anything else should be a program.
5676 # Find all interdependent deplibs by searching for libraries
5677 # that are linked more than once (e.g. -la -lb -la)
5678 for deplib in $deplibs; do
5679 if $opt_duplicate_deps ; then
5681 *" $deplib "*) specialdeplibs="$specialdeplibs $deplib" ;;
5684 libs="$libs $deplib"
5687 if test "$linkmode" = lib; then
5688 libs="$predeps $libs $compiler_lib_search_path $postdeps"
5690 # Compute libraries that are listed more than once in $predeps
5691 # $postdeps and mark them as special (i.e., whose duplicates are
5692 # not to be eliminated).
5694 if $opt_duplicate_compiler_generated_deps; then
5695 for pre_post_dep in $predeps $postdeps; do
5696 case "$pre_post_deps " in
5697 *" $pre_post_dep "*) specialdeplibs="$specialdeplibs $pre_post_deps" ;;
5699 pre_post_deps="$pre_post_deps $pre_post_dep"
5708 need_relink=no # whether we're linking any uninstalled libtool libraries
5709 notinst_deplibs= # not-installed libtool libraries
5710 notinst_path= # paths that contain not-installed libtool libraries
5714 passes="conv dlpreopen link"
5715 for file in $dlfiles $dlprefiles; do
5719 func_fatal_help "libraries can \`-dlopen' only libtool libraries: $file"
5730 passes="conv scan dlopen dlpreopen link"
5736 for pass in $passes; do
5737 # The preopen pass in lib mode reverses $deplibs; put it back here
5738 # so that -L comes before libs that need it for instance...
5739 if test "$linkmode,$pass" = "lib,link"; then
5740 ## FIXME: Find the place where the list is rebuilt in the wrong
5741 ## order, and fix it there properly
5743 for deplib in $deplibs; do
5744 tmp_deplibs="$deplib $tmp_deplibs"
5746 deplibs="$tmp_deplibs"
5749 if test "$linkmode,$pass" = "lib,link" ||
5750 test "$linkmode,$pass" = "prog,scan"; then
5754 if test "$linkmode" = prog; then
5756 dlopen) libs="$dlfiles" ;;
5757 dlpreopen) libs="$dlprefiles" ;;
5758 link) libs="$deplibs %DEPLIBS% $dependency_libs" ;;
5761 if test "$linkmode,$pass" = "lib,dlpreopen"; then
5762 # Collect and forward deplibs of preopened libtool libs
5763 for lib in $dlprefiles; do
5764 # Ignore non-libtool-libs
5767 *.la) func_source "$lib" ;;
5770 # Collect preopened libtool deplibs, except any this library
5771 # has declared as weak libs
5772 for deplib in $dependency_libs; do
5773 func_basename "$deplib"
5774 deplib_base=$func_basename_result
5775 case " $weak_libs " in
5776 *" $deplib_base "*) ;;
5777 *) deplibs="$deplibs $deplib" ;;
5783 if test "$pass" = dlopen; then
5784 # Collect dlpreopened libraries
5785 save_deplibs="$deplibs"
5789 for deplib in $libs; do
5793 -mt|-mthreads|-kthread|-Kthread|-pthread|-pthreads|--thread-safe|-threads)
5794 if test "$linkmode,$pass" = "prog,link"; then
5795 compile_deplibs="$deplib $compile_deplibs"
5796 finalize_deplibs="$deplib $finalize_deplibs"
5798 compiler_flags="$compiler_flags $deplib"
5799 if test "$linkmode" = lib ; then
5800 case "$new_inherited_linker_flags " in
5802 * ) new_inherited_linker_flags="$new_inherited_linker_flags $deplib" ;;
5809 if test "$linkmode" != lib && test "$linkmode" != prog; then
5810 func_warning "\`-l' is ignored for archives/objects"
5813 func_stripname '-l' '' "$deplib"
5814 name=$func_stripname_result
5815 if test "$linkmode" = lib; then
5816 searchdirs="$newlib_search_path $lib_search_path $compiler_lib_search_dirs $sys_lib_search_path $shlib_search_path"
5818 searchdirs="$newlib_search_path $lib_search_path $sys_lib_search_path $shlib_search_path"
5820 for searchdir in $searchdirs; do
5821 for search_ext in .la $std_shrext .so .a; do
5822 # Search the libtool library
5823 lib="$searchdir/lib${name}${search_ext}"
5824 if test -f "$lib"; then
5825 if test "$search_ext" = ".la"; then
5834 if test "$found" != yes; then
5835 # deplib doesn't seem to be a libtool library
5836 if test "$linkmode,$pass" = "prog,link"; then
5837 compile_deplibs="$deplib $compile_deplibs"
5838 finalize_deplibs="$deplib $finalize_deplibs"
5840 deplibs="$deplib $deplibs"
5841 test "$linkmode" = lib && newdependency_libs="$deplib $newdependency_libs"
5844 else # deplib is a libtool library
5845 # If $allow_libtool_libs_with_static_runtimes && $deplib is a stdlib,
5846 # We need to do some special things here, and not later.
5847 if test "X$allow_libtool_libs_with_static_runtimes" = "Xyes" ; then
5848 case " $predeps $postdeps " in
5850 if func_lalib_p "$lib"; then
5854 for l in $old_library $library_names; do
5857 if test "X$ll" = "X$old_library" ; then # only static version available
5859 func_dirname "$lib" "" "."
5860 ladir="$func_dirname_result"
5861 lib=$ladir/$old_library
5862 if test "$linkmode,$pass" = "prog,link"; then
5863 compile_deplibs="$deplib $compile_deplibs"
5864 finalize_deplibs="$deplib $finalize_deplibs"
5866 deplibs="$deplib $deplibs"
5867 test "$linkmode" = lib && newdependency_libs="$deplib $newdependency_libs"
5879 if test "$linkmode,$pass" = "prog,link"; then
5880 compile_deplibs="$deplib $compile_deplibs"
5881 finalize_deplibs="$deplib $finalize_deplibs"
5883 deplibs="$deplib $deplibs"
5884 if test "$linkmode" = lib ; then
5885 case "$new_inherited_linker_flags " in
5887 * ) new_inherited_linker_flags="$new_inherited_linker_flags $deplib" ;;
5896 deplibs="$deplib $deplibs"
5897 test "$pass" = conv && continue
5898 newdependency_libs="$deplib $newdependency_libs"
5899 func_stripname '-L' '' "$deplib"
5900 newlib_search_path="$newlib_search_path $func_stripname_result"
5903 if test "$pass" = conv; then
5904 deplibs="$deplib $deplibs"
5907 if test "$pass" = scan; then
5908 deplibs="$deplib $deplibs"
5910 compile_deplibs="$deplib $compile_deplibs"
5911 finalize_deplibs="$deplib $finalize_deplibs"
5913 func_stripname '-L' '' "$deplib"
5914 newlib_search_path="$newlib_search_path $func_stripname_result"
5917 func_warning "\`-L' is ignored for archives/objects"
5923 if test "$pass" = link; then
5924 func_stripname '-R' '' "$deplib"
5925 dir=$func_stripname_result
5926 # Make sure the xrpath contains only unique directories.
5929 *) xrpath="$xrpath $dir" ;;
5932 deplibs="$deplib $deplibs"
5935 *.la) lib="$deplib" ;;
5937 if test "$pass" = conv; then
5938 deplibs="$deplib $deplibs"
5943 # Linking convenience modules into shared libraries is allowed,
5944 # but linking other static libraries is non-portable.
5945 case " $dlpreconveniencelibs " in
5949 case $deplibs_check_method in
5951 set dummy $deplibs_check_method; shift
5952 match_pattern_regex=`expr "$deplibs_check_method" : "$1 \(.*\)"`
5953 if eval "\$ECHO \"$deplib\"" 2>/dev/null | $SED 10q \
5954 | $EGREP "$match_pattern_regex" > /dev/null; then
5962 if test "$valid_a_lib" != yes; then
5964 $ECHO "*** Warning: Trying to link with static lib archive $deplib."
5965 echo "*** I have the capability to make that library automatically link in when"
5966 echo "*** you link to this library. But I can only do this if you have a"
5967 echo "*** shared version of the library, which you do not appear to have"
5968 echo "*** because the file extensions .$libext of this argument makes me believe"
5969 echo "*** that it is just a static archive that I should not use here."
5972 $ECHO "*** Warning: Linking the shared library $output against the"
5973 $ECHO "*** static library $deplib is not portable!"
5974 deplibs="$deplib $deplibs"
5981 if test "$pass" != link; then
5982 deplibs="$deplib $deplibs"
5984 compile_deplibs="$deplib $compile_deplibs"
5985 finalize_deplibs="$deplib $finalize_deplibs"
5992 if test "$pass" = conv; then
5993 deplibs="$deplib $deplibs"
5994 elif test "$linkmode" = prog; then
5995 if test "$pass" = dlpreopen || test "$dlopen_support" != yes || test "$build_libtool_libs" = no; then
5996 # If there is no dlopen support or we're linking statically,
5997 # we need to preload.
5998 newdlprefiles="$newdlprefiles $deplib"
5999 compile_deplibs="$deplib $compile_deplibs"
6000 finalize_deplibs="$deplib $finalize_deplibs"
6002 newdlfiles="$newdlfiles $deplib"
6013 if test "$found" = yes || test -f "$lib"; then :
6015 func_fatal_error "cannot find the library \`$lib' or unhandled argument \`$deplib'"
6018 # Check to see that this really is a libtool archive.
6019 func_lalib_unsafe_p "$lib" \
6020 || func_fatal_error "\`$lib' is not a valid libtool archive"
6022 func_dirname "$lib" "" "."
6023 ladir="$func_dirname_result"
6031 inherited_linker_flags=
6032 # If the library was installed with an old release of libtool,
6033 # it will not redefine variables installed, or shouldnotlink
6042 # Convert "-framework foo" to "foo.ltframework"
6043 if test -n "$inherited_linker_flags"; then
6044 tmp_inherited_linker_flags=`$ECHO "$inherited_linker_flags" | $SED 's/-framework \([^ $]*\)/\1.ltframework/g'`
6045 for tmp_inherited_linker_flag in $tmp_inherited_linker_flags; do
6046 case " $new_inherited_linker_flags " in
6047 *" $tmp_inherited_linker_flag "*) ;;
6048 *) new_inherited_linker_flags="$new_inherited_linker_flags $tmp_inherited_linker_flag";;
6052 dependency_libs=`$ECHO " $dependency_libs" | $SED 's% \([^ $]*\).ltframework% -framework \1%g'`
6053 if test "$linkmode,$pass" = "lib,link" ||
6054 test "$linkmode,$pass" = "prog,scan" ||
6055 { test "$linkmode" != prog && test "$linkmode" != lib; }; then
6056 test -n "$dlopen" && dlfiles="$dlfiles $dlopen"
6057 test -n "$dlpreopen" && dlprefiles="$dlprefiles $dlpreopen"
6060 if test "$pass" = conv; then
6061 # Only check for convenience libraries
6062 deplibs="$lib $deplibs"
6063 if test -z "$libdir"; then
6064 if test -z "$old_library"; then
6065 func_fatal_error "cannot find name of link library for \`$lib'"
6067 # It is a libtool convenience library, so add in its objects.
6068 convenience="$convenience $ladir/$objdir/$old_library"
6069 old_convenience="$old_convenience $ladir/$objdir/$old_library"
6070 elif test "$linkmode" != prog && test "$linkmode" != lib; then
6071 func_fatal_error "\`$lib' is not a convenience library"
6074 for deplib in $dependency_libs; do
6075 deplibs="$deplib $deplibs"
6076 if $opt_duplicate_deps ; then
6077 case "$tmp_libs " in
6078 *" $deplib "*) specialdeplibs="$specialdeplibs $deplib" ;;
6081 tmp_libs="$tmp_libs $deplib"
6087 # Get the name of the library we link against.
6089 for l in $old_library $library_names; do
6092 if test -z "$linklib"; then
6093 func_fatal_error "cannot find name of link library for \`$lib'"
6096 # This library was specified with -dlopen.
6097 if test "$pass" = dlopen; then
6098 if test -z "$libdir"; then
6099 func_fatal_error "cannot -dlopen a convenience library: \`$lib'"
6101 if test -z "$dlname" ||
6102 test "$dlopen_support" != yes ||
6103 test "$build_libtool_libs" = no; then
6104 # If there is no dlname, no dlopen support or we're linking
6105 # statically, we need to preload. We also need to preload any
6106 # dependent libraries so libltdl's deplib preloader doesn't
6107 # bomb out in the load deplibs phase.
6108 dlprefiles="$dlprefiles $lib $dependency_libs"
6110 newdlfiles="$newdlfiles $lib"
6115 # We need an absolute path.
6117 [\\/]* | [A-Za-z]:[\\/]*) abs_ladir="$ladir" ;;
6119 abs_ladir=`cd "$ladir" && pwd`
6120 if test -z "$abs_ladir"; then
6121 func_warning "cannot determine absolute directory name of \`$ladir'"
6122 func_warning "passing it literally to the linker, although it might fail"
6127 func_basename "$lib"
6128 laname="$func_basename_result"
6130 # Find the relevant object directory and library name.
6131 if test "X$installed" = Xyes; then
6132 if test ! -f "$libdir/$linklib" && test -f "$abs_ladir/$linklib"; then
6133 func_warning "library \`$lib' was moved."
6141 test "X$hardcode_automatic" = Xyes && avoidtemprpath=yes
6143 if test ! -f "$ladir/$objdir/$linklib" && test -f "$abs_ladir/$linklib"; then
6146 # Remove this search path later
6147 notinst_path="$notinst_path $abs_ladir"
6149 dir="$ladir/$objdir"
6150 absdir="$abs_ladir/$objdir"
6151 # Remove this search path later
6152 notinst_path="$notinst_path $abs_ladir"
6154 fi # $installed = yes
6155 func_stripname 'lib' '.la' "$laname"
6156 name=$func_stripname_result
6158 # This library was specified with -dlpreopen.
6159 if test "$pass" = dlpreopen; then
6160 if test -z "$libdir" && test "$linkmode" = prog; then
6161 func_fatal_error "only libraries may -dlpreopen a convenience library: \`$lib'"
6163 # Prefer using a static library (so that no silly _DYNAMIC symbols
6164 # are required to link).
6165 if test -n "$old_library"; then
6166 newdlprefiles="$newdlprefiles $dir/$old_library"
6167 # Keep a list of preopened convenience libraries to check
6168 # that they are being used correctly in the link pass.
6169 test -z "$libdir" && \
6170 dlpreconveniencelibs="$dlpreconveniencelibs $dir/$old_library"
6171 # Otherwise, use the dlname, so that lt_dlopen finds it.
6172 elif test -n "$dlname"; then
6173 newdlprefiles="$newdlprefiles $dir/$dlname"
6175 newdlprefiles="$newdlprefiles $dir/$linklib"
6177 fi # $pass = dlpreopen
6179 if test -z "$libdir"; then
6180 # Link the convenience library
6181 if test "$linkmode" = lib; then
6182 deplibs="$dir/$old_library $deplibs"
6183 elif test "$linkmode,$pass" = "prog,link"; then
6184 compile_deplibs="$dir/$old_library $compile_deplibs"
6185 finalize_deplibs="$dir/$old_library $finalize_deplibs"
6187 deplibs="$lib $deplibs" # used for prog,scan pass
6193 if test "$linkmode" = prog && test "$pass" != link; then
6194 newlib_search_path="$newlib_search_path $ladir"
6195 deplibs="$lib $deplibs"
6198 if test "$link_all_deplibs" != no || test -z "$library_names" ||
6199 test "$build_libtool_libs" = no; then
6204 for deplib in $dependency_libs; do
6206 -L*) func_stripname '-L' '' "$deplib"
6207 newlib_search_path="$newlib_search_path $func_stripname_result"
6210 # Need to link against all dependency_libs?
6211 if test "$linkalldeplibs" = yes; then
6212 deplibs="$deplib $deplibs"
6214 # Need to hardcode shared library paths
6215 # or/and link against static libraries
6216 newdependency_libs="$deplib $newdependency_libs"
6218 if $opt_duplicate_deps ; then
6219 case "$tmp_libs " in
6220 *" $deplib "*) specialdeplibs="$specialdeplibs $deplib" ;;
6223 tmp_libs="$tmp_libs $deplib"
6226 fi # $linkmode = prog...
6228 if test "$linkmode,$pass" = "prog,link"; then
6229 if test -n "$library_names" &&
6230 { { test "$prefer_static_libs" = no ||
6231 test "$prefer_static_libs,$installed" = "built,yes"; } ||
6232 test -z "$old_library"; }; then
6233 # We need to hardcode the library path
6234 if test -n "$shlibpath_var" && test -z "$avoidtemprpath" ; then
6235 # Make sure the rpath contains only unique directories.
6236 case "$temp_rpath:" in
6238 *) temp_rpath="$temp_rpath$absdir:" ;;
6242 # Hardcode the library path.
6243 # Skip directories that are in the system default run-time
6245 case " $sys_lib_dlsearch_path " in
6248 case "$compile_rpath " in
6250 *) compile_rpath="$compile_rpath $absdir"
6254 case " $sys_lib_dlsearch_path " in
6257 case "$finalize_rpath " in
6259 *) finalize_rpath="$finalize_rpath $libdir"
6263 fi # $linkmode,$pass = prog,link...
6265 if test "$alldeplibs" = yes &&
6266 { test "$deplibs_check_method" = pass_all ||
6267 { test "$build_libtool_libs" = yes &&
6268 test -n "$library_names"; }; }; then
6269 # We only need to search for static libraries
6274 link_static=no # Whether the deplib will be linked statically
6275 use_static_libs=$prefer_static_libs
6276 if test "$use_static_libs" = built && test "$installed" = yes; then
6279 if test -n "$library_names" &&
6280 { test "$use_static_libs" = no || test -z "$old_library"; }; then
6282 *cygwin* | *mingw* | *cegcc*)
6283 # No point in relinking DLLs because paths are not encoded
6284 notinst_deplibs="$notinst_deplibs $lib"
6288 if test "$installed" = no; then
6289 notinst_deplibs="$notinst_deplibs $lib"
6294 # This is a shared library
6296 # Warn about portability, can't link against -module's on some
6297 # systems (darwin). Don't bleat about dlopened modules though!
6299 for dlpremoduletest in $dlprefiles; do
6300 if test "X$dlpremoduletest" = "X$lib"; then
6301 dlopenmodule="$dlpremoduletest"
6305 if test -z "$dlopenmodule" && test "$shouldnotlink" = yes && test "$pass" = link; then
6307 if test "$linkmode" = prog; then
6308 $ECHO "*** Warning: Linking the executable $output against the loadable module"
6310 $ECHO "*** Warning: Linking the shared library $output against the loadable module"
6312 $ECHO "*** $linklib is not portable!"
6314 if test "$linkmode" = lib &&
6315 test "$hardcode_into_libs" = yes; then
6316 # Hardcode the library path.
6317 # Skip directories that are in the system default run-time
6319 case " $sys_lib_dlsearch_path " in
6322 case "$compile_rpath " in
6324 *) compile_rpath="$compile_rpath $absdir"
6328 case " $sys_lib_dlsearch_path " in
6331 case "$finalize_rpath " in
6333 *) finalize_rpath="$finalize_rpath $libdir"
6339 if test -n "$old_archive_from_expsyms_cmds"; then
6340 # figure out the soname
6341 set dummy $library_names
6345 libname=`eval "\\$ECHO \"$libname_spec\""`
6346 # use dlname if we got it. it's perfectly good, no?
6347 if test -n "$dlname"; then
6349 elif test -n "$soname_spec"; then
6352 *cygwin* | mingw* | *cegcc*)
6353 func_arith $current - $age
6354 major=$func_arith_result
6358 eval soname=\"$soname_spec\"
6363 # Make a new name for the extract_expsyms_cmds to use
6365 func_basename "$soroot"
6366 soname="$func_basename_result"
6367 func_stripname 'lib' '.dll' "$soname"
6368 newlib=libimp-$func_stripname_result.a
6370 # If the library has no export list, then create one now
6371 if test -f "$output_objdir/$soname-def"; then :
6373 func_verbose "extracting exported symbol list from \`$soname'"
6374 func_execute_cmds "$extract_expsyms_cmds" 'exit $?'
6378 if test -f "$output_objdir/$newlib"; then :; else
6379 func_verbose "generating import library for \`$soname'"
6380 func_execute_cmds "$old_archive_from_expsyms_cmds" 'exit $?'
6382 # make sure the library variables are pointing to the new library
6385 fi # test -n "$old_archive_from_expsyms_cmds"
6387 if test "$linkmode" = prog || test "$mode" != relink; then
6392 case $hardcode_action in
6393 immediate | unsupported)
6394 if test "$hardcode_direct" = no; then
6397 *-*-sco3.2v5.0.[024]*) add_dir="-L$dir" ;;
6398 *-*-sysv4*uw2*) add_dir="-L$dir" ;;
6399 *-*-sysv5OpenUNIX* | *-*-sysv5UnixWare7.[01].[10]* | \
6400 *-*-unixware7*) add_dir="-L$dir" ;;
6402 # if the lib is a (non-dlopened) module then we can not
6403 # link against it, someone is ignoring the earlier warnings
6404 if /usr/bin/file -L $add 2> /dev/null |
6405 $GREP ": [^:]* bundle" >/dev/null ; then
6406 if test "X$dlopenmodule" != "X$lib"; then
6407 $ECHO "*** Warning: lib $linklib is a module, not a shared library"
6408 if test -z "$old_library" ; then
6410 echo "*** And there doesn't seem to be a static archive available"
6411 echo "*** The link will probably fail, sorry"
6413 add="$dir/$old_library"
6415 elif test -n "$old_library"; then
6416 add="$dir/$old_library"
6420 elif test "$hardcode_minus_L" = no; then
6422 *-*-sunos*) add_shlibpath="$dir" ;;
6426 elif test "$hardcode_shlibpath_var" = no; then
6427 add_shlibpath="$dir"
6434 if test "$hardcode_direct" = yes &&
6435 test "$hardcode_direct_absolute" = no; then
6437 elif test "$hardcode_minus_L" = yes; then
6439 # Try looking first in the location we're being installed to.
6440 if test -n "$inst_prefix_dir"; then
6443 add_dir="$add_dir -L$inst_prefix_dir$libdir"
6448 elif test "$hardcode_shlibpath_var" = yes; then
6449 add_shlibpath="$dir"
6458 if test "$lib_linked" != yes; then
6459 func_fatal_configuration "unsupported hardcode properties"
6462 if test -n "$add_shlibpath"; then
6463 case :$compile_shlibpath: in
6464 *":$add_shlibpath:"*) ;;
6465 *) compile_shlibpath="$compile_shlibpath$add_shlibpath:" ;;
6468 if test "$linkmode" = prog; then
6469 test -n "$add_dir" && compile_deplibs="$add_dir $compile_deplibs"
6470 test -n "$add" && compile_deplibs="$add $compile_deplibs"
6472 test -n "$add_dir" && deplibs="$add_dir $deplibs"
6473 test -n "$add" && deplibs="$add $deplibs"
6474 if test "$hardcode_direct" != yes &&
6475 test "$hardcode_minus_L" != yes &&
6476 test "$hardcode_shlibpath_var" = yes; then
6477 case :$finalize_shlibpath: in
6479 *) finalize_shlibpath="$finalize_shlibpath$libdir:" ;;
6485 if test "$linkmode" = prog || test "$mode" = relink; then
6489 # Finalize command for both is simple: just hardcode it.
6490 if test "$hardcode_direct" = yes &&
6491 test "$hardcode_direct_absolute" = no; then
6492 add="$libdir/$linklib"
6493 elif test "$hardcode_minus_L" = yes; then
6496 elif test "$hardcode_shlibpath_var" = yes; then
6497 case :$finalize_shlibpath: in
6499 *) finalize_shlibpath="$finalize_shlibpath$libdir:" ;;
6502 elif test "$hardcode_automatic" = yes; then
6503 if test -n "$inst_prefix_dir" &&
6504 test -f "$inst_prefix_dir$libdir/$linklib" ; then
6505 add="$inst_prefix_dir$libdir/$linklib"
6507 add="$libdir/$linklib"
6510 # We cannot seem to hardcode it, guess we'll fake it.
6512 # Try looking first in the location we're being installed to.
6513 if test -n "$inst_prefix_dir"; then
6516 add_dir="$add_dir -L$inst_prefix_dir$libdir"
6523 if test "$linkmode" = prog; then
6524 test -n "$add_dir" && finalize_deplibs="$add_dir $finalize_deplibs"
6525 test -n "$add" && finalize_deplibs="$add $finalize_deplibs"
6527 test -n "$add_dir" && deplibs="$add_dir $deplibs"
6528 test -n "$add" && deplibs="$add $deplibs"
6531 elif test "$linkmode" = prog; then
6532 # Here we assume that one of hardcode_direct or hardcode_minus_L
6533 # is not unsupported. This is valid on all known static and
6535 if test "$hardcode_direct" != unsupported; then
6536 test -n "$old_library" && linklib="$old_library"
6537 compile_deplibs="$dir/$linklib $compile_deplibs"
6538 finalize_deplibs="$dir/$linklib $finalize_deplibs"
6540 compile_deplibs="-l$name -L$dir $compile_deplibs"
6541 finalize_deplibs="-l$name -L$dir $finalize_deplibs"
6543 elif test "$build_libtool_libs" = yes; then
6544 # Not a shared library
6545 if test "$deplibs_check_method" != pass_all; then
6546 # We're trying link a shared library against a static one
6547 # but the system doesn't support it.
6549 # Just print a warning and add the library to dependency_libs so
6550 # that the program can be linked against the static library.
6552 $ECHO "*** Warning: This system can not link to static lib archive $lib."
6553 echo "*** I have the capability to make that library automatically link in when"
6554 echo "*** you link to this library. But I can only do this if you have a"
6555 echo "*** shared version of the library, which you do not appear to have."
6556 if test "$module" = yes; then
6557 echo "*** But as you try to build a module library, libtool will still create "
6558 echo "*** a static module, that should work as long as the dlopening application"
6559 echo "*** is linked with the -dlopen flag to resolve symbols at runtime."
6560 if test -z "$global_symbol_pipe"; then
6562 echo "*** However, this would only work if libtool was able to extract symbol"
6563 echo "*** lists from a program, using \`nm' or equivalent, but libtool could"
6564 echo "*** not find such a program. So, this module is probably useless."
6565 echo "*** \`nm' from GNU binutils and a full rebuild may help."
6567 if test "$build_old_libs" = no; then
6568 build_libtool_libs=module
6571 build_libtool_libs=no
6575 deplibs="$dir/$old_library $deplibs"
6578 fi # link shared/static library?
6580 if test "$linkmode" = lib; then
6581 if test -n "$dependency_libs" &&
6582 { test "$hardcode_into_libs" != yes ||
6583 test "$build_old_libs" = yes ||
6584 test "$link_static" = yes; }; then
6585 # Extract -R from dependency_libs
6587 for libdir in $dependency_libs; do
6589 -R*) func_stripname '-R' '' "$libdir"
6590 temp_xrpath=$func_stripname_result
6592 *" $temp_xrpath "*) ;;
6593 *) xrpath="$xrpath $temp_xrpath";;
6595 *) temp_deplibs="$temp_deplibs $libdir";;
6598 dependency_libs="$temp_deplibs"
6601 newlib_search_path="$newlib_search_path $absdir"
6602 # Link against this library
6603 test "$link_static" = no && newdependency_libs="$abs_ladir/$laname $newdependency_libs"
6604 # ... and its dependency_libs
6606 for deplib in $dependency_libs; do
6607 newdependency_libs="$deplib $newdependency_libs"
6608 if $opt_duplicate_deps ; then
6609 case "$tmp_libs " in
6610 *" $deplib "*) specialdeplibs="$specialdeplibs $deplib" ;;
6613 tmp_libs="$tmp_libs $deplib"
6616 if test "$link_all_deplibs" != no; then
6617 # Add the search paths of all dependency libraries
6618 for deplib in $dependency_libs; do
6621 -L*) path="$deplib" ;;
6623 func_dirname "$deplib" "" "."
6624 dir="$func_dirname_result"
6625 # We need an absolute path.
6627 [\\/]* | [A-Za-z]:[\\/]*) absdir="$dir" ;;
6629 absdir=`cd "$dir" && pwd`
6630 if test -z "$absdir"; then
6631 func_warning "cannot determine absolute directory name of \`$dir'"
6636 if $GREP "^installed=no" $deplib > /dev/null; then
6640 eval deplibrary_names=`${SED} -n -e 's/^library_names=\(.*\)$/\1/p' $deplib`
6641 if test -n "$deplibrary_names" ; then
6642 for tmp in $deplibrary_names ; do
6645 if test -f "$absdir/$objdir/$depdepl" ; then
6646 depdepl="$absdir/$objdir/$depdepl"
6647 darwin_install_name=`${OTOOL} -L $depdepl | awk '{if (NR == 2) {print $1;exit}}'`
6648 if test -z "$darwin_install_name"; then
6649 darwin_install_name=`${OTOOL64} -L $depdepl | awk '{if (NR == 2) {print $1;exit}}'`
6651 compiler_flags="$compiler_flags ${wl}-dylib_file ${wl}${darwin_install_name}:${depdepl}"
6652 linker_flags="$linker_flags -dylib_file ${darwin_install_name}:${depdepl}"
6658 path="-L$absdir/$objdir"
6662 eval libdir=`${SED} -n -e 's/^libdir=\(.*\)$/\1/p' $deplib`
6663 test -z "$libdir" && \
6664 func_fatal_error "\`$deplib' is not a valid libtool archive"
6665 test "$absdir" != "$libdir" && \
6666 func_warning "\`$deplib' seems to be moved"
6672 case " $deplibs " in
6674 *) deplibs="$path $deplibs" ;;
6677 fi # link_all_deplibs != no
6679 done # for deplib in $libs
6680 if test "$pass" = link; then
6681 if test "$linkmode" = "prog"; then
6682 compile_deplibs="$new_inherited_linker_flags $compile_deplibs"
6683 finalize_deplibs="$new_inherited_linker_flags $finalize_deplibs"
6685 compiler_flags="$compiler_flags "`$ECHO " $new_inherited_linker_flags" | $SED 's% \([^ $]*\).ltframework% -framework \1%g'`
6688 dependency_libs="$newdependency_libs"
6689 if test "$pass" = dlpreopen; then
6690 # Link the dlpreopened libraries before other libraries
6691 for deplib in $save_deplibs; do
6692 deplibs="$deplib $deplibs"
6695 if test "$pass" != dlopen; then
6696 if test "$pass" != conv; then
6697 # Make sure lib_search_path contains only unique directories.
6699 for dir in $newlib_search_path; do
6700 case "$lib_search_path " in
6702 *) lib_search_path="$lib_search_path $dir" ;;
6708 if test "$linkmode,$pass" != "prog,link"; then
6711 vars="compile_deplibs finalize_deplibs"
6713 for var in $vars dependency_libs; do
6714 # Add libraries to $var in reverse order
6715 eval tmp_libs=\"\$$var\"
6717 for deplib in $tmp_libs; do
6718 # FIXME: Pedantically, this is the right thing to do, so
6719 # that some nasty dependency loop isn't accidentally
6721 #new_libs="$deplib $new_libs"
6722 # Pragmatically, this seems to cause very few problems in
6725 -L*) new_libs="$deplib $new_libs" ;;
6728 # And here is the reason: when a library appears more
6729 # than once as an explicit dependence of a library, or
6730 # is implicitly linked in more than once by the
6731 # compiler, it is considered special, and multiple
6732 # occurrences thereof are not removed. Compare this
6733 # with having the same library being listed as a
6734 # dependency of multiple other libraries: in this case,
6735 # we know (pedantically, we assume) the library does not
6736 # need to be listed more than once, so we keep only the
6737 # last copy. This is not always right, but it is rare
6738 # enough that we require users that really mean to play
6739 # such unportable linking tricks to link the library
6740 # using -Wl,-lname, so that libtool does not consider it
6741 # for duplicate removal.
6742 case " $specialdeplibs " in
6743 *" $deplib "*) new_libs="$deplib $new_libs" ;;
6745 case " $new_libs " in
6747 *) new_libs="$deplib $new_libs" ;;
6755 for deplib in $new_libs; do
6758 case " $tmp_libs " in
6760 *) tmp_libs="$tmp_libs $deplib" ;;
6763 *) tmp_libs="$tmp_libs $deplib" ;;
6766 eval $var=\"$tmp_libs\"
6769 # Last step: remove runtime libs from dependency_libs
6770 # (they stay in deplibs)
6772 for i in $dependency_libs ; do
6773 case " $predeps $postdeps $compiler_lib_search_path " in
6778 if test -n "$i" ; then
6779 tmp_libs="$tmp_libs $i"
6782 dependency_libs=$tmp_libs
6784 if test "$linkmode" = prog; then
6785 dlfiles="$newdlfiles"
6787 if test "$linkmode" = prog || test "$linkmode" = lib; then
6788 dlprefiles="$newdlprefiles"
6793 if test -n "$dlfiles$dlprefiles" || test "$dlself" != no; then
6794 func_warning "\`-dlopen' is ignored for archives"
6799 func_warning "\`-l' and \`-L' are ignored for archives" ;;
6802 test -n "$rpath" && \
6803 func_warning "\`-rpath' is ignored for archives"
6805 test -n "$xrpath" && \
6806 func_warning "\`-R' is ignored for archives"
6808 test -n "$vinfo" && \
6809 func_warning "\`-version-info/-version-number' is ignored for archives"
6811 test -n "$release" && \
6812 func_warning "\`-release' is ignored for archives"
6814 test -n "$export_symbols$export_symbols_regex" && \
6815 func_warning "\`-export-symbols' is ignored for archives"
6817 # Now set the variables for building old libraries.
6818 build_libtool_libs=no
6820 objs="$objs$old_deplibs"
6824 # Make sure we only generate libraries of the form `libNAME.la'.
6827 func_stripname 'lib' '.la' "$outputname"
6828 name=$func_stripname_result
6829 eval shared_ext=\"$shrext_cmds\"
6830 eval libname=\"$libname_spec\"
6833 test "$module" = no && \
6834 func_fatal_help "libtool library \`$output' must begin with \`lib'"
6836 if test "$need_lib_prefix" != no; then
6837 # Add the "lib" prefix for modules if required
6838 func_stripname '' '.la' "$outputname"
6839 name=$func_stripname_result
6840 eval shared_ext=\"$shrext_cmds\"
6841 eval libname=\"$libname_spec\"
6843 func_stripname '' '.la' "$outputname"
6844 libname=$func_stripname_result
6849 if test -n "$objs"; then
6850 if test "$deplibs_check_method" != pass_all; then
6851 func_fatal_error "cannot build libtool library \`$output' from non-libtool objects on this host:$objs"
6854 $ECHO "*** Warning: Linking the shared library $output against the non-libtool"
6855 $ECHO "*** objects $objs is not portable!"
6856 libobjs="$libobjs $objs"
6860 test "$dlself" != no && \
6861 func_warning "\`-dlopen self' is ignored for libtool libraries"
6865 test "$#" -gt 1 && \
6866 func_warning "ignoring multiple \`-rpath's for a libtool library"
6871 if test -z "$rpath"; then
6872 if test "$build_libtool_libs" = yes; then
6873 # Building a libtool convenience library.
6874 # Some compilers have problems with a `.al' extension so
6875 # convenience libraries should have the same extension an
6876 # archive normally would.
6877 oldlibs="$output_objdir/$libname.$libext $oldlibs"
6878 build_libtool_libs=convenience
6882 test -n "$vinfo" && \
6883 func_warning "\`-version-info/-version-number' is ignored for convenience libraries"
6885 test -n "$release" && \
6886 func_warning "\`-release' is ignored for convenience libraries"
6889 # Parse the version information argument.
6890 save_ifs="$IFS"; IFS=':'
6891 set dummy $vinfo 0 0 0
6896 func_fatal_help "too many parameters to \`-version-info'"
6898 # convert absolute version numbers to libtool ages
6899 # this retains compatibility with .la files and attempts
6900 # to make the code below a bit more comprehensible
6902 case $vinfo_number in
6906 number_revision="$3"
6908 # There are really only two kinds -- those that
6909 # use the current revision as the major version
6910 # and those that subtract age and use age as
6911 # a minor version. But, then there is irix
6912 # which has an extra 1 added just for fun
6914 case $version_type in
6915 darwin|linux|osf|windows|none)
6916 func_arith $number_major + $number_minor
6917 current=$func_arith_result
6919 revision="$number_revision"
6921 freebsd-aout|freebsd-elf|qnx|sunos)
6922 current="$number_major"
6923 revision="$number_minor"
6927 func_arith $number_major + $number_minor
6928 current=$func_arith_result
6930 revision="$number_minor"
6931 lt_irix_increment=no
6942 # Check that each of the things are valid numbers.
6944 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]) ;;
6946 func_error "CURRENT \`$current' must be a nonnegative integer"
6947 func_fatal_error "\`$vinfo' is not valid version information"
6952 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]) ;;
6954 func_error "REVISION \`$revision' must be a nonnegative integer"
6955 func_fatal_error "\`$vinfo' is not valid version information"
6960 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]) ;;
6962 func_error "AGE \`$age' must be a nonnegative integer"
6963 func_fatal_error "\`$vinfo' is not valid version information"
6967 if test "$age" -gt "$current"; then
6968 func_error "AGE \`$age' is greater than the current interface number \`$current'"
6969 func_fatal_error "\`$vinfo' is not valid version information"
6972 # Calculate the version variables.
6976 case $version_type in
6980 # Like Linux, but with the current version available in
6981 # verstring for coding it into the library header
6982 func_arith $current - $age
6983 major=.$func_arith_result
6984 versuffix="$major.$age.$revision"
6985 # Darwin ld doesn't like 0 for these options...
6986 func_arith $current + 1
6987 minor_current=$func_arith_result
6988 xlcverstring="${wl}-compatibility_version ${wl}$minor_current ${wl}-current_version ${wl}$minor_current.$revision"
6989 verstring="-compatibility_version $minor_current -current_version $minor_current.$revision"
6994 versuffix=".$current.$revision";
6999 versuffix=".$current"
7003 if test "X$lt_irix_increment" = "Xno"; then
7004 func_arith $current - $age
7006 func_arith $current - $age + 1
7008 major=$func_arith_result
7010 case $version_type in
7011 nonstopux) verstring_prefix=nonstopux ;;
7012 *) verstring_prefix=sgi ;;
7014 verstring="$verstring_prefix$major.$revision"
7016 # Add in all the interfaces that we are compatible with.
7018 while test "$loop" -ne 0; do
7019 func_arith $revision - $loop
7020 iface=$func_arith_result
7021 func_arith $loop - 1
7022 loop=$func_arith_result
7023 verstring="$verstring_prefix$major.$iface:$verstring"
7026 # Before this point, $major must not contain `.'.
7028 versuffix="$major.$revision"
7032 func_arith $current - $age
7033 major=.$func_arith_result
7034 versuffix="$major.$age.$revision"
7038 func_arith $current - $age
7039 major=.$func_arith_result
7040 versuffix=".$current.$age.$revision"
7041 verstring="$current.$age.$revision"
7043 # Add in all the interfaces that we are compatible with.
7045 while test "$loop" -ne 0; do
7046 func_arith $current - $loop
7047 iface=$func_arith_result
7048 func_arith $loop - 1
7049 loop=$func_arith_result
7050 verstring="$verstring:${iface}.0"
7053 # Make executables depend on our current version.
7054 verstring="$verstring:${current}.0"
7059 versuffix=".$current"
7064 versuffix=".$current.$revision"
7068 # Use '-' rather than '.', since we only want one
7069 # extension on DOS 8.3 filesystems.
7070 func_arith $current - $age
7071 major=$func_arith_result
7076 func_fatal_configuration "unknown library version type \`$version_type'"
7080 # Clear the version info if we defaulted, and they specified a release.
7081 if test -z "$vinfo" && test -n "$release"; then
7083 case $version_type in
7085 # we can't check for "0.0" in archive_cmds due to quoting
7086 # problems, so we reset it completely
7093 if test "$need_version" = no; then
7100 # Remove version info from name if versioning should be avoided
7101 if test "$avoid_version" = yes && test "$need_version" = no; then
7107 # Check to see if the archive will have undefined symbols.
7108 if test "$allow_undefined" = yes; then
7109 if test "$allow_undefined_flag" = unsupported; then
7110 func_warning "undefined symbols not allowed in $host shared libraries"
7111 build_libtool_libs=no
7115 # Don't allow undefined symbols.
7116 allow_undefined_flag="$no_undefined_flag"
7121 func_generate_dlsyms "$libname" "$libname" "yes"
7122 libobjs="$libobjs $symfileobj"
7123 test "X$libobjs" = "X " && libobjs=
7125 if test "$mode" != relink; then
7126 # Remove our outputs, but don't remove object files since they
7127 # may have been created when compiling PIC objects.
7129 tempremovelist=`$ECHO "$output_objdir/*"`
7130 for p in $tempremovelist; do
7134 $output_objdir/$outputname | $output_objdir/$libname.* | $output_objdir/${libname}${release}.*)
7135 if test "X$precious_files_regex" != "X"; then
7136 if $ECHO "$p" | $EGREP -e "$precious_files_regex" >/dev/null 2>&1
7141 removelist="$removelist $p"
7146 test -n "$removelist" && \
7147 func_show_eval "${RM}r \$removelist"
7150 # Now set the variables for building old libraries.
7151 if test "$build_old_libs" = yes && test "$build_libtool_libs" != convenience ; then
7152 oldlibs="$oldlibs $output_objdir/$libname.$libext"
7154 # Transform .lo files to .o files.
7155 oldobjs="$objs "`$ECHO "$libobjs" | $SP2NL | $SED "/\.${libext}$/d; $lo2o" | $NL2SP`
7158 # Eliminate all temporary directories.
7159 #for path in $notinst_path; do
7160 # lib_search_path=`$ECHO "$lib_search_path " | $SED "s% $path % %g"`
7161 # deplibs=`$ECHO "$deplibs " | $SED "s% -L$path % %g"`
7162 # dependency_libs=`$ECHO "$dependency_libs " | $SED "s% -L$path % %g"`
7165 if test -n "$xrpath"; then
7166 # If the user specified any rpath flags, then add them.
7168 for libdir in $xrpath; do
7169 temp_xrpath="$temp_xrpath -R$libdir"
7170 case "$finalize_rpath " in
7172 *) finalize_rpath="$finalize_rpath $libdir" ;;
7175 if test "$hardcode_into_libs" != yes || test "$build_old_libs" = yes; then
7176 dependency_libs="$temp_xrpath $dependency_libs"
7180 # Make sure dlfiles contains only unique files that won't be dlpreopened
7181 old_dlfiles="$dlfiles"
7183 for lib in $old_dlfiles; do
7184 case " $dlprefiles $dlfiles " in
7186 *) dlfiles="$dlfiles $lib" ;;
7190 # Make sure dlprefiles contains only unique files
7191 old_dlprefiles="$dlprefiles"
7193 for lib in $old_dlprefiles; do
7194 case "$dlprefiles " in
7196 *) dlprefiles="$dlprefiles $lib" ;;
7200 if test "$build_libtool_libs" = yes; then
7201 if test -n "$rpath"; then
7203 *-*-cygwin* | *-*-mingw* | *-*-pw32* | *-*-os2* | *-*-beos* | *-cegcc* | *-*-haiku*)
7204 # these systems don't actually have a c library (as such)!
7206 *-*-rhapsody* | *-*-darwin1.[012])
7207 # Rhapsody C library is in the System framework
7208 deplibs="$deplibs System.ltframework"
7211 # Don't link with libc until the a.out ld.so is fixed.
7213 *-*-openbsd* | *-*-freebsd* | *-*-dragonfly*)
7214 # Do not include libc due to us having libc/libc_r.
7216 *-*-sco3.2v5* | *-*-sco5v6*)
7217 # Causes problems with __ctype
7219 *-*-sysv4.2uw2* | *-*-sysv5* | *-*-unixware* | *-*-OpenUNIX*)
7220 # Compiler inserts libc in the correct place for threads to work
7223 # Add libc to deplibs on all other systems if necessary.
7224 if test "$build_libtool_need_lc" = "yes"; then
7225 deplibs="$deplibs -lc"
7231 # Transform deplibs into only deplibs that can be linked in shared.
7233 libname_save=$libname
7234 release_save=$release
7235 versuffix_save=$versuffix
7237 # I'm not sure if I'm treating the release correctly. I think
7238 # release should show up in the -l (ie -lgmp5) so we don't want to
7239 # add it in twice. Is that correct?
7245 case $deplibs_check_method in
7247 # Don't check for shared/static. Everything works.
7248 # This might be a little naive. We might want to check
7249 # whether the library exists or not. But this is on
7250 # osf3 & osf4 and I'm not really sure... Just
7251 # implementing what was already the behavior.
7255 # This code stresses the "libraries are programs" paradigm to its
7256 # limits. Maybe even breaks it. We compile a program, linking it
7257 # against the deplibs as a proxy for the library. Then we can check
7258 # whether they linked in statically or dynamically with ldd.
7259 $opt_dry_run || $RM conftest.c
7260 cat > conftest.c <<EOF
7261 int main() { return 0; }
7263 $opt_dry_run || $RM conftest
7264 if $LTCC $LTCFLAGS -o conftest conftest.c $deplibs; then
7265 ldd_output=`ldd conftest`
7266 for i in $deplibs; do
7269 func_stripname -l '' "$i"
7270 name=$func_stripname_result
7271 if test "X$allow_libtool_libs_with_static_runtimes" = "Xyes" ; then
7272 case " $predeps $postdeps " in
7274 newdeplibs="$newdeplibs $i"
7279 if test -n "$i" ; then
7280 libname=`eval "\\$ECHO \"$libname_spec\""`
7281 deplib_matches=`eval "\\$ECHO \"$library_names_spec\""`
7282 set dummy $deplib_matches; shift
7284 if test `expr "$ldd_output" : ".*$deplib_match"` -ne 0 ; then
7285 newdeplibs="$newdeplibs $i"
7289 $ECHO "*** Warning: dynamic linker does not accept needed library $i."
7290 echo "*** I have the capability to make that library automatically link in when"
7291 echo "*** you link to this library. But I can only do this if you have a"
7292 echo "*** shared version of the library, which I believe you do not have"
7293 echo "*** because a test_compile did reveal that the linker did not use it for"
7294 echo "*** its dynamic dependency list that programs get resolved with at runtime."
7299 newdeplibs="$newdeplibs $i"
7304 # Error occurred in the first compile. Let's try to salvage
7305 # the situation: Compile a separate program for each library.
7306 for i in $deplibs; do
7309 func_stripname -l '' "$i"
7310 name=$func_stripname_result
7311 $opt_dry_run || $RM conftest
7312 if $LTCC $LTCFLAGS -o conftest conftest.c $i; then
7313 ldd_output=`ldd conftest`
7314 if test "X$allow_libtool_libs_with_static_runtimes" = "Xyes" ; then
7315 case " $predeps $postdeps " in
7317 newdeplibs="$newdeplibs $i"
7322 if test -n "$i" ; then
7323 libname=`eval "\\$ECHO \"$libname_spec\""`
7324 deplib_matches=`eval "\\$ECHO \"$library_names_spec\""`
7325 set dummy $deplib_matches; shift
7327 if test `expr "$ldd_output" : ".*$deplib_match"` -ne 0 ; then
7328 newdeplibs="$newdeplibs $i"
7332 $ECHO "*** Warning: dynamic linker does not accept needed library $i."
7333 echo "*** I have the capability to make that library automatically link in when"
7334 echo "*** you link to this library. But I can only do this if you have a"
7335 echo "*** shared version of the library, which you do not appear to have"
7336 echo "*** because a test_compile did reveal that the linker did not use this one"
7337 echo "*** as a dynamic dependency that programs can get resolved with at runtime."
7343 $ECHO "*** Warning! Library $i is needed by this library but I was not able to"
7344 echo "*** make it link in! You will probably need to install it or some"
7345 echo "*** library that it depends on before this library will be fully"
7346 echo "*** functional. Installing it before continuing would be even better."
7350 newdeplibs="$newdeplibs $i"
7357 set dummy $deplibs_check_method; shift
7358 file_magic_regex=`expr "$deplibs_check_method" : "$1 \(.*\)"`
7359 for a_deplib in $deplibs; do
7362 func_stripname -l '' "$a_deplib"
7363 name=$func_stripname_result
7364 if test "X$allow_libtool_libs_with_static_runtimes" = "Xyes" ; then
7365 case " $predeps $postdeps " in
7367 newdeplibs="$newdeplibs $a_deplib"
7372 if test -n "$a_deplib" ; then
7373 libname=`eval "\\$ECHO \"$libname_spec\""`
7374 for i in $lib_search_path $sys_lib_search_path $shlib_search_path; do
7375 potential_libs=`ls $i/$libname[.-]* 2>/dev/null`
7376 for potent_lib in $potential_libs; do
7377 # Follow soft links.
7378 if ls -lLd "$potent_lib" 2>/dev/null |
7379 $GREP " -> " >/dev/null; then
7382 # The statement above tries to avoid entering an
7383 # endless loop below, in case of cyclic links.
7384 # We might still enter an endless loop, since a link
7385 # loop can be closed while we follow links,
7387 potlib="$potent_lib"
7388 while test -h "$potlib" 2>/dev/null; do
7389 potliblink=`ls -ld $potlib | ${SED} 's/.* -> //'`
7391 [\\/]* | [A-Za-z]:[\\/]*) potlib="$potliblink";;
7392 *) potlib=`$ECHO "$potlib" | $SED 's,[^/]*$,,'`"$potliblink";;
7395 if eval $file_magic_cmd \"\$potlib\" 2>/dev/null |
7397 $EGREP "$file_magic_regex" > /dev/null; then
7398 newdeplibs="$newdeplibs $a_deplib"
7405 if test -n "$a_deplib" ; then
7408 $ECHO "*** Warning: linker path does not have real file for library $a_deplib."
7409 echo "*** I have the capability to make that library automatically link in when"
7410 echo "*** you link to this library. But I can only do this if you have a"
7411 echo "*** shared version of the library, which you do not appear to have"
7412 echo "*** because I did check the linker path looking for a file starting"
7413 if test -z "$potlib" ; then
7414 $ECHO "*** with $libname but no candidates were found. (...for file magic test)"
7416 $ECHO "*** with $libname and none of the candidates passed a file format test"
7417 $ECHO "*** using a file magic. Last file checked: $potlib"
7422 # Add a -L argument.
7423 newdeplibs="$newdeplibs $a_deplib"
7426 done # Gone through all deplibs.
7429 set dummy $deplibs_check_method; shift
7430 match_pattern_regex=`expr "$deplibs_check_method" : "$1 \(.*\)"`
7431 for a_deplib in $deplibs; do
7434 func_stripname -l '' "$a_deplib"
7435 name=$func_stripname_result
7436 if test "X$allow_libtool_libs_with_static_runtimes" = "Xyes" ; then
7437 case " $predeps $postdeps " in
7439 newdeplibs="$newdeplibs $a_deplib"
7444 if test -n "$a_deplib" ; then
7445 libname=`eval "\\$ECHO \"$libname_spec\""`
7446 for i in $lib_search_path $sys_lib_search_path $shlib_search_path; do
7447 potential_libs=`ls $i/$libname[.-]* 2>/dev/null`
7448 for potent_lib in $potential_libs; do
7449 potlib="$potent_lib" # see symlink-check above in file_magic test
7450 if eval "\$ECHO \"$potent_lib\"" 2>/dev/null | $SED 10q | \
7451 $EGREP "$match_pattern_regex" > /dev/null; then
7452 newdeplibs="$newdeplibs $a_deplib"
7459 if test -n "$a_deplib" ; then
7462 $ECHO "*** Warning: linker path does not have real file for library $a_deplib."
7463 echo "*** I have the capability to make that library automatically link in when"
7464 echo "*** you link to this library. But I can only do this if you have a"
7465 echo "*** shared version of the library, which you do not appear to have"
7466 echo "*** because I did check the linker path looking for a file starting"
7467 if test -z "$potlib" ; then
7468 $ECHO "*** with $libname but no candidates were found. (...for regex pattern test)"
7470 $ECHO "*** with $libname and none of the candidates passed a file format test"
7471 $ECHO "*** using a regex pattern. Last file checked: $potlib"
7476 # Add a -L argument.
7477 newdeplibs="$newdeplibs $a_deplib"
7480 done # Gone through all deplibs.
7484 tmp_deplibs=`$ECHO " $deplibs" | $SED 's/ -lc$//; s/ -[LR][^ ]*//g'`
7485 if test "X$allow_libtool_libs_with_static_runtimes" = "Xyes" ; then
7486 for i in $predeps $postdeps ; do
7487 # can't use Xsed below, because $i might contain '/'
7488 tmp_deplibs=`$ECHO " $tmp_deplibs" | $SED "s,$i,,"`
7491 case $tmp_deplibs in
7494 if test "X$deplibs_check_method" = "Xnone"; then
7495 echo "*** Warning: inter-library dependencies are not supported in this platform."
7497 echo "*** Warning: inter-library dependencies are not known to be supported."
7499 echo "*** All declared inter-library dependencies are being dropped."
7505 versuffix=$versuffix_save
7507 release=$release_save
7508 libname=$libname_save
7512 *-*-rhapsody* | *-*-darwin1.[012])
7513 # On Rhapsody replace the C library with the System framework
7514 newdeplibs=`$ECHO " $newdeplibs" | $SED 's/ -lc / System.ltframework /'`
7518 if test "$droppeddeps" = yes; then
7519 if test "$module" = yes; then
7521 echo "*** Warning: libtool could not satisfy all declared inter-library"
7522 $ECHO "*** dependencies of module $libname. Therefore, libtool will create"
7523 echo "*** a static module, that should work as long as the dlopening"
7524 echo "*** application is linked with the -dlopen flag."
7525 if test -z "$global_symbol_pipe"; then
7527 echo "*** However, this would only work if libtool was able to extract symbol"
7528 echo "*** lists from a program, using \`nm' or equivalent, but libtool could"
7529 echo "*** not find such a program. So, this module is probably useless."
7530 echo "*** \`nm' from GNU binutils and a full rebuild may help."
7532 if test "$build_old_libs" = no; then
7533 oldlibs="$output_objdir/$libname.$libext"
7534 build_libtool_libs=module
7537 build_libtool_libs=no
7540 echo "*** The inter-library dependencies that have been dropped here will be"
7541 echo "*** automatically added whenever a program is linked with this library"
7542 echo "*** or is declared to -dlopen it."
7544 if test "$allow_undefined" = no; then
7546 echo "*** Since this library must not contain undefined symbols,"
7547 echo "*** because either the platform does not support them or"
7548 echo "*** it was explicitly requested with -no-undefined,"
7549 echo "*** libtool will only create a static version of it."
7550 if test "$build_old_libs" = no; then
7551 oldlibs="$output_objdir/$libname.$libext"
7552 build_libtool_libs=module
7555 build_libtool_libs=no
7560 # Done checking deplibs!
7563 # Time to change all our "foo.ltframework" stuff back to "-framework foo"
7566 newdeplibs=`$ECHO " $newdeplibs" | $SED 's% \([^ $]*\).ltframework% -framework \1%g'`
7567 new_inherited_linker_flags=`$ECHO " $new_inherited_linker_flags" | $SED 's% \([^ $]*\).ltframework% -framework \1%g'`
7568 deplibs=`$ECHO " $deplibs" | $SED 's% \([^ $]*\).ltframework% -framework \1%g'`
7572 # move library search paths that coincide with paths to not yet
7573 # installed libraries to the beginning of the library search list
7575 for path in $notinst_path; do
7576 case " $new_libs " in
7577 *" -L$path/$objdir "*) ;;
7579 case " $deplibs " in
7580 *" -L$path/$objdir "*)
7581 new_libs="$new_libs -L$path/$objdir" ;;
7586 for deplib in $deplibs; do
7589 case " $new_libs " in
7591 *) new_libs="$new_libs $deplib" ;;
7594 *) new_libs="$new_libs $deplib" ;;
7599 # All the library-specific variables (install_libdir is set above).
7604 # Test again, we may have decided not to build it any more
7605 if test "$build_libtool_libs" = yes; then
7606 if test "$hardcode_into_libs" = yes; then
7607 # Hardcode the library paths
7610 rpath="$finalize_rpath"
7611 test "$mode" != relink && rpath="$compile_rpath$rpath"
7612 for libdir in $rpath; do
7613 if test -n "$hardcode_libdir_flag_spec"; then
7614 if test -n "$hardcode_libdir_separator"; then
7615 if test -z "$hardcode_libdirs"; then
7616 hardcode_libdirs="$libdir"
7618 # Just accumulate the unique libdirs.
7619 case $hardcode_libdir_separator$hardcode_libdirs$hardcode_libdir_separator in
7620 *"$hardcode_libdir_separator$libdir$hardcode_libdir_separator"*)
7623 hardcode_libdirs="$hardcode_libdirs$hardcode_libdir_separator$libdir"
7628 eval flag=\"$hardcode_libdir_flag_spec\"
7629 dep_rpath="$dep_rpath $flag"
7631 elif test -n "$runpath_var"; then
7632 case "$perm_rpath " in
7634 *) perm_rpath="$perm_rpath $libdir" ;;
7638 # Substitute the hardcoded libdirs into the rpath.
7639 if test -n "$hardcode_libdir_separator" &&
7640 test -n "$hardcode_libdirs"; then
7641 libdir="$hardcode_libdirs"
7642 if test -n "$hardcode_libdir_flag_spec_ld"; then
7643 eval dep_rpath=\"$hardcode_libdir_flag_spec_ld\"
7645 eval dep_rpath=\"$hardcode_libdir_flag_spec\"
7648 if test -n "$runpath_var" && test -n "$perm_rpath"; then
7649 # We should set the runpath_var.
7651 for dir in $perm_rpath; do
7654 eval "$runpath_var='$rpath\$$runpath_var'; export $runpath_var"
7656 test -n "$dep_rpath" && deplibs="$dep_rpath $deplibs"
7659 shlibpath="$finalize_shlibpath"
7660 test "$mode" != relink && shlibpath="$compile_shlibpath$shlibpath"
7661 if test -n "$shlibpath"; then
7662 eval "$shlibpath_var='$shlibpath\$$shlibpath_var'; export $shlibpath_var"
7665 # Get the real and link names of the library.
7666 eval shared_ext=\"$shrext_cmds\"
7667 eval library_names=\"$library_names_spec\"
7668 set dummy $library_names
7673 if test -n "$soname_spec"; then
7674 eval soname=\"$soname_spec\"
7678 if test -z "$dlname"; then
7682 lib="$output_objdir/$realname"
7686 linknames="$linknames $link"
7689 # Use standard objects if they are pic
7690 test -z "$pic_flag" && libobjs=`$ECHO "$libobjs" | $SP2NL | $SED "$lo2o" | $NL2SP`
7691 test "X$libobjs" = "X " && libobjs=
7694 if test -n "$export_symbols" && test -n "$include_expsyms"; then
7695 $opt_dry_run || cp "$export_symbols" "$output_objdir/$libname.uexp"
7696 export_symbols="$output_objdir/$libname.uexp"
7697 delfiles="$delfiles $export_symbols"
7700 orig_export_symbols=
7702 cygwin* | mingw* | cegcc*)
7703 if test -n "$export_symbols" && test -z "$export_symbols_regex"; then
7704 # exporting using user supplied symfile
7705 if test "x`$SED 1q $export_symbols`" != xEXPORTS; then
7706 # and it's NOT already a .def file. Must figure out
7707 # which of the given symbols are data symbols and tag
7708 # them as such. So, trigger use of export_symbols_cmds.
7709 # export_symbols gets reassigned inside the "prepare
7710 # the list of exported symbols" if statement, so the
7711 # include_expsyms logic still works.
7712 orig_export_symbols="$export_symbols"
7714 always_export_symbols=yes
7720 # Prepare the list of exported symbols
7721 if test -z "$export_symbols"; then
7722 if test "$always_export_symbols" = yes || test -n "$export_symbols_regex"; then
7723 func_verbose "generating symbol list for \`$libname.la'"
7724 export_symbols="$output_objdir/$libname.exp"
7725 $opt_dry_run || $RM $export_symbols
7726 cmds=$export_symbols_cmds
7727 save_ifs="$IFS"; IFS='~'
7728 for cmd in $cmds; do
7732 len=$func_len_result
7733 if test "$len" -lt "$max_cmd_len" || test "$max_cmd_len" -le -1; then
7734 func_show_eval "$cmd" 'exit $?'
7735 skipped_export=false
7737 # The command line is too long to execute in one step.
7738 func_verbose "using reloadable object file for export list..."
7740 # Break out early, otherwise skipped_export may be
7741 # set to false by a later but shorter cmd.
7746 if test -n "$export_symbols_regex" && test "X$skipped_export" != "X:"; then
7747 func_show_eval '$EGREP -e "$export_symbols_regex" "$export_symbols" > "${export_symbols}T"'
7748 func_show_eval '$MV "${export_symbols}T" "$export_symbols"'
7753 if test -n "$export_symbols" && test -n "$include_expsyms"; then
7754 tmp_export_symbols="$export_symbols"
7755 test -n "$orig_export_symbols" && tmp_export_symbols="$orig_export_symbols"
7756 $opt_dry_run || eval '$ECHO "$include_expsyms" | $SP2NL >> "$tmp_export_symbols"'
7759 if test "X$skipped_export" != "X:" && test -n "$orig_export_symbols"; then
7760 # The given exports_symbols file has to be filtered, so filter it.
7761 func_verbose "filter symbol list for \`$libname.la' to tag DATA exports"
7762 # FIXME: $output_objdir/$libname.filter potentially contains lots of
7763 # 's' commands which not all seds can handle. GNU sed should be fine
7764 # though. Also, the filter scales superlinearly with the number of
7765 # global variables. join(1) would be nice here, but unfortunately
7766 # isn't a blessed tool.
7767 $opt_dry_run || $SED -e '/[ ,]DATA/!d;s,\(.*\)\([ \,].*\),s|^\1$|\1\2|,' < $export_symbols > $output_objdir/$libname.filter
7768 delfiles="$delfiles $export_symbols $output_objdir/$libname.filter"
7769 export_symbols=$output_objdir/$libname.def
7770 $opt_dry_run || $SED -f $output_objdir/$libname.filter < $orig_export_symbols > $export_symbols
7774 for test_deplib in $deplibs; do
7775 case " $convenience " in
7776 *" $test_deplib "*) ;;
7778 tmp_deplibs="$tmp_deplibs $test_deplib"
7782 deplibs="$tmp_deplibs"
7784 if test -n "$convenience"; then
7785 if test -n "$whole_archive_flag_spec" &&
7786 test "$compiler_needs_object" = yes &&
7787 test -z "$libobjs"; then
7788 # extract the archives, so we have objects to list.
7789 # TODO: could optimize this to just extract one archive.
7790 whole_archive_flag_spec=
7792 if test -n "$whole_archive_flag_spec"; then
7793 save_libobjs=$libobjs
7794 eval libobjs=\"\$libobjs $whole_archive_flag_spec\"
7795 test "X$libobjs" = "X " && libobjs=
7797 gentop="$output_objdir/${outputname}x"
7798 generated="$generated $gentop"
7800 func_extract_archives $gentop $convenience
7801 libobjs="$libobjs $func_extract_archives_result"
7802 test "X$libobjs" = "X " && libobjs=
7806 if test "$thread_safe" = yes && test -n "$thread_safe_flag_spec"; then
7807 eval flag=\"$thread_safe_flag_spec\"
7808 linker_flags="$linker_flags $flag"
7811 # Make a backup of the uninstalled library when relinking
7812 if test "$mode" = relink; then
7813 $opt_dry_run || eval '(cd $output_objdir && $RM ${realname}U && $MV $realname ${realname}U)' || exit $?
7816 # Do each of the archive commands.
7817 if test "$module" = yes && test -n "$module_cmds" ; then
7818 if test -n "$export_symbols" && test -n "$module_expsym_cmds"; then
7819 eval test_cmds=\"$module_expsym_cmds\"
7820 cmds=$module_expsym_cmds
7822 eval test_cmds=\"$module_cmds\"
7826 if test -n "$export_symbols" && test -n "$archive_expsym_cmds"; then
7827 eval test_cmds=\"$archive_expsym_cmds\"
7828 cmds=$archive_expsym_cmds
7830 eval test_cmds=\"$archive_cmds\"
7835 if test "X$skipped_export" != "X:" &&
7836 func_len " $test_cmds" &&
7837 len=$func_len_result &&
7838 test "$len" -lt "$max_cmd_len" || test "$max_cmd_len" -le -1; then
7841 # The command line is too long to link in one step, link piecewise
7842 # or, if using GNU ld and skipped_export is not :, use a linker
7845 # Save the value of $output and $libobjs because we want to
7846 # use them later. If we have whole_archive_flag_spec, we
7847 # want to use save_libobjs as it was before
7848 # whole_archive_flag_spec was expanded, because we can't
7849 # assume the linker understands whole_archive_flag_spec.
7850 # This may have to be revisited, in case too many
7851 # convenience libraries get linked in and end up exceeding
7853 if test -z "$convenience" || test -z "$whole_archive_flag_spec"; then
7854 save_libobjs=$libobjs
7857 func_basename "$output"
7858 output_la=$func_basename_result
7860 # Clear the reloadable object creation command queue and
7861 # initialize k to one.
7868 if test -n "$save_libobjs" && test "X$skipped_export" != "X:" && test "$with_gnu_ld" = yes; then
7869 output=${output_objdir}/${output_la}.lnkscript
7870 func_verbose "creating GNU ld script: $output"
7871 echo 'INPUT (' > $output
7872 for obj in $save_libobjs
7874 $ECHO "$obj" >> $output
7877 delfiles="$delfiles $output"
7878 elif test -n "$save_libobjs" && test "X$skipped_export" != "X:" && test "X$file_list_spec" != X; then
7879 output=${output_objdir}/${output_la}.lnk
7880 func_verbose "creating linker input file list: $output"
7885 if test "$compiler_needs_object" = yes; then
7891 $ECHO "$obj" >> $output
7893 delfiles="$delfiles $output"
7894 output=$firstobj\"$file_list_spec$output\"
7896 if test -n "$save_libobjs"; then
7897 func_verbose "creating reloadable object files..."
7898 output=$output_objdir/$output_la-${k}.$objext
7899 eval test_cmds=\"$reload_cmds\"
7900 func_len " $test_cmds"
7901 len0=$func_len_result
7904 # Loop over the list of objects to be linked.
7905 for obj in $save_libobjs
7908 func_arith $len + $func_len_result
7909 len=$func_arith_result
7910 if test "X$objlist" = X ||
7911 test "$len" -lt "$max_cmd_len"; then
7912 func_append objlist " $obj"
7914 # The command $test_cmds is almost too long, add a
7915 # command to the queue.
7916 if test "$k" -eq 1 ; then
7917 # The first file doesn't have a previous command to add.
7918 reload_objs=$objlist
7919 eval concat_cmds=\"$reload_cmds\"
7921 # All subsequent reloadable object files will link in
7922 # the last one created.
7923 reload_objs="$objlist $last_robj"
7924 eval concat_cmds=\"\$concat_cmds~$reload_cmds~\$RM $last_robj\"
7926 last_robj=$output_objdir/$output_la-${k}.$objext
7928 k=$func_arith_result
7929 output=$output_objdir/$output_la-${k}.$objext
7931 func_len " $last_robj"
7932 func_arith $len0 + $func_len_result
7933 len=$func_arith_result
7936 # Handle the remaining objects by creating one last
7937 # reloadable object file. All subsequent reloadable object
7938 # files will link in the last one created.
7939 test -z "$concat_cmds" || concat_cmds=$concat_cmds~
7940 reload_objs="$objlist $last_robj"
7941 eval concat_cmds=\"\${concat_cmds}$reload_cmds\"
7942 if test -n "$last_robj"; then
7943 eval concat_cmds=\"\${concat_cmds}~\$RM $last_robj\"
7945 delfiles="$delfiles $output"
7951 if ${skipped_export-false}; then
7952 func_verbose "generating symbol list for \`$libname.la'"
7953 export_symbols="$output_objdir/$libname.exp"
7954 $opt_dry_run || $RM $export_symbols
7956 # Append the command to create the export file.
7957 test -z "$concat_cmds" || concat_cmds=$concat_cmds~
7958 eval concat_cmds=\"\$concat_cmds$export_symbols_cmds\"
7959 if test -n "$last_robj"; then
7960 eval concat_cmds=\"\$concat_cmds~\$RM $last_robj\"
7964 test -n "$save_libobjs" &&
7965 func_verbose "creating a temporary reloadable object file: $output"
7967 # Loop through the commands generated above and execute them.
7968 save_ifs="$IFS"; IFS='~'
7969 for cmd in $concat_cmds; do
7972 func_quote_for_expand "$cmd"
7973 eval "func_echo $func_quote_for_expand_result"
7975 $opt_dry_run || eval "$cmd" || {
7978 # Restore the uninstalled library and exit
7979 if test "$mode" = relink; then
7980 ( cd "$output_objdir" && \
7981 $RM "${realname}T" && \
7982 $MV "${realname}U" "$realname" )
7990 if test -n "$export_symbols_regex" && ${skipped_export-false}; then
7991 func_show_eval '$EGREP -e "$export_symbols_regex" "$export_symbols" > "${export_symbols}T"'
7992 func_show_eval '$MV "${export_symbols}T" "$export_symbols"'
7996 if ${skipped_export-false}; then
7997 if test -n "$export_symbols" && test -n "$include_expsyms"; then
7998 tmp_export_symbols="$export_symbols"
7999 test -n "$orig_export_symbols" && tmp_export_symbols="$orig_export_symbols"
8000 $opt_dry_run || eval '$ECHO "$include_expsyms" | $SP2NL >> "$tmp_export_symbols"'
8003 if test -n "$orig_export_symbols"; then
8004 # The given exports_symbols file has to be filtered, so filter it.
8005 func_verbose "filter symbol list for \`$libname.la' to tag DATA exports"
8006 # FIXME: $output_objdir/$libname.filter potentially contains lots of
8007 # 's' commands which not all seds can handle. GNU sed should be fine
8008 # though. Also, the filter scales superlinearly with the number of
8009 # global variables. join(1) would be nice here, but unfortunately
8010 # isn't a blessed tool.
8011 $opt_dry_run || $SED -e '/[ ,]DATA/!d;s,\(.*\)\([ \,].*\),s|^\1$|\1\2|,' < $export_symbols > $output_objdir/$libname.filter
8012 delfiles="$delfiles $export_symbols $output_objdir/$libname.filter"
8013 export_symbols=$output_objdir/$libname.def
8014 $opt_dry_run || $SED -f $output_objdir/$libname.filter < $orig_export_symbols > $export_symbols
8019 # Restore the value of output.
8022 if test -n "$convenience" && test -n "$whole_archive_flag_spec"; then
8023 eval libobjs=\"\$libobjs $whole_archive_flag_spec\"
8024 test "X$libobjs" = "X " && libobjs=
8026 # Expand the library linking commands again to reset the
8027 # value of $libobjs for piecewise linking.
8029 # Do each of the archive commands.
8030 if test "$module" = yes && test -n "$module_cmds" ; then
8031 if test -n "$export_symbols" && test -n "$module_expsym_cmds"; then
8032 cmds=$module_expsym_cmds
8037 if test -n "$export_symbols" && test -n "$archive_expsym_cmds"; then
8038 cmds=$archive_expsym_cmds
8045 if test -n "$delfiles"; then
8046 # Append the command to remove temporary files to $cmds.
8047 eval cmds=\"\$cmds~\$RM $delfiles\"
8050 # Add any objects from preloaded convenience libraries
8051 if test -n "$dlprefiles"; then
8052 gentop="$output_objdir/${outputname}x"
8053 generated="$generated $gentop"
8055 func_extract_archives $gentop $dlprefiles
8056 libobjs="$libobjs $func_extract_archives_result"
8057 test "X$libobjs" = "X " && libobjs=
8060 save_ifs="$IFS"; IFS='~'
8061 for cmd in $cmds; do
8065 func_quote_for_expand "$cmd"
8066 eval "func_echo $func_quote_for_expand_result"
8068 $opt_dry_run || eval "$cmd" || {
8071 # Restore the uninstalled library and exit
8072 if test "$mode" = relink; then
8073 ( cd "$output_objdir" && \
8074 $RM "${realname}T" && \
8075 $MV "${realname}U" "$realname" )
8083 # Restore the uninstalled library and exit
8084 if test "$mode" = relink; then
8085 $opt_dry_run || eval '(cd $output_objdir && $RM ${realname}T && $MV $realname ${realname}T && $MV ${realname}U $realname)' || exit $?
8087 if test -n "$convenience"; then
8088 if test -z "$whole_archive_flag_spec"; then
8089 func_show_eval '${RM}r "$gentop"'
8096 # Create links to the real library.
8097 for linkname in $linknames; do
8098 if test "$realname" != "$linkname"; then
8099 func_show_eval '(cd "$output_objdir" && $RM "$linkname" && $LN_S "$realname" "$linkname")' 'exit $?'
8103 # If -module or -export-dynamic was specified, set the dlname.
8104 if test "$module" = yes || test "$export_dynamic" = yes; then
8105 # On all known operating systems, these are identical.
8112 if test -n "$dlfiles$dlprefiles" || test "$dlself" != no; then
8113 func_warning "\`-dlopen' is ignored for objects"
8118 func_warning "\`-l' and \`-L' are ignored for objects" ;;
8121 test -n "$rpath" && \
8122 func_warning "\`-rpath' is ignored for objects"
8124 test -n "$xrpath" && \
8125 func_warning "\`-R' is ignored for objects"
8127 test -n "$vinfo" && \
8128 func_warning "\`-version-info' is ignored for objects"
8130 test -n "$release" && \
8131 func_warning "\`-release' is ignored for objects"
8135 test -n "$objs$old_deplibs" && \
8136 func_fatal_error "cannot build library object \`$output' from non-libtool objects"
8140 obj=$func_lo2o_result
8148 # Delete the old objects.
8149 $opt_dry_run || $RM $obj $libobj
8151 # Objects from convenience libraries. This assumes
8152 # single-version convenience libraries. Whenever we create
8153 # different ones for PIC/non-PIC, this we'll have to duplicate
8157 # reload_cmds runs $LD directly, so let us get rid of
8158 # -Wl from whole_archive_flag_spec and hope we can get by with
8159 # turning comma into space..
8162 if test -n "$convenience"; then
8163 if test -n "$whole_archive_flag_spec"; then
8164 eval tmp_whole_archive_flags=\"$whole_archive_flag_spec\"
8165 reload_conv_objs=$reload_objs\ `$ECHO "$tmp_whole_archive_flags" | $SED 's|,| |g'`
8167 gentop="$output_objdir/${obj}x"
8168 generated="$generated $gentop"
8170 func_extract_archives $gentop $convenience
8171 reload_conv_objs="$reload_objs $func_extract_archives_result"
8175 # Create the old-style object.
8176 reload_objs="$objs$old_deplibs "`$ECHO "$libobjs" | $SP2NL | $SED "/\.${libext}$/d; /\.lib$/d; $lo2o" | $NL2SP`" $reload_conv_objs" ### testsuite: skip nested quoting test
8179 func_execute_cmds "$reload_cmds" 'exit $?'
8181 # Exit if we aren't doing a library object file.
8182 if test -z "$libobj"; then
8183 if test -n "$gentop"; then
8184 func_show_eval '${RM}r "$gentop"'
8190 if test "$build_libtool_libs" != yes; then
8191 if test -n "$gentop"; then
8192 func_show_eval '${RM}r "$gentop"'
8195 # Create an invalid libtool object if no PIC, so that we don't
8196 # accidentally link it into a program.
8197 # $show "echo timestamp > $libobj"
8198 # $opt_dry_run || eval "echo timestamp > $libobj" || exit $?
8202 if test -n "$pic_flag" || test "$pic_mode" != default; then
8203 # Only do commands if we really have different PIC objects.
8204 reload_objs="$libobjs $reload_conv_objs"
8206 func_execute_cmds "$reload_cmds" 'exit $?'
8209 if test -n "$gentop"; then
8210 func_show_eval '${RM}r "$gentop"'
8218 *cygwin*) func_stripname '' '.exe' "$output"
8219 output=$func_stripname_result.exe;;
8221 test -n "$vinfo" && \
8222 func_warning "\`-version-info' is ignored for programs"
8224 test -n "$release" && \
8225 func_warning "\`-release' is ignored for programs"
8227 test "$preload" = yes \
8228 && test "$dlopen_support" = unknown \
8229 && test "$dlopen_self" = unknown \
8230 && test "$dlopen_self_static" = unknown && \
8231 func_warning "\`LT_INIT([dlopen])' not used. Assuming no dlopen support."
8234 *-*-rhapsody* | *-*-darwin1.[012])
8235 # On Rhapsody replace the C library is the System framework
8236 compile_deplibs=`$ECHO " $compile_deplibs" | $SED 's/ -lc / System.ltframework /'`
8237 finalize_deplibs=`$ECHO " $finalize_deplibs" | $SED 's/ -lc / System.ltframework /'`
8243 # Don't allow lazy linking, it breaks C++ global constructors
8244 # But is supposedly fixed on 10.4 or later (yay!).
8245 if test "$tagname" = CXX ; then
8246 case ${MACOSX_DEPLOYMENT_TARGET-10.0} in
8248 compile_command="$compile_command ${wl}-bind_at_load"
8249 finalize_command="$finalize_command ${wl}-bind_at_load"
8253 # Time to change all our "foo.ltframework" stuff back to "-framework foo"
8254 compile_deplibs=`$ECHO " $compile_deplibs" | $SED 's% \([^ $]*\).ltframework% -framework \1%g'`
8255 finalize_deplibs=`$ECHO " $finalize_deplibs" | $SED 's% \([^ $]*\).ltframework% -framework \1%g'`
8260 # move library search paths that coincide with paths to not yet
8261 # installed libraries to the beginning of the library search list
8263 for path in $notinst_path; do
8264 case " $new_libs " in
8265 *" -L$path/$objdir "*) ;;
8267 case " $compile_deplibs " in
8268 *" -L$path/$objdir "*)
8269 new_libs="$new_libs -L$path/$objdir" ;;
8274 for deplib in $compile_deplibs; do
8277 case " $new_libs " in
8279 *) new_libs="$new_libs $deplib" ;;
8282 *) new_libs="$new_libs $deplib" ;;
8285 compile_deplibs="$new_libs"
8288 compile_command="$compile_command $compile_deplibs"
8289 finalize_command="$finalize_command $finalize_deplibs"
8291 if test -n "$rpath$xrpath"; then
8292 # If the user specified any rpath flags, then add them.
8293 for libdir in $rpath $xrpath; do
8294 # This is the magic to use -rpath.
8295 case "$finalize_rpath " in
8297 *) finalize_rpath="$finalize_rpath $libdir" ;;
8302 # Now hardcode the library paths
8305 for libdir in $compile_rpath $finalize_rpath; do
8306 if test -n "$hardcode_libdir_flag_spec"; then
8307 if test -n "$hardcode_libdir_separator"; then
8308 if test -z "$hardcode_libdirs"; then
8309 hardcode_libdirs="$libdir"
8311 # Just accumulate the unique libdirs.
8312 case $hardcode_libdir_separator$hardcode_libdirs$hardcode_libdir_separator in
8313 *"$hardcode_libdir_separator$libdir$hardcode_libdir_separator"*)
8316 hardcode_libdirs="$hardcode_libdirs$hardcode_libdir_separator$libdir"
8321 eval flag=\"$hardcode_libdir_flag_spec\"
8322 rpath="$rpath $flag"
8324 elif test -n "$runpath_var"; then
8325 case "$perm_rpath " in
8327 *) perm_rpath="$perm_rpath $libdir" ;;
8331 *-*-cygwin* | *-*-mingw* | *-*-pw32* | *-*-os2* | *-cegcc*)
8332 testbindir=`${ECHO} "$libdir" | ${SED} -e 's*/lib$*/bin*'`
8333 case :$dllsearchpath: in
8335 ::) dllsearchpath=$libdir;;
8336 *) dllsearchpath="$dllsearchpath:$libdir";;
8338 case :$dllsearchpath: in
8339 *":$testbindir:"*) ;;
8340 ::) dllsearchpath=$testbindir;;
8341 *) dllsearchpath="$dllsearchpath:$testbindir";;
8346 # Substitute the hardcoded libdirs into the rpath.
8347 if test -n "$hardcode_libdir_separator" &&
8348 test -n "$hardcode_libdirs"; then
8349 libdir="$hardcode_libdirs"
8350 eval rpath=\" $hardcode_libdir_flag_spec\"
8352 compile_rpath="$rpath"
8356 for libdir in $finalize_rpath; do
8357 if test -n "$hardcode_libdir_flag_spec"; then
8358 if test -n "$hardcode_libdir_separator"; then
8359 if test -z "$hardcode_libdirs"; then
8360 hardcode_libdirs="$libdir"
8362 # Just accumulate the unique libdirs.
8363 case $hardcode_libdir_separator$hardcode_libdirs$hardcode_libdir_separator in
8364 *"$hardcode_libdir_separator$libdir$hardcode_libdir_separator"*)
8367 hardcode_libdirs="$hardcode_libdirs$hardcode_libdir_separator$libdir"
8372 eval flag=\"$hardcode_libdir_flag_spec\"
8373 rpath="$rpath $flag"
8375 elif test -n "$runpath_var"; then
8376 case "$finalize_perm_rpath " in
8378 *) finalize_perm_rpath="$finalize_perm_rpath $libdir" ;;
8382 # Substitute the hardcoded libdirs into the rpath.
8383 if test -n "$hardcode_libdir_separator" &&
8384 test -n "$hardcode_libdirs"; then
8385 libdir="$hardcode_libdirs"
8386 eval rpath=\" $hardcode_libdir_flag_spec\"
8388 finalize_rpath="$rpath"
8390 if test -n "$libobjs" && test "$build_old_libs" = yes; then
8391 # Transform all the library objects into standard objects.
8392 compile_command=`$ECHO "$compile_command" | $SP2NL | $SED "$lo2o" | $NL2SP`
8393 finalize_command=`$ECHO "$finalize_command" | $SP2NL | $SED "$lo2o" | $NL2SP`
8396 func_generate_dlsyms "$outputname" "@PROGRAM@" "no"
8398 # template prelinking step
8399 if test -n "$prelink_cmds"; then
8400 func_execute_cmds "$prelink_cmds" 'exit $?'
8403 wrappers_required=yes
8405 *cegcc* | *mingw32ce*)
8406 # Disable wrappers for cegcc and mingw32ce hosts, we are cross compiling anyway.
8407 wrappers_required=no
8409 *cygwin* | *mingw* )
8410 if test "$build_libtool_libs" != yes; then
8411 wrappers_required=no
8415 if test "$need_relink" = no || test "$build_libtool_libs" != yes; then
8416 wrappers_required=no
8420 if test "$wrappers_required" = no; then
8421 # Replace the output file specification.
8422 compile_command=`$ECHO "$compile_command" | $SED 's%@OUTPUT@%'"$output"'%g'`
8423 link_command="$compile_command$compile_rpath"
8425 # We have no uninstalled library dependencies, so finalize right now.
8427 func_show_eval "$link_command" 'exit_status=$?'
8429 # Delete the generated files.
8430 if test -f "$output_objdir/${outputname}S.${objext}"; then
8431 func_show_eval '$RM "$output_objdir/${outputname}S.${objext}"'
8437 if test -n "$compile_shlibpath$finalize_shlibpath"; then
8438 compile_command="$shlibpath_var=\"$compile_shlibpath$finalize_shlibpath\$$shlibpath_var\" $compile_command"
8440 if test -n "$finalize_shlibpath"; then
8441 finalize_command="$shlibpath_var=\"$finalize_shlibpath\$$shlibpath_var\" $finalize_command"
8446 if test -n "$runpath_var"; then
8447 if test -n "$perm_rpath"; then
8448 # We should set the runpath_var.
8450 for dir in $perm_rpath; do
8453 compile_var="$runpath_var=\"$rpath\$$runpath_var\" "
8455 if test -n "$finalize_perm_rpath"; then
8456 # We should set the runpath_var.
8458 for dir in $finalize_perm_rpath; do
8461 finalize_var="$runpath_var=\"$rpath\$$runpath_var\" "
8465 if test "$no_install" = yes; then
8466 # We don't need to create a wrapper script.
8467 link_command="$compile_var$compile_command$compile_rpath"
8468 # Replace the output file specification.
8469 link_command=`$ECHO "$link_command" | $SED 's%@OUTPUT@%'"$output"'%g'`
8470 # Delete the old output file.
8471 $opt_dry_run || $RM $output
8472 # Link the executable and exit
8473 func_show_eval "$link_command" 'exit $?'
8477 if test "$hardcode_action" = relink; then
8478 # Fast installation is not supported
8479 link_command="$compile_var$compile_command$compile_rpath"
8480 relink_command="$finalize_var$finalize_command$finalize_rpath"
8482 func_warning "this platform does not like uninstalled shared libraries"
8483 func_warning "\`$output' will be relinked during installation"
8485 if test "$fast_install" != no; then
8486 link_command="$finalize_var$compile_command$finalize_rpath"
8487 if test "$fast_install" = yes; then
8488 relink_command=`$ECHO "$compile_var$compile_command$compile_rpath" | $SED 's%@OUTPUT@%\$progdir/\$file%g'`
8490 # fast_install is set to needless
8494 link_command="$compile_var$compile_command$compile_rpath"
8495 relink_command="$finalize_var$finalize_command$finalize_rpath"
8499 # Replace the output file specification.
8500 link_command=`$ECHO "$link_command" | $SED 's%@OUTPUT@%'"$output_objdir/$outputname"'%g'`
8502 # Delete the old output files.
8503 $opt_dry_run || $RM $output $output_objdir/$outputname $output_objdir/lt-$outputname
8505 func_show_eval "$link_command" 'exit $?'
8507 # Now create the wrapper script.
8508 func_verbose "creating $output"
8510 # Quote the relink command for shipping.
8511 if test -n "$relink_command"; then
8512 # Preserve any variables that may affect compiler behavior
8513 for var in $variables_saved_for_relink; do
8514 if eval test -z \"\${$var+set}\"; then
8515 relink_command="{ test -z \"\${$var+set}\" || $lt_unset $var || { $var=; export $var; }; }; $relink_command"
8516 elif eval var_value=\$$var; test -z "$var_value"; then
8517 relink_command="$var=; export $var; $relink_command"
8519 func_quote_for_eval "$var_value"
8520 relink_command="$var=$func_quote_for_eval_result; export $var; $relink_command"
8523 relink_command="(cd `pwd`; $relink_command)"
8524 relink_command=`$ECHO "$relink_command" | $SED "$sed_quote_subst"`
8527 # Only actually do things if not in dry run mode.
8529 # win32 will think the script is a binary if it has
8530 # a .exe suffix, so we strip it off here.
8532 *.exe) func_stripname '' '.exe' "$output"
8533 output=$func_stripname_result ;;
8535 # test for cygwin because mv fails w/o .exe extensions
8539 func_stripname '' '.exe' "$outputname"
8540 outputname=$func_stripname_result ;;
8544 *cygwin* | *mingw* )
8545 func_dirname_and_basename "$output" "" "."
8546 output_name=$func_basename_result
8547 output_path=$func_dirname_result
8548 cwrappersource="$output_path/$objdir/lt-$output_name.c"
8549 cwrapper="$output_path/$output_name.exe"
8550 $RM $cwrappersource $cwrapper
8551 trap "$RM $cwrappersource $cwrapper; exit $EXIT_FAILURE" 1 2 15
8553 func_emit_cwrapperexe_src > $cwrappersource
8555 # The wrapper executable is built using the $host compiler,
8556 # because it contains $host paths and files. If cross-
8557 # compiling, it, like the target executable, must be
8558 # executed on the $host or under an emulation environment.
8560 $LTCC $LTCFLAGS -o $cwrapper $cwrappersource
8564 # Now, create the wrapper script for func_source use:
8565 func_ltwrapper_scriptname $cwrapper
8566 $RM $func_ltwrapper_scriptname_result
8567 trap "$RM $func_ltwrapper_scriptname_result; exit $EXIT_FAILURE" 1 2 15
8569 # note: this script will not be executed, so do not chmod.
8570 if test "x$build" = "x$host" ; then
8571 $cwrapper --lt-dump-script > $func_ltwrapper_scriptname_result
8573 func_emit_wrapper no > $func_ltwrapper_scriptname_result
8579 trap "$RM $output; exit $EXIT_FAILURE" 1 2 15
8581 func_emit_wrapper no > $output
8590 # See if we need to build an old-fashioned archive.
8591 for oldlib in $oldlibs; do
8593 if test "$build_libtool_libs" = convenience; then
8594 oldobjs="$libobjs_save $symfileobj"
8595 addlibs="$convenience"
8596 build_libtool_libs=no
8598 if test "$build_libtool_libs" = module; then
8599 oldobjs="$libobjs_save"
8600 build_libtool_libs=no
8602 oldobjs="$old_deplibs $non_pic_objects"
8603 if test "$preload" = yes && test -f "$symfileobj"; then
8604 oldobjs="$oldobjs $symfileobj"
8607 addlibs="$old_convenience"
8610 if test -n "$addlibs"; then
8611 gentop="$output_objdir/${outputname}x"
8612 generated="$generated $gentop"
8614 func_extract_archives $gentop $addlibs
8615 oldobjs="$oldobjs $func_extract_archives_result"
8618 # Do each command in the archive commands.
8619 if test -n "$old_archive_from_new_cmds" && test "$build_libtool_libs" = yes; then
8620 cmds=$old_archive_from_new_cmds
8623 # Add any objects from preloaded convenience libraries
8624 if test -n "$dlprefiles"; then
8625 gentop="$output_objdir/${outputname}x"
8626 generated="$generated $gentop"
8628 func_extract_archives $gentop $dlprefiles
8629 oldobjs="$oldobjs $func_extract_archives_result"
8632 # POSIX demands no paths to be encoded in archives. We have
8633 # to avoid creating archives with duplicate basenames if we
8634 # might have to extract them afterwards, e.g., when creating a
8635 # static archive out of a convenience library, or when linking
8636 # the entirety of a libtool archive into another (currently
8637 # not supported by libtool).
8638 if (for obj in $oldobjs
8640 func_basename "$obj"
8641 $ECHO "$func_basename_result"
8642 done | sort | sort -uc >/dev/null 2>&1); then
8645 echo "copying selected object files to avoid basename conflicts..."
8646 gentop="$output_objdir/${outputname}x"
8647 generated="$generated $gentop"
8648 func_mkdir_p "$gentop"
8649 save_oldobjs=$oldobjs
8652 for obj in $save_oldobjs
8654 func_basename "$obj"
8655 objbase="$func_basename_result"
8656 case " $oldobjs " in
8657 " ") oldobjs=$obj ;;
8660 # Make sure we don't pick an alternate name that also
8662 newobj=lt$counter-$objbase
8663 func_arith $counter + 1
8664 counter=$func_arith_result
8665 case " $oldobjs " in
8666 *[\ /]"$newobj "*) ;;
8667 *) if test ! -f "$gentop/$newobj"; then break; fi ;;
8670 func_show_eval "ln $obj $gentop/$newobj || cp $obj $gentop/$newobj"
8671 oldobjs="$oldobjs $gentop/$newobj"
8673 *) oldobjs="$oldobjs $obj" ;;
8677 eval cmds=\"$old_archive_cmds\"
8680 len=$func_len_result
8681 if test "$len" -lt "$max_cmd_len" || test "$max_cmd_len" -le -1; then
8682 cmds=$old_archive_cmds
8684 # the command line is too long to link in one step, link in parts
8685 func_verbose "using piecewise archive linking..."
8690 save_oldobjs=$oldobjs
8692 # Is there a better way of finding the last object in the list?
8693 for obj in $save_oldobjs
8697 eval test_cmds=\"$old_archive_cmds\"
8698 func_len " $test_cmds"
8699 len0=$func_len_result
8701 for obj in $save_oldobjs
8704 func_arith $len + $func_len_result
8705 len=$func_arith_result
8706 func_append objlist " $obj"
8707 if test "$len" -lt "$max_cmd_len"; then
8710 # the above command should be used before it gets too long
8712 if test "$obj" = "$last_oldobj" ; then
8715 test -z "$concat_cmds" || concat_cmds=$concat_cmds~
8716 eval concat_cmds=\"\${concat_cmds}$old_archive_cmds\"
8723 if test "X$oldobjs" = "X" ; then
8724 eval cmds=\"\$concat_cmds\"
8726 eval cmds=\"\$concat_cmds~\$old_archive_cmds\"
8730 func_execute_cmds "$cmds" 'exit $?'
8733 test -n "$generated" && \
8734 func_show_eval "${RM}r$generated"
8736 # Now create the libtool archive.
8740 test "$build_old_libs" = yes && old_library="$libname.$libext"
8741 func_verbose "creating $output"
8743 # Preserve any variables that may affect compiler behavior
8744 for var in $variables_saved_for_relink; do
8745 if eval test -z \"\${$var+set}\"; then
8746 relink_command="{ test -z \"\${$var+set}\" || $lt_unset $var || { $var=; export $var; }; }; $relink_command"
8747 elif eval var_value=\$$var; test -z "$var_value"; then
8748 relink_command="$var=; export $var; $relink_command"
8750 func_quote_for_eval "$var_value"
8751 relink_command="$var=$func_quote_for_eval_result; export $var; $relink_command"
8754 # Quote the link command for shipping.
8755 relink_command="(cd `pwd`; $SHELL $progpath $preserve_args --mode=relink $libtool_args @inst_prefix_dir@)"
8756 relink_command=`$ECHO "$relink_command" | $SED "$sed_quote_subst"`
8757 if test "$hardcode_automatic" = yes ; then
8761 # Only create the output if not a dry run.
8763 for installed in no yes; do
8764 if test "$installed" = yes; then
8765 if test -z "$install_libdir"; then
8768 output="$output_objdir/$outputname"i
8769 # Replace all uninstalled libtool libraries with the installed ones
8771 for deplib in $dependency_libs; do
8774 func_basename "$deplib"
8775 name="$func_basename_result"
8776 eval libdir=`${SED} -n -e 's/^libdir=\(.*\)$/\1/p' $deplib`
8777 test -z "$libdir" && \
8778 func_fatal_error "\`$deplib' is not a valid libtool archive"
8779 newdependency_libs="$newdependency_libs $libdir/$name"
8781 *) newdependency_libs="$newdependency_libs $deplib" ;;
8784 dependency_libs="$newdependency_libs"
8787 for lib in $dlfiles; do
8790 func_basename "$lib"
8791 name="$func_basename_result"
8792 eval libdir=`${SED} -n -e 's/^libdir=\(.*\)$/\1/p' $lib`
8793 test -z "$libdir" && \
8794 func_fatal_error "\`$lib' is not a valid libtool archive"
8795 newdlfiles="$newdlfiles $libdir/$name"
8797 *) newdlfiles="$newdlfiles $lib" ;;
8800 dlfiles="$newdlfiles"
8802 for lib in $dlprefiles; do
8805 # Only pass preopened files to the pseudo-archive (for
8806 # eventual linking with the app. that links it) if we
8807 # didn't already link the preopened objects directly into
8809 func_basename "$lib"
8810 name="$func_basename_result"
8811 eval libdir=`${SED} -n -e 's/^libdir=\(.*\)$/\1/p' $lib`
8812 test -z "$libdir" && \
8813 func_fatal_error "\`$lib' is not a valid libtool archive"
8814 newdlprefiles="$newdlprefiles $libdir/$name"
8818 dlprefiles="$newdlprefiles"
8821 for lib in $dlfiles; do
8823 [\\/]* | [A-Za-z]:[\\/]*) abs="$lib" ;;
8824 *) abs=`pwd`"/$lib" ;;
8826 newdlfiles="$newdlfiles $abs"
8828 dlfiles="$newdlfiles"
8830 for lib in $dlprefiles; do
8832 [\\/]* | [A-Za-z]:[\\/]*) abs="$lib" ;;
8833 *) abs=`pwd`"/$lib" ;;
8835 newdlprefiles="$newdlprefiles $abs"
8837 dlprefiles="$newdlprefiles"
8840 # place dlname in correct position for cygwin
8841 # In fact, it would be nice if we could use this code for all target
8842 # systems that can't hard-code library paths into their executables
8843 # and that have no shared library path variable independent of PATH,
8844 # but it turns out we can't easily determine that from inspecting
8845 # libtool variables, so we have to hard-code the OSs to which it
8846 # applies here; at the moment, that means platforms that use the PE
8847 # object format with DLL files. See the long comment at the top of
8848 # tests/bindir.at for full details.
8850 case $host,$output,$installed,$module,$dlname in
8851 *cygwin*,*lai,yes,no,*.dll | *mingw*,*lai,yes,no,*.dll | *cegcc*,*lai,yes,no,*.dll)
8852 # If a -bindir argument was supplied, place the dll there.
8853 if test "x$bindir" != x ;
8855 func_relative_path "$install_libdir" "$bindir"
8856 tdlname=$func_relative_path_result$dlname
8858 # Otherwise fall back on heuristic.
8859 tdlname=../bin/$dlname
8864 # $outputname - a libtool library file
8865 # Generated by $PROGRAM (GNU $PACKAGE$TIMESTAMP) $VERSION
8867 # Please DO NOT delete this file!
8868 # It is necessary for linking the library.
8870 # The name that we can dlopen(3).
8873 # Names of this library.
8874 library_names='$library_names'
8876 # The name of the static archive.
8877 old_library='$old_library'
8879 # Linker flags that can not go in dependency_libs.
8880 inherited_linker_flags='$new_inherited_linker_flags'
8882 # Libraries that this one depends upon.
8883 dependency_libs='$dependency_libs'
8885 # Names of additional weak libraries provided by this library
8886 weak_library_names='$weak_libs'
8888 # Version information for $libname.
8893 # Is this an already installed library?
8894 installed=$installed
8896 # Should we warn about portability when linking against -modules?
8897 shouldnotlink=$module
8899 # Files to dlopen/dlpreopen
8901 dlpreopen='$dlprefiles'
8903 # Directory that this library needs to be installed in:
8904 libdir='$install_libdir'"
8905 if test "$installed" = no && test "$need_relink" = yes; then
8907 relink_command=\"$relink_command\""
8912 # Do a symbolic link so that the libtool archive can be found in
8913 # LD_LIBRARY_PATH before the program is installed.
8914 func_show_eval '( cd "$output_objdir" && $RM "$outputname" && $LN_S "../$outputname" "$outputname" )' 'exit $?'
8920 { test "$mode" = link || test "$mode" = relink; } &&
8921 func_mode_link ${1+"$@"}
8924 # func_mode_uninstall arg...
8925 func_mode_uninstall ()
8933 # This variable tells wrapper scripts just to set variables rather
8934 # than running their programs.
8935 libtool_install_magic="$magic"
8940 -f) RM="$RM $arg"; rmforce=yes ;;
8941 -*) RM="$RM $arg" ;;
8942 *) files="$files $arg" ;;
8947 func_fatal_help "you must specify an RM program"
8951 origobjdir="$objdir"
8952 for file in $files; do
8953 func_dirname "$file" "" "."
8954 dir="$func_dirname_result"
8955 if test "X$dir" = X.; then
8956 objdir="$origobjdir"
8958 objdir="$dir/$origobjdir"
8960 func_basename "$file"
8961 name="$func_basename_result"
8962 test "$mode" = uninstall && objdir="$dir"
8964 # Remember objdir for removal later, being careful to avoid duplicates
8965 if test "$mode" = clean; then
8968 *) rmdirs="$rmdirs $objdir" ;;
8972 # Don't error if the file doesn't exist and rm -f was used.
8973 if { test -L "$file"; } >/dev/null 2>&1 ||
8974 { test -h "$file"; } >/dev/null 2>&1 ||
8975 test -f "$file"; then
8977 elif test -d "$file"; then
8980 elif test "$rmforce" = yes; then
8988 # Possibly a libtool archive, so verify it.
8989 if func_lalib_p "$file"; then
8990 func_source $dir/$name
8992 # Delete the libtool libraries and symlinks.
8993 for n in $library_names; do
8994 rmfiles="$rmfiles $objdir/$n"
8996 test -n "$old_library" && rmfiles="$rmfiles $objdir/$old_library"
9000 case " $library_names " in
9001 # " " in the beginning catches empty $dlname
9003 *) rmfiles="$rmfiles $objdir/$dlname" ;;
9005 test -n "$libdir" && rmfiles="$rmfiles $objdir/$name $objdir/${name}i"
9008 if test -n "$library_names"; then
9009 # Do each command in the postuninstall commands.
9010 func_execute_cmds "$postuninstall_cmds" 'test "$rmforce" = yes || exit_status=1'
9013 if test -n "$old_library"; then
9014 # Do each command in the old_postuninstall commands.
9015 func_execute_cmds "$old_postuninstall_cmds" 'test "$rmforce" = yes || exit_status=1'
9017 # FIXME: should reinstall the best remaining shared library.
9024 # Possibly a libtool object, so verify it.
9025 if func_lalib_p "$file"; then
9028 func_source $dir/$name
9030 # Add PIC object to the list of files to remove.
9031 if test -n "$pic_object" &&
9032 test "$pic_object" != none; then
9033 rmfiles="$rmfiles $dir/$pic_object"
9036 # Add non-PIC object to the list of files to remove.
9037 if test -n "$non_pic_object" &&
9038 test "$non_pic_object" != none; then
9039 rmfiles="$rmfiles $dir/$non_pic_object"
9045 if test "$mode" = clean ; then
9049 func_stripname '' '.exe' "$file"
9050 file=$func_stripname_result
9051 func_stripname '' '.exe' "$name"
9052 noexename=$func_stripname_result
9053 # $file with .exe has already been added to rmfiles,
9054 # add $file without .exe
9055 rmfiles="$rmfiles $file"
9058 # Do a test to see if this is a libtool program.
9059 if func_ltwrapper_p "$file"; then
9060 if func_ltwrapper_executable_p "$file"; then
9061 func_ltwrapper_scriptname "$file"
9063 func_source $func_ltwrapper_scriptname_result
9064 rmfiles="$rmfiles $func_ltwrapper_scriptname_result"
9067 func_source $dir/$noexename
9070 # note $name still contains .exe if it was in $file originally
9071 # as does the version of $file that was added into $rmfiles
9072 rmfiles="$rmfiles $objdir/$name $objdir/${name}S.${objext}"
9073 if test "$fast_install" = yes && test -n "$relink_command"; then
9074 rmfiles="$rmfiles $objdir/lt-$name"
9076 if test "X$noexename" != "X$name" ; then
9077 rmfiles="$rmfiles $objdir/lt-${noexename}.c"
9083 func_show_eval "$RM $rmfiles" 'exit_status=1'
9085 objdir="$origobjdir"
9087 # Try to remove the ${objdir}s in the directories where we deleted files
9088 for dir in $rmdirs; do
9089 if test -d "$dir"; then
9090 func_show_eval "rmdir $dir >/dev/null 2>&1"
9097 { test "$mode" = uninstall || test "$mode" = clean; } &&
9098 func_mode_uninstall ${1+"$@"}
9100 test -z "$mode" && {
9101 help="$generic_help"
9102 func_fatal_help "you must specify a MODE"
9105 test -z "$exec_cmd" && \
9106 func_fatal_help "invalid operation mode \`$mode'"
9108 if test -n "$exec_cmd"; then
9109 eval exec "$exec_cmd"
9116 # The TAGs below are defined such that we never get into a situation
9117 # in which we disable both kinds of libraries. Given conflicting
9118 # choices, we go for a static library, that is the most portable,
9119 # since we can't tell whether shared libraries were disabled because
9120 # the user asked for that or because the platform doesn't support
9121 # them. This is particularly important on AIX, because we don't
9122 # support having both static and shared libraries enabled at the same
9123 # time on that platform, so we default to a shared-only configuration.
9124 # If a disable-shared tag is given, we'll fallback to a static-only
9125 # configuration. But we'll never go from static-only to shared-only.
9127 # ### BEGIN LIBTOOL TAG CONFIG: disable-shared
9128 build_libtool_libs=no
9130 # ### END LIBTOOL TAG CONFIG: disable-shared
9132 # ### BEGIN LIBTOOL TAG CONFIG: disable-static
9133 build_old_libs=`case $build_libtool_libs in yes) echo no;; *) echo yes;; esac`
9134 # ### END LIBTOOL TAG CONFIG: disable-static
9143 # ### BEGIN LIBTOOL TAG CONFIG: CXX
9145 # The linker used to build libraries.
9146 LD="/usr/bin/ld -m elf_x86_64"
9148 # How to create reloadable object files.
9150 reload_cmds="\$LD\$reload_flag -o \$output\$reload_objs"
9152 # Commands used to build an old-style archive.
9153 old_archive_cmds="\$AR \$AR_FLAGS \$oldlib\$oldobjs~\$RANLIB \$oldlib"
9155 # A language specific compiler.
9158 # Is the compiler the GNU compiler?
9161 # Compiler flag to turn off builtin functions.
9162 no_builtin_flag=" -fno-builtin"
9164 # How to pass a linker flag through the compiler.
9167 # Additional compiler flags for building library objects.
9168 pic_flag=" -fPIC -DPIC"
9170 # Compiler flag to prevent dynamic linking.
9173 # Does compiler simultaneously support -c and -o options?
9176 # Whether or not to add -lc for building shared libraries.
9177 build_libtool_need_lc=no
9179 # Whether or not to disallow shared libs when runtime libs are static.
9180 allow_libtool_libs_with_static_runtimes=no
9182 # Compiler flag to allow reflexive dlopens.
9183 export_dynamic_flag_spec="\${wl}--export-dynamic"
9185 # Compiler flag to generate shared objects directly from archives.
9186 whole_archive_flag_spec="\${wl}--whole-archive\$convenience \${wl}--no-whole-archive"
9188 # Whether the compiler copes with passing no objects directly.
9189 compiler_needs_object="no"
9191 # Create an old-style archive from a shared archive.
9192 old_archive_from_new_cmds=""
9194 # Create a temporary old-style archive to link instead of a shared archive.
9195 old_archive_from_expsyms_cmds=""
9197 # Commands used to build a shared archive.
9198 archive_cmds="\$CC -shared -nostdlib \$predep_objects \$libobjs \$deplibs \$postdep_objects \$compiler_flags \${wl}-soname \$wl\$soname -o \$lib"
9199 archive_expsym_cmds="\$CC -shared -nostdlib \$predep_objects \$libobjs \$deplibs \$postdep_objects \$compiler_flags \${wl}-soname \$wl\$soname \${wl}-retain-symbols-file \$wl\$export_symbols -o \$lib"
9201 # Commands used to build a loadable module if different from building
9204 module_expsym_cmds=""
9206 # Whether we are building with GNU ld or not.
9209 # Flag that allows shared libraries with undefined symbols to be built.
9210 allow_undefined_flag=""
9212 # Flag that enforces no undefined symbols.
9213 no_undefined_flag=""
9215 # Flag to hardcode $libdir into a binary during linking.
9216 # This must work even if $libdir does not exist
9217 hardcode_libdir_flag_spec="\${wl}-rpath \${wl}\$libdir"
9219 # If ld is used when linking, flag to hardcode $libdir into a binary
9220 # during linking. This must work even if $libdir does not exist.
9221 hardcode_libdir_flag_spec_ld=""
9223 # Whether we need a single "-rpath" flag with a separated argument.
9224 hardcode_libdir_separator=""
9226 # Set to "yes" if using DIR/libNAME${shared_ext} during linking hardcodes
9227 # DIR into the resulting binary.
9230 # Set to "yes" if using DIR/libNAME${shared_ext} during linking hardcodes
9231 # DIR into the resulting binary and the resulting library dependency is
9232 # "absolute",i.e impossible to change by setting ${shlibpath_var} if the
9233 # library is relocated.
9234 hardcode_direct_absolute=no
9236 # Set to "yes" if using the -LDIR flag during linking hardcodes DIR
9237 # into the resulting binary.
9240 # Set to "yes" if using SHLIBPATH_VAR=DIR during linking hardcodes DIR
9241 # into the resulting binary.
9242 hardcode_shlibpath_var=unsupported
9244 # Set to "yes" if building a shared library automatically hardcodes DIR
9245 # into the library and all subsequent libraries and executables linked
9247 hardcode_automatic=no
9249 # Set to yes if linker adds runtime paths of dependent libraries
9250 # to runtime path list.
9253 # Whether libtool must link a program against all its dependency libraries.
9254 link_all_deplibs=unknown
9256 # Fix the shell variable $srcfile for the compiler.
9259 # Set to "yes" if exported symbols are required.
9260 always_export_symbols=no
9262 # The commands to list exported symbols.
9263 export_symbols_cmds="\$NM \$libobjs \$convenience | \$global_symbol_pipe | \$SED 's/.* //' | sort | uniq > \$export_symbols"
9265 # Symbols that should not be listed in the preloaded symbols.
9266 exclude_expsyms="_GLOBAL_OFFSET_TABLE_|_GLOBAL__F[ID]_.*"
9268 # Symbols that must always be exported.
9271 # Commands necessary for linking programs (against libraries) with templates.
9274 # Specify filename containing input files.
9277 # How to hardcode a shared library path into an executable.
9278 hardcode_action=immediate
9280 # The directories searched by this compiler when creating a shared library.
9281 compiler_lib_search_dirs="/usr/lib/gcc/x86_64-redhat-linux/4.4.2 /usr/lib/gcc/x86_64-redhat-linux/4.4.2 /usr/lib/gcc/x86_64-redhat-linux/4.4.2/../../../../lib64 /lib/../lib64 /usr/lib/../lib64 /usr/lib/gcc/x86_64-redhat-linux/4.4.2/../../.."
9283 # Dependencies to place before and after the objects being linked to
9284 # create a shared library.
9285 predep_objects="/usr/lib/gcc/x86_64-redhat-linux/4.4.2/../../../../lib64/crti.o /usr/lib/gcc/x86_64-redhat-linux/4.4.2/crtbeginS.o"
9286 postdep_objects="/usr/lib/gcc/x86_64-redhat-linux/4.4.2/crtendS.o /usr/lib/gcc/x86_64-redhat-linux/4.4.2/../../../../lib64/crtn.o"
9288 postdeps="-lstdc++ -lm -lgomp -lgcc_s -lpthread -lc -lgcc_s"
9290 # The library search path used internally by the compiler when linking
9292 compiler_lib_search_path="-L/usr/lib/gcc/x86_64-redhat-linux/4.4.2 -L/usr/lib/gcc/x86_64-redhat-linux/4.4.2 -L/usr/lib/gcc/x86_64-redhat-linux/4.4.2/../../../../lib64 -L/lib/../lib64 -L/usr/lib/../lib64 -L/usr/lib/gcc/x86_64-redhat-linux/4.4.2/../../.."
9294 # ### END LIBTOOL TAG CONFIG: CXX