2 ## DO NOT EDIT - This file generated from ./build-aux/ltmain.in
3 ## by inline-source v2016-02-21.11
5 # libtool (GNU libtool) 2.4.6.40-6ca5-dirty
6 # Provide generalized library-building support services.
7 # Written by Gordon Matzigkeit <gord@gnu.ai.mit.edu>, 1996
9 # Copyright (C) 1996-2017 Free Software Foundation, Inc.
10 # This is free software; see the source for copying conditions. There is NO
11 # warranty; not even for MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
13 # GNU Libtool is free software; you can redistribute it and/or modify
14 # it under the terms of the GNU General Public License as published by
15 # the Free Software Foundation; either version 2 of the License, or
16 # (at your option) any later version.
18 # As a special exception to the GNU General Public License,
19 # if you distribute this file as part of a program or library that
20 # is built using GNU Libtool, you may include this file under the
21 # same distribution terms that you use for the rest of that program.
23 # GNU Libtool is distributed in the hope that it will be useful, but
24 # WITHOUT ANY WARRANTY; without even the implied warranty of
25 # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
26 # General Public License for more details.
28 # You should have received a copy of the GNU General Public License
29 # along with this program. If not, see <http://www.gnu.org/licenses/>.
34 VERSION=2.4.6.40-6ca5-dirty
35 package_revision=2.4.6.40
42 # Run './libtool --help' for help with using this script from the
46 ## ------------------------------- ##
47 ## User overridable command paths. ##
48 ## ------------------------------- ##
50 # After configure completes, it has a better idea of some of the
51 # shell tools we need than the defaults used by the functions shared
52 # with bootstrap, so set those here where they can still be over-
53 # ridden by the user, but otherwise take precedence.
55 : ${AUTOCONF="autoconf"}
56 : ${AUTOMAKE="automake"}
59 ## -------------------------- ##
60 ## Source external libraries. ##
61 ## -------------------------- ##
63 # Much of our low-level functionality needs to be sourced from external
64 # libraries, which are installed to $pkgauxdir.
66 # Set a version string for this script.
67 scriptversion=2017-04-19.12; # UTC
69 # General shell script boiler plate, and helper functions.
70 # Written by Gary V. Vaughan, 2004
72 # This is free software. There is NO warranty; not even for
73 # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
75 # Copyright (C) 2004-2017 Bootstrap Authors
77 # This file is dual licensed under the terms of the MIT license
78 # <https://opensource.org/license/MIT>, and GPL version 3 or later
79 # <http://www.gnu.org/licenses/gpl-2.0.html>. You must apply one of
80 # these licenses when using or redistributing this software or any of
81 # the files within it. See the URLs above, or the file `LICENSE`
82 # included in the Bootstrap distribution for the full license texts.
84 # Please report bugs or propose patches to:
85 # <https://github.com/gnulib-modules/bootstrap/issues>
92 # Evaluate this file near the top of your script to gain access to
93 # the functions and variables defined here:
95 # . `echo "$0" | ${SED-sed} 's|[^/]*$||'`/build-aux/funclib.sh
97 # If you need to override any of the default environment variable
98 # settings, do that before evaluating this file.
101 ## -------------------- ##
102 ## Shell normalisation. ##
103 ## -------------------- ##
105 # Some shells need a little help to be as Bourne compatible as possible.
106 # Before doing anything else, make sure all that help has been provided!
108 DUALCASE=1; export DUALCASE # for MKS sh
109 if test -n "${ZSH_VERSION+set}" && (emulate sh) >/dev/null 2>&1; then :
112 # Pre-4.2 versions of Zsh do word splitting on ${1+"$@"}, which
113 # is contrary to our usage. Disable this feature.
114 alias -g '${1+"$@"}'='"$@"'
117 case `(set -o) 2>/dev/null` in *posix*) set -o posix ;; esac
120 # NLS nuisances: We save the old values in case they are required later.
123 for _G_var in LANG LANGUAGE LC_ALL LC_CTYPE LC_COLLATE LC_MESSAGES
125 eval "if test set = \"\${$_G_var+set}\"; then
126 save_$_G_var=\$$_G_var
129 _G_user_locale=\"$_G_var=\\\$save_\$_G_var; \$_G_user_locale\"
130 _G_safe_locale=\"$_G_var=C; \$_G_safe_locale\"
134 # Make sure IFS has a sensible default
140 # There are apparently some retarded systems that use ';' as a PATH separator!
141 if test "${PATH_SEPARATOR+set}" != set; then
143 (PATH='/bin;/bin'; FPATH=$PATH; sh -c :) >/dev/null 2>&1 && {
144 (PATH='/bin:/bin'; FPATH=$PATH; sh -c :) >/dev/null 2>&1 ||
152 # Portably unset VAR.
153 # In some shells, an 'unset VAR' statement leaves a non-zero return
154 # status if VAR is already unset, which might be problematic if the
155 # statement is used at the end of a function (thus poisoning its return
156 # value) or when 'set -e' is active (causing even a spurious abort of
157 # the script in this case).
160 { eval $1=; (eval unset $1) >/dev/null 2>&1 && eval unset $1 || : ; }
164 # Make sure CDPATH doesn't cause `cd` commands to output the target dir.
167 # Make sure ${,E,F}GREP behave sanely.
168 func_unset GREP_OPTIONS
171 ## ------------------------- ##
172 ## Locate command utilities. ##
173 ## ------------------------- ##
176 # func_executable_p FILE
177 # ----------------------
178 # Check that FILE is an executable regular file.
181 test -f "$1" && test -x "$1"
185 # func_path_progs PROGS_LIST CHECK_FUNC [PATH]
186 # --------------------------------------------
187 # Search for either a program that responds to --version with output
188 # containing "GNU", or else returned by CHECK_FUNC otherwise, by
189 # trying all the directories in PATH with each of the elements of
192 # CHECK_FUNC should accept the path to a candidate program, and
193 # set $func_check_prog_result if it truncates its output less than
194 # $_G_path_prog_max characters.
202 _G_path_prog_found=false
203 _G_save_IFS=$IFS; IFS=${PATH_SEPARATOR-:}
204 for _G_dir in $_G_PATH; do
206 test -z "$_G_dir" && _G_dir=.
207 for _G_prog_name in $_G_progs_list; do
208 for _exeext in '' .EXE; do
209 _G_path_prog=$_G_dir/$_G_prog_name$_exeext
210 func_executable_p "$_G_path_prog" || continue
211 case `"$_G_path_prog" --version 2>&1` in
212 *GNU*) func_path_progs_result=$_G_path_prog _G_path_prog_found=: ;;
213 *) $_G_check_func $_G_path_prog
214 func_path_progs_result=$func_check_prog_result
217 $_G_path_prog_found && break 3
222 test -z "$func_path_progs_result" && {
223 echo "no acceptable sed could be found in \$PATH" >&2
229 # We want to be able to use the functions in this file before configure
230 # has figured out where the best binaries are kept, which means we have
231 # to search for them ourselves - except when the results are already set
232 # where we skip the searches.
234 # Unless the user overrides by setting SED, search the path for either GNU
235 # sed, or the sed that truncates its output the least.
237 _G_sed_script=s/aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa/bbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbb/
238 for _G_i in 1 2 3 4 5 6 7; do
239 _G_sed_script=$_G_sed_script$nl$_G_sed_script
241 echo "$_G_sed_script" 2>/dev/null | sed 99q >conftest.sed
244 func_check_prog_sed ()
249 printf 0123456789 >conftest.in
252 cat conftest.in conftest.in >conftest.tmp
253 mv conftest.tmp conftest.in
254 cp conftest.in conftest.nl
255 echo '' >> conftest.nl
256 "$_G_path_prog" -f conftest.sed <conftest.nl >conftest.out 2>/dev/null || break
257 diff conftest.out conftest.nl >/dev/null 2>&1 || break
258 _G_count=`expr $_G_count + 1`
259 if test "$_G_count" -gt "$_G_path_prog_max"; then
260 # Best one so far, save it but keep looking for a better one
261 func_check_prog_result=$_G_path_prog
262 _G_path_prog_max=$_G_count
264 # 10*(2^10) chars as input seems more than enough
265 test 10 -lt "$_G_count" && break
267 rm -f conftest.in conftest.tmp conftest.nl conftest.out
270 func_path_progs "sed gsed" func_check_prog_sed "$PATH:/usr/xpg4/bin"
272 SED=$func_path_progs_result
276 # Unless the user overrides by setting GREP, search the path for either GNU
277 # grep, or the grep that truncates its output the least.
279 func_check_prog_grep ()
285 printf 0123456789 >conftest.in
288 cat conftest.in conftest.in >conftest.tmp
289 mv conftest.tmp conftest.in
290 cp conftest.in conftest.nl
291 echo 'GREP' >> conftest.nl
292 "$_G_path_prog" -e 'GREP$' -e '-(cannot match)-' <conftest.nl >conftest.out 2>/dev/null || break
293 diff conftest.out conftest.nl >/dev/null 2>&1 || break
294 _G_count=`expr $_G_count + 1`
295 if test "$_G_count" -gt "$_G_path_prog_max"; then
296 # Best one so far, save it but keep looking for a better one
297 func_check_prog_result=$_G_path_prog
298 _G_path_prog_max=$_G_count
300 # 10*(2^10) chars as input seems more than enough
301 test 10 -lt "$_G_count" && break
303 rm -f conftest.in conftest.tmp conftest.nl conftest.out
306 func_path_progs "grep ggrep" func_check_prog_grep "$PATH:/usr/xpg4/bin"
307 GREP=$func_path_progs_result
311 ## ------------------------------- ##
312 ## User overridable command paths. ##
313 ## ------------------------------- ##
315 # All uppercase variable names are used for environment variables. These
316 # variables can be overridden by the user before calling a script that
317 # uses them if a suitable command of that name is not already available
318 # in the command search PATH.
321 : ${ECHO="printf %s\n"}
322 : ${EGREP="$GREP -E"}
323 : ${FGREP="$GREP -F"}
329 : ${SHELL="${CONFIG_SHELL-/bin/sh}"}
332 ## -------------------- ##
333 ## Useful sed snippets. ##
334 ## -------------------- ##
336 sed_dirname='s|/[^/]*$||'
337 sed_basename='s|^.*/||'
339 # Sed substitution that helps us do robust quoting. It backslashifies
340 # metacharacters that are still active within double-quoted strings.
341 sed_quote_subst='s|\([`"$\\]\)|\\\1|g'
343 # Same as above, but do not quote variable references.
344 sed_double_quote_subst='s/\(["`\\]\)/\\\1/g'
346 # Sed substitution that turns a string into a regex matching for the
348 sed_make_literal_regex='s|[].[^$\\*\/]|\\&|g'
350 # Sed substitution that converts a w32 file name or path
351 # that contains forward slashes, into one that contains
352 # (escaped) backslashes. A very naive implementation.
353 sed_naive_backslashify='s|\\\\*|\\|g;s|/|\\|g;s|\\|\\\\|g'
355 # Re-'\' parameter expansions in output of sed_double_quote_subst that
356 # were '\'-ed in input to the same. If an odd number of '\' preceded a
357 # '$' in input to sed_double_quote_subst, that '$' was protected from
358 # expansion. Since each input '\' is now two '\'s, look for any number
359 # of runs of four '\'s followed by two '\'s and then a '$'. '\' that '$'.
364 sed_double_backslash="\
367 s/^$_G_bs2$_G_dollar/$_G_bs&/
368 s/\\([^$_G_bs]\\)$_G_bs2$_G_dollar/\\1$_G_bs2$_G_bs$_G_dollar/g
372 ## ----------------- ##
373 ## Global variables. ##
374 ## ----------------- ##
376 # Except for the global variables explicitly listed below, the following
377 # functions in the '^func_' namespace, and the '^require_' namespace
378 # variables initialised in the 'Resource management' section, sourcing
379 # this file will not pollute your global namespace with anything
380 # else. There's no portable way to scope variables in Bourne shell
381 # though, so actually running these functions will sometimes place
382 # results into a variable named after the function, and often use
383 # temporary variables in the '^_G_' namespace. If you are careful to
384 # avoid using those namespaces casually in your sourcing script, things
385 # should continue to work as you expect. And, of course, you can freely
386 # overwrite any of the functions or variables defined here before
387 # calling anything to customize them.
391 EXIT_MISMATCH=63 # $? = 63 is used to indicate version mismatch to missing.
392 EXIT_SKIP=77 # $? = 77 is used to indicate a skipped test to automake.
394 # Allow overriding, eg assuming that you follow the convention of
395 # putting '$debug_cmd' at the start of all your functions, you can get
396 # bash to show function call trace with:
398 # debug_cmd='eval echo "${FUNCNAME[0]} $*" >&2' bash your-script-name
399 debug_cmd=${debug_cmd-":"}
402 # By convention, finish your script with:
406 # so that you can set exit_status to non-zero if you want to indicate
407 # something went wrong during execution without actually bailing out at
408 # the point of failure.
409 exit_status=$EXIT_SUCCESS
411 # Work around backward compatibility issue on IRIX 6.5. On IRIX 6.4+, sh
412 # is ksh but when the shell is invoked as "sh" and the current value of
413 # the _XPG environment variable is not equal to 1 (one), the special
414 # positional parameter $0, within a function call, is the name of the
418 # The name of this program.
419 progname=`$ECHO "$progpath" |$SED "$sed_basename"`
421 # Make sure we have an absolute progpath for reexecution:
423 [\\/]*|[A-Za-z]:\\*) ;;
425 progdir=`$ECHO "$progpath" |$SED "$sed_dirname"`
426 progdir=`cd "$progdir" && pwd`
427 progpath=$progdir/$progname
431 IFS=${PATH_SEPARATOR-:}
432 for progdir in $PATH; do
434 test -x "$progdir/$progname" && break
437 test -n "$progdir" || progdir=`pwd`
438 progpath=$progdir/$progname
443 ## ----------------- ##
444 ## Standard options. ##
445 ## ----------------- ##
447 # The following options affect the operation of the functions defined
448 # below, and should be set appropriately depending on run-time para-
449 # meters passed on the command line.
455 # Categories 'all' and 'none' are always available. Append any others
456 # you will pass as the first argument to func_warning from your own
460 # By default, display warnings according to 'opt_warning_types'. Set
461 # 'warning_func' to ':' to elide all warnings, or func_fatal_error to
462 # treat the next displayed warning as a fatal error.
463 warning_func=func_warn_and_continue
465 # Set to 'all' to display all warnings, 'none' to suppress all
466 # warnings, or a space delimited list of some subset of
467 # 'warning_categories' to display only the listed warnings.
468 opt_warning_types=all
471 ## -------------------- ##
472 ## Resource management. ##
473 ## -------------------- ##
475 # This section contains definitions for functions that each ensure a
476 # particular resource (a file, or a non-empty configuration variable for
477 # example) is available, and if appropriate to extract default values
478 # from pertinent package files. Call them using their associated
479 # 'require_*' variable to ensure that they are executed, at most, once.
481 # It's entirely deliberate that calling these functions can set
482 # variables that don't obey the namespace limitations obeyed by the rest
483 # of this file, in order that that they be as useful as possible to
487 # require_term_colors
488 # -------------------
489 # Allow display of bold text on terminals that support it.
490 require_term_colors=func_require_term_colors
491 func_require_term_colors ()
496 # COLORTERM and USE_ANSI_COLORS environment variables take
497 # precedence, because most terminfo databases neglect to describe
498 # whether color sequences are supported.
499 test -n "${COLORTERM+set}" && : ${USE_ANSI_COLORS="1"}
501 if test 1 = "$USE_ANSI_COLORS"; then
502 # Standard ANSI escape sequences
504 tc_bold='
\e[1m'; tc_standout='
\e[7m'
505 tc_red='
\e[31m'; tc_green='
\e[32m'
506 tc_blue='
\e[34m'; tc_cyan='
\e[36m'
508 # Otherwise trust the terminfo database after all.
509 test -n "`tput sgr0 2>/dev/null`" && {
511 test -n "`tput bold 2>/dev/null`" && tc_bold=`tput bold`
513 test -n "`tput smso 2>/dev/null`" && tc_standout=`tput smso`
514 test -n "`tput setaf 1 2>/dev/null`" && tc_red=`tput setaf 1`
515 test -n "`tput setaf 2 2>/dev/null`" && tc_green=`tput setaf 2`
516 test -n "`tput setaf 4 2>/dev/null`" && tc_blue=`tput setaf 4`
517 test -n "`tput setaf 5 2>/dev/null`" && tc_cyan=`tput setaf 5`
522 require_term_colors=:
526 ## ----------------- ##
527 ## Function library. ##
528 ## ----------------- ##
530 # This section contains a variety of useful functions to call in your
531 # scripts. Take note of the portable wrappers for features provided by
532 # some modern shells, which will fall back to slower equivalents on
533 # less featureful shells.
536 # func_append VAR VALUE
537 # ---------------------
538 # Append VALUE onto the existing contents of VAR.
540 # We should try to minimise forks, especially on Windows where they are
541 # unreasonably slow, so skip the feature probes when bash or zsh are
543 if test set = "${BASH_VERSION+set}${ZSH_VERSION+set}"; then
544 : ${_G_HAVE_ARITH_OP="yes"}
545 : ${_G_HAVE_XSI_OPS="yes"}
546 # The += operator was introduced in bash 3.1
547 case $BASH_VERSION in
548 [12].* | 3.0 | 3.0*) ;;
550 : ${_G_HAVE_PLUSEQ_OP="yes"}
556 # Can be empty, in which case the shell is probed, "yes" if += is
557 # useable or anything else if it does not work.
558 test -z "$_G_HAVE_PLUSEQ_OP" \
559 && (eval 'x=a; x+=" b"; test "a b" = "$x"') 2>/dev/null \
560 && _G_HAVE_PLUSEQ_OP=yes
562 if test yes = "$_G_HAVE_PLUSEQ_OP"
564 # This is an XSI compatible shell, allowing a faster implementation...
572 # ...otherwise fall back to using expr, which is often a shell builtin.
582 # func_append_quoted VAR VALUE
583 # ----------------------------
584 # Quote VALUE and append to the end of shell variable VAR, separated
586 if test yes = "$_G_HAVE_PLUSEQ_OP"; then
587 eval 'func_append_quoted ()
591 func_quote_arg pretty "$2"
592 eval "$1+=\\ \$func_quote_arg_result"
595 func_append_quoted ()
599 func_quote_arg pretty "$2"
600 eval "$1=\$$1\\ \$func_quote_arg_result"
605 # func_append_uniq VAR VALUE
606 # --------------------------
607 # Append unique VALUE onto the existing contents of VAR, assuming
608 # entries are delimited by the first character of VALUE. For example:
610 # func_append_uniq options " --another-option option-argument"
612 # will only append to $options if " --another-option option-argument "
613 # is not already present somewhere in $options already (note spaces at
614 # each end implied by leading space in second argument).
619 eval _G_current_value='`$ECHO $'$1'`'
620 _G_delim=`expr "$2" : '\(.\)'`
622 case $_G_delim$_G_current_value$_G_delim in
624 *) func_append "$@" ;;
631 # Set func_arith_result to the result of evaluating TERMs.
632 test -z "$_G_HAVE_ARITH_OP" \
633 && (eval 'test 2 = $(( 1 + 1 ))') 2>/dev/null \
634 && _G_HAVE_ARITH_OP=yes
636 if test yes = "$_G_HAVE_ARITH_OP"; then
641 func_arith_result=$(( $* ))
648 func_arith_result=`expr "$@"`
655 # Set func_basename_result to FILE with everything up to and including
656 # the last / stripped.
657 if test yes = "$_G_HAVE_XSI_OPS"; then
658 # If this shell supports suffix pattern removal, then use it to avoid
659 # forking. Hide the definitions single quotes in case the shell chokes
660 # on unsupported syntax...
661 _b='func_basename_result=${1##*/}'
663 */*) func_dirname_result=${1%/*}$2 ;;
664 * ) func_dirname_result=$3 ;;
668 # ...otherwise fall back to using sed.
669 _b='func_basename_result=`$ECHO "$1" |$SED "$sed_basename"`'
670 _d='func_dirname_result=`$ECHO "$1" |$SED "$sed_dirname"`
671 if test "X$func_dirname_result" = "X$1"; then
672 func_dirname_result=$3
674 func_append func_dirname_result "$2"
678 eval 'func_basename ()
686 # func_dirname FILE APPEND NONDIR_REPLACEMENT
687 # -------------------------------------------
688 # Compute the dirname of FILE. If nonempty, add APPEND to the result,
689 # otherwise set result to NONDIR_REPLACEMENT.
690 eval 'func_dirname ()
698 # func_dirname_and_basename FILE APPEND NONDIR_REPLACEMENT
699 # --------------------------------------------------------
700 # Perform func_basename and func_dirname in a single function
702 # dirname: Compute the dirname of FILE. If nonempty,
703 # add APPEND to the result, otherwise set result
704 # to NONDIR_REPLACEMENT.
705 # value returned in "$func_dirname_result"
706 # basename: Compute filename of FILE.
707 # value retuned in "$func_basename_result"
708 # For efficiency, we do not delegate to the functions above but instead
709 # duplicate the functionality here.
710 eval 'func_dirname_and_basename ()
721 # Echo program name prefixed message.
730 for _G_line in $_G_message; do
732 $ECHO "$progname: $_G_line"
738 # func_echo_all ARG...
739 # --------------------
740 # Invoke $ECHO with all args, space-separated.
747 # func_echo_infix_1 INFIX ARG...
748 # ------------------------------
749 # Echo program name, followed by INFIX on the first line, with any
750 # additional lines not showing INFIX.
759 _G_prefix="$progname: $_G_infix: "
762 # Strip color escape sequences before counting printable length
763 for _G_tc in "$tc_reset" "$tc_bold" "$tc_standout" "$tc_red" "$tc_green" "$tc_blue" "$tc_cyan"
765 test -n "$_G_tc" && {
766 _G_esc_tc=`$ECHO "$_G_tc" | $SED "$sed_make_literal_regex"`
767 _G_indent=`$ECHO "$_G_indent" | $SED "s|$_G_esc_tc||g"`
770 _G_indent="$progname: "`echo "$_G_indent" | $SED 's|.| |g'`" " ## exclude from sc_prohibit_nested_quotes
772 func_echo_infix_1_IFS=$IFS
774 for _G_line in $_G_message; do
775 IFS=$func_echo_infix_1_IFS
776 $ECHO "$_G_prefix$tc_bold$_G_line$tc_reset" >&2
779 IFS=$func_echo_infix_1_IFS
785 # Echo program name prefixed message to standard error.
792 func_echo_infix_1 " $tc_standout${tc_red}error$tc_reset" "$*" >&2
796 # func_fatal_error ARG...
797 # -----------------------
798 # Echo program name prefixed message to standard error, and exit.
808 # func_grep EXPRESSION FILENAME
809 # -----------------------------
810 # Check whether EXPRESSION matches any line of FILENAME, without output.
815 $GREP "$1" "$2" >/dev/null 2>&1
821 # Set func_len_result to the length of STRING. STRING may not
822 # start with a hyphen.
823 test -z "$_G_HAVE_XSI_OPS" \
825 test 5aa/bb/cc = "${#x}${x%%/*}${x%/*}${x#*/}${x##*/}"') 2>/dev/null \
826 && _G_HAVE_XSI_OPS=yes
828 if test yes = "$_G_HAVE_XSI_OPS"; then
833 func_len_result=${#1}
840 func_len_result=`expr "$1" : ".*" 2>/dev/null || echo $max_cmd_len`
845 # func_mkdir_p DIRECTORY-PATH
846 # ---------------------------
847 # Make sure the entire path to DIRECTORY-PATH is available.
855 if test -n "$_G_directory_path" && test : != "$opt_dry_run"; then
857 # Protect directory names starting with '-'
858 case $_G_directory_path in
859 -*) _G_directory_path=./$_G_directory_path ;;
862 # While some portion of DIR does not yet exist...
863 while test ! -d "$_G_directory_path"; do
864 # ...make a list in topmost first order. Use a colon delimited
865 # list incase some portion of path contains whitespace.
866 _G_dir_list=$_G_directory_path:$_G_dir_list
868 # If the last portion added has no slash in it, the list is done
869 case $_G_directory_path in */*) ;; *) break ;; esac
871 # ...otherwise throw away the child directory and loop
872 _G_directory_path=`$ECHO "$_G_directory_path" | $SED -e "$sed_dirname"`
874 _G_dir_list=`$ECHO "$_G_dir_list" | $SED 's|:*$||'`
876 func_mkdir_p_IFS=$IFS; IFS=:
877 for _G_dir in $_G_dir_list; do
878 IFS=$func_mkdir_p_IFS
879 # mkdir can fail with a 'File exist' error if two processes
880 # try to create one of the directories concurrently. Don't
882 $MKDIR "$_G_dir" 2>/dev/null || :
884 IFS=$func_mkdir_p_IFS
886 # Bail out if we (or some other process) failed to create a directory.
887 test -d "$_G_directory_path" || \
888 func_fatal_error "Failed to create '$1'"
893 # func_mktempdir [BASENAME]
894 # -------------------------
895 # Make a temporary directory that won't clash with other running
896 # libtool processes, and avoids race conditions if possible. If
897 # given, BASENAME is the basename for that directory.
902 _G_template=${TMPDIR-/tmp}/${1-$progname}
904 if test : = "$opt_dry_run"; then
905 # Return a directory name, but don't create it in dry-run mode
906 _G_tmpdir=$_G_template-$$
909 # If mktemp works, use that first and foremost
910 _G_tmpdir=`mktemp -d "$_G_template-XXXXXXXX" 2>/dev/null`
912 if test ! -d "$_G_tmpdir"; then
913 # Failing that, at least try and use $RANDOM to avoid a race
914 _G_tmpdir=$_G_template-${RANDOM-0}$$
916 func_mktempdir_umask=`umask`
919 umask $func_mktempdir_umask
922 # If we're not in dry-run mode, bomb out on failure
923 test -d "$_G_tmpdir" || \
924 func_fatal_error "cannot create temporary directory '$_G_tmpdir'"
931 # func_normal_abspath PATH
932 # ------------------------
933 # Remove doubled-up and trailing slashes, "." path components,
934 # and cancel out any ".." path components in PATH after making
935 # it an absolute path.
936 func_normal_abspath ()
940 # These SED scripts presuppose an absolute path with a trailing slash.
941 _G_pathcar='s|^/\([^/]*\).*$|\1|'
942 _G_pathcdr='s|^/[^/]*||'
943 _G_removedotparts=':dotsl
947 _G_collapseslashes='s|/\{1,\}|/|g'
948 _G_finalslash='s|/*$|/|'
950 # Start from root dir and reassemble the path.
951 func_normal_abspath_result=
952 func_normal_abspath_tpath=$1
953 func_normal_abspath_altnamespace=
954 case $func_normal_abspath_tpath in
956 # Empty path, that just means $cwd.
957 func_stripname '' '/' "`pwd`"
958 func_normal_abspath_result=$func_stripname_result
961 # The next three entries are used to spot a run of precisely
962 # two leading slashes without using negated character classes;
963 # we take advantage of case's first-match behaviour.
965 # Unusual form of absolute path, do nothing.
968 # Not necessarily an ordinary path; POSIX reserves leading '//'
969 # and for example Cygwin uses it to access remote file shares
970 # over CIFS/SMB, so we conserve a leading double slash if found.
971 func_normal_abspath_altnamespace=/
974 # Absolute path, do nothing.
977 # Relative path, prepend $cwd.
978 func_normal_abspath_tpath=`pwd`/$func_normal_abspath_tpath
982 # Cancel out all the simple stuff to save iterations. We also want
983 # the path to end with a slash for ease of parsing, so make sure
984 # there is one (and only one) here.
985 func_normal_abspath_tpath=`$ECHO "$func_normal_abspath_tpath" | $SED \
986 -e "$_G_removedotparts" -e "$_G_collapseslashes" -e "$_G_finalslash"`
988 # Processed it all yet?
989 if test / = "$func_normal_abspath_tpath"; then
990 # If we ascended to the root using ".." the result may be empty now.
991 if test -z "$func_normal_abspath_result"; then
992 func_normal_abspath_result=/
996 func_normal_abspath_tcomponent=`$ECHO "$func_normal_abspath_tpath" | $SED \
998 func_normal_abspath_tpath=`$ECHO "$func_normal_abspath_tpath" | $SED \
1000 # Figure out what to do with it
1001 case $func_normal_abspath_tcomponent in
1003 # Trailing empty path component, ignore it.
1006 # Parent dir; strip last assembled component from result.
1007 func_dirname "$func_normal_abspath_result"
1008 func_normal_abspath_result=$func_dirname_result
1011 # Actual path component, append it.
1012 func_append func_normal_abspath_result "/$func_normal_abspath_tcomponent"
1016 # Restore leading double-slash if one was found on entry.
1017 func_normal_abspath_result=$func_normal_abspath_altnamespace$func_normal_abspath_result
1021 # func_notquiet ARG...
1022 # --------------------
1023 # Echo program name prefixed message only when not in quiet mode.
1028 $opt_quiet || func_echo ${1+"$@"}
1030 # A bug in bash halts the script if the last line of a function
1031 # fails when set -e is in force, so we need another command to
1037 # func_relative_path SRCDIR DSTDIR
1038 # --------------------------------
1039 # Set func_relative_path_result to the relative path from SRCDIR to DSTDIR.
1040 func_relative_path ()
1044 func_relative_path_result=
1045 func_normal_abspath "$1"
1046 func_relative_path_tlibdir=$func_normal_abspath_result
1047 func_normal_abspath "$2"
1048 func_relative_path_tbindir=$func_normal_abspath_result
1050 # Ascend the tree starting from libdir
1052 # check if we have found a prefix of bindir
1053 case $func_relative_path_tbindir in
1054 $func_relative_path_tlibdir)
1055 # found an exact match
1056 func_relative_path_tcancelled=
1059 $func_relative_path_tlibdir*)
1060 # found a matching prefix
1061 func_stripname "$func_relative_path_tlibdir" '' "$func_relative_path_tbindir"
1062 func_relative_path_tcancelled=$func_stripname_result
1063 if test -z "$func_relative_path_result"; then
1064 func_relative_path_result=.
1069 func_dirname $func_relative_path_tlibdir
1070 func_relative_path_tlibdir=$func_dirname_result
1071 if test -z "$func_relative_path_tlibdir"; then
1072 # Have to descend all the way to the root!
1073 func_relative_path_result=../$func_relative_path_result
1074 func_relative_path_tcancelled=$func_relative_path_tbindir
1077 func_relative_path_result=../$func_relative_path_result
1082 # Now calculate path; take care to avoid doubling-up slashes.
1083 func_stripname '' '/' "$func_relative_path_result"
1084 func_relative_path_result=$func_stripname_result
1085 func_stripname '/' '/' "$func_relative_path_tcancelled"
1086 if test -n "$func_stripname_result"; then
1087 func_append func_relative_path_result "/$func_stripname_result"
1090 # Normalisation. If bindir is libdir, return '.' else relative path.
1091 if test -n "$func_relative_path_result"; then
1092 func_stripname './' '' "$func_relative_path_result"
1093 func_relative_path_result=$func_stripname_result
1096 test -n "$func_relative_path_result" || func_relative_path_result=.
1102 # func_quote_portable EVAL ARG
1103 # ----------------------------
1104 # Internal function to portably implement func_quote_arg. Note that we still
1105 # keep attention to performance here so we as much as possible try to avoid
1106 # calling sed binary (so far O(N) complexity as long as func_append is O(1)).
1107 func_quote_portable ()
1111 func_quote_portable_result=$2
1113 # one-time-loop (easy break)
1117 func_quote_portable_result=`$ECHO "$2" | $SED \
1118 -e "$sed_double_quote_subst" -e "$sed_double_backslash"`
1123 case $func_quote_portable_result in
1125 case $func_quote_portable_result in
1127 func_quote_portable_result=`$ECHO "$func_quote_portable_result" \
1128 | $SED "$sed_quote_subst"`
1133 func_quote_portable_old_IFS=$IFS
1134 for _G_char in '\' '`' '"' '$'
1136 # STATE($1) PREV($2) SEPARATOR($3)
1138 func_quote_portable_result=dummy"$_G_char$func_quote_portable_result$_G_char"dummy
1140 for _G_part in $func_quote_portable_result
1144 func_append func_quote_portable_result "$3$2"
1145 set quote "$_G_part" "\\$_G_char"
1149 func_quote_portable_result=
1152 set quote "$_G_part" ""
1157 IFS=$func_quote_portable_old_IFS
1164 func_quote_portable_unquoted_result=$func_quote_portable_result
1165 case $func_quote_portable_result in
1166 # double-quote args containing shell metacharacters to delay
1167 # word splitting, command substitution and variable expansion
1168 # for a subsequent eval.
1169 # many bourne shells cannot handle close brackets correctly
1170 # in scan sets, so we specify it separately.
1171 *[\[\~\#\^\&\*\(\)\{\}\|\;\<\>\?\'\ \ ]*|*]*|"")
1172 func_quote_portable_result=\"$func_quote_portable_result\"
1178 # func_quotefast_eval ARG
1179 # -----------------------
1180 # Quote one ARG (internal). This is equivalent to 'func_quote_arg eval ARG',
1181 # but optimized for speed. Result is stored in $func_quotefast_eval.
1182 if test xyes = `(x=; printf -v x %q yes; echo x"$x") 2>/dev/null`; then
1183 printf -v _GL_test_printf_tilde %q '~'
1184 if test '\~' = "$_GL_test_printf_tilde"; then
1185 func_quotefast_eval ()
1187 printf -v func_quotefast_eval_result %q "$1"
1190 # Broken older Bash implementations. Make those faster too if possible.
1191 func_quotefast_eval ()
1195 func_quote_portable false "$1"
1196 func_quotefast_eval_result=$func_quote_portable_result
1199 printf -v func_quotefast_eval_result %q "$1"
1205 func_quotefast_eval ()
1207 func_quote_portable false "$1"
1208 func_quotefast_eval_result=$func_quote_portable_result
1213 # func_quote_arg MODEs ARG
1214 # ------------------------
1215 # Quote one ARG to be evaled later. MODEs argument may contain zero or more
1216 # specifiers listed below separated by ',' character. This function returns two
1218 # i) func_quote_arg_result
1219 # double-quoted (when needed), suitable for a subsequent eval
1220 # ii) func_quote_arg_unquoted_result
1221 # has all characters that are still active within double
1222 # quotes backslashified. Available only if 'unquoted' is specified.
1227 # - escape shell special characters
1229 # - the same as 'eval'; but do not quote variable references
1231 # - request aesthetic output, i.e. '"a b"' instead of 'a\ b'. This might
1232 # be used later in func_quote to get output like: 'echo "a b"' instead
1233 # of 'echo a\ b'. This is slower than default on some shells.
1235 # - produce also $func_quote_arg_unquoted_result which does not contain
1236 # wrapping double-quotes.
1238 # Examples for 'func_quote_arg pretty,unquoted string':
1240 # string | *_result | *_unquoted_result
1241 # ------------+-----------------------+-------------------
1244 # "a b" | "\"a b\"" | \"a b\"
1246 # z="${x-$y}" | "z=\"\${x-\$y}\"" | z=\"\${x-\$y}\"
1248 # Examples for 'func_quote_arg pretty,unquoted,expand string':
1250 # string | *_result | *_unquoted_result
1251 # --------------+---------------------+--------------------
1252 # z="${x-$y}" | "z=\"${x-$y}\"" | z=\"${x-$y}\"
1255 _G_quote_expand=false
1263 *,pretty,*|*,expand,*|*,unquoted,*)
1264 func_quote_portable $_G_quote_expand "$2"
1265 func_quote_arg_result=$func_quote_portable_result
1266 func_quote_arg_unquoted_result=$func_quote_portable_unquoted_result
1269 # Faster quote-for-eval for some shells.
1270 func_quotefast_eval "$2"
1271 func_quote_arg_result=$func_quotefast_eval_result
1277 # func_quote MODEs ARGs...
1278 # ------------------------
1279 # Quote all ARGs to be evaled later and join them into single command. See
1280 # func_quote_arg's description for more info.
1284 _G_func_quote_mode=$1 ; shift
1286 while test 0 -lt $#; do
1287 func_quote_arg "$_G_func_quote_mode" "$1"
1288 if test -n "$func_quote_result"; then
1289 func_append func_quote_result " $func_quote_arg_result"
1291 func_append func_quote_result "$func_quote_arg_result"
1298 # func_stripname PREFIX SUFFIX NAME
1299 # ---------------------------------
1300 # strip PREFIX and SUFFIX from NAME, and store in func_stripname_result.
1301 # PREFIX and SUFFIX must not contain globbing or regex special
1302 # characters, hashes, percent signs, but SUFFIX may contain a leading
1303 # dot (in which case that matches only a dot).
1304 if test yes = "$_G_HAVE_XSI_OPS"; then
1305 eval 'func_stripname ()
1309 # pdksh 5.2.14 does not do ${X%$Y} correctly if both X and Y are
1310 # positional parameters, so assign one to ordinary variable first.
1311 func_stripname_result=$3
1312 func_stripname_result=${func_stripname_result#"$1"}
1313 func_stripname_result=${func_stripname_result%"$2"}
1321 .*) func_stripname_result=`$ECHO "$3" | $SED -e "s%^$1%%" -e "s%\\\\$2\$%%"`;;
1322 *) func_stripname_result=`$ECHO "$3" | $SED -e "s%^$1%%" -e "s%$2\$%%"`;;
1328 # func_show_eval CMD [FAIL_EXP]
1329 # -----------------------------
1330 # Unless opt_quiet is true, then output CMD. Then, if opt_dryrun is
1331 # not true, evaluate CMD. If the evaluation of CMD fails, and FAIL_EXP
1332 # is given, then evaluate it.
1338 _G_fail_exp=${2-':'}
1340 func_quote_arg pretty,expand "$_G_cmd"
1341 eval "func_notquiet $func_quote_arg_result"
1346 if test 0 -ne "$_G_status"; then
1347 eval "(exit $_G_status); $_G_fail_exp"
1353 # func_show_eval_locale CMD [FAIL_EXP]
1354 # ------------------------------------
1355 # Unless opt_quiet is true, then output CMD. Then, if opt_dryrun is
1356 # not true, evaluate CMD. If the evaluation of CMD fails, and FAIL_EXP
1357 # is given, then evaluate it. Use the saved locale for evaluation.
1358 func_show_eval_locale ()
1363 _G_fail_exp=${2-':'}
1366 func_quote_arg expand,pretty "$_G_cmd"
1367 eval "func_echo $func_quote_arg_result"
1371 eval "$_G_user_locale
1374 eval "$_G_safe_locale"
1375 if test 0 -ne "$_G_status"; then
1376 eval "(exit $_G_status); $_G_fail_exp"
1384 # Turn $1 into a string suitable for a shell variable name.
1385 # Result is stored in $func_tr_sh_result. All characters
1386 # not in the set a-zA-Z0-9_ are replaced with '_'. Further,
1387 # if $1 begins with a digit, a '_' is prepended as well.
1393 [0-9]* | *[!a-zA-Z0-9_]*)
1394 func_tr_sh_result=`$ECHO "$1" | $SED -e 's/^\([0-9]\)/_\1/' -e 's/[^a-zA-Z0-9_]/_/g'`
1397 func_tr_sh_result=$1
1403 # func_verbose ARG...
1404 # -------------------
1405 # Echo program name prefixed message in verbose mode only.
1410 $opt_verbose && func_echo "$*"
1416 # func_warn_and_continue ARG...
1417 # -----------------------------
1418 # Echo program name prefixed warning message to standard error.
1419 func_warn_and_continue ()
1423 $require_term_colors
1425 func_echo_infix_1 "${tc_red}warning$tc_reset" "$*" >&2
1429 # func_warning CATEGORY ARG...
1430 # ----------------------------
1431 # Echo program name prefixed warning message to standard error. Warning
1432 # messages can be filtered according to CATEGORY, where this function
1433 # elides messages where CATEGORY is not listed in the global variable
1434 # 'opt_warning_types'.
1439 # CATEGORY must be in the warning_categories list!
1440 case " $warning_categories " in
1442 *) func_internal_error "invalid warning category '$1'" ;;
1448 case " $opt_warning_types " in
1449 *" $_G_category "*) $warning_func ${1+"$@"} ;;
1454 # func_sort_ver VER1 VER2
1455 # -----------------------
1456 # 'sort -V' is not generally available.
1457 # Note this deviates from the version comparison in automake
1458 # in that it treats 1.5 < 1.5.0, and treats 1.4.4a < 1.4-p3a
1459 # but this should suffice as we won't be specifying old
1460 # version formats or redundant trailing .0 in bootstrap.conf.
1461 # If we did want full compatibility then we should probably
1462 # use m4_version_compare from autoconf.
1467 printf '%s\n%s\n' "$1" "$2" \
1468 | sort -t. -k 1,1n -k 2,2n -k 3,3n -k 4,4n -k 5,5n -k 6,6n -k 7,7n -k 8,8n -k 9,9n
1471 # func_lt_ver PREV CURR
1472 # ---------------------
1473 # Return true if PREV and CURR are in the correct order according to
1474 # func_sort_ver, otherwise false. Use it like this:
1476 # func_lt_ver "$prev_ver" "$proposed_ver" || func_fatal_error "..."
1481 test "x$1" = x`func_sort_ver "$1" "$2" | $SED 1q`
1486 # mode: shell-script
1488 # eval: (add-hook 'before-save-hook 'time-stamp)
1489 # time-stamp-pattern: "10/scriptversion=%:y-%02m-%02d.%02H; # UTC"
1490 # time-stamp-time-zone: "UTC"
1494 # A portable, pluggable option parser for Bourne shell.
1495 # Written by Gary V. Vaughan, 2010
1497 # This is free software. There is NO warranty; not even for
1498 # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
1500 # Copyright (C) 2010-2017 Bootstrap Authors
1502 # This file is dual licensed under the terms of the MIT license
1503 # <https://opensource.org/license/MIT>, and GPL version 3 or later
1504 # <http://www.gnu.org/licenses/gpl-2.0.html>. You must apply one of
1505 # these licenses when using or redistributing this software or any of
1506 # the files within it. See the URLs above, or the file `LICENSE`
1507 # included in the Bootstrap distribution for the full license texts.
1509 # Please report bugs or propose patches to:
1510 # <https://github.com/gnulib-modules/bootstrap/issues>
1512 # Set a version string for this script.
1513 scriptversion=2016-03-06.01; # UTC
1520 # This file is a library for parsing options in your shell scripts along
1521 # with assorted other useful supporting features that you can make use
1524 # For the simplest scripts you might need only:
1527 # . relative/path/to/funclib.sh
1528 # . relative/path/to/options-parser
1530 # func_options ${1+"$@"}
1531 # eval set dummy "$func_options_result"; shift
1532 # ...rest of your script...
1534 # In order for the '--version' option to work, you will need to have a
1535 # suitably formatted comment like the one at the top of this file
1536 # starting with '# Written by ' and ending with '# Copyright'.
1538 # For '-h' and '--help' to work, you will also need a one line
1539 # description of your script's purpose in a comment directly above the
1540 # '# Written by ' line, like the one at the top of this file.
1542 # The default options also support '--debug', which will turn on shell
1543 # execution tracing (see the comment above debug_cmd below for another
1544 # use), and '--verbose' and the func_verbose function to allow your script
1545 # to display verbose messages only when your user has specified
1548 # After sourcing this file, you can plug in processing for additional
1549 # options by amending the variables from the 'Configuration' section
1550 # below, and following the instructions in the 'Option parsing'
1551 # section further down.
1553 ## -------------- ##
1554 ## Configuration. ##
1555 ## -------------- ##
1557 # You should override these variables in your script after sourcing this
1558 # file so that they reflect the customisations you have added to the
1561 # The usage line for option parsing errors and the start of '-h' and
1562 # '--help' output messages. You can embed shell variables for delayed
1563 # expansion at the time the message is displayed, but you will need to
1564 # quote other shell meta-characters carefully to prevent them being
1565 # expanded when the contents are evaled.
1566 usage='$progpath [OPTION]...'
1568 # Short help message in response to '-h' and '--help'. Add to this or
1569 # override it after sourcing this library to reflect the full set of
1570 # options your script accepts.
1572 --debug enable verbose shell tracing
1573 -W, --warnings=CATEGORY
1574 report the warnings falling in CATEGORY [all]
1575 -v, --verbose verbosely report processing
1576 --version print version information and exit
1577 -h, --help print short or long help message and exit
1580 # Additional text appended to 'usage_message' in response to '--help'.
1582 Warning categories include:
1583 'all' show all warnings
1584 'none' turn off all the warnings
1585 'error' warnings are treated as fatal errors"
1587 # Help message printed before fatal option parsing errors.
1588 fatal_help="Try '\$progname --help' for more information."
1592 ## ------------------------- ##
1593 ## Hook function management. ##
1594 ## ------------------------- ##
1596 # This section contains functions for adding, removing, and running hooks
1597 # in the main code. A hook is just a list of function names that can be
1598 # run in order later on.
1600 # func_hookable FUNC_NAME
1601 # -----------------------
1602 # Declare that FUNC_NAME will run hooks added with
1603 # 'func_add_hook FUNC_NAME ...'.
1608 func_append hookable_fns " $1"
1612 # func_add_hook FUNC_NAME HOOK_FUNC
1613 # ---------------------------------
1614 # Request that FUNC_NAME call HOOK_FUNC before it returns. FUNC_NAME must
1615 # first have been declared "hookable" by a call to 'func_hookable'.
1620 case " $hookable_fns " in
1622 *) func_fatal_error "'$1' does not accept hook functions." ;;
1625 eval func_append ${1}_hooks '" $2"'
1629 # func_remove_hook FUNC_NAME HOOK_FUNC
1630 # ------------------------------------
1631 # Remove HOOK_FUNC from the list of hook functions to be called by
1637 eval ${1}_hooks='`$ECHO "\$'$1'_hooks" |$SED "s| '$2'||"`'
1641 # func_propagate_result FUNC_NAME_A FUNC_NAME_B
1642 # ---------------------------------------------
1643 # If the *_result variable of FUNC_NAME_A _is set_, assign its value to
1644 # *_result variable of FUNC_NAME_B.
1645 func_propagate_result ()
1649 func_propagate_result_result=:
1650 if eval "test \"\${${1}_result+set}\" = set"
1652 eval "${2}_result=\$${1}_result"
1654 func_propagate_result_result=false
1659 # func_run_hooks FUNC_NAME [ARG]...
1660 # ---------------------------------
1661 # Run all hook functions registered to FUNC_NAME.
1662 # It's assumed that the list of hook functions contains nothing more
1663 # than a whitespace-delimited list of legal shell function names, and
1664 # no effort is wasted trying to catch shell meta-characters or preserve
1670 case " $hookable_fns " in
1672 *) func_fatal_error "'$1' does not support hook functions." ;;
1675 eval _G_hook_fns=\$$1_hooks; shift
1677 for _G_hook in $_G_hook_fns; do
1678 func_unset "${_G_hook}_result"
1679 eval $_G_hook '${1+"$@"}'
1680 func_propagate_result $_G_hook func_run_hooks
1681 if $func_propagate_result_result; then
1682 eval set dummy "$func_run_hooks_result"; shift
1689 ## --------------- ##
1690 ## Option parsing. ##
1691 ## --------------- ##
1693 # In order to add your own option parsing hooks, you must accept the
1694 # full positional parameter list from your hook function. You may remove
1695 # or edit any options that you action, and then pass back the remaining
1696 # unprocessed options in '<hooked_function_name>_result', escaped
1697 # suitably for 'eval'.
1699 # The '<hooked_function_name>_result' variable is automatically unset
1700 # before your hook gets called; for best performance, only set the
1701 # *_result variable when necessary (i.e. don't call the 'func_quote'
1702 # function unnecessarily because it can be an expensive operation on some
1707 # my_options_prep ()
1711 # # Extend the existing usage message.
1712 # usage_message=$usage_message'
1713 # -s, --silent don'\''t print informational messages
1715 # # No change in '$@' (ignored completely by this hook). Leave
1716 # # my_options_prep_result variable intact.
1718 # func_add_hook func_options_prep my_options_prep
1721 # my_silent_option ()
1725 # args_changed=false
1727 # # Note that, for efficiency, we parse as many options as we can
1728 # # recognise in a loop before passing the remainder back to the
1729 # # caller on the first unrecognised argument we encounter.
1730 # while test $# -gt 0; do
1733 # --silent|-s) opt_silent=:
1736 # # Separate non-argument short options:
1737 # -s*) func_split_short_opt "$_G_opt"
1738 # set dummy "$func_split_short_opt_name" \
1739 # "-$func_split_short_opt_arg" ${1+"$@"}
1743 # *) # Make sure the first unrecognised option "$_G_opt"
1744 # # is added back to "$@" in case we need it later,
1745 # # if $args_changed was set to 'true'.
1746 # set dummy "$_G_opt" ${1+"$@"}; shift; break ;;
1750 # # Only call 'func_quote' here if we processed at least one argument.
1751 # if $args_changed; then
1752 # func_quote eval ${1+"$@"}
1753 # my_silent_option_result=$func_quote_result
1756 # func_add_hook func_parse_options my_silent_option
1759 # my_option_validation ()
1763 # $opt_silent && $opt_verbose && func_fatal_help "\
1764 # '--silent' and '--verbose' options are mutually exclusive."
1766 # func_add_hook func_validate_options my_option_validation
1768 # You'll also need to manually amend $usage_message to reflect the extra
1769 # options you parse. It's preferable to append if you can, so that
1770 # multiple option parsing hooks can be added safely.
1773 # func_options_finish [ARG]...
1774 # ----------------------------
1775 # Finishing the option parse loop (call 'func_options' hooks ATM).
1776 func_options_finish ()
1780 func_run_hooks func_options ${1+"$@"}
1781 func_propagate_result func_run_hooks func_options_finish
1785 # func_options [ARG]...
1786 # ---------------------
1787 # All the functions called inside func_options are hookable. See the
1788 # individual implementations for details.
1789 func_hookable func_options
1794 _G_options_quoted=false
1796 for my_func in options_prep parse_options validate_options options_finish
1798 func_unset func_${my_func}_result
1799 func_unset func_run_hooks_result
1800 eval func_$my_func '${1+"$@"}'
1801 func_propagate_result func_$my_func func_options
1802 if $func_propagate_result_result; then
1803 eval set dummy "$func_options_result"; shift
1808 $_G_options_quoted || {
1809 # As we (func_options) are top-level options-parser function and
1810 # nobody quoted "$@" for us yet, we need to do it explicitly for
1812 func_quote eval ${1+"$@"}
1813 func_options_result=$func_quote_result
1818 # func_options_prep [ARG]...
1819 # --------------------------
1820 # All initialisations required before starting the option parse loop.
1821 # Note that when calling hook functions, we pass through the list of
1822 # positional parameters. If a hook function modifies that list, and
1823 # needs to propagate that back to rest of this script, then the complete
1824 # modified list must be put in 'func_run_hooks_result' before returning.
1825 func_hookable func_options_prep
1826 func_options_prep ()
1834 func_run_hooks func_options_prep ${1+"$@"}
1835 func_propagate_result func_run_hooks func_options_prep
1839 # func_parse_options [ARG]...
1840 # ---------------------------
1841 # The main option parsing loop.
1842 func_hookable func_parse_options
1843 func_parse_options ()
1847 _G_parse_options_requote=false
1848 # this just eases exit handling
1849 while test $# -gt 0; do
1850 # Defer to hook functions for initial option parsing, so they
1851 # get priority in the event of reusing an option name.
1852 func_run_hooks func_parse_options ${1+"$@"}
1853 func_propagate_result func_run_hooks func_parse_options
1854 if $func_propagate_result_result; then
1855 eval set dummy "$func_parse_options_result"; shift
1856 # Even though we may have changed "$@", we passed the "$@" array
1857 # down into the hook and it quoted it for us (because we are in
1858 # this if-branch). No need to quote it again.
1859 _G_parse_options_requote=false
1862 # Break out of the loop if we already parsed every option.
1863 test $# -gt 0 || break
1865 # We expect that one of the options parsed in this function matches
1866 # and thus we remove _G_opt from "$@" and need to re-quote.
1867 _G_match_parse_options=:
1871 --debug|-x) debug_cmd='set -x'
1872 func_echo "enabling shell trace mode" >&2
1876 --no-warnings|--no-warning|--no-warn)
1877 set dummy --warnings none ${1+"$@"}
1881 --warnings|--warning|-W)
1882 if test $# = 0 && func_missing_arg $_G_opt; then
1883 _G_parse_options_requote=:
1886 case " $warning_categories $1" in
1888 # trailing space prevents matching last $1 above
1889 func_append_uniq opt_warning_types " $1"
1892 opt_warning_types=$warning_categories
1895 opt_warning_types=none
1899 opt_warning_types=$warning_categories
1900 warning_func=func_fatal_error
1904 "unsupported warning category: '$1'"
1910 --verbose|-v) opt_verbose=: ;;
1911 --version) func_version ;;
1912 -\?|-h) func_usage ;;
1913 --help) func_help ;;
1915 # Separate optargs to long options (plugins may need this):
1916 --*=*) func_split_equals "$_G_opt"
1917 set dummy "$func_split_equals_lhs" \
1918 "$func_split_equals_rhs" ${1+"$@"}
1922 # Separate optargs to short options:
1924 func_split_short_opt "$_G_opt"
1925 set dummy "$func_split_short_opt_name" \
1926 "$func_split_short_opt_arg" ${1+"$@"}
1930 # Separate non-argument short options:
1932 func_split_short_opt "$_G_opt"
1933 set dummy "$func_split_short_opt_name" \
1934 "-$func_split_short_opt_arg" ${1+"$@"}
1938 --) _G_parse_options_requote=: ; break ;;
1939 -*) func_fatal_help "unrecognised option: '$_G_opt'" ;;
1940 *) set dummy "$_G_opt" ${1+"$@"}; shift
1941 _G_match_parse_options=false
1946 if $_G_match_parse_options; then
1947 _G_parse_options_requote=:
1951 if $_G_parse_options_requote; then
1952 # save modified positional parameters for caller
1953 func_quote eval ${1+"$@"}
1954 func_parse_options_result=$func_quote_result
1959 # func_validate_options [ARG]...
1960 # ------------------------------
1961 # Perform any sanity checks on option settings and/or unconsumed
1963 func_hookable func_validate_options
1964 func_validate_options ()
1968 # Display all warnings if -W was not given.
1969 test -n "$opt_warning_types" || opt_warning_types=" $warning_categories"
1971 func_run_hooks func_validate_options ${1+"$@"}
1972 func_propagate_result func_run_hooks func_validate_options
1974 # Bail if the options were screwed!
1975 $exit_cmd $EXIT_FAILURE
1980 ## ----------------- ##
1981 ## Helper functions. ##
1982 ## ----------------- ##
1984 # This section contains the helper functions used by the rest of the
1985 # hookable option parser framework in ascii-betical order.
1988 # func_fatal_help ARG...
1989 # ----------------------
1990 # Echo program name prefixed message to standard error, followed by
1991 # a help hint, and exit.
1996 eval \$ECHO \""Usage: $usage"\"
1997 eval \$ECHO \""$fatal_help"\"
1998 func_error ${1+"$@"}
2005 # Echo long help message to standard output and exit.
2011 $ECHO "$long_help_message"
2016 # func_missing_arg ARGNAME
2017 # ------------------------
2018 # Echo program name prefixed message to standard error and set global
2024 func_error "Missing argument for '$1'."
2029 # func_split_equals STRING
2030 # ------------------------
2031 # Set func_split_equals_lhs and func_split_equals_rhs shell variables
2032 # after splitting STRING at the '=' sign.
2033 test -z "$_G_HAVE_XSI_OPS" \
2035 test 5aa/bb/cc = "${#x}${x%%/*}${x%/*}${x#*/}${x##*/}"') 2>/dev/null \
2036 && _G_HAVE_XSI_OPS=yes
2038 if test yes = "$_G_HAVE_XSI_OPS"
2040 # This is an XSI compatible shell, allowing a faster implementation...
2041 eval 'func_split_equals ()
2045 func_split_equals_lhs=${1%%=*}
2046 func_split_equals_rhs=${1#*=}
2047 if test "x$func_split_equals_lhs" = "x$1"; then
2048 func_split_equals_rhs=
2052 # ...otherwise fall back to using expr, which is often a shell builtin.
2053 func_split_equals ()
2057 func_split_equals_lhs=`expr "x$1" : 'x\([^=]*\)'`
2058 func_split_equals_rhs=
2059 test "x$func_split_equals_lhs" = "x$1" \
2060 || func_split_equals_rhs=`expr "x$1" : 'x[^=]*=\(.*\)$'`
2062 fi #func_split_equals
2065 # func_split_short_opt SHORTOPT
2066 # -----------------------------
2067 # Set func_split_short_opt_name and func_split_short_opt_arg shell
2068 # variables after splitting SHORTOPT after the 2nd character.
2069 if test yes = "$_G_HAVE_XSI_OPS"
2071 # This is an XSI compatible shell, allowing a faster implementation...
2072 eval 'func_split_short_opt ()
2076 func_split_short_opt_arg=${1#??}
2077 func_split_short_opt_name=${1%"$func_split_short_opt_arg"}
2080 # ...otherwise fall back to using expr, which is often a shell builtin.
2081 func_split_short_opt ()
2085 func_split_short_opt_name=`expr "x$1" : 'x-\(.\)'`
2086 func_split_short_opt_arg=`expr "x$1" : 'x-.\(.*\)$'`
2088 fi #func_split_short_opt
2093 # Echo short help message to standard output and exit.
2099 $ECHO "Run '$progname --help |${PAGER-more}' for full usage"
2104 # func_usage_message
2105 # ------------------
2106 # Echo short help message to standard output.
2107 func_usage_message ()
2111 eval \$ECHO \""Usage: $usage"\"
2118 /^Written by/q' < "$progpath"
2120 eval \$ECHO \""$usage_message"\"
2126 # Echo version message to standard output and exit.
2127 # The version message is extracted from the calling file's header
2128 # comments, with leading '# ' stripped:
2129 # 1. First display the progname and version
2130 # 2. Followed by the header comment line matching /^# Written by /
2131 # 3. Then a blank line followed by the first following line matching
2133 # 4. Immediately followed by any lines between the previous matches,
2134 # except lines preceding the intervening completely blank line.
2135 # For example, see the header comments of this file.
2140 printf '%s\n' "$progname $scriptversion"
2161 s|\((C)\)[ 0-9,-]*[ ,-]\([1-9][0-9]* \)|\1 \2|
2171 # mode: shell-script
2173 # eval: (add-hook 'before-save-hook 'time-stamp)
2174 # time-stamp-pattern: "10/scriptversion=%:y-%02m-%02d.%02H; # UTC"
2175 # time-stamp-time-zone: "UTC"
2178 # Set a version string.
2179 scriptversion='(GNU libtool) 2.4.6.40-6ca5-dirty'
2184 # Libtool also displays the current mode in messages, so override
2185 # funclib.sh func_echo with this custom definition.
2194 for _G_line in $_G_message; do
2196 $ECHO "$progname${opt_mode+: $opt_mode}: $_G_line"
2202 # func_warning ARG...
2203 # -------------------
2204 # Libtool warnings are not categorized, so override funclib.sh
2205 # func_warning with this simpler definition.
2210 $warning_func ${1+"$@"}
2214 ## ---------------- ##
2215 ## Options parsing. ##
2216 ## ---------------- ##
2218 # Hook in the functions to make sure our own options are parsed during
2219 # the option parsing loop.
2221 usage='$progpath [OPTION]... [MODE-ARG]...'
2223 # Short help message in response to '-h'.
2224 usage_message="Options:
2225 --config show all configuration variables
2226 --debug enable verbose shell tracing
2227 -n, --dry-run display commands without modifying any files
2228 --features display basic configuration information and exit
2229 --mode=MODE use operation mode MODE
2230 --no-warnings equivalent to '-Wnone'
2231 --preserve-dup-deps don't remove duplicate dependency libraries
2232 --quiet, --silent don't print informational messages
2233 --tag=TAG use configuration variables from tag TAG
2234 -v, --verbose print more informational messages than default
2235 --version print version information
2236 -W, --warnings=CATEGORY report the warnings falling in CATEGORY [all]
2237 -h, --help, --help-all print short, long, or detailed help message
2240 # Additional text appended to 'usage_message' in response to '--help'.
2246 $ECHO "$long_help_message
2248 MODE must be one of the following:
2250 clean remove files from the build directory
2251 compile compile a source file into a libtool object
2252 execute automatically set library path, then run a program
2253 finish complete the installation of libtool libraries
2254 install install libraries or executables
2255 link create a library or an executable
2256 uninstall remove libraries from an installed directory
2258 MODE-ARGS vary depending on the MODE. When passed as first option,
2259 '--mode=MODE' may be abbreviated as 'MODE' or a unique abbreviation of that.
2260 Try '$progname --help --mode=MODE' for a more detailed description of MODE.
2262 When reporting a bug, please describe a test case to reproduce it and
2263 include the following information:
2268 compiler flags: $LTCFLAGS
2269 linker: $LD (gnu? $with_gnu_ld)
2270 version: $progname (GNU libtool) 2.4.6.40-6ca5-dirty
2271 automake: `($AUTOMAKE --version) 2>/dev/null |$SED 1q`
2272 autoconf: `($AUTOCONF --version) 2>/dev/null |$SED 1q`
2274 Report bugs to <bug-libtool@gnu.org>.
2275 GNU libtool home page: <http://www.gnu.org/s/libtool/>.
2276 General help using GNU software: <http://www.gnu.org/gethelp/>."
2281 # func_lo2o OBJECT-NAME
2282 # ---------------------
2283 # Transform OBJECT-NAME from a '.lo' suffix to the platform specific
2286 lo2o=s/\\.lo\$/.$objext/
2287 o2lo=s/\\.$objext\$/.lo/
2289 if test yes = "$_G_HAVE_XSI_OPS"; then
2293 *.lo) func_lo2o_result=${1%.lo}.$objext ;;
2294 * ) func_lo2o_result=$1 ;;
2298 # func_xform LIBOBJ-OR-SOURCE
2299 # ---------------------------
2300 # Transform LIBOBJ-OR-SOURCE from a '.o' or '.c' (or otherwise)
2301 # suffix to a '.lo' libtool-object suffix.
2304 func_xform_result=${1%.*}.lo
2307 # ...otherwise fall back to using sed.
2310 func_lo2o_result=`$ECHO "$1" | $SED "$lo2o"`
2315 func_xform_result=`$ECHO "$1" | $SED 's|\.[^.]*$|.lo|'`
2320 # func_fatal_configuration ARG...
2321 # -------------------------------
2322 # Echo program name prefixed message to standard error, followed by
2323 # a configuration failure hint, and exit.
2324 func_fatal_configuration ()
2326 func_fatal_error ${1+"$@"} \
2327 "See the $PACKAGE documentation for more information." \
2328 "Fatal configuration error."
2334 # Display the configuration for all the tags in this script.
2337 re_begincf='^# ### BEGIN LIBTOOL'
2338 re_endcf='^# ### END LIBTOOL'
2340 # Default configuration.
2341 $SED "1,/$re_begincf CONFIG/d;/$re_endcf CONFIG/,\$d" < "$progpath"
2343 # Now print the configurations for the tags.
2344 for tagname in $taglist; do
2345 $SED -n "/$re_begincf TAG CONFIG: $tagname\$/,/$re_endcf TAG CONFIG: $tagname\$/p" < "$progpath"
2354 # Display the features supported by this script.
2358 if test yes = "$build_libtool_libs"; then
2359 echo "enable shared libraries"
2361 echo "disable shared libraries"
2363 if test yes = "$build_old_libs"; then
2364 echo "enable static libraries"
2366 echo "disable static libraries"
2373 # func_enable_tag TAGNAME
2374 # -----------------------
2375 # Verify that TAGNAME is valid, and either flag an error and exit, or
2376 # enable the TAGNAME tag. We also add TAGNAME to the global $taglist
2383 re_begincf="^# ### BEGIN LIBTOOL TAG CONFIG: $tagname\$"
2384 re_endcf="^# ### END LIBTOOL TAG CONFIG: $tagname\$"
2385 sed_extractcf=/$re_begincf/,/$re_endcf/p
2390 func_fatal_error "invalid tag name: $tagname"
2394 # Don't test for the "default" C tag, as we know it's
2395 # there but not specially marked.
2399 if $GREP "$re_begincf" "$progpath" >/dev/null 2>&1; then
2400 taglist="$taglist $tagname"
2402 # Evaluate the configuration. Be careful to quote the path
2403 # and the sed script, to avoid splitting on whitespace, but
2404 # also don't use non-portable quotes within backquotes within
2405 # quotes we have to do it in 2 steps:
2406 extractedcf=`$SED -n -e "$sed_extractcf" < "$progpath"`
2409 func_error "ignoring unknown tag $tagname"
2416 # func_check_version_match
2417 # ------------------------
2418 # Ensure that we are using m4 macros, and libtool script from the same
2419 # release of libtool.
2420 func_check_version_match ()
2422 if test "$package_revision" != "$macro_revision"; then
2423 if test "$VERSION" != "$macro_version"; then
2424 if test -z "$macro_version"; then
2426 $progname: Version mismatch error. This is $PACKAGE $VERSION, but the
2427 $progname: definition of this LT_INIT comes from an older release.
2428 $progname: You should recreate aclocal.m4 with macros from $PACKAGE $VERSION
2429 $progname: and run autoconf again.
2433 $progname: Version mismatch error. This is $PACKAGE $VERSION, but the
2434 $progname: definition of this LT_INIT comes from $PACKAGE $macro_version.
2435 $progname: You should recreate aclocal.m4 with macros from $PACKAGE $VERSION
2436 $progname: and run autoconf again.
2441 $progname: Version mismatch error. This is $PACKAGE $VERSION, revision $package_revision,
2442 $progname: but the definition of this LT_INIT comes from revision $macro_revision.
2443 $progname: You should recreate aclocal.m4 with macros from revision $package_revision
2444 $progname: of $PACKAGE $VERSION and run autoconf again.
2453 # libtool_options_prep [ARG]...
2454 # -----------------------------
2455 # Preparation for options parsed by libtool.
2456 libtool_options_prep ()
2466 opt_preserve_dup_deps=false
2472 _G_rc_lt_options_prep=:
2474 # Shorthand for --mode=foo, only valid as the first argument
2477 shift; set dummy --mode clean ${1+"$@"}; shift
2479 compile|compil|compi|comp|com|co|c)
2480 shift; set dummy --mode compile ${1+"$@"}; shift
2482 execute|execut|execu|exec|exe|ex|e)
2483 shift; set dummy --mode execute ${1+"$@"}; shift
2485 finish|finis|fini|fin|fi|f)
2486 shift; set dummy --mode finish ${1+"$@"}; shift
2488 install|instal|insta|inst|ins|in|i)
2489 shift; set dummy --mode install ${1+"$@"}; shift
2492 shift; set dummy --mode link ${1+"$@"}; shift
2494 uninstall|uninstal|uninsta|uninst|unins|unin|uni|un|u)
2495 shift; set dummy --mode uninstall ${1+"$@"}; shift
2498 _G_rc_lt_options_prep=false
2502 if $_G_rc_lt_options_prep; then
2503 # Pass back the list of options.
2504 func_quote eval ${1+"$@"}
2505 libtool_options_prep_result=$func_quote_result
2508 func_add_hook func_options_prep libtool_options_prep
2511 # libtool_parse_options [ARG]...
2512 # ---------------------------------
2513 # Provide handling for libtool specific options.
2514 libtool_parse_options ()
2518 _G_rc_lt_parse_options=false
2520 # Perform our own loop to consume as many options as possible in
2522 while test $# -gt 0; do
2523 _G_match_lt_parse_options=:
2527 --dry-run|--dryrun|-n)
2531 --config) func_config ;;
2534 opt_dlopen="${opt_dlopen+$opt_dlopen
2539 --preserve-dup-deps)
2540 opt_preserve_dup_deps=: ;;
2542 --features) func_features ;;
2544 --finish) set dummy --mode finish ${1+"$@"}; shift ;;
2546 --help) opt_help=: ;;
2548 --help-all) opt_help=': help-all' ;;
2550 --mode) test $# = 0 && func_missing_arg $_G_opt && break
2553 # Valid mode arguments:
2554 clean|compile|execute|finish|install|link|relink|uninstall) ;;
2556 # Catch anything else as an error
2557 *) func_error "invalid argument for $_G_opt"
2565 --no-silent|--no-quiet)
2567 func_append preserve_args " $_G_opt"
2570 --no-warnings|--no-warning|--no-warn)
2572 func_append preserve_args " $_G_opt"
2577 func_append preserve_args " $_G_opt"
2583 func_append preserve_args " $_G_opt"
2586 --tag) test $# = 0 && func_missing_arg $_G_opt && break
2588 func_append preserve_args " $_G_opt $1"
2589 func_enable_tag "$1"
2593 --verbose|-v) opt_quiet=false
2595 func_append preserve_args " $_G_opt"
2598 # An option not handled by this hook function:
2599 *) set dummy "$_G_opt" ${1+"$@"} ; shift
2600 _G_match_lt_parse_options=false
2604 $_G_match_lt_parse_options && _G_rc_lt_parse_options=:
2607 if $_G_rc_lt_parse_options; then
2608 # save modified positional parameters for caller
2609 func_quote eval ${1+"$@"}
2610 libtool_parse_options_result=$func_quote_result
2613 func_add_hook func_parse_options libtool_parse_options
2617 # libtool_validate_options [ARG]...
2618 # ---------------------------------
2619 # Perform any sanity checks on option settings and/or unconsumed
2621 libtool_validate_options ()
2623 # save first non-option argument
2624 if test 0 -lt $#; then
2630 test : = "$debug_cmd" || func_append preserve_args " --debug"
2633 # Solaris2 added to fix http://debbugs.gnu.org/cgi/bugreport.cgi?bug=16452
2634 # see also: http://gcc.gnu.org/bugzilla/show_bug.cgi?id=59788
2635 *cygwin* | *mingw* | *pw32* | *cegcc* | *solaris2* | *os2*)
2636 # don't eliminate duplications in $postdeps and $predeps
2637 opt_duplicate_compiler_generated_deps=:
2640 opt_duplicate_compiler_generated_deps=$opt_preserve_dup_deps
2645 # Sanity checks first:
2646 func_check_version_match
2648 test yes != "$build_libtool_libs" \
2649 && test yes != "$build_old_libs" \
2650 && func_fatal_configuration "not configured to build any kind of library"
2653 eval std_shrext=\"$shrext_cmds\"
2655 # Only execute mode is allowed to have -dlopen flags.
2656 if test -n "$opt_dlopen" && test execute != "$opt_mode"; then
2657 func_error "unrecognized option '-dlopen'"
2662 # Change the help message to a mode-specific one.
2664 help="Try '$progname --help --mode=$opt_mode' for more information."
2667 # Pass back the unparsed argument list
2668 func_quote eval ${1+"$@"}
2669 libtool_validate_options_result=$func_quote_result
2671 func_add_hook func_validate_options libtool_validate_options
2674 # Process options as early as possible so that --help and --version
2675 # can return quickly.
2676 func_options ${1+"$@"}
2677 eval set dummy "$func_options_result"; shift
2685 magic='%%%MAGIC variable%%%'
2686 magic_exe='%%%MAGIC EXE variable%%%'
2692 # If this variable is set in any of the actions, the command in it
2693 # will be execed at the end. This prevents here-documents from being
2694 # left over by shells.
2698 # A function that is used when there is no print builtin or printf.
2699 func_fallback_echo ()
2701 eval 'cat <<_LTECHO_EOF
2706 # func_generated_by_libtool
2707 # True iff stdin has been generated by Libtool. This function is only
2708 # a basic sanity check; it will hardly flush out determined imposters.
2709 func_generated_by_libtool_p ()
2711 $GREP "^# Generated by .*$PACKAGE" > /dev/null 2>&1
2715 # True iff FILE is a libtool '.la' library or '.lo' object file.
2716 # This function is only a basic sanity check; it will hardly flush out
2717 # determined imposters.
2721 $SED -e 4q "$1" 2>/dev/null | func_generated_by_libtool_p
2724 # func_lalib_unsafe_p file
2725 # True iff FILE is a libtool '.la' library or '.lo' object file.
2726 # This function implements the same check as func_lalib_p without
2727 # resorting to external programs. To this end, it redirects stdin and
2728 # closes it afterwards, without saving the original file descriptor.
2729 # As a safety measure, use it only where a negative result would be
2730 # fatal anyway. Works if 'file' does not exist.
2731 func_lalib_unsafe_p ()
2734 if test -f "$1" && test -r "$1" && exec 5<&0 <"$1"; then
2735 for lalib_p_l in 1 2 3 4
2738 case $lalib_p_line in
2739 \#\ Generated\ by\ *$PACKAGE* ) lalib_p=yes; break;;
2744 test yes = "$lalib_p"
2747 # func_ltwrapper_script_p file
2748 # True iff FILE is a libtool wrapper script
2749 # This function is only a basic sanity check; it will hardly flush out
2750 # determined imposters.
2751 func_ltwrapper_script_p ()
2754 $lt_truncate_bin < "$1" 2>/dev/null | func_generated_by_libtool_p
2757 # func_ltwrapper_executable_p file
2758 # True iff FILE is a libtool wrapper executable
2759 # This function is only a basic sanity check; it will hardly flush out
2760 # determined imposters.
2761 func_ltwrapper_executable_p ()
2763 func_ltwrapper_exec_suffix=
2766 *) func_ltwrapper_exec_suffix=.exe ;;
2768 $GREP "$magic_exe" "$1$func_ltwrapper_exec_suffix" >/dev/null 2>&1
2771 # func_ltwrapper_scriptname file
2772 # Assumes file is an ltwrapper_executable
2773 # uses $file to determine the appropriate filename for a
2774 # temporary ltwrapper_script.
2775 func_ltwrapper_scriptname ()
2777 func_dirname_and_basename "$1" "" "."
2778 func_stripname '' '.exe' "$func_basename_result"
2779 func_ltwrapper_scriptname_result=$func_dirname_result/$objdir/${func_stripname_result}_ltshwrapper
2782 # func_ltwrapper_p file
2783 # True iff FILE is a libtool wrapper script or wrapper executable
2784 # This function is only a basic sanity check; it will hardly flush out
2785 # determined imposters.
2788 func_ltwrapper_script_p "$1" || func_ltwrapper_executable_p "$1"
2792 # func_execute_cmds commands fail_cmd
2793 # Execute tilde-delimited COMMANDS.
2794 # If FAIL_CMD is given, eval that upon failure.
2795 # FAIL_CMD may read-access the current command in variable CMD!
2796 func_execute_cmds ()
2800 save_ifs=$IFS; IFS='~'
2805 func_show_eval "$cmd" "${2-:}"
2812 # Source FILE, adding directory component if necessary.
2813 # Note that it is not necessary on cygwin/mingw to append a dot to
2814 # FILE even if both FILE and FILE.exe exist: automatic-append-.exe
2815 # behavior happens only for exec(3), not for open(2)! Also, sourcing
2816 # 'FILE.' does not work on cygwin managed mounts.
2822 */* | *\\*) . "$1" ;;
2828 # func_resolve_sysroot PATH
2829 # Replace a leading = in PATH with a sysroot. Store the result into
2830 # func_resolve_sysroot_result
2831 func_resolve_sysroot ()
2833 func_resolve_sysroot_result=$1
2834 case $func_resolve_sysroot_result in
2836 func_stripname '=' '' "$func_resolve_sysroot_result"
2837 func_resolve_sysroot_result=$lt_sysroot$func_stripname_result
2842 # func_replace_sysroot PATH
2843 # If PATH begins with the sysroot, replace it with = and
2844 # store the result into func_replace_sysroot_result.
2845 func_replace_sysroot ()
2847 case $lt_sysroot:$1 in
2849 func_stripname "$lt_sysroot" '' "$1"
2850 func_replace_sysroot_result='='$func_stripname_result
2853 # Including no sysroot.
2854 func_replace_sysroot_result=$1
2859 # func_infer_tag arg
2860 # Infer tagged configuration to use if any are available and
2861 # if one wasn't chosen via the "--tag" command line option.
2862 # Only attempt this if the compiler in the base compile
2863 # command doesn't match the default compiler.
2864 # arg is usually of the form 'gcc ...'
2869 if test -n "$available_tags" && test -z "$tagname"; then
2872 func_append_quoted CC_quoted "$arg"
2874 CC_expanded=`func_echo_all $CC`
2875 CC_quoted_expanded=`func_echo_all $CC_quoted`
2877 # Blanks in the command may have been stripped by the calling shell,
2878 # but not from the CC environment variable when configure was run.
2879 " $CC "* | "$CC "* | " $CC_expanded "* | "$CC_expanded "* | \
2880 " $CC_quoted"* | "$CC_quoted "* | " $CC_quoted_expanded "* | "$CC_quoted_expanded "*) ;;
2881 # Blanks at the start of $base_compile will cause this to fail
2882 # if we don't check for them as well.
2884 for z in $available_tags; do
2885 if $GREP "^# ### BEGIN LIBTOOL TAG CONFIG: $z$" < "$progpath" > /dev/null; then
2886 # Evaluate the configuration.
2887 eval "`$SED -n -e '/^# ### BEGIN LIBTOOL TAG CONFIG: '$z'$/,/^# ### END LIBTOOL TAG CONFIG: '$z'$/p' < $progpath`"
2890 # Double-quote args containing other shell metacharacters.
2891 func_append_quoted CC_quoted "$arg"
2893 CC_expanded=`func_echo_all $CC`
2894 CC_quoted_expanded=`func_echo_all $CC_quoted`
2896 " $CC "* | "$CC "* | " $CC_expanded "* | "$CC_expanded "* | \
2897 " $CC_quoted"* | "$CC_quoted "* | " $CC_quoted_expanded "* | "$CC_quoted_expanded "*)
2898 # The compiler in the base compile command matches
2899 # the one in the tagged configuration.
2900 # Assume this is the tagged configuration we want.
2907 # If $tagname still isn't set, then no tagged configuration
2908 # was found and let the user know that the "--tag" command
2909 # line option must be used.
2910 if test -z "$tagname"; then
2911 func_echo "unable to infer tagged configuration"
2912 func_fatal_error "specify a tag with '--tag'"
2914 # func_verbose "using $tagname tagged configuration"
2923 # func_write_libtool_object output_name pic_name nonpic_name
2924 # Create a libtool object file (analogous to a ".la" file),
2925 # but don't create it if we're doing a dry run.
2926 func_write_libtool_object ()
2929 if test yes = "$build_libtool_libs"; then
2935 if test yes = "$build_old_libs"; then
2942 cat >${write_libobj}T <<EOF
2943 # $write_libobj - a libtool object file
2944 # Generated by $PROGRAM (GNU $PACKAGE) $VERSION
2946 # Please DO NOT delete this file!
2947 # It is necessary for linking the library.
2949 # Name of the PIC object.
2950 pic_object=$write_lobj
2952 # Name of the non-PIC object
2953 non_pic_object=$write_oldobj
2956 $MV "${write_libobj}T" "$write_libobj"
2961 ##################################################
2962 # FILE NAME AND PATH CONVERSION HELPER FUNCTIONS #
2963 ##################################################
2965 # func_convert_core_file_wine_to_w32 ARG
2966 # Helper function used by file name conversion functions when $build is *nix,
2967 # and $host is mingw, cygwin, or some other w32 environment. Relies on a
2968 # correctly configured wine environment available, with the winepath program
2969 # in $build's $PATH.
2971 # ARG is the $build file name to be converted to w32 format.
2972 # Result is available in $func_convert_core_file_wine_to_w32_result, and will
2973 # be empty on error (or when ARG is empty)
2974 func_convert_core_file_wine_to_w32 ()
2978 func_convert_core_file_wine_to_w32_result=$1
2979 if test -n "$1"; then
2980 # Unfortunately, winepath does not exit with a non-zero error code, so we
2981 # are forced to check the contents of stdout. On the other hand, if the
2982 # command is not found, the shell will set an exit code of 127 and print
2983 # *an error message* to stdout. So we must check for both error code of
2984 # zero AND non-empty stdout, which explains the odd construction:
2985 func_convert_core_file_wine_to_w32_tmp=`winepath -w "$1" 2>/dev/null`
2986 if test "$?" -eq 0 && test -n "$func_convert_core_file_wine_to_w32_tmp"; then
2987 func_convert_core_file_wine_to_w32_result=`$ECHO "$func_convert_core_file_wine_to_w32_tmp" |
2988 $SED -e "$sed_naive_backslashify"`
2990 func_convert_core_file_wine_to_w32_result=
2994 # end: func_convert_core_file_wine_to_w32
2997 # func_convert_core_path_wine_to_w32 ARG
2998 # Helper function used by path conversion functions when $build is *nix, and
2999 # $host is mingw, cygwin, or some other w32 environment. Relies on a correctly
3000 # configured wine environment available, with the winepath program in $build's
3001 # $PATH. Assumes ARG has no leading or trailing path separator characters.
3003 # ARG is path to be converted from $build format to win32.
3004 # Result is available in $func_convert_core_path_wine_to_w32_result.
3005 # Unconvertible file (directory) names in ARG are skipped; if no directory names
3006 # are convertible, then the result may be empty.
3007 func_convert_core_path_wine_to_w32 ()
3011 # unfortunately, winepath doesn't convert paths, only file names
3012 func_convert_core_path_wine_to_w32_result=
3013 if test -n "$1"; then
3016 for func_convert_core_path_wine_to_w32_f in $1; do
3018 func_convert_core_file_wine_to_w32 "$func_convert_core_path_wine_to_w32_f"
3019 if test -n "$func_convert_core_file_wine_to_w32_result"; then
3020 if test -z "$func_convert_core_path_wine_to_w32_result"; then
3021 func_convert_core_path_wine_to_w32_result=$func_convert_core_file_wine_to_w32_result
3023 func_append func_convert_core_path_wine_to_w32_result ";$func_convert_core_file_wine_to_w32_result"
3030 # end: func_convert_core_path_wine_to_w32
3033 # func_cygpath ARGS...
3034 # Wrapper around calling the cygpath program via LT_CYGPATH. This is used when
3035 # when (1) $build is *nix and Cygwin is hosted via a wine environment; or (2)
3036 # $build is MSYS and $host is Cygwin, or (3) $build is Cygwin. In case (1) or
3037 # (2), returns the Cygwin file name or path in func_cygpath_result (input
3038 # file name or path is assumed to be in w32 format, as previously converted
3039 # from $build's *nix or MSYS format). In case (3), returns the w32 file name
3040 # or path in func_cygpath_result (input file name or path is assumed to be in
3041 # Cygwin format). Returns an empty string on error.
3043 # ARGS are passed to cygpath, with the last one being the file name or path to
3046 # Specify the absolute *nix (or w32) name to cygpath in the LT_CYGPATH
3047 # environment variable; do not put it in $PATH.
3052 if test -n "$LT_CYGPATH" && test -f "$LT_CYGPATH"; then
3053 func_cygpath_result=`$LT_CYGPATH "$@" 2>/dev/null`
3054 if test "$?" -ne 0; then
3055 # on failure, ensure result is empty
3056 func_cygpath_result=
3059 func_cygpath_result=
3060 func_error "LT_CYGPATH is empty or specifies non-existent file: '$LT_CYGPATH'"
3066 # func_convert_core_msys_to_w32 ARG
3067 # Convert file name or path ARG from MSYS format to w32 format. Return
3068 # result in func_convert_core_msys_to_w32_result.
3069 func_convert_core_msys_to_w32 ()
3073 # awkward: cmd appends spaces to result
3074 func_convert_core_msys_to_w32_result=`( cmd //c echo "$1" ) 2>/dev/null |
3075 $SED -e 's/[ ]*$//' -e "$sed_naive_backslashify"`
3077 #end: func_convert_core_msys_to_w32
3080 # func_convert_file_check ARG1 ARG2
3081 # Verify that ARG1 (a file name in $build format) was converted to $host
3082 # format in ARG2. Otherwise, emit an error message, but continue (resetting
3083 # func_to_host_file_result to ARG1).
3084 func_convert_file_check ()
3088 if test -z "$2" && test -n "$1"; then
3089 func_error "Could not determine host file name corresponding to"
3091 func_error "Continuing, but uninstalled executables may not work."
3093 func_to_host_file_result=$1
3096 # end func_convert_file_check
3099 # func_convert_path_check FROM_PATHSEP TO_PATHSEP FROM_PATH TO_PATH
3100 # Verify that FROM_PATH (a path in $build format) was converted to $host
3101 # format in TO_PATH. Otherwise, emit an error message, but continue, resetting
3102 # func_to_host_file_result to a simplistic fallback value (see below).
3103 func_convert_path_check ()
3107 if test -z "$4" && test -n "$3"; then
3108 func_error "Could not determine the host path corresponding to"
3110 func_error "Continuing, but uninstalled executables may not work."
3111 # Fallback. This is a deliberately simplistic "conversion" and
3112 # should not be "improved". See libtool.info.
3113 if test "x$1" != "x$2"; then
3114 lt_replace_pathsep_chars="s|$1|$2|g"
3115 func_to_host_path_result=`echo "$3" |
3116 $SED -e "$lt_replace_pathsep_chars"`
3118 func_to_host_path_result=$3
3122 # end func_convert_path_check
3125 # func_convert_path_front_back_pathsep FRONTPAT BACKPAT REPL ORIG
3126 # Modifies func_to_host_path_result by prepending REPL if ORIG matches FRONTPAT
3127 # and appending REPL if ORIG matches BACKPAT.
3128 func_convert_path_front_back_pathsep ()
3133 $1 ) func_to_host_path_result=$3$func_to_host_path_result
3137 $2 ) func_append func_to_host_path_result "$3"
3141 # end func_convert_path_front_back_pathsep
3144 ##################################################
3145 # $build to $host FILE NAME CONVERSION FUNCTIONS #
3146 ##################################################
3147 # invoked via '$to_host_file_cmd ARG'
3149 # In each case, ARG is the path to be converted from $build to $host format.
3150 # Result will be available in $func_to_host_file_result.
3153 # func_to_host_file ARG
3154 # Converts the file name ARG from $build format to $host format. Return result
3155 # in func_to_host_file_result.
3156 func_to_host_file ()
3160 $to_host_file_cmd "$1"
3162 # end func_to_host_file
3165 # func_to_tool_file ARG LAZY
3166 # converts the file name ARG from $build format to toolchain format. Return
3167 # result in func_to_tool_file_result. If the conversion in use is listed
3168 # in (the comma separated) LAZY, no conversion takes place.
3169 func_to_tool_file ()
3174 *,"$to_tool_file_cmd",*)
3175 func_to_tool_file_result=$1
3178 $to_tool_file_cmd "$1"
3179 func_to_tool_file_result=$func_to_host_file_result
3183 # end func_to_tool_file
3186 # func_convert_file_noop ARG
3187 # Copy ARG to func_to_host_file_result.
3188 func_convert_file_noop ()
3190 func_to_host_file_result=$1
3192 # end func_convert_file_noop
3195 # func_convert_file_msys_to_w32 ARG
3196 # Convert file name ARG from (mingw) MSYS to (mingw) w32 format; automatic
3197 # conversion to w32 is not available inside the cwrapper. Returns result in
3198 # func_to_host_file_result.
3199 func_convert_file_msys_to_w32 ()
3203 func_to_host_file_result=$1
3204 if test -n "$1"; then
3205 func_convert_core_msys_to_w32 "$1"
3206 func_to_host_file_result=$func_convert_core_msys_to_w32_result
3208 func_convert_file_check "$1" "$func_to_host_file_result"
3210 # end func_convert_file_msys_to_w32
3213 # func_convert_file_cygwin_to_w32 ARG
3214 # Convert file name ARG from Cygwin to w32 format. Returns result in
3215 # func_to_host_file_result.
3216 func_convert_file_cygwin_to_w32 ()
3220 func_to_host_file_result=$1
3221 if test -n "$1"; then
3222 # because $build is cygwin, we call "the" cygpath in $PATH; no need to use
3223 # LT_CYGPATH in this case.
3224 func_to_host_file_result=`cygpath -m "$1"`
3226 func_convert_file_check "$1" "$func_to_host_file_result"
3228 # end func_convert_file_cygwin_to_w32
3231 # func_convert_file_nix_to_w32 ARG
3232 # Convert file name ARG from *nix to w32 format. Requires a wine environment
3233 # and a working winepath. Returns result in func_to_host_file_result.
3234 func_convert_file_nix_to_w32 ()
3238 func_to_host_file_result=$1
3239 if test -n "$1"; then
3240 func_convert_core_file_wine_to_w32 "$1"
3241 func_to_host_file_result=$func_convert_core_file_wine_to_w32_result
3243 func_convert_file_check "$1" "$func_to_host_file_result"
3245 # end func_convert_file_nix_to_w32
3248 # func_convert_file_msys_to_cygwin ARG
3249 # Convert file name ARG from MSYS to Cygwin format. Requires LT_CYGPATH set.
3250 # Returns result in func_to_host_file_result.
3251 func_convert_file_msys_to_cygwin ()
3255 func_to_host_file_result=$1
3256 if test -n "$1"; then
3257 func_convert_core_msys_to_w32 "$1"
3258 func_cygpath -u "$func_convert_core_msys_to_w32_result"
3259 func_to_host_file_result=$func_cygpath_result
3261 func_convert_file_check "$1" "$func_to_host_file_result"
3263 # end func_convert_file_msys_to_cygwin
3266 # func_convert_file_nix_to_cygwin ARG
3267 # Convert file name ARG from *nix to Cygwin format. Requires Cygwin installed
3268 # in a wine environment, working winepath, and LT_CYGPATH set. Returns result
3269 # in func_to_host_file_result.
3270 func_convert_file_nix_to_cygwin ()
3274 func_to_host_file_result=$1
3275 if test -n "$1"; then
3276 # convert from *nix to w32, then use cygpath to convert from w32 to cygwin.
3277 func_convert_core_file_wine_to_w32 "$1"
3278 func_cygpath -u "$func_convert_core_file_wine_to_w32_result"
3279 func_to_host_file_result=$func_cygpath_result
3281 func_convert_file_check "$1" "$func_to_host_file_result"
3283 # end func_convert_file_nix_to_cygwin
3286 #############################################
3287 # $build to $host PATH CONVERSION FUNCTIONS #
3288 #############################################
3289 # invoked via '$to_host_path_cmd ARG'
3291 # In each case, ARG is the path to be converted from $build to $host format.
3292 # The result will be available in $func_to_host_path_result.
3294 # Path separators are also converted from $build format to $host format. If
3295 # ARG begins or ends with a path separator character, it is preserved (but
3296 # converted to $host format) on output.
3298 # All path conversion functions are named using the following convention:
3299 # file name conversion function : func_convert_file_X_to_Y ()
3300 # path conversion function : func_convert_path_X_to_Y ()
3301 # where, for any given $build/$host combination the 'X_to_Y' value is the
3302 # same. If conversion functions are added for new $build/$host combinations,
3303 # the two new functions must follow this pattern, or func_init_to_host_path_cmd
3307 # func_init_to_host_path_cmd
3308 # Ensures that function "pointer" variable $to_host_path_cmd is set to the
3309 # appropriate value, based on the value of $to_host_file_cmd.
3311 func_init_to_host_path_cmd ()
3315 if test -z "$to_host_path_cmd"; then
3316 func_stripname 'func_convert_file_' '' "$to_host_file_cmd"
3317 to_host_path_cmd=func_convert_path_$func_stripname_result
3322 # func_to_host_path ARG
3323 # Converts the path ARG from $build format to $host format. Return result
3324 # in func_to_host_path_result.
3325 func_to_host_path ()
3329 func_init_to_host_path_cmd
3330 $to_host_path_cmd "$1"
3332 # end func_to_host_path
3335 # func_convert_path_noop ARG
3336 # Copy ARG to func_to_host_path_result.
3337 func_convert_path_noop ()
3339 func_to_host_path_result=$1
3341 # end func_convert_path_noop
3344 # func_convert_path_msys_to_w32 ARG
3345 # Convert path ARG from (mingw) MSYS to (mingw) w32 format; automatic
3346 # conversion to w32 is not available inside the cwrapper. Returns result in
3347 # func_to_host_path_result.
3348 func_convert_path_msys_to_w32 ()
3352 func_to_host_path_result=$1
3353 if test -n "$1"; then
3354 # Remove leading and trailing path separator characters from ARG. MSYS
3355 # behavior is inconsistent here; cygpath turns them into '.;' and ';.';
3356 # and winepath ignores them completely.
3357 func_stripname : : "$1"
3358 func_to_host_path_tmp1=$func_stripname_result
3359 func_convert_core_msys_to_w32 "$func_to_host_path_tmp1"
3360 func_to_host_path_result=$func_convert_core_msys_to_w32_result
3361 func_convert_path_check : ";" \
3362 "$func_to_host_path_tmp1" "$func_to_host_path_result"
3363 func_convert_path_front_back_pathsep ":*" "*:" ";" "$1"
3366 # end func_convert_path_msys_to_w32
3369 # func_convert_path_cygwin_to_w32 ARG
3370 # Convert path ARG from Cygwin to w32 format. Returns result in
3371 # func_to_host_file_result.
3372 func_convert_path_cygwin_to_w32 ()
3376 func_to_host_path_result=$1
3377 if test -n "$1"; then
3378 # See func_convert_path_msys_to_w32:
3379 func_stripname : : "$1"
3380 func_to_host_path_tmp1=$func_stripname_result
3381 func_to_host_path_result=`cygpath -m -p "$func_to_host_path_tmp1"`
3382 func_convert_path_check : ";" \
3383 "$func_to_host_path_tmp1" "$func_to_host_path_result"
3384 func_convert_path_front_back_pathsep ":*" "*:" ";" "$1"
3387 # end func_convert_path_cygwin_to_w32
3390 # func_convert_path_nix_to_w32 ARG
3391 # Convert path ARG from *nix to w32 format. Requires a wine environment and
3392 # a working winepath. Returns result in func_to_host_file_result.
3393 func_convert_path_nix_to_w32 ()
3397 func_to_host_path_result=$1
3398 if test -n "$1"; then
3399 # See func_convert_path_msys_to_w32:
3400 func_stripname : : "$1"
3401 func_to_host_path_tmp1=$func_stripname_result
3402 func_convert_core_path_wine_to_w32 "$func_to_host_path_tmp1"
3403 func_to_host_path_result=$func_convert_core_path_wine_to_w32_result
3404 func_convert_path_check : ";" \
3405 "$func_to_host_path_tmp1" "$func_to_host_path_result"
3406 func_convert_path_front_back_pathsep ":*" "*:" ";" "$1"
3409 # end func_convert_path_nix_to_w32
3412 # func_convert_path_msys_to_cygwin ARG
3413 # Convert path ARG from MSYS to Cygwin format. Requires LT_CYGPATH set.
3414 # Returns result in func_to_host_file_result.
3415 func_convert_path_msys_to_cygwin ()
3419 func_to_host_path_result=$1
3420 if test -n "$1"; then
3421 # See func_convert_path_msys_to_w32:
3422 func_stripname : : "$1"
3423 func_to_host_path_tmp1=$func_stripname_result
3424 func_convert_core_msys_to_w32 "$func_to_host_path_tmp1"
3425 func_cygpath -u -p "$func_convert_core_msys_to_w32_result"
3426 func_to_host_path_result=$func_cygpath_result
3427 func_convert_path_check : : \
3428 "$func_to_host_path_tmp1" "$func_to_host_path_result"
3429 func_convert_path_front_back_pathsep ":*" "*:" : "$1"
3432 # end func_convert_path_msys_to_cygwin
3435 # func_convert_path_nix_to_cygwin ARG
3436 # Convert path ARG from *nix to Cygwin format. Requires Cygwin installed in a
3437 # a wine environment, working winepath, and LT_CYGPATH set. Returns result in
3438 # func_to_host_file_result.
3439 func_convert_path_nix_to_cygwin ()
3443 func_to_host_path_result=$1
3444 if test -n "$1"; then
3445 # Remove leading and trailing path separator characters from
3446 # ARG. msys behavior is inconsistent here, cygpath turns them
3447 # into '.;' and ';.', and winepath ignores them completely.
3448 func_stripname : : "$1"
3449 func_to_host_path_tmp1=$func_stripname_result
3450 func_convert_core_path_wine_to_w32 "$func_to_host_path_tmp1"
3451 func_cygpath -u -p "$func_convert_core_path_wine_to_w32_result"
3452 func_to_host_path_result=$func_cygpath_result
3453 func_convert_path_check : : \
3454 "$func_to_host_path_tmp1" "$func_to_host_path_result"
3455 func_convert_path_front_back_pathsep ":*" "*:" : "$1"
3458 # end func_convert_path_nix_to_cygwin
3461 # func_dll_def_p FILE
3462 # True iff FILE is a Windows DLL '.def' file.
3463 # Keep in sync with _LT_DLL_DEF_P in libtool.m4
3468 func_dll_def_p_tmp=`$SED -n \
3470 -e '/^\(;.*\)*$/d' \
3471 -e 's/^\(EXPORTS\|LIBRARY\)\([ ].*\)*$/DEF/p' \
3474 test DEF = "$func_dll_def_p_tmp"
3478 # func_mode_compile arg...
3479 func_mode_compile ()
3483 # Get the compilation command and the source file.
3485 srcfile=$nonopt # always keep a non-empty value in "srcfile"
3497 # do not "continue". Instead, add this to base_compile
3509 # Accept any command-line options.
3512 test -n "$libobj" && \
3513 func_fatal_error "you cannot specify '-o' more than once"
3518 -pie | -fpie | -fPIE)
3519 func_append pie_flag " $arg"
3523 -shared | -static | -prefer-pic | -prefer-non-pic)
3524 func_append later " $arg"
3534 arg_mode=arg # the next one goes into the "base_compile" arg list
3535 continue # The current "srcfile" will either be retained or
3536 ;; # replaced later. I would guess that would be a bug.
3539 func_stripname '-Wc,' '' "$arg"
3540 args=$func_stripname_result
3542 save_ifs=$IFS; IFS=,
3543 for arg in $args; do
3545 func_append_quoted lastarg "$arg"
3548 func_stripname ' ' '' "$lastarg"
3549 lastarg=$func_stripname_result
3551 # Add the arguments to base_compile.
3552 func_append base_compile " $lastarg"
3557 # Accept the current argument as the source file.
3558 # The previous "srcfile" becomes the current argument.
3565 esac # case $arg_mode
3567 # Aesthetically quote the previous argument.
3568 func_append_quoted base_compile "$lastarg"
3573 func_fatal_error "you must specify an argument for -Xcompile"
3576 func_fatal_error "you must specify a target with '-o'"
3579 # Get the name of the library object.
3580 test -z "$libobj" && {
3581 func_basename "$srcfile"
3582 libobj=$func_basename_result
3587 # Recognize several different file suffixes.
3588 # If the user specifies -o file.o, it is replaced with file.lo
3591 *.ada | *.adb | *.ads | *.asm | \
3592 *.c++ | *.cc | *.ii | *.class | *.cpp | *.cxx | \
3593 *.[fF][09]? | *.for | *.java | *.go | *.obj | *.sx | *.cu | *.cup)
3594 func_xform "$libobj"
3595 libobj=$func_xform_result
3600 *.lo) func_lo2o "$libobj"; obj=$func_lo2o_result ;;
3602 func_fatal_error "cannot determine name of library object from '$libobj'"
3606 func_infer_tag $base_compile
3608 for arg in $later; do
3611 test yes = "$build_libtool_libs" \
3612 || func_fatal_configuration "cannot build a shared library"
3618 build_libtool_libs=no
3635 func_quote_arg pretty "$libobj"
3636 test "X$libobj" != "X$func_quote_arg_result" \
3637 && $ECHO "X$libobj" | $GREP '[]~#^*{};<>?"'"'"' &()|`$[]' \
3638 && func_warning "libobj name '$libobj' may not contain shell special characters."
3639 func_dirname_and_basename "$obj" "/" ""
3640 objname=$func_basename_result
3641 xdir=$func_dirname_result
3642 lobj=$xdir$objdir/$objname
3644 test -z "$base_compile" && \
3645 func_fatal_help "you must specify a compilation command"
3647 # Delete any leftover library objects.
3648 if test yes = "$build_old_libs"; then
3649 removelist="$obj $lobj $libobj ${libobj}T"
3651 removelist="$lobj $libobj ${libobj}T"
3654 # On Cygwin there's no "real" PIC flag so we must build both object types
3656 cygwin* | mingw* | pw32* | os2* | cegcc*)
3660 if test no = "$pic_mode" && test pass_all != "$deplibs_check_method"; then
3661 # non-PIC code in shared libraries is not supported
3665 # Calculate the filename of the output object if compiler does
3666 # not support -o with -c
3667 if test no = "$compiler_c_o"; then
3668 output_obj=`$ECHO "$srcfile" | $SED 's%^.*/%%; s%\.[^.]*$%%'`.$objext
3669 lockfile=$output_obj.lock
3676 # Lock this critical section if it is needed
3677 # We use this script file to make the link, it avoids creating a new file
3678 if test yes = "$need_locks"; then
3679 until $opt_dry_run || ln "$progpath" "$lockfile" 2>/dev/null; do
3680 func_echo "Waiting for $lockfile to be removed"
3683 elif test warn = "$need_locks"; then
3684 if test -f "$lockfile"; then
3686 *** ERROR, $lockfile exists and contains:
3687 `cat $lockfile 2>/dev/null`
3689 This indicates that another process is trying to use the same
3690 temporary object file, and libtool could not work around it because
3691 your compiler does not support '-c' and '-o' together. If you
3692 repeat this compilation, it may succeed, by chance, but you had better
3693 avoid parallel builds (make -j) in this platform, or get a better
3696 $opt_dry_run || $RM $removelist
3699 func_append removelist " $output_obj"
3700 $ECHO "$srcfile" > "$lockfile"
3703 $opt_dry_run || $RM $removelist
3704 func_append removelist " $lockfile"
3705 trap '$opt_dry_run || $RM $removelist; exit $EXIT_FAILURE' 1 2 15
3707 func_to_tool_file "$srcfile" func_convert_file_msys_to_w32
3708 srcfile=$func_to_tool_file_result
3709 func_quote_arg pretty "$srcfile"
3710 qsrcfile=$func_quote_arg_result
3712 # Only build a PIC object if we are building libtool libraries.
3713 if test yes = "$build_libtool_libs"; then
3714 # Without this assignment, base_compile gets emptied.
3715 fbsd_hideous_sh_bug=$base_compile
3717 if test no != "$pic_mode"; then
3718 command="$base_compile $qsrcfile $pic_flag"
3720 # Don't build PIC code
3721 command="$base_compile $qsrcfile"
3724 func_mkdir_p "$xdir$objdir"
3726 if test -z "$output_obj"; then
3727 # Place PIC objects in $objdir
3728 func_append command " -o $lobj"
3731 func_show_eval_locale "$command" \
3732 'test -n "$output_obj" && $RM $removelist; exit $EXIT_FAILURE'
3734 if test warn = "$need_locks" &&
3735 test "X`cat $lockfile 2>/dev/null`" != "X$srcfile"; then
3737 *** ERROR, $lockfile contains:
3738 `cat $lockfile 2>/dev/null`
3740 but it should contain:
3743 This indicates that another process is trying to use the same
3744 temporary object file, and libtool could not work around it because
3745 your compiler does not support '-c' and '-o' together. If you
3746 repeat this compilation, it may succeed, by chance, but you had better
3747 avoid parallel builds (make -j) in this platform, or get a better
3750 $opt_dry_run || $RM $removelist
3754 # Just move the object if needed, then go on to compile the next one
3755 if test -n "$output_obj" && test "X$output_obj" != "X$lobj"; then
3756 func_show_eval '$MV "$output_obj" "$lobj"' \
3757 'error=$?; $opt_dry_run || $RM $removelist; exit $error'
3760 # Allow error messages only from the first compilation.
3761 if test yes = "$suppress_opt"; then
3762 suppress_output=' >/dev/null 2>&1'
3766 # Only build a position-dependent object if we build old libraries.
3767 if test yes = "$build_old_libs"; then
3768 if test yes != "$pic_mode"; then
3769 # Don't build PIC code
3770 command="$base_compile $qsrcfile$pie_flag"
3772 command="$base_compile $qsrcfile $pic_flag"
3774 if test yes = "$compiler_c_o"; then
3775 func_append command " -o $obj"
3778 # Suppress compiler output if we already did a PIC compilation.
3779 func_append command "$suppress_output"
3780 func_show_eval_locale "$command" \
3781 '$opt_dry_run || $RM $removelist; exit $EXIT_FAILURE'
3783 if test warn = "$need_locks" &&
3784 test "X`cat $lockfile 2>/dev/null`" != "X$srcfile"; then
3786 *** ERROR, $lockfile contains:
3787 `cat $lockfile 2>/dev/null`
3789 but it should contain:
3792 This indicates that another process is trying to use the same
3793 temporary object file, and libtool could not work around it because
3794 your compiler does not support '-c' and '-o' together. If you
3795 repeat this compilation, it may succeed, by chance, but you had better
3796 avoid parallel builds (make -j) in this platform, or get a better
3799 $opt_dry_run || $RM $removelist
3803 # Just move the object if needed
3804 if test -n "$output_obj" && test "X$output_obj" != "X$obj"; then
3805 func_show_eval '$MV "$output_obj" "$obj"' \
3806 'error=$?; $opt_dry_run || $RM $removelist; exit $error'
3811 func_write_libtool_object "$libobj" "$objdir/$objname" "$objname"
3813 # Unlock the critical section if it was locked
3814 if test no != "$need_locks"; then
3815 removelist=$lockfile
3824 test compile = "$opt_mode" && func_mode_compile ${1+"$@"}
3829 # We need to display help for each of the modes.
3832 # Generic help is extracted from the usage comments
3833 # at the start of this file.
3839 "Usage: $progname [OPTION]... --mode=clean RM [RM-OPTION]... FILE...
3841 Remove files from the build directory.
3843 RM is the name of the program to use to delete files associated with each FILE
3844 (typically '/bin/rm'). RM-OPTIONS are options (such as '-f') to be passed
3847 If FILE is a libtool library, object or program, all the files associated
3848 with it are deleted. Otherwise, only FILE itself is deleted using RM."
3853 "Usage: $progname [OPTION]... --mode=compile COMPILE-COMMAND... SOURCEFILE
3855 Compile a source file into a libtool library object.
3857 This mode accepts the following additional options:
3859 -o OUTPUT-FILE set the output file name to OUTPUT-FILE
3860 -no-suppress do not suppress compiler output for multiple passes
3861 -prefer-pic try to build PIC objects only
3862 -prefer-non-pic try to build non-PIC objects only
3863 -shared do not build a '.o' file suitable for static linking
3864 -static only build a '.o' file suitable for static linking
3865 -Wc,FLAG pass FLAG directly to the compiler
3867 COMPILE-COMMAND is a command to be used in creating a 'standard' object file
3868 from the given SOURCEFILE.
3870 The output file name is determined by removing the directory component from
3871 SOURCEFILE, then substituting the C source code suffix '.c' with the
3872 library object suffix, '.lo'."
3877 "Usage: $progname [OPTION]... --mode=execute COMMAND [ARGS]...
3879 Automatically set library path, then run a program.
3881 This mode accepts the following additional options:
3883 -dlopen FILE add the directory containing FILE to the library path
3885 This mode sets the library path environment variable according to '-dlopen'
3888 If any of the ARGS are libtool executable wrappers, then they are translated
3889 into their corresponding uninstalled binary, and any of their required library
3890 directories are added to the library path.
3892 Then, COMMAND is executed, with ARGS as arguments."
3897 "Usage: $progname [OPTION]... --mode=finish [LIBDIR]...
3899 Complete the installation of libtool libraries.
3901 Each LIBDIR is a directory that contains libtool libraries.
3903 The commands that this mode executes may require superuser privileges. Use
3904 the '--dry-run' option if you just want to see what would be executed."
3909 "Usage: $progname [OPTION]... --mode=install INSTALL-COMMAND...
3911 Install executables or libraries.
3913 INSTALL-COMMAND is the installation command. The first component should be
3914 either the 'install' or 'cp' program.
3916 The following components of INSTALL-COMMAND are treated specially:
3918 -inst-prefix-dir PREFIX-DIR Use PREFIX-DIR as a staging area for installation
3920 The rest of the components are interpreted as arguments to that command (only
3921 BSD-compatible install options are recognized)."
3926 "Usage: $progname [OPTION]... --mode=link LINK-COMMAND...
3928 Link object files or libraries together to form another library, or to
3929 create an executable program.
3931 LINK-COMMAND is a command using the C compiler that you would use to create
3932 a program from several object files.
3934 The following components of LINK-COMMAND are treated specially:
3936 -all-static do not do any dynamic linking at all
3937 -avoid-version do not add a version suffix if possible
3938 -bindir BINDIR specify path to binaries directory (for systems where
3939 libraries must be found in the PATH setting at runtime)
3940 -dlopen FILE '-dlpreopen' FILE if it cannot be dlopened at runtime
3941 -dlpreopen FILE link in FILE and add its symbols to lt_preloaded_symbols
3942 -export-dynamic allow symbols from OUTPUT-FILE to be resolved with dlsym(3)
3943 -export-symbols SYMFILE
3944 try to export only the symbols listed in SYMFILE
3945 -export-symbols-regex REGEX
3946 try to export only the symbols matching REGEX
3947 -LLIBDIR search LIBDIR for required installed libraries
3948 -lNAME OUTPUT-FILE requires the installed library libNAME
3949 -module build a library that can dlopened
3950 -no-fast-install disable the fast-install mode
3951 -no-install link a not-installable executable
3952 -no-undefined declare that a library does not refer to external symbols
3953 -o OUTPUT-FILE create OUTPUT-FILE from the specified objects
3954 -objectlist FILE use a list of object files found in FILE to specify objects
3955 -os2dllname NAME force a short DLL name on OS/2 (no effect on other OSes)
3956 -precious-files-regex REGEX
3957 don't remove output files matching REGEX
3958 -release RELEASE specify package release information
3959 -rpath LIBDIR the created library will eventually be installed in LIBDIR
3960 -R[ ]LIBDIR add LIBDIR to the runtime path of programs and libraries
3961 -shared only do dynamic linking of libtool libraries
3962 -shrext SUFFIX override the standard shared library file extension
3963 -static do not do any dynamic linking of uninstalled libtool libraries
3964 -static-libtool-libs
3965 do not do any dynamic linking of libtool libraries
3966 -version-info CURRENT[:REVISION[:AGE]]
3967 specify library version info [each variable defaults to 0]
3968 -weak LIBNAME declare that the target provides the LIBNAME interface
3970 -Xcompiler FLAG pass linker-specific FLAG directly to the compiler
3972 -Xlinker FLAG pass linker-specific FLAG directly to the linker
3973 -XCClinker FLAG pass link-specific FLAG to the compiler driver (CC)
3975 All other options (arguments beginning with '-') are ignored.
3977 Every other argument is treated as a filename. Files ending in '.la' are
3978 treated as uninstalled libtool libraries, other files are standard or library
3981 If the OUTPUT-FILE ends in '.la', then a libtool library is created,
3982 only library objects ('.lo' files) may be specified, and '-rpath' is
3983 required, except when creating a convenience library.
3985 If OUTPUT-FILE ends in '.a' or '.lib', then a standard library is created
3986 using 'ar' and 'ranlib', or on Windows using 'lib'.
3988 If OUTPUT-FILE ends in '.lo' or '.$objext', then a reloadable object file
3989 is created, otherwise an executable program is created."
3994 "Usage: $progname [OPTION]... --mode=uninstall RM [RM-OPTION]... FILE...
3996 Remove libraries from an installation directory.
3998 RM is the name of the program to use to delete files associated with each FILE
3999 (typically '/bin/rm'). RM-OPTIONS are options (such as '-f') to be passed
4002 If FILE is a libtool library, all the files associated with it are deleted.
4003 Otherwise, only FILE itself is deleted using RM."
4007 func_fatal_help "invalid operation mode '$opt_mode'"
4012 $ECHO "Try '$progname --help' for more information about other modes."
4015 # Now that we've collected a possible --mode arg, show help if necessary
4017 if test : = "$opt_help"; then
4022 for opt_mode in compile link execute install finish uninstall clean; do
4025 } | $SED -n '1p; 2,$s/^Usage:/ or: /p'
4028 for opt_mode in compile link execute install finish uninstall clean; do
4034 /^When reporting/,/^Report/{
4039 /information about other modes/d
4040 /more detailed .*MODE/d
4041 s/^Usage:.*--mode=\([^ ]*\) .*/Description of \1 mode:/'
4047 # func_mode_execute arg...
4048 func_mode_execute ()
4052 # The first argument is the command name.
4055 func_fatal_help "you must specify a COMMAND"
4057 # Handle -dlopen flags immediately.
4058 for file in $opt_dlopen; do
4060 || func_fatal_help "'$file' is not a file"
4065 func_resolve_sysroot "$file"
4066 file=$func_resolve_sysroot_result
4068 # Check to see that this really is a libtool archive.
4069 func_lalib_unsafe_p "$file" \
4070 || func_fatal_help "'$lib' is not a valid libtool archive"
4072 # Read the libtool library.
4077 # Skip this library if it cannot be dlopened.
4078 if test -z "$dlname"; then
4079 # Warn if it was a shared library.
4080 test -n "$library_names" && \
4081 func_warning "'$file' was not linked with '-export-dynamic'"
4085 func_dirname "$file" "" "."
4086 dir=$func_dirname_result
4088 if test -f "$dir/$objdir/$dlname"; then
4089 func_append dir "/$objdir"
4091 if test ! -f "$dir/$dlname"; then
4092 func_fatal_error "cannot find '$dlname' in '$dir' or '$dir/$objdir'"
4098 # Just add the directory containing the .lo file.
4099 func_dirname "$file" "" "."
4100 dir=$func_dirname_result
4104 func_warning "'-dlopen' is ignored for non-libtool libraries and objects"
4109 # Get the absolute pathname.
4110 absdir=`cd "$dir" && pwd`
4111 test -n "$absdir" && dir=$absdir
4113 # Now add the directory to shlibpath_var.
4114 if eval "test -z \"\$$shlibpath_var\""; then
4115 eval "$shlibpath_var=\"\$dir\""
4117 eval "$shlibpath_var=\"\$dir:\$$shlibpath_var\""
4121 # This variable tells wrapper scripts just to set shlibpath_var
4122 # rather than running their programs.
4123 libtool_execute_magic=$magic
4125 # Check if any of the arguments is a wrapper script.
4130 -* | *.la | *.lo ) ;;
4132 # Do a test to see if this is really a libtool program.
4133 if func_ltwrapper_script_p "$file"; then
4135 # Transform arg to wrapped name.
4136 file=$progdir/$program
4137 elif func_ltwrapper_executable_p "$file"; then
4138 func_ltwrapper_scriptname "$file"
4139 func_source "$func_ltwrapper_scriptname_result"
4140 # Transform arg to wrapped name.
4141 file=$progdir/$program
4145 # Quote arguments (to preserve shell metacharacters).
4146 func_append_quoted args "$file"
4149 if $opt_dry_run; then
4150 # Display what would be done.
4151 if test -n "$shlibpath_var"; then
4152 eval "\$ECHO \"\$shlibpath_var=\$$shlibpath_var\""
4153 echo "export $shlibpath_var"
4158 if test -n "$shlibpath_var"; then
4159 # Export the shlibpath_var.
4160 eval "export $shlibpath_var"
4163 # Restore saved environment variables
4164 for lt_var in LANG LANGUAGE LC_ALL LC_CTYPE LC_COLLATE LC_MESSAGES
4166 eval "if test \"\${save_$lt_var+set}\" = set; then
4167 $lt_var=\$save_$lt_var; export $lt_var
4173 # Now prepare to actually exec the command.
4178 test execute = "$opt_mode" && func_mode_execute ${1+"$@"}
4181 # func_mode_finish arg...
4190 for opt in "$nonopt" ${1+"$@"}
4192 if test -d "$opt"; then
4193 func_append libdirs " $opt"
4195 elif test -f "$opt"; then
4196 if func_lalib_unsafe_p "$opt"; then
4197 func_append libs " $opt"
4199 func_warning "'$opt' is not a valid libtool archive"
4203 func_fatal_error "invalid argument '$opt'"
4207 if test -n "$libs"; then
4208 if test -n "$lt_sysroot"; then
4209 sysroot_regex=`$ECHO "$lt_sysroot" | $SED "$sed_make_literal_regex"`
4210 sysroot_cmd="s/\([ ']\)$sysroot_regex/\1/g;"
4215 # Remove sysroot references
4216 if $opt_dry_run; then
4217 for lib in $libs; do
4218 echo "removing references to $lt_sysroot and '=' prefixes from $lib"
4221 tmpdir=`func_mktempdir`
4222 for lib in $libs; do
4223 $SED -e "$sysroot_cmd s/\([ ']-[LR]\)=/\1/g; s/\([ ']\)=/\1/g" $lib \
4225 mv -f $tmpdir/tmp-la $lib
4231 if test -n "$finish_cmds$finish_eval" && test -n "$libdirs"; then
4232 for libdir in $libdirs; do
4233 if test -n "$finish_cmds"; then
4234 # Do each command in the finish commands.
4235 func_execute_cmds "$finish_cmds" 'admincmds="$admincmds
4238 if test -n "$finish_eval"; then
4239 # Do the single finish_eval.
4240 eval cmds=\"$finish_eval\"
4241 $opt_dry_run || eval "$cmds" || func_append admincmds "
4247 # Exit here if they wanted silent mode.
4248 $opt_quiet && exit $EXIT_SUCCESS
4250 if test -n "$finish_cmds$finish_eval" && test -n "$libdirs"; then
4251 echo "----------------------------------------------------------------------"
4252 echo "Libraries have been installed in:"
4253 for libdir in $libdirs; do
4257 echo "If you ever happen to want to link against installed libraries"
4258 echo "in a given directory, LIBDIR, you must either use libtool, and"
4259 echo "specify the full pathname of the library, or use the '-LLIBDIR'"
4260 echo "flag during linking and do at least one of the following:"
4261 if test -n "$shlibpath_var"; then
4262 echo " - add LIBDIR to the '$shlibpath_var' environment variable"
4263 echo " during execution"
4265 if test -n "$runpath_var"; then
4266 echo " - add LIBDIR to the '$runpath_var' environment variable"
4267 echo " during linking"
4269 if test -n "$hardcode_libdir_flag_spec"; then
4271 eval flag=\"$hardcode_libdir_flag_spec\"
4273 $ECHO " - use the '$flag' linker flag"
4275 if test -n "$admincmds"; then
4276 $ECHO " - have your system administrator run these commands:$admincmds"
4278 if test -f /etc/ld.so.conf; then
4279 echo " - have your system administrator add LIBDIR to '/etc/ld.so.conf'"
4283 echo "See any operating system documentation about shared libraries for"
4285 solaris2.[6789]|solaris2.1[0-9])
4286 echo "more information, such as the ld(1), crle(1) and ld.so(8) manual"
4290 echo "more information, such as the ld(1) and ld.so(8) manual pages."
4293 echo "----------------------------------------------------------------------"
4298 test finish = "$opt_mode" && func_mode_finish ${1+"$@"}
4301 # func_mode_install arg...
4302 func_mode_install ()
4306 # There may be an optional sh(1) argument at the beginning of
4307 # install_prog (especially on Windows NT).
4308 if test "$SHELL" = "$nonopt" || test /bin/sh = "$nonopt" ||
4309 # Allow the use of GNU shtool's install command.
4310 case $nonopt in *shtool*) :;; *) false;; esac
4312 # Aesthetically quote it.
4313 func_quote_arg pretty "$nonopt"
4314 install_prog="$func_quote_arg_result "
4322 # The real first argument should be the name of the installation program.
4323 # Aesthetically quote it.
4324 func_quote_arg pretty "$arg"
4325 func_append install_prog "$func_quote_arg_result"
4326 install_shared_prog=$install_prog
4327 case " $install_prog " in
4328 *[\\\ /]cp\ *) install_cp=: ;;
4329 *) install_cp=false ;;
4332 # We need to accept at least all the BSD install flags.
4344 if test -n "$dest"; then
4345 func_append files " $dest"
4353 if $install_cp; then :; else
4367 # If the previous option needed an argument, then skip it.
4368 if test -n "$prev"; then
4369 if test X-m = "X$prev" && test -n "$install_override_mode"; then
4370 arg2=$install_override_mode
4381 # Aesthetically quote the argument.
4382 func_quote_arg pretty "$arg"
4383 func_append install_prog " $func_quote_arg_result"
4384 if test -n "$arg2"; then
4385 func_quote_arg pretty "$arg2"
4387 func_append install_shared_prog " $func_quote_arg_result"
4390 test -z "$install_prog" && \
4391 func_fatal_help "you must specify an install program"
4393 test -n "$prev" && \
4394 func_fatal_help "the '$prev' option requires an argument"
4396 if test -n "$install_override_mode" && $no_mode; then
4397 if $install_cp; then :; else
4398 func_quote_arg pretty "$install_override_mode"
4399 func_append install_shared_prog " -m $func_quote_arg_result"
4403 if test -z "$files"; then
4404 if test -z "$dest"; then
4405 func_fatal_help "no file or destination specified"
4407 func_fatal_help "you must specify a destination"
4411 # Strip any trailing slash from the destination.
4412 func_stripname '' '/' "$dest"
4413 dest=$func_stripname_result
4415 # Check to see that the destination is a directory.
4416 test -d "$dest" && isdir=:
4421 func_dirname_and_basename "$dest" "" "."
4422 destdir=$func_dirname_result
4423 destname=$func_basename_result
4425 # Not a directory, so check to see that there is only one file specified.
4426 set dummy $files; shift
4427 test "$#" -gt 1 && \
4428 func_fatal_help "'$dest' is not a directory"
4431 [\\/]* | [A-Za-z]:[\\/]*) ;;
4433 for file in $files; do
4437 func_fatal_help "'$destdir' must be an absolute directory name"
4444 # This variable tells wrapper scripts just to set variables rather
4445 # than running their programs.
4446 libtool_install_magic=$magic
4451 for file in $files; do
4453 # Do each installation.
4456 # Do the static libraries later.
4457 func_append staticlibs " $file"
4461 func_resolve_sysroot "$file"
4462 file=$func_resolve_sysroot_result
4464 # Check to see that this really is a libtool archive.
4465 func_lalib_unsafe_p "$file" \
4466 || func_fatal_help "'$file' is not a valid libtool archive"
4473 # Add the libdir to current_libdirs if it is the destination.
4474 if test "X$destdir" = "X$libdir"; then
4475 case "$current_libdirs " in
4477 *) func_append current_libdirs " $libdir" ;;
4480 # Note the libdir as a future libdir.
4481 case "$future_libdirs " in
4483 *) func_append future_libdirs " $libdir" ;;
4487 func_dirname "$file" "/" ""
4488 dir=$func_dirname_result
4489 func_append dir "$objdir"
4491 if test -n "$relink_command"; then
4492 # Determine the prefix the user has applied to our future dir.
4493 inst_prefix_dir=`$ECHO "$destdir" | $SED -e "s%$libdir\$%%"`
4495 # Don't allow the user to place us outside of our expected
4496 # location b/c this prevents finding dependent libraries that
4497 # are installed to the same prefix.
4498 # At present, this check doesn't affect windows .dll's that
4499 # are installed into $libdir/../bin (currently, that works fine)
4500 # but it's something to keep an eye on.
4501 test "$inst_prefix_dir" = "$destdir" && \
4502 func_fatal_error "error: cannot install '$file' to a directory not ending in $libdir"
4504 if test -n "$inst_prefix_dir"; then
4505 # Stick the inst_prefix_dir data into the link command.
4506 relink_command=`$ECHO "$relink_command" | $SED "s%@inst_prefix_dir@%-inst-prefix-dir $inst_prefix_dir%"`
4508 relink_command=`$ECHO "$relink_command" | $SED "s%@inst_prefix_dir@%%"`
4511 func_warning "relinking '$file'"
4512 func_show_eval "$relink_command" \
4513 'func_fatal_error "error: relink '\''$file'\'' with the above command before installing it"'
4516 # See the names of the shared library.
4517 set dummy $library_names; shift
4518 if test -n "$1"; then
4523 test -n "$relink_command" && srcname=${realname}T
4525 # Install the shared library and build the symlinks.
4526 func_show_eval "$install_shared_prog $dir/$srcname $destdir/$realname" \
4530 cygwin* | mingw* | pw32* | cegcc*)
4545 if test -n "$tstripme" && test -n "$striplib"; then
4546 func_show_eval "$striplib $destdir/$realname" 'exit $?'
4549 if test "$#" -gt 0; then
4550 # Delete the old symlinks, and create new ones.
4551 # Try 'ln -sf' first, because the 'ln' binary might depend on
4552 # the symlink we replace! Solaris /bin/ln does not understand -f,
4553 # so we also need to try rm && ln -s.
4556 test "$linkname" != "$realname" \
4557 && func_show_eval "(cd $destdir && { $LN_S -f $realname $linkname || { $RM $linkname && $LN_S $realname $linkname; }; })"
4561 # Do each command in the postinstall commands.
4562 lib=$destdir/$realname
4563 func_execute_cmds "$postinstall_cmds" 'exit $?'
4566 # Install the pseudo-library for information purposes.
4567 func_basename "$file"
4568 name=$func_basename_result
4569 instname=$dir/${name}i
4570 func_show_eval "$install_prog $instname $destdir/$name" 'exit $?'
4572 # Maybe install the static library, too.
4573 test -n "$old_library" && func_append staticlibs " $dir/$old_library"
4577 # Install (i.e. copy) a libtool object.
4579 # Figure out destination file name, if it wasn't already specified.
4580 if test -n "$destname"; then
4581 destfile=$destdir/$destname
4583 func_basename "$file"
4584 destfile=$func_basename_result
4585 destfile=$destdir/$destfile
4588 # Deduce the name of the destination old-style object file.
4591 func_lo2o "$destfile"
4592 staticdest=$func_lo2o_result
4595 staticdest=$destfile
4599 func_fatal_help "cannot copy a libtool object to '$destfile'"
4603 # Install the libtool object if requested.
4604 test -n "$destfile" && \
4605 func_show_eval "$install_prog $file $destfile" 'exit $?'
4607 # Install the old object if enabled.
4608 if test yes = "$build_old_libs"; then
4609 # Deduce the name of the old-style object file.
4611 staticobj=$func_lo2o_result
4612 func_show_eval "$install_prog \$staticobj \$staticdest" 'exit $?'
4618 # Figure out destination file name, if it wasn't already specified.
4619 if test -n "$destname"; then
4620 destfile=$destdir/$destname
4622 func_basename "$file"
4623 destfile=$func_basename_result
4624 destfile=$destdir/$destfile
4627 # If the file is missing, and there is a .exe on the end, strip it
4628 # because it is most likely a libtool script we actually want to
4633 if test ! -f "$file"; then
4634 func_stripname '' '.exe' "$file"
4635 file=$func_stripname_result
4641 # Do a test to see if this is really a libtool program.
4644 if func_ltwrapper_executable_p "$file"; then
4645 func_ltwrapper_scriptname "$file"
4646 wrapper=$func_ltwrapper_scriptname_result
4648 func_stripname '' '.exe' "$file"
4649 wrapper=$func_stripname_result
4656 if func_ltwrapper_script_p "$wrapper"; then
4660 func_source "$wrapper"
4662 # Check the variables that should have been set.
4663 test -z "$generated_by_libtool_version" && \
4664 func_fatal_error "invalid libtool wrapper script '$wrapper'"
4667 for lib in $notinst_deplibs; do
4668 # Check to see that each library is installed.
4670 if test -f "$lib"; then
4673 libfile=$libdir/`$ECHO "$lib" | $SED 's%^.*/%%g'`
4674 if test -n "$libdir" && test ! -f "$libfile"; then
4675 func_warning "'$lib' has not been installed in '$libdir'"
4681 func_source "$wrapper"
4684 if test no = "$fast_install" && test -n "$relink_command"; then
4687 tmpdir=`func_mktempdir`
4688 func_basename "$file$stripped_ext"
4689 file=$func_basename_result
4690 outputname=$tmpdir/$file
4691 # Replace the output file specification.
4692 relink_command=`$ECHO "$relink_command" | $SED 's%@OUTPUT@%'"$outputname"'%g'`
4695 func_quote_arg expand,pretty "$relink_command"
4696 eval "func_echo $func_quote_arg_result"
4698 if eval "$relink_command"; then :
4700 func_error "error: relink '$file' with the above command before installing it"
4701 $opt_dry_run || ${RM}r "$tmpdir"
4706 func_warning "cannot relink '$file'"
4710 # Install the binary that we compiled earlier.
4711 file=`$ECHO "$file$stripped_ext" | $SED "s%\([^/]*\)$%$objdir/\1%"`
4715 # remove .exe since cygwin /usr/bin/install will append another
4717 case $install_prog,$host in
4718 */usr/bin/install*,*cygwin*)
4719 case $file:$destfile in
4724 destfile=$destfile.exe
4727 func_stripname '' '.exe' "$destfile"
4728 destfile=$func_stripname_result
4733 func_show_eval "$install_prog\$stripme \$file \$destfile" 'exit $?'
4734 $opt_dry_run || if test -n "$outputname"; then
4741 for file in $staticlibs; do
4742 func_basename "$file"
4743 name=$func_basename_result
4745 # Set up the ranlib parameters.
4746 oldlib=$destdir/$name
4747 func_to_tool_file "$oldlib" func_convert_file_msys_to_w32
4748 tool_oldlib=$func_to_tool_file_result
4750 func_show_eval "$install_prog \$file \$oldlib" 'exit $?'
4752 if test -n "$stripme" && test -n "$old_striplib"; then
4753 func_show_eval "$old_striplib $tool_oldlib" 'exit $?'
4756 # Do each command in the postinstall commands.
4757 func_execute_cmds "$old_postinstall_cmds" 'exit $?'
4760 test -n "$future_libdirs" && \
4761 func_warning "remember to run '$progname --finish$future_libdirs'"
4763 if test -n "$current_libdirs"; then
4764 # Maybe just do a dry run.
4765 $opt_dry_run && current_libdirs=" -n$current_libdirs"
4766 exec_cmd='$SHELL "$progpath" $preserve_args --finish$current_libdirs'
4772 test install = "$opt_mode" && func_mode_install ${1+"$@"}
4775 # func_generate_dlsyms outputname originator pic_p
4776 # Extract symbols from dlprefiles and create ${outputname}S.o with
4777 # a dlpreopen symbol table.
4778 func_generate_dlsyms ()
4785 my_prefix=`$ECHO "$my_originator" | $SED 's%[^a-zA-Z0-9]%_%g'`
4788 if test -n "$dlfiles$dlprefiles" || test no != "$dlself"; then
4789 if test -n "$NM" && test -n "$global_symbol_pipe"; then
4790 my_dlsyms=${my_outputname}S.c
4792 func_error "not configured to extract global symbols from dlpreopened files"
4796 if test -n "$my_dlsyms"; then
4800 # Discover the nlist of each of the dlfiles.
4801 nlist=$output_objdir/$my_outputname.nm
4803 func_show_eval "$RM $nlist ${nlist}S ${nlist}T"
4805 # Parse the name list into a source file.
4806 func_verbose "creating $output_objdir/$my_dlsyms"
4808 $opt_dry_run || $ECHO > "$output_objdir/$my_dlsyms" "\
4809 /* $my_dlsyms - symbol resolution table for '$my_outputname' dlsym emulation. */
4810 /* Generated by $PROGRAM (GNU $PACKAGE) $VERSION */
4816 #if defined __GNUC__ && (((__GNUC__ == 4) && (__GNUC_MINOR__ >= 4)) || (__GNUC__ > 4))
4817 #pragma GCC diagnostic ignored \"-Wstrict-prototypes\"
4820 /* Keep this code in sync between libtool.m4, ltmain, lt_system.h, and tests. */
4821 #if defined _WIN32 || defined __CYGWIN__ || defined _WIN32_WCE
4822 /* DATA imports from DLLs on WIN32 can't be const, because runtime
4823 relocations are performed -- see ld's documentation on pseudo-relocs. */
4824 # define LT_DLSYM_CONST
4825 #elif defined __osf__
4826 /* This system does not cope well with relocations in const data. */
4827 # define LT_DLSYM_CONST
4829 # define LT_DLSYM_CONST const
4832 #define STREQ(s1, s2) (strcmp ((s1), (s2)) == 0)
4834 /* External symbol declarations for the compiler. */\
4837 if test yes = "$dlself"; then
4838 func_verbose "generating symbol list for '$output'"
4840 $opt_dry_run || echo ': @PROGRAM@ ' > "$nlist"
4842 # Add our own program objects to the symbol list.
4843 progfiles=`$ECHO "$objs$old_deplibs" | $SP2NL | $SED "$lo2o" | $NL2SP`
4844 for progfile in $progfiles; do
4845 func_to_tool_file "$progfile" func_convert_file_msys_to_w32
4846 func_verbose "extracting global C symbols from '$func_to_tool_file_result'"
4847 $opt_dry_run || eval "$NM $func_to_tool_file_result | $global_symbol_pipe >> '$nlist'"
4850 if test -n "$exclude_expsyms"; then
4852 eval '$EGREP -v " ($exclude_expsyms)$" "$nlist" > "$nlist"T'
4853 eval '$MV "$nlist"T "$nlist"'
4857 if test -n "$export_symbols_regex"; then
4859 eval '$EGREP -e "$export_symbols_regex" "$nlist" > "$nlist"T'
4860 eval '$MV "$nlist"T "$nlist"'
4864 # Prepare the list of exported symbols
4865 if test -z "$export_symbols"; then
4866 export_symbols=$output_objdir/$outputname.exp
4869 eval "$SED -n -e '/^: @PROGRAM@ $/d' -e 's/^.* \(.*\)$/\1/p' "'< "$nlist" > "$export_symbols"'
4871 *cygwin* | *mingw* | *cegcc* )
4872 eval "echo EXPORTS "'> "$output_objdir/$outputname.def"'
4873 eval 'cat "$export_symbols" >> "$output_objdir/$outputname.def"'
4879 eval "$SED -e 's/\([].[*^$]\)/\\\\\1/g' -e 's/^/ /' -e 's/$/$/'"' < "$export_symbols" > "$output_objdir/$outputname.exp"'
4880 eval '$GREP -f "$output_objdir/$outputname.exp" < "$nlist" > "$nlist"T'
4881 eval '$MV "$nlist"T "$nlist"'
4883 *cygwin* | *mingw* | *cegcc* )
4884 eval "echo EXPORTS "'> "$output_objdir/$outputname.def"'
4885 eval 'cat "$nlist" >> "$output_objdir/$outputname.def"'
4892 for dlprefile in $dlprefiles; do
4893 func_verbose "extracting global C symbols from '$dlprefile'"
4894 func_basename "$dlprefile"
4895 name=$func_basename_result
4897 *cygwin* | *mingw* | *cegcc* )
4898 # if an import library, we need to obtain dlname
4899 if func_win32_import_lib_p "$dlprefile"; then
4900 func_tr_sh "$dlprefile"
4901 eval "curr_lafile=\$libfile_$func_tr_sh_result"
4902 dlprefile_dlbasename=
4903 if test -n "$curr_lafile" && func_lalib_p "$curr_lafile"; then
4904 # Use subshell, to avoid clobbering current variable values
4905 dlprefile_dlname=`source "$curr_lafile" && echo "$dlname"`
4906 if test -n "$dlprefile_dlname"; then
4907 func_basename "$dlprefile_dlname"
4908 dlprefile_dlbasename=$func_basename_result
4910 # no lafile. user explicitly requested -dlpreopen <import library>.
4911 $sharedlib_from_linklib_cmd "$dlprefile"
4912 dlprefile_dlbasename=$sharedlib_from_linklib_result
4916 if test -n "$dlprefile_dlbasename"; then
4917 eval '$ECHO ": $dlprefile_dlbasename" >> "$nlist"'
4919 func_warning "Could not compute DLL name from $name"
4920 eval '$ECHO ": $name " >> "$nlist"'
4922 func_to_tool_file "$dlprefile" func_convert_file_msys_to_w32
4923 eval "$NM \"$func_to_tool_file_result\" 2>/dev/null | $global_symbol_pipe |
4924 $SED -e '/I __imp/d' -e 's/I __nm_/D /;s/_nm__//' >> '$nlist'"
4926 else # not an import lib
4928 eval '$ECHO ": $name " >> "$nlist"'
4929 func_to_tool_file "$dlprefile" func_convert_file_msys_to_w32
4930 eval "$NM \"$func_to_tool_file_result\" 2>/dev/null | $global_symbol_pipe >> '$nlist'"
4936 eval '$ECHO ": $name " >> "$nlist"'
4937 func_to_tool_file "$dlprefile" func_convert_file_msys_to_w32
4938 eval "$NM \"$func_to_tool_file_result\" 2>/dev/null | $global_symbol_pipe >> '$nlist'"
4945 # Make sure we have at least an empty file.
4946 test -f "$nlist" || : > "$nlist"
4948 if test -n "$exclude_expsyms"; then
4949 $EGREP -v " ($exclude_expsyms)$" "$nlist" > "$nlist"T
4950 $MV "$nlist"T "$nlist"
4953 # Try sorting and uniquifying the output.
4954 if $GREP -v "^: " < "$nlist" |
4955 if sort -k 3 </dev/null >/dev/null 2>&1; then
4960 uniq > "$nlist"S; then
4963 $GREP -v "^: " < "$nlist" > "$nlist"S
4966 if test -f "$nlist"S; then
4967 eval "$global_symbol_to_cdecl"' < "$nlist"S >> "$output_objdir/$my_dlsyms"'
4969 echo '/* NONE */' >> "$output_objdir/$my_dlsyms"
4972 func_show_eval '$RM "${nlist}I"'
4973 if test -n "$global_symbol_to_import"; then
4974 eval "$global_symbol_to_import"' < "$nlist"S > "$nlist"I'
4977 echo >> "$output_objdir/$my_dlsyms" "\
4979 /* The mapping between symbol names and symbols. */
4984 extern LT_DLSYM_CONST lt_dlsymlist
4985 lt_${my_prefix}_LTX_preloaded_symbols[];\
4988 if test -s "$nlist"I; then
4989 echo >> "$output_objdir/$my_dlsyms" "\
4990 static void lt_syminit(void)
4992 LT_DLSYM_CONST lt_dlsymlist *symbol = lt_${my_prefix}_LTX_preloaded_symbols;
4993 for (; symbol->name; ++symbol)
4995 $SED 's/.*/ if (STREQ (symbol->name, \"&\")) symbol->address = (void *) \&&;/' < "$nlist"I >> "$output_objdir/$my_dlsyms"
4996 echo >> "$output_objdir/$my_dlsyms" "\
5000 echo >> "$output_objdir/$my_dlsyms" "\
5001 LT_DLSYM_CONST lt_dlsymlist
5002 lt_${my_prefix}_LTX_preloaded_symbols[] =
5003 { {\"$my_originator\", (void *) 0},"
5005 if test -s "$nlist"I; then
5006 echo >> "$output_objdir/$my_dlsyms" "\
5007 {\"@INIT@\", (void *) <_syminit},"
5010 case $need_lib_prefix in
5012 eval "$global_symbol_to_c_name_address" < "$nlist" >> "$output_objdir/$my_dlsyms"
5015 eval "$global_symbol_to_c_name_address_lib_prefix" < "$nlist" >> "$output_objdir/$my_dlsyms"
5018 echo >> "$output_objdir/$my_dlsyms" "\
5022 /* This works around a problem in FreeBSD linker */
5023 #ifdef FREEBSD_WORKAROUND
5024 static const void *lt_preloaded_setup() {
5025 return lt_${my_prefix}_LTX_preloaded_symbols;
5035 pic_flag_for_symtable=
5036 case "$compile_command " in
5040 # compiling the symbol table file with pic_flag works around
5041 # a FreeBSD bug that causes programs to crash when -lm is
5042 # linked before any other PIC object. But we must not use
5043 # pic_flag when linking with -static. The problem exists in
5044 # FreeBSD 2.2.6 and is fixed in FreeBSD 3.1.
5045 *-*-freebsd2.*|*-*-freebsd3.0*|*-*-freebsdelf3.0*)
5046 pic_flag_for_symtable=" $pic_flag -DFREEBSD_WORKAROUND" ;;
5048 pic_flag_for_symtable=" $pic_flag" ;;
5050 $my_pic_p && pic_flag_for_symtable=" $pic_flag"
5056 for arg in $LTCFLAGS; do
5058 -pie | -fpie | -fPIE) ;;
5059 *) func_append symtab_cflags " $arg" ;;
5063 # Now compile the dynamic symbol file.
5064 func_show_eval '(cd $output_objdir && $LTCC$symtab_cflags -c$no_builtin_flag$pic_flag_for_symtable "$my_dlsyms")' 'exit $?'
5066 # Clean up the generated files.
5067 func_show_eval '$RM "$output_objdir/$my_dlsyms" "$nlist" "${nlist}S" "${nlist}T" "${nlist}I"'
5069 # Transform the symbol file into the correct name.
5070 symfileobj=$output_objdir/${my_outputname}S.$objext
5072 *cygwin* | *mingw* | *cegcc* )
5073 if test -f "$output_objdir/$my_outputname.def"; then
5074 compile_command=`$ECHO "$compile_command" | $SED "s%@SYMFILE@%$output_objdir/$my_outputname.def $symfileobj%"`
5075 finalize_command=`$ECHO "$finalize_command" | $SED "s%@SYMFILE@%$output_objdir/$my_outputname.def $symfileobj%"`
5077 compile_command=`$ECHO "$compile_command" | $SED "s%@SYMFILE@%$symfileobj%"`
5078 finalize_command=`$ECHO "$finalize_command" | $SED "s%@SYMFILE@%$symfileobj%"`
5082 compile_command=`$ECHO "$compile_command" | $SED "s%@SYMFILE@%$symfileobj%"`
5083 finalize_command=`$ECHO "$finalize_command" | $SED "s%@SYMFILE@%$symfileobj%"`
5088 func_fatal_error "unknown suffix for '$my_dlsyms'"
5092 # We keep going just in case the user didn't refer to
5093 # lt_preloaded_symbols. The linker will fail if global_symbol_pipe
5094 # really was required.
5096 # Nullify the symbol file.
5097 compile_command=`$ECHO "$compile_command" | $SED "s% @SYMFILE@%%"`
5098 finalize_command=`$ECHO "$finalize_command" | $SED "s% @SYMFILE@%%"`
5102 # func_cygming_gnu_implib_p ARG
5103 # This predicate returns with zero status (TRUE) if
5104 # ARG is a GNU/binutils-style import library. Returns
5105 # with nonzero status (FALSE) otherwise.
5106 func_cygming_gnu_implib_p ()
5110 func_to_tool_file "$1" func_convert_file_msys_to_w32
5111 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)$'`
5112 test -n "$func_cygming_gnu_implib_tmp"
5115 # func_cygming_ms_implib_p ARG
5116 # This predicate returns with zero status (TRUE) if
5117 # ARG is an MS-style import library. Returns
5118 # with nonzero status (FALSE) otherwise.
5119 func_cygming_ms_implib_p ()
5123 func_to_tool_file "$1" func_convert_file_msys_to_w32
5124 func_cygming_ms_implib_tmp=`$NM "$func_to_tool_file_result" | eval "$global_symbol_pipe" | $GREP '_NULL_IMPORT_DESCRIPTOR'`
5125 test -n "$func_cygming_ms_implib_tmp"
5128 # func_win32_libid arg
5129 # return the library type of file 'arg'
5131 # Need a lot of goo to handle *both* DLLs and import libs
5132 # Has to be a shell function in order to 'eat' the argument
5133 # that is supplied when $file_magic_command is called.
5134 # Despite the name, also deal with 64 bit binaries.
5139 win32_libid_type=unknown
5140 win32_fileres=`file -L $1 2>/dev/null`
5141 case $win32_fileres in
5142 *ar\ archive\ import\ library*) # definitely import
5143 win32_libid_type="x86 archive import"
5145 *ar\ archive*) # could be an import, or static
5146 # Keep the egrep pattern in sync with the one in _LT_CHECK_MAGIC_METHOD.
5147 if eval $OBJDUMP -f $1 | $SED -e '10q' 2>/dev/null |
5148 $EGREP 'file format (pei*-i386(.*architecture: i386)?|pe-arm-wince|pe-x86-64)' >/dev/null; then
5149 case $nm_interface in
5151 if func_cygming_ms_implib_p "$1" ||
5152 func_cygming_gnu_implib_p "$1"
5160 func_to_tool_file "$1" func_convert_file_msys_to_w32
5161 win32_nmres=`eval $NM -f posix -A \"$func_to_tool_file_result\" |
5172 case $win32_nmres in
5173 import*) win32_libid_type="x86 archive import";;
5174 *) win32_libid_type="x86 archive static";;
5179 win32_libid_type="x86 DLL"
5181 *executable*) # but shell scripts are "executable" too...
5182 case $win32_fileres in
5183 *MS\ Windows\ PE\ Intel*)
5184 win32_libid_type="x86 DLL"
5189 $ECHO "$win32_libid_type"
5192 # func_cygming_dll_for_implib ARG
5194 # Platform-specific function to extract the
5195 # name of the DLL associated with the specified
5196 # import library ARG.
5197 # Invoked by eval'ing the libtool variable
5198 # $sharedlib_from_linklib_cmd
5199 # Result is available in the variable
5200 # $sharedlib_from_linklib_result
5201 func_cygming_dll_for_implib ()
5205 sharedlib_from_linklib_result=`$DLLTOOL --identify-strict --identify "$1"`
5208 # func_cygming_dll_for_implib_fallback_core SECTION_NAME LIBNAMEs
5210 # The is the core of a fallback implementation of a
5211 # platform-specific function to extract the name of the
5212 # DLL associated with the specified import library LIBNAME.
5214 # SECTION_NAME is either .idata$6 or .idata$7, depending
5215 # on the platform and compiler that created the implib.
5217 # Echos the name of the DLL associated with the
5218 # specified import library.
5219 func_cygming_dll_for_implib_fallback_core ()
5223 match_literal=`$ECHO "$1" | $SED "$sed_make_literal_regex"`
5224 $OBJDUMP -s --section "$1" "$2" 2>/dev/null |
5225 $SED '/^Contents of section '"$match_literal"':/{
5226 # Place marker at beginning of archive member dllname section
5231 # These lines can sometimes be longer than 43 characters, but
5232 # are always uninteresting
5233 /:[ ]*file format pe[i]\{,1\}-/d
5234 /^In archive [^:]*:/d
5235 # Ensure marker is printed
5237 # Remove all lines with less than 43 characters
5239 # From remaining lines, remove first 43 characters
5242 # Join marker and all lines until next marker into a single line
5243 /^====MARK====/ b para
5252 # Remove trailing dots and whitespace
5256 # we now have a list, one entry per line, of the stringified
5257 # contents of the appropriate section of all members of the
5258 # archive that possess that section. Heuristic: eliminate
5259 # all those that have a first or second character that is
5260 # a '.' (that is, objdump's representation of an unprintable
5261 # character.) This should work for all archives with less than
5262 # 0x302f exports -- but will fail for DLLs whose name actually
5263 # begins with a literal '.' or a single character followed by
5266 # Of those that remain, print the first one.
5267 $SED -e '/^\./d;/^.\./d;q'
5270 # func_cygming_dll_for_implib_fallback ARG
5271 # Platform-specific function to extract the
5272 # name of the DLL associated with the specified
5273 # import library ARG.
5275 # This fallback implementation is for use when $DLLTOOL
5276 # does not support the --identify-strict option.
5277 # Invoked by eval'ing the libtool variable
5278 # $sharedlib_from_linklib_cmd
5279 # Result is available in the variable
5280 # $sharedlib_from_linklib_result
5281 func_cygming_dll_for_implib_fallback ()
5285 if func_cygming_gnu_implib_p "$1"; then
5286 # binutils import library
5287 sharedlib_from_linklib_result=`func_cygming_dll_for_implib_fallback_core '.idata$7' "$1"`
5288 elif func_cygming_ms_implib_p "$1"; then
5289 # ms-generated import library
5290 sharedlib_from_linklib_result=`func_cygming_dll_for_implib_fallback_core '.idata$6' "$1"`
5293 sharedlib_from_linklib_result=
5298 # func_extract_an_archive dir oldlib
5299 func_extract_an_archive ()
5303 f_ex_an_ar_dir=$1; shift
5304 f_ex_an_ar_oldlib=$1
5305 if test yes = "$lock_old_archive_extraction"; then
5306 lockfile=$f_ex_an_ar_oldlib.lock
5307 until $opt_dry_run || ln "$progpath" "$lockfile" 2>/dev/null; do
5308 func_echo "Waiting for $lockfile to be removed"
5312 func_show_eval "(cd \$f_ex_an_ar_dir && $AR x \"\$f_ex_an_ar_oldlib\")" \
5313 'stat=$?; rm -f "$lockfile"; exit $stat'
5314 if test yes = "$lock_old_archive_extraction"; then
5315 $opt_dry_run || rm -f "$lockfile"
5317 if ($AR t "$f_ex_an_ar_oldlib" | sort | sort -uc >/dev/null 2>&1); then
5320 func_fatal_error "object name conflicts in archive: $f_ex_an_ar_dir/$f_ex_an_ar_oldlib"
5325 # func_extract_archives gentop oldlib ...
5326 func_extract_archives ()
5331 my_oldlibs=${1+"$@"}
5337 for my_xlib in $my_oldlibs; do
5338 # Extract the objects.
5340 [\\/]* | [A-Za-z]:[\\/]*) my_xabs=$my_xlib ;;
5341 *) my_xabs=`pwd`"/$my_xlib" ;;
5343 func_basename "$my_xlib"
5344 my_xlib=$func_basename_result
5347 case " $extracted_archives " in
5349 func_arith $extracted_serial + 1
5350 extracted_serial=$func_arith_result
5351 my_xlib_u=lt$extracted_serial-$my_xlib ;;
5355 extracted_archives="$extracted_archives $my_xlib_u"
5356 my_xdir=$my_gentop/$my_xlib_u
5358 func_mkdir_p "$my_xdir"
5362 func_verbose "Extracting $my_xabs"
5363 # Do not bother doing anything if just a dry run
5365 darwin_orig_dir=`pwd`
5366 cd $my_xdir || exit $?
5367 darwin_archive=$my_xabs
5369 func_basename "$darwin_archive"
5370 darwin_base_archive=$func_basename_result
5371 darwin_arches=`$LIPO -info "$darwin_archive" 2>/dev/null | $GREP Architectures 2>/dev/null || true`
5372 if test -n "$darwin_arches"; then
5373 darwin_arches=`$ECHO "$darwin_arches" | $SED -e 's/.*are://'`
5375 func_verbose "$darwin_base_archive has multiple architectures $darwin_arches"
5376 for darwin_arch in $darwin_arches; do
5377 func_mkdir_p "unfat-$$/$darwin_base_archive-$darwin_arch"
5378 $LIPO -thin $darwin_arch -output "unfat-$$/$darwin_base_archive-$darwin_arch/$darwin_base_archive" "$darwin_archive"
5379 cd "unfat-$$/$darwin_base_archive-$darwin_arch"
5380 func_extract_an_archive "`pwd`" "$darwin_base_archive"
5382 $RM "unfat-$$/$darwin_base_archive-$darwin_arch/$darwin_base_archive"
5383 done # $darwin_arches
5384 ## Okay now we've a bunch of thin objects, gotta fatten them up :)
5385 darwin_filelist=`find unfat-$$ -type f -name \*.o -print -o -name \*.lo -print | $SED -e "$sed_basename" | sort -u`
5388 for darwin_file in $darwin_filelist; do
5389 darwin_files=`find unfat-$$ -name $darwin_file -print | sort | $NL2SP`
5390 $LIPO -create -output "$darwin_file" $darwin_files
5391 done # $darwin_filelist
5393 cd "$darwin_orig_dir"
5396 func_extract_an_archive "$my_xdir" "$my_xabs"
5401 func_extract_an_archive "$my_xdir" "$my_xabs"
5404 my_oldobjs="$my_oldobjs "`find $my_xdir -name \*.$objext -print -o -name \*.lo -print | sort | $NL2SP`
5407 func_extract_archives_result=$my_oldobjs
5411 # func_emit_wrapper [arg=no]
5413 # Emit a libtool wrapper script on stdout.
5414 # Don't directly open a file because we may want to
5415 # incorporate the script contents within a cygwin/mingw
5416 # wrapper executable. Must ONLY be called from within
5417 # func_mode_link because it depends on a number of variables
5420 # ARG is the value that the WRAPPER_SCRIPT_BELONGS_IN_OBJDIR
5421 # variable will take. If 'yes', then the emitted script
5422 # will assume that the directory where it is stored is
5423 # the $objdir directory. This is a cygwin/mingw-specific
5425 func_emit_wrapper ()
5427 func_emit_wrapper_arg1=${1-no}
5432 # $output - temporary wrapper script for $objdir/$outputname
5433 # Generated by $PROGRAM (GNU $PACKAGE) $VERSION
5435 # The $output program cannot be directly executed until all the libtool
5436 # libraries that it depends on are installed.
5438 # This wrapper script should never be moved out of the build directory.
5439 # If it is, it will not operate correctly.
5441 # Sed substitution that helps us do robust quoting. It backslashifies
5442 # metacharacters that are still active within double-quoted strings.
5443 sed_quote_subst='$sed_quote_subst'
5445 # Be Bourne compatible
5446 if test -n \"\${ZSH_VERSION+set}\" && (emulate sh) >/dev/null 2>&1; then
5449 # Zsh 3.x and 4.x performs word splitting on \${1+\"\$@\"}, which
5450 # is contrary to our usage. Disable this feature.
5451 alias -g '\${1+\"\$@\"}'='\"\$@\"'
5452 setopt NO_GLOB_SUBST
5454 case \`(set -o) 2>/dev/null\` in *posix*) set -o posix;; esac
5456 BIN_SH=xpg4; export BIN_SH # for Tru64
5457 DUALCASE=1; export DUALCASE # for MKS sh
5459 # The HP-UX ksh and POSIX shell print the target directory to stdout
5461 (unset CDPATH) >/dev/null 2>&1 && unset CDPATH
5463 relink_command=\"$relink_command\"
5465 # This environment variable determines our operation mode.
5466 if test \"\$libtool_install_magic\" = \"$magic\"; then
5467 # install mode needs the following variables:
5468 generated_by_libtool_version='$macro_version'
5469 notinst_deplibs='$notinst_deplibs'
5471 # When we are sourced in execute mode, \$file and \$ECHO are already set.
5472 if test \"\$libtool_execute_magic\" != \"$magic\"; then
5475 func_quote_arg pretty "$ECHO"
5476 qECHO=$func_quote_arg_result
5479 # A function that is used when there is no print builtin or printf.
5480 func_fallback_echo ()
5482 eval 'cat <<_LTECHO_EOF
5489 # Very basic option parsing. These options are (a) specific to
5490 # the libtool wrapper, (b) are identical between the wrapper
5491 # /script/ and the wrapper /executable/ that is used only on
5492 # windows platforms, and (c) all begin with the string "--lt-"
5493 # (application programs are unlikely to have options that match
5496 # There are only two supported options: --lt-debug and
5497 # --lt-dump-script. There is, deliberately, no --lt-help.
5499 # The first argument to this parsing function should be the
5500 # script's $0 value, followed by "$@".
5502 func_parse_lt_options ()
5508 case \"\$lt_opt\" in
5509 --lt-debug) lt_option_debug=1 ;;
5511 lt_dump_D=\`\$ECHO \"X\$lt_script_arg0\" | $SED -e 's/^X//' -e 's%/[^/]*$%%'\`
5512 test \"X\$lt_dump_D\" = \"X\$lt_script_arg0\" && lt_dump_D=.
5513 lt_dump_F=\`\$ECHO \"X\$lt_script_arg0\" | $SED -e 's/^X//' -e 's%^.*/%%'\`
5514 cat \"\$lt_dump_D/\$lt_dump_F\"
5518 \$ECHO \"Unrecognized --lt- option: '\$lt_opt'\" 1>&2
5524 # Print the debug banner immediately:
5525 if test -n \"\$lt_option_debug\"; then
5526 echo \"$outputname:$output:\$LINENO: libtool wrapper (GNU $PACKAGE) $VERSION\" 1>&2
5530 # Used when --lt-debug. Prints its arguments to stdout
5531 # (redirection is the responsibility of the caller)
5532 func_lt_dump_args ()
5537 \$ECHO \"$outputname:$output:\$LINENO: newargv[\$lt_dump_args_N]: \$lt_arg\"
5538 lt_dump_args_N=\`expr \$lt_dump_args_N + 1\`
5542 # Core function for launching the target application
5543 func_exec_program_core ()
5547 # Backslashes separate directories on plain windows
5548 *-*-mingw | *-*-os2* | *-cegcc*)
5550 if test -n \"\$lt_option_debug\"; then
5551 \$ECHO \"$outputname:$output:\$LINENO: newargv[0]: \$progdir\\\\\$program\" 1>&2
5552 func_lt_dump_args \${1+\"\$@\"} 1>&2
5554 exec \"\$progdir\\\\\$program\" \${1+\"\$@\"}
5560 if test -n \"\$lt_option_debug\"; then
5561 \$ECHO \"$outputname:$output:\$LINENO: newargv[0]: \$progdir/\$program\" 1>&2
5562 func_lt_dump_args \${1+\"\$@\"} 1>&2
5564 exec \"\$progdir/\$program\" \${1+\"\$@\"}
5569 \$ECHO \"\$0: cannot exec \$program \$*\" 1>&2
5573 # A function to encapsulate launching the target application
5574 # Strips options in the --lt-* namespace from \$@ and
5575 # launches target application with the remaining arguments.
5576 func_exec_program ()
5584 *) set x \"\$@\" \"\$lt_wr_arg\"; shift;;
5589 func_exec_program_core \${1+\"\$@\"}
5593 func_parse_lt_options \"\$0\" \${1+\"\$@\"}
5595 # Find the directory that this script lives in.
5596 thisdir=\`\$ECHO \"\$file\" | $SED 's%/[^/]*$%%'\`
5597 test \"x\$thisdir\" = \"x\$file\" && thisdir=.
5599 # Follow symbolic links until we get to the real thisdir.
5600 file=\`ls -ld \"\$file\" | $SED -n 's/.*-> //p'\`
5601 while test -n \"\$file\"; do
5602 destdir=\`\$ECHO \"\$file\" | $SED 's%/[^/]*\$%%'\`
5604 # If there was a directory component, then change thisdir.
5605 if test \"x\$destdir\" != \"x\$file\"; then
5606 case \"\$destdir\" in
5607 [\\\\/]* | [A-Za-z]:[\\\\/]*) thisdir=\"\$destdir\" ;;
5608 *) thisdir=\"\$thisdir/\$destdir\" ;;
5612 file=\`\$ECHO \"\$file\" | $SED 's%^.*/%%'\`
5613 file=\`ls -ld \"\$thisdir/\$file\" | $SED -n 's/.*-> //p'\`
5616 # Usually 'no', except on cygwin/mingw when embedded into
5618 WRAPPER_SCRIPT_BELONGS_IN_OBJDIR=$func_emit_wrapper_arg1
5619 if test \"\$WRAPPER_SCRIPT_BELONGS_IN_OBJDIR\" = \"yes\"; then
5620 # special case for '.'
5621 if test \"\$thisdir\" = \".\"; then
5624 # remove .libs from thisdir
5625 case \"\$thisdir\" in
5626 *[\\\\/]$objdir ) thisdir=\`\$ECHO \"\$thisdir\" | $SED 's%[\\\\/][^\\\\/]*$%%'\` ;;
5627 $objdir ) thisdir=. ;;
5631 # Try to get the absolute directory name.
5632 absdir=\`cd \"\$thisdir\" && pwd\`
5633 test -n \"\$absdir\" && thisdir=\"\$absdir\"
5636 if test yes = "$fast_install"; then
5638 program=lt-'$outputname'$exeext
5639 progdir=\"\$thisdir/$objdir\"
5641 if test ! -f \"\$progdir/\$program\" ||
5642 { file=\`ls -1dt \"\$progdir/\$program\" \"\$progdir/../\$program\" 2>/dev/null | $SED 1q\`; \\
5643 test \"X\$file\" != \"X\$progdir/\$program\"; }; then
5645 file=\"\$\$-\$program\"
5647 if test ! -d \"\$progdir\"; then
5648 $MKDIR \"\$progdir\"
5650 $RM \"\$progdir/\$file\"
5655 # relink executable if necessary
5656 if test -n \"\$relink_command\"; then
5657 if relink_command_output=\`eval \$relink_command 2>&1\`; then :
5659 \$ECHO \"\$relink_command_output\" >&2
5660 $RM \"\$progdir/\$file\"
5665 $MV \"\$progdir/\$file\" \"\$progdir/\$program\" 2>/dev/null ||
5666 { $RM \"\$progdir/\$program\";
5667 $MV \"\$progdir/\$file\" \"\$progdir/\$program\"; }
5668 $RM \"\$progdir/\$file\"
5672 program='$outputname'
5673 progdir=\"\$thisdir/$objdir\"
5679 if test -f \"\$progdir/\$program\"; then"
5681 # fixup the dll searchpath if we need to.
5683 # Fix the DLL searchpath if we need to. Do this before prepending
5684 # to shlibpath, because on Windows, both are PATH and uninstalled
5685 # libraries must come first.
5686 if test -n "$dllsearchpath"; then
5688 # Add the dll search path components to the executable PATH
5689 PATH=$dllsearchpath:\$PATH
5693 # Export our shlibpath_var if we have one.
5694 if test yes = "$shlibpath_overrides_runpath" && test -n "$shlibpath_var" && test -n "$temp_rpath"; then
5696 # Add our own library path to $shlibpath_var
5697 $shlibpath_var=\"$temp_rpath\$$shlibpath_var\"
5699 # Some systems cannot cope with colon-terminated $shlibpath_var
5700 # The second colon is a workaround for a bug in BeOS R4 sed
5701 $shlibpath_var=\`\$ECHO \"\$$shlibpath_var\" | $SED 's/::*\$//'\`
5703 export $shlibpath_var
5708 if test \"\$libtool_execute_magic\" != \"$magic\"; then
5709 # Run the actual program with our arguments.
5710 func_exec_program \${1+\"\$@\"}
5713 # The program doesn't exist.
5714 \$ECHO \"\$0: error: '\$progdir/\$program' does not exist\" 1>&2
5715 \$ECHO \"This script is just a wrapper for \$program.\" 1>&2
5716 \$ECHO \"See the $PACKAGE documentation for more information.\" 1>&2
5724 # func_emit_cwrapperexe_src
5725 # emit the source code for a wrapper executable on stdout
5726 # Must ONLY be called from within func_mode_link because
5727 # it depends on a number of variable set therein.
5728 func_emit_cwrapperexe_src ()
5732 /* $cwrappersource - temporary wrapper executable for $objdir/$outputname
5733 Generated by $PROGRAM (GNU $PACKAGE) $VERSION
5735 The $output program cannot be directly executed until all the libtool
5736 libraries that it depends on are installed.
5738 This wrapper executable should never be moved out of the build directory.
5739 If it is, it will not operate correctly.
5744 # define _CRT_SECURE_NO_DEPRECATE 1
5749 # include <direct.h>
5750 # include <process.h>
5753 # include <unistd.h>
5754 # include <stdint.h>
5766 #include <sys/stat.h>
5768 #define STREQ(s1, s2) (strcmp ((s1), (s2)) == 0)
5770 /* declarations of non-ANSI functions */
5771 #if defined __MINGW32__
5772 # ifdef __STRICT_ANSI__
5773 int _putenv (const char *);
5775 #elif defined __CYGWIN__
5776 # ifdef __STRICT_ANSI__
5777 char *realpath (const char *, char *);
5778 int putenv (char *);
5779 int setenv (const char *, const char *, int);
5781 /* #elif defined other_platform || defined ... */
5784 /* portability defines, excluding path handling macros */
5785 #if defined _MSC_VER
5786 # define setmode _setmode
5788 # define chmod _chmod
5789 # define getcwd _getcwd
5790 # define putenv _putenv
5791 # define S_IXUSR _S_IEXEC
5792 #elif defined __MINGW32__
5793 # define setmode _setmode
5795 # define chmod _chmod
5796 # define getcwd _getcwd
5797 # define putenv _putenv
5798 #elif defined __CYGWIN__
5799 # define HAVE_SETENV
5800 # define FOPEN_WB "wb"
5801 /* #elif defined other platforms ... */
5804 #if defined PATH_MAX
5805 # define LT_PATHMAX PATH_MAX
5806 #elif defined MAXPATHLEN
5807 # define LT_PATHMAX MAXPATHLEN
5809 # define LT_PATHMAX 1024
5819 /* path handling portability macros */
5820 #ifndef DIR_SEPARATOR
5821 # define DIR_SEPARATOR '/'
5822 # define PATH_SEPARATOR ':'
5825 #if defined _WIN32 || defined __MSDOS__ || defined __DJGPP__ || \
5827 # define HAVE_DOS_BASED_FILE_SYSTEM
5828 # define FOPEN_WB "wb"
5829 # ifndef DIR_SEPARATOR_2
5830 # define DIR_SEPARATOR_2 '\\'
5832 # ifndef PATH_SEPARATOR_2
5833 # define PATH_SEPARATOR_2 ';'
5837 #ifndef DIR_SEPARATOR_2
5838 # define IS_DIR_SEPARATOR(ch) ((ch) == DIR_SEPARATOR)
5839 #else /* DIR_SEPARATOR_2 */
5840 # define IS_DIR_SEPARATOR(ch) \
5841 (((ch) == DIR_SEPARATOR) || ((ch) == DIR_SEPARATOR_2))
5842 #endif /* DIR_SEPARATOR_2 */
5844 #ifndef PATH_SEPARATOR_2
5845 # define IS_PATH_SEPARATOR(ch) ((ch) == PATH_SEPARATOR)
5846 #else /* PATH_SEPARATOR_2 */
5847 # define IS_PATH_SEPARATOR(ch) ((ch) == PATH_SEPARATOR_2)
5848 #endif /* PATH_SEPARATOR_2 */
5851 # define FOPEN_WB "w"
5854 # define _O_BINARY 0
5857 #define XMALLOC(type, num) ((type *) xmalloc ((num) * sizeof(type)))
5858 #define XFREE(stale) do { \
5859 if (stale) { free (stale); stale = 0; } \
5862 #if defined LT_DEBUGWRAPPER
5863 static int lt_debug = 1;
5865 static int lt_debug = 0;
5868 const char *program_name = "libtool-wrapper"; /* in case xstrdup fails */
5870 void *xmalloc (size_t num);
5871 char *xstrdup (const char *string);
5872 const char *base_name (const char *name);
5873 char *find_executable (const char *wrapper);
5874 char *chase_symlinks (const char *pathspec);
5875 int make_executable (const char *path);
5876 int check_executable (const char *path);
5877 char *strendzap (char *str, const char *pat);
5878 void lt_debugprintf (const char *file, int line, const char *fmt, ...);
5879 void lt_fatal (const char *file, int line, const char *message, ...);
5880 static const char *nonnull (const char *s);
5881 static const char *nonempty (const char *s);
5882 void lt_setenv (const char *name, const char *value);
5883 char *lt_extend_str (const char *orig_value, const char *add, int to_end);
5884 void lt_update_exe_path (const char *name, const char *value);
5885 void lt_update_lib_path (const char *name, const char *value);
5886 char **prepare_spawn (char **argv);
5887 void lt_dump_script (FILE *f);
5891 #if __GNUC__ < 4 || (__GNUC__ == 4 && __GNUC_MINOR__ < 5)
5892 # define externally_visible volatile
5894 # define externally_visible __attribute__((externally_visible)) volatile
5896 externally_visible const char * MAGIC_EXE = "$magic_exe";
5897 const char * LIB_PATH_VARNAME = "$shlibpath_var";
5900 if test yes = "$shlibpath_overrides_runpath" && test -n "$shlibpath_var" && test -n "$temp_rpath"; then
5901 func_to_host_path "$temp_rpath"
5903 const char * LIB_PATH_VALUE = "$func_to_host_path_result";
5907 const char * LIB_PATH_VALUE = "";
5911 if test -n "$dllsearchpath"; then
5912 func_to_host_path "$dllsearchpath:"
5914 const char * EXE_PATH_VARNAME = "PATH";
5915 const char * EXE_PATH_VALUE = "$func_to_host_path_result";
5919 const char * EXE_PATH_VARNAME = "";
5920 const char * EXE_PATH_VALUE = "";
5924 if test yes = "$fast_install"; then
5926 const char * TARGET_PROGRAM_NAME = "lt-$outputname"; /* hopefully, no .exe */
5930 const char * TARGET_PROGRAM_NAME = "$outputname"; /* hopefully, no .exe */
5937 #define LTWRAPPER_OPTION_PREFIX "--lt-"
5939 static const char *ltwrapper_option_prefix = LTWRAPPER_OPTION_PREFIX;
5940 static const char *dumpscript_opt = LTWRAPPER_OPTION_PREFIX "dump-script";
5941 static const char *debug_opt = LTWRAPPER_OPTION_PREFIX "debug";
5944 main (int argc, char *argv[])
5949 char *actual_cwrapper_path;
5950 char *actual_cwrapper_name;
5957 program_name = (char *) xstrdup (base_name (argv[0]));
5958 newargz = XMALLOC (char *, (size_t) argc + 1);
5960 /* very simple arg parsing; don't want to rely on getopt
5961 * also, copy all non cwrapper options to newargz, except
5962 * argz[0], which is handled differently
5965 for (i = 1; i < argc; i++)
5967 if (STREQ (argv[i], dumpscript_opt))
5971 *mingw* | *cygwin* )
5972 # make stdout use "unix" line endings
5973 echo " setmode(1,_O_BINARY);"
5978 lt_dump_script (stdout);
5981 if (STREQ (argv[i], debug_opt))
5986 if (STREQ (argv[i], ltwrapper_option_prefix))
5988 /* however, if there is an option in the LTWRAPPER_OPTION_PREFIX
5989 namespace, but it is not one of the ones we know about and
5990 have already dealt with, above (inluding dump-script), then
5991 report an error. Otherwise, targets might begin to believe
5992 they are allowed to use options in the LTWRAPPER_OPTION_PREFIX
5993 namespace. The first time any user complains about this, we'll
5994 need to make LTWRAPPER_OPTION_PREFIX a configure-time option
5995 or a configure.ac-settable value.
5997 lt_fatal (__FILE__, __LINE__,
5998 "unrecognized %s option: '%s'",
5999 ltwrapper_option_prefix, argv[i]);
6002 newargz[++newargc] = xstrdup (argv[i]);
6004 newargz[++newargc] = NULL;
6008 /* The GNU banner must be the first non-error debug message */
6009 lt_debugprintf (__FILE__, __LINE__, "libtool wrapper (GNU $PACKAGE) $VERSION\n");
6012 lt_debugprintf (__FILE__, __LINE__, "(main) argv[0]: %s\n", argv[0]);
6013 lt_debugprintf (__FILE__, __LINE__, "(main) program_name: %s\n", program_name);
6015 tmp_pathspec = find_executable (argv[0]);
6016 if (tmp_pathspec == NULL)
6017 lt_fatal (__FILE__, __LINE__, "couldn't find %s", argv[0]);
6018 lt_debugprintf (__FILE__, __LINE__,
6019 "(main) found exe (before symlink chase) at: %s\n",
6022 actual_cwrapper_path = chase_symlinks (tmp_pathspec);
6023 lt_debugprintf (__FILE__, __LINE__,
6024 "(main) found exe (after symlink chase) at: %s\n",
6025 actual_cwrapper_path);
6026 XFREE (tmp_pathspec);
6028 actual_cwrapper_name = xstrdup (base_name (actual_cwrapper_path));
6029 strendzap (actual_cwrapper_path, actual_cwrapper_name);
6031 /* wrapper name transforms */
6032 strendzap (actual_cwrapper_name, ".exe");
6033 tmp_pathspec = lt_extend_str (actual_cwrapper_name, ".exe", 1);
6034 XFREE (actual_cwrapper_name);
6035 actual_cwrapper_name = tmp_pathspec;
6038 /* target_name transforms -- use actual target program name; might have lt- prefix */
6039 target_name = xstrdup (base_name (TARGET_PROGRAM_NAME));
6040 strendzap (target_name, ".exe");
6041 tmp_pathspec = lt_extend_str (target_name, ".exe", 1);
6042 XFREE (target_name);
6043 target_name = tmp_pathspec;
6046 lt_debugprintf (__FILE__, __LINE__,
6047 "(main) libtool target name: %s\n",
6053 XMALLOC (char, (strlen (actual_cwrapper_path) +
6054 strlen ("$objdir") + 1 + strlen (actual_cwrapper_name) + 1));
6055 strcpy (newargz[0], actual_cwrapper_path);
6056 strcat (newargz[0], "$objdir");
6057 strcat (newargz[0], "/");
6061 /* stop here, and copy so we don't have to do this twice */
6062 tmp_pathspec = xstrdup (newargz[0]);
6064 /* do NOT want the lt- prefix here, so use actual_cwrapper_name */
6065 strcat (newargz[0], actual_cwrapper_name);
6067 /* DO want the lt- prefix here if it exists, so use target_name */
6068 lt_argv_zero = lt_extend_str (tmp_pathspec, target_name, 1);
6069 XFREE (tmp_pathspec);
6070 tmp_pathspec = NULL;
6078 while ((p = strchr (newargz[0], '\\')) != NULL)
6082 while ((p = strchr (lt_argv_zero, '\\')) != NULL)
6092 XFREE (target_name);
6093 XFREE (actual_cwrapper_path);
6094 XFREE (actual_cwrapper_name);
6096 lt_setenv ("BIN_SH", "xpg4"); /* for Tru64 */
6097 lt_setenv ("DUALCASE", "1"); /* for MSK sh */
6098 /* Update the DLL searchpath. EXE_PATH_VALUE ($dllsearchpath) must
6099 be prepended before (that is, appear after) LIB_PATH_VALUE ($temp_rpath)
6100 because on Windows, both *_VARNAMEs are PATH but uninstalled
6101 libraries must come first. */
6102 lt_update_exe_path (EXE_PATH_VARNAME, EXE_PATH_VALUE);
6103 lt_update_lib_path (LIB_PATH_VARNAME, LIB_PATH_VALUE);
6105 lt_debugprintf (__FILE__, __LINE__, "(main) lt_argv_zero: %s\n",
6106 nonnull (lt_argv_zero));
6107 for (i = 0; i < newargc; i++)
6109 lt_debugprintf (__FILE__, __LINE__, "(main) newargz[%d]: %s\n",
6110 i, nonnull (newargz[i]));
6118 /* execv doesn't actually work on mingw as expected on unix */
6119 newargz = prepare_spawn (newargz);
6120 rval = (int) _spawnv (_P_WAIT, lt_argv_zero, (const char * const *) newargz);
6123 /* failed to start process */
6124 lt_debugprintf (__FILE__, __LINE__,
6125 "(main) failed to launch target \"%s\": %s\n",
6126 lt_argv_zero, nonnull (strerror (errno)));
6134 execv (lt_argv_zero, newargz);
6135 return rval; /* =127, but avoids unused variable warning */
6144 xmalloc (size_t num)
6146 void *p = (void *) malloc (num);
6148 lt_fatal (__FILE__, __LINE__, "memory exhausted");
6154 xstrdup (const char *string)
6156 return string ? strcpy ((char *) xmalloc (strlen (string) + 1),
6161 base_name (const char *name)
6165 #if defined HAVE_DOS_BASED_FILE_SYSTEM
6166 /* Skip over the disk name in MSDOS pathnames. */
6167 if (isalpha ((unsigned char) name[0]) && name[1] == ':')
6171 for (base = name; *name; name++)
6172 if (IS_DIR_SEPARATOR (*name))
6178 check_executable (const char *path)
6182 lt_debugprintf (__FILE__, __LINE__, "(check_executable): %s\n",
6184 if ((!path) || (!*path))
6187 if ((stat (path, &st) >= 0)
6188 && (st.st_mode & (S_IXUSR | S_IXGRP | S_IXOTH)))
6195 make_executable (const char *path)
6200 lt_debugprintf (__FILE__, __LINE__, "(make_executable): %s\n",
6202 if ((!path) || (!*path))
6205 if (stat (path, &st) >= 0)
6207 rval = chmod (path, st.st_mode | S_IXOTH | S_IXGRP | S_IXUSR);
6212 /* Searches for the full path of the wrapper. Returns
6213 newly allocated full path name if found, NULL otherwise
6214 Does not chase symlinks, even on platforms that support them.
6217 find_executable (const char *wrapper)
6222 /* static buffer for getcwd */
6223 char tmp[LT_PATHMAX + 1];
6227 lt_debugprintf (__FILE__, __LINE__, "(find_executable): %s\n",
6228 nonempty (wrapper));
6230 if ((wrapper == NULL) || (*wrapper == '\0'))
6233 /* Absolute path? */
6234 #if defined HAVE_DOS_BASED_FILE_SYSTEM
6235 if (isalpha ((unsigned char) wrapper[0]) && wrapper[1] == ':')
6237 concat_name = xstrdup (wrapper);
6238 if (check_executable (concat_name))
6240 XFREE (concat_name);
6245 if (IS_DIR_SEPARATOR (wrapper[0]))
6247 concat_name = xstrdup (wrapper);
6248 if (check_executable (concat_name))
6250 XFREE (concat_name);
6252 #if defined HAVE_DOS_BASED_FILE_SYSTEM
6256 for (p = wrapper; *p; p++)
6264 /* no slashes; search PATH */
6265 const char *path = getenv ("PATH");
6268 for (p = path; *p; p = p_next)
6272 for (q = p; *q; q++)
6273 if (IS_PATH_SEPARATOR (*q))
6275 p_len = (size_t) (q - p);
6276 p_next = (*q == '\0' ? q : q + 1);
6279 /* empty path: current directory */
6280 if (getcwd (tmp, LT_PATHMAX) == NULL)
6281 lt_fatal (__FILE__, __LINE__, "getcwd failed: %s",
6282 nonnull (strerror (errno)));
6283 tmp_len = strlen (tmp);
6285 XMALLOC (char, tmp_len + 1 + strlen (wrapper) + 1);
6286 memcpy (concat_name, tmp, tmp_len);
6287 concat_name[tmp_len] = '/';
6288 strcpy (concat_name + tmp_len + 1, wrapper);
6293 XMALLOC (char, p_len + 1 + strlen (wrapper) + 1);
6294 memcpy (concat_name, p, p_len);
6295 concat_name[p_len] = '/';
6296 strcpy (concat_name + p_len + 1, wrapper);
6298 if (check_executable (concat_name))
6300 XFREE (concat_name);
6303 /* not found in PATH; assume curdir */
6305 /* Relative path | not found in path: prepend cwd */
6306 if (getcwd (tmp, LT_PATHMAX) == NULL)
6307 lt_fatal (__FILE__, __LINE__, "getcwd failed: %s",
6308 nonnull (strerror (errno)));
6309 tmp_len = strlen (tmp);
6310 concat_name = XMALLOC (char, tmp_len + 1 + strlen (wrapper) + 1);
6311 memcpy (concat_name, tmp, tmp_len);
6312 concat_name[tmp_len] = '/';
6313 strcpy (concat_name + tmp_len + 1, wrapper);
6315 if (check_executable (concat_name))
6317 XFREE (concat_name);
6322 chase_symlinks (const char *pathspec)
6325 return xstrdup (pathspec);
6327 char buf[LT_PATHMAX];
6329 char *tmp_pathspec = xstrdup (pathspec);
6331 int has_symlinks = 0;
6332 while (strlen (tmp_pathspec) && !has_symlinks)
6334 lt_debugprintf (__FILE__, __LINE__,
6335 "checking path component for symlinks: %s\n",
6337 if (lstat (tmp_pathspec, &s) == 0)
6339 if (S_ISLNK (s.st_mode) != 0)
6345 /* search backwards for last DIR_SEPARATOR */
6346 p = tmp_pathspec + strlen (tmp_pathspec) - 1;
6347 while ((p > tmp_pathspec) && (!IS_DIR_SEPARATOR (*p)))
6349 if ((p == tmp_pathspec) && (!IS_DIR_SEPARATOR (*p)))
6351 /* no more DIR_SEPARATORS left */
6358 lt_fatal (__FILE__, __LINE__,
6359 "error accessing file \"%s\": %s",
6360 tmp_pathspec, nonnull (strerror (errno)));
6363 XFREE (tmp_pathspec);
6367 return xstrdup (pathspec);
6370 tmp_pathspec = realpath (pathspec, buf);
6371 if (tmp_pathspec == 0)
6373 lt_fatal (__FILE__, __LINE__,
6374 "could not follow symlinks for %s", pathspec);
6376 return xstrdup (tmp_pathspec);
6381 strendzap (char *str, const char *pat)
6385 assert (str != NULL);
6386 assert (pat != NULL);
6389 patlen = strlen (pat);
6393 str += len - patlen;
6394 if (STREQ (str, pat))
6401 lt_debugprintf (const char *file, int line, const char *fmt, ...)
6406 (void) fprintf (stderr, "%s:%s:%d: ", program_name, file, line);
6407 va_start (args, fmt);
6408 (void) vfprintf (stderr, fmt, args);
6414 lt_error_core (int exit_status, const char *file,
6415 int line, const char *mode,
6416 const char *message, va_list ap)
6418 fprintf (stderr, "%s:%s:%d: %s: ", program_name, file, line, mode);
6419 vfprintf (stderr, message, ap);
6420 fprintf (stderr, ".\n");
6422 if (exit_status >= 0)
6427 lt_fatal (const char *file, int line, const char *message, ...)
6430 va_start (ap, message);
6431 lt_error_core (EXIT_FAILURE, file, line, "FATAL", message, ap);
6436 nonnull (const char *s)
6438 return s ? s : "(null)";
6442 nonempty (const char *s)
6444 return (s && !*s) ? "(empty)" : nonnull (s);
6448 lt_setenv (const char *name, const char *value)
6450 lt_debugprintf (__FILE__, __LINE__,
6451 "(lt_setenv) setting '%s' to '%s'\n",
6452 nonnull (name), nonnull (value));
6455 /* always make a copy, for consistency with !HAVE_SETENV */
6456 char *str = xstrdup (value);
6457 setenv (name, str, 1);
6459 size_t len = strlen (name) + 1 + strlen (value) + 1;
6460 char *str = XMALLOC (char, len);
6461 sprintf (str, "%s=%s", name, value);
6462 if (putenv (str) != EXIT_SUCCESS)
6471 lt_extend_str (const char *orig_value, const char *add, int to_end)
6474 if (orig_value && *orig_value)
6476 size_t orig_value_len = strlen (orig_value);
6477 size_t add_len = strlen (add);
6478 new_value = XMALLOC (char, add_len + orig_value_len + 1);
6481 strcpy (new_value, orig_value);
6482 strcpy (new_value + orig_value_len, add);
6486 strcpy (new_value, add);
6487 strcpy (new_value + add_len, orig_value);
6492 new_value = xstrdup (add);
6498 lt_update_exe_path (const char *name, const char *value)
6500 lt_debugprintf (__FILE__, __LINE__,
6501 "(lt_update_exe_path) modifying '%s' by prepending '%s'\n",
6502 nonnull (name), nonnull (value));
6504 if (name && *name && value && *value)
6506 char *new_value = lt_extend_str (getenv (name), value, 0);
6507 /* some systems can't cope with a ':'-terminated path #' */
6508 size_t len = strlen (new_value);
6509 while ((len > 0) && IS_PATH_SEPARATOR (new_value[len-1]))
6511 new_value[--len] = '\0';
6513 lt_setenv (name, new_value);
6519 lt_update_lib_path (const char *name, const char *value)
6521 lt_debugprintf (__FILE__, __LINE__,
6522 "(lt_update_lib_path) modifying '%s' by prepending '%s'\n",
6523 nonnull (name), nonnull (value));
6525 if (name && *name && value && *value)
6527 char *new_value = lt_extend_str (getenv (name), value, 0);
6528 lt_setenv (name, new_value);
6538 /* Prepares an argument vector before calling spawn().
6539 Note that spawn() does not by itself call the command interpreter
6540 (getenv ("COMSPEC") != NULL ? getenv ("COMSPEC") :
6541 ({ OSVERSIONINFO v; v.dwOSVersionInfoSize = sizeof(OSVERSIONINFO);
6543 v.dwPlatformId == VER_PLATFORM_WIN32_NT;
6544 }) ? "cmd.exe" : "command.com").
6545 Instead it simply concatenates the arguments, separated by ' ', and calls
6546 CreateProcess(). We must quote the arguments since Win32 CreateProcess()
6547 interprets characters like ' ', '\t', '\\', '"' (but not '<' and '>') in a
6549 - Space and tab are interpreted as delimiters. They are not treated as
6550 delimiters if they are surrounded by double quotes: "...".
6551 - Unescaped double quotes are removed from the input. Their only effect is
6552 that within double quotes, space and tab are treated like normal
6554 - Backslashes not followed by double quotes are not special.
6555 - But 2*n+1 backslashes followed by a double quote become
6556 n backslashes followed by a double quote (n >= 0):
6561 #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"
6562 #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"
6564 prepare_spawn (char **argv)
6570 /* Count number of arguments. */
6571 for (argc = 0; argv[argc] != NULL; argc++)
6574 /* Allocate new argument vector. */
6575 new_argv = XMALLOC (char *, argc + 1);
6577 /* Put quoted arguments into the new argument vector. */
6578 for (i = 0; i < argc; i++)
6580 const char *string = argv[i];
6582 if (string[0] == '\0')
6583 new_argv[i] = xstrdup ("\"\"");
6584 else if (strpbrk (string, SHELL_SPECIAL_CHARS) != NULL)
6586 int quote_around = (strpbrk (string, SHELL_SPACE_CHARS) != NULL);
6588 unsigned int backslashes;
6590 char *quoted_string;
6597 for (s = string; *s != '\0'; s++)
6601 length += backslashes + 1;
6609 length += backslashes + 1;
6611 quoted_string = XMALLOC (char, length + 1);
6617 for (s = string; *s != '\0'; s++)
6623 for (j = backslashes + 1; j > 0; j--)
6635 for (j = backslashes; j > 0; j--)
6641 new_argv[i] = quoted_string;
6644 new_argv[i] = (char *) string;
6646 new_argv[argc] = NULL;
6655 void lt_dump_script (FILE* f)
6658 func_emit_wrapper yes |
6660 s/^\(.\{79\}\)\(..*\)/\1\
6665 s/\([^\n]*\).*/ fputs ("\1", f);/p
6672 # end: func_emit_cwrapperexe_src
6674 # func_win32_import_lib_p ARG
6675 # True if ARG is an import lib, as indicated by $file_magic_cmd
6676 func_win32_import_lib_p ()
6680 case `eval $file_magic_cmd \"\$1\" 2>/dev/null | $SED -e 10q` in
6686 # func_suncc_cstd_abi
6687 # !!ONLY CALL THIS FOR SUN CC AFTER $compile_command IS FULLY EXPANDED!!
6688 # Several compiler flags select an ABI that is incompatible with the
6689 # Cstd library. Avoid specifying it if any are in CXXFLAGS.
6690 func_suncc_cstd_abi ()
6694 case " $compile_command " in
6695 *" -compat=g "*|*\ -std=c++[0-9][0-9]\ *|*" -library=stdcxx4 "*|*" -library=stlport4 "*)
6696 suncc_use_cstd_abi=no
6699 suncc_use_cstd_abi=yes
6704 # func_mode_link arg...
6710 *-*-cygwin* | *-*-mingw* | *-*-pw32* | *-*-os2* | *-cegcc*)
6711 # It is impossible to link a dll without this setting, and
6712 # we shouldn't force the makefile maintainer to figure out
6713 # what system we are compiling for in order to pass an extra
6714 # flag for every libtool invocation.
6715 # allow_undefined=no
6717 # FIXME: Unfortunately, there are problems with the above when trying
6718 # to make a dll that has undefined symbols, in which case not
6719 # even a static library is built. For now, we need to specify
6720 # -no-undefined on the libtool link line when we can be certain
6721 # that all symbols are satisfied, otherwise we get a static library.
6728 libtool_args=$nonopt
6729 base_compile="$nonopt $@"
6730 compile_command=$nonopt
6731 finalize_command=$nonopt
6744 lib_search_path=`pwd`
6746 new_inherited_linker_flags=
6755 export_symbols_regex=
6764 precious_files_regex=
6765 prefer_static_libs=no
6778 single_module=$wl-single_module
6779 func_infer_tag $base_compile
6781 # We need to know -static, to get the right output filenames.
6786 test yes != "$build_libtool_libs" \
6787 && func_fatal_configuration "cannot build a shared library"
6791 -all-static | -static | -static-libtool-libs)
6794 if test yes = "$build_libtool_libs" && test -z "$link_static_flag"; then
6795 func_warning "complete static linking is impossible in this configuration"
6797 if test -n "$link_static_flag"; then
6798 dlopen_self=$dlopen_self_static
6800 prefer_static_libs=yes
6803 if test -z "$pic_flag" && test -n "$link_static_flag"; then
6804 dlopen_self=$dlopen_self_static
6806 prefer_static_libs=built
6808 -static-libtool-libs)
6809 if test -z "$pic_flag" && test -n "$link_static_flag"; then
6810 dlopen_self=$dlopen_self_static
6812 prefer_static_libs=yes
6815 build_libtool_libs=no
6822 # See if our shared archives depend on static archives.
6823 test -n "$old_archive_from_new_cmds" && build_old_libs=yes
6825 # Go through the arguments, transforming them on the way.
6826 while test "$#" -gt 0; do
6829 func_quote_arg pretty,unquoted "$arg"
6830 qarg=$func_quote_arg_unquoted_result
6831 func_append libtool_args " $func_quote_arg_result"
6833 # If the previous option needs an argument, assign it.
6834 if test -n "$prev"; then
6837 func_append compile_command " @OUTPUT@"
6838 func_append finalize_command " @OUTPUT@"
6850 # Add the symbol object into the linking commands.
6851 func_append compile_command " @SYMFILE@"
6852 func_append finalize_command " @SYMFILE@"
6856 *.la | *.lo) ;; # We handle these cases below.
6858 if test no = "$dlself"; then
6866 if test dlprefiles = "$prev"; then
6868 elif test dlfiles = "$prev" && test yes != "$dlopen_self"; then
6878 if test dlfiles = "$prev"; then
6879 func_append dlfiles " $arg"
6881 func_append dlprefiles " $arg"
6891 || func_fatal_error "symbol file '$arg' does not exist"
6896 export_symbols_regex=$arg
6904 *" $qarg.ltframework "*) ;;
6905 *) func_append deplibs " $qarg.ltframework" # this is fixed later
6914 inst_prefix_dir=$arg
6919 # Clang does not use LLVM to link, so we can simply discard any
6920 # '-mllvm $arg' options when doing the link step.
6925 if test -f "$arg"; then
6928 for fil in `cat "$save_arg"`
6930 # func_append moreargs " $fil"
6932 # A libtool-controlled object.
6934 # Check to see that this really is a libtool object.
6935 if func_lalib_unsafe_p "$arg"; then
6942 if test -z "$pic_object" ||
6943 test -z "$non_pic_object" ||
6944 test none = "$pic_object" &&
6945 test none = "$non_pic_object"; then
6946 func_fatal_error "cannot find name of object for '$arg'"
6949 # Extract subdirectory from the argument.
6950 func_dirname "$arg" "/" ""
6951 xdir=$func_dirname_result
6953 if test none != "$pic_object"; then
6954 # Prepend the subdirectory the object is found in.
6955 pic_object=$xdir$pic_object
6957 if test dlfiles = "$prev"; then
6958 if test yes = "$build_libtool_libs" && test yes = "$dlopen_support"; then
6959 func_append dlfiles " $pic_object"
6963 # If libtool objects are unsupported, then we need to preload.
6968 # CHECK ME: I think I busted this. -Ossama
6969 if test dlprefiles = "$prev"; then
6970 # Preload the old-style object.
6971 func_append dlprefiles " $pic_object"
6976 func_append libobjs " $pic_object"
6981 if test none != "$non_pic_object"; then
6982 # Prepend the subdirectory the object is found in.
6983 non_pic_object=$xdir$non_pic_object
6985 # A standard non-PIC object
6986 func_append non_pic_objects " $non_pic_object"
6987 if test -z "$pic_object" || test none = "$pic_object"; then
6991 # If the PIC object exists, use it instead.
6992 # $xdir was prepended to $pic_object above.
6993 non_pic_object=$pic_object
6994 func_append non_pic_objects " $non_pic_object"
6997 # Only an error if not doing a dry-run.
6998 if $opt_dry_run; then
6999 # Extract subdirectory from the argument.
7000 func_dirname "$arg" "/" ""
7001 xdir=$func_dirname_result
7004 pic_object=$xdir$objdir/$func_lo2o_result
7005 non_pic_object=$xdir$func_lo2o_result
7006 func_append libobjs " $pic_object"
7007 func_append non_pic_objects " $non_pic_object"
7009 func_fatal_error "'$arg' is not a valid libtool object"
7014 func_fatal_error "link input file '$arg' does not exist"
7026 precious_files_regex=$arg
7036 # We need an absolute path.
7038 [\\/]* | [A-Za-z]:[\\/]*) ;;
7040 func_fatal_error "only absolute run-paths are allowed"
7043 if test rpath = "$prev"; then
7046 *) func_append rpath " $arg" ;;
7051 *) func_append xrpath " $arg" ;;
7063 func_append weak_libs " $arg"
7068 func_append linker_flags " $qarg"
7069 func_append compiler_flags " $qarg"
7071 func_append compile_command " $qarg"
7072 func_append finalize_command " $qarg"
7076 func_append compiler_flags " $qarg"
7078 func_append compile_command " $qarg"
7079 func_append finalize_command " $qarg"
7083 func_append linker_flags " $qarg"
7084 func_append compiler_flags " $wl$qarg"
7086 func_append compile_command " $wl$qarg"
7087 func_append finalize_command " $wl$qarg"
7091 eval "$prev=\"\$arg\""
7096 fi # test -n "$prev"
7102 if test -n "$link_static_flag"; then
7103 # See comment for -static flag below, for more details.
7104 func_append compile_command " $link_static_flag"
7105 func_append finalize_command " $link_static_flag"
7111 # FIXME: remove this flag sometime in the future.
7112 func_fatal_error "'-allow-undefined' must not be used because it is the default"
7140 -export-symbols | -export-symbols-regex)
7141 if test -n "$export_symbols" || test -n "$export_symbols_regex"; then
7142 func_fatal_error "more than one -exported-symbols argument is not allowed"
7144 if test X-export-symbols = "X$arg"; then
7162 # The native IRIX linker understands -LANG:*, -LIST:* and -LNO:*
7163 # so, if we see these flags be careful not to treat them like -L
7165 case $with_gcc/$host in
7166 no/*-*-irix* | /*-*-irix*)
7167 func_append compile_command " $arg"
7168 func_append finalize_command " $arg"
7175 func_stripname "-L" '' "$arg"
7176 if test -z "$func_stripname_result"; then
7177 if test "$#" -gt 0; then
7178 func_fatal_error "require no space between '-L' and '$1'"
7180 func_fatal_error "need path for '-L' option"
7183 func_resolve_sysroot "$func_stripname_result"
7184 dir=$func_resolve_sysroot_result
7185 # We need an absolute path.
7187 [\\/]* | [A-Za-z]:[\\/]*) ;;
7189 absdir=`cd "$dir" && pwd`
7190 test -z "$absdir" && \
7191 func_fatal_error "cannot determine absolute directory name of '$dir'"
7196 *" -L$dir "* | *" $arg "*)
7197 # Will only happen for absolute or sysroot arguments
7200 # Preserve sysroot, but never include relative directories
7202 [\\/]* | [A-Za-z]:[\\/]* | =*) func_append deplibs " $arg" ;;
7203 *) func_append deplibs " -L$dir" ;;
7205 func_append lib_search_path " $dir"
7209 *-*-cygwin* | *-*-mingw* | *-*-pw32* | *-*-os2* | *-cegcc*)
7210 testbindir=`$ECHO "$dir" | $SED 's*/lib$*/bin*'`
7211 case :$dllsearchpath: in
7213 ::) dllsearchpath=$dir;;
7214 *) func_append dllsearchpath ":$dir";;
7216 case :$dllsearchpath: in
7217 *":$testbindir:"*) ;;
7218 ::) dllsearchpath=$testbindir;;
7219 *) func_append dllsearchpath ":$testbindir";;
7227 if test X-lc = "X$arg" || test X-lm = "X$arg"; then
7229 *-*-cygwin* | *-*-mingw* | *-*-pw32* | *-*-beos* | *-cegcc* | *-*-haiku*)
7230 # These systems don't actually have a C or math library (as such)
7234 # These systems don't actually have a C library (as such)
7235 test X-lc = "X$arg" && continue
7237 *-*-openbsd* | *-*-freebsd* | *-*-dragonfly* | *-*-bitrig*)
7238 # Do not include libc due to us having libc/libc_r.
7239 test X-lc = "X$arg" && continue
7241 *-*-rhapsody* | *-*-darwin1.[012])
7242 # Rhapsody C and math libraries are in the System framework
7243 func_append deplibs " System.ltframework"
7246 *-*-sco3.2v5* | *-*-sco5v6*)
7247 # Causes problems with __ctype
7248 test X-lc = "X$arg" && continue
7250 *-*-sysv4.2uw2* | *-*-sysv5* | *-*-unixware* | *-*-OpenUNIX*)
7251 # Compiler inserts libc in the correct place for threads to work
7252 test X-lc = "X$arg" && continue
7255 elif test X-lc_r = "X$arg"; then
7257 *-*-openbsd* | *-*-freebsd* | *-*-dragonfly* | *-*-bitrig*)
7258 # Do not include libc_r directly, use -pthread flag.
7263 func_append deplibs " $arg"
7277 # Tru64 UNIX uses -model [arg] to determine the layout of C++
7278 # classes, name mangling, and exception handling.
7279 # Darwin uses the -arch flag to determine output architecture.
7280 -model|-arch|-isysroot|--sysroot)
7281 func_append compiler_flags " $arg"
7282 func_append compile_command " $arg"
7283 func_append finalize_command " $arg"
7288 -mt|-mthreads|-kthread|-Kthread|-pthread|-pthreads|--thread-safe \
7289 |-threads|-fopenmp|-openmp|-mp|-xopenmp|-omp|-qsmp=*)
7290 func_append compiler_flags " $arg"
7291 func_append compile_command " $arg"
7292 func_append finalize_command " $arg"
7293 case "$new_inherited_linker_flags " in
7295 * ) func_append new_inherited_linker_flags " $arg" ;;
7301 single_module=$wl-multi_module
7312 *-*-cygwin* | *-*-mingw* | *-*-pw32* | *-*-os2* | *-*-darwin* | *-cegcc*)
7313 # The PATH hackery in wrapper scripts is required on Windows
7314 # and Darwin in order for the loader to find any dlls it needs.
7315 func_warning "'-no-install' is ignored for $host"
7316 func_warning "assuming '-no-fast-install' instead"
7319 *) no_install=yes ;;
7341 -precious-files-regex)
7362 func_stripname '-R' '' "$arg"
7363 dir=$func_stripname_result
7364 # We need an absolute path.
7366 [\\/]* | [A-Za-z]:[\\/]*) ;;
7368 func_stripname '=' '' "$dir"
7369 dir=$lt_sysroot$func_stripname_result
7372 func_fatal_error "only absolute run-paths are allowed"
7377 *) func_append xrpath " $dir" ;;
7383 # The effects of -shared are defined in a previous loop.
7392 -static | -static-libtool-libs)
7393 # The effects of -static are defined in a previous loop.
7394 # We used to do the same as -all-static on platforms that
7395 # didn't have a PIC flag, but the assumption that the effects
7396 # would be equivalent was wrong. It would break on at least
7397 # Digital Unix and AIX.
7423 func_stripname '-Wc,' '' "$arg"
7424 args=$func_stripname_result
7426 save_ifs=$IFS; IFS=,
7427 for flag in $args; do
7429 func_quote_arg pretty "$flag"
7430 func_append arg " $func_quote_arg_result"
7431 func_append compiler_flags " $func_quote_arg_result"
7434 func_stripname ' ' '' "$arg"
7435 arg=$func_stripname_result
7439 func_stripname '-Wl,' '' "$arg"
7440 args=$func_stripname_result
7442 save_ifs=$IFS; IFS=,
7443 for flag in $args; do
7445 func_quote_arg pretty "$flag"
7446 func_append arg " $wl$func_quote_arg_result"
7447 func_append compiler_flags " $wl$func_quote_arg_result"
7448 func_append linker_flags " $func_quote_arg_result"
7451 func_stripname ' ' '' "$arg"
7452 arg=$func_stripname_result
7472 func_quote_arg pretty "$arg"
7473 arg=$func_quote_arg_result
7476 # Flags to be passed through unchanged, with rationale:
7477 # -64, -mips[0-9] enable 64-bit mode for the SGI compiler
7478 # -r[0-9][0-9]* specify processor for the SGI compiler
7479 # -xarch=*, -xtarget=* enable 64-bit mode for the Sun compiler
7480 # +DA*, +DD* enable 64-bit mode for the HP compiler
7481 # -q* compiler args for the IBM compiler
7482 # -m*, -t[45]*, -txscale* architecture-specific flags for GCC
7483 # -F/path path to uninstalled frameworks, gcc on darwin
7484 # -p, -pg, --coverage, -fprofile-* profiling flags for GCC
7485 # -fstack-protector* stack protector flags for GCC
7486 # @file GCC response files
7487 # -tp=* Portland pgcc target processor selection
7488 # --sysroot=* for sysroot support
7489 # -O*, -g*, -flto*, -fwhopr*, -fuse-linker-plugin GCC link-time optimization
7490 # -specs=* GCC specs files
7491 # -stdlib=* select c++ std lib with clang
7492 # -fsanitize=* Clang/GCC memory and address sanitizer
7493 # -fuse-ld=* Linker select flags for GCC
7494 -64|-mips[0-9]|-r[0-9][0-9]*|-xarch=*|-xtarget=*|+DA*|+DD*|-q*|-m*| \
7495 -t[45]*|-txscale*|-p|-pg|--coverage|-fprofile-*|-F*|@*|-tp=*|--sysroot=*| \
7496 -O*|-g*|-flto*|-fwhopr*|-fuse-linker-plugin|-fstack-protector*|-stdlib=*| \
7497 -specs=*|-fsanitize=*|-fuse-ld=*)
7498 func_quote_arg pretty "$arg"
7499 arg=$func_quote_arg_result
7500 func_append compile_command " $arg"
7501 func_append finalize_command " $arg"
7502 func_append compiler_flags " $arg"
7507 if test os2 = "`expr $host : '.*\(os2\)'`"; then
7508 # OS/2 uses -Zxxx to specify OS/2-specific options
7509 compiler_flags="$compiler_flags $arg"
7510 func_append compile_command " $arg"
7511 func_append finalize_command " $arg"
7519 # Otherwise treat like 'Some other compiler flag' below
7520 func_quote_arg pretty "$arg"
7521 arg=$func_quote_arg_result
7525 # Some other compiler flag.
7527 func_quote_arg pretty "$arg"
7528 arg=$func_quote_arg_result
7532 # A standard object.
7533 func_append objs " $arg"
7537 # A libtool-controlled object.
7539 # Check to see that this really is a libtool object.
7540 if func_lalib_unsafe_p "$arg"; then
7547 if test -z "$pic_object" ||
7548 test -z "$non_pic_object" ||
7549 test none = "$pic_object" &&
7550 test none = "$non_pic_object"; then
7551 func_fatal_error "cannot find name of object for '$arg'"
7554 # Extract subdirectory from the argument.
7555 func_dirname "$arg" "/" ""
7556 xdir=$func_dirname_result
7558 test none = "$pic_object" || {
7559 # Prepend the subdirectory the object is found in.
7560 pic_object=$xdir$pic_object
7562 if test dlfiles = "$prev"; then
7563 if test yes = "$build_libtool_libs" && test yes = "$dlopen_support"; then
7564 func_append dlfiles " $pic_object"
7568 # If libtool objects are unsupported, then we need to preload.
7573 # CHECK ME: I think I busted this. -Ossama
7574 if test dlprefiles = "$prev"; then
7575 # Preload the old-style object.
7576 func_append dlprefiles " $pic_object"
7581 func_append libobjs " $pic_object"
7586 if test none != "$non_pic_object"; then
7587 # Prepend the subdirectory the object is found in.
7588 non_pic_object=$xdir$non_pic_object
7590 # A standard non-PIC object
7591 func_append non_pic_objects " $non_pic_object"
7592 if test -z "$pic_object" || test none = "$pic_object"; then
7596 # If the PIC object exists, use it instead.
7597 # $xdir was prepended to $pic_object above.
7598 non_pic_object=$pic_object
7599 func_append non_pic_objects " $non_pic_object"
7602 # Only an error if not doing a dry-run.
7603 if $opt_dry_run; then
7604 # Extract subdirectory from the argument.
7605 func_dirname "$arg" "/" ""
7606 xdir=$func_dirname_result
7609 pic_object=$xdir$objdir/$func_lo2o_result
7610 non_pic_object=$xdir$func_lo2o_result
7611 func_append libobjs " $pic_object"
7612 func_append non_pic_objects " $non_pic_object"
7614 func_fatal_error "'$arg' is not a valid libtool object"
7621 func_append deplibs " $arg"
7622 func_append old_deplibs " $arg"
7627 # A libtool-controlled library.
7629 func_resolve_sysroot "$arg"
7630 if test dlfiles = "$prev"; then
7631 # This library was specified with -dlopen.
7632 func_append dlfiles " $func_resolve_sysroot_result"
7634 elif test dlprefiles = "$prev"; then
7635 # The library was specified with -dlpreopen.
7636 func_append dlprefiles " $func_resolve_sysroot_result"
7639 func_append deplibs " $func_resolve_sysroot_result"
7644 # Some other compiler argument.
7646 # Unknown arguments in both finalize_command and compile_command need
7647 # to be aesthetically quoted because they are evaled later.
7648 func_quote_arg pretty "$arg"
7649 arg=$func_quote_arg_result
7653 # Now actually substitute the argument into the commands.
7654 if test -n "$arg"; then
7655 func_append compile_command " $arg"
7656 func_append finalize_command " $arg"
7658 done # argument parsing loop
7660 test -n "$prev" && \
7661 func_fatal_help "the '$prevarg' option requires an argument"
7663 if test yes = "$export_dynamic" && test -n "$export_dynamic_flag_spec"; then
7664 eval arg=\"$export_dynamic_flag_spec\"
7665 func_append compile_command " $arg"
7666 func_append finalize_command " $arg"
7670 # calculate the name of the file, without its directory
7671 func_basename "$output"
7672 outputname=$func_basename_result
7673 libobjs_save=$libobjs
7675 if test -n "$shlibpath_var"; then
7676 # get the directories listed in $shlibpath_var
7677 eval shlib_search_path=\`\$ECHO \"\$$shlibpath_var\" \| \$SED \'s/:/ /g\'\`
7681 eval sys_lib_search_path=\"$sys_lib_search_path_spec\"
7682 eval sys_lib_dlsearch_path=\"$sys_lib_dlsearch_path_spec\"
7684 # Definition is injected by LT_CONFIG during libtool generation.
7685 func_munge_path_list sys_lib_dlsearch_path "$LT_SYS_LIBRARY_PATH"
7687 func_dirname "$output" "/" ""
7688 output_objdir=$func_dirname_result$objdir
7689 func_to_tool_file "$output_objdir/"
7690 tool_output_objdir=$func_to_tool_file_result
7691 # Create the object directory.
7692 func_mkdir_p "$output_objdir"
7694 # Determine the type of output
7697 func_fatal_help "you must specify an output file"
7699 *.$libext) linkmode=oldlib ;;
7700 *.lo | *.$objext) linkmode=obj ;;
7701 *.la) linkmode=lib ;;
7702 *) linkmode=prog ;; # Anything else should be a program.
7708 # Find all interdependent deplibs by searching for libraries
7709 # that are linked more than once (e.g. -la -lb -la)
7710 for deplib in $deplibs; do
7711 if $opt_preserve_dup_deps; then
7713 *" $deplib "*) func_append specialdeplibs " $deplib" ;;
7716 func_append libs " $deplib"
7719 if test lib = "$linkmode"; then
7720 libs="$predeps $libs $compiler_lib_search_path $postdeps"
7722 # Compute libraries that are listed more than once in $predeps
7723 # $postdeps and mark them as special (i.e., whose duplicates are
7724 # not to be eliminated).
7726 if $opt_duplicate_compiler_generated_deps; then
7727 for pre_post_dep in $predeps $postdeps; do
7728 case "$pre_post_deps " in
7729 *" $pre_post_dep "*) func_append specialdeplibs " $pre_post_deps" ;;
7731 func_append pre_post_deps " $pre_post_dep"
7740 need_relink=no # whether we're linking any uninstalled libtool libraries
7741 notinst_deplibs= # not-installed libtool libraries
7742 notinst_path= # paths that contain not-installed libtool libraries
7746 passes="conv dlpreopen link"
7747 for file in $dlfiles $dlprefiles; do
7751 func_fatal_help "libraries can '-dlopen' only libtool libraries: $file"
7762 passes="conv scan dlopen dlpreopen link"
7768 for pass in $passes; do
7769 # The preopen pass in lib mode reverses $deplibs; put it back here
7770 # so that -L comes before libs that need it for instance...
7771 if test lib,link = "$linkmode,$pass"; then
7772 ## FIXME: Find the place where the list is rebuilt in the wrong
7773 ## order, and fix it there properly
7775 for deplib in $deplibs; do
7776 tmp_deplibs="$deplib $tmp_deplibs"
7778 deplibs=$tmp_deplibs
7781 if test lib,link = "$linkmode,$pass" ||
7782 test prog,scan = "$linkmode,$pass"; then
7786 if test prog = "$linkmode"; then
7788 dlopen) libs=$dlfiles ;;
7789 dlpreopen) libs=$dlprefiles ;;
7790 link) libs="$deplibs %DEPLIBS% $dependency_libs" ;;
7793 if test lib,dlpreopen = "$linkmode,$pass"; then
7794 # Collect and forward deplibs of preopened libtool libs
7795 for lib in $dlprefiles; do
7796 # Ignore non-libtool-libs
7798 func_resolve_sysroot "$lib"
7800 *.la) func_source "$func_resolve_sysroot_result" ;;
7803 # Collect preopened libtool deplibs, except any this library
7804 # has declared as weak libs
7805 for deplib in $dependency_libs; do
7806 func_basename "$deplib"
7807 deplib_base=$func_basename_result
7808 case " $weak_libs " in
7809 *" $deplib_base "*) ;;
7810 *) func_append deplibs " $deplib" ;;
7816 if test dlopen = "$pass"; then
7817 # Collect dlpreopened libraries
7818 save_deplibs=$deplibs
7822 for deplib in $libs; do
7826 -mt|-mthreads|-kthread|-Kthread|-pthread|-pthreads|--thread-safe \
7827 |-threads|-fopenmp|-openmp|-mp|-xopenmp|-omp|-qsmp=*)
7828 if test prog,link = "$linkmode,$pass"; then
7829 compile_deplibs="$deplib $compile_deplibs"
7830 finalize_deplibs="$deplib $finalize_deplibs"
7832 func_append compiler_flags " $deplib"
7833 if test lib = "$linkmode"; then
7834 case "$new_inherited_linker_flags " in
7836 * ) func_append new_inherited_linker_flags " $deplib" ;;
7843 if test lib != "$linkmode" && test prog != "$linkmode"; then
7844 func_warning "'-l' is ignored for archives/objects"
7847 func_stripname '-l' '' "$deplib"
7848 name=$func_stripname_result
7849 if test lib = "$linkmode"; then
7850 searchdirs="$newlib_search_path $lib_search_path $compiler_lib_search_dirs $sys_lib_search_path $shlib_search_path"
7852 searchdirs="$newlib_search_path $lib_search_path $sys_lib_search_path $shlib_search_path"
7854 for searchdir in $searchdirs; do
7855 for search_ext in .la $std_shrext .so .a; do
7856 # Search the libtool library
7857 lib=$searchdir/lib$name$search_ext
7858 if test -f "$lib"; then
7859 if test .la = "$search_ext"; then
7869 # deplib is a libtool library
7870 # If $allow_libtool_libs_with_static_runtimes && $deplib is a stdlib,
7871 # We need to do some special things here, and not later.
7872 if test yes = "$allow_libtool_libs_with_static_runtimes"; then
7873 case " $predeps $postdeps " in
7875 if func_lalib_p "$lib"; then
7879 for l in $old_library $library_names; do
7882 if test "X$ll" = "X$old_library"; then # only static version available
7884 func_dirname "$lib" "" "."
7885 ladir=$func_dirname_result
7886 lib=$ladir/$old_library
7887 if test prog,link = "$linkmode,$pass"; then
7888 compile_deplibs="$deplib $compile_deplibs"
7889 finalize_deplibs="$deplib $finalize_deplibs"
7891 deplibs="$deplib $deplibs"
7892 test lib = "$linkmode" && newdependency_libs="$deplib $newdependency_libs"
7902 # deplib doesn't seem to be a libtool library
7903 if test prog,link = "$linkmode,$pass"; then
7904 compile_deplibs="$deplib $compile_deplibs"
7905 finalize_deplibs="$deplib $finalize_deplibs"
7907 deplibs="$deplib $deplibs"
7908 test lib = "$linkmode" && newdependency_libs="$deplib $newdependency_libs"
7914 if test prog,link = "$linkmode,$pass"; then
7915 compile_deplibs="$deplib $compile_deplibs"
7916 finalize_deplibs="$deplib $finalize_deplibs"
7918 deplibs="$deplib $deplibs"
7919 if test lib = "$linkmode"; then
7920 case "$new_inherited_linker_flags " in
7922 * ) func_append new_inherited_linker_flags " $deplib" ;;
7931 deplibs="$deplib $deplibs"
7932 test conv = "$pass" && continue
7933 newdependency_libs="$deplib $newdependency_libs"
7934 func_stripname '-L' '' "$deplib"
7935 func_resolve_sysroot "$func_stripname_result"
7936 func_append newlib_search_path " $func_resolve_sysroot_result"
7939 if test conv = "$pass"; then
7940 deplibs="$deplib $deplibs"
7943 if test scan = "$pass"; then
7944 deplibs="$deplib $deplibs"
7946 compile_deplibs="$deplib $compile_deplibs"
7947 finalize_deplibs="$deplib $finalize_deplibs"
7949 func_stripname '-L' '' "$deplib"
7950 func_resolve_sysroot "$func_stripname_result"
7951 func_append newlib_search_path " $func_resolve_sysroot_result"
7954 func_warning "'-L' is ignored for archives/objects"
7960 if test link = "$pass"; then
7961 func_stripname '-R' '' "$deplib"
7962 func_resolve_sysroot "$func_stripname_result"
7963 dir=$func_resolve_sysroot_result
7964 # Make sure the xrpath contains only unique directories.
7967 *) func_append xrpath " $dir" ;;
7970 deplibs="$deplib $deplibs"
7974 func_resolve_sysroot "$deplib"
7975 lib=$func_resolve_sysroot_result
7978 if test conv = "$pass"; then
7979 deplibs="$deplib $deplibs"
7984 # Linking convenience modules into shared libraries is allowed,
7985 # but linking other static libraries is non-portable.
7986 case " $dlpreconveniencelibs " in
7990 case $deplibs_check_method in
7992 set dummy $deplibs_check_method; shift
7993 match_pattern_regex=`expr "$deplibs_check_method" : "$1 \(.*\)"`
7994 if eval "\$ECHO \"$deplib\"" 2>/dev/null | $SED 10q \
7995 | $EGREP "$match_pattern_regex" > /dev/null; then
8003 if $valid_a_lib; then
8005 $ECHO "*** Warning: Linking the shared library $output against the"
8006 $ECHO "*** static library $deplib is not portable!"
8007 deplibs="$deplib $deplibs"
8010 $ECHO "*** Warning: Trying to link with static lib archive $deplib."
8011 echo "*** I have the capability to make that library automatically link in when"
8012 echo "*** you link to this library. But I can only do this if you have a"
8013 echo "*** shared version of the library, which you do not appear to have"
8014 echo "*** because the file extensions .$libext of this argument makes me believe"
8015 echo "*** that it is just a static archive that I should not use here."
8022 if test link != "$pass"; then
8023 deplibs="$deplib $deplibs"
8025 compile_deplibs="$deplib $compile_deplibs"
8026 finalize_deplibs="$deplib $finalize_deplibs"
8033 if test conv = "$pass"; then
8034 deplibs="$deplib $deplibs"
8035 elif test prog = "$linkmode"; then
8036 if test dlpreopen = "$pass" || test yes != "$dlopen_support" || test no = "$build_libtool_libs"; then
8037 # If there is no dlopen support or we're linking statically,
8038 # we need to preload.
8039 func_append newdlprefiles " $deplib"
8040 compile_deplibs="$deplib $compile_deplibs"
8041 finalize_deplibs="$deplib $finalize_deplibs"
8043 func_append newdlfiles " $deplib"
8054 $found || test -f "$lib" \
8055 || func_fatal_error "cannot find the library '$lib' or unhandled argument '$deplib'"
8057 # Check to see that this really is a libtool archive.
8058 func_lalib_unsafe_p "$lib" \
8059 || func_fatal_error "'$lib' is not a valid libtool archive"
8061 func_dirname "$lib" "" "."
8062 ladir=$func_dirname_result
8070 inherited_linker_flags=
8071 # If the library was installed with an old release of libtool,
8072 # it will not redefine variables installed, or shouldnotlink
8081 # Convert "-framework foo" to "foo.ltframework"
8082 if test -n "$inherited_linker_flags"; then
8083 tmp_inherited_linker_flags=`$ECHO "$inherited_linker_flags" | $SED 's/-framework \([^ $]*\)/\1.ltframework/g'`
8084 for tmp_inherited_linker_flag in $tmp_inherited_linker_flags; do
8085 case " $new_inherited_linker_flags " in
8086 *" $tmp_inherited_linker_flag "*) ;;
8087 *) func_append new_inherited_linker_flags " $tmp_inherited_linker_flag";;
8091 dependency_libs=`$ECHO " $dependency_libs" | $SED 's% \([^ $]*\).ltframework% -framework \1%g'`
8092 if test lib,link = "$linkmode,$pass" ||
8093 test prog,scan = "$linkmode,$pass" ||
8094 { test prog != "$linkmode" && test lib != "$linkmode"; }; then
8095 test -n "$dlopen" && func_append dlfiles " $dlopen"
8096 test -n "$dlpreopen" && func_append dlprefiles " $dlpreopen"
8099 if test conv = "$pass"; then
8100 # Only check for convenience libraries
8101 deplibs="$lib $deplibs"
8102 if test -z "$libdir"; then
8103 if test -z "$old_library"; then
8104 func_fatal_error "cannot find name of link library for '$lib'"
8106 # It is a libtool convenience library, so add in its objects.
8107 func_append convenience " $ladir/$objdir/$old_library"
8108 func_append old_convenience " $ladir/$objdir/$old_library"
8109 elif test prog != "$linkmode" && test lib != "$linkmode"; then
8110 func_fatal_error "'$lib' is not a convenience library"
8113 for deplib in $dependency_libs; do
8114 deplibs="$deplib $deplibs"
8115 if $opt_preserve_dup_deps; then
8116 case "$tmp_libs " in
8117 *" $deplib "*) func_append specialdeplibs " $deplib" ;;
8120 func_append tmp_libs " $deplib"
8126 # Get the name of the library we link against.
8128 if test -n "$old_library" &&
8129 { test yes = "$prefer_static_libs" ||
8130 test built,no = "$prefer_static_libs,$installed"; }; then
8131 linklib=$old_library
8133 for l in $old_library $library_names; do
8137 if test -z "$linklib"; then
8138 func_fatal_error "cannot find name of link library for '$lib'"
8141 # This library was specified with -dlopen.
8142 if test dlopen = "$pass"; then
8144 && func_fatal_error "cannot -dlopen a convenience library: '$lib'"
8145 if test -z "$dlname" ||
8146 test yes != "$dlopen_support" ||
8147 test no = "$build_libtool_libs"
8149 # If there is no dlname, no dlopen support or we're linking
8150 # statically, we need to preload. We also need to preload any
8151 # dependent libraries so libltdl's deplib preloader doesn't
8152 # bomb out in the load deplibs phase.
8153 func_append dlprefiles " $lib $dependency_libs"
8155 func_append newdlfiles " $lib"
8160 # We need an absolute path.
8162 [\\/]* | [A-Za-z]:[\\/]*) abs_ladir=$ladir ;;
8164 abs_ladir=`cd "$ladir" && pwd`
8165 if test -z "$abs_ladir"; then
8166 func_warning "cannot determine absolute directory name of '$ladir'"
8167 func_warning "passing it literally to the linker, although it might fail"
8172 func_basename "$lib"
8173 laname=$func_basename_result
8175 # Find the relevant object directory and library name.
8176 if test yes = "$installed"; then
8177 if test ! -f "$lt_sysroot$libdir/$linklib" && test -f "$abs_ladir/$linklib"; then
8178 func_warning "library '$lib' was moved."
8183 dir=$lt_sysroot$libdir
8184 absdir=$lt_sysroot$libdir
8186 test yes = "$hardcode_automatic" && avoidtemprpath=yes
8188 if test ! -f "$ladir/$objdir/$linklib" && test -f "$abs_ladir/$linklib"; then
8191 # Remove this search path later
8192 func_append notinst_path " $abs_ladir"
8195 absdir=$abs_ladir/$objdir
8196 # Remove this search path later
8197 func_append notinst_path " $abs_ladir"
8199 fi # $installed = yes
8200 func_stripname 'lib' '.la' "$laname"
8201 name=$func_stripname_result
8203 # This library was specified with -dlpreopen.
8204 if test dlpreopen = "$pass"; then
8205 if test -z "$libdir" && test prog = "$linkmode"; then
8206 func_fatal_error "only libraries may -dlpreopen a convenience library: '$lib'"
8209 # special handling for platforms with PE-DLLs.
8210 *cygwin* | *mingw* | *cegcc* )
8211 # Linker will automatically link against shared library if both
8212 # static and shared are present. Therefore, ensure we extract
8213 # symbols from the import library if a shared library is present
8214 # (otherwise, the dlopen module name will be incorrect). We do
8215 # this by putting the import library name into $newdlprefiles.
8216 # We recover the dlopen module name by 'saving' the la file
8217 # name in a special purpose variable, and (later) extracting the
8218 # dlname from the la file.
8219 if test -n "$dlname"; then
8220 func_tr_sh "$dir/$linklib"
8221 eval "libfile_$func_tr_sh_result=\$abs_ladir/\$laname"
8222 func_append newdlprefiles " $dir/$linklib"
8224 func_append newdlprefiles " $dir/$old_library"
8225 # Keep a list of preopened convenience libraries to check
8226 # that they are being used correctly in the link pass.
8227 test -z "$libdir" && \
8228 func_append dlpreconveniencelibs " $dir/$old_library"
8232 # Prefer using a static library (so that no silly _DYNAMIC symbols
8233 # are required to link).
8234 if test -n "$old_library"; then
8235 func_append newdlprefiles " $dir/$old_library"
8236 # Keep a list of preopened convenience libraries to check
8237 # that they are being used correctly in the link pass.
8238 test -z "$libdir" && \
8239 func_append dlpreconveniencelibs " $dir/$old_library"
8240 # Otherwise, use the dlname, so that lt_dlopen finds it.
8241 elif test -n "$dlname"; then
8242 func_append newdlprefiles " $dir/$dlname"
8244 func_append newdlprefiles " $dir/$linklib"
8248 fi # $pass = dlpreopen
8250 if test -z "$libdir"; then
8251 # Link the convenience library
8252 if test lib = "$linkmode"; then
8253 deplibs="$dir/$old_library $deplibs"
8254 elif test prog,link = "$linkmode,$pass"; then
8255 compile_deplibs="$dir/$old_library $compile_deplibs"
8256 finalize_deplibs="$dir/$old_library $finalize_deplibs"
8258 deplibs="$lib $deplibs" # used for prog,scan pass
8264 if test prog = "$linkmode" && test link != "$pass"; then
8265 func_append newlib_search_path " $ladir"
8266 deplibs="$lib $deplibs"
8268 linkalldeplibs=false
8269 if test no != "$link_all_deplibs" || test -z "$library_names" ||
8270 test no = "$build_libtool_libs"; then
8275 for deplib in $dependency_libs; do
8277 -L*) func_stripname '-L' '' "$deplib"
8278 func_resolve_sysroot "$func_stripname_result"
8279 func_append newlib_search_path " $func_resolve_sysroot_result"
8282 # Need to link against all dependency_libs?
8283 if $linkalldeplibs; then
8284 deplibs="$deplib $deplibs"
8286 # Need to hardcode shared library paths
8287 # or/and link against static libraries
8288 newdependency_libs="$deplib $newdependency_libs"
8290 if $opt_preserve_dup_deps; then
8291 case "$tmp_libs " in
8292 *" $deplib "*) func_append specialdeplibs " $deplib" ;;
8295 func_append tmp_libs " $deplib"
8298 fi # $linkmode = prog...
8300 if test prog,link = "$linkmode,$pass"; then
8301 if test -n "$library_names" &&
8302 { { test no = "$prefer_static_libs" ||
8303 test built,yes = "$prefer_static_libs,$installed"; } ||
8304 test -z "$old_library"; }; then
8305 # We need to hardcode the library path
8306 if test -n "$shlibpath_var" && test -z "$avoidtemprpath"; then
8307 # Make sure the rpath contains only unique directories.
8308 case $temp_rpath: in
8310 *) func_append temp_rpath "$absdir:" ;;
8314 # Hardcode the library path.
8315 # Skip directories that are in the system default run-time
8317 case " $sys_lib_dlsearch_path " in
8320 case "$compile_rpath " in
8322 *) func_append compile_rpath " $absdir" ;;
8326 case " $sys_lib_dlsearch_path " in
8329 case "$finalize_rpath " in
8331 *) func_append finalize_rpath " $libdir" ;;
8335 fi # $linkmode,$pass = prog,link...
8338 { test pass_all = "$deplibs_check_method" ||
8339 { test yes = "$build_libtool_libs" &&
8340 test -n "$library_names"; }; }; then
8341 # We only need to search for static libraries
8346 link_static=no # Whether the deplib will be linked statically
8347 use_static_libs=$prefer_static_libs
8348 if test built = "$use_static_libs" && test yes = "$installed"; then
8351 if test -n "$library_names" &&
8352 { test no = "$use_static_libs" || test -z "$old_library"; }; then
8354 *cygwin* | *mingw* | *cegcc* | *os2*)
8355 # No point in relinking DLLs because paths are not encoded
8356 func_append notinst_deplibs " $lib"
8360 if test no = "$installed"; then
8361 func_append notinst_deplibs " $lib"
8366 # This is a shared library
8368 # Warn about portability, can't link against -module's on some
8369 # systems (darwin). Don't bleat about dlopened modules though!
8371 for dlpremoduletest in $dlprefiles; do
8372 if test "X$dlpremoduletest" = "X$lib"; then
8373 dlopenmodule=$dlpremoduletest
8377 if test -z "$dlopenmodule" && test yes = "$shouldnotlink" && test link = "$pass"; then
8379 if test prog = "$linkmode"; then
8380 $ECHO "*** Warning: Linking the executable $output against the loadable module"
8382 $ECHO "*** Warning: Linking the shared library $output against the loadable module"
8384 $ECHO "*** $linklib is not portable!"
8386 if test lib = "$linkmode" &&
8387 test yes = "$hardcode_into_libs"; then
8388 # Hardcode the library path.
8389 # Skip directories that are in the system default run-time
8391 case " $sys_lib_dlsearch_path " in
8394 case "$compile_rpath " in
8396 *) func_append compile_rpath " $absdir" ;;
8400 case " $sys_lib_dlsearch_path " in
8403 case "$finalize_rpath " in
8405 *) func_append finalize_rpath " $libdir" ;;
8411 if test -n "$old_archive_from_expsyms_cmds"; then
8412 # figure out the soname
8413 set dummy $library_names
8417 libname=`eval "\\$ECHO \"$libname_spec\""`
8418 # use dlname if we got it. it's perfectly good, no?
8419 if test -n "$dlname"; then
8421 elif test -n "$soname_spec"; then
8424 *cygwin* | mingw* | *cegcc* | *os2*)
8425 func_arith $current - $age
8426 major=$func_arith_result
8430 eval soname=\"$soname_spec\"
8435 # Make a new name for the extract_expsyms_cmds to use
8437 func_basename "$soroot"
8438 soname=$func_basename_result
8439 func_stripname 'lib' '.dll' "$soname"
8440 newlib=libimp-$func_stripname_result.a
8442 # If the library has no export list, then create one now
8443 if test -f "$output_objdir/$soname-def"; then :
8445 func_verbose "extracting exported symbol list from '$soname'"
8446 func_execute_cmds "$extract_expsyms_cmds" 'exit $?'
8450 if test -f "$output_objdir/$newlib"; then :; else
8451 func_verbose "generating import library for '$soname'"
8452 func_execute_cmds "$old_archive_from_expsyms_cmds" 'exit $?'
8454 # make sure the library variables are pointing to the new library
8457 fi # test -n "$old_archive_from_expsyms_cmds"
8459 if test prog = "$linkmode" || test relink != "$opt_mode"; then
8464 case $hardcode_action in
8465 immediate | unsupported)
8466 if test no = "$hardcode_direct"; then
8469 *-*-sco3.2v5.0.[024]*) add_dir=-L$dir ;;
8470 *-*-sysv4*uw2*) add_dir=-L$dir ;;
8471 *-*-sysv5OpenUNIX* | *-*-sysv5UnixWare7.[01].[10]* | \
8472 *-*-unixware7*) add_dir=-L$dir ;;
8474 # if the lib is a (non-dlopened) module then we cannot
8475 # link against it, someone is ignoring the earlier warnings
8476 if /usr/bin/file -L $add 2> /dev/null |
8477 $GREP ": [^:]* bundle" >/dev/null; then
8478 if test "X$dlopenmodule" != "X$lib"; then
8479 $ECHO "*** Warning: lib $linklib is a module, not a shared library"
8480 if test -z "$old_library"; then
8482 echo "*** And there doesn't seem to be a static archive available"
8483 echo "*** The link will probably fail, sorry"
8485 add=$dir/$old_library
8487 elif test -n "$old_library"; then
8488 add=$dir/$old_library
8492 elif test no = "$hardcode_minus_L"; then
8494 *-*-sunos*) add_shlibpath=$dir ;;
8498 elif test no = "$hardcode_shlibpath_var"; then
8506 if test yes = "$hardcode_direct" &&
8507 test no = "$hardcode_direct_absolute"; then
8509 elif test yes = "$hardcode_minus_L"; then
8511 # Try looking first in the location we're being installed to.
8512 if test -n "$inst_prefix_dir"; then
8515 func_append add_dir " -L$inst_prefix_dir$libdir"
8520 elif test yes = "$hardcode_shlibpath_var"; then
8530 if test yes != "$lib_linked"; then
8531 func_fatal_configuration "unsupported hardcode properties"
8534 if test -n "$add_shlibpath"; then
8535 case :$compile_shlibpath: in
8536 *":$add_shlibpath:"*) ;;
8537 *) func_append compile_shlibpath "$add_shlibpath:" ;;
8540 if test prog = "$linkmode"; then
8541 test -n "$add_dir" && compile_deplibs="$add_dir $compile_deplibs"
8542 test -n "$add" && compile_deplibs="$add $compile_deplibs"
8544 test -n "$add_dir" && deplibs="$add_dir $deplibs"
8545 test -n "$add" && deplibs="$add $deplibs"
8546 if test yes != "$hardcode_direct" &&
8547 test yes != "$hardcode_minus_L" &&
8548 test yes = "$hardcode_shlibpath_var"; then
8549 case :$finalize_shlibpath: in
8551 *) func_append finalize_shlibpath "$libdir:" ;;
8557 if test prog = "$linkmode" || test relink = "$opt_mode"; then
8561 # Finalize command for both is simple: just hardcode it.
8562 if test yes = "$hardcode_direct" &&
8563 test no = "$hardcode_direct_absolute"; then
8564 add=$libdir/$linklib
8565 elif test yes = "$hardcode_minus_L"; then
8568 elif test yes = "$hardcode_shlibpath_var"; then
8569 case :$finalize_shlibpath: in
8571 *) func_append finalize_shlibpath "$libdir:" ;;
8574 elif test yes = "$hardcode_automatic"; then
8575 if test -n "$inst_prefix_dir" &&
8576 test -f "$inst_prefix_dir$libdir/$linklib"; then
8577 add=$inst_prefix_dir$libdir/$linklib
8579 add=$libdir/$linklib
8582 # We cannot seem to hardcode it, guess we'll fake it.
8584 # Try looking first in the location we're being installed to.
8585 if test -n "$inst_prefix_dir"; then
8588 func_append add_dir " -L$inst_prefix_dir$libdir"
8595 if test prog = "$linkmode"; then
8596 test -n "$add_dir" && finalize_deplibs="$add_dir $finalize_deplibs"
8597 test -n "$add" && finalize_deplibs="$add $finalize_deplibs"
8599 test -n "$add_dir" && deplibs="$add_dir $deplibs"
8600 test -n "$add" && deplibs="$add $deplibs"
8603 elif test prog = "$linkmode"; then
8604 # Here we assume that one of hardcode_direct or hardcode_minus_L
8605 # is not unsupported. This is valid on all known static and
8607 if test unsupported != "$hardcode_direct"; then
8608 test -n "$old_library" && linklib=$old_library
8609 compile_deplibs="$dir/$linklib $compile_deplibs"
8610 finalize_deplibs="$dir/$linklib $finalize_deplibs"
8612 compile_deplibs="-l$name -L$dir $compile_deplibs"
8613 finalize_deplibs="-l$name -L$dir $finalize_deplibs"
8615 elif test yes = "$build_libtool_libs"; then
8616 # Not a shared library
8617 if test pass_all != "$deplibs_check_method"; then
8618 # We're trying link a shared library against a static one
8619 # but the system doesn't support it.
8621 # Just print a warning and add the library to dependency_libs so
8622 # that the program can be linked against the static library.
8624 $ECHO "*** Warning: This system cannot link to static lib archive $lib."
8625 echo "*** I have the capability to make that library automatically link in when"
8626 echo "*** you link to this library. But I can only do this if you have a"
8627 echo "*** shared version of the library, which you do not appear to have."
8628 if test yes = "$module"; then
8629 echo "*** But as you try to build a module library, libtool will still create "
8630 echo "*** a static module, that should work as long as the dlopening application"
8631 echo "*** is linked with the -dlopen flag to resolve symbols at runtime."
8632 if test -z "$global_symbol_pipe"; then
8634 echo "*** However, this would only work if libtool was able to extract symbol"
8635 echo "*** lists from a program, using 'nm' or equivalent, but libtool could"
8636 echo "*** not find such a program. So, this module is probably useless."
8637 echo "*** 'nm' from GNU binutils and a full rebuild may help."
8639 if test no = "$build_old_libs"; then
8640 build_libtool_libs=module
8643 build_libtool_libs=no
8647 deplibs="$dir/$old_library $deplibs"
8650 fi # link shared/static library?
8652 if test lib = "$linkmode"; then
8653 if test -n "$dependency_libs" &&
8654 { test yes != "$hardcode_into_libs" ||
8655 test yes = "$build_old_libs" ||
8656 test yes = "$link_static"; }; then
8657 # Extract -R from dependency_libs
8659 for libdir in $dependency_libs; do
8661 -R*) func_stripname '-R' '' "$libdir"
8662 temp_xrpath=$func_stripname_result
8664 *" $temp_xrpath "*) ;;
8665 *) func_append xrpath " $temp_xrpath";;
8667 *) func_append temp_deplibs " $libdir";;
8670 dependency_libs=$temp_deplibs
8673 func_append newlib_search_path " $absdir"
8674 # Link against this library
8675 test no = "$link_static" && newdependency_libs="$abs_ladir/$laname $newdependency_libs"
8676 # ... and its dependency_libs
8678 for deplib in $dependency_libs; do
8679 newdependency_libs="$deplib $newdependency_libs"
8681 -L*) func_stripname '-L' '' "$deplib"
8682 func_resolve_sysroot "$func_stripname_result";;
8683 *) func_resolve_sysroot "$deplib" ;;
8685 if $opt_preserve_dup_deps; then
8686 case "$tmp_libs " in
8687 *" $func_resolve_sysroot_result "*)
8688 func_append specialdeplibs " $func_resolve_sysroot_result" ;;
8691 func_append tmp_libs " $func_resolve_sysroot_result"
8694 if test no != "$link_all_deplibs"; then
8695 # Add the search paths of all dependency libraries
8696 for deplib in $dependency_libs; do
8699 -L*) path=$deplib ;;
8701 func_resolve_sysroot "$deplib"
8702 deplib=$func_resolve_sysroot_result
8703 func_dirname "$deplib" "" "."
8704 dir=$func_dirname_result
8705 # We need an absolute path.
8707 [\\/]* | [A-Za-z]:[\\/]*) absdir=$dir ;;
8709 absdir=`cd "$dir" && pwd`
8710 if test -z "$absdir"; then
8711 func_warning "cannot determine absolute directory name of '$dir'"
8716 if $GREP "^installed=no" $deplib > /dev/null; then
8720 eval deplibrary_names=`$SED -n -e 's/^library_names=\(.*\)$/\1/p' $deplib`
8721 if test -n "$deplibrary_names"; then
8722 for tmp in $deplibrary_names; do
8725 if test -f "$absdir/$objdir/$depdepl"; then
8726 depdepl=$absdir/$objdir/$depdepl
8727 darwin_install_name=`$OTOOL -L $depdepl | awk '{if (NR == 2) {print $1;exit}}'`
8728 if test -z "$darwin_install_name"; then
8729 darwin_install_name=`$OTOOL64 -L $depdepl | awk '{if (NR == 2) {print $1;exit}}'`
8731 func_append compiler_flags " $wl-dylib_file $wl$darwin_install_name:$depdepl"
8732 func_append linker_flags " -dylib_file $darwin_install_name:$depdepl"
8738 path=-L$absdir/$objdir
8742 eval libdir=`$SED -n -e 's/^libdir=\(.*\)$/\1/p' $deplib`
8743 test -z "$libdir" && \
8744 func_fatal_error "'$deplib' is not a valid libtool archive"
8745 test "$absdir" != "$libdir" && \
8746 func_warning "'$deplib' seems to be moved"
8752 case " $deplibs " in
8754 *) deplibs="$path $deplibs" ;;
8757 fi # link_all_deplibs != no
8759 done # for deplib in $libs
8760 if test link = "$pass"; then
8761 if test prog = "$linkmode"; then
8762 compile_deplibs="$new_inherited_linker_flags $compile_deplibs"
8763 finalize_deplibs="$new_inherited_linker_flags $finalize_deplibs"
8765 compiler_flags="$compiler_flags "`$ECHO " $new_inherited_linker_flags" | $SED 's% \([^ $]*\).ltframework% -framework \1%g'`
8768 dependency_libs=$newdependency_libs
8769 if test dlpreopen = "$pass"; then
8770 # Link the dlpreopened libraries before other libraries
8771 for deplib in $save_deplibs; do
8772 deplibs="$deplib $deplibs"
8775 if test dlopen != "$pass"; then
8776 test conv = "$pass" || {
8777 # Make sure lib_search_path contains only unique directories.
8779 for dir in $newlib_search_path; do
8780 case "$lib_search_path " in
8782 *) func_append lib_search_path " $dir" ;;
8788 if test prog,link = "$linkmode,$pass"; then
8789 vars="compile_deplibs finalize_deplibs"
8793 for var in $vars dependency_libs; do
8794 # Add libraries to $var in reverse order
8795 eval tmp_libs=\"\$$var\"
8797 for deplib in $tmp_libs; do
8798 # FIXME: Pedantically, this is the right thing to do, so
8799 # that some nasty dependency loop isn't accidentally
8801 #new_libs="$deplib $new_libs"
8802 # Pragmatically, this seems to cause very few problems in
8805 -L*) new_libs="$deplib $new_libs" ;;
8808 # And here is the reason: when a library appears more
8809 # than once as an explicit dependence of a library, or
8810 # is implicitly linked in more than once by the
8811 # compiler, it is considered special, and multiple
8812 # occurrences thereof are not removed. Compare this
8813 # with having the same library being listed as a
8814 # dependency of multiple other libraries: in this case,
8815 # we know (pedantically, we assume) the library does not
8816 # need to be listed more than once, so we keep only the
8817 # last copy. This is not always right, but it is rare
8818 # enough that we require users that really mean to play
8819 # such unportable linking tricks to link the library
8820 # using -Wl,-lname, so that libtool does not consider it
8821 # for duplicate removal.
8822 case " $specialdeplibs " in
8823 *" $deplib "*) new_libs="$deplib $new_libs" ;;
8825 case " $new_libs " in
8827 *) new_libs="$deplib $new_libs" ;;
8835 for deplib in $new_libs; do
8838 case " $tmp_libs " in
8840 *) func_append tmp_libs " $deplib" ;;
8843 *) func_append tmp_libs " $deplib" ;;
8846 eval $var=\"$tmp_libs\"
8850 # Add Sun CC postdeps if required:
8851 test CXX = "$tagname" && {
8854 case `$CC -V 2>&1 | sed 5q` in
8855 *Sun\ C*) # Sun C++ 5.9
8858 if test no != "$suncc_use_cstd_abi"; then
8859 func_append postdeps ' -library=Cstd -library=Crun'
8866 func_cc_basename "$CC"
8867 case $func_cc_basename_result in
8871 if test no != "$suncc_use_cstd_abi"; then
8872 func_append postdeps ' -library=Cstd -library=Crun'
8880 # Last step: remove runtime libs from dependency_libs
8881 # (they stay in deplibs)
8883 for i in $dependency_libs; do
8884 case " $predeps $postdeps $compiler_lib_search_path " in
8889 if test -n "$i"; then
8890 func_append tmp_libs " $i"
8893 dependency_libs=$tmp_libs
8895 if test prog = "$linkmode"; then
8898 if test prog = "$linkmode" || test lib = "$linkmode"; then
8899 dlprefiles=$newdlprefiles
8904 if test -n "$dlfiles$dlprefiles" || test no != "$dlself"; then
8905 func_warning "'-dlopen' is ignored for archives"
8910 func_warning "'-l' and '-L' are ignored for archives" ;;
8913 test -n "$rpath" && \
8914 func_warning "'-rpath' is ignored for archives"
8916 test -n "$xrpath" && \
8917 func_warning "'-R' is ignored for archives"
8919 test -n "$vinfo" && \
8920 func_warning "'-version-info/-version-number' is ignored for archives"
8922 test -n "$release" && \
8923 func_warning "'-release' is ignored for archives"
8925 test -n "$export_symbols$export_symbols_regex" && \
8926 func_warning "'-export-symbols' is ignored for archives"
8928 # Now set the variables for building old libraries.
8929 build_libtool_libs=no
8931 func_append objs "$old_deplibs"
8935 # Make sure we only generate libraries of the form 'libNAME.la'.
8938 func_stripname 'lib' '.la' "$outputname"
8939 name=$func_stripname_result
8940 eval shared_ext=\"$shrext_cmds\"
8941 eval libname=\"$libname_spec\"
8944 test no = "$module" \
8945 && func_fatal_help "libtool library '$output' must begin with 'lib'"
8947 if test no != "$need_lib_prefix"; then
8948 # Add the "lib" prefix for modules if required
8949 func_stripname '' '.la' "$outputname"
8950 name=$func_stripname_result
8951 eval shared_ext=\"$shrext_cmds\"
8952 eval libname=\"$libname_spec\"
8954 func_stripname '' '.la' "$outputname"
8955 libname=$func_stripname_result
8960 if test -n "$objs"; then
8961 if test pass_all != "$deplibs_check_method"; then
8962 func_fatal_error "cannot build libtool library '$output' from non-libtool objects on this host:$objs"
8965 $ECHO "*** Warning: Linking the shared library $output against the non-libtool"
8966 $ECHO "*** objects $objs is not portable!"
8967 func_append libobjs " $objs"
8971 test no = "$dlself" \
8972 || func_warning "'-dlopen self' is ignored for libtool libraries"
8977 && func_warning "ignoring multiple '-rpath's for a libtool library"
8982 if test -z "$rpath"; then
8983 if test yes = "$build_libtool_libs"; then
8984 # Building a libtool convenience library.
8985 # Some compilers have problems with a '.al' extension so
8986 # convenience libraries should have the same extension an
8987 # archive normally would.
8988 oldlibs="$output_objdir/$libname.$libext $oldlibs"
8989 build_libtool_libs=convenience
8993 test -n "$vinfo" && \
8994 func_warning "'-version-info/-version-number' is ignored for convenience libraries"
8996 test -n "$release" && \
8997 func_warning "'-release' is ignored for convenience libraries"
9000 # Parse the version information argument.
9001 save_ifs=$IFS; IFS=:
9002 set dummy $vinfo 0 0 0
9007 func_fatal_help "too many parameters to '-version-info'"
9009 # convert absolute version numbers to libtool ages
9010 # this retains compatibility with .la files and attempts
9011 # to make the code below a bit more comprehensible
9013 case $vinfo_number in
9019 # There are really only two kinds -- those that
9020 # use the current revision as the major version
9021 # and those that subtract age and use age as
9022 # a minor version. But, then there is irix
9023 # that has an extra 1 added just for fun
9025 case $version_type in
9026 # correct linux to gnu/linux during the next big refactor
9027 darwin|freebsd-elf|linux|osf|windows|none)
9028 func_arith $number_major + $number_minor
9029 current=$func_arith_result
9031 revision=$number_revision
9033 freebsd-aout|qnx|sunos)
9034 current=$number_major
9035 revision=$number_minor
9039 func_arith $number_major + $number_minor
9040 current=$func_arith_result
9042 revision=$number_minor
9043 lt_irix_increment=no
9054 # Check that each of the things are valid numbers.
9056 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]) ;;
9058 func_error "CURRENT '$current' must be a nonnegative integer"
9059 func_fatal_error "'$vinfo' is not valid version information"
9064 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]) ;;
9066 func_error "REVISION '$revision' must be a nonnegative integer"
9067 func_fatal_error "'$vinfo' is not valid version information"
9072 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]) ;;
9074 func_error "AGE '$age' must be a nonnegative integer"
9075 func_fatal_error "'$vinfo' is not valid version information"
9079 if test "$age" -gt "$current"; then
9080 func_error "AGE '$age' is greater than the current interface number '$current'"
9081 func_fatal_error "'$vinfo' is not valid version information"
9084 # Calculate the version variables.
9088 case $version_type in
9092 # Like Linux, but with the current version available in
9093 # verstring for coding it into the library header
9094 func_arith $current - $age
9095 major=.$func_arith_result
9096 versuffix=$major.$age.$revision
9097 # Darwin ld doesn't like 0 for these options...
9098 func_arith $current + 1
9099 minor_current=$func_arith_result
9100 xlcverstring="$wl-compatibility_version $wl$minor_current $wl-current_version $wl$minor_current.$revision"
9101 verstring="-compatibility_version $minor_current -current_version $minor_current.$revision"
9102 # On Darwin other compilers
9105 verstring="$wl-compatibility_version $wl$minor_current $wl-current_version $wl$minor_current.$revision"
9108 verstring="-compatibility_version $minor_current -current_version $minor_current.$revision"
9115 versuffix=.$current.$revision
9119 func_arith $current - $age
9120 major=.$func_arith_result
9121 versuffix=$major.$age.$revision
9125 if test no = "$lt_irix_increment"; then
9126 func_arith $current - $age
9128 func_arith $current - $age + 1
9130 major=$func_arith_result
9132 case $version_type in
9133 nonstopux) verstring_prefix=nonstopux ;;
9134 *) verstring_prefix=sgi ;;
9136 verstring=$verstring_prefix$major.$revision
9138 # Add in all the interfaces that we are compatible with.
9140 while test 0 -ne "$loop"; do
9141 func_arith $revision - $loop
9142 iface=$func_arith_result
9143 func_arith $loop - 1
9144 loop=$func_arith_result
9145 verstring=$verstring_prefix$major.$iface:$verstring
9148 # Before this point, $major must not contain '.'.
9150 versuffix=$major.$revision
9153 linux) # correct to gnu/linux during the next big refactor
9154 func_arith $current - $age
9155 major=.$func_arith_result
9156 versuffix=$major.$age.$revision
9160 func_arith $current - $age
9161 major=.$func_arith_result
9162 versuffix=.$current.$age.$revision
9163 verstring=$current.$age.$revision
9165 # Add in all the interfaces that we are compatible with.
9167 while test 0 -ne "$loop"; do
9168 func_arith $current - $loop
9169 iface=$func_arith_result
9170 func_arith $loop - 1
9171 loop=$func_arith_result
9172 verstring=$verstring:$iface.0
9175 # Make executables depend on our current version.
9176 func_append verstring ":$current.0"
9191 versuffix=.$current.$revision
9195 # Use '-' rather than '.', since we only want one
9196 # extension on DOS 8.3 file systems.
9197 func_arith $current - $age
9198 major=$func_arith_result
9203 func_fatal_configuration "unknown library version type '$version_type'"
9207 # Clear the version info if we defaulted, and they specified a release.
9208 if test -z "$vinfo" && test -n "$release"; then
9210 case $version_type in
9212 # we can't check for "0.0" in archive_cmds due to quoting
9213 # problems, so we reset it completely
9220 if test no = "$need_version"; then
9227 # Remove version info from name if versioning should be avoided
9228 if test yes,no = "$avoid_version,$need_version"; then
9234 # Check to see if the archive will have undefined symbols.
9235 if test yes = "$allow_undefined"; then
9236 if test unsupported = "$allow_undefined_flag"; then
9237 if test yes = "$build_old_libs"; then
9238 func_warning "undefined symbols not allowed in $host shared libraries; building static only"
9239 build_libtool_libs=no
9241 func_fatal_error "can't build $host shared library unless -no-undefined is specified"
9245 # Don't allow undefined symbols.
9246 allow_undefined_flag=$no_undefined_flag
9251 func_generate_dlsyms "$libname" "$libname" :
9252 func_append libobjs " $symfileobj"
9253 test " " = "$libobjs" && libobjs=
9255 if test relink != "$opt_mode"; then
9256 # Remove our outputs, but don't remove object files since they
9257 # may have been created when compiling PIC objects.
9259 tempremovelist=`$ECHO "$output_objdir/*"`
9260 for p in $tempremovelist; do
9264 $output_objdir/$outputname | $output_objdir/$libname.* | $output_objdir/$libname$release.*)
9265 if test -n "$precious_files_regex"; then
9266 if $ECHO "$p" | $EGREP -e "$precious_files_regex" >/dev/null 2>&1
9271 func_append removelist " $p"
9276 test -n "$removelist" && \
9277 func_show_eval "${RM}r \$removelist"
9280 # Now set the variables for building old libraries.
9281 if test yes = "$build_old_libs" && test convenience != "$build_libtool_libs"; then
9282 func_append oldlibs " $output_objdir/$libname.$libext"
9284 # Transform .lo files to .o files.
9285 oldobjs="$objs "`$ECHO "$libobjs" | $SP2NL | $SED "/\.$libext$/d; $lo2o" | $NL2SP`
9288 # Eliminate all temporary directories.
9289 #for path in $notinst_path; do
9290 # lib_search_path=`$ECHO "$lib_search_path " | $SED "s% $path % %g"`
9291 # deplibs=`$ECHO "$deplibs " | $SED "s% -L$path % %g"`
9292 # dependency_libs=`$ECHO "$dependency_libs " | $SED "s% -L$path % %g"`
9295 if test -n "$xrpath"; then
9296 # If the user specified any rpath flags, then add them.
9298 for libdir in $xrpath; do
9299 func_replace_sysroot "$libdir"
9300 func_append temp_xrpath " -R$func_replace_sysroot_result"
9301 case "$finalize_rpath " in
9303 *) func_append finalize_rpath " $libdir" ;;
9306 if test yes != "$hardcode_into_libs" || test yes = "$build_old_libs"; then
9307 dependency_libs="$temp_xrpath $dependency_libs"
9311 # Make sure dlfiles contains only unique files that won't be dlpreopened
9312 old_dlfiles=$dlfiles
9314 for lib in $old_dlfiles; do
9315 case " $dlprefiles $dlfiles " in
9317 *) func_append dlfiles " $lib" ;;
9321 # Make sure dlprefiles contains only unique files
9322 old_dlprefiles=$dlprefiles
9324 for lib in $old_dlprefiles; do
9325 case "$dlprefiles " in
9327 *) func_append dlprefiles " $lib" ;;
9331 if test yes = "$build_libtool_libs"; then
9332 if test -n "$rpath"; then
9334 *-*-cygwin* | *-*-mingw* | *-*-pw32* | *-*-os2* | *-*-beos* | *-cegcc* | *-*-haiku*)
9335 # these systems don't actually have a c library (as such)!
9337 *-*-rhapsody* | *-*-darwin1.[012])
9338 # Rhapsody C library is in the System framework
9339 func_append deplibs " System.ltframework"
9342 # Don't link with libc until the a.out ld.so is fixed.
9344 *-*-openbsd* | *-*-freebsd* | *-*-dragonfly*)
9345 # Do not include libc due to us having libc/libc_r.
9347 *-*-sco3.2v5* | *-*-sco5v6*)
9348 # Causes problems with __ctype
9350 *-*-sysv4.2uw2* | *-*-sysv5* | *-*-unixware* | *-*-OpenUNIX*)
9351 # Compiler inserts libc in the correct place for threads to work
9354 # Add libc to deplibs on all other systems if necessary.
9355 if test yes = "$build_libtool_need_lc"; then
9356 func_append deplibs " -lc"
9362 # Transform deplibs into only deplibs that can be linked in shared.
9364 libname_save=$libname
9365 release_save=$release
9366 versuffix_save=$versuffix
9368 # I'm not sure if I'm treating the release correctly. I think
9369 # release should show up in the -l (ie -lgmp5) so we don't want to
9370 # add it in twice. Is that correct?
9376 case $deplibs_check_method in
9378 # Don't check for shared/static. Everything works.
9379 # This might be a little naive. We might want to check
9380 # whether the library exists or not. But this is on
9381 # osf3 & osf4 and I'm not really sure... Just
9382 # implementing what was already the behavior.
9386 # This code stresses the "libraries are programs" paradigm to its
9387 # limits. Maybe even breaks it. We compile a program, linking it
9388 # against the deplibs as a proxy for the library. Then we can check
9389 # whether they linked in statically or dynamically with ldd.
9390 $opt_dry_run || $RM conftest.c
9391 cat > conftest.c <<EOF
9392 int main() { return 0; }
9394 $opt_dry_run || $RM conftest
9395 if $LTCC $LTCFLAGS -o conftest conftest.c $deplibs; then
9396 ldd_output=`ldd conftest`
9397 for i in $deplibs; do
9400 func_stripname -l '' "$i"
9401 name=$func_stripname_result
9402 if test yes = "$allow_libtool_libs_with_static_runtimes"; then
9403 case " $predeps $postdeps " in
9405 func_append newdeplibs " $i"
9410 if test -n "$i"; then
9411 libname=`eval "\\$ECHO \"$libname_spec\""`
9412 deplib_matches=`eval "\\$ECHO \"$library_names_spec\""`
9413 set dummy $deplib_matches; shift
9415 if test `expr "$ldd_output" : ".*$deplib_match"` -ne 0; then
9416 func_append newdeplibs " $i"
9420 $ECHO "*** Warning: dynamic linker does not accept needed library $i."
9421 echo "*** I have the capability to make that library automatically link in when"
9422 echo "*** you link to this library. But I can only do this if you have a"
9423 echo "*** shared version of the library, which I believe you do not have"
9424 echo "*** because a test_compile did reveal that the linker did not use it for"
9425 echo "*** its dynamic dependency list that programs get resolved with at runtime."
9430 func_append newdeplibs " $i"
9435 # Error occurred in the first compile. Let's try to salvage
9436 # the situation: Compile a separate program for each library.
9437 for i in $deplibs; do
9440 func_stripname -l '' "$i"
9441 name=$func_stripname_result
9442 $opt_dry_run || $RM conftest
9443 if $LTCC $LTCFLAGS -o conftest conftest.c $i; then
9444 ldd_output=`ldd conftest`
9445 if test yes = "$allow_libtool_libs_with_static_runtimes"; then
9446 case " $predeps $postdeps " in
9448 func_append newdeplibs " $i"
9453 if test -n "$i"; then
9454 libname=`eval "\\$ECHO \"$libname_spec\""`
9455 deplib_matches=`eval "\\$ECHO \"$library_names_spec\""`
9456 set dummy $deplib_matches; shift
9458 if test `expr "$ldd_output" : ".*$deplib_match"` -ne 0; then
9459 func_append newdeplibs " $i"
9463 $ECHO "*** Warning: dynamic linker does not accept needed library $i."
9464 echo "*** I have the capability to make that library automatically link in when"
9465 echo "*** you link to this library. But I can only do this if you have a"
9466 echo "*** shared version of the library, which you do not appear to have"
9467 echo "*** because a test_compile did reveal that the linker did not use this one"
9468 echo "*** as a dynamic dependency that programs can get resolved with at runtime."
9474 $ECHO "*** Warning! Library $i is needed by this library but I was not able to"
9475 echo "*** make it link in! You will probably need to install it or some"
9476 echo "*** library that it depends on before this library will be fully"
9477 echo "*** functional. Installing it before continuing would be even better."
9481 func_append newdeplibs " $i"
9488 set dummy $deplibs_check_method; shift
9489 file_magic_regex=`expr "$deplibs_check_method" : "$1 \(.*\)"`
9490 for a_deplib in $deplibs; do
9493 func_stripname -l '' "$a_deplib"
9494 name=$func_stripname_result
9495 if test yes = "$allow_libtool_libs_with_static_runtimes"; then
9496 case " $predeps $postdeps " in
9498 func_append newdeplibs " $a_deplib"
9503 if test -n "$a_deplib"; then
9504 libname=`eval "\\$ECHO \"$libname_spec\""`
9505 if test -n "$file_magic_glob"; then
9506 libnameglob=`func_echo_all "$libname" | $SED -e $file_magic_glob`
9508 libnameglob=$libname
9510 test yes = "$want_nocaseglob" && nocaseglob=`shopt -p nocaseglob`
9511 for i in $lib_search_path $sys_lib_search_path $shlib_search_path; do
9512 if test yes = "$want_nocaseglob"; then
9514 potential_libs=`ls $i/$libnameglob[.-]* 2>/dev/null`
9517 potential_libs=`ls $i/$libnameglob[.-]* 2>/dev/null`
9519 for potent_lib in $potential_libs; do
9520 # Follow soft links.
9521 if ls -lLd "$potent_lib" 2>/dev/null |
9522 $GREP " -> " >/dev/null; then
9525 # The statement above tries to avoid entering an
9526 # endless loop below, in case of cyclic links.
9527 # We might still enter an endless loop, since a link
9528 # loop can be closed while we follow links,
9531 while test -h "$potlib" 2>/dev/null; do
9532 potliblink=`ls -ld $potlib | $SED 's/.* -> //'`
9534 [\\/]* | [A-Za-z]:[\\/]*) potlib=$potliblink;;
9535 *) potlib=`$ECHO "$potlib" | $SED 's|[^/]*$||'`"$potliblink";;
9538 if eval $file_magic_cmd \"\$potlib\" 2>/dev/null |
9540 $EGREP "$file_magic_regex" > /dev/null; then
9541 func_append newdeplibs " $a_deplib"
9548 if test -n "$a_deplib"; then
9551 $ECHO "*** Warning: linker path does not have real file for library $a_deplib."
9552 echo "*** I have the capability to make that library automatically link in when"
9553 echo "*** you link to this library. But I can only do this if you have a"
9554 echo "*** shared version of the library, which you do not appear to have"
9555 echo "*** because I did check the linker path looking for a file starting"
9556 if test -z "$potlib"; then
9557 $ECHO "*** with $libname but no candidates were found. (...for file magic test)"
9559 $ECHO "*** with $libname and none of the candidates passed a file format test"
9560 $ECHO "*** using a file magic. Last file checked: $potlib"
9565 # Add a -L argument.
9566 func_append newdeplibs " $a_deplib"
9569 done # Gone through all deplibs.
9572 set dummy $deplibs_check_method; shift
9573 match_pattern_regex=`expr "$deplibs_check_method" : "$1 \(.*\)"`
9574 for a_deplib in $deplibs; do
9577 func_stripname -l '' "$a_deplib"
9578 name=$func_stripname_result
9579 if test yes = "$allow_libtool_libs_with_static_runtimes"; then
9580 case " $predeps $postdeps " in
9582 func_append newdeplibs " $a_deplib"
9587 if test -n "$a_deplib"; then
9588 libname=`eval "\\$ECHO \"$libname_spec\""`
9589 for i in $lib_search_path $sys_lib_search_path $shlib_search_path; do
9590 potential_libs=`ls $i/$libname[.-]* 2>/dev/null`
9591 for potent_lib in $potential_libs; do
9592 potlib=$potent_lib # see symlink-check above in file_magic test
9593 if eval "\$ECHO \"$potent_lib\"" 2>/dev/null | $SED 10q | \
9594 $EGREP "$match_pattern_regex" > /dev/null; then
9595 func_append newdeplibs " $a_deplib"
9602 if test -n "$a_deplib"; then
9605 $ECHO "*** Warning: linker path does not have real file for library $a_deplib."
9606 echo "*** I have the capability to make that library automatically link in when"
9607 echo "*** you link to this library. But I can only do this if you have a"
9608 echo "*** shared version of the library, which you do not appear to have"
9609 echo "*** because I did check the linker path looking for a file starting"
9610 if test -z "$potlib"; then
9611 $ECHO "*** with $libname but no candidates were found. (...for regex pattern test)"
9613 $ECHO "*** with $libname and none of the candidates passed a file format test"
9614 $ECHO "*** using a regex pattern. Last file checked: $potlib"
9619 # Add a -L argument.
9620 func_append newdeplibs " $a_deplib"
9623 done # Gone through all deplibs.
9627 tmp_deplibs=`$ECHO " $deplibs" | $SED 's/ -lc$//; s/ -[LR][^ ]*//g'`
9628 if test yes = "$allow_libtool_libs_with_static_runtimes"; then
9629 for i in $predeps $postdeps; do
9630 # can't use Xsed below, because $i might contain '/'
9631 tmp_deplibs=`$ECHO " $tmp_deplibs" | $SED "s|$i||"`
9634 case $tmp_deplibs in
9637 if test none = "$deplibs_check_method"; then
9638 echo "*** Warning: inter-library dependencies are not supported in this platform."
9640 echo "*** Warning: inter-library dependencies are not known to be supported."
9642 echo "*** All declared inter-library dependencies are being dropped."
9648 versuffix=$versuffix_save
9650 release=$release_save
9651 libname=$libname_save
9655 *-*-rhapsody* | *-*-darwin1.[012])
9656 # On Rhapsody replace the C library with the System framework
9657 newdeplibs=`$ECHO " $newdeplibs" | $SED 's/ -lc / System.ltframework /'`
9661 if test yes = "$droppeddeps"; then
9662 if test yes = "$module"; then
9664 echo "*** Warning: libtool could not satisfy all declared inter-library"
9665 $ECHO "*** dependencies of module $libname. Therefore, libtool will create"
9666 echo "*** a static module, that should work as long as the dlopening"
9667 echo "*** application is linked with the -dlopen flag."
9668 if test -z "$global_symbol_pipe"; then
9670 echo "*** However, this would only work if libtool was able to extract symbol"
9671 echo "*** lists from a program, using 'nm' or equivalent, but libtool could"
9672 echo "*** not find such a program. So, this module is probably useless."
9673 echo "*** 'nm' from GNU binutils and a full rebuild may help."
9675 if test no = "$build_old_libs"; then
9676 oldlibs=$output_objdir/$libname.$libext
9677 build_libtool_libs=module
9680 build_libtool_libs=no
9683 echo "*** The inter-library dependencies that have been dropped here will be"
9684 echo "*** automatically added whenever a program is linked with this library"
9685 echo "*** or is declared to -dlopen it."
9687 if test no = "$allow_undefined"; then
9689 echo "*** Since this library must not contain undefined symbols,"
9690 echo "*** because either the platform does not support them or"
9691 echo "*** it was explicitly requested with -no-undefined,"
9692 echo "*** libtool will only create a static version of it."
9693 if test no = "$build_old_libs"; then
9694 oldlibs=$output_objdir/$libname.$libext
9695 build_libtool_libs=module
9698 build_libtool_libs=no
9703 # Done checking deplibs!
9706 # Time to change all our "foo.ltframework" stuff back to "-framework foo"
9709 newdeplibs=`$ECHO " $newdeplibs" | $SED 's% \([^ $]*\).ltframework% -framework \1%g'`
9710 new_inherited_linker_flags=`$ECHO " $new_inherited_linker_flags" | $SED 's% \([^ $]*\).ltframework% -framework \1%g'`
9711 deplibs=`$ECHO " $deplibs" | $SED 's% \([^ $]*\).ltframework% -framework \1%g'`
9715 # move library search paths that coincide with paths to not yet
9716 # installed libraries to the beginning of the library search list
9718 for path in $notinst_path; do
9719 case " $new_libs " in
9720 *" -L$path/$objdir "*) ;;
9722 case " $deplibs " in
9723 *" -L$path/$objdir "*)
9724 func_append new_libs " -L$path/$objdir" ;;
9729 for deplib in $deplibs; do
9732 case " $new_libs " in
9734 *) func_append new_libs " $deplib" ;;
9737 *) func_append new_libs " $deplib" ;;
9742 # All the library-specific variables (install_libdir is set above).
9747 # Test again, we may have decided not to build it any more
9748 if test yes = "$build_libtool_libs"; then
9749 # Remove $wl instances when linking with ld.
9750 # FIXME: should test the right _cmds variable.
9751 case $archive_cmds in
9754 if test yes = "$hardcode_into_libs"; then
9755 # Hardcode the library paths
9758 rpath=$finalize_rpath
9759 test relink = "$opt_mode" || rpath=$compile_rpath$rpath
9760 for libdir in $rpath; do
9761 if test -n "$hardcode_libdir_flag_spec"; then
9762 if test -n "$hardcode_libdir_separator"; then
9763 func_replace_sysroot "$libdir"
9764 libdir=$func_replace_sysroot_result
9765 if test -z "$hardcode_libdirs"; then
9766 hardcode_libdirs=$libdir
9768 # Just accumulate the unique libdirs.
9769 case $hardcode_libdir_separator$hardcode_libdirs$hardcode_libdir_separator in
9770 *"$hardcode_libdir_separator$libdir$hardcode_libdir_separator"*)
9773 func_append hardcode_libdirs "$hardcode_libdir_separator$libdir"
9778 eval flag=\"$hardcode_libdir_flag_spec\"
9779 func_append dep_rpath " $flag"
9781 elif test -n "$runpath_var"; then
9782 case "$perm_rpath " in
9784 *) func_append perm_rpath " $libdir" ;;
9788 # Substitute the hardcoded libdirs into the rpath.
9789 if test -n "$hardcode_libdir_separator" &&
9790 test -n "$hardcode_libdirs"; then
9791 libdir=$hardcode_libdirs
9792 eval "dep_rpath=\"$hardcode_libdir_flag_spec\""
9794 if test -n "$runpath_var" && test -n "$perm_rpath"; then
9795 # We should set the runpath_var.
9797 for dir in $perm_rpath; do
9798 func_append rpath "$dir:"
9800 eval "$runpath_var='$rpath\$$runpath_var'; export $runpath_var"
9802 test -n "$dep_rpath" && deplibs="$dep_rpath $deplibs"
9805 shlibpath=$finalize_shlibpath
9806 test relink = "$opt_mode" || shlibpath=$compile_shlibpath$shlibpath
9807 if test -n "$shlibpath"; then
9808 eval "$shlibpath_var='$shlibpath\$$shlibpath_var'; export $shlibpath_var"
9811 # Get the real and link names of the library.
9812 eval shared_ext=\"$shrext_cmds\"
9813 eval library_names=\"$library_names_spec\"
9814 set dummy $library_names
9819 if test -n "$soname_spec"; then
9820 eval soname=\"$soname_spec\"
9824 if test -z "$dlname"; then
9828 lib=$output_objdir/$realname
9832 func_append linknames " $link"
9835 # Use standard objects if they are pic
9836 test -z "$pic_flag" && libobjs=`$ECHO "$libobjs" | $SP2NL | $SED "$lo2o" | $NL2SP`
9837 test "X$libobjs" = "X " && libobjs=
9840 if test -n "$export_symbols" && test -n "$include_expsyms"; then
9841 $opt_dry_run || cp "$export_symbols" "$output_objdir/$libname.uexp"
9842 export_symbols=$output_objdir/$libname.uexp
9843 func_append delfiles " $export_symbols"
9846 orig_export_symbols=
9848 cygwin* | mingw* | cegcc*)
9849 if test -n "$export_symbols" && test -z "$export_symbols_regex"; then
9850 # exporting using user supplied symfile
9851 func_dll_def_p "$export_symbols" || {
9852 # and it's NOT already a .def file. Must figure out
9853 # which of the given symbols are data symbols and tag
9854 # them as such. So, trigger use of export_symbols_cmds.
9855 # export_symbols gets reassigned inside the "prepare
9856 # the list of exported symbols" if statement, so the
9857 # include_expsyms logic still works.
9858 orig_export_symbols=$export_symbols
9860 always_export_symbols=yes
9866 # Prepare the list of exported symbols
9867 if test -z "$export_symbols"; then
9868 if test yes = "$always_export_symbols" || test -n "$export_symbols_regex"; then
9869 func_verbose "generating symbol list for '$libname.la'"
9870 export_symbols=$output_objdir/$libname.exp
9871 $opt_dry_run || $RM $export_symbols
9872 cmds=$export_symbols_cmds
9873 save_ifs=$IFS; IFS='~'
9874 for cmd1 in $cmds; do
9876 # Take the normal branch if the nm_file_list_spec branch
9877 # doesn't work or if tool conversion is not needed.
9878 case $nm_file_list_spec~$to_tool_file_cmd in
9879 *~func_convert_file_noop | *~func_convert_file_msys_to_w32 | ~*)
9880 try_normal_branch=yes
9883 len=$func_len_result
9886 try_normal_branch=no
9889 if test yes = "$try_normal_branch" \
9890 && { test "$len" -lt "$max_cmd_len" \
9891 || test "$max_cmd_len" -le -1; }
9893 func_show_eval "$cmd" 'exit $?'
9894 skipped_export=false
9895 elif test -n "$nm_file_list_spec"; then
9896 func_basename "$output"
9897 output_la=$func_basename_result
9898 save_libobjs=$libobjs
9900 output=$output_objdir/$output_la.nm
9901 func_to_tool_file "$output"
9902 libobjs=$nm_file_list_spec$func_to_tool_file_result
9903 func_append delfiles " $output"
9904 func_verbose "creating $NM input file list: $output"
9905 for obj in $save_libobjs; do
9906 func_to_tool_file "$obj"
9907 $ECHO "$func_to_tool_file_result"
9910 func_show_eval "$cmd" 'exit $?'
9912 libobjs=$save_libobjs
9913 skipped_export=false
9915 # The command line is too long to execute in one step.
9916 func_verbose "using reloadable object file for export list..."
9918 # Break out early, otherwise skipped_export may be
9919 # set to false by a later but shorter cmd.
9924 if test -n "$export_symbols_regex" && test : != "$skipped_export"; then
9925 func_show_eval '$EGREP -e "$export_symbols_regex" "$export_symbols" > "${export_symbols}T"'
9926 func_show_eval '$MV "${export_symbols}T" "$export_symbols"'
9931 if test -n "$export_symbols" && test -n "$include_expsyms"; then
9932 tmp_export_symbols=$export_symbols
9933 test -n "$orig_export_symbols" && tmp_export_symbols=$orig_export_symbols
9934 $opt_dry_run || eval '$ECHO "$include_expsyms" | $SP2NL >> "$tmp_export_symbols"'
9937 if test : != "$skipped_export" && test -n "$orig_export_symbols"; then
9938 # The given exports_symbols file has to be filtered, so filter it.
9939 func_verbose "filter symbol list for '$libname.la' to tag DATA exports"
9940 # FIXME: $output_objdir/$libname.filter potentially contains lots of
9941 # 's' commands, which not all seds can handle. GNU sed should be fine
9942 # though. Also, the filter scales superlinearly with the number of
9943 # global variables. join(1) would be nice here, but unfortunately
9944 # isn't a blessed tool.
9945 $opt_dry_run || $SED -e '/[ ,]DATA/!d;s,\(.*\)\([ \,].*\),s|^\1$|\1\2|,' < $export_symbols > $output_objdir/$libname.filter
9946 func_append delfiles " $export_symbols $output_objdir/$libname.filter"
9947 export_symbols=$output_objdir/$libname.def
9948 $opt_dry_run || $SED -f $output_objdir/$libname.filter < $orig_export_symbols > $export_symbols
9952 for test_deplib in $deplibs; do
9953 case " $convenience " in
9954 *" $test_deplib "*) ;;
9956 func_append tmp_deplibs " $test_deplib"
9960 deplibs=$tmp_deplibs
9962 if test -n "$convenience"; then
9963 if test -n "$whole_archive_flag_spec" &&
9964 test yes = "$compiler_needs_object" &&
9965 test -z "$libobjs"; then
9966 # extract the archives, so we have objects to list.
9967 # TODO: could optimize this to just extract one archive.
9968 whole_archive_flag_spec=
9970 if test -n "$whole_archive_flag_spec"; then
9971 save_libobjs=$libobjs
9972 eval libobjs=\"\$libobjs $whole_archive_flag_spec\"
9973 test "X$libobjs" = "X " && libobjs=
9975 gentop=$output_objdir/${outputname}x
9976 func_append generated " $gentop"
9978 func_extract_archives $gentop $convenience
9979 func_append libobjs " $func_extract_archives_result"
9980 test "X$libobjs" = "X " && libobjs=
9984 if test yes = "$thread_safe" && test -n "$thread_safe_flag_spec"; then
9985 eval flag=\"$thread_safe_flag_spec\"
9986 func_append linker_flags " $flag"
9989 # Make a backup of the uninstalled library when relinking
9990 if test relink = "$opt_mode"; then
9991 $opt_dry_run || eval '(cd $output_objdir && $RM ${realname}U && $MV $realname ${realname}U)' || exit $?
9994 # Do each of the archive commands.
9995 if test yes = "$module" && test -n "$module_cmds"; then
9996 if test -n "$export_symbols" && test -n "$module_expsym_cmds"; then
9997 eval test_cmds=\"$module_expsym_cmds\"
9998 cmds=$module_expsym_cmds
10000 eval test_cmds=\"$module_cmds\"
10004 if test -n "$export_symbols" && test -n "$archive_expsym_cmds"; then
10005 eval test_cmds=\"$archive_expsym_cmds\"
10006 cmds=$archive_expsym_cmds
10008 eval test_cmds=\"$archive_cmds\"
10013 if test : != "$skipped_export" &&
10014 func_len " $test_cmds" &&
10015 len=$func_len_result &&
10016 test "$len" -lt "$max_cmd_len" || test "$max_cmd_len" -le -1; then
10019 # The command line is too long to link in one step, link piecewise
10020 # or, if using GNU ld and skipped_export is not :, use a linker
10023 # Save the value of $output and $libobjs because we want to
10024 # use them later. If we have whole_archive_flag_spec, we
10025 # want to use save_libobjs as it was before
10026 # whole_archive_flag_spec was expanded, because we can't
10027 # assume the linker understands whole_archive_flag_spec.
10028 # This may have to be revisited, in case too many
10029 # convenience libraries get linked in and end up exceeding
10031 if test -z "$convenience" || test -z "$whole_archive_flag_spec"; then
10032 save_libobjs=$libobjs
10034 save_output=$output
10035 func_basename "$output"
10036 output_la=$func_basename_result
10038 # Clear the reloadable object creation command queue and
10039 # initialize k to one.
10046 if test -n "$save_libobjs" && test : != "$skipped_export" && test yes = "$with_gnu_ld"; then
10047 output=$output_objdir/$output_la.lnkscript
10048 func_verbose "creating GNU ld script: $output"
10049 echo 'INPUT (' > $output
10050 for obj in $save_libobjs
10052 func_to_tool_file "$obj"
10053 $ECHO "$func_to_tool_file_result" >> $output
10055 echo ')' >> $output
10056 func_append delfiles " $output"
10057 func_to_tool_file "$output"
10058 output=$func_to_tool_file_result
10059 elif test -n "$save_libobjs" && test : != "$skipped_export" && test -n "$file_list_spec"; then
10060 output=$output_objdir/$output_la.lnk
10061 func_verbose "creating linker input file list: $output"
10063 set x $save_libobjs
10066 if test yes = "$compiler_needs_object"; then
10072 func_to_tool_file "$obj"
10073 $ECHO "$func_to_tool_file_result" >> $output
10075 func_append delfiles " $output"
10076 func_to_tool_file "$output"
10077 output=$firstobj\"$file_list_spec$func_to_tool_file_result\"
10079 if test -n "$save_libobjs"; then
10080 func_verbose "creating reloadable object files..."
10081 output=$output_objdir/$output_la-$k.$objext
10082 eval test_cmds=\"$reload_cmds\"
10083 func_len " $test_cmds"
10084 len0=$func_len_result
10087 # Loop over the list of objects to be linked.
10088 for obj in $save_libobjs
10091 func_arith $len + $func_len_result
10092 len=$func_arith_result
10093 if test -z "$objlist" ||
10094 test "$len" -lt "$max_cmd_len"; then
10095 func_append objlist " $obj"
10097 # The command $test_cmds is almost too long, add a
10098 # command to the queue.
10099 if test 1 -eq "$k"; then
10100 # The first file doesn't have a previous command to add.
10101 reload_objs=$objlist
10102 eval concat_cmds=\"$reload_cmds\"
10104 # All subsequent reloadable object files will link in
10105 # the last one created.
10106 reload_objs="$objlist $last_robj"
10107 eval concat_cmds=\"\$concat_cmds~$reload_cmds~\$RM $last_robj\"
10109 last_robj=$output_objdir/$output_la-$k.$objext
10111 k=$func_arith_result
10112 output=$output_objdir/$output_la-$k.$objext
10114 func_len " $last_robj"
10115 func_arith $len0 + $func_len_result
10116 len=$func_arith_result
10119 # Handle the remaining objects by creating one last
10120 # reloadable object file. All subsequent reloadable object
10121 # files will link in the last one created.
10122 test -z "$concat_cmds" || concat_cmds=$concat_cmds~
10123 reload_objs="$objlist $last_robj"
10124 eval concat_cmds=\"\$concat_cmds$reload_cmds\"
10125 if test -n "$last_robj"; then
10126 eval concat_cmds=\"\$concat_cmds~\$RM $last_robj\"
10128 func_append delfiles " $output"
10134 ${skipped_export-false} && {
10135 func_verbose "generating symbol list for '$libname.la'"
10136 export_symbols=$output_objdir/$libname.exp
10137 $opt_dry_run || $RM $export_symbols
10139 # Append the command to create the export file.
10140 test -z "$concat_cmds" || concat_cmds=$concat_cmds~
10141 eval concat_cmds=\"\$concat_cmds$export_symbols_cmds\"
10142 if test -n "$last_robj"; then
10143 eval concat_cmds=\"\$concat_cmds~\$RM $last_robj\"
10147 test -n "$save_libobjs" &&
10148 func_verbose "creating a temporary reloadable object file: $output"
10150 # Loop through the commands generated above and execute them.
10151 save_ifs=$IFS; IFS='~'
10152 for cmd in $concat_cmds; do
10155 func_quote_arg expand,pretty "$cmd"
10156 eval "func_echo $func_quote_arg_result"
10158 $opt_dry_run || eval "$cmd" || {
10161 # Restore the uninstalled library and exit
10162 if test relink = "$opt_mode"; then
10163 ( cd "$output_objdir" && \
10164 $RM "${realname}T" && \
10165 $MV "${realname}U" "$realname" )
10173 if test -n "$export_symbols_regex" && ${skipped_export-false}; then
10174 func_show_eval '$EGREP -e "$export_symbols_regex" "$export_symbols" > "${export_symbols}T"'
10175 func_show_eval '$MV "${export_symbols}T" "$export_symbols"'
10179 ${skipped_export-false} && {
10180 if test -n "$export_symbols" && test -n "$include_expsyms"; then
10181 tmp_export_symbols=$export_symbols
10182 test -n "$orig_export_symbols" && tmp_export_symbols=$orig_export_symbols
10183 $opt_dry_run || eval '$ECHO "$include_expsyms" | $SP2NL >> "$tmp_export_symbols"'
10186 if test -n "$orig_export_symbols"; then
10187 # The given exports_symbols file has to be filtered, so filter it.
10188 func_verbose "filter symbol list for '$libname.la' to tag DATA exports"
10189 # FIXME: $output_objdir/$libname.filter potentially contains lots of
10190 # 's' commands, which not all seds can handle. GNU sed should be fine
10191 # though. Also, the filter scales superlinearly with the number of
10192 # global variables. join(1) would be nice here, but unfortunately
10193 # isn't a blessed tool.
10194 $opt_dry_run || $SED -e '/[ ,]DATA/!d;s,\(.*\)\([ \,].*\),s|^\1$|\1\2|,' < $export_symbols > $output_objdir/$libname.filter
10195 func_append delfiles " $export_symbols $output_objdir/$libname.filter"
10196 export_symbols=$output_objdir/$libname.def
10197 $opt_dry_run || $SED -f $output_objdir/$libname.filter < $orig_export_symbols > $export_symbols
10202 # Restore the value of output.
10203 output=$save_output
10205 if test -n "$convenience" && test -n "$whole_archive_flag_spec"; then
10206 eval libobjs=\"\$libobjs $whole_archive_flag_spec\"
10207 test "X$libobjs" = "X " && libobjs=
10209 # Expand the library linking commands again to reset the
10210 # value of $libobjs for piecewise linking.
10212 # Do each of the archive commands.
10213 if test yes = "$module" && test -n "$module_cmds"; then
10214 if test -n "$export_symbols" && test -n "$module_expsym_cmds"; then
10215 cmds=$module_expsym_cmds
10220 if test -n "$export_symbols" && test -n "$archive_expsym_cmds"; then
10221 cmds=$archive_expsym_cmds
10228 if test -n "$delfiles"; then
10229 # Append the command to remove temporary files to $cmds.
10230 eval cmds=\"\$cmds~\$RM $delfiles\"
10233 # Add any objects from preloaded convenience libraries
10234 if test -n "$dlprefiles"; then
10235 gentop=$output_objdir/${outputname}x
10236 func_append generated " $gentop"
10238 func_extract_archives $gentop $dlprefiles
10239 func_append libobjs " $func_extract_archives_result"
10240 test "X$libobjs" = "X " && libobjs=
10243 save_ifs=$IFS; IFS='~'
10244 for cmd in $cmds; do
10249 func_quote_arg expand,pretty "$cmd"
10250 eval "func_echo $func_quote_arg_result"
10252 $opt_dry_run || eval "$cmd" || {
10255 # Restore the uninstalled library and exit
10256 if test relink = "$opt_mode"; then
10257 ( cd "$output_objdir" && \
10258 $RM "${realname}T" && \
10259 $MV "${realname}U" "$realname" )
10267 # Restore the uninstalled library and exit
10268 if test relink = "$opt_mode"; then
10269 $opt_dry_run || eval '(cd $output_objdir && $RM ${realname}T && $MV $realname ${realname}T && $MV ${realname}U $realname)' || exit $?
10271 if test -n "$convenience"; then
10272 if test -z "$whole_archive_flag_spec"; then
10273 func_show_eval '${RM}r "$gentop"'
10280 # Create links to the real library.
10281 for linkname in $linknames; do
10282 if test "$realname" != "$linkname"; then
10283 func_show_eval '(cd "$output_objdir" && $RM "$linkname" && $LN_S "$realname" "$linkname")' 'exit $?'
10287 # If -module or -export-dynamic was specified, set the dlname.
10288 if test yes = "$module" || test yes = "$export_dynamic"; then
10289 # On all known operating systems, these are identical.
10296 if test -n "$dlfiles$dlprefiles" || test no != "$dlself"; then
10297 func_warning "'-dlopen' is ignored for objects"
10300 case " $deplibs" in
10302 func_warning "'-l' and '-L' are ignored for objects" ;;
10305 test -n "$rpath" && \
10306 func_warning "'-rpath' is ignored for objects"
10308 test -n "$xrpath" && \
10309 func_warning "'-R' is ignored for objects"
10311 test -n "$vinfo" && \
10312 func_warning "'-version-info' is ignored for objects"
10314 test -n "$release" && \
10315 func_warning "'-release' is ignored for objects"
10319 test -n "$objs$old_deplibs" && \
10320 func_fatal_error "cannot build library object '$output' from non-libtool objects"
10323 func_lo2o "$libobj"
10324 obj=$func_lo2o_result
10332 # Delete the old objects.
10333 $opt_dry_run || $RM $obj $libobj
10335 # Objects from convenience libraries. This assumes
10336 # single-version convenience libraries. Whenever we create
10337 # different ones for PIC/non-PIC, this we'll have to duplicate
10341 # if reload_cmds runs $LD directly, get rid of -Wl from
10342 # whole_archive_flag_spec and hope we can get by with turning comma
10344 case $reload_cmds in
10345 *\$LD[\ \$]*) wl= ;;
10347 if test -n "$convenience"; then
10348 if test -n "$whole_archive_flag_spec"; then
10349 eval tmp_whole_archive_flags=\"$whole_archive_flag_spec\"
10350 test -n "$wl" || tmp_whole_archive_flags=`$ECHO "$tmp_whole_archive_flags" | $SED 's|,| |g'`
10351 reload_conv_objs=$reload_objs\ $tmp_whole_archive_flags
10353 gentop=$output_objdir/${obj}x
10354 func_append generated " $gentop"
10356 func_extract_archives $gentop $convenience
10357 reload_conv_objs="$reload_objs $func_extract_archives_result"
10361 # If we're not building shared, we need to use non_pic_objs
10362 test yes = "$build_libtool_libs" || libobjs=$non_pic_objects
10364 # Create the old-style object.
10365 reload_objs=$objs$old_deplibs' '`$ECHO "$libobjs" | $SP2NL | $SED "/\.$libext$/d; /\.lib$/d; $lo2o" | $NL2SP`' '$reload_conv_objs
10368 func_execute_cmds "$reload_cmds" 'exit $?'
10370 # Exit if we aren't doing a library object file.
10371 if test -z "$libobj"; then
10372 if test -n "$gentop"; then
10373 func_show_eval '${RM}r "$gentop"'
10379 test yes = "$build_libtool_libs" || {
10380 if test -n "$gentop"; then
10381 func_show_eval '${RM}r "$gentop"'
10384 # Create an invalid libtool object if no PIC, so that we don't
10385 # accidentally link it into a program.
10386 # $show "echo timestamp > $libobj"
10387 # $opt_dry_run || eval "echo timestamp > $libobj" || exit $?
10391 if test -n "$pic_flag" || test default != "$pic_mode"; then
10392 # Only do commands if we really have different PIC objects.
10393 reload_objs="$libobjs $reload_conv_objs"
10395 func_execute_cmds "$reload_cmds" 'exit $?'
10398 if test -n "$gentop"; then
10399 func_show_eval '${RM}r "$gentop"'
10407 *cygwin*) func_stripname '' '.exe' "$output"
10408 output=$func_stripname_result.exe;;
10410 test -n "$vinfo" && \
10411 func_warning "'-version-info' is ignored for programs"
10413 test -n "$release" && \
10414 func_warning "'-release' is ignored for programs"
10417 && test unknown,unknown,unknown = "$dlopen_support,$dlopen_self,$dlopen_self_static" \
10418 && func_warning "'LT_INIT([dlopen])' not used. Assuming no dlopen support."
10421 *-*-rhapsody* | *-*-darwin1.[012])
10422 # On Rhapsody replace the C library is the System framework
10423 compile_deplibs=`$ECHO " $compile_deplibs" | $SED 's/ -lc / System.ltframework /'`
10424 finalize_deplibs=`$ECHO " $finalize_deplibs" | $SED 's/ -lc / System.ltframework /'`
10430 # Don't allow lazy linking, it breaks C++ global constructors
10431 # But is supposedly fixed on 10.4 or later (yay!).
10432 if test CXX = "$tagname"; then
10433 case ${MACOSX_DEPLOYMENT_TARGET-10.0} in
10435 func_append compile_command " $wl-bind_at_load"
10436 func_append finalize_command " $wl-bind_at_load"
10440 # Time to change all our "foo.ltframework" stuff back to "-framework foo"
10441 compile_deplibs=`$ECHO " $compile_deplibs" | $SED 's% \([^ $]*\).ltframework% -framework \1%g'`
10442 finalize_deplibs=`$ECHO " $finalize_deplibs" | $SED 's% \([^ $]*\).ltframework% -framework \1%g'`
10447 # move library search paths that coincide with paths to not yet
10448 # installed libraries to the beginning of the library search list
10450 for path in $notinst_path; do
10451 case " $new_libs " in
10452 *" -L$path/$objdir "*) ;;
10454 case " $compile_deplibs " in
10455 *" -L$path/$objdir "*)
10456 func_append new_libs " -L$path/$objdir" ;;
10461 for deplib in $compile_deplibs; do
10464 case " $new_libs " in
10466 *) func_append new_libs " $deplib" ;;
10469 *) func_append new_libs " $deplib" ;;
10472 compile_deplibs=$new_libs
10475 func_append compile_command " $compile_deplibs"
10476 func_append finalize_command " $finalize_deplibs"
10478 if test -n "$rpath$xrpath"; then
10479 # If the user specified any rpath flags, then add them.
10480 for libdir in $rpath $xrpath; do
10481 # This is the magic to use -rpath.
10482 case "$finalize_rpath " in
10484 *) func_append finalize_rpath " $libdir" ;;
10489 # Now hardcode the library paths
10492 for libdir in $compile_rpath $finalize_rpath; do
10493 if test -n "$hardcode_libdir_flag_spec"; then
10494 if test -n "$hardcode_libdir_separator"; then
10495 if test -z "$hardcode_libdirs"; then
10496 hardcode_libdirs=$libdir
10498 # Just accumulate the unique libdirs.
10499 case $hardcode_libdir_separator$hardcode_libdirs$hardcode_libdir_separator in
10500 *"$hardcode_libdir_separator$libdir$hardcode_libdir_separator"*)
10503 func_append hardcode_libdirs "$hardcode_libdir_separator$libdir"
10508 eval flag=\"$hardcode_libdir_flag_spec\"
10509 func_append rpath " $flag"
10511 elif test -n "$runpath_var"; then
10512 case "$perm_rpath " in
10514 *) func_append perm_rpath " $libdir" ;;
10518 *-*-cygwin* | *-*-mingw* | *-*-pw32* | *-*-os2* | *-cegcc*)
10519 testbindir=`$ECHO "$libdir" | $SED -e 's*/lib$*/bin*'`
10520 case :$dllsearchpath: in
10522 ::) dllsearchpath=$libdir;;
10523 *) func_append dllsearchpath ":$libdir";;
10525 case :$dllsearchpath: in
10526 *":$testbindir:"*) ;;
10527 ::) dllsearchpath=$testbindir;;
10528 *) func_append dllsearchpath ":$testbindir";;
10533 # Substitute the hardcoded libdirs into the rpath.
10534 if test -n "$hardcode_libdir_separator" &&
10535 test -n "$hardcode_libdirs"; then
10536 libdir=$hardcode_libdirs
10537 eval rpath=\" $hardcode_libdir_flag_spec\"
10539 compile_rpath=$rpath
10543 for libdir in $finalize_rpath; do
10544 if test -n "$hardcode_libdir_flag_spec"; then
10545 if test -n "$hardcode_libdir_separator"; then
10546 if test -z "$hardcode_libdirs"; then
10547 hardcode_libdirs=$libdir
10549 # Just accumulate the unique libdirs.
10550 case $hardcode_libdir_separator$hardcode_libdirs$hardcode_libdir_separator in
10551 *"$hardcode_libdir_separator$libdir$hardcode_libdir_separator"*)
10554 func_append hardcode_libdirs "$hardcode_libdir_separator$libdir"
10559 eval flag=\"$hardcode_libdir_flag_spec\"
10560 func_append rpath " $flag"
10562 elif test -n "$runpath_var"; then
10563 case "$finalize_perm_rpath " in
10565 *) func_append finalize_perm_rpath " $libdir" ;;
10569 # Substitute the hardcoded libdirs into the rpath.
10570 if test -n "$hardcode_libdir_separator" &&
10571 test -n "$hardcode_libdirs"; then
10572 libdir=$hardcode_libdirs
10573 eval rpath=\" $hardcode_libdir_flag_spec\"
10575 finalize_rpath=$rpath
10577 if test -n "$libobjs" && test yes = "$build_old_libs"; then
10578 # Transform all the library objects into standard objects.
10579 compile_command=`$ECHO "$compile_command" | $SP2NL | $SED "$lo2o" | $NL2SP`
10580 finalize_command=`$ECHO "$finalize_command" | $SP2NL | $SED "$lo2o" | $NL2SP`
10583 func_generate_dlsyms "$outputname" "@PROGRAM@" false
10585 # template prelinking step
10586 if test -n "$prelink_cmds"; then
10587 func_execute_cmds "$prelink_cmds" 'exit $?'
10590 wrappers_required=:
10592 *cegcc* | *mingw32ce*)
10593 # Disable wrappers for cegcc and mingw32ce hosts, we are cross compiling anyway.
10594 wrappers_required=false
10596 *cygwin* | *mingw* )
10597 test yes = "$build_libtool_libs" || wrappers_required=false
10600 if test no = "$need_relink" || test yes != "$build_libtool_libs"; then
10601 wrappers_required=false
10605 $wrappers_required || {
10606 # Replace the output file specification.
10607 compile_command=`$ECHO "$compile_command" | $SED 's%@OUTPUT@%'"$output"'%g'`
10608 link_command=$compile_command$compile_rpath
10610 # We have no uninstalled library dependencies, so finalize right now.
10612 func_show_eval "$link_command" 'exit_status=$?'
10614 if test -n "$postlink_cmds"; then
10615 func_to_tool_file "$output"
10616 postlink_cmds=`func_echo_all "$postlink_cmds" | $SED -e 's%@OUTPUT@%'"$output"'%g' -e 's%@TOOL_OUTPUT@%'"$func_to_tool_file_result"'%g'`
10617 func_execute_cmds "$postlink_cmds" 'exit $?'
10620 # Delete the generated files.
10621 if test -f "$output_objdir/${outputname}S.$objext"; then
10622 func_show_eval '$RM "$output_objdir/${outputname}S.$objext"'
10628 if test -n "$compile_shlibpath$finalize_shlibpath"; then
10629 compile_command="$shlibpath_var=\"$compile_shlibpath$finalize_shlibpath\$$shlibpath_var\" $compile_command"
10631 if test -n "$finalize_shlibpath"; then
10632 finalize_command="$shlibpath_var=\"$finalize_shlibpath\$$shlibpath_var\" $finalize_command"
10637 if test -n "$runpath_var"; then
10638 if test -n "$perm_rpath"; then
10639 # We should set the runpath_var.
10641 for dir in $perm_rpath; do
10642 func_append rpath "$dir:"
10644 compile_var="$runpath_var=\"$rpath\$$runpath_var\" "
10646 if test -n "$finalize_perm_rpath"; then
10647 # We should set the runpath_var.
10649 for dir in $finalize_perm_rpath; do
10650 func_append rpath "$dir:"
10652 finalize_var="$runpath_var=\"$rpath\$$runpath_var\" "
10656 if test yes = "$no_install"; then
10657 # We don't need to create a wrapper script.
10658 link_command=$compile_var$compile_command$compile_rpath
10659 # Replace the output file specification.
10660 link_command=`$ECHO "$link_command" | $SED 's%@OUTPUT@%'"$output"'%g'`
10661 # Delete the old output file.
10662 $opt_dry_run || $RM $output
10663 # Link the executable and exit
10664 func_show_eval "$link_command" 'exit $?'
10666 if test -n "$postlink_cmds"; then
10667 func_to_tool_file "$output"
10668 postlink_cmds=`func_echo_all "$postlink_cmds" | $SED -e 's%@OUTPUT@%'"$output"'%g' -e 's%@TOOL_OUTPUT@%'"$func_to_tool_file_result"'%g'`
10669 func_execute_cmds "$postlink_cmds" 'exit $?'
10675 case $hardcode_action,$fast_install in
10677 # Fast installation is not supported
10678 link_command=$compile_var$compile_command$compile_rpath
10679 relink_command=$finalize_var$finalize_command$finalize_rpath
10681 func_warning "this platform does not like uninstalled shared libraries"
10682 func_warning "'$output' will be relinked during installation"
10685 link_command=$finalize_var$compile_command$finalize_rpath
10686 relink_command=`$ECHO "$compile_var$compile_command$compile_rpath" | $SED 's%@OUTPUT@%\$progdir/\$file%g'`
10689 link_command=$compile_var$compile_command$compile_rpath
10690 relink_command=$finalize_var$finalize_command$finalize_rpath
10693 link_command=$finalize_var$compile_command$finalize_rpath
10698 # Replace the output file specification.
10699 link_command=`$ECHO "$link_command" | $SED 's%@OUTPUT@%'"$output_objdir/$outputname"'%g'`
10701 # Delete the old output files.
10702 $opt_dry_run || $RM $output $output_objdir/$outputname $output_objdir/lt-$outputname
10704 func_show_eval "$link_command" 'exit $?'
10706 if test -n "$postlink_cmds"; then
10707 func_to_tool_file "$output_objdir/$outputname"
10708 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'`
10709 func_execute_cmds "$postlink_cmds" 'exit $?'
10712 # Now create the wrapper script.
10713 func_verbose "creating $output"
10715 # Quote the relink command for shipping.
10716 if test -n "$relink_command"; then
10717 # Preserve any variables that may affect compiler behavior
10718 for var in $variables_saved_for_relink; do
10719 if eval test -z \"\${$var+set}\"; then
10720 relink_command="{ test -z \"\${$var+set}\" || $lt_unset $var || { $var=; export $var; }; }; $relink_command"
10721 elif eval var_value=\$$var; test -z "$var_value"; then
10722 relink_command="$var=; export $var; $relink_command"
10724 func_quote_arg pretty "$var_value"
10725 relink_command="$var=$func_quote_arg_result; export $var; $relink_command"
10728 func_quote eval cd "`pwd`"
10729 func_quote_arg pretty,unquoted "($func_quote_result; $relink_command)"
10730 relink_command=$func_quote_arg_unquoted_result
10733 # Only actually do things if not in dry run mode.
10735 # win32 will think the script is a binary if it has
10736 # a .exe suffix, so we strip it off here.
10738 *.exe) func_stripname '' '.exe' "$output"
10739 output=$func_stripname_result ;;
10741 # test for cygwin because mv fails w/o .exe extensions
10745 func_stripname '' '.exe' "$outputname"
10746 outputname=$func_stripname_result ;;
10750 *cygwin* | *mingw* )
10751 func_dirname_and_basename "$output" "" "."
10752 output_name=$func_basename_result
10753 output_path=$func_dirname_result
10754 cwrappersource=$output_path/$objdir/lt-$output_name.c
10755 cwrapper=$output_path/$output_name.exe
10756 $RM $cwrappersource $cwrapper
10757 trap "$RM $cwrappersource $cwrapper; exit $EXIT_FAILURE" 1 2 15
10759 func_emit_cwrapperexe_src > $cwrappersource
10761 # The wrapper executable is built using the $host compiler,
10762 # because it contains $host paths and files. If cross-
10763 # compiling, it, like the target executable, must be
10764 # executed on the $host or under an emulation environment.
10766 $LTCC $LTCFLAGS -o $cwrapper $cwrappersource
10770 # Now, create the wrapper script for func_source use:
10771 func_ltwrapper_scriptname $cwrapper
10772 $RM $func_ltwrapper_scriptname_result
10773 trap "$RM $func_ltwrapper_scriptname_result; exit $EXIT_FAILURE" 1 2 15
10775 # note: this script will not be executed, so do not chmod.
10776 if test "x$build" = "x$host"; then
10777 $cwrapper --lt-dump-script > $func_ltwrapper_scriptname_result
10779 func_emit_wrapper no > $func_ltwrapper_scriptname_result
10785 trap "$RM $output; exit $EXIT_FAILURE" 1 2 15
10787 func_emit_wrapper no > $output
10796 # See if we need to build an old-fashioned archive.
10797 for oldlib in $oldlibs; do
10799 case $build_libtool_libs in
10801 oldobjs="$libobjs_save $symfileobj"
10802 addlibs=$convenience
10803 build_libtool_libs=no
10806 oldobjs=$libobjs_save
10807 addlibs=$old_convenience
10808 build_libtool_libs=no
10811 oldobjs="$old_deplibs $non_pic_objects"
10812 $preload && test -f "$symfileobj" \
10813 && func_append oldobjs " $symfileobj"
10814 addlibs=$old_convenience
10818 if test -n "$addlibs"; then
10819 gentop=$output_objdir/${outputname}x
10820 func_append generated " $gentop"
10822 func_extract_archives $gentop $addlibs
10823 func_append oldobjs " $func_extract_archives_result"
10826 # Do each command in the archive commands.
10827 if test -n "$old_archive_from_new_cmds" && test yes = "$build_libtool_libs"; then
10828 cmds=$old_archive_from_new_cmds
10831 # Add any objects from preloaded convenience libraries
10832 if test -n "$dlprefiles"; then
10833 gentop=$output_objdir/${outputname}x
10834 func_append generated " $gentop"
10836 func_extract_archives $gentop $dlprefiles
10837 func_append oldobjs " $func_extract_archives_result"
10840 # POSIX demands no paths to be encoded in archives. We have
10841 # to avoid creating archives with duplicate basenames if we
10842 # might have to extract them afterwards, e.g., when creating a
10843 # static archive out of a convenience library, or when linking
10844 # the entirety of a libtool archive into another (currently
10845 # not supported by libtool).
10846 if (for obj in $oldobjs
10848 func_basename "$obj"
10849 $ECHO "$func_basename_result"
10850 done | sort | sort -uc >/dev/null 2>&1); then
10853 echo "copying selected object files to avoid basename conflicts..."
10854 gentop=$output_objdir/${outputname}x
10855 func_append generated " $gentop"
10856 func_mkdir_p "$gentop"
10857 save_oldobjs=$oldobjs
10860 for obj in $save_oldobjs
10862 func_basename "$obj"
10863 objbase=$func_basename_result
10864 case " $oldobjs " in
10865 " ") oldobjs=$obj ;;
10866 *[\ /]"$objbase "*)
10868 # Make sure we don't pick an alternate name that also
10870 newobj=lt$counter-$objbase
10871 func_arith $counter + 1
10872 counter=$func_arith_result
10873 case " $oldobjs " in
10874 *[\ /]"$newobj "*) ;;
10875 *) if test ! -f "$gentop/$newobj"; then break; fi ;;
10878 func_show_eval "ln $obj $gentop/$newobj || cp $obj $gentop/$newobj"
10879 func_append oldobjs " $gentop/$newobj"
10881 *) func_append oldobjs " $obj" ;;
10885 func_to_tool_file "$oldlib" func_convert_file_msys_to_w32
10886 tool_oldlib=$func_to_tool_file_result
10887 eval cmds=\"$old_archive_cmds\"
10890 len=$func_len_result
10891 if test "$len" -lt "$max_cmd_len" || test "$max_cmd_len" -le -1; then
10892 cmds=$old_archive_cmds
10893 elif test -n "$archiver_list_spec"; then
10894 func_verbose "using command file archive linking..."
10895 for obj in $oldobjs
10897 func_to_tool_file "$obj"
10898 $ECHO "$func_to_tool_file_result"
10899 done > $output_objdir/$libname.libcmd
10900 func_to_tool_file "$output_objdir/$libname.libcmd"
10901 oldobjs=" $archiver_list_spec$func_to_tool_file_result"
10902 cmds=$old_archive_cmds
10904 # the command line is too long to link in one step, link in parts
10905 func_verbose "using piecewise archive linking..."
10906 save_RANLIB=$RANLIB
10910 save_oldobjs=$oldobjs
10912 # Is there a better way of finding the last object in the list?
10913 for obj in $save_oldobjs
10917 eval test_cmds=\"$old_archive_cmds\"
10918 func_len " $test_cmds"
10919 len0=$func_len_result
10921 for obj in $save_oldobjs
10924 func_arith $len + $func_len_result
10925 len=$func_arith_result
10926 func_append objlist " $obj"
10927 if test "$len" -lt "$max_cmd_len"; then
10930 # the above command should be used before it gets too long
10932 if test "$obj" = "$last_oldobj"; then
10933 RANLIB=$save_RANLIB
10935 test -z "$concat_cmds" || concat_cmds=$concat_cmds~
10936 eval concat_cmds=\"\$concat_cmds$old_archive_cmds\"
10941 RANLIB=$save_RANLIB
10943 if test -z "$oldobjs"; then
10944 eval cmds=\"\$concat_cmds\"
10946 eval cmds=\"\$concat_cmds~\$old_archive_cmds\"
10950 func_execute_cmds "$cmds" 'exit $?'
10953 test -n "$generated" && \
10954 func_show_eval "${RM}r$generated"
10956 # Now create the libtool archive.
10960 test yes = "$build_old_libs" && old_library=$libname.$libext
10961 func_verbose "creating $output"
10963 # Preserve any variables that may affect compiler behavior
10964 for var in $variables_saved_for_relink; do
10965 if eval test -z \"\${$var+set}\"; then
10966 relink_command="{ test -z \"\${$var+set}\" || $lt_unset $var || { $var=; export $var; }; }; $relink_command"
10967 elif eval var_value=\$$var; test -z "$var_value"; then
10968 relink_command="$var=; export $var; $relink_command"
10970 func_quote_arg pretty,unquoted "$var_value"
10971 relink_command="$var=$func_quote_arg_unquoted_result; export $var; $relink_command"
10974 # Quote the link command for shipping.
10975 func_quote eval cd "`pwd`"
10976 relink_command="($func_quote_result; $SHELL \"$progpath\" $preserve_args --mode=relink $libtool_args @inst_prefix_dir@)"
10977 func_quote_arg pretty,unquoted "$relink_command"
10978 relink_command=$func_quote_arg_unquoted_result
10979 if test yes = "$hardcode_automatic"; then
10983 # Only create the output if not a dry run.
10985 for installed in no yes; do
10986 if test yes = "$installed"; then
10987 if test -z "$install_libdir"; then
10990 output=$output_objdir/${outputname}i
10991 # Replace all uninstalled libtool libraries with the installed ones
10992 newdependency_libs=
10993 for deplib in $dependency_libs; do
10996 func_basename "$deplib"
10997 name=$func_basename_result
10998 func_resolve_sysroot "$deplib"
10999 eval libdir=`$SED -n -e 's/^libdir=\(.*\)$/\1/p' $func_resolve_sysroot_result`
11000 test -z "$libdir" && \
11001 func_fatal_error "'$deplib' is not a valid libtool archive"
11002 func_append newdependency_libs " ${lt_sysroot:+=}$libdir/$name"
11005 func_stripname -L '' "$deplib"
11006 func_replace_sysroot "$func_stripname_result"
11007 func_append newdependency_libs " -L$func_replace_sysroot_result"
11010 func_stripname -R '' "$deplib"
11011 func_replace_sysroot "$func_stripname_result"
11012 func_append newdependency_libs " -R$func_replace_sysroot_result"
11014 *) func_append newdependency_libs " $deplib" ;;
11017 dependency_libs=$newdependency_libs
11020 for lib in $dlfiles; do
11023 func_basename "$lib"
11024 name=$func_basename_result
11025 eval libdir=`$SED -n -e 's/^libdir=\(.*\)$/\1/p' $lib`
11026 test -z "$libdir" && \
11027 func_fatal_error "'$lib' is not a valid libtool archive"
11028 func_append newdlfiles " ${lt_sysroot:+=}$libdir/$name"
11030 *) func_append newdlfiles " $lib" ;;
11033 dlfiles=$newdlfiles
11035 for lib in $dlprefiles; do
11038 # Only pass preopened files to the pseudo-archive (for
11039 # eventual linking with the app. that links it) if we
11040 # didn't already link the preopened objects directly into
11042 func_basename "$lib"
11043 name=$func_basename_result
11044 eval libdir=`$SED -n -e 's/^libdir=\(.*\)$/\1/p' $lib`
11045 test -z "$libdir" && \
11046 func_fatal_error "'$lib' is not a valid libtool archive"
11047 func_append newdlprefiles " ${lt_sysroot:+=}$libdir/$name"
11051 dlprefiles=$newdlprefiles
11054 for lib in $dlfiles; do
11056 [\\/]* | [A-Za-z]:[\\/]*) abs=$lib ;;
11057 *) abs=`pwd`"/$lib" ;;
11059 func_append newdlfiles " $abs"
11061 dlfiles=$newdlfiles
11063 for lib in $dlprefiles; do
11065 [\\/]* | [A-Za-z]:[\\/]*) abs=$lib ;;
11066 *) abs=`pwd`"/$lib" ;;
11068 func_append newdlprefiles " $abs"
11070 dlprefiles=$newdlprefiles
11073 # place dlname in correct position for cygwin
11074 # In fact, it would be nice if we could use this code for all target
11075 # systems that can't hard-code library paths into their executables
11076 # and that have no shared library path variable independent of PATH,
11077 # but it turns out we can't easily determine that from inspecting
11078 # libtool variables, so we have to hard-code the OSs to which it
11079 # applies here; at the moment, that means platforms that use the PE
11080 # object format with DLL files. See the long comment at the top of
11081 # tests/bindir.at for full details.
11083 case $host,$output,$installed,$module,$dlname in
11084 *cygwin*,*lai,yes,no,*.dll | *mingw*,*lai,yes,no,*.dll | *cegcc*,*lai,yes,no,*.dll)
11085 # If a -bindir argument was supplied, place the dll there.
11086 if test -n "$bindir"; then
11087 func_relative_path "$install_libdir" "$bindir"
11088 tdlname=$func_relative_path_result/$dlname
11090 # Otherwise fall back on heuristic.
11091 tdlname=../bin/$dlname
11096 # $outputname - a libtool library file
11097 # Generated by $PROGRAM (GNU $PACKAGE) $VERSION
11099 # Please DO NOT delete this file!
11100 # It is necessary for linking the library.
11102 # The name that we can dlopen(3).
11105 # Names of this library.
11106 library_names='$library_names'
11108 # The name of the static archive.
11109 old_library='$old_library'
11111 # Linker flags that cannot go in dependency_libs.
11112 inherited_linker_flags='$new_inherited_linker_flags'
11114 # Libraries that this one depends upon.
11115 dependency_libs='$dependency_libs'
11117 # Names of additional weak libraries provided by this library
11118 weak_library_names='$weak_libs'
11120 # Version information for $libname.
11125 # Is this an already installed library?
11126 installed=$installed
11128 # Should we warn about portability when linking against -modules?
11129 shouldnotlink=$module
11131 # Files to dlopen/dlpreopen
11133 dlpreopen='$dlprefiles'
11135 # Directory that this library needs to be installed in:
11136 libdir='$install_libdir'"
11137 if test no,yes = "$installed,$need_relink"; then
11138 $ECHO >> $output "\
11139 relink_command=\"$relink_command\""
11144 # Do a symbolic link so that the libtool archive can be found in
11145 # LD_LIBRARY_PATH before the program is installed.
11146 func_show_eval '( cd "$output_objdir" && $RM "$outputname" && $LN_S "../$outputname" "$outputname" )' 'exit $?'
11152 if test link = "$opt_mode" || test relink = "$opt_mode"; then
11153 func_mode_link ${1+"$@"}
11157 # func_mode_uninstall arg...
11158 func_mode_uninstall ()
11167 # This variable tells wrapper scripts just to set variables rather
11168 # than running their programs.
11169 libtool_install_magic=$magic
11174 -f) func_append RM " $arg"; rmforce=: ;;
11175 -*) func_append RM " $arg" ;;
11176 *) func_append files " $arg" ;;
11181 func_fatal_help "you must specify an RM program"
11185 for file in $files; do
11186 func_dirname "$file" "" "."
11187 dir=$func_dirname_result
11188 if test . = "$dir"; then
11193 func_basename "$file"
11194 name=$func_basename_result
11195 test uninstall = "$opt_mode" && odir=$dir
11197 # Remember odir for removal later, being careful to avoid duplicates
11198 if test clean = "$opt_mode"; then
11199 case " $rmdirs " in
11201 *) func_append rmdirs " $odir" ;;
11205 # Don't error if the file doesn't exist and rm -f was used.
11206 if { test -L "$file"; } >/dev/null 2>&1 ||
11207 { test -h "$file"; } >/dev/null 2>&1 ||
11208 test -f "$file"; then
11210 elif test -d "$file"; then
11213 elif $rmforce; then
11221 # Possibly a libtool archive, so verify it.
11222 if func_lalib_p "$file"; then
11223 func_source $dir/$name
11225 # Delete the libtool libraries and symlinks.
11226 for n in $library_names; do
11227 func_append rmfiles " $odir/$n"
11229 test -n "$old_library" && func_append rmfiles " $odir/$old_library"
11233 case " $library_names " in
11235 *) test -n "$dlname" && func_append rmfiles " $odir/$dlname" ;;
11237 test -n "$libdir" && func_append rmfiles " $odir/$name $odir/${name}i"
11240 if test -n "$library_names"; then
11241 # Do each command in the postuninstall commands.
11242 func_execute_cmds "$postuninstall_cmds" '$rmforce || exit_status=1'
11245 if test -n "$old_library"; then
11246 # Do each command in the old_postuninstall commands.
11247 func_execute_cmds "$old_postuninstall_cmds" '$rmforce || exit_status=1'
11249 # FIXME: should reinstall the best remaining shared library.
11256 # Possibly a libtool object, so verify it.
11257 if func_lalib_p "$file"; then
11259 # Read the .lo file
11260 func_source $dir/$name
11262 # Add PIC object to the list of files to remove.
11263 if test -n "$pic_object" && test none != "$pic_object"; then
11264 func_append rmfiles " $dir/$pic_object"
11267 # Add non-PIC object to the list of files to remove.
11268 if test -n "$non_pic_object" && test none != "$non_pic_object"; then
11269 func_append rmfiles " $dir/$non_pic_object"
11275 if test clean = "$opt_mode"; then
11279 func_stripname '' '.exe' "$file"
11280 file=$func_stripname_result
11281 func_stripname '' '.exe' "$name"
11282 noexename=$func_stripname_result
11283 # $file with .exe has already been added to rmfiles,
11284 # add $file without .exe
11285 func_append rmfiles " $file"
11288 # Do a test to see if this is a libtool program.
11289 if func_ltwrapper_p "$file"; then
11290 if func_ltwrapper_executable_p "$file"; then
11291 func_ltwrapper_scriptname "$file"
11293 func_source $func_ltwrapper_scriptname_result
11294 func_append rmfiles " $func_ltwrapper_scriptname_result"
11297 func_source $dir/$noexename
11300 # note $name still contains .exe if it was in $file originally
11301 # as does the version of $file that was added into $rmfiles
11302 func_append rmfiles " $odir/$name $odir/${name}S.$objext"
11303 if test yes = "$fast_install" && test -n "$relink_command"; then
11304 func_append rmfiles " $odir/lt-$name"
11306 if test "X$noexename" != "X$name"; then
11307 func_append rmfiles " $odir/lt-$noexename.c"
11313 func_show_eval "$RM $rmfiles" 'exit_status=1'
11316 # Try to remove the $objdir's in the directories where we deleted files
11317 for dir in $rmdirs; do
11318 if test -d "$dir"; then
11319 func_show_eval "rmdir $dir >/dev/null 2>&1"
11326 if test uninstall = "$opt_mode" || test clean = "$opt_mode"; then
11327 func_mode_uninstall ${1+"$@"}
11330 test -z "$opt_mode" && {
11332 func_fatal_help "you must specify a MODE"
11335 test -z "$exec_cmd" && \
11336 func_fatal_help "invalid operation mode '$opt_mode'"
11338 if test -n "$exec_cmd"; then
11339 eval exec "$exec_cmd"
11346 # The TAGs below are defined such that we never get into a situation
11347 # where we disable both kinds of libraries. Given conflicting
11348 # choices, we go for a static library, that is the most portable,
11349 # since we can't tell whether shared libraries were disabled because
11350 # the user asked for that or because the platform doesn't support
11351 # them. This is particularly important on AIX, because we don't
11352 # support having both static and shared libraries enabled at the same
11353 # time on that platform, so we default to a shared-only configuration.
11354 # If a disable-shared tag is given, we'll fallback to a static-only
11355 # configuration. But we'll never go from static-only to shared-only.
11357 # ### BEGIN LIBTOOL TAG CONFIG: disable-shared
11358 build_libtool_libs=no
11360 # ### END LIBTOOL TAG CONFIG: disable-shared
11362 # ### BEGIN LIBTOOL TAG CONFIG: disable-static
11363 build_old_libs=`case $build_libtool_libs in yes) echo no;; *) echo yes;; esac`
11364 # ### END LIBTOOL TAG CONFIG: disable-static
11367 # mode:shell-script