2 # libtool (GNU libtool) 2.4
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 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 # --tag=TAG use configuration variables from tag TAG
45 # -v, --verbose print more informational messages than default
46 # --no-verbose don't print the extra informational messages
47 # --version print version information
48 # -h, --help, --help-all print short, long, or detailed help message
50 # MODE must be one of the following:
52 # clean remove files from the build directory
53 # compile compile a source file into a libtool object
54 # execute automatically set library path, then run a program
55 # finish complete the installation of libtool libraries
56 # install install libraries or executables
57 # link create a library or an executable
58 # uninstall remove libraries from an installed directory
60 # MODE-ARGS vary depending on the MODE. When passed as first option,
61 # `--mode=MODE' may be abbreviated as `MODE' or a unique abbreviation of that.
62 # Try `$progname --help --mode=MODE' for a more detailed description of MODE.
64 # When reporting a bug, please describe a test case to reproduce it and
65 # include the following information:
70 # compiler flags: $LTCFLAGS
71 # linker: $LD (gnu? $with_gnu_ld)
72 # $progname: (GNU libtool) 2.4
73 # automake: $automake_version
74 # autoconf: $autoconf_version
76 # Report bugs to <bug-libtool@gnu.org>.
77 # GNU libtool home page: <http://www.gnu.org/software/libtool/>.
78 # General help using GNU software: <http://www.gnu.org/gethelp/>.
84 package_revision=1.3293
86 # Be Bourne compatible
87 if test -n "${ZSH_VERSION+set}" && (emulate sh) >/dev/null 2>&1; then
90 # Zsh 3.x and 4.x performs word splitting on ${1+"$@"}, which
91 # is contrary to our usage. Disable this feature.
92 alias -g '${1+"$@"}'='"$@"'
95 case `(set -o) 2>/dev/null` in *posix*) set -o posix;; esac
97 BIN_SH=xpg4; export BIN_SH # for Tru64
98 DUALCASE=1; export DUALCASE # for MKS sh
100 # A function that is used when there is no print builtin or printf.
101 func_fallback_echo ()
103 eval 'cat <<_LTECHO_EOF
108 # NLS nuisances: We save the old values to restore during execute mode.
111 for lt_var in LANG LANGUAGE LC_ALL LC_CTYPE LC_COLLATE LC_MESSAGES
113 eval "if test \"\${$lt_var+set}\" = set; then
114 save_$lt_var=\$$lt_var
117 lt_user_locale=\"$lt_var=\\\$save_\$lt_var; \$lt_user_locale\"
118 lt_safe_locale=\"$lt_var=C; \$lt_safe_locale\"
123 export LANGUAGE LC_ALL
128 # Work around backward compatibility issue on IRIX 6.5. On IRIX 6.4+, sh
129 # is ksh but when the shell is invoked as "sh" and the current value of
130 # the _XPG environment variable is not equal to 1 (one), the special
131 # positional parameter $0, within a function call, is the name of the
138 test "${ECHO+set}" = set || ECHO=${as_echo-'printf %s\n'}
148 : ${SHELL="${CONFIG_SHELL-/bin/sh}"}
149 : ${Xsed="$SED -e 1s/^X//"}
154 EXIT_MISMATCH=63 # $? = 63 is used to indicate version mismatch to missing.
155 EXIT_SKIP=77 # $? = 77 is used to indicate a skipped test to automake.
157 exit_status=$EXIT_SUCCESS
159 # Make sure IFS has a sensible default
164 dirname="s,/[^/]*$,,"
167 # func_dirname file append nondir_replacement
168 # Compute the dirname of FILE. If nonempty, add APPEND to the result,
169 # otherwise set result to NONDIR_REPLACEMENT.
172 func_dirname_result=`$ECHO "${1}" | $SED "$dirname"`
173 if test "X$func_dirname_result" = "X${1}"; then
174 func_dirname_result="${3}"
176 func_dirname_result="$func_dirname_result${2}"
178 } # func_dirname may be replaced by extended shell implementation
184 func_basename_result=`$ECHO "${1}" | $SED "$basename"`
185 } # func_basename may be replaced by extended shell implementation
188 # func_dirname_and_basename file append nondir_replacement
189 # perform func_basename and func_dirname in a single function
191 # dirname: Compute the dirname of FILE. If nonempty,
192 # add APPEND to the result, otherwise set result
193 # to NONDIR_REPLACEMENT.
194 # value returned in "$func_dirname_result"
195 # basename: Compute filename of FILE.
196 # value retuned in "$func_basename_result"
197 # Implementation must be kept synchronized with func_dirname
198 # and func_basename. For efficiency, we do not delegate to
199 # those functions but instead duplicate the functionality here.
200 func_dirname_and_basename ()
202 # Extract subdirectory from the argument.
203 func_dirname_result=`$ECHO "${1}" | $SED -e "$dirname"`
204 if test "X$func_dirname_result" = "X${1}"; then
205 func_dirname_result="${3}"
207 func_dirname_result="$func_dirname_result${2}"
209 func_basename_result=`$ECHO "${1}" | $SED -e "$basename"`
210 } # func_dirname_and_basename may be replaced by extended shell implementation
213 # func_stripname prefix suffix name
214 # strip PREFIX and SUFFIX off of NAME.
215 # PREFIX and SUFFIX must not contain globbing or regex special
216 # characters, hashes, percent signs, but SUFFIX may contain a leading
217 # dot (in which case that matches only a dot).
218 # func_strip_suffix prefix name
222 .*) func_stripname_result=`$ECHO "${3}" | $SED "s%^${1}%%; s%\\\\${2}\$%%"`;;
223 *) func_stripname_result=`$ECHO "${3}" | $SED "s%^${1}%%; s%${2}\$%%"`;;
225 } # func_stripname may be replaced by extended shell implementation
228 # These SED scripts presuppose an absolute path with a trailing slash.
229 pathcar='s,^/\([^/]*\).*$,\1,'
230 pathcdr='s,^/[^/]*,,'
231 removedotparts=':dotsl
235 collapseslashes='s@/\{1,\}@/@g'
236 finalslash='s,/*$,/,'
238 # func_normal_abspath PATH
239 # Remove doubled-up and trailing slashes, "." path components,
240 # and cancel out any ".." path components in PATH after making
241 # it an absolute path.
242 # value returned in "$func_normal_abspath_result"
243 func_normal_abspath ()
245 # Start from root dir and reassemble the path.
246 func_normal_abspath_result=
247 func_normal_abspath_tpath=$1
248 func_normal_abspath_altnamespace=
249 case $func_normal_abspath_tpath in
251 # Empty path, that just means $cwd.
252 func_stripname '' '/' "`pwd`"
253 func_normal_abspath_result=$func_stripname_result
256 # The next three entries are used to spot a run of precisely
257 # two leading slashes without using negated character classes;
258 # we take advantage of case's first-match behaviour.
260 # Unusual form of absolute path, do nothing.
263 # Not necessarily an ordinary path; POSIX reserves leading '//'
264 # and for example Cygwin uses it to access remote file shares
265 # over CIFS/SMB, so we conserve a leading double slash if found.
266 func_normal_abspath_altnamespace=/
269 # Absolute path, do nothing.
272 # Relative path, prepend $cwd.
273 func_normal_abspath_tpath=`pwd`/$func_normal_abspath_tpath
276 # Cancel out all the simple stuff to save iterations. We also want
277 # the path to end with a slash for ease of parsing, so make sure
278 # there is one (and only one) here.
279 func_normal_abspath_tpath=`$ECHO "$func_normal_abspath_tpath" | $SED \
280 -e "$removedotparts" -e "$collapseslashes" -e "$finalslash"`
282 # Processed it all yet?
283 if test "$func_normal_abspath_tpath" = / ; then
284 # If we ascended to the root using ".." the result may be empty now.
285 if test -z "$func_normal_abspath_result" ; then
286 func_normal_abspath_result=/
290 func_normal_abspath_tcomponent=`$ECHO "$func_normal_abspath_tpath" | $SED \
292 func_normal_abspath_tpath=`$ECHO "$func_normal_abspath_tpath" | $SED \
294 # Figure out what to do with it
295 case $func_normal_abspath_tcomponent in
297 # Trailing empty path component, ignore it.
300 # Parent dir; strip last assembled component from result.
301 func_dirname "$func_normal_abspath_result"
302 func_normal_abspath_result=$func_dirname_result
305 # Actual path component, append it.
306 func_normal_abspath_result=$func_normal_abspath_result/$func_normal_abspath_tcomponent
310 # Restore leading double-slash if one was found on entry.
311 func_normal_abspath_result=$func_normal_abspath_altnamespace$func_normal_abspath_result
314 # func_relative_path SRCDIR DSTDIR
315 # generates a relative path from SRCDIR to DSTDIR, with a trailing
316 # slash if non-empty, suitable for immediately appending a filename
317 # without needing to append a separator.
318 # value returned in "$func_relative_path_result"
319 func_relative_path ()
321 func_relative_path_result=
322 func_normal_abspath "$1"
323 func_relative_path_tlibdir=$func_normal_abspath_result
324 func_normal_abspath "$2"
325 func_relative_path_tbindir=$func_normal_abspath_result
327 # Ascend the tree starting from libdir
329 # check if we have found a prefix of bindir
330 case $func_relative_path_tbindir in
331 $func_relative_path_tlibdir)
332 # found an exact match
333 func_relative_path_tcancelled=
336 $func_relative_path_tlibdir*)
337 # found a matching prefix
338 func_stripname "$func_relative_path_tlibdir" '' "$func_relative_path_tbindir"
339 func_relative_path_tcancelled=$func_stripname_result
340 if test -z "$func_relative_path_result"; then
341 func_relative_path_result=.
346 func_dirname $func_relative_path_tlibdir
347 func_relative_path_tlibdir=${func_dirname_result}
348 if test "x$func_relative_path_tlibdir" = x ; then
349 # Have to descend all the way to the root!
350 func_relative_path_result=../$func_relative_path_result
351 func_relative_path_tcancelled=$func_relative_path_tbindir
354 func_relative_path_result=../$func_relative_path_result
359 # Now calculate path; take care to avoid doubling-up slashes.
360 func_stripname '' '/' "$func_relative_path_result"
361 func_relative_path_result=$func_stripname_result
362 func_stripname '/' '/' "$func_relative_path_tcancelled"
363 if test "x$func_stripname_result" != x ; then
364 func_relative_path_result=${func_relative_path_result}/${func_stripname_result}
367 # Normalisation. If bindir is libdir, return empty string,
368 # else relative path ending with a slash; either way, target
369 # file name can be directly appended.
370 if test ! -z "$func_relative_path_result"; then
371 func_stripname './' '' "$func_relative_path_result/"
372 func_relative_path_result=$func_stripname_result
376 # The name of this program:
377 func_dirname_and_basename "$progpath"
378 progname=$func_basename_result
380 # Make sure we have an absolute path for reexecution:
382 [\\/]*|[A-Za-z]:\\*) ;;
384 progdir=$func_dirname_result
385 progdir=`cd "$progdir" && pwd`
386 progpath="$progdir/$progname"
391 for progdir in $PATH; do
393 test -x "$progdir/$progname" && break
396 test -n "$progdir" || progdir=`pwd`
397 progpath="$progdir/$progname"
401 # Sed substitution that helps us do robust quoting. It backslashifies
402 # metacharacters that are still active within double-quoted strings.
403 Xsed="${SED}"' -e 1s/^X//'
404 sed_quote_subst='s/\([`"$\\]\)/\\\1/g'
406 # Same as above, but do not quote variable references.
407 double_quote_subst='s/\(["`\\]\)/\\\1/g'
409 # Sed substitution that turns a string into a regex matching for the
411 sed_make_literal_regex='s,[].[^$\\*\/],\\&,g'
413 # Sed substitution that converts a w32 file name or path
414 # which contains forward slashes, into one that contains
415 # (escaped) backslashes. A very naive implementation.
416 lt_sed_naive_backslashify='s|\\\\*|\\|g;s|/|\\|g;s|\\|\\\\|g'
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 --version) 2>/dev/null |$SED 1q`"'/
775 s/\$autoconf_version/'"`(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
1060 # Parse options once, thoroughly. This comes as soon as possible in the
1061 # script to make things like `--version' happen as quickly as we can.
1063 # this just eases exit handling
1064 while test $# -gt 0; do
1068 --debug|-x) opt_debug='set -x'
1069 func_echo "enabling shell trace mode"
1072 --dry-run|--dryrun|-n)
1081 opt_dlopen="${opt_dlopen+$opt_dlopen
1085 --preserve-dup-deps)
1086 opt_preserve_dup_deps=:
1094 set dummy --mode finish ${1+"$@"}; shift
1101 opt_help=': help-all'
1104 test $# = 0 && func_missing_arg $opt && break
1108 # Valid mode arguments:
1109 clean|compile|execute|finish|install|link|relink|uninstall) ;;
1111 # Catch anything else as an error
1112 *) func_error "invalid argument for $opt"
1119 --no-silent|--no-quiet)
1121 func_append preserve_args " $opt"
1125 func_append preserve_args " $opt"
1129 func_append preserve_args " $opt"
1134 func_append preserve_args " $opt"
1138 test $# = 0 && func_missing_arg $opt && break
1141 func_append preserve_args " $opt $optarg"
1142 func_enable_tag "$optarg"
1146 -\?|-h) func_usage ;;
1147 --help) func_help ;;
1148 --version) func_version ;;
1150 # Separate optargs to long options:
1152 func_split_long_opt "$opt"
1153 set dummy "$func_split_long_opt_name" "$func_split_long_opt_arg" ${1+"$@"}
1157 # Separate non-argument short options:
1159 func_split_short_opt "$opt"
1160 set dummy "$func_split_short_opt_name" "-$func_split_short_opt_arg" ${1+"$@"}
1165 -*) func_fatal_help "unrecognized option \`$opt'" ;;
1166 *) set dummy "$opt" ${1+"$@"}; shift; break ;;
1172 # save first non-option argument
1173 if test "$#" -gt 0; then
1179 test "$opt_debug" = : || func_append preserve_args " --debug"
1182 *cygwin* | *mingw* | *pw32* | *cegcc*)
1183 # don't eliminate duplications in $postdeps and $predeps
1184 opt_duplicate_compiler_generated_deps=:
1187 opt_duplicate_compiler_generated_deps=$opt_preserve_dup_deps
1192 # Sanity checks first:
1193 func_check_version_match
1195 if test "$build_libtool_libs" != yes && test "$build_old_libs" != yes; then
1196 func_fatal_configuration "not configured to build any kind of library"
1200 eval std_shrext=\"$shrext_cmds\"
1202 # Only execute mode is allowed to have -dlopen flags.
1203 if test -n "$opt_dlopen" && test "$opt_mode" != execute; then
1204 func_error "unrecognized option \`-dlopen'"
1209 # Change the help message to a mode-specific one.
1210 generic_help="$help"
1211 help="Try \`$progname --help --mode=$opt_mode' for more information."
1215 # Bail if the options were screwed
1216 $exit_cmd $EXIT_FAILURE
1227 # True iff FILE is a libtool `.la' library or `.lo' object file.
1228 # This function is only a basic sanity check; it will hardly flush out
1229 # determined imposters.
1233 $SED -e 4q "$1" 2>/dev/null \
1234 | $GREP "^# Generated by .*$PACKAGE" > /dev/null 2>&1
1237 # func_lalib_unsafe_p file
1238 # True iff FILE is a libtool `.la' library or `.lo' object file.
1239 # This function implements the same check as func_lalib_p without
1240 # resorting to external programs. To this end, it redirects stdin and
1241 # closes it afterwards, without saving the original file descriptor.
1242 # As a safety measure, use it only where a negative result would be
1243 # fatal anyway. Works if `file' does not exist.
1244 func_lalib_unsafe_p ()
1247 if test -f "$1" && test -r "$1" && exec 5<&0 <"$1"; then
1248 for lalib_p_l in 1 2 3 4
1251 case "$lalib_p_line" in
1252 \#\ Generated\ by\ *$PACKAGE* ) lalib_p=yes; break;;
1257 test "$lalib_p" = yes
1260 # func_ltwrapper_script_p file
1261 # True iff FILE is a libtool wrapper script
1262 # This function is only a basic sanity check; it will hardly flush out
1263 # determined imposters.
1264 func_ltwrapper_script_p ()
1269 # func_ltwrapper_executable_p file
1270 # True iff FILE is a libtool wrapper executable
1271 # This function is only a basic sanity check; it will hardly flush out
1272 # determined imposters.
1273 func_ltwrapper_executable_p ()
1275 func_ltwrapper_exec_suffix=
1278 *) func_ltwrapper_exec_suffix=.exe ;;
1280 $GREP "$magic_exe" "$1$func_ltwrapper_exec_suffix" >/dev/null 2>&1
1283 # func_ltwrapper_scriptname file
1284 # Assumes file is an ltwrapper_executable
1285 # uses $file to determine the appropriate filename for a
1286 # temporary ltwrapper_script.
1287 func_ltwrapper_scriptname ()
1289 func_dirname_and_basename "$1" "" "."
1290 func_stripname '' '.exe' "$func_basename_result"
1291 func_ltwrapper_scriptname_result="$func_dirname_result/$objdir/${func_stripname_result}_ltshwrapper"
1294 # func_ltwrapper_p file
1295 # True iff FILE is a libtool wrapper script or wrapper executable
1296 # This function is only a basic sanity check; it will hardly flush out
1297 # determined imposters.
1300 func_ltwrapper_script_p "$1" || func_ltwrapper_executable_p "$1"
1304 # func_execute_cmds commands fail_cmd
1305 # Execute tilde-delimited COMMANDS.
1306 # If FAIL_CMD is given, eval that upon failure.
1307 # FAIL_CMD may read-access the current command in variable CMD!
1308 func_execute_cmds ()
1311 save_ifs=$IFS; IFS='~'
1315 func_show_eval "$cmd" "${2-:}"
1322 # Source FILE, adding directory component if necessary.
1323 # Note that it is not necessary on cygwin/mingw to append a dot to
1324 # FILE even if both FILE and FILE.exe exist: automatic-append-.exe
1325 # behavior happens only for exec(3), not for open(2)! Also, sourcing
1326 # `FILE.' does not work on cygwin managed mounts.
1331 */* | *\\*) . "$1" ;;
1337 # func_resolve_sysroot PATH
1338 # Replace a leading = in PATH with a sysroot. Store the result into
1339 # func_resolve_sysroot_result
1340 func_resolve_sysroot ()
1342 func_resolve_sysroot_result=$1
1343 case $func_resolve_sysroot_result in
1345 func_stripname '=' '' "$func_resolve_sysroot_result"
1346 func_resolve_sysroot_result=$lt_sysroot$func_stripname_result
1351 # func_replace_sysroot PATH
1352 # If PATH begins with the sysroot, replace it with = and
1353 # store the result into func_replace_sysroot_result.
1354 func_replace_sysroot ()
1356 case "$lt_sysroot:$1" in
1358 func_stripname "$lt_sysroot" '' "$1"
1359 func_replace_sysroot_result="=$func_stripname_result"
1362 # Including no sysroot.
1363 func_replace_sysroot_result=$1
1368 # func_infer_tag arg
1369 # Infer tagged configuration to use if any are available and
1370 # if one wasn't chosen via the "--tag" command line option.
1371 # Only attempt this if the compiler in the base compile
1372 # command doesn't match the default compiler.
1373 # arg is usually of the form 'gcc ...'
1378 # FreeBSD-specific: where we install compilers with non-standard names
1379 tag_compilers_CC="*cc cc* *gcc gcc* clang"
1380 tag_compilers_CXX="*c++ c++* *g++ g++* clang++"
1381 base_compiler=`set -- "$@"; echo $1`
1383 # If $tagname isn't set, then try to infer if the default "CC" tag applies
1384 if test -z "$tagname"; then
1385 for zp in $tag_compilers_CC; do
1386 case $base_compiler in
1387 $zp) tagname="CC"; break;;
1392 if test -n "$available_tags" && test -z "$tagname"; then
1395 func_append_quoted CC_quoted "$arg"
1397 CC_expanded=`func_echo_all $CC`
1398 CC_quoted_expanded=`func_echo_all $CC_quoted`
1400 # Blanks in the command may have been stripped by the calling shell,
1401 # but not from the CC environment variable when configure was run.
1402 " $CC "* | "$CC "* | " $CC_expanded "* | "$CC_expanded "* | \
1403 " $CC_quoted"* | "$CC_quoted "* | " $CC_quoted_expanded "* | "$CC_quoted_expanded "*) ;;
1404 # Blanks at the start of $base_compile will cause this to fail
1405 # if we don't check for them as well.
1407 for z in $available_tags; do
1408 if $GREP "^# ### BEGIN LIBTOOL TAG CONFIG: $z$" < "$progpath" > /dev/null; then
1409 # Evaluate the configuration.
1410 eval "`${SED} -n -e '/^# ### BEGIN LIBTOOL TAG CONFIG: '$z'$/,/^# ### END LIBTOOL TAG CONFIG: '$z'$/p' < $progpath`"
1413 # Double-quote args containing other shell metacharacters.
1414 func_append_quoted CC_quoted "$arg"
1416 CC_expanded=`func_echo_all $CC`
1417 CC_quoted_expanded=`func_echo_all $CC_quoted`
1419 " $CC "* | "$CC "* | " $CC_expanded "* | "$CC_expanded "* | \
1420 " $CC_quoted"* | "$CC_quoted "* | " $CC_quoted_expanded "* | "$CC_quoted_expanded "*)
1421 # The compiler in the base compile command matches
1422 # the one in the tagged configuration.
1423 # Assume this is the tagged configuration we want.
1429 # FreeBSD-specific: try compilers based on inferred tag
1430 if test -z "$tagname"; then
1431 eval "tag_compilers=\$tag_compilers_${z}"
1432 if test -n "$tag_compilers"; then
1433 for zp in $tag_compilers; do
1434 case $base_compiler in
1435 $zp) tagname=$z; break;;
1438 if test -n "$tagname"; then
1445 # If $tagname still isn't set, then no tagged configuration
1446 # was found and let the user know that the "--tag" command
1447 # line option must be used.
1448 if test -z "$tagname"; then
1449 func_echo "unable to infer tagged configuration"
1450 func_fatal_error "specify a tag with \`--tag'"
1452 # func_verbose "using $tagname tagged configuration"
1461 # func_write_libtool_object output_name pic_name nonpic_name
1462 # Create a libtool object file (analogous to a ".la" file),
1463 # but don't create it if we're doing a dry run.
1464 func_write_libtool_object ()
1467 if test "$build_libtool_libs" = yes; then
1473 if test "$build_old_libs" = yes; then
1474 write_oldobj=\'${3}\'
1480 cat >${write_libobj}T <<EOF
1481 # $write_libobj - a libtool object file
1482 # Generated by $PROGRAM (GNU $PACKAGE$TIMESTAMP) $VERSION
1484 # Please DO NOT delete this file!
1485 # It is necessary for linking the library.
1487 # Name of the PIC object.
1488 pic_object=$write_lobj
1490 # Name of the non-PIC object
1491 non_pic_object=$write_oldobj
1494 $MV "${write_libobj}T" "${write_libobj}"
1499 ##################################################
1500 # FILE NAME AND PATH CONVERSION HELPER FUNCTIONS #
1501 ##################################################
1503 # func_convert_core_file_wine_to_w32 ARG
1504 # Helper function used by file name conversion functions when $build is *nix,
1505 # and $host is mingw, cygwin, or some other w32 environment. Relies on a
1506 # correctly configured wine environment available, with the winepath program
1507 # in $build's $PATH.
1509 # ARG is the $build file name to be converted to w32 format.
1510 # Result is available in $func_convert_core_file_wine_to_w32_result, and will
1511 # be empty on error (or when ARG is empty)
1512 func_convert_core_file_wine_to_w32 ()
1515 func_convert_core_file_wine_to_w32_result="$1"
1516 if test -n "$1"; then
1517 # Unfortunately, winepath does not exit with a non-zero error code, so we
1518 # are forced to check the contents of stdout. On the other hand, if the
1519 # command is not found, the shell will set an exit code of 127 and print
1520 # *an error message* to stdout. So we must check for both error code of
1521 # zero AND non-empty stdout, which explains the odd construction:
1522 func_convert_core_file_wine_to_w32_tmp=`winepath -w "$1" 2>/dev/null`
1523 if test "$?" -eq 0 && test -n "${func_convert_core_file_wine_to_w32_tmp}"; then
1524 func_convert_core_file_wine_to_w32_result=`$ECHO "$func_convert_core_file_wine_to_w32_tmp" |
1525 $SED -e "$lt_sed_naive_backslashify"`
1527 func_convert_core_file_wine_to_w32_result=
1531 # end: func_convert_core_file_wine_to_w32
1534 # func_convert_core_path_wine_to_w32 ARG
1535 # Helper function used by path conversion functions when $build is *nix, and
1536 # $host is mingw, cygwin, or some other w32 environment. Relies on a correctly
1537 # configured wine environment available, with the winepath program in $build's
1538 # $PATH. Assumes ARG has no leading or trailing path separator characters.
1540 # ARG is path to be converted from $build format to win32.
1541 # Result is available in $func_convert_core_path_wine_to_w32_result.
1542 # Unconvertible file (directory) names in ARG are skipped; if no directory names
1543 # are convertible, then the result may be empty.
1544 func_convert_core_path_wine_to_w32 ()
1547 # unfortunately, winepath doesn't convert paths, only file names
1548 func_convert_core_path_wine_to_w32_result=""
1549 if test -n "$1"; then
1552 for func_convert_core_path_wine_to_w32_f in $1; do
1554 func_convert_core_file_wine_to_w32 "$func_convert_core_path_wine_to_w32_f"
1555 if test -n "$func_convert_core_file_wine_to_w32_result" ; then
1556 if test -z "$func_convert_core_path_wine_to_w32_result"; then
1557 func_convert_core_path_wine_to_w32_result="$func_convert_core_file_wine_to_w32_result"
1559 func_append func_convert_core_path_wine_to_w32_result ";$func_convert_core_file_wine_to_w32_result"
1566 # end: func_convert_core_path_wine_to_w32
1569 # func_cygpath ARGS...
1570 # Wrapper around calling the cygpath program via LT_CYGPATH. This is used when
1571 # when (1) $build is *nix and Cygwin is hosted via a wine environment; or (2)
1572 # $build is MSYS and $host is Cygwin, or (3) $build is Cygwin. In case (1) or
1573 # (2), returns the Cygwin file name or path in func_cygpath_result (input
1574 # file name or path is assumed to be in w32 format, as previously converted
1575 # from $build's *nix or MSYS format). In case (3), returns the w32 file name
1576 # or path in func_cygpath_result (input file name or path is assumed to be in
1577 # Cygwin format). Returns an empty string on error.
1579 # ARGS are passed to cygpath, with the last one being the file name or path to
1582 # Specify the absolute *nix (or w32) name to cygpath in the LT_CYGPATH
1583 # environment variable; do not put it in $PATH.
1587 if test -n "$LT_CYGPATH" && test -f "$LT_CYGPATH"; then
1588 func_cygpath_result=`$LT_CYGPATH "$@" 2>/dev/null`
1589 if test "$?" -ne 0; then
1590 # on failure, ensure result is empty
1591 func_cygpath_result=
1594 func_cygpath_result=
1595 func_error "LT_CYGPATH is empty or specifies non-existent file: \`$LT_CYGPATH'"
1601 # func_convert_core_msys_to_w32 ARG
1602 # Convert file name or path ARG from MSYS format to w32 format. Return
1603 # result in func_convert_core_msys_to_w32_result.
1604 func_convert_core_msys_to_w32 ()
1607 # awkward: cmd appends spaces to result
1608 func_convert_core_msys_to_w32_result=`( cmd //c echo "$1" ) 2>/dev/null |
1609 $SED -e 's/[ ]*$//' -e "$lt_sed_naive_backslashify"`
1611 #end: func_convert_core_msys_to_w32
1614 # func_convert_file_check ARG1 ARG2
1615 # Verify that ARG1 (a file name in $build format) was converted to $host
1616 # format in ARG2. Otherwise, emit an error message, but continue (resetting
1617 # func_to_host_file_result to ARG1).
1618 func_convert_file_check ()
1621 if test -z "$2" && test -n "$1" ; then
1622 func_error "Could not determine host file name corresponding to"
1624 func_error "Continuing, but uninstalled executables may not work."
1626 func_to_host_file_result="$1"
1629 # end func_convert_file_check
1632 # func_convert_path_check FROM_PATHSEP TO_PATHSEP FROM_PATH TO_PATH
1633 # Verify that FROM_PATH (a path in $build format) was converted to $host
1634 # format in TO_PATH. Otherwise, emit an error message, but continue, resetting
1635 # func_to_host_file_result to a simplistic fallback value (see below).
1636 func_convert_path_check ()
1639 if test -z "$4" && test -n "$3"; then
1640 func_error "Could not determine the host path corresponding to"
1642 func_error "Continuing, but uninstalled executables may not work."
1643 # Fallback. This is a deliberately simplistic "conversion" and
1644 # should not be "improved". See libtool.info.
1645 if test "x$1" != "x$2"; then
1646 lt_replace_pathsep_chars="s|$1|$2|g"
1647 func_to_host_path_result=`echo "$3" |
1648 $SED -e "$lt_replace_pathsep_chars"`
1650 func_to_host_path_result="$3"
1654 # end func_convert_path_check
1657 # func_convert_path_front_back_pathsep FRONTPAT BACKPAT REPL ORIG
1658 # Modifies func_to_host_path_result by prepending REPL if ORIG matches FRONTPAT
1659 # and appending REPL if ORIG matches BACKPAT.
1660 func_convert_path_front_back_pathsep ()
1664 $1 ) func_to_host_path_result="$3$func_to_host_path_result"
1668 $2 ) func_append func_to_host_path_result "$3"
1672 # end func_convert_path_front_back_pathsep
1675 ##################################################
1676 # $build to $host FILE NAME CONVERSION FUNCTIONS #
1677 ##################################################
1678 # invoked via `$to_host_file_cmd ARG'
1680 # In each case, ARG is the path to be converted from $build to $host format.
1681 # Result will be available in $func_to_host_file_result.
1684 # func_to_host_file ARG
1685 # Converts the file name ARG from $build format to $host format. Return result
1686 # in func_to_host_file_result.
1687 func_to_host_file ()
1690 $to_host_file_cmd "$1"
1692 # end func_to_host_file
1695 # func_to_tool_file ARG LAZY
1696 # converts the file name ARG from $build format to toolchain format. Return
1697 # result in func_to_tool_file_result. If the conversion in use is listed
1698 # in (the comma separated) LAZY, no conversion takes place.
1699 func_to_tool_file ()
1703 *,"$to_tool_file_cmd",*)
1704 func_to_tool_file_result=$1
1707 $to_tool_file_cmd "$1"
1708 func_to_tool_file_result=$func_to_host_file_result
1712 # end func_to_tool_file
1715 # func_convert_file_noop ARG
1716 # Copy ARG to func_to_host_file_result.
1717 func_convert_file_noop ()
1719 func_to_host_file_result="$1"
1721 # end func_convert_file_noop
1724 # func_convert_file_msys_to_w32 ARG
1725 # Convert file name ARG from (mingw) MSYS to (mingw) w32 format; automatic
1726 # conversion to w32 is not available inside the cwrapper. Returns result in
1727 # func_to_host_file_result.
1728 func_convert_file_msys_to_w32 ()
1731 func_to_host_file_result="$1"
1732 if test -n "$1"; then
1733 func_convert_core_msys_to_w32 "$1"
1734 func_to_host_file_result="$func_convert_core_msys_to_w32_result"
1736 func_convert_file_check "$1" "$func_to_host_file_result"
1738 # end func_convert_file_msys_to_w32
1741 # func_convert_file_cygwin_to_w32 ARG
1742 # Convert file name ARG from Cygwin to w32 format. Returns result in
1743 # func_to_host_file_result.
1744 func_convert_file_cygwin_to_w32 ()
1747 func_to_host_file_result="$1"
1748 if test -n "$1"; then
1749 # because $build is cygwin, we call "the" cygpath in $PATH; no need to use
1750 # LT_CYGPATH in this case.
1751 func_to_host_file_result=`cygpath -m "$1"`
1753 func_convert_file_check "$1" "$func_to_host_file_result"
1755 # end func_convert_file_cygwin_to_w32
1758 # func_convert_file_nix_to_w32 ARG
1759 # Convert file name ARG from *nix to w32 format. Requires a wine environment
1760 # and a working winepath. Returns result in func_to_host_file_result.
1761 func_convert_file_nix_to_w32 ()
1764 func_to_host_file_result="$1"
1765 if test -n "$1"; then
1766 func_convert_core_file_wine_to_w32 "$1"
1767 func_to_host_file_result="$func_convert_core_file_wine_to_w32_result"
1769 func_convert_file_check "$1" "$func_to_host_file_result"
1771 # end func_convert_file_nix_to_w32
1774 # func_convert_file_msys_to_cygwin ARG
1775 # Convert file name ARG from MSYS to Cygwin format. Requires LT_CYGPATH set.
1776 # Returns result in func_to_host_file_result.
1777 func_convert_file_msys_to_cygwin ()
1780 func_to_host_file_result="$1"
1781 if test -n "$1"; then
1782 func_convert_core_msys_to_w32 "$1"
1783 func_cygpath -u "$func_convert_core_msys_to_w32_result"
1784 func_to_host_file_result="$func_cygpath_result"
1786 func_convert_file_check "$1" "$func_to_host_file_result"
1788 # end func_convert_file_msys_to_cygwin
1791 # func_convert_file_nix_to_cygwin ARG
1792 # Convert file name ARG from *nix to Cygwin format. Requires Cygwin installed
1793 # in a wine environment, working winepath, and LT_CYGPATH set. Returns result
1794 # in func_to_host_file_result.
1795 func_convert_file_nix_to_cygwin ()
1798 func_to_host_file_result="$1"
1799 if test -n "$1"; then
1800 # convert from *nix to w32, then use cygpath to convert from w32 to cygwin.
1801 func_convert_core_file_wine_to_w32 "$1"
1802 func_cygpath -u "$func_convert_core_file_wine_to_w32_result"
1803 func_to_host_file_result="$func_cygpath_result"
1805 func_convert_file_check "$1" "$func_to_host_file_result"
1807 # end func_convert_file_nix_to_cygwin
1810 #############################################
1811 # $build to $host PATH CONVERSION FUNCTIONS #
1812 #############################################
1813 # invoked via `$to_host_path_cmd ARG'
1815 # In each case, ARG is the path to be converted from $build to $host format.
1816 # The result will be available in $func_to_host_path_result.
1818 # Path separators are also converted from $build format to $host format. If
1819 # ARG begins or ends with a path separator character, it is preserved (but
1820 # converted to $host format) on output.
1822 # All path conversion functions are named using the following convention:
1823 # file name conversion function : func_convert_file_X_to_Y ()
1824 # path conversion function : func_convert_path_X_to_Y ()
1825 # where, for any given $build/$host combination the 'X_to_Y' value is the
1826 # same. If conversion functions are added for new $build/$host combinations,
1827 # the two new functions must follow this pattern, or func_init_to_host_path_cmd
1831 # func_init_to_host_path_cmd
1832 # Ensures that function "pointer" variable $to_host_path_cmd is set to the
1833 # appropriate value, based on the value of $to_host_file_cmd.
1835 func_init_to_host_path_cmd ()
1838 if test -z "$to_host_path_cmd"; then
1839 func_stripname 'func_convert_file_' '' "$to_host_file_cmd"
1840 to_host_path_cmd="func_convert_path_${func_stripname_result}"
1845 # func_to_host_path ARG
1846 # Converts the path ARG from $build format to $host format. Return result
1847 # in func_to_host_path_result.
1848 func_to_host_path ()
1851 func_init_to_host_path_cmd
1852 $to_host_path_cmd "$1"
1854 # end func_to_host_path
1857 # func_convert_path_noop ARG
1858 # Copy ARG to func_to_host_path_result.
1859 func_convert_path_noop ()
1861 func_to_host_path_result="$1"
1863 # end func_convert_path_noop
1866 # func_convert_path_msys_to_w32 ARG
1867 # Convert path ARG from (mingw) MSYS to (mingw) w32 format; automatic
1868 # conversion to w32 is not available inside the cwrapper. Returns result in
1869 # func_to_host_path_result.
1870 func_convert_path_msys_to_w32 ()
1873 func_to_host_path_result="$1"
1874 if test -n "$1"; then
1875 # Remove leading and trailing path separator characters from ARG. MSYS
1876 # behavior is inconsistent here; cygpath turns them into '.;' and ';.';
1877 # and winepath ignores them completely.
1878 func_stripname : : "$1"
1879 func_to_host_path_tmp1=$func_stripname_result
1880 func_convert_core_msys_to_w32 "$func_to_host_path_tmp1"
1881 func_to_host_path_result="$func_convert_core_msys_to_w32_result"
1882 func_convert_path_check : ";" \
1883 "$func_to_host_path_tmp1" "$func_to_host_path_result"
1884 func_convert_path_front_back_pathsep ":*" "*:" ";" "$1"
1887 # end func_convert_path_msys_to_w32
1890 # func_convert_path_cygwin_to_w32 ARG
1891 # Convert path ARG from Cygwin to w32 format. Returns result in
1892 # func_to_host_file_result.
1893 func_convert_path_cygwin_to_w32 ()
1896 func_to_host_path_result="$1"
1897 if test -n "$1"; then
1898 # See func_convert_path_msys_to_w32:
1899 func_stripname : : "$1"
1900 func_to_host_path_tmp1=$func_stripname_result
1901 func_to_host_path_result=`cygpath -m -p "$func_to_host_path_tmp1"`
1902 func_convert_path_check : ";" \
1903 "$func_to_host_path_tmp1" "$func_to_host_path_result"
1904 func_convert_path_front_back_pathsep ":*" "*:" ";" "$1"
1907 # end func_convert_path_cygwin_to_w32
1910 # func_convert_path_nix_to_w32 ARG
1911 # Convert path ARG from *nix to w32 format. Requires a wine environment and
1912 # a working winepath. Returns result in func_to_host_file_result.
1913 func_convert_path_nix_to_w32 ()
1916 func_to_host_path_result="$1"
1917 if test -n "$1"; then
1918 # See func_convert_path_msys_to_w32:
1919 func_stripname : : "$1"
1920 func_to_host_path_tmp1=$func_stripname_result
1921 func_convert_core_path_wine_to_w32 "$func_to_host_path_tmp1"
1922 func_to_host_path_result="$func_convert_core_path_wine_to_w32_result"
1923 func_convert_path_check : ";" \
1924 "$func_to_host_path_tmp1" "$func_to_host_path_result"
1925 func_convert_path_front_back_pathsep ":*" "*:" ";" "$1"
1928 # end func_convert_path_nix_to_w32
1931 # func_convert_path_msys_to_cygwin ARG
1932 # Convert path ARG from MSYS to Cygwin format. Requires LT_CYGPATH set.
1933 # Returns result in func_to_host_file_result.
1934 func_convert_path_msys_to_cygwin ()
1937 func_to_host_path_result="$1"
1938 if test -n "$1"; then
1939 # See func_convert_path_msys_to_w32:
1940 func_stripname : : "$1"
1941 func_to_host_path_tmp1=$func_stripname_result
1942 func_convert_core_msys_to_w32 "$func_to_host_path_tmp1"
1943 func_cygpath -u -p "$func_convert_core_msys_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_msys_to_cygwin
1953 # func_convert_path_nix_to_cygwin ARG
1954 # Convert path ARG from *nix to Cygwin format. Requires Cygwin installed in a
1955 # a wine environment, working winepath, and LT_CYGPATH set. Returns result in
1956 # func_to_host_file_result.
1957 func_convert_path_nix_to_cygwin ()
1960 func_to_host_path_result="$1"
1961 if test -n "$1"; then
1962 # Remove leading and trailing path separator characters from
1963 # ARG. msys behavior is inconsistent here, cygpath turns them
1964 # into '.;' and ';.', and winepath ignores them completely.
1965 func_stripname : : "$1"
1966 func_to_host_path_tmp1=$func_stripname_result
1967 func_convert_core_path_wine_to_w32 "$func_to_host_path_tmp1"
1968 func_cygpath -u -p "$func_convert_core_path_wine_to_w32_result"
1969 func_to_host_path_result="$func_cygpath_result"
1970 func_convert_path_check : : \
1971 "$func_to_host_path_tmp1" "$func_to_host_path_result"
1972 func_convert_path_front_back_pathsep ":*" "*:" : "$1"
1975 # end func_convert_path_nix_to_cygwin
1978 # func_mode_compile arg...
1979 func_mode_compile ()
1982 # Get the compilation command and the source file.
1984 srcfile="$nonopt" # always keep a non-empty value in "srcfile"
1996 # do not "continue". Instead, add this to base_compile
2008 # Accept any command-line options.
2011 test -n "$libobj" && \
2012 func_fatal_error "you cannot specify \`-o' more than once"
2017 -pie | -fpie | -fPIE)
2018 func_append pie_flag " $arg"
2022 -shared | -static | -prefer-pic | -prefer-non-pic)
2023 func_append later " $arg"
2033 arg_mode=arg # the next one goes into the "base_compile" arg list
2034 continue # The current "srcfile" will either be retained or
2035 ;; # replaced later. I would guess that would be a bug.
2038 func_stripname '-Wc,' '' "$arg"
2039 args=$func_stripname_result
2041 save_ifs="$IFS"; IFS=','
2042 for arg in $args; do
2044 func_append_quoted lastarg "$arg"
2047 func_stripname ' ' '' "$lastarg"
2048 lastarg=$func_stripname_result
2050 # Add the arguments to base_compile.
2051 func_append base_compile " $lastarg"
2056 # Accept the current argument as the source file.
2057 # The previous "srcfile" becomes the current argument.
2064 esac # case $arg_mode
2066 # Aesthetically quote the previous argument.
2067 func_append_quoted base_compile "$lastarg"
2072 func_fatal_error "you must specify an argument for -Xcompile"
2075 func_fatal_error "you must specify a target with \`-o'"
2078 # Get the name of the library object.
2079 test -z "$libobj" && {
2080 func_basename "$srcfile"
2081 libobj="$func_basename_result"
2086 # Recognize several different file suffixes.
2087 # If the user specifies -o file.o, it is replaced with file.lo
2090 *.ada | *.adb | *.ads | *.asm | \
2091 *.c++ | *.cc | *.ii | *.class | *.cpp | *.cxx | \
2092 *.[fF][09]? | *.for | *.java | *.obj | *.sx | *.cu | *.cup)
2093 func_xform "$libobj"
2094 libobj=$func_xform_result
2099 *.lo) func_lo2o "$libobj"; obj=$func_lo2o_result ;;
2101 func_fatal_error "cannot determine name of library object from \`$libobj'"
2105 func_infer_tag $base_compile
2107 for arg in $later; do
2110 test "$build_libtool_libs" != yes && \
2111 func_fatal_configuration "can not build a shared library"
2117 build_libtool_libs=no
2134 func_quote_for_eval "$libobj"
2135 test "X$libobj" != "X$func_quote_for_eval_result" \
2136 && $ECHO "X$libobj" | $GREP '[]~#^*{};<>?"'"'"' &()|`$[]' \
2137 && func_warning "libobj name \`$libobj' may not contain shell special characters."
2138 func_dirname_and_basename "$obj" "/" ""
2139 objname="$func_basename_result"
2140 xdir="$func_dirname_result"
2141 lobj=${xdir}$objdir/$objname
2143 test -z "$base_compile" && \
2144 func_fatal_help "you must specify a compilation command"
2146 # Delete any leftover library objects.
2147 if test "$build_old_libs" = yes; then
2148 removelist="$obj $lobj $libobj ${libobj}T"
2150 removelist="$lobj $libobj ${libobj}T"
2153 # On Cygwin there's no "real" PIC flag so we must build both object types
2155 cygwin* | mingw* | pw32* | os2* | cegcc*)
2159 if test "$pic_mode" = no && test "$deplibs_check_method" != pass_all; then
2160 # non-PIC code in shared libraries is not supported
2164 # Calculate the filename of the output object if compiler does
2165 # not support -o with -c
2166 if test "$compiler_c_o" = no; then
2167 output_obj=`$ECHO "$srcfile" | $SED 's%^.*/%%; s%\.[^.]*$%%'`.${objext}
2168 lockfile="$output_obj.lock"
2175 # Lock this critical section if it is needed
2176 # We use this script file to make the link, it avoids creating a new file
2177 if test "$need_locks" = yes; then
2178 until $opt_dry_run || ln "$progpath" "$lockfile" 2>/dev/null; do
2179 func_echo "Waiting for $lockfile to be removed"
2182 elif test "$need_locks" = warn; then
2183 if test -f "$lockfile"; then
2185 *** ERROR, $lockfile exists and contains:
2186 `cat $lockfile 2>/dev/null`
2188 This indicates that another process is trying to use the same
2189 temporary object file, and libtool could not work around it because
2190 your compiler does not support \`-c' and \`-o' together. If you
2191 repeat this compilation, it may succeed, by chance, but you had better
2192 avoid parallel builds (make -j) in this platform, or get a better
2195 $opt_dry_run || $RM $removelist
2198 func_append removelist " $output_obj"
2199 $ECHO "$srcfile" > "$lockfile"
2202 $opt_dry_run || $RM $removelist
2203 func_append removelist " $lockfile"
2204 trap '$opt_dry_run || $RM $removelist; exit $EXIT_FAILURE' 1 2 15
2206 func_to_tool_file "$srcfile" func_convert_file_msys_to_w32
2207 srcfile=$func_to_tool_file_result
2208 func_quote_for_eval "$srcfile"
2209 qsrcfile=$func_quote_for_eval_result
2211 # Only build a PIC object if we are building libtool libraries.
2212 if test "$build_libtool_libs" = yes; then
2213 # Without this assignment, base_compile gets emptied.
2214 fbsd_hideous_sh_bug=$base_compile
2216 if test "$pic_mode" != no; then
2217 command="$base_compile $qsrcfile $pic_flag"
2219 # Don't build PIC code
2220 command="$base_compile $qsrcfile"
2223 func_mkdir_p "$xdir$objdir"
2225 if test -z "$output_obj"; then
2226 # Place PIC objects in $objdir
2227 func_append command " -o $lobj"
2230 func_show_eval_locale "$command" \
2231 'test -n "$output_obj" && $RM $removelist; exit $EXIT_FAILURE'
2233 if test "$need_locks" = warn &&
2234 test "X`cat $lockfile 2>/dev/null`" != "X$srcfile"; then
2236 *** ERROR, $lockfile contains:
2237 `cat $lockfile 2>/dev/null`
2239 but it should contain:
2242 This indicates that another process is trying to use the same
2243 temporary object file, and libtool could not work around it because
2244 your compiler does not support \`-c' and \`-o' together. If you
2245 repeat this compilation, it may succeed, by chance, but you had better
2246 avoid parallel builds (make -j) in this platform, or get a better
2249 $opt_dry_run || $RM $removelist
2253 # Just move the object if needed, then go on to compile the next one
2254 if test -n "$output_obj" && test "X$output_obj" != "X$lobj"; then
2255 func_show_eval '$MV "$output_obj" "$lobj"' \
2256 'error=$?; $opt_dry_run || $RM $removelist; exit $error'
2259 # Allow error messages only from the first compilation.
2260 if test "$suppress_opt" = yes; then
2261 suppress_output=' >/dev/null 2>&1'
2265 # Only build a position-dependent object if we build old libraries.
2266 if test "$build_old_libs" = yes; then
2267 if test "$pic_mode" != yes; then
2268 # Don't build PIC code
2269 command="$base_compile $qsrcfile$pie_flag"
2271 command="$base_compile $qsrcfile $pic_flag"
2273 if test "$compiler_c_o" = yes; then
2274 func_append command " -o $obj"
2277 # Suppress compiler output if we already did a PIC compilation.
2278 func_append command "$suppress_output"
2279 func_show_eval_locale "$command" \
2280 '$opt_dry_run || $RM $removelist; exit $EXIT_FAILURE'
2282 if test "$need_locks" = warn &&
2283 test "X`cat $lockfile 2>/dev/null`" != "X$srcfile"; then
2285 *** ERROR, $lockfile contains:
2286 `cat $lockfile 2>/dev/null`
2288 but it should contain:
2291 This indicates that another process is trying to use the same
2292 temporary object file, and libtool could not work around it because
2293 your compiler does not support \`-c' and \`-o' together. If you
2294 repeat this compilation, it may succeed, by chance, but you had better
2295 avoid parallel builds (make -j) in this platform, or get a better
2298 $opt_dry_run || $RM $removelist
2302 # Just move the object if needed
2303 if test -n "$output_obj" && test "X$output_obj" != "X$obj"; then
2304 func_show_eval '$MV "$output_obj" "$obj"' \
2305 'error=$?; $opt_dry_run || $RM $removelist; exit $error'
2310 func_write_libtool_object "$libobj" "$objdir/$objname" "$objname"
2312 # Unlock the critical section if it was locked
2313 if test "$need_locks" != no; then
2314 removelist=$lockfile
2323 test "$opt_mode" = compile && func_mode_compile ${1+"$@"}
2328 # We need to display help for each of the modes.
2331 # Generic help is extracted from the usage comments
2332 # at the start of this file.
2338 "Usage: $progname [OPTION]... --mode=clean RM [RM-OPTION]... FILE...
2340 Remove files from the build directory.
2342 RM is the name of the program to use to delete files associated with each FILE
2343 (typically \`/bin/rm'). RM-OPTIONS are options (such as \`-f') to be passed
2346 If FILE is a libtool library, object or program, all the files associated
2347 with it are deleted. Otherwise, only FILE itself is deleted using RM."
2352 "Usage: $progname [OPTION]... --mode=compile COMPILE-COMMAND... SOURCEFILE
2354 Compile a source file into a libtool library object.
2356 This mode accepts the following additional options:
2358 -o OUTPUT-FILE set the output file name to OUTPUT-FILE
2359 -no-suppress do not suppress compiler output for multiple passes
2360 -prefer-pic try to build PIC objects only
2361 -prefer-non-pic try to build non-PIC objects only
2362 -shared do not build a \`.o' file suitable for static linking
2363 -static only build a \`.o' file suitable for static linking
2364 -Wc,FLAG pass FLAG directly to the compiler
2366 COMPILE-COMMAND is a command to be used in creating a \`standard' object file
2367 from the given SOURCEFILE.
2369 The output file name is determined by removing the directory component from
2370 SOURCEFILE, then substituting the C source code suffix \`.c' with the
2371 library object suffix, \`.lo'."
2376 "Usage: $progname [OPTION]... --mode=execute COMMAND [ARGS]...
2378 Automatically set library path, then run a program.
2380 This mode accepts the following additional options:
2382 -dlopen FILE add the directory containing FILE to the library path
2384 This mode sets the library path environment variable according to \`-dlopen'
2387 If any of the ARGS are libtool executable wrappers, then they are translated
2388 into their corresponding uninstalled binary, and any of their required library
2389 directories are added to the library path.
2391 Then, COMMAND is executed, with ARGS as arguments."
2396 "Usage: $progname [OPTION]... --mode=finish [LIBDIR]...
2398 Complete the installation of libtool libraries.
2400 Each LIBDIR is a directory that contains libtool libraries.
2402 The commands that this mode executes may require superuser privileges. Use
2403 the \`--dry-run' option if you just want to see what would be executed."
2408 "Usage: $progname [OPTION]... --mode=install INSTALL-COMMAND...
2410 Install executables or libraries.
2412 INSTALL-COMMAND is the installation command. The first component should be
2413 either the \`install' or \`cp' program.
2415 The following components of INSTALL-COMMAND are treated specially:
2417 -inst-prefix-dir PREFIX-DIR Use PREFIX-DIR as a staging area for installation
2419 The rest of the components are interpreted as arguments to that command (only
2420 BSD-compatible install options are recognized)."
2425 "Usage: $progname [OPTION]... --mode=link LINK-COMMAND...
2427 Link object files or libraries together to form another library, or to
2428 create an executable program.
2430 LINK-COMMAND is a command using the C compiler that you would use to create
2431 a program from several object files.
2433 The following components of LINK-COMMAND are treated specially:
2435 -all-static do not do any dynamic linking at all
2436 -avoid-version do not add a version suffix if possible
2437 -bindir BINDIR specify path to binaries directory (for systems where
2438 libraries must be found in the PATH setting at runtime)
2439 -dlopen FILE \`-dlpreopen' FILE if it cannot be dlopened at runtime
2440 -dlpreopen FILE link in FILE and add its symbols to lt_preloaded_symbols
2441 -export-dynamic allow symbols from OUTPUT-FILE to be resolved with dlsym(3)
2442 -export-symbols SYMFILE
2443 try to export only the symbols listed in SYMFILE
2444 -export-symbols-regex REGEX
2445 try to export only the symbols matching REGEX
2446 -LLIBDIR search LIBDIR for required installed libraries
2447 -lNAME OUTPUT-FILE requires the installed library libNAME
2448 -module build a library that can dlopened
2449 -no-fast-install disable the fast-install mode
2450 -no-install link a not-installable executable
2451 -no-undefined declare that a library does not refer to external symbols
2452 -o OUTPUT-FILE create OUTPUT-FILE from the specified objects
2453 -objectlist FILE Use a list of object files found in FILE to specify objects
2454 -precious-files-regex REGEX
2455 don't remove output files matching REGEX
2456 -release RELEASE specify package release information
2457 -rpath LIBDIR the created library will eventually be installed in LIBDIR
2458 -R[ ]LIBDIR add LIBDIR to the runtime path of programs and libraries
2459 -shared only do dynamic linking of libtool libraries
2460 -shrext SUFFIX override the standard shared library file extension
2461 -static do not do any dynamic linking of uninstalled libtool libraries
2462 -static-libtool-libs
2463 do not do any dynamic linking of libtool libraries
2464 -version-info CURRENT[:REVISION[:AGE]]
2465 specify library version info [each variable defaults to 0]
2466 -weak LIBNAME declare that the target provides the LIBNAME interface
2468 -Xcompiler FLAG pass linker-specific FLAG directly to the compiler
2470 -Xlinker FLAG pass linker-specific FLAG directly to the linker
2471 -XCClinker FLAG pass link-specific FLAG to the compiler driver (CC)
2473 All other options (arguments beginning with \`-') are ignored.
2475 Every other argument is treated as a filename. Files ending in \`.la' are
2476 treated as uninstalled libtool libraries, other files are standard or library
2479 If the OUTPUT-FILE ends in \`.la', then a libtool library is created,
2480 only library objects (\`.lo' files) may be specified, and \`-rpath' is
2481 required, except when creating a convenience library.
2483 If OUTPUT-FILE ends in \`.a' or \`.lib', then a standard library is created
2484 using \`ar' and \`ranlib', or on Windows using \`lib'.
2486 If OUTPUT-FILE ends in \`.lo' or \`.${objext}', then a reloadable object file
2487 is created, otherwise an executable program is created."
2492 "Usage: $progname [OPTION]... --mode=uninstall RM [RM-OPTION]... FILE...
2494 Remove libraries from an installation directory.
2496 RM is the name of the program to use to delete files associated with each FILE
2497 (typically \`/bin/rm'). RM-OPTIONS are options (such as \`-f') to be passed
2500 If FILE is a libtool library, all the files associated with it are deleted.
2501 Otherwise, only FILE itself is deleted using RM."
2505 func_fatal_help "invalid operation mode \`$opt_mode'"
2510 $ECHO "Try \`$progname --help' for more information about other modes."
2513 # Now that we've collected a possible --mode arg, show help if necessary
2515 if test "$opt_help" = :; then
2520 for opt_mode in compile link execute install finish uninstall clean; do
2523 } | sed -n '1p; 2,$s/^Usage:/ or: /p'
2526 for opt_mode in compile link execute install finish uninstall clean; do
2532 /^When reporting/,/^Report/{
2537 /information about other modes/d
2538 /more detailed .*MODE/d
2539 s/^Usage:.*--mode=\([^ ]*\) .*/Description of \1 mode:/'
2545 # func_mode_execute arg...
2546 func_mode_execute ()
2549 # The first argument is the command name.
2552 func_fatal_help "you must specify a COMMAND"
2554 # Handle -dlopen flags immediately.
2555 for file in $opt_dlopen; do
2557 || func_fatal_help "\`$file' is not a file"
2562 func_resolve_sysroot "$file"
2563 file=$func_resolve_sysroot_result
2565 # Check to see that this really is a libtool archive.
2566 func_lalib_unsafe_p "$file" \
2567 || func_fatal_help "\`$lib' is not a valid libtool archive"
2569 # Read the libtool library.
2574 # Skip this library if it cannot be dlopened.
2575 if test -z "$dlname"; then
2576 # Warn if it was a shared library.
2577 test -n "$library_names" && \
2578 func_warning "\`$file' was not linked with \`-export-dynamic'"
2582 func_dirname "$file" "" "."
2583 dir="$func_dirname_result"
2585 if test -f "$dir/$objdir/$dlname"; then
2586 func_append dir "/$objdir"
2588 if test ! -f "$dir/$dlname"; then
2589 func_fatal_error "cannot find \`$dlname' in \`$dir' or \`$dir/$objdir'"
2595 # Just add the directory containing the .lo file.
2596 func_dirname "$file" "" "."
2597 dir="$func_dirname_result"
2601 func_warning "\`-dlopen' is ignored for non-libtool libraries and objects"
2606 # Get the absolute pathname.
2607 absdir=`cd "$dir" && pwd`
2608 test -n "$absdir" && dir="$absdir"
2610 # Now add the directory to shlibpath_var.
2611 if eval "test -z \"\$$shlibpath_var\""; then
2612 eval "$shlibpath_var=\"\$dir\""
2614 eval "$shlibpath_var=\"\$dir:\$$shlibpath_var\""
2618 # This variable tells wrapper scripts just to set shlibpath_var
2619 # rather than running their programs.
2620 libtool_execute_magic="$magic"
2622 # Check if any of the arguments is a wrapper script.
2627 -* | *.la | *.lo ) ;;
2629 # Do a test to see if this is really a libtool program.
2630 if func_ltwrapper_script_p "$file"; then
2632 # Transform arg to wrapped name.
2633 file="$progdir/$program"
2634 elif func_ltwrapper_executable_p "$file"; then
2635 func_ltwrapper_scriptname "$file"
2636 func_source "$func_ltwrapper_scriptname_result"
2637 # Transform arg to wrapped name.
2638 file="$progdir/$program"
2642 # Quote arguments (to preserve shell metacharacters).
2643 func_append_quoted args "$file"
2646 if test "X$opt_dry_run" = Xfalse; then
2647 if test -n "$shlibpath_var"; then
2648 # Export the shlibpath_var.
2649 eval "export $shlibpath_var"
2652 # Restore saved environment variables
2653 for lt_var in LANG LANGUAGE LC_ALL LC_CTYPE LC_COLLATE LC_MESSAGES
2655 eval "if test \"\${save_$lt_var+set}\" = set; then
2656 $lt_var=\$save_$lt_var; export $lt_var
2662 # Now prepare to actually exec the command.
2663 exec_cmd="\$cmd$args"
2665 # Display what would be done.
2666 if test -n "$shlibpath_var"; then
2667 eval "\$ECHO \"\$shlibpath_var=\$$shlibpath_var\""
2668 echo "export $shlibpath_var"
2675 test "$opt_mode" = execute && func_mode_execute ${1+"$@"}
2678 # func_mode_finish arg...
2686 for opt in "$nonopt" ${1+"$@"}
2688 if test -d "$opt"; then
2689 func_append libdirs " $opt"
2691 elif test -f "$opt"; then
2692 if func_lalib_unsafe_p "$opt"; then
2693 func_append libs " $opt"
2695 func_warning "\`$opt' is not a valid libtool archive"
2699 func_fatal_error "invalid argument \`$opt'"
2703 if test -n "$libs"; then
2704 if test -n "$lt_sysroot"; then
2705 sysroot_regex=`$ECHO "$lt_sysroot" | $SED "$sed_make_literal_regex"`
2706 sysroot_cmd="s/\([ ']\)$sysroot_regex/\1/g;"
2711 # Remove sysroot references
2712 if $opt_dry_run; then
2713 for lib in $libs; do
2714 echo "removing references to $lt_sysroot and \`=' prefixes from $lib"
2717 tmpdir=`func_mktempdir`
2718 for lib in $libs; do
2719 sed -e "${sysroot_cmd} s/\([ ']-[LR]\)=/\1/g; s/\([ ']\)=/\1/g" $lib \
2721 mv -f $tmpdir/tmp-la $lib
2727 if test -n "$finish_cmds$finish_eval" && test -n "$libdirs"; then
2728 for libdir in $libdirs; do
2729 if test -n "$finish_cmds"; then
2730 # Do each command in the finish commands.
2731 func_execute_cmds "$finish_cmds" 'admincmds="$admincmds
2734 if test -n "$finish_eval"; then
2735 # Do the single finish_eval.
2736 eval cmds=\"$finish_eval\"
2737 $opt_dry_run || eval "$cmds" || func_append admincmds "
2743 # Exit here if they wanted silent mode.
2744 $opt_silent && exit $EXIT_SUCCESS
2746 if test -n "$finish_cmds$finish_eval" && test -n "$libdirs"; then
2747 echo "----------------------------------------------------------------------"
2748 echo "Libraries have been installed in:"
2749 for libdir in $libdirs; do
2753 echo "If you ever happen to want to link against installed libraries"
2754 echo "in a given directory, LIBDIR, you must either use libtool, and"
2755 echo "specify the full pathname of the library, or use the \`-LLIBDIR'"
2756 echo "flag during linking and do at least one of the following:"
2757 if test -n "$shlibpath_var"; then
2758 echo " - add LIBDIR to the \`$shlibpath_var' environment variable"
2759 echo " during execution"
2761 if test -n "$runpath_var"; then
2762 echo " - add LIBDIR to the \`$runpath_var' environment variable"
2763 echo " during linking"
2765 if test -n "$hardcode_libdir_flag_spec"; then
2767 eval flag=\"$hardcode_libdir_flag_spec\"
2769 $ECHO " - use the \`$flag' linker flag"
2771 if test -n "$admincmds"; then
2772 $ECHO " - have your system administrator run these commands:$admincmds"
2774 if test -f /etc/ld.so.conf; then
2775 echo " - have your system administrator add LIBDIR to \`/etc/ld.so.conf'"
2779 echo "See any operating system documentation about shared libraries for"
2781 solaris2.[6789]|solaris2.1[0-9])
2782 echo "more information, such as the ld(1), crle(1) and ld.so(8) manual"
2786 echo "more information, such as the ld(1) and ld.so(8) manual pages."
2789 echo "----------------------------------------------------------------------"
2794 test "$opt_mode" = finish && func_mode_finish ${1+"$@"}
2797 # func_mode_install arg...
2798 func_mode_install ()
2801 # There may be an optional sh(1) argument at the beginning of
2802 # install_prog (especially on Windows NT).
2803 if test "$nonopt" = "$SHELL" || test "$nonopt" = /bin/sh ||
2804 # Allow the use of GNU shtool's install command.
2805 case $nonopt in *shtool*) :;; *) false;; esac; then
2806 # Aesthetically quote it.
2807 func_quote_for_eval "$nonopt"
2808 install_prog="$func_quote_for_eval_result "
2816 # The real first argument should be the name of the installation program.
2817 # Aesthetically quote it.
2818 func_quote_for_eval "$arg"
2819 func_append install_prog "$func_quote_for_eval_result"
2820 install_shared_prog=$install_prog
2821 case " $install_prog " in
2822 *[\\\ /]cp\ *) install_cp=: ;;
2823 *) install_cp=false ;;
2826 # We need to accept at least all the BSD install flags.
2838 if test -n "$dest"; then
2839 func_append files " $dest"
2847 if $install_cp; then :; else
2861 # If the previous option needed an argument, then skip it.
2862 if test -n "$prev"; then
2863 if test "x$prev" = x-m && test -n "$install_override_mode"; then
2864 arg2=$install_override_mode
2875 # Aesthetically quote the argument.
2876 func_quote_for_eval "$arg"
2877 func_append install_prog " $func_quote_for_eval_result"
2878 if test -n "$arg2"; then
2879 func_quote_for_eval "$arg2"
2881 func_append install_shared_prog " $func_quote_for_eval_result"
2884 test -z "$install_prog" && \
2885 func_fatal_help "you must specify an install program"
2887 test -n "$prev" && \
2888 func_fatal_help "the \`$prev' option requires an argument"
2890 if test -n "$install_override_mode" && $no_mode; then
2891 if $install_cp; then :; else
2892 func_quote_for_eval "$install_override_mode"
2893 func_append install_shared_prog " -m $func_quote_for_eval_result"
2897 if test -z "$files"; then
2898 if test -z "$dest"; then
2899 func_fatal_help "no file or destination specified"
2901 func_fatal_help "you must specify a destination"
2905 # Strip any trailing slash from the destination.
2906 func_stripname '' '/' "$dest"
2907 dest=$func_stripname_result
2909 # Check to see that the destination is a directory.
2910 test -d "$dest" && isdir=yes
2911 if test "$isdir" = yes; then
2915 func_dirname_and_basename "$dest" "" "."
2916 destdir="$func_dirname_result"
2917 destname="$func_basename_result"
2919 # Not a directory, so check to see that there is only one file specified.
2920 set dummy $files; shift
2921 test "$#" -gt 1 && \
2922 func_fatal_help "\`$dest' is not a directory"
2925 [\\/]* | [A-Za-z]:[\\/]*) ;;
2927 for file in $files; do
2931 func_fatal_help "\`$destdir' must be an absolute directory name"
2938 # This variable tells wrapper scripts just to set variables rather
2939 # than running their programs.
2940 libtool_install_magic="$magic"
2945 for file in $files; do
2947 # Do each installation.
2950 # Do the static libraries later.
2951 func_append staticlibs " $file"
2955 func_resolve_sysroot "$file"
2956 file=$func_resolve_sysroot_result
2958 # Check to see that this really is a libtool archive.
2959 func_lalib_unsafe_p "$file" \
2960 || func_fatal_help "\`$file' is not a valid libtool archive"
2967 # Add the libdir to current_libdirs if it is the destination.
2968 if test "X$destdir" = "X$libdir"; then
2969 case "$current_libdirs " in
2971 *) func_append current_libdirs " $libdir" ;;
2974 # Note the libdir as a future libdir.
2975 case "$future_libdirs " in
2977 *) func_append future_libdirs " $libdir" ;;
2981 func_dirname "$file" "/" ""
2982 dir="$func_dirname_result"
2983 func_append dir "$objdir"
2985 if test -n "$relink_command"; then
2986 # Determine the prefix the user has applied to our future dir.
2987 inst_prefix_dir=`$ECHO "$destdir" | $SED -e "s%$libdir\$%%"`
2989 # Don't allow the user to place us outside of our expected
2990 # location b/c this prevents finding dependent libraries that
2991 # are installed to the same prefix.
2992 # At present, this check doesn't affect windows .dll's that
2993 # are installed into $libdir/../bin (currently, that works fine)
2994 # but it's something to keep an eye on.
2995 test "$inst_prefix_dir" = "$destdir" && \
2996 func_fatal_error "error: cannot install \`$file' to a directory not ending in $libdir"
2998 if test -n "$inst_prefix_dir"; then
2999 # Stick the inst_prefix_dir data into the link command.
3000 relink_command=`$ECHO "$relink_command" | $SED "s%@inst_prefix_dir@%-inst-prefix-dir $inst_prefix_dir%"`
3002 relink_command=`$ECHO "$relink_command" | $SED "s%@inst_prefix_dir@%%"`
3005 func_warning "relinking \`$file'"
3006 func_show_eval "$relink_command" \
3007 'func_fatal_error "error: relink \`$file'\'' with the above command before installing it"'
3010 # See the names of the shared library.
3011 set dummy $library_names; shift
3012 if test -n "$1"; then
3017 test -n "$relink_command" && srcname="$realname"T
3019 # Install the shared library and build the symlinks.
3020 func_show_eval "$install_shared_prog $dir/$srcname $destdir/$realname" \
3024 cygwin* | mingw* | pw32* | cegcc*)
3032 if test -n "$tstripme" && test -n "$striplib"; then
3033 func_show_eval "$striplib $destdir/$realname" 'exit $?'
3036 if test "$#" -gt 0; then
3037 # Delete the old symlinks, and create new ones.
3038 # Try `ln -sf' first, because the `ln' binary might depend on
3039 # the symlink we replace! Solaris /bin/ln does not understand -f,
3040 # so we also need to try rm && ln -s.
3043 test "$linkname" != "$realname" \
3044 && func_show_eval "(cd $destdir && { $LN_S -f $realname $linkname || { $RM $linkname && $LN_S $realname $linkname; }; })"
3048 # Do each command in the postinstall commands.
3049 lib="$destdir/$realname"
3050 func_execute_cmds "$postinstall_cmds" 'exit $?'
3053 # Install the pseudo-library for information purposes.
3054 func_basename "$file"
3055 name="$func_basename_result"
3056 instname="$dir/$name"i
3057 func_show_eval "$install_prog $instname $destdir/$name" 'exit $?'
3059 # Maybe install the static library, too.
3060 test -n "$old_library" && func_append staticlibs " $dir/$old_library"
3064 # Install (i.e. copy) a libtool object.
3066 # Figure out destination file name, if it wasn't already specified.
3067 if test -n "$destname"; then
3068 destfile="$destdir/$destname"
3070 func_basename "$file"
3071 destfile="$func_basename_result"
3072 destfile="$destdir/$destfile"
3075 # Deduce the name of the destination old-style object file.
3078 func_lo2o "$destfile"
3079 staticdest=$func_lo2o_result
3082 staticdest="$destfile"
3086 func_fatal_help "cannot copy a libtool object to \`$destfile'"
3090 # Install the libtool object if requested.
3091 test -n "$destfile" && \
3092 func_show_eval "$install_prog $file $destfile" 'exit $?'
3094 # Install the old object if enabled.
3095 if test "$build_old_libs" = yes; then
3096 # Deduce the name of the old-style object file.
3098 staticobj=$func_lo2o_result
3099 func_show_eval "$install_prog \$staticobj \$staticdest" 'exit $?'
3105 # Figure out destination file name, if it wasn't already specified.
3106 if test -n "$destname"; then
3107 destfile="$destdir/$destname"
3109 func_basename "$file"
3110 destfile="$func_basename_result"
3111 destfile="$destdir/$destfile"
3114 # If the file is missing, and there is a .exe on the end, strip it
3115 # because it is most likely a libtool script we actually want to
3120 if test ! -f "$file"; then
3121 func_stripname '' '.exe' "$file"
3122 file=$func_stripname_result
3128 # Do a test to see if this is really a libtool program.
3131 if func_ltwrapper_executable_p "$file"; then
3132 func_ltwrapper_scriptname "$file"
3133 wrapper=$func_ltwrapper_scriptname_result
3135 func_stripname '' '.exe' "$file"
3136 wrapper=$func_stripname_result
3143 if func_ltwrapper_script_p "$wrapper"; then
3147 func_source "$wrapper"
3149 # Check the variables that should have been set.
3150 test -z "$generated_by_libtool_version" && \
3151 func_fatal_error "invalid libtool wrapper script \`$wrapper'"
3154 for lib in $notinst_deplibs; do
3155 # Check to see that each library is installed.
3157 if test -f "$lib"; then
3160 libfile="$libdir/"`$ECHO "$lib" | $SED 's%^.*/%%g'` ### testsuite: skip nested quoting test
3161 if test -n "$libdir" && test ! -f "$libfile"; then
3162 func_warning "\`$lib' has not been installed in \`$libdir'"
3168 func_source "$wrapper"
3171 if test "$fast_install" = no && test -n "$relink_command"; then
3173 if test "$finalize" = yes; then
3174 tmpdir=`func_mktempdir`
3175 func_basename "$file$stripped_ext"
3176 file="$func_basename_result"
3177 outputname="$tmpdir/$file"
3178 # Replace the output file specification.
3179 relink_command=`$ECHO "$relink_command" | $SED 's%@OUTPUT@%'"$outputname"'%g'`
3182 func_quote_for_expand "$relink_command"
3183 eval "func_echo $func_quote_for_expand_result"
3185 if eval "$relink_command"; then :
3187 func_error "error: relink \`$file' with the above command before installing it"
3188 $opt_dry_run || ${RM}r "$tmpdir"
3193 func_warning "cannot relink \`$file'"
3197 # Install the binary that we compiled earlier.
3198 file=`$ECHO "$file$stripped_ext" | $SED "s%\([^/]*\)$%$objdir/\1%"`
3202 # remove .exe since cygwin /usr/bin/install will append another
3204 case $install_prog,$host in
3205 */usr/bin/install*,*cygwin*)
3206 case $file:$destfile in
3211 destfile=$destfile.exe
3214 func_stripname '' '.exe' "$destfile"
3215 destfile=$func_stripname_result
3220 func_show_eval "$install_prog\$stripme \$file \$destfile" 'exit $?'
3221 $opt_dry_run || if test -n "$outputname"; then
3228 for file in $staticlibs; do
3229 func_basename "$file"
3230 name="$func_basename_result"
3232 # Set up the ranlib parameters.
3233 oldlib="$destdir/$name"
3235 func_show_eval "$install_prog \$file \$oldlib" 'exit $?'
3237 if test -n "$stripme" && test -n "$old_striplib"; then
3238 func_show_eval "$old_striplib $oldlib" 'exit $?'
3241 # Do each command in the postinstall commands.
3242 func_execute_cmds "$old_postinstall_cmds" 'exit $?'
3245 test -n "$future_libdirs" && \
3246 func_warning "remember to run \`$progname --finish$future_libdirs'"
3248 if test -n "$current_libdirs"; then
3249 # Maybe just do a dry run.
3250 $opt_dry_run && current_libdirs=" -n$current_libdirs"
3251 exec_cmd='$SHELL $progpath $preserve_args --finish$current_libdirs'
3257 test "$opt_mode" = install && func_mode_install ${1+"$@"}
3260 # func_generate_dlsyms outputname originator pic_p
3261 # Extract symbols from dlprefiles and create ${outputname}S.o with
3262 # a dlpreopen symbol table.
3263 func_generate_dlsyms ()
3269 my_prefix=`$ECHO "$my_originator" | sed 's%[^a-zA-Z0-9]%_%g'`
3272 if test -n "$dlfiles$dlprefiles" || test "$dlself" != no; then
3273 if test -n "$NM" && test -n "$global_symbol_pipe"; then
3274 my_dlsyms="${my_outputname}S.c"
3276 func_error "not configured to extract global symbols from dlpreopened files"
3280 if test -n "$my_dlsyms"; then
3284 # Discover the nlist of each of the dlfiles.
3285 nlist="$output_objdir/${my_outputname}.nm"
3287 func_show_eval "$RM $nlist ${nlist}S ${nlist}T"
3289 # Parse the name list into a source file.
3290 func_verbose "creating $output_objdir/$my_dlsyms"
3292 $opt_dry_run || $ECHO > "$output_objdir/$my_dlsyms" "\
3293 /* $my_dlsyms - symbol resolution table for \`$my_outputname' dlsym emulation. */
3294 /* Generated by $PROGRAM (GNU $PACKAGE$TIMESTAMP) $VERSION */
3300 #if defined(__GNUC__) && (((__GNUC__ == 4) && (__GNUC_MINOR__ >= 4)) || (__GNUC__ > 4))
3301 #pragma GCC diagnostic ignored \"-Wstrict-prototypes\"
3304 /* Keep this code in sync between libtool.m4, ltmain, lt_system.h, and tests. */
3305 #if defined(_WIN32) || defined(__CYGWIN__) || defined(_WIN32_WCE)
3306 /* DATA imports from DLLs on WIN32 con't be const, because runtime
3307 relocations are performed -- see ld's documentation on pseudo-relocs. */
3308 # define LT_DLSYM_CONST
3309 #elif defined(__osf__)
3310 /* This system does not cope well with relocations in const data. */
3311 # define LT_DLSYM_CONST
3313 # define LT_DLSYM_CONST const
3316 /* External symbol declarations for the compiler. */\
3319 if test "$dlself" = yes; then
3320 func_verbose "generating symbol list for \`$output'"
3322 $opt_dry_run || echo ': @PROGRAM@ ' > "$nlist"
3324 # Add our own program objects to the symbol list.
3325 progfiles=`$ECHO "$objs$old_deplibs" | $SP2NL | $SED "$lo2o" | $NL2SP`
3326 for progfile in $progfiles; do
3327 func_to_tool_file "$progfile" func_convert_file_msys_to_w32
3328 func_verbose "extracting global C symbols from \`$func_to_tool_file_result'"
3329 $opt_dry_run || eval "$NM $func_to_tool_file_result | $global_symbol_pipe >> '$nlist'"
3332 if test -n "$exclude_expsyms"; then
3334 eval '$EGREP -v " ($exclude_expsyms)$" "$nlist" > "$nlist"T'
3335 eval '$MV "$nlist"T "$nlist"'
3339 if test -n "$export_symbols_regex"; then
3341 eval '$EGREP -e "$export_symbols_regex" "$nlist" > "$nlist"T'
3342 eval '$MV "$nlist"T "$nlist"'
3346 # Prepare the list of exported symbols
3347 if test -z "$export_symbols"; then
3348 export_symbols="$output_objdir/$outputname.exp"
3351 eval "${SED} -n -e '/^: @PROGRAM@ $/d' -e 's/^.* \(.*\)$/\1/p' "'< "$nlist" > "$export_symbols"'
3353 *cygwin* | *mingw* | *cegcc* )
3354 eval "echo EXPORTS "'> "$output_objdir/$outputname.def"'
3355 eval 'cat "$export_symbols" >> "$output_objdir/$outputname.def"'
3361 eval "${SED} -e 's/\([].[*^$]\)/\\\\\1/g' -e 's/^/ /' -e 's/$/$/'"' < "$export_symbols" > "$output_objdir/$outputname.exp"'
3362 eval '$GREP -f "$output_objdir/$outputname.exp" < "$nlist" > "$nlist"T'
3363 eval '$MV "$nlist"T "$nlist"'
3365 *cygwin* | *mingw* | *cegcc* )
3366 eval "echo EXPORTS "'> "$output_objdir/$outputname.def"'
3367 eval 'cat "$nlist" >> "$output_objdir/$outputname.def"'
3374 for dlprefile in $dlprefiles; do
3375 func_verbose "extracting global C symbols from \`$dlprefile'"
3376 func_basename "$dlprefile"
3377 name="$func_basename_result"
3379 *cygwin* | *mingw* | *cegcc* )
3380 # if an import library, we need to obtain dlname
3381 if func_win32_import_lib_p "$dlprefile"; then
3382 func_tr_sh "$dlprefile"
3383 eval "curr_lafile=\$libfile_$func_tr_sh_result"
3384 dlprefile_dlbasename=""
3385 if test -n "$curr_lafile" && func_lalib_p "$curr_lafile"; then
3386 # Use subshell, to avoid clobbering current variable values
3387 dlprefile_dlname=`source "$curr_lafile" && echo "$dlname"`
3388 if test -n "$dlprefile_dlname" ; then
3389 func_basename "$dlprefile_dlname"
3390 dlprefile_dlbasename="$func_basename_result"
3392 # no lafile. user explicitly requested -dlpreopen <import library>.
3393 $sharedlib_from_linklib_cmd "$dlprefile"
3394 dlprefile_dlbasename=$sharedlib_from_linklib_result
3398 if test -n "$dlprefile_dlbasename" ; then
3399 eval '$ECHO ": $dlprefile_dlbasename" >> "$nlist"'
3401 func_warning "Could not compute DLL name from $name"
3402 eval '$ECHO ": $name " >> "$nlist"'
3404 func_to_tool_file "$dlprefile" func_convert_file_msys_to_w32
3405 eval "$NM \"$func_to_tool_file_result\" 2>/dev/null | $global_symbol_pipe |
3406 $SED -e '/I __imp/d' -e 's/I __nm_/D /;s/_nm__//' >> '$nlist'"
3408 else # not an import lib
3410 eval '$ECHO ": $name " >> "$nlist"'
3411 func_to_tool_file "$dlprefile" func_convert_file_msys_to_w32
3412 eval "$NM \"$func_to_tool_file_result\" 2>/dev/null | $global_symbol_pipe >> '$nlist'"
3418 eval '$ECHO ": $name " >> "$nlist"'
3419 func_to_tool_file "$dlprefile" func_convert_file_msys_to_w32
3420 eval "$NM \"$func_to_tool_file_result\" 2>/dev/null | $global_symbol_pipe >> '$nlist'"
3427 # Make sure we have at least an empty file.
3428 test -f "$nlist" || : > "$nlist"
3430 if test -n "$exclude_expsyms"; then
3431 $EGREP -v " ($exclude_expsyms)$" "$nlist" > "$nlist"T
3432 $MV "$nlist"T "$nlist"
3435 # Try sorting and uniquifying the output.
3436 if $GREP -v "^: " < "$nlist" |
3437 if sort -k 3 </dev/null >/dev/null 2>&1; then
3442 uniq > "$nlist"S; then
3445 $GREP -v "^: " < "$nlist" > "$nlist"S
3448 if test -f "$nlist"S; then
3449 eval "$global_symbol_to_cdecl"' < "$nlist"S >> "$output_objdir/$my_dlsyms"'
3451 echo '/* NONE */' >> "$output_objdir/$my_dlsyms"
3454 echo >> "$output_objdir/$my_dlsyms" "\
3456 /* The mapping between symbol names and symbols. */
3461 extern LT_DLSYM_CONST lt_dlsymlist
3462 lt_${my_prefix}_LTX_preloaded_symbols[];
3463 LT_DLSYM_CONST lt_dlsymlist
3464 lt_${my_prefix}_LTX_preloaded_symbols[] =
3466 { \"$my_originator\", (void *) 0 },"
3468 case $need_lib_prefix in
3470 eval "$global_symbol_to_c_name_address" < "$nlist" >> "$output_objdir/$my_dlsyms"
3473 eval "$global_symbol_to_c_name_address_lib_prefix" < "$nlist" >> "$output_objdir/$my_dlsyms"
3476 echo >> "$output_objdir/$my_dlsyms" "\
3480 /* This works around a problem in FreeBSD linker */
3481 #ifdef FREEBSD_WORKAROUND
3482 static const void *lt_preloaded_setup() {
3483 return lt_${my_prefix}_LTX_preloaded_symbols;
3493 pic_flag_for_symtable=
3494 case "$compile_command " in
3498 # compiling the symbol table file with pic_flag works around
3499 # a FreeBSD bug that causes programs to crash when -lm is
3500 # linked before any other PIC object. But we must not use
3501 # pic_flag when linking with -static. The problem exists in
3502 # FreeBSD 2.2.6 and is fixed in FreeBSD 3.1.
3503 *-*-freebsd2*|*-*-freebsd3.0*|*-*-freebsdelf3.0*)
3504 pic_flag_for_symtable=" $pic_flag -DFREEBSD_WORKAROUND" ;;
3506 pic_flag_for_symtable=" $pic_flag" ;;
3508 if test "X$my_pic_p" != Xno; then
3509 pic_flag_for_symtable=" $pic_flag"
3516 for arg in $LTCFLAGS; do
3518 -pie | -fpie | -fPIE) ;;
3519 *) func_append symtab_cflags " $arg" ;;
3523 # Now compile the dynamic symbol file.
3524 func_show_eval '(cd $output_objdir && $LTCC$symtab_cflags -c$no_builtin_flag$pic_flag_for_symtable "$my_dlsyms")' 'exit $?'
3526 # Clean up the generated files.
3527 func_show_eval '$RM "$output_objdir/$my_dlsyms" "$nlist" "${nlist}S" "${nlist}T"'
3529 # Transform the symbol file into the correct name.
3530 symfileobj="$output_objdir/${my_outputname}S.$objext"
3532 *cygwin* | *mingw* | *cegcc* )
3533 if test -f "$output_objdir/$my_outputname.def"; then
3534 compile_command=`$ECHO "$compile_command" | $SED "s%@SYMFILE@%$output_objdir/$my_outputname.def $symfileobj%"`
3535 finalize_command=`$ECHO "$finalize_command" | $SED "s%@SYMFILE@%$output_objdir/$my_outputname.def $symfileobj%"`
3537 compile_command=`$ECHO "$compile_command" | $SED "s%@SYMFILE@%$symfileobj%"`
3538 finalize_command=`$ECHO "$finalize_command" | $SED "s%@SYMFILE@%$symfileobj%"`
3542 compile_command=`$ECHO "$compile_command" | $SED "s%@SYMFILE@%$symfileobj%"`
3543 finalize_command=`$ECHO "$finalize_command" | $SED "s%@SYMFILE@%$symfileobj%"`
3548 # FreeBSD doesn't need this...
3551 func_fatal_error "unknown suffix for \`$my_dlsyms'"
3555 # We keep going just in case the user didn't refer to
3556 # lt_preloaded_symbols. The linker will fail if global_symbol_pipe
3557 # really was required.
3559 # Nullify the symbol file.
3560 compile_command=`$ECHO "$compile_command" | $SED "s% @SYMFILE@%%"`
3561 finalize_command=`$ECHO "$finalize_command" | $SED "s% @SYMFILE@%%"`
3565 # func_win32_libid arg
3566 # return the library type of file 'arg'
3568 # Need a lot of goo to handle *both* DLLs and import libs
3569 # Has to be a shell function in order to 'eat' the argument
3570 # that is supplied when $file_magic_command is called.
3571 # Despite the name, also deal with 64 bit binaries.
3575 win32_libid_type="unknown"
3576 win32_fileres=`file -L $1 2>/dev/null`
3577 case $win32_fileres in
3578 *ar\ archive\ import\ library*) # definitely import
3579 win32_libid_type="x86 archive import"
3581 *ar\ archive*) # could be an import, or static
3582 # Keep the egrep pattern in sync with the one in _LT_CHECK_MAGIC_METHOD.
3583 if eval $OBJDUMP -f $1 | $SED -e '10q' 2>/dev/null |
3584 $EGREP 'file format (pei*-i386(.*architecture: i386)?|pe-arm-wince|pe-x86-64)' >/dev/null; then
3585 func_to_tool_file "$1" func_convert_file_msys_to_w32
3586 win32_nmres=`eval $NM -f posix -A \"$func_to_tool_file_result\" |
3595 case $win32_nmres in
3596 import*) win32_libid_type="x86 archive import";;
3597 *) win32_libid_type="x86 archive static";;
3602 win32_libid_type="x86 DLL"
3604 *executable*) # but shell scripts are "executable" too...
3605 case $win32_fileres in
3606 *MS\ Windows\ PE\ Intel*)
3607 win32_libid_type="x86 DLL"
3612 $ECHO "$win32_libid_type"
3615 # func_cygming_dll_for_implib ARG
3617 # Platform-specific function to extract the
3618 # name of the DLL associated with the specified
3619 # import library ARG.
3620 # Invoked by eval'ing the libtool variable
3621 # $sharedlib_from_linklib_cmd
3622 # Result is available in the variable
3623 # $sharedlib_from_linklib_result
3624 func_cygming_dll_for_implib ()
3627 sharedlib_from_linklib_result=`$DLLTOOL --identify-strict --identify "$1"`
3630 # func_cygming_dll_for_implib_fallback_core SECTION_NAME LIBNAMEs
3632 # The is the core of a fallback implementation of a
3633 # platform-specific function to extract the name of the
3634 # DLL associated with the specified import library LIBNAME.
3636 # SECTION_NAME is either .idata$6 or .idata$7, depending
3637 # on the platform and compiler that created the implib.
3639 # Echos the name of the DLL associated with the
3640 # specified import library.
3641 func_cygming_dll_for_implib_fallback_core ()
3644 match_literal=`$ECHO "$1" | $SED "$sed_make_literal_regex"`
3645 $OBJDUMP -s --section "$1" "$2" 2>/dev/null |
3646 $SED '/^Contents of section '"$match_literal"':/{
3647 # Place marker at beginning of archive member dllname section
3652 # These lines can sometimes be longer than 43 characters, but
3653 # are always uninteresting
3654 /:[ ]*file format pe[i]\{,1\}-/d
3655 /^In archive [^:]*:/d
3656 # Ensure marker is printed
3658 # Remove all lines with less than 43 characters
3660 # From remaining lines, remove first 43 characters
3663 # Join marker and all lines until next marker into a single line
3664 /^====MARK====/ b para
3673 # Remove trailing dots and whitespace
3677 # we now have a list, one entry per line, of the stringified
3678 # contents of the appropriate section of all members of the
3679 # archive which possess that section. Heuristic: eliminate
3680 # all those which have a first or second character that is
3681 # a '.' (that is, objdump's representation of an unprintable
3682 # character.) This should work for all archives with less than
3683 # 0x302f exports -- but will fail for DLLs whose name actually
3684 # begins with a literal '.' or a single character followed by
3687 # Of those that remain, print the first one.
3688 $SED -e '/^\./d;/^.\./d;q'
3691 # func_cygming_gnu_implib_p ARG
3692 # This predicate returns with zero status (TRUE) if
3693 # ARG is a GNU/binutils-style import library. Returns
3694 # with nonzero status (FALSE) otherwise.
3695 func_cygming_gnu_implib_p ()
3698 func_to_tool_file "$1" func_convert_file_msys_to_w32
3699 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)$'`
3700 test -n "$func_cygming_gnu_implib_tmp"
3703 # func_cygming_ms_implib_p ARG
3704 # This predicate returns with zero status (TRUE) if
3705 # ARG is an MS-style import library. Returns
3706 # with nonzero status (FALSE) otherwise.
3707 func_cygming_ms_implib_p ()
3710 func_to_tool_file "$1" func_convert_file_msys_to_w32
3711 func_cygming_ms_implib_tmp=`$NM "$func_to_tool_file_result" | eval "$global_symbol_pipe" | $GREP '_NULL_IMPORT_DESCRIPTOR'`
3712 test -n "$func_cygming_ms_implib_tmp"
3715 # func_cygming_dll_for_implib_fallback ARG
3716 # Platform-specific function to extract the
3717 # name of the DLL associated with the specified
3718 # import library ARG.
3720 # This fallback implementation is for use when $DLLTOOL
3721 # does not support the --identify-strict option.
3722 # Invoked by eval'ing the libtool variable
3723 # $sharedlib_from_linklib_cmd
3724 # Result is available in the variable
3725 # $sharedlib_from_linklib_result
3726 func_cygming_dll_for_implib_fallback ()
3729 if func_cygming_gnu_implib_p "$1" ; then
3730 # binutils import library
3731 sharedlib_from_linklib_result=`func_cygming_dll_for_implib_fallback_core '.idata$7' "$1"`
3732 elif func_cygming_ms_implib_p "$1" ; then
3733 # ms-generated import library
3734 sharedlib_from_linklib_result=`func_cygming_dll_for_implib_fallback_core '.idata$6' "$1"`
3737 sharedlib_from_linklib_result=""
3742 # func_extract_an_archive dir oldlib
3743 func_extract_an_archive ()
3746 f_ex_an_ar_dir="$1"; shift
3747 f_ex_an_ar_oldlib="$1"
3748 if test "$lock_old_archive_extraction" = yes; then
3749 lockfile=$f_ex_an_ar_oldlib.lock
3750 until $opt_dry_run || ln "$progpath" "$lockfile" 2>/dev/null; do
3751 func_echo "Waiting for $lockfile to be removed"
3755 func_show_eval "(cd \$f_ex_an_ar_dir && $AR x \"\$f_ex_an_ar_oldlib\")" \
3756 'stat=$?; rm -f "$lockfile"; exit $stat'
3757 if test "$lock_old_archive_extraction" = yes; then
3758 $opt_dry_run || rm -f "$lockfile"
3760 if ($AR t "$f_ex_an_ar_oldlib" | sort | sort -uc >/dev/null 2>&1); then
3763 func_fatal_error "object name conflicts in archive: $f_ex_an_ar_dir/$f_ex_an_ar_oldlib"
3768 # func_extract_archives gentop oldlib ...
3769 func_extract_archives ()
3772 my_gentop="$1"; shift
3773 my_oldlibs=${1+"$@"}
3779 for my_xlib in $my_oldlibs; do
3780 # Extract the objects.
3782 [\\/]* | [A-Za-z]:[\\/]*) my_xabs="$my_xlib" ;;
3783 *) my_xabs=`pwd`"/$my_xlib" ;;
3785 func_basename "$my_xlib"
3786 my_xlib="$func_basename_result"
3789 case " $extracted_archives " in
3791 func_arith $extracted_serial + 1
3792 extracted_serial=$func_arith_result
3793 my_xlib_u=lt$extracted_serial-$my_xlib ;;
3797 extracted_archives="$extracted_archives $my_xlib_u"
3798 my_xdir="$my_gentop/$my_xlib_u"
3800 func_mkdir_p "$my_xdir"
3804 func_verbose "Extracting $my_xabs"
3805 # Do not bother doing anything if just a dry run
3807 darwin_orig_dir=`pwd`
3808 cd $my_xdir || exit $?
3809 darwin_archive=$my_xabs
3811 darwin_base_archive=`basename "$darwin_archive"`
3812 darwin_arches=`$LIPO -info "$darwin_archive" 2>/dev/null | $GREP Architectures 2>/dev/null || true`
3813 if test -n "$darwin_arches"; then
3814 darwin_arches=`$ECHO "$darwin_arches" | $SED -e 's/.*are://'`
3816 func_verbose "$darwin_base_archive has multiple architectures $darwin_arches"
3817 for darwin_arch in $darwin_arches ; do
3818 func_mkdir_p "unfat-$$/${darwin_base_archive}-${darwin_arch}"
3819 $LIPO -thin $darwin_arch -output "unfat-$$/${darwin_base_archive}-${darwin_arch}/${darwin_base_archive}" "${darwin_archive}"
3820 cd "unfat-$$/${darwin_base_archive}-${darwin_arch}"
3821 func_extract_an_archive "`pwd`" "${darwin_base_archive}"
3823 $RM "unfat-$$/${darwin_base_archive}-${darwin_arch}/${darwin_base_archive}"
3824 done # $darwin_arches
3825 ## Okay now we've a bunch of thin objects, gotta fatten them up :)
3826 darwin_filelist=`find unfat-$$ -type f -name \*.o -print -o -name \*.lo -print | $SED -e "$basename" | sort -u`
3829 for darwin_file in $darwin_filelist; do
3830 darwin_files=`find unfat-$$ -name $darwin_file -print | sort | $NL2SP`
3831 $LIPO -create -output "$darwin_file" $darwin_files
3832 done # $darwin_filelist
3834 cd "$darwin_orig_dir"
3837 func_extract_an_archive "$my_xdir" "$my_xabs"
3842 func_extract_an_archive "$my_xdir" "$my_xabs"
3845 my_oldobjs="$my_oldobjs "`find $my_xdir -name \*.$objext -print -o -name \*.lo -print | sort | $NL2SP`
3848 func_extract_archives_result="$my_oldobjs"
3852 # func_emit_wrapper [arg=no]
3854 # Emit a libtool wrapper script on stdout.
3855 # Don't directly open a file because we may want to
3856 # incorporate the script contents within a cygwin/mingw
3857 # wrapper executable. Must ONLY be called from within
3858 # func_mode_link because it depends on a number of variables
3861 # ARG is the value that the WRAPPER_SCRIPT_BELONGS_IN_OBJDIR
3862 # variable will take. If 'yes', then the emitted script
3863 # will assume that the directory in which it is stored is
3864 # the $objdir directory. This is a cygwin/mingw-specific
3866 func_emit_wrapper ()
3868 func_emit_wrapper_arg1=${1-no}
3873 # $output - temporary wrapper script for $objdir/$outputname
3874 # Generated by $PROGRAM (GNU $PACKAGE$TIMESTAMP) $VERSION
3876 # The $output program cannot be directly executed until all the libtool
3877 # libraries that it depends on are installed.
3879 # This wrapper script should never be moved out of the build directory.
3880 # If it is, it will not operate correctly.
3882 # Sed substitution that helps us do robust quoting. It backslashifies
3883 # metacharacters that are still active within double-quoted strings.
3884 sed_quote_subst='$sed_quote_subst'
3886 # Be Bourne compatible
3887 if test -n \"\${ZSH_VERSION+set}\" && (emulate sh) >/dev/null 2>&1; then
3890 # Zsh 3.x and 4.x performs word splitting on \${1+\"\$@\"}, which
3891 # is contrary to our usage. Disable this feature.
3892 alias -g '\${1+\"\$@\"}'='\"\$@\"'
3893 setopt NO_GLOB_SUBST
3895 case \`(set -o) 2>/dev/null\` in *posix*) set -o posix;; esac
3897 BIN_SH=xpg4; export BIN_SH # for Tru64
3898 DUALCASE=1; export DUALCASE # for MKS sh
3900 # The HP-UX ksh and POSIX shell print the target directory to stdout
3902 (unset CDPATH) >/dev/null 2>&1 && unset CDPATH
3904 relink_command=\"$relink_command\"
3906 # This environment variable determines our operation mode.
3907 if test \"\$libtool_install_magic\" = \"$magic\"; then
3908 # install mode needs the following variables:
3909 generated_by_libtool_version='$macro_version'
3910 notinst_deplibs='$notinst_deplibs'
3912 # When we are sourced in execute mode, \$file and \$ECHO are already set.
3913 if test \"\$libtool_execute_magic\" != \"$magic\"; then
3916 qECHO=`$ECHO "$ECHO" | $SED "$sed_quote_subst"`
3919 # A function that is used when there is no print builtin or printf.
3920 func_fallback_echo ()
3922 eval 'cat <<_LTECHO_EOF
3929 # Very basic option parsing. These options are (a) specific to
3930 # the libtool wrapper, (b) are identical between the wrapper
3931 # /script/ and the wrapper /executable/ which is used only on
3932 # windows platforms, and (c) all begin with the string "--lt-"
3933 # (application programs are unlikely to have options which match
3936 # There are only two supported options: --lt-debug and
3937 # --lt-dump-script. There is, deliberately, no --lt-help.
3939 # The first argument to this parsing function should be the
3940 # script's $0 value, followed by "$@".
3942 func_parse_lt_options ()
3948 case \"\$lt_opt\" in
3949 --lt-debug) lt_option_debug=1 ;;
3951 lt_dump_D=\`\$ECHO \"X\$lt_script_arg0\" | $SED -e 's/^X//' -e 's%/[^/]*$%%'\`
3952 test \"X\$lt_dump_D\" = \"X\$lt_script_arg0\" && lt_dump_D=.
3953 lt_dump_F=\`\$ECHO \"X\$lt_script_arg0\" | $SED -e 's/^X//' -e 's%^.*/%%'\`
3954 cat \"\$lt_dump_D/\$lt_dump_F\"
3958 \$ECHO \"Unrecognized --lt- option: '\$lt_opt'\" 1>&2
3964 # Print the debug banner immediately:
3965 if test -n \"\$lt_option_debug\"; then
3966 echo \"${outputname}:${output}:\${LINENO}: libtool wrapper (GNU $PACKAGE$TIMESTAMP) $VERSION\" 1>&2
3970 # Used when --lt-debug. Prints its arguments to stdout
3971 # (redirection is the responsibility of the caller)
3972 func_lt_dump_args ()
3977 \$ECHO \"${outputname}:${output}:\${LINENO}: newargv[\$lt_dump_args_N]: \$lt_arg\"
3978 lt_dump_args_N=\`expr \$lt_dump_args_N + 1\`
3982 # Core function for launching the target application
3983 func_exec_program_core ()
3987 # Backslashes separate directories on plain windows
3988 *-*-mingw | *-*-os2* | *-cegcc*)
3990 if test -n \"\$lt_option_debug\"; then
3991 \$ECHO \"${outputname}:${output}:\${LINENO}: newargv[0]: \$progdir\\\\\$program\" 1>&2
3992 func_lt_dump_args \${1+\"\$@\"} 1>&2
3994 exec \"\$progdir\\\\\$program\" \${1+\"\$@\"}
4000 if test -n \"\$lt_option_debug\"; then
4001 \$ECHO \"${outputname}:${output}:\${LINENO}: newargv[0]: \$progdir/\$program\" 1>&2
4002 func_lt_dump_args \${1+\"\$@\"} 1>&2
4004 exec \"\$progdir/\$program\" \${1+\"\$@\"}
4009 \$ECHO \"\$0: cannot exec \$program \$*\" 1>&2
4013 # A function to encapsulate launching the target application
4014 # Strips options in the --lt-* namespace from \$@ and
4015 # launches target application with the remaining arguments.
4016 func_exec_program ()
4022 *) set x \"\$@\" \"\$lt_wr_arg\"; shift;;
4026 func_exec_program_core \${1+\"\$@\"}
4030 func_parse_lt_options \"\$0\" \${1+\"\$@\"}
4032 # Find the directory that this script lives in.
4033 thisdir=\`\$ECHO \"\$file\" | $SED 's%/[^/]*$%%'\`
4034 test \"x\$thisdir\" = \"x\$file\" && thisdir=.
4036 # Follow symbolic links until we get to the real thisdir.
4037 file=\`ls -ld \"\$file\" | $SED -n 's/.*-> //p'\`
4038 while test -n \"\$file\"; do
4039 destdir=\`\$ECHO \"\$file\" | $SED 's%/[^/]*\$%%'\`
4041 # If there was a directory component, then change thisdir.
4042 if test \"x\$destdir\" != \"x\$file\"; then
4043 case \"\$destdir\" in
4044 [\\\\/]* | [A-Za-z]:[\\\\/]*) thisdir=\"\$destdir\" ;;
4045 *) thisdir=\"\$thisdir/\$destdir\" ;;
4049 file=\`\$ECHO \"\$file\" | $SED 's%^.*/%%'\`
4050 file=\`ls -ld \"\$thisdir/\$file\" | $SED -n 's/.*-> //p'\`
4053 # Usually 'no', except on cygwin/mingw when embedded into
4055 WRAPPER_SCRIPT_BELONGS_IN_OBJDIR=$func_emit_wrapper_arg1
4056 if test \"\$WRAPPER_SCRIPT_BELONGS_IN_OBJDIR\" = \"yes\"; then
4057 # special case for '.'
4058 if test \"\$thisdir\" = \".\"; then
4061 # remove .libs from thisdir
4062 case \"\$thisdir\" in
4063 *[\\\\/]$objdir ) thisdir=\`\$ECHO \"\$thisdir\" | $SED 's%[\\\\/][^\\\\/]*$%%'\` ;;
4064 $objdir ) thisdir=. ;;
4068 # Try to get the absolute directory name.
4069 absdir=\`cd \"\$thisdir\" && pwd\`
4070 test -n \"\$absdir\" && thisdir=\"\$absdir\"
4073 if test "$fast_install" = yes; then
4075 program=lt-'$outputname'$exeext
4076 progdir=\"\$thisdir/$objdir\"
4078 if test ! -f \"\$progdir/\$program\" ||
4079 { file=\`ls -1dt \"\$progdir/\$program\" \"\$progdir/../\$program\" 2>/dev/null | ${SED} 1q\`; \\
4080 test \"X\$file\" != \"X\$progdir/\$program\"; }; then
4082 file=\"\$\$-\$program\"
4084 if test ! -d \"\$progdir\"; then
4085 $MKDIR \"\$progdir\"
4087 $RM \"\$progdir/\$file\"
4092 # relink executable if necessary
4093 if test -n \"\$relink_command\"; then
4094 if relink_command_output=\`eval \$relink_command 2>&1\`; then :
4096 $ECHO \"\$relink_command_output\" >&2
4097 $RM \"\$progdir/\$file\"
4102 $MV \"\$progdir/\$file\" \"\$progdir/\$program\" 2>/dev/null ||
4103 { $RM \"\$progdir/\$program\";
4104 $MV \"\$progdir/\$file\" \"\$progdir/\$program\"; }
4105 $RM \"\$progdir/\$file\"
4109 program='$outputname'
4110 progdir=\"\$thisdir/$objdir\"
4116 if test -f \"\$progdir/\$program\"; then"
4118 # fixup the dll searchpath if we need to.
4120 # Fix the DLL searchpath if we need to. Do this before prepending
4121 # to shlibpath, because on Windows, both are PATH and uninstalled
4122 # libraries must come first.
4123 if test -n "$dllsearchpath"; then
4125 # Add the dll search path components to the executable PATH
4126 PATH=$dllsearchpath:\$PATH
4130 # Export our shlibpath_var if we have one.
4131 if test "$shlibpath_overrides_runpath" = yes && test -n "$shlibpath_var" && test -n "$temp_rpath"; then
4133 # Add our own library path to $shlibpath_var
4134 $shlibpath_var=\"$temp_rpath\$$shlibpath_var\"
4136 # Some systems cannot cope with colon-terminated $shlibpath_var
4137 # The second colon is a workaround for a bug in BeOS R4 sed
4138 $shlibpath_var=\`\$ECHO \"\$$shlibpath_var\" | $SED 's/::*\$//'\`
4140 export $shlibpath_var
4145 if test \"\$libtool_execute_magic\" != \"$magic\"; then
4146 # Run the actual program with our arguments.
4147 func_exec_program \${1+\"\$@\"}
4150 # The program doesn't exist.
4151 \$ECHO \"\$0: error: \\\`\$progdir/\$program' does not exist\" 1>&2
4152 \$ECHO \"This script is just a wrapper for \$program.\" 1>&2
4153 \$ECHO \"See the $PACKAGE documentation for more information.\" 1>&2
4161 # func_emit_cwrapperexe_src
4162 # emit the source code for a wrapper executable on stdout
4163 # Must ONLY be called from within func_mode_link because
4164 # it depends on a number of variable set therein.
4165 func_emit_cwrapperexe_src ()
4169 /* $cwrappersource - temporary wrapper executable for $objdir/$outputname
4170 Generated by $PROGRAM (GNU $PACKAGE$TIMESTAMP) $VERSION
4172 The $output program cannot be directly executed until all the libtool
4173 libraries that it depends on are installed.
4175 This wrapper executable should never be moved out of the build directory.
4176 If it is, it will not operate correctly.
4181 # define _CRT_SECURE_NO_DEPRECATE 1
4186 # include <direct.h>
4187 # include <process.h>
4190 # include <unistd.h>
4191 # include <stdint.h>
4203 #include <sys/stat.h>
4205 /* declarations of non-ANSI functions */
4206 #if defined(__MINGW32__)
4207 # ifdef __STRICT_ANSI__
4208 int _putenv (const char *);
4210 #elif defined(__CYGWIN__)
4211 # ifdef __STRICT_ANSI__
4212 char *realpath (const char *, char *);
4213 int putenv (char *);
4214 int setenv (const char *, const char *, int);
4216 /* #elif defined (other platforms) ... */
4219 /* portability defines, excluding path handling macros */
4220 #if defined(_MSC_VER)
4221 # define setmode _setmode
4223 # define chmod _chmod
4224 # define getcwd _getcwd
4225 # define putenv _putenv
4226 # define S_IXUSR _S_IEXEC
4227 # ifndef _INTPTR_T_DEFINED
4228 # define _INTPTR_T_DEFINED
4229 # define intptr_t int
4231 #elif defined(__MINGW32__)
4232 # define setmode _setmode
4234 # define chmod _chmod
4235 # define getcwd _getcwd
4236 # define putenv _putenv
4237 #elif defined(__CYGWIN__)
4238 # define HAVE_SETENV
4239 # define FOPEN_WB "wb"
4240 /* #elif defined (other platforms) ... */
4243 #if defined(PATH_MAX)
4244 # define LT_PATHMAX PATH_MAX
4245 #elif defined(MAXPATHLEN)
4246 # define LT_PATHMAX MAXPATHLEN
4248 # define LT_PATHMAX 1024
4258 /* path handling portability macros */
4259 #ifndef DIR_SEPARATOR
4260 # define DIR_SEPARATOR '/'
4261 # define PATH_SEPARATOR ':'
4264 #if defined (_WIN32) || defined (__MSDOS__) || defined (__DJGPP__) || \
4266 # define HAVE_DOS_BASED_FILE_SYSTEM
4267 # define FOPEN_WB "wb"
4268 # ifndef DIR_SEPARATOR_2
4269 # define DIR_SEPARATOR_2 '\\'
4271 # ifndef PATH_SEPARATOR_2
4272 # define PATH_SEPARATOR_2 ';'
4276 #ifndef DIR_SEPARATOR_2
4277 # define IS_DIR_SEPARATOR(ch) ((ch) == DIR_SEPARATOR)
4278 #else /* DIR_SEPARATOR_2 */
4279 # define IS_DIR_SEPARATOR(ch) \
4280 (((ch) == DIR_SEPARATOR) || ((ch) == DIR_SEPARATOR_2))
4281 #endif /* DIR_SEPARATOR_2 */
4283 #ifndef PATH_SEPARATOR_2
4284 # define IS_PATH_SEPARATOR(ch) ((ch) == PATH_SEPARATOR)
4285 #else /* PATH_SEPARATOR_2 */
4286 # define IS_PATH_SEPARATOR(ch) ((ch) == PATH_SEPARATOR_2)
4287 #endif /* PATH_SEPARATOR_2 */
4290 # define FOPEN_WB "w"
4293 # define _O_BINARY 0
4296 #define XMALLOC(type, num) ((type *) xmalloc ((num) * sizeof(type)))
4297 #define XFREE(stale) do { \
4298 if (stale) { free ((void *) stale); stale = 0; } \
4301 #if defined(LT_DEBUGWRAPPER)
4302 static int lt_debug = 1;
4304 static int lt_debug = 0;
4307 const char *program_name = "libtool-wrapper"; /* in case xstrdup fails */
4309 void *xmalloc (size_t num);
4310 char *xstrdup (const char *string);
4311 const char *base_name (const char *name);
4312 char *find_executable (const char *wrapper);
4313 char *chase_symlinks (const char *pathspec);
4314 int make_executable (const char *path);
4315 int check_executable (const char *path);
4316 char *strendzap (char *str, const char *pat);
4317 void lt_debugprintf (const char *file, int line, const char *fmt, ...);
4318 void lt_fatal (const char *file, int line, const char *message, ...);
4319 static const char *nonnull (const char *s);
4320 static const char *nonempty (const char *s);
4321 void lt_setenv (const char *name, const char *value);
4322 char *lt_extend_str (const char *orig_value, const char *add, int to_end);
4323 void lt_update_exe_path (const char *name, const char *value);
4324 void lt_update_lib_path (const char *name, const char *value);
4325 char **prepare_spawn (char **argv);
4326 void lt_dump_script (FILE *f);
4330 volatile const char * MAGIC_EXE = "$magic_exe";
4331 const char * LIB_PATH_VARNAME = "$shlibpath_var";
4334 if test "$shlibpath_overrides_runpath" = yes && test -n "$shlibpath_var" && test -n "$temp_rpath"; then
4335 func_to_host_path "$temp_rpath"
4337 const char * LIB_PATH_VALUE = "$func_to_host_path_result";
4341 const char * LIB_PATH_VALUE = "";
4345 if test -n "$dllsearchpath"; then
4346 func_to_host_path "$dllsearchpath:"
4348 const char * EXE_PATH_VARNAME = "PATH";
4349 const char * EXE_PATH_VALUE = "$func_to_host_path_result";
4353 const char * EXE_PATH_VARNAME = "";
4354 const char * EXE_PATH_VALUE = "";
4358 if test "$fast_install" = yes; then
4360 const char * TARGET_PROGRAM_NAME = "lt-$outputname"; /* hopefully, no .exe */
4364 const char * TARGET_PROGRAM_NAME = "$outputname"; /* hopefully, no .exe */
4371 #define LTWRAPPER_OPTION_PREFIX "--lt-"
4373 static const char *ltwrapper_option_prefix = LTWRAPPER_OPTION_PREFIX;
4374 static const char *dumpscript_opt = LTWRAPPER_OPTION_PREFIX "dump-script";
4375 static const char *debug_opt = LTWRAPPER_OPTION_PREFIX "debug";
4378 main (int argc, char *argv[])
4383 char *actual_cwrapper_path;
4384 char *actual_cwrapper_name;
4387 intptr_t rval = 127;
4391 program_name = (char *) xstrdup (base_name (argv[0]));
4392 newargz = XMALLOC (char *, argc + 1);
4394 /* very simple arg parsing; don't want to rely on getopt
4395 * also, copy all non cwrapper options to newargz, except
4396 * argz[0], which is handled differently
4399 for (i = 1; i < argc; i++)
4401 if (strcmp (argv[i], dumpscript_opt) == 0)
4405 *mingw* | *cygwin* )
4406 # make stdout use "unix" line endings
4407 echo " setmode(1,_O_BINARY);"
4412 lt_dump_script (stdout);
4415 if (strcmp (argv[i], debug_opt) == 0)
4420 if (strcmp (argv[i], ltwrapper_option_prefix) == 0)
4422 /* however, if there is an option in the LTWRAPPER_OPTION_PREFIX
4423 namespace, but it is not one of the ones we know about and
4424 have already dealt with, above (inluding dump-script), then
4425 report an error. Otherwise, targets might begin to believe
4426 they are allowed to use options in the LTWRAPPER_OPTION_PREFIX
4427 namespace. The first time any user complains about this, we'll
4428 need to make LTWRAPPER_OPTION_PREFIX a configure-time option
4429 or a configure.ac-settable value.
4431 lt_fatal (__FILE__, __LINE__,
4432 "unrecognized %s option: '%s'",
4433 ltwrapper_option_prefix, argv[i]);
4436 newargz[++newargc] = xstrdup (argv[i]);
4438 newargz[++newargc] = NULL;
4442 /* The GNU banner must be the first non-error debug message */
4443 lt_debugprintf (__FILE__, __LINE__, "libtool wrapper (GNU $PACKAGE$TIMESTAMP) $VERSION\n");
4446 lt_debugprintf (__FILE__, __LINE__, "(main) argv[0]: %s\n", argv[0]);
4447 lt_debugprintf (__FILE__, __LINE__, "(main) program_name: %s\n", program_name);
4449 tmp_pathspec = find_executable (argv[0]);
4450 if (tmp_pathspec == NULL)
4451 lt_fatal (__FILE__, __LINE__, "couldn't find %s", argv[0]);
4452 lt_debugprintf (__FILE__, __LINE__,
4453 "(main) found exe (before symlink chase) at: %s\n",
4456 actual_cwrapper_path = chase_symlinks (tmp_pathspec);
4457 lt_debugprintf (__FILE__, __LINE__,
4458 "(main) found exe (after symlink chase) at: %s\n",
4459 actual_cwrapper_path);
4460 XFREE (tmp_pathspec);
4462 actual_cwrapper_name = xstrdup (base_name (actual_cwrapper_path));
4463 strendzap (actual_cwrapper_path, actual_cwrapper_name);
4465 /* wrapper name transforms */
4466 strendzap (actual_cwrapper_name, ".exe");
4467 tmp_pathspec = lt_extend_str (actual_cwrapper_name, ".exe", 1);
4468 XFREE (actual_cwrapper_name);
4469 actual_cwrapper_name = tmp_pathspec;
4472 /* target_name transforms -- use actual target program name; might have lt- prefix */
4473 target_name = xstrdup (base_name (TARGET_PROGRAM_NAME));
4474 strendzap (target_name, ".exe");
4475 tmp_pathspec = lt_extend_str (target_name, ".exe", 1);
4476 XFREE (target_name);
4477 target_name = tmp_pathspec;
4480 lt_debugprintf (__FILE__, __LINE__,
4481 "(main) libtool target name: %s\n",
4487 XMALLOC (char, (strlen (actual_cwrapper_path) +
4488 strlen ("$objdir") + 1 + strlen (actual_cwrapper_name) + 1));
4489 strcpy (newargz[0], actual_cwrapper_path);
4490 strcat (newargz[0], "$objdir");
4491 strcat (newargz[0], "/");
4495 /* stop here, and copy so we don't have to do this twice */
4496 tmp_pathspec = xstrdup (newargz[0]);
4498 /* do NOT want the lt- prefix here, so use actual_cwrapper_name */
4499 strcat (newargz[0], actual_cwrapper_name);
4501 /* DO want the lt- prefix here if it exists, so use target_name */
4502 lt_argv_zero = lt_extend_str (tmp_pathspec, target_name, 1);
4503 XFREE (tmp_pathspec);
4504 tmp_pathspec = NULL;
4512 while ((p = strchr (newargz[0], '\\')) != NULL)
4516 while ((p = strchr (lt_argv_zero, '\\')) != NULL)
4526 XFREE (target_name);
4527 XFREE (actual_cwrapper_path);
4528 XFREE (actual_cwrapper_name);
4530 lt_setenv ("BIN_SH", "xpg4"); /* for Tru64 */
4531 lt_setenv ("DUALCASE", "1"); /* for MSK sh */
4532 /* Update the DLL searchpath. EXE_PATH_VALUE ($dllsearchpath) must
4533 be prepended before (that is, appear after) LIB_PATH_VALUE ($temp_rpath)
4534 because on Windows, both *_VARNAMEs are PATH but uninstalled
4535 libraries must come first. */
4536 lt_update_exe_path (EXE_PATH_VARNAME, EXE_PATH_VALUE);
4537 lt_update_lib_path (LIB_PATH_VARNAME, LIB_PATH_VALUE);
4539 lt_debugprintf (__FILE__, __LINE__, "(main) lt_argv_zero: %s\n",
4540 nonnull (lt_argv_zero));
4541 for (i = 0; i < newargc; i++)
4543 lt_debugprintf (__FILE__, __LINE__, "(main) newargz[%d]: %s\n",
4544 i, nonnull (newargz[i]));
4552 /* execv doesn't actually work on mingw as expected on unix */
4553 newargz = prepare_spawn (newargz);
4554 rval = _spawnv (_P_WAIT, lt_argv_zero, (const char * const *) newargz);
4557 /* failed to start process */
4558 lt_debugprintf (__FILE__, __LINE__,
4559 "(main) failed to launch target \"%s\": %s\n",
4560 lt_argv_zero, nonnull (strerror (errno)));
4568 execv (lt_argv_zero, newargz);
4569 return rval; /* =127, but avoids unused variable warning */
4578 xmalloc (size_t num)
4580 void *p = (void *) malloc (num);
4582 lt_fatal (__FILE__, __LINE__, "memory exhausted");
4588 xstrdup (const char *string)
4590 return string ? strcpy ((char *) xmalloc (strlen (string) + 1),
4595 base_name (const char *name)
4599 #if defined (HAVE_DOS_BASED_FILE_SYSTEM)
4600 /* Skip over the disk name in MSDOS pathnames. */
4601 if (isalpha ((unsigned char) name[0]) && name[1] == ':')
4605 for (base = name; *name; name++)
4606 if (IS_DIR_SEPARATOR (*name))
4612 check_executable (const char *path)
4616 lt_debugprintf (__FILE__, __LINE__, "(check_executable): %s\n",
4618 if ((!path) || (!*path))
4621 if ((stat (path, &st) >= 0)
4622 && (st.st_mode & (S_IXUSR | S_IXGRP | S_IXOTH)))
4629 make_executable (const char *path)
4634 lt_debugprintf (__FILE__, __LINE__, "(make_executable): %s\n",
4636 if ((!path) || (!*path))
4639 if (stat (path, &st) >= 0)
4641 rval = chmod (path, st.st_mode | S_IXOTH | S_IXGRP | S_IXUSR);
4646 /* Searches for the full path of the wrapper. Returns
4647 newly allocated full path name if found, NULL otherwise
4648 Does not chase symlinks, even on platforms that support them.
4651 find_executable (const char *wrapper)
4656 /* static buffer for getcwd */
4657 char tmp[LT_PATHMAX + 1];
4661 lt_debugprintf (__FILE__, __LINE__, "(find_executable): %s\n",
4662 nonempty (wrapper));
4664 if ((wrapper == NULL) || (*wrapper == '\0'))
4667 /* Absolute path? */
4668 #if defined (HAVE_DOS_BASED_FILE_SYSTEM)
4669 if (isalpha ((unsigned char) wrapper[0]) && wrapper[1] == ':')
4671 concat_name = xstrdup (wrapper);
4672 if (check_executable (concat_name))
4674 XFREE (concat_name);
4679 if (IS_DIR_SEPARATOR (wrapper[0]))
4681 concat_name = xstrdup (wrapper);
4682 if (check_executable (concat_name))
4684 XFREE (concat_name);
4686 #if defined (HAVE_DOS_BASED_FILE_SYSTEM)
4690 for (p = wrapper; *p; p++)
4698 /* no slashes; search PATH */
4699 const char *path = getenv ("PATH");
4702 for (p = path; *p; p = p_next)
4706 for (q = p; *q; q++)
4707 if (IS_PATH_SEPARATOR (*q))
4710 p_next = (*q == '\0' ? q : q + 1);
4713 /* empty path: current directory */
4714 if (getcwd (tmp, LT_PATHMAX) == NULL)
4715 lt_fatal (__FILE__, __LINE__, "getcwd failed: %s",
4716 nonnull (strerror (errno)));
4717 tmp_len = strlen (tmp);
4719 XMALLOC (char, tmp_len + 1 + strlen (wrapper) + 1);
4720 memcpy (concat_name, tmp, tmp_len);
4721 concat_name[tmp_len] = '/';
4722 strcpy (concat_name + tmp_len + 1, wrapper);
4727 XMALLOC (char, p_len + 1 + strlen (wrapper) + 1);
4728 memcpy (concat_name, p, p_len);
4729 concat_name[p_len] = '/';
4730 strcpy (concat_name + p_len + 1, wrapper);
4732 if (check_executable (concat_name))
4734 XFREE (concat_name);
4737 /* not found in PATH; assume curdir */
4739 /* Relative path | not found in path: prepend cwd */
4740 if (getcwd (tmp, LT_PATHMAX) == NULL)
4741 lt_fatal (__FILE__, __LINE__, "getcwd failed: %s",
4742 nonnull (strerror (errno)));
4743 tmp_len = strlen (tmp);
4744 concat_name = XMALLOC (char, tmp_len + 1 + strlen (wrapper) + 1);
4745 memcpy (concat_name, tmp, tmp_len);
4746 concat_name[tmp_len] = '/';
4747 strcpy (concat_name + tmp_len + 1, wrapper);
4749 if (check_executable (concat_name))
4751 XFREE (concat_name);
4756 chase_symlinks (const char *pathspec)
4759 return xstrdup (pathspec);
4761 char buf[LT_PATHMAX];
4763 char *tmp_pathspec = xstrdup (pathspec);
4765 int has_symlinks = 0;
4766 while (strlen (tmp_pathspec) && !has_symlinks)
4768 lt_debugprintf (__FILE__, __LINE__,
4769 "checking path component for symlinks: %s\n",
4771 if (lstat (tmp_pathspec, &s) == 0)
4773 if (S_ISLNK (s.st_mode) != 0)
4779 /* search backwards for last DIR_SEPARATOR */
4780 p = tmp_pathspec + strlen (tmp_pathspec) - 1;
4781 while ((p > tmp_pathspec) && (!IS_DIR_SEPARATOR (*p)))
4783 if ((p == tmp_pathspec) && (!IS_DIR_SEPARATOR (*p)))
4785 /* no more DIR_SEPARATORS left */
4792 lt_fatal (__FILE__, __LINE__,
4793 "error accessing file \"%s\": %s",
4794 tmp_pathspec, nonnull (strerror (errno)));
4797 XFREE (tmp_pathspec);
4801 return xstrdup (pathspec);
4804 tmp_pathspec = realpath (pathspec, buf);
4805 if (tmp_pathspec == 0)
4807 lt_fatal (__FILE__, __LINE__,
4808 "could not follow symlinks for %s", pathspec);
4810 return xstrdup (tmp_pathspec);
4815 strendzap (char *str, const char *pat)
4819 assert (str != NULL);
4820 assert (pat != NULL);
4823 patlen = strlen (pat);
4827 str += len - patlen;
4828 if (strcmp (str, pat) == 0)
4835 lt_debugprintf (const char *file, int line, const char *fmt, ...)
4840 (void) fprintf (stderr, "%s:%s:%d: ", program_name, file, line);
4841 va_start (args, fmt);
4842 (void) vfprintf (stderr, fmt, args);
4848 lt_error_core (int exit_status, const char *file,
4849 int line, const char *mode,
4850 const char *message, va_list ap)
4852 fprintf (stderr, "%s:%s:%d: %s: ", program_name, file, line, mode);
4853 vfprintf (stderr, message, ap);
4854 fprintf (stderr, ".\n");
4856 if (exit_status >= 0)
4861 lt_fatal (const char *file, int line, const char *message, ...)
4864 va_start (ap, message);
4865 lt_error_core (EXIT_FAILURE, file, line, "FATAL", message, ap);
4870 nonnull (const char *s)
4872 return s ? s : "(null)";
4876 nonempty (const char *s)
4878 return (s && !*s) ? "(empty)" : nonnull (s);
4882 lt_setenv (const char *name, const char *value)
4884 lt_debugprintf (__FILE__, __LINE__,
4885 "(lt_setenv) setting '%s' to '%s'\n",
4886 nonnull (name), nonnull (value));
4889 /* always make a copy, for consistency with !HAVE_SETENV */
4890 char *str = xstrdup (value);
4891 setenv (name, str, 1);
4893 int len = strlen (name) + 1 + strlen (value) + 1;
4894 char *str = XMALLOC (char, len);
4895 sprintf (str, "%s=%s", name, value);
4896 if (putenv (str) != EXIT_SUCCESS)
4905 lt_extend_str (const char *orig_value, const char *add, int to_end)
4908 if (orig_value && *orig_value)
4910 int orig_value_len = strlen (orig_value);
4911 int add_len = strlen (add);
4912 new_value = XMALLOC (char, add_len + orig_value_len + 1);
4915 strcpy (new_value, orig_value);
4916 strcpy (new_value + orig_value_len, add);
4920 strcpy (new_value, add);
4921 strcpy (new_value + add_len, orig_value);
4926 new_value = xstrdup (add);
4932 lt_update_exe_path (const char *name, const char *value)
4934 lt_debugprintf (__FILE__, __LINE__,
4935 "(lt_update_exe_path) modifying '%s' by prepending '%s'\n",
4936 nonnull (name), nonnull (value));
4938 if (name && *name && value && *value)
4940 char *new_value = lt_extend_str (getenv (name), value, 0);
4941 /* some systems can't cope with a ':'-terminated path #' */
4942 int len = strlen (new_value);
4943 while (((len = strlen (new_value)) > 0) && IS_PATH_SEPARATOR (new_value[len-1]))
4945 new_value[len-1] = '\0';
4947 lt_setenv (name, new_value);
4953 lt_update_lib_path (const char *name, const char *value)
4955 lt_debugprintf (__FILE__, __LINE__,
4956 "(lt_update_lib_path) modifying '%s' by prepending '%s'\n",
4957 nonnull (name), nonnull (value));
4959 if (name && *name && value && *value)
4961 char *new_value = lt_extend_str (getenv (name), value, 0);
4962 lt_setenv (name, new_value);
4972 /* Prepares an argument vector before calling spawn().
4973 Note that spawn() does not by itself call the command interpreter
4974 (getenv ("COMSPEC") != NULL ? getenv ("COMSPEC") :
4975 ({ OSVERSIONINFO v; v.dwOSVersionInfoSize = sizeof(OSVERSIONINFO);
4977 v.dwPlatformId == VER_PLATFORM_WIN32_NT;
4978 }) ? "cmd.exe" : "command.com").
4979 Instead it simply concatenates the arguments, separated by ' ', and calls
4980 CreateProcess(). We must quote the arguments since Win32 CreateProcess()
4981 interprets characters like ' ', '\t', '\\', '"' (but not '<' and '>') in a
4983 - Space and tab are interpreted as delimiters. They are not treated as
4984 delimiters if they are surrounded by double quotes: "...".
4985 - Unescaped double quotes are removed from the input. Their only effect is
4986 that within double quotes, space and tab are treated like normal
4988 - Backslashes not followed by double quotes are not special.
4989 - But 2*n+1 backslashes followed by a double quote become
4990 n backslashes followed by a double quote (n >= 0):
4995 #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"
4996 #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"
4998 prepare_spawn (char **argv)
5004 /* Count number of arguments. */
5005 for (argc = 0; argv[argc] != NULL; argc++)
5008 /* Allocate new argument vector. */
5009 new_argv = XMALLOC (char *, argc + 1);
5011 /* Put quoted arguments into the new argument vector. */
5012 for (i = 0; i < argc; i++)
5014 const char *string = argv[i];
5016 if (string[0] == '\0')
5017 new_argv[i] = xstrdup ("\"\"");
5018 else if (strpbrk (string, SHELL_SPECIAL_CHARS) != NULL)
5020 int quote_around = (strpbrk (string, SHELL_SPACE_CHARS) != NULL);
5022 unsigned int backslashes;
5024 char *quoted_string;
5031 for (s = string; *s != '\0'; s++)
5035 length += backslashes + 1;
5043 length += backslashes + 1;
5045 quoted_string = XMALLOC (char, length + 1);
5051 for (s = string; *s != '\0'; s++)
5057 for (j = backslashes + 1; j > 0; j--)
5069 for (j = backslashes; j > 0; j--)
5075 new_argv[i] = quoted_string;
5078 new_argv[i] = (char *) string;
5080 new_argv[argc] = NULL;
5089 void lt_dump_script (FILE* f)
5092 func_emit_wrapper yes |
5093 $SED -e 's/\([\\"]\)/\\\1/g' \
5094 -e 's/^/ fputs ("/' -e 's/$/\\n", f);/'
5100 # end: func_emit_cwrapperexe_src
5102 # func_win32_import_lib_p ARG
5103 # True if ARG is an import lib, as indicated by $file_magic_cmd
5104 func_win32_import_lib_p ()
5107 case `eval $file_magic_cmd \"\$1\" 2>/dev/null | $SED -e 10q` in
5113 # func_mode_link arg...
5118 *-*-cygwin* | *-*-mingw* | *-*-pw32* | *-*-os2* | *-cegcc*)
5119 # It is impossible to link a dll without this setting, and
5120 # we shouldn't force the makefile maintainer to figure out
5121 # which system we are compiling for in order to pass an extra
5122 # flag for every libtool invocation.
5123 # allow_undefined=no
5125 # FIXME: Unfortunately, there are problems with the above when trying
5126 # to make a dll which has undefined symbols, in which case not
5127 # even a static library is built. For now, we need to specify
5128 # -no-undefined on the libtool link line when we can be certain
5129 # that all symbols are satisfied, otherwise we get a static library.
5136 libtool_args=$nonopt
5137 base_compile="$nonopt $@"
5138 compile_command=$nonopt
5139 finalize_command=$nonopt
5152 lib_search_path=`pwd`
5154 new_inherited_linker_flags=
5163 export_symbols_regex=
5171 precious_files_regex=
5172 prefer_static_libs=no
5185 single_module="${wl}-single_module"
5186 func_infer_tag $base_compile
5188 # We need to know -static, to get the right output filenames.
5193 test "$build_libtool_libs" != yes && \
5194 func_fatal_configuration "can not build a shared library"
5198 -all-static | -static | -static-libtool-libs)
5201 if test "$build_libtool_libs" = yes && test -z "$link_static_flag"; then
5202 func_warning "complete static linking is impossible in this configuration"
5204 if test -n "$link_static_flag"; then
5205 dlopen_self=$dlopen_self_static
5207 prefer_static_libs=yes
5210 if test -z "$pic_flag" && test -n "$link_static_flag"; then
5211 dlopen_self=$dlopen_self_static
5213 prefer_static_libs=built
5215 -static-libtool-libs)
5216 if test -z "$pic_flag" && test -n "$link_static_flag"; then
5217 dlopen_self=$dlopen_self_static
5219 prefer_static_libs=yes
5222 build_libtool_libs=no
5229 # See if our shared archives depend on static archives.
5230 test -n "$old_archive_from_new_cmds" && build_old_libs=yes
5232 # Go through the arguments, transforming them on the way.
5233 while test "$#" -gt 0; do
5236 func_quote_for_eval "$arg"
5237 qarg=$func_quote_for_eval_unquoted_result
5238 func_append libtool_args " $func_quote_for_eval_result"
5240 # If the previous option needs an argument, assign it.
5241 if test -n "$prev"; then
5244 func_append compile_command " @OUTPUT@"
5245 func_append finalize_command " @OUTPUT@"
5256 if test "$preload" = no; then
5257 # Add the symbol object into the linking commands.
5258 func_append compile_command " @SYMFILE@"
5259 func_append finalize_command " @SYMFILE@"
5263 *.la | *.lo) ;; # We handle these cases below.
5265 if test "$dlself" = no; then
5273 if test "$prev" = dlprefiles; then
5275 elif test "$prev" = dlfiles && test "$dlopen_self" != yes; then
5285 if test "$prev" = dlfiles; then
5286 func_append dlfiles " $arg"
5288 func_append dlprefiles " $arg"
5296 export_symbols="$arg"
5298 || func_fatal_error "symbol file \`$arg' does not exist"
5303 export_symbols_regex="$arg"
5311 *" $qarg.ltframework "*) ;;
5312 *) func_append deplibs " $qarg.ltframework" # this is fixed later
5321 inst_prefix_dir="$arg"
5326 if test -f "$arg"; then
5329 for fil in `cat "$save_arg"`
5331 # func_append moreargs " $fil"
5333 # A libtool-controlled object.
5335 # Check to see that this really is a libtool object.
5336 if func_lalib_unsafe_p "$arg"; then
5343 if test -z "$pic_object" ||
5344 test -z "$non_pic_object" ||
5345 test "$pic_object" = none &&
5346 test "$non_pic_object" = none; then
5347 func_fatal_error "cannot find name of object for \`$arg'"
5350 # Extract subdirectory from the argument.
5351 func_dirname "$arg" "/" ""
5352 xdir="$func_dirname_result"
5354 if test "$pic_object" != none; then
5355 # Prepend the subdirectory the object is found in.
5356 pic_object="$xdir$pic_object"
5358 if test "$prev" = dlfiles; then
5359 if test "$build_libtool_libs" = yes && test "$dlopen_support" = yes; then
5360 func_append dlfiles " $pic_object"
5364 # If libtool objects are unsupported, then we need to preload.
5369 # CHECK ME: I think I busted this. -Ossama
5370 if test "$prev" = dlprefiles; then
5371 # Preload the old-style object.
5372 func_append dlprefiles " $pic_object"
5377 func_append libobjs " $pic_object"
5382 if test "$non_pic_object" != none; then
5383 # Prepend the subdirectory the object is found in.
5384 non_pic_object="$xdir$non_pic_object"
5386 # A standard non-PIC object
5387 func_append non_pic_objects " $non_pic_object"
5388 if test -z "$pic_object" || test "$pic_object" = none ; then
5389 arg="$non_pic_object"
5392 # If the PIC object exists, use it instead.
5393 # $xdir was prepended to $pic_object above.
5394 non_pic_object="$pic_object"
5395 func_append non_pic_objects " $non_pic_object"
5398 # Only an error if not doing a dry-run.
5399 if $opt_dry_run; then
5400 # Extract subdirectory from the argument.
5401 func_dirname "$arg" "/" ""
5402 xdir="$func_dirname_result"
5405 pic_object=$xdir$objdir/$func_lo2o_result
5406 non_pic_object=$xdir$func_lo2o_result
5407 func_append libobjs " $pic_object"
5408 func_append non_pic_objects " $non_pic_object"
5410 func_fatal_error "\`$arg' is not a valid libtool object"
5415 func_fatal_error "link input file \`$arg' does not exist"
5422 precious_files_regex="$arg"
5432 # We need an absolute path.
5434 [\\/]* | [A-Za-z]:[\\/]*) ;;
5436 func_fatal_error "only absolute run-paths are allowed"
5439 if test "$prev" = rpath; then
5442 *) func_append rpath " $arg" ;;
5447 *) func_append xrpath " $arg" ;;
5459 func_append weak_libs " $arg"
5464 func_append linker_flags " $qarg"
5465 func_append compiler_flags " $qarg"
5467 func_append compile_command " $qarg"
5468 func_append finalize_command " $qarg"
5472 func_append compiler_flags " $qarg"
5474 func_append compile_command " $qarg"
5475 func_append finalize_command " $qarg"
5479 func_append linker_flags " $qarg"
5480 func_append compiler_flags " $wl$qarg"
5482 func_append compile_command " $wl$qarg"
5483 func_append finalize_command " $wl$qarg"
5487 eval "$prev=\"\$arg\""
5492 fi # test -n "$prev"
5498 if test -n "$link_static_flag"; then
5499 # See comment for -static flag below, for more details.
5500 func_append compile_command " $link_static_flag"
5501 func_append finalize_command " $link_static_flag"
5507 # FIXME: remove this flag sometime in the future.
5508 func_fatal_error "\`-allow-undefined' must not be used because it is the default"
5536 -export-symbols | -export-symbols-regex)
5537 if test -n "$export_symbols" || test -n "$export_symbols_regex"; then
5538 func_fatal_error "more than one -exported-symbols argument is not allowed"
5540 if test "X$arg" = "X-export-symbols"; then
5558 # The native IRIX linker understands -LANG:*, -LIST:* and -LNO:*
5559 # so, if we see these flags be careful not to treat them like -L
5561 case $with_gcc/$host in
5562 no/*-*-irix* | /*-*-irix*)
5563 func_append compile_command " $arg"
5564 func_append finalize_command " $arg"
5571 func_stripname "-L" '' "$arg"
5572 if test -z "$func_stripname_result"; then
5573 if test "$#" -gt 0; then
5574 func_fatal_error "require no space between \`-L' and \`$1'"
5576 func_fatal_error "need path for \`-L' option"
5579 func_resolve_sysroot "$func_stripname_result"
5580 dir=$func_resolve_sysroot_result
5581 # We need an absolute path.
5583 [\\/]* | [A-Za-z]:[\\/]*) ;;
5585 absdir=`cd "$dir" && pwd`
5586 test -z "$absdir" && \
5587 func_fatal_error "cannot determine absolute directory name of \`$dir'"
5592 *" -L$dir "* | *" $arg "*)
5593 # Will only happen for absolute or sysroot arguments
5596 # Preserve sysroot, but never include relative directories
5598 [\\/]* | [A-Za-z]:[\\/]* | =*) func_append deplibs " $arg" ;;
5599 *) func_append deplibs " -L$dir" ;;
5601 func_append lib_search_path " $dir"
5605 *-*-cygwin* | *-*-mingw* | *-*-pw32* | *-*-os2* | *-cegcc*)
5606 testbindir=`$ECHO "$dir" | $SED 's*/lib$*/bin*'`
5607 case :$dllsearchpath: in
5609 ::) dllsearchpath=$dir;;
5610 *) func_append dllsearchpath ":$dir";;
5612 case :$dllsearchpath: in
5613 *":$testbindir:"*) ;;
5614 ::) dllsearchpath=$testbindir;;
5615 *) func_append dllsearchpath ":$testbindir";;
5619 deplibs="$deplibs $arg"
5624 if test "X$arg" = "X-lc" || test "X$arg" = "X-lm"; then
5626 *-*-cygwin* | *-*-mingw* | *-*-pw32* | *-*-beos* | *-cegcc* | *-*-haiku*)
5627 # These systems don't actually have a C or math library (as such)
5631 # These systems don't actually have a C library (as such)
5632 test "X$arg" = "X-lc" && continue
5634 *-*-openbsd* | *-*-freebsd* | *-*-dragonfly*)
5635 # Do not include libc due to us having libc/libc_r.
5636 test "X$arg" = "X-lc" && continue
5638 *-*-rhapsody* | *-*-darwin1.[012])
5639 # Rhapsody C and math libraries are in the System framework
5640 func_append deplibs " System.ltframework"
5643 *-*-sco3.2v5* | *-*-sco5v6*)
5644 # Causes problems with __ctype
5645 test "X$arg" = "X-lc" && continue
5647 *-*-sysv4.2uw2* | *-*-sysv5* | *-*-unixware* | *-*-OpenUNIX*)
5648 # Compiler inserts libc in the correct place for threads to work
5649 test "X$arg" = "X-lc" && continue
5652 elif test "X$arg" = "X-lc_r"; then
5654 *-*-openbsd* | *-*-freebsd* | *-*-dragonfly*)
5655 # Do not include libc_r directly, use -pthread flag.
5660 func_append deplibs " $arg"
5669 # Tru64 UNIX uses -model [arg] to determine the layout of C++
5670 # classes, name mangling, and exception handling.
5671 # Darwin uses the -arch flag to determine output architecture.
5672 -model|-arch|-isysroot|--sysroot)
5673 func_append compiler_flags " $arg"
5674 func_append compile_command " $arg"
5675 func_append finalize_command " $arg"
5680 -mt|-mthreads|-kthread|-Kthread|-pthread|-pthreads|--thread-safe|-threads)
5681 func_append compiler_flags " $arg"
5682 func_append compile_command " $arg"
5683 func_append finalize_command " $arg"
5684 case "$new_inherited_linker_flags " in
5686 * ) func_append new_inherited_linker_flags " $arg" ;;
5692 single_module="${wl}-multi_module"
5703 *-*-cygwin* | *-*-mingw* | *-*-pw32* | *-*-os2* | *-*-darwin* | *-cegcc*)
5704 # The PATH hackery in wrapper scripts is required on Windows
5705 # and Darwin in order for the loader to find any dlls it needs.
5706 func_warning "\`-no-install' is ignored for $host"
5707 func_warning "assuming \`-no-fast-install' instead"
5710 *) no_install=yes ;;
5727 -precious-files-regex)
5748 func_stripname '-R' '' "$arg"
5749 dir=$func_stripname_result
5750 # We need an absolute path.
5752 [\\/]* | [A-Za-z]:[\\/]*) ;;
5754 func_stripname '=' '' "$dir"
5755 dir=$lt_sysroot$func_stripname_result
5758 func_fatal_error "only absolute run-paths are allowed"
5763 *) func_append xrpath " $dir" ;;
5769 # The effects of -shared are defined in a previous loop.
5778 -static | -static-libtool-libs)
5779 # The effects of -static are defined in a previous loop.
5780 # We used to do the same as -all-static on platforms that
5781 # didn't have a PIC flag, but the assumption that the effects
5782 # would be equivalent was wrong. It would break on at least
5783 # Digital Unix and AIX.
5809 func_stripname '-Wc,' '' "$arg"
5810 args=$func_stripname_result
5812 save_ifs="$IFS"; IFS=','
5813 for flag in $args; do
5815 func_quote_for_eval "$flag"
5816 func_append arg " $func_quote_for_eval_result"
5817 func_append compiler_flags " $func_quote_for_eval_result"
5820 func_stripname ' ' '' "$arg"
5821 arg=$func_stripname_result
5825 func_stripname '-Wl,' '' "$arg"
5826 args=$func_stripname_result
5828 save_ifs="$IFS"; IFS=','
5829 for flag in $args; do
5831 func_quote_for_eval "$flag"
5832 func_append arg " $wl$func_quote_for_eval_result"
5833 func_append compiler_flags " $wl$func_quote_for_eval_result"
5834 func_append linker_flags " $func_quote_for_eval_result"
5837 func_stripname ' ' '' "$arg"
5838 arg=$func_stripname_result
5858 func_quote_for_eval "$arg"
5859 arg="$func_quote_for_eval_result"
5862 # Flags to be passed through unchanged, with rationale:
5863 # -64, -mips[0-9] enable 64-bit mode for the SGI compiler
5864 # -r[0-9][0-9]* specify processor for the SGI compiler
5865 # -xarch=*, -xtarget=* enable 64-bit mode for the Sun compiler
5866 # +DA*, +DD* enable 64-bit mode for the HP compiler
5867 # -q* compiler args for the IBM compiler
5868 # -m*, -t[45]*, -txscale* architecture-specific flags for GCC
5869 # -F/path path to uninstalled frameworks, gcc on darwin
5870 # -p, -pg, --coverage, -fprofile-* profiling flags for GCC
5871 # @file GCC response files
5872 # -tp=* Portland pgcc target processor selection
5873 # --sysroot=* for sysroot support
5874 # -O*, -flto*, -fwhopr*, -fuse-linker-plugin GCC link-time optimization
5875 -64|-mips[0-9]|-r[0-9][0-9]*|-xarch=*|-xtarget=*|+DA*|+DD*|-q*|-m*| \
5876 -t[45]*|-txscale*|-p|-pg|--coverage|-fprofile-*|-F*|@*|-tp=*|--sysroot=*| \
5877 -O*|-flto*|-fwhopr*|-fuse-linker-plugin)
5878 func_quote_for_eval "$arg"
5879 arg="$func_quote_for_eval_result"
5880 func_append compile_command " $arg"
5881 func_append finalize_command " $arg"
5882 func_append compiler_flags " $arg"
5886 # Some other compiler flag.
5888 func_quote_for_eval "$arg"
5889 arg="$func_quote_for_eval_result"
5893 # A standard object.
5894 func_append objs " $arg"
5898 # A libtool-controlled object.
5900 # Check to see that this really is a libtool object.
5901 if func_lalib_unsafe_p "$arg"; then
5908 if test -z "$pic_object" ||
5909 test -z "$non_pic_object" ||
5910 test "$pic_object" = none &&
5911 test "$non_pic_object" = none; then
5912 func_fatal_error "cannot find name of object for \`$arg'"
5915 # Extract subdirectory from the argument.
5916 func_dirname "$arg" "/" ""
5917 xdir="$func_dirname_result"
5919 if test "$pic_object" != none; then
5920 # Prepend the subdirectory the object is found in.
5921 pic_object="$xdir$pic_object"
5923 if test "$prev" = dlfiles; then
5924 if test "$build_libtool_libs" = yes && test "$dlopen_support" = yes; then
5925 func_append dlfiles " $pic_object"
5929 # If libtool objects are unsupported, then we need to preload.
5934 # CHECK ME: I think I busted this. -Ossama
5935 if test "$prev" = dlprefiles; then
5936 # Preload the old-style object.
5937 func_append dlprefiles " $pic_object"
5942 func_append libobjs " $pic_object"
5947 if test "$non_pic_object" != none; then
5948 # Prepend the subdirectory the object is found in.
5949 non_pic_object="$xdir$non_pic_object"
5951 # A standard non-PIC object
5952 func_append non_pic_objects " $non_pic_object"
5953 if test -z "$pic_object" || test "$pic_object" = none ; then
5954 arg="$non_pic_object"
5957 # If the PIC object exists, use it instead.
5958 # $xdir was prepended to $pic_object above.
5959 non_pic_object="$pic_object"
5960 func_append non_pic_objects " $non_pic_object"
5963 # Only an error if not doing a dry-run.
5964 if $opt_dry_run; then
5965 # Extract subdirectory from the argument.
5966 func_dirname "$arg" "/" ""
5967 xdir="$func_dirname_result"
5970 pic_object=$xdir$objdir/$func_lo2o_result
5971 non_pic_object=$xdir$func_lo2o_result
5972 func_append libobjs " $pic_object"
5973 func_append non_pic_objects " $non_pic_object"
5975 func_fatal_error "\`$arg' is not a valid libtool object"
5982 func_append deplibs " $arg"
5983 func_append old_deplibs " $arg"
5988 # A libtool-controlled library.
5990 func_resolve_sysroot "$arg"
5991 if test "$prev" = dlfiles; then
5992 # This library was specified with -dlopen.
5993 func_append dlfiles " $func_resolve_sysroot_result"
5995 elif test "$prev" = dlprefiles; then
5996 # The library was specified with -dlpreopen.
5997 func_append dlprefiles " $func_resolve_sysroot_result"
6000 func_append deplibs " $func_resolve_sysroot_result"
6005 # Some other compiler argument.
6007 # Unknown arguments in both finalize_command and compile_command need
6008 # to be aesthetically quoted because they are evaled later.
6009 func_quote_for_eval "$arg"
6010 arg="$func_quote_for_eval_result"
6014 # Now actually substitute the argument into the commands.
6015 if test -n "$arg"; then
6016 func_append compile_command " $arg"
6017 func_append finalize_command " $arg"
6019 done # argument parsing loop
6021 test -n "$prev" && \
6022 func_fatal_help "the \`$prevarg' option requires an argument"
6024 if test "$export_dynamic" = yes && test -n "$export_dynamic_flag_spec"; then
6025 eval arg=\"$export_dynamic_flag_spec\"
6026 func_append compile_command " $arg"
6027 func_append finalize_command " $arg"
6031 # calculate the name of the file, without its directory
6032 func_basename "$output"
6033 outputname="$func_basename_result"
6034 libobjs_save="$libobjs"
6036 if test -n "$shlibpath_var"; then
6037 # get the directories listed in $shlibpath_var
6038 eval shlib_search_path=\`\$ECHO \"\${$shlibpath_var}\" \| \$SED \'s/:/ /g\'\`
6042 eval sys_lib_search_path=\"$sys_lib_search_path_spec\"
6043 eval sys_lib_dlsearch_path=\"$sys_lib_dlsearch_path_spec\"
6045 func_dirname "$output" "/" ""
6046 output_objdir="$func_dirname_result$objdir"
6047 func_to_tool_file "$output_objdir/"
6048 tool_output_objdir=$func_to_tool_file_result
6049 # Create the object directory.
6050 func_mkdir_p "$output_objdir"
6052 # Determine the type of output
6055 func_fatal_help "you must specify an output file"
6057 *.$libext) linkmode=oldlib ;;
6058 *.lo | *.$objext) linkmode=obj ;;
6059 *.la) linkmode=lib ;;
6060 *) linkmode=prog ;; # Anything else should be a program.
6066 # Find all interdependent deplibs by searching for libraries
6067 # that are linked more than once (e.g. -la -lb -la)
6068 for deplib in $deplibs; do
6069 if $opt_preserve_dup_deps ; then
6071 *" $deplib "*) func_append specialdeplibs " $deplib" ;;
6074 func_append libs " $deplib"
6077 if test "$linkmode" = lib; then
6078 libs="$predeps $libs $compiler_lib_search_path $postdeps"
6080 # Compute libraries that are listed more than once in $predeps
6081 # $postdeps and mark them as special (i.e., whose duplicates are
6082 # not to be eliminated).
6084 if $opt_duplicate_compiler_generated_deps; then
6085 for pre_post_dep in $predeps $postdeps; do
6086 case "$pre_post_deps " in
6087 *" $pre_post_dep "*) func_append specialdeplibs " $pre_post_deps" ;;
6089 func_append pre_post_deps " $pre_post_dep"
6098 need_relink=no # whether we're linking any uninstalled libtool libraries
6099 notinst_deplibs= # not-installed libtool libraries
6100 notinst_path= # paths that contain not-installed libtool libraries
6104 passes="conv dlpreopen link"
6105 for file in $dlfiles $dlprefiles; do
6109 func_fatal_help "libraries can \`-dlopen' only libtool libraries: $file"
6120 passes="conv scan dlopen dlpreopen link"
6126 for pass in $passes; do
6127 # The preopen pass in lib mode reverses $deplibs; put it back here
6128 # so that -L comes before libs that need it for instance...
6129 if test "$linkmode,$pass" = "lib,link"; then
6130 ## FIXME: Find the place where the list is rebuilt in the wrong
6131 ## order, and fix it there properly
6133 for deplib in $deplibs; do
6134 tmp_deplibs="$deplib $tmp_deplibs"
6136 deplibs="$tmp_deplibs"
6139 if test "$linkmode,$pass" = "lib,link" ||
6140 test "$linkmode,$pass" = "prog,scan"; then
6144 if test "$linkmode" = prog; then
6146 dlopen) libs="$dlfiles" ;;
6147 dlpreopen) libs="$dlprefiles" ;;
6148 link) libs="$deplibs %DEPLIBS% $dependency_libs" ;;
6151 if test "$linkmode,$pass" = "lib,dlpreopen"; then
6152 # Collect and forward deplibs of preopened libtool libs
6153 for lib in $dlprefiles; do
6154 # Ignore non-libtool-libs
6156 func_resolve_sysroot "$lib"
6158 *.la) func_source "$func_resolve_sysroot_result" ;;
6161 # Collect preopened libtool deplibs, except any this library
6162 # has declared as weak libs
6163 for deplib in $dependency_libs; do
6164 func_basename "$deplib"
6165 deplib_base=$func_basename_result
6166 case " $weak_libs " in
6167 *" $deplib_base "*) ;;
6168 *) func_append deplibs " $deplib" ;;
6174 if test "$pass" = dlopen; then
6175 # Collect dlpreopened libraries
6176 save_deplibs="$deplibs"
6180 for deplib in $libs; do
6184 -mt|-mthreads|-kthread|-Kthread|-pthread|-pthreads|--thread-safe|-threads)
6185 if test "$linkmode,$pass" = "prog,link"; then
6186 compile_deplibs="$deplib $compile_deplibs"
6187 finalize_deplibs="$deplib $finalize_deplibs"
6189 func_append compiler_flags " $deplib"
6194 deplibs="$deplib $deplibs"
6195 test "$pass" = conv && continue
6196 newdependency_libs="$deplib $newdependency_libs"
6199 if test "$pass" = conv; then
6200 deplibs="$deplib $deplibs"
6203 if test "$pass" = scan; then
6204 deplibs="$deplib $deplibs"
6206 compile_deplibs="$deplib $compile_deplibs"
6207 finalize_deplibs="$deplib $finalize_deplibs"
6217 if test "$linkmode" != lib && test "$linkmode" != prog; then
6218 func_warning "\`-l' is ignored for archives/objects"
6221 func_stripname '-l' '' "$deplib"
6222 name=$func_stripname_result
6223 if test "$linkmode" = lib; then
6224 searchdirs="$newlib_search_path $lib_search_path $compiler_lib_search_dirs $sys_lib_search_path $shlib_search_path"
6226 searchdirs="$newlib_search_path $lib_search_path $sys_lib_search_path $shlib_search_path"
6228 for searchdir in $searchdirs; do
6229 for search_ext in .la $std_shrext .so .a; do
6230 # Search the libtool library
6231 lib="$searchdir/lib${name}${search_ext}"
6232 if test -f "$lib"; then
6233 if test "$search_ext" = ".la"; then
6242 if test "$found" != yes; then
6243 # deplib doesn't seem to be a libtool library
6244 if test "$linkmode,$pass" = "prog,link"; then
6245 compile_deplibs="$deplib $compile_deplibs"
6246 finalize_deplibs="$deplib $finalize_deplibs"
6248 deplibs="$deplib $deplibs"
6249 test "$linkmode" = lib && newdependency_libs="$deplib $newdependency_libs"
6252 else # deplib is a libtool library
6253 # If $allow_libtool_libs_with_static_runtimes && $deplib is a stdlib,
6254 # We need to do some special things here, and not later.
6255 if test "X$allow_libtool_libs_with_static_runtimes" = "Xyes" ; then
6256 case " $predeps $postdeps " in
6258 if func_lalib_p "$lib"; then
6262 for l in $old_library $library_names; do
6265 if test "X$ll" = "X$old_library" ; then # only static version available
6267 func_dirname "$lib" "" "."
6268 ladir="$func_dirname_result"
6269 lib=$ladir/$old_library
6270 if test "$linkmode,$pass" = "prog,link"; then
6271 compile_deplibs="$deplib $compile_deplibs"
6272 finalize_deplibs="$deplib $finalize_deplibs"
6274 deplibs="$deplib $deplibs"
6275 test "$linkmode" = lib && newdependency_libs="$deplib $newdependency_libs"
6287 if test "$linkmode,$pass" = "prog,link"; then
6288 compile_deplibs="$deplib $compile_deplibs"
6289 finalize_deplibs="$deplib $finalize_deplibs"
6291 deplibs="$deplib $deplibs"
6292 if test "$linkmode" = lib ; then
6293 case "$new_inherited_linker_flags " in
6295 * ) func_append new_inherited_linker_flags " $deplib" ;;
6304 deplibs="$deplib $deplibs"
6305 test "$pass" = conv && continue
6306 newdependency_libs="$deplib $newdependency_libs"
6307 func_stripname '-L' '' "$deplib"
6308 func_resolve_sysroot "$func_stripname_result"
6309 func_append newlib_search_path " $func_resolve_sysroot_result"
6312 if test "$pass" = conv; then
6313 deplibs="$deplib $deplibs"
6316 if test "$pass" = scan; then
6317 deplibs="$deplib $deplibs"
6319 compile_deplibs="$deplib $compile_deplibs"
6320 finalize_deplibs="$deplib $finalize_deplibs"
6322 func_stripname '-L' '' "$deplib"
6323 func_resolve_sysroot "$func_stripname_result"
6324 func_append newlib_search_path " $func_resolve_sysroot_result"
6327 func_warning "\`-L' is ignored for archives/objects"
6333 if test "$pass" = link; then
6334 func_stripname '-R' '' "$deplib"
6335 func_resolve_sysroot "$func_stripname_result"
6336 dir=$func_resolve_sysroot_result
6337 # Make sure the xrpath contains only unique directories.
6340 *) func_append xrpath " $dir" ;;
6343 deplibs="$deplib $deplibs"
6347 func_resolve_sysroot "$deplib"
6348 lib=$func_resolve_sysroot_result
6351 if test "$pass" = conv; then
6352 deplibs="$deplib $deplibs"
6357 # Linking convenience modules into shared libraries is allowed,
6358 # but linking other static libraries is non-portable.
6359 case " $dlpreconveniencelibs " in
6363 case $deplibs_check_method in
6365 set dummy $deplibs_check_method; shift
6366 match_pattern_regex=`expr "$deplibs_check_method" : "$1 \(.*\)"`
6367 if eval "\$ECHO \"$deplib\"" 2>/dev/null | $SED 10q \
6368 | $EGREP "$match_pattern_regex" > /dev/null; then
6376 if test "$valid_a_lib" != yes; then
6378 $ECHO "*** Warning: Trying to link with static lib archive $deplib."
6379 echo "*** I have the capability to make that library automatically link in when"
6380 echo "*** you link to this library. But I can only do this if you have a"
6381 echo "*** shared version of the library, which you do not appear to have"
6382 echo "*** because the file extensions .$libext of this argument makes me believe"
6383 echo "*** that it is just a static archive that I should not use here."
6386 $ECHO "*** Warning: Linking the shared library $output against the"
6387 $ECHO "*** static library $deplib is not portable!"
6388 deplibs="$deplib $deplibs"
6395 if test "$pass" != link; then
6396 deplibs="$deplib $deplibs"
6398 compile_deplibs="$deplib $compile_deplibs"
6399 finalize_deplibs="$deplib $finalize_deplibs"
6406 if test "$pass" = conv; then
6407 deplibs="$deplib $deplibs"
6408 elif test "$linkmode" = prog; then
6409 if test "$pass" = dlpreopen || test "$dlopen_support" != yes || test "$build_libtool_libs" = no; then
6410 # If there is no dlopen support or we're linking statically,
6411 # we need to preload.
6412 func_append newdlprefiles " $deplib"
6413 compile_deplibs="$deplib $compile_deplibs"
6414 finalize_deplibs="$deplib $finalize_deplibs"
6416 func_append newdlfiles " $deplib"
6427 if test "$found" = yes || test -f "$lib"; then :
6429 func_fatal_error "cannot find the library \`$lib' or unhandled argument \`$deplib'"
6432 # Check to see that this really is a libtool archive.
6433 func_lalib_unsafe_p "$lib" \
6434 || func_fatal_error "\`$lib' is not a valid libtool archive"
6436 func_dirname "$lib" "" "."
6437 ladir="$func_dirname_result"
6445 inherited_linker_flags=
6446 # If the library was installed with an old release of libtool,
6447 # it will not redefine variables installed, or shouldnotlink
6456 # Convert "-framework foo" to "foo.ltframework"
6457 if test -n "$inherited_linker_flags"; then
6458 tmp_inherited_linker_flags=`$ECHO "$inherited_linker_flags" | $SED 's/-framework \([^ $]*\)/\1.ltframework/g'`
6459 for tmp_inherited_linker_flag in $tmp_inherited_linker_flags; do
6460 case " $new_inherited_linker_flags " in
6461 *" $tmp_inherited_linker_flag "*) ;;
6462 *) func_append new_inherited_linker_flags " $tmp_inherited_linker_flag";;
6466 dependency_libs=`$ECHO " $dependency_libs" | $SED 's% \([^ $]*\).ltframework% -framework \1%g'`
6467 if test "$linkmode,$pass" = "lib,link" ||
6468 test "$linkmode,$pass" = "prog,scan" ||
6469 { test "$linkmode" != prog && test "$linkmode" != lib; }; then
6470 test -n "$dlopen" && func_append dlfiles " $dlopen"
6471 test -n "$dlpreopen" && func_append dlprefiles " $dlpreopen"
6474 if test "$pass" = conv; then
6475 # Only check for convenience libraries
6476 deplibs="$lib $deplibs"
6477 if test -z "$libdir"; then
6478 if test -z "$old_library"; then
6479 func_fatal_error "cannot find name of link library for \`$lib'"
6481 # It is a libtool convenience library, so add in its objects.
6482 func_append convenience " $ladir/$objdir/$old_library"
6483 func_append old_convenience " $ladir/$objdir/$old_library"
6484 elif test "$linkmode" != prog && test "$linkmode" != lib; then
6485 func_fatal_error "\`$lib' is not a convenience library"
6488 for deplib in $dependency_libs; do
6489 deplibs="$deplib $deplibs"
6490 if $opt_preserve_dup_deps ; then
6491 case "$tmp_libs " in
6492 *" $deplib "*) func_append specialdeplibs " $deplib" ;;
6495 func_append tmp_libs " $deplib"
6501 # Get the name of the library we link against.
6503 if test -n "$old_library" &&
6504 { test "$prefer_static_libs" = yes ||
6505 test "$prefer_static_libs,$installed" = "built,no"; }; then
6506 linklib=$old_library
6508 for l in $old_library $library_names; do
6512 if test -z "$linklib"; then
6513 func_fatal_error "cannot find name of link library for \`$lib'"
6516 # This library was specified with -dlopen.
6517 if test "$pass" = dlopen; then
6518 if test -z "$libdir"; then
6519 func_fatal_error "cannot -dlopen a convenience library: \`$lib'"
6521 if test -z "$dlname" ||
6522 test "$dlopen_support" != yes ||
6523 test "$build_libtool_libs" = no; then
6524 # If there is no dlname, no dlopen support or we're linking
6525 # statically, we need to preload. We also need to preload any
6526 # dependent libraries so libltdl's deplib preloader doesn't
6527 # bomb out in the load deplibs phase.
6528 func_append dlprefiles " $lib $dependency_libs"
6530 func_append newdlfiles " $lib"
6535 # We need an absolute path.
6537 [\\/]* | [A-Za-z]:[\\/]*) abs_ladir="$ladir" ;;
6539 abs_ladir=`cd "$ladir" && pwd`
6540 if test -z "$abs_ladir"; then
6541 func_warning "cannot determine absolute directory name of \`$ladir'"
6542 func_warning "passing it literally to the linker, although it might fail"
6547 func_basename "$lib"
6548 laname="$func_basename_result"
6550 # Find the relevant object directory and library name.
6551 if test "X$installed" = Xyes; then
6552 if test ! -f "$lt_sysroot$libdir/$linklib" && test -f "$abs_ladir/$linklib"; then
6553 func_warning "library \`$lib' was moved."
6558 dir="$lt_sysroot$libdir"
6559 absdir="$lt_sysroot$libdir"
6561 test "X$hardcode_automatic" = Xyes && avoidtemprpath=yes
6563 if test ! -f "$ladir/$objdir/$linklib" && test -f "$abs_ladir/$linklib"; then
6566 # Remove this search path later
6567 func_append notinst_path " $abs_ladir"
6569 dir="$ladir/$objdir"
6570 absdir="$abs_ladir/$objdir"
6571 # Remove this search path later
6572 func_append notinst_path " $abs_ladir"
6574 fi # $installed = yes
6575 func_stripname 'lib' '.la' "$laname"
6576 name=$func_stripname_result
6578 # This library was specified with -dlpreopen.
6579 if test "$pass" = dlpreopen; then
6580 if test -z "$libdir" && test "$linkmode" = prog; then
6581 func_fatal_error "only libraries may -dlpreopen a convenience library: \`$lib'"
6584 # special handling for platforms with PE-DLLs.
6585 *cygwin* | *mingw* | *cegcc* )
6586 # Linker will automatically link against shared library if both
6587 # static and shared are present. Therefore, ensure we extract
6588 # symbols from the import library if a shared library is present
6589 # (otherwise, the dlopen module name will be incorrect). We do
6590 # this by putting the import library name into $newdlprefiles.
6591 # We recover the dlopen module name by 'saving' the la file
6592 # name in a special purpose variable, and (later) extracting the
6593 # dlname from the la file.
6594 if test -n "$dlname"; then
6595 func_tr_sh "$dir/$linklib"
6596 eval "libfile_$func_tr_sh_result=\$abs_ladir/\$laname"
6597 func_append newdlprefiles " $dir/$linklib"
6599 func_append newdlprefiles " $dir/$old_library"
6600 # Keep a list of preopened convenience libraries to check
6601 # that they are being used correctly in the link pass.
6602 test -z "$libdir" && \
6603 func_append dlpreconveniencelibs " $dir/$old_library"
6607 # Prefer using a static library (so that no silly _DYNAMIC symbols
6608 # are required to link).
6609 if test -n "$old_library"; then
6610 func_append newdlprefiles " $dir/$old_library"
6611 # Keep a list of preopened convenience libraries to check
6612 # that they are being used correctly in the link pass.
6613 test -z "$libdir" && \
6614 func_append dlpreconveniencelibs " $dir/$old_library"
6615 # Otherwise, use the dlname, so that lt_dlopen finds it.
6616 elif test -n "$dlname"; then
6617 func_append newdlprefiles " $dir/$dlname"
6619 func_append newdlprefiles " $dir/$linklib"
6623 fi # $pass = dlpreopen
6625 if test -z "$libdir"; then
6626 # Link the convenience library
6627 if test "$linkmode" = lib; then
6628 deplibs="$dir/$old_library $deplibs"
6629 elif test "$linkmode,$pass" = "prog,link"; then
6630 compile_deplibs="$dir/$old_library $compile_deplibs"
6631 finalize_deplibs="$dir/$old_library $finalize_deplibs"
6633 deplibs="$lib $deplibs" # used for prog,scan pass
6639 if test "$linkmode" = prog && test "$pass" != link; then
6640 func_append newlib_search_path " $ladir"
6641 deplibs="$lib $deplibs"
6644 if test "$link_all_deplibs" != no || test -z "$library_names" ||
6645 test "$build_libtool_libs" = no; then
6650 for deplib in $dependency_libs; do
6652 -L*) func_stripname '-L' '' "$deplib"
6653 func_resolve_sysroot "$func_stripname_result"
6654 func_append newlib_search_path " $func_resolve_sysroot_result"
6657 # Need to link against all dependency_libs?
6658 if test "$linkalldeplibs" = yes; then
6659 deplibs="$deplib $deplibs"
6661 # Need to hardcode shared library paths
6662 # or/and link against static libraries
6663 newdependency_libs="$deplib $newdependency_libs"
6665 if $opt_preserve_dup_deps ; then
6666 case "$tmp_libs " in
6667 *" $deplib "*) func_append specialdeplibs " $deplib" ;;
6670 func_append tmp_libs " $deplib"
6673 fi # $linkmode = prog...
6675 if test "$linkmode,$pass" = "prog,link"; then
6676 if test -n "$library_names" &&
6677 { { test "$prefer_static_libs" = no ||
6678 test "$prefer_static_libs,$installed" = "built,yes"; } ||
6679 test -z "$old_library"; }; then
6680 # We need to hardcode the library path
6681 if test -n "$shlibpath_var" && test -z "$avoidtemprpath" ; then
6682 # Make sure the rpath contains only unique directories.
6683 case "$temp_rpath:" in
6685 *) func_append temp_rpath "$absdir:" ;;
6689 # Hardcode the library path.
6690 # Skip directories that are in the system default run-time
6692 case " $sys_lib_dlsearch_path " in
6695 case "$compile_rpath " in
6697 *) func_append compile_rpath " $absdir" ;;
6701 case " $sys_lib_dlsearch_path " in
6704 case "$finalize_rpath " in
6706 *) func_append finalize_rpath " $libdir" ;;
6710 fi # $linkmode,$pass = prog,link...
6712 if test "$alldeplibs" = yes &&
6713 { test "$deplibs_check_method" = pass_all ||
6714 { test "$build_libtool_libs" = yes &&
6715 test -n "$library_names"; }; }; then
6716 # We only need to search for static libraries
6721 link_static=no # Whether the deplib will be linked statically
6722 use_static_libs=$prefer_static_libs
6723 if test "$use_static_libs" = built && test "$installed" = yes; then
6726 if test -n "$library_names" &&
6727 { test "$use_static_libs" = no || test -z "$old_library"; }; then
6729 *cygwin* | *mingw* | *cegcc*)
6730 # No point in relinking DLLs because paths are not encoded
6731 func_append notinst_deplibs " $lib"
6735 if test "$installed" = no; then
6736 func_append notinst_deplibs " $lib"
6741 # This is a shared library
6743 # Warn about portability, can't link against -module's on some
6744 # systems (darwin). Don't bleat about dlopened modules though!
6746 for dlpremoduletest in $dlprefiles; do
6747 if test "X$dlpremoduletest" = "X$lib"; then
6748 dlopenmodule="$dlpremoduletest"
6752 if test -z "$dlopenmodule" && test "$shouldnotlink" = yes && test "$pass" = link; then
6754 if test "$linkmode" = prog; then
6755 $ECHO "*** Warning: Linking the executable $output against the loadable module"
6757 $ECHO "*** Warning: Linking the shared library $output against the loadable module"
6759 $ECHO "*** $linklib is not portable!"
6761 if test "$linkmode" = lib &&
6762 test "$hardcode_into_libs" = yes; then
6763 # Hardcode the library path.
6764 # Skip directories that are in the system default run-time
6766 case " $sys_lib_dlsearch_path " in
6769 case "$compile_rpath " in
6771 *) func_append compile_rpath " $absdir" ;;
6775 case " $sys_lib_dlsearch_path " in
6778 case "$finalize_rpath " in
6780 *) func_append finalize_rpath " $libdir" ;;
6786 if test -n "$old_archive_from_expsyms_cmds"; then
6787 # figure out the soname
6788 set dummy $library_names
6792 libname=`eval "\\$ECHO \"$libname_spec\""`
6793 # use dlname if we got it. it's perfectly good, no?
6794 if test -n "$dlname"; then
6796 elif test -n "$soname_spec"; then
6799 *cygwin* | mingw* | *cegcc*)
6800 func_arith $current - $age
6801 major=$func_arith_result
6805 eval soname=\"$soname_spec\"
6810 # Make a new name for the extract_expsyms_cmds to use
6812 func_basename "$soroot"
6813 soname="$func_basename_result"
6814 func_stripname 'lib' '.dll' "$soname"
6815 newlib=libimp-$func_stripname_result.a
6817 # If the library has no export list, then create one now
6818 if test -f "$output_objdir/$soname-def"; then :
6820 func_verbose "extracting exported symbol list from \`$soname'"
6821 func_execute_cmds "$extract_expsyms_cmds" 'exit $?'
6825 if test -f "$output_objdir/$newlib"; then :; else
6826 func_verbose "generating import library for \`$soname'"
6827 func_execute_cmds "$old_archive_from_expsyms_cmds" 'exit $?'
6829 # make sure the library variables are pointing to the new library
6832 fi # test -n "$old_archive_from_expsyms_cmds"
6834 if test "$linkmode" = prog || test "$opt_mode" != relink; then
6839 case $hardcode_action in
6840 immediate | unsupported)
6841 if test "$hardcode_direct" = no; then
6844 *-*-sco3.2v5.0.[024]*) add_dir="-L$dir" ;;
6845 *-*-sysv4*uw2*) add_dir="-L$dir" ;;
6846 *-*-sysv5OpenUNIX* | *-*-sysv5UnixWare7.[01].[10]* | \
6847 *-*-unixware7*) add_dir="-L$dir" ;;
6849 # if the lib is a (non-dlopened) module then we can not
6850 # link against it, someone is ignoring the earlier warnings
6851 if /usr/bin/file -L $add 2> /dev/null |
6852 $GREP ": [^:]* bundle" >/dev/null ; then
6853 if test "X$dlopenmodule" != "X$lib"; then
6854 $ECHO "*** Warning: lib $linklib is a module, not a shared library"
6855 if test -z "$old_library" ; then
6857 echo "*** And there doesn't seem to be a static archive available"
6858 echo "*** The link will probably fail, sorry"
6860 add="$dir/$old_library"
6862 elif test -n "$old_library"; then
6863 add="$dir/$old_library"
6867 elif test "$hardcode_minus_L" = no; then
6869 *-*-sunos*) add_shlibpath="$dir" ;;
6873 elif test "$hardcode_shlibpath_var" = no; then
6874 add_shlibpath="$dir"
6881 if test "$hardcode_direct" = yes &&
6882 test "$hardcode_direct_absolute" = no; then
6884 elif test "$hardcode_minus_L" = yes; then
6886 # Try looking first in the location we're being installed to.
6887 if test -n "$inst_prefix_dir"; then
6890 func_append add_dir " -L$inst_prefix_dir$libdir"
6895 elif test "$hardcode_shlibpath_var" = yes; then
6896 add_shlibpath="$dir"
6905 if test "$lib_linked" != yes; then
6906 func_fatal_configuration "unsupported hardcode properties"
6909 if test -n "$add_shlibpath"; then
6910 case :$compile_shlibpath: in
6911 *":$add_shlibpath:"*) ;;
6912 *) func_append compile_shlibpath "$add_shlibpath:" ;;
6915 if test "$linkmode" = prog; then
6916 test -n "$add_dir" && compile_deplibs="$add_dir $compile_deplibs"
6917 test -n "$add" && compile_deplibs="$add $compile_deplibs"
6919 test -n "$add_dir" && deplibs="$add_dir $deplibs"
6920 test -n "$add" && deplibs="$add $deplibs"
6921 if test "$hardcode_direct" != yes &&
6922 test "$hardcode_minus_L" != yes &&
6923 test "$hardcode_shlibpath_var" = yes; then
6924 case :$finalize_shlibpath: in
6926 *) func_append finalize_shlibpath "$libdir:" ;;
6932 if test "$linkmode" = prog || test "$opt_mode" = relink; then
6936 # Finalize command for both is simple: just hardcode it.
6937 if test "$hardcode_direct" = yes &&
6938 test "$hardcode_direct_absolute" = no; then
6939 add="$libdir/$linklib"
6940 elif test "$hardcode_minus_L" = yes; then
6943 elif test "$hardcode_shlibpath_var" = yes; then
6944 case :$finalize_shlibpath: in
6946 *) func_append finalize_shlibpath "$libdir:" ;;
6949 elif test "$hardcode_automatic" = yes; then
6950 if test -n "$inst_prefix_dir" &&
6951 test -f "$inst_prefix_dir$libdir/$linklib" ; then
6952 add="$inst_prefix_dir$libdir/$linklib"
6954 add="$libdir/$linklib"
6957 # We cannot seem to hardcode it, guess we'll fake it.
6959 # Try looking first in the location we're being installed to.
6960 if test -n "$inst_prefix_dir"; then
6963 func_append add_dir " -L$inst_prefix_dir$libdir"
6970 if test "$linkmode" = prog; then
6971 test -n "$add_dir" && finalize_deplibs="$add_dir $finalize_deplibs"
6972 test -n "$add" && finalize_deplibs="$add $finalize_deplibs"
6974 test -n "$add_dir" && deplibs="$add_dir $deplibs"
6975 test -n "$add" && deplibs="$add $deplibs"
6978 elif test "$linkmode" = prog; then
6979 # Here we assume that one of hardcode_direct or hardcode_minus_L
6980 # is not unsupported. This is valid on all known static and
6982 if test "$hardcode_direct" != unsupported; then
6983 test -n "$old_library" && linklib="$old_library"
6984 compile_deplibs="$dir/$linklib $compile_deplibs"
6985 finalize_deplibs="$dir/$linklib $finalize_deplibs"
6987 compile_deplibs="-l$name -L$dir $compile_deplibs"
6988 finalize_deplibs="-l$name -L$dir $finalize_deplibs"
6990 elif test "$build_libtool_libs" = yes; then
6991 # Not a shared library
6992 if test "$deplibs_check_method" != pass_all; then
6993 # We're trying link a shared library against a static one
6994 # but the system doesn't support it.
6996 # Just print a warning and add the library to dependency_libs so
6997 # that the program can be linked against the static library.
6999 $ECHO "*** Warning: This system can not link to static lib archive $lib."
7000 echo "*** I have the capability to make that library automatically link in when"
7001 echo "*** you link to this library. But I can only do this if you have a"
7002 echo "*** shared version of the library, which you do not appear to have."
7003 if test "$module" = yes; then
7004 echo "*** But as you try to build a module library, libtool will still create "
7005 echo "*** a static module, that should work as long as the dlopening application"
7006 echo "*** is linked with the -dlopen flag to resolve symbols at runtime."
7007 if test -z "$global_symbol_pipe"; then
7009 echo "*** However, this would only work if libtool was able to extract symbol"
7010 echo "*** lists from a program, using \`nm' or equivalent, but libtool could"
7011 echo "*** not find such a program. So, this module is probably useless."
7012 echo "*** \`nm' from GNU binutils and a full rebuild may help."
7014 if test "$build_old_libs" = no; then
7015 build_libtool_libs=module
7018 build_libtool_libs=no
7022 deplibs="$dir/$old_library $deplibs"
7025 fi # link shared/static library?
7027 if test "$linkmode" = lib; then
7028 if test -n "$dependency_libs" &&
7029 { test "$hardcode_into_libs" != yes ||
7030 test "$build_old_libs" = yes ||
7031 test "$link_static" = yes; }; then
7032 # Extract -R from dependency_libs
7034 for libdir in $dependency_libs; do
7036 -R*) func_stripname '-R' '' "$libdir"
7037 temp_xrpath=$func_stripname_result
7039 *" $temp_xrpath "*) ;;
7040 *) func_append xrpath " $temp_xrpath";;
7042 *) func_append temp_deplibs " $libdir";;
7045 dependency_libs="$temp_deplibs"
7048 func_append newlib_search_path " $absdir"
7049 # Link against this library
7050 test "$link_static" = no && newdependency_libs="$abs_ladir/$laname $newdependency_libs"
7051 # ... and its dependency_libs
7053 for deplib in $dependency_libs; do
7054 newdependency_libs="$deplib $newdependency_libs"
7056 -L*) func_stripname '-L' '' "$deplib"
7057 func_resolve_sysroot "$func_stripname_result";;
7058 *) func_resolve_sysroot "$deplib" ;;
7060 if $opt_preserve_dup_deps ; then
7061 case "$tmp_libs " in
7062 *" $func_resolve_sysroot_result "*)
7063 func_append specialdeplibs " $func_resolve_sysroot_result" ;;
7066 func_append tmp_libs " $func_resolve_sysroot_result"
7069 if test "$link_all_deplibs" != no; then
7070 # Add the search paths of all dependency libraries
7071 for deplib in $dependency_libs; do
7074 -L*) path="$deplib" ;;
7076 func_resolve_sysroot "$deplib"
7077 deplib=$func_resolve_sysroot_result
7078 func_dirname "$deplib" "" "."
7079 dir=$func_dirname_result
7080 # We need an absolute path.
7082 [\\/]* | [A-Za-z]:[\\/]*) absdir="$dir" ;;
7084 absdir=`cd "$dir" && pwd`
7085 if test -z "$absdir"; then
7086 func_warning "cannot determine absolute directory name of \`$dir'"
7091 if $GREP "^installed=no" $deplib > /dev/null; then
7095 eval deplibrary_names=`${SED} -n -e 's/^library_names=\(.*\)$/\1/p' $deplib`
7096 if test -n "$deplibrary_names" ; then
7097 for tmp in $deplibrary_names ; do
7100 if test -f "$absdir/$objdir/$depdepl" ; then
7101 depdepl="$absdir/$objdir/$depdepl"
7102 darwin_install_name=`${OTOOL} -L $depdepl | awk '{if (NR == 2) {print $1;exit}}'`
7103 if test -z "$darwin_install_name"; then
7104 darwin_install_name=`${OTOOL64} -L $depdepl | awk '{if (NR == 2) {print $1;exit}}'`
7106 func_append compiler_flags " ${wl}-dylib_file ${wl}${darwin_install_name}:${depdepl}"
7107 func_append linker_flags " -dylib_file ${darwin_install_name}:${depdepl}"
7113 path="-L$absdir/$objdir"
7117 eval libdir=`${SED} -n -e 's/^libdir=\(.*\)$/\1/p' $deplib`
7118 test -z "$libdir" && \
7119 func_fatal_error "\`$deplib' is not a valid libtool archive"
7120 test "$absdir" != "$libdir" && \
7121 func_warning "\`$deplib' seems to be moved"
7127 case " $deplibs " in
7129 *) deplibs="$path $deplibs" ;;
7132 fi # link_all_deplibs != no
7134 done # for deplib in $libs
7135 if test "$pass" = link; then
7136 if test "$linkmode" = "prog"; then
7137 compile_deplibs="$new_inherited_linker_flags $compile_deplibs"
7138 finalize_deplibs="$new_inherited_linker_flags $finalize_deplibs"
7140 compiler_flags="$compiler_flags "`$ECHO " $new_inherited_linker_flags" | $SED 's% \([^ $]*\).ltframework% -framework \1%g'`
7143 dependency_libs="$newdependency_libs"
7144 if test "$pass" = dlpreopen; then
7145 # Link the dlpreopened libraries before other libraries
7146 for deplib in $save_deplibs; do
7147 deplibs="$deplib $deplibs"
7150 if test "$pass" != dlopen; then
7151 if test "$pass" != conv; then
7152 # Make sure lib_search_path contains only unique directories.
7154 for dir in $newlib_search_path; do
7155 case "$lib_search_path " in
7157 *) func_append lib_search_path " $dir" ;;
7163 if test "$linkmode,$pass" != "prog,link"; then
7166 vars="compile_deplibs finalize_deplibs"
7168 for var in $vars dependency_libs; do
7169 # Add libraries to $var in reverse order
7170 eval tmp_libs=\"\$$var\"
7172 for deplib in $tmp_libs; do
7173 # FIXME: Pedantically, this is the right thing to do, so
7174 # that some nasty dependency loop isn't accidentally
7176 #new_libs="$deplib $new_libs"
7177 # Pragmatically, this seems to cause very few problems in
7180 -L*) new_libs="$deplib $new_libs" ;;
7183 # And here is the reason: when a library appears more
7184 # than once as an explicit dependence of a library, or
7185 # is implicitly linked in more than once by the
7186 # compiler, it is considered special, and multiple
7187 # occurrences thereof are not removed. Compare this
7188 # with having the same library being listed as a
7189 # dependency of multiple other libraries: in this case,
7190 # we know (pedantically, we assume) the library does not
7191 # need to be listed more than once, so we keep only the
7192 # last copy. This is not always right, but it is rare
7193 # enough that we require users that really mean to play
7194 # such unportable linking tricks to link the library
7195 # using -Wl,-lname, so that libtool does not consider it
7196 # for duplicate removal.
7197 case " $specialdeplibs " in
7198 *" $deplib "*) new_libs="$deplib $new_libs" ;;
7200 case " $new_libs " in
7202 *) new_libs="$deplib $new_libs" ;;
7210 for deplib in $new_libs; do
7213 case " $tmp_libs " in
7215 *) func_append tmp_libs " $deplib" ;;
7218 *) func_append tmp_libs " $deplib" ;;
7221 eval $var=\"$tmp_libs\"
7224 # Last step: remove runtime libs from dependency_libs
7225 # (they stay in deplibs)
7227 for i in $dependency_libs ; do
7228 case " $predeps $postdeps $compiler_lib_search_path " in
7233 if test -n "$i" ; then
7234 func_append tmp_libs " $i"
7237 dependency_libs=$tmp_libs
7239 if test "$linkmode" = prog; then
7240 dlfiles="$newdlfiles"
7242 if test "$linkmode" = prog || test "$linkmode" = lib; then
7243 dlprefiles="$newdlprefiles"
7248 if test -n "$dlfiles$dlprefiles" || test "$dlself" != no; then
7249 func_warning "\`-dlopen' is ignored for archives"
7254 func_warning "\`-l' and \`-L' are ignored for archives" ;;
7257 test -n "$rpath" && \
7258 func_warning "\`-rpath' is ignored for archives"
7260 test -n "$xrpath" && \
7261 func_warning "\`-R' is ignored for archives"
7263 test -n "$vinfo" && \
7264 func_warning "\`-version-info/-version-number' is ignored for archives"
7266 test -n "$release" && \
7267 func_warning "\`-release' is ignored for archives"
7269 test -n "$export_symbols$export_symbols_regex" && \
7270 func_warning "\`-export-symbols' is ignored for archives"
7272 # Now set the variables for building old libraries.
7273 build_libtool_libs=no
7275 func_append objs "$old_deplibs"
7279 # Make sure we only generate libraries of the form `libNAME.la'.
7282 func_stripname 'lib' '.la' "$outputname"
7283 name=$func_stripname_result
7284 eval shared_ext=\"$shrext_cmds\"
7285 eval libname=\"$libname_spec\"
7288 test "$module" = no && \
7289 func_fatal_help "libtool library \`$output' must begin with \`lib'"
7291 if test "$need_lib_prefix" != no; then
7292 # Add the "lib" prefix for modules if required
7293 func_stripname '' '.la' "$outputname"
7294 name=$func_stripname_result
7295 eval shared_ext=\"$shrext_cmds\"
7296 eval libname=\"$libname_spec\"
7298 func_stripname '' '.la' "$outputname"
7299 libname=$func_stripname_result
7304 if test -n "$objs"; then
7305 if test "$deplibs_check_method" != pass_all; then
7306 func_fatal_error "cannot build libtool library \`$output' from non-libtool objects on this host:$objs"
7309 $ECHO "*** Warning: Linking the shared library $output against the non-libtool"
7310 $ECHO "*** objects $objs is not portable!"
7311 func_append libobjs " $objs"
7315 test "$dlself" != no && \
7316 func_warning "\`-dlopen self' is ignored for libtool libraries"
7320 test "$#" -gt 1 && \
7321 func_warning "ignoring multiple \`-rpath's for a libtool library"
7326 if test -z "$rpath"; then
7327 if test "$build_libtool_libs" = yes; then
7328 # Building a libtool convenience library.
7329 # Some compilers have problems with a `.al' extension so
7330 # convenience libraries should have the same extension an
7331 # archive normally would.
7332 oldlibs="$output_objdir/$libname.$libext $oldlibs"
7333 build_libtool_libs=convenience
7337 test -n "$vinfo" && \
7338 func_warning "\`-version-info/-version-number' is ignored for convenience libraries"
7340 test -n "$release" && \
7341 func_warning "\`-release' is ignored for convenience libraries"
7344 # Parse the version information argument.
7345 save_ifs="$IFS"; IFS=':'
7346 set dummy $vinfo 0 0 0
7351 func_fatal_help "too many parameters to \`-version-info'"
7353 # convert absolute version numbers to libtool ages
7354 # this retains compatibility with .la files and attempts
7355 # to make the code below a bit more comprehensible
7357 case $vinfo_number in
7361 number_revision="$3"
7363 # There are really only two kinds -- those that
7364 # use the current revision as the major version
7365 # and those that subtract age and use age as
7366 # a minor version. But, then there is irix
7367 # which has an extra 1 added just for fun
7369 case $version_type in
7370 darwin|linux|osf|windows|none)
7371 func_arith $number_major + $number_minor
7372 current=$func_arith_result
7374 revision="$number_revision"
7376 freebsd-aout|freebsd-elf|qnx|sunos)
7377 current="$number_major"
7378 revision="$number_minor"
7382 func_arith $number_major + $number_minor
7383 current=$func_arith_result
7385 revision="$number_minor"
7386 lt_irix_increment=no
7397 # Check that each of the things are valid numbers.
7399 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]) ;;
7401 func_error "CURRENT \`$current' must be a nonnegative integer"
7402 func_fatal_error "\`$vinfo' is not valid version information"
7407 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]) ;;
7409 func_error "REVISION \`$revision' must be a nonnegative integer"
7410 func_fatal_error "\`$vinfo' is not valid version information"
7415 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]) ;;
7417 func_error "AGE \`$age' must be a nonnegative integer"
7418 func_fatal_error "\`$vinfo' is not valid version information"
7422 if test "$age" -gt "$current"; then
7423 func_error "AGE \`$age' is greater than the current interface number \`$current'"
7424 func_fatal_error "\`$vinfo' is not valid version information"
7427 # Calculate the version variables.
7431 case $version_type in
7435 # Like Linux, but with the current version available in
7436 # verstring for coding it into the library header
7437 func_arith $current - $age
7438 major=.$func_arith_result
7439 versuffix="$major.$age.$revision"
7440 # Darwin ld doesn't like 0 for these options...
7441 func_arith $current + 1
7442 minor_current=$func_arith_result
7443 xlcverstring="${wl}-compatibility_version ${wl}$minor_current ${wl}-current_version ${wl}$minor_current.$revision"
7444 verstring="-compatibility_version $minor_current -current_version $minor_current.$revision"
7449 versuffix=".$current.$revision";
7454 versuffix=".$current"
7458 if test "X$lt_irix_increment" = "Xno"; then
7459 func_arith $current - $age
7461 func_arith $current - $age + 1
7463 major=$func_arith_result
7465 case $version_type in
7466 nonstopux) verstring_prefix=nonstopux ;;
7467 *) verstring_prefix=sgi ;;
7469 verstring="$verstring_prefix$major.$revision"
7471 # Add in all the interfaces that we are compatible with.
7473 while test "$loop" -ne 0; do
7474 func_arith $revision - $loop
7475 iface=$func_arith_result
7476 func_arith $loop - 1
7477 loop=$func_arith_result
7478 verstring="$verstring_prefix$major.$iface:$verstring"
7481 # Before this point, $major must not contain `.'.
7483 versuffix="$major.$revision"
7487 func_arith $current - $age
7488 major=.$func_arith_result
7489 versuffix="$major.$age.$revision"
7493 func_arith $current - $age
7494 major=.$func_arith_result
7495 versuffix=".$current.$age.$revision"
7496 verstring="$current.$age.$revision"
7498 # Add in all the interfaces that we are compatible with.
7500 while test "$loop" -ne 0; do
7501 func_arith $current - $loop
7502 iface=$func_arith_result
7503 func_arith $loop - 1
7504 loop=$func_arith_result
7505 verstring="$verstring:${iface}.0"
7508 # Make executables depend on our current version.
7509 func_append verstring ":${current}.0"
7514 versuffix=".$current"
7519 versuffix=".$current.$revision"
7523 # Use '-' rather than '.', since we only want one
7524 # extension on DOS 8.3 filesystems.
7525 func_arith $current - $age
7526 major=$func_arith_result
7531 func_fatal_configuration "unknown library version type \`$version_type'"
7535 # Clear the version info if we defaulted, and they specified a release.
7536 if test -z "$vinfo" && test -n "$release"; then
7538 case $version_type in
7540 # we can't check for "0.0" in archive_cmds due to quoting
7541 # problems, so we reset it completely
7548 if test "$need_version" = no; then
7555 # Remove version info from name if versioning should be avoided
7556 if test "$avoid_version" = yes && test "$need_version" = no; then
7562 # Check to see if the archive will have undefined symbols.
7563 if test "$allow_undefined" = yes; then
7564 if test "$allow_undefined_flag" = unsupported; then
7565 func_warning "undefined symbols not allowed in $host shared libraries"
7566 build_libtool_libs=no
7570 # Don't allow undefined symbols.
7571 allow_undefined_flag="$no_undefined_flag"
7576 func_generate_dlsyms "$libname" "$libname" "yes"
7577 func_append libobjs " $symfileobj"
7578 test "X$libobjs" = "X " && libobjs=
7580 if test "$opt_mode" != relink; then
7581 # Remove our outputs, but don't remove object files since they
7582 # may have been created when compiling PIC objects.
7584 tempremovelist=`$ECHO "$output_objdir/*"`
7585 for p in $tempremovelist; do
7589 $output_objdir/$outputname | $output_objdir/$libname.* | $output_objdir/${libname}${release}.*)
7590 if test "X$precious_files_regex" != "X"; then
7591 if $ECHO "$p" | $EGREP -e "$precious_files_regex" >/dev/null 2>&1
7596 func_append removelist " $p"
7601 test -n "$removelist" && \
7602 func_show_eval "${RM}r \$removelist"
7605 # Now set the variables for building old libraries.
7606 if test "$build_old_libs" = yes && test "$build_libtool_libs" != convenience ; then
7607 func_append oldlibs " $output_objdir/$libname.$libext"
7609 # Transform .lo files to .o files.
7610 oldobjs="$objs "`$ECHO "$libobjs" | $SP2NL | $SED "/\.${libext}$/d; $lo2o" | $NL2SP`
7613 # Eliminate all temporary directories.
7614 #for path in $notinst_path; do
7615 # lib_search_path=`$ECHO "$lib_search_path " | $SED "s% $path % %g"`
7616 # deplibs=`$ECHO "$deplibs " | $SED "s% -L$path % %g"`
7617 # dependency_libs=`$ECHO "$dependency_libs " | $SED "s% -L$path % %g"`
7620 if test -n "$xrpath"; then
7621 # If the user specified any rpath flags, then add them.
7623 for libdir in $xrpath; do
7624 func_replace_sysroot "$libdir"
7625 func_append temp_xrpath " -R$func_replace_sysroot_result"
7626 case "$finalize_rpath " in
7628 *) func_append finalize_rpath " $libdir" ;;
7631 if test "$hardcode_into_libs" != yes || test "$build_old_libs" = yes; then
7632 dependency_libs="$temp_xrpath $dependency_libs"
7636 # Make sure dlfiles contains only unique files that won't be dlpreopened
7637 old_dlfiles="$dlfiles"
7639 for lib in $old_dlfiles; do
7640 case " $dlprefiles $dlfiles " in
7642 *) func_append dlfiles " $lib" ;;
7646 # Make sure dlprefiles contains only unique files
7647 old_dlprefiles="$dlprefiles"
7649 for lib in $old_dlprefiles; do
7650 case "$dlprefiles " in
7652 *) func_append dlprefiles " $lib" ;;
7656 if test "$build_libtool_libs" = yes; then
7657 if test -n "$rpath"; then
7659 *-*-cygwin* | *-*-mingw* | *-*-pw32* | *-*-os2* | *-*-beos* | *-cegcc* | *-*-haiku*)
7660 # these systems don't actually have a c library (as such)!
7662 *-*-rhapsody* | *-*-darwin1.[012])
7663 # Rhapsody C library is in the System framework
7664 func_append deplibs " System.ltframework"
7667 # Don't link with libc until the a.out ld.so is fixed.
7669 *-*-openbsd* | *-*-freebsd* | *-*-dragonfly*)
7670 # Do not include libc due to us having libc/libc_r.
7672 *-*-sco3.2v5* | *-*-sco5v6*)
7673 # Causes problems with __ctype
7675 *-*-sysv4.2uw2* | *-*-sysv5* | *-*-unixware* | *-*-OpenUNIX*)
7676 # Compiler inserts libc in the correct place for threads to work
7679 # Add libc to deplibs on all other systems if necessary.
7680 if test "$build_libtool_need_lc" = "yes"; then
7681 func_append deplibs " -lc"
7687 # Transform deplibs into only deplibs that can be linked in shared.
7689 libname_save=$libname
7690 release_save=$release
7691 versuffix_save=$versuffix
7693 # I'm not sure if I'm treating the release correctly. I think
7694 # release should show up in the -l (ie -lgmp5) so we don't want to
7695 # add it in twice. Is that correct?
7701 case $deplibs_check_method in
7703 # Don't check for shared/static. Everything works.
7704 # This might be a little naive. We might want to check
7705 # whether the library exists or not. But this is on
7706 # osf3 & osf4 and I'm not really sure... Just
7707 # implementing what was already the behavior.
7711 # This code stresses the "libraries are programs" paradigm to its
7712 # limits. Maybe even breaks it. We compile a program, linking it
7713 # against the deplibs as a proxy for the library. Then we can check
7714 # whether they linked in statically or dynamically with ldd.
7715 $opt_dry_run || $RM conftest.c
7716 cat > conftest.c <<EOF
7717 int main() { return 0; }
7719 $opt_dry_run || $RM conftest
7720 if $LTCC $LTCFLAGS -o conftest conftest.c $deplibs; then
7721 ldd_output=`ldd conftest`
7722 for i in $deplibs; do
7725 func_stripname -l '' "$i"
7726 name=$func_stripname_result
7727 if test "X$allow_libtool_libs_with_static_runtimes" = "Xyes" ; then
7728 case " $predeps $postdeps " in
7730 func_append newdeplibs " $i"
7735 if test -n "$i" ; then
7736 libname=`eval "\\$ECHO \"$libname_spec\""`
7737 deplib_matches=`eval "\\$ECHO \"$library_names_spec\""`
7738 set dummy $deplib_matches; shift
7740 if test `expr "$ldd_output" : ".*$deplib_match"` -ne 0 ; then
7741 func_append newdeplibs " $i"
7745 $ECHO "*** Warning: dynamic linker does not accept needed library $i."
7746 echo "*** I have the capability to make that library automatically link in when"
7747 echo "*** you link to this library. But I can only do this if you have a"
7748 echo "*** shared version of the library, which I believe you do not have"
7749 echo "*** because a test_compile did reveal that the linker did not use it for"
7750 echo "*** its dynamic dependency list that programs get resolved with at runtime."
7755 func_append newdeplibs " $i"
7760 # Error occurred in the first compile. Let's try to salvage
7761 # the situation: Compile a separate program for each library.
7762 for i in $deplibs; do
7765 func_stripname -l '' "$i"
7766 name=$func_stripname_result
7767 $opt_dry_run || $RM conftest
7768 if $LTCC $LTCFLAGS -o conftest conftest.c $i; then
7769 ldd_output=`ldd conftest`
7770 if test "X$allow_libtool_libs_with_static_runtimes" = "Xyes" ; then
7771 case " $predeps $postdeps " in
7773 func_append newdeplibs " $i"
7778 if test -n "$i" ; then
7779 libname=`eval "\\$ECHO \"$libname_spec\""`
7780 deplib_matches=`eval "\\$ECHO \"$library_names_spec\""`
7781 set dummy $deplib_matches; shift
7783 if test `expr "$ldd_output" : ".*$deplib_match"` -ne 0 ; then
7784 func_append newdeplibs " $i"
7788 $ECHO "*** Warning: dynamic linker does not accept needed library $i."
7789 echo "*** I have the capability to make that library automatically link in when"
7790 echo "*** you link to this library. But I can only do this if you have a"
7791 echo "*** shared version of the library, which you do not appear to have"
7792 echo "*** because a test_compile did reveal that the linker did not use this one"
7793 echo "*** as a dynamic dependency that programs can get resolved with at runtime."
7799 $ECHO "*** Warning! Library $i is needed by this library but I was not able to"
7800 echo "*** make it link in! You will probably need to install it or some"
7801 echo "*** library that it depends on before this library will be fully"
7802 echo "*** functional. Installing it before continuing would be even better."
7806 func_append newdeplibs " $i"
7813 set dummy $deplibs_check_method; shift
7814 file_magic_regex=`expr "$deplibs_check_method" : "$1 \(.*\)"`
7815 for a_deplib in $deplibs; do
7818 func_stripname -l '' "$a_deplib"
7819 name=$func_stripname_result
7820 if test "X$allow_libtool_libs_with_static_runtimes" = "Xyes" ; then
7821 case " $predeps $postdeps " in
7823 func_append newdeplibs " $a_deplib"
7828 if test -n "$a_deplib" ; then
7829 libname=`eval "\\$ECHO \"$libname_spec\""`
7830 if test -n "$file_magic_glob"; then
7831 libnameglob=`func_echo_all "$libname" | $SED -e $file_magic_glob`
7833 libnameglob=$libname
7835 test "$want_nocaseglob" = yes && nocaseglob=`shopt -p nocaseglob`
7836 for i in $lib_search_path $sys_lib_search_path $shlib_search_path; do
7837 if test "$want_nocaseglob" = yes; then
7839 potential_libs=`ls $i/$libnameglob[.-]* 2>/dev/null`
7842 potential_libs=`ls $i/$libnameglob[.-]* 2>/dev/null`
7844 for potent_lib in $potential_libs; do
7845 # Follow soft links.
7846 if ls -lLd "$potent_lib" 2>/dev/null |
7847 $GREP " -> " >/dev/null; then
7850 # The statement above tries to avoid entering an
7851 # endless loop below, in case of cyclic links.
7852 # We might still enter an endless loop, since a link
7853 # loop can be closed while we follow links,
7855 potlib="$potent_lib"
7856 while test -h "$potlib" 2>/dev/null; do
7857 potliblink=`ls -ld $potlib | ${SED} 's/.* -> //'`
7859 [\\/]* | [A-Za-z]:[\\/]*) potlib="$potliblink";;
7860 *) potlib=`$ECHO "$potlib" | $SED 's,[^/]*$,,'`"$potliblink";;
7863 if eval $file_magic_cmd \"\$potlib\" 2>/dev/null |
7865 $EGREP "$file_magic_regex" > /dev/null; then
7866 func_append newdeplibs " $a_deplib"
7873 if test -n "$a_deplib" ; then
7876 $ECHO "*** Warning: linker path does not have real file for library $a_deplib."
7877 echo "*** I have the capability to make that library automatically link in when"
7878 echo "*** you link to this library. But I can only do this if you have a"
7879 echo "*** shared version of the library, which you do not appear to have"
7880 echo "*** because I did check the linker path looking for a file starting"
7881 if test -z "$potlib" ; then
7882 $ECHO "*** with $libname but no candidates were found. (...for file magic test)"
7884 $ECHO "*** with $libname and none of the candidates passed a file format test"
7885 $ECHO "*** using a file magic. Last file checked: $potlib"
7890 # Add a -L argument.
7891 func_append newdeplibs " $a_deplib"
7894 done # Gone through all deplibs.
7897 set dummy $deplibs_check_method; shift
7898 match_pattern_regex=`expr "$deplibs_check_method" : "$1 \(.*\)"`
7899 for a_deplib in $deplibs; do
7902 func_stripname -l '' "$a_deplib"
7903 name=$func_stripname_result
7904 if test "X$allow_libtool_libs_with_static_runtimes" = "Xyes" ; then
7905 case " $predeps $postdeps " in
7907 func_append newdeplibs " $a_deplib"
7912 if test -n "$a_deplib" ; then
7913 libname=`eval "\\$ECHO \"$libname_spec\""`
7914 for i in $lib_search_path $sys_lib_search_path $shlib_search_path; do
7915 potential_libs=`ls $i/$libname[.-]* 2>/dev/null`
7916 for potent_lib in $potential_libs; do
7917 potlib="$potent_lib" # see symlink-check above in file_magic test
7918 if eval "\$ECHO \"$potent_lib\"" 2>/dev/null | $SED 10q | \
7919 $EGREP "$match_pattern_regex" > /dev/null; then
7920 func_append newdeplibs " $a_deplib"
7927 if test -n "$a_deplib" ; then
7930 $ECHO "*** Warning: linker path does not have real file for library $a_deplib."
7931 echo "*** I have the capability to make that library automatically link in when"
7932 echo "*** you link to this library. But I can only do this if you have a"
7933 echo "*** shared version of the library, which you do not appear to have"
7934 echo "*** because I did check the linker path looking for a file starting"
7935 if test -z "$potlib" ; then
7936 $ECHO "*** with $libname but no candidates were found. (...for regex pattern test)"
7938 $ECHO "*** with $libname and none of the candidates passed a file format test"
7939 $ECHO "*** using a regex pattern. Last file checked: $potlib"
7944 # Add a -L argument.
7945 func_append newdeplibs " $a_deplib"
7948 done # Gone through all deplibs.
7952 tmp_deplibs=`$ECHO " $deplibs" | $SED 's/ -lc$//; s/ -[LR][^ ]*//g'`
7953 if test "X$allow_libtool_libs_with_static_runtimes" = "Xyes" ; then
7954 for i in $predeps $postdeps ; do
7955 # can't use Xsed below, because $i might contain '/'
7956 tmp_deplibs=`$ECHO " $tmp_deplibs" | $SED "s,$i,,"`
7959 case $tmp_deplibs in
7962 if test "X$deplibs_check_method" = "Xnone"; then
7963 echo "*** Warning: inter-library dependencies are not supported in this platform."
7965 echo "*** Warning: inter-library dependencies are not known to be supported."
7967 echo "*** All declared inter-library dependencies are being dropped."
7973 versuffix=$versuffix_save
7975 release=$release_save
7976 libname=$libname_save
7980 *-*-rhapsody* | *-*-darwin1.[012])
7981 # On Rhapsody replace the C library with the System framework
7982 newdeplibs=`$ECHO " $newdeplibs" | $SED 's/ -lc / System.ltframework /'`
7986 if test "$droppeddeps" = yes; then
7987 if test "$module" = yes; then
7989 echo "*** Warning: libtool could not satisfy all declared inter-library"
7990 $ECHO "*** dependencies of module $libname. Therefore, libtool will create"
7991 echo "*** a static module, that should work as long as the dlopening"
7992 echo "*** application is linked with the -dlopen flag."
7993 if test -z "$global_symbol_pipe"; then
7995 echo "*** However, this would only work if libtool was able to extract symbol"
7996 echo "*** lists from a program, using \`nm' or equivalent, but libtool could"
7997 echo "*** not find such a program. So, this module is probably useless."
7998 echo "*** \`nm' from GNU binutils and a full rebuild may help."
8000 if test "$build_old_libs" = no; then
8001 oldlibs="$output_objdir/$libname.$libext"
8002 build_libtool_libs=module
8005 build_libtool_libs=no
8008 echo "*** The inter-library dependencies that have been dropped here will be"
8009 echo "*** automatically added whenever a program is linked with this library"
8010 echo "*** or is declared to -dlopen it."
8012 if test "$allow_undefined" = no; then
8014 echo "*** Since this library must not contain undefined symbols,"
8015 echo "*** because either the platform does not support them or"
8016 echo "*** it was explicitly requested with -no-undefined,"
8017 echo "*** libtool will only create a static version of it."
8018 if test "$build_old_libs" = no; then
8019 oldlibs="$output_objdir/$libname.$libext"
8020 build_libtool_libs=module
8023 build_libtool_libs=no
8028 # Done checking deplibs!
8031 # Time to change all our "foo.ltframework" stuff back to "-framework foo"
8034 newdeplibs=`$ECHO " $newdeplibs" | $SED 's% \([^ $]*\).ltframework% -framework \1%g'`
8035 new_inherited_linker_flags=`$ECHO " $new_inherited_linker_flags" | $SED 's% \([^ $]*\).ltframework% -framework \1%g'`
8036 deplibs=`$ECHO " $deplibs" | $SED 's% \([^ $]*\).ltframework% -framework \1%g'`
8040 # move library search paths that coincide with paths to not yet
8041 # installed libraries to the beginning of the library search list
8043 for path in $notinst_path; do
8044 case " $new_libs " in
8045 *" -L$path/$objdir "*) ;;
8047 case " $deplibs " in
8048 *" -L$path/$objdir "*)
8049 func_append new_libs " -L$path/$objdir" ;;
8054 for deplib in $deplibs; do
8057 case " $new_libs " in
8059 *) func_append new_libs " $deplib" ;;
8062 *) func_append new_libs " $deplib" ;;
8067 # All the library-specific variables (install_libdir is set above).
8072 # Test again, we may have decided not to build it any more
8073 if test "$build_libtool_libs" = yes; then
8074 if test "$hardcode_into_libs" = yes; then
8075 # Hardcode the library paths
8078 rpath="$finalize_rpath"
8079 test "$opt_mode" != relink && rpath="$compile_rpath$rpath"
8080 for libdir in $rpath; do
8081 if test -n "$hardcode_libdir_flag_spec"; then
8082 if test -n "$hardcode_libdir_separator"; then
8083 func_replace_sysroot "$libdir"
8084 libdir=$func_replace_sysroot_result
8085 if test -z "$hardcode_libdirs"; then
8086 hardcode_libdirs="$libdir"
8088 # Just accumulate the unique libdirs.
8089 case $hardcode_libdir_separator$hardcode_libdirs$hardcode_libdir_separator in
8090 *"$hardcode_libdir_separator$libdir$hardcode_libdir_separator"*)
8093 func_append hardcode_libdirs "$hardcode_libdir_separator$libdir"
8098 eval flag=\"$hardcode_libdir_flag_spec\"
8099 func_append dep_rpath " $flag"
8101 elif test -n "$runpath_var"; then
8102 case "$perm_rpath " in
8104 *) func_apped perm_rpath " $libdir" ;;
8108 # Substitute the hardcoded libdirs into the rpath.
8109 if test -n "$hardcode_libdir_separator" &&
8110 test -n "$hardcode_libdirs"; then
8111 libdir="$hardcode_libdirs"
8112 if test -n "$hardcode_libdir_flag_spec_ld"; then
8113 eval dep_rpath=\"$hardcode_libdir_flag_spec_ld\"
8115 eval dep_rpath=\"$hardcode_libdir_flag_spec\"
8118 if test -n "$runpath_var" && test -n "$perm_rpath"; then
8119 # We should set the runpath_var.
8121 for dir in $perm_rpath; do
8122 func_append rpath "$dir:"
8124 eval "$runpath_var='$rpath\$$runpath_var'; export $runpath_var"
8126 test -n "$dep_rpath" && deplibs="$dep_rpath $deplibs"
8129 shlibpath="$finalize_shlibpath"
8130 test "$opt_mode" != relink && shlibpath="$compile_shlibpath$shlibpath"
8131 if test -n "$shlibpath"; then
8132 eval "$shlibpath_var='$shlibpath\$$shlibpath_var'; export $shlibpath_var"
8135 # Get the real and link names of the library.
8136 eval shared_ext=\"$shrext_cmds\"
8137 eval library_names=\"$library_names_spec\"
8138 set dummy $library_names
8143 if test -n "$soname_spec"; then
8144 eval soname=\"$soname_spec\"
8148 if test -z "$dlname"; then
8152 lib="$output_objdir/$realname"
8156 func_append linknames " $link"
8159 # Use standard objects if they are pic
8160 test -z "$pic_flag" && libobjs=`$ECHO "$libobjs" | $SP2NL | $SED "$lo2o" | $NL2SP`
8161 test "X$libobjs" = "X " && libobjs=
8164 if test -n "$export_symbols" && test -n "$include_expsyms"; then
8165 $opt_dry_run || cp "$export_symbols" "$output_objdir/$libname.uexp"
8166 export_symbols="$output_objdir/$libname.uexp"
8167 func_append delfiles " $export_symbols"
8170 orig_export_symbols=
8172 cygwin* | mingw* | cegcc*)
8173 if test -n "$export_symbols" && test -z "$export_symbols_regex"; then
8174 # exporting using user supplied symfile
8175 if test "x`$SED 1q $export_symbols`" != xEXPORTS; then
8176 # and it's NOT already a .def file. Must figure out
8177 # which of the given symbols are data symbols and tag
8178 # them as such. So, trigger use of export_symbols_cmds.
8179 # export_symbols gets reassigned inside the "prepare
8180 # the list of exported symbols" if statement, so the
8181 # include_expsyms logic still works.
8182 orig_export_symbols="$export_symbols"
8184 always_export_symbols=yes
8190 # Prepare the list of exported symbols
8191 if test -z "$export_symbols"; then
8192 if test "$always_export_symbols" = yes || test -n "$export_symbols_regex"; then
8193 func_verbose "generating symbol list for \`$libname.la'"
8194 export_symbols="$output_objdir/$libname.exp"
8195 $opt_dry_run || $RM $export_symbols
8196 cmds=$export_symbols_cmds
8197 save_ifs="$IFS"; IFS='~'
8198 for cmd1 in $cmds; do
8200 # Take the normal branch if the nm_file_list_spec branch
8201 # doesn't work or if tool conversion is not needed.
8202 case $nm_file_list_spec~$to_tool_file_cmd in
8203 *~func_convert_file_noop | *~func_convert_file_msys_to_w32 | ~*)
8204 try_normal_branch=yes
8207 len=$func_len_result
8210 try_normal_branch=no
8213 if test "$try_normal_branch" = yes \
8214 && { test "$len" -lt "$max_cmd_len" \
8215 || test "$max_cmd_len" -le -1; }
8217 func_show_eval "$cmd" 'exit $?'
8218 skipped_export=false
8219 elif test -n "$nm_file_list_spec"; then
8220 func_basename "$output"
8221 output_la=$func_basename_result
8222 save_libobjs=$libobjs
8224 output=${output_objdir}/${output_la}.nm
8225 func_to_tool_file "$output"
8226 libobjs=$nm_file_list_spec$func_to_tool_file_result
8227 func_append delfiles " $output"
8228 func_verbose "creating $NM input file list: $output"
8229 for obj in $save_libobjs; do
8230 func_to_tool_file "$obj"
8231 $ECHO "$func_to_tool_file_result"
8234 func_show_eval "$cmd" 'exit $?'
8236 libobjs=$save_libobjs
8237 skipped_export=false
8239 # The command line is too long to execute in one step.
8240 func_verbose "using reloadable object file for export list..."
8242 # Break out early, otherwise skipped_export may be
8243 # set to false by a later but shorter cmd.
8248 if test -n "$export_symbols_regex" && test "X$skipped_export" != "X:"; then
8249 func_show_eval '$EGREP -e "$export_symbols_regex" "$export_symbols" > "${export_symbols}T"'
8250 func_show_eval '$MV "${export_symbols}T" "$export_symbols"'
8255 if test -n "$export_symbols" && test -n "$include_expsyms"; then
8256 tmp_export_symbols="$export_symbols"
8257 test -n "$orig_export_symbols" && tmp_export_symbols="$orig_export_symbols"
8258 $opt_dry_run || eval '$ECHO "$include_expsyms" | $SP2NL >> "$tmp_export_symbols"'
8261 if test "X$skipped_export" != "X:" && test -n "$orig_export_symbols"; then
8262 # The given exports_symbols file has to be filtered, so filter it.
8263 func_verbose "filter symbol list for \`$libname.la' to tag DATA exports"
8264 # FIXME: $output_objdir/$libname.filter potentially contains lots of
8265 # 's' commands which not all seds can handle. GNU sed should be fine
8266 # though. Also, the filter scales superlinearly with the number of
8267 # global variables. join(1) would be nice here, but unfortunately
8268 # isn't a blessed tool.
8269 $opt_dry_run || $SED -e '/[ ,]DATA/!d;s,\(.*\)\([ \,].*\),s|^\1$|\1\2|,' < $export_symbols > $output_objdir/$libname.filter
8270 func_append delfiles " $export_symbols $output_objdir/$libname.filter"
8271 export_symbols=$output_objdir/$libname.def
8272 $opt_dry_run || $SED -f $output_objdir/$libname.filter < $orig_export_symbols > $export_symbols
8276 for test_deplib in $deplibs; do
8277 case " $convenience " in
8278 *" $test_deplib "*) ;;
8280 func_append tmp_deplibs " $test_deplib"
8284 deplibs="$tmp_deplibs"
8286 if test -n "$convenience"; then
8287 if test -n "$whole_archive_flag_spec" &&
8288 test "$compiler_needs_object" = yes &&
8289 test -z "$libobjs"; then
8290 # extract the archives, so we have objects to list.
8291 # TODO: could optimize this to just extract one archive.
8292 whole_archive_flag_spec=
8294 if test -n "$whole_archive_flag_spec"; then
8295 save_libobjs=$libobjs
8296 eval libobjs=\"\$libobjs $whole_archive_flag_spec\"
8297 test "X$libobjs" = "X " && libobjs=
8299 gentop="$output_objdir/${outputname}x"
8300 func_append generated " $gentop"
8302 func_extract_archives $gentop $convenience
8303 func_append libobjs " $func_extract_archives_result"
8304 test "X$libobjs" = "X " && libobjs=
8308 if test "$thread_safe" = yes && test -n "$thread_safe_flag_spec"; then
8309 eval flag=\"$thread_safe_flag_spec\"
8310 func_append linker_flags " $flag"
8313 # Make a backup of the uninstalled library when relinking
8314 if test "$opt_mode" = relink; then
8315 $opt_dry_run || eval '(cd $output_objdir && $RM ${realname}U && $MV $realname ${realname}U)' || exit $?
8318 # Do each of the archive commands.
8319 if test "$module" = yes && test -n "$module_cmds" ; then
8320 if test -n "$export_symbols" && test -n "$module_expsym_cmds"; then
8321 eval test_cmds=\"$module_expsym_cmds\"
8322 cmds=$module_expsym_cmds
8324 eval test_cmds=\"$module_cmds\"
8328 if test -n "$export_symbols" && test -n "$archive_expsym_cmds"; then
8329 eval test_cmds=\"$archive_expsym_cmds\"
8330 cmds=$archive_expsym_cmds
8332 eval test_cmds=\"$archive_cmds\"
8337 if test "X$skipped_export" != "X:" &&
8338 func_len " $test_cmds" &&
8339 len=$func_len_result &&
8340 test "$len" -lt "$max_cmd_len" || test "$max_cmd_len" -le -1; then
8343 # The command line is too long to link in one step, link piecewise
8344 # or, if using GNU ld and skipped_export is not :, use a linker
8347 # Save the value of $output and $libobjs because we want to
8348 # use them later. If we have whole_archive_flag_spec, we
8349 # want to use save_libobjs as it was before
8350 # whole_archive_flag_spec was expanded, because we can't
8351 # assume the linker understands whole_archive_flag_spec.
8352 # This may have to be revisited, in case too many
8353 # convenience libraries get linked in and end up exceeding
8355 if test -z "$convenience" || test -z "$whole_archive_flag_spec"; then
8356 save_libobjs=$libobjs
8359 func_basename "$output"
8360 output_la=$func_basename_result
8362 # Clear the reloadable object creation command queue and
8363 # initialize k to one.
8370 if test -n "$save_libobjs" && test "X$skipped_export" != "X:" && test "$with_gnu_ld" = yes; then
8371 output=${output_objdir}/${output_la}.lnkscript
8372 func_verbose "creating GNU ld script: $output"
8373 echo 'INPUT (' > $output
8374 for obj in $save_libobjs
8376 func_to_tool_file "$obj"
8377 $ECHO "$func_to_tool_file_result" >> $output
8380 func_append delfiles " $output"
8381 func_to_tool_file "$output"
8382 output=$func_to_tool_file_result
8383 elif test -n "$save_libobjs" && test "X$skipped_export" != "X:" && test "X$file_list_spec" != X; then
8384 output=${output_objdir}/${output_la}.lnk
8385 func_verbose "creating linker input file list: $output"
8390 if test "$compiler_needs_object" = yes; then
8396 func_to_tool_file "$obj"
8397 $ECHO "$func_to_tool_file_result" >> $output
8399 func_append delfiles " $output"
8400 func_to_tool_file "$output"
8401 output=$firstobj\"$file_list_spec$func_to_tool_file_result\"
8403 if test -n "$save_libobjs"; then
8404 func_verbose "creating reloadable object files..."
8405 output=$output_objdir/$output_la-${k}.$objext
8406 eval test_cmds=\"$reload_cmds\"
8407 func_len " $test_cmds"
8408 len0=$func_len_result
8411 # Loop over the list of objects to be linked.
8412 for obj in $save_libobjs
8415 func_arith $len + $func_len_result
8416 len=$func_arith_result
8417 if test "X$objlist" = X ||
8418 test "$len" -lt "$max_cmd_len"; then
8419 func_append objlist " $obj"
8421 # The command $test_cmds is almost too long, add a
8422 # command to the queue.
8423 if test "$k" -eq 1 ; then
8424 # The first file doesn't have a previous command to add.
8425 reload_objs=$objlist
8426 eval concat_cmds=\"$reload_cmds\"
8428 # All subsequent reloadable object files will link in
8429 # the last one created.
8430 reload_objs="$objlist $last_robj"
8431 eval concat_cmds=\"\$concat_cmds~$reload_cmds~\$RM $last_robj\"
8433 last_robj=$output_objdir/$output_la-${k}.$objext
8435 k=$func_arith_result
8436 output=$output_objdir/$output_la-${k}.$objext
8438 func_len " $last_robj"
8439 func_arith $len0 + $func_len_result
8440 len=$func_arith_result
8443 # Handle the remaining objects by creating one last
8444 # reloadable object file. All subsequent reloadable object
8445 # files will link in the last one created.
8446 test -z "$concat_cmds" || concat_cmds=$concat_cmds~
8447 reload_objs="$objlist $last_robj"
8448 eval concat_cmds=\"\${concat_cmds}$reload_cmds\"
8449 if test -n "$last_robj"; then
8450 eval concat_cmds=\"\${concat_cmds}~\$RM $last_robj\"
8452 func_append delfiles " $output"
8458 if ${skipped_export-false}; then
8459 func_verbose "generating symbol list for \`$libname.la'"
8460 export_symbols="$output_objdir/$libname.exp"
8461 $opt_dry_run || $RM $export_symbols
8463 # Append the command to create the export file.
8464 test -z "$concat_cmds" || concat_cmds=$concat_cmds~
8465 eval concat_cmds=\"\$concat_cmds$export_symbols_cmds\"
8466 if test -n "$last_robj"; then
8467 eval concat_cmds=\"\$concat_cmds~\$RM $last_robj\"
8471 test -n "$save_libobjs" &&
8472 func_verbose "creating a temporary reloadable object file: $output"
8474 # Loop through the commands generated above and execute them.
8475 save_ifs="$IFS"; IFS='~'
8476 for cmd in $concat_cmds; do
8479 func_quote_for_expand "$cmd"
8480 eval "func_echo $func_quote_for_expand_result"
8482 $opt_dry_run || eval "$cmd" || {
8485 # Restore the uninstalled library and exit
8486 if test "$opt_mode" = relink; then
8487 ( cd "$output_objdir" && \
8488 $RM "${realname}T" && \
8489 $MV "${realname}U" "$realname" )
8497 if test -n "$export_symbols_regex" && ${skipped_export-false}; then
8498 func_show_eval '$EGREP -e "$export_symbols_regex" "$export_symbols" > "${export_symbols}T"'
8499 func_show_eval '$MV "${export_symbols}T" "$export_symbols"'
8503 if ${skipped_export-false}; then
8504 if test -n "$export_symbols" && test -n "$include_expsyms"; then
8505 tmp_export_symbols="$export_symbols"
8506 test -n "$orig_export_symbols" && tmp_export_symbols="$orig_export_symbols"
8507 $opt_dry_run || eval '$ECHO "$include_expsyms" | $SP2NL >> "$tmp_export_symbols"'
8510 if test -n "$orig_export_symbols"; then
8511 # The given exports_symbols file has to be filtered, so filter it.
8512 func_verbose "filter symbol list for \`$libname.la' to tag DATA exports"
8513 # FIXME: $output_objdir/$libname.filter potentially contains lots of
8514 # 's' commands which not all seds can handle. GNU sed should be fine
8515 # though. Also, the filter scales superlinearly with the number of
8516 # global variables. join(1) would be nice here, but unfortunately
8517 # isn't a blessed tool.
8518 $opt_dry_run || $SED -e '/[ ,]DATA/!d;s,\(.*\)\([ \,].*\),s|^\1$|\1\2|,' < $export_symbols > $output_objdir/$libname.filter
8519 func_append delfiles " $export_symbols $output_objdir/$libname.filter"
8520 export_symbols=$output_objdir/$libname.def
8521 $opt_dry_run || $SED -f $output_objdir/$libname.filter < $orig_export_symbols > $export_symbols
8526 # Restore the value of output.
8529 if test -n "$convenience" && test -n "$whole_archive_flag_spec"; then
8530 eval libobjs=\"\$libobjs $whole_archive_flag_spec\"
8531 test "X$libobjs" = "X " && libobjs=
8533 # Expand the library linking commands again to reset the
8534 # value of $libobjs for piecewise linking.
8536 # Do each of the archive commands.
8537 if test "$module" = yes && test -n "$module_cmds" ; then
8538 if test -n "$export_symbols" && test -n "$module_expsym_cmds"; then
8539 cmds=$module_expsym_cmds
8544 if test -n "$export_symbols" && test -n "$archive_expsym_cmds"; then
8545 cmds=$archive_expsym_cmds
8552 if test -n "$delfiles"; then
8553 # Append the command to remove temporary files to $cmds.
8554 eval cmds=\"\$cmds~\$RM $delfiles\"
8557 # Add any objects from preloaded convenience libraries
8558 if test -n "$dlprefiles"; then
8559 gentop="$output_objdir/${outputname}x"
8560 func_append generated " $gentop"
8562 func_extract_archives $gentop $dlprefiles
8563 func_append libobjs " $func_extract_archives_result"
8564 test "X$libobjs" = "X " && libobjs=
8567 save_ifs="$IFS"; IFS='~'
8568 for cmd in $cmds; do
8572 func_quote_for_expand "$cmd"
8573 eval "func_echo $func_quote_for_expand_result"
8575 $opt_dry_run || eval "$cmd" || {
8578 # Restore the uninstalled library and exit
8579 if test "$opt_mode" = relink; then
8580 ( cd "$output_objdir" && \
8581 $RM "${realname}T" && \
8582 $MV "${realname}U" "$realname" )
8590 # Restore the uninstalled library and exit
8591 if test "$opt_mode" = relink; then
8592 $opt_dry_run || eval '(cd $output_objdir && $RM ${realname}T && $MV $realname ${realname}T && $MV ${realname}U $realname)' || exit $?
8594 if test -n "$convenience"; then
8595 if test -z "$whole_archive_flag_spec"; then
8596 func_show_eval '${RM}r "$gentop"'
8603 # Create links to the real library.
8604 for linkname in $linknames; do
8605 if test "$realname" != "$linkname"; then
8606 func_show_eval '(cd "$output_objdir" && $RM "$linkname" && $LN_S "$realname" "$linkname")' 'exit $?'
8610 # If -module or -export-dynamic was specified, set the dlname.
8611 if test "$module" = yes || test "$export_dynamic" = yes; then
8612 # On all known operating systems, these are identical.
8619 if test -n "$dlfiles$dlprefiles" || test "$dlself" != no; then
8620 func_warning "\`-dlopen' is ignored for objects"
8625 func_warning "\`-l' and \`-L' are ignored for objects" ;;
8628 test -n "$rpath" && \
8629 func_warning "\`-rpath' is ignored for objects"
8631 test -n "$xrpath" && \
8632 func_warning "\`-R' is ignored for objects"
8634 test -n "$vinfo" && \
8635 func_warning "\`-version-info' is ignored for objects"
8637 test -n "$release" && \
8638 func_warning "\`-release' is ignored for objects"
8642 test -n "$objs$old_deplibs" && \
8643 func_fatal_error "cannot build library object \`$output' from non-libtool objects"
8647 obj=$func_lo2o_result
8655 # Delete the old objects.
8656 $opt_dry_run || $RM $obj $libobj
8658 # Objects from convenience libraries. This assumes
8659 # single-version convenience libraries. Whenever we create
8660 # different ones for PIC/non-PIC, this we'll have to duplicate
8664 # reload_cmds runs $LD directly, so let us get rid of
8665 # -Wl from whole_archive_flag_spec and hope we can get by with
8666 # turning comma into space..
8669 if test -n "$convenience"; then
8670 if test -n "$whole_archive_flag_spec"; then
8671 eval tmp_whole_archive_flags=\"$whole_archive_flag_spec\"
8672 reload_conv_objs=$reload_objs\ `$ECHO "$tmp_whole_archive_flags" | $SED 's|,| |g'`
8674 gentop="$output_objdir/${obj}x"
8675 func_append generated " $gentop"
8677 func_extract_archives $gentop $convenience
8678 reload_conv_objs="$reload_objs $func_extract_archives_result"
8682 # If we're not building shared, we need to use non_pic_objs
8683 test "$build_libtool_libs" != yes && libobjs="$non_pic_objects"
8685 # Create the old-style object.
8686 reload_objs="$objs$old_deplibs "`$ECHO "$libobjs" | $SP2NL | $SED "/\.${libext}$/d; /\.lib$/d; $lo2o" | $NL2SP`" $reload_conv_objs" ### testsuite: skip nested quoting test
8689 func_execute_cmds "$reload_cmds" 'exit $?'
8691 # Exit if we aren't doing a library object file.
8692 if test -z "$libobj"; then
8693 if test -n "$gentop"; then
8694 func_show_eval '${RM}r "$gentop"'
8700 if test "$build_libtool_libs" != yes; then
8701 if test -n "$gentop"; then
8702 func_show_eval '${RM}r "$gentop"'
8705 # Create an invalid libtool object if no PIC, so that we don't
8706 # accidentally link it into a program.
8707 # $show "echo timestamp > $libobj"
8708 # $opt_dry_run || eval "echo timestamp > $libobj" || exit $?
8712 if test -n "$pic_flag" || test "$pic_mode" != default; then
8713 # Only do commands if we really have different PIC objects.
8714 reload_objs="$libobjs $reload_conv_objs"
8716 func_execute_cmds "$reload_cmds" 'exit $?'
8719 if test -n "$gentop"; then
8720 func_show_eval '${RM}r "$gentop"'
8728 *cygwin*) func_stripname '' '.exe' "$output"
8729 output=$func_stripname_result.exe;;
8731 test -n "$vinfo" && \
8732 func_warning "\`-version-info' is ignored for programs"
8734 test -n "$release" && \
8735 func_warning "\`-release' is ignored for programs"
8737 test "$preload" = yes \
8738 && test "$dlopen_support" = unknown \
8739 && test "$dlopen_self" = unknown \
8740 && test "$dlopen_self_static" = unknown && \
8741 func_warning "\`LT_INIT([dlopen])' not used. Assuming no dlopen support."
8744 *-*-rhapsody* | *-*-darwin1.[012])
8745 # On Rhapsody replace the C library is the System framework
8746 compile_deplibs=`$ECHO " $compile_deplibs" | $SED 's/ -lc / System.ltframework /'`
8747 finalize_deplibs=`$ECHO " $finalize_deplibs" | $SED 's/ -lc / System.ltframework /'`
8753 # Don't allow lazy linking, it breaks C++ global constructors
8754 # But is supposedly fixed on 10.4 or later (yay!).
8755 if test "$tagname" = CXX ; then
8756 case ${MACOSX_DEPLOYMENT_TARGET-10.0} in
8758 func_append compile_command " ${wl}-bind_at_load"
8759 func_append finalize_command " ${wl}-bind_at_load"
8763 # Time to change all our "foo.ltframework" stuff back to "-framework foo"
8764 compile_deplibs=`$ECHO " $compile_deplibs" | $SED 's% \([^ $]*\).ltframework% -framework \1%g'`
8765 finalize_deplibs=`$ECHO " $finalize_deplibs" | $SED 's% \([^ $]*\).ltframework% -framework \1%g'`
8770 # move library search paths that coincide with paths to not yet
8771 # installed libraries to the beginning of the library search list
8773 for path in $notinst_path; do
8774 case " $new_libs " in
8775 *" -L$path/$objdir "*) ;;
8777 case " $compile_deplibs " in
8778 *" -L$path/$objdir "*)
8779 func_append new_libs " -L$path/$objdir" ;;
8784 for deplib in $compile_deplibs; do
8787 case " $new_libs " in
8789 *) func_append new_libs " $deplib" ;;
8792 *) func_append new_libs " $deplib" ;;
8795 compile_deplibs="$new_libs"
8798 func_append compile_command " $compile_deplibs"
8799 func_append finalize_command " $finalize_deplibs"
8801 if test -n "$rpath$xrpath"; then
8802 # If the user specified any rpath flags, then add them.
8803 for libdir in $rpath $xrpath; do
8804 # This is the magic to use -rpath.
8805 case "$finalize_rpath " in
8807 *) func_append finalize_rpath " $libdir" ;;
8812 # Now hardcode the library paths
8815 for libdir in $compile_rpath $finalize_rpath; do
8816 if test -n "$hardcode_libdir_flag_spec"; then
8817 if test -n "$hardcode_libdir_separator"; then
8818 if test -z "$hardcode_libdirs"; then
8819 hardcode_libdirs="$libdir"
8821 # Just accumulate the unique libdirs.
8822 case $hardcode_libdir_separator$hardcode_libdirs$hardcode_libdir_separator in
8823 *"$hardcode_libdir_separator$libdir$hardcode_libdir_separator"*)
8826 func_append hardcode_libdirs "$hardcode_libdir_separator$libdir"
8831 eval flag=\"$hardcode_libdir_flag_spec\"
8832 func_append rpath " $flag"
8834 elif test -n "$runpath_var"; then
8835 case "$perm_rpath " in
8837 *) func_append perm_rpath " $libdir" ;;
8841 *-*-cygwin* | *-*-mingw* | *-*-pw32* | *-*-os2* | *-cegcc*)
8842 testbindir=`${ECHO} "$libdir" | ${SED} -e 's*/lib$*/bin*'`
8843 case :$dllsearchpath: in
8845 ::) dllsearchpath=$libdir;;
8846 *) func_append dllsearchpath ":$libdir";;
8848 case :$dllsearchpath: in
8849 *":$testbindir:"*) ;;
8850 ::) dllsearchpath=$testbindir;;
8851 *) func_append dllsearchpath ":$testbindir";;
8856 # Substitute the hardcoded libdirs into the rpath.
8857 if test -n "$hardcode_libdir_separator" &&
8858 test -n "$hardcode_libdirs"; then
8859 libdir="$hardcode_libdirs"
8860 eval rpath=\" $hardcode_libdir_flag_spec\"
8862 compile_rpath="$rpath"
8866 for libdir in $finalize_rpath; do
8867 if test -n "$hardcode_libdir_flag_spec"; then
8868 if test -n "$hardcode_libdir_separator"; then
8869 if test -z "$hardcode_libdirs"; then
8870 hardcode_libdirs="$libdir"
8872 # Just accumulate the unique libdirs.
8873 case $hardcode_libdir_separator$hardcode_libdirs$hardcode_libdir_separator in
8874 *"$hardcode_libdir_separator$libdir$hardcode_libdir_separator"*)
8877 func_append hardcode_libdirs "$hardcode_libdir_separator$libdir"
8882 eval flag=\"$hardcode_libdir_flag_spec\"
8883 func_append rpath " $flag"
8885 elif test -n "$runpath_var"; then
8886 case "$finalize_perm_rpath " in
8888 *) func_append finalize_perm_rpath " $libdir" ;;
8892 # Substitute the hardcoded libdirs into the rpath.
8893 if test -n "$hardcode_libdir_separator" &&
8894 test -n "$hardcode_libdirs"; then
8895 libdir="$hardcode_libdirs"
8896 eval rpath=\" $hardcode_libdir_flag_spec\"
8898 finalize_rpath="$rpath"
8900 if test -n "$libobjs" && test "$build_old_libs" = yes; then
8901 # Transform all the library objects into standard objects.
8902 compile_command=`$ECHO "$compile_command" | $SP2NL | $SED "$lo2o" | $NL2SP`
8903 finalize_command=`$ECHO "$finalize_command" | $SP2NL | $SED "$lo2o" | $NL2SP`
8906 func_generate_dlsyms "$outputname" "@PROGRAM@" "no"
8908 # template prelinking step
8909 if test -n "$prelink_cmds"; then
8910 func_execute_cmds "$prelink_cmds" 'exit $?'
8913 wrappers_required=yes
8915 *cegcc* | *mingw32ce*)
8916 # Disable wrappers for cegcc and mingw32ce hosts, we are cross compiling anyway.
8917 wrappers_required=no
8919 *cygwin* | *mingw* )
8920 if test "$build_libtool_libs" != yes; then
8921 wrappers_required=no
8925 if test "$need_relink" = no || test "$build_libtool_libs" != yes; then
8926 wrappers_required=no
8930 if test "$wrappers_required" = no; then
8931 # Replace the output file specification.
8932 compile_command=`$ECHO "$compile_command" | $SED 's%@OUTPUT@%'"$output"'%g'`
8933 link_command="$compile_command$compile_rpath"
8935 # We have no uninstalled library dependencies, so finalize right now.
8937 func_show_eval "$link_command" 'exit_status=$?'
8939 if test -n "$postlink_cmds"; then
8940 func_to_tool_file "$output"
8941 postlink_cmds=`func_echo_all "$postlink_cmds" | $SED -e 's%@OUTPUT@%'"$output"'%g' -e 's%@TOOL_OUTPUT@%'"$func_to_tool_file_result"'%g'`
8942 func_execute_cmds "$postlink_cmds" 'exit $?'
8945 # Delete the generated files.
8946 if test -f "$output_objdir/${outputname}S.${objext}"; then
8947 func_show_eval '$RM "$output_objdir/${outputname}S.${objext}"'
8953 if test -n "$compile_shlibpath$finalize_shlibpath"; then
8954 compile_command="$shlibpath_var=\"$compile_shlibpath$finalize_shlibpath\$$shlibpath_var\" $compile_command"
8956 if test -n "$finalize_shlibpath"; then
8957 finalize_command="$shlibpath_var=\"$finalize_shlibpath\$$shlibpath_var\" $finalize_command"
8962 if test -n "$runpath_var"; then
8963 if test -n "$perm_rpath"; then
8964 # We should set the runpath_var.
8966 for dir in $perm_rpath; do
8967 func_append rpath "$dir:"
8969 compile_var="$runpath_var=\"$rpath\$$runpath_var\" "
8971 if test -n "$finalize_perm_rpath"; then
8972 # We should set the runpath_var.
8974 for dir in $finalize_perm_rpath; do
8975 func_append rpath "$dir:"
8977 finalize_var="$runpath_var=\"$rpath\$$runpath_var\" "
8981 if test "$no_install" = yes; then
8982 # We don't need to create a wrapper script.
8983 link_command="$compile_var$compile_command$compile_rpath"
8984 # Replace the output file specification.
8985 link_command=`$ECHO "$link_command" | $SED 's%@OUTPUT@%'"$output"'%g'`
8986 # Delete the old output file.
8987 $opt_dry_run || $RM $output
8988 # Link the executable and exit
8989 func_show_eval "$link_command" 'exit $?'
8991 if test -n "$postlink_cmds"; then
8992 func_to_tool_file "$output"
8993 postlink_cmds=`func_echo_all "$postlink_cmds" | $SED -e 's%@OUTPUT@%'"$output"'%g' -e 's%@TOOL_OUTPUT@%'"$func_to_tool_file_result"'%g'`
8994 func_execute_cmds "$postlink_cmds" 'exit $?'
9000 if test "$hardcode_action" = relink; then
9001 # Fast installation is not supported
9002 link_command="$compile_var$compile_command$compile_rpath"
9003 relink_command="$finalize_var$finalize_command$finalize_rpath"
9005 func_warning "this platform does not like uninstalled shared libraries"
9006 func_warning "\`$output' will be relinked during installation"
9008 if test "$fast_install" != no; then
9009 link_command="$finalize_var$compile_command$finalize_rpath"
9010 if test "$fast_install" = yes; then
9011 relink_command=`$ECHO "$compile_var$compile_command$compile_rpath" | $SED 's%@OUTPUT@%\$progdir/\$file%g'`
9013 # fast_install is set to needless
9017 link_command="$compile_var$compile_command$compile_rpath"
9018 relink_command="$finalize_var$finalize_command$finalize_rpath"
9022 # Replace the output file specification.
9023 link_command=`$ECHO "$link_command" | $SED 's%@OUTPUT@%'"$output_objdir/$outputname"'%g'`
9025 # Delete the old output files.
9026 $opt_dry_run || $RM $output $output_objdir/$outputname $output_objdir/lt-$outputname
9028 func_show_eval "$link_command" 'exit $?'
9030 if test -n "$postlink_cmds"; then
9031 func_to_tool_file "$output_objdir/$outputname"
9032 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'`
9033 func_execute_cmds "$postlink_cmds" 'exit $?'
9036 # Now create the wrapper script.
9037 func_verbose "creating $output"
9039 # Quote the relink command for shipping.
9040 if test -n "$relink_command"; then
9041 # Preserve any variables that may affect compiler behavior
9042 for var in $variables_saved_for_relink; do
9043 if eval test -z \"\${$var+set}\"; then
9044 relink_command="{ test -z \"\${$var+set}\" || $lt_unset $var || { $var=; export $var; }; }; $relink_command"
9045 elif eval var_value=\$$var; test -z "$var_value"; then
9046 relink_command="$var=; export $var; $relink_command"
9048 func_quote_for_eval "$var_value"
9049 relink_command="$var=$func_quote_for_eval_result; export $var; $relink_command"
9052 relink_command="(cd `pwd`; $relink_command)"
9053 relink_command=`$ECHO "$relink_command" | $SED "$sed_quote_subst"`
9056 # Only actually do things if not in dry run mode.
9058 # win32 will think the script is a binary if it has
9059 # a .exe suffix, so we strip it off here.
9061 *.exe) func_stripname '' '.exe' "$output"
9062 output=$func_stripname_result ;;
9064 # test for cygwin because mv fails w/o .exe extensions
9068 func_stripname '' '.exe' "$outputname"
9069 outputname=$func_stripname_result ;;
9073 *cygwin* | *mingw* )
9074 func_dirname_and_basename "$output" "" "."
9075 output_name=$func_basename_result
9076 output_path=$func_dirname_result
9077 cwrappersource="$output_path/$objdir/lt-$output_name.c"
9078 cwrapper="$output_path/$output_name.exe"
9079 $RM $cwrappersource $cwrapper
9080 trap "$RM $cwrappersource $cwrapper; exit $EXIT_FAILURE" 1 2 15
9082 func_emit_cwrapperexe_src > $cwrappersource
9084 # The wrapper executable is built using the $host compiler,
9085 # because it contains $host paths and files. If cross-
9086 # compiling, it, like the target executable, must be
9087 # executed on the $host or under an emulation environment.
9089 $LTCC $LTCFLAGS -o $cwrapper $cwrappersource
9093 # Now, create the wrapper script for func_source use:
9094 func_ltwrapper_scriptname $cwrapper
9095 $RM $func_ltwrapper_scriptname_result
9096 trap "$RM $func_ltwrapper_scriptname_result; exit $EXIT_FAILURE" 1 2 15
9098 # note: this script will not be executed, so do not chmod.
9099 if test "x$build" = "x$host" ; then
9100 $cwrapper --lt-dump-script > $func_ltwrapper_scriptname_result
9102 func_emit_wrapper no > $func_ltwrapper_scriptname_result
9108 trap "$RM $output; exit $EXIT_FAILURE" 1 2 15
9110 func_emit_wrapper no > $output
9119 # See if we need to build an old-fashioned archive.
9120 for oldlib in $oldlibs; do
9122 if test "$build_libtool_libs" = convenience; then
9123 oldobjs="$libobjs_save $symfileobj"
9124 addlibs="$convenience"
9125 build_libtool_libs=no
9127 if test "$build_libtool_libs" = module; then
9128 oldobjs="$libobjs_save"
9129 build_libtool_libs=no
9131 oldobjs="$old_deplibs $non_pic_objects"
9132 if test "$preload" = yes && test -f "$symfileobj"; then
9133 func_append oldobjs " $symfileobj"
9136 addlibs="$old_convenience"
9139 if test -n "$addlibs"; then
9140 gentop="$output_objdir/${outputname}x"
9141 func_append generated " $gentop"
9143 func_extract_archives $gentop $addlibs
9144 func_append oldobjs " $func_extract_archives_result"
9147 # Do each command in the archive commands.
9148 if test -n "$old_archive_from_new_cmds" && test "$build_libtool_libs" = yes; then
9149 cmds=$old_archive_from_new_cmds
9152 # Add any objects from preloaded convenience libraries
9153 if test -n "$dlprefiles"; then
9154 gentop="$output_objdir/${outputname}x"
9155 func_append generated " $gentop"
9157 func_extract_archives $gentop $dlprefiles
9158 func_append oldobjs " $func_extract_archives_result"
9161 # POSIX demands no paths to be encoded in archives. We have
9162 # to avoid creating archives with duplicate basenames if we
9163 # might have to extract them afterwards, e.g., when creating a
9164 # static archive out of a convenience library, or when linking
9165 # the entirety of a libtool archive into another (currently
9166 # not supported by libtool).
9167 if (for obj in $oldobjs
9169 func_basename "$obj"
9170 $ECHO "$func_basename_result"
9171 done | sort | sort -uc >/dev/null 2>&1); then
9174 echo "copying selected object files to avoid basename conflicts..."
9175 gentop="$output_objdir/${outputname}x"
9176 func_append generated " $gentop"
9177 func_mkdir_p "$gentop"
9178 save_oldobjs=$oldobjs
9181 for obj in $save_oldobjs
9183 func_basename "$obj"
9184 objbase="$func_basename_result"
9185 case " $oldobjs " in
9186 " ") oldobjs=$obj ;;
9189 # Make sure we don't pick an alternate name that also
9191 newobj=lt$counter-$objbase
9192 func_arith $counter + 1
9193 counter=$func_arith_result
9194 case " $oldobjs " in
9195 *[\ /]"$newobj "*) ;;
9196 *) if test ! -f "$gentop/$newobj"; then break; fi ;;
9199 func_show_eval "ln $obj $gentop/$newobj || cp $obj $gentop/$newobj"
9200 func_append oldobjs " $gentop/$newobj"
9202 *) func_append oldobjs " $obj" ;;
9206 eval cmds=\"$old_archive_cmds\"
9209 len=$func_len_result
9210 if test "$len" -lt "$max_cmd_len" || test "$max_cmd_len" -le -1; then
9211 cmds=$old_archive_cmds
9212 elif test -n "$archiver_list_spec"; then
9213 func_verbose "using command file archive linking..."
9216 func_to_tool_file "$obj"
9217 $ECHO "$func_to_tool_file_result"
9218 done > $output_objdir/$libname.libcmd
9219 func_to_tool_file "$output_objdir/$libname.libcmd"
9220 oldobjs=" $archiver_list_spec$func_to_tool_file_result"
9221 cmds=$old_archive_cmds
9223 # the command line is too long to link in one step, link in parts
9224 func_verbose "using piecewise archive linking..."
9229 save_oldobjs=$oldobjs
9231 # Is there a better way of finding the last object in the list?
9232 for obj in $save_oldobjs
9236 eval test_cmds=\"$old_archive_cmds\"
9237 func_len " $test_cmds"
9238 len0=$func_len_result
9240 for obj in $save_oldobjs
9243 func_arith $len + $func_len_result
9244 len=$func_arith_result
9245 func_append objlist " $obj"
9246 if test "$len" -lt "$max_cmd_len"; then
9249 # the above command should be used before it gets too long
9251 if test "$obj" = "$last_oldobj" ; then
9254 test -z "$concat_cmds" || concat_cmds=$concat_cmds~
9255 eval concat_cmds=\"\${concat_cmds}$old_archive_cmds\"
9262 if test "X$oldobjs" = "X" ; then
9263 eval cmds=\"\$concat_cmds\"
9265 eval cmds=\"\$concat_cmds~\$old_archive_cmds\"
9269 func_execute_cmds "$cmds" 'exit $?'
9272 test -n "$generated" && \
9273 func_show_eval "${RM}r$generated"
9275 # Now create the libtool archive.
9279 test "$build_old_libs" = yes && old_library="$libname.$libext"
9280 func_verbose "creating $output"
9282 # Preserve any variables that may affect compiler behavior
9283 for var in $variables_saved_for_relink; do
9284 if eval test -z \"\${$var+set}\"; then
9285 relink_command="{ test -z \"\${$var+set}\" || $lt_unset $var || { $var=; export $var; }; }; $relink_command"
9286 elif eval var_value=\$$var; test -z "$var_value"; then
9287 relink_command="$var=; export $var; $relink_command"
9289 func_quote_for_eval "$var_value"
9290 relink_command="$var=$func_quote_for_eval_result; export $var; $relink_command"
9293 # Quote the link command for shipping.
9294 relink_command="(cd `pwd`; $SHELL $progpath $preserve_args --mode=relink $libtool_args @inst_prefix_dir@)"
9295 relink_command=`$ECHO "$relink_command" | $SED "$sed_quote_subst"`
9296 if test "$hardcode_automatic" = yes ; then
9300 # Only create the output if not a dry run.
9302 for installed in no yes; do
9303 if test "$installed" = yes; then
9304 if test -z "$install_libdir"; then
9307 output="$output_objdir/$outputname"i
9308 # Replace all uninstalled libtool libraries with the installed ones
9310 for deplib in $dependency_libs; do
9313 func_basename "$deplib"
9314 name="$func_basename_result"
9315 eval libdir=`${SED} -n -e 's/^libdir=\(.*\)$/\1/p' $deplib`
9316 test -z "$libdir" && \
9317 func_fatal_error "\`$deplib' is not a valid libtool archive"
9318 func_append newdependency_libs " ${lt_sysroot:+=}$libdir/$name"
9321 func_stripname -L '' "$deplib"
9322 func_replace_sysroot "$func_stripname_result"
9323 func_append newdependency_libs " -L$func_replace_sysroot_result"
9326 func_stripname -R '' "$deplib"
9327 func_replace_sysroot "$func_stripname_result"
9328 func_append newdependency_libs " -R$func_replace_sysroot_result"
9330 *) func_append newdependency_libs " $deplib" ;;
9333 dependency_libs="$newdependency_libs"
9336 for lib in $dlfiles; do
9339 func_basename "$lib"
9340 name="$func_basename_result"
9341 eval libdir=`${SED} -n -e 's/^libdir=\(.*\)$/\1/p' $lib`
9342 test -z "$libdir" && \
9343 func_fatal_error "\`$lib' is not a valid libtool archive"
9344 func_append newdlfiles " ${lt_sysroot:+=}$libdir/$name"
9346 *) func_append newdlfiles " $lib" ;;
9349 dlfiles="$newdlfiles"
9351 for lib in $dlprefiles; do
9354 # Only pass preopened files to the pseudo-archive (for
9355 # eventual linking with the app. that links it) if we
9356 # didn't already link the preopened objects directly into
9358 func_basename "$lib"
9359 name="$func_basename_result"
9360 eval libdir=`${SED} -n -e 's/^libdir=\(.*\)$/\1/p' $lib`
9361 test -z "$libdir" && \
9362 func_fatal_error "\`$lib' is not a valid libtool archive"
9363 func_append newdlprefiles " ${lt_sysroot:+=}$libdir/$name"
9367 dlprefiles="$newdlprefiles"
9370 for lib in $dlfiles; do
9372 [\\/]* | [A-Za-z]:[\\/]*) abs="$lib" ;;
9373 *) abs=`pwd`"/$lib" ;;
9375 func_append newdlfiles " $abs"
9377 dlfiles="$newdlfiles"
9379 for lib in $dlprefiles; do
9381 [\\/]* | [A-Za-z]:[\\/]*) abs="$lib" ;;
9382 *) abs=`pwd`"/$lib" ;;
9384 func_append newdlprefiles " $abs"
9386 dlprefiles="$newdlprefiles"
9389 # place dlname in correct position for cygwin
9390 # In fact, it would be nice if we could use this code for all target
9391 # systems that can't hard-code library paths into their executables
9392 # and that have no shared library path variable independent of PATH,
9393 # but it turns out we can't easily determine that from inspecting
9394 # libtool variables, so we have to hard-code the OSs to which it
9395 # applies here; at the moment, that means platforms that use the PE
9396 # object format with DLL files. See the long comment at the top of
9397 # tests/bindir.at for full details.
9399 case $host,$output,$installed,$module,$dlname in
9400 *cygwin*,*lai,yes,no,*.dll | *mingw*,*lai,yes,no,*.dll | *cegcc*,*lai,yes,no,*.dll)
9401 # If a -bindir argument was supplied, place the dll there.
9402 if test "x$bindir" != x ;
9404 func_relative_path "$install_libdir" "$bindir"
9405 tdlname=$func_relative_path_result$dlname
9407 # Otherwise fall back on heuristic.
9408 tdlname=../bin/$dlname
9413 # $outputname - a libtool library file
9414 # Generated by $PROGRAM (GNU $PACKAGE$TIMESTAMP) $VERSION
9416 # Please DO NOT delete this file!
9417 # It is necessary for linking the library.
9419 # The name that we can dlopen(3).
9422 # Names of this library.
9423 library_names='$library_names'
9425 # The name of the static archive.
9426 old_library='$old_library'
9428 # Linker flags that can not go in dependency_libs.
9429 inherited_linker_flags='$new_inherited_linker_flags'
9431 # Libraries that this one depends upon.
9432 dependency_libs='$dependency_libs'
9434 # Names of additional weak libraries provided by this library
9435 weak_library_names='$weak_libs'
9437 # Version information for $libname.
9442 # Is this an already installed library?
9443 installed=$installed
9445 # Should we warn about portability when linking against -modules?
9446 shouldnotlink=$module
9448 # Files to dlopen/dlpreopen
9450 dlpreopen='$dlprefiles'
9452 # Directory that this library needs to be installed in:
9453 libdir='$install_libdir'"
9454 if test "$installed" = no && test "$need_relink" = yes; then
9456 relink_command=\"$relink_command\""
9461 # Do a symbolic link so that the libtool archive can be found in
9462 # LD_LIBRARY_PATH before the program is installed.
9463 func_show_eval '( cd "$output_objdir" && $RM "$outputname" && $LN_S "../$outputname" "$outputname" )' 'exit $?'
9469 { test "$opt_mode" = link || test "$opt_mode" = relink; } &&
9470 func_mode_link ${1+"$@"}
9473 # func_mode_uninstall arg...
9474 func_mode_uninstall ()
9482 # This variable tells wrapper scripts just to set variables rather
9483 # than running their programs.
9484 libtool_install_magic="$magic"
9489 -f) func_append RM " $arg"; rmforce=yes ;;
9490 -*) func_append RM " $arg" ;;
9491 *) func_append files " $arg" ;;
9496 func_fatal_help "you must specify an RM program"
9500 for file in $files; do
9501 func_dirname "$file" "" "."
9502 dir="$func_dirname_result"
9503 if test "X$dir" = X.; then
9508 func_basename "$file"
9509 name="$func_basename_result"
9510 test "$opt_mode" = uninstall && odir="$dir"
9512 # Remember odir for removal later, being careful to avoid duplicates
9513 if test "$opt_mode" = clean; then
9516 *) func_append rmdirs " $odir" ;;
9520 # Don't error if the file doesn't exist and rm -f was used.
9521 if { test -L "$file"; } >/dev/null 2>&1 ||
9522 { test -h "$file"; } >/dev/null 2>&1 ||
9523 test -f "$file"; then
9525 elif test -d "$file"; then
9528 elif test "$rmforce" = yes; then
9536 # Possibly a libtool archive, so verify it.
9537 if func_lalib_p "$file"; then
9538 func_source $dir/$name
9540 # Delete the libtool libraries and symlinks.
9541 for n in $library_names; do
9542 func_append rmfiles " $odir/$n"
9544 test -n "$old_library" && func_append rmfiles " $odir/$old_library"
9548 case " $library_names " in
9550 *) test -n "$dlname" && func_append rmfiles " $odir/$dlname" ;;
9552 test -n "$libdir" && func_append rmfiles " $odir/$name $odir/${name}i"
9555 if test -n "$library_names"; then
9556 # Do each command in the postuninstall commands.
9557 func_execute_cmds "$postuninstall_cmds" 'test "$rmforce" = yes || exit_status=1'
9560 if test -n "$old_library"; then
9561 # Do each command in the old_postuninstall commands.
9562 func_execute_cmds "$old_postuninstall_cmds" 'test "$rmforce" = yes || exit_status=1'
9564 # FIXME: should reinstall the best remaining shared library.
9571 # Possibly a libtool object, so verify it.
9572 if func_lalib_p "$file"; then
9575 func_source $dir/$name
9577 # Add PIC object to the list of files to remove.
9578 if test -n "$pic_object" &&
9579 test "$pic_object" != none; then
9580 func_append rmfiles " $dir/$pic_object"
9583 # Add non-PIC object to the list of files to remove.
9584 if test -n "$non_pic_object" &&
9585 test "$non_pic_object" != none; then
9586 func_append rmfiles " $dir/$non_pic_object"
9592 if test "$opt_mode" = clean ; then
9596 func_stripname '' '.exe' "$file"
9597 file=$func_stripname_result
9598 func_stripname '' '.exe' "$name"
9599 noexename=$func_stripname_result
9600 # $file with .exe has already been added to rmfiles,
9601 # add $file without .exe
9602 func_append rmfiles " $file"
9605 # Do a test to see if this is a libtool program.
9606 if func_ltwrapper_p "$file"; then
9607 if func_ltwrapper_executable_p "$file"; then
9608 func_ltwrapper_scriptname "$file"
9610 func_source $func_ltwrapper_scriptname_result
9611 func_append rmfiles " $func_ltwrapper_scriptname_result"
9614 func_source $dir/$noexename
9617 # note $name still contains .exe if it was in $file originally
9618 # as does the version of $file that was added into $rmfiles
9619 func_append rmfiles " $odir/$name $odir/${name}S.${objext}"
9620 if test "$fast_install" = yes && test -n "$relink_command"; then
9621 func_append rmfiles " $odir/lt-$name"
9623 if test "X$noexename" != "X$name" ; then
9624 func_append rmfiles " $odir/lt-${noexename}.c"
9630 func_show_eval "$RM $rmfiles" 'exit_status=1'
9633 # Try to remove the ${objdir}s in the directories where we deleted files
9634 for dir in $rmdirs; do
9635 if test -d "$dir"; then
9636 func_show_eval "rmdir $dir >/dev/null 2>&1"
9643 { test "$opt_mode" = uninstall || test "$opt_mode" = clean; } &&
9644 func_mode_uninstall ${1+"$@"}
9646 test -z "$opt_mode" && {
9647 help="$generic_help"
9648 func_fatal_help "you must specify a MODE"
9651 test -z "$exec_cmd" && \
9652 func_fatal_help "invalid operation mode \`$opt_mode'"
9654 if test -n "$exec_cmd"; then
9655 eval exec "$exec_cmd"
9662 # The TAGs below are defined such that we never get into a situation
9663 # in which we disable both kinds of libraries. Given conflicting
9664 # choices, we go for a static library, that is the most portable,
9665 # since we can't tell whether shared libraries were disabled because
9666 # the user asked for that or because the platform doesn't support
9667 # them. This is particularly important on AIX, because we don't
9668 # support having both static and shared libraries enabled at the same
9669 # time on that platform, so we default to a shared-only configuration.
9670 # If a disable-shared tag is given, we'll fallback to a static-only
9671 # configuration. But we'll never go from static-only to shared-only.
9673 # ### BEGIN LIBTOOL TAG CONFIG: disable-shared
9674 build_libtool_libs=no
9676 # ### END LIBTOOL TAG CONFIG: disable-shared
9678 # ### BEGIN LIBTOOL TAG CONFIG: disable-static
9679 build_old_libs=`case $build_libtool_libs in yes) echo no;; *) echo yes;; esac`
9680 # ### END LIBTOOL TAG CONFIG: disable-static