3 # libtool - Provide generalized library-building support services.
4 # Generated automatically by config.status (GNU gsl) 1.11
5 # Libtool was configured on host m304-apple-server.Stanford.EDU:
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 Free Software Foundation, Inc.
10 # Written by Gordon Matzigkeit, 1996
12 # This file is part of GNU Libtool.
14 # GNU Libtool is free software; you can redistribute it and/or
15 # modify it under the terms of the GNU General Public License as
16 # published by the Free Software Foundation; either version 2 of
17 # the License, or (at your option) any later version.
19 # As a special exception to the GNU General Public License,
20 # if you distribute this file as part of a program or library that
21 # is built using GNU Libtool, you may include this file under the
22 # same distribution terms that you use for the rest of that program.
24 # GNU Libtool is distributed in the hope that it will be useful,
25 # but WITHOUT ANY WARRANTY; without even the implied warranty of
26 # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
27 # GNU General Public License for more details.
29 # You should have received a copy of the GNU General Public License
30 # along with GNU Libtool; see the file COPYING. If not, a copy
31 # can be downloaded from http://www.gnu.org/licenses/gpl.html, or
32 # obtained by writing to the Free Software Foundation, Inc.,
33 # 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
36 # The names of the tagged configurations supported by this script.
39 # ### BEGIN LIBTOOL CONFIG
41 # Which release of libtool.m4 was used?
45 # Whether or not to build shared libraries.
46 build_libtool_libs=yes
48 # Whether or not to build static libraries.
51 # What type of objects to build.
54 # Whether or not to optimize for fast installation.
59 host=i386-apple-darwin9.4.0
64 build=i386-apple-darwin9.4.0
67 # A sed program that does not truncate output.
70 # Sed that helps us avoid accidentally triggering echo(1) options like -n.
71 Xsed="$SED -e 1s/^X//"
73 # A grep program that handles long lines.
77 EGREP="/usr/bin/grep -E"
79 # A literal string matcher.
80 FGREP="/usr/bin/grep -F"
82 # A BSD- or MS-compatible name lister.
85 # Whether we need soft or hard links.
88 # What is the maximum length of a command?
91 # Object file suffix (normally "o").
94 # Executable file suffix (normally "").
97 # whether the shell understands "unset".
100 # turn spaces into newlines.
101 SP2NL="tr \\040 \\012"
103 # turn newlines into spaces.
104 NL2SP="tr \\015\\012 \\040\\040"
106 # How to create reloadable object files.
108 reload_cmds="\$LTCC \$LTCFLAGS -nostdlib \${wl}-r -o \$output\$reload_objs"
110 # Method to check whether dependent libraries are shared objects.
111 deplibs_check_method="pass_all"
113 # Command to use when deplibs_check_method == "file_magic".
114 file_magic_cmd="\$MAGIC_CMD"
120 # A symbol stripping program.
123 # Commands used to install an old-style archive.
125 old_postinstall_cmds="chmod 644 \$oldlib~\$RANLIB \$oldlib"
126 old_postuninstall_cmds=""
131 # LTCC compiler flags.
134 # Take the output of nm and produce a listing of raw symbols and C names.
135 global_symbol_pipe="sed -n -e 's/^.*[ ]\\([BCDEGRST][BCDEGRST]*\\)[ ][ ]*_\\([_A-Za-z][_A-Za-z0-9]*\\)\$/\\1 _\\2 \\2/p'"
137 # Transform the output of nm in a proper C declaration.
138 global_symbol_to_cdecl="sed -n -e 's/^T .* \\(.*\\)\$/extern int \\1();/p' -e 's/^[BCDEGRST]* .* \\(.*\\)\$/extern char \\1;/p'"
140 # Transform the output of nm in a C name address pair.
141 global_symbol_to_c_name_address="sed -n -e 's/^: \\([^ ]*\\) \$/ {\\\"\\1\\\", (void *) 0},/p' -e 's/^[BCDEGRST]* \\([^ ]*\\) \\([^ ]*\\)\$/ {\"\\2\", (void *) \\&\\2},/p'"
143 # Transform the output of nm in a C name address pair when lib prefix is needed.
144 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'"
146 # The name of the directory that contains temporary libtool files.
149 # Shell to use when invoking shell scripts.
152 # An echo program that does not interpret backslashes.
155 # Used to examine libraries when file_magic_cmd begins with "file".
158 # Must we lock files when doing compilation?
161 # Tool to manipulate archived DWARF debug symbol files on Mac OS X.
164 # Tool to change global to local symbols on Mac OS X.
167 # Old archive suffix (normally "a").
170 # Shared library suffix (normally ".so").
171 shrext_cmds="\`test .\$module = .yes && echo .so || echo .dylib\`"
173 # The commands to extract the exported symbol list from a shared archive.
174 extract_expsyms_cmds=""
176 # Variables whose values should be saved in libtool wrapper scripts and
177 # restored at link time.
178 variables_saved_for_relink="PATH DYLD_LIBRARY_PATH GCC_EXEC_PREFIX COMPILER_PATH LIBRARY_PATH"
180 # Do we need the "lib" prefix for modules?
183 # Do we need a version for libraries?
186 # Library versioning type.
189 # Shared library runtime path variable.
192 # Shared library path variable.
193 shlibpath_var=DYLD_LIBRARY_PATH
195 # Is shlibpath searched before the hard-coded library search path?
196 shlibpath_overrides_runpath=yes
198 # Format of library name prefix.
199 libname_spec="lib\$name"
201 # List of archive names. First name is the real one, the rest are links.
202 # The last name is the one that the linker finds with -lNAME
203 library_names_spec="\${libname}\${release}\${major}\$shared_ext \${libname}\$shared_ext"
205 # The coded name of the library, if different from the real name.
206 soname_spec="\${libname}\${release}\${major}\$shared_ext"
208 # Command to use after installation of a shared archive.
211 # Command to use after uninstallation of a shared archive.
212 postuninstall_cmds=""
214 # Commands used to finish a libtool library installation in a directory.
217 # As "finish_cmds", except a single script fragment to be evaled but
221 # Whether we should hardcode library paths into libraries.
222 hardcode_into_libs=no
224 # Compile-time system search path for libraries.
225 sys_lib_search_path_spec="/usr/lib/i686-apple-darwin9/4.0.1 /usr/lib /usr/lib/gcc/i686-apple-darwin9/4.0.1 /usr/local/lib"
227 # Run-time system search path for libraries.
228 sys_lib_dlsearch_path_spec="/usr/local/lib /lib /usr/lib"
230 # Whether dlopen is supported.
231 dlopen_support=unknown
233 # Whether dlopen of programs is supported.
236 # Whether dlopen of statically linked programs is supported.
237 dlopen_self_static=unknown
239 # Commands to strip libraries.
240 old_striplib="strip -S"
244 # The linker used to build libraries.
245 LD="/usr/libexec/gcc/i686-apple-darwin9/4.0.1/ld"
247 # Commands used to build an old-style archive.
248 old_archive_cmds="\$AR \$AR_FLAGS \$oldlib\$oldobjs~\$RANLIB \$oldlib"
250 # A language specific compiler.
253 # Is the compiler the GNU compiler?
256 # Compiler flag to turn off builtin functions.
257 no_builtin_flag=" -fno-builtin"
259 # How to pass a linker flag through the compiler.
262 # Additional compiler flags for building library objects.
263 pic_flag=" -fno-common -DPIC"
265 # Compiler flag to prevent dynamic linking.
268 # Does compiler simultaneously support -c and -o options?
271 # Whether or not to add -lc for building shared libraries.
272 build_libtool_need_lc=no
274 # Whether or not to disallow shared libs when runtime libs are static.
275 allow_libtool_libs_with_static_runtimes=no
277 # Compiler flag to allow reflexive dlopens.
278 export_dynamic_flag_spec=""
280 # Compiler flag to generate shared objects directly from archives.
281 whole_archive_flag_spec=""
283 # Whether the compiler copes with passing no objects directly.
284 compiler_needs_object="no"
286 # Create an old-style archive from a shared archive.
287 old_archive_from_new_cmds=""
289 # Create a temporary old-style archive to link instead of a shared archive.
290 old_archive_from_expsyms_cmds=""
292 # Commands used to build a shared archive.
293 archive_cmds="\$CC -dynamiclib \$allow_undefined_flag -o \$lib \$libobjs \$deplibs \$compiler_flags -install_name \$rpath/\$soname \$verstring \$single_module~\$DSYMUTIL \$lib || :"
294 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~\$DSYMUTIL \$lib || :"
296 # Commands used to build a loadable module if different from building
298 module_cmds="\$CC \$allow_undefined_flag -o \$lib -bundle \$libobjs \$deplibs \$compiler_flags~\$DSYMUTIL \$lib || :"
299 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~\$DSYMUTIL \$lib || :"
301 # Whether we are building with GNU ld or not.
304 # Flag that allows shared libraries with undefined symbols to be built.
305 allow_undefined_flag="\${wl}-undefined \${wl}dynamic_lookup"
307 # Flag that enforces no undefined symbols.
310 # Flag to hardcode $libdir into a binary during linking.
311 # This must work even if $libdir does not exist
312 hardcode_libdir_flag_spec=""
314 # If ld is used when linking, flag to hardcode $libdir into a binary
315 # during linking. This must work even if $libdir does not exist.
316 hardcode_libdir_flag_spec_ld=""
318 # Whether we need a single "-rpath" flag with a separated argument.
319 hardcode_libdir_separator=""
321 # Set to "yes" if using DIR/libNAME${shared_ext} during linking hardcodes
322 # DIR into the resulting binary.
325 # Set to "yes" if using DIR/libNAME${shared_ext} during linking hardcodes
326 # DIR into the resulting binary and the resulting library dependency is
327 # "absolute",i.e impossible to change by setting ${shlibpath_var} if the
328 # library is relocated.
329 hardcode_direct_absolute=no
331 # Set to "yes" if using the -LDIR flag during linking hardcodes DIR
332 # into the resulting binary.
335 # Set to "yes" if using SHLIBPATH_VAR=DIR during linking hardcodes DIR
336 # into the resulting binary.
337 hardcode_shlibpath_var=unsupported
339 # Set to "yes" if building a shared library automatically hardcodes DIR
340 # into the library and all subsequent libraries and executables linked
342 hardcode_automatic=yes
344 # Set to yes if linker adds runtime paths of dependent libraries
345 # to runtime path list.
348 # Whether libtool must link a program against all its dependency libraries.
351 # Fix the shell variable $srcfile for the compiler.
354 # Set to "yes" if exported symbols are required.
355 always_export_symbols=no
357 # The commands to list exported symbols.
358 export_symbols_cmds="\$NM \$libobjs \$convenience | \$global_symbol_pipe | \$SED 's/.* //' | sort | uniq > \$export_symbols"
360 # Symbols that should not be listed in the preloaded symbols.
361 exclude_expsyms="_GLOBAL_OFFSET_TABLE_|_GLOBAL__F[ID]_.*"
363 # Symbols that must always be exported.
366 # Commands necessary for linking programs (against libraries) with templates.
369 # Specify filename containing input files.
372 # How to hardcode a shared library path into an executable.
373 hardcode_action=immediate
375 # ### END LIBTOOL CONFIG
377 # Generated from ltmain.m4sh.
379 # ltmain.sh (GNU libtool) 2.2
380 # Written by Gordon Matzigkeit <gord@gnu.ai.mit.edu>, 1996
382 # Copyright (C) 1996, 1997, 1998, 1999, 2000, 2001, 2003, 2004, 2005, 2006, 2007 2008 Free Software Foundation, Inc.
383 # This is free software; see the source for copying conditions. There is NO
384 # warranty; not even for MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
386 # GNU Libtool is free software; you can redistribute it and/or modify
387 # it under the terms of the GNU General Public License as published by
388 # the Free Software Foundation; either version 2 of the License, or
389 # (at your option) any later version.
391 # As a special exception to the GNU General Public License,
392 # if you distribute this file as part of a program or library that
393 # is built using GNU Libtool, you may include this file under the
394 # same distribution terms that you use for the rest of that program.
396 # GNU Libtool is distributed in the hope that it will be useful, but
397 # WITHOUT ANY WARRANTY; without even the implied warranty of
398 # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
399 # General Public License for more details.
401 # You should have received a copy of the GNU General Public License
402 # along with GNU Libtool; see the file COPYING. If not, a copy
403 # can be downloaded from http://www.gnu.org/licenses/gpl.html,
404 # or obtained by writing to the Free Software Foundation, Inc.,
405 # 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
407 # Usage: $progname [OPTION]... [MODE-ARG]...
409 # Provide generalized library-building support services.
411 # --config show all configuration variables
412 # --debug enable verbose shell tracing
413 # -n, --dry-run display commands without modifying any files
414 # --features display basic configuration information and exit
415 # --mode=MODE use operation mode MODE
416 # --preserve-dup-deps don't remove duplicate dependency libraries
417 # --quiet, --silent don't print informational messages
418 # --tag=TAG use configuration variables from tag TAG
419 # -v, --verbose print informational messages (default)
420 # --version print version information
421 # -h, --help print short or long help message
423 # MODE must be one of the following:
425 # clean remove files from the build directory
426 # compile compile a source file into a libtool object
427 # execute automatically set library path, then run a program
428 # finish complete the installation of libtool libraries
429 # install install libraries or executables
430 # link create a library or an executable
431 # uninstall remove libraries from an installed directory
433 # MODE-ARGS vary depending on the MODE.
434 # Try `$progname --help --mode=MODE' for a more detailed description of MODE.
436 # When reporting a bug, please describe a test case to reproduce it and
437 # include the following information:
439 # host-triplet: $host
442 # compiler flags: $LTCFLAGS
443 # linker: $LD (gnu? $with_gnu_ld)
444 # $progname: (GNU libtool) 2.2
445 # automake: $automake_version
446 # autoconf: $autoconf_version
448 # Report bugs to <bug-libtool@gnu.org>.
454 package_revision=1.2599
456 # Be Bourne compatible
457 if test -n "${ZSH_VERSION+set}" && (emulate sh) >/dev/null 2>&1; then
460 # Zsh 3.x and 4.x performs word splitting on ${1+"$@"}, which
461 # is contrary to our usage. Disable this feature.
462 alias -g '${1+"$@"}'='"$@"'
465 case `(set -o) 2>/dev/null` in *posix*) set -o posix;; esac
467 BIN_SH=xpg4; export BIN_SH # for Tru64
468 DUALCASE=1; export DUALCASE # for MKS sh
470 # NLS nuisances: We save the old values to restore during execute mode.
471 # Only set LANG and LC_ALL to C if already set.
472 # These must not be set unconditionally because not all systems understand
473 # e.g. LANG=C (notably SCO).
474 for lt_var in LANG LANGUAGE LC_ALL LC_CTYPE LC_COLLATE LC_MESSAGES
476 eval "if test \"\${$lt_var+set}\" = set; then
477 save_$lt_var=\$$lt_var
491 : ${EGREP="/usr/bin/grep -E"}
492 : ${FGREP="/usr/bin/grep -F"}
493 : ${GREP="/usr/bin/grep"}
499 : ${SED="/usr/bin/sed"}
500 : ${SHELL="${CONFIG_SHELL-/bin/sh}"}
501 : ${Xsed="$SED -e 1s/^X//"}
506 EXIT_MISMATCH=63 # $? = 63 is used to indicate version mismatch to missing.
507 EXIT_SKIP=77 # $? = 77 is used to indicate a skipped test to automake.
509 exit_status=$EXIT_SUCCESS
511 # Make sure IFS has a sensible default
516 dirname="s,/[^/]*$,,"
519 # Work around backward compatibility issue on IRIX 6.5. On IRIX 6.4+, sh
520 # is ksh but when the shell is invoked as "sh" and the current value of
521 # the _XPG environment variable is not equal to 1 (one), the special
522 # positional parameter $0, within a function call, is the name of the
526 # The name of this program:
527 # In the unlikely event $progname began with a '-', it would play havoc with
528 # func_echo (imagine progname=-n), so we prepend ./ in that case:
529 progname=`$ECHO "X$progpath" | $Xsed -e "$basename" -e 's,^-,./-,'`
531 # Make sure we have an absolute path for reexecution:
533 [\\/]*|[A-Za-z]:\\*) ;;
535 progdir=`$ECHO "X$progpath" | $Xsed -e "$dirname"`
536 progdir=`cd "$progdir" && pwd`
537 progpath="$progdir/$progname"
542 for progdir in $PATH; do
544 test -x "$progdir/$progname" && break
547 test -n "$progdir" || progdir=`pwd`
548 progpath="$progdir/$progname"
552 # Sed substitution that helps us do robust quoting. It backslashifies
553 # metacharacters that are still active within double-quoted strings.
554 Xsed="${SED}"' -e 1s/^X//'
555 sed_quote_subst='s/\([`"$\\]\)/\\\1/g'
557 # Same as above, but do not quote variable references.
558 double_quote_subst='s/\(["`\\]\)/\\\1/g'
560 # Re-`\' parameter expansions in output of double_quote_subst that were
561 # `\'-ed in input to the same. If an odd number of `\' preceded a '$'
562 # in input to double_quote_subst, that '$' was protected from expansion.
563 # Since each input `\' is now two `\'s, look for any number of runs of
564 # four `\'s followed by two `\'s and then a '$'. `\' that '$'.
569 sed_double_backslash="\
573 s/\\([^$bs]\\)$bs2$dollar/\\1$bs2$bs$dollar/g
583 # Echo program name prefixed message, along with the current mode
584 # name if it has been set yet.
587 $ECHO "$progname${mode+: }$mode: $*"
590 # func_verbose arg...
591 # Echo program name prefixed message in verbose mode only.
594 $opt_verbose && func_echo ${1+"$@"}
596 # A bug in bash halts the script if the last line of a function
597 # fails when set -e is in force, so we need another command to
603 # Echo program name prefixed message to standard error.
606 $ECHO "$progname${mode+: }$mode: "${1+"$@"} 1>&2
609 # func_warning arg...
610 # Echo program name prefixed warning message to standard error.
613 $ECHO "$progname${mode+: }$mode: warning: "${1+"$@"} 1>&2
616 # func_fatal_error arg...
617 # Echo program name prefixed message to standard error, and exit.
624 # func_fatal_help arg...
625 # Echo program name prefixed message to standard error, followed by
626 # a help hint, and exit.
630 func_fatal_error "$help"
632 help="Try \`$progname --help' for more information." ## default
635 # func_grep expression filename
636 # Check whether EXPRESSION matches any line of FILENAME, without output.
639 $GREP "$1" "$2" >/dev/null 2>&1
643 # func_mkdir_p directory-path
644 # Make sure the entire path to DIRECTORY-PATH is available.
647 my_directory_path="$1"
650 if test -n "$my_directory_path" && test "$opt_dry_run" != ":"; then
652 # Protect directory names starting with `-'
653 case $my_directory_path in
654 -*) my_directory_path="./$my_directory_path" ;;
657 # While some portion of DIR does not yet exist...
658 while test ! -d "$my_directory_path"; do
659 # ...make a list in topmost first order. Use a colon delimited
660 # list incase some portion of path contains whitespace.
661 my_dir_list="$my_directory_path:$my_dir_list"
663 # If the last portion added has no slash in it, the list is done
664 case $my_directory_path in */*) ;; *) break ;; esac
666 # ...otherwise throw away the child directory and loop
667 my_directory_path=`$ECHO "X$my_directory_path" | $Xsed -e "$dirname"`
669 my_dir_list=`$ECHO "X$my_dir_list" | $Xsed -e 's,:*$,,'`
671 save_mkdir_p_IFS="$IFS"; IFS=':'
672 for my_dir in $my_dir_list; do
673 IFS="$save_mkdir_p_IFS"
674 # mkdir can fail with a `File exist' error if two processes
675 # try to create one of the directories concurrently. Don't
677 $MKDIR "$my_dir" 2>/dev/null || :
679 IFS="$save_mkdir_p_IFS"
681 # Bail out if we (or some other process) failed to create a directory.
682 test -d "$my_directory_path" || \
683 func_fatal_error "Failed to create \`$1'"
688 # func_mktempdir [string]
689 # Make a temporary directory that won't clash with other running
690 # libtool processes, and avoids race conditions if possible. If
691 # given, STRING is the basename for that directory.
694 my_template="${TMPDIR-/tmp}/${1-$progname}"
696 if test "$opt_dry_run" = ":"; then
697 # Return a directory name, but don't create it in dry-run mode
698 my_tmpdir="${my_template}-$$"
701 # If mktemp works, use that first and foremost
702 my_tmpdir=`mktemp -d "${my_template}-XXXXXXXX" 2>/dev/null`
704 if test ! -d "$my_tmpdir"; then
705 # Failing that, at least try and use $RANDOM to avoid a race
706 my_tmpdir="${my_template}-${RANDOM-0}$$"
708 save_mktempdir_umask=`umask`
711 umask $save_mktempdir_umask
714 # If we're not in dry-run mode, bomb out on failure
715 test -d "$my_tmpdir" || \
716 func_fatal_error "cannot create temporary directory \`$my_tmpdir'"
719 $ECHO "X$my_tmpdir" | $Xsed
723 # func_quote_for_eval arg
724 # Aesthetically quote ARG to be evaled later.
725 # This function returns two values: FUNC_QUOTE_FOR_EVAL_RESULT
726 # is double-quoted, suitable for a subsequent eval, whereas
727 # FUNC_QUOTE_FOR_EVAL_UNQUOTED_RESULT has merely all characters
728 # which are still active within double quotes backslashified.
729 func_quote_for_eval ()
733 func_quote_for_eval_unquoted_result=`$ECHO "X$1" | $Xsed -e "$sed_quote_subst"` ;;
735 func_quote_for_eval_unquoted_result="$1" ;;
738 case $func_quote_for_eval_unquoted_result in
739 # Double-quote args containing shell metacharacters to delay
740 # word splitting, command substitution and and variable
741 # expansion for a subsequent eval.
742 # Many Bourne shells cannot handle close brackets correctly
743 # in scan sets, so we specify it separately.
744 *[\[\~\#\^\&\*\(\)\{\}\|\;\<\>\?\'\ \ ]*|*]*|"")
745 func_quote_for_eval_result="\"$func_quote_for_eval_unquoted_result\""
748 func_quote_for_eval_result="$func_quote_for_eval_unquoted_result"
753 # func_quote_for_expand arg
754 # Aesthetically quote ARG to be evaled later; same as above,
755 # but do not quote variable references.
756 func_quote_for_expand ()
760 my_arg=`$ECHO "X$1" | $Xsed \
761 -e "$double_quote_subst" -e "$sed_double_backslash"` ;;
767 # Double-quote args containing shell metacharacters to delay
768 # word splitting and command substitution for a subsequent eval.
769 # Many Bourne shells cannot handle close brackets correctly
770 # in scan sets, so we specify it separately.
771 *[\[\~\#\^\&\*\(\)\{\}\|\;\<\>\?\'\ \ ]*|*]*|"")
776 func_quote_for_expand_result="$my_arg"
780 # func_show_eval cmd [fail_exp]
781 # Unless opt_silent is true, then output CMD. Then, if opt_dryrun is
782 # not true, evaluate CMD. If the evaluation of CMD fails, and FAIL_EXP
783 # is given, then evaluate it.
789 ${opt_silent-false} || {
790 func_quote_for_expand "$my_cmd"
791 eval "func_echo $func_quote_for_expand_result"
794 if ${opt_dry_run-false}; then :; else
797 if test "$my_status" -eq 0; then :; else
798 eval "(exit $my_status); $my_fail_exp"
808 # Echo version message to standard output and exit.
811 $SED -n '/^# '$PROGRAM' (GNU /,/# warranty; / {
814 s/\((C)\)[ 0-9,-]*\( [1-9][0-9]*\)/\1\2/
821 # Echo short help message to standard output and exit.
824 $SED -n '/^# Usage:/,/# -h/ {
827 s/\$progname/'$progname'/
831 $ECHO "run \`$progname --help | more' for full usage"
836 # Echo long help message to standard output and exit.
839 $SED -n '/^# Usage:/,/# Report bugs to/ {
842 s*\$progname*'$progname'*
844 s*\$SHELL*'"$SHELL"'*
846 s*\$LTCFLAGS*'"$LTCFLAGS"'*
848 s/\$with_gnu_ld/'"$with_gnu_ld"'/
849 s/\$automake_version/'"`(automake --version) 2>/dev/null |$SED 1q`"'/
850 s/\$autoconf_version/'"`(autoconf --version) 2>/dev/null |$SED 1q`"'/
856 # func_missing_arg argname
857 # Echo program name prefixed message to standard error and set global
861 func_error "missing argument for $1"
871 # Check that we have a working $ECHO.
872 if test "X$1" = X--no-reexec; then
873 # Discard the --no-reexec flag, and continue.
875 elif test "X$1" = X--fallback-echo; then
876 # Avoid inline document here, it may be left over
878 elif test "X`{ $ECHO '\t'; } 2>/dev/null`" = 'X\t'; then
879 # Yippee, $ECHO works!
882 # Restart under the correct shell, and then maybe $ECHO will work.
883 exec $SHELL "$progpath" --no-reexec ${1+"$@"}
886 if test "X$1" = X--fallback-echo; then
887 # used as fallback echo
895 magic="%%%MAGIC variable%%%"
896 magic_exe="%%%MAGIC EXE variable%%%"
903 lo2o="s/\\.lo\$/.${objext}/"
904 o2lo="s/\\.${objext}\$/.lo/"
909 opt_duplicate_deps=false
913 # If this variable is set in any of the actions, the command in it
914 # will be execed at the end. This prevents here-documents from being
915 # left over by shells.
918 # func_fatal_configuration arg...
919 # Echo program name prefixed message to standard error, followed by
920 # a configuration failure hint, and exit.
921 func_fatal_configuration ()
924 func_error "See the $PACKAGE documentation for more information."
925 func_fatal_error "Fatal configuration error."
930 # Display the configuration for all the tags in this script.
933 re_begincf='^# ### BEGIN LIBTOOL'
934 re_endcf='^# ### END LIBTOOL'
936 # Default configuration.
937 $SED "1,/$re_begincf CONFIG/d;/$re_endcf CONFIG/,\$d" < "$progpath"
939 # Now print the configurations for the tags.
940 for tagname in $taglist; do
941 $SED -n "/$re_begincf TAG CONFIG: $tagname\$/,/$re_endcf TAG CONFIG: $tagname\$/p" < "$progpath"
948 # Display the features supported by this script.
952 if test "$build_libtool_libs" = yes; then
953 $ECHO "enable shared libraries"
955 $ECHO "disable shared libraries"
957 if test "$build_old_libs" = yes; then
958 $ECHO "enable static libraries"
960 $ECHO "disable static libraries"
966 # func_enable_tag tagname
967 # Verify that TAGNAME is valid, and either flag an error and exit, or
968 # enable the TAGNAME tag. We also add TAGNAME to the global $taglist
975 re_begincf="^# ### BEGIN LIBTOOL TAG CONFIG: $tagname\$"
976 re_endcf="^# ### END LIBTOOL TAG CONFIG: $tagname\$"
977 sed_extractcf="/$re_begincf/,/$re_endcf/p"
982 func_fatal_error "invalid tag name: $tagname"
986 # Don't test for the "default" C tag, as we know it's
987 # there but not specially marked.
991 if $GREP "$re_begincf" "$progpath" >/dev/null 2>&1; then
992 taglist="$taglist $tagname"
994 # Evaluate the configuration. Be careful to quote the path
995 # and the sed script, to avoid splitting on whitespace, but
996 # also don't use non-portable quotes within backquotes within
997 # quotes we have to do it in 2 steps:
998 extractedcf=`$SED -n -e "$sed_extractcf" < "$progpath"`
1001 func_error "ignoring unknown tag $tagname"
1010 # We need to display help for each of the modes.
1013 # Generic help is extracted from the usage comments
1014 # at the start of this file.
1020 "Usage: $progname [OPTION]... --mode=clean RM [RM-OPTION]... FILE...
1022 Remove files from the build directory.
1024 RM is the name of the program to use to delete files associated with each FILE
1025 (typically \`/bin/rm'). RM-OPTIONS are options (such as \`-f') to be passed
1028 If FILE is a libtool library, object or program, all the files associated
1029 with it are deleted. Otherwise, only FILE itself is deleted using RM."
1034 "Usage: $progname [OPTION]... --mode=compile COMPILE-COMMAND... SOURCEFILE
1036 Compile a source file into a libtool library object.
1038 This mode accepts the following additional options:
1040 -o OUTPUT-FILE set the output file name to OUTPUT-FILE
1041 -no-suppress do not suppress compiler output for multiple passes
1042 -prefer-pic try to building PIC objects only
1043 -prefer-non-pic try to building non-PIC objects only
1044 -shared do not build a \`.o' file suitable for static linking
1045 -static only build a \`.o' file suitable for static linking
1047 COMPILE-COMMAND is a command to be used in creating a \`standard' object file
1048 from the given SOURCEFILE.
1050 The output file name is determined by removing the directory component from
1051 SOURCEFILE, then substituting the C source code suffix \`.c' with the
1052 library object suffix, \`.lo'."
1057 "Usage: $progname [OPTION]... --mode=execute COMMAND [ARGS]...
1059 Automatically set library path, then run a program.
1061 This mode accepts the following additional options:
1063 -dlopen FILE add the directory containing FILE to the library path
1065 This mode sets the library path environment variable according to \`-dlopen'
1068 If any of the ARGS are libtool executable wrappers, then they are translated
1069 into their corresponding uninstalled binary, and any of their required library
1070 directories are added to the library path.
1072 Then, COMMAND is executed, with ARGS as arguments."
1077 "Usage: $progname [OPTION]... --mode=finish [LIBDIR]...
1079 Complete the installation of libtool libraries.
1081 Each LIBDIR is a directory that contains libtool libraries.
1083 The commands that this mode executes may require superuser privileges. Use
1084 the \`--dry-run' option if you just want to see what would be executed."
1089 "Usage: $progname [OPTION]... --mode=install INSTALL-COMMAND...
1091 Install executables or libraries.
1093 INSTALL-COMMAND is the installation command. The first component should be
1094 either the \`install' or \`cp' program.
1096 The following components of INSTALL-COMMAND are treated specially:
1098 -inst-prefix PREFIX-DIR Use PREFIX-DIR as a staging area for installation
1100 The rest of the components are interpreted as arguments to that command (only
1101 BSD-compatible install options are recognized)."
1106 "Usage: $progname [OPTION]... --mode=link LINK-COMMAND...
1108 Link object files or libraries together to form another library, or to
1109 create an executable program.
1111 LINK-COMMAND is a command using the C compiler that you would use to create
1112 a program from several object files.
1114 The following components of LINK-COMMAND are treated specially:
1116 -all-static do not do any dynamic linking at all
1117 -avoid-version do not add a version suffix if possible
1118 -dlopen FILE \`-dlpreopen' FILE if it cannot be dlopened at runtime
1119 -dlpreopen FILE link in FILE and add its symbols to lt_preloaded_symbols
1120 -export-dynamic allow symbols from OUTPUT-FILE to be resolved with dlsym(3)
1121 -export-symbols SYMFILE
1122 try to export only the symbols listed in SYMFILE
1123 -export-symbols-regex REGEX
1124 try to export only the symbols matching REGEX
1125 -LLIBDIR search LIBDIR for required installed libraries
1126 -lNAME OUTPUT-FILE requires the installed library libNAME
1127 -module build a library that can dlopened
1128 -no-fast-install disable the fast-install mode
1129 -no-install link a not-installable executable
1130 -no-undefined declare that a library does not refer to external symbols
1131 -o OUTPUT-FILE create OUTPUT-FILE from the specified objects
1132 -objectlist FILE Use a list of object files found in FILE to specify objects
1133 -precious-files-regex REGEX
1134 don't remove output files matching REGEX
1135 -release RELEASE specify package release information
1136 -rpath LIBDIR the created library will eventually be installed in LIBDIR
1137 -R[ ]LIBDIR add LIBDIR to the runtime path of programs and libraries
1138 -shared only do dynamic linking of libtool libraries
1139 -shrext SUFFIX override the standard shared library file extension
1140 -static do not do any dynamic linking of uninstalled libtool libraries
1141 -static-libtool-libs
1142 do not do any dynamic linking of libtool libraries
1143 -version-info CURRENT[:REVISION[:AGE]]
1144 specify library version info [each variable defaults to 0]
1145 -weak LIBNAME declare that the target provides the LIBNAME interface
1147 All other options (arguments beginning with \`-') are ignored.
1149 Every other argument is treated as a filename. Files ending in \`.la' are
1150 treated as uninstalled libtool libraries, other files are standard or library
1153 If the OUTPUT-FILE ends in \`.la', then a libtool library is created,
1154 only library objects (\`.lo' files) may be specified, and \`-rpath' is
1155 required, except when creating a convenience library.
1157 If OUTPUT-FILE ends in \`.a' or \`.lib', then a standard library is created
1158 using \`ar' and \`ranlib', or on Windows using \`lib'.
1160 If OUTPUT-FILE ends in \`.lo' or \`.${objext}', then a reloadable object file
1161 is created, otherwise an executable program is created."
1166 "Usage: $progname [OPTION]... --mode=uninstall RM [RM-OPTION]... FILE...
1168 Remove libraries from an installation directory.
1170 RM is the name of the program to use to delete files associated with each FILE
1171 (typically \`/bin/rm'). RM-OPTIONS are options (such as \`-f') to be passed
1174 If FILE is a libtool library, all the files associated with it are deleted.
1175 Otherwise, only FILE itself is deleted using RM."
1179 func_fatal_help "invalid operation mode \`$mode'"
1184 $ECHO "Try \`$progname --help' for more information about other modes."
1189 # Generated shell functions inserted here.
1190 # func_dirname file append nondir_replacement
1191 # Compute the dirname of FILE. If nonempty, add APPEND to the result,
1192 # otherwise set result to NONDIR_REPLACEMENT.
1196 */*) func_dirname_result="${1%/*}${2}" ;;
1197 * ) func_dirname_result="${3}" ;;
1201 # func_basename file
1204 func_basename_result="${1##*/}"
1207 # func_dirname_and_basename file append nondir_replacement
1208 # perform func_basename and func_dirname in a single function
1210 # dirname: Compute the dirname of FILE. If nonempty,
1211 # add APPEND to the result, otherwise set result
1212 # to NONDIR_REPLACEMENT.
1213 # value returned in "$func_dirname_result"
1214 # basename: Compute filename of FILE.
1215 # value retuned in "$func_basename_result"
1216 # Implementation must be kept synchronized with func_dirname
1217 # and func_basename. For efficiency, we do not delegate to
1218 # those functions but instead duplicate the functionality here.
1219 func_dirname_and_basename ()
1222 */*) func_dirname_result="${1%/*}${2}" ;;
1223 * ) func_dirname_result="${3}" ;;
1225 func_basename_result="${1##*/}"
1228 # func_stripname prefix suffix name
1229 # strip PREFIX and SUFFIX off of NAME.
1230 # PREFIX and SUFFIX must not contain globbing or regex special
1231 # characters, hashes, percent signs, but SUFFIX may contain a leading
1232 # dot (in which case that matches only a dot).
1235 # pdksh 5.2.14 does not do ${X%$Y} correctly if both X and Y are
1236 # positional parameters, so assign one to ordinary parameter first.
1237 func_stripname_result=${3}
1238 func_stripname_result=${func_stripname_result#"${1}"}
1239 func_stripname_result=${func_stripname_result%"${2}"}
1245 func_opt_split_opt=${1%%=*}
1246 func_opt_split_arg=${1#*=}
1253 *.lo) func_lo2o_result=${1%.lo}.${objext} ;;
1254 *) func_lo2o_result=${1} ;;
1258 # func_append var value
1259 # Append VALUE to the end of shell variable VAR.
1264 # Generated shell functions inserted here.
1267 # Parse options once, thoroughly. This comes as soon as possible in
1268 # the script to make things like `libtool --version' happen quickly.
1271 # Shorthand for --mode=foo, only valid as the first argument
1274 shift; set dummy --mode clean ${1+"$@"}; shift
1276 compile|compil|compi|comp|com|co|c)
1277 shift; set dummy --mode compile ${1+"$@"}; shift
1279 execute|execut|execu|exec|exe|ex|e)
1280 shift; set dummy --mode execute ${1+"$@"}; shift
1282 finish|finis|fini|fin|fi|f)
1283 shift; set dummy --mode finish ${1+"$@"}; shift
1285 install|instal|insta|inst|ins|in|i)
1286 shift; set dummy --mode install ${1+"$@"}; shift
1289 shift; set dummy --mode link ${1+"$@"}; shift
1291 uninstall|uninstal|uninsta|uninst|unins|unin|uni|un|u)
1292 shift; set dummy --mode uninstall ${1+"$@"}; shift
1296 # Parse non-mode specific arguments:
1297 while test "$#" -gt 0; do
1302 --config) func_config ;;
1304 --debug) preserve_args="$preserve_args $opt"
1305 func_echo "enabling shell trace mode"
1310 -dlopen) test "$#" -eq 0 && func_missing_arg "$opt" && break
1311 execute_dlfiles="$execute_dlfiles $1"
1315 --dry-run | -n) opt_dry_run=: ;;
1316 --features) func_features ;;
1317 --finish) mode="finish" ;;
1319 --mode) test "$#" -eq 0 && func_missing_arg "$opt" && break
1321 # Valid mode arguments:
1331 # Catch anything else as an error
1332 *) func_error "invalid argument for $opt"
1342 --preserve-dup-deps)
1343 opt_duplicate_deps=: ;;
1345 --quiet|--silent) preserve_args="$preserve_args $opt"
1349 --verbose| -v) preserve_args="$preserve_args $opt"
1353 --tag) test "$#" -eq 0 && func_missing_arg "$opt" && break
1354 preserve_args="$preserve_args $opt $1"
1355 func_enable_tag "$1" # tagname is set here
1359 # Separate optargs to long options:
1360 -dlopen=*|--mode=*|--tag=*)
1361 func_opt_split "$opt"
1362 set dummy "$func_opt_split_opt" "$func_opt_split_arg" ${1+"$@"}
1366 -\?|-h) func_usage ;;
1367 --help) opt_help=: ;;
1368 --version) func_version ;;
1370 -*) func_fatal_help "unrecognized option \`$opt'" ;;
1378 # Now that we've collected a possible --mode arg, show help if necessary
1379 $opt_help && func_mode_help
1382 *cygwin* | *mingw* | *pw32*)
1383 # don't eliminate duplications in $postdeps and $predeps
1384 opt_duplicate_compiler_generated_deps=:
1387 opt_duplicate_compiler_generated_deps=$opt_duplicate_deps
1391 # Having warned about all mis-specified options, bail out if
1392 # anything was wrong.
1393 $exit_cmd $EXIT_FAILURE
1396 # func_check_version_match
1397 # Ensure that we are using m4 macros, and libtool script from the same
1398 # release of libtool.
1399 func_check_version_match ()
1401 if test "$package_revision" != "$macro_revision"; then
1402 if test "$VERSION" != "$macro_version"; then
1403 if test -z "$macro_version"; then
1405 $progname: Version mismatch error. This is $PACKAGE $VERSION, but the
1406 $progname: definition of this LT_INIT comes from an older release.
1407 $progname: You should recreate aclocal.m4 with macros from $PACKAGE $VERSION
1408 $progname: and run autoconf again.
1412 $progname: Version mismatch error. This is $PACKAGE $VERSION, but the
1413 $progname: definition of this LT_INIT comes from $PACKAGE $macro_version.
1414 $progname: You should recreate aclocal.m4 with macros from $PACKAGE $VERSION
1415 $progname: and run autoconf again.
1420 $progname: Version mismatch error. This is $PACKAGE $VERSION, revision $package_revision,
1421 $progname: but the definition of this LT_INIT comes from revision $macro_revision.
1422 $progname: You should recreate aclocal.m4 with macros from revision $package_revision
1423 $progname: of $PACKAGE $VERSION and run autoconf again.
1437 # Sanity checks first:
1438 func_check_version_match
1440 if test "$build_libtool_libs" != yes && test "$build_old_libs" != yes; then
1441 func_fatal_configuration "not configured to build any kind of library"
1444 test -z "$mode" && func_fatal_error "error: you must specify a MODE."
1448 eval std_shrext=\"$shrext_cmds\"
1451 # Only execute mode is allowed to have -dlopen flags.
1452 if test -n "$execute_dlfiles" && test "$mode" != execute; then
1453 func_error "unrecognized option \`-dlopen'"
1458 # Change the help message to a mode-specific one.
1459 generic_help="$help"
1460 help="Try \`$progname --help --mode=$mode' for more information."
1465 # True iff FILE is a libtool `.la' library or `.lo' object file.
1466 # This function is only a basic sanity check; it will hardly flush out
1467 # determined imposters.
1470 $SED -e 4q "$1" 2>/dev/null \
1471 | $GREP "^# Generated by .*$PACKAGE" > /dev/null 2>&1
1474 # func_lalib_unsafe_p file
1475 # True iff FILE is a libtool `.la' library or `.lo' object file.
1476 # This function implements the same check as func_lalib_p without
1477 # resorting to external programs. To this end, it redirects stdin and
1478 # closes it afterwards, without saving the original file descriptor.
1479 # As a safety measure, use it only where a negative result would be
1480 # fatal anyway. Works if `file' does not exist.
1481 func_lalib_unsafe_p ()
1484 if test -r "$1" && exec 5<&1 <"$1"; then
1485 for lalib_p_l in 1 2 3 4
1488 case "$lalib_p_line" in
1489 \#\ Generated\ by\ *$PACKAGE* ) lalib_p=yes; break;;
1494 test "$lalib_p" = yes
1497 # func_ltwrapper_script_p file
1498 # True iff FILE is a libtool wrapper script
1499 # This function is only a basic sanity check; it will hardly flush out
1500 # determined imposters.
1501 func_ltwrapper_script_p ()
1506 # func_ltwrapper_executable_p file
1507 # True iff FILE is a libtool wrapper executable
1508 # This function is only a basic sanity check; it will hardly flush out
1509 # determined imposters.
1510 func_ltwrapper_executable_p ()
1512 func_ltwrapper_exec_suffix=
1515 *) func_ltwrapper_exec_suffix=.exe ;;
1517 $GREP "$magic_exe" "$1$func_ltwrapper_exec_suffix" >/dev/null 2>&1
1520 # func_ltwrapper_scriptname file
1521 # Assumes file is an ltwrapper_executable
1522 # uses $file to determine the appropriate filename for a
1523 # temporary ltwrapper_script.
1524 func_ltwrapper_scriptname ()
1526 func_ltwrapper_scriptname_result=""
1527 if func_ltwrapper_executable_p "$1"; then
1528 func_dirname_and_basename "$1" "" "."
1529 func_stripname '' '.exe' "$func_basename_result"
1530 func_ltwrapper_scriptname_result="$func_dirname_result/$objdir/${func_stripname_result}_ltshwrapper"
1534 # func_ltwrapper_p file
1535 # True iff FILE is a libtool wrapper script or wrapper executable
1536 # This function is only a basic sanity check; it will hardly flush out
1537 # determined imposters.
1540 func_ltwrapper_script_p "$1" || func_ltwrapper_executable_p "$1"
1544 # func_execute_cmds commands fail_cmd
1545 # Execute tilde-delimited COMMANDS.
1546 # If FAIL_CMD is given, eval that upon failure.
1547 # FAIL_CMD may read-access the current command in variable CMD!
1548 func_execute_cmds ()
1551 save_ifs=$IFS; IFS='~'
1555 func_show_eval "$cmd" "${2-:}"
1562 # Source FILE, adding directory component if necessary.
1563 # Note that it is not necessary on cygwin/mingw to append a dot to
1564 # FILE even if both FILE and FILE.exe exist: automatic-append-.exe
1565 # behavior happens only for exec(3), not for open(2)! Also, sourcing
1566 # `FILE.' does not work on cygwin managed mounts.
1571 */* | *\\*) . "$1" ;;
1577 # func_win32_libid arg
1578 # return the library type of file 'arg'
1580 # Need a lot of goo to handle *both* DLLs and import libs
1581 # Has to be a shell function in order to 'eat' the argument
1582 # that is supplied when $file_magic_command is called.
1586 win32_libid_type="unknown"
1587 win32_fileres=`file -L $1 2>/dev/null`
1588 case $win32_fileres in
1589 *ar\ archive\ import\ library*) # definitely import
1590 win32_libid_type="x86 archive import"
1592 *ar\ archive*) # could be an import, or static
1593 if eval $OBJDUMP -f $1 | $SED -e '10q' 2>/dev/null |
1594 $EGREP 'file format pe-i386(.*architecture: i386)?' >/dev/null ; then
1595 win32_nmres=`eval $NM -f posix -A $1 |
1604 case $win32_nmres in
1605 import*) win32_libid_type="x86 archive import";;
1606 *) win32_libid_type="x86 archive static";;
1611 win32_libid_type="x86 DLL"
1613 *executable*) # but shell scripts are "executable" too...
1614 case $win32_fileres in
1615 *MS\ Windows\ PE\ Intel*)
1616 win32_libid_type="x86 DLL"
1621 $ECHO "$win32_libid_type"
1626 # func_infer_tag arg
1627 # Infer tagged configuration to use if any are available and
1628 # if one wasn't chosen via the "--tag" command line option.
1629 # Only attempt this if the compiler in the base compile
1630 # command doesn't match the default compiler.
1631 # arg is usually of the form 'gcc ...'
1635 if test -n "$available_tags" && test -z "$tagname"; then
1638 func_quote_for_eval "$arg"
1639 CC_quoted="$CC_quoted $func_quote_for_eval_result"
1642 # Blanks in the command may have been stripped by the calling shell,
1643 # but not from the CC environment variable when configure was run.
1644 " $CC "* | "$CC "* | " `$ECHO $CC` "* | "`$ECHO $CC` "* | " $CC_quoted"* | "$CC_quoted "* | " `$ECHO $CC_quoted` "* | "`$ECHO $CC_quoted` "*) ;;
1645 # Blanks at the start of $base_compile will cause this to fail
1646 # if we don't check for them as well.
1648 for z in $available_tags; do
1649 if $GREP "^# ### BEGIN LIBTOOL TAG CONFIG: $z$" < "$progpath" > /dev/null; then
1650 # Evaluate the configuration.
1651 eval "`${SED} -n -e '/^# ### BEGIN LIBTOOL TAG CONFIG: '$z'$/,/^# ### END LIBTOOL TAG CONFIG: '$z'$/p' < $progpath`"
1654 # Double-quote args containing other shell metacharacters.
1655 func_quote_for_eval "$arg"
1656 CC_quoted="$CC_quoted $func_quote_for_eval_result"
1659 " $CC "* | "$CC "* | " `$ECHO $CC` "* | "`$ECHO $CC` "* | " $CC_quoted"* | "$CC_quoted "* | " `$ECHO $CC_quoted` "* | "`$ECHO $CC_quoted` "*)
1660 # The compiler in the base compile command matches
1661 # the one in the tagged configuration.
1662 # Assume this is the tagged configuration we want.
1669 # If $tagname still isn't set, then no tagged configuration
1670 # was found and let the user know that the "--tag" command
1671 # line option must be used.
1672 if test -z "$tagname"; then
1673 func_echo "unable to infer tagged configuration"
1674 func_fatal_error "specify a tag with \`--tag'"
1676 # func_verbose "using $tagname tagged configuration"
1685 # func_generate_dlsyms outputname originator pic_p
1686 # Extract symbols from dlprefiles and create ${outputname}S.o with
1687 # a dlpreopen symbol table.
1688 func_generate_dlsyms ()
1694 my_prefix=`$ECHO "$my_originator" | sed 's%[^a-zA-Z0-9]%_%g'`
1697 if test -n "$dlfiles$dlprefiles" || test "$dlself" != no; then
1698 if test -n "$NM" && test -n "$global_symbol_pipe"; then
1699 my_dlsyms="${my_outputname}S.c"
1701 func_error "not configured to extract global symbols from dlpreopened files"
1705 if test -n "$my_dlsyms"; then
1709 # Discover the nlist of each of the dlfiles.
1710 nlist="$output_objdir/${my_outputname}.nm"
1712 func_show_eval "$RM $nlist ${nlist}S ${nlist}T"
1714 # Parse the name list into a source file.
1715 func_verbose "creating $output_objdir/$my_dlsyms"
1717 $opt_dry_run || $ECHO > "$output_objdir/$my_dlsyms" "\
1718 /* $my_dlsyms - symbol resolution table for \`$my_outputname' dlsym emulation. */
1719 /* Generated by $PROGRAM (GNU $PACKAGE$TIMESTAMP) $VERSION */
1725 /* External symbol declarations for the compiler. */\
1728 if test "$dlself" = yes; then
1729 func_verbose "generating symbol list for \`$output'"
1731 $opt_dry_run || echo ': @PROGRAM@ ' > "$nlist"
1733 # Add our own program objects to the symbol list.
1734 progfiles=`$ECHO "X$objs$old_deplibs" | $SP2NL | $Xsed -e "$lo2o" | $NL2SP`
1735 for progfile in $progfiles; do
1736 func_verbose "extracting global C symbols from \`$progfile'"
1737 $opt_dry_run || eval "$NM $progfile | $global_symbol_pipe >> '$nlist'"
1740 if test -n "$exclude_expsyms"; then
1742 eval '$EGREP -v " ($exclude_expsyms)$" "$nlist" > "$nlist"T'
1743 eval '$MV "$nlist"T "$nlist"'
1747 if test -n "$export_symbols_regex"; then
1749 eval '$EGREP -e "$export_symbols_regex" "$nlist" > "$nlist"T'
1750 eval '$MV "$nlist"T "$nlist"'
1754 # Prepare the list of exported symbols
1755 if test -z "$export_symbols"; then
1756 export_symbols="$output_objdir/$outputname.exp"
1759 eval "${SED} -n -e '/^: @PROGRAM@ $/d' -e 's/^.* \(.*\)$/\1/p' "'< "$nlist" > "$export_symbols"'
1761 *cygwin* | *mingw* )
1762 eval "echo EXPORTS "'> "$output_objdir/$outputname.def"'
1763 eval 'cat "$export_symbols" >> "$output_objdir/$outputname.def"'
1769 eval "${SED} -e 's/\([].[*^$]\)/\\\\\1/g' -e 's/^/ /' -e 's/$/$/'"' < "$export_symbols" > "$output_objdir/$outputname.exp"'
1770 eval '$GREP -f "$output_objdir/$outputname.exp" < "$nlist" > "$nlist"T'
1771 eval '$MV "$nlist"T "$nlist"'
1774 eval "echo EXPORTS "'> "$output_objdir/$outputname.def"'
1775 eval 'cat "$nlist" >> "$output_objdir/$outputname.def"'
1782 for dlprefile in $dlprefiles; do
1783 func_verbose "extracting global C symbols from \`$dlprefile'"
1784 func_basename "$dlprefile"
1785 name="$func_basename_result"
1787 eval '$ECHO ": $name " >> "$nlist"'
1788 eval "$NM $dlprefile 2>/dev/null | $global_symbol_pipe >> '$nlist'"
1793 # Make sure we have at least an empty file.
1794 test -f "$nlist" || : > "$nlist"
1796 if test -n "$exclude_expsyms"; then
1797 $EGREP -v " ($exclude_expsyms)$" "$nlist" > "$nlist"T
1798 $MV "$nlist"T "$nlist"
1801 # Try sorting and uniquifying the output.
1802 if $GREP -v "^: " < "$nlist" |
1803 if sort -k 3 </dev/null >/dev/null 2>&1; then
1808 uniq > "$nlist"S; then
1811 $GREP -v "^: " < "$nlist" > "$nlist"S
1814 if test -f "$nlist"S; then
1815 eval "$global_symbol_to_cdecl"' < "$nlist"S >> "$output_objdir/$my_dlsyms"'
1817 $ECHO '/* NONE */' >> "$output_objdir/$my_dlsyms"
1820 $ECHO >> "$output_objdir/$my_dlsyms" "\
1822 /* The mapping between symbol names and symbols. */
1829 *cygwin* | *mingw* )
1830 $ECHO >> "$output_objdir/$my_dlsyms" "\
1831 /* DATA imports from DLLs on WIN32 con't be const, because
1832 runtime relocations are performed -- see ld's documentation
1833 on pseudo-relocs. */"
1836 echo >> "$output_objdir/$my_dlsyms" "\
1837 /* This system does not cope well with relocations in const data */"
1840 lt_dlsym_const=const ;;
1843 $ECHO >> "$output_objdir/$my_dlsyms" "\
1844 extern $lt_dlsym_const lt_dlsymlist
1845 lt_${my_prefix}_LTX_preloaded_symbols[];
1846 $lt_dlsym_const lt_dlsymlist
1847 lt_${my_prefix}_LTX_preloaded_symbols[] =
1849 { \"$my_originator\", (void *) 0 },"
1851 case $need_lib_prefix in
1853 eval "$global_symbol_to_c_name_address" < "$nlist" >> "$output_objdir/$my_dlsyms"
1856 eval "$global_symbol_to_c_name_address_lib_prefix" < "$nlist" >> "$output_objdir/$my_dlsyms"
1859 $ECHO >> "$output_objdir/$my_dlsyms" "\
1863 /* This works around a problem in FreeBSD linker */
1864 #ifdef FREEBSD_WORKAROUND
1865 static const void *lt_preloaded_setup() {
1866 return lt_${my_prefix}_LTX_preloaded_symbols;
1876 pic_flag_for_symtable=
1877 case "$compile_command " in
1881 # compiling the symbol table file with pic_flag works around
1882 # a FreeBSD bug that causes programs to crash when -lm is
1883 # linked before any other PIC object. But we must not use
1884 # pic_flag when linking with -static. The problem exists in
1885 # FreeBSD 2.2.6 and is fixed in FreeBSD 3.1.
1886 *-*-freebsd2*|*-*-freebsd3.0*|*-*-freebsdelf3.0*)
1887 pic_flag_for_symtable=" $pic_flag -DFREEBSD_WORKAROUND" ;;
1889 pic_flag_for_symtable=" $pic_flag" ;;
1891 if test "X$my_pic_p" != Xno; then
1892 pic_flag_for_symtable=" $pic_flag"
1899 for arg in $LTCFLAGS; do
1901 -pie | -fpie | -fPIE) ;;
1902 *) symtab_cflags="$symtab_cflags $arg" ;;
1906 # Now compile the dynamic symbol file.
1907 func_show_eval '(cd $output_objdir && $LTCC$symtab_cflags -c$no_builtin_flag$pic_flag_for_symtable "$my_dlsyms")' 'exit $?'
1909 # Clean up the generated files.
1910 func_show_eval '$RM "$output_objdir/$my_dlsyms" "$nlist" "${nlist}S" "${nlist}T"'
1912 # Transform the symbol file into the correct name.
1913 symfileobj="$output_objdir/${my_outputname}S.$objext"
1915 *cygwin* | *mingw* )
1916 if test -f "$output_objdir/$my_outputname.def"; then
1917 compile_command=`$ECHO "X$compile_command" | $Xsed -e "s%@SYMFILE@%$output_objdir/$my_outputname.def $symfileobj%"`
1918 finalize_command=`$ECHO "X$finalize_command" | $Xsed -e "s%@SYMFILE@%$output_objdir/$my_outputname.def $symfileobj%"`
1920 compile_command=`$ECHO "X$compile_command" | $Xsed -e "s%@SYMFILE@%$symfileobj%"`
1921 finalize_command=`$ECHO "X$finalize_command" | $Xsed -e "s%@SYMFILE@%$symfileobj%"`
1925 compile_command=`$ECHO "X$compile_command" | $Xsed -e "s%@SYMFILE@%$symfileobj%"`
1926 finalize_command=`$ECHO "X$finalize_command" | $Xsed -e "s%@SYMFILE@%$symfileobj%"`
1931 func_fatal_error "unknown suffix for \`$my_dlsyms'"
1935 # We keep going just in case the user didn't refer to
1936 # lt_preloaded_symbols. The linker will fail if global_symbol_pipe
1937 # really was required.
1939 # Nullify the symbol file.
1940 compile_command=`$ECHO "X$compile_command" | $Xsed -e "s% @SYMFILE@%%"`
1941 finalize_command=`$ECHO "X$finalize_command" | $Xsed -e "s% @SYMFILE@%%"`
1945 # func_extract_an_archive dir oldlib
1946 func_extract_an_archive ()
1949 f_ex_an_ar_dir="$1"; shift
1950 f_ex_an_ar_oldlib="$1"
1951 func_show_eval "(cd \$f_ex_an_ar_dir && $AR x \"\$f_ex_an_ar_oldlib\")" 'exit $?'
1952 if ($AR t "$f_ex_an_ar_oldlib" | sort | sort -uc >/dev/null 2>&1); then
1955 func_fatal_error "object name conflicts in archive: $f_ex_an_ar_dir/$f_ex_an_ar_oldlib"
1960 # func_extract_archives gentop oldlib ...
1961 func_extract_archives ()
1964 my_gentop="$1"; shift
1965 my_oldlibs=${1+"$@"}
1971 for my_xlib in $my_oldlibs; do
1972 # Extract the objects.
1974 [\\/]* | [A-Za-z]:[\\/]*) my_xabs="$my_xlib" ;;
1975 *) my_xabs=`pwd`"/$my_xlib" ;;
1977 func_basename "$my_xlib"
1978 my_xlib="$func_basename_result"
1981 case " $extracted_archives " in
1983 extracted_serial=`expr $extracted_serial + 1`
1984 my_xlib_u=lt$extracted_serial-$my_xlib ;;
1988 extracted_archives="$extracted_archives $my_xlib_u"
1989 my_xdir="$my_gentop/$my_xlib_u"
1991 func_mkdir_p "$my_xdir"
1995 func_verbose "Extracting $my_xabs"
1996 # Do not bother doing anything if just a dry run
1998 darwin_orig_dir=`pwd`
1999 cd $my_xdir || exit $?
2000 darwin_archive=$my_xabs
2002 darwin_base_archive=`basename "$darwin_archive"`
2003 darwin_arches=`lipo -info "$darwin_archive" 2>/dev/null | $GREP Architectures 2>/dev/null || true`
2004 if test -n "$darwin_arches"; then
2005 darwin_arches=`$ECHO "$darwin_arches" | $SED -e 's/.*are://'`
2007 func_verbose "$darwin_base_archive has multiple architectures $darwin_arches"
2008 for darwin_arch in $darwin_arches ; do
2009 func_mkdir_p "unfat-$$/${darwin_base_archive}-${darwin_arch}"
2010 lipo -thin $darwin_arch -output "unfat-$$/${darwin_base_archive}-${darwin_arch}/${darwin_base_archive}" "${darwin_archive}"
2011 cd "unfat-$$/${darwin_base_archive}-${darwin_arch}"
2012 func_extract_an_archive "`pwd`" "${darwin_base_archive}"
2014 $RM "unfat-$$/${darwin_base_archive}-${darwin_arch}/${darwin_base_archive}"
2015 done # $darwin_arches
2016 ## Okay now we've a bunch of thin objects, gotta fatten them up :)
2017 darwin_filelist=`find unfat-$$ -type f -name \*.o -print -o -name \*.lo -print| xargs basename | sort -u | $NL2SP`
2020 for darwin_file in $darwin_filelist; do
2021 darwin_files=`find unfat-$$ -name $darwin_file -print | $NL2SP`
2022 lipo -create -output "$darwin_file" $darwin_files
2023 done # $darwin_filelist
2025 cd "$darwin_orig_dir"
2028 func_extract_an_archive "$my_xdir" "$my_xabs"
2033 func_extract_an_archive "$my_xdir" "$my_xabs"
2036 my_oldobjs="$my_oldobjs "`find $my_xdir -name \*.$objext -print -o -name \*.lo -print | $NL2SP`
2039 func_extract_archives_result="$my_oldobjs"
2044 # func_write_libtool_object output_name pic_name nonpic_name
2045 # Create a libtool object file (analogous to a ".la" file),
2046 # but don't create it if we're doing a dry run.
2047 func_write_libtool_object ()
2050 if test "$build_libtool_libs" = yes; then
2056 if test "$build_old_libs" = yes; then
2057 write_oldobj=\'${3}\'
2063 cat >${write_libobj}T <<EOF
2064 # $write_libobj - a libtool object file
2065 # Generated by $PROGRAM (GNU $PACKAGE$TIMESTAMP) $VERSION
2067 # Please DO NOT delete this file!
2068 # It is necessary for linking the library.
2070 # Name of the PIC object.
2071 pic_object=$write_lobj
2073 # Name of the non-PIC object
2074 non_pic_object=$write_oldobj
2077 mv -f "${write_libobj}T" "${write_libobj}"
2081 # func_mode_compile arg...
2082 func_mode_compile ()
2085 # Get the compilation command and the source file.
2087 srcfile="$nonopt" # always keep a non-empty value in "srcfile"
2099 # do not "continue". Instead, add this to base_compile
2111 # Accept any command-line options.
2114 test -n "$libobj" && \
2115 func_fatal_error "you cannot specify \`-o' more than once"
2120 -pie | -fpie | -fPIE)
2121 pie_flag="$pie_flag $arg"
2125 -shared | -static | -prefer-pic | -prefer-non-pic)
2136 arg_mode=arg # the next one goes into the "base_compile" arg list
2137 continue # The current "srcfile" will either be retained or
2138 ;; # replaced later. I would guess that would be a bug.
2141 func_stripname '-Wc,' '' "$arg"
2142 args=$func_stripname_result
2144 save_ifs="$IFS"; IFS=','
2145 for arg in $args; do
2147 func_quote_for_eval "$arg"
2148 lastarg="$lastarg $func_quote_for_eval_result"
2151 func_stripname ' ' '' "$lastarg"
2152 lastarg=$func_stripname_result
2154 # Add the arguments to base_compile.
2155 base_compile="$base_compile $lastarg"
2160 # Accept the current argument as the source file.
2161 # The previous "srcfile" becomes the current argument.
2168 esac # case $arg_mode
2170 # Aesthetically quote the previous argument.
2171 func_quote_for_eval "$lastarg"
2172 base_compile="$base_compile $func_quote_for_eval_result"
2177 func_fatal_error "you must specify an argument for -Xcompile"
2180 func_fatal_error "you must specify a target with \`-o'"
2183 # Get the name of the library object.
2184 test -z "$libobj" && {
2185 func_basename "$srcfile"
2186 libobj="$func_basename_result"
2191 # Recognize several different file suffixes.
2192 # If the user specifies -o file.o, it is replaced with file.lo
2202 *.class) xform=class ;;
2205 *.[fF][09]?) xform='[fF][09].' ;;
2207 *.java) xform=java ;;
2212 libobj=`$ECHO "X$libobj" | $Xsed -e "s/\.$xform$/.lo/"`
2215 *.lo) func_lo2o "$libobj"; obj=$func_lo2o_result ;;
2217 func_fatal_error "cannot determine name of library object from \`$libobj'"
2221 func_infer_tag $base_compile
2223 for arg in $later; do
2226 test "$build_libtool_libs" != yes && \
2227 func_fatal_configuration "can not build a shared library"
2233 build_libtool_libs=no
2250 func_quote_for_eval "$libobj"
2251 test "X$libobj" != "X$func_quote_for_eval_result" \
2252 && $ECHO "X$libobj" | $GREP '[]~#^*{};<>?"'"'"' &()|`$[]' \
2253 && func_warning "libobj name \`$libobj' may not contain shell special characters."
2254 func_dirname_and_basename "$obj" "/" ""
2255 objname="$func_basename_result"
2256 xdir="$func_dirname_result"
2257 lobj=${xdir}$objdir/$objname
2259 test -z "$base_compile" && \
2260 func_fatal_help "you must specify a compilation command"
2262 # Delete any leftover library objects.
2263 if test "$build_old_libs" = yes; then
2264 removelist="$obj $lobj $libobj ${libobj}T"
2266 removelist="$lobj $libobj ${libobj}T"
2269 $opt_dry_run || $RM $removelist
2270 trap "$opt_dry_run || $RM $removelist; exit $EXIT_FAILURE" 1 2 15
2272 # On Cygwin there's no "real" PIC flag so we must build both object types
2274 cygwin* | mingw* | pw32* | os2*)
2278 if test "$pic_mode" = no && test "$deplibs_check_method" != pass_all; then
2279 # non-PIC code in shared libraries is not supported
2283 # Calculate the filename of the output object if compiler does
2284 # not support -o with -c
2285 if test "$compiler_c_o" = no; then
2286 output_obj=`$ECHO "X$srcfile" | $Xsed -e 's%^.*/%%' -e 's%\.[^.]*$%%'`.${objext}
2287 lockfile="$output_obj.lock"
2288 removelist="$removelist $output_obj $lockfile"
2289 trap "$opt_dry_run || $RM $removelist; exit $EXIT_FAILURE" 1 2 15
2296 # Lock this critical section if it is needed
2297 # We use this script file to make the link, it avoids creating a new file
2298 if test "$need_locks" = yes; then
2299 until $opt_dry_run || ln "$progpath" "$lockfile" 2>/dev/null; do
2300 func_echo "Waiting for $lockfile to be removed"
2303 elif test "$need_locks" = warn; then
2304 if test -f "$lockfile"; then
2306 *** ERROR, $lockfile exists and contains:
2307 `cat $lockfile 2>/dev/null`
2309 This indicates that another process is trying to use the same
2310 temporary object file, and libtool could not work around it because
2311 your compiler does not support \`-c' and \`-o' together. If you
2312 repeat this compilation, it may succeed, by chance, but you had better
2313 avoid parallel builds (make -j) in this platform, or get a better
2316 $opt_dry_run || $RM $removelist
2319 $ECHO "$srcfile" > "$lockfile"
2322 if test -n "$fix_srcfile_path"; then
2323 eval srcfile=\"$fix_srcfile_path\"
2325 func_quote_for_eval "$srcfile"
2326 qsrcfile=$func_quote_for_eval_result
2328 $opt_dry_run || $RM "$libobj" "${libobj}T"
2330 # Only build a PIC object if we are building libtool libraries.
2331 if test "$build_libtool_libs" = yes; then
2332 # Without this assignment, base_compile gets emptied.
2333 fbsd_hideous_sh_bug=$base_compile
2335 if test "$pic_mode" != no; then
2336 command="$base_compile $qsrcfile $pic_flag"
2338 # Don't build PIC code
2339 command="$base_compile $qsrcfile"
2342 func_mkdir_p "$xdir$objdir"
2344 if test -z "$output_obj"; then
2345 # Place PIC objects in $objdir
2346 command="$command -o $lobj"
2349 $opt_dry_run || $RM "$lobj" "$output_obj"
2351 func_show_eval "$command" \
2352 'test -n "$output_obj" && $RM $removelist; exit $EXIT_FAILURE'
2354 if test "$need_locks" = warn &&
2355 test "X`cat $lockfile 2>/dev/null`" != "X$srcfile"; then
2357 *** ERROR, $lockfile contains:
2358 `cat $lockfile 2>/dev/null`
2360 but it should contain:
2363 This indicates that another process is trying to use the same
2364 temporary object file, and libtool could not work around it because
2365 your compiler does not support \`-c' and \`-o' together. If you
2366 repeat this compilation, it may succeed, by chance, but you had better
2367 avoid parallel builds (make -j) in this platform, or get a better
2370 $opt_dry_run || $RM $removelist
2374 # Just move the object if needed, then go on to compile the next one
2375 if test -n "$output_obj" && test "X$output_obj" != "X$lobj"; then
2376 func_show_eval '$MV "$output_obj" "$lobj"' \
2377 'error=$?; $opt_dry_run || $RM $removelist; exit $error'
2380 # Allow error messages only from the first compilation.
2381 if test "$suppress_opt" = yes; then
2382 suppress_output=' >/dev/null 2>&1'
2386 # Only build a position-dependent object if we build old libraries.
2387 if test "$build_old_libs" = yes; then
2388 if test "$pic_mode" != yes; then
2389 # Don't build PIC code
2390 command="$base_compile $qsrcfile$pie_flag"
2392 command="$base_compile $qsrcfile $pic_flag"
2394 if test "$compiler_c_o" = yes; then
2395 command="$command -o $obj"
2398 # Suppress compiler output if we already did a PIC compilation.
2399 command="$command$suppress_output"
2400 $opt_dry_run || $RM "$obj" "$output_obj"
2401 func_show_eval "$command" \
2402 '$opt_dry_run || $RM $removelist; exit $EXIT_FAILURE'
2404 if test "$need_locks" = warn &&
2405 test "X`cat $lockfile 2>/dev/null`" != "X$srcfile"; then
2407 *** ERROR, $lockfile contains:
2408 `cat $lockfile 2>/dev/null`
2410 but it should contain:
2413 This indicates that another process is trying to use the same
2414 temporary object file, and libtool could not work around it because
2415 your compiler does not support \`-c' and \`-o' together. If you
2416 repeat this compilation, it may succeed, by chance, but you had better
2417 avoid parallel builds (make -j) in this platform, or get a better
2420 $opt_dry_run || $RM $removelist
2424 # Just move the object if needed
2425 if test -n "$output_obj" && test "X$output_obj" != "X$obj"; then
2426 func_show_eval '$MV "$output_obj" "$obj"' \
2427 'error=$?; $opt_dry_run || $RM $removelist; exit $error'
2432 func_write_libtool_object "$libobj" "$objdir/$objname" "$objname"
2434 # Unlock the critical section if it was locked
2435 if test "$need_locks" != no; then
2443 test "$mode" = compile && func_mode_compile ${1+"$@"}
2446 # func_mode_execute arg...
2447 func_mode_execute ()
2450 # The first argument is the command name.
2453 func_fatal_help "you must specify a COMMAND"
2455 # Handle -dlopen flags immediately.
2456 for file in $execute_dlfiles; do
2458 || func_fatal_help "\`$file' is not a file"
2463 # Check to see that this really is a libtool archive.
2464 func_lalib_unsafe_p "$file" \
2465 || func_fatal_help "\`$lib' is not a valid libtool archive"
2467 # Read the libtool library.
2472 # Skip this library if it cannot be dlopened.
2473 if test -z "$dlname"; then
2474 # Warn if it was a shared library.
2475 test -n "$library_names" && \
2476 func_warning "\`$file' was not linked with \`-export-dynamic'"
2480 func_dirname "$file" "" "."
2481 dir="$func_dirname_result"
2483 if test -f "$dir/$objdir/$dlname"; then
2486 if test ! -f "$dir/$dlname"; then
2487 func_fatal_error "cannot find \`$dlname' in \`$dir' or \`$dir/$objdir'"
2493 # Just add the directory containing the .lo file.
2494 func_dirname "$file" "" "."
2495 dir="$func_dirname_result"
2499 func_warning "\`-dlopen' is ignored for non-libtool libraries and objects"
2504 # Get the absolute pathname.
2505 absdir=`cd "$dir" && pwd`
2506 test -n "$absdir" && dir="$absdir"
2508 # Now add the directory to shlibpath_var.
2509 if eval "test -z \"\$$shlibpath_var\""; then
2510 eval "$shlibpath_var=\"\$dir\""
2512 eval "$shlibpath_var=\"\$dir:\$$shlibpath_var\""
2516 # This variable tells wrapper scripts just to set shlibpath_var
2517 # rather than running their programs.
2518 libtool_execute_magic="$magic"
2520 # Check if any of the arguments is a wrapper script.
2527 # Do a test to see if this is really a libtool program.
2528 if func_ltwrapper_script_p "$file"; then
2530 elif func_ltwrapper_executable_p "$file"; then
2531 func_ltwrapper_scriptname "$file"
2532 func_source "$func_ltwrapper_scriptname_result"
2534 # Transform arg to wrapped name.
2535 file="$progdir/$program"
2538 # Quote arguments (to preserve shell metacharacters).
2539 func_quote_for_eval "$file"
2540 args="$args $func_quote_for_eval_result"
2543 if test "X$opt_dry_run" = Xfalse; then
2544 if test -n "$shlibpath_var"; then
2545 # Export the shlibpath_var.
2546 eval "export $shlibpath_var"
2549 # Restore saved environment variables
2550 for lt_var in LANG LANGUAGE LC_ALL LC_CTYPE LC_COLLATE LC_MESSAGES
2552 eval "if test \"\${save_$lt_var+set}\" = set; then
2553 $lt_var=\$save_$lt_var; export $lt_var
2559 # Now prepare to actually exec the command.
2560 exec_cmd="\$cmd$args"
2562 # Display what would be done.
2563 if test -n "$shlibpath_var"; then
2564 eval "\$ECHO \"\$shlibpath_var=\$$shlibpath_var\""
2565 $ECHO "export $shlibpath_var"
2572 test "$mode" = execute && func_mode_execute ${1+"$@"}
2575 # func_mode_finish arg...
2582 if test -n "$finish_cmds$finish_eval" && test -n "$libdirs"; then
2585 libdirs="$libdirs $dir"
2588 for libdir in $libdirs; do
2589 if test -n "$finish_cmds"; then
2590 # Do each command in the finish commands.
2591 func_execute_cmds "$finish_cmds" 'admincmds="$admincmds
2594 if test -n "$finish_eval"; then
2595 # Do the single finish_eval.
2596 eval cmds=\"$finish_eval\"
2597 $opt_dry_run || eval "$cmds" || admincmds="$admincmds
2603 # Exit here if they wanted silent mode.
2604 $opt_silent && exit $EXIT_SUCCESS
2606 $ECHO "X----------------------------------------------------------------------" | $Xsed
2607 $ECHO "Libraries have been installed in:"
2608 for libdir in $libdirs; do
2612 $ECHO "If you ever happen to want to link against installed libraries"
2613 $ECHO "in a given directory, LIBDIR, you must either use libtool, and"
2614 $ECHO "specify the full pathname of the library, or use the \`-LLIBDIR'"
2615 $ECHO "flag during linking and do at least one of the following:"
2616 if test -n "$shlibpath_var"; then
2617 $ECHO " - add LIBDIR to the \`$shlibpath_var' environment variable"
2618 $ECHO " during execution"
2620 if test -n "$runpath_var"; then
2621 $ECHO " - add LIBDIR to the \`$runpath_var' environment variable"
2622 $ECHO " during linking"
2624 if test -n "$hardcode_libdir_flag_spec"; then
2626 eval flag=\"$hardcode_libdir_flag_spec\"
2628 $ECHO " - use the \`$flag' linker flag"
2630 if test -n "$admincmds"; then
2631 $ECHO " - have your system administrator run these commands:$admincmds"
2633 if test -f /etc/ld.so.conf; then
2634 $ECHO " - have your system administrator add LIBDIR to \`/etc/ld.so.conf'"
2638 $ECHO "See any operating system documentation about shared libraries for"
2640 solaris2.[6789]|solaris2.1[0-9])
2641 $ECHO "more information, such as the ld(1), crle(1) and ld.so(8) manual"
2645 $ECHO "more information, such as the ld(1) and ld.so(8) manual pages."
2648 $ECHO "X----------------------------------------------------------------------" | $Xsed
2652 test "$mode" = finish && func_mode_finish ${1+"$@"}
2655 # func_mode_install arg...
2656 func_mode_install ()
2659 # There may be an optional sh(1) argument at the beginning of
2660 # install_prog (especially on Windows NT).
2661 if test "$nonopt" = "$SHELL" || test "$nonopt" = /bin/sh ||
2662 # Allow the use of GNU shtool's install command.
2663 $ECHO "X$nonopt" | $GREP shtool >/dev/null; then
2664 # Aesthetically quote it.
2665 func_quote_for_eval "$nonopt"
2666 install_prog="$func_quote_for_eval_result "
2674 # The real first argument should be the name of the installation program.
2675 # Aesthetically quote it.
2676 func_quote_for_eval "$arg"
2677 install_prog="$install_prog$func_quote_for_eval_result"
2679 # We need to accept at least all the BSD install flags.
2689 if test -n "$dest"; then
2690 files="$files $dest"
2698 case " $install_prog " in
2713 # If the previous option needed an argument, then skip it.
2714 if test -n "$prev"; then
2723 # Aesthetically quote the argument.
2724 func_quote_for_eval "$arg"
2725 install_prog="$install_prog $func_quote_for_eval_result"
2728 test -z "$install_prog" && \
2729 func_fatal_help "you must specify an install program"
2731 test -n "$prev" && \
2732 func_fatal_help "the \`$prev' option requires an argument"
2734 if test -z "$files"; then
2735 if test -z "$dest"; then
2736 func_fatal_help "no file or destination specified"
2738 func_fatal_help "you must specify a destination"
2742 # Strip any trailing slash from the destination.
2743 func_stripname '' '/' "$dest"
2744 dest=$func_stripname_result
2746 # Check to see that the destination is a directory.
2747 test -d "$dest" && isdir=yes
2748 if test "$isdir" = yes; then
2752 func_dirname_and_basename "$dest" "" "."
2753 destdir="$func_dirname_result"
2754 destname="$func_basename_result"
2756 # Not a directory, so check to see that there is only one file specified.
2757 set dummy $files; shift
2758 test "$#" -gt 1 && \
2759 func_fatal_help "\`$dest' is not a directory"
2762 [\\/]* | [A-Za-z]:[\\/]*) ;;
2764 for file in $files; do
2768 func_fatal_help "\`$destdir' must be an absolute directory name"
2775 # This variable tells wrapper scripts just to set variables rather
2776 # than running their programs.
2777 libtool_install_magic="$magic"
2782 for file in $files; do
2784 # Do each installation.
2787 # Do the static libraries later.
2788 staticlibs="$staticlibs $file"
2792 # Check to see that this really is a libtool archive.
2793 func_lalib_unsafe_p "$file" \
2794 || func_fatal_help "\`$file' is not a valid libtool archive"
2801 # Add the libdir to current_libdirs if it is the destination.
2802 if test "X$destdir" = "X$libdir"; then
2803 case "$current_libdirs " in
2805 *) current_libdirs="$current_libdirs $libdir" ;;
2808 # Note the libdir as a future libdir.
2809 case "$future_libdirs " in
2811 *) future_libdirs="$future_libdirs $libdir" ;;
2815 func_dirname "$file" "/" ""
2816 dir="$func_dirname_result"
2819 if test -n "$relink_command"; then
2820 # Determine the prefix the user has applied to our future dir.
2821 inst_prefix_dir=`$ECHO "X$destdir" | $Xsed -e "s%$libdir\$%%"`
2823 # Don't allow the user to place us outside of our expected
2824 # location b/c this prevents finding dependent libraries that
2825 # are installed to the same prefix.
2826 # At present, this check doesn't affect windows .dll's that
2827 # are installed into $libdir/../bin (currently, that works fine)
2828 # but it's something to keep an eye on.
2829 test "$inst_prefix_dir" = "$destdir" && \
2830 func_fatal_error "error: cannot install \`$file' to a directory not ending in $libdir"
2832 if test -n "$inst_prefix_dir"; then
2833 # Stick the inst_prefix_dir data into the link command.
2834 relink_command=`$ECHO "X$relink_command" | $Xsed -e "s%@inst_prefix_dir@%-inst-prefix-dir $inst_prefix_dir%"`
2836 relink_command=`$ECHO "X$relink_command" | $Xsed -e "s%@inst_prefix_dir@%%"`
2839 func_warning "relinking \`$file'"
2840 func_show_eval "$relink_command" \
2841 'func_fatal_error "error: relink \`$file'\'' with the above command before installing it"'
2844 # See the names of the shared library.
2845 set dummy $library_names; shift
2846 if test -n "$1"; then
2851 test -n "$relink_command" && srcname="$realname"T
2853 # Install the shared library and build the symlinks.
2854 func_show_eval "$install_prog $dir/$srcname $destdir/$realname" \
2858 cygwin* | mingw* | pw32*)
2866 if test -n "$tstripme" && test -n "$striplib"; then
2867 func_show_eval "$striplib $destdir/$realname" 'exit $?'
2870 if test "$#" -gt 0; then
2871 # Delete the old symlinks, and create new ones.
2872 # Try `ln -sf' first, because the `ln' binary might depend on
2873 # the symlink we replace! Solaris /bin/ln does not understand -f,
2874 # so we also need to try rm && ln -s.
2877 test "$linkname" != "$realname" \
2878 && func_show_eval "(cd $destdir && { $LN_S -f $realname $linkname || { $RM $linkname && $LN_S $realname $linkname; }; })"
2882 # Do each command in the postinstall commands.
2883 lib="$destdir/$realname"
2884 func_execute_cmds "$postinstall_cmds" 'exit $?'
2887 # Install the pseudo-library for information purposes.
2888 func_basename "$file"
2889 name="$func_basename_result"
2890 instname="$dir/$name"i
2891 func_show_eval "$install_prog $instname $destdir/$name" 'exit $?'
2893 # Maybe install the static library, too.
2894 test -n "$old_library" && staticlibs="$staticlibs $dir/$old_library"
2898 # Install (i.e. copy) a libtool object.
2900 # Figure out destination file name, if it wasn't already specified.
2901 if test -n "$destname"; then
2902 destfile="$destdir/$destname"
2904 func_basename "$file"
2905 destfile="$func_basename_result"
2906 destfile="$destdir/$destfile"
2909 # Deduce the name of the destination old-style object file.
2912 func_lo2o "$destfile"
2913 staticdest=$func_lo2o_result
2916 staticdest="$destfile"
2920 func_fatal_help "cannot copy a libtool object to \`$destfile'"
2924 # Install the libtool object if requested.
2925 test -n "$destfile" && \
2926 func_show_eval "$install_prog $file $destfile" 'exit $?'
2928 # Install the old object if enabled.
2929 if test "$build_old_libs" = yes; then
2930 # Deduce the name of the old-style object file.
2932 staticobj=$func_lo2o_result
2933 func_show_eval "$install_prog \$staticobj \$staticdest" 'exit $?'
2939 # Figure out destination file name, if it wasn't already specified.
2940 if test -n "$destname"; then
2941 destfile="$destdir/$destname"
2943 func_basename "$file"
2944 destfile="$func_basename_result"
2945 destfile="$destdir/$destfile"
2948 # If the file is missing, and there is a .exe on the end, strip it
2949 # because it is most likely a libtool script we actually want to
2954 if test ! -f "$file"; then
2955 func_stripname '' '.exe' "$file"
2956 file=$func_stripname_result
2962 # Do a test to see if this is really a libtool program.
2965 if func_ltwrapper_executable_p "$file"; then
2966 func_ltwrapper_scriptname "$file"
2967 wrapper=$func_ltwrapper_scriptname_result
2969 func_stripname '' '.exe' "$file"
2970 wrapper=$func_stripname_result
2977 if func_ltwrapper_script_p "$wrapper"; then
2981 func_source "$wrapper"
2983 # Check the variables that should have been set.
2984 test -z "$generated_by_libtool_version" && \
2985 func_fatal_error "invalid libtool wrapper script \`$wrapper'"
2988 for lib in $notinst_deplibs; do
2989 # Check to see that each library is installed.
2991 if test -f "$lib"; then
2994 libfile="$libdir/"`$ECHO "X$lib" | $Xsed -e 's%^.*/%%g'` ### testsuite: skip nested quoting test
2995 if test -n "$libdir" && test ! -f "$libfile"; then
2996 func_warning "\`$lib' has not been installed in \`$libdir'"
3002 func_source "$wrapper"
3005 if test "$fast_install" = no && test -n "$relink_command"; then
3007 if test "$finalize" = yes; then
3008 tmpdir=`func_mktempdir`
3009 func_basename "$file$stripped_ext"
3010 file="$func_basename_result"
3011 outputname="$tmpdir/$file"
3012 # Replace the output file specification.
3013 relink_command=`$ECHO "X$relink_command" | $Xsed -e 's%@OUTPUT@%'"$outputname"'%g'`
3016 func_quote_for_expand "$relink_command"
3017 eval "func_echo $func_quote_for_expand_result"
3019 if eval "$relink_command"; then :
3021 func_error "error: relink \`$file' with the above command before installing it"
3022 $opt_dry_run || ${RM}r "$tmpdir"
3027 func_warning "cannot relink \`$file'"
3031 # Install the binary that we compiled earlier.
3032 file=`$ECHO "X$file$stripped_ext" | $Xsed -e "s%\([^/]*\)$%$objdir/\1%"`
3036 # remove .exe since cygwin /usr/bin/install will append another
3038 case $install_prog,$host in
3039 */usr/bin/install*,*cygwin*)
3040 case $file:$destfile in
3045 destfile=$destfile.exe
3048 func_stripname '' '.exe' "$destfile"
3049 destfile=$func_stripname_result
3054 func_show_eval "$install_prog\$stripme \$file \$destfile" 'exit $?'
3055 $opt_dry_run || if test -n "$outputname"; then
3062 for file in $staticlibs; do
3063 func_basename "$file"
3064 name="$func_basename_result"
3066 # Set up the ranlib parameters.
3067 oldlib="$destdir/$name"
3069 func_show_eval "$install_prog \$file \$oldlib" 'exit $?'
3071 if test -n "$stripme" && test -n "$old_striplib"; then
3072 func_show_eval "$old_striplib $oldlib" 'exit $?'
3075 # Do each command in the postinstall commands.
3076 func_execute_cmds "$old_postinstall_cmds" 'exit $?'
3079 test -n "$future_libdirs" && \
3080 func_warning "remember to run \`$progname --finish$future_libdirs'"
3082 if test -n "$current_libdirs"; then
3083 # Maybe just do a dry run.
3084 $opt_dry_run && current_libdirs=" -n$current_libdirs"
3085 exec_cmd='$SHELL $progpath $preserve_args --finish$current_libdirs'
3091 test "$mode" = install && func_mode_install ${1+"$@"}
3094 # func_emit_wrapper arg
3096 # emit a libtool wrapper script on stdout
3097 # don't directly open a file because we may want to
3098 # incorporate the script contents within a cygwin/mingw
3099 # wrapper executable. Must ONLY be called from within
3100 # func_mode_link because it depends on a number of variable
3103 # arg is the value that the WRAPPER_SCRIPT_BELONGS_IN_OBJDIR
3104 # variable will take. If 'yes', then the emitted script
3105 # will assume that the directory in which it is stored is
3106 # the '.lib' directory. This is a cygwin/mingw-specific
3108 func_emit_wrapper ()
3110 func_emit_wrapper_arg1=no
3111 if test -n "$1" ; then
3112 func_emit_wrapper_arg1=$1
3118 # $output - temporary wrapper script for $objdir/$outputname
3119 # Generated by $PROGRAM (GNU $PACKAGE$TIMESTAMP) $VERSION
3121 # The $output program cannot be directly executed until all the libtool
3122 # libraries that it depends on are installed.
3124 # This wrapper script should never be moved out of the build directory.
3125 # If it is, it will not operate correctly.
3127 # Sed substitution that helps us do robust quoting. It backslashifies
3128 # metacharacters that are still active within double-quoted strings.
3129 Xsed='${SED} -e 1s/^X//'
3130 sed_quote_subst='$sed_quote_subst'
3132 # Be Bourne compatible
3133 if test -n \"\${ZSH_VERSION+set}\" && (emulate sh) >/dev/null 2>&1; then
3136 # Zsh 3.x and 4.x performs word splitting on \${1+\"\$@\"}, which
3137 # is contrary to our usage. Disable this feature.
3138 alias -g '\${1+\"\$@\"}'='\"\$@\"'
3139 setopt NO_GLOB_SUBST
3141 case \`(set -o) 2>/dev/null\` in *posix*) set -o posix;; esac
3143 BIN_SH=xpg4; export BIN_SH # for Tru64
3144 DUALCASE=1; export DUALCASE # for MKS sh
3146 # The HP-UX ksh and POSIX shell print the target directory to stdout
3148 (unset CDPATH) >/dev/null 2>&1 && unset CDPATH
3150 relink_command=\"$relink_command\"
3152 # This environment variable determines our operation mode.
3153 if test \"\$libtool_install_magic\" = \"$magic\"; then
3154 # install mode needs the following variables:
3155 generated_by_libtool_version='$macro_version'
3156 notinst_deplibs='$notinst_deplibs'
3158 # When we are sourced in execute mode, \$file and \$ECHO are already set.
3159 if test \"\$libtool_execute_magic\" != \"$magic\"; then
3162 # Make sure echo works.
3163 if test \"X\$1\" = X--no-reexec; then
3164 # Discard the --no-reexec flag, and continue.
3166 elif test \"X\`{ \$ECHO '\t'; } 2>/dev/null\`\" = 'X\t'; then
3167 # Yippee, \$ECHO works!
3170 # Restart under the correct shell, and then maybe \$ECHO will work.
3171 exec $SHELL \"\$0\" --no-reexec \${1+\"\$@\"}
3177 # Find the directory that this script lives in.
3178 thisdir=\`\$ECHO \"X\$file\" | \$Xsed -e 's%/[^/]*$%%'\`
3179 test \"x\$thisdir\" = \"x\$file\" && thisdir=.
3181 # Follow symbolic links until we get to the real thisdir.
3182 file=\`ls -ld \"\$file\" | ${SED} -n 's/.*-> //p'\`
3183 while test -n \"\$file\"; do
3184 destdir=\`\$ECHO \"X\$file\" | \$Xsed -e 's%/[^/]*\$%%'\`
3186 # If there was a directory component, then change thisdir.
3187 if test \"x\$destdir\" != \"x\$file\"; then
3188 case \"\$destdir\" in
3189 [\\\\/]* | [A-Za-z]:[\\\\/]*) thisdir=\"\$destdir\" ;;
3190 *) thisdir=\"\$thisdir/\$destdir\" ;;
3194 file=\`\$ECHO \"X\$file\" | \$Xsed -e 's%^.*/%%'\`
3195 file=\`ls -ld \"\$thisdir/\$file\" | ${SED} -n 's/.*-> //p'\`
3198 # Usually 'no', except on cygwin/mingw when embedded into
3200 WRAPPER_SCRIPT_BELONGS_IN_OBJDIR=$func_emit_wrapper_arg1
3201 if test \"\$WRAPPER_SCRIPT_BELONGS_IN_OBJDIR\" = \"yes\"; then
3202 # special case for '.'
3203 if test \"\$thisdir\" = \".\"; then
3206 # remove .libs from thisdir
3207 case \"\$thisdir\" in
3208 *[\\\\/]$objdir ) thisdir=\`\$ECHO \"X\$thisdir\" | \$Xsed -e 's%[\\\\/][^\\\\/]*$%%'\` ;;
3209 $objdir ) thisdir=. ;;
3213 # Try to get the absolute directory name.
3214 absdir=\`cd \"\$thisdir\" && pwd\`
3215 test -n \"\$absdir\" && thisdir=\"\$absdir\"
3218 if test "$fast_install" = yes; then
3220 program=lt-'$outputname'$exeext
3221 progdir=\"\$thisdir/$objdir\"
3223 if test ! -f \"\$progdir/\$program\" ||
3224 { file=\`ls -1dt \"\$progdir/\$program\" \"\$progdir/../\$program\" 2>/dev/null | ${SED} 1q\`; \\
3225 test \"X\$file\" != \"X\$progdir/\$program\"; }; then
3227 file=\"\$\$-\$program\"
3229 if test ! -d \"\$progdir\"; then
3230 $MKDIR \"\$progdir\"
3232 $RM \"\$progdir/\$file\"
3237 # relink executable if necessary
3238 if test -n \"\$relink_command\"; then
3239 if relink_command_output=\`eval \$relink_command 2>&1\`; then :
3241 $ECHO \"\$relink_command_output\" >&2
3242 $RM \"\$progdir/\$file\"
3247 $MV \"\$progdir/\$file\" \"\$progdir/\$program\" 2>/dev/null ||
3248 { $RM \"\$progdir/\$program\";
3249 $MV \"\$progdir/\$file\" \"\$progdir/\$program\"; }
3250 $RM \"\$progdir/\$file\"
3254 program='$outputname'
3255 progdir=\"\$thisdir/$objdir\"
3261 if test -f \"\$progdir/\$program\"; then"
3263 # Export our shlibpath_var if we have one.
3264 if test "$shlibpath_overrides_runpath" = yes && test -n "$shlibpath_var" && test -n "$temp_rpath"; then
3266 # Add our own library path to $shlibpath_var
3267 $shlibpath_var=\"$temp_rpath\$$shlibpath_var\"
3269 # Some systems cannot cope with colon-terminated $shlibpath_var
3270 # The second colon is a workaround for a bug in BeOS R4 sed
3271 $shlibpath_var=\`\$ECHO \"X\$$shlibpath_var\" | \$Xsed -e 's/::*\$//'\`
3273 export $shlibpath_var
3277 # fixup the dll searchpath if we need to.
3278 if test -n "$dllsearchpath"; then
3280 # Add the dll search path components to the executable PATH
3281 PATH=$dllsearchpath:\$PATH
3286 if test \"\$libtool_execute_magic\" != \"$magic\"; then
3287 # Run the actual program with our arguments.
3290 # Backslashes separate directories on plain windows
3291 *-*-mingw | *-*-os2*)
3293 exec \"\$progdir\\\\\$program\" \${1+\"\$@\"}
3299 exec \"\$progdir/\$program\" \${1+\"\$@\"}
3304 \$ECHO \"\$0: cannot exec \$program \$*\"
3308 # The program doesn't exist.
3309 \$ECHO \"\$0: error: \\\`\$progdir/\$program' does not exist\" 1>&2
3310 \$ECHO \"This script is just a wrapper for \$program.\" 1>&2
3311 $ECHO \"See the $PACKAGE documentation for more information.\" 1>&2
3317 # end: func_emit_wrapper
3319 # func_emit_cwrapperexe_src
3320 # emit the source code for a wrapper executable on stdout
3321 # Must ONLY be called from within func_mode_link because
3322 # it depends on a number of variable set therein.
3323 func_emit_cwrapperexe_src ()
3327 /* $cwrappersource - temporary wrapper executable for $objdir/$outputname
3328 Generated by $PROGRAM (GNU $PACKAGE$TIMESTAMP) $VERSION
3330 The $output program cannot be directly executed until all the libtool
3331 libraries that it depends on are installed.
3333 This wrapper executable should never be moved out of the build directory.
3334 If it is, it will not operate correctly.
3336 Currently, it simply execs the wrapper *script* "$SHELL $output",
3337 but could eventually absorb all of the scripts functionality and
3338 exec $objdir/$outputname directly.
3345 # include <direct.h>
3346 # include <process.h>
3348 # include <unistd.h>
3349 # include <stdint.h>
3357 #include <sys/stat.h>
3359 #if defined(PATH_MAX)
3360 # define LT_PATHMAX PATH_MAX
3361 #elif defined(MAXPATHLEN)
3362 # define LT_PATHMAX MAXPATHLEN
3364 # define LT_PATHMAX 1024
3375 # define S_IXUSR _S_IEXEC
3377 # ifndef _INTPTR_T_DEFINED
3378 # define intptr_t int
3382 #ifndef DIR_SEPARATOR
3383 # define DIR_SEPARATOR '/'
3384 # define PATH_SEPARATOR ':'
3387 #if defined (_WIN32) || defined (__MSDOS__) || defined (__DJGPP__) || \
3389 # define HAVE_DOS_BASED_FILE_SYSTEM
3390 # ifndef DIR_SEPARATOR_2
3391 # define DIR_SEPARATOR_2 '\\'
3393 # ifndef PATH_SEPARATOR_2
3394 # define PATH_SEPARATOR_2 ';'
3398 #ifndef DIR_SEPARATOR_2
3399 # define IS_DIR_SEPARATOR(ch) ((ch) == DIR_SEPARATOR)
3400 #else /* DIR_SEPARATOR_2 */
3401 # define IS_DIR_SEPARATOR(ch) \
3402 (((ch) == DIR_SEPARATOR) || ((ch) == DIR_SEPARATOR_2))
3403 #endif /* DIR_SEPARATOR_2 */
3405 #ifndef PATH_SEPARATOR_2
3406 # define IS_PATH_SEPARATOR(ch) ((ch) == PATH_SEPARATOR)
3407 #else /* PATH_SEPARATOR_2 */
3408 # define IS_PATH_SEPARATOR(ch) ((ch) == PATH_SEPARATOR_2)
3409 #endif /* PATH_SEPARATOR_2 */
3411 #define XMALLOC(type, num) ((type *) xmalloc ((num) * sizeof(type)))
3412 #define XFREE(stale) do { \
3413 if (stale) { free ((void *) stale); stale = 0; } \
3416 #undef LTWRAPPER_DEBUGPRINTF
3417 #if defined DEBUGWRAPPER
3418 # define LTWRAPPER_DEBUGPRINTF(args) ltwrapper_debugprintf args
3420 ltwrapper_debugprintf (const char *fmt, ...)
3423 va_start (args, fmt);
3424 (void) vfprintf (stderr, fmt, args);
3428 # define LTWRAPPER_DEBUGPRINTF(args)
3431 const char *program_name = NULL;
3433 void *xmalloc (size_t num);
3434 char *xstrdup (const char *string);
3435 const char *base_name (const char *name);
3436 char *find_executable (const char *wrapper);
3437 char *chase_symlinks (const char *pathspec);
3438 int make_executable (const char *path);
3439 int check_executable (const char *path);
3440 char *strendzap (char *str, const char *pat);
3441 void lt_fatal (const char *message, ...);
3443 static const char *script_text =
3446 func_emit_wrapper yes |
3447 $SED -e 's/\([\\"]\)/\\\1/g' \
3448 -e 's/^/ "/' -e 's/$/\\n"/'
3452 const char * MAGIC_EXE = "$magic_exe";
3455 main (int argc, char *argv[])
3459 char *actual_cwrapper_path;
3460 char *shwrapper_name;
3461 intptr_t rval = 127;
3464 const char *dumpscript_opt = "--lt-dump-script";
3467 program_name = (char *) xstrdup (base_name (argv[0]));
3468 LTWRAPPER_DEBUGPRINTF (("(main) argv[0] : %s\n", argv[0]));
3469 LTWRAPPER_DEBUGPRINTF (("(main) program_name : %s\n", program_name));
3471 /* very simple arg parsing; don't want to rely on getopt */
3472 for (i = 1; i < argc; i++)
3474 if (strcmp (argv[i], dumpscript_opt) == 0)
3476 printf ("%s", script_text);
3481 newargz = XMALLOC (char *, argc + 2);
3484 if test -n "$TARGETSHELL" ; then
3485 # no path translation at all
3486 lt_newargv0=$TARGETSHELL
3490 # awkward: cmd appends spaces to result
3491 lt_sed_strip_trailing_spaces="s/[ ]*\$//"
3492 lt_newargv0=`( cmd //c echo $SHELL | $SED -e "$lt_sed_strip_trailing_spaces" ) 2>/dev/null || echo $SHELL`
3493 case $lt_newargv0 in
3495 *) lt_newargv0=$lt_newargv0.exe ;;
3498 * ) lt_newargv0=$SHELL ;;
3503 newargz[0] = (char *) xstrdup ("$lt_newargv0");
3507 tmp_pathspec = find_executable (argv[0]);
3508 if (tmp_pathspec == NULL)
3509 lt_fatal ("Couldn't find %s", argv[0]);
3510 LTWRAPPER_DEBUGPRINTF (("(main) found exe (before symlink chase) at : %s\n",
3513 actual_cwrapper_path = chase_symlinks (tmp_pathspec);
3514 LTWRAPPER_DEBUGPRINTF (("(main) found exe (after symlink chase) at : %s\n",
3515 actual_cwrapper_path));
3516 XFREE (tmp_pathspec);
3518 shwrapper_name = (char *) xstrdup (base_name (actual_cwrapper_path));
3519 strendzap (actual_cwrapper_path, shwrapper_name);
3521 /* shwrapper_name transforms */
3522 strendzap (shwrapper_name, ".exe");
3523 tmp_pathspec = XMALLOC (char, (strlen (shwrapper_name) +
3524 strlen ("_ltshwrapperTMP") + 1));
3525 strcpy (tmp_pathspec, shwrapper_name);
3526 strcat (tmp_pathspec, "_ltshwrapperTMP");
3527 XFREE (shwrapper_name);
3528 shwrapper_name = tmp_pathspec;
3530 LTWRAPPER_DEBUGPRINTF (("(main) libtool shell wrapper name: %s\n",
3536 XMALLOC (char, (strlen (actual_cwrapper_path) +
3537 strlen ("$objdir") + 1 + strlen (shwrapper_name) + 1));
3538 strcpy (newargz[1], actual_cwrapper_path);
3539 strcat (newargz[1], "$objdir");
3540 strcat (newargz[1], "/");
3541 strcat (newargz[1], shwrapper_name);
3550 while ((p = strchr (newargz[1], '\\')) != NULL)
3560 XFREE (shwrapper_name);
3561 XFREE (actual_cwrapper_path);
3563 /* note: do NOT use "wt" here! -- defer to underlying
3564 * mount type on cygwin
3566 if ((shwrapper = fopen (newargz[1], "w")) == 0)
3568 lt_fatal ("Could not open %s for writing", newargz[1]);
3570 fprintf (shwrapper, "%s", script_text);
3573 make_executable (newargz[1]);
3575 for (i = 1; i < argc; i++)
3576 newargz[i + 1] = xstrdup (argv[i]);
3577 newargz[argc + 1] = NULL;
3579 for (i = 0; i < argc + 1; i++)
3581 LTWRAPPER_DEBUGPRINTF (("(main) newargz[%d] : %s\n", i, newargz[i]));
3589 /* execv doesn't actually work on mingw as expected on unix */
3590 rval = _spawnv (_P_WAIT, "$lt_newargv0", (const char * const *) newargz);
3593 /* failed to start process */
3594 LTWRAPPER_DEBUGPRINTF (("(main) failed to launch target \"$lt_newargv0\": errno = %d\n", errno));
3603 execv ("$lt_newargv0", newargz);
3604 return rval; /* =127, but avoids unused variable warning */
3613 xmalloc (size_t num)
3615 void *p = (void *) malloc (num);
3617 lt_fatal ("Memory exhausted");
3623 xstrdup (const char *string)
3625 return string ? strcpy ((char *) xmalloc (strlen (string) + 1),
3630 base_name (const char *name)
3634 #if defined (HAVE_DOS_BASED_FILE_SYSTEM)
3635 /* Skip over the disk name in MSDOS pathnames. */
3636 if (isalpha ((unsigned char) name[0]) && name[1] == ':')
3640 for (base = name; *name; name++)
3641 if (IS_DIR_SEPARATOR (*name))
3647 check_executable (const char *path)
3651 LTWRAPPER_DEBUGPRINTF (("(check_executable) : %s\n",
3652 path ? (*path ? path : "EMPTY!") : "NULL!"));
3653 if ((!path) || (!*path))
3656 if ((stat (path, &st) >= 0)
3657 && (st.st_mode & (S_IXUSR | S_IXGRP | S_IXOTH)))
3664 make_executable (const char *path)
3669 LTWRAPPER_DEBUGPRINTF (("(make_executable) : %s\n",
3670 path ? (*path ? path : "EMPTY!") : "NULL!"));
3671 if ((!path) || (!*path))
3674 if (stat (path, &st) >= 0)
3676 rval = chmod (path, st.st_mode | S_IXOTH | S_IXGRP | S_IXUSR);
3681 /* Searches for the full path of the wrapper. Returns
3682 newly allocated full path name if found, NULL otherwise
3683 Does not chase symlinks, even on platforms that support them.
3686 find_executable (const char *wrapper)
3691 /* static buffer for getcwd */
3692 char tmp[LT_PATHMAX + 1];
3696 LTWRAPPER_DEBUGPRINTF (("(find_executable) : %s\n",
3697 wrapper ? (*wrapper ? wrapper : "EMPTY!") : "NULL!"));
3699 if ((wrapper == NULL) || (*wrapper == '\0'))
3702 /* Absolute path? */
3703 #if defined (HAVE_DOS_BASED_FILE_SYSTEM)
3704 if (isalpha ((unsigned char) wrapper[0]) && wrapper[1] == ':')
3706 concat_name = xstrdup (wrapper);
3707 if (check_executable (concat_name))
3709 XFREE (concat_name);
3714 if (IS_DIR_SEPARATOR (wrapper[0]))
3716 concat_name = xstrdup (wrapper);
3717 if (check_executable (concat_name))
3719 XFREE (concat_name);
3721 #if defined (HAVE_DOS_BASED_FILE_SYSTEM)
3725 for (p = wrapper; *p; p++)
3733 /* no slashes; search PATH */
3734 const char *path = getenv ("PATH");
3737 for (p = path; *p; p = p_next)
3741 for (q = p; *q; q++)
3742 if (IS_PATH_SEPARATOR (*q))
3745 p_next = (*q == '\0' ? q : q + 1);
3748 /* empty path: current directory */
3749 if (getcwd (tmp, LT_PATHMAX) == NULL)
3750 lt_fatal ("getcwd failed");
3751 tmp_len = strlen (tmp);
3753 XMALLOC (char, tmp_len + 1 + strlen (wrapper) + 1);
3754 memcpy (concat_name, tmp, tmp_len);
3755 concat_name[tmp_len] = '/';
3756 strcpy (concat_name + tmp_len + 1, wrapper);
3761 XMALLOC (char, p_len + 1 + strlen (wrapper) + 1);
3762 memcpy (concat_name, p, p_len);
3763 concat_name[p_len] = '/';
3764 strcpy (concat_name + p_len + 1, wrapper);
3766 if (check_executable (concat_name))
3768 XFREE (concat_name);
3771 /* not found in PATH; assume curdir */
3773 /* Relative path | not found in path: prepend cwd */
3774 if (getcwd (tmp, LT_PATHMAX) == NULL)
3775 lt_fatal ("getcwd failed");
3776 tmp_len = strlen (tmp);
3777 concat_name = XMALLOC (char, tmp_len + 1 + strlen (wrapper) + 1);
3778 memcpy (concat_name, tmp, tmp_len);
3779 concat_name[tmp_len] = '/';
3780 strcpy (concat_name + tmp_len + 1, wrapper);
3782 if (check_executable (concat_name))
3784 XFREE (concat_name);
3789 chase_symlinks (const char *pathspec)
3792 return xstrdup (pathspec);
3794 char buf[LT_PATHMAX];
3796 char *tmp_pathspec = xstrdup (pathspec);
3798 int has_symlinks = 0;
3799 while (strlen (tmp_pathspec) && !has_symlinks)
3801 LTWRAPPER_DEBUGPRINTF (("checking path component for symlinks: %s\n",
3803 if (lstat (tmp_pathspec, &s) == 0)
3805 if (S_ISLNK (s.st_mode) != 0)
3811 /* search backwards for last DIR_SEPARATOR */
3812 p = tmp_pathspec + strlen (tmp_pathspec) - 1;
3813 while ((p > tmp_pathspec) && (!IS_DIR_SEPARATOR (*p)))
3815 if ((p == tmp_pathspec) && (!IS_DIR_SEPARATOR (*p)))
3817 /* no more DIR_SEPARATORS left */
3824 char *errstr = strerror (errno);
3825 lt_fatal ("Error accessing file %s (%s)", tmp_pathspec, errstr);
3828 XFREE (tmp_pathspec);
3832 return xstrdup (pathspec);
3835 tmp_pathspec = realpath (pathspec, buf);
3836 if (tmp_pathspec == 0)
3838 lt_fatal ("Could not follow symlinks for %s", pathspec);
3840 return xstrdup (tmp_pathspec);
3845 strendzap (char *str, const char *pat)
3849 assert (str != NULL);
3850 assert (pat != NULL);
3853 patlen = strlen (pat);
3857 str += len - patlen;
3858 if (strcmp (str, pat) == 0)
3865 lt_error_core (int exit_status, const char *mode,
3866 const char *message, va_list ap)
3868 fprintf (stderr, "%s: %s: ", program_name, mode);
3869 vfprintf (stderr, message, ap);
3870 fprintf (stderr, ".\n");
3872 if (exit_status >= 0)
3877 lt_fatal (const char *message, ...)
3880 va_start (ap, message);
3881 lt_error_core (EXIT_FAILURE, "FATAL", message, ap);
3886 # end: func_emit_cwrapperexe_src
3888 # func_mode_link arg...
3893 *-*-cygwin* | *-*-mingw* | *-*-pw32* | *-*-os2*)
3894 # It is impossible to link a dll without this setting, and
3895 # we shouldn't force the makefile maintainer to figure out
3896 # which system we are compiling for in order to pass an extra
3897 # flag for every libtool invocation.
3898 # allow_undefined=no
3900 # FIXME: Unfortunately, there are problems with the above when trying
3901 # to make a dll which has undefined symbols, in which case not
3902 # even a static library is built. For now, we need to specify
3903 # -no-undefined on the libtool link line when we can be certain
3904 # that all symbols are satisfied, otherwise we get a static library.
3911 libtool_args=$nonopt
3912 base_compile="$nonopt $@"
3913 compile_command=$nonopt
3914 finalize_command=$nonopt
3927 lib_search_path=`pwd`
3929 new_inherited_linker_flags=
3937 export_symbols_regex=
3945 precious_files_regex=
3946 prefer_static_libs=no
3959 single_module="${wl}-single_module"
3960 func_infer_tag $base_compile
3962 # We need to know -static, to get the right output filenames.
3967 test "$build_libtool_libs" != yes && \
3968 func_fatal_configuration "can not build a shared library"
3972 -all-static | -static | -static-libtool-libs)
3975 if test "$build_libtool_libs" = yes && test -z "$link_static_flag"; then
3976 func_warning "complete static linking is impossible in this configuration"
3978 if test -n "$link_static_flag"; then
3979 dlopen_self=$dlopen_self_static
3980 # See comment for -static flag below, for more details.
3981 func_append compile_command " $link_static_flag"
3982 func_append finalize_command " $link_static_flag"
3984 prefer_static_libs=yes
3987 if test -z "$pic_flag" && test -n "$link_static_flag"; then
3988 dlopen_self=$dlopen_self_static
3990 prefer_static_libs=built
3992 -static-libtool-libs)
3993 if test -z "$pic_flag" && test -n "$link_static_flag"; then
3994 dlopen_self=$dlopen_self_static
3996 prefer_static_libs=yes
3999 build_libtool_libs=no
4006 # See if our shared archives depend on static archives.
4007 test -n "$old_archive_from_new_cmds" && build_old_libs=yes
4009 # Go through the arguments, transforming them on the way.
4010 while test "$#" -gt 0; do
4013 func_quote_for_eval "$arg"
4014 qarg=$func_quote_for_eval_unquoted_result
4015 func_append libtool_args " $func_quote_for_eval_result"
4017 # If the previous option needs an argument, assign it.
4018 if test -n "$prev"; then
4021 func_append compile_command " @OUTPUT@"
4022 func_append finalize_command " @OUTPUT@"
4028 if test "$preload" = no; then
4029 # Add the symbol object into the linking commands.
4030 func_append compile_command " @SYMFILE@"
4031 func_append finalize_command " @SYMFILE@"
4035 *.la | *.lo) ;; # We handle these cases below.
4037 if test "$dlself" = no; then
4045 if test "$prev" = dlprefiles; then
4047 elif test "$prev" = dlfiles && test "$dlopen_self" != yes; then
4057 if test "$prev" = dlfiles; then
4058 dlfiles="$dlfiles $arg"
4060 dlprefiles="$dlprefiles $arg"
4068 export_symbols="$arg"
4070 || func_fatal_error "symbol file \`$arg' does not exist"
4075 export_symbols_regex="$arg"
4083 *" $qarg.ltframework "*) ;;
4084 *) deplibs="$deplibs $qarg.ltframework" # this is fixed later
4093 inst_prefix_dir="$arg"
4098 if test -f "$arg"; then
4101 for fil in `cat "$save_arg"`
4103 # moreargs="$moreargs $fil"
4105 # A libtool-controlled object.
4107 # Check to see that this really is a libtool object.
4108 if func_lalib_unsafe_p "$arg"; then
4115 if test -z "$pic_object" ||
4116 test -z "$non_pic_object" ||
4117 test "$pic_object" = none &&
4118 test "$non_pic_object" = none; then
4119 func_fatal_error "cannot find name of object for \`$arg'"
4122 # Extract subdirectory from the argument.
4123 func_dirname "$arg" "/" ""
4124 xdir="$func_dirname_result"
4126 if test "$pic_object" != none; then
4127 # Prepend the subdirectory the object is found in.
4128 pic_object="$xdir$pic_object"
4130 if test "$prev" = dlfiles; then
4131 if test "$build_libtool_libs" = yes && test "$dlopen_support" = yes; then
4132 dlfiles="$dlfiles $pic_object"
4136 # If libtool objects are unsupported, then we need to preload.
4141 # CHECK ME: I think I busted this. -Ossama
4142 if test "$prev" = dlprefiles; then
4143 # Preload the old-style object.
4144 dlprefiles="$dlprefiles $pic_object"
4149 func_append libobjs " $pic_object"
4154 if test "$non_pic_object" != none; then
4155 # Prepend the subdirectory the object is found in.
4156 non_pic_object="$xdir$non_pic_object"
4158 # A standard non-PIC object
4159 func_append non_pic_objects " $non_pic_object"
4160 if test -z "$pic_object" || test "$pic_object" = none ; then
4161 arg="$non_pic_object"
4164 # If the PIC object exists, use it instead.
4165 # $xdir was prepended to $pic_object above.
4166 non_pic_object="$pic_object"
4167 func_append non_pic_objects " $non_pic_object"
4170 # Only an error if not doing a dry-run.
4171 if $opt_dry_run; then
4172 # Extract subdirectory from the argument.
4173 func_dirname "$arg" "/" ""
4174 xdir="$func_dirname_result"
4177 pic_object=$xdir$objdir/$func_lo2o_result
4178 non_pic_object=$xdir$func_lo2o_result
4179 func_append libobjs " $pic_object"
4180 func_append non_pic_objects " $non_pic_object"
4182 func_fatal_error "\`$arg' is not a valid libtool object"
4187 func_fatal_error "link input file \`$arg' does not exist"
4194 precious_files_regex="$arg"
4204 # We need an absolute path.
4206 [\\/]* | [A-Za-z]:[\\/]*) ;;
4208 func_fatal_error "only absolute run-paths are allowed"
4211 if test "$prev" = rpath; then
4214 *) rpath="$rpath $arg" ;;
4219 *) xrpath="$xrpath $arg" ;;
4231 weak_libs="$weak_libs $arg"
4236 linker_flags="$linker_flags $qarg"
4237 compiler_flags="$compiler_flags $qarg"
4239 func_append compile_command " $qarg"
4240 func_append finalize_command " $qarg"
4244 compiler_flags="$compiler_flags $qarg"
4246 func_append compile_command " $qarg"
4247 func_append finalize_command " $qarg"
4251 linker_flags="$linker_flags $qarg"
4252 compiler_flags="$compiler_flags $wl$qarg"
4254 func_append compile_command " $wl$qarg"
4255 func_append finalize_command " $wl$qarg"
4259 eval "$prev=\"\$arg\""
4264 fi # test -n "$prev"
4270 # The effects of -all-static are defined in a previous loop.
4275 # FIXME: remove this flag sometime in the future.
4276 func_fatal_error "\`-allow-undefined' must not be used because it is the default"
4299 -export-symbols | -export-symbols-regex)
4300 if test -n "$export_symbols" || test -n "$export_symbols_regex"; then
4301 func_fatal_error "more than one -exported-symbols argument is not allowed"
4303 if test "X$arg" = "X-export-symbols"; then
4321 # The native IRIX linker understands -LANG:*, -LIST:* and -LNO:*
4322 # so, if we see these flags be careful not to treat them like -L
4324 case $with_gcc/$host in
4325 no/*-*-irix* | /*-*-irix*)
4326 func_append compile_command " $arg"
4327 func_append finalize_command " $arg"
4334 func_stripname '-L' '' "$arg"
4335 dir=$func_stripname_result
4336 # We need an absolute path.
4338 [\\/]* | [A-Za-z]:[\\/]*) ;;
4340 absdir=`cd "$dir" && pwd`
4341 test -z "$absdir" && \
4342 func_fatal_error "cannot determine absolute directory name of \`$dir'"
4349 deplibs="$deplibs -L$dir"
4350 lib_search_path="$lib_search_path $dir"
4354 *-*-cygwin* | *-*-mingw* | *-*-pw32* | *-*-os2*)
4355 testbindir=`$ECHO "X$dir" | $Xsed -e 's*/lib$*/bin*'`
4356 case :$dllsearchpath: in
4358 *) dllsearchpath="$dllsearchpath:$dir";;
4360 case :$dllsearchpath: in
4361 *":$testbindir:"*) ;;
4362 *) dllsearchpath="$dllsearchpath:$testbindir";;
4370 if test "X$arg" = "X-lc" || test "X$arg" = "X-lm"; then
4372 *-*-cygwin* | *-*-mingw* | *-*-pw32* | *-*-beos*)
4373 # These systems don't actually have a C or math library (as such)
4377 # These systems don't actually have a C library (as such)
4378 test "X$arg" = "X-lc" && continue
4380 *-*-openbsd* | *-*-freebsd* | *-*-dragonfly*)
4381 # Do not include libc due to us having libc/libc_r.
4382 test "X$arg" = "X-lc" && continue
4384 *-*-rhapsody* | *-*-darwin1.[012])
4385 # Rhapsody C and math libraries are in the System framework
4386 deplibs="$deplibs System.ltframework"
4389 *-*-sco3.2v5* | *-*-sco5v6*)
4390 # Causes problems with __ctype
4391 test "X$arg" = "X-lc" && continue
4393 *-*-sysv4.2uw2* | *-*-sysv5* | *-*-unixware* | *-*-OpenUNIX*)
4394 # Compiler inserts libc in the correct place for threads to work
4395 test "X$arg" = "X-lc" && continue
4398 elif test "X$arg" = "X-lc_r"; then
4400 *-*-openbsd* | *-*-freebsd* | *-*-dragonfly*)
4401 # Do not include libc_r directly, use -pthread flag.
4406 deplibs="$deplibs $arg"
4415 # Tru64 UNIX uses -model [arg] to determine the layout of C++
4416 # classes, name mangling, and exception handling.
4417 # Darwin uses the -arch flag to determine output architecture.
4418 -model|-arch|-isysroot)
4419 compiler_flags="$compiler_flags $arg"
4420 func_append compile_command " $arg"
4421 func_append finalize_command " $arg"
4426 -mt|-mthreads|-kthread|-Kthread|-pthread|-pthreads|--thread-safe|-threads)
4427 compiler_flags="$compiler_flags $arg"
4428 func_append compile_command " $arg"
4429 func_append finalize_command " $arg"
4430 case "$new_inherited_linker_flags " in
4432 * ) new_inherited_linker_flags="$new_inherited_linker_flags $arg" ;;
4438 single_module="${wl}-multi_module"
4449 *-*-cygwin* | *-*-mingw* | *-*-pw32* | *-*-os2* | *-*-darwin*)
4450 # The PATH hackery in wrapper scripts is required on Windows
4451 # and Darwin in order for the loader to find any dlls it needs.
4452 func_warning "\`-no-install' is ignored for $host"
4453 func_warning "assuming \`-no-fast-install' instead"
4456 *) no_install=yes ;;
4473 -precious-files-regex)
4494 func_stripname '-R' '' "$arg"
4495 dir=$func_stripname_result
4496 # We need an absolute path.
4498 [\\/]* | [A-Za-z]:[\\/]*) ;;
4500 func_fatal_error "only absolute run-paths are allowed"
4505 *) xrpath="$xrpath $dir" ;;
4511 # The effects of -shared are defined in a previous loop.
4520 -static | -static-libtool-libs)
4521 # The effects of -static are defined in a previous loop.
4522 # We used to do the same as -all-static on platforms that
4523 # didn't have a PIC flag, but the assumption that the effects
4524 # would be equivalent was wrong. It would break on at least
4525 # Digital Unix and AIX.
4551 func_stripname '-Wc,' '' "$arg"
4552 args=$func_stripname_result
4554 save_ifs="$IFS"; IFS=','
4555 for flag in $args; do
4557 func_quote_for_eval "$flag"
4558 arg="$arg $wl$func_quote_for_eval_result"
4559 compiler_flags="$compiler_flags $func_quote_for_eval_result"
4562 func_stripname ' ' '' "$arg"
4563 arg=$func_stripname_result
4567 func_stripname '-Wl,' '' "$arg"
4568 args=$func_stripname_result
4570 save_ifs="$IFS"; IFS=','
4571 for flag in $args; do
4573 func_quote_for_eval "$flag"
4574 arg="$arg $wl$func_quote_for_eval_result"
4575 compiler_flags="$compiler_flags $wl$func_quote_for_eval_result"
4576 linker_flags="$linker_flags $func_quote_for_eval_result"
4579 func_stripname ' ' '' "$arg"
4580 arg=$func_stripname_result
4600 func_quote_for_eval "$arg"
4601 arg="$func_quote_for_eval_result"
4604 # -64, -mips[0-9] enable 64-bit mode on the SGI compiler
4605 # -r[0-9][0-9]* specifies the processor on the SGI compiler
4606 # -xarch=*, -xtarget=* enable 64-bit mode on the Sun compiler
4607 # +DA*, +DD* enable 64-bit mode on the HP compiler
4608 # -q* pass through compiler args for the IBM compiler
4609 # -m*, -t[45]*, -txscale* pass through architecture-specific
4610 # compiler args for GCC
4611 # -F/path gives path to uninstalled frameworks, gcc on darwin
4612 # -p, -pg, --coverage, -fprofile-* pass through profiling flag for GCC
4613 # @file GCC response files
4614 -64|-mips[0-9]|-r[0-9][0-9]*|-xarch=*|-xtarget=*|+DA*|+DD*|-q*|-m*| \
4615 -t[45]*|-txscale*|-p|-pg|--coverage|-fprofile-*|-F*|@*)
4616 func_quote_for_eval "$arg"
4617 arg="$func_quote_for_eval_result"
4618 func_append compile_command " $arg"
4619 func_append finalize_command " $arg"
4620 compiler_flags="$compiler_flags $arg"
4624 # Some other compiler flag.
4626 func_quote_for_eval "$arg"
4627 arg="$func_quote_for_eval_result"
4631 # A standard object.
4636 # A libtool-controlled object.
4638 # Check to see that this really is a libtool object.
4639 if func_lalib_unsafe_p "$arg"; then
4646 if test -z "$pic_object" ||
4647 test -z "$non_pic_object" ||
4648 test "$pic_object" = none &&
4649 test "$non_pic_object" = none; then
4650 func_fatal_error "cannot find name of object for \`$arg'"
4653 # Extract subdirectory from the argument.
4654 func_dirname "$arg" "/" ""
4655 xdir="$func_dirname_result"
4657 if test "$pic_object" != none; then
4658 # Prepend the subdirectory the object is found in.
4659 pic_object="$xdir$pic_object"
4661 if test "$prev" = dlfiles; then
4662 if test "$build_libtool_libs" = yes && test "$dlopen_support" = yes; then
4663 dlfiles="$dlfiles $pic_object"
4667 # If libtool objects are unsupported, then we need to preload.
4672 # CHECK ME: I think I busted this. -Ossama
4673 if test "$prev" = dlprefiles; then
4674 # Preload the old-style object.
4675 dlprefiles="$dlprefiles $pic_object"
4680 func_append libobjs " $pic_object"
4685 if test "$non_pic_object" != none; then
4686 # Prepend the subdirectory the object is found in.
4687 non_pic_object="$xdir$non_pic_object"
4689 # A standard non-PIC object
4690 func_append non_pic_objects " $non_pic_object"
4691 if test -z "$pic_object" || test "$pic_object" = none ; then
4692 arg="$non_pic_object"
4695 # If the PIC object exists, use it instead.
4696 # $xdir was prepended to $pic_object above.
4697 non_pic_object="$pic_object"
4698 func_append non_pic_objects " $non_pic_object"
4701 # Only an error if not doing a dry-run.
4702 if $opt_dry_run; then
4703 # Extract subdirectory from the argument.
4704 func_dirname "$arg" "/" ""
4705 xdir="$func_dirname_result"
4708 pic_object=$xdir$objdir/$func_lo2o_result
4709 non_pic_object=$xdir$func_lo2o_result
4710 func_append libobjs " $pic_object"
4711 func_append non_pic_objects " $non_pic_object"
4713 func_fatal_error "\`$arg' is not a valid libtool object"
4720 deplibs="$deplibs $arg"
4721 old_deplibs="$old_deplibs $arg"
4726 # A libtool-controlled library.
4728 if test "$prev" = dlfiles; then
4729 # This library was specified with -dlopen.
4730 dlfiles="$dlfiles $arg"
4732 elif test "$prev" = dlprefiles; then
4733 # The library was specified with -dlpreopen.
4734 dlprefiles="$dlprefiles $arg"
4737 deplibs="$deplibs $arg"
4742 # Some other compiler argument.
4744 # Unknown arguments in both finalize_command and compile_command need
4745 # to be aesthetically quoted because they are evaled later.
4746 func_quote_for_eval "$arg"
4747 arg="$func_quote_for_eval_result"
4751 # Now actually substitute the argument into the commands.
4752 if test -n "$arg"; then
4753 func_append compile_command " $arg"
4754 func_append finalize_command " $arg"
4756 done # argument parsing loop
4758 test -n "$prev" && \
4759 func_fatal_help "the \`$prevarg' option requires an argument"
4761 if test "$export_dynamic" = yes && test -n "$export_dynamic_flag_spec"; then
4762 eval arg=\"$export_dynamic_flag_spec\"
4763 func_append compile_command " $arg"
4764 func_append finalize_command " $arg"
4768 # calculate the name of the file, without its directory
4769 func_basename "$output"
4770 outputname="$func_basename_result"
4771 libobjs_save="$libobjs"
4773 if test -n "$shlibpath_var"; then
4774 # get the directories listed in $shlibpath_var
4775 eval shlib_search_path=\`\$ECHO \"X\${$shlibpath_var}\" \| \$Xsed -e \'s/:/ /g\'\`
4779 eval sys_lib_search_path=\"$sys_lib_search_path_spec\"
4780 eval sys_lib_dlsearch_path=\"$sys_lib_dlsearch_path_spec\"
4782 func_dirname "$output" "/" ""
4783 output_objdir="$func_dirname_result$objdir"
4784 # Create the object directory.
4785 func_mkdir_p "$output_objdir"
4787 # Determine the type of output
4790 func_fatal_help "you must specify an output file"
4792 *.$libext) linkmode=oldlib ;;
4793 *.lo | *.$objext) linkmode=obj ;;
4794 *.la) linkmode=lib ;;
4795 *) linkmode=prog ;; # Anything else should be a program.
4801 # Find all interdependent deplibs by searching for libraries
4802 # that are linked more than once (e.g. -la -lb -la)
4803 for deplib in $deplibs; do
4804 if $opt_duplicate_deps ; then
4806 *" $deplib "*) specialdeplibs="$specialdeplibs $deplib" ;;
4809 libs="$libs $deplib"
4812 if test "$linkmode" = lib; then
4813 libs="$predeps $libs $compiler_lib_search_path $postdeps"
4815 # Compute libraries that are listed more than once in $predeps
4816 # $postdeps and mark them as special (i.e., whose duplicates are
4817 # not to be eliminated).
4819 if $opt_duplicate_compiler_generated_deps; then
4820 for pre_post_dep in $predeps $postdeps; do
4821 case "$pre_post_deps " in
4822 *" $pre_post_dep "*) specialdeplibs="$specialdeplibs $pre_post_deps" ;;
4824 pre_post_deps="$pre_post_deps $pre_post_dep"
4833 need_relink=no # whether we're linking any uninstalled libtool libraries
4834 notinst_deplibs= # not-installed libtool libraries
4835 notinst_path= # paths that contain not-installed libtool libraries
4839 passes="conv dlpreopen link"
4840 for file in $dlfiles $dlprefiles; do
4844 func_fatal_help "libraries can \`-dlopen' only libtool libraries: $file"
4855 passes="conv scan dlopen dlpreopen link"
4861 for pass in $passes; do
4862 # The preopen pass in lib mode reverses $deplibs; put it back here
4863 # so that -L comes before libs that need it for instance...
4864 if test "$linkmode,$pass" = "lib,link"; then
4865 ## FIXME: Find the place where the list is rebuilt in the wrong
4866 ## order, and fix it there properly
4868 for deplib in $deplibs; do
4869 tmp_deplibs="$deplib $tmp_deplibs"
4871 deplibs="$tmp_deplibs"
4874 if test "$linkmode,$pass" = "lib,link" ||
4875 test "$linkmode,$pass" = "prog,scan"; then
4879 if test "$linkmode" = prog; then
4881 dlopen) libs="$dlfiles" ;;
4882 dlpreopen) libs="$dlprefiles" ;;
4883 link) libs="$deplibs %DEPLIBS% $dependency_libs" ;;
4886 if test "$linkmode,$pass" = "lib,dlpreopen"; then
4887 # Collect and forward deplibs of preopened libtool libs
4888 for lib in $dlprefiles; do
4889 # Ignore non-libtool-libs
4892 *.la) func_source "$lib" ;;
4895 # Collect preopened libtool deplibs, except any this library
4896 # has declared as weak libs
4897 for deplib in $dependency_libs; do
4898 deplib_base=`$ECHO "X$deplib" | $Xsed -e "$basename"`
4899 case " $weak_libs " in
4900 *" $deplib_base "*) ;;
4901 *) deplibs="$deplibs $deplib" ;;
4907 if test "$pass" = dlopen; then
4908 # Collect dlpreopened libraries
4909 save_deplibs="$deplibs"
4913 for deplib in $libs; do
4917 -mt|-mthreads|-kthread|-Kthread|-pthread|-pthreads|--thread-safe|-threads)
4918 if test "$linkmode,$pass" = "prog,link"; then
4919 compile_deplibs="$deplib $compile_deplibs"
4920 finalize_deplibs="$deplib $finalize_deplibs"
4922 compiler_flags="$compiler_flags $deplib"
4923 if test "$linkmode" = lib ; then
4924 case "$new_inherited_linker_flags " in
4926 * ) new_inherited_linker_flags="$new_inherited_linker_flags $deplib" ;;
4933 if test "$linkmode" != lib && test "$linkmode" != prog; then
4934 func_warning "\`-l' is ignored for archives/objects"
4937 func_stripname '-l' '' "$deplib"
4938 name=$func_stripname_result
4939 if test "$linkmode" = lib; then
4940 searchdirs="$newlib_search_path $lib_search_path $compiler_lib_search_dirs $sys_lib_search_path $shlib_search_path"
4942 searchdirs="$newlib_search_path $lib_search_path $sys_lib_search_path $shlib_search_path"
4944 for searchdir in $searchdirs; do
4945 for search_ext in .la $std_shrext .so .a; do
4946 # Search the libtool library
4947 lib="$searchdir/lib${name}${search_ext}"
4948 if test -f "$lib"; then
4949 if test "$search_ext" = ".la"; then
4958 if test "$found" != yes; then
4959 # deplib doesn't seem to be a libtool library
4960 if test "$linkmode,$pass" = "prog,link"; then
4961 compile_deplibs="$deplib $compile_deplibs"
4962 finalize_deplibs="$deplib $finalize_deplibs"
4964 deplibs="$deplib $deplibs"
4965 test "$linkmode" = lib && newdependency_libs="$deplib $newdependency_libs"
4968 else # deplib is a libtool library
4969 # If $allow_libtool_libs_with_static_runtimes && $deplib is a stdlib,
4970 # We need to do some special things here, and not later.
4971 if test "X$allow_libtool_libs_with_static_runtimes" = "Xyes" ; then
4972 case " $predeps $postdeps " in
4974 if func_lalib_p "$lib"; then
4978 for l in $old_library $library_names; do
4981 if test "X$ll" = "X$old_library" ; then # only static version available
4983 func_dirname "$lib" "" "."
4984 ladir="$func_dirname_result"
4985 lib=$ladir/$old_library
4986 if test "$linkmode,$pass" = "prog,link"; then
4987 compile_deplibs="$deplib $compile_deplibs"
4988 finalize_deplibs="$deplib $finalize_deplibs"
4990 deplibs="$deplib $deplibs"
4991 test "$linkmode" = lib && newdependency_libs="$deplib $newdependency_libs"
5003 if test "$linkmode,$pass" = "prog,link"; then
5004 compile_deplibs="$deplib $compile_deplibs"
5005 finalize_deplibs="$deplib $finalize_deplibs"
5007 deplibs="$deplib $deplibs"
5008 if test "$linkmode" = lib ; then
5009 case "$new_inherited_linker_flags " in
5011 * ) new_inherited_linker_flags="$new_inherited_linker_flags $deplib" ;;
5020 deplibs="$deplib $deplibs"
5021 test "$pass" = conv && continue
5022 newdependency_libs="$deplib $newdependency_libs"
5023 func_stripname '-L' '' "$deplib"
5024 newlib_search_path="$newlib_search_path $func_stripname_result"
5027 if test "$pass" = conv; then
5028 deplibs="$deplib $deplibs"
5031 if test "$pass" = scan; then
5032 deplibs="$deplib $deplibs"
5034 compile_deplibs="$deplib $compile_deplibs"
5035 finalize_deplibs="$deplib $finalize_deplibs"
5037 func_stripname '-L' '' "$deplib"
5038 newlib_search_path="$newlib_search_path $func_stripname_result"
5041 func_warning "\`-L' is ignored for archives/objects"
5047 if test "$pass" = link; then
5048 func_stripname '-R' '' "$deplib"
5049 dir=$func_stripname_result
5050 # Make sure the xrpath contains only unique directories.
5053 *) xrpath="$xrpath $dir" ;;
5056 deplibs="$deplib $deplibs"
5059 *.la) lib="$deplib" ;;
5061 if test "$pass" = conv; then
5062 deplibs="$deplib $deplibs"
5067 # Linking convenience modules into shared libraries is allowed,
5068 # but linking other static libraries is non-portable.
5069 case " $dlpreconveniencelibs " in
5073 case $deplibs_check_method in
5075 set dummy $deplibs_check_method; shift
5076 match_pattern_regex=`expr "$deplibs_check_method" : "$1 \(.*\)"`
5077 if eval "\$ECHO \"X$deplib\"" 2>/dev/null | $Xsed -e 10q \
5078 | $EGREP "$match_pattern_regex" > /dev/null; then
5086 if test "$valid_a_lib" != yes; then
5088 $ECHO "*** Warning: Trying to link with static lib archive $deplib."
5089 $ECHO "*** I have the capability to make that library automatically link in when"
5090 $ECHO "*** you link to this library. But I can only do this if you have a"
5091 $ECHO "*** shared version of the library, which you do not appear to have"
5092 $ECHO "*** because the file extensions .$libext of this argument makes me believe"
5093 $ECHO "*** that it is just a static archive that I should not use here."
5096 $ECHO "*** Warning: Linking the shared library $output against the"
5097 $ECHO "*** static library $deplib is not portable!"
5098 deplibs="$deplib $deplibs"
5105 if test "$pass" != link; then
5106 deplibs="$deplib $deplibs"
5108 compile_deplibs="$deplib $compile_deplibs"
5109 finalize_deplibs="$deplib $finalize_deplibs"
5116 if test "$pass" = conv; then
5117 deplibs="$deplib $deplibs"
5118 elif test "$linkmode" = prog; then
5119 if test "$pass" = dlpreopen || test "$dlopen_support" != yes || test "$build_libtool_libs" = no; then
5120 # If there is no dlopen support or we're linking statically,
5121 # we need to preload.
5122 newdlprefiles="$newdlprefiles $deplib"
5123 compile_deplibs="$deplib $compile_deplibs"
5124 finalize_deplibs="$deplib $finalize_deplibs"
5126 newdlfiles="$newdlfiles $deplib"
5137 if test "$found" = yes || test -f "$lib"; then :
5139 func_fatal_error "cannot find the library \`$lib' or unhandled argument \`$deplib'"
5142 # Check to see that this really is a libtool archive.
5143 func_lalib_unsafe_p "$lib" \
5144 || func_fatal_error "\`$lib' is not a valid libtool archive"
5146 func_dirname "$lib" "" "."
5147 ladir="$func_dirname_result"
5155 inherited_linker_flags=
5156 # If the library was installed with an old release of libtool,
5157 # it will not redefine variables installed, or shouldnotlink
5166 # Convert "-framework foo" to "foo.ltframework"
5167 if test -n "$inherited_linker_flags"; then
5168 tmp_inherited_linker_flags=`$ECHO "X$inherited_linker_flags" | $Xsed -e 's/-framework \([^ $]*\)/\1.ltframework/g'`
5169 for tmp_inherited_linker_flag in $tmp_inherited_linker_flags; do
5170 case " $new_inherited_linker_flags " in
5171 *" $tmp_inherited_linker_flag "*) ;;
5172 *) new_inherited_linker_flags="$new_inherited_linker_flags $tmp_inherited_linker_flag";;
5176 dependency_libs=`$ECHO "X $dependency_libs" | $Xsed -e 's% \([^ $]*\).ltframework% -framework \1%g'`
5177 if test "$linkmode,$pass" = "lib,link" ||
5178 test "$linkmode,$pass" = "prog,scan" ||
5179 { test "$linkmode" != prog && test "$linkmode" != lib; }; then
5180 test -n "$dlopen" && dlfiles="$dlfiles $dlopen"
5181 test -n "$dlpreopen" && dlprefiles="$dlprefiles $dlpreopen"
5184 if test "$pass" = conv; then
5185 # Only check for convenience libraries
5186 deplibs="$lib $deplibs"
5187 if test -z "$libdir"; then
5188 if test -z "$old_library"; then
5189 func_fatal_error "cannot find name of link library for \`$lib'"
5191 # It is a libtool convenience library, so add in its objects.
5192 convenience="$convenience $ladir/$objdir/$old_library"
5193 old_convenience="$old_convenience $ladir/$objdir/$old_library"
5194 elif test "$linkmode" != prog && test "$linkmode" != lib; then
5195 func_fatal_error "\`$lib' is not a convenience library"
5198 for deplib in $dependency_libs; do
5199 deplibs="$deplib $deplibs"
5200 if $opt_duplicate_deps ; then
5201 case "$tmp_libs " in
5202 *" $deplib "*) specialdeplibs="$specialdeplibs $deplib" ;;
5205 tmp_libs="$tmp_libs $deplib"
5211 # Get the name of the library we link against.
5213 for l in $old_library $library_names; do
5216 if test -z "$linklib"; then
5217 func_fatal_error "cannot find name of link library for \`$lib'"
5220 # This library was specified with -dlopen.
5221 if test "$pass" = dlopen; then
5222 if test -z "$libdir"; then
5223 func_fatal_error "cannot -dlopen a convenience library: \`$lib'"
5225 if test -z "$dlname" ||
5226 test "$dlopen_support" != yes ||
5227 test "$build_libtool_libs" = no; then
5228 # If there is no dlname, no dlopen support or we're linking
5229 # statically, we need to preload. We also need to preload any
5230 # dependent libraries so libltdl's deplib preloader doesn't
5231 # bomb out in the load deplibs phase.
5232 dlprefiles="$dlprefiles $lib $dependency_libs"
5234 newdlfiles="$newdlfiles $lib"
5239 # We need an absolute path.
5241 [\\/]* | [A-Za-z]:[\\/]*) abs_ladir="$ladir" ;;
5243 abs_ladir=`cd "$ladir" && pwd`
5244 if test -z "$abs_ladir"; then
5245 func_warning "cannot determine absolute directory name of \`$ladir'"
5246 func_warning "passing it literally to the linker, although it might fail"
5251 func_basename "$lib"
5252 laname="$func_basename_result"
5254 # Find the relevant object directory and library name.
5255 if test "X$installed" = Xyes; then
5256 if test ! -f "$libdir/$linklib" && test -f "$abs_ladir/$linklib"; then
5257 func_warning "library \`$lib' was moved."
5265 test "X$hardcode_automatic" = Xyes && avoidtemprpath=yes
5267 if test ! -f "$ladir/$objdir/$linklib" && test -f "$abs_ladir/$linklib"; then
5270 # Remove this search path later
5271 notinst_path="$notinst_path $abs_ladir"
5273 dir="$ladir/$objdir"
5274 absdir="$abs_ladir/$objdir"
5275 # Remove this search path later
5276 notinst_path="$notinst_path $abs_ladir"
5278 fi # $installed = yes
5279 func_stripname 'lib' '.la' "$laname"
5280 name=$func_stripname_result
5282 # This library was specified with -dlpreopen.
5283 if test "$pass" = dlpreopen; then
5284 if test -z "$libdir" && test "$linkmode" = prog; then
5285 func_fatal_error "only libraries may -dlpreopen a convenience library: \`$lib'"
5287 # Prefer using a static library (so that no silly _DYNAMIC symbols
5288 # are required to link).
5289 if test -n "$old_library"; then
5290 newdlprefiles="$newdlprefiles $dir/$old_library"
5291 # Keep a list of preopened convenience libraries to check
5292 # that they are being used correctly in the link pass.
5293 test -z "$libdir" && \
5294 dlpreconveniencelibs="$dlpreconveniencelibs $dir/$old_library"
5295 # Otherwise, use the dlname, so that lt_dlopen finds it.
5296 elif test -n "$dlname"; then
5297 newdlprefiles="$newdlprefiles $dir/$dlname"
5299 newdlprefiles="$newdlprefiles $dir/$linklib"
5301 fi # $pass = dlpreopen
5303 if test -z "$libdir"; then
5304 # Link the convenience library
5305 if test "$linkmode" = lib; then
5306 deplibs="$dir/$old_library $deplibs"
5307 elif test "$linkmode,$pass" = "prog,link"; then
5308 compile_deplibs="$dir/$old_library $compile_deplibs"
5309 finalize_deplibs="$dir/$old_library $finalize_deplibs"
5311 deplibs="$lib $deplibs" # used for prog,scan pass
5317 if test "$linkmode" = prog && test "$pass" != link; then
5318 newlib_search_path="$newlib_search_path $ladir"
5319 deplibs="$lib $deplibs"
5322 if test "$link_all_deplibs" != no || test -z "$library_names" ||
5323 test "$build_libtool_libs" = no; then
5328 for deplib in $dependency_libs; do
5330 -L*) func_stripname '-L' '' "$deplib"
5331 newlib_search_path="$newlib_search_path $func_stripname_result"
5334 # Need to link against all dependency_libs?
5335 if test "$linkalldeplibs" = yes; then
5336 deplibs="$deplib $deplibs"
5338 # Need to hardcode shared library paths
5339 # or/and link against static libraries
5340 newdependency_libs="$deplib $newdependency_libs"
5342 if $opt_duplicate_deps ; then
5343 case "$tmp_libs " in
5344 *" $deplib "*) specialdeplibs="$specialdeplibs $deplib" ;;
5347 tmp_libs="$tmp_libs $deplib"
5350 fi # $linkmode = prog...
5352 if test "$linkmode,$pass" = "prog,link"; then
5353 if test -n "$library_names" &&
5354 { { test "$prefer_static_libs" = no ||
5355 test "$prefer_static_libs,$installed" = "built,yes"; } ||
5356 test -z "$old_library"; }; then
5357 # We need to hardcode the library path
5358 if test -n "$shlibpath_var" && test -z "$avoidtemprpath" ; then
5359 # Make sure the rpath contains only unique directories.
5360 case "$temp_rpath:" in
5362 *) temp_rpath="$temp_rpath$absdir:" ;;
5366 # Hardcode the library path.
5367 # Skip directories that are in the system default run-time
5369 case " $sys_lib_dlsearch_path " in
5372 case "$compile_rpath " in
5374 *) compile_rpath="$compile_rpath $absdir"
5378 case " $sys_lib_dlsearch_path " in
5381 case "$finalize_rpath " in
5383 *) finalize_rpath="$finalize_rpath $libdir"
5387 fi # $linkmode,$pass = prog,link...
5389 if test "$alldeplibs" = yes &&
5390 { test "$deplibs_check_method" = pass_all ||
5391 { test "$build_libtool_libs" = yes &&
5392 test -n "$library_names"; }; }; then
5393 # We only need to search for static libraries
5398 link_static=no # Whether the deplib will be linked statically
5399 use_static_libs=$prefer_static_libs
5400 if test "$use_static_libs" = built && test "$installed" = yes; then
5403 if test -n "$library_names" &&
5404 { test "$use_static_libs" = no || test -z "$old_library"; }; then
5407 # No point in relinking DLLs because paths are not encoded
5408 notinst_deplibs="$notinst_deplibs $lib"
5412 if test "$installed" = no; then
5413 notinst_deplibs="$notinst_deplibs $lib"
5418 # This is a shared library
5420 # Warn about portability, can't link against -module's on some
5421 # systems (darwin). Don't bleat about dlopened modules though!
5423 for dlpremoduletest in $dlprefiles; do
5424 if test "X$dlpremoduletest" = "X$lib"; then
5425 dlopenmodule="$dlpremoduletest"
5429 if test -z "$dlopenmodule" && test "$shouldnotlink" = yes && test "$pass" = link; then
5431 if test "$linkmode" = prog; then
5432 $ECHO "*** Warning: Linking the executable $output against the loadable module"
5434 $ECHO "*** Warning: Linking the shared library $output against the loadable module"
5436 $ECHO "*** $linklib is not portable!"
5438 if test "$linkmode" = lib &&
5439 test "$hardcode_into_libs" = yes; then
5440 # Hardcode the library path.
5441 # Skip directories that are in the system default run-time
5443 case " $sys_lib_dlsearch_path " in
5446 case "$compile_rpath " in
5448 *) compile_rpath="$compile_rpath $absdir"
5452 case " $sys_lib_dlsearch_path " in
5455 case "$finalize_rpath " in
5457 *) finalize_rpath="$finalize_rpath $libdir"
5463 if test -n "$old_archive_from_expsyms_cmds"; then
5464 # figure out the soname
5465 set dummy $library_names
5469 libname=`eval "\\$ECHO \"$libname_spec\""`
5470 # use dlname if we got it. it's perfectly good, no?
5471 if test -n "$dlname"; then
5473 elif test -n "$soname_spec"; then
5477 major=`expr $current - $age`
5481 eval soname=\"$soname_spec\"
5486 # Make a new name for the extract_expsyms_cmds to use
5488 func_basename "$soroot"
5489 soname="$func_basename_result"
5490 func_stripname 'lib' '.dll' "$soname"
5491 newlib=libimp-$func_stripname_result.a
5493 # If the library has no export list, then create one now
5494 if test -f "$output_objdir/$soname-def"; then :
5496 func_verbose "extracting exported symbol list from \`$soname'"
5497 func_execute_cmds "$extract_expsyms_cmds" 'exit $?'
5501 if test -f "$output_objdir/$newlib"; then :; else
5502 func_verbose "generating import library for \`$soname'"
5503 func_execute_cmds "$old_archive_from_expsyms_cmds" 'exit $?'
5505 # make sure the library variables are pointing to the new library
5508 fi # test -n "$old_archive_from_expsyms_cmds"
5510 if test "$linkmode" = prog || test "$mode" != relink; then
5515 case $hardcode_action in
5516 immediate | unsupported)
5517 if test "$hardcode_direct" = no; then
5520 *-*-sco3.2v5.0.[024]*) add_dir="-L$dir" ;;
5521 *-*-sysv4*uw2*) add_dir="-L$dir" ;;
5522 *-*-sysv5OpenUNIX* | *-*-sysv5UnixWare7.[01].[10]* | \
5523 *-*-unixware7*) add_dir="-L$dir" ;;
5525 # if the lib is a (non-dlopened) module then we can not
5526 # link against it, someone is ignoring the earlier warnings
5527 if /usr/bin/file -L $add 2> /dev/null |
5528 $GREP ": [^:]* bundle" >/dev/null ; then
5529 if test "X$dlopenmodule" != "X$lib"; then
5530 $ECHO "*** Warning: lib $linklib is a module, not a shared library"
5531 if test -z "$old_library" ; then
5533 $ECHO "*** And there doesn't seem to be a static archive available"
5534 $ECHO "*** The link will probably fail, sorry"
5536 add="$dir/$old_library"
5538 elif test -n "$old_library"; then
5539 add="$dir/$old_library"
5543 elif test "$hardcode_minus_L" = no; then
5545 *-*-sunos*) add_shlibpath="$dir" ;;
5549 elif test "$hardcode_shlibpath_var" = no; then
5550 add_shlibpath="$dir"
5557 if test "$hardcode_direct" = yes &&
5558 test "$hardcode_direct_absolute" = no; then
5560 elif test "$hardcode_minus_L" = yes; then
5562 # Try looking first in the location we're being installed to.
5563 if test -n "$inst_prefix_dir"; then
5566 add_dir="$add_dir -L$inst_prefix_dir$libdir"
5571 elif test "$hardcode_shlibpath_var" = yes; then
5572 add_shlibpath="$dir"
5581 if test "$lib_linked" != yes; then
5582 func_fatal_configuration "unsupported hardcode properties"
5585 if test -n "$add_shlibpath"; then
5586 case :$compile_shlibpath: in
5587 *":$add_shlibpath:"*) ;;
5588 *) compile_shlibpath="$compile_shlibpath$add_shlibpath:" ;;
5591 if test "$linkmode" = prog; then
5592 test -n "$add_dir" && compile_deplibs="$add_dir $compile_deplibs"
5593 test -n "$add" && compile_deplibs="$add $compile_deplibs"
5595 test -n "$add_dir" && deplibs="$add_dir $deplibs"
5596 test -n "$add" && deplibs="$add $deplibs"
5597 if test "$hardcode_direct" != yes &&
5598 test "$hardcode_minus_L" != yes &&
5599 test "$hardcode_shlibpath_var" = yes; then
5600 case :$finalize_shlibpath: in
5602 *) finalize_shlibpath="$finalize_shlibpath$libdir:" ;;
5608 if test "$linkmode" = prog || test "$mode" = relink; then
5612 # Finalize command for both is simple: just hardcode it.
5613 if test "$hardcode_direct" = yes &&
5614 test "$hardcode_direct_absolute" = no; then
5615 add="$libdir/$linklib"
5616 elif test "$hardcode_minus_L" = yes; then
5619 elif test "$hardcode_shlibpath_var" = yes; then
5620 case :$finalize_shlibpath: in
5622 *) finalize_shlibpath="$finalize_shlibpath$libdir:" ;;
5625 elif test "$hardcode_automatic" = yes; then
5626 if test -n "$inst_prefix_dir" &&
5627 test -f "$inst_prefix_dir$libdir/$linklib" ; then
5628 add="$inst_prefix_dir$libdir/$linklib"
5630 add="$libdir/$linklib"
5633 # We cannot seem to hardcode it, guess we'll fake it.
5635 # Try looking first in the location we're being installed to.
5636 if test -n "$inst_prefix_dir"; then
5639 add_dir="$add_dir -L$inst_prefix_dir$libdir"
5646 if test "$linkmode" = prog; then
5647 test -n "$add_dir" && finalize_deplibs="$add_dir $finalize_deplibs"
5648 test -n "$add" && finalize_deplibs="$add $finalize_deplibs"
5650 test -n "$add_dir" && deplibs="$add_dir $deplibs"
5651 test -n "$add" && deplibs="$add $deplibs"
5654 elif test "$linkmode" = prog; then
5655 # Here we assume that one of hardcode_direct or hardcode_minus_L
5656 # is not unsupported. This is valid on all known static and
5658 if test "$hardcode_direct" != unsupported; then
5659 test -n "$old_library" && linklib="$old_library"
5660 compile_deplibs="$dir/$linklib $compile_deplibs"
5661 finalize_deplibs="$dir/$linklib $finalize_deplibs"
5663 compile_deplibs="-l$name -L$dir $compile_deplibs"
5664 finalize_deplibs="-l$name -L$dir $finalize_deplibs"
5666 elif test "$build_libtool_libs" = yes; then
5667 # Not a shared library
5668 if test "$deplibs_check_method" != pass_all; then
5669 # We're trying link a shared library against a static one
5670 # but the system doesn't support it.
5672 # Just print a warning and add the library to dependency_libs so
5673 # that the program can be linked against the static library.
5675 $ECHO "*** Warning: This system can not link to static lib archive $lib."
5676 $ECHO "*** I have the capability to make that library automatically link in when"
5677 $ECHO "*** you link to this library. But I can only do this if you have a"
5678 $ECHO "*** shared version of the library, which you do not appear to have."
5679 if test "$module" = yes; then
5680 $ECHO "*** But as you try to build a module library, libtool will still create "
5681 $ECHO "*** a static module, that should work as long as the dlopening application"
5682 $ECHO "*** is linked with the -dlopen flag to resolve symbols at runtime."
5683 if test -z "$global_symbol_pipe"; then
5685 $ECHO "*** However, this would only work if libtool was able to extract symbol"
5686 $ECHO "*** lists from a program, using \`nm' or equivalent, but libtool could"
5687 $ECHO "*** not find such a program. So, this module is probably useless."
5688 $ECHO "*** \`nm' from GNU binutils and a full rebuild may help."
5690 if test "$build_old_libs" = no; then
5691 build_libtool_libs=module
5694 build_libtool_libs=no
5698 deplibs="$dir/$old_library $deplibs"
5701 fi # link shared/static library?
5703 if test "$linkmode" = lib; then
5704 if test -n "$dependency_libs" &&
5705 { test "$hardcode_into_libs" != yes ||
5706 test "$build_old_libs" = yes ||
5707 test "$link_static" = yes; }; then
5708 # Extract -R from dependency_libs
5710 for libdir in $dependency_libs; do
5712 -R*) func_stripname '-R' '' "$libdir"
5713 temp_xrpath=$func_stripname_result
5715 *" $temp_xrpath "*) ;;
5716 *) xrpath="$xrpath $temp_xrpath";;
5718 *) temp_deplibs="$temp_deplibs $libdir";;
5721 dependency_libs="$temp_deplibs"
5724 newlib_search_path="$newlib_search_path $absdir"
5725 # Link against this library
5726 test "$link_static" = no && newdependency_libs="$abs_ladir/$laname $newdependency_libs"
5727 # ... and its dependency_libs
5729 for deplib in $dependency_libs; do
5730 newdependency_libs="$deplib $newdependency_libs"
5731 if $opt_duplicate_deps ; then
5732 case "$tmp_libs " in
5733 *" $deplib "*) specialdeplibs="$specialdeplibs $deplib" ;;
5736 tmp_libs="$tmp_libs $deplib"
5739 if test "$link_all_deplibs" != no; then
5740 # Add the search paths of all dependency libraries
5741 for deplib in $dependency_libs; do
5743 -L*) path="$deplib" ;;
5745 func_dirname "$deplib" "" "."
5746 dir="$func_dirname_result"
5747 # We need an absolute path.
5749 [\\/]* | [A-Za-z]:[\\/]*) absdir="$dir" ;;
5751 absdir=`cd "$dir" && pwd`
5752 if test -z "$absdir"; then
5753 func_warning "cannot determine absolute directory name of \`$dir'"
5758 if $GREP "^installed=no" $deplib > /dev/null; then
5762 eval deplibrary_names=`${SED} -n -e 's/^library_names=\(.*\)$/\1/p' $deplib`
5763 if test -n "$deplibrary_names" ; then
5764 for tmp in $deplibrary_names ; do
5767 if test -f "$absdir/$objdir/$depdepl" ; then
5768 depdepl="$absdir/$objdir/$depdepl"
5769 darwin_install_name=`otool -L $depdepl | $SED -n -e '3q;2,2p' | $SED -e 's/(.*//'`
5770 darwin_install_name=`$ECHO $darwin_install_name`
5771 if test -z "$darwin_install_name"; then
5772 darwin_install_name=`otool64 -L $depdepl | $SED -n -e '3q;2,2p' | $SED -e 's/(.*//'`
5773 darwin_install_name=`$ECHO $darwin_install_name`
5775 compiler_flags="$compiler_flags ${wl}-dylib_file ${wl}${darwin_install_name}:${depdepl}"
5776 linker_flags="$linker_flags -dylib_file ${darwin_install_name}:${depdepl}"
5782 path="-L$absdir/$objdir"
5786 eval libdir=`${SED} -n -e 's/^libdir=\(.*\)$/\1/p' $deplib`
5787 test -z "$libdir" && \
5788 func_fatal_error "\`$deplib' is not a valid libtool archive"
5789 test "$absdir" != "$libdir" && \
5790 func_warning "\`$deplib' seems to be moved"
5796 case " $deplibs " in
5798 *) deplibs="$path $deplibs" ;;
5801 fi # link_all_deplibs != no
5803 done # for deplib in $libs
5804 if test "$pass" = link; then
5805 if test "$linkmode" = "prog"; then
5806 compile_deplibs="$new_inherited_linker_flags $compile_deplibs"
5807 finalize_deplibs="$new_inherited_linker_flags $finalize_deplibs"
5809 compiler_flags="$compiler_flags "`$ECHO "X $new_inherited_linker_flags" | $Xsed -e 's% \([^ $]*\).ltframework% -framework \1%g'`
5812 dependency_libs="$newdependency_libs"
5813 if test "$pass" = dlpreopen; then
5814 # Link the dlpreopened libraries before other libraries
5815 for deplib in $save_deplibs; do
5816 deplibs="$deplib $deplibs"
5819 if test "$pass" != dlopen; then
5820 if test "$pass" != conv; then
5821 # Make sure lib_search_path contains only unique directories.
5823 for dir in $newlib_search_path; do
5824 case "$lib_search_path " in
5826 *) lib_search_path="$lib_search_path $dir" ;;
5832 if test "$linkmode,$pass" != "prog,link"; then
5835 vars="compile_deplibs finalize_deplibs"
5837 for var in $vars dependency_libs; do
5838 # Add libraries to $var in reverse order
5839 eval tmp_libs=\"\$$var\"
5841 for deplib in $tmp_libs; do
5842 # FIXME: Pedantically, this is the right thing to do, so
5843 # that some nasty dependency loop isn't accidentally
5845 #new_libs="$deplib $new_libs"
5846 # Pragmatically, this seems to cause very few problems in
5849 -L*) new_libs="$deplib $new_libs" ;;
5852 # And here is the reason: when a library appears more
5853 # than once as an explicit dependence of a library, or
5854 # is implicitly linked in more than once by the
5855 # compiler, it is considered special, and multiple
5856 # occurrences thereof are not removed. Compare this
5857 # with having the same library being listed as a
5858 # dependency of multiple other libraries: in this case,
5859 # we know (pedantically, we assume) the library does not
5860 # need to be listed more than once, so we keep only the
5861 # last copy. This is not always right, but it is rare
5862 # enough that we require users that really mean to play
5863 # such unportable linking tricks to link the library
5864 # using -Wl,-lname, so that libtool does not consider it
5865 # for duplicate removal.
5866 case " $specialdeplibs " in
5867 *" $deplib "*) new_libs="$deplib $new_libs" ;;
5869 case " $new_libs " in
5871 *) new_libs="$deplib $new_libs" ;;
5879 for deplib in $new_libs; do
5882 case " $tmp_libs " in
5884 *) tmp_libs="$tmp_libs $deplib" ;;
5887 *) tmp_libs="$tmp_libs $deplib" ;;
5890 eval $var=\"$tmp_libs\"
5893 # Last step: remove runtime libs from dependency_libs
5894 # (they stay in deplibs)
5896 for i in $dependency_libs ; do
5897 case " $predeps $postdeps $compiler_lib_search_path " in
5902 if test -n "$i" ; then
5903 tmp_libs="$tmp_libs $i"
5906 dependency_libs=$tmp_libs
5908 if test "$linkmode" = prog; then
5909 dlfiles="$newdlfiles"
5911 if test "$linkmode" = prog || test "$linkmode" = lib; then
5912 dlprefiles="$newdlprefiles"
5917 if test -n "$dlfiles$dlprefiles" || test "$dlself" != no; then
5918 func_warning "\`-dlopen' is ignored for archives"
5923 func_warning "\`-l' and \`-L' are ignored for archives" ;;
5926 test -n "$rpath" && \
5927 func_warning "\`-rpath' is ignored for archives"
5929 test -n "$xrpath" && \
5930 func_warning "\`-R' is ignored for archives"
5932 test -n "$vinfo" && \
5933 func_warning "\`-version-info/-version-number' is ignored for archives"
5935 test -n "$release" && \
5936 func_warning "\`-release' is ignored for archives"
5938 test -n "$export_symbols$export_symbols_regex" && \
5939 func_warning "\`-export-symbols' is ignored for archives"
5941 # Now set the variables for building old libraries.
5942 build_libtool_libs=no
5944 objs="$objs$old_deplibs"
5948 # Make sure we only generate libraries of the form `libNAME.la'.
5951 func_stripname 'lib' '.la' "$outputname"
5952 name=$func_stripname_result
5953 eval shared_ext=\"$shrext_cmds\"
5954 eval libname=\"$libname_spec\"
5957 test "$module" = no && \
5958 func_fatal_help "libtool library \`$output' must begin with \`lib'"
5960 if test "$need_lib_prefix" != no; then
5961 # Add the "lib" prefix for modules if required
5962 func_stripname '' '.la' "$outputname"
5963 name=$func_stripname_result
5964 eval shared_ext=\"$shrext_cmds\"
5965 eval libname=\"$libname_spec\"
5967 func_stripname '' '.la' "$outputname"
5968 libname=$func_stripname_result
5973 if test -n "$objs"; then
5974 if test "$deplibs_check_method" != pass_all; then
5975 func_fatal_error "cannot build libtool library \`$output' from non-libtool objects on this host:$objs"
5978 $ECHO "*** Warning: Linking the shared library $output against the non-libtool"
5979 $ECHO "*** objects $objs is not portable!"
5980 libobjs="$libobjs $objs"
5984 test "$dlself" != no && \
5985 func_warning "\`-dlopen self' is ignored for libtool libraries"
5989 test "$#" -gt 1 && \
5990 func_warning "ignoring multiple \`-rpath's for a libtool library"
5995 if test -z "$rpath"; then
5996 if test "$build_libtool_libs" = yes; then
5997 # Building a libtool convenience library.
5998 # Some compilers have problems with a `.al' extension so
5999 # convenience libraries should have the same extension an
6000 # archive normally would.
6001 oldlibs="$output_objdir/$libname.$libext $oldlibs"
6002 build_libtool_libs=convenience
6006 test -n "$vinfo" && \
6007 func_warning "\`-version-info/-version-number' is ignored for convenience libraries"
6009 test -n "$release" && \
6010 func_warning "\`-release' is ignored for convenience libraries"
6013 # Parse the version information argument.
6014 save_ifs="$IFS"; IFS=':'
6015 set dummy $vinfo 0 0 0
6020 func_fatal_help "too many parameters to \`-version-info'"
6022 # convert absolute version numbers to libtool ages
6023 # this retains compatibility with .la files and attempts
6024 # to make the code below a bit more comprehensible
6026 case $vinfo_number in
6030 number_revision="$3"
6032 # There are really only two kinds -- those that
6033 # use the current revision as the major version
6034 # and those that subtract age and use age as
6035 # a minor version. But, then there is irix
6036 # which has an extra 1 added just for fun
6038 case $version_type in
6039 darwin|linux|osf|windows|none)
6040 current=`expr $number_major + $number_minor`
6042 revision="$number_revision"
6044 freebsd-aout|freebsd-elf|sunos)
6045 current="$number_major"
6046 revision="$number_minor"
6050 current=`expr $number_major + $number_minor`
6052 revision="$number_minor"
6053 lt_irix_increment=no
6064 # Check that each of the things are valid numbers.
6066 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]) ;;
6068 func_error "CURRENT \`$current' must be a nonnegative integer"
6069 func_fatal_error "\`$vinfo' is not valid version information"
6074 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]) ;;
6076 func_error "REVISION \`$revision' must be a nonnegative integer"
6077 func_fatal_error "\`$vinfo' is not valid version information"
6082 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]) ;;
6084 func_error "AGE \`$age' must be a nonnegative integer"
6085 func_fatal_error "\`$vinfo' is not valid version information"
6089 if test "$age" -gt "$current"; then
6090 func_error "AGE \`$age' is greater than the current interface number \`$current'"
6091 func_fatal_error "\`$vinfo' is not valid version information"
6094 # Calculate the version variables.
6098 case $version_type in
6102 # Like Linux, but with the current version available in
6103 # verstring for coding it into the library header
6104 major=.`expr $current - $age`
6105 versuffix="$major.$age.$revision"
6106 # Darwin ld doesn't like 0 for these options...
6107 minor_current=`expr $current + 1`
6108 xlcverstring="${wl}-compatibility_version ${wl}$minor_current ${wl}-current_version ${wl}$minor_current.$revision"
6109 verstring="-compatibility_version $minor_current -current_version $minor_current.$revision"
6114 versuffix=".$current.$revision";
6119 versuffix=".$current"
6123 if test "X$lt_irix_increment" = "Xno"; then
6124 major=`expr $current - $age`
6126 major=`expr $current - $age + 1`
6129 case $version_type in
6130 nonstopux) verstring_prefix=nonstopux ;;
6131 *) verstring_prefix=sgi ;;
6133 verstring="$verstring_prefix$major.$revision"
6135 # Add in all the interfaces that we are compatible with.
6137 while test "$loop" -ne 0; do
6138 iface=`expr $revision - $loop`
6139 loop=`expr $loop - 1`
6140 verstring="$verstring_prefix$major.$iface:$verstring"
6143 # Before this point, $major must not contain `.'.
6145 versuffix="$major.$revision"
6149 major=.`expr $current - $age`
6150 versuffix="$major.$age.$revision"
6154 major=.`expr $current - $age`
6155 versuffix=".$current.$age.$revision"
6156 verstring="$current.$age.$revision"
6158 # Add in all the interfaces that we are compatible with.
6160 while test "$loop" -ne 0; do
6161 iface=`expr $current - $loop`
6162 loop=`expr $loop - 1`
6163 verstring="$verstring:${iface}.0"
6166 # Make executables depend on our current version.
6167 verstring="$verstring:${current}.0"
6172 versuffix=".$current"
6177 versuffix=".$current.$revision"
6181 # Use '-' rather than '.', since we only want one
6182 # extension on DOS 8.3 filesystems.
6183 major=`expr $current - $age`
6188 func_fatal_configuration "unknown library version type \`$version_type'"
6192 # Clear the version info if we defaulted, and they specified a release.
6193 if test -z "$vinfo" && test -n "$release"; then
6195 case $version_type in
6197 # we can't check for "0.0" in archive_cmds due to quoting
6198 # problems, so we reset it completely
6205 if test "$need_version" = no; then
6212 # Remove version info from name if versioning should be avoided
6213 if test "$avoid_version" = yes && test "$need_version" = no; then
6219 # Check to see if the archive will have undefined symbols.
6220 if test "$allow_undefined" = yes; then
6221 if test "$allow_undefined_flag" = unsupported; then
6222 func_warning "undefined symbols not allowed in $host shared libraries"
6223 build_libtool_libs=no
6227 # Don't allow undefined symbols.
6228 allow_undefined_flag="$no_undefined_flag"
6233 func_generate_dlsyms "$libname" "$libname" "yes"
6234 libobjs="$libobjs $symfileobj"
6235 test "X$libobjs" = "X " && libobjs=
6237 if test "$mode" != relink; then
6238 # Remove our outputs, but don't remove object files since they
6239 # may have been created when compiling PIC objects.
6241 tempremovelist=`$ECHO "$output_objdir/*"`
6242 for p in $tempremovelist; do
6246 $output_objdir/$outputname | $output_objdir/$libname.* | $output_objdir/${libname}${release}.*)
6247 if test "X$precious_files_regex" != "X"; then
6248 if $ECHO "$p" | $EGREP -e "$precious_files_regex" >/dev/null 2>&1
6253 removelist="$removelist $p"
6258 test -n "$removelist" && \
6259 func_show_eval "${RM}r \$removelist"
6262 # Now set the variables for building old libraries.
6263 if test "$build_old_libs" = yes && test "$build_libtool_libs" != convenience ; then
6264 oldlibs="$oldlibs $output_objdir/$libname.$libext"
6266 # Transform .lo files to .o files.
6267 oldobjs="$objs "`$ECHO "X$libobjs" | $SP2NL | $Xsed -e '/\.'${libext}'$/d' -e "$lo2o" | $NL2SP`
6270 # Eliminate all temporary directories.
6271 #for path in $notinst_path; do
6272 # lib_search_path=`$ECHO "X$lib_search_path " | $Xsed -e "s% $path % %g"`
6273 # deplibs=`$ECHO "X$deplibs " | $Xsed -e "s% -L$path % %g"`
6274 # dependency_libs=`$ECHO "X$dependency_libs " | $Xsed -e "s% -L$path % %g"`
6277 if test -n "$xrpath"; then
6278 # If the user specified any rpath flags, then add them.
6280 for libdir in $xrpath; do
6281 temp_xrpath="$temp_xrpath -R$libdir"
6282 case "$finalize_rpath " in
6284 *) finalize_rpath="$finalize_rpath $libdir" ;;
6287 if test "$hardcode_into_libs" != yes || test "$build_old_libs" = yes; then
6288 dependency_libs="$temp_xrpath $dependency_libs"
6292 # Make sure dlfiles contains only unique files that won't be dlpreopened
6293 old_dlfiles="$dlfiles"
6295 for lib in $old_dlfiles; do
6296 case " $dlprefiles $dlfiles " in
6298 *) dlfiles="$dlfiles $lib" ;;
6302 # Make sure dlprefiles contains only unique files
6303 old_dlprefiles="$dlprefiles"
6305 for lib in $old_dlprefiles; do
6306 case "$dlprefiles " in
6308 *) dlprefiles="$dlprefiles $lib" ;;
6312 if test "$build_libtool_libs" = yes; then
6313 if test -n "$rpath"; then
6315 *-*-cygwin* | *-*-mingw* | *-*-pw32* | *-*-os2* | *-*-beos*)
6316 # these systems don't actually have a c library (as such)!
6318 *-*-rhapsody* | *-*-darwin1.[012])
6319 # Rhapsody C library is in the System framework
6320 deplibs="$deplibs System.ltframework"
6323 # Don't link with libc until the a.out ld.so is fixed.
6325 *-*-openbsd* | *-*-freebsd* | *-*-dragonfly*)
6326 # Do not include libc due to us having libc/libc_r.
6328 *-*-sco3.2v5* | *-*-sco5v6*)
6329 # Causes problems with __ctype
6331 *-*-sysv4.2uw2* | *-*-sysv5* | *-*-unixware* | *-*-OpenUNIX*)
6332 # Compiler inserts libc in the correct place for threads to work
6335 # Add libc to deplibs on all other systems if necessary.
6336 if test "$build_libtool_need_lc" = "yes"; then
6337 deplibs="$deplibs -lc"
6343 # Transform deplibs into only deplibs that can be linked in shared.
6345 libname_save=$libname
6346 release_save=$release
6347 versuffix_save=$versuffix
6349 # I'm not sure if I'm treating the release correctly. I think
6350 # release should show up in the -l (ie -lgmp5) so we don't want to
6351 # add it in twice. Is that correct?
6357 case $deplibs_check_method in
6359 # Don't check for shared/static. Everything works.
6360 # This might be a little naive. We might want to check
6361 # whether the library exists or not. But this is on
6362 # osf3 & osf4 and I'm not really sure... Just
6363 # implementing what was already the behavior.
6367 # This code stresses the "libraries are programs" paradigm to its
6368 # limits. Maybe even breaks it. We compile a program, linking it
6369 # against the deplibs as a proxy for the library. Then we can check
6370 # whether they linked in statically or dynamically with ldd.
6371 $opt_dry_run || $RM conftest.c
6372 cat > conftest.c <<EOF
6373 int main() { return 0; }
6375 $opt_dry_run || $RM conftest
6376 if $LTCC $LTCFLAGS -o conftest conftest.c $deplibs; then
6377 ldd_output=`ldd conftest`
6378 for i in $deplibs; do
6379 name=`expr $i : '-l\(.*\)'`
6380 # If $name is empty we are operating on a -L argument.
6381 if test "$name" != "" && test "$name" != "0"; then
6382 if test "X$allow_libtool_libs_with_static_runtimes" = "Xyes" ; then
6383 case " $predeps $postdeps " in
6385 newdeplibs="$newdeplibs $i"
6390 if test -n "$i" ; then
6391 libname=`eval "\\$ECHO \"$libname_spec\""`
6392 deplib_matches=`eval "\\$ECHO \"$library_names_spec\""`
6393 set dummy $deplib_matches; shift
6395 if test `expr "$ldd_output" : ".*$deplib_match"` -ne 0 ; then
6396 newdeplibs="$newdeplibs $i"
6400 $ECHO "*** Warning: dynamic linker does not accept needed library $i."
6401 $ECHO "*** I have the capability to make that library automatically link in when"
6402 $ECHO "*** you link to this library. But I can only do this if you have a"
6403 $ECHO "*** shared version of the library, which I believe you do not have"
6404 $ECHO "*** because a test_compile did reveal that the linker did not use it for"
6405 $ECHO "*** its dynamic dependency list that programs get resolved with at runtime."
6409 newdeplibs="$newdeplibs $i"
6413 # Error occurred in the first compile. Let's try to salvage
6414 # the situation: Compile a separate program for each library.
6415 for i in $deplibs; do
6416 name=`expr $i : '-l\(.*\)'`
6417 # If $name is empty we are operating on a -L argument.
6418 if test "$name" != "" && test "$name" != "0"; then
6419 $opt_dry_run || $RM conftest
6420 if $LTCC $LTCFLAGS -o conftest conftest.c $i; then
6421 ldd_output=`ldd conftest`
6422 if test "X$allow_libtool_libs_with_static_runtimes" = "Xyes" ; then
6423 case " $predeps $postdeps " in
6425 newdeplibs="$newdeplibs $i"
6430 if test -n "$i" ; then
6431 libname=`eval "\\$ECHO \"$libname_spec\""`
6432 deplib_matches=`eval "\\$ECHO \"$library_names_spec\""`
6433 set dummy $deplib_matches; shift
6435 if test `expr "$ldd_output" : ".*$deplib_match"` -ne 0 ; then
6436 newdeplibs="$newdeplibs $i"
6440 $ECHO "*** Warning: dynamic linker does not accept needed library $i."
6441 $ECHO "*** I have the capability to make that library automatically link in when"
6442 $ECHO "*** you link to this library. But I can only do this if you have a"
6443 $ECHO "*** shared version of the library, which you do not appear to have"
6444 $ECHO "*** because a test_compile did reveal that the linker did not use this one"
6445 $ECHO "*** as a dynamic dependency that programs can get resolved with at runtime."
6451 $ECHO "*** Warning! Library $i is needed by this library but I was not able to"
6452 $ECHO "*** make it link in! You will probably need to install it or some"
6453 $ECHO "*** library that it depends on before this library will be fully"
6454 $ECHO "*** functional. Installing it before continuing would be even better."
6457 newdeplibs="$newdeplibs $i"
6463 set dummy $deplibs_check_method; shift
6464 file_magic_regex=`expr "$deplibs_check_method" : "$1 \(.*\)"`
6465 for a_deplib in $deplibs; do
6466 name=`expr $a_deplib : '-l\(.*\)'`
6467 # If $name is empty we are operating on a -L argument.
6468 if test "$name" != "" && test "$name" != "0"; then
6469 if test "X$allow_libtool_libs_with_static_runtimes" = "Xyes" ; then
6470 case " $predeps $postdeps " in
6472 newdeplibs="$newdeplibs $a_deplib"
6477 if test -n "$a_deplib" ; then
6478 libname=`eval "\\$ECHO \"$libname_spec\""`
6479 for i in $lib_search_path $sys_lib_search_path $shlib_search_path; do
6480 potential_libs=`ls $i/$libname[.-]* 2>/dev/null`
6481 for potent_lib in $potential_libs; do
6482 # Follow soft links.
6483 if ls -lLd "$potent_lib" 2>/dev/null |
6484 $GREP " -> " >/dev/null; then
6487 # The statement above tries to avoid entering an
6488 # endless loop below, in case of cyclic links.
6489 # We might still enter an endless loop, since a link
6490 # loop can be closed while we follow links,
6492 potlib="$potent_lib"
6493 while test -h "$potlib" 2>/dev/null; do
6494 potliblink=`ls -ld $potlib | ${SED} 's/.* -> //'`
6496 [\\/]* | [A-Za-z]:[\\/]*) potlib="$potliblink";;
6497 *) potlib=`$ECHO "X$potlib" | $Xsed -e 's,[^/]*$,,'`"$potliblink";;
6500 if eval $file_magic_cmd \"\$potlib\" 2>/dev/null |
6502 $EGREP "$file_magic_regex" > /dev/null; then
6503 newdeplibs="$newdeplibs $a_deplib"
6510 if test -n "$a_deplib" ; then
6513 $ECHO "*** Warning: linker path does not have real file for library $a_deplib."
6514 $ECHO "*** I have the capability to make that library automatically link in when"
6515 $ECHO "*** you link to this library. But I can only do this if you have a"
6516 $ECHO "*** shared version of the library, which you do not appear to have"
6517 $ECHO "*** because I did check the linker path looking for a file starting"
6518 if test -z "$potlib" ; then
6519 $ECHO "*** with $libname but no candidates were found. (...for file magic test)"
6521 $ECHO "*** with $libname and none of the candidates passed a file format test"
6522 $ECHO "*** using a file magic. Last file checked: $potlib"
6526 # Add a -L argument.
6527 newdeplibs="$newdeplibs $a_deplib"
6529 done # Gone through all deplibs.
6532 set dummy $deplibs_check_method; shift
6533 match_pattern_regex=`expr "$deplibs_check_method" : "$1 \(.*\)"`
6534 for a_deplib in $deplibs; do
6535 name=`expr $a_deplib : '-l\(.*\)'`
6536 # If $name is empty we are operating on a -L argument.
6537 if test -n "$name" && test "$name" != "0"; then
6538 if test "X$allow_libtool_libs_with_static_runtimes" = "Xyes" ; then
6539 case " $predeps $postdeps " in
6541 newdeplibs="$newdeplibs $a_deplib"
6546 if test -n "$a_deplib" ; then
6547 libname=`eval "\\$ECHO \"$libname_spec\""`
6548 for i in $lib_search_path $sys_lib_search_path $shlib_search_path; do
6549 potential_libs=`ls $i/$libname[.-]* 2>/dev/null`
6550 for potent_lib in $potential_libs; do
6551 potlib="$potent_lib" # see symlink-check above in file_magic test
6552 if eval "\$ECHO \"X$potent_lib\"" 2>/dev/null | $Xsed -e 10q | \
6553 $EGREP "$match_pattern_regex" > /dev/null; then
6554 newdeplibs="$newdeplibs $a_deplib"
6561 if test -n "$a_deplib" ; then
6564 $ECHO "*** Warning: linker path does not have real file for library $a_deplib."
6565 $ECHO "*** I have the capability to make that library automatically link in when"
6566 $ECHO "*** you link to this library. But I can only do this if you have a"
6567 $ECHO "*** shared version of the library, which you do not appear to have"
6568 $ECHO "*** because I did check the linker path looking for a file starting"
6569 if test -z "$potlib" ; then
6570 $ECHO "*** with $libname but no candidates were found. (...for regex pattern test)"
6572 $ECHO "*** with $libname and none of the candidates passed a file format test"
6573 $ECHO "*** using a regex pattern. Last file checked: $potlib"
6577 # Add a -L argument.
6578 newdeplibs="$newdeplibs $a_deplib"
6580 done # Gone through all deplibs.
6584 tmp_deplibs=`$ECHO "X $deplibs" | $Xsed \
6585 -e 's/ -lc$//' -e 's/ -[LR][^ ]*//g'`
6586 if test "X$allow_libtool_libs_with_static_runtimes" = "Xyes" ; then
6587 for i in $predeps $postdeps ; do
6588 # can't use Xsed below, because $i might contain '/'
6589 tmp_deplibs=`$ECHO "X $tmp_deplibs" | $Xsed -e "s,$i,,"`
6592 if $ECHO "X $tmp_deplibs" | $Xsed -e 's/[ ]//g' |
6593 $GREP . >/dev/null; then
6595 if test "X$deplibs_check_method" = "Xnone"; then
6596 $ECHO "*** Warning: inter-library dependencies are not supported in this platform."
6598 $ECHO "*** Warning: inter-library dependencies are not known to be supported."
6600 $ECHO "*** All declared inter-library dependencies are being dropped."
6605 versuffix=$versuffix_save
6607 release=$release_save
6608 libname=$libname_save
6612 *-*-rhapsody* | *-*-darwin1.[012])
6613 # On Rhapsody replace the C library with the System framework
6614 newdeplibs=`$ECHO "X $newdeplibs" | $Xsed -e 's/ -lc / System.ltframework /'`
6618 if test "$droppeddeps" = yes; then
6619 if test "$module" = yes; then
6621 $ECHO "*** Warning: libtool could not satisfy all declared inter-library"
6622 $ECHO "*** dependencies of module $libname. Therefore, libtool will create"
6623 $ECHO "*** a static module, that should work as long as the dlopening"
6624 $ECHO "*** application is linked with the -dlopen flag."
6625 if test -z "$global_symbol_pipe"; then
6627 $ECHO "*** However, this would only work if libtool was able to extract symbol"
6628 $ECHO "*** lists from a program, using \`nm' or equivalent, but libtool could"
6629 $ECHO "*** not find such a program. So, this module is probably useless."
6630 $ECHO "*** \`nm' from GNU binutils and a full rebuild may help."
6632 if test "$build_old_libs" = no; then
6633 oldlibs="$output_objdir/$libname.$libext"
6634 build_libtool_libs=module
6637 build_libtool_libs=no
6640 $ECHO "*** The inter-library dependencies that have been dropped here will be"
6641 $ECHO "*** automatically added whenever a program is linked with this library"
6642 $ECHO "*** or is declared to -dlopen it."
6644 if test "$allow_undefined" = no; then
6646 $ECHO "*** Since this library must not contain undefined symbols,"
6647 $ECHO "*** because either the platform does not support them or"
6648 $ECHO "*** it was explicitly requested with -no-undefined,"
6649 $ECHO "*** libtool will only create a static version of it."
6650 if test "$build_old_libs" = no; then
6651 oldlibs="$output_objdir/$libname.$libext"
6652 build_libtool_libs=module
6655 build_libtool_libs=no
6660 # Done checking deplibs!
6663 # Time to change all our "foo.ltframework" stuff back to "-framework foo"
6666 newdeplibs=`$ECHO "X $newdeplibs" | $Xsed -e 's% \([^ $]*\).ltframework% -framework \1%g'`
6667 new_inherited_linker_flags=`$ECHO "X $new_inherited_linker_flags" | $Xsed -e 's% \([^ $]*\).ltframework% -framework \1%g'`
6668 deplibs=`$ECHO "X $deplibs" | $Xsed -e 's% \([^ $]*\).ltframework% -framework \1%g'`
6672 # move library search paths that coincide with paths to not yet
6673 # installed libraries to the beginning of the library search list
6675 for path in $notinst_path; do
6676 case " $new_libs " in
6677 *" -L$path/$objdir "*) ;;
6679 case " $deplibs " in
6680 *" -L$path/$objdir "*)
6681 new_libs="$new_libs -L$path/$objdir" ;;
6686 for deplib in $deplibs; do
6689 case " $new_libs " in
6691 *) new_libs="$new_libs $deplib" ;;
6694 *) new_libs="$new_libs $deplib" ;;
6699 # All the library-specific variables (install_libdir is set above).
6704 # Test again, we may have decided not to build it any more
6705 if test "$build_libtool_libs" = yes; then
6706 if test "$hardcode_into_libs" = yes; then
6707 # Hardcode the library paths
6710 rpath="$finalize_rpath"
6711 test "$mode" != relink && rpath="$compile_rpath$rpath"
6712 for libdir in $rpath; do
6713 if test -n "$hardcode_libdir_flag_spec"; then
6714 if test -n "$hardcode_libdir_separator"; then
6715 if test -z "$hardcode_libdirs"; then
6716 hardcode_libdirs="$libdir"
6718 # Just accumulate the unique libdirs.
6719 case $hardcode_libdir_separator$hardcode_libdirs$hardcode_libdir_separator in
6720 *"$hardcode_libdir_separator$libdir$hardcode_libdir_separator"*)
6723 hardcode_libdirs="$hardcode_libdirs$hardcode_libdir_separator$libdir"
6728 eval flag=\"$hardcode_libdir_flag_spec\"
6729 dep_rpath="$dep_rpath $flag"
6731 elif test -n "$runpath_var"; then
6732 case "$perm_rpath " in
6734 *) perm_rpath="$perm_rpath $libdir" ;;
6738 # Substitute the hardcoded libdirs into the rpath.
6739 if test -n "$hardcode_libdir_separator" &&
6740 test -n "$hardcode_libdirs"; then
6741 libdir="$hardcode_libdirs"
6742 if test -n "$hardcode_libdir_flag_spec_ld"; then
6743 eval dep_rpath=\"$hardcode_libdir_flag_spec_ld\"
6745 eval dep_rpath=\"$hardcode_libdir_flag_spec\"
6748 if test -n "$runpath_var" && test -n "$perm_rpath"; then
6749 # We should set the runpath_var.
6751 for dir in $perm_rpath; do
6754 eval "$runpath_var='$rpath\$$runpath_var'; export $runpath_var"
6756 test -n "$dep_rpath" && deplibs="$dep_rpath $deplibs"
6759 shlibpath="$finalize_shlibpath"
6760 test "$mode" != relink && shlibpath="$compile_shlibpath$shlibpath"
6761 if test -n "$shlibpath"; then
6762 eval "$shlibpath_var='$shlibpath\$$shlibpath_var'; export $shlibpath_var"
6765 # Get the real and link names of the library.
6766 eval shared_ext=\"$shrext_cmds\"
6767 eval library_names=\"$library_names_spec\"
6768 set dummy $library_names
6773 if test -n "$soname_spec"; then
6774 eval soname=\"$soname_spec\"
6778 if test -z "$dlname"; then
6782 lib="$output_objdir/$realname"
6786 linknames="$linknames $link"
6789 # Use standard objects if they are pic
6790 test -z "$pic_flag" && libobjs=`$ECHO "X$libobjs" | $SP2NL | $Xsed -e "$lo2o" | $NL2SP`
6791 test "X$libobjs" = "X " && libobjs=
6794 if test -n "$export_symbols" && test -n "$include_expsyms"; then
6795 $opt_dry_run || cp "$export_symbols" "$output_objdir/$libname.uexp"
6796 export_symbols="$output_objdir/$libname.uexp"
6797 delfiles="$delfiles $export_symbols"
6800 orig_export_symbols=
6803 if test -n "$export_symbols" && test -z "$export_symbols_regex"; then
6804 # exporting using user supplied symfile
6805 if test "x`$SED 1q $export_symbols`" != xEXPORTS; then
6806 # and it's NOT already a .def file. Must figure out
6807 # which of the given symbols are data symbols and tag
6808 # them as such. So, trigger use of export_symbols_cmds.
6809 # export_symbols gets reassigned inside the "prepare
6810 # the list of exported symbols" if statement, so the
6811 # include_expsyms logic still works.
6812 orig_export_symbols="$export_symbols"
6814 always_export_symbols=yes
6820 # Prepare the list of exported symbols
6821 if test -z "$export_symbols"; then
6822 if test "$always_export_symbols" = yes || test -n "$export_symbols_regex"; then
6823 func_verbose "generating symbol list for \`$libname.la'"
6824 export_symbols="$output_objdir/$libname.exp"
6825 $opt_dry_run || $RM $export_symbols
6826 cmds=$export_symbols_cmds
6827 save_ifs="$IFS"; IFS='~'
6828 for cmd in $cmds; do
6831 if len=`expr "X$cmd" : ".*"` &&
6832 test "$len" -le "$max_cmd_len" || test "$max_cmd_len" -le -1; then
6833 func_show_eval "$cmd" 'exit $?'
6834 skipped_export=false
6836 # The command line is too long to execute in one step.
6837 func_verbose "using reloadable object file for export list..."
6839 # Break out early, otherwise skipped_export may be
6840 # set to false by a later but shorter cmd.
6845 if test -n "$export_symbols_regex" && test "X$skipped_export" != "X:"; then
6846 func_show_eval '$EGREP -e "$export_symbols_regex" "$export_symbols" > "${export_symbols}T"'
6847 func_show_eval '$MV "${export_symbols}T" "$export_symbols"'
6852 if test -n "$export_symbols" && test -n "$include_expsyms"; then
6853 tmp_export_symbols="$export_symbols"
6854 test -n "$orig_export_symbols" && tmp_export_symbols="$orig_export_symbols"
6855 $opt_dry_run || eval '$ECHO "X$include_expsyms" | $Xsed | $SP2NL >> "$tmp_export_symbols"'
6858 if test "X$skipped_export" != "X:" && test -n "$orig_export_symbols"; then
6859 # The given exports_symbols file has to be filtered, so filter it.
6860 func_verbose "filter symbol list for \`$libname.la' to tag DATA exports"
6861 # FIXME: $output_objdir/$libname.filter potentially contains lots of
6862 # 's' commands which not all seds can handle. GNU sed should be fine
6863 # though. Also, the filter scales superlinearly with the number of
6864 # global variables. join(1) would be nice here, but unfortunately
6865 # isn't a blessed tool.
6866 $opt_dry_run || $SED -e '/[ ,]DATA/!d;s,\(.*\)\([ \,].*\),s|^\1$|\1\2|,' < $export_symbols > $output_objdir/$libname.filter
6867 delfiles="$delfiles $export_symbols $output_objdir/$libname.filter"
6868 export_symbols=$output_objdir/$libname.def
6869 $opt_dry_run || $SED -f $output_objdir/$libname.filter < $orig_export_symbols > $export_symbols
6873 for test_deplib in $deplibs; do
6874 case " $convenience " in
6875 *" $test_deplib "*) ;;
6877 tmp_deplibs="$tmp_deplibs $test_deplib"
6881 deplibs="$tmp_deplibs"
6883 if test -n "$convenience"; then
6884 if test -n "$whole_archive_flag_spec" &&
6885 test "$compiler_needs_object" = yes &&
6886 test -z "$libobjs"; then
6887 # extract the archives, so we have objects to list.
6888 # TODO: could optimize this to just extract one archive.
6889 whole_archive_flag_spec=
6891 if test -n "$whole_archive_flag_spec"; then
6892 save_libobjs=$libobjs
6893 eval libobjs=\"\$libobjs $whole_archive_flag_spec\"
6894 test "X$libobjs" = "X " && libobjs=
6896 gentop="$output_objdir/${outputname}x"
6897 generated="$generated $gentop"
6899 func_extract_archives $gentop $convenience
6900 libobjs="$libobjs $func_extract_archives_result"
6901 test "X$libobjs" = "X " && libobjs=
6905 if test "$thread_safe" = yes && test -n "$thread_safe_flag_spec"; then
6906 eval flag=\"$thread_safe_flag_spec\"
6907 linker_flags="$linker_flags $flag"
6910 # Make a backup of the uninstalled library when relinking
6911 if test "$mode" = relink; then
6912 $opt_dry_run || eval '(cd $output_objdir && $RM ${realname}U && $MV $realname ${realname}U)' || exit $?
6915 # Do each of the archive commands.
6916 if test "$module" = yes && test -n "$module_cmds" ; then
6917 if test -n "$export_symbols" && test -n "$module_expsym_cmds"; then
6918 eval test_cmds=\"$module_expsym_cmds\"
6919 cmds=$module_expsym_cmds
6921 eval test_cmds=\"$module_cmds\"
6925 if test -n "$export_symbols" && test -n "$archive_expsym_cmds"; then
6926 eval test_cmds=\"$archive_expsym_cmds\"
6927 cmds=$archive_expsym_cmds
6929 eval test_cmds=\"$archive_cmds\"
6934 if test "X$skipped_export" != "X:" &&
6935 len=`expr "X$test_cmds" : ".*" 2>/dev/null` &&
6936 test "$len" -le "$max_cmd_len" || test "$max_cmd_len" -le -1; then
6939 # The command line is too long to link in one step, link piecewise
6940 # or, if using GNU ld and skipped_export is not :, use a linker
6943 # Save the value of $output and $libobjs because we want to
6944 # use them later. If we have whole_archive_flag_spec, we
6945 # want to use save_libobjs as it was before
6946 # whole_archive_flag_spec was expanded, because we can't
6947 # assume the linker understands whole_archive_flag_spec.
6948 # This may have to be revisited, in case too many
6949 # convenience libraries get linked in and end up exceeding
6951 if test -z "$convenience" || test -z "$whole_archive_flag_spec"; then
6952 save_libobjs=$libobjs
6955 output_la=`$ECHO "X$output" | $Xsed -e "$basename"`
6957 # Clear the reloadable object creation command queue and
6958 # initialize k to one.
6965 if test -n "$save_libobjs" && test "X$skipped_export" != "X:" && test "$with_gnu_ld" = yes; then
6966 output=${output_objdir}/${output_la}.lnkscript
6967 func_verbose "creating GNU ld script: $output"
6968 $ECHO 'INPUT (' > $output
6969 for obj in $save_libobjs
6971 $ECHO "$obj" >> $output
6973 $ECHO ')' >> $output
6974 delfiles="$delfiles $output"
6975 elif test -n "$save_libobjs" && test "X$skipped_export" != "X:" && test "X$file_list_spec" != X; then
6976 output=${output_objdir}/${output_la}.lnk
6977 func_verbose "creating linker input file list: $output"
6982 if test "$compiler_needs_object" = yes; then
6988 $ECHO "$obj" >> $output
6990 delfiles="$delfiles $output"
6991 output=$firstobj\"$file_list_spec$output\"
6993 if test -n "$save_libobjs"; then
6994 func_verbose "creating reloadable object files..."
6995 output=$output_objdir/$output_la-${k}.$objext
6996 # Loop over the list of objects to be linked.
6997 for obj in $save_libobjs
6999 eval test_cmds=\"$reload_cmds $objlist $last_robj\"
7000 if test "X$objlist" = X ||
7001 { len=`expr "X$test_cmds" : ".*" 2>/dev/null` &&
7002 test "$len" -le "$max_cmd_len"; }; then
7003 objlist="$objlist $obj"
7005 # The command $test_cmds is almost too long, add a
7006 # command to the queue.
7007 if test "$k" -eq 1 ; then
7008 # The first file doesn't have a previous command to add.
7009 eval concat_cmds=\"$reload_cmds $objlist $last_robj\"
7011 # All subsequent reloadable object files will link in
7012 # the last one created.
7013 eval concat_cmds=\"\$concat_cmds~$reload_cmds $objlist $last_robj~\$RM $last_robj\"
7015 last_robj=$output_objdir/$output_la-${k}.$objext
7017 output=$output_objdir/$output_la-${k}.$objext
7022 # Handle the remaining objects by creating one last
7023 # reloadable object file. All subsequent reloadable object
7024 # files will link in the last one created.
7025 test -z "$concat_cmds" || concat_cmds=$concat_cmds~
7026 eval concat_cmds=\"\${concat_cmds}$reload_cmds $objlist $last_robj\"
7027 if test -n "$last_robj"; then
7028 eval concat_cmds=\"\${concat_cmds}~\$RM $last_robj\"
7030 delfiles="$delfiles $output"
7036 if ${skipped_export-false}; then
7037 func_verbose "generating symbol list for \`$libname.la'"
7038 export_symbols="$output_objdir/$libname.exp"
7039 $opt_dry_run || $RM $export_symbols
7041 # Append the command to create the export file.
7042 test -z "$concat_cmds" || concat_cmds=$concat_cmds~
7043 eval concat_cmds=\"\$concat_cmds$export_symbols_cmds\"
7044 if test -n "$last_robj"; then
7045 eval concat_cmds=\"\$concat_cmds~\$RM $last_robj\"
7049 test -n "$save_libobjs" &&
7050 func_verbose "creating a temporary reloadable object file: $output"
7052 # Loop through the commands generated above and execute them.
7053 save_ifs="$IFS"; IFS='~'
7054 for cmd in $concat_cmds; do
7057 func_quote_for_expand "$cmd"
7058 eval "func_echo $func_quote_for_expand_result"
7060 $opt_dry_run || eval "$cmd" || {
7063 # Restore the uninstalled library and exit
7064 if test "$mode" = relink; then
7065 ( cd "$output_objdir" && \
7066 $RM "${realname}T" && \
7067 $MV "${realname}U" "$realname" )
7075 if test -n "$export_symbols_regex" && ${skipped_export-false}; then
7076 func_show_eval '$EGREP -e "$export_symbols_regex" "$export_symbols" > "${export_symbols}T"'
7077 func_show_eval '$MV "${export_symbols}T" "$export_symbols"'
7081 if ${skipped_export-false}; then
7082 if test -n "$export_symbols" && test -n "$include_expsyms"; then
7083 tmp_export_symbols="$export_symbols"
7084 test -n "$orig_export_symbols" && tmp_export_symbols="$orig_export_symbols"
7085 $opt_dry_run || eval '$ECHO "X$include_expsyms" | $Xsed | $SP2NL >> "$tmp_export_symbols"'
7088 if test -n "$orig_export_symbols"; then
7089 # The given exports_symbols file has to be filtered, so filter it.
7090 func_verbose "filter symbol list for \`$libname.la' to tag DATA exports"
7091 # FIXME: $output_objdir/$libname.filter potentially contains lots of
7092 # 's' commands which not all seds can handle. GNU sed should be fine
7093 # though. Also, the filter scales superlinearly with the number of
7094 # global variables. join(1) would be nice here, but unfortunately
7095 # isn't a blessed tool.
7096 $opt_dry_run || $SED -e '/[ ,]DATA/!d;s,\(.*\)\([ \,].*\),s|^\1$|\1\2|,' < $export_symbols > $output_objdir/$libname.filter
7097 delfiles="$delfiles $export_symbols $output_objdir/$libname.filter"
7098 export_symbols=$output_objdir/$libname.def
7099 $opt_dry_run || $SED -f $output_objdir/$libname.filter < $orig_export_symbols > $export_symbols
7104 # Restore the value of output.
7107 if test -n "$convenience" && test -n "$whole_archive_flag_spec"; then
7108 eval libobjs=\"\$libobjs $whole_archive_flag_spec\"
7109 test "X$libobjs" = "X " && libobjs=
7111 # Expand the library linking commands again to reset the
7112 # value of $libobjs for piecewise linking.
7114 # Do each of the archive commands.
7115 if test "$module" = yes && test -n "$module_cmds" ; then
7116 if test -n "$export_symbols" && test -n "$module_expsym_cmds"; then
7117 cmds=$module_expsym_cmds
7122 if test -n "$export_symbols" && test -n "$archive_expsym_cmds"; then
7123 cmds=$archive_expsym_cmds
7130 if test -n "$delfiles"; then
7131 # Append the command to remove temporary files to $cmds.
7132 eval cmds=\"\$cmds~\$RM $delfiles\"
7135 # Add any objects from preloaded convenience libraries
7136 if test -n "$dlprefiles"; then
7137 gentop="$output_objdir/${outputname}x"
7138 generated="$generated $gentop"
7140 func_extract_archives $gentop $dlprefiles
7141 libobjs="$libobjs $func_extract_archives_result"
7142 test "X$libobjs" = "X " && libobjs=
7145 save_ifs="$IFS"; IFS='~'
7146 for cmd in $cmds; do
7150 func_quote_for_expand "$cmd"
7151 eval "func_echo $func_quote_for_expand_result"
7153 $opt_dry_run || eval "$cmd" || {
7156 # Restore the uninstalled library and exit
7157 if test "$mode" = relink; then
7158 ( cd "$output_objdir" && \
7159 $RM "${realname}T" && \
7160 $MV "${realname}U" "$realname" )
7168 # Restore the uninstalled library and exit
7169 if test "$mode" = relink; then
7170 $opt_dry_run || eval '(cd $output_objdir && $RM ${realname}T && $MV $realname ${realname}T && $MV ${realname}U $realname)' || exit $?
7172 if test -n "$convenience"; then
7173 if test -z "$whole_archive_flag_spec"; then
7174 func_show_eval '${RM}r "$gentop"'
7181 # Create links to the real library.
7182 for linkname in $linknames; do
7183 if test "$realname" != "$linkname"; then
7184 func_show_eval '(cd "$output_objdir" && $RM "$linkname" && $LN_S "$realname" "$linkname")' 'exit $?'
7188 # If -module or -export-dynamic was specified, set the dlname.
7189 if test "$module" = yes || test "$export_dynamic" = yes; then
7190 # On all known operating systems, these are identical.
7197 if test -n "$dlfiles$dlprefiles" || test "$dlself" != no; then
7198 func_warning "\`-dlopen' is ignored for objects"
7203 func_warning "\`-l' and \`-L' are ignored for objects" ;;
7206 test -n "$rpath" && \
7207 func_warning "\`-rpath' is ignored for objects"
7209 test -n "$xrpath" && \
7210 func_warning "\`-R' is ignored for objects"
7212 test -n "$vinfo" && \
7213 func_warning "\`-version-info' is ignored for objects"
7215 test -n "$release" && \
7216 func_warning "\`-release' is ignored for objects"
7220 test -n "$objs$old_deplibs" && \
7221 func_fatal_error "cannot build library object \`$output' from non-libtool objects"
7225 obj=$func_lo2o_result
7233 # Delete the old objects.
7234 $opt_dry_run || $RM $obj $libobj
7236 # Objects from convenience libraries. This assumes
7237 # single-version convenience libraries. Whenever we create
7238 # different ones for PIC/non-PIC, this we'll have to duplicate
7242 # reload_cmds runs $LD directly, so let us get rid of
7243 # -Wl from whole_archive_flag_spec and hope we can get by with
7244 # turning comma into space..
7247 if test -n "$convenience"; then
7248 if test -n "$whole_archive_flag_spec"; then
7249 eval tmp_whole_archive_flags=\"$whole_archive_flag_spec\"
7250 reload_conv_objs=$reload_objs\ `$ECHO "X$tmp_whole_archive_flags" | $Xsed -e 's|,| |g'`
7252 gentop="$output_objdir/${obj}x"
7253 generated="$generated $gentop"
7255 func_extract_archives $gentop $convenience
7256 reload_conv_objs="$reload_objs $func_extract_archives_result"
7260 # Create the old-style object.
7261 reload_objs="$objs$old_deplibs "`$ECHO "X$libobjs" | $SP2NL | $Xsed -e '/\.'${libext}$'/d' -e '/\.lib$/d' -e "$lo2o" | $NL2SP`" $reload_conv_objs" ### testsuite: skip nested quoting test
7264 func_execute_cmds "$reload_cmds" 'exit $?'
7266 # Exit if we aren't doing a library object file.
7267 if test -z "$libobj"; then
7268 if test -n "$gentop"; then
7269 func_show_eval '${RM}r "$gentop"'
7275 if test "$build_libtool_libs" != yes; then
7276 if test -n "$gentop"; then
7277 func_show_eval '${RM}r "$gentop"'
7280 # Create an invalid libtool object if no PIC, so that we don't
7281 # accidentally link it into a program.
7282 # $show "echo timestamp > $libobj"
7283 # $opt_dry_run || eval "echo timestamp > $libobj" || exit $?
7287 if test -n "$pic_flag" || test "$pic_mode" != default; then
7288 # Only do commands if we really have different PIC objects.
7289 reload_objs="$libobjs $reload_conv_objs"
7291 func_execute_cmds "$reload_cmds" 'exit $?'
7294 if test -n "$gentop"; then
7295 func_show_eval '${RM}r "$gentop"'
7303 *cygwin*) func_stripname '' '.exe' "$output"
7304 output=$func_stripname_result.exe;;
7306 test -n "$vinfo" && \
7307 func_warning "\`-version-info' is ignored for programs"
7309 test -n "$release" && \
7310 func_warning "\`-release' is ignored for programs"
7312 test "$preload" = yes \
7313 && test "$dlopen_support" = unknown \
7314 && test "$dlopen_self" = unknown \
7315 && test "$dlopen_self_static" = unknown && \
7316 func_warning "\`LT_INIT([dlopen])' not used. Assuming no dlopen support."
7319 *-*-rhapsody* | *-*-darwin1.[012])
7320 # On Rhapsody replace the C library is the System framework
7321 compile_deplibs=`$ECHO "X $compile_deplibs" | $Xsed -e 's/ -lc / System.ltframework /'`
7322 finalize_deplibs=`$ECHO "X $finalize_deplibs" | $Xsed -e 's/ -lc / System.ltframework /'`
7328 # Don't allow lazy linking, it breaks C++ global constructors
7329 # But is supposedly fixed on 10.4 or later (yay!).
7330 if test "$tagname" = CXX ; then
7331 case ${MACOSX_DEPLOYMENT_TARGET-10.0} in
7333 compile_command="$compile_command ${wl}-bind_at_load"
7334 finalize_command="$finalize_command ${wl}-bind_at_load"
7338 # Time to change all our "foo.ltframework" stuff back to "-framework foo"
7339 compile_deplibs=`$ECHO "X $compile_deplibs" | $Xsed -e 's% \([^ $]*\).ltframework% -framework \1%g'`
7340 finalize_deplibs=`$ECHO "X $finalize_deplibs" | $Xsed -e 's% \([^ $]*\).ltframework% -framework \1%g'`
7345 # move library search paths that coincide with paths to not yet
7346 # installed libraries to the beginning of the library search list
7348 for path in $notinst_path; do
7349 case " $new_libs " in
7350 *" -L$path/$objdir "*) ;;
7352 case " $compile_deplibs " in
7353 *" -L$path/$objdir "*)
7354 new_libs="$new_libs -L$path/$objdir" ;;
7359 for deplib in $compile_deplibs; do
7362 case " $new_libs " in
7364 *) new_libs="$new_libs $deplib" ;;
7367 *) new_libs="$new_libs $deplib" ;;
7370 compile_deplibs="$new_libs"
7373 compile_command="$compile_command $compile_deplibs"
7374 finalize_command="$finalize_command $finalize_deplibs"
7376 if test -n "$rpath$xrpath"; then
7377 # If the user specified any rpath flags, then add them.
7378 for libdir in $rpath $xrpath; do
7379 # This is the magic to use -rpath.
7380 case "$finalize_rpath " in
7382 *) finalize_rpath="$finalize_rpath $libdir" ;;
7387 # Now hardcode the library paths
7390 for libdir in $compile_rpath $finalize_rpath; do
7391 if test -n "$hardcode_libdir_flag_spec"; then
7392 if test -n "$hardcode_libdir_separator"; then
7393 if test -z "$hardcode_libdirs"; then
7394 hardcode_libdirs="$libdir"
7396 # Just accumulate the unique libdirs.
7397 case $hardcode_libdir_separator$hardcode_libdirs$hardcode_libdir_separator in
7398 *"$hardcode_libdir_separator$libdir$hardcode_libdir_separator"*)
7401 hardcode_libdirs="$hardcode_libdirs$hardcode_libdir_separator$libdir"
7406 eval flag=\"$hardcode_libdir_flag_spec\"
7407 rpath="$rpath $flag"
7409 elif test -n "$runpath_var"; then
7410 case "$perm_rpath " in
7412 *) perm_rpath="$perm_rpath $libdir" ;;
7416 *-*-cygwin* | *-*-mingw* | *-*-pw32* | *-*-os2*)
7417 testbindir=`${ECHO} "$libdir" | ${SED} -e 's*/lib$*/bin*'`
7418 case :$dllsearchpath: in
7420 *) dllsearchpath="$dllsearchpath:$libdir";;
7422 case :$dllsearchpath: in
7423 *":$testbindir:"*) ;;
7424 *) dllsearchpath="$dllsearchpath:$testbindir";;
7429 # Substitute the hardcoded libdirs into the rpath.
7430 if test -n "$hardcode_libdir_separator" &&
7431 test -n "$hardcode_libdirs"; then
7432 libdir="$hardcode_libdirs"
7433 eval rpath=\" $hardcode_libdir_flag_spec\"
7435 compile_rpath="$rpath"
7439 for libdir in $finalize_rpath; do
7440 if test -n "$hardcode_libdir_flag_spec"; then
7441 if test -n "$hardcode_libdir_separator"; then
7442 if test -z "$hardcode_libdirs"; then
7443 hardcode_libdirs="$libdir"
7445 # Just accumulate the unique libdirs.
7446 case $hardcode_libdir_separator$hardcode_libdirs$hardcode_libdir_separator in
7447 *"$hardcode_libdir_separator$libdir$hardcode_libdir_separator"*)
7450 hardcode_libdirs="$hardcode_libdirs$hardcode_libdir_separator$libdir"
7455 eval flag=\"$hardcode_libdir_flag_spec\"
7456 rpath="$rpath $flag"
7458 elif test -n "$runpath_var"; then
7459 case "$finalize_perm_rpath " in
7461 *) finalize_perm_rpath="$finalize_perm_rpath $libdir" ;;
7465 # Substitute the hardcoded libdirs into the rpath.
7466 if test -n "$hardcode_libdir_separator" &&
7467 test -n "$hardcode_libdirs"; then
7468 libdir="$hardcode_libdirs"
7469 eval rpath=\" $hardcode_libdir_flag_spec\"
7471 finalize_rpath="$rpath"
7473 if test -n "$libobjs" && test "$build_old_libs" = yes; then
7474 # Transform all the library objects into standard objects.
7475 compile_command=`$ECHO "X$compile_command" | $SP2NL | $Xsed -e "$lo2o" | $NL2SP`
7476 finalize_command=`$ECHO "X$finalize_command" | $SP2NL | $Xsed -e "$lo2o" | $NL2SP`
7479 func_generate_dlsyms "$outputname" "@PROGRAM@" "no"
7481 # template prelinking step
7482 if test -n "$prelink_cmds"; then
7483 func_execute_cmds "$prelink_cmds" 'exit $?'
7486 wrappers_required=yes
7488 *cygwin* | *mingw* )
7489 if test "$build_libtool_libs" != yes; then
7490 wrappers_required=no
7494 if test "$need_relink" = no || test "$build_libtool_libs" != yes; then
7495 wrappers_required=no
7499 if test "$wrappers_required" = no; then
7500 # Replace the output file specification.
7501 compile_command=`$ECHO "X$compile_command" | $Xsed -e 's%@OUTPUT@%'"$output"'%g'`
7502 link_command="$compile_command$compile_rpath"
7504 # We have no uninstalled library dependencies, so finalize right now.
7506 func_show_eval "$link_command" 'exit_status=$?'
7508 # Delete the generated files.
7509 if test -f "$output_objdir/${outputname}S.${objext}"; then
7510 func_show_eval '$RM "$output_objdir/${outputname}S.${objext}"'
7516 if test -n "$compile_shlibpath$finalize_shlibpath"; then
7517 compile_command="$shlibpath_var=\"$compile_shlibpath$finalize_shlibpath\$$shlibpath_var\" $compile_command"
7519 if test -n "$finalize_shlibpath"; then
7520 finalize_command="$shlibpath_var=\"$finalize_shlibpath\$$shlibpath_var\" $finalize_command"
7525 if test -n "$runpath_var"; then
7526 if test -n "$perm_rpath"; then
7527 # We should set the runpath_var.
7529 for dir in $perm_rpath; do
7532 compile_var="$runpath_var=\"$rpath\$$runpath_var\" "
7534 if test -n "$finalize_perm_rpath"; then
7535 # We should set the runpath_var.
7537 for dir in $finalize_perm_rpath; do
7540 finalize_var="$runpath_var=\"$rpath\$$runpath_var\" "
7544 if test "$no_install" = yes; then
7545 # We don't need to create a wrapper script.
7546 link_command="$compile_var$compile_command$compile_rpath"
7547 # Replace the output file specification.
7548 link_command=`$ECHO "X$link_command" | $Xsed -e 's%@OUTPUT@%'"$output"'%g'`
7549 # Delete the old output file.
7550 $opt_dry_run || $RM $output
7551 # Link the executable and exit
7552 func_show_eval "$link_command" 'exit $?'
7556 if test "$hardcode_action" = relink; then
7557 # Fast installation is not supported
7558 link_command="$compile_var$compile_command$compile_rpath"
7559 relink_command="$finalize_var$finalize_command$finalize_rpath"
7561 func_warning "this platform does not like uninstalled shared libraries"
7562 func_warning "\`$output' will be relinked during installation"
7564 if test "$fast_install" != no; then
7565 link_command="$finalize_var$compile_command$finalize_rpath"
7566 if test "$fast_install" = yes; then
7567 relink_command=`$ECHO "X$compile_var$compile_command$compile_rpath" | $Xsed -e 's%@OUTPUT@%\$progdir/\$file%g'`
7569 # fast_install is set to needless
7573 link_command="$compile_var$compile_command$compile_rpath"
7574 relink_command="$finalize_var$finalize_command$finalize_rpath"
7578 # Replace the output file specification.
7579 link_command=`$ECHO "X$link_command" | $Xsed -e 's%@OUTPUT@%'"$output_objdir/$outputname"'%g'`
7581 # Delete the old output files.
7582 $opt_dry_run || $RM $output $output_objdir/$outputname $output_objdir/lt-$outputname
7584 func_show_eval "$link_command" 'exit $?'
7586 # Now create the wrapper script.
7587 func_verbose "creating $output"
7589 # Quote the relink command for shipping.
7590 if test -n "$relink_command"; then
7591 # Preserve any variables that may affect compiler behavior
7592 for var in $variables_saved_for_relink; do
7593 if eval test -z \"\${$var+set}\"; then
7594 relink_command="{ test -z \"\${$var+set}\" || $lt_unset $var || { $var=; export $var; }; }; $relink_command"
7595 elif eval var_value=\$$var; test -z "$var_value"; then
7596 relink_command="$var=; export $var; $relink_command"
7598 func_quote_for_eval "$var_value"
7599 relink_command="$var=$func_quote_for_eval_result; export $var; $relink_command"
7602 relink_command="(cd `pwd`; $relink_command)"
7603 relink_command=`$ECHO "X$relink_command" | $Xsed -e "$sed_quote_subst"`
7606 # Quote $ECHO for shipping.
7607 if test "X$ECHO" = "X$SHELL $progpath --fallback-echo"; then
7609 [\\/]* | [A-Za-z]:[\\/]*) qecho="$SHELL $progpath --fallback-echo";;
7610 *) qecho="$SHELL `pwd`/$progpath --fallback-echo";;
7612 qecho=`$ECHO "X$qecho" | $Xsed -e "$sed_quote_subst"`
7614 qecho=`$ECHO "X$ECHO" | $Xsed -e "$sed_quote_subst"`
7617 # Only actually do things if not in dry run mode.
7619 # win32 will think the script is a binary if it has
7620 # a .exe suffix, so we strip it off here.
7622 *.exe) func_stripname '' '.exe' "$output"
7623 output=$func_stripname_result ;;
7625 # test for cygwin because mv fails w/o .exe extensions
7629 func_stripname '' '.exe' "$outputname"
7630 outputname=$func_stripname_result ;;
7634 *cygwin* | *mingw* )
7635 func_dirname_and_basename "$output" "" "."
7636 output_name=$func_basename_result
7637 output_path=$func_dirname_result
7638 cwrappersource="$output_path/$objdir/lt-$output_name.c"
7639 cwrapper="$output_path/$output_name.exe"
7640 $RM $cwrappersource $cwrapper
7641 trap "$RM $cwrappersource $cwrapper; exit $EXIT_FAILURE" 1 2 15
7643 func_emit_cwrapperexe_src > $cwrappersource
7645 # we should really use a build-platform specific compiler
7646 # here, but OTOH, the wrappers (shell script and this C one)
7647 # are only useful if you want to execute the "real" binary.
7648 # Since the "real" binary is built for $host, then this
7649 # wrapper might as well be built for $host, too.
7651 $LTCC $LTCFLAGS -o $cwrapper $cwrappersource
7655 # Now, create the wrapper script for func_source use:
7656 func_ltwrapper_scriptname $cwrapper
7657 $RM $func_ltwrapper_scriptname_result
7658 trap "$RM $func_ltwrapper_scriptname_result; exit $EXIT_FAILURE" 1 2 15
7660 $cwrapper --lt-dump-script > $func_ltwrapper_scriptname_result
7665 trap "$RM $output; exit $EXIT_FAILURE" 1 2 15
7667 func_emit_wrapper no > $output
7676 # See if we need to build an old-fashioned archive.
7677 for oldlib in $oldlibs; do
7679 if test "$build_libtool_libs" = convenience; then
7680 oldobjs="$libobjs_save $symfileobj"
7681 addlibs="$convenience"
7682 build_libtool_libs=no
7684 if test "$build_libtool_libs" = module; then
7685 oldobjs="$libobjs_save"
7686 build_libtool_libs=no
7688 oldobjs="$old_deplibs $non_pic_objects"
7689 if test "$preload" = yes && test -f "$symfileobj"; then
7690 oldobjs="$oldobjs $symfileobj"
7693 addlibs="$old_convenience"
7696 if test -n "$addlibs"; then
7697 gentop="$output_objdir/${outputname}x"
7698 generated="$generated $gentop"
7700 func_extract_archives $gentop $addlibs
7701 oldobjs="$oldobjs $func_extract_archives_result"
7704 # Do each command in the archive commands.
7705 if test -n "$old_archive_from_new_cmds" && test "$build_libtool_libs" = yes; then
7706 cmds=$old_archive_from_new_cmds
7709 # Add any objects from preloaded convenience libraries
7710 if test -n "$dlprefiles"; then
7711 gentop="$output_objdir/${outputname}x"
7712 generated="$generated $gentop"
7714 func_extract_archives $gentop $dlprefiles
7715 oldobjs="$oldobjs $func_extract_archives_result"
7718 # POSIX demands no paths to be encoded in archives. We have
7719 # to avoid creating archives with duplicate basenames if we
7720 # might have to extract them afterwards, e.g., when creating a
7721 # static archive out of a convenience library, or when linking
7722 # the entirety of a libtool archive into another (currently
7723 # not supported by libtool).
7724 if (for obj in $oldobjs
7726 func_basename "$obj"
7727 $ECHO "$func_basename_result"
7728 done | sort | sort -uc >/dev/null 2>&1); then
7731 $ECHO "copying selected object files to avoid basename conflicts..."
7732 gentop="$output_objdir/${outputname}x"
7733 generated="$generated $gentop"
7734 func_mkdir_p "$gentop"
7735 save_oldobjs=$oldobjs
7738 for obj in $save_oldobjs
7740 func_basename "$obj"
7741 objbase="$func_basename_result"
7742 case " $oldobjs " in
7743 " ") oldobjs=$obj ;;
7746 # Make sure we don't pick an alternate name that also
7748 newobj=lt$counter-$objbase
7749 counter=`expr $counter + 1`
7750 case " $oldobjs " in
7751 *[\ /]"$newobj "*) ;;
7752 *) if test ! -f "$gentop/$newobj"; then break; fi ;;
7755 func_show_eval "ln $obj $gentop/$newobj || cp $obj $gentop/$newobj"
7756 oldobjs="$oldobjs $gentop/$newobj"
7758 *) oldobjs="$oldobjs $obj" ;;
7762 eval cmds=\"$old_archive_cmds\"
7764 if len=`expr "X$cmds" : ".*" 2>/dev/null` &&
7765 test "$len" -le "$max_cmd_len" || test "$max_cmd_len" -le -1; then
7766 cmds=$old_archive_cmds
7768 # the command line is too long to link in one step, link in parts
7769 func_verbose "using piecewise archive linking..."
7774 save_oldobjs=$oldobjs
7775 # Is there a better way of finding the last object in the list?
7776 for obj in $save_oldobjs
7780 for obj in $save_oldobjs
7782 oldobjs="$objlist $obj"
7783 objlist="$objlist $obj"
7784 eval test_cmds=\"$old_archive_cmds\"
7785 if len=`expr "X$test_cmds" : ".*" 2>/dev/null` &&
7786 test "$len" -le "$max_cmd_len"; then
7789 # the above command should be used before it gets too long
7791 if test "$obj" = "$last_oldobj" ; then
7794 test -z "$concat_cmds" || concat_cmds=$concat_cmds~
7795 eval concat_cmds=\"\${concat_cmds}$old_archive_cmds\"
7801 if test "X$oldobjs" = "X" ; then
7802 eval cmds=\"\$concat_cmds\"
7804 eval cmds=\"\$concat_cmds~\$old_archive_cmds\"
7808 func_execute_cmds "$cmds" 'exit $?'
7811 test -n "$generated" && \
7812 func_show_eval "${RM}r$generated"
7814 # Now create the libtool archive.
7818 test "$build_old_libs" = yes && old_library="$libname.$libext"
7819 func_verbose "creating $output"
7821 # Preserve any variables that may affect compiler behavior
7822 for var in $variables_saved_for_relink; do
7823 if eval test -z \"\${$var+set}\"; then
7824 relink_command="{ test -z \"\${$var+set}\" || $lt_unset $var || { $var=; export $var; }; }; $relink_command"
7825 elif eval var_value=\$$var; test -z "$var_value"; then
7826 relink_command="$var=; export $var; $relink_command"
7828 func_quote_for_eval "$var_value"
7829 relink_command="$var=$func_quote_for_eval_result; export $var; $relink_command"
7832 # Quote the link command for shipping.
7833 relink_command="(cd `pwd`; $SHELL $progpath $preserve_args --mode=relink $libtool_args @inst_prefix_dir@)"
7834 relink_command=`$ECHO "X$relink_command" | $Xsed -e "$sed_quote_subst"`
7835 if test "$hardcode_automatic" = yes ; then
7839 # Only create the output if not a dry run.
7841 for installed in no yes; do
7842 if test "$installed" = yes; then
7843 if test -z "$install_libdir"; then
7846 output="$output_objdir/$outputname"i
7847 # Replace all uninstalled libtool libraries with the installed ones
7849 for deplib in $dependency_libs; do
7852 func_basename "$deplib"
7853 name="$func_basename_result"
7854 eval libdir=`${SED} -n -e 's/^libdir=\(.*\)$/\1/p' $deplib`
7855 test -z "$libdir" && \
7856 func_fatal_error "\`$deplib' is not a valid libtool archive"
7857 newdependency_libs="$newdependency_libs $libdir/$name"
7859 *) newdependency_libs="$newdependency_libs $deplib" ;;
7862 dependency_libs="$newdependency_libs"
7865 for lib in $dlfiles; do
7868 func_basename "$lib"
7869 name="$func_basename_result"
7870 eval libdir=`${SED} -n -e 's/^libdir=\(.*\)$/\1/p' $lib`
7871 test -z "$libdir" && \
7872 func_fatal_error "\`$lib' is not a valid libtool archive"
7873 newdlfiles="$newdlfiles $libdir/$name"
7875 *) newdlfiles="$newdlfiles $lib" ;;
7878 dlfiles="$newdlfiles"
7880 for lib in $dlprefiles; do
7883 # Only pass preopened files to the pseudo-archive (for
7884 # eventual linking with the app. that links it) if we
7885 # didn't already link the preopened objects directly into
7887 func_basename "$lib"
7888 name="$func_basename_result"
7889 eval libdir=`${SED} -n -e 's/^libdir=\(.*\)$/\1/p' $lib`
7890 test -z "$libdir" && \
7891 func_fatal_error "\`$lib' is not a valid libtool archive"
7892 newdlprefiles="$newdlprefiles $libdir/$name"
7896 dlprefiles="$newdlprefiles"
7899 for lib in $dlfiles; do
7901 [\\/]* | [A-Za-z]:[\\/]*) abs="$lib" ;;
7902 *) abs=`pwd`"/$lib" ;;
7904 newdlfiles="$newdlfiles $abs"
7906 dlfiles="$newdlfiles"
7908 for lib in $dlprefiles; do
7910 [\\/]* | [A-Za-z]:[\\/]*) abs="$lib" ;;
7911 *) abs=`pwd`"/$lib" ;;
7913 newdlprefiles="$newdlprefiles $abs"
7915 dlprefiles="$newdlprefiles"
7918 # place dlname in correct position for cygwin
7920 case $host,$output,$installed,$module,$dlname in
7921 *cygwin*,*lai,yes,no,*.dll | *mingw*,*lai,yes,no,*.dll) tdlname=../bin/$dlname ;;
7924 # $outputname - a libtool library file
7925 # Generated by $PROGRAM (GNU $PACKAGE$TIMESTAMP) $VERSION
7927 # Please DO NOT delete this file!
7928 # It is necessary for linking the library.
7930 # The name that we can dlopen(3).
7933 # Names of this library.
7934 library_names='$library_names'
7936 # The name of the static archive.
7937 old_library='$old_library'
7939 # Linker flags that can not go in dependency_libs.
7940 inherited_linker_flags='$new_inherited_linker_flags'
7942 # Libraries that this one depends upon.
7943 dependency_libs='$dependency_libs'
7945 # Names of additional weak libraries provided by this library
7946 weak_library_names='$weak_libs'
7948 # Version information for $libname.
7953 # Is this an already installed library?
7954 installed=$installed
7956 # Should we warn about portability when linking against -modules?
7957 shouldnotlink=$module
7959 # Files to dlopen/dlpreopen
7961 dlpreopen='$dlprefiles'
7963 # Directory that this library needs to be installed in:
7964 libdir='$install_libdir'"
7965 if test "$installed" = no && test "$need_relink" = yes; then
7967 relink_command=\"$relink_command\""
7972 # Do a symbolic link so that the libtool archive can be found in
7973 # LD_LIBRARY_PATH before the program is installed.
7974 func_show_eval '( cd "$output_objdir" && $RM "$outputname" && $LN_S "../$outputname" "$outputname" )' 'exit $?'
7980 { test "$mode" = link || test "$mode" = relink; } &&
7981 func_mode_link ${1+"$@"}
7984 # func_mode_uninstall arg...
7985 func_mode_uninstall ()
7993 # This variable tells wrapper scripts just to set variables rather
7994 # than running their programs.
7995 libtool_install_magic="$magic"
8000 -f) RM="$RM $arg"; rmforce=yes ;;
8001 -*) RM="$RM $arg" ;;
8002 *) files="$files $arg" ;;
8007 func_fatal_help "you must specify an RM program"
8011 origobjdir="$objdir"
8012 for file in $files; do
8013 func_dirname "$file" "" "."
8014 dir="$func_dirname_result"
8015 if test "X$dir" = X.; then
8016 objdir="$origobjdir"
8018 objdir="$dir/$origobjdir"
8020 func_basename "$file"
8021 name="$func_basename_result"
8022 test "$mode" = uninstall && objdir="$dir"
8024 # Remember objdir for removal later, being careful to avoid duplicates
8025 if test "$mode" = clean; then
8028 *) rmdirs="$rmdirs $objdir" ;;
8032 # Don't error if the file doesn't exist and rm -f was used.
8033 if { test -L "$file"; } >/dev/null 2>&1 ||
8034 { test -h "$file"; } >/dev/null 2>&1 ||
8035 test -f "$file"; then
8037 elif test -d "$file"; then
8040 elif test "$rmforce" = yes; then
8048 # Possibly a libtool archive, so verify it.
8049 if func_lalib_p "$file"; then
8050 func_source $dir/$name
8052 # Delete the libtool libraries and symlinks.
8053 for n in $library_names; do
8054 rmfiles="$rmfiles $objdir/$n"
8056 test -n "$old_library" && rmfiles="$rmfiles $objdir/$old_library"
8060 case " $library_names " in
8061 # " " in the beginning catches empty $dlname
8063 *) rmfiles="$rmfiles $objdir/$dlname" ;;
8065 test -n "$libdir" && rmfiles="$rmfiles $objdir/$name $objdir/${name}i"
8068 if test -n "$library_names"; then
8069 # Do each command in the postuninstall commands.
8070 func_execute_cmds "$postuninstall_cmds" 'test "$rmforce" = yes || exit_status=1'
8073 if test -n "$old_library"; then
8074 # Do each command in the old_postuninstall commands.
8075 func_execute_cmds "$old_postuninstall_cmds" 'test "$rmforce" = yes || exit_status=1'
8077 # FIXME: should reinstall the best remaining shared library.
8084 # Possibly a libtool object, so verify it.
8085 if func_lalib_p "$file"; then
8088 func_source $dir/$name
8090 # Add PIC object to the list of files to remove.
8091 if test -n "$pic_object" &&
8092 test "$pic_object" != none; then
8093 rmfiles="$rmfiles $dir/$pic_object"
8096 # Add non-PIC object to the list of files to remove.
8097 if test -n "$non_pic_object" &&
8098 test "$non_pic_object" != none; then
8099 rmfiles="$rmfiles $dir/$non_pic_object"
8105 if test "$mode" = clean ; then
8109 func_stripname '' '.exe' "$file"
8110 file=$func_stripname_result
8111 func_stripname '' '.exe' "$name"
8112 noexename=$func_stripname_result
8113 # $file with .exe has already been added to rmfiles,
8114 # add $file without .exe
8115 rmfiles="$rmfiles $file"
8118 # Do a test to see if this is a libtool program.
8119 if func_ltwrapper_p "$file"; then
8120 if func_ltwrapper_executable_p "$file"; then
8121 func_ltwrapper_scriptname "$file"
8123 func_source $func_ltwrapper_scriptname_result
8124 rmfiles="$rmfiles $func_ltwrapper_scriptname_result"
8127 func_source $dir/$noexename
8130 # note $name still contains .exe if it was in $file originally
8131 # as does the version of $file that was added into $rmfiles
8132 rmfiles="$rmfiles $objdir/$name $objdir/${name}S.${objext}"
8133 if test "$fast_install" = yes && test -n "$relink_command"; then
8134 rmfiles="$rmfiles $objdir/lt-$name"
8136 if test "X$noexename" != "X$name" ; then
8137 rmfiles="$rmfiles $objdir/lt-${noexename}.c"
8143 func_show_eval "$RM $rmfiles" 'exit_status=1'
8145 objdir="$origobjdir"
8147 # Try to remove the ${objdir}s in the directories where we deleted files
8148 for dir in $rmdirs; do
8149 if test -d "$dir"; then
8150 func_show_eval "rmdir $dir >/dev/null 2>&1"
8157 { test "$mode" = uninstall || test "$mode" = clean; } &&
8158 func_mode_uninstall ${1+"$@"}
8160 test -z "$mode" && {
8161 help="$generic_help"
8162 func_fatal_help "you must specify a MODE"
8165 test -z "$exec_cmd" && \
8166 func_fatal_help "invalid operation mode \`$mode'"
8168 if test -n "$exec_cmd"; then
8169 eval exec "$exec_cmd"
8176 # The TAGs below are defined such that we never get into a situation
8177 # in which we disable both kinds of libraries. Given conflicting
8178 # choices, we go for a static library, that is the most portable,
8179 # since we can't tell whether shared libraries were disabled because
8180 # the user asked for that or because the platform doesn't support
8181 # them. This is particularly important on AIX, because we don't
8182 # support having both static and shared libraries enabled at the same
8183 # time on that platform, so we default to a shared-only configuration.
8184 # If a disable-shared tag is given, we'll fallback to a static-only
8185 # configuration. But we'll never go from static-only to shared-only.
8187 # ### BEGIN LIBTOOL TAG CONFIG: disable-shared
8188 build_libtool_libs=no
8190 # ### END LIBTOOL TAG CONFIG: disable-shared
8192 # ### BEGIN LIBTOOL TAG CONFIG: disable-static
8193 build_old_libs=`case $build_libtool_libs in yes) echo no;; *) echo yes;; esac`
8194 # ### END LIBTOOL TAG CONFIG: disable-static