1 m4_define([_m4_divert(SCRIPT)], 100)
2 m4_divert_push([SCRIPT])
3 # libtool (GNU @PACKAGE@@TIMESTAMP@) @VERSION@
4 # Written by Gordon Matzigkeit <gord@gnu.ai.mit.edu>, 1996
6 # Copyright (C) 1996, 1997, 1998, 1999, 2000, 2001, 2003, 2004, 2005, 2006,
7 # 2007, 2008, 2009, 2010, 2011 Free Software Foundation, Inc.
8 # This is free software; see the source for copying conditions. There is NO
9 # warranty; not even for MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
11 # GNU Libtool is free software; you can redistribute it and/or modify
12 # it under the terms of the GNU General Public License as published by
13 # the Free Software Foundation; either version 2 of the License, or
14 # (at your option) any later version.
16 # As a special exception to the GNU General Public License,
17 # if you distribute this file as part of a program or library that
18 # is built using GNU Libtool, you may include this file under the
19 # same distribution terms that you use for the rest of that program.
21 # GNU Libtool is distributed in the hope that it will be useful, but
22 # WITHOUT ANY WARRANTY; without even the implied warranty of
23 # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
24 # General Public License for more details.
26 # You should have received a copy of the GNU General Public License
27 # along with GNU Libtool; see the file COPYING. If not, a copy
28 # can be downloaded from http://www.gnu.org/licenses/gpl.html,
29 # or obtained by writing to the Free Software Foundation, Inc.,
30 # 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
32 # Usage: $progname [OPTION]... [MODE-ARG]...
34 # Provide generalized library-building support services.
36 # --config show all configuration variables
37 # --debug enable verbose shell tracing
38 # -n, --dry-run display commands without modifying any files
39 # --features display basic configuration information and exit
40 # --mode=MODE use operation mode MODE
41 # --preserve-dup-deps don't remove duplicate dependency libraries
42 # --quiet, --silent don't print informational messages
43 # --no-quiet, --no-silent
44 # print informational messages (default)
45 # --no-warn don't display warning messages
46 # --tag=TAG use configuration variables from tag TAG
47 # -v, --verbose print more informational messages than default
48 # --no-verbose don't print the extra informational messages
49 # --version print version information
50 # -h, --help, --help-all print short, long, or detailed help message
52 # MODE must be one of the following:
54 # clean remove files from the build directory
55 # compile compile a source file into a libtool object
56 # execute automatically set library path, then run a program
57 # finish complete the installation of libtool libraries
58 # install install libraries or executables
59 # link create a library or an executable
60 # uninstall remove libraries from an installed directory
62 # MODE-ARGS vary depending on the MODE. When passed as first option,
63 # `--mode=MODE' may be abbreviated as `MODE' or a unique abbreviation of that.
64 # Try `$progname --help --mode=MODE' for a more detailed description of MODE.
66 # When reporting a bug, please describe a test case to reproduce it and
67 # include the following information:
72 # compiler flags: $LTCFLAGS
73 # linker: $LD (gnu? $with_gnu_ld)
74 # $progname: (GNU @PACKAGE@@TIMESTAMP@) @VERSION@
75 # automake: $automake_version
76 # autoconf: $autoconf_version
78 # Report bugs to <@PACKAGE_BUGREPORT@>.
79 # GNU @PACKAGE@ home page: <@PACKAGE_URL@>.
80 # General help using GNU software: <http://www.gnu.org/gethelp/>.
85 TIMESTAMP="@TIMESTAMP@"
86 package_revision=@package_revision@
88 # Be Bourne compatible
89 if test -n "${ZSH_VERSION+set}" && (emulate sh) >/dev/null 2>&1; then
92 # Zsh 3.x and 4.x performs word splitting on ${1+"$@"}, which
93 # is contrary to our usage. Disable this feature.
94 alias -g '${1+"$@"}'='"$@"'
97 case `(set -o) 2>/dev/null` in *posix*) set -o posix;; esac
99 BIN_SH=xpg4; export BIN_SH # for Tru64
100 DUALCASE=1; export DUALCASE # for MKS sh
102 # A function that is used when there is no print builtin or printf.
103 func_fallback_echo ()
105 eval 'cat <<_LTECHO_EOF
110 # NLS nuisances: We save the old values to restore during execute mode.
113 for lt_var in LANG LANGUAGE LC_ALL LC_CTYPE LC_COLLATE LC_MESSAGES
115 eval "if test \"\${$lt_var+set}\" = set; then
116 save_$lt_var=\$$lt_var
119 lt_user_locale=\"$lt_var=\\\$save_\$lt_var; \$lt_user_locale\"
120 lt_safe_locale=\"$lt_var=C; \$lt_safe_locale\"
125 export LANGUAGE LC_ALL
129 dnl This script is generated by config.status, so we cannot put things
131 m4_define([M4SH_IN_HEADER], [$1])dnl
133 m4_include([getopt.m4sh])
136 magic="%%%MAGIC variable%%%"
137 magic_exe="%%%MAGIC EXE variable%%%"
142 lo2o="s/\\.lo\$/.${objext}/"
143 o2lo="s/\\.${objext}\$/.lo/"
147 # If this variable is set in any of the actions, the command in it
148 # will be execed at the end. This prevents here-documents from being
149 # left over by shells.
152 # func_append var value
153 # Append VALUE to the end of shell variable VAR.
156 eval "${1}=\$${1}\${2}"
157 } # func_append may be replaced by extended shell implementation
159 # func_append_quoted var value
160 # Quote VALUE and append to the end of shell variable VAR, separated
162 func_append_quoted ()
164 func_quote_for_eval "${2}"
165 eval "${1}=\$${1}\\ \$func_quote_for_eval_result"
166 } # func_append_quoted may be replaced by extended shell implementation
169 # func_arith arithmetic-term...
172 func_arith_result=`expr "${@}"`
173 } # func_arith may be replaced by extended shell implementation
177 # STRING may not start with a hyphen.
180 func_len_result=`expr "${1}" : ".*" 2>/dev/null || echo $max_cmd_len`
181 } # func_len may be replaced by extended shell implementation
187 func_lo2o_result=`$ECHO "${1}" | $SED "$lo2o"`
188 } # func_lo2o may be replaced by extended shell implementation
191 # func_xform libobj-or-source
194 func_xform_result=`$ECHO "${1}" | $SED 's/\.[^.]*$/.lo/'`
195 } # func_xform may be replaced by extended shell implementation
198 # func_fatal_configuration arg...
199 # Echo program name prefixed message to standard error, followed by
200 # a configuration failure hint, and exit.
201 func_fatal_configuration ()
204 func_error "See the $PACKAGE documentation for more information."
205 func_fatal_error "Fatal configuration error."
210 # Display the configuration for all the tags in this script.
213 re_begincf='^# ### BEGIN LIBTOOL'
214 re_endcf='^# ### END LIBTOOL'
216 # Default configuration.
217 $SED "1,/$re_begincf CONFIG/d;/$re_endcf CONFIG/,\$d" < "$progpath"
219 # Now print the configurations for the tags.
220 for tagname in $taglist; do
221 $SED -n "/$re_begincf TAG CONFIG: $tagname\$/,/$re_endcf TAG CONFIG: $tagname\$/p" < "$progpath"
228 # Display the features supported by this script.
232 if test "$build_libtool_libs" = yes; then
233 echo "enable shared libraries"
235 echo "disable shared libraries"
237 if test "$build_old_libs" = yes; then
238 echo "enable static libraries"
240 echo "disable static libraries"
246 # func_enable_tag tagname
247 # Verify that TAGNAME is valid, and either flag an error and exit, or
248 # enable the TAGNAME tag. We also add TAGNAME to the global $taglist
255 re_begincf="^# ### BEGIN LIBTOOL TAG CONFIG: $tagname\$"
256 re_endcf="^# ### END LIBTOOL TAG CONFIG: $tagname\$"
257 sed_extractcf="/$re_begincf/,/$re_endcf/p"
262 func_fatal_error "invalid tag name: $tagname"
266 # Don't test for the "default" C tag, as we know it's
267 # there but not specially marked.
271 if $GREP "$re_begincf" "$progpath" >/dev/null 2>&1; then
272 taglist="$taglist $tagname"
274 # Evaluate the configuration. Be careful to quote the path
275 # and the sed script, to avoid splitting on whitespace, but
276 # also don't use non-portable quotes within backquotes within
277 # quotes we have to do it in 2 steps:
278 extractedcf=`$SED -n -e "$sed_extractcf" < "$progpath"`
281 func_error "ignoring unknown tag $tagname"
287 # func_check_version_match
288 # Ensure that we are using m4 macros, and libtool script from the same
289 # release of libtool.
290 func_check_version_match ()
292 if test "$package_revision" != "$macro_revision"; then
293 if test "$VERSION" != "$macro_version"; then
294 if test -z "$macro_version"; then
296 $progname: Version mismatch error. This is $PACKAGE $VERSION, but the
297 $progname: definition of this LT_INIT comes from an older release.
298 $progname: You should recreate aclocal.m4 with macros from $PACKAGE $VERSION
299 $progname: and run autoconf again.
303 $progname: Version mismatch error. This is $PACKAGE $VERSION, but the
304 $progname: definition of this LT_INIT comes from $PACKAGE $macro_version.
305 $progname: You should recreate aclocal.m4 with macros from $PACKAGE $VERSION
306 $progname: and run autoconf again.
311 $progname: Version mismatch error. This is $PACKAGE $VERSION, revision $package_revision,
312 $progname: but the definition of this LT_INIT comes from revision $macro_revision.
313 $progname: You should recreate aclocal.m4 with macros from revision $package_revision
314 $progname: of $PACKAGE $VERSION and run autoconf again.
323 # Shorthand for --mode=foo, only valid as the first argument
326 shift; set dummy --mode clean ${1+"$@"}; shift
328 compile|compil|compi|comp|com|co|c)
329 shift; set dummy --mode compile ${1+"$@"}; shift
331 execute|execut|execu|exec|exe|ex|e)
332 shift; set dummy --mode execute ${1+"$@"}; shift
334 finish|finis|fini|fin|fi|f)
335 shift; set dummy --mode finish ${1+"$@"}; shift
337 install|instal|insta|inst|ins|in|i)
338 shift; set dummy --mode install ${1+"$@"}; shift
341 shift; set dummy --mode link ${1+"$@"}; shift
343 uninstall|uninstal|uninsta|uninst|unins|unin|uni|un|u)
344 shift; set dummy --mode uninstall ${1+"$@"}; shift
349 dnl SHORT LONG DEFAULT INIT
350 dnl ----------------------------------------------------------------------
352 [n], [--dry-run|--dryrun], [], [],
353 [], [--config], [], [
355 [;], [--dlopen|-dlopen], [], [],
356 [], [--preserve-dup-deps], [], [],
357 [], [--features], [], [
359 [], [--finish], [], [
360 set dummy --mode finish ${1+"[$]@"}; shift],
361 [], [--help], [], [],
362 [], [--help-all], [], [
363 opt_help=': help-all'],
366 # Valid mode arguments:
367 clean|compile|execute|finish|install|link|relink|uninstall) ;;
369 # Catch anything else as an error
370 *) func_error "invalid argument for $opt"
375 [], [--no-silent|--no-quiet], [false], [
376 func_append preserve_args " $opt"],
377 [], [--no-warning|--no-warn], [false], [
378 func_append preserve_args " $opt"],
379 [], [--no-verbose], [false], [
380 func_append preserve_args " $opt"],
381 [], [--silent|--quiet], [], [
382 func_append preserve_args " $opt"
384 [v], [--verbose], [], [
385 func_append preserve_args " $opt"
388 func_append preserve_args " $opt $optarg"
389 func_enable_tag "$optarg"],
391 # save first non-option argument
392 if test "$[]#" -gt 0; then
398 test "$opt_debug" = : || func_append preserve_args " --debug"
401 *cygwin* | *mingw* | *pw32* | *cegcc*)
402 # don't eliminate duplications in $postdeps and $predeps
403 opt_duplicate_compiler_generated_deps=:
406 opt_duplicate_compiler_generated_deps=$opt_preserve_dup_deps
411 # Sanity checks first:
412 func_check_version_match
414 if test "$build_libtool_libs" != yes && test "$build_old_libs" != yes; then
415 func_fatal_configuration "not configured to build any kind of library"
419 eval std_shrext=\"$shrext_cmds\"
421 # Only execute mode is allowed to have -dlopen flags.
422 if test -n "$opt_dlopen" && test "$opt_mode" != execute; then
423 func_error "unrecognized option \`-dlopen'"
428 # Change the help message to a mode-specific one.
430 help="Try \`$progname --help --mode=$opt_mode' for more information."
441 # True iff FILE is a libtool `.la' library or `.lo' object file.
442 # This function is only a basic sanity check; it will hardly flush out
443 # determined imposters.
447 $SED -e 4q "$1" 2>/dev/null \
448 | $GREP "^# Generated by .*$PACKAGE" > /dev/null 2>&1
451 # func_lalib_unsafe_p file
452 # True iff FILE is a libtool `.la' library or `.lo' object file.
453 # This function implements the same check as func_lalib_p without
454 # resorting to external programs. To this end, it redirects stdin and
455 # closes it afterwards, without saving the original file descriptor.
456 # As a safety measure, use it only where a negative result would be
457 # fatal anyway. Works if `file' does not exist.
458 func_lalib_unsafe_p ()
461 if test -f "$1" && test -r "$1" && exec 5<&0 <"$1"; then
462 for lalib_p_l in 1 2 3 4
465 case "$lalib_p_line" in
466 \#\ Generated\ by\ *$PACKAGE* ) lalib_p=yes; break;;
471 test "$lalib_p" = yes
474 # func_ltwrapper_script_p file
475 # True iff FILE is a libtool wrapper script
476 # This function is only a basic sanity check; it will hardly flush out
477 # determined imposters.
478 func_ltwrapper_script_p ()
483 # func_ltwrapper_executable_p file
484 # True iff FILE is a libtool wrapper executable
485 # This function is only a basic sanity check; it will hardly flush out
486 # determined imposters.
487 func_ltwrapper_executable_p ()
489 func_ltwrapper_exec_suffix=
492 *) func_ltwrapper_exec_suffix=.exe ;;
494 $GREP "$magic_exe" "$1$func_ltwrapper_exec_suffix" >/dev/null 2>&1
497 # func_ltwrapper_scriptname file
498 # Assumes file is an ltwrapper_executable
499 # uses $file to determine the appropriate filename for a
500 # temporary ltwrapper_script.
501 func_ltwrapper_scriptname ()
503 func_dirname_and_basename "$1" "" "."
504 func_stripname '' '.exe' "$func_basename_result"
505 func_ltwrapper_scriptname_result="$func_dirname_result/$objdir/${func_stripname_result}_ltshwrapper"
508 # func_ltwrapper_p file
509 # True iff FILE is a libtool wrapper script or wrapper executable
510 # This function is only a basic sanity check; it will hardly flush out
511 # determined imposters.
514 func_ltwrapper_script_p "$1" || func_ltwrapper_executable_p "$1"
518 # func_execute_cmds commands fail_cmd
519 # Execute tilde-delimited COMMANDS.
520 # If FAIL_CMD is given, eval that upon failure.
521 # FAIL_CMD may read-access the current command in variable CMD!
525 save_ifs=$IFS; IFS='~'
529 func_show_eval "$cmd" "${2-:}"
536 # Source FILE, adding directory component if necessary.
537 # Note that it is not necessary on cygwin/mingw to append a dot to
538 # FILE even if both FILE and FILE.exe exist: automatic-append-.exe
539 # behavior happens only for exec(3), not for open(2)! Also, sourcing
540 # `FILE.' does not work on cygwin managed mounts.
545 */* | *\\*) . "$1" ;;
551 # func_resolve_sysroot PATH
552 # Replace a leading = in PATH with a sysroot. Store the result into
553 # func_resolve_sysroot_result
554 func_resolve_sysroot ()
556 func_resolve_sysroot_result=$1
557 case $func_resolve_sysroot_result in
559 func_stripname '=' '' "$func_resolve_sysroot_result"
560 func_resolve_sysroot_result=$lt_sysroot$func_stripname_result
565 # func_replace_sysroot PATH
566 # If PATH begins with the sysroot, replace it with = and
567 # store the result into func_replace_sysroot_result.
568 func_replace_sysroot ()
570 case "$lt_sysroot:$1" in
572 func_stripname "$lt_sysroot" '' "$1"
573 func_replace_sysroot_result="=$func_stripname_result"
576 # Including no sysroot.
577 func_replace_sysroot_result=$1
583 # Infer tagged configuration to use if any are available and
584 # if one wasn't chosen via the "--tag" command line option.
585 # Only attempt this if the compiler in the base compile
586 # command doesn't match the default compiler.
587 # arg is usually of the form 'gcc ...'
591 if test -n "$available_tags" && test -z "$tagname"; then
594 func_append_quoted CC_quoted "$arg"
596 CC_expanded=`func_echo_all $CC`
597 CC_quoted_expanded=`func_echo_all $CC_quoted`
599 # Blanks in the command may have been stripped by the calling shell,
600 # but not from the CC environment variable when configure was run.
601 " $CC "* | "$CC "* | " $CC_expanded "* | "$CC_expanded "* | \
602 " $CC_quoted"* | "$CC_quoted "* | " $CC_quoted_expanded "* | "$CC_quoted_expanded "*) ;;
603 # Blanks at the start of $base_compile will cause this to fail
604 # if we don't check for them as well.
606 for z in $available_tags; do
607 if $GREP "^# ### BEGIN LIBTOOL TAG CONFIG: $z$" < "$progpath" > /dev/null; then
608 # Evaluate the configuration.
609 eval "`${SED} -n -e '/^# ### BEGIN LIBTOOL TAG CONFIG: '$z'$/,/^# ### END LIBTOOL TAG CONFIG: '$z'$/p' < $progpath`"
612 # Double-quote args containing other shell metacharacters.
613 func_append_quoted CC_quoted "$arg"
615 CC_expanded=`func_echo_all $CC`
616 CC_quoted_expanded=`func_echo_all $CC_quoted`
618 " $CC "* | "$CC "* | " $CC_expanded "* | "$CC_expanded "* | \
619 " $CC_quoted"* | "$CC_quoted "* | " $CC_quoted_expanded "* | "$CC_quoted_expanded "*)
620 # The compiler in the base compile command matches
621 # the one in the tagged configuration.
622 # Assume this is the tagged configuration we want.
629 # If $tagname still isn't set, then no tagged configuration
630 # was found and let the user know that the "--tag" command
631 # line option must be used.
632 if test -z "$tagname"; then
633 func_echo "unable to infer tagged configuration"
634 func_fatal_error "specify a tag with \`--tag'"
636 # func_verbose "using $tagname tagged configuration"
645 # func_write_libtool_object output_name pic_name nonpic_name
646 # Create a libtool object file (analogous to a ".la" file),
647 # but don't create it if we're doing a dry run.
648 func_write_libtool_object ()
651 if test "$build_libtool_libs" = yes; then
657 if test "$build_old_libs" = yes; then
658 write_oldobj=\'${3}\'
664 cat >${write_libobj}T <<EOF
665 # $write_libobj - a libtool object file
666 # Generated by $PROGRAM (GNU $PACKAGE$TIMESTAMP) $VERSION
668 # Please DO NOT delete this file!
669 # It is necessary for linking the library.
671 # Name of the PIC object.
672 pic_object=$write_lobj
674 # Name of the non-PIC object
675 non_pic_object=$write_oldobj
678 $MV "${write_libobj}T" "${write_libobj}"
683 ##################################################
684 # FILE NAME AND PATH CONVERSION HELPER FUNCTIONS #
685 ##################################################
687 # func_convert_core_file_wine_to_w32 ARG
688 # Helper function used by file name conversion functions when $build is *nix,
689 # and $host is mingw, cygwin, or some other w32 environment. Relies on a
690 # correctly configured wine environment available, with the winepath program
693 # ARG is the $build file name to be converted to w32 format.
694 # Result is available in $func_convert_core_file_wine_to_w32_result, and will
695 # be empty on error (or when ARG is empty)
696 func_convert_core_file_wine_to_w32 ()
699 func_convert_core_file_wine_to_w32_result="$1"
700 if test -n "$1"; then
701 # Unfortunately, winepath does not exit with a non-zero error code, so we
702 # are forced to check the contents of stdout. On the other hand, if the
703 # command is not found, the shell will set an exit code of 127 and print
704 # *an error message* to stdout. So we must check for both error code of
705 # zero AND non-empty stdout, which explains the odd construction:
706 func_convert_core_file_wine_to_w32_tmp=`winepath -w "$1" 2>/dev/null`
707 if test "$?" -eq 0 && test -n "${func_convert_core_file_wine_to_w32_tmp}"; then
708 func_convert_core_file_wine_to_w32_result=`$ECHO "$func_convert_core_file_wine_to_w32_tmp" |
709 $SED -e "$lt_sed_naive_backslashify"`
711 func_convert_core_file_wine_to_w32_result=
715 # end: func_convert_core_file_wine_to_w32
718 # func_convert_core_path_wine_to_w32 ARG
719 # Helper function used by path conversion functions when $build is *nix, and
720 # $host is mingw, cygwin, or some other w32 environment. Relies on a correctly
721 # configured wine environment available, with the winepath program in $build's
722 # $PATH. Assumes ARG has no leading or trailing path separator characters.
724 # ARG is path to be converted from $build format to win32.
725 # Result is available in $func_convert_core_path_wine_to_w32_result.
726 # Unconvertible file (directory) names in ARG are skipped; if no directory names
727 # are convertible, then the result may be empty.
728 func_convert_core_path_wine_to_w32 ()
731 # unfortunately, winepath doesn't convert paths, only file names
732 func_convert_core_path_wine_to_w32_result=""
733 if test -n "$1"; then
736 for func_convert_core_path_wine_to_w32_f in $1; do
738 func_convert_core_file_wine_to_w32 "$func_convert_core_path_wine_to_w32_f"
739 if test -n "$func_convert_core_file_wine_to_w32_result" ; then
740 if test -z "$func_convert_core_path_wine_to_w32_result"; then
741 func_convert_core_path_wine_to_w32_result="$func_convert_core_file_wine_to_w32_result"
743 func_append func_convert_core_path_wine_to_w32_result ";$func_convert_core_file_wine_to_w32_result"
750 # end: func_convert_core_path_wine_to_w32
753 # func_cygpath ARGS...
754 # Wrapper around calling the cygpath program via LT_CYGPATH. This is used when
755 # when (1) $build is *nix and Cygwin is hosted via a wine environment; or (2)
756 # $build is MSYS and $host is Cygwin, or (3) $build is Cygwin. In case (1) or
757 # (2), returns the Cygwin file name or path in func_cygpath_result (input
758 # file name or path is assumed to be in w32 format, as previously converted
759 # from $build's *nix or MSYS format). In case (3), returns the w32 file name
760 # or path in func_cygpath_result (input file name or path is assumed to be in
761 # Cygwin format). Returns an empty string on error.
763 # ARGS are passed to cygpath, with the last one being the file name or path to
766 # Specify the absolute *nix (or w32) name to cygpath in the LT_CYGPATH
767 # environment variable; do not put it in $PATH.
771 if test -n "$LT_CYGPATH" && test -f "$LT_CYGPATH"; then
772 func_cygpath_result=`$LT_CYGPATH "$@" 2>/dev/null`
773 if test "$?" -ne 0; then
774 # on failure, ensure result is empty
779 func_error "LT_CYGPATH is empty or specifies non-existent file: \`$LT_CYGPATH'"
785 # func_convert_core_msys_to_w32 ARG
786 # Convert file name or path ARG from MSYS format to w32 format. Return
787 # result in func_convert_core_msys_to_w32_result.
788 func_convert_core_msys_to_w32 ()
791 # awkward: cmd appends spaces to result
792 func_convert_core_msys_to_w32_result=`( cmd //c echo "$1" ) 2>/dev/null |
793 $SED -e 's/[ ]*$//' -e "$lt_sed_naive_backslashify"`
795 #end: func_convert_core_msys_to_w32
798 # func_convert_file_check ARG1 ARG2
799 # Verify that ARG1 (a file name in $build format) was converted to $host
800 # format in ARG2. Otherwise, emit an error message, but continue (resetting
801 # func_to_host_file_result to ARG1).
802 func_convert_file_check ()
805 if test -z "$2" && test -n "$1" ; then
806 func_error "Could not determine host file name corresponding to"
808 func_error "Continuing, but uninstalled executables may not work."
810 func_to_host_file_result="$1"
813 # end func_convert_file_check
816 # func_convert_path_check FROM_PATHSEP TO_PATHSEP FROM_PATH TO_PATH
817 # Verify that FROM_PATH (a path in $build format) was converted to $host
818 # format in TO_PATH. Otherwise, emit an error message, but continue, resetting
819 # func_to_host_file_result to a simplistic fallback value (see below).
820 func_convert_path_check ()
823 if test -z "$4" && test -n "$3"; then
824 func_error "Could not determine the host path corresponding to"
826 func_error "Continuing, but uninstalled executables may not work."
827 # Fallback. This is a deliberately simplistic "conversion" and
828 # should not be "improved". See libtool.info.
829 if test "x$1" != "x$2"; then
830 lt_replace_pathsep_chars="s|$1|$2|g"
831 func_to_host_path_result=`echo "$3" |
832 $SED -e "$lt_replace_pathsep_chars"`
834 func_to_host_path_result="$3"
838 # end func_convert_path_check
841 # func_convert_path_front_back_pathsep FRONTPAT BACKPAT REPL ORIG
842 # Modifies func_to_host_path_result by prepending REPL if ORIG matches FRONTPAT
843 # and appending REPL if ORIG matches BACKPAT.
844 func_convert_path_front_back_pathsep ()
848 $1 ) func_to_host_path_result="$3$func_to_host_path_result"
852 $2 ) func_append func_to_host_path_result "$3"
856 # end func_convert_path_front_back_pathsep
859 ##################################################
860 # $build to $host FILE NAME CONVERSION FUNCTIONS #
861 ##################################################
862 # invoked via `$to_host_file_cmd ARG'
864 # In each case, ARG is the path to be converted from $build to $host format.
865 # Result will be available in $func_to_host_file_result.
868 # func_to_host_file ARG
869 # Converts the file name ARG from $build format to $host format. Return result
870 # in func_to_host_file_result.
874 $to_host_file_cmd "$1"
876 # end func_to_host_file
879 # func_to_tool_file ARG LAZY
880 # converts the file name ARG from $build format to toolchain format. Return
881 # result in func_to_tool_file_result. If the conversion in use is listed
882 # in (the comma separated) LAZY, no conversion takes place.
887 *,"$to_tool_file_cmd",*)
888 func_to_tool_file_result=$1
891 $to_tool_file_cmd "$1"
892 func_to_tool_file_result=$func_to_host_file_result
896 # end func_to_tool_file
899 # func_convert_file_noop ARG
900 # Copy ARG to func_to_host_file_result.
901 func_convert_file_noop ()
903 func_to_host_file_result="$1"
905 # end func_convert_file_noop
908 # func_convert_file_msys_to_w32 ARG
909 # Convert file name ARG from (mingw) MSYS to (mingw) w32 format; automatic
910 # conversion to w32 is not available inside the cwrapper. Returns result in
911 # func_to_host_file_result.
912 func_convert_file_msys_to_w32 ()
915 func_to_host_file_result="$1"
916 if test -n "$1"; then
917 func_convert_core_msys_to_w32 "$1"
918 func_to_host_file_result="$func_convert_core_msys_to_w32_result"
920 func_convert_file_check "$1" "$func_to_host_file_result"
922 # end func_convert_file_msys_to_w32
925 # func_convert_file_cygwin_to_w32 ARG
926 # Convert file name ARG from Cygwin to w32 format. Returns result in
927 # func_to_host_file_result.
928 func_convert_file_cygwin_to_w32 ()
931 func_to_host_file_result="$1"
932 if test -n "$1"; then
933 # because $build is cygwin, we call "the" cygpath in $PATH; no need to use
934 # LT_CYGPATH in this case.
935 func_to_host_file_result=`cygpath -m "$1"`
937 func_convert_file_check "$1" "$func_to_host_file_result"
939 # end func_convert_file_cygwin_to_w32
942 # func_convert_file_nix_to_w32 ARG
943 # Convert file name ARG from *nix to w32 format. Requires a wine environment
944 # and a working winepath. Returns result in func_to_host_file_result.
945 func_convert_file_nix_to_w32 ()
948 func_to_host_file_result="$1"
949 if test -n "$1"; then
950 func_convert_core_file_wine_to_w32 "$1"
951 func_to_host_file_result="$func_convert_core_file_wine_to_w32_result"
953 func_convert_file_check "$1" "$func_to_host_file_result"
955 # end func_convert_file_nix_to_w32
958 # func_convert_file_msys_to_cygwin ARG
959 # Convert file name ARG from MSYS to Cygwin format. Requires LT_CYGPATH set.
960 # Returns result in func_to_host_file_result.
961 func_convert_file_msys_to_cygwin ()
964 func_to_host_file_result="$1"
965 if test -n "$1"; then
966 func_convert_core_msys_to_w32 "$1"
967 func_cygpath -u "$func_convert_core_msys_to_w32_result"
968 func_to_host_file_result="$func_cygpath_result"
970 func_convert_file_check "$1" "$func_to_host_file_result"
972 # end func_convert_file_msys_to_cygwin
975 # func_convert_file_nix_to_cygwin ARG
976 # Convert file name ARG from *nix to Cygwin format. Requires Cygwin installed
977 # in a wine environment, working winepath, and LT_CYGPATH set. Returns result
978 # in func_to_host_file_result.
979 func_convert_file_nix_to_cygwin ()
982 func_to_host_file_result="$1"
983 if test -n "$1"; then
984 # convert from *nix to w32, then use cygpath to convert from w32 to cygwin.
985 func_convert_core_file_wine_to_w32 "$1"
986 func_cygpath -u "$func_convert_core_file_wine_to_w32_result"
987 func_to_host_file_result="$func_cygpath_result"
989 func_convert_file_check "$1" "$func_to_host_file_result"
991 # end func_convert_file_nix_to_cygwin
994 #############################################
995 # $build to $host PATH CONVERSION FUNCTIONS #
996 #############################################
997 # invoked via `$to_host_path_cmd ARG'
999 # In each case, ARG is the path to be converted from $build to $host format.
1000 # The result will be available in $func_to_host_path_result.
1002 # Path separators are also converted from $build format to $host format. If
1003 # ARG begins or ends with a path separator character, it is preserved (but
1004 # converted to $host format) on output.
1006 # All path conversion functions are named using the following convention:
1007 # file name conversion function : func_convert_file_X_to_Y ()
1008 # path conversion function : func_convert_path_X_to_Y ()
1009 # where, for any given $build/$host combination the 'X_to_Y' value is the
1010 # same. If conversion functions are added for new $build/$host combinations,
1011 # the two new functions must follow this pattern, or func_init_to_host_path_cmd
1015 # func_init_to_host_path_cmd
1016 # Ensures that function "pointer" variable $to_host_path_cmd is set to the
1017 # appropriate value, based on the value of $to_host_file_cmd.
1019 func_init_to_host_path_cmd ()
1022 if test -z "$to_host_path_cmd"; then
1023 func_stripname 'func_convert_file_' '' "$to_host_file_cmd"
1024 to_host_path_cmd="func_convert_path_${func_stripname_result}"
1029 # func_to_host_path ARG
1030 # Converts the path ARG from $build format to $host format. Return result
1031 # in func_to_host_path_result.
1032 func_to_host_path ()
1035 func_init_to_host_path_cmd
1036 $to_host_path_cmd "$1"
1038 # end func_to_host_path
1041 # func_convert_path_noop ARG
1042 # Copy ARG to func_to_host_path_result.
1043 func_convert_path_noop ()
1045 func_to_host_path_result="$1"
1047 # end func_convert_path_noop
1050 # func_convert_path_msys_to_w32 ARG
1051 # Convert path ARG from (mingw) MSYS to (mingw) w32 format; automatic
1052 # conversion to w32 is not available inside the cwrapper. Returns result in
1053 # func_to_host_path_result.
1054 func_convert_path_msys_to_w32 ()
1057 func_to_host_path_result="$1"
1058 if test -n "$1"; then
1059 # Remove leading and trailing path separator characters from ARG. MSYS
1060 # behavior is inconsistent here; cygpath turns them into '.;' and ';.';
1061 # and winepath ignores them completely.
1062 func_stripname : : "$1"
1063 func_to_host_path_tmp1=$func_stripname_result
1064 func_convert_core_msys_to_w32 "$func_to_host_path_tmp1"
1065 func_to_host_path_result="$func_convert_core_msys_to_w32_result"
1066 func_convert_path_check : ";" \
1067 "$func_to_host_path_tmp1" "$func_to_host_path_result"
1068 func_convert_path_front_back_pathsep ":*" "*:" ";" "$1"
1071 # end func_convert_path_msys_to_w32
1074 # func_convert_path_cygwin_to_w32 ARG
1075 # Convert path ARG from Cygwin to w32 format. Returns result in
1076 # func_to_host_file_result.
1077 func_convert_path_cygwin_to_w32 ()
1080 func_to_host_path_result="$1"
1081 if test -n "$1"; then
1082 # See func_convert_path_msys_to_w32:
1083 func_stripname : : "$1"
1084 func_to_host_path_tmp1=$func_stripname_result
1085 func_to_host_path_result=`cygpath -m -p "$func_to_host_path_tmp1"`
1086 func_convert_path_check : ";" \
1087 "$func_to_host_path_tmp1" "$func_to_host_path_result"
1088 func_convert_path_front_back_pathsep ":*" "*:" ";" "$1"
1091 # end func_convert_path_cygwin_to_w32
1094 # func_convert_path_nix_to_w32 ARG
1095 # Convert path ARG from *nix to w32 format. Requires a wine environment and
1096 # a working winepath. Returns result in func_to_host_file_result.
1097 func_convert_path_nix_to_w32 ()
1100 func_to_host_path_result="$1"
1101 if test -n "$1"; then
1102 # See func_convert_path_msys_to_w32:
1103 func_stripname : : "$1"
1104 func_to_host_path_tmp1=$func_stripname_result
1105 func_convert_core_path_wine_to_w32 "$func_to_host_path_tmp1"
1106 func_to_host_path_result="$func_convert_core_path_wine_to_w32_result"
1107 func_convert_path_check : ";" \
1108 "$func_to_host_path_tmp1" "$func_to_host_path_result"
1109 func_convert_path_front_back_pathsep ":*" "*:" ";" "$1"
1112 # end func_convert_path_nix_to_w32
1115 # func_convert_path_msys_to_cygwin ARG
1116 # Convert path ARG from MSYS to Cygwin format. Requires LT_CYGPATH set.
1117 # Returns result in func_to_host_file_result.
1118 func_convert_path_msys_to_cygwin ()
1121 func_to_host_path_result="$1"
1122 if test -n "$1"; then
1123 # See func_convert_path_msys_to_w32:
1124 func_stripname : : "$1"
1125 func_to_host_path_tmp1=$func_stripname_result
1126 func_convert_core_msys_to_w32 "$func_to_host_path_tmp1"
1127 func_cygpath -u -p "$func_convert_core_msys_to_w32_result"
1128 func_to_host_path_result="$func_cygpath_result"
1129 func_convert_path_check : : \
1130 "$func_to_host_path_tmp1" "$func_to_host_path_result"
1131 func_convert_path_front_back_pathsep ":*" "*:" : "$1"
1134 # end func_convert_path_msys_to_cygwin
1137 # func_convert_path_nix_to_cygwin ARG
1138 # Convert path ARG from *nix to Cygwin format. Requires Cygwin installed in a
1139 # a wine environment, working winepath, and LT_CYGPATH set. Returns result in
1140 # func_to_host_file_result.
1141 func_convert_path_nix_to_cygwin ()
1144 func_to_host_path_result="$1"
1145 if test -n "$1"; then
1146 # Remove leading and trailing path separator characters from
1147 # ARG. msys behavior is inconsistent here, cygpath turns them
1148 # into '.;' and ';.', and winepath ignores them completely.
1149 func_stripname : : "$1"
1150 func_to_host_path_tmp1=$func_stripname_result
1151 func_convert_core_path_wine_to_w32 "$func_to_host_path_tmp1"
1152 func_cygpath -u -p "$func_convert_core_path_wine_to_w32_result"
1153 func_to_host_path_result="$func_cygpath_result"
1154 func_convert_path_check : : \
1155 "$func_to_host_path_tmp1" "$func_to_host_path_result"
1156 func_convert_path_front_back_pathsep ":*" "*:" : "$1"
1159 # end func_convert_path_nix_to_cygwin
1162 # func_mode_compile arg...
1163 func_mode_compile ()
1166 # Get the compilation command and the source file.
1168 srcfile="$nonopt" # always keep a non-empty value in "srcfile"
1180 # do not "continue". Instead, add this to base_compile
1192 # Accept any command-line options.
1195 test -n "$libobj" && \
1196 func_fatal_error "you cannot specify \`-o' more than once"
1201 -pie | -fpie | -fPIE)
1202 func_append pie_flag " $arg"
1206 -shared | -static | -prefer-pic | -prefer-non-pic)
1207 func_append later " $arg"
1217 arg_mode=arg # the next one goes into the "base_compile" arg list
1218 continue # The current "srcfile" will either be retained or
1219 ;; # replaced later. I would guess that would be a bug.
1222 func_stripname '-Wc,' '' "$arg"
1223 args=$func_stripname_result
1225 save_ifs="$IFS"; IFS=','
1226 for arg in $args; do
1228 func_append_quoted lastarg "$arg"
1231 func_stripname ' ' '' "$lastarg"
1232 lastarg=$func_stripname_result
1234 # Add the arguments to base_compile.
1235 func_append base_compile " $lastarg"
1240 # Accept the current argument as the source file.
1241 # The previous "srcfile" becomes the current argument.
1248 esac # case $arg_mode
1250 # Aesthetically quote the previous argument.
1251 func_append_quoted base_compile "$lastarg"
1256 func_fatal_error "you must specify an argument for -Xcompile"
1259 func_fatal_error "you must specify a target with \`-o'"
1262 # Get the name of the library object.
1263 test -z "$libobj" && {
1264 func_basename "$srcfile"
1265 libobj="$func_basename_result"
1270 # Recognize several different file suffixes.
1271 # If the user specifies -o file.o, it is replaced with file.lo
1274 *.ada | *.adb | *.ads | *.asm | \
1275 *.c++ | *.cc | *.ii | *.class | *.cpp | *.cxx | \
1276 *.[fF][09]? | *.for | *.java | *.go | *.obj | *.sx | *.cu | *.cup)
1277 func_xform "$libobj"
1278 libobj=$func_xform_result
1283 *.lo) func_lo2o "$libobj"; obj=$func_lo2o_result ;;
1285 func_fatal_error "cannot determine name of library object from \`$libobj'"
1289 func_infer_tag $base_compile
1291 for arg in $later; do
1294 test "$build_libtool_libs" != yes && \
1295 func_fatal_configuration "can not build a shared library"
1301 build_libtool_libs=no
1318 func_quote_for_eval "$libobj"
1319 test "X$libobj" != "X$func_quote_for_eval_result" \
1320 && $ECHO "X$libobj" | $GREP '[@:>@~#^*{};<>?"'"'"' &()|`$@<:@]' \
1321 && func_warning "libobj name \`$libobj' may not contain shell special characters."
1322 func_dirname_and_basename "$obj" "/" ""
1323 objname="$func_basename_result"
1324 xdir="$func_dirname_result"
1325 lobj=${xdir}$objdir/$objname
1327 test -z "$base_compile" && \
1328 func_fatal_help "you must specify a compilation command"
1330 # Delete any leftover library objects.
1331 if test "$build_old_libs" = yes; then
1332 removelist="$obj $lobj $libobj ${libobj}T"
1334 removelist="$lobj $libobj ${libobj}T"
1337 # On Cygwin there's no "real" PIC flag so we must build both object types
1339 cygwin* | mingw* | pw32* | os2* | cegcc*)
1343 if test "$pic_mode" = no && test "$deplibs_check_method" != pass_all; then
1344 # non-PIC code in shared libraries is not supported
1348 # Calculate the filename of the output object if compiler does
1349 # not support -o with -c
1350 if test "$compiler_c_o" = no; then
1351 output_obj=`$ECHO "$srcfile" | $SED 's%^.*/%%; s%\.[^.]*$%%'`.${objext}
1352 lockfile="$output_obj.lock"
1359 # Lock this critical section if it is needed
1360 # We use this script file to make the link, it avoids creating a new file
1361 if test "$need_locks" = yes; then
1362 until $opt_dry_run || ln "$progpath" "$lockfile" 2>/dev/null; do
1363 func_echo "Waiting for $lockfile to be removed"
1366 elif test "$need_locks" = warn; then
1367 if test -f "$lockfile"; then
1369 *** ERROR, $lockfile exists and contains:
1370 `cat $lockfile 2>/dev/null`
1372 This indicates that another process is trying to use the same
1373 temporary object file, and libtool could not work around it because
1374 your compiler does not support \`-c' and \`-o' together. If you
1375 repeat this compilation, it may succeed, by chance, but you had better
1376 avoid parallel builds (make -j) in this platform, or get a better
1379 $opt_dry_run || $RM $removelist
1382 func_append removelist " $output_obj"
1383 $ECHO "$srcfile" > "$lockfile"
1386 $opt_dry_run || $RM $removelist
1387 func_append removelist " $lockfile"
1388 trap '$opt_dry_run || $RM $removelist; exit $EXIT_FAILURE' 1 2 15
1390 func_to_tool_file "$srcfile" func_convert_file_msys_to_w32
1391 srcfile=$func_to_tool_file_result
1392 func_quote_for_eval "$srcfile"
1393 qsrcfile=$func_quote_for_eval_result
1395 # Only build a PIC object if we are building libtool libraries.
1396 if test "$build_libtool_libs" = yes; then
1397 # Without this assignment, base_compile gets emptied.
1398 fbsd_hideous_sh_bug=$base_compile
1400 if test "$pic_mode" != no; then
1401 command="$base_compile $qsrcfile $pic_flag"
1403 # Don't build PIC code
1404 command="$base_compile $qsrcfile"
1407 func_mkdir_p "$xdir$objdir"
1409 if test -z "$output_obj"; then
1410 # Place PIC objects in $objdir
1411 func_append command " -o $lobj"
1414 func_show_eval_locale "$command" \
1415 'test -n "$output_obj" && $RM $removelist; exit $EXIT_FAILURE'
1417 if test "$need_locks" = warn &&
1418 test "X`cat $lockfile 2>/dev/null`" != "X$srcfile"; then
1420 *** ERROR, $lockfile contains:
1421 `cat $lockfile 2>/dev/null`
1423 but it should contain:
1426 This indicates that another process is trying to use the same
1427 temporary object file, and libtool could not work around it because
1428 your compiler does not support \`-c' and \`-o' together. If you
1429 repeat this compilation, it may succeed, by chance, but you had better
1430 avoid parallel builds (make -j) in this platform, or get a better
1433 $opt_dry_run || $RM $removelist
1437 # Just move the object if needed, then go on to compile the next one
1438 if test -n "$output_obj" && test "X$output_obj" != "X$lobj"; then
1439 func_show_eval '$MV "$output_obj" "$lobj"' \
1440 'error=$?; $opt_dry_run || $RM $removelist; exit $error'
1443 # Allow error messages only from the first compilation.
1444 if test "$suppress_opt" = yes; then
1445 suppress_output=' >/dev/null 2>&1'
1449 # Only build a position-dependent object if we build old libraries.
1450 if test "$build_old_libs" = yes; then
1451 if test "$pic_mode" != yes; then
1452 # Don't build PIC code
1453 command="$base_compile $qsrcfile$pie_flag"
1455 command="$base_compile $qsrcfile $pic_flag"
1457 if test "$compiler_c_o" = yes; then
1458 func_append command " -o $obj"
1461 # Suppress compiler output if we already did a PIC compilation.
1462 func_append command "$suppress_output"
1463 func_show_eval_locale "$command" \
1464 '$opt_dry_run || $RM $removelist; exit $EXIT_FAILURE'
1466 if test "$need_locks" = warn &&
1467 test "X`cat $lockfile 2>/dev/null`" != "X$srcfile"; then
1469 *** ERROR, $lockfile contains:
1470 `cat $lockfile 2>/dev/null`
1472 but it should contain:
1475 This indicates that another process is trying to use the same
1476 temporary object file, and libtool could not work around it because
1477 your compiler does not support \`-c' and \`-o' together. If you
1478 repeat this compilation, it may succeed, by chance, but you had better
1479 avoid parallel builds (make -j) in this platform, or get a better
1482 $opt_dry_run || $RM $removelist
1486 # Just move the object if needed
1487 if test -n "$output_obj" && test "X$output_obj" != "X$obj"; then
1488 func_show_eval '$MV "$output_obj" "$obj"' \
1489 'error=$?; $opt_dry_run || $RM $removelist; exit $error'
1494 func_write_libtool_object "$libobj" "$objdir/$objname" "$objname"
1496 # Unlock the critical section if it was locked
1497 if test "$need_locks" != no; then
1498 removelist=$lockfile
1507 test "$opt_mode" = compile && func_mode_compile ${1+"$@"}
1512 # We need to display help for each of the modes.
1515 # Generic help is extracted from the usage comments
1516 # at the start of this file.
1522 "Usage: $progname [OPTION]... --mode=clean RM [RM-OPTION]... FILE...
1524 Remove files from the build directory.
1526 RM is the name of the program to use to delete files associated with each FILE
1527 (typically \`/bin/rm'). RM-OPTIONS are options (such as \`-f') to be passed
1530 If FILE is a libtool library, object or program, all the files associated
1531 with it are deleted. Otherwise, only FILE itself is deleted using RM."
1536 "Usage: $progname [OPTION]... --mode=compile COMPILE-COMMAND... SOURCEFILE
1538 Compile a source file into a libtool library object.
1540 This mode accepts the following additional options:
1542 -o OUTPUT-FILE set the output file name to OUTPUT-FILE
1543 -no-suppress do not suppress compiler output for multiple passes
1544 -prefer-pic try to build PIC objects only
1545 -prefer-non-pic try to build non-PIC objects only
1546 -shared do not build a \`.o' file suitable for static linking
1547 -static only build a \`.o' file suitable for static linking
1548 -Wc,FLAG pass FLAG directly to the compiler
1550 COMPILE-COMMAND is a command to be used in creating a \`standard' object file
1551 from the given SOURCEFILE.
1553 The output file name is determined by removing the directory component from
1554 SOURCEFILE, then substituting the C source code suffix \`.c' with the
1555 library object suffix, \`.lo'."
1560 "Usage: $progname [OPTION]... --mode=execute COMMAND [ARGS]...
1562 Automatically set library path, then run a program.
1564 This mode accepts the following additional options:
1566 -dlopen FILE add the directory containing FILE to the library path
1568 This mode sets the library path environment variable according to \`-dlopen'
1571 If any of the ARGS are libtool executable wrappers, then they are translated
1572 into their corresponding uninstalled binary, and any of their required library
1573 directories are added to the library path.
1575 Then, COMMAND is executed, with ARGS as arguments."
1580 "Usage: $progname [OPTION]... --mode=finish [LIBDIR]...
1582 Complete the installation of libtool libraries.
1584 Each LIBDIR is a directory that contains libtool libraries.
1586 The commands that this mode executes may require superuser privileges. Use
1587 the \`--dry-run' option if you just want to see what would be executed."
1592 "Usage: $progname [OPTION]... --mode=install INSTALL-COMMAND...
1594 Install executables or libraries.
1596 INSTALL-COMMAND is the installation command. The first component should be
1597 either the \`install' or \`cp' program.
1599 The following components of INSTALL-COMMAND are treated specially:
1601 -inst-prefix-dir PREFIX-DIR Use PREFIX-DIR as a staging area for installation
1603 The rest of the components are interpreted as arguments to that command (only
1604 BSD-compatible install options are recognized)."
1609 "Usage: $progname [OPTION]... --mode=link LINK-COMMAND...
1611 Link object files or libraries together to form another library, or to
1612 create an executable program.
1614 LINK-COMMAND is a command using the C compiler that you would use to create
1615 a program from several object files.
1617 The following components of LINK-COMMAND are treated specially:
1619 -all-static do not do any dynamic linking at all
1620 -avoid-version do not add a version suffix if possible
1621 -bindir BINDIR specify path to binaries directory (for systems where
1622 libraries must be found in the PATH setting at runtime)
1623 -dlopen FILE \`-dlpreopen' FILE if it cannot be dlopened at runtime
1624 -dlpreopen FILE link in FILE and add its symbols to lt_preloaded_symbols
1625 -export-dynamic allow symbols from OUTPUT-FILE to be resolved with dlsym(3)
1626 -export-symbols SYMFILE
1627 try to export only the symbols listed in SYMFILE
1628 -export-symbols-regex REGEX
1629 try to export only the symbols matching REGEX
1630 -LLIBDIR search LIBDIR for required installed libraries
1631 -lNAME OUTPUT-FILE requires the installed library libNAME
1632 -module build a library that can dlopened
1633 -no-fast-install disable the fast-install mode
1634 -no-install link a not-installable executable
1635 -no-undefined declare that a library does not refer to external symbols
1636 -o OUTPUT-FILE create OUTPUT-FILE from the specified objects
1637 -objectlist FILE Use a list of object files found in FILE to specify objects
1638 -precious-files-regex REGEX
1639 don't remove output files matching REGEX
1640 -release RELEASE specify package release information
1641 -rpath LIBDIR the created library will eventually be installed in LIBDIR
1642 -R[ ]LIBDIR add LIBDIR to the runtime path of programs and libraries
1643 -shared only do dynamic linking of libtool libraries
1644 -shrext SUFFIX override the standard shared library file extension
1645 -static do not do any dynamic linking of uninstalled libtool libraries
1646 -static-libtool-libs
1647 do not do any dynamic linking of libtool libraries
1648 -version-info CURRENT[:REVISION[:AGE]]
1649 specify library version info [each variable defaults to 0]
1650 -weak LIBNAME declare that the target provides the LIBNAME interface
1652 -Xcompiler FLAG pass linker-specific FLAG directly to the compiler
1654 -Xlinker FLAG pass linker-specific FLAG directly to the linker
1655 -XCClinker FLAG pass link-specific FLAG to the compiler driver (CC)
1657 All other options (arguments beginning with \`-') are ignored.
1659 Every other argument is treated as a filename. Files ending in \`.la' are
1660 treated as uninstalled libtool libraries, other files are standard or library
1663 If the OUTPUT-FILE ends in \`.la', then a libtool library is created,
1664 only library objects (\`.lo' files) may be specified, and \`-rpath' is
1665 required, except when creating a convenience library.
1667 If OUTPUT-FILE ends in \`.a' or \`.lib', then a standard library is created
1668 using \`ar' and \`ranlib', or on Windows using \`lib'.
1670 If OUTPUT-FILE ends in \`.lo' or \`.${objext}', then a reloadable object file
1671 is created, otherwise an executable program is created."
1676 "Usage: $progname [OPTION]... --mode=uninstall RM [RM-OPTION]... FILE...
1678 Remove libraries from an installation directory.
1680 RM is the name of the program to use to delete files associated with each FILE
1681 (typically \`/bin/rm'). RM-OPTIONS are options (such as \`-f') to be passed
1684 If FILE is a libtool library, all the files associated with it are deleted.
1685 Otherwise, only FILE itself is deleted using RM."
1689 func_fatal_help "invalid operation mode \`$opt_mode'"
1694 $ECHO "Try \`$progname --help' for more information about other modes."
1697 # Now that we've collected a possible --mode arg, show help if necessary
1699 if test "$opt_help" = :; then
1704 for opt_mode in compile link execute install finish uninstall clean; do
1707 } | sed -n '1p; 2,$s/^Usage:/ or: /p'
1710 for opt_mode in compile link execute install finish uninstall clean; do
1716 /^When reporting/,/^Report/{
1721 /information about other modes/d
1722 /more detailed .*MODE/d
1723 s/^Usage:.*--mode=\([^ ]*\) .*/Description of \1 mode:/'
1729 # func_mode_execute arg...
1730 func_mode_execute ()
1733 # The first argument is the command name.
1736 func_fatal_help "you must specify a COMMAND"
1738 # Handle -dlopen flags immediately.
1739 for file in $opt_dlopen; do
1741 || func_fatal_help "\`$file' is not a file"
1746 func_resolve_sysroot "$file"
1747 file=$func_resolve_sysroot_result
1749 # Check to see that this really is a libtool archive.
1750 func_lalib_unsafe_p "$file" \
1751 || func_fatal_help "\`$lib' is not a valid libtool archive"
1753 # Read the libtool library.
1758 # Skip this library if it cannot be dlopened.
1759 if test -z "$dlname"; then
1760 # Warn if it was a shared library.
1761 test -n "$library_names" && \
1762 func_warning "\`$file' was not linked with \`-export-dynamic'"
1766 func_dirname "$file" "" "."
1767 dir="$func_dirname_result"
1769 if test -f "$dir/$objdir/$dlname"; then
1770 func_append dir "/$objdir"
1772 if test ! -f "$dir/$dlname"; then
1773 func_fatal_error "cannot find \`$dlname' in \`$dir' or \`$dir/$objdir'"
1779 # Just add the directory containing the .lo file.
1780 func_dirname "$file" "" "."
1781 dir="$func_dirname_result"
1785 func_warning "\`-dlopen' is ignored for non-libtool libraries and objects"
1790 # Get the absolute pathname.
1791 absdir=`cd "$dir" && pwd`
1792 test -n "$absdir" && dir="$absdir"
1794 # Now add the directory to shlibpath_var.
1795 if eval "test -z \"\$$shlibpath_var\""; then
1796 eval "$shlibpath_var=\"\$dir\""
1798 eval "$shlibpath_var=\"\$dir:\$$shlibpath_var\""
1802 # This variable tells wrapper scripts just to set shlibpath_var
1803 # rather than running their programs.
1804 libtool_execute_magic="$magic"
1806 # Check if any of the arguments is a wrapper script.
1811 -* | *.la | *.lo ) ;;
1813 # Do a test to see if this is really a libtool program.
1814 if func_ltwrapper_script_p "$file"; then
1816 # Transform arg to wrapped name.
1817 file="$progdir/$program"
1818 elif func_ltwrapper_executable_p "$file"; then
1819 func_ltwrapper_scriptname "$file"
1820 func_source "$func_ltwrapper_scriptname_result"
1821 # Transform arg to wrapped name.
1822 file="$progdir/$program"
1826 # Quote arguments (to preserve shell metacharacters).
1827 func_append_quoted args "$file"
1830 if test "X$opt_dry_run" = Xfalse; then
1831 if test -n "$shlibpath_var"; then
1832 # Export the shlibpath_var.
1833 eval "export $shlibpath_var"
1836 # Restore saved environment variables
1837 for lt_var in LANG LANGUAGE LC_ALL LC_CTYPE LC_COLLATE LC_MESSAGES
1839 eval "if test \"\${save_$lt_var+set}\" = set; then
1840 $lt_var=\$save_$lt_var; export $lt_var
1846 # Now prepare to actually exec the command.
1847 exec_cmd="\$cmd$args"
1849 # Display what would be done.
1850 if test -n "$shlibpath_var"; then
1851 eval "\$ECHO \"\$shlibpath_var=\$$shlibpath_var\""
1852 echo "export $shlibpath_var"
1859 test "$opt_mode" = execute && func_mode_execute ${1+"$@"}
1862 # func_mode_finish arg...
1870 for opt in "$nonopt" ${1+"$@"}
1872 if test -d "$opt"; then
1873 func_append libdirs " $opt"
1875 elif test -f "$opt"; then
1876 if func_lalib_unsafe_p "$opt"; then
1877 func_append libs " $opt"
1879 func_warning "\`$opt' is not a valid libtool archive"
1883 func_fatal_error "invalid argument \`$opt'"
1887 if test -n "$libs"; then
1888 if test -n "$lt_sysroot"; then
1889 sysroot_regex=`$ECHO "$lt_sysroot" | $SED "$sed_make_literal_regex"`
1890 sysroot_cmd="s/\([ ']\)$sysroot_regex/\1/g;"
1895 # Remove sysroot references
1896 if $opt_dry_run; then
1897 for lib in $libs; do
1898 echo "removing references to $lt_sysroot and \`=' prefixes from $lib"
1901 tmpdir=`func_mktempdir`
1902 for lib in $libs; do
1903 sed -e "${sysroot_cmd} s/\([ ']-[LR]\)=/\1/g; s/\([ ']\)=/\1/g" $lib \
1905 mv -f $tmpdir/tmp-la $lib
1911 if test -n "$finish_cmds$finish_eval" && test -n "$libdirs"; then
1912 for libdir in $libdirs; do
1913 if test -n "$finish_cmds"; then
1914 # Do each command in the finish commands.
1915 func_execute_cmds "$finish_cmds" 'admincmds="$admincmds
1918 if test -n "$finish_eval"; then
1919 # Do the single finish_eval.
1920 eval cmds=\"$finish_eval\"
1921 $opt_dry_run || eval "$cmds" || func_append admincmds "
1927 # Exit here if they wanted silent mode.
1928 $opt_silent && exit $EXIT_SUCCESS
1930 if test -n "$finish_cmds$finish_eval" && test -n "$libdirs"; then
1931 echo "----------------------------------------------------------------------"
1932 echo "Libraries have been installed in:"
1933 for libdir in $libdirs; do
1937 echo "If you ever happen to want to link against installed libraries"
1938 echo "in a given directory, LIBDIR, you must either use libtool, and"
1939 echo "specify the full pathname of the library, or use the \`-LLIBDIR'"
1940 echo "flag during linking and do at least one of the following:"
1941 if test -n "$shlibpath_var"; then
1942 echo " - add LIBDIR to the \`$shlibpath_var' environment variable"
1943 echo " during execution"
1945 if test -n "$runpath_var"; then
1946 echo " - add LIBDIR to the \`$runpath_var' environment variable"
1947 echo " during linking"
1949 if test -n "$hardcode_libdir_flag_spec"; then
1951 eval flag=\"$hardcode_libdir_flag_spec\"
1953 $ECHO " - use the \`$flag' linker flag"
1955 if test -n "$admincmds"; then
1956 $ECHO " - have your system administrator run these commands:$admincmds"
1958 if test -f /etc/ld.so.conf; then
1959 echo " - have your system administrator add LIBDIR to \`/etc/ld.so.conf'"
1963 echo "See any operating system documentation about shared libraries for"
1965 solaris2.[6789]|solaris2.1[0-9])
1966 echo "more information, such as the ld(1), crle(1) and ld.so(8) manual"
1970 echo "more information, such as the ld(1) and ld.so(8) manual pages."
1973 echo "----------------------------------------------------------------------"
1978 test "$opt_mode" = finish && func_mode_finish ${1+"$@"}
1981 # func_mode_install arg...
1982 func_mode_install ()
1985 # There may be an optional sh(1) argument at the beginning of
1986 # install_prog (especially on Windows NT).
1987 if test "$nonopt" = "$SHELL" || test "$nonopt" = /bin/sh ||
1988 # Allow the use of GNU shtool's install command.
1989 case $nonopt in *shtool*) :;; *) false;; esac; then
1990 # Aesthetically quote it.
1991 func_quote_for_eval "$nonopt"
1992 install_prog="$func_quote_for_eval_result "
2000 # The real first argument should be the name of the installation program.
2001 # Aesthetically quote it.
2002 func_quote_for_eval "$arg"
2003 func_append install_prog "$func_quote_for_eval_result"
2004 install_shared_prog=$install_prog
2005 case " $install_prog " in
2006 *[\\\ /]cp\ *) install_cp=: ;;
2007 *) install_cp=false ;;
2010 # We need to accept at least all the BSD install flags.
2022 if test -n "$dest"; then
2023 func_append files " $dest"
2031 if $install_cp; then :; else
2045 # If the previous option needed an argument, then skip it.
2046 if test -n "$prev"; then
2047 if test "x$prev" = x-m && test -n "$install_override_mode"; then
2048 arg2=$install_override_mode
2059 # Aesthetically quote the argument.
2060 func_quote_for_eval "$arg"
2061 func_append install_prog " $func_quote_for_eval_result"
2062 if test -n "$arg2"; then
2063 func_quote_for_eval "$arg2"
2065 func_append install_shared_prog " $func_quote_for_eval_result"
2068 test -z "$install_prog" && \
2069 func_fatal_help "you must specify an install program"
2071 test -n "$prev" && \
2072 func_fatal_help "the \`$prev' option requires an argument"
2074 if test -n "$install_override_mode" && $no_mode; then
2075 if $install_cp; then :; else
2076 func_quote_for_eval "$install_override_mode"
2077 func_append install_shared_prog " -m $func_quote_for_eval_result"
2081 if test -z "$files"; then
2082 if test -z "$dest"; then
2083 func_fatal_help "no file or destination specified"
2085 func_fatal_help "you must specify a destination"
2089 # Strip any trailing slash from the destination.
2090 func_stripname '' '/' "$dest"
2091 dest=$func_stripname_result
2093 # Check to see that the destination is a directory.
2094 test -d "$dest" && isdir=yes
2095 if test "$isdir" = yes; then
2099 func_dirname_and_basename "$dest" "" "."
2100 destdir="$func_dirname_result"
2101 destname="$func_basename_result"
2103 # Not a directory, so check to see that there is only one file specified.
2104 set dummy $files; shift
2105 test "$#" -gt 1 && \
2106 func_fatal_help "\`$dest' is not a directory"
2109 [\\/]* | [A-Za-z]:[\\/]*) ;;
2111 for file in $files; do
2115 func_fatal_help "\`$destdir' must be an absolute directory name"
2122 # This variable tells wrapper scripts just to set variables rather
2123 # than running their programs.
2124 libtool_install_magic="$magic"
2129 for file in $files; do
2131 # Do each installation.
2134 # Do the static libraries later.
2135 func_append staticlibs " $file"
2139 func_resolve_sysroot "$file"
2140 file=$func_resolve_sysroot_result
2142 # Check to see that this really is a libtool archive.
2143 func_lalib_unsafe_p "$file" \
2144 || func_fatal_help "\`$file' is not a valid libtool archive"
2151 # Add the libdir to current_libdirs if it is the destination.
2152 if test "X$destdir" = "X$libdir"; then
2153 case "$current_libdirs " in
2155 *) func_append current_libdirs " $libdir" ;;
2158 # Note the libdir as a future libdir.
2159 case "$future_libdirs " in
2161 *) func_append future_libdirs " $libdir" ;;
2165 func_dirname "$file" "/" ""
2166 dir="$func_dirname_result"
2167 func_append dir "$objdir"
2169 if test -n "$relink_command"; then
2170 # Determine the prefix the user has applied to our future dir.
2171 inst_prefix_dir=`$ECHO "$destdir" | $SED -e "s%$libdir\$%%"`
2173 # Don't allow the user to place us outside of our expected
2174 # location b/c this prevents finding dependent libraries that
2175 # are installed to the same prefix.
2176 # At present, this check doesn't affect windows .dll's that
2177 # are installed into $libdir/../bin (currently, that works fine)
2178 # but it's something to keep an eye on.
2179 test "$inst_prefix_dir" = "$destdir" && \
2180 func_fatal_error "error: cannot install \`$file' to a directory not ending in $libdir"
2182 if test -n "$inst_prefix_dir"; then
2183 # Stick the inst_prefix_dir data into the link command.
2184 relink_command=`$ECHO "$relink_command" | $SED "s%@inst_prefix_dir@%-inst-prefix-dir $inst_prefix_dir%"`
2186 relink_command=`$ECHO "$relink_command" | $SED "s%@inst_prefix_dir@%%"`
2189 func_warning "relinking \`$file'"
2190 func_show_eval "$relink_command" \
2191 'func_fatal_error "error: relink \`$file'\'' with the above command before installing it"'
2194 # See the names of the shared library.
2195 set dummy $library_names; shift
2196 if test -n "$1"; then
2201 test -n "$relink_command" && srcname="$realname"T
2203 # Install the shared library and build the symlinks.
2204 func_show_eval "$install_shared_prog $dir/$srcname $destdir/$realname" \
2208 cygwin* | mingw* | pw32* | cegcc*)
2216 if test -n "$tstripme" && test -n "$striplib"; then
2217 func_show_eval "$striplib $destdir/$realname" 'exit $?'
2220 if test "$#" -gt 0; then
2221 # Delete the old symlinks, and create new ones.
2222 # Try `ln -sf' first, because the `ln' binary might depend on
2223 # the symlink we replace! Solaris /bin/ln does not understand -f,
2224 # so we also need to try rm && ln -s.
2227 test "$linkname" != "$realname" \
2228 && func_show_eval "(cd $destdir && { $LN_S -f $realname $linkname || { $RM $linkname && $LN_S $realname $linkname; }; })"
2232 # Do each command in the postinstall commands.
2233 lib="$destdir/$realname"
2234 func_execute_cmds "$postinstall_cmds" 'exit $?'
2237 # Install the pseudo-library for information purposes.
2238 func_basename "$file"
2239 name="$func_basename_result"
2240 instname="$dir/$name"i
2241 func_show_eval "$install_prog $instname $destdir/$name" 'exit $?'
2243 # Maybe install the static library, too.
2244 test -n "$old_library" && func_append staticlibs " $dir/$old_library"
2248 # Install (i.e. copy) a libtool object.
2250 # Figure out destination file name, if it wasn't already specified.
2251 if test -n "$destname"; then
2252 destfile="$destdir/$destname"
2254 func_basename "$file"
2255 destfile="$func_basename_result"
2256 destfile="$destdir/$destfile"
2259 # Deduce the name of the destination old-style object file.
2262 func_lo2o "$destfile"
2263 staticdest=$func_lo2o_result
2266 staticdest="$destfile"
2270 func_fatal_help "cannot copy a libtool object to \`$destfile'"
2274 # Install the libtool object if requested.
2275 test -n "$destfile" && \
2276 func_show_eval "$install_prog $file $destfile" 'exit $?'
2278 # Install the old object if enabled.
2279 if test "$build_old_libs" = yes; then
2280 # Deduce the name of the old-style object file.
2282 staticobj=$func_lo2o_result
2283 func_show_eval "$install_prog \$staticobj \$staticdest" 'exit $?'
2289 # Figure out destination file name, if it wasn't already specified.
2290 if test -n "$destname"; then
2291 destfile="$destdir/$destname"
2293 func_basename "$file"
2294 destfile="$func_basename_result"
2295 destfile="$destdir/$destfile"
2298 # If the file is missing, and there is a .exe on the end, strip it
2299 # because it is most likely a libtool script we actually want to
2304 if test ! -f "$file"; then
2305 func_stripname '' '.exe' "$file"
2306 file=$func_stripname_result
2312 # Do a test to see if this is really a libtool program.
2315 if func_ltwrapper_executable_p "$file"; then
2316 func_ltwrapper_scriptname "$file"
2317 wrapper=$func_ltwrapper_scriptname_result
2319 func_stripname '' '.exe' "$file"
2320 wrapper=$func_stripname_result
2327 if func_ltwrapper_script_p "$wrapper"; then
2331 func_source "$wrapper"
2333 # Check the variables that should have been set.
2334 test -z "$generated_by_libtool_version" && \
2335 func_fatal_error "invalid libtool wrapper script \`$wrapper'"
2338 for lib in $notinst_deplibs; do
2339 # Check to see that each library is installed.
2341 if test -f "$lib"; then
2344 libfile="$libdir/"`$ECHO "$lib" | $SED 's%^.*/%%g'` ### testsuite: skip nested quoting test
2345 if test -n "$libdir" && test ! -f "$libfile"; then
2346 func_warning "\`$lib' has not been installed in \`$libdir'"
2352 func_source "$wrapper"
2355 if test "$fast_install" = no && test -n "$relink_command"; then
2357 if test "$finalize" = yes; then
2358 tmpdir=`func_mktempdir`
2359 func_basename "$file$stripped_ext"
2360 file="$func_basename_result"
2361 outputname="$tmpdir/$file"
2362 # Replace the output file specification.
2363 relink_command=`$ECHO "$relink_command" | $SED 's%@OUTPUT@%'"$outputname"'%g'`
2366 func_quote_for_expand "$relink_command"
2367 eval "func_echo $func_quote_for_expand_result"
2369 if eval "$relink_command"; then :
2371 func_error "error: relink \`$file' with the above command before installing it"
2372 $opt_dry_run || ${RM}r "$tmpdir"
2377 func_warning "cannot relink \`$file'"
2381 # Install the binary that we compiled earlier.
2382 file=`$ECHO "$file$stripped_ext" | $SED "s%\([^/]*\)$%$objdir/\1%"`
2386 # remove .exe since cygwin /usr/bin/install will append another
2388 case $install_prog,$host in
2389 */usr/bin/install*,*cygwin*)
2390 case $file:$destfile in
2395 destfile=$destfile.exe
2398 func_stripname '' '.exe' "$destfile"
2399 destfile=$func_stripname_result
2404 func_show_eval "$install_prog\$stripme \$file \$destfile" 'exit $?'
2405 $opt_dry_run || if test -n "$outputname"; then
2412 for file in $staticlibs; do
2413 func_basename "$file"
2414 name="$func_basename_result"
2416 # Set up the ranlib parameters.
2417 oldlib="$destdir/$name"
2418 func_to_tool_file "$oldlib" func_convert_file_msys_to_w32
2419 tool_oldlib=$func_to_tool_file_result
2421 func_show_eval "$install_prog \$file \$oldlib" 'exit $?'
2423 if test -n "$stripme" && test -n "$old_striplib"; then
2424 func_show_eval "$old_striplib $tool_oldlib" 'exit $?'
2427 # Do each command in the postinstall commands.
2428 func_execute_cmds "$old_postinstall_cmds" 'exit $?'
2431 test -n "$future_libdirs" && \
2432 func_warning "remember to run \`$progname --finish$future_libdirs'"
2434 if test -n "$current_libdirs"; then
2435 # Maybe just do a dry run.
2436 $opt_dry_run && current_libdirs=" -n$current_libdirs"
2437 exec_cmd='$SHELL $progpath $preserve_args --finish$current_libdirs'
2443 test "$opt_mode" = install && func_mode_install ${1+"$@"}
2446 # func_generate_dlsyms outputname originator pic_p
2447 # Extract symbols from dlprefiles and create ${outputname}S.o with
2448 # a dlpreopen symbol table.
2449 func_generate_dlsyms ()
2455 my_prefix=`$ECHO "$my_originator" | sed 's%[^a-zA-Z0-9]%_%g'`
2458 if test -n "$dlfiles$dlprefiles" || test "$dlself" != no; then
2459 if test -n "$NM" && test -n "$global_symbol_pipe"; then
2460 my_dlsyms="${my_outputname}S.c"
2462 func_error "not configured to extract global symbols from dlpreopened files"
2466 if test -n "$my_dlsyms"; then
2470 # Discover the nlist of each of the dlfiles.
2471 nlist="$output_objdir/${my_outputname}.nm"
2473 func_show_eval "$RM $nlist ${nlist}S ${nlist}T"
2475 # Parse the name list into a source file.
2476 func_verbose "creating $output_objdir/$my_dlsyms"
2478 $opt_dry_run || $ECHO > "$output_objdir/$my_dlsyms" "\
2479 /* $my_dlsyms - symbol resolution table for \`$my_outputname' dlsym emulation. */
2480 /* Generated by $PROGRAM (GNU $PACKAGE$TIMESTAMP) $VERSION */
2486 #if defined(__GNUC__) && (((__GNUC__ == 4) && (__GNUC_MINOR__ >= 4)) || (__GNUC__ > 4))
2487 #pragma GCC diagnostic ignored \"-Wstrict-prototypes\"
2490 /* Keep this code in sync between libtool.m4, ltmain, lt_system.h, and tests. */
2491 #if defined(_WIN32) || defined(__CYGWIN__) || defined(_WIN32_WCE)
2492 /* DATA imports from DLLs on WIN32 con't be const, because runtime
2493 relocations are performed -- see ld's documentation on pseudo-relocs. */
2494 # define LT_DLSYM_CONST
2495 #elif defined(__osf__)
2496 /* This system does not cope well with relocations in const data. */
2497 # define LT_DLSYM_CONST
2499 # define LT_DLSYM_CONST const
2502 /* External symbol declarations for the compiler. */\
2505 if test "$dlself" = yes; then
2506 func_verbose "generating symbol list for \`$output'"
2508 $opt_dry_run || echo ': @PROGRAM@ ' > "$nlist"
2510 # Add our own program objects to the symbol list.
2511 progfiles=`$ECHO "$objs$old_deplibs" | $SP2NL | $SED "$lo2o" | $NL2SP`
2512 for progfile in $progfiles; do
2513 func_to_tool_file "$progfile" func_convert_file_msys_to_w32
2514 func_verbose "extracting global C symbols from \`$func_to_tool_file_result'"
2515 $opt_dry_run || eval "$NM $func_to_tool_file_result | $global_symbol_pipe >> '$nlist'"
2518 if test -n "$exclude_expsyms"; then
2520 eval '$EGREP -v " ($exclude_expsyms)$" "$nlist" > "$nlist"T'
2521 eval '$MV "$nlist"T "$nlist"'
2525 if test -n "$export_symbols_regex"; then
2527 eval '$EGREP -e "$export_symbols_regex" "$nlist" > "$nlist"T'
2528 eval '$MV "$nlist"T "$nlist"'
2532 # Prepare the list of exported symbols
2533 if test -z "$export_symbols"; then
2534 export_symbols="$output_objdir/$outputname.exp"
2537 eval "${SED} -n -e '/^: @PROGRAM@ $/d' -e 's/^.* \(.*\)$/\1/p' "'< "$nlist" > "$export_symbols"'
2539 *cygwin* | *mingw* | *cegcc* )
2540 eval "echo EXPORTS "'> "$output_objdir/$outputname.def"'
2541 eval 'cat "$export_symbols" >> "$output_objdir/$outputname.def"'
2547 eval "${SED} -e 's/\([].[*^$]\)/\\\\\1/g' -e 's/^/ /' -e 's/$/$/'"' < "$export_symbols" > "$output_objdir/$outputname.exp"'
2548 eval '$GREP -f "$output_objdir/$outputname.exp" < "$nlist" > "$nlist"T'
2549 eval '$MV "$nlist"T "$nlist"'
2551 *cygwin* | *mingw* | *cegcc* )
2552 eval "echo EXPORTS "'> "$output_objdir/$outputname.def"'
2553 eval 'cat "$nlist" >> "$output_objdir/$outputname.def"'
2560 for dlprefile in $dlprefiles; do
2561 func_verbose "extracting global C symbols from \`$dlprefile'"
2562 func_basename "$dlprefile"
2563 name="$func_basename_result"
2565 *cygwin* | *mingw* | *cegcc* )
2566 # if an import library, we need to obtain dlname
2567 if func_win32_import_lib_p "$dlprefile"; then
2568 func_tr_sh "$dlprefile"
2569 eval "curr_lafile=\$libfile_$func_tr_sh_result"
2570 dlprefile_dlbasename=""
2571 if test -n "$curr_lafile" && func_lalib_p "$curr_lafile"; then
2572 # Use subshell, to avoid clobbering current variable values
2573 dlprefile_dlname=`source "$curr_lafile" && echo "$dlname"`
2574 if test -n "$dlprefile_dlname" ; then
2575 func_basename "$dlprefile_dlname"
2576 dlprefile_dlbasename="$func_basename_result"
2578 # no lafile. user explicitly requested -dlpreopen <import library>.
2579 $sharedlib_from_linklib_cmd "$dlprefile"
2580 dlprefile_dlbasename=$sharedlib_from_linklib_result
2584 if test -n "$dlprefile_dlbasename" ; then
2585 eval '$ECHO ": $dlprefile_dlbasename" >> "$nlist"'
2587 func_warning "Could not compute DLL name from $name"
2588 eval '$ECHO ": $name " >> "$nlist"'
2590 func_to_tool_file "$dlprefile" func_convert_file_msys_to_w32
2591 eval "$NM \"$func_to_tool_file_result\" 2>/dev/null | $global_symbol_pipe |
2592 $SED -e '/I __imp/d' -e 's/I __nm_/D /;s/_nm__//' >> '$nlist'"
2594 else # not an import lib
2596 eval '$ECHO ": $name " >> "$nlist"'
2597 func_to_tool_file "$dlprefile" func_convert_file_msys_to_w32
2598 eval "$NM \"$func_to_tool_file_result\" 2>/dev/null | $global_symbol_pipe >> '$nlist'"
2604 eval '$ECHO ": $name " >> "$nlist"'
2605 func_to_tool_file "$dlprefile" func_convert_file_msys_to_w32
2606 eval "$NM \"$func_to_tool_file_result\" 2>/dev/null | $global_symbol_pipe >> '$nlist'"
2613 # Make sure we have at least an empty file.
2614 test -f "$nlist" || : > "$nlist"
2616 if test -n "$exclude_expsyms"; then
2617 $EGREP -v " ($exclude_expsyms)$" "$nlist" > "$nlist"T
2618 $MV "$nlist"T "$nlist"
2621 # Try sorting and uniquifying the output.
2622 if $GREP -v "^: " < "$nlist" |
2623 if sort -k 3 </dev/null >/dev/null 2>&1; then
2628 uniq > "$nlist"S; then
2631 $GREP -v "^: " < "$nlist" > "$nlist"S
2634 if test -f "$nlist"S; then
2635 eval "$global_symbol_to_cdecl"' < "$nlist"S >> "$output_objdir/$my_dlsyms"'
2637 echo '/* NONE */' >> "$output_objdir/$my_dlsyms"
2640 echo >> "$output_objdir/$my_dlsyms" "\
2642 /* The mapping between symbol names and symbols. */
2647 extern LT_DLSYM_CONST lt_dlsymlist
2648 lt_${my_prefix}_LTX_preloaded_symbols[];
2649 LT_DLSYM_CONST lt_dlsymlist
2650 lt_${my_prefix}_LTX_preloaded_symbols[] =
2652 { \"$my_originator\", (void *) 0 },"
2654 case $need_lib_prefix in
2656 eval "$global_symbol_to_c_name_address" < "$nlist" >> "$output_objdir/$my_dlsyms"
2659 eval "$global_symbol_to_c_name_address_lib_prefix" < "$nlist" >> "$output_objdir/$my_dlsyms"
2662 echo >> "$output_objdir/$my_dlsyms" "\
2666 /* This works around a problem in FreeBSD linker */
2667 #ifdef FREEBSD_WORKAROUND
2668 static const void *lt_preloaded_setup() {
2669 return lt_${my_prefix}_LTX_preloaded_symbols;
2679 pic_flag_for_symtable=
2680 case "$compile_command " in
2684 # compiling the symbol table file with pic_flag works around
2685 # a FreeBSD bug that causes programs to crash when -lm is
2686 # linked before any other PIC object. But we must not use
2687 # pic_flag when linking with -static. The problem exists in
2688 # FreeBSD 2.2.6 and is fixed in FreeBSD 3.1.
2689 *-*-freebsd2.*|*-*-freebsd3.0*|*-*-freebsdelf3.0*)
2690 pic_flag_for_symtable=" $pic_flag -DFREEBSD_WORKAROUND" ;;
2692 pic_flag_for_symtable=" $pic_flag" ;;
2694 if test "X$my_pic_p" != Xno; then
2695 pic_flag_for_symtable=" $pic_flag"
2702 for arg in $LTCFLAGS; do
2704 -pie | -fpie | -fPIE) ;;
2705 *) func_append symtab_cflags " $arg" ;;
2709 # Now compile the dynamic symbol file.
2710 func_show_eval '(cd $output_objdir && $LTCC$symtab_cflags -c$no_builtin_flag$pic_flag_for_symtable "$my_dlsyms")' 'exit $?'
2712 # Clean up the generated files.
2713 func_show_eval '$RM "$output_objdir/$my_dlsyms" "$nlist" "${nlist}S" "${nlist}T"'
2715 # Transform the symbol file into the correct name.
2716 symfileobj="$output_objdir/${my_outputname}S.$objext"
2718 *cygwin* | *mingw* | *cegcc* )
2719 if test -f "$output_objdir/$my_outputname.def"; then
2720 compile_command=`$ECHO "$compile_command" | $SED "s%@SYMFILE@%$output_objdir/$my_outputname.def $symfileobj%"`
2721 finalize_command=`$ECHO "$finalize_command" | $SED "s%@SYMFILE@%$output_objdir/$my_outputname.def $symfileobj%"`
2723 compile_command=`$ECHO "$compile_command" | $SED "s%@SYMFILE@%$symfileobj%"`
2724 finalize_command=`$ECHO "$finalize_command" | $SED "s%@SYMFILE@%$symfileobj%"`
2728 compile_command=`$ECHO "$compile_command" | $SED "s%@SYMFILE@%$symfileobj%"`
2729 finalize_command=`$ECHO "$finalize_command" | $SED "s%@SYMFILE@%$symfileobj%"`
2734 func_fatal_error "unknown suffix for \`$my_dlsyms'"
2738 # We keep going just in case the user didn't refer to
2739 # lt_preloaded_symbols. The linker will fail if global_symbol_pipe
2740 # really was required.
2742 # Nullify the symbol file.
2743 compile_command=`$ECHO "$compile_command" | $SED "s% @SYMFILE@%%"`
2744 finalize_command=`$ECHO "$finalize_command" | $SED "s% @SYMFILE@%%"`
2748 # func_win32_libid arg
2749 # return the library type of file 'arg'
2751 # Need a lot of goo to handle *both* DLLs and import libs
2752 # Has to be a shell function in order to 'eat' the argument
2753 # that is supplied when $file_magic_command is called.
2754 # Despite the name, also deal with 64 bit binaries.
2758 win32_libid_type="unknown"
2759 win32_fileres=`file -L $1 2>/dev/null`
2760 case $win32_fileres in
2761 *ar\ archive\ import\ library*) # definitely import
2762 win32_libid_type="x86 archive import"
2764 *ar\ archive*) # could be an import, or static
2765 # Keep the egrep pattern in sync with the one in _LT_CHECK_MAGIC_METHOD.
2766 if eval $OBJDUMP -f $1 | $SED -e '10q' 2>/dev/null |
2767 $EGREP 'file format (pei*-i386(.*architecture: i386)?|pe-arm-wince|pe-x86-64)' >/dev/null; then
2768 func_to_tool_file "$1" func_convert_file_msys_to_w32
2769 win32_nmres=`eval $NM -f posix -A \"$func_to_tool_file_result\" |
2778 case $win32_nmres in
2779 import*) win32_libid_type="x86 archive import";;
2780 *) win32_libid_type="x86 archive static";;
2785 win32_libid_type="x86 DLL"
2787 *executable*) # but shell scripts are "executable" too...
2788 case $win32_fileres in
2789 *MS\ Windows\ PE\ Intel*)
2790 win32_libid_type="x86 DLL"
2795 $ECHO "$win32_libid_type"
2798 # func_cygming_dll_for_implib ARG
2800 # Platform-specific function to extract the
2801 # name of the DLL associated with the specified
2802 # import library ARG.
2803 # Invoked by eval'ing the libtool variable
2804 # $sharedlib_from_linklib_cmd
2805 # Result is available in the variable
2806 # $sharedlib_from_linklib_result
2807 func_cygming_dll_for_implib ()
2810 sharedlib_from_linklib_result=`$DLLTOOL --identify-strict --identify "$1"`
2813 # func_cygming_dll_for_implib_fallback_core SECTION_NAME LIBNAMEs
2815 # The is the core of a fallback implementation of a
2816 # platform-specific function to extract the name of the
2817 # DLL associated with the specified import library LIBNAME.
2819 # SECTION_NAME is either .idata$6 or .idata$7, depending
2820 # on the platform and compiler that created the implib.
2822 # Echos the name of the DLL associated with the
2823 # specified import library.
2824 func_cygming_dll_for_implib_fallback_core ()
2827 match_literal=`$ECHO "$1" | $SED "$sed_make_literal_regex"`
2828 $OBJDUMP -s --section "$1" "$2" 2>/dev/null |
2829 $SED '/^Contents of section '"$match_literal"':/{
2830 # Place marker at beginning of archive member dllname section
2835 # These lines can sometimes be longer than 43 characters, but
2836 # are always uninteresting
2837 /:[ ]*file format pe[i]\{,1\}-/d
2838 /^In archive [^:]*:/d
2839 # Ensure marker is printed
2841 # Remove all lines with less than 43 characters
2843 # From remaining lines, remove first 43 characters
2846 # Join marker and all lines until next marker into a single line
2847 /^====MARK====/ b para
2856 # Remove trailing dots and whitespace
2860 # we now have a list, one entry per line, of the stringified
2861 # contents of the appropriate section of all members of the
2862 # archive which possess that section. Heuristic: eliminate
2863 # all those which have a first or second character that is
2864 # a '.' (that is, objdump's representation of an unprintable
2865 # character.) This should work for all archives with less than
2866 # 0x302f exports -- but will fail for DLLs whose name actually
2867 # begins with a literal '.' or a single character followed by
2870 # Of those that remain, print the first one.
2871 $SED -e '/^\./d;/^.\./d;q'
2874 # func_cygming_gnu_implib_p ARG
2875 # This predicate returns with zero status (TRUE) if
2876 # ARG is a GNU/binutils-style import library. Returns
2877 # with nonzero status (FALSE) otherwise.
2878 func_cygming_gnu_implib_p ()
2881 func_to_tool_file "$1" func_convert_file_msys_to_w32
2882 func_cygming_gnu_implib_tmp=`$NM "$func_to_tool_file_result" | eval "$global_symbol_pipe" | $EGREP ' (_head_[A-Za-z0-9_]+_[ad]l*|[A-Za-z0-9_]+_[ad]l*_iname)$'`
2883 test -n "$func_cygming_gnu_implib_tmp"
2886 # func_cygming_ms_implib_p ARG
2887 # This predicate returns with zero status (TRUE) if
2888 # ARG is an MS-style import library. Returns
2889 # with nonzero status (FALSE) otherwise.
2890 func_cygming_ms_implib_p ()
2893 func_to_tool_file "$1" func_convert_file_msys_to_w32
2894 func_cygming_ms_implib_tmp=`$NM "$func_to_tool_file_result" | eval "$global_symbol_pipe" | $GREP '_NULL_IMPORT_DESCRIPTOR'`
2895 test -n "$func_cygming_ms_implib_tmp"
2898 # func_cygming_dll_for_implib_fallback ARG
2899 # Platform-specific function to extract the
2900 # name of the DLL associated with the specified
2901 # import library ARG.
2903 # This fallback implementation is for use when $DLLTOOL
2904 # does not support the --identify-strict option.
2905 # Invoked by eval'ing the libtool variable
2906 # $sharedlib_from_linklib_cmd
2907 # Result is available in the variable
2908 # $sharedlib_from_linklib_result
2909 func_cygming_dll_for_implib_fallback ()
2912 if func_cygming_gnu_implib_p "$1" ; then
2913 # binutils import library
2914 sharedlib_from_linklib_result=`func_cygming_dll_for_implib_fallback_core '.idata$7' "$1"`
2915 elif func_cygming_ms_implib_p "$1" ; then
2916 # ms-generated import library
2917 sharedlib_from_linklib_result=`func_cygming_dll_for_implib_fallback_core '.idata$6' "$1"`
2920 sharedlib_from_linklib_result=""
2925 # func_extract_an_archive dir oldlib
2926 func_extract_an_archive ()
2929 f_ex_an_ar_dir="$1"; shift
2930 f_ex_an_ar_oldlib="$1"
2931 if test "$lock_old_archive_extraction" = yes; then
2932 lockfile=$f_ex_an_ar_oldlib.lock
2933 until $opt_dry_run || ln "$progpath" "$lockfile" 2>/dev/null; do
2934 func_echo "Waiting for $lockfile to be removed"
2938 func_show_eval "(cd \$f_ex_an_ar_dir && $AR x \"\$f_ex_an_ar_oldlib\")" \
2939 'stat=$?; rm -f "$lockfile"; exit $stat'
2940 if test "$lock_old_archive_extraction" = yes; then
2941 $opt_dry_run || rm -f "$lockfile"
2943 if ($AR t "$f_ex_an_ar_oldlib" | sort | sort -uc >/dev/null 2>&1); then
2946 func_fatal_error "object name conflicts in archive: $f_ex_an_ar_dir/$f_ex_an_ar_oldlib"
2951 # func_extract_archives gentop oldlib ...
2952 func_extract_archives ()
2955 my_gentop="$1"; shift
2956 my_oldlibs=${1+"$@"}
2962 for my_xlib in $my_oldlibs; do
2963 # Extract the objects.
2965 [\\/]* | [A-Za-z]:[\\/]*) my_xabs="$my_xlib" ;;
2966 *) my_xabs=`pwd`"/$my_xlib" ;;
2968 func_basename "$my_xlib"
2969 my_xlib="$func_basename_result"
2972 case " $extracted_archives " in
2974 func_arith $extracted_serial + 1
2975 extracted_serial=$func_arith_result
2976 my_xlib_u=lt$extracted_serial-$my_xlib ;;
2980 extracted_archives="$extracted_archives $my_xlib_u"
2981 my_xdir="$my_gentop/$my_xlib_u"
2983 func_mkdir_p "$my_xdir"
2987 func_verbose "Extracting $my_xabs"
2988 # Do not bother doing anything if just a dry run
2990 darwin_orig_dir=`pwd`
2991 cd $my_xdir || exit $?
2992 darwin_archive=$my_xabs
2994 darwin_base_archive=`basename "$darwin_archive"`
2995 darwin_arches=`$LIPO -info "$darwin_archive" 2>/dev/null | $GREP Architectures 2>/dev/null || true`
2996 if test -n "$darwin_arches"; then
2997 darwin_arches=`$ECHO "$darwin_arches" | $SED -e 's/.*are://'`
2999 func_verbose "$darwin_base_archive has multiple architectures $darwin_arches"
3000 for darwin_arch in $darwin_arches ; do
3001 func_mkdir_p "unfat-$$/${darwin_base_archive}-${darwin_arch}"
3002 $LIPO -thin $darwin_arch -output "unfat-$$/${darwin_base_archive}-${darwin_arch}/${darwin_base_archive}" "${darwin_archive}"
3003 cd "unfat-$$/${darwin_base_archive}-${darwin_arch}"
3004 func_extract_an_archive "`pwd`" "${darwin_base_archive}"
3006 $RM "unfat-$$/${darwin_base_archive}-${darwin_arch}/${darwin_base_archive}"
3007 done # $darwin_arches
3008 ## Okay now we've a bunch of thin objects, gotta fatten them up :)
3009 darwin_filelist=`find unfat-$$ -type f -name \*.o -print -o -name \*.lo -print | $SED -e "$basename" | sort -u`
3012 for darwin_file in $darwin_filelist; do
3013 darwin_files=`find unfat-$$ -name $darwin_file -print | sort | $NL2SP`
3014 $LIPO -create -output "$darwin_file" $darwin_files
3015 done # $darwin_filelist
3017 cd "$darwin_orig_dir"
3020 func_extract_an_archive "$my_xdir" "$my_xabs"
3025 func_extract_an_archive "$my_xdir" "$my_xabs"
3028 my_oldobjs="$my_oldobjs "`find $my_xdir -name \*.$objext -print -o -name \*.lo -print | sort | $NL2SP`
3031 func_extract_archives_result="$my_oldobjs"
3035 # func_emit_wrapper [arg=no]
3037 # Emit a libtool wrapper script on stdout.
3038 # Don't directly open a file because we may want to
3039 # incorporate the script contents within a cygwin/mingw
3040 # wrapper executable. Must ONLY be called from within
3041 # func_mode_link because it depends on a number of variables
3044 # ARG is the value that the WRAPPER_SCRIPT_BELONGS_IN_OBJDIR
3045 # variable will take. If 'yes', then the emitted script
3046 # will assume that the directory in which it is stored is
3047 # the $objdir directory. This is a cygwin/mingw-specific
3049 func_emit_wrapper ()
3051 func_emit_wrapper_arg1=${1-no}
3056 # $output - temporary wrapper script for $objdir/$outputname
3057 # Generated by $PROGRAM (GNU $PACKAGE$TIMESTAMP) $VERSION
3059 # The $output program cannot be directly executed until all the libtool
3060 # libraries that it depends on are installed.
3062 # This wrapper script should never be moved out of the build directory.
3063 # If it is, it will not operate correctly.
3065 # Sed substitution that helps us do robust quoting. It backslashifies
3066 # metacharacters that are still active within double-quoted strings.
3067 sed_quote_subst='$sed_quote_subst'
3069 # Be Bourne compatible
3070 if test -n \"\${ZSH_VERSION+set}\" && (emulate sh) >/dev/null 2>&1; then
3073 # Zsh 3.x and 4.x performs word splitting on \${1+\"\$@\"}, which
3074 # is contrary to our usage. Disable this feature.
3075 alias -g '\${1+\"\$@\"}'='\"\$@\"'
3076 setopt NO_GLOB_SUBST
3078 case \`(set -o) 2>/dev/null\` in *posix*) set -o posix;; esac
3080 BIN_SH=xpg4; export BIN_SH # for Tru64
3081 DUALCASE=1; export DUALCASE # for MKS sh
3083 # The HP-UX ksh and POSIX shell print the target directory to stdout
3085 (unset CDPATH) >/dev/null 2>&1 && unset CDPATH
3087 relink_command=\"$relink_command\"
3089 # This environment variable determines our operation mode.
3090 if test \"\$libtool_install_magic\" = \"$magic\"; then
3091 # install mode needs the following variables:
3092 generated_by_libtool_version='$macro_version'
3093 notinst_deplibs='$notinst_deplibs'
3095 # When we are sourced in execute mode, \$file and \$ECHO are already set.
3096 if test \"\$libtool_execute_magic\" != \"$magic\"; then
3099 qECHO=`$ECHO "$ECHO" | $SED "$sed_quote_subst"`
3102 # A function that is used when there is no print builtin or printf.
3103 func_fallback_echo ()
3105 eval 'cat <<_LTECHO_EOF
3112 # Very basic option parsing. These options are (a) specific to
3113 # the libtool wrapper, (b) are identical between the wrapper
3114 # /script/ and the wrapper /executable/ which is used only on
3115 # windows platforms, and (c) all begin with the string "--lt-"
3116 # (application programs are unlikely to have options which match
3119 # There are only two supported options: --lt-debug and
3120 # --lt-dump-script. There is, deliberately, no --lt-help.
3122 # The first argument to this parsing function should be the
3123 # script's $0 value, followed by "$@".
3125 func_parse_lt_options ()
3131 case \"\$lt_opt\" in
3132 --lt-debug) lt_option_debug=1 ;;
3134 lt_dump_D=\`\$ECHO \"X\$lt_script_arg0\" | $SED -e 's/^X//' -e 's%/[^/]*$%%'\`
3135 test \"X\$lt_dump_D\" = \"X\$lt_script_arg0\" && lt_dump_D=.
3136 lt_dump_F=\`\$ECHO \"X\$lt_script_arg0\" | $SED -e 's/^X//' -e 's%^.*/%%'\`
3137 cat \"\$lt_dump_D/\$lt_dump_F\"
3141 \$ECHO \"Unrecognized --lt- option: '\$lt_opt'\" 1>&2
3147 # Print the debug banner immediately:
3148 if test -n \"\$lt_option_debug\"; then
3149 echo \"${outputname}:${output}:\${LINENO}: libtool wrapper (GNU $PACKAGE$TIMESTAMP) $VERSION\" 1>&2
3153 # Used when --lt-debug. Prints its arguments to stdout
3154 # (redirection is the responsibility of the caller)
3155 func_lt_dump_args ()
3160 \$ECHO \"${outputname}:${output}:\${LINENO}: newargv[\$lt_dump_args_N]: \$lt_arg\"
3161 lt_dump_args_N=\`expr \$lt_dump_args_N + 1\`
3165 # Core function for launching the target application
3166 func_exec_program_core ()
3170 # Backslashes separate directories on plain windows
3171 *-*-mingw | *-*-os2* | *-cegcc*)
3173 if test -n \"\$lt_option_debug\"; then
3174 \$ECHO \"${outputname}:${output}:\${LINENO}: newargv[0]: \$progdir\\\\\$program\" 1>&2
3175 func_lt_dump_args \${1+\"\$@\"} 1>&2
3177 exec \"\$progdir\\\\\$program\" \${1+\"\$@\"}
3183 if test -n \"\$lt_option_debug\"; then
3184 \$ECHO \"${outputname}:${output}:\${LINENO}: newargv[0]: \$progdir/\$program\" 1>&2
3185 func_lt_dump_args \${1+\"\$@\"} 1>&2
3187 exec \"\$progdir/\$program\" \${1+\"\$@\"}
3192 \$ECHO \"\$0: cannot exec \$program \$*\" 1>&2
3196 # A function to encapsulate launching the target application
3197 # Strips options in the --lt-* namespace from \$@ and
3198 # launches target application with the remaining arguments.
3199 func_exec_program ()
3207 *) set x \"\$@\" \"\$lt_wr_arg\"; shift;;
3212 func_exec_program_core \${1+\"\$@\"}
3216 func_parse_lt_options \"\$0\" \${1+\"\$@\"}
3218 # Find the directory that this script lives in.
3219 thisdir=\`\$ECHO \"\$file\" | $SED 's%/[^/]*$%%'\`
3220 test \"x\$thisdir\" = \"x\$file\" && thisdir=.
3222 # Follow symbolic links until we get to the real thisdir.
3223 file=\`ls -ld \"\$file\" | $SED -n 's/.*-> //p'\`
3224 while test -n \"\$file\"; do
3225 destdir=\`\$ECHO \"\$file\" | $SED 's%/[^/]*\$%%'\`
3227 # If there was a directory component, then change thisdir.
3228 if test \"x\$destdir\" != \"x\$file\"; then
3229 case \"\$destdir\" in
3230 [\\\\/]* | [A-Za-z]:[\\\\/]*) thisdir=\"\$destdir\" ;;
3231 *) thisdir=\"\$thisdir/\$destdir\" ;;
3235 file=\`\$ECHO \"\$file\" | $SED 's%^.*/%%'\`
3236 file=\`ls -ld \"\$thisdir/\$file\" | $SED -n 's/.*-> //p'\`
3239 # Usually 'no', except on cygwin/mingw when embedded into
3241 WRAPPER_SCRIPT_BELONGS_IN_OBJDIR=$func_emit_wrapper_arg1
3242 if test \"\$WRAPPER_SCRIPT_BELONGS_IN_OBJDIR\" = \"yes\"; then
3243 # special case for '.'
3244 if test \"\$thisdir\" = \".\"; then
3247 # remove .libs from thisdir
3248 case \"\$thisdir\" in
3249 *[\\\\/]$objdir ) thisdir=\`\$ECHO \"\$thisdir\" | $SED 's%[\\\\/][^\\\\/]*$%%'\` ;;
3250 $objdir ) thisdir=. ;;
3254 # Try to get the absolute directory name.
3255 absdir=\`cd \"\$thisdir\" && pwd\`
3256 test -n \"\$absdir\" && thisdir=\"\$absdir\"
3259 if test "$fast_install" = yes; then
3261 program=lt-'$outputname'$exeext
3262 progdir=\"\$thisdir/$objdir\"
3264 if test ! -f \"\$progdir/\$program\" ||
3265 { file=\`ls -1dt \"\$progdir/\$program\" \"\$progdir/../\$program\" 2>/dev/null | ${SED} 1q\`; \\
3266 test \"X\$file\" != \"X\$progdir/\$program\"; }; then
3268 file=\"\$\$-\$program\"
3270 if test ! -d \"\$progdir\"; then
3271 $MKDIR \"\$progdir\"
3273 $RM \"\$progdir/\$file\"
3278 # relink executable if necessary
3279 if test -n \"\$relink_command\"; then
3280 if relink_command_output=\`eval \$relink_command 2>&1\`; then :
3282 $ECHO \"\$relink_command_output\" >&2
3283 $RM \"\$progdir/\$file\"
3288 $MV \"\$progdir/\$file\" \"\$progdir/\$program\" 2>/dev/null ||
3289 { $RM \"\$progdir/\$program\";
3290 $MV \"\$progdir/\$file\" \"\$progdir/\$program\"; }
3291 $RM \"\$progdir/\$file\"
3295 program='$outputname'
3296 progdir=\"\$thisdir/$objdir\"
3302 if test -f \"\$progdir/\$program\"; then"
3304 # fixup the dll searchpath if we need to.
3306 # Fix the DLL searchpath if we need to. Do this before prepending
3307 # to shlibpath, because on Windows, both are PATH and uninstalled
3308 # libraries must come first.
3309 if test -n "$dllsearchpath"; then
3311 # Add the dll search path components to the executable PATH
3312 PATH=$dllsearchpath:\$PATH
3316 # Export our shlibpath_var if we have one.
3317 if test "$shlibpath_overrides_runpath" = yes && test -n "$shlibpath_var" && test -n "$temp_rpath"; then
3319 # Add our own library path to $shlibpath_var
3320 $shlibpath_var=\"$temp_rpath\$$shlibpath_var\"
3322 # Some systems cannot cope with colon-terminated $shlibpath_var
3323 # The second colon is a workaround for a bug in BeOS R4 sed
3324 $shlibpath_var=\`\$ECHO \"\$$shlibpath_var\" | $SED 's/::*\$//'\`
3326 export $shlibpath_var
3331 if test \"\$libtool_execute_magic\" != \"$magic\"; then
3332 # Run the actual program with our arguments.
3333 func_exec_program \${1+\"\$@\"}
3336 # The program doesn't exist.
3337 \$ECHO \"\$0: error: \\\`\$progdir/\$program' does not exist\" 1>&2
3338 \$ECHO \"This script is just a wrapper for \$program.\" 1>&2
3339 \$ECHO \"See the $PACKAGE documentation for more information.\" 1>&2
3347 # func_emit_cwrapperexe_src
3348 # emit the source code for a wrapper executable on stdout
3349 # Must ONLY be called from within func_mode_link because
3350 # it depends on a number of variable set therein.
3351 func_emit_cwrapperexe_src ()
3355 /* $cwrappersource - temporary wrapper executable for $objdir/$outputname
3356 Generated by $PROGRAM (GNU $PACKAGE$TIMESTAMP) $VERSION
3358 The $output program cannot be directly executed until all the libtool
3359 libraries that it depends on are installed.
3361 This wrapper executable should never be moved out of the build directory.
3362 If it is, it will not operate correctly.
3367 # define _CRT_SECURE_NO_DEPRECATE 1
3372 # include <direct.h>
3373 # include <process.h>
3376 # include <unistd.h>
3377 # include <stdint.h>
3389 #include <sys/stat.h>
3391 /* declarations of non-ANSI functions */
3392 #if defined(__MINGW32__)
3393 # ifdef __STRICT_ANSI__
3394 int _putenv (const char *);
3396 #elif defined(__CYGWIN__)
3397 # ifdef __STRICT_ANSI__
3398 char *realpath (const char *, char *);
3399 int putenv (char *);
3400 int setenv (const char *, const char *, int);
3402 /* #elif defined (other platforms) ... */
3405 /* portability defines, excluding path handling macros */
3406 #if defined(_MSC_VER)
3407 # define setmode _setmode
3409 # define chmod _chmod
3410 # define getcwd _getcwd
3411 # define putenv _putenv
3412 # define S_IXUSR _S_IEXEC
3413 # ifndef _INTPTR_T_DEFINED
3414 # define _INTPTR_T_DEFINED
3415 # define intptr_t int
3417 #elif defined(__MINGW32__)
3418 # define setmode _setmode
3420 # define chmod _chmod
3421 # define getcwd _getcwd
3422 # define putenv _putenv
3423 #elif defined(__CYGWIN__)
3424 # define HAVE_SETENV
3425 # define FOPEN_WB "wb"
3426 /* #elif defined (other platforms) ... */
3429 #if defined(PATH_MAX)
3430 # define LT_PATHMAX PATH_MAX
3431 #elif defined(MAXPATHLEN)
3432 # define LT_PATHMAX MAXPATHLEN
3434 # define LT_PATHMAX 1024
3444 /* path handling portability macros */
3445 #ifndef DIR_SEPARATOR
3446 # define DIR_SEPARATOR '/'
3447 # define PATH_SEPARATOR ':'
3450 #if defined (_WIN32) || defined (__MSDOS__) || defined (__DJGPP__) || \
3452 # define HAVE_DOS_BASED_FILE_SYSTEM
3453 # define FOPEN_WB "wb"
3454 # ifndef DIR_SEPARATOR_2
3455 # define DIR_SEPARATOR_2 '\\'
3457 # ifndef PATH_SEPARATOR_2
3458 # define PATH_SEPARATOR_2 ';'
3462 #ifndef DIR_SEPARATOR_2
3463 # define IS_DIR_SEPARATOR(ch) ((ch) == DIR_SEPARATOR)
3464 #else /* DIR_SEPARATOR_2 */
3465 # define IS_DIR_SEPARATOR(ch) \
3466 (((ch) == DIR_SEPARATOR) || ((ch) == DIR_SEPARATOR_2))
3467 #endif /* DIR_SEPARATOR_2 */
3469 #ifndef PATH_SEPARATOR_2
3470 # define IS_PATH_SEPARATOR(ch) ((ch) == PATH_SEPARATOR)
3471 #else /* PATH_SEPARATOR_2 */
3472 # define IS_PATH_SEPARATOR(ch) ((ch) == PATH_SEPARATOR_2)
3473 #endif /* PATH_SEPARATOR_2 */
3476 # define FOPEN_WB "w"
3479 # define _O_BINARY 0
3482 #define XMALLOC(type, num) ((type *) xmalloc ((num) * sizeof(type)))
3483 #define XFREE(stale) do { \
3484 if (stale) { free ((void *) stale); stale = 0; } \
3487 #if defined(LT_DEBUGWRAPPER)
3488 static int lt_debug = 1;
3490 static int lt_debug = 0;
3493 const char *program_name = "libtool-wrapper"; /* in case xstrdup fails */
3495 void *xmalloc (size_t num);
3496 char *xstrdup (const char *string);
3497 const char *base_name (const char *name);
3498 char *find_executable (const char *wrapper);
3499 char *chase_symlinks (const char *pathspec);
3500 int make_executable (const char *path);
3501 int check_executable (const char *path);
3502 char *strendzap (char *str, const char *pat);
3503 void lt_debugprintf (const char *file, int line, const char *fmt, ...);
3504 void lt_fatal (const char *file, int line, const char *message, ...);
3505 static const char *nonnull (const char *s);
3506 static const char *nonempty (const char *s);
3507 void lt_setenv (const char *name, const char *value);
3508 char *lt_extend_str (const char *orig_value, const char *add, int to_end);
3509 void lt_update_exe_path (const char *name, const char *value);
3510 void lt_update_lib_path (const char *name, const char *value);
3511 char **prepare_spawn (char **argv);
3512 void lt_dump_script (FILE *f);
3516 volatile const char * MAGIC_EXE = "$magic_exe";
3517 const char * LIB_PATH_VARNAME = "$shlibpath_var";
3520 if test "$shlibpath_overrides_runpath" = yes && test -n "$shlibpath_var" && test -n "$temp_rpath"; then
3521 func_to_host_path "$temp_rpath"
3523 const char * LIB_PATH_VALUE = "$func_to_host_path_result";
3527 const char * LIB_PATH_VALUE = "";
3531 if test -n "$dllsearchpath"; then
3532 func_to_host_path "$dllsearchpath:"
3534 const char * EXE_PATH_VARNAME = "PATH";
3535 const char * EXE_PATH_VALUE = "$func_to_host_path_result";
3539 const char * EXE_PATH_VARNAME = "";
3540 const char * EXE_PATH_VALUE = "";
3544 if test "$fast_install" = yes; then
3546 const char * TARGET_PROGRAM_NAME = "lt-$outputname"; /* hopefully, no .exe */
3550 const char * TARGET_PROGRAM_NAME = "$outputname"; /* hopefully, no .exe */
3557 #define LTWRAPPER_OPTION_PREFIX "--lt-"
3559 static const char *ltwrapper_option_prefix = LTWRAPPER_OPTION_PREFIX;
3560 static const char *dumpscript_opt = LTWRAPPER_OPTION_PREFIX "dump-script";
3561 static const char *debug_opt = LTWRAPPER_OPTION_PREFIX "debug";
3564 main (int argc, char *argv[])
3569 char *actual_cwrapper_path;
3570 char *actual_cwrapper_name;
3573 intptr_t rval = 127;
3577 program_name = (char *) xstrdup (base_name (argv[0]));
3578 newargz = XMALLOC (char *, argc + 1);
3580 /* very simple arg parsing; don't want to rely on getopt
3581 * also, copy all non cwrapper options to newargz, except
3582 * argz[0], which is handled differently
3585 for (i = 1; i < argc; i++)
3587 if (strcmp (argv[i], dumpscript_opt) == 0)
3591 *mingw* | *cygwin* )
3592 # make stdout use "unix" line endings
3593 echo " setmode(1,_O_BINARY);"
3598 lt_dump_script (stdout);
3601 if (strcmp (argv[i], debug_opt) == 0)
3606 if (strcmp (argv[i], ltwrapper_option_prefix) == 0)
3608 /* however, if there is an option in the LTWRAPPER_OPTION_PREFIX
3609 namespace, but it is not one of the ones we know about and
3610 have already dealt with, above (inluding dump-script), then
3611 report an error. Otherwise, targets might begin to believe
3612 they are allowed to use options in the LTWRAPPER_OPTION_PREFIX
3613 namespace. The first time any user complains about this, we'll
3614 need to make LTWRAPPER_OPTION_PREFIX a configure-time option
3615 or a configure.ac-settable value.
3617 lt_fatal (__FILE__, __LINE__,
3618 "unrecognized %s option: '%s'",
3619 ltwrapper_option_prefix, argv[i]);
3622 newargz[++newargc] = xstrdup (argv[i]);
3624 newargz[++newargc] = NULL;
3628 /* The GNU banner must be the first non-error debug message */
3629 lt_debugprintf (__FILE__, __LINE__, "libtool wrapper (GNU $PACKAGE$TIMESTAMP) $VERSION\n");
3632 lt_debugprintf (__FILE__, __LINE__, "(main) argv[0]: %s\n", argv[0]);
3633 lt_debugprintf (__FILE__, __LINE__, "(main) program_name: %s\n", program_name);
3635 tmp_pathspec = find_executable (argv[0]);
3636 if (tmp_pathspec == NULL)
3637 lt_fatal (__FILE__, __LINE__, "couldn't find %s", argv[0]);
3638 lt_debugprintf (__FILE__, __LINE__,
3639 "(main) found exe (before symlink chase) at: %s\n",
3642 actual_cwrapper_path = chase_symlinks (tmp_pathspec);
3643 lt_debugprintf (__FILE__, __LINE__,
3644 "(main) found exe (after symlink chase) at: %s\n",
3645 actual_cwrapper_path);
3646 XFREE (tmp_pathspec);
3648 actual_cwrapper_name = xstrdup (base_name (actual_cwrapper_path));
3649 strendzap (actual_cwrapper_path, actual_cwrapper_name);
3651 /* wrapper name transforms */
3652 strendzap (actual_cwrapper_name, ".exe");
3653 tmp_pathspec = lt_extend_str (actual_cwrapper_name, ".exe", 1);
3654 XFREE (actual_cwrapper_name);
3655 actual_cwrapper_name = tmp_pathspec;
3658 /* target_name transforms -- use actual target program name; might have lt- prefix */
3659 target_name = xstrdup (base_name (TARGET_PROGRAM_NAME));
3660 strendzap (target_name, ".exe");
3661 tmp_pathspec = lt_extend_str (target_name, ".exe", 1);
3662 XFREE (target_name);
3663 target_name = tmp_pathspec;
3666 lt_debugprintf (__FILE__, __LINE__,
3667 "(main) libtool target name: %s\n",
3673 XMALLOC (char, (strlen (actual_cwrapper_path) +
3674 strlen ("$objdir") + 1 + strlen (actual_cwrapper_name) + 1));
3675 strcpy (newargz[0], actual_cwrapper_path);
3676 strcat (newargz[0], "$objdir");
3677 strcat (newargz[0], "/");
3681 /* stop here, and copy so we don't have to do this twice */
3682 tmp_pathspec = xstrdup (newargz[0]);
3684 /* do NOT want the lt- prefix here, so use actual_cwrapper_name */
3685 strcat (newargz[0], actual_cwrapper_name);
3687 /* DO want the lt- prefix here if it exists, so use target_name */
3688 lt_argv_zero = lt_extend_str (tmp_pathspec, target_name, 1);
3689 XFREE (tmp_pathspec);
3690 tmp_pathspec = NULL;
3698 while ((p = strchr (newargz[0], '\\')) != NULL)
3702 while ((p = strchr (lt_argv_zero, '\\')) != NULL)
3712 XFREE (target_name);
3713 XFREE (actual_cwrapper_path);
3714 XFREE (actual_cwrapper_name);
3716 lt_setenv ("BIN_SH", "xpg4"); /* for Tru64 */
3717 lt_setenv ("DUALCASE", "1"); /* for MSK sh */
3718 /* Update the DLL searchpath. EXE_PATH_VALUE ($dllsearchpath) must
3719 be prepended before (that is, appear after) LIB_PATH_VALUE ($temp_rpath)
3720 because on Windows, both *_VARNAMEs are PATH but uninstalled
3721 libraries must come first. */
3722 lt_update_exe_path (EXE_PATH_VARNAME, EXE_PATH_VALUE);
3723 lt_update_lib_path (LIB_PATH_VARNAME, LIB_PATH_VALUE);
3725 lt_debugprintf (__FILE__, __LINE__, "(main) lt_argv_zero: %s\n",
3726 nonnull (lt_argv_zero));
3727 for (i = 0; i < newargc; i++)
3729 lt_debugprintf (__FILE__, __LINE__, "(main) newargz[%d]: %s\n",
3730 i, nonnull (newargz[i]));
3738 /* execv doesn't actually work on mingw as expected on unix */
3739 newargz = prepare_spawn (newargz);
3740 rval = _spawnv (_P_WAIT, lt_argv_zero, (const char * const *) newargz);
3743 /* failed to start process */
3744 lt_debugprintf (__FILE__, __LINE__,
3745 "(main) failed to launch target \"%s\": %s\n",
3746 lt_argv_zero, nonnull (strerror (errno)));
3754 execv (lt_argv_zero, newargz);
3755 return rval; /* =127, but avoids unused variable warning */
3764 xmalloc (size_t num)
3766 void *p = (void *) malloc (num);
3768 lt_fatal (__FILE__, __LINE__, "memory exhausted");
3774 xstrdup (const char *string)
3776 return string ? strcpy ((char *) xmalloc (strlen (string) + 1),
3781 base_name (const char *name)
3785 #if defined (HAVE_DOS_BASED_FILE_SYSTEM)
3786 /* Skip over the disk name in MSDOS pathnames. */
3787 if (isalpha ((unsigned char) name[0]) && name[1] == ':')
3791 for (base = name; *name; name++)
3792 if (IS_DIR_SEPARATOR (*name))
3798 check_executable (const char *path)
3802 lt_debugprintf (__FILE__, __LINE__, "(check_executable): %s\n",
3804 if ((!path) || (!*path))
3807 if ((stat (path, &st) >= 0)
3808 && (st.st_mode & (S_IXUSR | S_IXGRP | S_IXOTH)))
3815 make_executable (const char *path)
3820 lt_debugprintf (__FILE__, __LINE__, "(make_executable): %s\n",
3822 if ((!path) || (!*path))
3825 if (stat (path, &st) >= 0)
3827 rval = chmod (path, st.st_mode | S_IXOTH | S_IXGRP | S_IXUSR);
3832 /* Searches for the full path of the wrapper. Returns
3833 newly allocated full path name if found, NULL otherwise
3834 Does not chase symlinks, even on platforms that support them.
3837 find_executable (const char *wrapper)
3842 /* static buffer for getcwd */
3843 char tmp[LT_PATHMAX + 1];
3847 lt_debugprintf (__FILE__, __LINE__, "(find_executable): %s\n",
3848 nonempty (wrapper));
3850 if ((wrapper == NULL) || (*wrapper == '\0'))
3853 /* Absolute path? */
3854 #if defined (HAVE_DOS_BASED_FILE_SYSTEM)
3855 if (isalpha ((unsigned char) wrapper[0]) && wrapper[1] == ':')
3857 concat_name = xstrdup (wrapper);
3858 if (check_executable (concat_name))
3860 XFREE (concat_name);
3865 if (IS_DIR_SEPARATOR (wrapper[0]))
3867 concat_name = xstrdup (wrapper);
3868 if (check_executable (concat_name))
3870 XFREE (concat_name);
3872 #if defined (HAVE_DOS_BASED_FILE_SYSTEM)
3876 for (p = wrapper; *p; p++)
3884 /* no slashes; search PATH */
3885 const char *path = getenv ("PATH");
3888 for (p = path; *p; p = p_next)
3892 for (q = p; *q; q++)
3893 if (IS_PATH_SEPARATOR (*q))
3896 p_next = (*q == '\0' ? q : q + 1);
3899 /* empty path: current directory */
3900 if (getcwd (tmp, LT_PATHMAX) == NULL)
3901 lt_fatal (__FILE__, __LINE__, "getcwd failed: %s",
3902 nonnull (strerror (errno)));
3903 tmp_len = strlen (tmp);
3905 XMALLOC (char, tmp_len + 1 + strlen (wrapper) + 1);
3906 memcpy (concat_name, tmp, tmp_len);
3907 concat_name[tmp_len] = '/';
3908 strcpy (concat_name + tmp_len + 1, wrapper);
3913 XMALLOC (char, p_len + 1 + strlen (wrapper) + 1);
3914 memcpy (concat_name, p, p_len);
3915 concat_name[p_len] = '/';
3916 strcpy (concat_name + p_len + 1, wrapper);
3918 if (check_executable (concat_name))
3920 XFREE (concat_name);
3923 /* not found in PATH; assume curdir */
3925 /* Relative path | not found in path: prepend cwd */
3926 if (getcwd (tmp, LT_PATHMAX) == NULL)
3927 lt_fatal (__FILE__, __LINE__, "getcwd failed: %s",
3928 nonnull (strerror (errno)));
3929 tmp_len = strlen (tmp);
3930 concat_name = XMALLOC (char, tmp_len + 1 + strlen (wrapper) + 1);
3931 memcpy (concat_name, tmp, tmp_len);
3932 concat_name[tmp_len] = '/';
3933 strcpy (concat_name + tmp_len + 1, wrapper);
3935 if (check_executable (concat_name))
3937 XFREE (concat_name);
3942 chase_symlinks (const char *pathspec)
3945 return xstrdup (pathspec);
3947 char buf[LT_PATHMAX];
3949 char *tmp_pathspec = xstrdup (pathspec);
3951 int has_symlinks = 0;
3952 while (strlen (tmp_pathspec) && !has_symlinks)
3954 lt_debugprintf (__FILE__, __LINE__,
3955 "checking path component for symlinks: %s\n",
3957 if (lstat (tmp_pathspec, &s) == 0)
3959 if (S_ISLNK (s.st_mode) != 0)
3965 /* search backwards for last DIR_SEPARATOR */
3966 p = tmp_pathspec + strlen (tmp_pathspec) - 1;
3967 while ((p > tmp_pathspec) && (!IS_DIR_SEPARATOR (*p)))
3969 if ((p == tmp_pathspec) && (!IS_DIR_SEPARATOR (*p)))
3971 /* no more DIR_SEPARATORS left */
3978 lt_fatal (__FILE__, __LINE__,
3979 "error accessing file \"%s\": %s",
3980 tmp_pathspec, nonnull (strerror (errno)));
3983 XFREE (tmp_pathspec);
3987 return xstrdup (pathspec);
3990 tmp_pathspec = realpath (pathspec, buf);
3991 if (tmp_pathspec == 0)
3993 lt_fatal (__FILE__, __LINE__,
3994 "could not follow symlinks for %s", pathspec);
3996 return xstrdup (tmp_pathspec);
4001 strendzap (char *str, const char *pat)
4005 assert (str != NULL);
4006 assert (pat != NULL);
4009 patlen = strlen (pat);
4013 str += len - patlen;
4014 if (strcmp (str, pat) == 0)
4021 lt_debugprintf (const char *file, int line, const char *fmt, ...)
4026 (void) fprintf (stderr, "%s:%s:%d: ", program_name, file, line);
4027 va_start (args, fmt);
4028 (void) vfprintf (stderr, fmt, args);
4034 lt_error_core (int exit_status, const char *file,
4035 int line, const char *mode,
4036 const char *message, va_list ap)
4038 fprintf (stderr, "%s:%s:%d: %s: ", program_name, file, line, mode);
4039 vfprintf (stderr, message, ap);
4040 fprintf (stderr, ".\n");
4042 if (exit_status >= 0)
4047 lt_fatal (const char *file, int line, const char *message, ...)
4050 va_start (ap, message);
4051 lt_error_core (EXIT_FAILURE, file, line, "FATAL", message, ap);
4056 nonnull (const char *s)
4058 return s ? s : "(null)";
4062 nonempty (const char *s)
4064 return (s && !*s) ? "(empty)" : nonnull (s);
4068 lt_setenv (const char *name, const char *value)
4070 lt_debugprintf (__FILE__, __LINE__,
4071 "(lt_setenv) setting '%s' to '%s'\n",
4072 nonnull (name), nonnull (value));
4075 /* always make a copy, for consistency with !HAVE_SETENV */
4076 char *str = xstrdup (value);
4077 setenv (name, str, 1);
4079 int len = strlen (name) + 1 + strlen (value) + 1;
4080 char *str = XMALLOC (char, len);
4081 sprintf (str, "%s=%s", name, value);
4082 if (putenv (str) != EXIT_SUCCESS)
4091 lt_extend_str (const char *orig_value, const char *add, int to_end)
4094 if (orig_value && *orig_value)
4096 int orig_value_len = strlen (orig_value);
4097 int add_len = strlen (add);
4098 new_value = XMALLOC (char, add_len + orig_value_len + 1);
4101 strcpy (new_value, orig_value);
4102 strcpy (new_value + orig_value_len, add);
4106 strcpy (new_value, add);
4107 strcpy (new_value + add_len, orig_value);
4112 new_value = xstrdup (add);
4118 lt_update_exe_path (const char *name, const char *value)
4120 lt_debugprintf (__FILE__, __LINE__,
4121 "(lt_update_exe_path) modifying '%s' by prepending '%s'\n",
4122 nonnull (name), nonnull (value));
4124 if (name && *name && value && *value)
4126 char *new_value = lt_extend_str (getenv (name), value, 0);
4127 /* some systems can't cope with a ':'-terminated path #' */
4128 int len = strlen (new_value);
4129 while (((len = strlen (new_value)) > 0) && IS_PATH_SEPARATOR (new_value[len-1]))
4131 new_value[len-1] = '\0';
4133 lt_setenv (name, new_value);
4139 lt_update_lib_path (const char *name, const char *value)
4141 lt_debugprintf (__FILE__, __LINE__,
4142 "(lt_update_lib_path) modifying '%s' by prepending '%s'\n",
4143 nonnull (name), nonnull (value));
4145 if (name && *name && value && *value)
4147 char *new_value = lt_extend_str (getenv (name), value, 0);
4148 lt_setenv (name, new_value);
4158 /* Prepares an argument vector before calling spawn().
4159 Note that spawn() does not by itself call the command interpreter
4160 (getenv ("COMSPEC") != NULL ? getenv ("COMSPEC") :
4161 ({ OSVERSIONINFO v; v.dwOSVersionInfoSize = sizeof(OSVERSIONINFO);
4163 v.dwPlatformId == VER_PLATFORM_WIN32_NT;
4164 }) ? "cmd.exe" : "command.com").
4165 Instead it simply concatenates the arguments, separated by ' ', and calls
4166 CreateProcess(). We must quote the arguments since Win32 CreateProcess()
4167 interprets characters like ' ', '\t', '\\', '"' (but not '<' and '>') in a
4169 - Space and tab are interpreted as delimiters. They are not treated as
4170 delimiters if they are surrounded by double quotes: "...".
4171 - Unescaped double quotes are removed from the input. Their only effect is
4172 that within double quotes, space and tab are treated like normal
4174 - Backslashes not followed by double quotes are not special.
4175 - But 2*n+1 backslashes followed by a double quote become
4176 n backslashes followed by a double quote (n >= 0):
4181 #define SHELL_SPECIAL_CHARS "\"\\ \001\002\003\004\005\006\007\010\011\012\013\014\015\016\017\020\021\022\023\024\025\026\027\030\031\032\033\034\035\036\037"
4182 #define SHELL_SPACE_CHARS " \001\002\003\004\005\006\007\010\011\012\013\014\015\016\017\020\021\022\023\024\025\026\027\030\031\032\033\034\035\036\037"
4184 prepare_spawn (char **argv)
4190 /* Count number of arguments. */
4191 for (argc = 0; argv[argc] != NULL; argc++)
4194 /* Allocate new argument vector. */
4195 new_argv = XMALLOC (char *, argc + 1);
4197 /* Put quoted arguments into the new argument vector. */
4198 for (i = 0; i < argc; i++)
4200 const char *string = argv[i];
4202 if (string[0] == '\0')
4203 new_argv[i] = xstrdup ("\"\"");
4204 else if (strpbrk (string, SHELL_SPECIAL_CHARS) != NULL)
4206 int quote_around = (strpbrk (string, SHELL_SPACE_CHARS) != NULL);
4208 unsigned int backslashes;
4210 char *quoted_string;
4217 for (s = string; *s != '\0'; s++)
4221 length += backslashes + 1;
4229 length += backslashes + 1;
4231 quoted_string = XMALLOC (char, length + 1);
4237 for (s = string; *s != '\0'; s++)
4243 for (j = backslashes + 1; j > 0; j--)
4255 for (j = backslashes; j > 0; j--)
4261 new_argv[i] = quoted_string;
4264 new_argv[i] = (char *) string;
4266 new_argv[argc] = NULL;
4275 void lt_dump_script (FILE* f)
4278 func_emit_wrapper yes |
4280 s/^\(.\{79\}\)\(..*\)/\1\
4285 s/\([^\n]*\).*/ fputs ("\1", f);/p
4292 # end: func_emit_cwrapperexe_src
4294 # func_win32_import_lib_p ARG
4295 # True if ARG is an import lib, as indicated by $file_magic_cmd
4296 func_win32_import_lib_p ()
4299 case `eval $file_magic_cmd \"\$1\" 2>/dev/null | $SED -e 10q` in
4305 # func_mode_link arg...
4310 *-*-cygwin* | *-*-mingw* | *-*-pw32* | *-*-os2* | *-cegcc*)
4311 # It is impossible to link a dll without this setting, and
4312 # we shouldn't force the makefile maintainer to figure out
4313 # which system we are compiling for in order to pass an extra
4314 # flag for every libtool invocation.
4315 # allow_undefined=no
4317 # FIXME: Unfortunately, there are problems with the above when trying
4318 # to make a dll which has undefined symbols, in which case not
4319 # even a static library is built. For now, we need to specify
4320 # -no-undefined on the libtool link line when we can be certain
4321 # that all symbols are satisfied, otherwise we get a static library.
4328 libtool_args=$nonopt
4329 base_compile="$nonopt $@"
4330 compile_command=$nonopt
4331 finalize_command=$nonopt
4344 lib_search_path=`pwd`
4346 new_inherited_linker_flags=
4355 export_symbols_regex=
4363 precious_files_regex=
4364 prefer_static_libs=no
4377 single_module="${wl}-single_module"
4378 func_infer_tag $base_compile
4380 # We need to know -static, to get the right output filenames.
4385 test "$build_libtool_libs" != yes && \
4386 func_fatal_configuration "can not build a shared library"
4390 -all-static | -static | -static-libtool-libs)
4393 if test "$build_libtool_libs" = yes && test -z "$link_static_flag"; then
4394 func_warning "complete static linking is impossible in this configuration"
4396 if test -n "$link_static_flag"; then
4397 dlopen_self=$dlopen_self_static
4399 prefer_static_libs=yes
4402 if test -z "$pic_flag" && test -n "$link_static_flag"; then
4403 dlopen_self=$dlopen_self_static
4405 prefer_static_libs=built
4407 -static-libtool-libs)
4408 if test -z "$pic_flag" && test -n "$link_static_flag"; then
4409 dlopen_self=$dlopen_self_static
4411 prefer_static_libs=yes
4414 build_libtool_libs=no
4421 # See if our shared archives depend on static archives.
4422 test -n "$old_archive_from_new_cmds" && build_old_libs=yes
4424 # Go through the arguments, transforming them on the way.
4425 while test "$#" -gt 0; do
4428 func_quote_for_eval "$arg"
4429 qarg=$func_quote_for_eval_unquoted_result
4430 func_append libtool_args " $func_quote_for_eval_result"
4432 # If the previous option needs an argument, assign it.
4433 if test -n "$prev"; then
4436 func_append compile_command " @OUTPUT@"
4437 func_append finalize_command " @OUTPUT@"
4448 if test "$preload" = no; then
4449 # Add the symbol object into the linking commands.
4450 func_append compile_command " @SYMFILE@"
4451 func_append finalize_command " @SYMFILE@"
4455 *.la | *.lo) ;; # We handle these cases below.
4457 if test "$dlself" = no; then
4465 if test "$prev" = dlprefiles; then
4467 elif test "$prev" = dlfiles && test "$dlopen_self" != yes; then
4477 if test "$prev" = dlfiles; then
4478 func_append dlfiles " $arg"
4480 func_append dlprefiles " $arg"
4488 export_symbols="$arg"
4490 || func_fatal_error "symbol file \`$arg' does not exist"
4495 export_symbols_regex="$arg"
4503 *" $qarg.ltframework "*) ;;
4504 *) func_append deplibs " $qarg.ltframework" # this is fixed later
4513 inst_prefix_dir="$arg"
4518 if test -f "$arg"; then
4521 for fil in `cat "$save_arg"`
4523 # func_append moreargs " $fil"
4525 # A libtool-controlled object.
4527 # Check to see that this really is a libtool object.
4528 if func_lalib_unsafe_p "$arg"; then
4535 if test -z "$pic_object" ||
4536 test -z "$non_pic_object" ||
4537 test "$pic_object" = none &&
4538 test "$non_pic_object" = none; then
4539 func_fatal_error "cannot find name of object for \`$arg'"
4542 # Extract subdirectory from the argument.
4543 func_dirname "$arg" "/" ""
4544 xdir="$func_dirname_result"
4546 if test "$pic_object" != none; then
4547 # Prepend the subdirectory the object is found in.
4548 pic_object="$xdir$pic_object"
4550 if test "$prev" = dlfiles; then
4551 if test "$build_libtool_libs" = yes && test "$dlopen_support" = yes; then
4552 func_append dlfiles " $pic_object"
4556 # If libtool objects are unsupported, then we need to preload.
4561 # CHECK ME: I think I busted this. -Ossama
4562 if test "$prev" = dlprefiles; then
4563 # Preload the old-style object.
4564 func_append dlprefiles " $pic_object"
4569 func_append libobjs " $pic_object"
4574 if test "$non_pic_object" != none; then
4575 # Prepend the subdirectory the object is found in.
4576 non_pic_object="$xdir$non_pic_object"
4578 # A standard non-PIC object
4579 func_append non_pic_objects " $non_pic_object"
4580 if test -z "$pic_object" || test "$pic_object" = none ; then
4581 arg="$non_pic_object"
4584 # If the PIC object exists, use it instead.
4585 # $xdir was prepended to $pic_object above.
4586 non_pic_object="$pic_object"
4587 func_append non_pic_objects " $non_pic_object"
4590 # Only an error if not doing a dry-run.
4591 if $opt_dry_run; then
4592 # Extract subdirectory from the argument.
4593 func_dirname "$arg" "/" ""
4594 xdir="$func_dirname_result"
4597 pic_object=$xdir$objdir/$func_lo2o_result
4598 non_pic_object=$xdir$func_lo2o_result
4599 func_append libobjs " $pic_object"
4600 func_append non_pic_objects " $non_pic_object"
4602 func_fatal_error "\`$arg' is not a valid libtool object"
4607 func_fatal_error "link input file \`$arg' does not exist"
4614 precious_files_regex="$arg"
4624 # We need an absolute path.
4626 [\\/]* | [A-Za-z]:[\\/]*) ;;
4628 func_fatal_error "only absolute run-paths are allowed"
4631 if test "$prev" = rpath; then
4634 *) func_append rpath " $arg" ;;
4639 *) func_append xrpath " $arg" ;;
4651 func_append weak_libs " $arg"
4656 func_append linker_flags " $qarg"
4657 func_append compiler_flags " $qarg"
4659 func_append compile_command " $qarg"
4660 func_append finalize_command " $qarg"
4664 func_append compiler_flags " $qarg"
4666 func_append compile_command " $qarg"
4667 func_append finalize_command " $qarg"
4671 func_append linker_flags " $qarg"
4672 func_append compiler_flags " $wl$qarg"
4674 func_append compile_command " $wl$qarg"
4675 func_append finalize_command " $wl$qarg"
4679 eval "$prev=\"\$arg\""
4684 fi # test -n "$prev"
4690 if test -n "$link_static_flag"; then
4691 # See comment for -static flag below, for more details.
4692 func_append compile_command " $link_static_flag"
4693 func_append finalize_command " $link_static_flag"
4699 # FIXME: remove this flag sometime in the future.
4700 func_fatal_error "\`-allow-undefined' must not be used because it is the default"
4728 -export-symbols | -export-symbols-regex)
4729 if test -n "$export_symbols" || test -n "$export_symbols_regex"; then
4730 func_fatal_error "more than one -exported-symbols argument is not allowed"
4732 if test "X$arg" = "X-export-symbols"; then
4750 # The native IRIX linker understands -LANG:*, -LIST:* and -LNO:*
4751 # so, if we see these flags be careful not to treat them like -L
4753 case $with_gcc/$host in
4754 no/*-*-irix* | /*-*-irix*)
4755 func_append compile_command " $arg"
4756 func_append finalize_command " $arg"
4763 func_stripname "-L" '' "$arg"
4764 if test -z "$func_stripname_result"; then
4765 if test "$#" -gt 0; then
4766 func_fatal_error "require no space between \`-L' and \`$1'"
4768 func_fatal_error "need path for \`-L' option"
4771 func_resolve_sysroot "$func_stripname_result"
4772 dir=$func_resolve_sysroot_result
4773 # We need an absolute path.
4775 [\\/]* | [A-Za-z]:[\\/]*) ;;
4777 absdir=`cd "$dir" && pwd`
4778 test -z "$absdir" && \
4779 func_fatal_error "cannot determine absolute directory name of \`$dir'"
4784 *" -L$dir "* | *" $arg "*)
4785 # Will only happen for absolute or sysroot arguments
4788 # Preserve sysroot, but never include relative directories
4790 [\\/]* | [A-Za-z]:[\\/]* | =*) func_append deplibs " $arg" ;;
4791 *) func_append deplibs " -L$dir" ;;
4793 func_append lib_search_path " $dir"
4797 *-*-cygwin* | *-*-mingw* | *-*-pw32* | *-*-os2* | *-cegcc*)
4798 testbindir=`$ECHO "$dir" | $SED 's*/lib$*/bin*'`
4799 case :$dllsearchpath: in
4801 ::) dllsearchpath=$dir;;
4802 *) func_append dllsearchpath ":$dir";;
4804 case :$dllsearchpath: in
4805 *":$testbindir:"*) ;;
4806 ::) dllsearchpath=$testbindir;;
4807 *) func_append dllsearchpath ":$testbindir";;
4815 if test "X$arg" = "X-lc" || test "X$arg" = "X-lm"; then
4817 *-*-cygwin* | *-*-mingw* | *-*-pw32* | *-*-beos* | *-cegcc* | *-*-haiku*)
4818 # These systems don't actually have a C or math library (as such)
4822 # These systems don't actually have a C library (as such)
4823 test "X$arg" = "X-lc" && continue
4825 *-*-openbsd* | *-*-freebsd* | *-*-dragonfly*)
4826 # Do not include libc due to us having libc/libc_r.
4827 test "X$arg" = "X-lc" && continue
4829 *-*-rhapsody* | *-*-darwin1.[012])
4830 # Rhapsody C and math libraries are in the System framework
4831 func_append deplibs " System.ltframework"
4834 *-*-sco3.2v5* | *-*-sco5v6*)
4835 # Causes problems with __ctype
4836 test "X$arg" = "X-lc" && continue
4838 *-*-sysv4.2uw2* | *-*-sysv5* | *-*-unixware* | *-*-OpenUNIX*)
4839 # Compiler inserts libc in the correct place for threads to work
4840 test "X$arg" = "X-lc" && continue
4843 elif test "X$arg" = "X-lc_r"; then
4845 *-*-openbsd* | *-*-freebsd* | *-*-dragonfly*)
4846 # Do not include libc_r directly, use -pthread flag.
4851 func_append deplibs " $arg"
4860 # Tru64 UNIX uses -model [arg] to determine the layout of C++
4861 # classes, name mangling, and exception handling.
4862 # Darwin uses the -arch flag to determine output architecture.
4863 -model|-arch|-isysroot|--sysroot)
4864 func_append compiler_flags " $arg"
4865 func_append compile_command " $arg"
4866 func_append finalize_command " $arg"
4871 -mt|-mthreads|-kthread|-Kthread|-pthread|-pthreads|--thread-safe \
4872 |-threads|-fopenmp|-openmp|-mp|-xopenmp|-omp|-qsmp=*)
4873 func_append compiler_flags " $arg"
4874 func_append compile_command " $arg"
4875 func_append finalize_command " $arg"
4876 case "$new_inherited_linker_flags " in
4878 * ) func_append new_inherited_linker_flags " $arg" ;;
4884 single_module="${wl}-multi_module"
4895 *-*-cygwin* | *-*-mingw* | *-*-pw32* | *-*-os2* | *-*-darwin* | *-cegcc*)
4896 # The PATH hackery in wrapper scripts is required on Windows
4897 # and Darwin in order for the loader to find any dlls it needs.
4898 func_warning "\`-no-install' is ignored for $host"
4899 func_warning "assuming \`-no-fast-install' instead"
4902 *) no_install=yes ;;
4919 -precious-files-regex)
4940 func_stripname '-R' '' "$arg"
4941 dir=$func_stripname_result
4942 # We need an absolute path.
4944 [\\/]* | [A-Za-z]:[\\/]*) ;;
4946 func_stripname '=' '' "$dir"
4947 dir=$lt_sysroot$func_stripname_result
4950 func_fatal_error "only absolute run-paths are allowed"
4955 *) func_append xrpath " $dir" ;;
4961 # The effects of -shared are defined in a previous loop.
4970 -static | -static-libtool-libs)
4971 # The effects of -static are defined in a previous loop.
4972 # We used to do the same as -all-static on platforms that
4973 # didn't have a PIC flag, but the assumption that the effects
4974 # would be equivalent was wrong. It would break on at least
4975 # Digital Unix and AIX.
5001 func_stripname '-Wc,' '' "$arg"
5002 args=$func_stripname_result
5004 save_ifs="$IFS"; IFS=','
5005 for flag in $args; do
5007 func_quote_for_eval "$flag"
5008 func_append arg " $func_quote_for_eval_result"
5009 func_append compiler_flags " $func_quote_for_eval_result"
5012 func_stripname ' ' '' "$arg"
5013 arg=$func_stripname_result
5017 func_stripname '-Wl,' '' "$arg"
5018 args=$func_stripname_result
5020 save_ifs="$IFS"; IFS=','
5021 for flag in $args; do
5023 func_quote_for_eval "$flag"
5024 func_append arg " $wl$func_quote_for_eval_result"
5025 func_append compiler_flags " $wl$func_quote_for_eval_result"
5026 func_append linker_flags " $func_quote_for_eval_result"
5029 func_stripname ' ' '' "$arg"
5030 arg=$func_stripname_result
5050 func_quote_for_eval "$arg"
5051 arg="$func_quote_for_eval_result"
5054 # Flags to be passed through unchanged, with rationale:
5055 # -64, -mips[0-9] enable 64-bit mode for the SGI compiler
5056 # -r[0-9][0-9]* specify processor for the SGI compiler
5057 # -xarch=*, -xtarget=* enable 64-bit mode for the Sun compiler
5058 # +DA*, +DD* enable 64-bit mode for the HP compiler
5059 # -q* compiler args for the IBM compiler
5060 # -m*, -t[45]*, -txscale* architecture-specific flags for GCC
5061 # -F/path path to uninstalled frameworks, gcc on darwin
5062 # -p, -pg, --coverage, -fprofile-* profiling flags for GCC
5063 # @file GCC response files
5064 # -tp=* Portland pgcc target processor selection
5065 # --sysroot=* for sysroot support
5066 # -O*, -flto*, -fwhopr*, -fuse-linker-plugin GCC link-time optimization
5067 -64|-mips[0-9]|-r[0-9][0-9]*|-xarch=*|-xtarget=*|+DA*|+DD*|-q*|-m*| \
5068 -t[45]*|-txscale*|-p|-pg|--coverage|-fprofile-*|-F*|@*|-tp=*|--sysroot=*| \
5069 -O*|-flto*|-fwhopr*|-fuse-linker-plugin)
5070 func_quote_for_eval "$arg"
5071 arg="$func_quote_for_eval_result"
5072 func_append compile_command " $arg"
5073 func_append finalize_command " $arg"
5074 func_append compiler_flags " $arg"
5078 # Some other compiler flag.
5080 func_quote_for_eval "$arg"
5081 arg="$func_quote_for_eval_result"
5085 # A standard object.
5086 func_append objs " $arg"
5090 # A libtool-controlled object.
5092 # Check to see that this really is a libtool object.
5093 if func_lalib_unsafe_p "$arg"; then
5100 if test -z "$pic_object" ||
5101 test -z "$non_pic_object" ||
5102 test "$pic_object" = none &&
5103 test "$non_pic_object" = none; then
5104 func_fatal_error "cannot find name of object for \`$arg'"
5107 # Extract subdirectory from the argument.
5108 func_dirname "$arg" "/" ""
5109 xdir="$func_dirname_result"
5111 if test "$pic_object" != none; then
5112 # Prepend the subdirectory the object is found in.
5113 pic_object="$xdir$pic_object"
5115 if test "$prev" = dlfiles; then
5116 if test "$build_libtool_libs" = yes && test "$dlopen_support" = yes; then
5117 func_append dlfiles " $pic_object"
5121 # If libtool objects are unsupported, then we need to preload.
5126 # CHECK ME: I think I busted this. -Ossama
5127 if test "$prev" = dlprefiles; then
5128 # Preload the old-style object.
5129 func_append dlprefiles " $pic_object"
5134 func_append libobjs " $pic_object"
5139 if test "$non_pic_object" != none; then
5140 # Prepend the subdirectory the object is found in.
5141 non_pic_object="$xdir$non_pic_object"
5143 # A standard non-PIC object
5144 func_append non_pic_objects " $non_pic_object"
5145 if test -z "$pic_object" || test "$pic_object" = none ; then
5146 arg="$non_pic_object"
5149 # If the PIC object exists, use it instead.
5150 # $xdir was prepended to $pic_object above.
5151 non_pic_object="$pic_object"
5152 func_append non_pic_objects " $non_pic_object"
5155 # Only an error if not doing a dry-run.
5156 if $opt_dry_run; then
5157 # Extract subdirectory from the argument.
5158 func_dirname "$arg" "/" ""
5159 xdir="$func_dirname_result"
5162 pic_object=$xdir$objdir/$func_lo2o_result
5163 non_pic_object=$xdir$func_lo2o_result
5164 func_append libobjs " $pic_object"
5165 func_append non_pic_objects " $non_pic_object"
5167 func_fatal_error "\`$arg' is not a valid libtool object"
5174 func_append deplibs " $arg"
5175 func_append old_deplibs " $arg"
5180 # A libtool-controlled library.
5182 func_resolve_sysroot "$arg"
5183 if test "$prev" = dlfiles; then
5184 # This library was specified with -dlopen.
5185 func_append dlfiles " $func_resolve_sysroot_result"
5187 elif test "$prev" = dlprefiles; then
5188 # The library was specified with -dlpreopen.
5189 func_append dlprefiles " $func_resolve_sysroot_result"
5192 func_append deplibs " $func_resolve_sysroot_result"
5197 # Some other compiler argument.
5199 # Unknown arguments in both finalize_command and compile_command need
5200 # to be aesthetically quoted because they are evaled later.
5201 func_quote_for_eval "$arg"
5202 arg="$func_quote_for_eval_result"
5206 # Now actually substitute the argument into the commands.
5207 if test -n "$arg"; then
5208 func_append compile_command " $arg"
5209 func_append finalize_command " $arg"
5211 done # argument parsing loop
5213 test -n "$prev" && \
5214 func_fatal_help "the \`$prevarg' option requires an argument"
5216 if test "$export_dynamic" = yes && test -n "$export_dynamic_flag_spec"; then
5217 eval arg=\"$export_dynamic_flag_spec\"
5218 func_append compile_command " $arg"
5219 func_append finalize_command " $arg"
5223 # calculate the name of the file, without its directory
5224 func_basename "$output"
5225 outputname="$func_basename_result"
5226 libobjs_save="$libobjs"
5228 if test -n "$shlibpath_var"; then
5229 # get the directories listed in $shlibpath_var
5230 eval shlib_search_path=\`\$ECHO \"\${$shlibpath_var}\" \| \$SED \'s/:/ /g\'\`
5234 eval sys_lib_search_path=\"$sys_lib_search_path_spec\"
5235 eval sys_lib_dlsearch_path=\"$sys_lib_dlsearch_path_spec\"
5237 func_dirname "$output" "/" ""
5238 output_objdir="$func_dirname_result$objdir"
5239 func_to_tool_file "$output_objdir/"
5240 tool_output_objdir=$func_to_tool_file_result
5241 # Create the object directory.
5242 func_mkdir_p "$output_objdir"
5244 # Determine the type of output
5247 func_fatal_help "you must specify an output file"
5249 *.$libext) linkmode=oldlib ;;
5250 *.lo | *.$objext) linkmode=obj ;;
5251 *.la) linkmode=lib ;;
5252 *) linkmode=prog ;; # Anything else should be a program.
5258 # Find all interdependent deplibs by searching for libraries
5259 # that are linked more than once (e.g. -la -lb -la)
5260 for deplib in $deplibs; do
5261 if $opt_preserve_dup_deps ; then
5263 *" $deplib "*) func_append specialdeplibs " $deplib" ;;
5266 func_append libs " $deplib"
5269 if test "$linkmode" = lib; then
5270 libs="$predeps $libs $compiler_lib_search_path $postdeps"
5272 # Compute libraries that are listed more than once in $predeps
5273 # $postdeps and mark them as special (i.e., whose duplicates are
5274 # not to be eliminated).
5276 if $opt_duplicate_compiler_generated_deps; then
5277 for pre_post_dep in $predeps $postdeps; do
5278 case "$pre_post_deps " in
5279 *" $pre_post_dep "*) func_append specialdeplibs " $pre_post_deps" ;;
5281 func_append pre_post_deps " $pre_post_dep"
5290 need_relink=no # whether we're linking any uninstalled libtool libraries
5291 notinst_deplibs= # not-installed libtool libraries
5292 notinst_path= # paths that contain not-installed libtool libraries
5296 passes="conv dlpreopen link"
5297 for file in $dlfiles $dlprefiles; do
5301 func_fatal_help "libraries can \`-dlopen' only libtool libraries: $file"
5312 passes="conv scan dlopen dlpreopen link"
5318 for pass in $passes; do
5319 # The preopen pass in lib mode reverses $deplibs; put it back here
5320 # so that -L comes before libs that need it for instance...
5321 if test "$linkmode,$pass" = "lib,link"; then
5322 ## FIXME: Find the place where the list is rebuilt in the wrong
5323 ## order, and fix it there properly
5325 for deplib in $deplibs; do
5326 tmp_deplibs="$deplib $tmp_deplibs"
5328 deplibs="$tmp_deplibs"
5331 if test "$linkmode,$pass" = "lib,link" ||
5332 test "$linkmode,$pass" = "prog,scan"; then
5336 if test "$linkmode" = prog; then
5338 dlopen) libs="$dlfiles" ;;
5339 dlpreopen) libs="$dlprefiles" ;;
5340 link) libs="$deplibs %DEPLIBS% $dependency_libs" ;;
5343 if test "$linkmode,$pass" = "lib,dlpreopen"; then
5344 # Collect and forward deplibs of preopened libtool libs
5345 for lib in $dlprefiles; do
5346 # Ignore non-libtool-libs
5348 func_resolve_sysroot "$lib"
5350 *.la) func_source "$func_resolve_sysroot_result" ;;
5353 # Collect preopened libtool deplibs, except any this library
5354 # has declared as weak libs
5355 for deplib in $dependency_libs; do
5356 func_basename "$deplib"
5357 deplib_base=$func_basename_result
5358 case " $weak_libs " in
5359 *" $deplib_base "*) ;;
5360 *) func_append deplibs " $deplib" ;;
5366 if test "$pass" = dlopen; then
5367 # Collect dlpreopened libraries
5368 save_deplibs="$deplibs"
5372 for deplib in $libs; do
5376 -mt|-mthreads|-kthread|-Kthread|-pthread|-pthreads|--thread-safe \
5377 |-threads|-fopenmp|-openmp|-mp|-xopenmp|-omp|-qsmp=*)
5378 if test "$linkmode,$pass" = "prog,link"; then
5379 compile_deplibs="$deplib $compile_deplibs"
5380 finalize_deplibs="$deplib $finalize_deplibs"
5382 func_append compiler_flags " $deplib"
5383 if test "$linkmode" = lib ; then
5384 case "$new_inherited_linker_flags " in
5386 * ) func_append new_inherited_linker_flags " $deplib" ;;
5393 if test "$linkmode" != lib && test "$linkmode" != prog; then
5394 func_warning "\`-l' is ignored for archives/objects"
5397 func_stripname '-l' '' "$deplib"
5398 name=$func_stripname_result
5399 if test "$linkmode" = lib; then
5400 searchdirs="$newlib_search_path $lib_search_path $compiler_lib_search_dirs $sys_lib_search_path $shlib_search_path"
5402 searchdirs="$newlib_search_path $lib_search_path $sys_lib_search_path $shlib_search_path"
5404 for searchdir in $searchdirs; do
5405 for search_ext in .la $std_shrext .so .a; do
5406 # Search the libtool library
5407 lib="$searchdir/lib${name}${search_ext}"
5408 if test -f "$lib"; then
5409 if test "$search_ext" = ".la"; then
5418 if test "$found" != yes; then
5419 # deplib doesn't seem to be a libtool library
5420 if test "$linkmode,$pass" = "prog,link"; then
5421 compile_deplibs="$deplib $compile_deplibs"
5422 finalize_deplibs="$deplib $finalize_deplibs"
5424 deplibs="$deplib $deplibs"
5425 test "$linkmode" = lib && newdependency_libs="$deplib $newdependency_libs"
5428 else # deplib is a libtool library
5429 # If $allow_libtool_libs_with_static_runtimes && $deplib is a stdlib,
5430 # We need to do some special things here, and not later.
5431 if test "X$allow_libtool_libs_with_static_runtimes" = "Xyes" ; then
5432 case " $predeps $postdeps " in
5434 if func_lalib_p "$lib"; then
5438 for l in $old_library $library_names; do
5441 if test "X$ll" = "X$old_library" ; then # only static version available
5443 func_dirname "$lib" "" "."
5444 ladir="$func_dirname_result"
5445 lib=$ladir/$old_library
5446 if test "$linkmode,$pass" = "prog,link"; then
5447 compile_deplibs="$deplib $compile_deplibs"
5448 finalize_deplibs="$deplib $finalize_deplibs"
5450 deplibs="$deplib $deplibs"
5451 test "$linkmode" = lib && newdependency_libs="$deplib $newdependency_libs"
5463 if test "$linkmode,$pass" = "prog,link"; then
5464 compile_deplibs="$deplib $compile_deplibs"
5465 finalize_deplibs="$deplib $finalize_deplibs"
5467 deplibs="$deplib $deplibs"
5468 if test "$linkmode" = lib ; then
5469 case "$new_inherited_linker_flags " in
5471 * ) func_append new_inherited_linker_flags " $deplib" ;;
5480 deplibs="$deplib $deplibs"
5481 test "$pass" = conv && continue
5482 newdependency_libs="$deplib $newdependency_libs"
5483 func_stripname '-L' '' "$deplib"
5484 func_resolve_sysroot "$func_stripname_result"
5485 func_append newlib_search_path " $func_resolve_sysroot_result"
5488 if test "$pass" = conv; then
5489 deplibs="$deplib $deplibs"
5492 if test "$pass" = scan; then
5493 deplibs="$deplib $deplibs"
5495 compile_deplibs="$deplib $compile_deplibs"
5496 finalize_deplibs="$deplib $finalize_deplibs"
5498 func_stripname '-L' '' "$deplib"
5499 func_resolve_sysroot "$func_stripname_result"
5500 func_append newlib_search_path " $func_resolve_sysroot_result"
5503 func_warning "\`-L' is ignored for archives/objects"
5509 if test "$pass" = link; then
5510 func_stripname '-R' '' "$deplib"
5511 func_resolve_sysroot "$func_stripname_result"
5512 dir=$func_resolve_sysroot_result
5513 # Make sure the xrpath contains only unique directories.
5516 *) func_append xrpath " $dir" ;;
5519 deplibs="$deplib $deplibs"
5523 func_resolve_sysroot "$deplib"
5524 lib=$func_resolve_sysroot_result
5527 if test "$pass" = conv; then
5528 deplibs="$deplib $deplibs"
5533 # Linking convenience modules into shared libraries is allowed,
5534 # but linking other static libraries is non-portable.
5535 case " $dlpreconveniencelibs " in
5539 case $deplibs_check_method in
5541 set dummy $deplibs_check_method; shift
5542 match_pattern_regex=`expr "$deplibs_check_method" : "$1 \(.*\)"`
5543 if eval "\$ECHO \"$deplib\"" 2>/dev/null | $SED 10q \
5544 | $EGREP "$match_pattern_regex" > /dev/null; then
5552 if test "$valid_a_lib" != yes; then
5554 $ECHO "*** Warning: Trying to link with static lib archive $deplib."
5555 echo "*** I have the capability to make that library automatically link in when"
5556 echo "*** you link to this library. But I can only do this if you have a"
5557 echo "*** shared version of the library, which you do not appear to have"
5558 echo "*** because the file extensions .$libext of this argument makes me believe"
5559 echo "*** that it is just a static archive that I should not use here."
5562 $ECHO "*** Warning: Linking the shared library $output against the"
5563 $ECHO "*** static library $deplib is not portable!"
5564 deplibs="$deplib $deplibs"
5571 if test "$pass" != link; then
5572 deplibs="$deplib $deplibs"
5574 compile_deplibs="$deplib $compile_deplibs"
5575 finalize_deplibs="$deplib $finalize_deplibs"
5582 if test "$pass" = conv; then
5583 deplibs="$deplib $deplibs"
5584 elif test "$linkmode" = prog; then
5585 if test "$pass" = dlpreopen || test "$dlopen_support" != yes || test "$build_libtool_libs" = no; then
5586 # If there is no dlopen support or we're linking statically,
5587 # we need to preload.
5588 func_append newdlprefiles " $deplib"
5589 compile_deplibs="$deplib $compile_deplibs"
5590 finalize_deplibs="$deplib $finalize_deplibs"
5592 func_append newdlfiles " $deplib"
5603 if test "$found" = yes || test -f "$lib"; then :
5605 func_fatal_error "cannot find the library \`$lib' or unhandled argument \`$deplib'"
5608 # Check to see that this really is a libtool archive.
5609 func_lalib_unsafe_p "$lib" \
5610 || func_fatal_error "\`$lib' is not a valid libtool archive"
5612 func_dirname "$lib" "" "."
5613 ladir="$func_dirname_result"
5621 inherited_linker_flags=
5622 # If the library was installed with an old release of libtool,
5623 # it will not redefine variables installed, or shouldnotlink
5632 # Convert "-framework foo" to "foo.ltframework"
5633 if test -n "$inherited_linker_flags"; then
5634 tmp_inherited_linker_flags=`$ECHO "$inherited_linker_flags" | $SED 's/-framework \([^ $]*\)/\1.ltframework/g'`
5635 for tmp_inherited_linker_flag in $tmp_inherited_linker_flags; do
5636 case " $new_inherited_linker_flags " in
5637 *" $tmp_inherited_linker_flag "*) ;;
5638 *) func_append new_inherited_linker_flags " $tmp_inherited_linker_flag";;
5642 dependency_libs=`$ECHO " $dependency_libs" | $SED 's% \([^ $]*\).ltframework% -framework \1%g'`
5643 if test "$linkmode,$pass" = "lib,link" ||
5644 test "$linkmode,$pass" = "prog,scan" ||
5645 { test "$linkmode" != prog && test "$linkmode" != lib; }; then
5646 test -n "$dlopen" && func_append dlfiles " $dlopen"
5647 test -n "$dlpreopen" && func_append dlprefiles " $dlpreopen"
5650 if test "$pass" = conv; then
5651 # Only check for convenience libraries
5652 deplibs="$lib $deplibs"
5653 if test -z "$libdir"; then
5654 if test -z "$old_library"; then
5655 func_fatal_error "cannot find name of link library for \`$lib'"
5657 # It is a libtool convenience library, so add in its objects.
5658 func_append convenience " $ladir/$objdir/$old_library"
5659 func_append old_convenience " $ladir/$objdir/$old_library"
5660 elif test "$linkmode" != prog && test "$linkmode" != lib; then
5661 func_fatal_error "\`$lib' is not a convenience library"
5664 for deplib in $dependency_libs; do
5665 deplibs="$deplib $deplibs"
5666 if $opt_preserve_dup_deps ; then
5667 case "$tmp_libs " in
5668 *" $deplib "*) func_append specialdeplibs " $deplib" ;;
5671 func_append tmp_libs " $deplib"
5677 # Get the name of the library we link against.
5679 if test -n "$old_library" &&
5680 { test "$prefer_static_libs" = yes ||
5681 test "$prefer_static_libs,$installed" = "built,no"; }; then
5682 linklib=$old_library
5684 for l in $old_library $library_names; do
5688 if test -z "$linklib"; then
5689 func_fatal_error "cannot find name of link library for \`$lib'"
5692 # This library was specified with -dlopen.
5693 if test "$pass" = dlopen; then
5694 if test -z "$libdir"; then
5695 func_fatal_error "cannot -dlopen a convenience library: \`$lib'"
5697 if test -z "$dlname" ||
5698 test "$dlopen_support" != yes ||
5699 test "$build_libtool_libs" = no; then
5700 # If there is no dlname, no dlopen support or we're linking
5701 # statically, we need to preload. We also need to preload any
5702 # dependent libraries so libltdl's deplib preloader doesn't
5703 # bomb out in the load deplibs phase.
5704 func_append dlprefiles " $lib $dependency_libs"
5706 func_append newdlfiles " $lib"
5711 # We need an absolute path.
5713 [\\/]* | [A-Za-z]:[\\/]*) abs_ladir="$ladir" ;;
5715 abs_ladir=`cd "$ladir" && pwd`
5716 if test -z "$abs_ladir"; then
5717 func_warning "cannot determine absolute directory name of \`$ladir'"
5718 func_warning "passing it literally to the linker, although it might fail"
5723 func_basename "$lib"
5724 laname="$func_basename_result"
5726 # Find the relevant object directory and library name.
5727 if test "X$installed" = Xyes; then
5728 if test ! -f "$lt_sysroot$libdir/$linklib" && test -f "$abs_ladir/$linklib"; then
5729 func_warning "library \`$lib' was moved."
5734 dir="$lt_sysroot$libdir"
5735 absdir="$lt_sysroot$libdir"
5737 test "X$hardcode_automatic" = Xyes && avoidtemprpath=yes
5739 if test ! -f "$ladir/$objdir/$linklib" && test -f "$abs_ladir/$linklib"; then
5742 # Remove this search path later
5743 func_append notinst_path " $abs_ladir"
5745 dir="$ladir/$objdir"
5746 absdir="$abs_ladir/$objdir"
5747 # Remove this search path later
5748 func_append notinst_path " $abs_ladir"
5750 fi # $installed = yes
5751 func_stripname 'lib' '.la' "$laname"
5752 name=$func_stripname_result
5754 # This library was specified with -dlpreopen.
5755 if test "$pass" = dlpreopen; then
5756 if test -z "$libdir" && test "$linkmode" = prog; then
5757 func_fatal_error "only libraries may -dlpreopen a convenience library: \`$lib'"
5760 # special handling for platforms with PE-DLLs.
5761 *cygwin* | *mingw* | *cegcc* )
5762 # Linker will automatically link against shared library if both
5763 # static and shared are present. Therefore, ensure we extract
5764 # symbols from the import library if a shared library is present
5765 # (otherwise, the dlopen module name will be incorrect). We do
5766 # this by putting the import library name into $newdlprefiles.
5767 # We recover the dlopen module name by 'saving' the la file
5768 # name in a special purpose variable, and (later) extracting the
5769 # dlname from the la file.
5770 if test -n "$dlname"; then
5771 func_tr_sh "$dir/$linklib"
5772 eval "libfile_$func_tr_sh_result=\$abs_ladir/\$laname"
5773 func_append newdlprefiles " $dir/$linklib"
5775 func_append newdlprefiles " $dir/$old_library"
5776 # Keep a list of preopened convenience libraries to check
5777 # that they are being used correctly in the link pass.
5778 test -z "$libdir" && \
5779 func_append dlpreconveniencelibs " $dir/$old_library"
5783 # Prefer using a static library (so that no silly _DYNAMIC symbols
5784 # are required to link).
5785 if test -n "$old_library"; then
5786 func_append newdlprefiles " $dir/$old_library"
5787 # Keep a list of preopened convenience libraries to check
5788 # that they are being used correctly in the link pass.
5789 test -z "$libdir" && \
5790 func_append dlpreconveniencelibs " $dir/$old_library"
5791 # Otherwise, use the dlname, so that lt_dlopen finds it.
5792 elif test -n "$dlname"; then
5793 func_append newdlprefiles " $dir/$dlname"
5795 func_append newdlprefiles " $dir/$linklib"
5799 fi # $pass = dlpreopen
5801 if test -z "$libdir"; then
5802 # Link the convenience library
5803 if test "$linkmode" = lib; then
5804 deplibs="$dir/$old_library $deplibs"
5805 elif test "$linkmode,$pass" = "prog,link"; then
5806 compile_deplibs="$dir/$old_library $compile_deplibs"
5807 finalize_deplibs="$dir/$old_library $finalize_deplibs"
5809 deplibs="$lib $deplibs" # used for prog,scan pass
5815 if test "$linkmode" = prog && test "$pass" != link; then
5816 func_append newlib_search_path " $ladir"
5817 deplibs="$lib $deplibs"
5820 if test "$link_all_deplibs" != no || test -z "$library_names" ||
5821 test "$build_libtool_libs" = no; then
5826 for deplib in $dependency_libs; do
5828 -L*) func_stripname '-L' '' "$deplib"
5829 func_resolve_sysroot "$func_stripname_result"
5830 func_append newlib_search_path " $func_resolve_sysroot_result"
5833 # Need to link against all dependency_libs?
5834 if test "$linkalldeplibs" = yes; then
5835 deplibs="$deplib $deplibs"
5837 # Need to hardcode shared library paths
5838 # or/and link against static libraries
5839 newdependency_libs="$deplib $newdependency_libs"
5841 if $opt_preserve_dup_deps ; then
5842 case "$tmp_libs " in
5843 *" $deplib "*) func_append specialdeplibs " $deplib" ;;
5846 func_append tmp_libs " $deplib"
5849 fi # $linkmode = prog...
5851 if test "$linkmode,$pass" = "prog,link"; then
5852 if test -n "$library_names" &&
5853 { { test "$prefer_static_libs" = no ||
5854 test "$prefer_static_libs,$installed" = "built,yes"; } ||
5855 test -z "$old_library"; }; then
5856 # We need to hardcode the library path
5857 if test -n "$shlibpath_var" && test -z "$avoidtemprpath" ; then
5858 # Make sure the rpath contains only unique directories.
5859 case "$temp_rpath:" in
5861 *) func_append temp_rpath "$absdir:" ;;
5865 # Hardcode the library path.
5866 # Skip directories that are in the system default run-time
5868 case " $sys_lib_dlsearch_path " in
5871 case "$compile_rpath " in
5873 *) func_append compile_rpath " $absdir" ;;
5877 case " $sys_lib_dlsearch_path " in
5880 case "$finalize_rpath " in
5882 *) func_append finalize_rpath " $libdir" ;;
5886 fi # $linkmode,$pass = prog,link...
5888 if test "$alldeplibs" = yes &&
5889 { test "$deplibs_check_method" = pass_all ||
5890 { test "$build_libtool_libs" = yes &&
5891 test -n "$library_names"; }; }; then
5892 # We only need to search for static libraries
5897 link_static=no # Whether the deplib will be linked statically
5898 use_static_libs=$prefer_static_libs
5899 if test "$use_static_libs" = built && test "$installed" = yes; then
5902 if test -n "$library_names" &&
5903 { test "$use_static_libs" = no || test -z "$old_library"; }; then
5905 *cygwin* | *mingw* | *cegcc*)
5906 # No point in relinking DLLs because paths are not encoded
5907 func_append notinst_deplibs " $lib"
5911 if test "$installed" = no; then
5912 func_append notinst_deplibs " $lib"
5917 # This is a shared library
5919 # Warn about portability, can't link against -module's on some
5920 # systems (darwin). Don't bleat about dlopened modules though!
5922 for dlpremoduletest in $dlprefiles; do
5923 if test "X$dlpremoduletest" = "X$lib"; then
5924 dlopenmodule="$dlpremoduletest"
5928 if test -z "$dlopenmodule" && test "$shouldnotlink" = yes && test "$pass" = link; then
5930 if test "$linkmode" = prog; then
5931 $ECHO "*** Warning: Linking the executable $output against the loadable module"
5933 $ECHO "*** Warning: Linking the shared library $output against the loadable module"
5935 $ECHO "*** $linklib is not portable!"
5937 if test "$linkmode" = lib &&
5938 test "$hardcode_into_libs" = yes; then
5939 # Hardcode the library path.
5940 # Skip directories that are in the system default run-time
5942 case " $sys_lib_dlsearch_path " in
5945 case "$compile_rpath " in
5947 *) func_append compile_rpath " $absdir" ;;
5951 case " $sys_lib_dlsearch_path " in
5954 case "$finalize_rpath " in
5956 *) func_append finalize_rpath " $libdir" ;;
5962 if test -n "$old_archive_from_expsyms_cmds"; then
5963 # figure out the soname
5964 set dummy $library_names
5968 libname=`eval "\\$ECHO \"$libname_spec\""`
5969 # use dlname if we got it. it's perfectly good, no?
5970 if test -n "$dlname"; then
5972 elif test -n "$soname_spec"; then
5975 *cygwin* | mingw* | *cegcc*)
5976 func_arith $current - $age
5977 major=$func_arith_result
5981 eval soname=\"$soname_spec\"
5986 # Make a new name for the extract_expsyms_cmds to use
5988 func_basename "$soroot"
5989 soname="$func_basename_result"
5990 func_stripname 'lib' '.dll' "$soname"
5991 newlib=libimp-$func_stripname_result.a
5993 # If the library has no export list, then create one now
5994 if test -f "$output_objdir/$soname-def"; then :
5996 func_verbose "extracting exported symbol list from \`$soname'"
5997 func_execute_cmds "$extract_expsyms_cmds" 'exit $?'
6001 if test -f "$output_objdir/$newlib"; then :; else
6002 func_verbose "generating import library for \`$soname'"
6003 func_execute_cmds "$old_archive_from_expsyms_cmds" 'exit $?'
6005 # make sure the library variables are pointing to the new library
6008 fi # test -n "$old_archive_from_expsyms_cmds"
6010 if test "$linkmode" = prog || test "$opt_mode" != relink; then
6015 case $hardcode_action in
6016 immediate | unsupported)
6017 if test "$hardcode_direct" = no; then
6020 *-*-sco3.2v5.0.[024]*) add_dir="-L$dir" ;;
6021 *-*-sysv4*uw2*) add_dir="-L$dir" ;;
6022 *-*-sysv5OpenUNIX* | *-*-sysv5UnixWare7.[01].[10]* | \
6023 *-*-unixware7*) add_dir="-L$dir" ;;
6025 # if the lib is a (non-dlopened) module then we can not
6026 # link against it, someone is ignoring the earlier warnings
6027 if /usr/bin/file -L $add 2> /dev/null |
6028 $GREP ": [^:]* bundle" >/dev/null ; then
6029 if test "X$dlopenmodule" != "X$lib"; then
6030 $ECHO "*** Warning: lib $linklib is a module, not a shared library"
6031 if test -z "$old_library" ; then
6033 echo "*** And there doesn't seem to be a static archive available"
6034 echo "*** The link will probably fail, sorry"
6036 add="$dir/$old_library"
6038 elif test -n "$old_library"; then
6039 add="$dir/$old_library"
6043 elif test "$hardcode_minus_L" = no; then
6045 *-*-sunos*) add_shlibpath="$dir" ;;
6049 elif test "$hardcode_shlibpath_var" = no; then
6050 add_shlibpath="$dir"
6057 if test "$hardcode_direct" = yes &&
6058 test "$hardcode_direct_absolute" = no; then
6060 elif test "$hardcode_minus_L" = yes; then
6062 # Try looking first in the location we're being installed to.
6063 if test -n "$inst_prefix_dir"; then
6066 func_append add_dir " -L$inst_prefix_dir$libdir"
6071 elif test "$hardcode_shlibpath_var" = yes; then
6072 add_shlibpath="$dir"
6081 if test "$lib_linked" != yes; then
6082 func_fatal_configuration "unsupported hardcode properties"
6085 if test -n "$add_shlibpath"; then
6086 case :$compile_shlibpath: in
6087 *":$add_shlibpath:"*) ;;
6088 *) func_append compile_shlibpath "$add_shlibpath:" ;;
6091 if test "$linkmode" = prog; then
6092 test -n "$add_dir" && compile_deplibs="$add_dir $compile_deplibs"
6093 test -n "$add" && compile_deplibs="$add $compile_deplibs"
6095 test -n "$add_dir" && deplibs="$add_dir $deplibs"
6096 test -n "$add" && deplibs="$add $deplibs"
6097 if test "$hardcode_direct" != yes &&
6098 test "$hardcode_minus_L" != yes &&
6099 test "$hardcode_shlibpath_var" = yes; then
6100 case :$finalize_shlibpath: in
6102 *) func_append finalize_shlibpath "$libdir:" ;;
6108 if test "$linkmode" = prog || test "$opt_mode" = relink; then
6112 # Finalize command for both is simple: just hardcode it.
6113 if test "$hardcode_direct" = yes &&
6114 test "$hardcode_direct_absolute" = no; then
6115 add="$libdir/$linklib"
6116 elif test "$hardcode_minus_L" = yes; then
6119 elif test "$hardcode_shlibpath_var" = yes; then
6120 case :$finalize_shlibpath: in
6122 *) func_append finalize_shlibpath "$libdir:" ;;
6125 elif test "$hardcode_automatic" = yes; then
6126 if test -n "$inst_prefix_dir" &&
6127 test -f "$inst_prefix_dir$libdir/$linklib" ; then
6128 add="$inst_prefix_dir$libdir/$linklib"
6130 add="$libdir/$linklib"
6133 # We cannot seem to hardcode it, guess we'll fake it.
6135 # Try looking first in the location we're being installed to.
6136 if test -n "$inst_prefix_dir"; then
6139 func_append add_dir " -L$inst_prefix_dir$libdir"
6146 if test "$linkmode" = prog; then
6147 test -n "$add_dir" && finalize_deplibs="$add_dir $finalize_deplibs"
6148 test -n "$add" && finalize_deplibs="$add $finalize_deplibs"
6150 test -n "$add_dir" && deplibs="$add_dir $deplibs"
6151 test -n "$add" && deplibs="$add $deplibs"
6154 elif test "$linkmode" = prog; then
6155 # Here we assume that one of hardcode_direct or hardcode_minus_L
6156 # is not unsupported. This is valid on all known static and
6158 if test "$hardcode_direct" != unsupported; then
6159 test -n "$old_library" && linklib="$old_library"
6160 compile_deplibs="$dir/$linklib $compile_deplibs"
6161 finalize_deplibs="$dir/$linklib $finalize_deplibs"
6163 compile_deplibs="-l$name -L$dir $compile_deplibs"
6164 finalize_deplibs="-l$name -L$dir $finalize_deplibs"
6166 elif test "$build_libtool_libs" = yes; then
6167 # Not a shared library
6168 if test "$deplibs_check_method" != pass_all; then
6169 # We're trying link a shared library against a static one
6170 # but the system doesn't support it.
6172 # Just print a warning and add the library to dependency_libs so
6173 # that the program can be linked against the static library.
6175 $ECHO "*** Warning: This system can not link to static lib archive $lib."
6176 echo "*** I have the capability to make that library automatically link in when"
6177 echo "*** you link to this library. But I can only do this if you have a"
6178 echo "*** shared version of the library, which you do not appear to have."
6179 if test "$module" = yes; then
6180 echo "*** But as you try to build a module library, libtool will still create "
6181 echo "*** a static module, that should work as long as the dlopening application"
6182 echo "*** is linked with the -dlopen flag to resolve symbols at runtime."
6183 if test -z "$global_symbol_pipe"; then
6185 echo "*** However, this would only work if libtool was able to extract symbol"
6186 echo "*** lists from a program, using \`nm' or equivalent, but libtool could"
6187 echo "*** not find such a program. So, this module is probably useless."
6188 echo "*** \`nm' from GNU binutils and a full rebuild may help."
6190 if test "$build_old_libs" = no; then
6191 build_libtool_libs=module
6194 build_libtool_libs=no
6198 deplibs="$dir/$old_library $deplibs"
6201 fi # link shared/static library?
6203 if test "$linkmode" = lib; then
6204 if test -n "$dependency_libs" &&
6205 { test "$hardcode_into_libs" != yes ||
6206 test "$build_old_libs" = yes ||
6207 test "$link_static" = yes; }; then
6208 # Extract -R from dependency_libs
6210 for libdir in $dependency_libs; do
6212 -R*) func_stripname '-R' '' "$libdir"
6213 temp_xrpath=$func_stripname_result
6215 *" $temp_xrpath "*) ;;
6216 *) func_append xrpath " $temp_xrpath";;
6218 *) func_append temp_deplibs " $libdir";;
6221 dependency_libs="$temp_deplibs"
6224 func_append newlib_search_path " $absdir"
6225 # Link against this library
6226 test "$link_static" = no && newdependency_libs="$abs_ladir/$laname $newdependency_libs"
6227 # ... and its dependency_libs
6229 for deplib in $dependency_libs; do
6230 newdependency_libs="$deplib $newdependency_libs"
6232 -L*) func_stripname '-L' '' "$deplib"
6233 func_resolve_sysroot "$func_stripname_result";;
6234 *) func_resolve_sysroot "$deplib" ;;
6236 if $opt_preserve_dup_deps ; then
6237 case "$tmp_libs " in
6238 *" $func_resolve_sysroot_result "*)
6239 func_append specialdeplibs " $func_resolve_sysroot_result" ;;
6242 func_append tmp_libs " $func_resolve_sysroot_result"
6245 if test "$link_all_deplibs" != no; then
6246 # Add the search paths of all dependency libraries
6247 for deplib in $dependency_libs; do
6250 -L*) path="$deplib" ;;
6252 func_resolve_sysroot "$deplib"
6253 deplib=$func_resolve_sysroot_result
6254 func_dirname "$deplib" "" "."
6255 dir=$func_dirname_result
6256 # We need an absolute path.
6258 [\\/]* | [A-Za-z]:[\\/]*) absdir="$dir" ;;
6260 absdir=`cd "$dir" && pwd`
6261 if test -z "$absdir"; then
6262 func_warning "cannot determine absolute directory name of \`$dir'"
6267 if $GREP "^installed=no" $deplib > /dev/null; then
6271 eval deplibrary_names=`${SED} -n -e 's/^library_names=\(.*\)$/\1/p' $deplib`
6272 if test -n "$deplibrary_names" ; then
6273 for tmp in $deplibrary_names ; do
6276 if test -f "$absdir/$objdir/$depdepl" ; then
6277 depdepl="$absdir/$objdir/$depdepl"
6278 darwin_install_name=`${OTOOL} -L $depdepl | awk '{if (NR == 2) {print $1;exit}}'`
6279 if test -z "$darwin_install_name"; then
6280 darwin_install_name=`${OTOOL64} -L $depdepl | awk '{if (NR == 2) {print $1;exit}}'`
6282 func_append compiler_flags " ${wl}-dylib_file ${wl}${darwin_install_name}:${depdepl}"
6283 func_append linker_flags " -dylib_file ${darwin_install_name}:${depdepl}"
6289 path="-L$absdir/$objdir"
6293 eval libdir=`${SED} -n -e 's/^libdir=\(.*\)$/\1/p' $deplib`
6294 test -z "$libdir" && \
6295 func_fatal_error "\`$deplib' is not a valid libtool archive"
6296 test "$absdir" != "$libdir" && \
6297 func_warning "\`$deplib' seems to be moved"
6303 case " $deplibs " in
6305 *) deplibs="$path $deplibs" ;;
6308 fi # link_all_deplibs != no
6310 done # for deplib in $libs
6311 if test "$pass" = link; then
6312 if test "$linkmode" = "prog"; then
6313 compile_deplibs="$new_inherited_linker_flags $compile_deplibs"
6314 finalize_deplibs="$new_inherited_linker_flags $finalize_deplibs"
6316 compiler_flags="$compiler_flags "`$ECHO " $new_inherited_linker_flags" | $SED 's% \([^ $]*\).ltframework% -framework \1%g'`
6319 dependency_libs="$newdependency_libs"
6320 if test "$pass" = dlpreopen; then
6321 # Link the dlpreopened libraries before other libraries
6322 for deplib in $save_deplibs; do
6323 deplibs="$deplib $deplibs"
6326 if test "$pass" != dlopen; then
6327 if test "$pass" != conv; then
6328 # Make sure lib_search_path contains only unique directories.
6330 for dir in $newlib_search_path; do
6331 case "$lib_search_path " in
6333 *) func_append lib_search_path " $dir" ;;
6339 if test "$linkmode,$pass" != "prog,link"; then
6342 vars="compile_deplibs finalize_deplibs"
6344 for var in $vars dependency_libs; do
6345 # Add libraries to $var in reverse order
6346 eval tmp_libs=\"\$$var\"
6348 for deplib in $tmp_libs; do
6349 # FIXME: Pedantically, this is the right thing to do, so
6350 # that some nasty dependency loop isn't accidentally
6352 #new_libs="$deplib $new_libs"
6353 # Pragmatically, this seems to cause very few problems in
6356 -L*) new_libs="$deplib $new_libs" ;;
6359 # And here is the reason: when a library appears more
6360 # than once as an explicit dependence of a library, or
6361 # is implicitly linked in more than once by the
6362 # compiler, it is considered special, and multiple
6363 # occurrences thereof are not removed. Compare this
6364 # with having the same library being listed as a
6365 # dependency of multiple other libraries: in this case,
6366 # we know (pedantically, we assume) the library does not
6367 # need to be listed more than once, so we keep only the
6368 # last copy. This is not always right, but it is rare
6369 # enough that we require users that really mean to play
6370 # such unportable linking tricks to link the library
6371 # using -Wl,-lname, so that libtool does not consider it
6372 # for duplicate removal.
6373 case " $specialdeplibs " in
6374 *" $deplib "*) new_libs="$deplib $new_libs" ;;
6376 case " $new_libs " in
6378 *) new_libs="$deplib $new_libs" ;;
6386 for deplib in $new_libs; do
6389 case " $tmp_libs " in
6391 *) func_append tmp_libs " $deplib" ;;
6394 *) func_append tmp_libs " $deplib" ;;
6397 eval $var=\"$tmp_libs\"
6400 # Last step: remove runtime libs from dependency_libs
6401 # (they stay in deplibs)
6403 for i in $dependency_libs ; do
6404 case " $predeps $postdeps $compiler_lib_search_path " in
6409 if test -n "$i" ; then
6410 func_append tmp_libs " $i"
6413 dependency_libs=$tmp_libs
6415 if test "$linkmode" = prog; then
6416 dlfiles="$newdlfiles"
6418 if test "$linkmode" = prog || test "$linkmode" = lib; then
6419 dlprefiles="$newdlprefiles"
6424 if test -n "$dlfiles$dlprefiles" || test "$dlself" != no; then
6425 func_warning "\`-dlopen' is ignored for archives"
6430 func_warning "\`-l' and \`-L' are ignored for archives" ;;
6433 test -n "$rpath" && \
6434 func_warning "\`-rpath' is ignored for archives"
6436 test -n "$xrpath" && \
6437 func_warning "\`-R' is ignored for archives"
6439 test -n "$vinfo" && \
6440 func_warning "\`-version-info/-version-number' is ignored for archives"
6442 test -n "$release" && \
6443 func_warning "\`-release' is ignored for archives"
6445 test -n "$export_symbols$export_symbols_regex" && \
6446 func_warning "\`-export-symbols' is ignored for archives"
6448 # Now set the variables for building old libraries.
6449 build_libtool_libs=no
6451 func_append objs "$old_deplibs"
6455 # Make sure we only generate libraries of the form `libNAME.la'.
6458 func_stripname 'lib' '.la' "$outputname"
6459 name=$func_stripname_result
6460 eval shared_ext=\"$shrext_cmds\"
6461 eval libname=\"$libname_spec\"
6464 test "$module" = no && \
6465 func_fatal_help "libtool library \`$output' must begin with \`lib'"
6467 if test "$need_lib_prefix" != no; then
6468 # Add the "lib" prefix for modules if required
6469 func_stripname '' '.la' "$outputname"
6470 name=$func_stripname_result
6471 eval shared_ext=\"$shrext_cmds\"
6472 eval libname=\"$libname_spec\"
6474 func_stripname '' '.la' "$outputname"
6475 libname=$func_stripname_result
6480 if test -n "$objs"; then
6481 if test "$deplibs_check_method" != pass_all; then
6482 func_fatal_error "cannot build libtool library \`$output' from non-libtool objects on this host:$objs"
6485 $ECHO "*** Warning: Linking the shared library $output against the non-libtool"
6486 $ECHO "*** objects $objs is not portable!"
6487 func_append libobjs " $objs"
6491 test "$dlself" != no && \
6492 func_warning "\`-dlopen self' is ignored for libtool libraries"
6496 test "$#" -gt 1 && \
6497 func_warning "ignoring multiple \`-rpath's for a libtool library"
6502 if test -z "$rpath"; then
6503 if test "$build_libtool_libs" = yes; then
6504 # Building a libtool convenience library.
6505 # Some compilers have problems with a `.al' extension so
6506 # convenience libraries should have the same extension an
6507 # archive normally would.
6508 oldlibs="$output_objdir/$libname.$libext $oldlibs"
6509 build_libtool_libs=convenience
6513 test -n "$vinfo" && \
6514 func_warning "\`-version-info/-version-number' is ignored for convenience libraries"
6516 test -n "$release" && \
6517 func_warning "\`-release' is ignored for convenience libraries"
6520 # Parse the version information argument.
6521 save_ifs="$IFS"; IFS=':'
6522 set dummy $vinfo 0 0 0
6527 func_fatal_help "too many parameters to \`-version-info'"
6529 # convert absolute version numbers to libtool ages
6530 # this retains compatibility with .la files and attempts
6531 # to make the code below a bit more comprehensible
6533 case $vinfo_number in
6537 number_revision="$3"
6539 # There are really only two kinds -- those that
6540 # use the current revision as the major version
6541 # and those that subtract age and use age as
6542 # a minor version. But, then there is irix
6543 # which has an extra 1 added just for fun
6545 case $version_type in
6546 # correct linux to gnu/linux during the next big refactor
6547 darwin|linux|osf|windows|none)
6548 func_arith $number_major + $number_minor
6549 current=$func_arith_result
6551 revision="$number_revision"
6553 freebsd-aout|freebsd-elf|qnx|sunos)
6554 current="$number_major"
6555 revision="$number_minor"
6559 func_arith $number_major + $number_minor
6560 current=$func_arith_result
6562 revision="$number_minor"
6563 lt_irix_increment=no
6574 # Check that each of the things are valid numbers.
6576 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]) ;;
6578 func_error "CURRENT \`$current' must be a nonnegative integer"
6579 func_fatal_error "\`$vinfo' is not valid version information"
6584 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]) ;;
6586 func_error "REVISION \`$revision' must be a nonnegative integer"
6587 func_fatal_error "\`$vinfo' is not valid version information"
6592 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]) ;;
6594 func_error "AGE \`$age' must be a nonnegative integer"
6595 func_fatal_error "\`$vinfo' is not valid version information"
6599 if test "$age" -gt "$current"; then
6600 func_error "AGE \`$age' is greater than the current interface number \`$current'"
6601 func_fatal_error "\`$vinfo' is not valid version information"
6604 # Calculate the version variables.
6608 case $version_type in
6612 # Like Linux, but with the current version available in
6613 # verstring for coding it into the library header
6614 func_arith $current - $age
6615 major=.$func_arith_result
6616 versuffix="$major.$age.$revision"
6617 # Darwin ld doesn't like 0 for these options...
6618 func_arith $current + 1
6619 minor_current=$func_arith_result
6620 xlcverstring="${wl}-compatibility_version ${wl}$minor_current ${wl}-current_version ${wl}$minor_current.$revision"
6621 verstring="-compatibility_version $minor_current -current_version $minor_current.$revision"
6626 versuffix=".$current.$revision";
6631 versuffix=".$current"
6635 if test "X$lt_irix_increment" = "Xno"; then
6636 func_arith $current - $age
6638 func_arith $current - $age + 1
6640 major=$func_arith_result
6642 case $version_type in
6643 nonstopux) verstring_prefix=nonstopux ;;
6644 *) verstring_prefix=sgi ;;
6646 verstring="$verstring_prefix$major.$revision"
6648 # Add in all the interfaces that we are compatible with.
6650 while test "$loop" -ne 0; do
6651 func_arith $revision - $loop
6652 iface=$func_arith_result
6653 func_arith $loop - 1
6654 loop=$func_arith_result
6655 verstring="$verstring_prefix$major.$iface:$verstring"
6658 # Before this point, $major must not contain `.'.
6660 versuffix="$major.$revision"
6663 linux) # correct to gnu/linux during the next big refactor
6664 func_arith $current - $age
6665 major=.$func_arith_result
6666 versuffix="$major.$age.$revision"
6670 func_arith $current - $age
6671 major=.$func_arith_result
6672 versuffix=".$current.$age.$revision"
6673 verstring="$current.$age.$revision"
6675 # Add in all the interfaces that we are compatible with.
6677 while test "$loop" -ne 0; do
6678 func_arith $current - $loop
6679 iface=$func_arith_result
6680 func_arith $loop - 1
6681 loop=$func_arith_result
6682 verstring="$verstring:${iface}.0"
6685 # Make executables depend on our current version.
6686 func_append verstring ":${current}.0"
6691 versuffix=".$current"
6696 versuffix=".$current.$revision"
6700 # Use '-' rather than '.', since we only want one
6701 # extension on DOS 8.3 filesystems.
6702 func_arith $current - $age
6703 major=$func_arith_result
6708 func_fatal_configuration "unknown library version type \`$version_type'"
6712 # Clear the version info if we defaulted, and they specified a release.
6713 if test -z "$vinfo" && test -n "$release"; then
6715 case $version_type in
6717 # we can't check for "0.0" in archive_cmds due to quoting
6718 # problems, so we reset it completely
6725 if test "$need_version" = no; then
6732 # Remove version info from name if versioning should be avoided
6733 if test "$avoid_version" = yes && test "$need_version" = no; then
6739 # Check to see if the archive will have undefined symbols.
6740 if test "$allow_undefined" = yes; then
6741 if test "$allow_undefined_flag" = unsupported; then
6742 func_warning "undefined symbols not allowed in $host shared libraries"
6743 build_libtool_libs=no
6747 # Don't allow undefined symbols.
6748 allow_undefined_flag="$no_undefined_flag"
6753 func_generate_dlsyms "$libname" "$libname" "yes"
6754 func_append libobjs " $symfileobj"
6755 test "X$libobjs" = "X " && libobjs=
6757 if test "$opt_mode" != relink; then
6758 # Remove our outputs, but don't remove object files since they
6759 # may have been created when compiling PIC objects.
6761 tempremovelist=`$ECHO "$output_objdir/*"`
6762 for p in $tempremovelist; do
6766 $output_objdir/$outputname | $output_objdir/$libname.* | $output_objdir/${libname}${release}.*)
6767 if test "X$precious_files_regex" != "X"; then
6768 if $ECHO "$p" | $EGREP -e "$precious_files_regex" >/dev/null 2>&1
6773 func_append removelist " $p"
6778 test -n "$removelist" && \
6779 func_show_eval "${RM}r \$removelist"
6782 # Now set the variables for building old libraries.
6783 if test "$build_old_libs" = yes && test "$build_libtool_libs" != convenience ; then
6784 func_append oldlibs " $output_objdir/$libname.$libext"
6786 # Transform .lo files to .o files.
6787 oldobjs="$objs "`$ECHO "$libobjs" | $SP2NL | $SED "/\.${libext}$/d; $lo2o" | $NL2SP`
6790 # Eliminate all temporary directories.
6791 #for path in $notinst_path; do
6792 # lib_search_path=`$ECHO "$lib_search_path " | $SED "s% $path % %g"`
6793 # deplibs=`$ECHO "$deplibs " | $SED "s% -L$path % %g"`
6794 # dependency_libs=`$ECHO "$dependency_libs " | $SED "s% -L$path % %g"`
6797 if test -n "$xrpath"; then
6798 # If the user specified any rpath flags, then add them.
6800 for libdir in $xrpath; do
6801 func_replace_sysroot "$libdir"
6802 func_append temp_xrpath " -R$func_replace_sysroot_result"
6803 case "$finalize_rpath " in
6805 *) func_append finalize_rpath " $libdir" ;;
6808 if test "$hardcode_into_libs" != yes || test "$build_old_libs" = yes; then
6809 dependency_libs="$temp_xrpath $dependency_libs"
6813 # Make sure dlfiles contains only unique files that won't be dlpreopened
6814 old_dlfiles="$dlfiles"
6816 for lib in $old_dlfiles; do
6817 case " $dlprefiles $dlfiles " in
6819 *) func_append dlfiles " $lib" ;;
6823 # Make sure dlprefiles contains only unique files
6824 old_dlprefiles="$dlprefiles"
6826 for lib in $old_dlprefiles; do
6827 case "$dlprefiles " in
6829 *) func_append dlprefiles " $lib" ;;
6833 if test "$build_libtool_libs" = yes; then
6834 if test -n "$rpath"; then
6836 *-*-cygwin* | *-*-mingw* | *-*-pw32* | *-*-os2* | *-*-beos* | *-cegcc* | *-*-haiku*)
6837 # these systems don't actually have a c library (as such)!
6839 *-*-rhapsody* | *-*-darwin1.[012])
6840 # Rhapsody C library is in the System framework
6841 func_append deplibs " System.ltframework"
6844 # Don't link with libc until the a.out ld.so is fixed.
6846 *-*-openbsd* | *-*-freebsd* | *-*-dragonfly*)
6847 # Do not include libc due to us having libc/libc_r.
6849 *-*-sco3.2v5* | *-*-sco5v6*)
6850 # Causes problems with __ctype
6852 *-*-sysv4.2uw2* | *-*-sysv5* | *-*-unixware* | *-*-OpenUNIX*)
6853 # Compiler inserts libc in the correct place for threads to work
6856 # Add libc to deplibs on all other systems if necessary.
6857 if test "$build_libtool_need_lc" = "yes"; then
6858 func_append deplibs " -lc"
6864 # Transform deplibs into only deplibs that can be linked in shared.
6866 libname_save=$libname
6867 release_save=$release
6868 versuffix_save=$versuffix
6870 # I'm not sure if I'm treating the release correctly. I think
6871 # release should show up in the -l (ie -lgmp5) so we don't want to
6872 # add it in twice. Is that correct?
6878 case $deplibs_check_method in
6880 # Don't check for shared/static. Everything works.
6881 # This might be a little naive. We might want to check
6882 # whether the library exists or not. But this is on
6883 # osf3 & osf4 and I'm not really sure... Just
6884 # implementing what was already the behavior.
6888 # This code stresses the "libraries are programs" paradigm to its
6889 # limits. Maybe even breaks it. We compile a program, linking it
6890 # against the deplibs as a proxy for the library. Then we can check
6891 # whether they linked in statically or dynamically with ldd.
6892 $opt_dry_run || $RM conftest.c
6893 cat > conftest.c <<EOF
6894 int main() { return 0; }
6896 $opt_dry_run || $RM conftest
6897 if $LTCC $LTCFLAGS -o conftest conftest.c $deplibs; then
6898 ldd_output=`ldd conftest`
6899 for i in $deplibs; do
6902 func_stripname -l '' "$i"
6903 name=$func_stripname_result
6904 if test "X$allow_libtool_libs_with_static_runtimes" = "Xyes" ; then
6905 case " $predeps $postdeps " in
6907 func_append newdeplibs " $i"
6912 if test -n "$i" ; then
6913 libname=`eval "\\$ECHO \"$libname_spec\""`
6914 deplib_matches=`eval "\\$ECHO \"$library_names_spec\""`
6915 set dummy $deplib_matches; shift
6917 if test `expr "$ldd_output" : ".*$deplib_match"` -ne 0 ; then
6918 func_append newdeplibs " $i"
6922 $ECHO "*** Warning: dynamic linker does not accept needed library $i."
6923 echo "*** I have the capability to make that library automatically link in when"
6924 echo "*** you link to this library. But I can only do this if you have a"
6925 echo "*** shared version of the library, which I believe you do not have"
6926 echo "*** because a test_compile did reveal that the linker did not use it for"
6927 echo "*** its dynamic dependency list that programs get resolved with at runtime."
6932 func_append newdeplibs " $i"
6937 # Error occurred in the first compile. Let's try to salvage
6938 # the situation: Compile a separate program for each library.
6939 for i in $deplibs; do
6942 func_stripname -l '' "$i"
6943 name=$func_stripname_result
6944 $opt_dry_run || $RM conftest
6945 if $LTCC $LTCFLAGS -o conftest conftest.c $i; then
6946 ldd_output=`ldd conftest`
6947 if test "X$allow_libtool_libs_with_static_runtimes" = "Xyes" ; then
6948 case " $predeps $postdeps " in
6950 func_append newdeplibs " $i"
6955 if test -n "$i" ; then
6956 libname=`eval "\\$ECHO \"$libname_spec\""`
6957 deplib_matches=`eval "\\$ECHO \"$library_names_spec\""`
6958 set dummy $deplib_matches; shift
6960 if test `expr "$ldd_output" : ".*$deplib_match"` -ne 0 ; then
6961 func_append newdeplibs " $i"
6965 $ECHO "*** Warning: dynamic linker does not accept needed library $i."
6966 echo "*** I have the capability to make that library automatically link in when"
6967 echo "*** you link to this library. But I can only do this if you have a"
6968 echo "*** shared version of the library, which you do not appear to have"
6969 echo "*** because a test_compile did reveal that the linker did not use this one"
6970 echo "*** as a dynamic dependency that programs can get resolved with at runtime."
6976 $ECHO "*** Warning! Library $i is needed by this library but I was not able to"
6977 echo "*** make it link in! You will probably need to install it or some"
6978 echo "*** library that it depends on before this library will be fully"
6979 echo "*** functional. Installing it before continuing would be even better."
6983 func_append newdeplibs " $i"
6990 set dummy $deplibs_check_method; shift
6991 file_magic_regex=`expr "$deplibs_check_method" : "$1 \(.*\)"`
6992 for a_deplib in $deplibs; do
6995 func_stripname -l '' "$a_deplib"
6996 name=$func_stripname_result
6997 if test "X$allow_libtool_libs_with_static_runtimes" = "Xyes" ; then
6998 case " $predeps $postdeps " in
7000 func_append newdeplibs " $a_deplib"
7005 if test -n "$a_deplib" ; then
7006 libname=`eval "\\$ECHO \"$libname_spec\""`
7007 if test -n "$file_magic_glob"; then
7008 libnameglob=`func_echo_all "$libname" | $SED -e $file_magic_glob`
7010 libnameglob=$libname
7012 test "$want_nocaseglob" = yes && nocaseglob=`shopt -p nocaseglob`
7013 for i in $lib_search_path $sys_lib_search_path $shlib_search_path; do
7014 if test "$want_nocaseglob" = yes; then
7016 potential_libs=`ls $i/$libnameglob[.-]* 2>/dev/null`
7019 potential_libs=`ls $i/$libnameglob[.-]* 2>/dev/null`
7021 for potent_lib in $potential_libs; do
7022 # Follow soft links.
7023 if ls -lLd "$potent_lib" 2>/dev/null |
7024 $GREP " -> " >/dev/null; then
7027 # The statement above tries to avoid entering an
7028 # endless loop below, in case of cyclic links.
7029 # We might still enter an endless loop, since a link
7030 # loop can be closed while we follow links,
7032 potlib="$potent_lib"
7033 while test -h "$potlib" 2>/dev/null; do
7034 potliblink=`ls -ld $potlib | ${SED} 's/.* -> //'`
7036 [\\/]* | [A-Za-z]:[\\/]*) potlib="$potliblink";;
7037 *) potlib=`$ECHO "$potlib" | $SED 's,[^/]*$,,'`"$potliblink";;
7040 if eval $file_magic_cmd \"\$potlib\" 2>/dev/null |
7042 $EGREP "$file_magic_regex" > /dev/null; then
7043 func_append newdeplibs " $a_deplib"
7050 if test -n "$a_deplib" ; then
7053 $ECHO "*** Warning: linker path does not have real file for library $a_deplib."
7054 echo "*** I have the capability to make that library automatically link in when"
7055 echo "*** you link to this library. But I can only do this if you have a"
7056 echo "*** shared version of the library, which you do not appear to have"
7057 echo "*** because I did check the linker path looking for a file starting"
7058 if test -z "$potlib" ; then
7059 $ECHO "*** with $libname but no candidates were found. (...for file magic test)"
7061 $ECHO "*** with $libname and none of the candidates passed a file format test"
7062 $ECHO "*** using a file magic. Last file checked: $potlib"
7067 # Add a -L argument.
7068 func_append newdeplibs " $a_deplib"
7071 done # Gone through all deplibs.
7074 set dummy $deplibs_check_method; shift
7075 match_pattern_regex=`expr "$deplibs_check_method" : "$1 \(.*\)"`
7076 for a_deplib in $deplibs; do
7079 func_stripname -l '' "$a_deplib"
7080 name=$func_stripname_result
7081 if test "X$allow_libtool_libs_with_static_runtimes" = "Xyes" ; then
7082 case " $predeps $postdeps " in
7084 func_append newdeplibs " $a_deplib"
7089 if test -n "$a_deplib" ; then
7090 libname=`eval "\\$ECHO \"$libname_spec\""`
7091 for i in $lib_search_path $sys_lib_search_path $shlib_search_path; do
7092 potential_libs=`ls $i/$libname[.-]* 2>/dev/null`
7093 for potent_lib in $potential_libs; do
7094 potlib="$potent_lib" # see symlink-check above in file_magic test
7095 if eval "\$ECHO \"$potent_lib\"" 2>/dev/null | $SED 10q | \
7096 $EGREP "$match_pattern_regex" > /dev/null; then
7097 func_append newdeplibs " $a_deplib"
7104 if test -n "$a_deplib" ; then
7107 $ECHO "*** Warning: linker path does not have real file for library $a_deplib."
7108 echo "*** I have the capability to make that library automatically link in when"
7109 echo "*** you link to this library. But I can only do this if you have a"
7110 echo "*** shared version of the library, which you do not appear to have"
7111 echo "*** because I did check the linker path looking for a file starting"
7112 if test -z "$potlib" ; then
7113 $ECHO "*** with $libname but no candidates were found. (...for regex pattern test)"
7115 $ECHO "*** with $libname and none of the candidates passed a file format test"
7116 $ECHO "*** using a regex pattern. Last file checked: $potlib"
7121 # Add a -L argument.
7122 func_append newdeplibs " $a_deplib"
7125 done # Gone through all deplibs.
7129 tmp_deplibs=`$ECHO " $deplibs" | $SED 's/ -lc$//; s/ -[LR][^ ]*//g'`
7130 if test "X$allow_libtool_libs_with_static_runtimes" = "Xyes" ; then
7131 for i in $predeps $postdeps ; do
7132 # can't use Xsed below, because $i might contain '/'
7133 tmp_deplibs=`$ECHO " $tmp_deplibs" | $SED "s,$i,,"`
7136 case $tmp_deplibs in
7139 if test "X$deplibs_check_method" = "Xnone"; then
7140 echo "*** Warning: inter-library dependencies are not supported in this platform."
7142 echo "*** Warning: inter-library dependencies are not known to be supported."
7144 echo "*** All declared inter-library dependencies are being dropped."
7150 versuffix=$versuffix_save
7152 release=$release_save
7153 libname=$libname_save
7157 *-*-rhapsody* | *-*-darwin1.[012])
7158 # On Rhapsody replace the C library with the System framework
7159 newdeplibs=`$ECHO " $newdeplibs" | $SED 's/ -lc / System.ltframework /'`
7163 if test "$droppeddeps" = yes; then
7164 if test "$module" = yes; then
7166 echo "*** Warning: libtool could not satisfy all declared inter-library"
7167 $ECHO "*** dependencies of module $libname. Therefore, libtool will create"
7168 echo "*** a static module, that should work as long as the dlopening"
7169 echo "*** application is linked with the -dlopen flag."
7170 if test -z "$global_symbol_pipe"; then
7172 echo "*** However, this would only work if libtool was able to extract symbol"
7173 echo "*** lists from a program, using \`nm' or equivalent, but libtool could"
7174 echo "*** not find such a program. So, this module is probably useless."
7175 echo "*** \`nm' from GNU binutils and a full rebuild may help."
7177 if test "$build_old_libs" = no; then
7178 oldlibs="$output_objdir/$libname.$libext"
7179 build_libtool_libs=module
7182 build_libtool_libs=no
7185 echo "*** The inter-library dependencies that have been dropped here will be"
7186 echo "*** automatically added whenever a program is linked with this library"
7187 echo "*** or is declared to -dlopen it."
7189 if test "$allow_undefined" = no; then
7191 echo "*** Since this library must not contain undefined symbols,"
7192 echo "*** because either the platform does not support them or"
7193 echo "*** it was explicitly requested with -no-undefined,"
7194 echo "*** libtool will only create a static version of it."
7195 if test "$build_old_libs" = no; then
7196 oldlibs="$output_objdir/$libname.$libext"
7197 build_libtool_libs=module
7200 build_libtool_libs=no
7205 # Done checking deplibs!
7208 # Time to change all our "foo.ltframework" stuff back to "-framework foo"
7211 newdeplibs=`$ECHO " $newdeplibs" | $SED 's% \([^ $]*\).ltframework% -framework \1%g'`
7212 new_inherited_linker_flags=`$ECHO " $new_inherited_linker_flags" | $SED 's% \([^ $]*\).ltframework% -framework \1%g'`
7213 deplibs=`$ECHO " $deplibs" | $SED 's% \([^ $]*\).ltframework% -framework \1%g'`
7217 # move library search paths that coincide with paths to not yet
7218 # installed libraries to the beginning of the library search list
7220 for path in $notinst_path; do
7221 case " $new_libs " in
7222 *" -L$path/$objdir "*) ;;
7224 case " $deplibs " in
7225 *" -L$path/$objdir "*)
7226 func_append new_libs " -L$path/$objdir" ;;
7231 for deplib in $deplibs; do
7234 case " $new_libs " in
7236 *) func_append new_libs " $deplib" ;;
7239 *) func_append new_libs " $deplib" ;;
7244 # All the library-specific variables (install_libdir is set above).
7249 # Test again, we may have decided not to build it any more
7250 if test "$build_libtool_libs" = yes; then
7251 # Remove ${wl} instances when linking with ld.
7252 # FIXME: should test the right _cmds variable.
7253 case $archive_cmds in
7256 if test "$hardcode_into_libs" = yes; then
7257 # Hardcode the library paths
7260 rpath="$finalize_rpath"
7261 test "$opt_mode" != relink && rpath="$compile_rpath$rpath"
7262 for libdir in $rpath; do
7263 if test -n "$hardcode_libdir_flag_spec"; then
7264 if test -n "$hardcode_libdir_separator"; then
7265 func_replace_sysroot "$libdir"
7266 libdir=$func_replace_sysroot_result
7267 if test -z "$hardcode_libdirs"; then
7268 hardcode_libdirs="$libdir"
7270 # Just accumulate the unique libdirs.
7271 case $hardcode_libdir_separator$hardcode_libdirs$hardcode_libdir_separator in
7272 *"$hardcode_libdir_separator$libdir$hardcode_libdir_separator"*)
7275 func_append hardcode_libdirs "$hardcode_libdir_separator$libdir"
7280 eval flag=\"$hardcode_libdir_flag_spec\"
7281 func_append dep_rpath " $flag"
7283 elif test -n "$runpath_var"; then
7284 case "$perm_rpath " in
7286 *) func_append perm_rpath " $libdir" ;;
7290 # Substitute the hardcoded libdirs into the rpath.
7291 if test -n "$hardcode_libdir_separator" &&
7292 test -n "$hardcode_libdirs"; then
7293 libdir="$hardcode_libdirs"
7294 eval "dep_rpath=\"$hardcode_libdir_flag_spec\""
7296 if test -n "$runpath_var" && test -n "$perm_rpath"; then
7297 # We should set the runpath_var.
7299 for dir in $perm_rpath; do
7300 func_append rpath "$dir:"
7302 eval "$runpath_var='$rpath\$$runpath_var'; export $runpath_var"
7304 test -n "$dep_rpath" && deplibs="$dep_rpath $deplibs"
7307 shlibpath="$finalize_shlibpath"
7308 test "$opt_mode" != relink && shlibpath="$compile_shlibpath$shlibpath"
7309 if test -n "$shlibpath"; then
7310 eval "$shlibpath_var='$shlibpath\$$shlibpath_var'; export $shlibpath_var"
7313 # Get the real and link names of the library.
7314 eval shared_ext=\"$shrext_cmds\"
7315 eval library_names=\"$library_names_spec\"
7316 set dummy $library_names
7321 if test -n "$soname_spec"; then
7322 eval soname=\"$soname_spec\"
7326 if test -z "$dlname"; then
7330 lib="$output_objdir/$realname"
7334 func_append linknames " $link"
7337 # Use standard objects if they are pic
7338 test -z "$pic_flag" && libobjs=`$ECHO "$libobjs" | $SP2NL | $SED "$lo2o" | $NL2SP`
7339 test "X$libobjs" = "X " && libobjs=
7342 if test -n "$export_symbols" && test -n "$include_expsyms"; then
7343 $opt_dry_run || cp "$export_symbols" "$output_objdir/$libname.uexp"
7344 export_symbols="$output_objdir/$libname.uexp"
7345 func_append delfiles " $export_symbols"
7348 orig_export_symbols=
7350 cygwin* | mingw* | cegcc*)
7351 if test -n "$export_symbols" && test -z "$export_symbols_regex"; then
7352 # exporting using user supplied symfile
7353 if test "x`$SED 1q $export_symbols`" != xEXPORTS; then
7354 # and it's NOT already a .def file. Must figure out
7355 # which of the given symbols are data symbols and tag
7356 # them as such. So, trigger use of export_symbols_cmds.
7357 # export_symbols gets reassigned inside the "prepare
7358 # the list of exported symbols" if statement, so the
7359 # include_expsyms logic still works.
7360 orig_export_symbols="$export_symbols"
7362 always_export_symbols=yes
7368 # Prepare the list of exported symbols
7369 if test -z "$export_symbols"; then
7370 if test "$always_export_symbols" = yes || test -n "$export_symbols_regex"; then
7371 func_verbose "generating symbol list for \`$libname.la'"
7372 export_symbols="$output_objdir/$libname.exp"
7373 $opt_dry_run || $RM $export_symbols
7374 cmds=$export_symbols_cmds
7375 save_ifs="$IFS"; IFS='~'
7376 for cmd1 in $cmds; do
7378 # Take the normal branch if the nm_file_list_spec branch
7379 # doesn't work or if tool conversion is not needed.
7380 case $nm_file_list_spec~$to_tool_file_cmd in
7381 *~func_convert_file_noop | *~func_convert_file_msys_to_w32 | ~*)
7382 try_normal_branch=yes
7385 len=$func_len_result
7388 try_normal_branch=no
7391 if test "$try_normal_branch" = yes \
7392 && { test "$len" -lt "$max_cmd_len" \
7393 || test "$max_cmd_len" -le -1; }
7395 func_show_eval "$cmd" 'exit $?'
7396 skipped_export=false
7397 elif test -n "$nm_file_list_spec"; then
7398 func_basename "$output"
7399 output_la=$func_basename_result
7400 save_libobjs=$libobjs
7402 output=${output_objdir}/${output_la}.nm
7403 func_to_tool_file "$output"
7404 libobjs=$nm_file_list_spec$func_to_tool_file_result
7405 func_append delfiles " $output"
7406 func_verbose "creating $NM input file list: $output"
7407 for obj in $save_libobjs; do
7408 func_to_tool_file "$obj"
7409 $ECHO "$func_to_tool_file_result"
7412 func_show_eval "$cmd" 'exit $?'
7414 libobjs=$save_libobjs
7415 skipped_export=false
7417 # The command line is too long to execute in one step.
7418 func_verbose "using reloadable object file for export list..."
7420 # Break out early, otherwise skipped_export may be
7421 # set to false by a later but shorter cmd.
7426 if test -n "$export_symbols_regex" && test "X$skipped_export" != "X:"; then
7427 func_show_eval '$EGREP -e "$export_symbols_regex" "$export_symbols" > "${export_symbols}T"'
7428 func_show_eval '$MV "${export_symbols}T" "$export_symbols"'
7433 if test -n "$export_symbols" && test -n "$include_expsyms"; then
7434 tmp_export_symbols="$export_symbols"
7435 test -n "$orig_export_symbols" && tmp_export_symbols="$orig_export_symbols"
7436 $opt_dry_run || eval '$ECHO "$include_expsyms" | $SP2NL >> "$tmp_export_symbols"'
7439 if test "X$skipped_export" != "X:" && test -n "$orig_export_symbols"; then
7440 # The given exports_symbols file has to be filtered, so filter it.
7441 func_verbose "filter symbol list for \`$libname.la' to tag DATA exports"
7442 # FIXME: $output_objdir/$libname.filter potentially contains lots of
7443 # 's' commands which not all seds can handle. GNU sed should be fine
7444 # though. Also, the filter scales superlinearly with the number of
7445 # global variables. join(1) would be nice here, but unfortunately
7446 # isn't a blessed tool.
7447 $opt_dry_run || $SED -e '/[ ,]DATA/!d;s,\(.*\)\([ \,].*\),s|^\1$|\1\2|,' < $export_symbols > $output_objdir/$libname.filter
7448 func_append delfiles " $export_symbols $output_objdir/$libname.filter"
7449 export_symbols=$output_objdir/$libname.def
7450 $opt_dry_run || $SED -f $output_objdir/$libname.filter < $orig_export_symbols > $export_symbols
7454 for test_deplib in $deplibs; do
7455 case " $convenience " in
7456 *" $test_deplib "*) ;;
7458 func_append tmp_deplibs " $test_deplib"
7462 deplibs="$tmp_deplibs"
7464 if test -n "$convenience"; then
7465 if test -n "$whole_archive_flag_spec" &&
7466 test "$compiler_needs_object" = yes &&
7467 test -z "$libobjs"; then
7468 # extract the archives, so we have objects to list.
7469 # TODO: could optimize this to just extract one archive.
7470 whole_archive_flag_spec=
7472 if test -n "$whole_archive_flag_spec"; then
7473 save_libobjs=$libobjs
7474 eval libobjs=\"\$libobjs $whole_archive_flag_spec\"
7475 test "X$libobjs" = "X " && libobjs=
7477 gentop="$output_objdir/${outputname}x"
7478 func_append generated " $gentop"
7480 func_extract_archives $gentop $convenience
7481 func_append libobjs " $func_extract_archives_result"
7482 test "X$libobjs" = "X " && libobjs=
7486 if test "$thread_safe" = yes && test -n "$thread_safe_flag_spec"; then
7487 eval flag=\"$thread_safe_flag_spec\"
7488 func_append linker_flags " $flag"
7491 # Make a backup of the uninstalled library when relinking
7492 if test "$opt_mode" = relink; then
7493 $opt_dry_run || eval '(cd $output_objdir && $RM ${realname}U && $MV $realname ${realname}U)' || exit $?
7496 # Do each of the archive commands.
7497 if test "$module" = yes && test -n "$module_cmds" ; then
7498 if test -n "$export_symbols" && test -n "$module_expsym_cmds"; then
7499 eval test_cmds=\"$module_expsym_cmds\"
7500 cmds=$module_expsym_cmds
7502 eval test_cmds=\"$module_cmds\"
7506 if test -n "$export_symbols" && test -n "$archive_expsym_cmds"; then
7507 eval test_cmds=\"$archive_expsym_cmds\"
7508 cmds=$archive_expsym_cmds
7510 eval test_cmds=\"$archive_cmds\"
7515 if test "X$skipped_export" != "X:" &&
7516 func_len " $test_cmds" &&
7517 len=$func_len_result &&
7518 test "$len" -lt "$max_cmd_len" || test "$max_cmd_len" -le -1; then
7521 # The command line is too long to link in one step, link piecewise
7522 # or, if using GNU ld and skipped_export is not :, use a linker
7525 # Save the value of $output and $libobjs because we want to
7526 # use them later. If we have whole_archive_flag_spec, we
7527 # want to use save_libobjs as it was before
7528 # whole_archive_flag_spec was expanded, because we can't
7529 # assume the linker understands whole_archive_flag_spec.
7530 # This may have to be revisited, in case too many
7531 # convenience libraries get linked in and end up exceeding
7533 if test -z "$convenience" || test -z "$whole_archive_flag_spec"; then
7534 save_libobjs=$libobjs
7537 func_basename "$output"
7538 output_la=$func_basename_result
7540 # Clear the reloadable object creation command queue and
7541 # initialize k to one.
7548 if test -n "$save_libobjs" && test "X$skipped_export" != "X:" && test "$with_gnu_ld" = yes; then
7549 output=${output_objdir}/${output_la}.lnkscript
7550 func_verbose "creating GNU ld script: $output"
7551 echo 'INPUT (' > $output
7552 for obj in $save_libobjs
7554 func_to_tool_file "$obj"
7555 $ECHO "$func_to_tool_file_result" >> $output
7558 func_append delfiles " $output"
7559 func_to_tool_file "$output"
7560 output=$func_to_tool_file_result
7561 elif test -n "$save_libobjs" && test "X$skipped_export" != "X:" && test "X$file_list_spec" != X; then
7562 output=${output_objdir}/${output_la}.lnk
7563 func_verbose "creating linker input file list: $output"
7568 if test "$compiler_needs_object" = yes; then
7574 func_to_tool_file "$obj"
7575 $ECHO "$func_to_tool_file_result" >> $output
7577 func_append delfiles " $output"
7578 func_to_tool_file "$output"
7579 output=$firstobj\"$file_list_spec$func_to_tool_file_result\"
7581 if test -n "$save_libobjs"; then
7582 func_verbose "creating reloadable object files..."
7583 output=$output_objdir/$output_la-${k}.$objext
7584 eval test_cmds=\"$reload_cmds\"
7585 func_len " $test_cmds"
7586 len0=$func_len_result
7589 # Loop over the list of objects to be linked.
7590 for obj in $save_libobjs
7593 func_arith $len + $func_len_result
7594 len=$func_arith_result
7595 if test "X$objlist" = X ||
7596 test "$len" -lt "$max_cmd_len"; then
7597 func_append objlist " $obj"
7599 # The command $test_cmds is almost too long, add a
7600 # command to the queue.
7601 if test "$k" -eq 1 ; then
7602 # The first file doesn't have a previous command to add.
7603 reload_objs=$objlist
7604 eval concat_cmds=\"$reload_cmds\"
7606 # All subsequent reloadable object files will link in
7607 # the last one created.
7608 reload_objs="$objlist $last_robj"
7609 eval concat_cmds=\"\$concat_cmds~$reload_cmds~\$RM $last_robj\"
7611 last_robj=$output_objdir/$output_la-${k}.$objext
7613 k=$func_arith_result
7614 output=$output_objdir/$output_la-${k}.$objext
7616 func_len " $last_robj"
7617 func_arith $len0 + $func_len_result
7618 len=$func_arith_result
7621 # Handle the remaining objects by creating one last
7622 # reloadable object file. All subsequent reloadable object
7623 # files will link in the last one created.
7624 test -z "$concat_cmds" || concat_cmds=$concat_cmds~
7625 reload_objs="$objlist $last_robj"
7626 eval concat_cmds=\"\${concat_cmds}$reload_cmds\"
7627 if test -n "$last_robj"; then
7628 eval concat_cmds=\"\${concat_cmds}~\$RM $last_robj\"
7630 func_append delfiles " $output"
7636 if ${skipped_export-false}; then
7637 func_verbose "generating symbol list for \`$libname.la'"
7638 export_symbols="$output_objdir/$libname.exp"
7639 $opt_dry_run || $RM $export_symbols
7641 # Append the command to create the export file.
7642 test -z "$concat_cmds" || concat_cmds=$concat_cmds~
7643 eval concat_cmds=\"\$concat_cmds$export_symbols_cmds\"
7644 if test -n "$last_robj"; then
7645 eval concat_cmds=\"\$concat_cmds~\$RM $last_robj\"
7649 test -n "$save_libobjs" &&
7650 func_verbose "creating a temporary reloadable object file: $output"
7652 # Loop through the commands generated above and execute them.
7653 save_ifs="$IFS"; IFS='~'
7654 for cmd in $concat_cmds; do
7657 func_quote_for_expand "$cmd"
7658 eval "func_echo $func_quote_for_expand_result"
7660 $opt_dry_run || eval "$cmd" || {
7663 # Restore the uninstalled library and exit
7664 if test "$opt_mode" = relink; then
7665 ( cd "$output_objdir" && \
7666 $RM "${realname}T" && \
7667 $MV "${realname}U" "$realname" )
7675 if test -n "$export_symbols_regex" && ${skipped_export-false}; then
7676 func_show_eval '$EGREP -e "$export_symbols_regex" "$export_symbols" > "${export_symbols}T"'
7677 func_show_eval '$MV "${export_symbols}T" "$export_symbols"'
7681 if ${skipped_export-false}; then
7682 if test -n "$export_symbols" && test -n "$include_expsyms"; then
7683 tmp_export_symbols="$export_symbols"
7684 test -n "$orig_export_symbols" && tmp_export_symbols="$orig_export_symbols"
7685 $opt_dry_run || eval '$ECHO "$include_expsyms" | $SP2NL >> "$tmp_export_symbols"'
7688 if test -n "$orig_export_symbols"; then
7689 # The given exports_symbols file has to be filtered, so filter it.
7690 func_verbose "filter symbol list for \`$libname.la' to tag DATA exports"
7691 # FIXME: $output_objdir/$libname.filter potentially contains lots of
7692 # 's' commands which not all seds can handle. GNU sed should be fine
7693 # though. Also, the filter scales superlinearly with the number of
7694 # global variables. join(1) would be nice here, but unfortunately
7695 # isn't a blessed tool.
7696 $opt_dry_run || $SED -e '/[ ,]DATA/!d;s,\(.*\)\([ \,].*\),s|^\1$|\1\2|,' < $export_symbols > $output_objdir/$libname.filter
7697 func_append delfiles " $export_symbols $output_objdir/$libname.filter"
7698 export_symbols=$output_objdir/$libname.def
7699 $opt_dry_run || $SED -f $output_objdir/$libname.filter < $orig_export_symbols > $export_symbols
7704 # Restore the value of output.
7707 if test -n "$convenience" && test -n "$whole_archive_flag_spec"; then
7708 eval libobjs=\"\$libobjs $whole_archive_flag_spec\"
7709 test "X$libobjs" = "X " && libobjs=
7711 # Expand the library linking commands again to reset the
7712 # value of $libobjs for piecewise linking.
7714 # Do each of the archive commands.
7715 if test "$module" = yes && test -n "$module_cmds" ; then
7716 if test -n "$export_symbols" && test -n "$module_expsym_cmds"; then
7717 cmds=$module_expsym_cmds
7722 if test -n "$export_symbols" && test -n "$archive_expsym_cmds"; then
7723 cmds=$archive_expsym_cmds
7730 if test -n "$delfiles"; then
7731 # Append the command to remove temporary files to $cmds.
7732 eval cmds=\"\$cmds~\$RM $delfiles\"
7735 # Add any objects from preloaded convenience libraries
7736 if test -n "$dlprefiles"; then
7737 gentop="$output_objdir/${outputname}x"
7738 func_append generated " $gentop"
7740 func_extract_archives $gentop $dlprefiles
7741 func_append libobjs " $func_extract_archives_result"
7742 test "X$libobjs" = "X " && libobjs=
7745 save_ifs="$IFS"; IFS='~'
7746 for cmd in $cmds; do
7750 func_quote_for_expand "$cmd"
7751 eval "func_echo $func_quote_for_expand_result"
7753 $opt_dry_run || eval "$cmd" || {
7756 # Restore the uninstalled library and exit
7757 if test "$opt_mode" = relink; then
7758 ( cd "$output_objdir" && \
7759 $RM "${realname}T" && \
7760 $MV "${realname}U" "$realname" )
7768 # Restore the uninstalled library and exit
7769 if test "$opt_mode" = relink; then
7770 $opt_dry_run || eval '(cd $output_objdir && $RM ${realname}T && $MV $realname ${realname}T && $MV ${realname}U $realname)' || exit $?
7772 if test -n "$convenience"; then
7773 if test -z "$whole_archive_flag_spec"; then
7774 func_show_eval '${RM}r "$gentop"'
7781 # Create links to the real library.
7782 for linkname in $linknames; do
7783 if test "$realname" != "$linkname"; then
7784 func_show_eval '(cd "$output_objdir" && $RM "$linkname" && $LN_S "$realname" "$linkname")' 'exit $?'
7788 # If -module or -export-dynamic was specified, set the dlname.
7789 if test "$module" = yes || test "$export_dynamic" = yes; then
7790 # On all known operating systems, these are identical.
7797 if test -n "$dlfiles$dlprefiles" || test "$dlself" != no; then
7798 func_warning "\`-dlopen' is ignored for objects"
7803 func_warning "\`-l' and \`-L' are ignored for objects" ;;
7806 test -n "$rpath" && \
7807 func_warning "\`-rpath' is ignored for objects"
7809 test -n "$xrpath" && \
7810 func_warning "\`-R' is ignored for objects"
7812 test -n "$vinfo" && \
7813 func_warning "\`-version-info' is ignored for objects"
7815 test -n "$release" && \
7816 func_warning "\`-release' is ignored for objects"
7820 test -n "$objs$old_deplibs" && \
7821 func_fatal_error "cannot build library object \`$output' from non-libtool objects"
7825 obj=$func_lo2o_result
7833 # Delete the old objects.
7834 $opt_dry_run || $RM $obj $libobj
7836 # Objects from convenience libraries. This assumes
7837 # single-version convenience libraries. Whenever we create
7838 # different ones for PIC/non-PIC, this we'll have to duplicate
7842 # reload_cmds runs $LD directly, so let us get rid of
7843 # -Wl from whole_archive_flag_spec and hope we can get by with
7844 # turning comma into space..
7847 if test -n "$convenience"; then
7848 if test -n "$whole_archive_flag_spec"; then
7849 eval tmp_whole_archive_flags=\"$whole_archive_flag_spec\"
7850 reload_conv_objs=$reload_objs\ `$ECHO "$tmp_whole_archive_flags" | $SED 's|,| |g'`
7852 gentop="$output_objdir/${obj}x"
7853 func_append generated " $gentop"
7855 func_extract_archives $gentop $convenience
7856 reload_conv_objs="$reload_objs $func_extract_archives_result"
7860 # If we're not building shared, we need to use non_pic_objs
7861 test "$build_libtool_libs" != yes && libobjs="$non_pic_objects"
7863 # Create the old-style object.
7864 reload_objs="$objs$old_deplibs "`$ECHO "$libobjs" | $SP2NL | $SED "/\.${libext}$/d; /\.lib$/d; $lo2o" | $NL2SP`" $reload_conv_objs" ### testsuite: skip nested quoting test
7867 func_execute_cmds "$reload_cmds" 'exit $?'
7869 # Exit if we aren't doing a library object file.
7870 if test -z "$libobj"; then
7871 if test -n "$gentop"; then
7872 func_show_eval '${RM}r "$gentop"'
7878 if test "$build_libtool_libs" != yes; then
7879 if test -n "$gentop"; then
7880 func_show_eval '${RM}r "$gentop"'
7883 # Create an invalid libtool object if no PIC, so that we don't
7884 # accidentally link it into a program.
7885 # $show "echo timestamp > $libobj"
7886 # $opt_dry_run || eval "echo timestamp > $libobj" || exit $?
7890 if test -n "$pic_flag" || test "$pic_mode" != default; then
7891 # Only do commands if we really have different PIC objects.
7892 reload_objs="$libobjs $reload_conv_objs"
7894 func_execute_cmds "$reload_cmds" 'exit $?'
7897 if test -n "$gentop"; then
7898 func_show_eval '${RM}r "$gentop"'
7906 *cygwin*) func_stripname '' '.exe' "$output"
7907 output=$func_stripname_result.exe;;
7909 test -n "$vinfo" && \
7910 func_warning "\`-version-info' is ignored for programs"
7912 test -n "$release" && \
7913 func_warning "\`-release' is ignored for programs"
7915 test "$preload" = yes \
7916 && test "$dlopen_support" = unknown \
7917 && test "$dlopen_self" = unknown \
7918 && test "$dlopen_self_static" = unknown && \
7919 func_warning "\`LT_INIT([dlopen])' not used. Assuming no dlopen support."
7922 *-*-rhapsody* | *-*-darwin1.[012])
7923 # On Rhapsody replace the C library is the System framework
7924 compile_deplibs=`$ECHO " $compile_deplibs" | $SED 's/ -lc / System.ltframework /'`
7925 finalize_deplibs=`$ECHO " $finalize_deplibs" | $SED 's/ -lc / System.ltframework /'`
7931 # Don't allow lazy linking, it breaks C++ global constructors
7932 # But is supposedly fixed on 10.4 or later (yay!).
7933 if test "$tagname" = CXX ; then
7934 case ${MACOSX_DEPLOYMENT_TARGET-10.0} in
7936 func_append compile_command " ${wl}-bind_at_load"
7937 func_append finalize_command " ${wl}-bind_at_load"
7941 # Time to change all our "foo.ltframework" stuff back to "-framework foo"
7942 compile_deplibs=`$ECHO " $compile_deplibs" | $SED 's% \([^ $]*\).ltframework% -framework \1%g'`
7943 finalize_deplibs=`$ECHO " $finalize_deplibs" | $SED 's% \([^ $]*\).ltframework% -framework \1%g'`
7948 # move library search paths that coincide with paths to not yet
7949 # installed libraries to the beginning of the library search list
7951 for path in $notinst_path; do
7952 case " $new_libs " in
7953 *" -L$path/$objdir "*) ;;
7955 case " $compile_deplibs " in
7956 *" -L$path/$objdir "*)
7957 func_append new_libs " -L$path/$objdir" ;;
7962 for deplib in $compile_deplibs; do
7965 case " $new_libs " in
7967 *) func_append new_libs " $deplib" ;;
7970 *) func_append new_libs " $deplib" ;;
7973 compile_deplibs="$new_libs"
7976 func_append compile_command " $compile_deplibs"
7977 func_append finalize_command " $finalize_deplibs"
7979 if test -n "$rpath$xrpath"; then
7980 # If the user specified any rpath flags, then add them.
7981 for libdir in $rpath $xrpath; do
7982 # This is the magic to use -rpath.
7983 case "$finalize_rpath " in
7985 *) func_append finalize_rpath " $libdir" ;;
7990 # Now hardcode the library paths
7993 for libdir in $compile_rpath $finalize_rpath; do
7994 if test -n "$hardcode_libdir_flag_spec"; then
7995 if test -n "$hardcode_libdir_separator"; then
7996 if test -z "$hardcode_libdirs"; then
7997 hardcode_libdirs="$libdir"
7999 # Just accumulate the unique libdirs.
8000 case $hardcode_libdir_separator$hardcode_libdirs$hardcode_libdir_separator in
8001 *"$hardcode_libdir_separator$libdir$hardcode_libdir_separator"*)
8004 func_append hardcode_libdirs "$hardcode_libdir_separator$libdir"
8009 eval flag=\"$hardcode_libdir_flag_spec\"
8010 func_append rpath " $flag"
8012 elif test -n "$runpath_var"; then
8013 case "$perm_rpath " in
8015 *) func_append perm_rpath " $libdir" ;;
8019 *-*-cygwin* | *-*-mingw* | *-*-pw32* | *-*-os2* | *-cegcc*)
8020 testbindir=`${ECHO} "$libdir" | ${SED} -e 's*/lib$*/bin*'`
8021 case :$dllsearchpath: in
8023 ::) dllsearchpath=$libdir;;
8024 *) func_append dllsearchpath ":$libdir";;
8026 case :$dllsearchpath: in
8027 *":$testbindir:"*) ;;
8028 ::) dllsearchpath=$testbindir;;
8029 *) func_append dllsearchpath ":$testbindir";;
8034 # Substitute the hardcoded libdirs into the rpath.
8035 if test -n "$hardcode_libdir_separator" &&
8036 test -n "$hardcode_libdirs"; then
8037 libdir="$hardcode_libdirs"
8038 eval rpath=\" $hardcode_libdir_flag_spec\"
8040 compile_rpath="$rpath"
8044 for libdir in $finalize_rpath; do
8045 if test -n "$hardcode_libdir_flag_spec"; then
8046 if test -n "$hardcode_libdir_separator"; then
8047 if test -z "$hardcode_libdirs"; then
8048 hardcode_libdirs="$libdir"
8050 # Just accumulate the unique libdirs.
8051 case $hardcode_libdir_separator$hardcode_libdirs$hardcode_libdir_separator in
8052 *"$hardcode_libdir_separator$libdir$hardcode_libdir_separator"*)
8055 func_append hardcode_libdirs "$hardcode_libdir_separator$libdir"
8060 eval flag=\"$hardcode_libdir_flag_spec\"
8061 func_append rpath " $flag"
8063 elif test -n "$runpath_var"; then
8064 case "$finalize_perm_rpath " in
8066 *) func_append finalize_perm_rpath " $libdir" ;;
8070 # Substitute the hardcoded libdirs into the rpath.
8071 if test -n "$hardcode_libdir_separator" &&
8072 test -n "$hardcode_libdirs"; then
8073 libdir="$hardcode_libdirs"
8074 eval rpath=\" $hardcode_libdir_flag_spec\"
8076 finalize_rpath="$rpath"
8078 if test -n "$libobjs" && test "$build_old_libs" = yes; then
8079 # Transform all the library objects into standard objects.
8080 compile_command=`$ECHO "$compile_command" | $SP2NL | $SED "$lo2o" | $NL2SP`
8081 finalize_command=`$ECHO "$finalize_command" | $SP2NL | $SED "$lo2o" | $NL2SP`
8084 func_generate_dlsyms "$outputname" "@PROGRAM@" "no"
8086 # template prelinking step
8087 if test -n "$prelink_cmds"; then
8088 func_execute_cmds "$prelink_cmds" 'exit $?'
8091 wrappers_required=yes
8093 *cegcc* | *mingw32ce*)
8094 # Disable wrappers for cegcc and mingw32ce hosts, we are cross compiling anyway.
8095 wrappers_required=no
8097 *cygwin* | *mingw* )
8098 if test "$build_libtool_libs" != yes; then
8099 wrappers_required=no
8103 if test "$need_relink" = no || test "$build_libtool_libs" != yes; then
8104 wrappers_required=no
8108 if test "$wrappers_required" = no; then
8109 # Replace the output file specification.
8110 compile_command=`$ECHO "$compile_command" | $SED 's%@OUTPUT@%'"$output"'%g'`
8111 link_command="$compile_command$compile_rpath"
8113 # We have no uninstalled library dependencies, so finalize right now.
8115 func_show_eval "$link_command" 'exit_status=$?'
8117 if test -n "$postlink_cmds"; then
8118 func_to_tool_file "$output"
8119 postlink_cmds=`func_echo_all "$postlink_cmds" | $SED -e 's%@OUTPUT@%'"$output"'%g' -e 's%@TOOL_OUTPUT@%'"$func_to_tool_file_result"'%g'`
8120 func_execute_cmds "$postlink_cmds" 'exit $?'
8123 # Delete the generated files.
8124 if test -f "$output_objdir/${outputname}S.${objext}"; then
8125 func_show_eval '$RM "$output_objdir/${outputname}S.${objext}"'
8131 if test -n "$compile_shlibpath$finalize_shlibpath"; then
8132 compile_command="$shlibpath_var=\"$compile_shlibpath$finalize_shlibpath\$$shlibpath_var\" $compile_command"
8134 if test -n "$finalize_shlibpath"; then
8135 finalize_command="$shlibpath_var=\"$finalize_shlibpath\$$shlibpath_var\" $finalize_command"
8140 if test -n "$runpath_var"; then
8141 if test -n "$perm_rpath"; then
8142 # We should set the runpath_var.
8144 for dir in $perm_rpath; do
8145 func_append rpath "$dir:"
8147 compile_var="$runpath_var=\"$rpath\$$runpath_var\" "
8149 if test -n "$finalize_perm_rpath"; then
8150 # We should set the runpath_var.
8152 for dir in $finalize_perm_rpath; do
8153 func_append rpath "$dir:"
8155 finalize_var="$runpath_var=\"$rpath\$$runpath_var\" "
8159 if test "$no_install" = yes; then
8160 # We don't need to create a wrapper script.
8161 link_command="$compile_var$compile_command$compile_rpath"
8162 # Replace the output file specification.
8163 link_command=`$ECHO "$link_command" | $SED 's%@OUTPUT@%'"$output"'%g'`
8164 # Delete the old output file.
8165 $opt_dry_run || $RM $output
8166 # Link the executable and exit
8167 func_show_eval "$link_command" 'exit $?'
8169 if test -n "$postlink_cmds"; then
8170 func_to_tool_file "$output"
8171 postlink_cmds=`func_echo_all "$postlink_cmds" | $SED -e 's%@OUTPUT@%'"$output"'%g' -e 's%@TOOL_OUTPUT@%'"$func_to_tool_file_result"'%g'`
8172 func_execute_cmds "$postlink_cmds" 'exit $?'
8178 if test "$hardcode_action" = relink; then
8179 # Fast installation is not supported
8180 link_command="$compile_var$compile_command$compile_rpath"
8181 relink_command="$finalize_var$finalize_command$finalize_rpath"
8183 func_warning "this platform does not like uninstalled shared libraries"
8184 func_warning "\`$output' will be relinked during installation"
8186 if test "$fast_install" != no; then
8187 link_command="$finalize_var$compile_command$finalize_rpath"
8188 if test "$fast_install" = yes; then
8189 relink_command=`$ECHO "$compile_var$compile_command$compile_rpath" | $SED 's%@OUTPUT@%\$progdir/\$file%g'`
8191 # fast_install is set to needless
8195 link_command="$compile_var$compile_command$compile_rpath"
8196 relink_command="$finalize_var$finalize_command$finalize_rpath"
8200 # Replace the output file specification.
8201 link_command=`$ECHO "$link_command" | $SED 's%@OUTPUT@%'"$output_objdir/$outputname"'%g'`
8203 # Delete the old output files.
8204 $opt_dry_run || $RM $output $output_objdir/$outputname $output_objdir/lt-$outputname
8206 func_show_eval "$link_command" 'exit $?'
8208 if test -n "$postlink_cmds"; then
8209 func_to_tool_file "$output_objdir/$outputname"
8210 postlink_cmds=`func_echo_all "$postlink_cmds" | $SED -e 's%@OUTPUT@%'"$output_objdir/$outputname"'%g' -e 's%@TOOL_OUTPUT@%'"$func_to_tool_file_result"'%g'`
8211 func_execute_cmds "$postlink_cmds" 'exit $?'
8214 # Now create the wrapper script.
8215 func_verbose "creating $output"
8217 # Quote the relink command for shipping.
8218 if test -n "$relink_command"; then
8219 # Preserve any variables that may affect compiler behavior
8220 for var in $variables_saved_for_relink; do
8221 if eval test -z \"\${$var+set}\"; then
8222 relink_command="{ test -z \"\${$var+set}\" || $lt_unset $var || { $var=; export $var; }; }; $relink_command"
8223 elif eval var_value=\$$var; test -z "$var_value"; then
8224 relink_command="$var=; export $var; $relink_command"
8226 func_quote_for_eval "$var_value"
8227 relink_command="$var=$func_quote_for_eval_result; export $var; $relink_command"
8230 relink_command="(cd `pwd`; $relink_command)"
8231 relink_command=`$ECHO "$relink_command" | $SED "$sed_quote_subst"`
8234 # Only actually do things if not in dry run mode.
8236 # win32 will think the script is a binary if it has
8237 # a .exe suffix, so we strip it off here.
8239 *.exe) func_stripname '' '.exe' "$output"
8240 output=$func_stripname_result ;;
8242 # test for cygwin because mv fails w/o .exe extensions
8246 func_stripname '' '.exe' "$outputname"
8247 outputname=$func_stripname_result ;;
8251 *cygwin* | *mingw* )
8252 func_dirname_and_basename "$output" "" "."
8253 output_name=$func_basename_result
8254 output_path=$func_dirname_result
8255 cwrappersource="$output_path/$objdir/lt-$output_name.c"
8256 cwrapper="$output_path/$output_name.exe"
8257 $RM $cwrappersource $cwrapper
8258 trap "$RM $cwrappersource $cwrapper; exit $EXIT_FAILURE" 1 2 15
8260 func_emit_cwrapperexe_src > $cwrappersource
8262 # The wrapper executable is built using the $host compiler,
8263 # because it contains $host paths and files. If cross-
8264 # compiling, it, like the target executable, must be
8265 # executed on the $host or under an emulation environment.
8267 $LTCC $LTCFLAGS -o $cwrapper $cwrappersource
8271 # Now, create the wrapper script for func_source use:
8272 func_ltwrapper_scriptname $cwrapper
8273 $RM $func_ltwrapper_scriptname_result
8274 trap "$RM $func_ltwrapper_scriptname_result; exit $EXIT_FAILURE" 1 2 15
8276 # note: this script will not be executed, so do not chmod.
8277 if test "x$build" = "x$host" ; then
8278 $cwrapper --lt-dump-script > $func_ltwrapper_scriptname_result
8280 func_emit_wrapper no > $func_ltwrapper_scriptname_result
8286 trap "$RM $output; exit $EXIT_FAILURE" 1 2 15
8288 func_emit_wrapper no > $output
8297 # See if we need to build an old-fashioned archive.
8298 for oldlib in $oldlibs; do
8300 if test "$build_libtool_libs" = convenience; then
8301 oldobjs="$libobjs_save $symfileobj"
8302 addlibs="$convenience"
8303 build_libtool_libs=no
8305 if test "$build_libtool_libs" = module; then
8306 oldobjs="$libobjs_save"
8307 build_libtool_libs=no
8309 oldobjs="$old_deplibs $non_pic_objects"
8310 if test "$preload" = yes && test -f "$symfileobj"; then
8311 func_append oldobjs " $symfileobj"
8314 addlibs="$old_convenience"
8317 if test -n "$addlibs"; then
8318 gentop="$output_objdir/${outputname}x"
8319 func_append generated " $gentop"
8321 func_extract_archives $gentop $addlibs
8322 func_append oldobjs " $func_extract_archives_result"
8325 # Do each command in the archive commands.
8326 if test -n "$old_archive_from_new_cmds" && test "$build_libtool_libs" = yes; then
8327 cmds=$old_archive_from_new_cmds
8330 # Add any objects from preloaded convenience libraries
8331 if test -n "$dlprefiles"; then
8332 gentop="$output_objdir/${outputname}x"
8333 func_append generated " $gentop"
8335 func_extract_archives $gentop $dlprefiles
8336 func_append oldobjs " $func_extract_archives_result"
8339 # POSIX demands no paths to be encoded in archives. We have
8340 # to avoid creating archives with duplicate basenames if we
8341 # might have to extract them afterwards, e.g., when creating a
8342 # static archive out of a convenience library, or when linking
8343 # the entirety of a libtool archive into another (currently
8344 # not supported by libtool).
8345 if (for obj in $oldobjs
8347 func_basename "$obj"
8348 $ECHO "$func_basename_result"
8349 done | sort | sort -uc >/dev/null 2>&1); then
8352 echo "copying selected object files to avoid basename conflicts..."
8353 gentop="$output_objdir/${outputname}x"
8354 func_append generated " $gentop"
8355 func_mkdir_p "$gentop"
8356 save_oldobjs=$oldobjs
8359 for obj in $save_oldobjs
8361 func_basename "$obj"
8362 objbase="$func_basename_result"
8363 case " $oldobjs " in
8364 " ") oldobjs=$obj ;;
8367 # Make sure we don't pick an alternate name that also
8369 newobj=lt$counter-$objbase
8370 func_arith $counter + 1
8371 counter=$func_arith_result
8372 case " $oldobjs " in
8373 *[\ /]"$newobj "*) ;;
8374 *) if test ! -f "$gentop/$newobj"; then break; fi ;;
8377 func_show_eval "ln $obj $gentop/$newobj || cp $obj $gentop/$newobj"
8378 func_append oldobjs " $gentop/$newobj"
8380 *) func_append oldobjs " $obj" ;;
8384 func_to_tool_file "$oldlib" func_convert_file_msys_to_w32
8385 tool_oldlib=$func_to_tool_file_result
8386 eval cmds=\"$old_archive_cmds\"
8389 len=$func_len_result
8390 if test "$len" -lt "$max_cmd_len" || test "$max_cmd_len" -le -1; then
8391 cmds=$old_archive_cmds
8392 elif test -n "$archiver_list_spec"; then
8393 func_verbose "using command file archive linking..."
8396 func_to_tool_file "$obj"
8397 $ECHO "$func_to_tool_file_result"
8398 done > $output_objdir/$libname.libcmd
8399 func_to_tool_file "$output_objdir/$libname.libcmd"
8400 oldobjs=" $archiver_list_spec$func_to_tool_file_result"
8401 cmds=$old_archive_cmds
8403 # the command line is too long to link in one step, link in parts
8404 func_verbose "using piecewise archive linking..."
8409 save_oldobjs=$oldobjs
8411 # Is there a better way of finding the last object in the list?
8412 for obj in $save_oldobjs
8416 eval test_cmds=\"$old_archive_cmds\"
8417 func_len " $test_cmds"
8418 len0=$func_len_result
8420 for obj in $save_oldobjs
8423 func_arith $len + $func_len_result
8424 len=$func_arith_result
8425 func_append objlist " $obj"
8426 if test "$len" -lt "$max_cmd_len"; then
8429 # the above command should be used before it gets too long
8431 if test "$obj" = "$last_oldobj" ; then
8434 test -z "$concat_cmds" || concat_cmds=$concat_cmds~
8435 eval concat_cmds=\"\${concat_cmds}$old_archive_cmds\"
8442 if test "X$oldobjs" = "X" ; then
8443 eval cmds=\"\$concat_cmds\"
8445 eval cmds=\"\$concat_cmds~\$old_archive_cmds\"
8449 func_execute_cmds "$cmds" 'exit $?'
8452 test -n "$generated" && \
8453 func_show_eval "${RM}r$generated"
8455 # Now create the libtool archive.
8459 test "$build_old_libs" = yes && old_library="$libname.$libext"
8460 func_verbose "creating $output"
8462 # Preserve any variables that may affect compiler behavior
8463 for var in $variables_saved_for_relink; do
8464 if eval test -z \"\${$var+set}\"; then
8465 relink_command="{ test -z \"\${$var+set}\" || $lt_unset $var || { $var=; export $var; }; }; $relink_command"
8466 elif eval var_value=\$$var; test -z "$var_value"; then
8467 relink_command="$var=; export $var; $relink_command"
8469 func_quote_for_eval "$var_value"
8470 relink_command="$var=$func_quote_for_eval_result; export $var; $relink_command"
8473 # Quote the link command for shipping.
8474 relink_command="(cd `pwd`; $SHELL $progpath $preserve_args --mode=relink $libtool_args @inst_prefix_dir@)"
8475 relink_command=`$ECHO "$relink_command" | $SED "$sed_quote_subst"`
8476 if test "$hardcode_automatic" = yes ; then
8480 # Only create the output if not a dry run.
8482 for installed in no yes; do
8483 if test "$installed" = yes; then
8484 if test -z "$install_libdir"; then
8487 output="$output_objdir/$outputname"i
8488 # Replace all uninstalled libtool libraries with the installed ones
8490 for deplib in $dependency_libs; do
8493 func_basename "$deplib"
8494 name="$func_basename_result"
8495 func_resolve_sysroot "$deplib"
8496 eval libdir=`${SED} -n -e 's/^libdir=\(.*\)$/\1/p' $func_resolve_sysroot_result`
8497 test -z "$libdir" && \
8498 func_fatal_error "\`$deplib' is not a valid libtool archive"
8499 func_append newdependency_libs " ${lt_sysroot:+=}$libdir/$name"
8502 func_stripname -L '' "$deplib"
8503 func_replace_sysroot "$func_stripname_result"
8504 func_append newdependency_libs " -L$func_replace_sysroot_result"
8507 func_stripname -R '' "$deplib"
8508 func_replace_sysroot "$func_stripname_result"
8509 func_append newdependency_libs " -R$func_replace_sysroot_result"
8511 *) func_append newdependency_libs " $deplib" ;;
8514 dependency_libs="$newdependency_libs"
8517 for lib in $dlfiles; do
8520 func_basename "$lib"
8521 name="$func_basename_result"
8522 eval libdir=`${SED} -n -e 's/^libdir=\(.*\)$/\1/p' $lib`
8523 test -z "$libdir" && \
8524 func_fatal_error "\`$lib' is not a valid libtool archive"
8525 func_append newdlfiles " ${lt_sysroot:+=}$libdir/$name"
8527 *) func_append newdlfiles " $lib" ;;
8530 dlfiles="$newdlfiles"
8532 for lib in $dlprefiles; do
8535 # Only pass preopened files to the pseudo-archive (for
8536 # eventual linking with the app. that links it) if we
8537 # didn't already link the preopened objects directly into
8539 func_basename "$lib"
8540 name="$func_basename_result"
8541 eval libdir=`${SED} -n -e 's/^libdir=\(.*\)$/\1/p' $lib`
8542 test -z "$libdir" && \
8543 func_fatal_error "\`$lib' is not a valid libtool archive"
8544 func_append newdlprefiles " ${lt_sysroot:+=}$libdir/$name"
8548 dlprefiles="$newdlprefiles"
8551 for lib in $dlfiles; do
8553 [\\/]* | [A-Za-z]:[\\/]*) abs="$lib" ;;
8554 *) abs=`pwd`"/$lib" ;;
8556 func_append newdlfiles " $abs"
8558 dlfiles="$newdlfiles"
8560 for lib in $dlprefiles; do
8562 [\\/]* | [A-Za-z]:[\\/]*) abs="$lib" ;;
8563 *) abs=`pwd`"/$lib" ;;
8565 func_append newdlprefiles " $abs"
8567 dlprefiles="$newdlprefiles"
8570 # place dlname in correct position for cygwin
8571 # In fact, it would be nice if we could use this code for all target
8572 # systems that can't hard-code library paths into their executables
8573 # and that have no shared library path variable independent of PATH,
8574 # but it turns out we can't easily determine that from inspecting
8575 # libtool variables, so we have to hard-code the OSs to which it
8576 # applies here; at the moment, that means platforms that use the PE
8577 # object format with DLL files. See the long comment at the top of
8578 # tests/bindir.at for full details.
8580 case $host,$output,$installed,$module,$dlname in
8581 *cygwin*,*lai,yes,no,*.dll | *mingw*,*lai,yes,no,*.dll | *cegcc*,*lai,yes,no,*.dll)
8582 # If a -bindir argument was supplied, place the dll there.
8583 if test "x$bindir" != x ;
8585 func_relative_path "$install_libdir" "$bindir"
8586 tdlname=$func_relative_path_result$dlname
8588 # Otherwise fall back on heuristic.
8589 tdlname=../bin/$dlname
8594 # $outputname - a libtool library file
8595 # Generated by $PROGRAM (GNU $PACKAGE$TIMESTAMP) $VERSION
8597 # Please DO NOT delete this file!
8598 # It is necessary for linking the library.
8600 # The name that we can dlopen(3).
8603 # Names of this library.
8604 library_names='$library_names'
8606 # The name of the static archive.
8607 old_library='$old_library'
8609 # Linker flags that can not go in dependency_libs.
8610 inherited_linker_flags='$new_inherited_linker_flags'
8612 # Libraries that this one depends upon.
8613 dependency_libs='$dependency_libs'
8615 # Names of additional weak libraries provided by this library
8616 weak_library_names='$weak_libs'
8618 # Version information for $libname.
8623 # Is this an already installed library?
8624 installed=$installed
8626 # Should we warn about portability when linking against -modules?
8627 shouldnotlink=$module
8629 # Files to dlopen/dlpreopen
8631 dlpreopen='$dlprefiles'
8633 # Directory that this library needs to be installed in:
8634 libdir='$install_libdir'"
8635 if test "$installed" = no && test "$need_relink" = yes; then
8637 relink_command=\"$relink_command\""
8642 # Do a symbolic link so that the libtool archive can be found in
8643 # LD_LIBRARY_PATH before the program is installed.
8644 func_show_eval '( cd "$output_objdir" && $RM "$outputname" && $LN_S "../$outputname" "$outputname" )' 'exit $?'
8650 { test "$opt_mode" = link || test "$opt_mode" = relink; } &&
8651 func_mode_link ${1+"$@"}
8654 # func_mode_uninstall arg...
8655 func_mode_uninstall ()
8663 # This variable tells wrapper scripts just to set variables rather
8664 # than running their programs.
8665 libtool_install_magic="$magic"
8670 -f) func_append RM " $arg"; rmforce=yes ;;
8671 -*) func_append RM " $arg" ;;
8672 *) func_append files " $arg" ;;
8677 func_fatal_help "you must specify an RM program"
8681 for file in $files; do
8682 func_dirname "$file" "" "."
8683 dir="$func_dirname_result"
8684 if test "X$dir" = X.; then
8689 func_basename "$file"
8690 name="$func_basename_result"
8691 test "$opt_mode" = uninstall && odir="$dir"
8693 # Remember odir for removal later, being careful to avoid duplicates
8694 if test "$opt_mode" = clean; then
8697 *) func_append rmdirs " $odir" ;;
8701 # Don't error if the file doesn't exist and rm -f was used.
8702 if { test -L "$file"; } >/dev/null 2>&1 ||
8703 { test -h "$file"; } >/dev/null 2>&1 ||
8704 test -f "$file"; then
8706 elif test -d "$file"; then
8709 elif test "$rmforce" = yes; then
8717 # Possibly a libtool archive, so verify it.
8718 if func_lalib_p "$file"; then
8719 func_source $dir/$name
8721 # Delete the libtool libraries and symlinks.
8722 for n in $library_names; do
8723 func_append rmfiles " $odir/$n"
8725 test -n "$old_library" && func_append rmfiles " $odir/$old_library"
8729 case " $library_names " in
8731 *) test -n "$dlname" && func_append rmfiles " $odir/$dlname" ;;
8733 test -n "$libdir" && func_append rmfiles " $odir/$name $odir/${name}i"
8736 if test -n "$library_names"; then
8737 # Do each command in the postuninstall commands.
8738 func_execute_cmds "$postuninstall_cmds" 'test "$rmforce" = yes || exit_status=1'
8741 if test -n "$old_library"; then
8742 # Do each command in the old_postuninstall commands.
8743 func_execute_cmds "$old_postuninstall_cmds" 'test "$rmforce" = yes || exit_status=1'
8745 # FIXME: should reinstall the best remaining shared library.
8752 # Possibly a libtool object, so verify it.
8753 if func_lalib_p "$file"; then
8756 func_source $dir/$name
8758 # Add PIC object to the list of files to remove.
8759 if test -n "$pic_object" &&
8760 test "$pic_object" != none; then
8761 func_append rmfiles " $dir/$pic_object"
8764 # Add non-PIC object to the list of files to remove.
8765 if test -n "$non_pic_object" &&
8766 test "$non_pic_object" != none; then
8767 func_append rmfiles " $dir/$non_pic_object"
8773 if test "$opt_mode" = clean ; then
8777 func_stripname '' '.exe' "$file"
8778 file=$func_stripname_result
8779 func_stripname '' '.exe' "$name"
8780 noexename=$func_stripname_result
8781 # $file with .exe has already been added to rmfiles,
8782 # add $file without .exe
8783 func_append rmfiles " $file"
8786 # Do a test to see if this is a libtool program.
8787 if func_ltwrapper_p "$file"; then
8788 if func_ltwrapper_executable_p "$file"; then
8789 func_ltwrapper_scriptname "$file"
8791 func_source $func_ltwrapper_scriptname_result
8792 func_append rmfiles " $func_ltwrapper_scriptname_result"
8795 func_source $dir/$noexename
8798 # note $name still contains .exe if it was in $file originally
8799 # as does the version of $file that was added into $rmfiles
8800 func_append rmfiles " $odir/$name $odir/${name}S.${objext}"
8801 if test "$fast_install" = yes && test -n "$relink_command"; then
8802 func_append rmfiles " $odir/lt-$name"
8804 if test "X$noexename" != "X$name" ; then
8805 func_append rmfiles " $odir/lt-${noexename}.c"
8811 func_show_eval "$RM $rmfiles" 'exit_status=1'
8814 # Try to remove the ${objdir}s in the directories where we deleted files
8815 for dir in $rmdirs; do
8816 if test -d "$dir"; then
8817 func_show_eval "rmdir $dir >/dev/null 2>&1"
8824 { test "$opt_mode" = uninstall || test "$opt_mode" = clean; } &&
8825 func_mode_uninstall ${1+"$@"}
8827 test -z "$opt_mode" && {
8828 help="$generic_help"
8829 func_fatal_help "you must specify a MODE"
8832 test -z "$exec_cmd" && \
8833 func_fatal_help "invalid operation mode \`$opt_mode'"
8835 if test -n "$exec_cmd"; then
8836 eval exec "$exec_cmd"
8843 # The TAGs below are defined such that we never get into a situation
8844 # in which we disable both kinds of libraries. Given conflicting
8845 # choices, we go for a static library, that is the most portable,
8846 # since we can't tell whether shared libraries were disabled because
8847 # the user asked for that or because the platform doesn't support
8848 # them. This is particularly important on AIX, because we don't
8849 # support having both static and shared libraries enabled at the same
8850 # time on that platform, so we default to a shared-only configuration.
8851 # If a disable-shared tag is given, we'll fallback to a static-only
8852 # configuration. But we'll never go from static-only to shared-only.
8854 # ### BEGIN LIBTOOL TAG CONFIG: disable-shared
8855 build_libtool_libs=no
8857 # ### END LIBTOOL TAG CONFIG: disable-shared
8859 # ### BEGIN LIBTOOL TAG CONFIG: disable-static
8860 build_old_libs=`case $build_libtool_libs in yes) echo no;; *) echo yes;; esac`
8861 # ### END LIBTOOL TAG CONFIG: disable-static