3 # libtool - Provide generalized library-building support services.
4 # Generated automatically by config.status (ImageMagick) 6.6.3-0
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, 2010 Free Software Foundation,
11 # Written by Gordon Matzigkeit, 1996
13 # This file is part of GNU Libtool.
15 # GNU Libtool is free software; you can redistribute it and/or
16 # modify it under the terms of the GNU General Public License as
17 # published by the Free Software Foundation; either version 2 of
18 # the License, or (at your option) any later version.
20 # As a special exception to the GNU General Public License,
21 # if you distribute this file as part of a program or library that
22 # is built using GNU Libtool, you may include this file under the
23 # same distribution terms that you use for the rest of that program.
25 # GNU Libtool is distributed in the hope that it will be useful,
26 # but WITHOUT ANY WARRANTY; without even the implied warranty of
27 # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
28 # GNU General Public License for more details.
30 # You should have received a copy of the GNU General Public License
31 # along with GNU Libtool; see the file COPYING. If not, a copy
32 # can be downloaded from http://www.gnu.org/licenses/gpl.html, or
33 # obtained by writing to the Free Software Foundation, Inc.,
34 # 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
37 # The names of the tagged configurations supported by this script.
40 # ### BEGIN LIBTOOL CONFIG
42 # A sed program that does not truncate output.
45 # Sed that helps us avoid accidentally triggering echo(1) options like -n.
46 Xsed="$SED -e 1s/^X//"
48 # A grep program that handles long lines.
54 # A literal string matcher.
57 # Shell to use when invoking shell scripts.
60 # An echo program that protects backslashes.
63 # Which release of libtool.m4 was used?
70 # DLL creation program.
73 # Object dumper program.
76 # Whether or not to build shared libraries.
77 build_libtool_libs=yes
79 # Whether or not to build static libraries.
82 # What type of objects to build.
85 # Whether or not to optimize for fast installation.
90 host=x86_64-unknown-linux-gnu
95 build=x86_64-unknown-linux-gnu
98 # A BSD- or MS-compatible name lister.
101 # Whether we need soft or hard links.
104 # What is the maximum length of a command?
107 # Object file suffix (normally "o").
110 # Executable file suffix (normally "").
113 # whether the shell understands "unset".
116 # turn spaces into newlines.
117 SP2NL="tr \\040 \\012"
119 # turn newlines into spaces.
120 NL2SP="tr \\015\\012 \\040\\040"
122 # Method to check whether dependent libraries are shared objects.
123 deplibs_check_method="pass_all"
125 # Command to use when deplibs_check_method == "file_magic".
126 file_magic_cmd="\$MAGIC_CMD"
132 # A symbol stripping program.
135 # Commands used to install an old-style archive.
137 old_postinstall_cmds="chmod 644 \$oldlib~\$RANLIB \$oldlib"
138 old_postuninstall_cmds=""
140 # Whether to use a lock for old archive extraction.
141 lock_old_archive_extraction=no
144 LTCC="gcc -std=gnu99 -std=gnu99"
146 # LTCC compiler flags.
147 LTCFLAGS="-fopenmp -g -O2 -Wall -pthread"
149 # Take the output of nm and produce a listing of raw symbols and C names.
150 global_symbol_pipe="sed -n -e 's/^.*[ ]\\([ABCDGIRSTW][ABCDGIRSTW]*\\)[ ][ ]*\\([_A-Za-z][_A-Za-z0-9]*\\)\$/\\1 \\2 \\2/p'"
152 # Transform the output of nm in a proper C declaration.
153 global_symbol_to_cdecl="sed -n -e 's/^T .* \\(.*\\)\$/extern int \\1();/p' -e 's/^[ABCDGIRSTW]* .* \\(.*\\)\$/extern char \\1;/p'"
155 # Transform the output of nm in a C name address pair.
156 global_symbol_to_c_name_address="sed -n -e 's/^: \\([^ ]*\\) \$/ {\\\"\\1\\\", (void *) 0},/p' -e 's/^[ABCDGIRSTW]* \\([^ ]*\\) \\([^ ]*\\)\$/ {\"\\2\", (void *) \\&\\2},/p'"
158 # Transform the output of nm in a C name address pair when lib prefix is needed.
159 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'"
161 # The name of the directory that contains temporary libtool files.
164 # Used to examine libraries when file_magic_cmd begins with "file".
167 # Must we lock files when doing compilation?
170 # Tool to manipulate archived DWARF debug symbol files on Mac OS X.
173 # Tool to change global to local symbols on Mac OS X.
176 # Tool to manipulate fat objects and archives on Mac OS X.
179 # ldd/readelf like tool for Mach-O binaries on Mac OS X.
182 # ldd/readelf like tool for 64 bit Mach-O binaries on Mac OS X 10.4.
185 # Old archive suffix (normally "a").
188 # Shared library suffix (normally ".so").
191 # The commands to extract the exported symbol list from a shared archive.
192 extract_expsyms_cmds=""
194 # Variables whose values should be saved in libtool wrapper scripts and
195 # restored at link time.
196 variables_saved_for_relink="PATH LD_LIBRARY_PATH LD_RUN_PATH GCC_EXEC_PREFIX COMPILER_PATH LIBRARY_PATH"
198 # Do we need the "lib" prefix for modules?
201 # Do we need a version for libraries?
204 # Library versioning type.
207 # Shared library runtime path variable.
208 runpath_var=LD_RUN_PATH
210 # Shared library path variable.
211 shlibpath_var=LD_LIBRARY_PATH
213 # Is shlibpath searched before the hard-coded library search path?
214 shlibpath_overrides_runpath=no
216 # Format of library name prefix.
217 libname_spec="lib\$name"
219 # List of archive names. First name is the real one, the rest are links.
220 # The last name is the one that the linker finds with -lNAME
221 library_names_spec="\${libname}\${release}\${shared_ext}\$versuffix \${libname}\${release}\${shared_ext}\$major \$libname\${shared_ext}"
223 # The coded name of the library, if different from the real name.
224 soname_spec="\${libname}\${release}\${shared_ext}\$major"
226 # Permission mode override for installation of shared libraries.
227 install_override_mode=""
229 # Command to use after installation of a shared archive.
232 # Command to use after uninstallation of a shared archive.
233 postuninstall_cmds=""
235 # Commands used to finish a libtool library installation in a directory.
236 finish_cmds="PATH=\\\"\\\$PATH:/sbin\\\" ldconfig -n \$libdir"
238 # As "finish_cmds", except a single script fragment to be evaled but
242 # Whether we should hardcode library paths into libraries.
243 hardcode_into_libs=yes
245 # Compile-time system search path for libraries.
246 sys_lib_search_path_spec="/usr/lib/gcc/x86_64-redhat-linux/4.4.4 /usr/lib64 /lib64 "
248 # Run-time system search path for libraries.
249 sys_lib_dlsearch_path_spec="/lib64 /usr/lib64 /lib /usr/lib /usr/lib64/alliance/lib /usr/lib64/atlas /usr/lib64/kicad /usr/lib64/llvm /usr/lib64/mysql /usr/lib64/octave-3.2.4 /usr/lib64/openmotif /usr/lib64/qt-3.3/lib /usr/lib64/tcl8.5/tclx8.4 /usr/lib64/tcl8.5 /usr/lib/wine/ /usr/lib64/wine/ /usr/lib64/xulrunner-1.9.2 "
251 # Whether dlopen is supported.
254 # Whether dlopen of programs is supported.
257 # Whether dlopen of statically linked programs is supported.
258 dlopen_self_static=yes
260 # Commands to strip libraries.
261 old_striplib="strip --strip-debug"
262 striplib="strip --strip-unneeded"
265 # The linker used to build libraries.
266 LD="/usr/bin/ld -m elf_x86_64"
268 # How to create reloadable object files.
270 reload_cmds="\$LD\$reload_flag -o \$output\$reload_objs"
272 # Commands used to build an old-style archive.
273 old_archive_cmds="\$AR \$AR_FLAGS \$oldlib\$oldobjs~\$RANLIB \$oldlib"
275 # A language specific compiler.
276 CC="gcc -std=gnu99 -std=gnu99"
278 # Is the compiler the GNU compiler?
281 # Compiler flag to turn off builtin functions.
282 no_builtin_flag=" -fno-builtin"
284 # How to pass a linker flag through the compiler.
287 # Additional compiler flags for building library objects.
288 pic_flag=" -fPIC -DPIC"
290 # Compiler flag to prevent dynamic linking.
293 # Does compiler simultaneously support -c and -o options?
296 # Whether or not to add -lc for building shared libraries.
297 build_libtool_need_lc=no
299 # Whether or not to disallow shared libs when runtime libs are static.
300 allow_libtool_libs_with_static_runtimes=no
302 # Compiler flag to allow reflexive dlopens.
303 export_dynamic_flag_spec="\${wl}--export-dynamic"
305 # Compiler flag to generate shared objects directly from archives.
306 whole_archive_flag_spec="\${wl}--whole-archive\$convenience \${wl}--no-whole-archive"
308 # Whether the compiler copes with passing no objects directly.
309 compiler_needs_object="no"
311 # Create an old-style archive from a shared archive.
312 old_archive_from_new_cmds=""
314 # Create a temporary old-style archive to link instead of a shared archive.
315 old_archive_from_expsyms_cmds=""
317 # Commands used to build a shared archive.
318 archive_cmds="\$CC -shared \$libobjs \$deplibs \$compiler_flags \${wl}-soname \$wl\$soname -o \$lib"
319 archive_expsym_cmds="echo \\\"{ global:\\\" > \$output_objdir/\$libname.ver~
320 cat \$export_symbols | sed -e \\\"s/\\\\(.*\\\\)/\\\\1;/\\\" >> \$output_objdir/\$libname.ver~
321 echo \\\"local: *; };\\\" >> \$output_objdir/\$libname.ver~
322 \$CC -shared \$libobjs \$deplibs \$compiler_flags \${wl}-soname \$wl\$soname \${wl}-version-script \${wl}\$output_objdir/\$libname.ver -o \$lib"
324 # Commands used to build a loadable module if different from building
327 module_expsym_cmds=""
329 # Whether we are building with GNU ld or not.
332 # Flag that allows shared libraries with undefined symbols to be built.
333 allow_undefined_flag=""
335 # Flag that enforces no undefined symbols.
338 # Flag to hardcode $libdir into a binary during linking.
339 # This must work even if $libdir does not exist
340 hardcode_libdir_flag_spec="\${wl}-rpath \${wl}\$libdir"
342 # If ld is used when linking, flag to hardcode $libdir into a binary
343 # during linking. This must work even if $libdir does not exist.
344 hardcode_libdir_flag_spec_ld=""
346 # Whether we need a single "-rpath" flag with a separated argument.
347 hardcode_libdir_separator=""
349 # Set to "yes" if using DIR/libNAME${shared_ext} during linking hardcodes
350 # DIR into the resulting binary.
353 # Set to "yes" if using DIR/libNAME${shared_ext} during linking hardcodes
354 # DIR into the resulting binary and the resulting library dependency is
355 # "absolute",i.e impossible to change by setting ${shlibpath_var} if the
356 # library is relocated.
357 hardcode_direct_absolute=no
359 # Set to "yes" if using the -LDIR flag during linking hardcodes DIR
360 # into the resulting binary.
363 # Set to "yes" if using SHLIBPATH_VAR=DIR during linking hardcodes DIR
364 # into the resulting binary.
365 hardcode_shlibpath_var=unsupported
367 # Set to "yes" if building a shared library automatically hardcodes DIR
368 # into the library and all subsequent libraries and executables linked
370 hardcode_automatic=no
372 # Set to yes if linker adds runtime paths of dependent libraries
373 # to runtime path list.
376 # Whether libtool must link a program against all its dependency libraries.
377 link_all_deplibs=unknown
379 # Fix the shell variable $srcfile for the compiler.
382 # Set to "yes" if exported symbols are required.
383 always_export_symbols=no
385 # The commands to list exported symbols.
386 export_symbols_cmds="\$NM \$libobjs \$convenience | \$global_symbol_pipe | \$SED 's/.* //' | sort | uniq > \$export_symbols"
388 # Symbols that should not be listed in the preloaded symbols.
389 exclude_expsyms="_GLOBAL_OFFSET_TABLE_|_GLOBAL__F[ID]_.*"
391 # Symbols that must always be exported.
394 # Commands necessary for linking programs (against libraries) with templates.
397 # Specify filename containing input files.
400 # How to hardcode a shared library path into an executable.
401 hardcode_action=immediate
403 # The directories searched by this compiler when creating a shared library.
404 compiler_lib_search_dirs=""
406 # Dependencies to place before and after the objects being linked to
407 # create a shared library.
413 # The library search path used internally by the compiler when linking
415 compiler_lib_search_path=""
417 # ### END LIBTOOL CONFIG
419 # Generated from ltmain.m4sh.
421 # libtool (GNU libtool) 2.2.10
422 # Written by Gordon Matzigkeit <gord@gnu.ai.mit.edu>, 1996
424 # Copyright (C) 1996, 1997, 1998, 1999, 2000, 2001, 2003, 2004, 2005, 2006,
425 # 2007, 2008, 2009, 2010 Free Software Foundation, Inc.
426 # This is free software; see the source for copying conditions. There is NO
427 # warranty; not even for MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
429 # GNU Libtool is free software; you can redistribute it and/or modify
430 # it under the terms of the GNU General Public License as published by
431 # the Free Software Foundation; either version 2 of the License, or
432 # (at your option) any later version.
434 # As a special exception to the GNU General Public License,
435 # if you distribute this file as part of a program or library that
436 # is built using GNU Libtool, you may include this file under the
437 # same distribution terms that you use for the rest of that program.
439 # GNU Libtool is distributed in the hope that it will be useful, but
440 # WITHOUT ANY WARRANTY; without even the implied warranty of
441 # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
442 # General Public License for more details.
444 # You should have received a copy of the GNU General Public License
445 # along with GNU Libtool; see the file COPYING. If not, a copy
446 # can be downloaded from http://www.gnu.org/licenses/gpl.html,
447 # or obtained by writing to the Free Software Foundation, Inc.,
448 # 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
450 # Usage: $progname [OPTION]... [MODE-ARG]...
452 # Provide generalized library-building support services.
454 # --config show all configuration variables
455 # --debug enable verbose shell tracing
456 # -n, --dry-run display commands without modifying any files
457 # --features display basic configuration information and exit
458 # --mode=MODE use operation mode MODE
459 # --preserve-dup-deps don't remove duplicate dependency libraries
460 # --quiet, --silent don't print informational messages
461 # --no-quiet, --no-silent
462 # print informational messages (default)
463 # --tag=TAG use configuration variables from tag TAG
464 # -v, --verbose print more informational messages than default
465 # --no-verbose don't print the extra informational messages
466 # --version print version information
467 # -h, --help, --help-all print short, long, or detailed help message
469 # MODE must be one of the following:
471 # clean remove files from the build directory
472 # compile compile a source file into a libtool object
473 # execute automatically set library path, then run a program
474 # finish complete the installation of libtool libraries
475 # install install libraries or executables
476 # link create a library or an executable
477 # uninstall remove libraries from an installed directory
479 # MODE-ARGS vary depending on the MODE. When passed as first option,
480 # `--mode=MODE' may be abbreviated as `MODE' or a unique abbreviation of that.
481 # Try `$progname --help --mode=MODE' for a more detailed description of MODE.
483 # When reporting a bug, please describe a test case to reproduce it and
484 # include the following information:
486 # host-triplet: $host
489 # compiler flags: $LTCFLAGS
490 # linker: $LD (gnu? $with_gnu_ld)
491 # $progname: (GNU libtool) 2.2.10
492 # automake: $automake_version
493 # autoconf: $autoconf_version
495 # Report bugs to <bug-libtool@gnu.org>.
501 package_revision=1.3175
503 # Be Bourne compatible
504 if test -n "${ZSH_VERSION+set}" && (emulate sh) >/dev/null 2>&1; then
507 # Zsh 3.x and 4.x performs word splitting on ${1+"$@"}, which
508 # is contrary to our usage. Disable this feature.
509 alias -g '${1+"$@"}'='"$@"'
512 case `(set -o) 2>/dev/null` in *posix*) set -o posix;; esac
514 BIN_SH=xpg4; export BIN_SH # for Tru64
515 DUALCASE=1; export DUALCASE # for MKS sh
517 # A function that is used when there is no print builtin or printf.
518 func_fallback_echo ()
520 eval 'cat <<_LTECHO_EOF
525 # NLS nuisances: We save the old values to restore during execute mode.
528 for lt_var in LANG LANGUAGE LC_ALL LC_CTYPE LC_COLLATE LC_MESSAGES
530 eval "if test \"\${$lt_var+set}\" = set; then
531 save_$lt_var=\$$lt_var
534 lt_user_locale=\"$lt_var=\\\$save_\$lt_var; \$lt_user_locale\"
535 lt_safe_locale=\"$lt_var=C; \$lt_safe_locale\"
540 export LANGUAGE LC_ALL
545 # Work around backward compatibility issue on IRIX 6.5. On IRIX 6.4+, sh
546 # is ksh but when the shell is invoked as "sh" and the current value of
547 # the _XPG environment variable is not equal to 1 (one), the special
548 # positional parameter $0, within a function call, is the name of the
555 test "${ECHO+set}" = set || ECHO=${as_echo-'printf %s\n'}
556 : ${EGREP="/bin/grep -E"}
557 : ${FGREP="/bin/grep -F"}
558 : ${GREP="/bin/grep"}
565 : ${SHELL="${CONFIG_SHELL-/bin/sh}"}
566 : ${Xsed="$SED -e 1s/^X//"}
571 EXIT_MISMATCH=63 # $? = 63 is used to indicate version mismatch to missing.
572 EXIT_SKIP=77 # $? = 77 is used to indicate a skipped test to automake.
574 exit_status=$EXIT_SUCCESS
576 # Make sure IFS has a sensible default
581 dirname="s,/[^/]*$,,"
584 # func_dirname_and_basename file append nondir_replacement
585 # perform func_basename and func_dirname in a single function
587 # dirname: Compute the dirname of FILE. If nonempty,
588 # add APPEND to the result, otherwise set result
589 # to NONDIR_REPLACEMENT.
590 # value returned in "$func_dirname_result"
591 # basename: Compute filename of FILE.
592 # value retuned in "$func_basename_result"
593 # Implementation must be kept synchronized with func_dirname
594 # and func_basename. For efficiency, we do not delegate to
595 # those functions but instead duplicate the functionality here.
596 func_dirname_and_basename ()
598 # Extract subdirectory from the argument.
599 func_dirname_result=`$ECHO "${1}" | $SED -e "$dirname"`
600 if test "X$func_dirname_result" = "X${1}"; then
601 func_dirname_result="${3}"
603 func_dirname_result="$func_dirname_result${2}"
605 func_basename_result=`$ECHO "${1}" | $SED -e "$basename"`
608 # Generated shell functions inserted here.
610 # func_dirname file append nondir_replacement
611 # Compute the dirname of FILE. If nonempty, add APPEND to the result,
612 # otherwise set result to NONDIR_REPLACEMENT.
616 */*) func_dirname_result="${1%/*}${2}" ;;
617 * ) func_dirname_result="${3}" ;;
624 func_basename_result="${1##*/}"
627 # func_dirname_and_basename file append nondir_replacement
628 # perform func_basename and func_dirname in a single function
630 # dirname: Compute the dirname of FILE. If nonempty,
631 # add APPEND to the result, otherwise set result
632 # to NONDIR_REPLACEMENT.
633 # value returned in "$func_dirname_result"
634 # basename: Compute filename of FILE.
635 # value retuned in "$func_basename_result"
636 # Implementation must be kept synchronized with func_dirname
637 # and func_basename. For efficiency, we do not delegate to
638 # those functions but instead duplicate the functionality here.
639 func_dirname_and_basename ()
642 */*) func_dirname_result="${1%/*}${2}" ;;
643 * ) func_dirname_result="${3}" ;;
645 func_basename_result="${1##*/}"
648 # func_stripname prefix suffix name
649 # strip PREFIX and SUFFIX off of NAME.
650 # PREFIX and SUFFIX must not contain globbing or regex special
651 # characters, hashes, percent signs, but SUFFIX may contain a leading
652 # dot (in which case that matches only a dot).
655 # pdksh 5.2.14 does not do ${X%$Y} correctly if both X and Y are
656 # positional parameters, so assign one to ordinary parameter first.
657 func_stripname_result=${3}
658 func_stripname_result=${func_stripname_result#"${1}"}
659 func_stripname_result=${func_stripname_result%"${2}"}
665 func_opt_split_opt=${1%%=*}
666 func_opt_split_arg=${1#*=}
673 *.lo) func_lo2o_result=${1%.lo}.${objext} ;;
674 *) func_lo2o_result=${1} ;;
678 # func_xform libobj-or-source
681 func_xform_result=${1%.*}.lo
684 # func_arith arithmetic-term...
687 func_arith_result=$(( $* ))
691 # STRING may not start with a hyphen.
694 func_len_result=${#1}
698 # func_append var value
699 # Append VALUE to the end of shell variable VAR.
704 # Generated shell functions inserted here.
706 # These SED scripts presuppose an absolute path with a trailing slash.
707 pathcar='s,^/\([^/]*\).*$,\1,'
708 pathcdr='s,^/[^/]*,,'
709 removedotparts=':dotsl
713 collapseslashes='s@/\{1,\}@/@g'
714 finalslash='s,/*$,/,'
716 # func_normal_abspath PATH
717 # Remove doubled-up and trailing slashes, "." path components,
718 # and cancel out any ".." path components in PATH after making
719 # it an absolute path.
720 # value returned in "$func_normal_abspath_result"
721 func_normal_abspath ()
723 # Start from root dir and reassemble the path.
724 func_normal_abspath_result=
725 func_normal_abspath_tpath=$1
726 func_normal_abspath_altnamespace=
727 case $func_normal_abspath_tpath in
729 # Empty path, that just means $cwd.
730 func_stripname '' '/' "`pwd`"
731 func_normal_abspath_result=$func_stripname_result
734 # The next three entries are used to spot a run of precisely
735 # two leading slashes without using negated character classes;
736 # we take advantage of case's first-match behaviour.
738 # Unusual form of absolute path, do nothing.
741 # Not necessarily an ordinary path; POSIX reserves leading '//'
742 # and for example Cygwin uses it to access remote file shares
743 # over CIFS/SMB, so we conserve a leading double slash if found.
744 func_normal_abspath_altnamespace=/
747 # Absolute path, do nothing.
750 # Relative path, prepend $cwd.
751 func_normal_abspath_tpath=`pwd`/$func_normal_abspath_tpath
754 # Cancel out all the simple stuff to save iterations. We also want
755 # the path to end with a slash for ease of parsing, so make sure
756 # there is one (and only one) here.
757 func_normal_abspath_tpath=`$ECHO "$func_normal_abspath_tpath" | $SED \
758 -e "$removedotparts" -e "$collapseslashes" -e "$finalslash"`
760 # Processed it all yet?
761 if test "$func_normal_abspath_tpath" = / ; then
762 # If we ascended to the root using ".." the result may be empty now.
763 if test -z "$func_normal_abspath_result" ; then
764 func_normal_abspath_result=/
768 func_normal_abspath_tcomponent=`$ECHO "$func_normal_abspath_tpath" | $SED \
770 func_normal_abspath_tpath=`$ECHO "$func_normal_abspath_tpath" | $SED \
772 # Figure out what to do with it
773 case $func_normal_abspath_tcomponent in
775 # Trailing empty path component, ignore it.
778 # Parent dir; strip last assembled component from result.
779 func_dirname "$func_normal_abspath_result"
780 func_normal_abspath_result=$func_dirname_result
783 # Actual path component, append it.
784 func_normal_abspath_result=$func_normal_abspath_result/$func_normal_abspath_tcomponent
788 # Restore leading double-slash if one was found on entry.
789 func_normal_abspath_result=$func_normal_abspath_altnamespace$func_normal_abspath_result
792 # func_relative_path SRCDIR DSTDIR
793 # generates a relative path from SRCDIR to DSTDIR, with a trailing
794 # slash if non-empty, suitable for immediately appending a filename
795 # without needing to append a separator.
796 # value returned in "$func_relative_path_result"
797 func_relative_path ()
799 func_relative_path_result=
800 func_normal_abspath "$1"
801 func_relative_path_tlibdir=$func_normal_abspath_result
802 func_normal_abspath "$2"
803 func_relative_path_tbindir=$func_normal_abspath_result
805 # Ascend the tree starting from libdir
807 # check if we have found a prefix of bindir
808 case $func_relative_path_tbindir in
809 $func_relative_path_tlibdir)
810 # found an exact match
811 func_relative_path_tcancelled=
814 $func_relative_path_tlibdir*)
815 # found a matching prefix
816 func_stripname "$func_relative_path_tlibdir" '' "$func_relative_path_tbindir"
817 func_relative_path_tcancelled=$func_stripname_result
818 if test -z "$func_relative_path_result"; then
819 func_relative_path_result=.
824 func_dirname $func_relative_path_tlibdir
825 func_relative_path_tlibdir=${func_dirname_result}
826 if test "x$func_relative_path_tlibdir" = x ; then
827 # Have to descend all the way to the root!
828 func_relative_path_result=../$func_relative_path_result
829 func_relative_path_tcancelled=$func_relative_path_tbindir
832 func_relative_path_result=../$func_relative_path_result
837 # Now calculate path; take care to avoid doubling-up slashes.
838 func_stripname '' '/' "$func_relative_path_result"
839 func_relative_path_result=$func_stripname_result
840 func_stripname '/' '/' "$func_relative_path_tcancelled"
841 if test "x$func_stripname_result" != x ; then
842 func_relative_path_result=${func_relative_path_result}/${func_stripname_result}
845 # Normalisation. If bindir is libdir, return empty string,
846 # else relative path ending with a slash; either way, target
847 # file name can be directly appended.
848 if test ! -z "$func_relative_path_result"; then
849 func_stripname './' '' "$func_relative_path_result/"
850 func_relative_path_result=$func_stripname_result
854 # The name of this program:
855 func_dirname_and_basename "$progpath"
856 progname=$func_basename_result
858 # Make sure we have an absolute path for reexecution:
860 [\\/]*|[A-Za-z]:\\*) ;;
862 progdir=$func_dirname_result
863 progdir=`cd "$progdir" && pwd`
864 progpath="$progdir/$progname"
869 for progdir in $PATH; do
871 test -x "$progdir/$progname" && break
874 test -n "$progdir" || progdir=`pwd`
875 progpath="$progdir/$progname"
879 # Sed substitution that helps us do robust quoting. It backslashifies
880 # metacharacters that are still active within double-quoted strings.
881 Xsed="${SED}"' -e 1s/^X//'
882 sed_quote_subst='s/\([`"$\\]\)/\\\1/g'
884 # Same as above, but do not quote variable references.
885 double_quote_subst='s/\(["`\\]\)/\\\1/g'
887 # Re-`\' parameter expansions in output of double_quote_subst that were
888 # `\'-ed in input to the same. If an odd number of `\' preceded a '$'
889 # in input to double_quote_subst, that '$' was protected from expansion.
890 # Since each input `\' is now two `\'s, look for any number of runs of
891 # four `\'s followed by two `\'s and then a '$'. `\' that '$'.
896 sed_double_backslash="\
900 s/\\([^$bs]\\)$bs2$dollar/\\1$bs2$bs$dollar/g
911 # Echo program name prefixed message, along with the current mode
912 # name if it has been set yet.
915 $ECHO "$progname${mode+: }$mode: $*"
918 # func_verbose arg...
919 # Echo program name prefixed message in verbose mode only.
922 $opt_verbose && func_echo ${1+"$@"}
924 # A bug in bash halts the script if the last line of a function
925 # fails when set -e is in force, so we need another command to
930 # func_echo_all arg...
931 # Invoke $ECHO with all args, space-separated.
938 # Echo program name prefixed message to standard error.
941 $ECHO "$progname${mode+: }$mode: "${1+"$@"} 1>&2
944 # func_warning arg...
945 # Echo program name prefixed warning message to standard error.
948 $opt_warning && $ECHO "$progname${mode+: }$mode: warning: "${1+"$@"} 1>&2
954 # func_fatal_error arg...
955 # Echo program name prefixed message to standard error, and exit.
962 # func_fatal_help arg...
963 # Echo program name prefixed message to standard error, followed by
964 # a help hint, and exit.
968 func_fatal_error "$help"
970 help="Try \`$progname --help' for more information." ## default
973 # func_grep expression filename
974 # Check whether EXPRESSION matches any line of FILENAME, without output.
977 $GREP "$1" "$2" >/dev/null 2>&1
981 # func_mkdir_p directory-path
982 # Make sure the entire path to DIRECTORY-PATH is available.
985 my_directory_path="$1"
988 if test -n "$my_directory_path" && test "$opt_dry_run" != ":"; then
990 # Protect directory names starting with `-'
991 case $my_directory_path in
992 -*) my_directory_path="./$my_directory_path" ;;
995 # While some portion of DIR does not yet exist...
996 while test ! -d "$my_directory_path"; do
997 # ...make a list in topmost first order. Use a colon delimited
998 # list incase some portion of path contains whitespace.
999 my_dir_list="$my_directory_path:$my_dir_list"
1001 # If the last portion added has no slash in it, the list is done
1002 case $my_directory_path in */*) ;; *) break ;; esac
1004 # ...otherwise throw away the child directory and loop
1005 my_directory_path=`$ECHO "$my_directory_path" | $SED -e "$dirname"`
1007 my_dir_list=`$ECHO "$my_dir_list" | $SED 's,:*$,,'`
1009 save_mkdir_p_IFS="$IFS"; IFS=':'
1010 for my_dir in $my_dir_list; do
1011 IFS="$save_mkdir_p_IFS"
1012 # mkdir can fail with a `File exist' error if two processes
1013 # try to create one of the directories concurrently. Don't
1014 # stop in that case!
1015 $MKDIR "$my_dir" 2>/dev/null || :
1017 IFS="$save_mkdir_p_IFS"
1019 # Bail out if we (or some other process) failed to create a directory.
1020 test -d "$my_directory_path" || \
1021 func_fatal_error "Failed to create \`$1'"
1026 # func_mktempdir [string]
1027 # Make a temporary directory that won't clash with other running
1028 # libtool processes, and avoids race conditions if possible. If
1029 # given, STRING is the basename for that directory.
1032 my_template="${TMPDIR-/tmp}/${1-$progname}"
1034 if test "$opt_dry_run" = ":"; then
1035 # Return a directory name, but don't create it in dry-run mode
1036 my_tmpdir="${my_template}-$$"
1039 # If mktemp works, use that first and foremost
1040 my_tmpdir=`mktemp -d "${my_template}-XXXXXXXX" 2>/dev/null`
1042 if test ! -d "$my_tmpdir"; then
1043 # Failing that, at least try and use $RANDOM to avoid a race
1044 my_tmpdir="${my_template}-${RANDOM-0}$$"
1046 save_mktempdir_umask=`umask`
1049 umask $save_mktempdir_umask
1052 # If we're not in dry-run mode, bomb out on failure
1053 test -d "$my_tmpdir" || \
1054 func_fatal_error "cannot create temporary directory \`$my_tmpdir'"
1061 # func_quote_for_eval arg
1062 # Aesthetically quote ARG to be evaled later.
1063 # This function returns two values: FUNC_QUOTE_FOR_EVAL_RESULT
1064 # is double-quoted, suitable for a subsequent eval, whereas
1065 # FUNC_QUOTE_FOR_EVAL_UNQUOTED_RESULT has merely all characters
1066 # which are still active within double quotes backslashified.
1067 func_quote_for_eval ()
1071 func_quote_for_eval_unquoted_result=`$ECHO "$1" | $SED "$sed_quote_subst"` ;;
1073 func_quote_for_eval_unquoted_result="$1" ;;
1076 case $func_quote_for_eval_unquoted_result in
1077 # Double-quote args containing shell metacharacters to delay
1078 # word splitting, command substitution and and variable
1079 # expansion for a subsequent eval.
1080 # Many Bourne shells cannot handle close brackets correctly
1081 # in scan sets, so we specify it separately.
1082 *[\[\~\#\^\&\*\(\)\{\}\|\;\<\>\?\'\ \ ]*|*]*|"")
1083 func_quote_for_eval_result="\"$func_quote_for_eval_unquoted_result\""
1086 func_quote_for_eval_result="$func_quote_for_eval_unquoted_result"
1091 # func_quote_for_expand arg
1092 # Aesthetically quote ARG to be evaled later; same as above,
1093 # but do not quote variable references.
1094 func_quote_for_expand ()
1098 my_arg=`$ECHO "$1" | $SED \
1099 -e "$double_quote_subst" -e "$sed_double_backslash"` ;;
1105 # Double-quote args containing shell metacharacters to delay
1106 # word splitting and command substitution for a subsequent eval.
1107 # Many Bourne shells cannot handle close brackets correctly
1108 # in scan sets, so we specify it separately.
1109 *[\[\~\#\^\&\*\(\)\{\}\|\;\<\>\?\'\ \ ]*|*]*|"")
1110 my_arg="\"$my_arg\""
1114 func_quote_for_expand_result="$my_arg"
1118 # func_show_eval cmd [fail_exp]
1119 # Unless opt_silent is true, then output CMD. Then, if opt_dryrun is
1120 # not true, evaluate CMD. If the evaluation of CMD fails, and FAIL_EXP
1121 # is given, then evaluate it.
1125 my_fail_exp="${2-:}"
1127 ${opt_silent-false} || {
1128 func_quote_for_expand "$my_cmd"
1129 eval "func_echo $func_quote_for_expand_result"
1132 if ${opt_dry_run-false}; then :; else
1135 if test "$my_status" -eq 0; then :; else
1136 eval "(exit $my_status); $my_fail_exp"
1142 # func_show_eval_locale cmd [fail_exp]
1143 # Unless opt_silent is true, then output CMD. Then, if opt_dryrun is
1144 # not true, evaluate CMD. If the evaluation of CMD fails, and FAIL_EXP
1145 # is given, then evaluate it. Use the saved locale for evaluation.
1146 func_show_eval_locale ()
1149 my_fail_exp="${2-:}"
1151 ${opt_silent-false} || {
1152 func_quote_for_expand "$my_cmd"
1153 eval "func_echo $func_quote_for_expand_result"
1156 if ${opt_dry_run-false}; then :; else
1157 eval "$lt_user_locale
1160 eval "$lt_safe_locale"
1161 if test "$my_status" -eq 0; then :; else
1162 eval "(exit $my_status); $my_fail_exp"
1169 # Echo version message to standard output and exit.
1180 /^# '$PROGRAM' (GNU /,/# warranty; / {
1183 s/\((C)\)[ 0-9,-]*\( [1-9][0-9]*\)/\1\2/
1190 # Echo short help message to standard output and exit.
1193 $SED -n '/^# Usage:/,/^# *.*--help/ {
1196 s/\$progname/'$progname'/
1200 $ECHO "run \`$progname --help | more' for full usage"
1204 # func_help [NOEXIT]
1205 # Echo long help message to standard output and exit,
1206 # unless 'noexit' is passed as argument.
1209 $SED -n '/^# Usage:/,/# Report bugs to/ {
1212 s*\$progname*'$progname'*
1214 s*\$SHELL*'"$SHELL"'*
1216 s*\$LTCFLAGS*'"$LTCFLAGS"'*
1218 s/\$with_gnu_ld/'"$with_gnu_ld"'/
1219 s/\$automake_version/'"`(automake --version) 2>/dev/null |$SED 1q`"'/
1220 s/\$autoconf_version/'"`(autoconf --version) 2>/dev/null |$SED 1q`"'/
1224 if test -z "$1"; then
1229 # func_missing_arg argname
1230 # Echo program name prefixed message to standard error and set global
1234 func_error "missing argument for $1."
1245 magic="%%%MAGIC variable%%%"
1246 magic_exe="%%%MAGIC EXE variable%%%"
1253 lo2o="s/\\.lo\$/.${objext}/"
1254 o2lo="s/\\.${objext}\$/.lo/"
1259 opt_duplicate_deps=false
1263 # If this variable is set in any of the actions, the command in it
1264 # will be execed at the end. This prevents here-documents from being
1265 # left over by shells.
1268 # func_fatal_configuration arg...
1269 # Echo program name prefixed message to standard error, followed by
1270 # a configuration failure hint, and exit.
1271 func_fatal_configuration ()
1273 func_error ${1+"$@"}
1274 func_error "See the $PACKAGE documentation for more information."
1275 func_fatal_error "Fatal configuration error."
1280 # Display the configuration for all the tags in this script.
1283 re_begincf='^# ### BEGIN LIBTOOL'
1284 re_endcf='^# ### END LIBTOOL'
1286 # Default configuration.
1287 $SED "1,/$re_begincf CONFIG/d;/$re_endcf CONFIG/,\$d" < "$progpath"
1289 # Now print the configurations for the tags.
1290 for tagname in $taglist; do
1291 $SED -n "/$re_begincf TAG CONFIG: $tagname\$/,/$re_endcf TAG CONFIG: $tagname\$/p" < "$progpath"
1298 # Display the features supported by this script.
1302 if test "$build_libtool_libs" = yes; then
1303 echo "enable shared libraries"
1305 echo "disable shared libraries"
1307 if test "$build_old_libs" = yes; then
1308 echo "enable static libraries"
1310 echo "disable static libraries"
1316 # func_enable_tag tagname
1317 # Verify that TAGNAME is valid, and either flag an error and exit, or
1318 # enable the TAGNAME tag. We also add TAGNAME to the global $taglist
1325 re_begincf="^# ### BEGIN LIBTOOL TAG CONFIG: $tagname\$"
1326 re_endcf="^# ### END LIBTOOL TAG CONFIG: $tagname\$"
1327 sed_extractcf="/$re_begincf/,/$re_endcf/p"
1332 func_fatal_error "invalid tag name: $tagname"
1336 # Don't test for the "default" C tag, as we know it's
1337 # there but not specially marked.
1341 if $GREP "$re_begincf" "$progpath" >/dev/null 2>&1; then
1342 taglist="$taglist $tagname"
1344 # Evaluate the configuration. Be careful to quote the path
1345 # and the sed script, to avoid splitting on whitespace, but
1346 # also don't use non-portable quotes within backquotes within
1347 # quotes we have to do it in 2 steps:
1348 extractedcf=`$SED -n -e "$sed_extractcf" < "$progpath"`
1351 func_error "ignoring unknown tag $tagname"
1357 # Parse options once, thoroughly. This comes as soon as possible in
1358 # the script to make things like `libtool --version' happen quickly.
1361 # Shorthand for --mode=foo, only valid as the first argument
1364 shift; set dummy --mode clean ${1+"$@"}; shift
1366 compile|compil|compi|comp|com|co|c)
1367 shift; set dummy --mode compile ${1+"$@"}; shift
1369 execute|execut|execu|exec|exe|ex|e)
1370 shift; set dummy --mode execute ${1+"$@"}; shift
1372 finish|finis|fini|fin|fi|f)
1373 shift; set dummy --mode finish ${1+"$@"}; shift
1375 install|instal|insta|inst|ins|in|i)
1376 shift; set dummy --mode install ${1+"$@"}; shift
1379 shift; set dummy --mode link ${1+"$@"}; shift
1381 uninstall|uninstal|uninsta|uninst|unins|unin|uni|un|u)
1382 shift; set dummy --mode uninstall ${1+"$@"}; shift
1386 # Parse non-mode specific arguments:
1387 while test "$#" -gt 0; do
1392 --config) func_config ;;
1394 --debug) preserve_args="$preserve_args $opt"
1395 func_echo "enabling shell trace mode"
1400 -dlopen) test "$#" -eq 0 && func_missing_arg "$opt" && break
1401 execute_dlfiles="$execute_dlfiles $1"
1405 --dry-run | -n) opt_dry_run=: ;;
1406 --features) func_features ;;
1407 --finish) mode="finish" ;;
1409 --mode) test "$#" -eq 0 && func_missing_arg "$opt" && break
1411 # Valid mode arguments:
1421 # Catch anything else as an error
1422 *) func_error "invalid argument for $opt"
1432 --preserve-dup-deps)
1433 opt_duplicate_deps=: ;;
1435 --quiet|--silent) preserve_args="$preserve_args $opt"
1440 --no-quiet|--no-silent)
1441 preserve_args="$preserve_args $opt"
1445 --verbose| -v) preserve_args="$preserve_args $opt"
1450 --no-verbose) preserve_args="$preserve_args $opt"
1454 --tag) test "$#" -eq 0 && func_missing_arg "$opt" && break
1455 preserve_args="$preserve_args $opt $1"
1456 func_enable_tag "$1" # tagname is set here
1460 # Separate optargs to long options:
1461 -dlopen=*|--mode=*|--tag=*)
1462 func_opt_split "$opt"
1463 set dummy "$func_opt_split_opt" "$func_opt_split_arg" ${1+"$@"}
1467 -\?|-h) func_usage ;;
1468 --help) opt_help=: ;;
1469 --help-all) opt_help=': help-all' ;;
1470 --version) func_version ;;
1472 -*) func_fatal_help "unrecognized option \`$opt'" ;;
1482 *cygwin* | *mingw* | *pw32* | *cegcc*)
1483 # don't eliminate duplications in $postdeps and $predeps
1484 opt_duplicate_compiler_generated_deps=:
1487 opt_duplicate_compiler_generated_deps=$opt_duplicate_deps
1491 # Having warned about all mis-specified options, bail out if
1492 # anything was wrong.
1493 $exit_cmd $EXIT_FAILURE
1496 # func_check_version_match
1497 # Ensure that we are using m4 macros, and libtool script from the same
1498 # release of libtool.
1499 func_check_version_match ()
1501 if test "$package_revision" != "$macro_revision"; then
1502 if test "$VERSION" != "$macro_version"; then
1503 if test -z "$macro_version"; then
1505 $progname: Version mismatch error. This is $PACKAGE $VERSION, but the
1506 $progname: definition of this LT_INIT comes from an older release.
1507 $progname: You should recreate aclocal.m4 with macros from $PACKAGE $VERSION
1508 $progname: and run autoconf again.
1512 $progname: Version mismatch error. This is $PACKAGE $VERSION, but the
1513 $progname: definition of this LT_INIT comes from $PACKAGE $macro_version.
1514 $progname: You should recreate aclocal.m4 with macros from $PACKAGE $VERSION
1515 $progname: and run autoconf again.
1520 $progname: Version mismatch error. This is $PACKAGE $VERSION, revision $package_revision,
1521 $progname: but the definition of this LT_INIT comes from revision $macro_revision.
1522 $progname: You should recreate aclocal.m4 with macros from revision $package_revision
1523 $progname: of $PACKAGE $VERSION and run autoconf again.
1537 # Sanity checks first:
1538 func_check_version_match
1540 if test "$build_libtool_libs" != yes && test "$build_old_libs" != yes; then
1541 func_fatal_configuration "not configured to build any kind of library"
1544 test -z "$mode" && func_fatal_error "error: you must specify a MODE."
1548 eval std_shrext=\"$shrext_cmds\"
1551 # Only execute mode is allowed to have -dlopen flags.
1552 if test -n "$execute_dlfiles" && test "$mode" != execute; then
1553 func_error "unrecognized option \`-dlopen'"
1558 # Change the help message to a mode-specific one.
1559 generic_help="$help"
1560 help="Try \`$progname --help --mode=$mode' for more information."
1565 # True iff FILE is a libtool `.la' library or `.lo' object file.
1566 # This function is only a basic sanity check; it will hardly flush out
1567 # determined imposters.
1571 $SED -e 4q "$1" 2>/dev/null \
1572 | $GREP "^# Generated by .*$PACKAGE" > /dev/null 2>&1
1575 # func_lalib_unsafe_p file
1576 # True iff FILE is a libtool `.la' library or `.lo' object file.
1577 # This function implements the same check as func_lalib_p without
1578 # resorting to external programs. To this end, it redirects stdin and
1579 # closes it afterwards, without saving the original file descriptor.
1580 # As a safety measure, use it only where a negative result would be
1581 # fatal anyway. Works if `file' does not exist.
1582 func_lalib_unsafe_p ()
1585 if test -f "$1" && test -r "$1" && exec 5<&0 <"$1"; then
1586 for lalib_p_l in 1 2 3 4
1589 case "$lalib_p_line" in
1590 \#\ Generated\ by\ *$PACKAGE* ) lalib_p=yes; break;;
1595 test "$lalib_p" = yes
1598 # func_ltwrapper_script_p file
1599 # True iff FILE is a libtool wrapper script
1600 # This function is only a basic sanity check; it will hardly flush out
1601 # determined imposters.
1602 func_ltwrapper_script_p ()
1607 # func_ltwrapper_executable_p file
1608 # True iff FILE is a libtool wrapper executable
1609 # This function is only a basic sanity check; it will hardly flush out
1610 # determined imposters.
1611 func_ltwrapper_executable_p ()
1613 func_ltwrapper_exec_suffix=
1616 *) func_ltwrapper_exec_suffix=.exe ;;
1618 $GREP "$magic_exe" "$1$func_ltwrapper_exec_suffix" >/dev/null 2>&1
1621 # func_ltwrapper_scriptname file
1622 # Assumes file is an ltwrapper_executable
1623 # uses $file to determine the appropriate filename for a
1624 # temporary ltwrapper_script.
1625 func_ltwrapper_scriptname ()
1627 func_ltwrapper_scriptname_result=""
1628 if func_ltwrapper_executable_p "$1"; then
1629 func_dirname_and_basename "$1" "" "."
1630 func_stripname '' '.exe' "$func_basename_result"
1631 func_ltwrapper_scriptname_result="$func_dirname_result/$objdir/${func_stripname_result}_ltshwrapper"
1635 # func_ltwrapper_p file
1636 # True iff FILE is a libtool wrapper script or wrapper executable
1637 # This function is only a basic sanity check; it will hardly flush out
1638 # determined imposters.
1641 func_ltwrapper_script_p "$1" || func_ltwrapper_executable_p "$1"
1645 # func_execute_cmds commands fail_cmd
1646 # Execute tilde-delimited COMMANDS.
1647 # If FAIL_CMD is given, eval that upon failure.
1648 # FAIL_CMD may read-access the current command in variable CMD!
1649 func_execute_cmds ()
1652 save_ifs=$IFS; IFS='~'
1656 func_show_eval "$cmd" "${2-:}"
1663 # Source FILE, adding directory component if necessary.
1664 # Note that it is not necessary on cygwin/mingw to append a dot to
1665 # FILE even if both FILE and FILE.exe exist: automatic-append-.exe
1666 # behavior happens only for exec(3), not for open(2)! Also, sourcing
1667 # `FILE.' does not work on cygwin managed mounts.
1672 */* | *\\*) . "$1" ;;
1678 # func_infer_tag arg
1679 # Infer tagged configuration to use if any are available and
1680 # if one wasn't chosen via the "--tag" command line option.
1681 # Only attempt this if the compiler in the base compile
1682 # command doesn't match the default compiler.
1683 # arg is usually of the form 'gcc ...'
1687 if test -n "$available_tags" && test -z "$tagname"; then
1690 func_quote_for_eval "$arg"
1691 CC_quoted="$CC_quoted $func_quote_for_eval_result"
1693 CC_expanded=`func_echo_all $CC`
1694 CC_quoted_expanded=`func_echo_all $CC_quoted`
1696 # Blanks in the command may have been stripped by the calling shell,
1697 # but not from the CC environment variable when configure was run.
1698 " $CC "* | "$CC "* | " $CC_expanded "* | "$CC_expanded "* | \
1699 " $CC_quoted"* | "$CC_quoted "* | " $CC_quoted_expanded "* | "$CC_quoted_expanded "*) ;;
1700 # Blanks at the start of $base_compile will cause this to fail
1701 # if we don't check for them as well.
1703 for z in $available_tags; do
1704 if $GREP "^# ### BEGIN LIBTOOL TAG CONFIG: $z$" < "$progpath" > /dev/null; then
1705 # Evaluate the configuration.
1706 eval "`${SED} -n -e '/^# ### BEGIN LIBTOOL TAG CONFIG: '$z'$/,/^# ### END LIBTOOL TAG CONFIG: '$z'$/p' < $progpath`"
1709 # Double-quote args containing other shell metacharacters.
1710 func_quote_for_eval "$arg"
1711 CC_quoted="$CC_quoted $func_quote_for_eval_result"
1713 CC_expanded=`func_echo_all $CC`
1714 CC_quoted_expanded=`func_echo_all $CC_quoted`
1716 " $CC "* | "$CC "* | " $CC_expanded "* | "$CC_expanded "* | \
1717 " $CC_quoted"* | "$CC_quoted "* | " $CC_quoted_expanded "* | "$CC_quoted_expanded "*)
1718 # The compiler in the base compile command matches
1719 # the one in the tagged configuration.
1720 # Assume this is the tagged configuration we want.
1727 # If $tagname still isn't set, then no tagged configuration
1728 # was found and let the user know that the "--tag" command
1729 # line option must be used.
1730 if test -z "$tagname"; then
1731 func_echo "unable to infer tagged configuration"
1732 func_fatal_error "specify a tag with \`--tag'"
1734 # func_verbose "using $tagname tagged configuration"
1743 # func_write_libtool_object output_name pic_name nonpic_name
1744 # Create a libtool object file (analogous to a ".la" file),
1745 # but don't create it if we're doing a dry run.
1746 func_write_libtool_object ()
1749 if test "$build_libtool_libs" = yes; then
1755 if test "$build_old_libs" = yes; then
1756 write_oldobj=\'${3}\'
1762 cat >${write_libobj}T <<EOF
1763 # $write_libobj - a libtool object file
1764 # Generated by $PROGRAM (GNU $PACKAGE$TIMESTAMP) $VERSION
1766 # Please DO NOT delete this file!
1767 # It is necessary for linking the library.
1769 # Name of the PIC object.
1770 pic_object=$write_lobj
1772 # Name of the non-PIC object
1773 non_pic_object=$write_oldobj
1776 $MV "${write_libobj}T" "${write_libobj}"
1780 # func_mode_compile arg...
1781 func_mode_compile ()
1784 # Get the compilation command and the source file.
1786 srcfile="$nonopt" # always keep a non-empty value in "srcfile"
1798 # do not "continue". Instead, add this to base_compile
1810 # Accept any command-line options.
1813 test -n "$libobj" && \
1814 func_fatal_error "you cannot specify \`-o' more than once"
1819 -pie | -fpie | -fPIE)
1820 pie_flag="$pie_flag $arg"
1824 -shared | -static | -prefer-pic | -prefer-non-pic)
1835 arg_mode=arg # the next one goes into the "base_compile" arg list
1836 continue # The current "srcfile" will either be retained or
1837 ;; # replaced later. I would guess that would be a bug.
1840 func_stripname '-Wc,' '' "$arg"
1841 args=$func_stripname_result
1843 save_ifs="$IFS"; IFS=','
1844 for arg in $args; do
1846 func_quote_for_eval "$arg"
1847 lastarg="$lastarg $func_quote_for_eval_result"
1850 func_stripname ' ' '' "$lastarg"
1851 lastarg=$func_stripname_result
1853 # Add the arguments to base_compile.
1854 base_compile="$base_compile $lastarg"
1859 # Accept the current argument as the source file.
1860 # The previous "srcfile" becomes the current argument.
1867 esac # case $arg_mode
1869 # Aesthetically quote the previous argument.
1870 func_quote_for_eval "$lastarg"
1871 base_compile="$base_compile $func_quote_for_eval_result"
1876 func_fatal_error "you must specify an argument for -Xcompile"
1879 func_fatal_error "you must specify a target with \`-o'"
1882 # Get the name of the library object.
1883 test -z "$libobj" && {
1884 func_basename "$srcfile"
1885 libobj="$func_basename_result"
1890 # Recognize several different file suffixes.
1891 # If the user specifies -o file.o, it is replaced with file.lo
1894 *.ada | *.adb | *.ads | *.asm | \
1895 *.c++ | *.cc | *.ii | *.class | *.cpp | *.cxx | \
1896 *.[fF][09]? | *.for | *.java | *.obj | *.sx | *.cu | *.cup)
1897 func_xform "$libobj"
1898 libobj=$func_xform_result
1903 *.lo) func_lo2o "$libobj"; obj=$func_lo2o_result ;;
1905 func_fatal_error "cannot determine name of library object from \`$libobj'"
1909 func_infer_tag $base_compile
1911 for arg in $later; do
1914 test "$build_libtool_libs" != yes && \
1915 func_fatal_configuration "can not build a shared library"
1921 build_libtool_libs=no
1938 func_quote_for_eval "$libobj"
1939 test "X$libobj" != "X$func_quote_for_eval_result" \
1940 && $ECHO "X$libobj" | $GREP '[]~#^*{};<>?"'"'"' &()|`$[]' \
1941 && func_warning "libobj name \`$libobj' may not contain shell special characters."
1942 func_dirname_and_basename "$obj" "/" ""
1943 objname="$func_basename_result"
1944 xdir="$func_dirname_result"
1945 lobj=${xdir}$objdir/$objname
1947 test -z "$base_compile" && \
1948 func_fatal_help "you must specify a compilation command"
1950 # Delete any leftover library objects.
1951 if test "$build_old_libs" = yes; then
1952 removelist="$obj $lobj $libobj ${libobj}T"
1954 removelist="$lobj $libobj ${libobj}T"
1957 # On Cygwin there's no "real" PIC flag so we must build both object types
1959 cygwin* | mingw* | pw32* | os2* | cegcc*)
1963 if test "$pic_mode" = no && test "$deplibs_check_method" != pass_all; then
1964 # non-PIC code in shared libraries is not supported
1968 # Calculate the filename of the output object if compiler does
1969 # not support -o with -c
1970 if test "$compiler_c_o" = no; then
1971 output_obj=`$ECHO "$srcfile" | $SED 's%^.*/%%; s%\.[^.]*$%%'`.${objext}
1972 lockfile="$output_obj.lock"
1979 # Lock this critical section if it is needed
1980 # We use this script file to make the link, it avoids creating a new file
1981 if test "$need_locks" = yes; then
1982 until $opt_dry_run || ln "$progpath" "$lockfile" 2>/dev/null; do
1983 func_echo "Waiting for $lockfile to be removed"
1986 elif test "$need_locks" = warn; then
1987 if test -f "$lockfile"; then
1989 *** ERROR, $lockfile exists and contains:
1990 `cat $lockfile 2>/dev/null`
1992 This indicates that another process is trying to use the same
1993 temporary object file, and libtool could not work around it because
1994 your compiler does not support \`-c' and \`-o' together. If you
1995 repeat this compilation, it may succeed, by chance, but you had better
1996 avoid parallel builds (make -j) in this platform, or get a better
1999 $opt_dry_run || $RM $removelist
2002 removelist="$removelist $output_obj"
2003 $ECHO "$srcfile" > "$lockfile"
2006 $opt_dry_run || $RM $removelist
2007 removelist="$removelist $lockfile"
2008 trap '$opt_dry_run || $RM $removelist; exit $EXIT_FAILURE' 1 2 15
2010 if test -n "$fix_srcfile_path"; then
2011 eval srcfile=\"$fix_srcfile_path\"
2013 func_quote_for_eval "$srcfile"
2014 qsrcfile=$func_quote_for_eval_result
2016 # Only build a PIC object if we are building libtool libraries.
2017 if test "$build_libtool_libs" = yes; then
2018 # Without this assignment, base_compile gets emptied.
2019 fbsd_hideous_sh_bug=$base_compile
2021 if test "$pic_mode" != no; then
2022 command="$base_compile $qsrcfile $pic_flag"
2024 # Don't build PIC code
2025 command="$base_compile $qsrcfile"
2028 func_mkdir_p "$xdir$objdir"
2030 if test -z "$output_obj"; then
2031 # Place PIC objects in $objdir
2032 command="$command -o $lobj"
2035 func_show_eval_locale "$command" \
2036 'test -n "$output_obj" && $RM $removelist; exit $EXIT_FAILURE'
2038 if test "$need_locks" = warn &&
2039 test "X`cat $lockfile 2>/dev/null`" != "X$srcfile"; then
2041 *** ERROR, $lockfile contains:
2042 `cat $lockfile 2>/dev/null`
2044 but it should contain:
2047 This indicates that another process is trying to use the same
2048 temporary object file, and libtool could not work around it because
2049 your compiler does not support \`-c' and \`-o' together. If you
2050 repeat this compilation, it may succeed, by chance, but you had better
2051 avoid parallel builds (make -j) in this platform, or get a better
2054 $opt_dry_run || $RM $removelist
2058 # Just move the object if needed, then go on to compile the next one
2059 if test -n "$output_obj" && test "X$output_obj" != "X$lobj"; then
2060 func_show_eval '$MV "$output_obj" "$lobj"' \
2061 'error=$?; $opt_dry_run || $RM $removelist; exit $error'
2064 # Allow error messages only from the first compilation.
2065 if test "$suppress_opt" = yes; then
2066 suppress_output=' >/dev/null 2>&1'
2070 # Only build a position-dependent object if we build old libraries.
2071 if test "$build_old_libs" = yes; then
2072 if test "$pic_mode" != yes; then
2073 # Don't build PIC code
2074 command="$base_compile $qsrcfile$pie_flag"
2076 command="$base_compile $qsrcfile $pic_flag"
2078 if test "$compiler_c_o" = yes; then
2079 command="$command -o $obj"
2082 # Suppress compiler output if we already did a PIC compilation.
2083 command="$command$suppress_output"
2084 func_show_eval_locale "$command" \
2085 '$opt_dry_run || $RM $removelist; exit $EXIT_FAILURE'
2087 if test "$need_locks" = warn &&
2088 test "X`cat $lockfile 2>/dev/null`" != "X$srcfile"; then
2090 *** ERROR, $lockfile contains:
2091 `cat $lockfile 2>/dev/null`
2093 but it should contain:
2096 This indicates that another process is trying to use the same
2097 temporary object file, and libtool could not work around it because
2098 your compiler does not support \`-c' and \`-o' together. If you
2099 repeat this compilation, it may succeed, by chance, but you had better
2100 avoid parallel builds (make -j) in this platform, or get a better
2103 $opt_dry_run || $RM $removelist
2107 # Just move the object if needed
2108 if test -n "$output_obj" && test "X$output_obj" != "X$obj"; then
2109 func_show_eval '$MV "$output_obj" "$obj"' \
2110 'error=$?; $opt_dry_run || $RM $removelist; exit $error'
2115 func_write_libtool_object "$libobj" "$objdir/$objname" "$objname"
2117 # Unlock the critical section if it was locked
2118 if test "$need_locks" != no; then
2119 removelist=$lockfile
2128 test "$mode" = compile && func_mode_compile ${1+"$@"}
2133 # We need to display help for each of the modes.
2136 # Generic help is extracted from the usage comments
2137 # at the start of this file.
2143 "Usage: $progname [OPTION]... --mode=clean RM [RM-OPTION]... FILE...
2145 Remove files from the build directory.
2147 RM is the name of the program to use to delete files associated with each FILE
2148 (typically \`/bin/rm'). RM-OPTIONS are options (such as \`-f') to be passed
2151 If FILE is a libtool library, object or program, all the files associated
2152 with it are deleted. Otherwise, only FILE itself is deleted using RM."
2157 "Usage: $progname [OPTION]... --mode=compile COMPILE-COMMAND... SOURCEFILE
2159 Compile a source file into a libtool library object.
2161 This mode accepts the following additional options:
2163 -o OUTPUT-FILE set the output file name to OUTPUT-FILE
2164 -no-suppress do not suppress compiler output for multiple passes
2165 -prefer-pic try to build PIC objects only
2166 -prefer-non-pic try to build non-PIC objects only
2167 -shared do not build a \`.o' file suitable for static linking
2168 -static only build a \`.o' file suitable for static linking
2169 -Wc,FLAG pass FLAG directly to the compiler
2171 COMPILE-COMMAND is a command to be used in creating a \`standard' object file
2172 from the given SOURCEFILE.
2174 The output file name is determined by removing the directory component from
2175 SOURCEFILE, then substituting the C source code suffix \`.c' with the
2176 library object suffix, \`.lo'."
2181 "Usage: $progname [OPTION]... --mode=execute COMMAND [ARGS]...
2183 Automatically set library path, then run a program.
2185 This mode accepts the following additional options:
2187 -dlopen FILE add the directory containing FILE to the library path
2189 This mode sets the library path environment variable according to \`-dlopen'
2192 If any of the ARGS are libtool executable wrappers, then they are translated
2193 into their corresponding uninstalled binary, and any of their required library
2194 directories are added to the library path.
2196 Then, COMMAND is executed, with ARGS as arguments."
2201 "Usage: $progname [OPTION]... --mode=finish [LIBDIR]...
2203 Complete the installation of libtool libraries.
2205 Each LIBDIR is a directory that contains libtool libraries.
2207 The commands that this mode executes may require superuser privileges. Use
2208 the \`--dry-run' option if you just want to see what would be executed."
2213 "Usage: $progname [OPTION]... --mode=install INSTALL-COMMAND...
2215 Install executables or libraries.
2217 INSTALL-COMMAND is the installation command. The first component should be
2218 either the \`install' or \`cp' program.
2220 The following components of INSTALL-COMMAND are treated specially:
2222 -inst-prefix-dir PREFIX-DIR Use PREFIX-DIR as a staging area for installation
2224 The rest of the components are interpreted as arguments to that command (only
2225 BSD-compatible install options are recognized)."
2230 "Usage: $progname [OPTION]... --mode=link LINK-COMMAND...
2232 Link object files or libraries together to form another library, or to
2233 create an executable program.
2235 LINK-COMMAND is a command using the C compiler that you would use to create
2236 a program from several object files.
2238 The following components of LINK-COMMAND are treated specially:
2240 -all-static do not do any dynamic linking at all
2241 -avoid-version do not add a version suffix if possible
2242 -bindir BINDIR specify path to binaries directory (for systems where
2243 libraries must be found in the PATH setting at runtime)
2244 -dlopen FILE \`-dlpreopen' FILE if it cannot be dlopened at runtime
2245 -dlpreopen FILE link in FILE and add its symbols to lt_preloaded_symbols
2246 -export-dynamic allow symbols from OUTPUT-FILE to be resolved with dlsym(3)
2247 -export-symbols SYMFILE
2248 try to export only the symbols listed in SYMFILE
2249 -export-symbols-regex REGEX
2250 try to export only the symbols matching REGEX
2251 -LLIBDIR search LIBDIR for required installed libraries
2252 -lNAME OUTPUT-FILE requires the installed library libNAME
2253 -module build a library that can dlopened
2254 -no-fast-install disable the fast-install mode
2255 -no-install link a not-installable executable
2256 -no-undefined declare that a library does not refer to external symbols
2257 -o OUTPUT-FILE create OUTPUT-FILE from the specified objects
2258 -objectlist FILE Use a list of object files found in FILE to specify objects
2259 -precious-files-regex REGEX
2260 don't remove output files matching REGEX
2261 -release RELEASE specify package release information
2262 -rpath LIBDIR the created library will eventually be installed in LIBDIR
2263 -R[ ]LIBDIR add LIBDIR to the runtime path of programs and libraries
2264 -shared only do dynamic linking of libtool libraries
2265 -shrext SUFFIX override the standard shared library file extension
2266 -static do not do any dynamic linking of uninstalled libtool libraries
2267 -static-libtool-libs
2268 do not do any dynamic linking of libtool libraries
2269 -version-info CURRENT[:REVISION[:AGE]]
2270 specify library version info [each variable defaults to 0]
2271 -weak LIBNAME declare that the target provides the LIBNAME interface
2273 -Xcompiler FLAG pass linker-specific FLAG directly to the compiler
2275 -Xlinker FLAG pass linker-specific FLAG directly to the linker
2276 -XCClinker FLAG pass link-specific FLAG to the compiler driver (CC)
2278 All other options (arguments beginning with \`-') are ignored.
2280 Every other argument is treated as a filename. Files ending in \`.la' are
2281 treated as uninstalled libtool libraries, other files are standard or library
2284 If the OUTPUT-FILE ends in \`.la', then a libtool library is created,
2285 only library objects (\`.lo' files) may be specified, and \`-rpath' is
2286 required, except when creating a convenience library.
2288 If OUTPUT-FILE ends in \`.a' or \`.lib', then a standard library is created
2289 using \`ar' and \`ranlib', or on Windows using \`lib'.
2291 If OUTPUT-FILE ends in \`.lo' or \`.${objext}', then a reloadable object file
2292 is created, otherwise an executable program is created."
2297 "Usage: $progname [OPTION]... --mode=uninstall RM [RM-OPTION]... FILE...
2299 Remove libraries from an installation directory.
2301 RM is the name of the program to use to delete files associated with each FILE
2302 (typically \`/bin/rm'). RM-OPTIONS are options (such as \`-f') to be passed
2305 If FILE is a libtool library, all the files associated with it are deleted.
2306 Otherwise, only FILE itself is deleted using RM."
2310 func_fatal_help "invalid operation mode \`$mode'"
2315 $ECHO "Try \`$progname --help' for more information about other modes."
2318 # Now that we've collected a possible --mode arg, show help if necessary
2320 if test "$opt_help" = :; then
2325 for mode in compile link execute install finish uninstall clean; do
2328 } | sed -n '1p; 2,$s/^Usage:/ or: /p'
2331 for mode in compile link execute install finish uninstall clean; do
2337 /^When reporting/,/^Report/{
2342 /information about other modes/d
2343 /more detailed .*MODE/d
2344 s/^Usage:.*--mode=\([^ ]*\) .*/Description of \1 mode:/'
2350 # func_mode_execute arg...
2351 func_mode_execute ()
2354 # The first argument is the command name.
2357 func_fatal_help "you must specify a COMMAND"
2359 # Handle -dlopen flags immediately.
2360 for file in $execute_dlfiles; do
2362 || func_fatal_help "\`$file' is not a file"
2367 # Check to see that this really is a libtool archive.
2368 func_lalib_unsafe_p "$file" \
2369 || func_fatal_help "\`$lib' is not a valid libtool archive"
2371 # Read the libtool library.
2376 # Skip this library if it cannot be dlopened.
2377 if test -z "$dlname"; then
2378 # Warn if it was a shared library.
2379 test -n "$library_names" && \
2380 func_warning "\`$file' was not linked with \`-export-dynamic'"
2384 func_dirname "$file" "" "."
2385 dir="$func_dirname_result"
2387 if test -f "$dir/$objdir/$dlname"; then
2390 if test ! -f "$dir/$dlname"; then
2391 func_fatal_error "cannot find \`$dlname' in \`$dir' or \`$dir/$objdir'"
2397 # Just add the directory containing the .lo file.
2398 func_dirname "$file" "" "."
2399 dir="$func_dirname_result"
2403 func_warning "\`-dlopen' is ignored for non-libtool libraries and objects"
2408 # Get the absolute pathname.
2409 absdir=`cd "$dir" && pwd`
2410 test -n "$absdir" && dir="$absdir"
2412 # Now add the directory to shlibpath_var.
2413 if eval "test -z \"\$$shlibpath_var\""; then
2414 eval "$shlibpath_var=\"\$dir\""
2416 eval "$shlibpath_var=\"\$dir:\$$shlibpath_var\""
2420 # This variable tells wrapper scripts just to set shlibpath_var
2421 # rather than running their programs.
2422 libtool_execute_magic="$magic"
2424 # Check if any of the arguments is a wrapper script.
2429 -* | *.la | *.lo ) ;;
2431 # Do a test to see if this is really a libtool program.
2432 if func_ltwrapper_script_p "$file"; then
2434 # Transform arg to wrapped name.
2435 file="$progdir/$program"
2436 elif func_ltwrapper_executable_p "$file"; then
2437 func_ltwrapper_scriptname "$file"
2438 func_source "$func_ltwrapper_scriptname_result"
2439 # Transform arg to wrapped name.
2440 file="$progdir/$program"
2444 # Quote arguments (to preserve shell metacharacters).
2445 func_quote_for_eval "$file"
2446 args="$args $func_quote_for_eval_result"
2449 if test "X$opt_dry_run" = Xfalse; then
2450 if test -n "$shlibpath_var"; then
2451 # Export the shlibpath_var.
2452 eval "export $shlibpath_var"
2455 # Restore saved environment variables
2456 for lt_var in LANG LANGUAGE LC_ALL LC_CTYPE LC_COLLATE LC_MESSAGES
2458 eval "if test \"\${save_$lt_var+set}\" = set; then
2459 $lt_var=\$save_$lt_var; export $lt_var
2465 # Now prepare to actually exec the command.
2466 exec_cmd="\$cmd$args"
2468 # Display what would be done.
2469 if test -n "$shlibpath_var"; then
2470 eval "\$ECHO \"\$shlibpath_var=\$$shlibpath_var\""
2471 echo "export $shlibpath_var"
2478 test "$mode" = execute && func_mode_execute ${1+"$@"}
2481 # func_mode_finish arg...
2488 if test -n "$finish_cmds$finish_eval" && test -n "$libdirs"; then
2491 libdirs="$libdirs $dir"
2494 for libdir in $libdirs; do
2495 if test -n "$finish_cmds"; then
2496 # Do each command in the finish commands.
2497 func_execute_cmds "$finish_cmds" 'admincmds="$admincmds
2500 if test -n "$finish_eval"; then
2501 # Do the single finish_eval.
2502 eval cmds=\"$finish_eval\"
2503 $opt_dry_run || eval "$cmds" || admincmds="$admincmds
2509 # Exit here if they wanted silent mode.
2510 $opt_silent && exit $EXIT_SUCCESS
2512 echo "----------------------------------------------------------------------"
2513 echo "Libraries have been installed in:"
2514 for libdir in $libdirs; do
2518 echo "If you ever happen to want to link against installed libraries"
2519 echo "in a given directory, LIBDIR, you must either use libtool, and"
2520 echo "specify the full pathname of the library, or use the \`-LLIBDIR'"
2521 echo "flag during linking and do at least one of the following:"
2522 if test -n "$shlibpath_var"; then
2523 echo " - add LIBDIR to the \`$shlibpath_var' environment variable"
2524 echo " during execution"
2526 if test -n "$runpath_var"; then
2527 echo " - add LIBDIR to the \`$runpath_var' environment variable"
2528 echo " during linking"
2530 if test -n "$hardcode_libdir_flag_spec"; then
2532 eval flag=\"$hardcode_libdir_flag_spec\"
2534 $ECHO " - use the \`$flag' linker flag"
2536 if test -n "$admincmds"; then
2537 $ECHO " - have your system administrator run these commands:$admincmds"
2539 if test -f /etc/ld.so.conf; then
2540 echo " - have your system administrator add LIBDIR to \`/etc/ld.so.conf'"
2544 echo "See any operating system documentation about shared libraries for"
2546 solaris2.[6789]|solaris2.1[0-9])
2547 echo "more information, such as the ld(1), crle(1) and ld.so(8) manual"
2551 echo "more information, such as the ld(1) and ld.so(8) manual pages."
2554 echo "----------------------------------------------------------------------"
2558 test "$mode" = finish && func_mode_finish ${1+"$@"}
2561 # func_mode_install arg...
2562 func_mode_install ()
2565 # There may be an optional sh(1) argument at the beginning of
2566 # install_prog (especially on Windows NT).
2567 if test "$nonopt" = "$SHELL" || test "$nonopt" = /bin/sh ||
2568 # Allow the use of GNU shtool's install command.
2569 case $nonopt in *shtool*) :;; *) false;; esac; then
2570 # Aesthetically quote it.
2571 func_quote_for_eval "$nonopt"
2572 install_prog="$func_quote_for_eval_result "
2580 # The real first argument should be the name of the installation program.
2581 # Aesthetically quote it.
2582 func_quote_for_eval "$arg"
2583 install_prog="$install_prog$func_quote_for_eval_result"
2584 install_shared_prog=$install_prog
2585 case " $install_prog " in
2586 *[\\\ /]cp\ *) install_cp=: ;;
2587 *) install_cp=false ;;
2590 # We need to accept at least all the BSD install flags.
2602 if test -n "$dest"; then
2603 files="$files $dest"
2611 if $install_cp; then :; else
2625 # If the previous option needed an argument, then skip it.
2626 if test -n "$prev"; then
2627 if test "x$prev" = x-m && test -n "$install_override_mode"; then
2628 arg2=$install_override_mode
2639 # Aesthetically quote the argument.
2640 func_quote_for_eval "$arg"
2641 install_prog="$install_prog $func_quote_for_eval_result"
2642 if test -n "$arg2"; then
2643 func_quote_for_eval "$arg2"
2645 install_shared_prog="$install_shared_prog $func_quote_for_eval_result"
2648 test -z "$install_prog" && \
2649 func_fatal_help "you must specify an install program"
2651 test -n "$prev" && \
2652 func_fatal_help "the \`$prev' option requires an argument"
2654 if test -n "$install_override_mode" && $no_mode; then
2655 if $install_cp; then :; else
2656 func_quote_for_eval "$install_override_mode"
2657 install_shared_prog="$install_shared_prog -m $func_quote_for_eval_result"
2661 if test -z "$files"; then
2662 if test -z "$dest"; then
2663 func_fatal_help "no file or destination specified"
2665 func_fatal_help "you must specify a destination"
2669 # Strip any trailing slash from the destination.
2670 func_stripname '' '/' "$dest"
2671 dest=$func_stripname_result
2673 # Check to see that the destination is a directory.
2674 test -d "$dest" && isdir=yes
2675 if test "$isdir" = yes; then
2679 func_dirname_and_basename "$dest" "" "."
2680 destdir="$func_dirname_result"
2681 destname="$func_basename_result"
2683 # Not a directory, so check to see that there is only one file specified.
2684 set dummy $files; shift
2685 test "$#" -gt 1 && \
2686 func_fatal_help "\`$dest' is not a directory"
2689 [\\/]* | [A-Za-z]:[\\/]*) ;;
2691 for file in $files; do
2695 func_fatal_help "\`$destdir' must be an absolute directory name"
2702 # This variable tells wrapper scripts just to set variables rather
2703 # than running their programs.
2704 libtool_install_magic="$magic"
2709 for file in $files; do
2711 # Do each installation.
2714 # Do the static libraries later.
2715 staticlibs="$staticlibs $file"
2719 # Check to see that this really is a libtool archive.
2720 func_lalib_unsafe_p "$file" \
2721 || func_fatal_help "\`$file' is not a valid libtool archive"
2728 # Add the libdir to current_libdirs if it is the destination.
2729 if test "X$destdir" = "X$libdir"; then
2730 case "$current_libdirs " in
2732 *) current_libdirs="$current_libdirs $libdir" ;;
2735 # Note the libdir as a future libdir.
2736 case "$future_libdirs " in
2738 *) future_libdirs="$future_libdirs $libdir" ;;
2742 func_dirname "$file" "/" ""
2743 dir="$func_dirname_result"
2746 if test -n "$relink_command"; then
2747 # Determine the prefix the user has applied to our future dir.
2748 inst_prefix_dir=`$ECHO "$destdir" | $SED -e "s%$libdir\$%%"`
2750 # Don't allow the user to place us outside of our expected
2751 # location b/c this prevents finding dependent libraries that
2752 # are installed to the same prefix.
2753 # At present, this check doesn't affect windows .dll's that
2754 # are installed into $libdir/../bin (currently, that works fine)
2755 # but it's something to keep an eye on.
2756 test "$inst_prefix_dir" = "$destdir" && \
2757 func_fatal_error "error: cannot install \`$file' to a directory not ending in $libdir"
2759 if test -n "$inst_prefix_dir"; then
2760 # Stick the inst_prefix_dir data into the link command.
2761 relink_command=`$ECHO "$relink_command" | $SED "s%@inst_prefix_dir@%-inst-prefix-dir $inst_prefix_dir%"`
2763 relink_command=`$ECHO "$relink_command" | $SED "s%@inst_prefix_dir@%%"`
2766 func_warning "relinking \`$file'"
2767 func_show_eval "$relink_command" \
2768 'func_fatal_error "error: relink \`$file'\'' with the above command before installing it"'
2771 # See the names of the shared library.
2772 set dummy $library_names; shift
2773 if test -n "$1"; then
2778 test -n "$relink_command" && srcname="$realname"T
2780 # Install the shared library and build the symlinks.
2781 func_show_eval "$install_shared_prog $dir/$srcname $destdir/$realname" \
2785 cygwin* | mingw* | pw32* | cegcc*)
2793 if test -n "$tstripme" && test -n "$striplib"; then
2794 func_show_eval "$striplib $destdir/$realname" 'exit $?'
2797 if test "$#" -gt 0; then
2798 # Delete the old symlinks, and create new ones.
2799 # Try `ln -sf' first, because the `ln' binary might depend on
2800 # the symlink we replace! Solaris /bin/ln does not understand -f,
2801 # so we also need to try rm && ln -s.
2804 test "$linkname" != "$realname" \
2805 && func_show_eval "(cd $destdir && { $LN_S -f $realname $linkname || { $RM $linkname && $LN_S $realname $linkname; }; })"
2809 # Do each command in the postinstall commands.
2810 lib="$destdir/$realname"
2811 func_execute_cmds "$postinstall_cmds" 'exit $?'
2814 # Install the pseudo-library for information purposes.
2815 func_basename "$file"
2816 name="$func_basename_result"
2817 instname="$dir/$name"i
2818 func_show_eval "$install_prog $instname $destdir/$name" 'exit $?'
2820 # Maybe install the static library, too.
2821 test -n "$old_library" && staticlibs="$staticlibs $dir/$old_library"
2825 # Install (i.e. copy) a libtool object.
2827 # Figure out destination file name, if it wasn't already specified.
2828 if test -n "$destname"; then
2829 destfile="$destdir/$destname"
2831 func_basename "$file"
2832 destfile="$func_basename_result"
2833 destfile="$destdir/$destfile"
2836 # Deduce the name of the destination old-style object file.
2839 func_lo2o "$destfile"
2840 staticdest=$func_lo2o_result
2843 staticdest="$destfile"
2847 func_fatal_help "cannot copy a libtool object to \`$destfile'"
2851 # Install the libtool object if requested.
2852 test -n "$destfile" && \
2853 func_show_eval "$install_prog $file $destfile" 'exit $?'
2855 # Install the old object if enabled.
2856 if test "$build_old_libs" = yes; then
2857 # Deduce the name of the old-style object file.
2859 staticobj=$func_lo2o_result
2860 func_show_eval "$install_prog \$staticobj \$staticdest" 'exit $?'
2866 # Figure out destination file name, if it wasn't already specified.
2867 if test -n "$destname"; then
2868 destfile="$destdir/$destname"
2870 func_basename "$file"
2871 destfile="$func_basename_result"
2872 destfile="$destdir/$destfile"
2875 # If the file is missing, and there is a .exe on the end, strip it
2876 # because it is most likely a libtool script we actually want to
2881 if test ! -f "$file"; then
2882 func_stripname '' '.exe' "$file"
2883 file=$func_stripname_result
2889 # Do a test to see if this is really a libtool program.
2892 if func_ltwrapper_executable_p "$file"; then
2893 func_ltwrapper_scriptname "$file"
2894 wrapper=$func_ltwrapper_scriptname_result
2896 func_stripname '' '.exe' "$file"
2897 wrapper=$func_stripname_result
2904 if func_ltwrapper_script_p "$wrapper"; then
2908 func_source "$wrapper"
2910 # Check the variables that should have been set.
2911 test -z "$generated_by_libtool_version" && \
2912 func_fatal_error "invalid libtool wrapper script \`$wrapper'"
2915 for lib in $notinst_deplibs; do
2916 # Check to see that each library is installed.
2918 if test -f "$lib"; then
2921 libfile="$libdir/"`$ECHO "$lib" | $SED 's%^.*/%%g'` ### testsuite: skip nested quoting test
2922 if test -n "$libdir" && test ! -f "$libfile"; then
2923 func_warning "\`$lib' has not been installed in \`$libdir'"
2929 func_source "$wrapper"
2932 if test "$fast_install" = no && test -n "$relink_command"; then
2934 if test "$finalize" = yes; then
2935 tmpdir=`func_mktempdir`
2936 func_basename "$file$stripped_ext"
2937 file="$func_basename_result"
2938 outputname="$tmpdir/$file"
2939 # Replace the output file specification.
2940 relink_command=`$ECHO "$relink_command" | $SED 's%@OUTPUT@%'"$outputname"'%g'`
2943 func_quote_for_expand "$relink_command"
2944 eval "func_echo $func_quote_for_expand_result"
2946 if eval "$relink_command"; then :
2948 func_error "error: relink \`$file' with the above command before installing it"
2949 $opt_dry_run || ${RM}r "$tmpdir"
2954 func_warning "cannot relink \`$file'"
2958 # Install the binary that we compiled earlier.
2959 file=`$ECHO "$file$stripped_ext" | $SED "s%\([^/]*\)$%$objdir/\1%"`
2963 # remove .exe since cygwin /usr/bin/install will append another
2965 case $install_prog,$host in
2966 */usr/bin/install*,*cygwin*)
2967 case $file:$destfile in
2972 destfile=$destfile.exe
2975 func_stripname '' '.exe' "$destfile"
2976 destfile=$func_stripname_result
2981 func_show_eval "$install_prog\$stripme \$file \$destfile" 'exit $?'
2982 $opt_dry_run || if test -n "$outputname"; then
2989 for file in $staticlibs; do
2990 func_basename "$file"
2991 name="$func_basename_result"
2993 # Set up the ranlib parameters.
2994 oldlib="$destdir/$name"
2996 func_show_eval "$install_prog \$file \$oldlib" 'exit $?'
2998 if test -n "$stripme" && test -n "$old_striplib"; then
2999 func_show_eval "$old_striplib $oldlib" 'exit $?'
3002 # Do each command in the postinstall commands.
3003 func_execute_cmds "$old_postinstall_cmds" 'exit $?'
3006 test -n "$future_libdirs" && \
3007 func_warning "remember to run \`$progname --finish$future_libdirs'"
3009 if test -n "$current_libdirs"; then
3010 # Maybe just do a dry run.
3011 $opt_dry_run && current_libdirs=" -n$current_libdirs"
3012 exec_cmd='$SHELL $progpath $preserve_args --finish$current_libdirs'
3018 test "$mode" = install && func_mode_install ${1+"$@"}
3021 # func_generate_dlsyms outputname originator pic_p
3022 # Extract symbols from dlprefiles and create ${outputname}S.o with
3023 # a dlpreopen symbol table.
3024 func_generate_dlsyms ()
3030 my_prefix=`$ECHO "$my_originator" | sed 's%[^a-zA-Z0-9]%_%g'`
3033 if test -n "$dlfiles$dlprefiles" || test "$dlself" != no; then
3034 if test -n "$NM" && test -n "$global_symbol_pipe"; then
3035 my_dlsyms="${my_outputname}S.c"
3037 func_error "not configured to extract global symbols from dlpreopened files"
3041 if test -n "$my_dlsyms"; then
3045 # Discover the nlist of each of the dlfiles.
3046 nlist="$output_objdir/${my_outputname}.nm"
3048 func_show_eval "$RM $nlist ${nlist}S ${nlist}T"
3050 # Parse the name list into a source file.
3051 func_verbose "creating $output_objdir/$my_dlsyms"
3053 $opt_dry_run || $ECHO > "$output_objdir/$my_dlsyms" "\
3054 /* $my_dlsyms - symbol resolution table for \`$my_outputname' dlsym emulation. */
3055 /* Generated by $PROGRAM (GNU $PACKAGE$TIMESTAMP) $VERSION */
3061 #if defined(__GNUC__) && (((__GNUC__ == 4) && (__GNUC_MINOR__ >= 4)) || (__GNUC__ > 4))
3062 #pragma GCC diagnostic ignored \"-Wstrict-prototypes\"
3065 /* External symbol declarations for the compiler. */\
3068 if test "$dlself" = yes; then
3069 func_verbose "generating symbol list for \`$output'"
3071 $opt_dry_run || echo ': @PROGRAM@ ' > "$nlist"
3073 # Add our own program objects to the symbol list.
3074 progfiles=`$ECHO "$objs$old_deplibs" | $SP2NL | $SED "$lo2o" | $NL2SP`
3075 for progfile in $progfiles; do
3076 func_verbose "extracting global C symbols from \`$progfile'"
3077 $opt_dry_run || eval "$NM $progfile | $global_symbol_pipe >> '$nlist'"
3080 if test -n "$exclude_expsyms"; then
3082 eval '$EGREP -v " ($exclude_expsyms)$" "$nlist" > "$nlist"T'
3083 eval '$MV "$nlist"T "$nlist"'
3087 if test -n "$export_symbols_regex"; then
3089 eval '$EGREP -e "$export_symbols_regex" "$nlist" > "$nlist"T'
3090 eval '$MV "$nlist"T "$nlist"'
3094 # Prepare the list of exported symbols
3095 if test -z "$export_symbols"; then
3096 export_symbols="$output_objdir/$outputname.exp"
3099 eval "${SED} -n -e '/^: @PROGRAM@ $/d' -e 's/^.* \(.*\)$/\1/p' "'< "$nlist" > "$export_symbols"'
3101 *cygwin* | *mingw* | *cegcc* )
3102 eval "echo EXPORTS "'> "$output_objdir/$outputname.def"'
3103 eval 'cat "$export_symbols" >> "$output_objdir/$outputname.def"'
3109 eval "${SED} -e 's/\([].[*^$]\)/\\\\\1/g' -e 's/^/ /' -e 's/$/$/'"' < "$export_symbols" > "$output_objdir/$outputname.exp"'
3110 eval '$GREP -f "$output_objdir/$outputname.exp" < "$nlist" > "$nlist"T'
3111 eval '$MV "$nlist"T "$nlist"'
3113 *cygwin* | *mingw* | *cegcc* )
3114 eval "echo EXPORTS "'> "$output_objdir/$outputname.def"'
3115 eval 'cat "$nlist" >> "$output_objdir/$outputname.def"'
3122 for dlprefile in $dlprefiles; do
3123 func_verbose "extracting global C symbols from \`$dlprefile'"
3124 func_basename "$dlprefile"
3125 name="$func_basename_result"
3127 eval '$ECHO ": $name " >> "$nlist"'
3128 eval "$NM $dlprefile 2>/dev/null | $global_symbol_pipe >> '$nlist'"
3133 # Make sure we have at least an empty file.
3134 test -f "$nlist" || : > "$nlist"
3136 if test -n "$exclude_expsyms"; then
3137 $EGREP -v " ($exclude_expsyms)$" "$nlist" > "$nlist"T
3138 $MV "$nlist"T "$nlist"
3141 # Try sorting and uniquifying the output.
3142 if $GREP -v "^: " < "$nlist" |
3143 if sort -k 3 </dev/null >/dev/null 2>&1; then
3148 uniq > "$nlist"S; then
3151 $GREP -v "^: " < "$nlist" > "$nlist"S
3154 if test -f "$nlist"S; then
3155 eval "$global_symbol_to_cdecl"' < "$nlist"S >> "$output_objdir/$my_dlsyms"'
3157 echo '/* NONE */' >> "$output_objdir/$my_dlsyms"
3160 echo >> "$output_objdir/$my_dlsyms" "\
3162 /* The mapping between symbol names and symbols. */
3169 *cygwin* | *mingw* | *cegcc* )
3170 echo >> "$output_objdir/$my_dlsyms" "\
3171 /* DATA imports from DLLs on WIN32 con't be const, because
3172 runtime relocations are performed -- see ld's documentation
3173 on pseudo-relocs. */"
3176 echo >> "$output_objdir/$my_dlsyms" "\
3177 /* This system does not cope well with relocations in const data */"
3180 lt_dlsym_const=const ;;
3183 echo >> "$output_objdir/$my_dlsyms" "\
3184 extern $lt_dlsym_const lt_dlsymlist
3185 lt_${my_prefix}_LTX_preloaded_symbols[];
3186 $lt_dlsym_const lt_dlsymlist
3187 lt_${my_prefix}_LTX_preloaded_symbols[] =
3189 { \"$my_originator\", (void *) 0 },"
3191 case $need_lib_prefix in
3193 eval "$global_symbol_to_c_name_address" < "$nlist" >> "$output_objdir/$my_dlsyms"
3196 eval "$global_symbol_to_c_name_address_lib_prefix" < "$nlist" >> "$output_objdir/$my_dlsyms"
3199 echo >> "$output_objdir/$my_dlsyms" "\
3203 /* This works around a problem in FreeBSD linker */
3204 #ifdef FREEBSD_WORKAROUND
3205 static const void *lt_preloaded_setup() {
3206 return lt_${my_prefix}_LTX_preloaded_symbols;
3216 pic_flag_for_symtable=
3217 case "$compile_command " in
3221 # compiling the symbol table file with pic_flag works around
3222 # a FreeBSD bug that causes programs to crash when -lm is
3223 # linked before any other PIC object. But we must not use
3224 # pic_flag when linking with -static. The problem exists in
3225 # FreeBSD 2.2.6 and is fixed in FreeBSD 3.1.
3226 *-*-freebsd2*|*-*-freebsd3.0*|*-*-freebsdelf3.0*)
3227 pic_flag_for_symtable=" $pic_flag -DFREEBSD_WORKAROUND" ;;
3229 pic_flag_for_symtable=" $pic_flag" ;;
3231 if test "X$my_pic_p" != Xno; then
3232 pic_flag_for_symtable=" $pic_flag"
3239 for arg in $LTCFLAGS; do
3241 -pie | -fpie | -fPIE) ;;
3242 *) symtab_cflags="$symtab_cflags $arg" ;;
3246 # Now compile the dynamic symbol file.
3247 func_show_eval '(cd $output_objdir && $LTCC$symtab_cflags -c$no_builtin_flag$pic_flag_for_symtable "$my_dlsyms")' 'exit $?'
3249 # Clean up the generated files.
3250 func_show_eval '$RM "$output_objdir/$my_dlsyms" "$nlist" "${nlist}S" "${nlist}T"'
3252 # Transform the symbol file into the correct name.
3253 symfileobj="$output_objdir/${my_outputname}S.$objext"
3255 *cygwin* | *mingw* | *cegcc* )
3256 if test -f "$output_objdir/$my_outputname.def"; then
3257 compile_command=`$ECHO "$compile_command" | $SED "s%@SYMFILE@%$output_objdir/$my_outputname.def $symfileobj%"`
3258 finalize_command=`$ECHO "$finalize_command" | $SED "s%@SYMFILE@%$output_objdir/$my_outputname.def $symfileobj%"`
3260 compile_command=`$ECHO "$compile_command" | $SED "s%@SYMFILE@%$symfileobj%"`
3261 finalize_command=`$ECHO "$finalize_command" | $SED "s%@SYMFILE@%$symfileobj%"`
3265 compile_command=`$ECHO "$compile_command" | $SED "s%@SYMFILE@%$symfileobj%"`
3266 finalize_command=`$ECHO "$finalize_command" | $SED "s%@SYMFILE@%$symfileobj%"`
3271 func_fatal_error "unknown suffix for \`$my_dlsyms'"
3275 # We keep going just in case the user didn't refer to
3276 # lt_preloaded_symbols. The linker will fail if global_symbol_pipe
3277 # really was required.
3279 # Nullify the symbol file.
3280 compile_command=`$ECHO "$compile_command" | $SED "s% @SYMFILE@%%"`
3281 finalize_command=`$ECHO "$finalize_command" | $SED "s% @SYMFILE@%%"`
3285 # func_win32_libid arg
3286 # return the library type of file 'arg'
3288 # Need a lot of goo to handle *both* DLLs and import libs
3289 # Has to be a shell function in order to 'eat' the argument
3290 # that is supplied when $file_magic_command is called.
3291 # Despite the name, also deal with 64 bit binaries.
3295 win32_libid_type="unknown"
3296 win32_fileres=`file -L $1 2>/dev/null`
3297 case $win32_fileres in
3298 *ar\ archive\ import\ library*) # definitely import
3299 win32_libid_type="x86 archive import"
3301 *ar\ archive*) # could be an import, or static
3302 # Keep the egrep pattern in sync with the one in _LT_CHECK_MAGIC_METHOD.
3303 if eval $OBJDUMP -f $1 | $SED -e '10q' 2>/dev/null |
3304 $EGREP 'file format (pei*-i386(.*architecture: i386)?|pe-arm-wince|pe-x86-64)' >/dev/null; then
3305 win32_nmres=`eval $NM -f posix -A $1 |
3314 case $win32_nmres in
3315 import*) win32_libid_type="x86 archive import";;
3316 *) win32_libid_type="x86 archive static";;
3321 win32_libid_type="x86 DLL"
3323 *executable*) # but shell scripts are "executable" too...
3324 case $win32_fileres in
3325 *MS\ Windows\ PE\ Intel*)
3326 win32_libid_type="x86 DLL"
3331 $ECHO "$win32_libid_type"
3336 # func_extract_an_archive dir oldlib
3337 func_extract_an_archive ()
3340 f_ex_an_ar_dir="$1"; shift
3341 f_ex_an_ar_oldlib="$1"
3342 if test "$lock_old_archive_extraction" = yes; then
3343 lockfile=$f_ex_an_ar_oldlib.lock
3344 until $opt_dry_run || ln "$progpath" "$lockfile" 2>/dev/null; do
3345 func_echo "Waiting for $lockfile to be removed"
3349 func_show_eval "(cd \$f_ex_an_ar_dir && $AR x \"\$f_ex_an_ar_oldlib\")" \
3350 'stat=$?; rm -f "$lockfile"; exit $stat'
3351 if test "$lock_old_archive_extraction" = yes; then
3352 $opt_dry_run || rm -f "$lockfile"
3354 if ($AR t "$f_ex_an_ar_oldlib" | sort | sort -uc >/dev/null 2>&1); then
3357 func_fatal_error "object name conflicts in archive: $f_ex_an_ar_dir/$f_ex_an_ar_oldlib"
3362 # func_extract_archives gentop oldlib ...
3363 func_extract_archives ()
3366 my_gentop="$1"; shift
3367 my_oldlibs=${1+"$@"}
3373 for my_xlib in $my_oldlibs; do
3374 # Extract the objects.
3376 [\\/]* | [A-Za-z]:[\\/]*) my_xabs="$my_xlib" ;;
3377 *) my_xabs=`pwd`"/$my_xlib" ;;
3379 func_basename "$my_xlib"
3380 my_xlib="$func_basename_result"
3383 case " $extracted_archives " in
3385 func_arith $extracted_serial + 1
3386 extracted_serial=$func_arith_result
3387 my_xlib_u=lt$extracted_serial-$my_xlib ;;
3391 extracted_archives="$extracted_archives $my_xlib_u"
3392 my_xdir="$my_gentop/$my_xlib_u"
3394 func_mkdir_p "$my_xdir"
3398 func_verbose "Extracting $my_xabs"
3399 # Do not bother doing anything if just a dry run
3401 darwin_orig_dir=`pwd`
3402 cd $my_xdir || exit $?
3403 darwin_archive=$my_xabs
3405 darwin_base_archive=`basename "$darwin_archive"`
3406 darwin_arches=`$LIPO -info "$darwin_archive" 2>/dev/null | $GREP Architectures 2>/dev/null || true`
3407 if test -n "$darwin_arches"; then
3408 darwin_arches=`$ECHO "$darwin_arches" | $SED -e 's/.*are://'`
3410 func_verbose "$darwin_base_archive has multiple architectures $darwin_arches"
3411 for darwin_arch in $darwin_arches ; do
3412 func_mkdir_p "unfat-$$/${darwin_base_archive}-${darwin_arch}"
3413 $LIPO -thin $darwin_arch -output "unfat-$$/${darwin_base_archive}-${darwin_arch}/${darwin_base_archive}" "${darwin_archive}"
3414 cd "unfat-$$/${darwin_base_archive}-${darwin_arch}"
3415 func_extract_an_archive "`pwd`" "${darwin_base_archive}"
3417 $RM "unfat-$$/${darwin_base_archive}-${darwin_arch}/${darwin_base_archive}"
3418 done # $darwin_arches
3419 ## Okay now we've a bunch of thin objects, gotta fatten them up :)
3420 darwin_filelist=`find unfat-$$ -type f -name \*.o -print -o -name \*.lo -print | $SED -e "$basename" | sort -u`
3423 for darwin_file in $darwin_filelist; do
3424 darwin_files=`find unfat-$$ -name $darwin_file -print | sort | $NL2SP`
3425 $LIPO -create -output "$darwin_file" $darwin_files
3426 done # $darwin_filelist
3428 cd "$darwin_orig_dir"
3431 func_extract_an_archive "$my_xdir" "$my_xabs"
3436 func_extract_an_archive "$my_xdir" "$my_xabs"
3439 my_oldobjs="$my_oldobjs "`find $my_xdir -name \*.$objext -print -o -name \*.lo -print | sort | $NL2SP`
3442 func_extract_archives_result="$my_oldobjs"
3446 # func_emit_wrapper [arg=no]
3448 # Emit a libtool wrapper script on stdout.
3449 # Don't directly open a file because we may want to
3450 # incorporate the script contents within a cygwin/mingw
3451 # wrapper executable. Must ONLY be called from within
3452 # func_mode_link because it depends on a number of variables
3455 # ARG is the value that the WRAPPER_SCRIPT_BELONGS_IN_OBJDIR
3456 # variable will take. If 'yes', then the emitted script
3457 # will assume that the directory in which it is stored is
3458 # the $objdir directory. This is a cygwin/mingw-specific
3460 func_emit_wrapper ()
3462 func_emit_wrapper_arg1=${1-no}
3467 # $output - temporary wrapper script for $objdir/$outputname
3468 # Generated by $PROGRAM (GNU $PACKAGE$TIMESTAMP) $VERSION
3470 # The $output program cannot be directly executed until all the libtool
3471 # libraries that it depends on are installed.
3473 # This wrapper script should never be moved out of the build directory.
3474 # If it is, it will not operate correctly.
3476 # Sed substitution that helps us do robust quoting. It backslashifies
3477 # metacharacters that are still active within double-quoted strings.
3478 sed_quote_subst='$sed_quote_subst'
3480 # Be Bourne compatible
3481 if test -n \"\${ZSH_VERSION+set}\" && (emulate sh) >/dev/null 2>&1; then
3484 # Zsh 3.x and 4.x performs word splitting on \${1+\"\$@\"}, which
3485 # is contrary to our usage. Disable this feature.
3486 alias -g '\${1+\"\$@\"}'='\"\$@\"'
3487 setopt NO_GLOB_SUBST
3489 case \`(set -o) 2>/dev/null\` in *posix*) set -o posix;; esac
3491 BIN_SH=xpg4; export BIN_SH # for Tru64
3492 DUALCASE=1; export DUALCASE # for MKS sh
3494 # The HP-UX ksh and POSIX shell print the target directory to stdout
3496 (unset CDPATH) >/dev/null 2>&1 && unset CDPATH
3498 relink_command=\"$relink_command\"
3500 # This environment variable determines our operation mode.
3501 if test \"\$libtool_install_magic\" = \"$magic\"; then
3502 # install mode needs the following variables:
3503 generated_by_libtool_version='$macro_version'
3504 notinst_deplibs='$notinst_deplibs'
3506 # When we are sourced in execute mode, \$file and \$ECHO are already set.
3507 if test \"\$libtool_execute_magic\" != \"$magic\"; then
3510 qECHO=`$ECHO "$ECHO" | $SED "$sed_quote_subst"`
3513 # A function that is used when there is no print builtin or printf.
3514 func_fallback_echo ()
3516 eval 'cat <<_LTECHO_EOF
3523 # Very basic option parsing. These options are (a) specific to
3524 # the libtool wrapper, (b) are identical between the wrapper
3525 # /script/ and the wrapper /executable/ which is used only on
3526 # windows platforms, and (c) all begin with the string "--lt-"
3527 # (application programs are unlikely to have options which match
3530 # There are only two supported options: --lt-debug and
3531 # --lt-dump-script. There is, deliberately, no --lt-help.
3533 # The first argument to this parsing function should be the
3534 # script's $0 value, followed by "$@".
3536 func_parse_lt_options ()
3542 case \"\$lt_opt\" in
3543 --lt-debug) lt_option_debug=1 ;;
3545 lt_dump_D=\`\$ECHO \"X\$lt_script_arg0\" | $SED -e 's/^X//' -e 's%/[^/]*$%%'\`
3546 test \"X\$lt_dump_D\" = \"X\$lt_script_arg0\" && lt_dump_D=.
3547 lt_dump_F=\`\$ECHO \"X\$lt_script_arg0\" | $SED -e 's/^X//' -e 's%^.*/%%'\`
3548 cat \"\$lt_dump_D/\$lt_dump_F\"
3552 \$ECHO \"Unrecognized --lt- option: '\$lt_opt'\" 1>&2
3558 # Print the debug banner immediately:
3559 if test -n \"\$lt_option_debug\"; then
3560 echo \"${outputname}:${output}:\${LINENO}: libtool wrapper (GNU $PACKAGE$TIMESTAMP) $VERSION\" 1>&2
3564 # Used when --lt-debug. Prints its arguments to stdout
3565 # (redirection is the responsibility of the caller)
3566 func_lt_dump_args ()
3571 \$ECHO \"${outputname}:${output}:\${LINENO}: newargv[\$lt_dump_args_N]: \$lt_arg\"
3572 lt_dump_args_N=\`expr \$lt_dump_args_N + 1\`
3576 # Core function for launching the target application
3577 func_exec_program_core ()
3581 # Backslashes separate directories on plain windows
3582 *-*-mingw | *-*-os2* | *-cegcc*)
3584 if test -n \"\$lt_option_debug\"; then
3585 \$ECHO \"${outputname}:${output}:\${LINENO}: newargv[0]: \$progdir\\\\\$program\" 1>&2
3586 func_lt_dump_args \${1+\"\$@\"} 1>&2
3588 exec \"\$progdir\\\\\$program\" \${1+\"\$@\"}
3594 if test -n \"\$lt_option_debug\"; then
3595 \$ECHO \"${outputname}:${output}:\${LINENO}: newargv[0]: \$progdir/\$program\" 1>&2
3596 func_lt_dump_args \${1+\"\$@\"} 1>&2
3598 exec \"\$progdir/\$program\" \${1+\"\$@\"}
3603 \$ECHO \"\$0: cannot exec \$program \$*\" 1>&2
3607 # A function to encapsulate launching the target application
3608 # Strips options in the --lt-* namespace from \$@ and
3609 # launches target application with the remaining arguments.
3610 func_exec_program ()
3616 *) set x \"\$@\" \"\$lt_wr_arg\"; shift;;
3620 func_exec_program_core \${1+\"\$@\"}
3624 func_parse_lt_options \"\$0\" \${1+\"\$@\"}
3626 # Find the directory that this script lives in.
3627 thisdir=\`\$ECHO \"\$file\" | $SED 's%/[^/]*$%%'\`
3628 test \"x\$thisdir\" = \"x\$file\" && thisdir=.
3630 # Follow symbolic links until we get to the real thisdir.
3631 file=\`ls -ld \"\$file\" | $SED -n 's/.*-> //p'\`
3632 while test -n \"\$file\"; do
3633 destdir=\`\$ECHO \"\$file\" | $SED 's%/[^/]*\$%%'\`
3635 # If there was a directory component, then change thisdir.
3636 if test \"x\$destdir\" != \"x\$file\"; then
3637 case \"\$destdir\" in
3638 [\\\\/]* | [A-Za-z]:[\\\\/]*) thisdir=\"\$destdir\" ;;
3639 *) thisdir=\"\$thisdir/\$destdir\" ;;
3643 file=\`\$ECHO \"\$file\" | $SED 's%^.*/%%'\`
3644 file=\`ls -ld \"\$thisdir/\$file\" | $SED -n 's/.*-> //p'\`
3647 # Usually 'no', except on cygwin/mingw when embedded into
3649 WRAPPER_SCRIPT_BELONGS_IN_OBJDIR=$func_emit_wrapper_arg1
3650 if test \"\$WRAPPER_SCRIPT_BELONGS_IN_OBJDIR\" = \"yes\"; then
3651 # special case for '.'
3652 if test \"\$thisdir\" = \".\"; then
3655 # remove .libs from thisdir
3656 case \"\$thisdir\" in
3657 *[\\\\/]$objdir ) thisdir=\`\$ECHO \"\$thisdir\" | $SED 's%[\\\\/][^\\\\/]*$%%'\` ;;
3658 $objdir ) thisdir=. ;;
3662 # Try to get the absolute directory name.
3663 absdir=\`cd \"\$thisdir\" && pwd\`
3664 test -n \"\$absdir\" && thisdir=\"\$absdir\"
3667 if test "$fast_install" = yes; then
3669 program=lt-'$outputname'$exeext
3670 progdir=\"\$thisdir/$objdir\"
3672 if test ! -f \"\$progdir/\$program\" ||
3673 { file=\`ls -1dt \"\$progdir/\$program\" \"\$progdir/../\$program\" 2>/dev/null | ${SED} 1q\`; \\
3674 test \"X\$file\" != \"X\$progdir/\$program\"; }; then
3676 file=\"\$\$-\$program\"
3678 if test ! -d \"\$progdir\"; then
3679 $MKDIR \"\$progdir\"
3681 $RM \"\$progdir/\$file\"
3686 # relink executable if necessary
3687 if test -n \"\$relink_command\"; then
3688 if relink_command_output=\`eval \$relink_command 2>&1\`; then :
3690 $ECHO \"\$relink_command_output\" >&2
3691 $RM \"\$progdir/\$file\"
3696 $MV \"\$progdir/\$file\" \"\$progdir/\$program\" 2>/dev/null ||
3697 { $RM \"\$progdir/\$program\";
3698 $MV \"\$progdir/\$file\" \"\$progdir/\$program\"; }
3699 $RM \"\$progdir/\$file\"
3703 program='$outputname'
3704 progdir=\"\$thisdir/$objdir\"
3710 if test -f \"\$progdir/\$program\"; then"
3712 # Export our shlibpath_var if we have one.
3713 if test "$shlibpath_overrides_runpath" = yes && test -n "$shlibpath_var" && test -n "$temp_rpath"; then
3715 # Add our own library path to $shlibpath_var
3716 $shlibpath_var=\"$temp_rpath\$$shlibpath_var\"
3718 # Some systems cannot cope with colon-terminated $shlibpath_var
3719 # The second colon is a workaround for a bug in BeOS R4 sed
3720 $shlibpath_var=\`\$ECHO \"\$$shlibpath_var\" | $SED 's/::*\$//'\`
3722 export $shlibpath_var
3726 # fixup the dll searchpath if we need to.
3727 if test -n "$dllsearchpath"; then
3729 # Add the dll search path components to the executable PATH
3730 PATH=$dllsearchpath:\$PATH
3735 if test \"\$libtool_execute_magic\" != \"$magic\"; then
3736 # Run the actual program with our arguments.
3737 func_exec_program \${1+\"\$@\"}
3740 # The program doesn't exist.
3741 \$ECHO \"\$0: error: \\\`\$progdir/\$program' does not exist\" 1>&2
3742 \$ECHO \"This script is just a wrapper for \$program.\" 1>&2
3743 \$ECHO \"See the $PACKAGE documentation for more information.\" 1>&2
3751 # func_to_host_path arg
3753 # Convert paths to host format when used with build tools.
3754 # Intended for use with "native" mingw (where libtool itself
3755 # is running under the msys shell), or in the following cross-
3756 # build environments:
3758 # mingw (msys) mingw [e.g. native]
3761 # where wine is equipped with the `winepath' executable.
3762 # In the native mingw case, the (msys) shell automatically
3763 # converts paths for any non-msys applications it launches,
3764 # but that facility isn't available from inside the cwrapper.
3765 # Similar accommodations are necessary for $host mingw and
3766 # $build cygwin. Calling this function does no harm for other
3767 # $host/$build combinations not listed above.
3769 # ARG is the path (on $build) that should be converted to
3770 # the proper representation for $host. The result is stored
3771 # in $func_to_host_path_result.
3772 func_to_host_path ()
3774 func_to_host_path_result="$1"
3775 if test -n "$1"; then
3778 lt_sed_naive_backslashify='s|\\\\*|\\|g;s|/|\\|g;s|\\|\\\\|g'
3780 *mingw* ) # actually, msys
3781 # awkward: cmd appends spaces to result
3782 func_to_host_path_result=`( cmd //c echo "$1" ) 2>/dev/null |
3783 $SED -e 's/[ ]*$//' -e "$lt_sed_naive_backslashify"`
3786 func_to_host_path_result=`cygpath -w "$1" |
3787 $SED -e "$lt_sed_naive_backslashify"`
3790 # Unfortunately, winepath does not exit with a non-zero
3791 # error code, so we are forced to check the contents of
3792 # stdout. On the other hand, if the command is not
3793 # found, the shell will set an exit code of 127 and print
3794 # *an error message* to stdout. So we must check for both
3795 # error code of zero AND non-empty stdout, which explains
3796 # the odd construction:
3797 func_to_host_path_tmp1=`winepath -w "$1" 2>/dev/null`
3798 if test "$?" -eq 0 && test -n "${func_to_host_path_tmp1}"; then
3799 func_to_host_path_result=`$ECHO "$func_to_host_path_tmp1" |
3800 $SED -e "$lt_sed_naive_backslashify"`
3802 # Allow warning below.
3803 func_to_host_path_result=
3807 if test -z "$func_to_host_path_result" ; then
3808 func_error "Could not determine host path corresponding to"
3810 func_error "Continuing, but uninstalled executables may not work."
3812 func_to_host_path_result="$1"
3818 # end: func_to_host_path
3820 # func_to_host_pathlist arg
3822 # Convert pathlists to host format when used with build tools.
3823 # See func_to_host_path(), above. This function supports the
3824 # following $build/$host combinations (but does no harm for
3825 # combinations not listed here):
3827 # mingw (msys) mingw [e.g. native]
3831 # Path separators are also converted from $build format to
3832 # $host format. If ARG begins or ends with a path separator
3833 # character, it is preserved (but converted to $host format)
3836 # ARG is a pathlist (on $build) that should be converted to
3837 # the proper representation on $host. The result is stored
3838 # in $func_to_host_pathlist_result.
3839 func_to_host_pathlist ()
3841 func_to_host_pathlist_result="$1"
3842 if test -n "$1"; then
3845 lt_sed_naive_backslashify='s|\\\\*|\\|g;s|/|\\|g;s|\\|\\\\|g'
3846 # Remove leading and trailing path separator characters from
3847 # ARG. msys behavior is inconsistent here, cygpath turns them
3848 # into '.;' and ';.', and winepath ignores them completely.
3849 func_stripname : : "$1"
3850 func_to_host_pathlist_tmp1=$func_stripname_result
3852 *mingw* ) # Actually, msys.
3853 # Awkward: cmd appends spaces to result.
3854 func_to_host_pathlist_result=`
3855 ( cmd //c echo "$func_to_host_pathlist_tmp1" ) 2>/dev/null |
3856 $SED -e 's/[ ]*$//' -e "$lt_sed_naive_backslashify"`
3859 func_to_host_pathlist_result=`cygpath -w -p "$func_to_host_pathlist_tmp1" |
3860 $SED -e "$lt_sed_naive_backslashify"`
3863 # unfortunately, winepath doesn't convert pathlists
3864 func_to_host_pathlist_result=""
3865 func_to_host_pathlist_oldIFS=$IFS
3867 for func_to_host_pathlist_f in $func_to_host_pathlist_tmp1 ; do
3868 IFS=$func_to_host_pathlist_oldIFS
3869 if test -n "$func_to_host_pathlist_f" ; then
3870 func_to_host_path "$func_to_host_pathlist_f"
3871 if test -n "$func_to_host_path_result" ; then
3872 if test -z "$func_to_host_pathlist_result" ; then
3873 func_to_host_pathlist_result="$func_to_host_path_result"
3875 func_append func_to_host_pathlist_result ";$func_to_host_path_result"
3880 IFS=$func_to_host_pathlist_oldIFS
3883 if test -z "$func_to_host_pathlist_result"; then
3884 func_error "Could not determine the host path(s) corresponding to"
3886 func_error "Continuing, but uninstalled executables may not work."
3887 # Fallback. This may break if $1 contains DOS-style drive
3888 # specifications. The fix is not to complicate the expression
3889 # below, but for the user to provide a working wine installation
3890 # with winepath so that path translation in the cross-to-mingw
3891 # case works properly.
3892 lt_replace_pathsep_nix_to_dos="s|:|;|g"
3893 func_to_host_pathlist_result=`echo "$func_to_host_pathlist_tmp1" |\
3894 $SED -e "$lt_replace_pathsep_nix_to_dos"`
3896 # Now, add the leading and trailing path separators back
3898 :* ) func_to_host_pathlist_result=";$func_to_host_pathlist_result"
3902 *: ) func_append func_to_host_pathlist_result ";"
3909 # end: func_to_host_pathlist
3911 # func_emit_cwrapperexe_src
3912 # emit the source code for a wrapper executable on stdout
3913 # Must ONLY be called from within func_mode_link because
3914 # it depends on a number of variable set therein.
3915 func_emit_cwrapperexe_src ()
3919 /* $cwrappersource - temporary wrapper executable for $objdir/$outputname
3920 Generated by $PROGRAM (GNU $PACKAGE$TIMESTAMP) $VERSION
3922 The $output program cannot be directly executed until all the libtool
3923 libraries that it depends on are installed.
3925 This wrapper executable should never be moved out of the build directory.
3926 If it is, it will not operate correctly.
3931 # define _CRT_SECURE_NO_DEPRECATE 1
3936 # include <direct.h>
3937 # include <process.h>
3940 # include <unistd.h>
3941 # include <stdint.h>
3953 #include <sys/stat.h>
3955 /* declarations of non-ANSI functions */
3956 #if defined(__MINGW32__)
3957 # ifdef __STRICT_ANSI__
3958 int _putenv (const char *);
3960 #elif defined(__CYGWIN__)
3961 # ifdef __STRICT_ANSI__
3962 char *realpath (const char *, char *);
3963 int putenv (char *);
3964 int setenv (const char *, const char *, int);
3966 /* #elif defined (other platforms) ... */
3969 /* portability defines, excluding path handling macros */
3970 #if defined(_MSC_VER)
3971 # define setmode _setmode
3973 # define chmod _chmod
3974 # define getcwd _getcwd
3975 # define putenv _putenv
3976 # define S_IXUSR _S_IEXEC
3977 # ifndef _INTPTR_T_DEFINED
3978 # define _INTPTR_T_DEFINED
3979 # define intptr_t int
3981 #elif defined(__MINGW32__)
3982 # define setmode _setmode
3984 # define chmod _chmod
3985 # define getcwd _getcwd
3986 # define putenv _putenv
3987 #elif defined(__CYGWIN__)
3988 # define HAVE_SETENV
3989 # define FOPEN_WB "wb"
3990 /* #elif defined (other platforms) ... */
3993 #if defined(PATH_MAX)
3994 # define LT_PATHMAX PATH_MAX
3995 #elif defined(MAXPATHLEN)
3996 # define LT_PATHMAX MAXPATHLEN
3998 # define LT_PATHMAX 1024
4008 /* path handling portability macros */
4009 #ifndef DIR_SEPARATOR
4010 # define DIR_SEPARATOR '/'
4011 # define PATH_SEPARATOR ':'
4014 #if defined (_WIN32) || defined (__MSDOS__) || defined (__DJGPP__) || \
4016 # define HAVE_DOS_BASED_FILE_SYSTEM
4017 # define FOPEN_WB "wb"
4018 # ifndef DIR_SEPARATOR_2
4019 # define DIR_SEPARATOR_2 '\\'
4021 # ifndef PATH_SEPARATOR_2
4022 # define PATH_SEPARATOR_2 ';'
4026 #ifndef DIR_SEPARATOR_2
4027 # define IS_DIR_SEPARATOR(ch) ((ch) == DIR_SEPARATOR)
4028 #else /* DIR_SEPARATOR_2 */
4029 # define IS_DIR_SEPARATOR(ch) \
4030 (((ch) == DIR_SEPARATOR) || ((ch) == DIR_SEPARATOR_2))
4031 #endif /* DIR_SEPARATOR_2 */
4033 #ifndef PATH_SEPARATOR_2
4034 # define IS_PATH_SEPARATOR(ch) ((ch) == PATH_SEPARATOR)
4035 #else /* PATH_SEPARATOR_2 */
4036 # define IS_PATH_SEPARATOR(ch) ((ch) == PATH_SEPARATOR_2)
4037 #endif /* PATH_SEPARATOR_2 */
4040 # define FOPEN_WB "w"
4043 # define _O_BINARY 0
4046 #define XMALLOC(type, num) ((type *) xmalloc ((num) * sizeof(type)))
4047 #define XFREE(stale) do { \
4048 if (stale) { free ((void *) stale); stale = 0; } \
4051 #if defined(LT_DEBUGWRAPPER)
4052 static int lt_debug = 1;
4054 static int lt_debug = 0;
4057 const char *program_name = "libtool-wrapper"; /* in case xstrdup fails */
4059 void *xmalloc (size_t num);
4060 char *xstrdup (const char *string);
4061 const char *base_name (const char *name);
4062 char *find_executable (const char *wrapper);
4063 char *chase_symlinks (const char *pathspec);
4064 int make_executable (const char *path);
4065 int check_executable (const char *path);
4066 char *strendzap (char *str, const char *pat);
4067 void lt_debugprintf (const char *file, int line, const char *fmt, ...);
4068 void lt_fatal (const char *file, int line, const char *message, ...);
4069 static const char *nonnull (const char *s);
4070 static const char *nonempty (const char *s);
4071 void lt_setenv (const char *name, const char *value);
4072 char *lt_extend_str (const char *orig_value, const char *add, int to_end);
4073 void lt_update_exe_path (const char *name, const char *value);
4074 void lt_update_lib_path (const char *name, const char *value);
4075 char **prepare_spawn (char **argv);
4076 void lt_dump_script (FILE *f);
4080 const char * MAGIC_EXE = "$magic_exe";
4081 const char * LIB_PATH_VARNAME = "$shlibpath_var";
4084 if test "$shlibpath_overrides_runpath" = yes && test -n "$shlibpath_var" && test -n "$temp_rpath"; then
4085 func_to_host_pathlist "$temp_rpath"
4087 const char * LIB_PATH_VALUE = "$func_to_host_pathlist_result";
4091 const char * LIB_PATH_VALUE = "";
4095 if test -n "$dllsearchpath"; then
4096 func_to_host_pathlist "$dllsearchpath:"
4098 const char * EXE_PATH_VARNAME = "PATH";
4099 const char * EXE_PATH_VALUE = "$func_to_host_pathlist_result";
4103 const char * EXE_PATH_VARNAME = "";
4104 const char * EXE_PATH_VALUE = "";
4108 if test "$fast_install" = yes; then
4110 const char * TARGET_PROGRAM_NAME = "lt-$outputname"; /* hopefully, no .exe */
4114 const char * TARGET_PROGRAM_NAME = "$outputname"; /* hopefully, no .exe */
4121 #define LTWRAPPER_OPTION_PREFIX "--lt-"
4123 static const char *ltwrapper_option_prefix = LTWRAPPER_OPTION_PREFIX;
4124 static const char *dumpscript_opt = LTWRAPPER_OPTION_PREFIX "dump-script";
4125 static const char *debug_opt = LTWRAPPER_OPTION_PREFIX "debug";
4128 main (int argc, char *argv[])
4133 char *actual_cwrapper_path;
4134 char *actual_cwrapper_name;
4137 intptr_t rval = 127;
4141 program_name = (char *) xstrdup (base_name (argv[0]));
4142 newargz = XMALLOC (char *, argc + 1);
4144 /* very simple arg parsing; don't want to rely on getopt
4145 * also, copy all non cwrapper options to newargz, except
4146 * argz[0], which is handled differently
4149 for (i = 1; i < argc; i++)
4151 if (strcmp (argv[i], dumpscript_opt) == 0)
4155 *mingw* | *cygwin* )
4156 # make stdout use "unix" line endings
4157 echo " setmode(1,_O_BINARY);"
4162 lt_dump_script (stdout);
4165 if (strcmp (argv[i], debug_opt) == 0)
4170 if (strcmp (argv[i], ltwrapper_option_prefix) == 0)
4172 /* however, if there is an option in the LTWRAPPER_OPTION_PREFIX
4173 namespace, but it is not one of the ones we know about and
4174 have already dealt with, above (inluding dump-script), then
4175 report an error. Otherwise, targets might begin to believe
4176 they are allowed to use options in the LTWRAPPER_OPTION_PREFIX
4177 namespace. The first time any user complains about this, we'll
4178 need to make LTWRAPPER_OPTION_PREFIX a configure-time option
4179 or a configure.ac-settable value.
4181 lt_fatal (__FILE__, __LINE__,
4182 "unrecognized %s option: '%s'",
4183 ltwrapper_option_prefix, argv[i]);
4186 newargz[++newargc] = xstrdup (argv[i]);
4188 newargz[++newargc] = NULL;
4192 /* The GNU banner must be the first non-error debug message */
4193 lt_debugprintf (__FILE__, __LINE__, "libtool wrapper (GNU $PACKAGE$TIMESTAMP) $VERSION\n");
4196 lt_debugprintf (__FILE__, __LINE__, "(main) argv[0]: %s\n", argv[0]);
4197 lt_debugprintf (__FILE__, __LINE__, "(main) program_name: %s\n", program_name);
4199 tmp_pathspec = find_executable (argv[0]);
4200 if (tmp_pathspec == NULL)
4201 lt_fatal (__FILE__, __LINE__, "couldn't find %s", argv[0]);
4202 lt_debugprintf (__FILE__, __LINE__,
4203 "(main) found exe (before symlink chase) at: %s\n",
4206 actual_cwrapper_path = chase_symlinks (tmp_pathspec);
4207 lt_debugprintf (__FILE__, __LINE__,
4208 "(main) found exe (after symlink chase) at: %s\n",
4209 actual_cwrapper_path);
4210 XFREE (tmp_pathspec);
4212 actual_cwrapper_name = xstrdup (base_name (actual_cwrapper_path));
4213 strendzap (actual_cwrapper_path, actual_cwrapper_name);
4215 /* wrapper name transforms */
4216 strendzap (actual_cwrapper_name, ".exe");
4217 tmp_pathspec = lt_extend_str (actual_cwrapper_name, ".exe", 1);
4218 XFREE (actual_cwrapper_name);
4219 actual_cwrapper_name = tmp_pathspec;
4222 /* target_name transforms -- use actual target program name; might have lt- prefix */
4223 target_name = xstrdup (base_name (TARGET_PROGRAM_NAME));
4224 strendzap (target_name, ".exe");
4225 tmp_pathspec = lt_extend_str (target_name, ".exe", 1);
4226 XFREE (target_name);
4227 target_name = tmp_pathspec;
4230 lt_debugprintf (__FILE__, __LINE__,
4231 "(main) libtool target name: %s\n",
4237 XMALLOC (char, (strlen (actual_cwrapper_path) +
4238 strlen ("$objdir") + 1 + strlen (actual_cwrapper_name) + 1));
4239 strcpy (newargz[0], actual_cwrapper_path);
4240 strcat (newargz[0], "$objdir");
4241 strcat (newargz[0], "/");
4245 /* stop here, and copy so we don't have to do this twice */
4246 tmp_pathspec = xstrdup (newargz[0]);
4248 /* do NOT want the lt- prefix here, so use actual_cwrapper_name */
4249 strcat (newargz[0], actual_cwrapper_name);
4251 /* DO want the lt- prefix here if it exists, so use target_name */
4252 lt_argv_zero = lt_extend_str (tmp_pathspec, target_name, 1);
4253 XFREE (tmp_pathspec);
4254 tmp_pathspec = NULL;
4262 while ((p = strchr (newargz[0], '\\')) != NULL)
4266 while ((p = strchr (lt_argv_zero, '\\')) != NULL)
4276 XFREE (target_name);
4277 XFREE (actual_cwrapper_path);
4278 XFREE (actual_cwrapper_name);
4280 lt_setenv ("BIN_SH", "xpg4"); /* for Tru64 */
4281 lt_setenv ("DUALCASE", "1"); /* for MSK sh */
4282 lt_update_lib_path (LIB_PATH_VARNAME, LIB_PATH_VALUE);
4283 lt_update_exe_path (EXE_PATH_VARNAME, EXE_PATH_VALUE);
4285 lt_debugprintf (__FILE__, __LINE__, "(main) lt_argv_zero: %s\n",
4286 nonnull (lt_argv_zero));
4287 for (i = 0; i < newargc; i++)
4289 lt_debugprintf (__FILE__, __LINE__, "(main) newargz[%d]: %s\n",
4290 i, nonnull (newargz[i]));
4298 /* execv doesn't actually work on mingw as expected on unix */
4299 newargz = prepare_spawn (newargz);
4300 rval = _spawnv (_P_WAIT, lt_argv_zero, (const char * const *) newargz);
4303 /* failed to start process */
4304 lt_debugprintf (__FILE__, __LINE__,
4305 "(main) failed to launch target \"%s\": %s\n",
4306 lt_argv_zero, nonnull (strerror (errno)));
4314 execv (lt_argv_zero, newargz);
4315 return rval; /* =127, but avoids unused variable warning */
4324 xmalloc (size_t num)
4326 void *p = (void *) malloc (num);
4328 lt_fatal (__FILE__, __LINE__, "memory exhausted");
4334 xstrdup (const char *string)
4336 return string ? strcpy ((char *) xmalloc (strlen (string) + 1),
4341 base_name (const char *name)
4345 #if defined (HAVE_DOS_BASED_FILE_SYSTEM)
4346 /* Skip over the disk name in MSDOS pathnames. */
4347 if (isalpha ((unsigned char) name[0]) && name[1] == ':')
4351 for (base = name; *name; name++)
4352 if (IS_DIR_SEPARATOR (*name))
4358 check_executable (const char *path)
4362 lt_debugprintf (__FILE__, __LINE__, "(check_executable): %s\n",
4364 if ((!path) || (!*path))
4367 if ((stat (path, &st) >= 0)
4368 && (st.st_mode & (S_IXUSR | S_IXGRP | S_IXOTH)))
4375 make_executable (const char *path)
4380 lt_debugprintf (__FILE__, __LINE__, "(make_executable): %s\n",
4382 if ((!path) || (!*path))
4385 if (stat (path, &st) >= 0)
4387 rval = chmod (path, st.st_mode | S_IXOTH | S_IXGRP | S_IXUSR);
4392 /* Searches for the full path of the wrapper. Returns
4393 newly allocated full path name if found, NULL otherwise
4394 Does not chase symlinks, even on platforms that support them.
4397 find_executable (const char *wrapper)
4402 /* static buffer for getcwd */
4403 char tmp[LT_PATHMAX + 1];
4407 lt_debugprintf (__FILE__, __LINE__, "(find_executable): %s\n",
4408 nonempty (wrapper));
4410 if ((wrapper == NULL) || (*wrapper == '\0'))
4413 /* Absolute path? */
4414 #if defined (HAVE_DOS_BASED_FILE_SYSTEM)
4415 if (isalpha ((unsigned char) wrapper[0]) && wrapper[1] == ':')
4417 concat_name = xstrdup (wrapper);
4418 if (check_executable (concat_name))
4420 XFREE (concat_name);
4425 if (IS_DIR_SEPARATOR (wrapper[0]))
4427 concat_name = xstrdup (wrapper);
4428 if (check_executable (concat_name))
4430 XFREE (concat_name);
4432 #if defined (HAVE_DOS_BASED_FILE_SYSTEM)
4436 for (p = wrapper; *p; p++)
4444 /* no slashes; search PATH */
4445 const char *path = getenv ("PATH");
4448 for (p = path; *p; p = p_next)
4452 for (q = p; *q; q++)
4453 if (IS_PATH_SEPARATOR (*q))
4456 p_next = (*q == '\0' ? q : q + 1);
4459 /* empty path: current directory */
4460 if (getcwd (tmp, LT_PATHMAX) == NULL)
4461 lt_fatal (__FILE__, __LINE__, "getcwd failed: %s",
4462 nonnull (strerror (errno)));
4463 tmp_len = strlen (tmp);
4465 XMALLOC (char, tmp_len + 1 + strlen (wrapper) + 1);
4466 memcpy (concat_name, tmp, tmp_len);
4467 concat_name[tmp_len] = '/';
4468 strcpy (concat_name + tmp_len + 1, wrapper);
4473 XMALLOC (char, p_len + 1 + strlen (wrapper) + 1);
4474 memcpy (concat_name, p, p_len);
4475 concat_name[p_len] = '/';
4476 strcpy (concat_name + p_len + 1, wrapper);
4478 if (check_executable (concat_name))
4480 XFREE (concat_name);
4483 /* not found in PATH; assume curdir */
4485 /* Relative path | not found in path: prepend cwd */
4486 if (getcwd (tmp, LT_PATHMAX) == NULL)
4487 lt_fatal (__FILE__, __LINE__, "getcwd failed: %s",
4488 nonnull (strerror (errno)));
4489 tmp_len = strlen (tmp);
4490 concat_name = XMALLOC (char, tmp_len + 1 + strlen (wrapper) + 1);
4491 memcpy (concat_name, tmp, tmp_len);
4492 concat_name[tmp_len] = '/';
4493 strcpy (concat_name + tmp_len + 1, wrapper);
4495 if (check_executable (concat_name))
4497 XFREE (concat_name);
4502 chase_symlinks (const char *pathspec)
4505 return xstrdup (pathspec);
4507 char buf[LT_PATHMAX];
4509 char *tmp_pathspec = xstrdup (pathspec);
4511 int has_symlinks = 0;
4512 while (strlen (tmp_pathspec) && !has_symlinks)
4514 lt_debugprintf (__FILE__, __LINE__,
4515 "checking path component for symlinks: %s\n",
4517 if (lstat (tmp_pathspec, &s) == 0)
4519 if (S_ISLNK (s.st_mode) != 0)
4525 /* search backwards for last DIR_SEPARATOR */
4526 p = tmp_pathspec + strlen (tmp_pathspec) - 1;
4527 while ((p > tmp_pathspec) && (!IS_DIR_SEPARATOR (*p)))
4529 if ((p == tmp_pathspec) && (!IS_DIR_SEPARATOR (*p)))
4531 /* no more DIR_SEPARATORS left */
4538 lt_fatal (__FILE__, __LINE__,
4539 "error accessing file \"%s\": %s",
4540 tmp_pathspec, nonnull (strerror (errno)));
4543 XFREE (tmp_pathspec);
4547 return xstrdup (pathspec);
4550 tmp_pathspec = realpath (pathspec, buf);
4551 if (tmp_pathspec == 0)
4553 lt_fatal (__FILE__, __LINE__,
4554 "could not follow symlinks for %s", pathspec);
4556 return xstrdup (tmp_pathspec);
4561 strendzap (char *str, const char *pat)
4565 assert (str != NULL);
4566 assert (pat != NULL);
4569 patlen = strlen (pat);
4573 str += len - patlen;
4574 if (strcmp (str, pat) == 0)
4581 lt_debugprintf (const char *file, int line, const char *fmt, ...)
4586 (void) fprintf (stderr, "%s:%s:%d: ", program_name, file, line);
4587 va_start (args, fmt);
4588 (void) vfprintf (stderr, fmt, args);
4594 lt_error_core (int exit_status, const char *file,
4595 int line, const char *mode,
4596 const char *message, va_list ap)
4598 fprintf (stderr, "%s:%s:%d: %s: ", program_name, file, line, mode);
4599 vfprintf (stderr, message, ap);
4600 fprintf (stderr, ".\n");
4602 if (exit_status >= 0)
4607 lt_fatal (const char *file, int line, const char *message, ...)
4610 va_start (ap, message);
4611 lt_error_core (EXIT_FAILURE, file, line, "FATAL", message, ap);
4616 nonnull (const char *s)
4618 return s ? s : "(null)";
4622 nonempty (const char *s)
4624 return (s && !*s) ? "(empty)" : nonnull (s);
4628 lt_setenv (const char *name, const char *value)
4630 lt_debugprintf (__FILE__, __LINE__,
4631 "(lt_setenv) setting '%s' to '%s'\n",
4632 nonnull (name), nonnull (value));
4635 /* always make a copy, for consistency with !HAVE_SETENV */
4636 char *str = xstrdup (value);
4637 setenv (name, str, 1);
4639 int len = strlen (name) + 1 + strlen (value) + 1;
4640 char *str = XMALLOC (char, len);
4641 sprintf (str, "%s=%s", name, value);
4642 if (putenv (str) != EXIT_SUCCESS)
4651 lt_extend_str (const char *orig_value, const char *add, int to_end)
4654 if (orig_value && *orig_value)
4656 int orig_value_len = strlen (orig_value);
4657 int add_len = strlen (add);
4658 new_value = XMALLOC (char, add_len + orig_value_len + 1);
4661 strcpy (new_value, orig_value);
4662 strcpy (new_value + orig_value_len, add);
4666 strcpy (new_value, add);
4667 strcpy (new_value + add_len, orig_value);
4672 new_value = xstrdup (add);
4678 lt_update_exe_path (const char *name, const char *value)
4680 lt_debugprintf (__FILE__, __LINE__,
4681 "(lt_update_exe_path) modifying '%s' by prepending '%s'\n",
4682 nonnull (name), nonnull (value));
4684 if (name && *name && value && *value)
4686 char *new_value = lt_extend_str (getenv (name), value, 0);
4687 /* some systems can't cope with a ':'-terminated path #' */
4688 int len = strlen (new_value);
4689 while (((len = strlen (new_value)) > 0) && IS_PATH_SEPARATOR (new_value[len-1]))
4691 new_value[len-1] = '\0';
4693 lt_setenv (name, new_value);
4699 lt_update_lib_path (const char *name, const char *value)
4701 lt_debugprintf (__FILE__, __LINE__,
4702 "(lt_update_lib_path) modifying '%s' by prepending '%s'\n",
4703 nonnull (name), nonnull (value));
4705 if (name && *name && value && *value)
4707 char *new_value = lt_extend_str (getenv (name), value, 0);
4708 lt_setenv (name, new_value);
4718 /* Prepares an argument vector before calling spawn().
4719 Note that spawn() does not by itself call the command interpreter
4720 (getenv ("COMSPEC") != NULL ? getenv ("COMSPEC") :
4721 ({ OSVERSIONINFO v; v.dwOSVersionInfoSize = sizeof(OSVERSIONINFO);
4723 v.dwPlatformId == VER_PLATFORM_WIN32_NT;
4724 }) ? "cmd.exe" : "command.com").
4725 Instead it simply concatenates the arguments, separated by ' ', and calls
4726 CreateProcess(). We must quote the arguments since Win32 CreateProcess()
4727 interprets characters like ' ', '\t', '\\', '"' (but not '<' and '>') in a
4729 - Space and tab are interpreted as delimiters. They are not treated as
4730 delimiters if they are surrounded by double quotes: "...".
4731 - Unescaped double quotes are removed from the input. Their only effect is
4732 that within double quotes, space and tab are treated like normal
4734 - Backslashes not followed by double quotes are not special.
4735 - But 2*n+1 backslashes followed by a double quote become
4736 n backslashes followed by a double quote (n >= 0):
4741 #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"
4742 #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"
4744 prepare_spawn (char **argv)
4750 /* Count number of arguments. */
4751 for (argc = 0; argv[argc] != NULL; argc++)
4754 /* Allocate new argument vector. */
4755 new_argv = XMALLOC (char *, argc + 1);
4757 /* Put quoted arguments into the new argument vector. */
4758 for (i = 0; i < argc; i++)
4760 const char *string = argv[i];
4762 if (string[0] == '\0')
4763 new_argv[i] = xstrdup ("\"\"");
4764 else if (strpbrk (string, SHELL_SPECIAL_CHARS) != NULL)
4766 int quote_around = (strpbrk (string, SHELL_SPACE_CHARS) != NULL);
4768 unsigned int backslashes;
4770 char *quoted_string;
4777 for (s = string; *s != '\0'; s++)
4781 length += backslashes + 1;
4789 length += backslashes + 1;
4791 quoted_string = XMALLOC (char, length + 1);
4797 for (s = string; *s != '\0'; s++)
4803 for (j = backslashes + 1; j > 0; j--)
4815 for (j = backslashes; j > 0; j--)
4821 new_argv[i] = quoted_string;
4824 new_argv[i] = (char *) string;
4826 new_argv[argc] = NULL;
4835 void lt_dump_script (FILE* f)
4838 func_emit_wrapper yes |
4839 $SED -e 's/\([\\"]\)/\\\1/g' \
4840 -e 's/^/ fputs ("/' -e 's/$/\\n", f);/'
4846 # end: func_emit_cwrapperexe_src
4848 # func_win32_import_lib_p ARG
4849 # True if ARG is an import lib, as indicated by $file_magic_cmd
4850 func_win32_import_lib_p ()
4853 case `eval $file_magic_cmd \"\$1\" 2>/dev/null | $SED -e 10q` in
4859 # func_mode_link arg...
4864 *-*-cygwin* | *-*-mingw* | *-*-pw32* | *-*-os2* | *-cegcc*)
4865 # It is impossible to link a dll without this setting, and
4866 # we shouldn't force the makefile maintainer to figure out
4867 # which system we are compiling for in order to pass an extra
4868 # flag for every libtool invocation.
4869 # allow_undefined=no
4871 # FIXME: Unfortunately, there are problems with the above when trying
4872 # to make a dll which has undefined symbols, in which case not
4873 # even a static library is built. For now, we need to specify
4874 # -no-undefined on the libtool link line when we can be certain
4875 # that all symbols are satisfied, otherwise we get a static library.
4882 libtool_args=$nonopt
4883 base_compile="$nonopt $@"
4884 compile_command=$nonopt
4885 finalize_command=$nonopt
4898 lib_search_path=`pwd`
4900 new_inherited_linker_flags=
4909 export_symbols_regex=
4917 precious_files_regex=
4918 prefer_static_libs=no
4931 single_module="${wl}-single_module"
4932 func_infer_tag $base_compile
4934 # We need to know -static, to get the right output filenames.
4939 test "$build_libtool_libs" != yes && \
4940 func_fatal_configuration "can not build a shared library"
4944 -all-static | -static | -static-libtool-libs)
4947 if test "$build_libtool_libs" = yes && test -z "$link_static_flag"; then
4948 func_warning "complete static linking is impossible in this configuration"
4950 if test -n "$link_static_flag"; then
4951 dlopen_self=$dlopen_self_static
4953 prefer_static_libs=yes
4956 if test -z "$pic_flag" && test -n "$link_static_flag"; then
4957 dlopen_self=$dlopen_self_static
4959 prefer_static_libs=built
4961 -static-libtool-libs)
4962 if test -z "$pic_flag" && test -n "$link_static_flag"; then
4963 dlopen_self=$dlopen_self_static
4965 prefer_static_libs=yes
4968 build_libtool_libs=no
4975 # See if our shared archives depend on static archives.
4976 test -n "$old_archive_from_new_cmds" && build_old_libs=yes
4978 # Go through the arguments, transforming them on the way.
4979 while test "$#" -gt 0; do
4982 func_quote_for_eval "$arg"
4983 qarg=$func_quote_for_eval_unquoted_result
4984 func_append libtool_args " $func_quote_for_eval_result"
4986 # If the previous option needs an argument, assign it.
4987 if test -n "$prev"; then
4990 func_append compile_command " @OUTPUT@"
4991 func_append finalize_command " @OUTPUT@"
5002 if test "$preload" = no; then
5003 # Add the symbol object into the linking commands.
5004 func_append compile_command " @SYMFILE@"
5005 func_append finalize_command " @SYMFILE@"
5009 *.la | *.lo) ;; # We handle these cases below.
5011 if test "$dlself" = no; then
5019 if test "$prev" = dlprefiles; then
5021 elif test "$prev" = dlfiles && test "$dlopen_self" != yes; then
5031 if test "$prev" = dlfiles; then
5032 dlfiles="$dlfiles $arg"
5034 dlprefiles="$dlprefiles $arg"
5042 export_symbols="$arg"
5044 || func_fatal_error "symbol file \`$arg' does not exist"
5049 export_symbols_regex="$arg"
5057 *" $qarg.ltframework "*) ;;
5058 *) deplibs="$deplibs $qarg.ltframework" # this is fixed later
5067 inst_prefix_dir="$arg"
5072 if test -f "$arg"; then
5075 for fil in `cat "$save_arg"`
5077 # moreargs="$moreargs $fil"
5079 # A libtool-controlled object.
5081 # Check to see that this really is a libtool object.
5082 if func_lalib_unsafe_p "$arg"; then
5089 if test -z "$pic_object" ||
5090 test -z "$non_pic_object" ||
5091 test "$pic_object" = none &&
5092 test "$non_pic_object" = none; then
5093 func_fatal_error "cannot find name of object for \`$arg'"
5096 # Extract subdirectory from the argument.
5097 func_dirname "$arg" "/" ""
5098 xdir="$func_dirname_result"
5100 if test "$pic_object" != none; then
5101 # Prepend the subdirectory the object is found in.
5102 pic_object="$xdir$pic_object"
5104 if test "$prev" = dlfiles; then
5105 if test "$build_libtool_libs" = yes && test "$dlopen_support" = yes; then
5106 dlfiles="$dlfiles $pic_object"
5110 # If libtool objects are unsupported, then we need to preload.
5115 # CHECK ME: I think I busted this. -Ossama
5116 if test "$prev" = dlprefiles; then
5117 # Preload the old-style object.
5118 dlprefiles="$dlprefiles $pic_object"
5123 func_append libobjs " $pic_object"
5128 if test "$non_pic_object" != none; then
5129 # Prepend the subdirectory the object is found in.
5130 non_pic_object="$xdir$non_pic_object"
5132 # A standard non-PIC object
5133 func_append non_pic_objects " $non_pic_object"
5134 if test -z "$pic_object" || test "$pic_object" = none ; then
5135 arg="$non_pic_object"
5138 # If the PIC object exists, use it instead.
5139 # $xdir was prepended to $pic_object above.
5140 non_pic_object="$pic_object"
5141 func_append non_pic_objects " $non_pic_object"
5144 # Only an error if not doing a dry-run.
5145 if $opt_dry_run; then
5146 # Extract subdirectory from the argument.
5147 func_dirname "$arg" "/" ""
5148 xdir="$func_dirname_result"
5151 pic_object=$xdir$objdir/$func_lo2o_result
5152 non_pic_object=$xdir$func_lo2o_result
5153 func_append libobjs " $pic_object"
5154 func_append non_pic_objects " $non_pic_object"
5156 func_fatal_error "\`$arg' is not a valid libtool object"
5161 func_fatal_error "link input file \`$arg' does not exist"
5168 precious_files_regex="$arg"
5178 # We need an absolute path.
5180 [\\/]* | [A-Za-z]:[\\/]*) ;;
5182 func_fatal_error "only absolute run-paths are allowed"
5185 if test "$prev" = rpath; then
5188 *) rpath="$rpath $arg" ;;
5193 *) xrpath="$xrpath $arg" ;;
5205 weak_libs="$weak_libs $arg"
5210 linker_flags="$linker_flags $qarg"
5211 compiler_flags="$compiler_flags $qarg"
5213 func_append compile_command " $qarg"
5214 func_append finalize_command " $qarg"
5218 compiler_flags="$compiler_flags $qarg"
5220 func_append compile_command " $qarg"
5221 func_append finalize_command " $qarg"
5225 linker_flags="$linker_flags $qarg"
5226 compiler_flags="$compiler_flags $wl$qarg"
5228 func_append compile_command " $wl$qarg"
5229 func_append finalize_command " $wl$qarg"
5233 eval "$prev=\"\$arg\""
5238 fi # test -n "$prev"
5244 if test -n "$link_static_flag"; then
5245 # See comment for -static flag below, for more details.
5246 func_append compile_command " $link_static_flag"
5247 func_append finalize_command " $link_static_flag"
5253 # FIXME: remove this flag sometime in the future.
5254 func_fatal_error "\`-allow-undefined' must not be used because it is the default"
5282 -export-symbols | -export-symbols-regex)
5283 if test -n "$export_symbols" || test -n "$export_symbols_regex"; then
5284 func_fatal_error "more than one -exported-symbols argument is not allowed"
5286 if test "X$arg" = "X-export-symbols"; then
5304 # The native IRIX linker understands -LANG:*, -LIST:* and -LNO:*
5305 # so, if we see these flags be careful not to treat them like -L
5307 case $with_gcc/$host in
5308 no/*-*-irix* | /*-*-irix*)
5309 func_append compile_command " $arg"
5310 func_append finalize_command " $arg"
5317 func_stripname '-L' '' "$arg"
5318 dir=$func_stripname_result
5319 if test -z "$dir"; then
5320 if test "$#" -gt 0; then
5321 func_fatal_error "require no space between \`-L' and \`$1'"
5323 func_fatal_error "need path for \`-L' option"
5326 # We need an absolute path.
5328 [\\/]* | [A-Za-z]:[\\/]*) ;;
5330 absdir=`cd "$dir" && pwd`
5331 test -z "$absdir" && \
5332 func_fatal_error "cannot determine absolute directory name of \`$dir'"
5339 deplibs="$deplibs -L$dir"
5340 lib_search_path="$lib_search_path $dir"
5344 *-*-cygwin* | *-*-mingw* | *-*-pw32* | *-*-os2* | *-cegcc*)
5345 testbindir=`$ECHO "$dir" | $SED 's*/lib$*/bin*'`
5346 case :$dllsearchpath: in
5348 ::) dllsearchpath=$dir;;
5349 *) dllsearchpath="$dllsearchpath:$dir";;
5351 case :$dllsearchpath: in
5352 *":$testbindir:"*) ;;
5353 ::) dllsearchpath=$testbindir;;
5354 *) dllsearchpath="$dllsearchpath:$testbindir";;
5362 if test "X$arg" = "X-lc" || test "X$arg" = "X-lm"; then
5364 *-*-cygwin* | *-*-mingw* | *-*-pw32* | *-*-beos* | *-cegcc* | *-*-haiku*)
5365 # These systems don't actually have a C or math library (as such)
5369 # These systems don't actually have a C library (as such)
5370 test "X$arg" = "X-lc" && continue
5372 *-*-openbsd* | *-*-freebsd* | *-*-dragonfly*)
5373 # Do not include libc due to us having libc/libc_r.
5374 test "X$arg" = "X-lc" && continue
5376 *-*-rhapsody* | *-*-darwin1.[012])
5377 # Rhapsody C and math libraries are in the System framework
5378 deplibs="$deplibs System.ltframework"
5381 *-*-sco3.2v5* | *-*-sco5v6*)
5382 # Causes problems with __ctype
5383 test "X$arg" = "X-lc" && continue
5385 *-*-sysv4.2uw2* | *-*-sysv5* | *-*-unixware* | *-*-OpenUNIX*)
5386 # Compiler inserts libc in the correct place for threads to work
5387 test "X$arg" = "X-lc" && continue
5390 elif test "X$arg" = "X-lc_r"; then
5392 *-*-openbsd* | *-*-freebsd* | *-*-dragonfly*)
5393 # Do not include libc_r directly, use -pthread flag.
5398 deplibs="$deplibs $arg"
5407 # Tru64 UNIX uses -model [arg] to determine the layout of C++
5408 # classes, name mangling, and exception handling.
5409 # Darwin uses the -arch flag to determine output architecture.
5410 -model|-arch|-isysroot)
5411 compiler_flags="$compiler_flags $arg"
5412 func_append compile_command " $arg"
5413 func_append finalize_command " $arg"
5418 -mt|-mthreads|-kthread|-Kthread|-pthread|-pthreads|--thread-safe|-threads)
5419 compiler_flags="$compiler_flags $arg"
5420 func_append compile_command " $arg"
5421 func_append finalize_command " $arg"
5422 case "$new_inherited_linker_flags " in
5424 * ) new_inherited_linker_flags="$new_inherited_linker_flags $arg" ;;
5430 single_module="${wl}-multi_module"
5441 *-*-cygwin* | *-*-mingw* | *-*-pw32* | *-*-os2* | *-*-darwin* | *-cegcc*)
5442 # The PATH hackery in wrapper scripts is required on Windows
5443 # and Darwin in order for the loader to find any dlls it needs.
5444 func_warning "\`-no-install' is ignored for $host"
5445 func_warning "assuming \`-no-fast-install' instead"
5448 *) no_install=yes ;;
5465 -precious-files-regex)
5486 func_stripname '-R' '' "$arg"
5487 dir=$func_stripname_result
5488 # We need an absolute path.
5490 [\\/]* | [A-Za-z]:[\\/]*) ;;
5492 func_fatal_error "only absolute run-paths are allowed"
5497 *) xrpath="$xrpath $dir" ;;
5503 # The effects of -shared are defined in a previous loop.
5512 -static | -static-libtool-libs)
5513 # The effects of -static are defined in a previous loop.
5514 # We used to do the same as -all-static on platforms that
5515 # didn't have a PIC flag, but the assumption that the effects
5516 # would be equivalent was wrong. It would break on at least
5517 # Digital Unix and AIX.
5543 func_stripname '-Wc,' '' "$arg"
5544 args=$func_stripname_result
5546 save_ifs="$IFS"; IFS=','
5547 for flag in $args; do
5549 func_quote_for_eval "$flag"
5550 arg="$arg $func_quote_for_eval_result"
5551 compiler_flags="$compiler_flags $func_quote_for_eval_result"
5554 func_stripname ' ' '' "$arg"
5555 arg=$func_stripname_result
5559 func_stripname '-Wl,' '' "$arg"
5560 args=$func_stripname_result
5562 save_ifs="$IFS"; IFS=','
5563 for flag in $args; do
5565 func_quote_for_eval "$flag"
5566 arg="$arg $wl$func_quote_for_eval_result"
5567 compiler_flags="$compiler_flags $wl$func_quote_for_eval_result"
5568 linker_flags="$linker_flags $func_quote_for_eval_result"
5571 func_stripname ' ' '' "$arg"
5572 arg=$func_stripname_result
5592 func_quote_for_eval "$arg"
5593 arg="$func_quote_for_eval_result"
5596 # Flags to be passed through unchanged, with rationale:
5597 # -64, -mips[0-9] enable 64-bit mode for the SGI compiler
5598 # -r[0-9][0-9]* specify processor for the SGI compiler
5599 # -xarch=*, -xtarget=* enable 64-bit mode for the Sun compiler
5600 # +DA*, +DD* enable 64-bit mode for the HP compiler
5601 # -q* compiler args for the IBM compiler
5602 # -m*, -t[45]*, -txscale* architecture-specific flags for GCC
5603 # -F/path path to uninstalled frameworks, gcc on darwin
5604 # -p, -pg, --coverage, -fprofile-* profiling flags for GCC
5605 # @file GCC response files
5606 # -tp=* Portland pgcc target processor selection
5607 -64|-mips[0-9]|-r[0-9][0-9]*|-xarch=*|-xtarget=*|+DA*|+DD*|-q*|-m*| \
5608 -t[45]*|-txscale*|-p|-pg|--coverage|-fprofile-*|-F*|@*|-tp=*)
5609 func_quote_for_eval "$arg"
5610 arg="$func_quote_for_eval_result"
5611 func_append compile_command " $arg"
5612 func_append finalize_command " $arg"
5613 compiler_flags="$compiler_flags $arg"
5617 # Some other compiler flag.
5619 func_quote_for_eval "$arg"
5620 arg="$func_quote_for_eval_result"
5624 # A standard object.
5629 # A libtool-controlled object.
5631 # Check to see that this really is a libtool object.
5632 if func_lalib_unsafe_p "$arg"; then
5639 if test -z "$pic_object" ||
5640 test -z "$non_pic_object" ||
5641 test "$pic_object" = none &&
5642 test "$non_pic_object" = none; then
5643 func_fatal_error "cannot find name of object for \`$arg'"
5646 # Extract subdirectory from the argument.
5647 func_dirname "$arg" "/" ""
5648 xdir="$func_dirname_result"
5650 if test "$pic_object" != none; then
5651 # Prepend the subdirectory the object is found in.
5652 pic_object="$xdir$pic_object"
5654 if test "$prev" = dlfiles; then
5655 if test "$build_libtool_libs" = yes && test "$dlopen_support" = yes; then
5656 dlfiles="$dlfiles $pic_object"
5660 # If libtool objects are unsupported, then we need to preload.
5665 # CHECK ME: I think I busted this. -Ossama
5666 if test "$prev" = dlprefiles; then
5667 # Preload the old-style object.
5668 dlprefiles="$dlprefiles $pic_object"
5673 func_append libobjs " $pic_object"
5678 if test "$non_pic_object" != none; then
5679 # Prepend the subdirectory the object is found in.
5680 non_pic_object="$xdir$non_pic_object"
5682 # A standard non-PIC object
5683 func_append non_pic_objects " $non_pic_object"
5684 if test -z "$pic_object" || test "$pic_object" = none ; then
5685 arg="$non_pic_object"
5688 # If the PIC object exists, use it instead.
5689 # $xdir was prepended to $pic_object above.
5690 non_pic_object="$pic_object"
5691 func_append non_pic_objects " $non_pic_object"
5694 # Only an error if not doing a dry-run.
5695 if $opt_dry_run; then
5696 # Extract subdirectory from the argument.
5697 func_dirname "$arg" "/" ""
5698 xdir="$func_dirname_result"
5701 pic_object=$xdir$objdir/$func_lo2o_result
5702 non_pic_object=$xdir$func_lo2o_result
5703 func_append libobjs " $pic_object"
5704 func_append non_pic_objects " $non_pic_object"
5706 func_fatal_error "\`$arg' is not a valid libtool object"
5713 deplibs="$deplibs $arg"
5714 old_deplibs="$old_deplibs $arg"
5719 # A libtool-controlled library.
5721 if test "$prev" = dlfiles; then
5722 # This library was specified with -dlopen.
5723 dlfiles="$dlfiles $arg"
5725 elif test "$prev" = dlprefiles; then
5726 # The library was specified with -dlpreopen.
5727 dlprefiles="$dlprefiles $arg"
5730 deplibs="$deplibs $arg"
5735 # Some other compiler argument.
5737 # Unknown arguments in both finalize_command and compile_command need
5738 # to be aesthetically quoted because they are evaled later.
5739 func_quote_for_eval "$arg"
5740 arg="$func_quote_for_eval_result"
5744 # Now actually substitute the argument into the commands.
5745 if test -n "$arg"; then
5746 func_append compile_command " $arg"
5747 func_append finalize_command " $arg"
5749 done # argument parsing loop
5751 test -n "$prev" && \
5752 func_fatal_help "the \`$prevarg' option requires an argument"
5754 if test "$export_dynamic" = yes && test -n "$export_dynamic_flag_spec"; then
5755 eval arg=\"$export_dynamic_flag_spec\"
5756 func_append compile_command " $arg"
5757 func_append finalize_command " $arg"
5761 # calculate the name of the file, without its directory
5762 func_basename "$output"
5763 outputname="$func_basename_result"
5764 libobjs_save="$libobjs"
5766 if test -n "$shlibpath_var"; then
5767 # get the directories listed in $shlibpath_var
5768 eval shlib_search_path=\`\$ECHO \"\${$shlibpath_var}\" \| \$SED \'s/:/ /g\'\`
5772 eval sys_lib_search_path=\"$sys_lib_search_path_spec\"
5773 eval sys_lib_dlsearch_path=\"$sys_lib_dlsearch_path_spec\"
5775 func_dirname "$output" "/" ""
5776 output_objdir="$func_dirname_result$objdir"
5777 # Create the object directory.
5778 func_mkdir_p "$output_objdir"
5780 # Determine the type of output
5783 func_fatal_help "you must specify an output file"
5785 *.$libext) linkmode=oldlib ;;
5786 *.lo | *.$objext) linkmode=obj ;;
5787 *.la) linkmode=lib ;;
5788 *) linkmode=prog ;; # Anything else should be a program.
5794 # Find all interdependent deplibs by searching for libraries
5795 # that are linked more than once (e.g. -la -lb -la)
5796 for deplib in $deplibs; do
5797 if $opt_duplicate_deps ; then
5799 *" $deplib "*) specialdeplibs="$specialdeplibs $deplib" ;;
5802 libs="$libs $deplib"
5805 if test "$linkmode" = lib; then
5806 libs="$predeps $libs $compiler_lib_search_path $postdeps"
5808 # Compute libraries that are listed more than once in $predeps
5809 # $postdeps and mark them as special (i.e., whose duplicates are
5810 # not to be eliminated).
5812 if $opt_duplicate_compiler_generated_deps; then
5813 for pre_post_dep in $predeps $postdeps; do
5814 case "$pre_post_deps " in
5815 *" $pre_post_dep "*) specialdeplibs="$specialdeplibs $pre_post_deps" ;;
5817 pre_post_deps="$pre_post_deps $pre_post_dep"
5826 need_relink=no # whether we're linking any uninstalled libtool libraries
5827 notinst_deplibs= # not-installed libtool libraries
5828 notinst_path= # paths that contain not-installed libtool libraries
5832 passes="conv dlpreopen link"
5833 for file in $dlfiles $dlprefiles; do
5837 func_fatal_help "libraries can \`-dlopen' only libtool libraries: $file"
5848 passes="conv scan dlopen dlpreopen link"
5854 for pass in $passes; do
5855 # The preopen pass in lib mode reverses $deplibs; put it back here
5856 # so that -L comes before libs that need it for instance...
5857 if test "$linkmode,$pass" = "lib,link"; then
5858 ## FIXME: Find the place where the list is rebuilt in the wrong
5859 ## order, and fix it there properly
5861 for deplib in $deplibs; do
5862 tmp_deplibs="$deplib $tmp_deplibs"
5864 deplibs="$tmp_deplibs"
5867 if test "$linkmode,$pass" = "lib,link" ||
5868 test "$linkmode,$pass" = "prog,scan"; then
5872 if test "$linkmode" = prog; then
5874 dlopen) libs="$dlfiles" ;;
5875 dlpreopen) libs="$dlprefiles" ;;
5876 link) libs="$deplibs %DEPLIBS% $dependency_libs" ;;
5879 if test "$linkmode,$pass" = "lib,dlpreopen"; then
5880 # Collect and forward deplibs of preopened libtool libs
5881 for lib in $dlprefiles; do
5882 # Ignore non-libtool-libs
5885 *.la) func_source "$lib" ;;
5888 # Collect preopened libtool deplibs, except any this library
5889 # has declared as weak libs
5890 for deplib in $dependency_libs; do
5891 func_basename "$deplib"
5892 deplib_base=$func_basename_result
5893 case " $weak_libs " in
5894 *" $deplib_base "*) ;;
5895 *) deplibs="$deplibs $deplib" ;;
5901 if test "$pass" = dlopen; then
5902 # Collect dlpreopened libraries
5903 save_deplibs="$deplibs"
5907 for deplib in $libs; do
5911 -mt|-mthreads|-kthread|-Kthread|-pthread|-pthreads|--thread-safe|-threads)
5912 if test "$linkmode,$pass" = "prog,link"; then
5913 compile_deplibs="$deplib $compile_deplibs"
5914 finalize_deplibs="$deplib $finalize_deplibs"
5916 compiler_flags="$compiler_flags $deplib"
5917 if test "$linkmode" = lib ; then
5918 case "$new_inherited_linker_flags " in
5920 * ) new_inherited_linker_flags="$new_inherited_linker_flags $deplib" ;;
5927 if test "$linkmode" != lib && test "$linkmode" != prog; then
5928 func_warning "\`-l' is ignored for archives/objects"
5931 func_stripname '-l' '' "$deplib"
5932 name=$func_stripname_result
5933 if test "$linkmode" = lib; then
5934 searchdirs="$newlib_search_path $lib_search_path $compiler_lib_search_dirs $sys_lib_search_path $shlib_search_path"
5936 searchdirs="$newlib_search_path $lib_search_path $sys_lib_search_path $shlib_search_path"
5938 for searchdir in $searchdirs; do
5939 for search_ext in .la $std_shrext .so .a; do
5940 # Search the libtool library
5941 lib="$searchdir/lib${name}${search_ext}"
5942 if test -f "$lib"; then
5943 if test "$search_ext" = ".la"; then
5952 if test "$found" != yes; then
5953 # deplib doesn't seem to be a libtool library
5954 if test "$linkmode,$pass" = "prog,link"; then
5955 compile_deplibs="$deplib $compile_deplibs"
5956 finalize_deplibs="$deplib $finalize_deplibs"
5958 deplibs="$deplib $deplibs"
5959 test "$linkmode" = lib && newdependency_libs="$deplib $newdependency_libs"
5962 else # deplib is a libtool library
5963 # If $allow_libtool_libs_with_static_runtimes && $deplib is a stdlib,
5964 # We need to do some special things here, and not later.
5965 if test "X$allow_libtool_libs_with_static_runtimes" = "Xyes" ; then
5966 case " $predeps $postdeps " in
5968 if func_lalib_p "$lib"; then
5972 for l in $old_library $library_names; do
5975 if test "X$ll" = "X$old_library" ; then # only static version available
5977 func_dirname "$lib" "" "."
5978 ladir="$func_dirname_result"
5979 lib=$ladir/$old_library
5980 if test "$linkmode,$pass" = "prog,link"; then
5981 compile_deplibs="$deplib $compile_deplibs"
5982 finalize_deplibs="$deplib $finalize_deplibs"
5984 deplibs="$deplib $deplibs"
5985 test "$linkmode" = lib && newdependency_libs="$deplib $newdependency_libs"
5997 if test "$linkmode,$pass" = "prog,link"; then
5998 compile_deplibs="$deplib $compile_deplibs"
5999 finalize_deplibs="$deplib $finalize_deplibs"
6001 deplibs="$deplib $deplibs"
6002 if test "$linkmode" = lib ; then
6003 case "$new_inherited_linker_flags " in
6005 * ) new_inherited_linker_flags="$new_inherited_linker_flags $deplib" ;;
6014 deplibs="$deplib $deplibs"
6015 test "$pass" = conv && continue
6016 newdependency_libs="$deplib $newdependency_libs"
6017 func_stripname '-L' '' "$deplib"
6018 newlib_search_path="$newlib_search_path $func_stripname_result"
6021 if test "$pass" = conv; then
6022 deplibs="$deplib $deplibs"
6025 if test "$pass" = scan; then
6026 deplibs="$deplib $deplibs"
6028 compile_deplibs="$deplib $compile_deplibs"
6029 finalize_deplibs="$deplib $finalize_deplibs"
6031 func_stripname '-L' '' "$deplib"
6032 newlib_search_path="$newlib_search_path $func_stripname_result"
6035 func_warning "\`-L' is ignored for archives/objects"
6041 if test "$pass" = link; then
6042 func_stripname '-R' '' "$deplib"
6043 dir=$func_stripname_result
6044 # Make sure the xrpath contains only unique directories.
6047 *) xrpath="$xrpath $dir" ;;
6050 deplibs="$deplib $deplibs"
6053 *.la) lib="$deplib" ;;
6055 if test "$pass" = conv; then
6056 deplibs="$deplib $deplibs"
6061 # Linking convenience modules into shared libraries is allowed,
6062 # but linking other static libraries is non-portable.
6063 case " $dlpreconveniencelibs " in
6067 case $deplibs_check_method in
6069 set dummy $deplibs_check_method; shift
6070 match_pattern_regex=`expr "$deplibs_check_method" : "$1 \(.*\)"`
6071 if eval "\$ECHO \"$deplib\"" 2>/dev/null | $SED 10q \
6072 | $EGREP "$match_pattern_regex" > /dev/null; then
6080 if test "$valid_a_lib" != yes; then
6082 $ECHO "*** Warning: Trying to link with static lib archive $deplib."
6083 echo "*** I have the capability to make that library automatically link in when"
6084 echo "*** you link to this library. But I can only do this if you have a"
6085 echo "*** shared version of the library, which you do not appear to have"
6086 echo "*** because the file extensions .$libext of this argument makes me believe"
6087 echo "*** that it is just a static archive that I should not use here."
6090 $ECHO "*** Warning: Linking the shared library $output against the"
6091 $ECHO "*** static library $deplib is not portable!"
6092 deplibs="$deplib $deplibs"
6099 if test "$pass" != link; then
6100 deplibs="$deplib $deplibs"
6102 compile_deplibs="$deplib $compile_deplibs"
6103 finalize_deplibs="$deplib $finalize_deplibs"
6110 if test "$pass" = conv; then
6111 deplibs="$deplib $deplibs"
6112 elif test "$linkmode" = prog; then
6113 if test "$pass" = dlpreopen || test "$dlopen_support" != yes || test "$build_libtool_libs" = no; then
6114 # If there is no dlopen support or we're linking statically,
6115 # we need to preload.
6116 newdlprefiles="$newdlprefiles $deplib"
6117 compile_deplibs="$deplib $compile_deplibs"
6118 finalize_deplibs="$deplib $finalize_deplibs"
6120 newdlfiles="$newdlfiles $deplib"
6131 if test "$found" = yes || test -f "$lib"; then :
6133 func_fatal_error "cannot find the library \`$lib' or unhandled argument \`$deplib'"
6136 # Check to see that this really is a libtool archive.
6137 func_lalib_unsafe_p "$lib" \
6138 || func_fatal_error "\`$lib' is not a valid libtool archive"
6140 func_dirname "$lib" "" "."
6141 ladir="$func_dirname_result"
6149 inherited_linker_flags=
6150 # If the library was installed with an old release of libtool,
6151 # it will not redefine variables installed, or shouldnotlink
6160 # Convert "-framework foo" to "foo.ltframework"
6161 if test -n "$inherited_linker_flags"; then
6162 tmp_inherited_linker_flags=`$ECHO "$inherited_linker_flags" | $SED 's/-framework \([^ $]*\)/\1.ltframework/g'`
6163 for tmp_inherited_linker_flag in $tmp_inherited_linker_flags; do
6164 case " $new_inherited_linker_flags " in
6165 *" $tmp_inherited_linker_flag "*) ;;
6166 *) new_inherited_linker_flags="$new_inherited_linker_flags $tmp_inherited_linker_flag";;
6170 dependency_libs=`$ECHO " $dependency_libs" | $SED 's% \([^ $]*\).ltframework% -framework \1%g'`
6171 if test "$linkmode,$pass" = "lib,link" ||
6172 test "$linkmode,$pass" = "prog,scan" ||
6173 { test "$linkmode" != prog && test "$linkmode" != lib; }; then
6174 test -n "$dlopen" && dlfiles="$dlfiles $dlopen"
6175 test -n "$dlpreopen" && dlprefiles="$dlprefiles $dlpreopen"
6178 if test "$pass" = conv; then
6179 # Only check for convenience libraries
6180 deplibs="$lib $deplibs"
6181 if test -z "$libdir"; then
6182 if test -z "$old_library"; then
6183 func_fatal_error "cannot find name of link library for \`$lib'"
6185 # It is a libtool convenience library, so add in its objects.
6186 convenience="$convenience $ladir/$objdir/$old_library"
6187 old_convenience="$old_convenience $ladir/$objdir/$old_library"
6188 elif test "$linkmode" != prog && test "$linkmode" != lib; then
6189 func_fatal_error "\`$lib' is not a convenience library"
6192 for deplib in $dependency_libs; do
6193 deplibs="$deplib $deplibs"
6194 if $opt_duplicate_deps ; then
6195 case "$tmp_libs " in
6196 *" $deplib "*) specialdeplibs="$specialdeplibs $deplib" ;;
6199 tmp_libs="$tmp_libs $deplib"
6205 # Get the name of the library we link against.
6207 for l in $old_library $library_names; do
6210 if test -z "$linklib"; then
6211 func_fatal_error "cannot find name of link library for \`$lib'"
6214 # This library was specified with -dlopen.
6215 if test "$pass" = dlopen; then
6216 if test -z "$libdir"; then
6217 func_fatal_error "cannot -dlopen a convenience library: \`$lib'"
6219 if test -z "$dlname" ||
6220 test "$dlopen_support" != yes ||
6221 test "$build_libtool_libs" = no; then
6222 # If there is no dlname, no dlopen support or we're linking
6223 # statically, we need to preload. We also need to preload any
6224 # dependent libraries so libltdl's deplib preloader doesn't
6225 # bomb out in the load deplibs phase.
6226 dlprefiles="$dlprefiles $lib $dependency_libs"
6228 newdlfiles="$newdlfiles $lib"
6233 # We need an absolute path.
6235 [\\/]* | [A-Za-z]:[\\/]*) abs_ladir="$ladir" ;;
6237 abs_ladir=`cd "$ladir" && pwd`
6238 if test -z "$abs_ladir"; then
6239 func_warning "cannot determine absolute directory name of \`$ladir'"
6240 func_warning "passing it literally to the linker, although it might fail"
6245 func_basename "$lib"
6246 laname="$func_basename_result"
6248 # Find the relevant object directory and library name.
6249 if test "X$installed" = Xyes; then
6250 if test ! -f "$libdir/$linklib" && test -f "$abs_ladir/$linklib"; then
6251 func_warning "library \`$lib' was moved."
6259 test "X$hardcode_automatic" = Xyes && avoidtemprpath=yes
6261 if test ! -f "$ladir/$objdir/$linklib" && test -f "$abs_ladir/$linklib"; then
6264 # Remove this search path later
6265 notinst_path="$notinst_path $abs_ladir"
6267 dir="$ladir/$objdir"
6268 absdir="$abs_ladir/$objdir"
6269 # Remove this search path later
6270 notinst_path="$notinst_path $abs_ladir"
6272 fi # $installed = yes
6273 func_stripname 'lib' '.la' "$laname"
6274 name=$func_stripname_result
6276 # This library was specified with -dlpreopen.
6277 if test "$pass" = dlpreopen; then
6278 if test -z "$libdir" && test "$linkmode" = prog; then
6279 func_fatal_error "only libraries may -dlpreopen a convenience library: \`$lib'"
6281 # Prefer using a static library (so that no silly _DYNAMIC symbols
6282 # are required to link).
6283 if test -n "$old_library"; then
6284 newdlprefiles="$newdlprefiles $dir/$old_library"
6285 # Keep a list of preopened convenience libraries to check
6286 # that they are being used correctly in the link pass.
6287 test -z "$libdir" && \
6288 dlpreconveniencelibs="$dlpreconveniencelibs $dir/$old_library"
6289 # Otherwise, use the dlname, so that lt_dlopen finds it.
6290 elif test -n "$dlname"; then
6291 newdlprefiles="$newdlprefiles $dir/$dlname"
6293 newdlprefiles="$newdlprefiles $dir/$linklib"
6295 fi # $pass = dlpreopen
6297 if test -z "$libdir"; then
6298 # Link the convenience library
6299 if test "$linkmode" = lib; then
6300 deplibs="$dir/$old_library $deplibs"
6301 elif test "$linkmode,$pass" = "prog,link"; then
6302 compile_deplibs="$dir/$old_library $compile_deplibs"
6303 finalize_deplibs="$dir/$old_library $finalize_deplibs"
6305 deplibs="$lib $deplibs" # used for prog,scan pass
6311 if test "$linkmode" = prog && test "$pass" != link; then
6312 newlib_search_path="$newlib_search_path $ladir"
6313 deplibs="$lib $deplibs"
6316 if test "$link_all_deplibs" != no || test -z "$library_names" ||
6317 test "$build_libtool_libs" = no; then
6322 for deplib in $dependency_libs; do
6324 -L*) func_stripname '-L' '' "$deplib"
6325 newlib_search_path="$newlib_search_path $func_stripname_result"
6328 # Need to link against all dependency_libs?
6329 if test "$linkalldeplibs" = yes; then
6330 deplibs="$deplib $deplibs"
6332 # Need to hardcode shared library paths
6333 # or/and link against static libraries
6334 newdependency_libs="$deplib $newdependency_libs"
6336 if $opt_duplicate_deps ; then
6337 case "$tmp_libs " in
6338 *" $deplib "*) specialdeplibs="$specialdeplibs $deplib" ;;
6341 tmp_libs="$tmp_libs $deplib"
6344 fi # $linkmode = prog...
6346 if test "$linkmode,$pass" = "prog,link"; then
6347 if test -n "$library_names" &&
6348 { { test "$prefer_static_libs" = no ||
6349 test "$prefer_static_libs,$installed" = "built,yes"; } ||
6350 test -z "$old_library"; }; then
6351 # We need to hardcode the library path
6352 if test -n "$shlibpath_var" && test -z "$avoidtemprpath" ; then
6353 # Make sure the rpath contains only unique directories.
6354 case "$temp_rpath:" in
6356 *) temp_rpath="$temp_rpath$absdir:" ;;
6360 # Hardcode the library path.
6361 # Skip directories that are in the system default run-time
6363 case " $sys_lib_dlsearch_path " in
6366 case "$compile_rpath " in
6368 *) compile_rpath="$compile_rpath $absdir"
6372 case " $sys_lib_dlsearch_path " in
6375 case "$finalize_rpath " in
6377 *) finalize_rpath="$finalize_rpath $libdir"
6381 fi # $linkmode,$pass = prog,link...
6383 if test "$alldeplibs" = yes &&
6384 { test "$deplibs_check_method" = pass_all ||
6385 { test "$build_libtool_libs" = yes &&
6386 test -n "$library_names"; }; }; then
6387 # We only need to search for static libraries
6392 link_static=no # Whether the deplib will be linked statically
6393 use_static_libs=$prefer_static_libs
6394 if test "$use_static_libs" = built && test "$installed" = yes; then
6397 if test -n "$library_names" &&
6398 { test "$use_static_libs" = no || test -z "$old_library"; }; then
6400 *cygwin* | *mingw* | *cegcc*)
6401 # No point in relinking DLLs because paths are not encoded
6402 notinst_deplibs="$notinst_deplibs $lib"
6406 if test "$installed" = no; then
6407 notinst_deplibs="$notinst_deplibs $lib"
6412 # This is a shared library
6414 # Warn about portability, can't link against -module's on some
6415 # systems (darwin). Don't bleat about dlopened modules though!
6417 for dlpremoduletest in $dlprefiles; do
6418 if test "X$dlpremoduletest" = "X$lib"; then
6419 dlopenmodule="$dlpremoduletest"
6423 if test -z "$dlopenmodule" && test "$shouldnotlink" = yes && test "$pass" = link; then
6425 if test "$linkmode" = prog; then
6426 $ECHO "*** Warning: Linking the executable $output against the loadable module"
6428 $ECHO "*** Warning: Linking the shared library $output against the loadable module"
6430 $ECHO "*** $linklib is not portable!"
6432 if test "$linkmode" = lib &&
6433 test "$hardcode_into_libs" = yes; then
6434 # Hardcode the library path.
6435 # Skip directories that are in the system default run-time
6437 case " $sys_lib_dlsearch_path " in
6440 case "$compile_rpath " in
6442 *) compile_rpath="$compile_rpath $absdir"
6446 case " $sys_lib_dlsearch_path " in
6449 case "$finalize_rpath " in
6451 *) finalize_rpath="$finalize_rpath $libdir"
6457 if test -n "$old_archive_from_expsyms_cmds"; then
6458 # figure out the soname
6459 set dummy $library_names
6463 libname=`eval "\\$ECHO \"$libname_spec\""`
6464 # use dlname if we got it. it's perfectly good, no?
6465 if test -n "$dlname"; then
6467 elif test -n "$soname_spec"; then
6470 *cygwin* | mingw* | *cegcc*)
6471 func_arith $current - $age
6472 major=$func_arith_result
6476 eval soname=\"$soname_spec\"
6481 # Make a new name for the extract_expsyms_cmds to use
6483 func_basename "$soroot"
6484 soname="$func_basename_result"
6485 func_stripname 'lib' '.dll' "$soname"
6486 newlib=libimp-$func_stripname_result.a
6488 # If the library has no export list, then create one now
6489 if test -f "$output_objdir/$soname-def"; then :
6491 func_verbose "extracting exported symbol list from \`$soname'"
6492 func_execute_cmds "$extract_expsyms_cmds" 'exit $?'
6496 if test -f "$output_objdir/$newlib"; then :; else
6497 func_verbose "generating import library for \`$soname'"
6498 func_execute_cmds "$old_archive_from_expsyms_cmds" 'exit $?'
6500 # make sure the library variables are pointing to the new library
6503 fi # test -n "$old_archive_from_expsyms_cmds"
6505 if test "$linkmode" = prog || test "$mode" != relink; then
6510 case $hardcode_action in
6511 immediate | unsupported)
6512 if test "$hardcode_direct" = no; then
6515 *-*-sco3.2v5.0.[024]*) add_dir="-L$dir" ;;
6516 *-*-sysv4*uw2*) add_dir="-L$dir" ;;
6517 *-*-sysv5OpenUNIX* | *-*-sysv5UnixWare7.[01].[10]* | \
6518 *-*-unixware7*) add_dir="-L$dir" ;;
6520 # if the lib is a (non-dlopened) module then we can not
6521 # link against it, someone is ignoring the earlier warnings
6522 if /usr/bin/file -L $add 2> /dev/null |
6523 $GREP ": [^:]* bundle" >/dev/null ; then
6524 if test "X$dlopenmodule" != "X$lib"; then
6525 $ECHO "*** Warning: lib $linklib is a module, not a shared library"
6526 if test -z "$old_library" ; then
6528 echo "*** And there doesn't seem to be a static archive available"
6529 echo "*** The link will probably fail, sorry"
6531 add="$dir/$old_library"
6533 elif test -n "$old_library"; then
6534 add="$dir/$old_library"
6538 elif test "$hardcode_minus_L" = no; then
6540 *-*-sunos*) add_shlibpath="$dir" ;;
6544 elif test "$hardcode_shlibpath_var" = no; then
6545 add_shlibpath="$dir"
6552 if test "$hardcode_direct" = yes &&
6553 test "$hardcode_direct_absolute" = no; then
6555 elif test "$hardcode_minus_L" = yes; then
6557 # Try looking first in the location we're being installed to.
6558 if test -n "$inst_prefix_dir"; then
6561 add_dir="$add_dir -L$inst_prefix_dir$libdir"
6566 elif test "$hardcode_shlibpath_var" = yes; then
6567 add_shlibpath="$dir"
6576 if test "$lib_linked" != yes; then
6577 func_fatal_configuration "unsupported hardcode properties"
6580 if test -n "$add_shlibpath"; then
6581 case :$compile_shlibpath: in
6582 *":$add_shlibpath:"*) ;;
6583 *) compile_shlibpath="$compile_shlibpath$add_shlibpath:" ;;
6586 if test "$linkmode" = prog; then
6587 test -n "$add_dir" && compile_deplibs="$add_dir $compile_deplibs"
6588 test -n "$add" && compile_deplibs="$add $compile_deplibs"
6590 test -n "$add_dir" && deplibs="$add_dir $deplibs"
6591 test -n "$add" && deplibs="$add $deplibs"
6592 if test "$hardcode_direct" != yes &&
6593 test "$hardcode_minus_L" != yes &&
6594 test "$hardcode_shlibpath_var" = yes; then
6595 case :$finalize_shlibpath: in
6597 *) finalize_shlibpath="$finalize_shlibpath$libdir:" ;;
6603 if test "$linkmode" = prog || test "$mode" = relink; then
6607 # Finalize command for both is simple: just hardcode it.
6608 if test "$hardcode_direct" = yes &&
6609 test "$hardcode_direct_absolute" = no; then
6610 add="$libdir/$linklib"
6611 elif test "$hardcode_minus_L" = yes; then
6614 elif test "$hardcode_shlibpath_var" = yes; then
6615 case :$finalize_shlibpath: in
6617 *) finalize_shlibpath="$finalize_shlibpath$libdir:" ;;
6620 elif test "$hardcode_automatic" = yes; then
6621 if test -n "$inst_prefix_dir" &&
6622 test -f "$inst_prefix_dir$libdir/$linklib" ; then
6623 add="$inst_prefix_dir$libdir/$linklib"
6625 add="$libdir/$linklib"
6628 # We cannot seem to hardcode it, guess we'll fake it.
6630 # Try looking first in the location we're being installed to.
6631 if test -n "$inst_prefix_dir"; then
6634 add_dir="$add_dir -L$inst_prefix_dir$libdir"
6641 if test "$linkmode" = prog; then
6642 test -n "$add_dir" && finalize_deplibs="$add_dir $finalize_deplibs"
6643 test -n "$add" && finalize_deplibs="$add $finalize_deplibs"
6645 test -n "$add_dir" && deplibs="$add_dir $deplibs"
6646 test -n "$add" && deplibs="$add $deplibs"
6649 elif test "$linkmode" = prog; then
6650 # Here we assume that one of hardcode_direct or hardcode_minus_L
6651 # is not unsupported. This is valid on all known static and
6653 if test "$hardcode_direct" != unsupported; then
6654 test -n "$old_library" && linklib="$old_library"
6655 compile_deplibs="$dir/$linklib $compile_deplibs"
6656 finalize_deplibs="$dir/$linklib $finalize_deplibs"
6658 compile_deplibs="-l$name -L$dir $compile_deplibs"
6659 finalize_deplibs="-l$name -L$dir $finalize_deplibs"
6661 elif test "$build_libtool_libs" = yes; then
6662 # Not a shared library
6663 if test "$deplibs_check_method" != pass_all; then
6664 # We're trying link a shared library against a static one
6665 # but the system doesn't support it.
6667 # Just print a warning and add the library to dependency_libs so
6668 # that the program can be linked against the static library.
6670 $ECHO "*** Warning: This system can not link to static lib archive $lib."
6671 echo "*** I have the capability to make that library automatically link in when"
6672 echo "*** you link to this library. But I can only do this if you have a"
6673 echo "*** shared version of the library, which you do not appear to have."
6674 if test "$module" = yes; then
6675 echo "*** But as you try to build a module library, libtool will still create "
6676 echo "*** a static module, that should work as long as the dlopening application"
6677 echo "*** is linked with the -dlopen flag to resolve symbols at runtime."
6678 if test -z "$global_symbol_pipe"; then
6680 echo "*** However, this would only work if libtool was able to extract symbol"
6681 echo "*** lists from a program, using \`nm' or equivalent, but libtool could"
6682 echo "*** not find such a program. So, this module is probably useless."
6683 echo "*** \`nm' from GNU binutils and a full rebuild may help."
6685 if test "$build_old_libs" = no; then
6686 build_libtool_libs=module
6689 build_libtool_libs=no
6693 deplibs="$dir/$old_library $deplibs"
6696 fi # link shared/static library?
6698 if test "$linkmode" = lib; then
6699 if test -n "$dependency_libs" &&
6700 { test "$hardcode_into_libs" != yes ||
6701 test "$build_old_libs" = yes ||
6702 test "$link_static" = yes; }; then
6703 # Extract -R from dependency_libs
6705 for libdir in $dependency_libs; do
6707 -R*) func_stripname '-R' '' "$libdir"
6708 temp_xrpath=$func_stripname_result
6710 *" $temp_xrpath "*) ;;
6711 *) xrpath="$xrpath $temp_xrpath";;
6713 *) temp_deplibs="$temp_deplibs $libdir";;
6716 dependency_libs="$temp_deplibs"
6719 newlib_search_path="$newlib_search_path $absdir"
6720 # Link against this library
6721 test "$link_static" = no && newdependency_libs="$abs_ladir/$laname $newdependency_libs"
6722 # ... and its dependency_libs
6724 for deplib in $dependency_libs; do
6725 newdependency_libs="$deplib $newdependency_libs"
6726 if $opt_duplicate_deps ; then
6727 case "$tmp_libs " in
6728 *" $deplib "*) specialdeplibs="$specialdeplibs $deplib" ;;
6731 tmp_libs="$tmp_libs $deplib"
6734 if test "$link_all_deplibs" != no; then
6735 # Add the search paths of all dependency libraries
6736 for deplib in $dependency_libs; do
6739 -L*) path="$deplib" ;;
6741 func_dirname "$deplib" "" "."
6742 dir="$func_dirname_result"
6743 # We need an absolute path.
6745 [\\/]* | [A-Za-z]:[\\/]*) absdir="$dir" ;;
6747 absdir=`cd "$dir" && pwd`
6748 if test -z "$absdir"; then
6749 func_warning "cannot determine absolute directory name of \`$dir'"
6754 if $GREP "^installed=no" $deplib > /dev/null; then
6758 eval deplibrary_names=`${SED} -n -e 's/^library_names=\(.*\)$/\1/p' $deplib`
6759 if test -n "$deplibrary_names" ; then
6760 for tmp in $deplibrary_names ; do
6763 if test -f "$absdir/$objdir/$depdepl" ; then
6764 depdepl="$absdir/$objdir/$depdepl"
6765 darwin_install_name=`${OTOOL} -L $depdepl | awk '{if (NR == 2) {print $1;exit}}'`
6766 if test -z "$darwin_install_name"; then
6767 darwin_install_name=`${OTOOL64} -L $depdepl | awk '{if (NR == 2) {print $1;exit}}'`
6769 compiler_flags="$compiler_flags ${wl}-dylib_file ${wl}${darwin_install_name}:${depdepl}"
6770 linker_flags="$linker_flags -dylib_file ${darwin_install_name}:${depdepl}"
6776 path="-L$absdir/$objdir"
6780 eval libdir=`${SED} -n -e 's/^libdir=\(.*\)$/\1/p' $deplib`
6781 test -z "$libdir" && \
6782 func_fatal_error "\`$deplib' is not a valid libtool archive"
6783 test "$absdir" != "$libdir" && \
6784 func_warning "\`$deplib' seems to be moved"
6790 case " $deplibs " in
6792 *) deplibs="$path $deplibs" ;;
6795 fi # link_all_deplibs != no
6797 done # for deplib in $libs
6798 if test "$pass" = link; then
6799 if test "$linkmode" = "prog"; then
6800 compile_deplibs="$new_inherited_linker_flags $compile_deplibs"
6801 finalize_deplibs="$new_inherited_linker_flags $finalize_deplibs"
6803 compiler_flags="$compiler_flags "`$ECHO " $new_inherited_linker_flags" | $SED 's% \([^ $]*\).ltframework% -framework \1%g'`
6806 dependency_libs="$newdependency_libs"
6807 if test "$pass" = dlpreopen; then
6808 # Link the dlpreopened libraries before other libraries
6809 for deplib in $save_deplibs; do
6810 deplibs="$deplib $deplibs"
6813 if test "$pass" != dlopen; then
6814 if test "$pass" != conv; then
6815 # Make sure lib_search_path contains only unique directories.
6817 for dir in $newlib_search_path; do
6818 case "$lib_search_path " in
6820 *) lib_search_path="$lib_search_path $dir" ;;
6826 if test "$linkmode,$pass" != "prog,link"; then
6829 vars="compile_deplibs finalize_deplibs"
6831 for var in $vars dependency_libs; do
6832 # Add libraries to $var in reverse order
6833 eval tmp_libs=\"\$$var\"
6835 for deplib in $tmp_libs; do
6836 # FIXME: Pedantically, this is the right thing to do, so
6837 # that some nasty dependency loop isn't accidentally
6839 #new_libs="$deplib $new_libs"
6840 # Pragmatically, this seems to cause very few problems in
6843 -L*) new_libs="$deplib $new_libs" ;;
6846 # And here is the reason: when a library appears more
6847 # than once as an explicit dependence of a library, or
6848 # is implicitly linked in more than once by the
6849 # compiler, it is considered special, and multiple
6850 # occurrences thereof are not removed. Compare this
6851 # with having the same library being listed as a
6852 # dependency of multiple other libraries: in this case,
6853 # we know (pedantically, we assume) the library does not
6854 # need to be listed more than once, so we keep only the
6855 # last copy. This is not always right, but it is rare
6856 # enough that we require users that really mean to play
6857 # such unportable linking tricks to link the library
6858 # using -Wl,-lname, so that libtool does not consider it
6859 # for duplicate removal.
6860 case " $specialdeplibs " in
6861 *" $deplib "*) new_libs="$deplib $new_libs" ;;
6863 case " $new_libs " in
6865 *) new_libs="$deplib $new_libs" ;;
6873 for deplib in $new_libs; do
6876 case " $tmp_libs " in
6878 *) tmp_libs="$tmp_libs $deplib" ;;
6881 *) tmp_libs="$tmp_libs $deplib" ;;
6884 eval $var=\"$tmp_libs\"
6887 # Last step: remove runtime libs from dependency_libs
6888 # (they stay in deplibs)
6890 for i in $dependency_libs ; do
6891 case " $predeps $postdeps $compiler_lib_search_path " in
6896 if test -n "$i" ; then
6897 tmp_libs="$tmp_libs $i"
6900 dependency_libs=$tmp_libs
6902 if test "$linkmode" = prog; then
6903 dlfiles="$newdlfiles"
6905 if test "$linkmode" = prog || test "$linkmode" = lib; then
6906 dlprefiles="$newdlprefiles"
6911 if test -n "$dlfiles$dlprefiles" || test "$dlself" != no; then
6912 func_warning "\`-dlopen' is ignored for archives"
6917 func_warning "\`-l' and \`-L' are ignored for archives" ;;
6920 test -n "$rpath" && \
6921 func_warning "\`-rpath' is ignored for archives"
6923 test -n "$xrpath" && \
6924 func_warning "\`-R' is ignored for archives"
6926 test -n "$vinfo" && \
6927 func_warning "\`-version-info/-version-number' is ignored for archives"
6929 test -n "$release" && \
6930 func_warning "\`-release' is ignored for archives"
6932 test -n "$export_symbols$export_symbols_regex" && \
6933 func_warning "\`-export-symbols' is ignored for archives"
6935 # Now set the variables for building old libraries.
6936 build_libtool_libs=no
6938 objs="$objs$old_deplibs"
6942 # Make sure we only generate libraries of the form `libNAME.la'.
6945 func_stripname 'lib' '.la' "$outputname"
6946 name=$func_stripname_result
6947 eval shared_ext=\"$shrext_cmds\"
6948 eval libname=\"$libname_spec\"
6951 test "$module" = no && \
6952 func_fatal_help "libtool library \`$output' must begin with \`lib'"
6954 if test "$need_lib_prefix" != no; then
6955 # Add the "lib" prefix for modules if required
6956 func_stripname '' '.la' "$outputname"
6957 name=$func_stripname_result
6958 eval shared_ext=\"$shrext_cmds\"
6959 eval libname=\"$libname_spec\"
6961 func_stripname '' '.la' "$outputname"
6962 libname=$func_stripname_result
6967 if test -n "$objs"; then
6968 if test "$deplibs_check_method" != pass_all; then
6969 func_fatal_error "cannot build libtool library \`$output' from non-libtool objects on this host:$objs"
6972 $ECHO "*** Warning: Linking the shared library $output against the non-libtool"
6973 $ECHO "*** objects $objs is not portable!"
6974 libobjs="$libobjs $objs"
6978 test "$dlself" != no && \
6979 func_warning "\`-dlopen self' is ignored for libtool libraries"
6983 test "$#" -gt 1 && \
6984 func_warning "ignoring multiple \`-rpath's for a libtool library"
6989 if test -z "$rpath"; then
6990 if test "$build_libtool_libs" = yes; then
6991 # Building a libtool convenience library.
6992 # Some compilers have problems with a `.al' extension so
6993 # convenience libraries should have the same extension an
6994 # archive normally would.
6995 oldlibs="$output_objdir/$libname.$libext $oldlibs"
6996 build_libtool_libs=convenience
7000 test -n "$vinfo" && \
7001 func_warning "\`-version-info/-version-number' is ignored for convenience libraries"
7003 test -n "$release" && \
7004 func_warning "\`-release' is ignored for convenience libraries"
7007 # Parse the version information argument.
7008 save_ifs="$IFS"; IFS=':'
7009 set dummy $vinfo 0 0 0
7014 func_fatal_help "too many parameters to \`-version-info'"
7016 # convert absolute version numbers to libtool ages
7017 # this retains compatibility with .la files and attempts
7018 # to make the code below a bit more comprehensible
7020 case $vinfo_number in
7024 number_revision="$3"
7026 # There are really only two kinds -- those that
7027 # use the current revision as the major version
7028 # and those that subtract age and use age as
7029 # a minor version. But, then there is irix
7030 # which has an extra 1 added just for fun
7032 case $version_type in
7033 darwin|linux|osf|windows|none)
7034 func_arith $number_major + $number_minor
7035 current=$func_arith_result
7037 revision="$number_revision"
7039 freebsd-aout|freebsd-elf|qnx|sunos)
7040 current="$number_major"
7041 revision="$number_minor"
7045 func_arith $number_major + $number_minor
7046 current=$func_arith_result
7048 revision="$number_minor"
7049 lt_irix_increment=no
7060 # Check that each of the things are valid numbers.
7062 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]) ;;
7064 func_error "CURRENT \`$current' must be a nonnegative integer"
7065 func_fatal_error "\`$vinfo' is not valid version information"
7070 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]) ;;
7072 func_error "REVISION \`$revision' must be a nonnegative integer"
7073 func_fatal_error "\`$vinfo' is not valid version information"
7078 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]) ;;
7080 func_error "AGE \`$age' must be a nonnegative integer"
7081 func_fatal_error "\`$vinfo' is not valid version information"
7085 if test "$age" -gt "$current"; then
7086 func_error "AGE \`$age' is greater than the current interface number \`$current'"
7087 func_fatal_error "\`$vinfo' is not valid version information"
7090 # Calculate the version variables.
7094 case $version_type in
7098 # Like Linux, but with the current version available in
7099 # verstring for coding it into the library header
7100 func_arith $current - $age
7101 major=.$func_arith_result
7102 versuffix="$major.$age.$revision"
7103 # Darwin ld doesn't like 0 for these options...
7104 func_arith $current + 1
7105 minor_current=$func_arith_result
7106 xlcverstring="${wl}-compatibility_version ${wl}$minor_current ${wl}-current_version ${wl}$minor_current.$revision"
7107 verstring="-compatibility_version $minor_current -current_version $minor_current.$revision"
7112 versuffix=".$current.$revision";
7117 versuffix=".$current"
7121 if test "X$lt_irix_increment" = "Xno"; then
7122 func_arith $current - $age
7124 func_arith $current - $age + 1
7126 major=$func_arith_result
7128 case $version_type in
7129 nonstopux) verstring_prefix=nonstopux ;;
7130 *) verstring_prefix=sgi ;;
7132 verstring="$verstring_prefix$major.$revision"
7134 # Add in all the interfaces that we are compatible with.
7136 while test "$loop" -ne 0; do
7137 func_arith $revision - $loop
7138 iface=$func_arith_result
7139 func_arith $loop - 1
7140 loop=$func_arith_result
7141 verstring="$verstring_prefix$major.$iface:$verstring"
7144 # Before this point, $major must not contain `.'.
7146 versuffix="$major.$revision"
7150 func_arith $current - $age
7151 major=.$func_arith_result
7152 versuffix="$major.$age.$revision"
7156 func_arith $current - $age
7157 major=.$func_arith_result
7158 versuffix=".$current.$age.$revision"
7159 verstring="$current.$age.$revision"
7161 # Add in all the interfaces that we are compatible with.
7163 while test "$loop" -ne 0; do
7164 func_arith $current - $loop
7165 iface=$func_arith_result
7166 func_arith $loop - 1
7167 loop=$func_arith_result
7168 verstring="$verstring:${iface}.0"
7171 # Make executables depend on our current version.
7172 verstring="$verstring:${current}.0"
7177 versuffix=".$current"
7182 versuffix=".$current.$revision"
7186 # Use '-' rather than '.', since we only want one
7187 # extension on DOS 8.3 filesystems.
7188 func_arith $current - $age
7189 major=$func_arith_result
7194 func_fatal_configuration "unknown library version type \`$version_type'"
7198 # Clear the version info if we defaulted, and they specified a release.
7199 if test -z "$vinfo" && test -n "$release"; then
7201 case $version_type in
7203 # we can't check for "0.0" in archive_cmds due to quoting
7204 # problems, so we reset it completely
7211 if test "$need_version" = no; then
7218 # Remove version info from name if versioning should be avoided
7219 if test "$avoid_version" = yes && test "$need_version" = no; then
7225 # Check to see if the archive will have undefined symbols.
7226 if test "$allow_undefined" = yes; then
7227 if test "$allow_undefined_flag" = unsupported; then
7228 func_warning "undefined symbols not allowed in $host shared libraries"
7229 build_libtool_libs=no
7233 # Don't allow undefined symbols.
7234 allow_undefined_flag="$no_undefined_flag"
7239 func_generate_dlsyms "$libname" "$libname" "yes"
7240 libobjs="$libobjs $symfileobj"
7241 test "X$libobjs" = "X " && libobjs=
7243 if test "$mode" != relink; then
7244 # Remove our outputs, but don't remove object files since they
7245 # may have been created when compiling PIC objects.
7247 tempremovelist=`$ECHO "$output_objdir/*"`
7248 for p in $tempremovelist; do
7252 $output_objdir/$outputname | $output_objdir/$libname.* | $output_objdir/${libname}${release}.*)
7253 if test "X$precious_files_regex" != "X"; then
7254 if $ECHO "$p" | $EGREP -e "$precious_files_regex" >/dev/null 2>&1
7259 removelist="$removelist $p"
7264 test -n "$removelist" && \
7265 func_show_eval "${RM}r \$removelist"
7268 # Now set the variables for building old libraries.
7269 if test "$build_old_libs" = yes && test "$build_libtool_libs" != convenience ; then
7270 oldlibs="$oldlibs $output_objdir/$libname.$libext"
7272 # Transform .lo files to .o files.
7273 oldobjs="$objs "`$ECHO "$libobjs" | $SP2NL | $SED "/\.${libext}$/d; $lo2o" | $NL2SP`
7276 # Eliminate all temporary directories.
7277 #for path in $notinst_path; do
7278 # lib_search_path=`$ECHO "$lib_search_path " | $SED "s% $path % %g"`
7279 # deplibs=`$ECHO "$deplibs " | $SED "s% -L$path % %g"`
7280 # dependency_libs=`$ECHO "$dependency_libs " | $SED "s% -L$path % %g"`
7283 if test -n "$xrpath"; then
7284 # If the user specified any rpath flags, then add them.
7286 for libdir in $xrpath; do
7287 temp_xrpath="$temp_xrpath -R$libdir"
7288 case "$finalize_rpath " in
7290 *) finalize_rpath="$finalize_rpath $libdir" ;;
7293 if test "$hardcode_into_libs" != yes || test "$build_old_libs" = yes; then
7294 dependency_libs="$temp_xrpath $dependency_libs"
7298 # Make sure dlfiles contains only unique files that won't be dlpreopened
7299 old_dlfiles="$dlfiles"
7301 for lib in $old_dlfiles; do
7302 case " $dlprefiles $dlfiles " in
7304 *) dlfiles="$dlfiles $lib" ;;
7308 # Make sure dlprefiles contains only unique files
7309 old_dlprefiles="$dlprefiles"
7311 for lib in $old_dlprefiles; do
7312 case "$dlprefiles " in
7314 *) dlprefiles="$dlprefiles $lib" ;;
7318 if test "$build_libtool_libs" = yes; then
7319 if test -n "$rpath"; then
7321 *-*-cygwin* | *-*-mingw* | *-*-pw32* | *-*-os2* | *-*-beos* | *-cegcc* | *-*-haiku*)
7322 # these systems don't actually have a c library (as such)!
7324 *-*-rhapsody* | *-*-darwin1.[012])
7325 # Rhapsody C library is in the System framework
7326 deplibs="$deplibs System.ltframework"
7329 # Don't link with libc until the a.out ld.so is fixed.
7331 *-*-openbsd* | *-*-freebsd* | *-*-dragonfly*)
7332 # Do not include libc due to us having libc/libc_r.
7334 *-*-sco3.2v5* | *-*-sco5v6*)
7335 # Causes problems with __ctype
7337 *-*-sysv4.2uw2* | *-*-sysv5* | *-*-unixware* | *-*-OpenUNIX*)
7338 # Compiler inserts libc in the correct place for threads to work
7341 # Add libc to deplibs on all other systems if necessary.
7342 if test "$build_libtool_need_lc" = "yes"; then
7343 deplibs="$deplibs -lc"
7349 # Transform deplibs into only deplibs that can be linked in shared.
7351 libname_save=$libname
7352 release_save=$release
7353 versuffix_save=$versuffix
7355 # I'm not sure if I'm treating the release correctly. I think
7356 # release should show up in the -l (ie -lgmp5) so we don't want to
7357 # add it in twice. Is that correct?
7363 case $deplibs_check_method in
7365 # Don't check for shared/static. Everything works.
7366 # This might be a little naive. We might want to check
7367 # whether the library exists or not. But this is on
7368 # osf3 & osf4 and I'm not really sure... Just
7369 # implementing what was already the behavior.
7373 # This code stresses the "libraries are programs" paradigm to its
7374 # limits. Maybe even breaks it. We compile a program, linking it
7375 # against the deplibs as a proxy for the library. Then we can check
7376 # whether they linked in statically or dynamically with ldd.
7377 $opt_dry_run || $RM conftest.c
7378 cat > conftest.c <<EOF
7379 int main() { return 0; }
7381 $opt_dry_run || $RM conftest
7382 if $LTCC $LTCFLAGS -o conftest conftest.c $deplibs; then
7383 ldd_output=`ldd conftest`
7384 for i in $deplibs; do
7387 func_stripname -l '' "$i"
7388 name=$func_stripname_result
7389 if test "X$allow_libtool_libs_with_static_runtimes" = "Xyes" ; then
7390 case " $predeps $postdeps " in
7392 newdeplibs="$newdeplibs $i"
7397 if test -n "$i" ; then
7398 libname=`eval "\\$ECHO \"$libname_spec\""`
7399 deplib_matches=`eval "\\$ECHO \"$library_names_spec\""`
7400 set dummy $deplib_matches; shift
7402 if test `expr "$ldd_output" : ".*$deplib_match"` -ne 0 ; then
7403 newdeplibs="$newdeplibs $i"
7407 $ECHO "*** Warning: dynamic linker does not accept needed library $i."
7408 echo "*** I have the capability to make that library automatically link in when"
7409 echo "*** you link to this library. But I can only do this if you have a"
7410 echo "*** shared version of the library, which I believe you do not have"
7411 echo "*** because a test_compile did reveal that the linker did not use it for"
7412 echo "*** its dynamic dependency list that programs get resolved with at runtime."
7417 newdeplibs="$newdeplibs $i"
7422 # Error occurred in the first compile. Let's try to salvage
7423 # the situation: Compile a separate program for each library.
7424 for i in $deplibs; do
7427 func_stripname -l '' "$i"
7428 name=$func_stripname_result
7429 $opt_dry_run || $RM conftest
7430 if $LTCC $LTCFLAGS -o conftest conftest.c $i; then
7431 ldd_output=`ldd conftest`
7432 if test "X$allow_libtool_libs_with_static_runtimes" = "Xyes" ; then
7433 case " $predeps $postdeps " in
7435 newdeplibs="$newdeplibs $i"
7440 if test -n "$i" ; then
7441 libname=`eval "\\$ECHO \"$libname_spec\""`
7442 deplib_matches=`eval "\\$ECHO \"$library_names_spec\""`
7443 set dummy $deplib_matches; shift
7445 if test `expr "$ldd_output" : ".*$deplib_match"` -ne 0 ; then
7446 newdeplibs="$newdeplibs $i"
7450 $ECHO "*** Warning: dynamic linker does not accept needed library $i."
7451 echo "*** I have the capability to make that library automatically link in when"
7452 echo "*** you link to this library. But I can only do this if you have a"
7453 echo "*** shared version of the library, which you do not appear to have"
7454 echo "*** because a test_compile did reveal that the linker did not use this one"
7455 echo "*** as a dynamic dependency that programs can get resolved with at runtime."
7461 $ECHO "*** Warning! Library $i is needed by this library but I was not able to"
7462 echo "*** make it link in! You will probably need to install it or some"
7463 echo "*** library that it depends on before this library will be fully"
7464 echo "*** functional. Installing it before continuing would be even better."
7468 newdeplibs="$newdeplibs $i"
7475 set dummy $deplibs_check_method; shift
7476 file_magic_regex=`expr "$deplibs_check_method" : "$1 \(.*\)"`
7477 for a_deplib in $deplibs; do
7480 func_stripname -l '' "$a_deplib"
7481 name=$func_stripname_result
7482 if test "X$allow_libtool_libs_with_static_runtimes" = "Xyes" ; then
7483 case " $predeps $postdeps " in
7485 newdeplibs="$newdeplibs $a_deplib"
7490 if test -n "$a_deplib" ; then
7491 libname=`eval "\\$ECHO \"$libname_spec\""`
7492 for i in $lib_search_path $sys_lib_search_path $shlib_search_path; do
7493 potential_libs=`ls $i/$libname[.-]* 2>/dev/null`
7494 for potent_lib in $potential_libs; do
7495 # Follow soft links.
7496 if ls -lLd "$potent_lib" 2>/dev/null |
7497 $GREP " -> " >/dev/null; then
7500 # The statement above tries to avoid entering an
7501 # endless loop below, in case of cyclic links.
7502 # We might still enter an endless loop, since a link
7503 # loop can be closed while we follow links,
7505 potlib="$potent_lib"
7506 while test -h "$potlib" 2>/dev/null; do
7507 potliblink=`ls -ld $potlib | ${SED} 's/.* -> //'`
7509 [\\/]* | [A-Za-z]:[\\/]*) potlib="$potliblink";;
7510 *) potlib=`$ECHO "$potlib" | $SED 's,[^/]*$,,'`"$potliblink";;
7513 if eval $file_magic_cmd \"\$potlib\" 2>/dev/null |
7515 $EGREP "$file_magic_regex" > /dev/null; then
7516 newdeplibs="$newdeplibs $a_deplib"
7523 if test -n "$a_deplib" ; then
7526 $ECHO "*** Warning: linker path does not have real file for library $a_deplib."
7527 echo "*** I have the capability to make that library automatically link in when"
7528 echo "*** you link to this library. But I can only do this if you have a"
7529 echo "*** shared version of the library, which you do not appear to have"
7530 echo "*** because I did check the linker path looking for a file starting"
7531 if test -z "$potlib" ; then
7532 $ECHO "*** with $libname but no candidates were found. (...for file magic test)"
7534 $ECHO "*** with $libname and none of the candidates passed a file format test"
7535 $ECHO "*** using a file magic. Last file checked: $potlib"
7540 # Add a -L argument.
7541 newdeplibs="$newdeplibs $a_deplib"
7544 done # Gone through all deplibs.
7547 set dummy $deplibs_check_method; shift
7548 match_pattern_regex=`expr "$deplibs_check_method" : "$1 \(.*\)"`
7549 for a_deplib in $deplibs; do
7552 func_stripname -l '' "$a_deplib"
7553 name=$func_stripname_result
7554 if test "X$allow_libtool_libs_with_static_runtimes" = "Xyes" ; then
7555 case " $predeps $postdeps " in
7557 newdeplibs="$newdeplibs $a_deplib"
7562 if test -n "$a_deplib" ; then
7563 libname=`eval "\\$ECHO \"$libname_spec\""`
7564 for i in $lib_search_path $sys_lib_search_path $shlib_search_path; do
7565 potential_libs=`ls $i/$libname[.-]* 2>/dev/null`
7566 for potent_lib in $potential_libs; do
7567 potlib="$potent_lib" # see symlink-check above in file_magic test
7568 if eval "\$ECHO \"$potent_lib\"" 2>/dev/null | $SED 10q | \
7569 $EGREP "$match_pattern_regex" > /dev/null; then
7570 newdeplibs="$newdeplibs $a_deplib"
7577 if test -n "$a_deplib" ; then
7580 $ECHO "*** Warning: linker path does not have real file for library $a_deplib."
7581 echo "*** I have the capability to make that library automatically link in when"
7582 echo "*** you link to this library. But I can only do this if you have a"
7583 echo "*** shared version of the library, which you do not appear to have"
7584 echo "*** because I did check the linker path looking for a file starting"
7585 if test -z "$potlib" ; then
7586 $ECHO "*** with $libname but no candidates were found. (...for regex pattern test)"
7588 $ECHO "*** with $libname and none of the candidates passed a file format test"
7589 $ECHO "*** using a regex pattern. Last file checked: $potlib"
7594 # Add a -L argument.
7595 newdeplibs="$newdeplibs $a_deplib"
7598 done # Gone through all deplibs.
7602 tmp_deplibs=`$ECHO " $deplibs" | $SED 's/ -lc$//; s/ -[LR][^ ]*//g'`
7603 if test "X$allow_libtool_libs_with_static_runtimes" = "Xyes" ; then
7604 for i in $predeps $postdeps ; do
7605 # can't use Xsed below, because $i might contain '/'
7606 tmp_deplibs=`$ECHO " $tmp_deplibs" | $SED "s,$i,,"`
7609 case $tmp_deplibs in
7612 if test "X$deplibs_check_method" = "Xnone"; then
7613 echo "*** Warning: inter-library dependencies are not supported in this platform."
7615 echo "*** Warning: inter-library dependencies are not known to be supported."
7617 echo "*** All declared inter-library dependencies are being dropped."
7623 versuffix=$versuffix_save
7625 release=$release_save
7626 libname=$libname_save
7630 *-*-rhapsody* | *-*-darwin1.[012])
7631 # On Rhapsody replace the C library with the System framework
7632 newdeplibs=`$ECHO " $newdeplibs" | $SED 's/ -lc / System.ltframework /'`
7636 if test "$droppeddeps" = yes; then
7637 if test "$module" = yes; then
7639 echo "*** Warning: libtool could not satisfy all declared inter-library"
7640 $ECHO "*** dependencies of module $libname. Therefore, libtool will create"
7641 echo "*** a static module, that should work as long as the dlopening"
7642 echo "*** application is linked with the -dlopen flag."
7643 if test -z "$global_symbol_pipe"; then
7645 echo "*** However, this would only work if libtool was able to extract symbol"
7646 echo "*** lists from a program, using \`nm' or equivalent, but libtool could"
7647 echo "*** not find such a program. So, this module is probably useless."
7648 echo "*** \`nm' from GNU binutils and a full rebuild may help."
7650 if test "$build_old_libs" = no; then
7651 oldlibs="$output_objdir/$libname.$libext"
7652 build_libtool_libs=module
7655 build_libtool_libs=no
7658 echo "*** The inter-library dependencies that have been dropped here will be"
7659 echo "*** automatically added whenever a program is linked with this library"
7660 echo "*** or is declared to -dlopen it."
7662 if test "$allow_undefined" = no; then
7664 echo "*** Since this library must not contain undefined symbols,"
7665 echo "*** because either the platform does not support them or"
7666 echo "*** it was explicitly requested with -no-undefined,"
7667 echo "*** libtool will only create a static version of it."
7668 if test "$build_old_libs" = no; then
7669 oldlibs="$output_objdir/$libname.$libext"
7670 build_libtool_libs=module
7673 build_libtool_libs=no
7678 # Done checking deplibs!
7681 # Time to change all our "foo.ltframework" stuff back to "-framework foo"
7684 newdeplibs=`$ECHO " $newdeplibs" | $SED 's% \([^ $]*\).ltframework% -framework \1%g'`
7685 new_inherited_linker_flags=`$ECHO " $new_inherited_linker_flags" | $SED 's% \([^ $]*\).ltframework% -framework \1%g'`
7686 deplibs=`$ECHO " $deplibs" | $SED 's% \([^ $]*\).ltframework% -framework \1%g'`
7690 # move library search paths that coincide with paths to not yet
7691 # installed libraries to the beginning of the library search list
7693 for path in $notinst_path; do
7694 case " $new_libs " in
7695 *" -L$path/$objdir "*) ;;
7697 case " $deplibs " in
7698 *" -L$path/$objdir "*)
7699 new_libs="$new_libs -L$path/$objdir" ;;
7704 for deplib in $deplibs; do
7707 case " $new_libs " in
7709 *) new_libs="$new_libs $deplib" ;;
7712 *) new_libs="$new_libs $deplib" ;;
7717 # All the library-specific variables (install_libdir is set above).
7722 # Test again, we may have decided not to build it any more
7723 if test "$build_libtool_libs" = yes; then
7724 if test "$hardcode_into_libs" = yes; then
7725 # Hardcode the library paths
7728 rpath="$finalize_rpath"
7729 test "$mode" != relink && rpath="$compile_rpath$rpath"
7730 for libdir in $rpath; do
7731 if test -n "$hardcode_libdir_flag_spec"; then
7732 if test -n "$hardcode_libdir_separator"; then
7733 if test -z "$hardcode_libdirs"; then
7734 hardcode_libdirs="$libdir"
7736 # Just accumulate the unique libdirs.
7737 case $hardcode_libdir_separator$hardcode_libdirs$hardcode_libdir_separator in
7738 *"$hardcode_libdir_separator$libdir$hardcode_libdir_separator"*)
7741 hardcode_libdirs="$hardcode_libdirs$hardcode_libdir_separator$libdir"
7746 eval flag=\"$hardcode_libdir_flag_spec\"
7747 dep_rpath="$dep_rpath $flag"
7749 elif test -n "$runpath_var"; then
7750 case "$perm_rpath " in
7752 *) perm_rpath="$perm_rpath $libdir" ;;
7756 # Substitute the hardcoded libdirs into the rpath.
7757 if test -n "$hardcode_libdir_separator" &&
7758 test -n "$hardcode_libdirs"; then
7759 libdir="$hardcode_libdirs"
7760 if test -n "$hardcode_libdir_flag_spec_ld"; then
7761 eval dep_rpath=\"$hardcode_libdir_flag_spec_ld\"
7763 eval dep_rpath=\"$hardcode_libdir_flag_spec\"
7766 if test -n "$runpath_var" && test -n "$perm_rpath"; then
7767 # We should set the runpath_var.
7769 for dir in $perm_rpath; do
7772 eval "$runpath_var='$rpath\$$runpath_var'; export $runpath_var"
7774 test -n "$dep_rpath" && deplibs="$dep_rpath $deplibs"
7777 shlibpath="$finalize_shlibpath"
7778 test "$mode" != relink && shlibpath="$compile_shlibpath$shlibpath"
7779 if test -n "$shlibpath"; then
7780 eval "$shlibpath_var='$shlibpath\$$shlibpath_var'; export $shlibpath_var"
7783 # Get the real and link names of the library.
7784 eval shared_ext=\"$shrext_cmds\"
7785 eval library_names=\"$library_names_spec\"
7786 set dummy $library_names
7791 if test -n "$soname_spec"; then
7792 eval soname=\"$soname_spec\"
7796 if test -z "$dlname"; then
7800 lib="$output_objdir/$realname"
7804 linknames="$linknames $link"
7807 # Use standard objects if they are pic
7808 test -z "$pic_flag" && libobjs=`$ECHO "$libobjs" | $SP2NL | $SED "$lo2o" | $NL2SP`
7809 test "X$libobjs" = "X " && libobjs=
7812 if test -n "$export_symbols" && test -n "$include_expsyms"; then
7813 $opt_dry_run || cp "$export_symbols" "$output_objdir/$libname.uexp"
7814 export_symbols="$output_objdir/$libname.uexp"
7815 delfiles="$delfiles $export_symbols"
7818 orig_export_symbols=
7820 cygwin* | mingw* | cegcc*)
7821 if test -n "$export_symbols" && test -z "$export_symbols_regex"; then
7822 # exporting using user supplied symfile
7823 if test "x`$SED 1q $export_symbols`" != xEXPORTS; then
7824 # and it's NOT already a .def file. Must figure out
7825 # which of the given symbols are data symbols and tag
7826 # them as such. So, trigger use of export_symbols_cmds.
7827 # export_symbols gets reassigned inside the "prepare
7828 # the list of exported symbols" if statement, so the
7829 # include_expsyms logic still works.
7830 orig_export_symbols="$export_symbols"
7832 always_export_symbols=yes
7838 # Prepare the list of exported symbols
7839 if test -z "$export_symbols"; then
7840 if test "$always_export_symbols" = yes || test -n "$export_symbols_regex"; then
7841 func_verbose "generating symbol list for \`$libname.la'"
7842 export_symbols="$output_objdir/$libname.exp"
7843 $opt_dry_run || $RM $export_symbols
7844 cmds=$export_symbols_cmds
7845 save_ifs="$IFS"; IFS='~'
7846 for cmd in $cmds; do
7850 len=$func_len_result
7851 if test "$len" -lt "$max_cmd_len" || test "$max_cmd_len" -le -1; then
7852 func_show_eval "$cmd" 'exit $?'
7853 skipped_export=false
7855 # The command line is too long to execute in one step.
7856 func_verbose "using reloadable object file for export list..."
7858 # Break out early, otherwise skipped_export may be
7859 # set to false by a later but shorter cmd.
7864 if test -n "$export_symbols_regex" && test "X$skipped_export" != "X:"; then
7865 func_show_eval '$EGREP -e "$export_symbols_regex" "$export_symbols" > "${export_symbols}T"'
7866 func_show_eval '$MV "${export_symbols}T" "$export_symbols"'
7871 if test -n "$export_symbols" && test -n "$include_expsyms"; then
7872 tmp_export_symbols="$export_symbols"
7873 test -n "$orig_export_symbols" && tmp_export_symbols="$orig_export_symbols"
7874 $opt_dry_run || eval '$ECHO "$include_expsyms" | $SP2NL >> "$tmp_export_symbols"'
7877 if test "X$skipped_export" != "X:" && test -n "$orig_export_symbols"; then
7878 # The given exports_symbols file has to be filtered, so filter it.
7879 func_verbose "filter symbol list for \`$libname.la' to tag DATA exports"
7880 # FIXME: $output_objdir/$libname.filter potentially contains lots of
7881 # 's' commands which not all seds can handle. GNU sed should be fine
7882 # though. Also, the filter scales superlinearly with the number of
7883 # global variables. join(1) would be nice here, but unfortunately
7884 # isn't a blessed tool.
7885 $opt_dry_run || $SED -e '/[ ,]DATA/!d;s,\(.*\)\([ \,].*\),s|^\1$|\1\2|,' < $export_symbols > $output_objdir/$libname.filter
7886 delfiles="$delfiles $export_symbols $output_objdir/$libname.filter"
7887 export_symbols=$output_objdir/$libname.def
7888 $opt_dry_run || $SED -f $output_objdir/$libname.filter < $orig_export_symbols > $export_symbols
7892 for test_deplib in $deplibs; do
7893 case " $convenience " in
7894 *" $test_deplib "*) ;;
7896 tmp_deplibs="$tmp_deplibs $test_deplib"
7900 deplibs="$tmp_deplibs"
7902 if test -n "$convenience"; then
7903 if test -n "$whole_archive_flag_spec" &&
7904 test "$compiler_needs_object" = yes &&
7905 test -z "$libobjs"; then
7906 # extract the archives, so we have objects to list.
7907 # TODO: could optimize this to just extract one archive.
7908 whole_archive_flag_spec=
7910 if test -n "$whole_archive_flag_spec"; then
7911 save_libobjs=$libobjs
7912 eval libobjs=\"\$libobjs $whole_archive_flag_spec\"
7913 test "X$libobjs" = "X " && libobjs=
7915 gentop="$output_objdir/${outputname}x"
7916 generated="$generated $gentop"
7918 func_extract_archives $gentop $convenience
7919 libobjs="$libobjs $func_extract_archives_result"
7920 test "X$libobjs" = "X " && libobjs=
7924 if test "$thread_safe" = yes && test -n "$thread_safe_flag_spec"; then
7925 eval flag=\"$thread_safe_flag_spec\"
7926 linker_flags="$linker_flags $flag"
7929 # Make a backup of the uninstalled library when relinking
7930 if test "$mode" = relink; then
7931 $opt_dry_run || eval '(cd $output_objdir && $RM ${realname}U && $MV $realname ${realname}U)' || exit $?
7934 # Do each of the archive commands.
7935 if test "$module" = yes && test -n "$module_cmds" ; then
7936 if test -n "$export_symbols" && test -n "$module_expsym_cmds"; then
7937 eval test_cmds=\"$module_expsym_cmds\"
7938 cmds=$module_expsym_cmds
7940 eval test_cmds=\"$module_cmds\"
7944 if test -n "$export_symbols" && test -n "$archive_expsym_cmds"; then
7945 eval test_cmds=\"$archive_expsym_cmds\"
7946 cmds=$archive_expsym_cmds
7948 eval test_cmds=\"$archive_cmds\"
7953 if test "X$skipped_export" != "X:" &&
7954 func_len " $test_cmds" &&
7955 len=$func_len_result &&
7956 test "$len" -lt "$max_cmd_len" || test "$max_cmd_len" -le -1; then
7959 # The command line is too long to link in one step, link piecewise
7960 # or, if using GNU ld and skipped_export is not :, use a linker
7963 # Save the value of $output and $libobjs because we want to
7964 # use them later. If we have whole_archive_flag_spec, we
7965 # want to use save_libobjs as it was before
7966 # whole_archive_flag_spec was expanded, because we can't
7967 # assume the linker understands whole_archive_flag_spec.
7968 # This may have to be revisited, in case too many
7969 # convenience libraries get linked in and end up exceeding
7971 if test -z "$convenience" || test -z "$whole_archive_flag_spec"; then
7972 save_libobjs=$libobjs
7975 func_basename "$output"
7976 output_la=$func_basename_result
7978 # Clear the reloadable object creation command queue and
7979 # initialize k to one.
7986 if test -n "$save_libobjs" && test "X$skipped_export" != "X:" && test "$with_gnu_ld" = yes; then
7987 output=${output_objdir}/${output_la}.lnkscript
7988 func_verbose "creating GNU ld script: $output"
7989 echo 'INPUT (' > $output
7990 for obj in $save_libobjs
7992 $ECHO "$obj" >> $output
7995 delfiles="$delfiles $output"
7996 elif test -n "$save_libobjs" && test "X$skipped_export" != "X:" && test "X$file_list_spec" != X; then
7997 output=${output_objdir}/${output_la}.lnk
7998 func_verbose "creating linker input file list: $output"
8003 if test "$compiler_needs_object" = yes; then
8009 $ECHO "$obj" >> $output
8011 delfiles="$delfiles $output"
8012 output=$firstobj\"$file_list_spec$output\"
8014 if test -n "$save_libobjs"; then
8015 func_verbose "creating reloadable object files..."
8016 output=$output_objdir/$output_la-${k}.$objext
8017 eval test_cmds=\"$reload_cmds\"
8018 func_len " $test_cmds"
8019 len0=$func_len_result
8022 # Loop over the list of objects to be linked.
8023 for obj in $save_libobjs
8026 func_arith $len + $func_len_result
8027 len=$func_arith_result
8028 if test "X$objlist" = X ||
8029 test "$len" -lt "$max_cmd_len"; then
8030 func_append objlist " $obj"
8032 # The command $test_cmds is almost too long, add a
8033 # command to the queue.
8034 if test "$k" -eq 1 ; then
8035 # The first file doesn't have a previous command to add.
8036 reload_objs=$objlist
8037 eval concat_cmds=\"$reload_cmds\"
8039 # All subsequent reloadable object files will link in
8040 # the last one created.
8041 reload_objs="$objlist $last_robj"
8042 eval concat_cmds=\"\$concat_cmds~$reload_cmds~\$RM $last_robj\"
8044 last_robj=$output_objdir/$output_la-${k}.$objext
8046 k=$func_arith_result
8047 output=$output_objdir/$output_la-${k}.$objext
8049 func_len " $last_robj"
8050 func_arith $len0 + $func_len_result
8051 len=$func_arith_result
8054 # Handle the remaining objects by creating one last
8055 # reloadable object file. All subsequent reloadable object
8056 # files will link in the last one created.
8057 test -z "$concat_cmds" || concat_cmds=$concat_cmds~
8058 reload_objs="$objlist $last_robj"
8059 eval concat_cmds=\"\${concat_cmds}$reload_cmds\"
8060 if test -n "$last_robj"; then
8061 eval concat_cmds=\"\${concat_cmds}~\$RM $last_robj\"
8063 delfiles="$delfiles $output"
8069 if ${skipped_export-false}; then
8070 func_verbose "generating symbol list for \`$libname.la'"
8071 export_symbols="$output_objdir/$libname.exp"
8072 $opt_dry_run || $RM $export_symbols
8074 # Append the command to create the export file.
8075 test -z "$concat_cmds" || concat_cmds=$concat_cmds~
8076 eval concat_cmds=\"\$concat_cmds$export_symbols_cmds\"
8077 if test -n "$last_robj"; then
8078 eval concat_cmds=\"\$concat_cmds~\$RM $last_robj\"
8082 test -n "$save_libobjs" &&
8083 func_verbose "creating a temporary reloadable object file: $output"
8085 # Loop through the commands generated above and execute them.
8086 save_ifs="$IFS"; IFS='~'
8087 for cmd in $concat_cmds; do
8090 func_quote_for_expand "$cmd"
8091 eval "func_echo $func_quote_for_expand_result"
8093 $opt_dry_run || eval "$cmd" || {
8096 # Restore the uninstalled library and exit
8097 if test "$mode" = relink; then
8098 ( cd "$output_objdir" && \
8099 $RM "${realname}T" && \
8100 $MV "${realname}U" "$realname" )
8108 if test -n "$export_symbols_regex" && ${skipped_export-false}; then
8109 func_show_eval '$EGREP -e "$export_symbols_regex" "$export_symbols" > "${export_symbols}T"'
8110 func_show_eval '$MV "${export_symbols}T" "$export_symbols"'
8114 if ${skipped_export-false}; then
8115 if test -n "$export_symbols" && test -n "$include_expsyms"; then
8116 tmp_export_symbols="$export_symbols"
8117 test -n "$orig_export_symbols" && tmp_export_symbols="$orig_export_symbols"
8118 $opt_dry_run || eval '$ECHO "$include_expsyms" | $SP2NL >> "$tmp_export_symbols"'
8121 if test -n "$orig_export_symbols"; then
8122 # The given exports_symbols file has to be filtered, so filter it.
8123 func_verbose "filter symbol list for \`$libname.la' to tag DATA exports"
8124 # FIXME: $output_objdir/$libname.filter potentially contains lots of
8125 # 's' commands which not all seds can handle. GNU sed should be fine
8126 # though. Also, the filter scales superlinearly with the number of
8127 # global variables. join(1) would be nice here, but unfortunately
8128 # isn't a blessed tool.
8129 $opt_dry_run || $SED -e '/[ ,]DATA/!d;s,\(.*\)\([ \,].*\),s|^\1$|\1\2|,' < $export_symbols > $output_objdir/$libname.filter
8130 delfiles="$delfiles $export_symbols $output_objdir/$libname.filter"
8131 export_symbols=$output_objdir/$libname.def
8132 $opt_dry_run || $SED -f $output_objdir/$libname.filter < $orig_export_symbols > $export_symbols
8137 # Restore the value of output.
8140 if test -n "$convenience" && test -n "$whole_archive_flag_spec"; then
8141 eval libobjs=\"\$libobjs $whole_archive_flag_spec\"
8142 test "X$libobjs" = "X " && libobjs=
8144 # Expand the library linking commands again to reset the
8145 # value of $libobjs for piecewise linking.
8147 # Do each of the archive commands.
8148 if test "$module" = yes && test -n "$module_cmds" ; then
8149 if test -n "$export_symbols" && test -n "$module_expsym_cmds"; then
8150 cmds=$module_expsym_cmds
8155 if test -n "$export_symbols" && test -n "$archive_expsym_cmds"; then
8156 cmds=$archive_expsym_cmds
8163 if test -n "$delfiles"; then
8164 # Append the command to remove temporary files to $cmds.
8165 eval cmds=\"\$cmds~\$RM $delfiles\"
8168 # Add any objects from preloaded convenience libraries
8169 if test -n "$dlprefiles"; then
8170 gentop="$output_objdir/${outputname}x"
8171 generated="$generated $gentop"
8173 func_extract_archives $gentop $dlprefiles
8174 libobjs="$libobjs $func_extract_archives_result"
8175 test "X$libobjs" = "X " && libobjs=
8178 save_ifs="$IFS"; IFS='~'
8179 for cmd in $cmds; do
8183 func_quote_for_expand "$cmd"
8184 eval "func_echo $func_quote_for_expand_result"
8186 $opt_dry_run || eval "$cmd" || {
8189 # Restore the uninstalled library and exit
8190 if test "$mode" = relink; then
8191 ( cd "$output_objdir" && \
8192 $RM "${realname}T" && \
8193 $MV "${realname}U" "$realname" )
8201 # Restore the uninstalled library and exit
8202 if test "$mode" = relink; then
8203 $opt_dry_run || eval '(cd $output_objdir && $RM ${realname}T && $MV $realname ${realname}T && $MV ${realname}U $realname)' || exit $?
8205 if test -n "$convenience"; then
8206 if test -z "$whole_archive_flag_spec"; then
8207 func_show_eval '${RM}r "$gentop"'
8214 # Create links to the real library.
8215 for linkname in $linknames; do
8216 if test "$realname" != "$linkname"; then
8217 func_show_eval '(cd "$output_objdir" && $RM "$linkname" && $LN_S "$realname" "$linkname")' 'exit $?'
8221 # If -module or -export-dynamic was specified, set the dlname.
8222 if test "$module" = yes || test "$export_dynamic" = yes; then
8223 # On all known operating systems, these are identical.
8230 if test -n "$dlfiles$dlprefiles" || test "$dlself" != no; then
8231 func_warning "\`-dlopen' is ignored for objects"
8236 func_warning "\`-l' and \`-L' are ignored for objects" ;;
8239 test -n "$rpath" && \
8240 func_warning "\`-rpath' is ignored for objects"
8242 test -n "$xrpath" && \
8243 func_warning "\`-R' is ignored for objects"
8245 test -n "$vinfo" && \
8246 func_warning "\`-version-info' is ignored for objects"
8248 test -n "$release" && \
8249 func_warning "\`-release' is ignored for objects"
8253 test -n "$objs$old_deplibs" && \
8254 func_fatal_error "cannot build library object \`$output' from non-libtool objects"
8258 obj=$func_lo2o_result
8266 # Delete the old objects.
8267 $opt_dry_run || $RM $obj $libobj
8269 # Objects from convenience libraries. This assumes
8270 # single-version convenience libraries. Whenever we create
8271 # different ones for PIC/non-PIC, this we'll have to duplicate
8275 # reload_cmds runs $LD directly, so let us get rid of
8276 # -Wl from whole_archive_flag_spec and hope we can get by with
8277 # turning comma into space..
8280 if test -n "$convenience"; then
8281 if test -n "$whole_archive_flag_spec"; then
8282 eval tmp_whole_archive_flags=\"$whole_archive_flag_spec\"
8283 reload_conv_objs=$reload_objs\ `$ECHO "$tmp_whole_archive_flags" | $SED 's|,| |g'`
8285 gentop="$output_objdir/${obj}x"
8286 generated="$generated $gentop"
8288 func_extract_archives $gentop $convenience
8289 reload_conv_objs="$reload_objs $func_extract_archives_result"
8293 # Create the old-style object.
8294 reload_objs="$objs$old_deplibs "`$ECHO "$libobjs" | $SP2NL | $SED "/\.${libext}$/d; /\.lib$/d; $lo2o" | $NL2SP`" $reload_conv_objs" ### testsuite: skip nested quoting test
8297 func_execute_cmds "$reload_cmds" 'exit $?'
8299 # Exit if we aren't doing a library object file.
8300 if test -z "$libobj"; then
8301 if test -n "$gentop"; then
8302 func_show_eval '${RM}r "$gentop"'
8308 if test "$build_libtool_libs" != yes; then
8309 if test -n "$gentop"; then
8310 func_show_eval '${RM}r "$gentop"'
8313 # Create an invalid libtool object if no PIC, so that we don't
8314 # accidentally link it into a program.
8315 # $show "echo timestamp > $libobj"
8316 # $opt_dry_run || eval "echo timestamp > $libobj" || exit $?
8320 if test -n "$pic_flag" || test "$pic_mode" != default; then
8321 # Only do commands if we really have different PIC objects.
8322 reload_objs="$libobjs $reload_conv_objs"
8324 func_execute_cmds "$reload_cmds" 'exit $?'
8327 if test -n "$gentop"; then
8328 func_show_eval '${RM}r "$gentop"'
8336 *cygwin*) func_stripname '' '.exe' "$output"
8337 output=$func_stripname_result.exe;;
8339 test -n "$vinfo" && \
8340 func_warning "\`-version-info' is ignored for programs"
8342 test -n "$release" && \
8343 func_warning "\`-release' is ignored for programs"
8345 test "$preload" = yes \
8346 && test "$dlopen_support" = unknown \
8347 && test "$dlopen_self" = unknown \
8348 && test "$dlopen_self_static" = unknown && \
8349 func_warning "\`LT_INIT([dlopen])' not used. Assuming no dlopen support."
8352 *-*-rhapsody* | *-*-darwin1.[012])
8353 # On Rhapsody replace the C library is the System framework
8354 compile_deplibs=`$ECHO " $compile_deplibs" | $SED 's/ -lc / System.ltframework /'`
8355 finalize_deplibs=`$ECHO " $finalize_deplibs" | $SED 's/ -lc / System.ltframework /'`
8361 # Don't allow lazy linking, it breaks C++ global constructors
8362 # But is supposedly fixed on 10.4 or later (yay!).
8363 if test "$tagname" = CXX ; then
8364 case ${MACOSX_DEPLOYMENT_TARGET-10.0} in
8366 compile_command="$compile_command ${wl}-bind_at_load"
8367 finalize_command="$finalize_command ${wl}-bind_at_load"
8371 # Time to change all our "foo.ltframework" stuff back to "-framework foo"
8372 compile_deplibs=`$ECHO " $compile_deplibs" | $SED 's% \([^ $]*\).ltframework% -framework \1%g'`
8373 finalize_deplibs=`$ECHO " $finalize_deplibs" | $SED 's% \([^ $]*\).ltframework% -framework \1%g'`
8378 # move library search paths that coincide with paths to not yet
8379 # installed libraries to the beginning of the library search list
8381 for path in $notinst_path; do
8382 case " $new_libs " in
8383 *" -L$path/$objdir "*) ;;
8385 case " $compile_deplibs " in
8386 *" -L$path/$objdir "*)
8387 new_libs="$new_libs -L$path/$objdir" ;;
8392 for deplib in $compile_deplibs; do
8395 case " $new_libs " in
8397 *) new_libs="$new_libs $deplib" ;;
8400 *) new_libs="$new_libs $deplib" ;;
8403 compile_deplibs="$new_libs"
8406 compile_command="$compile_command $compile_deplibs"
8407 finalize_command="$finalize_command $finalize_deplibs"
8409 if test -n "$rpath$xrpath"; then
8410 # If the user specified any rpath flags, then add them.
8411 for libdir in $rpath $xrpath; do
8412 # This is the magic to use -rpath.
8413 case "$finalize_rpath " in
8415 *) finalize_rpath="$finalize_rpath $libdir" ;;
8420 # Now hardcode the library paths
8423 for libdir in $compile_rpath $finalize_rpath; do
8424 if test -n "$hardcode_libdir_flag_spec"; then
8425 if test -n "$hardcode_libdir_separator"; then
8426 if test -z "$hardcode_libdirs"; then
8427 hardcode_libdirs="$libdir"
8429 # Just accumulate the unique libdirs.
8430 case $hardcode_libdir_separator$hardcode_libdirs$hardcode_libdir_separator in
8431 *"$hardcode_libdir_separator$libdir$hardcode_libdir_separator"*)
8434 hardcode_libdirs="$hardcode_libdirs$hardcode_libdir_separator$libdir"
8439 eval flag=\"$hardcode_libdir_flag_spec\"
8440 rpath="$rpath $flag"
8442 elif test -n "$runpath_var"; then
8443 case "$perm_rpath " in
8445 *) perm_rpath="$perm_rpath $libdir" ;;
8449 *-*-cygwin* | *-*-mingw* | *-*-pw32* | *-*-os2* | *-cegcc*)
8450 testbindir=`${ECHO} "$libdir" | ${SED} -e 's*/lib$*/bin*'`
8451 case :$dllsearchpath: in
8453 ::) dllsearchpath=$libdir;;
8454 *) dllsearchpath="$dllsearchpath:$libdir";;
8456 case :$dllsearchpath: in
8457 *":$testbindir:"*) ;;
8458 ::) dllsearchpath=$testbindir;;
8459 *) dllsearchpath="$dllsearchpath:$testbindir";;
8464 # Substitute the hardcoded libdirs into the rpath.
8465 if test -n "$hardcode_libdir_separator" &&
8466 test -n "$hardcode_libdirs"; then
8467 libdir="$hardcode_libdirs"
8468 eval rpath=\" $hardcode_libdir_flag_spec\"
8470 compile_rpath="$rpath"
8474 for libdir in $finalize_rpath; do
8475 if test -n "$hardcode_libdir_flag_spec"; then
8476 if test -n "$hardcode_libdir_separator"; then
8477 if test -z "$hardcode_libdirs"; then
8478 hardcode_libdirs="$libdir"
8480 # Just accumulate the unique libdirs.
8481 case $hardcode_libdir_separator$hardcode_libdirs$hardcode_libdir_separator in
8482 *"$hardcode_libdir_separator$libdir$hardcode_libdir_separator"*)
8485 hardcode_libdirs="$hardcode_libdirs$hardcode_libdir_separator$libdir"
8490 eval flag=\"$hardcode_libdir_flag_spec\"
8491 rpath="$rpath $flag"
8493 elif test -n "$runpath_var"; then
8494 case "$finalize_perm_rpath " in
8496 *) finalize_perm_rpath="$finalize_perm_rpath $libdir" ;;
8500 # Substitute the hardcoded libdirs into the rpath.
8501 if test -n "$hardcode_libdir_separator" &&
8502 test -n "$hardcode_libdirs"; then
8503 libdir="$hardcode_libdirs"
8504 eval rpath=\" $hardcode_libdir_flag_spec\"
8506 finalize_rpath="$rpath"
8508 if test -n "$libobjs" && test "$build_old_libs" = yes; then
8509 # Transform all the library objects into standard objects.
8510 compile_command=`$ECHO "$compile_command" | $SP2NL | $SED "$lo2o" | $NL2SP`
8511 finalize_command=`$ECHO "$finalize_command" | $SP2NL | $SED "$lo2o" | $NL2SP`
8514 func_generate_dlsyms "$outputname" "@PROGRAM@" "no"
8516 # template prelinking step
8517 if test -n "$prelink_cmds"; then
8518 func_execute_cmds "$prelink_cmds" 'exit $?'
8521 wrappers_required=yes
8523 *cegcc* | *mingw32ce*)
8524 # Disable wrappers for cegcc and mingw32ce hosts, we are cross compiling anyway.
8525 wrappers_required=no
8527 *cygwin* | *mingw* )
8528 if test "$build_libtool_libs" != yes; then
8529 wrappers_required=no
8533 if test "$need_relink" = no || test "$build_libtool_libs" != yes; then
8534 wrappers_required=no
8538 if test "$wrappers_required" = no; then
8539 # Replace the output file specification.
8540 compile_command=`$ECHO "$compile_command" | $SED 's%@OUTPUT@%'"$output"'%g'`
8541 link_command="$compile_command$compile_rpath"
8543 # We have no uninstalled library dependencies, so finalize right now.
8545 func_show_eval "$link_command" 'exit_status=$?'
8547 # Delete the generated files.
8548 if test -f "$output_objdir/${outputname}S.${objext}"; then
8549 func_show_eval '$RM "$output_objdir/${outputname}S.${objext}"'
8555 if test -n "$compile_shlibpath$finalize_shlibpath"; then
8556 compile_command="$shlibpath_var=\"$compile_shlibpath$finalize_shlibpath\$$shlibpath_var\" $compile_command"
8558 if test -n "$finalize_shlibpath"; then
8559 finalize_command="$shlibpath_var=\"$finalize_shlibpath\$$shlibpath_var\" $finalize_command"
8564 if test -n "$runpath_var"; then
8565 if test -n "$perm_rpath"; then
8566 # We should set the runpath_var.
8568 for dir in $perm_rpath; do
8571 compile_var="$runpath_var=\"$rpath\$$runpath_var\" "
8573 if test -n "$finalize_perm_rpath"; then
8574 # We should set the runpath_var.
8576 for dir in $finalize_perm_rpath; do
8579 finalize_var="$runpath_var=\"$rpath\$$runpath_var\" "
8583 if test "$no_install" = yes; then
8584 # We don't need to create a wrapper script.
8585 link_command="$compile_var$compile_command$compile_rpath"
8586 # Replace the output file specification.
8587 link_command=`$ECHO "$link_command" | $SED 's%@OUTPUT@%'"$output"'%g'`
8588 # Delete the old output file.
8589 $opt_dry_run || $RM $output
8590 # Link the executable and exit
8591 func_show_eval "$link_command" 'exit $?'
8595 if test "$hardcode_action" = relink; then
8596 # Fast installation is not supported
8597 link_command="$compile_var$compile_command$compile_rpath"
8598 relink_command="$finalize_var$finalize_command$finalize_rpath"
8600 func_warning "this platform does not like uninstalled shared libraries"
8601 func_warning "\`$output' will be relinked during installation"
8603 if test "$fast_install" != no; then
8604 link_command="$finalize_var$compile_command$finalize_rpath"
8605 if test "$fast_install" = yes; then
8606 relink_command=`$ECHO "$compile_var$compile_command$compile_rpath" | $SED 's%@OUTPUT@%\$progdir/\$file%g'`
8608 # fast_install is set to needless
8612 link_command="$compile_var$compile_command$compile_rpath"
8613 relink_command="$finalize_var$finalize_command$finalize_rpath"
8617 # Replace the output file specification.
8618 link_command=`$ECHO "$link_command" | $SED 's%@OUTPUT@%'"$output_objdir/$outputname"'%g'`
8620 # Delete the old output files.
8621 $opt_dry_run || $RM $output $output_objdir/$outputname $output_objdir/lt-$outputname
8623 func_show_eval "$link_command" 'exit $?'
8625 # Now create the wrapper script.
8626 func_verbose "creating $output"
8628 # Quote the relink command for shipping.
8629 if test -n "$relink_command"; then
8630 # Preserve any variables that may affect compiler behavior
8631 for var in $variables_saved_for_relink; do
8632 if eval test -z \"\${$var+set}\"; then
8633 relink_command="{ test -z \"\${$var+set}\" || $lt_unset $var || { $var=; export $var; }; }; $relink_command"
8634 elif eval var_value=\$$var; test -z "$var_value"; then
8635 relink_command="$var=; export $var; $relink_command"
8637 func_quote_for_eval "$var_value"
8638 relink_command="$var=$func_quote_for_eval_result; export $var; $relink_command"
8641 relink_command="(cd `pwd`; $relink_command)"
8642 relink_command=`$ECHO "$relink_command" | $SED "$sed_quote_subst"`
8645 # Only actually do things if not in dry run mode.
8647 # win32 will think the script is a binary if it has
8648 # a .exe suffix, so we strip it off here.
8650 *.exe) func_stripname '' '.exe' "$output"
8651 output=$func_stripname_result ;;
8653 # test for cygwin because mv fails w/o .exe extensions
8657 func_stripname '' '.exe' "$outputname"
8658 outputname=$func_stripname_result ;;
8662 *cygwin* | *mingw* )
8663 func_dirname_and_basename "$output" "" "."
8664 output_name=$func_basename_result
8665 output_path=$func_dirname_result
8666 cwrappersource="$output_path/$objdir/lt-$output_name.c"
8667 cwrapper="$output_path/$output_name.exe"
8668 $RM $cwrappersource $cwrapper
8669 trap "$RM $cwrappersource $cwrapper; exit $EXIT_FAILURE" 1 2 15
8671 func_emit_cwrapperexe_src > $cwrappersource
8673 # The wrapper executable is built using the $host compiler,
8674 # because it contains $host paths and files. If cross-
8675 # compiling, it, like the target executable, must be
8676 # executed on the $host or under an emulation environment.
8678 $LTCC $LTCFLAGS -o $cwrapper $cwrappersource
8682 # Now, create the wrapper script for func_source use:
8683 func_ltwrapper_scriptname $cwrapper
8684 $RM $func_ltwrapper_scriptname_result
8685 trap "$RM $func_ltwrapper_scriptname_result; exit $EXIT_FAILURE" 1 2 15
8687 # note: this script will not be executed, so do not chmod.
8688 if test "x$build" = "x$host" ; then
8689 $cwrapper --lt-dump-script > $func_ltwrapper_scriptname_result
8691 func_emit_wrapper no > $func_ltwrapper_scriptname_result
8697 trap "$RM $output; exit $EXIT_FAILURE" 1 2 15
8699 func_emit_wrapper no > $output
8708 # See if we need to build an old-fashioned archive.
8709 for oldlib in $oldlibs; do
8711 if test "$build_libtool_libs" = convenience; then
8712 oldobjs="$libobjs_save $symfileobj"
8713 addlibs="$convenience"
8714 build_libtool_libs=no
8716 if test "$build_libtool_libs" = module; then
8717 oldobjs="$libobjs_save"
8718 build_libtool_libs=no
8720 oldobjs="$old_deplibs $non_pic_objects"
8721 if test "$preload" = yes && test -f "$symfileobj"; then
8722 oldobjs="$oldobjs $symfileobj"
8725 addlibs="$old_convenience"
8728 if test -n "$addlibs"; then
8729 gentop="$output_objdir/${outputname}x"
8730 generated="$generated $gentop"
8732 func_extract_archives $gentop $addlibs
8733 oldobjs="$oldobjs $func_extract_archives_result"
8736 # Do each command in the archive commands.
8737 if test -n "$old_archive_from_new_cmds" && test "$build_libtool_libs" = yes; then
8738 cmds=$old_archive_from_new_cmds
8741 # Add any objects from preloaded convenience libraries
8742 if test -n "$dlprefiles"; then
8743 gentop="$output_objdir/${outputname}x"
8744 generated="$generated $gentop"
8746 func_extract_archives $gentop $dlprefiles
8747 oldobjs="$oldobjs $func_extract_archives_result"
8750 # POSIX demands no paths to be encoded in archives. We have
8751 # to avoid creating archives with duplicate basenames if we
8752 # might have to extract them afterwards, e.g., when creating a
8753 # static archive out of a convenience library, or when linking
8754 # the entirety of a libtool archive into another (currently
8755 # not supported by libtool).
8756 if (for obj in $oldobjs
8758 func_basename "$obj"
8759 $ECHO "$func_basename_result"
8760 done | sort | sort -uc >/dev/null 2>&1); then
8763 echo "copying selected object files to avoid basename conflicts..."
8764 gentop="$output_objdir/${outputname}x"
8765 generated="$generated $gentop"
8766 func_mkdir_p "$gentop"
8767 save_oldobjs=$oldobjs
8770 for obj in $save_oldobjs
8772 func_basename "$obj"
8773 objbase="$func_basename_result"
8774 case " $oldobjs " in
8775 " ") oldobjs=$obj ;;
8778 # Make sure we don't pick an alternate name that also
8780 newobj=lt$counter-$objbase
8781 func_arith $counter + 1
8782 counter=$func_arith_result
8783 case " $oldobjs " in
8784 *[\ /]"$newobj "*) ;;
8785 *) if test ! -f "$gentop/$newobj"; then break; fi ;;
8788 func_show_eval "ln $obj $gentop/$newobj || cp $obj $gentop/$newobj"
8789 oldobjs="$oldobjs $gentop/$newobj"
8791 *) oldobjs="$oldobjs $obj" ;;
8795 eval cmds=\"$old_archive_cmds\"
8798 len=$func_len_result
8799 if test "$len" -lt "$max_cmd_len" || test "$max_cmd_len" -le -1; then
8800 cmds=$old_archive_cmds
8802 # the command line is too long to link in one step, link in parts
8803 func_verbose "using piecewise archive linking..."
8808 save_oldobjs=$oldobjs
8810 # Is there a better way of finding the last object in the list?
8811 for obj in $save_oldobjs
8815 eval test_cmds=\"$old_archive_cmds\"
8816 func_len " $test_cmds"
8817 len0=$func_len_result
8819 for obj in $save_oldobjs
8822 func_arith $len + $func_len_result
8823 len=$func_arith_result
8824 func_append objlist " $obj"
8825 if test "$len" -lt "$max_cmd_len"; then
8828 # the above command should be used before it gets too long
8830 if test "$obj" = "$last_oldobj" ; then
8833 test -z "$concat_cmds" || concat_cmds=$concat_cmds~
8834 eval concat_cmds=\"\${concat_cmds}$old_archive_cmds\"
8841 if test "X$oldobjs" = "X" ; then
8842 eval cmds=\"\$concat_cmds\"
8844 eval cmds=\"\$concat_cmds~\$old_archive_cmds\"
8848 func_execute_cmds "$cmds" 'exit $?'
8851 test -n "$generated" && \
8852 func_show_eval "${RM}r$generated"
8854 # Now create the libtool archive.
8858 test "$build_old_libs" = yes && old_library="$libname.$libext"
8859 func_verbose "creating $output"
8861 # Preserve any variables that may affect compiler behavior
8862 for var in $variables_saved_for_relink; do
8863 if eval test -z \"\${$var+set}\"; then
8864 relink_command="{ test -z \"\${$var+set}\" || $lt_unset $var || { $var=; export $var; }; }; $relink_command"
8865 elif eval var_value=\$$var; test -z "$var_value"; then
8866 relink_command="$var=; export $var; $relink_command"
8868 func_quote_for_eval "$var_value"
8869 relink_command="$var=$func_quote_for_eval_result; export $var; $relink_command"
8872 # Quote the link command for shipping.
8873 relink_command="(cd `pwd`; $SHELL $progpath $preserve_args --mode=relink $libtool_args @inst_prefix_dir@)"
8874 relink_command=`$ECHO "$relink_command" | $SED "$sed_quote_subst"`
8875 if test "$hardcode_automatic" = yes ; then
8879 # Only create the output if not a dry run.
8881 for installed in no yes; do
8882 if test "$installed" = yes; then
8883 if test -z "$install_libdir"; then
8886 output="$output_objdir/$outputname"i
8887 # Replace all uninstalled libtool libraries with the installed ones
8889 for deplib in $dependency_libs; do
8892 func_basename "$deplib"
8893 name="$func_basename_result"
8894 eval libdir=`${SED} -n -e 's/^libdir=\(.*\)$/\1/p' $deplib`
8895 test -z "$libdir" && \
8896 func_fatal_error "\`$deplib' is not a valid libtool archive"
8897 newdependency_libs="$newdependency_libs $libdir/$name"
8899 *) newdependency_libs="$newdependency_libs $deplib" ;;
8902 dependency_libs="$newdependency_libs"
8905 for lib in $dlfiles; do
8908 func_basename "$lib"
8909 name="$func_basename_result"
8910 eval libdir=`${SED} -n -e 's/^libdir=\(.*\)$/\1/p' $lib`
8911 test -z "$libdir" && \
8912 func_fatal_error "\`$lib' is not a valid libtool archive"
8913 newdlfiles="$newdlfiles $libdir/$name"
8915 *) newdlfiles="$newdlfiles $lib" ;;
8918 dlfiles="$newdlfiles"
8920 for lib in $dlprefiles; do
8923 # Only pass preopened files to the pseudo-archive (for
8924 # eventual linking with the app. that links it) if we
8925 # didn't already link the preopened objects directly into
8927 func_basename "$lib"
8928 name="$func_basename_result"
8929 eval libdir=`${SED} -n -e 's/^libdir=\(.*\)$/\1/p' $lib`
8930 test -z "$libdir" && \
8931 func_fatal_error "\`$lib' is not a valid libtool archive"
8932 newdlprefiles="$newdlprefiles $libdir/$name"
8936 dlprefiles="$newdlprefiles"
8939 for lib in $dlfiles; do
8941 [\\/]* | [A-Za-z]:[\\/]*) abs="$lib" ;;
8942 *) abs=`pwd`"/$lib" ;;
8944 newdlfiles="$newdlfiles $abs"
8946 dlfiles="$newdlfiles"
8948 for lib in $dlprefiles; do
8950 [\\/]* | [A-Za-z]:[\\/]*) abs="$lib" ;;
8951 *) abs=`pwd`"/$lib" ;;
8953 newdlprefiles="$newdlprefiles $abs"
8955 dlprefiles="$newdlprefiles"
8958 # place dlname in correct position for cygwin
8959 # In fact, it would be nice if we could use this code for all target
8960 # systems that can't hard-code library paths into their executables
8961 # and that have no shared library path variable independent of PATH,
8962 # but it turns out we can't easily determine that from inspecting
8963 # libtool variables, so we have to hard-code the OSs to which it
8964 # applies here; at the moment, that means platforms that use the PE
8965 # object format with DLL files. See the long comment at the top of
8966 # tests/bindir.at for full details.
8968 case $host,$output,$installed,$module,$dlname in
8969 *cygwin*,*lai,yes,no,*.dll | *mingw*,*lai,yes,no,*.dll | *cegcc*,*lai,yes,no,*.dll)
8970 # If a -bindir argument was supplied, place the dll there.
8971 if test "x$bindir" != x ;
8973 func_relative_path "$install_libdir" "$bindir"
8974 tdlname=$func_relative_path_result$dlname
8976 # Otherwise fall back on heuristic.
8977 tdlname=../bin/$dlname
8982 # $outputname - a libtool library file
8983 # Generated by $PROGRAM (GNU $PACKAGE$TIMESTAMP) $VERSION
8985 # Please DO NOT delete this file!
8986 # It is necessary for linking the library.
8988 # The name that we can dlopen(3).
8991 # Names of this library.
8992 library_names='$library_names'
8994 # The name of the static archive.
8995 old_library='$old_library'
8997 # Linker flags that can not go in dependency_libs.
8998 inherited_linker_flags='$new_inherited_linker_flags'
9000 # Libraries that this one depends upon.
9001 dependency_libs='$dependency_libs'
9003 # Names of additional weak libraries provided by this library
9004 weak_library_names='$weak_libs'
9006 # Version information for $libname.
9011 # Is this an already installed library?
9012 installed=$installed
9014 # Should we warn about portability when linking against -modules?
9015 shouldnotlink=$module
9017 # Files to dlopen/dlpreopen
9019 dlpreopen='$dlprefiles'
9021 # Directory that this library needs to be installed in:
9022 libdir='$install_libdir'"
9023 if test "$installed" = no && test "$need_relink" = yes; then
9025 relink_command=\"$relink_command\""
9030 # Do a symbolic link so that the libtool archive can be found in
9031 # LD_LIBRARY_PATH before the program is installed.
9032 func_show_eval '( cd "$output_objdir" && $RM "$outputname" && $LN_S "../$outputname" "$outputname" )' 'exit $?'
9038 { test "$mode" = link || test "$mode" = relink; } &&
9039 func_mode_link ${1+"$@"}
9042 # func_mode_uninstall arg...
9043 func_mode_uninstall ()
9051 # This variable tells wrapper scripts just to set variables rather
9052 # than running their programs.
9053 libtool_install_magic="$magic"
9058 -f) RM="$RM $arg"; rmforce=yes ;;
9059 -*) RM="$RM $arg" ;;
9060 *) files="$files $arg" ;;
9065 func_fatal_help "you must specify an RM program"
9069 origobjdir="$objdir"
9070 for file in $files; do
9071 func_dirname "$file" "" "."
9072 dir="$func_dirname_result"
9073 if test "X$dir" = X.; then
9074 objdir="$origobjdir"
9076 objdir="$dir/$origobjdir"
9078 func_basename "$file"
9079 name="$func_basename_result"
9080 test "$mode" = uninstall && objdir="$dir"
9082 # Remember objdir for removal later, being careful to avoid duplicates
9083 if test "$mode" = clean; then
9086 *) rmdirs="$rmdirs $objdir" ;;
9090 # Don't error if the file doesn't exist and rm -f was used.
9091 if { test -L "$file"; } >/dev/null 2>&1 ||
9092 { test -h "$file"; } >/dev/null 2>&1 ||
9093 test -f "$file"; then
9095 elif test -d "$file"; then
9098 elif test "$rmforce" = yes; then
9106 # Possibly a libtool archive, so verify it.
9107 if func_lalib_p "$file"; then
9108 func_source $dir/$name
9110 # Delete the libtool libraries and symlinks.
9111 for n in $library_names; do
9112 rmfiles="$rmfiles $objdir/$n"
9114 test -n "$old_library" && rmfiles="$rmfiles $objdir/$old_library"
9118 case " $library_names " in
9119 # " " in the beginning catches empty $dlname
9121 *) rmfiles="$rmfiles $objdir/$dlname" ;;
9123 test -n "$libdir" && rmfiles="$rmfiles $objdir/$name $objdir/${name}i"
9126 if test -n "$library_names"; then
9127 # Do each command in the postuninstall commands.
9128 func_execute_cmds "$postuninstall_cmds" 'test "$rmforce" = yes || exit_status=1'
9131 if test -n "$old_library"; then
9132 # Do each command in the old_postuninstall commands.
9133 func_execute_cmds "$old_postuninstall_cmds" 'test "$rmforce" = yes || exit_status=1'
9135 # FIXME: should reinstall the best remaining shared library.
9142 # Possibly a libtool object, so verify it.
9143 if func_lalib_p "$file"; then
9146 func_source $dir/$name
9148 # Add PIC object to the list of files to remove.
9149 if test -n "$pic_object" &&
9150 test "$pic_object" != none; then
9151 rmfiles="$rmfiles $dir/$pic_object"
9154 # Add non-PIC object to the list of files to remove.
9155 if test -n "$non_pic_object" &&
9156 test "$non_pic_object" != none; then
9157 rmfiles="$rmfiles $dir/$non_pic_object"
9163 if test "$mode" = clean ; then
9167 func_stripname '' '.exe' "$file"
9168 file=$func_stripname_result
9169 func_stripname '' '.exe' "$name"
9170 noexename=$func_stripname_result
9171 # $file with .exe has already been added to rmfiles,
9172 # add $file without .exe
9173 rmfiles="$rmfiles $file"
9176 # Do a test to see if this is a libtool program.
9177 if func_ltwrapper_p "$file"; then
9178 if func_ltwrapper_executable_p "$file"; then
9179 func_ltwrapper_scriptname "$file"
9181 func_source $func_ltwrapper_scriptname_result
9182 rmfiles="$rmfiles $func_ltwrapper_scriptname_result"
9185 func_source $dir/$noexename
9188 # note $name still contains .exe if it was in $file originally
9189 # as does the version of $file that was added into $rmfiles
9190 rmfiles="$rmfiles $objdir/$name $objdir/${name}S.${objext}"
9191 if test "$fast_install" = yes && test -n "$relink_command"; then
9192 rmfiles="$rmfiles $objdir/lt-$name"
9194 if test "X$noexename" != "X$name" ; then
9195 rmfiles="$rmfiles $objdir/lt-${noexename}.c"
9201 func_show_eval "$RM $rmfiles" 'exit_status=1'
9203 objdir="$origobjdir"
9205 # Try to remove the ${objdir}s in the directories where we deleted files
9206 for dir in $rmdirs; do
9207 if test -d "$dir"; then
9208 func_show_eval "rmdir $dir >/dev/null 2>&1"
9215 { test "$mode" = uninstall || test "$mode" = clean; } &&
9216 func_mode_uninstall ${1+"$@"}
9218 test -z "$mode" && {
9219 help="$generic_help"
9220 func_fatal_help "you must specify a MODE"
9223 test -z "$exec_cmd" && \
9224 func_fatal_help "invalid operation mode \`$mode'"
9226 if test -n "$exec_cmd"; then
9227 eval exec "$exec_cmd"
9234 # The TAGs below are defined such that we never get into a situation
9235 # in which we disable both kinds of libraries. Given conflicting
9236 # choices, we go for a static library, that is the most portable,
9237 # since we can't tell whether shared libraries were disabled because
9238 # the user asked for that or because the platform doesn't support
9239 # them. This is particularly important on AIX, because we don't
9240 # support having both static and shared libraries enabled at the same
9241 # time on that platform, so we default to a shared-only configuration.
9242 # If a disable-shared tag is given, we'll fallback to a static-only
9243 # configuration. But we'll never go from static-only to shared-only.
9245 # ### BEGIN LIBTOOL TAG CONFIG: disable-shared
9246 build_libtool_libs=no
9248 # ### END LIBTOOL TAG CONFIG: disable-shared
9250 # ### BEGIN LIBTOOL TAG CONFIG: disable-static
9251 build_old_libs=`case $build_libtool_libs in yes) echo no;; *) echo yes;; esac`
9252 # ### END LIBTOOL TAG CONFIG: disable-static
9261 # ### BEGIN LIBTOOL TAG CONFIG: CXX
9263 # The linker used to build libraries.
9264 LD="/usr/bin/ld -m elf_x86_64"
9266 # How to create reloadable object files.
9268 reload_cmds="\$LD\$reload_flag -o \$output\$reload_objs"
9270 # Commands used to build an old-style archive.
9271 old_archive_cmds="\$AR \$AR_FLAGS \$oldlib\$oldobjs~\$RANLIB \$oldlib"
9273 # A language specific compiler.
9276 # Is the compiler the GNU compiler?
9279 # Compiler flag to turn off builtin functions.
9280 no_builtin_flag=" -fno-builtin"
9282 # How to pass a linker flag through the compiler.
9285 # Additional compiler flags for building library objects.
9286 pic_flag=" -fPIC -DPIC"
9288 # Compiler flag to prevent dynamic linking.
9291 # Does compiler simultaneously support -c and -o options?
9294 # Whether or not to add -lc for building shared libraries.
9295 build_libtool_need_lc=no
9297 # Whether or not to disallow shared libs when runtime libs are static.
9298 allow_libtool_libs_with_static_runtimes=no
9300 # Compiler flag to allow reflexive dlopens.
9301 export_dynamic_flag_spec="\${wl}--export-dynamic"
9303 # Compiler flag to generate shared objects directly from archives.
9304 whole_archive_flag_spec="\${wl}--whole-archive\$convenience \${wl}--no-whole-archive"
9306 # Whether the compiler copes with passing no objects directly.
9307 compiler_needs_object="no"
9309 # Create an old-style archive from a shared archive.
9310 old_archive_from_new_cmds=""
9312 # Create a temporary old-style archive to link instead of a shared archive.
9313 old_archive_from_expsyms_cmds=""
9315 # Commands used to build a shared archive.
9316 archive_cmds="\$CC -shared -nostdlib \$predep_objects \$libobjs \$deplibs \$postdep_objects \$compiler_flags \${wl}-soname \$wl\$soname -o \$lib"
9317 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"
9319 # Commands used to build a loadable module if different from building
9322 module_expsym_cmds=""
9324 # Whether we are building with GNU ld or not.
9327 # Flag that allows shared libraries with undefined symbols to be built.
9328 allow_undefined_flag=""
9330 # Flag that enforces no undefined symbols.
9331 no_undefined_flag=""
9333 # Flag to hardcode $libdir into a binary during linking.
9334 # This must work even if $libdir does not exist
9335 hardcode_libdir_flag_spec="\${wl}-rpath \${wl}\$libdir"
9337 # If ld is used when linking, flag to hardcode $libdir into a binary
9338 # during linking. This must work even if $libdir does not exist.
9339 hardcode_libdir_flag_spec_ld=""
9341 # Whether we need a single "-rpath" flag with a separated argument.
9342 hardcode_libdir_separator=""
9344 # Set to "yes" if using DIR/libNAME${shared_ext} during linking hardcodes
9345 # DIR into the resulting binary.
9348 # Set to "yes" if using DIR/libNAME${shared_ext} during linking hardcodes
9349 # DIR into the resulting binary and the resulting library dependency is
9350 # "absolute",i.e impossible to change by setting ${shlibpath_var} if the
9351 # library is relocated.
9352 hardcode_direct_absolute=no
9354 # Set to "yes" if using the -LDIR flag during linking hardcodes DIR
9355 # into the resulting binary.
9358 # Set to "yes" if using SHLIBPATH_VAR=DIR during linking hardcodes DIR
9359 # into the resulting binary.
9360 hardcode_shlibpath_var=unsupported
9362 # Set to "yes" if building a shared library automatically hardcodes DIR
9363 # into the library and all subsequent libraries and executables linked
9365 hardcode_automatic=no
9367 # Set to yes if linker adds runtime paths of dependent libraries
9368 # to runtime path list.
9371 # Whether libtool must link a program against all its dependency libraries.
9372 link_all_deplibs=unknown
9374 # Fix the shell variable $srcfile for the compiler.
9377 # Set to "yes" if exported symbols are required.
9378 always_export_symbols=no
9380 # The commands to list exported symbols.
9381 export_symbols_cmds="\$NM \$libobjs \$convenience | \$global_symbol_pipe | \$SED 's/.* //' | sort | uniq > \$export_symbols"
9383 # Symbols that should not be listed in the preloaded symbols.
9384 exclude_expsyms="_GLOBAL_OFFSET_TABLE_|_GLOBAL__F[ID]_.*"
9386 # Symbols that must always be exported.
9389 # Commands necessary for linking programs (against libraries) with templates.
9392 # Specify filename containing input files.
9395 # How to hardcode a shared library path into an executable.
9396 hardcode_action=immediate
9398 # The directories searched by this compiler when creating a shared library.
9399 compiler_lib_search_dirs="/usr/lib/gcc/x86_64-redhat-linux/4.4.4 /usr/lib/gcc/x86_64-redhat-linux/4.4.4 /usr/lib/gcc/x86_64-redhat-linux/4.4.4/../../../../lib64 /lib/../lib64 /usr/lib/../lib64 /usr/lib/gcc/x86_64-redhat-linux/4.4.4/../../.."
9401 # Dependencies to place before and after the objects being linked to
9402 # create a shared library.
9403 predep_objects="/usr/lib/gcc/x86_64-redhat-linux/4.4.4/../../../../lib64/crti.o /usr/lib/gcc/x86_64-redhat-linux/4.4.4/crtbeginS.o"
9404 postdep_objects="/usr/lib/gcc/x86_64-redhat-linux/4.4.4/crtendS.o /usr/lib/gcc/x86_64-redhat-linux/4.4.4/../../../../lib64/crtn.o"
9406 postdeps="-lstdc++ -lm -lgomp -lgcc_s -lpthread -lc -lgcc_s"
9408 # The library search path used internally by the compiler when linking
9410 compiler_lib_search_path="-L/usr/lib/gcc/x86_64-redhat-linux/4.4.4 -L/usr/lib/gcc/x86_64-redhat-linux/4.4.4 -L/usr/lib/gcc/x86_64-redhat-linux/4.4.4/../../../../lib64 -L/lib/../lib64 -L/usr/lib/../lib64 -L/usr/lib/gcc/x86_64-redhat-linux/4.4.4/../../.."
9412 # ### END LIBTOOL TAG CONFIG: CXX