2 # libtool (GNU libtool) 2.4.2
3 # Written by Gordon Matzigkeit <gord@gnu.ai.mit.edu>, 1996
5 # Copyright (C) 1996, 1997, 1998, 1999, 2000, 2001, 2003, 2004, 2005, 2006,
6 # 2007, 2008, 2009, 2010, 2011 Free Software Foundation, Inc.
7 # This is free software; see the source for copying conditions. There is NO
8 # warranty; not even for MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
10 # GNU Libtool is free software; you can redistribute it and/or modify
11 # it under the terms of the GNU General Public License as published by
12 # the Free Software Foundation; either version 2 of the License, or
13 # (at your option) any later version.
15 # As a special exception to the GNU General Public License,
16 # if you distribute this file as part of a program or library that
17 # is built using GNU Libtool, you may include this file under the
18 # same distribution terms that you use for the rest of that program.
20 # GNU Libtool is distributed in the hope that it will be useful, but
21 # WITHOUT ANY WARRANTY; without even the implied warranty of
22 # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
23 # General Public License for more details.
25 # You should have received a copy of the GNU General Public License
26 # along with GNU Libtool; see the file COPYING. If not, a copy
27 # can be downloaded from http://www.gnu.org/licenses/gpl.html,
28 # or obtained by writing to the Free Software Foundation, Inc.,
29 # 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
31 # Usage: $progname [OPTION]... [MODE-ARG]...
33 # Provide generalized library-building support services.
35 # --config show all configuration variables
36 # --debug enable verbose shell tracing
37 # -n, --dry-run display commands without modifying any files
38 # --features display basic configuration information and exit
39 # --mode=MODE use operation mode MODE
40 # --preserve-dup-deps don't remove duplicate dependency libraries
41 # --quiet, --silent don't print informational messages
42 # --no-quiet, --no-silent
43 # print informational messages (default)
44 # --no-warn don't display warning messages
45 # --tag=TAG use configuration variables from tag TAG
46 # -v, --verbose print more informational messages than default
47 # --no-verbose don't print the extra informational messages
48 # --version print version information
49 # -h, --help, --help-all print short, long, or detailed help message
51 # MODE must be one of the following:
53 # clean remove files from the build directory
54 # compile compile a source file into a libtool object
55 # execute automatically set library path, then run a program
56 # finish complete the installation of libtool libraries
57 # install install libraries or executables
58 # link create a library or an executable
59 # uninstall remove libraries from an installed directory
61 # MODE-ARGS vary depending on the MODE. When passed as first option,
62 # `--mode=MODE' may be abbreviated as `MODE' or a unique abbreviation of that.
63 # Try `$progname --help --mode=MODE' for a more detailed description of MODE.
65 # When reporting a bug, please describe a test case to reproduce it and
66 # include the following information:
71 # compiler flags: $LTCFLAGS
72 # linker: $LD (gnu? $with_gnu_ld)
73 # $progname: (GNU libtool) 2.4.2 Debian-2.4.2-1
74 # automake: $automake_version
75 # autoconf: $autoconf_version
77 # Report bugs to <bug-libtool@gnu.org>.
78 # GNU libtool home page: <http://www.gnu.org/software/libtool/>.
79 # General help using GNU software: <http://www.gnu.org/gethelp/>.
83 VERSION="2.4.2 Debian-2.4.2-1"
85 package_revision=1.3337
87 # Be Bourne compatible
88 if test -n "${ZSH_VERSION+set}" && (emulate sh) >/dev/null 2>&1; then
91 # Zsh 3.x and 4.x performs word splitting on ${1+"$@"}, which
92 # is contrary to our usage. Disable this feature.
93 alias -g '${1+"$@"}'='"$@"'
96 case `(set -o) 2>/dev/null` in *posix*) set -o posix;; esac
98 BIN_SH=xpg4; export BIN_SH # for Tru64
99 DUALCASE=1; export DUALCASE # for MKS sh
101 # A function that is used when there is no print builtin or printf.
102 func_fallback_echo ()
104 eval 'cat <<_LTECHO_EOF
109 # NLS nuisances: We save the old values to restore during execute mode.
112 for lt_var in LANG LANGUAGE LC_ALL LC_CTYPE LC_COLLATE LC_MESSAGES
114 eval "if test \"\${$lt_var+set}\" = set; then
115 save_$lt_var=\$$lt_var
118 lt_user_locale=\"$lt_var=\\\$save_\$lt_var; \$lt_user_locale\"
119 lt_safe_locale=\"$lt_var=C; \$lt_safe_locale\"
124 export LANGUAGE LC_ALL
129 # Work around backward compatibility issue on IRIX 6.5. On IRIX 6.4+, sh
130 # is ksh but when the shell is invoked as "sh" and the current value of
131 # the _XPG environment variable is not equal to 1 (one), the special
132 # positional parameter $0, within a function call, is the name of the
139 test "${ECHO+set}" = set || ECHO=${as_echo-'printf %s\n'}
144 : ${SHELL="${CONFIG_SHELL-/bin/sh}"}
145 : ${Xsed="$SED -e 1s/^X//"}
150 EXIT_MISMATCH=63 # $? = 63 is used to indicate version mismatch to missing.
151 EXIT_SKIP=77 # $? = 77 is used to indicate a skipped test to automake.
153 exit_status=$EXIT_SUCCESS
155 # Make sure IFS has a sensible default
160 dirname="s,/[^/]*$,,"
163 # func_dirname file append nondir_replacement
164 # Compute the dirname of FILE. If nonempty, add APPEND to the result,
165 # otherwise set result to NONDIR_REPLACEMENT.
168 func_dirname_result=`$ECHO "${1}" | $SED "$dirname"`
169 if test "X$func_dirname_result" = "X${1}"; then
170 func_dirname_result="${3}"
172 func_dirname_result="$func_dirname_result${2}"
174 } # func_dirname may be replaced by extended shell implementation
180 func_basename_result=`$ECHO "${1}" | $SED "$basename"`
181 } # func_basename may be replaced by extended shell implementation
184 # func_dirname_and_basename file append nondir_replacement
185 # perform func_basename and func_dirname in a single function
187 # dirname: Compute the dirname of FILE. If nonempty,
188 # add APPEND to the result, otherwise set result
189 # to NONDIR_REPLACEMENT.
190 # value returned in "$func_dirname_result"
191 # basename: Compute filename of FILE.
192 # value retuned in "$func_basename_result"
193 # Implementation must be kept synchronized with func_dirname
194 # and func_basename. For efficiency, we do not delegate to
195 # those functions but instead duplicate the functionality here.
196 func_dirname_and_basename ()
198 # Extract subdirectory from the argument.
199 func_dirname_result=`$ECHO "${1}" | $SED -e "$dirname"`
200 if test "X$func_dirname_result" = "X${1}"; then
201 func_dirname_result="${3}"
203 func_dirname_result="$func_dirname_result${2}"
205 func_basename_result=`$ECHO "${1}" | $SED -e "$basename"`
206 } # func_dirname_and_basename may be replaced by extended shell implementation
209 # func_stripname prefix suffix name
210 # strip PREFIX and SUFFIX off of NAME.
211 # PREFIX and SUFFIX must not contain globbing or regex special
212 # characters, hashes, percent signs, but SUFFIX may contain a leading
213 # dot (in which case that matches only a dot).
214 # func_strip_suffix prefix name
218 .*) func_stripname_result=`$ECHO "${3}" | $SED "s%^${1}%%; s%\\\\${2}\$%%"`;;
219 *) func_stripname_result=`$ECHO "${3}" | $SED "s%^${1}%%; s%${2}\$%%"`;;
221 } # func_stripname may be replaced by extended shell implementation
224 # These SED scripts presuppose an absolute path with a trailing slash.
225 pathcar='s,^/\([^/]*\).*$,\1,'
226 pathcdr='s,^/[^/]*,,'
227 removedotparts=':dotsl
231 collapseslashes='s@/\{1,\}@/@g'
232 finalslash='s,/*$,/,'
234 # func_normal_abspath PATH
235 # Remove doubled-up and trailing slashes, "." path components,
236 # and cancel out any ".." path components in PATH after making
237 # it an absolute path.
238 # value returned in "$func_normal_abspath_result"
239 func_normal_abspath ()
241 # Start from root dir and reassemble the path.
242 func_normal_abspath_result=
243 func_normal_abspath_tpath=$1
244 func_normal_abspath_altnamespace=
245 case $func_normal_abspath_tpath in
247 # Empty path, that just means $cwd.
248 func_stripname '' '/' "`pwd`"
249 func_normal_abspath_result=$func_stripname_result
252 # The next three entries are used to spot a run of precisely
253 # two leading slashes without using negated character classes;
254 # we take advantage of case's first-match behaviour.
256 # Unusual form of absolute path, do nothing.
259 # Not necessarily an ordinary path; POSIX reserves leading '//'
260 # and for example Cygwin uses it to access remote file shares
261 # over CIFS/SMB, so we conserve a leading double slash if found.
262 func_normal_abspath_altnamespace=/
265 # Absolute path, do nothing.
268 # Relative path, prepend $cwd.
269 func_normal_abspath_tpath=`pwd`/$func_normal_abspath_tpath
272 # Cancel out all the simple stuff to save iterations. We also want
273 # the path to end with a slash for ease of parsing, so make sure
274 # there is one (and only one) here.
275 func_normal_abspath_tpath=`$ECHO "$func_normal_abspath_tpath" | $SED \
276 -e "$removedotparts" -e "$collapseslashes" -e "$finalslash"`
278 # Processed it all yet?
279 if test "$func_normal_abspath_tpath" = / ; then
280 # If we ascended to the root using ".." the result may be empty now.
281 if test -z "$func_normal_abspath_result" ; then
282 func_normal_abspath_result=/
286 func_normal_abspath_tcomponent=`$ECHO "$func_normal_abspath_tpath" | $SED \
288 func_normal_abspath_tpath=`$ECHO "$func_normal_abspath_tpath" | $SED \
290 # Figure out what to do with it
291 case $func_normal_abspath_tcomponent in
293 # Trailing empty path component, ignore it.
296 # Parent dir; strip last assembled component from result.
297 func_dirname "$func_normal_abspath_result"
298 func_normal_abspath_result=$func_dirname_result
301 # Actual path component, append it.
302 func_normal_abspath_result=$func_normal_abspath_result/$func_normal_abspath_tcomponent
306 # Restore leading double-slash if one was found on entry.
307 func_normal_abspath_result=$func_normal_abspath_altnamespace$func_normal_abspath_result
310 # func_relative_path SRCDIR DSTDIR
311 # generates a relative path from SRCDIR to DSTDIR, with a trailing
312 # slash if non-empty, suitable for immediately appending a filename
313 # without needing to append a separator.
314 # value returned in "$func_relative_path_result"
315 func_relative_path ()
317 func_relative_path_result=
318 func_normal_abspath "$1"
319 func_relative_path_tlibdir=$func_normal_abspath_result
320 func_normal_abspath "$2"
321 func_relative_path_tbindir=$func_normal_abspath_result
323 # Ascend the tree starting from libdir
325 # check if we have found a prefix of bindir
326 case $func_relative_path_tbindir in
327 $func_relative_path_tlibdir)
328 # found an exact match
329 func_relative_path_tcancelled=
332 $func_relative_path_tlibdir*)
333 # found a matching prefix
334 func_stripname "$func_relative_path_tlibdir" '' "$func_relative_path_tbindir"
335 func_relative_path_tcancelled=$func_stripname_result
336 if test -z "$func_relative_path_result"; then
337 func_relative_path_result=.
342 func_dirname $func_relative_path_tlibdir
343 func_relative_path_tlibdir=${func_dirname_result}
344 if test "x$func_relative_path_tlibdir" = x ; then
345 # Have to descend all the way to the root!
346 func_relative_path_result=../$func_relative_path_result
347 func_relative_path_tcancelled=$func_relative_path_tbindir
350 func_relative_path_result=../$func_relative_path_result
355 # Now calculate path; take care to avoid doubling-up slashes.
356 func_stripname '' '/' "$func_relative_path_result"
357 func_relative_path_result=$func_stripname_result
358 func_stripname '/' '/' "$func_relative_path_tcancelled"
359 if test "x$func_stripname_result" != x ; then
360 func_relative_path_result=${func_relative_path_result}/${func_stripname_result}
363 # Normalisation. If bindir is libdir, return empty string,
364 # else relative path ending with a slash; either way, target
365 # file name can be directly appended.
366 if test ! -z "$func_relative_path_result"; then
367 func_stripname './' '' "$func_relative_path_result/"
368 func_relative_path_result=$func_stripname_result
372 # The name of this program:
373 func_dirname_and_basename "$progpath"
374 progname=$func_basename_result
376 # Make sure we have an absolute path for reexecution:
378 [\\/]*|[A-Za-z]:\\*) ;;
380 progdir=$func_dirname_result
381 progdir=`cd "$progdir" && pwd`
382 progpath="$progdir/$progname"
386 IFS=${PATH_SEPARATOR-:}
387 for progdir in $PATH; do
389 test -x "$progdir/$progname" && break
392 test -n "$progdir" || progdir=`pwd`
393 progpath="$progdir/$progname"
397 # Sed substitution that helps us do robust quoting. It backslashifies
398 # metacharacters that are still active within double-quoted strings.
399 Xsed="${SED}"' -e 1s/^X//'
400 sed_quote_subst='s/\([`"$\\]\)/\\\1/g'
402 # Same as above, but do not quote variable references.
403 double_quote_subst='s/\(["`\\]\)/\\\1/g'
405 # Sed substitution that turns a string into a regex matching for the
407 sed_make_literal_regex='s,[].[^$\\*\/],\\&,g'
409 # Sed substitution that converts a w32 file name or path
410 # which contains forward slashes, into one that contains
411 # (escaped) backslashes. A very naive implementation.
412 lt_sed_naive_backslashify='s|\\\\*|\\|g;s|/|\\|g;s|\\|\\\\|g'
414 # Sed substitution to remove simple comments and empty
415 # lines from a Windows .def file.
416 sed_uncomment_deffile='/^;/d; /^[ ]*$/d'
418 # Re-`\' parameter expansions in output of double_quote_subst that were
419 # `\'-ed in input to the same. If an odd number of `\' preceded a '$'
420 # in input to double_quote_subst, that '$' was protected from expansion.
421 # Since each input `\' is now two `\'s, look for any number of runs of
422 # four `\'s followed by two `\'s and then a '$'. `\' that '$'.
427 sed_double_backslash="\
431 s/\\([^$bs]\\)$bs2$dollar/\\1$bs2$bs$dollar/g
442 # Echo program name prefixed message, along with the current mode
443 # name if it has been set yet.
446 $ECHO "$progname: ${opt_mode+$opt_mode: }$*"
449 # func_verbose arg...
450 # Echo program name prefixed message in verbose mode only.
453 $opt_verbose && func_echo ${1+"$@"}
455 # A bug in bash halts the script if the last line of a function
456 # fails when set -e is in force, so we need another command to
461 # func_echo_all arg...
462 # Invoke $ECHO with all args, space-separated.
469 # Echo program name prefixed message to standard error.
472 $ECHO "$progname: ${opt_mode+$opt_mode: }"${1+"$@"} 1>&2
475 # func_warning arg...
476 # Echo program name prefixed warning message to standard error.
479 $opt_warning && $ECHO "$progname: ${opt_mode+$opt_mode: }warning: "${1+"$@"} 1>&2
485 # func_fatal_error arg...
486 # Echo program name prefixed message to standard error, and exit.
493 # func_fatal_help arg...
494 # Echo program name prefixed message to standard error, followed by
495 # a help hint, and exit.
499 func_fatal_error "$help"
501 help="Try \`$progname --help' for more information." ## default
504 # func_grep expression filename
505 # Check whether EXPRESSION matches any line of FILENAME, without output.
508 $GREP "$1" "$2" >/dev/null 2>&1
512 # func_mkdir_p directory-path
513 # Make sure the entire path to DIRECTORY-PATH is available.
516 my_directory_path="$1"
519 if test -n "$my_directory_path" && test "$opt_dry_run" != ":"; then
521 # Protect directory names starting with `-'
522 case $my_directory_path in
523 -*) my_directory_path="./$my_directory_path" ;;
526 # While some portion of DIR does not yet exist...
527 while test ! -d "$my_directory_path"; do
528 # ...make a list in topmost first order. Use a colon delimited
529 # list incase some portion of path contains whitespace.
530 my_dir_list="$my_directory_path:$my_dir_list"
532 # If the last portion added has no slash in it, the list is done
533 case $my_directory_path in */*) ;; *) break ;; esac
535 # ...otherwise throw away the child directory and loop
536 my_directory_path=`$ECHO "$my_directory_path" | $SED -e "$dirname"`
538 my_dir_list=`$ECHO "$my_dir_list" | $SED 's,:*$,,'`
540 save_mkdir_p_IFS="$IFS"; IFS=':'
541 for my_dir in $my_dir_list; do
542 IFS="$save_mkdir_p_IFS"
543 # mkdir can fail with a `File exist' error if two processes
544 # try to create one of the directories concurrently. Don't
546 $MKDIR "$my_dir" 2>/dev/null || :
548 IFS="$save_mkdir_p_IFS"
550 # Bail out if we (or some other process) failed to create a directory.
551 test -d "$my_directory_path" || \
552 func_fatal_error "Failed to create \`$1'"
557 # func_mktempdir [string]
558 # Make a temporary directory that won't clash with other running
559 # libtool processes, and avoids race conditions if possible. If
560 # given, STRING is the basename for that directory.
563 my_template="${TMPDIR-/tmp}/${1-$progname}"
565 if test "$opt_dry_run" = ":"; then
566 # Return a directory name, but don't create it in dry-run mode
567 my_tmpdir="${my_template}-$$"
570 # If mktemp works, use that first and foremost
571 my_tmpdir=`mktemp -d "${my_template}-XXXXXXXX" 2>/dev/null`
573 if test ! -d "$my_tmpdir"; then
574 # Failing that, at least try and use $RANDOM to avoid a race
575 my_tmpdir="${my_template}-${RANDOM-0}$$"
577 save_mktempdir_umask=`umask`
580 umask $save_mktempdir_umask
583 # If we're not in dry-run mode, bomb out on failure
584 test -d "$my_tmpdir" || \
585 func_fatal_error "cannot create temporary directory \`$my_tmpdir'"
592 # func_quote_for_eval arg
593 # Aesthetically quote ARG to be evaled later.
594 # This function returns two values: FUNC_QUOTE_FOR_EVAL_RESULT
595 # is double-quoted, suitable for a subsequent eval, whereas
596 # FUNC_QUOTE_FOR_EVAL_UNQUOTED_RESULT has merely all characters
597 # which are still active within double quotes backslashified.
598 func_quote_for_eval ()
602 func_quote_for_eval_unquoted_result=`$ECHO "$1" | $SED "$sed_quote_subst"` ;;
604 func_quote_for_eval_unquoted_result="$1" ;;
607 case $func_quote_for_eval_unquoted_result in
608 # Double-quote args containing shell metacharacters to delay
609 # word splitting, command substitution and and variable
610 # expansion for a subsequent eval.
611 # Many Bourne shells cannot handle close brackets correctly
612 # in scan sets, so we specify it separately.
613 *[\[\~\#\^\&\*\(\)\{\}\|\;\<\>\?\'\ \ ]*|*]*|"")
614 func_quote_for_eval_result="\"$func_quote_for_eval_unquoted_result\""
617 func_quote_for_eval_result="$func_quote_for_eval_unquoted_result"
622 # func_quote_for_expand arg
623 # Aesthetically quote ARG to be evaled later; same as above,
624 # but do not quote variable references.
625 func_quote_for_expand ()
629 my_arg=`$ECHO "$1" | $SED \
630 -e "$double_quote_subst" -e "$sed_double_backslash"` ;;
636 # Double-quote args containing shell metacharacters to delay
637 # word splitting and command substitution for a subsequent eval.
638 # Many Bourne shells cannot handle close brackets correctly
639 # in scan sets, so we specify it separately.
640 *[\[\~\#\^\&\*\(\)\{\}\|\;\<\>\?\'\ \ ]*|*]*|"")
645 func_quote_for_expand_result="$my_arg"
649 # func_show_eval cmd [fail_exp]
650 # Unless opt_silent is true, then output CMD. Then, if opt_dryrun is
651 # not true, evaluate CMD. If the evaluation of CMD fails, and FAIL_EXP
652 # is given, then evaluate it.
658 ${opt_silent-false} || {
659 func_quote_for_expand "$my_cmd"
660 eval "func_echo $func_quote_for_expand_result"
663 if ${opt_dry_run-false}; then :; else
666 if test "$my_status" -eq 0; then :; else
667 eval "(exit $my_status); $my_fail_exp"
673 # func_show_eval_locale cmd [fail_exp]
674 # Unless opt_silent is true, then output CMD. Then, if opt_dryrun is
675 # not true, evaluate CMD. If the evaluation of CMD fails, and FAIL_EXP
676 # is given, then evaluate it. Use the saved locale for evaluation.
677 func_show_eval_locale ()
682 ${opt_silent-false} || {
683 func_quote_for_expand "$my_cmd"
684 eval "func_echo $func_quote_for_expand_result"
687 if ${opt_dry_run-false}; then :; else
688 eval "$lt_user_locale
691 eval "$lt_safe_locale"
692 if test "$my_status" -eq 0; then :; else
693 eval "(exit $my_status); $my_fail_exp"
699 # Turn $1 into a string suitable for a shell variable name.
700 # Result is stored in $func_tr_sh_result. All characters
701 # not in the set a-zA-Z0-9_ are replaced with '_'. Further,
702 # if $1 begins with a digit, a '_' is prepended as well.
706 [0-9]* | *[!a-zA-Z0-9_]*)
707 func_tr_sh_result=`$ECHO "$1" | $SED 's/^\([0-9]\)/_\1/; s/[^a-zA-Z0-9_]/_/g'`
717 # Echo version message to standard output and exit.
730 /^# '$PROGRAM' (GNU /,/# warranty; / {
733 s/\((C)\)[ 0-9,-]*\( [1-9][0-9]*\)/\1\2/
740 # Echo short help message to standard output and exit.
745 $SED -n '/^# Usage:/,/^# *.*--help/ {
748 s/\$progname/'$progname'/
752 $ECHO "run \`$progname --help | more' for full usage"
757 # Echo long help message to standard output and exit,
758 # unless 'noexit' is passed as argument.
763 $SED -n '/^# Usage:/,/# Report bugs to/ {
767 s*\$progname*'$progname'*
769 s*\$SHELL*'"$SHELL"'*
771 s*\$LTCFLAGS*'"$LTCFLAGS"'*
773 s/\$with_gnu_ld/'"$with_gnu_ld"'/
774 s/\$automake_version/'"`(${AUTOMAKE-automake} --version) 2>/dev/null |$SED 1q`"'/
775 s/\$autoconf_version/'"`(${AUTOCONF-autoconf} --version) 2>/dev/null |$SED 1q`"'/
779 /^# .* home page:/b print
780 /^# General help using/b print
783 if test -z "$1"; then
788 # func_missing_arg argname
789 # Echo program name prefixed message to standard error and set global
795 func_error "missing argument for $1."
800 # func_split_short_opt shortopt
801 # Set func_split_short_opt_name and func_split_short_opt_arg shell
802 # variables after splitting SHORTOPT after the 2nd character.
803 func_split_short_opt ()
805 my_sed_short_opt='1s/^\(..\).*$/\1/;q'
806 my_sed_short_rest='1s/^..\(.*\)$/\1/;q'
808 func_split_short_opt_name=`$ECHO "$1" | $SED "$my_sed_short_opt"`
809 func_split_short_opt_arg=`$ECHO "$1" | $SED "$my_sed_short_rest"`
810 } # func_split_short_opt may be replaced by extended shell implementation
813 # func_split_long_opt longopt
814 # Set func_split_long_opt_name and func_split_long_opt_arg shell
815 # variables after splitting LONGOPT at the `=' sign.
816 func_split_long_opt ()
818 my_sed_long_opt='1s/^\(--[^=]*\)=.*/\1/;q'
819 my_sed_long_arg='1s/^--[^=]*=//'
821 func_split_long_opt_name=`$ECHO "$1" | $SED "$my_sed_long_opt"`
822 func_split_long_opt_arg=`$ECHO "$1" | $SED "$my_sed_long_arg"`
823 } # func_split_long_opt may be replaced by extended shell implementation
831 magic="%%%MAGIC variable%%%"
832 magic_exe="%%%MAGIC EXE variable%%%"
837 lo2o="s/\\.lo\$/.${objext}/"
838 o2lo="s/\\.${objext}\$/.lo/"
842 # If this variable is set in any of the actions, the command in it
843 # will be execed at the end. This prevents here-documents from being
844 # left over by shells.
847 # func_append var value
848 # Append VALUE to the end of shell variable VAR.
851 eval "${1}=\$${1}\${2}"
852 } # func_append may be replaced by extended shell implementation
854 # func_append_quoted var value
855 # Quote VALUE and append to the end of shell variable VAR, separated
857 func_append_quoted ()
859 func_quote_for_eval "${2}"
860 eval "${1}=\$${1}\\ \$func_quote_for_eval_result"
861 } # func_append_quoted may be replaced by extended shell implementation
864 # func_arith arithmetic-term...
867 func_arith_result=`expr "${@}"`
868 } # func_arith may be replaced by extended shell implementation
872 # STRING may not start with a hyphen.
875 func_len_result=`expr "${1}" : ".*" 2>/dev/null || echo $max_cmd_len`
876 } # func_len may be replaced by extended shell implementation
882 func_lo2o_result=`$ECHO "${1}" | $SED "$lo2o"`
883 } # func_lo2o may be replaced by extended shell implementation
886 # func_xform libobj-or-source
889 func_xform_result=`$ECHO "${1}" | $SED 's/\.[^.]*$/.lo/'`
890 } # func_xform may be replaced by extended shell implementation
893 # func_fatal_configuration arg...
894 # Echo program name prefixed message to standard error, followed by
895 # a configuration failure hint, and exit.
896 func_fatal_configuration ()
899 func_error "See the $PACKAGE documentation for more information."
900 func_fatal_error "Fatal configuration error."
905 # Display the configuration for all the tags in this script.
908 re_begincf='^# ### BEGIN LIBTOOL'
909 re_endcf='^# ### END LIBTOOL'
911 # Default configuration.
912 $SED "1,/$re_begincf CONFIG/d;/$re_endcf CONFIG/,\$d" < "$progpath"
914 # Now print the configurations for the tags.
915 for tagname in $taglist; do
916 $SED -n "/$re_begincf TAG CONFIG: $tagname\$/,/$re_endcf TAG CONFIG: $tagname\$/p" < "$progpath"
923 # Display the features supported by this script.
927 if test "$build_libtool_libs" = yes; then
928 echo "enable shared libraries"
930 echo "disable shared libraries"
932 if test "$build_old_libs" = yes; then
933 echo "enable static libraries"
935 echo "disable static libraries"
941 # func_enable_tag tagname
942 # Verify that TAGNAME is valid, and either flag an error and exit, or
943 # enable the TAGNAME tag. We also add TAGNAME to the global $taglist
950 re_begincf="^# ### BEGIN LIBTOOL TAG CONFIG: $tagname\$"
951 re_endcf="^# ### END LIBTOOL TAG CONFIG: $tagname\$"
952 sed_extractcf="/$re_begincf/,/$re_endcf/p"
957 func_fatal_error "invalid tag name: $tagname"
961 # Don't test for the "default" C tag, as we know it's
962 # there but not specially marked.
966 if $GREP "$re_begincf" "$progpath" >/dev/null 2>&1; then
967 taglist="$taglist $tagname"
969 # Evaluate the configuration. Be careful to quote the path
970 # and the sed script, to avoid splitting on whitespace, but
971 # also don't use non-portable quotes within backquotes within
972 # quotes we have to do it in 2 steps:
973 extractedcf=`$SED -n -e "$sed_extractcf" < "$progpath"`
976 func_error "ignoring unknown tag $tagname"
982 # func_check_version_match
983 # Ensure that we are using m4 macros, and libtool script from the same
984 # release of libtool.
985 func_check_version_match ()
987 if test "$package_revision" != "$macro_revision"; then
988 if test "$VERSION" != "$macro_version"; then
989 if test -z "$macro_version"; then
991 $progname: Version mismatch error. This is $PACKAGE $VERSION, but the
992 $progname: definition of this LT_INIT comes from an older release.
993 $progname: You should recreate aclocal.m4 with macros from $PACKAGE $VERSION
994 $progname: and run autoconf again.
998 $progname: Version mismatch error. This is $PACKAGE $VERSION, but the
999 $progname: definition of this LT_INIT comes from $PACKAGE $macro_version.
1000 $progname: You should recreate aclocal.m4 with macros from $PACKAGE $VERSION
1001 $progname: and run autoconf again.
1006 $progname: Version mismatch error. This is $PACKAGE $VERSION, revision $package_revision,
1007 $progname: but the definition of this LT_INIT comes from revision $macro_revision.
1008 $progname: You should recreate aclocal.m4 with macros from revision $package_revision
1009 $progname: of $PACKAGE $VERSION and run autoconf again.
1018 # Shorthand for --mode=foo, only valid as the first argument
1021 shift; set dummy --mode clean ${1+"$@"}; shift
1023 compile|compil|compi|comp|com|co|c)
1024 shift; set dummy --mode compile ${1+"$@"}; shift
1026 execute|execut|execu|exec|exe|ex|e)
1027 shift; set dummy --mode execute ${1+"$@"}; shift
1029 finish|finis|fini|fin|fi|f)
1030 shift; set dummy --mode finish ${1+"$@"}; shift
1032 install|instal|insta|inst|ins|in|i)
1033 shift; set dummy --mode install ${1+"$@"}; shift
1036 shift; set dummy --mode link ${1+"$@"}; shift
1038 uninstall|uninstal|uninsta|uninst|unins|unin|uni|un|u)
1039 shift; set dummy --mode uninstall ${1+"$@"}; shift
1049 opt_preserve_dup_deps=false
1061 # Parse options once, thoroughly. This comes as soon as possible in the
1062 # script to make things like `--version' happen as quickly as we can.
1064 # this just eases exit handling
1065 while test $# -gt 0; do
1069 --debug|-x) opt_debug='set -x'
1070 func_echo "enabling shell trace mode"
1073 --dry-run|--dryrun|-n)
1082 opt_dlopen="${opt_dlopen+$opt_dlopen
1086 --preserve-dup-deps)
1087 opt_preserve_dup_deps=:
1095 set dummy --mode finish ${1+"$@"}; shift
1102 opt_help=': help-all'
1105 test $# = 0 && func_missing_arg $opt && break
1109 # Valid mode arguments:
1110 clean|compile|execute|finish|install|link|relink|uninstall) ;;
1112 # Catch anything else as an error
1113 *) func_error "invalid argument for $opt"
1120 --no-silent|--no-quiet)
1122 func_append preserve_args " $opt"
1124 --no-warning|--no-warn)
1126 func_append preserve_args " $opt"
1130 func_append preserve_args " $opt"
1134 func_append preserve_args " $opt"
1139 func_append preserve_args " $opt"
1143 test $# = 0 && func_missing_arg $opt && break
1146 func_append preserve_args " $opt $optarg"
1147 func_enable_tag "$optarg"
1151 -\?|-h) func_usage ;;
1152 --help) func_help ;;
1153 --version) func_version ;;
1155 # Separate optargs to long options:
1157 func_split_long_opt "$opt"
1158 set dummy "$func_split_long_opt_name" "$func_split_long_opt_arg" ${1+"$@"}
1162 # Separate non-argument short options:
1164 func_split_short_opt "$opt"
1165 set dummy "$func_split_short_opt_name" "-$func_split_short_opt_arg" ${1+"$@"}
1170 -*) func_fatal_help "unrecognized option \`$opt'" ;;
1171 *) set dummy "$opt" ${1+"$@"}; shift; break ;;
1177 # save first non-option argument
1178 if test "$#" -gt 0; then
1184 test "$opt_debug" = : || func_append preserve_args " --debug"
1187 *cygwin* | *mingw* | *pw32* | *cegcc*)
1188 # don't eliminate duplications in $postdeps and $predeps
1189 opt_duplicate_compiler_generated_deps=:
1192 opt_duplicate_compiler_generated_deps=$opt_preserve_dup_deps
1197 # Sanity checks first:
1198 func_check_version_match
1200 if test "$build_libtool_libs" != yes && test "$build_old_libs" != yes; then
1201 func_fatal_configuration "not configured to build any kind of library"
1205 eval std_shrext=\"$shrext_cmds\"
1207 # Only execute mode is allowed to have -dlopen flags.
1208 if test -n "$opt_dlopen" && test "$opt_mode" != execute; then
1209 func_error "unrecognized option \`-dlopen'"
1214 # Change the help message to a mode-specific one.
1215 generic_help="$help"
1216 help="Try \`$progname --help --mode=$opt_mode' for more information."
1220 # Bail if the options were screwed
1221 $exit_cmd $EXIT_FAILURE
1232 # True iff FILE is a libtool `.la' library or `.lo' object file.
1233 # This function is only a basic sanity check; it will hardly flush out
1234 # determined imposters.
1238 $SED -e 4q "$1" 2>/dev/null \
1239 | $GREP "^# Generated by .*$PACKAGE" > /dev/null 2>&1
1242 # func_lalib_unsafe_p file
1243 # True iff FILE is a libtool `.la' library or `.lo' object file.
1244 # This function implements the same check as func_lalib_p without
1245 # resorting to external programs. To this end, it redirects stdin and
1246 # closes it afterwards, without saving the original file descriptor.
1247 # As a safety measure, use it only where a negative result would be
1248 # fatal anyway. Works if `file' does not exist.
1249 func_lalib_unsafe_p ()
1252 if test -f "$1" && test -r "$1" && exec 5<&0 <"$1"; then
1253 for lalib_p_l in 1 2 3 4
1256 case "$lalib_p_line" in
1257 \#\ Generated\ by\ *$PACKAGE* ) lalib_p=yes; break;;
1262 test "$lalib_p" = yes
1265 # func_ltwrapper_script_p file
1266 # True iff FILE is a libtool wrapper script
1267 # This function is only a basic sanity check; it will hardly flush out
1268 # determined imposters.
1269 func_ltwrapper_script_p ()
1274 # func_ltwrapper_executable_p file
1275 # True iff FILE is a libtool wrapper executable
1276 # This function is only a basic sanity check; it will hardly flush out
1277 # determined imposters.
1278 func_ltwrapper_executable_p ()
1280 func_ltwrapper_exec_suffix=
1283 *) func_ltwrapper_exec_suffix=.exe ;;
1285 $GREP "$magic_exe" "$1$func_ltwrapper_exec_suffix" >/dev/null 2>&1
1288 # func_ltwrapper_scriptname file
1289 # Assumes file is an ltwrapper_executable
1290 # uses $file to determine the appropriate filename for a
1291 # temporary ltwrapper_script.
1292 func_ltwrapper_scriptname ()
1294 func_dirname_and_basename "$1" "" "."
1295 func_stripname '' '.exe' "$func_basename_result"
1296 func_ltwrapper_scriptname_result="$func_dirname_result/$objdir/${func_stripname_result}_ltshwrapper"
1299 # func_ltwrapper_p file
1300 # True iff FILE is a libtool wrapper script or wrapper executable
1301 # This function is only a basic sanity check; it will hardly flush out
1302 # determined imposters.
1305 func_ltwrapper_script_p "$1" || func_ltwrapper_executable_p "$1"
1309 # func_execute_cmds commands fail_cmd
1310 # Execute tilde-delimited COMMANDS.
1311 # If FAIL_CMD is given, eval that upon failure.
1312 # FAIL_CMD may read-access the current command in variable CMD!
1313 func_execute_cmds ()
1316 save_ifs=$IFS; IFS='~'
1320 func_show_eval "$cmd" "${2-:}"
1327 # Source FILE, adding directory component if necessary.
1328 # Note that it is not necessary on cygwin/mingw to append a dot to
1329 # FILE even if both FILE and FILE.exe exist: automatic-append-.exe
1330 # behavior happens only for exec(3), not for open(2)! Also, sourcing
1331 # `FILE.' does not work on cygwin managed mounts.
1336 */* | *\\*) . "$1" ;;
1342 # func_resolve_sysroot PATH
1343 # Replace a leading = in PATH with a sysroot. Store the result into
1344 # func_resolve_sysroot_result
1345 func_resolve_sysroot ()
1347 func_resolve_sysroot_result=$1
1348 case $func_resolve_sysroot_result in
1350 func_stripname '=' '' "$func_resolve_sysroot_result"
1351 func_resolve_sysroot_result=$lt_sysroot$func_stripname_result
1356 # func_replace_sysroot PATH
1357 # If PATH begins with the sysroot, replace it with = and
1358 # store the result into func_replace_sysroot_result.
1359 func_replace_sysroot ()
1361 case "$lt_sysroot:$1" in
1363 func_stripname "$lt_sysroot" '' "$1"
1364 func_replace_sysroot_result="=$func_stripname_result"
1367 # Including no sysroot.
1368 func_replace_sysroot_result=$1
1373 # func_infer_tag arg
1374 # Infer tagged configuration to use if any are available and
1375 # if one wasn't chosen via the "--tag" command line option.
1376 # Only attempt this if the compiler in the base compile
1377 # command doesn't match the default compiler.
1378 # arg is usually of the form 'gcc ...'
1382 if test -n "$available_tags" && test -z "$tagname"; then
1385 func_append_quoted CC_quoted "$arg"
1387 CC_expanded=`func_echo_all $CC`
1388 CC_quoted_expanded=`func_echo_all $CC_quoted`
1390 # Blanks in the command may have been stripped by the calling shell,
1391 # but not from the CC environment variable when configure was run.
1392 " $CC "* | "$CC "* | " $CC_expanded "* | "$CC_expanded "* | \
1393 " $CC_quoted"* | "$CC_quoted "* | " $CC_quoted_expanded "* | "$CC_quoted_expanded "*) ;;
1394 # Blanks at the start of $base_compile will cause this to fail
1395 # if we don't check for them as well.
1397 for z in $available_tags; do
1398 if $GREP "^# ### BEGIN LIBTOOL TAG CONFIG: $z$" < "$progpath" > /dev/null; then
1399 # Evaluate the configuration.
1400 eval "`${SED} -n -e '/^# ### BEGIN LIBTOOL TAG CONFIG: '$z'$/,/^# ### END LIBTOOL TAG CONFIG: '$z'$/p' < $progpath`"
1403 # Double-quote args containing other shell metacharacters.
1404 func_append_quoted CC_quoted "$arg"
1406 CC_expanded=`func_echo_all $CC`
1407 CC_quoted_expanded=`func_echo_all $CC_quoted`
1409 " $CC "* | "$CC "* | " $CC_expanded "* | "$CC_expanded "* | \
1410 " $CC_quoted"* | "$CC_quoted "* | " $CC_quoted_expanded "* | "$CC_quoted_expanded "*)
1411 # The compiler in the base compile command matches
1412 # the one in the tagged configuration.
1413 # Assume this is the tagged configuration we want.
1420 # If $tagname still isn't set, then no tagged configuration
1421 # was found and let the user know that the "--tag" command
1422 # line option must be used.
1423 if test -z "$tagname"; then
1424 func_echo "unable to infer tagged configuration"
1425 func_fatal_error "specify a tag with \`--tag'"
1427 # func_verbose "using $tagname tagged configuration"
1436 # func_write_libtool_object output_name pic_name nonpic_name
1437 # Create a libtool object file (analogous to a ".la" file),
1438 # but don't create it if we're doing a dry run.
1439 func_write_libtool_object ()
1442 if test "$build_libtool_libs" = yes; then
1448 if test "$build_old_libs" = yes; then
1449 write_oldobj=\'${3}\'
1455 cat >${write_libobj}T <<EOF
1456 # $write_libobj - a libtool object file
1457 # Generated by $PROGRAM (GNU $PACKAGE$TIMESTAMP) $VERSION
1459 # Please DO NOT delete this file!
1460 # It is necessary for linking the library.
1462 # Name of the PIC object.
1463 pic_object=$write_lobj
1465 # Name of the non-PIC object
1466 non_pic_object=$write_oldobj
1469 $MV "${write_libobj}T" "${write_libobj}"
1474 ##################################################
1475 # FILE NAME AND PATH CONVERSION HELPER FUNCTIONS #
1476 ##################################################
1478 # func_convert_core_file_wine_to_w32 ARG
1479 # Helper function used by file name conversion functions when $build is *nix,
1480 # and $host is mingw, cygwin, or some other w32 environment. Relies on a
1481 # correctly configured wine environment available, with the winepath program
1482 # in $build's $PATH.
1484 # ARG is the $build file name to be converted to w32 format.
1485 # Result is available in $func_convert_core_file_wine_to_w32_result, and will
1486 # be empty on error (or when ARG is empty)
1487 func_convert_core_file_wine_to_w32 ()
1490 func_convert_core_file_wine_to_w32_result="$1"
1491 if test -n "$1"; then
1492 # Unfortunately, winepath does not exit with a non-zero error code, so we
1493 # are forced to check the contents of stdout. On the other hand, if the
1494 # command is not found, the shell will set an exit code of 127 and print
1495 # *an error message* to stdout. So we must check for both error code of
1496 # zero AND non-empty stdout, which explains the odd construction:
1497 func_convert_core_file_wine_to_w32_tmp=`winepath -w "$1" 2>/dev/null`
1498 if test "$?" -eq 0 && test -n "${func_convert_core_file_wine_to_w32_tmp}"; then
1499 func_convert_core_file_wine_to_w32_result=`$ECHO "$func_convert_core_file_wine_to_w32_tmp" |
1500 $SED -e "$lt_sed_naive_backslashify"`
1502 func_convert_core_file_wine_to_w32_result=
1506 # end: func_convert_core_file_wine_to_w32
1509 # func_convert_core_path_wine_to_w32 ARG
1510 # Helper function used by path conversion functions when $build is *nix, and
1511 # $host is mingw, cygwin, or some other w32 environment. Relies on a correctly
1512 # configured wine environment available, with the winepath program in $build's
1513 # $PATH. Assumes ARG has no leading or trailing path separator characters.
1515 # ARG is path to be converted from $build format to win32.
1516 # Result is available in $func_convert_core_path_wine_to_w32_result.
1517 # Unconvertible file (directory) names in ARG are skipped; if no directory names
1518 # are convertible, then the result may be empty.
1519 func_convert_core_path_wine_to_w32 ()
1522 # unfortunately, winepath doesn't convert paths, only file names
1523 func_convert_core_path_wine_to_w32_result=""
1524 if test -n "$1"; then
1527 for func_convert_core_path_wine_to_w32_f in $1; do
1529 func_convert_core_file_wine_to_w32 "$func_convert_core_path_wine_to_w32_f"
1530 if test -n "$func_convert_core_file_wine_to_w32_result" ; then
1531 if test -z "$func_convert_core_path_wine_to_w32_result"; then
1532 func_convert_core_path_wine_to_w32_result="$func_convert_core_file_wine_to_w32_result"
1534 func_append func_convert_core_path_wine_to_w32_result ";$func_convert_core_file_wine_to_w32_result"
1541 # end: func_convert_core_path_wine_to_w32
1544 # func_cygpath ARGS...
1545 # Wrapper around calling the cygpath program via LT_CYGPATH. This is used when
1546 # when (1) $build is *nix and Cygwin is hosted via a wine environment; or (2)
1547 # $build is MSYS and $host is Cygwin, or (3) $build is Cygwin. In case (1) or
1548 # (2), returns the Cygwin file name or path in func_cygpath_result (input
1549 # file name or path is assumed to be in w32 format, as previously converted
1550 # from $build's *nix or MSYS format). In case (3), returns the w32 file name
1551 # or path in func_cygpath_result (input file name or path is assumed to be in
1552 # Cygwin format). Returns an empty string on error.
1554 # ARGS are passed to cygpath, with the last one being the file name or path to
1557 # Specify the absolute *nix (or w32) name to cygpath in the LT_CYGPATH
1558 # environment variable; do not put it in $PATH.
1562 if test -n "$LT_CYGPATH" && test -f "$LT_CYGPATH"; then
1563 func_cygpath_result=`$LT_CYGPATH "$@" 2>/dev/null`
1564 if test "$?" -ne 0; then
1565 # on failure, ensure result is empty
1566 func_cygpath_result=
1569 func_cygpath_result=
1570 func_error "LT_CYGPATH is empty or specifies non-existent file: \`$LT_CYGPATH'"
1576 # func_convert_core_msys_to_w32 ARG
1577 # Convert file name or path ARG from MSYS format to w32 format. Return
1578 # result in func_convert_core_msys_to_w32_result.
1579 func_convert_core_msys_to_w32 ()
1582 # awkward: cmd appends spaces to result
1583 func_convert_core_msys_to_w32_result=`( cmd //c echo "$1" ) 2>/dev/null |
1584 $SED -e 's/[ ]*$//' -e "$lt_sed_naive_backslashify"`
1586 #end: func_convert_core_msys_to_w32
1589 # func_convert_file_check ARG1 ARG2
1590 # Verify that ARG1 (a file name in $build format) was converted to $host
1591 # format in ARG2. Otherwise, emit an error message, but continue (resetting
1592 # func_to_host_file_result to ARG1).
1593 func_convert_file_check ()
1596 if test -z "$2" && test -n "$1" ; then
1597 func_error "Could not determine host file name corresponding to"
1599 func_error "Continuing, but uninstalled executables may not work."
1601 func_to_host_file_result="$1"
1604 # end func_convert_file_check
1607 # func_convert_path_check FROM_PATHSEP TO_PATHSEP FROM_PATH TO_PATH
1608 # Verify that FROM_PATH (a path in $build format) was converted to $host
1609 # format in TO_PATH. Otherwise, emit an error message, but continue, resetting
1610 # func_to_host_file_result to a simplistic fallback value (see below).
1611 func_convert_path_check ()
1614 if test -z "$4" && test -n "$3"; then
1615 func_error "Could not determine the host path corresponding to"
1617 func_error "Continuing, but uninstalled executables may not work."
1618 # Fallback. This is a deliberately simplistic "conversion" and
1619 # should not be "improved". See libtool.info.
1620 if test "x$1" != "x$2"; then
1621 lt_replace_pathsep_chars="s|$1|$2|g"
1622 func_to_host_path_result=`echo "$3" |
1623 $SED -e "$lt_replace_pathsep_chars"`
1625 func_to_host_path_result="$3"
1629 # end func_convert_path_check
1632 # func_convert_path_front_back_pathsep FRONTPAT BACKPAT REPL ORIG
1633 # Modifies func_to_host_path_result by prepending REPL if ORIG matches FRONTPAT
1634 # and appending REPL if ORIG matches BACKPAT.
1635 func_convert_path_front_back_pathsep ()
1639 $1 ) func_to_host_path_result="$3$func_to_host_path_result"
1643 $2 ) func_append func_to_host_path_result "$3"
1647 # end func_convert_path_front_back_pathsep
1650 ##################################################
1651 # $build to $host FILE NAME CONVERSION FUNCTIONS #
1652 ##################################################
1653 # invoked via `$to_host_file_cmd ARG'
1655 # In each case, ARG is the path to be converted from $build to $host format.
1656 # Result will be available in $func_to_host_file_result.
1659 # func_to_host_file ARG
1660 # Converts the file name ARG from $build format to $host format. Return result
1661 # in func_to_host_file_result.
1662 func_to_host_file ()
1665 $to_host_file_cmd "$1"
1667 # end func_to_host_file
1670 # func_to_tool_file ARG LAZY
1671 # converts the file name ARG from $build format to toolchain format. Return
1672 # result in func_to_tool_file_result. If the conversion in use is listed
1673 # in (the comma separated) LAZY, no conversion takes place.
1674 func_to_tool_file ()
1678 *,"$to_tool_file_cmd",*)
1679 func_to_tool_file_result=$1
1682 $to_tool_file_cmd "$1"
1683 func_to_tool_file_result=$func_to_host_file_result
1687 # end func_to_tool_file
1690 # func_convert_file_noop ARG
1691 # Copy ARG to func_to_host_file_result.
1692 func_convert_file_noop ()
1694 func_to_host_file_result="$1"
1696 # end func_convert_file_noop
1699 # func_convert_file_msys_to_w32 ARG
1700 # Convert file name ARG from (mingw) MSYS to (mingw) w32 format; automatic
1701 # conversion to w32 is not available inside the cwrapper. Returns result in
1702 # func_to_host_file_result.
1703 func_convert_file_msys_to_w32 ()
1706 func_to_host_file_result="$1"
1707 if test -n "$1"; then
1708 func_convert_core_msys_to_w32 "$1"
1709 func_to_host_file_result="$func_convert_core_msys_to_w32_result"
1711 func_convert_file_check "$1" "$func_to_host_file_result"
1713 # end func_convert_file_msys_to_w32
1716 # func_convert_file_cygwin_to_w32 ARG
1717 # Convert file name ARG from Cygwin to w32 format. Returns result in
1718 # func_to_host_file_result.
1719 func_convert_file_cygwin_to_w32 ()
1722 func_to_host_file_result="$1"
1723 if test -n "$1"; then
1724 # because $build is cygwin, we call "the" cygpath in $PATH; no need to use
1725 # LT_CYGPATH in this case.
1726 func_to_host_file_result=`cygpath -m "$1"`
1728 func_convert_file_check "$1" "$func_to_host_file_result"
1730 # end func_convert_file_cygwin_to_w32
1733 # func_convert_file_nix_to_w32 ARG
1734 # Convert file name ARG from *nix to w32 format. Requires a wine environment
1735 # and a working winepath. Returns result in func_to_host_file_result.
1736 func_convert_file_nix_to_w32 ()
1739 func_to_host_file_result="$1"
1740 if test -n "$1"; then
1741 func_convert_core_file_wine_to_w32 "$1"
1742 func_to_host_file_result="$func_convert_core_file_wine_to_w32_result"
1744 func_convert_file_check "$1" "$func_to_host_file_result"
1746 # end func_convert_file_nix_to_w32
1749 # func_convert_file_msys_to_cygwin ARG
1750 # Convert file name ARG from MSYS to Cygwin format. Requires LT_CYGPATH set.
1751 # Returns result in func_to_host_file_result.
1752 func_convert_file_msys_to_cygwin ()
1755 func_to_host_file_result="$1"
1756 if test -n "$1"; then
1757 func_convert_core_msys_to_w32 "$1"
1758 func_cygpath -u "$func_convert_core_msys_to_w32_result"
1759 func_to_host_file_result="$func_cygpath_result"
1761 func_convert_file_check "$1" "$func_to_host_file_result"
1763 # end func_convert_file_msys_to_cygwin
1766 # func_convert_file_nix_to_cygwin ARG
1767 # Convert file name ARG from *nix to Cygwin format. Requires Cygwin installed
1768 # in a wine environment, working winepath, and LT_CYGPATH set. Returns result
1769 # in func_to_host_file_result.
1770 func_convert_file_nix_to_cygwin ()
1773 func_to_host_file_result="$1"
1774 if test -n "$1"; then
1775 # convert from *nix to w32, then use cygpath to convert from w32 to cygwin.
1776 func_convert_core_file_wine_to_w32 "$1"
1777 func_cygpath -u "$func_convert_core_file_wine_to_w32_result"
1778 func_to_host_file_result="$func_cygpath_result"
1780 func_convert_file_check "$1" "$func_to_host_file_result"
1782 # end func_convert_file_nix_to_cygwin
1785 #############################################
1786 # $build to $host PATH CONVERSION FUNCTIONS #
1787 #############################################
1788 # invoked via `$to_host_path_cmd ARG'
1790 # In each case, ARG is the path to be converted from $build to $host format.
1791 # The result will be available in $func_to_host_path_result.
1793 # Path separators are also converted from $build format to $host format. If
1794 # ARG begins or ends with a path separator character, it is preserved (but
1795 # converted to $host format) on output.
1797 # All path conversion functions are named using the following convention:
1798 # file name conversion function : func_convert_file_X_to_Y ()
1799 # path conversion function : func_convert_path_X_to_Y ()
1800 # where, for any given $build/$host combination the 'X_to_Y' value is the
1801 # same. If conversion functions are added for new $build/$host combinations,
1802 # the two new functions must follow this pattern, or func_init_to_host_path_cmd
1806 # func_init_to_host_path_cmd
1807 # Ensures that function "pointer" variable $to_host_path_cmd is set to the
1808 # appropriate value, based on the value of $to_host_file_cmd.
1810 func_init_to_host_path_cmd ()
1813 if test -z "$to_host_path_cmd"; then
1814 func_stripname 'func_convert_file_' '' "$to_host_file_cmd"
1815 to_host_path_cmd="func_convert_path_${func_stripname_result}"
1820 # func_to_host_path ARG
1821 # Converts the path ARG from $build format to $host format. Return result
1822 # in func_to_host_path_result.
1823 func_to_host_path ()
1826 func_init_to_host_path_cmd
1827 $to_host_path_cmd "$1"
1829 # end func_to_host_path
1832 # func_convert_path_noop ARG
1833 # Copy ARG to func_to_host_path_result.
1834 func_convert_path_noop ()
1836 func_to_host_path_result="$1"
1838 # end func_convert_path_noop
1841 # func_convert_path_msys_to_w32 ARG
1842 # Convert path ARG from (mingw) MSYS to (mingw) w32 format; automatic
1843 # conversion to w32 is not available inside the cwrapper. Returns result in
1844 # func_to_host_path_result.
1845 func_convert_path_msys_to_w32 ()
1848 func_to_host_path_result="$1"
1849 if test -n "$1"; then
1850 # Remove leading and trailing path separator characters from ARG. MSYS
1851 # behavior is inconsistent here; cygpath turns them into '.;' and ';.';
1852 # and winepath ignores them completely.
1853 func_stripname : : "$1"
1854 func_to_host_path_tmp1=$func_stripname_result
1855 func_convert_core_msys_to_w32 "$func_to_host_path_tmp1"
1856 func_to_host_path_result="$func_convert_core_msys_to_w32_result"
1857 func_convert_path_check : ";" \
1858 "$func_to_host_path_tmp1" "$func_to_host_path_result"
1859 func_convert_path_front_back_pathsep ":*" "*:" ";" "$1"
1862 # end func_convert_path_msys_to_w32
1865 # func_convert_path_cygwin_to_w32 ARG
1866 # Convert path ARG from Cygwin to w32 format. Returns result in
1867 # func_to_host_file_result.
1868 func_convert_path_cygwin_to_w32 ()
1871 func_to_host_path_result="$1"
1872 if test -n "$1"; then
1873 # See func_convert_path_msys_to_w32:
1874 func_stripname : : "$1"
1875 func_to_host_path_tmp1=$func_stripname_result
1876 func_to_host_path_result=`cygpath -m -p "$func_to_host_path_tmp1"`
1877 func_convert_path_check : ";" \
1878 "$func_to_host_path_tmp1" "$func_to_host_path_result"
1879 func_convert_path_front_back_pathsep ":*" "*:" ";" "$1"
1882 # end func_convert_path_cygwin_to_w32
1885 # func_convert_path_nix_to_w32 ARG
1886 # Convert path ARG from *nix to w32 format. Requires a wine environment and
1887 # a working winepath. Returns result in func_to_host_file_result.
1888 func_convert_path_nix_to_w32 ()
1891 func_to_host_path_result="$1"
1892 if test -n "$1"; then
1893 # See func_convert_path_msys_to_w32:
1894 func_stripname : : "$1"
1895 func_to_host_path_tmp1=$func_stripname_result
1896 func_convert_core_path_wine_to_w32 "$func_to_host_path_tmp1"
1897 func_to_host_path_result="$func_convert_core_path_wine_to_w32_result"
1898 func_convert_path_check : ";" \
1899 "$func_to_host_path_tmp1" "$func_to_host_path_result"
1900 func_convert_path_front_back_pathsep ":*" "*:" ";" "$1"
1903 # end func_convert_path_nix_to_w32
1906 # func_convert_path_msys_to_cygwin ARG
1907 # Convert path ARG from MSYS to Cygwin format. Requires LT_CYGPATH set.
1908 # Returns result in func_to_host_file_result.
1909 func_convert_path_msys_to_cygwin ()
1912 func_to_host_path_result="$1"
1913 if test -n "$1"; then
1914 # See func_convert_path_msys_to_w32:
1915 func_stripname : : "$1"
1916 func_to_host_path_tmp1=$func_stripname_result
1917 func_convert_core_msys_to_w32 "$func_to_host_path_tmp1"
1918 func_cygpath -u -p "$func_convert_core_msys_to_w32_result"
1919 func_to_host_path_result="$func_cygpath_result"
1920 func_convert_path_check : : \
1921 "$func_to_host_path_tmp1" "$func_to_host_path_result"
1922 func_convert_path_front_back_pathsep ":*" "*:" : "$1"
1925 # end func_convert_path_msys_to_cygwin
1928 # func_convert_path_nix_to_cygwin ARG
1929 # Convert path ARG from *nix to Cygwin format. Requires Cygwin installed in a
1930 # a wine environment, working winepath, and LT_CYGPATH set. Returns result in
1931 # func_to_host_file_result.
1932 func_convert_path_nix_to_cygwin ()
1935 func_to_host_path_result="$1"
1936 if test -n "$1"; then
1937 # Remove leading and trailing path separator characters from
1938 # ARG. msys behavior is inconsistent here, cygpath turns them
1939 # into '.;' and ';.', and winepath ignores them completely.
1940 func_stripname : : "$1"
1941 func_to_host_path_tmp1=$func_stripname_result
1942 func_convert_core_path_wine_to_w32 "$func_to_host_path_tmp1"
1943 func_cygpath -u -p "$func_convert_core_path_wine_to_w32_result"
1944 func_to_host_path_result="$func_cygpath_result"
1945 func_convert_path_check : : \
1946 "$func_to_host_path_tmp1" "$func_to_host_path_result"
1947 func_convert_path_front_back_pathsep ":*" "*:" : "$1"
1950 # end func_convert_path_nix_to_cygwin
1953 # func_mode_compile arg...
1954 func_mode_compile ()
1957 # Get the compilation command and the source file.
1959 srcfile="$nonopt" # always keep a non-empty value in "srcfile"
1971 # do not "continue". Instead, add this to base_compile
1983 # Accept any command-line options.
1986 test -n "$libobj" && \
1987 func_fatal_error "you cannot specify \`-o' more than once"
1992 -pie | -fpie | -fPIE)
1993 func_append pie_flag " $arg"
1997 -shared | -static | -prefer-pic | -prefer-non-pic)
1998 func_append later " $arg"
2008 arg_mode=arg # the next one goes into the "base_compile" arg list
2009 continue # The current "srcfile" will either be retained or
2010 ;; # replaced later. I would guess that would be a bug.
2013 func_stripname '-Wc,' '' "$arg"
2014 args=$func_stripname_result
2016 save_ifs="$IFS"; IFS=','
2017 for arg in $args; do
2019 func_append_quoted lastarg "$arg"
2022 func_stripname ' ' '' "$lastarg"
2023 lastarg=$func_stripname_result
2025 # Add the arguments to base_compile.
2026 func_append base_compile " $lastarg"
2031 # Accept the current argument as the source file.
2032 # The previous "srcfile" becomes the current argument.
2039 esac # case $arg_mode
2041 # Aesthetically quote the previous argument.
2042 func_append_quoted base_compile "$lastarg"
2047 func_fatal_error "you must specify an argument for -Xcompile"
2050 func_fatal_error "you must specify a target with \`-o'"
2053 # Get the name of the library object.
2054 test -z "$libobj" && {
2055 func_basename "$srcfile"
2056 libobj="$func_basename_result"
2061 # Recognize several different file suffixes.
2062 # If the user specifies -o file.o, it is replaced with file.lo
2065 *.ada | *.adb | *.ads | *.asm | \
2066 *.c++ | *.cc | *.ii | *.class | *.cpp | *.cxx | \
2067 *.[fF][09]? | *.for | *.java | *.go | *.obj | *.sx | *.cu | *.cup)
2068 func_xform "$libobj"
2069 libobj=$func_xform_result
2074 *.lo) func_lo2o "$libobj"; obj=$func_lo2o_result ;;
2076 func_fatal_error "cannot determine name of library object from \`$libobj'"
2080 func_infer_tag $base_compile
2082 for arg in $later; do
2085 test "$build_libtool_libs" != yes && \
2086 func_fatal_configuration "can not build a shared library"
2092 build_libtool_libs=no
2109 func_quote_for_eval "$libobj"
2110 test "X$libobj" != "X$func_quote_for_eval_result" \
2111 && $ECHO "X$libobj" | $GREP '[]~#^*{};<>?"'"'"' &()|`$[]' \
2112 && func_warning "libobj name \`$libobj' may not contain shell special characters."
2113 func_dirname_and_basename "$obj" "/" ""
2114 objname="$func_basename_result"
2115 xdir="$func_dirname_result"
2116 lobj=${xdir}$objdir/$objname
2118 test -z "$base_compile" && \
2119 func_fatal_help "you must specify a compilation command"
2121 # Delete any leftover library objects.
2122 if test "$build_old_libs" = yes; then
2123 removelist="$obj $lobj $libobj ${libobj}T"
2125 removelist="$lobj $libobj ${libobj}T"
2128 # On Cygwin there's no "real" PIC flag so we must build both object types
2130 cygwin* | mingw* | pw32* | os2* | cegcc*)
2134 if test "$pic_mode" = no && test "$deplibs_check_method" != pass_all; then
2135 # non-PIC code in shared libraries is not supported
2139 # Calculate the filename of the output object if compiler does
2140 # not support -o with -c
2141 if test "$compiler_c_o" = no; then
2142 output_obj=`$ECHO "$srcfile" | $SED 's%^.*/%%; s%\.[^.]*$%%'`.${objext}
2143 lockfile="$output_obj.lock"
2150 # Lock this critical section if it is needed
2151 # We use this script file to make the link, it avoids creating a new file
2152 if test "$need_locks" = yes; then
2153 until $opt_dry_run || ln "$progpath" "$lockfile" 2>/dev/null; do
2154 func_echo "Waiting for $lockfile to be removed"
2157 elif test "$need_locks" = warn; then
2158 if test -f "$lockfile"; then
2160 *** ERROR, $lockfile exists and contains:
2161 `cat $lockfile 2>/dev/null`
2163 This indicates that another process is trying to use the same
2164 temporary object file, and libtool could not work around it because
2165 your compiler does not support \`-c' and \`-o' together. If you
2166 repeat this compilation, it may succeed, by chance, but you had better
2167 avoid parallel builds (make -j) in this platform, or get a better
2170 $opt_dry_run || $RM $removelist
2173 func_append removelist " $output_obj"
2174 $ECHO "$srcfile" > "$lockfile"
2177 $opt_dry_run || $RM $removelist
2178 func_append removelist " $lockfile"
2179 trap '$opt_dry_run || $RM $removelist; exit $EXIT_FAILURE' 1 2 15
2181 func_to_tool_file "$srcfile" func_convert_file_msys_to_w32
2182 srcfile=$func_to_tool_file_result
2183 func_quote_for_eval "$srcfile"
2184 qsrcfile=$func_quote_for_eval_result
2186 # Only build a PIC object if we are building libtool libraries.
2187 if test "$build_libtool_libs" = yes; then
2188 # Without this assignment, base_compile gets emptied.
2189 fbsd_hideous_sh_bug=$base_compile
2191 if test "$pic_mode" != no; then
2192 command="$base_compile $qsrcfile $pic_flag"
2194 # Don't build PIC code
2195 command="$base_compile $qsrcfile"
2198 func_mkdir_p "$xdir$objdir"
2200 if test -z "$output_obj"; then
2201 # Place PIC objects in $objdir
2202 func_append command " -o $lobj"
2205 func_show_eval_locale "$command" \
2206 'test -n "$output_obj" && $RM $removelist; exit $EXIT_FAILURE'
2208 if test "$need_locks" = warn &&
2209 test "X`cat $lockfile 2>/dev/null`" != "X$srcfile"; then
2211 *** ERROR, $lockfile contains:
2212 `cat $lockfile 2>/dev/null`
2214 but it should contain:
2217 This indicates that another process is trying to use the same
2218 temporary object file, and libtool could not work around it because
2219 your compiler does not support \`-c' and \`-o' together. If you
2220 repeat this compilation, it may succeed, by chance, but you had better
2221 avoid parallel builds (make -j) in this platform, or get a better
2224 $opt_dry_run || $RM $removelist
2228 # Just move the object if needed, then go on to compile the next one
2229 if test -n "$output_obj" && test "X$output_obj" != "X$lobj"; then
2230 func_show_eval '$MV "$output_obj" "$lobj"' \
2231 'error=$?; $opt_dry_run || $RM $removelist; exit $error'
2234 # Allow error messages only from the first compilation.
2235 if test "$suppress_opt" = yes; then
2236 suppress_output=' >/dev/null 2>&1'
2240 # Only build a position-dependent object if we build old libraries.
2241 if test "$build_old_libs" = yes; then
2242 if test "$pic_mode" != yes; then
2243 # Don't build PIC code
2244 command="$base_compile $qsrcfile$pie_flag"
2246 command="$base_compile $qsrcfile $pic_flag"
2248 if test "$compiler_c_o" = yes; then
2249 func_append command " -o $obj"
2252 # Suppress compiler output if we already did a PIC compilation.
2253 func_append command "$suppress_output"
2254 func_show_eval_locale "$command" \
2255 '$opt_dry_run || $RM $removelist; exit $EXIT_FAILURE'
2257 if test "$need_locks" = warn &&
2258 test "X`cat $lockfile 2>/dev/null`" != "X$srcfile"; then
2260 *** ERROR, $lockfile contains:
2261 `cat $lockfile 2>/dev/null`
2263 but it should contain:
2266 This indicates that another process is trying to use the same
2267 temporary object file, and libtool could not work around it because
2268 your compiler does not support \`-c' and \`-o' together. If you
2269 repeat this compilation, it may succeed, by chance, but you had better
2270 avoid parallel builds (make -j) in this platform, or get a better
2273 $opt_dry_run || $RM $removelist
2277 # Just move the object if needed
2278 if test -n "$output_obj" && test "X$output_obj" != "X$obj"; then
2279 func_show_eval '$MV "$output_obj" "$obj"' \
2280 'error=$?; $opt_dry_run || $RM $removelist; exit $error'
2285 func_write_libtool_object "$libobj" "$objdir/$objname" "$objname"
2287 # Unlock the critical section if it was locked
2288 if test "$need_locks" != no; then
2289 removelist=$lockfile
2298 test "$opt_mode" = compile && func_mode_compile ${1+"$@"}
2303 # We need to display help for each of the modes.
2306 # Generic help is extracted from the usage comments
2307 # at the start of this file.
2313 "Usage: $progname [OPTION]... --mode=clean RM [RM-OPTION]... FILE...
2315 Remove files from the build directory.
2317 RM is the name of the program to use to delete files associated with each FILE
2318 (typically \`/bin/rm'). RM-OPTIONS are options (such as \`-f') to be passed
2321 If FILE is a libtool library, object or program, all the files associated
2322 with it are deleted. Otherwise, only FILE itself is deleted using RM."
2327 "Usage: $progname [OPTION]... --mode=compile COMPILE-COMMAND... SOURCEFILE
2329 Compile a source file into a libtool library object.
2331 This mode accepts the following additional options:
2333 -o OUTPUT-FILE set the output file name to OUTPUT-FILE
2334 -no-suppress do not suppress compiler output for multiple passes
2335 -prefer-pic try to build PIC objects only
2336 -prefer-non-pic try to build non-PIC objects only
2337 -shared do not build a \`.o' file suitable for static linking
2338 -static only build a \`.o' file suitable for static linking
2339 -Wc,FLAG pass FLAG directly to the compiler
2341 COMPILE-COMMAND is a command to be used in creating a \`standard' object file
2342 from the given SOURCEFILE.
2344 The output file name is determined by removing the directory component from
2345 SOURCEFILE, then substituting the C source code suffix \`.c' with the
2346 library object suffix, \`.lo'."
2351 "Usage: $progname [OPTION]... --mode=execute COMMAND [ARGS]...
2353 Automatically set library path, then run a program.
2355 This mode accepts the following additional options:
2357 -dlopen FILE add the directory containing FILE to the library path
2359 This mode sets the library path environment variable according to \`-dlopen'
2362 If any of the ARGS are libtool executable wrappers, then they are translated
2363 into their corresponding uninstalled binary, and any of their required library
2364 directories are added to the library path.
2366 Then, COMMAND is executed, with ARGS as arguments."
2371 "Usage: $progname [OPTION]... --mode=finish [LIBDIR]...
2373 Complete the installation of libtool libraries.
2375 Each LIBDIR is a directory that contains libtool libraries.
2377 The commands that this mode executes may require superuser privileges. Use
2378 the \`--dry-run' option if you just want to see what would be executed."
2383 "Usage: $progname [OPTION]... --mode=install INSTALL-COMMAND...
2385 Install executables or libraries.
2387 INSTALL-COMMAND is the installation command. The first component should be
2388 either the \`install' or \`cp' program.
2390 The following components of INSTALL-COMMAND are treated specially:
2392 -inst-prefix-dir PREFIX-DIR Use PREFIX-DIR as a staging area for installation
2394 The rest of the components are interpreted as arguments to that command (only
2395 BSD-compatible install options are recognized)."
2400 "Usage: $progname [OPTION]... --mode=link LINK-COMMAND...
2402 Link object files or libraries together to form another library, or to
2403 create an executable program.
2405 LINK-COMMAND is a command using the C compiler that you would use to create
2406 a program from several object files.
2408 The following components of LINK-COMMAND are treated specially:
2410 -all-static do not do any dynamic linking at all
2411 -avoid-version do not add a version suffix if possible
2412 -bindir BINDIR specify path to binaries directory (for systems where
2413 libraries must be found in the PATH setting at runtime)
2414 -dlopen FILE \`-dlpreopen' FILE if it cannot be dlopened at runtime
2415 -dlpreopen FILE link in FILE and add its symbols to lt_preloaded_symbols
2416 -export-dynamic allow symbols from OUTPUT-FILE to be resolved with dlsym(3)
2417 -export-symbols SYMFILE
2418 try to export only the symbols listed in SYMFILE
2419 -export-symbols-regex REGEX
2420 try to export only the symbols matching REGEX
2421 -LLIBDIR search LIBDIR for required installed libraries
2422 -lNAME OUTPUT-FILE requires the installed library libNAME
2423 -module build a library that can dlopened
2424 -no-fast-install disable the fast-install mode
2425 -no-install link a not-installable executable
2426 -no-undefined declare that a library does not refer to external symbols
2427 -o OUTPUT-FILE create OUTPUT-FILE from the specified objects
2428 -objectlist FILE Use a list of object files found in FILE to specify objects
2429 -precious-files-regex REGEX
2430 don't remove output files matching REGEX
2431 -release RELEASE specify package release information
2432 -rpath LIBDIR the created library will eventually be installed in LIBDIR
2433 -R[ ]LIBDIR add LIBDIR to the runtime path of programs and libraries
2434 -shared only do dynamic linking of libtool libraries
2435 -shrext SUFFIX override the standard shared library file extension
2436 -static do not do any dynamic linking of uninstalled libtool libraries
2437 -static-libtool-libs
2438 do not do any dynamic linking of libtool libraries
2439 -version-info CURRENT[:REVISION[:AGE]]
2440 specify library version info [each variable defaults to 0]
2441 -weak LIBNAME declare that the target provides the LIBNAME interface
2443 -Xcompiler FLAG pass linker-specific FLAG directly to the compiler
2445 -Xlinker FLAG pass linker-specific FLAG directly to the linker
2446 -XCClinker FLAG pass link-specific FLAG to the compiler driver (CC)
2448 All other options (arguments beginning with \`-') are ignored.
2450 Every other argument is treated as a filename. Files ending in \`.la' are
2451 treated as uninstalled libtool libraries, other files are standard or library
2454 If the OUTPUT-FILE ends in \`.la', then a libtool library is created,
2455 only library objects (\`.lo' files) may be specified, and \`-rpath' is
2456 required, except when creating a convenience library.
2458 If OUTPUT-FILE ends in \`.a' or \`.lib', then a standard library is created
2459 using \`ar' and \`ranlib', or on Windows using \`lib'.
2461 If OUTPUT-FILE ends in \`.lo' or \`.${objext}', then a reloadable object file
2462 is created, otherwise an executable program is created."
2467 "Usage: $progname [OPTION]... --mode=uninstall RM [RM-OPTION]... FILE...
2469 Remove libraries from an installation directory.
2471 RM is the name of the program to use to delete files associated with each FILE
2472 (typically \`/bin/rm'). RM-OPTIONS are options (such as \`-f') to be passed
2475 If FILE is a libtool library, all the files associated with it are deleted.
2476 Otherwise, only FILE itself is deleted using RM."
2480 func_fatal_help "invalid operation mode \`$opt_mode'"
2485 $ECHO "Try \`$progname --help' for more information about other modes."
2488 # Now that we've collected a possible --mode arg, show help if necessary
2490 if test "$opt_help" = :; then
2495 for opt_mode in compile link execute install finish uninstall clean; do
2498 } | sed -n '1p; 2,$s/^Usage:/ or: /p'
2501 for opt_mode in compile link execute install finish uninstall clean; do
2507 /^When reporting/,/^Report/{
2512 /information about other modes/d
2513 /more detailed .*MODE/d
2514 s/^Usage:.*--mode=\([^ ]*\) .*/Description of \1 mode:/'
2520 # func_mode_execute arg...
2521 func_mode_execute ()
2524 # The first argument is the command name.
2527 func_fatal_help "you must specify a COMMAND"
2529 # Handle -dlopen flags immediately.
2530 for file in $opt_dlopen; do
2532 || func_fatal_help "\`$file' is not a file"
2537 func_resolve_sysroot "$file"
2538 file=$func_resolve_sysroot_result
2540 # Check to see that this really is a libtool archive.
2541 func_lalib_unsafe_p "$file" \
2542 || func_fatal_help "\`$lib' is not a valid libtool archive"
2544 # Read the libtool library.
2549 # Skip this library if it cannot be dlopened.
2550 if test -z "$dlname"; then
2551 # Warn if it was a shared library.
2552 test -n "$library_names" && \
2553 func_warning "\`$file' was not linked with \`-export-dynamic'"
2557 func_dirname "$file" "" "."
2558 dir="$func_dirname_result"
2560 if test -f "$dir/$objdir/$dlname"; then
2561 func_append dir "/$objdir"
2563 if test ! -f "$dir/$dlname"; then
2564 func_fatal_error "cannot find \`$dlname' in \`$dir' or \`$dir/$objdir'"
2570 # Just add the directory containing the .lo file.
2571 func_dirname "$file" "" "."
2572 dir="$func_dirname_result"
2576 func_warning "\`-dlopen' is ignored for non-libtool libraries and objects"
2581 # Get the absolute pathname.
2582 absdir=`cd "$dir" && pwd`
2583 test -n "$absdir" && dir="$absdir"
2585 # Now add the directory to shlibpath_var.
2586 if eval "test -z \"\$$shlibpath_var\""; then
2587 eval "$shlibpath_var=\"\$dir\""
2589 eval "$shlibpath_var=\"\$dir:\$$shlibpath_var\""
2593 # This variable tells wrapper scripts just to set shlibpath_var
2594 # rather than running their programs.
2595 libtool_execute_magic="$magic"
2597 # Check if any of the arguments is a wrapper script.
2602 -* | *.la | *.lo ) ;;
2604 # Do a test to see if this is really a libtool program.
2605 if func_ltwrapper_script_p "$file"; then
2607 # Transform arg to wrapped name.
2608 file="$progdir/$program"
2609 elif func_ltwrapper_executable_p "$file"; then
2610 func_ltwrapper_scriptname "$file"
2611 func_source "$func_ltwrapper_scriptname_result"
2612 # Transform arg to wrapped name.
2613 file="$progdir/$program"
2617 # Quote arguments (to preserve shell metacharacters).
2618 func_append_quoted args "$file"
2621 if test "X$opt_dry_run" = Xfalse; then
2622 if test -n "$shlibpath_var"; then
2623 # Export the shlibpath_var.
2624 eval "export $shlibpath_var"
2627 # Restore saved environment variables
2628 for lt_var in LANG LANGUAGE LC_ALL LC_CTYPE LC_COLLATE LC_MESSAGES
2630 eval "if test \"\${save_$lt_var+set}\" = set; then
2631 $lt_var=\$save_$lt_var; export $lt_var
2637 # Now prepare to actually exec the command.
2638 exec_cmd="\$cmd$args"
2640 # Display what would be done.
2641 if test -n "$shlibpath_var"; then
2642 eval "\$ECHO \"\$shlibpath_var=\$$shlibpath_var\""
2643 echo "export $shlibpath_var"
2650 test "$opt_mode" = execute && func_mode_execute ${1+"$@"}
2653 # func_mode_finish arg...
2661 for opt in "$nonopt" ${1+"$@"}
2663 if test -d "$opt"; then
2664 func_append libdirs " $opt"
2666 elif test -f "$opt"; then
2667 if func_lalib_unsafe_p "$opt"; then
2668 func_append libs " $opt"
2670 func_warning "\`$opt' is not a valid libtool archive"
2674 func_fatal_error "invalid argument \`$opt'"
2678 if test -n "$libs"; then
2679 if test -n "$lt_sysroot"; then
2680 sysroot_regex=`$ECHO "$lt_sysroot" | $SED "$sed_make_literal_regex"`
2681 sysroot_cmd="s/\([ ']\)$sysroot_regex/\1/g;"
2686 # Remove sysroot references
2687 if $opt_dry_run; then
2688 for lib in $libs; do
2689 echo "removing references to $lt_sysroot and \`=' prefixes from $lib"
2692 tmpdir=`func_mktempdir`
2693 for lib in $libs; do
2694 sed -e "${sysroot_cmd} s/\([ ']-[LR]\)=/\1/g; s/\([ ']\)=/\1/g" $lib \
2696 mv -f $tmpdir/tmp-la $lib
2702 if test -n "$finish_cmds$finish_eval" && test -n "$libdirs"; then
2703 for libdir in $libdirs; do
2704 if test -n "$finish_cmds"; then
2705 # Do each command in the finish commands.
2706 func_execute_cmds "$finish_cmds" 'admincmds="$admincmds
2709 if test -n "$finish_eval"; then
2710 # Do the single finish_eval.
2711 eval cmds=\"$finish_eval\"
2712 $opt_dry_run || eval "$cmds" || func_append admincmds "
2718 # Exit here if they wanted silent mode.
2719 $opt_silent && exit $EXIT_SUCCESS
2721 if test -n "$finish_cmds$finish_eval" && test -n "$libdirs"; then
2722 echo "----------------------------------------------------------------------"
2723 echo "Libraries have been installed in:"
2724 for libdir in $libdirs; do
2728 echo "If you ever happen to want to link against installed libraries"
2729 echo "in a given directory, LIBDIR, you must either use libtool, and"
2730 echo "specify the full pathname of the library, or use the \`-LLIBDIR'"
2731 echo "flag during linking and do at least one of the following:"
2732 if test -n "$shlibpath_var"; then
2733 echo " - add LIBDIR to the \`$shlibpath_var' environment variable"
2734 echo " during execution"
2736 if test -n "$runpath_var"; then
2737 echo " - add LIBDIR to the \`$runpath_var' environment variable"
2738 echo " during linking"
2740 if test -n "$hardcode_libdir_flag_spec"; then
2742 eval flag=\"$hardcode_libdir_flag_spec\"
2744 $ECHO " - use the \`$flag' linker flag"
2746 if test -n "$admincmds"; then
2747 $ECHO " - have your system administrator run these commands:$admincmds"
2749 if test -f /etc/ld.so.conf; then
2750 echo " - have your system administrator add LIBDIR to \`/etc/ld.so.conf'"
2754 echo "See any operating system documentation about shared libraries for"
2756 solaris2.[6789]|solaris2.1[0-9])
2757 echo "more information, such as the ld(1), crle(1) and ld.so(8) manual"
2761 echo "more information, such as the ld(1) and ld.so(8) manual pages."
2764 echo "----------------------------------------------------------------------"
2769 test "$opt_mode" = finish && func_mode_finish ${1+"$@"}
2772 # func_mode_install arg...
2773 func_mode_install ()
2776 # There may be an optional sh(1) argument at the beginning of
2777 # install_prog (especially on Windows NT).
2778 if test "$nonopt" = "$SHELL" || test "$nonopt" = /bin/sh ||
2779 # Allow the use of GNU shtool's install command.
2780 case $nonopt in *shtool*) :;; *) false;; esac; then
2781 # Aesthetically quote it.
2782 func_quote_for_eval "$nonopt"
2783 install_prog="$func_quote_for_eval_result "
2791 # The real first argument should be the name of the installation program.
2792 # Aesthetically quote it.
2793 func_quote_for_eval "$arg"
2794 func_append install_prog "$func_quote_for_eval_result"
2795 install_shared_prog=$install_prog
2796 case " $install_prog " in
2797 *[\\\ /]cp\ *) install_cp=: ;;
2798 *) install_cp=false ;;
2801 # We need to accept at least all the BSD install flags.
2813 if test -n "$dest"; then
2814 func_append files " $dest"
2822 if $install_cp; then :; else
2836 # If the previous option needed an argument, then skip it.
2837 if test -n "$prev"; then
2838 if test "x$prev" = x-m && test -n "$install_override_mode"; then
2839 arg2=$install_override_mode
2850 # Aesthetically quote the argument.
2851 func_quote_for_eval "$arg"
2852 func_append install_prog " $func_quote_for_eval_result"
2853 if test -n "$arg2"; then
2854 func_quote_for_eval "$arg2"
2856 func_append install_shared_prog " $func_quote_for_eval_result"
2859 test -z "$install_prog" && \
2860 func_fatal_help "you must specify an install program"
2862 test -n "$prev" && \
2863 func_fatal_help "the \`$prev' option requires an argument"
2865 if test -n "$install_override_mode" && $no_mode; then
2866 if $install_cp; then :; else
2867 func_quote_for_eval "$install_override_mode"
2868 func_append install_shared_prog " -m $func_quote_for_eval_result"
2872 if test -z "$files"; then
2873 if test -z "$dest"; then
2874 func_fatal_help "no file or destination specified"
2876 func_fatal_help "you must specify a destination"
2880 # Strip any trailing slash from the destination.
2881 func_stripname '' '/' "$dest"
2882 dest=$func_stripname_result
2884 # Check to see that the destination is a directory.
2885 test -d "$dest" && isdir=yes
2886 if test "$isdir" = yes; then
2890 func_dirname_and_basename "$dest" "" "."
2891 destdir="$func_dirname_result"
2892 destname="$func_basename_result"
2894 # Not a directory, so check to see that there is only one file specified.
2895 set dummy $files; shift
2896 test "$#" -gt 1 && \
2897 func_fatal_help "\`$dest' is not a directory"
2900 [\\/]* | [A-Za-z]:[\\/]*) ;;
2902 for file in $files; do
2906 func_fatal_help "\`$destdir' must be an absolute directory name"
2913 # This variable tells wrapper scripts just to set variables rather
2914 # than running their programs.
2915 libtool_install_magic="$magic"
2920 for file in $files; do
2922 # Do each installation.
2925 # Do the static libraries later.
2926 func_append staticlibs " $file"
2930 func_resolve_sysroot "$file"
2931 file=$func_resolve_sysroot_result
2933 # Check to see that this really is a libtool archive.
2934 func_lalib_unsafe_p "$file" \
2935 || func_fatal_help "\`$file' is not a valid libtool archive"
2942 # Add the libdir to current_libdirs if it is the destination.
2943 if test "X$destdir" = "X$libdir"; then
2944 case "$current_libdirs " in
2946 *) func_append current_libdirs " $libdir" ;;
2949 # Note the libdir as a future libdir.
2950 case "$future_libdirs " in
2952 *) func_append future_libdirs " $libdir" ;;
2956 func_dirname "$file" "/" ""
2957 dir="$func_dirname_result"
2958 func_append dir "$objdir"
2960 if test -n "$relink_command"; then
2961 # Determine the prefix the user has applied to our future dir.
2962 inst_prefix_dir=`$ECHO "$destdir" | $SED -e "s%$libdir\$%%"`
2964 # Don't allow the user to place us outside of our expected
2965 # location b/c this prevents finding dependent libraries that
2966 # are installed to the same prefix.
2967 # At present, this check doesn't affect windows .dll's that
2968 # are installed into $libdir/../bin (currently, that works fine)
2969 # but it's something to keep an eye on.
2970 test "$inst_prefix_dir" = "$destdir" && \
2971 func_fatal_error "error: cannot install \`$file' to a directory not ending in $libdir"
2973 if test -n "$inst_prefix_dir"; then
2974 # Stick the inst_prefix_dir data into the link command.
2975 relink_command=`$ECHO "$relink_command" | $SED "s%@inst_prefix_dir@%-inst-prefix-dir $inst_prefix_dir%"`
2977 relink_command=`$ECHO "$relink_command" | $SED "s%@inst_prefix_dir@%%"`
2980 func_warning "relinking \`$file'"
2981 func_show_eval "$relink_command" \
2982 'func_fatal_error "error: relink \`$file'\'' with the above command before installing it"'
2985 # See the names of the shared library.
2986 set dummy $library_names; shift
2987 if test -n "$1"; then
2992 test -n "$relink_command" && srcname="$realname"T
2994 # Install the shared library and build the symlinks.
2995 func_show_eval "$install_shared_prog $dir/$srcname $destdir/$realname" \
2999 cygwin* | mingw* | pw32* | cegcc*)
3007 if test -n "$tstripme" && test -n "$striplib"; then
3008 func_show_eval "$striplib $destdir/$realname" 'exit $?'
3011 if test "$#" -gt 0; then
3012 # Delete the old symlinks, and create new ones.
3013 # Try `ln -sf' first, because the `ln' binary might depend on
3014 # the symlink we replace! Solaris /bin/ln does not understand -f,
3015 # so we also need to try rm && ln -s.
3018 test "$linkname" != "$realname" \
3019 && func_show_eval "(cd $destdir && { $LN_S -f $realname $linkname || { $RM $linkname && $LN_S $realname $linkname; }; })"
3023 # Do each command in the postinstall commands.
3024 lib="$destdir/$realname"
3025 func_execute_cmds "$postinstall_cmds" 'exit $?'
3028 # Install the pseudo-library for information purposes.
3029 func_basename "$file"
3030 name="$func_basename_result"
3031 instname="$dir/$name"i
3032 func_show_eval "$install_prog $instname $destdir/$name" 'exit $?'
3034 # Maybe install the static library, too.
3035 test -n "$old_library" && func_append staticlibs " $dir/$old_library"
3039 # Install (i.e. copy) a libtool object.
3041 # Figure out destination file name, if it wasn't already specified.
3042 if test -n "$destname"; then
3043 destfile="$destdir/$destname"
3045 func_basename "$file"
3046 destfile="$func_basename_result"
3047 destfile="$destdir/$destfile"
3050 # Deduce the name of the destination old-style object file.
3053 func_lo2o "$destfile"
3054 staticdest=$func_lo2o_result
3057 staticdest="$destfile"
3061 func_fatal_help "cannot copy a libtool object to \`$destfile'"
3065 # Install the libtool object if requested.
3066 test -n "$destfile" && \
3067 func_show_eval "$install_prog $file $destfile" 'exit $?'
3069 # Install the old object if enabled.
3070 if test "$build_old_libs" = yes; then
3071 # Deduce the name of the old-style object file.
3073 staticobj=$func_lo2o_result
3074 func_show_eval "$install_prog \$staticobj \$staticdest" 'exit $?'
3080 # Figure out destination file name, if it wasn't already specified.
3081 if test -n "$destname"; then
3082 destfile="$destdir/$destname"
3084 func_basename "$file"
3085 destfile="$func_basename_result"
3086 destfile="$destdir/$destfile"
3089 # If the file is missing, and there is a .exe on the end, strip it
3090 # because it is most likely a libtool script we actually want to
3095 if test ! -f "$file"; then
3096 func_stripname '' '.exe' "$file"
3097 file=$func_stripname_result
3103 # Do a test to see if this is really a libtool program.
3106 if func_ltwrapper_executable_p "$file"; then
3107 func_ltwrapper_scriptname "$file"
3108 wrapper=$func_ltwrapper_scriptname_result
3110 func_stripname '' '.exe' "$file"
3111 wrapper=$func_stripname_result
3118 if func_ltwrapper_script_p "$wrapper"; then
3122 func_source "$wrapper"
3124 # Check the variables that should have been set.
3125 test -z "$generated_by_libtool_version" && \
3126 func_fatal_error "invalid libtool wrapper script \`$wrapper'"
3129 for lib in $notinst_deplibs; do
3130 # Check to see that each library is installed.
3132 if test -f "$lib"; then
3135 libfile="$libdir/"`$ECHO "$lib" | $SED 's%^.*/%%g'` ### testsuite: skip nested quoting test
3136 if test -n "$libdir" && test ! -f "$libfile"; then
3137 func_warning "\`$lib' has not been installed in \`$libdir'"
3143 func_source "$wrapper"
3146 if test "$fast_install" = no && test -n "$relink_command"; then
3148 if test "$finalize" = yes; then
3149 tmpdir=`func_mktempdir`
3150 func_basename "$file$stripped_ext"
3151 file="$func_basename_result"
3152 outputname="$tmpdir/$file"
3153 # Replace the output file specification.
3154 relink_command=`$ECHO "$relink_command" | $SED 's%@OUTPUT@%'"$outputname"'%g'`
3157 func_quote_for_expand "$relink_command"
3158 eval "func_echo $func_quote_for_expand_result"
3160 if eval "$relink_command"; then :
3162 func_error "error: relink \`$file' with the above command before installing it"
3163 $opt_dry_run || ${RM}r "$tmpdir"
3168 func_warning "cannot relink \`$file'"
3172 # Install the binary that we compiled earlier.
3173 file=`$ECHO "$file$stripped_ext" | $SED "s%\([^/]*\)$%$objdir/\1%"`
3177 # remove .exe since cygwin /usr/bin/install will append another
3179 case $install_prog,$host in
3180 */usr/bin/install*,*cygwin*)
3181 case $file:$destfile in
3186 destfile=$destfile.exe
3189 func_stripname '' '.exe' "$destfile"
3190 destfile=$func_stripname_result
3195 func_show_eval "$install_prog\$stripme \$file \$destfile" 'exit $?'
3196 $opt_dry_run || if test -n "$outputname"; then
3203 for file in $staticlibs; do
3204 func_basename "$file"
3205 name="$func_basename_result"
3207 # Set up the ranlib parameters.
3208 oldlib="$destdir/$name"
3209 func_to_tool_file "$oldlib" func_convert_file_msys_to_w32
3210 tool_oldlib=$func_to_tool_file_result
3212 func_show_eval "$install_prog \$file \$oldlib" 'exit $?'
3214 if test -n "$stripme" && test -n "$old_striplib"; then
3215 func_show_eval "$old_striplib $tool_oldlib" 'exit $?'
3218 # Do each command in the postinstall commands.
3219 func_execute_cmds "$old_postinstall_cmds" 'exit $?'
3222 test -n "$future_libdirs" && \
3223 func_warning "remember to run \`$progname --finish$future_libdirs'"
3225 if test -n "$current_libdirs"; then
3226 # Maybe just do a dry run.
3227 $opt_dry_run && current_libdirs=" -n$current_libdirs"
3228 exec_cmd='$SHELL $progpath $preserve_args --finish$current_libdirs'
3234 test "$opt_mode" = install && func_mode_install ${1+"$@"}
3237 # func_generate_dlsyms outputname originator pic_p
3238 # Extract symbols from dlprefiles and create ${outputname}S.o with
3239 # a dlpreopen symbol table.
3240 func_generate_dlsyms ()
3246 my_prefix=`$ECHO "$my_originator" | sed 's%[^a-zA-Z0-9]%_%g'`
3249 if test -n "$dlfiles$dlprefiles" || test "$dlself" != no; then
3250 if test -n "$NM" && test -n "$global_symbol_pipe"; then
3251 my_dlsyms="${my_outputname}S.c"
3253 func_error "not configured to extract global symbols from dlpreopened files"
3257 if test -n "$my_dlsyms"; then
3261 # Discover the nlist of each of the dlfiles.
3262 nlist="$output_objdir/${my_outputname}.nm"
3264 func_show_eval "$RM $nlist ${nlist}S ${nlist}T"
3266 # Parse the name list into a source file.
3267 func_verbose "creating $output_objdir/$my_dlsyms"
3269 $opt_dry_run || $ECHO > "$output_objdir/$my_dlsyms" "\
3270 /* $my_dlsyms - symbol resolution table for \`$my_outputname' dlsym emulation. */
3271 /* Generated by $PROGRAM (GNU $PACKAGE$TIMESTAMP) $VERSION */
3277 #if defined(__GNUC__) && (((__GNUC__ == 4) && (__GNUC_MINOR__ >= 4)) || (__GNUC__ > 4))
3278 #pragma GCC diagnostic ignored \"-Wstrict-prototypes\"
3281 /* Keep this code in sync between libtool.m4, ltmain, lt_system.h, and tests. */
3282 #if defined(_WIN32) || defined(__CYGWIN__) || defined(_WIN32_WCE)
3283 /* DATA imports from DLLs on WIN32 con't be const, because runtime
3284 relocations are performed -- see ld's documentation on pseudo-relocs. */
3285 # define LT_DLSYM_CONST
3286 #elif defined(__osf__)
3287 /* This system does not cope well with relocations in const data. */
3288 # define LT_DLSYM_CONST
3290 # define LT_DLSYM_CONST const
3293 /* External symbol declarations for the compiler. */\
3296 if test "$dlself" = yes; then
3297 func_verbose "generating symbol list for \`$output'"
3299 $opt_dry_run || echo ': @PROGRAM@ ' > "$nlist"
3301 # Add our own program objects to the symbol list.
3302 progfiles=`$ECHO "$objs$old_deplibs" | $SP2NL | $SED "$lo2o" | $NL2SP`
3303 for progfile in $progfiles; do
3304 func_to_tool_file "$progfile" func_convert_file_msys_to_w32
3305 func_verbose "extracting global C symbols from \`$func_to_tool_file_result'"
3306 $opt_dry_run || eval "$NM $func_to_tool_file_result | $global_symbol_pipe >> '$nlist'"
3309 if test -n "$exclude_expsyms"; then
3311 eval '$EGREP -v " ($exclude_expsyms)$" "$nlist" > "$nlist"T'
3312 eval '$MV "$nlist"T "$nlist"'
3316 if test -n "$export_symbols_regex"; then
3318 eval '$EGREP -e "$export_symbols_regex" "$nlist" > "$nlist"T'
3319 eval '$MV "$nlist"T "$nlist"'
3323 # Prepare the list of exported symbols
3324 if test -z "$export_symbols"; then
3325 export_symbols="$output_objdir/$outputname.exp"
3328 eval "${SED} -n -e '/^: @PROGRAM@ $/d' -e 's/^.* \(.*\)$/\1/p' "'< "$nlist" > "$export_symbols"'
3330 *cygwin* | *mingw* | *cegcc* )
3331 eval "echo EXPORTS "'> "$output_objdir/$outputname.def"'
3332 eval 'cat "$export_symbols" >> "$output_objdir/$outputname.def"'
3338 eval "${SED} -e 's/\([].[*^$]\)/\\\\\1/g' -e 's/^/ /' -e 's/$/$/'"' < "$export_symbols" > "$output_objdir/$outputname.exp"'
3339 eval '$GREP -f "$output_objdir/$outputname.exp" < "$nlist" > "$nlist"T'
3340 eval '$MV "$nlist"T "$nlist"'
3342 *cygwin* | *mingw* | *cegcc* )
3343 eval "echo EXPORTS "'> "$output_objdir/$outputname.def"'
3344 eval 'cat "$nlist" >> "$output_objdir/$outputname.def"'
3351 for dlprefile in $dlprefiles; do
3352 func_verbose "extracting global C symbols from \`$dlprefile'"
3353 func_basename "$dlprefile"
3354 name="$func_basename_result"
3356 *cygwin* | *mingw* | *cegcc* )
3357 # if an import library, we need to obtain dlname
3358 if func_win32_import_lib_p "$dlprefile"; then
3359 func_tr_sh "$dlprefile"
3360 eval "curr_lafile=\$libfile_$func_tr_sh_result"
3361 dlprefile_dlbasename=""
3362 if test -n "$curr_lafile" && func_lalib_p "$curr_lafile"; then
3363 # Use subshell, to avoid clobbering current variable values
3364 dlprefile_dlname=`source "$curr_lafile" && echo "$dlname"`
3365 if test -n "$dlprefile_dlname" ; then
3366 func_basename "$dlprefile_dlname"
3367 dlprefile_dlbasename="$func_basename_result"
3369 # no lafile. user explicitly requested -dlpreopen <import library>.
3370 $sharedlib_from_linklib_cmd "$dlprefile"
3371 dlprefile_dlbasename=$sharedlib_from_linklib_result
3375 if test -n "$dlprefile_dlbasename" ; then
3376 eval '$ECHO ": $dlprefile_dlbasename" >> "$nlist"'
3378 func_warning "Could not compute DLL name from $name"
3379 eval '$ECHO ": $name " >> "$nlist"'
3381 func_to_tool_file "$dlprefile" func_convert_file_msys_to_w32
3382 eval "$NM \"$func_to_tool_file_result\" 2>/dev/null | $global_symbol_pipe |
3383 $SED -e '/I __imp/d' -e 's/I __nm_/D /;s/_nm__//' >> '$nlist'"
3385 else # not an import lib
3387 eval '$ECHO ": $name " >> "$nlist"'
3388 func_to_tool_file "$dlprefile" func_convert_file_msys_to_w32
3389 eval "$NM \"$func_to_tool_file_result\" 2>/dev/null | $global_symbol_pipe >> '$nlist'"
3395 eval '$ECHO ": $name " >> "$nlist"'
3396 func_to_tool_file "$dlprefile" func_convert_file_msys_to_w32
3397 eval "$NM \"$func_to_tool_file_result\" 2>/dev/null | $global_symbol_pipe >> '$nlist'"
3404 # Make sure we have at least an empty file.
3405 test -f "$nlist" || : > "$nlist"
3407 if test -n "$exclude_expsyms"; then
3408 $EGREP -v " ($exclude_expsyms)$" "$nlist" > "$nlist"T
3409 $MV "$nlist"T "$nlist"
3412 # Try sorting and uniquifying the output.
3413 if $GREP -v "^: " < "$nlist" |
3414 if sort -k 3 </dev/null >/dev/null 2>&1; then
3419 uniq > "$nlist"S; then
3422 $GREP -v "^: " < "$nlist" > "$nlist"S
3425 if test -f "$nlist"S; then
3426 eval "$global_symbol_to_cdecl"' < "$nlist"S >> "$output_objdir/$my_dlsyms"'
3428 echo '/* NONE */' >> "$output_objdir/$my_dlsyms"
3431 echo >> "$output_objdir/$my_dlsyms" "\
3433 /* The mapping between symbol names and symbols. */
3438 extern LT_DLSYM_CONST lt_dlsymlist
3439 lt_${my_prefix}_LTX_preloaded_symbols[];
3440 LT_DLSYM_CONST lt_dlsymlist
3441 lt_${my_prefix}_LTX_preloaded_symbols[] =
3443 { \"$my_originator\", (void *) 0 },"
3445 case $need_lib_prefix in
3447 eval "$global_symbol_to_c_name_address" < "$nlist" >> "$output_objdir/$my_dlsyms"
3450 eval "$global_symbol_to_c_name_address_lib_prefix" < "$nlist" >> "$output_objdir/$my_dlsyms"
3453 echo >> "$output_objdir/$my_dlsyms" "\
3457 /* This works around a problem in FreeBSD linker */
3458 #ifdef FREEBSD_WORKAROUND
3459 static const void *lt_preloaded_setup() {
3460 return lt_${my_prefix}_LTX_preloaded_symbols;
3470 pic_flag_for_symtable=
3471 case "$compile_command " in
3475 # compiling the symbol table file with pic_flag works around
3476 # a FreeBSD bug that causes programs to crash when -lm is
3477 # linked before any other PIC object. But we must not use
3478 # pic_flag when linking with -static. The problem exists in
3479 # FreeBSD 2.2.6 and is fixed in FreeBSD 3.1.
3480 *-*-freebsd2.*|*-*-freebsd3.0*|*-*-freebsdelf3.0*)
3481 pic_flag_for_symtable=" $pic_flag -DFREEBSD_WORKAROUND" ;;
3483 pic_flag_for_symtable=" $pic_flag" ;;
3485 if test "X$my_pic_p" != Xno; then
3486 pic_flag_for_symtable=" $pic_flag"
3493 for arg in $LTCFLAGS; do
3495 -pie | -fpie | -fPIE) ;;
3496 *) func_append symtab_cflags " $arg" ;;
3500 # Now compile the dynamic symbol file.
3501 func_show_eval '(cd $output_objdir && $LTCC$symtab_cflags -c$no_builtin_flag$pic_flag_for_symtable "$my_dlsyms")' 'exit $?'
3503 # Clean up the generated files.
3504 func_show_eval '$RM "$output_objdir/$my_dlsyms" "$nlist" "${nlist}S" "${nlist}T"'
3506 # Transform the symbol file into the correct name.
3507 symfileobj="$output_objdir/${my_outputname}S.$objext"
3509 *cygwin* | *mingw* | *cegcc* )
3510 if test -f "$output_objdir/$my_outputname.def"; then
3511 compile_command=`$ECHO "$compile_command" | $SED "s%@SYMFILE@%$output_objdir/$my_outputname.def $symfileobj%"`
3512 finalize_command=`$ECHO "$finalize_command" | $SED "s%@SYMFILE@%$output_objdir/$my_outputname.def $symfileobj%"`
3514 compile_command=`$ECHO "$compile_command" | $SED "s%@SYMFILE@%$symfileobj%"`
3515 finalize_command=`$ECHO "$finalize_command" | $SED "s%@SYMFILE@%$symfileobj%"`
3519 compile_command=`$ECHO "$compile_command" | $SED "s%@SYMFILE@%$symfileobj%"`
3520 finalize_command=`$ECHO "$finalize_command" | $SED "s%@SYMFILE@%$symfileobj%"`
3525 func_fatal_error "unknown suffix for \`$my_dlsyms'"
3529 # We keep going just in case the user didn't refer to
3530 # lt_preloaded_symbols. The linker will fail if global_symbol_pipe
3531 # really was required.
3533 # Nullify the symbol file.
3534 compile_command=`$ECHO "$compile_command" | $SED "s% @SYMFILE@%%"`
3535 finalize_command=`$ECHO "$finalize_command" | $SED "s% @SYMFILE@%%"`
3539 # func_win32_libid arg
3540 # return the library type of file 'arg'
3542 # Need a lot of goo to handle *both* DLLs and import libs
3543 # Has to be a shell function in order to 'eat' the argument
3544 # that is supplied when $file_magic_command is called.
3545 # Despite the name, also deal with 64 bit binaries.
3549 win32_libid_type="unknown"
3550 win32_fileres=`file -L $1 2>/dev/null`
3551 case $win32_fileres in
3552 *ar\ archive\ import\ library*) # definitely import
3553 win32_libid_type="x86 archive import"
3555 *ar\ archive*) # could be an import, or static
3556 # Keep the egrep pattern in sync with the one in _LT_CHECK_MAGIC_METHOD.
3557 if eval $OBJDUMP -f $1 | $SED -e '10q' 2>/dev/null |
3558 $EGREP 'file format (pei*-i386(.*architecture: i386)?|pe-arm-wince|pe-x86-64)' >/dev/null; then
3559 func_to_tool_file "$1" func_convert_file_msys_to_w32
3560 win32_nmres=`eval $NM -f posix -A \"$func_to_tool_file_result\" |
3569 case $win32_nmres in
3570 import*) win32_libid_type="x86 archive import";;
3571 *) win32_libid_type="x86 archive static";;
3576 win32_libid_type="x86 DLL"
3578 *executable*) # but shell scripts are "executable" too...
3579 case $win32_fileres in
3580 *MS\ Windows\ PE\ Intel*)
3581 win32_libid_type="x86 DLL"
3586 $ECHO "$win32_libid_type"
3589 # func_cygming_dll_for_implib ARG
3591 # Platform-specific function to extract the
3592 # name of the DLL associated with the specified
3593 # import library ARG.
3594 # Invoked by eval'ing the libtool variable
3595 # $sharedlib_from_linklib_cmd
3596 # Result is available in the variable
3597 # $sharedlib_from_linklib_result
3598 func_cygming_dll_for_implib ()
3601 sharedlib_from_linklib_result=`$DLLTOOL --identify-strict --identify "$1"`
3604 # func_cygming_dll_for_implib_fallback_core SECTION_NAME LIBNAMEs
3606 # The is the core of a fallback implementation of a
3607 # platform-specific function to extract the name of the
3608 # DLL associated with the specified import library LIBNAME.
3610 # SECTION_NAME is either .idata$6 or .idata$7, depending
3611 # on the platform and compiler that created the implib.
3613 # Echos the name of the DLL associated with the
3614 # specified import library.
3615 func_cygming_dll_for_implib_fallback_core ()
3618 match_literal=`$ECHO "$1" | $SED "$sed_make_literal_regex"`
3619 $OBJDUMP -s --section "$1" "$2" 2>/dev/null |
3620 $SED '/^Contents of section '"$match_literal"':/{
3621 # Place marker at beginning of archive member dllname section
3626 # These lines can sometimes be longer than 43 characters, but
3627 # are always uninteresting
3628 /:[ ]*file format pe[i]\{,1\}-/d
3629 /^In archive [^:]*:/d
3630 # Ensure marker is printed
3632 # Remove all lines with less than 43 characters
3634 # From remaining lines, remove first 43 characters
3637 # Join marker and all lines until next marker into a single line
3638 /^====MARK====/ b para
3647 # Remove trailing dots and whitespace
3651 # we now have a list, one entry per line, of the stringified
3652 # contents of the appropriate section of all members of the
3653 # archive which possess that section. Heuristic: eliminate
3654 # all those which have a first or second character that is
3655 # a '.' (that is, objdump's representation of an unprintable
3656 # character.) This should work for all archives with less than
3657 # 0x302f exports -- but will fail for DLLs whose name actually
3658 # begins with a literal '.' or a single character followed by
3661 # Of those that remain, print the first one.
3662 $SED -e '/^\./d;/^.\./d;q'
3665 # func_cygming_gnu_implib_p ARG
3666 # This predicate returns with zero status (TRUE) if
3667 # ARG is a GNU/binutils-style import library. Returns
3668 # with nonzero status (FALSE) otherwise.
3669 func_cygming_gnu_implib_p ()
3672 func_to_tool_file "$1" func_convert_file_msys_to_w32
3673 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)$'`
3674 test -n "$func_cygming_gnu_implib_tmp"
3677 # func_cygming_ms_implib_p ARG
3678 # This predicate returns with zero status (TRUE) if
3679 # ARG is an MS-style import library. Returns
3680 # with nonzero status (FALSE) otherwise.
3681 func_cygming_ms_implib_p ()
3684 func_to_tool_file "$1" func_convert_file_msys_to_w32
3685 func_cygming_ms_implib_tmp=`$NM "$func_to_tool_file_result" | eval "$global_symbol_pipe" | $GREP '_NULL_IMPORT_DESCRIPTOR'`
3686 test -n "$func_cygming_ms_implib_tmp"
3689 # func_cygming_dll_for_implib_fallback ARG
3690 # Platform-specific function to extract the
3691 # name of the DLL associated with the specified
3692 # import library ARG.
3694 # This fallback implementation is for use when $DLLTOOL
3695 # does not support the --identify-strict option.
3696 # Invoked by eval'ing the libtool variable
3697 # $sharedlib_from_linklib_cmd
3698 # Result is available in the variable
3699 # $sharedlib_from_linklib_result
3700 func_cygming_dll_for_implib_fallback ()
3703 if func_cygming_gnu_implib_p "$1" ; then
3704 # binutils import library
3705 sharedlib_from_linklib_result=`func_cygming_dll_for_implib_fallback_core '.idata$7' "$1"`
3706 elif func_cygming_ms_implib_p "$1" ; then
3707 # ms-generated import library
3708 sharedlib_from_linklib_result=`func_cygming_dll_for_implib_fallback_core '.idata$6' "$1"`
3711 sharedlib_from_linklib_result=""
3716 # func_extract_an_archive dir oldlib
3717 func_extract_an_archive ()
3720 f_ex_an_ar_dir="$1"; shift
3721 f_ex_an_ar_oldlib="$1"
3722 if test "$lock_old_archive_extraction" = yes; then
3723 lockfile=$f_ex_an_ar_oldlib.lock
3724 until $opt_dry_run || ln "$progpath" "$lockfile" 2>/dev/null; do
3725 func_echo "Waiting for $lockfile to be removed"
3729 func_show_eval "(cd \$f_ex_an_ar_dir && $AR x \"\$f_ex_an_ar_oldlib\")" \
3730 'stat=$?; rm -f "$lockfile"; exit $stat'
3731 if test "$lock_old_archive_extraction" = yes; then
3732 $opt_dry_run || rm -f "$lockfile"
3734 if ($AR t "$f_ex_an_ar_oldlib" | sort | sort -uc >/dev/null 2>&1); then
3737 func_fatal_error "object name conflicts in archive: $f_ex_an_ar_dir/$f_ex_an_ar_oldlib"
3742 # func_extract_archives gentop oldlib ...
3743 func_extract_archives ()
3746 my_gentop="$1"; shift
3747 my_oldlibs=${1+"$@"}
3753 for my_xlib in $my_oldlibs; do
3754 # Extract the objects.
3756 [\\/]* | [A-Za-z]:[\\/]*) my_xabs="$my_xlib" ;;
3757 *) my_xabs=`pwd`"/$my_xlib" ;;
3759 func_basename "$my_xlib"
3760 my_xlib="$func_basename_result"
3763 case " $extracted_archives " in
3765 func_arith $extracted_serial + 1
3766 extracted_serial=$func_arith_result
3767 my_xlib_u=lt$extracted_serial-$my_xlib ;;
3771 extracted_archives="$extracted_archives $my_xlib_u"
3772 my_xdir="$my_gentop/$my_xlib_u"
3774 func_mkdir_p "$my_xdir"
3778 func_verbose "Extracting $my_xabs"
3779 # Do not bother doing anything if just a dry run
3781 darwin_orig_dir=`pwd`
3782 cd $my_xdir || exit $?
3783 darwin_archive=$my_xabs
3785 darwin_base_archive=`basename "$darwin_archive"`
3786 darwin_arches=`$LIPO -info "$darwin_archive" 2>/dev/null | $GREP Architectures 2>/dev/null || true`
3787 if test -n "$darwin_arches"; then
3788 darwin_arches=`$ECHO "$darwin_arches" | $SED -e 's/.*are://'`
3790 func_verbose "$darwin_base_archive has multiple architectures $darwin_arches"
3791 for darwin_arch in $darwin_arches ; do
3792 func_mkdir_p "unfat-$$/${darwin_base_archive}-${darwin_arch}"
3793 $LIPO -thin $darwin_arch -output "unfat-$$/${darwin_base_archive}-${darwin_arch}/${darwin_base_archive}" "${darwin_archive}"
3794 cd "unfat-$$/${darwin_base_archive}-${darwin_arch}"
3795 func_extract_an_archive "`pwd`" "${darwin_base_archive}"
3797 $RM "unfat-$$/${darwin_base_archive}-${darwin_arch}/${darwin_base_archive}"
3798 done # $darwin_arches
3799 ## Okay now we've a bunch of thin objects, gotta fatten them up :)
3800 darwin_filelist=`find unfat-$$ -type f -name \*.o -print -o -name \*.lo -print | $SED -e "$basename" | sort -u`
3803 for darwin_file in $darwin_filelist; do
3804 darwin_files=`find unfat-$$ -name $darwin_file -print | sort | $NL2SP`
3805 $LIPO -create -output "$darwin_file" $darwin_files
3806 done # $darwin_filelist
3808 cd "$darwin_orig_dir"
3811 func_extract_an_archive "$my_xdir" "$my_xabs"
3816 func_extract_an_archive "$my_xdir" "$my_xabs"
3819 my_oldobjs="$my_oldobjs "`find $my_xdir -name \*.$objext -print -o -name \*.lo -print | sort | $NL2SP`
3822 func_extract_archives_result="$my_oldobjs"
3826 # func_emit_wrapper [arg=no]
3828 # Emit a libtool wrapper script on stdout.
3829 # Don't directly open a file because we may want to
3830 # incorporate the script contents within a cygwin/mingw
3831 # wrapper executable. Must ONLY be called from within
3832 # func_mode_link because it depends on a number of variables
3835 # ARG is the value that the WRAPPER_SCRIPT_BELONGS_IN_OBJDIR
3836 # variable will take. If 'yes', then the emitted script
3837 # will assume that the directory in which it is stored is
3838 # the $objdir directory. This is a cygwin/mingw-specific
3840 func_emit_wrapper ()
3842 func_emit_wrapper_arg1=${1-no}
3847 # $output - temporary wrapper script for $objdir/$outputname
3848 # Generated by $PROGRAM (GNU $PACKAGE$TIMESTAMP) $VERSION
3850 # The $output program cannot be directly executed until all the libtool
3851 # libraries that it depends on are installed.
3853 # This wrapper script should never be moved out of the build directory.
3854 # If it is, it will not operate correctly.
3856 # Sed substitution that helps us do robust quoting. It backslashifies
3857 # metacharacters that are still active within double-quoted strings.
3858 sed_quote_subst='$sed_quote_subst'
3860 # Be Bourne compatible
3861 if test -n \"\${ZSH_VERSION+set}\" && (emulate sh) >/dev/null 2>&1; then
3864 # Zsh 3.x and 4.x performs word splitting on \${1+\"\$@\"}, which
3865 # is contrary to our usage. Disable this feature.
3866 alias -g '\${1+\"\$@\"}'='\"\$@\"'
3867 setopt NO_GLOB_SUBST
3869 case \`(set -o) 2>/dev/null\` in *posix*) set -o posix;; esac
3871 BIN_SH=xpg4; export BIN_SH # for Tru64
3872 DUALCASE=1; export DUALCASE # for MKS sh
3874 # The HP-UX ksh and POSIX shell print the target directory to stdout
3876 (unset CDPATH) >/dev/null 2>&1 && unset CDPATH
3878 relink_command=\"$relink_command\"
3880 # This environment variable determines our operation mode.
3881 if test \"\$libtool_install_magic\" = \"$magic\"; then
3882 # install mode needs the following variables:
3883 generated_by_libtool_version='$macro_version'
3884 notinst_deplibs='$notinst_deplibs'
3886 # When we are sourced in execute mode, \$file and \$ECHO are already set.
3887 if test \"\$libtool_execute_magic\" != \"$magic\"; then
3890 qECHO=`$ECHO "$ECHO" | $SED "$sed_quote_subst"`
3893 # A function that is used when there is no print builtin or printf.
3894 func_fallback_echo ()
3896 eval 'cat <<_LTECHO_EOF
3903 # Very basic option parsing. These options are (a) specific to
3904 # the libtool wrapper, (b) are identical between the wrapper
3905 # /script/ and the wrapper /executable/ which is used only on
3906 # windows platforms, and (c) all begin with the string "--lt-"
3907 # (application programs are unlikely to have options which match
3910 # There are only two supported options: --lt-debug and
3911 # --lt-dump-script. There is, deliberately, no --lt-help.
3913 # The first argument to this parsing function should be the
3914 # script's $0 value, followed by "$@".
3916 func_parse_lt_options ()
3922 case \"\$lt_opt\" in
3923 --lt-debug) lt_option_debug=1 ;;
3925 lt_dump_D=\`\$ECHO \"X\$lt_script_arg0\" | $SED -e 's/^X//' -e 's%/[^/]*$%%'\`
3926 test \"X\$lt_dump_D\" = \"X\$lt_script_arg0\" && lt_dump_D=.
3927 lt_dump_F=\`\$ECHO \"X\$lt_script_arg0\" | $SED -e 's/^X//' -e 's%^.*/%%'\`
3928 cat \"\$lt_dump_D/\$lt_dump_F\"
3932 \$ECHO \"Unrecognized --lt- option: '\$lt_opt'\" 1>&2
3938 # Print the debug banner immediately:
3939 if test -n \"\$lt_option_debug\"; then
3940 echo \"${outputname}:${output}:\${LINENO}: libtool wrapper (GNU $PACKAGE$TIMESTAMP) $VERSION\" 1>&2
3944 # Used when --lt-debug. Prints its arguments to stdout
3945 # (redirection is the responsibility of the caller)
3946 func_lt_dump_args ()
3951 \$ECHO \"${outputname}:${output}:\${LINENO}: newargv[\$lt_dump_args_N]: \$lt_arg\"
3952 lt_dump_args_N=\`expr \$lt_dump_args_N + 1\`
3956 # Core function for launching the target application
3957 func_exec_program_core ()
3961 # Backslashes separate directories on plain windows
3962 *-*-mingw | *-*-os2* | *-cegcc*)
3964 if test -n \"\$lt_option_debug\"; then
3965 \$ECHO \"${outputname}:${output}:\${LINENO}: newargv[0]: \$progdir\\\\\$program\" 1>&2
3966 func_lt_dump_args \${1+\"\$@\"} 1>&2
3968 exec \"\$progdir\\\\\$program\" \${1+\"\$@\"}
3974 if test -n \"\$lt_option_debug\"; then
3975 \$ECHO \"${outputname}:${output}:\${LINENO}: newargv[0]: \$progdir/\$program\" 1>&2
3976 func_lt_dump_args \${1+\"\$@\"} 1>&2
3978 exec \"\$progdir/\$program\" \${1+\"\$@\"}
3983 \$ECHO \"\$0: cannot exec \$program \$*\" 1>&2
3987 # A function to encapsulate launching the target application
3988 # Strips options in the --lt-* namespace from \$@ and
3989 # launches target application with the remaining arguments.
3990 func_exec_program ()
3998 *) set x \"\$@\" \"\$lt_wr_arg\"; shift;;
4003 func_exec_program_core \${1+\"\$@\"}
4007 func_parse_lt_options \"\$0\" \${1+\"\$@\"}
4009 # Find the directory that this script lives in.
4010 thisdir=\`\$ECHO \"\$file\" | $SED 's%/[^/]*$%%'\`
4011 test \"x\$thisdir\" = \"x\$file\" && thisdir=.
4013 # Follow symbolic links until we get to the real thisdir.
4014 file=\`ls -ld \"\$file\" | $SED -n 's/.*-> //p'\`
4015 while test -n \"\$file\"; do
4016 destdir=\`\$ECHO \"\$file\" | $SED 's%/[^/]*\$%%'\`
4018 # If there was a directory component, then change thisdir.
4019 if test \"x\$destdir\" != \"x\$file\"; then
4020 case \"\$destdir\" in
4021 [\\\\/]* | [A-Za-z]:[\\\\/]*) thisdir=\"\$destdir\" ;;
4022 *) thisdir=\"\$thisdir/\$destdir\" ;;
4026 file=\`\$ECHO \"\$file\" | $SED 's%^.*/%%'\`
4027 file=\`ls -ld \"\$thisdir/\$file\" | $SED -n 's/.*-> //p'\`
4030 # Usually 'no', except on cygwin/mingw when embedded into
4032 WRAPPER_SCRIPT_BELONGS_IN_OBJDIR=$func_emit_wrapper_arg1
4033 if test \"\$WRAPPER_SCRIPT_BELONGS_IN_OBJDIR\" = \"yes\"; then
4034 # special case for '.'
4035 if test \"\$thisdir\" = \".\"; then
4038 # remove .libs from thisdir
4039 case \"\$thisdir\" in
4040 *[\\\\/]$objdir ) thisdir=\`\$ECHO \"\$thisdir\" | $SED 's%[\\\\/][^\\\\/]*$%%'\` ;;
4041 $objdir ) thisdir=. ;;
4045 # Try to get the absolute directory name.
4046 absdir=\`cd \"\$thisdir\" && pwd\`
4047 test -n \"\$absdir\" && thisdir=\"\$absdir\"
4050 if test "$fast_install" = yes; then
4052 program=lt-'$outputname'$exeext
4053 progdir=\"\$thisdir/$objdir\"
4055 if test ! -f \"\$progdir/\$program\" ||
4056 { file=\`ls -1dt \"\$progdir/\$program\" \"\$progdir/../\$program\" 2>/dev/null | ${SED} 1q\`; \\
4057 test \"X\$file\" != \"X\$progdir/\$program\"; }; then
4059 file=\"\$\$-\$program\"
4061 if test ! -d \"\$progdir\"; then
4062 $MKDIR \"\$progdir\"
4064 $RM \"\$progdir/\$file\"
4069 # relink executable if necessary
4070 if test -n \"\$relink_command\"; then
4071 if relink_command_output=\`eval \$relink_command 2>&1\`; then :
4073 $ECHO \"\$relink_command_output\" >&2
4074 $RM \"\$progdir/\$file\"
4079 $MV \"\$progdir/\$file\" \"\$progdir/\$program\" 2>/dev/null ||
4080 { $RM \"\$progdir/\$program\";
4081 $MV \"\$progdir/\$file\" \"\$progdir/\$program\"; }
4082 $RM \"\$progdir/\$file\"
4086 program='$outputname'
4087 progdir=\"\$thisdir/$objdir\"
4093 if test -f \"\$progdir/\$program\"; then"
4095 # fixup the dll searchpath if we need to.
4097 # Fix the DLL searchpath if we need to. Do this before prepending
4098 # to shlibpath, because on Windows, both are PATH and uninstalled
4099 # libraries must come first.
4100 if test -n "$dllsearchpath"; then
4102 # Add the dll search path components to the executable PATH
4103 PATH=$dllsearchpath:\$PATH
4107 # Export our shlibpath_var if we have one.
4108 if test "$shlibpath_overrides_runpath" = yes && test -n "$shlibpath_var" && test -n "$temp_rpath"; then
4110 # Add our own library path to $shlibpath_var
4111 $shlibpath_var=\"$temp_rpath\$$shlibpath_var\"
4113 # Some systems cannot cope with colon-terminated $shlibpath_var
4114 # The second colon is a workaround for a bug in BeOS R4 sed
4115 $shlibpath_var=\`\$ECHO \"\$$shlibpath_var\" | $SED 's/::*\$//'\`
4117 export $shlibpath_var
4122 if test \"\$libtool_execute_magic\" != \"$magic\"; then
4123 # Run the actual program with our arguments.
4124 func_exec_program \${1+\"\$@\"}
4127 # The program doesn't exist.
4128 \$ECHO \"\$0: error: \\\`\$progdir/\$program' does not exist\" 1>&2
4129 \$ECHO \"This script is just a wrapper for \$program.\" 1>&2
4130 \$ECHO \"See the $PACKAGE documentation for more information.\" 1>&2
4138 # func_emit_cwrapperexe_src
4139 # emit the source code for a wrapper executable on stdout
4140 # Must ONLY be called from within func_mode_link because
4141 # it depends on a number of variable set therein.
4142 func_emit_cwrapperexe_src ()
4146 /* $cwrappersource - temporary wrapper executable for $objdir/$outputname
4147 Generated by $PROGRAM (GNU $PACKAGE$TIMESTAMP) $VERSION
4149 The $output program cannot be directly executed until all the libtool
4150 libraries that it depends on are installed.
4152 This wrapper executable should never be moved out of the build directory.
4153 If it is, it will not operate correctly.
4158 # define _CRT_SECURE_NO_DEPRECATE 1
4163 # include <direct.h>
4164 # include <process.h>
4167 # include <unistd.h>
4168 # include <stdint.h>
4180 #include <sys/stat.h>
4182 /* declarations of non-ANSI functions */
4183 #if defined(__MINGW32__)
4184 # ifdef __STRICT_ANSI__
4185 int _putenv (const char *);
4187 #elif defined(__CYGWIN__)
4188 # ifdef __STRICT_ANSI__
4189 char *realpath (const char *, char *);
4190 int putenv (char *);
4191 int setenv (const char *, const char *, int);
4193 /* #elif defined (other platforms) ... */
4196 /* portability defines, excluding path handling macros */
4197 #if defined(_MSC_VER)
4198 # define setmode _setmode
4200 # define chmod _chmod
4201 # define getcwd _getcwd
4202 # define putenv _putenv
4203 # define S_IXUSR _S_IEXEC
4204 # ifndef _INTPTR_T_DEFINED
4205 # define _INTPTR_T_DEFINED
4206 # define intptr_t int
4208 #elif defined(__MINGW32__)
4209 # define setmode _setmode
4211 # define chmod _chmod
4212 # define getcwd _getcwd
4213 # define putenv _putenv
4214 #elif defined(__CYGWIN__)
4215 # define HAVE_SETENV
4216 # define FOPEN_WB "wb"
4217 /* #elif defined (other platforms) ... */
4220 #if defined(PATH_MAX)
4221 # define LT_PATHMAX PATH_MAX
4222 #elif defined(MAXPATHLEN)
4223 # define LT_PATHMAX MAXPATHLEN
4225 # define LT_PATHMAX 1024
4235 /* path handling portability macros */
4236 #ifndef DIR_SEPARATOR
4237 # define DIR_SEPARATOR '/'
4238 # define PATH_SEPARATOR ':'
4241 #if defined (_WIN32) || defined (__MSDOS__) || defined (__DJGPP__) || \
4243 # define HAVE_DOS_BASED_FILE_SYSTEM
4244 # define FOPEN_WB "wb"
4245 # ifndef DIR_SEPARATOR_2
4246 # define DIR_SEPARATOR_2 '\\'
4248 # ifndef PATH_SEPARATOR_2
4249 # define PATH_SEPARATOR_2 ';'
4253 #ifndef DIR_SEPARATOR_2
4254 # define IS_DIR_SEPARATOR(ch) ((ch) == DIR_SEPARATOR)
4255 #else /* DIR_SEPARATOR_2 */
4256 # define IS_DIR_SEPARATOR(ch) \
4257 (((ch) == DIR_SEPARATOR) || ((ch) == DIR_SEPARATOR_2))
4258 #endif /* DIR_SEPARATOR_2 */
4260 #ifndef PATH_SEPARATOR_2
4261 # define IS_PATH_SEPARATOR(ch) ((ch) == PATH_SEPARATOR)
4262 #else /* PATH_SEPARATOR_2 */
4263 # define IS_PATH_SEPARATOR(ch) ((ch) == PATH_SEPARATOR_2)
4264 #endif /* PATH_SEPARATOR_2 */
4267 # define FOPEN_WB "w"
4270 # define _O_BINARY 0
4273 #define XMALLOC(type, num) ((type *) xmalloc ((num) * sizeof(type)))
4274 #define XFREE(stale) do { \
4275 if (stale) { free ((void *) stale); stale = 0; } \
4278 #if defined(LT_DEBUGWRAPPER)
4279 static int lt_debug = 1;
4281 static int lt_debug = 0;
4284 const char *program_name = "libtool-wrapper"; /* in case xstrdup fails */
4286 void *xmalloc (size_t num);
4287 char *xstrdup (const char *string);
4288 const char *base_name (const char *name);
4289 char *find_executable (const char *wrapper);
4290 char *chase_symlinks (const char *pathspec);
4291 int make_executable (const char *path);
4292 int check_executable (const char *path);
4293 char *strendzap (char *str, const char *pat);
4294 void lt_debugprintf (const char *file, int line, const char *fmt, ...);
4295 void lt_fatal (const char *file, int line, const char *message, ...);
4296 static const char *nonnull (const char *s);
4297 static const char *nonempty (const char *s);
4298 void lt_setenv (const char *name, const char *value);
4299 char *lt_extend_str (const char *orig_value, const char *add, int to_end);
4300 void lt_update_exe_path (const char *name, const char *value);
4301 void lt_update_lib_path (const char *name, const char *value);
4302 char **prepare_spawn (char **argv);
4303 void lt_dump_script (FILE *f);
4307 volatile const char * MAGIC_EXE = "$magic_exe";
4308 const char * LIB_PATH_VARNAME = "$shlibpath_var";
4311 if test "$shlibpath_overrides_runpath" = yes && test -n "$shlibpath_var" && test -n "$temp_rpath"; then
4312 func_to_host_path "$temp_rpath"
4314 const char * LIB_PATH_VALUE = "$func_to_host_path_result";
4318 const char * LIB_PATH_VALUE = "";
4322 if test -n "$dllsearchpath"; then
4323 func_to_host_path "$dllsearchpath:"
4325 const char * EXE_PATH_VARNAME = "PATH";
4326 const char * EXE_PATH_VALUE = "$func_to_host_path_result";
4330 const char * EXE_PATH_VARNAME = "";
4331 const char * EXE_PATH_VALUE = "";
4335 if test "$fast_install" = yes; then
4337 const char * TARGET_PROGRAM_NAME = "lt-$outputname"; /* hopefully, no .exe */
4341 const char * TARGET_PROGRAM_NAME = "$outputname"; /* hopefully, no .exe */
4348 #define LTWRAPPER_OPTION_PREFIX "--lt-"
4350 static const char *ltwrapper_option_prefix = LTWRAPPER_OPTION_PREFIX;
4351 static const char *dumpscript_opt = LTWRAPPER_OPTION_PREFIX "dump-script";
4352 static const char *debug_opt = LTWRAPPER_OPTION_PREFIX "debug";
4355 main (int argc, char *argv[])
4360 char *actual_cwrapper_path;
4361 char *actual_cwrapper_name;
4364 intptr_t rval = 127;
4368 program_name = (char *) xstrdup (base_name (argv[0]));
4369 newargz = XMALLOC (char *, argc + 1);
4371 /* very simple arg parsing; don't want to rely on getopt
4372 * also, copy all non cwrapper options to newargz, except
4373 * argz[0], which is handled differently
4376 for (i = 1; i < argc; i++)
4378 if (strcmp (argv[i], dumpscript_opt) == 0)
4382 *mingw* | *cygwin* )
4383 # make stdout use "unix" line endings
4384 echo " setmode(1,_O_BINARY);"
4389 lt_dump_script (stdout);
4392 if (strcmp (argv[i], debug_opt) == 0)
4397 if (strcmp (argv[i], ltwrapper_option_prefix) == 0)
4399 /* however, if there is an option in the LTWRAPPER_OPTION_PREFIX
4400 namespace, but it is not one of the ones we know about and
4401 have already dealt with, above (inluding dump-script), then
4402 report an error. Otherwise, targets might begin to believe
4403 they are allowed to use options in the LTWRAPPER_OPTION_PREFIX
4404 namespace. The first time any user complains about this, we'll
4405 need to make LTWRAPPER_OPTION_PREFIX a configure-time option
4406 or a configure.ac-settable value.
4408 lt_fatal (__FILE__, __LINE__,
4409 "unrecognized %s option: '%s'",
4410 ltwrapper_option_prefix, argv[i]);
4413 newargz[++newargc] = xstrdup (argv[i]);
4415 newargz[++newargc] = NULL;
4419 /* The GNU banner must be the first non-error debug message */
4420 lt_debugprintf (__FILE__, __LINE__, "libtool wrapper (GNU $PACKAGE$TIMESTAMP) $VERSION\n");
4423 lt_debugprintf (__FILE__, __LINE__, "(main) argv[0]: %s\n", argv[0]);
4424 lt_debugprintf (__FILE__, __LINE__, "(main) program_name: %s\n", program_name);
4426 tmp_pathspec = find_executable (argv[0]);
4427 if (tmp_pathspec == NULL)
4428 lt_fatal (__FILE__, __LINE__, "couldn't find %s", argv[0]);
4429 lt_debugprintf (__FILE__, __LINE__,
4430 "(main) found exe (before symlink chase) at: %s\n",
4433 actual_cwrapper_path = chase_symlinks (tmp_pathspec);
4434 lt_debugprintf (__FILE__, __LINE__,
4435 "(main) found exe (after symlink chase) at: %s\n",
4436 actual_cwrapper_path);
4437 XFREE (tmp_pathspec);
4439 actual_cwrapper_name = xstrdup (base_name (actual_cwrapper_path));
4440 strendzap (actual_cwrapper_path, actual_cwrapper_name);
4442 /* wrapper name transforms */
4443 strendzap (actual_cwrapper_name, ".exe");
4444 tmp_pathspec = lt_extend_str (actual_cwrapper_name, ".exe", 1);
4445 XFREE (actual_cwrapper_name);
4446 actual_cwrapper_name = tmp_pathspec;
4449 /* target_name transforms -- use actual target program name; might have lt- prefix */
4450 target_name = xstrdup (base_name (TARGET_PROGRAM_NAME));
4451 strendzap (target_name, ".exe");
4452 tmp_pathspec = lt_extend_str (target_name, ".exe", 1);
4453 XFREE (target_name);
4454 target_name = tmp_pathspec;
4457 lt_debugprintf (__FILE__, __LINE__,
4458 "(main) libtool target name: %s\n",
4464 XMALLOC (char, (strlen (actual_cwrapper_path) +
4465 strlen ("$objdir") + 1 + strlen (actual_cwrapper_name) + 1));
4466 strcpy (newargz[0], actual_cwrapper_path);
4467 strcat (newargz[0], "$objdir");
4468 strcat (newargz[0], "/");
4472 /* stop here, and copy so we don't have to do this twice */
4473 tmp_pathspec = xstrdup (newargz[0]);
4475 /* do NOT want the lt- prefix here, so use actual_cwrapper_name */
4476 strcat (newargz[0], actual_cwrapper_name);
4478 /* DO want the lt- prefix here if it exists, so use target_name */
4479 lt_argv_zero = lt_extend_str (tmp_pathspec, target_name, 1);
4480 XFREE (tmp_pathspec);
4481 tmp_pathspec = NULL;
4489 while ((p = strchr (newargz[0], '\\')) != NULL)
4493 while ((p = strchr (lt_argv_zero, '\\')) != NULL)
4503 XFREE (target_name);
4504 XFREE (actual_cwrapper_path);
4505 XFREE (actual_cwrapper_name);
4507 lt_setenv ("BIN_SH", "xpg4"); /* for Tru64 */
4508 lt_setenv ("DUALCASE", "1"); /* for MSK sh */
4509 /* Update the DLL searchpath. EXE_PATH_VALUE ($dllsearchpath) must
4510 be prepended before (that is, appear after) LIB_PATH_VALUE ($temp_rpath)
4511 because on Windows, both *_VARNAMEs are PATH but uninstalled
4512 libraries must come first. */
4513 lt_update_exe_path (EXE_PATH_VARNAME, EXE_PATH_VALUE);
4514 lt_update_lib_path (LIB_PATH_VARNAME, LIB_PATH_VALUE);
4516 lt_debugprintf (__FILE__, __LINE__, "(main) lt_argv_zero: %s\n",
4517 nonnull (lt_argv_zero));
4518 for (i = 0; i < newargc; i++)
4520 lt_debugprintf (__FILE__, __LINE__, "(main) newargz[%d]: %s\n",
4521 i, nonnull (newargz[i]));
4529 /* execv doesn't actually work on mingw as expected on unix */
4530 newargz = prepare_spawn (newargz);
4531 rval = _spawnv (_P_WAIT, lt_argv_zero, (const char * const *) newargz);
4534 /* failed to start process */
4535 lt_debugprintf (__FILE__, __LINE__,
4536 "(main) failed to launch target \"%s\": %s\n",
4537 lt_argv_zero, nonnull (strerror (errno)));
4545 execv (lt_argv_zero, newargz);
4546 return rval; /* =127, but avoids unused variable warning */
4555 xmalloc (size_t num)
4557 void *p = (void *) malloc (num);
4559 lt_fatal (__FILE__, __LINE__, "memory exhausted");
4565 xstrdup (const char *string)
4567 return string ? strcpy ((char *) xmalloc (strlen (string) + 1),
4572 base_name (const char *name)
4576 #if defined (HAVE_DOS_BASED_FILE_SYSTEM)
4577 /* Skip over the disk name in MSDOS pathnames. */
4578 if (isalpha ((unsigned char) name[0]) && name[1] == ':')
4582 for (base = name; *name; name++)
4583 if (IS_DIR_SEPARATOR (*name))
4589 check_executable (const char *path)
4593 lt_debugprintf (__FILE__, __LINE__, "(check_executable): %s\n",
4595 if ((!path) || (!*path))
4598 if ((stat (path, &st) >= 0)
4599 && (st.st_mode & (S_IXUSR | S_IXGRP | S_IXOTH)))
4606 make_executable (const char *path)
4611 lt_debugprintf (__FILE__, __LINE__, "(make_executable): %s\n",
4613 if ((!path) || (!*path))
4616 if (stat (path, &st) >= 0)
4618 rval = chmod (path, st.st_mode | S_IXOTH | S_IXGRP | S_IXUSR);
4623 /* Searches for the full path of the wrapper. Returns
4624 newly allocated full path name if found, NULL otherwise
4625 Does not chase symlinks, even on platforms that support them.
4628 find_executable (const char *wrapper)
4633 /* static buffer for getcwd */
4634 char tmp[LT_PATHMAX + 1];
4638 lt_debugprintf (__FILE__, __LINE__, "(find_executable): %s\n",
4639 nonempty (wrapper));
4641 if ((wrapper == NULL) || (*wrapper == '\0'))
4644 /* Absolute path? */
4645 #if defined (HAVE_DOS_BASED_FILE_SYSTEM)
4646 if (isalpha ((unsigned char) wrapper[0]) && wrapper[1] == ':')
4648 concat_name = xstrdup (wrapper);
4649 if (check_executable (concat_name))
4651 XFREE (concat_name);
4656 if (IS_DIR_SEPARATOR (wrapper[0]))
4658 concat_name = xstrdup (wrapper);
4659 if (check_executable (concat_name))
4661 XFREE (concat_name);
4663 #if defined (HAVE_DOS_BASED_FILE_SYSTEM)
4667 for (p = wrapper; *p; p++)
4675 /* no slashes; search PATH */
4676 const char *path = getenv ("PATH");
4679 for (p = path; *p; p = p_next)
4683 for (q = p; *q; q++)
4684 if (IS_PATH_SEPARATOR (*q))
4687 p_next = (*q == '\0' ? q : q + 1);
4690 /* empty path: current directory */
4691 if (getcwd (tmp, LT_PATHMAX) == NULL)
4692 lt_fatal (__FILE__, __LINE__, "getcwd failed: %s",
4693 nonnull (strerror (errno)));
4694 tmp_len = strlen (tmp);
4696 XMALLOC (char, tmp_len + 1 + strlen (wrapper) + 1);
4697 memcpy (concat_name, tmp, tmp_len);
4698 concat_name[tmp_len] = '/';
4699 strcpy (concat_name + tmp_len + 1, wrapper);
4704 XMALLOC (char, p_len + 1 + strlen (wrapper) + 1);
4705 memcpy (concat_name, p, p_len);
4706 concat_name[p_len] = '/';
4707 strcpy (concat_name + p_len + 1, wrapper);
4709 if (check_executable (concat_name))
4711 XFREE (concat_name);
4714 /* not found in PATH; assume curdir */
4716 /* Relative path | not found in path: prepend cwd */
4717 if (getcwd (tmp, LT_PATHMAX) == NULL)
4718 lt_fatal (__FILE__, __LINE__, "getcwd failed: %s",
4719 nonnull (strerror (errno)));
4720 tmp_len = strlen (tmp);
4721 concat_name = XMALLOC (char, tmp_len + 1 + strlen (wrapper) + 1);
4722 memcpy (concat_name, tmp, tmp_len);
4723 concat_name[tmp_len] = '/';
4724 strcpy (concat_name + tmp_len + 1, wrapper);
4726 if (check_executable (concat_name))
4728 XFREE (concat_name);
4733 chase_symlinks (const char *pathspec)
4736 return xstrdup (pathspec);
4738 char buf[LT_PATHMAX];
4740 char *tmp_pathspec = xstrdup (pathspec);
4742 int has_symlinks = 0;
4743 while (strlen (tmp_pathspec) && !has_symlinks)
4745 lt_debugprintf (__FILE__, __LINE__,
4746 "checking path component for symlinks: %s\n",
4748 if (lstat (tmp_pathspec, &s) == 0)
4750 if (S_ISLNK (s.st_mode) != 0)
4756 /* search backwards for last DIR_SEPARATOR */
4757 p = tmp_pathspec + strlen (tmp_pathspec) - 1;
4758 while ((p > tmp_pathspec) && (!IS_DIR_SEPARATOR (*p)))
4760 if ((p == tmp_pathspec) && (!IS_DIR_SEPARATOR (*p)))
4762 /* no more DIR_SEPARATORS left */
4769 lt_fatal (__FILE__, __LINE__,
4770 "error accessing file \"%s\": %s",
4771 tmp_pathspec, nonnull (strerror (errno)));
4774 XFREE (tmp_pathspec);
4778 return xstrdup (pathspec);
4781 tmp_pathspec = realpath (pathspec, buf);
4782 if (tmp_pathspec == 0)
4784 lt_fatal (__FILE__, __LINE__,
4785 "could not follow symlinks for %s", pathspec);
4787 return xstrdup (tmp_pathspec);
4792 strendzap (char *str, const char *pat)
4796 assert (str != NULL);
4797 assert (pat != NULL);
4800 patlen = strlen (pat);
4804 str += len - patlen;
4805 if (strcmp (str, pat) == 0)
4812 lt_debugprintf (const char *file, int line, const char *fmt, ...)
4817 (void) fprintf (stderr, "%s:%s:%d: ", program_name, file, line);
4818 va_start (args, fmt);
4819 (void) vfprintf (stderr, fmt, args);
4825 lt_error_core (int exit_status, const char *file,
4826 int line, const char *mode,
4827 const char *message, va_list ap)
4829 fprintf (stderr, "%s:%s:%d: %s: ", program_name, file, line, mode);
4830 vfprintf (stderr, message, ap);
4831 fprintf (stderr, ".\n");
4833 if (exit_status >= 0)
4838 lt_fatal (const char *file, int line, const char *message, ...)
4841 va_start (ap, message);
4842 lt_error_core (EXIT_FAILURE, file, line, "FATAL", message, ap);
4847 nonnull (const char *s)
4849 return s ? s : "(null)";
4853 nonempty (const char *s)
4855 return (s && !*s) ? "(empty)" : nonnull (s);
4859 lt_setenv (const char *name, const char *value)
4861 lt_debugprintf (__FILE__, __LINE__,
4862 "(lt_setenv) setting '%s' to '%s'\n",
4863 nonnull (name), nonnull (value));
4866 /* always make a copy, for consistency with !HAVE_SETENV */
4867 char *str = xstrdup (value);
4868 setenv (name, str, 1);
4870 int len = strlen (name) + 1 + strlen (value) + 1;
4871 char *str = XMALLOC (char, len);
4872 sprintf (str, "%s=%s", name, value);
4873 if (putenv (str) != EXIT_SUCCESS)
4882 lt_extend_str (const char *orig_value, const char *add, int to_end)
4885 if (orig_value && *orig_value)
4887 int orig_value_len = strlen (orig_value);
4888 int add_len = strlen (add);
4889 new_value = XMALLOC (char, add_len + orig_value_len + 1);
4892 strcpy (new_value, orig_value);
4893 strcpy (new_value + orig_value_len, add);
4897 strcpy (new_value, add);
4898 strcpy (new_value + add_len, orig_value);
4903 new_value = xstrdup (add);
4909 lt_update_exe_path (const char *name, const char *value)
4911 lt_debugprintf (__FILE__, __LINE__,
4912 "(lt_update_exe_path) modifying '%s' by prepending '%s'\n",
4913 nonnull (name), nonnull (value));
4915 if (name && *name && value && *value)
4917 char *new_value = lt_extend_str (getenv (name), value, 0);
4918 /* some systems can't cope with a ':'-terminated path #' */
4919 int len = strlen (new_value);
4920 while (((len = strlen (new_value)) > 0) && IS_PATH_SEPARATOR (new_value[len-1]))
4922 new_value[len-1] = '\0';
4924 lt_setenv (name, new_value);
4930 lt_update_lib_path (const char *name, const char *value)
4932 lt_debugprintf (__FILE__, __LINE__,
4933 "(lt_update_lib_path) modifying '%s' by prepending '%s'\n",
4934 nonnull (name), nonnull (value));
4936 if (name && *name && value && *value)
4938 char *new_value = lt_extend_str (getenv (name), value, 0);
4939 lt_setenv (name, new_value);
4949 /* Prepares an argument vector before calling spawn().
4950 Note that spawn() does not by itself call the command interpreter
4951 (getenv ("COMSPEC") != NULL ? getenv ("COMSPEC") :
4952 ({ OSVERSIONINFO v; v.dwOSVersionInfoSize = sizeof(OSVERSIONINFO);
4954 v.dwPlatformId == VER_PLATFORM_WIN32_NT;
4955 }) ? "cmd.exe" : "command.com").
4956 Instead it simply concatenates the arguments, separated by ' ', and calls
4957 CreateProcess(). We must quote the arguments since Win32 CreateProcess()
4958 interprets characters like ' ', '\t', '\\', '"' (but not '<' and '>') in a
4960 - Space and tab are interpreted as delimiters. They are not treated as
4961 delimiters if they are surrounded by double quotes: "...".
4962 - Unescaped double quotes are removed from the input. Their only effect is
4963 that within double quotes, space and tab are treated like normal
4965 - Backslashes not followed by double quotes are not special.
4966 - But 2*n+1 backslashes followed by a double quote become
4967 n backslashes followed by a double quote (n >= 0):
4972 #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"
4973 #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"
4975 prepare_spawn (char **argv)
4981 /* Count number of arguments. */
4982 for (argc = 0; argv[argc] != NULL; argc++)
4985 /* Allocate new argument vector. */
4986 new_argv = XMALLOC (char *, argc + 1);
4988 /* Put quoted arguments into the new argument vector. */
4989 for (i = 0; i < argc; i++)
4991 const char *string = argv[i];
4993 if (string[0] == '\0')
4994 new_argv[i] = xstrdup ("\"\"");
4995 else if (strpbrk (string, SHELL_SPECIAL_CHARS) != NULL)
4997 int quote_around = (strpbrk (string, SHELL_SPACE_CHARS) != NULL);
4999 unsigned int backslashes;
5001 char *quoted_string;
5008 for (s = string; *s != '\0'; s++)
5012 length += backslashes + 1;
5020 length += backslashes + 1;
5022 quoted_string = XMALLOC (char, length + 1);
5028 for (s = string; *s != '\0'; s++)
5034 for (j = backslashes + 1; j > 0; j--)
5046 for (j = backslashes; j > 0; j--)
5052 new_argv[i] = quoted_string;
5055 new_argv[i] = (char *) string;
5057 new_argv[argc] = NULL;
5066 void lt_dump_script (FILE* f)
5069 func_emit_wrapper yes |
5071 s/^\(.\{79\}\)\(..*\)/\1\
5076 s/\([^\n]*\).*/ fputs ("\1", f);/p
5083 # end: func_emit_cwrapperexe_src
5085 # func_win32_import_lib_p ARG
5086 # True if ARG is an import lib, as indicated by $file_magic_cmd
5087 func_win32_import_lib_p ()
5090 case `eval $file_magic_cmd \"\$1\" 2>/dev/null | $SED -e 10q` in
5096 # func_mode_link arg...
5101 *-*-cygwin* | *-*-mingw* | *-*-pw32* | *-*-os2* | *-cegcc*)
5102 # It is impossible to link a dll without this setting, and
5103 # we shouldn't force the makefile maintainer to figure out
5104 # which system we are compiling for in order to pass an extra
5105 # flag for every libtool invocation.
5106 # allow_undefined=no
5108 # FIXME: Unfortunately, there are problems with the above when trying
5109 # to make a dll which has undefined symbols, in which case not
5110 # even a static library is built. For now, we need to specify
5111 # -no-undefined on the libtool link line when we can be certain
5112 # that all symbols are satisfied, otherwise we get a static library.
5119 libtool_args=$nonopt
5120 base_compile="$nonopt $@"
5121 compile_command=$nonopt
5122 finalize_command=$nonopt
5135 lib_search_path=`pwd`
5137 new_inherited_linker_flags=
5146 export_symbols_regex=
5154 precious_files_regex=
5155 prefer_static_libs=no
5168 single_module="${wl}-single_module"
5169 func_infer_tag $base_compile
5171 # We need to know -static, to get the right output filenames.
5176 test "$build_libtool_libs" != yes && \
5177 func_fatal_configuration "can not build a shared library"
5181 -all-static | -static | -static-libtool-libs)
5184 if test "$build_libtool_libs" = yes && test -z "$link_static_flag"; then
5185 func_warning "complete static linking is impossible in this configuration"
5187 if test -n "$link_static_flag"; then
5188 dlopen_self=$dlopen_self_static
5190 prefer_static_libs=yes
5193 if test -z "$pic_flag" && test -n "$link_static_flag"; then
5194 dlopen_self=$dlopen_self_static
5196 prefer_static_libs=built
5198 -static-libtool-libs)
5199 if test -z "$pic_flag" && test -n "$link_static_flag"; then
5200 dlopen_self=$dlopen_self_static
5202 prefer_static_libs=yes
5205 build_libtool_libs=no
5212 # See if our shared archives depend on static archives.
5213 test -n "$old_archive_from_new_cmds" && build_old_libs=yes
5215 # Go through the arguments, transforming them on the way.
5216 while test "$#" -gt 0; do
5219 func_quote_for_eval "$arg"
5220 qarg=$func_quote_for_eval_unquoted_result
5221 func_append libtool_args " $func_quote_for_eval_result"
5223 # If the previous option needs an argument, assign it.
5224 if test -n "$prev"; then
5227 func_append compile_command " @OUTPUT@"
5228 func_append finalize_command " @OUTPUT@"
5239 if test "$preload" = no; then
5240 # Add the symbol object into the linking commands.
5241 func_append compile_command " @SYMFILE@"
5242 func_append finalize_command " @SYMFILE@"
5246 *.la | *.lo) ;; # We handle these cases below.
5248 if test "$dlself" = no; then
5256 if test "$prev" = dlprefiles; then
5258 elif test "$prev" = dlfiles && test "$dlopen_self" != yes; then
5268 if test "$prev" = dlfiles; then
5269 func_append dlfiles " $arg"
5271 func_append dlprefiles " $arg"
5279 export_symbols="$arg"
5281 || func_fatal_error "symbol file \`$arg' does not exist"
5286 export_symbols_regex="$arg"
5294 *" $qarg.ltframework "*) ;;
5295 *) func_append deplibs " $qarg.ltframework" # this is fixed later
5304 inst_prefix_dir="$arg"
5309 if test -f "$arg"; then
5312 for fil in `cat "$save_arg"`
5314 # func_append moreargs " $fil"
5316 # A libtool-controlled object.
5318 # Check to see that this really is a libtool object.
5319 if func_lalib_unsafe_p "$arg"; then
5326 if test -z "$pic_object" ||
5327 test -z "$non_pic_object" ||
5328 test "$pic_object" = none &&
5329 test "$non_pic_object" = none; then
5330 func_fatal_error "cannot find name of object for \`$arg'"
5333 # Extract subdirectory from the argument.
5334 func_dirname "$arg" "/" ""
5335 xdir="$func_dirname_result"
5337 if test "$pic_object" != none; then
5338 # Prepend the subdirectory the object is found in.
5339 pic_object="$xdir$pic_object"
5341 if test "$prev" = dlfiles; then
5342 if test "$build_libtool_libs" = yes && test "$dlopen_support" = yes; then
5343 func_append dlfiles " $pic_object"
5347 # If libtool objects are unsupported, then we need to preload.
5352 # CHECK ME: I think I busted this. -Ossama
5353 if test "$prev" = dlprefiles; then
5354 # Preload the old-style object.
5355 func_append dlprefiles " $pic_object"
5360 func_append libobjs " $pic_object"
5365 if test "$non_pic_object" != none; then
5366 # Prepend the subdirectory the object is found in.
5367 non_pic_object="$xdir$non_pic_object"
5369 # A standard non-PIC object
5370 func_append non_pic_objects " $non_pic_object"
5371 if test -z "$pic_object" || test "$pic_object" = none ; then
5372 arg="$non_pic_object"
5375 # If the PIC object exists, use it instead.
5376 # $xdir was prepended to $pic_object above.
5377 non_pic_object="$pic_object"
5378 func_append non_pic_objects " $non_pic_object"
5381 # Only an error if not doing a dry-run.
5382 if $opt_dry_run; then
5383 # Extract subdirectory from the argument.
5384 func_dirname "$arg" "/" ""
5385 xdir="$func_dirname_result"
5388 pic_object=$xdir$objdir/$func_lo2o_result
5389 non_pic_object=$xdir$func_lo2o_result
5390 func_append libobjs " $pic_object"
5391 func_append non_pic_objects " $non_pic_object"
5393 func_fatal_error "\`$arg' is not a valid libtool object"
5398 func_fatal_error "link input file \`$arg' does not exist"
5405 precious_files_regex="$arg"
5415 # We need an absolute path.
5417 [\\/]* | [A-Za-z]:[\\/]*) ;;
5419 func_fatal_error "only absolute run-paths are allowed"
5422 if test "$prev" = rpath; then
5425 *) func_append rpath " $arg" ;;
5430 *) func_append xrpath " $arg" ;;
5442 func_append weak_libs " $arg"
5447 func_append linker_flags " $qarg"
5448 func_append compiler_flags " $qarg"
5450 func_append compile_command " $qarg"
5451 func_append finalize_command " $qarg"
5455 func_append compiler_flags " $qarg"
5457 func_append compile_command " $qarg"
5458 func_append finalize_command " $qarg"
5462 func_append linker_flags " $qarg"
5463 func_append compiler_flags " $wl$qarg"
5465 func_append compile_command " $wl$qarg"
5466 func_append finalize_command " $wl$qarg"
5470 eval "$prev=\"\$arg\""
5475 fi # test -n "$prev"
5481 if test -n "$link_static_flag"; then
5482 # See comment for -static flag below, for more details.
5483 func_append compile_command " $link_static_flag"
5484 func_append finalize_command " $link_static_flag"
5490 # FIXME: remove this flag sometime in the future.
5491 func_fatal_error "\`-allow-undefined' must not be used because it is the default"
5519 -export-symbols | -export-symbols-regex)
5520 if test -n "$export_symbols" || test -n "$export_symbols_regex"; then
5521 func_fatal_error "more than one -exported-symbols argument is not allowed"
5523 if test "X$arg" = "X-export-symbols"; then
5541 # The native IRIX linker understands -LANG:*, -LIST:* and -LNO:*
5542 # so, if we see these flags be careful not to treat them like -L
5544 case $with_gcc/$host in
5545 no/*-*-irix* | /*-*-irix*)
5546 func_append compile_command " $arg"
5547 func_append finalize_command " $arg"
5554 func_stripname "-L" '' "$arg"
5555 if test -z "$func_stripname_result"; then
5556 if test "$#" -gt 0; then
5557 func_fatal_error "require no space between \`-L' and \`$1'"
5559 func_fatal_error "need path for \`-L' option"
5562 func_resolve_sysroot "$func_stripname_result"
5563 dir=$func_resolve_sysroot_result
5564 # We need an absolute path.
5566 [\\/]* | [A-Za-z]:[\\/]*) ;;
5568 absdir=`cd "$dir" && pwd`
5569 test -z "$absdir" && \
5570 func_fatal_error "cannot determine absolute directory name of \`$dir'"
5575 *" -L$dir "* | *" $arg "*)
5576 # Will only happen for absolute or sysroot arguments
5579 # Preserve sysroot, but never include relative directories
5581 [\\/]* | [A-Za-z]:[\\/]* | =*) func_append deplibs " $arg" ;;
5582 *) func_append deplibs " -L$dir" ;;
5584 func_append lib_search_path " $dir"
5588 *-*-cygwin* | *-*-mingw* | *-*-pw32* | *-*-os2* | *-cegcc*)
5589 testbindir=`$ECHO "$dir" | $SED 's*/lib$*/bin*'`
5590 case :$dllsearchpath: in
5592 ::) dllsearchpath=$dir;;
5593 *) func_append dllsearchpath ":$dir";;
5595 case :$dllsearchpath: in
5596 *":$testbindir:"*) ;;
5597 ::) dllsearchpath=$testbindir;;
5598 *) func_append dllsearchpath ":$testbindir";;
5606 if test "X$arg" = "X-lc" || test "X$arg" = "X-lm"; then
5608 *-*-cygwin* | *-*-mingw* | *-*-pw32* | *-*-beos* | *-cegcc* | *-*-haiku*)
5609 # These systems don't actually have a C or math library (as such)
5613 # These systems don't actually have a C library (as such)
5614 test "X$arg" = "X-lc" && continue
5616 *-*-openbsd* | *-*-freebsd* | *-*-dragonfly*)
5617 # Do not include libc due to us having libc/libc_r.
5618 test "X$arg" = "X-lc" && continue
5620 *-*-rhapsody* | *-*-darwin1.[012])
5621 # Rhapsody C and math libraries are in the System framework
5622 func_append deplibs " System.ltframework"
5625 *-*-sco3.2v5* | *-*-sco5v6*)
5626 # Causes problems with __ctype
5627 test "X$arg" = "X-lc" && continue
5629 *-*-sysv4.2uw2* | *-*-sysv5* | *-*-unixware* | *-*-OpenUNIX*)
5630 # Compiler inserts libc in the correct place for threads to work
5631 test "X$arg" = "X-lc" && continue
5634 elif test "X$arg" = "X-lc_r"; then
5636 *-*-openbsd* | *-*-freebsd* | *-*-dragonfly*)
5637 # Do not include libc_r directly, use -pthread flag.
5642 func_append deplibs " $arg"
5651 # Tru64 UNIX uses -model [arg] to determine the layout of C++
5652 # classes, name mangling, and exception handling.
5653 # Darwin uses the -arch flag to determine output architecture.
5654 -model|-arch|-isysroot|--sysroot)
5655 func_append compiler_flags " $arg"
5656 func_append compile_command " $arg"
5657 func_append finalize_command " $arg"
5662 -mt|-mthreads|-kthread|-Kthread|-pthread|-pthreads|--thread-safe \
5663 |-threads|-fopenmp|-openmp|-mp|-xopenmp|-omp|-qsmp=*)
5664 func_append compiler_flags " $arg"
5665 func_append compile_command " $arg"
5666 func_append finalize_command " $arg"
5667 case "$new_inherited_linker_flags " in
5669 * ) func_append new_inherited_linker_flags " $arg" ;;
5675 single_module="${wl}-multi_module"
5686 *-*-cygwin* | *-*-mingw* | *-*-pw32* | *-*-os2* | *-*-darwin* | *-cegcc*)
5687 # The PATH hackery in wrapper scripts is required on Windows
5688 # and Darwin in order for the loader to find any dlls it needs.
5689 func_warning "\`-no-install' is ignored for $host"
5690 func_warning "assuming \`-no-fast-install' instead"
5693 *) no_install=yes ;;
5710 -precious-files-regex)
5731 func_stripname '-R' '' "$arg"
5732 dir=$func_stripname_result
5733 # We need an absolute path.
5735 [\\/]* | [A-Za-z]:[\\/]*) ;;
5737 func_stripname '=' '' "$dir"
5738 dir=$lt_sysroot$func_stripname_result
5741 func_fatal_error "only absolute run-paths are allowed"
5746 *) func_append xrpath " $dir" ;;
5752 # The effects of -shared are defined in a previous loop.
5761 -static | -static-libtool-libs)
5762 # The effects of -static are defined in a previous loop.
5763 # We used to do the same as -all-static on platforms that
5764 # didn't have a PIC flag, but the assumption that the effects
5765 # would be equivalent was wrong. It would break on at least
5766 # Digital Unix and AIX.
5792 func_stripname '-Wc,' '' "$arg"
5793 args=$func_stripname_result
5795 save_ifs="$IFS"; IFS=','
5796 for flag in $args; do
5798 func_quote_for_eval "$flag"
5799 func_append arg " $func_quote_for_eval_result"
5800 func_append compiler_flags " $func_quote_for_eval_result"
5803 func_stripname ' ' '' "$arg"
5804 arg=$func_stripname_result
5808 func_stripname '-Wl,' '' "$arg"
5809 args=$func_stripname_result
5811 save_ifs="$IFS"; IFS=','
5812 for flag in $args; do
5814 func_quote_for_eval "$flag"
5815 func_append arg " $wl$func_quote_for_eval_result"
5816 func_append compiler_flags " $wl$func_quote_for_eval_result"
5817 func_append linker_flags " $func_quote_for_eval_result"
5820 func_stripname ' ' '' "$arg"
5821 arg=$func_stripname_result
5841 func_quote_for_eval "$arg"
5842 arg="$func_quote_for_eval_result"
5845 # Flags to be passed through unchanged, with rationale:
5846 # -64, -mips[0-9] enable 64-bit mode for the SGI compiler
5847 # -r[0-9][0-9]* specify processor for the SGI compiler
5848 # -xarch=*, -xtarget=* enable 64-bit mode for the Sun compiler
5849 # +DA*, +DD* enable 64-bit mode for the HP compiler
5850 # -q* compiler args for the IBM compiler
5851 # -m*, -t[45]*, -txscale* architecture-specific flags for GCC
5852 # -F/path path to uninstalled frameworks, gcc on darwin
5853 # -p, -pg, --coverage, -fprofile-* profiling flags for GCC
5854 # @file GCC response files
5855 # -tp=* Portland pgcc target processor selection
5856 # --sysroot=* for sysroot support
5857 # -O*, -flto*, -fwhopr*, -fuse-linker-plugin GCC link-time optimization
5858 -64|-mips[0-9]|-r[0-9][0-9]*|-xarch=*|-xtarget=*|+DA*|+DD*|-q*|-m*| \
5859 -t[45]*|-txscale*|-p|-pg|--coverage|-fprofile-*|-F*|@*|-tp=*|--sysroot=*| \
5860 -O*|-flto*|-fwhopr*|-fuse-linker-plugin)
5861 func_quote_for_eval "$arg"
5862 arg="$func_quote_for_eval_result"
5863 func_append compile_command " $arg"
5864 func_append finalize_command " $arg"
5865 func_append compiler_flags " $arg"
5869 # Some other compiler flag.
5871 func_quote_for_eval "$arg"
5872 arg="$func_quote_for_eval_result"
5876 # A standard object.
5877 func_append objs " $arg"
5881 # A libtool-controlled object.
5883 # Check to see that this really is a libtool object.
5884 if func_lalib_unsafe_p "$arg"; then
5891 if test -z "$pic_object" ||
5892 test -z "$non_pic_object" ||
5893 test "$pic_object" = none &&
5894 test "$non_pic_object" = none; then
5895 func_fatal_error "cannot find name of object for \`$arg'"
5898 # Extract subdirectory from the argument.
5899 func_dirname "$arg" "/" ""
5900 xdir="$func_dirname_result"
5902 if test "$pic_object" != none; then
5903 # Prepend the subdirectory the object is found in.
5904 pic_object="$xdir$pic_object"
5906 if test "$prev" = dlfiles; then
5907 if test "$build_libtool_libs" = yes && test "$dlopen_support" = yes; then
5908 func_append dlfiles " $pic_object"
5912 # If libtool objects are unsupported, then we need to preload.
5917 # CHECK ME: I think I busted this. -Ossama
5918 if test "$prev" = dlprefiles; then
5919 # Preload the old-style object.
5920 func_append dlprefiles " $pic_object"
5925 func_append libobjs " $pic_object"
5930 if test "$non_pic_object" != none; then
5931 # Prepend the subdirectory the object is found in.
5932 non_pic_object="$xdir$non_pic_object"
5934 # A standard non-PIC object
5935 func_append non_pic_objects " $non_pic_object"
5936 if test -z "$pic_object" || test "$pic_object" = none ; then
5937 arg="$non_pic_object"
5940 # If the PIC object exists, use it instead.
5941 # $xdir was prepended to $pic_object above.
5942 non_pic_object="$pic_object"
5943 func_append non_pic_objects " $non_pic_object"
5946 # Only an error if not doing a dry-run.
5947 if $opt_dry_run; then
5948 # Extract subdirectory from the argument.
5949 func_dirname "$arg" "/" ""
5950 xdir="$func_dirname_result"
5953 pic_object=$xdir$objdir/$func_lo2o_result
5954 non_pic_object=$xdir$func_lo2o_result
5955 func_append libobjs " $pic_object"
5956 func_append non_pic_objects " $non_pic_object"
5958 func_fatal_error "\`$arg' is not a valid libtool object"
5965 func_append deplibs " $arg"
5966 func_append old_deplibs " $arg"
5971 # A libtool-controlled library.
5973 func_resolve_sysroot "$arg"
5974 if test "$prev" = dlfiles; then
5975 # This library was specified with -dlopen.
5976 func_append dlfiles " $func_resolve_sysroot_result"
5978 elif test "$prev" = dlprefiles; then
5979 # The library was specified with -dlpreopen.
5980 func_append dlprefiles " $func_resolve_sysroot_result"
5983 func_append deplibs " $func_resolve_sysroot_result"
5988 # Some other compiler argument.
5990 # Unknown arguments in both finalize_command and compile_command need
5991 # to be aesthetically quoted because they are evaled later.
5992 func_quote_for_eval "$arg"
5993 arg="$func_quote_for_eval_result"
5997 # Now actually substitute the argument into the commands.
5998 if test -n "$arg"; then
5999 func_append compile_command " $arg"
6000 func_append finalize_command " $arg"
6002 done # argument parsing loop
6004 test -n "$prev" && \
6005 func_fatal_help "the \`$prevarg' option requires an argument"
6007 if test "$export_dynamic" = yes && test -n "$export_dynamic_flag_spec"; then
6008 eval arg=\"$export_dynamic_flag_spec\"
6009 func_append compile_command " $arg"
6010 func_append finalize_command " $arg"
6014 # calculate the name of the file, without its directory
6015 func_basename "$output"
6016 outputname="$func_basename_result"
6017 libobjs_save="$libobjs"
6019 if test -n "$shlibpath_var"; then
6020 # get the directories listed in $shlibpath_var
6021 eval shlib_search_path=\`\$ECHO \"\${$shlibpath_var}\" \| \$SED \'s/:/ /g\'\`
6025 eval sys_lib_search_path=\"$sys_lib_search_path_spec\"
6026 eval sys_lib_dlsearch_path=\"$sys_lib_dlsearch_path_spec\"
6028 func_dirname "$output" "/" ""
6029 output_objdir="$func_dirname_result$objdir"
6030 func_to_tool_file "$output_objdir/"
6031 tool_output_objdir=$func_to_tool_file_result
6032 # Create the object directory.
6033 func_mkdir_p "$output_objdir"
6035 # Determine the type of output
6038 func_fatal_help "you must specify an output file"
6040 *.$libext) linkmode=oldlib ;;
6041 *.lo | *.$objext) linkmode=obj ;;
6042 *.la) linkmode=lib ;;
6043 *) linkmode=prog ;; # Anything else should be a program.
6049 # Find all interdependent deplibs by searching for libraries
6050 # that are linked more than once (e.g. -la -lb -la)
6051 for deplib in $deplibs; do
6052 if $opt_preserve_dup_deps ; then
6054 *" $deplib "*) func_append specialdeplibs " $deplib" ;;
6057 func_append libs " $deplib"
6060 if test "$linkmode" = lib; then
6061 libs="$predeps $libs $compiler_lib_search_path $postdeps"
6063 # Compute libraries that are listed more than once in $predeps
6064 # $postdeps and mark them as special (i.e., whose duplicates are
6065 # not to be eliminated).
6067 if $opt_duplicate_compiler_generated_deps; then
6068 for pre_post_dep in $predeps $postdeps; do
6069 case "$pre_post_deps " in
6070 *" $pre_post_dep "*) func_append specialdeplibs " $pre_post_deps" ;;
6072 func_append pre_post_deps " $pre_post_dep"
6081 need_relink=no # whether we're linking any uninstalled libtool libraries
6082 notinst_deplibs= # not-installed libtool libraries
6083 notinst_path= # paths that contain not-installed libtool libraries
6087 passes="conv dlpreopen link"
6088 for file in $dlfiles $dlprefiles; do
6092 func_fatal_help "libraries can \`-dlopen' only libtool libraries: $file"
6103 passes="conv scan dlopen dlpreopen link"
6109 for pass in $passes; do
6110 # The preopen pass in lib mode reverses $deplibs; put it back here
6111 # so that -L comes before libs that need it for instance...
6112 if test "$linkmode,$pass" = "lib,link"; then
6113 ## FIXME: Find the place where the list is rebuilt in the wrong
6114 ## order, and fix it there properly
6116 for deplib in $deplibs; do
6117 tmp_deplibs="$deplib $tmp_deplibs"
6119 deplibs="$tmp_deplibs"
6122 if test "$linkmode,$pass" = "lib,link" ||
6123 test "$linkmode,$pass" = "prog,scan"; then
6127 if test "$linkmode" = prog; then
6129 dlopen) libs="$dlfiles" ;;
6130 dlpreopen) libs="$dlprefiles" ;;
6132 libs="$deplibs %DEPLIBS%"
6133 test "X$link_all_deplibs" != Xno && libs="$libs $dependency_libs"
6137 if test "$linkmode,$pass" = "lib,dlpreopen"; then
6138 # Collect and forward deplibs of preopened libtool libs
6139 for lib in $dlprefiles; do
6140 # Ignore non-libtool-libs
6142 func_resolve_sysroot "$lib"
6144 *.la) func_source "$func_resolve_sysroot_result" ;;
6147 # Collect preopened libtool deplibs, except any this library
6148 # has declared as weak libs
6149 for deplib in $dependency_libs; do
6150 func_basename "$deplib"
6151 deplib_base=$func_basename_result
6152 case " $weak_libs " in
6153 *" $deplib_base "*) ;;
6154 *) func_append deplibs " $deplib" ;;
6160 if test "$pass" = dlopen; then
6161 # Collect dlpreopened libraries
6162 save_deplibs="$deplibs"
6166 for deplib in $libs; do
6170 -mt|-mthreads|-kthread|-Kthread|-pthread|-pthreads|--thread-safe \
6171 |-threads|-fopenmp|-openmp|-mp|-xopenmp|-omp|-qsmp=*)
6172 if test "$linkmode,$pass" = "prog,link"; then
6173 compile_deplibs="$deplib $compile_deplibs"
6174 finalize_deplibs="$deplib $finalize_deplibs"
6176 func_append compiler_flags " $deplib"
6177 if test "$linkmode" = lib ; then
6178 case "$new_inherited_linker_flags " in
6180 * ) func_append new_inherited_linker_flags " $deplib" ;;
6187 if test "$linkmode" != lib && test "$linkmode" != prog; then
6188 func_warning "\`-l' is ignored for archives/objects"
6191 func_stripname '-l' '' "$deplib"
6192 name=$func_stripname_result
6193 if test "$linkmode" = lib; then
6194 searchdirs="$newlib_search_path $lib_search_path $compiler_lib_search_dirs $sys_lib_search_path $shlib_search_path"
6196 searchdirs="$newlib_search_path $lib_search_path $sys_lib_search_path $shlib_search_path"
6198 for searchdir in $searchdirs; do
6199 for search_ext in .la $std_shrext .so .a; do
6200 # Search the libtool library
6201 lib="$searchdir/lib${name}${search_ext}"
6202 if test -f "$lib"; then
6203 if test "$search_ext" = ".la"; then
6212 if test "$found" != yes; then
6213 # deplib doesn't seem to be a libtool library
6214 if test "$linkmode,$pass" = "prog,link"; then
6215 compile_deplibs="$deplib $compile_deplibs"
6216 finalize_deplibs="$deplib $finalize_deplibs"
6218 deplibs="$deplib $deplibs"
6219 test "$linkmode" = lib && newdependency_libs="$deplib $newdependency_libs"
6222 else # deplib is a libtool library
6223 # If $allow_libtool_libs_with_static_runtimes && $deplib is a stdlib,
6224 # We need to do some special things here, and not later.
6225 if test "X$allow_libtool_libs_with_static_runtimes" = "Xyes" ; then
6226 case " $predeps $postdeps " in
6228 if func_lalib_p "$lib"; then
6232 for l in $old_library $library_names; do
6235 if test "X$ll" = "X$old_library" ; then # only static version available
6237 func_dirname "$lib" "" "."
6238 ladir="$func_dirname_result"
6239 lib=$ladir/$old_library
6240 if test "$linkmode,$pass" = "prog,link"; then
6241 compile_deplibs="$deplib $compile_deplibs"
6242 finalize_deplibs="$deplib $finalize_deplibs"
6244 deplibs="$deplib $deplibs"
6245 test "$linkmode" = lib && newdependency_libs="$deplib $newdependency_libs"
6257 if test "$linkmode,$pass" = "prog,link"; then
6258 compile_deplibs="$deplib $compile_deplibs"
6259 finalize_deplibs="$deplib $finalize_deplibs"
6261 deplibs="$deplib $deplibs"
6262 if test "$linkmode" = lib ; then
6263 case "$new_inherited_linker_flags " in
6265 * ) func_append new_inherited_linker_flags " $deplib" ;;
6274 deplibs="$deplib $deplibs"
6275 test "$pass" = conv && continue
6276 newdependency_libs="$deplib $newdependency_libs"
6277 func_stripname '-L' '' "$deplib"
6278 func_resolve_sysroot "$func_stripname_result"
6279 func_append newlib_search_path " $func_resolve_sysroot_result"
6282 if test "$pass" = conv; then
6283 deplibs="$deplib $deplibs"
6286 if test "$pass" = scan; then
6287 deplibs="$deplib $deplibs"
6289 compile_deplibs="$deplib $compile_deplibs"
6290 finalize_deplibs="$deplib $finalize_deplibs"
6292 func_stripname '-L' '' "$deplib"
6293 func_resolve_sysroot "$func_stripname_result"
6294 func_append newlib_search_path " $func_resolve_sysroot_result"
6297 func_warning "\`-L' is ignored for archives/objects"
6303 if test "$pass" = link; then
6304 func_stripname '-R' '' "$deplib"
6305 func_resolve_sysroot "$func_stripname_result"
6306 dir=$func_resolve_sysroot_result
6307 # Make sure the xrpath contains only unique directories.
6310 *) func_append xrpath " $dir" ;;
6313 deplibs="$deplib $deplibs"
6317 func_resolve_sysroot "$deplib"
6318 lib=$func_resolve_sysroot_result
6321 if test "$pass" = conv; then
6322 deplibs="$deplib $deplibs"
6327 # Linking convenience modules into shared libraries is allowed,
6328 # but linking other static libraries is non-portable.
6329 case " $dlpreconveniencelibs " in
6333 case $deplibs_check_method in
6335 set dummy $deplibs_check_method; shift
6336 match_pattern_regex=`expr "$deplibs_check_method" : "$1 \(.*\)"`
6337 if eval "\$ECHO \"$deplib\"" 2>/dev/null | $SED 10q \
6338 | $EGREP "$match_pattern_regex" > /dev/null; then
6346 if test "$valid_a_lib" != yes; then
6348 $ECHO "*** Warning: Trying to link with static lib archive $deplib."
6349 echo "*** I have the capability to make that library automatically link in when"
6350 echo "*** you link to this library. But I can only do this if you have a"
6351 echo "*** shared version of the library, which you do not appear to have"
6352 echo "*** because the file extensions .$libext of this argument makes me believe"
6353 echo "*** that it is just a static archive that I should not use here."
6356 $ECHO "*** Warning: Linking the shared library $output against the"
6357 $ECHO "*** static library $deplib is not portable!"
6358 deplibs="$deplib $deplibs"
6365 if test "$pass" != link; then
6366 deplibs="$deplib $deplibs"
6368 compile_deplibs="$deplib $compile_deplibs"
6369 finalize_deplibs="$deplib $finalize_deplibs"
6376 if test "$pass" = conv; then
6377 deplibs="$deplib $deplibs"
6378 elif test "$linkmode" = prog; then
6379 if test "$pass" = dlpreopen || test "$dlopen_support" != yes || test "$build_libtool_libs" = no; then
6380 # If there is no dlopen support or we're linking statically,
6381 # we need to preload.
6382 func_append newdlprefiles " $deplib"
6383 compile_deplibs="$deplib $compile_deplibs"
6384 finalize_deplibs="$deplib $finalize_deplibs"
6386 func_append newdlfiles " $deplib"
6397 if test "$found" = yes || test -f "$lib"; then :
6399 func_fatal_error "cannot find the library \`$lib' or unhandled argument \`$deplib'"
6402 # Check to see that this really is a libtool archive.
6403 func_lalib_unsafe_p "$lib" \
6404 || func_fatal_error "\`$lib' is not a valid libtool archive"
6406 func_dirname "$lib" "" "."
6407 ladir="$func_dirname_result"
6415 inherited_linker_flags=
6416 # If the library was installed with an old release of libtool,
6417 # it will not redefine variables installed, or shouldnotlink
6426 # Convert "-framework foo" to "foo.ltframework"
6427 if test -n "$inherited_linker_flags"; then
6428 tmp_inherited_linker_flags=`$ECHO "$inherited_linker_flags" | $SED 's/-framework \([^ $]*\)/\1.ltframework/g'`
6429 for tmp_inherited_linker_flag in $tmp_inherited_linker_flags; do
6430 case " $new_inherited_linker_flags " in
6431 *" $tmp_inherited_linker_flag "*) ;;
6432 *) func_append new_inherited_linker_flags " $tmp_inherited_linker_flag";;
6436 dependency_libs=`$ECHO " $dependency_libs" | $SED 's% \([^ $]*\).ltframework% -framework \1%g'`
6437 if test "$linkmode,$pass" = "lib,link" ||
6438 test "$linkmode,$pass" = "prog,scan" ||
6439 { test "$linkmode" != prog && test "$linkmode" != lib; }; then
6440 test -n "$dlopen" && func_append dlfiles " $dlopen"
6441 test -n "$dlpreopen" && func_append dlprefiles " $dlpreopen"
6444 if test "$pass" = conv; then
6445 # Only check for convenience libraries
6446 deplibs="$lib $deplibs"
6447 if test -z "$libdir"; then
6448 if test -z "$old_library"; then
6449 func_fatal_error "cannot find name of link library for \`$lib'"
6451 # It is a libtool convenience library, so add in its objects.
6452 func_append convenience " $ladir/$objdir/$old_library"
6453 func_append old_convenience " $ladir/$objdir/$old_library"
6455 for deplib in $dependency_libs; do
6456 deplibs="$deplib $deplibs"
6457 if $opt_preserve_dup_deps ; then
6458 case "$tmp_libs " in
6459 *" $deplib "*) func_append specialdeplibs " $deplib" ;;
6462 func_append tmp_libs " $deplib"
6464 elif test "$linkmode" != prog && test "$linkmode" != lib; then
6465 func_fatal_error "\`$lib' is not a convenience library"
6471 # Get the name of the library we link against.
6473 if test -n "$old_library" &&
6474 { test "$prefer_static_libs" = yes ||
6475 test "$prefer_static_libs,$installed" = "built,no"; }; then
6476 linklib=$old_library
6478 for l in $old_library $library_names; do
6482 if test -z "$linklib"; then
6483 func_fatal_error "cannot find name of link library for \`$lib'"
6486 # This library was specified with -dlopen.
6487 if test "$pass" = dlopen; then
6488 if test -z "$libdir"; then
6489 func_fatal_error "cannot -dlopen a convenience library: \`$lib'"
6491 if test -z "$dlname" ||
6492 test "$dlopen_support" != yes ||
6493 test "$build_libtool_libs" = no; then
6494 # If there is no dlname, no dlopen support or we're linking
6495 # statically, we need to preload. We also need to preload any
6496 # dependent libraries so libltdl's deplib preloader doesn't
6497 # bomb out in the load deplibs phase.
6498 func_append dlprefiles " $lib $dependency_libs"
6500 func_append newdlfiles " $lib"
6505 # We need an absolute path.
6507 [\\/]* | [A-Za-z]:[\\/]*) abs_ladir="$ladir" ;;
6509 abs_ladir=`cd "$ladir" && pwd`
6510 if test -z "$abs_ladir"; then
6511 func_warning "cannot determine absolute directory name of \`$ladir'"
6512 func_warning "passing it literally to the linker, although it might fail"
6517 func_basename "$lib"
6518 laname="$func_basename_result"
6520 # Find the relevant object directory and library name.
6521 if test "X$installed" = Xyes; then
6522 if test ! -f "$lt_sysroot$libdir/$linklib" && test -f "$abs_ladir/$linklib"; then
6523 func_warning "library \`$lib' was moved."
6528 dir="$lt_sysroot$libdir"
6529 absdir="$lt_sysroot$libdir"
6531 test "X$hardcode_automatic" = Xyes && avoidtemprpath=yes
6533 if test ! -f "$ladir/$objdir/$linklib" && test -f "$abs_ladir/$linklib"; then
6536 # Remove this search path later
6537 func_append notinst_path " $abs_ladir"
6539 dir="$ladir/$objdir"
6540 absdir="$abs_ladir/$objdir"
6541 # Remove this search path later
6542 func_append notinst_path " $abs_ladir"
6544 fi # $installed = yes
6545 func_stripname 'lib' '.la' "$laname"
6546 name=$func_stripname_result
6548 # This library was specified with -dlpreopen.
6549 if test "$pass" = dlpreopen; then
6550 if test -z "$libdir" && test "$linkmode" = prog; then
6551 func_fatal_error "only libraries may -dlpreopen a convenience library: \`$lib'"
6554 # special handling for platforms with PE-DLLs.
6555 *cygwin* | *mingw* | *cegcc* )
6556 # Linker will automatically link against shared library if both
6557 # static and shared are present. Therefore, ensure we extract
6558 # symbols from the import library if a shared library is present
6559 # (otherwise, the dlopen module name will be incorrect). We do
6560 # this by putting the import library name into $newdlprefiles.
6561 # We recover the dlopen module name by 'saving' the la file
6562 # name in a special purpose variable, and (later) extracting the
6563 # dlname from the la file.
6564 if test -n "$dlname"; then
6565 func_tr_sh "$dir/$linklib"
6566 eval "libfile_$func_tr_sh_result=\$abs_ladir/\$laname"
6567 func_append newdlprefiles " $dir/$linklib"
6569 func_append newdlprefiles " $dir/$old_library"
6570 # Keep a list of preopened convenience libraries to check
6571 # that they are being used correctly in the link pass.
6572 test -z "$libdir" && \
6573 func_append dlpreconveniencelibs " $dir/$old_library"
6577 # Prefer using a static library (so that no silly _DYNAMIC symbols
6578 # are required to link).
6579 if test -n "$old_library"; then
6580 func_append newdlprefiles " $dir/$old_library"
6581 # Keep a list of preopened convenience libraries to check
6582 # that they are being used correctly in the link pass.
6583 test -z "$libdir" && \
6584 func_append dlpreconveniencelibs " $dir/$old_library"
6585 # Otherwise, use the dlname, so that lt_dlopen finds it.
6586 elif test -n "$dlname"; then
6587 func_append newdlprefiles " $dir/$dlname"
6589 func_append newdlprefiles " $dir/$linklib"
6593 fi # $pass = dlpreopen
6595 if test -z "$libdir"; then
6596 # Link the convenience library
6597 if test "$linkmode" = lib; then
6598 deplibs="$dir/$old_library $deplibs"
6599 elif test "$linkmode,$pass" = "prog,link"; then
6600 compile_deplibs="$dir/$old_library $compile_deplibs"
6601 finalize_deplibs="$dir/$old_library $finalize_deplibs"
6603 deplibs="$lib $deplibs" # used for prog,scan pass
6609 if test "$linkmode" = prog && test "$pass" != link; then
6610 func_append newlib_search_path " $ladir"
6611 deplibs="$lib $deplibs"
6614 if test "$link_all_deplibs" != no || test -z "$library_names" ||
6615 test "$build_libtool_libs" = no; then
6620 for deplib in $dependency_libs; do
6622 -L*) func_stripname '-L' '' "$deplib"
6623 func_resolve_sysroot "$func_stripname_result"
6624 func_append newlib_search_path " $func_resolve_sysroot_result"
6627 # Need to link against all dependency_libs?
6628 if test "$linkalldeplibs" = yes; then
6629 deplibs="$deplib $deplibs"
6631 # Need to hardcode shared library paths
6632 # or/and link against static libraries
6633 newdependency_libs="$deplib $newdependency_libs"
6635 if $opt_preserve_dup_deps ; then
6636 case "$tmp_libs " in
6637 *" $deplib "*) func_append specialdeplibs " $deplib" ;;
6640 func_append tmp_libs " $deplib"
6643 fi # $linkmode = prog...
6645 if test "$linkmode,$pass" = "prog,link"; then
6646 if test -n "$library_names" &&
6647 { { test "$prefer_static_libs" = no ||
6648 test "$prefer_static_libs,$installed" = "built,yes"; } ||
6649 test -z "$old_library"; }; then
6650 # We need to hardcode the library path
6651 if test -n "$shlibpath_var" && test -z "$avoidtemprpath" ; then
6652 # Make sure the rpath contains only unique directories.
6653 case "$temp_rpath:" in
6655 *) func_append temp_rpath "$absdir:" ;;
6659 # Hardcode the library path.
6660 # Skip directories that are in the system default run-time
6662 case " $sys_lib_dlsearch_path " in
6665 case "$compile_rpath " in
6667 *) func_append compile_rpath " $absdir" ;;
6671 case " $sys_lib_dlsearch_path " in
6674 case "$finalize_rpath " in
6676 *) func_append finalize_rpath " $libdir" ;;
6680 fi # $linkmode,$pass = prog,link...
6682 if test "$alldeplibs" = yes &&
6683 { test "$deplibs_check_method" = pass_all ||
6684 { test "$build_libtool_libs" = yes &&
6685 test -n "$library_names"; }; }; then
6686 # We only need to search for static libraries
6691 link_static=no # Whether the deplib will be linked statically
6692 use_static_libs=$prefer_static_libs
6693 if test "$use_static_libs" = built && test "$installed" = yes; then
6696 if test -n "$library_names" &&
6697 { test "$use_static_libs" = no || test -z "$old_library"; }; then
6699 *cygwin* | *mingw* | *cegcc*)
6700 # No point in relinking DLLs because paths are not encoded
6701 func_append notinst_deplibs " $lib"
6705 if test "$installed" = no; then
6706 func_append notinst_deplibs " $lib"
6711 # This is a shared library
6713 # Warn about portability, can't link against -module's on some
6714 # systems (darwin). Don't bleat about dlopened modules though!
6716 for dlpremoduletest in $dlprefiles; do
6717 if test "X$dlpremoduletest" = "X$lib"; then
6718 dlopenmodule="$dlpremoduletest"
6722 if test -z "$dlopenmodule" && test "$shouldnotlink" = yes && test "$pass" = link; then
6724 if test "$linkmode" = prog; then
6725 $ECHO "*** Warning: Linking the executable $output against the loadable module"
6727 $ECHO "*** Warning: Linking the shared library $output against the loadable module"
6729 $ECHO "*** $linklib is not portable!"
6731 if test "$linkmode" = lib &&
6732 test "$hardcode_into_libs" = yes; then
6733 # Hardcode the library path.
6734 # Skip directories that are in the system default run-time
6736 case " $sys_lib_dlsearch_path " in
6739 case "$compile_rpath " in
6741 *) func_append compile_rpath " $absdir" ;;
6745 case " $sys_lib_dlsearch_path " in
6748 case "$finalize_rpath " in
6750 *) func_append finalize_rpath " $libdir" ;;
6756 if test -n "$old_archive_from_expsyms_cmds"; then
6757 # figure out the soname
6758 set dummy $library_names
6762 libname=`eval "\\$ECHO \"$libname_spec\""`
6763 # use dlname if we got it. it's perfectly good, no?
6764 if test -n "$dlname"; then
6766 elif test -n "$soname_spec"; then
6769 *cygwin* | mingw* | *cegcc*)
6770 func_arith $current - $age
6771 major=$func_arith_result
6775 eval soname=\"$soname_spec\"
6780 # Make a new name for the extract_expsyms_cmds to use
6782 func_basename "$soroot"
6783 soname="$func_basename_result"
6784 func_stripname 'lib' '.dll' "$soname"
6785 newlib=libimp-$func_stripname_result.a
6787 # If the library has no export list, then create one now
6788 if test -f "$output_objdir/$soname-def"; then :
6790 func_verbose "extracting exported symbol list from \`$soname'"
6791 func_execute_cmds "$extract_expsyms_cmds" 'exit $?'
6795 if test -f "$output_objdir/$newlib"; then :; else
6796 func_verbose "generating import library for \`$soname'"
6797 func_execute_cmds "$old_archive_from_expsyms_cmds" 'exit $?'
6799 # make sure the library variables are pointing to the new library
6802 fi # test -n "$old_archive_from_expsyms_cmds"
6804 if test "$linkmode" = prog || test "$opt_mode" != relink; then
6809 case $hardcode_action in
6810 immediate | unsupported)
6811 if test "$hardcode_direct" = no; then
6814 *-*-sco3.2v5.0.[024]*) add_dir="-L$dir" ;;
6815 *-*-sysv4*uw2*) add_dir="-L$dir" ;;
6816 *-*-sysv5OpenUNIX* | *-*-sysv5UnixWare7.[01].[10]* | \
6817 *-*-unixware7*) add_dir="-L$dir" ;;
6819 # if the lib is a (non-dlopened) module then we can not
6820 # link against it, someone is ignoring the earlier warnings
6821 if /usr/bin/file -L $add 2> /dev/null |
6822 $GREP ": [^:]* bundle" >/dev/null ; then
6823 if test "X$dlopenmodule" != "X$lib"; then
6824 $ECHO "*** Warning: lib $linklib is a module, not a shared library"
6825 if test -z "$old_library" ; then
6827 echo "*** And there doesn't seem to be a static archive available"
6828 echo "*** The link will probably fail, sorry"
6830 add="$dir/$old_library"
6832 elif test -n "$old_library"; then
6833 add="$dir/$old_library"
6837 elif test "$hardcode_minus_L" = no; then
6839 *-*-sunos*) add_shlibpath="$dir" ;;
6843 elif test "$hardcode_shlibpath_var" = no; then
6844 add_shlibpath="$dir"
6851 if test "$hardcode_direct" = yes &&
6852 test "$hardcode_direct_absolute" = no; then
6854 elif test "$hardcode_minus_L" = yes; then
6856 # Try looking first in the location we're being installed to.
6857 if test -n "$inst_prefix_dir"; then
6860 func_append add_dir " -L$inst_prefix_dir$libdir"
6865 elif test "$hardcode_shlibpath_var" = yes; then
6866 add_shlibpath="$dir"
6875 if test "$lib_linked" != yes; then
6876 func_fatal_configuration "unsupported hardcode properties"
6879 if test -n "$add_shlibpath"; then
6880 case :$compile_shlibpath: in
6881 *":$add_shlibpath:"*) ;;
6882 *) func_append compile_shlibpath "$add_shlibpath:" ;;
6885 if test "$linkmode" = prog; then
6886 test -n "$add_dir" && compile_deplibs="$add_dir $compile_deplibs"
6887 test -n "$add" && compile_deplibs="$add $compile_deplibs"
6889 test -n "$add_dir" && deplibs="$add_dir $deplibs"
6890 test -n "$add" && deplibs="$add $deplibs"
6891 if test "$hardcode_direct" != yes &&
6892 test "$hardcode_minus_L" != yes &&
6893 test "$hardcode_shlibpath_var" = yes; then
6894 case :$finalize_shlibpath: in
6896 *) func_append finalize_shlibpath "$libdir:" ;;
6902 if test "$linkmode" = prog || test "$opt_mode" = relink; then
6906 # Finalize command for both is simple: just hardcode it.
6907 if test "$hardcode_direct" = yes &&
6908 test "$hardcode_direct_absolute" = no; then
6909 add="$libdir/$linklib"
6910 elif test "$hardcode_minus_L" = yes; then
6913 elif test "$hardcode_shlibpath_var" = yes; then
6914 case :$finalize_shlibpath: in
6916 *) func_append finalize_shlibpath "$libdir:" ;;
6919 elif test "$hardcode_automatic" = yes; then
6920 if test -n "$inst_prefix_dir" &&
6921 test -f "$inst_prefix_dir$libdir/$linklib" ; then
6922 add="$inst_prefix_dir$libdir/$linklib"
6924 add="$libdir/$linklib"
6927 # We cannot seem to hardcode it, guess we'll fake it.
6929 # Try looking first in the location we're being installed to.
6930 if test -n "$inst_prefix_dir"; then
6933 func_append add_dir " -L$inst_prefix_dir$libdir"
6940 if test "$linkmode" = prog; then
6941 test -n "$add_dir" && finalize_deplibs="$add_dir $finalize_deplibs"
6942 test -n "$add" && finalize_deplibs="$add $finalize_deplibs"
6944 test -n "$add_dir" && deplibs="$add_dir $deplibs"
6945 test -n "$add" && deplibs="$add $deplibs"
6948 elif test "$linkmode" = prog; then
6949 # Here we assume that one of hardcode_direct or hardcode_minus_L
6950 # is not unsupported. This is valid on all known static and
6952 if test "$hardcode_direct" != unsupported; then
6953 test -n "$old_library" && linklib="$old_library"
6954 compile_deplibs="$dir/$linklib $compile_deplibs"
6955 finalize_deplibs="$dir/$linklib $finalize_deplibs"
6957 compile_deplibs="-l$name -L$dir $compile_deplibs"
6958 finalize_deplibs="-l$name -L$dir $finalize_deplibs"
6960 elif test "$build_libtool_libs" = yes; then
6961 # Not a shared library
6962 if test "$deplibs_check_method" != pass_all; then
6963 # We're trying link a shared library against a static one
6964 # but the system doesn't support it.
6966 # Just print a warning and add the library to dependency_libs so
6967 # that the program can be linked against the static library.
6969 $ECHO "*** Warning: This system can not link to static lib archive $lib."
6970 echo "*** I have the capability to make that library automatically link in when"
6971 echo "*** you link to this library. But I can only do this if you have a"
6972 echo "*** shared version of the library, which you do not appear to have."
6973 if test "$module" = yes; then
6974 echo "*** But as you try to build a module library, libtool will still create "
6975 echo "*** a static module, that should work as long as the dlopening application"
6976 echo "*** is linked with the -dlopen flag to resolve symbols at runtime."
6977 if test -z "$global_symbol_pipe"; then
6979 echo "*** However, this would only work if libtool was able to extract symbol"
6980 echo "*** lists from a program, using \`nm' or equivalent, but libtool could"
6981 echo "*** not find such a program. So, this module is probably useless."
6982 echo "*** \`nm' from GNU binutils and a full rebuild may help."
6984 if test "$build_old_libs" = no; then
6985 build_libtool_libs=module
6988 build_libtool_libs=no
6992 deplibs="$dir/$old_library $deplibs"
6995 fi # link shared/static library?
6997 if test "$linkmode" = lib; then
6998 if test -n "$dependency_libs" &&
6999 { test "$hardcode_into_libs" != yes ||
7000 test "$build_old_libs" = yes ||
7001 test "$link_static" = yes; }; then
7002 # Extract -R from dependency_libs
7004 for libdir in $dependency_libs; do
7006 -R*) func_stripname '-R' '' "$libdir"
7007 temp_xrpath=$func_stripname_result
7009 *" $temp_xrpath "*) ;;
7010 *) func_append xrpath " $temp_xrpath";;
7012 *) func_append temp_deplibs " $libdir";;
7015 dependency_libs="$temp_deplibs"
7018 func_append newlib_search_path " $absdir"
7019 # Link against this library
7020 test "$link_static" = no && newdependency_libs="$abs_ladir/$laname $newdependency_libs"
7021 # ... and its dependency_libs
7023 for deplib in $dependency_libs; do
7024 newdependency_libs="$deplib $newdependency_libs"
7026 -L*) func_stripname '-L' '' "$deplib"
7027 func_resolve_sysroot "$func_stripname_result";;
7028 *) func_resolve_sysroot "$deplib" ;;
7030 if $opt_preserve_dup_deps ; then
7031 case "$tmp_libs " in
7032 *" $func_resolve_sysroot_result "*)
7033 func_append specialdeplibs " $func_resolve_sysroot_result" ;;
7036 func_append tmp_libs " $func_resolve_sysroot_result"
7039 if test "$link_all_deplibs" != no; then
7040 # Add the search paths of all dependency libraries
7041 for deplib in $dependency_libs; do
7044 -L*) path="$deplib" ;;
7046 func_resolve_sysroot "$deplib"
7047 deplib=$func_resolve_sysroot_result
7048 func_dirname "$deplib" "" "."
7049 dir=$func_dirname_result
7050 # We need an absolute path.
7052 [\\/]* | [A-Za-z]:[\\/]*) absdir="$dir" ;;
7054 absdir=`cd "$dir" && pwd`
7055 if test -z "$absdir"; then
7056 func_warning "cannot determine absolute directory name of \`$dir'"
7061 if $GREP "^installed=no" $deplib > /dev/null; then
7065 eval deplibrary_names=`${SED} -n -e 's/^library_names=\(.*\)$/\1/p' $deplib`
7066 if test -n "$deplibrary_names" ; then
7067 for tmp in $deplibrary_names ; do
7070 if test -f "$absdir/$objdir/$depdepl" ; then
7071 depdepl="$absdir/$objdir/$depdepl"
7072 darwin_install_name=`${OTOOL} -L $depdepl | awk '{if (NR == 2) {print $1;exit}}'`
7073 if test -z "$darwin_install_name"; then
7074 darwin_install_name=`${OTOOL64} -L $depdepl | awk '{if (NR == 2) {print $1;exit}}'`
7076 func_append compiler_flags " ${wl}-dylib_file ${wl}${darwin_install_name}:${depdepl}"
7077 func_append linker_flags " -dylib_file ${darwin_install_name}:${depdepl}"
7083 path="-L$absdir/$objdir"
7087 eval libdir=`${SED} -n -e 's/^libdir=\(.*\)$/\1/p' $deplib`
7088 test -z "$libdir" && \
7089 func_fatal_error "\`$deplib' is not a valid libtool archive"
7090 test "$absdir" != "$libdir" && \
7091 func_warning "\`$deplib' seems to be moved"
7097 case " $deplibs " in
7099 *) deplibs="$path $deplibs" ;;
7102 fi # link_all_deplibs != no
7104 done # for deplib in $libs
7105 if test "$pass" = link; then
7106 if test "$linkmode" = "prog"; then
7107 compile_deplibs="$new_inherited_linker_flags $compile_deplibs"
7108 finalize_deplibs="$new_inherited_linker_flags $finalize_deplibs"
7110 compiler_flags="$compiler_flags "`$ECHO " $new_inherited_linker_flags" | $SED 's% \([^ $]*\).ltframework% -framework \1%g'`
7113 dependency_libs="$newdependency_libs"
7114 if test "$pass" = dlpreopen; then
7115 # Link the dlpreopened libraries before other libraries
7116 for deplib in $save_deplibs; do
7117 deplibs="$deplib $deplibs"
7120 if test "$pass" != dlopen; then
7121 if test "$pass" != conv; then
7122 # Make sure lib_search_path contains only unique directories.
7124 for dir in $newlib_search_path; do
7125 case "$lib_search_path " in
7127 *) func_append lib_search_path " $dir" ;;
7133 if test "$linkmode,$pass" != "prog,link"; then
7136 vars="compile_deplibs finalize_deplibs"
7138 for var in $vars dependency_libs; do
7139 # Add libraries to $var in reverse order
7140 eval tmp_libs=\"\$$var\"
7142 for deplib in $tmp_libs; do
7143 # FIXME: Pedantically, this is the right thing to do, so
7144 # that some nasty dependency loop isn't accidentally
7146 #new_libs="$deplib $new_libs"
7147 # Pragmatically, this seems to cause very few problems in
7150 -L*) new_libs="$deplib $new_libs" ;;
7153 # And here is the reason: when a library appears more
7154 # than once as an explicit dependence of a library, or
7155 # is implicitly linked in more than once by the
7156 # compiler, it is considered special, and multiple
7157 # occurrences thereof are not removed. Compare this
7158 # with having the same library being listed as a
7159 # dependency of multiple other libraries: in this case,
7160 # we know (pedantically, we assume) the library does not
7161 # need to be listed more than once, so we keep only the
7162 # last copy. This is not always right, but it is rare
7163 # enough that we require users that really mean to play
7164 # such unportable linking tricks to link the library
7165 # using -Wl,-lname, so that libtool does not consider it
7166 # for duplicate removal.
7167 case " $specialdeplibs " in
7168 *" $deplib "*) new_libs="$deplib $new_libs" ;;
7170 case " $new_libs " in
7172 *) new_libs="$deplib $new_libs" ;;
7180 for deplib in $new_libs; do
7183 case " $tmp_libs " in
7185 *) func_append tmp_libs " $deplib" ;;
7188 *) func_append tmp_libs " $deplib" ;;
7191 eval $var=\"$tmp_libs\"
7194 # Last step: remove runtime libs from dependency_libs
7195 # (they stay in deplibs)
7197 for i in $dependency_libs ; do
7198 case " $predeps $postdeps $compiler_lib_search_path " in
7203 if test -n "$i" ; then
7204 func_append tmp_libs " $i"
7207 dependency_libs=$tmp_libs
7209 if test "$linkmode" = prog; then
7210 dlfiles="$newdlfiles"
7212 if test "$linkmode" = prog || test "$linkmode" = lib; then
7213 dlprefiles="$newdlprefiles"
7218 if test -n "$dlfiles$dlprefiles" || test "$dlself" != no; then
7219 func_warning "\`-dlopen' is ignored for archives"
7224 func_warning "\`-l' and \`-L' are ignored for archives" ;;
7227 test -n "$rpath" && \
7228 func_warning "\`-rpath' is ignored for archives"
7230 test -n "$xrpath" && \
7231 func_warning "\`-R' is ignored for archives"
7233 test -n "$vinfo" && \
7234 func_warning "\`-version-info/-version-number' is ignored for archives"
7236 test -n "$release" && \
7237 func_warning "\`-release' is ignored for archives"
7239 test -n "$export_symbols$export_symbols_regex" && \
7240 func_warning "\`-export-symbols' is ignored for archives"
7242 # Now set the variables for building old libraries.
7243 build_libtool_libs=no
7245 func_append objs "$old_deplibs"
7249 # Make sure we only generate libraries of the form `libNAME.la'.
7252 func_stripname 'lib' '.la' "$outputname"
7253 name=$func_stripname_result
7254 eval shared_ext=\"$shrext_cmds\"
7255 eval libname=\"$libname_spec\"
7258 test "$module" = no && \
7259 func_fatal_help "libtool library \`$output' must begin with \`lib'"
7261 if test "$need_lib_prefix" != no; then
7262 # Add the "lib" prefix for modules if required
7263 func_stripname '' '.la' "$outputname"
7264 name=$func_stripname_result
7265 eval shared_ext=\"$shrext_cmds\"
7266 eval libname=\"$libname_spec\"
7268 func_stripname '' '.la' "$outputname"
7269 libname=$func_stripname_result
7274 if test -n "$objs"; then
7275 if test "$deplibs_check_method" != pass_all; then
7276 func_fatal_error "cannot build libtool library \`$output' from non-libtool objects on this host:$objs"
7279 $ECHO "*** Warning: Linking the shared library $output against the non-libtool"
7280 $ECHO "*** objects $objs is not portable!"
7281 func_append libobjs " $objs"
7285 test "$dlself" != no && \
7286 func_warning "\`-dlopen self' is ignored for libtool libraries"
7290 test "$#" -gt 1 && \
7291 func_warning "ignoring multiple \`-rpath's for a libtool library"
7296 if test -z "$rpath"; then
7297 if test "$build_libtool_libs" = yes; then
7298 # Building a libtool convenience library.
7299 # Some compilers have problems with a `.al' extension so
7300 # convenience libraries should have the same extension an
7301 # archive normally would.
7302 oldlibs="$output_objdir/$libname.$libext $oldlibs"
7303 build_libtool_libs=convenience
7307 test -n "$vinfo" && \
7308 func_warning "\`-version-info/-version-number' is ignored for convenience libraries"
7310 test -n "$release" && \
7311 func_warning "\`-release' is ignored for convenience libraries"
7314 # Parse the version information argument.
7315 save_ifs="$IFS"; IFS=':'
7316 set dummy $vinfo 0 0 0
7321 func_fatal_help "too many parameters to \`-version-info'"
7323 # convert absolute version numbers to libtool ages
7324 # this retains compatibility with .la files and attempts
7325 # to make the code below a bit more comprehensible
7327 case $vinfo_number in
7331 number_revision="$3"
7333 # There are really only two kinds -- those that
7334 # use the current revision as the major version
7335 # and those that subtract age and use age as
7336 # a minor version. But, then there is irix
7337 # which has an extra 1 added just for fun
7339 case $version_type in
7340 # correct linux to gnu/linux during the next big refactor
7341 darwin|linux|osf|windows|none)
7342 func_arith $number_major + $number_minor
7343 current=$func_arith_result
7345 revision="$number_revision"
7347 freebsd-aout|freebsd-elf|qnx|sunos)
7348 current="$number_major"
7349 revision="$number_minor"
7353 func_arith $number_major + $number_minor
7354 current=$func_arith_result
7356 revision="$number_minor"
7357 lt_irix_increment=no
7360 func_fatal_configuration "$modename: unknown library version type \`$version_type'"
7371 # Check that each of the things are valid numbers.
7373 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]) ;;
7375 func_error "CURRENT \`$current' must be a nonnegative integer"
7376 func_fatal_error "\`$vinfo' is not valid version information"
7381 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]) ;;
7383 func_error "REVISION \`$revision' must be a nonnegative integer"
7384 func_fatal_error "\`$vinfo' is not valid version information"
7389 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]) ;;
7391 func_error "AGE \`$age' must be a nonnegative integer"
7392 func_fatal_error "\`$vinfo' is not valid version information"
7396 if test "$age" -gt "$current"; then
7397 func_error "AGE \`$age' is greater than the current interface number \`$current'"
7398 func_fatal_error "\`$vinfo' is not valid version information"
7401 # Calculate the version variables.
7405 case $version_type in
7409 # Like Linux, but with the current version available in
7410 # verstring for coding it into the library header
7411 func_arith $current - $age
7412 major=.$func_arith_result
7413 versuffix="$major.$age.$revision"
7414 # Darwin ld doesn't like 0 for these options...
7415 func_arith $current + 1
7416 minor_current=$func_arith_result
7417 xlcverstring="${wl}-compatibility_version ${wl}$minor_current ${wl}-current_version ${wl}$minor_current.$revision"
7418 verstring="-compatibility_version $minor_current -current_version $minor_current.$revision"
7423 versuffix=".$current.$revision";
7428 versuffix=".$current"
7432 if test "X$lt_irix_increment" = "Xno"; then
7433 func_arith $current - $age
7435 func_arith $current - $age + 1
7437 major=$func_arith_result
7439 case $version_type in
7440 nonstopux) verstring_prefix=nonstopux ;;
7441 *) verstring_prefix=sgi ;;
7443 verstring="$verstring_prefix$major.$revision"
7445 # Add in all the interfaces that we are compatible with.
7447 while test "$loop" -ne 0; do
7448 func_arith $revision - $loop
7449 iface=$func_arith_result
7450 func_arith $loop - 1
7451 loop=$func_arith_result
7452 verstring="$verstring_prefix$major.$iface:$verstring"
7455 # Before this point, $major must not contain `.'.
7457 versuffix="$major.$revision"
7460 linux) # correct to gnu/linux during the next big refactor
7461 func_arith $current - $age
7462 major=.$func_arith_result
7463 versuffix="$major.$age.$revision"
7467 func_arith $current - $age
7468 major=.$func_arith_result
7469 versuffix=".$current.$age.$revision"
7470 verstring="$current.$age.$revision"
7472 # Add in all the interfaces that we are compatible with.
7474 while test "$loop" -ne 0; do
7475 func_arith $current - $loop
7476 iface=$func_arith_result
7477 func_arith $loop - 1
7478 loop=$func_arith_result
7479 verstring="$verstring:${iface}.0"
7482 # Make executables depend on our current version.
7483 func_append verstring ":${current}.0"
7488 versuffix=".$current"
7493 versuffix=".$current.$revision"
7497 # Use '-' rather than '.', since we only want one
7498 # extension on DOS 8.3 filesystems.
7499 func_arith $current - $age
7500 major=$func_arith_result
7505 func_fatal_configuration "unknown library version type \`$version_type'"
7509 # Clear the version info if we defaulted, and they specified a release.
7510 if test -z "$vinfo" && test -n "$release"; then
7512 case $version_type in
7514 # we can't check for "0.0" in archive_cmds due to quoting
7515 # problems, so we reset it completely
7522 if test "$need_version" = no; then
7529 # Remove version info from name if versioning should be avoided
7530 if test "$avoid_version" = yes && test "$need_version" = no; then
7536 # Check to see if the archive will have undefined symbols.
7537 if test "$allow_undefined" = yes; then
7538 if test "$allow_undefined_flag" = unsupported; then
7539 func_warning "undefined symbols not allowed in $host shared libraries"
7540 build_libtool_libs=no
7544 # Don't allow undefined symbols.
7545 allow_undefined_flag="$no_undefined_flag"
7550 func_generate_dlsyms "$libname" "$libname" "yes"
7551 func_append libobjs " $symfileobj"
7552 test "X$libobjs" = "X " && libobjs=
7554 if test "$opt_mode" != relink; then
7555 # Remove our outputs, but don't remove object files since they
7556 # may have been created when compiling PIC objects.
7558 tempremovelist=`$ECHO "$output_objdir/*"`
7559 for p in $tempremovelist; do
7563 $output_objdir/$outputname | $output_objdir/$libname.* | $output_objdir/${libname}${release}.*)
7564 if test "X$precious_files_regex" != "X"; then
7565 if $ECHO "$p" | $EGREP -e "$precious_files_regex" >/dev/null 2>&1
7570 func_append removelist " $p"
7575 test -n "$removelist" && \
7576 func_show_eval "${RM}r \$removelist"
7579 # Now set the variables for building old libraries.
7580 if test "$build_old_libs" = yes && test "$build_libtool_libs" != convenience ; then
7581 func_append oldlibs " $output_objdir/$libname.$libext"
7583 # Transform .lo files to .o files.
7584 oldobjs="$objs "`$ECHO "$libobjs" | $SP2NL | $SED "/\.${libext}$/d; $lo2o" | $NL2SP`
7587 # Eliminate all temporary directories.
7588 #for path in $notinst_path; do
7589 # lib_search_path=`$ECHO "$lib_search_path " | $SED "s% $path % %g"`
7590 # deplibs=`$ECHO "$deplibs " | $SED "s% -L$path % %g"`
7591 # dependency_libs=`$ECHO "$dependency_libs " | $SED "s% -L$path % %g"`
7594 if test -n "$xrpath"; then
7595 # If the user specified any rpath flags, then add them.
7597 for libdir in $xrpath; do
7598 func_replace_sysroot "$libdir"
7599 func_append temp_xrpath " -R$func_replace_sysroot_result"
7600 case "$finalize_rpath " in
7602 *) func_append finalize_rpath " $libdir" ;;
7605 if test "$hardcode_into_libs" != yes || test "$build_old_libs" = yes; then
7606 dependency_libs="$temp_xrpath $dependency_libs"
7610 # Make sure dlfiles contains only unique files that won't be dlpreopened
7611 old_dlfiles="$dlfiles"
7613 for lib in $old_dlfiles; do
7614 case " $dlprefiles $dlfiles " in
7616 *) func_append dlfiles " $lib" ;;
7620 # Make sure dlprefiles contains only unique files
7621 old_dlprefiles="$dlprefiles"
7623 for lib in $old_dlprefiles; do
7624 case "$dlprefiles " in
7626 *) func_append dlprefiles " $lib" ;;
7630 if test "$build_libtool_libs" = yes; then
7631 if test -n "$rpath"; then
7633 *-*-cygwin* | *-*-mingw* | *-*-pw32* | *-*-os2* | *-*-beos* | *-cegcc* | *-*-haiku*)
7634 # these systems don't actually have a c library (as such)!
7636 *-*-rhapsody* | *-*-darwin1.[012])
7637 # Rhapsody C library is in the System framework
7638 func_append deplibs " System.ltframework"
7641 # Don't link with libc until the a.out ld.so is fixed.
7643 *-*-openbsd* | *-*-freebsd* | *-*-dragonfly*)
7644 # Do not include libc due to us having libc/libc_r.
7646 *-*-sco3.2v5* | *-*-sco5v6*)
7647 # Causes problems with __ctype
7649 *-*-sysv4.2uw2* | *-*-sysv5* | *-*-unixware* | *-*-OpenUNIX*)
7650 # Compiler inserts libc in the correct place for threads to work
7653 # Add libc to deplibs on all other systems if necessary.
7654 if test "$build_libtool_need_lc" = "yes"; then
7655 func_append deplibs " -lc"
7661 # Transform deplibs into only deplibs that can be linked in shared.
7663 libname_save=$libname
7664 release_save=$release
7665 versuffix_save=$versuffix
7667 # I'm not sure if I'm treating the release correctly. I think
7668 # release should show up in the -l (ie -lgmp5) so we don't want to
7669 # add it in twice. Is that correct?
7675 case $deplibs_check_method in
7677 # Don't check for shared/static. Everything works.
7678 # This might be a little naive. We might want to check
7679 # whether the library exists or not. But this is on
7680 # osf3 & osf4 and I'm not really sure... Just
7681 # implementing what was already the behavior.
7685 # This code stresses the "libraries are programs" paradigm to its
7686 # limits. Maybe even breaks it. We compile a program, linking it
7687 # against the deplibs as a proxy for the library. Then we can check
7688 # whether they linked in statically or dynamically with ldd.
7689 $opt_dry_run || $RM conftest.c
7690 cat > conftest.c <<EOF
7691 int main() { return 0; }
7693 $opt_dry_run || $RM conftest
7694 if $LTCC $LTCFLAGS -o conftest conftest.c $deplibs; then
7695 ldd_output=`ldd conftest`
7696 for i in $deplibs; do
7699 func_stripname -l '' "$i"
7700 name=$func_stripname_result
7701 if test "X$allow_libtool_libs_with_static_runtimes" = "Xyes" ; then
7702 case " $predeps $postdeps " in
7704 func_append newdeplibs " $i"
7709 if test -n "$i" ; then
7710 libname=`eval "\\$ECHO \"$libname_spec\""`
7711 deplib_matches=`eval "\\$ECHO \"$library_names_spec\""`
7712 set dummy $deplib_matches; shift
7714 if test `expr "$ldd_output" : ".*$deplib_match"` -ne 0 ; then
7715 func_append newdeplibs " $i"
7719 $ECHO "*** Warning: dynamic linker does not accept needed library $i."
7720 echo "*** I have the capability to make that library automatically link in when"
7721 echo "*** you link to this library. But I can only do this if you have a"
7722 echo "*** shared version of the library, which I believe you do not have"
7723 echo "*** because a test_compile did reveal that the linker did not use it for"
7724 echo "*** its dynamic dependency list that programs get resolved with at runtime."
7729 func_append newdeplibs " $i"
7734 # Error occurred in the first compile. Let's try to salvage
7735 # the situation: Compile a separate program for each library.
7736 for i in $deplibs; do
7739 func_stripname -l '' "$i"
7740 name=$func_stripname_result
7741 $opt_dry_run || $RM conftest
7742 if $LTCC $LTCFLAGS -o conftest conftest.c $i; then
7743 ldd_output=`ldd conftest`
7744 if test "X$allow_libtool_libs_with_static_runtimes" = "Xyes" ; then
7745 case " $predeps $postdeps " in
7747 func_append newdeplibs " $i"
7752 if test -n "$i" ; then
7753 libname=`eval "\\$ECHO \"$libname_spec\""`
7754 deplib_matches=`eval "\\$ECHO \"$library_names_spec\""`
7755 set dummy $deplib_matches; shift
7757 if test `expr "$ldd_output" : ".*$deplib_match"` -ne 0 ; then
7758 func_append newdeplibs " $i"
7762 $ECHO "*** Warning: dynamic linker does not accept needed library $i."
7763 echo "*** I have the capability to make that library automatically link in when"
7764 echo "*** you link to this library. But I can only do this if you have a"
7765 echo "*** shared version of the library, which you do not appear to have"
7766 echo "*** because a test_compile did reveal that the linker did not use this one"
7767 echo "*** as a dynamic dependency that programs can get resolved with at runtime."
7773 $ECHO "*** Warning! Library $i is needed by this library but I was not able to"
7774 echo "*** make it link in! You will probably need to install it or some"
7775 echo "*** library that it depends on before this library will be fully"
7776 echo "*** functional. Installing it before continuing would be even better."
7780 func_append newdeplibs " $i"
7787 set dummy $deplibs_check_method; shift
7788 file_magic_regex=`expr "$deplibs_check_method" : "$1 \(.*\)"`
7789 for a_deplib in $deplibs; do
7792 func_stripname -l '' "$a_deplib"
7793 name=$func_stripname_result
7794 if test "X$allow_libtool_libs_with_static_runtimes" = "Xyes" ; then
7795 case " $predeps $postdeps " in
7797 func_append newdeplibs " $a_deplib"
7802 if test -n "$a_deplib" ; then
7803 libname=`eval "\\$ECHO \"$libname_spec\""`
7804 if test -n "$file_magic_glob"; then
7805 libnameglob=`func_echo_all "$libname" | $SED -e $file_magic_glob`
7807 libnameglob=$libname
7809 test "$want_nocaseglob" = yes && nocaseglob=`shopt -p nocaseglob`
7810 for i in $lib_search_path $sys_lib_search_path $shlib_search_path; do
7811 if test "$want_nocaseglob" = yes; then
7813 potential_libs=`ls $i/$libnameglob[.-]* 2>/dev/null`
7816 potential_libs=`ls $i/$libnameglob[.-]* 2>/dev/null`
7818 for potent_lib in $potential_libs; do
7819 # Follow soft links.
7820 if ls -lLd "$potent_lib" 2>/dev/null |
7821 $GREP " -> " >/dev/null; then
7824 # The statement above tries to avoid entering an
7825 # endless loop below, in case of cyclic links.
7826 # We might still enter an endless loop, since a link
7827 # loop can be closed while we follow links,
7829 potlib="$potent_lib"
7830 while test -h "$potlib" 2>/dev/null; do
7831 potliblink=`ls -ld $potlib | ${SED} 's/.* -> //'`
7833 [\\/]* | [A-Za-z]:[\\/]*) potlib="$potliblink";;
7834 *) potlib=`$ECHO "$potlib" | $SED 's,[^/]*$,,'`"$potliblink";;
7837 if eval $file_magic_cmd \"\$potlib\" 2>/dev/null |
7839 $EGREP "$file_magic_regex" > /dev/null; then
7840 func_append newdeplibs " $a_deplib"
7847 if test -n "$a_deplib" ; then
7850 $ECHO "*** Warning: linker path does not have real file for library $a_deplib."
7851 echo "*** I have the capability to make that library automatically link in when"
7852 echo "*** you link to this library. But I can only do this if you have a"
7853 echo "*** shared version of the library, which you do not appear to have"
7854 echo "*** because I did check the linker path looking for a file starting"
7855 if test -z "$potlib" ; then
7856 $ECHO "*** with $libname but no candidates were found. (...for file magic test)"
7858 $ECHO "*** with $libname and none of the candidates passed a file format test"
7859 $ECHO "*** using a file magic. Last file checked: $potlib"
7864 # Add a -L argument.
7865 func_append newdeplibs " $a_deplib"
7868 done # Gone through all deplibs.
7871 set dummy $deplibs_check_method; shift
7872 match_pattern_regex=`expr "$deplibs_check_method" : "$1 \(.*\)"`
7873 for a_deplib in $deplibs; do
7876 func_stripname -l '' "$a_deplib"
7877 name=$func_stripname_result
7878 if test "X$allow_libtool_libs_with_static_runtimes" = "Xyes" ; then
7879 case " $predeps $postdeps " in
7881 func_append newdeplibs " $a_deplib"
7886 if test -n "$a_deplib" ; then
7887 libname=`eval "\\$ECHO \"$libname_spec\""`
7888 for i in $lib_search_path $sys_lib_search_path $shlib_search_path; do
7889 potential_libs=`ls $i/$libname[.-]* 2>/dev/null`
7890 for potent_lib in $potential_libs; do
7891 potlib="$potent_lib" # see symlink-check above in file_magic test
7892 if eval "\$ECHO \"$potent_lib\"" 2>/dev/null | $SED 10q | \
7893 $EGREP "$match_pattern_regex" > /dev/null; then
7894 func_append newdeplibs " $a_deplib"
7901 if test -n "$a_deplib" ; then
7904 $ECHO "*** Warning: linker path does not have real file for library $a_deplib."
7905 echo "*** I have the capability to make that library automatically link in when"
7906 echo "*** you link to this library. But I can only do this if you have a"
7907 echo "*** shared version of the library, which you do not appear to have"
7908 echo "*** because I did check the linker path looking for a file starting"
7909 if test -z "$potlib" ; then
7910 $ECHO "*** with $libname but no candidates were found. (...for regex pattern test)"
7912 $ECHO "*** with $libname and none of the candidates passed a file format test"
7913 $ECHO "*** using a regex pattern. Last file checked: $potlib"
7918 # Add a -L argument.
7919 func_append newdeplibs " $a_deplib"
7922 done # Gone through all deplibs.
7926 tmp_deplibs=`$ECHO " $deplibs" | $SED 's/ -lc$//; s/ -[LR][^ ]*//g'`
7927 if test "X$allow_libtool_libs_with_static_runtimes" = "Xyes" ; then
7928 for i in $predeps $postdeps ; do
7929 # can't use Xsed below, because $i might contain '/'
7930 tmp_deplibs=`$ECHO " $tmp_deplibs" | $SED "s,$i,,"`
7933 case $tmp_deplibs in
7936 if test "X$deplibs_check_method" = "Xnone"; then
7937 echo "*** Warning: inter-library dependencies are not supported in this platform."
7939 echo "*** Warning: inter-library dependencies are not known to be supported."
7941 echo "*** All declared inter-library dependencies are being dropped."
7947 versuffix=$versuffix_save
7949 release=$release_save
7950 libname=$libname_save
7954 *-*-rhapsody* | *-*-darwin1.[012])
7955 # On Rhapsody replace the C library with the System framework
7956 newdeplibs=`$ECHO " $newdeplibs" | $SED 's/ -lc / System.ltframework /'`
7960 if test "$droppeddeps" = yes; then
7961 if test "$module" = yes; then
7963 echo "*** Warning: libtool could not satisfy all declared inter-library"
7964 $ECHO "*** dependencies of module $libname. Therefore, libtool will create"
7965 echo "*** a static module, that should work as long as the dlopening"
7966 echo "*** application is linked with the -dlopen flag."
7967 if test -z "$global_symbol_pipe"; then
7969 echo "*** However, this would only work if libtool was able to extract symbol"
7970 echo "*** lists from a program, using \`nm' or equivalent, but libtool could"
7971 echo "*** not find such a program. So, this module is probably useless."
7972 echo "*** \`nm' from GNU binutils and a full rebuild may help."
7974 if test "$build_old_libs" = no; then
7975 oldlibs="$output_objdir/$libname.$libext"
7976 build_libtool_libs=module
7979 build_libtool_libs=no
7982 echo "*** The inter-library dependencies that have been dropped here will be"
7983 echo "*** automatically added whenever a program is linked with this library"
7984 echo "*** or is declared to -dlopen it."
7986 if test "$allow_undefined" = no; then
7988 echo "*** Since this library must not contain undefined symbols,"
7989 echo "*** because either the platform does not support them or"
7990 echo "*** it was explicitly requested with -no-undefined,"
7991 echo "*** libtool will only create a static version of it."
7992 if test "$build_old_libs" = no; then
7993 oldlibs="$output_objdir/$libname.$libext"
7994 build_libtool_libs=module
7997 build_libtool_libs=no
8002 # Done checking deplibs!
8005 # Time to change all our "foo.ltframework" stuff back to "-framework foo"
8008 newdeplibs=`$ECHO " $newdeplibs" | $SED 's% \([^ $]*\).ltframework% -framework \1%g'`
8009 new_inherited_linker_flags=`$ECHO " $new_inherited_linker_flags" | $SED 's% \([^ $]*\).ltframework% -framework \1%g'`
8010 deplibs=`$ECHO " $deplibs" | $SED 's% \([^ $]*\).ltframework% -framework \1%g'`
8014 # move library search paths that coincide with paths to not yet
8015 # installed libraries to the beginning of the library search list
8017 for path in $notinst_path; do
8018 case " $new_libs " in
8019 *" -L$path/$objdir "*) ;;
8021 case " $deplibs " in
8022 *" -L$path/$objdir "*)
8023 func_append new_libs " -L$path/$objdir" ;;
8028 for deplib in $deplibs; do
8031 case " $new_libs " in
8033 *) func_append new_libs " $deplib" ;;
8036 *) func_append new_libs " $deplib" ;;
8041 # All the library-specific variables (install_libdir is set above).
8046 # Test again, we may have decided not to build it any more
8047 if test "$build_libtool_libs" = yes; then
8048 # Remove ${wl} instances when linking with ld.
8049 # FIXME: should test the right _cmds variable.
8050 case $archive_cmds in
8053 if test "$hardcode_into_libs" = yes; then
8054 # Hardcode the library paths
8057 rpath="$finalize_rpath"
8058 test "$opt_mode" != relink && rpath="$compile_rpath$rpath"
8059 for libdir in $rpath; do
8060 if test -n "$hardcode_libdir_flag_spec"; then
8061 if test -n "$hardcode_libdir_separator"; then
8062 func_replace_sysroot "$libdir"
8063 libdir=$func_replace_sysroot_result
8064 if test -z "$hardcode_libdirs"; then
8065 hardcode_libdirs="$libdir"
8067 # Just accumulate the unique libdirs.
8068 case $hardcode_libdir_separator$hardcode_libdirs$hardcode_libdir_separator in
8069 *"$hardcode_libdir_separator$libdir$hardcode_libdir_separator"*)
8072 func_append hardcode_libdirs "$hardcode_libdir_separator$libdir"
8077 eval flag=\"$hardcode_libdir_flag_spec\"
8078 func_append dep_rpath " $flag"
8080 elif test -n "$runpath_var"; then
8081 case "$perm_rpath " in
8083 *) func_append perm_rpath " $libdir" ;;
8087 # Substitute the hardcoded libdirs into the rpath.
8088 if test -n "$hardcode_libdir_separator" &&
8089 test -n "$hardcode_libdirs"; then
8090 libdir="$hardcode_libdirs"
8091 eval "dep_rpath=\"$hardcode_libdir_flag_spec\""
8093 if test -n "$runpath_var" && test -n "$perm_rpath"; then
8094 # We should set the runpath_var.
8096 for dir in $perm_rpath; do
8097 func_append rpath "$dir:"
8099 eval "$runpath_var='$rpath\$$runpath_var'; export $runpath_var"
8101 test -n "$dep_rpath" && deplibs="$dep_rpath $deplibs"
8104 shlibpath="$finalize_shlibpath"
8105 test "$opt_mode" != relink && shlibpath="$compile_shlibpath$shlibpath"
8106 if test -n "$shlibpath"; then
8107 eval "$shlibpath_var='$shlibpath\$$shlibpath_var'; export $shlibpath_var"
8110 # Get the real and link names of the library.
8111 eval shared_ext=\"$shrext_cmds\"
8112 eval library_names=\"$library_names_spec\"
8113 set dummy $library_names
8118 if test -n "$soname_spec"; then
8119 eval soname=\"$soname_spec\"
8123 if test -z "$dlname"; then
8127 lib="$output_objdir/$realname"
8131 func_append linknames " $link"
8134 # Use standard objects if they are pic
8135 test -z "$pic_flag" && libobjs=`$ECHO "$libobjs" | $SP2NL | $SED "$lo2o" | $NL2SP`
8136 test "X$libobjs" = "X " && libobjs=
8139 if test -n "$export_symbols" && test -n "$include_expsyms"; then
8140 $opt_dry_run || cp "$export_symbols" "$output_objdir/$libname.uexp"
8141 export_symbols="$output_objdir/$libname.uexp"
8142 func_append delfiles " $export_symbols"
8145 orig_export_symbols=
8147 cygwin* | mingw* | cegcc*)
8148 if test -n "$export_symbols" && test -z "$export_symbols_regex"; then
8149 # exporting using user supplied symfile
8150 if test "x`$SED "$sed_uncomment_deffile" $export_symbols | $SED 1q`" != xEXPORTS; then
8151 # and it's NOT already a .def file. Must figure out
8152 # which of the given symbols are data symbols and tag
8153 # them as such. So, trigger use of export_symbols_cmds.
8154 # export_symbols gets reassigned inside the "prepare
8155 # the list of exported symbols" if statement, so the
8156 # include_expsyms logic still works.
8157 orig_export_symbols="$export_symbols"
8159 always_export_symbols=yes
8165 # Prepare the list of exported symbols
8166 if test -z "$export_symbols"; then
8167 if test "$always_export_symbols" = yes || test -n "$export_symbols_regex"; then
8168 func_verbose "generating symbol list for \`$libname.la'"
8169 export_symbols="$output_objdir/$libname.exp"
8170 $opt_dry_run || $RM $export_symbols
8171 cmds=$export_symbols_cmds
8172 save_ifs="$IFS"; IFS='~'
8173 for cmd1 in $cmds; do
8175 # Take the normal branch if the nm_file_list_spec branch
8176 # doesn't work or if tool conversion is not needed.
8177 case $nm_file_list_spec~$to_tool_file_cmd in
8178 *~func_convert_file_noop | *~func_convert_file_msys_to_w32 | ~*)
8179 try_normal_branch=yes
8182 len=$func_len_result
8185 try_normal_branch=no
8188 if test "$try_normal_branch" = yes \
8189 && { test "$len" -lt "$max_cmd_len" \
8190 || test "$max_cmd_len" -le -1; }
8192 func_show_eval "$cmd" 'exit $?'
8193 skipped_export=false
8194 elif test -n "$nm_file_list_spec"; then
8195 func_basename "$output"
8196 output_la=$func_basename_result
8197 save_libobjs=$libobjs
8199 output=${output_objdir}/${output_la}.nm
8200 func_to_tool_file "$output"
8201 libobjs=$nm_file_list_spec$func_to_tool_file_result
8202 func_append delfiles " $output"
8203 func_verbose "creating $NM input file list: $output"
8204 for obj in $save_libobjs; do
8205 func_to_tool_file "$obj"
8206 $ECHO "$func_to_tool_file_result"
8209 func_show_eval "$cmd" 'exit $?'
8211 libobjs=$save_libobjs
8212 skipped_export=false
8214 # The command line is too long to execute in one step.
8215 func_verbose "using reloadable object file for export list..."
8217 # Break out early, otherwise skipped_export may be
8218 # set to false by a later but shorter cmd.
8223 if test -n "$export_symbols_regex" && test "X$skipped_export" != "X:"; then
8224 func_show_eval '$EGREP -e "$export_symbols_regex" "$export_symbols" > "${export_symbols}T"'
8225 func_show_eval '$MV "${export_symbols}T" "$export_symbols"'
8230 if test -n "$export_symbols" && test -n "$include_expsyms"; then
8231 tmp_export_symbols="$export_symbols"
8232 test -n "$orig_export_symbols" && tmp_export_symbols="$orig_export_symbols"
8233 $opt_dry_run || eval '$ECHO "$include_expsyms" | $SP2NL >> "$tmp_export_symbols"'
8236 if test "X$skipped_export" != "X:" && test -n "$orig_export_symbols"; then
8237 # The given exports_symbols file has to be filtered, so filter it.
8238 func_verbose "filter symbol list for \`$libname.la' to tag DATA exports"
8239 # FIXME: $output_objdir/$libname.filter potentially contains lots of
8240 # 's' commands which not all seds can handle. GNU sed should be fine
8241 # though. Also, the filter scales superlinearly with the number of
8242 # global variables. join(1) would be nice here, but unfortunately
8243 # isn't a blessed tool.
8244 $opt_dry_run || $SED -e '/[ ,]DATA/!d;s,\(.*\)\([ \,].*\),s|^\1$|\1\2|,' < $export_symbols > $output_objdir/$libname.filter
8245 func_append delfiles " $export_symbols $output_objdir/$libname.filter"
8246 export_symbols=$output_objdir/$libname.def
8247 $opt_dry_run || $SED -f $output_objdir/$libname.filter < $orig_export_symbols > $export_symbols
8251 for test_deplib in $deplibs; do
8252 case " $convenience " in
8253 *" $test_deplib "*) ;;
8255 func_append tmp_deplibs " $test_deplib"
8259 deplibs="$tmp_deplibs"
8261 if test -n "$convenience"; then
8262 if test -n "$whole_archive_flag_spec" &&
8263 test "$compiler_needs_object" = yes &&
8264 test -z "$libobjs"; then
8265 # extract the archives, so we have objects to list.
8266 # TODO: could optimize this to just extract one archive.
8267 whole_archive_flag_spec=
8269 if test -n "$whole_archive_flag_spec"; then
8270 save_libobjs=$libobjs
8271 eval libobjs=\"\$libobjs $whole_archive_flag_spec\"
8272 test "X$libobjs" = "X " && libobjs=
8274 gentop="$output_objdir/${outputname}x"
8275 func_append generated " $gentop"
8277 func_extract_archives $gentop $convenience
8278 func_append libobjs " $func_extract_archives_result"
8279 test "X$libobjs" = "X " && libobjs=
8283 if test "$thread_safe" = yes && test -n "$thread_safe_flag_spec"; then
8284 eval flag=\"$thread_safe_flag_spec\"
8285 func_append linker_flags " $flag"
8288 # Make a backup of the uninstalled library when relinking
8289 if test "$opt_mode" = relink; then
8290 $opt_dry_run || eval '(cd $output_objdir && $RM ${realname}U && $MV $realname ${realname}U)' || exit $?
8293 # Do each of the archive commands.
8294 if test "$module" = yes && test -n "$module_cmds" ; then
8295 if test -n "$export_symbols" && test -n "$module_expsym_cmds"; then
8296 eval test_cmds=\"$module_expsym_cmds\"
8297 cmds=$module_expsym_cmds
8299 eval test_cmds=\"$module_cmds\"
8303 if test -n "$export_symbols" && test -n "$archive_expsym_cmds"; then
8304 eval test_cmds=\"$archive_expsym_cmds\"
8305 cmds=$archive_expsym_cmds
8307 eval test_cmds=\"$archive_cmds\"
8312 if test "X$skipped_export" != "X:" &&
8313 func_len " $test_cmds" &&
8314 len=$func_len_result &&
8315 test "$len" -lt "$max_cmd_len" || test "$max_cmd_len" -le -1; then
8318 # The command line is too long to link in one step, link piecewise
8319 # or, if using GNU ld and skipped_export is not :, use a linker
8322 # Save the value of $output and $libobjs because we want to
8323 # use them later. If we have whole_archive_flag_spec, we
8324 # want to use save_libobjs as it was before
8325 # whole_archive_flag_spec was expanded, because we can't
8326 # assume the linker understands whole_archive_flag_spec.
8327 # This may have to be revisited, in case too many
8328 # convenience libraries get linked in and end up exceeding
8330 if test -z "$convenience" || test -z "$whole_archive_flag_spec"; then
8331 save_libobjs=$libobjs
8334 func_basename "$output"
8335 output_la=$func_basename_result
8337 # Clear the reloadable object creation command queue and
8338 # initialize k to one.
8345 if test -n "$save_libobjs" && test "X$skipped_export" != "X:" && test "$with_gnu_ld" = yes; then
8346 output=${output_objdir}/${output_la}.lnkscript
8347 func_verbose "creating GNU ld script: $output"
8348 echo 'INPUT (' > $output
8349 for obj in $save_libobjs
8351 func_to_tool_file "$obj"
8352 $ECHO "$func_to_tool_file_result" >> $output
8355 func_append delfiles " $output"
8356 func_to_tool_file "$output"
8357 output=$func_to_tool_file_result
8358 elif test -n "$save_libobjs" && test "X$skipped_export" != "X:" && test "X$file_list_spec" != X; then
8359 output=${output_objdir}/${output_la}.lnk
8360 func_verbose "creating linker input file list: $output"
8365 if test "$compiler_needs_object" = yes; then
8371 func_to_tool_file "$obj"
8372 $ECHO "$func_to_tool_file_result" >> $output
8374 func_append delfiles " $output"
8375 func_to_tool_file "$output"
8376 output=$firstobj\"$file_list_spec$func_to_tool_file_result\"
8378 if test -n "$save_libobjs"; then
8379 func_verbose "creating reloadable object files..."
8380 output=$output_objdir/$output_la-${k}.$objext
8381 eval test_cmds=\"$reload_cmds\"
8382 func_len " $test_cmds"
8383 len0=$func_len_result
8386 # Loop over the list of objects to be linked.
8387 for obj in $save_libobjs
8390 func_arith $len + $func_len_result
8391 len=$func_arith_result
8392 if test "X$objlist" = X ||
8393 test "$len" -lt "$max_cmd_len"; then
8394 func_append objlist " $obj"
8396 # The command $test_cmds is almost too long, add a
8397 # command to the queue.
8398 if test "$k" -eq 1 ; then
8399 # The first file doesn't have a previous command to add.
8400 reload_objs=$objlist
8401 eval concat_cmds=\"$reload_cmds\"
8403 # All subsequent reloadable object files will link in
8404 # the last one created.
8405 reload_objs="$objlist $last_robj"
8406 eval concat_cmds=\"\$concat_cmds~$reload_cmds~\$RM $last_robj\"
8408 last_robj=$output_objdir/$output_la-${k}.$objext
8410 k=$func_arith_result
8411 output=$output_objdir/$output_la-${k}.$objext
8413 func_len " $last_robj"
8414 func_arith $len0 + $func_len_result
8415 len=$func_arith_result
8418 # Handle the remaining objects by creating one last
8419 # reloadable object file. All subsequent reloadable object
8420 # files will link in the last one created.
8421 test -z "$concat_cmds" || concat_cmds=$concat_cmds~
8422 reload_objs="$objlist $last_robj"
8423 eval concat_cmds=\"\${concat_cmds}$reload_cmds\"
8424 if test -n "$last_robj"; then
8425 eval concat_cmds=\"\${concat_cmds}~\$RM $last_robj\"
8427 func_append delfiles " $output"
8433 if ${skipped_export-false}; then
8434 func_verbose "generating symbol list for \`$libname.la'"
8435 export_symbols="$output_objdir/$libname.exp"
8436 $opt_dry_run || $RM $export_symbols
8438 # Append the command to create the export file.
8439 test -z "$concat_cmds" || concat_cmds=$concat_cmds~
8440 eval concat_cmds=\"\$concat_cmds$export_symbols_cmds\"
8441 if test -n "$last_robj"; then
8442 eval concat_cmds=\"\$concat_cmds~\$RM $last_robj\"
8446 test -n "$save_libobjs" &&
8447 func_verbose "creating a temporary reloadable object file: $output"
8449 # Loop through the commands generated above and execute them.
8450 save_ifs="$IFS"; IFS='~'
8451 for cmd in $concat_cmds; do
8454 func_quote_for_expand "$cmd"
8455 eval "func_echo $func_quote_for_expand_result"
8457 $opt_dry_run || eval "$cmd" || {
8460 # Restore the uninstalled library and exit
8461 if test "$opt_mode" = relink; then
8462 ( cd "$output_objdir" && \
8463 $RM "${realname}T" && \
8464 $MV "${realname}U" "$realname" )
8472 if test -n "$export_symbols_regex" && ${skipped_export-false}; then
8473 func_show_eval '$EGREP -e "$export_symbols_regex" "$export_symbols" > "${export_symbols}T"'
8474 func_show_eval '$MV "${export_symbols}T" "$export_symbols"'
8478 if ${skipped_export-false}; then
8479 if test -n "$export_symbols" && test -n "$include_expsyms"; then
8480 tmp_export_symbols="$export_symbols"
8481 test -n "$orig_export_symbols" && tmp_export_symbols="$orig_export_symbols"
8482 $opt_dry_run || eval '$ECHO "$include_expsyms" | $SP2NL >> "$tmp_export_symbols"'
8485 if test -n "$orig_export_symbols"; then
8486 # The given exports_symbols file has to be filtered, so filter it.
8487 func_verbose "filter symbol list for \`$libname.la' to tag DATA exports"
8488 # FIXME: $output_objdir/$libname.filter potentially contains lots of
8489 # 's' commands which not all seds can handle. GNU sed should be fine
8490 # though. Also, the filter scales superlinearly with the number of
8491 # global variables. join(1) would be nice here, but unfortunately
8492 # isn't a blessed tool.
8493 $opt_dry_run || $SED -e '/[ ,]DATA/!d;s,\(.*\)\([ \,].*\),s|^\1$|\1\2|,' < $export_symbols > $output_objdir/$libname.filter
8494 func_append delfiles " $export_symbols $output_objdir/$libname.filter"
8495 export_symbols=$output_objdir/$libname.def
8496 $opt_dry_run || $SED -f $output_objdir/$libname.filter < $orig_export_symbols > $export_symbols
8501 # Restore the value of output.
8504 if test -n "$convenience" && test -n "$whole_archive_flag_spec"; then
8505 eval libobjs=\"\$libobjs $whole_archive_flag_spec\"
8506 test "X$libobjs" = "X " && libobjs=
8508 # Expand the library linking commands again to reset the
8509 # value of $libobjs for piecewise linking.
8511 # Do each of the archive commands.
8512 if test "$module" = yes && test -n "$module_cmds" ; then
8513 if test -n "$export_symbols" && test -n "$module_expsym_cmds"; then
8514 cmds=$module_expsym_cmds
8519 if test -n "$export_symbols" && test -n "$archive_expsym_cmds"; then
8520 cmds=$archive_expsym_cmds
8527 if test -n "$delfiles"; then
8528 # Append the command to remove temporary files to $cmds.
8529 eval cmds=\"\$cmds~\$RM $delfiles\"
8532 # Add any objects from preloaded convenience libraries
8533 if test -n "$dlprefiles"; then
8534 gentop="$output_objdir/${outputname}x"
8535 func_append generated " $gentop"
8537 func_extract_archives $gentop $dlprefiles
8538 func_append libobjs " $func_extract_archives_result"
8539 test "X$libobjs" = "X " && libobjs=
8542 save_ifs="$IFS"; IFS='~'
8543 for cmd in $cmds; do
8547 func_quote_for_expand "$cmd"
8548 eval "func_echo $func_quote_for_expand_result"
8550 $opt_dry_run || eval "$cmd" || {
8553 # Restore the uninstalled library and exit
8554 if test "$opt_mode" = relink; then
8555 ( cd "$output_objdir" && \
8556 $RM "${realname}T" && \
8557 $MV "${realname}U" "$realname" )
8565 # Restore the uninstalled library and exit
8566 if test "$opt_mode" = relink; then
8567 $opt_dry_run || eval '(cd $output_objdir && $RM ${realname}T && $MV $realname ${realname}T && $MV ${realname}U $realname)' || exit $?
8569 if test -n "$convenience"; then
8570 if test -z "$whole_archive_flag_spec"; then
8571 func_show_eval '${RM}r "$gentop"'
8578 # Create links to the real library.
8579 for linkname in $linknames; do
8580 if test "$realname" != "$linkname"; then
8581 func_show_eval '(cd "$output_objdir" && $RM "$linkname" && $LN_S "$realname" "$linkname")' 'exit $?'
8585 # If -module or -export-dynamic was specified, set the dlname.
8586 if test "$module" = yes || test "$export_dynamic" = yes; then
8587 # On all known operating systems, these are identical.
8594 if test -n "$dlfiles$dlprefiles" || test "$dlself" != no; then
8595 func_warning "\`-dlopen' is ignored for objects"
8600 func_warning "\`-l' and \`-L' are ignored for objects" ;;
8603 test -n "$rpath" && \
8604 func_warning "\`-rpath' is ignored for objects"
8606 test -n "$xrpath" && \
8607 func_warning "\`-R' is ignored for objects"
8609 test -n "$vinfo" && \
8610 func_warning "\`-version-info' is ignored for objects"
8612 test -n "$release" && \
8613 func_warning "\`-release' is ignored for objects"
8617 test -n "$objs$old_deplibs" && \
8618 func_fatal_error "cannot build library object \`$output' from non-libtool objects"
8622 obj=$func_lo2o_result
8630 # Delete the old objects.
8631 $opt_dry_run || $RM $obj $libobj
8633 # Objects from convenience libraries. This assumes
8634 # single-version convenience libraries. Whenever we create
8635 # different ones for PIC/non-PIC, this we'll have to duplicate
8639 # reload_cmds runs $LD directly, so let us get rid of
8640 # -Wl from whole_archive_flag_spec and hope we can get by with
8641 # turning comma into space..
8644 if test -n "$convenience"; then
8645 if test -n "$whole_archive_flag_spec"; then
8646 eval tmp_whole_archive_flags=\"$whole_archive_flag_spec\"
8647 reload_conv_objs=$reload_objs\ `$ECHO "$tmp_whole_archive_flags" | $SED 's|,| |g'`
8649 gentop="$output_objdir/${obj}x"
8650 func_append generated " $gentop"
8652 func_extract_archives $gentop $convenience
8653 reload_conv_objs="$reload_objs $func_extract_archives_result"
8657 # If we're not building shared, we need to use non_pic_objs
8658 test "$build_libtool_libs" != yes && libobjs="$non_pic_objects"
8660 # Create the old-style object.
8661 reload_objs="$objs$old_deplibs "`$ECHO "$libobjs" | $SP2NL | $SED "/\.${libext}$/d; /\.lib$/d; $lo2o" | $NL2SP`" $reload_conv_objs" ### testsuite: skip nested quoting test
8664 func_execute_cmds "$reload_cmds" 'exit $?'
8666 # Exit if we aren't doing a library object file.
8667 if test -z "$libobj"; then
8668 if test -n "$gentop"; then
8669 func_show_eval '${RM}r "$gentop"'
8675 if test "$build_libtool_libs" != yes; then
8676 if test -n "$gentop"; then
8677 func_show_eval '${RM}r "$gentop"'
8680 # Create an invalid libtool object if no PIC, so that we don't
8681 # accidentally link it into a program.
8682 # $show "echo timestamp > $libobj"
8683 # $opt_dry_run || eval "echo timestamp > $libobj" || exit $?
8687 if test -n "$pic_flag" || test "$pic_mode" != default; then
8688 # Only do commands if we really have different PIC objects.
8689 reload_objs="$libobjs $reload_conv_objs"
8691 func_execute_cmds "$reload_cmds" 'exit $?'
8694 if test -n "$gentop"; then
8695 func_show_eval '${RM}r "$gentop"'
8703 *cygwin*) func_stripname '' '.exe' "$output"
8704 output=$func_stripname_result.exe;;
8706 test -n "$vinfo" && \
8707 func_warning "\`-version-info' is ignored for programs"
8709 test -n "$release" && \
8710 func_warning "\`-release' is ignored for programs"
8712 test "$preload" = yes \
8713 && test "$dlopen_support" = unknown \
8714 && test "$dlopen_self" = unknown \
8715 && test "$dlopen_self_static" = unknown && \
8716 func_warning "\`LT_INIT([dlopen])' not used. Assuming no dlopen support."
8719 *-*-rhapsody* | *-*-darwin1.[012])
8720 # On Rhapsody replace the C library is the System framework
8721 compile_deplibs=`$ECHO " $compile_deplibs" | $SED 's/ -lc / System.ltframework /'`
8722 finalize_deplibs=`$ECHO " $finalize_deplibs" | $SED 's/ -lc / System.ltframework /'`
8728 # Don't allow lazy linking, it breaks C++ global constructors
8729 # But is supposedly fixed on 10.4 or later (yay!).
8730 if test "$tagname" = CXX ; then
8731 case ${MACOSX_DEPLOYMENT_TARGET-10.0} in
8733 func_append compile_command " ${wl}-bind_at_load"
8734 func_append finalize_command " ${wl}-bind_at_load"
8738 # Time to change all our "foo.ltframework" stuff back to "-framework foo"
8739 compile_deplibs=`$ECHO " $compile_deplibs" | $SED 's% \([^ $]*\).ltframework% -framework \1%g'`
8740 finalize_deplibs=`$ECHO " $finalize_deplibs" | $SED 's% \([^ $]*\).ltframework% -framework \1%g'`
8745 # move library search paths that coincide with paths to not yet
8746 # installed libraries to the beginning of the library search list
8748 for path in $notinst_path; do
8749 case " $new_libs " in
8750 *" -L$path/$objdir "*) ;;
8752 case " $compile_deplibs " in
8753 *" -L$path/$objdir "*)
8754 func_append new_libs " -L$path/$objdir" ;;
8759 for deplib in $compile_deplibs; do
8762 case " $new_libs " in
8764 *) func_append new_libs " $deplib" ;;
8767 *) func_append new_libs " $deplib" ;;
8770 compile_deplibs="$new_libs"
8773 func_append compile_command " $compile_deplibs"
8774 func_append finalize_command " $finalize_deplibs"
8776 if test -n "$rpath$xrpath"; then
8777 # If the user specified any rpath flags, then add them.
8778 for libdir in $rpath $xrpath; do
8779 # This is the magic to use -rpath.
8780 case "$finalize_rpath " in
8782 *) func_append finalize_rpath " $libdir" ;;
8787 # Now hardcode the library paths
8790 for libdir in $compile_rpath $finalize_rpath; do
8791 if test -n "$hardcode_libdir_flag_spec"; then
8792 if test -n "$hardcode_libdir_separator"; then
8793 if test -z "$hardcode_libdirs"; then
8794 hardcode_libdirs="$libdir"
8796 # Just accumulate the unique libdirs.
8797 case $hardcode_libdir_separator$hardcode_libdirs$hardcode_libdir_separator in
8798 *"$hardcode_libdir_separator$libdir$hardcode_libdir_separator"*)
8801 func_append hardcode_libdirs "$hardcode_libdir_separator$libdir"
8806 eval flag=\"$hardcode_libdir_flag_spec\"
8807 func_append rpath " $flag"
8809 elif test -n "$runpath_var"; then
8810 case "$perm_rpath " in
8812 *) func_append perm_rpath " $libdir" ;;
8816 *-*-cygwin* | *-*-mingw* | *-*-pw32* | *-*-os2* | *-cegcc*)
8817 testbindir=`${ECHO} "$libdir" | ${SED} -e 's*/lib$*/bin*'`
8818 case :$dllsearchpath: in
8820 ::) dllsearchpath=$libdir;;
8821 *) func_append dllsearchpath ":$libdir";;
8823 case :$dllsearchpath: in
8824 *":$testbindir:"*) ;;
8825 ::) dllsearchpath=$testbindir;;
8826 *) func_append dllsearchpath ":$testbindir";;
8831 # Substitute the hardcoded libdirs into the rpath.
8832 if test -n "$hardcode_libdir_separator" &&
8833 test -n "$hardcode_libdirs"; then
8834 libdir="$hardcode_libdirs"
8835 eval rpath=\" $hardcode_libdir_flag_spec\"
8837 compile_rpath="$rpath"
8841 for libdir in $finalize_rpath; do
8842 if test -n "$hardcode_libdir_flag_spec"; then
8843 if test -n "$hardcode_libdir_separator"; then
8844 if test -z "$hardcode_libdirs"; then
8845 hardcode_libdirs="$libdir"
8847 # Just accumulate the unique libdirs.
8848 case $hardcode_libdir_separator$hardcode_libdirs$hardcode_libdir_separator in
8849 *"$hardcode_libdir_separator$libdir$hardcode_libdir_separator"*)
8852 func_append hardcode_libdirs "$hardcode_libdir_separator$libdir"
8857 eval flag=\"$hardcode_libdir_flag_spec\"
8858 func_append rpath " $flag"
8860 elif test -n "$runpath_var"; then
8861 case "$finalize_perm_rpath " in
8863 *) func_append finalize_perm_rpath " $libdir" ;;
8867 # Substitute the hardcoded libdirs into the rpath.
8868 if test -n "$hardcode_libdir_separator" &&
8869 test -n "$hardcode_libdirs"; then
8870 libdir="$hardcode_libdirs"
8871 eval rpath=\" $hardcode_libdir_flag_spec\"
8873 finalize_rpath="$rpath"
8875 if test -n "$libobjs" && test "$build_old_libs" = yes; then
8876 # Transform all the library objects into standard objects.
8877 compile_command=`$ECHO "$compile_command" | $SP2NL | $SED "$lo2o" | $NL2SP`
8878 finalize_command=`$ECHO "$finalize_command" | $SP2NL | $SED "$lo2o" | $NL2SP`
8881 func_generate_dlsyms "$outputname" "@PROGRAM@" "no"
8883 # template prelinking step
8884 if test -n "$prelink_cmds"; then
8885 func_execute_cmds "$prelink_cmds" 'exit $?'
8888 wrappers_required=yes
8890 *cegcc* | *mingw32ce*)
8891 # Disable wrappers for cegcc and mingw32ce hosts, we are cross compiling anyway.
8892 wrappers_required=no
8894 *cygwin* | *mingw* )
8895 if test "$build_libtool_libs" != yes; then
8896 wrappers_required=no
8900 if test "$need_relink" = no || test "$build_libtool_libs" != yes; then
8901 wrappers_required=no
8905 if test "$wrappers_required" = no; then
8906 # Replace the output file specification.
8907 compile_command=`$ECHO "$compile_command" | $SED 's%@OUTPUT@%'"$output"'%g'`
8908 link_command="$compile_command$compile_rpath"
8910 # We have no uninstalled library dependencies, so finalize right now.
8912 func_show_eval "$link_command" 'exit_status=$?'
8914 if test -n "$postlink_cmds"; then
8915 func_to_tool_file "$output"
8916 postlink_cmds=`func_echo_all "$postlink_cmds" | $SED -e 's%@OUTPUT@%'"$output"'%g' -e 's%@TOOL_OUTPUT@%'"$func_to_tool_file_result"'%g'`
8917 func_execute_cmds "$postlink_cmds" 'exit $?'
8920 # Delete the generated files.
8921 if test -f "$output_objdir/${outputname}S.${objext}"; then
8922 func_show_eval '$RM "$output_objdir/${outputname}S.${objext}"'
8928 if test -n "$compile_shlibpath$finalize_shlibpath"; then
8929 compile_command="$shlibpath_var=\"$compile_shlibpath$finalize_shlibpath\$$shlibpath_var\" $compile_command"
8931 if test -n "$finalize_shlibpath"; then
8932 finalize_command="$shlibpath_var=\"$finalize_shlibpath\$$shlibpath_var\" $finalize_command"
8937 if test -n "$runpath_var"; then
8938 if test -n "$perm_rpath"; then
8939 # We should set the runpath_var.
8941 for dir in $perm_rpath; do
8942 func_append rpath "$dir:"
8944 compile_var="$runpath_var=\"$rpath\$$runpath_var\" "
8946 if test -n "$finalize_perm_rpath"; then
8947 # We should set the runpath_var.
8949 for dir in $finalize_perm_rpath; do
8950 func_append rpath "$dir:"
8952 finalize_var="$runpath_var=\"$rpath\$$runpath_var\" "
8956 if test "$no_install" = yes; then
8957 # We don't need to create a wrapper script.
8958 link_command="$compile_var$compile_command$compile_rpath"
8959 # Replace the output file specification.
8960 link_command=`$ECHO "$link_command" | $SED 's%@OUTPUT@%'"$output"'%g'`
8961 # Delete the old output file.
8962 $opt_dry_run || $RM $output
8963 # Link the executable and exit
8964 func_show_eval "$link_command" 'exit $?'
8966 if test -n "$postlink_cmds"; then
8967 func_to_tool_file "$output"
8968 postlink_cmds=`func_echo_all "$postlink_cmds" | $SED -e 's%@OUTPUT@%'"$output"'%g' -e 's%@TOOL_OUTPUT@%'"$func_to_tool_file_result"'%g'`
8969 func_execute_cmds "$postlink_cmds" 'exit $?'
8975 if test "$hardcode_action" = relink; then
8976 # Fast installation is not supported
8977 link_command="$compile_var$compile_command$compile_rpath"
8978 relink_command="$finalize_var$finalize_command$finalize_rpath"
8980 func_warning "this platform does not like uninstalled shared libraries"
8981 func_warning "\`$output' will be relinked during installation"
8983 if test "$fast_install" != no; then
8984 link_command="$finalize_var$compile_command$finalize_rpath"
8985 if test "$fast_install" = yes; then
8986 relink_command=`$ECHO "$compile_var$compile_command$compile_rpath" | $SED 's%@OUTPUT@%\$progdir/\$file%g'`
8988 # fast_install is set to needless
8992 link_command="$compile_var$compile_command$compile_rpath"
8993 relink_command="$finalize_var$finalize_command$finalize_rpath"
8997 # Replace the output file specification.
8998 link_command=`$ECHO "$link_command" | $SED 's%@OUTPUT@%'"$output_objdir/$outputname"'%g'`
9000 # Delete the old output files.
9001 $opt_dry_run || $RM $output $output_objdir/$outputname $output_objdir/lt-$outputname
9003 func_show_eval "$link_command" 'exit $?'
9005 if test -n "$postlink_cmds"; then
9006 func_to_tool_file "$output_objdir/$outputname"
9007 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'`
9008 func_execute_cmds "$postlink_cmds" 'exit $?'
9011 # Now create the wrapper script.
9012 func_verbose "creating $output"
9014 # Quote the relink command for shipping.
9015 if test -n "$relink_command"; then
9016 # Preserve any variables that may affect compiler behavior
9017 for var in $variables_saved_for_relink; do
9018 if eval test -z \"\${$var+set}\"; then
9019 relink_command="{ test -z \"\${$var+set}\" || $lt_unset $var || { $var=; export $var; }; }; $relink_command"
9020 elif eval var_value=\$$var; test -z "$var_value"; then
9021 relink_command="$var=; export $var; $relink_command"
9023 func_quote_for_eval "$var_value"
9024 relink_command="$var=$func_quote_for_eval_result; export $var; $relink_command"
9027 relink_command="(cd `pwd`; $relink_command)"
9028 relink_command=`$ECHO "$relink_command" | $SED "$sed_quote_subst"`
9031 # Only actually do things if not in dry run mode.
9033 # win32 will think the script is a binary if it has
9034 # a .exe suffix, so we strip it off here.
9036 *.exe) func_stripname '' '.exe' "$output"
9037 output=$func_stripname_result ;;
9039 # test for cygwin because mv fails w/o .exe extensions
9043 func_stripname '' '.exe' "$outputname"
9044 outputname=$func_stripname_result ;;
9048 *cygwin* | *mingw* )
9049 func_dirname_and_basename "$output" "" "."
9050 output_name=$func_basename_result
9051 output_path=$func_dirname_result
9052 cwrappersource="$output_path/$objdir/lt-$output_name.c"
9053 cwrapper="$output_path/$output_name.exe"
9054 $RM $cwrappersource $cwrapper
9055 trap "$RM $cwrappersource $cwrapper; exit $EXIT_FAILURE" 1 2 15
9057 func_emit_cwrapperexe_src > $cwrappersource
9059 # The wrapper executable is built using the $host compiler,
9060 # because it contains $host paths and files. If cross-
9061 # compiling, it, like the target executable, must be
9062 # executed on the $host or under an emulation environment.
9064 $LTCC $LTCFLAGS -o $cwrapper $cwrappersource
9068 # Now, create the wrapper script for func_source use:
9069 func_ltwrapper_scriptname $cwrapper
9070 $RM $func_ltwrapper_scriptname_result
9071 trap "$RM $func_ltwrapper_scriptname_result; exit $EXIT_FAILURE" 1 2 15
9073 # note: this script will not be executed, so do not chmod.
9074 if test "x$build" = "x$host" ; then
9075 $cwrapper --lt-dump-script > $func_ltwrapper_scriptname_result
9077 func_emit_wrapper no > $func_ltwrapper_scriptname_result
9083 trap "$RM $output; exit $EXIT_FAILURE" 1 2 15
9085 func_emit_wrapper no > $output
9094 # See if we need to build an old-fashioned archive.
9095 for oldlib in $oldlibs; do
9097 if test "$build_libtool_libs" = convenience; then
9098 oldobjs="$libobjs_save $symfileobj"
9099 addlibs="$convenience"
9100 build_libtool_libs=no
9102 if test "$build_libtool_libs" = module; then
9103 oldobjs="$libobjs_save"
9104 build_libtool_libs=no
9106 oldobjs="$old_deplibs $non_pic_objects"
9107 if test "$preload" = yes && test -f "$symfileobj"; then
9108 func_append oldobjs " $symfileobj"
9111 addlibs="$old_convenience"
9114 if test -n "$addlibs"; then
9115 gentop="$output_objdir/${outputname}x"
9116 func_append generated " $gentop"
9118 func_extract_archives $gentop $addlibs
9119 func_append oldobjs " $func_extract_archives_result"
9122 # Do each command in the archive commands.
9123 if test -n "$old_archive_from_new_cmds" && test "$build_libtool_libs" = yes; then
9124 cmds=$old_archive_from_new_cmds
9127 # Add any objects from preloaded convenience libraries
9128 if test -n "$dlprefiles"; then
9129 gentop="$output_objdir/${outputname}x"
9130 func_append generated " $gentop"
9132 func_extract_archives $gentop $dlprefiles
9133 func_append oldobjs " $func_extract_archives_result"
9136 # POSIX demands no paths to be encoded in archives. We have
9137 # to avoid creating archives with duplicate basenames if we
9138 # might have to extract them afterwards, e.g., when creating a
9139 # static archive out of a convenience library, or when linking
9140 # the entirety of a libtool archive into another (currently
9141 # not supported by libtool).
9142 if (for obj in $oldobjs
9144 func_basename "$obj"
9145 $ECHO "$func_basename_result"
9146 done | sort | sort -uc >/dev/null 2>&1); then
9149 echo "copying selected object files to avoid basename conflicts..."
9150 gentop="$output_objdir/${outputname}x"
9151 func_append generated " $gentop"
9152 func_mkdir_p "$gentop"
9153 save_oldobjs=$oldobjs
9156 for obj in $save_oldobjs
9158 func_basename "$obj"
9159 objbase="$func_basename_result"
9160 case " $oldobjs " in
9161 " ") oldobjs=$obj ;;
9164 # Make sure we don't pick an alternate name that also
9166 newobj=lt$counter-$objbase
9167 func_arith $counter + 1
9168 counter=$func_arith_result
9169 case " $oldobjs " in
9170 *[\ /]"$newobj "*) ;;
9171 *) if test ! -f "$gentop/$newobj"; then break; fi ;;
9174 func_show_eval "ln $obj $gentop/$newobj || cp $obj $gentop/$newobj"
9175 func_append oldobjs " $gentop/$newobj"
9177 *) func_append oldobjs " $obj" ;;
9181 func_to_tool_file "$oldlib" func_convert_file_msys_to_w32
9182 tool_oldlib=$func_to_tool_file_result
9183 eval cmds=\"$old_archive_cmds\"
9186 len=$func_len_result
9187 if test "$len" -lt "$max_cmd_len" || test "$max_cmd_len" -le -1; then
9188 cmds=$old_archive_cmds
9189 elif test -n "$archiver_list_spec"; then
9190 func_verbose "using command file archive linking..."
9193 func_to_tool_file "$obj"
9194 $ECHO "$func_to_tool_file_result"
9195 done > $output_objdir/$libname.libcmd
9196 func_to_tool_file "$output_objdir/$libname.libcmd"
9197 oldobjs=" $archiver_list_spec$func_to_tool_file_result"
9198 cmds=$old_archive_cmds
9200 # the command line is too long to link in one step, link in parts
9201 func_verbose "using piecewise archive linking..."
9206 save_oldobjs=$oldobjs
9208 # Is there a better way of finding the last object in the list?
9209 for obj in $save_oldobjs
9213 eval test_cmds=\"$old_archive_cmds\"
9214 func_len " $test_cmds"
9215 len0=$func_len_result
9217 for obj in $save_oldobjs
9220 func_arith $len + $func_len_result
9221 len=$func_arith_result
9222 func_append objlist " $obj"
9223 if test "$len" -lt "$max_cmd_len"; then
9226 # the above command should be used before it gets too long
9228 if test "$obj" = "$last_oldobj" ; then
9231 test -z "$concat_cmds" || concat_cmds=$concat_cmds~
9232 eval concat_cmds=\"\${concat_cmds}$old_archive_cmds\"
9239 if test "X$oldobjs" = "X" ; then
9240 eval cmds=\"\$concat_cmds\"
9242 eval cmds=\"\$concat_cmds~\$old_archive_cmds\"
9246 func_execute_cmds "$cmds" 'exit $?'
9249 test -n "$generated" && \
9250 func_show_eval "${RM}r$generated"
9252 # Now create the libtool archive.
9256 test "$build_old_libs" = yes && old_library="$libname.$libext"
9257 func_verbose "creating $output"
9259 # Preserve any variables that may affect compiler behavior
9260 for var in $variables_saved_for_relink; do
9261 if eval test -z \"\${$var+set}\"; then
9262 relink_command="{ test -z \"\${$var+set}\" || $lt_unset $var || { $var=; export $var; }; }; $relink_command"
9263 elif eval var_value=\$$var; test -z "$var_value"; then
9264 relink_command="$var=; export $var; $relink_command"
9266 func_quote_for_eval "$var_value"
9267 relink_command="$var=$func_quote_for_eval_result; export $var; $relink_command"
9270 # Quote the link command for shipping.
9271 relink_command="(cd `pwd`; $SHELL $progpath $preserve_args --mode=relink $libtool_args @inst_prefix_dir@)"
9272 relink_command=`$ECHO "$relink_command" | $SED "$sed_quote_subst"`
9273 if test "$hardcode_automatic" = yes ; then
9277 # Only create the output if not a dry run.
9279 for installed in no yes; do
9280 if test "$installed" = yes; then
9281 if test -z "$install_libdir"; then
9284 output="$output_objdir/$outputname"i
9285 # Replace all uninstalled libtool libraries with the installed ones
9287 for deplib in $dependency_libs; do
9290 func_basename "$deplib"
9291 name="$func_basename_result"
9292 func_resolve_sysroot "$deplib"
9293 eval libdir=`${SED} -n -e 's/^libdir=\(.*\)$/\1/p' $func_resolve_sysroot_result`
9294 test -z "$libdir" && \
9295 func_fatal_error "\`$deplib' is not a valid libtool archive"
9296 func_append newdependency_libs " ${lt_sysroot:+=}$libdir/$name"
9299 func_stripname -L '' "$deplib"
9300 func_replace_sysroot "$func_stripname_result"
9301 func_append newdependency_libs " -L$func_replace_sysroot_result"
9304 func_stripname -R '' "$deplib"
9305 func_replace_sysroot "$func_stripname_result"
9306 func_append newdependency_libs " -R$func_replace_sysroot_result"
9308 *) func_append newdependency_libs " $deplib" ;;
9311 dependency_libs="$newdependency_libs"
9314 for lib in $dlfiles; do
9317 func_basename "$lib"
9318 name="$func_basename_result"
9319 eval libdir=`${SED} -n -e 's/^libdir=\(.*\)$/\1/p' $lib`
9320 test -z "$libdir" && \
9321 func_fatal_error "\`$lib' is not a valid libtool archive"
9322 func_append newdlfiles " ${lt_sysroot:+=}$libdir/$name"
9324 *) func_append newdlfiles " $lib" ;;
9327 dlfiles="$newdlfiles"
9329 for lib in $dlprefiles; do
9332 # Only pass preopened files to the pseudo-archive (for
9333 # eventual linking with the app. that links it) if we
9334 # didn't already link the preopened objects directly into
9336 func_basename "$lib"
9337 name="$func_basename_result"
9338 eval libdir=`${SED} -n -e 's/^libdir=\(.*\)$/\1/p' $lib`
9339 test -z "$libdir" && \
9340 func_fatal_error "\`$lib' is not a valid libtool archive"
9341 func_append newdlprefiles " ${lt_sysroot:+=}$libdir/$name"
9345 dlprefiles="$newdlprefiles"
9348 for lib in $dlfiles; do
9350 [\\/]* | [A-Za-z]:[\\/]*) abs="$lib" ;;
9351 *) abs=`pwd`"/$lib" ;;
9353 func_append newdlfiles " $abs"
9355 dlfiles="$newdlfiles"
9357 for lib in $dlprefiles; do
9359 [\\/]* | [A-Za-z]:[\\/]*) abs="$lib" ;;
9360 *) abs=`pwd`"/$lib" ;;
9362 func_append newdlprefiles " $abs"
9364 dlprefiles="$newdlprefiles"
9367 # place dlname in correct position for cygwin
9368 # In fact, it would be nice if we could use this code for all target
9369 # systems that can't hard-code library paths into their executables
9370 # and that have no shared library path variable independent of PATH,
9371 # but it turns out we can't easily determine that from inspecting
9372 # libtool variables, so we have to hard-code the OSs to which it
9373 # applies here; at the moment, that means platforms that use the PE
9374 # object format with DLL files. See the long comment at the top of
9375 # tests/bindir.at for full details.
9377 case $host,$output,$installed,$module,$dlname in
9378 *cygwin*,*lai,yes,no,*.dll | *mingw*,*lai,yes,no,*.dll | *cegcc*,*lai,yes,no,*.dll)
9379 # If a -bindir argument was supplied, place the dll there.
9380 if test "x$bindir" != x ;
9382 func_relative_path "$install_libdir" "$bindir"
9383 tdlname=$func_relative_path_result$dlname
9385 # Otherwise fall back on heuristic.
9386 tdlname=../bin/$dlname
9391 # $outputname - a libtool library file
9392 # Generated by $PROGRAM (GNU $PACKAGE$TIMESTAMP) $VERSION
9394 # Please DO NOT delete this file!
9395 # It is necessary for linking the library.
9397 # The name that we can dlopen(3).
9400 # Names of this library.
9401 library_names='$library_names'
9403 # The name of the static archive.
9404 old_library='$old_library'
9406 # Linker flags that can not go in dependency_libs.
9407 inherited_linker_flags='$new_inherited_linker_flags'
9409 # Libraries that this one depends upon.
9410 dependency_libs='$dependency_libs'
9412 # Names of additional weak libraries provided by this library
9413 weak_library_names='$weak_libs'
9415 # Version information for $libname.
9420 # Is this an already installed library?
9421 installed=$installed
9423 # Should we warn about portability when linking against -modules?
9424 shouldnotlink=$module
9426 # Files to dlopen/dlpreopen
9428 dlpreopen='$dlprefiles'
9430 # Directory that this library needs to be installed in:
9431 libdir='$install_libdir'"
9432 if test "$installed" = no && test "$need_relink" = yes; then
9434 relink_command=\"$relink_command\""
9439 # Do a symbolic link so that the libtool archive can be found in
9440 # LD_LIBRARY_PATH before the program is installed.
9441 func_show_eval '( cd "$output_objdir" && $RM "$outputname" && $LN_S "../$outputname" "$outputname" )' 'exit $?'
9447 { test "$opt_mode" = link || test "$opt_mode" = relink; } &&
9448 func_mode_link ${1+"$@"}
9451 # func_mode_uninstall arg...
9452 func_mode_uninstall ()
9460 # This variable tells wrapper scripts just to set variables rather
9461 # than running their programs.
9462 libtool_install_magic="$magic"
9467 -f) func_append RM " $arg"; rmforce=yes ;;
9468 -*) func_append RM " $arg" ;;
9469 *) func_append files " $arg" ;;
9474 func_fatal_help "you must specify an RM program"
9478 for file in $files; do
9479 func_dirname "$file" "" "."
9480 dir="$func_dirname_result"
9481 if test "X$dir" = X.; then
9486 func_basename "$file"
9487 name="$func_basename_result"
9488 test "$opt_mode" = uninstall && odir="$dir"
9490 # Remember odir for removal later, being careful to avoid duplicates
9491 if test "$opt_mode" = clean; then
9494 *) func_append rmdirs " $odir" ;;
9498 # Don't error if the file doesn't exist and rm -f was used.
9499 if { test -L "$file"; } >/dev/null 2>&1 ||
9500 { test -h "$file"; } >/dev/null 2>&1 ||
9501 test -f "$file"; then
9503 elif test -d "$file"; then
9506 elif test "$rmforce" = yes; then
9514 # Possibly a libtool archive, so verify it.
9515 if func_lalib_p "$file"; then
9516 func_source $dir/$name
9518 # Delete the libtool libraries and symlinks.
9519 for n in $library_names; do
9520 func_append rmfiles " $odir/$n"
9522 test -n "$old_library" && func_append rmfiles " $odir/$old_library"
9526 case " $library_names " in
9528 *) test -n "$dlname" && func_append rmfiles " $odir/$dlname" ;;
9530 test -n "$libdir" && func_append rmfiles " $odir/$name $odir/${name}i"
9533 if test -n "$library_names"; then
9534 # Do each command in the postuninstall commands.
9535 func_execute_cmds "$postuninstall_cmds" 'test "$rmforce" = yes || exit_status=1'
9538 if test -n "$old_library"; then
9539 # Do each command in the old_postuninstall commands.
9540 func_execute_cmds "$old_postuninstall_cmds" 'test "$rmforce" = yes || exit_status=1'
9542 # FIXME: should reinstall the best remaining shared library.
9549 # Possibly a libtool object, so verify it.
9550 if func_lalib_p "$file"; then
9553 func_source $dir/$name
9555 # Add PIC object to the list of files to remove.
9556 if test -n "$pic_object" &&
9557 test "$pic_object" != none; then
9558 func_append rmfiles " $dir/$pic_object"
9561 # Add non-PIC object to the list of files to remove.
9562 if test -n "$non_pic_object" &&
9563 test "$non_pic_object" != none; then
9564 func_append rmfiles " $dir/$non_pic_object"
9570 if test "$opt_mode" = clean ; then
9574 func_stripname '' '.exe' "$file"
9575 file=$func_stripname_result
9576 func_stripname '' '.exe' "$name"
9577 noexename=$func_stripname_result
9578 # $file with .exe has already been added to rmfiles,
9579 # add $file without .exe
9580 func_append rmfiles " $file"
9583 # Do a test to see if this is a libtool program.
9584 if func_ltwrapper_p "$file"; then
9585 if func_ltwrapper_executable_p "$file"; then
9586 func_ltwrapper_scriptname "$file"
9588 func_source $func_ltwrapper_scriptname_result
9589 func_append rmfiles " $func_ltwrapper_scriptname_result"
9592 func_source $dir/$noexename
9595 # note $name still contains .exe if it was in $file originally
9596 # as does the version of $file that was added into $rmfiles
9597 func_append rmfiles " $odir/$name $odir/${name}S.${objext}"
9598 if test "$fast_install" = yes && test -n "$relink_command"; then
9599 func_append rmfiles " $odir/lt-$name"
9601 if test "X$noexename" != "X$name" ; then
9602 func_append rmfiles " $odir/lt-${noexename}.c"
9608 func_show_eval "$RM $rmfiles" 'exit_status=1'
9611 # Try to remove the ${objdir}s in the directories where we deleted files
9612 for dir in $rmdirs; do
9613 if test -d "$dir"; then
9614 func_show_eval "rmdir $dir >/dev/null 2>&1"
9621 { test "$opt_mode" = uninstall || test "$opt_mode" = clean; } &&
9622 func_mode_uninstall ${1+"$@"}
9624 test -z "$opt_mode" && {
9625 help="$generic_help"
9626 func_fatal_help "you must specify a MODE"
9629 test -z "$exec_cmd" && \
9630 func_fatal_help "invalid operation mode \`$opt_mode'"
9632 if test -n "$exec_cmd"; then
9633 eval exec "$exec_cmd"
9640 # The TAGs below are defined such that we never get into a situation
9641 # in which we disable both kinds of libraries. Given conflicting
9642 # choices, we go for a static library, that is the most portable,
9643 # since we can't tell whether shared libraries were disabled because
9644 # the user asked for that or because the platform doesn't support
9645 # them. This is particularly important on AIX, because we don't
9646 # support having both static and shared libraries enabled at the same
9647 # time on that platform, so we default to a shared-only configuration.
9648 # If a disable-shared tag is given, we'll fallback to a static-only
9649 # configuration. But we'll never go from static-only to shared-only.
9651 # ### BEGIN LIBTOOL TAG CONFIG: disable-shared
9652 build_libtool_libs=no
9654 # ### END LIBTOOL TAG CONFIG: disable-shared
9656 # ### BEGIN LIBTOOL TAG CONFIG: disable-static
9657 build_old_libs=`case $build_libtool_libs in yes) echo no;; *) echo yes;; esac`
9658 # ### END LIBTOOL TAG CONFIG: disable-static