2 ## DO NOT EDIT - This file generated from ./build-aux/ltmain.in
3 ## by inline-source v2019-02-19.15
5 # libtool (GNU libtool) 2.4.6
6 # Provide generalized library-building support services.
7 # Written by Gordon Matzigkeit <gord@gnu.ai.mit.edu>, 1996
9 # Copyright (C) 1996-2019 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/>.
35 package_revision=2.4.6
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=2019-02-19.15; # 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-2019 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 if test : = "$opt_dry_run"; then
903 # Return a directory name, but don't create it in dry-run mode
904 _G_mktemp='mktemp -dtu'
906 _G_mktemp='mktemp -dt'
909 _G_tmpdir=`$_G_mktemp "${1-$progname}-XXXXXXXX"` || \
910 func_fatal_error "cannot create temporary directory"
916 # func_normal_abspath PATH
917 # ------------------------
918 # Remove doubled-up and trailing slashes, "." path components,
919 # and cancel out any ".." path components in PATH after making
920 # it an absolute path.
921 func_normal_abspath ()
925 # These SED scripts presuppose an absolute path with a trailing slash.
926 _G_pathcar='s|^/\([^/]*\).*$|\1|'
927 _G_pathcdr='s|^/[^/]*||'
928 _G_removedotparts=':dotsl
932 _G_collapseslashes='s|/\{1,\}|/|g'
933 _G_finalslash='s|/*$|/|'
935 # Start from root dir and reassemble the path.
936 func_normal_abspath_result=
937 func_normal_abspath_tpath=$1
938 func_normal_abspath_altnamespace=
939 case $func_normal_abspath_tpath in
941 # Empty path, that just means $cwd.
942 func_stripname '' '/' "`pwd`"
943 func_normal_abspath_result=$func_stripname_result
946 # The next three entries are used to spot a run of precisely
947 # two leading slashes without using negated character classes;
948 # we take advantage of case's first-match behaviour.
950 # Unusual form of absolute path, do nothing.
953 # Not necessarily an ordinary path; POSIX reserves leading '//'
954 # and for example Cygwin uses it to access remote file shares
955 # over CIFS/SMB, so we conserve a leading double slash if found.
956 func_normal_abspath_altnamespace=/
959 # Absolute path, do nothing.
962 # Relative path, prepend $cwd.
963 func_normal_abspath_tpath=`pwd`/$func_normal_abspath_tpath
967 # Cancel out all the simple stuff to save iterations. We also want
968 # the path to end with a slash for ease of parsing, so make sure
969 # there is one (and only one) here.
970 func_normal_abspath_tpath=`$ECHO "$func_normal_abspath_tpath" | $SED \
971 -e "$_G_removedotparts" -e "$_G_collapseslashes" -e "$_G_finalslash"`
973 # Processed it all yet?
974 if test / = "$func_normal_abspath_tpath"; then
975 # If we ascended to the root using ".." the result may be empty now.
976 if test -z "$func_normal_abspath_result"; then
977 func_normal_abspath_result=/
981 func_normal_abspath_tcomponent=`$ECHO "$func_normal_abspath_tpath" | $SED \
983 func_normal_abspath_tpath=`$ECHO "$func_normal_abspath_tpath" | $SED \
985 # Figure out what to do with it
986 case $func_normal_abspath_tcomponent in
988 # Trailing empty path component, ignore it.
991 # Parent dir; strip last assembled component from result.
992 func_dirname "$func_normal_abspath_result"
993 func_normal_abspath_result=$func_dirname_result
996 # Actual path component, append it.
997 func_append func_normal_abspath_result "/$func_normal_abspath_tcomponent"
1001 # Restore leading double-slash if one was found on entry.
1002 func_normal_abspath_result=$func_normal_abspath_altnamespace$func_normal_abspath_result
1006 # func_notquiet ARG...
1007 # --------------------
1008 # Echo program name prefixed message only when not in quiet mode.
1013 $opt_quiet || func_echo ${1+"$@"}
1015 # A bug in bash halts the script if the last line of a function
1016 # fails when set -e is in force, so we need another command to
1022 # func_relative_path SRCDIR DSTDIR
1023 # --------------------------------
1024 # Set func_relative_path_result to the relative path from SRCDIR to DSTDIR.
1025 func_relative_path ()
1029 func_relative_path_result=
1030 func_normal_abspath "$1"
1031 func_relative_path_tlibdir=$func_normal_abspath_result
1032 func_normal_abspath "$2"
1033 func_relative_path_tbindir=$func_normal_abspath_result
1035 # Ascend the tree starting from libdir
1037 # check if we have found a prefix of bindir
1038 case $func_relative_path_tbindir in
1039 $func_relative_path_tlibdir)
1040 # found an exact match
1041 func_relative_path_tcancelled=
1044 $func_relative_path_tlibdir*)
1045 # found a matching prefix
1046 func_stripname "$func_relative_path_tlibdir" '' "$func_relative_path_tbindir"
1047 func_relative_path_tcancelled=$func_stripname_result
1048 if test -z "$func_relative_path_result"; then
1049 func_relative_path_result=.
1054 func_dirname $func_relative_path_tlibdir
1055 func_relative_path_tlibdir=$func_dirname_result
1056 if test -z "$func_relative_path_tlibdir"; then
1057 # Have to descend all the way to the root!
1058 func_relative_path_result=../$func_relative_path_result
1059 func_relative_path_tcancelled=$func_relative_path_tbindir
1062 func_relative_path_result=../$func_relative_path_result
1067 # Now calculate path; take care to avoid doubling-up slashes.
1068 func_stripname '' '/' "$func_relative_path_result"
1069 func_relative_path_result=$func_stripname_result
1070 func_stripname '/' '/' "$func_relative_path_tcancelled"
1071 if test -n "$func_stripname_result"; then
1072 func_append func_relative_path_result "/$func_stripname_result"
1075 # Normalisation. If bindir is libdir, return '.' else relative path.
1076 if test -n "$func_relative_path_result"; then
1077 func_stripname './' '' "$func_relative_path_result"
1078 func_relative_path_result=$func_stripname_result
1081 test -n "$func_relative_path_result" || func_relative_path_result=.
1087 # func_quote_portable EVAL ARG
1088 # ----------------------------
1089 # Internal function to portably implement func_quote_arg. Note that we still
1090 # keep attention to performance here so we as much as possible try to avoid
1091 # calling sed binary (so far O(N) complexity as long as func_append is O(1)).
1092 func_quote_portable ()
1096 func_quote_portable_result=$2
1098 # one-time-loop (easy break)
1102 func_quote_portable_result=`$ECHO "$2" | $SED \
1103 -e "$sed_double_quote_subst" -e "$sed_double_backslash"`
1108 case $func_quote_portable_result in
1110 case $func_quote_portable_result in
1112 func_quote_portable_result=`$ECHO "$func_quote_portable_result" \
1113 | $SED "$sed_quote_subst"`
1118 func_quote_portable_old_IFS=$IFS
1119 for _G_char in '\' '`' '"' '$'
1121 # STATE($1) PREV($2) SEPARATOR($3)
1123 func_quote_portable_result=dummy"$_G_char$func_quote_portable_result$_G_char"dummy
1125 for _G_part in $func_quote_portable_result
1129 func_append func_quote_portable_result "$3$2"
1130 set quote "$_G_part" "\\$_G_char"
1134 func_quote_portable_result=
1137 set quote "$_G_part" ""
1142 IFS=$func_quote_portable_old_IFS
1149 func_quote_portable_unquoted_result=$func_quote_portable_result
1150 case $func_quote_portable_result in
1151 # double-quote args containing shell metacharacters to delay
1152 # word splitting, command substitution and variable expansion
1153 # for a subsequent eval.
1154 # many bourne shells cannot handle close brackets correctly
1155 # in scan sets, so we specify it separately.
1156 *[\[\~\#\^\&\*\(\)\{\}\|\;\<\>\?\'\ \ ]*|*]*|"")
1157 func_quote_portable_result=\"$func_quote_portable_result\"
1163 # func_quotefast_eval ARG
1164 # -----------------------
1165 # Quote one ARG (internal). This is equivalent to 'func_quote_arg eval ARG',
1166 # but optimized for speed. Result is stored in $func_quotefast_eval.
1167 if test xyes = `(x=; printf -v x %q yes; echo x"$x") 2>/dev/null`; then
1168 printf -v _GL_test_printf_tilde %q '~'
1169 if test '\~' = "$_GL_test_printf_tilde"; then
1170 func_quotefast_eval ()
1172 printf -v func_quotefast_eval_result %q "$1"
1175 # Broken older Bash implementations. Make those faster too if possible.
1176 func_quotefast_eval ()
1180 func_quote_portable false "$1"
1181 func_quotefast_eval_result=$func_quote_portable_result
1184 printf -v func_quotefast_eval_result %q "$1"
1190 func_quotefast_eval ()
1192 func_quote_portable false "$1"
1193 func_quotefast_eval_result=$func_quote_portable_result
1198 # func_quote_arg MODEs ARG
1199 # ------------------------
1200 # Quote one ARG to be evaled later. MODEs argument may contain zero or more
1201 # specifiers listed below separated by ',' character. This function returns two
1203 # i) func_quote_arg_result
1204 # double-quoted (when needed), suitable for a subsequent eval
1205 # ii) func_quote_arg_unquoted_result
1206 # has all characters that are still active within double
1207 # quotes backslashified. Available only if 'unquoted' is specified.
1212 # - escape shell special characters
1214 # - the same as 'eval'; but do not quote variable references
1216 # - request aesthetic output, i.e. '"a b"' instead of 'a\ b'. This might
1217 # be used later in func_quote to get output like: 'echo "a b"' instead
1218 # of 'echo a\ b'. This is slower than default on some shells.
1220 # - produce also $func_quote_arg_unquoted_result which does not contain
1221 # wrapping double-quotes.
1223 # Examples for 'func_quote_arg pretty,unquoted string':
1225 # string | *_result | *_unquoted_result
1226 # ------------+-----------------------+-------------------
1229 # "a b" | "\"a b\"" | \"a b\"
1231 # z="${x-$y}" | "z=\"\${x-\$y}\"" | z=\"\${x-\$y}\"
1233 # Examples for 'func_quote_arg pretty,unquoted,expand string':
1235 # string | *_result | *_unquoted_result
1236 # --------------+---------------------+--------------------
1237 # z="${x-$y}" | "z=\"${x-$y}\"" | z=\"${x-$y}\"
1240 _G_quote_expand=false
1248 *,pretty,*|*,expand,*|*,unquoted,*)
1249 func_quote_portable $_G_quote_expand "$2"
1250 func_quote_arg_result=$func_quote_portable_result
1251 func_quote_arg_unquoted_result=$func_quote_portable_unquoted_result
1254 # Faster quote-for-eval for some shells.
1255 func_quotefast_eval "$2"
1256 func_quote_arg_result=$func_quotefast_eval_result
1262 # func_quote MODEs ARGs...
1263 # ------------------------
1264 # Quote all ARGs to be evaled later and join them into single command. See
1265 # func_quote_arg's description for more info.
1269 _G_func_quote_mode=$1 ; shift
1271 while test 0 -lt $#; do
1272 func_quote_arg "$_G_func_quote_mode" "$1"
1273 if test -n "$func_quote_result"; then
1274 func_append func_quote_result " $func_quote_arg_result"
1276 func_append func_quote_result "$func_quote_arg_result"
1283 # func_stripname PREFIX SUFFIX NAME
1284 # ---------------------------------
1285 # strip PREFIX and SUFFIX from NAME, and store in func_stripname_result.
1286 # PREFIX and SUFFIX must not contain globbing or regex special
1287 # characters, hashes, percent signs, but SUFFIX may contain a leading
1288 # dot (in which case that matches only a dot).
1289 if test yes = "$_G_HAVE_XSI_OPS"; then
1290 eval 'func_stripname ()
1294 # pdksh 5.2.14 does not do ${X%$Y} correctly if both X and Y are
1295 # positional parameters, so assign one to ordinary variable first.
1296 func_stripname_result=$3
1297 func_stripname_result=${func_stripname_result#"$1"}
1298 func_stripname_result=${func_stripname_result%"$2"}
1306 .*) func_stripname_result=`$ECHO "$3" | $SED -e "s%^$1%%" -e "s%\\\\$2\$%%"`;;
1307 *) func_stripname_result=`$ECHO "$3" | $SED -e "s%^$1%%" -e "s%$2\$%%"`;;
1313 # func_show_eval CMD [FAIL_EXP]
1314 # -----------------------------
1315 # Unless opt_quiet is true, then output CMD. Then, if opt_dryrun is
1316 # not true, evaluate CMD. If the evaluation of CMD fails, and FAIL_EXP
1317 # is given, then evaluate it.
1323 _G_fail_exp=${2-':'}
1325 func_quote_arg pretty,expand "$_G_cmd"
1326 eval "func_notquiet $func_quote_arg_result"
1331 if test 0 -ne "$_G_status"; then
1332 eval "(exit $_G_status); $_G_fail_exp"
1338 # func_show_eval_locale CMD [FAIL_EXP]
1339 # ------------------------------------
1340 # Unless opt_quiet is true, then output CMD. Then, if opt_dryrun is
1341 # not true, evaluate CMD. If the evaluation of CMD fails, and FAIL_EXP
1342 # is given, then evaluate it. Use the saved locale for evaluation.
1343 func_show_eval_locale ()
1348 _G_fail_exp=${2-':'}
1351 func_quote_arg expand,pretty "$_G_cmd"
1352 eval "func_echo $func_quote_arg_result"
1356 eval "$_G_user_locale
1359 eval "$_G_safe_locale"
1360 if test 0 -ne "$_G_status"; then
1361 eval "(exit $_G_status); $_G_fail_exp"
1369 # Turn $1 into a string suitable for a shell variable name.
1370 # Result is stored in $func_tr_sh_result. All characters
1371 # not in the set a-zA-Z0-9_ are replaced with '_'. Further,
1372 # if $1 begins with a digit, a '_' is prepended as well.
1378 [0-9]* | *[!a-zA-Z0-9_]*)
1379 func_tr_sh_result=`$ECHO "$1" | $SED -e 's/^\([0-9]\)/_\1/' -e 's/[^a-zA-Z0-9_]/_/g'`
1382 func_tr_sh_result=$1
1388 # func_verbose ARG...
1389 # -------------------
1390 # Echo program name prefixed message in verbose mode only.
1395 $opt_verbose && func_echo "$*"
1401 # func_warn_and_continue ARG...
1402 # -----------------------------
1403 # Echo program name prefixed warning message to standard error.
1404 func_warn_and_continue ()
1408 $require_term_colors
1410 func_echo_infix_1 "${tc_red}warning$tc_reset" "$*" >&2
1414 # func_warning CATEGORY ARG...
1415 # ----------------------------
1416 # Echo program name prefixed warning message to standard error. Warning
1417 # messages can be filtered according to CATEGORY, where this function
1418 # elides messages where CATEGORY is not listed in the global variable
1419 # 'opt_warning_types'.
1424 # CATEGORY must be in the warning_categories list!
1425 case " $warning_categories " in
1427 *) func_internal_error "invalid warning category '$1'" ;;
1433 case " $opt_warning_types " in
1434 *" $_G_category "*) $warning_func ${1+"$@"} ;;
1439 # func_sort_ver VER1 VER2
1440 # -----------------------
1441 # 'sort -V' is not generally available.
1442 # Note this deviates from the version comparison in automake
1443 # in that it treats 1.5 < 1.5.0, and treats 1.4.4a < 1.4-p3a
1444 # but this should suffice as we won't be specifying old
1445 # version formats or redundant trailing .0 in bootstrap.conf.
1446 # If we did want full compatibility then we should probably
1447 # use m4_version_compare from autoconf.
1452 printf '%s\n%s\n' "$1" "$2" \
1453 | 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
1456 # func_lt_ver PREV CURR
1457 # ---------------------
1458 # Return true if PREV and CURR are in the correct order according to
1459 # func_sort_ver, otherwise false. Use it like this:
1461 # func_lt_ver "$prev_ver" "$proposed_ver" || func_fatal_error "..."
1466 test "x$1" = x`func_sort_ver "$1" "$2" | $SED 1q`
1471 # mode: shell-script
1473 # eval: (add-hook 'before-save-hook 'time-stamp)
1474 # time-stamp-pattern: "10/scriptversion=%:y-%02m-%02d.%02H; # UTC"
1475 # time-stamp-time-zone: "UTC"
1479 # A portable, pluggable option parser for Bourne shell.
1480 # Written by Gary V. Vaughan, 2010
1482 # This is free software. There is NO warranty; not even for
1483 # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
1485 # Copyright (C) 2010-2019 Bootstrap Authors
1487 # This file is dual licensed under the terms of the MIT license
1488 # <https://opensource.org/license/MIT>, and GPL version 3 or later
1489 # <http://www.gnu.org/licenses/gpl-2.0.html>. You must apply one of
1490 # these licenses when using or redistributing this software or any of
1491 # the files within it. See the URLs above, or the file `LICENSE`
1492 # included in the Bootstrap distribution for the full license texts.
1494 # Please report bugs or propose patches to:
1495 # <https://github.com/gnulib-modules/bootstrap/issues>
1497 # Set a version string for this script.
1498 scriptversion=2019-02-19.15; # UTC
1505 # This file is a library for parsing options in your shell scripts along
1506 # with assorted other useful supporting features that you can make use
1509 # For the simplest scripts you might need only:
1512 # . relative/path/to/funclib.sh
1513 # . relative/path/to/options-parser
1515 # func_options ${1+"$@"}
1516 # eval set dummy "$func_options_result"; shift
1517 # ...rest of your script...
1519 # In order for the '--version' option to work, you will need to have a
1520 # suitably formatted comment like the one at the top of this file
1521 # starting with '# Written by ' and ending with '# Copyright'.
1523 # For '-h' and '--help' to work, you will also need a one line
1524 # description of your script's purpose in a comment directly above the
1525 # '# Written by ' line, like the one at the top of this file.
1527 # The default options also support '--debug', which will turn on shell
1528 # execution tracing (see the comment above debug_cmd below for another
1529 # use), and '--verbose' and the func_verbose function to allow your script
1530 # to display verbose messages only when your user has specified
1533 # After sourcing this file, you can plug in processing for additional
1534 # options by amending the variables from the 'Configuration' section
1535 # below, and following the instructions in the 'Option parsing'
1536 # section further down.
1538 ## -------------- ##
1539 ## Configuration. ##
1540 ## -------------- ##
1542 # You should override these variables in your script after sourcing this
1543 # file so that they reflect the customisations you have added to the
1546 # The usage line for option parsing errors and the start of '-h' and
1547 # '--help' output messages. You can embed shell variables for delayed
1548 # expansion at the time the message is displayed, but you will need to
1549 # quote other shell meta-characters carefully to prevent them being
1550 # expanded when the contents are evaled.
1551 usage='$progpath [OPTION]...'
1553 # Short help message in response to '-h' and '--help'. Add to this or
1554 # override it after sourcing this library to reflect the full set of
1555 # options your script accepts.
1557 --debug enable verbose shell tracing
1558 -W, --warnings=CATEGORY
1559 report the warnings falling in CATEGORY [all]
1560 -v, --verbose verbosely report processing
1561 --version print version information and exit
1562 -h, --help print short or long help message and exit
1565 # Additional text appended to 'usage_message' in response to '--help'.
1567 Warning categories include:
1568 'all' show all warnings
1569 'none' turn off all the warnings
1570 'error' warnings are treated as fatal errors"
1572 # Help message printed before fatal option parsing errors.
1573 fatal_help="Try '\$progname --help' for more information."
1577 ## ------------------------- ##
1578 ## Hook function management. ##
1579 ## ------------------------- ##
1581 # This section contains functions for adding, removing, and running hooks
1582 # in the main code. A hook is just a list of function names that can be
1583 # run in order later on.
1585 # func_hookable FUNC_NAME
1586 # -----------------------
1587 # Declare that FUNC_NAME will run hooks added with
1588 # 'func_add_hook FUNC_NAME ...'.
1593 func_append hookable_fns " $1"
1597 # func_add_hook FUNC_NAME HOOK_FUNC
1598 # ---------------------------------
1599 # Request that FUNC_NAME call HOOK_FUNC before it returns. FUNC_NAME must
1600 # first have been declared "hookable" by a call to 'func_hookable'.
1605 case " $hookable_fns " in
1607 *) func_fatal_error "'$1' does not accept hook functions." ;;
1610 eval func_append ${1}_hooks '" $2"'
1614 # func_remove_hook FUNC_NAME HOOK_FUNC
1615 # ------------------------------------
1616 # Remove HOOK_FUNC from the list of hook functions to be called by
1622 eval ${1}_hooks='`$ECHO "\$'$1'_hooks" |$SED "s| '$2'||"`'
1626 # func_propagate_result FUNC_NAME_A FUNC_NAME_B
1627 # ---------------------------------------------
1628 # If the *_result variable of FUNC_NAME_A _is set_, assign its value to
1629 # *_result variable of FUNC_NAME_B.
1630 func_propagate_result ()
1634 func_propagate_result_result=:
1635 if eval "test \"\${${1}_result+set}\" = set"
1637 eval "${2}_result=\$${1}_result"
1639 func_propagate_result_result=false
1644 # func_run_hooks FUNC_NAME [ARG]...
1645 # ---------------------------------
1646 # Run all hook functions registered to FUNC_NAME.
1647 # It's assumed that the list of hook functions contains nothing more
1648 # than a whitespace-delimited list of legal shell function names, and
1649 # no effort is wasted trying to catch shell meta-characters or preserve
1655 case " $hookable_fns " in
1657 *) func_fatal_error "'$1' does not support hook functions." ;;
1660 eval _G_hook_fns=\$$1_hooks; shift
1662 for _G_hook in $_G_hook_fns; do
1663 func_unset "${_G_hook}_result"
1664 eval $_G_hook '${1+"$@"}'
1665 func_propagate_result $_G_hook func_run_hooks
1666 if $func_propagate_result_result; then
1667 eval set dummy "$func_run_hooks_result"; shift
1674 ## --------------- ##
1675 ## Option parsing. ##
1676 ## --------------- ##
1678 # In order to add your own option parsing hooks, you must accept the
1679 # full positional parameter list from your hook function. You may remove
1680 # or edit any options that you action, and then pass back the remaining
1681 # unprocessed options in '<hooked_function_name>_result', escaped
1682 # suitably for 'eval'.
1684 # The '<hooked_function_name>_result' variable is automatically unset
1685 # before your hook gets called; for best performance, only set the
1686 # *_result variable when necessary (i.e. don't call the 'func_quote'
1687 # function unnecessarily because it can be an expensive operation on some
1692 # my_options_prep ()
1696 # # Extend the existing usage message.
1697 # usage_message=$usage_message'
1698 # -s, --silent don'\''t print informational messages
1700 # # No change in '$@' (ignored completely by this hook). Leave
1701 # # my_options_prep_result variable intact.
1703 # func_add_hook func_options_prep my_options_prep
1706 # my_silent_option ()
1710 # args_changed=false
1712 # # Note that, for efficiency, we parse as many options as we can
1713 # # recognise in a loop before passing the remainder back to the
1714 # # caller on the first unrecognised argument we encounter.
1715 # while test $# -gt 0; do
1718 # --silent|-s) opt_silent=:
1721 # # Separate non-argument short options:
1722 # -s*) func_split_short_opt "$_G_opt"
1723 # set dummy "$func_split_short_opt_name" \
1724 # "-$func_split_short_opt_arg" ${1+"$@"}
1728 # *) # Make sure the first unrecognised option "$_G_opt"
1729 # # is added back to "$@" in case we need it later,
1730 # # if $args_changed was set to 'true'.
1731 # set dummy "$_G_opt" ${1+"$@"}; shift; break ;;
1735 # # Only call 'func_quote' here if we processed at least one argument.
1736 # if $args_changed; then
1737 # func_quote eval ${1+"$@"}
1738 # my_silent_option_result=$func_quote_result
1741 # func_add_hook func_parse_options my_silent_option
1744 # my_option_validation ()
1748 # $opt_silent && $opt_verbose && func_fatal_help "\
1749 # '--silent' and '--verbose' options are mutually exclusive."
1751 # func_add_hook func_validate_options my_option_validation
1753 # You'll also need to manually amend $usage_message to reflect the extra
1754 # options you parse. It's preferable to append if you can, so that
1755 # multiple option parsing hooks can be added safely.
1758 # func_options_finish [ARG]...
1759 # ----------------------------
1760 # Finishing the option parse loop (call 'func_options' hooks ATM).
1761 func_options_finish ()
1765 func_run_hooks func_options ${1+"$@"}
1766 func_propagate_result func_run_hooks func_options_finish
1770 # func_options [ARG]...
1771 # ---------------------
1772 # All the functions called inside func_options are hookable. See the
1773 # individual implementations for details.
1774 func_hookable func_options
1779 _G_options_quoted=false
1781 for my_func in options_prep parse_options validate_options options_finish
1783 func_unset func_${my_func}_result
1784 func_unset func_run_hooks_result
1785 eval func_$my_func '${1+"$@"}'
1786 func_propagate_result func_$my_func func_options
1787 if $func_propagate_result_result; then
1788 eval set dummy "$func_options_result"; shift
1793 $_G_options_quoted || {
1794 # As we (func_options) are top-level options-parser function and
1795 # nobody quoted "$@" for us yet, we need to do it explicitly for
1797 func_quote eval ${1+"$@"}
1798 func_options_result=$func_quote_result
1803 # func_options_prep [ARG]...
1804 # --------------------------
1805 # All initialisations required before starting the option parse loop.
1806 # Note that when calling hook functions, we pass through the list of
1807 # positional parameters. If a hook function modifies that list, and
1808 # needs to propagate that back to rest of this script, then the complete
1809 # modified list must be put in 'func_run_hooks_result' before returning.
1810 func_hookable func_options_prep
1811 func_options_prep ()
1819 func_run_hooks func_options_prep ${1+"$@"}
1820 func_propagate_result func_run_hooks func_options_prep
1824 # func_parse_options [ARG]...
1825 # ---------------------------
1826 # The main option parsing loop.
1827 func_hookable func_parse_options
1828 func_parse_options ()
1832 _G_parse_options_requote=false
1833 # this just eases exit handling
1834 while test $# -gt 0; do
1835 # Defer to hook functions for initial option parsing, so they
1836 # get priority in the event of reusing an option name.
1837 func_run_hooks func_parse_options ${1+"$@"}
1838 func_propagate_result func_run_hooks func_parse_options
1839 if $func_propagate_result_result; then
1840 eval set dummy "$func_parse_options_result"; shift
1841 # Even though we may have changed "$@", we passed the "$@" array
1842 # down into the hook and it quoted it for us (because we are in
1843 # this if-branch). No need to quote it again.
1844 _G_parse_options_requote=false
1847 # Break out of the loop if we already parsed every option.
1848 test $# -gt 0 || break
1850 # We expect that one of the options parsed in this function matches
1851 # and thus we remove _G_opt from "$@" and need to re-quote.
1852 _G_match_parse_options=:
1856 --debug|-x) debug_cmd='set -x'
1857 func_echo "enabling shell trace mode" >&2
1861 --no-warnings|--no-warning|--no-warn)
1862 set dummy --warnings none ${1+"$@"}
1866 --warnings|--warning|-W)
1867 if test $# = 0 && func_missing_arg $_G_opt; then
1868 _G_parse_options_requote=:
1871 case " $warning_categories $1" in
1873 # trailing space prevents matching last $1 above
1874 func_append_uniq opt_warning_types " $1"
1877 opt_warning_types=$warning_categories
1880 opt_warning_types=none
1884 opt_warning_types=$warning_categories
1885 warning_func=func_fatal_error
1889 "unsupported warning category: '$1'"
1895 --verbose|-v) opt_verbose=: ;;
1896 --version) func_version ;;
1897 -\?|-h) func_usage ;;
1898 --help) func_help ;;
1900 # Separate optargs to long options (plugins may need this):
1901 --*=*) func_split_equals "$_G_opt"
1902 set dummy "$func_split_equals_lhs" \
1903 "$func_split_equals_rhs" ${1+"$@"}
1907 # Separate optargs to short options:
1909 func_split_short_opt "$_G_opt"
1910 set dummy "$func_split_short_opt_name" \
1911 "$func_split_short_opt_arg" ${1+"$@"}
1915 # Separate non-argument short options:
1917 func_split_short_opt "$_G_opt"
1918 set dummy "$func_split_short_opt_name" \
1919 "-$func_split_short_opt_arg" ${1+"$@"}
1923 --) _G_parse_options_requote=: ; break ;;
1924 -*) func_fatal_help "unrecognised option: '$_G_opt'" ;;
1925 *) set dummy "$_G_opt" ${1+"$@"}; shift
1926 _G_match_parse_options=false
1931 if $_G_match_parse_options; then
1932 _G_parse_options_requote=:
1936 if $_G_parse_options_requote; then
1937 # save modified positional parameters for caller
1938 func_quote eval ${1+"$@"}
1939 func_parse_options_result=$func_quote_result
1944 # func_validate_options [ARG]...
1945 # ------------------------------
1946 # Perform any sanity checks on option settings and/or unconsumed
1948 func_hookable func_validate_options
1949 func_validate_options ()
1953 # Display all warnings if -W was not given.
1954 test -n "$opt_warning_types" || opt_warning_types=" $warning_categories"
1956 func_run_hooks func_validate_options ${1+"$@"}
1957 func_propagate_result func_run_hooks func_validate_options
1959 # Bail if the options were screwed!
1960 $exit_cmd $EXIT_FAILURE
1965 ## ----------------- ##
1966 ## Helper functions. ##
1967 ## ----------------- ##
1969 # This section contains the helper functions used by the rest of the
1970 # hookable option parser framework in ascii-betical order.
1973 # func_fatal_help ARG...
1974 # ----------------------
1975 # Echo program name prefixed message to standard error, followed by
1976 # a help hint, and exit.
1981 eval \$ECHO \""Usage: $usage"\"
1982 eval \$ECHO \""$fatal_help"\"
1983 func_error ${1+"$@"}
1990 # Echo long help message to standard output and exit.
1996 $ECHO "$long_help_message"
2001 # func_missing_arg ARGNAME
2002 # ------------------------
2003 # Echo program name prefixed message to standard error and set global
2009 func_error "Missing argument for '$1'."
2014 # func_split_equals STRING
2015 # ------------------------
2016 # Set func_split_equals_lhs and func_split_equals_rhs shell variables
2017 # after splitting STRING at the '=' sign.
2018 test -z "$_G_HAVE_XSI_OPS" \
2020 test 5aa/bb/cc = "${#x}${x%%/*}${x%/*}${x#*/}${x##*/}"') 2>/dev/null \
2021 && _G_HAVE_XSI_OPS=yes
2023 if test yes = "$_G_HAVE_XSI_OPS"
2025 # This is an XSI compatible shell, allowing a faster implementation...
2026 eval 'func_split_equals ()
2030 func_split_equals_lhs=${1%%=*}
2031 func_split_equals_rhs=${1#*=}
2032 if test "x$func_split_equals_lhs" = "x$1"; then
2033 func_split_equals_rhs=
2037 # ...otherwise fall back to using expr, which is often a shell builtin.
2038 func_split_equals ()
2042 func_split_equals_lhs=`expr "x$1" : 'x\([^=]*\)'`
2043 func_split_equals_rhs=
2044 test "x$func_split_equals_lhs" = "x$1" \
2045 || func_split_equals_rhs=`expr "x$1" : 'x[^=]*=\(.*\)$'`
2047 fi #func_split_equals
2050 # func_split_short_opt SHORTOPT
2051 # -----------------------------
2052 # Set func_split_short_opt_name and func_split_short_opt_arg shell
2053 # variables after splitting SHORTOPT after the 2nd character.
2054 if test yes = "$_G_HAVE_XSI_OPS"
2056 # This is an XSI compatible shell, allowing a faster implementation...
2057 eval 'func_split_short_opt ()
2061 func_split_short_opt_arg=${1#??}
2062 func_split_short_opt_name=${1%"$func_split_short_opt_arg"}
2065 # ...otherwise fall back to using expr, which is often a shell builtin.
2066 func_split_short_opt ()
2070 func_split_short_opt_name=`expr "x$1" : 'x-\(.\)'`
2071 func_split_short_opt_arg=`expr "x$1" : 'x-.\(.*\)$'`
2073 fi #func_split_short_opt
2078 # Echo short help message to standard output and exit.
2084 $ECHO "Run '$progname --help |${PAGER-more}' for full usage"
2089 # func_usage_message
2090 # ------------------
2091 # Echo short help message to standard output.
2092 func_usage_message ()
2096 eval \$ECHO \""Usage: $usage"\"
2103 /^Written by/q' < "$progpath"
2105 eval \$ECHO \""$usage_message"\"
2111 # Echo version message to standard output and exit.
2112 # The version message is extracted from the calling file's header
2113 # comments, with leading '# ' stripped:
2114 # 1. First display the progname and version
2115 # 2. Followed by the header comment line matching /^# Written by /
2116 # 3. Then a blank line followed by the first following line matching
2118 # 4. Immediately followed by any lines between the previous matches,
2119 # except lines preceding the intervening completely blank line.
2120 # For example, see the header comments of this file.
2125 printf '%s\n' "$progname $scriptversion"
2146 s|\((C)\)[ 0-9,-]*[ ,-]\([1-9][0-9]* \)|\1 \2|
2156 # mode: shell-script
2158 # eval: (add-hook 'before-save-hook 'time-stamp)
2159 # time-stamp-pattern: "30/scriptversion=%:y-%02m-%02d.%02H; # UTC"
2160 # time-stamp-time-zone: "UTC"
2163 # Set a version string.
2164 scriptversion='(GNU libtool) 2.4.6'
2169 # Libtool also displays the current mode in messages, so override
2170 # funclib.sh func_echo with this custom definition.
2179 for _G_line in $_G_message; do
2181 $ECHO "$progname${opt_mode+: $opt_mode}: $_G_line"
2187 # func_warning ARG...
2188 # -------------------
2189 # Libtool warnings are not categorized, so override funclib.sh
2190 # func_warning with this simpler definition.
2195 $warning_func ${1+"$@"}
2199 ## ---------------- ##
2200 ## Options parsing. ##
2201 ## ---------------- ##
2203 # Hook in the functions to make sure our own options are parsed during
2204 # the option parsing loop.
2206 usage='$progpath [OPTION]... [MODE-ARG]...'
2208 # Short help message in response to '-h'.
2209 usage_message="Options:
2210 --config show all configuration variables
2211 --debug enable verbose shell tracing
2212 -n, --dry-run display commands without modifying any files
2213 --features display basic configuration information and exit
2214 --mode=MODE use operation mode MODE
2215 --no-warnings equivalent to '-Wnone'
2216 --preserve-dup-deps don't remove duplicate dependency libraries
2217 --quiet, --silent don't print informational messages
2218 --tag=TAG use configuration variables from tag TAG
2219 -v, --verbose print more informational messages than default
2220 --version print version information
2221 -W, --warnings=CATEGORY report the warnings falling in CATEGORY [all]
2222 -h, --help, --help-all print short, long, or detailed help message
2225 # Additional text appended to 'usage_message' in response to '--help'.
2231 $ECHO "$long_help_message
2233 MODE must be one of the following:
2235 clean remove files from the build directory
2236 compile compile a source file into a libtool object
2237 execute automatically set library path, then run a program
2238 finish complete the installation of libtool libraries
2239 install install libraries or executables
2240 link create a library or an executable
2241 uninstall remove libraries from an installed directory
2243 MODE-ARGS vary depending on the MODE. When passed as first option,
2244 '--mode=MODE' may be abbreviated as 'MODE' or a unique abbreviation of that.
2245 Try '$progname --help --mode=MODE' for a more detailed description of MODE.
2247 When reporting a bug, please describe a test case to reproduce it and
2248 include the following information:
2253 compiler flags: $LTCFLAGS
2254 linker: $LD (gnu? $with_gnu_ld)
2255 version: $progname (GNU libtool) 2.4.6
2256 automake: `($AUTOMAKE --version) 2>/dev/null |$SED 1q`
2257 autoconf: `($AUTOCONF --version) 2>/dev/null |$SED 1q`
2259 Report bugs to <bug-libtool@gnu.org>.
2260 GNU libtool home page: <http://www.gnu.org/s/libtool/>.
2261 General help using GNU software: <http://www.gnu.org/gethelp/>."
2266 # func_lo2o OBJECT-NAME
2267 # ---------------------
2268 # Transform OBJECT-NAME from a '.lo' suffix to the platform specific
2271 lo2o=s/\\.lo\$/.$objext/
2272 o2lo=s/\\.$objext\$/.lo/
2274 if test yes = "$_G_HAVE_XSI_OPS"; then
2278 *.lo) func_lo2o_result=${1%.lo}.$objext ;;
2279 * ) func_lo2o_result=$1 ;;
2283 # func_xform LIBOBJ-OR-SOURCE
2284 # ---------------------------
2285 # Transform LIBOBJ-OR-SOURCE from a '.o' or '.c' (or otherwise)
2286 # suffix to a '.lo' libtool-object suffix.
2289 func_xform_result=${1%.*}.lo
2292 # ...otherwise fall back to using sed.
2295 func_lo2o_result=`$ECHO "$1" | $SED "$lo2o"`
2300 func_xform_result=`$ECHO "$1" | $SED 's|\.[^.]*$|.lo|'`
2305 # func_fatal_configuration ARG...
2306 # -------------------------------
2307 # Echo program name prefixed message to standard error, followed by
2308 # a configuration failure hint, and exit.
2309 func_fatal_configuration ()
2311 func_fatal_error ${1+"$@"} \
2312 "See the $PACKAGE documentation for more information." \
2313 "Fatal configuration error."
2319 # Display the configuration for all the tags in this script.
2322 re_begincf='^# ### BEGIN LIBTOOL'
2323 re_endcf='^# ### END LIBTOOL'
2325 # Default configuration.
2326 $SED "1,/$re_begincf CONFIG/d;/$re_endcf CONFIG/,\$d" < "$progpath"
2328 # Now print the configurations for the tags.
2329 for tagname in $taglist; do
2330 $SED -n "/$re_begincf TAG CONFIG: $tagname\$/,/$re_endcf TAG CONFIG: $tagname\$/p" < "$progpath"
2339 # Display the features supported by this script.
2343 if test yes = "$build_libtool_libs"; then
2344 echo "enable shared libraries"
2346 echo "disable shared libraries"
2348 if test yes = "$build_old_libs"; then
2349 echo "enable static libraries"
2351 echo "disable static libraries"
2358 # func_enable_tag TAGNAME
2359 # -----------------------
2360 # Verify that TAGNAME is valid, and either flag an error and exit, or
2361 # enable the TAGNAME tag. We also add TAGNAME to the global $taglist
2368 re_begincf="^# ### BEGIN LIBTOOL TAG CONFIG: $tagname\$"
2369 re_endcf="^# ### END LIBTOOL TAG CONFIG: $tagname\$"
2370 sed_extractcf=/$re_begincf/,/$re_endcf/p
2375 func_fatal_error "invalid tag name: $tagname"
2379 # Don't test for the "default" C tag, as we know it's
2380 # there but not specially marked.
2384 if $GREP "$re_begincf" "$progpath" >/dev/null 2>&1; then
2385 taglist="$taglist $tagname"
2387 # Evaluate the configuration. Be careful to quote the path
2388 # and the sed script, to avoid splitting on whitespace, but
2389 # also don't use non-portable quotes within backquotes within
2390 # quotes we have to do it in 2 steps:
2391 extractedcf=`$SED -n -e "$sed_extractcf" < "$progpath"`
2394 func_error "ignoring unknown tag $tagname"
2401 # func_check_version_match
2402 # ------------------------
2403 # Ensure that we are using m4 macros, and libtool script from the same
2404 # release of libtool.
2405 func_check_version_match ()
2407 if test "$package_revision" != "$macro_revision"; then
2408 if test "$VERSION" != "$macro_version"; then
2409 if test -z "$macro_version"; then
2411 $progname: Version mismatch error. This is $PACKAGE $VERSION, but the
2412 $progname: definition of this LT_INIT comes from an older release.
2413 $progname: You should recreate aclocal.m4 with macros from $PACKAGE $VERSION
2414 $progname: and run autoconf again.
2418 $progname: Version mismatch error. This is $PACKAGE $VERSION, but the
2419 $progname: definition of this LT_INIT comes from $PACKAGE $macro_version.
2420 $progname: You should recreate aclocal.m4 with macros from $PACKAGE $VERSION
2421 $progname: and run autoconf again.
2426 $progname: Version mismatch error. This is $PACKAGE $VERSION, revision $package_revision,
2427 $progname: but the definition of this LT_INIT comes from revision $macro_revision.
2428 $progname: You should recreate aclocal.m4 with macros from revision $package_revision
2429 $progname: of $PACKAGE $VERSION and run autoconf again.
2438 # libtool_options_prep [ARG]...
2439 # -----------------------------
2440 # Preparation for options parsed by libtool.
2441 libtool_options_prep ()
2451 opt_preserve_dup_deps=false
2457 _G_rc_lt_options_prep=:
2459 # Shorthand for --mode=foo, only valid as the first argument
2462 shift; set dummy --mode clean ${1+"$@"}; shift
2464 compile|compil|compi|comp|com|co|c)
2465 shift; set dummy --mode compile ${1+"$@"}; shift
2467 execute|execut|execu|exec|exe|ex|e)
2468 shift; set dummy --mode execute ${1+"$@"}; shift
2470 finish|finis|fini|fin|fi|f)
2471 shift; set dummy --mode finish ${1+"$@"}; shift
2473 install|instal|insta|inst|ins|in|i)
2474 shift; set dummy --mode install ${1+"$@"}; shift
2477 shift; set dummy --mode link ${1+"$@"}; shift
2479 uninstall|uninstal|uninsta|uninst|unins|unin|uni|un|u)
2480 shift; set dummy --mode uninstall ${1+"$@"}; shift
2483 _G_rc_lt_options_prep=false
2487 if $_G_rc_lt_options_prep; then
2488 # Pass back the list of options.
2489 func_quote eval ${1+"$@"}
2490 libtool_options_prep_result=$func_quote_result
2493 func_add_hook func_options_prep libtool_options_prep
2496 # libtool_parse_options [ARG]...
2497 # ---------------------------------
2498 # Provide handling for libtool specific options.
2499 libtool_parse_options ()
2503 _G_rc_lt_parse_options=false
2505 # Perform our own loop to consume as many options as possible in
2507 while test $# -gt 0; do
2508 _G_match_lt_parse_options=:
2512 --dry-run|--dryrun|-n)
2516 --config) func_config ;;
2519 opt_dlopen="${opt_dlopen+$opt_dlopen
2524 --preserve-dup-deps)
2525 opt_preserve_dup_deps=: ;;
2527 --features) func_features ;;
2529 --finish) set dummy --mode finish ${1+"$@"}; shift ;;
2531 --help) opt_help=: ;;
2533 --help-all) opt_help=': help-all' ;;
2535 --mode) test $# = 0 && func_missing_arg $_G_opt && break
2538 # Valid mode arguments:
2539 clean|compile|execute|finish|install|link|relink|uninstall) ;;
2541 # Catch anything else as an error
2542 *) func_error "invalid argument for $_G_opt"
2550 --no-silent|--no-quiet)
2552 func_append preserve_args " $_G_opt"
2555 --no-warnings|--no-warning|--no-warn)
2557 func_append preserve_args " $_G_opt"
2562 func_append preserve_args " $_G_opt"
2568 func_append preserve_args " $_G_opt"
2571 --tag) test $# = 0 && func_missing_arg $_G_opt && break
2573 func_append preserve_args " $_G_opt $1"
2574 func_enable_tag "$1"
2578 --verbose|-v) opt_quiet=false
2580 func_append preserve_args " $_G_opt"
2583 # An option not handled by this hook function:
2584 *) set dummy "$_G_opt" ${1+"$@"} ; shift
2585 _G_match_lt_parse_options=false
2589 $_G_match_lt_parse_options && _G_rc_lt_parse_options=:
2592 if $_G_rc_lt_parse_options; then
2593 # save modified positional parameters for caller
2594 func_quote eval ${1+"$@"}
2595 libtool_parse_options_result=$func_quote_result
2598 func_add_hook func_parse_options libtool_parse_options
2602 # libtool_validate_options [ARG]...
2603 # ---------------------------------
2604 # Perform any sanity checks on option settings and/or unconsumed
2606 libtool_validate_options ()
2608 # save first non-option argument
2609 if test 0 -lt $#; then
2615 test : = "$debug_cmd" || func_append preserve_args " --debug"
2618 # Solaris2 added to fix http://debbugs.gnu.org/cgi/bugreport.cgi?bug=16452
2619 # see also: http://gcc.gnu.org/bugzilla/show_bug.cgi?id=59788
2620 *cygwin* | *mingw* | *pw32* | *cegcc* | *solaris2* | *os2*)
2621 # don't eliminate duplications in $postdeps and $predeps
2622 opt_duplicate_compiler_generated_deps=:
2625 opt_duplicate_compiler_generated_deps=$opt_preserve_dup_deps
2630 # Sanity checks first:
2631 func_check_version_match
2633 test yes != "$build_libtool_libs" \
2634 && test yes != "$build_old_libs" \
2635 && func_fatal_configuration "not configured to build any kind of library"
2638 eval std_shrext=\"$shrext_cmds\"
2640 # Only execute mode is allowed to have -dlopen flags.
2641 if test -n "$opt_dlopen" && test execute != "$opt_mode"; then
2642 func_error "unrecognized option '-dlopen'"
2647 # Change the help message to a mode-specific one.
2649 help="Try '$progname --help --mode=$opt_mode' for more information."
2652 # Pass back the unparsed argument list
2653 func_quote eval ${1+"$@"}
2654 libtool_validate_options_result=$func_quote_result
2656 func_add_hook func_validate_options libtool_validate_options
2659 # Process options as early as possible so that --help and --version
2660 # can return quickly.
2661 func_options ${1+"$@"}
2662 eval set dummy "$func_options_result"; shift
2670 magic='%%%MAGIC variable%%%'
2671 magic_exe='%%%MAGIC EXE variable%%%'
2677 # If this variable is set in any of the actions, the command in it
2678 # will be execed at the end. This prevents here-documents from being
2679 # left over by shells.
2683 # A function that is used when there is no print builtin or printf.
2684 func_fallback_echo ()
2686 eval 'cat <<_LTECHO_EOF
2691 # func_generated_by_libtool
2692 # True iff stdin has been generated by Libtool. This function is only
2693 # a basic sanity check; it will hardly flush out determined imposters.
2694 func_generated_by_libtool_p ()
2696 $GREP "^# Generated by .*$PACKAGE" > /dev/null 2>&1
2700 # True iff FILE is a libtool '.la' library or '.lo' object file.
2701 # This function is only a basic sanity check; it will hardly flush out
2702 # determined imposters.
2706 $SED -e 4q "$1" 2>/dev/null | func_generated_by_libtool_p
2709 # func_lalib_unsafe_p file
2710 # True iff FILE is a libtool '.la' library or '.lo' object file.
2711 # This function implements the same check as func_lalib_p without
2712 # resorting to external programs. To this end, it redirects stdin and
2713 # closes it afterwards, without saving the original file descriptor.
2714 # As a safety measure, use it only where a negative result would be
2715 # fatal anyway. Works if 'file' does not exist.
2716 func_lalib_unsafe_p ()
2719 if test -f "$1" && test -r "$1" && exec 5<&0 <"$1"; then
2720 for lalib_p_l in 1 2 3 4
2723 case $lalib_p_line in
2724 \#\ Generated\ by\ *$PACKAGE* ) lalib_p=yes; break;;
2729 test yes = "$lalib_p"
2732 # func_ltwrapper_script_p file
2733 # True iff FILE is a libtool wrapper script
2734 # This function is only a basic sanity check; it will hardly flush out
2735 # determined imposters.
2736 func_ltwrapper_script_p ()
2739 $lt_truncate_bin < "$1" 2>/dev/null | func_generated_by_libtool_p
2742 # func_ltwrapper_executable_p file
2743 # True iff FILE is a libtool wrapper executable
2744 # This function is only a basic sanity check; it will hardly flush out
2745 # determined imposters.
2746 func_ltwrapper_executable_p ()
2748 func_ltwrapper_exec_suffix=
2751 *) func_ltwrapper_exec_suffix=.exe ;;
2753 $GREP "$magic_exe" "$1$func_ltwrapper_exec_suffix" >/dev/null 2>&1
2756 # func_ltwrapper_scriptname file
2757 # Assumes file is an ltwrapper_executable
2758 # uses $file to determine the appropriate filename for a
2759 # temporary ltwrapper_script.
2760 func_ltwrapper_scriptname ()
2762 func_dirname_and_basename "$1" "" "."
2763 func_stripname '' '.exe' "$func_basename_result"
2764 func_ltwrapper_scriptname_result=$func_dirname_result/$objdir/${func_stripname_result}_ltshwrapper
2767 # func_ltwrapper_p file
2768 # True iff FILE is a libtool wrapper script or wrapper executable
2769 # This function is only a basic sanity check; it will hardly flush out
2770 # determined imposters.
2773 func_ltwrapper_script_p "$1" || func_ltwrapper_executable_p "$1"
2777 # func_execute_cmds commands fail_cmd
2778 # Execute tilde-delimited COMMANDS.
2779 # If FAIL_CMD is given, eval that upon failure.
2780 # FAIL_CMD may read-access the current command in variable CMD!
2781 func_execute_cmds ()
2785 save_ifs=$IFS; IFS='~'
2790 func_show_eval "$cmd" "${2-:}"
2797 # Source FILE, adding directory component if necessary.
2798 # Note that it is not necessary on cygwin/mingw to append a dot to
2799 # FILE even if both FILE and FILE.exe exist: automatic-append-.exe
2800 # behavior happens only for exec(3), not for open(2)! Also, sourcing
2801 # 'FILE.' does not work on cygwin managed mounts.
2807 */* | *\\*) . "$1" ;;
2813 # func_resolve_sysroot PATH
2814 # Replace a leading = in PATH with a sysroot. Store the result into
2815 # func_resolve_sysroot_result
2816 func_resolve_sysroot ()
2818 func_resolve_sysroot_result=$1
2819 case $func_resolve_sysroot_result in
2821 func_stripname '=' '' "$func_resolve_sysroot_result"
2822 func_resolve_sysroot_result=$lt_sysroot$func_stripname_result
2827 # func_replace_sysroot PATH
2828 # If PATH begins with the sysroot, replace it with = and
2829 # store the result into func_replace_sysroot_result.
2830 func_replace_sysroot ()
2832 case $lt_sysroot:$1 in
2834 func_stripname "$lt_sysroot" '' "$1"
2835 func_replace_sysroot_result='='$func_stripname_result
2838 # Including no sysroot.
2839 func_replace_sysroot_result=$1
2844 # func_infer_tag arg
2845 # Infer tagged configuration to use if any are available and
2846 # if one wasn't chosen via the "--tag" command line option.
2847 # Only attempt this if the compiler in the base compile
2848 # command doesn't match the default compiler.
2849 # arg is usually of the form 'gcc ...'
2854 if test -n "$available_tags" && test -z "$tagname"; then
2857 func_append_quoted CC_quoted "$arg"
2859 CC_expanded=`func_echo_all $CC`
2860 CC_quoted_expanded=`func_echo_all $CC_quoted`
2862 # Blanks in the command may have been stripped by the calling shell,
2863 # but not from the CC environment variable when configure was run.
2864 " $CC "* | "$CC "* | " $CC_expanded "* | "$CC_expanded "* | \
2865 " $CC_quoted"* | "$CC_quoted "* | " $CC_quoted_expanded "* | "$CC_quoted_expanded "*) ;;
2866 # Blanks at the start of $base_compile will cause this to fail
2867 # if we don't check for them as well.
2869 for z in $available_tags; do
2870 if $GREP "^# ### BEGIN LIBTOOL TAG CONFIG: $z$" < "$progpath" > /dev/null; then
2871 # Evaluate the configuration.
2872 eval "`$SED -n -e '/^# ### BEGIN LIBTOOL TAG CONFIG: '$z'$/,/^# ### END LIBTOOL TAG CONFIG: '$z'$/p' < $progpath`"
2875 # Double-quote args containing other shell metacharacters.
2876 func_append_quoted CC_quoted "$arg"
2878 CC_expanded=`func_echo_all $CC`
2879 CC_quoted_expanded=`func_echo_all $CC_quoted`
2881 " $CC "* | "$CC "* | " $CC_expanded "* | "$CC_expanded "* | \
2882 " $CC_quoted"* | "$CC_quoted "* | " $CC_quoted_expanded "* | "$CC_quoted_expanded "*)
2883 # The compiler in the base compile command matches
2884 # the one in the tagged configuration.
2885 # Assume this is the tagged configuration we want.
2892 # If $tagname still isn't set, then no tagged configuration
2893 # was found and let the user know that the "--tag" command
2894 # line option must be used.
2895 if test -z "$tagname"; then
2896 func_echo "unable to infer tagged configuration"
2897 func_fatal_error "specify a tag with '--tag'"
2899 # func_verbose "using $tagname tagged configuration"
2908 # func_write_libtool_object output_name pic_name nonpic_name
2909 # Create a libtool object file (analogous to a ".la" file),
2910 # but don't create it if we're doing a dry run.
2911 func_write_libtool_object ()
2914 if test yes = "$build_libtool_libs"; then
2920 if test yes = "$build_old_libs"; then
2927 cat >${write_libobj}T <<EOF
2928 # $write_libobj - a libtool object file
2929 # Generated by $PROGRAM (GNU $PACKAGE) $VERSION
2931 # Please DO NOT delete this file!
2932 # It is necessary for linking the library.
2934 # Name of the PIC object.
2935 pic_object=$write_lobj
2937 # Name of the non-PIC object
2938 non_pic_object=$write_oldobj
2941 $MV "${write_libobj}T" "$write_libobj"
2946 ##################################################
2947 # FILE NAME AND PATH CONVERSION HELPER FUNCTIONS #
2948 ##################################################
2950 # func_convert_core_file_wine_to_w32 ARG
2951 # Helper function used by file name conversion functions when $build is *nix,
2952 # and $host is mingw, cygwin, or some other w32 environment. Relies on a
2953 # correctly configured wine environment available, with the winepath program
2954 # in $build's $PATH.
2956 # ARG is the $build file name to be converted to w32 format.
2957 # Result is available in $func_convert_core_file_wine_to_w32_result, and will
2958 # be empty on error (or when ARG is empty)
2959 func_convert_core_file_wine_to_w32 ()
2963 func_convert_core_file_wine_to_w32_result=$1
2964 if test -n "$1"; then
2965 # Unfortunately, winepath does not exit with a non-zero error code, so we
2966 # are forced to check the contents of stdout. On the other hand, if the
2967 # command is not found, the shell will set an exit code of 127 and print
2968 # *an error message* to stdout. So we must check for both error code of
2969 # zero AND non-empty stdout, which explains the odd construction:
2970 func_convert_core_file_wine_to_w32_tmp=`winepath -w "$1" 2>/dev/null`
2971 if test "$?" -eq 0 && test -n "$func_convert_core_file_wine_to_w32_tmp"; then
2972 func_convert_core_file_wine_to_w32_result=`$ECHO "$func_convert_core_file_wine_to_w32_tmp" |
2973 $SED -e "$sed_naive_backslashify"`
2975 func_convert_core_file_wine_to_w32_result=
2979 # end: func_convert_core_file_wine_to_w32
2982 # func_convert_core_path_wine_to_w32 ARG
2983 # Helper function used by path conversion functions when $build is *nix, and
2984 # $host is mingw, cygwin, or some other w32 environment. Relies on a correctly
2985 # configured wine environment available, with the winepath program in $build's
2986 # $PATH. Assumes ARG has no leading or trailing path separator characters.
2988 # ARG is path to be converted from $build format to win32.
2989 # Result is available in $func_convert_core_path_wine_to_w32_result.
2990 # Unconvertible file (directory) names in ARG are skipped; if no directory names
2991 # are convertible, then the result may be empty.
2992 func_convert_core_path_wine_to_w32 ()
2996 # unfortunately, winepath doesn't convert paths, only file names
2997 func_convert_core_path_wine_to_w32_result=
2998 if test -n "$1"; then
3001 for func_convert_core_path_wine_to_w32_f in $1; do
3003 func_convert_core_file_wine_to_w32 "$func_convert_core_path_wine_to_w32_f"
3004 if test -n "$func_convert_core_file_wine_to_w32_result"; then
3005 if test -z "$func_convert_core_path_wine_to_w32_result"; then
3006 func_convert_core_path_wine_to_w32_result=$func_convert_core_file_wine_to_w32_result
3008 func_append func_convert_core_path_wine_to_w32_result ";$func_convert_core_file_wine_to_w32_result"
3015 # end: func_convert_core_path_wine_to_w32
3018 # func_cygpath ARGS...
3019 # Wrapper around calling the cygpath program via LT_CYGPATH. This is used when
3020 # when (1) $build is *nix and Cygwin is hosted via a wine environment; or (2)
3021 # $build is MSYS and $host is Cygwin, or (3) $build is Cygwin. In case (1) or
3022 # (2), returns the Cygwin file name or path in func_cygpath_result (input
3023 # file name or path is assumed to be in w32 format, as previously converted
3024 # from $build's *nix or MSYS format). In case (3), returns the w32 file name
3025 # or path in func_cygpath_result (input file name or path is assumed to be in
3026 # Cygwin format). Returns an empty string on error.
3028 # ARGS are passed to cygpath, with the last one being the file name or path to
3031 # Specify the absolute *nix (or w32) name to cygpath in the LT_CYGPATH
3032 # environment variable; do not put it in $PATH.
3037 if test -n "$LT_CYGPATH" && test -f "$LT_CYGPATH"; then
3038 func_cygpath_result=`$LT_CYGPATH "$@" 2>/dev/null`
3039 if test "$?" -ne 0; then
3040 # on failure, ensure result is empty
3041 func_cygpath_result=
3044 func_cygpath_result=
3045 func_error "LT_CYGPATH is empty or specifies non-existent file: '$LT_CYGPATH'"
3051 # func_convert_core_msys_to_w32 ARG
3052 # Convert file name or path ARG from MSYS format to w32 format. Return
3053 # result in func_convert_core_msys_to_w32_result.
3054 func_convert_core_msys_to_w32 ()
3058 # awkward: cmd appends spaces to result
3059 func_convert_core_msys_to_w32_result=`( cmd //c echo "$1" ) 2>/dev/null |
3060 $SED -e 's/[ ]*$//' -e "$sed_naive_backslashify"`
3062 #end: func_convert_core_msys_to_w32
3065 # func_convert_file_check ARG1 ARG2
3066 # Verify that ARG1 (a file name in $build format) was converted to $host
3067 # format in ARG2. Otherwise, emit an error message, but continue (resetting
3068 # func_to_host_file_result to ARG1).
3069 func_convert_file_check ()
3073 if test -z "$2" && test -n "$1"; then
3074 func_error "Could not determine host file name corresponding to"
3076 func_error "Continuing, but uninstalled executables may not work."
3078 func_to_host_file_result=$1
3081 # end func_convert_file_check
3084 # func_convert_path_check FROM_PATHSEP TO_PATHSEP FROM_PATH TO_PATH
3085 # Verify that FROM_PATH (a path in $build format) was converted to $host
3086 # format in TO_PATH. Otherwise, emit an error message, but continue, resetting
3087 # func_to_host_file_result to a simplistic fallback value (see below).
3088 func_convert_path_check ()
3092 if test -z "$4" && test -n "$3"; then
3093 func_error "Could not determine the host path corresponding to"
3095 func_error "Continuing, but uninstalled executables may not work."
3096 # Fallback. This is a deliberately simplistic "conversion" and
3097 # should not be "improved". See libtool.info.
3098 if test "x$1" != "x$2"; then
3099 lt_replace_pathsep_chars="s|$1|$2|g"
3100 func_to_host_path_result=`echo "$3" |
3101 $SED -e "$lt_replace_pathsep_chars"`
3103 func_to_host_path_result=$3
3107 # end func_convert_path_check
3110 # func_convert_path_front_back_pathsep FRONTPAT BACKPAT REPL ORIG
3111 # Modifies func_to_host_path_result by prepending REPL if ORIG matches FRONTPAT
3112 # and appending REPL if ORIG matches BACKPAT.
3113 func_convert_path_front_back_pathsep ()
3118 $1 ) func_to_host_path_result=$3$func_to_host_path_result
3122 $2 ) func_append func_to_host_path_result "$3"
3126 # end func_convert_path_front_back_pathsep
3129 ##################################################
3130 # $build to $host FILE NAME CONVERSION FUNCTIONS #
3131 ##################################################
3132 # invoked via '$to_host_file_cmd ARG'
3134 # In each case, ARG is the path to be converted from $build to $host format.
3135 # Result will be available in $func_to_host_file_result.
3138 # func_to_host_file ARG
3139 # Converts the file name ARG from $build format to $host format. Return result
3140 # in func_to_host_file_result.
3141 func_to_host_file ()
3145 $to_host_file_cmd "$1"
3147 # end func_to_host_file
3150 # func_to_tool_file ARG LAZY
3151 # converts the file name ARG from $build format to toolchain format. Return
3152 # result in func_to_tool_file_result. If the conversion in use is listed
3153 # in (the comma separated) LAZY, no conversion takes place.
3154 func_to_tool_file ()
3159 *,"$to_tool_file_cmd",*)
3160 func_to_tool_file_result=$1
3163 $to_tool_file_cmd "$1"
3164 func_to_tool_file_result=$func_to_host_file_result
3168 # end func_to_tool_file
3171 # func_convert_file_noop ARG
3172 # Copy ARG to func_to_host_file_result.
3173 func_convert_file_noop ()
3175 func_to_host_file_result=$1
3177 # end func_convert_file_noop
3180 # func_convert_file_msys_to_w32 ARG
3181 # Convert file name ARG from (mingw) MSYS to (mingw) w32 format; automatic
3182 # conversion to w32 is not available inside the cwrapper. Returns result in
3183 # func_to_host_file_result.
3184 func_convert_file_msys_to_w32 ()
3188 func_to_host_file_result=$1
3189 if test -n "$1"; then
3190 func_convert_core_msys_to_w32 "$1"
3191 func_to_host_file_result=$func_convert_core_msys_to_w32_result
3193 func_convert_file_check "$1" "$func_to_host_file_result"
3195 # end func_convert_file_msys_to_w32
3198 # func_convert_file_cygwin_to_w32 ARG
3199 # Convert file name ARG from Cygwin to w32 format. Returns result in
3200 # func_to_host_file_result.
3201 func_convert_file_cygwin_to_w32 ()
3205 func_to_host_file_result=$1
3206 if test -n "$1"; then
3207 # because $build is cygwin, we call "the" cygpath in $PATH; no need to use
3208 # LT_CYGPATH in this case.
3209 func_to_host_file_result=`cygpath -m "$1"`
3211 func_convert_file_check "$1" "$func_to_host_file_result"
3213 # end func_convert_file_cygwin_to_w32
3216 # func_convert_file_nix_to_w32 ARG
3217 # Convert file name ARG from *nix to w32 format. Requires a wine environment
3218 # and a working winepath. Returns result in func_to_host_file_result.
3219 func_convert_file_nix_to_w32 ()
3223 func_to_host_file_result=$1
3224 if test -n "$1"; then
3225 func_convert_core_file_wine_to_w32 "$1"
3226 func_to_host_file_result=$func_convert_core_file_wine_to_w32_result
3228 func_convert_file_check "$1" "$func_to_host_file_result"
3230 # end func_convert_file_nix_to_w32
3233 # func_convert_file_msys_to_cygwin ARG
3234 # Convert file name ARG from MSYS to Cygwin format. Requires LT_CYGPATH set.
3235 # Returns result in func_to_host_file_result.
3236 func_convert_file_msys_to_cygwin ()
3240 func_to_host_file_result=$1
3241 if test -n "$1"; then
3242 func_convert_core_msys_to_w32 "$1"
3243 func_cygpath -u "$func_convert_core_msys_to_w32_result"
3244 func_to_host_file_result=$func_cygpath_result
3246 func_convert_file_check "$1" "$func_to_host_file_result"
3248 # end func_convert_file_msys_to_cygwin
3251 # func_convert_file_nix_to_cygwin ARG
3252 # Convert file name ARG from *nix to Cygwin format. Requires Cygwin installed
3253 # in a wine environment, working winepath, and LT_CYGPATH set. Returns result
3254 # in func_to_host_file_result.
3255 func_convert_file_nix_to_cygwin ()
3259 func_to_host_file_result=$1
3260 if test -n "$1"; then
3261 # convert from *nix to w32, then use cygpath to convert from w32 to cygwin.
3262 func_convert_core_file_wine_to_w32 "$1"
3263 func_cygpath -u "$func_convert_core_file_wine_to_w32_result"
3264 func_to_host_file_result=$func_cygpath_result
3266 func_convert_file_check "$1" "$func_to_host_file_result"
3268 # end func_convert_file_nix_to_cygwin
3271 #############################################
3272 # $build to $host PATH CONVERSION FUNCTIONS #
3273 #############################################
3274 # invoked via '$to_host_path_cmd ARG'
3276 # In each case, ARG is the path to be converted from $build to $host format.
3277 # The result will be available in $func_to_host_path_result.
3279 # Path separators are also converted from $build format to $host format. If
3280 # ARG begins or ends with a path separator character, it is preserved (but
3281 # converted to $host format) on output.
3283 # All path conversion functions are named using the following convention:
3284 # file name conversion function : func_convert_file_X_to_Y ()
3285 # path conversion function : func_convert_path_X_to_Y ()
3286 # where, for any given $build/$host combination the 'X_to_Y' value is the
3287 # same. If conversion functions are added for new $build/$host combinations,
3288 # the two new functions must follow this pattern, or func_init_to_host_path_cmd
3292 # func_init_to_host_path_cmd
3293 # Ensures that function "pointer" variable $to_host_path_cmd is set to the
3294 # appropriate value, based on the value of $to_host_file_cmd.
3296 func_init_to_host_path_cmd ()
3300 if test -z "$to_host_path_cmd"; then
3301 func_stripname 'func_convert_file_' '' "$to_host_file_cmd"
3302 to_host_path_cmd=func_convert_path_$func_stripname_result
3307 # func_to_host_path ARG
3308 # Converts the path ARG from $build format to $host format. Return result
3309 # in func_to_host_path_result.
3310 func_to_host_path ()
3314 func_init_to_host_path_cmd
3315 $to_host_path_cmd "$1"
3317 # end func_to_host_path
3320 # func_convert_path_noop ARG
3321 # Copy ARG to func_to_host_path_result.
3322 func_convert_path_noop ()
3324 func_to_host_path_result=$1
3326 # end func_convert_path_noop
3329 # func_convert_path_msys_to_w32 ARG
3330 # Convert path ARG from (mingw) MSYS to (mingw) w32 format; automatic
3331 # conversion to w32 is not available inside the cwrapper. Returns result in
3332 # func_to_host_path_result.
3333 func_convert_path_msys_to_w32 ()
3337 func_to_host_path_result=$1
3338 if test -n "$1"; then
3339 # Remove leading and trailing path separator characters from ARG. MSYS
3340 # behavior is inconsistent here; cygpath turns them into '.;' and ';.';
3341 # and winepath ignores them completely.
3342 func_stripname : : "$1"
3343 func_to_host_path_tmp1=$func_stripname_result
3344 func_convert_core_msys_to_w32 "$func_to_host_path_tmp1"
3345 func_to_host_path_result=$func_convert_core_msys_to_w32_result
3346 func_convert_path_check : ";" \
3347 "$func_to_host_path_tmp1" "$func_to_host_path_result"
3348 func_convert_path_front_back_pathsep ":*" "*:" ";" "$1"
3351 # end func_convert_path_msys_to_w32
3354 # func_convert_path_cygwin_to_w32 ARG
3355 # Convert path ARG from Cygwin to w32 format. Returns result in
3356 # func_to_host_file_result.
3357 func_convert_path_cygwin_to_w32 ()
3361 func_to_host_path_result=$1
3362 if test -n "$1"; then
3363 # See func_convert_path_msys_to_w32:
3364 func_stripname : : "$1"
3365 func_to_host_path_tmp1=$func_stripname_result
3366 func_to_host_path_result=`cygpath -m -p "$func_to_host_path_tmp1"`
3367 func_convert_path_check : ";" \
3368 "$func_to_host_path_tmp1" "$func_to_host_path_result"
3369 func_convert_path_front_back_pathsep ":*" "*:" ";" "$1"
3372 # end func_convert_path_cygwin_to_w32
3375 # func_convert_path_nix_to_w32 ARG
3376 # Convert path ARG from *nix to w32 format. Requires a wine environment and
3377 # a working winepath. Returns result in func_to_host_file_result.
3378 func_convert_path_nix_to_w32 ()
3382 func_to_host_path_result=$1
3383 if test -n "$1"; then
3384 # See func_convert_path_msys_to_w32:
3385 func_stripname : : "$1"
3386 func_to_host_path_tmp1=$func_stripname_result
3387 func_convert_core_path_wine_to_w32 "$func_to_host_path_tmp1"
3388 func_to_host_path_result=$func_convert_core_path_wine_to_w32_result
3389 func_convert_path_check : ";" \
3390 "$func_to_host_path_tmp1" "$func_to_host_path_result"
3391 func_convert_path_front_back_pathsep ":*" "*:" ";" "$1"
3394 # end func_convert_path_nix_to_w32
3397 # func_convert_path_msys_to_cygwin ARG
3398 # Convert path ARG from MSYS to Cygwin format. Requires LT_CYGPATH set.
3399 # Returns result in func_to_host_file_result.
3400 func_convert_path_msys_to_cygwin ()
3404 func_to_host_path_result=$1
3405 if test -n "$1"; then
3406 # See func_convert_path_msys_to_w32:
3407 func_stripname : : "$1"
3408 func_to_host_path_tmp1=$func_stripname_result
3409 func_convert_core_msys_to_w32 "$func_to_host_path_tmp1"
3410 func_cygpath -u -p "$func_convert_core_msys_to_w32_result"
3411 func_to_host_path_result=$func_cygpath_result
3412 func_convert_path_check : : \
3413 "$func_to_host_path_tmp1" "$func_to_host_path_result"
3414 func_convert_path_front_back_pathsep ":*" "*:" : "$1"
3417 # end func_convert_path_msys_to_cygwin
3420 # func_convert_path_nix_to_cygwin ARG
3421 # Convert path ARG from *nix to Cygwin format. Requires Cygwin installed in a
3422 # a wine environment, working winepath, and LT_CYGPATH set. Returns result in
3423 # func_to_host_file_result.
3424 func_convert_path_nix_to_cygwin ()
3428 func_to_host_path_result=$1
3429 if test -n "$1"; then
3430 # Remove leading and trailing path separator characters from
3431 # ARG. msys behavior is inconsistent here, cygpath turns them
3432 # into '.;' and ';.', and winepath ignores them completely.
3433 func_stripname : : "$1"
3434 func_to_host_path_tmp1=$func_stripname_result
3435 func_convert_core_path_wine_to_w32 "$func_to_host_path_tmp1"
3436 func_cygpath -u -p "$func_convert_core_path_wine_to_w32_result"
3437 func_to_host_path_result=$func_cygpath_result
3438 func_convert_path_check : : \
3439 "$func_to_host_path_tmp1" "$func_to_host_path_result"
3440 func_convert_path_front_back_pathsep ":*" "*:" : "$1"
3443 # end func_convert_path_nix_to_cygwin
3446 # func_dll_def_p FILE
3447 # True iff FILE is a Windows DLL '.def' file.
3448 # Keep in sync with _LT_DLL_DEF_P in libtool.m4
3453 func_dll_def_p_tmp=`$SED -n \
3455 -e '/^\(;.*\)*$/d' \
3456 -e 's/^\(EXPORTS\|LIBRARY\)\([ ].*\)*$/DEF/p' \
3459 test DEF = "$func_dll_def_p_tmp"
3463 # func_mode_compile arg...
3464 func_mode_compile ()
3468 # Get the compilation command and the source file.
3470 srcfile=$nonopt # always keep a non-empty value in "srcfile"
3482 # do not "continue". Instead, add this to base_compile
3494 # Accept any command-line options.
3497 test -n "$libobj" && \
3498 func_fatal_error "you cannot specify '-o' more than once"
3503 -pie | -fpie | -fPIE)
3504 func_append pie_flag " $arg"
3508 -shared | -static | -prefer-pic | -prefer-non-pic)
3509 func_append later " $arg"
3519 arg_mode=arg # the next one goes into the "base_compile" arg list
3520 continue # The current "srcfile" will either be retained or
3521 ;; # replaced later. I would guess that would be a bug.
3524 func_stripname '-Wc,' '' "$arg"
3525 args=$func_stripname_result
3527 save_ifs=$IFS; IFS=,
3528 for arg in $args; do
3530 func_append_quoted lastarg "$arg"
3533 func_stripname ' ' '' "$lastarg"
3534 lastarg=$func_stripname_result
3536 # Add the arguments to base_compile.
3537 func_append base_compile " $lastarg"
3542 # Accept the current argument as the source file.
3543 # The previous "srcfile" becomes the current argument.
3550 esac # case $arg_mode
3552 # Aesthetically quote the previous argument.
3553 func_append_quoted base_compile "$lastarg"
3558 func_fatal_error "you must specify an argument for -Xcompile"
3561 func_fatal_error "you must specify a target with '-o'"
3564 # Get the name of the library object.
3565 test -z "$libobj" && {
3566 func_basename "$srcfile"
3567 libobj=$func_basename_result
3572 # Recognize several different file suffixes.
3573 # If the user specifies -o file.o, it is replaced with file.lo
3576 *.ada | *.adb | *.ads | *.asm | \
3577 *.c++ | *.cc | *.ii | *.class | *.cpp | *.cxx | \
3578 *.[fF][09]? | *.for | *.java | *.go | *.obj | *.sx | *.cu | *.cup)
3579 func_xform "$libobj"
3580 libobj=$func_xform_result
3585 *.lo) func_lo2o "$libobj"; obj=$func_lo2o_result ;;
3587 func_fatal_error "cannot determine name of library object from '$libobj'"
3591 func_infer_tag $base_compile
3593 for arg in $later; do
3596 test yes = "$build_libtool_libs" \
3597 || func_fatal_configuration "cannot build a shared library"
3603 build_libtool_libs=no
3620 func_quote_arg pretty "$libobj"
3621 test "X$libobj" != "X$func_quote_arg_result" \
3622 && $ECHO "X$libobj" | $GREP '[]~#^*{};<>?"'"'"' &()|`$[]' \
3623 && func_warning "libobj name '$libobj' may not contain shell special characters."
3624 func_dirname_and_basename "$obj" "/" ""
3625 objname=$func_basename_result
3626 xdir=$func_dirname_result
3627 lobj=$xdir$objdir/$objname
3629 test -z "$base_compile" && \
3630 func_fatal_help "you must specify a compilation command"
3632 # Delete any leftover library objects.
3633 if test yes = "$build_old_libs"; then
3634 removelist="$obj $lobj $libobj ${libobj}T"
3636 removelist="$lobj $libobj ${libobj}T"
3639 # On Cygwin there's no "real" PIC flag so we must build both object types
3641 cygwin* | mingw* | pw32* | os2* | cegcc*)
3645 if test no = "$pic_mode" && test pass_all != "$deplibs_check_method"; then
3646 # non-PIC code in shared libraries is not supported
3650 # Calculate the filename of the output object if compiler does
3651 # not support -o with -c
3652 if test no = "$compiler_c_o"; then
3653 output_obj=`$ECHO "$srcfile" | $SED 's%^.*/%%; s%\.[^.]*$%%'`.$objext
3654 lockfile=$output_obj.lock
3661 # Lock this critical section if it is needed
3662 # We use this script file to make the link, it avoids creating a new file
3663 if test yes = "$need_locks"; then
3664 until $opt_dry_run || ln "$progpath" "$lockfile" 2>/dev/null; do
3665 func_echo "Waiting for $lockfile to be removed"
3668 elif test warn = "$need_locks"; then
3669 if test -f "$lockfile"; then
3671 *** ERROR, $lockfile exists and contains:
3672 `cat $lockfile 2>/dev/null`
3674 This indicates that another process is trying to use the same
3675 temporary object file, and libtool could not work around it because
3676 your compiler does not support '-c' and '-o' together. If you
3677 repeat this compilation, it may succeed, by chance, but you had better
3678 avoid parallel builds (make -j) in this platform, or get a better
3681 $opt_dry_run || $RM $removelist
3684 func_append removelist " $output_obj"
3685 $ECHO "$srcfile" > "$lockfile"
3688 $opt_dry_run || $RM $removelist
3689 func_append removelist " $lockfile"
3690 trap '$opt_dry_run || $RM $removelist; exit $EXIT_FAILURE' 1 2 15
3692 func_to_tool_file "$srcfile" func_convert_file_msys_to_w32
3693 srcfile=$func_to_tool_file_result
3694 func_quote_arg pretty "$srcfile"
3695 qsrcfile=$func_quote_arg_result
3697 # Only build a PIC object if we are building libtool libraries.
3698 if test yes = "$build_libtool_libs"; then
3699 # Without this assignment, base_compile gets emptied.
3700 fbsd_hideous_sh_bug=$base_compile
3702 if test no != "$pic_mode"; then
3703 command="$base_compile $qsrcfile $pic_flag"
3705 # Don't build PIC code
3706 command="$base_compile $qsrcfile"
3709 func_mkdir_p "$xdir$objdir"
3711 if test -z "$output_obj"; then
3712 # Place PIC objects in $objdir
3713 func_append command " -o $lobj"
3716 func_show_eval_locale "$command" \
3717 'test -n "$output_obj" && $RM $removelist; exit $EXIT_FAILURE'
3719 if test warn = "$need_locks" &&
3720 test "X`cat $lockfile 2>/dev/null`" != "X$srcfile"; then
3722 *** ERROR, $lockfile contains:
3723 `cat $lockfile 2>/dev/null`
3725 but it should contain:
3728 This indicates that another process is trying to use the same
3729 temporary object file, and libtool could not work around it because
3730 your compiler does not support '-c' and '-o' together. If you
3731 repeat this compilation, it may succeed, by chance, but you had better
3732 avoid parallel builds (make -j) in this platform, or get a better
3735 $opt_dry_run || $RM $removelist
3739 # Just move the object if needed, then go on to compile the next one
3740 if test -n "$output_obj" && test "X$output_obj" != "X$lobj"; then
3741 func_show_eval '$MV "$output_obj" "$lobj"' \
3742 'error=$?; $opt_dry_run || $RM $removelist; exit $error'
3745 # Allow error messages only from the first compilation.
3746 if test yes = "$suppress_opt"; then
3747 suppress_output=' >/dev/null 2>&1'
3751 # Only build a position-dependent object if we build old libraries.
3752 if test yes = "$build_old_libs"; then
3753 if test yes != "$pic_mode"; then
3754 # Don't build PIC code
3755 command="$base_compile $qsrcfile$pie_flag"
3757 command="$base_compile $qsrcfile $pic_flag"
3759 if test yes = "$compiler_c_o"; then
3760 func_append command " -o $obj"
3763 # Suppress compiler output if we already did a PIC compilation.
3764 func_append command "$suppress_output"
3765 func_show_eval_locale "$command" \
3766 '$opt_dry_run || $RM $removelist; exit $EXIT_FAILURE'
3768 if test warn = "$need_locks" &&
3769 test "X`cat $lockfile 2>/dev/null`" != "X$srcfile"; then
3771 *** ERROR, $lockfile contains:
3772 `cat $lockfile 2>/dev/null`
3774 but it should contain:
3777 This indicates that another process is trying to use the same
3778 temporary object file, and libtool could not work around it because
3779 your compiler does not support '-c' and '-o' together. If you
3780 repeat this compilation, it may succeed, by chance, but you had better
3781 avoid parallel builds (make -j) in this platform, or get a better
3784 $opt_dry_run || $RM $removelist
3788 # Just move the object if needed
3789 if test -n "$output_obj" && test "X$output_obj" != "X$obj"; then
3790 func_show_eval '$MV "$output_obj" "$obj"' \
3791 'error=$?; $opt_dry_run || $RM $removelist; exit $error'
3796 func_write_libtool_object "$libobj" "$objdir/$objname" "$objname"
3798 # Unlock the critical section if it was locked
3799 if test no != "$need_locks"; then
3800 removelist=$lockfile
3809 test compile = "$opt_mode" && func_mode_compile ${1+"$@"}
3814 # We need to display help for each of the modes.
3817 # Generic help is extracted from the usage comments
3818 # at the start of this file.
3824 "Usage: $progname [OPTION]... --mode=clean RM [RM-OPTION]... FILE...
3826 Remove files from the build directory.
3828 RM is the name of the program to use to delete files associated with each FILE
3829 (typically '/bin/rm'). RM-OPTIONS are options (such as '-f') to be passed
3832 If FILE is a libtool library, object or program, all the files associated
3833 with it are deleted. Otherwise, only FILE itself is deleted using RM."
3838 "Usage: $progname [OPTION]... --mode=compile COMPILE-COMMAND... SOURCEFILE
3840 Compile a source file into a libtool library object.
3842 This mode accepts the following additional options:
3844 -o OUTPUT-FILE set the output file name to OUTPUT-FILE
3845 -no-suppress do not suppress compiler output for multiple passes
3846 -prefer-pic try to build PIC objects only
3847 -prefer-non-pic try to build non-PIC objects only
3848 -shared do not build a '.o' file suitable for static linking
3849 -static only build a '.o' file suitable for static linking
3850 -Wc,FLAG pass FLAG directly to the compiler
3852 COMPILE-COMMAND is a command to be used in creating a 'standard' object file
3853 from the given SOURCEFILE.
3855 The output file name is determined by removing the directory component from
3856 SOURCEFILE, then substituting the C source code suffix '.c' with the
3857 library object suffix, '.lo'."
3862 "Usage: $progname [OPTION]... --mode=execute COMMAND [ARGS]...
3864 Automatically set library path, then run a program.
3866 This mode accepts the following additional options:
3868 -dlopen FILE add the directory containing FILE to the library path
3870 This mode sets the library path environment variable according to '-dlopen'
3873 If any of the ARGS are libtool executable wrappers, then they are translated
3874 into their corresponding uninstalled binary, and any of their required library
3875 directories are added to the library path.
3877 Then, COMMAND is executed, with ARGS as arguments."
3882 "Usage: $progname [OPTION]... --mode=finish [LIBDIR]...
3884 Complete the installation of libtool libraries.
3886 Each LIBDIR is a directory that contains libtool libraries.
3888 The commands that this mode executes may require superuser privileges. Use
3889 the '--dry-run' option if you just want to see what would be executed."
3894 "Usage: $progname [OPTION]... --mode=install INSTALL-COMMAND...
3896 Install executables or libraries.
3898 INSTALL-COMMAND is the installation command. The first component should be
3899 either the 'install' or 'cp' program.
3901 The following components of INSTALL-COMMAND are treated specially:
3903 -inst-prefix-dir PREFIX-DIR Use PREFIX-DIR as a staging area for installation
3905 The rest of the components are interpreted as arguments to that command (only
3906 BSD-compatible install options are recognized)."
3911 "Usage: $progname [OPTION]... --mode=link LINK-COMMAND...
3913 Link object files or libraries together to form another library, or to
3914 create an executable program.
3916 LINK-COMMAND is a command using the C compiler that you would use to create
3917 a program from several object files.
3919 The following components of LINK-COMMAND are treated specially:
3921 -all-static do not do any dynamic linking at all
3922 -avoid-version do not add a version suffix if possible
3923 -bindir BINDIR specify path to binaries directory (for systems where
3924 libraries must be found in the PATH setting at runtime)
3925 -dlopen FILE '-dlpreopen' FILE if it cannot be dlopened at runtime
3926 -dlpreopen FILE link in FILE and add its symbols to lt_preloaded_symbols
3927 -export-dynamic allow symbols from OUTPUT-FILE to be resolved with dlsym(3)
3928 -export-symbols SYMFILE
3929 try to export only the symbols listed in SYMFILE
3930 -export-symbols-regex REGEX
3931 try to export only the symbols matching REGEX
3932 -LLIBDIR search LIBDIR for required installed libraries
3933 -lNAME OUTPUT-FILE requires the installed library libNAME
3934 -module build a library that can dlopened
3935 -no-fast-install disable the fast-install mode
3936 -no-install link a not-installable executable
3937 -no-undefined declare that a library does not refer to external symbols
3938 -o OUTPUT-FILE create OUTPUT-FILE from the specified objects
3939 -objectlist FILE use a list of object files found in FILE to specify objects
3940 -os2dllname NAME force a short DLL name on OS/2 (no effect on other OSes)
3941 -precious-files-regex REGEX
3942 don't remove output files matching REGEX
3943 -release RELEASE specify package release information
3944 -rpath LIBDIR the created library will eventually be installed in LIBDIR
3945 -R[ ]LIBDIR add LIBDIR to the runtime path of programs and libraries
3946 -shared only do dynamic linking of libtool libraries
3947 -shrext SUFFIX override the standard shared library file extension
3948 -static do not do any dynamic linking of uninstalled libtool libraries
3949 -static-libtool-libs
3950 do not do any dynamic linking of libtool libraries
3951 -version-info CURRENT[:REVISION[:AGE]]
3952 specify library version info [each variable defaults to 0]
3953 -weak LIBNAME declare that the target provides the LIBNAME interface
3955 -Xcompiler FLAG pass linker-specific FLAG directly to the compiler
3957 -Xlinker FLAG pass linker-specific FLAG directly to the linker
3958 -XCClinker FLAG pass link-specific FLAG to the compiler driver (CC)
3960 All other options (arguments beginning with '-') are ignored.
3962 Every other argument is treated as a filename. Files ending in '.la' are
3963 treated as uninstalled libtool libraries, other files are standard or library
3966 If the OUTPUT-FILE ends in '.la', then a libtool library is created,
3967 only library objects ('.lo' files) may be specified, and '-rpath' is
3968 required, except when creating a convenience library.
3970 If OUTPUT-FILE ends in '.a' or '.lib', then a standard library is created
3971 using 'ar' and 'ranlib', or on Windows using 'lib'.
3973 If OUTPUT-FILE ends in '.lo' or '.$objext', then a reloadable object file
3974 is created, otherwise an executable program is created."
3979 "Usage: $progname [OPTION]... --mode=uninstall RM [RM-OPTION]... FILE...
3981 Remove libraries from an installation directory.
3983 RM is the name of the program to use to delete files associated with each FILE
3984 (typically '/bin/rm'). RM-OPTIONS are options (such as '-f') to be passed
3987 If FILE is a libtool library, all the files associated with it are deleted.
3988 Otherwise, only FILE itself is deleted using RM."
3992 func_fatal_help "invalid operation mode '$opt_mode'"
3997 $ECHO "Try '$progname --help' for more information about other modes."
4000 # Now that we've collected a possible --mode arg, show help if necessary
4002 if test : = "$opt_help"; then
4007 for opt_mode in compile link execute install finish uninstall clean; do
4010 } | $SED -n '1p; 2,$s/^Usage:/ or: /p'
4013 for opt_mode in compile link execute install finish uninstall clean; do
4019 /^When reporting/,/^Report/{
4024 /information about other modes/d
4025 /more detailed .*MODE/d
4026 s/^Usage:.*--mode=\([^ ]*\) .*/Description of \1 mode:/'
4032 # func_mode_execute arg...
4033 func_mode_execute ()
4037 # The first argument is the command name.
4040 func_fatal_help "you must specify a COMMAND"
4042 # Handle -dlopen flags immediately.
4043 for file in $opt_dlopen; do
4045 || func_fatal_help "'$file' is not a file"
4050 func_resolve_sysroot "$file"
4051 file=$func_resolve_sysroot_result
4053 # Check to see that this really is a libtool archive.
4054 func_lalib_unsafe_p "$file" \
4055 || func_fatal_help "'$lib' is not a valid libtool archive"
4057 # Read the libtool library.
4062 # Skip this library if it cannot be dlopened.
4063 if test -z "$dlname"; then
4064 # Warn if it was a shared library.
4065 test -n "$library_names" && \
4066 func_warning "'$file' was not linked with '-export-dynamic'"
4070 func_dirname "$file" "" "."
4071 dir=$func_dirname_result
4073 if test -f "$dir/$objdir/$dlname"; then
4074 func_append dir "/$objdir"
4076 if test ! -f "$dir/$dlname"; then
4077 func_fatal_error "cannot find '$dlname' in '$dir' or '$dir/$objdir'"
4083 # Just add the directory containing the .lo file.
4084 func_dirname "$file" "" "."
4085 dir=$func_dirname_result
4089 func_warning "'-dlopen' is ignored for non-libtool libraries and objects"
4094 # Get the absolute pathname.
4095 absdir=`cd "$dir" && pwd`
4096 test -n "$absdir" && dir=$absdir
4098 # Now add the directory to shlibpath_var.
4099 if eval "test -z \"\$$shlibpath_var\""; then
4100 eval "$shlibpath_var=\"\$dir\""
4102 eval "$shlibpath_var=\"\$dir:\$$shlibpath_var\""
4106 # This variable tells wrapper scripts just to set shlibpath_var
4107 # rather than running their programs.
4108 libtool_execute_magic=$magic
4110 # Check if any of the arguments is a wrapper script.
4115 -* | *.la | *.lo ) ;;
4117 # Do a test to see if this is really a libtool program.
4118 if func_ltwrapper_script_p "$file"; then
4120 # Transform arg to wrapped name.
4121 file=$progdir/$program
4122 elif func_ltwrapper_executable_p "$file"; then
4123 func_ltwrapper_scriptname "$file"
4124 func_source "$func_ltwrapper_scriptname_result"
4125 # Transform arg to wrapped name.
4126 file=$progdir/$program
4130 # Quote arguments (to preserve shell metacharacters).
4131 func_append_quoted args "$file"
4134 if $opt_dry_run; then
4135 # Display what would be done.
4136 if test -n "$shlibpath_var"; then
4137 eval "\$ECHO \"\$shlibpath_var=\$$shlibpath_var\""
4138 echo "export $shlibpath_var"
4143 if test -n "$shlibpath_var"; then
4144 # Export the shlibpath_var.
4145 eval "export $shlibpath_var"
4148 # Restore saved environment variables
4149 for lt_var in LANG LANGUAGE LC_ALL LC_CTYPE LC_COLLATE LC_MESSAGES
4151 eval "if test \"\${save_$lt_var+set}\" = set; then
4152 $lt_var=\$save_$lt_var; export $lt_var
4158 # Now prepare to actually exec the command.
4163 test execute = "$opt_mode" && func_mode_execute ${1+"$@"}
4166 # func_mode_finish arg...
4175 for opt in "$nonopt" ${1+"$@"}
4177 if test -d "$opt"; then
4178 func_append libdirs " $opt"
4180 elif test -f "$opt"; then
4181 if func_lalib_unsafe_p "$opt"; then
4182 func_append libs " $opt"
4184 func_warning "'$opt' is not a valid libtool archive"
4188 func_fatal_error "invalid argument '$opt'"
4192 if test -n "$libs"; then
4193 if test -n "$lt_sysroot"; then
4194 sysroot_regex=`$ECHO "$lt_sysroot" | $SED "$sed_make_literal_regex"`
4195 sysroot_cmd="s/\([ ']\)$sysroot_regex/\1/g;"
4200 # Remove sysroot references
4201 if $opt_dry_run; then
4202 for lib in $libs; do
4203 echo "removing references to $lt_sysroot and '=' prefixes from $lib"
4206 tmpdir=`func_mktempdir`
4207 for lib in $libs; do
4208 $SED -e "$sysroot_cmd s/\([ ']-[LR]\)=/\1/g; s/\([ ']\)=/\1/g" $lib \
4210 mv -f $tmpdir/tmp-la $lib
4216 if test -n "$finish_cmds$finish_eval" && test -n "$libdirs"; then
4217 for libdir in $libdirs; do
4218 if test -n "$finish_cmds"; then
4219 # Do each command in the finish commands.
4220 func_execute_cmds "$finish_cmds" 'admincmds="$admincmds
4223 if test -n "$finish_eval"; then
4224 # Do the single finish_eval.
4225 eval cmds=\"$finish_eval\"
4226 $opt_dry_run || eval "$cmds" || func_append admincmds "
4232 # Exit here if they wanted silent mode.
4233 $opt_quiet && exit $EXIT_SUCCESS
4235 if test -n "$finish_cmds$finish_eval" && test -n "$libdirs"; then
4236 echo "----------------------------------------------------------------------"
4237 echo "Libraries have been installed in:"
4238 for libdir in $libdirs; do
4242 echo "If you ever happen to want to link against installed libraries"
4243 echo "in a given directory, LIBDIR, you must either use libtool, and"
4244 echo "specify the full pathname of the library, or use the '-LLIBDIR'"
4245 echo "flag during linking and do at least one of the following:"
4246 if test -n "$shlibpath_var"; then
4247 echo " - add LIBDIR to the '$shlibpath_var' environment variable"
4248 echo " during execution"
4250 if test -n "$runpath_var"; then
4251 echo " - add LIBDIR to the '$runpath_var' environment variable"
4252 echo " during linking"
4254 if test -n "$hardcode_libdir_flag_spec"; then
4256 eval flag=\"$hardcode_libdir_flag_spec\"
4258 $ECHO " - use the '$flag' linker flag"
4260 if test -n "$admincmds"; then
4261 $ECHO " - have your system administrator run these commands:$admincmds"
4263 if test -f /etc/ld.so.conf; then
4264 echo " - have your system administrator add LIBDIR to '/etc/ld.so.conf'"
4268 echo "See any operating system documentation about shared libraries for"
4270 solaris2.[6789]|solaris2.1[0-9])
4271 echo "more information, such as the ld(1), crle(1) and ld.so(8) manual"
4275 echo "more information, such as the ld(1) and ld.so(8) manual pages."
4278 echo "----------------------------------------------------------------------"
4283 test finish = "$opt_mode" && func_mode_finish ${1+"$@"}
4286 # func_mode_install arg...
4287 func_mode_install ()
4291 # There may be an optional sh(1) argument at the beginning of
4292 # install_prog (especially on Windows NT).
4293 if test "$SHELL" = "$nonopt" || test /bin/sh = "$nonopt" ||
4294 # Allow the use of GNU shtool's install command.
4295 case $nonopt in *shtool*) :;; *) false;; esac
4297 # Aesthetically quote it.
4298 func_quote_arg pretty "$nonopt"
4299 install_prog="$func_quote_arg_result "
4307 # The real first argument should be the name of the installation program.
4308 # Aesthetically quote it.
4309 func_quote_arg pretty "$arg"
4310 func_append install_prog "$func_quote_arg_result"
4311 install_shared_prog=$install_prog
4312 case " $install_prog " in
4313 *[\\\ /]cp\ *) install_cp=: ;;
4314 *) install_cp=false ;;
4317 # We need to accept at least all the BSD install flags.
4329 if test -n "$dest"; then
4330 func_append files " $dest"
4338 if $install_cp; then :; else
4352 # If the previous option needed an argument, then skip it.
4353 if test -n "$prev"; then
4354 if test X-m = "X$prev" && test -n "$install_override_mode"; then
4355 arg2=$install_override_mode
4366 # Aesthetically quote the argument.
4367 func_quote_arg pretty "$arg"
4368 func_append install_prog " $func_quote_arg_result"
4369 if test -n "$arg2"; then
4370 func_quote_arg pretty "$arg2"
4372 func_append install_shared_prog " $func_quote_arg_result"
4375 test -z "$install_prog" && \
4376 func_fatal_help "you must specify an install program"
4378 test -n "$prev" && \
4379 func_fatal_help "the '$prev' option requires an argument"
4381 if test -n "$install_override_mode" && $no_mode; then
4382 if $install_cp; then :; else
4383 func_quote_arg pretty "$install_override_mode"
4384 func_append install_shared_prog " -m $func_quote_arg_result"
4388 if test -z "$files"; then
4389 if test -z "$dest"; then
4390 func_fatal_help "no file or destination specified"
4392 func_fatal_help "you must specify a destination"
4396 # Strip any trailing slash from the destination.
4397 func_stripname '' '/' "$dest"
4398 dest=$func_stripname_result
4400 # Check to see that the destination is a directory.
4401 test -d "$dest" && isdir=:
4406 func_dirname_and_basename "$dest" "" "."
4407 destdir=$func_dirname_result
4408 destname=$func_basename_result
4409 func_stripname '' '/' "$destdir"
4410 destdir=$func_stripname_result
4412 # Not a directory, so check to see that there is only one file specified.
4413 set dummy $files; shift
4414 test "$#" -gt 1 && \
4415 func_fatal_help "'$dest' is not a directory"
4418 [\\/]* | [A-Za-z]:[\\/]*)
4419 func_normal_abspath "$destdir"
4420 destdir="$func_normal_abspath_result"
4423 for file in $files; do
4427 func_fatal_help "'$destdir' must be an absolute directory name"
4434 # This variable tells wrapper scripts just to set variables rather
4435 # than running their programs.
4436 libtool_install_magic=$magic
4441 for file in $files; do
4443 # Do each installation.
4446 # Do the static libraries later.
4447 func_append staticlibs " $file"
4451 func_resolve_sysroot "$file"
4452 file=$func_resolve_sysroot_result
4454 # Check to see that this really is a libtool archive.
4455 func_lalib_unsafe_p "$file" \
4456 || func_fatal_help "'$file' is not a valid libtool archive"
4463 # Add the libdir to current_libdirs if it is the destination.
4464 if test "X$destdir" = "X$libdir"; then
4465 case "$current_libdirs " in
4467 *) func_append current_libdirs " $libdir" ;;
4470 # Note the libdir as a future libdir.
4471 case "$future_libdirs " in
4473 *) func_append future_libdirs " $libdir" ;;
4477 func_dirname "$file" "/" ""
4478 dir=$func_dirname_result
4479 func_append dir "$objdir"
4481 if test -n "$relink_command"; then
4482 # Determine the prefix the user has applied to our future dir.
4483 inst_prefix_dir=`$ECHO "$destdir" | $SED -e "s%$libdir\$%%"`
4485 # Don't allow the user to place us outside of our expected
4486 # location b/c this prevents finding dependent libraries that
4487 # are installed to the same prefix.
4488 # At present, this check doesn't affect windows .dll's that
4489 # are installed into $libdir/../bin (currently, that works fine)
4490 # but it's something to keep an eye on.
4491 test "$inst_prefix_dir" = "$destdir" && \
4492 func_fatal_error "error: cannot install '$file' to a directory not ending in $libdir"
4494 if test -n "$inst_prefix_dir"; then
4495 # Stick the inst_prefix_dir data into the link command.
4496 relink_command=`$ECHO "$relink_command" | $SED "s%@inst_prefix_dir@%-inst-prefix-dir $inst_prefix_dir%"`
4498 relink_command=`$ECHO "$relink_command" | $SED "s%@inst_prefix_dir@%%"`
4501 func_warning "relinking '$file'"
4502 func_show_eval "$relink_command" \
4503 'func_fatal_error "error: relink '\''$file'\'' with the above command before installing it"'
4506 # See the names of the shared library.
4507 set dummy $library_names; shift
4508 if test -n "$1"; then
4513 test -n "$relink_command" && srcname=${realname}T
4515 # Install the shared library and build the symlinks.
4516 func_show_eval "$install_shared_prog $dir/$srcname $destdir/$realname" \
4520 cygwin* | mingw* | pw32* | cegcc*)
4535 if test -n "$tstripme" && test -n "$striplib"; then
4536 func_show_eval "$striplib $destdir/$realname" 'exit $?'
4539 if test "$#" -gt 0; then
4540 # Delete the old symlinks, and create new ones.
4541 # Try 'ln -sf' first, because the 'ln' binary might depend on
4542 # the symlink we replace! Solaris /bin/ln does not understand -f,
4543 # so we also need to try rm && ln -s.
4546 test "$linkname" != "$realname" \
4547 && func_show_eval "(cd $destdir && { $LN_S -f $realname $linkname || { $RM $linkname && $LN_S $realname $linkname; }; })"
4551 # Do each command in the postinstall commands.
4552 lib=$destdir/$realname
4553 func_execute_cmds "$postinstall_cmds" 'exit $?'
4556 # Install the pseudo-library for information purposes.
4557 func_basename "$file"
4558 name=$func_basename_result
4559 instname=$dir/${name}i
4560 func_show_eval "$install_prog $instname $destdir/$name" 'exit $?'
4562 # Maybe install the static library, too.
4563 test -n "$old_library" && func_append staticlibs " $dir/$old_library"
4567 # Install (i.e. copy) a libtool object.
4569 # Figure out destination file name, if it wasn't already specified.
4570 if test -n "$destname"; then
4571 destfile=$destdir/$destname
4573 func_basename "$file"
4574 destfile=$func_basename_result
4575 destfile=$destdir/$destfile
4578 # Deduce the name of the destination old-style object file.
4581 func_lo2o "$destfile"
4582 staticdest=$func_lo2o_result
4585 staticdest=$destfile
4589 func_fatal_help "cannot copy a libtool object to '$destfile'"
4593 # Install the libtool object if requested.
4594 test -n "$destfile" && \
4595 func_show_eval "$install_prog $file $destfile" 'exit $?'
4597 # Install the old object if enabled.
4598 if test yes = "$build_old_libs"; then
4599 # Deduce the name of the old-style object file.
4601 staticobj=$func_lo2o_result
4602 func_show_eval "$install_prog \$staticobj \$staticdest" 'exit $?'
4608 # Figure out destination file name, if it wasn't already specified.
4609 if test -n "$destname"; then
4610 destfile=$destdir/$destname
4612 func_basename "$file"
4613 destfile=$func_basename_result
4614 destfile=$destdir/$destfile
4617 # If the file is missing, and there is a .exe on the end, strip it
4618 # because it is most likely a libtool script we actually want to
4623 if test ! -f "$file"; then
4624 func_stripname '' '.exe' "$file"
4625 file=$func_stripname_result
4631 # Do a test to see if this is really a libtool program.
4634 if func_ltwrapper_executable_p "$file"; then
4635 func_ltwrapper_scriptname "$file"
4636 wrapper=$func_ltwrapper_scriptname_result
4638 func_stripname '' '.exe' "$file"
4639 wrapper=$func_stripname_result
4646 if func_ltwrapper_script_p "$wrapper"; then
4650 func_source "$wrapper"
4652 # Check the variables that should have been set.
4653 test -z "$generated_by_libtool_version" && \
4654 func_fatal_error "invalid libtool wrapper script '$wrapper'"
4657 for lib in $notinst_deplibs; do
4658 # Check to see that each library is installed.
4660 if test -f "$lib"; then
4663 libfile=$libdir/`$ECHO "$lib" | $SED 's%^.*/%%g'`
4664 if test -n "$libdir" && test ! -f "$libfile"; then
4665 func_warning "'$lib' has not been installed in '$libdir'"
4671 func_source "$wrapper"
4674 if test no = "$fast_install" && test -n "$relink_command"; then
4677 tmpdir=`func_mktempdir`
4678 func_basename "$file$stripped_ext"
4679 file=$func_basename_result
4680 outputname=$tmpdir/$file
4681 # Replace the output file specification.
4682 relink_command=`$ECHO "$relink_command" | $SED 's%@OUTPUT@%'"$outputname"'%g'`
4685 func_quote_arg expand,pretty "$relink_command"
4686 eval "func_echo $func_quote_arg_result"
4688 if eval "$relink_command"; then :
4690 func_error "error: relink '$file' with the above command before installing it"
4691 $opt_dry_run || ${RM}r "$tmpdir"
4696 func_warning "cannot relink '$file'"
4700 # Install the binary that we compiled earlier.
4701 file=`$ECHO "$file$stripped_ext" | $SED "s%\([^/]*\)$%$objdir/\1%"`
4705 # remove .exe since cygwin /usr/bin/install will append another
4707 case $install_prog,$host in
4708 */usr/bin/install*,*cygwin*)
4709 case $file:$destfile in
4714 destfile=$destfile.exe
4717 func_stripname '' '.exe' "$destfile"
4718 destfile=$func_stripname_result
4723 func_show_eval "$install_prog\$stripme \$file \$destfile" 'exit $?'
4724 $opt_dry_run || if test -n "$outputname"; then
4731 for file in $staticlibs; do
4732 func_basename "$file"
4733 name=$func_basename_result
4735 # Set up the ranlib parameters.
4736 oldlib=$destdir/$name
4737 func_to_tool_file "$oldlib" func_convert_file_msys_to_w32
4738 tool_oldlib=$func_to_tool_file_result
4740 func_show_eval "$install_prog \$file \$oldlib" 'exit $?'
4742 if test -n "$stripme" && test -n "$old_striplib"; then
4743 func_show_eval "$old_striplib $tool_oldlib" 'exit $?'
4746 # Do each command in the postinstall commands.
4747 func_execute_cmds "$old_postinstall_cmds" 'exit $?'
4750 test -n "$future_libdirs" && \
4751 func_warning "remember to run '$progname --finish$future_libdirs'"
4753 if test -n "$current_libdirs"; then
4754 # Maybe just do a dry run.
4755 $opt_dry_run && current_libdirs=" -n$current_libdirs"
4756 exec_cmd='$SHELL "$progpath" $preserve_args --finish$current_libdirs'
4762 test install = "$opt_mode" && func_mode_install ${1+"$@"}
4765 # func_generate_dlsyms outputname originator pic_p
4766 # Extract symbols from dlprefiles and create ${outputname}S.o with
4767 # a dlpreopen symbol table.
4768 func_generate_dlsyms ()
4775 my_prefix=`$ECHO "$my_originator" | $SED 's%[^a-zA-Z0-9]%_%g'`
4778 if test -n "$dlfiles$dlprefiles" || test no != "$dlself"; then
4779 if test -n "$NM" && test -n "$global_symbol_pipe"; then
4780 my_dlsyms=${my_outputname}S.c
4782 func_error "not configured to extract global symbols from dlpreopened files"
4786 if test -n "$my_dlsyms"; then
4790 # Discover the nlist of each of the dlfiles.
4791 nlist=$output_objdir/$my_outputname.nm
4793 func_show_eval "$RM $nlist ${nlist}S ${nlist}T"
4795 # Parse the name list into a source file.
4796 func_verbose "creating $output_objdir/$my_dlsyms"
4798 $opt_dry_run || $ECHO > "$output_objdir/$my_dlsyms" "\
4799 /* $my_dlsyms - symbol resolution table for '$my_outputname' dlsym emulation. */
4800 /* Generated by $PROGRAM (GNU $PACKAGE) $VERSION */
4806 #if defined __GNUC__ && (((__GNUC__ == 4) && (__GNUC_MINOR__ >= 4)) || (__GNUC__ > 4))
4807 #pragma GCC diagnostic ignored \"-Wstrict-prototypes\"
4810 /* Keep this code in sync between libtool.m4, ltmain, lt_system.h, and tests. */
4811 #if defined _WIN32 || defined __CYGWIN__ || defined _WIN32_WCE
4812 /* DATA imports from DLLs on WIN32 can't be const, because runtime
4813 relocations are performed -- see ld's documentation on pseudo-relocs. */
4814 # define LT_DLSYM_CONST
4815 #elif defined __osf__
4816 /* This system does not cope well with relocations in const data. */
4817 # define LT_DLSYM_CONST
4819 # define LT_DLSYM_CONST const
4822 #define STREQ(s1, s2) (strcmp ((s1), (s2)) == 0)
4824 /* External symbol declarations for the compiler. */\
4827 if test yes = "$dlself"; then
4828 func_verbose "generating symbol list for '$output'"
4830 $opt_dry_run || echo ': @PROGRAM@ ' > "$nlist"
4832 # Add our own program objects to the symbol list.
4833 progfiles=`$ECHO "$objs$old_deplibs" | $SP2NL | $SED "$lo2o" | $NL2SP`
4834 for progfile in $progfiles; do
4835 func_to_tool_file "$progfile" func_convert_file_msys_to_w32
4836 func_verbose "extracting global C symbols from '$func_to_tool_file_result'"
4837 $opt_dry_run || eval "$NM $func_to_tool_file_result | $global_symbol_pipe >> '$nlist'"
4840 if test -n "$exclude_expsyms"; then
4842 eval '$EGREP -v " ($exclude_expsyms)$" "$nlist" > "$nlist"T'
4843 eval '$MV "$nlist"T "$nlist"'
4847 if test -n "$export_symbols_regex"; then
4849 eval '$EGREP -e "$export_symbols_regex" "$nlist" > "$nlist"T'
4850 eval '$MV "$nlist"T "$nlist"'
4854 # Prepare the list of exported symbols
4855 if test -z "$export_symbols"; then
4856 export_symbols=$output_objdir/$outputname.exp
4859 eval "$SED -n -e '/^: @PROGRAM@ $/d' -e 's/^.* \(.*\)$/\1/p' "'< "$nlist" > "$export_symbols"'
4861 *cygwin* | *mingw* | *cegcc* )
4862 eval "echo EXPORTS "'> "$output_objdir/$outputname.def"'
4863 eval 'cat "$export_symbols" >> "$output_objdir/$outputname.def"'
4869 eval "$SED -e 's/\([].[*^$]\)/\\\\\1/g' -e 's/^/ /' -e 's/$/$/'"' < "$export_symbols" > "$output_objdir/$outputname.exp"'
4870 eval '$GREP -f "$output_objdir/$outputname.exp" < "$nlist" > "$nlist"T'
4871 eval '$MV "$nlist"T "$nlist"'
4873 *cygwin* | *mingw* | *cegcc* )
4874 eval "echo EXPORTS "'> "$output_objdir/$outputname.def"'
4875 eval 'cat "$nlist" >> "$output_objdir/$outputname.def"'
4882 for dlprefile in $dlprefiles; do
4883 func_verbose "extracting global C symbols from '$dlprefile'"
4884 func_basename "$dlprefile"
4885 name=$func_basename_result
4887 *cygwin* | *mingw* | *cegcc* )
4888 # if an import library, we need to obtain dlname
4889 if func_win32_import_lib_p "$dlprefile"; then
4890 func_tr_sh "$dlprefile"
4891 eval "curr_lafile=\$libfile_$func_tr_sh_result"
4892 dlprefile_dlbasename=
4893 if test -n "$curr_lafile" && func_lalib_p "$curr_lafile"; then
4894 # Use subshell, to avoid clobbering current variable values
4895 dlprefile_dlname=`source "$curr_lafile" && echo "$dlname"`
4896 if test -n "$dlprefile_dlname"; then
4897 func_basename "$dlprefile_dlname"
4898 dlprefile_dlbasename=$func_basename_result
4900 # no lafile. user explicitly requested -dlpreopen <import library>.
4901 $sharedlib_from_linklib_cmd "$dlprefile"
4902 dlprefile_dlbasename=$sharedlib_from_linklib_result
4906 if test -n "$dlprefile_dlbasename"; then
4907 eval '$ECHO ": $dlprefile_dlbasename" >> "$nlist"'
4909 func_warning "Could not compute DLL name from $name"
4910 eval '$ECHO ": $name " >> "$nlist"'
4912 func_to_tool_file "$dlprefile" func_convert_file_msys_to_w32
4913 eval "$NM \"$func_to_tool_file_result\" 2>/dev/null | $global_symbol_pipe |
4914 $SED -e '/I __imp/d' -e 's/I __nm_/D /;s/_nm__//' >> '$nlist'"
4916 else # not an import lib
4918 eval '$ECHO ": $name " >> "$nlist"'
4919 func_to_tool_file "$dlprefile" func_convert_file_msys_to_w32
4920 eval "$NM \"$func_to_tool_file_result\" 2>/dev/null | $global_symbol_pipe >> '$nlist'"
4926 eval '$ECHO ": $name " >> "$nlist"'
4927 func_to_tool_file "$dlprefile" func_convert_file_msys_to_w32
4928 eval "$NM \"$func_to_tool_file_result\" 2>/dev/null | $global_symbol_pipe >> '$nlist'"
4935 # Make sure we have at least an empty file.
4936 test -f "$nlist" || : > "$nlist"
4938 if test -n "$exclude_expsyms"; then
4939 $EGREP -v " ($exclude_expsyms)$" "$nlist" > "$nlist"T
4940 $MV "$nlist"T "$nlist"
4943 # Try sorting and uniquifying the output.
4944 if $GREP -v "^: " < "$nlist" |
4945 if sort -k 3 </dev/null >/dev/null 2>&1; then
4950 uniq > "$nlist"S; then
4953 $GREP -v "^: " < "$nlist" > "$nlist"S
4956 if test -f "$nlist"S; then
4957 eval "$global_symbol_to_cdecl"' < "$nlist"S >> "$output_objdir/$my_dlsyms"'
4959 echo '/* NONE */' >> "$output_objdir/$my_dlsyms"
4962 func_show_eval '$RM "${nlist}I"'
4963 if test -n "$global_symbol_to_import"; then
4964 eval "$global_symbol_to_import"' < "$nlist"S > "$nlist"I'
4967 echo >> "$output_objdir/$my_dlsyms" "\
4969 /* The mapping between symbol names and symbols. */
4974 extern LT_DLSYM_CONST lt_dlsymlist
4975 lt_${my_prefix}_LTX_preloaded_symbols[];\
4978 if test -s "$nlist"I; then
4979 echo >> "$output_objdir/$my_dlsyms" "\
4980 static void lt_syminit(void)
4982 LT_DLSYM_CONST lt_dlsymlist *symbol = lt_${my_prefix}_LTX_preloaded_symbols;
4983 for (; symbol->name; ++symbol)
4985 $SED 's/.*/ if (STREQ (symbol->name, \"&\")) symbol->address = (void *) \&&;/' < "$nlist"I >> "$output_objdir/$my_dlsyms"
4986 echo >> "$output_objdir/$my_dlsyms" "\
4990 echo >> "$output_objdir/$my_dlsyms" "\
4991 LT_DLSYM_CONST lt_dlsymlist
4992 lt_${my_prefix}_LTX_preloaded_symbols[] =
4993 { {\"$my_originator\", (void *) 0},"
4995 if test -s "$nlist"I; then
4996 echo >> "$output_objdir/$my_dlsyms" "\
4997 {\"@INIT@\", (void *) <_syminit},"
5000 case $need_lib_prefix in
5002 eval "$global_symbol_to_c_name_address" < "$nlist" >> "$output_objdir/$my_dlsyms"
5005 eval "$global_symbol_to_c_name_address_lib_prefix" < "$nlist" >> "$output_objdir/$my_dlsyms"
5008 echo >> "$output_objdir/$my_dlsyms" "\
5012 /* This works around a problem in FreeBSD linker */
5013 #ifdef FREEBSD_WORKAROUND
5014 static const void *lt_preloaded_setup() {
5015 return lt_${my_prefix}_LTX_preloaded_symbols;
5025 pic_flag_for_symtable=
5026 case "$compile_command " in
5030 # compiling the symbol table file with pic_flag works around
5031 # a FreeBSD bug that causes programs to crash when -lm is
5032 # linked before any other PIC object. But we must not use
5033 # pic_flag when linking with -static. The problem exists in
5034 # FreeBSD 2.2.6 and is fixed in FreeBSD 3.1.
5035 *-*-freebsd2.*|*-*-freebsd3.0*|*-*-freebsdelf3.0*)
5036 pic_flag_for_symtable=" $pic_flag -DFREEBSD_WORKAROUND" ;;
5038 pic_flag_for_symtable=" $pic_flag" ;;
5040 $my_pic_p && pic_flag_for_symtable=" $pic_flag"
5046 for arg in $LTCFLAGS; do
5048 -pie | -fpie | -fPIE) ;;
5049 *) func_append symtab_cflags " $arg" ;;
5053 # Now compile the dynamic symbol file.
5054 func_show_eval '(cd $output_objdir && $LTCC$symtab_cflags -c$no_builtin_flag$pic_flag_for_symtable "$my_dlsyms")' 'exit $?'
5056 # Clean up the generated files.
5057 func_show_eval '$RM "$output_objdir/$my_dlsyms" "$nlist" "${nlist}S" "${nlist}T" "${nlist}I"'
5059 # Transform the symbol file into the correct name.
5060 symfileobj=$output_objdir/${my_outputname}S.$objext
5062 *cygwin* | *mingw* | *cegcc* )
5063 if test -f "$output_objdir/$my_outputname.def"; then
5064 compile_command=`$ECHO "$compile_command" | $SED "s%@SYMFILE@%$output_objdir/$my_outputname.def $symfileobj%"`
5065 finalize_command=`$ECHO "$finalize_command" | $SED "s%@SYMFILE@%$output_objdir/$my_outputname.def $symfileobj%"`
5067 compile_command=`$ECHO "$compile_command" | $SED "s%@SYMFILE@%$symfileobj%"`
5068 finalize_command=`$ECHO "$finalize_command" | $SED "s%@SYMFILE@%$symfileobj%"`
5072 compile_command=`$ECHO "$compile_command" | $SED "s%@SYMFILE@%$symfileobj%"`
5073 finalize_command=`$ECHO "$finalize_command" | $SED "s%@SYMFILE@%$symfileobj%"`
5078 func_fatal_error "unknown suffix for '$my_dlsyms'"
5082 # We keep going just in case the user didn't refer to
5083 # lt_preloaded_symbols. The linker will fail if global_symbol_pipe
5084 # really was required.
5086 # Nullify the symbol file.
5087 compile_command=`$ECHO "$compile_command" | $SED "s% @SYMFILE@%%"`
5088 finalize_command=`$ECHO "$finalize_command" | $SED "s% @SYMFILE@%%"`
5092 # func_cygming_gnu_implib_p ARG
5093 # This predicate returns with zero status (TRUE) if
5094 # ARG is a GNU/binutils-style import library. Returns
5095 # with nonzero status (FALSE) otherwise.
5096 func_cygming_gnu_implib_p ()
5100 func_to_tool_file "$1" func_convert_file_msys_to_w32
5101 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)$'`
5102 test -n "$func_cygming_gnu_implib_tmp"
5105 # func_cygming_ms_implib_p ARG
5106 # This predicate returns with zero status (TRUE) if
5107 # ARG is an MS-style import library. Returns
5108 # with nonzero status (FALSE) otherwise.
5109 func_cygming_ms_implib_p ()
5113 func_to_tool_file "$1" func_convert_file_msys_to_w32
5114 func_cygming_ms_implib_tmp=`$NM "$func_to_tool_file_result" | eval "$global_symbol_pipe" | $GREP '_NULL_IMPORT_DESCRIPTOR'`
5115 test -n "$func_cygming_ms_implib_tmp"
5118 # func_win32_libid arg
5119 # return the library type of file 'arg'
5121 # Need a lot of goo to handle *both* DLLs and import libs
5122 # Has to be a shell function in order to 'eat' the argument
5123 # that is supplied when $file_magic_command is called.
5124 # Despite the name, also deal with 64 bit binaries.
5129 win32_libid_type=unknown
5130 win32_fileres=`file -L $1 2>/dev/null`
5131 case $win32_fileres in
5132 *ar\ archive\ import\ library*) # definitely import
5133 win32_libid_type="x86 archive import"
5135 *ar\ archive*) # could be an import, or static
5136 # Keep the egrep pattern in sync with the one in _LT_CHECK_MAGIC_METHOD.
5137 if eval $OBJDUMP -f $1 | $SED -e '10q' 2>/dev/null |
5138 $EGREP 'file format (pei*-i386(.*architecture: i386)?|pe-arm-wince|pe-x86-64)' >/dev/null; then
5139 case $nm_interface in
5141 if func_cygming_ms_implib_p "$1" ||
5142 func_cygming_gnu_implib_p "$1"
5150 func_to_tool_file "$1" func_convert_file_msys_to_w32
5151 win32_nmres=`eval $NM -f posix -A \"$func_to_tool_file_result\" |
5162 case $win32_nmres in
5163 import*) win32_libid_type="x86 archive import";;
5164 *) win32_libid_type="x86 archive static";;
5169 win32_libid_type="x86 DLL"
5171 *executable*) # but shell scripts are "executable" too...
5172 case $win32_fileres in
5173 *MS\ Windows\ PE\ Intel*)
5174 win32_libid_type="x86 DLL"
5179 $ECHO "$win32_libid_type"
5182 # func_cygming_dll_for_implib ARG
5184 # Platform-specific function to extract the
5185 # name of the DLL associated with the specified
5186 # import library ARG.
5187 # Invoked by eval'ing the libtool variable
5188 # $sharedlib_from_linklib_cmd
5189 # Result is available in the variable
5190 # $sharedlib_from_linklib_result
5191 func_cygming_dll_for_implib ()
5195 sharedlib_from_linklib_result=`$DLLTOOL --identify-strict --identify "$1"`
5198 # func_cygming_dll_for_implib_fallback_core SECTION_NAME LIBNAMEs
5200 # The is the core of a fallback implementation of a
5201 # platform-specific function to extract the name of the
5202 # DLL associated with the specified import library LIBNAME.
5204 # SECTION_NAME is either .idata$6 or .idata$7, depending
5205 # on the platform and compiler that created the implib.
5207 # Echos the name of the DLL associated with the
5208 # specified import library.
5209 func_cygming_dll_for_implib_fallback_core ()
5213 match_literal=`$ECHO "$1" | $SED "$sed_make_literal_regex"`
5214 $OBJDUMP -s --section "$1" "$2" 2>/dev/null |
5215 $SED '/^Contents of section '"$match_literal"':/{
5216 # Place marker at beginning of archive member dllname section
5221 # These lines can sometimes be longer than 43 characters, but
5222 # are always uninteresting
5223 /:[ ]*file format pe[i]\{,1\}-/d
5224 /^In archive [^:]*:/d
5225 # Ensure marker is printed
5227 # Remove all lines with less than 43 characters
5229 # From remaining lines, remove first 43 characters
5232 # Join marker and all lines until next marker into a single line
5233 /^====MARK====/ b para
5242 # Remove trailing dots and whitespace
5246 # we now have a list, one entry per line, of the stringified
5247 # contents of the appropriate section of all members of the
5248 # archive that possess that section. Heuristic: eliminate
5249 # all those that have a first or second character that is
5250 # a '.' (that is, objdump's representation of an unprintable
5251 # character.) This should work for all archives with less than
5252 # 0x302f exports -- but will fail for DLLs whose name actually
5253 # begins with a literal '.' or a single character followed by
5256 # Of those that remain, print the first one.
5257 $SED -e '/^\./d;/^.\./d;q'
5260 # func_cygming_dll_for_implib_fallback ARG
5261 # Platform-specific function to extract the
5262 # name of the DLL associated with the specified
5263 # import library ARG.
5265 # This fallback implementation is for use when $DLLTOOL
5266 # does not support the --identify-strict option.
5267 # Invoked by eval'ing the libtool variable
5268 # $sharedlib_from_linklib_cmd
5269 # Result is available in the variable
5270 # $sharedlib_from_linklib_result
5271 func_cygming_dll_for_implib_fallback ()
5275 if func_cygming_gnu_implib_p "$1"; then
5276 # binutils import library
5277 sharedlib_from_linklib_result=`func_cygming_dll_for_implib_fallback_core '.idata$7' "$1"`
5278 elif func_cygming_ms_implib_p "$1"; then
5279 # ms-generated import library
5280 sharedlib_from_linklib_result=`func_cygming_dll_for_implib_fallback_core '.idata$6' "$1"`
5283 sharedlib_from_linklib_result=
5288 # func_extract_an_archive dir oldlib
5289 func_extract_an_archive ()
5293 f_ex_an_ar_dir=$1; shift
5294 f_ex_an_ar_oldlib=$1
5295 if test yes = "$lock_old_archive_extraction"; then
5296 lockfile=$f_ex_an_ar_oldlib.lock
5297 until $opt_dry_run || ln "$progpath" "$lockfile" 2>/dev/null; do
5298 func_echo "Waiting for $lockfile to be removed"
5302 func_show_eval "(cd \$f_ex_an_ar_dir && $AR x \"\$f_ex_an_ar_oldlib\")" \
5303 'stat=$?; rm -f "$lockfile"; exit $stat'
5304 if test yes = "$lock_old_archive_extraction"; then
5305 $opt_dry_run || rm -f "$lockfile"
5307 if ($AR t "$f_ex_an_ar_oldlib" | sort | sort -uc >/dev/null 2>&1); then
5310 func_fatal_error "object name conflicts in archive: $f_ex_an_ar_dir/$f_ex_an_ar_oldlib"
5315 # func_extract_archives gentop oldlib ...
5316 func_extract_archives ()
5321 my_oldlibs=${1+"$@"}
5327 for my_xlib in $my_oldlibs; do
5328 # Extract the objects.
5330 [\\/]* | [A-Za-z]:[\\/]*) my_xabs=$my_xlib ;;
5331 *) my_xabs=`pwd`"/$my_xlib" ;;
5333 func_basename "$my_xlib"
5334 my_xlib=$func_basename_result
5337 case " $extracted_archives " in
5339 func_arith $extracted_serial + 1
5340 extracted_serial=$func_arith_result
5341 my_xlib_u=lt$extracted_serial-$my_xlib ;;
5345 extracted_archives="$extracted_archives $my_xlib_u"
5346 my_xdir=$my_gentop/$my_xlib_u
5348 func_mkdir_p "$my_xdir"
5352 func_verbose "Extracting $my_xabs"
5353 # Do not bother doing anything if just a dry run
5355 darwin_orig_dir=`pwd`
5356 cd $my_xdir || exit $?
5357 darwin_archive=$my_xabs
5359 func_basename "$darwin_archive"
5360 darwin_base_archive=$func_basename_result
5361 darwin_arches=`$LIPO -info "$darwin_archive" 2>/dev/null | $GREP Architectures 2>/dev/null || true`
5362 if test -n "$darwin_arches"; then
5363 darwin_arches=`$ECHO "$darwin_arches" | $SED -e 's/.*are://'`
5365 func_verbose "$darwin_base_archive has multiple architectures $darwin_arches"
5366 for darwin_arch in $darwin_arches; do
5367 func_mkdir_p "unfat-$$/$darwin_base_archive-$darwin_arch"
5368 $LIPO -thin $darwin_arch -output "unfat-$$/$darwin_base_archive-$darwin_arch/$darwin_base_archive" "$darwin_archive"
5369 cd "unfat-$$/$darwin_base_archive-$darwin_arch"
5370 func_extract_an_archive "`pwd`" "$darwin_base_archive"
5372 $RM "unfat-$$/$darwin_base_archive-$darwin_arch/$darwin_base_archive"
5373 done # $darwin_arches
5374 ## Okay now we've a bunch of thin objects, gotta fatten them up :)
5375 darwin_filelist=`find unfat-$$ -type f -name \*.o -print -o -name \*.lo -print | $SED -e "$sed_basename" | sort -u`
5378 for darwin_file in $darwin_filelist; do
5379 darwin_files=`find unfat-$$ -name $darwin_file -print | sort | $NL2SP`
5380 $LIPO -create -output "$darwin_file" $darwin_files
5381 done # $darwin_filelist
5383 cd "$darwin_orig_dir"
5386 func_extract_an_archive "$my_xdir" "$my_xabs"
5391 func_extract_an_archive "$my_xdir" "$my_xabs"
5394 my_oldobjs="$my_oldobjs "`find $my_xdir -name \*.$objext -print -o -name \*.lo -print | sort | $NL2SP`
5397 func_extract_archives_result=$my_oldobjs
5401 # func_emit_wrapper [arg=no]
5403 # Emit a libtool wrapper script on stdout.
5404 # Don't directly open a file because we may want to
5405 # incorporate the script contents within a cygwin/mingw
5406 # wrapper executable. Must ONLY be called from within
5407 # func_mode_link because it depends on a number of variables
5410 # ARG is the value that the WRAPPER_SCRIPT_BELONGS_IN_OBJDIR
5411 # variable will take. If 'yes', then the emitted script
5412 # will assume that the directory where it is stored is
5413 # the $objdir directory. This is a cygwin/mingw-specific
5415 func_emit_wrapper ()
5417 func_emit_wrapper_arg1=${1-no}
5422 # $output - temporary wrapper script for $objdir/$outputname
5423 # Generated by $PROGRAM (GNU $PACKAGE) $VERSION
5425 # The $output program cannot be directly executed until all the libtool
5426 # libraries that it depends on are installed.
5428 # This wrapper script should never be moved out of the build directory.
5429 # If it is, it will not operate correctly.
5431 # Sed substitution that helps us do robust quoting. It backslashifies
5432 # metacharacters that are still active within double-quoted strings.
5433 sed_quote_subst='$sed_quote_subst'
5435 # Be Bourne compatible
5436 if test -n \"\${ZSH_VERSION+set}\" && (emulate sh) >/dev/null 2>&1; then
5439 # Zsh 3.x and 4.x performs word splitting on \${1+\"\$@\"}, which
5440 # is contrary to our usage. Disable this feature.
5441 alias -g '\${1+\"\$@\"}'='\"\$@\"'
5442 setopt NO_GLOB_SUBST
5444 case \`(set -o) 2>/dev/null\` in *posix*) set -o posix;; esac
5446 BIN_SH=xpg4; export BIN_SH # for Tru64
5447 DUALCASE=1; export DUALCASE # for MKS sh
5449 # The HP-UX ksh and POSIX shell print the target directory to stdout
5451 (unset CDPATH) >/dev/null 2>&1 && unset CDPATH
5453 relink_command=\"$relink_command\"
5455 # This environment variable determines our operation mode.
5456 if test \"\$libtool_install_magic\" = \"$magic\"; then
5457 # install mode needs the following variables:
5458 generated_by_libtool_version='$macro_version'
5459 notinst_deplibs='$notinst_deplibs'
5461 # When we are sourced in execute mode, \$file and \$ECHO are already set.
5462 if test \"\$libtool_execute_magic\" != \"$magic\"; then
5465 func_quote_arg pretty "$ECHO"
5466 qECHO=$func_quote_arg_result
5469 # A function that is used when there is no print builtin or printf.
5470 func_fallback_echo ()
5472 eval 'cat <<_LTECHO_EOF
5479 # Very basic option parsing. These options are (a) specific to
5480 # the libtool wrapper, (b) are identical between the wrapper
5481 # /script/ and the wrapper /executable/ that is used only on
5482 # windows platforms, and (c) all begin with the string "--lt-"
5483 # (application programs are unlikely to have options that match
5486 # There are only two supported options: --lt-debug and
5487 # --lt-dump-script. There is, deliberately, no --lt-help.
5489 # The first argument to this parsing function should be the
5490 # script's $0 value, followed by "$@".
5492 func_parse_lt_options ()
5498 case \"\$lt_opt\" in
5499 --lt-debug) lt_option_debug=1 ;;
5501 lt_dump_D=\`\$ECHO \"X\$lt_script_arg0\" | $SED -e 's/^X//' -e 's%/[^/]*$%%'\`
5502 test \"X\$lt_dump_D\" = \"X\$lt_script_arg0\" && lt_dump_D=.
5503 lt_dump_F=\`\$ECHO \"X\$lt_script_arg0\" | $SED -e 's/^X//' -e 's%^.*/%%'\`
5504 cat \"\$lt_dump_D/\$lt_dump_F\"
5508 \$ECHO \"Unrecognized --lt- option: '\$lt_opt'\" 1>&2
5514 # Print the debug banner immediately:
5515 if test -n \"\$lt_option_debug\"; then
5516 echo \"$outputname:$output:\$LINENO: libtool wrapper (GNU $PACKAGE) $VERSION\" 1>&2
5520 # Used when --lt-debug. Prints its arguments to stdout
5521 # (redirection is the responsibility of the caller)
5522 func_lt_dump_args ()
5527 \$ECHO \"$outputname:$output:\$LINENO: newargv[\$lt_dump_args_N]: \$lt_arg\"
5528 lt_dump_args_N=\`expr \$lt_dump_args_N + 1\`
5532 # Core function for launching the target application
5533 func_exec_program_core ()
5537 # Backslashes separate directories on plain windows
5538 *-*-mingw | *-*-os2* | *-cegcc*)
5540 if test -n \"\$lt_option_debug\"; then
5541 \$ECHO \"$outputname:$output:\$LINENO: newargv[0]: \$progdir\\\\\$program\" 1>&2
5542 func_lt_dump_args \${1+\"\$@\"} 1>&2
5544 exec \"\$progdir\\\\\$program\" \${1+\"\$@\"}
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+\"\$@\"}
5559 \$ECHO \"\$0: cannot exec \$program \$*\" 1>&2
5563 # A function to encapsulate launching the target application
5564 # Strips options in the --lt-* namespace from \$@ and
5565 # launches target application with the remaining arguments.
5566 func_exec_program ()
5574 *) set x \"\$@\" \"\$lt_wr_arg\"; shift;;
5579 func_exec_program_core \${1+\"\$@\"}
5583 func_parse_lt_options \"\$0\" \${1+\"\$@\"}
5585 # Find the directory that this script lives in.
5586 thisdir=\`\$ECHO \"\$file\" | $SED 's%/[^/]*$%%'\`
5587 test \"x\$thisdir\" = \"x\$file\" && thisdir=.
5589 # Follow symbolic links until we get to the real thisdir.
5590 file=\`ls -ld \"\$file\" | $SED -n 's/.*-> //p'\`
5591 while test -n \"\$file\"; do
5592 destdir=\`\$ECHO \"\$file\" | $SED 's%/[^/]*\$%%'\`
5594 # If there was a directory component, then change thisdir.
5595 if test \"x\$destdir\" != \"x\$file\"; then
5596 case \"\$destdir\" in
5597 [\\\\/]* | [A-Za-z]:[\\\\/]*) thisdir=\"\$destdir\" ;;
5598 *) thisdir=\"\$thisdir/\$destdir\" ;;
5602 file=\`\$ECHO \"\$file\" | $SED 's%^.*/%%'\`
5603 file=\`ls -ld \"\$thisdir/\$file\" | $SED -n 's/.*-> //p'\`
5606 # Usually 'no', except on cygwin/mingw when embedded into
5608 WRAPPER_SCRIPT_BELONGS_IN_OBJDIR=$func_emit_wrapper_arg1
5609 if test \"\$WRAPPER_SCRIPT_BELONGS_IN_OBJDIR\" = \"yes\"; then
5610 # special case for '.'
5611 if test \"\$thisdir\" = \".\"; then
5614 # remove .libs from thisdir
5615 case \"\$thisdir\" in
5616 *[\\\\/]$objdir ) thisdir=\`\$ECHO \"\$thisdir\" | $SED 's%[\\\\/][^\\\\/]*$%%'\` ;;
5617 $objdir ) thisdir=. ;;
5621 # Try to get the absolute directory name.
5622 absdir=\`cd \"\$thisdir\" && pwd\`
5623 test -n \"\$absdir\" && thisdir=\"\$absdir\"
5626 if test yes = "$fast_install"; then
5628 program=lt-'$outputname'$exeext
5629 progdir=\"\$thisdir/$objdir\"
5631 if test ! -f \"\$progdir/\$program\" ||
5632 { file=\`ls -1dt \"\$progdir/\$program\" \"\$progdir/../\$program\" 2>/dev/null | $SED 1q\`; \\
5633 test \"X\$file\" != \"X\$progdir/\$program\"; }; then
5635 file=\"\$\$-\$program\"
5637 if test ! -d \"\$progdir\"; then
5638 $MKDIR \"\$progdir\"
5640 $RM \"\$progdir/\$file\"
5645 # relink executable if necessary
5646 if test -n \"\$relink_command\"; then
5647 if relink_command_output=\`eval \$relink_command 2>&1\`; then :
5649 \$ECHO \"\$relink_command_output\" >&2
5650 $RM \"\$progdir/\$file\"
5655 $MV \"\$progdir/\$file\" \"\$progdir/\$program\" 2>/dev/null ||
5656 { $RM \"\$progdir/\$program\";
5657 $MV \"\$progdir/\$file\" \"\$progdir/\$program\"; }
5658 $RM \"\$progdir/\$file\"
5662 program='$outputname'
5663 progdir=\"\$thisdir/$objdir\"
5669 if test -f \"\$progdir/\$program\"; then"
5671 # fixup the dll searchpath if we need to.
5673 # Fix the DLL searchpath if we need to. Do this before prepending
5674 # to shlibpath, because on Windows, both are PATH and uninstalled
5675 # libraries must come first.
5676 if test -n "$dllsearchpath"; then
5678 # Add the dll search path components to the executable PATH
5679 PATH=$dllsearchpath:\$PATH
5683 # Export our shlibpath_var if we have one.
5684 if test yes = "$shlibpath_overrides_runpath" && test -n "$shlibpath_var" && test -n "$temp_rpath"; then
5686 # Add our own library path to $shlibpath_var
5687 $shlibpath_var=\"$temp_rpath\$$shlibpath_var\"
5689 # Some systems cannot cope with colon-terminated $shlibpath_var
5690 # The second colon is a workaround for a bug in BeOS R4 sed
5691 $shlibpath_var=\`\$ECHO \"\$$shlibpath_var\" | $SED 's/::*\$//'\`
5693 export $shlibpath_var
5698 if test \"\$libtool_execute_magic\" != \"$magic\"; then
5699 # Run the actual program with our arguments.
5700 func_exec_program \${1+\"\$@\"}
5703 # The program doesn't exist.
5704 \$ECHO \"\$0: error: '\$progdir/\$program' does not exist\" 1>&2
5705 \$ECHO \"This script is just a wrapper for \$program.\" 1>&2
5706 \$ECHO \"See the $PACKAGE documentation for more information.\" 1>&2
5714 # func_emit_cwrapperexe_src
5715 # emit the source code for a wrapper executable on stdout
5716 # Must ONLY be called from within func_mode_link because
5717 # it depends on a number of variable set therein.
5718 func_emit_cwrapperexe_src ()
5722 /* $cwrappersource - temporary wrapper executable for $objdir/$outputname
5723 Generated by $PROGRAM (GNU $PACKAGE) $VERSION
5725 The $output program cannot be directly executed until all the libtool
5726 libraries that it depends on are installed.
5728 This wrapper executable should never be moved out of the build directory.
5729 If it is, it will not operate correctly.
5734 # define _CRT_SECURE_NO_DEPRECATE 1
5739 # include <direct.h>
5740 # include <process.h>
5743 # include <unistd.h>
5744 # include <stdint.h>
5756 #include <sys/stat.h>
5758 #define STREQ(s1, s2) (strcmp ((s1), (s2)) == 0)
5760 /* declarations of non-ANSI functions */
5761 #if defined __MINGW32__
5762 # ifdef __STRICT_ANSI__
5763 int _putenv (const char *);
5765 #elif defined __CYGWIN__
5766 # ifdef __STRICT_ANSI__
5767 char *realpath (const char *, char *);
5768 int putenv (char *);
5769 int setenv (const char *, const char *, int);
5771 /* #elif defined other_platform || defined ... */
5774 /* portability defines, excluding path handling macros */
5775 #if defined _MSC_VER
5776 # define setmode _setmode
5778 # define chmod _chmod
5779 # define getcwd _getcwd
5780 # define putenv _putenv
5781 # define S_IXUSR _S_IEXEC
5782 #elif defined __MINGW32__
5783 # define setmode _setmode
5785 # define chmod _chmod
5786 # define getcwd _getcwd
5787 # define putenv _putenv
5788 #elif defined __CYGWIN__
5789 # define HAVE_SETENV
5790 # define FOPEN_WB "wb"
5791 /* #elif defined other platforms ... */
5794 #if defined PATH_MAX
5795 # define LT_PATHMAX PATH_MAX
5796 #elif defined MAXPATHLEN
5797 # define LT_PATHMAX MAXPATHLEN
5799 # define LT_PATHMAX 1024
5809 /* path handling portability macros */
5810 #ifndef DIR_SEPARATOR
5811 # define DIR_SEPARATOR '/'
5812 # define PATH_SEPARATOR ':'
5815 #if defined _WIN32 || defined __MSDOS__ || defined __DJGPP__ || \
5817 # define HAVE_DOS_BASED_FILE_SYSTEM
5818 # define FOPEN_WB "wb"
5819 # ifndef DIR_SEPARATOR_2
5820 # define DIR_SEPARATOR_2 '\\'
5822 # ifndef PATH_SEPARATOR_2
5823 # define PATH_SEPARATOR_2 ';'
5827 #ifndef DIR_SEPARATOR_2
5828 # define IS_DIR_SEPARATOR(ch) ((ch) == DIR_SEPARATOR)
5829 #else /* DIR_SEPARATOR_2 */
5830 # define IS_DIR_SEPARATOR(ch) \
5831 (((ch) == DIR_SEPARATOR) || ((ch) == DIR_SEPARATOR_2))
5832 #endif /* DIR_SEPARATOR_2 */
5834 #ifndef PATH_SEPARATOR_2
5835 # define IS_PATH_SEPARATOR(ch) ((ch) == PATH_SEPARATOR)
5836 #else /* PATH_SEPARATOR_2 */
5837 # define IS_PATH_SEPARATOR(ch) ((ch) == PATH_SEPARATOR_2)
5838 #endif /* PATH_SEPARATOR_2 */
5841 # define FOPEN_WB "w"
5844 # define _O_BINARY 0
5847 #define XMALLOC(type, num) ((type *) xmalloc ((num) * sizeof(type)))
5848 #define XFREE(stale) do { \
5849 if (stale) { free (stale); stale = 0; } \
5852 #if defined LT_DEBUGWRAPPER
5853 static int lt_debug = 1;
5855 static int lt_debug = 0;
5858 const char *program_name = "libtool-wrapper"; /* in case xstrdup fails */
5860 void *xmalloc (size_t num);
5861 char *xstrdup (const char *string);
5862 const char *base_name (const char *name);
5863 char *find_executable (const char *wrapper);
5864 char *chase_symlinks (const char *pathspec);
5865 int make_executable (const char *path);
5866 int check_executable (const char *path);
5867 char *strendzap (char *str, const char *pat);
5868 void lt_debugprintf (const char *file, int line, const char *fmt, ...);
5869 void lt_fatal (const char *file, int line, const char *message, ...);
5870 static const char *nonnull (const char *s);
5871 static const char *nonempty (const char *s);
5872 void lt_setenv (const char *name, const char *value);
5873 char *lt_extend_str (const char *orig_value, const char *add, int to_end);
5874 void lt_update_exe_path (const char *name, const char *value);
5875 void lt_update_lib_path (const char *name, const char *value);
5876 char **prepare_spawn (char **argv);
5877 void lt_dump_script (FILE *f);
5881 #if __GNUC__ < 4 || (__GNUC__ == 4 && __GNUC_MINOR__ < 5)
5882 # define externally_visible volatile
5884 # define externally_visible __attribute__((externally_visible)) volatile
5886 externally_visible const char * MAGIC_EXE = "$magic_exe";
5887 const char * LIB_PATH_VARNAME = "$shlibpath_var";
5890 if test yes = "$shlibpath_overrides_runpath" && test -n "$shlibpath_var" && test -n "$temp_rpath"; then
5891 func_to_host_path "$temp_rpath"
5893 const char * LIB_PATH_VALUE = "$func_to_host_path_result";
5897 const char * LIB_PATH_VALUE = "";
5901 if test -n "$dllsearchpath"; then
5902 func_to_host_path "$dllsearchpath:"
5904 const char * EXE_PATH_VARNAME = "PATH";
5905 const char * EXE_PATH_VALUE = "$func_to_host_path_result";
5909 const char * EXE_PATH_VARNAME = "";
5910 const char * EXE_PATH_VALUE = "";
5914 if test yes = "$fast_install"; then
5916 const char * TARGET_PROGRAM_NAME = "lt-$outputname"; /* hopefully, no .exe */
5920 const char * TARGET_PROGRAM_NAME = "$outputname"; /* hopefully, no .exe */
5927 #define LTWRAPPER_OPTION_PREFIX "--lt-"
5929 static const char *ltwrapper_option_prefix = LTWRAPPER_OPTION_PREFIX;
5930 static const char *dumpscript_opt = LTWRAPPER_OPTION_PREFIX "dump-script";
5931 static const char *debug_opt = LTWRAPPER_OPTION_PREFIX "debug";
5934 main (int argc, char *argv[])
5939 char *actual_cwrapper_path;
5940 char *actual_cwrapper_name;
5947 program_name = (char *) xstrdup (base_name (argv[0]));
5948 newargz = XMALLOC (char *, (size_t) argc + 1);
5950 /* very simple arg parsing; don't want to rely on getopt
5951 * also, copy all non cwrapper options to newargz, except
5952 * argz[0], which is handled differently
5955 for (i = 1; i < argc; i++)
5957 if (STREQ (argv[i], dumpscript_opt))
5961 *mingw* | *cygwin* )
5962 # make stdout use "unix" line endings
5963 echo " setmode(1,_O_BINARY);"
5968 lt_dump_script (stdout);
5971 if (STREQ (argv[i], debug_opt))
5976 if (STREQ (argv[i], ltwrapper_option_prefix))
5978 /* however, if there is an option in the LTWRAPPER_OPTION_PREFIX
5979 namespace, but it is not one of the ones we know about and
5980 have already dealt with, above (inluding dump-script), then
5981 report an error. Otherwise, targets might begin to believe
5982 they are allowed to use options in the LTWRAPPER_OPTION_PREFIX
5983 namespace. The first time any user complains about this, we'll
5984 need to make LTWRAPPER_OPTION_PREFIX a configure-time option
5985 or a configure.ac-settable value.
5987 lt_fatal (__FILE__, __LINE__,
5988 "unrecognized %s option: '%s'",
5989 ltwrapper_option_prefix, argv[i]);
5992 newargz[++newargc] = xstrdup (argv[i]);
5994 newargz[++newargc] = NULL;
5998 /* The GNU banner must be the first non-error debug message */
5999 lt_debugprintf (__FILE__, __LINE__, "libtool wrapper (GNU $PACKAGE) $VERSION\n");
6002 lt_debugprintf (__FILE__, __LINE__, "(main) argv[0]: %s\n", argv[0]);
6003 lt_debugprintf (__FILE__, __LINE__, "(main) program_name: %s\n", program_name);
6005 tmp_pathspec = find_executable (argv[0]);
6006 if (tmp_pathspec == NULL)
6007 lt_fatal (__FILE__, __LINE__, "couldn't find %s", argv[0]);
6008 lt_debugprintf (__FILE__, __LINE__,
6009 "(main) found exe (before symlink chase) at: %s\n",
6012 actual_cwrapper_path = chase_symlinks (tmp_pathspec);
6013 lt_debugprintf (__FILE__, __LINE__,
6014 "(main) found exe (after symlink chase) at: %s\n",
6015 actual_cwrapper_path);
6016 XFREE (tmp_pathspec);
6018 actual_cwrapper_name = xstrdup (base_name (actual_cwrapper_path));
6019 strendzap (actual_cwrapper_path, actual_cwrapper_name);
6021 /* wrapper name transforms */
6022 strendzap (actual_cwrapper_name, ".exe");
6023 tmp_pathspec = lt_extend_str (actual_cwrapper_name, ".exe", 1);
6024 XFREE (actual_cwrapper_name);
6025 actual_cwrapper_name = tmp_pathspec;
6028 /* target_name transforms -- use actual target program name; might have lt- prefix */
6029 target_name = xstrdup (base_name (TARGET_PROGRAM_NAME));
6030 strendzap (target_name, ".exe");
6031 tmp_pathspec = lt_extend_str (target_name, ".exe", 1);
6032 XFREE (target_name);
6033 target_name = tmp_pathspec;
6036 lt_debugprintf (__FILE__, __LINE__,
6037 "(main) libtool target name: %s\n",
6043 XMALLOC (char, (strlen (actual_cwrapper_path) +
6044 strlen ("$objdir") + 1 + strlen (actual_cwrapper_name) + 1));
6045 strcpy (newargz[0], actual_cwrapper_path);
6046 strcat (newargz[0], "$objdir");
6047 strcat (newargz[0], "/");
6051 /* stop here, and copy so we don't have to do this twice */
6052 tmp_pathspec = xstrdup (newargz[0]);
6054 /* do NOT want the lt- prefix here, so use actual_cwrapper_name */
6055 strcat (newargz[0], actual_cwrapper_name);
6057 /* DO want the lt- prefix here if it exists, so use target_name */
6058 lt_argv_zero = lt_extend_str (tmp_pathspec, target_name, 1);
6059 XFREE (tmp_pathspec);
6060 tmp_pathspec = NULL;
6068 while ((p = strchr (newargz[0], '\\')) != NULL)
6072 while ((p = strchr (lt_argv_zero, '\\')) != NULL)
6082 XFREE (target_name);
6083 XFREE (actual_cwrapper_path);
6084 XFREE (actual_cwrapper_name);
6086 lt_setenv ("BIN_SH", "xpg4"); /* for Tru64 */
6087 lt_setenv ("DUALCASE", "1"); /* for MSK sh */
6088 /* Update the DLL searchpath. EXE_PATH_VALUE ($dllsearchpath) must
6089 be prepended before (that is, appear after) LIB_PATH_VALUE ($temp_rpath)
6090 because on Windows, both *_VARNAMEs are PATH but uninstalled
6091 libraries must come first. */
6092 lt_update_exe_path (EXE_PATH_VARNAME, EXE_PATH_VALUE);
6093 lt_update_lib_path (LIB_PATH_VARNAME, LIB_PATH_VALUE);
6095 lt_debugprintf (__FILE__, __LINE__, "(main) lt_argv_zero: %s\n",
6096 nonnull (lt_argv_zero));
6097 for (i = 0; i < newargc; i++)
6099 lt_debugprintf (__FILE__, __LINE__, "(main) newargz[%d]: %s\n",
6100 i, nonnull (newargz[i]));
6108 /* execv doesn't actually work on mingw as expected on unix */
6109 newargz = prepare_spawn (newargz);
6110 rval = (int) _spawnv (_P_WAIT, lt_argv_zero, (const char * const *) newargz);
6113 /* failed to start process */
6114 lt_debugprintf (__FILE__, __LINE__,
6115 "(main) failed to launch target \"%s\": %s\n",
6116 lt_argv_zero, nonnull (strerror (errno)));
6124 execv (lt_argv_zero, newargz);
6125 return rval; /* =127, but avoids unused variable warning */
6134 xmalloc (size_t num)
6136 void *p = (void *) malloc (num);
6138 lt_fatal (__FILE__, __LINE__, "memory exhausted");
6144 xstrdup (const char *string)
6146 return string ? strcpy ((char *) xmalloc (strlen (string) + 1),
6151 base_name (const char *name)
6155 #if defined HAVE_DOS_BASED_FILE_SYSTEM
6156 /* Skip over the disk name in MSDOS pathnames. */
6157 if (isalpha ((unsigned char) name[0]) && name[1] == ':')
6161 for (base = name; *name; name++)
6162 if (IS_DIR_SEPARATOR (*name))
6168 check_executable (const char *path)
6172 lt_debugprintf (__FILE__, __LINE__, "(check_executable): %s\n",
6174 if ((!path) || (!*path))
6177 if ((stat (path, &st) >= 0)
6178 && (st.st_mode & (S_IXUSR | S_IXGRP | S_IXOTH)))
6185 make_executable (const char *path)
6190 lt_debugprintf (__FILE__, __LINE__, "(make_executable): %s\n",
6192 if ((!path) || (!*path))
6195 if (stat (path, &st) >= 0)
6197 rval = chmod (path, st.st_mode | S_IXOTH | S_IXGRP | S_IXUSR);
6202 /* Searches for the full path of the wrapper. Returns
6203 newly allocated full path name if found, NULL otherwise
6204 Does not chase symlinks, even on platforms that support them.
6207 find_executable (const char *wrapper)
6212 /* static buffer for getcwd */
6213 char tmp[LT_PATHMAX + 1];
6217 lt_debugprintf (__FILE__, __LINE__, "(find_executable): %s\n",
6218 nonempty (wrapper));
6220 if ((wrapper == NULL) || (*wrapper == '\0'))
6223 /* Absolute path? */
6224 #if defined HAVE_DOS_BASED_FILE_SYSTEM
6225 if (isalpha ((unsigned char) wrapper[0]) && wrapper[1] == ':')
6227 concat_name = xstrdup (wrapper);
6228 if (check_executable (concat_name))
6230 XFREE (concat_name);
6235 if (IS_DIR_SEPARATOR (wrapper[0]))
6237 concat_name = xstrdup (wrapper);
6238 if (check_executable (concat_name))
6240 XFREE (concat_name);
6242 #if defined HAVE_DOS_BASED_FILE_SYSTEM
6246 for (p = wrapper; *p; p++)
6254 /* no slashes; search PATH */
6255 const char *path = getenv ("PATH");
6258 for (p = path; *p; p = p_next)
6262 for (q = p; *q; q++)
6263 if (IS_PATH_SEPARATOR (*q))
6265 p_len = (size_t) (q - p);
6266 p_next = (*q == '\0' ? q : q + 1);
6269 /* empty path: current directory */
6270 if (getcwd (tmp, LT_PATHMAX) == NULL)
6271 lt_fatal (__FILE__, __LINE__, "getcwd failed: %s",
6272 nonnull (strerror (errno)));
6273 tmp_len = strlen (tmp);
6275 XMALLOC (char, tmp_len + 1 + strlen (wrapper) + 1);
6276 memcpy (concat_name, tmp, tmp_len);
6277 concat_name[tmp_len] = '/';
6278 strcpy (concat_name + tmp_len + 1, wrapper);
6283 XMALLOC (char, p_len + 1 + strlen (wrapper) + 1);
6284 memcpy (concat_name, p, p_len);
6285 concat_name[p_len] = '/';
6286 strcpy (concat_name + p_len + 1, wrapper);
6288 if (check_executable (concat_name))
6290 XFREE (concat_name);
6293 /* not found in PATH; assume curdir */
6295 /* Relative path | not found in path: prepend cwd */
6296 if (getcwd (tmp, LT_PATHMAX) == NULL)
6297 lt_fatal (__FILE__, __LINE__, "getcwd failed: %s",
6298 nonnull (strerror (errno)));
6299 tmp_len = strlen (tmp);
6300 concat_name = XMALLOC (char, tmp_len + 1 + strlen (wrapper) + 1);
6301 memcpy (concat_name, tmp, tmp_len);
6302 concat_name[tmp_len] = '/';
6303 strcpy (concat_name + tmp_len + 1, wrapper);
6305 if (check_executable (concat_name))
6307 XFREE (concat_name);
6312 chase_symlinks (const char *pathspec)
6315 return xstrdup (pathspec);
6317 char buf[LT_PATHMAX];
6319 char *tmp_pathspec = xstrdup (pathspec);
6321 int has_symlinks = 0;
6322 while (strlen (tmp_pathspec) && !has_symlinks)
6324 lt_debugprintf (__FILE__, __LINE__,
6325 "checking path component for symlinks: %s\n",
6327 if (lstat (tmp_pathspec, &s) == 0)
6329 if (S_ISLNK (s.st_mode) != 0)
6335 /* search backwards for last DIR_SEPARATOR */
6336 p = tmp_pathspec + strlen (tmp_pathspec) - 1;
6337 while ((p > tmp_pathspec) && (!IS_DIR_SEPARATOR (*p)))
6339 if ((p == tmp_pathspec) && (!IS_DIR_SEPARATOR (*p)))
6341 /* no more DIR_SEPARATORS left */
6348 lt_fatal (__FILE__, __LINE__,
6349 "error accessing file \"%s\": %s",
6350 tmp_pathspec, nonnull (strerror (errno)));
6353 XFREE (tmp_pathspec);
6357 return xstrdup (pathspec);
6360 tmp_pathspec = realpath (pathspec, buf);
6361 if (tmp_pathspec == 0)
6363 lt_fatal (__FILE__, __LINE__,
6364 "could not follow symlinks for %s", pathspec);
6366 return xstrdup (tmp_pathspec);
6371 strendzap (char *str, const char *pat)
6375 assert (str != NULL);
6376 assert (pat != NULL);
6379 patlen = strlen (pat);
6383 str += len - patlen;
6384 if (STREQ (str, pat))
6391 lt_debugprintf (const char *file, int line, const char *fmt, ...)
6396 (void) fprintf (stderr, "%s:%s:%d: ", program_name, file, line);
6397 va_start (args, fmt);
6398 (void) vfprintf (stderr, fmt, args);
6404 lt_error_core (int exit_status, const char *file,
6405 int line, const char *mode,
6406 const char *message, va_list ap)
6408 fprintf (stderr, "%s:%s:%d: %s: ", program_name, file, line, mode);
6409 vfprintf (stderr, message, ap);
6410 fprintf (stderr, ".\n");
6412 if (exit_status >= 0)
6417 lt_fatal (const char *file, int line, const char *message, ...)
6420 va_start (ap, message);
6421 lt_error_core (EXIT_FAILURE, file, line, "FATAL", message, ap);
6426 nonnull (const char *s)
6428 return s ? s : "(null)";
6432 nonempty (const char *s)
6434 return (s && !*s) ? "(empty)" : nonnull (s);
6438 lt_setenv (const char *name, const char *value)
6440 lt_debugprintf (__FILE__, __LINE__,
6441 "(lt_setenv) setting '%s' to '%s'\n",
6442 nonnull (name), nonnull (value));
6445 /* always make a copy, for consistency with !HAVE_SETENV */
6446 char *str = xstrdup (value);
6447 setenv (name, str, 1);
6449 size_t len = strlen (name) + 1 + strlen (value) + 1;
6450 char *str = XMALLOC (char, len);
6451 sprintf (str, "%s=%s", name, value);
6452 if (putenv (str) != EXIT_SUCCESS)
6461 lt_extend_str (const char *orig_value, const char *add, int to_end)
6464 if (orig_value && *orig_value)
6466 size_t orig_value_len = strlen (orig_value);
6467 size_t add_len = strlen (add);
6468 new_value = XMALLOC (char, add_len + orig_value_len + 1);
6471 strcpy (new_value, orig_value);
6472 strcpy (new_value + orig_value_len, add);
6476 strcpy (new_value, add);
6477 strcpy (new_value + add_len, orig_value);
6482 new_value = xstrdup (add);
6488 lt_update_exe_path (const char *name, const char *value)
6490 lt_debugprintf (__FILE__, __LINE__,
6491 "(lt_update_exe_path) modifying '%s' by prepending '%s'\n",
6492 nonnull (name), nonnull (value));
6494 if (name && *name && value && *value)
6496 char *new_value = lt_extend_str (getenv (name), value, 0);
6497 /* some systems can't cope with a ':'-terminated path #' */
6498 size_t len = strlen (new_value);
6499 while ((len > 0) && IS_PATH_SEPARATOR (new_value[len-1]))
6501 new_value[--len] = '\0';
6503 lt_setenv (name, new_value);
6509 lt_update_lib_path (const char *name, const char *value)
6511 lt_debugprintf (__FILE__, __LINE__,
6512 "(lt_update_lib_path) modifying '%s' by prepending '%s'\n",
6513 nonnull (name), nonnull (value));
6515 if (name && *name && value && *value)
6517 char *new_value = lt_extend_str (getenv (name), value, 0);
6518 lt_setenv (name, new_value);
6528 /* Prepares an argument vector before calling spawn().
6529 Note that spawn() does not by itself call the command interpreter
6530 (getenv ("COMSPEC") != NULL ? getenv ("COMSPEC") :
6531 ({ OSVERSIONINFO v; v.dwOSVersionInfoSize = sizeof(OSVERSIONINFO);
6533 v.dwPlatformId == VER_PLATFORM_WIN32_NT;
6534 }) ? "cmd.exe" : "command.com").
6535 Instead it simply concatenates the arguments, separated by ' ', and calls
6536 CreateProcess(). We must quote the arguments since Win32 CreateProcess()
6537 interprets characters like ' ', '\t', '\\', '"' (but not '<' and '>') in a
6539 - Space and tab are interpreted as delimiters. They are not treated as
6540 delimiters if they are surrounded by double quotes: "...".
6541 - Unescaped double quotes are removed from the input. Their only effect is
6542 that within double quotes, space and tab are treated like normal
6544 - Backslashes not followed by double quotes are not special.
6545 - But 2*n+1 backslashes followed by a double quote become
6546 n backslashes followed by a double quote (n >= 0):
6551 #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"
6552 #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"
6554 prepare_spawn (char **argv)
6560 /* Count number of arguments. */
6561 for (argc = 0; argv[argc] != NULL; argc++)
6564 /* Allocate new argument vector. */
6565 new_argv = XMALLOC (char *, argc + 1);
6567 /* Put quoted arguments into the new argument vector. */
6568 for (i = 0; i < argc; i++)
6570 const char *string = argv[i];
6572 if (string[0] == '\0')
6573 new_argv[i] = xstrdup ("\"\"");
6574 else if (strpbrk (string, SHELL_SPECIAL_CHARS) != NULL)
6576 int quote_around = (strpbrk (string, SHELL_SPACE_CHARS) != NULL);
6578 unsigned int backslashes;
6580 char *quoted_string;
6587 for (s = string; *s != '\0'; s++)
6591 length += backslashes + 1;
6599 length += backslashes + 1;
6601 quoted_string = XMALLOC (char, length + 1);
6607 for (s = string; *s != '\0'; s++)
6613 for (j = backslashes + 1; j > 0; j--)
6625 for (j = backslashes; j > 0; j--)
6631 new_argv[i] = quoted_string;
6634 new_argv[i] = (char *) string;
6636 new_argv[argc] = NULL;
6645 void lt_dump_script (FILE* f)
6648 func_emit_wrapper yes |
6650 s/^\(.\{79\}\)\(..*\)/\1\
6655 s/\([^\n]*\).*/ fputs ("\1", f);/p
6662 # end: func_emit_cwrapperexe_src
6664 # func_win32_import_lib_p ARG
6665 # True if ARG is an import lib, as indicated by $file_magic_cmd
6666 func_win32_import_lib_p ()
6670 case `eval $file_magic_cmd \"\$1\" 2>/dev/null | $SED -e 10q` in
6676 # func_suncc_cstd_abi
6677 # !!ONLY CALL THIS FOR SUN CC AFTER $compile_command IS FULLY EXPANDED!!
6678 # Several compiler flags select an ABI that is incompatible with the
6679 # Cstd library. Avoid specifying it if any are in CXXFLAGS.
6680 func_suncc_cstd_abi ()
6684 case " $compile_command " in
6685 *" -compat=g "*|*\ -std=c++[0-9][0-9]\ *|*" -library=stdcxx4 "*|*" -library=stlport4 "*)
6686 suncc_use_cstd_abi=no
6689 suncc_use_cstd_abi=yes
6694 # func_mode_link arg...
6700 *-*-cygwin* | *-*-mingw* | *-*-pw32* | *-*-os2* | *-cegcc*)
6701 # It is impossible to link a dll without this setting, and
6702 # we shouldn't force the makefile maintainer to figure out
6703 # what system we are compiling for in order to pass an extra
6704 # flag for every libtool invocation.
6705 # allow_undefined=no
6707 # FIXME: Unfortunately, there are problems with the above when trying
6708 # to make a dll that has undefined symbols, in which case not
6709 # even a static library is built. For now, we need to specify
6710 # -no-undefined on the libtool link line when we can be certain
6711 # that all symbols are satisfied, otherwise we get a static library.
6715 if test "$link_all_deplibs" = unknown; then
6723 libtool_args=$nonopt
6724 base_compile="$nonopt $@"
6725 compile_command=$nonopt
6726 finalize_command=$nonopt
6739 lib_search_path=`pwd`
6741 new_inherited_linker_flags=
6750 export_symbols_regex=
6759 precious_files_regex=
6760 prefer_static_libs=no
6773 single_module=$wl-single_module
6774 func_infer_tag $base_compile
6776 # We need to know -static, to get the right output filenames.
6781 test yes != "$build_libtool_libs" \
6782 && func_fatal_configuration "cannot build a shared library"
6786 -all-static | -static | -static-libtool-libs)
6789 if test yes = "$build_libtool_libs" && test -z "$link_static_flag"; then
6790 func_warning "complete static linking is impossible in this configuration"
6792 if test -n "$link_static_flag"; then
6793 dlopen_self=$dlopen_self_static
6795 prefer_static_libs=yes
6798 if test -z "$pic_flag" && test -n "$link_static_flag"; then
6799 dlopen_self=$dlopen_self_static
6801 prefer_static_libs=built
6803 -static-libtool-libs)
6804 if test -z "$pic_flag" && test -n "$link_static_flag"; then
6805 dlopen_self=$dlopen_self_static
6807 prefer_static_libs=yes
6810 build_libtool_libs=no
6817 # See if our shared archives depend on static archives.
6818 test -n "$old_archive_from_new_cmds" && build_old_libs=yes
6820 # Go through the arguments, transforming them on the way.
6821 while test "$#" -gt 0; do
6824 func_quote_arg pretty,unquoted "$arg"
6825 qarg=$func_quote_arg_unquoted_result
6826 func_append libtool_args " $func_quote_arg_result"
6828 # If the previous option needs an argument, assign it.
6829 if test -n "$prev"; then
6832 func_append compile_command " @OUTPUT@"
6833 func_append finalize_command " @OUTPUT@"
6845 # Add the symbol object into the linking commands.
6846 func_append compile_command " @SYMFILE@"
6847 func_append finalize_command " @SYMFILE@"
6851 *.la | *.lo) ;; # We handle these cases below.
6853 if test no = "$dlself"; then
6861 if test dlprefiles = "$prev"; then
6863 elif test dlfiles = "$prev" && test yes != "$dlopen_self"; then
6873 if test dlfiles = "$prev"; then
6874 func_append dlfiles " $arg"
6876 func_append dlprefiles " $arg"
6886 || func_fatal_error "symbol file '$arg' does not exist"
6891 export_symbols_regex=$arg
6899 *" $qarg.ltframework "*) ;;
6900 *) func_append deplibs " $qarg.ltframework" # this is fixed later
6909 inst_prefix_dir=$arg
6914 # Clang does not use LLVM to link, so we can simply discard any
6915 # '-mllvm $arg' options when doing the link step.
6920 if test -f "$arg"; then
6923 for fil in `cat "$save_arg"`
6925 # func_append moreargs " $fil"
6927 # A libtool-controlled object.
6929 # Check to see that this really is a libtool object.
6930 if func_lalib_unsafe_p "$arg"; then
6937 if test -z "$pic_object" ||
6938 test -z "$non_pic_object" ||
6939 test none = "$pic_object" &&
6940 test none = "$non_pic_object"; then
6941 func_fatal_error "cannot find name of object for '$arg'"
6944 # Extract subdirectory from the argument.
6945 func_dirname "$arg" "/" ""
6946 xdir=$func_dirname_result
6948 if test none != "$pic_object"; then
6949 # Prepend the subdirectory the object is found in.
6950 pic_object=$xdir$pic_object
6952 if test dlfiles = "$prev"; then
6953 if test yes = "$build_libtool_libs" && test yes = "$dlopen_support"; then
6954 func_append dlfiles " $pic_object"
6958 # If libtool objects are unsupported, then we need to preload.
6963 # CHECK ME: I think I busted this. -Ossama
6964 if test dlprefiles = "$prev"; then
6965 # Preload the old-style object.
6966 func_append dlprefiles " $pic_object"
6971 func_append libobjs " $pic_object"
6976 if test none != "$non_pic_object"; then
6977 # Prepend the subdirectory the object is found in.
6978 non_pic_object=$xdir$non_pic_object
6980 # A standard non-PIC object
6981 func_append non_pic_objects " $non_pic_object"
6982 if test -z "$pic_object" || test none = "$pic_object"; then
6986 # If the PIC object exists, use it instead.
6987 # $xdir was prepended to $pic_object above.
6988 non_pic_object=$pic_object
6989 func_append non_pic_objects " $non_pic_object"
6992 # Only an error if not doing a dry-run.
6993 if $opt_dry_run; then
6994 # Extract subdirectory from the argument.
6995 func_dirname "$arg" "/" ""
6996 xdir=$func_dirname_result
6999 pic_object=$xdir$objdir/$func_lo2o_result
7000 non_pic_object=$xdir$func_lo2o_result
7001 func_append libobjs " $pic_object"
7002 func_append non_pic_objects " $non_pic_object"
7004 func_fatal_error "'$arg' is not a valid libtool object"
7009 func_fatal_error "link input file '$arg' does not exist"
7021 precious_files_regex=$arg
7031 # We need an absolute path.
7033 [\\/]* | [A-Za-z]:[\\/]*) ;;
7035 func_fatal_error "only absolute run-paths are allowed"
7038 func_normal_abspath "$arg"
7039 arg="$func_normal_abspath_result"
7040 if test rpath = "$prev"; then
7043 *) func_append rpath " $arg" ;;
7048 *) func_append xrpath " $arg" ;;
7060 func_append weak_libs " $arg"
7065 func_append linker_flags " $qarg"
7066 func_append compiler_flags " $qarg"
7068 func_append compile_command " $qarg"
7069 func_append finalize_command " $qarg"
7073 func_append compiler_flags " $qarg"
7075 func_append compile_command " $qarg"
7076 func_append finalize_command " $qarg"
7080 func_append linker_flags " $qarg"
7081 func_append compiler_flags " $wl$qarg"
7083 func_append compile_command " $wl$qarg"
7084 func_append finalize_command " $wl$qarg"
7088 eval "$prev=\"\$arg\""
7093 fi # test -n "$prev"
7099 if test -n "$link_static_flag"; then
7100 # See comment for -static flag below, for more details.
7101 func_append compile_command " $link_static_flag"
7102 func_append finalize_command " $link_static_flag"
7108 # FIXME: remove this flag sometime in the future.
7109 func_fatal_error "'-allow-undefined' must not be used because it is the default"
7137 -export-symbols | -export-symbols-regex)
7138 if test -n "$export_symbols" || test -n "$export_symbols_regex"; then
7139 func_fatal_error "more than one -exported-symbols argument is not allowed"
7141 if test X-export-symbols = "X$arg"; then
7159 # The native IRIX linker understands -LANG:*, -LIST:* and -LNO:*
7160 # so, if we see these flags be careful not to treat them like -L
7162 case $with_gcc/$host in
7163 no/*-*-irix* | /*-*-irix*)
7164 func_append compile_command " $arg"
7165 func_append finalize_command " $arg"
7172 func_stripname "-L" '' "$arg"
7173 if test -z "$func_stripname_result"; then
7174 if test "$#" -gt 0; then
7175 func_fatal_error "require no space between '-L' and '$1'"
7177 func_fatal_error "need path for '-L' option"
7180 func_resolve_sysroot "$func_stripname_result"
7181 dir=$func_resolve_sysroot_result
7182 # We need an absolute path.
7184 [\\/]* | [A-Za-z]:[\\/]*) ;;
7186 absdir=`cd "$dir" && pwd`
7187 test -z "$absdir" && \
7188 func_fatal_error "cannot determine absolute directory name of '$dir'"
7193 *" -L$dir "* | *" $arg "*)
7194 # Will only happen for absolute or sysroot arguments
7197 # Preserve sysroot, but never include relative directories
7199 [\\/]* | [A-Za-z]:[\\/]* | =*) func_append deplibs " $arg" ;;
7200 *) func_append deplibs " -L$dir" ;;
7202 func_append lib_search_path " $dir"
7206 *-*-cygwin* | *-*-mingw* | *-*-pw32* | *-*-os2* | *-cegcc*)
7207 testbindir=`$ECHO "$dir" | $SED 's*/lib$*/bin*'`
7208 case :$dllsearchpath: in
7210 ::) dllsearchpath=$dir;;
7211 *) func_append dllsearchpath ":$dir";;
7213 case :$dllsearchpath: in
7214 *":$testbindir:"*) ;;
7215 ::) dllsearchpath=$testbindir;;
7216 *) func_append dllsearchpath ":$testbindir";;
7224 if test X-lc = "X$arg" || test X-lm = "X$arg"; then
7226 *-*-cygwin* | *-*-mingw* | *-*-pw32* | *-*-beos* | *-cegcc* | *-*-haiku*)
7227 # These systems don't actually have a C or math library (as such)
7231 # These systems don't actually have a C library (as such)
7232 test X-lc = "X$arg" && continue
7234 *-*-openbsd* | *-*-freebsd* | *-*-dragonfly* | *-*-bitrig*)
7235 # Do not include libc due to us having libc/libc_r.
7236 test X-lc = "X$arg" && continue
7238 *-*-rhapsody* | *-*-darwin1.[012])
7239 # Rhapsody C and math libraries are in the System framework
7240 func_append deplibs " System.ltframework"
7243 *-*-sco3.2v5* | *-*-sco5v6*)
7244 # Causes problems with __ctype
7245 test X-lc = "X$arg" && continue
7247 *-*-sysv4.2uw2* | *-*-sysv5* | *-*-unixware* | *-*-OpenUNIX*)
7248 # Compiler inserts libc in the correct place for threads to work
7249 test X-lc = "X$arg" && continue
7252 elif test X-lc_r = "X$arg"; then
7254 *-*-openbsd* | *-*-freebsd* | *-*-dragonfly* | *-*-bitrig*)
7255 # Do not include libc_r directly, use -pthread flag.
7260 func_append deplibs " $arg"
7274 # Tru64 UNIX uses -model [arg] to determine the layout of C++
7275 # classes, name mangling, and exception handling.
7276 # Darwin uses the -arch flag to determine output architecture.
7277 -model|-arch|-isysroot|--sysroot)
7278 func_append compiler_flags " $arg"
7279 func_append compile_command " $arg"
7280 func_append finalize_command " $arg"
7285 -mt|-mthreads|-kthread|-Kthread|-pthread|-pthreads|--thread-safe \
7286 |-threads|-fopenmp|-openmp|-mp|-xopenmp|-omp|-qsmp=*)
7287 func_append compiler_flags " $arg"
7288 func_append compile_command " $arg"
7289 func_append finalize_command " $arg"
7290 case "$new_inherited_linker_flags " in
7292 * ) func_append new_inherited_linker_flags " $arg" ;;
7298 single_module=$wl-multi_module
7309 *-*-cygwin* | *-*-mingw* | *-*-pw32* | *-*-os2* | *-*-darwin* | *-cegcc*)
7310 # The PATH hackery in wrapper scripts is required on Windows
7311 # and Darwin in order for the loader to find any dlls it needs.
7312 func_warning "'-no-install' is ignored for $host"
7313 func_warning "assuming '-no-fast-install' instead"
7316 *) no_install=yes ;;
7338 -precious-files-regex)
7359 func_stripname '-R' '' "$arg"
7360 dir=$func_stripname_result
7361 # We need an absolute path.
7363 [\\/]* | [A-Za-z]:[\\/]*) ;;
7365 func_stripname '=' '' "$dir"
7366 dir=$lt_sysroot$func_stripname_result
7369 func_fatal_error "only absolute run-paths are allowed"
7374 *) func_append xrpath " $dir" ;;
7380 # The effects of -shared are defined in a previous loop.
7389 -static | -static-libtool-libs)
7390 # The effects of -static are defined in a previous loop.
7391 # We used to do the same as -all-static on platforms that
7392 # didn't have a PIC flag, but the assumption that the effects
7393 # would be equivalent was wrong. It would break on at least
7394 # Digital Unix and AIX.
7420 func_stripname '-Wc,' '' "$arg"
7421 args=$func_stripname_result
7423 save_ifs=$IFS; IFS=,
7424 for flag in $args; do
7426 func_quote_arg pretty "$flag"
7427 func_append arg " $func_quote_arg_result"
7428 func_append compiler_flags " $func_quote_arg_result"
7431 func_stripname ' ' '' "$arg"
7432 arg=$func_stripname_result
7436 func_stripname '-Wl,' '' "$arg"
7437 args=$func_stripname_result
7439 save_ifs=$IFS; IFS=,
7440 for flag in $args; do
7442 func_quote_arg pretty "$flag"
7443 func_append arg " $wl$func_quote_arg_result"
7444 func_append compiler_flags " $wl$func_quote_arg_result"
7445 func_append linker_flags " $func_quote_arg_result"
7448 func_stripname ' ' '' "$arg"
7449 arg=$func_stripname_result
7469 func_quote_arg pretty "$arg"
7470 arg=$func_quote_arg_result
7473 # Flags to be passed through unchanged, with rationale:
7474 # -64, -mips[0-9] enable 64-bit mode for the SGI compiler
7475 # -r[0-9][0-9]* specify processor for the SGI compiler
7476 # -xarch=*, -xtarget=* enable 64-bit mode for the Sun compiler
7477 # +DA*, +DD* enable 64-bit mode for the HP compiler
7478 # -q* compiler args for the IBM compiler
7479 # -m*, -t[45]*, -txscale* architecture-specific flags for GCC
7480 # -F/path path to uninstalled frameworks, gcc on darwin
7481 # -p, -pg, --coverage, -fprofile-* profiling flags for GCC
7482 # -fstack-protector* stack protector flags for GCC
7483 # @file GCC response files
7484 # -tp=* Portland pgcc target processor selection
7485 # --sysroot=* for sysroot support
7486 # -O*, -g*, -flto*, -fwhopr*, -fuse-linker-plugin GCC link-time optimization
7487 # -specs=* GCC specs files
7488 # -stdlib=* select c++ std lib with clang
7489 # -fsanitize=* Clang/GCC memory and address sanitizer
7490 # -fuse-ld=* Linker select flags for GCC
7491 -64|-mips[0-9]|-r[0-9][0-9]*|-xarch=*|-xtarget=*|+DA*|+DD*|-q*|-m*| \
7492 -t[45]*|-txscale*|-p|-pg|--coverage|-fprofile-*|-F*|@*|-tp=*|--sysroot=*| \
7493 -O*|-g*|-flto*|-fwhopr*|-fuse-linker-plugin|-fstack-protector*|-stdlib=*| \
7494 -specs=*|-fsanitize=*|-fuse-ld=*)
7495 func_quote_arg pretty "$arg"
7496 arg=$func_quote_arg_result
7497 func_append compile_command " $arg"
7498 func_append finalize_command " $arg"
7499 func_append compiler_flags " $arg"
7504 if test os2 = "`expr $host : '.*\(os2\)'`"; then
7505 # OS/2 uses -Zxxx to specify OS/2-specific options
7506 compiler_flags="$compiler_flags $arg"
7507 func_append compile_command " $arg"
7508 func_append finalize_command " $arg"
7516 # Otherwise treat like 'Some other compiler flag' below
7517 func_quote_arg pretty "$arg"
7518 arg=$func_quote_arg_result
7522 # Some other compiler flag.
7524 func_quote_arg pretty "$arg"
7525 arg=$func_quote_arg_result
7529 # A standard object.
7530 func_append objs " $arg"
7534 # A libtool-controlled object.
7536 # Check to see that this really is a libtool object.
7537 if func_lalib_unsafe_p "$arg"; then
7544 if test -z "$pic_object" ||
7545 test -z "$non_pic_object" ||
7546 test none = "$pic_object" &&
7547 test none = "$non_pic_object"; then
7548 func_fatal_error "cannot find name of object for '$arg'"
7551 # Extract subdirectory from the argument.
7552 func_dirname "$arg" "/" ""
7553 xdir=$func_dirname_result
7555 test none = "$pic_object" || {
7556 # Prepend the subdirectory the object is found in.
7557 pic_object=$xdir$pic_object
7559 if test dlfiles = "$prev"; then
7560 if test yes = "$build_libtool_libs" && test yes = "$dlopen_support"; then
7561 func_append dlfiles " $pic_object"
7565 # If libtool objects are unsupported, then we need to preload.
7570 # CHECK ME: I think I busted this. -Ossama
7571 if test dlprefiles = "$prev"; then
7572 # Preload the old-style object.
7573 func_append dlprefiles " $pic_object"
7578 func_append libobjs " $pic_object"
7583 if test none != "$non_pic_object"; then
7584 # Prepend the subdirectory the object is found in.
7585 non_pic_object=$xdir$non_pic_object
7587 # A standard non-PIC object
7588 func_append non_pic_objects " $non_pic_object"
7589 if test -z "$pic_object" || test none = "$pic_object"; then
7593 # If the PIC object exists, use it instead.
7594 # $xdir was prepended to $pic_object above.
7595 non_pic_object=$pic_object
7596 func_append non_pic_objects " $non_pic_object"
7599 # Only an error if not doing a dry-run.
7600 if $opt_dry_run; then
7601 # Extract subdirectory from the argument.
7602 func_dirname "$arg" "/" ""
7603 xdir=$func_dirname_result
7606 pic_object=$xdir$objdir/$func_lo2o_result
7607 non_pic_object=$xdir$func_lo2o_result
7608 func_append libobjs " $pic_object"
7609 func_append non_pic_objects " $non_pic_object"
7611 func_fatal_error "'$arg' is not a valid libtool object"
7618 func_append deplibs " $arg"
7619 func_append old_deplibs " $arg"
7624 # A libtool-controlled library.
7626 func_resolve_sysroot "$arg"
7627 if test dlfiles = "$prev"; then
7628 # This library was specified with -dlopen.
7629 func_append dlfiles " $func_resolve_sysroot_result"
7631 elif test dlprefiles = "$prev"; then
7632 # The library was specified with -dlpreopen.
7633 func_append dlprefiles " $func_resolve_sysroot_result"
7636 func_append deplibs " $func_resolve_sysroot_result"
7641 # Some other compiler argument.
7643 # Unknown arguments in both finalize_command and compile_command need
7644 # to be aesthetically quoted because they are evaled later.
7645 func_quote_arg pretty "$arg"
7646 arg=$func_quote_arg_result
7650 # Now actually substitute the argument into the commands.
7651 if test -n "$arg"; then
7652 func_append compile_command " $arg"
7653 func_append finalize_command " $arg"
7655 done # argument parsing loop
7657 test -n "$prev" && \
7658 func_fatal_help "the '$prevarg' option requires an argument"
7660 if test yes = "$export_dynamic" && test -n "$export_dynamic_flag_spec"; then
7661 eval arg=\"$export_dynamic_flag_spec\"
7662 func_append compile_command " $arg"
7663 func_append finalize_command " $arg"
7667 # calculate the name of the file, without its directory
7668 func_basename "$output"
7669 outputname=$func_basename_result
7670 libobjs_save=$libobjs
7672 if test -n "$shlibpath_var"; then
7673 # get the directories listed in $shlibpath_var
7674 eval shlib_search_path=\`\$ECHO \"\$$shlibpath_var\" \| \$SED \'s/:/ /g\'\`
7678 eval sys_lib_search_path=\"$sys_lib_search_path_spec\"
7679 eval sys_lib_dlsearch_path=\"$sys_lib_dlsearch_path_spec\"
7681 # Definition is injected by LT_CONFIG during libtool generation.
7682 func_munge_path_list sys_lib_dlsearch_path "$LT_SYS_LIBRARY_PATH"
7684 func_dirname "$output" "/" ""
7685 output_objdir=$func_dirname_result$objdir
7686 func_to_tool_file "$output_objdir/"
7687 tool_output_objdir=$func_to_tool_file_result
7688 # Create the object directory.
7689 func_mkdir_p "$output_objdir"
7691 # Determine the type of output
7694 func_fatal_help "you must specify an output file"
7696 *.$libext) linkmode=oldlib ;;
7697 *.lo | *.$objext) linkmode=obj ;;
7698 *.la) linkmode=lib ;;
7699 *) linkmode=prog ;; # Anything else should be a program.
7705 # Find all interdependent deplibs by searching for libraries
7706 # that are linked more than once (e.g. -la -lb -la)
7707 for deplib in $deplibs; do
7708 if $opt_preserve_dup_deps; then
7710 *" $deplib "*) func_append specialdeplibs " $deplib" ;;
7713 func_append libs " $deplib"
7716 if test lib = "$linkmode"; then
7717 libs="$predeps $libs $compiler_lib_search_path $postdeps"
7719 # Compute libraries that are listed more than once in $predeps
7720 # $postdeps and mark them as special (i.e., whose duplicates are
7721 # not to be eliminated).
7723 if $opt_duplicate_compiler_generated_deps; then
7724 for pre_post_dep in $predeps $postdeps; do
7725 case "$pre_post_deps " in
7726 *" $pre_post_dep "*) func_append specialdeplibs " $pre_post_deps" ;;
7728 func_append pre_post_deps " $pre_post_dep"
7737 need_relink=no # whether we're linking any uninstalled libtool libraries
7738 notinst_deplibs= # not-installed libtool libraries
7739 notinst_path= # paths that contain not-installed libtool libraries
7743 passes="conv dlpreopen link"
7744 for file in $dlfiles $dlprefiles; do
7748 func_fatal_help "libraries can '-dlopen' only libtool libraries: $file"
7759 passes="conv scan dlopen dlpreopen link"
7765 for pass in $passes; do
7766 # The preopen pass in lib mode reverses $deplibs; put it back here
7767 # so that -L comes before libs that need it for instance...
7768 if test lib,link = "$linkmode,$pass"; then
7769 ## FIXME: Find the place where the list is rebuilt in the wrong
7770 ## order, and fix it there properly
7772 for deplib in $deplibs; do
7773 tmp_deplibs="$deplib $tmp_deplibs"
7775 deplibs=$tmp_deplibs
7778 if test lib,link = "$linkmode,$pass" ||
7779 test prog,scan = "$linkmode,$pass"; then
7783 if test prog = "$linkmode"; then
7785 dlopen) libs=$dlfiles ;;
7786 dlpreopen) libs=$dlprefiles ;;
7788 libs="$deplibs %DEPLIBS%"
7789 test "X$link_all_deplibs" = Xno ||
7790 func_append libs " $dependency_libs"
7794 if test lib,dlpreopen = "$linkmode,$pass"; then
7795 # Collect and forward deplibs of preopened libtool libs
7796 for lib in $dlprefiles; do
7797 # Ignore non-libtool-libs
7799 func_resolve_sysroot "$lib"
7801 *.la) func_source "$func_resolve_sysroot_result" ;;
7804 # Collect preopened libtool deplibs, except any this library
7805 # has declared as weak libs
7806 for deplib in $dependency_libs; do
7807 func_basename "$deplib"
7808 deplib_base=$func_basename_result
7809 case " $weak_libs " in
7810 *" $deplib_base "*) ;;
7811 *) func_append deplibs " $deplib" ;;
7817 if test dlopen = "$pass"; then
7818 # Collect dlpreopened libraries
7819 save_deplibs=$deplibs
7823 for deplib in $libs; do
7827 -mt|-mthreads|-kthread|-Kthread|-pthread|-pthreads|--thread-safe \
7828 |-threads|-fopenmp|-openmp|-mp|-xopenmp|-omp|-qsmp=*)
7829 if test prog,link = "$linkmode,$pass"; then
7830 compile_deplibs="$deplib $compile_deplibs"
7831 finalize_deplibs="$deplib $finalize_deplibs"
7833 func_append compiler_flags " $deplib"
7834 if test lib = "$linkmode"; then
7835 case "$new_inherited_linker_flags " in
7837 * ) func_append new_inherited_linker_flags " $deplib" ;;
7844 if test lib != "$linkmode" && test prog != "$linkmode"; then
7845 func_warning "'-l' is ignored for archives/objects"
7848 func_stripname '-l' '' "$deplib"
7849 name=$func_stripname_result
7850 if test lib = "$linkmode"; then
7851 searchdirs="$newlib_search_path $lib_search_path $compiler_lib_search_dirs $sys_lib_search_path $shlib_search_path"
7853 searchdirs="$newlib_search_path $lib_search_path $sys_lib_search_path $shlib_search_path"
7855 for searchdir in $searchdirs; do
7856 for search_ext in .la $std_shrext .so .a; do
7857 # Search the libtool library
7858 lib=$searchdir/lib$name$search_ext
7859 if test -f "$lib"; then
7860 if test .la = "$search_ext"; then
7870 # deplib is a libtool library
7871 # If $allow_libtool_libs_with_static_runtimes && $deplib is a stdlib,
7872 # We need to do some special things here, and not later.
7873 if test yes = "$allow_libtool_libs_with_static_runtimes"; then
7874 case " $predeps $postdeps " in
7876 if func_lalib_p "$lib"; then
7880 for l in $old_library $library_names; do
7883 if test "X$ll" = "X$old_library"; then # only static version available
7885 func_dirname "$lib" "" "."
7886 ladir=$func_dirname_result
7887 lib=$ladir/$old_library
7888 if test prog,link = "$linkmode,$pass"; then
7889 compile_deplibs="$deplib $compile_deplibs"
7890 finalize_deplibs="$deplib $finalize_deplibs"
7892 deplibs="$deplib $deplibs"
7893 test lib = "$linkmode" && newdependency_libs="$deplib $newdependency_libs"
7903 # deplib doesn't seem to be a libtool library
7904 if test prog,link = "$linkmode,$pass"; then
7905 compile_deplibs="$deplib $compile_deplibs"
7906 finalize_deplibs="$deplib $finalize_deplibs"
7908 deplibs="$deplib $deplibs"
7909 test lib = "$linkmode" && newdependency_libs="$deplib $newdependency_libs"
7915 if test prog,link = "$linkmode,$pass"; then
7916 compile_deplibs="$deplib $compile_deplibs"
7917 finalize_deplibs="$deplib $finalize_deplibs"
7919 deplibs="$deplib $deplibs"
7920 if test lib = "$linkmode"; then
7921 case "$new_inherited_linker_flags " in
7923 * ) func_append new_inherited_linker_flags " $deplib" ;;
7932 deplibs="$deplib $deplibs"
7933 test conv = "$pass" && continue
7934 newdependency_libs="$deplib $newdependency_libs"
7935 func_stripname '-L' '' "$deplib"
7936 func_resolve_sysroot "$func_stripname_result"
7937 func_append newlib_search_path " $func_resolve_sysroot_result"
7940 if test conv = "$pass"; then
7941 deplibs="$deplib $deplibs"
7944 if test scan = "$pass"; then
7945 deplibs="$deplib $deplibs"
7947 compile_deplibs="$deplib $compile_deplibs"
7948 finalize_deplibs="$deplib $finalize_deplibs"
7950 func_stripname '-L' '' "$deplib"
7951 func_resolve_sysroot "$func_stripname_result"
7952 func_append newlib_search_path " $func_resolve_sysroot_result"
7955 func_warning "'-L' is ignored for archives/objects"
7961 if test link = "$pass"; then
7962 func_stripname '-R' '' "$deplib"
7963 func_resolve_sysroot "$func_stripname_result"
7964 dir=$func_resolve_sysroot_result
7965 # Make sure the xrpath contains only unique directories.
7968 *) func_append xrpath " $dir" ;;
7971 deplibs="$deplib $deplibs"
7975 func_resolve_sysroot "$deplib"
7976 lib=$func_resolve_sysroot_result
7979 if test conv = "$pass"; then
7980 deplibs="$deplib $deplibs"
7985 # Linking convenience modules into shared libraries is allowed,
7986 # but linking other static libraries is non-portable.
7987 case " $dlpreconveniencelibs " in
7991 case $deplibs_check_method in
7993 set dummy $deplibs_check_method; shift
7994 match_pattern_regex=`expr "$deplibs_check_method" : "$1 \(.*\)"`
7995 if eval "\$ECHO \"$deplib\"" 2>/dev/null | $SED 10q \
7996 | $EGREP "$match_pattern_regex" > /dev/null; then
8004 if $valid_a_lib; then
8006 $ECHO "*** Warning: Linking the shared library $output against the"
8007 $ECHO "*** static library $deplib is not portable!"
8008 deplibs="$deplib $deplibs"
8011 $ECHO "*** Warning: Trying to link with static lib archive $deplib."
8012 echo "*** I have the capability to make that library automatically link in when"
8013 echo "*** you link to this library. But I can only do this if you have a"
8014 echo "*** shared version of the library, which you do not appear to have"
8015 echo "*** because the file extensions .$libext of this argument makes me believe"
8016 echo "*** that it is just a static archive that I should not use here."
8023 if test link != "$pass"; then
8024 deplibs="$deplib $deplibs"
8026 compile_deplibs="$deplib $compile_deplibs"
8027 finalize_deplibs="$deplib $finalize_deplibs"
8034 if test conv = "$pass"; then
8035 deplibs="$deplib $deplibs"
8036 elif test prog = "$linkmode"; then
8037 if test dlpreopen = "$pass" || test yes != "$dlopen_support" || test no = "$build_libtool_libs"; then
8038 # If there is no dlopen support or we're linking statically,
8039 # we need to preload.
8040 func_append newdlprefiles " $deplib"
8041 compile_deplibs="$deplib $compile_deplibs"
8042 finalize_deplibs="$deplib $finalize_deplibs"
8044 func_append newdlfiles " $deplib"
8055 $found || test -f "$lib" \
8056 || func_fatal_error "cannot find the library '$lib' or unhandled argument '$deplib'"
8058 # Check to see that this really is a libtool archive.
8059 func_lalib_unsafe_p "$lib" \
8060 || func_fatal_error "'$lib' is not a valid libtool archive"
8062 func_dirname "$lib" "" "."
8063 ladir=$func_dirname_result
8071 inherited_linker_flags=
8072 # If the library was installed with an old release of libtool,
8073 # it will not redefine variables installed, or shouldnotlink
8082 # Convert "-framework foo" to "foo.ltframework"
8083 if test -n "$inherited_linker_flags"; then
8084 tmp_inherited_linker_flags=`$ECHO "$inherited_linker_flags" | $SED 's/-framework \([^ $]*\)/\1.ltframework/g'`
8085 for tmp_inherited_linker_flag in $tmp_inherited_linker_flags; do
8086 case " $new_inherited_linker_flags " in
8087 *" $tmp_inherited_linker_flag "*) ;;
8088 *) func_append new_inherited_linker_flags " $tmp_inherited_linker_flag";;
8092 dependency_libs=`$ECHO " $dependency_libs" | $SED 's% \([^ $]*\).ltframework% -framework \1%g'`
8093 if test lib,link = "$linkmode,$pass" ||
8094 test prog,scan = "$linkmode,$pass" ||
8095 { test prog != "$linkmode" && test lib != "$linkmode"; }; then
8096 test -n "$dlopen" && func_append dlfiles " $dlopen"
8097 test -n "$dlpreopen" && func_append dlprefiles " $dlpreopen"
8100 if test conv = "$pass"; then
8101 # Only check for convenience libraries
8102 deplibs="$lib $deplibs"
8103 if test -z "$libdir"; then
8104 if test -z "$old_library"; then
8105 func_fatal_error "cannot find name of link library for '$lib'"
8107 # It is a libtool convenience library, so add in its objects.
8108 func_append convenience " $ladir/$objdir/$old_library"
8109 func_append old_convenience " $ladir/$objdir/$old_library"
8111 for deplib in $dependency_libs; do
8112 deplibs="$deplib $deplibs"
8113 if $opt_duplicate_deps; then
8114 case "$tmp_libs " in
8115 *" $deplib "*) func_append specialdeplibs " $deplib" ;;
8118 func_append tmp_libs " $deplib"
8120 elif test prog != "$linkmode" && test lib != "$linkmode"; then
8121 func_fatal_error "'$lib' is not a convenience library"
8127 # Get the name of the library we link against.
8129 if test -n "$old_library" &&
8130 { test yes = "$prefer_static_libs" ||
8131 test built,no = "$prefer_static_libs,$installed"; }; then
8132 linklib=$old_library
8134 for l in $old_library $library_names; do
8138 if test -z "$linklib"; then
8139 func_fatal_error "cannot find name of link library for '$lib'"
8142 # This library was specified with -dlopen.
8143 if test dlopen = "$pass"; then
8145 && func_fatal_error "cannot -dlopen a convenience library: '$lib'"
8146 if test -z "$dlname" ||
8147 test yes != "$dlopen_support" ||
8148 test no = "$build_libtool_libs"
8150 # If there is no dlname, no dlopen support or we're linking
8151 # statically, we need to preload. We also need to preload any
8152 # dependent libraries so libltdl's deplib preloader doesn't
8153 # bomb out in the load deplibs phase.
8154 func_append dlprefiles " $lib $dependency_libs"
8156 func_append newdlfiles " $lib"
8161 # We need an absolute path.
8163 [\\/]* | [A-Za-z]:[\\/]*) abs_ladir=$ladir ;;
8165 abs_ladir=`cd "$ladir" && pwd`
8166 if test -z "$abs_ladir"; then
8167 func_warning "cannot determine absolute directory name of '$ladir'"
8168 func_warning "passing it literally to the linker, although it might fail"
8173 func_basename "$lib"
8174 laname=$func_basename_result
8176 # Find the relevant object directory and library name.
8177 if test yes = "$installed"; then
8178 if test ! -f "$lt_sysroot$libdir/$linklib" && test -f "$abs_ladir/$linklib"; then
8179 func_warning "library '$lib' was moved."
8184 dir=$lt_sysroot$libdir
8185 absdir=$lt_sysroot$libdir
8187 test yes = "$hardcode_automatic" && avoidtemprpath=yes
8189 if test ! -f "$ladir/$objdir/$linklib" && test -f "$abs_ladir/$linklib"; then
8192 # Remove this search path later
8193 func_append notinst_path " $abs_ladir"
8196 absdir=$abs_ladir/$objdir
8197 # Remove this search path later
8198 func_append notinst_path " $abs_ladir"
8200 fi # $installed = yes
8201 func_stripname 'lib' '.la' "$laname"
8202 name=$func_stripname_result
8204 # This library was specified with -dlpreopen.
8205 if test dlpreopen = "$pass"; then
8206 if test -z "$libdir" && test prog = "$linkmode"; then
8207 func_fatal_error "only libraries may -dlpreopen a convenience library: '$lib'"
8210 # special handling for platforms with PE-DLLs.
8211 *cygwin* | *mingw* | *cegcc* )
8212 # Linker will automatically link against shared library if both
8213 # static and shared are present. Therefore, ensure we extract
8214 # symbols from the import library if a shared library is present
8215 # (otherwise, the dlopen module name will be incorrect). We do
8216 # this by putting the import library name into $newdlprefiles.
8217 # We recover the dlopen module name by 'saving' the la file
8218 # name in a special purpose variable, and (later) extracting the
8219 # dlname from the la file.
8220 if test -n "$dlname"; then
8221 func_tr_sh "$dir/$linklib"
8222 eval "libfile_$func_tr_sh_result=\$abs_ladir/\$laname"
8223 func_append newdlprefiles " $dir/$linklib"
8225 func_append newdlprefiles " $dir/$old_library"
8226 # Keep a list of preopened convenience libraries to check
8227 # that they are being used correctly in the link pass.
8228 test -z "$libdir" && \
8229 func_append dlpreconveniencelibs " $dir/$old_library"
8233 # Prefer using a static library (so that no silly _DYNAMIC symbols
8234 # are required to link).
8235 if test -n "$old_library"; then
8236 func_append newdlprefiles " $dir/$old_library"
8237 # Keep a list of preopened convenience libraries to check
8238 # that they are being used correctly in the link pass.
8239 test -z "$libdir" && \
8240 func_append dlpreconveniencelibs " $dir/$old_library"
8241 # Otherwise, use the dlname, so that lt_dlopen finds it.
8242 elif test -n "$dlname"; then
8243 func_append newdlprefiles " $dir/$dlname"
8245 func_append newdlprefiles " $dir/$linklib"
8249 fi # $pass = dlpreopen
8251 if test -z "$libdir"; then
8252 # Link the convenience library
8253 if test lib = "$linkmode"; then
8254 deplibs="$dir/$old_library $deplibs"
8255 elif test prog,link = "$linkmode,$pass"; then
8256 compile_deplibs="$dir/$old_library $compile_deplibs"
8257 finalize_deplibs="$dir/$old_library $finalize_deplibs"
8259 deplibs="$lib $deplibs" # used for prog,scan pass
8265 if test prog = "$linkmode" && test link != "$pass"; then
8266 func_append newlib_search_path " $ladir"
8267 deplibs="$lib $deplibs"
8269 linkalldeplibs=false
8270 if test no != "$link_all_deplibs" || test -z "$library_names" ||
8271 test no = "$build_libtool_libs"; then
8276 for deplib in $dependency_libs; do
8278 -L*) func_stripname '-L' '' "$deplib"
8279 func_resolve_sysroot "$func_stripname_result"
8280 func_append newlib_search_path " $func_resolve_sysroot_result"
8283 # Need to link against all dependency_libs?
8284 if $linkalldeplibs; then
8285 deplibs="$deplib $deplibs"
8287 # Need to hardcode shared library paths
8288 # or/and link against static libraries
8289 newdependency_libs="$deplib $newdependency_libs"
8291 if $opt_preserve_dup_deps; then
8292 case "$tmp_libs " in
8293 *" $deplib "*) func_append specialdeplibs " $deplib" ;;
8296 func_append tmp_libs " $deplib"
8299 fi # $linkmode = prog...
8301 if test prog,link = "$linkmode,$pass"; then
8302 if test -n "$library_names" &&
8303 { { test no = "$prefer_static_libs" ||
8304 test built,yes = "$prefer_static_libs,$installed"; } ||
8305 test -z "$old_library"; }; then
8306 # We need to hardcode the library path
8307 if test -n "$shlibpath_var" && test -z "$avoidtemprpath"; then
8308 # Make sure the rpath contains only unique directories.
8309 case $temp_rpath: in
8311 *) func_append temp_rpath "$absdir:" ;;
8315 # Hardcode the library path.
8316 # Skip directories that are in the system default run-time
8318 case " $sys_lib_dlsearch_path " in
8321 case "$compile_rpath " in
8323 *) func_append compile_rpath " $absdir" ;;
8327 case " $sys_lib_dlsearch_path " in
8330 case "$finalize_rpath " in
8332 *) func_append finalize_rpath " $libdir" ;;
8336 fi # $linkmode,$pass = prog,link...
8339 { test pass_all = "$deplibs_check_method" ||
8340 { test yes = "$build_libtool_libs" &&
8341 test -n "$library_names"; }; }; then
8342 # We only need to search for static libraries
8347 link_static=no # Whether the deplib will be linked statically
8348 use_static_libs=$prefer_static_libs
8349 if test built = "$use_static_libs" && test yes = "$installed"; then
8352 if test -n "$library_names" &&
8353 { test no = "$use_static_libs" || test -z "$old_library"; }; then
8355 *cygwin* | *mingw* | *cegcc* | *os2*)
8356 # No point in relinking DLLs because paths are not encoded
8357 func_append notinst_deplibs " $lib"
8361 if test no = "$installed"; then
8362 func_append notinst_deplibs " $lib"
8367 # This is a shared library
8369 # Warn about portability, can't link against -module's on some
8370 # systems (darwin). Don't bleat about dlopened modules though!
8372 for dlpremoduletest in $dlprefiles; do
8373 if test "X$dlpremoduletest" = "X$lib"; then
8374 dlopenmodule=$dlpremoduletest
8378 if test -z "$dlopenmodule" && test yes = "$shouldnotlink" && test link = "$pass"; then
8380 if test prog = "$linkmode"; then
8381 $ECHO "*** Warning: Linking the executable $output against the loadable module"
8383 $ECHO "*** Warning: Linking the shared library $output against the loadable module"
8385 $ECHO "*** $linklib is not portable!"
8387 if test lib = "$linkmode" &&
8388 test yes = "$hardcode_into_libs"; then
8389 # Hardcode the library path.
8390 # Skip directories that are in the system default run-time
8392 case " $sys_lib_dlsearch_path " in
8395 case "$compile_rpath " in
8397 *) func_append compile_rpath " $absdir" ;;
8401 case " $sys_lib_dlsearch_path " in
8404 case "$finalize_rpath " in
8406 *) func_append finalize_rpath " $libdir" ;;
8412 if test -n "$old_archive_from_expsyms_cmds"; then
8413 # figure out the soname
8414 set dummy $library_names
8418 libname=`eval "\\$ECHO \"$libname_spec\""`
8419 # use dlname if we got it. it's perfectly good, no?
8420 if test -n "$dlname"; then
8422 elif test -n "$soname_spec"; then
8425 *cygwin* | mingw* | *cegcc* | *os2*)
8426 func_arith $current - $age
8427 major=$func_arith_result
8431 eval soname=\"$soname_spec\"
8436 # Make a new name for the extract_expsyms_cmds to use
8438 func_basename "$soroot"
8439 soname=$func_basename_result
8440 func_stripname 'lib' '.dll' "$soname"
8441 newlib=libimp-$func_stripname_result.a
8443 # If the library has no export list, then create one now
8444 if test -f "$output_objdir/$soname-def"; then :
8446 func_verbose "extracting exported symbol list from '$soname'"
8447 func_execute_cmds "$extract_expsyms_cmds" 'exit $?'
8451 if test -f "$output_objdir/$newlib"; then :; else
8452 func_verbose "generating import library for '$soname'"
8453 func_execute_cmds "$old_archive_from_expsyms_cmds" 'exit $?'
8455 # make sure the library variables are pointing to the new library
8458 fi # test -n "$old_archive_from_expsyms_cmds"
8460 if test prog = "$linkmode" || test relink != "$opt_mode"; then
8465 case $hardcode_action in
8466 immediate | unsupported)
8467 if test no = "$hardcode_direct"; then
8470 *-*-sco3.2v5.0.[024]*) add_dir=-L$dir ;;
8471 *-*-sysv4*uw2*) add_dir=-L$dir ;;
8472 *-*-sysv5OpenUNIX* | *-*-sysv5UnixWare7.[01].[10]* | \
8473 *-*-unixware7*) add_dir=-L$dir ;;
8475 # if the lib is a (non-dlopened) module then we cannot
8476 # link against it, someone is ignoring the earlier warnings
8477 if /usr/bin/file -L $add 2> /dev/null |
8478 $GREP ": [^:]* bundle" >/dev/null; then
8479 if test "X$dlopenmodule" != "X$lib"; then
8480 $ECHO "*** Warning: lib $linklib is a module, not a shared library"
8481 if test -z "$old_library"; then
8483 echo "*** And there doesn't seem to be a static archive available"
8484 echo "*** The link will probably fail, sorry"
8486 add=$dir/$old_library
8488 elif test -n "$old_library"; then
8489 add=$dir/$old_library
8493 elif test no = "$hardcode_minus_L"; then
8495 *-*-sunos*) add_shlibpath=$dir ;;
8499 elif test no = "$hardcode_shlibpath_var"; then
8507 if test yes = "$hardcode_direct" &&
8508 test no = "$hardcode_direct_absolute"; then
8510 elif test yes = "$hardcode_minus_L"; then
8512 # Try looking first in the location we're being installed to.
8513 if test -n "$inst_prefix_dir"; then
8516 func_append add_dir " -L$inst_prefix_dir$libdir"
8521 elif test yes = "$hardcode_shlibpath_var"; then
8531 if test yes != "$lib_linked"; then
8532 func_fatal_configuration "unsupported hardcode properties"
8535 if test -n "$add_shlibpath"; then
8536 case :$compile_shlibpath: in
8537 *":$add_shlibpath:"*) ;;
8538 *) func_append compile_shlibpath "$add_shlibpath:" ;;
8541 if test prog = "$linkmode"; then
8542 test -n "$add_dir" && compile_deplibs="$add_dir $compile_deplibs"
8543 test -n "$add" && compile_deplibs="$add $compile_deplibs"
8545 test -n "$add_dir" && deplibs="$add_dir $deplibs"
8546 test -n "$add" && deplibs="$add $deplibs"
8547 if test yes != "$hardcode_direct" &&
8548 test yes != "$hardcode_minus_L" &&
8549 test yes = "$hardcode_shlibpath_var"; then
8550 case :$finalize_shlibpath: in
8552 *) func_append finalize_shlibpath "$libdir:" ;;
8558 if test prog = "$linkmode" || test relink = "$opt_mode"; then
8562 # Finalize command for both is simple: just hardcode it.
8563 if test yes = "$hardcode_direct" &&
8564 test no = "$hardcode_direct_absolute"; then
8565 add=$libdir/$linklib
8566 elif test yes = "$hardcode_minus_L"; then
8569 elif test yes = "$hardcode_shlibpath_var"; then
8570 case :$finalize_shlibpath: in
8572 *) func_append finalize_shlibpath "$libdir:" ;;
8575 elif test yes = "$hardcode_automatic"; then
8576 if test -n "$inst_prefix_dir" &&
8577 test -f "$inst_prefix_dir$libdir/$linklib"; then
8578 add=$inst_prefix_dir$libdir/$linklib
8580 add=$libdir/$linklib
8583 # We cannot seem to hardcode it, guess we'll fake it.
8585 # Try looking first in the location we're being installed to.
8586 if test -n "$inst_prefix_dir"; then
8589 func_append add_dir " -L$inst_prefix_dir$libdir"
8596 if test prog = "$linkmode"; then
8597 test -n "$add_dir" && finalize_deplibs="$add_dir $finalize_deplibs"
8598 test -n "$add" && finalize_deplibs="$add $finalize_deplibs"
8600 test -n "$add_dir" && deplibs="$add_dir $deplibs"
8601 test -n "$add" && deplibs="$add $deplibs"
8604 elif test prog = "$linkmode"; then
8605 # Here we assume that one of hardcode_direct or hardcode_minus_L
8606 # is not unsupported. This is valid on all known static and
8608 if test unsupported != "$hardcode_direct"; then
8609 test -n "$old_library" && linklib=$old_library
8610 compile_deplibs="$dir/$linklib $compile_deplibs"
8611 finalize_deplibs="$dir/$linklib $finalize_deplibs"
8613 compile_deplibs="-l$name -L$dir $compile_deplibs"
8614 finalize_deplibs="-l$name -L$dir $finalize_deplibs"
8616 elif test yes = "$build_libtool_libs"; then
8617 # Not a shared library
8618 if test pass_all != "$deplibs_check_method"; then
8619 # We're trying link a shared library against a static one
8620 # but the system doesn't support it.
8622 # Just print a warning and add the library to dependency_libs so
8623 # that the program can be linked against the static library.
8625 $ECHO "*** Warning: This system cannot link to static lib archive $lib."
8626 echo "*** I have the capability to make that library automatically link in when"
8627 echo "*** you link to this library. But I can only do this if you have a"
8628 echo "*** shared version of the library, which you do not appear to have."
8629 if test yes = "$module"; then
8630 echo "*** But as you try to build a module library, libtool will still create "
8631 echo "*** a static module, that should work as long as the dlopening application"
8632 echo "*** is linked with the -dlopen flag to resolve symbols at runtime."
8633 if test -z "$global_symbol_pipe"; then
8635 echo "*** However, this would only work if libtool was able to extract symbol"
8636 echo "*** lists from a program, using 'nm' or equivalent, but libtool could"
8637 echo "*** not find such a program. So, this module is probably useless."
8638 echo "*** 'nm' from GNU binutils and a full rebuild may help."
8640 if test no = "$build_old_libs"; then
8641 build_libtool_libs=module
8644 build_libtool_libs=no
8648 deplibs="$dir/$old_library $deplibs"
8651 fi # link shared/static library?
8653 if test lib = "$linkmode"; then
8654 if test -n "$dependency_libs" &&
8655 { test yes != "$hardcode_into_libs" ||
8656 test yes = "$build_old_libs" ||
8657 test yes = "$link_static"; }; then
8658 # Extract -R from dependency_libs
8660 for libdir in $dependency_libs; do
8662 -R*) func_stripname '-R' '' "$libdir"
8663 temp_xrpath=$func_stripname_result
8665 *" $temp_xrpath "*) ;;
8666 *) func_append xrpath " $temp_xrpath";;
8668 *) func_append temp_deplibs " $libdir";;
8671 dependency_libs=$temp_deplibs
8674 func_append newlib_search_path " $absdir"
8675 # Link against this library
8676 test no = "$link_static" && newdependency_libs="$abs_ladir/$laname $newdependency_libs"
8677 # ... and its dependency_libs
8679 for deplib in $dependency_libs; do
8680 newdependency_libs="$deplib $newdependency_libs"
8682 -L*) func_stripname '-L' '' "$deplib"
8683 func_resolve_sysroot "$func_stripname_result";;
8684 *) func_resolve_sysroot "$deplib" ;;
8686 if $opt_preserve_dup_deps; then
8687 case "$tmp_libs " in
8688 *" $func_resolve_sysroot_result "*)
8689 func_append specialdeplibs " $func_resolve_sysroot_result" ;;
8692 func_append tmp_libs " $func_resolve_sysroot_result"
8695 if test no != "$link_all_deplibs"; then
8696 # Add the search paths of all dependency libraries
8697 for deplib in $dependency_libs; do
8700 -L*) path=$deplib ;;
8702 func_resolve_sysroot "$deplib"
8703 deplib=$func_resolve_sysroot_result
8704 func_dirname "$deplib" "" "."
8705 dir=$func_dirname_result
8706 # We need an absolute path.
8708 [\\/]* | [A-Za-z]:[\\/]*) absdir=$dir ;;
8710 absdir=`cd "$dir" && pwd`
8711 if test -z "$absdir"; then
8712 func_warning "cannot determine absolute directory name of '$dir'"
8717 if $GREP "^installed=no" $deplib > /dev/null; then
8721 eval deplibrary_names=`$SED -n -e 's/^library_names=\(.*\)$/\1/p' $deplib`
8722 if test -n "$deplibrary_names"; then
8723 for tmp in $deplibrary_names; do
8726 if test -f "$absdir/$objdir/$depdepl"; then
8727 depdepl=$absdir/$objdir/$depdepl
8728 darwin_install_name=`$OTOOL -L $depdepl | awk '{if (NR == 2) {print $1;exit}}'`
8729 if test -z "$darwin_install_name"; then
8730 darwin_install_name=`$OTOOL64 -L $depdepl | awk '{if (NR == 2) {print $1;exit}}'`
8732 func_append compiler_flags " $wl-dylib_file $wl$darwin_install_name:$depdepl"
8733 func_append linker_flags " -dylib_file $darwin_install_name:$depdepl"
8739 path=-L$absdir/$objdir
8743 eval libdir=`$SED -n -e 's/^libdir=\(.*\)$/\1/p' $deplib`
8744 test -z "$libdir" && \
8745 func_fatal_error "'$deplib' is not a valid libtool archive"
8746 test "$absdir" != "$libdir" && \
8747 func_warning "'$deplib' seems to be moved"
8753 case " $deplibs " in
8755 *) deplibs="$path $deplibs" ;;
8758 fi # link_all_deplibs != no
8760 done # for deplib in $libs
8761 if test link = "$pass"; then
8762 if test prog = "$linkmode"; then
8763 compile_deplibs="$new_inherited_linker_flags $compile_deplibs"
8764 finalize_deplibs="$new_inherited_linker_flags $finalize_deplibs"
8766 compiler_flags="$compiler_flags "`$ECHO " $new_inherited_linker_flags" | $SED 's% \([^ $]*\).ltframework% -framework \1%g'`
8769 dependency_libs=$newdependency_libs
8770 if test dlpreopen = "$pass"; then
8771 # Link the dlpreopened libraries before other libraries
8772 for deplib in $save_deplibs; do
8773 deplibs="$deplib $deplibs"
8776 if test dlopen != "$pass"; then
8777 test conv = "$pass" || {
8778 # Make sure lib_search_path contains only unique directories.
8780 for dir in $newlib_search_path; do
8781 case "$lib_search_path " in
8783 *) func_append lib_search_path " $dir" ;;
8789 if test prog,link = "$linkmode,$pass"; then
8790 vars="compile_deplibs finalize_deplibs"
8794 for var in $vars dependency_libs; do
8795 # Add libraries to $var in reverse order
8796 eval tmp_libs=\"\$$var\"
8798 for deplib in $tmp_libs; do
8799 # FIXME: Pedantically, this is the right thing to do, so
8800 # that some nasty dependency loop isn't accidentally
8802 #new_libs="$deplib $new_libs"
8803 # Pragmatically, this seems to cause very few problems in
8806 -L*) new_libs="$deplib $new_libs" ;;
8809 # And here is the reason: when a library appears more
8810 # than once as an explicit dependence of a library, or
8811 # is implicitly linked in more than once by the
8812 # compiler, it is considered special, and multiple
8813 # occurrences thereof are not removed. Compare this
8814 # with having the same library being listed as a
8815 # dependency of multiple other libraries: in this case,
8816 # we know (pedantically, we assume) the library does not
8817 # need to be listed more than once, so we keep only the
8818 # last copy. This is not always right, but it is rare
8819 # enough that we require users that really mean to play
8820 # such unportable linking tricks to link the library
8821 # using -Wl,-lname, so that libtool does not consider it
8822 # for duplicate removal.
8823 case " $specialdeplibs " in
8824 *" $deplib "*) new_libs="$deplib $new_libs" ;;
8826 case " $new_libs " in
8828 *) new_libs="$deplib $new_libs" ;;
8836 for deplib in $new_libs; do
8839 case " $tmp_libs " in
8841 *) func_append tmp_libs " $deplib" ;;
8844 *) func_append tmp_libs " $deplib" ;;
8847 eval $var=\"$tmp_libs\"
8851 # Add Sun CC postdeps if required:
8852 test CXX = "$tagname" && {
8855 case `$CC -V 2>&1 | sed 5q` in
8856 *Sun\ C*) # Sun C++ 5.9
8859 if test no != "$suncc_use_cstd_abi"; then
8860 func_append postdeps ' -library=Cstd -library=Crun'
8867 func_cc_basename "$CC"
8868 case $func_cc_basename_result in
8872 if test no != "$suncc_use_cstd_abi"; then
8873 func_append postdeps ' -library=Cstd -library=Crun'
8881 # Last step: remove runtime libs from dependency_libs
8882 # (they stay in deplibs)
8884 for i in $dependency_libs; do
8885 case " $predeps $postdeps $compiler_lib_search_path " in
8890 if test -n "$i"; then
8891 func_append tmp_libs " $i"
8894 dependency_libs=$tmp_libs
8896 if test prog = "$linkmode"; then
8899 if test prog = "$linkmode" || test lib = "$linkmode"; then
8900 dlprefiles=$newdlprefiles
8905 if test -n "$dlfiles$dlprefiles" || test no != "$dlself"; then
8906 func_warning "'-dlopen' is ignored for archives"
8911 func_warning "'-l' and '-L' are ignored for archives" ;;
8914 test -n "$rpath" && \
8915 func_warning "'-rpath' is ignored for archives"
8917 test -n "$xrpath" && \
8918 func_warning "'-R' is ignored for archives"
8920 test -n "$vinfo" && \
8921 func_warning "'-version-info/-version-number' is ignored for archives"
8923 test -n "$release" && \
8924 func_warning "'-release' is ignored for archives"
8926 test -n "$export_symbols$export_symbols_regex" && \
8927 func_warning "'-export-symbols' is ignored for archives"
8929 # Now set the variables for building old libraries.
8930 build_libtool_libs=no
8932 func_append objs "$old_deplibs"
8936 # Make sure we only generate libraries of the form 'libNAME.la'.
8939 func_stripname 'lib' '.la' "$outputname"
8940 name=$func_stripname_result
8941 eval shared_ext=\"$shrext_cmds\"
8942 eval libname=\"$libname_spec\"
8945 test no = "$module" \
8946 && func_fatal_help "libtool library '$output' must begin with 'lib'"
8948 if test no != "$need_lib_prefix"; then
8949 # Add the "lib" prefix for modules if required
8950 func_stripname '' '.la' "$outputname"
8951 name=$func_stripname_result
8952 eval shared_ext=\"$shrext_cmds\"
8953 eval libname=\"$libname_spec\"
8955 func_stripname '' '.la' "$outputname"
8956 libname=$func_stripname_result
8961 if test -n "$objs"; then
8962 if test pass_all != "$deplibs_check_method"; then
8963 func_fatal_error "cannot build libtool library '$output' from non-libtool objects on this host:$objs"
8966 $ECHO "*** Warning: Linking the shared library $output against the non-libtool"
8967 $ECHO "*** objects $objs is not portable!"
8968 func_append libobjs " $objs"
8972 test no = "$dlself" \
8973 || func_warning "'-dlopen self' is ignored for libtool libraries"
8978 && func_warning "ignoring multiple '-rpath's for a libtool library"
8983 if test -z "$rpath"; then
8984 if test yes = "$build_libtool_libs"; then
8985 # Building a libtool convenience library.
8986 # Some compilers have problems with a '.al' extension so
8987 # convenience libraries should have the same extension an
8988 # archive normally would.
8989 oldlibs="$output_objdir/$libname.$libext $oldlibs"
8990 build_libtool_libs=convenience
8994 test -n "$vinfo" && \
8995 func_warning "'-version-info/-version-number' is ignored for convenience libraries"
8997 test -n "$release" && \
8998 func_warning "'-release' is ignored for convenience libraries"
9001 # Parse the version information argument.
9002 save_ifs=$IFS; IFS=:
9003 set dummy $vinfo 0 0 0
9008 func_fatal_help "too many parameters to '-version-info'"
9010 # convert absolute version numbers to libtool ages
9011 # this retains compatibility with .la files and attempts
9012 # to make the code below a bit more comprehensible
9014 case $vinfo_number in
9020 # There are really only two kinds -- those that
9021 # use the current revision as the major version
9022 # and those that subtract age and use age as
9023 # a minor version. But, then there is irix
9024 # that has an extra 1 added just for fun
9026 case $version_type in
9027 # correct linux to gnu/linux during the next big refactor
9028 darwin|freebsd-elf|linux|osf|windows|none)
9029 func_arith $number_major + $number_minor
9030 current=$func_arith_result
9032 revision=$number_revision
9034 freebsd-aout|qnx|sunos)
9035 current=$number_major
9036 revision=$number_minor
9040 func_arith $number_major + $number_minor
9041 current=$func_arith_result
9043 revision=$number_minor
9044 lt_irix_increment=no
9047 func_fatal_configuration "$modename: unknown library version type \`$version_type'"
9058 # Check that each of the things are valid numbers.
9060 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]) ;;
9062 func_error "CURRENT '$current' must be a nonnegative integer"
9063 func_fatal_error "'$vinfo' is not valid version information"
9068 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]) ;;
9070 func_error "REVISION '$revision' must be a nonnegative integer"
9071 func_fatal_error "'$vinfo' is not valid version information"
9076 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]) ;;
9078 func_error "AGE '$age' must be a nonnegative integer"
9079 func_fatal_error "'$vinfo' is not valid version information"
9083 if test "$age" -gt "$current"; then
9084 func_error "AGE '$age' is greater than the current interface number '$current'"
9085 func_fatal_error "'$vinfo' is not valid version information"
9088 # Calculate the version variables.
9092 case $version_type in
9096 # Like Linux, but with the current version available in
9097 # verstring for coding it into the library header
9098 func_arith $current - $age
9099 major=.$func_arith_result
9100 versuffix=$major.$age.$revision
9101 # Darwin ld doesn't like 0 for these options...
9102 func_arith $current + 1
9103 minor_current=$func_arith_result
9104 xlcverstring="$wl-compatibility_version $wl$minor_current $wl-current_version $wl$minor_current.$revision"
9105 verstring="-compatibility_version $minor_current -current_version $minor_current.$revision"
9106 # On Darwin other compilers
9109 verstring="$wl-compatibility_version $wl$minor_current $wl-current_version $wl$minor_current.$revision"
9112 verstring="-compatibility_version $minor_current -current_version $minor_current.$revision"
9119 versuffix=.$current.$revision
9123 func_arith $current - $age
9124 major=.$func_arith_result
9125 versuffix=$major.$age.$revision
9129 if test no = "$lt_irix_increment"; then
9130 func_arith $current - $age
9132 func_arith $current - $age + 1
9134 major=$func_arith_result
9136 case $version_type in
9137 nonstopux) verstring_prefix=nonstopux ;;
9138 *) verstring_prefix=sgi ;;
9140 verstring=$verstring_prefix$major.$revision
9142 # Add in all the interfaces that we are compatible with.
9144 while test 0 -ne "$loop"; do
9145 func_arith $revision - $loop
9146 iface=$func_arith_result
9147 func_arith $loop - 1
9148 loop=$func_arith_result
9149 verstring=$verstring_prefix$major.$iface:$verstring
9152 # Before this point, $major must not contain '.'.
9154 versuffix=$major.$revision
9157 linux) # correct to gnu/linux during the next big refactor
9158 func_arith $current - $age
9159 major=.$func_arith_result
9160 versuffix=$major.$age.$revision
9164 func_arith $current - $age
9165 major=.$func_arith_result
9166 versuffix=.$current.$age.$revision
9167 verstring=$current.$age.$revision
9169 # Add in all the interfaces that we are compatible with.
9171 while test 0 -ne "$loop"; do
9172 func_arith $current - $loop
9173 iface=$func_arith_result
9174 func_arith $loop - 1
9175 loop=$func_arith_result
9176 verstring=$verstring:$iface.0
9179 # Make executables depend on our current version.
9180 func_append verstring ":$current.0"
9195 versuffix=.$current.$revision
9199 # Use '-' rather than '.', since we only want one
9200 # extension on DOS 8.3 file systems.
9201 func_arith $current - $age
9202 major=$func_arith_result
9207 func_fatal_configuration "unknown library version type '$version_type'"
9211 # Clear the version info if we defaulted, and they specified a release.
9212 if test -z "$vinfo" && test -n "$release"; then
9214 case $version_type in
9216 # we can't check for "0.0" in archive_cmds due to quoting
9217 # problems, so we reset it completely
9224 if test no = "$need_version"; then
9231 # Remove version info from name if versioning should be avoided
9232 if test yes,no = "$avoid_version,$need_version"; then
9238 # Check to see if the archive will have undefined symbols.
9239 if test yes = "$allow_undefined"; then
9240 if test unsupported = "$allow_undefined_flag"; then
9241 if test yes = "$build_old_libs"; then
9242 func_warning "undefined symbols not allowed in $host shared libraries; building static only"
9243 build_libtool_libs=no
9245 func_fatal_error "can't build $host shared library unless -no-undefined is specified"
9249 # Don't allow undefined symbols.
9250 allow_undefined_flag=$no_undefined_flag
9255 func_generate_dlsyms "$libname" "$libname" :
9256 func_append libobjs " $symfileobj"
9257 test " " = "$libobjs" && libobjs=
9259 if test relink != "$opt_mode"; then
9260 # Remove our outputs, but don't remove object files since they
9261 # may have been created when compiling PIC objects.
9263 tempremovelist=`$ECHO "$output_objdir/*"`
9264 for p in $tempremovelist; do
9268 $output_objdir/$outputname | $output_objdir/$libname.* | $output_objdir/$libname$release.*)
9269 if test -n "$precious_files_regex"; then
9270 if $ECHO "$p" | $EGREP -e "$precious_files_regex" >/dev/null 2>&1
9275 func_append removelist " $p"
9280 test -n "$removelist" && \
9281 func_show_eval "${RM}r \$removelist"
9284 # Now set the variables for building old libraries.
9285 if test yes = "$build_old_libs" && test convenience != "$build_libtool_libs"; then
9286 func_append oldlibs " $output_objdir/$libname.$libext"
9288 # Transform .lo files to .o files.
9289 oldobjs="$objs "`$ECHO "$libobjs" | $SP2NL | $SED "/\.$libext$/d; $lo2o" | $NL2SP`
9292 # Eliminate all temporary directories.
9293 #for path in $notinst_path; do
9294 # lib_search_path=`$ECHO "$lib_search_path " | $SED "s% $path % %g"`
9295 # deplibs=`$ECHO "$deplibs " | $SED "s% -L$path % %g"`
9296 # dependency_libs=`$ECHO "$dependency_libs " | $SED "s% -L$path % %g"`
9299 if test -n "$xrpath"; then
9300 # If the user specified any rpath flags, then add them.
9302 for libdir in $xrpath; do
9303 # Skip directories that are in the system default run-time search path.
9304 case " $sys_lib_dlsearch_path " in
9305 *" $libdir "*) continue ;;
9307 func_replace_sysroot "$libdir"
9308 func_append temp_xrpath " -R$func_replace_sysroot_result"
9309 case "$finalize_rpath " in
9311 *) func_append finalize_rpath " $libdir" ;;
9314 if test yes != "$hardcode_into_libs" || test yes = "$build_old_libs"; then
9315 dependency_libs="$temp_xrpath $dependency_libs"
9319 # Make sure dlfiles contains only unique files that won't be dlpreopened
9320 old_dlfiles=$dlfiles
9322 for lib in $old_dlfiles; do
9323 case " $dlprefiles $dlfiles " in
9325 *) func_append dlfiles " $lib" ;;
9329 # Make sure dlprefiles contains only unique files
9330 old_dlprefiles=$dlprefiles
9332 for lib in $old_dlprefiles; do
9333 case "$dlprefiles " in
9335 *) func_append dlprefiles " $lib" ;;
9339 if test yes = "$build_libtool_libs"; then
9340 if test -n "$rpath"; then
9342 *-*-cygwin* | *-*-mingw* | *-*-pw32* | *-*-os2* | *-*-beos* | *-cegcc* | *-*-haiku*)
9343 # these systems don't actually have a c library (as such)!
9345 *-*-rhapsody* | *-*-darwin1.[012])
9346 # Rhapsody C library is in the System framework
9347 func_append deplibs " System.ltframework"
9350 # Don't link with libc until the a.out ld.so is fixed.
9352 *-*-openbsd* | *-*-freebsd* | *-*-dragonfly*)
9353 # Do not include libc due to us having libc/libc_r.
9355 *-*-sco3.2v5* | *-*-sco5v6*)
9356 # Causes problems with __ctype
9358 *-*-sysv4.2uw2* | *-*-sysv5* | *-*-unixware* | *-*-OpenUNIX*)
9359 # Compiler inserts libc in the correct place for threads to work
9362 # Add libc to deplibs on all other systems if necessary.
9363 if test yes = "$build_libtool_need_lc"; then
9364 func_append deplibs " -lc"
9370 # Transform deplibs into only deplibs that can be linked in shared.
9372 libname_save=$libname
9373 release_save=$release
9374 versuffix_save=$versuffix
9376 # I'm not sure if I'm treating the release correctly. I think
9377 # release should show up in the -l (ie -lgmp5) so we don't want to
9378 # add it in twice. Is that correct?
9384 case $deplibs_check_method in
9386 # Don't check for shared/static. Everything works.
9387 # This might be a little naive. We might want to check
9388 # whether the library exists or not. But this is on
9389 # osf3 & osf4 and I'm not really sure... Just
9390 # implementing what was already the behavior.
9394 # This code stresses the "libraries are programs" paradigm to its
9395 # limits. Maybe even breaks it. We compile a program, linking it
9396 # against the deplibs as a proxy for the library. Then we can check
9397 # whether they linked in statically or dynamically with ldd.
9398 $opt_dry_run || $RM conftest.c
9399 cat > conftest.c <<EOF
9400 int main() { return 0; }
9402 $opt_dry_run || $RM conftest
9403 if $LTCC $LTCFLAGS -o conftest conftest.c $deplibs; then
9404 ldd_output=`ldd conftest`
9405 for i in $deplibs; do
9408 func_stripname -l '' "$i"
9409 name=$func_stripname_result
9410 if test yes = "$allow_libtool_libs_with_static_runtimes"; then
9411 case " $predeps $postdeps " in
9413 func_append newdeplibs " $i"
9418 if test -n "$i"; then
9419 libname=`eval "\\$ECHO \"$libname_spec\""`
9420 deplib_matches=`eval "\\$ECHO \"$library_names_spec\""`
9421 set dummy $deplib_matches; shift
9423 if test `expr "$ldd_output" : ".*$deplib_match"` -ne 0; then
9424 func_append newdeplibs " $i"
9428 $ECHO "*** Warning: dynamic linker does not accept needed library $i."
9429 echo "*** I have the capability to make that library automatically link in when"
9430 echo "*** you link to this library. But I can only do this if you have a"
9431 echo "*** shared version of the library, which I believe you do not have"
9432 echo "*** because a test_compile did reveal that the linker did not use it for"
9433 echo "*** its dynamic dependency list that programs get resolved with at runtime."
9438 func_append newdeplibs " $i"
9443 # Error occurred in the first compile. Let's try to salvage
9444 # the situation: Compile a separate program for each library.
9445 for i in $deplibs; do
9448 func_stripname -l '' "$i"
9449 name=$func_stripname_result
9450 $opt_dry_run || $RM conftest
9451 if $LTCC $LTCFLAGS -o conftest conftest.c $i; then
9452 ldd_output=`ldd conftest`
9453 if test yes = "$allow_libtool_libs_with_static_runtimes"; then
9454 case " $predeps $postdeps " in
9456 func_append newdeplibs " $i"
9461 if test -n "$i"; then
9462 libname=`eval "\\$ECHO \"$libname_spec\""`
9463 deplib_matches=`eval "\\$ECHO \"$library_names_spec\""`
9464 set dummy $deplib_matches; shift
9466 if test `expr "$ldd_output" : ".*$deplib_match"` -ne 0; then
9467 func_append newdeplibs " $i"
9471 $ECHO "*** Warning: dynamic linker does not accept needed library $i."
9472 echo "*** I have the capability to make that library automatically link in when"
9473 echo "*** you link to this library. But I can only do this if you have a"
9474 echo "*** shared version of the library, which you do not appear to have"
9475 echo "*** because a test_compile did reveal that the linker did not use this one"
9476 echo "*** as a dynamic dependency that programs can get resolved with at runtime."
9482 $ECHO "*** Warning! Library $i is needed by this library but I was not able to"
9483 echo "*** make it link in! You will probably need to install it or some"
9484 echo "*** library that it depends on before this library will be fully"
9485 echo "*** functional. Installing it before continuing would be even better."
9489 func_append newdeplibs " $i"
9496 set dummy $deplibs_check_method; shift
9497 file_magic_regex=`expr "$deplibs_check_method" : "$1 \(.*\)"`
9498 for a_deplib in $deplibs; do
9501 func_stripname -l '' "$a_deplib"
9502 name=$func_stripname_result
9503 if test yes = "$allow_libtool_libs_with_static_runtimes"; then
9504 case " $predeps $postdeps " in
9506 func_append newdeplibs " $a_deplib"
9511 if test -n "$a_deplib"; then
9512 libname=`eval "\\$ECHO \"$libname_spec\""`
9513 if test -n "$file_magic_glob"; then
9514 libnameglob=`func_echo_all "$libname" | $SED -e $file_magic_glob`
9516 libnameglob=$libname
9518 test yes = "$want_nocaseglob" && nocaseglob=`shopt -p nocaseglob`
9519 for i in $lib_search_path $sys_lib_search_path $shlib_search_path; do
9520 if test yes = "$want_nocaseglob"; then
9522 potential_libs=`ls $i/$libnameglob[.-]* 2>/dev/null`
9525 potential_libs=`ls $i/$libnameglob[.-]* 2>/dev/null`
9527 for potent_lib in $potential_libs; do
9528 # Follow soft links.
9529 if ls -lLd "$potent_lib" 2>/dev/null |
9530 $GREP " -> " >/dev/null; then
9533 # The statement above tries to avoid entering an
9534 # endless loop below, in case of cyclic links.
9535 # We might still enter an endless loop, since a link
9536 # loop can be closed while we follow links,
9539 while test -h "$potlib" 2>/dev/null; do
9540 potliblink=`ls -ld $potlib | $SED 's/.* -> //'`
9542 [\\/]* | [A-Za-z]:[\\/]*) potlib=$potliblink;;
9543 *) potlib=`$ECHO "$potlib" | $SED 's|[^/]*$||'`"$potliblink";;
9546 if eval $file_magic_cmd \"\$potlib\" 2>/dev/null |
9548 $EGREP "$file_magic_regex" > /dev/null; then
9549 func_append newdeplibs " $a_deplib"
9556 if test -n "$a_deplib"; then
9559 $ECHO "*** Warning: linker path does not have real file for library $a_deplib."
9560 echo "*** I have the capability to make that library automatically link in when"
9561 echo "*** you link to this library. But I can only do this if you have a"
9562 echo "*** shared version of the library, which you do not appear to have"
9563 echo "*** because I did check the linker path looking for a file starting"
9564 if test -z "$potlib"; then
9565 $ECHO "*** with $libname but no candidates were found. (...for file magic test)"
9567 $ECHO "*** with $libname and none of the candidates passed a file format test"
9568 $ECHO "*** using a file magic. Last file checked: $potlib"
9573 # Add a -L argument.
9574 func_append newdeplibs " $a_deplib"
9577 done # Gone through all deplibs.
9580 set dummy $deplibs_check_method; shift
9581 match_pattern_regex=`expr "$deplibs_check_method" : "$1 \(.*\)"`
9582 for a_deplib in $deplibs; do
9585 func_stripname -l '' "$a_deplib"
9586 name=$func_stripname_result
9587 if test yes = "$allow_libtool_libs_with_static_runtimes"; then
9588 case " $predeps $postdeps " in
9590 func_append newdeplibs " $a_deplib"
9595 if test -n "$a_deplib"; then
9596 libname=`eval "\\$ECHO \"$libname_spec\""`
9597 for i in $lib_search_path $sys_lib_search_path $shlib_search_path; do
9598 potential_libs=`ls $i/$libname[.-]* 2>/dev/null`
9599 for potent_lib in $potential_libs; do
9600 potlib=$potent_lib # see symlink-check above in file_magic test
9601 if eval "\$ECHO \"$potent_lib\"" 2>/dev/null | $SED 10q | \
9602 $EGREP "$match_pattern_regex" > /dev/null; then
9603 func_append newdeplibs " $a_deplib"
9610 if test -n "$a_deplib"; then
9613 $ECHO "*** Warning: linker path does not have real file for library $a_deplib."
9614 echo "*** I have the capability to make that library automatically link in when"
9615 echo "*** you link to this library. But I can only do this if you have a"
9616 echo "*** shared version of the library, which you do not appear to have"
9617 echo "*** because I did check the linker path looking for a file starting"
9618 if test -z "$potlib"; then
9619 $ECHO "*** with $libname but no candidates were found. (...for regex pattern test)"
9621 $ECHO "*** with $libname and none of the candidates passed a file format test"
9622 $ECHO "*** using a regex pattern. Last file checked: $potlib"
9627 # Add a -L argument.
9628 func_append newdeplibs " $a_deplib"
9631 done # Gone through all deplibs.
9635 tmp_deplibs=`$ECHO " $deplibs" | $SED 's/ -lc$//; s/ -[LR][^ ]*//g'`
9636 if test yes = "$allow_libtool_libs_with_static_runtimes"; then
9637 for i in $predeps $postdeps; do
9638 # can't use Xsed below, because $i might contain '/'
9639 tmp_deplibs=`$ECHO " $tmp_deplibs" | $SED "s|$i||"`
9642 case $tmp_deplibs in
9645 if test none = "$deplibs_check_method"; then
9646 echo "*** Warning: inter-library dependencies are not supported in this platform."
9648 echo "*** Warning: inter-library dependencies are not known to be supported."
9650 echo "*** All declared inter-library dependencies are being dropped."
9656 versuffix=$versuffix_save
9658 release=$release_save
9659 libname=$libname_save
9663 *-*-rhapsody* | *-*-darwin1.[012])
9664 # On Rhapsody replace the C library with the System framework
9665 newdeplibs=`$ECHO " $newdeplibs" | $SED 's/ -lc / System.ltframework /'`
9669 if test yes = "$droppeddeps"; then
9670 if test yes = "$module"; then
9672 echo "*** Warning: libtool could not satisfy all declared inter-library"
9673 $ECHO "*** dependencies of module $libname. Therefore, libtool will create"
9674 echo "*** a static module, that should work as long as the dlopening"
9675 echo "*** application is linked with the -dlopen flag."
9676 if test -z "$global_symbol_pipe"; then
9678 echo "*** However, this would only work if libtool was able to extract symbol"
9679 echo "*** lists from a program, using 'nm' or equivalent, but libtool could"
9680 echo "*** not find such a program. So, this module is probably useless."
9681 echo "*** 'nm' from GNU binutils and a full rebuild may help."
9683 if test no = "$build_old_libs"; then
9684 oldlibs=$output_objdir/$libname.$libext
9685 build_libtool_libs=module
9688 build_libtool_libs=no
9691 echo "*** The inter-library dependencies that have been dropped here will be"
9692 echo "*** automatically added whenever a program is linked with this library"
9693 echo "*** or is declared to -dlopen it."
9695 if test no = "$allow_undefined"; then
9697 echo "*** Since this library must not contain undefined symbols,"
9698 echo "*** because either the platform does not support them or"
9699 echo "*** it was explicitly requested with -no-undefined,"
9700 echo "*** libtool will only create a static version of it."
9701 if test no = "$build_old_libs"; then
9702 oldlibs=$output_objdir/$libname.$libext
9703 build_libtool_libs=module
9706 build_libtool_libs=no
9711 # Done checking deplibs!
9714 # Time to change all our "foo.ltframework" stuff back to "-framework foo"
9717 newdeplibs=`$ECHO " $newdeplibs" | $SED 's% \([^ $]*\).ltframework% -framework \1%g'`
9718 new_inherited_linker_flags=`$ECHO " $new_inherited_linker_flags" | $SED 's% \([^ $]*\).ltframework% -framework \1%g'`
9719 deplibs=`$ECHO " $deplibs" | $SED 's% \([^ $]*\).ltframework% -framework \1%g'`
9723 # move library search paths that coincide with paths to not yet
9724 # installed libraries to the beginning of the library search list
9726 for path in $notinst_path; do
9727 case " $new_libs " in
9728 *" -L$path/$objdir "*) ;;
9730 case " $deplibs " in
9731 *" -L$path/$objdir "*)
9732 func_append new_libs " -L$path/$objdir" ;;
9737 for deplib in $deplibs; do
9740 case " $new_libs " in
9742 *) func_append new_libs " $deplib" ;;
9745 *) func_append new_libs " $deplib" ;;
9750 # All the library-specific variables (install_libdir is set above).
9755 # Test again, we may have decided not to build it any more
9756 if test yes = "$build_libtool_libs"; then
9757 # Remove $wl instances when linking with ld.
9758 # FIXME: should test the right _cmds variable.
9759 case $archive_cmds in
9762 if test yes = "$hardcode_into_libs"; then
9763 # Hardcode the library paths
9766 rpath=$finalize_rpath
9767 test relink = "$opt_mode" || rpath=$compile_rpath$rpath
9768 for libdir in $rpath; do
9769 if test -n "$hardcode_libdir_flag_spec"; then
9770 if test -n "$hardcode_libdir_separator"; then
9771 func_replace_sysroot "$libdir"
9772 libdir=$func_replace_sysroot_result
9773 if test -z "$hardcode_libdirs"; then
9774 hardcode_libdirs=$libdir
9776 # Just accumulate the unique libdirs.
9777 case $hardcode_libdir_separator$hardcode_libdirs$hardcode_libdir_separator in
9778 *"$hardcode_libdir_separator$libdir$hardcode_libdir_separator"*)
9781 func_append hardcode_libdirs "$hardcode_libdir_separator$libdir"
9786 eval flag=\"$hardcode_libdir_flag_spec\"
9787 func_append dep_rpath " $flag"
9789 elif test -n "$runpath_var"; then
9790 case "$perm_rpath " in
9792 *) func_append perm_rpath " $libdir" ;;
9796 # Substitute the hardcoded libdirs into the rpath.
9797 if test -n "$hardcode_libdir_separator" &&
9798 test -n "$hardcode_libdirs"; then
9799 libdir=$hardcode_libdirs
9800 eval "dep_rpath=\"$hardcode_libdir_flag_spec\""
9802 if test -n "$runpath_var" && test -n "$perm_rpath"; then
9803 # We should set the runpath_var.
9805 for dir in $perm_rpath; do
9806 func_append rpath "$dir:"
9808 eval "$runpath_var='$rpath\$$runpath_var'; export $runpath_var"
9810 test -n "$dep_rpath" && deplibs="$dep_rpath $deplibs"
9813 shlibpath=$finalize_shlibpath
9814 test relink = "$opt_mode" || shlibpath=$compile_shlibpath$shlibpath
9815 if test -n "$shlibpath"; then
9816 eval "$shlibpath_var='$shlibpath\$$shlibpath_var'; export $shlibpath_var"
9819 # Get the real and link names of the library.
9820 eval shared_ext=\"$shrext_cmds\"
9821 eval library_names=\"$library_names_spec\"
9822 set dummy $library_names
9827 if test -n "$soname_spec"; then
9828 eval soname=\"$soname_spec\"
9832 if test -z "$dlname"; then
9836 lib=$output_objdir/$realname
9840 func_append linknames " $link"
9843 # Use standard objects if they are pic
9844 test -z "$pic_flag" && libobjs=`$ECHO "$libobjs" | $SP2NL | $SED "$lo2o" | $NL2SP`
9845 test "X$libobjs" = "X " && libobjs=
9848 if test -n "$export_symbols" && test -n "$include_expsyms"; then
9849 $opt_dry_run || cp "$export_symbols" "$output_objdir/$libname.uexp"
9850 export_symbols=$output_objdir/$libname.uexp
9851 func_append delfiles " $export_symbols"
9854 orig_export_symbols=
9856 cygwin* | mingw* | cegcc*)
9857 if test -n "$export_symbols" && test -z "$export_symbols_regex"; then
9858 # exporting using user supplied symfile
9859 func_dll_def_p "$export_symbols" || {
9860 # and it's NOT already a .def file. Must figure out
9861 # which of the given symbols are data symbols and tag
9862 # them as such. So, trigger use of export_symbols_cmds.
9863 # export_symbols gets reassigned inside the "prepare
9864 # the list of exported symbols" if statement, so the
9865 # include_expsyms logic still works.
9866 orig_export_symbols=$export_symbols
9868 always_export_symbols=yes
9874 # Prepare the list of exported symbols
9875 if test -z "$export_symbols"; then
9876 if test yes = "$always_export_symbols" || test -n "$export_symbols_regex"; then
9877 func_verbose "generating symbol list for '$libname.la'"
9878 export_symbols=$output_objdir/$libname.exp
9879 $opt_dry_run || $RM $export_symbols
9880 cmds=$export_symbols_cmds
9881 save_ifs=$IFS; IFS='~'
9882 for cmd1 in $cmds; do
9884 # Take the normal branch if the nm_file_list_spec branch
9885 # doesn't work or if tool conversion is not needed.
9886 case $nm_file_list_spec~$to_tool_file_cmd in
9887 *~func_convert_file_noop | *~func_convert_file_msys_to_w32 | ~*)
9888 try_normal_branch=yes
9891 len=$func_len_result
9894 try_normal_branch=no
9897 if test yes = "$try_normal_branch" \
9898 && { test "$len" -lt "$max_cmd_len" \
9899 || test "$max_cmd_len" -le -1; }
9901 func_show_eval "$cmd" 'exit $?'
9902 skipped_export=false
9903 elif test -n "$nm_file_list_spec"; then
9904 func_basename "$output"
9905 output_la=$func_basename_result
9906 save_libobjs=$libobjs
9908 output=$output_objdir/$output_la.nm
9909 func_to_tool_file "$output"
9910 libobjs=$nm_file_list_spec$func_to_tool_file_result
9911 func_append delfiles " $output"
9912 func_verbose "creating $NM input file list: $output"
9913 for obj in $save_libobjs; do
9914 func_to_tool_file "$obj"
9915 $ECHO "$func_to_tool_file_result"
9918 func_show_eval "$cmd" 'exit $?'
9920 libobjs=$save_libobjs
9921 skipped_export=false
9923 # The command line is too long to execute in one step.
9924 func_verbose "using reloadable object file for export list..."
9926 # Break out early, otherwise skipped_export may be
9927 # set to false by a later but shorter cmd.
9932 if test -n "$export_symbols_regex" && test : != "$skipped_export"; then
9933 func_show_eval '$EGREP -e "$export_symbols_regex" "$export_symbols" > "${export_symbols}T"'
9934 func_show_eval '$MV "${export_symbols}T" "$export_symbols"'
9939 if test -n "$export_symbols" && test -n "$include_expsyms"; then
9940 tmp_export_symbols=$export_symbols
9941 test -n "$orig_export_symbols" && tmp_export_symbols=$orig_export_symbols
9942 $opt_dry_run || eval '$ECHO "$include_expsyms" | $SP2NL >> "$tmp_export_symbols"'
9945 if test : != "$skipped_export" && test -n "$orig_export_symbols"; then
9946 # The given exports_symbols file has to be filtered, so filter it.
9947 func_verbose "filter symbol list for '$libname.la' to tag DATA exports"
9948 # FIXME: $output_objdir/$libname.filter potentially contains lots of
9949 # 's' commands, which not all seds can handle. GNU sed should be fine
9950 # though. Also, the filter scales superlinearly with the number of
9951 # global variables. join(1) would be nice here, but unfortunately
9952 # isn't a blessed tool.
9953 $opt_dry_run || $SED -e '/[ ,]DATA/!d;s,\(.*\)\([ \,].*\),s|^\1$|\1\2|,' < $export_symbols > $output_objdir/$libname.filter
9954 func_append delfiles " $export_symbols $output_objdir/$libname.filter"
9955 export_symbols=$output_objdir/$libname.def
9956 $opt_dry_run || $SED -f $output_objdir/$libname.filter < $orig_export_symbols > $export_symbols
9960 for test_deplib in $deplibs; do
9961 case " $convenience " in
9962 *" $test_deplib "*) ;;
9964 func_append tmp_deplibs " $test_deplib"
9968 deplibs=$tmp_deplibs
9970 if test -n "$convenience"; then
9971 if test -n "$whole_archive_flag_spec" &&
9972 test yes = "$compiler_needs_object" &&
9973 test -z "$libobjs"; then
9974 # extract the archives, so we have objects to list.
9975 # TODO: could optimize this to just extract one archive.
9976 whole_archive_flag_spec=
9978 if test -n "$whole_archive_flag_spec"; then
9979 save_libobjs=$libobjs
9980 eval libobjs=\"\$libobjs $whole_archive_flag_spec\"
9981 test "X$libobjs" = "X " && libobjs=
9983 gentop=$output_objdir/${outputname}x
9984 func_append generated " $gentop"
9986 func_extract_archives $gentop $convenience
9987 func_append libobjs " $func_extract_archives_result"
9988 test "X$libobjs" = "X " && libobjs=
9992 if test yes = "$thread_safe" && test -n "$thread_safe_flag_spec"; then
9993 eval flag=\"$thread_safe_flag_spec\"
9994 func_append linker_flags " $flag"
9997 # Make a backup of the uninstalled library when relinking
9998 if test relink = "$opt_mode"; then
9999 $opt_dry_run || eval '(cd $output_objdir && $RM ${realname}U && $MV $realname ${realname}U)' || exit $?
10002 # Do each of the archive commands.
10003 if test yes = "$module" && test -n "$module_cmds"; then
10004 if test -n "$export_symbols" && test -n "$module_expsym_cmds"; then
10005 eval test_cmds=\"$module_expsym_cmds\"
10006 cmds=$module_expsym_cmds
10008 eval test_cmds=\"$module_cmds\"
10012 if test -n "$export_symbols" && test -n "$archive_expsym_cmds"; then
10013 eval test_cmds=\"$archive_expsym_cmds\"
10014 cmds=$archive_expsym_cmds
10016 eval test_cmds=\"$archive_cmds\"
10021 if test : != "$skipped_export" &&
10022 func_len " $test_cmds" &&
10023 len=$func_len_result &&
10024 test "$len" -lt "$max_cmd_len" || test "$max_cmd_len" -le -1; then
10027 # The command line is too long to link in one step, link piecewise
10028 # or, if using GNU ld and skipped_export is not :, use a linker
10031 # Save the value of $output and $libobjs because we want to
10032 # use them later. If we have whole_archive_flag_spec, we
10033 # want to use save_libobjs as it was before
10034 # whole_archive_flag_spec was expanded, because we can't
10035 # assume the linker understands whole_archive_flag_spec.
10036 # This may have to be revisited, in case too many
10037 # convenience libraries get linked in and end up exceeding
10039 if test -z "$convenience" || test -z "$whole_archive_flag_spec"; then
10040 save_libobjs=$libobjs
10042 save_output=$output
10043 func_basename "$output"
10044 output_la=$func_basename_result
10046 # Clear the reloadable object creation command queue and
10047 # initialize k to one.
10054 if test -n "$save_libobjs" && test : != "$skipped_export" && test yes = "$with_gnu_ld"; then
10055 output=$output_objdir/$output_la.lnkscript
10056 func_verbose "creating GNU ld script: $output"
10057 echo 'INPUT (' > $output
10058 for obj in $save_libobjs
10060 func_to_tool_file "$obj"
10061 $ECHO "$func_to_tool_file_result" >> $output
10063 echo ')' >> $output
10064 func_append delfiles " $output"
10065 func_to_tool_file "$output"
10066 output=$func_to_tool_file_result
10067 elif test -n "$save_libobjs" && test : != "$skipped_export" && test -n "$file_list_spec"; then
10068 output=$output_objdir/$output_la.lnk
10069 func_verbose "creating linker input file list: $output"
10071 set x $save_libobjs
10074 if test yes = "$compiler_needs_object"; then
10080 func_to_tool_file "$obj"
10081 $ECHO "$func_to_tool_file_result" >> $output
10083 func_append delfiles " $output"
10084 func_to_tool_file "$output"
10085 output=$firstobj\"$file_list_spec$func_to_tool_file_result\"
10087 if test -n "$save_libobjs"; then
10088 func_verbose "creating reloadable object files..."
10089 output=$output_objdir/$output_la-$k.$objext
10090 eval test_cmds=\"$reload_cmds\"
10091 func_len " $test_cmds"
10092 len0=$func_len_result
10095 # Loop over the list of objects to be linked.
10096 for obj in $save_libobjs
10099 func_arith $len + $func_len_result
10100 len=$func_arith_result
10101 if test -z "$objlist" ||
10102 test "$len" -lt "$max_cmd_len"; then
10103 func_append objlist " $obj"
10105 # The command $test_cmds is almost too long, add a
10106 # command to the queue.
10107 if test 1 -eq "$k"; then
10108 # The first file doesn't have a previous command to add.
10109 reload_objs=$objlist
10110 eval concat_cmds=\"$reload_cmds\"
10112 # All subsequent reloadable object files will link in
10113 # the last one created.
10114 reload_objs="$objlist $last_robj"
10115 eval concat_cmds=\"\$concat_cmds~$reload_cmds~\$RM $last_robj\"
10117 last_robj=$output_objdir/$output_la-$k.$objext
10119 k=$func_arith_result
10120 output=$output_objdir/$output_la-$k.$objext
10122 func_len " $last_robj"
10123 func_arith $len0 + $func_len_result
10124 len=$func_arith_result
10127 # Handle the remaining objects by creating one last
10128 # reloadable object file. All subsequent reloadable object
10129 # files will link in the last one created.
10130 test -z "$concat_cmds" || concat_cmds=$concat_cmds~
10131 reload_objs="$objlist $last_robj"
10132 eval concat_cmds=\"\$concat_cmds$reload_cmds\"
10133 if test -n "$last_robj"; then
10134 eval concat_cmds=\"\$concat_cmds~\$RM $last_robj\"
10136 func_append delfiles " $output"
10142 ${skipped_export-false} && {
10143 func_verbose "generating symbol list for '$libname.la'"
10144 export_symbols=$output_objdir/$libname.exp
10145 $opt_dry_run || $RM $export_symbols
10147 # Append the command to create the export file.
10148 test -z "$concat_cmds" || concat_cmds=$concat_cmds~
10149 eval concat_cmds=\"\$concat_cmds$export_symbols_cmds\"
10150 if test -n "$last_robj"; then
10151 eval concat_cmds=\"\$concat_cmds~\$RM $last_robj\"
10155 test -n "$save_libobjs" &&
10156 func_verbose "creating a temporary reloadable object file: $output"
10158 # Loop through the commands generated above and execute them.
10159 save_ifs=$IFS; IFS='~'
10160 for cmd in $concat_cmds; do
10163 func_quote_arg expand,pretty "$cmd"
10164 eval "func_echo $func_quote_arg_result"
10166 $opt_dry_run || eval "$cmd" || {
10169 # Restore the uninstalled library and exit
10170 if test relink = "$opt_mode"; then
10171 ( cd "$output_objdir" && \
10172 $RM "${realname}T" && \
10173 $MV "${realname}U" "$realname" )
10181 if test -n "$export_symbols_regex" && ${skipped_export-false}; then
10182 func_show_eval '$EGREP -e "$export_symbols_regex" "$export_symbols" > "${export_symbols}T"'
10183 func_show_eval '$MV "${export_symbols}T" "$export_symbols"'
10187 ${skipped_export-false} && {
10188 if test -n "$export_symbols" && test -n "$include_expsyms"; then
10189 tmp_export_symbols=$export_symbols
10190 test -n "$orig_export_symbols" && tmp_export_symbols=$orig_export_symbols
10191 $opt_dry_run || eval '$ECHO "$include_expsyms" | $SP2NL >> "$tmp_export_symbols"'
10194 if test -n "$orig_export_symbols"; then
10195 # The given exports_symbols file has to be filtered, so filter it.
10196 func_verbose "filter symbol list for '$libname.la' to tag DATA exports"
10197 # FIXME: $output_objdir/$libname.filter potentially contains lots of
10198 # 's' commands, which not all seds can handle. GNU sed should be fine
10199 # though. Also, the filter scales superlinearly with the number of
10200 # global variables. join(1) would be nice here, but unfortunately
10201 # isn't a blessed tool.
10202 $opt_dry_run || $SED -e '/[ ,]DATA/!d;s,\(.*\)\([ \,].*\),s|^\1$|\1\2|,' < $export_symbols > $output_objdir/$libname.filter
10203 func_append delfiles " $export_symbols $output_objdir/$libname.filter"
10204 export_symbols=$output_objdir/$libname.def
10205 $opt_dry_run || $SED -f $output_objdir/$libname.filter < $orig_export_symbols > $export_symbols
10210 # Restore the value of output.
10211 output=$save_output
10213 if test -n "$convenience" && test -n "$whole_archive_flag_spec"; then
10214 eval libobjs=\"\$libobjs $whole_archive_flag_spec\"
10215 test "X$libobjs" = "X " && libobjs=
10217 # Expand the library linking commands again to reset the
10218 # value of $libobjs for piecewise linking.
10220 # Do each of the archive commands.
10221 if test yes = "$module" && test -n "$module_cmds"; then
10222 if test -n "$export_symbols" && test -n "$module_expsym_cmds"; then
10223 cmds=$module_expsym_cmds
10228 if test -n "$export_symbols" && test -n "$archive_expsym_cmds"; then
10229 cmds=$archive_expsym_cmds
10236 if test -n "$delfiles"; then
10237 # Append the command to remove temporary files to $cmds.
10238 eval cmds=\"\$cmds~\$RM $delfiles\"
10241 # Add any objects from preloaded convenience libraries
10242 if test -n "$dlprefiles"; then
10243 gentop=$output_objdir/${outputname}x
10244 func_append generated " $gentop"
10246 func_extract_archives $gentop $dlprefiles
10247 func_append libobjs " $func_extract_archives_result"
10248 test "X$libobjs" = "X " && libobjs=
10251 save_ifs=$IFS; IFS='~'
10252 for cmd in $cmds; do
10257 func_quote_arg expand,pretty "$cmd"
10258 eval "func_echo $func_quote_arg_result"
10260 $opt_dry_run || eval "$cmd" || {
10263 # Restore the uninstalled library and exit
10264 if test relink = "$opt_mode"; then
10265 ( cd "$output_objdir" && \
10266 $RM "${realname}T" && \
10267 $MV "${realname}U" "$realname" )
10275 # Restore the uninstalled library and exit
10276 if test relink = "$opt_mode"; then
10277 $opt_dry_run || eval '(cd $output_objdir && $RM ${realname}T && $MV $realname ${realname}T && $MV ${realname}U $realname)' || exit $?
10279 if test -n "$convenience"; then
10280 if test -z "$whole_archive_flag_spec"; then
10281 func_show_eval '${RM}r "$gentop"'
10288 # Create links to the real library.
10289 for linkname in $linknames; do
10290 if test "$realname" != "$linkname"; then
10291 func_show_eval '(cd "$output_objdir" && $RM "$linkname" && $LN_S "$realname" "$linkname")' 'exit $?'
10295 # If -module or -export-dynamic was specified, set the dlname.
10296 if test yes = "$module" || test yes = "$export_dynamic"; then
10297 # On all known operating systems, these are identical.
10304 if test -n "$dlfiles$dlprefiles" || test no != "$dlself"; then
10305 func_warning "'-dlopen' is ignored for objects"
10308 case " $deplibs" in
10310 func_warning "'-l' and '-L' are ignored for objects" ;;
10313 test -n "$rpath" && \
10314 func_warning "'-rpath' is ignored for objects"
10316 test -n "$xrpath" && \
10317 func_warning "'-R' is ignored for objects"
10319 test -n "$vinfo" && \
10320 func_warning "'-version-info' is ignored for objects"
10322 test -n "$release" && \
10323 func_warning "'-release' is ignored for objects"
10327 test -n "$objs$old_deplibs" && \
10328 func_fatal_error "cannot build library object '$output' from non-libtool objects"
10331 func_lo2o "$libobj"
10332 obj=$func_lo2o_result
10340 # Delete the old objects.
10341 $opt_dry_run || $RM $obj $libobj
10343 # Objects from convenience libraries. This assumes
10344 # single-version convenience libraries. Whenever we create
10345 # different ones for PIC/non-PIC, this we'll have to duplicate
10349 # if reload_cmds runs $LD directly, get rid of -Wl from
10350 # whole_archive_flag_spec and hope we can get by with turning comma
10352 case $reload_cmds in
10353 *\$LD[\ \$]*) wl= ;;
10355 if test -n "$convenience"; then
10356 if test -n "$whole_archive_flag_spec"; then
10357 eval tmp_whole_archive_flags=\"$whole_archive_flag_spec\"
10358 test -n "$wl" || tmp_whole_archive_flags=`$ECHO "$tmp_whole_archive_flags" | $SED 's|,| |g'`
10359 reload_conv_objs=$reload_objs\ $tmp_whole_archive_flags
10361 gentop=$output_objdir/${obj}x
10362 func_append generated " $gentop"
10364 func_extract_archives $gentop $convenience
10365 reload_conv_objs="$reload_objs $func_extract_archives_result"
10369 # If we're not building shared, we need to use non_pic_objs
10370 test yes = "$build_libtool_libs" || libobjs=$non_pic_objects
10372 # Create the old-style object.
10373 reload_objs=$objs$old_deplibs' '`$ECHO "$libobjs" | $SP2NL | $SED "/\.$libext$/d; /\.lib$/d; $lo2o" | $NL2SP`' '$reload_conv_objs
10376 func_execute_cmds "$reload_cmds" 'exit $?'
10378 # Exit if we aren't doing a library object file.
10379 if test -z "$libobj"; then
10380 if test -n "$gentop"; then
10381 func_show_eval '${RM}r "$gentop"'
10387 test yes = "$build_libtool_libs" || {
10388 if test -n "$gentop"; then
10389 func_show_eval '${RM}r "$gentop"'
10392 # Create an invalid libtool object if no PIC, so that we don't
10393 # accidentally link it into a program.
10394 # $show "echo timestamp > $libobj"
10395 # $opt_dry_run || eval "echo timestamp > $libobj" || exit $?
10399 if test -n "$pic_flag" || test default != "$pic_mode"; then
10400 # Only do commands if we really have different PIC objects.
10401 reload_objs="$libobjs $reload_conv_objs"
10403 func_execute_cmds "$reload_cmds" 'exit $?'
10406 if test -n "$gentop"; then
10407 func_show_eval '${RM}r "$gentop"'
10415 *cygwin*) func_stripname '' '.exe' "$output"
10416 output=$func_stripname_result.exe;;
10418 test -n "$vinfo" && \
10419 func_warning "'-version-info' is ignored for programs"
10421 test -n "$release" && \
10422 func_warning "'-release' is ignored for programs"
10425 && test unknown,unknown,unknown = "$dlopen_support,$dlopen_self,$dlopen_self_static" \
10426 && func_warning "'LT_INIT([dlopen])' not used. Assuming no dlopen support."
10429 *-*-rhapsody* | *-*-darwin1.[012])
10430 # On Rhapsody replace the C library is the System framework
10431 compile_deplibs=`$ECHO " $compile_deplibs" | $SED 's/ -lc / System.ltframework /'`
10432 finalize_deplibs=`$ECHO " $finalize_deplibs" | $SED 's/ -lc / System.ltframework /'`
10438 # Don't allow lazy linking, it breaks C++ global constructors
10439 # But is supposedly fixed on 10.4 or later (yay!).
10440 if test CXX = "$tagname"; then
10441 case ${MACOSX_DEPLOYMENT_TARGET-10.0} in
10443 func_append compile_command " $wl-bind_at_load"
10444 func_append finalize_command " $wl-bind_at_load"
10448 # Time to change all our "foo.ltframework" stuff back to "-framework foo"
10449 compile_deplibs=`$ECHO " $compile_deplibs" | $SED 's% \([^ $]*\).ltframework% -framework \1%g'`
10450 finalize_deplibs=`$ECHO " $finalize_deplibs" | $SED 's% \([^ $]*\).ltframework% -framework \1%g'`
10455 # move library search paths that coincide with paths to not yet
10456 # installed libraries to the beginning of the library search list
10458 for path in $notinst_path; do
10459 case " $new_libs " in
10460 *" -L$path/$objdir "*) ;;
10462 case " $compile_deplibs " in
10463 *" -L$path/$objdir "*)
10464 func_append new_libs " -L$path/$objdir" ;;
10469 for deplib in $compile_deplibs; do
10472 case " $new_libs " in
10474 *) func_append new_libs " $deplib" ;;
10477 *) func_append new_libs " $deplib" ;;
10480 compile_deplibs=$new_libs
10483 func_append compile_command " $compile_deplibs"
10484 func_append finalize_command " $finalize_deplibs"
10486 if test -n "$rpath$xrpath"; then
10487 # If the user specified any rpath flags, then add them.
10488 for libdir in $rpath $xrpath; do
10489 # Skip directories that are in the system default run-time search path.
10490 case " $sys_lib_dlsearch_path " in
10491 *" $libdir "*) continue ;;
10493 # This is the magic to use -rpath.
10494 case "$finalize_rpath " in
10496 *) func_append finalize_rpath " $libdir" ;;
10501 # Now hardcode the library paths
10504 for libdir in $compile_rpath $finalize_rpath; do
10505 if test -n "$hardcode_libdir_flag_spec"; then
10506 if test -n "$hardcode_libdir_separator"; then
10507 if test -z "$hardcode_libdirs"; then
10508 hardcode_libdirs=$libdir
10510 # Just accumulate the unique libdirs.
10511 case $hardcode_libdir_separator$hardcode_libdirs$hardcode_libdir_separator in
10512 *"$hardcode_libdir_separator$libdir$hardcode_libdir_separator"*)
10515 func_append hardcode_libdirs "$hardcode_libdir_separator$libdir"
10520 eval flag=\"$hardcode_libdir_flag_spec\"
10521 func_append rpath " $flag"
10523 elif test -n "$runpath_var"; then
10524 case "$perm_rpath " in
10526 *) func_append perm_rpath " $libdir" ;;
10530 *-*-cygwin* | *-*-mingw* | *-*-pw32* | *-*-os2* | *-cegcc*)
10531 testbindir=`$ECHO "$libdir" | $SED -e 's*/lib$*/bin*'`
10532 case :$dllsearchpath: in
10534 ::) dllsearchpath=$libdir;;
10535 *) func_append dllsearchpath ":$libdir";;
10537 case :$dllsearchpath: in
10538 *":$testbindir:"*) ;;
10539 ::) dllsearchpath=$testbindir;;
10540 *) func_append dllsearchpath ":$testbindir";;
10545 # Substitute the hardcoded libdirs into the rpath.
10546 if test -n "$hardcode_libdir_separator" &&
10547 test -n "$hardcode_libdirs"; then
10548 libdir=$hardcode_libdirs
10549 eval rpath=\" $hardcode_libdir_flag_spec\"
10551 compile_rpath=$rpath
10555 for libdir in $finalize_rpath; do
10556 if test -n "$hardcode_libdir_flag_spec"; then
10557 if test -n "$hardcode_libdir_separator"; then
10558 if test -z "$hardcode_libdirs"; then
10559 hardcode_libdirs=$libdir
10561 # Just accumulate the unique libdirs.
10562 case $hardcode_libdir_separator$hardcode_libdirs$hardcode_libdir_separator in
10563 *"$hardcode_libdir_separator$libdir$hardcode_libdir_separator"*)
10566 func_append hardcode_libdirs "$hardcode_libdir_separator$libdir"
10571 eval flag=\"$hardcode_libdir_flag_spec\"
10572 func_append rpath " $flag"
10574 elif test -n "$runpath_var"; then
10575 case "$finalize_perm_rpath " in
10577 *) func_append finalize_perm_rpath " $libdir" ;;
10581 # Substitute the hardcoded libdirs into the rpath.
10582 if test -n "$hardcode_libdir_separator" &&
10583 test -n "$hardcode_libdirs"; then
10584 libdir=$hardcode_libdirs
10585 eval rpath=\" $hardcode_libdir_flag_spec\"
10587 finalize_rpath=$rpath
10589 if test -n "$libobjs" && test yes = "$build_old_libs"; then
10590 # Transform all the library objects into standard objects.
10591 compile_command=`$ECHO "$compile_command" | $SP2NL | $SED "$lo2o" | $NL2SP`
10592 finalize_command=`$ECHO "$finalize_command" | $SP2NL | $SED "$lo2o" | $NL2SP`
10595 func_generate_dlsyms "$outputname" "@PROGRAM@" false
10597 # template prelinking step
10598 if test -n "$prelink_cmds"; then
10599 func_execute_cmds "$prelink_cmds" 'exit $?'
10602 wrappers_required=:
10604 *cegcc* | *mingw32ce*)
10605 # Disable wrappers for cegcc and mingw32ce hosts, we are cross compiling anyway.
10606 wrappers_required=false
10608 *cygwin* | *mingw* )
10609 test yes = "$build_libtool_libs" || wrappers_required=false
10612 if test no = "$need_relink" || test yes != "$build_libtool_libs"; then
10613 wrappers_required=false
10617 $wrappers_required || {
10618 # Replace the output file specification.
10619 compile_command=`$ECHO "$compile_command" | $SED 's%@OUTPUT@%'"$output"'%g'`
10620 link_command=$compile_command$compile_rpath
10622 # We have no uninstalled library dependencies, so finalize right now.
10624 func_show_eval "$link_command" 'exit_status=$?'
10626 if test -n "$postlink_cmds"; then
10627 func_to_tool_file "$output"
10628 postlink_cmds=`func_echo_all "$postlink_cmds" | $SED -e 's%@OUTPUT@%'"$output"'%g' -e 's%@TOOL_OUTPUT@%'"$func_to_tool_file_result"'%g'`
10629 func_execute_cmds "$postlink_cmds" 'exit $?'
10632 # Delete the generated files.
10633 if test -f "$output_objdir/${outputname}S.$objext"; then
10634 func_show_eval '$RM "$output_objdir/${outputname}S.$objext"'
10640 if test -n "$compile_shlibpath$finalize_shlibpath"; then
10641 compile_command="$shlibpath_var=\"$compile_shlibpath$finalize_shlibpath\$$shlibpath_var\" $compile_command"
10643 if test -n "$finalize_shlibpath"; then
10644 finalize_command="$shlibpath_var=\"$finalize_shlibpath\$$shlibpath_var\" $finalize_command"
10649 if test -n "$runpath_var"; then
10650 if test -n "$perm_rpath"; then
10651 # We should set the runpath_var.
10653 for dir in $perm_rpath; do
10654 func_append rpath "$dir:"
10656 compile_var="$runpath_var=\"$rpath\$$runpath_var\" "
10658 if test -n "$finalize_perm_rpath"; then
10659 # We should set the runpath_var.
10661 for dir in $finalize_perm_rpath; do
10662 func_append rpath "$dir:"
10664 finalize_var="$runpath_var=\"$rpath\$$runpath_var\" "
10668 if test yes = "$no_install"; then
10669 # We don't need to create a wrapper script.
10670 link_command=$compile_var$compile_command$compile_rpath
10671 # Replace the output file specification.
10672 link_command=`$ECHO "$link_command" | $SED 's%@OUTPUT@%'"$output"'%g'`
10673 # Delete the old output file.
10674 $opt_dry_run || $RM $output
10675 # Link the executable and exit
10676 func_show_eval "$link_command" 'exit $?'
10678 if test -n "$postlink_cmds"; then
10679 func_to_tool_file "$output"
10680 postlink_cmds=`func_echo_all "$postlink_cmds" | $SED -e 's%@OUTPUT@%'"$output"'%g' -e 's%@TOOL_OUTPUT@%'"$func_to_tool_file_result"'%g'`
10681 func_execute_cmds "$postlink_cmds" 'exit $?'
10687 case $hardcode_action,$fast_install in
10689 # Fast installation is not supported
10690 link_command=$compile_var$compile_command$compile_rpath
10691 relink_command=$finalize_var$finalize_command$finalize_rpath
10693 func_warning "this platform does not like uninstalled shared libraries"
10694 func_warning "'$output' will be relinked during installation"
10697 link_command=$finalize_var$compile_command$finalize_rpath
10698 relink_command=`$ECHO "$compile_var$compile_command$compile_rpath" | $SED 's%@OUTPUT@%\$progdir/\$file%g'`
10701 link_command=$compile_var$compile_command$compile_rpath
10702 relink_command=$finalize_var$finalize_command$finalize_rpath
10705 link_command=$finalize_var$compile_command$finalize_rpath
10710 # Replace the output file specification.
10711 link_command=`$ECHO "$link_command" | $SED 's%@OUTPUT@%'"$output_objdir/$outputname"'%g'`
10713 # Delete the old output files.
10714 $opt_dry_run || $RM $output $output_objdir/$outputname $output_objdir/lt-$outputname
10716 func_show_eval "$link_command" 'exit $?'
10718 if test -n "$postlink_cmds"; then
10719 func_to_tool_file "$output_objdir/$outputname"
10720 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'`
10721 func_execute_cmds "$postlink_cmds" 'exit $?'
10724 # Now create the wrapper script.
10725 func_verbose "creating $output"
10727 # Quote the relink command for shipping.
10728 if test -n "$relink_command"; then
10729 # Preserve any variables that may affect compiler behavior
10730 for var in $variables_saved_for_relink; do
10731 if eval test -z \"\${$var+set}\"; then
10732 relink_command="{ test -z \"\${$var+set}\" || $lt_unset $var || { $var=; export $var; }; }; $relink_command"
10733 elif eval var_value=\$$var; test -z "$var_value"; then
10734 relink_command="$var=; export $var; $relink_command"
10736 func_quote_arg pretty "$var_value"
10737 relink_command="$var=$func_quote_arg_result; export $var; $relink_command"
10740 func_quote eval cd "`pwd`"
10741 func_quote_arg pretty,unquoted "($func_quote_result; $relink_command)"
10742 relink_command=$func_quote_arg_unquoted_result
10745 # Only actually do things if not in dry run mode.
10747 # win32 will think the script is a binary if it has
10748 # a .exe suffix, so we strip it off here.
10750 *.exe) func_stripname '' '.exe' "$output"
10751 output=$func_stripname_result ;;
10753 # test for cygwin because mv fails w/o .exe extensions
10757 func_stripname '' '.exe' "$outputname"
10758 outputname=$func_stripname_result ;;
10762 *cygwin* | *mingw* )
10763 func_dirname_and_basename "$output" "" "."
10764 output_name=$func_basename_result
10765 output_path=$func_dirname_result
10766 cwrappersource=$output_path/$objdir/lt-$output_name.c
10767 cwrapper=$output_path/$output_name.exe
10768 $RM $cwrappersource $cwrapper
10769 trap "$RM $cwrappersource $cwrapper; exit $EXIT_FAILURE" 1 2 15
10771 func_emit_cwrapperexe_src > $cwrappersource
10773 # The wrapper executable is built using the $host compiler,
10774 # because it contains $host paths and files. If cross-
10775 # compiling, it, like the target executable, must be
10776 # executed on the $host or under an emulation environment.
10778 $LTCC $LTCFLAGS -o $cwrapper $cwrappersource
10782 # Now, create the wrapper script for func_source use:
10783 func_ltwrapper_scriptname $cwrapper
10784 $RM $func_ltwrapper_scriptname_result
10785 trap "$RM $func_ltwrapper_scriptname_result; exit $EXIT_FAILURE" 1 2 15
10787 # note: this script will not be executed, so do not chmod.
10788 if test "x$build" = "x$host"; then
10789 $cwrapper --lt-dump-script > $func_ltwrapper_scriptname_result
10791 func_emit_wrapper no > $func_ltwrapper_scriptname_result
10797 trap "$RM $output; exit $EXIT_FAILURE" 1 2 15
10799 func_emit_wrapper no > $output
10808 # See if we need to build an old-fashioned archive.
10809 for oldlib in $oldlibs; do
10811 case $build_libtool_libs in
10813 oldobjs="$libobjs_save $symfileobj"
10814 addlibs=$convenience
10815 build_libtool_libs=no
10818 oldobjs=$libobjs_save
10819 addlibs=$old_convenience
10820 build_libtool_libs=no
10823 oldobjs="$old_deplibs $non_pic_objects"
10824 $preload && test -f "$symfileobj" \
10825 && func_append oldobjs " $symfileobj"
10826 addlibs=$old_convenience
10830 if test -n "$addlibs"; then
10831 gentop=$output_objdir/${outputname}x
10832 func_append generated " $gentop"
10834 func_extract_archives $gentop $addlibs
10835 func_append oldobjs " $func_extract_archives_result"
10838 # Do each command in the archive commands.
10839 if test -n "$old_archive_from_new_cmds" && test yes = "$build_libtool_libs"; then
10840 cmds=$old_archive_from_new_cmds
10843 # Add any objects from preloaded convenience libraries
10844 if test -n "$dlprefiles"; then
10845 gentop=$output_objdir/${outputname}x
10846 func_append generated " $gentop"
10848 func_extract_archives $gentop $dlprefiles
10849 func_append oldobjs " $func_extract_archives_result"
10852 # POSIX demands no paths to be encoded in archives. We have
10853 # to avoid creating archives with duplicate basenames if we
10854 # might have to extract them afterwards, e.g., when creating a
10855 # static archive out of a convenience library, or when linking
10856 # the entirety of a libtool archive into another (currently
10857 # not supported by libtool).
10858 if (for obj in $oldobjs
10860 func_basename "$obj"
10861 $ECHO "$func_basename_result"
10862 done | sort | sort -uc >/dev/null 2>&1); then
10865 echo "copying selected object files to avoid basename conflicts..."
10866 gentop=$output_objdir/${outputname}x
10867 func_append generated " $gentop"
10868 func_mkdir_p "$gentop"
10869 save_oldobjs=$oldobjs
10872 for obj in $save_oldobjs
10874 func_basename "$obj"
10875 objbase=$func_basename_result
10876 case " $oldobjs " in
10877 " ") oldobjs=$obj ;;
10878 *[\ /]"$objbase "*)
10880 # Make sure we don't pick an alternate name that also
10882 newobj=lt$counter-$objbase
10883 func_arith $counter + 1
10884 counter=$func_arith_result
10885 case " $oldobjs " in
10886 *[\ /]"$newobj "*) ;;
10887 *) if test ! -f "$gentop/$newobj"; then break; fi ;;
10890 func_show_eval "ln $obj $gentop/$newobj || cp $obj $gentop/$newobj"
10891 func_append oldobjs " $gentop/$newobj"
10893 *) func_append oldobjs " $obj" ;;
10897 func_to_tool_file "$oldlib" func_convert_file_msys_to_w32
10898 tool_oldlib=$func_to_tool_file_result
10899 eval cmds=\"$old_archive_cmds\"
10902 len=$func_len_result
10903 if test "$len" -lt "$max_cmd_len" || test "$max_cmd_len" -le -1; then
10904 cmds=$old_archive_cmds
10905 elif test -n "$archiver_list_spec"; then
10906 func_verbose "using command file archive linking..."
10907 for obj in $oldobjs
10909 func_to_tool_file "$obj"
10910 $ECHO "$func_to_tool_file_result"
10911 done > $output_objdir/$libname.libcmd
10912 func_to_tool_file "$output_objdir/$libname.libcmd"
10913 oldobjs=" $archiver_list_spec$func_to_tool_file_result"
10914 cmds=$old_archive_cmds
10916 # the command line is too long to link in one step, link in parts
10917 func_verbose "using piecewise archive linking..."
10918 save_RANLIB=$RANLIB
10922 save_oldobjs=$oldobjs
10924 # Is there a better way of finding the last object in the list?
10925 for obj in $save_oldobjs
10929 eval test_cmds=\"$old_archive_cmds\"
10930 func_len " $test_cmds"
10931 len0=$func_len_result
10933 for obj in $save_oldobjs
10936 func_arith $len + $func_len_result
10937 len=$func_arith_result
10938 func_append objlist " $obj"
10939 if test "$len" -lt "$max_cmd_len"; then
10942 # the above command should be used before it gets too long
10944 if test "$obj" = "$last_oldobj"; then
10945 RANLIB=$save_RANLIB
10947 test -z "$concat_cmds" || concat_cmds=$concat_cmds~
10948 eval concat_cmds=\"\$concat_cmds$old_archive_cmds\"
10953 RANLIB=$save_RANLIB
10955 if test -z "$oldobjs"; then
10956 eval cmds=\"\$concat_cmds\"
10958 eval cmds=\"\$concat_cmds~\$old_archive_cmds\"
10962 func_execute_cmds "$cmds" 'exit $?'
10965 test -n "$generated" && \
10966 func_show_eval "${RM}r$generated"
10968 # Now create the libtool archive.
10972 test yes = "$build_old_libs" && old_library=$libname.$libext
10973 func_verbose "creating $output"
10975 # Preserve any variables that may affect compiler behavior
10976 for var in $variables_saved_for_relink; do
10977 if eval test -z \"\${$var+set}\"; then
10978 relink_command="{ test -z \"\${$var+set}\" || $lt_unset $var || { $var=; export $var; }; }; $relink_command"
10979 elif eval var_value=\$$var; test -z "$var_value"; then
10980 relink_command="$var=; export $var; $relink_command"
10982 func_quote_arg pretty,unquoted "$var_value"
10983 relink_command="$var=$func_quote_arg_unquoted_result; export $var; $relink_command"
10986 # Quote the link command for shipping.
10987 func_quote eval cd "`pwd`"
10988 relink_command="($func_quote_result; $SHELL \"$progpath\" $preserve_args --mode=relink $libtool_args @inst_prefix_dir@)"
10989 func_quote_arg pretty,unquoted "$relink_command"
10990 relink_command=$func_quote_arg_unquoted_result
10991 if test yes = "$hardcode_automatic"; then
10995 # Only create the output if not a dry run.
10997 for installed in no yes; do
10998 if test yes = "$installed"; then
10999 if test -z "$install_libdir"; then
11002 output=$output_objdir/${outputname}i
11003 # Replace all uninstalled libtool libraries with the installed ones
11004 newdependency_libs=
11005 for deplib in $dependency_libs; do
11008 func_basename "$deplib"
11009 name=$func_basename_result
11010 func_resolve_sysroot "$deplib"
11011 eval libdir=`$SED -n -e 's/^libdir=\(.*\)$/\1/p' $func_resolve_sysroot_result`
11012 test -z "$libdir" && \
11013 func_fatal_error "'$deplib' is not a valid libtool archive"
11014 func_append newdependency_libs " ${lt_sysroot:+=}$libdir/$name"
11017 func_stripname -L '' "$deplib"
11018 func_replace_sysroot "$func_stripname_result"
11019 func_append newdependency_libs " -L$func_replace_sysroot_result"
11022 func_stripname -R '' "$deplib"
11023 func_replace_sysroot "$func_stripname_result"
11024 func_append newdependency_libs " -R$func_replace_sysroot_result"
11026 *) func_append newdependency_libs " $deplib" ;;
11029 dependency_libs=$newdependency_libs
11032 for lib in $dlfiles; do
11035 func_basename "$lib"
11036 name=$func_basename_result
11037 eval libdir=`$SED -n -e 's/^libdir=\(.*\)$/\1/p' $lib`
11038 test -z "$libdir" && \
11039 func_fatal_error "'$lib' is not a valid libtool archive"
11040 func_append newdlfiles " ${lt_sysroot:+=}$libdir/$name"
11042 *) func_append newdlfiles " $lib" ;;
11045 dlfiles=$newdlfiles
11047 for lib in $dlprefiles; do
11050 # Only pass preopened files to the pseudo-archive (for
11051 # eventual linking with the app. that links it) if we
11052 # didn't already link the preopened objects directly into
11054 func_basename "$lib"
11055 name=$func_basename_result
11056 eval libdir=`$SED -n -e 's/^libdir=\(.*\)$/\1/p' $lib`
11057 test -z "$libdir" && \
11058 func_fatal_error "'$lib' is not a valid libtool archive"
11059 func_append newdlprefiles " ${lt_sysroot:+=}$libdir/$name"
11063 dlprefiles=$newdlprefiles
11066 for lib in $dlfiles; do
11068 [\\/]* | [A-Za-z]:[\\/]*) abs=$lib ;;
11069 *) abs=`pwd`"/$lib" ;;
11071 func_append newdlfiles " $abs"
11073 dlfiles=$newdlfiles
11075 for lib in $dlprefiles; do
11077 [\\/]* | [A-Za-z]:[\\/]*) abs=$lib ;;
11078 *) abs=`pwd`"/$lib" ;;
11080 func_append newdlprefiles " $abs"
11082 dlprefiles=$newdlprefiles
11085 # place dlname in correct position for cygwin
11086 # In fact, it would be nice if we could use this code for all target
11087 # systems that can't hard-code library paths into their executables
11088 # and that have no shared library path variable independent of PATH,
11089 # but it turns out we can't easily determine that from inspecting
11090 # libtool variables, so we have to hard-code the OSs to which it
11091 # applies here; at the moment, that means platforms that use the PE
11092 # object format with DLL files. See the long comment at the top of
11093 # tests/bindir.at for full details.
11095 case $host,$output,$installed,$module,$dlname in
11096 *cygwin*,*lai,yes,no,*.dll | *mingw*,*lai,yes,no,*.dll | *cegcc*,*lai,yes,no,*.dll)
11097 # If a -bindir argument was supplied, place the dll there.
11098 if test -n "$bindir"; then
11099 func_relative_path "$install_libdir" "$bindir"
11100 tdlname=$func_relative_path_result/$dlname
11102 # Otherwise fall back on heuristic.
11103 tdlname=../bin/$dlname
11108 # $outputname - a libtool library file
11109 # Generated by $PROGRAM (GNU $PACKAGE) $VERSION
11111 # Please DO NOT delete this file!
11112 # It is necessary for linking the library.
11114 # The name that we can dlopen(3).
11117 # Names of this library.
11118 library_names='$library_names'
11120 # The name of the static archive.
11121 old_library='$old_library'
11123 # Linker flags that cannot go in dependency_libs.
11124 inherited_linker_flags='$new_inherited_linker_flags'
11126 # Libraries that this one depends upon.
11127 dependency_libs='$dependency_libs'
11129 # Names of additional weak libraries provided by this library
11130 weak_library_names='$weak_libs'
11132 # Version information for $libname.
11137 # Is this an already installed library?
11138 installed=$installed
11140 # Should we warn about portability when linking against -modules?
11141 shouldnotlink=$module
11143 # Files to dlopen/dlpreopen
11145 dlpreopen='$dlprefiles'
11147 # Directory that this library needs to be installed in:
11148 libdir='$install_libdir'"
11149 if test no,yes = "$installed,$need_relink"; then
11150 $ECHO >> $output "\
11151 relink_command=\"$relink_command\""
11156 # Do a symbolic link so that the libtool archive can be found in
11157 # LD_LIBRARY_PATH before the program is installed.
11158 func_show_eval '( cd "$output_objdir" && $RM "$outputname" && $LN_S "../$outputname" "$outputname" )' 'exit $?'
11164 if test link = "$opt_mode" || test relink = "$opt_mode"; then
11165 func_mode_link ${1+"$@"}
11169 # func_mode_uninstall arg...
11170 func_mode_uninstall ()
11179 # This variable tells wrapper scripts just to set variables rather
11180 # than running their programs.
11181 libtool_install_magic=$magic
11186 -f) func_append RM " $arg"; rmforce=: ;;
11187 -*) func_append RM " $arg" ;;
11188 *) func_append files " $arg" ;;
11193 func_fatal_help "you must specify an RM program"
11197 for file in $files; do
11198 func_dirname "$file" "" "."
11199 dir=$func_dirname_result
11200 if test . = "$dir"; then
11205 func_basename "$file"
11206 name=$func_basename_result
11207 test uninstall = "$opt_mode" && odir=$dir
11209 # Remember odir for removal later, being careful to avoid duplicates
11210 if test clean = "$opt_mode"; then
11211 case " $rmdirs " in
11213 *) func_append rmdirs " $odir" ;;
11217 # Don't error if the file doesn't exist and rm -f was used.
11218 if { test -L "$file"; } >/dev/null 2>&1 ||
11219 { test -h "$file"; } >/dev/null 2>&1 ||
11220 test -f "$file"; then
11222 elif test -d "$file"; then
11225 elif $rmforce; then
11233 # Possibly a libtool archive, so verify it.
11234 if func_lalib_p "$file"; then
11235 func_source $dir/$name
11237 # Delete the libtool libraries and symlinks.
11238 for n in $library_names; do
11239 func_append rmfiles " $odir/$n"
11241 test -n "$old_library" && func_append rmfiles " $odir/$old_library"
11245 case " $library_names " in
11247 *) test -n "$dlname" && func_append rmfiles " $odir/$dlname" ;;
11249 test -n "$libdir" && func_append rmfiles " $odir/$name $odir/${name}i"
11252 if test -n "$library_names"; then
11253 # Do each command in the postuninstall commands.
11254 func_execute_cmds "$postuninstall_cmds" '$rmforce || exit_status=1'
11257 if test -n "$old_library"; then
11258 # Do each command in the old_postuninstall commands.
11259 func_execute_cmds "$old_postuninstall_cmds" '$rmforce || exit_status=1'
11261 # FIXME: should reinstall the best remaining shared library.
11268 # Possibly a libtool object, so verify it.
11269 if func_lalib_p "$file"; then
11271 # Read the .lo file
11272 func_source $dir/$name
11274 # Add PIC object to the list of files to remove.
11275 if test -n "$pic_object" && test none != "$pic_object"; then
11276 func_append rmfiles " $dir/$pic_object"
11279 # Add non-PIC object to the list of files to remove.
11280 if test -n "$non_pic_object" && test none != "$non_pic_object"; then
11281 func_append rmfiles " $dir/$non_pic_object"
11287 if test clean = "$opt_mode"; then
11291 func_stripname '' '.exe' "$file"
11292 file=$func_stripname_result
11293 func_stripname '' '.exe' "$name"
11294 noexename=$func_stripname_result
11295 # $file with .exe has already been added to rmfiles,
11296 # add $file without .exe
11297 func_append rmfiles " $file"
11300 # Do a test to see if this is a libtool program.
11301 if func_ltwrapper_p "$file"; then
11302 if func_ltwrapper_executable_p "$file"; then
11303 func_ltwrapper_scriptname "$file"
11305 func_source $func_ltwrapper_scriptname_result
11306 func_append rmfiles " $func_ltwrapper_scriptname_result"
11309 func_source $dir/$noexename
11312 # note $name still contains .exe if it was in $file originally
11313 # as does the version of $file that was added into $rmfiles
11314 func_append rmfiles " $odir/$name $odir/${name}S.$objext"
11315 if test yes = "$fast_install" && test -n "$relink_command"; then
11316 func_append rmfiles " $odir/lt-$name"
11318 if test "X$noexename" != "X$name"; then
11319 func_append rmfiles " $odir/lt-$noexename.c"
11325 func_show_eval "$RM $rmfiles" 'exit_status=1'
11328 # Try to remove the $objdir's in the directories where we deleted files
11329 for dir in $rmdirs; do
11330 if test -d "$dir"; then
11331 func_show_eval "rmdir $dir >/dev/null 2>&1"
11338 if test uninstall = "$opt_mode" || test clean = "$opt_mode"; then
11339 func_mode_uninstall ${1+"$@"}
11342 test -z "$opt_mode" && {
11344 func_fatal_help "you must specify a MODE"
11347 test -z "$exec_cmd" && \
11348 func_fatal_help "invalid operation mode '$opt_mode'"
11350 if test -n "$exec_cmd"; then
11351 eval exec "$exec_cmd"
11358 # The TAGs below are defined such that we never get into a situation
11359 # where we disable both kinds of libraries. Given conflicting
11360 # choices, we go for a static library, that is the most portable,
11361 # since we can't tell whether shared libraries were disabled because
11362 # the user asked for that or because the platform doesn't support
11363 # them. This is particularly important on AIX, because we don't
11364 # support having both static and shared libraries enabled at the same
11365 # time on that platform, so we default to a shared-only configuration.
11366 # If a disable-shared tag is given, we'll fallback to a static-only
11367 # configuration. But we'll never go from static-only to shared-only.
11369 # ### BEGIN LIBTOOL TAG CONFIG: disable-shared
11370 build_libtool_libs=no
11372 # ### END LIBTOOL TAG CONFIG: disable-shared
11374 # ### BEGIN LIBTOOL TAG CONFIG: disable-static
11375 build_old_libs=`case $build_libtool_libs in yes) echo no;; *) echo yes;; esac`
11376 # ### END LIBTOOL TAG CONFIG: disable-static
11379 # mode:shell-script