3 # libtool - Provide generalized library-building support services.
4 # Generated automatically by config.status (cyrus-sasl) 2.1.23
5 # Libtool was configured on host rand.mit.de.padl.com:
6 # NOTE: Changes made to this file will be lost: look at ltmain.sh.
8 # Copyright (C) 1996, 1997, 1998, 1999, 2000, 2001, 2003, 2004, 2005,
9 # 2006, 2007, 2008, 2009, 2010 Free Software Foundation,
11 # Written by Gordon Matzigkeit, 1996
13 # This file is part of GNU Libtool.
15 # GNU Libtool is free software; you can redistribute it and/or
16 # modify it under the terms of the GNU General Public License as
17 # published by the Free Software Foundation; either version 2 of
18 # the License, or (at your option) any later version.
20 # As a special exception to the GNU General Public License,
21 # if you distribute this file as part of a program or library that
22 # is built using GNU Libtool, you may include this file under the
23 # same distribution terms that you use for the rest of that program.
25 # GNU Libtool is distributed in the hope that it will be useful,
26 # but WITHOUT ANY WARRANTY; without even the implied warranty of
27 # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
28 # GNU General Public License for more details.
30 # You should have received a copy of the GNU General Public License
31 # along with GNU Libtool; see the file COPYING. If not, a copy
32 # can be downloaded from http://www.gnu.org/licenses/gpl.html, or
33 # obtained by writing to the Free Software Foundation, Inc.,
34 # 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
37 # The names of the tagged configurations supported by this script.
40 # ### BEGIN LIBTOOL CONFIG
42 # Whether or not to build static libraries.
45 # Which release of libtool.m4 was used?
49 # Whether or not to build shared libraries.
50 build_libtool_libs=yes
52 # What type of objects to build.
55 # Whether or not to optimize for fast installation.
58 # Shell to use when invoking shell scripts.
61 # An echo program that protects backslashes.
66 host=x86_64-apple-darwin10.7.3
71 build=x86_64-apple-darwin10.7.3
74 # A sed program that does not truncate output.
77 # Sed that helps us avoid accidentally triggering echo(1) options like -n.
78 Xsed="$SED -e 1s/^X//"
80 # A grep program that handles long lines.
84 EGREP="/usr/bin/grep -E"
86 # A literal string matcher.
87 FGREP="/usr/bin/grep -F"
89 # A BSD- or MS-compatible name lister.
92 # Whether we need soft or hard links.
95 # What is the maximum length of a command?
98 # Object file suffix (normally "o").
101 # Executable file suffix (normally "").
104 # whether the shell understands "unset".
107 # turn spaces into newlines.
108 SP2NL="tr \\040 \\012"
110 # turn newlines into spaces.
111 NL2SP="tr \\015\\012 \\040\\040"
113 # An object symbol dumper.
116 # Method to check whether dependent libraries are shared objects.
117 deplibs_check_method="pass_all"
119 # Command to use when deplibs_check_method == "file_magic".
120 file_magic_cmd="\$MAGIC_CMD"
126 # A symbol stripping program.
129 # Commands used to install an old-style archive.
131 old_postinstall_cmds="chmod 644 \$oldlib~\$RANLIB \$oldlib"
132 old_postuninstall_cmds=""
134 # Whether to use a lock for old archive extraction.
135 lock_old_archive_extraction=yes
140 # LTCC compiler flags.
141 LTCFLAGS="-Wall -W -g"
143 # Take the output of nm and produce a listing of raw symbols and C names.
144 global_symbol_pipe="sed -n -e 's/^.*[ ]\\([BCDEGRST][BCDEGRST]*\\)[ ][ ]*_\\([_A-Za-z][_A-Za-z0-9]*\\)\$/\\1 _\\2 \\2/p'"
146 # Transform the output of nm in a proper C declaration.
147 global_symbol_to_cdecl="sed -n -e 's/^T .* \\(.*\\)\$/extern int \\1();/p' -e 's/^[BCDEGRST]* .* \\(.*\\)\$/extern char \\1;/p'"
149 # Transform the output of nm in a C name address pair.
150 global_symbol_to_c_name_address="sed -n -e 's/^: \\([^ ]*\\) \$/ {\\\"\\1\\\", (void *) 0},/p' -e 's/^[BCDEGRST]* \\([^ ]*\\) \\([^ ]*\\)\$/ {\"\\2\", (void *) \\&\\2},/p'"
152 # Transform the output of nm in a C name address pair when lib prefix is needed.
153 global_symbol_to_c_name_address_lib_prefix="sed -n -e 's/^: \\([^ ]*\\) \$/ {\\\"\\1\\\", (void *) 0},/p' -e 's/^[BCDEGRST]* \\([^ ]*\\) \\(lib[^ ]*\\)\$/ {\"\\2\", (void *) \\&\\2},/p' -e 's/^[BCDEGRST]* \\([^ ]*\\) \\([^ ]*\\)\$/ {\"lib\\2\", (void *) \\&\\2},/p'"
155 # The name of the directory that contains temporary libtool files.
158 # Used to examine libraries when file_magic_cmd begins with "file".
161 # Must we lock files when doing compilation?
164 # Tool to manipulate archived DWARF debug symbol files on Mac OS X.
167 # Tool to change global to local symbols on Mac OS X.
170 # Tool to manipulate fat objects and archives on Mac OS X.
173 # ldd/readelf like tool for Mach-O binaries on Mac OS X.
176 # ldd/readelf like tool for 64 bit Mach-O binaries on Mac OS X 10.4.
179 # Old archive suffix (normally "a").
182 # Shared library suffix (normally ".so").
183 shrext_cmds="\`test .\$module = .yes && echo .so || echo .dylib\`"
185 # The commands to extract the exported symbol list from a shared archive.
186 extract_expsyms_cmds=""
188 # Variables whose values should be saved in libtool wrapper scripts and
189 # restored at link time.
190 variables_saved_for_relink="PATH DYLD_LIBRARY_PATH GCC_EXEC_PREFIX COMPILER_PATH LIBRARY_PATH"
192 # Do we need the "lib" prefix for modules?
195 # Do we need a version for libraries?
198 # Library versioning type.
201 # Shared library runtime path variable.
204 # Shared library path variable.
205 shlibpath_var=DYLD_LIBRARY_PATH
207 # Is shlibpath searched before the hard-coded library search path?
208 shlibpath_overrides_runpath=yes
210 # Format of library name prefix.
211 libname_spec="lib\$name"
213 # List of archive names. First name is the real one, the rest are links.
214 # The last name is the one that the linker finds with -lNAME
215 library_names_spec="\${libname}\${release}\${major}\$shared_ext \${libname}\$shared_ext"
217 # The coded name of the library, if different from the real name.
218 soname_spec="\${libname}\${release}\${major}\$shared_ext"
220 # Permission mode override for installation of shared libraries.
221 install_override_mode=""
223 # Command to use after installation of a shared archive.
226 # Command to use after uninstallation of a shared archive.
227 postuninstall_cmds=""
229 # Commands used to finish a libtool library installation in a directory.
232 # As "finish_cmds", except a single script fragment to be evaled but
236 # Whether we should hardcode library paths into libraries.
237 hardcode_into_libs=no
239 # Compile-time system search path for libraries.
240 sys_lib_search_path_spec="/usr/lib/gcc/i686-apple-darwin10/4.2.1/x86_64 /usr/lib/i686-apple-darwin10/4.2.1 /usr/lib /usr/local/lib"
242 # Run-time system search path for libraries.
243 sys_lib_dlsearch_path_spec="/usr/local/lib /lib /usr/lib"
245 # Whether dlopen is supported.
246 dlopen_support=unknown
248 # Whether dlopen of programs is supported.
251 # Whether dlopen of statically linked programs is supported.
252 dlopen_self_static=unknown
254 # Commands to strip libraries.
255 old_striplib="strip -S"
259 # The linker used to build libraries.
260 LD="/usr/libexec/gcc/i686-apple-darwin10/4.2.1/ld"
262 # How to create reloadable object files.
264 reload_cmds="\$LTCC \$LTCFLAGS -nostdlib \${wl}-r -o \$output\$reload_objs"
266 # Commands used to build an old-style archive.
267 old_archive_cmds="\$AR \$AR_FLAGS \$oldlib\$oldobjs~\$RANLIB \$oldlib"
269 # A language specific compiler.
272 # Is the compiler the GNU compiler?
275 # Compiler flag to turn off builtin functions.
276 no_builtin_flag=" -fno-builtin"
278 # How to pass a linker flag through the compiler.
281 # Additional compiler flags for building library objects.
282 pic_flag=" -fno-common -DPIC"
284 # Compiler flag to prevent dynamic linking.
287 # Does compiler simultaneously support -c and -o options?
290 # Whether or not to add -lc for building shared libraries.
291 build_libtool_need_lc=no
293 # Whether or not to disallow shared libs when runtime libs are static.
294 allow_libtool_libs_with_static_runtimes=no
296 # Compiler flag to allow reflexive dlopens.
297 export_dynamic_flag_spec=""
299 # Compiler flag to generate shared objects directly from archives.
300 whole_archive_flag_spec="\`for conv in \$convenience\\\"\\\"; do test -n \\\"\$conv\\\" && new_convenience=\\\"\$new_convenience \${wl}-force_load,\$conv\\\"; done; func_echo_all \\\"\$new_convenience\\\"\`"
302 # Whether the compiler copes with passing no objects directly.
303 compiler_needs_object="no"
305 # Create an old-style archive from a shared archive.
306 old_archive_from_new_cmds=""
308 # Create a temporary old-style archive to link instead of a shared archive.
309 old_archive_from_expsyms_cmds=""
311 # Commands used to build a shared archive.
312 archive_cmds="\$CC -dynamiclib \$allow_undefined_flag -o \$lib \$libobjs \$deplibs \$compiler_flags -install_name \$rpath/\$soname \$verstring \$single_module"
313 archive_expsym_cmds="sed 's,^,_,' < \$export_symbols > \$output_objdir/\${libname}-symbols.expsym~\$CC -dynamiclib \$allow_undefined_flag -o \$lib \$libobjs \$deplibs \$compiler_flags -install_name \$rpath/\$soname \$verstring \$single_module \${wl}-exported_symbols_list,\$output_objdir/\${libname}-symbols.expsym"
315 # Commands used to build a loadable module if different from building
317 module_cmds="\$CC \$allow_undefined_flag -o \$lib -bundle \$libobjs \$deplibs \$compiler_flags"
318 module_expsym_cmds="sed -e 's,^,_,' < \$export_symbols > \$output_objdir/\${libname}-symbols.expsym~\$CC \$allow_undefined_flag -o \$lib -bundle \$libobjs \$deplibs \$compiler_flags \${wl}-exported_symbols_list,\$output_objdir/\${libname}-symbols.expsym"
320 # Whether we are building with GNU ld or not.
323 # Flag that allows shared libraries with undefined symbols to be built.
324 allow_undefined_flag="\${wl}-undefined \${wl}dynamic_lookup"
326 # Flag that enforces no undefined symbols.
329 # Flag to hardcode $libdir into a binary during linking.
330 # This must work even if $libdir does not exist
331 hardcode_libdir_flag_spec=""
333 # If ld is used when linking, flag to hardcode $libdir into a binary
334 # during linking. This must work even if $libdir does not exist.
335 hardcode_libdir_flag_spec_ld=""
337 # Whether we need a single "-rpath" flag with a separated argument.
338 hardcode_libdir_separator=""
340 # Set to "yes" if using DIR/libNAME${shared_ext} during linking hardcodes
341 # DIR into the resulting binary.
344 # Set to "yes" if using DIR/libNAME${shared_ext} during linking hardcodes
345 # DIR into the resulting binary and the resulting library dependency is
346 # "absolute",i.e impossible to change by setting ${shlibpath_var} if the
347 # library is relocated.
348 hardcode_direct_absolute=no
350 # Set to "yes" if using the -LDIR flag during linking hardcodes DIR
351 # into the resulting binary.
354 # Set to "yes" if using SHLIBPATH_VAR=DIR during linking hardcodes DIR
355 # into the resulting binary.
356 hardcode_shlibpath_var=unsupported
358 # Set to "yes" if building a shared library automatically hardcodes DIR
359 # into the library and all subsequent libraries and executables linked
361 hardcode_automatic=yes
363 # Set to yes if linker adds runtime paths of dependent libraries
364 # to runtime path list.
367 # Whether libtool must link a program against all its dependency libraries.
370 # Fix the shell variable $srcfile for the compiler.
373 # Set to "yes" if exported symbols are required.
374 always_export_symbols=no
376 # The commands to list exported symbols.
377 export_symbols_cmds="\$NM \$libobjs \$convenience | \$global_symbol_pipe | \$SED 's/.* //' | sort | uniq > \$export_symbols"
379 # Symbols that should not be listed in the preloaded symbols.
380 exclude_expsyms="_GLOBAL_OFFSET_TABLE_|_GLOBAL__F[ID]_.*"
382 # Symbols that must always be exported.
385 # Commands necessary for linking programs (against libraries) with templates.
388 # Specify filename containing input files.
391 # How to hardcode a shared library path into an executable.
392 hardcode_action=immediate
394 # ### END LIBTOOL CONFIG
396 # Generated from ltmain.m4sh.
398 # libtool (GNU libtool) 2.2.10
399 # Written by Gordon Matzigkeit <gord@gnu.ai.mit.edu>, 1996
401 # Copyright (C) 1996, 1997, 1998, 1999, 2000, 2001, 2003, 2004, 2005, 2006,
402 # 2007, 2008, 2009, 2010 Free Software Foundation, Inc.
403 # This is free software; see the source for copying conditions. There is NO
404 # warranty; not even for MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
406 # GNU Libtool is free software; you can redistribute it and/or modify
407 # it under the terms of the GNU General Public License as published by
408 # the Free Software Foundation; either version 2 of the License, or
409 # (at your option) any later version.
411 # As a special exception to the GNU General Public License,
412 # if you distribute this file as part of a program or library that
413 # is built using GNU Libtool, you may include this file under the
414 # same distribution terms that you use for the rest of that program.
416 # GNU Libtool is distributed in the hope that it will be useful, but
417 # WITHOUT ANY WARRANTY; without even the implied warranty of
418 # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
419 # General Public License for more details.
421 # You should have received a copy of the GNU General Public License
422 # along with GNU Libtool; see the file COPYING. If not, a copy
423 # can be downloaded from http://www.gnu.org/licenses/gpl.html,
424 # or obtained by writing to the Free Software Foundation, Inc.,
425 # 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
427 # Usage: $progname [OPTION]... [MODE-ARG]...
429 # Provide generalized library-building support services.
431 # --config show all configuration variables
432 # --debug enable verbose shell tracing
433 # -n, --dry-run display commands without modifying any files
434 # --features display basic configuration information and exit
435 # --mode=MODE use operation mode MODE
436 # --preserve-dup-deps don't remove duplicate dependency libraries
437 # --quiet, --silent don't print informational messages
438 # --no-quiet, --no-silent
439 # print informational messages (default)
440 # --tag=TAG use configuration variables from tag TAG
441 # -v, --verbose print more informational messages than default
442 # --no-verbose don't print the extra informational messages
443 # --version print version information
444 # -h, --help, --help-all print short, long, or detailed help message
446 # MODE must be one of the following:
448 # clean remove files from the build directory
449 # compile compile a source file into a libtool object
450 # execute automatically set library path, then run a program
451 # finish complete the installation of libtool libraries
452 # install install libraries or executables
453 # link create a library or an executable
454 # uninstall remove libraries from an installed directory
456 # MODE-ARGS vary depending on the MODE. When passed as first option,
457 # `--mode=MODE' may be abbreviated as `MODE' or a unique abbreviation of that.
458 # Try `$progname --help --mode=MODE' for a more detailed description of MODE.
460 # When reporting a bug, please describe a test case to reproduce it and
461 # include the following information:
463 # host-triplet: $host
466 # compiler flags: $LTCFLAGS
467 # linker: $LD (gnu? $with_gnu_ld)
468 # $progname: (GNU libtool) 2.2.10
469 # automake: $automake_version
470 # autoconf: $autoconf_version
472 # Report bugs to <bug-libtool@gnu.org>.
478 package_revision=1.3175
480 # Be Bourne compatible
481 if test -n "${ZSH_VERSION+set}" && (emulate sh) >/dev/null 2>&1; then
484 # Zsh 3.x and 4.x performs word splitting on ${1+"$@"}, which
485 # is contrary to our usage. Disable this feature.
486 alias -g '${1+"$@"}'='"$@"'
489 case `(set -o) 2>/dev/null` in *posix*) set -o posix;; esac
491 BIN_SH=xpg4; export BIN_SH # for Tru64
492 DUALCASE=1; export DUALCASE # for MKS sh
494 # A function that is used when there is no print builtin or printf.
495 func_fallback_echo ()
497 eval 'cat <<_LTECHO_EOF
502 # NLS nuisances: We save the old values to restore during execute mode.
505 for lt_var in LANG LANGUAGE LC_ALL LC_CTYPE LC_COLLATE LC_MESSAGES
507 eval "if test \"\${$lt_var+set}\" = set; then
508 save_$lt_var=\$$lt_var
511 lt_user_locale=\"$lt_var=\\\$save_\$lt_var; \$lt_user_locale\"
512 lt_safe_locale=\"$lt_var=C; \$lt_safe_locale\"
517 export LANGUAGE LC_ALL
522 # Work around backward compatibility issue on IRIX 6.5. On IRIX 6.4+, sh
523 # is ksh but when the shell is invoked as "sh" and the current value of
524 # the _XPG environment variable is not equal to 1 (one), the special
525 # positional parameter $0, within a function call, is the name of the
532 test "${ECHO+set}" = set || ECHO=${as_echo-'printf %s\n'}
542 : ${SHELL="${CONFIG_SHELL-/bin/sh}"}
543 : ${Xsed="$SED -e 1s/^X//"}
548 EXIT_MISMATCH=63 # $? = 63 is used to indicate version mismatch to missing.
549 EXIT_SKIP=77 # $? = 77 is used to indicate a skipped test to automake.
551 exit_status=$EXIT_SUCCESS
553 # Make sure IFS has a sensible default
558 dirname="s,/[^/]*$,,"
561 # func_dirname_and_basename file append nondir_replacement
562 # perform func_basename and func_dirname in a single function
564 # dirname: Compute the dirname of FILE. If nonempty,
565 # add APPEND to the result, otherwise set result
566 # to NONDIR_REPLACEMENT.
567 # value returned in "$func_dirname_result"
568 # basename: Compute filename of FILE.
569 # value retuned in "$func_basename_result"
570 # Implementation must be kept synchronized with func_dirname
571 # and func_basename. For efficiency, we do not delegate to
572 # those functions but instead duplicate the functionality here.
573 func_dirname_and_basename ()
575 # Extract subdirectory from the argument.
576 func_dirname_result=`$ECHO "${1}" | $SED -e "$dirname"`
577 if test "X$func_dirname_result" = "X${1}"; then
578 func_dirname_result="${3}"
580 func_dirname_result="$func_dirname_result${2}"
582 func_basename_result=`$ECHO "${1}" | $SED -e "$basename"`
585 # Generated shell functions inserted here.
587 # func_dirname file append nondir_replacement
588 # Compute the dirname of FILE. If nonempty, add APPEND to the result,
589 # otherwise set result to NONDIR_REPLACEMENT.
593 */*) func_dirname_result="${1%/*}${2}" ;;
594 * ) func_dirname_result="${3}" ;;
601 func_basename_result="${1##*/}"
604 # func_dirname_and_basename file append nondir_replacement
605 # perform func_basename and func_dirname in a single function
607 # dirname: Compute the dirname of FILE. If nonempty,
608 # add APPEND to the result, otherwise set result
609 # to NONDIR_REPLACEMENT.
610 # value returned in "$func_dirname_result"
611 # basename: Compute filename of FILE.
612 # value retuned in "$func_basename_result"
613 # Implementation must be kept synchronized with func_dirname
614 # and func_basename. For efficiency, we do not delegate to
615 # those functions but instead duplicate the functionality here.
616 func_dirname_and_basename ()
619 */*) func_dirname_result="${1%/*}${2}" ;;
620 * ) func_dirname_result="${3}" ;;
622 func_basename_result="${1##*/}"
625 # func_stripname prefix suffix name
626 # strip PREFIX and SUFFIX off of NAME.
627 # PREFIX and SUFFIX must not contain globbing or regex special
628 # characters, hashes, percent signs, but SUFFIX may contain a leading
629 # dot (in which case that matches only a dot).
632 # pdksh 5.2.14 does not do ${X%$Y} correctly if both X and Y are
633 # positional parameters, so assign one to ordinary parameter first.
634 func_stripname_result=${3}
635 func_stripname_result=${func_stripname_result#"${1}"}
636 func_stripname_result=${func_stripname_result%"${2}"}
642 func_opt_split_opt=${1%%=*}
643 func_opt_split_arg=${1#*=}
650 *.lo) func_lo2o_result=${1%.lo}.${objext} ;;
651 *) func_lo2o_result=${1} ;;
655 # func_xform libobj-or-source
658 func_xform_result=${1%.*}.lo
661 # func_arith arithmetic-term...
664 func_arith_result=$(( $* ))
668 # STRING may not start with a hyphen.
671 func_len_result=${#1}
675 # func_append var value
676 # Append VALUE to the end of shell variable VAR.
681 # Generated shell functions inserted here.
683 # These SED scripts presuppose an absolute path with a trailing slash.
684 pathcar='s,^/\([^/]*\).*$,\1,'
685 pathcdr='s,^/[^/]*,,'
686 removedotparts=':dotsl
690 collapseslashes='s@/\{1,\}@/@g'
691 finalslash='s,/*$,/,'
693 # func_normal_abspath PATH
694 # Remove doubled-up and trailing slashes, "." path components,
695 # and cancel out any ".." path components in PATH after making
696 # it an absolute path.
697 # value returned in "$func_normal_abspath_result"
698 func_normal_abspath ()
700 # Start from root dir and reassemble the path.
701 func_normal_abspath_result=
702 func_normal_abspath_tpath=$1
703 func_normal_abspath_altnamespace=
704 case $func_normal_abspath_tpath in
706 # Empty path, that just means $cwd.
707 func_stripname '' '/' "`pwd`"
708 func_normal_abspath_result=$func_stripname_result
711 # The next three entries are used to spot a run of precisely
712 # two leading slashes without using negated character classes;
713 # we take advantage of case's first-match behaviour.
715 # Unusual form of absolute path, do nothing.
718 # Not necessarily an ordinary path; POSIX reserves leading '//'
719 # and for example Cygwin uses it to access remote file shares
720 # over CIFS/SMB, so we conserve a leading double slash if found.
721 func_normal_abspath_altnamespace=/
724 # Absolute path, do nothing.
727 # Relative path, prepend $cwd.
728 func_normal_abspath_tpath=`pwd`/$func_normal_abspath_tpath
731 # Cancel out all the simple stuff to save iterations. We also want
732 # the path to end with a slash for ease of parsing, so make sure
733 # there is one (and only one) here.
734 func_normal_abspath_tpath=`$ECHO "$func_normal_abspath_tpath" | $SED \
735 -e "$removedotparts" -e "$collapseslashes" -e "$finalslash"`
737 # Processed it all yet?
738 if test "$func_normal_abspath_tpath" = / ; then
739 # If we ascended to the root using ".." the result may be empty now.
740 if test -z "$func_normal_abspath_result" ; then
741 func_normal_abspath_result=/
745 func_normal_abspath_tcomponent=`$ECHO "$func_normal_abspath_tpath" | $SED \
747 func_normal_abspath_tpath=`$ECHO "$func_normal_abspath_tpath" | $SED \
749 # Figure out what to do with it
750 case $func_normal_abspath_tcomponent in
752 # Trailing empty path component, ignore it.
755 # Parent dir; strip last assembled component from result.
756 func_dirname "$func_normal_abspath_result"
757 func_normal_abspath_result=$func_dirname_result
760 # Actual path component, append it.
761 func_normal_abspath_result=$func_normal_abspath_result/$func_normal_abspath_tcomponent
765 # Restore leading double-slash if one was found on entry.
766 func_normal_abspath_result=$func_normal_abspath_altnamespace$func_normal_abspath_result
769 # func_relative_path SRCDIR DSTDIR
770 # generates a relative path from SRCDIR to DSTDIR, with a trailing
771 # slash if non-empty, suitable for immediately appending a filename
772 # without needing to append a separator.
773 # value returned in "$func_relative_path_result"
774 func_relative_path ()
776 func_relative_path_result=
777 func_normal_abspath "$1"
778 func_relative_path_tlibdir=$func_normal_abspath_result
779 func_normal_abspath "$2"
780 func_relative_path_tbindir=$func_normal_abspath_result
782 # Ascend the tree starting from libdir
784 # check if we have found a prefix of bindir
785 case $func_relative_path_tbindir in
786 $func_relative_path_tlibdir)
787 # found an exact match
788 func_relative_path_tcancelled=
791 $func_relative_path_tlibdir*)
792 # found a matching prefix
793 func_stripname "$func_relative_path_tlibdir" '' "$func_relative_path_tbindir"
794 func_relative_path_tcancelled=$func_stripname_result
795 if test -z "$func_relative_path_result"; then
796 func_relative_path_result=.
801 func_dirname $func_relative_path_tlibdir
802 func_relative_path_tlibdir=${func_dirname_result}
803 if test "x$func_relative_path_tlibdir" = x ; then
804 # Have to descend all the way to the root!
805 func_relative_path_result=../$func_relative_path_result
806 func_relative_path_tcancelled=$func_relative_path_tbindir
809 func_relative_path_result=../$func_relative_path_result
814 # Now calculate path; take care to avoid doubling-up slashes.
815 func_stripname '' '/' "$func_relative_path_result"
816 func_relative_path_result=$func_stripname_result
817 func_stripname '/' '/' "$func_relative_path_tcancelled"
818 if test "x$func_stripname_result" != x ; then
819 func_relative_path_result=${func_relative_path_result}/${func_stripname_result}
822 # Normalisation. If bindir is libdir, return empty string,
823 # else relative path ending with a slash; either way, target
824 # file name can be directly appended.
825 if test ! -z "$func_relative_path_result"; then
826 func_stripname './' '' "$func_relative_path_result/"
827 func_relative_path_result=$func_stripname_result
831 # The name of this program:
832 func_dirname_and_basename "$progpath"
833 progname=$func_basename_result
835 # Make sure we have an absolute path for reexecution:
837 [\\/]*|[A-Za-z]:\\*) ;;
839 progdir=$func_dirname_result
840 progdir=`cd "$progdir" && pwd`
841 progpath="$progdir/$progname"
846 for progdir in $PATH; do
848 test -x "$progdir/$progname" && break
851 test -n "$progdir" || progdir=`pwd`
852 progpath="$progdir/$progname"
856 # Sed substitution that helps us do robust quoting. It backslashifies
857 # metacharacters that are still active within double-quoted strings.
858 Xsed="${SED}"' -e 1s/^X//'
859 sed_quote_subst='s/\([`"$\\]\)/\\\1/g'
861 # Same as above, but do not quote variable references.
862 double_quote_subst='s/\(["`\\]\)/\\\1/g'
864 # Re-`\' parameter expansions in output of double_quote_subst that were
865 # `\'-ed in input to the same. If an odd number of `\' preceded a '$'
866 # in input to double_quote_subst, that '$' was protected from expansion.
867 # Since each input `\' is now two `\'s, look for any number of runs of
868 # four `\'s followed by two `\'s and then a '$'. `\' that '$'.
873 sed_double_backslash="\
877 s/\\([^$bs]\\)$bs2$dollar/\\1$bs2$bs$dollar/g
888 # Echo program name prefixed message, along with the current mode
889 # name if it has been set yet.
892 $ECHO "$progname${mode+: }$mode: $*"
895 # func_verbose arg...
896 # Echo program name prefixed message in verbose mode only.
899 $opt_verbose && func_echo ${1+"$@"}
901 # A bug in bash halts the script if the last line of a function
902 # fails when set -e is in force, so we need another command to
907 # func_echo_all arg...
908 # Invoke $ECHO with all args, space-separated.
915 # Echo program name prefixed message to standard error.
918 $ECHO "$progname${mode+: }$mode: "${1+"$@"} 1>&2
921 # func_warning arg...
922 # Echo program name prefixed warning message to standard error.
925 $opt_warning && $ECHO "$progname${mode+: }$mode: warning: "${1+"$@"} 1>&2
931 # func_fatal_error arg...
932 # Echo program name prefixed message to standard error, and exit.
939 # func_fatal_help arg...
940 # Echo program name prefixed message to standard error, followed by
941 # a help hint, and exit.
945 func_fatal_error "$help"
947 help="Try \`$progname --help' for more information." ## default
950 # func_grep expression filename
951 # Check whether EXPRESSION matches any line of FILENAME, without output.
954 $GREP "$1" "$2" >/dev/null 2>&1
958 # func_mkdir_p directory-path
959 # Make sure the entire path to DIRECTORY-PATH is available.
962 my_directory_path="$1"
965 if test -n "$my_directory_path" && test "$opt_dry_run" != ":"; then
967 # Protect directory names starting with `-'
968 case $my_directory_path in
969 -*) my_directory_path="./$my_directory_path" ;;
972 # While some portion of DIR does not yet exist...
973 while test ! -d "$my_directory_path"; do
974 # ...make a list in topmost first order. Use a colon delimited
975 # list incase some portion of path contains whitespace.
976 my_dir_list="$my_directory_path:$my_dir_list"
978 # If the last portion added has no slash in it, the list is done
979 case $my_directory_path in */*) ;; *) break ;; esac
981 # ...otherwise throw away the child directory and loop
982 my_directory_path=`$ECHO "$my_directory_path" | $SED -e "$dirname"`
984 my_dir_list=`$ECHO "$my_dir_list" | $SED 's,:*$,,'`
986 save_mkdir_p_IFS="$IFS"; IFS=':'
987 for my_dir in $my_dir_list; do
988 IFS="$save_mkdir_p_IFS"
989 # mkdir can fail with a `File exist' error if two processes
990 # try to create one of the directories concurrently. Don't
992 $MKDIR "$my_dir" 2>/dev/null || :
994 IFS="$save_mkdir_p_IFS"
996 # Bail out if we (or some other process) failed to create a directory.
997 test -d "$my_directory_path" || \
998 func_fatal_error "Failed to create \`$1'"
1003 # func_mktempdir [string]
1004 # Make a temporary directory that won't clash with other running
1005 # libtool processes, and avoids race conditions if possible. If
1006 # given, STRING is the basename for that directory.
1009 my_template="${TMPDIR-/tmp}/${1-$progname}"
1011 if test "$opt_dry_run" = ":"; then
1012 # Return a directory name, but don't create it in dry-run mode
1013 my_tmpdir="${my_template}-$$"
1016 # If mktemp works, use that first and foremost
1017 my_tmpdir=`mktemp -d "${my_template}-XXXXXXXX" 2>/dev/null`
1019 if test ! -d "$my_tmpdir"; then
1020 # Failing that, at least try and use $RANDOM to avoid a race
1021 my_tmpdir="${my_template}-${RANDOM-0}$$"
1023 save_mktempdir_umask=`umask`
1026 umask $save_mktempdir_umask
1029 # If we're not in dry-run mode, bomb out on failure
1030 test -d "$my_tmpdir" || \
1031 func_fatal_error "cannot create temporary directory \`$my_tmpdir'"
1038 # func_quote_for_eval arg
1039 # Aesthetically quote ARG to be evaled later.
1040 # This function returns two values: FUNC_QUOTE_FOR_EVAL_RESULT
1041 # is double-quoted, suitable for a subsequent eval, whereas
1042 # FUNC_QUOTE_FOR_EVAL_UNQUOTED_RESULT has merely all characters
1043 # which are still active within double quotes backslashified.
1044 func_quote_for_eval ()
1048 func_quote_for_eval_unquoted_result=`$ECHO "$1" | $SED "$sed_quote_subst"` ;;
1050 func_quote_for_eval_unquoted_result="$1" ;;
1053 case $func_quote_for_eval_unquoted_result in
1054 # Double-quote args containing shell metacharacters to delay
1055 # word splitting, command substitution and and variable
1056 # expansion for a subsequent eval.
1057 # Many Bourne shells cannot handle close brackets correctly
1058 # in scan sets, so we specify it separately.
1059 *[\[\~\#\^\&\*\(\)\{\}\|\;\<\>\?\'\ \ ]*|*]*|"")
1060 func_quote_for_eval_result="\"$func_quote_for_eval_unquoted_result\""
1063 func_quote_for_eval_result="$func_quote_for_eval_unquoted_result"
1068 # func_quote_for_expand arg
1069 # Aesthetically quote ARG to be evaled later; same as above,
1070 # but do not quote variable references.
1071 func_quote_for_expand ()
1075 my_arg=`$ECHO "$1" | $SED \
1076 -e "$double_quote_subst" -e "$sed_double_backslash"` ;;
1082 # Double-quote args containing shell metacharacters to delay
1083 # word splitting and command substitution for a subsequent eval.
1084 # Many Bourne shells cannot handle close brackets correctly
1085 # in scan sets, so we specify it separately.
1086 *[\[\~\#\^\&\*\(\)\{\}\|\;\<\>\?\'\ \ ]*|*]*|"")
1087 my_arg="\"$my_arg\""
1091 func_quote_for_expand_result="$my_arg"
1095 # func_show_eval cmd [fail_exp]
1096 # Unless opt_silent is true, then output CMD. Then, if opt_dryrun is
1097 # not true, evaluate CMD. If the evaluation of CMD fails, and FAIL_EXP
1098 # is given, then evaluate it.
1102 my_fail_exp="${2-:}"
1104 ${opt_silent-false} || {
1105 func_quote_for_expand "$my_cmd"
1106 eval "func_echo $func_quote_for_expand_result"
1109 if ${opt_dry_run-false}; then :; else
1112 if test "$my_status" -eq 0; then :; else
1113 eval "(exit $my_status); $my_fail_exp"
1119 # func_show_eval_locale cmd [fail_exp]
1120 # Unless opt_silent is true, then output CMD. Then, if opt_dryrun is
1121 # not true, evaluate CMD. If the evaluation of CMD fails, and FAIL_EXP
1122 # is given, then evaluate it. Use the saved locale for evaluation.
1123 func_show_eval_locale ()
1126 my_fail_exp="${2-:}"
1128 ${opt_silent-false} || {
1129 func_quote_for_expand "$my_cmd"
1130 eval "func_echo $func_quote_for_expand_result"
1133 if ${opt_dry_run-false}; then :; else
1134 eval "$lt_user_locale
1137 eval "$lt_safe_locale"
1138 if test "$my_status" -eq 0; then :; else
1139 eval "(exit $my_status); $my_fail_exp"
1146 # Echo version message to standard output and exit.
1157 /^# '$PROGRAM' (GNU /,/# warranty; / {
1160 s/\((C)\)[ 0-9,-]*\( [1-9][0-9]*\)/\1\2/
1167 # Echo short help message to standard output and exit.
1170 $SED -n '/^# Usage:/,/^# *.*--help/ {
1173 s/\$progname/'$progname'/
1177 $ECHO "run \`$progname --help | more' for full usage"
1181 # func_help [NOEXIT]
1182 # Echo long help message to standard output and exit,
1183 # unless 'noexit' is passed as argument.
1186 $SED -n '/^# Usage:/,/# Report bugs to/ {
1189 s*\$progname*'$progname'*
1191 s*\$SHELL*'"$SHELL"'*
1193 s*\$LTCFLAGS*'"$LTCFLAGS"'*
1195 s/\$with_gnu_ld/'"$with_gnu_ld"'/
1196 s/\$automake_version/'"`(automake --version) 2>/dev/null |$SED 1q`"'/
1197 s/\$autoconf_version/'"`(autoconf --version) 2>/dev/null |$SED 1q`"'/
1201 if test -z "$1"; then
1206 # func_missing_arg argname
1207 # Echo program name prefixed message to standard error and set global
1211 func_error "missing argument for $1."
1222 magic="%%%MAGIC variable%%%"
1223 magic_exe="%%%MAGIC EXE variable%%%"
1230 lo2o="s/\\.lo\$/.${objext}/"
1231 o2lo="s/\\.${objext}\$/.lo/"
1236 opt_duplicate_deps=false
1240 # If this variable is set in any of the actions, the command in it
1241 # will be execed at the end. This prevents here-documents from being
1242 # left over by shells.
1245 # func_fatal_configuration arg...
1246 # Echo program name prefixed message to standard error, followed by
1247 # a configuration failure hint, and exit.
1248 func_fatal_configuration ()
1250 func_error ${1+"$@"}
1251 func_error "See the $PACKAGE documentation for more information."
1252 func_fatal_error "Fatal configuration error."
1257 # Display the configuration for all the tags in this script.
1260 re_begincf='^# ### BEGIN LIBTOOL'
1261 re_endcf='^# ### END LIBTOOL'
1263 # Default configuration.
1264 $SED "1,/$re_begincf CONFIG/d;/$re_endcf CONFIG/,\$d" < "$progpath"
1266 # Now print the configurations for the tags.
1267 for tagname in $taglist; do
1268 $SED -n "/$re_begincf TAG CONFIG: $tagname\$/,/$re_endcf TAG CONFIG: $tagname\$/p" < "$progpath"
1275 # Display the features supported by this script.
1279 if test "$build_libtool_libs" = yes; then
1280 echo "enable shared libraries"
1282 echo "disable shared libraries"
1284 if test "$build_old_libs" = yes; then
1285 echo "enable static libraries"
1287 echo "disable static libraries"
1293 # func_enable_tag tagname
1294 # Verify that TAGNAME is valid, and either flag an error and exit, or
1295 # enable the TAGNAME tag. We also add TAGNAME to the global $taglist
1302 re_begincf="^# ### BEGIN LIBTOOL TAG CONFIG: $tagname\$"
1303 re_endcf="^# ### END LIBTOOL TAG CONFIG: $tagname\$"
1304 sed_extractcf="/$re_begincf/,/$re_endcf/p"
1309 func_fatal_error "invalid tag name: $tagname"
1313 # Don't test for the "default" C tag, as we know it's
1314 # there but not specially marked.
1318 if $GREP "$re_begincf" "$progpath" >/dev/null 2>&1; then
1319 taglist="$taglist $tagname"
1321 # Evaluate the configuration. Be careful to quote the path
1322 # and the sed script, to avoid splitting on whitespace, but
1323 # also don't use non-portable quotes within backquotes within
1324 # quotes we have to do it in 2 steps:
1325 extractedcf=`$SED -n -e "$sed_extractcf" < "$progpath"`
1328 func_error "ignoring unknown tag $tagname"
1334 # Parse options once, thoroughly. This comes as soon as possible in
1335 # the script to make things like `libtool --version' happen quickly.
1338 # Shorthand for --mode=foo, only valid as the first argument
1341 shift; set dummy --mode clean ${1+"$@"}; shift
1343 compile|compil|compi|comp|com|co|c)
1344 shift; set dummy --mode compile ${1+"$@"}; shift
1346 execute|execut|execu|exec|exe|ex|e)
1347 shift; set dummy --mode execute ${1+"$@"}; shift
1349 finish|finis|fini|fin|fi|f)
1350 shift; set dummy --mode finish ${1+"$@"}; shift
1352 install|instal|insta|inst|ins|in|i)
1353 shift; set dummy --mode install ${1+"$@"}; shift
1356 shift; set dummy --mode link ${1+"$@"}; shift
1358 uninstall|uninstal|uninsta|uninst|unins|unin|uni|un|u)
1359 shift; set dummy --mode uninstall ${1+"$@"}; shift
1363 # Parse non-mode specific arguments:
1364 while test "$#" -gt 0; do
1369 --config) func_config ;;
1371 --debug) preserve_args="$preserve_args $opt"
1372 func_echo "enabling shell trace mode"
1377 -dlopen) test "$#" -eq 0 && func_missing_arg "$opt" && break
1378 execute_dlfiles="$execute_dlfiles $1"
1382 --dry-run | -n) opt_dry_run=: ;;
1383 --features) func_features ;;
1384 --finish) mode="finish" ;;
1386 --mode) test "$#" -eq 0 && func_missing_arg "$opt" && break
1388 # Valid mode arguments:
1398 # Catch anything else as an error
1399 *) func_error "invalid argument for $opt"
1409 --preserve-dup-deps)
1410 opt_duplicate_deps=: ;;
1412 --quiet|--silent) preserve_args="$preserve_args $opt"
1417 --no-quiet|--no-silent)
1418 preserve_args="$preserve_args $opt"
1422 --verbose| -v) preserve_args="$preserve_args $opt"
1427 --no-verbose) preserve_args="$preserve_args $opt"
1431 --tag) test "$#" -eq 0 && func_missing_arg "$opt" && break
1432 preserve_args="$preserve_args $opt $1"
1433 func_enable_tag "$1" # tagname is set here
1437 # Separate optargs to long options:
1438 -dlopen=*|--mode=*|--tag=*)
1439 func_opt_split "$opt"
1440 set dummy "$func_opt_split_opt" "$func_opt_split_arg" ${1+"$@"}
1444 -\?|-h) func_usage ;;
1445 --help) opt_help=: ;;
1446 --help-all) opt_help=': help-all' ;;
1447 --version) func_version ;;
1449 -*) func_fatal_help "unrecognized option \`$opt'" ;;
1459 *cygwin* | *mingw* | *pw32* | *cegcc*)
1460 # don't eliminate duplications in $postdeps and $predeps
1461 opt_duplicate_compiler_generated_deps=:
1464 opt_duplicate_compiler_generated_deps=$opt_duplicate_deps
1468 # Having warned about all mis-specified options, bail out if
1469 # anything was wrong.
1470 $exit_cmd $EXIT_FAILURE
1473 # func_check_version_match
1474 # Ensure that we are using m4 macros, and libtool script from the same
1475 # release of libtool.
1476 func_check_version_match ()
1478 if test "$package_revision" != "$macro_revision"; then
1479 if test "$VERSION" != "$macro_version"; then
1480 if test -z "$macro_version"; then
1482 $progname: Version mismatch error. This is $PACKAGE $VERSION, but the
1483 $progname: definition of this LT_INIT comes from an older release.
1484 $progname: You should recreate aclocal.m4 with macros from $PACKAGE $VERSION
1485 $progname: and run autoconf again.
1489 $progname: Version mismatch error. This is $PACKAGE $VERSION, but the
1490 $progname: definition of this LT_INIT comes from $PACKAGE $macro_version.
1491 $progname: You should recreate aclocal.m4 with macros from $PACKAGE $VERSION
1492 $progname: and run autoconf again.
1497 $progname: Version mismatch error. This is $PACKAGE $VERSION, revision $package_revision,
1498 $progname: but the definition of this LT_INIT comes from revision $macro_revision.
1499 $progname: You should recreate aclocal.m4 with macros from revision $package_revision
1500 $progname: of $PACKAGE $VERSION and run autoconf again.
1514 # Sanity checks first:
1515 func_check_version_match
1517 if test "$build_libtool_libs" != yes && test "$build_old_libs" != yes; then
1518 func_fatal_configuration "not configured to build any kind of library"
1521 test -z "$mode" && func_fatal_error "error: you must specify a MODE."
1525 eval std_shrext=\"$shrext_cmds\"
1528 # Only execute mode is allowed to have -dlopen flags.
1529 if test -n "$execute_dlfiles" && test "$mode" != execute; then
1530 func_error "unrecognized option \`-dlopen'"
1535 # Change the help message to a mode-specific one.
1536 generic_help="$help"
1537 help="Try \`$progname --help --mode=$mode' for more information."
1542 # True iff FILE is a libtool `.la' library or `.lo' object file.
1543 # This function is only a basic sanity check; it will hardly flush out
1544 # determined imposters.
1548 $SED -e 4q "$1" 2>/dev/null \
1549 | $GREP "^# Generated by .*$PACKAGE" > /dev/null 2>&1
1552 # func_lalib_unsafe_p file
1553 # True iff FILE is a libtool `.la' library or `.lo' object file.
1554 # This function implements the same check as func_lalib_p without
1555 # resorting to external programs. To this end, it redirects stdin and
1556 # closes it afterwards, without saving the original file descriptor.
1557 # As a safety measure, use it only where a negative result would be
1558 # fatal anyway. Works if `file' does not exist.
1559 func_lalib_unsafe_p ()
1562 if test -f "$1" && test -r "$1" && exec 5<&0 <"$1"; then
1563 for lalib_p_l in 1 2 3 4
1566 case "$lalib_p_line" in
1567 \#\ Generated\ by\ *$PACKAGE* ) lalib_p=yes; break;;
1572 test "$lalib_p" = yes
1575 # func_ltwrapper_script_p file
1576 # True iff FILE is a libtool wrapper script
1577 # This function is only a basic sanity check; it will hardly flush out
1578 # determined imposters.
1579 func_ltwrapper_script_p ()
1584 # func_ltwrapper_executable_p file
1585 # True iff FILE is a libtool wrapper executable
1586 # This function is only a basic sanity check; it will hardly flush out
1587 # determined imposters.
1588 func_ltwrapper_executable_p ()
1590 func_ltwrapper_exec_suffix=
1593 *) func_ltwrapper_exec_suffix=.exe ;;
1595 $GREP "$magic_exe" "$1$func_ltwrapper_exec_suffix" >/dev/null 2>&1
1598 # func_ltwrapper_scriptname file
1599 # Assumes file is an ltwrapper_executable
1600 # uses $file to determine the appropriate filename for a
1601 # temporary ltwrapper_script.
1602 func_ltwrapper_scriptname ()
1604 func_ltwrapper_scriptname_result=""
1605 if func_ltwrapper_executable_p "$1"; then
1606 func_dirname_and_basename "$1" "" "."
1607 func_stripname '' '.exe' "$func_basename_result"
1608 func_ltwrapper_scriptname_result="$func_dirname_result/$objdir/${func_stripname_result}_ltshwrapper"
1612 # func_ltwrapper_p file
1613 # True iff FILE is a libtool wrapper script or wrapper executable
1614 # This function is only a basic sanity check; it will hardly flush out
1615 # determined imposters.
1618 func_ltwrapper_script_p "$1" || func_ltwrapper_executable_p "$1"
1622 # func_execute_cmds commands fail_cmd
1623 # Execute tilde-delimited COMMANDS.
1624 # If FAIL_CMD is given, eval that upon failure.
1625 # FAIL_CMD may read-access the current command in variable CMD!
1626 func_execute_cmds ()
1629 save_ifs=$IFS; IFS='~'
1633 func_show_eval "$cmd" "${2-:}"
1640 # Source FILE, adding directory component if necessary.
1641 # Note that it is not necessary on cygwin/mingw to append a dot to
1642 # FILE even if both FILE and FILE.exe exist: automatic-append-.exe
1643 # behavior happens only for exec(3), not for open(2)! Also, sourcing
1644 # `FILE.' does not work on cygwin managed mounts.
1649 */* | *\\*) . "$1" ;;
1655 # func_infer_tag arg
1656 # Infer tagged configuration to use if any are available and
1657 # if one wasn't chosen via the "--tag" command line option.
1658 # Only attempt this if the compiler in the base compile
1659 # command doesn't match the default compiler.
1660 # arg is usually of the form 'gcc ...'
1664 if test -n "$available_tags" && test -z "$tagname"; then
1667 func_quote_for_eval "$arg"
1668 CC_quoted="$CC_quoted $func_quote_for_eval_result"
1670 CC_expanded=`func_echo_all $CC`
1671 CC_quoted_expanded=`func_echo_all $CC_quoted`
1673 # Blanks in the command may have been stripped by the calling shell,
1674 # but not from the CC environment variable when configure was run.
1675 " $CC "* | "$CC "* | " $CC_expanded "* | "$CC_expanded "* | \
1676 " $CC_quoted"* | "$CC_quoted "* | " $CC_quoted_expanded "* | "$CC_quoted_expanded "*) ;;
1677 # Blanks at the start of $base_compile will cause this to fail
1678 # if we don't check for them as well.
1680 for z in $available_tags; do
1681 if $GREP "^# ### BEGIN LIBTOOL TAG CONFIG: $z$" < "$progpath" > /dev/null; then
1682 # Evaluate the configuration.
1683 eval "`${SED} -n -e '/^# ### BEGIN LIBTOOL TAG CONFIG: '$z'$/,/^# ### END LIBTOOL TAG CONFIG: '$z'$/p' < $progpath`"
1686 # Double-quote args containing other shell metacharacters.
1687 func_quote_for_eval "$arg"
1688 CC_quoted="$CC_quoted $func_quote_for_eval_result"
1690 CC_expanded=`func_echo_all $CC`
1691 CC_quoted_expanded=`func_echo_all $CC_quoted`
1693 " $CC "* | "$CC "* | " $CC_expanded "* | "$CC_expanded "* | \
1694 " $CC_quoted"* | "$CC_quoted "* | " $CC_quoted_expanded "* | "$CC_quoted_expanded "*)
1695 # The compiler in the base compile command matches
1696 # the one in the tagged configuration.
1697 # Assume this is the tagged configuration we want.
1704 # If $tagname still isn't set, then no tagged configuration
1705 # was found and let the user know that the "--tag" command
1706 # line option must be used.
1707 if test -z "$tagname"; then
1708 func_echo "unable to infer tagged configuration"
1709 func_fatal_error "specify a tag with \`--tag'"
1711 # func_verbose "using $tagname tagged configuration"
1720 # func_write_libtool_object output_name pic_name nonpic_name
1721 # Create a libtool object file (analogous to a ".la" file),
1722 # but don't create it if we're doing a dry run.
1723 func_write_libtool_object ()
1726 if test "$build_libtool_libs" = yes; then
1732 if test "$build_old_libs" = yes; then
1733 write_oldobj=\'${3}\'
1739 cat >${write_libobj}T <<EOF
1740 # $write_libobj - a libtool object file
1741 # Generated by $PROGRAM (GNU $PACKAGE$TIMESTAMP) $VERSION
1743 # Please DO NOT delete this file!
1744 # It is necessary for linking the library.
1746 # Name of the PIC object.
1747 pic_object=$write_lobj
1749 # Name of the non-PIC object
1750 non_pic_object=$write_oldobj
1753 $MV "${write_libobj}T" "${write_libobj}"
1757 # func_mode_compile arg...
1758 func_mode_compile ()
1761 # Get the compilation command and the source file.
1763 srcfile="$nonopt" # always keep a non-empty value in "srcfile"
1775 # do not "continue". Instead, add this to base_compile
1787 # Accept any command-line options.
1790 test -n "$libobj" && \
1791 func_fatal_error "you cannot specify \`-o' more than once"
1796 -pie | -fpie | -fPIE)
1797 pie_flag="$pie_flag $arg"
1801 -shared | -static | -prefer-pic | -prefer-non-pic)
1812 arg_mode=arg # the next one goes into the "base_compile" arg list
1813 continue # The current "srcfile" will either be retained or
1814 ;; # replaced later. I would guess that would be a bug.
1817 func_stripname '-Wc,' '' "$arg"
1818 args=$func_stripname_result
1820 save_ifs="$IFS"; IFS=','
1821 for arg in $args; do
1823 func_quote_for_eval "$arg"
1824 lastarg="$lastarg $func_quote_for_eval_result"
1827 func_stripname ' ' '' "$lastarg"
1828 lastarg=$func_stripname_result
1830 # Add the arguments to base_compile.
1831 base_compile="$base_compile $lastarg"
1836 # Accept the current argument as the source file.
1837 # The previous "srcfile" becomes the current argument.
1844 esac # case $arg_mode
1846 # Aesthetically quote the previous argument.
1847 func_quote_for_eval "$lastarg"
1848 base_compile="$base_compile $func_quote_for_eval_result"
1853 func_fatal_error "you must specify an argument for -Xcompile"
1856 func_fatal_error "you must specify a target with \`-o'"
1859 # Get the name of the library object.
1860 test -z "$libobj" && {
1861 func_basename "$srcfile"
1862 libobj="$func_basename_result"
1867 # Recognize several different file suffixes.
1868 # If the user specifies -o file.o, it is replaced with file.lo
1871 *.ada | *.adb | *.ads | *.asm | \
1872 *.c++ | *.cc | *.ii | *.class | *.cpp | *.cxx | \
1873 *.[fF][09]? | *.for | *.java | *.obj | *.sx | *.cu | *.cup)
1874 func_xform "$libobj"
1875 libobj=$func_xform_result
1880 *.lo) func_lo2o "$libobj"; obj=$func_lo2o_result ;;
1882 func_fatal_error "cannot determine name of library object from \`$libobj'"
1886 func_infer_tag $base_compile
1888 for arg in $later; do
1891 test "$build_libtool_libs" != yes && \
1892 func_fatal_configuration "can not build a shared library"
1898 build_libtool_libs=no
1915 func_quote_for_eval "$libobj"
1916 test "X$libobj" != "X$func_quote_for_eval_result" \
1917 && $ECHO "X$libobj" | $GREP '[]~#^*{};<>?"'"'"' &()|`$[]' \
1918 && func_warning "libobj name \`$libobj' may not contain shell special characters."
1919 func_dirname_and_basename "$obj" "/" ""
1920 objname="$func_basename_result"
1921 xdir="$func_dirname_result"
1922 lobj=${xdir}$objdir/$objname
1924 test -z "$base_compile" && \
1925 func_fatal_help "you must specify a compilation command"
1927 # Delete any leftover library objects.
1928 if test "$build_old_libs" = yes; then
1929 removelist="$obj $lobj $libobj ${libobj}T"
1931 removelist="$lobj $libobj ${libobj}T"
1934 # On Cygwin there's no "real" PIC flag so we must build both object types
1936 cygwin* | mingw* | pw32* | os2* | cegcc*)
1940 if test "$pic_mode" = no && test "$deplibs_check_method" != pass_all; then
1941 # non-PIC code in shared libraries is not supported
1945 # Calculate the filename of the output object if compiler does
1946 # not support -o with -c
1947 if test "$compiler_c_o" = no; then
1948 output_obj=`$ECHO "$srcfile" | $SED 's%^.*/%%; s%\.[^.]*$%%'`.${objext}
1949 lockfile="$output_obj.lock"
1956 # Lock this critical section if it is needed
1957 # We use this script file to make the link, it avoids creating a new file
1958 if test "$need_locks" = yes; then
1959 until $opt_dry_run || ln "$progpath" "$lockfile" 2>/dev/null; do
1960 func_echo "Waiting for $lockfile to be removed"
1963 elif test "$need_locks" = warn; then
1964 if test -f "$lockfile"; then
1966 *** ERROR, $lockfile exists and contains:
1967 `cat $lockfile 2>/dev/null`
1969 This indicates that another process is trying to use the same
1970 temporary object file, and libtool could not work around it because
1971 your compiler does not support \`-c' and \`-o' together. If you
1972 repeat this compilation, it may succeed, by chance, but you had better
1973 avoid parallel builds (make -j) in this platform, or get a better
1976 $opt_dry_run || $RM $removelist
1979 removelist="$removelist $output_obj"
1980 $ECHO "$srcfile" > "$lockfile"
1983 $opt_dry_run || $RM $removelist
1984 removelist="$removelist $lockfile"
1985 trap '$opt_dry_run || $RM $removelist; exit $EXIT_FAILURE' 1 2 15
1987 if test -n "$fix_srcfile_path"; then
1988 eval srcfile=\"$fix_srcfile_path\"
1990 func_quote_for_eval "$srcfile"
1991 qsrcfile=$func_quote_for_eval_result
1993 # Only build a PIC object if we are building libtool libraries.
1994 if test "$build_libtool_libs" = yes; then
1995 # Without this assignment, base_compile gets emptied.
1996 fbsd_hideous_sh_bug=$base_compile
1998 if test "$pic_mode" != no; then
1999 command="$base_compile $qsrcfile $pic_flag"
2001 # Don't build PIC code
2002 command="$base_compile $qsrcfile"
2005 func_mkdir_p "$xdir$objdir"
2007 if test -z "$output_obj"; then
2008 # Place PIC objects in $objdir
2009 command="$command -o $lobj"
2012 func_show_eval_locale "$command" \
2013 'test -n "$output_obj" && $RM $removelist; exit $EXIT_FAILURE'
2015 if test "$need_locks" = warn &&
2016 test "X`cat $lockfile 2>/dev/null`" != "X$srcfile"; then
2018 *** ERROR, $lockfile contains:
2019 `cat $lockfile 2>/dev/null`
2021 but it should contain:
2024 This indicates that another process is trying to use the same
2025 temporary object file, and libtool could not work around it because
2026 your compiler does not support \`-c' and \`-o' together. If you
2027 repeat this compilation, it may succeed, by chance, but you had better
2028 avoid parallel builds (make -j) in this platform, or get a better
2031 $opt_dry_run || $RM $removelist
2035 # Just move the object if needed, then go on to compile the next one
2036 if test -n "$output_obj" && test "X$output_obj" != "X$lobj"; then
2037 func_show_eval '$MV "$output_obj" "$lobj"' \
2038 'error=$?; $opt_dry_run || $RM $removelist; exit $error'
2041 # Allow error messages only from the first compilation.
2042 if test "$suppress_opt" = yes; then
2043 suppress_output=' >/dev/null 2>&1'
2047 # Only build a position-dependent object if we build old libraries.
2048 if test "$build_old_libs" = yes; then
2049 if test "$pic_mode" != yes; then
2050 # Don't build PIC code
2051 command="$base_compile $qsrcfile$pie_flag"
2053 command="$base_compile $qsrcfile $pic_flag"
2055 if test "$compiler_c_o" = yes; then
2056 command="$command -o $obj"
2059 # Suppress compiler output if we already did a PIC compilation.
2060 command="$command$suppress_output"
2061 func_show_eval_locale "$command" \
2062 '$opt_dry_run || $RM $removelist; exit $EXIT_FAILURE'
2064 if test "$need_locks" = warn &&
2065 test "X`cat $lockfile 2>/dev/null`" != "X$srcfile"; then
2067 *** ERROR, $lockfile contains:
2068 `cat $lockfile 2>/dev/null`
2070 but it should contain:
2073 This indicates that another process is trying to use the same
2074 temporary object file, and libtool could not work around it because
2075 your compiler does not support \`-c' and \`-o' together. If you
2076 repeat this compilation, it may succeed, by chance, but you had better
2077 avoid parallel builds (make -j) in this platform, or get a better
2080 $opt_dry_run || $RM $removelist
2084 # Just move the object if needed
2085 if test -n "$output_obj" && test "X$output_obj" != "X$obj"; then
2086 func_show_eval '$MV "$output_obj" "$obj"' \
2087 'error=$?; $opt_dry_run || $RM $removelist; exit $error'
2092 func_write_libtool_object "$libobj" "$objdir/$objname" "$objname"
2094 # Unlock the critical section if it was locked
2095 if test "$need_locks" != no; then
2096 removelist=$lockfile
2105 test "$mode" = compile && func_mode_compile ${1+"$@"}
2110 # We need to display help for each of the modes.
2113 # Generic help is extracted from the usage comments
2114 # at the start of this file.
2120 "Usage: $progname [OPTION]... --mode=clean RM [RM-OPTION]... FILE...
2122 Remove files from the build directory.
2124 RM is the name of the program to use to delete files associated with each FILE
2125 (typically \`/bin/rm'). RM-OPTIONS are options (such as \`-f') to be passed
2128 If FILE is a libtool library, object or program, all the files associated
2129 with it are deleted. Otherwise, only FILE itself is deleted using RM."
2134 "Usage: $progname [OPTION]... --mode=compile COMPILE-COMMAND... SOURCEFILE
2136 Compile a source file into a libtool library object.
2138 This mode accepts the following additional options:
2140 -o OUTPUT-FILE set the output file name to OUTPUT-FILE
2141 -no-suppress do not suppress compiler output for multiple passes
2142 -prefer-pic try to build PIC objects only
2143 -prefer-non-pic try to build non-PIC objects only
2144 -shared do not build a \`.o' file suitable for static linking
2145 -static only build a \`.o' file suitable for static linking
2146 -Wc,FLAG pass FLAG directly to the compiler
2148 COMPILE-COMMAND is a command to be used in creating a \`standard' object file
2149 from the given SOURCEFILE.
2151 The output file name is determined by removing the directory component from
2152 SOURCEFILE, then substituting the C source code suffix \`.c' with the
2153 library object suffix, \`.lo'."
2158 "Usage: $progname [OPTION]... --mode=execute COMMAND [ARGS]...
2160 Automatically set library path, then run a program.
2162 This mode accepts the following additional options:
2164 -dlopen FILE add the directory containing FILE to the library path
2166 This mode sets the library path environment variable according to \`-dlopen'
2169 If any of the ARGS are libtool executable wrappers, then they are translated
2170 into their corresponding uninstalled binary, and any of their required library
2171 directories are added to the library path.
2173 Then, COMMAND is executed, with ARGS as arguments."
2178 "Usage: $progname [OPTION]... --mode=finish [LIBDIR]...
2180 Complete the installation of libtool libraries.
2182 Each LIBDIR is a directory that contains libtool libraries.
2184 The commands that this mode executes may require superuser privileges. Use
2185 the \`--dry-run' option if you just want to see what would be executed."
2190 "Usage: $progname [OPTION]... --mode=install INSTALL-COMMAND...
2192 Install executables or libraries.
2194 INSTALL-COMMAND is the installation command. The first component should be
2195 either the \`install' or \`cp' program.
2197 The following components of INSTALL-COMMAND are treated specially:
2199 -inst-prefix-dir PREFIX-DIR Use PREFIX-DIR as a staging area for installation
2201 The rest of the components are interpreted as arguments to that command (only
2202 BSD-compatible install options are recognized)."
2207 "Usage: $progname [OPTION]... --mode=link LINK-COMMAND...
2209 Link object files or libraries together to form another library, or to
2210 create an executable program.
2212 LINK-COMMAND is a command using the C compiler that you would use to create
2213 a program from several object files.
2215 The following components of LINK-COMMAND are treated specially:
2217 -all-static do not do any dynamic linking at all
2218 -avoid-version do not add a version suffix if possible
2219 -bindir BINDIR specify path to binaries directory (for systems where
2220 libraries must be found in the PATH setting at runtime)
2221 -dlopen FILE \`-dlpreopen' FILE if it cannot be dlopened at runtime
2222 -dlpreopen FILE link in FILE and add its symbols to lt_preloaded_symbols
2223 -export-dynamic allow symbols from OUTPUT-FILE to be resolved with dlsym(3)
2224 -export-symbols SYMFILE
2225 try to export only the symbols listed in SYMFILE
2226 -export-symbols-regex REGEX
2227 try to export only the symbols matching REGEX
2228 -LLIBDIR search LIBDIR for required installed libraries
2229 -lNAME OUTPUT-FILE requires the installed library libNAME
2230 -module build a library that can dlopened
2231 -no-fast-install disable the fast-install mode
2232 -no-install link a not-installable executable
2233 -no-undefined declare that a library does not refer to external symbols
2234 -o OUTPUT-FILE create OUTPUT-FILE from the specified objects
2235 -objectlist FILE Use a list of object files found in FILE to specify objects
2236 -precious-files-regex REGEX
2237 don't remove output files matching REGEX
2238 -release RELEASE specify package release information
2239 -rpath LIBDIR the created library will eventually be installed in LIBDIR
2240 -R[ ]LIBDIR add LIBDIR to the runtime path of programs and libraries
2241 -shared only do dynamic linking of libtool libraries
2242 -shrext SUFFIX override the standard shared library file extension
2243 -static do not do any dynamic linking of uninstalled libtool libraries
2244 -static-libtool-libs
2245 do not do any dynamic linking of libtool libraries
2246 -version-info CURRENT[:REVISION[:AGE]]
2247 specify library version info [each variable defaults to 0]
2248 -weak LIBNAME declare that the target provides the LIBNAME interface
2250 -Xcompiler FLAG pass linker-specific FLAG directly to the compiler
2252 -Xlinker FLAG pass linker-specific FLAG directly to the linker
2253 -XCClinker FLAG pass link-specific FLAG to the compiler driver (CC)
2255 All other options (arguments beginning with \`-') are ignored.
2257 Every other argument is treated as a filename. Files ending in \`.la' are
2258 treated as uninstalled libtool libraries, other files are standard or library
2261 If the OUTPUT-FILE ends in \`.la', then a libtool library is created,
2262 only library objects (\`.lo' files) may be specified, and \`-rpath' is
2263 required, except when creating a convenience library.
2265 If OUTPUT-FILE ends in \`.a' or \`.lib', then a standard library is created
2266 using \`ar' and \`ranlib', or on Windows using \`lib'.
2268 If OUTPUT-FILE ends in \`.lo' or \`.${objext}', then a reloadable object file
2269 is created, otherwise an executable program is created."
2274 "Usage: $progname [OPTION]... --mode=uninstall RM [RM-OPTION]... FILE...
2276 Remove libraries from an installation directory.
2278 RM is the name of the program to use to delete files associated with each FILE
2279 (typically \`/bin/rm'). RM-OPTIONS are options (such as \`-f') to be passed
2282 If FILE is a libtool library, all the files associated with it are deleted.
2283 Otherwise, only FILE itself is deleted using RM."
2287 func_fatal_help "invalid operation mode \`$mode'"
2292 $ECHO "Try \`$progname --help' for more information about other modes."
2295 # Now that we've collected a possible --mode arg, show help if necessary
2297 if test "$opt_help" = :; then
2302 for mode in compile link execute install finish uninstall clean; do
2305 } | sed -n '1p; 2,$s/^Usage:/ or: /p'
2308 for mode in compile link execute install finish uninstall clean; do
2314 /^When reporting/,/^Report/{
2319 /information about other modes/d
2320 /more detailed .*MODE/d
2321 s/^Usage:.*--mode=\([^ ]*\) .*/Description of \1 mode:/'
2327 # func_mode_execute arg...
2328 func_mode_execute ()
2331 # The first argument is the command name.
2334 func_fatal_help "you must specify a COMMAND"
2336 # Handle -dlopen flags immediately.
2337 for file in $execute_dlfiles; do
2339 || func_fatal_help "\`$file' is not a file"
2344 # Check to see that this really is a libtool archive.
2345 func_lalib_unsafe_p "$file" \
2346 || func_fatal_help "\`$lib' is not a valid libtool archive"
2348 # Read the libtool library.
2353 # Skip this library if it cannot be dlopened.
2354 if test -z "$dlname"; then
2355 # Warn if it was a shared library.
2356 test -n "$library_names" && \
2357 func_warning "\`$file' was not linked with \`-export-dynamic'"
2361 func_dirname "$file" "" "."
2362 dir="$func_dirname_result"
2364 if test -f "$dir/$objdir/$dlname"; then
2367 if test ! -f "$dir/$dlname"; then
2368 func_fatal_error "cannot find \`$dlname' in \`$dir' or \`$dir/$objdir'"
2374 # Just add the directory containing the .lo file.
2375 func_dirname "$file" "" "."
2376 dir="$func_dirname_result"
2380 func_warning "\`-dlopen' is ignored for non-libtool libraries and objects"
2385 # Get the absolute pathname.
2386 absdir=`cd "$dir" && pwd`
2387 test -n "$absdir" && dir="$absdir"
2389 # Now add the directory to shlibpath_var.
2390 if eval "test -z \"\$$shlibpath_var\""; then
2391 eval "$shlibpath_var=\"\$dir\""
2393 eval "$shlibpath_var=\"\$dir:\$$shlibpath_var\""
2397 # This variable tells wrapper scripts just to set shlibpath_var
2398 # rather than running their programs.
2399 libtool_execute_magic="$magic"
2401 # Check if any of the arguments is a wrapper script.
2406 -* | *.la | *.lo ) ;;
2408 # Do a test to see if this is really a libtool program.
2409 if func_ltwrapper_script_p "$file"; then
2411 # Transform arg to wrapped name.
2412 file="$progdir/$program"
2413 elif func_ltwrapper_executable_p "$file"; then
2414 func_ltwrapper_scriptname "$file"
2415 func_source "$func_ltwrapper_scriptname_result"
2416 # Transform arg to wrapped name.
2417 file="$progdir/$program"
2421 # Quote arguments (to preserve shell metacharacters).
2422 func_quote_for_eval "$file"
2423 args="$args $func_quote_for_eval_result"
2426 if test "X$opt_dry_run" = Xfalse; then
2427 if test -n "$shlibpath_var"; then
2428 # Export the shlibpath_var.
2429 eval "export $shlibpath_var"
2432 # Restore saved environment variables
2433 for lt_var in LANG LANGUAGE LC_ALL LC_CTYPE LC_COLLATE LC_MESSAGES
2435 eval "if test \"\${save_$lt_var+set}\" = set; then
2436 $lt_var=\$save_$lt_var; export $lt_var
2442 # Now prepare to actually exec the command.
2443 exec_cmd="\$cmd$args"
2445 # Display what would be done.
2446 if test -n "$shlibpath_var"; then
2447 eval "\$ECHO \"\$shlibpath_var=\$$shlibpath_var\""
2448 echo "export $shlibpath_var"
2455 test "$mode" = execute && func_mode_execute ${1+"$@"}
2458 # func_mode_finish arg...
2465 if test -n "$finish_cmds$finish_eval" && test -n "$libdirs"; then
2468 libdirs="$libdirs $dir"
2471 for libdir in $libdirs; do
2472 if test -n "$finish_cmds"; then
2473 # Do each command in the finish commands.
2474 func_execute_cmds "$finish_cmds" 'admincmds="$admincmds
2477 if test -n "$finish_eval"; then
2478 # Do the single finish_eval.
2479 eval cmds=\"$finish_eval\"
2480 $opt_dry_run || eval "$cmds" || admincmds="$admincmds
2486 # Exit here if they wanted silent mode.
2487 $opt_silent && exit $EXIT_SUCCESS
2489 echo "----------------------------------------------------------------------"
2490 echo "Libraries have been installed in:"
2491 for libdir in $libdirs; do
2495 echo "If you ever happen to want to link against installed libraries"
2496 echo "in a given directory, LIBDIR, you must either use libtool, and"
2497 echo "specify the full pathname of the library, or use the \`-LLIBDIR'"
2498 echo "flag during linking and do at least one of the following:"
2499 if test -n "$shlibpath_var"; then
2500 echo " - add LIBDIR to the \`$shlibpath_var' environment variable"
2501 echo " during execution"
2503 if test -n "$runpath_var"; then
2504 echo " - add LIBDIR to the \`$runpath_var' environment variable"
2505 echo " during linking"
2507 if test -n "$hardcode_libdir_flag_spec"; then
2509 eval flag=\"$hardcode_libdir_flag_spec\"
2511 $ECHO " - use the \`$flag' linker flag"
2513 if test -n "$admincmds"; then
2514 $ECHO " - have your system administrator run these commands:$admincmds"
2516 if test -f /etc/ld.so.conf; then
2517 echo " - have your system administrator add LIBDIR to \`/etc/ld.so.conf'"
2521 echo "See any operating system documentation about shared libraries for"
2523 solaris2.[6789]|solaris2.1[0-9])
2524 echo "more information, such as the ld(1), crle(1) and ld.so(8) manual"
2528 echo "more information, such as the ld(1) and ld.so(8) manual pages."
2531 echo "----------------------------------------------------------------------"
2535 test "$mode" = finish && func_mode_finish ${1+"$@"}
2538 # func_mode_install arg...
2539 func_mode_install ()
2542 # There may be an optional sh(1) argument at the beginning of
2543 # install_prog (especially on Windows NT).
2544 if test "$nonopt" = "$SHELL" || test "$nonopt" = /bin/sh ||
2545 # Allow the use of GNU shtool's install command.
2546 case $nonopt in *shtool*) :;; *) false;; esac; then
2547 # Aesthetically quote it.
2548 func_quote_for_eval "$nonopt"
2549 install_prog="$func_quote_for_eval_result "
2557 # The real first argument should be the name of the installation program.
2558 # Aesthetically quote it.
2559 func_quote_for_eval "$arg"
2560 install_prog="$install_prog$func_quote_for_eval_result"
2561 install_shared_prog=$install_prog
2562 case " $install_prog " in
2563 *[\\\ /]cp\ *) install_cp=: ;;
2564 *) install_cp=false ;;
2567 # We need to accept at least all the BSD install flags.
2579 if test -n "$dest"; then
2580 files="$files $dest"
2588 if $install_cp; then :; else
2602 # If the previous option needed an argument, then skip it.
2603 if test -n "$prev"; then
2604 if test "x$prev" = x-m && test -n "$install_override_mode"; then
2605 arg2=$install_override_mode
2616 # Aesthetically quote the argument.
2617 func_quote_for_eval "$arg"
2618 install_prog="$install_prog $func_quote_for_eval_result"
2619 if test -n "$arg2"; then
2620 func_quote_for_eval "$arg2"
2622 install_shared_prog="$install_shared_prog $func_quote_for_eval_result"
2625 test -z "$install_prog" && \
2626 func_fatal_help "you must specify an install program"
2628 test -n "$prev" && \
2629 func_fatal_help "the \`$prev' option requires an argument"
2631 if test -n "$install_override_mode" && $no_mode; then
2632 if $install_cp; then :; else
2633 func_quote_for_eval "$install_override_mode"
2634 install_shared_prog="$install_shared_prog -m $func_quote_for_eval_result"
2638 if test -z "$files"; then
2639 if test -z "$dest"; then
2640 func_fatal_help "no file or destination specified"
2642 func_fatal_help "you must specify a destination"
2646 # Strip any trailing slash from the destination.
2647 func_stripname '' '/' "$dest"
2648 dest=$func_stripname_result
2650 # Check to see that the destination is a directory.
2651 test -d "$dest" && isdir=yes
2652 if test "$isdir" = yes; then
2656 func_dirname_and_basename "$dest" "" "."
2657 destdir="$func_dirname_result"
2658 destname="$func_basename_result"
2660 # Not a directory, so check to see that there is only one file specified.
2661 set dummy $files; shift
2662 test "$#" -gt 1 && \
2663 func_fatal_help "\`$dest' is not a directory"
2666 [\\/]* | [A-Za-z]:[\\/]*) ;;
2668 for file in $files; do
2672 func_fatal_help "\`$destdir' must be an absolute directory name"
2679 # This variable tells wrapper scripts just to set variables rather
2680 # than running their programs.
2681 libtool_install_magic="$magic"
2686 for file in $files; do
2688 # Do each installation.
2691 # Do the static libraries later.
2692 staticlibs="$staticlibs $file"
2696 # Check to see that this really is a libtool archive.
2697 func_lalib_unsafe_p "$file" \
2698 || func_fatal_help "\`$file' is not a valid libtool archive"
2705 # Add the libdir to current_libdirs if it is the destination.
2706 if test "X$destdir" = "X$libdir"; then
2707 case "$current_libdirs " in
2709 *) current_libdirs="$current_libdirs $libdir" ;;
2712 # Note the libdir as a future libdir.
2713 case "$future_libdirs " in
2715 *) future_libdirs="$future_libdirs $libdir" ;;
2719 func_dirname "$file" "/" ""
2720 dir="$func_dirname_result"
2723 if test -n "$relink_command"; then
2724 # Determine the prefix the user has applied to our future dir.
2725 inst_prefix_dir=`$ECHO "$destdir" | $SED -e "s%$libdir\$%%"`
2727 # Don't allow the user to place us outside of our expected
2728 # location b/c this prevents finding dependent libraries that
2729 # are installed to the same prefix.
2730 # At present, this check doesn't affect windows .dll's that
2731 # are installed into $libdir/../bin (currently, that works fine)
2732 # but it's something to keep an eye on.
2733 test "$inst_prefix_dir" = "$destdir" && \
2734 func_fatal_error "error: cannot install \`$file' to a directory not ending in $libdir"
2736 if test -n "$inst_prefix_dir"; then
2737 # Stick the inst_prefix_dir data into the link command.
2738 relink_command=`$ECHO "$relink_command" | $SED "s%@inst_prefix_dir@%-inst-prefix-dir $inst_prefix_dir%"`
2740 relink_command=`$ECHO "$relink_command" | $SED "s%@inst_prefix_dir@%%"`
2743 func_warning "relinking \`$file'"
2744 func_show_eval "$relink_command" \
2745 'func_fatal_error "error: relink \`$file'\'' with the above command before installing it"'
2748 # See the names of the shared library.
2749 set dummy $library_names; shift
2750 if test -n "$1"; then
2755 test -n "$relink_command" && srcname="$realname"T
2757 # Install the shared library and build the symlinks.
2758 func_show_eval "$install_shared_prog $dir/$srcname $destdir/$realname" \
2762 cygwin* | mingw* | pw32* | cegcc*)
2770 if test -n "$tstripme" && test -n "$striplib"; then
2771 func_show_eval "$striplib $destdir/$realname" 'exit $?'
2774 if test "$#" -gt 0; then
2775 # Delete the old symlinks, and create new ones.
2776 # Try `ln -sf' first, because the `ln' binary might depend on
2777 # the symlink we replace! Solaris /bin/ln does not understand -f,
2778 # so we also need to try rm && ln -s.
2781 test "$linkname" != "$realname" \
2782 && func_show_eval "(cd $destdir && { $LN_S -f $realname $linkname || { $RM $linkname && $LN_S $realname $linkname; }; })"
2786 # Do each command in the postinstall commands.
2787 lib="$destdir/$realname"
2788 func_execute_cmds "$postinstall_cmds" 'exit $?'
2791 # Install the pseudo-library for information purposes.
2792 func_basename "$file"
2793 name="$func_basename_result"
2794 instname="$dir/$name"i
2795 func_show_eval "$install_prog $instname $destdir/$name" 'exit $?'
2797 # Maybe install the static library, too.
2798 test -n "$old_library" && staticlibs="$staticlibs $dir/$old_library"
2802 # Install (i.e. copy) a libtool object.
2804 # Figure out destination file name, if it wasn't already specified.
2805 if test -n "$destname"; then
2806 destfile="$destdir/$destname"
2808 func_basename "$file"
2809 destfile="$func_basename_result"
2810 destfile="$destdir/$destfile"
2813 # Deduce the name of the destination old-style object file.
2816 func_lo2o "$destfile"
2817 staticdest=$func_lo2o_result
2820 staticdest="$destfile"
2824 func_fatal_help "cannot copy a libtool object to \`$destfile'"
2828 # Install the libtool object if requested.
2829 test -n "$destfile" && \
2830 func_show_eval "$install_prog $file $destfile" 'exit $?'
2832 # Install the old object if enabled.
2833 if test "$build_old_libs" = yes; then
2834 # Deduce the name of the old-style object file.
2836 staticobj=$func_lo2o_result
2837 func_show_eval "$install_prog \$staticobj \$staticdest" 'exit $?'
2843 # Figure out destination file name, if it wasn't already specified.
2844 if test -n "$destname"; then
2845 destfile="$destdir/$destname"
2847 func_basename "$file"
2848 destfile="$func_basename_result"
2849 destfile="$destdir/$destfile"
2852 # If the file is missing, and there is a .exe on the end, strip it
2853 # because it is most likely a libtool script we actually want to
2858 if test ! -f "$file"; then
2859 func_stripname '' '.exe' "$file"
2860 file=$func_stripname_result
2866 # Do a test to see if this is really a libtool program.
2869 if func_ltwrapper_executable_p "$file"; then
2870 func_ltwrapper_scriptname "$file"
2871 wrapper=$func_ltwrapper_scriptname_result
2873 func_stripname '' '.exe' "$file"
2874 wrapper=$func_stripname_result
2881 if func_ltwrapper_script_p "$wrapper"; then
2885 func_source "$wrapper"
2887 # Check the variables that should have been set.
2888 test -z "$generated_by_libtool_version" && \
2889 func_fatal_error "invalid libtool wrapper script \`$wrapper'"
2892 for lib in $notinst_deplibs; do
2893 # Check to see that each library is installed.
2895 if test -f "$lib"; then
2898 libfile="$libdir/"`$ECHO "$lib" | $SED 's%^.*/%%g'` ### testsuite: skip nested quoting test
2899 if test -n "$libdir" && test ! -f "$libfile"; then
2900 func_warning "\`$lib' has not been installed in \`$libdir'"
2906 func_source "$wrapper"
2909 if test "$fast_install" = no && test -n "$relink_command"; then
2911 if test "$finalize" = yes; then
2912 tmpdir=`func_mktempdir`
2913 func_basename "$file$stripped_ext"
2914 file="$func_basename_result"
2915 outputname="$tmpdir/$file"
2916 # Replace the output file specification.
2917 relink_command=`$ECHO "$relink_command" | $SED 's%@OUTPUT@%'"$outputname"'%g'`
2920 func_quote_for_expand "$relink_command"
2921 eval "func_echo $func_quote_for_expand_result"
2923 if eval "$relink_command"; then :
2925 func_error "error: relink \`$file' with the above command before installing it"
2926 $opt_dry_run || ${RM}r "$tmpdir"
2931 func_warning "cannot relink \`$file'"
2935 # Install the binary that we compiled earlier.
2936 file=`$ECHO "$file$stripped_ext" | $SED "s%\([^/]*\)$%$objdir/\1%"`
2940 # remove .exe since cygwin /usr/bin/install will append another
2942 case $install_prog,$host in
2943 */usr/bin/install*,*cygwin*)
2944 case $file:$destfile in
2949 destfile=$destfile.exe
2952 func_stripname '' '.exe' "$destfile"
2953 destfile=$func_stripname_result
2958 func_show_eval "$install_prog\$stripme \$file \$destfile" 'exit $?'
2959 $opt_dry_run || if test -n "$outputname"; then
2966 for file in $staticlibs; do
2967 func_basename "$file"
2968 name="$func_basename_result"
2970 # Set up the ranlib parameters.
2971 oldlib="$destdir/$name"
2973 func_show_eval "$install_prog \$file \$oldlib" 'exit $?'
2975 if test -n "$stripme" && test -n "$old_striplib"; then
2976 func_show_eval "$old_striplib $oldlib" 'exit $?'
2979 # Do each command in the postinstall commands.
2980 func_execute_cmds "$old_postinstall_cmds" 'exit $?'
2983 test -n "$future_libdirs" && \
2984 func_warning "remember to run \`$progname --finish$future_libdirs'"
2986 if test -n "$current_libdirs"; then
2987 # Maybe just do a dry run.
2988 $opt_dry_run && current_libdirs=" -n$current_libdirs"
2989 exec_cmd='$SHELL $progpath $preserve_args --finish$current_libdirs'
2995 test "$mode" = install && func_mode_install ${1+"$@"}
2998 # func_generate_dlsyms outputname originator pic_p
2999 # Extract symbols from dlprefiles and create ${outputname}S.o with
3000 # a dlpreopen symbol table.
3001 func_generate_dlsyms ()
3007 my_prefix=`$ECHO "$my_originator" | sed 's%[^a-zA-Z0-9]%_%g'`
3010 if test -n "$dlfiles$dlprefiles" || test "$dlself" != no; then
3011 if test -n "$NM" && test -n "$global_symbol_pipe"; then
3012 my_dlsyms="${my_outputname}S.c"
3014 func_error "not configured to extract global symbols from dlpreopened files"
3018 if test -n "$my_dlsyms"; then
3022 # Discover the nlist of each of the dlfiles.
3023 nlist="$output_objdir/${my_outputname}.nm"
3025 func_show_eval "$RM $nlist ${nlist}S ${nlist}T"
3027 # Parse the name list into a source file.
3028 func_verbose "creating $output_objdir/$my_dlsyms"
3030 $opt_dry_run || $ECHO > "$output_objdir/$my_dlsyms" "\
3031 /* $my_dlsyms - symbol resolution table for \`$my_outputname' dlsym emulation. */
3032 /* Generated by $PROGRAM (GNU $PACKAGE$TIMESTAMP) $VERSION */
3038 #if defined(__GNUC__) && (((__GNUC__ == 4) && (__GNUC_MINOR__ >= 4)) || (__GNUC__ > 4))
3039 #pragma GCC diagnostic ignored \"-Wstrict-prototypes\"
3042 /* External symbol declarations for the compiler. */\
3045 if test "$dlself" = yes; then
3046 func_verbose "generating symbol list for \`$output'"
3048 $opt_dry_run || echo ': @PROGRAM@ ' > "$nlist"
3050 # Add our own program objects to the symbol list.
3051 progfiles=`$ECHO "$objs$old_deplibs" | $SP2NL | $SED "$lo2o" | $NL2SP`
3052 for progfile in $progfiles; do
3053 func_verbose "extracting global C symbols from \`$progfile'"
3054 $opt_dry_run || eval "$NM $progfile | $global_symbol_pipe >> '$nlist'"
3057 if test -n "$exclude_expsyms"; then
3059 eval '$EGREP -v " ($exclude_expsyms)$" "$nlist" > "$nlist"T'
3060 eval '$MV "$nlist"T "$nlist"'
3064 if test -n "$export_symbols_regex"; then
3066 eval '$EGREP -e "$export_symbols_regex" "$nlist" > "$nlist"T'
3067 eval '$MV "$nlist"T "$nlist"'
3071 # Prepare the list of exported symbols
3072 if test -z "$export_symbols"; then
3073 export_symbols="$output_objdir/$outputname.exp"
3076 eval "${SED} -n -e '/^: @PROGRAM@ $/d' -e 's/^.* \(.*\)$/\1/p' "'< "$nlist" > "$export_symbols"'
3078 *cygwin* | *mingw* | *cegcc* )
3079 eval "echo EXPORTS "'> "$output_objdir/$outputname.def"'
3080 eval 'cat "$export_symbols" >> "$output_objdir/$outputname.def"'
3086 eval "${SED} -e 's/\([].[*^$]\)/\\\\\1/g' -e 's/^/ /' -e 's/$/$/'"' < "$export_symbols" > "$output_objdir/$outputname.exp"'
3087 eval '$GREP -f "$output_objdir/$outputname.exp" < "$nlist" > "$nlist"T'
3088 eval '$MV "$nlist"T "$nlist"'
3090 *cygwin* | *mingw* | *cegcc* )
3091 eval "echo EXPORTS "'> "$output_objdir/$outputname.def"'
3092 eval 'cat "$nlist" >> "$output_objdir/$outputname.def"'
3099 for dlprefile in $dlprefiles; do
3100 func_verbose "extracting global C symbols from \`$dlprefile'"
3101 func_basename "$dlprefile"
3102 name="$func_basename_result"
3104 eval '$ECHO ": $name " >> "$nlist"'
3105 eval "$NM $dlprefile 2>/dev/null | $global_symbol_pipe >> '$nlist'"
3110 # Make sure we have at least an empty file.
3111 test -f "$nlist" || : > "$nlist"
3113 if test -n "$exclude_expsyms"; then
3114 $EGREP -v " ($exclude_expsyms)$" "$nlist" > "$nlist"T
3115 $MV "$nlist"T "$nlist"
3118 # Try sorting and uniquifying the output.
3119 if $GREP -v "^: " < "$nlist" |
3120 if sort -k 3 </dev/null >/dev/null 2>&1; then
3125 uniq > "$nlist"S; then
3128 $GREP -v "^: " < "$nlist" > "$nlist"S
3131 if test -f "$nlist"S; then
3132 eval "$global_symbol_to_cdecl"' < "$nlist"S >> "$output_objdir/$my_dlsyms"'
3134 echo '/* NONE */' >> "$output_objdir/$my_dlsyms"
3137 echo >> "$output_objdir/$my_dlsyms" "\
3139 /* The mapping between symbol names and symbols. */
3146 *cygwin* | *mingw* | *cegcc* )
3147 echo >> "$output_objdir/$my_dlsyms" "\
3148 /* DATA imports from DLLs on WIN32 con't be const, because
3149 runtime relocations are performed -- see ld's documentation
3150 on pseudo-relocs. */"
3153 echo >> "$output_objdir/$my_dlsyms" "\
3154 /* This system does not cope well with relocations in const data */"
3157 lt_dlsym_const=const ;;
3160 echo >> "$output_objdir/$my_dlsyms" "\
3161 extern $lt_dlsym_const lt_dlsymlist
3162 lt_${my_prefix}_LTX_preloaded_symbols[];
3163 $lt_dlsym_const lt_dlsymlist
3164 lt_${my_prefix}_LTX_preloaded_symbols[] =
3166 { \"$my_originator\", (void *) 0 },"
3168 case $need_lib_prefix in
3170 eval "$global_symbol_to_c_name_address" < "$nlist" >> "$output_objdir/$my_dlsyms"
3173 eval "$global_symbol_to_c_name_address_lib_prefix" < "$nlist" >> "$output_objdir/$my_dlsyms"
3176 echo >> "$output_objdir/$my_dlsyms" "\
3180 /* This works around a problem in FreeBSD linker */
3181 #ifdef FREEBSD_WORKAROUND
3182 static const void *lt_preloaded_setup() {
3183 return lt_${my_prefix}_LTX_preloaded_symbols;
3193 pic_flag_for_symtable=
3194 case "$compile_command " in
3198 # compiling the symbol table file with pic_flag works around
3199 # a FreeBSD bug that causes programs to crash when -lm is
3200 # linked before any other PIC object. But we must not use
3201 # pic_flag when linking with -static. The problem exists in
3202 # FreeBSD 2.2.6 and is fixed in FreeBSD 3.1.
3203 *-*-freebsd2*|*-*-freebsd3.0*|*-*-freebsdelf3.0*)
3204 pic_flag_for_symtable=" $pic_flag -DFREEBSD_WORKAROUND" ;;
3206 pic_flag_for_symtable=" $pic_flag" ;;
3208 if test "X$my_pic_p" != Xno; then
3209 pic_flag_for_symtable=" $pic_flag"
3216 for arg in $LTCFLAGS; do
3218 -pie | -fpie | -fPIE) ;;
3219 *) symtab_cflags="$symtab_cflags $arg" ;;
3223 # Now compile the dynamic symbol file.
3224 func_show_eval '(cd $output_objdir && $LTCC$symtab_cflags -c$no_builtin_flag$pic_flag_for_symtable "$my_dlsyms")' 'exit $?'
3226 # Clean up the generated files.
3227 func_show_eval '$RM "$output_objdir/$my_dlsyms" "$nlist" "${nlist}S" "${nlist}T"'
3229 # Transform the symbol file into the correct name.
3230 symfileobj="$output_objdir/${my_outputname}S.$objext"
3232 *cygwin* | *mingw* | *cegcc* )
3233 if test -f "$output_objdir/$my_outputname.def"; then
3234 compile_command=`$ECHO "$compile_command" | $SED "s%@SYMFILE@%$output_objdir/$my_outputname.def $symfileobj%"`
3235 finalize_command=`$ECHO "$finalize_command" | $SED "s%@SYMFILE@%$output_objdir/$my_outputname.def $symfileobj%"`
3237 compile_command=`$ECHO "$compile_command" | $SED "s%@SYMFILE@%$symfileobj%"`
3238 finalize_command=`$ECHO "$finalize_command" | $SED "s%@SYMFILE@%$symfileobj%"`
3242 compile_command=`$ECHO "$compile_command" | $SED "s%@SYMFILE@%$symfileobj%"`
3243 finalize_command=`$ECHO "$finalize_command" | $SED "s%@SYMFILE@%$symfileobj%"`
3248 func_fatal_error "unknown suffix for \`$my_dlsyms'"
3252 # We keep going just in case the user didn't refer to
3253 # lt_preloaded_symbols. The linker will fail if global_symbol_pipe
3254 # really was required.
3256 # Nullify the symbol file.
3257 compile_command=`$ECHO "$compile_command" | $SED "s% @SYMFILE@%%"`
3258 finalize_command=`$ECHO "$finalize_command" | $SED "s% @SYMFILE@%%"`
3262 # func_win32_libid arg
3263 # return the library type of file 'arg'
3265 # Need a lot of goo to handle *both* DLLs and import libs
3266 # Has to be a shell function in order to 'eat' the argument
3267 # that is supplied when $file_magic_command is called.
3268 # Despite the name, also deal with 64 bit binaries.
3272 win32_libid_type="unknown"
3273 win32_fileres=`file -L $1 2>/dev/null`
3274 case $win32_fileres in
3275 *ar\ archive\ import\ library*) # definitely import
3276 win32_libid_type="x86 archive import"
3278 *ar\ archive*) # could be an import, or static
3279 # Keep the egrep pattern in sync with the one in _LT_CHECK_MAGIC_METHOD.
3280 if eval $OBJDUMP -f $1 | $SED -e '10q' 2>/dev/null |
3281 $EGREP 'file format (pei*-i386(.*architecture: i386)?|pe-arm-wince|pe-x86-64)' >/dev/null; then
3282 win32_nmres=`eval $NM -f posix -A $1 |
3291 case $win32_nmres in
3292 import*) win32_libid_type="x86 archive import";;
3293 *) win32_libid_type="x86 archive static";;
3298 win32_libid_type="x86 DLL"
3300 *executable*) # but shell scripts are "executable" too...
3301 case $win32_fileres in
3302 *MS\ Windows\ PE\ Intel*)
3303 win32_libid_type="x86 DLL"
3308 $ECHO "$win32_libid_type"
3313 # func_extract_an_archive dir oldlib
3314 func_extract_an_archive ()
3317 f_ex_an_ar_dir="$1"; shift
3318 f_ex_an_ar_oldlib="$1"
3319 if test "$lock_old_archive_extraction" = yes; then
3320 lockfile=$f_ex_an_ar_oldlib.lock
3321 until $opt_dry_run || ln "$progpath" "$lockfile" 2>/dev/null; do
3322 func_echo "Waiting for $lockfile to be removed"
3326 func_show_eval "(cd \$f_ex_an_ar_dir && $AR x \"\$f_ex_an_ar_oldlib\")" \
3327 'stat=$?; rm -f "$lockfile"; exit $stat'
3328 if test "$lock_old_archive_extraction" = yes; then
3329 $opt_dry_run || rm -f "$lockfile"
3331 if ($AR t "$f_ex_an_ar_oldlib" | sort | sort -uc >/dev/null 2>&1); then
3334 func_fatal_error "object name conflicts in archive: $f_ex_an_ar_dir/$f_ex_an_ar_oldlib"
3339 # func_extract_archives gentop oldlib ...
3340 func_extract_archives ()
3343 my_gentop="$1"; shift
3344 my_oldlibs=${1+"$@"}
3350 for my_xlib in $my_oldlibs; do
3351 # Extract the objects.
3353 [\\/]* | [A-Za-z]:[\\/]*) my_xabs="$my_xlib" ;;
3354 *) my_xabs=`pwd`"/$my_xlib" ;;
3356 func_basename "$my_xlib"
3357 my_xlib="$func_basename_result"
3360 case " $extracted_archives " in
3362 func_arith $extracted_serial + 1
3363 extracted_serial=$func_arith_result
3364 my_xlib_u=lt$extracted_serial-$my_xlib ;;
3368 extracted_archives="$extracted_archives $my_xlib_u"
3369 my_xdir="$my_gentop/$my_xlib_u"
3371 func_mkdir_p "$my_xdir"
3375 func_verbose "Extracting $my_xabs"
3376 # Do not bother doing anything if just a dry run
3378 darwin_orig_dir=`pwd`
3379 cd $my_xdir || exit $?
3380 darwin_archive=$my_xabs
3382 darwin_base_archive=`basename "$darwin_archive"`
3383 darwin_arches=`$LIPO -info "$darwin_archive" 2>/dev/null | $GREP Architectures 2>/dev/null || true`
3384 if test -n "$darwin_arches"; then
3385 darwin_arches=`$ECHO "$darwin_arches" | $SED -e 's/.*are://'`
3387 func_verbose "$darwin_base_archive has multiple architectures $darwin_arches"
3388 for darwin_arch in $darwin_arches ; do
3389 func_mkdir_p "unfat-$$/${darwin_base_archive}-${darwin_arch}"
3390 $LIPO -thin $darwin_arch -output "unfat-$$/${darwin_base_archive}-${darwin_arch}/${darwin_base_archive}" "${darwin_archive}"
3391 cd "unfat-$$/${darwin_base_archive}-${darwin_arch}"
3392 func_extract_an_archive "`pwd`" "${darwin_base_archive}"
3394 $RM "unfat-$$/${darwin_base_archive}-${darwin_arch}/${darwin_base_archive}"
3395 done # $darwin_arches
3396 ## Okay now we've a bunch of thin objects, gotta fatten them up :)
3397 darwin_filelist=`find unfat-$$ -type f -name \*.o -print -o -name \*.lo -print | $SED -e "$basename" | sort -u`
3400 for darwin_file in $darwin_filelist; do
3401 darwin_files=`find unfat-$$ -name $darwin_file -print | sort | $NL2SP`
3402 $LIPO -create -output "$darwin_file" $darwin_files
3403 done # $darwin_filelist
3405 cd "$darwin_orig_dir"
3408 func_extract_an_archive "$my_xdir" "$my_xabs"
3413 func_extract_an_archive "$my_xdir" "$my_xabs"
3416 my_oldobjs="$my_oldobjs "`find $my_xdir -name \*.$objext -print -o -name \*.lo -print | sort | $NL2SP`
3419 func_extract_archives_result="$my_oldobjs"
3423 # func_emit_wrapper [arg=no]
3425 # Emit a libtool wrapper script on stdout.
3426 # Don't directly open a file because we may want to
3427 # incorporate the script contents within a cygwin/mingw
3428 # wrapper executable. Must ONLY be called from within
3429 # func_mode_link because it depends on a number of variables
3432 # ARG is the value that the WRAPPER_SCRIPT_BELONGS_IN_OBJDIR
3433 # variable will take. If 'yes', then the emitted script
3434 # will assume that the directory in which it is stored is
3435 # the $objdir directory. This is a cygwin/mingw-specific
3437 func_emit_wrapper ()
3439 func_emit_wrapper_arg1=${1-no}
3444 # $output - temporary wrapper script for $objdir/$outputname
3445 # Generated by $PROGRAM (GNU $PACKAGE$TIMESTAMP) $VERSION
3447 # The $output program cannot be directly executed until all the libtool
3448 # libraries that it depends on are installed.
3450 # This wrapper script should never be moved out of the build directory.
3451 # If it is, it will not operate correctly.
3453 # Sed substitution that helps us do robust quoting. It backslashifies
3454 # metacharacters that are still active within double-quoted strings.
3455 sed_quote_subst='$sed_quote_subst'
3457 # Be Bourne compatible
3458 if test -n \"\${ZSH_VERSION+set}\" && (emulate sh) >/dev/null 2>&1; then
3461 # Zsh 3.x and 4.x performs word splitting on \${1+\"\$@\"}, which
3462 # is contrary to our usage. Disable this feature.
3463 alias -g '\${1+\"\$@\"}'='\"\$@\"'
3464 setopt NO_GLOB_SUBST
3466 case \`(set -o) 2>/dev/null\` in *posix*) set -o posix;; esac
3468 BIN_SH=xpg4; export BIN_SH # for Tru64
3469 DUALCASE=1; export DUALCASE # for MKS sh
3471 # The HP-UX ksh and POSIX shell print the target directory to stdout
3473 (unset CDPATH) >/dev/null 2>&1 && unset CDPATH
3475 relink_command=\"$relink_command\"
3477 # This environment variable determines our operation mode.
3478 if test \"\$libtool_install_magic\" = \"$magic\"; then
3479 # install mode needs the following variables:
3480 generated_by_libtool_version='$macro_version'
3481 notinst_deplibs='$notinst_deplibs'
3483 # When we are sourced in execute mode, \$file and \$ECHO are already set.
3484 if test \"\$libtool_execute_magic\" != \"$magic\"; then
3487 qECHO=`$ECHO "$ECHO" | $SED "$sed_quote_subst"`
3490 # A function that is used when there is no print builtin or printf.
3491 func_fallback_echo ()
3493 eval 'cat <<_LTECHO_EOF
3500 # Very basic option parsing. These options are (a) specific to
3501 # the libtool wrapper, (b) are identical between the wrapper
3502 # /script/ and the wrapper /executable/ which is used only on
3503 # windows platforms, and (c) all begin with the string "--lt-"
3504 # (application programs are unlikely to have options which match
3507 # There are only two supported options: --lt-debug and
3508 # --lt-dump-script. There is, deliberately, no --lt-help.
3510 # The first argument to this parsing function should be the
3511 # script's $0 value, followed by "$@".
3513 func_parse_lt_options ()
3519 case \"\$lt_opt\" in
3520 --lt-debug) lt_option_debug=1 ;;
3522 lt_dump_D=\`\$ECHO \"X\$lt_script_arg0\" | $SED -e 's/^X//' -e 's%/[^/]*$%%'\`
3523 test \"X\$lt_dump_D\" = \"X\$lt_script_arg0\" && lt_dump_D=.
3524 lt_dump_F=\`\$ECHO \"X\$lt_script_arg0\" | $SED -e 's/^X//' -e 's%^.*/%%'\`
3525 cat \"\$lt_dump_D/\$lt_dump_F\"
3529 \$ECHO \"Unrecognized --lt- option: '\$lt_opt'\" 1>&2
3535 # Print the debug banner immediately:
3536 if test -n \"\$lt_option_debug\"; then
3537 echo \"${outputname}:${output}:\${LINENO}: libtool wrapper (GNU $PACKAGE$TIMESTAMP) $VERSION\" 1>&2
3541 # Used when --lt-debug. Prints its arguments to stdout
3542 # (redirection is the responsibility of the caller)
3543 func_lt_dump_args ()
3548 \$ECHO \"${outputname}:${output}:\${LINENO}: newargv[\$lt_dump_args_N]: \$lt_arg\"
3549 lt_dump_args_N=\`expr \$lt_dump_args_N + 1\`
3553 # Core function for launching the target application
3554 func_exec_program_core ()
3558 # Backslashes separate directories on plain windows
3559 *-*-mingw | *-*-os2* | *-cegcc*)
3561 if test -n \"\$lt_option_debug\"; then
3562 \$ECHO \"${outputname}:${output}:\${LINENO}: newargv[0]: \$progdir\\\\\$program\" 1>&2
3563 func_lt_dump_args \${1+\"\$@\"} 1>&2
3565 exec \"\$progdir\\\\\$program\" \${1+\"\$@\"}
3571 if test -n \"\$lt_option_debug\"; then
3572 \$ECHO \"${outputname}:${output}:\${LINENO}: newargv[0]: \$progdir/\$program\" 1>&2
3573 func_lt_dump_args \${1+\"\$@\"} 1>&2
3575 exec \"\$progdir/\$program\" \${1+\"\$@\"}
3580 \$ECHO \"\$0: cannot exec \$program \$*\" 1>&2
3584 # A function to encapsulate launching the target application
3585 # Strips options in the --lt-* namespace from \$@ and
3586 # launches target application with the remaining arguments.
3587 func_exec_program ()
3593 *) set x \"\$@\" \"\$lt_wr_arg\"; shift;;
3597 func_exec_program_core \${1+\"\$@\"}
3601 func_parse_lt_options \"\$0\" \${1+\"\$@\"}
3603 # Find the directory that this script lives in.
3604 thisdir=\`\$ECHO \"\$file\" | $SED 's%/[^/]*$%%'\`
3605 test \"x\$thisdir\" = \"x\$file\" && thisdir=.
3607 # Follow symbolic links until we get to the real thisdir.
3608 file=\`ls -ld \"\$file\" | $SED -n 's/.*-> //p'\`
3609 while test -n \"\$file\"; do
3610 destdir=\`\$ECHO \"\$file\" | $SED 's%/[^/]*\$%%'\`
3612 # If there was a directory component, then change thisdir.
3613 if test \"x\$destdir\" != \"x\$file\"; then
3614 case \"\$destdir\" in
3615 [\\\\/]* | [A-Za-z]:[\\\\/]*) thisdir=\"\$destdir\" ;;
3616 *) thisdir=\"\$thisdir/\$destdir\" ;;
3620 file=\`\$ECHO \"\$file\" | $SED 's%^.*/%%'\`
3621 file=\`ls -ld \"\$thisdir/\$file\" | $SED -n 's/.*-> //p'\`
3624 # Usually 'no', except on cygwin/mingw when embedded into
3626 WRAPPER_SCRIPT_BELONGS_IN_OBJDIR=$func_emit_wrapper_arg1
3627 if test \"\$WRAPPER_SCRIPT_BELONGS_IN_OBJDIR\" = \"yes\"; then
3628 # special case for '.'
3629 if test \"\$thisdir\" = \".\"; then
3632 # remove .libs from thisdir
3633 case \"\$thisdir\" in
3634 *[\\\\/]$objdir ) thisdir=\`\$ECHO \"\$thisdir\" | $SED 's%[\\\\/][^\\\\/]*$%%'\` ;;
3635 $objdir ) thisdir=. ;;
3639 # Try to get the absolute directory name.
3640 absdir=\`cd \"\$thisdir\" && pwd\`
3641 test -n \"\$absdir\" && thisdir=\"\$absdir\"
3644 if test "$fast_install" = yes; then
3646 program=lt-'$outputname'$exeext
3647 progdir=\"\$thisdir/$objdir\"
3649 if test ! -f \"\$progdir/\$program\" ||
3650 { file=\`ls -1dt \"\$progdir/\$program\" \"\$progdir/../\$program\" 2>/dev/null | ${SED} 1q\`; \\
3651 test \"X\$file\" != \"X\$progdir/\$program\"; }; then
3653 file=\"\$\$-\$program\"
3655 if test ! -d \"\$progdir\"; then
3656 $MKDIR \"\$progdir\"
3658 $RM \"\$progdir/\$file\"
3663 # relink executable if necessary
3664 if test -n \"\$relink_command\"; then
3665 if relink_command_output=\`eval \$relink_command 2>&1\`; then :
3667 $ECHO \"\$relink_command_output\" >&2
3668 $RM \"\$progdir/\$file\"
3673 $MV \"\$progdir/\$file\" \"\$progdir/\$program\" 2>/dev/null ||
3674 { $RM \"\$progdir/\$program\";
3675 $MV \"\$progdir/\$file\" \"\$progdir/\$program\"; }
3676 $RM \"\$progdir/\$file\"
3680 program='$outputname'
3681 progdir=\"\$thisdir/$objdir\"
3687 if test -f \"\$progdir/\$program\"; then"
3689 # Export our shlibpath_var if we have one.
3690 if test "$shlibpath_overrides_runpath" = yes && test -n "$shlibpath_var" && test -n "$temp_rpath"; then
3692 # Add our own library path to $shlibpath_var
3693 $shlibpath_var=\"$temp_rpath\$$shlibpath_var\"
3695 # Some systems cannot cope with colon-terminated $shlibpath_var
3696 # The second colon is a workaround for a bug in BeOS R4 sed
3697 $shlibpath_var=\`\$ECHO \"\$$shlibpath_var\" | $SED 's/::*\$//'\`
3699 export $shlibpath_var
3703 # fixup the dll searchpath if we need to.
3704 if test -n "$dllsearchpath"; then
3706 # Add the dll search path components to the executable PATH
3707 PATH=$dllsearchpath:\$PATH
3712 if test \"\$libtool_execute_magic\" != \"$magic\"; then
3713 # Run the actual program with our arguments.
3714 func_exec_program \${1+\"\$@\"}
3717 # The program doesn't exist.
3718 \$ECHO \"\$0: error: \\\`\$progdir/\$program' does not exist\" 1>&2
3719 \$ECHO \"This script is just a wrapper for \$program.\" 1>&2
3720 \$ECHO \"See the $PACKAGE documentation for more information.\" 1>&2
3728 # func_to_host_path arg
3730 # Convert paths to host format when used with build tools.
3731 # Intended for use with "native" mingw (where libtool itself
3732 # is running under the msys shell), or in the following cross-
3733 # build environments:
3735 # mingw (msys) mingw [e.g. native]
3738 # where wine is equipped with the `winepath' executable.
3739 # In the native mingw case, the (msys) shell automatically
3740 # converts paths for any non-msys applications it launches,
3741 # but that facility isn't available from inside the cwrapper.
3742 # Similar accommodations are necessary for $host mingw and
3743 # $build cygwin. Calling this function does no harm for other
3744 # $host/$build combinations not listed above.
3746 # ARG is the path (on $build) that should be converted to
3747 # the proper representation for $host. The result is stored
3748 # in $func_to_host_path_result.
3749 func_to_host_path ()
3751 func_to_host_path_result="$1"
3752 if test -n "$1"; then
3755 lt_sed_naive_backslashify='s|\\\\*|\\|g;s|/|\\|g;s|\\|\\\\|g'
3757 *mingw* ) # actually, msys
3758 # awkward: cmd appends spaces to result
3759 func_to_host_path_result=`( cmd //c echo "$1" ) 2>/dev/null |
3760 $SED -e 's/[ ]*$//' -e "$lt_sed_naive_backslashify"`
3763 func_to_host_path_result=`cygpath -w "$1" |
3764 $SED -e "$lt_sed_naive_backslashify"`
3767 # Unfortunately, winepath does not exit with a non-zero
3768 # error code, so we are forced to check the contents of
3769 # stdout. On the other hand, if the command is not
3770 # found, the shell will set an exit code of 127 and print
3771 # *an error message* to stdout. So we must check for both
3772 # error code of zero AND non-empty stdout, which explains
3773 # the odd construction:
3774 func_to_host_path_tmp1=`winepath -w "$1" 2>/dev/null`
3775 if test "$?" -eq 0 && test -n "${func_to_host_path_tmp1}"; then
3776 func_to_host_path_result=`$ECHO "$func_to_host_path_tmp1" |
3777 $SED -e "$lt_sed_naive_backslashify"`
3779 # Allow warning below.
3780 func_to_host_path_result=
3784 if test -z "$func_to_host_path_result" ; then
3785 func_error "Could not determine host path corresponding to"
3787 func_error "Continuing, but uninstalled executables may not work."
3789 func_to_host_path_result="$1"
3795 # end: func_to_host_path
3797 # func_to_host_pathlist arg
3799 # Convert pathlists to host format when used with build tools.
3800 # See func_to_host_path(), above. This function supports the
3801 # following $build/$host combinations (but does no harm for
3802 # combinations not listed here):
3804 # mingw (msys) mingw [e.g. native]
3808 # Path separators are also converted from $build format to
3809 # $host format. If ARG begins or ends with a path separator
3810 # character, it is preserved (but converted to $host format)
3813 # ARG is a pathlist (on $build) that should be converted to
3814 # the proper representation on $host. The result is stored
3815 # in $func_to_host_pathlist_result.
3816 func_to_host_pathlist ()
3818 func_to_host_pathlist_result="$1"
3819 if test -n "$1"; then
3822 lt_sed_naive_backslashify='s|\\\\*|\\|g;s|/|\\|g;s|\\|\\\\|g'
3823 # Remove leading and trailing path separator characters from
3824 # ARG. msys behavior is inconsistent here, cygpath turns them
3825 # into '.;' and ';.', and winepath ignores them completely.
3826 func_stripname : : "$1"
3827 func_to_host_pathlist_tmp1=$func_stripname_result
3829 *mingw* ) # Actually, msys.
3830 # Awkward: cmd appends spaces to result.
3831 func_to_host_pathlist_result=`
3832 ( cmd //c echo "$func_to_host_pathlist_tmp1" ) 2>/dev/null |
3833 $SED -e 's/[ ]*$//' -e "$lt_sed_naive_backslashify"`
3836 func_to_host_pathlist_result=`cygpath -w -p "$func_to_host_pathlist_tmp1" |
3837 $SED -e "$lt_sed_naive_backslashify"`
3840 # unfortunately, winepath doesn't convert pathlists
3841 func_to_host_pathlist_result=""
3842 func_to_host_pathlist_oldIFS=$IFS
3844 for func_to_host_pathlist_f in $func_to_host_pathlist_tmp1 ; do
3845 IFS=$func_to_host_pathlist_oldIFS
3846 if test -n "$func_to_host_pathlist_f" ; then
3847 func_to_host_path "$func_to_host_pathlist_f"
3848 if test -n "$func_to_host_path_result" ; then
3849 if test -z "$func_to_host_pathlist_result" ; then
3850 func_to_host_pathlist_result="$func_to_host_path_result"
3852 func_append func_to_host_pathlist_result ";$func_to_host_path_result"
3857 IFS=$func_to_host_pathlist_oldIFS
3860 if test -z "$func_to_host_pathlist_result"; then
3861 func_error "Could not determine the host path(s) corresponding to"
3863 func_error "Continuing, but uninstalled executables may not work."
3864 # Fallback. This may break if $1 contains DOS-style drive
3865 # specifications. The fix is not to complicate the expression
3866 # below, but for the user to provide a working wine installation
3867 # with winepath so that path translation in the cross-to-mingw
3868 # case works properly.
3869 lt_replace_pathsep_nix_to_dos="s|:|;|g"
3870 func_to_host_pathlist_result=`echo "$func_to_host_pathlist_tmp1" |\
3871 $SED -e "$lt_replace_pathsep_nix_to_dos"`
3873 # Now, add the leading and trailing path separators back
3875 :* ) func_to_host_pathlist_result=";$func_to_host_pathlist_result"
3879 *: ) func_append func_to_host_pathlist_result ";"
3886 # end: func_to_host_pathlist
3888 # func_emit_cwrapperexe_src
3889 # emit the source code for a wrapper executable on stdout
3890 # Must ONLY be called from within func_mode_link because
3891 # it depends on a number of variable set therein.
3892 func_emit_cwrapperexe_src ()
3896 /* $cwrappersource - temporary wrapper executable for $objdir/$outputname
3897 Generated by $PROGRAM (GNU $PACKAGE$TIMESTAMP) $VERSION
3899 The $output program cannot be directly executed until all the libtool
3900 libraries that it depends on are installed.
3902 This wrapper executable should never be moved out of the build directory.
3903 If it is, it will not operate correctly.
3908 # define _CRT_SECURE_NO_DEPRECATE 1
3913 # include <direct.h>
3914 # include <process.h>
3917 # include <unistd.h>
3918 # include <stdint.h>
3930 #include <sys/stat.h>
3932 /* declarations of non-ANSI functions */
3933 #if defined(__MINGW32__)
3934 # ifdef __STRICT_ANSI__
3935 int _putenv (const char *);
3937 #elif defined(__CYGWIN__)
3938 # ifdef __STRICT_ANSI__
3939 char *realpath (const char *, char *);
3940 int putenv (char *);
3941 int setenv (const char *, const char *, int);
3943 /* #elif defined (other platforms) ... */
3946 /* portability defines, excluding path handling macros */
3947 #if defined(_MSC_VER)
3948 # define setmode _setmode
3950 # define chmod _chmod
3951 # define getcwd _getcwd
3952 # define putenv _putenv
3953 # define S_IXUSR _S_IEXEC
3954 # ifndef _INTPTR_T_DEFINED
3955 # define _INTPTR_T_DEFINED
3956 # define intptr_t int
3958 #elif defined(__MINGW32__)
3959 # define setmode _setmode
3961 # define chmod _chmod
3962 # define getcwd _getcwd
3963 # define putenv _putenv
3964 #elif defined(__CYGWIN__)
3965 # define HAVE_SETENV
3966 # define FOPEN_WB "wb"
3967 /* #elif defined (other platforms) ... */
3970 #if defined(PATH_MAX)
3971 # define LT_PATHMAX PATH_MAX
3972 #elif defined(MAXPATHLEN)
3973 # define LT_PATHMAX MAXPATHLEN
3975 # define LT_PATHMAX 1024
3985 /* path handling portability macros */
3986 #ifndef DIR_SEPARATOR
3987 # define DIR_SEPARATOR '/'
3988 # define PATH_SEPARATOR ':'
3991 #if defined (_WIN32) || defined (__MSDOS__) || defined (__DJGPP__) || \
3993 # define HAVE_DOS_BASED_FILE_SYSTEM
3994 # define FOPEN_WB "wb"
3995 # ifndef DIR_SEPARATOR_2
3996 # define DIR_SEPARATOR_2 '\\'
3998 # ifndef PATH_SEPARATOR_2
3999 # define PATH_SEPARATOR_2 ';'
4003 #ifndef DIR_SEPARATOR_2
4004 # define IS_DIR_SEPARATOR(ch) ((ch) == DIR_SEPARATOR)
4005 #else /* DIR_SEPARATOR_2 */
4006 # define IS_DIR_SEPARATOR(ch) \
4007 (((ch) == DIR_SEPARATOR) || ((ch) == DIR_SEPARATOR_2))
4008 #endif /* DIR_SEPARATOR_2 */
4010 #ifndef PATH_SEPARATOR_2
4011 # define IS_PATH_SEPARATOR(ch) ((ch) == PATH_SEPARATOR)
4012 #else /* PATH_SEPARATOR_2 */
4013 # define IS_PATH_SEPARATOR(ch) ((ch) == PATH_SEPARATOR_2)
4014 #endif /* PATH_SEPARATOR_2 */
4017 # define FOPEN_WB "w"
4020 # define _O_BINARY 0
4023 #define XMALLOC(type, num) ((type *) xmalloc ((num) * sizeof(type)))
4024 #define XFREE(stale) do { \
4025 if (stale) { free ((void *) stale); stale = 0; } \
4028 #if defined(LT_DEBUGWRAPPER)
4029 static int lt_debug = 1;
4031 static int lt_debug = 0;
4034 const char *program_name = "libtool-wrapper"; /* in case xstrdup fails */
4036 void *xmalloc (size_t num);
4037 char *xstrdup (const char *string);
4038 const char *base_name (const char *name);
4039 char *find_executable (const char *wrapper);
4040 char *chase_symlinks (const char *pathspec);
4041 int make_executable (const char *path);
4042 int check_executable (const char *path);
4043 char *strendzap (char *str, const char *pat);
4044 void lt_debugprintf (const char *file, int line, const char *fmt, ...);
4045 void lt_fatal (const char *file, int line, const char *message, ...);
4046 static const char *nonnull (const char *s);
4047 static const char *nonempty (const char *s);
4048 void lt_setenv (const char *name, const char *value);
4049 char *lt_extend_str (const char *orig_value, const char *add, int to_end);
4050 void lt_update_exe_path (const char *name, const char *value);
4051 void lt_update_lib_path (const char *name, const char *value);
4052 char **prepare_spawn (char **argv);
4053 void lt_dump_script (FILE *f);
4057 const char * MAGIC_EXE = "$magic_exe";
4058 const char * LIB_PATH_VARNAME = "$shlibpath_var";
4061 if test "$shlibpath_overrides_runpath" = yes && test -n "$shlibpath_var" && test -n "$temp_rpath"; then
4062 func_to_host_pathlist "$temp_rpath"
4064 const char * LIB_PATH_VALUE = "$func_to_host_pathlist_result";
4068 const char * LIB_PATH_VALUE = "";
4072 if test -n "$dllsearchpath"; then
4073 func_to_host_pathlist "$dllsearchpath:"
4075 const char * EXE_PATH_VARNAME = "PATH";
4076 const char * EXE_PATH_VALUE = "$func_to_host_pathlist_result";
4080 const char * EXE_PATH_VARNAME = "";
4081 const char * EXE_PATH_VALUE = "";
4085 if test "$fast_install" = yes; then
4087 const char * TARGET_PROGRAM_NAME = "lt-$outputname"; /* hopefully, no .exe */
4091 const char * TARGET_PROGRAM_NAME = "$outputname"; /* hopefully, no .exe */
4098 #define LTWRAPPER_OPTION_PREFIX "--lt-"
4100 static const char *ltwrapper_option_prefix = LTWRAPPER_OPTION_PREFIX;
4101 static const char *dumpscript_opt = LTWRAPPER_OPTION_PREFIX "dump-script";
4102 static const char *debug_opt = LTWRAPPER_OPTION_PREFIX "debug";
4105 main (int argc, char *argv[])
4110 char *actual_cwrapper_path;
4111 char *actual_cwrapper_name;
4114 intptr_t rval = 127;
4118 program_name = (char *) xstrdup (base_name (argv[0]));
4119 newargz = XMALLOC (char *, argc + 1);
4121 /* very simple arg parsing; don't want to rely on getopt
4122 * also, copy all non cwrapper options to newargz, except
4123 * argz[0], which is handled differently
4126 for (i = 1; i < argc; i++)
4128 if (strcmp (argv[i], dumpscript_opt) == 0)
4132 *mingw* | *cygwin* )
4133 # make stdout use "unix" line endings
4134 echo " setmode(1,_O_BINARY);"
4139 lt_dump_script (stdout);
4142 if (strcmp (argv[i], debug_opt) == 0)
4147 if (strcmp (argv[i], ltwrapper_option_prefix) == 0)
4149 /* however, if there is an option in the LTWRAPPER_OPTION_PREFIX
4150 namespace, but it is not one of the ones we know about and
4151 have already dealt with, above (inluding dump-script), then
4152 report an error. Otherwise, targets might begin to believe
4153 they are allowed to use options in the LTWRAPPER_OPTION_PREFIX
4154 namespace. The first time any user complains about this, we'll
4155 need to make LTWRAPPER_OPTION_PREFIX a configure-time option
4156 or a configure.ac-settable value.
4158 lt_fatal (__FILE__, __LINE__,
4159 "unrecognized %s option: '%s'",
4160 ltwrapper_option_prefix, argv[i]);
4163 newargz[++newargc] = xstrdup (argv[i]);
4165 newargz[++newargc] = NULL;
4169 /* The GNU banner must be the first non-error debug message */
4170 lt_debugprintf (__FILE__, __LINE__, "libtool wrapper (GNU $PACKAGE$TIMESTAMP) $VERSION\n");
4173 lt_debugprintf (__FILE__, __LINE__, "(main) argv[0]: %s\n", argv[0]);
4174 lt_debugprintf (__FILE__, __LINE__, "(main) program_name: %s\n", program_name);
4176 tmp_pathspec = find_executable (argv[0]);
4177 if (tmp_pathspec == NULL)
4178 lt_fatal (__FILE__, __LINE__, "couldn't find %s", argv[0]);
4179 lt_debugprintf (__FILE__, __LINE__,
4180 "(main) found exe (before symlink chase) at: %s\n",
4183 actual_cwrapper_path = chase_symlinks (tmp_pathspec);
4184 lt_debugprintf (__FILE__, __LINE__,
4185 "(main) found exe (after symlink chase) at: %s\n",
4186 actual_cwrapper_path);
4187 XFREE (tmp_pathspec);
4189 actual_cwrapper_name = xstrdup (base_name (actual_cwrapper_path));
4190 strendzap (actual_cwrapper_path, actual_cwrapper_name);
4192 /* wrapper name transforms */
4193 strendzap (actual_cwrapper_name, ".exe");
4194 tmp_pathspec = lt_extend_str (actual_cwrapper_name, ".exe", 1);
4195 XFREE (actual_cwrapper_name);
4196 actual_cwrapper_name = tmp_pathspec;
4199 /* target_name transforms -- use actual target program name; might have lt- prefix */
4200 target_name = xstrdup (base_name (TARGET_PROGRAM_NAME));
4201 strendzap (target_name, ".exe");
4202 tmp_pathspec = lt_extend_str (target_name, ".exe", 1);
4203 XFREE (target_name);
4204 target_name = tmp_pathspec;
4207 lt_debugprintf (__FILE__, __LINE__,
4208 "(main) libtool target name: %s\n",
4214 XMALLOC (char, (strlen (actual_cwrapper_path) +
4215 strlen ("$objdir") + 1 + strlen (actual_cwrapper_name) + 1));
4216 strcpy (newargz[0], actual_cwrapper_path);
4217 strcat (newargz[0], "$objdir");
4218 strcat (newargz[0], "/");
4222 /* stop here, and copy so we don't have to do this twice */
4223 tmp_pathspec = xstrdup (newargz[0]);
4225 /* do NOT want the lt- prefix here, so use actual_cwrapper_name */
4226 strcat (newargz[0], actual_cwrapper_name);
4228 /* DO want the lt- prefix here if it exists, so use target_name */
4229 lt_argv_zero = lt_extend_str (tmp_pathspec, target_name, 1);
4230 XFREE (tmp_pathspec);
4231 tmp_pathspec = NULL;
4239 while ((p = strchr (newargz[0], '\\')) != NULL)
4243 while ((p = strchr (lt_argv_zero, '\\')) != NULL)
4253 XFREE (target_name);
4254 XFREE (actual_cwrapper_path);
4255 XFREE (actual_cwrapper_name);
4257 lt_setenv ("BIN_SH", "xpg4"); /* for Tru64 */
4258 lt_setenv ("DUALCASE", "1"); /* for MSK sh */
4259 lt_update_lib_path (LIB_PATH_VARNAME, LIB_PATH_VALUE);
4260 lt_update_exe_path (EXE_PATH_VARNAME, EXE_PATH_VALUE);
4262 lt_debugprintf (__FILE__, __LINE__, "(main) lt_argv_zero: %s\n",
4263 nonnull (lt_argv_zero));
4264 for (i = 0; i < newargc; i++)
4266 lt_debugprintf (__FILE__, __LINE__, "(main) newargz[%d]: %s\n",
4267 i, nonnull (newargz[i]));
4275 /* execv doesn't actually work on mingw as expected on unix */
4276 newargz = prepare_spawn (newargz);
4277 rval = _spawnv (_P_WAIT, lt_argv_zero, (const char * const *) newargz);
4280 /* failed to start process */
4281 lt_debugprintf (__FILE__, __LINE__,
4282 "(main) failed to launch target \"%s\": %s\n",
4283 lt_argv_zero, nonnull (strerror (errno)));
4291 execv (lt_argv_zero, newargz);
4292 return rval; /* =127, but avoids unused variable warning */
4301 xmalloc (size_t num)
4303 void *p = (void *) malloc (num);
4305 lt_fatal (__FILE__, __LINE__, "memory exhausted");
4311 xstrdup (const char *string)
4313 return string ? strcpy ((char *) xmalloc (strlen (string) + 1),
4318 base_name (const char *name)
4322 #if defined (HAVE_DOS_BASED_FILE_SYSTEM)
4323 /* Skip over the disk name in MSDOS pathnames. */
4324 if (isalpha ((unsigned char) name[0]) && name[1] == ':')
4328 for (base = name; *name; name++)
4329 if (IS_DIR_SEPARATOR (*name))
4335 check_executable (const char *path)
4339 lt_debugprintf (__FILE__, __LINE__, "(check_executable): %s\n",
4341 if ((!path) || (!*path))
4344 if ((stat (path, &st) >= 0)
4345 && (st.st_mode & (S_IXUSR | S_IXGRP | S_IXOTH)))
4352 make_executable (const char *path)
4357 lt_debugprintf (__FILE__, __LINE__, "(make_executable): %s\n",
4359 if ((!path) || (!*path))
4362 if (stat (path, &st) >= 0)
4364 rval = chmod (path, st.st_mode | S_IXOTH | S_IXGRP | S_IXUSR);
4369 /* Searches for the full path of the wrapper. Returns
4370 newly allocated full path name if found, NULL otherwise
4371 Does not chase symlinks, even on platforms that support them.
4374 find_executable (const char *wrapper)
4379 /* static buffer for getcwd */
4380 char tmp[LT_PATHMAX + 1];
4384 lt_debugprintf (__FILE__, __LINE__, "(find_executable): %s\n",
4385 nonempty (wrapper));
4387 if ((wrapper == NULL) || (*wrapper == '\0'))
4390 /* Absolute path? */
4391 #if defined (HAVE_DOS_BASED_FILE_SYSTEM)
4392 if (isalpha ((unsigned char) wrapper[0]) && wrapper[1] == ':')
4394 concat_name = xstrdup (wrapper);
4395 if (check_executable (concat_name))
4397 XFREE (concat_name);
4402 if (IS_DIR_SEPARATOR (wrapper[0]))
4404 concat_name = xstrdup (wrapper);
4405 if (check_executable (concat_name))
4407 XFREE (concat_name);
4409 #if defined (HAVE_DOS_BASED_FILE_SYSTEM)
4413 for (p = wrapper; *p; p++)
4421 /* no slashes; search PATH */
4422 const char *path = getenv ("PATH");
4425 for (p = path; *p; p = p_next)
4429 for (q = p; *q; q++)
4430 if (IS_PATH_SEPARATOR (*q))
4433 p_next = (*q == '\0' ? q : q + 1);
4436 /* empty path: current directory */
4437 if (getcwd (tmp, LT_PATHMAX) == NULL)
4438 lt_fatal (__FILE__, __LINE__, "getcwd failed: %s",
4439 nonnull (strerror (errno)));
4440 tmp_len = strlen (tmp);
4442 XMALLOC (char, tmp_len + 1 + strlen (wrapper) + 1);
4443 memcpy (concat_name, tmp, tmp_len);
4444 concat_name[tmp_len] = '/';
4445 strcpy (concat_name + tmp_len + 1, wrapper);
4450 XMALLOC (char, p_len + 1 + strlen (wrapper) + 1);
4451 memcpy (concat_name, p, p_len);
4452 concat_name[p_len] = '/';
4453 strcpy (concat_name + p_len + 1, wrapper);
4455 if (check_executable (concat_name))
4457 XFREE (concat_name);
4460 /* not found in PATH; assume curdir */
4462 /* Relative path | not found in path: prepend cwd */
4463 if (getcwd (tmp, LT_PATHMAX) == NULL)
4464 lt_fatal (__FILE__, __LINE__, "getcwd failed: %s",
4465 nonnull (strerror (errno)));
4466 tmp_len = strlen (tmp);
4467 concat_name = XMALLOC (char, tmp_len + 1 + strlen (wrapper) + 1);
4468 memcpy (concat_name, tmp, tmp_len);
4469 concat_name[tmp_len] = '/';
4470 strcpy (concat_name + tmp_len + 1, wrapper);
4472 if (check_executable (concat_name))
4474 XFREE (concat_name);
4479 chase_symlinks (const char *pathspec)
4482 return xstrdup (pathspec);
4484 char buf[LT_PATHMAX];
4486 char *tmp_pathspec = xstrdup (pathspec);
4488 int has_symlinks = 0;
4489 while (strlen (tmp_pathspec) && !has_symlinks)
4491 lt_debugprintf (__FILE__, __LINE__,
4492 "checking path component for symlinks: %s\n",
4494 if (lstat (tmp_pathspec, &s) == 0)
4496 if (S_ISLNK (s.st_mode) != 0)
4502 /* search backwards for last DIR_SEPARATOR */
4503 p = tmp_pathspec + strlen (tmp_pathspec) - 1;
4504 while ((p > tmp_pathspec) && (!IS_DIR_SEPARATOR (*p)))
4506 if ((p == tmp_pathspec) && (!IS_DIR_SEPARATOR (*p)))
4508 /* no more DIR_SEPARATORS left */
4515 lt_fatal (__FILE__, __LINE__,
4516 "error accessing file \"%s\": %s",
4517 tmp_pathspec, nonnull (strerror (errno)));
4520 XFREE (tmp_pathspec);
4524 return xstrdup (pathspec);
4527 tmp_pathspec = realpath (pathspec, buf);
4528 if (tmp_pathspec == 0)
4530 lt_fatal (__FILE__, __LINE__,
4531 "could not follow symlinks for %s", pathspec);
4533 return xstrdup (tmp_pathspec);
4538 strendzap (char *str, const char *pat)
4542 assert (str != NULL);
4543 assert (pat != NULL);
4546 patlen = strlen (pat);
4550 str += len - patlen;
4551 if (strcmp (str, pat) == 0)
4558 lt_debugprintf (const char *file, int line, const char *fmt, ...)
4563 (void) fprintf (stderr, "%s:%s:%d: ", program_name, file, line);
4564 va_start (args, fmt);
4565 (void) vfprintf (stderr, fmt, args);
4571 lt_error_core (int exit_status, const char *file,
4572 int line, const char *mode,
4573 const char *message, va_list ap)
4575 fprintf (stderr, "%s:%s:%d: %s: ", program_name, file, line, mode);
4576 vfprintf (stderr, message, ap);
4577 fprintf (stderr, ".\n");
4579 if (exit_status >= 0)
4584 lt_fatal (const char *file, int line, const char *message, ...)
4587 va_start (ap, message);
4588 lt_error_core (EXIT_FAILURE, file, line, "FATAL", message, ap);
4593 nonnull (const char *s)
4595 return s ? s : "(null)";
4599 nonempty (const char *s)
4601 return (s && !*s) ? "(empty)" : nonnull (s);
4605 lt_setenv (const char *name, const char *value)
4607 lt_debugprintf (__FILE__, __LINE__,
4608 "(lt_setenv) setting '%s' to '%s'\n",
4609 nonnull (name), nonnull (value));
4612 /* always make a copy, for consistency with !HAVE_SETENV */
4613 char *str = xstrdup (value);
4614 setenv (name, str, 1);
4616 int len = strlen (name) + 1 + strlen (value) + 1;
4617 char *str = XMALLOC (char, len);
4618 sprintf (str, "%s=%s", name, value);
4619 if (putenv (str) != EXIT_SUCCESS)
4628 lt_extend_str (const char *orig_value, const char *add, int to_end)
4631 if (orig_value && *orig_value)
4633 int orig_value_len = strlen (orig_value);
4634 int add_len = strlen (add);
4635 new_value = XMALLOC (char, add_len + orig_value_len + 1);
4638 strcpy (new_value, orig_value);
4639 strcpy (new_value + orig_value_len, add);
4643 strcpy (new_value, add);
4644 strcpy (new_value + add_len, orig_value);
4649 new_value = xstrdup (add);
4655 lt_update_exe_path (const char *name, const char *value)
4657 lt_debugprintf (__FILE__, __LINE__,
4658 "(lt_update_exe_path) modifying '%s' by prepending '%s'\n",
4659 nonnull (name), nonnull (value));
4661 if (name && *name && value && *value)
4663 char *new_value = lt_extend_str (getenv (name), value, 0);
4664 /* some systems can't cope with a ':'-terminated path #' */
4665 int len = strlen (new_value);
4666 while (((len = strlen (new_value)) > 0) && IS_PATH_SEPARATOR (new_value[len-1]))
4668 new_value[len-1] = '\0';
4670 lt_setenv (name, new_value);
4676 lt_update_lib_path (const char *name, const char *value)
4678 lt_debugprintf (__FILE__, __LINE__,
4679 "(lt_update_lib_path) modifying '%s' by prepending '%s'\n",
4680 nonnull (name), nonnull (value));
4682 if (name && *name && value && *value)
4684 char *new_value = lt_extend_str (getenv (name), value, 0);
4685 lt_setenv (name, new_value);
4695 /* Prepares an argument vector before calling spawn().
4696 Note that spawn() does not by itself call the command interpreter
4697 (getenv ("COMSPEC") != NULL ? getenv ("COMSPEC") :
4698 ({ OSVERSIONINFO v; v.dwOSVersionInfoSize = sizeof(OSVERSIONINFO);
4700 v.dwPlatformId == VER_PLATFORM_WIN32_NT;
4701 }) ? "cmd.exe" : "command.com").
4702 Instead it simply concatenates the arguments, separated by ' ', and calls
4703 CreateProcess(). We must quote the arguments since Win32 CreateProcess()
4704 interprets characters like ' ', '\t', '\\', '"' (but not '<' and '>') in a
4706 - Space and tab are interpreted as delimiters. They are not treated as
4707 delimiters if they are surrounded by double quotes: "...".
4708 - Unescaped double quotes are removed from the input. Their only effect is
4709 that within double quotes, space and tab are treated like normal
4711 - Backslashes not followed by double quotes are not special.
4712 - But 2*n+1 backslashes followed by a double quote become
4713 n backslashes followed by a double quote (n >= 0):
4718 #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"
4719 #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"
4721 prepare_spawn (char **argv)
4727 /* Count number of arguments. */
4728 for (argc = 0; argv[argc] != NULL; argc++)
4731 /* Allocate new argument vector. */
4732 new_argv = XMALLOC (char *, argc + 1);
4734 /* Put quoted arguments into the new argument vector. */
4735 for (i = 0; i < argc; i++)
4737 const char *string = argv[i];
4739 if (string[0] == '\0')
4740 new_argv[i] = xstrdup ("\"\"");
4741 else if (strpbrk (string, SHELL_SPECIAL_CHARS) != NULL)
4743 int quote_around = (strpbrk (string, SHELL_SPACE_CHARS) != NULL);
4745 unsigned int backslashes;
4747 char *quoted_string;
4754 for (s = string; *s != '\0'; s++)
4758 length += backslashes + 1;
4766 length += backslashes + 1;
4768 quoted_string = XMALLOC (char, length + 1);
4774 for (s = string; *s != '\0'; s++)
4780 for (j = backslashes + 1; j > 0; j--)
4792 for (j = backslashes; j > 0; j--)
4798 new_argv[i] = quoted_string;
4801 new_argv[i] = (char *) string;
4803 new_argv[argc] = NULL;
4812 void lt_dump_script (FILE* f)
4815 func_emit_wrapper yes |
4816 $SED -e 's/\([\\"]\)/\\\1/g' \
4817 -e 's/^/ fputs ("/' -e 's/$/\\n", f);/'
4823 # end: func_emit_cwrapperexe_src
4825 # func_win32_import_lib_p ARG
4826 # True if ARG is an import lib, as indicated by $file_magic_cmd
4827 func_win32_import_lib_p ()
4830 case `eval $file_magic_cmd \"\$1\" 2>/dev/null | $SED -e 10q` in
4836 # func_mode_link arg...
4841 *-*-cygwin* | *-*-mingw* | *-*-pw32* | *-*-os2* | *-cegcc*)
4842 # It is impossible to link a dll without this setting, and
4843 # we shouldn't force the makefile maintainer to figure out
4844 # which system we are compiling for in order to pass an extra
4845 # flag for every libtool invocation.
4846 # allow_undefined=no
4848 # FIXME: Unfortunately, there are problems with the above when trying
4849 # to make a dll which has undefined symbols, in which case not
4850 # even a static library is built. For now, we need to specify
4851 # -no-undefined on the libtool link line when we can be certain
4852 # that all symbols are satisfied, otherwise we get a static library.
4859 libtool_args=$nonopt
4860 base_compile="$nonopt $@"
4861 compile_command=$nonopt
4862 finalize_command=$nonopt
4875 lib_search_path=`pwd`
4877 new_inherited_linker_flags=
4886 export_symbols_regex=
4894 precious_files_regex=
4895 prefer_static_libs=no
4908 single_module="${wl}-single_module"
4909 func_infer_tag $base_compile
4911 # We need to know -static, to get the right output filenames.
4916 test "$build_libtool_libs" != yes && \
4917 func_fatal_configuration "can not build a shared library"
4921 -all-static | -static | -static-libtool-libs)
4924 if test "$build_libtool_libs" = yes && test -z "$link_static_flag"; then
4925 func_warning "complete static linking is impossible in this configuration"
4927 if test -n "$link_static_flag"; then
4928 dlopen_self=$dlopen_self_static
4930 prefer_static_libs=yes
4933 if test -z "$pic_flag" && test -n "$link_static_flag"; then
4934 dlopen_self=$dlopen_self_static
4936 prefer_static_libs=built
4938 -static-libtool-libs)
4939 if test -z "$pic_flag" && test -n "$link_static_flag"; then
4940 dlopen_self=$dlopen_self_static
4942 prefer_static_libs=yes
4945 build_libtool_libs=no
4952 # See if our shared archives depend on static archives.
4953 test -n "$old_archive_from_new_cmds" && build_old_libs=yes
4955 # Go through the arguments, transforming them on the way.
4956 while test "$#" -gt 0; do
4959 func_quote_for_eval "$arg"
4960 qarg=$func_quote_for_eval_unquoted_result
4961 func_append libtool_args " $func_quote_for_eval_result"
4963 # If the previous option needs an argument, assign it.
4964 if test -n "$prev"; then
4967 func_append compile_command " @OUTPUT@"
4968 func_append finalize_command " @OUTPUT@"
4979 if test "$preload" = no; then
4980 # Add the symbol object into the linking commands.
4981 func_append compile_command " @SYMFILE@"
4982 func_append finalize_command " @SYMFILE@"
4986 *.la | *.lo) ;; # We handle these cases below.
4988 if test "$dlself" = no; then
4996 if test "$prev" = dlprefiles; then
4998 elif test "$prev" = dlfiles && test "$dlopen_self" != yes; then
5008 if test "$prev" = dlfiles; then
5009 dlfiles="$dlfiles $arg"
5011 dlprefiles="$dlprefiles $arg"
5019 export_symbols="$arg"
5021 || func_fatal_error "symbol file \`$arg' does not exist"
5026 export_symbols_regex="$arg"
5034 *" $qarg.ltframework "*) ;;
5035 *) deplibs="$deplibs $qarg.ltframework" # this is fixed later
5044 inst_prefix_dir="$arg"
5049 if test -f "$arg"; then
5052 for fil in `cat "$save_arg"`
5054 # moreargs="$moreargs $fil"
5056 # A libtool-controlled object.
5058 # Check to see that this really is a libtool object.
5059 if func_lalib_unsafe_p "$arg"; then
5066 if test -z "$pic_object" ||
5067 test -z "$non_pic_object" ||
5068 test "$pic_object" = none &&
5069 test "$non_pic_object" = none; then
5070 func_fatal_error "cannot find name of object for \`$arg'"
5073 # Extract subdirectory from the argument.
5074 func_dirname "$arg" "/" ""
5075 xdir="$func_dirname_result"
5077 if test "$pic_object" != none; then
5078 # Prepend the subdirectory the object is found in.
5079 pic_object="$xdir$pic_object"
5081 if test "$prev" = dlfiles; then
5082 if test "$build_libtool_libs" = yes && test "$dlopen_support" = yes; then
5083 dlfiles="$dlfiles $pic_object"
5087 # If libtool objects are unsupported, then we need to preload.
5092 # CHECK ME: I think I busted this. -Ossama
5093 if test "$prev" = dlprefiles; then
5094 # Preload the old-style object.
5095 dlprefiles="$dlprefiles $pic_object"
5100 func_append libobjs " $pic_object"
5105 if test "$non_pic_object" != none; then
5106 # Prepend the subdirectory the object is found in.
5107 non_pic_object="$xdir$non_pic_object"
5109 # A standard non-PIC object
5110 func_append non_pic_objects " $non_pic_object"
5111 if test -z "$pic_object" || test "$pic_object" = none ; then
5112 arg="$non_pic_object"
5115 # If the PIC object exists, use it instead.
5116 # $xdir was prepended to $pic_object above.
5117 non_pic_object="$pic_object"
5118 func_append non_pic_objects " $non_pic_object"
5121 # Only an error if not doing a dry-run.
5122 if $opt_dry_run; then
5123 # Extract subdirectory from the argument.
5124 func_dirname "$arg" "/" ""
5125 xdir="$func_dirname_result"
5128 pic_object=$xdir$objdir/$func_lo2o_result
5129 non_pic_object=$xdir$func_lo2o_result
5130 func_append libobjs " $pic_object"
5131 func_append non_pic_objects " $non_pic_object"
5133 func_fatal_error "\`$arg' is not a valid libtool object"
5138 func_fatal_error "link input file \`$arg' does not exist"
5145 precious_files_regex="$arg"
5155 # We need an absolute path.
5157 [\\/]* | [A-Za-z]:[\\/]*) ;;
5159 func_fatal_error "only absolute run-paths are allowed"
5162 if test "$prev" = rpath; then
5165 *) rpath="$rpath $arg" ;;
5170 *) xrpath="$xrpath $arg" ;;
5182 weak_libs="$weak_libs $arg"
5187 linker_flags="$linker_flags $qarg"
5188 compiler_flags="$compiler_flags $qarg"
5190 func_append compile_command " $qarg"
5191 func_append finalize_command " $qarg"
5195 compiler_flags="$compiler_flags $qarg"
5197 func_append compile_command " $qarg"
5198 func_append finalize_command " $qarg"
5202 linker_flags="$linker_flags $qarg"
5203 compiler_flags="$compiler_flags $wl$qarg"
5205 func_append compile_command " $wl$qarg"
5206 func_append finalize_command " $wl$qarg"
5210 eval "$prev=\"\$arg\""
5215 fi # test -n "$prev"
5221 if test -n "$link_static_flag"; then
5222 # See comment for -static flag below, for more details.
5223 func_append compile_command " $link_static_flag"
5224 func_append finalize_command " $link_static_flag"
5230 # FIXME: remove this flag sometime in the future.
5231 func_fatal_error "\`-allow-undefined' must not be used because it is the default"
5259 -export-symbols | -export-symbols-regex)
5260 if test -n "$export_symbols" || test -n "$export_symbols_regex"; then
5261 func_fatal_error "more than one -exported-symbols argument is not allowed"
5263 if test "X$arg" = "X-export-symbols"; then
5281 # The native IRIX linker understands -LANG:*, -LIST:* and -LNO:*
5282 # so, if we see these flags be careful not to treat them like -L
5284 case $with_gcc/$host in
5285 no/*-*-irix* | /*-*-irix*)
5286 func_append compile_command " $arg"
5287 func_append finalize_command " $arg"
5294 func_stripname '-L' '' "$arg"
5295 dir=$func_stripname_result
5296 if test -z "$dir"; then
5297 if test "$#" -gt 0; then
5298 func_fatal_error "require no space between \`-L' and \`$1'"
5300 func_fatal_error "need path for \`-L' option"
5303 # We need an absolute path.
5305 [\\/]* | [A-Za-z]:[\\/]*) ;;
5307 absdir=`cd "$dir" && pwd`
5308 test -z "$absdir" && \
5309 func_fatal_error "cannot determine absolute directory name of \`$dir'"
5316 deplibs="$deplibs -L$dir"
5317 lib_search_path="$lib_search_path $dir"
5321 *-*-cygwin* | *-*-mingw* | *-*-pw32* | *-*-os2* | *-cegcc*)
5322 testbindir=`$ECHO "$dir" | $SED 's*/lib$*/bin*'`
5323 case :$dllsearchpath: in
5325 ::) dllsearchpath=$dir;;
5326 *) dllsearchpath="$dllsearchpath:$dir";;
5328 case :$dllsearchpath: in
5329 *":$testbindir:"*) ;;
5330 ::) dllsearchpath=$testbindir;;
5331 *) dllsearchpath="$dllsearchpath:$testbindir";;
5339 if test "X$arg" = "X-lc" || test "X$arg" = "X-lm"; then
5341 *-*-cygwin* | *-*-mingw* | *-*-pw32* | *-*-beos* | *-cegcc* | *-*-haiku*)
5342 # These systems don't actually have a C or math library (as such)
5346 # These systems don't actually have a C library (as such)
5347 test "X$arg" = "X-lc" && continue
5349 *-*-openbsd* | *-*-freebsd* | *-*-dragonfly*)
5350 # Do not include libc due to us having libc/libc_r.
5351 test "X$arg" = "X-lc" && continue
5353 *-*-rhapsody* | *-*-darwin1.[012])
5354 # Rhapsody C and math libraries are in the System framework
5355 deplibs="$deplibs System.ltframework"
5358 *-*-sco3.2v5* | *-*-sco5v6*)
5359 # Causes problems with __ctype
5360 test "X$arg" = "X-lc" && continue
5362 *-*-sysv4.2uw2* | *-*-sysv5* | *-*-unixware* | *-*-OpenUNIX*)
5363 # Compiler inserts libc in the correct place for threads to work
5364 test "X$arg" = "X-lc" && continue
5367 elif test "X$arg" = "X-lc_r"; then
5369 *-*-openbsd* | *-*-freebsd* | *-*-dragonfly*)
5370 # Do not include libc_r directly, use -pthread flag.
5375 deplibs="$deplibs $arg"
5384 # Tru64 UNIX uses -model [arg] to determine the layout of C++
5385 # classes, name mangling, and exception handling.
5386 # Darwin uses the -arch flag to determine output architecture.
5387 -model|-arch|-isysroot)
5388 compiler_flags="$compiler_flags $arg"
5389 func_append compile_command " $arg"
5390 func_append finalize_command " $arg"
5395 -mt|-mthreads|-kthread|-Kthread|-pthread|-pthreads|--thread-safe|-threads)
5396 compiler_flags="$compiler_flags $arg"
5397 func_append compile_command " $arg"
5398 func_append finalize_command " $arg"
5399 case "$new_inherited_linker_flags " in
5401 * ) new_inherited_linker_flags="$new_inherited_linker_flags $arg" ;;
5407 single_module="${wl}-multi_module"
5418 *-*-cygwin* | *-*-mingw* | *-*-pw32* | *-*-os2* | *-*-darwin* | *-cegcc*)
5419 # The PATH hackery in wrapper scripts is required on Windows
5420 # and Darwin in order for the loader to find any dlls it needs.
5421 func_warning "\`-no-install' is ignored for $host"
5422 func_warning "assuming \`-no-fast-install' instead"
5425 *) no_install=yes ;;
5442 -precious-files-regex)
5463 func_stripname '-R' '' "$arg"
5464 dir=$func_stripname_result
5465 # We need an absolute path.
5467 [\\/]* | [A-Za-z]:[\\/]*) ;;
5469 func_fatal_error "only absolute run-paths are allowed"
5474 *) xrpath="$xrpath $dir" ;;
5480 # The effects of -shared are defined in a previous loop.
5489 -static | -static-libtool-libs)
5490 # The effects of -static are defined in a previous loop.
5491 # We used to do the same as -all-static on platforms that
5492 # didn't have a PIC flag, but the assumption that the effects
5493 # would be equivalent was wrong. It would break on at least
5494 # Digital Unix and AIX.
5520 func_stripname '-Wc,' '' "$arg"
5521 args=$func_stripname_result
5523 save_ifs="$IFS"; IFS=','
5524 for flag in $args; do
5526 func_quote_for_eval "$flag"
5527 arg="$arg $func_quote_for_eval_result"
5528 compiler_flags="$compiler_flags $func_quote_for_eval_result"
5531 func_stripname ' ' '' "$arg"
5532 arg=$func_stripname_result
5536 func_stripname '-Wl,' '' "$arg"
5537 args=$func_stripname_result
5539 save_ifs="$IFS"; IFS=','
5540 for flag in $args; do
5542 func_quote_for_eval "$flag"
5543 arg="$arg $wl$func_quote_for_eval_result"
5544 compiler_flags="$compiler_flags $wl$func_quote_for_eval_result"
5545 linker_flags="$linker_flags $func_quote_for_eval_result"
5548 func_stripname ' ' '' "$arg"
5549 arg=$func_stripname_result
5569 func_quote_for_eval "$arg"
5570 arg="$func_quote_for_eval_result"
5573 # Flags to be passed through unchanged, with rationale:
5574 # -64, -mips[0-9] enable 64-bit mode for the SGI compiler
5575 # -r[0-9][0-9]* specify processor for the SGI compiler
5576 # -xarch=*, -xtarget=* enable 64-bit mode for the Sun compiler
5577 # +DA*, +DD* enable 64-bit mode for the HP compiler
5578 # -q* compiler args for the IBM compiler
5579 # -m*, -t[45]*, -txscale* architecture-specific flags for GCC
5580 # -F/path path to uninstalled frameworks, gcc on darwin
5581 # -p, -pg, --coverage, -fprofile-* profiling flags for GCC
5582 # @file GCC response files
5583 # -tp=* Portland pgcc target processor selection
5584 -64|-mips[0-9]|-r[0-9][0-9]*|-xarch=*|-xtarget=*|+DA*|+DD*|-q*|-m*| \
5585 -t[45]*|-txscale*|-p|-pg|--coverage|-fprofile-*|-F*|@*|-tp=*)
5586 func_quote_for_eval "$arg"
5587 arg="$func_quote_for_eval_result"
5588 func_append compile_command " $arg"
5589 func_append finalize_command " $arg"
5590 compiler_flags="$compiler_flags $arg"
5594 # Some other compiler flag.
5596 func_quote_for_eval "$arg"
5597 arg="$func_quote_for_eval_result"
5601 # A standard object.
5606 # A libtool-controlled object.
5608 # Check to see that this really is a libtool object.
5609 if func_lalib_unsafe_p "$arg"; then
5616 if test -z "$pic_object" ||
5617 test -z "$non_pic_object" ||
5618 test "$pic_object" = none &&
5619 test "$non_pic_object" = none; then
5620 func_fatal_error "cannot find name of object for \`$arg'"
5623 # Extract subdirectory from the argument.
5624 func_dirname "$arg" "/" ""
5625 xdir="$func_dirname_result"
5627 if test "$pic_object" != none; then
5628 # Prepend the subdirectory the object is found in.
5629 pic_object="$xdir$pic_object"
5631 if test "$prev" = dlfiles; then
5632 if test "$build_libtool_libs" = yes && test "$dlopen_support" = yes; then
5633 dlfiles="$dlfiles $pic_object"
5637 # If libtool objects are unsupported, then we need to preload.
5642 # CHECK ME: I think I busted this. -Ossama
5643 if test "$prev" = dlprefiles; then
5644 # Preload the old-style object.
5645 dlprefiles="$dlprefiles $pic_object"
5650 func_append libobjs " $pic_object"
5655 if test "$non_pic_object" != none; then
5656 # Prepend the subdirectory the object is found in.
5657 non_pic_object="$xdir$non_pic_object"
5659 # A standard non-PIC object
5660 func_append non_pic_objects " $non_pic_object"
5661 if test -z "$pic_object" || test "$pic_object" = none ; then
5662 arg="$non_pic_object"
5665 # If the PIC object exists, use it instead.
5666 # $xdir was prepended to $pic_object above.
5667 non_pic_object="$pic_object"
5668 func_append non_pic_objects " $non_pic_object"
5671 # Only an error if not doing a dry-run.
5672 if $opt_dry_run; then
5673 # Extract subdirectory from the argument.
5674 func_dirname "$arg" "/" ""
5675 xdir="$func_dirname_result"
5678 pic_object=$xdir$objdir/$func_lo2o_result
5679 non_pic_object=$xdir$func_lo2o_result
5680 func_append libobjs " $pic_object"
5681 func_append non_pic_objects " $non_pic_object"
5683 func_fatal_error "\`$arg' is not a valid libtool object"
5690 deplibs="$deplibs $arg"
5691 old_deplibs="$old_deplibs $arg"
5696 # A libtool-controlled library.
5698 if test "$prev" = dlfiles; then
5699 # This library was specified with -dlopen.
5700 dlfiles="$dlfiles $arg"
5702 elif test "$prev" = dlprefiles; then
5703 # The library was specified with -dlpreopen.
5704 dlprefiles="$dlprefiles $arg"
5707 deplibs="$deplibs $arg"
5712 # Some other compiler argument.
5714 # Unknown arguments in both finalize_command and compile_command need
5715 # to be aesthetically quoted because they are evaled later.
5716 func_quote_for_eval "$arg"
5717 arg="$func_quote_for_eval_result"
5721 # Now actually substitute the argument into the commands.
5722 if test -n "$arg"; then
5723 func_append compile_command " $arg"
5724 func_append finalize_command " $arg"
5726 done # argument parsing loop
5728 test -n "$prev" && \
5729 func_fatal_help "the \`$prevarg' option requires an argument"
5731 if test "$export_dynamic" = yes && test -n "$export_dynamic_flag_spec"; then
5732 eval arg=\"$export_dynamic_flag_spec\"
5733 func_append compile_command " $arg"
5734 func_append finalize_command " $arg"
5738 # calculate the name of the file, without its directory
5739 func_basename "$output"
5740 outputname="$func_basename_result"
5741 libobjs_save="$libobjs"
5743 if test -n "$shlibpath_var"; then
5744 # get the directories listed in $shlibpath_var
5745 eval shlib_search_path=\`\$ECHO \"\${$shlibpath_var}\" \| \$SED \'s/:/ /g\'\`
5749 eval sys_lib_search_path=\"$sys_lib_search_path_spec\"
5750 eval sys_lib_dlsearch_path=\"$sys_lib_dlsearch_path_spec\"
5752 func_dirname "$output" "/" ""
5753 output_objdir="$func_dirname_result$objdir"
5754 # Create the object directory.
5755 func_mkdir_p "$output_objdir"
5757 # Determine the type of output
5760 func_fatal_help "you must specify an output file"
5762 *.$libext) linkmode=oldlib ;;
5763 *.lo | *.$objext) linkmode=obj ;;
5764 *.la) linkmode=lib ;;
5765 *) linkmode=prog ;; # Anything else should be a program.
5771 # Find all interdependent deplibs by searching for libraries
5772 # that are linked more than once (e.g. -la -lb -la)
5773 for deplib in $deplibs; do
5774 if $opt_duplicate_deps ; then
5776 *" $deplib "*) specialdeplibs="$specialdeplibs $deplib" ;;
5779 libs="$libs $deplib"
5782 if test "$linkmode" = lib; then
5783 libs="$predeps $libs $compiler_lib_search_path $postdeps"
5785 # Compute libraries that are listed more than once in $predeps
5786 # $postdeps and mark them as special (i.e., whose duplicates are
5787 # not to be eliminated).
5789 if $opt_duplicate_compiler_generated_deps; then
5790 for pre_post_dep in $predeps $postdeps; do
5791 case "$pre_post_deps " in
5792 *" $pre_post_dep "*) specialdeplibs="$specialdeplibs $pre_post_deps" ;;
5794 pre_post_deps="$pre_post_deps $pre_post_dep"
5803 need_relink=no # whether we're linking any uninstalled libtool libraries
5804 notinst_deplibs= # not-installed libtool libraries
5805 notinst_path= # paths that contain not-installed libtool libraries
5809 passes="conv dlpreopen link"
5810 for file in $dlfiles $dlprefiles; do
5814 func_fatal_help "libraries can \`-dlopen' only libtool libraries: $file"
5825 passes="conv scan dlopen dlpreopen link"
5831 for pass in $passes; do
5832 # The preopen pass in lib mode reverses $deplibs; put it back here
5833 # so that -L comes before libs that need it for instance...
5834 if test "$linkmode,$pass" = "lib,link"; then
5835 ## FIXME: Find the place where the list is rebuilt in the wrong
5836 ## order, and fix it there properly
5838 for deplib in $deplibs; do
5839 tmp_deplibs="$deplib $tmp_deplibs"
5841 deplibs="$tmp_deplibs"
5844 if test "$linkmode,$pass" = "lib,link" ||
5845 test "$linkmode,$pass" = "prog,scan"; then
5849 if test "$linkmode" = prog; then
5851 dlopen) libs="$dlfiles" ;;
5852 dlpreopen) libs="$dlprefiles" ;;
5853 link) libs="$deplibs %DEPLIBS% $dependency_libs" ;;
5856 if test "$linkmode,$pass" = "lib,dlpreopen"; then
5857 # Collect and forward deplibs of preopened libtool libs
5858 for lib in $dlprefiles; do
5859 # Ignore non-libtool-libs
5862 *.la) func_source "$lib" ;;
5865 # Collect preopened libtool deplibs, except any this library
5866 # has declared as weak libs
5867 for deplib in $dependency_libs; do
5868 func_basename "$deplib"
5869 deplib_base=$func_basename_result
5870 case " $weak_libs " in
5871 *" $deplib_base "*) ;;
5872 *) deplibs="$deplibs $deplib" ;;
5878 if test "$pass" = dlopen; then
5879 # Collect dlpreopened libraries
5880 save_deplibs="$deplibs"
5884 for deplib in $libs; do
5888 -mt|-mthreads|-kthread|-Kthread|-pthread|-pthreads|--thread-safe|-threads)
5889 if test "$linkmode,$pass" = "prog,link"; then
5890 compile_deplibs="$deplib $compile_deplibs"
5891 finalize_deplibs="$deplib $finalize_deplibs"
5893 compiler_flags="$compiler_flags $deplib"
5894 if test "$linkmode" = lib ; then
5895 case "$new_inherited_linker_flags " in
5897 * ) new_inherited_linker_flags="$new_inherited_linker_flags $deplib" ;;
5904 if test "$linkmode" != lib && test "$linkmode" != prog; then
5905 func_warning "\`-l' is ignored for archives/objects"
5908 func_stripname '-l' '' "$deplib"
5909 name=$func_stripname_result
5910 if test "$linkmode" = lib; then
5911 searchdirs="$newlib_search_path $lib_search_path $compiler_lib_search_dirs $sys_lib_search_path $shlib_search_path"
5913 searchdirs="$newlib_search_path $lib_search_path $sys_lib_search_path $shlib_search_path"
5915 for searchdir in $searchdirs; do
5916 for search_ext in .la $std_shrext .so .a; do
5917 # Search the libtool library
5918 lib="$searchdir/lib${name}${search_ext}"
5919 if test -f "$lib"; then
5920 if test "$search_ext" = ".la"; then
5929 if test "$found" != yes; then
5930 # deplib doesn't seem to be a libtool library
5931 if test "$linkmode,$pass" = "prog,link"; then
5932 compile_deplibs="$deplib $compile_deplibs"
5933 finalize_deplibs="$deplib $finalize_deplibs"
5935 deplibs="$deplib $deplibs"
5936 test "$linkmode" = lib && newdependency_libs="$deplib $newdependency_libs"
5939 else # deplib is a libtool library
5940 # If $allow_libtool_libs_with_static_runtimes && $deplib is a stdlib,
5941 # We need to do some special things here, and not later.
5942 if test "X$allow_libtool_libs_with_static_runtimes" = "Xyes" ; then
5943 case " $predeps $postdeps " in
5945 if func_lalib_p "$lib"; then
5949 for l in $old_library $library_names; do
5952 if test "X$ll" = "X$old_library" ; then # only static version available
5954 func_dirname "$lib" "" "."
5955 ladir="$func_dirname_result"
5956 lib=$ladir/$old_library
5957 if test "$linkmode,$pass" = "prog,link"; then
5958 compile_deplibs="$deplib $compile_deplibs"
5959 finalize_deplibs="$deplib $finalize_deplibs"
5961 deplibs="$deplib $deplibs"
5962 test "$linkmode" = lib && newdependency_libs="$deplib $newdependency_libs"
5974 if test "$linkmode,$pass" = "prog,link"; then
5975 compile_deplibs="$deplib $compile_deplibs"
5976 finalize_deplibs="$deplib $finalize_deplibs"
5978 deplibs="$deplib $deplibs"
5979 if test "$linkmode" = lib ; then
5980 case "$new_inherited_linker_flags " in
5982 * ) new_inherited_linker_flags="$new_inherited_linker_flags $deplib" ;;
5991 deplibs="$deplib $deplibs"
5992 test "$pass" = conv && continue
5993 newdependency_libs="$deplib $newdependency_libs"
5994 func_stripname '-L' '' "$deplib"
5995 newlib_search_path="$newlib_search_path $func_stripname_result"
5998 if test "$pass" = conv; then
5999 deplibs="$deplib $deplibs"
6002 if test "$pass" = scan; then
6003 deplibs="$deplib $deplibs"
6005 compile_deplibs="$deplib $compile_deplibs"
6006 finalize_deplibs="$deplib $finalize_deplibs"
6008 func_stripname '-L' '' "$deplib"
6009 newlib_search_path="$newlib_search_path $func_stripname_result"
6012 func_warning "\`-L' is ignored for archives/objects"
6018 if test "$pass" = link; then
6019 func_stripname '-R' '' "$deplib"
6020 dir=$func_stripname_result
6021 # Make sure the xrpath contains only unique directories.
6024 *) xrpath="$xrpath $dir" ;;
6027 deplibs="$deplib $deplibs"
6030 *.la) lib="$deplib" ;;
6032 if test "$pass" = conv; then
6033 deplibs="$deplib $deplibs"
6038 # Linking convenience modules into shared libraries is allowed,
6039 # but linking other static libraries is non-portable.
6040 case " $dlpreconveniencelibs " in
6044 case $deplibs_check_method in
6046 set dummy $deplibs_check_method; shift
6047 match_pattern_regex=`expr "$deplibs_check_method" : "$1 \(.*\)"`
6048 if eval "\$ECHO \"$deplib\"" 2>/dev/null | $SED 10q \
6049 | $EGREP "$match_pattern_regex" > /dev/null; then
6057 if test "$valid_a_lib" != yes; then
6059 $ECHO "*** Warning: Trying to link with static lib archive $deplib."
6060 echo "*** I have the capability to make that library automatically link in when"
6061 echo "*** you link to this library. But I can only do this if you have a"
6062 echo "*** shared version of the library, which you do not appear to have"
6063 echo "*** because the file extensions .$libext of this argument makes me believe"
6064 echo "*** that it is just a static archive that I should not use here."
6067 $ECHO "*** Warning: Linking the shared library $output against the"
6068 $ECHO "*** static library $deplib is not portable!"
6069 deplibs="$deplib $deplibs"
6076 if test "$pass" != link; then
6077 deplibs="$deplib $deplibs"
6079 compile_deplibs="$deplib $compile_deplibs"
6080 finalize_deplibs="$deplib $finalize_deplibs"
6087 if test "$pass" = conv; then
6088 deplibs="$deplib $deplibs"
6089 elif test "$linkmode" = prog; then
6090 if test "$pass" = dlpreopen || test "$dlopen_support" != yes || test "$build_libtool_libs" = no; then
6091 # If there is no dlopen support or we're linking statically,
6092 # we need to preload.
6093 newdlprefiles="$newdlprefiles $deplib"
6094 compile_deplibs="$deplib $compile_deplibs"
6095 finalize_deplibs="$deplib $finalize_deplibs"
6097 newdlfiles="$newdlfiles $deplib"
6108 if test "$found" = yes || test -f "$lib"; then :
6110 func_fatal_error "cannot find the library \`$lib' or unhandled argument \`$deplib'"
6113 # Check to see that this really is a libtool archive.
6114 func_lalib_unsafe_p "$lib" \
6115 || func_fatal_error "\`$lib' is not a valid libtool archive"
6117 func_dirname "$lib" "" "."
6118 ladir="$func_dirname_result"
6126 inherited_linker_flags=
6127 # If the library was installed with an old release of libtool,
6128 # it will not redefine variables installed, or shouldnotlink
6137 # Convert "-framework foo" to "foo.ltframework"
6138 if test -n "$inherited_linker_flags"; then
6139 tmp_inherited_linker_flags=`$ECHO "$inherited_linker_flags" | $SED 's/-framework \([^ $]*\)/\1.ltframework/g'`
6140 for tmp_inherited_linker_flag in $tmp_inherited_linker_flags; do
6141 case " $new_inherited_linker_flags " in
6142 *" $tmp_inherited_linker_flag "*) ;;
6143 *) new_inherited_linker_flags="$new_inherited_linker_flags $tmp_inherited_linker_flag";;
6147 dependency_libs=`$ECHO " $dependency_libs" | $SED 's% \([^ $]*\).ltframework% -framework \1%g'`
6148 if test "$linkmode,$pass" = "lib,link" ||
6149 test "$linkmode,$pass" = "prog,scan" ||
6150 { test "$linkmode" != prog && test "$linkmode" != lib; }; then
6151 test -n "$dlopen" && dlfiles="$dlfiles $dlopen"
6152 test -n "$dlpreopen" && dlprefiles="$dlprefiles $dlpreopen"
6155 if test "$pass" = conv; then
6156 # Only check for convenience libraries
6157 deplibs="$lib $deplibs"
6158 if test -z "$libdir"; then
6159 if test -z "$old_library"; then
6160 func_fatal_error "cannot find name of link library for \`$lib'"
6162 # It is a libtool convenience library, so add in its objects.
6163 convenience="$convenience $ladir/$objdir/$old_library"
6164 old_convenience="$old_convenience $ladir/$objdir/$old_library"
6165 elif test "$linkmode" != prog && test "$linkmode" != lib; then
6166 func_fatal_error "\`$lib' is not a convenience library"
6169 for deplib in $dependency_libs; do
6170 deplibs="$deplib $deplibs"
6171 if $opt_duplicate_deps ; then
6172 case "$tmp_libs " in
6173 *" $deplib "*) specialdeplibs="$specialdeplibs $deplib" ;;
6176 tmp_libs="$tmp_libs $deplib"
6182 # Get the name of the library we link against.
6184 for l in $old_library $library_names; do
6187 if test -z "$linklib"; then
6188 func_fatal_error "cannot find name of link library for \`$lib'"
6191 # This library was specified with -dlopen.
6192 if test "$pass" = dlopen; then
6193 if test -z "$libdir"; then
6194 func_fatal_error "cannot -dlopen a convenience library: \`$lib'"
6196 if test -z "$dlname" ||
6197 test "$dlopen_support" != yes ||
6198 test "$build_libtool_libs" = no; then
6199 # If there is no dlname, no dlopen support or we're linking
6200 # statically, we need to preload. We also need to preload any
6201 # dependent libraries so libltdl's deplib preloader doesn't
6202 # bomb out in the load deplibs phase.
6203 dlprefiles="$dlprefiles $lib $dependency_libs"
6205 newdlfiles="$newdlfiles $lib"
6210 # We need an absolute path.
6212 [\\/]* | [A-Za-z]:[\\/]*) abs_ladir="$ladir" ;;
6214 abs_ladir=`cd "$ladir" && pwd`
6215 if test -z "$abs_ladir"; then
6216 func_warning "cannot determine absolute directory name of \`$ladir'"
6217 func_warning "passing it literally to the linker, although it might fail"
6222 func_basename "$lib"
6223 laname="$func_basename_result"
6225 # Find the relevant object directory and library name.
6226 if test "X$installed" = Xyes; then
6227 if test ! -f "$libdir/$linklib" && test -f "$abs_ladir/$linklib"; then
6228 func_warning "library \`$lib' was moved."
6236 test "X$hardcode_automatic" = Xyes && avoidtemprpath=yes
6238 if test ! -f "$ladir/$objdir/$linklib" && test -f "$abs_ladir/$linklib"; then
6241 # Remove this search path later
6242 notinst_path="$notinst_path $abs_ladir"
6244 dir="$ladir/$objdir"
6245 absdir="$abs_ladir/$objdir"
6246 # Remove this search path later
6247 notinst_path="$notinst_path $abs_ladir"
6249 fi # $installed = yes
6250 func_stripname 'lib' '.la' "$laname"
6251 name=$func_stripname_result
6253 # This library was specified with -dlpreopen.
6254 if test "$pass" = dlpreopen; then
6255 if test -z "$libdir" && test "$linkmode" = prog; then
6256 func_fatal_error "only libraries may -dlpreopen a convenience library: \`$lib'"
6258 # Prefer using a static library (so that no silly _DYNAMIC symbols
6259 # are required to link).
6260 if test -n "$old_library"; then
6261 newdlprefiles="$newdlprefiles $dir/$old_library"
6262 # Keep a list of preopened convenience libraries to check
6263 # that they are being used correctly in the link pass.
6264 test -z "$libdir" && \
6265 dlpreconveniencelibs="$dlpreconveniencelibs $dir/$old_library"
6266 # Otherwise, use the dlname, so that lt_dlopen finds it.
6267 elif test -n "$dlname"; then
6268 newdlprefiles="$newdlprefiles $dir/$dlname"
6270 newdlprefiles="$newdlprefiles $dir/$linklib"
6272 fi # $pass = dlpreopen
6274 if test -z "$libdir"; then
6275 # Link the convenience library
6276 if test "$linkmode" = lib; then
6277 deplibs="$dir/$old_library $deplibs"
6278 elif test "$linkmode,$pass" = "prog,link"; then
6279 compile_deplibs="$dir/$old_library $compile_deplibs"
6280 finalize_deplibs="$dir/$old_library $finalize_deplibs"
6282 deplibs="$lib $deplibs" # used for prog,scan pass
6288 if test "$linkmode" = prog && test "$pass" != link; then
6289 newlib_search_path="$newlib_search_path $ladir"
6290 deplibs="$lib $deplibs"
6293 if test "$link_all_deplibs" != no || test -z "$library_names" ||
6294 test "$build_libtool_libs" = no; then
6299 for deplib in $dependency_libs; do
6301 -L*) func_stripname '-L' '' "$deplib"
6302 newlib_search_path="$newlib_search_path $func_stripname_result"
6305 # Need to link against all dependency_libs?
6306 if test "$linkalldeplibs" = yes; then
6307 deplibs="$deplib $deplibs"
6309 # Need to hardcode shared library paths
6310 # or/and link against static libraries
6311 newdependency_libs="$deplib $newdependency_libs"
6313 if $opt_duplicate_deps ; then
6314 case "$tmp_libs " in
6315 *" $deplib "*) specialdeplibs="$specialdeplibs $deplib" ;;
6318 tmp_libs="$tmp_libs $deplib"
6321 fi # $linkmode = prog...
6323 if test "$linkmode,$pass" = "prog,link"; then
6324 if test -n "$library_names" &&
6325 { { test "$prefer_static_libs" = no ||
6326 test "$prefer_static_libs,$installed" = "built,yes"; } ||
6327 test -z "$old_library"; }; then
6328 # We need to hardcode the library path
6329 if test -n "$shlibpath_var" && test -z "$avoidtemprpath" ; then
6330 # Make sure the rpath contains only unique directories.
6331 case "$temp_rpath:" in
6333 *) temp_rpath="$temp_rpath$absdir:" ;;
6337 # Hardcode the library path.
6338 # Skip directories that are in the system default run-time
6340 case " $sys_lib_dlsearch_path " in
6343 case "$compile_rpath " in
6345 *) compile_rpath="$compile_rpath $absdir"
6349 case " $sys_lib_dlsearch_path " in
6352 case "$finalize_rpath " in
6354 *) finalize_rpath="$finalize_rpath $libdir"
6358 fi # $linkmode,$pass = prog,link...
6360 if test "$alldeplibs" = yes &&
6361 { test "$deplibs_check_method" = pass_all ||
6362 { test "$build_libtool_libs" = yes &&
6363 test -n "$library_names"; }; }; then
6364 # We only need to search for static libraries
6369 link_static=no # Whether the deplib will be linked statically
6370 use_static_libs=$prefer_static_libs
6371 if test "$use_static_libs" = built && test "$installed" = yes; then
6374 if test -n "$library_names" &&
6375 { test "$use_static_libs" = no || test -z "$old_library"; }; then
6377 *cygwin* | *mingw* | *cegcc*)
6378 # No point in relinking DLLs because paths are not encoded
6379 notinst_deplibs="$notinst_deplibs $lib"
6383 if test "$installed" = no; then
6384 notinst_deplibs="$notinst_deplibs $lib"
6389 # This is a shared library
6391 # Warn about portability, can't link against -module's on some
6392 # systems (darwin). Don't bleat about dlopened modules though!
6394 for dlpremoduletest in $dlprefiles; do
6395 if test "X$dlpremoduletest" = "X$lib"; then
6396 dlopenmodule="$dlpremoduletest"
6400 if test -z "$dlopenmodule" && test "$shouldnotlink" = yes && test "$pass" = link; then
6402 if test "$linkmode" = prog; then
6403 $ECHO "*** Warning: Linking the executable $output against the loadable module"
6405 $ECHO "*** Warning: Linking the shared library $output against the loadable module"
6407 $ECHO "*** $linklib is not portable!"
6409 if test "$linkmode" = lib &&
6410 test "$hardcode_into_libs" = yes; then
6411 # Hardcode the library path.
6412 # Skip directories that are in the system default run-time
6414 case " $sys_lib_dlsearch_path " in
6417 case "$compile_rpath " in
6419 *) compile_rpath="$compile_rpath $absdir"
6423 case " $sys_lib_dlsearch_path " in
6426 case "$finalize_rpath " in
6428 *) finalize_rpath="$finalize_rpath $libdir"
6434 if test -n "$old_archive_from_expsyms_cmds"; then
6435 # figure out the soname
6436 set dummy $library_names
6440 libname=`eval "\\$ECHO \"$libname_spec\""`
6441 # use dlname if we got it. it's perfectly good, no?
6442 if test -n "$dlname"; then
6444 elif test -n "$soname_spec"; then
6447 *cygwin* | mingw* | *cegcc*)
6448 func_arith $current - $age
6449 major=$func_arith_result
6453 eval soname=\"$soname_spec\"
6458 # Make a new name for the extract_expsyms_cmds to use
6460 func_basename "$soroot"
6461 soname="$func_basename_result"
6462 func_stripname 'lib' '.dll' "$soname"
6463 newlib=libimp-$func_stripname_result.a
6465 # If the library has no export list, then create one now
6466 if test -f "$output_objdir/$soname-def"; then :
6468 func_verbose "extracting exported symbol list from \`$soname'"
6469 func_execute_cmds "$extract_expsyms_cmds" 'exit $?'
6473 if test -f "$output_objdir/$newlib"; then :; else
6474 func_verbose "generating import library for \`$soname'"
6475 func_execute_cmds "$old_archive_from_expsyms_cmds" 'exit $?'
6477 # make sure the library variables are pointing to the new library
6480 fi # test -n "$old_archive_from_expsyms_cmds"
6482 if test "$linkmode" = prog || test "$mode" != relink; then
6487 case $hardcode_action in
6488 immediate | unsupported)
6489 if test "$hardcode_direct" = no; then
6492 *-*-sco3.2v5.0.[024]*) add_dir="-L$dir" ;;
6493 *-*-sysv4*uw2*) add_dir="-L$dir" ;;
6494 *-*-sysv5OpenUNIX* | *-*-sysv5UnixWare7.[01].[10]* | \
6495 *-*-unixware7*) add_dir="-L$dir" ;;
6497 # if the lib is a (non-dlopened) module then we can not
6498 # link against it, someone is ignoring the earlier warnings
6499 if /usr/bin/file -L $add 2> /dev/null |
6500 $GREP ": [^:]* bundle" >/dev/null ; then
6501 if test "X$dlopenmodule" != "X$lib"; then
6502 $ECHO "*** Warning: lib $linklib is a module, not a shared library"
6503 if test -z "$old_library" ; then
6505 echo "*** And there doesn't seem to be a static archive available"
6506 echo "*** The link will probably fail, sorry"
6508 add="$dir/$old_library"
6510 elif test -n "$old_library"; then
6511 add="$dir/$old_library"
6515 elif test "$hardcode_minus_L" = no; then
6517 *-*-sunos*) add_shlibpath="$dir" ;;
6521 elif test "$hardcode_shlibpath_var" = no; then
6522 add_shlibpath="$dir"
6529 if test "$hardcode_direct" = yes &&
6530 test "$hardcode_direct_absolute" = no; then
6532 elif test "$hardcode_minus_L" = yes; then
6534 # Try looking first in the location we're being installed to.
6535 if test -n "$inst_prefix_dir"; then
6538 add_dir="$add_dir -L$inst_prefix_dir$libdir"
6543 elif test "$hardcode_shlibpath_var" = yes; then
6544 add_shlibpath="$dir"
6553 if test "$lib_linked" != yes; then
6554 func_fatal_configuration "unsupported hardcode properties"
6557 if test -n "$add_shlibpath"; then
6558 case :$compile_shlibpath: in
6559 *":$add_shlibpath:"*) ;;
6560 *) compile_shlibpath="$compile_shlibpath$add_shlibpath:" ;;
6563 if test "$linkmode" = prog; then
6564 test -n "$add_dir" && compile_deplibs="$add_dir $compile_deplibs"
6565 test -n "$add" && compile_deplibs="$add $compile_deplibs"
6567 test -n "$add_dir" && deplibs="$add_dir $deplibs"
6568 test -n "$add" && deplibs="$add $deplibs"
6569 if test "$hardcode_direct" != yes &&
6570 test "$hardcode_minus_L" != yes &&
6571 test "$hardcode_shlibpath_var" = yes; then
6572 case :$finalize_shlibpath: in
6574 *) finalize_shlibpath="$finalize_shlibpath$libdir:" ;;
6580 if test "$linkmode" = prog || test "$mode" = relink; then
6584 # Finalize command for both is simple: just hardcode it.
6585 if test "$hardcode_direct" = yes &&
6586 test "$hardcode_direct_absolute" = no; then
6587 add="$libdir/$linklib"
6588 elif test "$hardcode_minus_L" = yes; then
6591 elif test "$hardcode_shlibpath_var" = yes; then
6592 case :$finalize_shlibpath: in
6594 *) finalize_shlibpath="$finalize_shlibpath$libdir:" ;;
6597 elif test "$hardcode_automatic" = yes; then
6598 if test -n "$inst_prefix_dir" &&
6599 test -f "$inst_prefix_dir$libdir/$linklib" ; then
6600 add="$inst_prefix_dir$libdir/$linklib"
6602 add="$libdir/$linklib"
6605 # We cannot seem to hardcode it, guess we'll fake it.
6607 # Try looking first in the location we're being installed to.
6608 if test -n "$inst_prefix_dir"; then
6611 add_dir="$add_dir -L$inst_prefix_dir$libdir"
6618 if test "$linkmode" = prog; then
6619 test -n "$add_dir" && finalize_deplibs="$add_dir $finalize_deplibs"
6620 test -n "$add" && finalize_deplibs="$add $finalize_deplibs"
6622 test -n "$add_dir" && deplibs="$add_dir $deplibs"
6623 test -n "$add" && deplibs="$add $deplibs"
6626 elif test "$linkmode" = prog; then
6627 # Here we assume that one of hardcode_direct or hardcode_minus_L
6628 # is not unsupported. This is valid on all known static and
6630 if test "$hardcode_direct" != unsupported; then
6631 test -n "$old_library" && linklib="$old_library"
6632 compile_deplibs="$dir/$linklib $compile_deplibs"
6633 finalize_deplibs="$dir/$linklib $finalize_deplibs"
6635 compile_deplibs="-l$name -L$dir $compile_deplibs"
6636 finalize_deplibs="-l$name -L$dir $finalize_deplibs"
6638 elif test "$build_libtool_libs" = yes; then
6639 # Not a shared library
6640 if test "$deplibs_check_method" != pass_all; then
6641 # We're trying link a shared library against a static one
6642 # but the system doesn't support it.
6644 # Just print a warning and add the library to dependency_libs so
6645 # that the program can be linked against the static library.
6647 $ECHO "*** Warning: This system can not link to static lib archive $lib."
6648 echo "*** I have the capability to make that library automatically link in when"
6649 echo "*** you link to this library. But I can only do this if you have a"
6650 echo "*** shared version of the library, which you do not appear to have."
6651 if test "$module" = yes; then
6652 echo "*** But as you try to build a module library, libtool will still create "
6653 echo "*** a static module, that should work as long as the dlopening application"
6654 echo "*** is linked with the -dlopen flag to resolve symbols at runtime."
6655 if test -z "$global_symbol_pipe"; then
6657 echo "*** However, this would only work if libtool was able to extract symbol"
6658 echo "*** lists from a program, using \`nm' or equivalent, but libtool could"
6659 echo "*** not find such a program. So, this module is probably useless."
6660 echo "*** \`nm' from GNU binutils and a full rebuild may help."
6662 if test "$build_old_libs" = no; then
6663 build_libtool_libs=module
6666 build_libtool_libs=no
6670 deplibs="$dir/$old_library $deplibs"
6673 fi # link shared/static library?
6675 if test "$linkmode" = lib; then
6676 if test -n "$dependency_libs" &&
6677 { test "$hardcode_into_libs" != yes ||
6678 test "$build_old_libs" = yes ||
6679 test "$link_static" = yes; }; then
6680 # Extract -R from dependency_libs
6682 for libdir in $dependency_libs; do
6684 -R*) func_stripname '-R' '' "$libdir"
6685 temp_xrpath=$func_stripname_result
6687 *" $temp_xrpath "*) ;;
6688 *) xrpath="$xrpath $temp_xrpath";;
6690 *) temp_deplibs="$temp_deplibs $libdir";;
6693 dependency_libs="$temp_deplibs"
6696 newlib_search_path="$newlib_search_path $absdir"
6697 # Link against this library
6698 test "$link_static" = no && newdependency_libs="$abs_ladir/$laname $newdependency_libs"
6699 # ... and its dependency_libs
6701 for deplib in $dependency_libs; do
6702 newdependency_libs="$deplib $newdependency_libs"
6703 if $opt_duplicate_deps ; then
6704 case "$tmp_libs " in
6705 *" $deplib "*) specialdeplibs="$specialdeplibs $deplib" ;;
6708 tmp_libs="$tmp_libs $deplib"
6711 if test "$link_all_deplibs" != no; then
6712 # Add the search paths of all dependency libraries
6713 for deplib in $dependency_libs; do
6716 -L*) path="$deplib" ;;
6718 func_dirname "$deplib" "" "."
6719 dir="$func_dirname_result"
6720 # We need an absolute path.
6722 [\\/]* | [A-Za-z]:[\\/]*) absdir="$dir" ;;
6724 absdir=`cd "$dir" && pwd`
6725 if test -z "$absdir"; then
6726 func_warning "cannot determine absolute directory name of \`$dir'"
6731 if $GREP "^installed=no" $deplib > /dev/null; then
6735 eval deplibrary_names=`${SED} -n -e 's/^library_names=\(.*\)$/\1/p' $deplib`
6736 if test -n "$deplibrary_names" ; then
6737 for tmp in $deplibrary_names ; do
6740 if test -f "$absdir/$objdir/$depdepl" ; then
6741 depdepl="$absdir/$objdir/$depdepl"
6742 darwin_install_name=`${OTOOL} -L $depdepl | awk '{if (NR == 2) {print $1;exit}}'`
6743 if test -z "$darwin_install_name"; then
6744 darwin_install_name=`${OTOOL64} -L $depdepl | awk '{if (NR == 2) {print $1;exit}}'`
6746 compiler_flags="$compiler_flags ${wl}-dylib_file ${wl}${darwin_install_name}:${depdepl}"
6747 linker_flags="$linker_flags -dylib_file ${darwin_install_name}:${depdepl}"
6753 path="-L$absdir/$objdir"
6757 eval libdir=`${SED} -n -e 's/^libdir=\(.*\)$/\1/p' $deplib`
6758 test -z "$libdir" && \
6759 func_fatal_error "\`$deplib' is not a valid libtool archive"
6760 test "$absdir" != "$libdir" && \
6761 func_warning "\`$deplib' seems to be moved"
6767 case " $deplibs " in
6769 *) deplibs="$path $deplibs" ;;
6772 fi # link_all_deplibs != no
6774 done # for deplib in $libs
6775 if test "$pass" = link; then
6776 if test "$linkmode" = "prog"; then
6777 compile_deplibs="$new_inherited_linker_flags $compile_deplibs"
6778 finalize_deplibs="$new_inherited_linker_flags $finalize_deplibs"
6780 compiler_flags="$compiler_flags "`$ECHO " $new_inherited_linker_flags" | $SED 's% \([^ $]*\).ltframework% -framework \1%g'`
6783 dependency_libs="$newdependency_libs"
6784 if test "$pass" = dlpreopen; then
6785 # Link the dlpreopened libraries before other libraries
6786 for deplib in $save_deplibs; do
6787 deplibs="$deplib $deplibs"
6790 if test "$pass" != dlopen; then
6791 if test "$pass" != conv; then
6792 # Make sure lib_search_path contains only unique directories.
6794 for dir in $newlib_search_path; do
6795 case "$lib_search_path " in
6797 *) lib_search_path="$lib_search_path $dir" ;;
6803 if test "$linkmode,$pass" != "prog,link"; then
6806 vars="compile_deplibs finalize_deplibs"
6808 for var in $vars dependency_libs; do
6809 # Add libraries to $var in reverse order
6810 eval tmp_libs=\"\$$var\"
6812 for deplib in $tmp_libs; do
6813 # FIXME: Pedantically, this is the right thing to do, so
6814 # that some nasty dependency loop isn't accidentally
6816 #new_libs="$deplib $new_libs"
6817 # Pragmatically, this seems to cause very few problems in
6820 -L*) new_libs="$deplib $new_libs" ;;
6823 # And here is the reason: when a library appears more
6824 # than once as an explicit dependence of a library, or
6825 # is implicitly linked in more than once by the
6826 # compiler, it is considered special, and multiple
6827 # occurrences thereof are not removed. Compare this
6828 # with having the same library being listed as a
6829 # dependency of multiple other libraries: in this case,
6830 # we know (pedantically, we assume) the library does not
6831 # need to be listed more than once, so we keep only the
6832 # last copy. This is not always right, but it is rare
6833 # enough that we require users that really mean to play
6834 # such unportable linking tricks to link the library
6835 # using -Wl,-lname, so that libtool does not consider it
6836 # for duplicate removal.
6837 case " $specialdeplibs " in
6838 *" $deplib "*) new_libs="$deplib $new_libs" ;;
6840 case " $new_libs " in
6842 *) new_libs="$deplib $new_libs" ;;
6850 for deplib in $new_libs; do
6853 case " $tmp_libs " in
6855 *) tmp_libs="$tmp_libs $deplib" ;;
6858 *) tmp_libs="$tmp_libs $deplib" ;;
6861 eval $var=\"$tmp_libs\"
6864 # Last step: remove runtime libs from dependency_libs
6865 # (they stay in deplibs)
6867 for i in $dependency_libs ; do
6868 case " $predeps $postdeps $compiler_lib_search_path " in
6873 if test -n "$i" ; then
6874 tmp_libs="$tmp_libs $i"
6877 dependency_libs=$tmp_libs
6879 if test "$linkmode" = prog; then
6880 dlfiles="$newdlfiles"
6882 if test "$linkmode" = prog || test "$linkmode" = lib; then
6883 dlprefiles="$newdlprefiles"
6888 if test -n "$dlfiles$dlprefiles" || test "$dlself" != no; then
6889 func_warning "\`-dlopen' is ignored for archives"
6894 func_warning "\`-l' and \`-L' are ignored for archives" ;;
6897 test -n "$rpath" && \
6898 func_warning "\`-rpath' is ignored for archives"
6900 test -n "$xrpath" && \
6901 func_warning "\`-R' is ignored for archives"
6903 test -n "$vinfo" && \
6904 func_warning "\`-version-info/-version-number' is ignored for archives"
6906 test -n "$release" && \
6907 func_warning "\`-release' is ignored for archives"
6909 test -n "$export_symbols$export_symbols_regex" && \
6910 func_warning "\`-export-symbols' is ignored for archives"
6912 # Now set the variables for building old libraries.
6913 build_libtool_libs=no
6915 objs="$objs$old_deplibs"
6919 # Make sure we only generate libraries of the form `libNAME.la'.
6922 func_stripname 'lib' '.la' "$outputname"
6923 name=$func_stripname_result
6924 eval shared_ext=\"$shrext_cmds\"
6925 eval libname=\"$libname_spec\"
6928 test "$module" = no && \
6929 func_fatal_help "libtool library \`$output' must begin with \`lib'"
6931 if test "$need_lib_prefix" != no; then
6932 # Add the "lib" prefix for modules if required
6933 func_stripname '' '.la' "$outputname"
6934 name=$func_stripname_result
6935 eval shared_ext=\"$shrext_cmds\"
6936 eval libname=\"$libname_spec\"
6938 func_stripname '' '.la' "$outputname"
6939 libname=$func_stripname_result
6944 if test -n "$objs"; then
6945 if test "$deplibs_check_method" != pass_all; then
6946 func_fatal_error "cannot build libtool library \`$output' from non-libtool objects on this host:$objs"
6949 $ECHO "*** Warning: Linking the shared library $output against the non-libtool"
6950 $ECHO "*** objects $objs is not portable!"
6951 libobjs="$libobjs $objs"
6955 test "$dlself" != no && \
6956 func_warning "\`-dlopen self' is ignored for libtool libraries"
6960 test "$#" -gt 1 && \
6961 func_warning "ignoring multiple \`-rpath's for a libtool library"
6966 if test -z "$rpath"; then
6967 if test "$build_libtool_libs" = yes; then
6968 # Building a libtool convenience library.
6969 # Some compilers have problems with a `.al' extension so
6970 # convenience libraries should have the same extension an
6971 # archive normally would.
6972 oldlibs="$output_objdir/$libname.$libext $oldlibs"
6973 build_libtool_libs=convenience
6977 test -n "$vinfo" && \
6978 func_warning "\`-version-info/-version-number' is ignored for convenience libraries"
6980 test -n "$release" && \
6981 func_warning "\`-release' is ignored for convenience libraries"
6984 # Parse the version information argument.
6985 save_ifs="$IFS"; IFS=':'
6986 set dummy $vinfo 0 0 0
6991 func_fatal_help "too many parameters to \`-version-info'"
6993 # convert absolute version numbers to libtool ages
6994 # this retains compatibility with .la files and attempts
6995 # to make the code below a bit more comprehensible
6997 case $vinfo_number in
7001 number_revision="$3"
7003 # There are really only two kinds -- those that
7004 # use the current revision as the major version
7005 # and those that subtract age and use age as
7006 # a minor version. But, then there is irix
7007 # which has an extra 1 added just for fun
7009 case $version_type in
7010 darwin|linux|osf|windows|none)
7011 func_arith $number_major + $number_minor
7012 current=$func_arith_result
7014 revision="$number_revision"
7016 freebsd-aout|freebsd-elf|qnx|sunos)
7017 current="$number_major"
7018 revision="$number_minor"
7022 func_arith $number_major + $number_minor
7023 current=$func_arith_result
7025 revision="$number_minor"
7026 lt_irix_increment=no
7037 # Check that each of the things are valid numbers.
7039 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]) ;;
7041 func_error "CURRENT \`$current' must be a nonnegative integer"
7042 func_fatal_error "\`$vinfo' is not valid version information"
7047 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]) ;;
7049 func_error "REVISION \`$revision' must be a nonnegative integer"
7050 func_fatal_error "\`$vinfo' is not valid version information"
7055 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]) ;;
7057 func_error "AGE \`$age' must be a nonnegative integer"
7058 func_fatal_error "\`$vinfo' is not valid version information"
7062 if test "$age" -gt "$current"; then
7063 func_error "AGE \`$age' is greater than the current interface number \`$current'"
7064 func_fatal_error "\`$vinfo' is not valid version information"
7067 # Calculate the version variables.
7071 case $version_type in
7075 # Like Linux, but with the current version available in
7076 # verstring for coding it into the library header
7077 func_arith $current - $age
7078 major=.$func_arith_result
7079 versuffix="$major.$age.$revision"
7080 # Darwin ld doesn't like 0 for these options...
7081 func_arith $current + 1
7082 minor_current=$func_arith_result
7083 xlcverstring="${wl}-compatibility_version ${wl}$minor_current ${wl}-current_version ${wl}$minor_current.$revision"
7084 verstring="-compatibility_version $minor_current -current_version $minor_current.$revision"
7089 versuffix=".$current.$revision";
7094 versuffix=".$current"
7098 if test "X$lt_irix_increment" = "Xno"; then
7099 func_arith $current - $age
7101 func_arith $current - $age + 1
7103 major=$func_arith_result
7105 case $version_type in
7106 nonstopux) verstring_prefix=nonstopux ;;
7107 *) verstring_prefix=sgi ;;
7109 verstring="$verstring_prefix$major.$revision"
7111 # Add in all the interfaces that we are compatible with.
7113 while test "$loop" -ne 0; do
7114 func_arith $revision - $loop
7115 iface=$func_arith_result
7116 func_arith $loop - 1
7117 loop=$func_arith_result
7118 verstring="$verstring_prefix$major.$iface:$verstring"
7121 # Before this point, $major must not contain `.'.
7123 versuffix="$major.$revision"
7127 func_arith $current - $age
7128 major=.$func_arith_result
7129 versuffix="$major.$age.$revision"
7133 func_arith $current - $age
7134 major=.$func_arith_result
7135 versuffix=".$current.$age.$revision"
7136 verstring="$current.$age.$revision"
7138 # Add in all the interfaces that we are compatible with.
7140 while test "$loop" -ne 0; do
7141 func_arith $current - $loop
7142 iface=$func_arith_result
7143 func_arith $loop - 1
7144 loop=$func_arith_result
7145 verstring="$verstring:${iface}.0"
7148 # Make executables depend on our current version.
7149 verstring="$verstring:${current}.0"
7154 versuffix=".$current"
7159 versuffix=".$current.$revision"
7163 # Use '-' rather than '.', since we only want one
7164 # extension on DOS 8.3 filesystems.
7165 func_arith $current - $age
7166 major=$func_arith_result
7171 func_fatal_configuration "unknown library version type \`$version_type'"
7175 # Clear the version info if we defaulted, and they specified a release.
7176 if test -z "$vinfo" && test -n "$release"; then
7178 case $version_type in
7180 # we can't check for "0.0" in archive_cmds due to quoting
7181 # problems, so we reset it completely
7188 if test "$need_version" = no; then
7195 # Remove version info from name if versioning should be avoided
7196 if test "$avoid_version" = yes && test "$need_version" = no; then
7202 # Check to see if the archive will have undefined symbols.
7203 if test "$allow_undefined" = yes; then
7204 if test "$allow_undefined_flag" = unsupported; then
7205 func_warning "undefined symbols not allowed in $host shared libraries"
7206 build_libtool_libs=no
7210 # Don't allow undefined symbols.
7211 allow_undefined_flag="$no_undefined_flag"
7216 func_generate_dlsyms "$libname" "$libname" "yes"
7217 libobjs="$libobjs $symfileobj"
7218 test "X$libobjs" = "X " && libobjs=
7220 if test "$mode" != relink; then
7221 # Remove our outputs, but don't remove object files since they
7222 # may have been created when compiling PIC objects.
7224 tempremovelist=`$ECHO "$output_objdir/*"`
7225 for p in $tempremovelist; do
7229 $output_objdir/$outputname | $output_objdir/$libname.* | $output_objdir/${libname}${release}.*)
7230 if test "X$precious_files_regex" != "X"; then
7231 if $ECHO "$p" | $EGREP -e "$precious_files_regex" >/dev/null 2>&1
7236 removelist="$removelist $p"
7241 test -n "$removelist" && \
7242 func_show_eval "${RM}r \$removelist"
7245 # Now set the variables for building old libraries.
7246 if test "$build_old_libs" = yes && test "$build_libtool_libs" != convenience ; then
7247 oldlibs="$oldlibs $output_objdir/$libname.$libext"
7249 # Transform .lo files to .o files.
7250 oldobjs="$objs "`$ECHO "$libobjs" | $SP2NL | $SED "/\.${libext}$/d; $lo2o" | $NL2SP`
7253 # Eliminate all temporary directories.
7254 #for path in $notinst_path; do
7255 # lib_search_path=`$ECHO "$lib_search_path " | $SED "s% $path % %g"`
7256 # deplibs=`$ECHO "$deplibs " | $SED "s% -L$path % %g"`
7257 # dependency_libs=`$ECHO "$dependency_libs " | $SED "s% -L$path % %g"`
7260 if test -n "$xrpath"; then
7261 # If the user specified any rpath flags, then add them.
7263 for libdir in $xrpath; do
7264 temp_xrpath="$temp_xrpath -R$libdir"
7265 case "$finalize_rpath " in
7267 *) finalize_rpath="$finalize_rpath $libdir" ;;
7270 if test "$hardcode_into_libs" != yes || test "$build_old_libs" = yes; then
7271 dependency_libs="$temp_xrpath $dependency_libs"
7275 # Make sure dlfiles contains only unique files that won't be dlpreopened
7276 old_dlfiles="$dlfiles"
7278 for lib in $old_dlfiles; do
7279 case " $dlprefiles $dlfiles " in
7281 *) dlfiles="$dlfiles $lib" ;;
7285 # Make sure dlprefiles contains only unique files
7286 old_dlprefiles="$dlprefiles"
7288 for lib in $old_dlprefiles; do
7289 case "$dlprefiles " in
7291 *) dlprefiles="$dlprefiles $lib" ;;
7295 if test "$build_libtool_libs" = yes; then
7296 if test -n "$rpath"; then
7298 *-*-cygwin* | *-*-mingw* | *-*-pw32* | *-*-os2* | *-*-beos* | *-cegcc* | *-*-haiku*)
7299 # these systems don't actually have a c library (as such)!
7301 *-*-rhapsody* | *-*-darwin1.[012])
7302 # Rhapsody C library is in the System framework
7303 deplibs="$deplibs System.ltframework"
7306 # Don't link with libc until the a.out ld.so is fixed.
7308 *-*-openbsd* | *-*-freebsd* | *-*-dragonfly*)
7309 # Do not include libc due to us having libc/libc_r.
7311 *-*-sco3.2v5* | *-*-sco5v6*)
7312 # Causes problems with __ctype
7314 *-*-sysv4.2uw2* | *-*-sysv5* | *-*-unixware* | *-*-OpenUNIX*)
7315 # Compiler inserts libc in the correct place for threads to work
7318 # Add libc to deplibs on all other systems if necessary.
7319 if test "$build_libtool_need_lc" = "yes"; then
7320 deplibs="$deplibs -lc"
7326 # Transform deplibs into only deplibs that can be linked in shared.
7328 libname_save=$libname
7329 release_save=$release
7330 versuffix_save=$versuffix
7332 # I'm not sure if I'm treating the release correctly. I think
7333 # release should show up in the -l (ie -lgmp5) so we don't want to
7334 # add it in twice. Is that correct?
7340 case $deplibs_check_method in
7342 # Don't check for shared/static. Everything works.
7343 # This might be a little naive. We might want to check
7344 # whether the library exists or not. But this is on
7345 # osf3 & osf4 and I'm not really sure... Just
7346 # implementing what was already the behavior.
7350 # This code stresses the "libraries are programs" paradigm to its
7351 # limits. Maybe even breaks it. We compile a program, linking it
7352 # against the deplibs as a proxy for the library. Then we can check
7353 # whether they linked in statically or dynamically with ldd.
7354 $opt_dry_run || $RM conftest.c
7355 cat > conftest.c <<EOF
7356 int main() { return 0; }
7358 $opt_dry_run || $RM conftest
7359 if $LTCC $LTCFLAGS -o conftest conftest.c $deplibs; then
7360 ldd_output=`ldd conftest`
7361 for i in $deplibs; do
7364 func_stripname -l '' "$i"
7365 name=$func_stripname_result
7366 if test "X$allow_libtool_libs_with_static_runtimes" = "Xyes" ; then
7367 case " $predeps $postdeps " in
7369 newdeplibs="$newdeplibs $i"
7374 if test -n "$i" ; then
7375 libname=`eval "\\$ECHO \"$libname_spec\""`
7376 deplib_matches=`eval "\\$ECHO \"$library_names_spec\""`
7377 set dummy $deplib_matches; shift
7379 if test `expr "$ldd_output" : ".*$deplib_match"` -ne 0 ; then
7380 newdeplibs="$newdeplibs $i"
7384 $ECHO "*** Warning: dynamic linker does not accept needed library $i."
7385 echo "*** I have the capability to make that library automatically link in when"
7386 echo "*** you link to this library. But I can only do this if you have a"
7387 echo "*** shared version of the library, which I believe you do not have"
7388 echo "*** because a test_compile did reveal that the linker did not use it for"
7389 echo "*** its dynamic dependency list that programs get resolved with at runtime."
7394 newdeplibs="$newdeplibs $i"
7399 # Error occurred in the first compile. Let's try to salvage
7400 # the situation: Compile a separate program for each library.
7401 for i in $deplibs; do
7404 func_stripname -l '' "$i"
7405 name=$func_stripname_result
7406 $opt_dry_run || $RM conftest
7407 if $LTCC $LTCFLAGS -o conftest conftest.c $i; then
7408 ldd_output=`ldd conftest`
7409 if test "X$allow_libtool_libs_with_static_runtimes" = "Xyes" ; then
7410 case " $predeps $postdeps " in
7412 newdeplibs="$newdeplibs $i"
7417 if test -n "$i" ; then
7418 libname=`eval "\\$ECHO \"$libname_spec\""`
7419 deplib_matches=`eval "\\$ECHO \"$library_names_spec\""`
7420 set dummy $deplib_matches; shift
7422 if test `expr "$ldd_output" : ".*$deplib_match"` -ne 0 ; then
7423 newdeplibs="$newdeplibs $i"
7427 $ECHO "*** Warning: dynamic linker does not accept needed library $i."
7428 echo "*** I have the capability to make that library automatically link in when"
7429 echo "*** you link to this library. But I can only do this if you have a"
7430 echo "*** shared version of the library, which you do not appear to have"
7431 echo "*** because a test_compile did reveal that the linker did not use this one"
7432 echo "*** as a dynamic dependency that programs can get resolved with at runtime."
7438 $ECHO "*** Warning! Library $i is needed by this library but I was not able to"
7439 echo "*** make it link in! You will probably need to install it or some"
7440 echo "*** library that it depends on before this library will be fully"
7441 echo "*** functional. Installing it before continuing would be even better."
7445 newdeplibs="$newdeplibs $i"
7452 set dummy $deplibs_check_method; shift
7453 file_magic_regex=`expr "$deplibs_check_method" : "$1 \(.*\)"`
7454 for a_deplib in $deplibs; do
7457 func_stripname -l '' "$a_deplib"
7458 name=$func_stripname_result
7459 if test "X$allow_libtool_libs_with_static_runtimes" = "Xyes" ; then
7460 case " $predeps $postdeps " in
7462 newdeplibs="$newdeplibs $a_deplib"
7467 if test -n "$a_deplib" ; then
7468 libname=`eval "\\$ECHO \"$libname_spec\""`
7469 for i in $lib_search_path $sys_lib_search_path $shlib_search_path; do
7470 potential_libs=`ls $i/$libname[.-]* 2>/dev/null`
7471 for potent_lib in $potential_libs; do
7472 # Follow soft links.
7473 if ls -lLd "$potent_lib" 2>/dev/null |
7474 $GREP " -> " >/dev/null; then
7477 # The statement above tries to avoid entering an
7478 # endless loop below, in case of cyclic links.
7479 # We might still enter an endless loop, since a link
7480 # loop can be closed while we follow links,
7482 potlib="$potent_lib"
7483 while test -h "$potlib" 2>/dev/null; do
7484 potliblink=`ls -ld $potlib | ${SED} 's/.* -> //'`
7486 [\\/]* | [A-Za-z]:[\\/]*) potlib="$potliblink";;
7487 *) potlib=`$ECHO "$potlib" | $SED 's,[^/]*$,,'`"$potliblink";;
7490 if eval $file_magic_cmd \"\$potlib\" 2>/dev/null |
7492 $EGREP "$file_magic_regex" > /dev/null; then
7493 newdeplibs="$newdeplibs $a_deplib"
7500 if test -n "$a_deplib" ; then
7503 $ECHO "*** Warning: linker path does not have real file for library $a_deplib."
7504 echo "*** I have the capability to make that library automatically link in when"
7505 echo "*** you link to this library. But I can only do this if you have a"
7506 echo "*** shared version of the library, which you do not appear to have"
7507 echo "*** because I did check the linker path looking for a file starting"
7508 if test -z "$potlib" ; then
7509 $ECHO "*** with $libname but no candidates were found. (...for file magic test)"
7511 $ECHO "*** with $libname and none of the candidates passed a file format test"
7512 $ECHO "*** using a file magic. Last file checked: $potlib"
7517 # Add a -L argument.
7518 newdeplibs="$newdeplibs $a_deplib"
7521 done # Gone through all deplibs.
7524 set dummy $deplibs_check_method; shift
7525 match_pattern_regex=`expr "$deplibs_check_method" : "$1 \(.*\)"`
7526 for a_deplib in $deplibs; do
7529 func_stripname -l '' "$a_deplib"
7530 name=$func_stripname_result
7531 if test "X$allow_libtool_libs_with_static_runtimes" = "Xyes" ; then
7532 case " $predeps $postdeps " in
7534 newdeplibs="$newdeplibs $a_deplib"
7539 if test -n "$a_deplib" ; then
7540 libname=`eval "\\$ECHO \"$libname_spec\""`
7541 for i in $lib_search_path $sys_lib_search_path $shlib_search_path; do
7542 potential_libs=`ls $i/$libname[.-]* 2>/dev/null`
7543 for potent_lib in $potential_libs; do
7544 potlib="$potent_lib" # see symlink-check above in file_magic test
7545 if eval "\$ECHO \"$potent_lib\"" 2>/dev/null | $SED 10q | \
7546 $EGREP "$match_pattern_regex" > /dev/null; then
7547 newdeplibs="$newdeplibs $a_deplib"
7554 if test -n "$a_deplib" ; then
7557 $ECHO "*** Warning: linker path does not have real file for library $a_deplib."
7558 echo "*** I have the capability to make that library automatically link in when"
7559 echo "*** you link to this library. But I can only do this if you have a"
7560 echo "*** shared version of the library, which you do not appear to have"
7561 echo "*** because I did check the linker path looking for a file starting"
7562 if test -z "$potlib" ; then
7563 $ECHO "*** with $libname but no candidates were found. (...for regex pattern test)"
7565 $ECHO "*** with $libname and none of the candidates passed a file format test"
7566 $ECHO "*** using a regex pattern. Last file checked: $potlib"
7571 # Add a -L argument.
7572 newdeplibs="$newdeplibs $a_deplib"
7575 done # Gone through all deplibs.
7579 tmp_deplibs=`$ECHO " $deplibs" | $SED 's/ -lc$//; s/ -[LR][^ ]*//g'`
7580 if test "X$allow_libtool_libs_with_static_runtimes" = "Xyes" ; then
7581 for i in $predeps $postdeps ; do
7582 # can't use Xsed below, because $i might contain '/'
7583 tmp_deplibs=`$ECHO " $tmp_deplibs" | $SED "s,$i,,"`
7586 case $tmp_deplibs in
7589 if test "X$deplibs_check_method" = "Xnone"; then
7590 echo "*** Warning: inter-library dependencies are not supported in this platform."
7592 echo "*** Warning: inter-library dependencies are not known to be supported."
7594 echo "*** All declared inter-library dependencies are being dropped."
7600 versuffix=$versuffix_save
7602 release=$release_save
7603 libname=$libname_save
7607 *-*-rhapsody* | *-*-darwin1.[012])
7608 # On Rhapsody replace the C library with the System framework
7609 newdeplibs=`$ECHO " $newdeplibs" | $SED 's/ -lc / System.ltframework /'`
7613 if test "$droppeddeps" = yes; then
7614 if test "$module" = yes; then
7616 echo "*** Warning: libtool could not satisfy all declared inter-library"
7617 $ECHO "*** dependencies of module $libname. Therefore, libtool will create"
7618 echo "*** a static module, that should work as long as the dlopening"
7619 echo "*** application is linked with the -dlopen flag."
7620 if test -z "$global_symbol_pipe"; then
7622 echo "*** However, this would only work if libtool was able to extract symbol"
7623 echo "*** lists from a program, using \`nm' or equivalent, but libtool could"
7624 echo "*** not find such a program. So, this module is probably useless."
7625 echo "*** \`nm' from GNU binutils and a full rebuild may help."
7627 if test "$build_old_libs" = no; then
7628 oldlibs="$output_objdir/$libname.$libext"
7629 build_libtool_libs=module
7632 build_libtool_libs=no
7635 echo "*** The inter-library dependencies that have been dropped here will be"
7636 echo "*** automatically added whenever a program is linked with this library"
7637 echo "*** or is declared to -dlopen it."
7639 if test "$allow_undefined" = no; then
7641 echo "*** Since this library must not contain undefined symbols,"
7642 echo "*** because either the platform does not support them or"
7643 echo "*** it was explicitly requested with -no-undefined,"
7644 echo "*** libtool will only create a static version of it."
7645 if test "$build_old_libs" = no; then
7646 oldlibs="$output_objdir/$libname.$libext"
7647 build_libtool_libs=module
7650 build_libtool_libs=no
7655 # Done checking deplibs!
7658 # Time to change all our "foo.ltframework" stuff back to "-framework foo"
7661 newdeplibs=`$ECHO " $newdeplibs" | $SED 's% \([^ $]*\).ltframework% -framework \1%g'`
7662 new_inherited_linker_flags=`$ECHO " $new_inherited_linker_flags" | $SED 's% \([^ $]*\).ltframework% -framework \1%g'`
7663 deplibs=`$ECHO " $deplibs" | $SED 's% \([^ $]*\).ltframework% -framework \1%g'`
7667 # move library search paths that coincide with paths to not yet
7668 # installed libraries to the beginning of the library search list
7670 for path in $notinst_path; do
7671 case " $new_libs " in
7672 *" -L$path/$objdir "*) ;;
7674 case " $deplibs " in
7675 *" -L$path/$objdir "*)
7676 new_libs="$new_libs -L$path/$objdir" ;;
7681 for deplib in $deplibs; do
7684 case " $new_libs " in
7686 *) new_libs="$new_libs $deplib" ;;
7689 *) new_libs="$new_libs $deplib" ;;
7694 # All the library-specific variables (install_libdir is set above).
7699 # Test again, we may have decided not to build it any more
7700 if test "$build_libtool_libs" = yes; then
7701 if test "$hardcode_into_libs" = yes; then
7702 # Hardcode the library paths
7705 rpath="$finalize_rpath"
7706 test "$mode" != relink && rpath="$compile_rpath$rpath"
7707 for libdir in $rpath; do
7708 if test -n "$hardcode_libdir_flag_spec"; then
7709 if test -n "$hardcode_libdir_separator"; then
7710 if test -z "$hardcode_libdirs"; then
7711 hardcode_libdirs="$libdir"
7713 # Just accumulate the unique libdirs.
7714 case $hardcode_libdir_separator$hardcode_libdirs$hardcode_libdir_separator in
7715 *"$hardcode_libdir_separator$libdir$hardcode_libdir_separator"*)
7718 hardcode_libdirs="$hardcode_libdirs$hardcode_libdir_separator$libdir"
7723 eval flag=\"$hardcode_libdir_flag_spec\"
7724 dep_rpath="$dep_rpath $flag"
7726 elif test -n "$runpath_var"; then
7727 case "$perm_rpath " in
7729 *) perm_rpath="$perm_rpath $libdir" ;;
7733 # Substitute the hardcoded libdirs into the rpath.
7734 if test -n "$hardcode_libdir_separator" &&
7735 test -n "$hardcode_libdirs"; then
7736 libdir="$hardcode_libdirs"
7737 if test -n "$hardcode_libdir_flag_spec_ld"; then
7738 eval dep_rpath=\"$hardcode_libdir_flag_spec_ld\"
7740 eval dep_rpath=\"$hardcode_libdir_flag_spec\"
7743 if test -n "$runpath_var" && test -n "$perm_rpath"; then
7744 # We should set the runpath_var.
7746 for dir in $perm_rpath; do
7749 eval "$runpath_var='$rpath\$$runpath_var'; export $runpath_var"
7751 test -n "$dep_rpath" && deplibs="$dep_rpath $deplibs"
7754 shlibpath="$finalize_shlibpath"
7755 test "$mode" != relink && shlibpath="$compile_shlibpath$shlibpath"
7756 if test -n "$shlibpath"; then
7757 eval "$shlibpath_var='$shlibpath\$$shlibpath_var'; export $shlibpath_var"
7760 # Get the real and link names of the library.
7761 eval shared_ext=\"$shrext_cmds\"
7762 eval library_names=\"$library_names_spec\"
7763 set dummy $library_names
7768 if test -n "$soname_spec"; then
7769 eval soname=\"$soname_spec\"
7773 if test -z "$dlname"; then
7777 lib="$output_objdir/$realname"
7781 linknames="$linknames $link"
7784 # Use standard objects if they are pic
7785 test -z "$pic_flag" && libobjs=`$ECHO "$libobjs" | $SP2NL | $SED "$lo2o" | $NL2SP`
7786 test "X$libobjs" = "X " && libobjs=
7789 if test -n "$export_symbols" && test -n "$include_expsyms"; then
7790 $opt_dry_run || cp "$export_symbols" "$output_objdir/$libname.uexp"
7791 export_symbols="$output_objdir/$libname.uexp"
7792 delfiles="$delfiles $export_symbols"
7795 orig_export_symbols=
7797 cygwin* | mingw* | cegcc*)
7798 if test -n "$export_symbols" && test -z "$export_symbols_regex"; then
7799 # exporting using user supplied symfile
7800 if test "x`$SED 1q $export_symbols`" != xEXPORTS; then
7801 # and it's NOT already a .def file. Must figure out
7802 # which of the given symbols are data symbols and tag
7803 # them as such. So, trigger use of export_symbols_cmds.
7804 # export_symbols gets reassigned inside the "prepare
7805 # the list of exported symbols" if statement, so the
7806 # include_expsyms logic still works.
7807 orig_export_symbols="$export_symbols"
7809 always_export_symbols=yes
7815 # Prepare the list of exported symbols
7816 if test -z "$export_symbols"; then
7817 if test "$always_export_symbols" = yes || test -n "$export_symbols_regex"; then
7818 func_verbose "generating symbol list for \`$libname.la'"
7819 export_symbols="$output_objdir/$libname.exp"
7820 $opt_dry_run || $RM $export_symbols
7821 cmds=$export_symbols_cmds
7822 save_ifs="$IFS"; IFS='~'
7823 for cmd in $cmds; do
7827 len=$func_len_result
7828 if test "$len" -lt "$max_cmd_len" || test "$max_cmd_len" -le -1; then
7829 func_show_eval "$cmd" 'exit $?'
7830 skipped_export=false
7832 # The command line is too long to execute in one step.
7833 func_verbose "using reloadable object file for export list..."
7835 # Break out early, otherwise skipped_export may be
7836 # set to false by a later but shorter cmd.
7841 if test -n "$export_symbols_regex" && test "X$skipped_export" != "X:"; then
7842 func_show_eval '$EGREP -e "$export_symbols_regex" "$export_symbols" > "${export_symbols}T"'
7843 func_show_eval '$MV "${export_symbols}T" "$export_symbols"'
7848 if test -n "$export_symbols" && test -n "$include_expsyms"; then
7849 tmp_export_symbols="$export_symbols"
7850 test -n "$orig_export_symbols" && tmp_export_symbols="$orig_export_symbols"
7851 $opt_dry_run || eval '$ECHO "$include_expsyms" | $SP2NL >> "$tmp_export_symbols"'
7854 if test "X$skipped_export" != "X:" && test -n "$orig_export_symbols"; then
7855 # The given exports_symbols file has to be filtered, so filter it.
7856 func_verbose "filter symbol list for \`$libname.la' to tag DATA exports"
7857 # FIXME: $output_objdir/$libname.filter potentially contains lots of
7858 # 's' commands which not all seds can handle. GNU sed should be fine
7859 # though. Also, the filter scales superlinearly with the number of
7860 # global variables. join(1) would be nice here, but unfortunately
7861 # isn't a blessed tool.
7862 $opt_dry_run || $SED -e '/[ ,]DATA/!d;s,\(.*\)\([ \,].*\),s|^\1$|\1\2|,' < $export_symbols > $output_objdir/$libname.filter
7863 delfiles="$delfiles $export_symbols $output_objdir/$libname.filter"
7864 export_symbols=$output_objdir/$libname.def
7865 $opt_dry_run || $SED -f $output_objdir/$libname.filter < $orig_export_symbols > $export_symbols
7869 for test_deplib in $deplibs; do
7870 case " $convenience " in
7871 *" $test_deplib "*) ;;
7873 tmp_deplibs="$tmp_deplibs $test_deplib"
7877 deplibs="$tmp_deplibs"
7879 if test -n "$convenience"; then
7880 if test -n "$whole_archive_flag_spec" &&
7881 test "$compiler_needs_object" = yes &&
7882 test -z "$libobjs"; then
7883 # extract the archives, so we have objects to list.
7884 # TODO: could optimize this to just extract one archive.
7885 whole_archive_flag_spec=
7887 if test -n "$whole_archive_flag_spec"; then
7888 save_libobjs=$libobjs
7889 eval libobjs=\"\$libobjs $whole_archive_flag_spec\"
7890 test "X$libobjs" = "X " && libobjs=
7892 gentop="$output_objdir/${outputname}x"
7893 generated="$generated $gentop"
7895 func_extract_archives $gentop $convenience
7896 libobjs="$libobjs $func_extract_archives_result"
7897 test "X$libobjs" = "X " && libobjs=
7901 if test "$thread_safe" = yes && test -n "$thread_safe_flag_spec"; then
7902 eval flag=\"$thread_safe_flag_spec\"
7903 linker_flags="$linker_flags $flag"
7906 # Make a backup of the uninstalled library when relinking
7907 if test "$mode" = relink; then
7908 $opt_dry_run || eval '(cd $output_objdir && $RM ${realname}U && $MV $realname ${realname}U)' || exit $?
7911 # Do each of the archive commands.
7912 if test "$module" = yes && test -n "$module_cmds" ; then
7913 if test -n "$export_symbols" && test -n "$module_expsym_cmds"; then
7914 eval test_cmds=\"$module_expsym_cmds\"
7915 cmds=$module_expsym_cmds
7917 eval test_cmds=\"$module_cmds\"
7921 if test -n "$export_symbols" && test -n "$archive_expsym_cmds"; then
7922 eval test_cmds=\"$archive_expsym_cmds\"
7923 cmds=$archive_expsym_cmds
7925 eval test_cmds=\"$archive_cmds\"
7930 if test "X$skipped_export" != "X:" &&
7931 func_len " $test_cmds" &&
7932 len=$func_len_result &&
7933 test "$len" -lt "$max_cmd_len" || test "$max_cmd_len" -le -1; then
7936 # The command line is too long to link in one step, link piecewise
7937 # or, if using GNU ld and skipped_export is not :, use a linker
7940 # Save the value of $output and $libobjs because we want to
7941 # use them later. If we have whole_archive_flag_spec, we
7942 # want to use save_libobjs as it was before
7943 # whole_archive_flag_spec was expanded, because we can't
7944 # assume the linker understands whole_archive_flag_spec.
7945 # This may have to be revisited, in case too many
7946 # convenience libraries get linked in and end up exceeding
7948 if test -z "$convenience" || test -z "$whole_archive_flag_spec"; then
7949 save_libobjs=$libobjs
7952 func_basename "$output"
7953 output_la=$func_basename_result
7955 # Clear the reloadable object creation command queue and
7956 # initialize k to one.
7963 if test -n "$save_libobjs" && test "X$skipped_export" != "X:" && test "$with_gnu_ld" = yes; then
7964 output=${output_objdir}/${output_la}.lnkscript
7965 func_verbose "creating GNU ld script: $output"
7966 echo 'INPUT (' > $output
7967 for obj in $save_libobjs
7969 $ECHO "$obj" >> $output
7972 delfiles="$delfiles $output"
7973 elif test -n "$save_libobjs" && test "X$skipped_export" != "X:" && test "X$file_list_spec" != X; then
7974 output=${output_objdir}/${output_la}.lnk
7975 func_verbose "creating linker input file list: $output"
7980 if test "$compiler_needs_object" = yes; then
7986 $ECHO "$obj" >> $output
7988 delfiles="$delfiles $output"
7989 output=$firstobj\"$file_list_spec$output\"
7991 if test -n "$save_libobjs"; then
7992 func_verbose "creating reloadable object files..."
7993 output=$output_objdir/$output_la-${k}.$objext
7994 eval test_cmds=\"$reload_cmds\"
7995 func_len " $test_cmds"
7996 len0=$func_len_result
7999 # Loop over the list of objects to be linked.
8000 for obj in $save_libobjs
8003 func_arith $len + $func_len_result
8004 len=$func_arith_result
8005 if test "X$objlist" = X ||
8006 test "$len" -lt "$max_cmd_len"; then
8007 func_append objlist " $obj"
8009 # The command $test_cmds is almost too long, add a
8010 # command to the queue.
8011 if test "$k" -eq 1 ; then
8012 # The first file doesn't have a previous command to add.
8013 reload_objs=$objlist
8014 eval concat_cmds=\"$reload_cmds\"
8016 # All subsequent reloadable object files will link in
8017 # the last one created.
8018 reload_objs="$objlist $last_robj"
8019 eval concat_cmds=\"\$concat_cmds~$reload_cmds~\$RM $last_robj\"
8021 last_robj=$output_objdir/$output_la-${k}.$objext
8023 k=$func_arith_result
8024 output=$output_objdir/$output_la-${k}.$objext
8026 func_len " $last_robj"
8027 func_arith $len0 + $func_len_result
8028 len=$func_arith_result
8031 # Handle the remaining objects by creating one last
8032 # reloadable object file. All subsequent reloadable object
8033 # files will link in the last one created.
8034 test -z "$concat_cmds" || concat_cmds=$concat_cmds~
8035 reload_objs="$objlist $last_robj"
8036 eval concat_cmds=\"\${concat_cmds}$reload_cmds\"
8037 if test -n "$last_robj"; then
8038 eval concat_cmds=\"\${concat_cmds}~\$RM $last_robj\"
8040 delfiles="$delfiles $output"
8046 if ${skipped_export-false}; then
8047 func_verbose "generating symbol list for \`$libname.la'"
8048 export_symbols="$output_objdir/$libname.exp"
8049 $opt_dry_run || $RM $export_symbols
8051 # Append the command to create the export file.
8052 test -z "$concat_cmds" || concat_cmds=$concat_cmds~
8053 eval concat_cmds=\"\$concat_cmds$export_symbols_cmds\"
8054 if test -n "$last_robj"; then
8055 eval concat_cmds=\"\$concat_cmds~\$RM $last_robj\"
8059 test -n "$save_libobjs" &&
8060 func_verbose "creating a temporary reloadable object file: $output"
8062 # Loop through the commands generated above and execute them.
8063 save_ifs="$IFS"; IFS='~'
8064 for cmd in $concat_cmds; do
8067 func_quote_for_expand "$cmd"
8068 eval "func_echo $func_quote_for_expand_result"
8070 $opt_dry_run || eval "$cmd" || {
8073 # Restore the uninstalled library and exit
8074 if test "$mode" = relink; then
8075 ( cd "$output_objdir" && \
8076 $RM "${realname}T" && \
8077 $MV "${realname}U" "$realname" )
8085 if test -n "$export_symbols_regex" && ${skipped_export-false}; then
8086 func_show_eval '$EGREP -e "$export_symbols_regex" "$export_symbols" > "${export_symbols}T"'
8087 func_show_eval '$MV "${export_symbols}T" "$export_symbols"'
8091 if ${skipped_export-false}; then
8092 if test -n "$export_symbols" && test -n "$include_expsyms"; then
8093 tmp_export_symbols="$export_symbols"
8094 test -n "$orig_export_symbols" && tmp_export_symbols="$orig_export_symbols"
8095 $opt_dry_run || eval '$ECHO "$include_expsyms" | $SP2NL >> "$tmp_export_symbols"'
8098 if test -n "$orig_export_symbols"; then
8099 # The given exports_symbols file has to be filtered, so filter it.
8100 func_verbose "filter symbol list for \`$libname.la' to tag DATA exports"
8101 # FIXME: $output_objdir/$libname.filter potentially contains lots of
8102 # 's' commands which not all seds can handle. GNU sed should be fine
8103 # though. Also, the filter scales superlinearly with the number of
8104 # global variables. join(1) would be nice here, but unfortunately
8105 # isn't a blessed tool.
8106 $opt_dry_run || $SED -e '/[ ,]DATA/!d;s,\(.*\)\([ \,].*\),s|^\1$|\1\2|,' < $export_symbols > $output_objdir/$libname.filter
8107 delfiles="$delfiles $export_symbols $output_objdir/$libname.filter"
8108 export_symbols=$output_objdir/$libname.def
8109 $opt_dry_run || $SED -f $output_objdir/$libname.filter < $orig_export_symbols > $export_symbols
8114 # Restore the value of output.
8117 if test -n "$convenience" && test -n "$whole_archive_flag_spec"; then
8118 eval libobjs=\"\$libobjs $whole_archive_flag_spec\"
8119 test "X$libobjs" = "X " && libobjs=
8121 # Expand the library linking commands again to reset the
8122 # value of $libobjs for piecewise linking.
8124 # Do each of the archive commands.
8125 if test "$module" = yes && test -n "$module_cmds" ; then
8126 if test -n "$export_symbols" && test -n "$module_expsym_cmds"; then
8127 cmds=$module_expsym_cmds
8132 if test -n "$export_symbols" && test -n "$archive_expsym_cmds"; then
8133 cmds=$archive_expsym_cmds
8140 if test -n "$delfiles"; then
8141 # Append the command to remove temporary files to $cmds.
8142 eval cmds=\"\$cmds~\$RM $delfiles\"
8145 # Add any objects from preloaded convenience libraries
8146 if test -n "$dlprefiles"; then
8147 gentop="$output_objdir/${outputname}x"
8148 generated="$generated $gentop"
8150 func_extract_archives $gentop $dlprefiles
8151 libobjs="$libobjs $func_extract_archives_result"
8152 test "X$libobjs" = "X " && libobjs=
8155 save_ifs="$IFS"; IFS='~'
8156 for cmd in $cmds; do
8160 func_quote_for_expand "$cmd"
8161 eval "func_echo $func_quote_for_expand_result"
8163 $opt_dry_run || eval "$cmd" || {
8166 # Restore the uninstalled library and exit
8167 if test "$mode" = relink; then
8168 ( cd "$output_objdir" && \
8169 $RM "${realname}T" && \
8170 $MV "${realname}U" "$realname" )
8178 # Restore the uninstalled library and exit
8179 if test "$mode" = relink; then
8180 $opt_dry_run || eval '(cd $output_objdir && $RM ${realname}T && $MV $realname ${realname}T && $MV ${realname}U $realname)' || exit $?
8182 if test -n "$convenience"; then
8183 if test -z "$whole_archive_flag_spec"; then
8184 func_show_eval '${RM}r "$gentop"'
8191 # Create links to the real library.
8192 for linkname in $linknames; do
8193 if test "$realname" != "$linkname"; then
8194 func_show_eval '(cd "$output_objdir" && $RM "$linkname" && $LN_S "$realname" "$linkname")' 'exit $?'
8198 # If -module or -export-dynamic was specified, set the dlname.
8199 if test "$module" = yes || test "$export_dynamic" = yes; then
8200 # On all known operating systems, these are identical.
8207 if test -n "$dlfiles$dlprefiles" || test "$dlself" != no; then
8208 func_warning "\`-dlopen' is ignored for objects"
8213 func_warning "\`-l' and \`-L' are ignored for objects" ;;
8216 test -n "$rpath" && \
8217 func_warning "\`-rpath' is ignored for objects"
8219 test -n "$xrpath" && \
8220 func_warning "\`-R' is ignored for objects"
8222 test -n "$vinfo" && \
8223 func_warning "\`-version-info' is ignored for objects"
8225 test -n "$release" && \
8226 func_warning "\`-release' is ignored for objects"
8230 test -n "$objs$old_deplibs" && \
8231 func_fatal_error "cannot build library object \`$output' from non-libtool objects"
8235 obj=$func_lo2o_result
8243 # Delete the old objects.
8244 $opt_dry_run || $RM $obj $libobj
8246 # Objects from convenience libraries. This assumes
8247 # single-version convenience libraries. Whenever we create
8248 # different ones for PIC/non-PIC, this we'll have to duplicate
8252 # reload_cmds runs $LD directly, so let us get rid of
8253 # -Wl from whole_archive_flag_spec and hope we can get by with
8254 # turning comma into space..
8257 if test -n "$convenience"; then
8258 if test -n "$whole_archive_flag_spec"; then
8259 eval tmp_whole_archive_flags=\"$whole_archive_flag_spec\"
8260 reload_conv_objs=$reload_objs\ `$ECHO "$tmp_whole_archive_flags" | $SED 's|,| |g'`
8262 gentop="$output_objdir/${obj}x"
8263 generated="$generated $gentop"
8265 func_extract_archives $gentop $convenience
8266 reload_conv_objs="$reload_objs $func_extract_archives_result"
8270 # Create the old-style object.
8271 reload_objs="$objs$old_deplibs "`$ECHO "$libobjs" | $SP2NL | $SED "/\.${libext}$/d; /\.lib$/d; $lo2o" | $NL2SP`" $reload_conv_objs" ### testsuite: skip nested quoting test
8274 func_execute_cmds "$reload_cmds" 'exit $?'
8276 # Exit if we aren't doing a library object file.
8277 if test -z "$libobj"; then
8278 if test -n "$gentop"; then
8279 func_show_eval '${RM}r "$gentop"'
8285 if test "$build_libtool_libs" != yes; then
8286 if test -n "$gentop"; then
8287 func_show_eval '${RM}r "$gentop"'
8290 # Create an invalid libtool object if no PIC, so that we don't
8291 # accidentally link it into a program.
8292 # $show "echo timestamp > $libobj"
8293 # $opt_dry_run || eval "echo timestamp > $libobj" || exit $?
8297 if test -n "$pic_flag" || test "$pic_mode" != default; then
8298 # Only do commands if we really have different PIC objects.
8299 reload_objs="$libobjs $reload_conv_objs"
8301 func_execute_cmds "$reload_cmds" 'exit $?'
8304 if test -n "$gentop"; then
8305 func_show_eval '${RM}r "$gentop"'
8313 *cygwin*) func_stripname '' '.exe' "$output"
8314 output=$func_stripname_result.exe;;
8316 test -n "$vinfo" && \
8317 func_warning "\`-version-info' is ignored for programs"
8319 test -n "$release" && \
8320 func_warning "\`-release' is ignored for programs"
8322 test "$preload" = yes \
8323 && test "$dlopen_support" = unknown \
8324 && test "$dlopen_self" = unknown \
8325 && test "$dlopen_self_static" = unknown && \
8326 func_warning "\`LT_INIT([dlopen])' not used. Assuming no dlopen support."
8329 *-*-rhapsody* | *-*-darwin1.[012])
8330 # On Rhapsody replace the C library is the System framework
8331 compile_deplibs=`$ECHO " $compile_deplibs" | $SED 's/ -lc / System.ltframework /'`
8332 finalize_deplibs=`$ECHO " $finalize_deplibs" | $SED 's/ -lc / System.ltframework /'`
8338 # Don't allow lazy linking, it breaks C++ global constructors
8339 # But is supposedly fixed on 10.4 or later (yay!).
8340 if test "$tagname" = CXX ; then
8341 case ${MACOSX_DEPLOYMENT_TARGET-10.0} in
8343 compile_command="$compile_command ${wl}-bind_at_load"
8344 finalize_command="$finalize_command ${wl}-bind_at_load"
8348 # Time to change all our "foo.ltframework" stuff back to "-framework foo"
8349 compile_deplibs=`$ECHO " $compile_deplibs" | $SED 's% \([^ $]*\).ltframework% -framework \1%g'`
8350 finalize_deplibs=`$ECHO " $finalize_deplibs" | $SED 's% \([^ $]*\).ltframework% -framework \1%g'`
8355 # move library search paths that coincide with paths to not yet
8356 # installed libraries to the beginning of the library search list
8358 for path in $notinst_path; do
8359 case " $new_libs " in
8360 *" -L$path/$objdir "*) ;;
8362 case " $compile_deplibs " in
8363 *" -L$path/$objdir "*)
8364 new_libs="$new_libs -L$path/$objdir" ;;
8369 for deplib in $compile_deplibs; do
8372 case " $new_libs " in
8374 *) new_libs="$new_libs $deplib" ;;
8377 *) new_libs="$new_libs $deplib" ;;
8380 compile_deplibs="$new_libs"
8383 compile_command="$compile_command $compile_deplibs"
8384 finalize_command="$finalize_command $finalize_deplibs"
8386 if test -n "$rpath$xrpath"; then
8387 # If the user specified any rpath flags, then add them.
8388 for libdir in $rpath $xrpath; do
8389 # This is the magic to use -rpath.
8390 case "$finalize_rpath " in
8392 *) finalize_rpath="$finalize_rpath $libdir" ;;
8397 # Now hardcode the library paths
8400 for libdir in $compile_rpath $finalize_rpath; do
8401 if test -n "$hardcode_libdir_flag_spec"; then
8402 if test -n "$hardcode_libdir_separator"; then
8403 if test -z "$hardcode_libdirs"; then
8404 hardcode_libdirs="$libdir"
8406 # Just accumulate the unique libdirs.
8407 case $hardcode_libdir_separator$hardcode_libdirs$hardcode_libdir_separator in
8408 *"$hardcode_libdir_separator$libdir$hardcode_libdir_separator"*)
8411 hardcode_libdirs="$hardcode_libdirs$hardcode_libdir_separator$libdir"
8416 eval flag=\"$hardcode_libdir_flag_spec\"
8417 rpath="$rpath $flag"
8419 elif test -n "$runpath_var"; then
8420 case "$perm_rpath " in
8422 *) perm_rpath="$perm_rpath $libdir" ;;
8426 *-*-cygwin* | *-*-mingw* | *-*-pw32* | *-*-os2* | *-cegcc*)
8427 testbindir=`${ECHO} "$libdir" | ${SED} -e 's*/lib$*/bin*'`
8428 case :$dllsearchpath: in
8430 ::) dllsearchpath=$libdir;;
8431 *) dllsearchpath="$dllsearchpath:$libdir";;
8433 case :$dllsearchpath: in
8434 *":$testbindir:"*) ;;
8435 ::) dllsearchpath=$testbindir;;
8436 *) dllsearchpath="$dllsearchpath:$testbindir";;
8441 # Substitute the hardcoded libdirs into the rpath.
8442 if test -n "$hardcode_libdir_separator" &&
8443 test -n "$hardcode_libdirs"; then
8444 libdir="$hardcode_libdirs"
8445 eval rpath=\" $hardcode_libdir_flag_spec\"
8447 compile_rpath="$rpath"
8451 for libdir in $finalize_rpath; do
8452 if test -n "$hardcode_libdir_flag_spec"; then
8453 if test -n "$hardcode_libdir_separator"; then
8454 if test -z "$hardcode_libdirs"; then
8455 hardcode_libdirs="$libdir"
8457 # Just accumulate the unique libdirs.
8458 case $hardcode_libdir_separator$hardcode_libdirs$hardcode_libdir_separator in
8459 *"$hardcode_libdir_separator$libdir$hardcode_libdir_separator"*)
8462 hardcode_libdirs="$hardcode_libdirs$hardcode_libdir_separator$libdir"
8467 eval flag=\"$hardcode_libdir_flag_spec\"
8468 rpath="$rpath $flag"
8470 elif test -n "$runpath_var"; then
8471 case "$finalize_perm_rpath " in
8473 *) finalize_perm_rpath="$finalize_perm_rpath $libdir" ;;
8477 # Substitute the hardcoded libdirs into the rpath.
8478 if test -n "$hardcode_libdir_separator" &&
8479 test -n "$hardcode_libdirs"; then
8480 libdir="$hardcode_libdirs"
8481 eval rpath=\" $hardcode_libdir_flag_spec\"
8483 finalize_rpath="$rpath"
8485 if test -n "$libobjs" && test "$build_old_libs" = yes; then
8486 # Transform all the library objects into standard objects.
8487 compile_command=`$ECHO "$compile_command" | $SP2NL | $SED "$lo2o" | $NL2SP`
8488 finalize_command=`$ECHO "$finalize_command" | $SP2NL | $SED "$lo2o" | $NL2SP`
8491 func_generate_dlsyms "$outputname" "@PROGRAM@" "no"
8493 # template prelinking step
8494 if test -n "$prelink_cmds"; then
8495 func_execute_cmds "$prelink_cmds" 'exit $?'
8498 wrappers_required=yes
8500 *cegcc* | *mingw32ce*)
8501 # Disable wrappers for cegcc and mingw32ce hosts, we are cross compiling anyway.
8502 wrappers_required=no
8504 *cygwin* | *mingw* )
8505 if test "$build_libtool_libs" != yes; then
8506 wrappers_required=no
8510 if test "$need_relink" = no || test "$build_libtool_libs" != yes; then
8511 wrappers_required=no
8515 if test "$wrappers_required" = no; then
8516 # Replace the output file specification.
8517 compile_command=`$ECHO "$compile_command" | $SED 's%@OUTPUT@%'"$output"'%g'`
8518 link_command="$compile_command$compile_rpath"
8520 # We have no uninstalled library dependencies, so finalize right now.
8522 func_show_eval "$link_command" 'exit_status=$?'
8524 # Delete the generated files.
8525 if test -f "$output_objdir/${outputname}S.${objext}"; then
8526 func_show_eval '$RM "$output_objdir/${outputname}S.${objext}"'
8532 if test -n "$compile_shlibpath$finalize_shlibpath"; then
8533 compile_command="$shlibpath_var=\"$compile_shlibpath$finalize_shlibpath\$$shlibpath_var\" $compile_command"
8535 if test -n "$finalize_shlibpath"; then
8536 finalize_command="$shlibpath_var=\"$finalize_shlibpath\$$shlibpath_var\" $finalize_command"
8541 if test -n "$runpath_var"; then
8542 if test -n "$perm_rpath"; then
8543 # We should set the runpath_var.
8545 for dir in $perm_rpath; do
8548 compile_var="$runpath_var=\"$rpath\$$runpath_var\" "
8550 if test -n "$finalize_perm_rpath"; then
8551 # We should set the runpath_var.
8553 for dir in $finalize_perm_rpath; do
8556 finalize_var="$runpath_var=\"$rpath\$$runpath_var\" "
8560 if test "$no_install" = yes; then
8561 # We don't need to create a wrapper script.
8562 link_command="$compile_var$compile_command$compile_rpath"
8563 # Replace the output file specification.
8564 link_command=`$ECHO "$link_command" | $SED 's%@OUTPUT@%'"$output"'%g'`
8565 # Delete the old output file.
8566 $opt_dry_run || $RM $output
8567 # Link the executable and exit
8568 func_show_eval "$link_command" 'exit $?'
8572 if test "$hardcode_action" = relink; then
8573 # Fast installation is not supported
8574 link_command="$compile_var$compile_command$compile_rpath"
8575 relink_command="$finalize_var$finalize_command$finalize_rpath"
8577 func_warning "this platform does not like uninstalled shared libraries"
8578 func_warning "\`$output' will be relinked during installation"
8580 if test "$fast_install" != no; then
8581 link_command="$finalize_var$compile_command$finalize_rpath"
8582 if test "$fast_install" = yes; then
8583 relink_command=`$ECHO "$compile_var$compile_command$compile_rpath" | $SED 's%@OUTPUT@%\$progdir/\$file%g'`
8585 # fast_install is set to needless
8589 link_command="$compile_var$compile_command$compile_rpath"
8590 relink_command="$finalize_var$finalize_command$finalize_rpath"
8594 # Replace the output file specification.
8595 link_command=`$ECHO "$link_command" | $SED 's%@OUTPUT@%'"$output_objdir/$outputname"'%g'`
8597 # Delete the old output files.
8598 $opt_dry_run || $RM $output $output_objdir/$outputname $output_objdir/lt-$outputname
8600 func_show_eval "$link_command" 'exit $?'
8602 # Now create the wrapper script.
8603 func_verbose "creating $output"
8605 # Quote the relink command for shipping.
8606 if test -n "$relink_command"; then
8607 # Preserve any variables that may affect compiler behavior
8608 for var in $variables_saved_for_relink; do
8609 if eval test -z \"\${$var+set}\"; then
8610 relink_command="{ test -z \"\${$var+set}\" || $lt_unset $var || { $var=; export $var; }; }; $relink_command"
8611 elif eval var_value=\$$var; test -z "$var_value"; then
8612 relink_command="$var=; export $var; $relink_command"
8614 func_quote_for_eval "$var_value"
8615 relink_command="$var=$func_quote_for_eval_result; export $var; $relink_command"
8618 relink_command="(cd `pwd`; $relink_command)"
8619 relink_command=`$ECHO "$relink_command" | $SED "$sed_quote_subst"`
8622 # Only actually do things if not in dry run mode.
8624 # win32 will think the script is a binary if it has
8625 # a .exe suffix, so we strip it off here.
8627 *.exe) func_stripname '' '.exe' "$output"
8628 output=$func_stripname_result ;;
8630 # test for cygwin because mv fails w/o .exe extensions
8634 func_stripname '' '.exe' "$outputname"
8635 outputname=$func_stripname_result ;;
8639 *cygwin* | *mingw* )
8640 func_dirname_and_basename "$output" "" "."
8641 output_name=$func_basename_result
8642 output_path=$func_dirname_result
8643 cwrappersource="$output_path/$objdir/lt-$output_name.c"
8644 cwrapper="$output_path/$output_name.exe"
8645 $RM $cwrappersource $cwrapper
8646 trap "$RM $cwrappersource $cwrapper; exit $EXIT_FAILURE" 1 2 15
8648 func_emit_cwrapperexe_src > $cwrappersource
8650 # The wrapper executable is built using the $host compiler,
8651 # because it contains $host paths and files. If cross-
8652 # compiling, it, like the target executable, must be
8653 # executed on the $host or under an emulation environment.
8655 $LTCC $LTCFLAGS -o $cwrapper $cwrappersource
8659 # Now, create the wrapper script for func_source use:
8660 func_ltwrapper_scriptname $cwrapper
8661 $RM $func_ltwrapper_scriptname_result
8662 trap "$RM $func_ltwrapper_scriptname_result; exit $EXIT_FAILURE" 1 2 15
8664 # note: this script will not be executed, so do not chmod.
8665 if test "x$build" = "x$host" ; then
8666 $cwrapper --lt-dump-script > $func_ltwrapper_scriptname_result
8668 func_emit_wrapper no > $func_ltwrapper_scriptname_result
8674 trap "$RM $output; exit $EXIT_FAILURE" 1 2 15
8676 func_emit_wrapper no > $output
8685 # See if we need to build an old-fashioned archive.
8686 for oldlib in $oldlibs; do
8688 if test "$build_libtool_libs" = convenience; then
8689 oldobjs="$libobjs_save $symfileobj"
8690 addlibs="$convenience"
8691 build_libtool_libs=no
8693 if test "$build_libtool_libs" = module; then
8694 oldobjs="$libobjs_save"
8695 build_libtool_libs=no
8697 oldobjs="$old_deplibs $non_pic_objects"
8698 if test "$preload" = yes && test -f "$symfileobj"; then
8699 oldobjs="$oldobjs $symfileobj"
8702 addlibs="$old_convenience"
8705 if test -n "$addlibs"; then
8706 gentop="$output_objdir/${outputname}x"
8707 generated="$generated $gentop"
8709 func_extract_archives $gentop $addlibs
8710 oldobjs="$oldobjs $func_extract_archives_result"
8713 # Do each command in the archive commands.
8714 if test -n "$old_archive_from_new_cmds" && test "$build_libtool_libs" = yes; then
8715 cmds=$old_archive_from_new_cmds
8718 # Add any objects from preloaded convenience libraries
8719 if test -n "$dlprefiles"; then
8720 gentop="$output_objdir/${outputname}x"
8721 generated="$generated $gentop"
8723 func_extract_archives $gentop $dlprefiles
8724 oldobjs="$oldobjs $func_extract_archives_result"
8727 # POSIX demands no paths to be encoded in archives. We have
8728 # to avoid creating archives with duplicate basenames if we
8729 # might have to extract them afterwards, e.g., when creating a
8730 # static archive out of a convenience library, or when linking
8731 # the entirety of a libtool archive into another (currently
8732 # not supported by libtool).
8733 if (for obj in $oldobjs
8735 func_basename "$obj"
8736 $ECHO "$func_basename_result"
8737 done | sort | sort -uc >/dev/null 2>&1); then
8740 echo "copying selected object files to avoid basename conflicts..."
8741 gentop="$output_objdir/${outputname}x"
8742 generated="$generated $gentop"
8743 func_mkdir_p "$gentop"
8744 save_oldobjs=$oldobjs
8747 for obj in $save_oldobjs
8749 func_basename "$obj"
8750 objbase="$func_basename_result"
8751 case " $oldobjs " in
8752 " ") oldobjs=$obj ;;
8755 # Make sure we don't pick an alternate name that also
8757 newobj=lt$counter-$objbase
8758 func_arith $counter + 1
8759 counter=$func_arith_result
8760 case " $oldobjs " in
8761 *[\ /]"$newobj "*) ;;
8762 *) if test ! -f "$gentop/$newobj"; then break; fi ;;
8765 func_show_eval "ln $obj $gentop/$newobj || cp $obj $gentop/$newobj"
8766 oldobjs="$oldobjs $gentop/$newobj"
8768 *) oldobjs="$oldobjs $obj" ;;
8772 eval cmds=\"$old_archive_cmds\"
8775 len=$func_len_result
8776 if test "$len" -lt "$max_cmd_len" || test "$max_cmd_len" -le -1; then
8777 cmds=$old_archive_cmds
8779 # the command line is too long to link in one step, link in parts
8780 func_verbose "using piecewise archive linking..."
8785 save_oldobjs=$oldobjs
8787 # Is there a better way of finding the last object in the list?
8788 for obj in $save_oldobjs
8792 eval test_cmds=\"$old_archive_cmds\"
8793 func_len " $test_cmds"
8794 len0=$func_len_result
8796 for obj in $save_oldobjs
8799 func_arith $len + $func_len_result
8800 len=$func_arith_result
8801 func_append objlist " $obj"
8802 if test "$len" -lt "$max_cmd_len"; then
8805 # the above command should be used before it gets too long
8807 if test "$obj" = "$last_oldobj" ; then
8810 test -z "$concat_cmds" || concat_cmds=$concat_cmds~
8811 eval concat_cmds=\"\${concat_cmds}$old_archive_cmds\"
8818 if test "X$oldobjs" = "X" ; then
8819 eval cmds=\"\$concat_cmds\"
8821 eval cmds=\"\$concat_cmds~\$old_archive_cmds\"
8825 func_execute_cmds "$cmds" 'exit $?'
8828 test -n "$generated" && \
8829 func_show_eval "${RM}r$generated"
8831 # Now create the libtool archive.
8835 test "$build_old_libs" = yes && old_library="$libname.$libext"
8836 func_verbose "creating $output"
8838 # Preserve any variables that may affect compiler behavior
8839 for var in $variables_saved_for_relink; do
8840 if eval test -z \"\${$var+set}\"; then
8841 relink_command="{ test -z \"\${$var+set}\" || $lt_unset $var || { $var=; export $var; }; }; $relink_command"
8842 elif eval var_value=\$$var; test -z "$var_value"; then
8843 relink_command="$var=; export $var; $relink_command"
8845 func_quote_for_eval "$var_value"
8846 relink_command="$var=$func_quote_for_eval_result; export $var; $relink_command"
8849 # Quote the link command for shipping.
8850 relink_command="(cd `pwd`; $SHELL $progpath $preserve_args --mode=relink $libtool_args @inst_prefix_dir@)"
8851 relink_command=`$ECHO "$relink_command" | $SED "$sed_quote_subst"`
8852 if test "$hardcode_automatic" = yes ; then
8856 # Only create the output if not a dry run.
8858 for installed in no yes; do
8859 if test "$installed" = yes; then
8860 if test -z "$install_libdir"; then
8863 output="$output_objdir/$outputname"i
8864 # Replace all uninstalled libtool libraries with the installed ones
8866 for deplib in $dependency_libs; do
8869 func_basename "$deplib"
8870 name="$func_basename_result"
8871 eval libdir=`${SED} -n -e 's/^libdir=\(.*\)$/\1/p' $deplib`
8872 test -z "$libdir" && \
8873 func_fatal_error "\`$deplib' is not a valid libtool archive"
8874 newdependency_libs="$newdependency_libs $libdir/$name"
8876 *) newdependency_libs="$newdependency_libs $deplib" ;;
8879 dependency_libs="$newdependency_libs"
8882 for lib in $dlfiles; do
8885 func_basename "$lib"
8886 name="$func_basename_result"
8887 eval libdir=`${SED} -n -e 's/^libdir=\(.*\)$/\1/p' $lib`
8888 test -z "$libdir" && \
8889 func_fatal_error "\`$lib' is not a valid libtool archive"
8890 newdlfiles="$newdlfiles $libdir/$name"
8892 *) newdlfiles="$newdlfiles $lib" ;;
8895 dlfiles="$newdlfiles"
8897 for lib in $dlprefiles; do
8900 # Only pass preopened files to the pseudo-archive (for
8901 # eventual linking with the app. that links it) if we
8902 # didn't already link the preopened objects directly into
8904 func_basename "$lib"
8905 name="$func_basename_result"
8906 eval libdir=`${SED} -n -e 's/^libdir=\(.*\)$/\1/p' $lib`
8907 test -z "$libdir" && \
8908 func_fatal_error "\`$lib' is not a valid libtool archive"
8909 newdlprefiles="$newdlprefiles $libdir/$name"
8913 dlprefiles="$newdlprefiles"
8916 for lib in $dlfiles; do
8918 [\\/]* | [A-Za-z]:[\\/]*) abs="$lib" ;;
8919 *) abs=`pwd`"/$lib" ;;
8921 newdlfiles="$newdlfiles $abs"
8923 dlfiles="$newdlfiles"
8925 for lib in $dlprefiles; do
8927 [\\/]* | [A-Za-z]:[\\/]*) abs="$lib" ;;
8928 *) abs=`pwd`"/$lib" ;;
8930 newdlprefiles="$newdlprefiles $abs"
8932 dlprefiles="$newdlprefiles"
8935 # place dlname in correct position for cygwin
8936 # In fact, it would be nice if we could use this code for all target
8937 # systems that can't hard-code library paths into their executables
8938 # and that have no shared library path variable independent of PATH,
8939 # but it turns out we can't easily determine that from inspecting
8940 # libtool variables, so we have to hard-code the OSs to which it
8941 # applies here; at the moment, that means platforms that use the PE
8942 # object format with DLL files. See the long comment at the top of
8943 # tests/bindir.at for full details.
8945 case $host,$output,$installed,$module,$dlname in
8946 *cygwin*,*lai,yes,no,*.dll | *mingw*,*lai,yes,no,*.dll | *cegcc*,*lai,yes,no,*.dll)
8947 # If a -bindir argument was supplied, place the dll there.
8948 if test "x$bindir" != x ;
8950 func_relative_path "$install_libdir" "$bindir"
8951 tdlname=$func_relative_path_result$dlname
8953 # Otherwise fall back on heuristic.
8954 tdlname=../bin/$dlname
8959 # $outputname - a libtool library file
8960 # Generated by $PROGRAM (GNU $PACKAGE$TIMESTAMP) $VERSION
8962 # Please DO NOT delete this file!
8963 # It is necessary for linking the library.
8965 # The name that we can dlopen(3).
8968 # Names of this library.
8969 library_names='$library_names'
8971 # The name of the static archive.
8972 old_library='$old_library'
8974 # Linker flags that can not go in dependency_libs.
8975 inherited_linker_flags='$new_inherited_linker_flags'
8977 # Libraries that this one depends upon.
8978 dependency_libs='$dependency_libs'
8980 # Names of additional weak libraries provided by this library
8981 weak_library_names='$weak_libs'
8983 # Version information for $libname.
8988 # Is this an already installed library?
8989 installed=$installed
8991 # Should we warn about portability when linking against -modules?
8992 shouldnotlink=$module
8994 # Files to dlopen/dlpreopen
8996 dlpreopen='$dlprefiles'
8998 # Directory that this library needs to be installed in:
8999 libdir='$install_libdir'"
9000 if test "$installed" = no && test "$need_relink" = yes; then
9002 relink_command=\"$relink_command\""
9007 # Do a symbolic link so that the libtool archive can be found in
9008 # LD_LIBRARY_PATH before the program is installed.
9009 func_show_eval '( cd "$output_objdir" && $RM "$outputname" && $LN_S "../$outputname" "$outputname" )' 'exit $?'
9015 { test "$mode" = link || test "$mode" = relink; } &&
9016 func_mode_link ${1+"$@"}
9019 # func_mode_uninstall arg...
9020 func_mode_uninstall ()
9028 # This variable tells wrapper scripts just to set variables rather
9029 # than running their programs.
9030 libtool_install_magic="$magic"
9035 -f) RM="$RM $arg"; rmforce=yes ;;
9036 -*) RM="$RM $arg" ;;
9037 *) files="$files $arg" ;;
9042 func_fatal_help "you must specify an RM program"
9046 origobjdir="$objdir"
9047 for file in $files; do
9048 func_dirname "$file" "" "."
9049 dir="$func_dirname_result"
9050 if test "X$dir" = X.; then
9051 objdir="$origobjdir"
9053 objdir="$dir/$origobjdir"
9055 func_basename "$file"
9056 name="$func_basename_result"
9057 test "$mode" = uninstall && objdir="$dir"
9059 # Remember objdir for removal later, being careful to avoid duplicates
9060 if test "$mode" = clean; then
9063 *) rmdirs="$rmdirs $objdir" ;;
9067 # Don't error if the file doesn't exist and rm -f was used.
9068 if { test -L "$file"; } >/dev/null 2>&1 ||
9069 { test -h "$file"; } >/dev/null 2>&1 ||
9070 test -f "$file"; then
9072 elif test -d "$file"; then
9075 elif test "$rmforce" = yes; then
9083 # Possibly a libtool archive, so verify it.
9084 if func_lalib_p "$file"; then
9085 func_source $dir/$name
9087 # Delete the libtool libraries and symlinks.
9088 for n in $library_names; do
9089 rmfiles="$rmfiles $objdir/$n"
9091 test -n "$old_library" && rmfiles="$rmfiles $objdir/$old_library"
9095 case " $library_names " in
9096 # " " in the beginning catches empty $dlname
9098 *) rmfiles="$rmfiles $objdir/$dlname" ;;
9100 test -n "$libdir" && rmfiles="$rmfiles $objdir/$name $objdir/${name}i"
9103 if test -n "$library_names"; then
9104 # Do each command in the postuninstall commands.
9105 func_execute_cmds "$postuninstall_cmds" 'test "$rmforce" = yes || exit_status=1'
9108 if test -n "$old_library"; then
9109 # Do each command in the old_postuninstall commands.
9110 func_execute_cmds "$old_postuninstall_cmds" 'test "$rmforce" = yes || exit_status=1'
9112 # FIXME: should reinstall the best remaining shared library.
9119 # Possibly a libtool object, so verify it.
9120 if func_lalib_p "$file"; then
9123 func_source $dir/$name
9125 # Add PIC object to the list of files to remove.
9126 if test -n "$pic_object" &&
9127 test "$pic_object" != none; then
9128 rmfiles="$rmfiles $dir/$pic_object"
9131 # Add non-PIC object to the list of files to remove.
9132 if test -n "$non_pic_object" &&
9133 test "$non_pic_object" != none; then
9134 rmfiles="$rmfiles $dir/$non_pic_object"
9140 if test "$mode" = clean ; then
9144 func_stripname '' '.exe' "$file"
9145 file=$func_stripname_result
9146 func_stripname '' '.exe' "$name"
9147 noexename=$func_stripname_result
9148 # $file with .exe has already been added to rmfiles,
9149 # add $file without .exe
9150 rmfiles="$rmfiles $file"
9153 # Do a test to see if this is a libtool program.
9154 if func_ltwrapper_p "$file"; then
9155 if func_ltwrapper_executable_p "$file"; then
9156 func_ltwrapper_scriptname "$file"
9158 func_source $func_ltwrapper_scriptname_result
9159 rmfiles="$rmfiles $func_ltwrapper_scriptname_result"
9162 func_source $dir/$noexename
9165 # note $name still contains .exe if it was in $file originally
9166 # as does the version of $file that was added into $rmfiles
9167 rmfiles="$rmfiles $objdir/$name $objdir/${name}S.${objext}"
9168 if test "$fast_install" = yes && test -n "$relink_command"; then
9169 rmfiles="$rmfiles $objdir/lt-$name"
9171 if test "X$noexename" != "X$name" ; then
9172 rmfiles="$rmfiles $objdir/lt-${noexename}.c"
9178 func_show_eval "$RM $rmfiles" 'exit_status=1'
9180 objdir="$origobjdir"
9182 # Try to remove the ${objdir}s in the directories where we deleted files
9183 for dir in $rmdirs; do
9184 if test -d "$dir"; then
9185 func_show_eval "rmdir $dir >/dev/null 2>&1"
9192 { test "$mode" = uninstall || test "$mode" = clean; } &&
9193 func_mode_uninstall ${1+"$@"}
9195 test -z "$mode" && {
9196 help="$generic_help"
9197 func_fatal_help "you must specify a MODE"
9200 test -z "$exec_cmd" && \
9201 func_fatal_help "invalid operation mode \`$mode'"
9203 if test -n "$exec_cmd"; then
9204 eval exec "$exec_cmd"
9211 # The TAGs below are defined such that we never get into a situation
9212 # in which we disable both kinds of libraries. Given conflicting
9213 # choices, we go for a static library, that is the most portable,
9214 # since we can't tell whether shared libraries were disabled because
9215 # the user asked for that or because the platform doesn't support
9216 # them. This is particularly important on AIX, because we don't
9217 # support having both static and shared libraries enabled at the same
9218 # time on that platform, so we default to a shared-only configuration.
9219 # If a disable-shared tag is given, we'll fallback to a static-only
9220 # configuration. But we'll never go from static-only to shared-only.
9222 # ### BEGIN LIBTOOL TAG CONFIG: disable-shared
9223 build_libtool_libs=no
9225 # ### END LIBTOOL TAG CONFIG: disable-shared
9227 # ### BEGIN LIBTOOL TAG CONFIG: disable-static
9228 build_old_libs=`case $build_libtool_libs in yes) echo no;; *) echo yes;; esac`
9229 # ### END LIBTOOL TAG CONFIG: disable-static