2 # libtool (GNU libtool) 2.4.2
3 # Written by Gordon Matzigkeit <gord@gnu.ai.mit.edu>, 1996
5 # Copyright (C) 1996, 1997, 1998, 1999, 2000, 2001, 2003, 2004, 2005, 2006,
6 # 2007, 2008, 2009, 2010, 2011 Free Software Foundation, Inc.
7 # This is free software; see the source for copying conditions. There is NO
8 # warranty; not even for MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
10 # GNU Libtool is free software; you can redistribute it and/or modify
11 # it under the terms of the GNU General Public License as published by
12 # the Free Software Foundation; either version 2 of the License, or
13 # (at your option) any later version.
15 # As a special exception to the GNU General Public License,
16 # if you distribute this file as part of a program or library that
17 # is built using GNU Libtool, you may include this file under the
18 # same distribution terms that you use for the rest of that program.
20 # GNU Libtool is distributed in the hope that it will be useful, but
21 # WITHOUT ANY WARRANTY; without even the implied warranty of
22 # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
23 # General Public License for more details.
25 # You should have received a copy of the GNU General Public License
26 # along with GNU Libtool; see the file COPYING. If not, a copy
27 # can be downloaded from http://www.gnu.org/licenses/gpl.html,
28 # or obtained by writing to the Free Software Foundation, Inc.,
29 # 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
31 # Usage: $progname [OPTION]... [MODE-ARG]...
33 # Provide generalized library-building support services.
35 # --config show all configuration variables
36 # --debug enable verbose shell tracing
37 # -n, --dry-run display commands without modifying any files
38 # --features display basic configuration information and exit
39 # --mode=MODE use operation mode MODE
40 # --preserve-dup-deps don't remove duplicate dependency libraries
41 # --quiet, --silent don't print informational messages
42 # --no-quiet, --no-silent
43 # print informational messages (default)
44 # --no-warn don't display warning messages
45 # --tag=TAG use configuration variables from tag TAG
46 # -v, --verbose print more informational messages than default
47 # --no-verbose don't print the extra informational messages
48 # --version print version information
49 # -h, --help, --help-all print short, long, or detailed help message
51 # MODE must be one of the following:
53 # clean remove files from the build directory
54 # compile compile a source file into a libtool object
55 # execute automatically set library path, then run a program
56 # finish complete the installation of libtool libraries
57 # install install libraries or executables
58 # link create a library or an executable
59 # uninstall remove libraries from an installed directory
61 # MODE-ARGS vary depending on the MODE. When passed as first option,
62 # `--mode=MODE' may be abbreviated as `MODE' or a unique abbreviation of that.
63 # Try `$progname --help --mode=MODE' for a more detailed description of MODE.
65 # When reporting a bug, please describe a test case to reproduce it and
66 # include the following information:
71 # compiler flags: $LTCFLAGS
72 # linker: $LD (gnu? $with_gnu_ld)
73 # $progname: (GNU libtool) 2.4.2
74 # automake: $automake_version
75 # autoconf: $autoconf_version
77 # Report bugs to <bug-libtool@gnu.org>.
78 # GNU libtool home page: <http://www.gnu.org/software/libtool/>.
79 # General help using GNU software: <http://www.gnu.org/gethelp/>.
85 package_revision
=1.3337
87 # Be Bourne compatible
88 if test -n "${ZSH_VERSION+set}" && (emulate sh
) >/dev
/null
2>&1; then
91 # Zsh 3.x and 4.x performs word splitting on ${1+"$@"}, which
92 # is contrary to our usage. Disable this feature.
93 alias -g '${1+"$@"}'='"$@"'
96 case `(set -o) 2>/dev/null` in *posix
*) set -o posix
;; esac
98 BIN_SH
=xpg4
; export BIN_SH
# for Tru64
99 DUALCASE
=1; export DUALCASE
# for MKS sh
101 # A function that is used when there is no print builtin or printf.
102 func_fallback_echo
()
104 eval 'cat <<_LTECHO_EOF
109 # NLS nuisances: We save the old values to restore during execute mode.
112 for lt_var
in LANG LANGUAGE LC_ALL LC_CTYPE LC_COLLATE LC_MESSAGES
114 eval "if test \"\${$lt_var+set}\" = set; then
115 save_$lt_var=\$$lt_var
118 lt_user_locale=\"$lt_var=\\\$save_\$lt_var; \$lt_user_locale\"
119 lt_safe_locale=\"$lt_var=C; \$lt_safe_locale\"
124 export LANGUAGE LC_ALL
129 # Work around backward compatibility issue on IRIX 6.5. On IRIX 6.4+, sh
130 # is ksh but when the shell is invoked as "sh" and the current value of
131 # the _XPG environment variable is not equal to 1 (one), the special
132 # positional parameter $0, within a function call, is the name of the
139 test "${ECHO+set}" = set || ECHO
=${as_echo-'printf %s\n'}
144 : ${SHELL="${CONFIG_SHELL-/bin/sh}"}
145 : ${Xsed="$SED -e 1s/^X//"}
150 EXIT_MISMATCH
=63 # $? = 63 is used to indicate version mismatch to missing.
151 EXIT_SKIP
=77 # $? = 77 is used to indicate a skipped test to automake.
153 exit_status
=$EXIT_SUCCESS
155 # Make sure IFS has a sensible default
160 dirname="s,/[^/]*$,,"
163 # func_dirname file append nondir_replacement
164 # Compute the dirname of FILE. If nonempty, add APPEND to the result,
165 # otherwise set result to NONDIR_REPLACEMENT.
168 func_dirname_result
=`$ECHO "${1}" | $SED "$dirname"`
169 if test "X$func_dirname_result" = "X${1}"; then
170 func_dirname_result
="${3}"
172 func_dirname_result
="$func_dirname_result${2}"
174 } # func_dirname may be replaced by extended shell implementation
180 func_basename_result
=`$ECHO "${1}" | $SED "$basename"`
181 } # func_basename may be replaced by extended shell implementation
184 # func_dirname_and_basename file append nondir_replacement
185 # perform func_basename and func_dirname in a single function
187 # dirname: Compute the dirname of FILE. If nonempty,
188 # add APPEND to the result, otherwise set result
189 # to NONDIR_REPLACEMENT.
190 # value returned in "$func_dirname_result"
191 # basename: Compute filename of FILE.
192 # value retuned in "$func_basename_result"
193 # Implementation must be kept synchronized with func_dirname
194 # and func_basename. For efficiency, we do not delegate to
195 # those functions but instead duplicate the functionality here.
196 func_dirname_and_basename
()
198 # Extract subdirectory from the argument.
199 func_dirname_result
=`$ECHO "${1}" | $SED -e "$dirname"`
200 if test "X$func_dirname_result" = "X${1}"; then
201 func_dirname_result
="${3}"
203 func_dirname_result
="$func_dirname_result${2}"
205 func_basename_result
=`$ECHO "${1}" | $SED -e "$basename"`
206 } # func_dirname_and_basename may be replaced by extended shell implementation
209 # func_stripname prefix suffix name
210 # strip PREFIX and SUFFIX off of NAME.
211 # PREFIX and SUFFIX must not contain globbing or regex special
212 # characters, hashes, percent signs, but SUFFIX may contain a leading
213 # dot (in which case that matches only a dot).
214 # func_strip_suffix prefix name
218 .
*) func_stripname_result
=`$ECHO "${3}" | $SED "s%^${1}%%; s%\\\\${2}\$%%"`;;
219 *) func_stripname_result
=`$ECHO "${3}" | $SED "s%^${1}%%; s%${2}\$%%"`;;
221 } # func_stripname may be replaced by extended shell implementation
224 # These SED scripts presuppose an absolute path with a trailing slash.
225 pathcar
='s,^/\([^/]*\).*$,\1,'
226 pathcdr
='s,^/[^/]*,,'
227 removedotparts
=':dotsl
231 collapseslashes
='s@/\{1,\}@/@g'
232 finalslash
='s,/*$,/,'
234 # func_normal_abspath PATH
235 # Remove doubled-up and trailing slashes, "." path components,
236 # and cancel out any ".." path components in PATH after making
237 # it an absolute path.
238 # value returned in "$func_normal_abspath_result"
239 func_normal_abspath
()
241 # Start from root dir and reassemble the path.
242 func_normal_abspath_result
=
243 func_normal_abspath_tpath
=$1
244 func_normal_abspath_altnamespace
=
245 case $func_normal_abspath_tpath in
247 # Empty path, that just means $cwd.
248 func_stripname
'' '/' "`pwd`"
249 func_normal_abspath_result
=$func_stripname_result
252 # The next three entries are used to spot a run of precisely
253 # two leading slashes without using negated character classes;
254 # we take advantage of case's first-match behaviour.
256 # Unusual form of absolute path, do nothing.
259 # Not necessarily an ordinary path; POSIX reserves leading '//'
260 # and for example Cygwin uses it to access remote file shares
261 # over CIFS/SMB, so we conserve a leading double slash if found.
262 func_normal_abspath_altnamespace
=/
265 # Absolute path, do nothing.
268 # Relative path, prepend $cwd.
269 func_normal_abspath_tpath
=`pwd`/$func_normal_abspath_tpath
272 # Cancel out all the simple stuff to save iterations. We also want
273 # the path to end with a slash for ease of parsing, so make sure
274 # there is one (and only one) here.
275 func_normal_abspath_tpath
=`$ECHO "$func_normal_abspath_tpath" | $SED \
276 -e "$removedotparts" -e "$collapseslashes" -e "$finalslash"`
278 # Processed it all yet?
279 if test "$func_normal_abspath_tpath" = / ; then
280 # If we ascended to the root using ".." the result may be empty now.
281 if test -z "$func_normal_abspath_result" ; then
282 func_normal_abspath_result
=/
286 func_normal_abspath_tcomponent
=`$ECHO "$func_normal_abspath_tpath" | $SED \
288 func_normal_abspath_tpath
=`$ECHO "$func_normal_abspath_tpath" | $SED \
290 # Figure out what to do with it
291 case $func_normal_abspath_tcomponent in
293 # Trailing empty path component, ignore it.
296 # Parent dir; strip last assembled component from result.
297 func_dirname
"$func_normal_abspath_result"
298 func_normal_abspath_result
=$func_dirname_result
301 # Actual path component, append it.
302 func_normal_abspath_result
=$func_normal_abspath_result/$func_normal_abspath_tcomponent
306 # Restore leading double-slash if one was found on entry.
307 func_normal_abspath_result
=$func_normal_abspath_altnamespace$func_normal_abspath_result
310 # func_relative_path SRCDIR DSTDIR
311 # generates a relative path from SRCDIR to DSTDIR, with a trailing
312 # slash if non-empty, suitable for immediately appending a filename
313 # without needing to append a separator.
314 # value returned in "$func_relative_path_result"
315 func_relative_path
()
317 func_relative_path_result
=
318 func_normal_abspath
"$1"
319 func_relative_path_tlibdir
=$func_normal_abspath_result
320 func_normal_abspath
"$2"
321 func_relative_path_tbindir
=$func_normal_abspath_result
323 # Ascend the tree starting from libdir
325 # check if we have found a prefix of bindir
326 case $func_relative_path_tbindir in
327 $func_relative_path_tlibdir)
328 # found an exact match
329 func_relative_path_tcancelled
=
332 $func_relative_path_tlibdir*)
333 # found a matching prefix
334 func_stripname
"$func_relative_path_tlibdir" '' "$func_relative_path_tbindir"
335 func_relative_path_tcancelled
=$func_stripname_result
336 if test -z "$func_relative_path_result"; then
337 func_relative_path_result
=.
342 func_dirname
$func_relative_path_tlibdir
343 func_relative_path_tlibdir
=${func_dirname_result}
344 if test "x$func_relative_path_tlibdir" = x
; then
345 # Have to descend all the way to the root!
346 func_relative_path_result
=..
/$func_relative_path_result
347 func_relative_path_tcancelled
=$func_relative_path_tbindir
350 func_relative_path_result
=..
/$func_relative_path_result
355 # Now calculate path; take care to avoid doubling-up slashes.
356 func_stripname
'' '/' "$func_relative_path_result"
357 func_relative_path_result
=$func_stripname_result
358 func_stripname
'/' '/' "$func_relative_path_tcancelled"
359 if test "x$func_stripname_result" != x
; then
360 func_relative_path_result
=${func_relative_path_result}/${func_stripname_result}
363 # Normalisation. If bindir is libdir, return empty string,
364 # else relative path ending with a slash; either way, target
365 # file name can be directly appended.
366 if test ! -z "$func_relative_path_result"; then
367 func_stripname
'./' '' "$func_relative_path_result/"
368 func_relative_path_result
=$func_stripname_result
372 # The name of this program:
373 func_dirname_and_basename
"$progpath"
374 progname
=$func_basename_result
376 # Make sure we have an absolute path for reexecution:
378 [\\/]*|
[A-Za-z
]:\\*) ;;
380 progdir
=$func_dirname_result
381 progdir
=`cd "$progdir" && pwd`
382 progpath
="$progdir/$progname"
386 IFS
=${PATH_SEPARATOR-:}
387 for progdir
in $PATH; do
389 test -x "$progdir/$progname" && break
392 test -n "$progdir" || progdir
=`pwd`
393 progpath
="$progdir/$progname"
397 # Sed substitution that helps us do robust quoting. It backslashifies
398 # metacharacters that are still active within double-quoted strings.
399 Xsed
="${SED}"' -e 1s/^X//'
400 sed_quote_subst
='s/\([`"$\\]\)/\\\1/g'
402 # Same as above, but do not quote variable references.
403 double_quote_subst
='s/\(["`\\]\)/\\\1/g'
405 # Sed substitution that turns a string into a regex matching for the
407 sed_make_literal_regex
='s,[].[^$\\*\/],\\&,g'
409 # Sed substitution that converts a w32 file name or path
410 # which contains forward slashes, into one that contains
411 # (escaped) backslashes. A very naive implementation.
412 lt_sed_naive_backslashify
='s|\\\\*|\\|g;s|/|\\|g;s|\\|\\\\|g'
414 # Re-`\' parameter expansions in output of double_quote_subst that were
415 # `\'-ed in input to the same. If an odd number of `\' preceded a '$'
416 # in input to double_quote_subst, that '$' was protected from expansion.
417 # Since each input `\' is now two `\'s, look for any number of runs of
418 # four `\'s followed by two `\'s and then a '$'. `\' that '$'.
423 sed_double_backslash
="\
427 s/\\([^$bs]\\)$bs2$dollar/\\1$bs2$bs$dollar/g
438 # Echo program name prefixed message, along with the current mode
439 # name if it has been set yet.
442 $ECHO "$progname: ${opt_mode+$opt_mode: }$*"
445 # func_verbose arg...
446 # Echo program name prefixed message in verbose mode only.
449 $opt_verbose && func_echo
${1+"$@"}
451 # A bug in bash halts the script if the last line of a function
452 # fails when set -e is in force, so we need another command to
457 # func_echo_all arg...
458 # Invoke $ECHO with all args, space-separated.
465 # Echo program name prefixed message to standard error.
468 $ECHO "$progname: ${opt_mode+$opt_mode: }"${1+"$@"} 1>&2
471 # func_warning arg...
472 # Echo program name prefixed warning message to standard error.
475 $opt_warning && $ECHO "$progname: ${opt_mode+$opt_mode: }warning: "${1+"$@"} 1>&2
481 # func_fatal_error arg...
482 # Echo program name prefixed message to standard error, and exit.
489 # func_fatal_help arg...
490 # Echo program name prefixed message to standard error, followed by
491 # a help hint, and exit.
495 func_fatal_error
"$help"
497 help="Try \`$progname --help' for more information." ## default
500 # func_grep expression filename
501 # Check whether EXPRESSION matches any line of FILENAME, without output.
504 $GREP "$1" "$2" >/dev
/null
2>&1
508 # func_mkdir_p directory-path
509 # Make sure the entire path to DIRECTORY-PATH is available.
512 my_directory_path
="$1"
515 if test -n "$my_directory_path" && test "$opt_dry_run" != ":"; then
517 # Protect directory names starting with `-'
518 case $my_directory_path in
519 -*) my_directory_path
="./$my_directory_path" ;;
522 # While some portion of DIR does not yet exist...
523 while test ! -d "$my_directory_path"; do
524 # ...make a list in topmost first order. Use a colon delimited
525 # list incase some portion of path contains whitespace.
526 my_dir_list
="$my_directory_path:$my_dir_list"
528 # If the last portion added has no slash in it, the list is done
529 case $my_directory_path in */*) ;; *) break ;; esac
531 # ...otherwise throw away the child directory and loop
532 my_directory_path
=`$ECHO "$my_directory_path" | $SED -e "$dirname"`
534 my_dir_list
=`$ECHO "$my_dir_list" | $SED 's,:*$,,'`
536 save_mkdir_p_IFS
="$IFS"; IFS
=':'
537 for my_dir
in $my_dir_list; do
538 IFS
="$save_mkdir_p_IFS"
539 # mkdir can fail with a `File exist' error if two processes
540 # try to create one of the directories concurrently. Don't
542 $MKDIR "$my_dir" 2>/dev
/null ||
:
544 IFS
="$save_mkdir_p_IFS"
546 # Bail out if we (or some other process) failed to create a directory.
547 test -d "$my_directory_path" || \
548 func_fatal_error
"Failed to create \`$1'"
553 # func_mktempdir [string]
554 # Make a temporary directory that won't clash with other running
555 # libtool processes, and avoids race conditions if possible. If
556 # given, STRING is the basename for that directory.
559 my_template
="${TMPDIR-/tmp}/${1-$progname}"
561 if test "$opt_dry_run" = ":"; then
562 # Return a directory name, but don't create it in dry-run mode
563 my_tmpdir
="${my_template}-$$"
566 # If mktemp works, use that first and foremost
567 my_tmpdir
=`mktemp -d "${my_template}-XXXXXXXX" 2>/dev/null`
569 if test ! -d "$my_tmpdir"; then
570 # Failing that, at least try and use $RANDOM to avoid a race
571 my_tmpdir
="${my_template}-${RANDOM-0}$$"
573 save_mktempdir_umask
=`umask`
576 umask $save_mktempdir_umask
579 # If we're not in dry-run mode, bomb out on failure
580 test -d "$my_tmpdir" || \
581 func_fatal_error
"cannot create temporary directory \`$my_tmpdir'"
588 # func_quote_for_eval arg
589 # Aesthetically quote ARG to be evaled later.
590 # This function returns two values: FUNC_QUOTE_FOR_EVAL_RESULT
591 # is double-quoted, suitable for a subsequent eval, whereas
592 # FUNC_QUOTE_FOR_EVAL_UNQUOTED_RESULT has merely all characters
593 # which are still active within double quotes backslashified.
594 func_quote_for_eval
()
598 func_quote_for_eval_unquoted_result=`$ECHO "$1" |
$SED "$sed_quote_subst"` ;;
600 func_quote_for_eval_unquoted_result="$1" ;;
603 case $func_quote_for_eval_unquoted_result in
604 # Double-quote args containing shell metacharacters to delay
605 # word splitting, command substitution and and variable
606 # expansion for a subsequent eval.
607 # Many Bourne shells cannot handle close brackets correctly
608 # in scan sets, so we specify it separately.
609 *[\[\~\#\^\&\*\(\)\{\}\|\;\<\>\?\'\ \ ]*|*]*|"")
610 func_quote_for_eval_result="\"$func_quote_for_eval_unquoted_result\""
613 func_quote_for_eval_result="$func_quote_for_eval_unquoted_result"
618 # func_quote_for_expand arg
619 # Aesthetically quote ARG to be evaled later; same as above,
620 # but do not quote variable references.
621 func_quote_for_expand ()
625 my_arg
=`$ECHO "$1" | $SED \
626 -e "$double_quote_subst" -e "$sed_double_backslash"` ;;
632 # Double-quote args containing shell metacharacters to delay
633 # word splitting and command substitution for a subsequent eval.
634 # Many Bourne shells cannot handle close brackets correctly
635 # in scan sets, so we specify it separately.
636 *[\
[\~\
#\^\&\*\(\)\{\}\|\;\<\>\?\'\ \ ]*|*]*|"")
641 func_quote_for_expand_result
="$my_arg"
645 # func_show_eval cmd [fail_exp]
646 # Unless opt_silent is true, then output CMD. Then, if opt_dryrun is
647 # not true, evaluate CMD. If the evaluation of CMD fails, and FAIL_EXP
648 # is given, then evaluate it.
654 ${opt_silent-false} ||
{
655 func_quote_for_expand
"$my_cmd"
656 eval "func_echo $func_quote_for_expand_result"
659 if ${opt_dry_run-false}; then :; else
662 if test "$my_status" -eq 0; then :; else
663 eval "(exit $my_status); $my_fail_exp"
669 # func_show_eval_locale cmd [fail_exp]
670 # Unless opt_silent is true, then output CMD. Then, if opt_dryrun is
671 # not true, evaluate CMD. If the evaluation of CMD fails, and FAIL_EXP
672 # is given, then evaluate it. Use the saved locale for evaluation.
673 func_show_eval_locale
()
678 ${opt_silent-false} ||
{
679 func_quote_for_expand
"$my_cmd"
680 eval "func_echo $func_quote_for_expand_result"
683 if ${opt_dry_run-false}; then :; else
684 eval "$lt_user_locale
687 eval "$lt_safe_locale"
688 if test "$my_status" -eq 0; then :; else
689 eval "(exit $my_status); $my_fail_exp"
695 # Turn $1 into a string suitable for a shell variable name.
696 # Result is stored in $func_tr_sh_result. All characters
697 # not in the set a-zA-Z0-9_ are replaced with '_'. Further,
698 # if $1 begins with a digit, a '_' is prepended as well.
702 [0-9]* |
*[!a-zA-Z0-9_
]*)
703 func_tr_sh_result
=`$ECHO "$1" | $SED 's/^\([0-9]\)/_\1/; s/[^a-zA-Z0-9_]/_/g'`
713 # Echo version message to standard output and exit.
726 /^# '$PROGRAM' (GNU /,/# warranty; / {
729 s/\((C)\)[ 0-9,-]*\( [1-9][0-9]*\)/\1\2/
736 # Echo short help message to standard output and exit.
741 $SED -n '/^# Usage:/,/^# *.*--help/ {
744 s/\$progname/'$progname'/
748 $ECHO "run \`$progname --help | more' for full usage"
753 # Echo long help message to standard output and exit,
754 # unless 'noexit' is passed as argument.
759 $SED -n '/^# Usage:/,/# Report bugs to/ {
763 s*\$progname*'$progname'*
765 s*\$SHELL*'"$SHELL"'*
767 s*\$LTCFLAGS*'"$LTCFLAGS"'*
769 s/\$with_gnu_ld/'"$with_gnu_ld"'/
770 s/\$automake_version/'"`(${AUTOMAKE-automake} --version) 2>/dev/null |$SED 1q`"'/
771 s/\$autoconf_version/'"`(${AUTOCONF-autoconf} --version) 2>/dev/null |$SED 1q`"'/
775 /^# .* home page:/b print
776 /^# General help using/b print
779 if test -z "$1"; then
784 # func_missing_arg argname
785 # Echo program name prefixed message to standard error and set global
791 func_error
"missing argument for $1."
796 # func_split_short_opt shortopt
797 # Set func_split_short_opt_name and func_split_short_opt_arg shell
798 # variables after splitting SHORTOPT after the 2nd character.
799 func_split_short_opt
()
801 my_sed_short_opt
='1s/^\(..\).*$/\1/;q'
802 my_sed_short_rest
='1s/^..\(.*\)$/\1/;q'
804 func_split_short_opt_name
=`$ECHO "$1" | $SED "$my_sed_short_opt"`
805 func_split_short_opt_arg
=`$ECHO "$1" | $SED "$my_sed_short_rest"`
806 } # func_split_short_opt may be replaced by extended shell implementation
809 # func_split_long_opt longopt
810 # Set func_split_long_opt_name and func_split_long_opt_arg shell
811 # variables after splitting LONGOPT at the `=' sign.
812 func_split_long_opt
()
814 my_sed_long_opt
='1s/^\(--[^=]*\)=.*/\1/;q'
815 my_sed_long_arg
='1s/^--[^=]*=//'
817 func_split_long_opt_name
=`$ECHO "$1" | $SED "$my_sed_long_opt"`
818 func_split_long_opt_arg
=`$ECHO "$1" | $SED "$my_sed_long_arg"`
819 } # func_split_long_opt may be replaced by extended shell implementation
827 magic
="%%%MAGIC variable%%%"
828 magic_exe
="%%%MAGIC EXE variable%%%"
833 lo2o
="s/\\.lo\$/.${objext}/"
834 o2lo
="s/\\.${objext}\$/.lo/"
838 # If this variable is set in any of the actions, the command in it
839 # will be execed at the end. This prevents here-documents from being
840 # left over by shells.
843 # func_append var value
844 # Append VALUE to the end of shell variable VAR.
847 eval "${1}=\$${1}\${2}"
848 } # func_append may be replaced by extended shell implementation
850 # func_append_quoted var value
851 # Quote VALUE and append to the end of shell variable VAR, separated
853 func_append_quoted
()
855 func_quote_for_eval
"${2}"
856 eval "${1}=\$${1}\\ \$func_quote_for_eval_result"
857 } # func_append_quoted may be replaced by extended shell implementation
860 # func_arith arithmetic-term...
863 func_arith_result
=`expr "${@}"`
864 } # func_arith may be replaced by extended shell implementation
868 # STRING may not start with a hyphen.
871 func_len_result
=`expr "${1}" : ".*" 2>/dev/null || echo $max_cmd_len`
872 } # func_len may be replaced by extended shell implementation
878 func_lo2o_result
=`$ECHO "${1}" | $SED "$lo2o"`
879 } # func_lo2o may be replaced by extended shell implementation
882 # func_xform libobj-or-source
885 func_xform_result
=`$ECHO "${1}" | $SED 's/\.[^.]*$/.lo/'`
886 } # func_xform may be replaced by extended shell implementation
889 # func_fatal_configuration arg...
890 # Echo program name prefixed message to standard error, followed by
891 # a configuration failure hint, and exit.
892 func_fatal_configuration
()
895 func_error
"See the $PACKAGE documentation for more information."
896 func_fatal_error
"Fatal configuration error."
901 # Display the configuration for all the tags in this script.
904 re_begincf
='^# ### BEGIN LIBTOOL'
905 re_endcf
='^# ### END LIBTOOL'
907 # Default configuration.
908 $SED "1,/$re_begincf CONFIG/d;/$re_endcf CONFIG/,\$d" < "$progpath"
910 # Now print the configurations for the tags.
911 for tagname
in $taglist; do
912 $SED -n "/$re_begincf TAG CONFIG: $tagname\$/,/$re_endcf TAG CONFIG: $tagname\$/p" < "$progpath"
919 # Display the features supported by this script.
923 if test "$build_libtool_libs" = yes; then
924 echo "enable shared libraries"
926 echo "disable shared libraries"
928 if test "$build_old_libs" = yes; then
929 echo "enable static libraries"
931 echo "disable static libraries"
937 # func_enable_tag tagname
938 # Verify that TAGNAME is valid, and either flag an error and exit, or
939 # enable the TAGNAME tag. We also add TAGNAME to the global $taglist
946 re_begincf
="^# ### BEGIN LIBTOOL TAG CONFIG: $tagname\$"
947 re_endcf
="^# ### END LIBTOOL TAG CONFIG: $tagname\$"
948 sed_extractcf
="/$re_begincf/,/$re_endcf/p"
953 func_fatal_error
"invalid tag name: $tagname"
957 # Don't test for the "default" C tag, as we know it's
958 # there but not specially marked.
962 if $GREP "$re_begincf" "$progpath" >/dev
/null
2>&1; then
963 taglist
="$taglist $tagname"
965 # Evaluate the configuration. Be careful to quote the path
966 # and the sed script, to avoid splitting on whitespace, but
967 # also don't use non-portable quotes within backquotes within
968 # quotes we have to do it in 2 steps:
969 extractedcf
=`$SED -n -e "$sed_extractcf" < "$progpath"`
972 func_error
"ignoring unknown tag $tagname"
978 # func_check_version_match
979 # Ensure that we are using m4 macros, and libtool script from the same
980 # release of libtool.
981 func_check_version_match
()
983 if test "$package_revision" != "$macro_revision"; then
984 if test "$VERSION" != "$macro_version"; then
985 if test -z "$macro_version"; then
987 $progname: Version mismatch error. This is $PACKAGE $VERSION, but the
988 $progname: definition of this LT_INIT comes from an older release.
989 $progname: You should recreate aclocal.m4 with macros from $PACKAGE $VERSION
990 $progname: and run autoconf again.
994 $progname: Version mismatch error. This is $PACKAGE $VERSION, but the
995 $progname: definition of this LT_INIT comes from $PACKAGE $macro_version.
996 $progname: You should recreate aclocal.m4 with macros from $PACKAGE $VERSION
997 $progname: and run autoconf again.
1002 $progname: Version mismatch error. This is $PACKAGE $VERSION, revision $package_revision,
1003 $progname: but the definition of this LT_INIT comes from revision $macro_revision.
1004 $progname: You should recreate aclocal.m4 with macros from revision $package_revision
1005 $progname: of $PACKAGE $VERSION and run autoconf again.
1014 # Shorthand for --mode=foo, only valid as the first argument
1017 shift; set dummy
--mode clean
${1+"$@"}; shift
1019 compile|compil|compi|comp|com|co|c
)
1020 shift; set dummy
--mode compile
${1+"$@"}; shift
1022 execute|execut|execu|
exec|exe|ex|e
)
1023 shift; set dummy
--mode execute
${1+"$@"}; shift
1025 finish|finis|fini|fin|
fi|f
)
1026 shift; set dummy
--mode finish
${1+"$@"}; shift
1028 install|instal|insta|inst|ins|
in|i
)
1029 shift; set dummy
--mode install ${1+"$@"}; shift
1032 shift; set dummy
--mode link
${1+"$@"}; shift
1034 uninstall|uninstal|uninsta|uninst|unins|unin|uni|un|u
)
1035 shift; set dummy
--mode uninstall
${1+"$@"}; shift
1045 opt_preserve_dup_deps
=false
1057 # Parse options once, thoroughly. This comes as soon as possible in the
1058 # script to make things like `--version' happen as quickly as we can.
1060 # this just eases exit handling
1061 while test $# -gt 0; do
1065 --debug|
-x) opt_debug
='set -x'
1066 func_echo
"enabling shell trace mode"
1069 --dry-run|
--dryrun|
-n)
1078 opt_dlopen
="${opt_dlopen+$opt_dlopen
1082 --preserve-dup-deps)
1083 opt_preserve_dup_deps
=:
1091 set dummy
--mode finish
${1+"$@"}; shift
1098 opt_help
=': help-all'
1101 test $# = 0 && func_missing_arg
$opt && break
1105 # Valid mode arguments:
1106 clean|compile|execute|finish|
install|link|relink|uninstall
) ;;
1108 # Catch anything else as an error
1109 *) func_error
"invalid argument for $opt"
1116 --no-silent|
--no-quiet)
1118 func_append preserve_args
" $opt"
1120 --no-warning|
--no-warn)
1122 func_append preserve_args
" $opt"
1126 func_append preserve_args
" $opt"
1130 func_append preserve_args
" $opt"
1135 func_append preserve_args
" $opt"
1139 test $# = 0 && func_missing_arg
$opt && break
1142 func_append preserve_args
" $opt $optarg"
1143 func_enable_tag
"$optarg"
1147 -\?|
-h) func_usage
;;
1148 --help) func_help
;;
1149 --version) func_version
;;
1151 # Separate optargs to long options:
1153 func_split_long_opt
"$opt"
1154 set dummy
"$func_split_long_opt_name" "$func_split_long_opt_arg" ${1+"$@"}
1158 # Separate non-argument short options:
1160 func_split_short_opt
"$opt"
1161 set dummy
"$func_split_short_opt_name" "-$func_split_short_opt_arg" ${1+"$@"}
1166 -*) func_fatal_help
"unrecognized option \`$opt'" ;;
1167 *) set dummy
"$opt" ${1+"$@"}; shift; break ;;
1173 # save first non-option argument
1174 if test "$#" -gt 0; then
1180 test "$opt_debug" = : || func_append preserve_args
" --debug"
1183 *cygwin
* |
*mingw
* |
*pw32
* |
*cegcc
*)
1184 # don't eliminate duplications in $postdeps and $predeps
1185 opt_duplicate_compiler_generated_deps
=:
1188 opt_duplicate_compiler_generated_deps
=$opt_preserve_dup_deps
1193 # Sanity checks first:
1194 func_check_version_match
1196 if test "$build_libtool_libs" != yes && test "$build_old_libs" != yes; then
1197 func_fatal_configuration
"not configured to build any kind of library"
1201 eval std_shrext
=\"$shrext_cmds\"
1203 # Only execute mode is allowed to have -dlopen flags.
1204 if test -n "$opt_dlopen" && test "$opt_mode" != execute
; then
1205 func_error
"unrecognized option \`-dlopen'"
1210 # Change the help message to a mode-specific one.
1211 generic_help
="$help"
1212 help="Try \`$progname --help --mode=$opt_mode' for more information."
1216 # Bail if the options were screwed
1217 $exit_cmd $EXIT_FAILURE
1228 # True iff FILE is a libtool `.la' library or `.lo' object file.
1229 # This function is only a basic sanity check; it will hardly flush out
1230 # determined imposters.
1234 $SED -e 4q
"$1" 2>/dev
/null \
1235 |
$GREP "^# Generated by .*$PACKAGE" > /dev
/null
2>&1
1238 # func_lalib_unsafe_p file
1239 # True iff FILE is a libtool `.la' library or `.lo' object file.
1240 # This function implements the same check as func_lalib_p without
1241 # resorting to external programs. To this end, it redirects stdin and
1242 # closes it afterwards, without saving the original file descriptor.
1243 # As a safety measure, use it only where a negative result would be
1244 # fatal anyway. Works if `file' does not exist.
1245 func_lalib_unsafe_p
()
1248 if test -f "$1" && test -r "$1" && exec 5<&0 <"$1"; then
1249 for lalib_p_l
in 1 2 3 4
1252 case "$lalib_p_line" in
1253 \
#\ Generated\ by\ *$PACKAGE* ) lalib_p=yes; break;;
1258 test "$lalib_p" = yes
1261 # func_ltwrapper_script_p file
1262 # True iff FILE is a libtool wrapper script
1263 # This function is only a basic sanity check; it will hardly flush out
1264 # determined imposters.
1265 func_ltwrapper_script_p
()
1270 # func_ltwrapper_executable_p file
1271 # True iff FILE is a libtool wrapper executable
1272 # This function is only a basic sanity check; it will hardly flush out
1273 # determined imposters.
1274 func_ltwrapper_executable_p
()
1276 func_ltwrapper_exec_suffix
=
1279 *) func_ltwrapper_exec_suffix
=.exe
;;
1281 $GREP "$magic_exe" "$1$func_ltwrapper_exec_suffix" >/dev
/null
2>&1
1284 # func_ltwrapper_scriptname file
1285 # Assumes file is an ltwrapper_executable
1286 # uses $file to determine the appropriate filename for a
1287 # temporary ltwrapper_script.
1288 func_ltwrapper_scriptname
()
1290 func_dirname_and_basename
"$1" "" "."
1291 func_stripname
'' '.exe' "$func_basename_result"
1292 func_ltwrapper_scriptname_result
="$func_dirname_result/$objdir/${func_stripname_result}_ltshwrapper"
1295 # func_ltwrapper_p file
1296 # True iff FILE is a libtool wrapper script or wrapper executable
1297 # This function is only a basic sanity check; it will hardly flush out
1298 # determined imposters.
1301 func_ltwrapper_script_p
"$1" || func_ltwrapper_executable_p
"$1"
1305 # func_execute_cmds commands fail_cmd
1306 # Execute tilde-delimited COMMANDS.
1307 # If FAIL_CMD is given, eval that upon failure.
1308 # FAIL_CMD may read-access the current command in variable CMD!
1309 func_execute_cmds
()
1312 save_ifs
=$IFS; IFS
='~'
1316 func_show_eval
"$cmd" "${2-:}"
1323 # Source FILE, adding directory component if necessary.
1324 # Note that it is not necessary on cygwin/mingw to append a dot to
1325 # FILE even if both FILE and FILE.exe exist: automatic-append-.exe
1326 # behavior happens only for exec(3), not for open(2)! Also, sourcing
1327 # `FILE.' does not work on cygwin managed mounts.
1332 */* |
*\\*) .
"$1" ;;
1338 # func_resolve_sysroot PATH
1339 # Replace a leading = in PATH with a sysroot. Store the result into
1340 # func_resolve_sysroot_result
1341 func_resolve_sysroot
()
1343 func_resolve_sysroot_result
=$1
1344 case $func_resolve_sysroot_result in
1346 func_stripname
'=' '' "$func_resolve_sysroot_result"
1347 func_resolve_sysroot_result
=$lt_sysroot$func_stripname_result
1352 # func_replace_sysroot PATH
1353 # If PATH begins with the sysroot, replace it with = and
1354 # store the result into func_replace_sysroot_result.
1355 func_replace_sysroot
()
1357 case "$lt_sysroot:$1" in
1359 func_stripname
"$lt_sysroot" '' "$1"
1360 func_replace_sysroot_result
="=$func_stripname_result"
1363 # Including no sysroot.
1364 func_replace_sysroot_result
=$1
1369 # func_infer_tag arg
1370 # Infer tagged configuration to use if any are available and
1371 # if one wasn't chosen via the "--tag" command line option.
1372 # Only attempt this if the compiler in the base compile
1373 # command doesn't match the default compiler.
1374 # arg is usually of the form 'gcc ...'
1379 # FreeBSD-specific: where we install compilers with non-standard names
1380 tag_compilers_CC
="*cc cc* *gcc gcc* clang"
1381 tag_compilers_CXX
="*c++ c++* *g++ g++* clang++"
1382 base_compiler
=`set -- "$@"; echo $1`
1384 # If $tagname isn't set, then try to infer if the default "CC" tag applies
1385 if test -z "$tagname"; then
1386 for zp
in $tag_compilers_CC; do
1387 case $base_compiler in
1388 $zp) tagname
="CC"; break;;
1393 if test -n "$available_tags" && test -z "$tagname"; then
1396 func_append_quoted CC_quoted
"$arg"
1398 CC_expanded
=`func_echo_all $CC`
1399 CC_quoted_expanded
=`func_echo_all $CC_quoted`
1401 # Blanks in the command may have been stripped by the calling shell,
1402 # but not from the CC environment variable when configure was run.
1403 " $CC "* |
"$CC "* |
" $CC_expanded "* |
"$CC_expanded "* | \
1404 " $CC_quoted"* |
"$CC_quoted "* |
" $CC_quoted_expanded "* |
"$CC_quoted_expanded "*) ;;
1405 # Blanks at the start of $base_compile will cause this to fail
1406 # if we don't check for them as well.
1408 for z
in $available_tags; do
1409 if $GREP "^# ### BEGIN LIBTOOL TAG CONFIG: $z$" < "$progpath" > /dev
/null
; then
1410 # Evaluate the configuration.
1411 eval "`${SED} -n -e '/^# ### BEGIN LIBTOOL TAG CONFIG: '$z'$/,/^# ### END LIBTOOL TAG CONFIG: '$z'$/p' < $progpath`"
1414 # Double-quote args containing other shell metacharacters.
1415 func_append_quoted CC_quoted
"$arg"
1417 CC_expanded
=`func_echo_all $CC`
1418 CC_quoted_expanded
=`func_echo_all $CC_quoted`
1420 " $CC "* |
"$CC "* |
" $CC_expanded "* |
"$CC_expanded "* | \
1421 " $CC_quoted"* |
"$CC_quoted "* |
" $CC_quoted_expanded "* |
"$CC_quoted_expanded "*)
1422 # The compiler in the base compile command matches
1423 # the one in the tagged configuration.
1424 # Assume this is the tagged configuration we want.
1430 # FreeBSD-specific: try compilers based on inferred tag
1431 if test -z "$tagname"; then
1432 eval "tag_compilers=\$tag_compilers_${z}"
1433 if test -n "$tag_compilers"; then
1434 for zp
in $tag_compilers; do
1435 case $base_compiler in
1436 $zp) tagname
=$z; break;;
1439 if test -n "$tagname"; then
1446 # If $tagname still isn't set, then no tagged configuration
1447 # was found and let the user know that the "--tag" command
1448 # line option must be used.
1449 if test -z "$tagname"; then
1450 func_echo
"unable to infer tagged configuration"
1451 func_fatal_error
"specify a tag with \`--tag'"
1453 # func_verbose "using $tagname tagged configuration"
1462 # func_write_libtool_object output_name pic_name nonpic_name
1463 # Create a libtool object file (analogous to a ".la" file),
1464 # but don't create it if we're doing a dry run.
1465 func_write_libtool_object
()
1468 if test "$build_libtool_libs" = yes; then
1474 if test "$build_old_libs" = yes; then
1475 write_oldobj
=\'${3}\'
1481 cat >${write_libobj}T
<<EOF
1482 # $write_libobj - a libtool object file
1483 # Generated by $PROGRAM (GNU $PACKAGE$TIMESTAMP) $VERSION
1485 # Please DO NOT delete this file!
1486 # It is necessary for linking the library.
1488 # Name of the PIC object.
1489 pic_object=$write_lobj
1491 # Name of the non-PIC object
1492 non_pic_object=$write_oldobj
1495 $MV "${write_libobj}T" "${write_libobj}"
1500 ##################################################
1501 # FILE NAME AND PATH CONVERSION HELPER FUNCTIONS #
1502 ##################################################
1504 # func_convert_core_file_wine_to_w32 ARG
1505 # Helper function used by file name conversion functions when $build is *nix,
1506 # and $host is mingw, cygwin, or some other w32 environment. Relies on a
1507 # correctly configured wine environment available, with the winepath program
1508 # in $build's $PATH.
1510 # ARG is the $build file name to be converted to w32 format.
1511 # Result is available in $func_convert_core_file_wine_to_w32_result, and will
1512 # be empty on error (or when ARG is empty)
1513 func_convert_core_file_wine_to_w32
()
1516 func_convert_core_file_wine_to_w32_result
="$1"
1517 if test -n "$1"; then
1518 # Unfortunately, winepath does not exit with a non-zero error code, so we
1519 # are forced to check the contents of stdout. On the other hand, if the
1520 # command is not found, the shell will set an exit code of 127 and print
1521 # *an error message* to stdout. So we must check for both error code of
1522 # zero AND non-empty stdout, which explains the odd construction:
1523 func_convert_core_file_wine_to_w32_tmp
=`winepath -w "$1" 2>/dev/null`
1524 if test "$?" -eq 0 && test -n "${func_convert_core_file_wine_to_w32_tmp}"; then
1525 func_convert_core_file_wine_to_w32_result
=`$ECHO "$func_convert_core_file_wine_to_w32_tmp" |
1526 $SED -e "$lt_sed_naive_backslashify"`
1528 func_convert_core_file_wine_to_w32_result
=
1532 # end: func_convert_core_file_wine_to_w32
1535 # func_convert_core_path_wine_to_w32 ARG
1536 # Helper function used by path conversion functions when $build is *nix, and
1537 # $host is mingw, cygwin, or some other w32 environment. Relies on a correctly
1538 # configured wine environment available, with the winepath program in $build's
1539 # $PATH. Assumes ARG has no leading or trailing path separator characters.
1541 # ARG is path to be converted from $build format to win32.
1542 # Result is available in $func_convert_core_path_wine_to_w32_result.
1543 # Unconvertible file (directory) names in ARG are skipped; if no directory names
1544 # are convertible, then the result may be empty.
1545 func_convert_core_path_wine_to_w32
()
1548 # unfortunately, winepath doesn't convert paths, only file names
1549 func_convert_core_path_wine_to_w32_result
=""
1550 if test -n "$1"; then
1553 for func_convert_core_path_wine_to_w32_f
in $1; do
1555 func_convert_core_file_wine_to_w32
"$func_convert_core_path_wine_to_w32_f"
1556 if test -n "$func_convert_core_file_wine_to_w32_result" ; then
1557 if test -z "$func_convert_core_path_wine_to_w32_result"; then
1558 func_convert_core_path_wine_to_w32_result
="$func_convert_core_file_wine_to_w32_result"
1560 func_append func_convert_core_path_wine_to_w32_result
";$func_convert_core_file_wine_to_w32_result"
1567 # end: func_convert_core_path_wine_to_w32
1570 # func_cygpath ARGS...
1571 # Wrapper around calling the cygpath program via LT_CYGPATH. This is used when
1572 # when (1) $build is *nix and Cygwin is hosted via a wine environment; or (2)
1573 # $build is MSYS and $host is Cygwin, or (3) $build is Cygwin. In case (1) or
1574 # (2), returns the Cygwin file name or path in func_cygpath_result (input
1575 # file name or path is assumed to be in w32 format, as previously converted
1576 # from $build's *nix or MSYS format). In case (3), returns the w32 file name
1577 # or path in func_cygpath_result (input file name or path is assumed to be in
1578 # Cygwin format). Returns an empty string on error.
1580 # ARGS are passed to cygpath, with the last one being the file name or path to
1583 # Specify the absolute *nix (or w32) name to cygpath in the LT_CYGPATH
1584 # environment variable; do not put it in $PATH.
1588 if test -n "$LT_CYGPATH" && test -f "$LT_CYGPATH"; then
1589 func_cygpath_result
=`$LT_CYGPATH "$@" 2>/dev/null`
1590 if test "$?" -ne 0; then
1591 # on failure, ensure result is empty
1592 func_cygpath_result
=
1595 func_cygpath_result
=
1596 func_error
"LT_CYGPATH is empty or specifies non-existent file: \`$LT_CYGPATH'"
1602 # func_convert_core_msys_to_w32 ARG
1603 # Convert file name or path ARG from MSYS format to w32 format. Return
1604 # result in func_convert_core_msys_to_w32_result.
1605 func_convert_core_msys_to_w32
()
1608 # awkward: cmd appends spaces to result
1609 func_convert_core_msys_to_w32_result
=`( cmd //c echo "$1" ) 2>/dev/null |
1610 $SED -e 's/[ ]*$//' -e "$lt_sed_naive_backslashify"`
1612 #end: func_convert_core_msys_to_w32
1615 # func_convert_file_check ARG1 ARG2
1616 # Verify that ARG1 (a file name in $build format) was converted to $host
1617 # format in ARG2. Otherwise, emit an error message, but continue (resetting
1618 # func_to_host_file_result to ARG1).
1619 func_convert_file_check
()
1622 if test -z "$2" && test -n "$1" ; then
1623 func_error
"Could not determine host file name corresponding to"
1625 func_error
"Continuing, but uninstalled executables may not work."
1627 func_to_host_file_result
="$1"
1630 # end func_convert_file_check
1633 # func_convert_path_check FROM_PATHSEP TO_PATHSEP FROM_PATH TO_PATH
1634 # Verify that FROM_PATH (a path in $build format) was converted to $host
1635 # format in TO_PATH. Otherwise, emit an error message, but continue, resetting
1636 # func_to_host_file_result to a simplistic fallback value (see below).
1637 func_convert_path_check
()
1640 if test -z "$4" && test -n "$3"; then
1641 func_error
"Could not determine the host path corresponding to"
1643 func_error
"Continuing, but uninstalled executables may not work."
1644 # Fallback. This is a deliberately simplistic "conversion" and
1645 # should not be "improved". See libtool.info.
1646 if test "x$1" != "x$2"; then
1647 lt_replace_pathsep_chars
="s|$1|$2|g"
1648 func_to_host_path_result
=`echo "$3" |
1649 $SED -e "$lt_replace_pathsep_chars"`
1651 func_to_host_path_result
="$3"
1655 # end func_convert_path_check
1658 # func_convert_path_front_back_pathsep FRONTPAT BACKPAT REPL ORIG
1659 # Modifies func_to_host_path_result by prepending REPL if ORIG matches FRONTPAT
1660 # and appending REPL if ORIG matches BACKPAT.
1661 func_convert_path_front_back_pathsep
()
1665 $1 ) func_to_host_path_result
="$3$func_to_host_path_result"
1669 $2 ) func_append func_to_host_path_result
"$3"
1673 # end func_convert_path_front_back_pathsep
1676 ##################################################
1677 # $build to $host FILE NAME CONVERSION FUNCTIONS #
1678 ##################################################
1679 # invoked via `$to_host_file_cmd ARG'
1681 # In each case, ARG is the path to be converted from $build to $host format.
1682 # Result will be available in $func_to_host_file_result.
1685 # func_to_host_file ARG
1686 # Converts the file name ARG from $build format to $host format. Return result
1687 # in func_to_host_file_result.
1688 func_to_host_file
()
1691 $to_host_file_cmd "$1"
1693 # end func_to_host_file
1696 # func_to_tool_file ARG LAZY
1697 # converts the file name ARG from $build format to toolchain format. Return
1698 # result in func_to_tool_file_result. If the conversion in use is listed
1699 # in (the comma separated) LAZY, no conversion takes place.
1700 func_to_tool_file
()
1704 *,"$to_tool_file_cmd",*)
1705 func_to_tool_file_result
=$1
1708 $to_tool_file_cmd "$1"
1709 func_to_tool_file_result
=$func_to_host_file_result
1713 # end func_to_tool_file
1716 # func_convert_file_noop ARG
1717 # Copy ARG to func_to_host_file_result.
1718 func_convert_file_noop
()
1720 func_to_host_file_result
="$1"
1722 # end func_convert_file_noop
1725 # func_convert_file_msys_to_w32 ARG
1726 # Convert file name ARG from (mingw) MSYS to (mingw) w32 format; automatic
1727 # conversion to w32 is not available inside the cwrapper. Returns result in
1728 # func_to_host_file_result.
1729 func_convert_file_msys_to_w32
()
1732 func_to_host_file_result
="$1"
1733 if test -n "$1"; then
1734 func_convert_core_msys_to_w32
"$1"
1735 func_to_host_file_result
="$func_convert_core_msys_to_w32_result"
1737 func_convert_file_check
"$1" "$func_to_host_file_result"
1739 # end func_convert_file_msys_to_w32
1742 # func_convert_file_cygwin_to_w32 ARG
1743 # Convert file name ARG from Cygwin to w32 format. Returns result in
1744 # func_to_host_file_result.
1745 func_convert_file_cygwin_to_w32
()
1748 func_to_host_file_result
="$1"
1749 if test -n "$1"; then
1750 # because $build is cygwin, we call "the" cygpath in $PATH; no need to use
1751 # LT_CYGPATH in this case.
1752 func_to_host_file_result
=`cygpath -m "$1"`
1754 func_convert_file_check
"$1" "$func_to_host_file_result"
1756 # end func_convert_file_cygwin_to_w32
1759 # func_convert_file_nix_to_w32 ARG
1760 # Convert file name ARG from *nix to w32 format. Requires a wine environment
1761 # and a working winepath. Returns result in func_to_host_file_result.
1762 func_convert_file_nix_to_w32
()
1765 func_to_host_file_result
="$1"
1766 if test -n "$1"; then
1767 func_convert_core_file_wine_to_w32
"$1"
1768 func_to_host_file_result
="$func_convert_core_file_wine_to_w32_result"
1770 func_convert_file_check
"$1" "$func_to_host_file_result"
1772 # end func_convert_file_nix_to_w32
1775 # func_convert_file_msys_to_cygwin ARG
1776 # Convert file name ARG from MSYS to Cygwin format. Requires LT_CYGPATH set.
1777 # Returns result in func_to_host_file_result.
1778 func_convert_file_msys_to_cygwin
()
1781 func_to_host_file_result
="$1"
1782 if test -n "$1"; then
1783 func_convert_core_msys_to_w32
"$1"
1784 func_cygpath
-u "$func_convert_core_msys_to_w32_result"
1785 func_to_host_file_result
="$func_cygpath_result"
1787 func_convert_file_check
"$1" "$func_to_host_file_result"
1789 # end func_convert_file_msys_to_cygwin
1792 # func_convert_file_nix_to_cygwin ARG
1793 # Convert file name ARG from *nix to Cygwin format. Requires Cygwin installed
1794 # in a wine environment, working winepath, and LT_CYGPATH set. Returns result
1795 # in func_to_host_file_result.
1796 func_convert_file_nix_to_cygwin
()
1799 func_to_host_file_result
="$1"
1800 if test -n "$1"; then
1801 # convert from *nix to w32, then use cygpath to convert from w32 to cygwin.
1802 func_convert_core_file_wine_to_w32
"$1"
1803 func_cygpath
-u "$func_convert_core_file_wine_to_w32_result"
1804 func_to_host_file_result
="$func_cygpath_result"
1806 func_convert_file_check
"$1" "$func_to_host_file_result"
1808 # end func_convert_file_nix_to_cygwin
1811 #############################################
1812 # $build to $host PATH CONVERSION FUNCTIONS #
1813 #############################################
1814 # invoked via `$to_host_path_cmd ARG'
1816 # In each case, ARG is the path to be converted from $build to $host format.
1817 # The result will be available in $func_to_host_path_result.
1819 # Path separators are also converted from $build format to $host format. If
1820 # ARG begins or ends with a path separator character, it is preserved (but
1821 # converted to $host format) on output.
1823 # All path conversion functions are named using the following convention:
1824 # file name conversion function : func_convert_file_X_to_Y ()
1825 # path conversion function : func_convert_path_X_to_Y ()
1826 # where, for any given $build/$host combination the 'X_to_Y' value is the
1827 # same. If conversion functions are added for new $build/$host combinations,
1828 # the two new functions must follow this pattern, or func_init_to_host_path_cmd
1832 # func_init_to_host_path_cmd
1833 # Ensures that function "pointer" variable $to_host_path_cmd is set to the
1834 # appropriate value, based on the value of $to_host_file_cmd.
1836 func_init_to_host_path_cmd
()
1839 if test -z "$to_host_path_cmd"; then
1840 func_stripname
'func_convert_file_' '' "$to_host_file_cmd"
1841 to_host_path_cmd
="func_convert_path_${func_stripname_result}"
1846 # func_to_host_path ARG
1847 # Converts the path ARG from $build format to $host format. Return result
1848 # in func_to_host_path_result.
1849 func_to_host_path
()
1852 func_init_to_host_path_cmd
1853 $to_host_path_cmd "$1"
1855 # end func_to_host_path
1858 # func_convert_path_noop ARG
1859 # Copy ARG to func_to_host_path_result.
1860 func_convert_path_noop
()
1862 func_to_host_path_result
="$1"
1864 # end func_convert_path_noop
1867 # func_convert_path_msys_to_w32 ARG
1868 # Convert path ARG from (mingw) MSYS to (mingw) w32 format; automatic
1869 # conversion to w32 is not available inside the cwrapper. Returns result in
1870 # func_to_host_path_result.
1871 func_convert_path_msys_to_w32
()
1874 func_to_host_path_result
="$1"
1875 if test -n "$1"; then
1876 # Remove leading and trailing path separator characters from ARG. MSYS
1877 # behavior is inconsistent here; cygpath turns them into '.;' and ';.';
1878 # and winepath ignores them completely.
1879 func_stripname
: : "$1"
1880 func_to_host_path_tmp1
=$func_stripname_result
1881 func_convert_core_msys_to_w32
"$func_to_host_path_tmp1"
1882 func_to_host_path_result
="$func_convert_core_msys_to_w32_result"
1883 func_convert_path_check
: ";" \
1884 "$func_to_host_path_tmp1" "$func_to_host_path_result"
1885 func_convert_path_front_back_pathsep
":*" "*:" ";" "$1"
1888 # end func_convert_path_msys_to_w32
1891 # func_convert_path_cygwin_to_w32 ARG
1892 # Convert path ARG from Cygwin to w32 format. Returns result in
1893 # func_to_host_file_result.
1894 func_convert_path_cygwin_to_w32
()
1897 func_to_host_path_result
="$1"
1898 if test -n "$1"; then
1899 # See func_convert_path_msys_to_w32:
1900 func_stripname
: : "$1"
1901 func_to_host_path_tmp1
=$func_stripname_result
1902 func_to_host_path_result
=`cygpath -m -p "$func_to_host_path_tmp1"`
1903 func_convert_path_check
: ";" \
1904 "$func_to_host_path_tmp1" "$func_to_host_path_result"
1905 func_convert_path_front_back_pathsep
":*" "*:" ";" "$1"
1908 # end func_convert_path_cygwin_to_w32
1911 # func_convert_path_nix_to_w32 ARG
1912 # Convert path ARG from *nix to w32 format. Requires a wine environment and
1913 # a working winepath. Returns result in func_to_host_file_result.
1914 func_convert_path_nix_to_w32
()
1917 func_to_host_path_result
="$1"
1918 if test -n "$1"; then
1919 # See func_convert_path_msys_to_w32:
1920 func_stripname
: : "$1"
1921 func_to_host_path_tmp1
=$func_stripname_result
1922 func_convert_core_path_wine_to_w32
"$func_to_host_path_tmp1"
1923 func_to_host_path_result
="$func_convert_core_path_wine_to_w32_result"
1924 func_convert_path_check
: ";" \
1925 "$func_to_host_path_tmp1" "$func_to_host_path_result"
1926 func_convert_path_front_back_pathsep
":*" "*:" ";" "$1"
1929 # end func_convert_path_nix_to_w32
1932 # func_convert_path_msys_to_cygwin ARG
1933 # Convert path ARG from MSYS to Cygwin format. Requires LT_CYGPATH set.
1934 # Returns result in func_to_host_file_result.
1935 func_convert_path_msys_to_cygwin
()
1938 func_to_host_path_result
="$1"
1939 if test -n "$1"; then
1940 # See func_convert_path_msys_to_w32:
1941 func_stripname
: : "$1"
1942 func_to_host_path_tmp1
=$func_stripname_result
1943 func_convert_core_msys_to_w32
"$func_to_host_path_tmp1"
1944 func_cygpath
-u -p "$func_convert_core_msys_to_w32_result"
1945 func_to_host_path_result
="$func_cygpath_result"
1946 func_convert_path_check
: : \
1947 "$func_to_host_path_tmp1" "$func_to_host_path_result"
1948 func_convert_path_front_back_pathsep
":*" "*:" : "$1"
1951 # end func_convert_path_msys_to_cygwin
1954 # func_convert_path_nix_to_cygwin ARG
1955 # Convert path ARG from *nix to Cygwin format. Requires Cygwin installed in a
1956 # a wine environment, working winepath, and LT_CYGPATH set. Returns result in
1957 # func_to_host_file_result.
1958 func_convert_path_nix_to_cygwin
()
1961 func_to_host_path_result
="$1"
1962 if test -n "$1"; then
1963 # Remove leading and trailing path separator characters from
1964 # ARG. msys behavior is inconsistent here, cygpath turns them
1965 # into '.;' and ';.', and winepath ignores them completely.
1966 func_stripname
: : "$1"
1967 func_to_host_path_tmp1
=$func_stripname_result
1968 func_convert_core_path_wine_to_w32
"$func_to_host_path_tmp1"
1969 func_cygpath
-u -p "$func_convert_core_path_wine_to_w32_result"
1970 func_to_host_path_result
="$func_cygpath_result"
1971 func_convert_path_check
: : \
1972 "$func_to_host_path_tmp1" "$func_to_host_path_result"
1973 func_convert_path_front_back_pathsep
":*" "*:" : "$1"
1976 # end func_convert_path_nix_to_cygwin
1979 # func_mode_compile arg...
1980 func_mode_compile
()
1983 # Get the compilation command and the source file.
1985 srcfile
="$nonopt" # always keep a non-empty value in "srcfile"
1997 # do not "continue". Instead, add this to base_compile
2009 # Accept any command-line options.
2012 test -n "$libobj" && \
2013 func_fatal_error
"you cannot specify \`-o' more than once"
2018 -pie |
-fpie |
-fPIE)
2019 func_append pie_flag
" $arg"
2023 -shared |
-static |
-prefer-pic |
-prefer-non-pic)
2024 func_append later
" $arg"
2034 arg_mode
=arg
# the next one goes into the "base_compile" arg list
2035 continue # The current "srcfile" will either be retained or
2036 ;; # replaced later. I would guess that would be a bug.
2039 func_stripname
'-Wc,' '' "$arg"
2040 args
=$func_stripname_result
2042 save_ifs
="$IFS"; IFS
=','
2043 for arg
in $args; do
2045 func_append_quoted lastarg
"$arg"
2048 func_stripname
' ' '' "$lastarg"
2049 lastarg
=$func_stripname_result
2051 # Add the arguments to base_compile.
2052 func_append base_compile
" $lastarg"
2057 # Accept the current argument as the source file.
2058 # The previous "srcfile" becomes the current argument.
2065 esac # case $arg_mode
2067 # Aesthetically quote the previous argument.
2068 func_append_quoted base_compile
"$lastarg"
2073 func_fatal_error
"you must specify an argument for -Xcompile"
2076 func_fatal_error
"you must specify a target with \`-o'"
2079 # Get the name of the library object.
2080 test -z "$libobj" && {
2081 func_basename
"$srcfile"
2082 libobj
="$func_basename_result"
2087 # Recognize several different file suffixes.
2088 # If the user specifies -o file.o, it is replaced with file.lo
2091 *.ada |
*.adb |
*.ads |
*.asm | \
2092 *.c
++ |
*.cc |
*.ii |
*.class |
*.cpp |
*.cxx | \
2093 *.
[fF
][09]? |
*.
for |
*.java |
*.go |
*.obj |
*.sx |
*.cu |
*.cup
)
2094 func_xform
"$libobj"
2095 libobj
=$func_xform_result
2100 *.lo
) func_lo2o
"$libobj"; obj
=$func_lo2o_result ;;
2102 func_fatal_error
"cannot determine name of library object from \`$libobj'"
2106 func_infer_tag
$base_compile
2108 for arg
in $later; do
2111 test "$build_libtool_libs" != yes && \
2112 func_fatal_configuration
"can not build a shared library"
2118 build_libtool_libs
=no
2135 func_quote_for_eval
"$libobj"
2136 test "X$libobj" != "X$func_quote_for_eval_result" \
2137 && $ECHO "X$libobj" |
$GREP '[]~#^*{};<>?"'"'"' &()|`$[]' \
2138 && func_warning
"libobj name \`$libobj' may not contain shell special characters."
2139 func_dirname_and_basename
"$obj" "/" ""
2140 objname
="$func_basename_result"
2141 xdir
="$func_dirname_result"
2142 lobj
=${xdir}$objdir/$objname
2144 test -z "$base_compile" && \
2145 func_fatal_help
"you must specify a compilation command"
2147 # Delete any leftover library objects.
2148 if test "$build_old_libs" = yes; then
2149 removelist
="$obj $lobj $libobj ${libobj}T"
2151 removelist
="$lobj $libobj ${libobj}T"
2154 # On Cygwin there's no "real" PIC flag so we must build both object types
2156 cygwin
* | mingw
* | pw32
* | os2
* | cegcc
*)
2160 if test "$pic_mode" = no
&& test "$deplibs_check_method" != pass_all
; then
2161 # non-PIC code in shared libraries is not supported
2165 # Calculate the filename of the output object if compiler does
2166 # not support -o with -c
2167 if test "$compiler_c_o" = no
; then
2168 output_obj
=`$ECHO "$srcfile" | $SED 's%^.*/%%; s%\.[^.]*$%%'`.
${objext}
2169 lockfile
="$output_obj.lock"
2176 # Lock this critical section if it is needed
2177 # We use this script file to make the link, it avoids creating a new file
2178 if test "$need_locks" = yes; then
2179 until $opt_dry_run ||
ln "$progpath" "$lockfile" 2>/dev
/null
; do
2180 func_echo
"Waiting for $lockfile to be removed"
2183 elif test "$need_locks" = warn
; then
2184 if test -f "$lockfile"; then
2186 *** ERROR, $lockfile exists and contains:
2187 `cat $lockfile 2>/dev/null`
2189 This indicates that another process is trying to use the same
2190 temporary object file, and libtool could not work around it because
2191 your compiler does not support \`-c' and \`-o' together. If you
2192 repeat this compilation, it may succeed, by chance, but you had better
2193 avoid parallel builds (make -j) in this platform, or get a better
2196 $opt_dry_run ||
$RM $removelist
2199 func_append removelist
" $output_obj"
2200 $ECHO "$srcfile" > "$lockfile"
2203 $opt_dry_run ||
$RM $removelist
2204 func_append removelist
" $lockfile"
2205 trap '$opt_dry_run || $RM $removelist; exit $EXIT_FAILURE' 1 2 15
2207 func_to_tool_file
"$srcfile" func_convert_file_msys_to_w32
2208 srcfile
=$func_to_tool_file_result
2209 func_quote_for_eval
"$srcfile"
2210 qsrcfile
=$func_quote_for_eval_result
2212 # Only build a PIC object if we are building libtool libraries.
2213 if test "$build_libtool_libs" = yes; then
2214 # Without this assignment, base_compile gets emptied.
2215 fbsd_hideous_sh_bug
=$base_compile
2217 if test "$pic_mode" != no
; then
2218 command="$base_compile $qsrcfile $pic_flag"
2220 # Don't build PIC code
2221 command="$base_compile $qsrcfile"
2224 func_mkdir_p
"$xdir$objdir"
2226 if test -z "$output_obj"; then
2227 # Place PIC objects in $objdir
2228 func_append
command " -o $lobj"
2231 func_show_eval_locale
"$command" \
2232 'test -n "$output_obj" && $RM $removelist; exit $EXIT_FAILURE'
2234 if test "$need_locks" = warn
&&
2235 test "X`cat $lockfile 2>/dev/null`" != "X$srcfile"; then
2237 *** ERROR, $lockfile contains:
2238 `cat $lockfile 2>/dev/null`
2240 but it should contain:
2243 This indicates that another process is trying to use the same
2244 temporary object file, and libtool could not work around it because
2245 your compiler does not support \`-c' and \`-o' together. If you
2246 repeat this compilation, it may succeed, by chance, but you had better
2247 avoid parallel builds (make -j) in this platform, or get a better
2250 $opt_dry_run ||
$RM $removelist
2254 # Just move the object if needed, then go on to compile the next one
2255 if test -n "$output_obj" && test "X$output_obj" != "X$lobj"; then
2256 func_show_eval
'$MV "$output_obj" "$lobj"' \
2257 'error=$?; $opt_dry_run || $RM $removelist; exit $error'
2260 # Allow error messages only from the first compilation.
2261 if test "$suppress_opt" = yes; then
2262 suppress_output
=' >/dev/null 2>&1'
2266 # Only build a position-dependent object if we build old libraries.
2267 if test "$build_old_libs" = yes; then
2268 if test "$pic_mode" != yes; then
2269 # Don't build PIC code
2270 command="$base_compile $qsrcfile$pie_flag"
2272 command="$base_compile $qsrcfile $pic_flag"
2274 if test "$compiler_c_o" = yes; then
2275 func_append
command " -o $obj"
2278 # Suppress compiler output if we already did a PIC compilation.
2279 func_append
command "$suppress_output"
2280 func_show_eval_locale
"$command" \
2281 '$opt_dry_run || $RM $removelist; exit $EXIT_FAILURE'
2283 if test "$need_locks" = warn
&&
2284 test "X`cat $lockfile 2>/dev/null`" != "X$srcfile"; then
2286 *** ERROR, $lockfile contains:
2287 `cat $lockfile 2>/dev/null`
2289 but it should contain:
2292 This indicates that another process is trying to use the same
2293 temporary object file, and libtool could not work around it because
2294 your compiler does not support \`-c' and \`-o' together. If you
2295 repeat this compilation, it may succeed, by chance, but you had better
2296 avoid parallel builds (make -j) in this platform, or get a better
2299 $opt_dry_run ||
$RM $removelist
2303 # Just move the object if needed
2304 if test -n "$output_obj" && test "X$output_obj" != "X$obj"; then
2305 func_show_eval
'$MV "$output_obj" "$obj"' \
2306 'error=$?; $opt_dry_run || $RM $removelist; exit $error'
2311 func_write_libtool_object
"$libobj" "$objdir/$objname" "$objname"
2313 # Unlock the critical section if it was locked
2314 if test "$need_locks" != no
; then
2315 removelist
=$lockfile
2324 test "$opt_mode" = compile
&& func_mode_compile
${1+"$@"}
2329 # We need to display help for each of the modes.
2332 # Generic help is extracted from the usage comments
2333 # at the start of this file.
2339 "Usage: $progname [OPTION]... --mode=clean RM [RM-OPTION]... FILE...
2341 Remove files from the build directory.
2343 RM is the name of the program to use to delete files associated with each FILE
2344 (typically \`/bin/rm'). RM-OPTIONS are options (such as \`-f') to be passed
2347 If FILE is a libtool library, object or program, all the files associated
2348 with it are deleted. Otherwise, only FILE itself is deleted using RM."
2353 "Usage: $progname [OPTION]... --mode=compile COMPILE-COMMAND... SOURCEFILE
2355 Compile a source file into a libtool library object.
2357 This mode accepts the following additional options:
2359 -o OUTPUT-FILE set the output file name to OUTPUT-FILE
2360 -no-suppress do not suppress compiler output for multiple passes
2361 -prefer-pic try to build PIC objects only
2362 -prefer-non-pic try to build non-PIC objects only
2363 -shared do not build a \`.o' file suitable for static linking
2364 -static only build a \`.o' file suitable for static linking
2365 -Wc,FLAG pass FLAG directly to the compiler
2367 COMPILE-COMMAND is a command to be used in creating a \`standard' object file
2368 from the given SOURCEFILE.
2370 The output file name is determined by removing the directory component from
2371 SOURCEFILE, then substituting the C source code suffix \`.c' with the
2372 library object suffix, \`.lo'."
2377 "Usage: $progname [OPTION]... --mode=execute COMMAND [ARGS]...
2379 Automatically set library path, then run a program.
2381 This mode accepts the following additional options:
2383 -dlopen FILE add the directory containing FILE to the library path
2385 This mode sets the library path environment variable according to \`-dlopen'
2388 If any of the ARGS are libtool executable wrappers, then they are translated
2389 into their corresponding uninstalled binary, and any of their required library
2390 directories are added to the library path.
2392 Then, COMMAND is executed, with ARGS as arguments."
2397 "Usage: $progname [OPTION]... --mode=finish [LIBDIR]...
2399 Complete the installation of libtool libraries.
2401 Each LIBDIR is a directory that contains libtool libraries.
2403 The commands that this mode executes may require superuser privileges. Use
2404 the \`--dry-run' option if you just want to see what would be executed."
2409 "Usage: $progname [OPTION]... --mode=install INSTALL-COMMAND...
2411 Install executables or libraries.
2413 INSTALL-COMMAND is the installation command. The first component should be
2414 either the \`install' or \`cp' program.
2416 The following components of INSTALL-COMMAND are treated specially:
2418 -inst-prefix-dir PREFIX-DIR Use PREFIX-DIR as a staging area for installation
2420 The rest of the components are interpreted as arguments to that command (only
2421 BSD-compatible install options are recognized)."
2426 "Usage: $progname [OPTION]... --mode=link LINK-COMMAND...
2428 Link object files or libraries together to form another library, or to
2429 create an executable program.
2431 LINK-COMMAND is a command using the C compiler that you would use to create
2432 a program from several object files.
2434 The following components of LINK-COMMAND are treated specially:
2436 -all-static do not do any dynamic linking at all
2437 -avoid-version do not add a version suffix if possible
2438 -bindir BINDIR specify path to binaries directory (for systems where
2439 libraries must be found in the PATH setting at runtime)
2440 -dlopen FILE \`-dlpreopen' FILE if it cannot be dlopened at runtime
2441 -dlpreopen FILE link in FILE and add its symbols to lt_preloaded_symbols
2442 -export-dynamic allow symbols from OUTPUT-FILE to be resolved with dlsym(3)
2443 -export-symbols SYMFILE
2444 try to export only the symbols listed in SYMFILE
2445 -export-symbols-regex REGEX
2446 try to export only the symbols matching REGEX
2447 -LLIBDIR search LIBDIR for required installed libraries
2448 -lNAME OUTPUT-FILE requires the installed library libNAME
2449 -module build a library that can dlopened
2450 -no-fast-install disable the fast-install mode
2451 -no-install link a not-installable executable
2452 -no-undefined declare that a library does not refer to external symbols
2453 -o OUTPUT-FILE create OUTPUT-FILE from the specified objects
2454 -objectlist FILE Use a list of object files found in FILE to specify objects
2455 -precious-files-regex REGEX
2456 don't remove output files matching REGEX
2457 -release RELEASE specify package release information
2458 -rpath LIBDIR the created library will eventually be installed in LIBDIR
2459 -R[ ]LIBDIR add LIBDIR to the runtime path of programs and libraries
2460 -shared only do dynamic linking of libtool libraries
2461 -shrext SUFFIX override the standard shared library file extension
2462 -static do not do any dynamic linking of uninstalled libtool libraries
2463 -static-libtool-libs
2464 do not do any dynamic linking of libtool libraries
2465 -version-info CURRENT[:REVISION[:AGE]]
2466 specify library version info [each variable defaults to 0]
2467 -weak LIBNAME declare that the target provides the LIBNAME interface
2469 -Xcompiler FLAG pass linker-specific FLAG directly to the compiler
2471 -Xlinker FLAG pass linker-specific FLAG directly to the linker
2472 -XCClinker FLAG pass link-specific FLAG to the compiler driver (CC)
2474 All other options (arguments beginning with \`-') are ignored.
2476 Every other argument is treated as a filename. Files ending in \`.la' are
2477 treated as uninstalled libtool libraries, other files are standard or library
2480 If the OUTPUT-FILE ends in \`.la', then a libtool library is created,
2481 only library objects (\`.lo' files) may be specified, and \`-rpath' is
2482 required, except when creating a convenience library.
2484 If OUTPUT-FILE ends in \`.a' or \`.lib', then a standard library is created
2485 using \`ar' and \`ranlib', or on Windows using \`lib'.
2487 If OUTPUT-FILE ends in \`.lo' or \`.${objext}', then a reloadable object file
2488 is created, otherwise an executable program is created."
2493 "Usage: $progname [OPTION]... --mode=uninstall RM [RM-OPTION]... FILE...
2495 Remove libraries from an installation directory.
2497 RM is the name of the program to use to delete files associated with each FILE
2498 (typically \`/bin/rm'). RM-OPTIONS are options (such as \`-f') to be passed
2501 If FILE is a libtool library, all the files associated with it are deleted.
2502 Otherwise, only FILE itself is deleted using RM."
2506 func_fatal_help
"invalid operation mode \`$opt_mode'"
2511 $ECHO "Try \`$progname --help' for more information about other modes."
2514 # Now that we've collected a possible --mode arg, show help if necessary
2516 if test "$opt_help" = :; then
2521 for opt_mode
in compile link execute
install finish uninstall clean
; do
2524 } |
sed -n '1p; 2,$s/^Usage:/ or: /p'
2527 for opt_mode
in compile link execute
install finish uninstall clean
; do
2533 /^When reporting/,/^Report/{
2538 /information about other modes/d
2539 /more detailed .*MODE/d
2540 s/^Usage:.*--mode=\([^ ]*\) .*/Description of \1 mode:/'
2546 # func_mode_execute arg...
2547 func_mode_execute
()
2550 # The first argument is the command name.
2553 func_fatal_help
"you must specify a COMMAND"
2555 # Handle -dlopen flags immediately.
2556 for file in $opt_dlopen; do
2558 || func_fatal_help
"\`$file' is not a file"
2563 func_resolve_sysroot
"$file"
2564 file=$func_resolve_sysroot_result
2566 # Check to see that this really is a libtool archive.
2567 func_lalib_unsafe_p
"$file" \
2568 || func_fatal_help
"\`$lib' is not a valid libtool archive"
2570 # Read the libtool library.
2575 # Skip this library if it cannot be dlopened.
2576 if test -z "$dlname"; then
2577 # Warn if it was a shared library.
2578 test -n "$library_names" && \
2579 func_warning
"\`$file' was not linked with \`-export-dynamic'"
2583 func_dirname
"$file" "" "."
2584 dir
="$func_dirname_result"
2586 if test -f "$dir/$objdir/$dlname"; then
2587 func_append dir
"/$objdir"
2589 if test ! -f "$dir/$dlname"; then
2590 func_fatal_error
"cannot find \`$dlname' in \`$dir' or \`$dir/$objdir'"
2596 # Just add the directory containing the .lo file.
2597 func_dirname
"$file" "" "."
2598 dir
="$func_dirname_result"
2602 func_warning
"\`-dlopen' is ignored for non-libtool libraries and objects"
2607 # Get the absolute pathname.
2608 absdir
=`cd "$dir" && pwd`
2609 test -n "$absdir" && dir
="$absdir"
2611 # Now add the directory to shlibpath_var.
2612 if eval "test -z \"\$$shlibpath_var\""; then
2613 eval "$shlibpath_var=\"\$dir\""
2615 eval "$shlibpath_var=\"\$dir:\$$shlibpath_var\""
2619 # This variable tells wrapper scripts just to set shlibpath_var
2620 # rather than running their programs.
2621 libtool_execute_magic
="$magic"
2623 # Check if any of the arguments is a wrapper script.
2628 -* |
*.la |
*.lo
) ;;
2630 # Do a test to see if this is really a libtool program.
2631 if func_ltwrapper_script_p
"$file"; then
2633 # Transform arg to wrapped name.
2634 file="$progdir/$program"
2635 elif func_ltwrapper_executable_p
"$file"; then
2636 func_ltwrapper_scriptname
"$file"
2637 func_source
"$func_ltwrapper_scriptname_result"
2638 # Transform arg to wrapped name.
2639 file="$progdir/$program"
2643 # Quote arguments (to preserve shell metacharacters).
2644 func_append_quoted args
"$file"
2647 if test "X$opt_dry_run" = Xfalse
; then
2648 if test -n "$shlibpath_var"; then
2649 # Export the shlibpath_var.
2650 eval "export $shlibpath_var"
2653 # Restore saved environment variables
2654 for lt_var
in LANG LANGUAGE LC_ALL LC_CTYPE LC_COLLATE LC_MESSAGES
2656 eval "if test \"\${save_$lt_var+set}\" = set; then
2657 $lt_var=\$save_$lt_var; export $lt_var
2663 # Now prepare to actually exec the command.
2664 exec_cmd
="\$cmd$args"
2666 # Display what would be done.
2667 if test -n "$shlibpath_var"; then
2668 eval "\$ECHO \"\$shlibpath_var=\$$shlibpath_var\""
2669 echo "export $shlibpath_var"
2676 test "$opt_mode" = execute
&& func_mode_execute
${1+"$@"}
2679 # func_mode_finish arg...
2687 for opt
in "$nonopt" ${1+"$@"}
2689 if test -d "$opt"; then
2690 func_append libdirs
" $opt"
2692 elif test -f "$opt"; then
2693 if func_lalib_unsafe_p
"$opt"; then
2694 func_append libs
" $opt"
2696 func_warning
"\`$opt' is not a valid libtool archive"
2700 func_fatal_error
"invalid argument \`$opt'"
2704 if test -n "$libs"; then
2705 if test -n "$lt_sysroot"; then
2706 sysroot_regex
=`$ECHO "$lt_sysroot" | $SED "$sed_make_literal_regex"`
2707 sysroot_cmd
="s/\([ ']\)$sysroot_regex/\1/g;"
2712 # Remove sysroot references
2713 if $opt_dry_run; then
2714 for lib
in $libs; do
2715 echo "removing references to $lt_sysroot and \`=' prefixes from $lib"
2718 tmpdir
=`func_mktempdir`
2719 for lib
in $libs; do
2720 sed -e "${sysroot_cmd} s/\([ ']-[LR]\)=/\1/g; s/\([ ']\)=/\1/g" $lib \
2722 mv -f $tmpdir/tmp-la
$lib
2728 if test -n "$finish_cmds$finish_eval" && test -n "$libdirs"; then
2729 for libdir
in $libdirs; do
2730 if test -n "$finish_cmds"; then
2731 # Do each command in the finish commands.
2732 func_execute_cmds
"$finish_cmds" 'admincmds="$admincmds
2735 if test -n "$finish_eval"; then
2736 # Do the single finish_eval.
2737 eval cmds
=\"$finish_eval\"
2738 $opt_dry_run ||
eval "$cmds" || func_append admincmds
"
2744 # Exit here if they wanted silent mode.
2745 $opt_silent && exit $EXIT_SUCCESS
2747 if test -n "$finish_cmds$finish_eval" && test -n "$libdirs"; then
2748 echo "----------------------------------------------------------------------"
2749 echo "Libraries have been installed in:"
2750 for libdir
in $libdirs; do
2754 echo "If you ever happen to want to link against installed libraries"
2755 echo "in a given directory, LIBDIR, you must either use libtool, and"
2756 echo "specify the full pathname of the library, or use the \`-LLIBDIR'"
2757 echo "flag during linking and do at least one of the following:"
2758 if test -n "$shlibpath_var"; then
2759 echo " - add LIBDIR to the \`$shlibpath_var' environment variable"
2760 echo " during execution"
2762 if test -n "$runpath_var"; then
2763 echo " - add LIBDIR to the \`$runpath_var' environment variable"
2764 echo " during linking"
2766 if test -n "$hardcode_libdir_flag_spec"; then
2768 eval flag
=\"$hardcode_libdir_flag_spec\"
2770 $ECHO " - use the \`$flag' linker flag"
2772 if test -n "$admincmds"; then
2773 $ECHO " - have your system administrator run these commands:$admincmds"
2775 if test -f /etc
/ld.so.conf
; then
2776 echo " - have your system administrator add LIBDIR to \`/etc/ld.so.conf'"
2780 echo "See any operating system documentation about shared libraries for"
2782 solaris2.
[6789]|solaris2.1
[0-9])
2783 echo "more information, such as the ld(1), crle(1) and ld.so(8) manual"
2787 echo "more information, such as the ld(1) and ld.so(8) manual pages."
2790 echo "----------------------------------------------------------------------"
2795 test "$opt_mode" = finish
&& func_mode_finish
${1+"$@"}
2798 # func_mode_install arg...
2799 func_mode_install
()
2802 # There may be an optional sh(1) argument at the beginning of
2803 # install_prog (especially on Windows NT).
2804 if test "$nonopt" = "$SHELL" ||
test "$nonopt" = /bin
/sh ||
2805 # Allow the use of GNU shtool's install command.
2806 case $nonopt in *shtool
*) :;; *) false
;; esac; then
2807 # Aesthetically quote it.
2808 func_quote_for_eval
"$nonopt"
2809 install_prog
="$func_quote_for_eval_result "
2817 # The real first argument should be the name of the installation program.
2818 # Aesthetically quote it.
2819 func_quote_for_eval
"$arg"
2820 func_append install_prog
"$func_quote_for_eval_result"
2821 install_shared_prog
=$install_prog
2822 case " $install_prog " in
2823 *[\\\
/]cp\
*) install_cp
=: ;;
2824 *) install_cp
=false
;;
2827 # We need to accept at least all the BSD install flags.
2839 if test -n "$dest"; then
2840 func_append files
" $dest"
2848 if $install_cp; then :; else
2862 # If the previous option needed an argument, then skip it.
2863 if test -n "$prev"; then
2864 if test "x$prev" = x-m
&& test -n "$install_override_mode"; then
2865 arg2
=$install_override_mode
2876 # Aesthetically quote the argument.
2877 func_quote_for_eval
"$arg"
2878 func_append install_prog
" $func_quote_for_eval_result"
2879 if test -n "$arg2"; then
2880 func_quote_for_eval
"$arg2"
2882 func_append install_shared_prog
" $func_quote_for_eval_result"
2885 test -z "$install_prog" && \
2886 func_fatal_help
"you must specify an install program"
2888 test -n "$prev" && \
2889 func_fatal_help
"the \`$prev' option requires an argument"
2891 if test -n "$install_override_mode" && $no_mode; then
2892 if $install_cp; then :; else
2893 func_quote_for_eval
"$install_override_mode"
2894 func_append install_shared_prog
" -m $func_quote_for_eval_result"
2898 if test -z "$files"; then
2899 if test -z "$dest"; then
2900 func_fatal_help
"no file or destination specified"
2902 func_fatal_help
"you must specify a destination"
2906 # Strip any trailing slash from the destination.
2907 func_stripname
'' '/' "$dest"
2908 dest
=$func_stripname_result
2910 # Check to see that the destination is a directory.
2911 test -d "$dest" && isdir
=yes
2912 if test "$isdir" = yes; then
2916 func_dirname_and_basename
"$dest" "" "."
2917 destdir
="$func_dirname_result"
2918 destname
="$func_basename_result"
2920 # Not a directory, so check to see that there is only one file specified.
2921 set dummy
$files; shift
2922 test "$#" -gt 1 && \
2923 func_fatal_help
"\`$dest' is not a directory"
2926 [\\/]* |
[A-Za-z
]:[\\/]*) ;;
2928 for file in $files; do
2932 func_fatal_help
"\`$destdir' must be an absolute directory name"
2939 # This variable tells wrapper scripts just to set variables rather
2940 # than running their programs.
2941 libtool_install_magic
="$magic"
2946 for file in $files; do
2948 # Do each installation.
2951 # Do the static libraries later.
2952 func_append staticlibs
" $file"
2956 func_resolve_sysroot
"$file"
2957 file=$func_resolve_sysroot_result
2959 # Check to see that this really is a libtool archive.
2960 func_lalib_unsafe_p
"$file" \
2961 || func_fatal_help
"\`$file' is not a valid libtool archive"
2968 # Add the libdir to current_libdirs if it is the destination.
2969 if test "X$destdir" = "X$libdir"; then
2970 case "$current_libdirs " in
2972 *) func_append current_libdirs
" $libdir" ;;
2975 # Note the libdir as a future libdir.
2976 case "$future_libdirs " in
2978 *) func_append future_libdirs
" $libdir" ;;
2982 func_dirname
"$file" "/" ""
2983 dir
="$func_dirname_result"
2984 func_append dir
"$objdir"
2986 if test -n "$relink_command"; then
2987 # Determine the prefix the user has applied to our future dir.
2988 inst_prefix_dir
=`$ECHO "$destdir" | $SED -e "s%$libdir\$%%"`
2990 # Don't allow the user to place us outside of our expected
2991 # location b/c this prevents finding dependent libraries that
2992 # are installed to the same prefix.
2993 # At present, this check doesn't affect windows .dll's that
2994 # are installed into $libdir/../bin (currently, that works fine)
2995 # but it's something to keep an eye on.
2996 test "$inst_prefix_dir" = "$destdir" && \
2997 func_fatal_error
"error: cannot install \`$file' to a directory not ending in $libdir"
2999 if test -n "$inst_prefix_dir"; then
3000 # Stick the inst_prefix_dir data into the link command.
3001 relink_command
=`$ECHO "$relink_command" | $SED "s%@inst_prefix_dir@%-inst-prefix-dir $inst_prefix_dir%"`
3003 relink_command
=`$ECHO "$relink_command" | $SED "s%@inst_prefix_dir@%%"`
3006 func_warning
"relinking \`$file'"
3007 func_show_eval
"$relink_command" \
3008 'func_fatal_error "error: relink \`$file'\'' with the above command before installing it"'
3011 # See the names of the shared library.
3012 set dummy
$library_names; shift
3013 if test -n "$1"; then
3018 test -n "$relink_command" && srcname
="$realname"T
3020 # Install the shared library and build the symlinks.
3021 func_show_eval
"$install_shared_prog $dir/$srcname $destdir/$realname" \
3025 cygwin
* | mingw
* | pw32
* | cegcc
*)
3033 if test -n "$tstripme" && test -n "$striplib"; then
3034 func_show_eval
"$striplib $destdir/$realname" 'exit $?'
3037 if test "$#" -gt 0; then
3038 # Delete the old symlinks, and create new ones.
3039 # Try `ln -sf' first, because the `ln' binary might depend on
3040 # the symlink we replace! Solaris /bin/ln does not understand -f,
3041 # so we also need to try rm && ln -s.
3044 test "$linkname" != "$realname" \
3045 && func_show_eval
"(cd $destdir && { $LN_S -f $realname $linkname || { $RM $linkname && $LN_S $realname $linkname; }; })"
3049 # Do each command in the postinstall commands.
3050 lib
="$destdir/$realname"
3051 func_execute_cmds
"$postinstall_cmds" 'exit $?'
3054 # Install the pseudo-library for information purposes.
3055 func_basename
"$file"
3056 name
="$func_basename_result"
3057 instname
="$dir/$name"i
3058 func_show_eval
"$install_prog $instname $destdir/$name" 'exit $?'
3060 # Maybe install the static library, too.
3061 test -n "$old_library" && func_append staticlibs
" $dir/$old_library"
3065 # Install (i.e. copy) a libtool object.
3067 # Figure out destination file name, if it wasn't already specified.
3068 if test -n "$destname"; then
3069 destfile
="$destdir/$destname"
3071 func_basename
"$file"
3072 destfile
="$func_basename_result"
3073 destfile
="$destdir/$destfile"
3076 # Deduce the name of the destination old-style object file.
3079 func_lo2o
"$destfile"
3080 staticdest
=$func_lo2o_result
3083 staticdest
="$destfile"
3087 func_fatal_help
"cannot copy a libtool object to \`$destfile'"
3091 # Install the libtool object if requested.
3092 test -n "$destfile" && \
3093 func_show_eval
"$install_prog $file $destfile" 'exit $?'
3095 # Install the old object if enabled.
3096 if test "$build_old_libs" = yes; then
3097 # Deduce the name of the old-style object file.
3099 staticobj
=$func_lo2o_result
3100 func_show_eval
"$install_prog \$staticobj \$staticdest" 'exit $?'
3106 # Figure out destination file name, if it wasn't already specified.
3107 if test -n "$destname"; then
3108 destfile
="$destdir/$destname"
3110 func_basename
"$file"
3111 destfile
="$func_basename_result"
3112 destfile
="$destdir/$destfile"
3115 # If the file is missing, and there is a .exe on the end, strip it
3116 # because it is most likely a libtool script we actually want to
3121 if test ! -f "$file"; then
3122 func_stripname
'' '.exe' "$file"
3123 file=$func_stripname_result
3129 # Do a test to see if this is really a libtool program.
3132 if func_ltwrapper_executable_p
"$file"; then
3133 func_ltwrapper_scriptname
"$file"
3134 wrapper
=$func_ltwrapper_scriptname_result
3136 func_stripname
'' '.exe' "$file"
3137 wrapper
=$func_stripname_result
3144 if func_ltwrapper_script_p
"$wrapper"; then
3148 func_source
"$wrapper"
3150 # Check the variables that should have been set.
3151 test -z "$generated_by_libtool_version" && \
3152 func_fatal_error
"invalid libtool wrapper script \`$wrapper'"
3155 for lib
in $notinst_deplibs; do
3156 # Check to see that each library is installed.
3158 if test -f "$lib"; then
3161 libfile
="$libdir/"`$ECHO "$lib" | $SED 's%^.*/%%g'` ### testsuite: skip nested quoting test
3162 if test -n "$libdir" && test ! -f "$libfile"; then
3163 func_warning
"\`$lib' has not been installed in \`$libdir'"
3169 func_source
"$wrapper"
3172 if test "$fast_install" = no
&& test -n "$relink_command"; then
3174 if test "$finalize" = yes; then
3175 tmpdir
=`func_mktempdir`
3176 func_basename
"$file$stripped_ext"
3177 file="$func_basename_result"
3178 outputname
="$tmpdir/$file"
3179 # Replace the output file specification.
3180 relink_command
=`$ECHO "$relink_command" | $SED 's%@OUTPUT@%'"$outputname"'%g'`
3183 func_quote_for_expand
"$relink_command"
3184 eval "func_echo $func_quote_for_expand_result"
3186 if eval "$relink_command"; then :
3188 func_error
"error: relink \`$file' with the above command before installing it"
3189 $opt_dry_run ||
${RM}r
"$tmpdir"
3194 func_warning
"cannot relink \`$file'"
3198 # Install the binary that we compiled earlier.
3199 file=`$ECHO "$file$stripped_ext" | $SED "s%\([^/]*\)$%$objdir/\1%"`
3203 # remove .exe since cygwin /usr/bin/install will append another
3205 case $install_prog,$host in
3206 */usr
/bin
/install*,*cygwin
*)
3207 case $file:$destfile in
3212 destfile
=$destfile.exe
3215 func_stripname
'' '.exe' "$destfile"
3216 destfile
=$func_stripname_result
3221 func_show_eval
"$install_prog\$stripme \$file \$destfile" 'exit $?'
3222 $opt_dry_run ||
if test -n "$outputname"; then
3229 for file in $staticlibs; do
3230 func_basename
"$file"
3231 name
="$func_basename_result"
3233 # Set up the ranlib parameters.
3234 oldlib
="$destdir/$name"
3235 func_to_tool_file
"$oldlib" func_convert_file_msys_to_w32
3236 tool_oldlib
=$func_to_tool_file_result
3238 func_show_eval
"$install_prog \$file \$oldlib" 'exit $?'
3240 if test -n "$stripme" && test -n "$old_striplib"; then
3241 func_show_eval
"$old_striplib $tool_oldlib" 'exit $?'
3244 # Do each command in the postinstall commands.
3245 func_execute_cmds
"$old_postinstall_cmds" 'exit $?'
3248 test -n "$future_libdirs" && \
3249 func_warning
"remember to run \`$progname --finish$future_libdirs'"
3251 if test -n "$current_libdirs"; then
3252 # Maybe just do a dry run.
3253 $opt_dry_run && current_libdirs
=" -n$current_libdirs"
3254 exec_cmd
='$SHELL $progpath $preserve_args --finish$current_libdirs'
3260 test "$opt_mode" = install && func_mode_install
${1+"$@"}
3263 # func_generate_dlsyms outputname originator pic_p
3264 # Extract symbols from dlprefiles and create ${outputname}S.o with
3265 # a dlpreopen symbol table.
3266 func_generate_dlsyms
()
3272 my_prefix
=`$ECHO "$my_originator" | sed 's%[^a-zA-Z0-9]%_%g'`
3275 if test -n "$dlfiles$dlprefiles" ||
test "$dlself" != no
; then
3276 if test -n "$NM" && test -n "$global_symbol_pipe"; then
3277 my_dlsyms
="${my_outputname}S.c"
3279 func_error
"not configured to extract global symbols from dlpreopened files"
3283 if test -n "$my_dlsyms"; then
3287 # Discover the nlist of each of the dlfiles.
3288 nlist
="$output_objdir/${my_outputname}.nm"
3290 func_show_eval
"$RM $nlist ${nlist}S ${nlist}T"
3292 # Parse the name list into a source file.
3293 func_verbose
"creating $output_objdir/$my_dlsyms"
3295 $opt_dry_run ||
$ECHO > "$output_objdir/$my_dlsyms" "\
3296 /* $my_dlsyms - symbol resolution table for \`$my_outputname' dlsym emulation. */
3297 /* Generated by $PROGRAM (GNU $PACKAGE$TIMESTAMP) $VERSION */
3303 #if defined(__GNUC__) && (((__GNUC__ == 4) && (__GNUC_MINOR__ >= 4)) || (__GNUC__ > 4))
3304 #pragma GCC diagnostic ignored \"-Wstrict-prototypes\"
3307 /* Keep this code in sync between libtool.m4, ltmain, lt_system.h, and tests. */
3308 #if defined(_WIN32) || defined(__CYGWIN__) || defined(_WIN32_WCE)
3309 /* DATA imports from DLLs on WIN32 con't be const, because runtime
3310 relocations are performed -- see ld's documentation on pseudo-relocs. */
3311 # define LT_DLSYM_CONST
3312 #elif defined(__osf__)
3313 /* This system does not cope well with relocations in const data. */
3314 # define LT_DLSYM_CONST
3316 # define LT_DLSYM_CONST const
3319 /* External symbol declarations for the compiler. */\
3322 if test "$dlself" = yes; then
3323 func_verbose
"generating symbol list for \`$output'"
3325 $opt_dry_run ||
echo ': @PROGRAM@ ' > "$nlist"
3327 # Add our own program objects to the symbol list.
3328 progfiles
=`$ECHO "$objs$old_deplibs" | $SP2NL | $SED "$lo2o" | $NL2SP`
3329 for progfile
in $progfiles; do
3330 func_to_tool_file
"$progfile" func_convert_file_msys_to_w32
3331 func_verbose
"extracting global C symbols from \`$func_to_tool_file_result'"
3332 $opt_dry_run ||
eval "$NM $func_to_tool_file_result | $global_symbol_pipe >> '$nlist'"
3335 if test -n "$exclude_expsyms"; then
3337 eval '$EGREP -v " ($exclude_expsyms)$" "$nlist" > "$nlist"T'
3338 eval '$MV "$nlist"T "$nlist"'
3342 if test -n "$export_symbols_regex"; then
3344 eval '$EGREP -e "$export_symbols_regex" "$nlist" > "$nlist"T'
3345 eval '$MV "$nlist"T "$nlist"'
3349 # Prepare the list of exported symbols
3350 if test -z "$export_symbols"; then
3351 export_symbols
="$output_objdir/$outputname.exp"
3354 eval "${SED} -n -e '/^: @PROGRAM@ $/d' -e 's/^.* \(.*\)$/\1/p' "'< "$nlist" > "$export_symbols"'
3356 *cygwin
* |
*mingw
* |
*cegcc
* )
3357 eval "echo EXPORTS "'> "$output_objdir/$outputname.def"'
3358 eval 'cat "$export_symbols" >> "$output_objdir/$outputname.def"'
3364 eval "${SED} -e 's/\([].[*^$]\)/\\\\\1/g' -e 's/^/ /' -e 's/$/$/'"' < "$export_symbols" > "$output_objdir/$outputname.exp"'
3365 eval '$GREP -f "$output_objdir/$outputname.exp" < "$nlist" > "$nlist"T'
3366 eval '$MV "$nlist"T "$nlist"'
3368 *cygwin
* |
*mingw
* |
*cegcc
* )
3369 eval "echo EXPORTS "'> "$output_objdir/$outputname.def"'
3370 eval 'cat "$nlist" >> "$output_objdir/$outputname.def"'
3377 for dlprefile
in $dlprefiles; do
3378 func_verbose
"extracting global C symbols from \`$dlprefile'"
3379 func_basename
"$dlprefile"
3380 name
="$func_basename_result"
3382 *cygwin
* |
*mingw
* |
*cegcc
* )
3383 # if an import library, we need to obtain dlname
3384 if func_win32_import_lib_p
"$dlprefile"; then
3385 func_tr_sh
"$dlprefile"
3386 eval "curr_lafile=\$libfile_$func_tr_sh_result"
3387 dlprefile_dlbasename
=""
3388 if test -n "$curr_lafile" && func_lalib_p
"$curr_lafile"; then
3389 # Use subshell, to avoid clobbering current variable values
3390 dlprefile_dlname
=`source "$curr_lafile" && echo "$dlname"`
3391 if test -n "$dlprefile_dlname" ; then
3392 func_basename
"$dlprefile_dlname"
3393 dlprefile_dlbasename
="$func_basename_result"
3395 # no lafile. user explicitly requested -dlpreopen <import library>.
3396 $sharedlib_from_linklib_cmd "$dlprefile"
3397 dlprefile_dlbasename
=$sharedlib_from_linklib_result
3401 if test -n "$dlprefile_dlbasename" ; then
3402 eval '$ECHO ": $dlprefile_dlbasename" >> "$nlist"'
3404 func_warning
"Could not compute DLL name from $name"
3405 eval '$ECHO ": $name " >> "$nlist"'
3407 func_to_tool_file
"$dlprefile" func_convert_file_msys_to_w32
3408 eval "$NM \"$func_to_tool_file_result\" 2>/dev/null | $global_symbol_pipe |
3409 $SED -e '/I __imp/d' -e 's/I __nm_/D /;s/_nm__//' >> '$nlist'"
3411 else # not an import lib
3413 eval '$ECHO ": $name " >> "$nlist"'
3414 func_to_tool_file
"$dlprefile" func_convert_file_msys_to_w32
3415 eval "$NM \"$func_to_tool_file_result\" 2>/dev/null | $global_symbol_pipe >> '$nlist'"
3421 eval '$ECHO ": $name " >> "$nlist"'
3422 func_to_tool_file
"$dlprefile" func_convert_file_msys_to_w32
3423 eval "$NM \"$func_to_tool_file_result\" 2>/dev/null | $global_symbol_pipe >> '$nlist'"
3430 # Make sure we have at least an empty file.
3431 test -f "$nlist" ||
: > "$nlist"
3433 if test -n "$exclude_expsyms"; then
3434 $EGREP -v " ($exclude_expsyms)$" "$nlist" > "$nlist"T
3435 $MV "$nlist"T
"$nlist"
3438 # Try sorting and uniquifying the output.
3439 if $GREP -v "^: " < "$nlist" |
3440 if sort -k 3 </dev
/null
>/dev
/null
2>&1; then
3445 uniq > "$nlist"S
; then
3448 $GREP -v "^: " < "$nlist" > "$nlist"S
3451 if test -f "$nlist"S
; then
3452 eval "$global_symbol_to_cdecl"' < "$nlist"S >> "$output_objdir/$my_dlsyms"'
3454 echo '/* NONE */' >> "$output_objdir/$my_dlsyms"
3457 echo >> "$output_objdir/$my_dlsyms" "\
3459 /* The mapping between symbol names and symbols. */
3464 extern LT_DLSYM_CONST lt_dlsymlist
3465 lt_${my_prefix}_LTX_preloaded_symbols[];
3466 LT_DLSYM_CONST lt_dlsymlist
3467 lt_${my_prefix}_LTX_preloaded_symbols[] =
3469 { \"$my_originator\", (void *) 0 },"
3471 case $need_lib_prefix in
3473 eval "$global_symbol_to_c_name_address" < "$nlist" >> "$output_objdir/$my_dlsyms"
3476 eval "$global_symbol_to_c_name_address_lib_prefix" < "$nlist" >> "$output_objdir/$my_dlsyms"
3479 echo >> "$output_objdir/$my_dlsyms" "\
3483 /* This works around a problem in FreeBSD linker */
3484 #ifdef FREEBSD_WORKAROUND
3485 static const void *lt_preloaded_setup() {
3486 return lt_${my_prefix}_LTX_preloaded_symbols;
3496 pic_flag_for_symtable
=
3497 case "$compile_command " in
3501 # compiling the symbol table file with pic_flag works around
3502 # a FreeBSD bug that causes programs to crash when -lm is
3503 # linked before any other PIC object. But we must not use
3504 # pic_flag when linking with -static. The problem exists in
3505 # FreeBSD 2.2.6 and is fixed in FreeBSD 3.1.
3506 *-*-freebsd2.
*|
*-*-freebsd3.0
*|
*-*-freebsdelf3.0
*)
3507 pic_flag_for_symtable
=" $pic_flag -DFREEBSD_WORKAROUND" ;;
3509 pic_flag_for_symtable
=" $pic_flag" ;;
3511 if test "X$my_pic_p" != Xno
; then
3512 pic_flag_for_symtable
=" $pic_flag"
3519 for arg
in $LTCFLAGS; do
3521 -pie |
-fpie |
-fPIE) ;;
3522 *) func_append symtab_cflags
" $arg" ;;
3526 # Now compile the dynamic symbol file.
3527 func_show_eval
'(cd $output_objdir && $LTCC$symtab_cflags -c$no_builtin_flag$pic_flag_for_symtable "$my_dlsyms")' 'exit $?'
3529 # Clean up the generated files.
3530 func_show_eval
'$RM "$output_objdir/$my_dlsyms" "$nlist" "${nlist}S" "${nlist}T"'
3532 # Transform the symbol file into the correct name.
3533 symfileobj
="$output_objdir/${my_outputname}S.$objext"
3535 *cygwin
* |
*mingw
* |
*cegcc
* )
3536 if test -f "$output_objdir/$my_outputname.def"; then
3537 compile_command
=`$ECHO "$compile_command" | $SED "s%@SYMFILE@%$output_objdir/$my_outputname.def $symfileobj%"`
3538 finalize_command
=`$ECHO "$finalize_command" | $SED "s%@SYMFILE@%$output_objdir/$my_outputname.def $symfileobj%"`
3540 compile_command
=`$ECHO "$compile_command" | $SED "s%@SYMFILE@%$symfileobj%"`
3541 finalize_command
=`$ECHO "$finalize_command" | $SED "s%@SYMFILE@%$symfileobj%"`
3545 compile_command
=`$ECHO "$compile_command" | $SED "s%@SYMFILE@%$symfileobj%"`
3546 finalize_command
=`$ECHO "$finalize_command" | $SED "s%@SYMFILE@%$symfileobj%"`
3551 # FreeBSD doesn't need this...
3554 func_fatal_error
"unknown suffix for \`$my_dlsyms'"
3558 # We keep going just in case the user didn't refer to
3559 # lt_preloaded_symbols. The linker will fail if global_symbol_pipe
3560 # really was required.
3562 # Nullify the symbol file.
3563 compile_command
=`$ECHO "$compile_command" | $SED "s% @SYMFILE@%%"`
3564 finalize_command
=`$ECHO "$finalize_command" | $SED "s% @SYMFILE@%%"`
3568 # func_win32_libid arg
3569 # return the library type of file 'arg'
3571 # Need a lot of goo to handle *both* DLLs and import libs
3572 # Has to be a shell function in order to 'eat' the argument
3573 # that is supplied when $file_magic_command is called.
3574 # Despite the name, also deal with 64 bit binaries.
3578 win32_libid_type
="unknown"
3579 win32_fileres
=`file -L $1 2>/dev/null`
3580 case $win32_fileres in
3581 *ar\ archive\ import\ library
*) # definitely import
3582 win32_libid_type
="x86 archive import"
3584 *ar\ archive
*) # could be an import, or static
3585 # Keep the egrep pattern in sync with the one in _LT_CHECK_MAGIC_METHOD.
3586 if eval $OBJDUMP -f $1 |
$SED -e '10q' 2>/dev
/null |
3587 $EGREP 'file format (pei*-i386(.*architecture: i386)?|pe-arm-wince|pe-x86-64)' >/dev
/null
; then
3588 func_to_tool_file
"$1" func_convert_file_msys_to_w32
3589 win32_nmres
=`eval $NM -f posix -A \"$func_to_tool_file_result\" |
3598 case $win32_nmres in
3599 import
*) win32_libid_type
="x86 archive import";;
3600 *) win32_libid_type
="x86 archive static";;
3605 win32_libid_type
="x86 DLL"
3607 *executable
*) # but shell scripts are "executable" too...
3608 case $win32_fileres in
3609 *MS\ Windows\ PE\ Intel
*)
3610 win32_libid_type
="x86 DLL"
3615 $ECHO "$win32_libid_type"
3618 # func_cygming_dll_for_implib ARG
3620 # Platform-specific function to extract the
3621 # name of the DLL associated with the specified
3622 # import library ARG.
3623 # Invoked by eval'ing the libtool variable
3624 # $sharedlib_from_linklib_cmd
3625 # Result is available in the variable
3626 # $sharedlib_from_linklib_result
3627 func_cygming_dll_for_implib
()
3630 sharedlib_from_linklib_result
=`$DLLTOOL --identify-strict --identify "$1"`
3633 # func_cygming_dll_for_implib_fallback_core SECTION_NAME LIBNAMEs
3635 # The is the core of a fallback implementation of a
3636 # platform-specific function to extract the name of the
3637 # DLL associated with the specified import library LIBNAME.
3639 # SECTION_NAME is either .idata$6 or .idata$7, depending
3640 # on the platform and compiler that created the implib.
3642 # Echos the name of the DLL associated with the
3643 # specified import library.
3644 func_cygming_dll_for_implib_fallback_core
()
3647 match_literal
=`$ECHO "$1" | $SED "$sed_make_literal_regex"`
3648 $OBJDUMP -s --section "$1" "$2" 2>/dev
/null |
3649 $SED '/^Contents of section '"$match_literal"':/{
3650 # Place marker at beginning of archive member dllname section
3655 # These lines can sometimes be longer than 43 characters, but
3656 # are always uninteresting
3657 /:[ ]*file format pe[i]\{,1\}-/d
3658 /^In archive [^:]*:/d
3659 # Ensure marker is printed
3661 # Remove all lines with less than 43 characters
3663 # From remaining lines, remove first 43 characters
3666 # Join marker and all lines until next marker into a single line
3667 /^====MARK====/ b para
3676 # Remove trailing dots and whitespace
3680 # we now have a list, one entry per line, of the stringified
3681 # contents of the appropriate section of all members of the
3682 # archive which possess that section. Heuristic: eliminate
3683 # all those which have a first or second character that is
3684 # a '.' (that is, objdump's representation of an unprintable
3685 # character.) This should work for all archives with less than
3686 # 0x302f exports -- but will fail for DLLs whose name actually
3687 # begins with a literal '.' or a single character followed by
3690 # Of those that remain, print the first one.
3691 $SED -e '/^\./d;/^.\./d;q'
3694 # func_cygming_gnu_implib_p ARG
3695 # This predicate returns with zero status (TRUE) if
3696 # ARG is a GNU/binutils-style import library. Returns
3697 # with nonzero status (FALSE) otherwise.
3698 func_cygming_gnu_implib_p
()
3701 func_to_tool_file
"$1" func_convert_file_msys_to_w32
3702 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)$'`
3703 test -n "$func_cygming_gnu_implib_tmp"
3706 # func_cygming_ms_implib_p ARG
3707 # This predicate returns with zero status (TRUE) if
3708 # ARG is an MS-style import library. Returns
3709 # with nonzero status (FALSE) otherwise.
3710 func_cygming_ms_implib_p
()
3713 func_to_tool_file
"$1" func_convert_file_msys_to_w32
3714 func_cygming_ms_implib_tmp
=`$NM "$func_to_tool_file_result" | eval "$global_symbol_pipe" | $GREP '_NULL_IMPORT_DESCRIPTOR'`
3715 test -n "$func_cygming_ms_implib_tmp"
3718 # func_cygming_dll_for_implib_fallback ARG
3719 # Platform-specific function to extract the
3720 # name of the DLL associated with the specified
3721 # import library ARG.
3723 # This fallback implementation is for use when $DLLTOOL
3724 # does not support the --identify-strict option.
3725 # Invoked by eval'ing the libtool variable
3726 # $sharedlib_from_linklib_cmd
3727 # Result is available in the variable
3728 # $sharedlib_from_linklib_result
3729 func_cygming_dll_for_implib_fallback
()
3732 if func_cygming_gnu_implib_p
"$1" ; then
3733 # binutils import library
3734 sharedlib_from_linklib_result
=`func_cygming_dll_for_implib_fallback_core '.idata$7' "$1"`
3735 elif func_cygming_ms_implib_p
"$1" ; then
3736 # ms-generated import library
3737 sharedlib_from_linklib_result
=`func_cygming_dll_for_implib_fallback_core '.idata$6' "$1"`
3740 sharedlib_from_linklib_result
=""
3745 # func_extract_an_archive dir oldlib
3746 func_extract_an_archive
()
3749 f_ex_an_ar_dir
="$1"; shift
3750 f_ex_an_ar_oldlib
="$1"
3751 if test "$lock_old_archive_extraction" = yes; then
3752 lockfile
=$f_ex_an_ar_oldlib.lock
3753 until $opt_dry_run ||
ln "$progpath" "$lockfile" 2>/dev
/null
; do
3754 func_echo
"Waiting for $lockfile to be removed"
3758 func_show_eval
"(cd \$f_ex_an_ar_dir && $AR x \"\$f_ex_an_ar_oldlib\")" \
3759 'stat=$?; rm -f "$lockfile"; exit $stat'
3760 if test "$lock_old_archive_extraction" = yes; then
3761 $opt_dry_run ||
rm -f "$lockfile"
3763 if ($AR t
"$f_ex_an_ar_oldlib" |
sort |
sort -uc >/dev
/null
2>&1); then
3766 func_fatal_error
"object name conflicts in archive: $f_ex_an_ar_dir/$f_ex_an_ar_oldlib"
3771 # func_extract_archives gentop oldlib ...
3772 func_extract_archives
()
3775 my_gentop
="$1"; shift
3776 my_oldlibs
=${1+"$@"}
3782 for my_xlib
in $my_oldlibs; do
3783 # Extract the objects.
3785 [\\/]* |
[A-Za-z
]:[\\/]*) my_xabs
="$my_xlib" ;;
3786 *) my_xabs
=`pwd`"/$my_xlib" ;;
3788 func_basename
"$my_xlib"
3789 my_xlib
="$func_basename_result"
3792 case " $extracted_archives " in
3794 func_arith
$extracted_serial + 1
3795 extracted_serial
=$func_arith_result
3796 my_xlib_u
=lt
$extracted_serial-$my_xlib ;;
3800 extracted_archives
="$extracted_archives $my_xlib_u"
3801 my_xdir
="$my_gentop/$my_xlib_u"
3803 func_mkdir_p
"$my_xdir"
3807 func_verbose
"Extracting $my_xabs"
3808 # Do not bother doing anything if just a dry run
3810 darwin_orig_dir
=`pwd`
3811 cd $my_xdir ||
exit $?
3812 darwin_archive
=$my_xabs
3814 darwin_base_archive
=`basename "$darwin_archive"`
3815 darwin_arches
=`$LIPO -info "$darwin_archive" 2>/dev/null | $GREP Architectures 2>/dev/null || true`
3816 if test -n "$darwin_arches"; then
3817 darwin_arches
=`$ECHO "$darwin_arches" | $SED -e 's/.*are://'`
3819 func_verbose
"$darwin_base_archive has multiple architectures $darwin_arches"
3820 for darwin_arch
in $darwin_arches ; do
3821 func_mkdir_p
"unfat-$$/${darwin_base_archive}-${darwin_arch}"
3822 $LIPO -thin $darwin_arch -output "unfat-$$/${darwin_base_archive}-${darwin_arch}/${darwin_base_archive}" "${darwin_archive}"
3823 cd "unfat-$$/${darwin_base_archive}-${darwin_arch}"
3824 func_extract_an_archive
"`pwd`" "${darwin_base_archive}"
3826 $RM "unfat-$$/${darwin_base_archive}-${darwin_arch}/${darwin_base_archive}"
3827 done # $darwin_arches
3828 ## Okay now we've a bunch of thin objects, gotta fatten them up :)
3829 darwin_filelist
=`find unfat-$$ -type f -name \*.o -print -o -name \*.lo -print | $SED -e "$basename" | sort -u`
3832 for darwin_file
in $darwin_filelist; do
3833 darwin_files
=`find unfat-$$ -name $darwin_file -print | sort | $NL2SP`
3834 $LIPO -create -output "$darwin_file" $darwin_files
3835 done # $darwin_filelist
3837 cd "$darwin_orig_dir"
3840 func_extract_an_archive
"$my_xdir" "$my_xabs"
3845 func_extract_an_archive
"$my_xdir" "$my_xabs"
3848 my_oldobjs
="$my_oldobjs "`find $my_xdir -name \*.$objext -print -o -name \*.lo -print | sort | $NL2SP`
3851 func_extract_archives_result
="$my_oldobjs"
3855 # func_emit_wrapper [arg=no]
3857 # Emit a libtool wrapper script on stdout.
3858 # Don't directly open a file because we may want to
3859 # incorporate the script contents within a cygwin/mingw
3860 # wrapper executable. Must ONLY be called from within
3861 # func_mode_link because it depends on a number of variables
3864 # ARG is the value that the WRAPPER_SCRIPT_BELONGS_IN_OBJDIR
3865 # variable will take. If 'yes', then the emitted script
3866 # will assume that the directory in which it is stored is
3867 # the $objdir directory. This is a cygwin/mingw-specific
3869 func_emit_wrapper
()
3871 func_emit_wrapper_arg1
=${1-no}
3876 # $output - temporary wrapper script for $objdir/$outputname
3877 # Generated by $PROGRAM (GNU $PACKAGE$TIMESTAMP) $VERSION
3879 # The $output program cannot be directly executed until all the libtool
3880 # libraries that it depends on are installed.
3882 # This wrapper script should never be moved out of the build directory.
3883 # If it is, it will not operate correctly.
3885 # Sed substitution that helps us do robust quoting. It backslashifies
3886 # metacharacters that are still active within double-quoted strings.
3887 sed_quote_subst='$sed_quote_subst'
3889 # Be Bourne compatible
3890 if test -n \"\${ZSH_VERSION+set}\" && (emulate sh) >/dev/null 2>&1; then
3893 # Zsh 3.x and 4.x performs word splitting on \${1+\"\$@\"}, which
3894 # is contrary to our usage. Disable this feature.
3895 alias -g '\${1+\"\$@\"}'='\"\$@\"'
3896 setopt NO_GLOB_SUBST
3898 case \`(set -o) 2>/dev/null\` in *posix*) set -o posix;; esac
3900 BIN_SH=xpg4; export BIN_SH # for Tru64
3901 DUALCASE=1; export DUALCASE # for MKS sh
3903 # The HP-UX ksh and POSIX shell print the target directory to stdout
3905 (unset CDPATH) >/dev/null 2>&1 && unset CDPATH
3907 relink_command=\"$relink_command\"
3909 # This environment variable determines our operation mode.
3910 if test \"\$libtool_install_magic\" = \"$magic\"; then
3911 # install mode needs the following variables:
3912 generated_by_libtool_version='$macro_version'
3913 notinst_deplibs='$notinst_deplibs'
3915 # When we are sourced in execute mode, \$file and \$ECHO are already set.
3916 if test \"\$libtool_execute_magic\" != \"$magic\"; then
3919 qECHO
=`$ECHO "$ECHO" | $SED "$sed_quote_subst"`
3922 # A function that is used when there is no print builtin or printf.
3923 func_fallback_echo ()
3925 eval 'cat <<_LTECHO_EOF
3932 # Very basic option parsing. These options are (a) specific to
3933 # the libtool wrapper, (b) are identical between the wrapper
3934 # /script/ and the wrapper /executable/ which is used only on
3935 # windows platforms, and (c) all begin with the string "--lt-"
3936 # (application programs are unlikely to have options which match
3939 # There are only two supported options: --lt-debug and
3940 # --lt-dump-script. There is, deliberately, no --lt-help.
3942 # The first argument to this parsing function should be the
3943 # script's $0 value, followed by "$@
".
3945 func_parse_lt_options ()
3951 case \"\$lt_opt\" in
3952 --lt-debug) lt_option_debug=1 ;;
3954 lt_dump_D=\`\$ECHO \"X\$lt_script_arg0\" | $SED -e 's/^X//' -e 's%/[^/]*$%%'\`
3955 test \"X\$lt_dump_D\" = \"X\$lt_script_arg0\" && lt_dump_D=.
3956 lt_dump_F=\`\$ECHO \"X\$lt_script_arg0\" | $SED -e 's/^X//' -e 's%^.*/%%'\`
3957 cat \"\$lt_dump_D/\$lt_dump_F\"
3961 \$ECHO \"Unrecognized --lt- option: '\$lt_opt'\" 1>&2
3967 # Print the debug banner immediately:
3968 if test -n \"\$lt_option_debug\"; then
3969 echo \"${outputname}:${output}:\${LINENO}: libtool wrapper (GNU $PACKAGE$TIMESTAMP) $VERSION\" 1>&2
3973 # Used when --lt-debug. Prints its arguments to stdout
3974 # (redirection is the responsibility of the caller)
3975 func_lt_dump_args ()
3980 \$ECHO \"${outputname}:${output}:\${LINENO}: newargv[\$lt_dump_args_N]: \$lt_arg\"
3981 lt_dump_args_N=\`expr \$lt_dump_args_N + 1\`
3985 # Core function for launching the target application
3986 func_exec_program_core ()
3990 # Backslashes separate directories on plain windows
3991 *-*-mingw |
*-*-os2* |
*-cegcc*)
3993 if test -n \"\$lt_option_debug\"; then
3994 \$ECHO \"${outputname}:${output}:\${LINENO}: newargv[0]: \$progdir\\\\\$program\" 1>&2
3995 func_lt_dump_args \${1+\"\$@\"} 1>&2
3997 exec \"\$progdir\\\\\$program\" \${1+\"\$@\"}
4003 if test -n \"\$lt_option_debug\"; then
4004 \$ECHO \"${outputname}:${output}:\${LINENO}: newargv[0]: \$progdir/\$program\" 1>&2
4005 func_lt_dump_args \${1+\"\$@\"} 1>&2
4007 exec \"\$progdir/\$program\" \${1+\"\$@\"}
4012 \$ECHO \"\$0: cannot exec \$program \$*\" 1>&2
4016 # A function to encapsulate launching the target application
4017 # Strips options in the --lt-* namespace from \$@ and
4018 # launches target application with the remaining arguments.
4019 func_exec_program ()
4027 *) set x \"\$@\" \"\$lt_wr_arg\"; shift;;
4032 func_exec_program_core \${1+\"\$@\"}
4036 func_parse_lt_options \"\$0\" \${1+\"\$@\"}
4038 # Find the directory that this script lives in.
4039 thisdir=\`\$ECHO \"\$file\" | $SED 's%/[^/]*$%%'\`
4040 test \"x\$thisdir\" = \"x\$file\" && thisdir=.
4042 # Follow symbolic links until we get to the real thisdir.
4043 file=\`ls -ld \"\$file\" | $SED -n 's/.*-> //p'\`
4044 while test -n \"\$file\"; do
4045 destdir=\`\$ECHO \"\$file\" | $SED 's%/[^/]*\$%%'\`
4047 # If there was a directory component, then change thisdir.
4048 if test \"x\$destdir\" != \"x\$file\"; then
4049 case \"\$destdir\" in
4050 [\\\\/]* | [A-Za-z]:[\\\\/]*) thisdir=\"\$destdir\" ;;
4051 *) thisdir=\"\$thisdir/\$destdir\" ;;
4055 file=\`\$ECHO \"\$file\" | $SED 's%^.*/%%'\`
4056 file=\`ls -ld \"\$thisdir/\$file\" | $SED -n 's/.*-> //p'\`
4059 # Usually 'no', except on cygwin/mingw when embedded into
4061 WRAPPER_SCRIPT_BELONGS_IN_OBJDIR=$func_emit_wrapper_arg1
4062 if test \"\$WRAPPER_SCRIPT_BELONGS_IN_OBJDIR\" = \"yes\"; then
4063 # special case for '.'
4064 if test \"\$thisdir\" = \".\"; then
4067 # remove .libs from thisdir
4068 case \"\$thisdir\" in
4069 *[\\\\/]$objdir ) thisdir=\`\$ECHO \"\$thisdir\" | $SED 's%[\\\\/][^\\\\/]*$%%'\` ;;
4070 $objdir ) thisdir=. ;;
4074 # Try to get the absolute directory name.
4075 absdir=\`cd \"\$thisdir\" && pwd\`
4076 test -n \"\$absdir\" && thisdir=\"\$absdir\"
4079 if test "$fast_install" = yes; then
4081 program=lt-'$outputname'$exeext
4082 progdir=\"\$thisdir/$objdir\"
4084 if test ! -f \"\$progdir/\$program\" ||
4085 { file=\`ls -1dt \"\$progdir/\$program\" \"\$progdir/../\$program\" 2>/dev/null | ${SED} 1q\`; \\
4086 test \"X\$file\" != \"X\$progdir/\$program\"; }; then
4088 file=\"\$\$-\$program\"
4090 if test ! -d \"\$progdir\"; then
4091 $MKDIR \"\$progdir\"
4093 $RM \"\$progdir/\$file\"
4098 # relink executable if necessary
4099 if test -n \"\$relink_command\"; then
4100 if relink_command_output=\`eval \$relink_command 2>&1\`; then :
4102 $ECHO \"\$relink_command_output\" >&2
4103 $RM \"\$progdir/\$file\"
4108 $MV \"\$progdir/\$file\" \"\$progdir/\$program\" 2>/dev/null ||
4109 { $RM \"\$progdir/\$program\";
4110 $MV \"\$progdir/\$file\" \"\$progdir/\$program\"; }
4111 $RM \"\$progdir/\$file\"
4115 program='$outputname'
4116 progdir=\"\$thisdir/$objdir\"
4122 if test -f \"\$progdir/\$program\"; then"
4124 # fixup the dll searchpath if we need to.
4126 # Fix the DLL searchpath if we need to. Do this before prepending
4127 # to shlibpath, because on Windows, both are PATH and uninstalled
4128 # libraries must come first.
4129 if test -n "$dllsearchpath"; then
4131 # Add the dll search path components to the executable PATH
4132 PATH=$dllsearchpath:\$PATH
4136 # Export our shlibpath_var if we have one.
4137 if test "$shlibpath_overrides_runpath" = yes && test -n "$shlibpath_var" && test -n "$temp_rpath"; then
4139 # Add our own library path to $shlibpath_var
4140 $shlibpath_var=\"$temp_rpath\$$shlibpath_var\"
4142 # Some systems cannot cope with colon-terminated $shlibpath_var
4143 # The second colon is a workaround for a bug in BeOS R4 sed
4144 $shlibpath_var=\`\$ECHO \"\$$shlibpath_var\" | $SED 's/::*\$//'\`
4146 export $shlibpath_var
4151 if test \"\$libtool_execute_magic\" != \"$magic\"; then
4152 # Run the actual program with our arguments.
4153 func_exec_program \${1+\"\$@\"}
4156 # The program doesn't exist.
4157 \$ECHO \"\$0: error: \\\`\$progdir/\$program' does not exist\" 1>&2
4158 \$ECHO \"This script is just a wrapper for \$program.\" 1>&2
4159 \$ECHO \"See the $PACKAGE documentation for more information.\" 1>&2
4167 # func_emit_cwrapperexe_src
4168 # emit the source code for a wrapper executable on stdout
4169 # Must ONLY be called from within func_mode_link because
4170 # it depends on a number of variable set therein.
4171 func_emit_cwrapperexe_src
()
4175 /* $cwrappersource - temporary wrapper executable for $objdir/$outputname
4176 Generated by $PROGRAM (GNU $PACKAGE$TIMESTAMP) $VERSION
4178 The $output program cannot be directly executed until all the libtool
4179 libraries that it depends on are installed.
4181 This wrapper executable should never be moved out of the build directory.
4182 If it is, it will not operate correctly.
4187 # define _CRT_SECURE_NO_DEPRECATE 1
4192 # include <direct.h>
4193 # include <process.h>
4196 # include <unistd.h>
4197 # include <stdint.h>
4209 #include <sys/stat.h>
4211 /* declarations of non-ANSI functions */
4212 #if defined(__MINGW32__)
4213 # ifdef __STRICT_ANSI__
4214 int _putenv (const char *);
4216 #elif defined(__CYGWIN__)
4217 # ifdef __STRICT_ANSI__
4218 char *realpath (const char *, char *);
4219 int putenv (char *);
4220 int setenv (const char *, const char *, int);
4222 /* #elif defined (other platforms) ... */
4225 /* portability defines, excluding path handling macros */
4226 #if defined(_MSC_VER)
4227 # define setmode _setmode
4229 # define chmod _chmod
4230 # define getcwd _getcwd
4231 # define putenv _putenv
4232 # define S_IXUSR _S_IEXEC
4233 # ifndef _INTPTR_T_DEFINED
4234 # define _INTPTR_T_DEFINED
4235 # define intptr_t int
4237 #elif defined(__MINGW32__)
4238 # define setmode _setmode
4240 # define chmod _chmod
4241 # define getcwd _getcwd
4242 # define putenv _putenv
4243 #elif defined(__CYGWIN__)
4244 # define HAVE_SETENV
4245 # define FOPEN_WB "wb"
4246 /* #elif defined (other platforms) ... */
4249 #if defined(PATH_MAX)
4250 # define LT_PATHMAX PATH_MAX
4251 #elif defined(MAXPATHLEN)
4252 # define LT_PATHMAX MAXPATHLEN
4254 # define LT_PATHMAX 1024
4264 /* path handling portability macros */
4265 #ifndef DIR_SEPARATOR
4266 # define DIR_SEPARATOR '/'
4267 # define PATH_SEPARATOR ':'
4270 #if defined (_WIN32) || defined (__MSDOS__) || defined (__DJGPP__) || \
4272 # define HAVE_DOS_BASED_FILE_SYSTEM
4273 # define FOPEN_WB "wb"
4274 # ifndef DIR_SEPARATOR_2
4275 # define DIR_SEPARATOR_2 '\\'
4277 # ifndef PATH_SEPARATOR_2
4278 # define PATH_SEPARATOR_2 ';'
4282 #ifndef DIR_SEPARATOR_2
4283 # define IS_DIR_SEPARATOR(ch) ((ch) == DIR_SEPARATOR)
4284 #else /* DIR_SEPARATOR_2 */
4285 # define IS_DIR_SEPARATOR(ch) \
4286 (((ch) == DIR_SEPARATOR) || ((ch) == DIR_SEPARATOR_2))
4287 #endif /* DIR_SEPARATOR_2 */
4289 #ifndef PATH_SEPARATOR_2
4290 # define IS_PATH_SEPARATOR(ch) ((ch) == PATH_SEPARATOR)
4291 #else /* PATH_SEPARATOR_2 */
4292 # define IS_PATH_SEPARATOR(ch) ((ch) == PATH_SEPARATOR_2)
4293 #endif /* PATH_SEPARATOR_2 */
4296 # define FOPEN_WB "w"
4299 # define _O_BINARY 0
4302 #define XMALLOC(type, num) ((type *) xmalloc ((num) * sizeof(type)))
4303 #define XFREE(stale) do { \
4304 if (stale) { free ((void *) stale); stale = 0; } \
4307 #if defined(LT_DEBUGWRAPPER)
4308 static int lt_debug = 1;
4310 static int lt_debug = 0;
4313 const char *program_name = "libtool-wrapper"; /* in case xstrdup fails */
4315 void *xmalloc (size_t num);
4316 char *xstrdup (const char *string);
4317 const char *base_name (const char *name);
4318 char *find_executable (const char *wrapper);
4319 char *chase_symlinks (const char *pathspec);
4320 int make_executable (const char *path);
4321 int check_executable (const char *path);
4322 char *strendzap (char *str, const char *pat);
4323 void lt_debugprintf (const char *file, int line, const char *fmt, ...);
4324 void lt_fatal (const char *file, int line, const char *message, ...);
4325 static const char *nonnull (const char *s);
4326 static const char *nonempty (const char *s);
4327 void lt_setenv (const char *name, const char *value);
4328 char *lt_extend_str (const char *orig_value, const char *add, int to_end);
4329 void lt_update_exe_path (const char *name, const char *value);
4330 void lt_update_lib_path (const char *name, const char *value);
4331 char **prepare_spawn (char **argv);
4332 void lt_dump_script (FILE *f);
4336 volatile const char * MAGIC_EXE = "$magic_exe";
4337 const char * LIB_PATH_VARNAME = "$shlibpath_var";
4340 if test "$shlibpath_overrides_runpath" = yes && test -n "$shlibpath_var" && test -n "$temp_rpath"; then
4341 func_to_host_path "$temp_rpath"
4343 const char * LIB_PATH_VALUE = "$func_to_host_path_result";
4347 const char
* LIB_PATH_VALUE
= "";
4351 if test -n "$dllsearchpath"; then
4352 func_to_host_path
"$dllsearchpath:"
4354 const char * EXE_PATH_VARNAME = "PATH";
4355 const char * EXE_PATH_VALUE = "$func_to_host_path_result";
4359 const char * EXE_PATH_VARNAME = "";
4360 const char * EXE_PATH_VALUE = "";
4364 if test "$fast_install" = yes; then
4366 const char * TARGET_PROGRAM_NAME = "lt-$outputname"; /* hopefully, no .exe */
4370 const char * TARGET_PROGRAM_NAME = "$outputname"; /* hopefully, no .exe */
4377 #define LTWRAPPER_OPTION_PREFIX "--lt-"
4379 static const char
*ltwrapper_option_prefix
= LTWRAPPER_OPTION_PREFIX
;
4380 static const char
*dumpscript_opt
= LTWRAPPER_OPTION_PREFIX
"dump-script";
4381 static const char
*debug_opt
= LTWRAPPER_OPTION_PREFIX
"debug";
4384 main
(int argc
, char
*argv
[])
4389 char
*actual_cwrapper_path
;
4390 char
*actual_cwrapper_name
;
4393 intptr_t rval
= 127;
4397 program_name
= (char
*) xstrdup
(base_name
(argv
[0]));
4398 newargz
= XMALLOC
(char
*, argc
+ 1);
4400 /* very simple arg parsing
; don
't want to rely on getopt
4401 * also, copy all non cwrapper options to newargz, except
4402 * argz[0], which is handled differently
4405 for (i = 1; i < argc; i++)
4407 if (strcmp (argv[i], dumpscript_opt) == 0)
4411 *mingw* | *cygwin* )
4412 # make stdout use "unix" line endings
4413 echo " setmode(1,_O_BINARY);"
4418 lt_dump_script (stdout);
4421 if (strcmp (argv[i], debug_opt) == 0)
4426 if (strcmp (argv[i], ltwrapper_option_prefix) == 0)
4428 /* however, if there is an option in the LTWRAPPER_OPTION_PREFIX
4429 namespace, but it is not one of the ones we know about and
4430 have already dealt with, above (inluding dump-script), then
4431 report an error. Otherwise, targets might begin to believe
4432 they are allowed to use options in the LTWRAPPER_OPTION_PREFIX
4433 namespace. The first time any user complains about this, we'll
4434 need to
make LTWRAPPER_OPTION_PREFIX a configure-time option
4435 or a configure.ac-settable value.
4437 lt_fatal
(__FILE__
, __LINE__
,
4438 "unrecognized %s option: '%s'",
4439 ltwrapper_option_prefix
, argv
[i
]);
4442 newargz
[++newargc
] = xstrdup
(argv
[i
]);
4444 newargz
[++newargc
] = NULL
;
4448 /* The GNU banner must be the first non-error debug message */
4449 lt_debugprintf (__FILE__, __LINE__, "libtool wrapper (GNU $PACKAGE$TIMESTAMP) $VERSION\n");
4452 lt_debugprintf (__FILE__, __LINE__, "(main) argv[0]: %s\n", argv[0]);
4453 lt_debugprintf (__FILE__, __LINE__, "(main) program_name: %s\n", program_name);
4455 tmp_pathspec = find_executable (argv[0]);
4456 if (tmp_pathspec == NULL)
4457 lt_fatal (__FILE__, __LINE__, "couldn't find %s", argv[0]);
4458 lt_debugprintf (__FILE__, __LINE__,
4459 "(main) found exe (before symlink chase) at: %s\n",
4462 actual_cwrapper_path = chase_symlinks (tmp_pathspec);
4463 lt_debugprintf (__FILE__, __LINE__,
4464 "(main) found exe (after symlink chase) at: %s\n",
4465 actual_cwrapper_path);
4466 XFREE (tmp_pathspec);
4468 actual_cwrapper_name = xstrdup (base_name (actual_cwrapper_path));
4469 strendzap (actual_cwrapper_path, actual_cwrapper_name);
4471 /* wrapper name transforms */
4472 strendzap (actual_cwrapper_name, ".exe");
4473 tmp_pathspec = lt_extend_str (actual_cwrapper_name, ".exe", 1);
4474 XFREE (actual_cwrapper_name);
4475 actual_cwrapper_name = tmp_pathspec;
4478 /* target_name transforms -- use actual target program name; might have lt- prefix */
4479 target_name = xstrdup (base_name (TARGET_PROGRAM_NAME));
4480 strendzap (target_name, ".exe");
4481 tmp_pathspec = lt_extend_str (target_name, ".exe", 1);
4482 XFREE (target_name);
4483 target_name = tmp_pathspec;
4486 lt_debugprintf (__FILE__, __LINE__,
4487 "(main) libtool target name: %s\n",
4493 XMALLOC (char, (strlen (actual_cwrapper_path) +
4494 strlen ("$objdir") + 1 + strlen (actual_cwrapper_name) + 1));
4495 strcpy (newargz[0], actual_cwrapper_path);
4496 strcat (newargz[0], "$objdir");
4497 strcat (newargz[0], "/");
4501 /* stop here
, and copy so we don
't have to do this twice */
4502 tmp_pathspec = xstrdup (newargz[0]);
4504 /* do NOT want the lt- prefix here, so use actual_cwrapper_name */
4505 strcat (newargz[0], actual_cwrapper_name);
4507 /* DO want the lt- prefix here if it exists, so use target_name */
4508 lt_argv_zero = lt_extend_str (tmp_pathspec, target_name, 1);
4509 XFREE (tmp_pathspec);
4510 tmp_pathspec = NULL;
4518 while ((p = strchr (newargz[0], '\\')) != NULL)
4522 while ((p = strchr (lt_argv_zero, '\\')) != NULL)
4532 XFREE (target_name);
4533 XFREE (actual_cwrapper_path);
4534 XFREE (actual_cwrapper_name);
4536 lt_setenv ("BIN_SH", "xpg4"); /* for Tru64 */
4537 lt_setenv ("DUALCASE", "1"); /* for MSK sh */
4538 /* Update the DLL searchpath. EXE_PATH_VALUE ($dllsearchpath) must
4539 be prepended before (that is, appear after) LIB_PATH_VALUE ($temp_rpath)
4540 because on Windows, both *_VARNAMEs are PATH but uninstalled
4541 libraries must come first. */
4542 lt_update_exe_path (EXE_PATH_VARNAME, EXE_PATH_VALUE);
4543 lt_update_lib_path (LIB_PATH_VARNAME, LIB_PATH_VALUE);
4545 lt_debugprintf (__FILE__, __LINE__, "(main) lt_argv_zero: %s\n",
4546 nonnull (lt_argv_zero));
4547 for (i = 0; i < newargc; i++)
4549 lt_debugprintf (__FILE__, __LINE__, "(main) newargz[%d]: %s\n",
4550 i, nonnull (newargz[i]));
4558 /* execv doesn't actually work on mingw as expected on unix
*/
4559 newargz
= prepare_spawn
(newargz
);
4560 rval
= _spawnv
(_P_WAIT
, lt_argv_zero
, (const char
* const
*) newargz
);
4563 /* failed to start process
*/
4564 lt_debugprintf
(__FILE__
, __LINE__
,
4565 "(main) failed to launch target \"%s\": %s\n",
4566 lt_argv_zero
, nonnull
(strerror
(errno
)));
4574 execv (lt_argv_zero, newargz);
4575 return rval; /* =127, but avoids unused variable warning */
4584 xmalloc
(size_t num
)
4586 void
*p
= (void
*) malloc
(num
);
4588 lt_fatal
(__FILE__
, __LINE__
, "memory exhausted");
4594 xstrdup
(const char
*string
)
4596 return string ? strcpy
((char
*) xmalloc
(strlen
(string
) + 1),
4601 base_name
(const char
*name
)
4605 #if defined (HAVE_DOS_BASED_FILE_SYSTEM)
4606 /* Skip over the disk name
in MSDOS pathnames.
*/
4607 if (isalpha
((unsigned char
) name
[0]) && name
[1] == ':')
4611 for (base
= name
; *name
; name
++)
4612 if (IS_DIR_SEPARATOR
(*name
))
4618 check_executable
(const char
*path
)
4622 lt_debugprintf
(__FILE__
, __LINE__
, "(check_executable): %s\n",
4624 if ((!path
) ||
(!*path
))
4627 if ((stat
(path
, &st
) >= 0)
4628 && (st.st_mode
& (S_IXUSR | S_IXGRP | S_IXOTH
)))
4635 make_executable
(const char
*path
)
4640 lt_debugprintf
(__FILE__
, __LINE__
, "(make_executable): %s\n",
4642 if ((!path
) ||
(!*path
))
4645 if (stat
(path
, &st
) >= 0)
4647 rval
= chmod (path
, st.st_mode | S_IXOTH | S_IXGRP | S_IXUSR
);
4652 /* Searches
for the full path of the wrapper. Returns
4653 newly allocated full path name
if found
, NULL otherwise
4654 Does not chase symlinks
, even on platforms that support them.
4657 find_executable
(const char
*wrapper
)
4662 /* static buffer
for getcwd
*/
4663 char tmp
[LT_PATHMAX
+ 1];
4667 lt_debugprintf
(__FILE__
, __LINE__
, "(find_executable): %s\n",
4668 nonempty
(wrapper
));
4670 if ((wrapper
== NULL
) ||
(*wrapper
== '\0'))
4673 /* Absolute path?
*/
4674 #if defined (HAVE_DOS_BASED_FILE_SYSTEM)
4675 if (isalpha
((unsigned char
) wrapper
[0]) && wrapper
[1] == ':')
4677 concat_name
= xstrdup
(wrapper
);
4678 if (check_executable
(concat_name
))
4680 XFREE
(concat_name
);
4685 if (IS_DIR_SEPARATOR
(wrapper
[0]))
4687 concat_name
= xstrdup
(wrapper
);
4688 if (check_executable
(concat_name
))
4690 XFREE
(concat_name
);
4692 #if defined (HAVE_DOS_BASED_FILE_SYSTEM)
4696 for (p
= wrapper
; *p
; p
++)
4704 /* no slashes
; search PATH
*/
4705 const char
*path
= getenv
("PATH");
4708 for (p
= path
; *p
; p
= p_next
)
4712 for (q
= p
; *q
; q
++)
4713 if (IS_PATH_SEPARATOR
(*q
))
4716 p_next
= (*q
== '\0' ? q
: q
+ 1);
4719 /* empty path
: current directory
*/
4720 if (getcwd
(tmp
, LT_PATHMAX
) == NULL
)
4721 lt_fatal
(__FILE__
, __LINE__
, "getcwd failed: %s",
4722 nonnull
(strerror
(errno
)));
4723 tmp_len
= strlen
(tmp
);
4725 XMALLOC
(char
, tmp_len
+ 1 + strlen
(wrapper
) + 1);
4726 memcpy
(concat_name
, tmp
, tmp_len
);
4727 concat_name
[tmp_len
] = '/';
4728 strcpy
(concat_name
+ tmp_len
+ 1, wrapper
);
4733 XMALLOC
(char
, p_len
+ 1 + strlen
(wrapper
) + 1);
4734 memcpy
(concat_name
, p
, p_len
);
4735 concat_name
[p_len
] = '/';
4736 strcpy
(concat_name
+ p_len
+ 1, wrapper
);
4738 if (check_executable
(concat_name
))
4740 XFREE
(concat_name
);
4743 /* not found
in PATH
; assume curdir
*/
4745 /* Relative path | not found
in path
: prepend cwd
*/
4746 if (getcwd
(tmp
, LT_PATHMAX
) == NULL
)
4747 lt_fatal
(__FILE__
, __LINE__
, "getcwd failed: %s",
4748 nonnull
(strerror
(errno
)));
4749 tmp_len
= strlen
(tmp
);
4750 concat_name
= XMALLOC
(char
, tmp_len
+ 1 + strlen
(wrapper
) + 1);
4751 memcpy
(concat_name
, tmp
, tmp_len
);
4752 concat_name
[tmp_len
] = '/';
4753 strcpy
(concat_name
+ tmp_len
+ 1, wrapper
);
4755 if (check_executable
(concat_name
))
4757 XFREE
(concat_name
);
4762 chase_symlinks
(const char
*pathspec
)
4765 return xstrdup
(pathspec
);
4767 char buf
[LT_PATHMAX
];
4769 char
*tmp_pathspec
= xstrdup
(pathspec
);
4771 int has_symlinks
= 0;
4772 while (strlen
(tmp_pathspec
) && !has_symlinks
)
4774 lt_debugprintf
(__FILE__
, __LINE__
,
4775 "checking path component for symlinks: %s\n",
4777 if (lstat
(tmp_pathspec
, &s
) == 0)
4779 if (S_ISLNK
(s.st_mode
) != 0)
4785 /* search backwards
for last DIR_SEPARATOR
*/
4786 p
= tmp_pathspec
+ strlen
(tmp_pathspec
) - 1;
4787 while ((p
> tmp_pathspec
) && (!IS_DIR_SEPARATOR
(*p
)))
4789 if ((p
== tmp_pathspec
) && (!IS_DIR_SEPARATOR
(*p
)))
4791 /* no
more DIR_SEPARATORS left
*/
4798 lt_fatal
(__FILE__
, __LINE__
,
4799 "error accessing file \"%s\": %s",
4800 tmp_pathspec
, nonnull
(strerror
(errno
)));
4803 XFREE
(tmp_pathspec
);
4807 return xstrdup
(pathspec
);
4810 tmp_pathspec
= realpath
(pathspec
, buf
);
4811 if (tmp_pathspec
== 0)
4813 lt_fatal
(__FILE__
, __LINE__
,
4814 "could not follow symlinks for %s", pathspec
);
4816 return xstrdup
(tmp_pathspec
);
4821 strendzap
(char
*str
, const char
*pat
)
4825 assert
(str
!= NULL
);
4826 assert
(pat
!= NULL
);
4829 patlen
= strlen
(pat
);
4833 str
+= len
- patlen
;
4834 if (strcmp
(str
, pat
) == 0)
4841 lt_debugprintf
(const char
*file, int line
, const char
*fmt, ...
)
4846 (void
) fprintf
(stderr
, "%s:%s:%d: ", program_name
, file, line
);
4847 va_start
(args
, fmt);
4848 (void
) vfprintf
(stderr
, fmt, args
);
4854 lt_error_core
(int exit_status
, const char
*file,
4855 int line
, const char
*mode
,
4856 const char
*message
, va_list ap
)
4858 fprintf
(stderr
, "%s:%s:%d: %s: ", program_name
, file, line
, mode
);
4859 vfprintf
(stderr
, message
, ap
);
4860 fprintf
(stderr
, ".\n");
4862 if (exit_status
>= 0)
4867 lt_fatal
(const char
*file, int line
, const char
*message
, ...
)
4870 va_start
(ap
, message
);
4871 lt_error_core
(EXIT_FAILURE
, file, line
, "FATAL", message
, ap
);
4876 nonnull
(const char
*s
)
4878 return s ? s
: "(null)";
4882 nonempty
(const char
*s
)
4884 return (s
&& !*s
) ?
"(empty)" : nonnull
(s
);
4888 lt_setenv
(const char
*name
, const char
*value
)
4890 lt_debugprintf
(__FILE__
, __LINE__
,
4891 "(lt_setenv) setting '%s' to '%s'\n",
4892 nonnull
(name
), nonnull
(value
));
4895 /* always
make a copy
, for consistency with
!HAVE_SETENV
*/
4896 char
*str
= xstrdup
(value
);
4897 setenv
(name
, str
, 1);
4899 int len
= strlen
(name
) + 1 + strlen
(value
) + 1;
4900 char
*str
= XMALLOC
(char
, len
);
4901 sprintf
(str
, "%s=%s", name
, value
);
4902 if (putenv
(str
) != EXIT_SUCCESS
)
4911 lt_extend_str
(const char
*orig_value
, const char
*add
, int to_end
)
4914 if (orig_value
&& *orig_value
)
4916 int orig_value_len
= strlen
(orig_value
);
4917 int add_len
= strlen
(add
);
4918 new_value
= XMALLOC
(char
, add_len
+ orig_value_len
+ 1);
4921 strcpy
(new_value
, orig_value
);
4922 strcpy
(new_value
+ orig_value_len
, add
);
4926 strcpy
(new_value
, add
);
4927 strcpy
(new_value
+ add_len
, orig_value
);
4932 new_value
= xstrdup
(add
);
4938 lt_update_exe_path
(const char
*name
, const char
*value
)
4940 lt_debugprintf
(__FILE__
, __LINE__
,
4941 "(lt_update_exe_path) modifying '%s' by prepending '%s'\n",
4942 nonnull
(name
), nonnull
(value
));
4944 if (name
&& *name
&& value
&& *value
)
4946 char
*new_value
= lt_extend_str
(getenv
(name
), value
, 0);
4947 /* some systems can
't cope with a ':'-terminated path #' */
4948 int len
= strlen
(new_value
);
4949 while (((len
= strlen
(new_value
)) > 0) && IS_PATH_SEPARATOR
(new_value
[len-1
]))
4951 new_value
[len-1
] = '\0';
4953 lt_setenv
(name
, new_value
);
4959 lt_update_lib_path
(const char
*name
, const char
*value
)
4961 lt_debugprintf
(__FILE__
, __LINE__
,
4962 "(lt_update_lib_path) modifying '%s' by prepending '%s'\n",
4963 nonnull
(name
), nonnull
(value
));
4965 if (name
&& *name
&& value
&& *value
)
4967 char
*new_value
= lt_extend_str
(getenv
(name
), value
, 0);
4968 lt_setenv
(name
, new_value
);
4978 /* Prepares an argument vector before calling spawn().
4979 Note that spawn() does not by itself call the command interpreter
4980 (getenv ("COMSPEC") != NULL ? getenv ("COMSPEC") :
4981 ({ OSVERSIONINFO v; v.dwOSVersionInfoSize = sizeof(OSVERSIONINFO);
4983 v.dwPlatformId == VER_PLATFORM_WIN32_NT;
4984 }) ? "cmd.exe" : "command.com").
4985 Instead it simply concatenates the arguments, separated by ' ', and calls
4986 CreateProcess(). We must quote the arguments since Win32 CreateProcess()
4987 interprets characters like ' ', '\t', '\\', '"' (but not '<' and '>') in a
4989 - Space and tab are interpreted as delimiters. They are not treated as
4990 delimiters if they are surrounded by double quotes: "...".
4991 - Unescaped double quotes are removed from the input. Their only effect is
4992 that within double quotes, space and tab are treated like normal
4994 - Backslashes not followed by double quotes are not special.
4995 - But 2*n+1 backslashes followed by a double quote become
4996 n backslashes followed by a double quote (n >= 0):
5001 #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"
5002 #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"
5004 prepare_spawn (char **argv)
5010 /* Count number of arguments. */
5011 for (argc = 0; argv[argc] != NULL; argc++)
5014 /* Allocate new argument vector. */
5015 new_argv = XMALLOC (char *, argc + 1);
5017 /* Put quoted arguments into the new argument vector. */
5018 for (i = 0; i < argc; i++)
5020 const char *string = argv[i];
5022 if (string[0] == '\0')
5023 new_argv[i] = xstrdup ("\"\"");
5024 else if (strpbrk (string, SHELL_SPECIAL_CHARS) != NULL)
5026 int quote_around = (strpbrk (string, SHELL_SPACE_CHARS) != NULL);
5028 unsigned int backslashes;
5030 char *quoted_string;
5037 for (s = string; *s != '\0'; s++)
5041 length += backslashes + 1;
5049 length += backslashes + 1;
5051 quoted_string = XMALLOC (char, length + 1);
5057 for (s = string; *s != '\0'; s++)
5063 for (j = backslashes + 1; j > 0; j--)
5075 for (j = backslashes; j > 0; j--)
5081 new_argv[i] = quoted_string;
5084 new_argv[i] = (char *) string;
5086 new_argv[argc] = NULL;
5095 void lt_dump_script
(FILE
* f
)
5098 func_emit_wrapper
yes |
5100 s/^\(.\{79\}\)\(..*\)/\1\
5105 s/\([^\n]*\).*/ fputs ("\1", f);/p
5112 # end: func_emit_cwrapperexe_src
5114 # func_win32_import_lib_p ARG
5115 # True if ARG is an import lib, as indicated by $file_magic_cmd
5116 func_win32_import_lib_p ()
5119 case `eval $file_magic_cmd \"\$1\" 2>/dev/null | $SED -e 10q` in
5125 # func_mode_link arg...
5130 *-*-cygwin* | *-*-mingw* | *-*-pw32* | *-*-os2* | *-cegcc*)
5131 # It is impossible to link a dll without this setting, and
5132 # we shouldn't force the makefile maintainer to figure out
5133 # which system we are compiling for in order to pass an extra
5134 # flag for every libtool invocation.
5135 # allow_undefined=no
5137 # FIXME: Unfortunately, there are problems with the above when trying
5138 # to make a dll which has undefined symbols, in which case not
5139 # even a static library is built. For now, we need to specify
5140 # -no-undefined on the libtool link line when we can be certain
5141 # that all symbols are satisfied, otherwise we get a static library.
5148 libtool_args=$nonopt
5149 base_compile="$nonopt $@"
5150 compile_command=$nonopt
5151 finalize_command=$nonopt
5164 lib_search_path=`pwd`
5166 new_inherited_linker_flags=
5175 export_symbols_regex=
5183 precious_files_regex=
5184 prefer_static_libs=no
5197 single_module="${wl}-single_module"
5198 func_infer_tag $base_compile
5200 # We need to know -static, to get the right output filenames.
5205 test "$build_libtool_libs" != yes && \
5206 func_fatal_configuration "can not build a shared library"
5210 -all-static | -static | -static-libtool-libs)
5213 if test "$build_libtool_libs" = yes && test -z "$link_static_flag"; then
5214 func_warning "complete static linking is impossible in this configuration"
5216 if test -n "$link_static_flag"; then
5217 dlopen_self=$dlopen_self_static
5219 prefer_static_libs=yes
5222 if test -z "$pic_flag" && test -n "$link_static_flag"; then
5223 dlopen_self=$dlopen_self_static
5225 prefer_static_libs=built
5227 -static-libtool-libs)
5228 if test -z "$pic_flag" && test -n "$link_static_flag"; then
5229 dlopen_self=$dlopen_self_static
5231 prefer_static_libs=yes
5234 build_libtool_libs=no
5241 # See if our shared archives depend on static archives.
5242 test -n "$old_archive_from_new_cmds" && build_old_libs=yes
5244 # Go through the arguments, transforming them on the way.
5245 while test "$#" -gt 0; do
5248 func_quote_for_eval "$arg"
5249 qarg=$func_quote_for_eval_unquoted_result
5250 func_append libtool_args " $func_quote_for_eval_result"
5252 # If the previous option needs an argument, assign it.
5253 if test -n "$prev"; then
5256 func_append compile_command " @OUTPUT@"
5257 func_append finalize_command " @OUTPUT@"
5268 if test "$preload" = no; then
5269 # Add the symbol object into the linking commands.
5270 func_append compile_command " @SYMFILE@"
5271 func_append finalize_command " @SYMFILE@"
5275 *.la | *.lo) ;; # We handle these cases below.
5277 if test "$dlself" = no; then
5285 if test "$prev" = dlprefiles; then
5287 elif test "$prev" = dlfiles && test "$dlopen_self" != yes; then
5297 if test "$prev" = dlfiles; then
5298 func_append dlfiles " $arg"
5300 func_append dlprefiles " $arg"
5308 export_symbols="$arg"
5310 || func_fatal_error "symbol file \`$arg' does not exist"
5315 export_symbols_regex="$arg"
5323 *" $qarg.ltframework "*) ;;
5324 *) func_append deplibs " $qarg.ltframework" # this is fixed later
5333 inst_prefix_dir="$arg"
5338 if test -f "$arg"; then
5341 for fil in `cat "$save_arg"`
5343 # func_append moreargs " $fil"
5345 # A libtool-controlled object.
5347 # Check to see that this really is a libtool object.
5348 if func_lalib_unsafe_p "$arg"; then
5355 if test -z "$pic_object" ||
5356 test -z "$non_pic_object" ||
5357 test "$pic_object" = none &&
5358 test "$non_pic_object" = none; then
5359 func_fatal_error "cannot find name of object for \`$arg'"
5362 # Extract subdirectory from the argument.
5363 func_dirname "$arg" "/" ""
5364 xdir="$func_dirname_result"
5366 if test "$pic_object" != none; then
5367 # Prepend the subdirectory the object is found in.
5368 pic_object="$xdir$pic_object"
5370 if test "$prev" = dlfiles; then
5371 if test "$build_libtool_libs" = yes && test "$dlopen_support" = yes; then
5372 func_append dlfiles " $pic_object"
5376 # If libtool objects are unsupported, then we need to preload.
5381 # CHECK ME: I think I busted this. -Ossama
5382 if test "$prev" = dlprefiles; then
5383 # Preload the old-style object.
5384 func_append dlprefiles " $pic_object"
5389 func_append libobjs " $pic_object"
5394 if test "$non_pic_object" != none; then
5395 # Prepend the subdirectory the object is found in.
5396 non_pic_object="$xdir$non_pic_object"
5398 # A standard non-PIC object
5399 func_append non_pic_objects " $non_pic_object"
5400 if test -z "$pic_object" || test "$pic_object" = none ; then
5401 arg="$non_pic_object"
5404 # If the PIC object exists, use it instead.
5405 # $xdir was prepended to $pic_object above.
5406 non_pic_object="$pic_object"
5407 func_append non_pic_objects " $non_pic_object"
5410 # Only an error if not doing a dry-run.
5411 if $opt_dry_run; then
5412 # Extract subdirectory from the argument.
5413 func_dirname "$arg" "/" ""
5414 xdir="$func_dirname_result"
5417 pic_object=$xdir$objdir/$func_lo2o_result
5418 non_pic_object=$xdir$func_lo2o_result
5419 func_append libobjs " $pic_object"
5420 func_append non_pic_objects " $non_pic_object"
5422 func_fatal_error "\`$arg' is not a valid libtool object"
5427 func_fatal_error "link input file \`$arg' does not exist"
5434 precious_files_regex="$arg"
5444 # We need an absolute path.
5446 [\\/]* | [A-Za-z]:[\\/]*) ;;
5448 func_fatal_error "only absolute run-paths are allowed"
5451 if test "$prev" = rpath; then
5454 *) func_append rpath " $arg" ;;
5459 *) func_append xrpath " $arg" ;;
5471 func_append weak_libs " $arg"
5476 func_append linker_flags " $qarg"
5477 func_append compiler_flags " $qarg"
5479 func_append compile_command " $qarg"
5480 func_append finalize_command " $qarg"
5484 func_append compiler_flags " $qarg"
5486 func_append compile_command " $qarg"
5487 func_append finalize_command " $qarg"
5491 func_append linker_flags " $qarg"
5492 func_append compiler_flags " $wl$qarg"
5494 func_append compile_command " $wl$qarg"
5495 func_append finalize_command " $wl$qarg"
5499 eval "$prev=\"\$arg\""
5504 fi # test -n "$prev"
5510 if test -n "$link_static_flag"; then
5511 # See comment for -static flag below, for more details.
5512 func_append compile_command " $link_static_flag"
5513 func_append finalize_command " $link_static_flag"
5519 # FIXME: remove this flag sometime in the future.
5520 func_fatal_error "\`-allow-undefined' must not be used because it is the default"
5548 -export-symbols | -export-symbols-regex)
5549 if test -n "$export_symbols" || test -n "$export_symbols_regex"; then
5550 func_fatal_error "more than one -exported-symbols argument is not allowed"
5552 if test "X$arg" = "X-export-symbols"; then
5570 # The native IRIX linker understands -LANG:*, -LIST:* and -LNO:*
5571 # so, if we see these flags be careful not to treat them like -L
5573 case $with_gcc/$host in
5574 no/*-*-irix* | /*-*-irix*)
5575 func_append compile_command " $arg"
5576 func_append finalize_command " $arg"
5583 func_stripname "-L" '' "$arg"
5584 if test -z "$func_stripname_result"; then
5585 if test "$#" -gt 0; then
5586 func_fatal_error "require no space between \`-L' and \`$1'"
5588 func_fatal_error "need path for \`-L' option"
5591 func_resolve_sysroot "$func_stripname_result"
5592 dir=$func_resolve_sysroot_result
5593 # We need an absolute path.
5595 [\\/]* | [A-Za-z]:[\\/]*) ;;
5597 absdir=`cd "$dir" && pwd`
5598 test -z "$absdir" && \
5599 func_fatal_error "cannot determine absolute directory name of \`$dir'"
5604 *" -L$dir "* | *" $arg "*)
5605 # Will only happen for absolute or sysroot arguments
5608 # Preserve sysroot, but never include relative directories
5610 [\\/]* | [A-Za-z]:[\\/]* | =*) func_append deplibs " $arg" ;;
5611 *) func_append deplibs " -L$dir" ;;
5613 func_append lib_search_path " $dir"
5617 *-*-cygwin* | *-*-mingw* | *-*-pw32* | *-*-os2* | *-cegcc*)
5618 testbindir=`$ECHO "$dir" | $SED 's*/lib$*/bin*'`
5619 case :$dllsearchpath: in
5621 ::) dllsearchpath=$dir;;
5622 *) func_append dllsearchpath ":$dir";;
5624 case :$dllsearchpath: in
5625 *":$testbindir:"*) ;;
5626 ::) dllsearchpath=$testbindir;;
5627 *) func_append dllsearchpath ":$testbindir";;
5631 deplibs="$deplibs $arg"
5636 if test "X$arg" = "X-lc" || test "X$arg" = "X-lm"; then
5638 *-*-cygwin* | *-*-mingw* | *-*-pw32* | *-*-beos* | *-cegcc* | *-*-haiku*)
5639 # These systems don't actually have a C or math library (as such)
5643 # These systems don't actually have a C library (as such)
5644 test "X$arg" = "X-lc" && continue
5646 *-*-openbsd* | *-*-freebsd* | *-*-dragonfly*)
5647 # Do not include libc due to us having libc/libc_r.
5648 test "X$arg" = "X-lc" && continue
5650 *-*-rhapsody* | *-*-darwin1.[012])
5651 # Rhapsody C and math libraries are in the System framework
5652 func_append deplibs " System.ltframework"
5655 *-*-sco3.2v5* | *-*-sco5v6*)
5656 # Causes problems with __ctype
5657 test "X$arg" = "X-lc" && continue
5659 *-*-sysv4.2uw2* | *-*-sysv5* | *-*-unixware* | *-*-OpenUNIX*)
5660 # Compiler inserts libc in the correct place for threads to work
5661 test "X$arg" = "X-lc" && continue
5664 elif test "X$arg" = "X-lc_r"; then
5666 *-*-openbsd* | *-*-freebsd* | *-*-dragonfly*)
5667 # Do not include libc_r directly, use -pthread flag.
5672 func_append deplibs " $arg"
5681 # Tru64 UNIX uses -model [arg] to determine the layout of C++
5682 # classes, name mangling, and exception handling.
5683 # Darwin uses the -arch flag to determine output architecture.
5684 -model|-arch|-isysroot|--sysroot)
5685 func_append compiler_flags " $arg"
5686 func_append compile_command " $arg"
5687 func_append finalize_command " $arg"
5692 -mt|-mthreads|-kthread|-Kthread|-pthread|-pthreads|--thread-safe \
5693 |-threads|-fopenmp|-openmp|-mp|-xopenmp|-omp|-qsmp=*)
5694 func_append compiler_flags " $arg"
5695 func_append compile_command " $arg"
5696 func_append finalize_command " $arg"
5697 case "$new_inherited_linker_flags " in
5699 * ) func_append new_inherited_linker_flags " $arg" ;;
5705 single_module="${wl}-multi_module"
5716 *-*-cygwin* | *-*-mingw* | *-*-pw32* | *-*-os2* | *-*-darwin* | *-cegcc*)
5717 # The PATH hackery in wrapper scripts is required on Windows
5718 # and Darwin in order for the loader to find any dlls it needs.
5719 func_warning "\`-no-install' is ignored for $host"
5720 func_warning "assuming \`-no-fast-install' instead"
5723 *) no_install=yes ;;
5740 -precious-files-regex)
5761 func_stripname '-R' '' "$arg"
5762 dir=$func_stripname_result
5763 # We need an absolute path.
5765 [\\/]* | [A-Za-z]:[\\/]*) ;;
5767 func_stripname '=' '' "$dir"
5768 dir=$lt_sysroot$func_stripname_result
5771 func_fatal_error "only absolute run-paths are allowed"
5776 *) func_append xrpath " $dir" ;;
5782 # The effects of -shared are defined in a previous loop.
5791 -static | -static-libtool-libs)
5792 # The effects of -static are defined in a previous loop.
5793 # We used to do the same as -all-static on platforms that
5794 # didn't have a PIC flag, but the assumption that the effects
5795 # would be equivalent was wrong. It would break on at least
5796 # Digital Unix and AIX.
5822 func_stripname '-Wc,' '' "$arg"
5823 args=$func_stripname_result
5825 save_ifs="$IFS"; IFS=','
5826 for flag in $args; do
5828 func_quote_for_eval "$flag"
5829 func_append arg " $func_quote_for_eval_result"
5830 func_append compiler_flags " $func_quote_for_eval_result"
5833 func_stripname ' ' '' "$arg"
5834 arg=$func_stripname_result
5838 func_stripname '-Wl,' '' "$arg"
5839 args=$func_stripname_result
5841 save_ifs="$IFS"; IFS=','
5842 for flag in $args; do
5844 func_quote_for_eval "$flag"
5845 func_append arg " $wl$func_quote_for_eval_result"
5846 func_append compiler_flags " $wl$func_quote_for_eval_result"
5847 func_append linker_flags " $func_quote_for_eval_result"
5850 func_stripname ' ' '' "$arg"
5851 arg=$func_stripname_result
5871 func_quote_for_eval "$arg"
5872 arg="$func_quote_for_eval_result"
5875 # Flags to be passed through unchanged, with rationale:
5876 # -64, -mips[0-9] enable 64-bit mode for the SGI compiler
5877 # -r[0-9][0-9]* specify processor for the SGI compiler
5878 # -xarch=*, -xtarget=* enable 64-bit mode for the Sun compiler
5879 # +DA*, +DD* enable 64-bit mode for the HP compiler
5880 # -q* compiler args for the IBM compiler
5881 # -m*, -t[45]*, -txscale* architecture-specific flags for GCC
5882 # -F/path path to uninstalled frameworks, gcc on darwin
5883 # -p, -pg, --coverage, -fprofile-* profiling flags for GCC
5884 # @file GCC response files
5885 # -tp=* Portland pgcc target processor selection
5886 # --sysroot=* for sysroot support
5887 # -O*, -flto*, -fwhopr*, -fuse-linker-plugin GCC link-time optimization
5888 -64|-mips[0-9]|-r[0-9][0-9]*|-xarch=*|-xtarget=*|+DA*|+DD*|-q*|-m*| \
5889 -t[45]*|-txscale*|-p|-pg|--coverage|-fprofile-*|-F*|@*|-tp=*|--sysroot=*| \
5890 -O*|-flto*|-fwhopr*|-fuse-linker-plugin)
5891 func_quote_for_eval "$arg"
5892 arg="$func_quote_for_eval_result"
5893 func_append compile_command " $arg"
5894 func_append finalize_command " $arg"
5895 func_append compiler_flags " $arg"
5899 # Some other compiler flag.
5901 func_quote_for_eval "$arg"
5902 arg="$func_quote_for_eval_result"
5906 # A standard object.
5907 func_append objs " $arg"
5911 # A libtool-controlled object.
5913 # Check to see that this really is a libtool object.
5914 if func_lalib_unsafe_p "$arg"; then
5921 if test -z "$pic_object" ||
5922 test -z "$non_pic_object" ||
5923 test "$pic_object" = none &&
5924 test "$non_pic_object" = none; then
5925 func_fatal_error "cannot find name of object for \`$arg'"
5928 # Extract subdirectory from the argument.
5929 func_dirname "$arg" "/" ""
5930 xdir="$func_dirname_result"
5932 if test "$pic_object" != none; then
5933 # Prepend the subdirectory the object is found in.
5934 pic_object="$xdir$pic_object"
5936 if test "$prev" = dlfiles; then
5937 if test "$build_libtool_libs" = yes && test "$dlopen_support" = yes; then
5938 func_append dlfiles " $pic_object"
5942 # If libtool objects are unsupported, then we need to preload.
5947 # CHECK ME: I think I busted this. -Ossama
5948 if test "$prev" = dlprefiles; then
5949 # Preload the old-style object.
5950 func_append dlprefiles " $pic_object"
5955 func_append libobjs " $pic_object"
5960 if test "$non_pic_object" != none; then
5961 # Prepend the subdirectory the object is found in.
5962 non_pic_object="$xdir$non_pic_object"
5964 # A standard non-PIC object
5965 func_append non_pic_objects " $non_pic_object"
5966 if test -z "$pic_object" || test "$pic_object" = none ; then
5967 arg="$non_pic_object"
5970 # If the PIC object exists, use it instead.
5971 # $xdir was prepended to $pic_object above.
5972 non_pic_object="$pic_object"
5973 func_append non_pic_objects " $non_pic_object"
5976 # Only an error if not doing a dry-run.
5977 if $opt_dry_run; then
5978 # Extract subdirectory from the argument.
5979 func_dirname "$arg" "/" ""
5980 xdir="$func_dirname_result"
5983 pic_object=$xdir$objdir/$func_lo2o_result
5984 non_pic_object=$xdir$func_lo2o_result
5985 func_append libobjs " $pic_object"
5986 func_append non_pic_objects " $non_pic_object"
5988 func_fatal_error "\`$arg' is not a valid libtool object"
5995 func_append deplibs " $arg"
5996 func_append old_deplibs " $arg"
6001 # A libtool-controlled library.
6003 func_resolve_sysroot "$arg"
6004 if test "$prev" = dlfiles; then
6005 # This library was specified with -dlopen.
6006 func_append dlfiles " $func_resolve_sysroot_result"
6008 elif test "$prev" = dlprefiles; then
6009 # The library was specified with -dlpreopen.
6010 func_append dlprefiles " $func_resolve_sysroot_result"
6013 func_append deplibs " $func_resolve_sysroot_result"
6018 # Some other compiler argument.
6020 # Unknown arguments in both finalize_command and compile_command need
6021 # to be aesthetically quoted because they are evaled later.
6022 func_quote_for_eval "$arg"
6023 arg="$func_quote_for_eval_result"
6027 # Now actually substitute the argument into the commands.
6028 if test -n "$arg"; then
6029 func_append compile_command " $arg"
6030 func_append finalize_command " $arg"
6032 done # argument parsing loop
6034 test -n "$prev" && \
6035 func_fatal_help "the \`$prevarg' option requires an argument"
6037 if test "$export_dynamic" = yes && test -n "$export_dynamic_flag_spec"; then
6038 eval arg=\"$export_dynamic_flag_spec\"
6039 func_append compile_command " $arg"
6040 func_append finalize_command " $arg"
6044 # calculate the name of the file, without its directory
6045 func_basename "$output"
6046 outputname="$func_basename_result"
6047 libobjs_save="$libobjs"
6049 if test -n "$shlibpath_var"; then
6050 # get the directories listed in $shlibpath_var
6051 eval shlib_search_path=\`\$ECHO \"\${$shlibpath_var}\" \| \$SED \'s/:/ /g\'\`
6055 eval sys_lib_search_path=\"$sys_lib_search_path_spec\"
6056 eval sys_lib_dlsearch_path=\"$sys_lib_dlsearch_path_spec\"
6058 func_dirname "$output" "/" ""
6059 output_objdir="$func_dirname_result$objdir"
6060 func_to_tool_file "$output_objdir/"
6061 tool_output_objdir=$func_to_tool_file_result
6062 # Create the object directory.
6063 func_mkdir_p "$output_objdir"
6065 # Determine the type of output
6068 func_fatal_help "you must specify an output file"
6070 *.$libext) linkmode=oldlib ;;
6071 *.lo | *.$objext) linkmode=obj ;;
6072 *.la) linkmode=lib ;;
6073 *) linkmode=prog ;; # Anything else should be a program.
6079 # Find all interdependent deplibs by searching for libraries
6080 # that are linked more than once (e.g. -la -lb -la)
6081 for deplib in $deplibs; do
6082 if $opt_preserve_dup_deps ; then
6084 *" $deplib "*) func_append specialdeplibs " $deplib" ;;
6087 func_append libs " $deplib"
6090 if test "$linkmode" = lib; then
6091 libs="$predeps $libs $compiler_lib_search_path $postdeps"
6093 # Compute libraries that are listed more than once in $predeps
6094 # $postdeps and mark them as special (i.e., whose duplicates are
6095 # not to be eliminated).
6097 if $opt_duplicate_compiler_generated_deps; then
6098 for pre_post_dep in $predeps $postdeps; do
6099 case "$pre_post_deps " in
6100 *" $pre_post_dep "*) func_append specialdeplibs " $pre_post_deps" ;;
6102 func_append pre_post_deps " $pre_post_dep"
6111 need_relink=no # whether we're linking any uninstalled libtool libraries
6112 notinst_deplibs= # not-installed libtool libraries
6113 notinst_path= # paths that contain not-installed libtool libraries
6117 passes="conv dlpreopen link"
6118 for file in $dlfiles $dlprefiles; do
6122 func_fatal_help "libraries can \`-dlopen' only libtool libraries: $file"
6133 passes="conv scan dlopen dlpreopen link"
6139 for pass in $passes; do
6140 # The preopen pass in lib mode reverses $deplibs; put it back here
6141 # so that -L comes before libs that need it for instance...
6142 if test "$linkmode,$pass" = "lib,link"; then
6143 ## FIXME: Find the place where the list is rebuilt in the wrong
6144 ## order, and fix it there properly
6146 for deplib in $deplibs; do
6147 tmp_deplibs="$deplib $tmp_deplibs"
6149 deplibs="$tmp_deplibs"
6152 if test "$linkmode,$pass" = "lib,link" ||
6153 test "$linkmode,$pass" = "prog,scan"; then
6157 if test "$linkmode" = prog; then
6159 dlopen) libs="$dlfiles" ;;
6160 dlpreopen) libs="$dlprefiles" ;;
6161 link) libs="$deplibs %DEPLIBS% $dependency_libs" ;;
6164 if test "$linkmode,$pass" = "lib,dlpreopen"; then
6165 # Collect and forward deplibs of preopened libtool libs
6166 for lib in $dlprefiles; do
6167 # Ignore non-libtool-libs
6169 func_resolve_sysroot "$lib"
6171 *.la) func_source "$func_resolve_sysroot_result" ;;
6174 # Collect preopened libtool deplibs, except any this library
6175 # has declared as weak libs
6176 for deplib in $dependency_libs; do
6177 func_basename "$deplib"
6178 deplib_base=$func_basename_result
6179 case " $weak_libs " in
6180 *" $deplib_base "*) ;;
6181 *) func_append deplibs " $deplib" ;;
6187 if test "$pass" = dlopen; then
6188 # Collect dlpreopened libraries
6189 save_deplibs="$deplibs"
6193 for deplib in $libs; do
6197 -mt|-mthreads|-kthread|-Kthread|-pthread|-pthreads|--thread-safe \
6198 |-threads|-fopenmp|-openmp|-mp|-xopenmp|-omp|-qsmp=*)
6199 if test "$linkmode,$pass" = "prog,link"; then
6200 compile_deplibs="$deplib $compile_deplibs"
6201 finalize_deplibs="$deplib $finalize_deplibs"
6203 func_append compiler_flags " $deplib"
6208 deplibs="$deplib $deplibs"
6209 test "$pass" = conv && continue
6210 newdependency_libs="$deplib $newdependency_libs"
6213 if test "$pass" = conv; then
6214 deplibs="$deplib $deplibs"
6217 if test "$pass" = scan; then
6218 deplibs="$deplib $deplibs"
6220 compile_deplibs="$deplib $compile_deplibs"
6221 finalize_deplibs="$deplib $finalize_deplibs"
6231 if test "$linkmode" != lib && test "$linkmode" != prog; then
6232 func_warning "\`-l' is ignored for archives/objects"
6235 func_stripname '-l' '' "$deplib"
6236 name=$func_stripname_result
6237 if test "$linkmode" = lib; then
6238 searchdirs="$newlib_search_path $lib_search_path $compiler_lib_search_dirs $sys_lib_search_path $shlib_search_path"
6240 searchdirs="$newlib_search_path $lib_search_path $sys_lib_search_path $shlib_search_path"
6242 for searchdir in $searchdirs; do
6243 for search_ext in .la $std_shrext .so .a; do
6244 # Search the libtool library
6245 lib="$searchdir/lib${name}${search_ext}"
6246 if test -f "$lib"; then
6247 if test "$search_ext" = ".la"; then
6256 if test "$found" != yes; then
6257 # deplib doesn't seem to be a libtool library
6258 if test "$linkmode,$pass" = "prog,link"; then
6259 compile_deplibs="$deplib $compile_deplibs"
6260 finalize_deplibs="$deplib $finalize_deplibs"
6262 deplibs="$deplib $deplibs"
6263 test "$linkmode" = lib && newdependency_libs="$deplib $newdependency_libs"
6266 else # deplib is a libtool library
6267 # If $allow_libtool_libs_with_static_runtimes && $deplib is a stdlib,
6268 # We need to do some special things here, and not later.
6269 if test "X$allow_libtool_libs_with_static_runtimes" = "Xyes" ; then
6270 case " $predeps $postdeps " in
6272 if func_lalib_p "$lib"; then
6276 for l in $old_library $library_names; do
6279 if test "X$ll" = "X$old_library" ; then # only static version available
6281 func_dirname "$lib" "" "."
6282 ladir="$func_dirname_result"
6283 lib=$ladir/$old_library
6284 if test "$linkmode,$pass" = "prog,link"; then
6285 compile_deplibs="$deplib $compile_deplibs"
6286 finalize_deplibs="$deplib $finalize_deplibs"
6288 deplibs="$deplib $deplibs"
6289 test "$linkmode" = lib && newdependency_libs="$deplib $newdependency_libs"
6301 if test "$linkmode,$pass" = "prog,link"; then
6302 compile_deplibs="$deplib $compile_deplibs"
6303 finalize_deplibs="$deplib $finalize_deplibs"
6305 deplibs="$deplib $deplibs"
6306 if test "$linkmode" = lib ; then
6307 case "$new_inherited_linker_flags " in
6309 * ) func_append new_inherited_linker_flags " $deplib" ;;
6318 deplibs="$deplib $deplibs"
6319 test "$pass" = conv && continue
6320 newdependency_libs="$deplib $newdependency_libs"
6321 func_stripname '-L' '' "$deplib"
6322 func_resolve_sysroot "$func_stripname_result"
6323 func_append newlib_search_path " $func_resolve_sysroot_result"
6326 if test "$pass" = conv; then
6327 deplibs="$deplib $deplibs"
6330 if test "$pass" = scan; then
6331 deplibs="$deplib $deplibs"
6333 compile_deplibs="$deplib $compile_deplibs"
6334 finalize_deplibs="$deplib $finalize_deplibs"
6336 func_stripname '-L' '' "$deplib"
6337 func_resolve_sysroot "$func_stripname_result"
6338 func_append newlib_search_path " $func_resolve_sysroot_result"
6341 func_warning "\`-L' is ignored for archives/objects"
6347 if test "$pass" = link; then
6348 func_stripname '-R' '' "$deplib"
6349 func_resolve_sysroot "$func_stripname_result"
6350 dir=$func_resolve_sysroot_result
6351 # Make sure the xrpath contains only unique directories.
6354 *) func_append xrpath " $dir" ;;
6357 deplibs="$deplib $deplibs"
6361 func_resolve_sysroot "$deplib"
6362 lib=$func_resolve_sysroot_result
6365 if test "$pass" = conv; then
6366 deplibs="$deplib $deplibs"
6371 # Linking convenience modules into shared libraries is allowed,
6372 # but linking other static libraries is non-portable.
6373 case " $dlpreconveniencelibs " in
6377 case $deplibs_check_method in
6379 set dummy $deplibs_check_method; shift
6380 match_pattern_regex=`expr "$deplibs_check_method" : "$1 \(.*\)"`
6381 if eval "\$ECHO \"$deplib\"" 2>/dev/null | $SED 10q \
6382 | $EGREP "$match_pattern_regex" > /dev/null; then
6390 if test "$valid_a_lib" != yes; then
6392 $ECHO "*** Warning: Trying to link with static lib archive $deplib."
6393 echo "*** I have the capability to make that library automatically link in when"
6394 echo "*** you link to this library. But I can only do this if you have a"
6395 echo "*** shared version of the library, which you do not appear to have"
6396 echo "*** because the file extensions .$libext of this argument makes me believe"
6397 echo "*** that it is just a static archive that I should not use here."
6400 $ECHO "*** Warning: Linking the shared library $output against the"
6401 $ECHO "*** static library $deplib is not portable!"
6402 deplibs="$deplib $deplibs"
6409 if test "$pass" != link; then
6410 deplibs="$deplib $deplibs"
6412 compile_deplibs="$deplib $compile_deplibs"
6413 finalize_deplibs="$deplib $finalize_deplibs"
6420 if test "$pass" = conv; then
6421 deplibs="$deplib $deplibs"
6422 elif test "$linkmode" = prog; then
6423 if test "$pass" = dlpreopen || test "$dlopen_support" != yes || test "$build_libtool_libs" = no; then
6424 # If there is no dlopen support or we're linking statically,
6425 # we need to preload.
6426 func_append newdlprefiles " $deplib"
6427 compile_deplibs="$deplib $compile_deplibs"
6428 finalize_deplibs="$deplib $finalize_deplibs"
6430 func_append newdlfiles " $deplib"
6441 if test "$found" = yes || test -f "$lib"; then :
6443 func_fatal_error "cannot find the library \`$lib' or unhandled argument \`$deplib'"
6446 # Check to see that this really is a libtool archive.
6447 func_lalib_unsafe_p "$lib" \
6448 || func_fatal_error "\`$lib' is not a valid libtool archive"
6450 func_dirname "$lib" "" "."
6451 ladir="$func_dirname_result"
6459 inherited_linker_flags=
6460 # If the library was installed with an old release of libtool,
6461 # it will not redefine variables installed, or shouldnotlink
6470 # Convert "-framework foo" to "foo.ltframework"
6471 if test -n "$inherited_linker_flags"; then
6472 tmp_inherited_linker_flags=`$ECHO "$inherited_linker_flags" | $SED 's/-framework \([^ $]*\)/\1.ltframework/g'`
6473 for tmp_inherited_linker_flag in $tmp_inherited_linker_flags; do
6474 case " $new_inherited_linker_flags " in
6475 *" $tmp_inherited_linker_flag "*) ;;
6476 *) func_append new_inherited_linker_flags " $tmp_inherited_linker_flag";;
6480 dependency_libs=`$ECHO " $dependency_libs" | $SED 's% \([^ $]*\).ltframework% -framework \1%g'`
6481 if test "$linkmode,$pass" = "lib,link" ||
6482 test "$linkmode,$pass" = "prog,scan" ||
6483 { test "$linkmode" != prog && test "$linkmode" != lib; }; then
6484 test -n "$dlopen" && func_append dlfiles " $dlopen"
6485 test -n "$dlpreopen" && func_append dlprefiles " $dlpreopen"
6488 if test "$pass" = conv; then
6489 # Only check for convenience libraries
6490 deplibs="$lib $deplibs"
6491 if test -z "$libdir"; then
6492 if test -z "$old_library"; then
6493 func_fatal_error "cannot find name of link library for \`$lib'"
6495 # It is a libtool convenience library, so add in its objects.
6496 func_append convenience " $ladir/$objdir/$old_library"
6497 func_append old_convenience " $ladir/$objdir/$old_library"
6498 elif test "$linkmode" != prog && test "$linkmode" != lib; then
6499 func_fatal_error "\`$lib' is not a convenience library"
6502 for deplib in $dependency_libs; do
6503 deplibs="$deplib $deplibs"
6504 if $opt_preserve_dup_deps ; then
6505 case "$tmp_libs " in
6506 *" $deplib "*) func_append specialdeplibs " $deplib" ;;
6509 func_append tmp_libs " $deplib"
6515 # Get the name of the library we link against.
6517 if test -n "$old_library" &&
6518 { test "$prefer_static_libs" = yes ||
6519 test "$prefer_static_libs,$installed" = "built,no"; }; then
6520 linklib=$old_library
6522 for l in $old_library $library_names; do
6526 if test -z "$linklib"; then
6527 func_fatal_error "cannot find name of link library for \`$lib'"
6530 # This library was specified with -dlopen.
6531 if test "$pass" = dlopen; then
6532 if test -z "$libdir"; then
6533 func_fatal_error "cannot -dlopen a convenience library: \`$lib'"
6535 if test -z "$dlname" ||
6536 test "$dlopen_support" != yes ||
6537 test "$build_libtool_libs" = no; then
6538 # If there is no dlname, no dlopen support or we're linking
6539 # statically, we need to preload. We also need to preload any
6540 # dependent libraries so libltdl's deplib preloader doesn't
6541 # bomb out in the load deplibs phase.
6542 func_append dlprefiles " $lib $dependency_libs"
6544 func_append newdlfiles " $lib"
6549 # We need an absolute path.
6551 [\\/]* | [A-Za-z]:[\\/]*) abs_ladir="$ladir" ;;
6553 abs_ladir=`cd "$ladir" && pwd`
6554 if test -z "$abs_ladir"; then
6555 func_warning "cannot determine absolute directory name of \`$ladir'"
6556 func_warning "passing it literally to the linker, although it might fail"
6561 func_basename "$lib"
6562 laname="$func_basename_result"
6564 # Find the relevant object directory and library name.
6565 if test "X$installed" = Xyes; then
6566 if test ! -f "$lt_sysroot$libdir/$linklib" && test -f "$abs_ladir/$linklib"; then
6567 func_warning "library \`$lib' was moved."
6572 dir="$lt_sysroot$libdir"
6573 absdir="$lt_sysroot$libdir"
6575 test "X$hardcode_automatic" = Xyes && avoidtemprpath=yes
6577 if test ! -f "$ladir/$objdir/$linklib" && test -f "$abs_ladir/$linklib"; then
6580 # Remove this search path later
6581 func_append notinst_path " $abs_ladir"
6583 dir="$ladir/$objdir"
6584 absdir="$abs_ladir/$objdir"
6585 # Remove this search path later
6586 func_append notinst_path " $abs_ladir"
6588 fi # $installed = yes
6589 func_stripname 'lib' '.la' "$laname"
6590 name=$func_stripname_result
6592 # This library was specified with -dlpreopen.
6593 if test "$pass" = dlpreopen; then
6594 if test -z "$libdir" && test "$linkmode" = prog; then
6595 func_fatal_error "only libraries may -dlpreopen a convenience library: \`$lib'"
6598 # special handling for platforms with PE-DLLs.
6599 *cygwin* | *mingw* | *cegcc* )
6600 # Linker will automatically link against shared library if both
6601 # static and shared are present. Therefore, ensure we extract
6602 # symbols from the import library if a shared library is present
6603 # (otherwise, the dlopen module name will be incorrect). We do
6604 # this by putting the import library name into $newdlprefiles.
6605 # We recover the dlopen module name by 'saving' the la file
6606 # name in a special purpose variable, and (later) extracting the
6607 # dlname from the la file.
6608 if test -n "$dlname"; then
6609 func_tr_sh "$dir/$linklib"
6610 eval "libfile_$func_tr_sh_result=\$abs_ladir/\$laname"
6611 func_append newdlprefiles " $dir/$linklib"
6613 func_append newdlprefiles " $dir/$old_library"
6614 # Keep a list of preopened convenience libraries to check
6615 # that they are being used correctly in the link pass.
6616 test -z "$libdir" && \
6617 func_append dlpreconveniencelibs " $dir/$old_library"
6621 # Prefer using a static library (so that no silly _DYNAMIC symbols
6622 # are required to link).
6623 if test -n "$old_library"; then
6624 func_append newdlprefiles " $dir/$old_library"
6625 # Keep a list of preopened convenience libraries to check
6626 # that they are being used correctly in the link pass.
6627 test -z "$libdir" && \
6628 func_append dlpreconveniencelibs " $dir/$old_library"
6629 # Otherwise, use the dlname, so that lt_dlopen finds it.
6630 elif test -n "$dlname"; then
6631 func_append newdlprefiles " $dir/$dlname"
6633 func_append newdlprefiles " $dir/$linklib"
6637 fi # $pass = dlpreopen
6639 if test -z "$libdir"; then
6640 # Link the convenience library
6641 if test "$linkmode" = lib; then
6642 deplibs="$dir/$old_library $deplibs"
6643 elif test "$linkmode,$pass" = "prog,link"; then
6644 compile_deplibs="$dir/$old_library $compile_deplibs"
6645 finalize_deplibs="$dir/$old_library $finalize_deplibs"
6647 deplibs="$lib $deplibs" # used for prog,scan pass
6653 if test "$linkmode" = prog && test "$pass" != link; then
6654 func_append newlib_search_path " $ladir"
6655 deplibs="$lib $deplibs"
6658 if test "$link_all_deplibs" != no || test -z "$library_names" ||
6659 test "$build_libtool_libs" = no; then
6664 for deplib in $dependency_libs; do
6666 -L*) func_stripname '-L' '' "$deplib"
6667 func_resolve_sysroot "$func_stripname_result"
6668 func_append newlib_search_path " $func_resolve_sysroot_result"
6671 # Need to link against all dependency_libs?
6672 if test "$linkalldeplibs" = yes; then
6673 deplibs="$deplib $deplibs"
6675 # Need to hardcode shared library paths
6676 # or/and link against static libraries
6677 newdependency_libs="$deplib $newdependency_libs"
6679 if $opt_preserve_dup_deps ; then
6680 case "$tmp_libs " in
6681 *" $deplib "*) func_append specialdeplibs " $deplib" ;;
6684 func_append tmp_libs " $deplib"
6687 fi # $linkmode = prog...
6689 if test "$linkmode,$pass" = "prog,link"; then
6690 if test -n "$library_names" &&
6691 { { test "$prefer_static_libs" = no ||
6692 test "$prefer_static_libs,$installed" = "built,yes"; } ||
6693 test -z "$old_library"; }; then
6694 # We need to hardcode the library path
6695 if test -n "$shlibpath_var" && test -z "$avoidtemprpath" ; then
6696 # Make sure the rpath contains only unique directories.
6697 case "$temp_rpath:" in
6699 *) func_append temp_rpath "$absdir:" ;;
6703 # Hardcode the library path.
6704 # Skip directories that are in the system default run-time
6706 case " $sys_lib_dlsearch_path " in
6709 case "$compile_rpath " in
6711 *) func_append compile_rpath " $absdir" ;;
6715 case " $sys_lib_dlsearch_path " in
6718 case "$finalize_rpath " in
6720 *) func_append finalize_rpath " $libdir" ;;
6724 fi # $linkmode,$pass = prog,link...
6726 if test "$alldeplibs" = yes &&
6727 { test "$deplibs_check_method" = pass_all ||
6728 { test "$build_libtool_libs" = yes &&
6729 test -n "$library_names"; }; }; then
6730 # We only need to search for static libraries
6735 link_static=no # Whether the deplib will be linked statically
6736 use_static_libs=$prefer_static_libs
6737 if test "$use_static_libs" = built && test "$installed" = yes; then
6740 if test -n "$library_names" &&
6741 { test "$use_static_libs" = no || test -z "$old_library"; }; then
6743 *cygwin* | *mingw* | *cegcc*)
6744 # No point in relinking DLLs because paths are not encoded
6745 func_append notinst_deplibs " $lib"
6749 if test "$installed" = no; then
6750 func_append notinst_deplibs " $lib"
6755 # This is a shared library
6757 # Warn about portability, can't link against -module's on some
6758 # systems (darwin). Don't bleat about dlopened modules though!
6760 for dlpremoduletest in $dlprefiles; do
6761 if test "X$dlpremoduletest" = "X$lib"; then
6762 dlopenmodule="$dlpremoduletest"
6766 if test -z "$dlopenmodule" && test "$shouldnotlink" = yes && test "$pass" = link; then
6768 if test "$linkmode" = prog; then
6769 $ECHO "*** Warning: Linking the executable $output against the loadable module"
6771 $ECHO "*** Warning: Linking the shared library $output against the loadable module"
6773 $ECHO "*** $linklib is not portable!"
6775 if test "$linkmode" = lib &&
6776 test "$hardcode_into_libs" = yes; then
6777 # Hardcode the library path.
6778 # Skip directories that are in the system default run-time
6780 case " $sys_lib_dlsearch_path " in
6783 case "$compile_rpath " in
6785 *) func_append compile_rpath " $absdir" ;;
6789 case " $sys_lib_dlsearch_path " in
6792 case "$finalize_rpath " in
6794 *) func_append finalize_rpath " $libdir" ;;
6800 if test -n "$old_archive_from_expsyms_cmds"; then
6801 # figure out the soname
6802 set dummy $library_names
6806 libname=`eval "\\$ECHO \"$libname_spec\""`
6807 # use dlname if we got it. it's perfectly good, no?
6808 if test -n "$dlname"; then
6810 elif test -n "$soname_spec"; then
6813 *cygwin* | mingw* | *cegcc*)
6814 func_arith $current - $age
6815 major=$func_arith_result
6819 eval soname=\"$soname_spec\"
6824 # Make a new name for the extract_expsyms_cmds to use
6826 func_basename "$soroot"
6827 soname="$func_basename_result"
6828 func_stripname 'lib' '.dll' "$soname"
6829 newlib=libimp-$func_stripname_result.a
6831 # If the library has no export list, then create one now
6832 if test -f "$output_objdir/$soname-def"; then :
6834 func_verbose "extracting exported symbol list from \`$soname'"
6835 func_execute_cmds "$extract_expsyms_cmds" 'exit $?'
6839 if test -f "$output_objdir/$newlib"; then :; else
6840 func_verbose "generating import library for \`$soname'"
6841 func_execute_cmds "$old_archive_from_expsyms_cmds" 'exit $?'
6843 # make sure the library variables are pointing to the new library
6846 fi # test -n "$old_archive_from_expsyms_cmds"
6848 if test "$linkmode" = prog || test "$opt_mode" != relink; then
6853 case $hardcode_action in
6854 immediate | unsupported)
6855 if test "$hardcode_direct" = no; then
6858 *-*-sco3.2v5.0.[024]*) add_dir="-L$dir" ;;
6859 *-*-sysv4*uw2*) add_dir="-L$dir" ;;
6860 *-*-sysv5OpenUNIX* | *-*-sysv5UnixWare7.[01].[10]* | \
6861 *-*-unixware7*) add_dir="-L$dir" ;;
6863 # if the lib is a (non-dlopened) module then we can not
6864 # link against it, someone is ignoring the earlier warnings
6865 if /usr/bin/file -L $add 2> /dev/null |
6866 $GREP ": [^:]* bundle" >/dev/null ; then
6867 if test "X$dlopenmodule" != "X$lib"; then
6868 $ECHO "*** Warning: lib $linklib is a module, not a shared library"
6869 if test -z "$old_library" ; then
6871 echo "*** And there doesn't seem to be a static archive available"
6872 echo "*** The link will probably fail, sorry"
6874 add="$dir/$old_library"
6876 elif test -n "$old_library"; then
6877 add="$dir/$old_library"
6881 elif test "$hardcode_minus_L" = no; then
6883 *-*-sunos*) add_shlibpath="$dir" ;;
6887 elif test "$hardcode_shlibpath_var" = no; then
6888 add_shlibpath="$dir"
6895 if test "$hardcode_direct" = yes &&
6896 test "$hardcode_direct_absolute" = no; then
6898 elif test "$hardcode_minus_L" = yes; then
6900 # Try looking first in the location we're being installed to.
6901 if test -n "$inst_prefix_dir"; then
6904 func_append add_dir " -L$inst_prefix_dir$libdir"
6909 elif test "$hardcode_shlibpath_var" = yes; then
6910 add_shlibpath="$dir"
6919 if test "$lib_linked" != yes; then
6920 func_fatal_configuration "unsupported hardcode properties"
6923 if test -n "$add_shlibpath"; then
6924 case :$compile_shlibpath: in
6925 *":$add_shlibpath:"*) ;;
6926 *) func_append compile_shlibpath "$add_shlibpath:" ;;
6929 if test "$linkmode" = prog; then
6930 test -n "$add_dir" && compile_deplibs="$add_dir $compile_deplibs"
6931 test -n "$add" && compile_deplibs="$add $compile_deplibs"
6933 test -n "$add_dir" && deplibs="$add_dir $deplibs"
6934 test -n "$add" && deplibs="$add $deplibs"
6935 if test "$hardcode_direct" != yes &&
6936 test "$hardcode_minus_L" != yes &&
6937 test "$hardcode_shlibpath_var" = yes; then
6938 case :$finalize_shlibpath: in
6940 *) func_append finalize_shlibpath "$libdir:" ;;
6946 if test "$linkmode" = prog || test "$opt_mode" = relink; then
6950 # Finalize command for both is simple: just hardcode it.
6951 if test "$hardcode_direct" = yes &&
6952 test "$hardcode_direct_absolute" = no; then
6953 add="$libdir/$linklib"
6954 elif test "$hardcode_minus_L" = yes; then
6957 elif test "$hardcode_shlibpath_var" = yes; then
6958 case :$finalize_shlibpath: in
6960 *) func_append finalize_shlibpath "$libdir:" ;;
6963 elif test "$hardcode_automatic" = yes; then
6964 if test -n "$inst_prefix_dir" &&
6965 test -f "$inst_prefix_dir$libdir/$linklib" ; then
6966 add="$inst_prefix_dir$libdir/$linklib"
6968 add="$libdir/$linklib"
6971 # We cannot seem to hardcode it, guess we'll fake it.
6973 # Try looking first in the location we're being installed to.
6974 if test -n "$inst_prefix_dir"; then
6977 func_append add_dir " -L$inst_prefix_dir$libdir"
6984 if test "$linkmode" = prog; then
6985 test -n "$add_dir" && finalize_deplibs="$add_dir $finalize_deplibs"
6986 test -n "$add" && finalize_deplibs="$add $finalize_deplibs"
6988 test -n "$add_dir" && deplibs="$add_dir $deplibs"
6989 test -n "$add" && deplibs="$add $deplibs"
6992 elif test "$linkmode" = prog; then
6993 # Here we assume that one of hardcode_direct or hardcode_minus_L
6994 # is not unsupported. This is valid on all known static and
6996 if test "$hardcode_direct" != unsupported; then
6997 test -n "$old_library" && linklib="$old_library"
6998 compile_deplibs="$dir/$linklib $compile_deplibs"
6999 finalize_deplibs="$dir/$linklib $finalize_deplibs"
7001 compile_deplibs="-l$name -L$dir $compile_deplibs"
7002 finalize_deplibs="-l$name -L$dir $finalize_deplibs"
7004 elif test "$build_libtool_libs" = yes; then
7005 # Not a shared library
7006 if test "$deplibs_check_method" != pass_all; then
7007 # We're trying link a shared library against a static one
7008 # but the system doesn't support it.
7010 # Just print a warning and add the library to dependency_libs so
7011 # that the program can be linked against the static library.
7013 $ECHO "*** Warning: This system can not link to static lib archive $lib."
7014 echo "*** I have the capability to make that library automatically link in when"
7015 echo "*** you link to this library. But I can only do this if you have a"
7016 echo "*** shared version of the library, which you do not appear to have."
7017 if test "$module" = yes; then
7018 echo "*** But as you try to build a module library, libtool will still create "
7019 echo "*** a static module, that should work as long as the dlopening application"
7020 echo "*** is linked with the -dlopen flag to resolve symbols at runtime."
7021 if test -z "$global_symbol_pipe"; then
7023 echo "*** However, this would only work if libtool was able to extract symbol"
7024 echo "*** lists from a program, using \`nm' or equivalent, but libtool could"
7025 echo "*** not find such a program. So, this module is probably useless."
7026 echo "*** \`nm' from GNU binutils and a full rebuild may help."
7028 if test "$build_old_libs" = no; then
7029 build_libtool_libs=module
7032 build_libtool_libs=no
7036 deplibs="$dir/$old_library $deplibs"
7039 fi # link shared/static library?
7041 if test "$linkmode" = lib; then
7042 if test -n "$dependency_libs" &&
7043 { test "$hardcode_into_libs" != yes ||
7044 test "$build_old_libs" = yes ||
7045 test "$link_static" = yes; }; then
7046 # Extract -R from dependency_libs
7048 for libdir in $dependency_libs; do
7050 -R*) func_stripname '-R' '' "$libdir"
7051 temp_xrpath=$func_stripname_result
7053 *" $temp_xrpath "*) ;;
7054 *) func_append xrpath " $temp_xrpath";;
7056 *) func_append temp_deplibs " $libdir";;
7059 dependency_libs="$temp_deplibs"
7062 func_append newlib_search_path " $absdir"
7063 # Link against this library
7064 test "$link_static" = no && newdependency_libs="$abs_ladir/$laname $newdependency_libs"
7065 # ... and its dependency_libs
7067 for deplib in $dependency_libs; do
7068 newdependency_libs="$deplib $newdependency_libs"
7070 -L*) func_stripname '-L' '' "$deplib"
7071 func_resolve_sysroot "$func_stripname_result";;
7072 *) func_resolve_sysroot "$deplib" ;;
7074 if $opt_preserve_dup_deps ; then
7075 case "$tmp_libs " in
7076 *" $func_resolve_sysroot_result "*)
7077 func_append specialdeplibs " $func_resolve_sysroot_result" ;;
7080 func_append tmp_libs " $func_resolve_sysroot_result"
7083 if test "$link_all_deplibs" != no; then
7084 # Add the search paths of all dependency libraries
7085 for deplib in $dependency_libs; do
7088 -L*) path="$deplib" ;;
7090 func_resolve_sysroot "$deplib"
7091 deplib=$func_resolve_sysroot_result
7092 func_dirname "$deplib" "" "."
7093 dir=$func_dirname_result
7094 # We need an absolute path.
7096 [\\/]* | [A-Za-z]:[\\/]*) absdir="$dir" ;;
7098 absdir=`cd "$dir" && pwd`
7099 if test -z "$absdir"; then
7100 func_warning "cannot determine absolute directory name of \`$dir'"
7105 if $GREP "^installed=no" $deplib > /dev/null; then
7109 eval deplibrary_names=`${SED} -n -e 's/^library_names=\(.*\)$/\1/p' $deplib`
7110 if test -n "$deplibrary_names" ; then
7111 for tmp in $deplibrary_names ; do
7114 if test -f "$absdir/$objdir/$depdepl" ; then
7115 depdepl="$absdir/$objdir/$depdepl"
7116 darwin_install_name=`${OTOOL} -L $depdepl | awk '{if (NR == 2) {print $1;exit}}'`
7117 if test -z "$darwin_install_name"; then
7118 darwin_install_name=`${OTOOL64} -L $depdepl | awk '{if (NR == 2) {print $1;exit}}'`
7120 func_append compiler_flags " ${wl}-dylib_file ${wl}${darwin_install_name}:${depdepl}"
7121 func_append linker_flags " -dylib_file ${darwin_install_name}:${depdepl}"
7127 path="-L$absdir/$objdir"
7131 eval libdir=`${SED} -n -e 's/^libdir=\(.*\)$/\1/p' $deplib`
7132 test -z "$libdir" && \
7133 func_fatal_error "\`$deplib' is not a valid libtool archive"
7134 test "$absdir" != "$libdir" && \
7135 func_warning "\`$deplib' seems to be moved"
7141 case " $deplibs " in
7143 *) deplibs="$path $deplibs" ;;
7146 fi # link_all_deplibs != no
7148 done # for deplib in $libs
7149 if test "$pass" = link; then
7150 if test "$linkmode" = "prog"; then
7151 compile_deplibs="$new_inherited_linker_flags $compile_deplibs"
7152 finalize_deplibs="$new_inherited_linker_flags $finalize_deplibs"
7154 compiler_flags="$compiler_flags "`$ECHO " $new_inherited_linker_flags" | $SED 's% \([^ $]*\).ltframework% -framework \1%g'`
7157 dependency_libs="$newdependency_libs"
7158 if test "$pass" = dlpreopen; then
7159 # Link the dlpreopened libraries before other libraries
7160 for deplib in $save_deplibs; do
7161 deplibs="$deplib $deplibs"
7164 if test "$pass" != dlopen; then
7165 if test "$pass" != conv; then
7166 # Make sure lib_search_path contains only unique directories.
7168 for dir in $newlib_search_path; do
7169 case "$lib_search_path " in
7171 *) func_append lib_search_path " $dir" ;;
7177 if test "$linkmode,$pass" != "prog,link"; then
7180 vars="compile_deplibs finalize_deplibs"
7182 for var in $vars dependency_libs; do
7183 # Add libraries to $var in reverse order
7184 eval tmp_libs=\"\$$var\"
7186 for deplib in $tmp_libs; do
7187 # FIXME: Pedantically, this is the right thing to do, so
7188 # that some nasty dependency loop isn't accidentally
7190 #new_libs="$deplib $new_libs"
7191 # Pragmatically, this seems to cause very few problems in
7194 -L*) new_libs="$deplib $new_libs" ;;
7197 # And here is the reason: when a library appears more
7198 # than once as an explicit dependence of a library, or
7199 # is implicitly linked in more than once by the
7200 # compiler, it is considered special, and multiple
7201 # occurrences thereof are not removed. Compare this
7202 # with having the same library being listed as a
7203 # dependency of multiple other libraries: in this case,
7204 # we know (pedantically, we assume) the library does not
7205 # need to be listed more than once, so we keep only the
7206 # last copy. This is not always right, but it is rare
7207 # enough that we require users that really mean to play
7208 # such unportable linking tricks to link the library
7209 # using -Wl,-lname, so that libtool does not consider it
7210 # for duplicate removal.
7211 case " $specialdeplibs " in
7212 *" $deplib "*) new_libs="$deplib $new_libs" ;;
7214 case " $new_libs " in
7216 *) new_libs="$deplib $new_libs" ;;
7224 for deplib in $new_libs; do
7227 case " $tmp_libs " in
7229 *) func_append tmp_libs " $deplib" ;;
7232 *) func_append tmp_libs " $deplib" ;;
7235 eval $var=\"$tmp_libs\"
7238 # Last step: remove runtime libs from dependency_libs
7239 # (they stay in deplibs)
7241 for i in $dependency_libs ; do
7242 case " $predeps $postdeps $compiler_lib_search_path " in
7247 if test -n "$i" ; then
7248 func_append tmp_libs " $i"
7251 dependency_libs=$tmp_libs
7253 if test "$linkmode" = prog; then
7254 dlfiles="$newdlfiles"
7256 if test "$linkmode" = prog || test "$linkmode" = lib; then
7257 dlprefiles="$newdlprefiles"
7262 if test -n "$dlfiles$dlprefiles" || test "$dlself" != no; then
7263 func_warning "\`-dlopen' is ignored for archives"
7268 func_warning "\`-l' and \`-L' are ignored for archives" ;;
7271 test -n "$rpath" && \
7272 func_warning "\`-rpath' is ignored for archives"
7274 test -n "$xrpath" && \
7275 func_warning "\`-R' is ignored for archives"
7277 test -n "$vinfo" && \
7278 func_warning "\`-version-info/-version-number' is ignored for archives"
7280 test -n "$release" && \
7281 func_warning "\`-release' is ignored for archives"
7283 test -n "$export_symbols$export_symbols_regex" && \
7284 func_warning "\`-export-symbols' is ignored for archives"
7286 # Now set the variables for building old libraries.
7287 build_libtool_libs=no
7289 func_append objs "$old_deplibs"
7293 # Make sure we only generate libraries of the form `libNAME.la'.
7296 func_stripname 'lib' '.la' "$outputname"
7297 name=$func_stripname_result
7298 eval shared_ext=\"$shrext_cmds\"
7299 eval libname=\"$libname_spec\"
7302 test "$module" = no && \
7303 func_fatal_help "libtool library \`$output' must begin with \`lib'"
7305 if test "$need_lib_prefix" != no; then
7306 # Add the "lib" prefix for modules if required
7307 func_stripname '' '.la' "$outputname"
7308 name=$func_stripname_result
7309 eval shared_ext=\"$shrext_cmds\"
7310 eval libname=\"$libname_spec\"
7312 func_stripname '' '.la' "$outputname"
7313 libname=$func_stripname_result
7318 if test -n "$objs"; then
7319 if test "$deplibs_check_method" != pass_all; then
7320 func_fatal_error "cannot build libtool library \`$output' from non-libtool objects on this host:$objs"
7323 $ECHO "*** Warning: Linking the shared library $output against the non-libtool"
7324 $ECHO "*** objects $objs is not portable!"
7325 func_append libobjs " $objs"
7329 test "$dlself" != no && \
7330 func_warning "\`-dlopen self' is ignored for libtool libraries"
7334 test "$#" -gt 1 && \
7335 func_warning "ignoring multiple \`-rpath's for a libtool library"
7340 if test -z "$rpath"; then
7341 if test "$build_libtool_libs" = yes; then
7342 # Building a libtool convenience library.
7343 # Some compilers have problems with a `.al' extension so
7344 # convenience libraries should have the same extension an
7345 # archive normally would.
7346 oldlibs="$output_objdir/$libname.$libext $oldlibs"
7347 build_libtool_libs=convenience
7351 test -n "$vinfo" && \
7352 func_warning "\`-version-info/-version-number' is ignored for convenience libraries"
7354 test -n "$release" && \
7355 func_warning "\`-release' is ignored for convenience libraries"
7358 # Parse the version information argument.
7359 save_ifs="$IFS"; IFS=':'
7360 set dummy $vinfo 0 0 0
7365 func_fatal_help "too many parameters to \`-version-info'"
7367 # convert absolute version numbers to libtool ages
7368 # this retains compatibility with .la files and attempts
7369 # to make the code below a bit more comprehensible
7371 case $vinfo_number in
7375 number_revision="$3"
7377 # There are really only two kinds -- those that
7378 # use the current revision as the major version
7379 # and those that subtract age and use age as
7380 # a minor version. But, then there is irix
7381 # which has an extra 1 added just for fun
7383 case $version_type in
7384 # correct linux to gnu/linux during the next big refactor
7385 darwin|linux|osf|windows|none)
7386 func_arith $number_major + $number_minor
7387 current=$func_arith_result
7389 revision="$number_revision"
7391 freebsd-aout|freebsd-elf|qnx|sunos)
7392 current="$number_major"
7393 revision="$number_minor"
7397 func_arith $number_major + $number_minor
7398 current=$func_arith_result
7400 revision="$number_minor"
7401 lt_irix_increment=no
7412 # Check that each of the things are valid numbers.
7414 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]) ;;
7416 func_error "CURRENT \`$current' must be a nonnegative integer"
7417 func_fatal_error "\`$vinfo' is not valid version information"
7422 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]) ;;
7424 func_error "REVISION \`$revision' must be a nonnegative integer"
7425 func_fatal_error "\`$vinfo' is not valid version information"
7430 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]) ;;
7432 func_error "AGE \`$age' must be a nonnegative integer"
7433 func_fatal_error "\`$vinfo' is not valid version information"
7437 if test "$age" -gt "$current"; then
7438 func_error "AGE \`$age' is greater than the current interface number \`$current'"
7439 func_fatal_error "\`$vinfo' is not valid version information"
7442 # Calculate the version variables.
7446 case $version_type in
7450 # Like Linux, but with the current version available in
7451 # verstring for coding it into the library header
7452 func_arith $current - $age
7453 major=.$func_arith_result
7454 versuffix="$major.$age.$revision"
7455 # Darwin ld doesn't like 0 for these options...
7456 func_arith $current + 1
7457 minor_current=$func_arith_result
7458 xlcverstring="${wl}-compatibility_version ${wl}$minor_current ${wl}-current_version ${wl}$minor_current.$revision"
7459 verstring="-compatibility_version $minor_current -current_version $minor_current.$revision"
7464 versuffix=".$current.$revision";
7469 versuffix=".$current"
7473 if test "X$lt_irix_increment" = "Xno"; then
7474 func_arith $current - $age
7476 func_arith $current - $age + 1
7478 major=$func_arith_result
7480 case $version_type in
7481 nonstopux) verstring_prefix=nonstopux ;;
7482 *) verstring_prefix=sgi ;;
7484 verstring="$verstring_prefix$major.$revision"
7486 # Add in all the interfaces that we are compatible with.
7488 while test "$loop" -ne 0; do
7489 func_arith $revision - $loop
7490 iface=$func_arith_result
7491 func_arith $loop - 1
7492 loop=$func_arith_result
7493 verstring="$verstring_prefix$major.$iface:$verstring"
7496 # Before this point, $major must not contain `.'.
7498 versuffix="$major.$revision"
7501 linux) # correct to gnu/linux during the next big refactor
7502 func_arith $current - $age
7503 major=.$func_arith_result
7504 versuffix="$major.$age.$revision"
7508 func_arith $current - $age
7509 major=.$func_arith_result
7510 versuffix=".$current.$age.$revision"
7511 verstring="$current.$age.$revision"
7513 # Add in all the interfaces that we are compatible with.
7515 while test "$loop" -ne 0; do
7516 func_arith $current - $loop
7517 iface=$func_arith_result
7518 func_arith $loop - 1
7519 loop=$func_arith_result
7520 verstring="$verstring:${iface}.0"
7523 # Make executables depend on our current version.
7524 func_append verstring ":${current}.0"
7529 versuffix=".$current"
7534 versuffix=".$current.$revision"
7538 # Use '-' rather than '.', since we only want one
7539 # extension on DOS 8.3 filesystems.
7540 func_arith $current - $age
7541 major=$func_arith_result
7546 func_fatal_configuration "unknown library version type \`$version_type'"
7550 # Clear the version info if we defaulted, and they specified a release.
7551 if test -z "$vinfo" && test -n "$release"; then
7553 case $version_type in
7555 # we can't check for "0.0" in archive_cmds due to quoting
7556 # problems, so we reset it completely
7563 if test "$need_version" = no; then
7570 # Remove version info from name if versioning should be avoided
7571 if test "$avoid_version" = yes && test "$need_version" = no; then
7577 # Check to see if the archive will have undefined symbols.
7578 if test "$allow_undefined" = yes; then
7579 if test "$allow_undefined_flag" = unsupported; then
7580 func_warning "undefined symbols not allowed in $host shared libraries"
7581 build_libtool_libs=no
7585 # Don't allow undefined symbols.
7586 allow_undefined_flag="$no_undefined_flag"
7591 func_generate_dlsyms "$libname" "$libname" "yes"
7592 func_append libobjs " $symfileobj"
7593 test "X$libobjs" = "X " && libobjs=
7595 if test "$opt_mode" != relink; then
7596 # Remove our outputs, but don't remove object files since they
7597 # may have been created when compiling PIC objects.
7599 tempremovelist=`$ECHO "$output_objdir/*"`
7600 for p in $tempremovelist; do
7604 $output_objdir/$outputname | $output_objdir/$libname.* | $output_objdir/${libname}${release}.*)
7605 if test "X$precious_files_regex" != "X"; then
7606 if $ECHO "$p" | $EGREP -e "$precious_files_regex" >/dev/null 2>&1
7611 func_append removelist " $p"
7616 test -n "$removelist" && \
7617 func_show_eval "${RM}r \$removelist"
7620 # Now set the variables for building old libraries.
7621 if test "$build_old_libs" = yes && test "$build_libtool_libs" != convenience ; then
7622 func_append oldlibs " $output_objdir/$libname.$libext"
7624 # Transform .lo files to .o files.
7625 oldobjs="$objs "`$ECHO "$libobjs" | $SP2NL | $SED "/\.${libext}$/d; $lo2o" | $NL2SP`
7628 # Eliminate all temporary directories.
7629 #for path in $notinst_path; do
7630 # lib_search_path=`$ECHO "$lib_search_path " | $SED "s% $path % %g"`
7631 # deplibs=`$ECHO "$deplibs " | $SED "s% -L$path % %g"`
7632 # dependency_libs=`$ECHO "$dependency_libs " | $SED "s% -L$path % %g"`
7635 if test -n "$xrpath"; then
7636 # If the user specified any rpath flags, then add them.
7638 for libdir in $xrpath; do
7639 func_replace_sysroot "$libdir"
7640 func_append temp_xrpath " -R$func_replace_sysroot_result"
7641 case "$finalize_rpath " in
7643 *) func_append finalize_rpath " $libdir" ;;
7646 if test "$hardcode_into_libs" != yes || test "$build_old_libs" = yes; then
7647 dependency_libs="$temp_xrpath $dependency_libs"
7651 # Make sure dlfiles contains only unique files that won't be dlpreopened
7652 old_dlfiles="$dlfiles"
7654 for lib in $old_dlfiles; do
7655 case " $dlprefiles $dlfiles " in
7657 *) func_append dlfiles " $lib" ;;
7661 # Make sure dlprefiles contains only unique files
7662 old_dlprefiles="$dlprefiles"
7664 for lib in $old_dlprefiles; do
7665 case "$dlprefiles " in
7667 *) func_append dlprefiles " $lib" ;;
7671 if test "$build_libtool_libs" = yes; then
7672 if test -n "$rpath"; then
7674 *-*-cygwin* | *-*-mingw* | *-*-pw32* | *-*-os2* | *-*-beos* | *-cegcc* | *-*-haiku*)
7675 # these systems don't actually have a c library (as such)!
7677 *-*-rhapsody* | *-*-darwin1.[012])
7678 # Rhapsody C library is in the System framework
7679 func_append deplibs " System.ltframework"
7682 # Don't link with libc until the a.out ld.so is fixed.
7684 *-*-openbsd* | *-*-freebsd* | *-*-dragonfly*)
7685 # Do not include libc due to us having libc/libc_r.
7687 *-*-sco3.2v5* | *-*-sco5v6*)
7688 # Causes problems with __ctype
7690 *-*-sysv4.2uw2* | *-*-sysv5* | *-*-unixware* | *-*-OpenUNIX*)
7691 # Compiler inserts libc in the correct place for threads to work
7694 # Add libc to deplibs on all other systems if necessary.
7695 if test "$build_libtool_need_lc" = "yes"; then
7696 func_append deplibs " -lc"
7702 # Transform deplibs into only deplibs that can be linked in shared.
7704 libname_save=$libname
7705 release_save=$release
7706 versuffix_save=$versuffix
7708 # I'm not sure if I'm treating the release correctly. I think
7709 # release should show up in the -l (ie -lgmp5) so we don't want to
7710 # add it in twice. Is that correct?
7716 case $deplibs_check_method in
7718 # Don't check for shared/static. Everything works.
7719 # This might be a little naive. We might want to check
7720 # whether the library exists or not. But this is on
7721 # osf3 & osf4 and I'm not really sure... Just
7722 # implementing what was already the behavior.
7726 # This code stresses the "libraries are programs" paradigm to its
7727 # limits. Maybe even breaks it. We compile a program, linking it
7728 # against the deplibs as a proxy for the library. Then we can check
7729 # whether they linked in statically or dynamically with ldd.
7730 $opt_dry_run || $RM conftest.c
7731 cat > conftest.c <<EOF
7732 int main() { return 0; }
7734 $opt_dry_run || $RM conftest
7735 if $LTCC $LTCFLAGS -o conftest conftest.c $deplibs; then
7736 ldd_output=`ldd conftest`
7737 for i in $deplibs; do
7740 func_stripname -l '' "$i"
7741 name=$func_stripname_result
7742 if test "X$allow_libtool_libs_with_static_runtimes" = "Xyes" ; then
7743 case " $predeps $postdeps " in
7745 func_append newdeplibs " $i"
7750 if test -n "$i" ; then
7751 libname=`eval "\\$ECHO \"$libname_spec\""`
7752 deplib_matches=`eval "\\$ECHO \"$library_names_spec\""`
7753 set dummy $deplib_matches; shift
7755 if test `expr "$ldd_output" : ".*$deplib_match"` -ne 0 ; then
7756 func_append newdeplibs " $i"
7760 $ECHO "*** Warning: dynamic linker does not accept needed library $i."
7761 echo "*** I have the capability to make that library automatically link in when"
7762 echo "*** you link to this library. But I can only do this if you have a"
7763 echo "*** shared version of the library, which I believe you do not have"
7764 echo "*** because a test_compile did reveal that the linker did not use it for"
7765 echo "*** its dynamic dependency list that programs get resolved with at runtime."
7770 func_append newdeplibs " $i"
7775 # Error occurred in the first compile. Let's try to salvage
7776 # the situation: Compile a separate program for each library.
7777 for i in $deplibs; do
7780 func_stripname -l '' "$i"
7781 name=$func_stripname_result
7782 $opt_dry_run || $RM conftest
7783 if $LTCC $LTCFLAGS -o conftest conftest.c $i; then
7784 ldd_output=`ldd conftest`
7785 if test "X$allow_libtool_libs_with_static_runtimes" = "Xyes" ; then
7786 case " $predeps $postdeps " in
7788 func_append newdeplibs " $i"
7793 if test -n "$i" ; then
7794 libname=`eval "\\$ECHO \"$libname_spec\""`
7795 deplib_matches=`eval "\\$ECHO \"$library_names_spec\""`
7796 set dummy $deplib_matches; shift
7798 if test `expr "$ldd_output" : ".*$deplib_match"` -ne 0 ; then
7799 func_append newdeplibs " $i"
7803 $ECHO "*** Warning: dynamic linker does not accept needed library $i."
7804 echo "*** I have the capability to make that library automatically link in when"
7805 echo "*** you link to this library. But I can only do this if you have a"
7806 echo "*** shared version of the library, which you do not appear to have"
7807 echo "*** because a test_compile did reveal that the linker did not use this one"
7808 echo "*** as a dynamic dependency that programs can get resolved with at runtime."
7814 $ECHO "*** Warning! Library $i is needed by this library but I was not able to"
7815 echo "*** make it link in! You will probably need to install it or some"
7816 echo "*** library that it depends on before this library will be fully"
7817 echo "*** functional. Installing it before continuing would be even better."
7821 func_append newdeplibs " $i"
7828 set dummy $deplibs_check_method; shift
7829 file_magic_regex=`expr "$deplibs_check_method" : "$1 \(.*\)"`
7830 for a_deplib in $deplibs; do
7833 func_stripname -l '' "$a_deplib"
7834 name=$func_stripname_result
7835 if test "X$allow_libtool_libs_with_static_runtimes" = "Xyes" ; then
7836 case " $predeps $postdeps " in
7838 func_append newdeplibs " $a_deplib"
7843 if test -n "$a_deplib" ; then
7844 libname=`eval "\\$ECHO \"$libname_spec\""`
7845 if test -n "$file_magic_glob"; then
7846 libnameglob=`func_echo_all "$libname" | $SED -e $file_magic_glob`
7848 libnameglob=$libname
7850 test "$want_nocaseglob" = yes && nocaseglob=`shopt -p nocaseglob`
7851 for i in $lib_search_path $sys_lib_search_path $shlib_search_path; do
7852 if test "$want_nocaseglob" = yes; then
7854 potential_libs=`ls $i/$libnameglob[.-]* 2>/dev/null`
7857 potential_libs=`ls $i/$libnameglob[.-]* 2>/dev/null`
7859 for potent_lib in $potential_libs; do
7860 # Follow soft links.
7861 if ls -lLd "$potent_lib" 2>/dev/null |
7862 $GREP " -> " >/dev/null; then
7865 # The statement above tries to avoid entering an
7866 # endless loop below, in case of cyclic links.
7867 # We might still enter an endless loop, since a link
7868 # loop can be closed while we follow links,
7870 potlib="$potent_lib"
7871 while test -h "$potlib" 2>/dev/null; do
7872 potliblink=`ls -ld $potlib | ${SED} 's/.* -> //'`
7874 [\\/]* | [A-Za-z]:[\\/]*) potlib="$potliblink";;
7875 *) potlib=`$ECHO "$potlib" | $SED 's,[^/]*$,,'`"$potliblink";;
7878 if eval $file_magic_cmd \"\$potlib\" 2>/dev/null |
7880 $EGREP "$file_magic_regex" > /dev/null; then
7881 func_append newdeplibs " $a_deplib"
7888 if test -n "$a_deplib" ; then
7891 $ECHO "*** Warning: linker path does not have real file for library $a_deplib."
7892 echo "*** I have the capability to make that library automatically link in when"
7893 echo "*** you link to this library. But I can only do this if you have a"
7894 echo "*** shared version of the library, which you do not appear to have"
7895 echo "*** because I did check the linker path looking for a file starting"
7896 if test -z "$potlib" ; then
7897 $ECHO "*** with $libname but no candidates were found. (...for file magic test)"
7899 $ECHO "*** with $libname and none of the candidates passed a file format test"
7900 $ECHO "*** using a file magic. Last file checked: $potlib"
7905 # Add a -L argument.
7906 func_append newdeplibs " $a_deplib"
7909 done # Gone through all deplibs.
7912 set dummy $deplibs_check_method; shift
7913 match_pattern_regex=`expr "$deplibs_check_method" : "$1 \(.*\)"`
7914 for a_deplib in $deplibs; do
7917 func_stripname -l '' "$a_deplib"
7918 name=$func_stripname_result
7919 if test "X$allow_libtool_libs_with_static_runtimes" = "Xyes" ; then
7920 case " $predeps $postdeps " in
7922 func_append newdeplibs " $a_deplib"
7927 if test -n "$a_deplib" ; then
7928 libname=`eval "\\$ECHO \"$libname_spec\""`
7929 for i in $lib_search_path $sys_lib_search_path $shlib_search_path; do
7930 potential_libs=`ls $i/$libname[.-]* 2>/dev/null`
7931 for potent_lib in $potential_libs; do
7932 potlib="$potent_lib" # see symlink-check above in file_magic test
7933 if eval "\$ECHO \"$potent_lib\"" 2>/dev/null | $SED 10q | \
7934 $EGREP "$match_pattern_regex" > /dev/null; then
7935 func_append newdeplibs " $a_deplib"
7942 if test -n "$a_deplib" ; then
7945 $ECHO "*** Warning: linker path does not have real file for library $a_deplib."
7946 echo "*** I have the capability to make that library automatically link in when"
7947 echo "*** you link to this library. But I can only do this if you have a"
7948 echo "*** shared version of the library, which you do not appear to have"
7949 echo "*** because I did check the linker path looking for a file starting"
7950 if test -z "$potlib" ; then
7951 $ECHO "*** with $libname but no candidates were found. (...for regex pattern test)"
7953 $ECHO "*** with $libname and none of the candidates passed a file format test"
7954 $ECHO "*** using a regex pattern. Last file checked: $potlib"
7959 # Add a -L argument.
7960 func_append newdeplibs " $a_deplib"
7963 done # Gone through all deplibs.
7967 tmp_deplibs=`$ECHO " $deplibs" | $SED 's/ -lc$//; s/ -[LR][^ ]*//g'`
7968 if test "X$allow_libtool_libs_with_static_runtimes" = "Xyes" ; then
7969 for i in $predeps $postdeps ; do
7970 # can't use Xsed below, because $i might contain '/'
7971 tmp_deplibs=`$ECHO " $tmp_deplibs" | $SED "s,$i,,"`
7974 case $tmp_deplibs in
7977 if test "X$deplibs_check_method" = "Xnone"; then
7978 echo "*** Warning: inter-library dependencies are not supported in this platform."
7980 echo "*** Warning: inter-library dependencies are not known to be supported."
7982 echo "*** All declared inter-library dependencies are being dropped."
7988 versuffix=$versuffix_save
7990 release=$release_save
7991 libname=$libname_save
7995 *-*-rhapsody* | *-*-darwin1.[012])
7996 # On Rhapsody replace the C library with the System framework
7997 newdeplibs=`$ECHO " $newdeplibs" | $SED 's/ -lc / System.ltframework /'`
8001 if test "$droppeddeps" = yes; then
8002 if test "$module" = yes; then
8004 echo "*** Warning: libtool could not satisfy all declared inter-library"
8005 $ECHO "*** dependencies of module $libname. Therefore, libtool will create"
8006 echo "*** a static module, that should work as long as the dlopening"
8007 echo "*** application is linked with the -dlopen flag."
8008 if test -z "$global_symbol_pipe"; then
8010 echo "*** However, this would only work if libtool was able to extract symbol"
8011 echo "*** lists from a program, using \`nm' or equivalent, but libtool could"
8012 echo "*** not find such a program. So, this module is probably useless."
8013 echo "*** \`nm' from GNU binutils and a full rebuild may help."
8015 if test "$build_old_libs" = no; then
8016 oldlibs="$output_objdir/$libname.$libext"
8017 build_libtool_libs=module
8020 build_libtool_libs=no
8023 echo "*** The inter-library dependencies that have been dropped here will be"
8024 echo "*** automatically added whenever a program is linked with this library"
8025 echo "*** or is declared to -dlopen it."
8027 if test "$allow_undefined" = no; then
8029 echo "*** Since this library must not contain undefined symbols,"
8030 echo "*** because either the platform does not support them or"
8031 echo "*** it was explicitly requested with -no-undefined,"
8032 echo "*** libtool will only create a static version of it."
8033 if test "$build_old_libs" = no; then
8034 oldlibs="$output_objdir/$libname.$libext"
8035 build_libtool_libs=module
8038 build_libtool_libs=no
8043 # Done checking deplibs!
8046 # Time to change all our "foo.ltframework" stuff back to "-framework foo"
8049 newdeplibs=`$ECHO " $newdeplibs" | $SED 's% \([^ $]*\).ltframework% -framework \1%g'`
8050 new_inherited_linker_flags=`$ECHO " $new_inherited_linker_flags" | $SED 's% \([^ $]*\).ltframework% -framework \1%g'`
8051 deplibs=`$ECHO " $deplibs" | $SED 's% \([^ $]*\).ltframework% -framework \1%g'`
8055 # move library search paths that coincide with paths to not yet
8056 # installed libraries to the beginning of the library search list
8058 for path in $notinst_path; do
8059 case " $new_libs " in
8060 *" -L$path/$objdir "*) ;;
8062 case " $deplibs " in
8063 *" -L$path/$objdir "*)
8064 func_append new_libs " -L$path/$objdir" ;;
8069 for deplib in $deplibs; do
8072 case " $new_libs " in
8074 *) func_append new_libs " $deplib" ;;
8077 *) func_append new_libs " $deplib" ;;
8082 # All the library-specific variables (install_libdir is set above).
8087 # Test again, we may have decided not to build it any more
8088 if test "$build_libtool_libs" = yes; then
8089 # Remove ${wl} instances when linking with ld.
8090 # FIXME: should test the right _cmds variable.
8091 case $archive_cmds in
8094 if test "$hardcode_into_libs" = yes; then
8095 # Hardcode the library paths
8098 rpath="$finalize_rpath"
8099 test "$opt_mode" != relink && rpath="$compile_rpath$rpath"
8100 for libdir in $rpath; do
8101 if test -n "$hardcode_libdir_flag_spec"; then
8102 if test -n "$hardcode_libdir_separator"; then
8103 func_replace_sysroot "$libdir"
8104 libdir=$func_replace_sysroot_result
8105 if test -z "$hardcode_libdirs"; then
8106 hardcode_libdirs="$libdir"
8108 # Just accumulate the unique libdirs.
8109 case $hardcode_libdir_separator$hardcode_libdirs$hardcode_libdir_separator in
8110 *"$hardcode_libdir_separator$libdir$hardcode_libdir_separator"*)
8113 func_append hardcode_libdirs "$hardcode_libdir_separator$libdir"
8118 eval flag=\"$hardcode_libdir_flag_spec\"
8119 func_append dep_rpath " $flag"
8121 elif test -n "$runpath_var"; then
8122 case "$perm_rpath " in
8124 *) func_append perm_rpath " $libdir" ;;
8128 # Substitute the hardcoded libdirs into the rpath.
8129 if test -n "$hardcode_libdir_separator" &&
8130 test -n "$hardcode_libdirs"; then
8131 libdir="$hardcode_libdirs"
8132 eval "dep_rpath=\"$hardcode_libdir_flag_spec\""
8134 if test -n "$runpath_var" && test -n "$perm_rpath"; then
8135 # We should set the runpath_var.
8137 for dir in $perm_rpath; do
8138 func_append rpath "$dir:"
8140 eval "$runpath_var='$rpath\$$runpath_var'; export $runpath_var"
8142 test -n "$dep_rpath" && deplibs="$dep_rpath $deplibs"
8145 shlibpath="$finalize_shlibpath"
8146 test "$opt_mode" != relink && shlibpath="$compile_shlibpath$shlibpath"
8147 if test -n "$shlibpath"; then
8148 eval "$shlibpath_var='$shlibpath\$$shlibpath_var'; export $shlibpath_var"
8151 # Get the real and link names of the library.
8152 eval shared_ext=\"$shrext_cmds\"
8153 eval library_names=\"$library_names_spec\"
8154 set dummy $library_names
8159 if test -n "$soname_spec"; then
8160 eval soname=\"$soname_spec\"
8164 if test -z "$dlname"; then
8168 lib="$output_objdir/$realname"
8172 func_append linknames " $link"
8175 # Use standard objects if they are pic
8176 test -z "$pic_flag" && libobjs=`$ECHO "$libobjs" | $SP2NL | $SED "$lo2o" | $NL2SP`
8177 test "X$libobjs" = "X " && libobjs=
8180 if test -n "$export_symbols" && test -n "$include_expsyms"; then
8181 $opt_dry_run || cp "$export_symbols" "$output_objdir/$libname.uexp"
8182 export_symbols="$output_objdir/$libname.uexp"
8183 func_append delfiles " $export_symbols"
8186 orig_export_symbols=
8188 cygwin* | mingw* | cegcc*)
8189 if test -n "$export_symbols" && test -z "$export_symbols_regex"; then
8190 # exporting using user supplied symfile
8191 if test "x`$SED 1q $export_symbols`" != xEXPORTS; then
8192 # and it's NOT already a .def file. Must figure out
8193 # which of the given symbols are data symbols and tag
8194 # them as such. So, trigger use of export_symbols_cmds.
8195 # export_symbols gets reassigned inside the "prepare
8196 # the list of exported symbols" if statement, so the
8197 # include_expsyms logic still works.
8198 orig_export_symbols="$export_symbols"
8200 always_export_symbols=yes
8206 # Prepare the list of exported symbols
8207 if test -z "$export_symbols"; then
8208 if test "$always_export_symbols" = yes || test -n "$export_symbols_regex"; then
8209 func_verbose "generating symbol list for \`$libname.la'"
8210 export_symbols="$output_objdir/$libname.exp"
8211 $opt_dry_run || $RM $export_symbols
8212 cmds=$export_symbols_cmds
8213 save_ifs="$IFS"; IFS='~'
8214 for cmd1 in $cmds; do
8216 # Take the normal branch if the nm_file_list_spec branch
8217 # doesn't work or if tool conversion is not needed.
8218 case $nm_file_list_spec~$to_tool_file_cmd in
8219 *~func_convert_file_noop | *~func_convert_file_msys_to_w32 | ~*)
8220 try_normal_branch=yes
8223 len=$func_len_result
8226 try_normal_branch=no
8229 if test "$try_normal_branch" = yes \
8230 && { test "$len" -lt "$max_cmd_len" \
8231 || test "$max_cmd_len" -le -1; }
8233 func_show_eval "$cmd" 'exit $?'
8234 skipped_export=false
8235 elif test -n "$nm_file_list_spec"; then
8236 func_basename "$output"
8237 output_la=$func_basename_result
8238 save_libobjs=$libobjs
8240 output=${output_objdir}/${output_la}.nm
8241 func_to_tool_file "$output"
8242 libobjs=$nm_file_list_spec$func_to_tool_file_result
8243 func_append delfiles " $output"
8244 func_verbose "creating $NM input file list: $output"
8245 for obj in $save_libobjs; do
8246 func_to_tool_file "$obj"
8247 $ECHO "$func_to_tool_file_result"
8250 func_show_eval "$cmd" 'exit $?'
8252 libobjs=$save_libobjs
8253 skipped_export=false
8255 # The command line is too long to execute in one step.
8256 func_verbose "using reloadable object file for export list..."
8258 # Break out early, otherwise skipped_export may be
8259 # set to false by a later but shorter cmd.
8264 if test -n "$export_symbols_regex" && test "X$skipped_export" != "X:"; then
8265 func_show_eval '$EGREP -e "$export_symbols_regex" "$export_symbols" > "${export_symbols}T"'
8266 func_show_eval '$MV "${export_symbols}T" "$export_symbols"'
8271 if test -n "$export_symbols" && test -n "$include_expsyms"; then
8272 tmp_export_symbols="$export_symbols"
8273 test -n "$orig_export_symbols" && tmp_export_symbols="$orig_export_symbols"
8274 $opt_dry_run || eval '$ECHO "$include_expsyms" | $SP2NL >> "$tmp_export_symbols"'
8277 if test "X$skipped_export" != "X:" && test -n "$orig_export_symbols"; then
8278 # The given exports_symbols file has to be filtered, so filter it.
8279 func_verbose "filter symbol list for \`$libname.la' to tag DATA exports"
8280 # FIXME: $output_objdir/$libname.filter potentially contains lots of
8281 # 's' commands which not all seds can handle. GNU sed should be fine
8282 # though. Also, the filter scales superlinearly with the number of
8283 # global variables. join(1) would be nice here, but unfortunately
8284 # isn't a blessed tool.
8285 $opt_dry_run || $SED -e '/[ ,]DATA/!d;s,\(.*\)\([ \,].*\),s|^\1$|\1\2|,' < $export_symbols > $output_objdir/$libname.filter
8286 func_append delfiles " $export_symbols $output_objdir/$libname.filter"
8287 export_symbols=$output_objdir/$libname.def
8288 $opt_dry_run || $SED -f $output_objdir/$libname.filter < $orig_export_symbols > $export_symbols
8292 for test_deplib in $deplibs; do
8293 case " $convenience " in
8294 *" $test_deplib "*) ;;
8296 func_append tmp_deplibs " $test_deplib"
8300 deplibs="$tmp_deplibs"
8302 if test -n "$convenience"; then
8303 if test -n "$whole_archive_flag_spec" &&
8304 test "$compiler_needs_object" = yes &&
8305 test -z "$libobjs"; then
8306 # extract the archives, so we have objects to list.
8307 # TODO: could optimize this to just extract one archive.
8308 whole_archive_flag_spec=
8310 if test -n "$whole_archive_flag_spec"; then
8311 save_libobjs=$libobjs
8312 eval libobjs=\"\$libobjs $whole_archive_flag_spec\"
8313 test "X$libobjs" = "X " && libobjs=
8315 gentop="$output_objdir/${outputname}x"
8316 func_append generated " $gentop"
8318 func_extract_archives $gentop $convenience
8319 func_append libobjs " $func_extract_archives_result"
8320 test "X$libobjs" = "X " && libobjs=
8324 if test "$thread_safe" = yes && test -n "$thread_safe_flag_spec"; then
8325 eval flag=\"$thread_safe_flag_spec\"
8326 func_append linker_flags " $flag"
8329 # Make a backup of the uninstalled library when relinking
8330 if test "$opt_mode" = relink; then
8331 $opt_dry_run || eval '(cd $output_objdir && $RM ${realname}U && $MV $realname ${realname}U)' || exit $?
8334 # Do each of the archive commands.
8335 if test "$module" = yes && test -n "$module_cmds" ; then
8336 if test -n "$export_symbols" && test -n "$module_expsym_cmds"; then
8337 eval test_cmds=\"$module_expsym_cmds\"
8338 cmds=$module_expsym_cmds
8340 eval test_cmds=\"$module_cmds\"
8344 if test -n "$export_symbols" && test -n "$archive_expsym_cmds"; then
8345 eval test_cmds=\"$archive_expsym_cmds\"
8346 cmds=$archive_expsym_cmds
8348 eval test_cmds=\"$archive_cmds\"
8353 if test "X$skipped_export" != "X:" &&
8354 func_len " $test_cmds" &&
8355 len=$func_len_result &&
8356 test "$len" -lt "$max_cmd_len" || test "$max_cmd_len" -le -1; then
8359 # The command line is too long to link in one step, link piecewise
8360 # or, if using GNU ld and skipped_export is not :, use a linker
8363 # Save the value of $output and $libobjs because we want to
8364 # use them later. If we have whole_archive_flag_spec, we
8365 # want to use save_libobjs as it was before
8366 # whole_archive_flag_spec was expanded, because we can't
8367 # assume the linker understands whole_archive_flag_spec.
8368 # This may have to be revisited, in case too many
8369 # convenience libraries get linked in and end up exceeding
8371 if test -z "$convenience" || test -z "$whole_archive_flag_spec"; then
8372 save_libobjs=$libobjs
8375 func_basename "$output"
8376 output_la=$func_basename_result
8378 # Clear the reloadable object creation command queue and
8379 # initialize k to one.
8386 if test -n "$save_libobjs" && test "X$skipped_export" != "X:" && test "$with_gnu_ld" = yes; then
8387 output=${output_objdir}/${output_la}.lnkscript
8388 func_verbose "creating GNU ld script: $output"
8389 echo 'INPUT (' > $output
8390 for obj in $save_libobjs
8392 func_to_tool_file "$obj"
8393 $ECHO "$func_to_tool_file_result" >> $output
8396 func_append delfiles " $output"
8397 func_to_tool_file "$output"
8398 output=$func_to_tool_file_result
8399 elif test -n "$save_libobjs" && test "X$skipped_export" != "X:" && test "X$file_list_spec" != X; then
8400 output=${output_objdir}/${output_la}.lnk
8401 func_verbose "creating linker input file list: $output"
8406 if test "$compiler_needs_object" = yes; then
8412 func_to_tool_file "$obj"
8413 $ECHO "$func_to_tool_file_result" >> $output
8415 func_append delfiles " $output"
8416 func_to_tool_file "$output"
8417 output=$firstobj\"$file_list_spec$func_to_tool_file_result\"
8419 if test -n "$save_libobjs"; then
8420 func_verbose "creating reloadable object files..."
8421 output=$output_objdir/$output_la-${k}.$objext
8422 eval test_cmds=\"$reload_cmds\"
8423 func_len " $test_cmds"
8424 len0=$func_len_result
8427 # Loop over the list of objects to be linked.
8428 for obj in $save_libobjs
8431 func_arith $len + $func_len_result
8432 len=$func_arith_result
8433 if test "X$objlist" = X ||
8434 test "$len" -lt "$max_cmd_len"; then
8435 func_append objlist " $obj"
8437 # The command $test_cmds is almost too long, add a
8438 # command to the queue.
8439 if test "$k" -eq 1 ; then
8440 # The first file doesn't have a previous command to add.
8441 reload_objs=$objlist
8442 eval concat_cmds=\"$reload_cmds\"
8444 # All subsequent reloadable object files will link in
8445 # the last one created.
8446 reload_objs="$objlist $last_robj"
8447 eval concat_cmds=\"\$concat_cmds~$reload_cmds~\$RM $last_robj\"
8449 last_robj=$output_objdir/$output_la-${k}.$objext
8451 k=$func_arith_result
8452 output=$output_objdir/$output_la-${k}.$objext
8454 func_len " $last_robj"
8455 func_arith $len0 + $func_len_result
8456 len=$func_arith_result
8459 # Handle the remaining objects by creating one last
8460 # reloadable object file. All subsequent reloadable object
8461 # files will link in the last one created.
8462 test -z "$concat_cmds" || concat_cmds=$concat_cmds~
8463 reload_objs="$objlist $last_robj"
8464 eval concat_cmds=\"\${concat_cmds}$reload_cmds\"
8465 if test -n "$last_robj"; then
8466 eval concat_cmds=\"\${concat_cmds}~\$RM $last_robj\"
8468 func_append delfiles " $output"
8474 if ${skipped_export-false}; then
8475 func_verbose "generating symbol list for \`$libname.la'"
8476 export_symbols="$output_objdir/$libname.exp"
8477 $opt_dry_run || $RM $export_symbols
8479 # Append the command to create the export file.
8480 test -z "$concat_cmds" || concat_cmds=$concat_cmds~
8481 eval concat_cmds=\"\$concat_cmds$export_symbols_cmds\"
8482 if test -n "$last_robj"; then
8483 eval concat_cmds=\"\$concat_cmds~\$RM $last_robj\"
8487 test -n "$save_libobjs" &&
8488 func_verbose "creating a temporary reloadable object file: $output"
8490 # Loop through the commands generated above and execute them.
8491 save_ifs="$IFS"; IFS='~'
8492 for cmd in $concat_cmds; do
8495 func_quote_for_expand "$cmd"
8496 eval "func_echo $func_quote_for_expand_result"
8498 $opt_dry_run || eval "$cmd" || {
8501 # Restore the uninstalled library and exit
8502 if test "$opt_mode" = relink; then
8503 ( cd "$output_objdir" && \
8504 $RM "${realname}T" && \
8505 $MV "${realname}U" "$realname" )
8513 if test -n "$export_symbols_regex" && ${skipped_export-false}; then
8514 func_show_eval '$EGREP -e "$export_symbols_regex" "$export_symbols" > "${export_symbols}T"'
8515 func_show_eval '$MV "${export_symbols}T" "$export_symbols"'
8519 if ${skipped_export-false}; then
8520 if test -n "$export_symbols" && test -n "$include_expsyms"; then
8521 tmp_export_symbols="$export_symbols"
8522 test -n "$orig_export_symbols" && tmp_export_symbols="$orig_export_symbols"
8523 $opt_dry_run || eval '$ECHO "$include_expsyms" | $SP2NL >> "$tmp_export_symbols"'
8526 if test -n "$orig_export_symbols"; then
8527 # The given exports_symbols file has to be filtered, so filter it.
8528 func_verbose "filter symbol list for \`$libname.la' to tag DATA exports"
8529 # FIXME: $output_objdir/$libname.filter potentially contains lots of
8530 # 's' commands which not all seds can handle. GNU sed should be fine
8531 # though. Also, the filter scales superlinearly with the number of
8532 # global variables. join(1) would be nice here, but unfortunately
8533 # isn't a blessed tool.
8534 $opt_dry_run || $SED -e '/[ ,]DATA/!d;s,\(.*\)\([ \,].*\),s|^\1$|\1\2|,' < $export_symbols > $output_objdir/$libname.filter
8535 func_append delfiles " $export_symbols $output_objdir/$libname.filter"
8536 export_symbols=$output_objdir/$libname.def
8537 $opt_dry_run || $SED -f $output_objdir/$libname.filter < $orig_export_symbols > $export_symbols
8542 # Restore the value of output.
8545 if test -n "$convenience" && test -n "$whole_archive_flag_spec"; then
8546 eval libobjs=\"\$libobjs $whole_archive_flag_spec\"
8547 test "X$libobjs" = "X " && libobjs=
8549 # Expand the library linking commands again to reset the
8550 # value of $libobjs for piecewise linking.
8552 # Do each of the archive commands.
8553 if test "$module" = yes && test -n "$module_cmds" ; then
8554 if test -n "$export_symbols" && test -n "$module_expsym_cmds"; then
8555 cmds=$module_expsym_cmds
8560 if test -n "$export_symbols" && test -n "$archive_expsym_cmds"; then
8561 cmds=$archive_expsym_cmds
8568 if test -n "$delfiles"; then
8569 # Append the command to remove temporary files to $cmds.
8570 eval cmds=\"\$cmds~\$RM $delfiles\"
8573 # Add any objects from preloaded convenience libraries
8574 if test -n "$dlprefiles"; then
8575 gentop="$output_objdir/${outputname}x"
8576 func_append generated " $gentop"
8578 func_extract_archives $gentop $dlprefiles
8579 func_append libobjs " $func_extract_archives_result"
8580 test "X$libobjs" = "X " && libobjs=
8583 save_ifs="$IFS"; IFS='~'
8584 for cmd in $cmds; do
8588 func_quote_for_expand "$cmd"
8589 eval "func_echo $func_quote_for_expand_result"
8591 $opt_dry_run || eval "$cmd" || {
8594 # Restore the uninstalled library and exit
8595 if test "$opt_mode" = relink; then
8596 ( cd "$output_objdir" && \
8597 $RM "${realname}T" && \
8598 $MV "${realname}U" "$realname" )
8606 # Restore the uninstalled library and exit
8607 if test "$opt_mode" = relink; then
8608 $opt_dry_run || eval '(cd $output_objdir && $RM ${realname}T && $MV $realname ${realname}T && $MV ${realname}U $realname)' || exit $?
8610 if test -n "$convenience"; then
8611 if test -z "$whole_archive_flag_spec"; then
8612 func_show_eval '${RM}r "$gentop"'
8619 # Create links to the real library.
8620 for linkname in $linknames; do
8621 if test "$realname" != "$linkname"; then
8622 func_show_eval '(cd "$output_objdir" && $RM "$linkname" && $LN_S "$realname" "$linkname")' 'exit $?'
8626 # If -module or -export-dynamic was specified, set the dlname.
8627 if test "$module" = yes || test "$export_dynamic" = yes; then
8628 # On all known operating systems, these are identical.
8635 if test -n "$dlfiles$dlprefiles" || test "$dlself" != no; then
8636 func_warning "\`-dlopen' is ignored for objects"
8641 func_warning "\`-l' and \`-L' are ignored for objects" ;;
8644 test -n "$rpath" && \
8645 func_warning "\`-rpath' is ignored for objects"
8647 test -n "$xrpath" && \
8648 func_warning "\`-R' is ignored for objects"
8650 test -n "$vinfo" && \
8651 func_warning "\`-version-info' is ignored for objects"
8653 test -n "$release" && \
8654 func_warning "\`-release' is ignored for objects"
8658 test -n "$objs$old_deplibs" && \
8659 func_fatal_error "cannot build library object \`$output' from non-libtool objects"
8663 obj=$func_lo2o_result
8671 # Delete the old objects.
8672 $opt_dry_run || $RM $obj $libobj
8674 # Objects from convenience libraries. This assumes
8675 # single-version convenience libraries. Whenever we create
8676 # different ones for PIC/non-PIC, this we'll have to duplicate
8680 # reload_cmds runs $LD directly, so let us get rid of
8681 # -Wl from whole_archive_flag_spec and hope we can get by with
8682 # turning comma into space..
8685 if test -n "$convenience"; then
8686 if test -n "$whole_archive_flag_spec"; then
8687 eval tmp_whole_archive_flags=\"$whole_archive_flag_spec\"
8688 reload_conv_objs=$reload_objs\ `$ECHO "$tmp_whole_archive_flags" | $SED 's|,| |g'`
8690 gentop="$output_objdir/${obj}x"
8691 func_append generated " $gentop"
8693 func_extract_archives $gentop $convenience
8694 reload_conv_objs="$reload_objs $func_extract_archives_result"
8698 # If we're not building shared, we need to use non_pic_objs
8699 test "$build_libtool_libs" != yes && libobjs="$non_pic_objects"
8701 # Create the old-style object.
8702 reload_objs="$objs$old_deplibs "`$ECHO "$libobjs" | $SP2NL | $SED "/\.${libext}$/d; /\.lib$/d; $lo2o" | $NL2SP`" $reload_conv_objs" ### testsuite: skip nested quoting test
8705 func_execute_cmds "$reload_cmds" 'exit $?'
8707 # Exit if we aren't doing a library object file.
8708 if test -z "$libobj"; then
8709 if test -n "$gentop"; then
8710 func_show_eval '${RM}r "$gentop"'
8716 if test "$build_libtool_libs" != yes; then
8717 if test -n "$gentop"; then
8718 func_show_eval '${RM}r "$gentop"'
8721 # Create an invalid libtool object if no PIC, so that we don't
8722 # accidentally link it into a program.
8723 # $show "echo timestamp > $libobj"
8724 # $opt_dry_run || eval "echo timestamp > $libobj" || exit $?
8728 if test -n "$pic_flag" || test "$pic_mode" != default; then
8729 # Only do commands if we really have different PIC objects.
8730 reload_objs="$libobjs $reload_conv_objs"
8732 func_execute_cmds "$reload_cmds" 'exit $?'
8735 if test -n "$gentop"; then
8736 func_show_eval '${RM}r "$gentop"'
8744 *cygwin*) func_stripname '' '.exe' "$output"
8745 output=$func_stripname_result.exe;;
8747 test -n "$vinfo" && \
8748 func_warning "\`-version-info' is ignored for programs"
8750 test -n "$release" && \
8751 func_warning "\`-release' is ignored for programs"
8753 test "$preload" = yes \
8754 && test "$dlopen_support" = unknown \
8755 && test "$dlopen_self" = unknown \
8756 && test "$dlopen_self_static" = unknown && \
8757 func_warning "\`LT_INIT([dlopen])' not used. Assuming no dlopen support."
8760 *-*-rhapsody* | *-*-darwin1.[012])
8761 # On Rhapsody replace the C library is the System framework
8762 compile_deplibs=`$ECHO " $compile_deplibs" | $SED 's/ -lc / System.ltframework /'`
8763 finalize_deplibs=`$ECHO " $finalize_deplibs" | $SED 's/ -lc / System.ltframework /'`
8769 # Don't allow lazy linking, it breaks C++ global constructors
8770 # But is supposedly fixed on 10.4 or later (yay!).
8771 if test "$tagname" = CXX ; then
8772 case ${MACOSX_DEPLOYMENT_TARGET-10.0} in
8774 func_append compile_command " ${wl}-bind_at_load"
8775 func_append finalize_command " ${wl}-bind_at_load"
8779 # Time to change all our "foo.ltframework" stuff back to "-framework foo"
8780 compile_deplibs=`$ECHO " $compile_deplibs" | $SED 's% \([^ $]*\).ltframework% -framework \1%g'`
8781 finalize_deplibs=`$ECHO " $finalize_deplibs" | $SED 's% \([^ $]*\).ltframework% -framework \1%g'`
8786 # move library search paths that coincide with paths to not yet
8787 # installed libraries to the beginning of the library search list
8789 for path in $notinst_path; do
8790 case " $new_libs " in
8791 *" -L$path/$objdir "*) ;;
8793 case " $compile_deplibs " in
8794 *" -L$path/$objdir "*)
8795 func_append new_libs " -L$path/$objdir" ;;
8800 for deplib in $compile_deplibs; do
8803 case " $new_libs " in
8805 *) func_append new_libs " $deplib" ;;
8808 *) func_append new_libs " $deplib" ;;
8811 compile_deplibs="$new_libs"
8814 func_append compile_command " $compile_deplibs"
8815 func_append finalize_command " $finalize_deplibs"
8817 if test -n "$rpath$xrpath"; then
8818 # If the user specified any rpath flags, then add them.
8819 for libdir in $rpath $xrpath; do
8820 # This is the magic to use -rpath.
8821 case "$finalize_rpath " in
8823 *) func_append finalize_rpath " $libdir" ;;
8828 # Now hardcode the library paths
8831 for libdir in $compile_rpath $finalize_rpath; do
8832 if test -n "$hardcode_libdir_flag_spec"; then
8833 if test -n "$hardcode_libdir_separator"; then
8834 if test -z "$hardcode_libdirs"; then
8835 hardcode_libdirs="$libdir"
8837 # Just accumulate the unique libdirs.
8838 case $hardcode_libdir_separator$hardcode_libdirs$hardcode_libdir_separator in
8839 *"$hardcode_libdir_separator$libdir$hardcode_libdir_separator"*)
8842 func_append hardcode_libdirs "$hardcode_libdir_separator$libdir"
8847 eval flag=\"$hardcode_libdir_flag_spec\"
8848 func_append rpath " $flag"
8850 elif test -n "$runpath_var"; then
8851 case "$perm_rpath " in
8853 *) func_append perm_rpath " $libdir" ;;
8857 *-*-cygwin* | *-*-mingw* | *-*-pw32* | *-*-os2* | *-cegcc*)
8858 testbindir=`${ECHO} "$libdir" | ${SED} -e 's*/lib$*/bin*'`
8859 case :$dllsearchpath: in
8861 ::) dllsearchpath=$libdir;;
8862 *) func_append dllsearchpath ":$libdir";;
8864 case :$dllsearchpath: in
8865 *":$testbindir:"*) ;;
8866 ::) dllsearchpath=$testbindir;;
8867 *) func_append dllsearchpath ":$testbindir";;
8872 # Substitute the hardcoded libdirs into the rpath.
8873 if test -n "$hardcode_libdir_separator" &&
8874 test -n "$hardcode_libdirs"; then
8875 libdir="$hardcode_libdirs"
8876 eval rpath=\" $hardcode_libdir_flag_spec\"
8878 compile_rpath="$rpath"
8882 for libdir in $finalize_rpath; do
8883 if test -n "$hardcode_libdir_flag_spec"; then
8884 if test -n "$hardcode_libdir_separator"; then
8885 if test -z "$hardcode_libdirs"; then
8886 hardcode_libdirs="$libdir"
8888 # Just accumulate the unique libdirs.
8889 case $hardcode_libdir_separator$hardcode_libdirs$hardcode_libdir_separator in
8890 *"$hardcode_libdir_separator$libdir$hardcode_libdir_separator"*)
8893 func_append hardcode_libdirs "$hardcode_libdir_separator$libdir"
8898 eval flag=\"$hardcode_libdir_flag_spec\"
8899 func_append rpath " $flag"
8901 elif test -n "$runpath_var"; then
8902 case "$finalize_perm_rpath " in
8904 *) func_append finalize_perm_rpath " $libdir" ;;
8908 # Substitute the hardcoded libdirs into the rpath.
8909 if test -n "$hardcode_libdir_separator" &&
8910 test -n "$hardcode_libdirs"; then
8911 libdir="$hardcode_libdirs"
8912 eval rpath=\" $hardcode_libdir_flag_spec\"
8914 finalize_rpath="$rpath"
8916 if test -n "$libobjs" && test "$build_old_libs" = yes; then
8917 # Transform all the library objects into standard objects.
8918 compile_command=`$ECHO "$compile_command" | $SP2NL | $SED "$lo2o" | $NL2SP`
8919 finalize_command=`$ECHO "$finalize_command" | $SP2NL | $SED "$lo2o" | $NL2SP`
8922 func_generate_dlsyms "$outputname" "@PROGRAM@" "no"
8924 # template prelinking step
8925 if test -n "$prelink_cmds"; then
8926 func_execute_cmds "$prelink_cmds" 'exit $?'
8929 wrappers_required=yes
8931 *cegcc* | *mingw32ce*)
8932 # Disable wrappers for cegcc and mingw32ce hosts, we are cross compiling anyway.
8933 wrappers_required=no
8935 *cygwin* | *mingw* )
8936 if test "$build_libtool_libs" != yes; then
8937 wrappers_required=no
8941 if test "$need_relink" = no || test "$build_libtool_libs" != yes; then
8942 wrappers_required=no
8946 if test "$wrappers_required" = no; then
8947 # Replace the output file specification.
8948 compile_command=`$ECHO "$compile_command" | $SED 's%@OUTPUT@%'"$output"'%g'`
8949 link_command="$compile_command$compile_rpath"
8951 # We have no uninstalled library dependencies, so finalize right now.
8953 func_show_eval "$link_command" 'exit_status=$?'
8955 if test -n "$postlink_cmds"; then
8956 func_to_tool_file "$output"
8957 postlink_cmds=`func_echo_all "$postlink_cmds" | $SED -e 's%@OUTPUT@%'"$output"'%g' -e 's%@TOOL_OUTPUT@%'"$func_to_tool_file_result"'%g'`
8958 func_execute_cmds "$postlink_cmds" 'exit $?'
8961 # Delete the generated files.
8962 if test -f "$output_objdir/${outputname}S.${objext}"; then
8963 func_show_eval '$RM "$output_objdir/${outputname}S.${objext}"'
8969 if test -n "$compile_shlibpath$finalize_shlibpath"; then
8970 compile_command="$shlibpath_var=\"$compile_shlibpath$finalize_shlibpath\$$shlibpath_var\" $compile_command"
8972 if test -n "$finalize_shlibpath"; then
8973 finalize_command="$shlibpath_var=\"$finalize_shlibpath\$$shlibpath_var\" $finalize_command"
8978 if test -n "$runpath_var"; then
8979 if test -n "$perm_rpath"; then
8980 # We should set the runpath_var.
8982 for dir in $perm_rpath; do
8983 func_append rpath "$dir:"
8985 compile_var="$runpath_var=\"$rpath\$$runpath_var\" "
8987 if test -n "$finalize_perm_rpath"; then
8988 # We should set the runpath_var.
8990 for dir in $finalize_perm_rpath; do
8991 func_append rpath "$dir:"
8993 finalize_var="$runpath_var=\"$rpath\$$runpath_var\" "
8997 if test "$no_install" = yes; then
8998 # We don't need to create a wrapper script.
8999 link_command="$compile_var$compile_command$compile_rpath"
9000 # Replace the output file specification.
9001 link_command=`$ECHO "$link_command" | $SED 's%@OUTPUT@%'"$output"'%g'`
9002 # Delete the old output file.
9003 $opt_dry_run || $RM $output
9004 # Link the executable and exit
9005 func_show_eval "$link_command" 'exit $?'
9007 if test -n "$postlink_cmds"; then
9008 func_to_tool_file "$output"
9009 postlink_cmds=`func_echo_all "$postlink_cmds" | $SED -e 's%@OUTPUT@%'"$output"'%g' -e 's%@TOOL_OUTPUT@%'"$func_to_tool_file_result"'%g'`
9010 func_execute_cmds "$postlink_cmds" 'exit $?'
9016 if test "$hardcode_action" = relink; then
9017 # Fast installation is not supported
9018 link_command="$compile_var$compile_command$compile_rpath"
9019 relink_command="$finalize_var$finalize_command$finalize_rpath"
9021 func_warning "this platform does not like uninstalled shared libraries"
9022 func_warning "\`$output' will be relinked during installation"
9024 if test "$fast_install" != no; then
9025 link_command="$finalize_var$compile_command$finalize_rpath"
9026 if test "$fast_install" = yes; then
9027 relink_command=`$ECHO "$compile_var$compile_command$compile_rpath" | $SED 's%@OUTPUT@%\$progdir/\$file%g'`
9029 # fast_install is set to needless
9033 link_command="$compile_var$compile_command$compile_rpath"
9034 relink_command="$finalize_var$finalize_command$finalize_rpath"
9038 # Replace the output file specification.
9039 link_command=`$ECHO "$link_command" | $SED 's%@OUTPUT@%'"$output_objdir/$outputname"'%g'`
9041 # Delete the old output files.
9042 $opt_dry_run || $RM $output $output_objdir/$outputname $output_objdir/lt-$outputname
9044 func_show_eval "$link_command" 'exit $?'
9046 if test -n "$postlink_cmds"; then
9047 func_to_tool_file "$output_objdir/$outputname"
9048 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'`
9049 func_execute_cmds "$postlink_cmds" 'exit $?'
9052 # Now create the wrapper script.
9053 func_verbose "creating $output"
9055 # Quote the relink command for shipping.
9056 if test -n "$relink_command"; then
9057 # Preserve any variables that may affect compiler behavior
9058 for var in $variables_saved_for_relink; do
9059 if eval test -z \"\${$var+set}\"; then
9060 relink_command="{ test -z \"\${$var+set}\" || $lt_unset $var || { $var=; export $var; }; }; $relink_command"
9061 elif eval var_value=\$$var; test -z "$var_value"; then
9062 relink_command="$var=; export $var; $relink_command"
9064 func_quote_for_eval "$var_value"
9065 relink_command="$var=$func_quote_for_eval_result; export $var; $relink_command"
9068 relink_command="(cd `pwd`; $relink_command)"
9069 relink_command=`$ECHO "$relink_command" | $SED "$sed_quote_subst"`
9072 # Only actually do things if not in dry run mode.
9074 # win32 will think the script is a binary if it has
9075 # a .exe suffix, so we strip it off here.
9077 *.exe) func_stripname '' '.exe' "$output"
9078 output=$func_stripname_result ;;
9080 # test for cygwin because mv fails w/o .exe extensions
9084 func_stripname '' '.exe' "$outputname"
9085 outputname=$func_stripname_result ;;
9089 *cygwin* | *mingw* )
9090 func_dirname_and_basename "$output" "" "."
9091 output_name=$func_basename_result
9092 output_path=$func_dirname_result
9093 cwrappersource="$output_path/$objdir/lt-$output_name.c"
9094 cwrapper="$output_path/$output_name.exe"
9095 $RM $cwrappersource $cwrapper
9096 trap "$RM $cwrappersource $cwrapper; exit $EXIT_FAILURE" 1 2 15
9098 func_emit_cwrapperexe_src > $cwrappersource
9100 # The wrapper executable is built using the $host compiler,
9101 # because it contains $host paths and files. If cross-
9102 # compiling, it, like the target executable, must be
9103 # executed on the $host or under an emulation environment.
9105 $LTCC $LTCFLAGS -o $cwrapper $cwrappersource
9109 # Now, create the wrapper script for func_source use:
9110 func_ltwrapper_scriptname $cwrapper
9111 $RM $func_ltwrapper_scriptname_result
9112 trap "$RM $func_ltwrapper_scriptname_result; exit $EXIT_FAILURE" 1 2 15
9114 # note: this script will not be executed, so do not chmod.
9115 if test "x$build" = "x$host" ; then
9116 $cwrapper --lt-dump-script > $func_ltwrapper_scriptname_result
9118 func_emit_wrapper no > $func_ltwrapper_scriptname_result
9124 trap "$RM $output; exit $EXIT_FAILURE" 1 2 15
9126 func_emit_wrapper no > $output
9135 # See if we need to build an old-fashioned archive.
9136 for oldlib in $oldlibs; do
9138 if test "$build_libtool_libs" = convenience; then
9139 oldobjs="$libobjs_save $symfileobj"
9140 addlibs="$convenience"
9141 build_libtool_libs=no
9143 if test "$build_libtool_libs" = module; then
9144 oldobjs="$libobjs_save"
9145 build_libtool_libs=no
9147 oldobjs="$old_deplibs $non_pic_objects"
9148 if test "$preload" = yes && test -f "$symfileobj"; then
9149 func_append oldobjs " $symfileobj"
9152 addlibs="$old_convenience"
9155 if test -n "$addlibs"; then
9156 gentop="$output_objdir/${outputname}x"
9157 func_append generated " $gentop"
9159 func_extract_archives $gentop $addlibs
9160 func_append oldobjs " $func_extract_archives_result"
9163 # Do each command in the archive commands.
9164 if test -n "$old_archive_from_new_cmds" && test "$build_libtool_libs" = yes; then
9165 cmds=$old_archive_from_new_cmds
9168 # Add any objects from preloaded convenience libraries
9169 if test -n "$dlprefiles"; then
9170 gentop="$output_objdir/${outputname}x"
9171 func_append generated " $gentop"
9173 func_extract_archives $gentop $dlprefiles
9174 func_append oldobjs " $func_extract_archives_result"
9177 # POSIX demands no paths to be encoded in archives. We have
9178 # to avoid creating archives with duplicate basenames if we
9179 # might have to extract them afterwards, e.g., when creating a
9180 # static archive out of a convenience library, or when linking
9181 # the entirety of a libtool archive into another (currently
9182 # not supported by libtool).
9183 if (for obj in $oldobjs
9185 func_basename "$obj"
9186 $ECHO "$func_basename_result"
9187 done | sort | sort -uc >/dev/null 2>&1); then
9190 echo "copying selected object files to avoid basename conflicts..."
9191 gentop="$output_objdir/${outputname}x"
9192 func_append generated " $gentop"
9193 func_mkdir_p "$gentop"
9194 save_oldobjs=$oldobjs
9197 for obj in $save_oldobjs
9199 func_basename "$obj"
9200 objbase="$func_basename_result"
9201 case " $oldobjs " in
9202 " ") oldobjs=$obj ;;
9205 # Make sure we don't pick an alternate name that also
9207 newobj=lt$counter-$objbase
9208 func_arith $counter + 1
9209 counter=$func_arith_result
9210 case " $oldobjs " in
9211 *[\ /]"$newobj "*) ;;
9212 *) if test ! -f "$gentop/$newobj"; then break; fi ;;
9215 func_show_eval "ln $obj $gentop/$newobj || cp $obj $gentop/$newobj"
9216 func_append oldobjs " $gentop/$newobj"
9218 *) func_append oldobjs " $obj" ;;
9222 func_to_tool_file "$oldlib" func_convert_file_msys_to_w32
9223 tool_oldlib=$func_to_tool_file_result
9224 eval cmds=\"$old_archive_cmds\"
9227 len=$func_len_result
9228 if test "$len" -lt "$max_cmd_len" || test "$max_cmd_len" -le -1; then
9229 cmds=$old_archive_cmds
9230 elif test -n "$archiver_list_spec"; then
9231 func_verbose "using command file archive linking..."
9234 func_to_tool_file "$obj"
9235 $ECHO "$func_to_tool_file_result"
9236 done > $output_objdir/$libname.libcmd
9237 func_to_tool_file "$output_objdir/$libname.libcmd"
9238 oldobjs=" $archiver_list_spec$func_to_tool_file_result"
9239 cmds=$old_archive_cmds
9241 # the command line is too long to link in one step, link in parts
9242 func_verbose "using piecewise archive linking..."
9247 save_oldobjs=$oldobjs
9249 # Is there a better way of finding the last object in the list?
9250 for obj in $save_oldobjs
9254 eval test_cmds=\"$old_archive_cmds\"
9255 func_len " $test_cmds"
9256 len0=$func_len_result
9258 for obj in $save_oldobjs
9261 func_arith $len + $func_len_result
9262 len=$func_arith_result
9263 func_append objlist " $obj"
9264 if test "$len" -lt "$max_cmd_len"; then
9267 # the above command should be used before it gets too long
9269 if test "$obj" = "$last_oldobj" ; then
9272 test -z "$concat_cmds" || concat_cmds=$concat_cmds~
9273 eval concat_cmds=\"\${concat_cmds}$old_archive_cmds\"
9280 if test "X$oldobjs" = "X" ; then
9281 eval cmds=\"\$concat_cmds\"
9283 eval cmds=\"\$concat_cmds~\$old_archive_cmds\"
9287 func_execute_cmds "$cmds" 'exit $?'
9290 test -n "$generated" && \
9291 func_show_eval "${RM}r$generated"
9293 # Now create the libtool archive.
9297 test "$build_old_libs" = yes && old_library="$libname.$libext"
9298 func_verbose "creating $output"
9300 # Preserve any variables that may affect compiler behavior
9301 for var in $variables_saved_for_relink; do
9302 if eval test -z \"\${$var+set}\"; then
9303 relink_command="{ test -z \"\${$var+set}\" || $lt_unset $var || { $var=; export $var; }; }; $relink_command"
9304 elif eval var_value=\$$var; test -z "$var_value"; then
9305 relink_command="$var=; export $var; $relink_command"
9307 func_quote_for_eval "$var_value"
9308 relink_command="$var=$func_quote_for_eval_result; export $var; $relink_command"
9311 # Quote the link command for shipping.
9312 relink_command="(cd `pwd`; $SHELL $progpath $preserve_args --mode=relink $libtool_args @inst_prefix_dir@)"
9313 relink_command=`$ECHO "$relink_command" | $SED "$sed_quote_subst"`
9314 if test "$hardcode_automatic" = yes ; then
9318 # Only create the output if not a dry run.
9320 for installed in no yes; do
9321 if test "$installed" = yes; then
9322 if test -z "$install_libdir"; then
9325 output="$output_objdir/$outputname"i
9326 # Replace all uninstalled libtool libraries with the installed ones
9328 for deplib in $dependency_libs; do
9331 func_basename "$deplib"
9332 name="$func_basename_result"
9333 func_resolve_sysroot "$deplib"
9334 eval libdir=`${SED} -n -e 's/^libdir=\(.*\)$/\1/p' $func_resolve_sysroot_result`
9335 test -z "$libdir" && \
9336 func_fatal_error "\`$deplib' is not a valid libtool archive"
9337 func_append newdependency_libs " ${lt_sysroot:+=}$libdir/$name"
9340 func_stripname -L '' "$deplib"
9341 func_replace_sysroot "$func_stripname_result"
9342 func_append newdependency_libs " -L$func_replace_sysroot_result"
9345 func_stripname -R '' "$deplib"
9346 func_replace_sysroot "$func_stripname_result"
9347 func_append newdependency_libs " -R$func_replace_sysroot_result"
9349 *) func_append newdependency_libs " $deplib" ;;
9352 dependency_libs="$newdependency_libs"
9355 for lib in $dlfiles; do
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 newdlfiles " ${lt_sysroot:+=}$libdir/$name"
9365 *) func_append newdlfiles " $lib" ;;
9368 dlfiles="$newdlfiles"
9370 for lib in $dlprefiles; do
9373 # Only pass preopened files to the pseudo-archive (for
9374 # eventual linking with the app. that links it) if we
9375 # didn't already link the preopened objects directly into
9377 func_basename "$lib"
9378 name="$func_basename_result"
9379 eval libdir=`${SED} -n -e 's/^libdir=\(.*\)$/\1/p' $lib`
9380 test -z "$libdir" && \
9381 func_fatal_error "\`$lib' is not a valid libtool archive"
9382 func_append newdlprefiles " ${lt_sysroot:+=}$libdir/$name"
9386 dlprefiles="$newdlprefiles"
9389 for lib in $dlfiles; do
9391 [\\/]* | [A-Za-z]:[\\/]*) abs="$lib" ;;
9392 *) abs=`pwd`"/$lib" ;;
9394 func_append newdlfiles " $abs"
9396 dlfiles="$newdlfiles"
9398 for lib in $dlprefiles; do
9400 [\\/]* | [A-Za-z]:[\\/]*) abs="$lib" ;;
9401 *) abs=`pwd`"/$lib" ;;
9403 func_append newdlprefiles " $abs"
9405 dlprefiles="$newdlprefiles"
9408 # place dlname in correct position for cygwin
9409 # In fact, it would be nice if we could use this code for all target
9410 # systems that can't hard-code library paths into their executables
9411 # and that have no shared library path variable independent of PATH,
9412 # but it turns out we can't easily determine that from inspecting
9413 # libtool variables, so we have to hard-code the OSs to which it
9414 # applies here; at the moment, that means platforms that use the PE
9415 # object format with DLL files. See the long comment at the top of
9416 # tests/bindir.at for full details.
9418 case $host,$output,$installed,$module,$dlname in
9419 *cygwin*,*lai,yes,no,*.dll | *mingw*,*lai,yes,no,*.dll | *cegcc*,*lai,yes,no,*.dll)
9420 # If a -bindir argument was supplied, place the dll there.
9421 if test "x$bindir" != x ;
9423 func_relative_path "$install_libdir" "$bindir"
9424 tdlname=$func_relative_path_result$dlname
9426 # Otherwise fall back on heuristic.
9427 tdlname=../bin/$dlname
9432 # $outputname - a libtool library file
9433 # Generated by $PROGRAM (GNU $PACKAGE$TIMESTAMP) $VERSION
9435 # Please DO NOT delete this file!
9436 # It is necessary for linking the library.
9438 # The name that we can dlopen(3).
9441 # Names of this library.
9442 library_names='$library_names'
9444 # The name of the static archive.
9445 old_library='$old_library'
9447 # Linker flags that can not go in dependency_libs.
9448 inherited_linker_flags='$new_inherited_linker_flags'
9450 # Libraries that this one depends upon.
9451 dependency_libs='$dependency_libs'
9453 # Names of additional weak libraries provided by this library
9454 weak_library_names='$weak_libs'
9456 # Version information for $libname.
9461 # Is this an already installed library?
9462 installed=$installed
9464 # Should we warn about portability when linking against -modules?
9465 shouldnotlink=$module
9467 # Files to dlopen/dlpreopen
9469 dlpreopen='$dlprefiles'
9471 # Directory that this library needs to be installed in:
9472 libdir='$install_libdir'"
9473 if test "$installed" = no && test "$need_relink" = yes; then
9475 relink_command=\"$relink_command\""
9480 # Do a symbolic link so that the libtool archive can be found in
9481 # LD_LIBRARY_PATH before the program is installed.
9482 func_show_eval '( cd "$output_objdir" && $RM "$outputname" && $LN_S "../$outputname" "$outputname" )' 'exit $?'
9488 { test "$opt_mode" = link || test "$opt_mode" = relink; } &&
9489 func_mode_link ${1+"$@"}
9492 # func_mode_uninstall arg...
9493 func_mode_uninstall ()
9501 # This variable tells wrapper scripts just to set variables rather
9502 # than running their programs.
9503 libtool_install_magic="$magic"
9508 -f) func_append RM " $arg"; rmforce=yes ;;
9509 -*) func_append RM " $arg" ;;
9510 *) func_append files " $arg" ;;
9515 func_fatal_help "you must specify an RM program"
9519 for file in $files; do
9520 func_dirname "$file" "" "."
9521 dir="$func_dirname_result"
9522 if test "X$dir" = X.; then
9527 func_basename "$file"
9528 name="$func_basename_result"
9529 test "$opt_mode" = uninstall && odir="$dir"
9531 # Remember odir for removal later, being careful to avoid duplicates
9532 if test "$opt_mode" = clean; then
9535 *) func_append rmdirs " $odir" ;;
9539 # Don't error if the file doesn't exist and rm -f was used.
9540 if { test -L "$file"; } >/dev/null 2>&1 ||
9541 { test -h "$file"; } >/dev/null 2>&1 ||
9542 test -f "$file"; then
9544 elif test -d "$file"; then
9547 elif test "$rmforce" = yes; then
9555 # Possibly a libtool archive, so verify it.
9556 if func_lalib_p "$file"; then
9557 func_source $dir/$name
9559 # Delete the libtool libraries and symlinks.
9560 for n in $library_names; do
9561 func_append rmfiles " $odir/$n"
9563 test -n "$old_library" && func_append rmfiles " $odir/$old_library"
9567 case " $library_names " in
9569 *) test -n "$dlname" && func_append rmfiles " $odir/$dlname" ;;
9571 test -n "$libdir" && func_append rmfiles " $odir/$name $odir/${name}i"
9574 if test -n "$library_names"; then
9575 # Do each command in the postuninstall commands.
9576 func_execute_cmds "$postuninstall_cmds" 'test "$rmforce" = yes || exit_status=1'
9579 if test -n "$old_library"; then
9580 # Do each command in the old_postuninstall commands.
9581 func_execute_cmds "$old_postuninstall_cmds" 'test "$rmforce" = yes || exit_status=1'
9583 # FIXME: should reinstall the best remaining shared library.
9590 # Possibly a libtool object, so verify it.
9591 if func_lalib_p "$file"; then
9594 func_source $dir/$name
9596 # Add PIC object to the list of files to remove.
9597 if test -n "$pic_object" &&
9598 test "$pic_object" != none; then
9599 func_append rmfiles " $dir/$pic_object"
9602 # Add non-PIC object to the list of files to remove.
9603 if test -n "$non_pic_object" &&
9604 test "$non_pic_object" != none; then
9605 func_append rmfiles " $dir/$non_pic_object"
9611 if test "$opt_mode" = clean ; then
9615 func_stripname '' '.exe' "$file"
9616 file=$func_stripname_result
9617 func_stripname '' '.exe' "$name"
9618 noexename=$func_stripname_result
9619 # $file with .exe has already been added to rmfiles,
9620 # add $file without .exe
9621 func_append rmfiles " $file"
9624 # Do a test to see if this is a libtool program.
9625 if func_ltwrapper_p "$file"; then
9626 if func_ltwrapper_executable_p "$file"; then
9627 func_ltwrapper_scriptname "$file"
9629 func_source $func_ltwrapper_scriptname_result
9630 func_append rmfiles " $func_ltwrapper_scriptname_result"
9633 func_source $dir/$noexename
9636 # note $name still contains .exe if it was in $file originally
9637 # as does the version of $file that was added into $rmfiles
9638 func_append rmfiles " $odir/$name $odir/${name}S.${objext}"
9639 if test "$fast_install" = yes && test -n "$relink_command"; then
9640 func_append rmfiles " $odir/lt-$name"
9642 if test "X$noexename" != "X$name" ; then
9643 func_append rmfiles " $odir/lt-${noexename}.c"
9649 func_show_eval "$RM $rmfiles" 'exit_status=1'
9652 # Try to remove the ${objdir}s in the directories where we deleted files
9653 for dir in $rmdirs; do
9654 if test -d "$dir"; then
9655 func_show_eval "rmdir $dir >/dev/null 2>&1"
9662 { test "$opt_mode" = uninstall || test "$opt_mode" = clean; } &&
9663 func_mode_uninstall ${1+"$@"}
9665 test -z "$opt_mode" && {
9666 help="$generic_help"
9667 func_fatal_help "you must specify a MODE"
9670 test -z "$exec_cmd" && \
9671 func_fatal_help "invalid operation mode \`$opt_mode'"
9673 if test -n "$exec_cmd"; then
9674 eval exec "$exec_cmd"
9681 # The TAGs below are defined such that we never get into a situation
9682 # in which we disable both kinds of libraries. Given conflicting
9683 # choices, we go for a static library, that is the most portable,
9684 # since we can't tell whether shared libraries were disabled because
9685 # the user asked for that or because the platform doesn't support
9686 # them. This is particularly important on AIX, because we don't
9687 # support having both static and shared libraries enabled at the same
9688 # time on that platform, so we default to a shared-only configuration.
9689 # If a disable-shared tag is given, we'll fallback to a static-only
9690 # configuration. But we'll never go from static-only to shared-only.
9692 # ### BEGIN LIBTOOL TAG CONFIG: disable-shared
9693 build_libtool_libs=no
9695 # ### END LIBTOOL TAG CONFIG: disable-shared
9697 # ### BEGIN LIBTOOL TAG CONFIG: disable-static
9698 build_old_libs=`case $build_libtool_libs in yes) echo no;; *) echo yes;; esac`
9699 # ### END LIBTOOL TAG CONFIG: disable-static