2 # libtool (GNU libtool) 2.4
3 # Written by Gordon Matzigkeit <gord@gnu.ai.mit.edu>, 1996
5 # Copyright (C) 1996, 1997, 1998, 1999, 2000, 2001, 2003, 2004, 2005, 2006,
6 # 2007, 2008, 2009, 2010 Free Software Foundation, Inc.
7 # This is free software; see the source for copying conditions. There is NO
8 # warranty; not even for MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
10 # GNU Libtool is free software; you can redistribute it and/or modify
11 # it under the terms of the GNU General Public License as published by
12 # the Free Software Foundation; either version 2 of the License, or
13 # (at your option) any later version.
15 # As a special exception to the GNU General Public License,
16 # if you distribute this file as part of a program or library that
17 # is built using GNU Libtool, you may include this file under the
18 # same distribution terms that you use for the rest of that program.
20 # GNU Libtool is distributed in the hope that it will be useful, but
21 # WITHOUT ANY WARRANTY; without even the implied warranty of
22 # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
23 # General Public License for more details.
25 # You should have received a copy of the GNU General Public License
26 # along with GNU Libtool; see the file COPYING. If not, a copy
27 # can be downloaded from http://www.gnu.org/licenses/gpl.html,
28 # or obtained by writing to the Free Software Foundation, Inc.,
29 # 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
31 # Usage: $progname [OPTION]... [MODE-ARG]...
33 # Provide generalized library-building support services.
35 # --config show all configuration variables
36 # --debug enable verbose shell tracing
37 # -n, --dry-run display commands without modifying any files
38 # --features display basic configuration information and exit
39 # --mode=MODE use operation mode MODE
40 # --preserve-dup-deps don't remove duplicate dependency libraries
41 # --quiet, --silent don't print informational messages
42 # --no-quiet, --no-silent
43 # print informational messages (default)
44 # --tag=TAG use configuration variables from tag TAG
45 # -v, --verbose print more informational messages than default
46 # --no-verbose don't print the extra informational messages
47 # --version print version information
48 # -h, --help, --help-all print short, long, or detailed help message
50 # MODE must be one of the following:
52 # clean remove files from the build directory
53 # compile compile a source file into a libtool object
54 # execute automatically set library path, then run a program
55 # finish complete the installation of libtool libraries
56 # install install libraries or executables
57 # link create a library or an executable
58 # uninstall remove libraries from an installed directory
60 # MODE-ARGS vary depending on the MODE. When passed as first option,
61 # `--mode=MODE' may be abbreviated as `MODE' or a unique abbreviation of that.
62 # Try `$progname --help --mode=MODE' for a more detailed description of MODE.
64 # When reporting a bug, please describe a test case to reproduce it and
65 # include the following information:
70 # compiler flags: $LTCFLAGS
71 # linker: $LD (gnu? $with_gnu_ld)
72 # $progname: (GNU libtool) 2.4
73 # automake: $automake_version
74 # autoconf: $autoconf_version
76 # Report bugs to <bug-libtool@gnu.org>.
77 # GNU libtool home page: <http://www.gnu.org/software/libtool/>.
78 # General help using GNU software: <http://www.gnu.org/gethelp/>.
84 package_revision=1.3293
86 # define SED for historic ltconfig's generated by Libtool 1.3
87 test -z "$SED" && SED=sed
89 # Be Bourne compatible
90 if test -n "${ZSH_VERSION+set}" && (emulate sh) >/dev/null 2>&1; then
93 # Zsh 3.x and 4.x performs word splitting on ${1+"$@"}, which
94 # is contrary to our usage. Disable this feature.
95 alias -g '${1+"$@"}'='"$@"'
98 case `(set -o) 2>/dev/null` in *posix*) set -o posix;; esac
100 BIN_SH=xpg4; export BIN_SH # for Tru64
101 DUALCASE=1; export DUALCASE # for MKS sh
103 # A function that is used when there is no print builtin or printf.
104 func_fallback_echo ()
106 eval 'cat <<_LTECHO_EOF
111 # NLS nuisances: We save the old values to restore during execute mode.
114 for lt_var in LANG LANGUAGE LC_ALL LC_CTYPE LC_COLLATE LC_MESSAGES
116 eval "if test \"\${$lt_var+set}\" = set; then
117 save_$lt_var=\$$lt_var
120 lt_user_locale=\"$lt_var=\\\$save_\$lt_var; \$lt_user_locale\"
121 lt_safe_locale=\"$lt_var=C; \$lt_safe_locale\"
126 export LANGUAGE LC_ALL
131 # Work around backward compatibility issue on IRIX 6.5. On IRIX 6.4+, sh
132 # is ksh but when the shell is invoked as "sh" and the current value of
133 # the _XPG environment variable is not equal to 1 (one), the special
134 # positional parameter $0, within a function call, is the name of the
141 test "${ECHO+set}" = set || ECHO=${as_echo-'printf %s\n'}
142 : ${EGREP="/bin/grep -E"}
143 : ${FGREP="/bin/grep -F"}
144 : ${GREP="/bin/grep"}
151 : ${SHELL="${CONFIG_SHELL-/bin/sh}"}
152 : ${Xsed="$SED -e 1s/^X//"}
157 EXIT_MISMATCH=63 # $? = 63 is used to indicate version mismatch to missing.
158 EXIT_SKIP=77 # $? = 77 is used to indicate a skipped test to automake.
160 exit_status=$EXIT_SUCCESS
162 # Make sure IFS has a sensible default
167 dirname="s,/[^/]*$,,"
170 # func_dirname file append nondir_replacement
171 # Compute the dirname of FILE. If nonempty, add APPEND to the result,
172 # otherwise set result to NONDIR_REPLACEMENT.
175 func_dirname_result=`$ECHO "${1}" | $SED "$dirname"`
176 if test "X$func_dirname_result" = "X${1}"; then
177 func_dirname_result="${3}"
179 func_dirname_result="$func_dirname_result${2}"
181 } # func_dirname may be replaced by extended shell implementation
187 func_basename_result=`$ECHO "${1}" | $SED "$basename"`
188 } # func_basename may be replaced by extended shell implementation
191 # func_dirname_and_basename file append nondir_replacement
192 # perform func_basename and func_dirname in a single function
194 # dirname: Compute the dirname of FILE. If nonempty,
195 # add APPEND to the result, otherwise set result
196 # to NONDIR_REPLACEMENT.
197 # value returned in "$func_dirname_result"
198 # basename: Compute filename of FILE.
199 # value retuned in "$func_basename_result"
200 # Implementation must be kept synchronized with func_dirname
201 # and func_basename. For efficiency, we do not delegate to
202 # those functions but instead duplicate the functionality here.
203 func_dirname_and_basename ()
205 # Extract subdirectory from the argument.
206 func_dirname_result=`$ECHO "${1}" | $SED -e "$dirname"`
207 if test "X$func_dirname_result" = "X${1}"; then
208 func_dirname_result="${3}"
210 func_dirname_result="$func_dirname_result${2}"
212 func_basename_result=`$ECHO "${1}" | $SED -e "$basename"`
213 } # func_dirname_and_basename may be replaced by extended shell implementation
216 # func_stripname prefix suffix name
217 # strip PREFIX and SUFFIX off of NAME.
218 # PREFIX and SUFFIX must not contain globbing or regex special
219 # characters, hashes, percent signs, but SUFFIX may contain a leading
220 # dot (in which case that matches only a dot).
221 # func_strip_suffix prefix name
225 .*) func_stripname_result=`$ECHO "${3}" | $SED "s%^${1}%%; s%\\\\${2}\$%%"`;;
226 *) func_stripname_result=`$ECHO "${3}" | $SED "s%^${1}%%; s%${2}\$%%"`;;
228 } # func_stripname may be replaced by extended shell implementation
231 # These SED scripts presuppose an absolute path with a trailing slash.
232 pathcar='s,^/\([^/]*\).*$,\1,'
233 pathcdr='s,^/[^/]*,,'
234 removedotparts=':dotsl
238 collapseslashes='s@/\{1,\}@/@g'
239 finalslash='s,/*$,/,'
241 # func_normal_abspath PATH
242 # Remove doubled-up and trailing slashes, "." path components,
243 # and cancel out any ".." path components in PATH after making
244 # it an absolute path.
245 # value returned in "$func_normal_abspath_result"
246 func_normal_abspath ()
248 # Start from root dir and reassemble the path.
249 func_normal_abspath_result=
250 func_normal_abspath_tpath=$1
251 func_normal_abspath_altnamespace=
252 case $func_normal_abspath_tpath in
254 # Empty path, that just means $cwd.
255 func_stripname '' '/' "`pwd`"
256 func_normal_abspath_result=$func_stripname_result
259 # The next three entries are used to spot a run of precisely
260 # two leading slashes without using negated character classes;
261 # we take advantage of case's first-match behaviour.
263 # Unusual form of absolute path, do nothing.
266 # Not necessarily an ordinary path; POSIX reserves leading '//'
267 # and for example Cygwin uses it to access remote file shares
268 # over CIFS/SMB, so we conserve a leading double slash if found.
269 func_normal_abspath_altnamespace=/
272 # Absolute path, do nothing.
275 # Relative path, prepend $cwd.
276 func_normal_abspath_tpath=`pwd`/$func_normal_abspath_tpath
279 # Cancel out all the simple stuff to save iterations. We also want
280 # the path to end with a slash for ease of parsing, so make sure
281 # there is one (and only one) here.
282 func_normal_abspath_tpath=`$ECHO "$func_normal_abspath_tpath" | $SED \
283 -e "$removedotparts" -e "$collapseslashes" -e "$finalslash"`
285 # Processed it all yet?
286 if test "$func_normal_abspath_tpath" = / ; then
287 # If we ascended to the root using ".." the result may be empty now.
288 if test -z "$func_normal_abspath_result" ; then
289 func_normal_abspath_result=/
293 func_normal_abspath_tcomponent=`$ECHO "$func_normal_abspath_tpath" | $SED \
295 func_normal_abspath_tpath=`$ECHO "$func_normal_abspath_tpath" | $SED \
297 # Figure out what to do with it
298 case $func_normal_abspath_tcomponent in
300 # Trailing empty path component, ignore it.
303 # Parent dir; strip last assembled component from result.
304 func_dirname "$func_normal_abspath_result"
305 func_normal_abspath_result=$func_dirname_result
308 # Actual path component, append it.
309 func_normal_abspath_result=$func_normal_abspath_result/$func_normal_abspath_tcomponent
313 # Restore leading double-slash if one was found on entry.
314 func_normal_abspath_result=$func_normal_abspath_altnamespace$func_normal_abspath_result
317 # func_relative_path SRCDIR DSTDIR
318 # generates a relative path from SRCDIR to DSTDIR, with a trailing
319 # slash if non-empty, suitable for immediately appending a filename
320 # without needing to append a separator.
321 # value returned in "$func_relative_path_result"
322 func_relative_path ()
324 func_relative_path_result=
325 func_normal_abspath "$1"
326 func_relative_path_tlibdir=$func_normal_abspath_result
327 func_normal_abspath "$2"
328 func_relative_path_tbindir=$func_normal_abspath_result
330 # Ascend the tree starting from libdir
332 # check if we have found a prefix of bindir
333 case $func_relative_path_tbindir in
334 $func_relative_path_tlibdir)
335 # found an exact match
336 func_relative_path_tcancelled=
339 $func_relative_path_tlibdir*)
340 # found a matching prefix
341 func_stripname "$func_relative_path_tlibdir" '' "$func_relative_path_tbindir"
342 func_relative_path_tcancelled=$func_stripname_result
343 if test -z "$func_relative_path_result"; then
344 func_relative_path_result=.
349 func_dirname $func_relative_path_tlibdir
350 func_relative_path_tlibdir=${func_dirname_result}
351 if test "x$func_relative_path_tlibdir" = x ; then
352 # Have to descend all the way to the root!
353 func_relative_path_result=../$func_relative_path_result
354 func_relative_path_tcancelled=$func_relative_path_tbindir
357 func_relative_path_result=../$func_relative_path_result
362 # Now calculate path; take care to avoid doubling-up slashes.
363 func_stripname '' '/' "$func_relative_path_result"
364 func_relative_path_result=$func_stripname_result
365 func_stripname '/' '/' "$func_relative_path_tcancelled"
366 if test "x$func_stripname_result" != x ; then
367 func_relative_path_result=${func_relative_path_result}/${func_stripname_result}
370 # Normalisation. If bindir is libdir, return empty string,
371 # else relative path ending with a slash; either way, target
372 # file name can be directly appended.
373 if test ! -z "$func_relative_path_result"; then
374 func_stripname './' '' "$func_relative_path_result/"
375 func_relative_path_result=$func_stripname_result
379 # The name of this program:
380 func_dirname_and_basename "$progpath"
381 progname=$func_basename_result
383 # Make sure we have an absolute path for reexecution:
385 [\\/]*|[A-Za-z]:\\*) ;;
387 progdir=$func_dirname_result
388 progdir=`cd "$progdir" && pwd`
389 progpath="$progdir/$progname"
394 for progdir in $PATH; do
396 test -x "$progdir/$progname" && break
399 test -n "$progdir" || progdir=`pwd`
400 progpath="$progdir/$progname"
404 # Sed substitution that helps us do robust quoting. It backslashifies
405 # metacharacters that are still active within double-quoted strings.
406 Xsed="${SED}"' -e 1s/^X//'
407 sed_quote_subst='s/\([`"$\\]\)/\\\1/g'
409 # Same as above, but do not quote variable references.
410 double_quote_subst='s/\(["`\\]\)/\\\1/g'
412 # Sed substitution that turns a string into a regex matching for the
414 sed_make_literal_regex='s,[].[^$\\*\/],\\&,g'
416 # Sed substitution that converts a w32 file name or path
417 # which contains forward slashes, into one that contains
418 # (escaped) backslashes. A very naive implementation.
419 lt_sed_naive_backslashify='s|\\\\*|\\|g;s|/|\\|g;s|\\|\\\\|g'
421 # Re-`\' parameter expansions in output of double_quote_subst that were
422 # `\'-ed in input to the same. If an odd number of `\' preceded a '$'
423 # in input to double_quote_subst, that '$' was protected from expansion.
424 # Since each input `\' is now two `\'s, look for any number of runs of
425 # four `\'s followed by two `\'s and then a '$'. `\' that '$'.
430 sed_double_backslash="\
434 s/\\([^$bs]\\)$bs2$dollar/\\1$bs2$bs$dollar/g
445 # Echo program name prefixed message, along with the current mode
446 # name if it has been set yet.
449 $ECHO "$progname: ${opt_mode+$opt_mode: }$*"
452 # func_verbose arg...
453 # Echo program name prefixed message in verbose mode only.
456 $opt_verbose && func_echo ${1+"$@"}
458 # A bug in bash halts the script if the last line of a function
459 # fails when set -e is in force, so we need another command to
464 # func_echo_all arg...
465 # Invoke $ECHO with all args, space-separated.
472 # Echo program name prefixed message to standard error.
475 $ECHO "$progname: ${opt_mode+$opt_mode: }"${1+"$@"} 1>&2
478 # func_warning arg...
479 # Echo program name prefixed warning message to standard error.
482 $opt_warning && $ECHO "$progname: ${opt_mode+$opt_mode: }warning: "${1+"$@"} 1>&2
488 # func_fatal_error arg...
489 # Echo program name prefixed message to standard error, and exit.
496 # func_fatal_help arg...
497 # Echo program name prefixed message to standard error, followed by
498 # a help hint, and exit.
502 func_fatal_error "$help"
504 help="Try \`$progname --help' for more information." ## default
507 # func_grep expression filename
508 # Check whether EXPRESSION matches any line of FILENAME, without output.
511 $GREP "$1" "$2" >/dev/null 2>&1
515 # func_mkdir_p directory-path
516 # Make sure the entire path to DIRECTORY-PATH is available.
519 my_directory_path="$1"
522 if test -n "$my_directory_path" && test "$opt_dry_run" != ":"; then
524 # Protect directory names starting with `-'
525 case $my_directory_path in
526 -*) my_directory_path="./$my_directory_path" ;;
529 # While some portion of DIR does not yet exist...
530 while test ! -d "$my_directory_path"; do
531 # ...make a list in topmost first order. Use a colon delimited
532 # list incase some portion of path contains whitespace.
533 my_dir_list="$my_directory_path:$my_dir_list"
535 # If the last portion added has no slash in it, the list is done
536 case $my_directory_path in */*) ;; *) break ;; esac
538 # ...otherwise throw away the child directory and loop
539 my_directory_path=`$ECHO "$my_directory_path" | $SED -e "$dirname"`
541 my_dir_list=`$ECHO "$my_dir_list" | $SED 's,:*$,,'`
543 save_mkdir_p_IFS="$IFS"; IFS=':'
544 for my_dir in $my_dir_list; do
545 IFS="$save_mkdir_p_IFS"
546 # mkdir can fail with a `File exist' error if two processes
547 # try to create one of the directories concurrently. Don't
549 $MKDIR "$my_dir" 2>/dev/null || :
551 IFS="$save_mkdir_p_IFS"
553 # Bail out if we (or some other process) failed to create a directory.
554 test -d "$my_directory_path" || \
555 func_fatal_error "Failed to create \`$1'"
560 # func_mktempdir [string]
561 # Make a temporary directory that won't clash with other running
562 # libtool processes, and avoids race conditions if possible. If
563 # given, STRING is the basename for that directory.
566 my_template="${TMPDIR-/tmp}/${1-$progname}"
568 if test "$opt_dry_run" = ":"; then
569 # Return a directory name, but don't create it in dry-run mode
570 my_tmpdir="${my_template}-$$"
573 # If mktemp works, use that first and foremost
574 my_tmpdir=`mktemp -d "${my_template}-XXXXXXXX" 2>/dev/null`
576 if test ! -d "$my_tmpdir"; then
577 # Failing that, at least try and use $RANDOM to avoid a race
578 my_tmpdir="${my_template}-${RANDOM-0}$$"
580 save_mktempdir_umask=`umask`
583 umask $save_mktempdir_umask
586 # If we're not in dry-run mode, bomb out on failure
587 test -d "$my_tmpdir" || \
588 func_fatal_error "cannot create temporary directory \`$my_tmpdir'"
595 # func_quote_for_eval arg
596 # Aesthetically quote ARG to be evaled later.
597 # This function returns two values: FUNC_QUOTE_FOR_EVAL_RESULT
598 # is double-quoted, suitable for a subsequent eval, whereas
599 # FUNC_QUOTE_FOR_EVAL_UNQUOTED_RESULT has merely all characters
600 # which are still active within double quotes backslashified.
601 func_quote_for_eval ()
605 func_quote_for_eval_unquoted_result=`$ECHO "$1" | $SED "$sed_quote_subst"` ;;
607 func_quote_for_eval_unquoted_result="$1" ;;
610 case $func_quote_for_eval_unquoted_result in
611 # Double-quote args containing shell metacharacters to delay
612 # word splitting, command substitution and and variable
613 # expansion for a subsequent eval.
614 # Many Bourne shells cannot handle close brackets correctly
615 # in scan sets, so we specify it separately.
616 *[\[\~\#\^\&\*\(\)\{\}\|\;\<\>\?\'\ \ ]*|*]*|"")
617 func_quote_for_eval_result="\"$func_quote_for_eval_unquoted_result\""
620 func_quote_for_eval_result="$func_quote_for_eval_unquoted_result"
625 # func_quote_for_expand arg
626 # Aesthetically quote ARG to be evaled later; same as above,
627 # but do not quote variable references.
628 func_quote_for_expand ()
632 my_arg=`$ECHO "$1" | $SED \
633 -e "$double_quote_subst" -e "$sed_double_backslash"` ;;
639 # Double-quote args containing shell metacharacters to delay
640 # word splitting and command substitution for a subsequent eval.
641 # Many Bourne shells cannot handle close brackets correctly
642 # in scan sets, so we specify it separately.
643 *[\[\~\#\^\&\*\(\)\{\}\|\;\<\>\?\'\ \ ]*|*]*|"")
648 func_quote_for_expand_result="$my_arg"
652 # func_show_eval cmd [fail_exp]
653 # Unless opt_silent is true, then output CMD. Then, if opt_dryrun is
654 # not true, evaluate CMD. If the evaluation of CMD fails, and FAIL_EXP
655 # is given, then evaluate it.
661 ${opt_silent-false} || {
662 func_quote_for_expand "$my_cmd"
663 eval "func_echo $func_quote_for_expand_result"
666 if ${opt_dry_run-false}; then :; else
669 if test "$my_status" -eq 0; then :; else
670 eval "(exit $my_status); $my_fail_exp"
676 # func_show_eval_locale cmd [fail_exp]
677 # Unless opt_silent is true, then output CMD. Then, if opt_dryrun is
678 # not true, evaluate CMD. If the evaluation of CMD fails, and FAIL_EXP
679 # is given, then evaluate it. Use the saved locale for evaluation.
680 func_show_eval_locale ()
685 ${opt_silent-false} || {
686 func_quote_for_expand "$my_cmd"
687 eval "func_echo $func_quote_for_expand_result"
690 if ${opt_dry_run-false}; then :; else
691 eval "$lt_user_locale
694 eval "$lt_safe_locale"
695 if test "$my_status" -eq 0; then :; else
696 eval "(exit $my_status); $my_fail_exp"
702 # Turn $1 into a string suitable for a shell variable name.
703 # Result is stored in $func_tr_sh_result. All characters
704 # not in the set a-zA-Z0-9_ are replaced with '_'. Further,
705 # if $1 begins with a digit, a '_' is prepended as well.
709 [0-9]* | *[!a-zA-Z0-9_]*)
710 func_tr_sh_result=`$ECHO "$1" | $SED 's/^\([0-9]\)/_\1/; s/[^a-zA-Z0-9_]/_/g'`
720 # Echo version message to standard output and exit.
733 /^# '$PROGRAM' (GNU /,/# warranty; / {
736 s/\((C)\)[ 0-9,-]*\( [1-9][0-9]*\)/\1\2/
743 # Echo short help message to standard output and exit.
748 $SED -n '/^# Usage:/,/^# *.*--help/ {
751 s/\$progname/'$progname'/
755 $ECHO "run \`$progname --help | more' for full usage"
760 # Echo long help message to standard output and exit,
761 # unless 'noexit' is passed as argument.
766 $SED -n '/^# Usage:/,/# Report bugs to/ {
770 s*\$progname*'$progname'*
772 s*\$SHELL*'"$SHELL"'*
774 s*\$LTCFLAGS*'"$LTCFLAGS"'*
776 s/\$with_gnu_ld/'"$with_gnu_ld"'/
777 s/\$automake_version/'"`(automake --version) 2>/dev/null |$SED 1q`"'/
778 s/\$autoconf_version/'"`(autoconf --version) 2>/dev/null |$SED 1q`"'/
782 /^# .* home page:/b print
783 /^# General help using/b print
786 if test -z "$1"; then
791 # func_missing_arg argname
792 # Echo program name prefixed message to standard error and set global
798 func_error "missing argument for $1."
803 # func_split_short_opt shortopt
804 # Set func_split_short_opt_name and func_split_short_opt_arg shell
805 # variables after splitting SHORTOPT after the 2nd character.
806 func_split_short_opt ()
808 my_sed_short_opt='1s/^\(..\).*$/\1/;q'
809 my_sed_short_rest='1s/^..\(.*\)$/\1/;q'
811 func_split_short_opt_name=`$ECHO "$1" | $SED "$my_sed_short_opt"`
812 func_split_short_opt_arg=`$ECHO "$1" | $SED "$my_sed_short_rest"`
813 } # func_split_short_opt may be replaced by extended shell implementation
816 # func_split_long_opt longopt
817 # Set func_split_long_opt_name and func_split_long_opt_arg shell
818 # variables after splitting LONGOPT at the `=' sign.
819 func_split_long_opt ()
821 my_sed_long_opt='1s/^\(--[^=]*\)=.*/\1/;q'
822 my_sed_long_arg='1s/^--[^=]*=//'
824 func_split_long_opt_name=`$ECHO "$1" | $SED "$my_sed_long_opt"`
825 func_split_long_opt_arg=`$ECHO "$1" | $SED "$my_sed_long_arg"`
826 } # func_split_long_opt may be replaced by extended shell implementation
834 magic="%%%MAGIC variable%%%"
835 magic_exe="%%%MAGIC EXE variable%%%"
840 lo2o="s/\\.lo\$/.${objext}/"
841 o2lo="s/\\.${objext}\$/.lo/"
845 # If this variable is set in any of the actions, the command in it
846 # will be execed at the end. This prevents here-documents from being
847 # left over by shells.
850 # func_append var value
851 # Append VALUE to the end of shell variable VAR.
854 eval "${1}=\$${1}\${2}"
855 } # func_append may be replaced by extended shell implementation
857 # func_append_quoted var value
858 # Quote VALUE and append to the end of shell variable VAR, separated
860 func_append_quoted ()
862 func_quote_for_eval "${2}"
863 eval "${1}=\$${1}\\ \$func_quote_for_eval_result"
864 } # func_append_quoted may be replaced by extended shell implementation
867 # func_arith arithmetic-term...
870 func_arith_result=`expr "${@}"`
871 } # func_arith may be replaced by extended shell implementation
875 # STRING may not start with a hyphen.
878 func_len_result=`expr "${1}" : ".*" 2>/dev/null || echo $max_cmd_len`
879 } # func_len may be replaced by extended shell implementation
885 func_lo2o_result=`$ECHO "${1}" | $SED "$lo2o"`
886 } # func_lo2o may be replaced by extended shell implementation
889 # func_xform libobj-or-source
892 func_xform_result=`$ECHO "${1}" | $SED 's/\.[^.]*$/.lo/'`
893 } # func_xform may be replaced by extended shell implementation
896 # func_fatal_configuration arg...
897 # Echo program name prefixed message to standard error, followed by
898 # a configuration failure hint, and exit.
899 func_fatal_configuration ()
902 func_error "See the $PACKAGE documentation for more information."
903 func_fatal_error "Fatal configuration error."
908 # Display the configuration for all the tags in this script.
911 re_begincf='^# ### BEGIN LIBTOOL'
912 re_endcf='^# ### END LIBTOOL'
914 # Default configuration.
915 $SED "1,/$re_begincf CONFIG/d;/$re_endcf CONFIG/,\$d" < "$progpath"
917 # Now print the configurations for the tags.
918 for tagname in $taglist; do
919 $SED -n "/$re_begincf TAG CONFIG: $tagname\$/,/$re_endcf TAG CONFIG: $tagname\$/p" < "$progpath"
926 # Display the features supported by this script.
930 if test "$build_libtool_libs" = yes; then
931 echo "enable shared libraries"
933 echo "disable shared libraries"
935 if test "$build_old_libs" = yes; then
936 echo "enable static libraries"
938 echo "disable static libraries"
944 # func_enable_tag tagname
945 # Verify that TAGNAME is valid, and either flag an error and exit, or
946 # enable the TAGNAME tag. We also add TAGNAME to the global $taglist
953 re_begincf="^# ### BEGIN LIBTOOL TAG CONFIG: $tagname\$"
954 re_endcf="^# ### END LIBTOOL TAG CONFIG: $tagname\$"
955 sed_extractcf="/$re_begincf/,/$re_endcf/p"
960 func_fatal_error "invalid tag name: $tagname"
964 # Don't test for the "default" C tag, as we know it's
965 # there but not specially marked.
969 if $GREP "$re_begincf" "$progpath" >/dev/null 2>&1; then
970 taglist="$taglist $tagname"
972 # Evaluate the configuration. Be careful to quote the path
973 # and the sed script, to avoid splitting on whitespace, but
974 # also don't use non-portable quotes within backquotes within
975 # quotes we have to do it in 2 steps:
976 extractedcf=`$SED -n -e "$sed_extractcf" < "$progpath"`
979 func_error "ignoring unknown tag $tagname"
985 # func_check_version_match
986 # Ensure that we are using m4 macros, and libtool script from the same
987 # release of libtool.
988 func_check_version_match ()
990 if test "$package_revision" != "$macro_revision"; then
991 if test "$VERSION" != "$macro_version"; then
992 if test -z "$macro_version"; then
994 $progname: Version mismatch error. This is $PACKAGE $VERSION, but the
995 $progname: definition of this LT_INIT comes from an older release.
996 $progname: You should recreate aclocal.m4 with macros from $PACKAGE $VERSION
997 $progname: and run autoconf again.
1001 $progname: Version mismatch error. This is $PACKAGE $VERSION, but the
1002 $progname: definition of this LT_INIT comes from $PACKAGE $macro_version.
1003 $progname: You should recreate aclocal.m4 with macros from $PACKAGE $VERSION
1004 $progname: and run autoconf again.
1009 $progname: Version mismatch error. This is $PACKAGE $VERSION, revision $package_revision,
1010 $progname: but the definition of this LT_INIT comes from revision $macro_revision.
1011 $progname: You should recreate aclocal.m4 with macros from revision $package_revision
1012 $progname: of $PACKAGE $VERSION and run autoconf again.
1021 # Shorthand for --mode=foo, only valid as the first argument
1024 shift; set dummy --mode clean ${1+"$@"}; shift
1026 compile|compil|compi|comp|com|co|c)
1027 shift; set dummy --mode compile ${1+"$@"}; shift
1029 execute|execut|execu|exec|exe|ex|e)
1030 shift; set dummy --mode execute ${1+"$@"}; shift
1032 finish|finis|fini|fin|fi|f)
1033 shift; set dummy --mode finish ${1+"$@"}; shift
1035 install|instal|insta|inst|ins|in|i)
1036 shift; set dummy --mode install ${1+"$@"}; shift
1039 shift; set dummy --mode link ${1+"$@"}; shift
1041 uninstall|uninstal|uninsta|uninst|unins|unin|uni|un|u)
1042 shift; set dummy --mode uninstall ${1+"$@"}; shift
1052 opt_preserve_dup_deps=false
1063 # Parse options once, thoroughly. This comes as soon as possible in the
1064 # script to make things like `--version' happen as quickly as we can.
1066 # this just eases exit handling
1067 while test $# -gt 0; do
1071 --debug|-x) opt_debug='set -x'
1072 func_echo "enabling shell trace mode"
1075 --dry-run|--dryrun|-n)
1084 opt_dlopen="${opt_dlopen+$opt_dlopen
1088 --preserve-dup-deps)
1089 opt_preserve_dup_deps=:
1097 set dummy --mode finish ${1+"$@"}; shift
1104 opt_help=': help-all'
1107 test $# = 0 && func_missing_arg $opt && break
1111 # Valid mode arguments:
1112 clean|compile|execute|finish|install|link|relink|uninstall) ;;
1114 # Catch anything else as an error
1115 *) func_error "invalid argument for $opt"
1122 --no-silent|--no-quiet)
1124 func_append preserve_args " $opt"
1128 func_append preserve_args " $opt"
1132 func_append preserve_args " $opt"
1137 func_append preserve_args " $opt"
1141 test $# = 0 && func_missing_arg $opt && break
1144 func_append preserve_args " $opt $optarg"
1145 func_enable_tag "$optarg"
1149 -\?|-h) func_usage ;;
1150 --help) func_help ;;
1151 --version) func_version ;;
1153 # Separate optargs to long options:
1155 func_split_long_opt "$opt"
1156 set dummy "$func_split_long_opt_name" "$func_split_long_opt_arg" ${1+"$@"}
1160 # Separate non-argument short options:
1162 func_split_short_opt "$opt"
1163 set dummy "$func_split_short_opt_name" "-$func_split_short_opt_arg" ${1+"$@"}
1168 -*) func_fatal_help "unrecognized option \`$opt'" ;;
1169 *) set dummy "$opt" ${1+"$@"}; shift; break ;;
1175 # save first non-option argument
1176 if test "$#" -gt 0; then
1182 test "$opt_debug" = : || func_append preserve_args " --debug"
1185 *cygwin* | *mingw* | *pw32* | *cegcc*)
1186 # don't eliminate duplications in $postdeps and $predeps
1187 opt_duplicate_compiler_generated_deps=:
1190 opt_duplicate_compiler_generated_deps=$opt_preserve_dup_deps
1195 # Sanity checks first:
1196 func_check_version_match
1198 if test "$build_libtool_libs" != yes && test "$build_old_libs" != yes; then
1199 func_fatal_configuration "not configured to build any kind of library"
1203 eval std_shrext=\"$shrext_cmds\"
1205 # Only execute mode is allowed to have -dlopen flags.
1206 if test -n "$opt_dlopen" && test "$opt_mode" != execute; then
1207 func_error "unrecognized option \`-dlopen'"
1212 # Change the help message to a mode-specific one.
1213 generic_help="$help"
1214 help="Try \`$progname --help --mode=$opt_mode' for more information."
1218 # Bail if the options were screwed
1219 $exit_cmd $EXIT_FAILURE
1230 # True iff FILE is a libtool `.la' library or `.lo' object file.
1231 # This function is only a basic sanity check; it will hardly flush out
1232 # determined imposters.
1236 $SED -e 4q "$1" 2>/dev/null \
1237 | $GREP "^# Generated by .*$PACKAGE" > /dev/null 2>&1
1240 # func_lalib_unsafe_p file
1241 # True iff FILE is a libtool `.la' library or `.lo' object file.
1242 # This function implements the same check as func_lalib_p without
1243 # resorting to external programs. To this end, it redirects stdin and
1244 # closes it afterwards, without saving the original file descriptor.
1245 # As a safety measure, use it only where a negative result would be
1246 # fatal anyway. Works if `file' does not exist.
1247 func_lalib_unsafe_p ()
1250 if test -f "$1" && test -r "$1" && exec 5<&0 <"$1"; then
1251 for lalib_p_l in 1 2 3 4
1254 case "$lalib_p_line" in
1255 \#\ Generated\ by\ *$PACKAGE* ) lalib_p=yes; break;;
1260 test "$lalib_p" = yes
1263 # func_ltwrapper_script_p file
1264 # True iff FILE is a libtool wrapper script
1265 # This function is only a basic sanity check; it will hardly flush out
1266 # determined imposters.
1267 func_ltwrapper_script_p ()
1272 # func_ltwrapper_executable_p file
1273 # True iff FILE is a libtool wrapper executable
1274 # This function is only a basic sanity check; it will hardly flush out
1275 # determined imposters.
1276 func_ltwrapper_executable_p ()
1278 func_ltwrapper_exec_suffix=
1281 *) func_ltwrapper_exec_suffix=.exe ;;
1283 $GREP "$magic_exe" "$1$func_ltwrapper_exec_suffix" >/dev/null 2>&1
1286 # func_ltwrapper_scriptname file
1287 # Assumes file is an ltwrapper_executable
1288 # uses $file to determine the appropriate filename for a
1289 # temporary ltwrapper_script.
1290 func_ltwrapper_scriptname ()
1292 func_dirname_and_basename "$1" "" "."
1293 func_stripname '' '.exe' "$func_basename_result"
1294 func_ltwrapper_scriptname_result="$func_dirname_result/$objdir/${func_stripname_result}_ltshwrapper"
1297 # func_ltwrapper_p file
1298 # True iff FILE is a libtool wrapper script or wrapper executable
1299 # This function is only a basic sanity check; it will hardly flush out
1300 # determined imposters.
1303 func_ltwrapper_script_p "$1" || func_ltwrapper_executable_p "$1"
1307 # func_execute_cmds commands fail_cmd
1308 # Execute tilde-delimited COMMANDS.
1309 # If FAIL_CMD is given, eval that upon failure.
1310 # FAIL_CMD may read-access the current command in variable CMD!
1311 func_execute_cmds ()
1314 save_ifs=$IFS; IFS='~'
1318 func_show_eval "$cmd" "${2-:}"
1325 # Source FILE, adding directory component if necessary.
1326 # Note that it is not necessary on cygwin/mingw to append a dot to
1327 # FILE even if both FILE and FILE.exe exist: automatic-append-.exe
1328 # behavior happens only for exec(3), not for open(2)! Also, sourcing
1329 # `FILE.' does not work on cygwin managed mounts.
1334 */* | *\\*) . "$1" ;;
1340 # func_resolve_sysroot PATH
1341 # Replace a leading = in PATH with a sysroot. Store the result into
1342 # func_resolve_sysroot_result
1343 func_resolve_sysroot ()
1345 func_resolve_sysroot_result=$1
1346 case $func_resolve_sysroot_result in
1348 func_stripname '=' '' "$func_resolve_sysroot_result"
1349 func_resolve_sysroot_result=$lt_sysroot$func_stripname_result
1354 # func_replace_sysroot PATH
1355 # If PATH begins with the sysroot, replace it with = and
1356 # store the result into func_replace_sysroot_result.
1357 func_replace_sysroot ()
1359 case "$lt_sysroot:$1" in
1361 func_stripname "$lt_sysroot" '' "$1"
1362 func_replace_sysroot_result="=$func_stripname_result"
1365 # Including no sysroot.
1366 func_replace_sysroot_result=$1
1371 # func_infer_tag arg
1372 # Infer tagged configuration to use if any are available and
1373 # if one wasn't chosen via the "--tag" command line option.
1374 # Only attempt this if the compiler in the base compile
1375 # command doesn't match the default compiler.
1376 # arg is usually of the form 'gcc ...'
1380 if test -n "$available_tags" && test -z "$tagname"; then
1383 func_append_quoted CC_quoted "$arg"
1385 CC_expanded=`func_echo_all $CC`
1386 CC_quoted_expanded=`func_echo_all $CC_quoted`
1388 # Blanks in the command may have been stripped by the calling shell,
1389 # but not from the CC environment variable when configure was run.
1390 " $CC "* | "$CC "* | " $CC_expanded "* | "$CC_expanded "* | \
1391 " $CC_quoted"* | "$CC_quoted "* | " $CC_quoted_expanded "* | "$CC_quoted_expanded "*) ;;
1392 # Blanks at the start of $base_compile will cause this to fail
1393 # if we don't check for them as well.
1395 for z in $available_tags; do
1396 if $GREP "^# ### BEGIN LIBTOOL TAG CONFIG: $z$" < "$progpath" > /dev/null; then
1397 # Evaluate the configuration.
1398 eval "`${SED} -n -e '/^# ### BEGIN LIBTOOL TAG CONFIG: '$z'$/,/^# ### END LIBTOOL TAG CONFIG: '$z'$/p' < $progpath`"
1401 # Double-quote args containing other shell metacharacters.
1402 func_append_quoted CC_quoted "$arg"
1404 CC_expanded=`func_echo_all $CC`
1405 CC_quoted_expanded=`func_echo_all $CC_quoted`
1407 " $CC "* | "$CC "* | " $CC_expanded "* | "$CC_expanded "* | \
1408 " $CC_quoted"* | "$CC_quoted "* | " $CC_quoted_expanded "* | "$CC_quoted_expanded "*)
1409 # The compiler in the base compile command matches
1410 # the one in the tagged configuration.
1411 # Assume this is the tagged configuration we want.
1418 # If $tagname still isn't set, then no tagged configuration
1419 # was found and let the user know that the "--tag" command
1420 # line option must be used.
1421 if test -z "$tagname"; then
1422 func_echo "unable to infer tagged configuration"
1423 func_fatal_error "specify a tag with \`--tag'"
1425 # func_verbose "using $tagname tagged configuration"
1434 # func_write_libtool_object output_name pic_name nonpic_name
1435 # Create a libtool object file (analogous to a ".la" file),
1436 # but don't create it if we're doing a dry run.
1437 func_write_libtool_object ()
1440 if test "$build_libtool_libs" = yes; then
1446 if test "$build_old_libs" = yes; then
1447 write_oldobj=\'${3}\'
1453 cat >${write_libobj}T <<EOF
1454 # $write_libobj - a libtool object file
1455 # Generated by $PROGRAM (GNU $PACKAGE$TIMESTAMP) $VERSION
1457 # Please DO NOT delete this file!
1458 # It is necessary for linking the library.
1460 # Name of the PIC object.
1461 pic_object=$write_lobj
1463 # Name of the non-PIC object
1464 non_pic_object=$write_oldobj
1467 $MV "${write_libobj}T" "${write_libobj}"
1472 ##################################################
1473 # FILE NAME AND PATH CONVERSION HELPER FUNCTIONS #
1474 ##################################################
1476 # func_convert_core_file_wine_to_w32 ARG
1477 # Helper function used by file name conversion functions when $build is *nix,
1478 # and $host is mingw, cygwin, or some other w32 environment. Relies on a
1479 # correctly configured wine environment available, with the winepath program
1480 # in $build's $PATH.
1482 # ARG is the $build file name to be converted to w32 format.
1483 # Result is available in $func_convert_core_file_wine_to_w32_result, and will
1484 # be empty on error (or when ARG is empty)
1485 func_convert_core_file_wine_to_w32 ()
1488 func_convert_core_file_wine_to_w32_result="$1"
1489 if test -n "$1"; then
1490 # Unfortunately, winepath does not exit with a non-zero error code, so we
1491 # are forced to check the contents of stdout. On the other hand, if the
1492 # command is not found, the shell will set an exit code of 127 and print
1493 # *an error message* to stdout. So we must check for both error code of
1494 # zero AND non-empty stdout, which explains the odd construction:
1495 func_convert_core_file_wine_to_w32_tmp=`winepath -w "$1" 2>/dev/null`
1496 if test "$?" -eq 0 && test -n "${func_convert_core_file_wine_to_w32_tmp}"; then
1497 func_convert_core_file_wine_to_w32_result=`$ECHO "$func_convert_core_file_wine_to_w32_tmp" |
1498 $SED -e "$lt_sed_naive_backslashify"`
1500 func_convert_core_file_wine_to_w32_result=
1504 # end: func_convert_core_file_wine_to_w32
1507 # func_convert_core_path_wine_to_w32 ARG
1508 # Helper function used by path conversion functions when $build is *nix, and
1509 # $host is mingw, cygwin, or some other w32 environment. Relies on a correctly
1510 # configured wine environment available, with the winepath program in $build's
1511 # $PATH. Assumes ARG has no leading or trailing path separator characters.
1513 # ARG is path to be converted from $build format to win32.
1514 # Result is available in $func_convert_core_path_wine_to_w32_result.
1515 # Unconvertible file (directory) names in ARG are skipped; if no directory names
1516 # are convertible, then the result may be empty.
1517 func_convert_core_path_wine_to_w32 ()
1520 # unfortunately, winepath doesn't convert paths, only file names
1521 func_convert_core_path_wine_to_w32_result=""
1522 if test -n "$1"; then
1525 for func_convert_core_path_wine_to_w32_f in $1; do
1527 func_convert_core_file_wine_to_w32 "$func_convert_core_path_wine_to_w32_f"
1528 if test -n "$func_convert_core_file_wine_to_w32_result" ; then
1529 if test -z "$func_convert_core_path_wine_to_w32_result"; then
1530 func_convert_core_path_wine_to_w32_result="$func_convert_core_file_wine_to_w32_result"
1532 func_append func_convert_core_path_wine_to_w32_result ";$func_convert_core_file_wine_to_w32_result"
1539 # end: func_convert_core_path_wine_to_w32
1542 # func_cygpath ARGS...
1543 # Wrapper around calling the cygpath program via LT_CYGPATH. This is used when
1544 # when (1) $build is *nix and Cygwin is hosted via a wine environment; or (2)
1545 # $build is MSYS and $host is Cygwin, or (3) $build is Cygwin. In case (1) or
1546 # (2), returns the Cygwin file name or path in func_cygpath_result (input
1547 # file name or path is assumed to be in w32 format, as previously converted
1548 # from $build's *nix or MSYS format). In case (3), returns the w32 file name
1549 # or path in func_cygpath_result (input file name or path is assumed to be in
1550 # Cygwin format). Returns an empty string on error.
1552 # ARGS are passed to cygpath, with the last one being the file name or path to
1555 # Specify the absolute *nix (or w32) name to cygpath in the LT_CYGPATH
1556 # environment variable; do not put it in $PATH.
1560 if test -n "$LT_CYGPATH" && test -f "$LT_CYGPATH"; then
1561 func_cygpath_result=`$LT_CYGPATH "$@" 2>/dev/null`
1562 if test "$?" -ne 0; then
1563 # on failure, ensure result is empty
1564 func_cygpath_result=
1567 func_cygpath_result=
1568 func_error "LT_CYGPATH is empty or specifies non-existent file: \`$LT_CYGPATH'"
1574 # func_convert_core_msys_to_w32 ARG
1575 # Convert file name or path ARG from MSYS format to w32 format. Return
1576 # result in func_convert_core_msys_to_w32_result.
1577 func_convert_core_msys_to_w32 ()
1580 # awkward: cmd appends spaces to result
1581 func_convert_core_msys_to_w32_result=`( cmd //c echo "$1" ) 2>/dev/null |
1582 $SED -e 's/[ ]*$//' -e "$lt_sed_naive_backslashify"`
1584 #end: func_convert_core_msys_to_w32
1587 # func_convert_file_check ARG1 ARG2
1588 # Verify that ARG1 (a file name in $build format) was converted to $host
1589 # format in ARG2. Otherwise, emit an error message, but continue (resetting
1590 # func_to_host_file_result to ARG1).
1591 func_convert_file_check ()
1594 if test -z "$2" && test -n "$1" ; then
1595 func_error "Could not determine host file name corresponding to"
1597 func_error "Continuing, but uninstalled executables may not work."
1599 func_to_host_file_result="$1"
1602 # end func_convert_file_check
1605 # func_convert_path_check FROM_PATHSEP TO_PATHSEP FROM_PATH TO_PATH
1606 # Verify that FROM_PATH (a path in $build format) was converted to $host
1607 # format in TO_PATH. Otherwise, emit an error message, but continue, resetting
1608 # func_to_host_file_result to a simplistic fallback value (see below).
1609 func_convert_path_check ()
1612 if test -z "$4" && test -n "$3"; then
1613 func_error "Could not determine the host path corresponding to"
1615 func_error "Continuing, but uninstalled executables may not work."
1616 # Fallback. This is a deliberately simplistic "conversion" and
1617 # should not be "improved". See libtool.info.
1618 if test "x$1" != "x$2"; then
1619 lt_replace_pathsep_chars="s|$1|$2|g"
1620 func_to_host_path_result=`echo "$3" |
1621 $SED -e "$lt_replace_pathsep_chars"`
1623 func_to_host_path_result="$3"
1627 # end func_convert_path_check
1630 # func_convert_path_front_back_pathsep FRONTPAT BACKPAT REPL ORIG
1631 # Modifies func_to_host_path_result by prepending REPL if ORIG matches FRONTPAT
1632 # and appending REPL if ORIG matches BACKPAT.
1633 func_convert_path_front_back_pathsep ()
1637 $1 ) func_to_host_path_result="$3$func_to_host_path_result"
1641 $2 ) func_append func_to_host_path_result "$3"
1645 # end func_convert_path_front_back_pathsep
1648 ##################################################
1649 # $build to $host FILE NAME CONVERSION FUNCTIONS #
1650 ##################################################
1651 # invoked via `$to_host_file_cmd ARG'
1653 # In each case, ARG is the path to be converted from $build to $host format.
1654 # Result will be available in $func_to_host_file_result.
1657 # func_to_host_file ARG
1658 # Converts the file name ARG from $build format to $host format. Return result
1659 # in func_to_host_file_result.
1660 func_to_host_file ()
1663 $to_host_file_cmd "$1"
1665 # end func_to_host_file
1668 # func_to_tool_file ARG LAZY
1669 # converts the file name ARG from $build format to toolchain format. Return
1670 # result in func_to_tool_file_result. If the conversion in use is listed
1671 # in (the comma separated) LAZY, no conversion takes place.
1672 func_to_tool_file ()
1676 *,"$to_tool_file_cmd",*)
1677 func_to_tool_file_result=$1
1680 $to_tool_file_cmd "$1"
1681 func_to_tool_file_result=$func_to_host_file_result
1685 # end func_to_tool_file
1688 # func_convert_file_noop ARG
1689 # Copy ARG to func_to_host_file_result.
1690 func_convert_file_noop ()
1692 func_to_host_file_result="$1"
1694 # end func_convert_file_noop
1697 # func_convert_file_msys_to_w32 ARG
1698 # Convert file name ARG from (mingw) MSYS to (mingw) w32 format; automatic
1699 # conversion to w32 is not available inside the cwrapper. Returns result in
1700 # func_to_host_file_result.
1701 func_convert_file_msys_to_w32 ()
1704 func_to_host_file_result="$1"
1705 if test -n "$1"; then
1706 func_convert_core_msys_to_w32 "$1"
1707 func_to_host_file_result="$func_convert_core_msys_to_w32_result"
1709 func_convert_file_check "$1" "$func_to_host_file_result"
1711 # end func_convert_file_msys_to_w32
1714 # func_convert_file_cygwin_to_w32 ARG
1715 # Convert file name ARG from Cygwin to w32 format. Returns result in
1716 # func_to_host_file_result.
1717 func_convert_file_cygwin_to_w32 ()
1720 func_to_host_file_result="$1"
1721 if test -n "$1"; then
1722 # because $build is cygwin, we call "the" cygpath in $PATH; no need to use
1723 # LT_CYGPATH in this case.
1724 func_to_host_file_result=`cygpath -m "$1"`
1726 func_convert_file_check "$1" "$func_to_host_file_result"
1728 # end func_convert_file_cygwin_to_w32
1731 # func_convert_file_nix_to_w32 ARG
1732 # Convert file name ARG from *nix to w32 format. Requires a wine environment
1733 # and a working winepath. Returns result in func_to_host_file_result.
1734 func_convert_file_nix_to_w32 ()
1737 func_to_host_file_result="$1"
1738 if test -n "$1"; then
1739 func_convert_core_file_wine_to_w32 "$1"
1740 func_to_host_file_result="$func_convert_core_file_wine_to_w32_result"
1742 func_convert_file_check "$1" "$func_to_host_file_result"
1744 # end func_convert_file_nix_to_w32
1747 # func_convert_file_msys_to_cygwin ARG
1748 # Convert file name ARG from MSYS to Cygwin format. Requires LT_CYGPATH set.
1749 # Returns result in func_to_host_file_result.
1750 func_convert_file_msys_to_cygwin ()
1753 func_to_host_file_result="$1"
1754 if test -n "$1"; then
1755 func_convert_core_msys_to_w32 "$1"
1756 func_cygpath -u "$func_convert_core_msys_to_w32_result"
1757 func_to_host_file_result="$func_cygpath_result"
1759 func_convert_file_check "$1" "$func_to_host_file_result"
1761 # end func_convert_file_msys_to_cygwin
1764 # func_convert_file_nix_to_cygwin ARG
1765 # Convert file name ARG from *nix to Cygwin format. Requires Cygwin installed
1766 # in a wine environment, working winepath, and LT_CYGPATH set. Returns result
1767 # in func_to_host_file_result.
1768 func_convert_file_nix_to_cygwin ()
1771 func_to_host_file_result="$1"
1772 if test -n "$1"; then
1773 # convert from *nix to w32, then use cygpath to convert from w32 to cygwin.
1774 func_convert_core_file_wine_to_w32 "$1"
1775 func_cygpath -u "$func_convert_core_file_wine_to_w32_result"
1776 func_to_host_file_result="$func_cygpath_result"
1778 func_convert_file_check "$1" "$func_to_host_file_result"
1780 # end func_convert_file_nix_to_cygwin
1783 #############################################
1784 # $build to $host PATH CONVERSION FUNCTIONS #
1785 #############################################
1786 # invoked via `$to_host_path_cmd ARG'
1788 # In each case, ARG is the path to be converted from $build to $host format.
1789 # The result will be available in $func_to_host_path_result.
1791 # Path separators are also converted from $build format to $host format. If
1792 # ARG begins or ends with a path separator character, it is preserved (but
1793 # converted to $host format) on output.
1795 # All path conversion functions are named using the following convention:
1796 # file name conversion function : func_convert_file_X_to_Y ()
1797 # path conversion function : func_convert_path_X_to_Y ()
1798 # where, for any given $build/$host combination the 'X_to_Y' value is the
1799 # same. If conversion functions are added for new $build/$host combinations,
1800 # the two new functions must follow this pattern, or func_init_to_host_path_cmd
1804 # func_init_to_host_path_cmd
1805 # Ensures that function "pointer" variable $to_host_path_cmd is set to the
1806 # appropriate value, based on the value of $to_host_file_cmd.
1808 func_init_to_host_path_cmd ()
1811 if test -z "$to_host_path_cmd"; then
1812 func_stripname 'func_convert_file_' '' "$to_host_file_cmd"
1813 to_host_path_cmd="func_convert_path_${func_stripname_result}"
1818 # func_to_host_path ARG
1819 # Converts the path ARG from $build format to $host format. Return result
1820 # in func_to_host_path_result.
1821 func_to_host_path ()
1824 func_init_to_host_path_cmd
1825 $to_host_path_cmd "$1"
1827 # end func_to_host_path
1830 # func_convert_path_noop ARG
1831 # Copy ARG to func_to_host_path_result.
1832 func_convert_path_noop ()
1834 func_to_host_path_result="$1"
1836 # end func_convert_path_noop
1839 # func_convert_path_msys_to_w32 ARG
1840 # Convert path ARG from (mingw) MSYS to (mingw) w32 format; automatic
1841 # conversion to w32 is not available inside the cwrapper. Returns result in
1842 # func_to_host_path_result.
1843 func_convert_path_msys_to_w32 ()
1846 func_to_host_path_result="$1"
1847 if test -n "$1"; then
1848 # Remove leading and trailing path separator characters from ARG. MSYS
1849 # behavior is inconsistent here; cygpath turns them into '.;' and ';.';
1850 # and winepath ignores them completely.
1851 func_stripname : : "$1"
1852 func_to_host_path_tmp1=$func_stripname_result
1853 func_convert_core_msys_to_w32 "$func_to_host_path_tmp1"
1854 func_to_host_path_result="$func_convert_core_msys_to_w32_result"
1855 func_convert_path_check : ";" \
1856 "$func_to_host_path_tmp1" "$func_to_host_path_result"
1857 func_convert_path_front_back_pathsep ":*" "*:" ";" "$1"
1860 # end func_convert_path_msys_to_w32
1863 # func_convert_path_cygwin_to_w32 ARG
1864 # Convert path ARG from Cygwin to w32 format. Returns result in
1865 # func_to_host_file_result.
1866 func_convert_path_cygwin_to_w32 ()
1869 func_to_host_path_result="$1"
1870 if test -n "$1"; then
1871 # See func_convert_path_msys_to_w32:
1872 func_stripname : : "$1"
1873 func_to_host_path_tmp1=$func_stripname_result
1874 func_to_host_path_result=`cygpath -m -p "$func_to_host_path_tmp1"`
1875 func_convert_path_check : ";" \
1876 "$func_to_host_path_tmp1" "$func_to_host_path_result"
1877 func_convert_path_front_back_pathsep ":*" "*:" ";" "$1"
1880 # end func_convert_path_cygwin_to_w32
1883 # func_convert_path_nix_to_w32 ARG
1884 # Convert path ARG from *nix to w32 format. Requires a wine environment and
1885 # a working winepath. Returns result in func_to_host_file_result.
1886 func_convert_path_nix_to_w32 ()
1889 func_to_host_path_result="$1"
1890 if test -n "$1"; then
1891 # See func_convert_path_msys_to_w32:
1892 func_stripname : : "$1"
1893 func_to_host_path_tmp1=$func_stripname_result
1894 func_convert_core_path_wine_to_w32 "$func_to_host_path_tmp1"
1895 func_to_host_path_result="$func_convert_core_path_wine_to_w32_result"
1896 func_convert_path_check : ";" \
1897 "$func_to_host_path_tmp1" "$func_to_host_path_result"
1898 func_convert_path_front_back_pathsep ":*" "*:" ";" "$1"
1901 # end func_convert_path_nix_to_w32
1904 # func_convert_path_msys_to_cygwin ARG
1905 # Convert path ARG from MSYS to Cygwin format. Requires LT_CYGPATH set.
1906 # Returns result in func_to_host_file_result.
1907 func_convert_path_msys_to_cygwin ()
1910 func_to_host_path_result="$1"
1911 if test -n "$1"; then
1912 # See func_convert_path_msys_to_w32:
1913 func_stripname : : "$1"
1914 func_to_host_path_tmp1=$func_stripname_result
1915 func_convert_core_msys_to_w32 "$func_to_host_path_tmp1"
1916 func_cygpath -u -p "$func_convert_core_msys_to_w32_result"
1917 func_to_host_path_result="$func_cygpath_result"
1918 func_convert_path_check : : \
1919 "$func_to_host_path_tmp1" "$func_to_host_path_result"
1920 func_convert_path_front_back_pathsep ":*" "*:" : "$1"
1923 # end func_convert_path_msys_to_cygwin
1926 # func_convert_path_nix_to_cygwin ARG
1927 # Convert path ARG from *nix to Cygwin format. Requires Cygwin installed in a
1928 # a wine environment, working winepath, and LT_CYGPATH set. Returns result in
1929 # func_to_host_file_result.
1930 func_convert_path_nix_to_cygwin ()
1933 func_to_host_path_result="$1"
1934 if test -n "$1"; then
1935 # Remove leading and trailing path separator characters from
1936 # ARG. msys behavior is inconsistent here, cygpath turns them
1937 # into '.;' and ';.', and winepath ignores them completely.
1938 func_stripname : : "$1"
1939 func_to_host_path_tmp1=$func_stripname_result
1940 func_convert_core_path_wine_to_w32 "$func_to_host_path_tmp1"
1941 func_cygpath -u -p "$func_convert_core_path_wine_to_w32_result"
1942 func_to_host_path_result="$func_cygpath_result"
1943 func_convert_path_check : : \
1944 "$func_to_host_path_tmp1" "$func_to_host_path_result"
1945 func_convert_path_front_back_pathsep ":*" "*:" : "$1"
1948 # end func_convert_path_nix_to_cygwin
1951 # func_mode_compile arg...
1952 func_mode_compile ()
1955 # Get the compilation command and the source file.
1957 srcfile="$nonopt" # always keep a non-empty value in "srcfile"
1969 # do not "continue". Instead, add this to base_compile
1981 # Accept any command-line options.
1984 test -n "$libobj" && \
1985 func_fatal_error "you cannot specify \`-o' more than once"
1990 -pie | -fpie | -fPIE)
1991 func_append pie_flag " $arg"
1995 -shared | -static | -prefer-pic | -prefer-non-pic)
1996 func_append later " $arg"
2006 arg_mode=arg # the next one goes into the "base_compile" arg list
2007 continue # The current "srcfile" will either be retained or
2008 ;; # replaced later. I would guess that would be a bug.
2011 func_stripname '-Wc,' '' "$arg"
2012 args=$func_stripname_result
2014 save_ifs="$IFS"; IFS=','
2015 for arg in $args; do
2017 func_append_quoted lastarg "$arg"
2020 func_stripname ' ' '' "$lastarg"
2021 lastarg=$func_stripname_result
2023 # Add the arguments to base_compile.
2024 func_append base_compile " $lastarg"
2029 # Accept the current argument as the source file.
2030 # The previous "srcfile" becomes the current argument.
2037 esac # case $arg_mode
2039 # Aesthetically quote the previous argument.
2040 func_append_quoted base_compile "$lastarg"
2045 func_fatal_error "you must specify an argument for -Xcompile"
2048 func_fatal_error "you must specify a target with \`-o'"
2051 # Get the name of the library object.
2052 test -z "$libobj" && {
2053 func_basename "$srcfile"
2054 libobj="$func_basename_result"
2059 # Recognize several different file suffixes.
2060 # If the user specifies -o file.o, it is replaced with file.lo
2063 *.ada | *.adb | *.ads | *.asm | \
2064 *.c++ | *.cc | *.ii | *.class | *.cpp | *.cxx | \
2065 *.[fF][09]? | *.for | *.java | *.obj | *.sx | *.cu | *.cup)
2066 func_xform "$libobj"
2067 libobj=$func_xform_result
2072 *.lo) func_lo2o "$libobj"; obj=$func_lo2o_result ;;
2074 func_fatal_error "cannot determine name of library object from \`$libobj'"
2078 func_infer_tag $base_compile
2080 for arg in $later; do
2083 test "$build_libtool_libs" != yes && \
2084 func_fatal_configuration "can not build a shared library"
2090 build_libtool_libs=no
2107 func_quote_for_eval "$libobj"
2108 test "X$libobj" != "X$func_quote_for_eval_result" \
2109 && $ECHO "X$libobj" | $GREP '[]~#^*{};<>?"'"'"' &()|`$[]' \
2110 && func_warning "libobj name \`$libobj' may not contain shell special characters."
2111 func_dirname_and_basename "$obj" "/" ""
2112 objname="$func_basename_result"
2113 xdir="$func_dirname_result"
2114 lobj=${xdir}$objdir/$objname
2116 test -z "$base_compile" && \
2117 func_fatal_help "you must specify a compilation command"
2119 # Delete any leftover library objects.
2120 if test "$build_old_libs" = yes; then
2121 removelist="$obj $lobj $libobj ${libobj}T"
2123 removelist="$lobj $libobj ${libobj}T"
2126 # On Cygwin there's no "real" PIC flag so we must build both object types
2128 cygwin* | mingw* | pw32* | os2* | cegcc*)
2132 if test "$pic_mode" = no && test "$deplibs_check_method" != pass_all; then
2133 # non-PIC code in shared libraries is not supported
2137 # Calculate the filename of the output object if compiler does
2138 # not support -o with -c
2139 if test "$compiler_c_o" = no; then
2140 output_obj=`$ECHO "$srcfile" | $SED 's%^.*/%%; s%\.[^.]*$%%'`.${objext}
2141 lockfile="$output_obj.lock"
2148 # Lock this critical section if it is needed
2149 # We use this script file to make the link, it avoids creating a new file
2150 if test "$need_locks" = yes; then
2151 until $opt_dry_run || ln "$progpath" "$lockfile" 2>/dev/null; do
2152 func_echo "Waiting for $lockfile to be removed"
2155 elif test "$need_locks" = warn; then
2156 if test -f "$lockfile"; then
2158 *** ERROR, $lockfile exists and contains:
2159 `cat $lockfile 2>/dev/null`
2161 This indicates that another process is trying to use the same
2162 temporary object file, and libtool could not work around it because
2163 your compiler does not support \`-c' and \`-o' together. If you
2164 repeat this compilation, it may succeed, by chance, but you had better
2165 avoid parallel builds (make -j) in this platform, or get a better
2168 $opt_dry_run || $RM $removelist
2171 func_append removelist " $output_obj"
2172 $ECHO "$srcfile" > "$lockfile"
2175 $opt_dry_run || $RM $removelist
2176 func_append removelist " $lockfile"
2177 trap '$opt_dry_run || $RM $removelist; exit $EXIT_FAILURE' 1 2 15
2179 func_to_tool_file "$srcfile" func_convert_file_msys_to_w32
2180 srcfile=$func_to_tool_file_result
2181 func_quote_for_eval "$srcfile"
2182 qsrcfile=$func_quote_for_eval_result
2184 # Only build a PIC object if we are building libtool libraries.
2185 if test "$build_libtool_libs" = yes; then
2186 # Without this assignment, base_compile gets emptied.
2187 fbsd_hideous_sh_bug=$base_compile
2189 if test "$pic_mode" != no; then
2190 command="$base_compile $qsrcfile $pic_flag"
2192 # Don't build PIC code
2193 command="$base_compile $qsrcfile"
2196 func_mkdir_p "$xdir$objdir"
2198 if test -z "$output_obj"; then
2199 # Place PIC objects in $objdir
2200 func_append command " -o $lobj"
2203 func_show_eval_locale "$command" \
2204 'test -n "$output_obj" && $RM $removelist; exit $EXIT_FAILURE'
2206 if test "$need_locks" = warn &&
2207 test "X`cat $lockfile 2>/dev/null`" != "X$srcfile"; then
2209 *** ERROR, $lockfile contains:
2210 `cat $lockfile 2>/dev/null`
2212 but it should contain:
2215 This indicates that another process is trying to use the same
2216 temporary object file, and libtool could not work around it because
2217 your compiler does not support \`-c' and \`-o' together. If you
2218 repeat this compilation, it may succeed, by chance, but you had better
2219 avoid parallel builds (make -j) in this platform, or get a better
2222 $opt_dry_run || $RM $removelist
2226 # Just move the object if needed, then go on to compile the next one
2227 if test -n "$output_obj" && test "X$output_obj" != "X$lobj"; then
2228 func_show_eval '$MV "$output_obj" "$lobj"' \
2229 'error=$?; $opt_dry_run || $RM $removelist; exit $error'
2232 # Allow error messages only from the first compilation.
2233 if test "$suppress_opt" = yes; then
2234 suppress_output=' >/dev/null 2>&1'
2238 # Only build a position-dependent object if we build old libraries.
2239 if test "$build_old_libs" = yes; then
2240 if test "$pic_mode" != yes; then
2241 # Don't build PIC code
2242 command="$base_compile $qsrcfile$pie_flag"
2244 command="$base_compile $qsrcfile $pic_flag"
2246 if test "$compiler_c_o" = yes; then
2247 func_append command " -o $obj"
2250 # Suppress compiler output if we already did a PIC compilation.
2251 func_append command "$suppress_output"
2252 func_show_eval_locale "$command" \
2253 '$opt_dry_run || $RM $removelist; exit $EXIT_FAILURE'
2255 if test "$need_locks" = warn &&
2256 test "X`cat $lockfile 2>/dev/null`" != "X$srcfile"; then
2258 *** ERROR, $lockfile contains:
2259 `cat $lockfile 2>/dev/null`
2261 but it should contain:
2264 This indicates that another process is trying to use the same
2265 temporary object file, and libtool could not work around it because
2266 your compiler does not support \`-c' and \`-o' together. If you
2267 repeat this compilation, it may succeed, by chance, but you had better
2268 avoid parallel builds (make -j) in this platform, or get a better
2271 $opt_dry_run || $RM $removelist
2275 # Just move the object if needed
2276 if test -n "$output_obj" && test "X$output_obj" != "X$obj"; then
2277 func_show_eval '$MV "$output_obj" "$obj"' \
2278 'error=$?; $opt_dry_run || $RM $removelist; exit $error'
2283 func_write_libtool_object "$libobj" "$objdir/$objname" "$objname"
2285 # Unlock the critical section if it was locked
2286 if test "$need_locks" != no; then
2287 removelist=$lockfile
2296 test "$opt_mode" = compile && func_mode_compile ${1+"$@"}
2301 # We need to display help for each of the modes.
2304 # Generic help is extracted from the usage comments
2305 # at the start of this file.
2311 "Usage: $progname [OPTION]... --mode=clean RM [RM-OPTION]... FILE...
2313 Remove files from the build directory.
2315 RM is the name of the program to use to delete files associated with each FILE
2316 (typically \`/bin/rm'). RM-OPTIONS are options (such as \`-f') to be passed
2319 If FILE is a libtool library, object or program, all the files associated
2320 with it are deleted. Otherwise, only FILE itself is deleted using RM."
2325 "Usage: $progname [OPTION]... --mode=compile COMPILE-COMMAND... SOURCEFILE
2327 Compile a source file into a libtool library object.
2329 This mode accepts the following additional options:
2331 -o OUTPUT-FILE set the output file name to OUTPUT-FILE
2332 -no-suppress do not suppress compiler output for multiple passes
2333 -prefer-pic try to build PIC objects only
2334 -prefer-non-pic try to build non-PIC objects only
2335 -shared do not build a \`.o' file suitable for static linking
2336 -static only build a \`.o' file suitable for static linking
2337 -Wc,FLAG pass FLAG directly to the compiler
2339 COMPILE-COMMAND is a command to be used in creating a \`standard' object file
2340 from the given SOURCEFILE.
2342 The output file name is determined by removing the directory component from
2343 SOURCEFILE, then substituting the C source code suffix \`.c' with the
2344 library object suffix, \`.lo'."
2349 "Usage: $progname [OPTION]... --mode=execute COMMAND [ARGS]...
2351 Automatically set library path, then run a program.
2353 This mode accepts the following additional options:
2355 -dlopen FILE add the directory containing FILE to the library path
2357 This mode sets the library path environment variable according to \`-dlopen'
2360 If any of the ARGS are libtool executable wrappers, then they are translated
2361 into their corresponding uninstalled binary, and any of their required library
2362 directories are added to the library path.
2364 Then, COMMAND is executed, with ARGS as arguments."
2369 "Usage: $progname [OPTION]... --mode=finish [LIBDIR]...
2371 Complete the installation of libtool libraries.
2373 Each LIBDIR is a directory that contains libtool libraries.
2375 The commands that this mode executes may require superuser privileges. Use
2376 the \`--dry-run' option if you just want to see what would be executed."
2381 "Usage: $progname [OPTION]... --mode=install INSTALL-COMMAND...
2383 Install executables or libraries.
2385 INSTALL-COMMAND is the installation command. The first component should be
2386 either the \`install' or \`cp' program.
2388 The following components of INSTALL-COMMAND are treated specially:
2390 -inst-prefix-dir PREFIX-DIR Use PREFIX-DIR as a staging area for installation
2392 The rest of the components are interpreted as arguments to that command (only
2393 BSD-compatible install options are recognized)."
2398 "Usage: $progname [OPTION]... --mode=link LINK-COMMAND...
2400 Link object files or libraries together to form another library, or to
2401 create an executable program.
2403 LINK-COMMAND is a command using the C compiler that you would use to create
2404 a program from several object files.
2406 The following components of LINK-COMMAND are treated specially:
2408 -all-static do not do any dynamic linking at all
2409 -avoid-version do not add a version suffix if possible
2410 -bindir BINDIR specify path to binaries directory (for systems where
2411 libraries must be found in the PATH setting at runtime)
2412 -dlopen FILE \`-dlpreopen' FILE if it cannot be dlopened at runtime
2413 -dlpreopen FILE link in FILE and add its symbols to lt_preloaded_symbols
2414 -export-dynamic allow symbols from OUTPUT-FILE to be resolved with dlsym(3)
2415 -export-symbols SYMFILE
2416 try to export only the symbols listed in SYMFILE
2417 -export-symbols-regex REGEX
2418 try to export only the symbols matching REGEX
2419 -LLIBDIR search LIBDIR for required installed libraries
2420 -lNAME OUTPUT-FILE requires the installed library libNAME
2421 -module build a library that can dlopened
2422 -no-fast-install disable the fast-install mode
2423 -no-install link a not-installable executable
2424 -no-undefined declare that a library does not refer to external symbols
2425 -o OUTPUT-FILE create OUTPUT-FILE from the specified objects
2426 -objectlist FILE Use a list of object files found in FILE to specify objects
2427 -precious-files-regex REGEX
2428 don't remove output files matching REGEX
2429 -release RELEASE specify package release information
2430 -rpath LIBDIR the created library will eventually be installed in LIBDIR
2431 -R[ ]LIBDIR add LIBDIR to the runtime path of programs and libraries
2432 -shared only do dynamic linking of libtool libraries
2433 -shrext SUFFIX override the standard shared library file extension
2434 -static do not do any dynamic linking of uninstalled libtool libraries
2435 -static-libtool-libs
2436 do not do any dynamic linking of libtool libraries
2437 -version-info CURRENT[:REVISION[:AGE]]
2438 specify library version info [each variable defaults to 0]
2439 -weak LIBNAME declare that the target provides the LIBNAME interface
2441 -Xcompiler FLAG pass linker-specific FLAG directly to the compiler
2443 -Xlinker FLAG pass linker-specific FLAG directly to the linker
2444 -XCClinker FLAG pass link-specific FLAG to the compiler driver (CC)
2446 All other options (arguments beginning with \`-') are ignored.
2448 Every other argument is treated as a filename. Files ending in \`.la' are
2449 treated as uninstalled libtool libraries, other files are standard or library
2452 If the OUTPUT-FILE ends in \`.la', then a libtool library is created,
2453 only library objects (\`.lo' files) may be specified, and \`-rpath' is
2454 required, except when creating a convenience library.
2456 If OUTPUT-FILE ends in \`.a' or \`.lib', then a standard library is created
2457 using \`ar' and \`ranlib', or on Windows using \`lib'.
2459 If OUTPUT-FILE ends in \`.lo' or \`.${objext}', then a reloadable object file
2460 is created, otherwise an executable program is created."
2465 "Usage: $progname [OPTION]... --mode=uninstall RM [RM-OPTION]... FILE...
2467 Remove libraries from an installation directory.
2469 RM is the name of the program to use to delete files associated with each FILE
2470 (typically \`/bin/rm'). RM-OPTIONS are options (such as \`-f') to be passed
2473 If FILE is a libtool library, all the files associated with it are deleted.
2474 Otherwise, only FILE itself is deleted using RM."
2478 func_fatal_help "invalid operation mode \`$opt_mode'"
2483 $ECHO "Try \`$progname --help' for more information about other modes."
2486 # Now that we've collected a possible --mode arg, show help if necessary
2488 if test "$opt_help" = :; then
2493 for opt_mode in compile link execute install finish uninstall clean; do
2496 } | sed -n '1p; 2,$s/^Usage:/ or: /p'
2499 for opt_mode in compile link execute install finish uninstall clean; do
2505 /^When reporting/,/^Report/{
2510 /information about other modes/d
2511 /more detailed .*MODE/d
2512 s/^Usage:.*--mode=\([^ ]*\) .*/Description of \1 mode:/'
2518 # func_mode_execute arg...
2519 func_mode_execute ()
2522 # The first argument is the command name.
2525 func_fatal_help "you must specify a COMMAND"
2527 # Handle -dlopen flags immediately.
2528 for file in $opt_dlopen; do
2530 || func_fatal_help "\`$file' is not a file"
2535 func_resolve_sysroot "$file"
2536 file=$func_resolve_sysroot_result
2538 # Check to see that this really is a libtool archive.
2539 func_lalib_unsafe_p "$file" \
2540 || func_fatal_help "\`$lib' is not a valid libtool archive"
2542 # Read the libtool library.
2547 # Skip this library if it cannot be dlopened.
2548 if test -z "$dlname"; then
2549 # Warn if it was a shared library.
2550 test -n "$library_names" && \
2551 func_warning "\`$file' was not linked with \`-export-dynamic'"
2555 func_dirname "$file" "" "."
2556 dir="$func_dirname_result"
2558 if test -f "$dir/$objdir/$dlname"; then
2559 func_append dir "/$objdir"
2561 if test ! -f "$dir/$dlname"; then
2562 func_fatal_error "cannot find \`$dlname' in \`$dir' or \`$dir/$objdir'"
2568 # Just add the directory containing the .lo file.
2569 func_dirname "$file" "" "."
2570 dir="$func_dirname_result"
2574 func_warning "\`-dlopen' is ignored for non-libtool libraries and objects"
2579 # Get the absolute pathname.
2580 absdir=`cd "$dir" && pwd`
2581 test -n "$absdir" && dir="$absdir"
2583 # Now add the directory to shlibpath_var.
2584 if eval "test -z \"\$$shlibpath_var\""; then
2585 eval "$shlibpath_var=\"\$dir\""
2587 eval "$shlibpath_var=\"\$dir:\$$shlibpath_var\""
2591 # This variable tells wrapper scripts just to set shlibpath_var
2592 # rather than running their programs.
2593 libtool_execute_magic="$magic"
2595 # Check if any of the arguments is a wrapper script.
2600 -* | *.la | *.lo ) ;;
2602 # Do a test to see if this is really a libtool program.
2603 if func_ltwrapper_script_p "$file"; then
2605 # Transform arg to wrapped name.
2606 file="$progdir/$program"
2607 elif func_ltwrapper_executable_p "$file"; then
2608 func_ltwrapper_scriptname "$file"
2609 func_source "$func_ltwrapper_scriptname_result"
2610 # Transform arg to wrapped name.
2611 file="$progdir/$program"
2615 # Quote arguments (to preserve shell metacharacters).
2616 func_append_quoted args "$file"
2619 if test "X$opt_dry_run" = Xfalse; then
2620 if test -n "$shlibpath_var"; then
2621 # Export the shlibpath_var.
2622 eval "export $shlibpath_var"
2625 # Restore saved environment variables
2626 for lt_var in LANG LANGUAGE LC_ALL LC_CTYPE LC_COLLATE LC_MESSAGES
2628 eval "if test \"\${save_$lt_var+set}\" = set; then
2629 $lt_var=\$save_$lt_var; export $lt_var
2635 # Now prepare to actually exec the command.
2636 exec_cmd="\$cmd$args"
2638 # Display what would be done.
2639 if test -n "$shlibpath_var"; then
2640 eval "\$ECHO \"\$shlibpath_var=\$$shlibpath_var\""
2641 echo "export $shlibpath_var"
2648 test "$opt_mode" = execute && func_mode_execute ${1+"$@"}
2651 # func_mode_finish arg...
2659 for opt in "$nonopt" ${1+"$@"}
2661 if test -d "$opt"; then
2662 func_append libdirs " $opt"
2664 elif test -f "$opt"; then
2665 if func_lalib_unsafe_p "$opt"; then
2666 func_append libs " $opt"
2668 func_warning "\`$opt' is not a valid libtool archive"
2672 func_fatal_error "invalid argument \`$opt'"
2676 if test -n "$libs"; then
2677 if test -n "$lt_sysroot"; then
2678 sysroot_regex=`$ECHO "$lt_sysroot" | $SED "$sed_make_literal_regex"`
2679 sysroot_cmd="s/\([ ']\)$sysroot_regex/\1/g;"
2684 # Remove sysroot references
2685 if $opt_dry_run; then
2686 for lib in $libs; do
2687 echo "removing references to $lt_sysroot and \`=' prefixes from $lib"
2690 tmpdir=`func_mktempdir`
2691 for lib in $libs; do
2692 sed -e "${sysroot_cmd} s/\([ ']-[LR]\)=/\1/g; s/\([ ']\)=/\1/g" $lib \
2694 mv -f $tmpdir/tmp-la $lib
2700 if test -n "$finish_cmds$finish_eval" && test -n "$libdirs"; then
2701 for libdir in $libdirs; do
2702 if test -n "$finish_cmds"; then
2703 # Do each command in the finish commands.
2704 func_execute_cmds "$finish_cmds" 'admincmds="$admincmds
2707 if test -n "$finish_eval"; then
2708 # Do the single finish_eval.
2709 eval cmds=\"$finish_eval\"
2710 $opt_dry_run || eval "$cmds" || func_append admincmds "
2716 # Exit here if they wanted silent mode.
2717 $opt_silent && exit $EXIT_SUCCESS
2719 if test -n "$finish_cmds$finish_eval" && test -n "$libdirs"; then
2720 echo "----------------------------------------------------------------------"
2721 echo "Libraries have been installed in:"
2722 for libdir in $libdirs; do
2726 echo "If you ever happen to want to link against installed libraries"
2727 echo "in a given directory, LIBDIR, you must either use libtool, and"
2728 echo "specify the full pathname of the library, or use the \`-LLIBDIR'"
2729 echo "flag during linking and do at least one of the following:"
2730 if test -n "$shlibpath_var"; then
2731 echo " - add LIBDIR to the \`$shlibpath_var' environment variable"
2732 echo " during execution"
2734 if test -n "$runpath_var"; then
2735 echo " - add LIBDIR to the \`$runpath_var' environment variable"
2736 echo " during linking"
2738 if test -n "$hardcode_libdir_flag_spec"; then
2740 eval flag=\"$hardcode_libdir_flag_spec\"
2742 $ECHO " - use the \`$flag' linker flag"
2744 if test -n "$admincmds"; then
2745 $ECHO " - have your system administrator run these commands:$admincmds"
2747 if test -f /etc/ld.so.conf; then
2748 echo " - have your system administrator add LIBDIR to \`/etc/ld.so.conf'"
2752 echo "See any operating system documentation about shared libraries for"
2754 solaris2.[6789]|solaris2.1[0-9])
2755 echo "more information, such as the ld(1), crle(1) and ld.so(8) manual"
2759 echo "more information, such as the ld(1) and ld.so(8) manual pages."
2762 echo "----------------------------------------------------------------------"
2767 test "$opt_mode" = finish && func_mode_finish ${1+"$@"}
2770 # func_mode_install arg...
2771 func_mode_install ()
2774 # There may be an optional sh(1) argument at the beginning of
2775 # install_prog (especially on Windows NT).
2776 if test "$nonopt" = "$SHELL" || test "$nonopt" = /bin/sh ||
2777 # Allow the use of GNU shtool's install command.
2778 case $nonopt in *shtool*) :;; *) false;; esac; then
2779 # Aesthetically quote it.
2780 func_quote_for_eval "$nonopt"
2781 install_prog="$func_quote_for_eval_result "
2789 # The real first argument should be the name of the installation program.
2790 # Aesthetically quote it.
2791 func_quote_for_eval "$arg"
2792 func_append install_prog "$func_quote_for_eval_result"
2793 install_shared_prog=$install_prog
2794 case " $install_prog " in
2795 *[\\\ /]cp\ *) install_cp=: ;;
2796 *) install_cp=false ;;
2799 # We need to accept at least all the BSD install flags.
2811 if test -n "$dest"; then
2812 func_append files " $dest"
2820 if $install_cp; then :; else
2834 # If the previous option needed an argument, then skip it.
2835 if test -n "$prev"; then
2836 if test "x$prev" = x-m && test -n "$install_override_mode"; then
2837 arg2=$install_override_mode
2848 # Aesthetically quote the argument.
2849 func_quote_for_eval "$arg"
2850 func_append install_prog " $func_quote_for_eval_result"
2851 if test -n "$arg2"; then
2852 func_quote_for_eval "$arg2"
2854 func_append install_shared_prog " $func_quote_for_eval_result"
2857 test -z "$install_prog" && \
2858 func_fatal_help "you must specify an install program"
2860 test -n "$prev" && \
2861 func_fatal_help "the \`$prev' option requires an argument"
2863 if test -n "$install_override_mode" && $no_mode; then
2864 if $install_cp; then :; else
2865 func_quote_for_eval "$install_override_mode"
2866 func_append install_shared_prog " -m $func_quote_for_eval_result"
2870 if test -z "$files"; then
2871 if test -z "$dest"; then
2872 func_fatal_help "no file or destination specified"
2874 func_fatal_help "you must specify a destination"
2878 # Strip any trailing slash from the destination.
2879 func_stripname '' '/' "$dest"
2880 dest=$func_stripname_result
2882 # Check to see that the destination is a directory.
2883 test -d "$dest" && isdir=yes
2884 if test "$isdir" = yes; then
2888 func_dirname_and_basename "$dest" "" "."
2889 destdir="$func_dirname_result"
2890 destname="$func_basename_result"
2892 # Not a directory, so check to see that there is only one file specified.
2893 set dummy $files; shift
2894 test "$#" -gt 1 && \
2895 func_fatal_help "\`$dest' is not a directory"
2898 [\\/]* | [A-Za-z]:[\\/]*) ;;
2900 for file in $files; do
2904 func_fatal_help "\`$destdir' must be an absolute directory name"
2911 # This variable tells wrapper scripts just to set variables rather
2912 # than running their programs.
2913 libtool_install_magic="$magic"
2918 for file in $files; do
2920 # Do each installation.
2923 # Do the static libraries later.
2924 func_append staticlibs " $file"
2928 func_resolve_sysroot "$file"
2929 file=$func_resolve_sysroot_result
2931 # Check to see that this really is a libtool archive.
2932 func_lalib_unsafe_p "$file" \
2933 || func_fatal_help "\`$file' is not a valid libtool archive"
2940 # Add the libdir to current_libdirs if it is the destination.
2941 if test "X$destdir" = "X$libdir"; then
2942 case "$current_libdirs " in
2944 *) func_append current_libdirs " $libdir" ;;
2947 # Note the libdir as a future libdir.
2948 case "$future_libdirs " in
2950 *) func_append future_libdirs " $libdir" ;;
2954 func_dirname "$file" "/" ""
2955 dir="$func_dirname_result"
2956 func_append dir "$objdir"
2958 if test -n "$relink_command"; then
2959 # Determine the prefix the user has applied to our future dir.
2960 inst_prefix_dir=`$ECHO "$destdir" | $SED -e "s%$libdir\$%%"`
2962 # Don't allow the user to place us outside of our expected
2963 # location b/c this prevents finding dependent libraries that
2964 # are installed to the same prefix.
2965 # At present, this check doesn't affect windows .dll's that
2966 # are installed into $libdir/../bin (currently, that works fine)
2967 # but it's something to keep an eye on.
2968 test "$inst_prefix_dir" = "$destdir" && \
2969 func_fatal_error "error: cannot install \`$file' to a directory not ending in $libdir"
2971 if test -n "$inst_prefix_dir"; then
2972 # Stick the inst_prefix_dir data into the link command.
2973 relink_command=`$ECHO "$relink_command" | $SED "s%@inst_prefix_dir@%-inst-prefix-dir $inst_prefix_dir%"`
2975 relink_command=`$ECHO "$relink_command" | $SED "s%@inst_prefix_dir@%%"`
2978 func_warning "relinking \`$file'"
2979 func_show_eval "$relink_command" \
2980 'func_fatal_error "error: relink \`$file'\'' with the above command before installing it"'
2983 # See the names of the shared library.
2984 set dummy $library_names; shift
2985 if test -n "$1"; then
2990 test -n "$relink_command" && srcname="$realname"T
2992 # Install the shared library and build the symlinks.
2993 func_show_eval "$install_shared_prog $dir/$srcname $destdir/$realname" \
2997 cygwin* | mingw* | pw32* | cegcc*)
3005 if test -n "$tstripme" && test -n "$striplib"; then
3006 func_show_eval "$striplib $destdir/$realname" 'exit $?'
3009 if test "$#" -gt 0; then
3010 # Delete the old symlinks, and create new ones.
3011 # Try `ln -sf' first, because the `ln' binary might depend on
3012 # the symlink we replace! Solaris /bin/ln does not understand -f,
3013 # so we also need to try rm && ln -s.
3016 test "$linkname" != "$realname" \
3017 && func_show_eval "(cd $destdir && { $LN_S -f $realname $linkname || { $RM $linkname && $LN_S $realname $linkname; }; })"
3021 # Do each command in the postinstall commands.
3022 lib="$destdir/$realname"
3023 func_execute_cmds "$postinstall_cmds" 'exit $?'
3026 # Install the pseudo-library for information purposes.
3027 func_basename "$file"
3028 name="$func_basename_result"
3029 instname="$dir/$name"i
3030 func_show_eval "$install_prog $instname $destdir/$name" 'exit $?'
3032 # Maybe install the static library, too.
3033 test -n "$old_library" && func_append staticlibs " $dir/$old_library"
3037 # Install (i.e. copy) a libtool object.
3039 # Figure out destination file name, if it wasn't already specified.
3040 if test -n "$destname"; then
3041 destfile="$destdir/$destname"
3043 func_basename "$file"
3044 destfile="$func_basename_result"
3045 destfile="$destdir/$destfile"
3048 # Deduce the name of the destination old-style object file.
3051 func_lo2o "$destfile"
3052 staticdest=$func_lo2o_result
3055 staticdest="$destfile"
3059 func_fatal_help "cannot copy a libtool object to \`$destfile'"
3063 # Install the libtool object if requested.
3064 test -n "$destfile" && \
3065 func_show_eval "$install_prog $file $destfile" 'exit $?'
3067 # Install the old object if enabled.
3068 if test "$build_old_libs" = yes; then
3069 # Deduce the name of the old-style object file.
3071 staticobj=$func_lo2o_result
3072 func_show_eval "$install_prog \$staticobj \$staticdest" 'exit $?'
3078 # Figure out destination file name, if it wasn't already specified.
3079 if test -n "$destname"; then
3080 destfile="$destdir/$destname"
3082 func_basename "$file"
3083 destfile="$func_basename_result"
3084 destfile="$destdir/$destfile"
3087 # If the file is missing, and there is a .exe on the end, strip it
3088 # because it is most likely a libtool script we actually want to
3093 if test ! -f "$file"; then
3094 func_stripname '' '.exe' "$file"
3095 file=$func_stripname_result
3101 # Do a test to see if this is really a libtool program.
3104 if func_ltwrapper_executable_p "$file"; then
3105 func_ltwrapper_scriptname "$file"
3106 wrapper=$func_ltwrapper_scriptname_result
3108 func_stripname '' '.exe' "$file"
3109 wrapper=$func_stripname_result
3116 if func_ltwrapper_script_p "$wrapper"; then
3120 func_source "$wrapper"
3122 # Check the variables that should have been set.
3123 test -z "$generated_by_libtool_version" && \
3124 func_fatal_error "invalid libtool wrapper script \`$wrapper'"
3127 for lib in $notinst_deplibs; do
3128 # Check to see that each library is installed.
3130 if test -f "$lib"; then
3133 libfile="$libdir/"`$ECHO "$lib" | $SED 's%^.*/%%g'` ### testsuite: skip nested quoting test
3134 if test -n "$libdir" && test ! -f "$libfile"; then
3135 func_warning "\`$lib' has not been installed in \`$libdir'"
3141 func_source "$wrapper"
3144 if test "$fast_install" = no && test -n "$relink_command"; then
3146 if test "$finalize" = yes; then
3147 tmpdir=`func_mktempdir`
3148 func_basename "$file$stripped_ext"
3149 file="$func_basename_result"
3150 outputname="$tmpdir/$file"
3151 # Replace the output file specification.
3152 relink_command=`$ECHO "$relink_command" | $SED 's%@OUTPUT@%'"$outputname"'%g'`
3155 func_quote_for_expand "$relink_command"
3156 eval "func_echo $func_quote_for_expand_result"
3158 if eval "$relink_command"; then :
3160 func_error "error: relink \`$file' with the above command before installing it"
3161 $opt_dry_run || ${RM}r "$tmpdir"
3166 func_warning "cannot relink \`$file'"
3170 # Install the binary that we compiled earlier.
3171 file=`$ECHO "$file$stripped_ext" | $SED "s%\([^/]*\)$%$objdir/\1%"`
3175 # remove .exe since cygwin /usr/bin/install will append another
3177 case $install_prog,$host in
3178 */usr/bin/install*,*cygwin*)
3179 case $file:$destfile in
3184 destfile=$destfile.exe
3187 func_stripname '' '.exe' "$destfile"
3188 destfile=$func_stripname_result
3193 func_show_eval "$install_prog\$stripme \$file \$destfile" 'exit $?'
3194 $opt_dry_run || if test -n "$outputname"; then
3201 for file in $staticlibs; do
3202 func_basename "$file"
3203 name="$func_basename_result"
3205 # Set up the ranlib parameters.
3206 oldlib="$destdir/$name"
3208 func_show_eval "$install_prog \$file \$oldlib" 'exit $?'
3210 if test -n "$stripme" && test -n "$old_striplib"; then
3211 func_show_eval "$old_striplib $oldlib" 'exit $?'
3214 # Do each command in the postinstall commands.
3215 func_execute_cmds "$old_postinstall_cmds" 'exit $?'
3218 test -n "$future_libdirs" && \
3219 func_warning "remember to run \`$progname --finish$future_libdirs'"
3221 if test -n "$current_libdirs"; then
3222 # Maybe just do a dry run.
3223 $opt_dry_run && current_libdirs=" -n$current_libdirs"
3224 exec_cmd='$SHELL $progpath $preserve_args --finish$current_libdirs'
3230 test "$opt_mode" = install && func_mode_install ${1+"$@"}
3233 # func_generate_dlsyms outputname originator pic_p
3234 # Extract symbols from dlprefiles and create ${outputname}S.o with
3235 # a dlpreopen symbol table.
3236 func_generate_dlsyms ()
3242 my_prefix=`$ECHO "$my_originator" | sed 's%[^a-zA-Z0-9]%_%g'`
3245 if test -n "$dlfiles$dlprefiles" || test "$dlself" != no; then
3246 if test -n "$NM" && test -n "$global_symbol_pipe"; then
3247 my_dlsyms="${my_outputname}S.c"
3249 func_error "not configured to extract global symbols from dlpreopened files"
3253 if test -n "$my_dlsyms"; then
3257 # Discover the nlist of each of the dlfiles.
3258 nlist="$output_objdir/${my_outputname}.nm"
3260 func_show_eval "$RM $nlist ${nlist}S ${nlist}T"
3262 # Parse the name list into a source file.
3263 func_verbose "creating $output_objdir/$my_dlsyms"
3265 $opt_dry_run || $ECHO > "$output_objdir/$my_dlsyms" "\
3266 /* $my_dlsyms - symbol resolution table for \`$my_outputname' dlsym emulation. */
3267 /* Generated by $PROGRAM (GNU $PACKAGE$TIMESTAMP) $VERSION */
3273 #if defined(__GNUC__) && (((__GNUC__ == 4) && (__GNUC_MINOR__ >= 4)) || (__GNUC__ > 4))
3274 #pragma GCC diagnostic ignored \"-Wstrict-prototypes\"
3277 /* Keep this code in sync between libtool.m4, ltmain, lt_system.h, and tests. */
3278 #if defined(_WIN32) || defined(__CYGWIN__) || defined(_WIN32_WCE)
3279 /* DATA imports from DLLs on WIN32 con't be const, because runtime
3280 relocations are performed -- see ld's documentation on pseudo-relocs. */
3281 # define LT_DLSYM_CONST
3282 #elif defined(__osf__)
3283 /* This system does not cope well with relocations in const data. */
3284 # define LT_DLSYM_CONST
3286 # define LT_DLSYM_CONST const
3289 /* External symbol declarations for the compiler. */\
3292 if test "$dlself" = yes; then
3293 func_verbose "generating symbol list for \`$output'"
3295 $opt_dry_run || echo ': @PROGRAM@ ' > "$nlist"
3297 # Add our own program objects to the symbol list.
3298 progfiles=`$ECHO "$objs$old_deplibs" | $SP2NL | $SED "$lo2o" | $NL2SP`
3299 for progfile in $progfiles; do
3300 func_to_tool_file "$progfile" func_convert_file_msys_to_w32
3301 func_verbose "extracting global C symbols from \`$func_to_tool_file_result'"
3302 $opt_dry_run || eval "$NM $func_to_tool_file_result | $global_symbol_pipe >> '$nlist'"
3305 if test -n "$exclude_expsyms"; then
3307 eval '$EGREP -v " ($exclude_expsyms)$" "$nlist" > "$nlist"T'
3308 eval '$MV "$nlist"T "$nlist"'
3312 if test -n "$export_symbols_regex"; then
3314 eval '$EGREP -e "$export_symbols_regex" "$nlist" > "$nlist"T'
3315 eval '$MV "$nlist"T "$nlist"'
3319 # Prepare the list of exported symbols
3320 if test -z "$export_symbols"; then
3321 export_symbols="$output_objdir/$outputname.exp"
3324 eval "${SED} -n -e '/^: @PROGRAM@ $/d' -e 's/^.* \(.*\)$/\1/p' "'< "$nlist" > "$export_symbols"'
3326 *cygwin* | *mingw* | *cegcc* )
3327 eval "echo EXPORTS "'> "$output_objdir/$outputname.def"'
3328 eval 'cat "$export_symbols" >> "$output_objdir/$outputname.def"'
3334 eval "${SED} -e 's/\([].[*^$]\)/\\\\\1/g' -e 's/^/ /' -e 's/$/$/'"' < "$export_symbols" > "$output_objdir/$outputname.exp"'
3335 eval '$GREP -f "$output_objdir/$outputname.exp" < "$nlist" > "$nlist"T'
3336 eval '$MV "$nlist"T "$nlist"'
3338 *cygwin* | *mingw* | *cegcc* )
3339 eval "echo EXPORTS "'> "$output_objdir/$outputname.def"'
3340 eval 'cat "$nlist" >> "$output_objdir/$outputname.def"'
3347 for dlprefile in $dlprefiles; do
3348 func_verbose "extracting global C symbols from \`$dlprefile'"
3349 func_basename "$dlprefile"
3350 name="$func_basename_result"
3352 *cygwin* | *mingw* | *cegcc* )
3353 # if an import library, we need to obtain dlname
3354 if func_win32_import_lib_p "$dlprefile"; then
3355 func_tr_sh "$dlprefile"
3356 eval "curr_lafile=\$libfile_$func_tr_sh_result"
3357 dlprefile_dlbasename=""
3358 if test -n "$curr_lafile" && func_lalib_p "$curr_lafile"; then
3359 # Use subshell, to avoid clobbering current variable values
3360 dlprefile_dlname=`source "$curr_lafile" && echo "$dlname"`
3361 if test -n "$dlprefile_dlname" ; then
3362 func_basename "$dlprefile_dlname"
3363 dlprefile_dlbasename="$func_basename_result"
3365 # no lafile. user explicitly requested -dlpreopen <import library>.
3366 $sharedlib_from_linklib_cmd "$dlprefile"
3367 dlprefile_dlbasename=$sharedlib_from_linklib_result
3371 if test -n "$dlprefile_dlbasename" ; then
3372 eval '$ECHO ": $dlprefile_dlbasename" >> "$nlist"'
3374 func_warning "Could not compute DLL name from $name"
3375 eval '$ECHO ": $name " >> "$nlist"'
3377 func_to_tool_file "$dlprefile" func_convert_file_msys_to_w32
3378 eval "$NM \"$func_to_tool_file_result\" 2>/dev/null | $global_symbol_pipe |
3379 $SED -e '/I __imp/d' -e 's/I __nm_/D /;s/_nm__//' >> '$nlist'"
3381 else # not an import lib
3383 eval '$ECHO ": $name " >> "$nlist"'
3384 func_to_tool_file "$dlprefile" func_convert_file_msys_to_w32
3385 eval "$NM \"$func_to_tool_file_result\" 2>/dev/null | $global_symbol_pipe >> '$nlist'"
3391 eval '$ECHO ": $name " >> "$nlist"'
3392 func_to_tool_file "$dlprefile" func_convert_file_msys_to_w32
3393 eval "$NM \"$func_to_tool_file_result\" 2>/dev/null | $global_symbol_pipe >> '$nlist'"
3400 # Make sure we have at least an empty file.
3401 test -f "$nlist" || : > "$nlist"
3403 if test -n "$exclude_expsyms"; then
3404 $EGREP -v " ($exclude_expsyms)$" "$nlist" > "$nlist"T
3405 $MV "$nlist"T "$nlist"
3408 # Try sorting and uniquifying the output.
3409 if $GREP -v "^: " < "$nlist" |
3410 if sort -k 3 </dev/null >/dev/null 2>&1; then
3415 uniq > "$nlist"S; then
3418 $GREP -v "^: " < "$nlist" > "$nlist"S
3421 if test -f "$nlist"S; then
3422 eval "$global_symbol_to_cdecl"' < "$nlist"S >> "$output_objdir/$my_dlsyms"'
3424 echo '/* NONE */' >> "$output_objdir/$my_dlsyms"
3427 echo >> "$output_objdir/$my_dlsyms" "\
3429 /* The mapping between symbol names and symbols. */
3434 extern LT_DLSYM_CONST lt_dlsymlist
3435 lt_${my_prefix}_LTX_preloaded_symbols[];
3436 LT_DLSYM_CONST lt_dlsymlist
3437 lt_${my_prefix}_LTX_preloaded_symbols[] =
3439 { \"$my_originator\", (void *) 0 },"
3441 case $need_lib_prefix in
3443 eval "$global_symbol_to_c_name_address" < "$nlist" >> "$output_objdir/$my_dlsyms"
3446 eval "$global_symbol_to_c_name_address_lib_prefix" < "$nlist" >> "$output_objdir/$my_dlsyms"
3449 echo >> "$output_objdir/$my_dlsyms" "\
3453 /* This works around a problem in FreeBSD linker */
3454 #ifdef FREEBSD_WORKAROUND
3455 static const void *lt_preloaded_setup() {
3456 return lt_${my_prefix}_LTX_preloaded_symbols;
3466 pic_flag_for_symtable=
3467 case "$compile_command " in
3471 # compiling the symbol table file with pic_flag works around
3472 # a FreeBSD bug that causes programs to crash when -lm is
3473 # linked before any other PIC object. But we must not use
3474 # pic_flag when linking with -static. The problem exists in
3475 # FreeBSD 2.2.6 and is fixed in FreeBSD 3.1.
3476 *-*-freebsd2*|*-*-freebsd3.0*|*-*-freebsdelf3.0*)
3477 pic_flag_for_symtable=" $pic_flag -DFREEBSD_WORKAROUND" ;;
3479 pic_flag_for_symtable=" $pic_flag" ;;
3481 if test "X$my_pic_p" != Xno; then
3482 pic_flag_for_symtable=" $pic_flag"
3489 for arg in $LTCFLAGS; do
3491 -pie | -fpie | -fPIE) ;;
3492 *) func_append symtab_cflags " $arg" ;;
3496 # Now compile the dynamic symbol file.
3497 func_show_eval '(cd $output_objdir && $LTCC$symtab_cflags -c$no_builtin_flag$pic_flag_for_symtable "$my_dlsyms")' 'exit $?'
3499 # Clean up the generated files.
3500 func_show_eval '$RM "$output_objdir/$my_dlsyms" "$nlist" "${nlist}S" "${nlist}T"'
3502 # Transform the symbol file into the correct name.
3503 symfileobj="$output_objdir/${my_outputname}S.$objext"
3505 *cygwin* | *mingw* | *cegcc* )
3506 if test -f "$output_objdir/$my_outputname.def"; then
3507 compile_command=`$ECHO "$compile_command" | $SED "s%@SYMFILE@%$output_objdir/$my_outputname.def $symfileobj%"`
3508 finalize_command=`$ECHO "$finalize_command" | $SED "s%@SYMFILE@%$output_objdir/$my_outputname.def $symfileobj%"`
3510 compile_command=`$ECHO "$compile_command" | $SED "s%@SYMFILE@%$symfileobj%"`
3511 finalize_command=`$ECHO "$finalize_command" | $SED "s%@SYMFILE@%$symfileobj%"`
3515 compile_command=`$ECHO "$compile_command" | $SED "s%@SYMFILE@%$symfileobj%"`
3516 finalize_command=`$ECHO "$finalize_command" | $SED "s%@SYMFILE@%$symfileobj%"`
3521 func_fatal_error "unknown suffix for \`$my_dlsyms'"
3525 # We keep going just in case the user didn't refer to
3526 # lt_preloaded_symbols. The linker will fail if global_symbol_pipe
3527 # really was required.
3529 # Nullify the symbol file.
3530 compile_command=`$ECHO "$compile_command" | $SED "s% @SYMFILE@%%"`
3531 finalize_command=`$ECHO "$finalize_command" | $SED "s% @SYMFILE@%%"`
3535 # func_win32_libid arg
3536 # return the library type of file 'arg'
3538 # Need a lot of goo to handle *both* DLLs and import libs
3539 # Has to be a shell function in order to 'eat' the argument
3540 # that is supplied when $file_magic_command is called.
3541 # Despite the name, also deal with 64 bit binaries.
3545 win32_libid_type="unknown"
3546 win32_fileres=`file -L $1 2>/dev/null`
3547 case $win32_fileres in
3548 *ar\ archive\ import\ library*) # definitely import
3549 win32_libid_type="x86 archive import"
3551 *ar\ archive*) # could be an import, or static
3552 # Keep the egrep pattern in sync with the one in _LT_CHECK_MAGIC_METHOD.
3553 if eval $OBJDUMP -f $1 | $SED -e '10q' 2>/dev/null |
3554 $EGREP 'file format (pei*-i386(.*architecture: i386)?|pe-arm-wince|pe-x86-64)' >/dev/null; then
3555 func_to_tool_file "$1" func_convert_file_msys_to_w32
3556 win32_nmres=`eval $NM -f posix -A \"$func_to_tool_file_result\" |
3565 case $win32_nmres in
3566 import*) win32_libid_type="x86 archive import";;
3567 *) win32_libid_type="x86 archive static";;
3572 win32_libid_type="x86 DLL"
3574 *executable*) # but shell scripts are "executable" too...
3575 case $win32_fileres in
3576 *MS\ Windows\ PE\ Intel*)
3577 win32_libid_type="x86 DLL"
3582 $ECHO "$win32_libid_type"
3585 # func_cygming_dll_for_implib ARG
3587 # Platform-specific function to extract the
3588 # name of the DLL associated with the specified
3589 # import library ARG.
3590 # Invoked by eval'ing the libtool variable
3591 # $sharedlib_from_linklib_cmd
3592 # Result is available in the variable
3593 # $sharedlib_from_linklib_result
3594 func_cygming_dll_for_implib ()
3597 sharedlib_from_linklib_result=`$DLLTOOL --identify-strict --identify "$1"`
3600 # func_cygming_dll_for_implib_fallback_core SECTION_NAME LIBNAMEs
3602 # The is the core of a fallback implementation of a
3603 # platform-specific function to extract the name of the
3604 # DLL associated with the specified import library LIBNAME.
3606 # SECTION_NAME is either .idata$6 or .idata$7, depending
3607 # on the platform and compiler that created the implib.
3609 # Echos the name of the DLL associated with the
3610 # specified import library.
3611 func_cygming_dll_for_implib_fallback_core ()
3614 match_literal=`$ECHO "$1" | $SED "$sed_make_literal_regex"`
3615 $OBJDUMP -s --section "$1" "$2" 2>/dev/null |
3616 $SED '/^Contents of section '"$match_literal"':/{
3617 # Place marker at beginning of archive member dllname section
3622 # These lines can sometimes be longer than 43 characters, but
3623 # are always uninteresting
3624 /:[ ]*file format pe[i]\{,1\}-/d
3625 /^In archive [^:]*:/d
3626 # Ensure marker is printed
3628 # Remove all lines with less than 43 characters
3630 # From remaining lines, remove first 43 characters
3633 # Join marker and all lines until next marker into a single line
3634 /^====MARK====/ b para
3643 # Remove trailing dots and whitespace
3647 # we now have a list, one entry per line, of the stringified
3648 # contents of the appropriate section of all members of the
3649 # archive which possess that section. Heuristic: eliminate
3650 # all those which have a first or second character that is
3651 # a '.' (that is, objdump's representation of an unprintable
3652 # character.) This should work for all archives with less than
3653 # 0x302f exports -- but will fail for DLLs whose name actually
3654 # begins with a literal '.' or a single character followed by
3657 # Of those that remain, print the first one.
3658 $SED -e '/^\./d;/^.\./d;q'
3661 # func_cygming_gnu_implib_p ARG
3662 # This predicate returns with zero status (TRUE) if
3663 # ARG is a GNU/binutils-style import library. Returns
3664 # with nonzero status (FALSE) otherwise.
3665 func_cygming_gnu_implib_p ()
3668 func_to_tool_file "$1" func_convert_file_msys_to_w32
3669 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)$'`
3670 test -n "$func_cygming_gnu_implib_tmp"
3673 # func_cygming_ms_implib_p ARG
3674 # This predicate returns with zero status (TRUE) if
3675 # ARG is an MS-style import library. Returns
3676 # with nonzero status (FALSE) otherwise.
3677 func_cygming_ms_implib_p ()
3680 func_to_tool_file "$1" func_convert_file_msys_to_w32
3681 func_cygming_ms_implib_tmp=`$NM "$func_to_tool_file_result" | eval "$global_symbol_pipe" | $GREP '_NULL_IMPORT_DESCRIPTOR'`
3682 test -n "$func_cygming_ms_implib_tmp"
3685 # func_cygming_dll_for_implib_fallback ARG
3686 # Platform-specific function to extract the
3687 # name of the DLL associated with the specified
3688 # import library ARG.
3690 # This fallback implementation is for use when $DLLTOOL
3691 # does not support the --identify-strict option.
3692 # Invoked by eval'ing the libtool variable
3693 # $sharedlib_from_linklib_cmd
3694 # Result is available in the variable
3695 # $sharedlib_from_linklib_result
3696 func_cygming_dll_for_implib_fallback ()
3699 if func_cygming_gnu_implib_p "$1" ; then
3700 # binutils import library
3701 sharedlib_from_linklib_result=`func_cygming_dll_for_implib_fallback_core '.idata$7' "$1"`
3702 elif func_cygming_ms_implib_p "$1" ; then
3703 # ms-generated import library
3704 sharedlib_from_linklib_result=`func_cygming_dll_for_implib_fallback_core '.idata$6' "$1"`
3707 sharedlib_from_linklib_result=""
3712 # func_extract_an_archive dir oldlib
3713 func_extract_an_archive ()
3716 f_ex_an_ar_dir="$1"; shift
3717 f_ex_an_ar_oldlib="$1"
3718 if test "$lock_old_archive_extraction" = yes; then
3719 lockfile=$f_ex_an_ar_oldlib.lock
3720 until $opt_dry_run || ln "$progpath" "$lockfile" 2>/dev/null; do
3721 func_echo "Waiting for $lockfile to be removed"
3725 func_show_eval "(cd \$f_ex_an_ar_dir && $AR x \"\$f_ex_an_ar_oldlib\")" \
3726 'stat=$?; rm -f "$lockfile"; exit $stat'
3727 if test "$lock_old_archive_extraction" = yes; then
3728 $opt_dry_run || rm -f "$lockfile"
3730 if ($AR t "$f_ex_an_ar_oldlib" | sort | sort -uc >/dev/null 2>&1); then
3733 func_fatal_error "object name conflicts in archive: $f_ex_an_ar_dir/$f_ex_an_ar_oldlib"
3738 # func_extract_archives gentop oldlib ...
3739 func_extract_archives ()
3742 my_gentop="$1"; shift
3743 my_oldlibs=${1+"$@"}
3749 for my_xlib in $my_oldlibs; do
3750 # Extract the objects.
3752 [\\/]* | [A-Za-z]:[\\/]*) my_xabs="$my_xlib" ;;
3753 *) my_xabs=`pwd`"/$my_xlib" ;;
3755 func_basename "$my_xlib"
3756 my_xlib="$func_basename_result"
3759 case " $extracted_archives " in
3761 func_arith $extracted_serial + 1
3762 extracted_serial=$func_arith_result
3763 my_xlib_u=lt$extracted_serial-$my_xlib ;;
3767 extracted_archives="$extracted_archives $my_xlib_u"
3768 my_xdir="$my_gentop/$my_xlib_u"
3770 func_mkdir_p "$my_xdir"
3774 func_verbose "Extracting $my_xabs"
3775 # Do not bother doing anything if just a dry run
3777 darwin_orig_dir=`pwd`
3778 cd $my_xdir || exit $?
3779 darwin_archive=$my_xabs
3781 darwin_base_archive=`basename "$darwin_archive"`
3782 darwin_arches=`$LIPO -info "$darwin_archive" 2>/dev/null | $GREP Architectures 2>/dev/null || true`
3783 if test -n "$darwin_arches"; then
3784 darwin_arches=`$ECHO "$darwin_arches" | $SED -e 's/.*are://'`
3786 func_verbose "$darwin_base_archive has multiple architectures $darwin_arches"
3787 for darwin_arch in $darwin_arches ; do
3788 func_mkdir_p "unfat-$$/${darwin_base_archive}-${darwin_arch}"
3789 $LIPO -thin $darwin_arch -output "unfat-$$/${darwin_base_archive}-${darwin_arch}/${darwin_base_archive}" "${darwin_archive}"
3790 cd "unfat-$$/${darwin_base_archive}-${darwin_arch}"
3791 func_extract_an_archive "`pwd`" "${darwin_base_archive}"
3793 $RM "unfat-$$/${darwin_base_archive}-${darwin_arch}/${darwin_base_archive}"
3794 done # $darwin_arches
3795 ## Okay now we've a bunch of thin objects, gotta fatten them up :)
3796 darwin_filelist=`find unfat-$$ -type f -name \*.o -print -o -name \*.lo -print | $SED -e "$basename" | sort -u`
3799 for darwin_file in $darwin_filelist; do
3800 darwin_files=`find unfat-$$ -name $darwin_file -print | sort | $NL2SP`
3801 $LIPO -create -output "$darwin_file" $darwin_files
3802 done # $darwin_filelist
3804 cd "$darwin_orig_dir"
3807 func_extract_an_archive "$my_xdir" "$my_xabs"
3812 func_extract_an_archive "$my_xdir" "$my_xabs"
3815 my_oldobjs="$my_oldobjs "`find $my_xdir -name \*.$objext -print -o -name \*.lo -print | sort | $NL2SP`
3818 func_extract_archives_result="$my_oldobjs"
3822 # func_emit_wrapper [arg=no]
3824 # Emit a libtool wrapper script on stdout.
3825 # Don't directly open a file because we may want to
3826 # incorporate the script contents within a cygwin/mingw
3827 # wrapper executable. Must ONLY be called from within
3828 # func_mode_link because it depends on a number of variables
3831 # ARG is the value that the WRAPPER_SCRIPT_BELONGS_IN_OBJDIR
3832 # variable will take. If 'yes', then the emitted script
3833 # will assume that the directory in which it is stored is
3834 # the $objdir directory. This is a cygwin/mingw-specific
3836 func_emit_wrapper ()
3838 func_emit_wrapper_arg1=${1-no}
3843 # $output - temporary wrapper script for $objdir/$outputname
3844 # Generated by $PROGRAM (GNU $PACKAGE$TIMESTAMP) $VERSION
3846 # The $output program cannot be directly executed until all the libtool
3847 # libraries that it depends on are installed.
3849 # This wrapper script should never be moved out of the build directory.
3850 # If it is, it will not operate correctly.
3852 # Sed substitution that helps us do robust quoting. It backslashifies
3853 # metacharacters that are still active within double-quoted strings.
3854 sed_quote_subst='$sed_quote_subst'
3856 # Be Bourne compatible
3857 if test -n \"\${ZSH_VERSION+set}\" && (emulate sh) >/dev/null 2>&1; then
3860 # Zsh 3.x and 4.x performs word splitting on \${1+\"\$@\"}, which
3861 # is contrary to our usage. Disable this feature.
3862 alias -g '\${1+\"\$@\"}'='\"\$@\"'
3863 setopt NO_GLOB_SUBST
3865 case \`(set -o) 2>/dev/null\` in *posix*) set -o posix;; esac
3867 BIN_SH=xpg4; export BIN_SH # for Tru64
3868 DUALCASE=1; export DUALCASE # for MKS sh
3870 # The HP-UX ksh and POSIX shell print the target directory to stdout
3872 (unset CDPATH) >/dev/null 2>&1 && unset CDPATH
3874 relink_command=\"$relink_command\"
3876 # This environment variable determines our operation mode.
3877 if test \"\$libtool_install_magic\" = \"$magic\"; then
3878 # install mode needs the following variables:
3879 generated_by_libtool_version='$macro_version'
3880 notinst_deplibs='$notinst_deplibs'
3882 # When we are sourced in execute mode, \$file and \$ECHO are already set.
3883 if test \"\$libtool_execute_magic\" != \"$magic\"; then
3886 qECHO=`$ECHO "$ECHO" | $SED "$sed_quote_subst"`
3889 # A function that is used when there is no print builtin or printf.
3890 func_fallback_echo ()
3892 eval 'cat <<_LTECHO_EOF
3899 # Very basic option parsing. These options are (a) specific to
3900 # the libtool wrapper, (b) are identical between the wrapper
3901 # /script/ and the wrapper /executable/ which is used only on
3902 # windows platforms, and (c) all begin with the string "--lt-"
3903 # (application programs are unlikely to have options which match
3906 # There are only two supported options: --lt-debug and
3907 # --lt-dump-script. There is, deliberately, no --lt-help.
3909 # The first argument to this parsing function should be the
3910 # script's $0 value, followed by "$@".
3912 func_parse_lt_options ()
3918 case \"\$lt_opt\" in
3919 --lt-debug) lt_option_debug=1 ;;
3921 lt_dump_D=\`\$ECHO \"X\$lt_script_arg0\" | $SED -e 's/^X//' -e 's%/[^/]*$%%'\`
3922 test \"X\$lt_dump_D\" = \"X\$lt_script_arg0\" && lt_dump_D=.
3923 lt_dump_F=\`\$ECHO \"X\$lt_script_arg0\" | $SED -e 's/^X//' -e 's%^.*/%%'\`
3924 cat \"\$lt_dump_D/\$lt_dump_F\"
3928 \$ECHO \"Unrecognized --lt- option: '\$lt_opt'\" 1>&2
3934 # Print the debug banner immediately:
3935 if test -n \"\$lt_option_debug\"; then
3936 echo \"${outputname}:${output}:\${LINENO}: libtool wrapper (GNU $PACKAGE$TIMESTAMP) $VERSION\" 1>&2
3940 # Used when --lt-debug. Prints its arguments to stdout
3941 # (redirection is the responsibility of the caller)
3942 func_lt_dump_args ()
3947 \$ECHO \"${outputname}:${output}:\${LINENO}: newargv[\$lt_dump_args_N]: \$lt_arg\"
3948 lt_dump_args_N=\`expr \$lt_dump_args_N + 1\`
3952 # Core function for launching the target application
3953 func_exec_program_core ()
3957 # Backslashes separate directories on plain windows
3958 *-*-mingw | *-*-os2* | *-cegcc*)
3960 if test -n \"\$lt_option_debug\"; then
3961 \$ECHO \"${outputname}:${output}:\${LINENO}: newargv[0]: \$progdir\\\\\$program\" 1>&2
3962 func_lt_dump_args \${1+\"\$@\"} 1>&2
3964 exec \"\$progdir\\\\\$program\" \${1+\"\$@\"}
3970 if test -n \"\$lt_option_debug\"; then
3971 \$ECHO \"${outputname}:${output}:\${LINENO}: newargv[0]: \$progdir/\$program\" 1>&2
3972 func_lt_dump_args \${1+\"\$@\"} 1>&2
3974 exec \"\$progdir/\$program\" \${1+\"\$@\"}
3979 \$ECHO \"\$0: cannot exec \$program \$*\" 1>&2
3983 # A function to encapsulate launching the target application
3984 # Strips options in the --lt-* namespace from \$@ and
3985 # launches target application with the remaining arguments.
3986 func_exec_program ()
3992 *) set x \"\$@\" \"\$lt_wr_arg\"; shift;;
3996 func_exec_program_core \${1+\"\$@\"}
4000 func_parse_lt_options \"\$0\" \${1+\"\$@\"}
4002 # Find the directory that this script lives in.
4003 thisdir=\`\$ECHO \"\$file\" | $SED 's%/[^/]*$%%'\`
4004 test \"x\$thisdir\" = \"x\$file\" && thisdir=.
4006 # Follow symbolic links until we get to the real thisdir.
4007 file=\`ls -ld \"\$file\" | $SED -n 's/.*-> //p'\`
4008 while test -n \"\$file\"; do
4009 destdir=\`\$ECHO \"\$file\" | $SED 's%/[^/]*\$%%'\`
4011 # If there was a directory component, then change thisdir.
4012 if test \"x\$destdir\" != \"x\$file\"; then
4013 case \"\$destdir\" in
4014 [\\\\/]* | [A-Za-z]:[\\\\/]*) thisdir=\"\$destdir\" ;;
4015 *) thisdir=\"\$thisdir/\$destdir\" ;;
4019 file=\`\$ECHO \"\$file\" | $SED 's%^.*/%%'\`
4020 file=\`ls -ld \"\$thisdir/\$file\" | $SED -n 's/.*-> //p'\`
4023 # Usually 'no', except on cygwin/mingw when embedded into
4025 WRAPPER_SCRIPT_BELONGS_IN_OBJDIR=$func_emit_wrapper_arg1
4026 if test \"\$WRAPPER_SCRIPT_BELONGS_IN_OBJDIR\" = \"yes\"; then
4027 # special case for '.'
4028 if test \"\$thisdir\" = \".\"; then
4031 # remove .libs from thisdir
4032 case \"\$thisdir\" in
4033 *[\\\\/]$objdir ) thisdir=\`\$ECHO \"\$thisdir\" | $SED 's%[\\\\/][^\\\\/]*$%%'\` ;;
4034 $objdir ) thisdir=. ;;
4038 # Try to get the absolute directory name.
4039 absdir=\`cd \"\$thisdir\" && pwd\`
4040 test -n \"\$absdir\" && thisdir=\"\$absdir\"
4043 if test "$fast_install" = yes; then
4045 program=lt-'$outputname'$exeext
4046 progdir=\"\$thisdir/$objdir\"
4048 if test ! -f \"\$progdir/\$program\" ||
4049 { file=\`ls -1dt \"\$progdir/\$program\" \"\$progdir/../\$program\" 2>/dev/null | ${SED} 1q\`; \\
4050 test \"X\$file\" != \"X\$progdir/\$program\"; }; then
4052 file=\"\$\$-\$program\"
4054 if test ! -d \"\$progdir\"; then
4055 $MKDIR \"\$progdir\"
4057 $RM \"\$progdir/\$file\"
4062 # relink executable if necessary
4063 if test -n \"\$relink_command\"; then
4064 if relink_command_output=\`eval \$relink_command 2>&1\`; then :
4066 $ECHO \"\$relink_command_output\" >&2
4067 $RM \"\$progdir/\$file\"
4072 $MV \"\$progdir/\$file\" \"\$progdir/\$program\" 2>/dev/null ||
4073 { $RM \"\$progdir/\$program\";
4074 $MV \"\$progdir/\$file\" \"\$progdir/\$program\"; }
4075 $RM \"\$progdir/\$file\"
4079 program='$outputname'
4080 progdir=\"\$thisdir/$objdir\"
4086 if test -f \"\$progdir/\$program\"; then"
4088 # fixup the dll searchpath if we need to.
4090 # Fix the DLL searchpath if we need to. Do this before prepending
4091 # to shlibpath, because on Windows, both are PATH and uninstalled
4092 # libraries must come first.
4093 if test -n "$dllsearchpath"; then
4095 # Add the dll search path components to the executable PATH
4096 PATH=$dllsearchpath:\$PATH
4100 # Export our shlibpath_var if we have one.
4101 if test "$shlibpath_overrides_runpath" = yes && test -n "$shlibpath_var" && test -n "$temp_rpath"; then
4103 # Add our own library path to $shlibpath_var
4104 $shlibpath_var=\"$temp_rpath\$$shlibpath_var\"
4106 # Some systems cannot cope with colon-terminated $shlibpath_var
4107 # The second colon is a workaround for a bug in BeOS R4 sed
4108 $shlibpath_var=\`\$ECHO \"\$$shlibpath_var\" | $SED 's/::*\$//'\`
4110 export $shlibpath_var
4115 if test \"\$libtool_execute_magic\" != \"$magic\"; then
4116 # Run the actual program with our arguments.
4117 func_exec_program \${1+\"\$@\"}
4120 # The program doesn't exist.
4121 \$ECHO \"\$0: error: \\\`\$progdir/\$program' does not exist\" 1>&2
4122 \$ECHO \"This script is just a wrapper for \$program.\" 1>&2
4123 \$ECHO \"See the $PACKAGE documentation for more information.\" 1>&2
4131 # func_emit_cwrapperexe_src
4132 # emit the source code for a wrapper executable on stdout
4133 # Must ONLY be called from within func_mode_link because
4134 # it depends on a number of variable set therein.
4135 func_emit_cwrapperexe_src ()
4139 /* $cwrappersource - temporary wrapper executable for $objdir/$outputname
4140 Generated by $PROGRAM (GNU $PACKAGE$TIMESTAMP) $VERSION
4142 The $output program cannot be directly executed until all the libtool
4143 libraries that it depends on are installed.
4145 This wrapper executable should never be moved out of the build directory.
4146 If it is, it will not operate correctly.
4151 # define _CRT_SECURE_NO_DEPRECATE 1
4156 # include <direct.h>
4157 # include <process.h>
4160 # include <unistd.h>
4161 # include <stdint.h>
4173 #include <sys/stat.h>
4175 /* declarations of non-ANSI functions */
4176 #if defined(__MINGW32__)
4177 # ifdef __STRICT_ANSI__
4178 int _putenv (const char *);
4180 #elif defined(__CYGWIN__)
4181 # ifdef __STRICT_ANSI__
4182 char *realpath (const char *, char *);
4183 int putenv (char *);
4184 int setenv (const char *, const char *, int);
4186 /* #elif defined (other platforms) ... */
4189 /* portability defines, excluding path handling macros */
4190 #if defined(_MSC_VER)
4191 # define setmode _setmode
4193 # define chmod _chmod
4194 # define getcwd _getcwd
4195 # define putenv _putenv
4196 # define S_IXUSR _S_IEXEC
4197 # ifndef _INTPTR_T_DEFINED
4198 # define _INTPTR_T_DEFINED
4199 # define intptr_t int
4201 #elif defined(__MINGW32__)
4202 # define setmode _setmode
4204 # define chmod _chmod
4205 # define getcwd _getcwd
4206 # define putenv _putenv
4207 #elif defined(__CYGWIN__)
4208 # define HAVE_SETENV
4209 # define FOPEN_WB "wb"
4210 /* #elif defined (other platforms) ... */
4213 #if defined(PATH_MAX)
4214 # define LT_PATHMAX PATH_MAX
4215 #elif defined(MAXPATHLEN)
4216 # define LT_PATHMAX MAXPATHLEN
4218 # define LT_PATHMAX 1024
4228 /* path handling portability macros */
4229 #ifndef DIR_SEPARATOR
4230 # define DIR_SEPARATOR '/'
4231 # define PATH_SEPARATOR ':'
4234 #if defined (_WIN32) || defined (__MSDOS__) || defined (__DJGPP__) || \
4236 # define HAVE_DOS_BASED_FILE_SYSTEM
4237 # define FOPEN_WB "wb"
4238 # ifndef DIR_SEPARATOR_2
4239 # define DIR_SEPARATOR_2 '\\'
4241 # ifndef PATH_SEPARATOR_2
4242 # define PATH_SEPARATOR_2 ';'
4246 #ifndef DIR_SEPARATOR_2
4247 # define IS_DIR_SEPARATOR(ch) ((ch) == DIR_SEPARATOR)
4248 #else /* DIR_SEPARATOR_2 */
4249 # define IS_DIR_SEPARATOR(ch) \
4250 (((ch) == DIR_SEPARATOR) || ((ch) == DIR_SEPARATOR_2))
4251 #endif /* DIR_SEPARATOR_2 */
4253 #ifndef PATH_SEPARATOR_2
4254 # define IS_PATH_SEPARATOR(ch) ((ch) == PATH_SEPARATOR)
4255 #else /* PATH_SEPARATOR_2 */
4256 # define IS_PATH_SEPARATOR(ch) ((ch) == PATH_SEPARATOR_2)
4257 #endif /* PATH_SEPARATOR_2 */
4260 # define FOPEN_WB "w"
4263 # define _O_BINARY 0
4266 #define XMALLOC(type, num) ((type *) xmalloc ((num) * sizeof(type)))
4267 #define XFREE(stale) do { \
4268 if (stale) { free ((void *) stale); stale = 0; } \
4271 #if defined(LT_DEBUGWRAPPER)
4272 static int lt_debug = 1;
4274 static int lt_debug = 0;
4277 const char *program_name = "libtool-wrapper"; /* in case xstrdup fails */
4279 void *xmalloc (size_t num);
4280 char *xstrdup (const char *string);
4281 const char *base_name (const char *name);
4282 char *find_executable (const char *wrapper);
4283 char *chase_symlinks (const char *pathspec);
4284 int make_executable (const char *path);
4285 int check_executable (const char *path);
4286 char *strendzap (char *str, const char *pat);
4287 void lt_debugprintf (const char *file, int line, const char *fmt, ...);
4288 void lt_fatal (const char *file, int line, const char *message, ...);
4289 static const char *nonnull (const char *s);
4290 static const char *nonempty (const char *s);
4291 void lt_setenv (const char *name, const char *value);
4292 char *lt_extend_str (const char *orig_value, const char *add, int to_end);
4293 void lt_update_exe_path (const char *name, const char *value);
4294 void lt_update_lib_path (const char *name, const char *value);
4295 char **prepare_spawn (char **argv);
4296 void lt_dump_script (FILE *f);
4300 volatile const char * MAGIC_EXE = "$magic_exe";
4301 const char * LIB_PATH_VARNAME = "$shlibpath_var";
4304 if test "$shlibpath_overrides_runpath" = yes && test -n "$shlibpath_var" && test -n "$temp_rpath"; then
4305 func_to_host_path "$temp_rpath"
4307 const char * LIB_PATH_VALUE = "$func_to_host_path_result";
4311 const char * LIB_PATH_VALUE = "";
4315 if test -n "$dllsearchpath"; then
4316 func_to_host_path "$dllsearchpath:"
4318 const char * EXE_PATH_VARNAME = "PATH";
4319 const char * EXE_PATH_VALUE = "$func_to_host_path_result";
4323 const char * EXE_PATH_VARNAME = "";
4324 const char * EXE_PATH_VALUE = "";
4328 if test "$fast_install" = yes; then
4330 const char * TARGET_PROGRAM_NAME = "lt-$outputname"; /* hopefully, no .exe */
4334 const char * TARGET_PROGRAM_NAME = "$outputname"; /* hopefully, no .exe */
4341 #define LTWRAPPER_OPTION_PREFIX "--lt-"
4343 static const char *ltwrapper_option_prefix = LTWRAPPER_OPTION_PREFIX;
4344 static const char *dumpscript_opt = LTWRAPPER_OPTION_PREFIX "dump-script";
4345 static const char *debug_opt = LTWRAPPER_OPTION_PREFIX "debug";
4348 main (int argc, char *argv[])
4353 char *actual_cwrapper_path;
4354 char *actual_cwrapper_name;
4357 intptr_t rval = 127;
4361 program_name = (char *) xstrdup (base_name (argv[0]));
4362 newargz = XMALLOC (char *, argc + 1);
4364 /* very simple arg parsing; don't want to rely on getopt
4365 * also, copy all non cwrapper options to newargz, except
4366 * argz[0], which is handled differently
4369 for (i = 1; i < argc; i++)
4371 if (strcmp (argv[i], dumpscript_opt) == 0)
4375 *mingw* | *cygwin* )
4376 # make stdout use "unix" line endings
4377 echo " setmode(1,_O_BINARY);"
4382 lt_dump_script (stdout);
4385 if (strcmp (argv[i], debug_opt) == 0)
4390 if (strcmp (argv[i], ltwrapper_option_prefix) == 0)
4392 /* however, if there is an option in the LTWRAPPER_OPTION_PREFIX
4393 namespace, but it is not one of the ones we know about and
4394 have already dealt with, above (inluding dump-script), then
4395 report an error. Otherwise, targets might begin to believe
4396 they are allowed to use options in the LTWRAPPER_OPTION_PREFIX
4397 namespace. The first time any user complains about this, we'll
4398 need to make LTWRAPPER_OPTION_PREFIX a configure-time option
4399 or a configure.ac-settable value.
4401 lt_fatal (__FILE__, __LINE__,
4402 "unrecognized %s option: '%s'",
4403 ltwrapper_option_prefix, argv[i]);
4406 newargz[++newargc] = xstrdup (argv[i]);
4408 newargz[++newargc] = NULL;
4412 /* The GNU banner must be the first non-error debug message */
4413 lt_debugprintf (__FILE__, __LINE__, "libtool wrapper (GNU $PACKAGE$TIMESTAMP) $VERSION\n");
4416 lt_debugprintf (__FILE__, __LINE__, "(main) argv[0]: %s\n", argv[0]);
4417 lt_debugprintf (__FILE__, __LINE__, "(main) program_name: %s\n", program_name);
4419 tmp_pathspec = find_executable (argv[0]);
4420 if (tmp_pathspec == NULL)
4421 lt_fatal (__FILE__, __LINE__, "couldn't find %s", argv[0]);
4422 lt_debugprintf (__FILE__, __LINE__,
4423 "(main) found exe (before symlink chase) at: %s\n",
4426 actual_cwrapper_path = chase_symlinks (tmp_pathspec);
4427 lt_debugprintf (__FILE__, __LINE__,
4428 "(main) found exe (after symlink chase) at: %s\n",
4429 actual_cwrapper_path);
4430 XFREE (tmp_pathspec);
4432 actual_cwrapper_name = xstrdup (base_name (actual_cwrapper_path));
4433 strendzap (actual_cwrapper_path, actual_cwrapper_name);
4435 /* wrapper name transforms */
4436 strendzap (actual_cwrapper_name, ".exe");
4437 tmp_pathspec = lt_extend_str (actual_cwrapper_name, ".exe", 1);
4438 XFREE (actual_cwrapper_name);
4439 actual_cwrapper_name = tmp_pathspec;
4442 /* target_name transforms -- use actual target program name; might have lt- prefix */
4443 target_name = xstrdup (base_name (TARGET_PROGRAM_NAME));
4444 strendzap (target_name, ".exe");
4445 tmp_pathspec = lt_extend_str (target_name, ".exe", 1);
4446 XFREE (target_name);
4447 target_name = tmp_pathspec;
4450 lt_debugprintf (__FILE__, __LINE__,
4451 "(main) libtool target name: %s\n",
4457 XMALLOC (char, (strlen (actual_cwrapper_path) +
4458 strlen ("$objdir") + 1 + strlen (actual_cwrapper_name) + 1));
4459 strcpy (newargz[0], actual_cwrapper_path);
4460 strcat (newargz[0], "$objdir");
4461 strcat (newargz[0], "/");
4465 /* stop here, and copy so we don't have to do this twice */
4466 tmp_pathspec = xstrdup (newargz[0]);
4468 /* do NOT want the lt- prefix here, so use actual_cwrapper_name */
4469 strcat (newargz[0], actual_cwrapper_name);
4471 /* DO want the lt- prefix here if it exists, so use target_name */
4472 lt_argv_zero = lt_extend_str (tmp_pathspec, target_name, 1);
4473 XFREE (tmp_pathspec);
4474 tmp_pathspec = NULL;
4482 while ((p = strchr (newargz[0], '\\')) != NULL)
4486 while ((p = strchr (lt_argv_zero, '\\')) != NULL)
4496 XFREE (target_name);
4497 XFREE (actual_cwrapper_path);
4498 XFREE (actual_cwrapper_name);
4500 lt_setenv ("BIN_SH", "xpg4"); /* for Tru64 */
4501 lt_setenv ("DUALCASE", "1"); /* for MSK sh */
4502 /* Update the DLL searchpath. EXE_PATH_VALUE ($dllsearchpath) must
4503 be prepended before (that is, appear after) LIB_PATH_VALUE ($temp_rpath)
4504 because on Windows, both *_VARNAMEs are PATH but uninstalled
4505 libraries must come first. */
4506 lt_update_exe_path (EXE_PATH_VARNAME, EXE_PATH_VALUE);
4507 lt_update_lib_path (LIB_PATH_VARNAME, LIB_PATH_VALUE);
4509 lt_debugprintf (__FILE__, __LINE__, "(main) lt_argv_zero: %s\n",
4510 nonnull (lt_argv_zero));
4511 for (i = 0; i < newargc; i++)
4513 lt_debugprintf (__FILE__, __LINE__, "(main) newargz[%d]: %s\n",
4514 i, nonnull (newargz[i]));
4522 /* execv doesn't actually work on mingw as expected on unix */
4523 newargz = prepare_spawn (newargz);
4524 rval = _spawnv (_P_WAIT, lt_argv_zero, (const char * const *) newargz);
4527 /* failed to start process */
4528 lt_debugprintf (__FILE__, __LINE__,
4529 "(main) failed to launch target \"%s\": %s\n",
4530 lt_argv_zero, nonnull (strerror (errno)));
4538 execv (lt_argv_zero, newargz);
4539 return rval; /* =127, but avoids unused variable warning */
4548 xmalloc (size_t num)
4550 void *p = (void *) malloc (num);
4552 lt_fatal (__FILE__, __LINE__, "memory exhausted");
4558 xstrdup (const char *string)
4560 return string ? strcpy ((char *) xmalloc (strlen (string) + 1),
4565 base_name (const char *name)
4569 #if defined (HAVE_DOS_BASED_FILE_SYSTEM)
4570 /* Skip over the disk name in MSDOS pathnames. */
4571 if (isalpha ((unsigned char) name[0]) && name[1] == ':')
4575 for (base = name; *name; name++)
4576 if (IS_DIR_SEPARATOR (*name))
4582 check_executable (const char *path)
4586 lt_debugprintf (__FILE__, __LINE__, "(check_executable): %s\n",
4588 if ((!path) || (!*path))
4591 if ((stat (path, &st) >= 0)
4592 && (st.st_mode & (S_IXUSR | S_IXGRP | S_IXOTH)))
4599 make_executable (const char *path)
4604 lt_debugprintf (__FILE__, __LINE__, "(make_executable): %s\n",
4606 if ((!path) || (!*path))
4609 if (stat (path, &st) >= 0)
4611 rval = chmod (path, st.st_mode | S_IXOTH | S_IXGRP | S_IXUSR);
4616 /* Searches for the full path of the wrapper. Returns
4617 newly allocated full path name if found, NULL otherwise
4618 Does not chase symlinks, even on platforms that support them.
4621 find_executable (const char *wrapper)
4626 /* static buffer for getcwd */
4627 char tmp[LT_PATHMAX + 1];
4631 lt_debugprintf (__FILE__, __LINE__, "(find_executable): %s\n",
4632 nonempty (wrapper));
4634 if ((wrapper == NULL) || (*wrapper == '\0'))
4637 /* Absolute path? */
4638 #if defined (HAVE_DOS_BASED_FILE_SYSTEM)
4639 if (isalpha ((unsigned char) wrapper[0]) && wrapper[1] == ':')
4641 concat_name = xstrdup (wrapper);
4642 if (check_executable (concat_name))
4644 XFREE (concat_name);
4649 if (IS_DIR_SEPARATOR (wrapper[0]))
4651 concat_name = xstrdup (wrapper);
4652 if (check_executable (concat_name))
4654 XFREE (concat_name);
4656 #if defined (HAVE_DOS_BASED_FILE_SYSTEM)
4660 for (p = wrapper; *p; p++)
4668 /* no slashes; search PATH */
4669 const char *path = getenv ("PATH");
4672 for (p = path; *p; p = p_next)
4676 for (q = p; *q; q++)
4677 if (IS_PATH_SEPARATOR (*q))
4680 p_next = (*q == '\0' ? q : q + 1);
4683 /* empty path: current directory */
4684 if (getcwd (tmp, LT_PATHMAX) == NULL)
4685 lt_fatal (__FILE__, __LINE__, "getcwd failed: %s",
4686 nonnull (strerror (errno)));
4687 tmp_len = strlen (tmp);
4689 XMALLOC (char, tmp_len + 1 + strlen (wrapper) + 1);
4690 memcpy (concat_name, tmp, tmp_len);
4691 concat_name[tmp_len] = '/';
4692 strcpy (concat_name + tmp_len + 1, wrapper);
4697 XMALLOC (char, p_len + 1 + strlen (wrapper) + 1);
4698 memcpy (concat_name, p, p_len);
4699 concat_name[p_len] = '/';
4700 strcpy (concat_name + p_len + 1, wrapper);
4702 if (check_executable (concat_name))
4704 XFREE (concat_name);
4707 /* not found in PATH; assume curdir */
4709 /* Relative path | not found in path: prepend cwd */
4710 if (getcwd (tmp, LT_PATHMAX) == NULL)
4711 lt_fatal (__FILE__, __LINE__, "getcwd failed: %s",
4712 nonnull (strerror (errno)));
4713 tmp_len = strlen (tmp);
4714 concat_name = XMALLOC (char, tmp_len + 1 + strlen (wrapper) + 1);
4715 memcpy (concat_name, tmp, tmp_len);
4716 concat_name[tmp_len] = '/';
4717 strcpy (concat_name + tmp_len + 1, wrapper);
4719 if (check_executable (concat_name))
4721 XFREE (concat_name);
4726 chase_symlinks (const char *pathspec)
4729 return xstrdup (pathspec);
4731 char buf[LT_PATHMAX];
4733 char *tmp_pathspec = xstrdup (pathspec);
4735 int has_symlinks = 0;
4736 while (strlen (tmp_pathspec) && !has_symlinks)
4738 lt_debugprintf (__FILE__, __LINE__,
4739 "checking path component for symlinks: %s\n",
4741 if (lstat (tmp_pathspec, &s) == 0)
4743 if (S_ISLNK (s.st_mode) != 0)
4749 /* search backwards for last DIR_SEPARATOR */
4750 p = tmp_pathspec + strlen (tmp_pathspec) - 1;
4751 while ((p > tmp_pathspec) && (!IS_DIR_SEPARATOR (*p)))
4753 if ((p == tmp_pathspec) && (!IS_DIR_SEPARATOR (*p)))
4755 /* no more DIR_SEPARATORS left */
4762 lt_fatal (__FILE__, __LINE__,
4763 "error accessing file \"%s\": %s",
4764 tmp_pathspec, nonnull (strerror (errno)));
4767 XFREE (tmp_pathspec);
4771 return xstrdup (pathspec);
4774 tmp_pathspec = realpath (pathspec, buf);
4775 if (tmp_pathspec == 0)
4777 lt_fatal (__FILE__, __LINE__,
4778 "could not follow symlinks for %s", pathspec);
4780 return xstrdup (tmp_pathspec);
4785 strendzap (char *str, const char *pat)
4789 assert (str != NULL);
4790 assert (pat != NULL);
4793 patlen = strlen (pat);
4797 str += len - patlen;
4798 if (strcmp (str, pat) == 0)
4805 lt_debugprintf (const char *file, int line, const char *fmt, ...)
4810 (void) fprintf (stderr, "%s:%s:%d: ", program_name, file, line);
4811 va_start (args, fmt);
4812 (void) vfprintf (stderr, fmt, args);
4818 lt_error_core (int exit_status, const char *file,
4819 int line, const char *mode,
4820 const char *message, va_list ap)
4822 fprintf (stderr, "%s:%s:%d: %s: ", program_name, file, line, mode);
4823 vfprintf (stderr, message, ap);
4824 fprintf (stderr, ".\n");
4826 if (exit_status >= 0)
4831 lt_fatal (const char *file, int line, const char *message, ...)
4834 va_start (ap, message);
4835 lt_error_core (EXIT_FAILURE, file, line, "FATAL", message, ap);
4840 nonnull (const char *s)
4842 return s ? s : "(null)";
4846 nonempty (const char *s)
4848 return (s && !*s) ? "(empty)" : nonnull (s);
4852 lt_setenv (const char *name, const char *value)
4854 lt_debugprintf (__FILE__, __LINE__,
4855 "(lt_setenv) setting '%s' to '%s'\n",
4856 nonnull (name), nonnull (value));
4859 /* always make a copy, for consistency with !HAVE_SETENV */
4860 char *str = xstrdup (value);
4861 setenv (name, str, 1);
4863 int len = strlen (name) + 1 + strlen (value) + 1;
4864 char *str = XMALLOC (char, len);
4865 sprintf (str, "%s=%s", name, value);
4866 if (putenv (str) != EXIT_SUCCESS)
4875 lt_extend_str (const char *orig_value, const char *add, int to_end)
4878 if (orig_value && *orig_value)
4880 int orig_value_len = strlen (orig_value);
4881 int add_len = strlen (add);
4882 new_value = XMALLOC (char, add_len + orig_value_len + 1);
4885 strcpy (new_value, orig_value);
4886 strcpy (new_value + orig_value_len, add);
4890 strcpy (new_value, add);
4891 strcpy (new_value + add_len, orig_value);
4896 new_value = xstrdup (add);
4902 lt_update_exe_path (const char *name, const char *value)
4904 lt_debugprintf (__FILE__, __LINE__,
4905 "(lt_update_exe_path) modifying '%s' by prepending '%s'\n",
4906 nonnull (name), nonnull (value));
4908 if (name && *name && value && *value)
4910 char *new_value = lt_extend_str (getenv (name), value, 0);
4911 /* some systems can't cope with a ':'-terminated path #' */
4912 int len = strlen (new_value);
4913 while (((len = strlen (new_value)) > 0) && IS_PATH_SEPARATOR (new_value[len-1]))
4915 new_value[len-1] = '\0';
4917 lt_setenv (name, new_value);
4923 lt_update_lib_path (const char *name, const char *value)
4925 lt_debugprintf (__FILE__, __LINE__,
4926 "(lt_update_lib_path) modifying '%s' by prepending '%s'\n",
4927 nonnull (name), nonnull (value));
4929 if (name && *name && value && *value)
4931 char *new_value = lt_extend_str (getenv (name), value, 0);
4932 lt_setenv (name, new_value);
4942 /* Prepares an argument vector before calling spawn().
4943 Note that spawn() does not by itself call the command interpreter
4944 (getenv ("COMSPEC") != NULL ? getenv ("COMSPEC") :
4945 ({ OSVERSIONINFO v; v.dwOSVersionInfoSize = sizeof(OSVERSIONINFO);
4947 v.dwPlatformId == VER_PLATFORM_WIN32_NT;
4948 }) ? "cmd.exe" : "command.com").
4949 Instead it simply concatenates the arguments, separated by ' ', and calls
4950 CreateProcess(). We must quote the arguments since Win32 CreateProcess()
4951 interprets characters like ' ', '\t', '\\', '"' (but not '<' and '>') in a
4953 - Space and tab are interpreted as delimiters. They are not treated as
4954 delimiters if they are surrounded by double quotes: "...".
4955 - Unescaped double quotes are removed from the input. Their only effect is
4956 that within double quotes, space and tab are treated like normal
4958 - Backslashes not followed by double quotes are not special.
4959 - But 2*n+1 backslashes followed by a double quote become
4960 n backslashes followed by a double quote (n >= 0):
4965 #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"
4966 #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"
4968 prepare_spawn (char **argv)
4974 /* Count number of arguments. */
4975 for (argc = 0; argv[argc] != NULL; argc++)
4978 /* Allocate new argument vector. */
4979 new_argv = XMALLOC (char *, argc + 1);
4981 /* Put quoted arguments into the new argument vector. */
4982 for (i = 0; i < argc; i++)
4984 const char *string = argv[i];
4986 if (string[0] == '\0')
4987 new_argv[i] = xstrdup ("\"\"");
4988 else if (strpbrk (string, SHELL_SPECIAL_CHARS) != NULL)
4990 int quote_around = (strpbrk (string, SHELL_SPACE_CHARS) != NULL);
4992 unsigned int backslashes;
4994 char *quoted_string;
5001 for (s = string; *s != '\0'; s++)
5005 length += backslashes + 1;
5013 length += backslashes + 1;
5015 quoted_string = XMALLOC (char, length + 1);
5021 for (s = string; *s != '\0'; s++)
5027 for (j = backslashes + 1; j > 0; j--)
5039 for (j = backslashes; j > 0; j--)
5045 new_argv[i] = quoted_string;
5048 new_argv[i] = (char *) string;
5050 new_argv[argc] = NULL;
5059 void lt_dump_script (FILE* f)
5062 func_emit_wrapper yes |
5063 $SED -e 's/\([\\"]\)/\\\1/g' \
5064 -e 's/^/ fputs ("/' -e 's/$/\\n", f);/'
5070 # end: func_emit_cwrapperexe_src
5072 # func_win32_import_lib_p ARG
5073 # True if ARG is an import lib, as indicated by $file_magic_cmd
5074 func_win32_import_lib_p ()
5077 case `eval $file_magic_cmd \"\$1\" 2>/dev/null | $SED -e 10q` in
5083 # func_mode_link arg...
5088 *-*-cygwin* | *-*-mingw* | *-*-pw32* | *-*-os2* | *-cegcc*)
5089 # It is impossible to link a dll without this setting, and
5090 # we shouldn't force the makefile maintainer to figure out
5091 # which system we are compiling for in order to pass an extra
5092 # flag for every libtool invocation.
5093 # allow_undefined=no
5095 # FIXME: Unfortunately, there are problems with the above when trying
5096 # to make a dll which has undefined symbols, in which case not
5097 # even a static library is built. For now, we need to specify
5098 # -no-undefined on the libtool link line when we can be certain
5099 # that all symbols are satisfied, otherwise we get a static library.
5106 libtool_args=$nonopt
5107 base_compile="$nonopt $@"
5108 compile_command=$nonopt
5109 finalize_command=$nonopt
5122 lib_search_path=`pwd`
5124 new_inherited_linker_flags=
5133 export_symbols_regex=
5141 precious_files_regex=
5142 prefer_static_libs=no
5155 single_module="${wl}-single_module"
5156 func_infer_tag $base_compile
5158 # We need to know -static, to get the right output filenames.
5163 test "$build_libtool_libs" != yes && \
5164 func_fatal_configuration "can not build a shared library"
5168 -all-static | -static | -static-libtool-libs)
5171 if test "$build_libtool_libs" = yes && test -z "$link_static_flag"; then
5172 func_warning "complete static linking is impossible in this configuration"
5174 if test -n "$link_static_flag"; then
5175 dlopen_self=$dlopen_self_static
5177 prefer_static_libs=yes
5180 if test -z "$pic_flag" && test -n "$link_static_flag"; then
5181 dlopen_self=$dlopen_self_static
5183 prefer_static_libs=built
5185 -static-libtool-libs)
5186 if test -z "$pic_flag" && test -n "$link_static_flag"; then
5187 dlopen_self=$dlopen_self_static
5189 prefer_static_libs=yes
5192 build_libtool_libs=no
5199 # See if our shared archives depend on static archives.
5200 test -n "$old_archive_from_new_cmds" && build_old_libs=yes
5202 # Go through the arguments, transforming them on the way.
5203 while test "$#" -gt 0; do
5206 func_quote_for_eval "$arg"
5207 qarg=$func_quote_for_eval_unquoted_result
5208 func_append libtool_args " $func_quote_for_eval_result"
5210 # If the previous option needs an argument, assign it.
5211 if test -n "$prev"; then
5214 func_append compile_command " @OUTPUT@"
5215 func_append finalize_command " @OUTPUT@"
5226 if test "$preload" = no; then
5227 # Add the symbol object into the linking commands.
5228 func_append compile_command " @SYMFILE@"
5229 func_append finalize_command " @SYMFILE@"
5233 *.la | *.lo) ;; # We handle these cases below.
5235 if test "$dlself" = no; then
5243 if test "$prev" = dlprefiles; then
5245 elif test "$prev" = dlfiles && test "$dlopen_self" != yes; then
5255 if test "$prev" = dlfiles; then
5256 func_append dlfiles " $arg"
5258 func_append dlprefiles " $arg"
5266 export_symbols="$arg"
5268 || func_fatal_error "symbol file \`$arg' does not exist"
5273 export_symbols_regex="$arg"
5281 *" $qarg.ltframework "*) ;;
5282 *) func_append deplibs " $qarg.ltframework" # this is fixed later
5291 inst_prefix_dir="$arg"
5296 if test -f "$arg"; then
5299 for fil in `cat "$save_arg"`
5301 # func_append moreargs " $fil"
5303 # A libtool-controlled object.
5305 # Check to see that this really is a libtool object.
5306 if func_lalib_unsafe_p "$arg"; then
5313 if test -z "$pic_object" ||
5314 test -z "$non_pic_object" ||
5315 test "$pic_object" = none &&
5316 test "$non_pic_object" = none; then
5317 func_fatal_error "cannot find name of object for \`$arg'"
5320 # Extract subdirectory from the argument.
5321 func_dirname "$arg" "/" ""
5322 xdir="$func_dirname_result"
5324 if test "$pic_object" != none; then
5325 # Prepend the subdirectory the object is found in.
5326 pic_object="$xdir$pic_object"
5328 if test "$prev" = dlfiles; then
5329 if test "$build_libtool_libs" = yes && test "$dlopen_support" = yes; then
5330 func_append dlfiles " $pic_object"
5334 # If libtool objects are unsupported, then we need to preload.
5339 # CHECK ME: I think I busted this. -Ossama
5340 if test "$prev" = dlprefiles; then
5341 # Preload the old-style object.
5342 func_append dlprefiles " $pic_object"
5347 func_append libobjs " $pic_object"
5352 if test "$non_pic_object" != none; then
5353 # Prepend the subdirectory the object is found in.
5354 non_pic_object="$xdir$non_pic_object"
5356 # A standard non-PIC object
5357 func_append non_pic_objects " $non_pic_object"
5358 if test -z "$pic_object" || test "$pic_object" = none ; then
5359 arg="$non_pic_object"
5362 # If the PIC object exists, use it instead.
5363 # $xdir was prepended to $pic_object above.
5364 non_pic_object="$pic_object"
5365 func_append non_pic_objects " $non_pic_object"
5368 # Only an error if not doing a dry-run.
5369 if $opt_dry_run; then
5370 # Extract subdirectory from the argument.
5371 func_dirname "$arg" "/" ""
5372 xdir="$func_dirname_result"
5375 pic_object=$xdir$objdir/$func_lo2o_result
5376 non_pic_object=$xdir$func_lo2o_result
5377 func_append libobjs " $pic_object"
5378 func_append non_pic_objects " $non_pic_object"
5380 func_fatal_error "\`$arg' is not a valid libtool object"
5385 func_fatal_error "link input file \`$arg' does not exist"
5392 precious_files_regex="$arg"
5402 # We need an absolute path.
5404 [\\/]* | [A-Za-z]:[\\/]*) ;;
5406 func_fatal_error "only absolute run-paths are allowed"
5409 if test "$prev" = rpath; then
5412 *) func_append rpath " $arg" ;;
5417 *) func_append xrpath " $arg" ;;
5429 func_append weak_libs " $arg"
5434 func_append linker_flags " $qarg"
5435 func_append compiler_flags " $qarg"
5437 func_append compile_command " $qarg"
5438 func_append finalize_command " $qarg"
5442 func_append compiler_flags " $qarg"
5444 func_append compile_command " $qarg"
5445 func_append finalize_command " $qarg"
5449 func_append linker_flags " $qarg"
5450 func_append compiler_flags " $wl$qarg"
5452 func_append compile_command " $wl$qarg"
5453 func_append finalize_command " $wl$qarg"
5457 eval "$prev=\"\$arg\""
5462 fi # test -n "$prev"
5468 if test -n "$link_static_flag"; then
5469 # See comment for -static flag below, for more details.
5470 func_append compile_command " $link_static_flag"
5471 func_append finalize_command " $link_static_flag"
5477 # FIXME: remove this flag sometime in the future.
5478 func_fatal_error "\`-allow-undefined' must not be used because it is the default"
5506 -export-symbols | -export-symbols-regex)
5507 if test -n "$export_symbols" || test -n "$export_symbols_regex"; then
5508 func_fatal_error "more than one -exported-symbols argument is not allowed"
5510 if test "X$arg" = "X-export-symbols"; then
5528 # The native IRIX linker understands -LANG:*, -LIST:* and -LNO:*
5529 # so, if we see these flags be careful not to treat them like -L
5531 case $with_gcc/$host in
5532 no/*-*-irix* | /*-*-irix*)
5533 func_append compile_command " $arg"
5534 func_append finalize_command " $arg"
5541 func_stripname "-L" '' "$arg"
5542 if test -z "$func_stripname_result"; then
5543 if test "$#" -gt 0; then
5544 func_fatal_error "require no space between \`-L' and \`$1'"
5546 func_fatal_error "need path for \`-L' option"
5549 func_resolve_sysroot "$func_stripname_result"
5550 dir=$func_resolve_sysroot_result
5551 # We need an absolute path.
5553 [\\/]* | [A-Za-z]:[\\/]*) ;;
5555 absdir=`cd "$dir" && pwd`
5556 test -z "$absdir" && \
5557 func_fatal_error "cannot determine absolute directory name of \`$dir'"
5562 *" -L$dir "* | *" $arg "*)
5563 # Will only happen for absolute or sysroot arguments
5566 # Preserve sysroot, but never include relative directories
5568 [\\/]* | [A-Za-z]:[\\/]* | =*) func_append deplibs " $arg" ;;
5569 *) func_append deplibs " -L$dir" ;;
5571 func_append lib_search_path " $dir"
5575 *-*-cygwin* | *-*-mingw* | *-*-pw32* | *-*-os2* | *-cegcc*)
5576 testbindir=`$ECHO "$dir" | $SED 's*/lib$*/bin*'`
5577 case :$dllsearchpath: in
5579 ::) dllsearchpath=$dir;;
5580 *) func_append dllsearchpath ":$dir";;
5582 case :$dllsearchpath: in
5583 *":$testbindir:"*) ;;
5584 ::) dllsearchpath=$testbindir;;
5585 *) func_append dllsearchpath ":$testbindir";;
5593 if test "X$arg" = "X-lc" || test "X$arg" = "X-lm"; then
5595 *-*-cygwin* | *-*-mingw* | *-*-pw32* | *-*-beos* | *-cegcc* | *-*-haiku*)
5596 # These systems don't actually have a C or math library (as such)
5600 # These systems don't actually have a C library (as such)
5601 test "X$arg" = "X-lc" && continue
5603 *-*-openbsd* | *-*-freebsd* | *-*-dragonfly*)
5604 # Do not include libc due to us having libc/libc_r.
5605 test "X$arg" = "X-lc" && continue
5607 *-*-rhapsody* | *-*-darwin1.[012])
5608 # Rhapsody C and math libraries are in the System framework
5609 func_append deplibs " System.ltframework"
5612 *-*-sco3.2v5* | *-*-sco5v6*)
5613 # Causes problems with __ctype
5614 test "X$arg" = "X-lc" && continue
5616 *-*-sysv4.2uw2* | *-*-sysv5* | *-*-unixware* | *-*-OpenUNIX*)
5617 # Compiler inserts libc in the correct place for threads to work
5618 test "X$arg" = "X-lc" && continue
5621 elif test "X$arg" = "X-lc_r"; then
5623 *-*-openbsd* | *-*-freebsd* | *-*-dragonfly*)
5624 # Do not include libc_r directly, use -pthread flag.
5629 func_append deplibs " $arg"
5638 # Tru64 UNIX uses -model [arg] to determine the layout of C++
5639 # classes, name mangling, and exception handling.
5640 # Darwin uses the -arch flag to determine output architecture.
5641 -model|-arch|-isysroot|--sysroot)
5642 func_append compiler_flags " $arg"
5643 func_append compile_command " $arg"
5644 func_append finalize_command " $arg"
5649 -mt|-mthreads|-kthread|-Kthread|-pthread|-pthreads|--thread-safe|-threads)
5650 func_append compiler_flags " $arg"
5651 func_append compile_command " $arg"
5652 func_append finalize_command " $arg"
5653 case "$new_inherited_linker_flags " in
5655 * ) func_append new_inherited_linker_flags " $arg" ;;
5661 single_module="${wl}-multi_module"
5672 *-*-cygwin* | *-*-mingw* | *-*-pw32* | *-*-os2* | *-*-darwin* | *-cegcc*)
5673 # The PATH hackery in wrapper scripts is required on Windows
5674 # and Darwin in order for the loader to find any dlls it needs.
5675 func_warning "\`-no-install' is ignored for $host"
5676 func_warning "assuming \`-no-fast-install' instead"
5679 *) no_install=yes ;;
5696 -precious-files-regex)
5717 func_stripname '-R' '' "$arg"
5718 dir=$func_stripname_result
5719 # We need an absolute path.
5721 [\\/]* | [A-Za-z]:[\\/]*) ;;
5723 func_stripname '=' '' "$dir"
5724 dir=$lt_sysroot$func_stripname_result
5727 func_fatal_error "only absolute run-paths are allowed"
5732 *) func_append xrpath " $dir" ;;
5738 # The effects of -shared are defined in a previous loop.
5747 -static | -static-libtool-libs)
5748 # The effects of -static are defined in a previous loop.
5749 # We used to do the same as -all-static on platforms that
5750 # didn't have a PIC flag, but the assumption that the effects
5751 # would be equivalent was wrong. It would break on at least
5752 # Digital Unix and AIX.
5778 func_stripname '-Wc,' '' "$arg"
5779 args=$func_stripname_result
5781 save_ifs="$IFS"; IFS=','
5782 for flag in $args; do
5784 func_quote_for_eval "$flag"
5785 func_append arg " $func_quote_for_eval_result"
5786 func_append compiler_flags " $func_quote_for_eval_result"
5789 func_stripname ' ' '' "$arg"
5790 arg=$func_stripname_result
5794 func_stripname '-Wl,' '' "$arg"
5795 args=$func_stripname_result
5797 save_ifs="$IFS"; IFS=','
5798 for flag in $args; do
5800 func_quote_for_eval "$flag"
5801 func_append arg " $wl$func_quote_for_eval_result"
5802 func_append compiler_flags " $wl$func_quote_for_eval_result"
5803 func_append linker_flags " $func_quote_for_eval_result"
5806 func_stripname ' ' '' "$arg"
5807 arg=$func_stripname_result
5827 func_quote_for_eval "$arg"
5828 arg="$func_quote_for_eval_result"
5831 # Flags to be passed through unchanged, with rationale:
5832 # -64, -mips[0-9] enable 64-bit mode for the SGI compiler
5833 # -r[0-9][0-9]* specify processor for the SGI compiler
5834 # -xarch=*, -xtarget=* enable 64-bit mode for the Sun compiler
5835 # +DA*, +DD* enable 64-bit mode for the HP compiler
5836 # -q* compiler args for the IBM compiler
5837 # -m*, -t[45]*, -txscale* architecture-specific flags for GCC
5838 # -F/path path to uninstalled frameworks, gcc on darwin
5839 # -p, -pg, --coverage, -fprofile-* profiling flags for GCC
5840 # @file GCC response files
5841 # -tp=* Portland pgcc target processor selection
5842 # --sysroot=* for sysroot support
5843 # -O*, -flto*, -fwhopr*, -fuse-linker-plugin GCC link-time optimization
5844 -64|-mips[0-9]|-r[0-9][0-9]*|-xarch=*|-xtarget=*|+DA*|+DD*|-q*|-m*| \
5845 -t[45]*|-txscale*|-p|-pg|--coverage|-fprofile-*|-F*|@*|-tp=*|--sysroot=*| \
5846 -O*|-flto*|-fwhopr*|-fuse-linker-plugin)
5847 func_quote_for_eval "$arg"
5848 arg="$func_quote_for_eval_result"
5849 func_append compile_command " $arg"
5850 func_append finalize_command " $arg"
5851 func_append compiler_flags " $arg"
5855 # Some other compiler flag.
5857 func_quote_for_eval "$arg"
5858 arg="$func_quote_for_eval_result"
5862 # A standard object.
5863 func_append objs " $arg"
5867 # A libtool-controlled object.
5869 # Check to see that this really is a libtool object.
5870 if func_lalib_unsafe_p "$arg"; then
5877 if test -z "$pic_object" ||
5878 test -z "$non_pic_object" ||
5879 test "$pic_object" = none &&
5880 test "$non_pic_object" = none; then
5881 func_fatal_error "cannot find name of object for \`$arg'"
5884 # Extract subdirectory from the argument.
5885 func_dirname "$arg" "/" ""
5886 xdir="$func_dirname_result"
5888 if test "$pic_object" != none; then
5889 # Prepend the subdirectory the object is found in.
5890 pic_object="$xdir$pic_object"
5892 if test "$prev" = dlfiles; then
5893 if test "$build_libtool_libs" = yes && test "$dlopen_support" = yes; then
5894 func_append dlfiles " $pic_object"
5898 # If libtool objects are unsupported, then we need to preload.
5903 # CHECK ME: I think I busted this. -Ossama
5904 if test "$prev" = dlprefiles; then
5905 # Preload the old-style object.
5906 func_append dlprefiles " $pic_object"
5911 func_append libobjs " $pic_object"
5916 if test "$non_pic_object" != none; then
5917 # Prepend the subdirectory the object is found in.
5918 non_pic_object="$xdir$non_pic_object"
5920 # A standard non-PIC object
5921 func_append non_pic_objects " $non_pic_object"
5922 if test -z "$pic_object" || test "$pic_object" = none ; then
5923 arg="$non_pic_object"
5926 # If the PIC object exists, use it instead.
5927 # $xdir was prepended to $pic_object above.
5928 non_pic_object="$pic_object"
5929 func_append non_pic_objects " $non_pic_object"
5932 # Only an error if not doing a dry-run.
5933 if $opt_dry_run; then
5934 # Extract subdirectory from the argument.
5935 func_dirname "$arg" "/" ""
5936 xdir="$func_dirname_result"
5939 pic_object=$xdir$objdir/$func_lo2o_result
5940 non_pic_object=$xdir$func_lo2o_result
5941 func_append libobjs " $pic_object"
5942 func_append non_pic_objects " $non_pic_object"
5944 func_fatal_error "\`$arg' is not a valid libtool object"
5951 func_append deplibs " $arg"
5952 func_append old_deplibs " $arg"
5957 # A libtool-controlled library.
5959 func_resolve_sysroot "$arg"
5960 if test "$prev" = dlfiles; then
5961 # This library was specified with -dlopen.
5962 func_append dlfiles " $func_resolve_sysroot_result"
5964 elif test "$prev" = dlprefiles; then
5965 # The library was specified with -dlpreopen.
5966 func_append dlprefiles " $func_resolve_sysroot_result"
5969 func_append deplibs " $func_resolve_sysroot_result"
5974 # Some other compiler argument.
5976 # Unknown arguments in both finalize_command and compile_command need
5977 # to be aesthetically quoted because they are evaled later.
5978 func_quote_for_eval "$arg"
5979 arg="$func_quote_for_eval_result"
5983 # Now actually substitute the argument into the commands.
5984 if test -n "$arg"; then
5985 func_append compile_command " $arg"
5986 func_append finalize_command " $arg"
5988 done # argument parsing loop
5990 if test "$module" = yes ; then
5991 # [Mandriva] dropping ld option "--no-undefined" which is wrong for plugins
5992 linker_flags=`$ECHO "X $linker_flags" | $Xsed -e 's/ --no-undefined//'`
5993 compiler_flags=`$ECHO "X $compiler_flags" | $Xsed -e 's/ -Wl,--no-undefined//'`
5996 test -n "$prev" && \
5997 func_fatal_help "the \`$prevarg' option requires an argument"
5999 if test "$export_dynamic" = yes && test -n "$export_dynamic_flag_spec"; then
6000 eval arg=\"$export_dynamic_flag_spec\"
6001 func_append compile_command " $arg"
6002 func_append finalize_command " $arg"
6006 # calculate the name of the file, without its directory
6007 func_basename "$output"
6008 outputname="$func_basename_result"
6009 libobjs_save="$libobjs"
6011 if test -n "$shlibpath_var"; then
6012 # get the directories listed in $shlibpath_var
6013 eval shlib_search_path=\`\$ECHO \"\${$shlibpath_var}\" \| \$SED \'s/:/ /g\'\`
6017 eval sys_lib_search_path=\"$sys_lib_search_path_spec\"
6018 eval sys_lib_dlsearch_path=\"$sys_lib_dlsearch_path_spec\"
6020 func_dirname "$output" "/" ""
6021 output_objdir="$func_dirname_result$objdir"
6022 func_to_tool_file "$output_objdir/"
6023 tool_output_objdir=$func_to_tool_file_result
6024 # Create the object directory.
6025 func_mkdir_p "$output_objdir"
6027 # Determine the type of output
6030 func_fatal_help "you must specify an output file"
6032 *.$libext) linkmode=oldlib ;;
6033 *.lo | *.$objext) linkmode=obj ;;
6034 *.la) linkmode=lib ;;
6035 *) linkmode=prog ;; # Anything else should be a program.
6041 # Find all interdependent deplibs by searching for libraries
6042 # that are linked more than once (e.g. -la -lb -la)
6043 for deplib in $deplibs; do
6044 if $opt_preserve_dup_deps ; then
6046 *" $deplib "*) func_append specialdeplibs " $deplib" ;;
6049 func_append libs " $deplib"
6052 if test "$linkmode" = lib; then
6053 libs="$predeps $libs $compiler_lib_search_path $postdeps"
6055 # Compute libraries that are listed more than once in $predeps
6056 # $postdeps and mark them as special (i.e., whose duplicates are
6057 # not to be eliminated).
6059 if $opt_duplicate_compiler_generated_deps; then
6060 for pre_post_dep in $predeps $postdeps; do
6061 case "$pre_post_deps " in
6062 *" $pre_post_dep "*) func_append specialdeplibs " $pre_post_deps" ;;
6064 func_append pre_post_deps " $pre_post_dep"
6073 need_relink=no # whether we're linking any uninstalled libtool libraries
6074 notinst_deplibs= # not-installed libtool libraries
6075 notinst_path= # paths that contain not-installed libtool libraries
6079 passes="conv dlpreopen link"
6080 for file in $dlfiles $dlprefiles; do
6084 func_fatal_help "libraries can \`-dlopen' only libtool libraries: $file"
6095 passes="conv scan dlopen dlpreopen link"
6101 for pass in $passes; do
6102 # The preopen pass in lib mode reverses $deplibs; put it back here
6103 # so that -L comes before libs that need it for instance...
6104 if test "$linkmode,$pass" = "lib,link"; then
6105 ## FIXME: Find the place where the list is rebuilt in the wrong
6106 ## order, and fix it there properly
6108 for deplib in $deplibs; do
6109 tmp_deplibs="$deplib $tmp_deplibs"
6111 deplibs="$tmp_deplibs"
6114 if test "$linkmode,$pass" = "lib,link" ||
6115 test "$linkmode,$pass" = "prog,scan"; then
6119 if test "$linkmode" = prog; then
6121 dlopen) libs="$dlfiles" ;;
6122 dlpreopen) libs="$dlprefiles" ;;
6124 libs="$deplibs %DEPLIBS%"
6125 test "X$link_all_deplibs" != Xno && libs="$libs $dependency_libs"
6129 if test "$linkmode,$pass" = "lib,dlpreopen"; then
6130 # Collect and forward deplibs of preopened libtool libs
6131 for lib in $dlprefiles; do
6132 # Ignore non-libtool-libs
6134 func_resolve_sysroot "$lib"
6136 *.la) func_source "$func_resolve_sysroot_result" ;;
6139 # Collect preopened libtool deplibs, except any this library
6140 # has declared as weak libs
6141 for deplib in $dependency_libs; do
6142 func_basename "$deplib"
6143 deplib_base=$func_basename_result
6144 case " $weak_libs " in
6145 *" $deplib_base "*) ;;
6146 *) func_append deplibs " $deplib" ;;
6152 if test "$pass" = dlopen; then
6153 # Collect dlpreopened libraries
6154 save_deplibs="$deplibs"
6158 for deplib in $libs; do
6162 -mt|-mthreads|-kthread|-Kthread|-pthread|-pthreads|--thread-safe|-threads)
6163 if test "$linkmode,$pass" = "prog,link"; then
6164 compile_deplibs="$deplib $compile_deplibs"
6165 finalize_deplibs="$deplib $finalize_deplibs"
6167 func_append compiler_flags " $deplib"
6168 if test "$linkmode" = lib ; then
6169 case "$new_inherited_linker_flags " in
6171 * ) func_append new_inherited_linker_flags " $deplib" ;;
6178 if test "$linkmode" != lib && test "$linkmode" != prog; then
6179 func_warning "\`-l' is ignored for archives/objects"
6182 func_stripname '-l' '' "$deplib"
6183 name=$func_stripname_result
6184 if test "$linkmode" = lib; then
6185 searchdirs="$newlib_search_path $lib_search_path $compiler_lib_search_dirs $sys_lib_search_path $shlib_search_path"
6187 searchdirs="$newlib_search_path $lib_search_path $sys_lib_search_path $shlib_search_path"
6189 for searchdir in $searchdirs; do
6190 for search_ext in .la $std_shrext .so .a; do
6191 # Search the libtool library
6192 lib="$searchdir/lib${name}${search_ext}"
6193 if test -f "$lib"; then
6194 if test "$search_ext" = ".la"; then
6203 if test "$found" != yes; then
6204 # deplib doesn't seem to be a libtool library
6205 if test "$linkmode,$pass" = "prog,link"; then
6206 compile_deplibs="$deplib $compile_deplibs"
6207 finalize_deplibs="$deplib $finalize_deplibs"
6209 deplibs="$deplib $deplibs"
6210 test "$linkmode" = lib && newdependency_libs="$deplib $newdependency_libs"
6213 else # deplib is a libtool library
6214 # If $allow_libtool_libs_with_static_runtimes && $deplib is a stdlib,
6215 # We need to do some special things here, and not later.
6216 if test "X$allow_libtool_libs_with_static_runtimes" = "Xyes" ; then
6217 case " $predeps $postdeps " in
6219 if func_lalib_p "$lib"; then
6223 for l in $old_library $library_names; do
6226 if test "X$ll" = "X$old_library" ; then # only static version available
6228 func_dirname "$lib" "" "."
6229 ladir="$func_dirname_result"
6230 lib=$ladir/$old_library
6231 if test "$linkmode,$pass" = "prog,link"; then
6232 compile_deplibs="$deplib $compile_deplibs"
6233 finalize_deplibs="$deplib $finalize_deplibs"
6235 deplibs="$deplib $deplibs"
6236 test "$linkmode" = lib && newdependency_libs="$deplib $newdependency_libs"
6248 if test "$linkmode,$pass" = "prog,link"; then
6249 compile_deplibs="$deplib $compile_deplibs"
6250 finalize_deplibs="$deplib $finalize_deplibs"
6252 deplibs="$deplib $deplibs"
6253 if test "$linkmode" = lib ; then
6254 case "$new_inherited_linker_flags " in
6256 * ) func_append new_inherited_linker_flags " $deplib" ;;
6265 deplibs="$deplib $deplibs"
6266 test "$pass" = conv && continue
6267 newdependency_libs="$deplib $newdependency_libs"
6268 func_stripname '-L' '' "$deplib"
6269 func_resolve_sysroot "$func_stripname_result"
6270 func_append newlib_search_path " $func_resolve_sysroot_result"
6273 if test "$pass" = conv; then
6274 deplibs="$deplib $deplibs"
6277 if test "$pass" = scan; then
6278 deplibs="$deplib $deplibs"
6280 compile_deplibs="$deplib $compile_deplibs"
6281 finalize_deplibs="$deplib $finalize_deplibs"
6283 func_stripname '-L' '' "$deplib"
6284 func_resolve_sysroot "$func_stripname_result"
6285 func_append newlib_search_path " $func_resolve_sysroot_result"
6288 func_warning "\`-L' is ignored for archives/objects"
6294 if test "$pass" = link; then
6295 func_stripname '-R' '' "$deplib"
6296 func_resolve_sysroot "$func_stripname_result"
6297 dir=$func_resolve_sysroot_result
6298 # Make sure the xrpath contains only unique directories.
6301 *) func_append xrpath " $dir" ;;
6304 deplibs="$deplib $deplibs"
6308 func_resolve_sysroot "$deplib"
6309 lib=$func_resolve_sysroot_result
6312 if test "$pass" = conv; then
6313 deplibs="$deplib $deplibs"
6318 # Linking convenience modules into shared libraries is allowed,
6319 # but linking other static libraries is non-portable.
6320 case " $dlpreconveniencelibs " in
6324 case $deplibs_check_method in
6326 set dummy $deplibs_check_method; shift
6327 match_pattern_regex=`expr "$deplibs_check_method" : "$1 \(.*\)"`
6328 if eval "\$ECHO \"$deplib\"" 2>/dev/null | $SED 10q \
6329 | $EGREP "$match_pattern_regex" > /dev/null; then
6337 if test "$valid_a_lib" != yes; then
6339 $ECHO "*** Warning: Trying to link with static lib archive $deplib."
6340 echo "*** I have the capability to make that library automatically link in when"
6341 echo "*** you link to this library. But I can only do this if you have a"
6342 echo "*** shared version of the library, which you do not appear to have"
6343 echo "*** because the file extensions .$libext of this argument makes me believe"
6344 echo "*** that it is just a static archive that I should not use here."
6347 $ECHO "*** Warning: Linking the shared library $output against the"
6348 $ECHO "*** static library $deplib is not portable!"
6349 deplibs="$deplib $deplibs"
6356 if test "$pass" != link; then
6357 deplibs="$deplib $deplibs"
6359 compile_deplibs="$deplib $compile_deplibs"
6360 finalize_deplibs="$deplib $finalize_deplibs"
6367 if test "$pass" = conv; then
6368 deplibs="$deplib $deplibs"
6369 elif test "$linkmode" = prog; then
6370 if test "$pass" = dlpreopen || test "$dlopen_support" != yes || test "$build_libtool_libs" = no; then
6371 # If there is no dlopen support or we're linking statically,
6372 # we need to preload.
6373 func_append newdlprefiles " $deplib"
6374 compile_deplibs="$deplib $compile_deplibs"
6375 finalize_deplibs="$deplib $finalize_deplibs"
6377 func_append newdlfiles " $deplib"
6388 if test "$found" = yes || test -f "$lib"; then :
6390 func_fatal_error "cannot find the library \`$lib' or unhandled argument \`$deplib'"
6393 # Check to see that this really is a libtool archive.
6394 func_lalib_unsafe_p "$lib" \
6395 || func_fatal_error "\`$lib' is not a valid libtool archive"
6397 func_dirname "$lib" "" "."
6398 ladir="$func_dirname_result"
6406 inherited_linker_flags=
6407 # If the library was installed with an old release of libtool,
6408 # it will not redefine variables installed, or shouldnotlink
6417 # Convert "-framework foo" to "foo.ltframework"
6418 if test -n "$inherited_linker_flags"; then
6419 tmp_inherited_linker_flags=`$ECHO "$inherited_linker_flags" | $SED 's/-framework \([^ $]*\)/\1.ltframework/g'`
6420 for tmp_inherited_linker_flag in $tmp_inherited_linker_flags; do
6421 case " $new_inherited_linker_flags " in
6422 *" $tmp_inherited_linker_flag "*) ;;
6423 *) func_append new_inherited_linker_flags " $tmp_inherited_linker_flag";;
6427 dependency_libs=`$ECHO " $dependency_libs" | $SED 's% \([^ $]*\).ltframework% -framework \1%g'`
6428 if test "$linkmode,$pass" = "lib,link" ||
6429 test "$linkmode,$pass" = "prog,scan" ||
6430 { test "$linkmode" != prog && test "$linkmode" != lib; }; then
6431 test -n "$dlopen" && func_append dlfiles " $dlopen"
6432 test -n "$dlpreopen" && func_append dlprefiles " $dlpreopen"
6435 if test "$pass" = conv; then
6436 # Only check for convenience libraries
6437 deplibs="$lib $deplibs"
6438 if test -z "$libdir"; then
6439 if test -z "$old_library"; then
6440 func_fatal_error "cannot find name of link library for \`$lib'"
6442 # It is a libtool convenience library, so add in its objects.
6443 func_append convenience " $ladir/$objdir/$old_library"
6444 func_append old_convenience " $ladir/$objdir/$old_library"
6445 elif test "$linkmode" != prog && test "$linkmode" != lib; then
6446 func_fatal_error "\`$lib' is not a convenience library"
6449 for deplib in $dependency_libs; do
6450 deplibs="$deplib $deplibs"
6451 if $opt_preserve_dup_deps ; then
6452 case "$tmp_libs " in
6453 *" $deplib "*) func_append specialdeplibs " $deplib" ;;
6456 func_append tmp_libs " $deplib"
6462 # Get the name of the library we link against.
6464 if test -n "$old_library" &&
6465 { test "$prefer_static_libs" = yes ||
6466 test "$prefer_static_libs,$installed" = "built,no"; }; then
6467 linklib=$old_library
6469 for l in $old_library $library_names; do
6473 if test -z "$linklib"; then
6474 func_fatal_error "cannot find name of link library for \`$lib'"
6477 # This library was specified with -dlopen.
6478 if test "$pass" = dlopen; then
6479 if test -z "$libdir"; then
6480 func_fatal_error "cannot -dlopen a convenience library: \`$lib'"
6482 if test -z "$dlname" ||
6483 test "$dlopen_support" != yes ||
6484 test "$build_libtool_libs" = no; then
6485 # If there is no dlname, no dlopen support or we're linking
6486 # statically, we need to preload. We also need to preload any
6487 # dependent libraries so libltdl's deplib preloader doesn't
6488 # bomb out in the load deplibs phase.
6489 func_append dlprefiles " $lib $dependency_libs"
6491 func_append newdlfiles " $lib"
6496 # We need an absolute path.
6498 [\\/]* | [A-Za-z]:[\\/]*) abs_ladir="$ladir" ;;
6500 abs_ladir=`cd "$ladir" && pwd`
6501 if test -z "$abs_ladir"; then
6502 func_warning "cannot determine absolute directory name of \`$ladir'"
6503 func_warning "passing it literally to the linker, although it might fail"
6508 func_basename "$lib"
6509 laname="$func_basename_result"
6511 # Find the relevant object directory and library name.
6512 if test "X$installed" = Xyes; then
6513 if test ! -f "$lt_sysroot$libdir/$linklib" && test -f "$abs_ladir/$linklib"; then
6514 func_warning "library \`$lib' was moved."
6519 dir="$lt_sysroot$libdir"
6520 absdir="$lt_sysroot$libdir"
6522 test "X$hardcode_automatic" = Xyes && avoidtemprpath=yes
6524 if test ! -f "$ladir/$objdir/$linklib" && test -f "$abs_ladir/$linklib"; then
6527 # Remove this search path later
6528 func_append notinst_path " $abs_ladir"
6530 dir="$ladir/$objdir"
6531 absdir="$abs_ladir/$objdir"
6532 # Remove this search path later
6533 func_append notinst_path " $abs_ladir"
6535 fi # $installed = yes
6536 func_stripname 'lib' '.la' "$laname"
6537 name=$func_stripname_result
6539 # This library was specified with -dlpreopen.
6540 if test "$pass" = dlpreopen; then
6541 if test -z "$libdir" && test "$linkmode" = prog; then
6542 func_fatal_error "only libraries may -dlpreopen a convenience library: \`$lib'"
6545 # special handling for platforms with PE-DLLs.
6546 *cygwin* | *mingw* | *cegcc* )
6547 # Linker will automatically link against shared library if both
6548 # static and shared are present. Therefore, ensure we extract
6549 # symbols from the import library if a shared library is present
6550 # (otherwise, the dlopen module name will be incorrect). We do
6551 # this by putting the import library name into $newdlprefiles.
6552 # We recover the dlopen module name by 'saving' the la file
6553 # name in a special purpose variable, and (later) extracting the
6554 # dlname from the la file.
6555 if test -n "$dlname"; then
6556 func_tr_sh "$dir/$linklib"
6557 eval "libfile_$func_tr_sh_result=\$abs_ladir/\$laname"
6558 func_append newdlprefiles " $dir/$linklib"
6560 func_append newdlprefiles " $dir/$old_library"
6561 # Keep a list of preopened convenience libraries to check
6562 # that they are being used correctly in the link pass.
6563 test -z "$libdir" && \
6564 func_append dlpreconveniencelibs " $dir/$old_library"
6568 # Prefer using a static library (so that no silly _DYNAMIC symbols
6569 # are required to link).
6570 if test -n "$old_library"; then
6571 func_append newdlprefiles " $dir/$old_library"
6572 # Keep a list of preopened convenience libraries to check
6573 # that they are being used correctly in the link pass.
6574 test -z "$libdir" && \
6575 func_append dlpreconveniencelibs " $dir/$old_library"
6576 # Otherwise, use the dlname, so that lt_dlopen finds it.
6577 elif test -n "$dlname"; then
6578 func_append newdlprefiles " $dir/$dlname"
6580 func_append newdlprefiles " $dir/$linklib"
6584 fi # $pass = dlpreopen
6586 if test -z "$libdir"; then
6587 # Link the convenience library
6588 if test "$linkmode" = lib; then
6589 deplibs="$dir/$old_library $deplibs"
6590 elif test "$linkmode,$pass" = "prog,link"; then
6591 compile_deplibs="$dir/$old_library $compile_deplibs"
6592 finalize_deplibs="$dir/$old_library $finalize_deplibs"
6594 deplibs="$lib $deplibs" # used for prog,scan pass
6600 if test "$linkmode" = prog && test "$pass" != link; then
6601 func_append newlib_search_path " $ladir"
6602 deplibs="$lib $deplibs"
6605 if test "$link_all_deplibs" != no || test -z "$library_names" ||
6606 test "$build_libtool_libs" = no; then
6611 for deplib in $dependency_libs; do
6613 -L*) func_stripname '-L' '' "$deplib"
6614 func_resolve_sysroot "$func_stripname_result"
6615 func_append newlib_search_path " $func_resolve_sysroot_result"
6618 # Need to link against all dependency_libs?
6619 if test "$linkalldeplibs" = yes; then
6620 deplibs="$deplib $deplibs"
6622 # Need to hardcode shared library paths
6623 # or/and link against static libraries
6624 newdependency_libs="$deplib $newdependency_libs"
6626 if $opt_preserve_dup_deps ; then
6627 case "$tmp_libs " in
6628 *" $deplib "*) func_append specialdeplibs " $deplib" ;;
6631 func_append tmp_libs " $deplib"
6634 fi # $linkmode = prog...
6636 if test "$linkmode,$pass" = "prog,link"; then
6637 if test -n "$library_names" &&
6638 { { test "$prefer_static_libs" = no ||
6639 test "$prefer_static_libs,$installed" = "built,yes"; } ||
6640 test -z "$old_library"; }; then
6641 # We need to hardcode the library path
6642 if test -n "$shlibpath_var" && test -z "$avoidtemprpath" ; then
6643 # Make sure the rpath contains only unique directories.
6644 case "$temp_rpath:" in
6646 *) func_append temp_rpath "$absdir:" ;;
6650 # Hardcode the library path.
6651 # Skip directories that are in the system default run-time
6653 case " $sys_lib_dlsearch_path " in
6656 case "$compile_rpath " in
6658 *) func_append compile_rpath " $absdir" ;;
6662 case " $sys_lib_dlsearch_path " in
6665 case "$finalize_rpath " in
6667 *) func_append finalize_rpath " $libdir" ;;
6671 fi # $linkmode,$pass = prog,link...
6673 if test "$alldeplibs" = yes &&
6674 { test "$deplibs_check_method" = pass_all ||
6675 { test "$build_libtool_libs" = yes &&
6676 test -n "$library_names"; }; }; then
6677 # We only need to search for static libraries
6682 link_static=no # Whether the deplib will be linked statically
6683 use_static_libs=$prefer_static_libs
6684 if test "$use_static_libs" = built && test "$installed" = yes; then
6687 if test -n "$library_names" &&
6688 { test "$use_static_libs" = no || test -z "$old_library"; }; then
6690 *cygwin* | *mingw* | *cegcc*)
6691 # No point in relinking DLLs because paths are not encoded
6692 func_append notinst_deplibs " $lib"
6696 if test "$installed" = no; then
6697 func_append notinst_deplibs " $lib"
6702 # This is a shared library
6704 # Warn about portability, can't link against -module's on some
6705 # systems (darwin). Don't bleat about dlopened modules though!
6707 for dlpremoduletest in $dlprefiles; do
6708 if test "X$dlpremoduletest" = "X$lib"; then
6709 dlopenmodule="$dlpremoduletest"
6713 if test -z "$dlopenmodule" && test "$shouldnotlink" = yes && test "$pass" = link; then
6715 if test "$linkmode" = prog; then
6716 $ECHO "*** Warning: Linking the executable $output against the loadable module"
6718 $ECHO "*** Warning: Linking the shared library $output against the loadable module"
6720 $ECHO "*** $linklib is not portable!"
6722 if test "$linkmode" = lib &&
6723 test "$hardcode_into_libs" = yes; then
6724 # Hardcode the library path.
6725 # Skip directories that are in the system default run-time
6727 case " $sys_lib_dlsearch_path " in
6730 case "$compile_rpath " in
6732 *) func_append compile_rpath " $absdir" ;;
6736 case " $sys_lib_dlsearch_path " in
6739 case "$finalize_rpath " in
6741 *) func_append finalize_rpath " $libdir" ;;
6747 if test -n "$old_archive_from_expsyms_cmds"; then
6748 # figure out the soname
6749 set dummy $library_names
6753 libname=`eval "\\$ECHO \"$libname_spec\""`
6754 # use dlname if we got it. it's perfectly good, no?
6755 if test -n "$dlname"; then
6757 elif test -n "$soname_spec"; then
6760 *cygwin* | mingw* | *cegcc*)
6761 func_arith $current - $age
6762 major=$func_arith_result
6766 eval soname=\"$soname_spec\"
6771 # Make a new name for the extract_expsyms_cmds to use
6773 func_basename "$soroot"
6774 soname="$func_basename_result"
6775 func_stripname 'lib' '.dll' "$soname"
6776 newlib=libimp-$func_stripname_result.a
6778 # If the library has no export list, then create one now
6779 if test -f "$output_objdir/$soname-def"; then :
6781 func_verbose "extracting exported symbol list from \`$soname'"
6782 func_execute_cmds "$extract_expsyms_cmds" 'exit $?'
6786 if test -f "$output_objdir/$newlib"; then :; else
6787 func_verbose "generating import library for \`$soname'"
6788 func_execute_cmds "$old_archive_from_expsyms_cmds" 'exit $?'
6790 # make sure the library variables are pointing to the new library
6793 fi # test -n "$old_archive_from_expsyms_cmds"
6795 if test "$linkmode" = prog || test "$opt_mode" != relink; then
6800 case $hardcode_action in
6801 immediate | unsupported)
6802 if test "$hardcode_direct" = no; then
6805 *-*-sco3.2v5.0.[024]*) add_dir="-L$dir" ;;
6806 *-*-sysv4*uw2*) add_dir="-L$dir" ;;
6807 *-*-sysv5OpenUNIX* | *-*-sysv5UnixWare7.[01].[10]* | \
6808 *-*-unixware7*) add_dir="-L$dir" ;;
6810 # if the lib is a (non-dlopened) module then we can not
6811 # link against it, someone is ignoring the earlier warnings
6812 if /usr/bin/file -L $add 2> /dev/null |
6813 $GREP ": [^:]* bundle" >/dev/null ; then
6814 if test "X$dlopenmodule" != "X$lib"; then
6815 $ECHO "*** Warning: lib $linklib is a module, not a shared library"
6816 if test -z "$old_library" ; then
6818 echo "*** And there doesn't seem to be a static archive available"
6819 echo "*** The link will probably fail, sorry"
6821 add="$dir/$old_library"
6823 elif test -n "$old_library"; then
6824 add="$dir/$old_library"
6828 elif test "$hardcode_minus_L" = no; then
6830 *-*-sunos*) add_shlibpath="$dir" ;;
6834 elif test "$hardcode_shlibpath_var" = no; then
6835 add_shlibpath="$dir"
6842 if test "$hardcode_direct" = yes &&
6843 test "$hardcode_direct_absolute" = no; then
6845 elif test "$hardcode_minus_L" = yes; then
6847 # Try looking first in the location we're being installed to.
6848 if test -n "$inst_prefix_dir"; then
6851 func_append add_dir " -L$inst_prefix_dir$libdir"
6856 elif test "$hardcode_shlibpath_var" = yes; then
6857 add_shlibpath="$dir"
6866 if test "$lib_linked" != yes; then
6867 func_fatal_configuration "unsupported hardcode properties"
6870 if test -n "$add_shlibpath"; then
6871 case :$compile_shlibpath: in
6872 *":$add_shlibpath:"*) ;;
6873 *) func_append compile_shlibpath "$add_shlibpath:" ;;
6876 if test "$linkmode" = prog; then
6877 test -n "$add_dir" && compile_deplibs="$add_dir $compile_deplibs"
6878 test -n "$add" && compile_deplibs="$add $compile_deplibs"
6880 test -n "$add_dir" && deplibs="$add_dir $deplibs"
6881 test -n "$add" && deplibs="$add $deplibs"
6882 if test "$hardcode_direct" != yes &&
6883 test "$hardcode_minus_L" != yes &&
6884 test "$hardcode_shlibpath_var" = yes; then
6885 case :$finalize_shlibpath: in
6887 *) func_append finalize_shlibpath "$libdir:" ;;
6893 if test "$linkmode" = prog || test "$opt_mode" = relink; then
6897 # Finalize command for both is simple: just hardcode it.
6898 if test "$hardcode_direct" = yes &&
6899 test "$hardcode_direct_absolute" = no; then
6900 add="$libdir/$linklib"
6901 elif test "$hardcode_minus_L" = yes; then
6904 elif test "$hardcode_shlibpath_var" = yes; then
6905 case :$finalize_shlibpath: in
6907 *) func_append finalize_shlibpath "$libdir:" ;;
6910 elif test "$hardcode_automatic" = yes; then
6911 if test -n "$inst_prefix_dir" &&
6912 test -f "$inst_prefix_dir$libdir/$linklib" ; then
6913 add="$inst_prefix_dir$libdir/$linklib"
6915 add="$libdir/$linklib"
6918 # We cannot seem to hardcode it, guess we'll fake it.
6920 # Try looking first in the location we're being installed to.
6921 if test -n "$inst_prefix_dir"; then
6924 func_append add_dir " -L$inst_prefix_dir$libdir"
6931 if test "$linkmode" = prog; then
6932 test -n "$add_dir" && finalize_deplibs="$add_dir $finalize_deplibs"
6933 test -n "$add" && finalize_deplibs="$add $finalize_deplibs"
6935 test -n "$add_dir" && deplibs="$add_dir $deplibs"
6936 test -n "$add" && deplibs="$add $deplibs"
6939 elif test "$linkmode" = prog; then
6940 # Here we assume that one of hardcode_direct or hardcode_minus_L
6941 # is not unsupported. This is valid on all known static and
6943 if test "$hardcode_direct" != unsupported; then
6944 test -n "$old_library" && linklib="$old_library"
6945 compile_deplibs="$dir/$linklib $compile_deplibs"
6946 finalize_deplibs="$dir/$linklib $finalize_deplibs"
6948 compile_deplibs="-l$name -L$dir $compile_deplibs"
6949 finalize_deplibs="-l$name -L$dir $finalize_deplibs"
6951 elif test "$build_libtool_libs" = yes; then
6952 # Not a shared library
6953 if test "$deplibs_check_method" != pass_all; then
6954 # We're trying link a shared library against a static one
6955 # but the system doesn't support it.
6957 # Just print a warning and add the library to dependency_libs so
6958 # that the program can be linked against the static library.
6960 $ECHO "*** Warning: This system can not link to static lib archive $lib."
6961 echo "*** I have the capability to make that library automatically link in when"
6962 echo "*** you link to this library. But I can only do this if you have a"
6963 echo "*** shared version of the library, which you do not appear to have."
6964 if test "$module" = yes; then
6965 echo "*** But as you try to build a module library, libtool will still create "
6966 echo "*** a static module, that should work as long as the dlopening application"
6967 echo "*** is linked with the -dlopen flag to resolve symbols at runtime."
6968 if test -z "$global_symbol_pipe"; then
6970 echo "*** However, this would only work if libtool was able to extract symbol"
6971 echo "*** lists from a program, using \`nm' or equivalent, but libtool could"
6972 echo "*** not find such a program. So, this module is probably useless."
6973 echo "*** \`nm' from GNU binutils and a full rebuild may help."
6975 if test "$build_old_libs" = no; then
6976 build_libtool_libs=module
6979 build_libtool_libs=no
6983 deplibs="$dir/$old_library $deplibs"
6986 fi # link shared/static library?
6988 if test "$linkmode" = lib; then
6989 if test -n "$dependency_libs" &&
6990 { test "$hardcode_into_libs" != yes ||
6991 test "$build_old_libs" = yes ||
6992 test "$link_static" = yes; }; then
6993 # Extract -R from dependency_libs
6995 for libdir in $dependency_libs; do
6997 -R*) func_stripname '-R' '' "$libdir"
6998 temp_xrpath=$func_stripname_result
7000 *" $temp_xrpath "*) ;;
7001 *) func_append xrpath " $temp_xrpath";;
7003 *) func_append temp_deplibs " $libdir";;
7006 dependency_libs="$temp_deplibs"
7009 func_append newlib_search_path " $absdir"
7010 # Link against this library
7011 test "$link_static" = no && newdependency_libs="$abs_ladir/$laname $newdependency_libs"
7012 # ... and its dependency_libs
7014 for deplib in $dependency_libs; do
7015 newdependency_libs="$deplib $newdependency_libs"
7017 -L*) func_stripname '-L' '' "$deplib"
7018 func_resolve_sysroot "$func_stripname_result";;
7019 *) func_resolve_sysroot "$deplib" ;;
7021 if $opt_preserve_dup_deps ; then
7022 case "$tmp_libs " in
7023 *" $func_resolve_sysroot_result "*)
7024 func_append specialdeplibs " $func_resolve_sysroot_result" ;;
7027 func_append tmp_libs " $func_resolve_sysroot_result"
7030 if test "$link_all_deplibs" != no; then
7031 # Add the search paths of all dependency libraries
7032 for deplib in $dependency_libs; do
7035 -L*) path="$deplib" ;;
7037 func_resolve_sysroot "$deplib"
7038 deplib=$func_resolve_sysroot_result
7039 func_dirname "$deplib" "" "."
7040 dir=$func_dirname_result
7041 # We need an absolute path.
7043 [\\/]* | [A-Za-z]:[\\/]*) absdir="$dir" ;;
7045 absdir=`cd "$dir" && pwd`
7046 if test -z "$absdir"; then
7047 func_warning "cannot determine absolute directory name of \`$dir'"
7052 if $GREP "^installed=no" $deplib > /dev/null; then
7056 eval deplibrary_names=`${SED} -n -e 's/^library_names=\(.*\)$/\1/p' $deplib`
7057 if test -n "$deplibrary_names" ; then
7058 for tmp in $deplibrary_names ; do
7061 if test -f "$absdir/$objdir/$depdepl" ; then
7062 depdepl="$absdir/$objdir/$depdepl"
7063 darwin_install_name=`${OTOOL} -L $depdepl | awk '{if (NR == 2) {print $1;exit}}'`
7064 if test -z "$darwin_install_name"; then
7065 darwin_install_name=`${OTOOL64} -L $depdepl | awk '{if (NR == 2) {print $1;exit}}'`
7067 func_append compiler_flags " ${wl}-dylib_file ${wl}${darwin_install_name}:${depdepl}"
7068 func_append linker_flags " -dylib_file ${darwin_install_name}:${depdepl}"
7074 path="-L$absdir/$objdir"
7078 eval libdir=`${SED} -n -e 's/^libdir=\(.*\)$/\1/p' $deplib`
7079 test -z "$libdir" && \
7080 func_fatal_error "\`$deplib' is not a valid libtool archive"
7081 test "$absdir" != "$libdir" && \
7082 func_warning "\`$deplib' seems to be moved"
7088 case " $deplibs " in
7090 *) deplibs="$path $deplibs" ;;
7093 fi # link_all_deplibs != no
7095 done # for deplib in $libs
7096 if test "$pass" = link; then
7097 if test "$linkmode" = "prog"; then
7098 compile_deplibs="$new_inherited_linker_flags $compile_deplibs"
7099 finalize_deplibs="$new_inherited_linker_flags $finalize_deplibs"
7101 compiler_flags="$compiler_flags "`$ECHO " $new_inherited_linker_flags" | $SED 's% \([^ $]*\).ltframework% -framework \1%g'`
7104 dependency_libs="$newdependency_libs"
7105 if test "$pass" = dlpreopen; then
7106 # Link the dlpreopened libraries before other libraries
7107 for deplib in $save_deplibs; do
7108 deplibs="$deplib $deplibs"
7111 if test "$pass" != dlopen; then
7112 if test "$pass" != conv; then
7113 # Make sure lib_search_path contains only unique directories.
7115 for dir in $newlib_search_path; do
7116 case "$lib_search_path " in
7118 *) func_append lib_search_path " $dir" ;;
7124 if test "$linkmode,$pass" != "prog,link"; then
7127 vars="compile_deplibs finalize_deplibs"
7129 for var in $vars dependency_libs; do
7130 # Add libraries to $var in reverse order
7131 eval tmp_libs=\"\$$var\"
7133 for deplib in $tmp_libs; do
7134 # FIXME: Pedantically, this is the right thing to do, so
7135 # that some nasty dependency loop isn't accidentally
7137 #new_libs="$deplib $new_libs"
7138 # Pragmatically, this seems to cause very few problems in
7141 -L*) new_libs="$deplib $new_libs" ;;
7144 # And here is the reason: when a library appears more
7145 # than once as an explicit dependence of a library, or
7146 # is implicitly linked in more than once by the
7147 # compiler, it is considered special, and multiple
7148 # occurrences thereof are not removed. Compare this
7149 # with having the same library being listed as a
7150 # dependency of multiple other libraries: in this case,
7151 # we know (pedantically, we assume) the library does not
7152 # need to be listed more than once, so we keep only the
7153 # last copy. This is not always right, but it is rare
7154 # enough that we require users that really mean to play
7155 # such unportable linking tricks to link the library
7156 # using -Wl,-lname, so that libtool does not consider it
7157 # for duplicate removal.
7158 case " $specialdeplibs " in
7159 *" $deplib "*) new_libs="$deplib $new_libs" ;;
7161 case " $new_libs " in
7163 *) new_libs="$deplib $new_libs" ;;
7171 for deplib in $new_libs; do
7174 case " $tmp_libs " in
7176 *) func_append tmp_libs " $deplib" ;;
7179 *) func_append tmp_libs " $deplib" ;;
7182 eval $var=\"$tmp_libs\"
7185 # Last step: remove runtime libs from dependency_libs
7186 # (they stay in deplibs)
7188 for i in $dependency_libs ; do
7189 case " $predeps $postdeps $compiler_lib_search_path " in
7194 if test -n "$i" ; then
7195 func_append tmp_libs " $i"
7198 dependency_libs=$tmp_libs
7200 if test "$linkmode" = prog; then
7201 dlfiles="$newdlfiles"
7203 if test "$linkmode" = prog || test "$linkmode" = lib; then
7204 dlprefiles="$newdlprefiles"
7209 if test -n "$dlfiles$dlprefiles" || test "$dlself" != no; then
7210 func_warning "\`-dlopen' is ignored for archives"
7215 func_warning "\`-l' and \`-L' are ignored for archives" ;;
7218 test -n "$rpath" && \
7219 func_warning "\`-rpath' is ignored for archives"
7221 test -n "$xrpath" && \
7222 func_warning "\`-R' is ignored for archives"
7224 test -n "$vinfo" && \
7225 func_warning "\`-version-info/-version-number' is ignored for archives"
7227 test -n "$release" && \
7228 func_warning "\`-release' is ignored for archives"
7230 test -n "$export_symbols$export_symbols_regex" && \
7231 func_warning "\`-export-symbols' is ignored for archives"
7233 # Now set the variables for building old libraries.
7234 build_libtool_libs=no
7236 func_append objs "$old_deplibs"
7240 # Make sure we only generate libraries of the form `libNAME.la'.
7243 func_stripname 'lib' '.la' "$outputname"
7244 name=$func_stripname_result
7245 eval shared_ext=\"$shrext_cmds\"
7246 eval libname=\"$libname_spec\"
7249 test "$module" = no && \
7250 func_fatal_help "libtool library \`$output' must begin with \`lib'"
7252 if test "$need_lib_prefix" != no; then
7253 # Add the "lib" prefix for modules if required
7254 func_stripname '' '.la' "$outputname"
7255 name=$func_stripname_result
7256 eval shared_ext=\"$shrext_cmds\"
7257 eval libname=\"$libname_spec\"
7259 func_stripname '' '.la' "$outputname"
7260 libname=$func_stripname_result
7265 if test -n "$objs"; then
7266 if test "$deplibs_check_method" != pass_all; then
7267 func_fatal_error "cannot build libtool library \`$output' from non-libtool objects on this host:$objs"
7270 $ECHO "*** Warning: Linking the shared library $output against the non-libtool"
7271 $ECHO "*** objects $objs is not portable!"
7272 func_append libobjs " $objs"
7276 test "$dlself" != no && \
7277 func_warning "\`-dlopen self' is ignored for libtool libraries"
7281 test "$#" -gt 1 && \
7282 func_warning "ignoring multiple \`-rpath's for a libtool library"
7287 if test -z "$rpath"; then
7288 if test "$build_libtool_libs" = yes; then
7289 # Building a libtool convenience library.
7290 # Some compilers have problems with a `.al' extension so
7291 # convenience libraries should have the same extension an
7292 # archive normally would.
7293 oldlibs="$output_objdir/$libname.$libext $oldlibs"
7294 build_libtool_libs=convenience
7298 test -n "$vinfo" && \
7299 func_warning "\`-version-info/-version-number' is ignored for convenience libraries"
7301 test -n "$release" && \
7302 func_warning "\`-release' is ignored for convenience libraries"
7305 # Parse the version information argument.
7306 save_ifs="$IFS"; IFS=':'
7307 set dummy $vinfo 0 0 0
7312 func_fatal_help "too many parameters to \`-version-info'"
7314 # convert absolute version numbers to libtool ages
7315 # this retains compatibility with .la files and attempts
7316 # to make the code below a bit more comprehensible
7318 case $vinfo_number in
7322 number_revision="$3"
7324 # There are really only two kinds -- those that
7325 # use the current revision as the major version
7326 # and those that subtract age and use age as
7327 # a minor version. But, then there is irix
7328 # which has an extra 1 added just for fun
7330 case $version_type in
7331 darwin|linux|osf|windows|none)
7332 func_arith $number_major + $number_minor
7333 current=$func_arith_result
7335 revision="$number_revision"
7337 freebsd-aout|freebsd-elf|qnx|sunos)
7338 current="$number_major"
7339 revision="$number_minor"
7343 func_arith $number_major + $number_minor
7344 current=$func_arith_result
7346 revision="$number_minor"
7347 lt_irix_increment=no
7358 # Check that each of the things are valid numbers.
7360 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]) ;;
7362 func_error "CURRENT \`$current' must be a nonnegative integer"
7363 func_fatal_error "\`$vinfo' is not valid version information"
7368 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]) ;;
7370 func_error "REVISION \`$revision' must be a nonnegative integer"
7371 func_fatal_error "\`$vinfo' is not valid version information"
7376 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]) ;;
7378 func_error "AGE \`$age' must be a nonnegative integer"
7379 func_fatal_error "\`$vinfo' is not valid version information"
7383 if test "$age" -gt "$current"; then
7384 func_error "AGE \`$age' is greater than the current interface number \`$current'"
7385 func_fatal_error "\`$vinfo' is not valid version information"
7388 # Calculate the version variables.
7392 case $version_type in
7396 # Like Linux, but with the current version available in
7397 # verstring for coding it into the library header
7398 func_arith $current - $age
7399 major=.$func_arith_result
7400 versuffix="$major.$age.$revision"
7401 # Darwin ld doesn't like 0 for these options...
7402 func_arith $current + 1
7403 minor_current=$func_arith_result
7404 xlcverstring="${wl}-compatibility_version ${wl}$minor_current ${wl}-current_version ${wl}$minor_current.$revision"
7405 verstring="-compatibility_version $minor_current -current_version $minor_current.$revision"
7410 versuffix=".$current.$revision";
7415 versuffix=".$current"
7419 if test "X$lt_irix_increment" = "Xno"; then
7420 func_arith $current - $age
7422 func_arith $current - $age + 1
7424 major=$func_arith_result
7426 case $version_type in
7427 nonstopux) verstring_prefix=nonstopux ;;
7428 *) verstring_prefix=sgi ;;
7430 verstring="$verstring_prefix$major.$revision"
7432 # Add in all the interfaces that we are compatible with.
7434 while test "$loop" -ne 0; do
7435 func_arith $revision - $loop
7436 iface=$func_arith_result
7437 func_arith $loop - 1
7438 loop=$func_arith_result
7439 verstring="$verstring_prefix$major.$iface:$verstring"
7442 # Before this point, $major must not contain `.'.
7444 versuffix="$major.$revision"
7448 func_arith $current - $age
7449 major=.$func_arith_result
7450 versuffix="$major.$age.$revision"
7454 func_arith $current - $age
7455 major=.$func_arith_result
7456 versuffix=".$current.$age.$revision"
7457 verstring="$current.$age.$revision"
7459 # Add in all the interfaces that we are compatible with.
7461 while test "$loop" -ne 0; do
7462 func_arith $current - $loop
7463 iface=$func_arith_result
7464 func_arith $loop - 1
7465 loop=$func_arith_result
7466 verstring="$verstring:${iface}.0"
7469 # Make executables depend on our current version.
7470 func_append verstring ":${current}.0"
7475 versuffix=".$current"
7480 versuffix=".$current.$revision"
7484 # Use '-' rather than '.', since we only want one
7485 # extension on DOS 8.3 filesystems.
7486 func_arith $current - $age
7487 major=$func_arith_result
7492 func_fatal_configuration "unknown library version type \`$version_type'"
7496 # Clear the version info if we defaulted, and they specified a release.
7497 if test -z "$vinfo" && test -n "$release"; then
7499 case $version_type in
7501 # we can't check for "0.0" in archive_cmds due to quoting
7502 # problems, so we reset it completely
7509 if test "$need_version" = no; then
7516 # Remove version info from name if versioning should be avoided
7517 if test "$avoid_version" = yes && test "$need_version" = no; then
7523 # Check to see if the archive will have undefined symbols.
7524 if test "$allow_undefined" = yes; then
7525 if test "$allow_undefined_flag" = unsupported; then
7526 func_warning "undefined symbols not allowed in $host shared libraries"
7527 build_libtool_libs=no
7531 # Don't allow undefined symbols.
7532 allow_undefined_flag="$no_undefined_flag"
7537 func_generate_dlsyms "$libname" "$libname" "yes"
7538 func_append libobjs " $symfileobj"
7539 test "X$libobjs" = "X " && libobjs=
7541 if test "$opt_mode" != relink; then
7542 # Remove our outputs, but don't remove object files since they
7543 # may have been created when compiling PIC objects.
7545 tempremovelist=`$ECHO "$output_objdir/*"`
7546 for p in $tempremovelist; do
7550 $output_objdir/$outputname | $output_objdir/$libname.* | $output_objdir/${libname}${release}.*)
7551 if test "X$precious_files_regex" != "X"; then
7552 if $ECHO "$p" | $EGREP -e "$precious_files_regex" >/dev/null 2>&1
7557 func_append removelist " $p"
7562 test -n "$removelist" && \
7563 func_show_eval "${RM}r \$removelist"
7566 # Now set the variables for building old libraries.
7567 if test "$build_old_libs" = yes && test "$build_libtool_libs" != convenience ; then
7568 func_append oldlibs " $output_objdir/$libname.$libext"
7570 # Transform .lo files to .o files.
7571 oldobjs="$objs "`$ECHO "$libobjs" | $SP2NL | $SED "/\.${libext}$/d; $lo2o" | $NL2SP`
7574 # Eliminate all temporary directories.
7575 #for path in $notinst_path; do
7576 # lib_search_path=`$ECHO "$lib_search_path " | $SED "s% $path % %g"`
7577 # deplibs=`$ECHO "$deplibs " | $SED "s% -L$path % %g"`
7578 # dependency_libs=`$ECHO "$dependency_libs " | $SED "s% -L$path % %g"`
7581 if test -n "$xrpath"; then
7582 # If the user specified any rpath flags, then add them.
7584 for libdir in $xrpath; do
7585 func_replace_sysroot "$libdir"
7586 func_append temp_xrpath " -R$func_replace_sysroot_result"
7587 case "$finalize_rpath " in
7589 *) func_append finalize_rpath " $libdir" ;;
7592 if test "$hardcode_into_libs" != yes || test "$build_old_libs" = yes; then
7593 dependency_libs="$temp_xrpath $dependency_libs"
7597 # Make sure dlfiles contains only unique files that won't be dlpreopened
7598 old_dlfiles="$dlfiles"
7600 for lib in $old_dlfiles; do
7601 case " $dlprefiles $dlfiles " in
7603 *) func_append dlfiles " $lib" ;;
7607 # Make sure dlprefiles contains only unique files
7608 old_dlprefiles="$dlprefiles"
7610 for lib in $old_dlprefiles; do
7611 case "$dlprefiles " in
7613 *) func_append dlprefiles " $lib" ;;
7617 if test "$build_libtool_libs" = yes; then
7618 if test -n "$rpath"; then
7620 *-*-cygwin* | *-*-mingw* | *-*-pw32* | *-*-os2* | *-*-beos* | *-cegcc* | *-*-haiku*)
7621 # these systems don't actually have a c library (as such)!
7623 *-*-rhapsody* | *-*-darwin1.[012])
7624 # Rhapsody C library is in the System framework
7625 func_append deplibs " System.ltframework"
7628 # Don't link with libc until the a.out ld.so is fixed.
7630 *-*-openbsd* | *-*-freebsd* | *-*-dragonfly*)
7631 # Do not include libc due to us having libc/libc_r.
7633 *-*-sco3.2v5* | *-*-sco5v6*)
7634 # Causes problems with __ctype
7636 *-*-sysv4.2uw2* | *-*-sysv5* | *-*-unixware* | *-*-OpenUNIX*)
7637 # Compiler inserts libc in the correct place for threads to work
7640 # Add libc to deplibs on all other systems if necessary.
7641 if test "$build_libtool_need_lc" = "yes"; then
7642 func_append deplibs " -lc"
7648 # Transform deplibs into only deplibs that can be linked in shared.
7650 libname_save=$libname
7651 release_save=$release
7652 versuffix_save=$versuffix
7654 # I'm not sure if I'm treating the release correctly. I think
7655 # release should show up in the -l (ie -lgmp5) so we don't want to
7656 # add it in twice. Is that correct?
7662 case $deplibs_check_method in
7664 # Don't check for shared/static. Everything works.
7665 # This might be a little naive. We might want to check
7666 # whether the library exists or not. But this is on
7667 # osf3 & osf4 and I'm not really sure... Just
7668 # implementing what was already the behavior.
7672 # This code stresses the "libraries are programs" paradigm to its
7673 # limits. Maybe even breaks it. We compile a program, linking it
7674 # against the deplibs as a proxy for the library. Then we can check
7675 # whether they linked in statically or dynamically with ldd.
7676 $opt_dry_run || $RM conftest.c
7677 cat > conftest.c <<EOF
7678 int main() { return 0; }
7680 $opt_dry_run || $RM conftest
7681 if $LTCC $LTCFLAGS -o conftest conftest.c $deplibs; then
7682 ldd_output=`ldd conftest`
7683 for i in $deplibs; do
7686 func_stripname -l '' "$i"
7687 name=$func_stripname_result
7688 if test "X$allow_libtool_libs_with_static_runtimes" = "Xyes" ; then
7689 case " $predeps $postdeps " in
7691 func_append newdeplibs " $i"
7696 if test -n "$i" ; then
7697 libname=`eval "\\$ECHO \"$libname_spec\""`
7698 deplib_matches=`eval "\\$ECHO \"$library_names_spec\""`
7699 set dummy $deplib_matches; shift
7701 if test `expr "$ldd_output" : ".*$deplib_match"` -ne 0 ; then
7702 func_append newdeplibs " $i"
7706 $ECHO "*** Warning: dynamic linker does not accept needed library $i."
7707 echo "*** I have the capability to make that library automatically link in when"
7708 echo "*** you link to this library. But I can only do this if you have a"
7709 echo "*** shared version of the library, which I believe you do not have"
7710 echo "*** because a test_compile did reveal that the linker did not use it for"
7711 echo "*** its dynamic dependency list that programs get resolved with at runtime."
7716 func_append newdeplibs " $i"
7721 # Error occurred in the first compile. Let's try to salvage
7722 # the situation: Compile a separate program for each library.
7723 for i in $deplibs; do
7726 func_stripname -l '' "$i"
7727 name=$func_stripname_result
7728 $opt_dry_run || $RM conftest
7729 if $LTCC $LTCFLAGS -o conftest conftest.c $i; then
7730 ldd_output=`ldd conftest`
7731 if test "X$allow_libtool_libs_with_static_runtimes" = "Xyes" ; then
7732 case " $predeps $postdeps " in
7734 func_append newdeplibs " $i"
7739 if test -n "$i" ; then
7740 libname=`eval "\\$ECHO \"$libname_spec\""`
7741 deplib_matches=`eval "\\$ECHO \"$library_names_spec\""`
7742 set dummy $deplib_matches; shift
7744 if test `expr "$ldd_output" : ".*$deplib_match"` -ne 0 ; then
7745 func_append newdeplibs " $i"
7749 $ECHO "*** Warning: dynamic linker does not accept needed library $i."
7750 echo "*** I have the capability to make that library automatically link in when"
7751 echo "*** you link to this library. But I can only do this if you have a"
7752 echo "*** shared version of the library, which you do not appear to have"
7753 echo "*** because a test_compile did reveal that the linker did not use this one"
7754 echo "*** as a dynamic dependency that programs can get resolved with at runtime."
7760 $ECHO "*** Warning! Library $i is needed by this library but I was not able to"
7761 echo "*** make it link in! You will probably need to install it or some"
7762 echo "*** library that it depends on before this library will be fully"
7763 echo "*** functional. Installing it before continuing would be even better."
7767 func_append newdeplibs " $i"
7774 set dummy $deplibs_check_method; shift
7775 file_magic_regex=`expr "$deplibs_check_method" : "$1 \(.*\)"`
7776 for a_deplib in $deplibs; do
7779 func_stripname -l '' "$a_deplib"
7780 name=$func_stripname_result
7781 if test "X$allow_libtool_libs_with_static_runtimes" = "Xyes" ; then
7782 case " $predeps $postdeps " in
7784 func_append newdeplibs " $a_deplib"
7789 if test -n "$a_deplib" ; then
7790 libname=`eval "\\$ECHO \"$libname_spec\""`
7791 if test -n "$file_magic_glob"; then
7792 libnameglob=`func_echo_all "$libname" | $SED -e $file_magic_glob`
7794 libnameglob=$libname
7796 test "$want_nocaseglob" = yes && nocaseglob=`shopt -p nocaseglob`
7797 for i in $lib_search_path $sys_lib_search_path $shlib_search_path; do
7798 if test "$want_nocaseglob" = yes; then
7800 potential_libs=`ls $i/$libnameglob[.-]* 2>/dev/null`
7803 potential_libs=`ls $i/$libnameglob[.-]* 2>/dev/null`
7805 for potent_lib in $potential_libs; do
7806 # Follow soft links.
7807 if ls -lLd "$potent_lib" 2>/dev/null |
7808 $GREP " -> " >/dev/null; then
7811 # The statement above tries to avoid entering an
7812 # endless loop below, in case of cyclic links.
7813 # We might still enter an endless loop, since a link
7814 # loop can be closed while we follow links,
7816 potlib="$potent_lib"
7817 while test -h "$potlib" 2>/dev/null; do
7818 potliblink=`ls -ld $potlib | ${SED} 's/.* -> //'`
7820 [\\/]* | [A-Za-z]:[\\/]*) potlib="$potliblink";;
7821 *) potlib=`$ECHO "$potlib" | $SED 's,[^/]*$,,'`"$potliblink";;
7824 if eval $file_magic_cmd \"\$potlib\" 2>/dev/null |
7826 $EGREP "$file_magic_regex" > /dev/null; then
7827 func_append newdeplibs " $a_deplib"
7834 if test -n "$a_deplib" ; then
7837 $ECHO "*** Warning: linker path does not have real file for library $a_deplib."
7838 echo "*** I have the capability to make that library automatically link in when"
7839 echo "*** you link to this library. But I can only do this if you have a"
7840 echo "*** shared version of the library, which you do not appear to have"
7841 echo "*** because I did check the linker path looking for a file starting"
7842 if test -z "$potlib" ; then
7843 $ECHO "*** with $libname but no candidates were found. (...for file magic test)"
7845 $ECHO "*** with $libname and none of the candidates passed a file format test"
7846 $ECHO "*** using a file magic. Last file checked: $potlib"
7851 # Add a -L argument.
7852 func_append newdeplibs " $a_deplib"
7855 done # Gone through all deplibs.
7858 set dummy $deplibs_check_method; shift
7859 match_pattern_regex=`expr "$deplibs_check_method" : "$1 \(.*\)"`
7860 for a_deplib in $deplibs; do
7863 func_stripname -l '' "$a_deplib"
7864 name=$func_stripname_result
7865 if test "X$allow_libtool_libs_with_static_runtimes" = "Xyes" ; then
7866 case " $predeps $postdeps " in
7868 func_append newdeplibs " $a_deplib"
7873 if test -n "$a_deplib" ; then
7874 libname=`eval "\\$ECHO \"$libname_spec\""`
7875 for i in $lib_search_path $sys_lib_search_path $shlib_search_path; do
7876 potential_libs=`ls $i/$libname[.-]* 2>/dev/null`
7877 for potent_lib in $potential_libs; do
7878 potlib="$potent_lib" # see symlink-check above in file_magic test
7879 if eval "\$ECHO \"$potent_lib\"" 2>/dev/null | $SED 10q | \
7880 $EGREP "$match_pattern_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 regex pattern test)"
7899 $ECHO "*** with $libname and none of the candidates passed a file format test"
7900 $ECHO "*** using a regex pattern. Last file checked: $potlib"
7905 # Add a -L argument.
7906 func_append newdeplibs " $a_deplib"
7909 done # Gone through all deplibs.
7913 tmp_deplibs=`$ECHO " $deplibs" | $SED 's/ -lc$//; s/ -[LR][^ ]*//g'`
7914 if test "X$allow_libtool_libs_with_static_runtimes" = "Xyes" ; then
7915 for i in $predeps $postdeps ; do
7916 # can't use Xsed below, because $i might contain '/'
7917 tmp_deplibs=`$ECHO " $tmp_deplibs" | $SED "s,$i,,"`
7920 case $tmp_deplibs in
7923 if test "X$deplibs_check_method" = "Xnone"; then
7924 echo "*** Warning: inter-library dependencies are not supported in this platform."
7926 echo "*** Warning: inter-library dependencies are not known to be supported."
7928 echo "*** All declared inter-library dependencies are being dropped."
7934 versuffix=$versuffix_save
7936 release=$release_save
7937 libname=$libname_save
7941 *-*-rhapsody* | *-*-darwin1.[012])
7942 # On Rhapsody replace the C library with the System framework
7943 newdeplibs=`$ECHO " $newdeplibs" | $SED 's/ -lc / System.ltframework /'`
7947 if test "$droppeddeps" = yes; then
7948 if test "$module" = yes; then
7950 echo "*** Warning: libtool could not satisfy all declared inter-library"
7951 $ECHO "*** dependencies of module $libname. Therefore, libtool will create"
7952 echo "*** a static module, that should work as long as the dlopening"
7953 echo "*** application is linked with the -dlopen flag."
7954 if test -z "$global_symbol_pipe"; then
7956 echo "*** However, this would only work if libtool was able to extract symbol"
7957 echo "*** lists from a program, using \`nm' or equivalent, but libtool could"
7958 echo "*** not find such a program. So, this module is probably useless."
7959 echo "*** \`nm' from GNU binutils and a full rebuild may help."
7961 if test "$build_old_libs" = no; then
7962 oldlibs="$output_objdir/$libname.$libext"
7963 build_libtool_libs=module
7966 build_libtool_libs=no
7969 echo "*** The inter-library dependencies that have been dropped here will be"
7970 echo "*** automatically added whenever a program is linked with this library"
7971 echo "*** or is declared to -dlopen it."
7973 if test "$allow_undefined" = no; then
7975 echo "*** Since this library must not contain undefined symbols,"
7976 echo "*** because either the platform does not support them or"
7977 echo "*** it was explicitly requested with -no-undefined,"
7978 echo "*** libtool will only create a static version of it."
7979 if test "$build_old_libs" = no; then
7980 oldlibs="$output_objdir/$libname.$libext"
7981 build_libtool_libs=module
7984 build_libtool_libs=no
7989 # Done checking deplibs!
7992 # Time to change all our "foo.ltframework" stuff back to "-framework foo"
7995 newdeplibs=`$ECHO " $newdeplibs" | $SED 's% \([^ $]*\).ltframework% -framework \1%g'`
7996 new_inherited_linker_flags=`$ECHO " $new_inherited_linker_flags" | $SED 's% \([^ $]*\).ltframework% -framework \1%g'`
7997 deplibs=`$ECHO " $deplibs" | $SED 's% \([^ $]*\).ltframework% -framework \1%g'`
8001 # move library search paths that coincide with paths to not yet
8002 # installed libraries to the beginning of the library search list
8004 for path in $notinst_path; do
8005 case " $new_libs " in
8006 *" -L$path/$objdir "*) ;;
8008 case " $deplibs " in
8009 *" -L$path/$objdir "*)
8010 func_append new_libs " -L$path/$objdir" ;;
8015 for deplib in $deplibs; do
8018 case " $new_libs " in
8020 *) func_append new_libs " $deplib" ;;
8023 *) func_append new_libs " $deplib" ;;
8028 # All the library-specific variables (install_libdir is set above).
8033 # Test again, we may have decided not to build it any more
8034 if test "$build_libtool_libs" = yes; then
8035 if test "$hardcode_into_libs" = yes; then
8036 # Hardcode the library paths
8039 rpath="$finalize_rpath"
8040 test "$opt_mode" != relink && rpath="$compile_rpath$rpath"
8041 for libdir in $rpath; do
8042 if test -n "$hardcode_libdir_flag_spec"; then
8043 if test -n "$hardcode_libdir_separator"; then
8044 func_replace_sysroot "$libdir"
8045 libdir=$func_replace_sysroot_result
8046 if test -z "$hardcode_libdirs"; then
8047 hardcode_libdirs="$libdir"
8049 # Just accumulate the unique libdirs.
8050 case $hardcode_libdir_separator$hardcode_libdirs$hardcode_libdir_separator in
8051 *"$hardcode_libdir_separator$libdir$hardcode_libdir_separator"*)
8054 func_append hardcode_libdirs "$hardcode_libdir_separator$libdir"
8059 eval flag=\"$hardcode_libdir_flag_spec\"
8060 func_append dep_rpath " $flag"
8062 elif test -n "$runpath_var"; then
8063 case "$perm_rpath " in
8065 *) func_apped perm_rpath " $libdir" ;;
8069 # Substitute the hardcoded libdirs into the rpath.
8070 if test -n "$hardcode_libdir_separator" &&
8071 test -n "$hardcode_libdirs"; then
8072 libdir="$hardcode_libdirs"
8073 if test -n "$hardcode_libdir_flag_spec_ld"; then
8074 eval dep_rpath=\"$hardcode_libdir_flag_spec_ld\"
8076 eval dep_rpath=\"$hardcode_libdir_flag_spec\"
8079 if test -n "$runpath_var" && test -n "$perm_rpath"; then
8080 # We should set the runpath_var.
8082 for dir in $perm_rpath; do
8083 func_append rpath "$dir:"
8085 eval "$runpath_var='$rpath\$$runpath_var'; export $runpath_var"
8087 test -n "$dep_rpath" && deplibs="$dep_rpath $deplibs"
8090 shlibpath="$finalize_shlibpath"
8091 test "$opt_mode" != relink && shlibpath="$compile_shlibpath$shlibpath"
8092 if test -n "$shlibpath"; then
8093 eval "$shlibpath_var='$shlibpath\$$shlibpath_var'; export $shlibpath_var"
8096 # Get the real and link names of the library.
8097 eval shared_ext=\"$shrext_cmds\"
8098 eval library_names=\"$library_names_spec\"
8099 set dummy $library_names
8104 if test -n "$soname_spec"; then
8105 eval soname=\"$soname_spec\"
8109 if test -z "$dlname"; then
8113 lib="$output_objdir/$realname"
8117 func_append linknames " $link"
8120 # Use standard objects if they are pic
8121 test -z "$pic_flag" && libobjs=`$ECHO "$libobjs" | $SP2NL | $SED "$lo2o" | $NL2SP`
8122 test "X$libobjs" = "X " && libobjs=
8125 if test -n "$export_symbols" && test -n "$include_expsyms"; then
8126 $opt_dry_run || cp "$export_symbols" "$output_objdir/$libname.uexp"
8127 export_symbols="$output_objdir/$libname.uexp"
8128 func_append delfiles " $export_symbols"
8131 orig_export_symbols=
8133 cygwin* | mingw* | cegcc*)
8134 if test -n "$export_symbols" && test -z "$export_symbols_regex"; then
8135 # exporting using user supplied symfile
8136 if test "x`$SED 1q $export_symbols`" != xEXPORTS; then
8137 # and it's NOT already a .def file. Must figure out
8138 # which of the given symbols are data symbols and tag
8139 # them as such. So, trigger use of export_symbols_cmds.
8140 # export_symbols gets reassigned inside the "prepare
8141 # the list of exported symbols" if statement, so the
8142 # include_expsyms logic still works.
8143 orig_export_symbols="$export_symbols"
8145 always_export_symbols=yes
8151 # Prepare the list of exported symbols
8152 if test -z "$export_symbols"; then
8153 if test "$always_export_symbols" = yes || test -n "$export_symbols_regex"; then
8154 func_verbose "generating symbol list for \`$libname.la'"
8155 export_symbols="$output_objdir/$libname.exp"
8156 $opt_dry_run || $RM $export_symbols
8157 cmds=$export_symbols_cmds
8158 save_ifs="$IFS"; IFS='~'
8159 for cmd1 in $cmds; do
8161 # Take the normal branch if the nm_file_list_spec branch
8162 # doesn't work or if tool conversion is not needed.
8163 case $nm_file_list_spec~$to_tool_file_cmd in
8164 *~func_convert_file_noop | *~func_convert_file_msys_to_w32 | ~*)
8165 try_normal_branch=yes
8168 len=$func_len_result
8171 try_normal_branch=no
8174 if test "$try_normal_branch" = yes \
8175 && { test "$len" -lt "$max_cmd_len" \
8176 || test "$max_cmd_len" -le -1; }
8178 func_show_eval "$cmd" 'exit $?'
8179 skipped_export=false
8180 elif test -n "$nm_file_list_spec"; then
8181 func_basename "$output"
8182 output_la=$func_basename_result
8183 save_libobjs=$libobjs
8185 output=${output_objdir}/${output_la}.nm
8186 func_to_tool_file "$output"
8187 libobjs=$nm_file_list_spec$func_to_tool_file_result
8188 func_append delfiles " $output"
8189 func_verbose "creating $NM input file list: $output"
8190 for obj in $save_libobjs; do
8191 func_to_tool_file "$obj"
8192 $ECHO "$func_to_tool_file_result"
8195 func_show_eval "$cmd" 'exit $?'
8197 libobjs=$save_libobjs
8198 skipped_export=false
8200 # The command line is too long to execute in one step.
8201 func_verbose "using reloadable object file for export list..."
8203 # Break out early, otherwise skipped_export may be
8204 # set to false by a later but shorter cmd.
8209 if test -n "$export_symbols_regex" && test "X$skipped_export" != "X:"; then
8210 func_show_eval '$EGREP -e "$export_symbols_regex" "$export_symbols" > "${export_symbols}T"'
8211 func_show_eval '$MV "${export_symbols}T" "$export_symbols"'
8216 if test -n "$export_symbols" && test -n "$include_expsyms"; then
8217 tmp_export_symbols="$export_symbols"
8218 test -n "$orig_export_symbols" && tmp_export_symbols="$orig_export_symbols"
8219 $opt_dry_run || eval '$ECHO "$include_expsyms" | $SP2NL >> "$tmp_export_symbols"'
8222 if test "X$skipped_export" != "X:" && test -n "$orig_export_symbols"; then
8223 # The given exports_symbols file has to be filtered, so filter it.
8224 func_verbose "filter symbol list for \`$libname.la' to tag DATA exports"
8225 # FIXME: $output_objdir/$libname.filter potentially contains lots of
8226 # 's' commands which not all seds can handle. GNU sed should be fine
8227 # though. Also, the filter scales superlinearly with the number of
8228 # global variables. join(1) would be nice here, but unfortunately
8229 # isn't a blessed tool.
8230 $opt_dry_run || $SED -e '/[ ,]DATA/!d;s,\(.*\)\([ \,].*\),s|^\1$|\1\2|,' < $export_symbols > $output_objdir/$libname.filter
8231 func_append delfiles " $export_symbols $output_objdir/$libname.filter"
8232 export_symbols=$output_objdir/$libname.def
8233 $opt_dry_run || $SED -f $output_objdir/$libname.filter < $orig_export_symbols > $export_symbols
8238 for test_deplib in $deplibs; do
8239 case " $convenience " in
8240 *" $test_deplib "*) ;;
8242 if test -n "$inst_prefix_dir" && test "$inst_prefix_dir" != "/" && (echo "$test_deplib" | grep -- "$inst_prefix_dir" >/dev/null); then
8243 func_append inst_prefix_arg " $test_deplib"
8245 func_append tmp_deplibs " $test_deplib"
8250 deplibs="$tmp_deplibs"
8251 if test -n "$inst_prefix_arg"; then
8252 deplibs="$inst_prefix_arg $deplibs"
8255 if test -n "$convenience"; then
8256 if test -n "$whole_archive_flag_spec" &&
8257 test "$compiler_needs_object" = yes &&
8258 test -z "$libobjs"; then
8259 # extract the archives, so we have objects to list.
8260 # TODO: could optimize this to just extract one archive.
8261 whole_archive_flag_spec=
8263 if test -n "$whole_archive_flag_spec"; then
8264 save_libobjs=$libobjs
8265 eval libobjs=\"\$libobjs $whole_archive_flag_spec\"
8266 test "X$libobjs" = "X " && libobjs=
8268 gentop="$output_objdir/${outputname}x"
8269 func_append generated " $gentop"
8271 func_extract_archives $gentop $convenience
8272 func_append libobjs " $func_extract_archives_result"
8273 test "X$libobjs" = "X " && libobjs=
8277 if test "$thread_safe" = yes && test -n "$thread_safe_flag_spec"; then
8278 eval flag=\"$thread_safe_flag_spec\"
8279 func_append linker_flags " $flag"
8282 # Make a backup of the uninstalled library when relinking
8283 if test "$opt_mode" = relink; then
8284 $opt_dry_run || eval '(cd $output_objdir && $RM ${realname}U && $MV $realname ${realname}U)' || exit $?
8287 # Do each of the archive commands.
8288 if test "$module" = yes && test -n "$module_cmds" ; then
8289 if test -n "$export_symbols" && test -n "$module_expsym_cmds"; then
8290 eval test_cmds=\"$module_expsym_cmds\"
8291 cmds=$module_expsym_cmds
8293 eval test_cmds=\"$module_cmds\"
8297 if test -n "$export_symbols" && test -n "$archive_expsym_cmds"; then
8298 eval test_cmds=\"$archive_expsym_cmds\"
8299 cmds=$archive_expsym_cmds
8301 eval test_cmds=\"$archive_cmds\"
8306 if test "X$skipped_export" != "X:" &&
8307 func_len " $test_cmds" &&
8308 len=$func_len_result &&
8309 test "$len" -lt "$max_cmd_len" || test "$max_cmd_len" -le -1; then
8312 # The command line is too long to link in one step, link piecewise
8313 # or, if using GNU ld and skipped_export is not :, use a linker
8316 # Save the value of $output and $libobjs because we want to
8317 # use them later. If we have whole_archive_flag_spec, we
8318 # want to use save_libobjs as it was before
8319 # whole_archive_flag_spec was expanded, because we can't
8320 # assume the linker understands whole_archive_flag_spec.
8321 # This may have to be revisited, in case too many
8322 # convenience libraries get linked in and end up exceeding
8324 if test -z "$convenience" || test -z "$whole_archive_flag_spec"; then
8325 save_libobjs=$libobjs
8328 func_basename "$output"
8329 output_la=$func_basename_result
8331 # Clear the reloadable object creation command queue and
8332 # initialize k to one.
8339 if test -n "$save_libobjs" && test "X$skipped_export" != "X:" && test "$with_gnu_ld" = yes; then
8340 output=${output_objdir}/${output_la}.lnkscript
8341 func_verbose "creating GNU ld script: $output"
8342 echo 'INPUT (' > $output
8343 for obj in $save_libobjs
8345 func_to_tool_file "$obj"
8346 $ECHO "$func_to_tool_file_result" >> $output
8349 func_append delfiles " $output"
8350 func_to_tool_file "$output"
8351 output=$func_to_tool_file_result
8352 elif test -n "$save_libobjs" && test "X$skipped_export" != "X:" && test "X$file_list_spec" != X; then
8353 output=${output_objdir}/${output_la}.lnk
8354 func_verbose "creating linker input file list: $output"
8359 if test "$compiler_needs_object" = yes; then
8365 func_to_tool_file "$obj"
8366 $ECHO "$func_to_tool_file_result" >> $output
8368 func_append delfiles " $output"
8369 func_to_tool_file "$output"
8370 output=$firstobj\"$file_list_spec$func_to_tool_file_result\"
8372 if test -n "$save_libobjs"; then
8373 func_verbose "creating reloadable object files..."
8374 output=$output_objdir/$output_la-${k}.$objext
8375 eval test_cmds=\"$reload_cmds\"
8376 func_len " $test_cmds"
8377 len0=$func_len_result
8380 # Loop over the list of objects to be linked.
8381 for obj in $save_libobjs
8384 func_arith $len + $func_len_result
8385 len=$func_arith_result
8386 if test "X$objlist" = X ||
8387 test "$len" -lt "$max_cmd_len"; then
8388 func_append objlist " $obj"
8390 # The command $test_cmds is almost too long, add a
8391 # command to the queue.
8392 if test "$k" -eq 1 ; then
8393 # The first file doesn't have a previous command to add.
8394 reload_objs=$objlist
8395 eval concat_cmds=\"$reload_cmds\"
8397 # All subsequent reloadable object files will link in
8398 # the last one created.
8399 reload_objs="$objlist $last_robj"
8400 eval concat_cmds=\"\$concat_cmds~$reload_cmds~\$RM $last_robj\"
8402 last_robj=$output_objdir/$output_la-${k}.$objext
8404 k=$func_arith_result
8405 output=$output_objdir/$output_la-${k}.$objext
8407 func_len " $last_robj"
8408 func_arith $len0 + $func_len_result
8409 len=$func_arith_result
8412 # Handle the remaining objects by creating one last
8413 # reloadable object file. All subsequent reloadable object
8414 # files will link in the last one created.
8415 test -z "$concat_cmds" || concat_cmds=$concat_cmds~
8416 reload_objs="$objlist $last_robj"
8417 eval concat_cmds=\"\${concat_cmds}$reload_cmds\"
8418 if test -n "$last_robj"; then
8419 eval concat_cmds=\"\${concat_cmds}~\$RM $last_robj\"
8421 func_append delfiles " $output"
8427 if ${skipped_export-false}; then
8428 func_verbose "generating symbol list for \`$libname.la'"
8429 export_symbols="$output_objdir/$libname.exp"
8430 $opt_dry_run || $RM $export_symbols
8432 # Append the command to create the export file.
8433 test -z "$concat_cmds" || concat_cmds=$concat_cmds~
8434 eval concat_cmds=\"\$concat_cmds$export_symbols_cmds\"
8435 if test -n "$last_robj"; then
8436 eval concat_cmds=\"\$concat_cmds~\$RM $last_robj\"
8440 test -n "$save_libobjs" &&
8441 func_verbose "creating a temporary reloadable object file: $output"
8443 # Loop through the commands generated above and execute them.
8444 save_ifs="$IFS"; IFS='~'
8445 for cmd in $concat_cmds; do
8448 func_quote_for_expand "$cmd"
8449 eval "func_echo $func_quote_for_expand_result"
8451 $opt_dry_run || eval "$cmd" || {
8454 # Restore the uninstalled library and exit
8455 if test "$opt_mode" = relink; then
8456 ( cd "$output_objdir" && \
8457 $RM "${realname}T" && \
8458 $MV "${realname}U" "$realname" )
8466 if test -n "$export_symbols_regex" && ${skipped_export-false}; then
8467 func_show_eval '$EGREP -e "$export_symbols_regex" "$export_symbols" > "${export_symbols}T"'
8468 func_show_eval '$MV "${export_symbols}T" "$export_symbols"'
8472 if ${skipped_export-false}; then
8473 if test -n "$export_symbols" && test -n "$include_expsyms"; then
8474 tmp_export_symbols="$export_symbols"
8475 test -n "$orig_export_symbols" && tmp_export_symbols="$orig_export_symbols"
8476 $opt_dry_run || eval '$ECHO "$include_expsyms" | $SP2NL >> "$tmp_export_symbols"'
8479 if test -n "$orig_export_symbols"; then
8480 # The given exports_symbols file has to be filtered, so filter it.
8481 func_verbose "filter symbol list for \`$libname.la' to tag DATA exports"
8482 # FIXME: $output_objdir/$libname.filter potentially contains lots of
8483 # 's' commands which not all seds can handle. GNU sed should be fine
8484 # though. Also, the filter scales superlinearly with the number of
8485 # global variables. join(1) would be nice here, but unfortunately
8486 # isn't a blessed tool.
8487 $opt_dry_run || $SED -e '/[ ,]DATA/!d;s,\(.*\)\([ \,].*\),s|^\1$|\1\2|,' < $export_symbols > $output_objdir/$libname.filter
8488 func_append delfiles " $export_symbols $output_objdir/$libname.filter"
8489 export_symbols=$output_objdir/$libname.def
8490 $opt_dry_run || $SED -f $output_objdir/$libname.filter < $orig_export_symbols > $export_symbols
8495 # Restore the value of output.
8498 if test -n "$convenience" && test -n "$whole_archive_flag_spec"; then
8499 eval libobjs=\"\$libobjs $whole_archive_flag_spec\"
8500 test "X$libobjs" = "X " && libobjs=
8502 # Expand the library linking commands again to reset the
8503 # value of $libobjs for piecewise linking.
8505 # Do each of the archive commands.
8506 if test "$module" = yes && test -n "$module_cmds" ; then
8507 if test -n "$export_symbols" && test -n "$module_expsym_cmds"; then
8508 cmds=$module_expsym_cmds
8513 if test -n "$export_symbols" && test -n "$archive_expsym_cmds"; then
8514 cmds=$archive_expsym_cmds
8521 if test -n "$delfiles"; then
8522 # Append the command to remove temporary files to $cmds.
8523 eval cmds=\"\$cmds~\$RM $delfiles\"
8526 # Add any objects from preloaded convenience libraries
8527 if test -n "$dlprefiles"; then
8528 gentop="$output_objdir/${outputname}x"
8529 func_append generated " $gentop"
8531 func_extract_archives $gentop $dlprefiles
8532 func_append libobjs " $func_extract_archives_result"
8533 test "X$libobjs" = "X " && libobjs=
8536 save_ifs="$IFS"; IFS='~'
8537 for cmd in $cmds; do
8541 func_quote_for_expand "$cmd"
8542 eval "func_echo $func_quote_for_expand_result"
8544 $opt_dry_run || eval "$cmd" || {
8547 # Restore the uninstalled library and exit
8548 if test "$opt_mode" = relink; then
8549 ( cd "$output_objdir" && \
8550 $RM "${realname}T" && \
8551 $MV "${realname}U" "$realname" )
8559 # Restore the uninstalled library and exit
8560 if test "$opt_mode" = relink; then
8561 $opt_dry_run || eval '(cd $output_objdir && $RM ${realname}T && $MV $realname ${realname}T && $MV ${realname}U $realname)' || exit $?
8563 if test -n "$convenience"; then
8564 if test -z "$whole_archive_flag_spec"; then
8565 func_show_eval '${RM}r "$gentop"'
8572 # Create links to the real library.
8573 for linkname in $linknames; do
8574 if test "$realname" != "$linkname"; then
8575 func_show_eval '(cd "$output_objdir" && $RM "$linkname" && $LN_S "$realname" "$linkname")' 'exit $?'
8579 # If -module or -export-dynamic was specified, set the dlname.
8580 if test "$module" = yes || test "$export_dynamic" = yes; then
8581 # On all known operating systems, these are identical.
8588 if test -n "$dlfiles$dlprefiles" || test "$dlself" != no; then
8589 func_warning "\`-dlopen' is ignored for objects"
8594 func_warning "\`-l' and \`-L' are ignored for objects" ;;
8597 test -n "$rpath" && \
8598 func_warning "\`-rpath' is ignored for objects"
8600 test -n "$xrpath" && \
8601 func_warning "\`-R' is ignored for objects"
8603 test -n "$vinfo" && \
8604 func_warning "\`-version-info' is ignored for objects"
8606 test -n "$release" && \
8607 func_warning "\`-release' is ignored for objects"
8611 test -n "$objs$old_deplibs" && \
8612 func_fatal_error "cannot build library object \`$output' from non-libtool objects"
8616 obj=$func_lo2o_result
8624 # Delete the old objects.
8625 $opt_dry_run || $RM $obj $libobj
8627 # Objects from convenience libraries. This assumes
8628 # single-version convenience libraries. Whenever we create
8629 # different ones for PIC/non-PIC, this we'll have to duplicate
8633 # reload_cmds runs $LD directly, so let us get rid of
8634 # -Wl from whole_archive_flag_spec and hope we can get by with
8635 # turning comma into space..
8638 if test -n "$convenience"; then
8639 if test -n "$whole_archive_flag_spec"; then
8640 eval tmp_whole_archive_flags=\"$whole_archive_flag_spec\"
8641 reload_conv_objs=$reload_objs\ `$ECHO "$tmp_whole_archive_flags" | $SED 's|,| |g'`
8643 gentop="$output_objdir/${obj}x"
8644 func_append generated " $gentop"
8646 func_extract_archives $gentop $convenience
8647 reload_conv_objs="$reload_objs $func_extract_archives_result"
8651 # If we're not building shared, we need to use non_pic_objs
8652 test "$build_libtool_libs" != yes && libobjs="$non_pic_objects"
8654 # Create the old-style object.
8655 reload_objs="$objs$old_deplibs "`$ECHO "$libobjs" | $SP2NL | $SED "/\.${libext}$/d; /\.lib$/d; $lo2o" | $NL2SP`" $reload_conv_objs" ### testsuite: skip nested quoting test
8658 func_execute_cmds "$reload_cmds" 'exit $?'
8660 # Exit if we aren't doing a library object file.
8661 if test -z "$libobj"; then
8662 if test -n "$gentop"; then
8663 func_show_eval '${RM}r "$gentop"'
8669 if test "$build_libtool_libs" != yes; then
8670 if test -n "$gentop"; then
8671 func_show_eval '${RM}r "$gentop"'
8674 # Create an invalid libtool object if no PIC, so that we don't
8675 # accidentally link it into a program.
8676 # $show "echo timestamp > $libobj"
8677 # $opt_dry_run || eval "echo timestamp > $libobj" || exit $?
8681 if test -n "$pic_flag" || test "$pic_mode" != default; then
8682 # Only do commands if we really have different PIC objects.
8683 reload_objs="$libobjs $reload_conv_objs"
8685 func_execute_cmds "$reload_cmds" 'exit $?'
8688 if test -n "$gentop"; then
8689 func_show_eval '${RM}r "$gentop"'
8697 *cygwin*) func_stripname '' '.exe' "$output"
8698 output=$func_stripname_result.exe;;
8700 test -n "$vinfo" && \
8701 func_warning "\`-version-info' is ignored for programs"
8703 test -n "$release" && \
8704 func_warning "\`-release' is ignored for programs"
8706 test "$preload" = yes \
8707 && test "$dlopen_support" = unknown \
8708 && test "$dlopen_self" = unknown \
8709 && test "$dlopen_self_static" = unknown && \
8710 func_warning "\`LT_INIT([dlopen])' not used. Assuming no dlopen support."
8713 *-*-rhapsody* | *-*-darwin1.[012])
8714 # On Rhapsody replace the C library is the System framework
8715 compile_deplibs=`$ECHO " $compile_deplibs" | $SED 's/ -lc / System.ltframework /'`
8716 finalize_deplibs=`$ECHO " $finalize_deplibs" | $SED 's/ -lc / System.ltframework /'`
8722 # Don't allow lazy linking, it breaks C++ global constructors
8723 # But is supposedly fixed on 10.4 or later (yay!).
8724 if test "$tagname" = CXX ; then
8725 case ${MACOSX_DEPLOYMENT_TARGET-10.0} in
8727 func_append compile_command " ${wl}-bind_at_load"
8728 func_append finalize_command " ${wl}-bind_at_load"
8732 # Time to change all our "foo.ltframework" stuff back to "-framework foo"
8733 compile_deplibs=`$ECHO " $compile_deplibs" | $SED 's% \([^ $]*\).ltframework% -framework \1%g'`
8734 finalize_deplibs=`$ECHO " $finalize_deplibs" | $SED 's% \([^ $]*\).ltframework% -framework \1%g'`
8739 # move library search paths that coincide with paths to not yet
8740 # installed libraries to the beginning of the library search list
8742 for path in $notinst_path; do
8743 case " $new_libs " in
8744 *" -L$path/$objdir "*) ;;
8746 case " $compile_deplibs " in
8747 *" -L$path/$objdir "*)
8748 func_append new_libs " -L$path/$objdir" ;;
8753 for deplib in $compile_deplibs; do
8756 case " $new_libs " in
8758 *) func_append new_libs " $deplib" ;;
8761 *) func_append new_libs " $deplib" ;;
8764 compile_deplibs="$new_libs"
8767 func_append compile_command " $compile_deplibs"
8768 func_append finalize_command " $finalize_deplibs"
8770 if test -n "$rpath$xrpath"; then
8771 # If the user specified any rpath flags, then add them.
8772 for libdir in $rpath $xrpath; do
8773 # This is the magic to use -rpath.
8774 case "$finalize_rpath " in
8776 *) func_append finalize_rpath " $libdir" ;;
8781 # Now hardcode the library paths
8784 for libdir in $compile_rpath $finalize_rpath; do
8785 if test -n "$hardcode_libdir_flag_spec"; then
8786 if test -n "$hardcode_libdir_separator"; then
8787 if test -z "$hardcode_libdirs"; then
8788 hardcode_libdirs="$libdir"
8790 # Just accumulate the unique libdirs.
8791 case $hardcode_libdir_separator$hardcode_libdirs$hardcode_libdir_separator in
8792 *"$hardcode_libdir_separator$libdir$hardcode_libdir_separator"*)
8795 func_append hardcode_libdirs "$hardcode_libdir_separator$libdir"
8800 eval flag=\"$hardcode_libdir_flag_spec\"
8801 func_append rpath " $flag"
8803 elif test -n "$runpath_var"; then
8804 case "$perm_rpath " in
8806 *) func_append perm_rpath " $libdir" ;;
8810 *-*-cygwin* | *-*-mingw* | *-*-pw32* | *-*-os2* | *-cegcc*)
8811 testbindir=`${ECHO} "$libdir" | ${SED} -e 's*/lib$*/bin*'`
8812 case :$dllsearchpath: in
8814 ::) dllsearchpath=$libdir;;
8815 *) func_append dllsearchpath ":$libdir";;
8817 case :$dllsearchpath: in
8818 *":$testbindir:"*) ;;
8819 ::) dllsearchpath=$testbindir;;
8820 *) func_append dllsearchpath ":$testbindir";;
8825 # Substitute the hardcoded libdirs into the rpath.
8826 if test -n "$hardcode_libdir_separator" &&
8827 test -n "$hardcode_libdirs"; then
8828 libdir="$hardcode_libdirs"
8829 eval rpath=\" $hardcode_libdir_flag_spec\"
8831 compile_rpath="$rpath"
8835 for libdir in $finalize_rpath; do
8836 if test -n "$hardcode_libdir_flag_spec"; then
8837 if test -n "$hardcode_libdir_separator"; then
8838 if test -z "$hardcode_libdirs"; then
8839 hardcode_libdirs="$libdir"
8841 # Just accumulate the unique libdirs.
8842 case $hardcode_libdir_separator$hardcode_libdirs$hardcode_libdir_separator in
8843 *"$hardcode_libdir_separator$libdir$hardcode_libdir_separator"*)
8846 func_append hardcode_libdirs "$hardcode_libdir_separator$libdir"
8851 eval flag=\"$hardcode_libdir_flag_spec\"
8852 func_append rpath " $flag"
8854 elif test -n "$runpath_var"; then
8855 case "$finalize_perm_rpath " in
8857 *) func_append finalize_perm_rpath " $libdir" ;;
8861 # Substitute the hardcoded libdirs into the rpath.
8862 if test -n "$hardcode_libdir_separator" &&
8863 test -n "$hardcode_libdirs"; then
8864 libdir="$hardcode_libdirs"
8865 eval rpath=\" $hardcode_libdir_flag_spec\"
8867 finalize_rpath="$rpath"
8869 if test -n "$libobjs" && test "$build_old_libs" = yes; then
8870 # Transform all the library objects into standard objects.
8871 compile_command=`$ECHO "$compile_command" | $SP2NL | $SED "$lo2o" | $NL2SP`
8872 finalize_command=`$ECHO "$finalize_command" | $SP2NL | $SED "$lo2o" | $NL2SP`
8875 func_generate_dlsyms "$outputname" "@PROGRAM@" "no"
8877 # template prelinking step
8878 if test -n "$prelink_cmds"; then
8879 func_execute_cmds "$prelink_cmds" 'exit $?'
8882 wrappers_required=yes
8884 *cegcc* | *mingw32ce*)
8885 # Disable wrappers for cegcc and mingw32ce hosts, we are cross compiling anyway.
8886 wrappers_required=no
8888 *cygwin* | *mingw* )
8889 if test "$build_libtool_libs" != yes; then
8890 wrappers_required=no
8894 if test "$need_relink" = no || test "$build_libtool_libs" != yes; then
8895 wrappers_required=no
8899 if test "$wrappers_required" = no; then
8900 # Replace the output file specification.
8901 compile_command=`$ECHO "$compile_command" | $SED 's%@OUTPUT@%'"$output"'%g'`
8902 link_command="$compile_command$compile_rpath"
8904 # We have no uninstalled library dependencies, so finalize right now.
8906 func_show_eval "$link_command" 'exit_status=$?'
8908 if test -n "$postlink_cmds"; then
8909 func_to_tool_file "$output"
8910 postlink_cmds=`func_echo_all "$postlink_cmds" | $SED -e 's%@OUTPUT@%'"$output"'%g' -e 's%@TOOL_OUTPUT@%'"$func_to_tool_file_result"'%g'`
8911 func_execute_cmds "$postlink_cmds" 'exit $?'
8914 # Delete the generated files.
8915 if test -f "$output_objdir/${outputname}S.${objext}"; then
8916 func_show_eval '$RM "$output_objdir/${outputname}S.${objext}"'
8922 if test -n "$compile_shlibpath$finalize_shlibpath"; then
8923 compile_command="$shlibpath_var=\"$compile_shlibpath$finalize_shlibpath\$$shlibpath_var\" $compile_command"
8925 if test -n "$finalize_shlibpath"; then
8926 finalize_command="$shlibpath_var=\"$finalize_shlibpath\$$shlibpath_var\" $finalize_command"
8931 if test -n "$runpath_var"; then
8932 if test -n "$perm_rpath"; then
8933 # We should set the runpath_var.
8935 for dir in $perm_rpath; do
8936 func_append rpath "$dir:"
8938 compile_var="$runpath_var=\"$rpath\$$runpath_var\" "
8940 if test -n "$finalize_perm_rpath"; then
8941 # We should set the runpath_var.
8943 for dir in $finalize_perm_rpath; do
8944 func_append rpath "$dir:"
8946 finalize_var="$runpath_var=\"$rpath\$$runpath_var\" "
8950 if test "$no_install" = yes; then
8951 # We don't need to create a wrapper script.
8952 link_command="$compile_var$compile_command$compile_rpath"
8953 # Replace the output file specification.
8954 link_command=`$ECHO "$link_command" | $SED 's%@OUTPUT@%'"$output"'%g'`
8955 # Delete the old output file.
8956 $opt_dry_run || $RM $output
8957 # Link the executable and exit
8958 func_show_eval "$link_command" 'exit $?'
8960 if test -n "$postlink_cmds"; then
8961 func_to_tool_file "$output"
8962 postlink_cmds=`func_echo_all "$postlink_cmds" | $SED -e 's%@OUTPUT@%'"$output"'%g' -e 's%@TOOL_OUTPUT@%'"$func_to_tool_file_result"'%g'`
8963 func_execute_cmds "$postlink_cmds" 'exit $?'
8969 if test "$hardcode_action" = relink; then
8970 # Fast installation is not supported
8971 link_command="$compile_var$compile_command$compile_rpath"
8972 relink_command="$finalize_var$finalize_command$finalize_rpath"
8974 func_warning "this platform does not like uninstalled shared libraries"
8975 func_warning "\`$output' will be relinked during installation"
8977 if test "$fast_install" != no; then
8978 link_command="$finalize_var$compile_command$finalize_rpath"
8979 if test "$fast_install" = yes; then
8980 relink_command=`$ECHO "$compile_var$compile_command$compile_rpath" | $SED 's%@OUTPUT@%\$progdir/\$file%g'`
8982 # fast_install is set to needless
8986 link_command="$compile_var$compile_command$compile_rpath"
8987 relink_command="$finalize_var$finalize_command$finalize_rpath"
8991 # Replace the output file specification.
8992 link_command=`$ECHO "$link_command" | $SED 's%@OUTPUT@%'"$output_objdir/$outputname"'%g'`
8994 # Delete the old output files.
8995 $opt_dry_run || $RM $output $output_objdir/$outputname $output_objdir/lt-$outputname
8997 func_show_eval "$link_command" 'exit $?'
8999 if test -n "$postlink_cmds"; then
9000 func_to_tool_file "$output_objdir/$outputname"
9001 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'`
9002 func_execute_cmds "$postlink_cmds" 'exit $?'
9005 # Now create the wrapper script.
9006 func_verbose "creating $output"
9008 # Quote the relink command for shipping.
9009 if test -n "$relink_command"; then
9010 # Preserve any variables that may affect compiler behavior
9011 for var in $variables_saved_for_relink; do
9012 if eval test -z \"\${$var+set}\"; then
9013 relink_command="{ test -z \"\${$var+set}\" || $lt_unset $var || { $var=; export $var; }; }; $relink_command"
9014 elif eval var_value=\$$var; test -z "$var_value"; then
9015 relink_command="$var=; export $var; $relink_command"
9017 func_quote_for_eval "$var_value"
9018 relink_command="$var=$func_quote_for_eval_result; export $var; $relink_command"
9021 relink_command="(cd `pwd`; $relink_command)"
9022 relink_command=`$ECHO "$relink_command" | $SED "$sed_quote_subst"`
9025 # Only actually do things if not in dry run mode.
9027 # win32 will think the script is a binary if it has
9028 # a .exe suffix, so we strip it off here.
9030 *.exe) func_stripname '' '.exe' "$output"
9031 output=$func_stripname_result ;;
9033 # test for cygwin because mv fails w/o .exe extensions
9037 func_stripname '' '.exe' "$outputname"
9038 outputname=$func_stripname_result ;;
9042 *cygwin* | *mingw* )
9043 func_dirname_and_basename "$output" "" "."
9044 output_name=$func_basename_result
9045 output_path=$func_dirname_result
9046 cwrappersource="$output_path/$objdir/lt-$output_name.c"
9047 cwrapper="$output_path/$output_name.exe"
9048 $RM $cwrappersource $cwrapper
9049 trap "$RM $cwrappersource $cwrapper; exit $EXIT_FAILURE" 1 2 15
9051 func_emit_cwrapperexe_src > $cwrappersource
9053 # The wrapper executable is built using the $host compiler,
9054 # because it contains $host paths and files. If cross-
9055 # compiling, it, like the target executable, must be
9056 # executed on the $host or under an emulation environment.
9058 $LTCC $LTCFLAGS -o $cwrapper $cwrappersource
9062 # Now, create the wrapper script for func_source use:
9063 func_ltwrapper_scriptname $cwrapper
9064 $RM $func_ltwrapper_scriptname_result
9065 trap "$RM $func_ltwrapper_scriptname_result; exit $EXIT_FAILURE" 1 2 15
9067 # note: this script will not be executed, so do not chmod.
9068 if test "x$build" = "x$host" ; then
9069 $cwrapper --lt-dump-script > $func_ltwrapper_scriptname_result
9071 func_emit_wrapper no > $func_ltwrapper_scriptname_result
9077 trap "$RM $output; exit $EXIT_FAILURE" 1 2 15
9079 func_emit_wrapper no > $output
9088 # See if we need to build an old-fashioned archive.
9089 for oldlib in $oldlibs; do
9091 if test "$build_libtool_libs" = convenience; then
9092 oldobjs="$libobjs_save $symfileobj"
9093 addlibs="$convenience"
9094 build_libtool_libs=no
9096 if test "$build_libtool_libs" = module; then
9097 oldobjs="$libobjs_save"
9098 build_libtool_libs=no
9100 oldobjs="$old_deplibs $non_pic_objects"
9101 if test "$preload" = yes && test -f "$symfileobj"; then
9102 func_append oldobjs " $symfileobj"
9105 addlibs="$old_convenience"
9108 if test -n "$addlibs"; then
9109 gentop="$output_objdir/${outputname}x"
9110 func_append generated " $gentop"
9112 func_extract_archives $gentop $addlibs
9113 func_append oldobjs " $func_extract_archives_result"
9116 # Do each command in the archive commands.
9117 if test -n "$old_archive_from_new_cmds" && test "$build_libtool_libs" = yes; then
9118 cmds=$old_archive_from_new_cmds
9121 # Add any objects from preloaded convenience libraries
9122 if test -n "$dlprefiles"; then
9123 gentop="$output_objdir/${outputname}x"
9124 func_append generated " $gentop"
9126 func_extract_archives $gentop $dlprefiles
9127 func_append oldobjs " $func_extract_archives_result"
9130 # POSIX demands no paths to be encoded in archives. We have
9131 # to avoid creating archives with duplicate basenames if we
9132 # might have to extract them afterwards, e.g., when creating a
9133 # static archive out of a convenience library, or when linking
9134 # the entirety of a libtool archive into another (currently
9135 # not supported by libtool).
9136 if (for obj in $oldobjs
9138 func_basename "$obj"
9139 $ECHO "$func_basename_result"
9140 done | sort | sort -uc >/dev/null 2>&1); then
9143 echo "copying selected object files to avoid basename conflicts..."
9144 gentop="$output_objdir/${outputname}x"
9145 func_append generated " $gentop"
9146 func_mkdir_p "$gentop"
9147 save_oldobjs=$oldobjs
9150 for obj in $save_oldobjs
9152 func_basename "$obj"
9153 objbase="$func_basename_result"
9154 case " $oldobjs " in
9155 " ") oldobjs=$obj ;;
9158 # Make sure we don't pick an alternate name that also
9160 newobj=lt$counter-$objbase
9161 func_arith $counter + 1
9162 counter=$func_arith_result
9163 case " $oldobjs " in
9164 *[\ /]"$newobj "*) ;;
9165 *) if test ! -f "$gentop/$newobj"; then break; fi ;;
9168 func_show_eval "ln $obj $gentop/$newobj || cp $obj $gentop/$newobj"
9169 func_append oldobjs " $gentop/$newobj"
9171 *) func_append oldobjs " $obj" ;;
9175 eval cmds=\"$old_archive_cmds\"
9178 len=$func_len_result
9179 if test "$len" -lt "$max_cmd_len" || test "$max_cmd_len" -le -1; then
9180 cmds=$old_archive_cmds
9181 elif test -n "$archiver_list_spec"; then
9182 func_verbose "using command file archive linking..."
9185 func_to_tool_file "$obj"
9186 $ECHO "$func_to_tool_file_result"
9187 done > $output_objdir/$libname.libcmd
9188 func_to_tool_file "$output_objdir/$libname.libcmd"
9189 oldobjs=" $archiver_list_spec$func_to_tool_file_result"
9190 cmds=$old_archive_cmds
9192 # the command line is too long to link in one step, link in parts
9193 func_verbose "using piecewise archive linking..."
9198 save_oldobjs=$oldobjs
9200 # Is there a better way of finding the last object in the list?
9201 for obj in $save_oldobjs
9205 eval test_cmds=\"$old_archive_cmds\"
9206 func_len " $test_cmds"
9207 len0=$func_len_result
9209 for obj in $save_oldobjs
9212 func_arith $len + $func_len_result
9213 len=$func_arith_result
9214 func_append objlist " $obj"
9215 if test "$len" -lt "$max_cmd_len"; then
9218 # the above command should be used before it gets too long
9220 if test "$obj" = "$last_oldobj" ; then
9223 test -z "$concat_cmds" || concat_cmds=$concat_cmds~
9224 eval concat_cmds=\"\${concat_cmds}$old_archive_cmds\"
9231 if test "X$oldobjs" = "X" ; then
9232 eval cmds=\"\$concat_cmds\"
9234 eval cmds=\"\$concat_cmds~\$old_archive_cmds\"
9238 func_execute_cmds "$cmds" 'exit $?'
9241 test -n "$generated" && \
9242 func_show_eval "${RM}r$generated"
9244 # Now create the libtool archive.
9248 test "$build_old_libs" = yes && old_library="$libname.$libext"
9249 func_verbose "creating $output"
9251 # Preserve any variables that may affect compiler behavior
9252 for var in $variables_saved_for_relink; do
9253 if eval test -z \"\${$var+set}\"; then
9254 relink_command="{ test -z \"\${$var+set}\" || $lt_unset $var || { $var=; export $var; }; }; $relink_command"
9255 elif eval var_value=\$$var; test -z "$var_value"; then
9256 relink_command="$var=; export $var; $relink_command"
9258 func_quote_for_eval "$var_value"
9259 relink_command="$var=$func_quote_for_eval_result; export $var; $relink_command"
9262 # Quote the link command for shipping.
9263 relink_command="(cd `pwd`; $SHELL $progpath $preserve_args --mode=relink $libtool_args @inst_prefix_dir@)"
9264 relink_command=`$ECHO "$relink_command" | $SED "$sed_quote_subst"`
9265 if test "$hardcode_automatic" = yes ; then
9269 # Only create the output if not a dry run.
9271 for installed in no yes; do
9272 if test "$installed" = yes; then
9273 if test -z "$install_libdir"; then
9276 output="$output_objdir/$outputname"i
9277 # Replace all uninstalled libtool libraries with the installed ones
9279 for deplib in $dependency_libs; do
9282 func_basename "$deplib"
9283 name="$func_basename_result"
9284 eval libdir=`${SED} -n -e 's/^libdir=\(.*\)$/\1/p' $deplib`
9285 test -z "$libdir" && \
9286 func_fatal_error "\`$deplib' is not a valid libtool archive"
9287 func_append newdependency_libs " ${lt_sysroot:+=}$libdir/$name"
9290 func_stripname -L '' "$deplib"
9291 func_replace_sysroot "$func_stripname_result"
9292 func_append newdependency_libs " -L$func_replace_sysroot_result"
9295 func_stripname -R '' "$deplib"
9296 func_replace_sysroot "$func_stripname_result"
9297 func_append newdependency_libs " -R$func_replace_sysroot_result"
9299 *) func_append newdependency_libs " $deplib" ;;
9302 dependency_libs="$newdependency_libs"
9305 for lib in $dlfiles; do
9308 func_basename "$lib"
9309 name="$func_basename_result"
9310 eval libdir=`${SED} -n -e 's/^libdir=\(.*\)$/\1/p' $lib`
9311 test -z "$libdir" && \
9312 func_fatal_error "\`$lib' is not a valid libtool archive"
9313 func_append newdlfiles " ${lt_sysroot:+=}$libdir/$name"
9315 *) func_append newdlfiles " $lib" ;;
9318 dlfiles="$newdlfiles"
9320 for lib in $dlprefiles; do
9323 # Only pass preopened files to the pseudo-archive (for
9324 # eventual linking with the app. that links it) if we
9325 # didn't already link the preopened objects directly into
9327 func_basename "$lib"
9328 name="$func_basename_result"
9329 eval libdir=`${SED} -n -e 's/^libdir=\(.*\)$/\1/p' $lib`
9330 test -z "$libdir" && \
9331 func_fatal_error "\`$lib' is not a valid libtool archive"
9332 func_append newdlprefiles " ${lt_sysroot:+=}$libdir/$name"
9336 dlprefiles="$newdlprefiles"
9339 for lib in $dlfiles; do
9341 [\\/]* | [A-Za-z]:[\\/]*) abs="$lib" ;;
9342 *) abs=`pwd`"/$lib" ;;
9344 func_append newdlfiles " $abs"
9346 dlfiles="$newdlfiles"
9348 for lib in $dlprefiles; do
9350 [\\/]* | [A-Za-z]:[\\/]*) abs="$lib" ;;
9351 *) abs=`pwd`"/$lib" ;;
9353 func_append newdlprefiles " $abs"
9355 dlprefiles="$newdlprefiles"
9358 # place dlname in correct position for cygwin
9359 # In fact, it would be nice if we could use this code for all target
9360 # systems that can't hard-code library paths into their executables
9361 # and that have no shared library path variable independent of PATH,
9362 # but it turns out we can't easily determine that from inspecting
9363 # libtool variables, so we have to hard-code the OSs to which it
9364 # applies here; at the moment, that means platforms that use the PE
9365 # object format with DLL files. See the long comment at the top of
9366 # tests/bindir.at for full details.
9368 case $host,$output,$installed,$module,$dlname in
9369 *cygwin*,*lai,yes,no,*.dll | *mingw*,*lai,yes,no,*.dll | *cegcc*,*lai,yes,no,*.dll)
9370 # If a -bindir argument was supplied, place the dll there.
9371 if test "x$bindir" != x ;
9373 func_relative_path "$install_libdir" "$bindir"
9374 tdlname=$func_relative_path_result$dlname
9376 # Otherwise fall back on heuristic.
9377 tdlname=../bin/$dlname
9382 # $outputname - a libtool library file
9383 # Generated by $PROGRAM (GNU $PACKAGE$TIMESTAMP) $VERSION
9385 # Please DO NOT delete this file!
9386 # It is necessary for linking the library.
9388 # The name that we can dlopen(3).
9391 # Names of this library.
9392 library_names='$library_names'
9394 # The name of the static archive.
9395 old_library='$old_library'
9397 # Linker flags that can not go in dependency_libs.
9398 inherited_linker_flags='$new_inherited_linker_flags'
9400 # Libraries that this one depends upon.
9401 dependency_libs='$dependency_libs'
9403 # Names of additional weak libraries provided by this library
9404 weak_library_names='$weak_libs'
9406 # Version information for $libname.
9411 # Is this an already installed library?
9412 installed=$installed
9414 # Should we warn about portability when linking against -modules?
9415 shouldnotlink=$module
9417 # Files to dlopen/dlpreopen
9419 dlpreopen='$dlprefiles'
9421 # Directory that this library needs to be installed in:
9422 libdir='$install_libdir'"
9423 if test "$installed" = no && test "$need_relink" = yes; then
9425 relink_command=\"$relink_command\""
9430 # Do a symbolic link so that the libtool archive can be found in
9431 # LD_LIBRARY_PATH before the program is installed.
9432 func_show_eval '( cd "$output_objdir" && $RM "$outputname" && $LN_S "../$outputname" "$outputname" )' 'exit $?'
9438 { test "$opt_mode" = link || test "$opt_mode" = relink; } &&
9439 func_mode_link ${1+"$@"}
9442 # func_mode_uninstall arg...
9443 func_mode_uninstall ()
9451 # This variable tells wrapper scripts just to set variables rather
9452 # than running their programs.
9453 libtool_install_magic="$magic"
9458 -f) func_append RM " $arg"; rmforce=yes ;;
9459 -*) func_append RM " $arg" ;;
9460 *) func_append files " $arg" ;;
9465 func_fatal_help "you must specify an RM program"
9469 for file in $files; do
9470 func_dirname "$file" "" "."
9471 dir="$func_dirname_result"
9472 if test "X$dir" = X.; then
9477 func_basename "$file"
9478 name="$func_basename_result"
9479 test "$opt_mode" = uninstall && odir="$dir"
9481 # Remember odir for removal later, being careful to avoid duplicates
9482 if test "$opt_mode" = clean; then
9485 *) func_append rmdirs " $odir" ;;
9489 # Don't error if the file doesn't exist and rm -f was used.
9490 if { test -L "$file"; } >/dev/null 2>&1 ||
9491 { test -h "$file"; } >/dev/null 2>&1 ||
9492 test -f "$file"; then
9494 elif test -d "$file"; then
9497 elif test "$rmforce" = yes; then
9505 # Possibly a libtool archive, so verify it.
9506 if func_lalib_p "$file"; then
9507 func_source $dir/$name
9509 # Delete the libtool libraries and symlinks.
9510 for n in $library_names; do
9511 func_append rmfiles " $odir/$n"
9513 test -n "$old_library" && func_append rmfiles " $odir/$old_library"
9517 case " $library_names " in
9519 *) test -n "$dlname" && func_append rmfiles " $odir/$dlname" ;;
9521 test -n "$libdir" && func_append rmfiles " $odir/$name $odir/${name}i"
9524 if test -n "$library_names"; then
9525 # Do each command in the postuninstall commands.
9526 func_execute_cmds "$postuninstall_cmds" 'test "$rmforce" = yes || exit_status=1'
9529 if test -n "$old_library"; then
9530 # Do each command in the old_postuninstall commands.
9531 func_execute_cmds "$old_postuninstall_cmds" 'test "$rmforce" = yes || exit_status=1'
9533 # FIXME: should reinstall the best remaining shared library.
9540 # Possibly a libtool object, so verify it.
9541 if func_lalib_p "$file"; then
9544 func_source $dir/$name
9546 # Add PIC object to the list of files to remove.
9547 if test -n "$pic_object" &&
9548 test "$pic_object" != none; then
9549 func_append rmfiles " $dir/$pic_object"
9552 # Add non-PIC object to the list of files to remove.
9553 if test -n "$non_pic_object" &&
9554 test "$non_pic_object" != none; then
9555 func_append rmfiles " $dir/$non_pic_object"
9561 if test "$opt_mode" = clean ; then
9565 func_stripname '' '.exe' "$file"
9566 file=$func_stripname_result
9567 func_stripname '' '.exe' "$name"
9568 noexename=$func_stripname_result
9569 # $file with .exe has already been added to rmfiles,
9570 # add $file without .exe
9571 func_append rmfiles " $file"
9574 # Do a test to see if this is a libtool program.
9575 if func_ltwrapper_p "$file"; then
9576 if func_ltwrapper_executable_p "$file"; then
9577 func_ltwrapper_scriptname "$file"
9579 func_source $func_ltwrapper_scriptname_result
9580 func_append rmfiles " $func_ltwrapper_scriptname_result"
9583 func_source $dir/$noexename
9586 # note $name still contains .exe if it was in $file originally
9587 # as does the version of $file that was added into $rmfiles
9588 func_append rmfiles " $odir/$name $odir/${name}S.${objext}"
9589 if test "$fast_install" = yes && test -n "$relink_command"; then
9590 func_append rmfiles " $odir/lt-$name"
9592 if test "X$noexename" != "X$name" ; then
9593 func_append rmfiles " $odir/lt-${noexename}.c"
9599 func_show_eval "$RM $rmfiles" 'exit_status=1'
9602 # Try to remove the ${objdir}s in the directories where we deleted files
9603 for dir in $rmdirs; do
9604 if test -d "$dir"; then
9605 func_show_eval "rmdir $dir >/dev/null 2>&1"
9612 { test "$opt_mode" = uninstall || test "$opt_mode" = clean; } &&
9613 func_mode_uninstall ${1+"$@"}
9615 test -z "$opt_mode" && {
9616 help="$generic_help"
9617 func_fatal_help "you must specify a MODE"
9620 test -z "$exec_cmd" && \
9621 func_fatal_help "invalid operation mode \`$opt_mode'"
9623 if test -n "$exec_cmd"; then
9624 eval exec "$exec_cmd"
9631 # The TAGs below are defined such that we never get into a situation
9632 # in which we disable both kinds of libraries. Given conflicting
9633 # choices, we go for a static library, that is the most portable,
9634 # since we can't tell whether shared libraries were disabled because
9635 # the user asked for that or because the platform doesn't support
9636 # them. This is particularly important on AIX, because we don't
9637 # support having both static and shared libraries enabled at the same
9638 # time on that platform, so we default to a shared-only configuration.
9639 # If a disable-shared tag is given, we'll fallback to a static-only
9640 # configuration. But we'll never go from static-only to shared-only.
9642 # ### BEGIN LIBTOOL TAG CONFIG: disable-shared
9643 build_libtool_libs=no
9645 # ### END LIBTOOL TAG CONFIG: disable-shared
9647 # ### BEGIN LIBTOOL TAG CONFIG: disable-static
9648 build_old_libs=`case $build_libtool_libs in yes) echo no;; *) echo yes;; esac`
9649 # ### END LIBTOOL TAG CONFIG: disable-static