2 # libtool (GNU libtool) 2.4.2
3 # Written by Gordon Matzigkeit <gord@gnu.ai.mit.edu>, 1996
5 # Copyright (C) 1996, 1997, 1998, 1999, 2000, 2001, 2003, 2004, 2005, 2006,
6 # 2007, 2008, 2009, 2010, 2011 Free Software Foundation, Inc.
7 # This is free software; see the source for copying conditions. There is NO
8 # warranty; not even for MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
10 # GNU Libtool is free software; you can redistribute it and/or modify
11 # it under the terms of the GNU General Public License as published by
12 # the Free Software Foundation; either version 2 of the License, or
13 # (at your option) any later version.
15 # As a special exception to the GNU General Public License,
16 # if you distribute this file as part of a program or library that
17 # is built using GNU Libtool, you may include this file under the
18 # same distribution terms that you use for the rest of that program.
20 # GNU Libtool is distributed in the hope that it will be useful, but
21 # WITHOUT ANY WARRANTY; without even the implied warranty of
22 # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
23 # General Public License for more details.
25 # You should have received a copy of the GNU General Public License
26 # along with GNU Libtool; see the file COPYING. If not, a copy
27 # can be downloaded from http://www.gnu.org/licenses/gpl.html,
28 # or obtained by writing to the Free Software Foundation, Inc.,
29 # 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
31 # Usage: $progname [OPTION]... [MODE-ARG]...
33 # Provide generalized library-building support services.
35 # --config show all configuration variables
36 # --debug enable verbose shell tracing
37 # -n, --dry-run display commands without modifying any files
38 # --features display basic configuration information and exit
39 # --mode=MODE use operation mode MODE
40 # --preserve-dup-deps don't remove duplicate dependency libraries
41 # --quiet, --silent don't print informational messages
42 # --no-quiet, --no-silent
43 # print informational messages (default)
44 # --no-warn don't display warning messages
45 # --tag=TAG use configuration variables from tag TAG
46 # -v, --verbose print more informational messages than default
47 # --no-verbose don't print the extra informational messages
48 # --version print version information
49 # -h, --help, --help-all print short, long, or detailed help message
51 # MODE must be one of the following:
53 # clean remove files from the build directory
54 # compile compile a source file into a libtool object
55 # execute automatically set library path, then run a program
56 # finish complete the installation of libtool libraries
57 # install install libraries or executables
58 # link create a library or an executable
59 # uninstall remove libraries from an installed directory
61 # MODE-ARGS vary depending on the MODE. When passed as first option,
62 # `--mode=MODE' may be abbreviated as `MODE' or a unique abbreviation of that.
63 # Try `$progname --help --mode=MODE' for a more detailed description of MODE.
65 # When reporting a bug, please describe a test case to reproduce it and
66 # include the following information:
71 # compiler flags: $LTCFLAGS
72 # linker: $LD (gnu? $with_gnu_ld)
73 # $progname: (GNU libtool) 2.4.2
74 # automake: $automake_version
75 # autoconf: $autoconf_version
77 # Report bugs to <bug-libtool@gnu.org>.
78 # GNU libtool home page: <http://www.gnu.org/software/libtool/>.
79 # General help using GNU software: <http://www.gnu.org/gethelp/>.
85 package_revision=1.3337
87 # Be Bourne compatible
88 if test -n "${ZSH_VERSION+set}" && (emulate sh) >/dev/null 2>&1; then
91 # Zsh 3.x and 4.x performs word splitting on ${1+"$@"}, which
92 # is contrary to our usage. Disable this feature.
93 alias -g '${1+"$@"}'='"$@"'
96 case `(set -o) 2>/dev/null` in *posix*) set -o posix;; esac
98 BIN_SH=xpg4; export BIN_SH # for Tru64
99 DUALCASE=1; export DUALCASE # for MKS sh
101 # A function that is used when there is no print builtin or printf.
102 func_fallback_echo ()
104 eval 'cat <<_LTECHO_EOF
109 # NLS nuisances: We save the old values to restore during execute mode.
112 for lt_var in LANG LANGUAGE LC_ALL LC_CTYPE LC_COLLATE LC_MESSAGES
114 eval "if test \"\${$lt_var+set}\" = set; then
115 save_$lt_var=\$$lt_var
118 lt_user_locale=\"$lt_var=\\\$save_\$lt_var; \$lt_user_locale\"
119 lt_safe_locale=\"$lt_var=C; \$lt_safe_locale\"
124 export LANGUAGE LC_ALL
129 # Work around backward compatibility issue on IRIX 6.5. On IRIX 6.4+, sh
130 # is ksh but when the shell is invoked as "sh" and the current value of
131 # the _XPG environment variable is not equal to 1 (one), the special
132 # positional parameter $0, within a function call, is the name of the
140 test "${ECHO+set}" = set || ECHO=${as_echo-'printf %s\n'}
145 : ${SHELL="${CONFIG_SHELL-/bin/sh}"}
146 : ${Xsed="$SED -e 1s/^X//"}
151 EXIT_MISMATCH=63 # $? = 63 is used to indicate version mismatch to missing.
152 EXIT_SKIP=77 # $? = 77 is used to indicate a skipped test to automake.
154 exit_status=$EXIT_SUCCESS
156 # Make sure IFS has a sensible default
161 dirname="s,/[^/]*$,,"
164 # func_dirname file append nondir_replacement
165 # Compute the dirname of FILE. If nonempty, add APPEND to the result,
166 # otherwise set result to NONDIR_REPLACEMENT.
169 func_dirname_result=`$ECHO "${1}" | $SED "$dirname"`
170 if test "X$func_dirname_result" = "X${1}"; then
171 func_dirname_result="${3}"
173 func_dirname_result="$func_dirname_result${2}"
175 } # func_dirname may be replaced by extended shell implementation
181 func_basename_result=`$ECHO "${1}" | $SED "$basename"`
182 } # func_basename may be replaced by extended shell implementation
185 # func_dirname_and_basename file append nondir_replacement
186 # perform func_basename and func_dirname in a single function
188 # dirname: Compute the dirname of FILE. If nonempty,
189 # add APPEND to the result, otherwise set result
190 # to NONDIR_REPLACEMENT.
191 # value returned in "$func_dirname_result"
192 # basename: Compute filename of FILE.
193 # value retuned in "$func_basename_result"
194 # Implementation must be kept synchronized with func_dirname
195 # and func_basename. For efficiency, we do not delegate to
196 # those functions but instead duplicate the functionality here.
197 func_dirname_and_basename ()
199 # Extract subdirectory from the argument.
200 func_dirname_result=`$ECHO "${1}" | $SED -e "$dirname"`
201 if test "X$func_dirname_result" = "X${1}"; then
202 func_dirname_result="${3}"
204 func_dirname_result="$func_dirname_result${2}"
206 func_basename_result=`$ECHO "${1}" | $SED -e "$basename"`
207 } # func_dirname_and_basename may be replaced by extended shell implementation
210 # func_stripname prefix suffix name
211 # strip PREFIX and SUFFIX off of NAME.
212 # PREFIX and SUFFIX must not contain globbing or regex special
213 # characters, hashes, percent signs, but SUFFIX may contain a leading
214 # dot (in which case that matches only a dot).
215 # func_strip_suffix prefix name
219 .*) func_stripname_result=`$ECHO "${3}" | $SED "s%^${1}%%; s%\\\\${2}\$%%"`;;
220 *) func_stripname_result=`$ECHO "${3}" | $SED "s%^${1}%%; s%${2}\$%%"`;;
222 } # func_stripname may be replaced by extended shell implementation
225 # These SED scripts presuppose an absolute path with a trailing slash.
226 pathcar='s,^/\([^/]*\).*$,\1,'
227 pathcdr='s,^/[^/]*,,'
228 removedotparts=':dotsl
232 collapseslashes='s@/\{1,\}@/@g'
233 finalslash='s,/*$,/,'
235 # func_normal_abspath PATH
236 # Remove doubled-up and trailing slashes, "." path components,
237 # and cancel out any ".." path components in PATH after making
238 # it an absolute path.
239 # value returned in "$func_normal_abspath_result"
240 func_normal_abspath ()
242 # Start from root dir and reassemble the path.
243 func_normal_abspath_result=
244 func_normal_abspath_tpath=$1
245 func_normal_abspath_altnamespace=
246 case $func_normal_abspath_tpath in
248 # Empty path, that just means $cwd.
249 func_stripname '' '/' "`pwd`"
250 func_normal_abspath_result=$func_stripname_result
253 # The next three entries are used to spot a run of precisely
254 # two leading slashes without using negated character classes;
255 # we take advantage of case's first-match behaviour.
257 # Unusual form of absolute path, do nothing.
260 # Not necessarily an ordinary path; POSIX reserves leading '//'
261 # and for example Cygwin uses it to access remote file shares
262 # over CIFS/SMB, so we conserve a leading double slash if found.
263 func_normal_abspath_altnamespace=/
266 # Absolute path, do nothing.
269 # Relative path, prepend $cwd.
270 func_normal_abspath_tpath=`pwd`/$func_normal_abspath_tpath
273 # Cancel out all the simple stuff to save iterations. We also want
274 # the path to end with a slash for ease of parsing, so make sure
275 # there is one (and only one) here.
276 func_normal_abspath_tpath=`$ECHO "$func_normal_abspath_tpath" | $SED \
277 -e "$removedotparts" -e "$collapseslashes" -e "$finalslash"`
279 # Processed it all yet?
280 if test "$func_normal_abspath_tpath" = / ; then
281 # If we ascended to the root using ".." the result may be empty now.
282 if test -z "$func_normal_abspath_result" ; then
283 func_normal_abspath_result=/
287 func_normal_abspath_tcomponent=`$ECHO "$func_normal_abspath_tpath" | $SED \
289 func_normal_abspath_tpath=`$ECHO "$func_normal_abspath_tpath" | $SED \
291 # Figure out what to do with it
292 case $func_normal_abspath_tcomponent in
294 # Trailing empty path component, ignore it.
297 # Parent dir; strip last assembled component from result.
298 func_dirname "$func_normal_abspath_result"
299 func_normal_abspath_result=$func_dirname_result
302 # Actual path component, append it.
303 func_normal_abspath_result=$func_normal_abspath_result/$func_normal_abspath_tcomponent
307 # Restore leading double-slash if one was found on entry.
308 func_normal_abspath_result=$func_normal_abspath_altnamespace$func_normal_abspath_result
311 # func_relative_path SRCDIR DSTDIR
312 # generates a relative path from SRCDIR to DSTDIR, with a trailing
313 # slash if non-empty, suitable for immediately appending a filename
314 # without needing to append a separator.
315 # value returned in "$func_relative_path_result"
316 func_relative_path ()
318 func_relative_path_result=
319 func_normal_abspath "$1"
320 func_relative_path_tlibdir=$func_normal_abspath_result
321 func_normal_abspath "$2"
322 func_relative_path_tbindir=$func_normal_abspath_result
324 # Ascend the tree starting from libdir
326 # check if we have found a prefix of bindir
327 case $func_relative_path_tbindir in
328 $func_relative_path_tlibdir)
329 # found an exact match
330 func_relative_path_tcancelled=
333 $func_relative_path_tlibdir*)
334 # found a matching prefix
335 func_stripname "$func_relative_path_tlibdir" '' "$func_relative_path_tbindir"
336 func_relative_path_tcancelled=$func_stripname_result
337 if test -z "$func_relative_path_result"; then
338 func_relative_path_result=.
343 func_dirname $func_relative_path_tlibdir
344 func_relative_path_tlibdir=${func_dirname_result}
345 if test "x$func_relative_path_tlibdir" = x ; then
346 # Have to descend all the way to the root!
347 func_relative_path_result=../$func_relative_path_result
348 func_relative_path_tcancelled=$func_relative_path_tbindir
351 func_relative_path_result=../$func_relative_path_result
356 # Now calculate path; take care to avoid doubling-up slashes.
357 func_stripname '' '/' "$func_relative_path_result"
358 func_relative_path_result=$func_stripname_result
359 func_stripname '/' '/' "$func_relative_path_tcancelled"
360 if test "x$func_stripname_result" != x ; then
361 func_relative_path_result=${func_relative_path_result}/${func_stripname_result}
364 # Normalisation. If bindir is libdir, return empty string,
365 # else relative path ending with a slash; either way, target
366 # file name can be directly appended.
367 if test ! -z "$func_relative_path_result"; then
368 func_stripname './' '' "$func_relative_path_result/"
369 func_relative_path_result=$func_stripname_result
373 # The name of this program:
374 func_dirname_and_basename "$progpath"
375 progname=$func_basename_result
377 # Make sure we have an absolute path for reexecution:
379 [\\/]*|[A-Za-z]:\\*) ;;
381 progdir=$func_dirname_result
382 progdir=`cd "$progdir" && pwd`
383 progpath="$progdir/$progname"
387 IFS=${PATH_SEPARATOR-:}
388 for progdir in $PATH; do
390 test -x "$progdir/$progname" && break
393 test -n "$progdir" || progdir=`pwd`
394 progpath="$progdir/$progname"
398 # Sed substitution that helps us do robust quoting. It backslashifies
399 # metacharacters that are still active within double-quoted strings.
400 Xsed="${SED}"' -e 1s/^X//'
401 sed_quote_subst='s/\([`"$\\]\)/\\\1/g'
403 # Same as above, but do not quote variable references.
404 double_quote_subst='s/\(["`\\]\)/\\\1/g'
406 # Sed substitution that turns a string into a regex matching for the
408 sed_make_literal_regex='s,[].[^$\\*\/],\\&,g'
410 # Sed substitution that converts a w32 file name or path
411 # which contains forward slashes, into one that contains
412 # (escaped) backslashes. A very naive implementation.
413 lt_sed_naive_backslashify='s|\\\\*|\\|g;s|/|\\|g;s|\\|\\\\|g'
415 # Re-`\' parameter expansions in output of double_quote_subst that were
416 # `\'-ed in input to the same. If an odd number of `\' preceded a '$'
417 # in input to double_quote_subst, that '$' was protected from expansion.
418 # Since each input `\' is now two `\'s, look for any number of runs of
419 # four `\'s followed by two `\'s and then a '$'. `\' that '$'.
424 sed_double_backslash="\
428 s/\\([^$bs]\\)$bs2$dollar/\\1$bs2$bs$dollar/g
439 # Echo program name prefixed message, along with the current mode
440 # name if it has been set yet.
443 $ECHO "$progname: ${opt_mode+$opt_mode: }$*"
446 # func_verbose arg...
447 # Echo program name prefixed message in verbose mode only.
450 $opt_verbose && func_echo ${1+"$@"}
452 # A bug in bash halts the script if the last line of a function
453 # fails when set -e is in force, so we need another command to
458 # func_echo_all arg...
459 # Invoke $ECHO with all args, space-separated.
466 # Echo program name prefixed message to standard error.
469 $ECHO "$progname: ${opt_mode+$opt_mode: }"${1+"$@"} 1>&2
472 # func_warning arg...
473 # Echo program name prefixed warning message to standard error.
476 $opt_warning && $ECHO "$progname: ${opt_mode+$opt_mode: }warning: "${1+"$@"} 1>&2
482 # func_fatal_error arg...
483 # Echo program name prefixed message to standard error, and exit.
490 # func_fatal_help arg...
491 # Echo program name prefixed message to standard error, followed by
492 # a help hint, and exit.
496 func_fatal_error "$help"
498 help="Try \`$progname --help' for more information." ## default
501 # func_grep expression filename
502 # Check whether EXPRESSION matches any line of FILENAME, without output.
505 $GREP "$1" "$2" >/dev/null 2>&1
509 # func_mkdir_p directory-path
510 # Make sure the entire path to DIRECTORY-PATH is available.
513 my_directory_path="$1"
516 if test -n "$my_directory_path" && test "$opt_dry_run" != ":"; then
518 # Protect directory names starting with `-'
519 case $my_directory_path in
520 -*) my_directory_path="./$my_directory_path" ;;
523 # While some portion of DIR does not yet exist...
524 while test ! -d "$my_directory_path"; do
525 # ...make a list in topmost first order. Use a colon delimited
526 # list incase some portion of path contains whitespace.
527 my_dir_list="$my_directory_path:$my_dir_list"
529 # If the last portion added has no slash in it, the list is done
530 case $my_directory_path in */*) ;; *) break ;; esac
532 # ...otherwise throw away the child directory and loop
533 my_directory_path=`$ECHO "$my_directory_path" | $SED -e "$dirname"`
535 my_dir_list=`$ECHO "$my_dir_list" | $SED 's,:*$,,'`
537 save_mkdir_p_IFS="$IFS"; IFS=':'
538 for my_dir in $my_dir_list; do
539 IFS="$save_mkdir_p_IFS"
540 # mkdir can fail with a `File exist' error if two processes
541 # try to create one of the directories concurrently. Don't
543 $MKDIR "$my_dir" 2>/dev/null || :
545 IFS="$save_mkdir_p_IFS"
547 # Bail out if we (or some other process) failed to create a directory.
548 test -d "$my_directory_path" || \
549 func_fatal_error "Failed to create \`$1'"
554 # func_mktempdir [string]
555 # Make a temporary directory that won't clash with other running
556 # libtool processes, and avoids race conditions if possible. If
557 # given, STRING is the basename for that directory.
560 my_template="${TMPDIR-/tmp}/${1-$progname}"
562 if test "$opt_dry_run" = ":"; then
563 # Return a directory name, but don't create it in dry-run mode
564 my_tmpdir="${my_template}-$$"
567 # If mktemp works, use that first and foremost
568 my_tmpdir=`mktemp -d "${my_template}-XXXXXXXX" 2>/dev/null`
570 if test ! -d "$my_tmpdir"; then
571 # Failing that, at least try and use $RANDOM to avoid a race
572 my_tmpdir="${my_template}-${RANDOM-0}$$"
574 save_mktempdir_umask=`umask`
577 umask $save_mktempdir_umask
580 # If we're not in dry-run mode, bomb out on failure
581 test -d "$my_tmpdir" || \
582 func_fatal_error "cannot create temporary directory \`$my_tmpdir'"
589 # func_quote_for_eval arg
590 # Aesthetically quote ARG to be evaled later.
591 # This function returns two values: FUNC_QUOTE_FOR_EVAL_RESULT
592 # is double-quoted, suitable for a subsequent eval, whereas
593 # FUNC_QUOTE_FOR_EVAL_UNQUOTED_RESULT has merely all characters
594 # which are still active within double quotes backslashified.
595 func_quote_for_eval ()
599 func_quote_for_eval_unquoted_result=`$ECHO "$1" | $SED "$sed_quote_subst"` ;;
601 func_quote_for_eval_unquoted_result="$1" ;;
604 case $func_quote_for_eval_unquoted_result in
605 # Double-quote args containing shell metacharacters to delay
606 # word splitting, command substitution and and variable
607 # expansion for a subsequent eval.
608 # Many Bourne shells cannot handle close brackets correctly
609 # in scan sets, so we specify it separately.
610 *[\[\~\#\^\&\*\(\)\{\}\|\;\<\>\?\'\ \ ]*|*]*|"")
611 func_quote_for_eval_result="\"$func_quote_for_eval_unquoted_result\""
614 func_quote_for_eval_result="$func_quote_for_eval_unquoted_result"
619 # func_quote_for_expand arg
620 # Aesthetically quote ARG to be evaled later; same as above,
621 # but do not quote variable references.
622 func_quote_for_expand ()
626 my_arg=`$ECHO "$1" | $SED \
627 -e "$double_quote_subst" -e "$sed_double_backslash"` ;;
633 # Double-quote args containing shell metacharacters to delay
634 # word splitting and command substitution for a subsequent eval.
635 # Many Bourne shells cannot handle close brackets correctly
636 # in scan sets, so we specify it separately.
637 *[\[\~\#\^\&\*\(\)\{\}\|\;\<\>\?\'\ \ ]*|*]*|"")
642 func_quote_for_expand_result="$my_arg"
646 # func_show_eval cmd [fail_exp]
647 # Unless opt_silent is true, then output CMD. Then, if opt_dryrun is
648 # not true, evaluate CMD. If the evaluation of CMD fails, and FAIL_EXP
649 # is given, then evaluate it.
655 ${opt_silent-false} || {
656 func_quote_for_expand "$my_cmd"
657 eval "func_echo $func_quote_for_expand_result"
660 if ${opt_dry_run-false}; then :; else
663 if test "$my_status" -eq 0; then :; else
664 eval "(exit $my_status); $my_fail_exp"
670 # func_show_eval_locale cmd [fail_exp]
671 # Unless opt_silent is true, then output CMD. Then, if opt_dryrun is
672 # not true, evaluate CMD. If the evaluation of CMD fails, and FAIL_EXP
673 # is given, then evaluate it. Use the saved locale for evaluation.
674 func_show_eval_locale ()
679 ${opt_silent-false} || {
680 func_quote_for_expand "$my_cmd"
681 eval "func_echo $func_quote_for_expand_result"
684 if ${opt_dry_run-false}; then :; else
685 eval "$lt_user_locale
688 eval "$lt_safe_locale"
689 if test "$my_status" -eq 0; then :; else
690 eval "(exit $my_status); $my_fail_exp"
696 # Turn $1 into a string suitable for a shell variable name.
697 # Result is stored in $func_tr_sh_result. All characters
698 # not in the set a-zA-Z0-9_ are replaced with '_'. Further,
699 # if $1 begins with a digit, a '_' is prepended as well.
703 [0-9]* | *[!a-zA-Z0-9_]*)
704 func_tr_sh_result=`$ECHO "$1" | $SED 's/^\([0-9]\)/_\1/; s/[^a-zA-Z0-9_]/_/g'`
714 # Echo version message to standard output and exit.
727 /^# '$PROGRAM' (GNU /,/# warranty; / {
730 s/\((C)\)[ 0-9,-]*\( [1-9][0-9]*\)/\1\2/
737 # Echo short help message to standard output and exit.
742 $SED -n '/^# Usage:/,/^# *.*--help/ {
745 s/\$progname/'$progname'/
749 $ECHO "run \`$progname --help | more' for full usage"
754 # Echo long help message to standard output and exit,
755 # unless 'noexit' is passed as argument.
760 $SED -n '/^# Usage:/,/# Report bugs to/ {
764 s*\$progname*'$progname'*
766 s*\$SHELL*'"$SHELL"'*
768 s*\$LTCFLAGS*'"$LTCFLAGS"'*
770 s/\$with_gnu_ld/'"$with_gnu_ld"'/
771 s/\$automake_version/'"`(${AUTOMAKE-automake} --version) 2>/dev/null |$SED 1q`"'/
772 s/\$autoconf_version/'"`(${AUTOCONF-autoconf} --version) 2>/dev/null |$SED 1q`"'/
776 /^# .* home page:/b print
777 /^# General help using/b print
780 if test -z "$1"; then
785 # func_missing_arg argname
786 # Echo program name prefixed message to standard error and set global
792 func_error "missing argument for $1."
797 # func_split_short_opt shortopt
798 # Set func_split_short_opt_name and func_split_short_opt_arg shell
799 # variables after splitting SHORTOPT after the 2nd character.
800 func_split_short_opt ()
802 my_sed_short_opt='1s/^\(..\).*$/\1/;q'
803 my_sed_short_rest='1s/^..\(.*\)$/\1/;q'
805 func_split_short_opt_name=`$ECHO "$1" | $SED "$my_sed_short_opt"`
806 func_split_short_opt_arg=`$ECHO "$1" | $SED "$my_sed_short_rest"`
807 } # func_split_short_opt may be replaced by extended shell implementation
810 # func_split_long_opt longopt
811 # Set func_split_long_opt_name and func_split_long_opt_arg shell
812 # variables after splitting LONGOPT at the `=' sign.
813 func_split_long_opt ()
815 my_sed_long_opt='1s/^\(--[^=]*\)=.*/\1/;q'
816 my_sed_long_arg='1s/^--[^=]*=//'
818 func_split_long_opt_name=`$ECHO "$1" | $SED "$my_sed_long_opt"`
819 func_split_long_opt_arg=`$ECHO "$1" | $SED "$my_sed_long_arg"`
820 } # func_split_long_opt may be replaced by extended shell implementation
828 magic="%%%MAGIC variable%%%"
829 magic_exe="%%%MAGIC EXE variable%%%"
834 lo2o="s/\\.lo\$/.${objext}/"
835 o2lo="s/\\.${objext}\$/.lo/"
839 # If this variable is set in any of the actions, the command in it
840 # will be execed at the end. This prevents here-documents from being
841 # left over by shells.
844 # func_append var value
845 # Append VALUE to the end of shell variable VAR.
848 eval "${1}=\$${1}\${2}"
849 } # func_append may be replaced by extended shell implementation
851 # func_append_quoted var value
852 # Quote VALUE and append to the end of shell variable VAR, separated
854 func_append_quoted ()
856 func_quote_for_eval "${2}"
857 eval "${1}=\$${1}\\ \$func_quote_for_eval_result"
858 } # func_append_quoted may be replaced by extended shell implementation
861 # func_arith arithmetic-term...
864 func_arith_result=`expr "${@}"`
865 } # func_arith may be replaced by extended shell implementation
869 # STRING may not start with a hyphen.
872 func_len_result=`expr "${1}" : ".*" 2>/dev/null || echo $max_cmd_len`
873 } # func_len may be replaced by extended shell implementation
879 func_lo2o_result=`$ECHO "${1}" | $SED "$lo2o"`
880 } # func_lo2o may be replaced by extended shell implementation
883 # func_xform libobj-or-source
886 func_xform_result=`$ECHO "${1}" | $SED 's/\.[^.]*$/.lo/'`
887 } # func_xform may be replaced by extended shell implementation
890 # func_fatal_configuration arg...
891 # Echo program name prefixed message to standard error, followed by
892 # a configuration failure hint, and exit.
893 func_fatal_configuration ()
896 func_error "See the $PACKAGE documentation for more information."
897 func_fatal_error "Fatal configuration error."
902 # Display the configuration for all the tags in this script.
905 re_begincf='^# ### BEGIN LIBTOOL'
906 re_endcf='^# ### END LIBTOOL'
908 # Default configuration.
909 $SED "1,/$re_begincf CONFIG/d;/$re_endcf CONFIG/,\$d" < "$progpath"
911 # Now print the configurations for the tags.
912 for tagname in $taglist; do
913 $SED -n "/$re_begincf TAG CONFIG: $tagname\$/,/$re_endcf TAG CONFIG: $tagname\$/p" < "$progpath"
920 # Display the features supported by this script.
924 if test "$build_libtool_libs" = yes; then
925 echo "enable shared libraries"
927 echo "disable shared libraries"
929 if test "$build_old_libs" = yes; then
930 echo "enable static libraries"
932 echo "disable static libraries"
938 # func_enable_tag tagname
939 # Verify that TAGNAME is valid, and either flag an error and exit, or
940 # enable the TAGNAME tag. We also add TAGNAME to the global $taglist
947 re_begincf="^# ### BEGIN LIBTOOL TAG CONFIG: $tagname\$"
948 re_endcf="^# ### END LIBTOOL TAG CONFIG: $tagname\$"
949 sed_extractcf="/$re_begincf/,/$re_endcf/p"
954 func_fatal_error "invalid tag name: $tagname"
958 # Don't test for the "default" C tag, as we know it's
959 # there but not specially marked.
963 if $GREP "$re_begincf" "$progpath" >/dev/null 2>&1; then
964 taglist="$taglist $tagname"
966 # Evaluate the configuration. Be careful to quote the path
967 # and the sed script, to avoid splitting on whitespace, but
968 # also don't use non-portable quotes within backquotes within
969 # quotes we have to do it in 2 steps:
970 extractedcf=`$SED -n -e "$sed_extractcf" < "$progpath"`
973 func_error "ignoring unknown tag $tagname"
979 # func_check_version_match
980 # Ensure that we are using m4 macros, and libtool script from the same
981 # release of libtool.
982 func_check_version_match ()
984 if test "$package_revision" != "$macro_revision"; then
985 if test "$VERSION" != "$macro_version"; then
986 if test -z "$macro_version"; then
988 $progname: Version mismatch error. This is $PACKAGE $VERSION, but the
989 $progname: definition of this LT_INIT comes from an older release.
990 $progname: You should recreate aclocal.m4 with macros from $PACKAGE $VERSION
991 $progname: and run autoconf again.
995 $progname: Version mismatch error. This is $PACKAGE $VERSION, but the
996 $progname: definition of this LT_INIT comes from $PACKAGE $macro_version.
997 $progname: You should recreate aclocal.m4 with macros from $PACKAGE $VERSION
998 $progname: and run autoconf again.
1003 $progname: Version mismatch error. This is $PACKAGE $VERSION, revision $package_revision,
1004 $progname: but the definition of this LT_INIT comes from revision $macro_revision.
1005 $progname: You should recreate aclocal.m4 with macros from revision $package_revision
1006 $progname: of $PACKAGE $VERSION and run autoconf again.
1015 # Shorthand for --mode=foo, only valid as the first argument
1018 shift; set dummy --mode clean ${1+"$@"}; shift
1020 compile|compil|compi|comp|com|co|c)
1021 shift; set dummy --mode compile ${1+"$@"}; shift
1023 execute|execut|execu|exec|exe|ex|e)
1024 shift; set dummy --mode execute ${1+"$@"}; shift
1026 finish|finis|fini|fin|fi|f)
1027 shift; set dummy --mode finish ${1+"$@"}; shift
1029 install|instal|insta|inst|ins|in|i)
1030 shift; set dummy --mode install ${1+"$@"}; shift
1033 shift; set dummy --mode link ${1+"$@"}; shift
1035 uninstall|uninstal|uninsta|uninst|unins|unin|uni|un|u)
1036 shift; set dummy --mode uninstall ${1+"$@"}; shift
1046 opt_preserve_dup_deps=false
1058 # Parse options once, thoroughly. This comes as soon as possible in the
1059 # script to make things like `--version' happen as quickly as we can.
1061 # this just eases exit handling
1062 while test $# -gt 0; do
1066 --debug|-x) opt_debug='set -x'
1067 func_echo "enabling shell trace mode"
1070 --dry-run|--dryrun|-n)
1079 opt_dlopen="${opt_dlopen+$opt_dlopen
1083 --preserve-dup-deps)
1084 opt_preserve_dup_deps=:
1092 set dummy --mode finish ${1+"$@"}; shift
1099 opt_help=': help-all'
1102 test $# = 0 && func_missing_arg $opt && break
1106 # Valid mode arguments:
1107 clean|compile|execute|finish|install|link|relink|uninstall) ;;
1109 # Catch anything else as an error
1110 *) func_error "invalid argument for $opt"
1117 --no-silent|--no-quiet)
1119 func_append preserve_args " $opt"
1121 --no-warning|--no-warn)
1123 func_append preserve_args " $opt"
1127 func_append preserve_args " $opt"
1131 func_append preserve_args " $opt"
1136 func_append preserve_args " $opt"
1140 test $# = 0 && func_missing_arg $opt && break
1143 func_append preserve_args " $opt $optarg"
1144 func_enable_tag "$optarg"
1148 -\?|-h) func_usage ;;
1149 --help) func_help ;;
1150 --version) func_version ;;
1152 # Separate optargs to long options:
1154 func_split_long_opt "$opt"
1155 set dummy "$func_split_long_opt_name" "$func_split_long_opt_arg" ${1+"$@"}
1159 # Separate non-argument short options:
1161 func_split_short_opt "$opt"
1162 set dummy "$func_split_short_opt_name" "-$func_split_short_opt_arg" ${1+"$@"}
1167 -*) func_fatal_help "unrecognized option \`$opt'" ;;
1168 *) set dummy "$opt" ${1+"$@"}; shift; break ;;
1174 # save first non-option argument
1175 if test "$#" -gt 0; then
1181 test "$opt_debug" = : || func_append preserve_args " --debug"
1184 *cygwin* | *mingw* | *pw32* | *cegcc*)
1185 # don't eliminate duplications in $postdeps and $predeps
1186 opt_duplicate_compiler_generated_deps=:
1189 opt_duplicate_compiler_generated_deps=$opt_preserve_dup_deps
1194 # Sanity checks first:
1195 func_check_version_match
1197 if test "$build_libtool_libs" != yes && test "$build_old_libs" != yes; then
1198 func_fatal_configuration "not configured to build any kind of library"
1202 eval std_shrext=\"$shrext_cmds\"
1204 # Only execute mode is allowed to have -dlopen flags.
1205 if test -n "$opt_dlopen" && test "$opt_mode" != execute; then
1206 func_error "unrecognized option \`-dlopen'"
1211 # Change the help message to a mode-specific one.
1212 generic_help="$help"
1213 help="Try \`$progname --help --mode=$opt_mode' for more information."
1217 # Bail if the options were screwed
1218 $exit_cmd $EXIT_FAILURE
1229 # True iff FILE is a libtool `.la' library or `.lo' object file.
1230 # This function is only a basic sanity check; it will hardly flush out
1231 # determined imposters.
1235 $SED -e 4q "$1" 2>/dev/null \
1236 | $GREP "^# Generated by .*$PACKAGE" > /dev/null 2>&1
1239 # func_lalib_unsafe_p file
1240 # True iff FILE is a libtool `.la' library or `.lo' object file.
1241 # This function implements the same check as func_lalib_p without
1242 # resorting to external programs. To this end, it redirects stdin and
1243 # closes it afterwards, without saving the original file descriptor.
1244 # As a safety measure, use it only where a negative result would be
1245 # fatal anyway. Works if `file' does not exist.
1246 func_lalib_unsafe_p ()
1249 if test -f "$1" && test -r "$1" && exec 5<&0 <"$1"; then
1250 for lalib_p_l in 1 2 3 4
1253 case "$lalib_p_line" in
1254 \#\ Generated\ by\ *$PACKAGE* ) lalib_p=yes; break;;
1259 test "$lalib_p" = yes
1262 # func_ltwrapper_script_p file
1263 # True iff FILE is a libtool wrapper script
1264 # This function is only a basic sanity check; it will hardly flush out
1265 # determined imposters.
1266 func_ltwrapper_script_p ()
1271 # func_ltwrapper_executable_p file
1272 # True iff FILE is a libtool wrapper executable
1273 # This function is only a basic sanity check; it will hardly flush out
1274 # determined imposters.
1275 func_ltwrapper_executable_p ()
1277 func_ltwrapper_exec_suffix=
1280 *) func_ltwrapper_exec_suffix=.exe ;;
1282 $GREP "$magic_exe" "$1$func_ltwrapper_exec_suffix" >/dev/null 2>&1
1285 # func_ltwrapper_scriptname file
1286 # Assumes file is an ltwrapper_executable
1287 # uses $file to determine the appropriate filename for a
1288 # temporary ltwrapper_script.
1289 func_ltwrapper_scriptname ()
1291 func_dirname_and_basename "$1" "" "."
1292 func_stripname '' '.exe' "$func_basename_result"
1293 func_ltwrapper_scriptname_result="$func_dirname_result/$objdir/${func_stripname_result}_ltshwrapper"
1296 # func_ltwrapper_p file
1297 # True iff FILE is a libtool wrapper script or wrapper executable
1298 # This function is only a basic sanity check; it will hardly flush out
1299 # determined imposters.
1302 func_ltwrapper_script_p "$1" || func_ltwrapper_executable_p "$1"
1306 # func_execute_cmds commands fail_cmd
1307 # Execute tilde-delimited COMMANDS.
1308 # If FAIL_CMD is given, eval that upon failure.
1309 # FAIL_CMD may read-access the current command in variable CMD!
1310 func_execute_cmds ()
1313 save_ifs=$IFS; IFS='~'
1317 func_show_eval "$cmd" "${2-:}"
1324 # Source FILE, adding directory component if necessary.
1325 # Note that it is not necessary on cygwin/mingw to append a dot to
1326 # FILE even if both FILE and FILE.exe exist: automatic-append-.exe
1327 # behavior happens only for exec(3), not for open(2)! Also, sourcing
1328 # `FILE.' does not work on cygwin managed mounts.
1333 */* | *\\*) . "$1" ;;
1339 # func_resolve_sysroot PATH
1340 # Replace a leading = in PATH with a sysroot. Store the result into
1341 # func_resolve_sysroot_result
1342 func_resolve_sysroot ()
1344 func_resolve_sysroot_result=$1
1345 case $func_resolve_sysroot_result in
1347 func_stripname '=' '' "$func_resolve_sysroot_result"
1348 func_resolve_sysroot_result=$lt_sysroot$func_stripname_result
1353 # func_replace_sysroot PATH
1354 # If PATH begins with the sysroot, replace it with = and
1355 # store the result into func_replace_sysroot_result.
1356 func_replace_sysroot ()
1358 case "$lt_sysroot:$1" in
1360 func_stripname "$lt_sysroot" '' "$1"
1361 func_replace_sysroot_result="=$func_stripname_result"
1364 # Including no sysroot.
1365 func_replace_sysroot_result=$1
1370 # func_infer_tag arg
1371 # Infer tagged configuration to use if any are available and
1372 # if one wasn't chosen via the "--tag" command line option.
1373 # Only attempt this if the compiler in the base compile
1374 # command doesn't match the default compiler.
1375 # arg is usually of the form 'gcc ...'
1379 if test -n "$available_tags" && test -z "$tagname"; then
1382 func_append_quoted CC_quoted "$arg"
1384 CC_expanded=`func_echo_all $CC`
1385 CC_quoted_expanded=`func_echo_all $CC_quoted`
1387 # Blanks in the command may have been stripped by the calling shell,
1388 # but not from the CC environment variable when configure was run.
1389 " $CC "* | "$CC "* | " $CC_expanded "* | "$CC_expanded "* | \
1390 " $CC_quoted"* | "$CC_quoted "* | " $CC_quoted_expanded "* | "$CC_quoted_expanded "*) ;;
1391 # Blanks at the start of $base_compile will cause this to fail
1392 # if we don't check for them as well.
1394 for z in $available_tags; do
1395 if $GREP "^# ### BEGIN LIBTOOL TAG CONFIG: $z$" < "$progpath" > /dev/null; then
1396 # Evaluate the configuration.
1397 eval "`${SED} -n -e '/^# ### BEGIN LIBTOOL TAG CONFIG: '$z'$/,/^# ### END LIBTOOL TAG CONFIG: '$z'$/p' < $progpath`"
1400 # Double-quote args containing other shell metacharacters.
1401 func_append_quoted CC_quoted "$arg"
1403 CC_expanded=`func_echo_all $CC`
1404 CC_quoted_expanded=`func_echo_all $CC_quoted`
1406 " $CC "* | "$CC "* | " $CC_expanded "* | "$CC_expanded "* | \
1407 " $CC_quoted"* | "$CC_quoted "* | " $CC_quoted_expanded "* | "$CC_quoted_expanded "*)
1408 # The compiler in the base compile command matches
1409 # the one in the tagged configuration.
1410 # Assume this is the tagged configuration we want.
1417 # If $tagname still isn't set, then no tagged configuration
1418 # was found and let the user know that the "--tag" command
1419 # line option must be used.
1420 if test -z "$tagname"; then
1421 func_echo "unable to infer tagged configuration"
1422 func_fatal_error "specify a tag with \`--tag'"
1424 # func_verbose "using $tagname tagged configuration"
1433 # func_write_libtool_object output_name pic_name nonpic_name
1434 # Create a libtool object file (analogous to a ".la" file),
1435 # but don't create it if we're doing a dry run.
1436 func_write_libtool_object ()
1439 if test "$build_libtool_libs" = yes; then
1445 if test "$build_old_libs" = yes; then
1446 write_oldobj=\'${3}\'
1452 cat >${write_libobj}T <<EOF
1453 # $write_libobj - a libtool object file
1454 # Generated by $PROGRAM (GNU $PACKAGE$TIMESTAMP) $VERSION
1456 # Please DO NOT delete this file!
1457 # It is necessary for linking the library.
1459 # Name of the PIC object.
1460 pic_object=$write_lobj
1462 # Name of the non-PIC object
1463 non_pic_object=$write_oldobj
1466 $MV "${write_libobj}T" "${write_libobj}"
1471 ##################################################
1472 # FILE NAME AND PATH CONVERSION HELPER FUNCTIONS #
1473 ##################################################
1475 # func_convert_core_file_wine_to_w32 ARG
1476 # Helper function used by file name conversion functions when $build is *nix,
1477 # and $host is mingw, cygwin, or some other w32 environment. Relies on a
1478 # correctly configured wine environment available, with the winepath program
1479 # in $build's $PATH.
1481 # ARG is the $build file name to be converted to w32 format.
1482 # Result is available in $func_convert_core_file_wine_to_w32_result, and will
1483 # be empty on error (or when ARG is empty)
1484 func_convert_core_file_wine_to_w32 ()
1487 func_convert_core_file_wine_to_w32_result="$1"
1488 if test -n "$1"; then
1489 # Unfortunately, winepath does not exit with a non-zero error code, so we
1490 # are forced to check the contents of stdout. On the other hand, if the
1491 # command is not found, the shell will set an exit code of 127 and print
1492 # *an error message* to stdout. So we must check for both error code of
1493 # zero AND non-empty stdout, which explains the odd construction:
1494 func_convert_core_file_wine_to_w32_tmp=`winepath -w "$1" 2>/dev/null`
1495 if test "$?" -eq 0 && test -n "${func_convert_core_file_wine_to_w32_tmp}"; then
1496 func_convert_core_file_wine_to_w32_result=`$ECHO "$func_convert_core_file_wine_to_w32_tmp" |
1497 $SED -e "$lt_sed_naive_backslashify"`
1499 func_convert_core_file_wine_to_w32_result=
1503 # end: func_convert_core_file_wine_to_w32
1506 # func_convert_core_path_wine_to_w32 ARG
1507 # Helper function used by path conversion functions when $build is *nix, and
1508 # $host is mingw, cygwin, or some other w32 environment. Relies on a correctly
1509 # configured wine environment available, with the winepath program in $build's
1510 # $PATH. Assumes ARG has no leading or trailing path separator characters.
1512 # ARG is path to be converted from $build format to win32.
1513 # Result is available in $func_convert_core_path_wine_to_w32_result.
1514 # Unconvertible file (directory) names in ARG are skipped; if no directory names
1515 # are convertible, then the result may be empty.
1516 func_convert_core_path_wine_to_w32 ()
1519 # unfortunately, winepath doesn't convert paths, only file names
1520 func_convert_core_path_wine_to_w32_result=""
1521 if test -n "$1"; then
1524 for func_convert_core_path_wine_to_w32_f in $1; do
1526 func_convert_core_file_wine_to_w32 "$func_convert_core_path_wine_to_w32_f"
1527 if test -n "$func_convert_core_file_wine_to_w32_result" ; then
1528 if test -z "$func_convert_core_path_wine_to_w32_result"; then
1529 func_convert_core_path_wine_to_w32_result="$func_convert_core_file_wine_to_w32_result"
1531 func_append func_convert_core_path_wine_to_w32_result ";$func_convert_core_file_wine_to_w32_result"
1538 # end: func_convert_core_path_wine_to_w32
1541 # func_cygpath ARGS...
1542 # Wrapper around calling the cygpath program via LT_CYGPATH. This is used when
1543 # when (1) $build is *nix and Cygwin is hosted via a wine environment; or (2)
1544 # $build is MSYS and $host is Cygwin, or (3) $build is Cygwin. In case (1) or
1545 # (2), returns the Cygwin file name or path in func_cygpath_result (input
1546 # file name or path is assumed to be in w32 format, as previously converted
1547 # from $build's *nix or MSYS format). In case (3), returns the w32 file name
1548 # or path in func_cygpath_result (input file name or path is assumed to be in
1549 # Cygwin format). Returns an empty string on error.
1551 # ARGS are passed to cygpath, with the last one being the file name or path to
1554 # Specify the absolute *nix (or w32) name to cygpath in the LT_CYGPATH
1555 # environment variable; do not put it in $PATH.
1559 if test -n "$LT_CYGPATH" && test -f "$LT_CYGPATH"; then
1560 func_cygpath_result=`$LT_CYGPATH "$@" 2>/dev/null`
1561 if test "$?" -ne 0; then
1562 # on failure, ensure result is empty
1563 func_cygpath_result=
1566 func_cygpath_result=
1567 func_error "LT_CYGPATH is empty or specifies non-existent file: \`$LT_CYGPATH'"
1573 # func_convert_core_msys_to_w32 ARG
1574 # Convert file name or path ARG from MSYS format to w32 format. Return
1575 # result in func_convert_core_msys_to_w32_result.
1576 func_convert_core_msys_to_w32 ()
1579 # awkward: cmd appends spaces to result
1580 func_convert_core_msys_to_w32_result=`( cmd //c echo "$1" ) 2>/dev/null |
1581 $SED -e 's/[ ]*$//' -e "$lt_sed_naive_backslashify"`
1583 #end: func_convert_core_msys_to_w32
1586 # func_convert_file_check ARG1 ARG2
1587 # Verify that ARG1 (a file name in $build format) was converted to $host
1588 # format in ARG2. Otherwise, emit an error message, but continue (resetting
1589 # func_to_host_file_result to ARG1).
1590 func_convert_file_check ()
1593 if test -z "$2" && test -n "$1" ; then
1594 func_error "Could not determine host file name corresponding to"
1596 func_error "Continuing, but uninstalled executables may not work."
1598 func_to_host_file_result="$1"
1601 # end func_convert_file_check
1604 # func_convert_path_check FROM_PATHSEP TO_PATHSEP FROM_PATH TO_PATH
1605 # Verify that FROM_PATH (a path in $build format) was converted to $host
1606 # format in TO_PATH. Otherwise, emit an error message, but continue, resetting
1607 # func_to_host_file_result to a simplistic fallback value (see below).
1608 func_convert_path_check ()
1611 if test -z "$4" && test -n "$3"; then
1612 func_error "Could not determine the host path corresponding to"
1614 func_error "Continuing, but uninstalled executables may not work."
1615 # Fallback. This is a deliberately simplistic "conversion" and
1616 # should not be "improved". See libtool.info.
1617 if test "x$1" != "x$2"; then
1618 lt_replace_pathsep_chars="s|$1|$2|g"
1619 func_to_host_path_result=`echo "$3" |
1620 $SED -e "$lt_replace_pathsep_chars"`
1622 func_to_host_path_result="$3"
1626 # end func_convert_path_check
1629 # func_convert_path_front_back_pathsep FRONTPAT BACKPAT REPL ORIG
1630 # Modifies func_to_host_path_result by prepending REPL if ORIG matches FRONTPAT
1631 # and appending REPL if ORIG matches BACKPAT.
1632 func_convert_path_front_back_pathsep ()
1636 $1 ) func_to_host_path_result="$3$func_to_host_path_result"
1640 $2 ) func_append func_to_host_path_result "$3"
1644 # end func_convert_path_front_back_pathsep
1647 ##################################################
1648 # $build to $host FILE NAME CONVERSION FUNCTIONS #
1649 ##################################################
1650 # invoked via `$to_host_file_cmd ARG'
1652 # In each case, ARG is the path to be converted from $build to $host format.
1653 # Result will be available in $func_to_host_file_result.
1656 # func_to_host_file ARG
1657 # Converts the file name ARG from $build format to $host format. Return result
1658 # in func_to_host_file_result.
1659 func_to_host_file ()
1662 $to_host_file_cmd "$1"
1664 # end func_to_host_file
1667 # func_to_tool_file ARG LAZY
1668 # converts the file name ARG from $build format to toolchain format. Return
1669 # result in func_to_tool_file_result. If the conversion in use is listed
1670 # in (the comma separated) LAZY, no conversion takes place.
1671 func_to_tool_file ()
1675 *,"$to_tool_file_cmd",*)
1676 func_to_tool_file_result=$1
1679 $to_tool_file_cmd "$1"
1680 func_to_tool_file_result=$func_to_host_file_result
1684 # end func_to_tool_file
1687 # func_convert_file_noop ARG
1688 # Copy ARG to func_to_host_file_result.
1689 func_convert_file_noop ()
1691 func_to_host_file_result="$1"
1693 # end func_convert_file_noop
1696 # func_convert_file_msys_to_w32 ARG
1697 # Convert file name ARG from (mingw) MSYS to (mingw) w32 format; automatic
1698 # conversion to w32 is not available inside the cwrapper. Returns result in
1699 # func_to_host_file_result.
1700 func_convert_file_msys_to_w32 ()
1703 func_to_host_file_result="$1"
1704 if test -n "$1"; then
1705 func_convert_core_msys_to_w32 "$1"
1706 func_to_host_file_result="$func_convert_core_msys_to_w32_result"
1708 func_convert_file_check "$1" "$func_to_host_file_result"
1710 # end func_convert_file_msys_to_w32
1713 # func_convert_file_cygwin_to_w32 ARG
1714 # Convert file name ARG from Cygwin to w32 format. Returns result in
1715 # func_to_host_file_result.
1716 func_convert_file_cygwin_to_w32 ()
1719 func_to_host_file_result="$1"
1720 if test -n "$1"; then
1721 # because $build is cygwin, we call "the" cygpath in $PATH; no need to use
1722 # LT_CYGPATH in this case.
1723 func_to_host_file_result=`cygpath -m "$1"`
1725 func_convert_file_check "$1" "$func_to_host_file_result"
1727 # end func_convert_file_cygwin_to_w32
1730 # func_convert_file_nix_to_w32 ARG
1731 # Convert file name ARG from *nix to w32 format. Requires a wine environment
1732 # and a working winepath. Returns result in func_to_host_file_result.
1733 func_convert_file_nix_to_w32 ()
1736 func_to_host_file_result="$1"
1737 if test -n "$1"; then
1738 func_convert_core_file_wine_to_w32 "$1"
1739 func_to_host_file_result="$func_convert_core_file_wine_to_w32_result"
1741 func_convert_file_check "$1" "$func_to_host_file_result"
1743 # end func_convert_file_nix_to_w32
1746 # func_convert_file_msys_to_cygwin ARG
1747 # Convert file name ARG from MSYS to Cygwin format. Requires LT_CYGPATH set.
1748 # Returns result in func_to_host_file_result.
1749 func_convert_file_msys_to_cygwin ()
1752 func_to_host_file_result="$1"
1753 if test -n "$1"; then
1754 func_convert_core_msys_to_w32 "$1"
1755 func_cygpath -u "$func_convert_core_msys_to_w32_result"
1756 func_to_host_file_result="$func_cygpath_result"
1758 func_convert_file_check "$1" "$func_to_host_file_result"
1760 # end func_convert_file_msys_to_cygwin
1763 # func_convert_file_nix_to_cygwin ARG
1764 # Convert file name ARG from *nix to Cygwin format. Requires Cygwin installed
1765 # in a wine environment, working winepath, and LT_CYGPATH set. Returns result
1766 # in func_to_host_file_result.
1767 func_convert_file_nix_to_cygwin ()
1770 func_to_host_file_result="$1"
1771 if test -n "$1"; then
1772 # convert from *nix to w32, then use cygpath to convert from w32 to cygwin.
1773 func_convert_core_file_wine_to_w32 "$1"
1774 func_cygpath -u "$func_convert_core_file_wine_to_w32_result"
1775 func_to_host_file_result="$func_cygpath_result"
1777 func_convert_file_check "$1" "$func_to_host_file_result"
1779 # end func_convert_file_nix_to_cygwin
1782 #############################################
1783 # $build to $host PATH CONVERSION FUNCTIONS #
1784 #############################################
1785 # invoked via `$to_host_path_cmd ARG'
1787 # In each case, ARG is the path to be converted from $build to $host format.
1788 # The result will be available in $func_to_host_path_result.
1790 # Path separators are also converted from $build format to $host format. If
1791 # ARG begins or ends with a path separator character, it is preserved (but
1792 # converted to $host format) on output.
1794 # All path conversion functions are named using the following convention:
1795 # file name conversion function : func_convert_file_X_to_Y ()
1796 # path conversion function : func_convert_path_X_to_Y ()
1797 # where, for any given $build/$host combination the 'X_to_Y' value is the
1798 # same. If conversion functions are added for new $build/$host combinations,
1799 # the two new functions must follow this pattern, or func_init_to_host_path_cmd
1803 # func_init_to_host_path_cmd
1804 # Ensures that function "pointer" variable $to_host_path_cmd is set to the
1805 # appropriate value, based on the value of $to_host_file_cmd.
1807 func_init_to_host_path_cmd ()
1810 if test -z "$to_host_path_cmd"; then
1811 func_stripname 'func_convert_file_' '' "$to_host_file_cmd"
1812 to_host_path_cmd="func_convert_path_${func_stripname_result}"
1817 # func_to_host_path ARG
1818 # Converts the path ARG from $build format to $host format. Return result
1819 # in func_to_host_path_result.
1820 func_to_host_path ()
1823 func_init_to_host_path_cmd
1824 $to_host_path_cmd "$1"
1826 # end func_to_host_path
1829 # func_convert_path_noop ARG
1830 # Copy ARG to func_to_host_path_result.
1831 func_convert_path_noop ()
1833 func_to_host_path_result="$1"
1835 # end func_convert_path_noop
1838 # func_convert_path_msys_to_w32 ARG
1839 # Convert path ARG from (mingw) MSYS to (mingw) w32 format; automatic
1840 # conversion to w32 is not available inside the cwrapper. Returns result in
1841 # func_to_host_path_result.
1842 func_convert_path_msys_to_w32 ()
1845 func_to_host_path_result="$1"
1846 if test -n "$1"; then
1847 # Remove leading and trailing path separator characters from ARG. MSYS
1848 # behavior is inconsistent here; cygpath turns them into '.;' and ';.';
1849 # and winepath ignores them completely.
1850 func_stripname : : "$1"
1851 func_to_host_path_tmp1=$func_stripname_result
1852 func_convert_core_msys_to_w32 "$func_to_host_path_tmp1"
1853 func_to_host_path_result="$func_convert_core_msys_to_w32_result"
1854 func_convert_path_check : ";" \
1855 "$func_to_host_path_tmp1" "$func_to_host_path_result"
1856 func_convert_path_front_back_pathsep ":*" "*:" ";" "$1"
1859 # end func_convert_path_msys_to_w32
1862 # func_convert_path_cygwin_to_w32 ARG
1863 # Convert path ARG from Cygwin to w32 format. Returns result in
1864 # func_to_host_file_result.
1865 func_convert_path_cygwin_to_w32 ()
1868 func_to_host_path_result="$1"
1869 if test -n "$1"; then
1870 # See func_convert_path_msys_to_w32:
1871 func_stripname : : "$1"
1872 func_to_host_path_tmp1=$func_stripname_result
1873 func_to_host_path_result=`cygpath -m -p "$func_to_host_path_tmp1"`
1874 func_convert_path_check : ";" \
1875 "$func_to_host_path_tmp1" "$func_to_host_path_result"
1876 func_convert_path_front_back_pathsep ":*" "*:" ";" "$1"
1879 # end func_convert_path_cygwin_to_w32
1882 # func_convert_path_nix_to_w32 ARG
1883 # Convert path ARG from *nix to w32 format. Requires a wine environment and
1884 # a working winepath. Returns result in func_to_host_file_result.
1885 func_convert_path_nix_to_w32 ()
1888 func_to_host_path_result="$1"
1889 if test -n "$1"; then
1890 # See func_convert_path_msys_to_w32:
1891 func_stripname : : "$1"
1892 func_to_host_path_tmp1=$func_stripname_result
1893 func_convert_core_path_wine_to_w32 "$func_to_host_path_tmp1"
1894 func_to_host_path_result="$func_convert_core_path_wine_to_w32_result"
1895 func_convert_path_check : ";" \
1896 "$func_to_host_path_tmp1" "$func_to_host_path_result"
1897 func_convert_path_front_back_pathsep ":*" "*:" ";" "$1"
1900 # end func_convert_path_nix_to_w32
1903 # func_convert_path_msys_to_cygwin ARG
1904 # Convert path ARG from MSYS to Cygwin format. Requires LT_CYGPATH set.
1905 # Returns result in func_to_host_file_result.
1906 func_convert_path_msys_to_cygwin ()
1909 func_to_host_path_result="$1"
1910 if test -n "$1"; then
1911 # See func_convert_path_msys_to_w32:
1912 func_stripname : : "$1"
1913 func_to_host_path_tmp1=$func_stripname_result
1914 func_convert_core_msys_to_w32 "$func_to_host_path_tmp1"
1915 func_cygpath -u -p "$func_convert_core_msys_to_w32_result"
1916 func_to_host_path_result="$func_cygpath_result"
1917 func_convert_path_check : : \
1918 "$func_to_host_path_tmp1" "$func_to_host_path_result"
1919 func_convert_path_front_back_pathsep ":*" "*:" : "$1"
1922 # end func_convert_path_msys_to_cygwin
1925 # func_convert_path_nix_to_cygwin ARG
1926 # Convert path ARG from *nix to Cygwin format. Requires Cygwin installed in a
1927 # a wine environment, working winepath, and LT_CYGPATH set. Returns result in
1928 # func_to_host_file_result.
1929 func_convert_path_nix_to_cygwin ()
1932 func_to_host_path_result="$1"
1933 if test -n "$1"; then
1934 # Remove leading and trailing path separator characters from
1935 # ARG. msys behavior is inconsistent here, cygpath turns them
1936 # into '.;' and ';.', and winepath ignores them completely.
1937 func_stripname : : "$1"
1938 func_to_host_path_tmp1=$func_stripname_result
1939 func_convert_core_path_wine_to_w32 "$func_to_host_path_tmp1"
1940 func_cygpath -u -p "$func_convert_core_path_wine_to_w32_result"
1941 func_to_host_path_result="$func_cygpath_result"
1942 func_convert_path_check : : \
1943 "$func_to_host_path_tmp1" "$func_to_host_path_result"
1944 func_convert_path_front_back_pathsep ":*" "*:" : "$1"
1947 # end func_convert_path_nix_to_cygwin
1950 # func_mode_compile arg...
1951 func_mode_compile ()
1954 # Get the compilation command and the source file.
1956 srcfile="$nonopt" # always keep a non-empty value in "srcfile"
1968 # do not "continue". Instead, add this to base_compile
1980 # Accept any command-line options.
1983 test -n "$libobj" && \
1984 func_fatal_error "you cannot specify \`-o' more than once"
1989 -pie | -fpie | -fPIE)
1990 func_append pie_flag " $arg"
1994 -shared | -static | -prefer-pic | -prefer-non-pic)
1995 func_append later " $arg"
2005 arg_mode=arg # the next one goes into the "base_compile" arg list
2006 continue # The current "srcfile" will either be retained or
2007 ;; # replaced later. I would guess that would be a bug.
2010 func_stripname '-Wc,' '' "$arg"
2011 args=$func_stripname_result
2013 save_ifs="$IFS"; IFS=','
2014 for arg in $args; do
2016 func_append_quoted lastarg "$arg"
2019 func_stripname ' ' '' "$lastarg"
2020 lastarg=$func_stripname_result
2022 # Add the arguments to base_compile.
2023 func_append base_compile " $lastarg"
2028 # Accept the current argument as the source file.
2029 # The previous "srcfile" becomes the current argument.
2036 esac # case $arg_mode
2038 # Aesthetically quote the previous argument.
2039 func_append_quoted base_compile "$lastarg"
2044 func_fatal_error "you must specify an argument for -Xcompile"
2047 func_fatal_error "you must specify a target with \`-o'"
2050 # Get the name of the library object.
2051 test -z "$libobj" && {
2052 func_basename "$srcfile"
2053 libobj="$func_basename_result"
2058 # Recognize several different file suffixes.
2059 # If the user specifies -o file.o, it is replaced with file.lo
2062 *.ada | *.adb | *.ads | *.asm | \
2063 *.c++ | *.cc | *.ii | *.class | *.cpp | *.cxx | \
2064 *.[fF][09]? | *.for | *.java | *.go | *.obj | *.sx | *.cu | *.cup)
2065 func_xform "$libobj"
2066 libobj=$func_xform_result
2071 *.lo) func_lo2o "$libobj"; obj=$func_lo2o_result ;;
2073 func_fatal_error "cannot determine name of library object from \`$libobj'"
2077 func_infer_tag $base_compile
2079 for arg in $later; do
2082 test "$build_libtool_libs" != yes && \
2083 func_fatal_configuration "can not build a shared library"
2089 build_libtool_libs=no
2106 func_quote_for_eval "$libobj"
2107 test "X$libobj" != "X$func_quote_for_eval_result" \
2108 && $ECHO "X$libobj" | $GREP '[]~#^*{};<>?"'"'"' &()|`$[]' \
2109 && func_warning "libobj name \`$libobj' may not contain shell special characters."
2110 func_dirname_and_basename "$obj" "/" ""
2111 objname="$func_basename_result"
2112 xdir="$func_dirname_result"
2113 lobj=${xdir}$objdir/$objname
2115 test -z "$base_compile" && \
2116 func_fatal_help "you must specify a compilation command"
2118 # Delete any leftover library objects.
2119 if test "$build_old_libs" = yes; then
2120 removelist="$obj $lobj $libobj ${libobj}T"
2122 removelist="$lobj $libobj ${libobj}T"
2125 # On Cygwin there's no "real" PIC flag so we must build both object types
2127 cygwin* | mingw* | pw32* | os2* | cegcc*)
2131 if test "$pic_mode" = no && test "$deplibs_check_method" != pass_all; then
2132 # non-PIC code in shared libraries is not supported
2136 # Calculate the filename of the output object if compiler does
2137 # not support -o with -c
2138 if test "$compiler_c_o" = no; then
2139 output_obj=`$ECHO "$srcfile" | $SED 's%^.*/%%; s%\.[^.]*$%%'`.${objext}
2140 lockfile="$output_obj.lock"
2147 # Lock this critical section if it is needed
2148 # We use this script file to make the link, it avoids creating a new file
2149 if test "$need_locks" = yes; then
2150 until $opt_dry_run || ln "$progpath" "$lockfile" 2>/dev/null; do
2151 func_echo "Waiting for $lockfile to be removed"
2154 elif test "$need_locks" = warn; then
2155 if test -f "$lockfile"; then
2157 *** ERROR, $lockfile exists and contains:
2158 `cat $lockfile 2>/dev/null`
2160 This indicates that another process is trying to use the same
2161 temporary object file, and libtool could not work around it because
2162 your compiler does not support \`-c' and \`-o' together. If you
2163 repeat this compilation, it may succeed, by chance, but you had better
2164 avoid parallel builds (make -j) in this platform, or get a better
2167 $opt_dry_run || $RM $removelist
2170 func_append removelist " $output_obj"
2171 $ECHO "$srcfile" > "$lockfile"
2174 $opt_dry_run || $RM $removelist
2175 func_append removelist " $lockfile"
2176 trap '$opt_dry_run || $RM $removelist; exit $EXIT_FAILURE' 1 2 15
2178 func_to_tool_file "$srcfile" func_convert_file_msys_to_w32
2179 srcfile=$func_to_tool_file_result
2180 func_quote_for_eval "$srcfile"
2181 qsrcfile=$func_quote_for_eval_result
2183 # Only build a PIC object if we are building libtool libraries.
2184 if test "$build_libtool_libs" = yes; then
2185 # Without this assignment, base_compile gets emptied.
2186 fbsd_hideous_sh_bug=$base_compile
2188 if test "$pic_mode" != no; then
2189 command="$base_compile $qsrcfile $pic_flag"
2191 # Don't build PIC code
2192 command="$base_compile $qsrcfile"
2195 func_mkdir_p "$xdir$objdir"
2197 if test -z "$output_obj"; then
2198 # Place PIC objects in $objdir
2199 func_append command " -o $lobj"
2202 func_show_eval_locale "$command" \
2203 'test -n "$output_obj" && $RM $removelist; exit $EXIT_FAILURE'
2205 if test "$need_locks" = warn &&
2206 test "X`cat $lockfile 2>/dev/null`" != "X$srcfile"; then
2208 *** ERROR, $lockfile contains:
2209 `cat $lockfile 2>/dev/null`
2211 but it should contain:
2214 This indicates that another process is trying to use the same
2215 temporary object file, and libtool could not work around it because
2216 your compiler does not support \`-c' and \`-o' together. If you
2217 repeat this compilation, it may succeed, by chance, but you had better
2218 avoid parallel builds (make -j) in this platform, or get a better
2221 $opt_dry_run || $RM $removelist
2225 # Just move the object if needed, then go on to compile the next one
2226 if test -n "$output_obj" && test "X$output_obj" != "X$lobj"; then
2227 func_show_eval '$MV "$output_obj" "$lobj"' \
2228 'error=$?; $opt_dry_run || $RM $removelist; exit $error'
2231 # Allow error messages only from the first compilation.
2232 if test "$suppress_opt" = yes; then
2233 suppress_output=' >/dev/null 2>&1'
2237 # Only build a position-dependent object if we build old libraries.
2238 if test "$build_old_libs" = yes; then
2239 if test "$pic_mode" != yes; then
2240 # Don't build PIC code
2241 command="$base_compile $qsrcfile$pie_flag"
2243 command="$base_compile $qsrcfile $pic_flag"
2245 if test "$compiler_c_o" = yes; then
2246 func_append command " -o $obj"
2249 # Suppress compiler output if we already did a PIC compilation.
2250 func_append command "$suppress_output"
2251 func_show_eval_locale "$command" \
2252 '$opt_dry_run || $RM $removelist; exit $EXIT_FAILURE'
2254 if test "$need_locks" = warn &&
2255 test "X`cat $lockfile 2>/dev/null`" != "X$srcfile"; then
2257 *** ERROR, $lockfile contains:
2258 `cat $lockfile 2>/dev/null`
2260 but it should contain:
2263 This indicates that another process is trying to use the same
2264 temporary object file, and libtool could not work around it because
2265 your compiler does not support \`-c' and \`-o' together. If you
2266 repeat this compilation, it may succeed, by chance, but you had better
2267 avoid parallel builds (make -j) in this platform, or get a better
2270 $opt_dry_run || $RM $removelist
2274 # Just move the object if needed
2275 if test -n "$output_obj" && test "X$output_obj" != "X$obj"; then
2276 func_show_eval '$MV "$output_obj" "$obj"' \
2277 'error=$?; $opt_dry_run || $RM $removelist; exit $error'
2282 func_write_libtool_object "$libobj" "$objdir/$objname" "$objname"
2284 # Unlock the critical section if it was locked
2285 if test "$need_locks" != no; then
2286 removelist=$lockfile
2295 test "$opt_mode" = compile && func_mode_compile ${1+"$@"}
2300 # We need to display help for each of the modes.
2303 # Generic help is extracted from the usage comments
2304 # at the start of this file.
2310 "Usage: $progname [OPTION]... --mode=clean RM [RM-OPTION]... FILE...
2312 Remove files from the build directory.
2314 RM is the name of the program to use to delete files associated with each FILE
2315 (typically \`/bin/rm'). RM-OPTIONS are options (such as \`-f') to be passed
2318 If FILE is a libtool library, object or program, all the files associated
2319 with it are deleted. Otherwise, only FILE itself is deleted using RM."
2324 "Usage: $progname [OPTION]... --mode=compile COMPILE-COMMAND... SOURCEFILE
2326 Compile a source file into a libtool library object.
2328 This mode accepts the following additional options:
2330 -o OUTPUT-FILE set the output file name to OUTPUT-FILE
2331 -no-suppress do not suppress compiler output for multiple passes
2332 -prefer-pic try to build PIC objects only
2333 -prefer-non-pic try to build non-PIC objects only
2334 -shared do not build a \`.o' file suitable for static linking
2335 -static only build a \`.o' file suitable for static linking
2336 -Wc,FLAG pass FLAG directly to the compiler
2338 COMPILE-COMMAND is a command to be used in creating a \`standard' object file
2339 from the given SOURCEFILE.
2341 The output file name is determined by removing the directory component from
2342 SOURCEFILE, then substituting the C source code suffix \`.c' with the
2343 library object suffix, \`.lo'."
2348 "Usage: $progname [OPTION]... --mode=execute COMMAND [ARGS]...
2350 Automatically set library path, then run a program.
2352 This mode accepts the following additional options:
2354 -dlopen FILE add the directory containing FILE to the library path
2356 This mode sets the library path environment variable according to \`-dlopen'
2359 If any of the ARGS are libtool executable wrappers, then they are translated
2360 into their corresponding uninstalled binary, and any of their required library
2361 directories are added to the library path.
2363 Then, COMMAND is executed, with ARGS as arguments."
2368 "Usage: $progname [OPTION]... --mode=finish [LIBDIR]...
2370 Complete the installation of libtool libraries.
2372 Each LIBDIR is a directory that contains libtool libraries.
2374 The commands that this mode executes may require superuser privileges. Use
2375 the \`--dry-run' option if you just want to see what would be executed."
2380 "Usage: $progname [OPTION]... --mode=install INSTALL-COMMAND...
2382 Install executables or libraries.
2384 INSTALL-COMMAND is the installation command. The first component should be
2385 either the \`install' or \`cp' program.
2387 The following components of INSTALL-COMMAND are treated specially:
2389 -inst-prefix-dir PREFIX-DIR Use PREFIX-DIR as a staging area for installation
2391 The rest of the components are interpreted as arguments to that command (only
2392 BSD-compatible install options are recognized)."
2397 "Usage: $progname [OPTION]... --mode=link LINK-COMMAND...
2399 Link object files or libraries together to form another library, or to
2400 create an executable program.
2402 LINK-COMMAND is a command using the C compiler that you would use to create
2403 a program from several object files.
2405 The following components of LINK-COMMAND are treated specially:
2407 -all-static do not do any dynamic linking at all
2408 -avoid-version do not add a version suffix if possible
2409 -bindir BINDIR specify path to binaries directory (for systems where
2410 libraries must be found in the PATH setting at runtime)
2411 -dlopen FILE \`-dlpreopen' FILE if it cannot be dlopened at runtime
2412 -dlpreopen FILE link in FILE and add its symbols to lt_preloaded_symbols
2413 -export-dynamic allow symbols from OUTPUT-FILE to be resolved with dlsym(3)
2414 -export-symbols SYMFILE
2415 try to export only the symbols listed in SYMFILE
2416 -export-symbols-regex REGEX
2417 try to export only the symbols matching REGEX
2418 -LLIBDIR search LIBDIR for required installed libraries
2419 -lNAME OUTPUT-FILE requires the installed library libNAME
2420 -module build a library that can dlopened
2421 -no-fast-install disable the fast-install mode
2422 -no-install link a not-installable executable
2423 -no-undefined declare that a library does not refer to external symbols
2424 -o OUTPUT-FILE create OUTPUT-FILE from the specified objects
2425 -objectlist FILE Use a list of object files found in FILE to specify objects
2426 -precious-files-regex REGEX
2427 don't remove output files matching REGEX
2428 -release RELEASE specify package release information
2429 -rpath LIBDIR the created library will eventually be installed in LIBDIR
2430 -R[ ]LIBDIR add LIBDIR to the runtime path of programs and libraries
2431 -shared only do dynamic linking of libtool libraries
2432 -shrext SUFFIX override the standard shared library file extension
2433 -static do not do any dynamic linking of uninstalled libtool libraries
2434 -static-libtool-libs
2435 do not do any dynamic linking of libtool libraries
2436 -version-info CURRENT[:REVISION[:AGE]]
2437 specify library version info [each variable defaults to 0]
2438 -weak LIBNAME declare that the target provides the LIBNAME interface
2440 -Xcompiler FLAG pass linker-specific FLAG directly to the compiler
2442 -Xlinker FLAG pass linker-specific FLAG directly to the linker
2443 -XCClinker FLAG pass link-specific FLAG to the compiler driver (CC)
2445 All other options (arguments beginning with \`-') are ignored.
2447 Every other argument is treated as a filename. Files ending in \`.la' are
2448 treated as uninstalled libtool libraries, other files are standard or library
2451 If the OUTPUT-FILE ends in \`.la', then a libtool library is created,
2452 only library objects (\`.lo' files) may be specified, and \`-rpath' is
2453 required, except when creating a convenience library.
2455 If OUTPUT-FILE ends in \`.a' or \`.lib', then a standard library is created
2456 using \`ar' and \`ranlib', or on Windows using \`lib'.
2458 If OUTPUT-FILE ends in \`.lo' or \`.${objext}', then a reloadable object file
2459 is created, otherwise an executable program is created."
2464 "Usage: $progname [OPTION]... --mode=uninstall RM [RM-OPTION]... FILE...
2466 Remove libraries from an installation directory.
2468 RM is the name of the program to use to delete files associated with each FILE
2469 (typically \`/bin/rm'). RM-OPTIONS are options (such as \`-f') to be passed
2472 If FILE is a libtool library, all the files associated with it are deleted.
2473 Otherwise, only FILE itself is deleted using RM."
2477 func_fatal_help "invalid operation mode \`$opt_mode'"
2482 $ECHO "Try \`$progname --help' for more information about other modes."
2485 # Now that we've collected a possible --mode arg, show help if necessary
2487 if test "$opt_help" = :; then
2492 for opt_mode in compile link execute install finish uninstall clean; do
2495 } | sed -n '1p; 2,$s/^Usage:/ or: /p'
2498 for opt_mode in compile link execute install finish uninstall clean; do
2504 /^When reporting/,/^Report/{
2509 /information about other modes/d
2510 /more detailed .*MODE/d
2511 s/^Usage:.*--mode=\([^ ]*\) .*/Description of \1 mode:/'
2517 # func_mode_execute arg...
2518 func_mode_execute ()
2521 # The first argument is the command name.
2524 func_fatal_help "you must specify a COMMAND"
2526 # Handle -dlopen flags immediately.
2527 for file in $opt_dlopen; do
2529 || func_fatal_help "\`$file' is not a file"
2534 func_resolve_sysroot "$file"
2535 file=$func_resolve_sysroot_result
2537 # Check to see that this really is a libtool archive.
2538 func_lalib_unsafe_p "$file" \
2539 || func_fatal_help "\`$lib' is not a valid libtool archive"
2541 # Read the libtool library.
2546 # Skip this library if it cannot be dlopened.
2547 if test -z "$dlname"; then
2548 # Warn if it was a shared library.
2549 test -n "$library_names" && \
2550 func_warning "\`$file' was not linked with \`-export-dynamic'"
2554 func_dirname "$file" "" "."
2555 dir="$func_dirname_result"
2557 if test -f "$dir/$objdir/$dlname"; then
2558 func_append dir "/$objdir"
2560 if test ! -f "$dir/$dlname"; then
2561 func_fatal_error "cannot find \`$dlname' in \`$dir' or \`$dir/$objdir'"
2567 # Just add the directory containing the .lo file.
2568 func_dirname "$file" "" "."
2569 dir="$func_dirname_result"
2573 func_warning "\`-dlopen' is ignored for non-libtool libraries and objects"
2578 # Get the absolute pathname.
2579 absdir=`cd "$dir" && pwd`
2580 test -n "$absdir" && dir="$absdir"
2582 # Now add the directory to shlibpath_var.
2583 if eval "test -z \"\$$shlibpath_var\""; then
2584 eval "$shlibpath_var=\"\$dir\""
2586 eval "$shlibpath_var=\"\$dir:\$$shlibpath_var\""
2590 # This variable tells wrapper scripts just to set shlibpath_var
2591 # rather than running their programs.
2592 libtool_execute_magic="$magic"
2594 # Check if any of the arguments is a wrapper script.
2599 -* | *.la | *.lo ) ;;
2601 # Do a test to see if this is really a libtool program.
2602 if func_ltwrapper_script_p "$file"; then
2604 # Transform arg to wrapped name.
2605 file="$progdir/$program"
2606 elif func_ltwrapper_executable_p "$file"; then
2607 func_ltwrapper_scriptname "$file"
2608 func_source "$func_ltwrapper_scriptname_result"
2609 # Transform arg to wrapped name.
2610 file="$progdir/$program"
2614 # Quote arguments (to preserve shell metacharacters).
2615 func_append_quoted args "$file"
2618 if test "X$opt_dry_run" = Xfalse; then
2619 if test -n "$shlibpath_var"; then
2620 # Export the shlibpath_var.
2621 eval "export $shlibpath_var"
2624 # Restore saved environment variables
2625 for lt_var in LANG LANGUAGE LC_ALL LC_CTYPE LC_COLLATE LC_MESSAGES
2627 eval "if test \"\${save_$lt_var+set}\" = set; then
2628 $lt_var=\$save_$lt_var; export $lt_var
2634 # Now prepare to actually exec the command.
2635 exec_cmd="\$cmd$args"
2637 # Display what would be done.
2638 if test -n "$shlibpath_var"; then
2639 eval "\$ECHO \"\$shlibpath_var=\$$shlibpath_var\""
2640 echo "export $shlibpath_var"
2647 test "$opt_mode" = execute && func_mode_execute ${1+"$@"}
2650 # func_mode_finish arg...
2658 for opt in "$nonopt" ${1+"$@"}
2660 if test -d "$opt"; then
2661 func_append libdirs " $opt"
2663 elif test -f "$opt"; then
2664 if func_lalib_unsafe_p "$opt"; then
2665 func_append libs " $opt"
2667 func_warning "\`$opt' is not a valid libtool archive"
2671 func_fatal_error "invalid argument \`$opt'"
2675 if test -n "$libs"; then
2676 if test -n "$lt_sysroot"; then
2677 sysroot_regex=`$ECHO "$lt_sysroot" | $SED "$sed_make_literal_regex"`
2678 sysroot_cmd="s/\([ ']\)$sysroot_regex/\1/g;"
2683 # Remove sysroot references
2684 if $opt_dry_run; then
2685 for lib in $libs; do
2686 echo "removing references to $lt_sysroot and \`=' prefixes from $lib"
2689 tmpdir=`func_mktempdir`
2690 for lib in $libs; do
2691 sed -e "${sysroot_cmd} s/\([ ']-[LR]\)=/\1/g; s/\([ ']\)=/\1/g" $lib \
2693 mv -f $tmpdir/tmp-la $lib
2699 if test -n "$finish_cmds$finish_eval" && test -n "$libdirs"; then
2700 for libdir in $libdirs; do
2701 if test -n "$finish_cmds"; then
2702 # Do each command in the finish commands.
2703 func_execute_cmds "$finish_cmds" 'admincmds="$admincmds
2706 if test -n "$finish_eval"; then
2707 # Do the single finish_eval.
2708 eval cmds=\"$finish_eval\"
2709 $opt_dry_run || eval "$cmds" || func_append admincmds "
2715 # Exit here if they wanted silent mode.
2716 $opt_silent && exit $EXIT_SUCCESS
2718 if test -n "$finish_cmds$finish_eval" && test -n "$libdirs"; then
2719 echo "----------------------------------------------------------------------"
2720 echo "Libraries have been installed in:"
2721 for libdir in $libdirs; do
2725 echo "If you ever happen to want to link against installed libraries"
2726 echo "in a given directory, LIBDIR, you must either use libtool, and"
2727 echo "specify the full pathname of the library, or use the \`-LLIBDIR'"
2728 echo "flag during linking and do at least one of the following:"
2729 if test -n "$shlibpath_var"; then
2730 echo " - add LIBDIR to the \`$shlibpath_var' environment variable"
2731 echo " during execution"
2733 if test -n "$runpath_var"; then
2734 echo " - add LIBDIR to the \`$runpath_var' environment variable"
2735 echo " during linking"
2737 if test -n "$hardcode_libdir_flag_spec"; then
2739 eval flag=\"$hardcode_libdir_flag_spec\"
2741 $ECHO " - use the \`$flag' linker flag"
2743 if test -n "$admincmds"; then
2744 $ECHO " - have your system administrator run these commands:$admincmds"
2746 if test -f /etc/ld.so.conf; then
2747 echo " - have your system administrator add LIBDIR to \`/etc/ld.so.conf'"
2751 echo "See any operating system documentation about shared libraries for"
2753 solaris2.[6789]|solaris2.1[0-9])
2754 echo "more information, such as the ld(1), crle(1) and ld.so(8) manual"
2758 echo "more information, such as the ld(1) and ld.so(8) manual pages."
2761 echo "----------------------------------------------------------------------"
2766 test "$opt_mode" = finish && func_mode_finish ${1+"$@"}
2769 # func_mode_install arg...
2770 func_mode_install ()
2773 # There may be an optional sh(1) argument at the beginning of
2774 # install_prog (especially on Windows NT).
2775 if test "$nonopt" = "$SHELL" || test "$nonopt" = /bin/sh ||
2776 # Allow the use of GNU shtool's install command.
2777 case $nonopt in *shtool*) :;; *) false;; esac; then
2778 # Aesthetically quote it.
2779 func_quote_for_eval "$nonopt"
2780 install_prog="$func_quote_for_eval_result "
2788 # The real first argument should be the name of the installation program.
2789 # Aesthetically quote it.
2790 func_quote_for_eval "$arg"
2791 func_append install_prog "$func_quote_for_eval_result"
2792 install_shared_prog=$install_prog
2793 case " $install_prog " in
2794 *[\\\ /]cp\ *) install_cp=: ;;
2795 *) install_cp=false ;;
2798 # We need to accept at least all the BSD install flags.
2810 if test -n "$dest"; then
2811 func_append files " $dest"
2819 if $install_cp; then :; else
2833 # If the previous option needed an argument, then skip it.
2834 if test -n "$prev"; then
2835 if test "x$prev" = x-m && test -n "$install_override_mode"; then
2836 arg2=$install_override_mode
2847 # Aesthetically quote the argument.
2848 func_quote_for_eval "$arg"
2849 func_append install_prog " $func_quote_for_eval_result"
2850 if test -n "$arg2"; then
2851 func_quote_for_eval "$arg2"
2853 func_append install_shared_prog " $func_quote_for_eval_result"
2856 test -z "$install_prog" && \
2857 func_fatal_help "you must specify an install program"
2859 test -n "$prev" && \
2860 func_fatal_help "the \`$prev' option requires an argument"
2862 if test -n "$install_override_mode" && $no_mode; then
2863 if $install_cp; then :; else
2864 func_quote_for_eval "$install_override_mode"
2865 func_append install_shared_prog " -m $func_quote_for_eval_result"
2869 if test -z "$files"; then
2870 if test -z "$dest"; then
2871 func_fatal_help "no file or destination specified"
2873 func_fatal_help "you must specify a destination"
2877 # Strip any trailing slash from the destination.
2878 func_stripname '' '/' "$dest"
2879 dest=$func_stripname_result
2881 # Check to see that the destination is a directory.
2882 test -d "$dest" && isdir=yes
2883 if test "$isdir" = yes; then
2887 func_dirname_and_basename "$dest" "" "."
2888 destdir="$func_dirname_result"
2889 destname="$func_basename_result"
2891 # Not a directory, so check to see that there is only one file specified.
2892 set dummy $files; shift
2893 test "$#" -gt 1 && \
2894 func_fatal_help "\`$dest' is not a directory"
2897 [\\/]* | [A-Za-z]:[\\/]*) ;;
2899 for file in $files; do
2903 func_fatal_help "\`$destdir' must be an absolute directory name"
2910 # This variable tells wrapper scripts just to set variables rather
2911 # than running their programs.
2912 libtool_install_magic="$magic"
2917 for file in $files; do
2919 # Do each installation.
2922 # Do the static libraries later.
2923 func_append staticlibs " $file"
2927 func_resolve_sysroot "$file"
2928 file=$func_resolve_sysroot_result
2930 # Check to see that this really is a libtool archive.
2931 func_lalib_unsafe_p "$file" \
2932 || func_fatal_help "\`$file' is not a valid libtool archive"
2939 # Add the libdir to current_libdirs if it is the destination.
2940 if test "X$destdir" = "X$libdir"; then
2941 case "$current_libdirs " in
2943 *) func_append current_libdirs " $libdir" ;;
2946 # Note the libdir as a future libdir.
2947 case "$future_libdirs " in
2949 *) func_append future_libdirs " $libdir" ;;
2953 func_dirname "$file" "/" ""
2954 dir="$func_dirname_result"
2955 func_append dir "$objdir"
2957 if test -n "$relink_command"; then
2958 # Determine the prefix the user has applied to our future dir.
2959 inst_prefix_dir=`$ECHO "$destdir" | $SED -e "s%$libdir\$%%"`
2961 # Don't allow the user to place us outside of our expected
2962 # location b/c this prevents finding dependent libraries that
2963 # are installed to the same prefix.
2964 # At present, this check doesn't affect windows .dll's that
2965 # are installed into $libdir/../bin (currently, that works fine)
2966 # but it's something to keep an eye on.
2967 test "$inst_prefix_dir" = "$destdir" && \
2968 func_fatal_error "error: cannot install \`$file' to a directory not ending in $libdir"
2970 if test -n "$inst_prefix_dir"; then
2971 # Stick the inst_prefix_dir data into the link command.
2972 relink_command=`$ECHO "$relink_command" | $SED "s%@inst_prefix_dir@%-inst-prefix-dir $inst_prefix_dir%"`
2974 relink_command=`$ECHO "$relink_command" | $SED "s%@inst_prefix_dir@%%"`
2977 func_warning "relinking \`$file'"
2978 func_show_eval "$relink_command" \
2979 'func_fatal_error "error: relink \`$file'\'' with the above command before installing it"'
2982 # See the names of the shared library.
2983 set dummy $library_names; shift
2984 if test -n "$1"; then
2989 test -n "$relink_command" && srcname="$realname"T
2991 # Install the shared library and build the symlinks.
2992 func_show_eval "$install_shared_prog $dir/$srcname $destdir/$realname" \
2996 cygwin* | mingw* | pw32* | cegcc*)
3004 if test -n "$tstripme" && test -n "$striplib"; then
3005 func_show_eval "$striplib $destdir/$realname" 'exit $?'
3008 if test "$#" -gt 0; then
3009 # Delete the old symlinks, and create new ones.
3010 # Try `ln -sf' first, because the `ln' binary might depend on
3011 # the symlink we replace! Solaris /bin/ln does not understand -f,
3012 # so we also need to try rm && ln -s.
3015 test "$linkname" != "$realname" \
3016 && func_show_eval "(cd $destdir && { $LN_S -f $realname $linkname || { $RM $linkname && $LN_S $realname $linkname; }; })"
3020 # Do each command in the postinstall commands.
3021 lib="$destdir/$realname"
3022 func_execute_cmds "$postinstall_cmds" 'exit $?'
3025 # Install the pseudo-library for information purposes.
3026 func_basename "$file"
3027 name="$func_basename_result"
3028 instname="$dir/$name"i
3029 func_show_eval "$install_prog $instname $destdir/$name" 'exit $?'
3031 # Maybe install the static library, too.
3032 test -n "$old_library" && func_append staticlibs " $dir/$old_library"
3036 # Install (i.e. copy) a libtool object.
3038 # Figure out destination file name, if it wasn't already specified.
3039 if test -n "$destname"; then
3040 destfile="$destdir/$destname"
3042 func_basename "$file"
3043 destfile="$func_basename_result"
3044 destfile="$destdir/$destfile"
3047 # Deduce the name of the destination old-style object file.
3050 func_lo2o "$destfile"
3051 staticdest=$func_lo2o_result
3054 staticdest="$destfile"
3058 func_fatal_help "cannot copy a libtool object to \`$destfile'"
3062 # Install the libtool object if requested.
3063 test -n "$destfile" && \
3064 func_show_eval "$install_prog $file $destfile" 'exit $?'
3066 # Install the old object if enabled.
3067 if test "$build_old_libs" = yes; then
3068 # Deduce the name of the old-style object file.
3070 staticobj=$func_lo2o_result
3071 func_show_eval "$install_prog \$staticobj \$staticdest" 'exit $?'
3077 # Figure out destination file name, if it wasn't already specified.
3078 if test -n "$destname"; then
3079 destfile="$destdir/$destname"
3081 func_basename "$file"
3082 destfile="$func_basename_result"
3083 destfile="$destdir/$destfile"
3086 # If the file is missing, and there is a .exe on the end, strip it
3087 # because it is most likely a libtool script we actually want to
3092 if test ! -f "$file"; then
3093 func_stripname '' '.exe' "$file"
3094 file=$func_stripname_result
3100 # Do a test to see if this is really a libtool program.
3103 if func_ltwrapper_executable_p "$file"; then
3104 func_ltwrapper_scriptname "$file"
3105 wrapper=$func_ltwrapper_scriptname_result
3107 func_stripname '' '.exe' "$file"
3108 wrapper=$func_stripname_result
3115 if func_ltwrapper_script_p "$wrapper"; then
3119 func_source "$wrapper"
3121 # Check the variables that should have been set.
3122 test -z "$generated_by_libtool_version" && \
3123 func_fatal_error "invalid libtool wrapper script \`$wrapper'"
3126 for lib in $notinst_deplibs; do
3127 # Check to see that each library is installed.
3129 if test -f "$lib"; then
3132 libfile="$libdir/"`$ECHO "$lib" | $SED 's%^.*/%%g'` ### testsuite: skip nested quoting test
3133 if test -n "$libdir" && test ! -f "$libfile"; then
3134 func_warning "\`$lib' has not been installed in \`$libdir'"
3140 func_source "$wrapper"
3143 if test "$fast_install" = no && test -n "$relink_command"; then
3145 if test "$finalize" = yes; then
3146 tmpdir=`func_mktempdir`
3147 func_basename "$file$stripped_ext"
3148 file="$func_basename_result"
3149 outputname="$tmpdir/$file"
3150 # Replace the output file specification.
3151 relink_command=`$ECHO "$relink_command" | $SED 's%@OUTPUT@%'"$outputname"'%g'`
3154 func_quote_for_expand "$relink_command"
3155 eval "func_echo $func_quote_for_expand_result"
3157 if eval "$relink_command"; then :
3159 func_error "error: relink \`$file' with the above command before installing it"
3160 $opt_dry_run || ${RM}r "$tmpdir"
3165 func_warning "cannot relink \`$file'"
3169 # Install the binary that we compiled earlier.
3170 file=`$ECHO "$file$stripped_ext" | $SED "s%\([^/]*\)$%$objdir/\1%"`
3174 # remove .exe since cygwin /usr/bin/install will append another
3176 case $install_prog,$host in
3177 */usr/bin/install*,*cygwin*)
3178 case $file:$destfile in
3183 destfile=$destfile.exe
3186 func_stripname '' '.exe' "$destfile"
3187 destfile=$func_stripname_result
3192 func_show_eval "$install_prog\$stripme \$file \$destfile" 'exit $?'
3193 $opt_dry_run || if test -n "$outputname"; then
3200 for file in $staticlibs; do
3201 func_basename "$file"
3202 name="$func_basename_result"
3204 # Set up the ranlib parameters.
3205 oldlib="$destdir/$name"
3206 func_to_tool_file "$oldlib" func_convert_file_msys_to_w32
3207 tool_oldlib=$func_to_tool_file_result
3209 func_show_eval "$install_prog \$file \$oldlib" 'exit $?'
3211 if test -n "$stripme" && test -n "$old_striplib"; then
3212 func_show_eval "$old_striplib $tool_oldlib" 'exit $?'
3215 # Do each command in the postinstall commands.
3216 func_execute_cmds "$old_postinstall_cmds" 'exit $?'
3219 test -n "$future_libdirs" && \
3220 func_warning "remember to run \`$progname --finish$future_libdirs'"
3222 if test -n "$current_libdirs"; then
3223 # Maybe just do a dry run.
3224 $opt_dry_run && current_libdirs=" -n$current_libdirs"
3225 exec_cmd='$SHELL $progpath $preserve_args --finish$current_libdirs'
3231 test "$opt_mode" = install && func_mode_install ${1+"$@"}
3234 # func_generate_dlsyms outputname originator pic_p
3235 # Extract symbols from dlprefiles and create ${outputname}S.o with
3236 # a dlpreopen symbol table.
3237 func_generate_dlsyms ()
3243 my_prefix=`$ECHO "$my_originator" | sed 's%[^a-zA-Z0-9]%_%g'`
3246 if test -n "$dlfiles$dlprefiles" || test "$dlself" != no; then
3247 if test -n "$NM" && test -n "$global_symbol_pipe"; then
3248 my_dlsyms="${my_outputname}S.c"
3250 func_error "not configured to extract global symbols from dlpreopened files"
3254 if test -n "$my_dlsyms"; then
3258 # Discover the nlist of each of the dlfiles.
3259 nlist="$output_objdir/${my_outputname}.nm"
3261 func_show_eval "$RM $nlist ${nlist}S ${nlist}T"
3263 # Parse the name list into a source file.
3264 func_verbose "creating $output_objdir/$my_dlsyms"
3266 $opt_dry_run || $ECHO > "$output_objdir/$my_dlsyms" "\
3267 /* $my_dlsyms - symbol resolution table for \`$my_outputname' dlsym emulation. */
3268 /* Generated by $PROGRAM (GNU $PACKAGE$TIMESTAMP) $VERSION */
3274 #if defined(__GNUC__) && (((__GNUC__ == 4) && (__GNUC_MINOR__ >= 4)) || (__GNUC__ > 4))
3275 #pragma GCC diagnostic ignored \"-Wstrict-prototypes\"
3278 /* Keep this code in sync between libtool.m4, ltmain, lt_system.h, and tests. */
3279 #if defined(_WIN32) || defined(__CYGWIN__) || defined(_WIN32_WCE)
3280 /* DATA imports from DLLs on WIN32 con't be const, because runtime
3281 relocations are performed -- see ld's documentation on pseudo-relocs. */
3282 # define LT_DLSYM_CONST
3283 #elif defined(__osf__)
3284 /* This system does not cope well with relocations in const data. */
3285 # define LT_DLSYM_CONST
3287 # define LT_DLSYM_CONST const
3290 /* External symbol declarations for the compiler. */\
3293 if test "$dlself" = yes; then
3294 func_verbose "generating symbol list for \`$output'"
3296 $opt_dry_run || echo ': @PROGRAM@ ' > "$nlist"
3298 # Add our own program objects to the symbol list.
3299 progfiles=`$ECHO "$objs$old_deplibs" | $SP2NL | $SED "$lo2o" | $NL2SP`
3300 for progfile in $progfiles; do
3301 func_to_tool_file "$progfile" func_convert_file_msys_to_w32
3302 func_verbose "extracting global C symbols from \`$func_to_tool_file_result'"
3303 $opt_dry_run || eval "$NM $func_to_tool_file_result | $global_symbol_pipe >> '$nlist'"
3306 if test -n "$exclude_expsyms"; then
3308 eval '$EGREP -v " ($exclude_expsyms)$" "$nlist" > "$nlist"T'
3309 eval '$MV "$nlist"T "$nlist"'
3313 if test -n "$export_symbols_regex"; then
3315 eval '$EGREP -e "$export_symbols_regex" "$nlist" > "$nlist"T'
3316 eval '$MV "$nlist"T "$nlist"'
3320 # Prepare the list of exported symbols
3321 if test -z "$export_symbols"; then
3322 export_symbols="$output_objdir/$outputname.exp"
3325 eval "${SED} -n -e '/^: @PROGRAM@ $/d' -e 's/^.* \(.*\)$/\1/p' "'< "$nlist" > "$export_symbols"'
3327 *cygwin* | *mingw* | *cegcc* )
3328 eval "echo EXPORTS "'> "$output_objdir/$outputname.def"'
3329 eval 'cat "$export_symbols" >> "$output_objdir/$outputname.def"'
3335 eval "${SED} -e 's/\([].[*^$]\)/\\\\\1/g' -e 's/^/ /' -e 's/$/$/'"' < "$export_symbols" > "$output_objdir/$outputname.exp"'
3336 eval '$GREP -f "$output_objdir/$outputname.exp" < "$nlist" > "$nlist"T'
3337 eval '$MV "$nlist"T "$nlist"'
3339 *cygwin* | *mingw* | *cegcc* )
3340 eval "echo EXPORTS "'> "$output_objdir/$outputname.def"'
3341 eval 'cat "$nlist" >> "$output_objdir/$outputname.def"'
3348 for dlprefile in $dlprefiles; do
3349 func_verbose "extracting global C symbols from \`$dlprefile'"
3350 func_basename "$dlprefile"
3351 name="$func_basename_result"
3353 *cygwin* | *mingw* | *cegcc* )
3354 # if an import library, we need to obtain dlname
3355 if func_win32_import_lib_p "$dlprefile"; then
3356 func_tr_sh "$dlprefile"
3357 eval "curr_lafile=\$libfile_$func_tr_sh_result"
3358 dlprefile_dlbasename=""
3359 if test -n "$curr_lafile" && func_lalib_p "$curr_lafile"; then
3360 # Use subshell, to avoid clobbering current variable values
3361 dlprefile_dlname=`source "$curr_lafile" && echo "$dlname"`
3362 if test -n "$dlprefile_dlname" ; then
3363 func_basename "$dlprefile_dlname"
3364 dlprefile_dlbasename="$func_basename_result"
3366 # no lafile. user explicitly requested -dlpreopen <import library>.
3367 $sharedlib_from_linklib_cmd "$dlprefile"
3368 dlprefile_dlbasename=$sharedlib_from_linklib_result
3372 if test -n "$dlprefile_dlbasename" ; then
3373 eval '$ECHO ": $dlprefile_dlbasename" >> "$nlist"'
3375 func_warning "Could not compute DLL name from $name"
3376 eval '$ECHO ": $name " >> "$nlist"'
3378 func_to_tool_file "$dlprefile" func_convert_file_msys_to_w32
3379 eval "$NM \"$func_to_tool_file_result\" 2>/dev/null | $global_symbol_pipe |
3380 $SED -e '/I __imp/d' -e 's/I __nm_/D /;s/_nm__//' >> '$nlist'"
3382 else # not an import lib
3384 eval '$ECHO ": $name " >> "$nlist"'
3385 func_to_tool_file "$dlprefile" func_convert_file_msys_to_w32
3386 eval "$NM \"$func_to_tool_file_result\" 2>/dev/null | $global_symbol_pipe >> '$nlist'"
3392 eval '$ECHO ": $name " >> "$nlist"'
3393 func_to_tool_file "$dlprefile" func_convert_file_msys_to_w32
3394 eval "$NM \"$func_to_tool_file_result\" 2>/dev/null | $global_symbol_pipe >> '$nlist'"
3401 # Make sure we have at least an empty file.
3402 test -f "$nlist" || : > "$nlist"
3404 if test -n "$exclude_expsyms"; then
3405 $EGREP -v " ($exclude_expsyms)$" "$nlist" > "$nlist"T
3406 $MV "$nlist"T "$nlist"
3409 # Try sorting and uniquifying the output.
3410 if $GREP -v "^: " < "$nlist" |
3411 if sort -k 3 </dev/null >/dev/null 2>&1; then
3416 uniq > "$nlist"S; then
3419 $GREP -v "^: " < "$nlist" > "$nlist"S
3422 if test -f "$nlist"S; then
3423 eval "$global_symbol_to_cdecl"' < "$nlist"S >> "$output_objdir/$my_dlsyms"'
3425 echo '/* NONE */' >> "$output_objdir/$my_dlsyms"
3428 echo >> "$output_objdir/$my_dlsyms" "\
3430 /* The mapping between symbol names and symbols. */
3435 extern LT_DLSYM_CONST lt_dlsymlist
3436 lt_${my_prefix}_LTX_preloaded_symbols[];
3437 LT_DLSYM_CONST lt_dlsymlist
3438 lt_${my_prefix}_LTX_preloaded_symbols[] =
3440 { \"$my_originator\", (void *) 0 },"
3442 case $need_lib_prefix in
3444 eval "$global_symbol_to_c_name_address" < "$nlist" >> "$output_objdir/$my_dlsyms"
3447 eval "$global_symbol_to_c_name_address_lib_prefix" < "$nlist" >> "$output_objdir/$my_dlsyms"
3450 echo >> "$output_objdir/$my_dlsyms" "\
3454 /* This works around a problem in FreeBSD linker */
3455 #ifdef FREEBSD_WORKAROUND
3456 static const void *lt_preloaded_setup() {
3457 return lt_${my_prefix}_LTX_preloaded_symbols;
3467 pic_flag_for_symtable=
3468 case "$compile_command " in
3472 # compiling the symbol table file with pic_flag works around
3473 # a FreeBSD bug that causes programs to crash when -lm is
3474 # linked before any other PIC object. But we must not use
3475 # pic_flag when linking with -static. The problem exists in
3476 # FreeBSD 2.2.6 and is fixed in FreeBSD 3.1.
3477 *-*-freebsd2.*|*-*-freebsd3.0*|*-*-freebsdelf3.0*)
3478 pic_flag_for_symtable=" $pic_flag -DFREEBSD_WORKAROUND" ;;
3480 pic_flag_for_symtable=" $pic_flag" ;;
3482 if test "X$my_pic_p" != Xno; then
3483 pic_flag_for_symtable=" $pic_flag"
3490 for arg in $LTCFLAGS; do
3492 -pie | -fpie | -fPIE) ;;
3493 *) func_append symtab_cflags " $arg" ;;
3497 # Now compile the dynamic symbol file.
3498 func_show_eval '(cd $output_objdir && $LTCC$symtab_cflags -c$no_builtin_flag$pic_flag_for_symtable "$my_dlsyms")' 'exit $?'
3500 # Clean up the generated files.
3501 func_show_eval '$RM "$output_objdir/$my_dlsyms" "$nlist" "${nlist}S" "${nlist}T"'
3503 # Transform the symbol file into the correct name.
3504 symfileobj="$output_objdir/${my_outputname}S.$objext"
3506 *cygwin* | *mingw* | *cegcc* )
3507 if test -f "$output_objdir/$my_outputname.def"; then
3508 compile_command=`$ECHO "$compile_command" | $SED "s%@SYMFILE@%$output_objdir/$my_outputname.def $symfileobj%"`
3509 finalize_command=`$ECHO "$finalize_command" | $SED "s%@SYMFILE@%$output_objdir/$my_outputname.def $symfileobj%"`
3511 compile_command=`$ECHO "$compile_command" | $SED "s%@SYMFILE@%$symfileobj%"`
3512 finalize_command=`$ECHO "$finalize_command" | $SED "s%@SYMFILE@%$symfileobj%"`
3516 compile_command=`$ECHO "$compile_command" | $SED "s%@SYMFILE@%$symfileobj%"`
3517 finalize_command=`$ECHO "$finalize_command" | $SED "s%@SYMFILE@%$symfileobj%"`
3522 func_fatal_error "unknown suffix for \`$my_dlsyms'"
3526 # We keep going just in case the user didn't refer to
3527 # lt_preloaded_symbols. The linker will fail if global_symbol_pipe
3528 # really was required.
3530 # Nullify the symbol file.
3531 compile_command=`$ECHO "$compile_command" | $SED "s% @SYMFILE@%%"`
3532 finalize_command=`$ECHO "$finalize_command" | $SED "s% @SYMFILE@%%"`
3536 # func_win32_libid arg
3537 # return the library type of file 'arg'
3539 # Need a lot of goo to handle *both* DLLs and import libs
3540 # Has to be a shell function in order to 'eat' the argument
3541 # that is supplied when $file_magic_command is called.
3542 # Despite the name, also deal with 64 bit binaries.
3546 win32_libid_type="unknown"
3547 win32_fileres=`file -L $1 2>/dev/null`
3548 case $win32_fileres in
3549 *ar\ archive\ import\ library*) # definitely import
3550 win32_libid_type="x86 archive import"
3552 *ar\ archive*) # could be an import, or static
3553 # Keep the egrep pattern in sync with the one in _LT_CHECK_MAGIC_METHOD.
3554 if eval $OBJDUMP -f $1 | $SED -e '10q' 2>/dev/null |
3555 $EGREP 'file format (pei*-i386(.*architecture: i386)?|pe-arm-wince|pe-x86-64)' >/dev/null; then
3556 func_to_tool_file "$1" func_convert_file_msys_to_w32
3557 win32_nmres=`eval $NM -f posix -A \"$func_to_tool_file_result\" |
3566 case $win32_nmres in
3567 import*) win32_libid_type="x86 archive import";;
3568 *) win32_libid_type="x86 archive static";;
3573 win32_libid_type="x86 DLL"
3575 *executable*) # but shell scripts are "executable" too...
3576 case $win32_fileres in
3577 *MS\ Windows\ PE\ Intel*)
3578 win32_libid_type="x86 DLL"
3583 $ECHO "$win32_libid_type"
3586 # func_cygming_dll_for_implib ARG
3588 # Platform-specific function to extract the
3589 # name of the DLL associated with the specified
3590 # import library ARG.
3591 # Invoked by eval'ing the libtool variable
3592 # $sharedlib_from_linklib_cmd
3593 # Result is available in the variable
3594 # $sharedlib_from_linklib_result
3595 func_cygming_dll_for_implib ()
3598 sharedlib_from_linklib_result=`$DLLTOOL --identify-strict --identify "$1"`
3601 # func_cygming_dll_for_implib_fallback_core SECTION_NAME LIBNAMEs
3603 # The is the core of a fallback implementation of a
3604 # platform-specific function to extract the name of the
3605 # DLL associated with the specified import library LIBNAME.
3607 # SECTION_NAME is either .idata$6 or .idata$7, depending
3608 # on the platform and compiler that created the implib.
3610 # Echos the name of the DLL associated with the
3611 # specified import library.
3612 func_cygming_dll_for_implib_fallback_core ()
3615 match_literal=`$ECHO "$1" | $SED "$sed_make_literal_regex"`
3616 $OBJDUMP -s --section "$1" "$2" 2>/dev/null |
3617 $SED '/^Contents of section '"$match_literal"':/{
3618 # Place marker at beginning of archive member dllname section
3623 # These lines can sometimes be longer than 43 characters, but
3624 # are always uninteresting
3625 /:[ ]*file format pe[i]\{,1\}-/d
3626 /^In archive [^:]*:/d
3627 # Ensure marker is printed
3629 # Remove all lines with less than 43 characters
3631 # From remaining lines, remove first 43 characters
3634 # Join marker and all lines until next marker into a single line
3635 /^====MARK====/ b para
3644 # Remove trailing dots and whitespace
3648 # we now have a list, one entry per line, of the stringified
3649 # contents of the appropriate section of all members of the
3650 # archive which possess that section. Heuristic: eliminate
3651 # all those which have a first or second character that is
3652 # a '.' (that is, objdump's representation of an unprintable
3653 # character.) This should work for all archives with less than
3654 # 0x302f exports -- but will fail for DLLs whose name actually
3655 # begins with a literal '.' or a single character followed by
3658 # Of those that remain, print the first one.
3659 $SED -e '/^\./d;/^.\./d;q'
3662 # func_cygming_gnu_implib_p ARG
3663 # This predicate returns with zero status (TRUE) if
3664 # ARG is a GNU/binutils-style import library. Returns
3665 # with nonzero status (FALSE) otherwise.
3666 func_cygming_gnu_implib_p ()
3669 func_to_tool_file "$1" func_convert_file_msys_to_w32
3670 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)$'`
3671 test -n "$func_cygming_gnu_implib_tmp"
3674 # func_cygming_ms_implib_p ARG
3675 # This predicate returns with zero status (TRUE) if
3676 # ARG is an MS-style import library. Returns
3677 # with nonzero status (FALSE) otherwise.
3678 func_cygming_ms_implib_p ()
3681 func_to_tool_file "$1" func_convert_file_msys_to_w32
3682 func_cygming_ms_implib_tmp=`$NM "$func_to_tool_file_result" | eval "$global_symbol_pipe" | $GREP '_NULL_IMPORT_DESCRIPTOR'`
3683 test -n "$func_cygming_ms_implib_tmp"
3686 # func_cygming_dll_for_implib_fallback ARG
3687 # Platform-specific function to extract the
3688 # name of the DLL associated with the specified
3689 # import library ARG.
3691 # This fallback implementation is for use when $DLLTOOL
3692 # does not support the --identify-strict option.
3693 # Invoked by eval'ing the libtool variable
3694 # $sharedlib_from_linklib_cmd
3695 # Result is available in the variable
3696 # $sharedlib_from_linklib_result
3697 func_cygming_dll_for_implib_fallback ()
3700 if func_cygming_gnu_implib_p "$1" ; then
3701 # binutils import library
3702 sharedlib_from_linklib_result=`func_cygming_dll_for_implib_fallback_core '.idata$7' "$1"`
3703 elif func_cygming_ms_implib_p "$1" ; then
3704 # ms-generated import library
3705 sharedlib_from_linklib_result=`func_cygming_dll_for_implib_fallback_core '.idata$6' "$1"`
3708 sharedlib_from_linklib_result=""
3713 # func_extract_an_archive dir oldlib
3714 func_extract_an_archive ()
3717 f_ex_an_ar_dir="$1"; shift
3718 f_ex_an_ar_oldlib="$1"
3719 if test "$lock_old_archive_extraction" = yes; then
3720 lockfile=$f_ex_an_ar_oldlib.lock
3721 until $opt_dry_run || ln "$progpath" "$lockfile" 2>/dev/null; do
3722 func_echo "Waiting for $lockfile to be removed"
3726 func_show_eval "(cd \$f_ex_an_ar_dir && $AR x \"\$f_ex_an_ar_oldlib\")" \
3727 'stat=$?; rm -f "$lockfile"; exit $stat'
3728 if test "$lock_old_archive_extraction" = yes; then
3729 $opt_dry_run || rm -f "$lockfile"
3731 if ($AR t "$f_ex_an_ar_oldlib" | sort | sort -uc >/dev/null 2>&1); then
3734 func_fatal_error "object name conflicts in archive: $f_ex_an_ar_dir/$f_ex_an_ar_oldlib"
3739 # func_extract_archives gentop oldlib ...
3740 func_extract_archives ()
3743 my_gentop="$1"; shift
3744 my_oldlibs=${1+"$@"}
3750 for my_xlib in $my_oldlibs; do
3751 # Extract the objects.
3753 [\\/]* | [A-Za-z]:[\\/]*) my_xabs="$my_xlib" ;;
3754 *) my_xabs=`pwd`"/$my_xlib" ;;
3756 func_basename "$my_xlib"
3757 my_xlib="$func_basename_result"
3760 case " $extracted_archives " in
3762 func_arith $extracted_serial + 1
3763 extracted_serial=$func_arith_result
3764 my_xlib_u=lt$extracted_serial-$my_xlib ;;
3768 extracted_archives="$extracted_archives $my_xlib_u"
3769 my_xdir="$my_gentop/$my_xlib_u"
3771 func_mkdir_p "$my_xdir"
3775 func_verbose "Extracting $my_xabs"
3776 # Do not bother doing anything if just a dry run
3778 darwin_orig_dir=`pwd`
3779 cd $my_xdir || exit $?
3780 darwin_archive=$my_xabs
3782 darwin_base_archive=`basename "$darwin_archive"`
3783 darwin_arches=`$LIPO -info "$darwin_archive" 2>/dev/null | $GREP Architectures 2>/dev/null || true`
3784 if test -n "$darwin_arches"; then
3785 darwin_arches=`$ECHO "$darwin_arches" | $SED -e 's/.*are://'`
3787 func_verbose "$darwin_base_archive has multiple architectures $darwin_arches"
3788 for darwin_arch in $darwin_arches ; do
3789 func_mkdir_p "unfat-$$/${darwin_base_archive}-${darwin_arch}"
3790 $LIPO -thin $darwin_arch -output "unfat-$$/${darwin_base_archive}-${darwin_arch}/${darwin_base_archive}" "${darwin_archive}"
3791 cd "unfat-$$/${darwin_base_archive}-${darwin_arch}"
3792 func_extract_an_archive "`pwd`" "${darwin_base_archive}"
3794 $RM "unfat-$$/${darwin_base_archive}-${darwin_arch}/${darwin_base_archive}"
3795 done # $darwin_arches
3796 ## Okay now we've a bunch of thin objects, gotta fatten them up :)
3797 darwin_filelist=`find unfat-$$ -type f -name \*.o -print -o -name \*.lo -print | $SED -e "$basename" | sort -u`
3800 for darwin_file in $darwin_filelist; do
3801 darwin_files=`find unfat-$$ -name $darwin_file -print | sort | $NL2SP`
3802 $LIPO -create -output "$darwin_file" $darwin_files
3803 done # $darwin_filelist
3805 cd "$darwin_orig_dir"
3808 func_extract_an_archive "$my_xdir" "$my_xabs"
3813 func_extract_an_archive "$my_xdir" "$my_xabs"
3816 my_oldobjs="$my_oldobjs "`find $my_xdir -name \*.$objext -print -o -name \*.lo -print | sort | $NL2SP`
3819 func_extract_archives_result="$my_oldobjs"
3823 # func_emit_wrapper [arg=no]
3825 # Emit a libtool wrapper script on stdout.
3826 # Don't directly open a file because we may want to
3827 # incorporate the script contents within a cygwin/mingw
3828 # wrapper executable. Must ONLY be called from within
3829 # func_mode_link because it depends on a number of variables
3832 # ARG is the value that the WRAPPER_SCRIPT_BELONGS_IN_OBJDIR
3833 # variable will take. If 'yes', then the emitted script
3834 # will assume that the directory in which it is stored is
3835 # the $objdir directory. This is a cygwin/mingw-specific
3837 func_emit_wrapper ()
3839 func_emit_wrapper_arg1=${1-no}
3844 # $output - temporary wrapper script for $objdir/$outputname
3845 # Generated by $PROGRAM (GNU $PACKAGE$TIMESTAMP) $VERSION
3847 # The $output program cannot be directly executed until all the libtool
3848 # libraries that it depends on are installed.
3850 # This wrapper script should never be moved out of the build directory.
3851 # If it is, it will not operate correctly.
3853 # Sed substitution that helps us do robust quoting. It backslashifies
3854 # metacharacters that are still active within double-quoted strings.
3855 sed_quote_subst='$sed_quote_subst'
3857 # Be Bourne compatible
3858 if test -n \"\${ZSH_VERSION+set}\" && (emulate sh) >/dev/null 2>&1; then
3861 # Zsh 3.x and 4.x performs word splitting on \${1+\"\$@\"}, which
3862 # is contrary to our usage. Disable this feature.
3863 alias -g '\${1+\"\$@\"}'='\"\$@\"'
3864 setopt NO_GLOB_SUBST
3866 case \`(set -o) 2>/dev/null\` in *posix*) set -o posix;; esac
3868 BIN_SH=xpg4; export BIN_SH # for Tru64
3869 DUALCASE=1; export DUALCASE # for MKS sh
3871 # The HP-UX ksh and POSIX shell print the target directory to stdout
3873 (unset CDPATH) >/dev/null 2>&1 && unset CDPATH
3875 relink_command=\"$relink_command\"
3877 # This environment variable determines our operation mode.
3878 if test \"\$libtool_install_magic\" = \"$magic\"; then
3879 # install mode needs the following variables:
3880 generated_by_libtool_version='$macro_version'
3881 notinst_deplibs='$notinst_deplibs'
3883 # When we are sourced in execute mode, \$file and \$ECHO are already set.
3884 if test \"\$libtool_execute_magic\" != \"$magic\"; then
3887 qECHO=`$ECHO "$ECHO" | $SED "$sed_quote_subst"`
3890 # A function that is used when there is no print builtin or printf.
3891 func_fallback_echo ()
3893 eval 'cat <<_LTECHO_EOF
3900 # Very basic option parsing. These options are (a) specific to
3901 # the libtool wrapper, (b) are identical between the wrapper
3902 # /script/ and the wrapper /executable/ which is used only on
3903 # windows platforms, and (c) all begin with the string "--lt-"
3904 # (application programs are unlikely to have options which match
3907 # There are only two supported options: --lt-debug and
3908 # --lt-dump-script. There is, deliberately, no --lt-help.
3910 # The first argument to this parsing function should be the
3911 # script's $0 value, followed by "$@".
3913 func_parse_lt_options ()
3919 case \"\$lt_opt\" in
3920 --lt-debug) lt_option_debug=1 ;;
3922 lt_dump_D=\`\$ECHO \"X\$lt_script_arg0\" | $SED -e 's/^X//' -e 's%/[^/]*$%%'\`
3923 test \"X\$lt_dump_D\" = \"X\$lt_script_arg0\" && lt_dump_D=.
3924 lt_dump_F=\`\$ECHO \"X\$lt_script_arg0\" | $SED -e 's/^X//' -e 's%^.*/%%'\`
3925 cat \"\$lt_dump_D/\$lt_dump_F\"
3929 \$ECHO \"Unrecognized --lt- option: '\$lt_opt'\" 1>&2
3935 # Print the debug banner immediately:
3936 if test -n \"\$lt_option_debug\"; then
3937 echo \"${outputname}:${output}:\${LINENO}: libtool wrapper (GNU $PACKAGE$TIMESTAMP) $VERSION\" 1>&2
3941 # Used when --lt-debug. Prints its arguments to stdout
3942 # (redirection is the responsibility of the caller)
3943 func_lt_dump_args ()
3948 \$ECHO \"${outputname}:${output}:\${LINENO}: newargv[\$lt_dump_args_N]: \$lt_arg\"
3949 lt_dump_args_N=\`expr \$lt_dump_args_N + 1\`
3953 # Core function for launching the target application
3954 func_exec_program_core ()
3958 # Backslashes separate directories on plain windows
3959 *-*-mingw | *-*-os2* | *-cegcc*)
3961 if test -n \"\$lt_option_debug\"; then
3962 \$ECHO \"${outputname}:${output}:\${LINENO}: newargv[0]: \$progdir\\\\\$program\" 1>&2
3963 func_lt_dump_args \${1+\"\$@\"} 1>&2
3965 exec \"\$progdir\\\\\$program\" \${1+\"\$@\"}
3971 if test -n \"\$lt_option_debug\"; then
3972 \$ECHO \"${outputname}:${output}:\${LINENO}: newargv[0]: \$progdir/\$program\" 1>&2
3973 func_lt_dump_args \${1+\"\$@\"} 1>&2
3975 exec \"\$progdir/\$program\" \${1+\"\$@\"}
3980 \$ECHO \"\$0: cannot exec \$program \$*\" 1>&2
3984 # A function to encapsulate launching the target application
3985 # Strips options in the --lt-* namespace from \$@ and
3986 # launches target application with the remaining arguments.
3987 func_exec_program ()
3995 *) set x \"\$@\" \"\$lt_wr_arg\"; shift;;
4000 func_exec_program_core \${1+\"\$@\"}
4004 func_parse_lt_options \"\$0\" \${1+\"\$@\"}
4006 # Find the directory that this script lives in.
4007 thisdir=\`\$ECHO \"\$file\" | $SED 's%/[^/]*$%%'\`
4008 test \"x\$thisdir\" = \"x\$file\" && thisdir=.
4010 # Follow symbolic links until we get to the real thisdir.
4011 file=\`ls -ld \"\$file\" | $SED -n 's/.*-> //p'\`
4012 while test -n \"\$file\"; do
4013 destdir=\`\$ECHO \"\$file\" | $SED 's%/[^/]*\$%%'\`
4015 # If there was a directory component, then change thisdir.
4016 if test \"x\$destdir\" != \"x\$file\"; then
4017 case \"\$destdir\" in
4018 [\\\\/]* | [A-Za-z]:[\\\\/]*) thisdir=\"\$destdir\" ;;
4019 *) thisdir=\"\$thisdir/\$destdir\" ;;
4023 file=\`\$ECHO \"\$file\" | $SED 's%^.*/%%'\`
4024 file=\`ls -ld \"\$thisdir/\$file\" | $SED -n 's/.*-> //p'\`
4027 # Usually 'no', except on cygwin/mingw when embedded into
4029 WRAPPER_SCRIPT_BELONGS_IN_OBJDIR=$func_emit_wrapper_arg1
4030 if test \"\$WRAPPER_SCRIPT_BELONGS_IN_OBJDIR\" = \"yes\"; then
4031 # special case for '.'
4032 if test \"\$thisdir\" = \".\"; then
4035 # remove .libs from thisdir
4036 case \"\$thisdir\" in
4037 *[\\\\/]$objdir ) thisdir=\`\$ECHO \"\$thisdir\" | $SED 's%[\\\\/][^\\\\/]*$%%'\` ;;
4038 $objdir ) thisdir=. ;;
4042 # Try to get the absolute directory name.
4043 absdir=\`cd \"\$thisdir\" && pwd\`
4044 test -n \"\$absdir\" && thisdir=\"\$absdir\"
4047 if test "$fast_install" = yes; then
4049 program=lt-'$outputname'$exeext
4050 progdir=\"\$thisdir/$objdir\"
4052 if test ! -f \"\$progdir/\$program\" ||
4053 { file=\`ls -1dt \"\$progdir/\$program\" \"\$progdir/../\$program\" 2>/dev/null | ${SED} 1q\`; \\
4054 test \"X\$file\" != \"X\$progdir/\$program\"; }; then
4056 file=\"\$\$-\$program\"
4058 if test ! -d \"\$progdir\"; then
4059 $MKDIR \"\$progdir\"
4061 $RM \"\$progdir/\$file\"
4066 # relink executable if necessary
4067 if test -n \"\$relink_command\"; then
4068 if relink_command_output=\`eval \$relink_command 2>&1\`; then :
4070 $ECHO \"\$relink_command_output\" >&2
4071 $RM \"\$progdir/\$file\"
4076 $MV \"\$progdir/\$file\" \"\$progdir/\$program\" 2>/dev/null ||
4077 { $RM \"\$progdir/\$program\";
4078 $MV \"\$progdir/\$file\" \"\$progdir/\$program\"; }
4079 $RM \"\$progdir/\$file\"
4083 program='$outputname'
4084 progdir=\"\$thisdir/$objdir\"
4090 if test -f \"\$progdir/\$program\"; then"
4092 # fixup the dll searchpath if we need to.
4094 # Fix the DLL searchpath if we need to. Do this before prepending
4095 # to shlibpath, because on Windows, both are PATH and uninstalled
4096 # libraries must come first.
4097 if test -n "$dllsearchpath"; then
4099 # Add the dll search path components to the executable PATH
4100 PATH=$dllsearchpath:\$PATH
4104 # Export our shlibpath_var if we have one.
4105 if test "$shlibpath_overrides_runpath" = yes && test -n "$shlibpath_var" && test -n "$temp_rpath"; then
4107 # Add our own library path to $shlibpath_var
4108 $shlibpath_var=\"$temp_rpath\$$shlibpath_var\"
4110 # Some systems cannot cope with colon-terminated $shlibpath_var
4111 # The second colon is a workaround for a bug in BeOS R4 sed
4112 $shlibpath_var=\`\$ECHO \"\$$shlibpath_var\" | $SED 's/::*\$//'\`
4114 export $shlibpath_var
4119 if test \"\$libtool_execute_magic\" != \"$magic\"; then
4120 # Run the actual program with our arguments.
4121 func_exec_program \${1+\"\$@\"}
4124 # The program doesn't exist.
4125 \$ECHO \"\$0: error: \\\`\$progdir/\$program' does not exist\" 1>&2
4126 \$ECHO \"This script is just a wrapper for \$program.\" 1>&2
4127 \$ECHO \"See the $PACKAGE documentation for more information.\" 1>&2
4135 # func_emit_cwrapperexe_src
4136 # emit the source code for a wrapper executable on stdout
4137 # Must ONLY be called from within func_mode_link because
4138 # it depends on a number of variable set therein.
4139 func_emit_cwrapperexe_src ()
4143 /* $cwrappersource - temporary wrapper executable for $objdir/$outputname
4144 Generated by $PROGRAM (GNU $PACKAGE$TIMESTAMP) $VERSION
4146 The $output program cannot be directly executed until all the libtool
4147 libraries that it depends on are installed.
4149 This wrapper executable should never be moved out of the build directory.
4150 If it is, it will not operate correctly.
4155 # define _CRT_SECURE_NO_DEPRECATE 1
4160 # include <direct.h>
4161 # include <process.h>
4164 # include <unistd.h>
4165 # include <stdint.h>
4177 #include <sys/stat.h>
4179 /* declarations of non-ANSI functions */
4180 #if defined(__MINGW32__)
4181 # ifdef __STRICT_ANSI__
4182 int _putenv (const char *);
4184 #elif defined(__CYGWIN__)
4185 # ifdef __STRICT_ANSI__
4186 char *realpath (const char *, char *);
4187 int putenv (char *);
4188 int setenv (const char *, const char *, int);
4190 /* #elif defined (other platforms) ... */
4193 /* portability defines, excluding path handling macros */
4194 #if defined(_MSC_VER)
4195 # define setmode _setmode
4197 # define chmod _chmod
4198 # define getcwd _getcwd
4199 # define putenv _putenv
4200 # define S_IXUSR _S_IEXEC
4201 # ifndef _INTPTR_T_DEFINED
4202 # define _INTPTR_T_DEFINED
4203 # define intptr_t int
4205 #elif defined(__MINGW32__)
4206 # define setmode _setmode
4208 # define chmod _chmod
4209 # define getcwd _getcwd
4210 # define putenv _putenv
4211 #elif defined(__CYGWIN__)
4212 # define HAVE_SETENV
4213 # define FOPEN_WB "wb"
4214 /* #elif defined (other platforms) ... */
4217 #if defined(PATH_MAX)
4218 # define LT_PATHMAX PATH_MAX
4219 #elif defined(MAXPATHLEN)
4220 # define LT_PATHMAX MAXPATHLEN
4222 # define LT_PATHMAX 1024
4232 /* path handling portability macros */
4233 #ifndef DIR_SEPARATOR
4234 # define DIR_SEPARATOR '/'
4235 # define PATH_SEPARATOR ':'
4238 #if defined (_WIN32) || defined (__MSDOS__) || defined (__DJGPP__) || \
4240 # define HAVE_DOS_BASED_FILE_SYSTEM
4241 # define FOPEN_WB "wb"
4242 # ifndef DIR_SEPARATOR_2
4243 # define DIR_SEPARATOR_2 '\\'
4245 # ifndef PATH_SEPARATOR_2
4246 # define PATH_SEPARATOR_2 ';'
4250 #ifndef DIR_SEPARATOR_2
4251 # define IS_DIR_SEPARATOR(ch) ((ch) == DIR_SEPARATOR)
4252 #else /* DIR_SEPARATOR_2 */
4253 # define IS_DIR_SEPARATOR(ch) \
4254 (((ch) == DIR_SEPARATOR) || ((ch) == DIR_SEPARATOR_2))
4255 #endif /* DIR_SEPARATOR_2 */
4257 #ifndef PATH_SEPARATOR_2
4258 # define IS_PATH_SEPARATOR(ch) ((ch) == PATH_SEPARATOR)
4259 #else /* PATH_SEPARATOR_2 */
4260 # define IS_PATH_SEPARATOR(ch) ((ch) == PATH_SEPARATOR_2)
4261 #endif /* PATH_SEPARATOR_2 */
4264 # define FOPEN_WB "w"
4267 # define _O_BINARY 0
4270 #define XMALLOC(type, num) ((type *) xmalloc ((num) * sizeof(type)))
4271 #define XFREE(stale) do { \
4272 if (stale) { free ((void *) stale); stale = 0; } \
4275 #if defined(LT_DEBUGWRAPPER)
4276 static int lt_debug = 1;
4278 static int lt_debug = 0;
4281 const char *program_name = "libtool-wrapper"; /* in case xstrdup fails */
4283 void *xmalloc (size_t num);
4284 char *xstrdup (const char *string);
4285 const char *base_name (const char *name);
4286 char *find_executable (const char *wrapper);
4287 char *chase_symlinks (const char *pathspec);
4288 int make_executable (const char *path);
4289 int check_executable (const char *path);
4290 char *strendzap (char *str, const char *pat);
4291 void lt_debugprintf (const char *file, int line, const char *fmt, ...);
4292 void lt_fatal (const char *file, int line, const char *message, ...);
4293 static const char *nonnull (const char *s);
4294 static const char *nonempty (const char *s);
4295 void lt_setenv (const char *name, const char *value);
4296 char *lt_extend_str (const char *orig_value, const char *add, int to_end);
4297 void lt_update_exe_path (const char *name, const char *value);
4298 void lt_update_lib_path (const char *name, const char *value);
4299 char **prepare_spawn (char **argv);
4300 void lt_dump_script (FILE *f);
4304 volatile const char * MAGIC_EXE = "$magic_exe";
4305 const char * LIB_PATH_VARNAME = "$shlibpath_var";
4308 if test "$shlibpath_overrides_runpath" = yes && test -n "$shlibpath_var" && test -n "$temp_rpath"; then
4309 func_to_host_path "$temp_rpath"
4311 const char * LIB_PATH_VALUE = "$func_to_host_path_result";
4315 const char * LIB_PATH_VALUE = "";
4319 if test -n "$dllsearchpath"; then
4320 func_to_host_path "$dllsearchpath:"
4322 const char * EXE_PATH_VARNAME = "PATH";
4323 const char * EXE_PATH_VALUE = "$func_to_host_path_result";
4327 const char * EXE_PATH_VARNAME = "";
4328 const char * EXE_PATH_VALUE = "";
4332 if test "$fast_install" = yes; then
4334 const char * TARGET_PROGRAM_NAME = "lt-$outputname"; /* hopefully, no .exe */
4338 const char * TARGET_PROGRAM_NAME = "$outputname"; /* hopefully, no .exe */
4345 #define LTWRAPPER_OPTION_PREFIX "--lt-"
4347 static const char *ltwrapper_option_prefix = LTWRAPPER_OPTION_PREFIX;
4348 static const char *dumpscript_opt = LTWRAPPER_OPTION_PREFIX "dump-script";
4349 static const char *debug_opt = LTWRAPPER_OPTION_PREFIX "debug";
4352 main (int argc, char *argv[])
4357 char *actual_cwrapper_path;
4358 char *actual_cwrapper_name;
4361 intptr_t rval = 127;
4365 program_name = (char *) xstrdup (base_name (argv[0]));
4366 newargz = XMALLOC (char *, argc + 1);
4368 /* very simple arg parsing; don't want to rely on getopt
4369 * also, copy all non cwrapper options to newargz, except
4370 * argz[0], which is handled differently
4373 for (i = 1; i < argc; i++)
4375 if (strcmp (argv[i], dumpscript_opt) == 0)
4379 *mingw* | *cygwin* )
4380 # make stdout use "unix" line endings
4381 echo " setmode(1,_O_BINARY);"
4386 lt_dump_script (stdout);
4389 if (strcmp (argv[i], debug_opt) == 0)
4394 if (strcmp (argv[i], ltwrapper_option_prefix) == 0)
4396 /* however, if there is an option in the LTWRAPPER_OPTION_PREFIX
4397 namespace, but it is not one of the ones we know about and
4398 have already dealt with, above (inluding dump-script), then
4399 report an error. Otherwise, targets might begin to believe
4400 they are allowed to use options in the LTWRAPPER_OPTION_PREFIX
4401 namespace. The first time any user complains about this, we'll
4402 need to make LTWRAPPER_OPTION_PREFIX a configure-time option
4403 or a configure.ac-settable value.
4405 lt_fatal (__FILE__, __LINE__,
4406 "unrecognized %s option: '%s'",
4407 ltwrapper_option_prefix, argv[i]);
4410 newargz[++newargc] = xstrdup (argv[i]);
4412 newargz[++newargc] = NULL;
4416 /* The GNU banner must be the first non-error debug message */
4417 lt_debugprintf (__FILE__, __LINE__, "libtool wrapper (GNU $PACKAGE$TIMESTAMP) $VERSION\n");
4420 lt_debugprintf (__FILE__, __LINE__, "(main) argv[0]: %s\n", argv[0]);
4421 lt_debugprintf (__FILE__, __LINE__, "(main) program_name: %s\n", program_name);
4423 tmp_pathspec = find_executable (argv[0]);
4424 if (tmp_pathspec == NULL)
4425 lt_fatal (__FILE__, __LINE__, "couldn't find %s", argv[0]);
4426 lt_debugprintf (__FILE__, __LINE__,
4427 "(main) found exe (before symlink chase) at: %s\n",
4430 actual_cwrapper_path = chase_symlinks (tmp_pathspec);
4431 lt_debugprintf (__FILE__, __LINE__,
4432 "(main) found exe (after symlink chase) at: %s\n",
4433 actual_cwrapper_path);
4434 XFREE (tmp_pathspec);
4436 actual_cwrapper_name = xstrdup (base_name (actual_cwrapper_path));
4437 strendzap (actual_cwrapper_path, actual_cwrapper_name);
4439 /* wrapper name transforms */
4440 strendzap (actual_cwrapper_name, ".exe");
4441 tmp_pathspec = lt_extend_str (actual_cwrapper_name, ".exe", 1);
4442 XFREE (actual_cwrapper_name);
4443 actual_cwrapper_name = tmp_pathspec;
4446 /* target_name transforms -- use actual target program name; might have lt- prefix */
4447 target_name = xstrdup (base_name (TARGET_PROGRAM_NAME));
4448 strendzap (target_name, ".exe");
4449 tmp_pathspec = lt_extend_str (target_name, ".exe", 1);
4450 XFREE (target_name);
4451 target_name = tmp_pathspec;
4454 lt_debugprintf (__FILE__, __LINE__,
4455 "(main) libtool target name: %s\n",
4461 XMALLOC (char, (strlen (actual_cwrapper_path) +
4462 strlen ("$objdir") + 1 + strlen (actual_cwrapper_name) + 1));
4463 strcpy (newargz[0], actual_cwrapper_path);
4464 strcat (newargz[0], "$objdir");
4465 strcat (newargz[0], "/");
4469 /* stop here, and copy so we don't have to do this twice */
4470 tmp_pathspec = xstrdup (newargz[0]);
4472 /* do NOT want the lt- prefix here, so use actual_cwrapper_name */
4473 strcat (newargz[0], actual_cwrapper_name);
4475 /* DO want the lt- prefix here if it exists, so use target_name */
4476 lt_argv_zero = lt_extend_str (tmp_pathspec, target_name, 1);
4477 XFREE (tmp_pathspec);
4478 tmp_pathspec = NULL;
4486 while ((p = strchr (newargz[0], '\\')) != NULL)
4490 while ((p = strchr (lt_argv_zero, '\\')) != NULL)
4500 XFREE (target_name);
4501 XFREE (actual_cwrapper_path);
4502 XFREE (actual_cwrapper_name);
4504 lt_setenv ("BIN_SH", "xpg4"); /* for Tru64 */
4505 lt_setenv ("DUALCASE", "1"); /* for MSK sh */
4506 /* Update the DLL searchpath. EXE_PATH_VALUE ($dllsearchpath) must
4507 be prepended before (that is, appear after) LIB_PATH_VALUE ($temp_rpath)
4508 because on Windows, both *_VARNAMEs are PATH but uninstalled
4509 libraries must come first. */
4510 lt_update_exe_path (EXE_PATH_VARNAME, EXE_PATH_VALUE);
4511 lt_update_lib_path (LIB_PATH_VARNAME, LIB_PATH_VALUE);
4513 lt_debugprintf (__FILE__, __LINE__, "(main) lt_argv_zero: %s\n",
4514 nonnull (lt_argv_zero));
4515 for (i = 0; i < newargc; i++)
4517 lt_debugprintf (__FILE__, __LINE__, "(main) newargz[%d]: %s\n",
4518 i, nonnull (newargz[i]));
4526 /* execv doesn't actually work on mingw as expected on unix */
4527 newargz = prepare_spawn (newargz);
4528 rval = _spawnv (_P_WAIT, lt_argv_zero, (const char * const *) newargz);
4531 /* failed to start process */
4532 lt_debugprintf (__FILE__, __LINE__,
4533 "(main) failed to launch target \"%s\": %s\n",
4534 lt_argv_zero, nonnull (strerror (errno)));
4542 execv (lt_argv_zero, newargz);
4543 return rval; /* =127, but avoids unused variable warning */
4552 xmalloc (size_t num)
4554 void *p = (void *) malloc (num);
4556 lt_fatal (__FILE__, __LINE__, "memory exhausted");
4562 xstrdup (const char *string)
4564 return string ? strcpy ((char *) xmalloc (strlen (string) + 1),
4569 base_name (const char *name)
4573 #if defined (HAVE_DOS_BASED_FILE_SYSTEM)
4574 /* Skip over the disk name in MSDOS pathnames. */
4575 if (isalpha ((unsigned char) name[0]) && name[1] == ':')
4579 for (base = name; *name; name++)
4580 if (IS_DIR_SEPARATOR (*name))
4586 check_executable (const char *path)
4590 lt_debugprintf (__FILE__, __LINE__, "(check_executable): %s\n",
4592 if ((!path) || (!*path))
4595 if ((stat (path, &st) >= 0)
4596 && (st.st_mode & (S_IXUSR | S_IXGRP | S_IXOTH)))
4603 make_executable (const char *path)
4608 lt_debugprintf (__FILE__, __LINE__, "(make_executable): %s\n",
4610 if ((!path) || (!*path))
4613 if (stat (path, &st) >= 0)
4615 rval = chmod (path, st.st_mode | S_IXOTH | S_IXGRP | S_IXUSR);
4620 /* Searches for the full path of the wrapper. Returns
4621 newly allocated full path name if found, NULL otherwise
4622 Does not chase symlinks, even on platforms that support them.
4625 find_executable (const char *wrapper)
4630 /* static buffer for getcwd */
4631 char tmp[LT_PATHMAX + 1];
4635 lt_debugprintf (__FILE__, __LINE__, "(find_executable): %s\n",
4636 nonempty (wrapper));
4638 if ((wrapper == NULL) || (*wrapper == '\0'))
4641 /* Absolute path? */
4642 #if defined (HAVE_DOS_BASED_FILE_SYSTEM)
4643 if (isalpha ((unsigned char) wrapper[0]) && wrapper[1] == ':')
4645 concat_name = xstrdup (wrapper);
4646 if (check_executable (concat_name))
4648 XFREE (concat_name);
4653 if (IS_DIR_SEPARATOR (wrapper[0]))
4655 concat_name = xstrdup (wrapper);
4656 if (check_executable (concat_name))
4658 XFREE (concat_name);
4660 #if defined (HAVE_DOS_BASED_FILE_SYSTEM)
4664 for (p = wrapper; *p; p++)
4672 /* no slashes; search PATH */
4673 const char *path = getenv ("PATH");
4676 for (p = path; *p; p = p_next)
4680 for (q = p; *q; q++)
4681 if (IS_PATH_SEPARATOR (*q))
4684 p_next = (*q == '\0' ? q : q + 1);
4687 /* empty path: current directory */
4688 if (getcwd (tmp, LT_PATHMAX) == NULL)
4689 lt_fatal (__FILE__, __LINE__, "getcwd failed: %s",
4690 nonnull (strerror (errno)));
4691 tmp_len = strlen (tmp);
4693 XMALLOC (char, tmp_len + 1 + strlen (wrapper) + 1);
4694 memcpy (concat_name, tmp, tmp_len);
4695 concat_name[tmp_len] = '/';
4696 strcpy (concat_name + tmp_len + 1, wrapper);
4701 XMALLOC (char, p_len + 1 + strlen (wrapper) + 1);
4702 memcpy (concat_name, p, p_len);
4703 concat_name[p_len] = '/';
4704 strcpy (concat_name + p_len + 1, wrapper);
4706 if (check_executable (concat_name))
4708 XFREE (concat_name);
4711 /* not found in PATH; assume curdir */
4713 /* Relative path | not found in path: prepend cwd */
4714 if (getcwd (tmp, LT_PATHMAX) == NULL)
4715 lt_fatal (__FILE__, __LINE__, "getcwd failed: %s",
4716 nonnull (strerror (errno)));
4717 tmp_len = strlen (tmp);
4718 concat_name = XMALLOC (char, tmp_len + 1 + strlen (wrapper) + 1);
4719 memcpy (concat_name, tmp, tmp_len);
4720 concat_name[tmp_len] = '/';
4721 strcpy (concat_name + tmp_len + 1, wrapper);
4723 if (check_executable (concat_name))
4725 XFREE (concat_name);
4730 chase_symlinks (const char *pathspec)
4733 return xstrdup (pathspec);
4735 char buf[LT_PATHMAX];
4737 char *tmp_pathspec = xstrdup (pathspec);
4739 int has_symlinks = 0;
4740 while (strlen (tmp_pathspec) && !has_symlinks)
4742 lt_debugprintf (__FILE__, __LINE__,
4743 "checking path component for symlinks: %s\n",
4745 if (lstat (tmp_pathspec, &s) == 0)
4747 if (S_ISLNK (s.st_mode) != 0)
4753 /* search backwards for last DIR_SEPARATOR */
4754 p = tmp_pathspec + strlen (tmp_pathspec) - 1;
4755 while ((p > tmp_pathspec) && (!IS_DIR_SEPARATOR (*p)))
4757 if ((p == tmp_pathspec) && (!IS_DIR_SEPARATOR (*p)))
4759 /* no more DIR_SEPARATORS left */
4766 lt_fatal (__FILE__, __LINE__,
4767 "error accessing file \"%s\": %s",
4768 tmp_pathspec, nonnull (strerror (errno)));
4771 XFREE (tmp_pathspec);
4775 return xstrdup (pathspec);
4778 tmp_pathspec = realpath (pathspec, buf);
4779 if (tmp_pathspec == 0)
4781 lt_fatal (__FILE__, __LINE__,
4782 "could not follow symlinks for %s", pathspec);
4784 return xstrdup (tmp_pathspec);
4789 strendzap (char *str, const char *pat)
4793 assert (str != NULL);
4794 assert (pat != NULL);
4797 patlen = strlen (pat);
4801 str += len - patlen;
4802 if (strcmp (str, pat) == 0)
4809 lt_debugprintf (const char *file, int line, const char *fmt, ...)
4814 (void) fprintf (stderr, "%s:%s:%d: ", program_name, file, line);
4815 va_start (args, fmt);
4816 (void) vfprintf (stderr, fmt, args);
4822 lt_error_core (int exit_status, const char *file,
4823 int line, const char *mode,
4824 const char *message, va_list ap)
4826 fprintf (stderr, "%s:%s:%d: %s: ", program_name, file, line, mode);
4827 vfprintf (stderr, message, ap);
4828 fprintf (stderr, ".\n");
4830 if (exit_status >= 0)
4835 lt_fatal (const char *file, int line, const char *message, ...)
4838 va_start (ap, message);
4839 lt_error_core (EXIT_FAILURE, file, line, "FATAL", message, ap);
4844 nonnull (const char *s)
4846 return s ? s : "(null)";
4850 nonempty (const char *s)
4852 return (s && !*s) ? "(empty)" : nonnull (s);
4856 lt_setenv (const char *name, const char *value)
4858 lt_debugprintf (__FILE__, __LINE__,
4859 "(lt_setenv) setting '%s' to '%s'\n",
4860 nonnull (name), nonnull (value));
4863 /* always make a copy, for consistency with !HAVE_SETENV */
4864 char *str = xstrdup (value);
4865 setenv (name, str, 1);
4867 int len = strlen (name) + 1 + strlen (value) + 1;
4868 char *str = XMALLOC (char, len);
4869 sprintf (str, "%s=%s", name, value);
4870 if (putenv (str) != EXIT_SUCCESS)
4879 lt_extend_str (const char *orig_value, const char *add, int to_end)
4882 if (orig_value && *orig_value)
4884 int orig_value_len = strlen (orig_value);
4885 int add_len = strlen (add);
4886 new_value = XMALLOC (char, add_len + orig_value_len + 1);
4889 strcpy (new_value, orig_value);
4890 strcpy (new_value + orig_value_len, add);
4894 strcpy (new_value, add);
4895 strcpy (new_value + add_len, orig_value);
4900 new_value = xstrdup (add);
4906 lt_update_exe_path (const char *name, const char *value)
4908 lt_debugprintf (__FILE__, __LINE__,
4909 "(lt_update_exe_path) modifying '%s' by prepending '%s'\n",
4910 nonnull (name), nonnull (value));
4912 if (name && *name && value && *value)
4914 char *new_value = lt_extend_str (getenv (name), value, 0);
4915 /* some systems can't cope with a ':'-terminated path #' */
4916 int len = strlen (new_value);
4917 while (((len = strlen (new_value)) > 0) && IS_PATH_SEPARATOR (new_value[len-1]))
4919 new_value[len-1] = '\0';
4921 lt_setenv (name, new_value);
4927 lt_update_lib_path (const char *name, const char *value)
4929 lt_debugprintf (__FILE__, __LINE__,
4930 "(lt_update_lib_path) modifying '%s' by prepending '%s'\n",
4931 nonnull (name), nonnull (value));
4933 if (name && *name && value && *value)
4935 char *new_value = lt_extend_str (getenv (name), value, 0);
4936 lt_setenv (name, new_value);
4946 /* Prepares an argument vector before calling spawn().
4947 Note that spawn() does not by itself call the command interpreter
4948 (getenv ("COMSPEC") != NULL ? getenv ("COMSPEC") :
4949 ({ OSVERSIONINFO v; v.dwOSVersionInfoSize = sizeof(OSVERSIONINFO);
4951 v.dwPlatformId == VER_PLATFORM_WIN32_NT;
4952 }) ? "cmd.exe" : "command.com").
4953 Instead it simply concatenates the arguments, separated by ' ', and calls
4954 CreateProcess(). We must quote the arguments since Win32 CreateProcess()
4955 interprets characters like ' ', '\t', '\\', '"' (but not '<' and '>') in a
4957 - Space and tab are interpreted as delimiters. They are not treated as
4958 delimiters if they are surrounded by double quotes: "...".
4959 - Unescaped double quotes are removed from the input. Their only effect is
4960 that within double quotes, space and tab are treated like normal
4962 - Backslashes not followed by double quotes are not special.
4963 - But 2*n+1 backslashes followed by a double quote become
4964 n backslashes followed by a double quote (n >= 0):
4969 #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"
4970 #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"
4972 prepare_spawn (char **argv)
4978 /* Count number of arguments. */
4979 for (argc = 0; argv[argc] != NULL; argc++)
4982 /* Allocate new argument vector. */
4983 new_argv = XMALLOC (char *, argc + 1);
4985 /* Put quoted arguments into the new argument vector. */
4986 for (i = 0; i < argc; i++)
4988 const char *string = argv[i];
4990 if (string[0] == '\0')
4991 new_argv[i] = xstrdup ("\"\"");
4992 else if (strpbrk (string, SHELL_SPECIAL_CHARS) != NULL)
4994 int quote_around = (strpbrk (string, SHELL_SPACE_CHARS) != NULL);
4996 unsigned int backslashes;
4998 char *quoted_string;
5005 for (s = string; *s != '\0'; s++)
5009 length += backslashes + 1;
5017 length += backslashes + 1;
5019 quoted_string = XMALLOC (char, length + 1);
5025 for (s = string; *s != '\0'; s++)
5031 for (j = backslashes + 1; j > 0; j--)
5043 for (j = backslashes; j > 0; j--)
5049 new_argv[i] = quoted_string;
5052 new_argv[i] = (char *) string;
5054 new_argv[argc] = NULL;
5063 void lt_dump_script (FILE* f)
5066 func_emit_wrapper yes |
5068 s/^\(.\{79\}\)\(..*\)/\1\
5073 s/\([^\n]*\).*/ fputs ("\1", f);/p
5080 # end: func_emit_cwrapperexe_src
5082 # func_win32_import_lib_p ARG
5083 # True if ARG is an import lib, as indicated by $file_magic_cmd
5084 func_win32_import_lib_p ()
5087 case `eval $file_magic_cmd \"\$1\" 2>/dev/null | $SED -e 10q` in
5093 # func_mode_link arg...
5098 *-*-cygwin* | *-*-mingw* | *-*-pw32* | *-*-os2* | *-cegcc*)
5099 # It is impossible to link a dll without this setting, and
5100 # we shouldn't force the makefile maintainer to figure out
5101 # which system we are compiling for in order to pass an extra
5102 # flag for every libtool invocation.
5103 # allow_undefined=no
5105 # FIXME: Unfortunately, there are problems with the above when trying
5106 # to make a dll which has undefined symbols, in which case not
5107 # even a static library is built. For now, we need to specify
5108 # -no-undefined on the libtool link line when we can be certain
5109 # that all symbols are satisfied, otherwise we get a static library.
5116 libtool_args=$nonopt
5117 base_compile="$nonopt $@"
5118 compile_command=$nonopt
5119 finalize_command=$nonopt
5132 lib_search_path=`pwd`
5134 new_inherited_linker_flags=
5143 export_symbols_regex=
5151 precious_files_regex=
5152 prefer_static_libs=no
5165 single_module="${wl}-single_module"
5166 func_infer_tag $base_compile
5168 # We need to know -static, to get the right output filenames.
5173 test "$build_libtool_libs" != yes && \
5174 func_fatal_configuration "can not build a shared library"
5178 -all-static | -static | -static-libtool-libs)
5181 if test "$build_libtool_libs" = yes && test -z "$link_static_flag"; then
5182 func_warning "complete static linking is impossible in this configuration"
5184 if test -n "$link_static_flag"; then
5185 dlopen_self=$dlopen_self_static
5187 prefer_static_libs=yes
5190 if test -z "$pic_flag" && test -n "$link_static_flag"; then
5191 dlopen_self=$dlopen_self_static
5193 prefer_static_libs=built
5195 -static-libtool-libs)
5196 if test -z "$pic_flag" && test -n "$link_static_flag"; then
5197 dlopen_self=$dlopen_self_static
5199 prefer_static_libs=yes
5202 build_libtool_libs=no
5209 # See if our shared archives depend on static archives.
5210 test -n "$old_archive_from_new_cmds" && build_old_libs=yes
5212 # Go through the arguments, transforming them on the way.
5213 while test "$#" -gt 0; do
5216 func_quote_for_eval "$arg"
5217 qarg=$func_quote_for_eval_unquoted_result
5218 func_append libtool_args " $func_quote_for_eval_result"
5220 # If the previous option needs an argument, assign it.
5221 if test -n "$prev"; then
5224 func_append compile_command " @OUTPUT@"
5225 func_append finalize_command " @OUTPUT@"
5236 if test "$preload" = no; then
5237 # Add the symbol object into the linking commands.
5238 func_append compile_command " @SYMFILE@"
5239 func_append finalize_command " @SYMFILE@"
5243 *.la | *.lo) ;; # We handle these cases below.
5245 if test "$dlself" = no; then
5253 if test "$prev" = dlprefiles; then
5255 elif test "$prev" = dlfiles && test "$dlopen_self" != yes; then
5265 if test "$prev" = dlfiles; then
5266 func_append dlfiles " $arg"
5268 func_append dlprefiles " $arg"
5276 export_symbols="$arg"
5278 || func_fatal_error "symbol file \`$arg' does not exist"
5283 export_symbols_regex="$arg"
5291 *" $qarg.ltframework "*) ;;
5292 *) func_append deplibs " $qarg.ltframework" # this is fixed later
5301 inst_prefix_dir="$arg"
5306 if test -f "$arg"; then
5309 for fil in `cat "$save_arg"`
5311 # func_append moreargs " $fil"
5313 # A libtool-controlled object.
5315 # Check to see that this really is a libtool object.
5316 if func_lalib_unsafe_p "$arg"; then
5323 if test -z "$pic_object" ||
5324 test -z "$non_pic_object" ||
5325 test "$pic_object" = none &&
5326 test "$non_pic_object" = none; then
5327 func_fatal_error "cannot find name of object for \`$arg'"
5330 # Extract subdirectory from the argument.
5331 func_dirname "$arg" "/" ""
5332 xdir="$func_dirname_result"
5334 if test "$pic_object" != none; then
5335 # Prepend the subdirectory the object is found in.
5336 pic_object="$xdir$pic_object"
5338 if test "$prev" = dlfiles; then
5339 if test "$build_libtool_libs" = yes && test "$dlopen_support" = yes; then
5340 func_append dlfiles " $pic_object"
5344 # If libtool objects are unsupported, then we need to preload.
5349 # CHECK ME: I think I busted this. -Ossama
5350 if test "$prev" = dlprefiles; then
5351 # Preload the old-style object.
5352 func_append dlprefiles " $pic_object"
5357 func_append libobjs " $pic_object"
5362 if test "$non_pic_object" != none; then
5363 # Prepend the subdirectory the object is found in.
5364 non_pic_object="$xdir$non_pic_object"
5366 # A standard non-PIC object
5367 func_append non_pic_objects " $non_pic_object"
5368 if test -z "$pic_object" || test "$pic_object" = none ; then
5369 arg="$non_pic_object"
5372 # If the PIC object exists, use it instead.
5373 # $xdir was prepended to $pic_object above.
5374 non_pic_object="$pic_object"
5375 func_append non_pic_objects " $non_pic_object"
5378 # Only an error if not doing a dry-run.
5379 if $opt_dry_run; then
5380 # Extract subdirectory from the argument.
5381 func_dirname "$arg" "/" ""
5382 xdir="$func_dirname_result"
5385 pic_object=$xdir$objdir/$func_lo2o_result
5386 non_pic_object=$xdir$func_lo2o_result
5387 func_append libobjs " $pic_object"
5388 func_append non_pic_objects " $non_pic_object"
5390 func_fatal_error "\`$arg' is not a valid libtool object"
5395 func_fatal_error "link input file \`$arg' does not exist"
5402 precious_files_regex="$arg"
5412 # We need an absolute path.
5414 [\\/]* | [A-Za-z]:[\\/]*) ;;
5416 func_fatal_error "only absolute run-paths are allowed"
5419 if test "$prev" = rpath; then
5422 *) func_append rpath " $arg" ;;
5427 *) func_append xrpath " $arg" ;;
5439 func_append weak_libs " $arg"
5444 func_append linker_flags " $qarg"
5445 func_append compiler_flags " $qarg"
5447 func_append compile_command " $qarg"
5448 func_append finalize_command " $qarg"
5452 func_append compiler_flags " $qarg"
5454 func_append compile_command " $qarg"
5455 func_append finalize_command " $qarg"
5459 func_append linker_flags " $qarg"
5460 func_append compiler_flags " $wl$qarg"
5462 func_append compile_command " $wl$qarg"
5463 func_append finalize_command " $wl$qarg"
5467 eval "$prev=\"\$arg\""
5472 fi # test -n "$prev"
5478 if test -n "$link_static_flag"; then
5479 # See comment for -static flag below, for more details.
5480 func_append compile_command " $link_static_flag"
5481 func_append finalize_command " $link_static_flag"
5487 # FIXME: remove this flag sometime in the future.
5488 func_fatal_error "\`-allow-undefined' must not be used because it is the default"
5516 -export-symbols | -export-symbols-regex)
5517 if test -n "$export_symbols" || test -n "$export_symbols_regex"; then
5518 func_fatal_error "more than one -exported-symbols argument is not allowed"
5520 if test "X$arg" = "X-export-symbols"; then
5538 # The native IRIX linker understands -LANG:*, -LIST:* and -LNO:*
5539 # so, if we see these flags be careful not to treat them like -L
5541 case $with_gcc/$host in
5542 no/*-*-irix* | /*-*-irix*)
5543 func_append compile_command " $arg"
5544 func_append finalize_command " $arg"
5551 func_stripname "-L" '' "$arg"
5552 if test -z "$func_stripname_result"; then
5553 if test "$#" -gt 0; then
5554 func_fatal_error "require no space between \`-L' and \`$1'"
5556 func_fatal_error "need path for \`-L' option"
5559 func_resolve_sysroot "$func_stripname_result"
5560 dir=$func_resolve_sysroot_result
5561 # We need an absolute path.
5563 [\\/]* | [A-Za-z]:[\\/]*) ;;
5565 absdir=`cd "$dir" && pwd`
5566 test -z "$absdir" && \
5567 func_fatal_error "cannot determine absolute directory name of \`$dir'"
5572 *" -L$dir "* | *" $arg "*)
5573 # Will only happen for absolute or sysroot arguments
5576 # Preserve sysroot, but never include relative directories
5578 [\\/]* | [A-Za-z]:[\\/]* | =*) func_append deplibs " $arg" ;;
5579 *) func_append deplibs " -L$dir" ;;
5581 func_append lib_search_path " $dir"
5585 *-*-cygwin* | *-*-mingw* | *-*-pw32* | *-*-os2* | *-cegcc*)
5586 testbindir=`$ECHO "$dir" | $SED 's*/lib$*/bin*'`
5587 case :$dllsearchpath: in
5589 ::) dllsearchpath=$dir;;
5590 *) func_append dllsearchpath ":$dir";;
5592 case :$dllsearchpath: in
5593 *":$testbindir:"*) ;;
5594 ::) dllsearchpath=$testbindir;;
5595 *) func_append dllsearchpath ":$testbindir";;
5603 if test "X$arg" = "X-lc" || test "X$arg" = "X-lm"; then
5605 *-*-cygwin* | *-*-mingw* | *-*-pw32* | *-*-beos* | *-cegcc* | *-*-haiku*)
5606 # These systems don't actually have a C or math library (as such)
5610 # These systems don't actually have a C library (as such)
5611 test "X$arg" = "X-lc" && continue
5613 *-*-openbsd* | *-*-freebsd* | *-*-dragonfly*)
5614 # Do not include libc due to us having libc/libc_r.
5615 test "X$arg" = "X-lc" && continue
5617 *-*-rhapsody* | *-*-darwin1.[012])
5618 # Rhapsody C and math libraries are in the System framework
5619 func_append deplibs " System.ltframework"
5622 *-*-sco3.2v5* | *-*-sco5v6*)
5623 # Causes problems with __ctype
5624 test "X$arg" = "X-lc" && continue
5626 *-*-sysv4.2uw2* | *-*-sysv5* | *-*-unixware* | *-*-OpenUNIX*)
5627 # Compiler inserts libc in the correct place for threads to work
5628 test "X$arg" = "X-lc" && continue
5631 elif test "X$arg" = "X-lc_r"; then
5633 *-*-openbsd* | *-*-freebsd* | *-*-dragonfly*)
5634 # Do not include libc_r directly, use -pthread flag.
5639 func_append deplibs " $arg"
5648 # Tru64 UNIX uses -model [arg] to determine the layout of C++
5649 # classes, name mangling, and exception handling.
5650 # Darwin uses the -arch flag to determine output architecture.
5651 -model|-arch|-isysroot|--sysroot)
5652 func_append compiler_flags " $arg"
5653 func_append compile_command " $arg"
5654 func_append finalize_command " $arg"
5659 -mt|-mthreads|-kthread|-Kthread|-pthread|-pthreads|--thread-safe \
5660 |-threads|-fopenmp|-openmp|-mp|-xopenmp|-omp|-qsmp=*)
5661 func_append compiler_flags " $arg"
5662 func_append compile_command " $arg"
5663 func_append finalize_command " $arg"
5664 case "$new_inherited_linker_flags " in
5666 * ) func_append new_inherited_linker_flags " $arg" ;;
5672 single_module="${wl}-multi_module"
5683 *-*-cygwin* | *-*-mingw* | *-*-pw32* | *-*-os2* | *-*-darwin* | *-cegcc*)
5684 # The PATH hackery in wrapper scripts is required on Windows
5685 # and Darwin in order for the loader to find any dlls it needs.
5686 func_warning "\`-no-install' is ignored for $host"
5687 func_warning "assuming \`-no-fast-install' instead"
5690 *) no_install=yes ;;
5707 -precious-files-regex)
5728 func_stripname '-R' '' "$arg"
5729 dir=$func_stripname_result
5730 # We need an absolute path.
5732 [\\/]* | [A-Za-z]:[\\/]*) ;;
5734 func_stripname '=' '' "$dir"
5735 dir=$lt_sysroot$func_stripname_result
5738 func_fatal_error "only absolute run-paths are allowed"
5743 *) func_append xrpath " $dir" ;;
5749 # The effects of -shared are defined in a previous loop.
5758 -static | -static-libtool-libs)
5759 # The effects of -static are defined in a previous loop.
5760 # We used to do the same as -all-static on platforms that
5761 # didn't have a PIC flag, but the assumption that the effects
5762 # would be equivalent was wrong. It would break on at least
5763 # Digital Unix and AIX.
5789 func_stripname '-Wc,' '' "$arg"
5790 args=$func_stripname_result
5792 save_ifs="$IFS"; IFS=','
5793 for flag in $args; do
5795 func_quote_for_eval "$flag"
5796 func_append arg " $func_quote_for_eval_result"
5797 func_append compiler_flags " $func_quote_for_eval_result"
5800 func_stripname ' ' '' "$arg"
5801 arg=$func_stripname_result
5805 func_stripname '-Wl,' '' "$arg"
5806 args=$func_stripname_result
5808 save_ifs="$IFS"; IFS=','
5809 for flag in $args; do
5811 func_quote_for_eval "$flag"
5812 func_append arg " $wl$func_quote_for_eval_result"
5813 func_append compiler_flags " $wl$func_quote_for_eval_result"
5814 func_append linker_flags " $func_quote_for_eval_result"
5817 func_stripname ' ' '' "$arg"
5818 arg=$func_stripname_result
5838 func_quote_for_eval "$arg"
5839 arg="$func_quote_for_eval_result"
5842 # Flags to be passed through unchanged, with rationale:
5843 # -64, -mips[0-9] enable 64-bit mode for the SGI compiler
5844 # -r[0-9][0-9]* specify processor for the SGI compiler
5845 # -xarch=*, -xtarget=* enable 64-bit mode for the Sun compiler
5846 # +DA*, +DD* enable 64-bit mode for the HP compiler
5847 # -q* compiler args for the IBM compiler
5848 # -m*, -t[45]*, -txscale* architecture-specific flags for GCC
5849 # -F/path path to uninstalled frameworks, gcc on darwin
5850 # -p, -pg, --coverage, -fprofile-* profiling flags for GCC
5851 # @file GCC response files
5852 # -tp=* Portland pgcc target processor selection
5853 # --sysroot=* for sysroot support
5854 # -O*, -flto*, -fwhopr*, -fuse-linker-plugin GCC link-time optimization
5855 -64|-mips[0-9]|-r[0-9][0-9]*|-xarch=*|-xtarget=*|+DA*|+DD*|-q*|-m*| \
5856 -t[45]*|-txscale*|-p|-pg|--coverage|-fprofile-*|-F*|@*|-tp=*|--sysroot=*| \
5857 -O*|-flto*|-fwhopr*|-fuse-linker-plugin)
5858 func_quote_for_eval "$arg"
5859 arg="$func_quote_for_eval_result"
5860 func_append compile_command " $arg"
5861 func_append finalize_command " $arg"
5862 func_append compiler_flags " $arg"
5866 # Some other compiler flag.
5868 func_quote_for_eval "$arg"
5869 arg="$func_quote_for_eval_result"
5873 # A standard object.
5874 func_append objs " $arg"
5878 # A libtool-controlled object.
5880 # Check to see that this really is a libtool object.
5881 if func_lalib_unsafe_p "$arg"; then
5888 if test -z "$pic_object" ||
5889 test -z "$non_pic_object" ||
5890 test "$pic_object" = none &&
5891 test "$non_pic_object" = none; then
5892 func_fatal_error "cannot find name of object for \`$arg'"
5895 # Extract subdirectory from the argument.
5896 func_dirname "$arg" "/" ""
5897 xdir="$func_dirname_result"
5899 if test "$pic_object" != none; then
5900 # Prepend the subdirectory the object is found in.
5901 pic_object="$xdir$pic_object"
5903 if test "$prev" = dlfiles; then
5904 if test "$build_libtool_libs" = yes && test "$dlopen_support" = yes; then
5905 func_append dlfiles " $pic_object"
5909 # If libtool objects are unsupported, then we need to preload.
5914 # CHECK ME: I think I busted this. -Ossama
5915 if test "$prev" = dlprefiles; then
5916 # Preload the old-style object.
5917 func_append dlprefiles " $pic_object"
5922 func_append libobjs " $pic_object"
5927 if test "$non_pic_object" != none; then
5928 # Prepend the subdirectory the object is found in.
5929 non_pic_object="$xdir$non_pic_object"
5931 # A standard non-PIC object
5932 func_append non_pic_objects " $non_pic_object"
5933 if test -z "$pic_object" || test "$pic_object" = none ; then
5934 arg="$non_pic_object"
5937 # If the PIC object exists, use it instead.
5938 # $xdir was prepended to $pic_object above.
5939 non_pic_object="$pic_object"
5940 func_append non_pic_objects " $non_pic_object"
5943 # Only an error if not doing a dry-run.
5944 if $opt_dry_run; then
5945 # Extract subdirectory from the argument.
5946 func_dirname "$arg" "/" ""
5947 xdir="$func_dirname_result"
5950 pic_object=$xdir$objdir/$func_lo2o_result
5951 non_pic_object=$xdir$func_lo2o_result
5952 func_append libobjs " $pic_object"
5953 func_append non_pic_objects " $non_pic_object"
5955 func_fatal_error "\`$arg' is not a valid libtool object"
5962 func_append deplibs " $arg"
5963 func_append old_deplibs " $arg"
5968 # A libtool-controlled library.
5970 func_resolve_sysroot "$arg"
5971 if test "$prev" = dlfiles; then
5972 # This library was specified with -dlopen.
5973 func_append dlfiles " $func_resolve_sysroot_result"
5975 elif test "$prev" = dlprefiles; then
5976 # The library was specified with -dlpreopen.
5977 func_append dlprefiles " $func_resolve_sysroot_result"
5980 func_append deplibs " $func_resolve_sysroot_result"
5985 # Some other compiler argument.
5987 # Unknown arguments in both finalize_command and compile_command need
5988 # to be aesthetically quoted because they are evaled later.
5989 func_quote_for_eval "$arg"
5990 arg="$func_quote_for_eval_result"
5994 # Now actually substitute the argument into the commands.
5995 if test -n "$arg"; then
5996 func_append compile_command " $arg"
5997 func_append finalize_command " $arg"
5999 done # argument parsing loop
6001 test -n "$prev" && \
6002 func_fatal_help "the \`$prevarg' option requires an argument"
6004 if test "$export_dynamic" = yes && test -n "$export_dynamic_flag_spec"; then
6005 eval arg=\"$export_dynamic_flag_spec\"
6006 func_append compile_command " $arg"
6007 func_append finalize_command " $arg"
6011 # calculate the name of the file, without its directory
6012 func_basename "$output"
6013 outputname="$func_basename_result"
6014 libobjs_save="$libobjs"
6016 if test -n "$shlibpath_var"; then
6017 # get the directories listed in $shlibpath_var
6018 eval shlib_search_path=\`\$ECHO \"\${$shlibpath_var}\" \| \$SED \'s/:/ /g\'\`
6022 eval sys_lib_search_path=\"$sys_lib_search_path_spec\"
6023 eval sys_lib_dlsearch_path=\"$sys_lib_dlsearch_path_spec\"
6025 func_dirname "$output" "/" ""
6026 output_objdir="$func_dirname_result$objdir"
6027 func_to_tool_file "$output_objdir/"
6028 tool_output_objdir=$func_to_tool_file_result
6029 # Create the object directory.
6030 func_mkdir_p "$output_objdir"
6032 # Determine the type of output
6035 func_fatal_help "you must specify an output file"
6037 *.$libext) linkmode=oldlib ;;
6038 *.lo | *.$objext) linkmode=obj ;;
6039 *.la) linkmode=lib ;;
6040 *) linkmode=prog ;; # Anything else should be a program.
6046 # Find all interdependent deplibs by searching for libraries
6047 # that are linked more than once (e.g. -la -lb -la)
6048 for deplib in $deplibs; do
6049 if $opt_preserve_dup_deps ; then
6051 *" $deplib "*) func_append specialdeplibs " $deplib" ;;
6054 func_append libs " $deplib"
6057 if test "$linkmode" = lib; then
6058 libs="$predeps $libs $compiler_lib_search_path $postdeps"
6060 # Compute libraries that are listed more than once in $predeps
6061 # $postdeps and mark them as special (i.e., whose duplicates are
6062 # not to be eliminated).
6064 if $opt_duplicate_compiler_generated_deps; then
6065 for pre_post_dep in $predeps $postdeps; do
6066 case "$pre_post_deps " in
6067 *" $pre_post_dep "*) func_append specialdeplibs " $pre_post_deps" ;;
6069 func_append pre_post_deps " $pre_post_dep"
6078 need_relink=no # whether we're linking any uninstalled libtool libraries
6079 notinst_deplibs= # not-installed libtool libraries
6080 notinst_path= # paths that contain not-installed libtool libraries
6084 passes="conv dlpreopen link"
6085 for file in $dlfiles $dlprefiles; do
6089 func_fatal_help "libraries can \`-dlopen' only libtool libraries: $file"
6100 passes="conv scan dlopen dlpreopen link"
6106 for pass in $passes; do
6107 # The preopen pass in lib mode reverses $deplibs; put it back here
6108 # so that -L comes before libs that need it for instance...
6109 if test "$linkmode,$pass" = "lib,link"; then
6110 ## FIXME: Find the place where the list is rebuilt in the wrong
6111 ## order, and fix it there properly
6113 for deplib in $deplibs; do
6114 tmp_deplibs="$deplib $tmp_deplibs"
6116 deplibs="$tmp_deplibs"
6119 if test "$linkmode,$pass" = "lib,link" ||
6120 test "$linkmode,$pass" = "prog,scan"; then
6124 if test "$linkmode" = prog; then
6126 dlopen) libs="$dlfiles" ;;
6127 dlpreopen) libs="$dlprefiles" ;;
6128 link) libs="$deplibs %DEPLIBS% $dependency_libs" ;;
6131 if test "$linkmode,$pass" = "lib,dlpreopen"; then
6132 # Collect and forward deplibs of preopened libtool libs
6133 for lib in $dlprefiles; do
6134 # Ignore non-libtool-libs
6136 func_resolve_sysroot "$lib"
6138 *.la) func_source "$func_resolve_sysroot_result" ;;
6141 # Collect preopened libtool deplibs, except any this library
6142 # has declared as weak libs
6143 for deplib in $dependency_libs; do
6144 func_basename "$deplib"
6145 deplib_base=$func_basename_result
6146 case " $weak_libs " in
6147 *" $deplib_base "*) ;;
6148 *) func_append deplibs " $deplib" ;;
6154 if test "$pass" = dlopen; then
6155 # Collect dlpreopened libraries
6156 save_deplibs="$deplibs"
6160 for deplib in $libs; do
6164 -mt|-mthreads|-kthread|-Kthread|-pthread|-pthreads|--thread-safe \
6165 |-threads|-fopenmp|-openmp|-mp|-xopenmp|-omp|-qsmp=*)
6166 if test "$linkmode,$pass" = "prog,link"; then
6167 compile_deplibs="$deplib $compile_deplibs"
6168 finalize_deplibs="$deplib $finalize_deplibs"
6170 func_append compiler_flags " $deplib"
6171 if test "$linkmode" = lib ; then
6172 case "$new_inherited_linker_flags " in
6174 * ) func_append new_inherited_linker_flags " $deplib" ;;
6181 if test "$linkmode" != lib && test "$linkmode" != prog; then
6182 func_warning "\`-l' is ignored for archives/objects"
6185 func_stripname '-l' '' "$deplib"
6186 name=$func_stripname_result
6187 if test "$linkmode" = lib; then
6188 searchdirs="$newlib_search_path $lib_search_path $compiler_lib_search_dirs $sys_lib_search_path $shlib_search_path"
6190 searchdirs="$newlib_search_path $lib_search_path $sys_lib_search_path $shlib_search_path"
6192 for searchdir in $searchdirs; do
6193 for search_ext in .la $std_shrext .so .a; do
6194 # Search the libtool library
6195 lib="$searchdir/lib${name}${search_ext}"
6196 if test -f "$lib"; then
6197 if test "$search_ext" = ".la"; then
6206 if test "$found" != yes; then
6207 # deplib doesn't seem to be a libtool library
6208 if test "$linkmode,$pass" = "prog,link"; then
6209 compile_deplibs="$deplib $compile_deplibs"
6210 finalize_deplibs="$deplib $finalize_deplibs"
6212 deplibs="$deplib $deplibs"
6213 test "$linkmode" = lib && newdependency_libs="$deplib $newdependency_libs"
6216 else # deplib is a libtool library
6217 # If $allow_libtool_libs_with_static_runtimes && $deplib is a stdlib,
6218 # We need to do some special things here, and not later.
6219 if test "X$allow_libtool_libs_with_static_runtimes" = "Xyes" ; then
6220 case " $predeps $postdeps " in
6222 if func_lalib_p "$lib"; then
6226 for l in $old_library $library_names; do
6229 if test "X$ll" = "X$old_library" ; then # only static version available
6231 func_dirname "$lib" "" "."
6232 ladir="$func_dirname_result"
6233 lib=$ladir/$old_library
6234 if test "$linkmode,$pass" = "prog,link"; then
6235 compile_deplibs="$deplib $compile_deplibs"
6236 finalize_deplibs="$deplib $finalize_deplibs"
6238 deplibs="$deplib $deplibs"
6239 test "$linkmode" = lib && newdependency_libs="$deplib $newdependency_libs"
6251 if test "$linkmode,$pass" = "prog,link"; then
6252 compile_deplibs="$deplib $compile_deplibs"
6253 finalize_deplibs="$deplib $finalize_deplibs"
6255 deplibs="$deplib $deplibs"
6256 if test "$linkmode" = lib ; then
6257 case "$new_inherited_linker_flags " in
6259 * ) func_append new_inherited_linker_flags " $deplib" ;;
6268 deplibs="$deplib $deplibs"
6269 test "$pass" = conv && continue
6270 newdependency_libs="$deplib $newdependency_libs"
6271 func_stripname '-L' '' "$deplib"
6272 func_resolve_sysroot "$func_stripname_result"
6273 func_append newlib_search_path " $func_resolve_sysroot_result"
6276 if test "$pass" = conv; then
6277 deplibs="$deplib $deplibs"
6280 if test "$pass" = scan; then
6281 deplibs="$deplib $deplibs"
6283 compile_deplibs="$deplib $compile_deplibs"
6284 finalize_deplibs="$deplib $finalize_deplibs"
6286 func_stripname '-L' '' "$deplib"
6287 func_resolve_sysroot "$func_stripname_result"
6288 func_append newlib_search_path " $func_resolve_sysroot_result"
6291 func_warning "\`-L' is ignored for archives/objects"
6297 if test "$pass" = link; then
6298 func_stripname '-R' '' "$deplib"
6299 func_resolve_sysroot "$func_stripname_result"
6300 dir=$func_resolve_sysroot_result
6301 # Make sure the xrpath contains only unique directories.
6304 *) func_append xrpath " $dir" ;;
6307 deplibs="$deplib $deplibs"
6311 func_resolve_sysroot "$deplib"
6312 lib=$func_resolve_sysroot_result
6315 if test "$pass" = conv; then
6316 deplibs="$deplib $deplibs"
6321 # Linking convenience modules into shared libraries is allowed,
6322 # but linking other static libraries is non-portable.
6323 case " $dlpreconveniencelibs " in
6327 case $deplibs_check_method in
6329 set dummy $deplibs_check_method; shift
6330 match_pattern_regex=`expr "$deplibs_check_method" : "$1 \(.*\)"`
6331 if eval "\$ECHO \"$deplib\"" 2>/dev/null | $SED 10q \
6332 | $EGREP "$match_pattern_regex" > /dev/null; then
6340 if test "$valid_a_lib" != yes; then
6342 $ECHO "*** Warning: Trying to link with static lib archive $deplib."
6343 echo "*** I have the capability to make that library automatically link in when"
6344 echo "*** you link to this library. But I can only do this if you have a"
6345 echo "*** shared version of the library, which you do not appear to have"
6346 echo "*** because the file extensions .$libext of this argument makes me believe"
6347 echo "*** that it is just a static archive that I should not use here."
6350 $ECHO "*** Warning: Linking the shared library $output against the"
6351 $ECHO "*** static library $deplib is not portable!"
6352 deplibs="$deplib $deplibs"
6359 if test "$pass" != link; then
6360 deplibs="$deplib $deplibs"
6362 compile_deplibs="$deplib $compile_deplibs"
6363 finalize_deplibs="$deplib $finalize_deplibs"
6370 if test "$pass" = conv; then
6371 deplibs="$deplib $deplibs"
6372 elif test "$linkmode" = prog; then
6373 if test "$pass" = dlpreopen || test "$dlopen_support" != yes || test "$build_libtool_libs" = no; then
6374 # If there is no dlopen support or we're linking statically,
6375 # we need to preload.
6376 func_append newdlprefiles " $deplib"
6377 compile_deplibs="$deplib $compile_deplibs"
6378 finalize_deplibs="$deplib $finalize_deplibs"
6380 func_append newdlfiles " $deplib"
6391 if test "$found" = yes || test -f "$lib"; then :
6393 func_fatal_error "cannot find the library \`$lib' or unhandled argument \`$deplib'"
6396 # Check to see that this really is a libtool archive.
6397 func_lalib_unsafe_p "$lib" \
6398 || func_fatal_error "\`$lib' is not a valid libtool archive"
6400 func_dirname "$lib" "" "."
6401 ladir="$func_dirname_result"
6409 inherited_linker_flags=
6410 # If the library was installed with an old release of libtool,
6411 # it will not redefine variables installed, or shouldnotlink
6420 # Convert "-framework foo" to "foo.ltframework"
6421 if test -n "$inherited_linker_flags"; then
6422 tmp_inherited_linker_flags=`$ECHO "$inherited_linker_flags" | $SED 's/-framework \([^ $]*\)/\1.ltframework/g'`
6423 for tmp_inherited_linker_flag in $tmp_inherited_linker_flags; do
6424 case " $new_inherited_linker_flags " in
6425 *" $tmp_inherited_linker_flag "*) ;;
6426 *) func_append new_inherited_linker_flags " $tmp_inherited_linker_flag";;
6430 dependency_libs=`$ECHO " $dependency_libs" | $SED 's% \([^ $]*\).ltframework% -framework \1%g'`
6431 if test "$linkmode,$pass" = "lib,link" ||
6432 test "$linkmode,$pass" = "prog,scan" ||
6433 { test "$linkmode" != prog && test "$linkmode" != lib; }; then
6434 test -n "$dlopen" && func_append dlfiles " $dlopen"
6435 test -n "$dlpreopen" && func_append dlprefiles " $dlpreopen"
6438 if test "$pass" = conv; then
6439 # Only check for convenience libraries
6440 deplibs="$lib $deplibs"
6441 if test -z "$libdir"; then
6442 if test -z "$old_library"; then
6443 func_fatal_error "cannot find name of link library for \`$lib'"
6445 # It is a libtool convenience library, so add in its objects.
6446 func_append convenience " $ladir/$objdir/$old_library"
6447 func_append old_convenience " $ladir/$objdir/$old_library"
6448 elif test "$linkmode" != prog && test "$linkmode" != lib; then
6449 func_fatal_error "\`$lib' is not a convenience library"
6452 for deplib in $dependency_libs; do
6453 deplibs="$deplib $deplibs"
6454 if $opt_preserve_dup_deps ; then
6455 case "$tmp_libs " in
6456 *" $deplib "*) func_append specialdeplibs " $deplib" ;;
6459 func_append tmp_libs " $deplib"
6465 # Get the name of the library we link against.
6467 if test -n "$old_library" &&
6468 { test "$prefer_static_libs" = yes ||
6469 test "$prefer_static_libs,$installed" = "built,no"; }; then
6470 linklib=$old_library
6472 for l in $old_library $library_names; do
6476 if test -z "$linklib"; then
6477 func_fatal_error "cannot find name of link library for \`$lib'"
6480 # This library was specified with -dlopen.
6481 if test "$pass" = dlopen; then
6482 if test -z "$libdir"; then
6483 func_fatal_error "cannot -dlopen a convenience library: \`$lib'"
6485 if test -z "$dlname" ||
6486 test "$dlopen_support" != yes ||
6487 test "$build_libtool_libs" = no; then
6488 # If there is no dlname, no dlopen support or we're linking
6489 # statically, we need to preload. We also need to preload any
6490 # dependent libraries so libltdl's deplib preloader doesn't
6491 # bomb out in the load deplibs phase.
6492 func_append dlprefiles " $lib $dependency_libs"
6494 func_append newdlfiles " $lib"
6499 # We need an absolute path.
6501 [\\/]* | [A-Za-z]:[\\/]*) abs_ladir="$ladir" ;;
6503 abs_ladir=`cd "$ladir" && pwd`
6504 if test -z "$abs_ladir"; then
6505 func_warning "cannot determine absolute directory name of \`$ladir'"
6506 func_warning "passing it literally to the linker, although it might fail"
6511 func_basename "$lib"
6512 laname="$func_basename_result"
6514 # Find the relevant object directory and library name.
6515 if test "X$installed" = Xyes; then
6516 if test ! -f "$lt_sysroot$libdir/$linklib" && test -f "$abs_ladir/$linklib"; then
6517 func_warning "library \`$lib' was moved."
6522 dir="$lt_sysroot$libdir"
6523 absdir="$lt_sysroot$libdir"
6525 test "X$hardcode_automatic" = Xyes && avoidtemprpath=yes
6527 if test ! -f "$ladir/$objdir/$linklib" && test -f "$abs_ladir/$linklib"; then
6530 # Remove this search path later
6531 func_append notinst_path " $abs_ladir"
6533 dir="$ladir/$objdir"
6534 absdir="$abs_ladir/$objdir"
6535 # Remove this search path later
6536 func_append notinst_path " $abs_ladir"
6538 fi # $installed = yes
6539 func_stripname 'lib' '.la' "$laname"
6540 name=$func_stripname_result
6542 # This library was specified with -dlpreopen.
6543 if test "$pass" = dlpreopen; then
6544 if test -z "$libdir" && test "$linkmode" = prog; then
6545 func_fatal_error "only libraries may -dlpreopen a convenience library: \`$lib'"
6548 # special handling for platforms with PE-DLLs.
6549 *cygwin* | *mingw* | *cegcc* )
6550 # Linker will automatically link against shared library if both
6551 # static and shared are present. Therefore, ensure we extract
6552 # symbols from the import library if a shared library is present
6553 # (otherwise, the dlopen module name will be incorrect). We do
6554 # this by putting the import library name into $newdlprefiles.
6555 # We recover the dlopen module name by 'saving' the la file
6556 # name in a special purpose variable, and (later) extracting the
6557 # dlname from the la file.
6558 if test -n "$dlname"; then
6559 func_tr_sh "$dir/$linklib"
6560 eval "libfile_$func_tr_sh_result=\$abs_ladir/\$laname"
6561 func_append newdlprefiles " $dir/$linklib"
6563 func_append newdlprefiles " $dir/$old_library"
6564 # Keep a list of preopened convenience libraries to check
6565 # that they are being used correctly in the link pass.
6566 test -z "$libdir" && \
6567 func_append dlpreconveniencelibs " $dir/$old_library"
6571 # Prefer using a static library (so that no silly _DYNAMIC symbols
6572 # are required to link).
6573 if test -n "$old_library"; then
6574 func_append newdlprefiles " $dir/$old_library"
6575 # Keep a list of preopened convenience libraries to check
6576 # that they are being used correctly in the link pass.
6577 test -z "$libdir" && \
6578 func_append dlpreconveniencelibs " $dir/$old_library"
6579 # Otherwise, use the dlname, so that lt_dlopen finds it.
6580 elif test -n "$dlname"; then
6581 func_append newdlprefiles " $dir/$dlname"
6583 func_append newdlprefiles " $dir/$linklib"
6587 fi # $pass = dlpreopen
6589 if test -z "$libdir"; then
6590 # Link the convenience library
6591 if test "$linkmode" = lib; then
6592 deplibs="$dir/$old_library $deplibs"
6593 elif test "$linkmode,$pass" = "prog,link"; then
6594 compile_deplibs="$dir/$old_library $compile_deplibs"
6595 finalize_deplibs="$dir/$old_library $finalize_deplibs"
6597 deplibs="$lib $deplibs" # used for prog,scan pass
6603 if test "$linkmode" = prog && test "$pass" != link; then
6604 func_append newlib_search_path " $ladir"
6605 deplibs="$lib $deplibs"
6608 if test "$link_all_deplibs" != no || test -z "$library_names" ||
6609 test "$build_libtool_libs" = no; then
6614 for deplib in $dependency_libs; do
6616 -L*) func_stripname '-L' '' "$deplib"
6617 func_resolve_sysroot "$func_stripname_result"
6618 func_append newlib_search_path " $func_resolve_sysroot_result"
6621 # Need to link against all dependency_libs?
6622 if test "$linkalldeplibs" = yes; then
6623 deplibs="$deplib $deplibs"
6625 # Need to hardcode shared library paths
6626 # or/and link against static libraries
6627 newdependency_libs="$deplib $newdependency_libs"
6629 if $opt_preserve_dup_deps ; then
6630 case "$tmp_libs " in
6631 *" $deplib "*) func_append specialdeplibs " $deplib" ;;
6634 func_append tmp_libs " $deplib"
6637 fi # $linkmode = prog...
6639 if test "$linkmode,$pass" = "prog,link"; then
6640 if test -n "$library_names" &&
6641 { { test "$prefer_static_libs" = no ||
6642 test "$prefer_static_libs,$installed" = "built,yes"; } ||
6643 test -z "$old_library"; }; then
6644 # We need to hardcode the library path
6645 if test -n "$shlibpath_var" && test -z "$avoidtemprpath" ; then
6646 # Make sure the rpath contains only unique directories.
6647 case "$temp_rpath:" in
6649 *) func_append temp_rpath "$absdir:" ;;
6653 # Hardcode the library path.
6654 # Skip directories that are in the system default run-time
6656 case " $sys_lib_dlsearch_path " in
6659 case "$compile_rpath " in
6661 *) func_append compile_rpath " $absdir" ;;
6665 case " $sys_lib_dlsearch_path " in
6668 case "$finalize_rpath " in
6670 *) func_append finalize_rpath " $libdir" ;;
6674 fi # $linkmode,$pass = prog,link...
6676 if test "$alldeplibs" = yes &&
6677 { test "$deplibs_check_method" = pass_all ||
6678 { test "$build_libtool_libs" = yes &&
6679 test -n "$library_names"; }; }; then
6680 # We only need to search for static libraries
6685 link_static=no # Whether the deplib will be linked statically
6686 use_static_libs=$prefer_static_libs
6687 if test "$use_static_libs" = built && test "$installed" = yes; then
6690 if test -n "$library_names" &&
6691 { test "$use_static_libs" = no || test -z "$old_library"; }; then
6693 *cygwin* | *mingw* | *cegcc*)
6694 # No point in relinking DLLs because paths are not encoded
6695 func_append notinst_deplibs " $lib"
6699 if test "$installed" = no; then
6700 func_append notinst_deplibs " $lib"
6705 # This is a shared library
6707 # Warn about portability, can't link against -module's on some
6708 # systems (darwin). Don't bleat about dlopened modules though!
6710 for dlpremoduletest in $dlprefiles; do
6711 if test "X$dlpremoduletest" = "X$lib"; then
6712 dlopenmodule="$dlpremoduletest"
6716 if test -z "$dlopenmodule" && test "$shouldnotlink" = yes && test "$pass" = link; then
6718 if test "$linkmode" = prog; then
6719 $ECHO "*** Warning: Linking the executable $output against the loadable module"
6721 $ECHO "*** Warning: Linking the shared library $output against the loadable module"
6723 $ECHO "*** $linklib is not portable!"
6725 if test "$linkmode" = lib &&
6726 test "$hardcode_into_libs" = yes; then
6727 # Hardcode the library path.
6728 # Skip directories that are in the system default run-time
6730 case " $sys_lib_dlsearch_path " in
6733 case "$compile_rpath " in
6735 *) func_append compile_rpath " $absdir" ;;
6739 case " $sys_lib_dlsearch_path " in
6742 case "$finalize_rpath " in
6744 *) func_append finalize_rpath " $libdir" ;;
6750 if test -n "$old_archive_from_expsyms_cmds"; then
6751 # figure out the soname
6752 set dummy $library_names
6756 libname=`eval "\\$ECHO \"$libname_spec\""`
6757 # use dlname if we got it. it's perfectly good, no?
6758 if test -n "$dlname"; then
6760 elif test -n "$soname_spec"; then
6763 *cygwin* | mingw* | *cegcc*)
6764 func_arith $current - $age
6765 major=$func_arith_result
6769 eval soname=\"$soname_spec\"
6774 # Make a new name for the extract_expsyms_cmds to use
6776 func_basename "$soroot"
6777 soname="$func_basename_result"
6778 func_stripname 'lib' '.dll' "$soname"
6779 newlib=libimp-$func_stripname_result.a
6781 # If the library has no export list, then create one now
6782 if test -f "$output_objdir/$soname-def"; then :
6784 func_verbose "extracting exported symbol list from \`$soname'"
6785 func_execute_cmds "$extract_expsyms_cmds" 'exit $?'
6789 if test -f "$output_objdir/$newlib"; then :; else
6790 func_verbose "generating import library for \`$soname'"
6791 func_execute_cmds "$old_archive_from_expsyms_cmds" 'exit $?'
6793 # make sure the library variables are pointing to the new library
6796 fi # test -n "$old_archive_from_expsyms_cmds"
6798 if test "$linkmode" = prog || test "$opt_mode" != relink; then
6803 case $hardcode_action in
6804 immediate | unsupported)
6805 if test "$hardcode_direct" = no; then
6808 *-*-sco3.2v5.0.[024]*) add_dir="-L$dir" ;;
6809 *-*-sysv4*uw2*) add_dir="-L$dir" ;;
6810 *-*-sysv5OpenUNIX* | *-*-sysv5UnixWare7.[01].[10]* | \
6811 *-*-unixware7*) add_dir="-L$dir" ;;
6813 # if the lib is a (non-dlopened) module then we can not
6814 # link against it, someone is ignoring the earlier warnings
6815 if /usr/bin/file -L $add 2> /dev/null |
6816 $GREP ": [^:]* bundle" >/dev/null ; then
6817 if test "X$dlopenmodule" != "X$lib"; then
6818 $ECHO "*** Warning: lib $linklib is a module, not a shared library"
6819 if test -z "$old_library" ; then
6821 echo "*** And there doesn't seem to be a static archive available"
6822 echo "*** The link will probably fail, sorry"
6824 add="$dir/$old_library"
6826 elif test -n "$old_library"; then
6827 add="$dir/$old_library"
6831 elif test "$hardcode_minus_L" = no; then
6833 *-*-sunos*) add_shlibpath="$dir" ;;
6837 elif test "$hardcode_shlibpath_var" = no; then
6838 add_shlibpath="$dir"
6845 if test "$hardcode_direct" = yes &&
6846 test "$hardcode_direct_absolute" = no; then
6848 elif test "$hardcode_minus_L" = yes; then
6850 # Try looking first in the location we're being installed to.
6851 if test -n "$inst_prefix_dir"; then
6854 func_append add_dir " -L$inst_prefix_dir$libdir"
6859 elif test "$hardcode_shlibpath_var" = yes; then
6860 add_shlibpath="$dir"
6869 if test "$lib_linked" != yes; then
6870 func_fatal_configuration "unsupported hardcode properties"
6873 if test -n "$add_shlibpath"; then
6874 case :$compile_shlibpath: in
6875 *":$add_shlibpath:"*) ;;
6876 *) func_append compile_shlibpath "$add_shlibpath:" ;;
6879 if test "$linkmode" = prog; then
6880 test -n "$add_dir" && compile_deplibs="$add_dir $compile_deplibs"
6881 test -n "$add" && compile_deplibs="$add $compile_deplibs"
6883 test -n "$add_dir" && deplibs="$add_dir $deplibs"
6884 test -n "$add" && deplibs="$add $deplibs"
6885 if test "$hardcode_direct" != yes &&
6886 test "$hardcode_minus_L" != yes &&
6887 test "$hardcode_shlibpath_var" = yes; then
6888 case :$finalize_shlibpath: in
6890 *) func_append finalize_shlibpath "$libdir:" ;;
6896 if test "$linkmode" = prog || test "$opt_mode" = relink; then
6900 # Finalize command for both is simple: just hardcode it.
6901 if test "$hardcode_direct" = yes &&
6902 test "$hardcode_direct_absolute" = no; then
6903 if test -f "$inst_prefix_dir$libdir/$linklib"; then
6904 add="$inst_prefix_dir$libdir/$linklib"
6906 add="$libdir/$linklib"
6908 elif test "$hardcode_minus_L" = yes; then
6911 elif test "$hardcode_shlibpath_var" = yes; then
6912 case :$finalize_shlibpath: in
6914 *) func_append finalize_shlibpath "$libdir:" ;;
6917 elif test "$hardcode_automatic" = yes; then
6918 if test -n "$inst_prefix_dir" &&
6919 test -f "$inst_prefix_dir$libdir/$linklib" ; then
6920 add="$inst_prefix_dir$libdir/$linklib"
6922 add="$libdir/$linklib"
6925 # We cannot seem to hardcode it, guess we'll fake it.
6927 # Try looking first in the location we're being installed to.
6928 if test -n "$inst_prefix_dir"; then
6931 func_append add_dir " -L$inst_prefix_dir$libdir"
6938 if test "$linkmode" = prog; then
6939 test -n "$add_dir" && finalize_deplibs="$add_dir $finalize_deplibs"
6940 test -n "$add" && finalize_deplibs="$add $finalize_deplibs"
6942 test -n "$add_dir" && deplibs="$add_dir $deplibs"
6943 test -n "$add" && deplibs="$add $deplibs"
6946 elif test "$linkmode" = prog; then
6947 # Here we assume that one of hardcode_direct or hardcode_minus_L
6948 # is not unsupported. This is valid on all known static and
6950 if test "$hardcode_direct" != unsupported; then
6951 test -n "$old_library" && linklib="$old_library"
6952 compile_deplibs="$dir/$linklib $compile_deplibs"
6953 finalize_deplibs="$dir/$linklib $finalize_deplibs"
6955 compile_deplibs="-l$name -L$dir $compile_deplibs"
6956 finalize_deplibs="-l$name -L$dir $finalize_deplibs"
6958 elif test "$build_libtool_libs" = yes; then
6959 # Not a shared library
6960 if test "$deplibs_check_method" != pass_all; then
6961 # We're trying link a shared library against a static one
6962 # but the system doesn't support it.
6964 # Just print a warning and add the library to dependency_libs so
6965 # that the program can be linked against the static library.
6967 $ECHO "*** Warning: This system can not link to static lib archive $lib."
6968 echo "*** I have the capability to make that library automatically link in when"
6969 echo "*** you link to this library. But I can only do this if you have a"
6970 echo "*** shared version of the library, which you do not appear to have."
6971 if test "$module" = yes; then
6972 echo "*** But as you try to build a module library, libtool will still create "
6973 echo "*** a static module, that should work as long as the dlopening application"
6974 echo "*** is linked with the -dlopen flag to resolve symbols at runtime."
6975 if test -z "$global_symbol_pipe"; then
6977 echo "*** However, this would only work if libtool was able to extract symbol"
6978 echo "*** lists from a program, using \`nm' or equivalent, but libtool could"
6979 echo "*** not find such a program. So, this module is probably useless."
6980 echo "*** \`nm' from GNU binutils and a full rebuild may help."
6982 if test "$build_old_libs" = no; then
6983 build_libtool_libs=module
6986 build_libtool_libs=no
6990 deplibs="$dir/$old_library $deplibs"
6993 fi # link shared/static library?
6995 if test "$linkmode" = lib; then
6996 if test -n "$dependency_libs" &&
6997 { test "$hardcode_into_libs" != yes ||
6998 test "$build_old_libs" = yes ||
6999 test "$link_static" = yes; }; then
7000 # Extract -R from dependency_libs
7002 for libdir in $dependency_libs; do
7004 -R*) func_stripname '-R' '' "$libdir"
7005 temp_xrpath=$func_stripname_result
7007 *" $temp_xrpath "*) ;;
7008 *) func_append xrpath " $temp_xrpath";;
7010 *) func_append temp_deplibs " $libdir";;
7013 dependency_libs="$temp_deplibs"
7016 func_append newlib_search_path " $absdir"
7017 # Link against this library
7018 test "$link_static" = no && newdependency_libs="$abs_ladir/$laname $newdependency_libs"
7019 # ... and its dependency_libs
7021 for deplib in $dependency_libs; do
7022 newdependency_libs="$deplib $newdependency_libs"
7024 -L*) func_stripname '-L' '' "$deplib"
7025 func_resolve_sysroot "$func_stripname_result";;
7026 *) func_resolve_sysroot "$deplib" ;;
7028 if $opt_preserve_dup_deps ; then
7029 case "$tmp_libs " in
7030 *" $func_resolve_sysroot_result "*)
7031 func_append specialdeplibs " $func_resolve_sysroot_result" ;;
7034 func_append tmp_libs " $func_resolve_sysroot_result"
7037 if test "$link_all_deplibs" != no; then
7038 # Add the search paths of all dependency libraries
7039 for deplib in $dependency_libs; do
7042 -L*) path="$deplib" ;;
7044 func_resolve_sysroot "$deplib"
7045 deplib=$func_resolve_sysroot_result
7046 func_dirname "$deplib" "" "."
7047 dir=$func_dirname_result
7048 # We need an absolute path.
7050 [\\/]* | [A-Za-z]:[\\/]*) absdir="$dir" ;;
7052 absdir=`cd "$dir" && pwd`
7053 if test -z "$absdir"; then
7054 func_warning "cannot determine absolute directory name of \`$dir'"
7059 if $GREP "^installed=no" $deplib > /dev/null; then
7063 eval deplibrary_names=`${SED} -n -e 's/^library_names=\(.*\)$/\1/p' $deplib`
7064 if test -n "$deplibrary_names" ; then
7065 for tmp in $deplibrary_names ; do
7068 if test -f "$absdir/$objdir/$depdepl" ; then
7069 depdepl="$absdir/$objdir/$depdepl"
7070 darwin_install_name=`${OTOOL} -L $depdepl | awk '{if (NR == 2) {print $1;exit}}'`
7071 if test -z "$darwin_install_name"; then
7072 darwin_install_name=`${OTOOL64} -L $depdepl | awk '{if (NR == 2) {print $1;exit}}'`
7074 func_append compiler_flags " ${wl}-dylib_file ${wl}${darwin_install_name}:${depdepl}"
7075 func_append linker_flags " -dylib_file ${darwin_install_name}:${depdepl}"
7081 path="-L$absdir/$objdir"
7085 eval libdir=`${SED} -n -e 's/^libdir=\(.*\)$/\1/p' $deplib`
7086 test -z "$libdir" && \
7087 func_fatal_error "\`$deplib' is not a valid libtool archive"
7088 test "$absdir" != "$libdir" && \
7089 func_warning "\`$deplib' seems to be moved"
7095 case " $deplibs " in
7097 *) deplibs="$path $deplibs" ;;
7100 fi # link_all_deplibs != no
7102 done # for deplib in $libs
7103 if test "$pass" = link; then
7104 if test "$linkmode" = "prog"; then
7105 compile_deplibs="$new_inherited_linker_flags $compile_deplibs"
7106 finalize_deplibs="$new_inherited_linker_flags $finalize_deplibs"
7108 compiler_flags="$compiler_flags "`$ECHO " $new_inherited_linker_flags" | $SED 's% \([^ $]*\).ltframework% -framework \1%g'`
7111 dependency_libs="$newdependency_libs"
7112 if test "$pass" = dlpreopen; then
7113 # Link the dlpreopened libraries before other libraries
7114 for deplib in $save_deplibs; do
7115 deplibs="$deplib $deplibs"
7118 if test "$pass" != dlopen; then
7119 if test "$pass" != conv; then
7120 # Make sure lib_search_path contains only unique directories.
7122 for dir in $newlib_search_path; do
7123 case "$lib_search_path " in
7125 *) func_append lib_search_path " $dir" ;;
7131 if test "$linkmode,$pass" != "prog,link"; then
7134 vars="compile_deplibs finalize_deplibs"
7136 for var in $vars dependency_libs; do
7137 # Add libraries to $var in reverse order
7138 eval tmp_libs=\"\$$var\"
7140 for deplib in $tmp_libs; do
7141 # FIXME: Pedantically, this is the right thing to do, so
7142 # that some nasty dependency loop isn't accidentally
7144 #new_libs="$deplib $new_libs"
7145 # Pragmatically, this seems to cause very few problems in
7148 -L*) new_libs="$deplib $new_libs" ;;
7151 # And here is the reason: when a library appears more
7152 # than once as an explicit dependence of a library, or
7153 # is implicitly linked in more than once by the
7154 # compiler, it is considered special, and multiple
7155 # occurrences thereof are not removed. Compare this
7156 # with having the same library being listed as a
7157 # dependency of multiple other libraries: in this case,
7158 # we know (pedantically, we assume) the library does not
7159 # need to be listed more than once, so we keep only the
7160 # last copy. This is not always right, but it is rare
7161 # enough that we require users that really mean to play
7162 # such unportable linking tricks to link the library
7163 # using -Wl,-lname, so that libtool does not consider it
7164 # for duplicate removal.
7165 case " $specialdeplibs " in
7166 *" $deplib "*) new_libs="$deplib $new_libs" ;;
7168 case " $new_libs " in
7170 *) new_libs="$deplib $new_libs" ;;
7178 for deplib in $new_libs; do
7181 case " $tmp_libs " in
7183 *) func_append tmp_libs " $deplib" ;;
7186 *) func_append tmp_libs " $deplib" ;;
7189 eval $var=\"$tmp_libs\"
7192 # Last step: remove runtime libs from dependency_libs
7193 # (they stay in deplibs)
7195 for i in $dependency_libs ; do
7196 case " $predeps $postdeps $compiler_lib_search_path " in
7201 if test -n "$i" ; then
7202 func_append tmp_libs " $i"
7205 dependency_libs=$tmp_libs
7207 if test "$linkmode" = prog; then
7208 dlfiles="$newdlfiles"
7210 if test "$linkmode" = prog || test "$linkmode" = lib; then
7211 dlprefiles="$newdlprefiles"
7216 if test -n "$dlfiles$dlprefiles" || test "$dlself" != no; then
7217 func_warning "\`-dlopen' is ignored for archives"
7222 func_warning "\`-l' and \`-L' are ignored for archives" ;;
7225 test -n "$rpath" && \
7226 func_warning "\`-rpath' is ignored for archives"
7228 test -n "$xrpath" && \
7229 func_warning "\`-R' is ignored for archives"
7231 test -n "$vinfo" && \
7232 func_warning "\`-version-info/-version-number' is ignored for archives"
7234 test -n "$release" && \
7235 func_warning "\`-release' is ignored for archives"
7237 test -n "$export_symbols$export_symbols_regex" && \
7238 func_warning "\`-export-symbols' is ignored for archives"
7240 # Now set the variables for building old libraries.
7241 build_libtool_libs=no
7243 func_append objs "$old_deplibs"
7247 # Make sure we only generate libraries of the form `libNAME.la'.
7250 func_stripname 'lib' '.la' "$outputname"
7251 name=$func_stripname_result
7252 eval shared_ext=\"$shrext_cmds\"
7253 eval libname=\"$libname_spec\"
7256 test "$module" = no && \
7257 func_fatal_help "libtool library \`$output' must begin with \`lib'"
7259 if test "$need_lib_prefix" != no; then
7260 # Add the "lib" prefix for modules if required
7261 func_stripname '' '.la' "$outputname"
7262 name=$func_stripname_result
7263 eval shared_ext=\"$shrext_cmds\"
7264 eval libname=\"$libname_spec\"
7266 func_stripname '' '.la' "$outputname"
7267 libname=$func_stripname_result
7272 if test -n "$objs"; then
7273 if test "$deplibs_check_method" != pass_all; then
7274 func_fatal_error "cannot build libtool library \`$output' from non-libtool objects on this host:$objs"
7277 $ECHO "*** Warning: Linking the shared library $output against the non-libtool"
7278 $ECHO "*** objects $objs is not portable!"
7279 func_append libobjs " $objs"
7283 test "$dlself" != no && \
7284 func_warning "\`-dlopen self' is ignored for libtool libraries"
7288 test "$#" -gt 1 && \
7289 func_warning "ignoring multiple \`-rpath's for a libtool library"
7294 if test -z "$rpath"; then
7295 if test "$build_libtool_libs" = yes; then
7296 # Building a libtool convenience library.
7297 # Some compilers have problems with a `.al' extension so
7298 # convenience libraries should have the same extension an
7299 # archive normally would.
7300 oldlibs="$output_objdir/$libname.$libext $oldlibs"
7301 build_libtool_libs=convenience
7305 test -n "$vinfo" && \
7306 func_warning "\`-version-info/-version-number' is ignored for convenience libraries"
7308 test -n "$release" && \
7309 func_warning "\`-release' is ignored for convenience libraries"
7312 # Parse the version information argument.
7313 save_ifs="$IFS"; IFS=':'
7314 set dummy $vinfo 0 0 0
7319 func_fatal_help "too many parameters to \`-version-info'"
7321 # convert absolute version numbers to libtool ages
7322 # this retains compatibility with .la files and attempts
7323 # to make the code below a bit more comprehensible
7325 case $vinfo_number in
7329 number_revision="$3"
7331 # There are really only two kinds -- those that
7332 # use the current revision as the major version
7333 # and those that subtract age and use age as
7334 # a minor version. But, then there is irix
7335 # which has an extra 1 added just for fun
7337 case $version_type in
7338 # correct linux to gnu/linux during the next big refactor
7339 darwin|linux|osf|windows|none)
7340 func_arith $number_major + $number_minor
7341 current=$func_arith_result
7343 revision="$number_revision"
7345 freebsd-aout|freebsd-elf|qnx|sunos)
7346 current="$number_major"
7347 revision="$number_minor"
7351 func_arith $number_major + $number_minor
7352 current=$func_arith_result
7354 revision="$number_minor"
7355 lt_irix_increment=no
7366 # Check that each of the things are valid numbers.
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 "CURRENT \`$current' 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 "REVISION \`$revision' must be a nonnegative integer"
7379 func_fatal_error "\`$vinfo' is not valid version information"
7384 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]) ;;
7386 func_error "AGE \`$age' must be a nonnegative integer"
7387 func_fatal_error "\`$vinfo' is not valid version information"
7391 if test "$age" -gt "$current"; then
7392 func_error "AGE \`$age' is greater than the current interface number \`$current'"
7393 func_fatal_error "\`$vinfo' is not valid version information"
7396 # Calculate the version variables.
7401 case $version_type in
7405 # Like Linux, but with the current version available in
7406 # verstring for coding it into the library header
7407 func_arith $current - $age
7408 major=.$func_arith_result
7409 versuffix="$major.$age.$revision"
7410 # Darwin ld doesn't like 0 for these options...
7411 func_arith $current + 1
7412 minor_current=$func_arith_result
7413 xlcverstring="${wl}-compatibility_version ${wl}$minor_current ${wl}-current_version ${wl}$minor_current.$revision"
7414 verstring="-compatibility_version $minor_current -current_version $minor_current.$revision"
7419 versuffix=".$current.$revision";
7424 versuffix=".$current"
7428 if test "X$lt_irix_increment" = "Xno"; then
7429 func_arith $current - $age
7431 func_arith $current - $age + 1
7433 major=$func_arith_result
7435 case $version_type in
7436 nonstopux) verstring_prefix=nonstopux ;;
7437 *) verstring_prefix=sgi ;;
7439 verstring="$verstring_prefix$major.$revision"
7441 # Add in all the interfaces that we are compatible with.
7443 while test "$loop" -ne 0; do
7444 func_arith $revision - $loop
7445 iface=$func_arith_result
7446 func_arith $loop - 1
7447 loop=$func_arith_result
7448 verstring="$verstring_prefix$major.$iface:$verstring"
7451 # Before this point, $major must not contain `.'.
7453 versuffix="$major.$revision"
7456 linux) # correct to gnu/linux during the next big refactor
7457 func_arith $current - $age
7458 major=.$func_arith_result
7459 versuffix="$major.$age.$revision"
7460 versuffix2="$major.$age"
7464 func_arith $current - $age
7465 major=.$func_arith_result
7466 versuffix=".$current.$age.$revision"
7467 verstring="$current.$age.$revision"
7469 # Add in all the interfaces that we are compatible with.
7471 while test "$loop" -ne 0; do
7472 func_arith $current - $loop
7473 iface=$func_arith_result
7474 func_arith $loop - 1
7475 loop=$func_arith_result
7476 verstring="$verstring:${iface}.0"
7479 # Make executables depend on our current version.
7480 func_append verstring ":${current}.0"
7485 versuffix=".$current"
7490 versuffix=".$current.$revision"
7494 # Use '-' rather than '.', since we only want one
7495 # extension on DOS 8.3 filesystems.
7496 func_arith $current - $age
7497 major=$func_arith_result
7502 func_fatal_configuration "unknown library version type \`$version_type'"
7506 # Clear the version info if we defaulted, and they specified a release.
7507 if test -z "$vinfo" && test -n "$release"; then
7509 case $version_type in
7511 # we can't check for "0.0" in archive_cmds due to quoting
7512 # problems, so we reset it completely
7519 if test "$need_version" = no; then
7528 # Remove version info from name if versioning should be avoided
7529 if test "$avoid_version" = yes && test "$need_version" = no; then
7536 # Check to see if the archive will have undefined symbols.
7537 if test "$allow_undefined" = yes; then
7538 if test "$allow_undefined_flag" = unsupported; then
7539 func_warning "undefined symbols not allowed in $host shared libraries"
7540 build_libtool_libs=no
7544 # Don't allow undefined symbols.
7545 allow_undefined_flag="$no_undefined_flag"
7550 func_generate_dlsyms "$libname" "$libname" "yes"
7551 func_append libobjs " $symfileobj"
7552 test "X$libobjs" = "X " && libobjs=
7554 if test "$opt_mode" != relink; then
7555 # Remove our outputs, but don't remove object files since they
7556 # may have been created when compiling PIC objects.
7558 tempremovelist=`$ECHO "$output_objdir/*"`
7559 for p in $tempremovelist; do
7563 $output_objdir/$outputname | $output_objdir/$libname.* | $output_objdir/${libname}${release}.*)
7564 if test "X$precious_files_regex" != "X"; then
7565 if $ECHO "$p" | $EGREP -e "$precious_files_regex" >/dev/null 2>&1
7570 func_append removelist " $p"
7575 test -n "$removelist" && \
7576 func_show_eval "${RM}r \$removelist"
7579 # Now set the variables for building old libraries.
7580 if test "$build_old_libs" = yes && test "$build_libtool_libs" != convenience ; then
7581 func_append oldlibs " $output_objdir/$libname.$libext"
7583 # Transform .lo files to .o files.
7584 oldobjs="$objs "`$ECHO "$libobjs" | $SP2NL | $SED "/\.${libext}$/d; $lo2o" | $NL2SP`
7587 # Eliminate all temporary directories.
7588 #for path in $notinst_path; do
7589 # lib_search_path=`$ECHO "$lib_search_path " | $SED "s% $path % %g"`
7590 # deplibs=`$ECHO "$deplibs " | $SED "s% -L$path % %g"`
7591 # dependency_libs=`$ECHO "$dependency_libs " | $SED "s% -L$path % %g"`
7594 if test -n "$xrpath"; then
7595 # If the user specified any rpath flags, then add them.
7597 for libdir in $xrpath; do
7598 func_replace_sysroot "$libdir"
7599 func_append temp_xrpath " -R$func_replace_sysroot_result"
7600 case "$finalize_rpath " in
7602 *) func_append finalize_rpath " $libdir" ;;
7605 if test "$hardcode_into_libs" != yes || test "$build_old_libs" = yes; then
7606 dependency_libs="$temp_xrpath $dependency_libs"
7610 # Make sure dlfiles contains only unique files that won't be dlpreopened
7611 old_dlfiles="$dlfiles"
7613 for lib in $old_dlfiles; do
7614 case " $dlprefiles $dlfiles " in
7616 *) func_append dlfiles " $lib" ;;
7620 # Make sure dlprefiles contains only unique files
7621 old_dlprefiles="$dlprefiles"
7623 for lib in $old_dlprefiles; do
7624 case "$dlprefiles " in
7626 *) func_append dlprefiles " $lib" ;;
7630 if test "$build_libtool_libs" = yes; then
7631 if test -n "$rpath"; then
7633 *-*-cygwin* | *-*-mingw* | *-*-pw32* | *-*-os2* | *-*-beos* | *-cegcc* | *-*-haiku*)
7634 # these systems don't actually have a c library (as such)!
7636 *-*-rhapsody* | *-*-darwin1.[012])
7637 # Rhapsody C library is in the System framework
7638 func_append deplibs " System.ltframework"
7641 # Don't link with libc until the a.out ld.so is fixed.
7643 *-*-openbsd* | *-*-mirbsd* | *-*-freebsd* | *-*-dragonfly*)
7644 # Do not include libc due to us having libc/libc_r.
7646 *-*-sco3.2v5* | *-*-sco5v6*)
7647 # Causes problems with __ctype
7649 *-*-sysv4.2uw2* | *-*-sysv5* | *-*-unixware* | *-*-OpenUNIX*)
7650 # Compiler inserts libc in the correct place for threads to work
7653 # Add libc to deplibs on all other systems if necessary.
7654 if test "$build_libtool_need_lc" = "yes"; then
7655 func_append deplibs " -lc"
7661 # Transform deplibs into only deplibs that can be linked in shared.
7663 libname_save=$libname
7664 release_save=$release
7665 versuffix_save=$versuffix
7666 versuffix2_save=$versuffix2
7668 # I'm not sure if I'm treating the release correctly. I think
7669 # release should show up in the -l (ie -lgmp5) so we don't want to
7670 # add it in twice. Is that correct?
7677 case $deplibs_check_method in
7679 # Don't check for shared/static. Everything works.
7680 # This might be a little naive. We might want to check
7681 # whether the library exists or not. But this is on
7682 # osf3 & osf4 and I'm not really sure... Just
7683 # implementing what was already the behavior.
7687 # This code stresses the "libraries are programs" paradigm to its
7688 # limits. Maybe even breaks it. We compile a program, linking it
7689 # against the deplibs as a proxy for the library. Then we can check
7690 # whether they linked in statically or dynamically with ldd.
7691 $opt_dry_run || $RM conftest.c
7692 cat > conftest.c <<EOF
7693 int main() { return 0; }
7695 $opt_dry_run || $RM conftest
7696 if $LTCC $LTCFLAGS -o conftest conftest.c $deplibs; then
7697 ldd_output=`ldd conftest`
7698 for i in $deplibs; do
7701 func_stripname -l '' "$i"
7702 name=$func_stripname_result
7703 if test "X$allow_libtool_libs_with_static_runtimes" = "Xyes" ; then
7704 case " $predeps $postdeps " in
7706 func_append newdeplibs " $i"
7711 if test -n "$i" ; then
7712 libname=`eval "\\$ECHO \"$libname_spec\""`
7713 deplib_matches=`eval "\\$ECHO \"$library_names_spec\""`
7714 set dummy $deplib_matches; shift
7716 if test `expr "$ldd_output" : ".*$deplib_match"` -ne 0 ; then
7717 func_append newdeplibs " $i"
7721 $ECHO "*** Warning: dynamic linker does not accept needed library $i."
7722 echo "*** I have the capability to make that library automatically link in when"
7723 echo "*** you link to this library. But I can only do this if you have a"
7724 echo "*** shared version of the library, which I believe you do not have"
7725 echo "*** because a test_compile did reveal that the linker did not use it for"
7726 echo "*** its dynamic dependency list that programs get resolved with at runtime."
7731 func_append newdeplibs " $i"
7736 # Error occurred in the first compile. Let's try to salvage
7737 # the situation: Compile a separate program for each library.
7738 for i in $deplibs; do
7741 func_stripname -l '' "$i"
7742 name=$func_stripname_result
7743 $opt_dry_run || $RM conftest
7744 if $LTCC $LTCFLAGS -o conftest conftest.c $i; then
7745 ldd_output=`ldd conftest`
7746 if test "X$allow_libtool_libs_with_static_runtimes" = "Xyes" ; then
7747 case " $predeps $postdeps " in
7749 func_append newdeplibs " $i"
7754 if test -n "$i" ; then
7755 libname=`eval "\\$ECHO \"$libname_spec\""`
7756 deplib_matches=`eval "\\$ECHO \"$library_names_spec\""`
7757 set dummy $deplib_matches; shift
7759 if test `expr "$ldd_output" : ".*$deplib_match"` -ne 0 ; then
7760 func_append newdeplibs " $i"
7764 $ECHO "*** Warning: dynamic linker does not accept needed library $i."
7765 echo "*** I have the capability to make that library automatically link in when"
7766 echo "*** you link to this library. But I can only do this if you have a"
7767 echo "*** shared version of the library, which you do not appear to have"
7768 echo "*** because a test_compile did reveal that the linker did not use this one"
7769 echo "*** as a dynamic dependency that programs can get resolved with at runtime."
7775 $ECHO "*** Warning! Library $i is needed by this library but I was not able to"
7776 echo "*** make it link in! You will probably need to install it or some"
7777 echo "*** library that it depends on before this library will be fully"
7778 echo "*** functional. Installing it before continuing would be even better."
7782 func_append newdeplibs " $i"
7789 set dummy $deplibs_check_method; shift
7790 file_magic_regex=`expr "$deplibs_check_method" : "$1 \(.*\)"`
7791 for a_deplib in $deplibs; do
7794 func_stripname -l '' "$a_deplib"
7795 name=$func_stripname_result
7796 if test "X$allow_libtool_libs_with_static_runtimes" = "Xyes" ; then
7797 case " $predeps $postdeps " in
7799 func_append newdeplibs " $a_deplib"
7804 if test -n "$a_deplib" ; then
7805 libname=`eval "\\$ECHO \"$libname_spec\""`
7806 if test -n "$file_magic_glob"; then
7807 libnameglob=`func_echo_all "$libname" | $SED -e $file_magic_glob`
7809 libnameglob=$libname
7811 test "$want_nocaseglob" = yes && nocaseglob=`shopt -p nocaseglob`
7812 for i in $lib_search_path $sys_lib_search_path $shlib_search_path; do
7813 if test "$want_nocaseglob" = yes; then
7815 potential_libs=`ls $i/$libnameglob[.-]* 2>/dev/null`
7818 potential_libs=`ls $i/$libnameglob[.-]* 2>/dev/null`
7820 for potent_lib in $potential_libs; do
7821 # Follow soft links.
7822 if ls -lLd "$potent_lib" 2>/dev/null |
7823 $GREP " -> " >/dev/null; then
7826 # The statement above tries to avoid entering an
7827 # endless loop below, in case of cyclic links.
7828 # We might still enter an endless loop, since a link
7829 # loop can be closed while we follow links,
7831 potlib="$potent_lib"
7832 while test -h "$potlib" 2>/dev/null; do
7833 potliblink=`ls -ld $potlib | ${SED} 's/.* -> //'`
7835 [\\/]* | [A-Za-z]:[\\/]*) potlib="$potliblink";;
7836 *) potlib=`$ECHO "$potlib" | $SED 's,[^/]*$,,'`"$potliblink";;
7839 if eval $file_magic_cmd \"\$potlib\" 2>/dev/null |
7841 $EGREP "$file_magic_regex" > /dev/null; then
7842 func_append newdeplibs " $a_deplib"
7849 if test -n "$a_deplib" ; then
7852 $ECHO "*** Warning: linker path does not have real file for library $a_deplib."
7853 echo "*** I have the capability to make that library automatically link in when"
7854 echo "*** you link to this library. But I can only do this if you have a"
7855 echo "*** shared version of the library, which you do not appear to have"
7856 echo "*** because I did check the linker path looking for a file starting"
7857 if test -z "$potlib" ; then
7858 $ECHO "*** with $libname but no candidates were found. (...for file magic test)"
7860 $ECHO "*** with $libname and none of the candidates passed a file format test"
7861 $ECHO "*** using a file magic. Last file checked: $potlib"
7866 # Add a -L argument.
7867 func_append newdeplibs " $a_deplib"
7870 done # Gone through all deplibs.
7873 set dummy $deplibs_check_method; shift
7874 match_pattern_regex=`expr "$deplibs_check_method" : "$1 \(.*\)"`
7875 for a_deplib in $deplibs; do
7878 func_stripname -l '' "$a_deplib"
7879 name=$func_stripname_result
7880 if test "X$allow_libtool_libs_with_static_runtimes" = "Xyes" ; then
7881 case " $predeps $postdeps " in
7883 func_append newdeplibs " $a_deplib"
7888 if test -n "$a_deplib" ; then
7889 libname=`eval "\\$ECHO \"$libname_spec\""`
7890 for i in $lib_search_path $sys_lib_search_path $shlib_search_path; do
7891 potential_libs=`ls $i/$libname[.-]* 2>/dev/null`
7892 for potent_lib in $potential_libs; do
7893 potlib="$potent_lib" # see symlink-check above in file_magic test
7894 if eval "\$ECHO \"$potent_lib\"" 2>/dev/null | $SED 10q | \
7895 $EGREP "$match_pattern_regex" > /dev/null; then
7896 func_append newdeplibs " $a_deplib"
7903 if test -n "$a_deplib" ; then
7906 $ECHO "*** Warning: linker path does not have real file for library $a_deplib."
7907 echo "*** I have the capability to make that library automatically link in when"
7908 echo "*** you link to this library. But I can only do this if you have a"
7909 echo "*** shared version of the library, which you do not appear to have"
7910 echo "*** because I did check the linker path looking for a file starting"
7911 if test -z "$potlib" ; then
7912 $ECHO "*** with $libname but no candidates were found. (...for regex pattern test)"
7914 $ECHO "*** with $libname and none of the candidates passed a file format test"
7915 $ECHO "*** using a regex pattern. Last file checked: $potlib"
7920 # Add a -L argument.
7921 func_append newdeplibs " $a_deplib"
7924 done # Gone through all deplibs.
7928 tmp_deplibs=`$ECHO " $deplibs" | $SED 's/ -lc$//; s/ -[LR][^ ]*//g'`
7929 if test "X$allow_libtool_libs_with_static_runtimes" = "Xyes" ; then
7930 for i in $predeps $postdeps ; do
7931 # can't use Xsed below, because $i might contain '/'
7932 tmp_deplibs=`$ECHO " $tmp_deplibs" | $SED "s,$i,,"`
7935 case $tmp_deplibs in
7938 if test "X$deplibs_check_method" = "Xnone"; then
7939 echo "*** Warning: inter-library dependencies are not supported in this platform."
7941 echo "*** Warning: inter-library dependencies are not known to be supported."
7943 echo "*** All declared inter-library dependencies are being dropped."
7949 versuffix=$versuffix_save
7950 versuffix2=$versuffix2_save
7952 release=$release_save
7953 libname=$libname_save
7957 *-*-rhapsody* | *-*-darwin1.[012])
7958 # On Rhapsody replace the C library with the System framework
7959 newdeplibs=`$ECHO " $newdeplibs" | $SED 's/ -lc / System.ltframework /'`
7963 if test "$droppeddeps" = yes; then
7964 if test "$module" = yes; then
7966 echo "*** Warning: libtool could not satisfy all declared inter-library"
7967 $ECHO "*** dependencies of module $libname. Therefore, libtool will create"
7968 echo "*** a static module, that should work as long as the dlopening"
7969 echo "*** application is linked with the -dlopen flag."
7970 if test -z "$global_symbol_pipe"; then
7972 echo "*** However, this would only work if libtool was able to extract symbol"
7973 echo "*** lists from a program, using \`nm' or equivalent, but libtool could"
7974 echo "*** not find such a program. So, this module is probably useless."
7975 echo "*** \`nm' from GNU binutils and a full rebuild may help."
7977 if test "$build_old_libs" = no; then
7978 oldlibs="$output_objdir/$libname.$libext"
7979 build_libtool_libs=module
7982 build_libtool_libs=no
7985 echo "*** The inter-library dependencies that have been dropped here will be"
7986 echo "*** automatically added whenever a program is linked with this library"
7987 echo "*** or is declared to -dlopen it."
7989 if test "$allow_undefined" = no; then
7991 echo "*** Since this library must not contain undefined symbols,"
7992 echo "*** because either the platform does not support them or"
7993 echo "*** it was explicitly requested with -no-undefined,"
7994 echo "*** libtool will only create a static version of it."
7995 if test "$build_old_libs" = no; then
7996 oldlibs="$output_objdir/$libname.$libext"
7997 build_libtool_libs=module
8000 build_libtool_libs=no
8005 # Done checking deplibs!
8008 # Time to change all our "foo.ltframework" stuff back to "-framework foo"
8011 newdeplibs=`$ECHO " $newdeplibs" | $SED 's% \([^ $]*\).ltframework% -framework \1%g'`
8012 new_inherited_linker_flags=`$ECHO " $new_inherited_linker_flags" | $SED 's% \([^ $]*\).ltframework% -framework \1%g'`
8013 deplibs=`$ECHO " $deplibs" | $SED 's% \([^ $]*\).ltframework% -framework \1%g'`
8017 # move library search paths that coincide with paths to not yet
8018 # installed libraries to the beginning of the library search list
8020 for path in $notinst_path; do
8021 case " $new_libs " in
8022 *" -L$path/$objdir "*) ;;
8024 case " $deplibs " in
8025 *" -L$path/$objdir "*)
8026 func_append new_libs " -L$path/$objdir" ;;
8031 for deplib in $deplibs; do
8034 case " $new_libs " in
8036 *) func_append new_libs " $deplib" ;;
8039 *) func_append new_libs " $deplib" ;;
8044 # All the library-specific variables (install_libdir is set above).
8049 # Test again, we may have decided not to build it any more
8050 if test "$build_libtool_libs" = yes; then
8051 # Remove ${wl} instances when linking with ld.
8052 # FIXME: should test the right _cmds variable.
8053 case $archive_cmds in
8056 if test "$hardcode_into_libs" = yes; then
8057 # Hardcode the library paths
8060 rpath="$finalize_rpath"
8061 test "$opt_mode" != relink && rpath="$compile_rpath$rpath"
8062 for libdir in $rpath; do
8063 if test -n "$hardcode_libdir_flag_spec"; then
8064 if test -n "$hardcode_libdir_separator"; then
8065 func_replace_sysroot "$libdir"
8066 libdir=$func_replace_sysroot_result
8067 if test -z "$hardcode_libdirs"; then
8068 hardcode_libdirs="$libdir"
8070 # Just accumulate the unique libdirs.
8071 case $hardcode_libdir_separator$hardcode_libdirs$hardcode_libdir_separator in
8072 *"$hardcode_libdir_separator$libdir$hardcode_libdir_separator"*)
8075 func_append hardcode_libdirs "$hardcode_libdir_separator$libdir"
8080 eval flag=\"$hardcode_libdir_flag_spec\"
8081 func_append dep_rpath " $flag"
8083 elif test -n "$runpath_var"; then
8084 case "$perm_rpath " in
8086 *) func_append perm_rpath " $libdir" ;;
8090 # Substitute the hardcoded libdirs into the rpath.
8091 if test -n "$hardcode_libdir_separator" &&
8092 test -n "$hardcode_libdirs"; then
8093 libdir="$hardcode_libdirs"
8094 eval "dep_rpath=\"$hardcode_libdir_flag_spec\""
8096 if test -n "$runpath_var" && test -n "$perm_rpath"; then
8097 # We should set the runpath_var.
8099 for dir in $perm_rpath; do
8100 func_append rpath "$dir:"
8102 eval "$runpath_var='$rpath\$$runpath_var'; export $runpath_var"
8104 test -n "$dep_rpath" && deplibs="$dep_rpath $deplibs"
8107 shlibpath="$finalize_shlibpath"
8108 test "$opt_mode" != relink && shlibpath="$compile_shlibpath$shlibpath"
8109 if test -n "$shlibpath"; then
8110 eval "$shlibpath_var='$shlibpath\$$shlibpath_var'; export $shlibpath_var"
8113 # Get the real and link names of the library.
8114 eval shared_ext=\"$shrext_cmds\"
8115 eval library_names=\"$library_names_spec\"
8116 set dummy $library_names
8121 if test -n "$soname_spec"; then
8122 eval soname=\"$soname_spec\"
8126 if test -z "$dlname"; then
8130 lib="$output_objdir/$realname"
8134 func_append linknames " $link"
8137 # Use standard objects if they are pic
8138 test -z "$pic_flag" && libobjs=`$ECHO "$libobjs" | $SP2NL | $SED "$lo2o" | $NL2SP`
8139 test "X$libobjs" = "X " && libobjs=
8142 if test -n "$export_symbols" && test -n "$include_expsyms"; then
8143 $opt_dry_run || cp "$export_symbols" "$output_objdir/$libname.uexp"
8144 export_symbols="$output_objdir/$libname.uexp"
8145 func_append delfiles " $export_symbols"
8148 orig_export_symbols=
8150 cygwin* | mingw* | cegcc*)
8151 if test -n "$export_symbols" && test -z "$export_symbols_regex"; then
8152 # exporting using user supplied symfile
8153 if test "x`$SED 1q $export_symbols`" != xEXPORTS; then
8154 # and it's NOT already a .def file. Must figure out
8155 # which of the given symbols are data symbols and tag
8156 # them as such. So, trigger use of export_symbols_cmds.
8157 # export_symbols gets reassigned inside the "prepare
8158 # the list of exported symbols" if statement, so the
8159 # include_expsyms logic still works.
8160 orig_export_symbols="$export_symbols"
8162 always_export_symbols=yes
8168 # Prepare the list of exported symbols
8169 if test -z "$export_symbols"; then
8170 if test "$always_export_symbols" = yes || test -n "$export_symbols_regex"; then
8171 func_verbose "generating symbol list for \`$libname.la'"
8172 export_symbols="$output_objdir/$libname.exp"
8173 $opt_dry_run || $RM $export_symbols
8174 cmds=$export_symbols_cmds
8175 save_ifs="$IFS"; IFS='~'
8176 for cmd1 in $cmds; do
8178 # Take the normal branch if the nm_file_list_spec branch
8179 # doesn't work or if tool conversion is not needed.
8180 case $nm_file_list_spec~$to_tool_file_cmd in
8181 *~func_convert_file_noop | *~func_convert_file_msys_to_w32 | ~*)
8182 try_normal_branch=yes
8185 len=$func_len_result
8188 try_normal_branch=no
8191 if test "$try_normal_branch" = yes \
8192 && { test "$len" -lt "$max_cmd_len" \
8193 || test "$max_cmd_len" -le -1; }
8195 func_show_eval "$cmd" 'exit $?'
8196 skipped_export=false
8197 elif test -n "$nm_file_list_spec"; then
8198 func_basename "$output"
8199 output_la=$func_basename_result
8200 save_libobjs=$libobjs
8202 output=${output_objdir}/${output_la}.nm
8203 func_to_tool_file "$output"
8204 libobjs=$nm_file_list_spec$func_to_tool_file_result
8205 func_append delfiles " $output"
8206 func_verbose "creating $NM input file list: $output"
8207 for obj in $save_libobjs; do
8208 func_to_tool_file "$obj"
8209 $ECHO "$func_to_tool_file_result"
8212 func_show_eval "$cmd" 'exit $?'
8214 libobjs=$save_libobjs
8215 skipped_export=false
8217 # The command line is too long to execute in one step.
8218 func_verbose "using reloadable object file for export list..."
8220 # Break out early, otherwise skipped_export may be
8221 # set to false by a later but shorter cmd.
8226 if test -n "$export_symbols_regex" && test "X$skipped_export" != "X:"; then
8227 func_show_eval '$EGREP -e "$export_symbols_regex" "$export_symbols" > "${export_symbols}T"'
8228 func_show_eval '$MV "${export_symbols}T" "$export_symbols"'
8233 if test -n "$export_symbols" && test -n "$include_expsyms"; then
8234 tmp_export_symbols="$export_symbols"
8235 test -n "$orig_export_symbols" && tmp_export_symbols="$orig_export_symbols"
8236 $opt_dry_run || eval '$ECHO "$include_expsyms" | $SP2NL >> "$tmp_export_symbols"'
8239 if test "X$skipped_export" != "X:" && test -n "$orig_export_symbols"; then
8240 # The given exports_symbols file has to be filtered, so filter it.
8241 func_verbose "filter symbol list for \`$libname.la' to tag DATA exports"
8242 # FIXME: $output_objdir/$libname.filter potentially contains lots of
8243 # 's' commands which not all seds can handle. GNU sed should be fine
8244 # though. Also, the filter scales superlinearly with the number of
8245 # global variables. join(1) would be nice here, but unfortunately
8246 # isn't a blessed tool.
8247 $opt_dry_run || $SED -e '/[ ,]DATA/!d;s,\(.*\)\([ \,].*\),s|^\1$|\1\2|,' < $export_symbols > $output_objdir/$libname.filter
8248 func_append delfiles " $export_symbols $output_objdir/$libname.filter"
8249 export_symbols=$output_objdir/$libname.def
8250 $opt_dry_run || $SED -f $output_objdir/$libname.filter < $orig_export_symbols > $export_symbols
8254 for test_deplib in $deplibs; do
8255 case " $convenience " in
8256 *" $test_deplib "*) ;;
8258 func_append tmp_deplibs " $test_deplib"
8262 deplibs="$tmp_deplibs"
8264 if test -n "$convenience"; then
8265 if test -n "$whole_archive_flag_spec" &&
8266 test "$compiler_needs_object" = yes &&
8267 test -z "$libobjs"; then
8268 # extract the archives, so we have objects to list.
8269 # TODO: could optimize this to just extract one archive.
8270 whole_archive_flag_spec=
8272 if test -n "$whole_archive_flag_spec"; then
8273 save_libobjs=$libobjs
8274 eval libobjs=\"\$libobjs $whole_archive_flag_spec\"
8275 test "X$libobjs" = "X " && libobjs=
8277 gentop="$output_objdir/${outputname}x"
8278 func_append generated " $gentop"
8280 func_extract_archives $gentop $convenience
8281 func_append libobjs " $func_extract_archives_result"
8282 test "X$libobjs" = "X " && libobjs=
8286 if test "$thread_safe" = yes && test -n "$thread_safe_flag_spec"; then
8287 eval flag=\"$thread_safe_flag_spec\"
8288 func_append linker_flags " $flag"
8291 # Make a backup of the uninstalled library when relinking
8292 if test "$opt_mode" = relink; then
8293 $opt_dry_run || eval '(cd $output_objdir && $RM ${realname}U && $MV $realname ${realname}U)' || exit $?
8296 # Do each of the archive commands.
8297 if test "$module" = yes && test -n "$module_cmds" ; then
8298 if test -n "$export_symbols" && test -n "$module_expsym_cmds"; then
8299 eval test_cmds=\"$module_expsym_cmds\"
8300 cmds=$module_expsym_cmds
8302 eval test_cmds=\"$module_cmds\"
8306 if test -n "$export_symbols" && test -n "$archive_expsym_cmds"; then
8307 eval test_cmds=\"$archive_expsym_cmds\"
8308 cmds=$archive_expsym_cmds
8310 eval test_cmds=\"$archive_cmds\"
8315 if test "X$skipped_export" != "X:" &&
8316 func_len " $test_cmds" &&
8317 len=$func_len_result &&
8318 test "$len" -lt "$max_cmd_len" || test "$max_cmd_len" -le -1; then
8321 # The command line is too long to link in one step, link piecewise
8322 # or, if using GNU ld and skipped_export is not :, use a linker
8325 # Save the value of $output and $libobjs because we want to
8326 # use them later. If we have whole_archive_flag_spec, we
8327 # want to use save_libobjs as it was before
8328 # whole_archive_flag_spec was expanded, because we can't
8329 # assume the linker understands whole_archive_flag_spec.
8330 # This may have to be revisited, in case too many
8331 # convenience libraries get linked in and end up exceeding
8333 if test -z "$convenience" || test -z "$whole_archive_flag_spec"; then
8334 save_libobjs=$libobjs
8337 func_basename "$output"
8338 output_la=$func_basename_result
8340 # Clear the reloadable object creation command queue and
8341 # initialize k to one.
8348 if test -n "$save_libobjs" && test "X$skipped_export" != "X:" && test "$with_gnu_ld" = yes; then
8349 output=${output_objdir}/${output_la}.lnkscript
8350 func_verbose "creating GNU ld script: $output"
8351 echo 'INPUT (' > $output
8352 for obj in $save_libobjs
8354 func_to_tool_file "$obj"
8355 $ECHO "$func_to_tool_file_result" >> $output
8358 func_append delfiles " $output"
8359 func_to_tool_file "$output"
8360 output=$func_to_tool_file_result
8361 elif test -n "$save_libobjs" && test "X$skipped_export" != "X:" && test "X$file_list_spec" != X; then
8362 output=${output_objdir}/${output_la}.lnk
8363 func_verbose "creating linker input file list: $output"
8368 if test "$compiler_needs_object" = yes; then
8374 func_to_tool_file "$obj"
8375 $ECHO "$func_to_tool_file_result" >> $output
8377 func_append delfiles " $output"
8378 func_to_tool_file "$output"
8379 output=$firstobj\"$file_list_spec$func_to_tool_file_result\"
8381 if test -n "$save_libobjs"; then
8382 func_verbose "creating reloadable object files..."
8383 output=$output_objdir/$output_la-${k}.$objext
8384 eval test_cmds=\"$reload_cmds\"
8385 func_len " $test_cmds"
8386 len0=$func_len_result
8389 # Loop over the list of objects to be linked.
8390 for obj in $save_libobjs
8393 func_arith $len + $func_len_result
8394 len=$func_arith_result
8395 if test "X$objlist" = X ||
8396 test "$len" -lt "$max_cmd_len"; then
8397 func_append objlist " $obj"
8399 # The command $test_cmds is almost too long, add a
8400 # command to the queue.
8401 if test "$k" -eq 1 ; then
8402 # The first file doesn't have a previous command to add.
8403 reload_objs=$objlist
8404 eval concat_cmds=\"$reload_cmds\"
8406 # All subsequent reloadable object files will link in
8407 # the last one created.
8408 reload_objs="$objlist $last_robj"
8409 eval concat_cmds=\"\$concat_cmds~$reload_cmds~\$RM $last_robj\"
8411 last_robj=$output_objdir/$output_la-${k}.$objext
8413 k=$func_arith_result
8414 output=$output_objdir/$output_la-${k}.$objext
8416 func_len " $last_robj"
8417 func_arith $len0 + $func_len_result
8418 len=$func_arith_result
8421 # Handle the remaining objects by creating one last
8422 # reloadable object file. All subsequent reloadable object
8423 # files will link in the last one created.
8424 test -z "$concat_cmds" || concat_cmds=$concat_cmds~
8425 reload_objs="$objlist $last_robj"
8426 eval concat_cmds=\"\${concat_cmds}$reload_cmds\"
8427 if test -n "$last_robj"; then
8428 eval concat_cmds=\"\${concat_cmds}~\$RM $last_robj\"
8430 func_append delfiles " $output"
8436 if ${skipped_export-false}; then
8437 func_verbose "generating symbol list for \`$libname.la'"
8438 export_symbols="$output_objdir/$libname.exp"
8439 $opt_dry_run || $RM $export_symbols
8441 # Append the command to create the export file.
8442 test -z "$concat_cmds" || concat_cmds=$concat_cmds~
8443 eval concat_cmds=\"\$concat_cmds$export_symbols_cmds\"
8444 if test -n "$last_robj"; then
8445 eval concat_cmds=\"\$concat_cmds~\$RM $last_robj\"
8449 test -n "$save_libobjs" &&
8450 func_verbose "creating a temporary reloadable object file: $output"
8452 # Loop through the commands generated above and execute them.
8453 save_ifs="$IFS"; IFS='~'
8454 for cmd in $concat_cmds; do
8457 func_quote_for_expand "$cmd"
8458 eval "func_echo $func_quote_for_expand_result"
8460 $opt_dry_run || eval "$cmd" || {
8463 # Restore the uninstalled library and exit
8464 if test "$opt_mode" = relink; then
8465 ( cd "$output_objdir" && \
8466 $RM "${realname}T" && \
8467 $MV "${realname}U" "$realname" )
8475 if test -n "$export_symbols_regex" && ${skipped_export-false}; then
8476 func_show_eval '$EGREP -e "$export_symbols_regex" "$export_symbols" > "${export_symbols}T"'
8477 func_show_eval '$MV "${export_symbols}T" "$export_symbols"'
8481 if ${skipped_export-false}; then
8482 if test -n "$export_symbols" && test -n "$include_expsyms"; then
8483 tmp_export_symbols="$export_symbols"
8484 test -n "$orig_export_symbols" && tmp_export_symbols="$orig_export_symbols"
8485 $opt_dry_run || eval '$ECHO "$include_expsyms" | $SP2NL >> "$tmp_export_symbols"'
8488 if test -n "$orig_export_symbols"; then
8489 # The given exports_symbols file has to be filtered, so filter it.
8490 func_verbose "filter symbol list for \`$libname.la' to tag DATA exports"
8491 # FIXME: $output_objdir/$libname.filter potentially contains lots of
8492 # 's' commands which not all seds can handle. GNU sed should be fine
8493 # though. Also, the filter scales superlinearly with the number of
8494 # global variables. join(1) would be nice here, but unfortunately
8495 # isn't a blessed tool.
8496 $opt_dry_run || $SED -e '/[ ,]DATA/!d;s,\(.*\)\([ \,].*\),s|^\1$|\1\2|,' < $export_symbols > $output_objdir/$libname.filter
8497 func_append delfiles " $export_symbols $output_objdir/$libname.filter"
8498 export_symbols=$output_objdir/$libname.def
8499 $opt_dry_run || $SED -f $output_objdir/$libname.filter < $orig_export_symbols > $export_symbols
8504 # Restore the value of output.
8507 if test -n "$convenience" && test -n "$whole_archive_flag_spec"; then
8508 eval libobjs=\"\$libobjs $whole_archive_flag_spec\"
8509 test "X$libobjs" = "X " && libobjs=
8511 # Expand the library linking commands again to reset the
8512 # value of $libobjs for piecewise linking.
8514 # Do each of the archive commands.
8515 if test "$module" = yes && test -n "$module_cmds" ; then
8516 if test -n "$export_symbols" && test -n "$module_expsym_cmds"; then
8517 cmds=$module_expsym_cmds
8522 if test -n "$export_symbols" && test -n "$archive_expsym_cmds"; then
8523 cmds=$archive_expsym_cmds
8530 if test -n "$delfiles"; then
8531 # Append the command to remove temporary files to $cmds.
8532 eval cmds=\"\$cmds~\$RM $delfiles\"
8535 # Add any objects from preloaded convenience libraries
8536 if test -n "$dlprefiles"; then
8537 gentop="$output_objdir/${outputname}x"
8538 func_append generated " $gentop"
8540 func_extract_archives $gentop $dlprefiles
8541 func_append libobjs " $func_extract_archives_result"
8542 test "X$libobjs" = "X " && libobjs=
8545 save_ifs="$IFS"; IFS='~'
8546 for cmd in $cmds; do
8550 func_quote_for_expand "$cmd"
8551 eval "func_echo $func_quote_for_expand_result"
8553 $opt_dry_run || eval "$cmd" || {
8556 # Restore the uninstalled library and exit
8557 if test "$opt_mode" = relink; then
8558 ( cd "$output_objdir" && \
8559 $RM "${realname}T" && \
8560 $MV "${realname}U" "$realname" )
8568 # Restore the uninstalled library and exit
8569 if test "$opt_mode" = relink; then
8570 $opt_dry_run || eval '(cd $output_objdir && $RM ${realname}T && $MV $realname ${realname}T && $MV ${realname}U $realname)' || exit $?
8572 if test -n "$convenience"; then
8573 if test -z "$whole_archive_flag_spec"; then
8574 func_show_eval '${RM}r "$gentop"'
8581 # Create links to the real library.
8582 for linkname in $linknames; do
8583 if test "$realname" != "$linkname"; then
8584 func_show_eval '(cd "$output_objdir" && $RM "$linkname" && $LN_S "$realname" "$linkname")' 'exit $?'
8588 # If -module or -export-dynamic was specified, set the dlname.
8589 if test "$module" = yes || test "$export_dynamic" = yes; then
8590 # On all known operating systems, these are identical.
8597 if test -n "$dlfiles$dlprefiles" || test "$dlself" != no; then
8598 func_warning "\`-dlopen' is ignored for objects"
8603 func_warning "\`-l' and \`-L' are ignored for objects" ;;
8606 test -n "$rpath" && \
8607 func_warning "\`-rpath' is ignored for objects"
8609 test -n "$xrpath" && \
8610 func_warning "\`-R' is ignored for objects"
8612 test -n "$vinfo" && \
8613 func_warning "\`-version-info' is ignored for objects"
8615 test -n "$release" && \
8616 func_warning "\`-release' is ignored for objects"
8620 test -n "$objs$old_deplibs" && \
8621 func_fatal_error "cannot build library object \`$output' from non-libtool objects"
8625 obj=$func_lo2o_result
8633 # Delete the old objects.
8634 $opt_dry_run || $RM $obj $libobj
8636 # Objects from convenience libraries. This assumes
8637 # single-version convenience libraries. Whenever we create
8638 # different ones for PIC/non-PIC, this we'll have to duplicate
8642 # reload_cmds runs $LD directly, so let us get rid of
8643 # -Wl from whole_archive_flag_spec and hope we can get by with
8644 # turning comma into space..
8647 if test -n "$convenience"; then
8648 if test -n "$whole_archive_flag_spec"; then
8649 eval tmp_whole_archive_flags=\"$whole_archive_flag_spec\"
8650 reload_conv_objs=$reload_objs\ `$ECHO "$tmp_whole_archive_flags" | $SED 's|,| |g'`
8652 gentop="$output_objdir/${obj}x"
8653 func_append generated " $gentop"
8655 func_extract_archives $gentop $convenience
8656 reload_conv_objs="$reload_objs $func_extract_archives_result"
8660 # If we're not building shared, we need to use non_pic_objs
8661 test "$build_libtool_libs" != yes && libobjs="$non_pic_objects"
8663 # Create the old-style object.
8664 reload_objs="$objs$old_deplibs "`$ECHO "$libobjs" | $SP2NL | $SED "/\.${libext}$/d; /\.lib$/d; $lo2o" | $NL2SP`" $reload_conv_objs" ### testsuite: skip nested quoting test
8667 func_execute_cmds "$reload_cmds" 'exit $?'
8669 # Exit if we aren't doing a library object file.
8670 if test -z "$libobj"; then
8671 if test -n "$gentop"; then
8672 func_show_eval '${RM}r "$gentop"'
8678 if test "$build_libtool_libs" != yes; then
8679 if test -n "$gentop"; then
8680 func_show_eval '${RM}r "$gentop"'
8683 # Create an invalid libtool object if no PIC, so that we don't
8684 # accidentally link it into a program.
8685 # $show "echo timestamp > $libobj"
8686 # $opt_dry_run || eval "echo timestamp > $libobj" || exit $?
8690 if test -n "$pic_flag" || test "$pic_mode" != default; then
8691 # Only do commands if we really have different PIC objects.
8692 reload_objs="$libobjs $reload_conv_objs"
8694 func_execute_cmds "$reload_cmds" 'exit $?'
8697 if test -n "$gentop"; then
8698 func_show_eval '${RM}r "$gentop"'
8706 *cygwin*) func_stripname '' '.exe' "$output"
8707 output=$func_stripname_result.exe;;
8709 test -n "$vinfo" && \
8710 func_warning "\`-version-info' is ignored for programs"
8712 test -n "$release" && \
8713 func_warning "\`-release' is ignored for programs"
8715 test "$preload" = yes \
8716 && test "$dlopen_support" = unknown \
8717 && test "$dlopen_self" = unknown \
8718 && test "$dlopen_self_static" = unknown && \
8719 func_warning "\`LT_INIT([dlopen])' not used. Assuming no dlopen support."
8722 *-*-rhapsody* | *-*-darwin1.[012])
8723 # On Rhapsody replace the C library is the System framework
8724 compile_deplibs=`$ECHO " $compile_deplibs" | $SED 's/ -lc / System.ltframework /'`
8725 finalize_deplibs=`$ECHO " $finalize_deplibs" | $SED 's/ -lc / System.ltframework /'`
8731 # Don't allow lazy linking, it breaks C++ global constructors
8732 # But is supposedly fixed on 10.4 or later (yay!).
8733 if test "$tagname" = CXX ; then
8734 case ${MACOSX_DEPLOYMENT_TARGET-10.0} in
8736 func_append compile_command " ${wl}-bind_at_load"
8737 func_append finalize_command " ${wl}-bind_at_load"
8741 # Time to change all our "foo.ltframework" stuff back to "-framework foo"
8742 compile_deplibs=`$ECHO " $compile_deplibs" | $SED 's% \([^ $]*\).ltframework% -framework \1%g'`
8743 finalize_deplibs=`$ECHO " $finalize_deplibs" | $SED 's% \([^ $]*\).ltframework% -framework \1%g'`
8748 # move library search paths that coincide with paths to not yet
8749 # installed libraries to the beginning of the library search list
8751 for path in $notinst_path; do
8752 case " $new_libs " in
8753 *" -L$path/$objdir "*) ;;
8755 case " $compile_deplibs " in
8756 *" -L$path/$objdir "*)
8757 func_append new_libs " -L$path/$objdir" ;;
8762 for deplib in $compile_deplibs; do
8765 case " $new_libs " in
8767 *) func_append new_libs " $deplib" ;;
8770 *) func_append new_libs " $deplib" ;;
8773 compile_deplibs="$new_libs"
8776 func_append compile_command " $compile_deplibs"
8777 func_append finalize_command " $finalize_deplibs"
8779 if test -n "$rpath$xrpath"; then
8780 # If the user specified any rpath flags, then add them.
8781 for libdir in $rpath $xrpath; do
8782 # This is the magic to use -rpath.
8783 case "$finalize_rpath " in
8785 *) func_append finalize_rpath " $libdir" ;;
8790 # Now hardcode the library paths
8793 for libdir in $compile_rpath $finalize_rpath; do
8794 if test -n "$hardcode_libdir_flag_spec"; then
8795 if test -n "$hardcode_libdir_separator"; then
8796 if test -z "$hardcode_libdirs"; then
8797 hardcode_libdirs="$libdir"
8799 # Just accumulate the unique libdirs.
8800 case $hardcode_libdir_separator$hardcode_libdirs$hardcode_libdir_separator in
8801 *"$hardcode_libdir_separator$libdir$hardcode_libdir_separator"*)
8804 func_append hardcode_libdirs "$hardcode_libdir_separator$libdir"
8809 eval flag=\"$hardcode_libdir_flag_spec\"
8810 func_append rpath " $flag"
8812 elif test -n "$runpath_var"; then
8813 case "$perm_rpath " in
8815 *) func_append perm_rpath " $libdir" ;;
8819 *-*-cygwin* | *-*-mingw* | *-*-pw32* | *-*-os2* | *-cegcc*)
8820 testbindir=`${ECHO} "$libdir" | ${SED} -e 's*/lib$*/bin*'`
8821 case :$dllsearchpath: in
8823 ::) dllsearchpath=$libdir;;
8824 *) func_append dllsearchpath ":$libdir";;
8826 case :$dllsearchpath: in
8827 *":$testbindir:"*) ;;
8828 ::) dllsearchpath=$testbindir;;
8829 *) func_append dllsearchpath ":$testbindir";;
8834 # Substitute the hardcoded libdirs into the rpath.
8835 if test -n "$hardcode_libdir_separator" &&
8836 test -n "$hardcode_libdirs"; then
8837 libdir="$hardcode_libdirs"
8838 eval rpath=\" $hardcode_libdir_flag_spec\"
8840 compile_rpath="$rpath"
8844 for libdir in $finalize_rpath; do
8845 if test -n "$hardcode_libdir_flag_spec"; then
8846 if test -n "$hardcode_libdir_separator"; then
8847 if test -z "$hardcode_libdirs"; then
8848 hardcode_libdirs="$libdir"
8850 # Just accumulate the unique libdirs.
8851 case $hardcode_libdir_separator$hardcode_libdirs$hardcode_libdir_separator in
8852 *"$hardcode_libdir_separator$libdir$hardcode_libdir_separator"*)
8855 func_append hardcode_libdirs "$hardcode_libdir_separator$libdir"
8860 eval flag=\"$hardcode_libdir_flag_spec\"
8861 func_append rpath " $flag"
8863 elif test -n "$runpath_var"; then
8864 case "$finalize_perm_rpath " in
8866 *) func_append finalize_perm_rpath " $libdir" ;;
8870 # Substitute the hardcoded libdirs into the rpath.
8871 if test -n "$hardcode_libdir_separator" &&
8872 test -n "$hardcode_libdirs"; then
8873 libdir="$hardcode_libdirs"
8874 eval rpath=\" $hardcode_libdir_flag_spec\"
8876 finalize_rpath="$rpath"
8878 if test -n "$libobjs" && test "$build_old_libs" = yes; then
8879 # Transform all the library objects into standard objects.
8880 compile_command=`$ECHO "$compile_command" | $SP2NL | $SED "$lo2o" | $NL2SP`
8881 finalize_command=`$ECHO "$finalize_command" | $SP2NL | $SED "$lo2o" | $NL2SP`
8884 func_generate_dlsyms "$outputname" "@PROGRAM@" "no"
8886 # template prelinking step
8887 if test -n "$prelink_cmds"; then
8888 func_execute_cmds "$prelink_cmds" 'exit $?'
8891 wrappers_required=yes
8893 *cegcc* | *mingw32ce*)
8894 # Disable wrappers for cegcc and mingw32ce hosts, we are cross compiling anyway.
8895 wrappers_required=no
8897 *cygwin* | *mingw* )
8898 if test "$build_libtool_libs" != yes; then
8899 wrappers_required=no
8903 if test "$need_relink" = no || test "$build_libtool_libs" != yes; then
8904 wrappers_required=no
8908 if test "$wrappers_required" = no; then
8909 # Replace the output file specification.
8910 compile_command=`$ECHO "$compile_command" | $SED 's%@OUTPUT@%'"$output"'%g'`
8911 link_command="$compile_command$compile_rpath"
8913 # We have no uninstalled library dependencies, so finalize right now.
8915 func_show_eval "$link_command" 'exit_status=$?'
8917 if test -n "$postlink_cmds"; then
8918 func_to_tool_file "$output"
8919 postlink_cmds=`func_echo_all "$postlink_cmds" | $SED -e 's%@OUTPUT@%'"$output"'%g' -e 's%@TOOL_OUTPUT@%'"$func_to_tool_file_result"'%g'`
8920 func_execute_cmds "$postlink_cmds" 'exit $?'
8923 # Delete the generated files.
8924 if test -f "$output_objdir/${outputname}S.${objext}"; then
8925 func_show_eval '$RM "$output_objdir/${outputname}S.${objext}"'
8931 if test -n "$compile_shlibpath$finalize_shlibpath"; then
8932 compile_command="$shlibpath_var=\"$compile_shlibpath$finalize_shlibpath\$$shlibpath_var\" $compile_command"
8934 if test -n "$finalize_shlibpath"; then
8935 finalize_command="$shlibpath_var=\"$finalize_shlibpath\$$shlibpath_var\" $finalize_command"
8940 if test -n "$runpath_var"; then
8941 if test -n "$perm_rpath"; then
8942 # We should set the runpath_var.
8944 for dir in $perm_rpath; do
8945 func_append rpath "$dir:"
8947 compile_var="$runpath_var=\"$rpath\$$runpath_var\" "
8949 if test -n "$finalize_perm_rpath"; then
8950 # We should set the runpath_var.
8952 for dir in $finalize_perm_rpath; do
8953 func_append rpath "$dir:"
8955 finalize_var="$runpath_var=\"$rpath\$$runpath_var\" "
8959 if test "$no_install" = yes; then
8960 # We don't need to create a wrapper script.
8961 link_command="$compile_var$compile_command$compile_rpath"
8962 # Replace the output file specification.
8963 link_command=`$ECHO "$link_command" | $SED 's%@OUTPUT@%'"$output"'%g'`
8964 # Delete the old output file.
8965 $opt_dry_run || $RM $output
8966 # Link the executable and exit
8967 func_show_eval "$link_command" 'exit $?'
8969 if test -n "$postlink_cmds"; then
8970 func_to_tool_file "$output"
8971 postlink_cmds=`func_echo_all "$postlink_cmds" | $SED -e 's%@OUTPUT@%'"$output"'%g' -e 's%@TOOL_OUTPUT@%'"$func_to_tool_file_result"'%g'`
8972 func_execute_cmds "$postlink_cmds" 'exit $?'
8978 if test "$hardcode_action" = relink; then
8979 # Fast installation is not supported
8980 link_command="$compile_var$compile_command$compile_rpath"
8981 relink_command="$finalize_var$finalize_command$finalize_rpath"
8983 func_warning "this platform does not like uninstalled shared libraries"
8984 func_warning "\`$output' will be relinked during installation"
8986 if test "$fast_install" != no; then
8987 link_command="$finalize_var$compile_command$finalize_rpath"
8988 if test "$fast_install" = yes; then
8989 relink_command=`$ECHO "$compile_var$compile_command$compile_rpath" | $SED 's%@OUTPUT@%\$progdir/\$file%g'`
8991 # fast_install is set to needless
8995 link_command="$compile_var$compile_command$compile_rpath"
8996 relink_command="$finalize_var$finalize_command$finalize_rpath"
9000 # Replace the output file specification.
9001 link_command=`$ECHO "$link_command" | $SED 's%@OUTPUT@%'"$output_objdir/$outputname"'%g'`
9003 # Delete the old output files.
9004 $opt_dry_run || $RM $output $output_objdir/$outputname $output_objdir/lt-$outputname
9006 func_show_eval "$link_command" 'exit $?'
9008 if test -n "$postlink_cmds"; then
9009 func_to_tool_file "$output_objdir/$outputname"
9010 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'`
9011 func_execute_cmds "$postlink_cmds" 'exit $?'
9014 # Now create the wrapper script.
9015 func_verbose "creating $output"
9017 # Quote the relink command for shipping.
9018 if test -n "$relink_command"; then
9019 # Preserve any variables that may affect compiler behavior
9020 for var in $variables_saved_for_relink; do
9021 if eval test -z \"\${$var+set}\"; then
9022 relink_command="{ test -z \"\${$var+set}\" || $lt_unset $var || { $var=; export $var; }; }; $relink_command"
9023 elif eval var_value=\$$var; test -z "$var_value"; then
9024 relink_command="$var=; export $var; $relink_command"
9026 func_quote_for_eval "$var_value"
9027 relink_command="$var=$func_quote_for_eval_result; export $var; $relink_command"
9030 relink_command="(cd `pwd`; $relink_command)"
9031 relink_command=`$ECHO "$relink_command" | $SED "$sed_quote_subst"`
9034 # Only actually do things if not in dry run mode.
9036 # win32 will think the script is a binary if it has
9037 # a .exe suffix, so we strip it off here.
9039 *.exe) func_stripname '' '.exe' "$output"
9040 output=$func_stripname_result ;;
9042 # test for cygwin because mv fails w/o .exe extensions
9046 func_stripname '' '.exe' "$outputname"
9047 outputname=$func_stripname_result ;;
9051 *cygwin* | *mingw* )
9052 func_dirname_and_basename "$output" "" "."
9053 output_name=$func_basename_result
9054 output_path=$func_dirname_result
9055 cwrappersource="$output_path/$objdir/lt-$output_name.c"
9056 cwrapper="$output_path/$output_name.exe"
9057 $RM $cwrappersource $cwrapper
9058 trap "$RM $cwrappersource $cwrapper; exit $EXIT_FAILURE" 1 2 15
9060 func_emit_cwrapperexe_src > $cwrappersource
9062 # The wrapper executable is built using the $host compiler,
9063 # because it contains $host paths and files. If cross-
9064 # compiling, it, like the target executable, must be
9065 # executed on the $host or under an emulation environment.
9067 $LTCC $LTCFLAGS -o $cwrapper $cwrappersource
9071 # Now, create the wrapper script for func_source use:
9072 func_ltwrapper_scriptname $cwrapper
9073 $RM $func_ltwrapper_scriptname_result
9074 trap "$RM $func_ltwrapper_scriptname_result; exit $EXIT_FAILURE" 1 2 15
9076 # note: this script will not be executed, so do not chmod.
9077 if test "x$build" = "x$host" ; then
9078 $cwrapper --lt-dump-script > $func_ltwrapper_scriptname_result
9080 func_emit_wrapper no > $func_ltwrapper_scriptname_result
9086 trap "$RM $output; exit $EXIT_FAILURE" 1 2 15
9088 func_emit_wrapper no > $output
9097 # See if we need to build an old-fashioned archive.
9098 for oldlib in $oldlibs; do
9100 if test "$build_libtool_libs" = convenience; then
9101 oldobjs="$libobjs_save $symfileobj"
9102 addlibs="$convenience"
9103 build_libtool_libs=no
9105 if test "$build_libtool_libs" = module; then
9106 oldobjs="$libobjs_save"
9107 build_libtool_libs=no
9109 oldobjs="$old_deplibs $non_pic_objects"
9110 if test "$preload" = yes && test -f "$symfileobj"; then
9111 func_append oldobjs " $symfileobj"
9114 addlibs="$old_convenience"
9117 if test -n "$addlibs"; then
9118 gentop="$output_objdir/${outputname}x"
9119 func_append generated " $gentop"
9121 func_extract_archives $gentop $addlibs
9122 func_append oldobjs " $func_extract_archives_result"
9125 # Do each command in the archive commands.
9126 if test -n "$old_archive_from_new_cmds" && test "$build_libtool_libs" = yes; then
9127 cmds=$old_archive_from_new_cmds
9130 # Add any objects from preloaded convenience libraries
9131 if test -n "$dlprefiles"; then
9132 gentop="$output_objdir/${outputname}x"
9133 func_append generated " $gentop"
9135 func_extract_archives $gentop $dlprefiles
9136 func_append oldobjs " $func_extract_archives_result"
9139 # POSIX demands no paths to be encoded in archives. We have
9140 # to avoid creating archives with duplicate basenames if we
9141 # might have to extract them afterwards, e.g., when creating a
9142 # static archive out of a convenience library, or when linking
9143 # the entirety of a libtool archive into another (currently
9144 # not supported by libtool).
9145 if (for obj in $oldobjs
9147 func_basename "$obj"
9148 $ECHO "$func_basename_result"
9149 done | sort | sort -uc >/dev/null 2>&1); then
9152 echo "copying selected object files to avoid basename conflicts..."
9153 gentop="$output_objdir/${outputname}x"
9154 func_append generated " $gentop"
9155 func_mkdir_p "$gentop"
9156 save_oldobjs=$oldobjs
9159 for obj in $save_oldobjs
9161 func_basename "$obj"
9162 objbase="$func_basename_result"
9163 case " $oldobjs " in
9164 " ") oldobjs=$obj ;;
9167 # Make sure we don't pick an alternate name that also
9169 newobj=lt$counter-$objbase
9170 func_arith $counter + 1
9171 counter=$func_arith_result
9172 case " $oldobjs " in
9173 *[\ /]"$newobj "*) ;;
9174 *) if test ! -f "$gentop/$newobj"; then break; fi ;;
9177 func_show_eval "ln $obj $gentop/$newobj || cp $obj $gentop/$newobj"
9178 func_append oldobjs " $gentop/$newobj"
9180 *) func_append oldobjs " $obj" ;;
9184 func_to_tool_file "$oldlib" func_convert_file_msys_to_w32
9185 tool_oldlib=$func_to_tool_file_result
9186 eval cmds=\"$old_archive_cmds\"
9189 len=$func_len_result
9190 if test "$len" -lt "$max_cmd_len" || test "$max_cmd_len" -le -1; then
9191 cmds=$old_archive_cmds
9192 elif test -n "$archiver_list_spec"; then
9193 func_verbose "using command file archive linking..."
9196 func_to_tool_file "$obj"
9197 $ECHO "$func_to_tool_file_result"
9198 done > $output_objdir/$libname.libcmd
9199 func_to_tool_file "$output_objdir/$libname.libcmd"
9200 oldobjs=" $archiver_list_spec$func_to_tool_file_result"
9201 cmds=$old_archive_cmds
9203 # the command line is too long to link in one step, link in parts
9204 func_verbose "using piecewise archive linking..."
9209 save_oldobjs=$oldobjs
9211 # Is there a better way of finding the last object in the list?
9212 for obj in $save_oldobjs
9216 eval test_cmds=\"$old_archive_cmds\"
9217 func_len " $test_cmds"
9218 len0=$func_len_result
9220 for obj in $save_oldobjs
9223 func_arith $len + $func_len_result
9224 len=$func_arith_result
9225 func_append objlist " $obj"
9226 if test "$len" -lt "$max_cmd_len"; then
9229 # the above command should be used before it gets too long
9231 if test "$obj" = "$last_oldobj" ; then
9234 test -z "$concat_cmds" || concat_cmds=$concat_cmds~
9235 eval concat_cmds=\"\${concat_cmds}$old_archive_cmds\"
9242 if test "X$oldobjs" = "X" ; then
9243 eval cmds=\"\$concat_cmds\"
9245 eval cmds=\"\$concat_cmds~\$old_archive_cmds\"
9249 func_execute_cmds "$cmds" 'exit $?'
9252 test -n "$generated" && \
9253 func_show_eval "${RM}r$generated"
9255 # Now create the libtool archive.
9259 test "$build_old_libs" = yes && old_library="$libname.$libext"
9260 func_verbose "creating $output"
9262 # Preserve any variables that may affect compiler behavior
9263 for var in $variables_saved_for_relink; do
9264 if eval test -z \"\${$var+set}\"; then
9265 relink_command="{ test -z \"\${$var+set}\" || $lt_unset $var || { $var=; export $var; }; }; $relink_command"
9266 elif eval var_value=\$$var; test -z "$var_value"; then
9267 relink_command="$var=; export $var; $relink_command"
9269 func_quote_for_eval "$var_value"
9270 relink_command="$var=$func_quote_for_eval_result; export $var; $relink_command"
9273 # Quote the link command for shipping.
9274 relink_command="(cd `pwd`; $SHELL $progpath $preserve_args --mode=relink $libtool_args @inst_prefix_dir@)"
9275 relink_command=`$ECHO "$relink_command" | $SED "$sed_quote_subst"`
9276 if test "$hardcode_automatic" = yes ; then
9280 # Only create the output if not a dry run.
9282 for installed in no yes; do
9283 if test "$installed" = yes; then
9284 if test -z "$install_libdir"; then
9287 output="$output_objdir/$outputname"i
9288 # Replace all uninstalled libtool libraries with the installed ones
9290 for deplib in $dependency_libs; do
9293 func_basename "$deplib"
9294 name="$func_basename_result"
9295 func_resolve_sysroot "$deplib"
9296 eval libdir=`${SED} -n -e 's/^libdir=\(.*\)$/\1/p' $func_resolve_sysroot_result`
9297 test -z "$libdir" && \
9298 func_fatal_error "\`$deplib' is not a valid libtool archive"
9299 func_append newdependency_libs " ${lt_sysroot:+=}$libdir/$name"
9302 func_stripname -L '' "$deplib"
9303 func_replace_sysroot "$func_stripname_result"
9304 func_append newdependency_libs " -L$func_replace_sysroot_result"
9307 func_stripname -R '' "$deplib"
9308 func_replace_sysroot "$func_stripname_result"
9309 func_append newdependency_libs " -R$func_replace_sysroot_result"
9311 *) func_append newdependency_libs " $deplib" ;;
9314 dependency_libs="$newdependency_libs"
9317 for lib in $dlfiles; do
9320 func_basename "$lib"
9321 name="$func_basename_result"
9322 eval libdir=`${SED} -n -e 's/^libdir=\(.*\)$/\1/p' $lib`
9323 test -z "$libdir" && \
9324 func_fatal_error "\`$lib' is not a valid libtool archive"
9325 func_append newdlfiles " ${lt_sysroot:+=}$libdir/$name"
9327 *) func_append newdlfiles " $lib" ;;
9330 dlfiles="$newdlfiles"
9332 for lib in $dlprefiles; do
9335 # Only pass preopened files to the pseudo-archive (for
9336 # eventual linking with the app. that links it) if we
9337 # didn't already link the preopened objects directly into
9339 func_basename "$lib"
9340 name="$func_basename_result"
9341 eval libdir=`${SED} -n -e 's/^libdir=\(.*\)$/\1/p' $lib`
9342 test -z "$libdir" && \
9343 func_fatal_error "\`$lib' is not a valid libtool archive"
9344 func_append newdlprefiles " ${lt_sysroot:+=}$libdir/$name"
9348 dlprefiles="$newdlprefiles"
9351 for lib in $dlfiles; do
9353 [\\/]* | [A-Za-z]:[\\/]*) abs="$lib" ;;
9354 *) abs=`pwd`"/$lib" ;;
9356 func_append newdlfiles " $abs"
9358 dlfiles="$newdlfiles"
9360 for lib in $dlprefiles; do
9362 [\\/]* | [A-Za-z]:[\\/]*) abs="$lib" ;;
9363 *) abs=`pwd`"/$lib" ;;
9365 func_append newdlprefiles " $abs"
9367 dlprefiles="$newdlprefiles"
9370 # place dlname in correct position for cygwin
9371 # In fact, it would be nice if we could use this code for all target
9372 # systems that can't hard-code library paths into their executables
9373 # and that have no shared library path variable independent of PATH,
9374 # but it turns out we can't easily determine that from inspecting
9375 # libtool variables, so we have to hard-code the OSs to which it
9376 # applies here; at the moment, that means platforms that use the PE
9377 # object format with DLL files. See the long comment at the top of
9378 # tests/bindir.at for full details.
9380 case $host,$output,$installed,$module,$dlname in
9381 *cygwin*,*lai,yes,no,*.dll | *mingw*,*lai,yes,no,*.dll | *cegcc*,*lai,yes,no,*.dll)
9382 # If a -bindir argument was supplied, place the dll there.
9383 if test "x$bindir" != x ;
9385 func_relative_path "$install_libdir" "$bindir"
9386 tdlname=$func_relative_path_result$dlname
9388 # Otherwise fall back on heuristic.
9389 tdlname=../bin/$dlname
9394 # $outputname - a libtool library file
9395 # Generated by $PROGRAM (GNU $PACKAGE$TIMESTAMP) $VERSION
9397 # Please DO NOT delete this file!
9398 # It is necessary for linking the library.
9400 # The name that we can dlopen(3).
9403 # Names of this library.
9404 library_names='$library_names'
9406 # The name of the static archive.
9407 old_library='$old_library'
9409 # Linker flags that can not go in dependency_libs.
9410 inherited_linker_flags='$new_inherited_linker_flags'
9412 # Libraries that this one depends upon.
9413 dependency_libs='$dependency_libs'
9415 # Names of additional weak libraries provided by this library
9416 weak_library_names='$weak_libs'
9418 # Version information for $libname.
9423 # Is this an already installed library?
9424 installed=$installed
9426 # Should we warn about portability when linking against -modules?
9427 shouldnotlink=$module
9429 # Files to dlopen/dlpreopen
9431 dlpreopen='$dlprefiles'
9433 # Directory that this library needs to be installed in:
9434 libdir='$install_libdir'"
9435 if test "$installed" = no && test "$need_relink" = yes && \
9436 test -n "$relink_command"; then
9438 relink_command=\"$relink_command\""
9443 # Do a symbolic link so that the libtool archive can be found in
9444 # LD_LIBRARY_PATH before the program is installed.
9445 func_show_eval '( cd "$output_objdir" && $RM "$outputname" && $LN_S "../$outputname" "$outputname" )' 'exit $?'
9451 { test "$opt_mode" = link || test "$opt_mode" = relink; } &&
9452 func_mode_link ${1+"$@"}
9455 # func_mode_uninstall arg...
9456 func_mode_uninstall ()
9464 # This variable tells wrapper scripts just to set variables rather
9465 # than running their programs.
9466 libtool_install_magic="$magic"
9471 -f) func_append RM " $arg"; rmforce=yes ;;
9472 -*) func_append RM " $arg" ;;
9473 *) func_append files " $arg" ;;
9478 func_fatal_help "you must specify an RM program"
9482 for file in $files; do
9483 func_dirname "$file" "" "."
9484 dir="$func_dirname_result"
9485 if test "X$dir" = X.; then
9490 func_basename "$file"
9491 name="$func_basename_result"
9492 test "$opt_mode" = uninstall && odir="$dir"
9494 # Remember odir for removal later, being careful to avoid duplicates
9495 if test "$opt_mode" = clean; then
9498 *) func_append rmdirs " $odir" ;;
9502 # Don't error if the file doesn't exist and rm -f was used.
9503 if { test -L "$file"; } >/dev/null 2>&1 ||
9504 { test -h "$file"; } >/dev/null 2>&1 ||
9505 test -f "$file"; then
9507 elif test -d "$file"; then
9510 elif test "$rmforce" = yes; then
9518 # Possibly a libtool archive, so verify it.
9519 if func_lalib_p "$file"; then
9520 func_source $dir/$name
9522 # Delete the libtool libraries and symlinks.
9523 for n in $library_names; do
9524 func_append rmfiles " $odir/$n"
9526 test -n "$old_library" && func_append rmfiles " $odir/$old_library"
9530 case " $library_names " in
9532 *) test -n "$dlname" && func_append rmfiles " $odir/$dlname" ;;
9534 test -n "$libdir" && func_append rmfiles " $odir/$name $odir/${name}i"
9537 if test -n "$library_names"; then
9538 # Do each command in the postuninstall commands.
9539 func_execute_cmds "$postuninstall_cmds" 'test "$rmforce" = yes || exit_status=1'
9542 if test -n "$old_library"; then
9543 # Do each command in the old_postuninstall commands.
9544 func_execute_cmds "$old_postuninstall_cmds" 'test "$rmforce" = yes || exit_status=1'
9546 # FIXME: should reinstall the best remaining shared library.
9553 # Possibly a libtool object, so verify it.
9554 if func_lalib_p "$file"; then
9557 func_source $dir/$name
9559 # Add PIC object to the list of files to remove.
9560 if test -n "$pic_object" &&
9561 test "$pic_object" != none; then
9562 func_append rmfiles " $dir/$pic_object"
9565 # Add non-PIC object to the list of files to remove.
9566 if test -n "$non_pic_object" &&
9567 test "$non_pic_object" != none; then
9568 func_append rmfiles " $dir/$non_pic_object"
9574 if test "$opt_mode" = clean ; then
9578 func_stripname '' '.exe' "$file"
9579 file=$func_stripname_result
9580 func_stripname '' '.exe' "$name"
9581 noexename=$func_stripname_result
9582 # $file with .exe has already been added to rmfiles,
9583 # add $file without .exe
9584 func_append rmfiles " $file"
9587 # Do a test to see if this is a libtool program.
9588 if func_ltwrapper_p "$file"; then
9589 if func_ltwrapper_executable_p "$file"; then
9590 func_ltwrapper_scriptname "$file"
9592 func_source $func_ltwrapper_scriptname_result
9593 func_append rmfiles " $func_ltwrapper_scriptname_result"
9596 func_source $dir/$noexename
9599 # note $name still contains .exe if it was in $file originally
9600 # as does the version of $file that was added into $rmfiles
9601 func_append rmfiles " $odir/$name $odir/${name}S.${objext}"
9602 if test "$fast_install" = yes && test -n "$relink_command"; then
9603 func_append rmfiles " $odir/lt-$name"
9605 if test "X$noexename" != "X$name" ; then
9606 func_append rmfiles " $odir/lt-${noexename}.c"
9612 func_show_eval "$RM $rmfiles" 'exit_status=1'
9615 # Try to remove the ${objdir}s in the directories where we deleted files
9616 for dir in $rmdirs; do
9617 if test -d "$dir"; then
9618 func_show_eval "rmdir $dir >/dev/null 2>&1"
9625 { test "$opt_mode" = uninstall || test "$opt_mode" = clean; } &&
9626 func_mode_uninstall ${1+"$@"}
9628 test -z "$opt_mode" && {
9629 help="$generic_help"
9630 func_fatal_help "you must specify a MODE"
9633 test -z "$exec_cmd" && \
9634 func_fatal_help "invalid operation mode \`$opt_mode'"
9636 if test -n "$exec_cmd"; then
9637 eval exec "$exec_cmd"
9644 # The TAGs below are defined such that we never get into a situation
9645 # in which we disable both kinds of libraries. Given conflicting
9646 # choices, we go for a static library, that is the most portable,
9647 # since we can't tell whether shared libraries were disabled because
9648 # the user asked for that or because the platform doesn't support
9649 # them. This is particularly important on AIX, because we don't
9650 # support having both static and shared libraries enabled at the same
9651 # time on that platform, so we default to a shared-only configuration.
9652 # If a disable-shared tag is given, we'll fallback to a static-only
9653 # configuration. But we'll never go from static-only to shared-only.
9655 # ### BEGIN LIBTOOL TAG CONFIG: disable-shared
9656 build_libtool_libs=no
9658 # ### END LIBTOOL TAG CONFIG: disable-shared
9660 # ### BEGIN LIBTOOL TAG CONFIG: disable-static
9661 build_old_libs=`case $build_libtool_libs in yes) echo no;; *) echo yes;; esac`
9662 # ### END LIBTOOL TAG CONFIG: disable-static