2 ## DO NOT EDIT - This file generated from ./build-aux/ltmain.in
3 ## by inline-source v2014-01-03.01
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-2015 Free Software Foundation, Inc.
10 # This is free software; see the source for copying conditions. There is NO
11 # warranty; not even for MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
13 # GNU Libtool is free software; you can redistribute it and/or modify
14 # it under the terms of the GNU General Public License as published by
15 # the Free Software Foundation; either version 2 of the License, or
16 # (at your option) any later version.
18 # As a special exception to the GNU General Public License,
19 # if you distribute this file as part of a program or library that
20 # is built using GNU Libtool, you may include this file under the
21 # same distribution terms that you use for the rest of that program.
23 # GNU Libtool is distributed in the hope that it will be useful, but
24 # WITHOUT ANY WARRANTY; without even the implied warranty of
25 # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
26 # General Public License for more details.
28 # You should have received a copy of the GNU General Public License
29 # along with this program. If not, see <http://www.gnu.org/licenses/>.
34 VERSION="2.4.6 Debian-2.4.6-14"
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=2015-01-20.17; # UTC
69 # General shell script boiler plate, and helper functions.
70 # Written by Gary V. Vaughan, 2004
72 # Copyright (C) 2004-2015 Free Software Foundation, Inc.
73 # This is free software; see the source for copying conditions. There is NO
74 # warranty; not even for MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
76 # This program is free software; you can redistribute it and/or modify
77 # it under the terms of the GNU General Public License as published by
78 # the Free Software Foundation; either version 3 of the License, or
79 # (at your option) any later version.
81 # As a special exception to the GNU General Public License, if you distribute
82 # this file as part of a program or library that is built using GNU Libtool,
83 # you may include this file under the same distribution terms that you use
84 # for the rest of that program.
86 # This program is distributed in the hope that it will be useful,
87 # but WITHOUT ANY WARRANTY; without even the implied warranty of
88 # MERCHANTABILITY or FITNES FOR A PARTICULAR PURPOSE. See the GNU
89 # General Public License for more details.
91 # You should have received a copy of the GNU General Public License
92 # along with this program. If not, see <http://www.gnu.org/licenses/>.
94 # Please report bugs or propose patches to gary@gnu.org.
101 # Evaluate this file near the top of your script to gain access to
102 # the functions and variables defined here:
104 # . `echo "$0" | ${SED-sed} 's|[^/]*$||'`/build-aux/funclib.sh
106 # If you need to override any of the default environment variable
107 # settings, do that before evaluating this file.
110 ## -------------------- ##
111 ## Shell normalisation. ##
112 ## -------------------- ##
114 # Some shells need a little help to be as Bourne compatible as possible.
115 # Before doing anything else, make sure all that help has been provided!
117 DUALCASE=1; export DUALCASE # for MKS sh
118 if test -n "${ZSH_VERSION+set}" && (emulate sh) >/dev/null 2>&1; then :
121 # Pre-4.2 versions of Zsh do word splitting on ${1+"$@"}, which
122 # is contrary to our usage. Disable this feature.
123 alias -g '${1+"$@"}'='"$@"'
126 case `(set -o) 2>/dev/null` in *posix*) set -o posix ;; esac
129 # NLS nuisances: We save the old values in case they are required later.
132 for _G_var in LANG LANGUAGE LC_ALL LC_CTYPE LC_COLLATE LC_MESSAGES
134 eval "if test set = \"\${$_G_var+set}\"; then
135 save_$_G_var=\$$_G_var
138 _G_user_locale=\"$_G_var=\\\$save_\$_G_var; \$_G_user_locale\"
139 _G_safe_locale=\"$_G_var=C; \$_G_safe_locale\"
144 (unset CDPATH) >/dev/null 2>&1 && unset CDPATH
146 # Make sure IFS has a sensible default
152 # There are apparently some retarded systems that use ';' as a PATH separator!
153 if test "${PATH_SEPARATOR+set}" != set; then
155 (PATH='/bin;/bin'; FPATH=$PATH; sh -c :) >/dev/null 2>&1 && {
156 (PATH='/bin:/bin'; FPATH=$PATH; sh -c :) >/dev/null 2>&1 ||
163 ## ------------------------- ##
164 ## Locate command utilities. ##
165 ## ------------------------- ##
168 # func_executable_p FILE
169 # ----------------------
170 # Check that FILE is an executable regular file.
173 test -f "$1" && test -x "$1"
177 # func_path_progs PROGS_LIST CHECK_FUNC [PATH]
178 # --------------------------------------------
179 # Search for either a program that responds to --version with output
180 # containing "GNU", or else returned by CHECK_FUNC otherwise, by
181 # trying all the directories in PATH with each of the elements of
184 # CHECK_FUNC should accept the path to a candidate program, and
185 # set $func_check_prog_result if it truncates its output less than
186 # $_G_path_prog_max characters.
194 _G_path_prog_found=false
195 _G_save_IFS=$IFS; IFS=${PATH_SEPARATOR-:}
196 for _G_dir in $_G_PATH; do
198 test -z "$_G_dir" && _G_dir=.
199 for _G_prog_name in $_G_progs_list; do
200 for _exeext in '' .EXE; do
201 _G_path_prog=$_G_dir/$_G_prog_name$_exeext
202 func_executable_p "$_G_path_prog" || continue
203 case `"$_G_path_prog" --version 2>&1` in
204 *GNU*) func_path_progs_result=$_G_path_prog _G_path_prog_found=: ;;
205 *) $_G_check_func $_G_path_prog
206 func_path_progs_result=$func_check_prog_result
209 $_G_path_prog_found && break 3
214 test -z "$func_path_progs_result" && {
215 echo "no acceptable sed could be found in \$PATH" >&2
221 # We want to be able to use the functions in this file before configure
222 # has figured out where the best binaries are kept, which means we have
223 # to search for them ourselves - except when the results are already set
224 # where we skip the searches.
226 # Unless the user overrides by setting SED, search the path for either GNU
227 # sed, or the sed that truncates its output the least.
229 _G_sed_script=s/aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa/bbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbb/
230 for _G_i in 1 2 3 4 5 6 7; do
231 _G_sed_script=$_G_sed_script$nl$_G_sed_script
233 echo "$_G_sed_script" 2>/dev/null | sed 99q >conftest.sed
236 func_check_prog_sed ()
241 printf 0123456789 >conftest.in
244 cat conftest.in conftest.in >conftest.tmp
245 mv conftest.tmp conftest.in
246 cp conftest.in conftest.nl
247 echo '' >> conftest.nl
248 "$_G_path_prog" -f conftest.sed <conftest.nl >conftest.out 2>/dev/null || break
249 diff conftest.out conftest.nl >/dev/null 2>&1 || break
250 _G_count=`expr $_G_count + 1`
251 if test "$_G_count" -gt "$_G_path_prog_max"; then
252 # Best one so far, save it but keep looking for a better one
253 func_check_prog_result=$_G_path_prog
254 _G_path_prog_max=$_G_count
256 # 10*(2^10) chars as input seems more than enough
257 test 10 -lt "$_G_count" && break
259 rm -f conftest.in conftest.tmp conftest.nl conftest.out
262 func_path_progs "sed gsed" func_check_prog_sed $PATH:/usr/xpg4/bin
264 SED=$func_path_progs_result
268 # Unless the user overrides by setting GREP, search the path for either GNU
269 # grep, or the grep that truncates its output the least.
271 func_check_prog_grep ()
277 printf 0123456789 >conftest.in
280 cat conftest.in conftest.in >conftest.tmp
281 mv conftest.tmp conftest.in
282 cp conftest.in conftest.nl
283 echo 'GREP' >> conftest.nl
284 "$_G_path_prog" -e 'GREP$' -e '-(cannot match)-' <conftest.nl >conftest.out 2>/dev/null || break
285 diff conftest.out conftest.nl >/dev/null 2>&1 || break
286 _G_count=`expr $_G_count + 1`
287 if test "$_G_count" -gt "$_G_path_prog_max"; then
288 # Best one so far, save it but keep looking for a better one
289 func_check_prog_result=$_G_path_prog
290 _G_path_prog_max=$_G_count
292 # 10*(2^10) chars as input seems more than enough
293 test 10 -lt "$_G_count" && break
295 rm -f conftest.in conftest.tmp conftest.nl conftest.out
298 func_path_progs "grep ggrep" func_check_prog_grep $PATH:/usr/xpg4/bin
299 GREP=$func_path_progs_result
303 ## ------------------------------- ##
304 ## User overridable command paths. ##
305 ## ------------------------------- ##
307 # All uppercase variable names are used for environment variables. These
308 # variables can be overridden by the user before calling a script that
309 # uses them if a suitable command of that name is not already available
310 # in the command search PATH.
313 : ${ECHO="printf %s\n"}
314 : ${EGREP="$GREP -E"}
315 : ${FGREP="$GREP -F"}
321 : ${SHELL="${CONFIG_SHELL-/bin/sh}"}
324 ## -------------------- ##
325 ## Useful sed snippets. ##
326 ## -------------------- ##
328 sed_dirname='s|/[^/]*$||'
329 sed_basename='s|^.*/||'
331 # Sed substitution that helps us do robust quoting. It backslashifies
332 # metacharacters that are still active within double-quoted strings.
333 sed_quote_subst='s|\([`"$\\]\)|\\\1|g'
335 # Same as above, but do not quote variable references.
336 sed_double_quote_subst='s/\(["`\\]\)/\\\1/g'
338 # Sed substitution that turns a string into a regex matching for the
340 sed_make_literal_regex='s|[].[^$\\*\/]|\\&|g'
342 # Sed substitution that converts a w32 file name or path
343 # that contains forward slashes, into one that contains
344 # (escaped) backslashes. A very naive implementation.
345 sed_naive_backslashify='s|\\\\*|\\|g;s|/|\\|g;s|\\|\\\\|g'
347 # Re-'\' parameter expansions in output of sed_double_quote_subst that
348 # were '\'-ed in input to the same. If an odd number of '\' preceded a
349 # '$' in input to sed_double_quote_subst, that '$' was protected from
350 # expansion. Since each input '\' is now two '\'s, look for any number
351 # of runs of four '\'s followed by two '\'s and then a '$'. '\' that '$'.
356 sed_double_backslash="\
359 s/^$_G_bs2$_G_dollar/$_G_bs&/
360 s/\\([^$_G_bs]\\)$_G_bs2$_G_dollar/\\1$_G_bs2$_G_bs$_G_dollar/g
364 ## ----------------- ##
365 ## Global variables. ##
366 ## ----------------- ##
368 # Except for the global variables explicitly listed below, the following
369 # functions in the '^func_' namespace, and the '^require_' namespace
370 # variables initialised in the 'Resource management' section, sourcing
371 # this file will not pollute your global namespace with anything
372 # else. There's no portable way to scope variables in Bourne shell
373 # though, so actually running these functions will sometimes place
374 # results into a variable named after the function, and often use
375 # temporary variables in the '^_G_' namespace. If you are careful to
376 # avoid using those namespaces casually in your sourcing script, things
377 # should continue to work as you expect. And, of course, you can freely
378 # overwrite any of the functions or variables defined here before
379 # calling anything to customize them.
383 EXIT_MISMATCH=63 # $? = 63 is used to indicate version mismatch to missing.
384 EXIT_SKIP=77 # $? = 77 is used to indicate a skipped test to automake.
386 # Allow overriding, eg assuming that you follow the convention of
387 # putting '$debug_cmd' at the start of all your functions, you can get
388 # bash to show function call trace with:
390 # debug_cmd='echo "${FUNCNAME[0]} $*" >&2' bash your-script-name
391 debug_cmd=${debug_cmd-":"}
394 # By convention, finish your script with:
398 # so that you can set exit_status to non-zero if you want to indicate
399 # something went wrong during execution without actually bailing out at
400 # the point of failure.
401 exit_status=$EXIT_SUCCESS
403 # Work around backward compatibility issue on IRIX 6.5. On IRIX 6.4+, sh
404 # is ksh but when the shell is invoked as "sh" and the current value of
405 # the _XPG environment variable is not equal to 1 (one), the special
406 # positional parameter $0, within a function call, is the name of the
410 # The name of this program.
411 progname=`$ECHO "$progpath" |$SED "$sed_basename"`
413 # Make sure we have an absolute progpath for reexecution:
415 [\\/]*|[A-Za-z]:\\*) ;;
417 progdir=`$ECHO "$progpath" |$SED "$sed_dirname"`
418 progdir=`cd "$progdir" && pwd`
419 progpath=$progdir/$progname
423 IFS=${PATH_SEPARATOR-:}
424 for progdir in $PATH; do
426 test -x "$progdir/$progname" && break
429 test -n "$progdir" || progdir=`pwd`
430 progpath=$progdir/$progname
435 ## ----------------- ##
436 ## Standard options. ##
437 ## ----------------- ##
439 # The following options affect the operation of the functions defined
440 # below, and should be set appropriately depending on run-time para-
441 # meters passed on the command line.
447 # Categories 'all' and 'none' are always available. Append any others
448 # you will pass as the first argument to func_warning from your own
452 # By default, display warnings according to 'opt_warning_types'. Set
453 # 'warning_func' to ':' to elide all warnings, or func_fatal_error to
454 # treat the next displayed warning as a fatal error.
455 warning_func=func_warn_and_continue
457 # Set to 'all' to display all warnings, 'none' to suppress all
458 # warnings, or a space delimited list of some subset of
459 # 'warning_categories' to display only the listed warnings.
460 opt_warning_types=all
463 ## -------------------- ##
464 ## Resource management. ##
465 ## -------------------- ##
467 # This section contains definitions for functions that each ensure a
468 # particular resource (a file, or a non-empty configuration variable for
469 # example) is available, and if appropriate to extract default values
470 # from pertinent package files. Call them using their associated
471 # 'require_*' variable to ensure that they are executed, at most, once.
473 # It's entirely deliberate that calling these functions can set
474 # variables that don't obey the namespace limitations obeyed by the rest
475 # of this file, in order that that they be as useful as possible to
479 # require_term_colors
480 # -------------------
481 # Allow display of bold text on terminals that support it.
482 require_term_colors=func_require_term_colors
483 func_require_term_colors ()
488 # COLORTERM and USE_ANSI_COLORS environment variables take
489 # precedence, because most terminfo databases neglect to describe
490 # whether color sequences are supported.
491 test -n "${COLORTERM+set}" && : ${USE_ANSI_COLORS="1"}
493 if test 1 = "$USE_ANSI_COLORS"; then
494 # Standard ANSI escape sequences
496 tc_bold='
\e[1m'; tc_standout='
\e[7m'
497 tc_red='
\e[31m'; tc_green='
\e[32m'
498 tc_blue='
\e[34m'; tc_cyan='
\e[36m'
500 # Otherwise trust the terminfo database after all.
501 test -n "`tput sgr0 2>/dev/null`" && {
503 test -n "`tput bold 2>/dev/null`" && tc_bold=`tput bold`
505 test -n "`tput smso 2>/dev/null`" && tc_standout=`tput smso`
506 test -n "`tput setaf 1 2>/dev/null`" && tc_red=`tput setaf 1`
507 test -n "`tput setaf 2 2>/dev/null`" && tc_green=`tput setaf 2`
508 test -n "`tput setaf 4 2>/dev/null`" && tc_blue=`tput setaf 4`
509 test -n "`tput setaf 5 2>/dev/null`" && tc_cyan=`tput setaf 5`
514 require_term_colors=:
518 ## ----------------- ##
519 ## Function library. ##
520 ## ----------------- ##
522 # This section contains a variety of useful functions to call in your
523 # scripts. Take note of the portable wrappers for features provided by
524 # some modern shells, which will fall back to slower equivalents on
525 # less featureful shells.
528 # func_append VAR VALUE
529 # ---------------------
530 # Append VALUE onto the existing contents of VAR.
532 # We should try to minimise forks, especially on Windows where they are
533 # unreasonably slow, so skip the feature probes when bash or zsh are
535 if test set = "${BASH_VERSION+set}${ZSH_VERSION+set}"; then
536 : ${_G_HAVE_ARITH_OP="yes"}
537 : ${_G_HAVE_XSI_OPS="yes"}
538 # The += operator was introduced in bash 3.1
539 case $BASH_VERSION in
540 [12].* | 3.0 | 3.0*) ;;
542 : ${_G_HAVE_PLUSEQ_OP="yes"}
548 # Can be empty, in which case the shell is probed, "yes" if += is
549 # useable or anything else if it does not work.
550 test -z "$_G_HAVE_PLUSEQ_OP" \
551 && (eval 'x=a; x+=" b"; test "a b" = "$x"') 2>/dev/null \
552 && _G_HAVE_PLUSEQ_OP=yes
554 if test yes = "$_G_HAVE_PLUSEQ_OP"
556 # This is an XSI compatible shell, allowing a faster implementation...
564 # ...otherwise fall back to using expr, which is often a shell builtin.
574 # func_append_quoted VAR VALUE
575 # ----------------------------
576 # Quote VALUE and append to the end of shell variable VAR, separated
578 if test yes = "$_G_HAVE_PLUSEQ_OP"; then
579 eval 'func_append_quoted ()
583 func_quote_for_eval "$2"
584 eval "$1+=\\ \$func_quote_for_eval_result"
587 func_append_quoted ()
591 func_quote_for_eval "$2"
592 eval "$1=\$$1\\ \$func_quote_for_eval_result"
597 # func_append_uniq VAR VALUE
598 # --------------------------
599 # Append unique VALUE onto the existing contents of VAR, assuming
600 # entries are delimited by the first character of VALUE. For example:
602 # func_append_uniq options " --another-option option-argument"
604 # will only append to $options if " --another-option option-argument "
605 # is not already present somewhere in $options already (note spaces at
606 # each end implied by leading space in second argument).
611 eval _G_current_value='`$ECHO $'$1'`'
612 _G_delim=`expr "$2" : '\(.\)'`
614 case $_G_delim$_G_current_value$_G_delim in
616 *) func_append "$@" ;;
623 # Set func_arith_result to the result of evaluating TERMs.
624 test -z "$_G_HAVE_ARITH_OP" \
625 && (eval 'test 2 = $(( 1 + 1 ))') 2>/dev/null \
626 && _G_HAVE_ARITH_OP=yes
628 if test yes = "$_G_HAVE_ARITH_OP"; then
633 func_arith_result=$(( $* ))
640 func_arith_result=`expr "$@"`
647 # Set func_basename_result to FILE with everything up to and including
648 # the last / stripped.
649 if test yes = "$_G_HAVE_XSI_OPS"; then
650 # If this shell supports suffix pattern removal, then use it to avoid
651 # forking. Hide the definitions single quotes in case the shell chokes
652 # on unsupported syntax...
653 _b='func_basename_result=${1##*/}'
655 */*) func_dirname_result=${1%/*}$2 ;;
656 * ) func_dirname_result=$3 ;;
660 # ...otherwise fall back to using sed.
661 _b='func_basename_result=`$ECHO "$1" |$SED "$sed_basename"`'
662 _d='func_dirname_result=`$ECHO "$1" |$SED "$sed_dirname"`
663 if test "X$func_dirname_result" = "X$1"; then
664 func_dirname_result=$3
666 func_append func_dirname_result "$2"
670 eval 'func_basename ()
678 # func_dirname FILE APPEND NONDIR_REPLACEMENT
679 # -------------------------------------------
680 # Compute the dirname of FILE. If nonempty, add APPEND to the result,
681 # otherwise set result to NONDIR_REPLACEMENT.
682 eval 'func_dirname ()
690 # func_dirname_and_basename FILE APPEND NONDIR_REPLACEMENT
691 # --------------------------------------------------------
692 # Perform func_basename and func_dirname in a single function
694 # dirname: Compute the dirname of FILE. If nonempty,
695 # add APPEND to the result, otherwise set result
696 # to NONDIR_REPLACEMENT.
697 # value returned in "$func_dirname_result"
698 # basename: Compute filename of FILE.
699 # value retuned in "$func_basename_result"
700 # For efficiency, we do not delegate to the functions above but instead
701 # duplicate the functionality here.
702 eval 'func_dirname_and_basename ()
713 # Echo program name prefixed message.
722 for _G_line in $_G_message; do
724 $ECHO "$progname: $_G_line"
730 # func_echo_all ARG...
731 # --------------------
732 # Invoke $ECHO with all args, space-separated.
739 # func_echo_infix_1 INFIX ARG...
740 # ------------------------------
741 # Echo program name, followed by INFIX on the first line, with any
742 # additional lines not showing INFIX.
751 _G_prefix="$progname: $_G_infix: "
754 # Strip color escape sequences before counting printable length
755 for _G_tc in "$tc_reset" "$tc_bold" "$tc_standout" "$tc_red" "$tc_green" "$tc_blue" "$tc_cyan"
757 test -n "$_G_tc" && {
758 _G_esc_tc=`$ECHO "$_G_tc" | $SED "$sed_make_literal_regex"`
759 _G_indent=`$ECHO "$_G_indent" | $SED "s|$_G_esc_tc||g"`
762 _G_indent="$progname: "`echo "$_G_indent" | $SED 's|.| |g'`" " ## exclude from sc_prohibit_nested_quotes
764 func_echo_infix_1_IFS=$IFS
766 for _G_line in $_G_message; do
767 IFS=$func_echo_infix_1_IFS
768 $ECHO "$_G_prefix$tc_bold$_G_line$tc_reset" >&2
771 IFS=$func_echo_infix_1_IFS
777 # Echo program name prefixed message to standard error.
784 func_echo_infix_1 " $tc_standout${tc_red}error$tc_reset" "$*" >&2
788 # func_fatal_error ARG...
789 # -----------------------
790 # Echo program name prefixed message to standard error, and exit.
800 # func_grep EXPRESSION FILENAME
801 # -----------------------------
802 # Check whether EXPRESSION matches any line of FILENAME, without output.
807 $GREP "$1" "$2" >/dev/null 2>&1
813 # Set func_len_result to the length of STRING. STRING may not
814 # start with a hyphen.
815 test -z "$_G_HAVE_XSI_OPS" \
817 test 5aa/bb/cc = "${#x}${x%%/*}${x%/*}${x#*/}${x##*/}"') 2>/dev/null \
818 && _G_HAVE_XSI_OPS=yes
820 if test yes = "$_G_HAVE_XSI_OPS"; then
825 func_len_result=${#1}
832 func_len_result=`expr "$1" : ".*" 2>/dev/null || echo $max_cmd_len`
837 # func_mkdir_p DIRECTORY-PATH
838 # ---------------------------
839 # Make sure the entire path to DIRECTORY-PATH is available.
847 if test -n "$_G_directory_path" && test : != "$opt_dry_run"; then
849 # Protect directory names starting with '-'
850 case $_G_directory_path in
851 -*) _G_directory_path=./$_G_directory_path ;;
854 # While some portion of DIR does not yet exist...
855 while test ! -d "$_G_directory_path"; do
856 # ...make a list in topmost first order. Use a colon delimited
857 # list incase some portion of path contains whitespace.
858 _G_dir_list=$_G_directory_path:$_G_dir_list
860 # If the last portion added has no slash in it, the list is done
861 case $_G_directory_path in */*) ;; *) break ;; esac
863 # ...otherwise throw away the child directory and loop
864 _G_directory_path=`$ECHO "$_G_directory_path" | $SED -e "$sed_dirname"`
866 _G_dir_list=`$ECHO "$_G_dir_list" | $SED 's|:*$||'`
868 func_mkdir_p_IFS=$IFS; IFS=:
869 for _G_dir in $_G_dir_list; do
870 IFS=$func_mkdir_p_IFS
871 # mkdir can fail with a 'File exist' error if two processes
872 # try to create one of the directories concurrently. Don't
874 $MKDIR "$_G_dir" 2>/dev/null || :
876 IFS=$func_mkdir_p_IFS
878 # Bail out if we (or some other process) failed to create a directory.
879 test -d "$_G_directory_path" || \
880 func_fatal_error "Failed to create '$1'"
885 # func_mktempdir [BASENAME]
886 # -------------------------
887 # Make a temporary directory that won't clash with other running
888 # libtool processes, and avoids race conditions if possible. If
889 # given, BASENAME is the basename for that directory.
894 _G_template=${TMPDIR-/tmp}/${1-$progname}
896 if test : = "$opt_dry_run"; then
897 # Return a directory name, but don't create it in dry-run mode
898 _G_tmpdir=$_G_template-$$
901 # If mktemp works, use that first and foremost
902 _G_tmpdir=`mktemp -d "$_G_template-XXXXXXXX" 2>/dev/null`
904 if test ! -d "$_G_tmpdir"; then
905 # Failing that, at least try and use $RANDOM to avoid a race
906 _G_tmpdir=$_G_template-${RANDOM-0}$$
908 func_mktempdir_umask=`umask`
911 umask $func_mktempdir_umask
914 # If we're not in dry-run mode, bomb out on failure
915 test -d "$_G_tmpdir" || \
916 func_fatal_error "cannot create temporary directory '$_G_tmpdir'"
923 # func_normal_abspath PATH
924 # ------------------------
925 # Remove doubled-up and trailing slashes, "." path components,
926 # and cancel out any ".." path components in PATH after making
927 # it an absolute path.
928 func_normal_abspath ()
932 # These SED scripts presuppose an absolute path with a trailing slash.
933 _G_pathcar='s|^/\([^/]*\).*$|\1|'
934 _G_pathcdr='s|^/[^/]*||'
935 _G_removedotparts=':dotsl
939 _G_collapseslashes='s|/\{1,\}|/|g'
940 _G_finalslash='s|/*$|/|'
942 # Start from root dir and reassemble the path.
943 func_normal_abspath_result=
944 func_normal_abspath_tpath=$1
945 func_normal_abspath_altnamespace=
946 case $func_normal_abspath_tpath in
948 # Empty path, that just means $cwd.
949 func_stripname '' '/' "`pwd`"
950 func_normal_abspath_result=$func_stripname_result
953 # The next three entries are used to spot a run of precisely
954 # two leading slashes without using negated character classes;
955 # we take advantage of case's first-match behaviour.
957 # Unusual form of absolute path, do nothing.
960 # Not necessarily an ordinary path; POSIX reserves leading '//'
961 # and for example Cygwin uses it to access remote file shares
962 # over CIFS/SMB, so we conserve a leading double slash if found.
963 func_normal_abspath_altnamespace=/
966 # Absolute path, do nothing.
969 # Relative path, prepend $cwd.
970 func_normal_abspath_tpath=`pwd`/$func_normal_abspath_tpath
974 # Cancel out all the simple stuff to save iterations. We also want
975 # the path to end with a slash for ease of parsing, so make sure
976 # there is one (and only one) here.
977 func_normal_abspath_tpath=`$ECHO "$func_normal_abspath_tpath" | $SED \
978 -e "$_G_removedotparts" -e "$_G_collapseslashes" -e "$_G_finalslash"`
980 # Processed it all yet?
981 if test / = "$func_normal_abspath_tpath"; then
982 # If we ascended to the root using ".." the result may be empty now.
983 if test -z "$func_normal_abspath_result"; then
984 func_normal_abspath_result=/
988 func_normal_abspath_tcomponent=`$ECHO "$func_normal_abspath_tpath" | $SED \
990 func_normal_abspath_tpath=`$ECHO "$func_normal_abspath_tpath" | $SED \
992 # Figure out what to do with it
993 case $func_normal_abspath_tcomponent in
995 # Trailing empty path component, ignore it.
998 # Parent dir; strip last assembled component from result.
999 func_dirname "$func_normal_abspath_result"
1000 func_normal_abspath_result=$func_dirname_result
1003 # Actual path component, append it.
1004 func_append func_normal_abspath_result "/$func_normal_abspath_tcomponent"
1008 # Restore leading double-slash if one was found on entry.
1009 func_normal_abspath_result=$func_normal_abspath_altnamespace$func_normal_abspath_result
1013 # func_notquiet ARG...
1014 # --------------------
1015 # Echo program name prefixed message only when not in quiet mode.
1020 $opt_quiet || func_echo ${1+"$@"}
1022 # A bug in bash halts the script if the last line of a function
1023 # fails when set -e is in force, so we need another command to
1029 # func_relative_path SRCDIR DSTDIR
1030 # --------------------------------
1031 # Set func_relative_path_result to the relative path from SRCDIR to DSTDIR.
1032 func_relative_path ()
1036 func_relative_path_result=
1037 func_normal_abspath "$1"
1038 func_relative_path_tlibdir=$func_normal_abspath_result
1039 func_normal_abspath "$2"
1040 func_relative_path_tbindir=$func_normal_abspath_result
1042 # Ascend the tree starting from libdir
1044 # check if we have found a prefix of bindir
1045 case $func_relative_path_tbindir in
1046 $func_relative_path_tlibdir)
1047 # found an exact match
1048 func_relative_path_tcancelled=
1051 $func_relative_path_tlibdir*)
1052 # found a matching prefix
1053 func_stripname "$func_relative_path_tlibdir" '' "$func_relative_path_tbindir"
1054 func_relative_path_tcancelled=$func_stripname_result
1055 if test -z "$func_relative_path_result"; then
1056 func_relative_path_result=.
1061 func_dirname $func_relative_path_tlibdir
1062 func_relative_path_tlibdir=$func_dirname_result
1063 if test -z "$func_relative_path_tlibdir"; then
1064 # Have to descend all the way to the root!
1065 func_relative_path_result=../$func_relative_path_result
1066 func_relative_path_tcancelled=$func_relative_path_tbindir
1069 func_relative_path_result=../$func_relative_path_result
1074 # Now calculate path; take care to avoid doubling-up slashes.
1075 func_stripname '' '/' "$func_relative_path_result"
1076 func_relative_path_result=$func_stripname_result
1077 func_stripname '/' '/' "$func_relative_path_tcancelled"
1078 if test -n "$func_stripname_result"; then
1079 func_append func_relative_path_result "/$func_stripname_result"
1082 # Normalisation. If bindir is libdir, return '.' else relative path.
1083 if test -n "$func_relative_path_result"; then
1084 func_stripname './' '' "$func_relative_path_result"
1085 func_relative_path_result=$func_stripname_result
1088 test -n "$func_relative_path_result" || func_relative_path_result=.
1094 # func_quote_for_eval ARG...
1095 # --------------------------
1096 # Aesthetically quote ARGs to be evaled later.
1097 # This function returns two values:
1098 # i) func_quote_for_eval_result
1099 # double-quoted, suitable for a subsequent eval
1100 # ii) func_quote_for_eval_unquoted_result
1101 # has all characters that are still active within double
1102 # quotes backslashified.
1103 func_quote_for_eval ()
1107 func_quote_for_eval_unquoted_result=
1108 func_quote_for_eval_result=
1109 while test 0 -lt $#; do
1112 _G_unquoted_arg=`printf '%s\n' "$1" |$SED "$sed_quote_subst"` ;;
1114 _G_unquoted_arg=$1 ;;
1116 if test -n "$func_quote_for_eval_unquoted_result"; then
1117 func_append func_quote_for_eval_unquoted_result " $_G_unquoted_arg"
1119 func_append func_quote_for_eval_unquoted_result "$_G_unquoted_arg"
1122 case $_G_unquoted_arg in
1123 # Double-quote args containing shell metacharacters to delay
1124 # word splitting, command substitution and variable expansion
1125 # for a subsequent eval.
1126 # Many Bourne shells cannot handle close brackets correctly
1127 # in scan sets, so we specify it separately.
1128 *[\[\~\#\^\&\*\(\)\{\}\|\;\<\>\?\'\ \ ]*|*]*|"")
1129 _G_quoted_arg=\"$_G_unquoted_arg\"
1132 _G_quoted_arg=$_G_unquoted_arg
1136 if test -n "$func_quote_for_eval_result"; then
1137 func_append func_quote_for_eval_result " $_G_quoted_arg"
1139 func_append func_quote_for_eval_result "$_G_quoted_arg"
1146 # func_quote_for_expand ARG
1147 # -------------------------
1148 # Aesthetically quote ARG to be evaled later; same as above,
1149 # but do not quote variable references.
1150 func_quote_for_expand ()
1156 _G_arg=`$ECHO "$1" | $SED \
1157 -e "$sed_double_quote_subst" -e "$sed_double_backslash"` ;;
1163 # Double-quote args containing shell metacharacters to delay
1164 # word splitting and command substitution for a subsequent eval.
1165 # Many Bourne shells cannot handle close brackets correctly
1166 # in scan sets, so we specify it separately.
1167 *[\[\~\#\^\&\*\(\)\{\}\|\;\<\>\?\'\ \ ]*|*]*|"")
1172 func_quote_for_expand_result=$_G_arg
1176 # func_stripname PREFIX SUFFIX NAME
1177 # ---------------------------------
1178 # strip PREFIX and SUFFIX from NAME, and store in func_stripname_result.
1179 # PREFIX and SUFFIX must not contain globbing or regex special
1180 # characters, hashes, percent signs, but SUFFIX may contain a leading
1181 # dot (in which case that matches only a dot).
1182 if test yes = "$_G_HAVE_XSI_OPS"; then
1183 eval 'func_stripname ()
1187 # pdksh 5.2.14 does not do ${X%$Y} correctly if both X and Y are
1188 # positional parameters, so assign one to ordinary variable first.
1189 func_stripname_result=$3
1190 func_stripname_result=${func_stripname_result#"$1"}
1191 func_stripname_result=${func_stripname_result%"$2"}
1199 .*) func_stripname_result=`$ECHO "$3" | $SED -e "s%^$1%%" -e "s%\\\\$2\$%%"`;;
1200 *) func_stripname_result=`$ECHO "$3" | $SED -e "s%^$1%%" -e "s%$2\$%%"`;;
1206 # func_show_eval CMD [FAIL_EXP]
1207 # -----------------------------
1208 # Unless opt_quiet is true, then output CMD. Then, if opt_dryrun is
1209 # not true, evaluate CMD. If the evaluation of CMD fails, and FAIL_EXP
1210 # is given, then evaluate it.
1216 _G_fail_exp=${2-':'}
1218 func_quote_for_expand "$_G_cmd"
1219 eval "func_notquiet $func_quote_for_expand_result"
1224 if test 0 -ne "$_G_status"; then
1225 eval "(exit $_G_status); $_G_fail_exp"
1231 # func_show_eval_locale CMD [FAIL_EXP]
1232 # ------------------------------------
1233 # Unless opt_quiet is true, then output CMD. Then, if opt_dryrun is
1234 # not true, evaluate CMD. If the evaluation of CMD fails, and FAIL_EXP
1235 # is given, then evaluate it. Use the saved locale for evaluation.
1236 func_show_eval_locale ()
1241 _G_fail_exp=${2-':'}
1244 func_quote_for_expand "$_G_cmd"
1245 eval "func_echo $func_quote_for_expand_result"
1249 eval "$_G_user_locale
1252 eval "$_G_safe_locale"
1253 if test 0 -ne "$_G_status"; then
1254 eval "(exit $_G_status); $_G_fail_exp"
1262 # Turn $1 into a string suitable for a shell variable name.
1263 # Result is stored in $func_tr_sh_result. All characters
1264 # not in the set a-zA-Z0-9_ are replaced with '_'. Further,
1265 # if $1 begins with a digit, a '_' is prepended as well.
1271 [0-9]* | *[!a-zA-Z0-9_]*)
1272 func_tr_sh_result=`$ECHO "$1" | $SED -e 's/^\([0-9]\)/_\1/' -e 's/[^a-zA-Z0-9_]/_/g'`
1275 func_tr_sh_result=$1
1281 # func_verbose ARG...
1282 # -------------------
1283 # Echo program name prefixed message in verbose mode only.
1288 $opt_verbose && func_echo "$*"
1294 # func_warn_and_continue ARG...
1295 # -----------------------------
1296 # Echo program name prefixed warning message to standard error.
1297 func_warn_and_continue ()
1301 $require_term_colors
1303 func_echo_infix_1 "${tc_red}warning$tc_reset" "$*" >&2
1307 # func_warning CATEGORY ARG...
1308 # ----------------------------
1309 # Echo program name prefixed warning message to standard error. Warning
1310 # messages can be filtered according to CATEGORY, where this function
1311 # elides messages where CATEGORY is not listed in the global variable
1312 # 'opt_warning_types'.
1317 # CATEGORY must be in the warning_categories list!
1318 case " $warning_categories " in
1320 *) func_internal_error "invalid warning category '$1'" ;;
1326 case " $opt_warning_types " in
1327 *" $_G_category "*) $warning_func ${1+"$@"} ;;
1332 # func_sort_ver VER1 VER2
1333 # -----------------------
1334 # 'sort -V' is not generally available.
1335 # Note this deviates from the version comparison in automake
1336 # in that it treats 1.5 < 1.5.0, and treats 1.4.4a < 1.4-p3a
1337 # but this should suffice as we won't be specifying old
1338 # version formats or redundant trailing .0 in bootstrap.conf.
1339 # If we did want full compatibility then we should probably
1340 # use m4_version_compare from autoconf.
1345 printf '%s\n%s\n' "$1" "$2" \
1346 | 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
1349 # func_lt_ver PREV CURR
1350 # ---------------------
1351 # Return true if PREV and CURR are in the correct order according to
1352 # func_sort_ver, otherwise false. Use it like this:
1354 # func_lt_ver "$prev_ver" "$proposed_ver" || func_fatal_error "..."
1359 test "x$1" = x`func_sort_ver "$1" "$2" | $SED 1q`
1364 # mode: shell-script
1366 # eval: (add-hook 'before-save-hook 'time-stamp)
1367 # time-stamp-pattern: "10/scriptversion=%:y-%02m-%02d.%02H; # UTC"
1368 # time-stamp-time-zone: "UTC"
1372 # Set a version string for this script.
1373 scriptversion=2015-10-07.11; # UTC
1375 # A portable, pluggable option parser for Bourne shell.
1376 # Written by Gary V. Vaughan, 2010
1378 # Copyright (C) 2010-2015 Free Software Foundation, Inc.
1379 # This is free software; see the source for copying conditions. There is NO
1380 # warranty; not even for MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
1382 # This program is free software: you can redistribute it and/or modify
1383 # it under the terms of the GNU General Public License as published by
1384 # the Free Software Foundation, either version 3 of the License, or
1385 # (at your option) any later version.
1387 # This program is distributed in the hope that it will be useful,
1388 # but WITHOUT ANY WARRANTY; without even the implied warranty of
1389 # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
1390 # GNU General Public License for more details.
1392 # You should have received a copy of the GNU General Public License
1393 # along with this program. If not, see <http://www.gnu.org/licenses/>.
1395 # Please report bugs or propose patches to gary@gnu.org.
1402 # This file is a library for parsing options in your shell scripts along
1403 # with assorted other useful supporting features that you can make use
1406 # For the simplest scripts you might need only:
1409 # . relative/path/to/funclib.sh
1410 # . relative/path/to/options-parser
1412 # func_options ${1+"$@"}
1413 # eval set dummy "$func_options_result"; shift
1414 # ...rest of your script...
1416 # In order for the '--version' option to work, you will need to have a
1417 # suitably formatted comment like the one at the top of this file
1418 # starting with '# Written by ' and ending with '# warranty; '.
1420 # For '-h' and '--help' to work, you will also need a one line
1421 # description of your script's purpose in a comment directly above the
1422 # '# Written by ' line, like the one at the top of this file.
1424 # The default options also support '--debug', which will turn on shell
1425 # execution tracing (see the comment above debug_cmd below for another
1426 # use), and '--verbose' and the func_verbose function to allow your script
1427 # to display verbose messages only when your user has specified
1430 # After sourcing this file, you can plug processing for additional
1431 # options by amending the variables from the 'Configuration' section
1432 # below, and following the instructions in the 'Option parsing'
1433 # section further down.
1435 ## -------------- ##
1436 ## Configuration. ##
1437 ## -------------- ##
1439 # You should override these variables in your script after sourcing this
1440 # file so that they reflect the customisations you have added to the
1443 # The usage line for option parsing errors and the start of '-h' and
1444 # '--help' output messages. You can embed shell variables for delayed
1445 # expansion at the time the message is displayed, but you will need to
1446 # quote other shell meta-characters carefully to prevent them being
1447 # expanded when the contents are evaled.
1448 usage='$progpath [OPTION]...'
1450 # Short help message in response to '-h' and '--help'. Add to this or
1451 # override it after sourcing this library to reflect the full set of
1452 # options your script accepts.
1454 --debug enable verbose shell tracing
1455 -W, --warnings=CATEGORY
1456 report the warnings falling in CATEGORY [all]
1457 -v, --verbose verbosely report processing
1458 --version print version information and exit
1459 -h, --help print short or long help message and exit
1462 # Additional text appended to 'usage_message' in response to '--help'.
1464 Warning categories include:
1465 'all' show all warnings
1466 'none' turn off all the warnings
1467 'error' warnings are treated as fatal errors"
1469 # Help message printed before fatal option parsing errors.
1470 fatal_help="Try '\$progname --help' for more information."
1474 ## ------------------------- ##
1475 ## Hook function management. ##
1476 ## ------------------------- ##
1478 # This section contains functions for adding, removing, and running hooks
1479 # to the main code. A hook is just a named list of of function, that can
1480 # be run in order later on.
1482 # func_hookable FUNC_NAME
1483 # -----------------------
1484 # Declare that FUNC_NAME will run hooks added with
1485 # 'func_add_hook FUNC_NAME ...'.
1490 func_append hookable_fns " $1"
1494 # func_add_hook FUNC_NAME HOOK_FUNC
1495 # ---------------------------------
1496 # Request that FUNC_NAME call HOOK_FUNC before it returns. FUNC_NAME must
1497 # first have been declared "hookable" by a call to 'func_hookable'.
1502 case " $hookable_fns " in
1504 *) func_fatal_error "'$1' does not accept hook functions." ;;
1507 eval func_append ${1}_hooks '" $2"'
1511 # func_remove_hook FUNC_NAME HOOK_FUNC
1512 # ------------------------------------
1513 # Remove HOOK_FUNC from the list of functions called by FUNC_NAME.
1518 eval ${1}_hooks='`$ECHO "\$'$1'_hooks" |$SED "s| '$2'||"`'
1522 # func_run_hooks FUNC_NAME [ARG]...
1523 # ---------------------------------
1524 # Run all hook functions registered to FUNC_NAME.
1525 # It is assumed that the list of hook functions contains nothing more
1526 # than a whitespace-delimited list of legal shell function names, and
1527 # no effort is wasted trying to catch shell meta-characters or preserve
1533 _G_rc_run_hooks=false
1535 case " $hookable_fns " in
1537 *) func_fatal_error "'$1' does not support hook funcions.n" ;;
1540 eval _G_hook_fns=\$$1_hooks; shift
1542 for _G_hook in $_G_hook_fns; do
1543 if eval $_G_hook '"$@"'; then
1544 # store returned options list back into positional
1545 # parameters for next 'cmd' execution.
1546 eval _G_hook_result=\$${_G_hook}_result
1547 eval set dummy "$_G_hook_result"; shift
1552 $_G_rc_run_hooks && func_run_hooks_result=$_G_hook_result
1557 ## --------------- ##
1558 ## Option parsing. ##
1559 ## --------------- ##
1561 # In order to add your own option parsing hooks, you must accept the
1562 # full positional parameter list in your hook function, you may remove/edit
1563 # any options that you action, and then pass back the remaining unprocessed
1564 # options in '<hooked_function_name>_result', escaped suitably for
1565 # 'eval'. In this case you also must return $EXIT_SUCCESS to let the
1566 # hook's caller know that it should pay attention to
1567 # '<hooked_function_name>_result'. Returning $EXIT_FAILURE signalizes that
1568 # arguments are left untouched by the hook and therefore caller will ignore the
1573 # my_options_prep ()
1577 # # Extend the existing usage message.
1578 # usage_message=$usage_message'
1579 # -s, --silent don'\''t print informational messages
1581 # # No change in '$@' (ignored completely by this hook). There is
1582 # # no need to do the equivalent (but slower) action:
1583 # # func_quote_for_eval ${1+"$@"}
1584 # # my_options_prep_result=$func_quote_for_eval_result
1587 # func_add_hook func_options_prep my_options_prep
1590 # my_silent_option ()
1594 # args_changed=false
1596 # # Note that for efficiency, we parse as many options as we can
1597 # # recognise in a loop before passing the remainder back to the
1598 # # caller on the first unrecognised argument we encounter.
1599 # while test $# -gt 0; do
1602 # --silent|-s) opt_silent=:
1605 # # Separate non-argument short options:
1606 # -s*) func_split_short_opt "$_G_opt"
1607 # set dummy "$func_split_short_opt_name" \
1608 # "-$func_split_short_opt_arg" ${1+"$@"}
1612 # *) # Make sure the first unrecognised option "$_G_opt"
1613 # # is added back to "$@", we could need that later
1614 # # if $args_changed is true.
1615 # set dummy "$_G_opt" ${1+"$@"}; shift; break ;;
1619 # if $args_changed; then
1620 # func_quote_for_eval ${1+"$@"}
1621 # my_silent_option_result=$func_quote_for_eval_result
1626 # func_add_hook func_parse_options my_silent_option
1629 # my_option_validation ()
1633 # $opt_silent && $opt_verbose && func_fatal_help "\
1634 # '--silent' and '--verbose' options are mutually exclusive."
1638 # func_add_hook func_validate_options my_option_validation
1640 # You'll also need to manually amend $usage_message to reflect the extra
1641 # options you parse. It's preferable to append if you can, so that
1642 # multiple option parsing hooks can be added safely.
1645 # func_options_finish [ARG]...
1646 # ----------------------------
1647 # Finishing the option parse loop (call 'func_options' hooks ATM).
1648 func_options_finish ()
1652 _G_func_options_finish_exit=false
1653 if func_run_hooks func_options ${1+"$@"}; then
1654 func_options_finish_result=$func_run_hooks_result
1655 _G_func_options_finish_exit=:
1658 $_G_func_options_finish_exit
1662 # func_options [ARG]...
1663 # ---------------------
1664 # All the functions called inside func_options are hookable. See the
1665 # individual implementations for details.
1666 func_hookable func_options
1673 for my_func in options_prep parse_options validate_options options_finish
1675 if eval func_$my_func '${1+"$@"}'; then
1676 eval _G_res_var='$'"func_${my_func}_result"
1677 eval set dummy "$_G_res_var" ; shift
1682 # Save modified positional parameters for caller. As a top-level
1683 # options-parser function we always need to set the 'func_options_result'
1684 # variable (regardless the $_G_rc_options value).
1685 if $_G_rc_options; then
1686 func_options_result=$_G_res_var
1688 func_quote_for_eval ${1+"$@"}
1689 func_options_result=$func_quote_for_eval_result
1696 # func_options_prep [ARG]...
1697 # --------------------------
1698 # All initialisations required before starting the option parse loop.
1699 # Note that when calling hook functions, we pass through the list of
1700 # positional parameters. If a hook function modifies that list, and
1701 # needs to propagate that back to rest of this script, then the complete
1702 # modified list must be put in 'func_run_hooks_result' before
1703 # returning $EXIT_SUCCESS (otherwise $EXIT_FAILURE is returned).
1704 func_hookable func_options_prep
1705 func_options_prep ()
1713 _G_rc_options_prep=false
1714 if func_run_hooks func_options_prep ${1+"$@"}; then
1715 _G_rc_options_prep=:
1716 # save modified positional parameters for caller
1717 func_options_prep_result=$func_run_hooks_result
1724 # func_parse_options [ARG]...
1725 # ---------------------------
1726 # The main option parsing loop.
1727 func_hookable func_parse_options
1728 func_parse_options ()
1732 func_parse_options_result=
1734 _G_rc_parse_options=false
1735 # this just eases exit handling
1736 while test $# -gt 0; do
1737 # Defer to hook functions for initial option parsing, so they
1738 # get priority in the event of reusing an option name.
1739 if func_run_hooks func_parse_options ${1+"$@"}; then
1740 eval set dummy "$func_run_hooks_result"; shift
1741 _G_rc_parse_options=:
1744 # Break out of the loop if we already parsed every option.
1745 test $# -gt 0 || break
1747 _G_match_parse_options=:
1751 --debug|-x) debug_cmd='set -x'
1752 func_echo "enabling shell trace mode"
1756 --no-warnings|--no-warning|--no-warn)
1757 set dummy --warnings none ${1+"$@"}
1761 --warnings|--warning|-W)
1762 if test $# = 0 && func_missing_arg $_G_opt; then
1763 _G_rc_parse_options=:
1766 case " $warning_categories $1" in
1768 # trailing space prevents matching last $1 above
1769 func_append_uniq opt_warning_types " $1"
1772 opt_warning_types=$warning_categories
1775 opt_warning_types=none
1779 opt_warning_types=$warning_categories
1780 warning_func=func_fatal_error
1784 "unsupported warning category: '$1'"
1790 --verbose|-v) opt_verbose=: ;;
1791 --version) func_version ;;
1792 -\?|-h) func_usage ;;
1793 --help) func_help ;;
1795 # Separate optargs to long options (plugins may need this):
1796 --*=*) func_split_equals "$_G_opt"
1797 set dummy "$func_split_equals_lhs" \
1798 "$func_split_equals_rhs" ${1+"$@"}
1802 # Separate optargs to short options:
1804 func_split_short_opt "$_G_opt"
1805 set dummy "$func_split_short_opt_name" \
1806 "$func_split_short_opt_arg" ${1+"$@"}
1810 # Separate non-argument short options:
1812 func_split_short_opt "$_G_opt"
1813 set dummy "$func_split_short_opt_name" \
1814 "-$func_split_short_opt_arg" ${1+"$@"}
1818 --) _G_rc_parse_options=: ; break ;;
1819 -*) func_fatal_help "unrecognised option: '$_G_opt'" ;;
1820 *) set dummy "$_G_opt" ${1+"$@"}; shift
1821 _G_match_parse_options=false
1826 $_G_match_parse_options && _G_rc_parse_options=:
1830 if $_G_rc_parse_options; then
1831 # save modified positional parameters for caller
1832 func_quote_for_eval ${1+"$@"}
1833 func_parse_options_result=$func_quote_for_eval_result
1836 $_G_rc_parse_options
1840 # func_validate_options [ARG]...
1841 # ------------------------------
1842 # Perform any sanity checks on option settings and/or unconsumed
1844 func_hookable func_validate_options
1845 func_validate_options ()
1849 _G_rc_validate_options=false
1851 # Display all warnings if -W was not given.
1852 test -n "$opt_warning_types" || opt_warning_types=" $warning_categories"
1854 if func_run_hooks func_validate_options ${1+"$@"}; then
1855 # save modified positional parameters for caller
1856 func_validate_options_result=$func_run_hooks_result
1857 _G_rc_validate_options=:
1860 # Bail if the options were screwed!
1861 $exit_cmd $EXIT_FAILURE
1863 $_G_rc_validate_options
1868 ## ----------------- ##
1869 ## Helper functions. ##
1870 ## ----------------- ##
1872 # This section contains the helper functions used by the rest of the
1873 # hookable option parser framework in ascii-betical order.
1876 # func_fatal_help ARG...
1877 # ----------------------
1878 # Echo program name prefixed message to standard error, followed by
1879 # a help hint, and exit.
1884 eval \$ECHO \""Usage: $usage"\"
1885 eval \$ECHO \""$fatal_help"\"
1886 func_error ${1+"$@"}
1893 # Echo long help message to standard output and exit.
1899 $ECHO "$long_help_message"
1904 # func_missing_arg ARGNAME
1905 # ------------------------
1906 # Echo program name prefixed message to standard error and set global
1912 func_error "Missing argument for '$1'."
1917 # func_split_equals STRING
1918 # ------------------------
1919 # Set func_split_equals_lhs and func_split_equals_rhs shell variables after
1920 # splitting STRING at the '=' sign.
1921 test -z "$_G_HAVE_XSI_OPS" \
1923 test 5aa/bb/cc = "${#x}${x%%/*}${x%/*}${x#*/}${x##*/}"') 2>/dev/null \
1924 && _G_HAVE_XSI_OPS=yes
1926 if test yes = "$_G_HAVE_XSI_OPS"
1928 # This is an XSI compatible shell, allowing a faster implementation...
1929 eval 'func_split_equals ()
1933 func_split_equals_lhs=${1%%=*}
1934 func_split_equals_rhs=${1#*=}
1935 test "x$func_split_equals_lhs" = "x$1" \
1936 && func_split_equals_rhs=
1939 # ...otherwise fall back to using expr, which is often a shell builtin.
1940 func_split_equals ()
1944 func_split_equals_lhs=`expr "x$1" : 'x\([^=]*\)'`
1945 func_split_equals_rhs=
1946 test "x$func_split_equals_lhs" = "x$1" \
1947 || func_split_equals_rhs=`expr "x$1" : 'x[^=]*=\(.*\)$'`
1949 fi #func_split_equals
1952 # func_split_short_opt SHORTOPT
1953 # -----------------------------
1954 # Set func_split_short_opt_name and func_split_short_opt_arg shell
1955 # variables after splitting SHORTOPT after the 2nd character.
1956 if test yes = "$_G_HAVE_XSI_OPS"
1958 # This is an XSI compatible shell, allowing a faster implementation...
1959 eval 'func_split_short_opt ()
1963 func_split_short_opt_arg=${1#??}
1964 func_split_short_opt_name=${1%"$func_split_short_opt_arg"}
1967 # ...otherwise fall back to using expr, which is often a shell builtin.
1968 func_split_short_opt ()
1972 func_split_short_opt_name=`expr "x$1" : 'x-\(.\)'`
1973 func_split_short_opt_arg=`expr "x$1" : 'x-.\(.*\)$'`
1975 fi #func_split_short_opt
1980 # Echo short help message to standard output and exit.
1986 $ECHO "Run '$progname --help |${PAGER-more}' for full usage"
1991 # func_usage_message
1992 # ------------------
1993 # Echo short help message to standard output.
1994 func_usage_message ()
1998 eval \$ECHO \""Usage: $usage"\"
2005 /^Written by/q' < "$progpath"
2007 eval \$ECHO \""$usage_message"\"
2013 # Echo version message to standard output and exit.
2018 printf '%s\n' "$progname $scriptversion"
2028 /^# Written by /,/# warranty; / {
2031 s|\((C)\)[ 0-9,-]*[ ,-]\([1-9][0-9]* \)|\1 \2|
2038 /^warranty; /q' < "$progpath"
2045 # mode: shell-script
2047 # eval: (add-hook 'before-save-hook 'time-stamp)
2048 # time-stamp-pattern: "10/scriptversion=%:y-%02m-%02d.%02H; # UTC"
2049 # time-stamp-time-zone: "UTC"
2052 # Set a version string.
2053 scriptversion='(GNU libtool) 2.4.6'
2058 # Libtool also displays the current mode in messages, so override
2059 # funclib.sh func_echo with this custom definition.
2068 for _G_line in $_G_message; do
2070 $ECHO "$progname${opt_mode+: $opt_mode}: $_G_line"
2076 # func_warning ARG...
2077 # -------------------
2078 # Libtool warnings are not categorized, so override funclib.sh
2079 # func_warning with this simpler definition.
2084 $warning_func ${1+"$@"}
2088 ## ---------------- ##
2089 ## Options parsing. ##
2090 ## ---------------- ##
2092 # Hook in the functions to make sure our own options are parsed during
2093 # the option parsing loop.
2095 usage='$progpath [OPTION]... [MODE-ARG]...'
2097 # Short help message in response to '-h'.
2098 usage_message="Options:
2099 --config show all configuration variables
2100 --debug enable verbose shell tracing
2101 -n, --dry-run display commands without modifying any files
2102 --features display basic configuration information and exit
2103 --mode=MODE use operation mode MODE
2104 --no-warnings equivalent to '-Wnone'
2105 --preserve-dup-deps don't remove duplicate dependency libraries
2106 --quiet, --silent don't print informational messages
2107 --tag=TAG use configuration variables from tag TAG
2108 -v, --verbose print more informational messages than default
2109 --version print version information
2110 -W, --warnings=CATEGORY report the warnings falling in CATEGORY [all]
2111 -h, --help, --help-all print short, long, or detailed help message
2114 # Additional text appended to 'usage_message' in response to '--help'.
2120 $ECHO "$long_help_message
2122 MODE must be one of the following:
2124 clean remove files from the build directory
2125 compile compile a source file into a libtool object
2126 execute automatically set library path, then run a program
2127 finish complete the installation of libtool libraries
2128 install install libraries or executables
2129 link create a library or an executable
2130 uninstall remove libraries from an installed directory
2132 MODE-ARGS vary depending on the MODE. When passed as first option,
2133 '--mode=MODE' may be abbreviated as 'MODE' or a unique abbreviation of that.
2134 Try '$progname --help --mode=MODE' for a more detailed description of MODE.
2136 When reporting a bug, please describe a test case to reproduce it and
2137 include the following information:
2142 compiler flags: $LTCFLAGS
2143 linker: $LD (gnu? $with_gnu_ld)
2144 version: $progname $scriptversion Debian-2.4.6-14
2145 automake: `($AUTOMAKE --version) 2>/dev/null |$SED 1q`
2146 autoconf: `($AUTOCONF --version) 2>/dev/null |$SED 1q`
2148 Report bugs to <bug-libtool@gnu.org>.
2149 GNU libtool home page: <http://www.gnu.org/s/libtool/>.
2150 General help using GNU software: <http://www.gnu.org/gethelp/>."
2155 # func_lo2o OBJECT-NAME
2156 # ---------------------
2157 # Transform OBJECT-NAME from a '.lo' suffix to the platform specific
2160 lo2o=s/\\.lo\$/.$objext/
2161 o2lo=s/\\.$objext\$/.lo/
2163 if test yes = "$_G_HAVE_XSI_OPS"; then
2167 *.lo) func_lo2o_result=${1%.lo}.$objext ;;
2168 * ) func_lo2o_result=$1 ;;
2172 # func_xform LIBOBJ-OR-SOURCE
2173 # ---------------------------
2174 # Transform LIBOBJ-OR-SOURCE from a '.o' or '.c' (or otherwise)
2175 # suffix to a '.lo' libtool-object suffix.
2178 func_xform_result=${1%.*}.lo
2181 # ...otherwise fall back to using sed.
2184 func_lo2o_result=`$ECHO "$1" | $SED "$lo2o"`
2189 func_xform_result=`$ECHO "$1" | $SED 's|\.[^.]*$|.lo|'`
2194 # func_fatal_configuration ARG...
2195 # -------------------------------
2196 # Echo program name prefixed message to standard error, followed by
2197 # a configuration failure hint, and exit.
2198 func_fatal_configuration ()
2200 func__fatal_error ${1+"$@"} \
2201 "See the $PACKAGE documentation for more information." \
2202 "Fatal configuration error."
2208 # Display the configuration for all the tags in this script.
2211 re_begincf='^# ### BEGIN LIBTOOL'
2212 re_endcf='^# ### END LIBTOOL'
2214 # Default configuration.
2215 $SED "1,/$re_begincf CONFIG/d;/$re_endcf CONFIG/,\$d" < "$progpath"
2217 # Now print the configurations for the tags.
2218 for tagname in $taglist; do
2219 $SED -n "/$re_begincf TAG CONFIG: $tagname\$/,/$re_endcf TAG CONFIG: $tagname\$/p" < "$progpath"
2228 # Display the features supported by this script.
2232 if test yes = "$build_libtool_libs"; then
2233 echo "enable shared libraries"
2235 echo "disable shared libraries"
2237 if test yes = "$build_old_libs"; then
2238 echo "enable static libraries"
2240 echo "disable static libraries"
2247 # func_enable_tag TAGNAME
2248 # -----------------------
2249 # Verify that TAGNAME is valid, and either flag an error and exit, or
2250 # enable the TAGNAME tag. We also add TAGNAME to the global $taglist
2257 re_begincf="^# ### BEGIN LIBTOOL TAG CONFIG: $tagname\$"
2258 re_endcf="^# ### END LIBTOOL TAG CONFIG: $tagname\$"
2259 sed_extractcf=/$re_begincf/,/$re_endcf/p
2264 func_fatal_error "invalid tag name: $tagname"
2268 # Don't test for the "default" C tag, as we know it's
2269 # there but not specially marked.
2273 if $GREP "$re_begincf" "$progpath" >/dev/null 2>&1; then
2274 taglist="$taglist $tagname"
2276 # Evaluate the configuration. Be careful to quote the path
2277 # and the sed script, to avoid splitting on whitespace, but
2278 # also don't use non-portable quotes within backquotes within
2279 # quotes we have to do it in 2 steps:
2280 extractedcf=`$SED -n -e "$sed_extractcf" < "$progpath"`
2283 func_error "ignoring unknown tag $tagname"
2290 # func_check_version_match
2291 # ------------------------
2292 # Ensure that we are using m4 macros, and libtool script from the same
2293 # release of libtool.
2294 func_check_version_match ()
2296 if test "$package_revision" != "$macro_revision"; then
2297 if test "$VERSION" != "$macro_version"; then
2298 if test -z "$macro_version"; then
2300 $progname: Version mismatch error. This is $PACKAGE $VERSION, but the
2301 $progname: definition of this LT_INIT comes from an older release.
2302 $progname: You should recreate aclocal.m4 with macros from $PACKAGE $VERSION
2303 $progname: and run autoconf again.
2307 $progname: Version mismatch error. This is $PACKAGE $VERSION, but the
2308 $progname: definition of this LT_INIT comes from $PACKAGE $macro_version.
2309 $progname: You should recreate aclocal.m4 with macros from $PACKAGE $VERSION
2310 $progname: and run autoconf again.
2315 $progname: Version mismatch error. This is $PACKAGE $VERSION, revision $package_revision,
2316 $progname: but the definition of this LT_INIT comes from revision $macro_revision.
2317 $progname: You should recreate aclocal.m4 with macros from revision $package_revision
2318 $progname: of $PACKAGE $VERSION and run autoconf again.
2327 # libtool_options_prep [ARG]...
2328 # -----------------------------
2329 # Preparation for options parsed by libtool.
2330 libtool_options_prep ()
2340 opt_preserve_dup_deps=false
2346 _G_rc_lt_options_prep=:
2348 # Shorthand for --mode=foo, only valid as the first argument
2351 shift; set dummy --mode clean ${1+"$@"}; shift
2353 compile|compil|compi|comp|com|co|c)
2354 shift; set dummy --mode compile ${1+"$@"}; shift
2356 execute|execut|execu|exec|exe|ex|e)
2357 shift; set dummy --mode execute ${1+"$@"}; shift
2359 finish|finis|fini|fin|fi|f)
2360 shift; set dummy --mode finish ${1+"$@"}; shift
2362 install|instal|insta|inst|ins|in|i)
2363 shift; set dummy --mode install ${1+"$@"}; shift
2366 shift; set dummy --mode link ${1+"$@"}; shift
2368 uninstall|uninstal|uninsta|uninst|unins|unin|uni|un|u)
2369 shift; set dummy --mode uninstall ${1+"$@"}; shift
2372 _G_rc_lt_options_prep=false
2376 if $_G_rc_lt_options_prep; then
2377 # Pass back the list of options.
2378 func_quote_for_eval ${1+"$@"}
2379 libtool_options_prep_result=$func_quote_for_eval_result
2382 $_G_rc_lt_options_prep
2384 func_add_hook func_options_prep libtool_options_prep
2387 # libtool_parse_options [ARG]...
2388 # ---------------------------------
2389 # Provide handling for libtool specific options.
2390 libtool_parse_options ()
2394 _G_rc_lt_parse_options=false
2396 # Perform our own loop to consume as many options as possible in
2398 while test $# -gt 0; do
2399 _G_match_lt_parse_options=:
2403 --dry-run|--dryrun|-n)
2407 --config) func_config ;;
2410 opt_dlopen="${opt_dlopen+$opt_dlopen
2415 --preserve-dup-deps)
2416 opt_preserve_dup_deps=: ;;
2418 --features) func_features ;;
2420 --finish) set dummy --mode finish ${1+"$@"}; shift ;;
2422 --help) opt_help=: ;;
2424 --help-all) opt_help=': help-all' ;;
2426 --mode) test $# = 0 && func_missing_arg $_G_opt && break
2429 # Valid mode arguments:
2430 clean|compile|execute|finish|install|link|relink|uninstall) ;;
2432 # Catch anything else as an error
2433 *) func_error "invalid argument for $_G_opt"
2441 --no-silent|--no-quiet)
2443 func_append preserve_args " $_G_opt"
2446 --no-warnings|--no-warning|--no-warn)
2448 func_append preserve_args " $_G_opt"
2453 func_append preserve_args " $_G_opt"
2459 func_append preserve_args " $_G_opt"
2462 --tag) test $# = 0 && func_missing_arg $_G_opt && break
2464 func_append preserve_args " $_G_opt $1"
2465 func_enable_tag "$1"
2469 --verbose|-v) opt_quiet=false
2471 func_append preserve_args " $_G_opt"
2474 # An option not handled by this hook function:
2475 *) set dummy "$_G_opt" ${1+"$@"} ; shift
2476 _G_match_lt_parse_options=false
2480 $_G_match_lt_parse_options && _G_rc_lt_parse_options=:
2483 if $_G_rc_lt_parse_options; then
2484 # save modified positional parameters for caller
2485 func_quote_for_eval ${1+"$@"}
2486 libtool_parse_options_result=$func_quote_for_eval_result
2489 $_G_rc_lt_parse_options
2491 func_add_hook func_parse_options libtool_parse_options
2495 # libtool_validate_options [ARG]...
2496 # ---------------------------------
2497 # Perform any sanity checks on option settings and/or unconsumed
2499 libtool_validate_options ()
2501 # save first non-option argument
2502 if test 0 -lt $#; then
2508 test : = "$debug_cmd" || func_append preserve_args " --debug"
2511 # Solaris2 added to fix http://debbugs.gnu.org/cgi/bugreport.cgi?bug=16452
2512 # see also: http://gcc.gnu.org/bugzilla/show_bug.cgi?id=59788
2513 *cygwin* | *mingw* | *pw32* | *cegcc* | *solaris2* | *os2*)
2514 # don't eliminate duplications in $postdeps and $predeps
2515 opt_duplicate_compiler_generated_deps=:
2518 opt_duplicate_compiler_generated_deps=$opt_preserve_dup_deps
2523 # Sanity checks first:
2524 func_check_version_match
2526 test yes != "$build_libtool_libs" \
2527 && test yes != "$build_old_libs" \
2528 && func_fatal_configuration "not configured to build any kind of library"
2531 eval std_shrext=\"$shrext_cmds\"
2533 # Only execute mode is allowed to have -dlopen flags.
2534 if test -n "$opt_dlopen" && test execute != "$opt_mode"; then
2535 func_error "unrecognized option '-dlopen'"
2540 # Change the help message to a mode-specific one.
2542 help="Try '$progname --help --mode=$opt_mode' for more information."
2545 # Pass back the unparsed argument list
2546 func_quote_for_eval ${1+"$@"}
2547 libtool_validate_options_result=$func_quote_for_eval_result
2549 func_add_hook func_validate_options libtool_validate_options
2552 # Process options as early as possible so that --help and --version
2553 # can return quickly.
2554 func_options ${1+"$@"}
2555 eval set dummy "$func_options_result"; shift
2563 magic='%%%MAGIC variable%%%'
2564 magic_exe='%%%MAGIC EXE variable%%%'
2570 # If this variable is set in any of the actions, the command in it
2571 # will be execed at the end. This prevents here-documents from being
2572 # left over by shells.
2576 # A function that is used when there is no print builtin or printf.
2577 func_fallback_echo ()
2579 eval 'cat <<_LTECHO_EOF
2584 # func_generated_by_libtool
2585 # True iff stdin has been generated by Libtool. This function is only
2586 # a basic sanity check; it will hardly flush out determined imposters.
2587 func_generated_by_libtool_p ()
2589 $GREP "^# Generated by .*$PACKAGE" > /dev/null 2>&1
2593 # True iff FILE is a libtool '.la' library or '.lo' object file.
2594 # This function is only a basic sanity check; it will hardly flush out
2595 # determined imposters.
2599 $SED -e 4q "$1" 2>/dev/null | func_generated_by_libtool_p
2602 # func_lalib_unsafe_p file
2603 # True iff FILE is a libtool '.la' library or '.lo' object file.
2604 # This function implements the same check as func_lalib_p without
2605 # resorting to external programs. To this end, it redirects stdin and
2606 # closes it afterwards, without saving the original file descriptor.
2607 # As a safety measure, use it only where a negative result would be
2608 # fatal anyway. Works if 'file' does not exist.
2609 func_lalib_unsafe_p ()
2612 if test -f "$1" && test -r "$1" && exec 5<&0 <"$1"; then
2613 for lalib_p_l in 1 2 3 4
2616 case $lalib_p_line in
2617 \#\ Generated\ by\ *$PACKAGE* ) lalib_p=yes; break;;
2622 test yes = "$lalib_p"
2625 # func_ltwrapper_script_p file
2626 # True iff FILE is a libtool wrapper script
2627 # This function is only a basic sanity check; it will hardly flush out
2628 # determined imposters.
2629 func_ltwrapper_script_p ()
2632 $lt_truncate_bin < "$1" 2>/dev/null | func_generated_by_libtool_p
2635 # func_ltwrapper_executable_p file
2636 # True iff FILE is a libtool wrapper executable
2637 # This function is only a basic sanity check; it will hardly flush out
2638 # determined imposters.
2639 func_ltwrapper_executable_p ()
2641 func_ltwrapper_exec_suffix=
2644 *) func_ltwrapper_exec_suffix=.exe ;;
2646 $GREP "$magic_exe" "$1$func_ltwrapper_exec_suffix" >/dev/null 2>&1
2649 # func_ltwrapper_scriptname file
2650 # Assumes file is an ltwrapper_executable
2651 # uses $file to determine the appropriate filename for a
2652 # temporary ltwrapper_script.
2653 func_ltwrapper_scriptname ()
2655 func_dirname_and_basename "$1" "" "."
2656 func_stripname '' '.exe' "$func_basename_result"
2657 func_ltwrapper_scriptname_result=$func_dirname_result/$objdir/${func_stripname_result}_ltshwrapper
2660 # func_ltwrapper_p file
2661 # True iff FILE is a libtool wrapper script or wrapper executable
2662 # This function is only a basic sanity check; it will hardly flush out
2663 # determined imposters.
2666 func_ltwrapper_script_p "$1" || func_ltwrapper_executable_p "$1"
2670 # func_execute_cmds commands fail_cmd
2671 # Execute tilde-delimited COMMANDS.
2672 # If FAIL_CMD is given, eval that upon failure.
2673 # FAIL_CMD may read-access the current command in variable CMD!
2674 func_execute_cmds ()
2678 save_ifs=$IFS; IFS='~'
2683 func_show_eval "$cmd" "${2-:}"
2690 # Source FILE, adding directory component if necessary.
2691 # Note that it is not necessary on cygwin/mingw to append a dot to
2692 # FILE even if both FILE and FILE.exe exist: automatic-append-.exe
2693 # behavior happens only for exec(3), not for open(2)! Also, sourcing
2694 # 'FILE.' does not work on cygwin managed mounts.
2700 */* | *\\*) . "$1" ;;
2706 # func_resolve_sysroot PATH
2707 # Replace a leading = in PATH with a sysroot. Store the result into
2708 # func_resolve_sysroot_result
2709 func_resolve_sysroot ()
2711 func_resolve_sysroot_result=$1
2712 case $func_resolve_sysroot_result in
2714 func_stripname '=' '' "$func_resolve_sysroot_result"
2715 func_resolve_sysroot_result=$lt_sysroot$func_stripname_result
2720 # func_replace_sysroot PATH
2721 # If PATH begins with the sysroot, replace it with = and
2722 # store the result into func_replace_sysroot_result.
2723 func_replace_sysroot ()
2725 case $lt_sysroot:$1 in
2727 func_stripname "$lt_sysroot" '' "$1"
2728 func_replace_sysroot_result='='$func_stripname_result
2731 # Including no sysroot.
2732 func_replace_sysroot_result=$1
2737 # func_infer_tag arg
2738 # Infer tagged configuration to use if any are available and
2739 # if one wasn't chosen via the "--tag" command line option.
2740 # Only attempt this if the compiler in the base compile
2741 # command doesn't match the default compiler.
2742 # arg is usually of the form 'gcc ...'
2747 if test -n "$available_tags" && test -z "$tagname"; then
2750 func_append_quoted CC_quoted "$arg"
2752 CC_expanded=`func_echo_all $CC`
2753 CC_quoted_expanded=`func_echo_all $CC_quoted`
2755 # Blanks in the command may have been stripped by the calling shell,
2756 # but not from the CC environment variable when configure was run.
2757 " $CC "* | "$CC "* | " $CC_expanded "* | "$CC_expanded "* | \
2758 " $CC_quoted"* | "$CC_quoted "* | " $CC_quoted_expanded "* | "$CC_quoted_expanded "*) ;;
2759 # Blanks at the start of $base_compile will cause this to fail
2760 # if we don't check for them as well.
2762 for z in $available_tags; do
2763 if $GREP "^# ### BEGIN LIBTOOL TAG CONFIG: $z$" < "$progpath" > /dev/null; then
2764 # Evaluate the configuration.
2765 eval "`$SED -n -e '/^# ### BEGIN LIBTOOL TAG CONFIG: '$z'$/,/^# ### END LIBTOOL TAG CONFIG: '$z'$/p' < $progpath`"
2768 # Double-quote args containing other shell metacharacters.
2769 func_append_quoted CC_quoted "$arg"
2771 CC_expanded=`func_echo_all $CC`
2772 CC_quoted_expanded=`func_echo_all $CC_quoted`
2774 " $CC "* | "$CC "* | " $CC_expanded "* | "$CC_expanded "* | \
2775 " $CC_quoted"* | "$CC_quoted "* | " $CC_quoted_expanded "* | "$CC_quoted_expanded "*)
2776 # The compiler in the base compile command matches
2777 # the one in the tagged configuration.
2778 # Assume this is the tagged configuration we want.
2785 # If $tagname still isn't set, then no tagged configuration
2786 # was found and let the user know that the "--tag" command
2787 # line option must be used.
2788 if test -z "$tagname"; then
2789 func_echo "unable to infer tagged configuration"
2790 func_fatal_error "specify a tag with '--tag'"
2792 # func_verbose "using $tagname tagged configuration"
2801 # func_write_libtool_object output_name pic_name nonpic_name
2802 # Create a libtool object file (analogous to a ".la" file),
2803 # but don't create it if we're doing a dry run.
2804 func_write_libtool_object ()
2807 if test yes = "$build_libtool_libs"; then
2813 if test yes = "$build_old_libs"; then
2820 cat >${write_libobj}T <<EOF
2821 # $write_libobj - a libtool object file
2822 # Generated by $PROGRAM (GNU $PACKAGE) $VERSION
2824 # Please DO NOT delete this file!
2825 # It is necessary for linking the library.
2827 # Name of the PIC object.
2828 pic_object=$write_lobj
2830 # Name of the non-PIC object
2831 non_pic_object=$write_oldobj
2834 $MV "${write_libobj}T" "$write_libobj"
2839 ##################################################
2840 # FILE NAME AND PATH CONVERSION HELPER FUNCTIONS #
2841 ##################################################
2843 # func_convert_core_file_wine_to_w32 ARG
2844 # Helper function used by file name conversion functions when $build is *nix,
2845 # and $host is mingw, cygwin, or some other w32 environment. Relies on a
2846 # correctly configured wine environment available, with the winepath program
2847 # in $build's $PATH.
2849 # ARG is the $build file name to be converted to w32 format.
2850 # Result is available in $func_convert_core_file_wine_to_w32_result, and will
2851 # be empty on error (or when ARG is empty)
2852 func_convert_core_file_wine_to_w32 ()
2856 func_convert_core_file_wine_to_w32_result=$1
2857 if test -n "$1"; then
2858 # Unfortunately, winepath does not exit with a non-zero error code, so we
2859 # are forced to check the contents of stdout. On the other hand, if the
2860 # command is not found, the shell will set an exit code of 127 and print
2861 # *an error message* to stdout. So we must check for both error code of
2862 # zero AND non-empty stdout, which explains the odd construction:
2863 func_convert_core_file_wine_to_w32_tmp=`winepath -w "$1" 2>/dev/null`
2864 if test "$?" -eq 0 && test -n "$func_convert_core_file_wine_to_w32_tmp"; then
2865 func_convert_core_file_wine_to_w32_result=`$ECHO "$func_convert_core_file_wine_to_w32_tmp" |
2866 $SED -e "$sed_naive_backslashify"`
2868 func_convert_core_file_wine_to_w32_result=
2872 # end: func_convert_core_file_wine_to_w32
2875 # func_convert_core_path_wine_to_w32 ARG
2876 # Helper function used by path conversion functions when $build is *nix, and
2877 # $host is mingw, cygwin, or some other w32 environment. Relies on a correctly
2878 # configured wine environment available, with the winepath program in $build's
2879 # $PATH. Assumes ARG has no leading or trailing path separator characters.
2881 # ARG is path to be converted from $build format to win32.
2882 # Result is available in $func_convert_core_path_wine_to_w32_result.
2883 # Unconvertible file (directory) names in ARG are skipped; if no directory names
2884 # are convertible, then the result may be empty.
2885 func_convert_core_path_wine_to_w32 ()
2889 # unfortunately, winepath doesn't convert paths, only file names
2890 func_convert_core_path_wine_to_w32_result=
2891 if test -n "$1"; then
2894 for func_convert_core_path_wine_to_w32_f in $1; do
2896 func_convert_core_file_wine_to_w32 "$func_convert_core_path_wine_to_w32_f"
2897 if test -n "$func_convert_core_file_wine_to_w32_result"; then
2898 if test -z "$func_convert_core_path_wine_to_w32_result"; then
2899 func_convert_core_path_wine_to_w32_result=$func_convert_core_file_wine_to_w32_result
2901 func_append func_convert_core_path_wine_to_w32_result ";$func_convert_core_file_wine_to_w32_result"
2908 # end: func_convert_core_path_wine_to_w32
2911 # func_cygpath ARGS...
2912 # Wrapper around calling the cygpath program via LT_CYGPATH. This is used when
2913 # when (1) $build is *nix and Cygwin is hosted via a wine environment; or (2)
2914 # $build is MSYS and $host is Cygwin, or (3) $build is Cygwin. In case (1) or
2915 # (2), returns the Cygwin file name or path in func_cygpath_result (input
2916 # file name or path is assumed to be in w32 format, as previously converted
2917 # from $build's *nix or MSYS format). In case (3), returns the w32 file name
2918 # or path in func_cygpath_result (input file name or path is assumed to be in
2919 # Cygwin format). Returns an empty string on error.
2921 # ARGS are passed to cygpath, with the last one being the file name or path to
2924 # Specify the absolute *nix (or w32) name to cygpath in the LT_CYGPATH
2925 # environment variable; do not put it in $PATH.
2930 if test -n "$LT_CYGPATH" && test -f "$LT_CYGPATH"; then
2931 func_cygpath_result=`$LT_CYGPATH "$@" 2>/dev/null`
2932 if test "$?" -ne 0; then
2933 # on failure, ensure result is empty
2934 func_cygpath_result=
2937 func_cygpath_result=
2938 func_error "LT_CYGPATH is empty or specifies non-existent file: '$LT_CYGPATH'"
2944 # func_convert_core_msys_to_w32 ARG
2945 # Convert file name or path ARG from MSYS format to w32 format. Return
2946 # result in func_convert_core_msys_to_w32_result.
2947 func_convert_core_msys_to_w32 ()
2951 # awkward: cmd appends spaces to result
2952 func_convert_core_msys_to_w32_result=`( cmd //c echo "$1" ) 2>/dev/null |
2953 $SED -e 's/[ ]*$//' -e "$sed_naive_backslashify"`
2955 #end: func_convert_core_msys_to_w32
2958 # func_convert_file_check ARG1 ARG2
2959 # Verify that ARG1 (a file name in $build format) was converted to $host
2960 # format in ARG2. Otherwise, emit an error message, but continue (resetting
2961 # func_to_host_file_result to ARG1).
2962 func_convert_file_check ()
2966 if test -z "$2" && test -n "$1"; then
2967 func_error "Could not determine host file name corresponding to"
2969 func_error "Continuing, but uninstalled executables may not work."
2971 func_to_host_file_result=$1
2974 # end func_convert_file_check
2977 # func_convert_path_check FROM_PATHSEP TO_PATHSEP FROM_PATH TO_PATH
2978 # Verify that FROM_PATH (a path in $build format) was converted to $host
2979 # format in TO_PATH. Otherwise, emit an error message, but continue, resetting
2980 # func_to_host_file_result to a simplistic fallback value (see below).
2981 func_convert_path_check ()
2985 if test -z "$4" && test -n "$3"; then
2986 func_error "Could not determine the host path corresponding to"
2988 func_error "Continuing, but uninstalled executables may not work."
2989 # Fallback. This is a deliberately simplistic "conversion" and
2990 # should not be "improved". See libtool.info.
2991 if test "x$1" != "x$2"; then
2992 lt_replace_pathsep_chars="s|$1|$2|g"
2993 func_to_host_path_result=`echo "$3" |
2994 $SED -e "$lt_replace_pathsep_chars"`
2996 func_to_host_path_result=$3
3000 # end func_convert_path_check
3003 # func_convert_path_front_back_pathsep FRONTPAT BACKPAT REPL ORIG
3004 # Modifies func_to_host_path_result by prepending REPL if ORIG matches FRONTPAT
3005 # and appending REPL if ORIG matches BACKPAT.
3006 func_convert_path_front_back_pathsep ()
3011 $1 ) func_to_host_path_result=$3$func_to_host_path_result
3015 $2 ) func_append func_to_host_path_result "$3"
3019 # end func_convert_path_front_back_pathsep
3022 ##################################################
3023 # $build to $host FILE NAME CONVERSION FUNCTIONS #
3024 ##################################################
3025 # invoked via '$to_host_file_cmd ARG'
3027 # In each case, ARG is the path to be converted from $build to $host format.
3028 # Result will be available in $func_to_host_file_result.
3031 # func_to_host_file ARG
3032 # Converts the file name ARG from $build format to $host format. Return result
3033 # in func_to_host_file_result.
3034 func_to_host_file ()
3038 $to_host_file_cmd "$1"
3040 # end func_to_host_file
3043 # func_to_tool_file ARG LAZY
3044 # converts the file name ARG from $build format to toolchain format. Return
3045 # result in func_to_tool_file_result. If the conversion in use is listed
3046 # in (the comma separated) LAZY, no conversion takes place.
3047 func_to_tool_file ()
3052 *,"$to_tool_file_cmd",*)
3053 func_to_tool_file_result=$1
3056 $to_tool_file_cmd "$1"
3057 func_to_tool_file_result=$func_to_host_file_result
3061 # end func_to_tool_file
3064 # func_convert_file_noop ARG
3065 # Copy ARG to func_to_host_file_result.
3066 func_convert_file_noop ()
3068 func_to_host_file_result=$1
3070 # end func_convert_file_noop
3073 # func_convert_file_msys_to_w32 ARG
3074 # Convert file name ARG from (mingw) MSYS to (mingw) w32 format; automatic
3075 # conversion to w32 is not available inside the cwrapper. Returns result in
3076 # func_to_host_file_result.
3077 func_convert_file_msys_to_w32 ()
3081 func_to_host_file_result=$1
3082 if test -n "$1"; then
3083 func_convert_core_msys_to_w32 "$1"
3084 func_to_host_file_result=$func_convert_core_msys_to_w32_result
3086 func_convert_file_check "$1" "$func_to_host_file_result"
3088 # end func_convert_file_msys_to_w32
3091 # func_convert_file_cygwin_to_w32 ARG
3092 # Convert file name ARG from Cygwin to w32 format. Returns result in
3093 # func_to_host_file_result.
3094 func_convert_file_cygwin_to_w32 ()
3098 func_to_host_file_result=$1
3099 if test -n "$1"; then
3100 # because $build is cygwin, we call "the" cygpath in $PATH; no need to use
3101 # LT_CYGPATH in this case.
3102 func_to_host_file_result=`cygpath -m "$1"`
3104 func_convert_file_check "$1" "$func_to_host_file_result"
3106 # end func_convert_file_cygwin_to_w32
3109 # func_convert_file_nix_to_w32 ARG
3110 # Convert file name ARG from *nix to w32 format. Requires a wine environment
3111 # and a working winepath. Returns result in func_to_host_file_result.
3112 func_convert_file_nix_to_w32 ()
3116 func_to_host_file_result=$1
3117 if test -n "$1"; then
3118 func_convert_core_file_wine_to_w32 "$1"
3119 func_to_host_file_result=$func_convert_core_file_wine_to_w32_result
3121 func_convert_file_check "$1" "$func_to_host_file_result"
3123 # end func_convert_file_nix_to_w32
3126 # func_convert_file_msys_to_cygwin ARG
3127 # Convert file name ARG from MSYS to Cygwin format. Requires LT_CYGPATH set.
3128 # Returns result in func_to_host_file_result.
3129 func_convert_file_msys_to_cygwin ()
3133 func_to_host_file_result=$1
3134 if test -n "$1"; then
3135 func_convert_core_msys_to_w32 "$1"
3136 func_cygpath -u "$func_convert_core_msys_to_w32_result"
3137 func_to_host_file_result=$func_cygpath_result
3139 func_convert_file_check "$1" "$func_to_host_file_result"
3141 # end func_convert_file_msys_to_cygwin
3144 # func_convert_file_nix_to_cygwin ARG
3145 # Convert file name ARG from *nix to Cygwin format. Requires Cygwin installed
3146 # in a wine environment, working winepath, and LT_CYGPATH set. Returns result
3147 # in func_to_host_file_result.
3148 func_convert_file_nix_to_cygwin ()
3152 func_to_host_file_result=$1
3153 if test -n "$1"; then
3154 # convert from *nix to w32, then use cygpath to convert from w32 to cygwin.
3155 func_convert_core_file_wine_to_w32 "$1"
3156 func_cygpath -u "$func_convert_core_file_wine_to_w32_result"
3157 func_to_host_file_result=$func_cygpath_result
3159 func_convert_file_check "$1" "$func_to_host_file_result"
3161 # end func_convert_file_nix_to_cygwin
3164 #############################################
3165 # $build to $host PATH CONVERSION FUNCTIONS #
3166 #############################################
3167 # invoked via '$to_host_path_cmd ARG'
3169 # In each case, ARG is the path to be converted from $build to $host format.
3170 # The result will be available in $func_to_host_path_result.
3172 # Path separators are also converted from $build format to $host format. If
3173 # ARG begins or ends with a path separator character, it is preserved (but
3174 # converted to $host format) on output.
3176 # All path conversion functions are named using the following convention:
3177 # file name conversion function : func_convert_file_X_to_Y ()
3178 # path conversion function : func_convert_path_X_to_Y ()
3179 # where, for any given $build/$host combination the 'X_to_Y' value is the
3180 # same. If conversion functions are added for new $build/$host combinations,
3181 # the two new functions must follow this pattern, or func_init_to_host_path_cmd
3185 # func_init_to_host_path_cmd
3186 # Ensures that function "pointer" variable $to_host_path_cmd is set to the
3187 # appropriate value, based on the value of $to_host_file_cmd.
3189 func_init_to_host_path_cmd ()
3193 if test -z "$to_host_path_cmd"; then
3194 func_stripname 'func_convert_file_' '' "$to_host_file_cmd"
3195 to_host_path_cmd=func_convert_path_$func_stripname_result
3200 # func_to_host_path ARG
3201 # Converts the path ARG from $build format to $host format. Return result
3202 # in func_to_host_path_result.
3203 func_to_host_path ()
3207 func_init_to_host_path_cmd
3208 $to_host_path_cmd "$1"
3210 # end func_to_host_path
3213 # func_convert_path_noop ARG
3214 # Copy ARG to func_to_host_path_result.
3215 func_convert_path_noop ()
3217 func_to_host_path_result=$1
3219 # end func_convert_path_noop
3222 # func_convert_path_msys_to_w32 ARG
3223 # Convert path ARG from (mingw) MSYS to (mingw) w32 format; automatic
3224 # conversion to w32 is not available inside the cwrapper. Returns result in
3225 # func_to_host_path_result.
3226 func_convert_path_msys_to_w32 ()
3230 func_to_host_path_result=$1
3231 if test -n "$1"; then
3232 # Remove leading and trailing path separator characters from ARG. MSYS
3233 # behavior is inconsistent here; cygpath turns them into '.;' and ';.';
3234 # and winepath ignores them completely.
3235 func_stripname : : "$1"
3236 func_to_host_path_tmp1=$func_stripname_result
3237 func_convert_core_msys_to_w32 "$func_to_host_path_tmp1"
3238 func_to_host_path_result=$func_convert_core_msys_to_w32_result
3239 func_convert_path_check : ";" \
3240 "$func_to_host_path_tmp1" "$func_to_host_path_result"
3241 func_convert_path_front_back_pathsep ":*" "*:" ";" "$1"
3244 # end func_convert_path_msys_to_w32
3247 # func_convert_path_cygwin_to_w32 ARG
3248 # Convert path ARG from Cygwin to w32 format. Returns result in
3249 # func_to_host_file_result.
3250 func_convert_path_cygwin_to_w32 ()
3254 func_to_host_path_result=$1
3255 if test -n "$1"; then
3256 # See func_convert_path_msys_to_w32:
3257 func_stripname : : "$1"
3258 func_to_host_path_tmp1=$func_stripname_result
3259 func_to_host_path_result=`cygpath -m -p "$func_to_host_path_tmp1"`
3260 func_convert_path_check : ";" \
3261 "$func_to_host_path_tmp1" "$func_to_host_path_result"
3262 func_convert_path_front_back_pathsep ":*" "*:" ";" "$1"
3265 # end func_convert_path_cygwin_to_w32
3268 # func_convert_path_nix_to_w32 ARG
3269 # Convert path ARG from *nix to w32 format. Requires a wine environment and
3270 # a working winepath. Returns result in func_to_host_file_result.
3271 func_convert_path_nix_to_w32 ()
3275 func_to_host_path_result=$1
3276 if test -n "$1"; then
3277 # See func_convert_path_msys_to_w32:
3278 func_stripname : : "$1"
3279 func_to_host_path_tmp1=$func_stripname_result
3280 func_convert_core_path_wine_to_w32 "$func_to_host_path_tmp1"
3281 func_to_host_path_result=$func_convert_core_path_wine_to_w32_result
3282 func_convert_path_check : ";" \
3283 "$func_to_host_path_tmp1" "$func_to_host_path_result"
3284 func_convert_path_front_back_pathsep ":*" "*:" ";" "$1"
3287 # end func_convert_path_nix_to_w32
3290 # func_convert_path_msys_to_cygwin ARG
3291 # Convert path ARG from MSYS to Cygwin format. Requires LT_CYGPATH set.
3292 # Returns result in func_to_host_file_result.
3293 func_convert_path_msys_to_cygwin ()
3297 func_to_host_path_result=$1
3298 if test -n "$1"; then
3299 # See func_convert_path_msys_to_w32:
3300 func_stripname : : "$1"
3301 func_to_host_path_tmp1=$func_stripname_result
3302 func_convert_core_msys_to_w32 "$func_to_host_path_tmp1"
3303 func_cygpath -u -p "$func_convert_core_msys_to_w32_result"
3304 func_to_host_path_result=$func_cygpath_result
3305 func_convert_path_check : : \
3306 "$func_to_host_path_tmp1" "$func_to_host_path_result"
3307 func_convert_path_front_back_pathsep ":*" "*:" : "$1"
3310 # end func_convert_path_msys_to_cygwin
3313 # func_convert_path_nix_to_cygwin ARG
3314 # Convert path ARG from *nix to Cygwin format. Requires Cygwin installed in a
3315 # a wine environment, working winepath, and LT_CYGPATH set. Returns result in
3316 # func_to_host_file_result.
3317 func_convert_path_nix_to_cygwin ()
3321 func_to_host_path_result=$1
3322 if test -n "$1"; then
3323 # Remove leading and trailing path separator characters from
3324 # ARG. msys behavior is inconsistent here, cygpath turns them
3325 # into '.;' and ';.', and winepath ignores them completely.
3326 func_stripname : : "$1"
3327 func_to_host_path_tmp1=$func_stripname_result
3328 func_convert_core_path_wine_to_w32 "$func_to_host_path_tmp1"
3329 func_cygpath -u -p "$func_convert_core_path_wine_to_w32_result"
3330 func_to_host_path_result=$func_cygpath_result
3331 func_convert_path_check : : \
3332 "$func_to_host_path_tmp1" "$func_to_host_path_result"
3333 func_convert_path_front_back_pathsep ":*" "*:" : "$1"
3336 # end func_convert_path_nix_to_cygwin
3339 # func_dll_def_p FILE
3340 # True iff FILE is a Windows DLL '.def' file.
3341 # Keep in sync with _LT_DLL_DEF_P in libtool.m4
3346 func_dll_def_p_tmp=`$SED -n \
3348 -e '/^\(;.*\)*$/d' \
3349 -e 's/^\(EXPORTS\|LIBRARY\)\([ ].*\)*$/DEF/p' \
3352 test DEF = "$func_dll_def_p_tmp"
3356 # func_mode_compile arg...
3357 func_mode_compile ()
3361 # Get the compilation command and the source file.
3363 srcfile=$nonopt # always keep a non-empty value in "srcfile"
3375 # do not "continue". Instead, add this to base_compile
3387 # Accept any command-line options.
3390 test -n "$libobj" && \
3391 func_fatal_error "you cannot specify '-o' more than once"
3396 -pie | -fpie | -fPIE)
3397 func_append pie_flag " $arg"
3401 -shared | -static | -prefer-pic | -prefer-non-pic)
3402 func_append later " $arg"
3412 arg_mode=arg # the next one goes into the "base_compile" arg list
3413 continue # The current "srcfile" will either be retained or
3414 ;; # replaced later. I would guess that would be a bug.
3417 func_stripname '-Wc,' '' "$arg"
3418 args=$func_stripname_result
3420 save_ifs=$IFS; IFS=,
3421 for arg in $args; do
3423 func_append_quoted lastarg "$arg"
3426 func_stripname ' ' '' "$lastarg"
3427 lastarg=$func_stripname_result
3429 # Add the arguments to base_compile.
3430 func_append base_compile " $lastarg"
3435 # Accept the current argument as the source file.
3436 # The previous "srcfile" becomes the current argument.
3443 esac # case $arg_mode
3445 # Aesthetically quote the previous argument.
3446 func_append_quoted base_compile "$lastarg"
3451 func_fatal_error "you must specify an argument for -Xcompile"
3454 func_fatal_error "you must specify a target with '-o'"
3457 # Get the name of the library object.
3458 test -z "$libobj" && {
3459 func_basename "$srcfile"
3460 libobj=$func_basename_result
3465 # Recognize several different file suffixes.
3466 # If the user specifies -o file.o, it is replaced with file.lo
3469 *.ada | *.adb | *.ads | *.asm | \
3470 *.c++ | *.cc | *.ii | *.class | *.cpp | *.cxx | \
3471 *.[fF][09]? | *.for | *.java | *.go | *.obj | *.sx | *.cu | *.cup)
3472 func_xform "$libobj"
3473 libobj=$func_xform_result
3478 *.lo) func_lo2o "$libobj"; obj=$func_lo2o_result ;;
3480 func_fatal_error "cannot determine name of library object from '$libobj'"
3484 func_infer_tag $base_compile
3486 for arg in $later; do
3489 test yes = "$build_libtool_libs" \
3490 || func_fatal_configuration "cannot build a shared library"
3496 build_libtool_libs=no
3513 func_quote_for_eval "$libobj"
3514 test "X$libobj" != "X$func_quote_for_eval_result" \
3515 && $ECHO "X$libobj" | $GREP '[]~#^*{};<>?"'"'"' &()|`$[]' \
3516 && func_warning "libobj name '$libobj' may not contain shell special characters."
3517 func_dirname_and_basename "$obj" "/" ""
3518 objname=$func_basename_result
3519 xdir=$func_dirname_result
3520 lobj=$xdir$objdir/$objname
3522 test -z "$base_compile" && \
3523 func_fatal_help "you must specify a compilation command"
3525 # Delete any leftover library objects.
3526 if test yes = "$build_old_libs"; then
3527 removelist="$obj $lobj $libobj ${libobj}T"
3529 removelist="$lobj $libobj ${libobj}T"
3532 # On Cygwin there's no "real" PIC flag so we must build both object types
3534 cygwin* | mingw* | pw32* | os2* | cegcc*)
3538 if test no = "$pic_mode" && test pass_all != "$deplibs_check_method"; then
3539 # non-PIC code in shared libraries is not supported
3543 # Calculate the filename of the output object if compiler does
3544 # not support -o with -c
3545 if test no = "$compiler_c_o"; then
3546 output_obj=`$ECHO "$srcfile" | $SED 's%^.*/%%; s%\.[^.]*$%%'`.$objext
3547 lockfile=$output_obj.lock
3554 # Lock this critical section if it is needed
3555 # We use this script file to make the link, it avoids creating a new file
3556 if test yes = "$need_locks"; then
3557 until $opt_dry_run || ln "$progpath" "$lockfile" 2>/dev/null; do
3558 func_echo "Waiting for $lockfile to be removed"
3561 elif test warn = "$need_locks"; then
3562 if test -f "$lockfile"; then
3564 *** ERROR, $lockfile exists and contains:
3565 `cat $lockfile 2>/dev/null`
3567 This indicates that another process is trying to use the same
3568 temporary object file, and libtool could not work around it because
3569 your compiler does not support '-c' and '-o' together. If you
3570 repeat this compilation, it may succeed, by chance, but you had better
3571 avoid parallel builds (make -j) in this platform, or get a better
3574 $opt_dry_run || $RM $removelist
3577 func_append removelist " $output_obj"
3578 $ECHO "$srcfile" > "$lockfile"
3581 $opt_dry_run || $RM $removelist
3582 func_append removelist " $lockfile"
3583 trap '$opt_dry_run || $RM $removelist; exit $EXIT_FAILURE' 1 2 15
3585 func_to_tool_file "$srcfile" func_convert_file_msys_to_w32
3586 srcfile=$func_to_tool_file_result
3587 func_quote_for_eval "$srcfile"
3588 qsrcfile=$func_quote_for_eval_result
3590 # Only build a PIC object if we are building libtool libraries.
3591 if test yes = "$build_libtool_libs"; then
3592 # Without this assignment, base_compile gets emptied.
3593 fbsd_hideous_sh_bug=$base_compile
3595 if test no != "$pic_mode"; then
3596 command="$base_compile $qsrcfile $pic_flag"
3598 # Don't build PIC code
3599 command="$base_compile $qsrcfile"
3602 func_mkdir_p "$xdir$objdir"
3604 if test -z "$output_obj"; then
3605 # Place PIC objects in $objdir
3606 func_append command " -o $lobj"
3609 func_show_eval_locale "$command" \
3610 'test -n "$output_obj" && $RM $removelist; exit $EXIT_FAILURE'
3612 if test warn = "$need_locks" &&
3613 test "X`cat $lockfile 2>/dev/null`" != "X$srcfile"; then
3615 *** ERROR, $lockfile contains:
3616 `cat $lockfile 2>/dev/null`
3618 but it should contain:
3621 This indicates that another process is trying to use the same
3622 temporary object file, and libtool could not work around it because
3623 your compiler does not support '-c' and '-o' together. If you
3624 repeat this compilation, it may succeed, by chance, but you had better
3625 avoid parallel builds (make -j) in this platform, or get a better
3628 $opt_dry_run || $RM $removelist
3632 # Just move the object if needed, then go on to compile the next one
3633 if test -n "$output_obj" && test "X$output_obj" != "X$lobj"; then
3634 func_show_eval '$MV "$output_obj" "$lobj"' \
3635 'error=$?; $opt_dry_run || $RM $removelist; exit $error'
3638 # Allow error messages only from the first compilation.
3639 if test yes = "$suppress_opt"; then
3640 suppress_output=' >/dev/null 2>&1'
3644 # Only build a position-dependent object if we build old libraries.
3645 if test yes = "$build_old_libs"; then
3646 if test yes != "$pic_mode"; then
3647 # Don't build PIC code
3648 command="$base_compile $qsrcfile$pie_flag"
3650 command="$base_compile $qsrcfile $pic_flag"
3652 if test yes = "$compiler_c_o"; then
3653 func_append command " -o $obj"
3656 # Suppress compiler output if we already did a PIC compilation.
3657 func_append command "$suppress_output"
3658 func_show_eval_locale "$command" \
3659 '$opt_dry_run || $RM $removelist; exit $EXIT_FAILURE'
3661 if test warn = "$need_locks" &&
3662 test "X`cat $lockfile 2>/dev/null`" != "X$srcfile"; then
3664 *** ERROR, $lockfile contains:
3665 `cat $lockfile 2>/dev/null`
3667 but it should contain:
3670 This indicates that another process is trying to use the same
3671 temporary object file, and libtool could not work around it because
3672 your compiler does not support '-c' and '-o' together. If you
3673 repeat this compilation, it may succeed, by chance, but you had better
3674 avoid parallel builds (make -j) in this platform, or get a better
3677 $opt_dry_run || $RM $removelist
3681 # Just move the object if needed
3682 if test -n "$output_obj" && test "X$output_obj" != "X$obj"; then
3683 func_show_eval '$MV "$output_obj" "$obj"' \
3684 'error=$?; $opt_dry_run || $RM $removelist; exit $error'
3689 func_write_libtool_object "$libobj" "$objdir/$objname" "$objname"
3691 # Unlock the critical section if it was locked
3692 if test no != "$need_locks"; then
3693 removelist=$lockfile
3702 test compile = "$opt_mode" && func_mode_compile ${1+"$@"}
3707 # We need to display help for each of the modes.
3710 # Generic help is extracted from the usage comments
3711 # at the start of this file.
3717 "Usage: $progname [OPTION]... --mode=clean RM [RM-OPTION]... FILE...
3719 Remove files from the build directory.
3721 RM is the name of the program to use to delete files associated with each FILE
3722 (typically '/bin/rm'). RM-OPTIONS are options (such as '-f') to be passed
3725 If FILE is a libtool library, object or program, all the files associated
3726 with it are deleted. Otherwise, only FILE itself is deleted using RM."
3731 "Usage: $progname [OPTION]... --mode=compile COMPILE-COMMAND... SOURCEFILE
3733 Compile a source file into a libtool library object.
3735 This mode accepts the following additional options:
3737 -o OUTPUT-FILE set the output file name to OUTPUT-FILE
3738 -no-suppress do not suppress compiler output for multiple passes
3739 -prefer-pic try to build PIC objects only
3740 -prefer-non-pic try to build non-PIC objects only
3741 -shared do not build a '.o' file suitable for static linking
3742 -static only build a '.o' file suitable for static linking
3743 -Wc,FLAG pass FLAG directly to the compiler
3745 COMPILE-COMMAND is a command to be used in creating a 'standard' object file
3746 from the given SOURCEFILE.
3748 The output file name is determined by removing the directory component from
3749 SOURCEFILE, then substituting the C source code suffix '.c' with the
3750 library object suffix, '.lo'."
3755 "Usage: $progname [OPTION]... --mode=execute COMMAND [ARGS]...
3757 Automatically set library path, then run a program.
3759 This mode accepts the following additional options:
3761 -dlopen FILE add the directory containing FILE to the library path
3763 This mode sets the library path environment variable according to '-dlopen'
3766 If any of the ARGS are libtool executable wrappers, then they are translated
3767 into their corresponding uninstalled binary, and any of their required library
3768 directories are added to the library path.
3770 Then, COMMAND is executed, with ARGS as arguments."
3775 "Usage: $progname [OPTION]... --mode=finish [LIBDIR]...
3777 Complete the installation of libtool libraries.
3779 Each LIBDIR is a directory that contains libtool libraries.
3781 The commands that this mode executes may require superuser privileges. Use
3782 the '--dry-run' option if you just want to see what would be executed."
3787 "Usage: $progname [OPTION]... --mode=install INSTALL-COMMAND...
3789 Install executables or libraries.
3791 INSTALL-COMMAND is the installation command. The first component should be
3792 either the 'install' or 'cp' program.
3794 The following components of INSTALL-COMMAND are treated specially:
3796 -inst-prefix-dir PREFIX-DIR Use PREFIX-DIR as a staging area for installation
3798 The rest of the components are interpreted as arguments to that command (only
3799 BSD-compatible install options are recognized)."
3804 "Usage: $progname [OPTION]... --mode=link LINK-COMMAND...
3806 Link object files or libraries together to form another library, or to
3807 create an executable program.
3809 LINK-COMMAND is a command using the C compiler that you would use to create
3810 a program from several object files.
3812 The following components of LINK-COMMAND are treated specially:
3814 -all-static do not do any dynamic linking at all
3815 -avoid-version do not add a version suffix if possible
3816 -bindir BINDIR specify path to binaries directory (for systems where
3817 libraries must be found in the PATH setting at runtime)
3818 -dlopen FILE '-dlpreopen' FILE if it cannot be dlopened at runtime
3819 -dlpreopen FILE link in FILE and add its symbols to lt_preloaded_symbols
3820 -export-dynamic allow symbols from OUTPUT-FILE to be resolved with dlsym(3)
3821 -export-symbols SYMFILE
3822 try to export only the symbols listed in SYMFILE
3823 -export-symbols-regex REGEX
3824 try to export only the symbols matching REGEX
3825 -LLIBDIR search LIBDIR for required installed libraries
3826 -lNAME OUTPUT-FILE requires the installed library libNAME
3827 -module build a library that can dlopened
3828 -no-fast-install disable the fast-install mode
3829 -no-install link a not-installable executable
3830 -no-undefined declare that a library does not refer to external symbols
3831 -o OUTPUT-FILE create OUTPUT-FILE from the specified objects
3832 -objectlist FILE use a list of object files found in FILE to specify objects
3833 -os2dllname NAME force a short DLL name on OS/2 (no effect on other OSes)
3834 -precious-files-regex REGEX
3835 don't remove output files matching REGEX
3836 -release RELEASE specify package release information
3837 -rpath LIBDIR the created library will eventually be installed in LIBDIR
3838 -R[ ]LIBDIR add LIBDIR to the runtime path of programs and libraries
3839 -shared only do dynamic linking of libtool libraries
3840 -shrext SUFFIX override the standard shared library file extension
3841 -static do not do any dynamic linking of uninstalled libtool libraries
3842 -static-libtool-libs
3843 do not do any dynamic linking of libtool libraries
3844 -version-info CURRENT[:REVISION[:AGE]]
3845 specify library version info [each variable defaults to 0]
3846 -weak LIBNAME declare that the target provides the LIBNAME interface
3848 -Xcompiler FLAG pass linker-specific FLAG directly to the compiler
3850 -Xlinker FLAG pass linker-specific FLAG directly to the linker
3851 -XCClinker FLAG pass link-specific FLAG to the compiler driver (CC)
3853 All other options (arguments beginning with '-') are ignored.
3855 Every other argument is treated as a filename. Files ending in '.la' are
3856 treated as uninstalled libtool libraries, other files are standard or library
3859 If the OUTPUT-FILE ends in '.la', then a libtool library is created,
3860 only library objects ('.lo' files) may be specified, and '-rpath' is
3861 required, except when creating a convenience library.
3863 If OUTPUT-FILE ends in '.a' or '.lib', then a standard library is created
3864 using 'ar' and 'ranlib', or on Windows using 'lib'.
3866 If OUTPUT-FILE ends in '.lo' or '.$objext', then a reloadable object file
3867 is created, otherwise an executable program is created."
3872 "Usage: $progname [OPTION]... --mode=uninstall RM [RM-OPTION]... FILE...
3874 Remove libraries from an installation directory.
3876 RM is the name of the program to use to delete files associated with each FILE
3877 (typically '/bin/rm'). RM-OPTIONS are options (such as '-f') to be passed
3880 If FILE is a libtool library, all the files associated with it are deleted.
3881 Otherwise, only FILE itself is deleted using RM."
3885 func_fatal_help "invalid operation mode '$opt_mode'"
3890 $ECHO "Try '$progname --help' for more information about other modes."
3893 # Now that we've collected a possible --mode arg, show help if necessary
3895 if test : = "$opt_help"; then
3900 for opt_mode in compile link execute install finish uninstall clean; do
3903 } | $SED -n '1p; 2,$s/^Usage:/ or: /p'
3906 for opt_mode in compile link execute install finish uninstall clean; do
3912 /^When reporting/,/^Report/{
3917 /information about other modes/d
3918 /more detailed .*MODE/d
3919 s/^Usage:.*--mode=\([^ ]*\) .*/Description of \1 mode:/'
3925 # func_mode_execute arg...
3926 func_mode_execute ()
3930 # The first argument is the command name.
3933 func_fatal_help "you must specify a COMMAND"
3935 # Handle -dlopen flags immediately.
3936 for file in $opt_dlopen; do
3938 || func_fatal_help "'$file' is not a file"
3943 func_resolve_sysroot "$file"
3944 file=$func_resolve_sysroot_result
3946 # Check to see that this really is a libtool archive.
3947 func_lalib_unsafe_p "$file" \
3948 || func_fatal_help "'$lib' is not a valid libtool archive"
3950 # Read the libtool library.
3955 # Skip this library if it cannot be dlopened.
3956 if test -z "$dlname"; then
3957 # Warn if it was a shared library.
3958 test -n "$library_names" && \
3959 func_warning "'$file' was not linked with '-export-dynamic'"
3963 func_dirname "$file" "" "."
3964 dir=$func_dirname_result
3966 if test -f "$dir/$objdir/$dlname"; then
3967 func_append dir "/$objdir"
3969 if test ! -f "$dir/$dlname"; then
3970 func_fatal_error "cannot find '$dlname' in '$dir' or '$dir/$objdir'"
3976 # Just add the directory containing the .lo file.
3977 func_dirname "$file" "" "."
3978 dir=$func_dirname_result
3982 func_warning "'-dlopen' is ignored for non-libtool libraries and objects"
3987 # Get the absolute pathname.
3988 absdir=`cd "$dir" && pwd`
3989 test -n "$absdir" && dir=$absdir
3991 # Now add the directory to shlibpath_var.
3992 if eval "test -z \"\$$shlibpath_var\""; then
3993 eval "$shlibpath_var=\"\$dir\""
3995 eval "$shlibpath_var=\"\$dir:\$$shlibpath_var\""
3999 # This variable tells wrapper scripts just to set shlibpath_var
4000 # rather than running their programs.
4001 libtool_execute_magic=$magic
4003 # Check if any of the arguments is a wrapper script.
4008 -* | *.la | *.lo ) ;;
4010 # Do a test to see if this is really a libtool program.
4011 if func_ltwrapper_script_p "$file"; then
4013 # Transform arg to wrapped name.
4014 file=$progdir/$program
4015 elif func_ltwrapper_executable_p "$file"; then
4016 func_ltwrapper_scriptname "$file"
4017 func_source "$func_ltwrapper_scriptname_result"
4018 # Transform arg to wrapped name.
4019 file=$progdir/$program
4023 # Quote arguments (to preserve shell metacharacters).
4024 func_append_quoted args "$file"
4027 if $opt_dry_run; then
4028 # Display what would be done.
4029 if test -n "$shlibpath_var"; then
4030 eval "\$ECHO \"\$shlibpath_var=\$$shlibpath_var\""
4031 echo "export $shlibpath_var"
4036 if test -n "$shlibpath_var"; then
4037 # Export the shlibpath_var.
4038 eval "export $shlibpath_var"
4041 # Restore saved environment variables
4042 for lt_var in LANG LANGUAGE LC_ALL LC_CTYPE LC_COLLATE LC_MESSAGES
4044 eval "if test \"\${save_$lt_var+set}\" = set; then
4045 $lt_var=\$save_$lt_var; export $lt_var
4051 # Now prepare to actually exec the command.
4056 test execute = "$opt_mode" && func_mode_execute ${1+"$@"}
4059 # func_mode_finish arg...
4068 for opt in "$nonopt" ${1+"$@"}
4070 if test -d "$opt"; then
4071 func_append libdirs " $opt"
4073 elif test -f "$opt"; then
4074 if func_lalib_unsafe_p "$opt"; then
4075 func_append libs " $opt"
4077 func_warning "'$opt' is not a valid libtool archive"
4081 func_fatal_error "invalid argument '$opt'"
4085 if test -n "$libs"; then
4086 if test -n "$lt_sysroot"; then
4087 sysroot_regex=`$ECHO "$lt_sysroot" | $SED "$sed_make_literal_regex"`
4088 sysroot_cmd="s/\([ ']\)$sysroot_regex/\1/g;"
4093 # Remove sysroot references
4094 if $opt_dry_run; then
4095 for lib in $libs; do
4096 echo "removing references to $lt_sysroot and '=' prefixes from $lib"
4099 tmpdir=`func_mktempdir`
4100 for lib in $libs; do
4101 $SED -e "$sysroot_cmd s/\([ ']-[LR]\)=/\1/g; s/\([ ']\)=/\1/g" $lib \
4103 mv -f $tmpdir/tmp-la $lib
4109 if test -n "$finish_cmds$finish_eval" && test -n "$libdirs"; then
4110 for libdir in $libdirs; do
4111 if test -n "$finish_cmds"; then
4112 # Do each command in the finish commands.
4113 func_execute_cmds "$finish_cmds" 'admincmds="$admincmds
4116 if test -n "$finish_eval"; then
4117 # Do the single finish_eval.
4118 eval cmds=\"$finish_eval\"
4119 $opt_dry_run || eval "$cmds" || func_append admincmds "
4125 # Exit here if they wanted silent mode.
4126 $opt_quiet && exit $EXIT_SUCCESS
4128 if test -n "$finish_cmds$finish_eval" && test -n "$libdirs"; then
4129 echo "----------------------------------------------------------------------"
4130 echo "Libraries have been installed in:"
4131 for libdir in $libdirs; do
4135 echo "If you ever happen to want to link against installed libraries"
4136 echo "in a given directory, LIBDIR, you must either use libtool, and"
4137 echo "specify the full pathname of the library, or use the '-LLIBDIR'"
4138 echo "flag during linking and do at least one of the following:"
4139 if test -n "$shlibpath_var"; then
4140 echo " - add LIBDIR to the '$shlibpath_var' environment variable"
4141 echo " during execution"
4143 if test -n "$runpath_var"; then
4144 echo " - add LIBDIR to the '$runpath_var' environment variable"
4145 echo " during linking"
4147 if test -n "$hardcode_libdir_flag_spec"; then
4149 eval flag=\"$hardcode_libdir_flag_spec\"
4151 $ECHO " - use the '$flag' linker flag"
4153 if test -n "$admincmds"; then
4154 $ECHO " - have your system administrator run these commands:$admincmds"
4156 if test -f /etc/ld.so.conf; then
4157 echo " - have your system administrator add LIBDIR to '/etc/ld.so.conf'"
4161 echo "See any operating system documentation about shared libraries for"
4163 solaris2.[6789]|solaris2.1[0-9])
4164 echo "more information, such as the ld(1), crle(1) and ld.so(8) manual"
4168 echo "more information, such as the ld(1) and ld.so(8) manual pages."
4171 echo "----------------------------------------------------------------------"
4176 test finish = "$opt_mode" && func_mode_finish ${1+"$@"}
4179 # func_mode_install arg...
4180 func_mode_install ()
4184 # There may be an optional sh(1) argument at the beginning of
4185 # install_prog (especially on Windows NT).
4186 if test "$SHELL" = "$nonopt" || test /bin/sh = "$nonopt" ||
4187 # Allow the use of GNU shtool's install command.
4188 case $nonopt in *shtool*) :;; *) false;; esac
4190 # Aesthetically quote it.
4191 func_quote_for_eval "$nonopt"
4192 install_prog="$func_quote_for_eval_result "
4200 # The real first argument should be the name of the installation program.
4201 # Aesthetically quote it.
4202 func_quote_for_eval "$arg"
4203 func_append install_prog "$func_quote_for_eval_result"
4204 install_shared_prog=$install_prog
4205 case " $install_prog " in
4206 *[\\\ /]cp\ *) install_cp=: ;;
4207 *) install_cp=false ;;
4210 # We need to accept at least all the BSD install flags.
4222 if test -n "$dest"; then
4223 func_append files " $dest"
4231 if $install_cp; then :; else
4245 # If the previous option needed an argument, then skip it.
4246 if test -n "$prev"; then
4247 if test X-m = "X$prev" && test -n "$install_override_mode"; then
4248 arg2=$install_override_mode
4259 # Aesthetically quote the argument.
4260 func_quote_for_eval "$arg"
4261 func_append install_prog " $func_quote_for_eval_result"
4262 if test -n "$arg2"; then
4263 func_quote_for_eval "$arg2"
4265 func_append install_shared_prog " $func_quote_for_eval_result"
4268 test -z "$install_prog" && \
4269 func_fatal_help "you must specify an install program"
4271 test -n "$prev" && \
4272 func_fatal_help "the '$prev' option requires an argument"
4274 if test -n "$install_override_mode" && $no_mode; then
4275 if $install_cp; then :; else
4276 func_quote_for_eval "$install_override_mode"
4277 func_append install_shared_prog " -m $func_quote_for_eval_result"
4281 if test -z "$files"; then
4282 if test -z "$dest"; then
4283 func_fatal_help "no file or destination specified"
4285 func_fatal_help "you must specify a destination"
4289 # Strip any trailing slash from the destination.
4290 func_stripname '' '/' "$dest"
4291 dest=$func_stripname_result
4293 # Check to see that the destination is a directory.
4294 test -d "$dest" && isdir=:
4299 func_dirname_and_basename "$dest" "" "."
4300 destdir=$func_dirname_result
4301 destname=$func_basename_result
4303 # Not a directory, so check to see that there is only one file specified.
4304 set dummy $files; shift
4305 test "$#" -gt 1 && \
4306 func_fatal_help "'$dest' is not a directory"
4309 [\\/]* | [A-Za-z]:[\\/]*) ;;
4311 for file in $files; do
4315 func_fatal_help "'$destdir' must be an absolute directory name"
4322 # This variable tells wrapper scripts just to set variables rather
4323 # than running their programs.
4324 libtool_install_magic=$magic
4329 for file in $files; do
4331 # Do each installation.
4334 # Do the static libraries later.
4335 func_append staticlibs " $file"
4339 func_resolve_sysroot "$file"
4340 file=$func_resolve_sysroot_result
4342 # Check to see that this really is a libtool archive.
4343 func_lalib_unsafe_p "$file" \
4344 || func_fatal_help "'$file' is not a valid libtool archive"
4351 # Add the libdir to current_libdirs if it is the destination.
4352 if test "X$destdir" = "X$libdir"; then
4353 case "$current_libdirs " in
4355 *) func_append current_libdirs " $libdir" ;;
4358 # Note the libdir as a future libdir.
4359 case "$future_libdirs " in
4361 *) func_append future_libdirs " $libdir" ;;
4365 func_dirname "$file" "/" ""
4366 dir=$func_dirname_result
4367 func_append dir "$objdir"
4369 if test -n "$relink_command"; then
4370 # Determine the prefix the user has applied to our future dir.
4371 inst_prefix_dir=`$ECHO "$destdir" | $SED -e "s%$libdir\$%%"`
4373 # Don't allow the user to place us outside of our expected
4374 # location b/c this prevents finding dependent libraries that
4375 # are installed to the same prefix.
4376 # At present, this check doesn't affect windows .dll's that
4377 # are installed into $libdir/../bin (currently, that works fine)
4378 # but it's something to keep an eye on.
4379 test "$inst_prefix_dir" = "$destdir" && \
4380 func_fatal_error "error: cannot install '$file' to a directory not ending in $libdir"
4382 if test -n "$inst_prefix_dir"; then
4383 # Stick the inst_prefix_dir data into the link command.
4384 relink_command=`$ECHO "$relink_command" | $SED "s%@inst_prefix_dir@%-inst-prefix-dir $inst_prefix_dir%"`
4386 relink_command=`$ECHO "$relink_command" | $SED "s%@inst_prefix_dir@%%"`
4389 func_warning "relinking '$file'"
4390 func_show_eval "$relink_command" \
4391 'func_fatal_error "error: relink '\''$file'\'' with the above command before installing it"'
4394 # See the names of the shared library.
4395 set dummy $library_names; shift
4396 if test -n "$1"; then
4401 test -n "$relink_command" && srcname=${realname}T
4403 # Install the shared library and build the symlinks.
4404 func_show_eval "$install_shared_prog $dir/$srcname $destdir/$realname" \
4408 cygwin* | mingw* | pw32* | cegcc*)
4423 if test -n "$tstripme" && test -n "$striplib"; then
4424 func_show_eval "$striplib $destdir/$realname" 'exit $?'
4427 if test "$#" -gt 0; then
4428 # Delete the old symlinks, and create new ones.
4429 # Try 'ln -sf' first, because the 'ln' binary might depend on
4430 # the symlink we replace! Solaris /bin/ln does not understand -f,
4431 # so we also need to try rm && ln -s.
4434 test "$linkname" != "$realname" \
4435 && func_show_eval "(cd $destdir && { $LN_S -f $realname $linkname || { $RM $linkname && $LN_S $realname $linkname; }; })"
4439 # Do each command in the postinstall commands.
4440 lib=$destdir/$realname
4441 func_execute_cmds "$postinstall_cmds" 'exit $?'
4444 # Install the pseudo-library for information purposes.
4445 func_basename "$file"
4446 name=$func_basename_result
4447 instname=$dir/${name}i
4448 func_show_eval "$install_prog $instname $destdir/$name" 'exit $?'
4450 # Maybe install the static library, too.
4451 test -n "$old_library" && func_append staticlibs " $dir/$old_library"
4455 # Install (i.e. copy) a libtool object.
4457 # Figure out destination file name, if it wasn't already specified.
4458 if test -n "$destname"; then
4459 destfile=$destdir/$destname
4461 func_basename "$file"
4462 destfile=$func_basename_result
4463 destfile=$destdir/$destfile
4466 # Deduce the name of the destination old-style object file.
4469 func_lo2o "$destfile"
4470 staticdest=$func_lo2o_result
4473 staticdest=$destfile
4477 func_fatal_help "cannot copy a libtool object to '$destfile'"
4481 # Install the libtool object if requested.
4482 test -n "$destfile" && \
4483 func_show_eval "$install_prog $file $destfile" 'exit $?'
4485 # Install the old object if enabled.
4486 if test yes = "$build_old_libs"; then
4487 # Deduce the name of the old-style object file.
4489 staticobj=$func_lo2o_result
4490 func_show_eval "$install_prog \$staticobj \$staticdest" 'exit $?'
4496 # Figure out destination file name, if it wasn't already specified.
4497 if test -n "$destname"; then
4498 destfile=$destdir/$destname
4500 func_basename "$file"
4501 destfile=$func_basename_result
4502 destfile=$destdir/$destfile
4505 # If the file is missing, and there is a .exe on the end, strip it
4506 # because it is most likely a libtool script we actually want to
4511 if test ! -f "$file"; then
4512 func_stripname '' '.exe' "$file"
4513 file=$func_stripname_result
4519 # Do a test to see if this is really a libtool program.
4522 if func_ltwrapper_executable_p "$file"; then
4523 func_ltwrapper_scriptname "$file"
4524 wrapper=$func_ltwrapper_scriptname_result
4526 func_stripname '' '.exe' "$file"
4527 wrapper=$func_stripname_result
4534 if func_ltwrapper_script_p "$wrapper"; then
4538 func_source "$wrapper"
4540 # Check the variables that should have been set.
4541 test -z "$generated_by_libtool_version" && \
4542 func_fatal_error "invalid libtool wrapper script '$wrapper'"
4545 for lib in $notinst_deplibs; do
4546 # Check to see that each library is installed.
4548 if test -f "$lib"; then
4551 libfile=$libdir/`$ECHO "$lib" | $SED 's%^.*/%%g'`
4552 if test -n "$libdir" && test ! -f "$libfile"; then
4553 func_warning "'$lib' has not been installed in '$libdir'"
4559 func_source "$wrapper"
4562 if test no = "$fast_install" && test -n "$relink_command"; then
4565 tmpdir=`func_mktempdir`
4566 func_basename "$file$stripped_ext"
4567 file=$func_basename_result
4568 outputname=$tmpdir/$file
4569 # Replace the output file specification.
4570 relink_command=`$ECHO "$relink_command" | $SED 's%@OUTPUT@%'"$outputname"'%g'`
4573 func_quote_for_expand "$relink_command"
4574 eval "func_echo $func_quote_for_expand_result"
4576 if eval "$relink_command"; then :
4578 func_error "error: relink '$file' with the above command before installing it"
4579 $opt_dry_run || ${RM}r "$tmpdir"
4584 func_warning "cannot relink '$file'"
4588 # Install the binary that we compiled earlier.
4589 file=`$ECHO "$file$stripped_ext" | $SED "s%\([^/]*\)$%$objdir/\1%"`
4593 # remove .exe since cygwin /usr/bin/install will append another
4595 case $install_prog,$host in
4596 */usr/bin/install*,*cygwin*)
4597 case $file:$destfile in
4602 destfile=$destfile.exe
4605 func_stripname '' '.exe' "$destfile"
4606 destfile=$func_stripname_result
4611 func_show_eval "$install_prog\$stripme \$file \$destfile" 'exit $?'
4612 $opt_dry_run || if test -n "$outputname"; then
4619 for file in $staticlibs; do
4620 func_basename "$file"
4621 name=$func_basename_result
4623 # Set up the ranlib parameters.
4624 oldlib=$destdir/$name
4625 func_to_tool_file "$oldlib" func_convert_file_msys_to_w32
4626 tool_oldlib=$func_to_tool_file_result
4628 func_show_eval "$install_prog \$file \$oldlib" 'exit $?'
4630 if test -n "$stripme" && test -n "$old_striplib"; then
4631 func_show_eval "$old_striplib $tool_oldlib" 'exit $?'
4634 # Do each command in the postinstall commands.
4635 func_execute_cmds "$old_postinstall_cmds" 'exit $?'
4638 test -n "$future_libdirs" && \
4639 func_warning "remember to run '$progname --finish$future_libdirs'"
4641 if test -n "$current_libdirs"; then
4642 # Maybe just do a dry run.
4643 $opt_dry_run && current_libdirs=" -n$current_libdirs"
4644 exec_cmd='$SHELL "$progpath" $preserve_args --finish$current_libdirs'
4650 test install = "$opt_mode" && func_mode_install ${1+"$@"}
4653 # func_generate_dlsyms outputname originator pic_p
4654 # Extract symbols from dlprefiles and create ${outputname}S.o with
4655 # a dlpreopen symbol table.
4656 func_generate_dlsyms ()
4663 my_prefix=`$ECHO "$my_originator" | $SED 's%[^a-zA-Z0-9]%_%g'`
4666 if test -n "$dlfiles$dlprefiles" || test no != "$dlself"; then
4667 if test -n "$NM" && test -n "$global_symbol_pipe"; then
4668 my_dlsyms=${my_outputname}S.c
4670 func_error "not configured to extract global symbols from dlpreopened files"
4674 if test -n "$my_dlsyms"; then
4678 # Discover the nlist of each of the dlfiles.
4679 nlist=$output_objdir/$my_outputname.nm
4681 func_show_eval "$RM $nlist ${nlist}S ${nlist}T"
4683 # Parse the name list into a source file.
4684 func_verbose "creating $output_objdir/$my_dlsyms"
4686 $opt_dry_run || $ECHO > "$output_objdir/$my_dlsyms" "\
4687 /* $my_dlsyms - symbol resolution table for '$my_outputname' dlsym emulation. */
4688 /* Generated by $PROGRAM (GNU $PACKAGE) $VERSION */
4694 #if defined __GNUC__ && (((__GNUC__ == 4) && (__GNUC_MINOR__ >= 4)) || (__GNUC__ > 4))
4695 #pragma GCC diagnostic ignored \"-Wstrict-prototypes\"
4698 /* Keep this code in sync between libtool.m4, ltmain, lt_system.h, and tests. */
4699 #if defined _WIN32 || defined __CYGWIN__ || defined _WIN32_WCE
4700 /* DATA imports from DLLs on WIN32 can't be const, because runtime
4701 relocations are performed -- see ld's documentation on pseudo-relocs. */
4702 # define LT_DLSYM_CONST
4703 #elif defined __osf__
4704 /* This system does not cope well with relocations in const data. */
4705 # define LT_DLSYM_CONST
4707 # define LT_DLSYM_CONST const
4710 #define STREQ(s1, s2) (strcmp ((s1), (s2)) == 0)
4712 /* External symbol declarations for the compiler. */\
4715 if test yes = "$dlself"; then
4716 func_verbose "generating symbol list for '$output'"
4718 $opt_dry_run || echo ': @PROGRAM@ ' > "$nlist"
4720 # Add our own program objects to the symbol list.
4721 progfiles=`$ECHO "$objs$old_deplibs" | $SP2NL | $SED "$lo2o" | $NL2SP`
4722 for progfile in $progfiles; do
4723 func_to_tool_file "$progfile" func_convert_file_msys_to_w32
4724 func_verbose "extracting global C symbols from '$func_to_tool_file_result'"
4725 $opt_dry_run || eval "$NM $func_to_tool_file_result | $global_symbol_pipe >> '$nlist'"
4728 if test -n "$exclude_expsyms"; then
4730 eval '$EGREP -v " ($exclude_expsyms)$" "$nlist" > "$nlist"T'
4731 eval '$MV "$nlist"T "$nlist"'
4735 if test -n "$export_symbols_regex"; then
4737 eval '$EGREP -e "$export_symbols_regex" "$nlist" > "$nlist"T'
4738 eval '$MV "$nlist"T "$nlist"'
4742 # Prepare the list of exported symbols
4743 if test -z "$export_symbols"; then
4744 export_symbols=$output_objdir/$outputname.exp
4747 eval "$SED -n -e '/^: @PROGRAM@ $/d' -e 's/^.* \(.*\)$/\1/p' "'< "$nlist" > "$export_symbols"'
4749 *cygwin* | *mingw* | *cegcc* )
4750 eval "echo EXPORTS "'> "$output_objdir/$outputname.def"'
4751 eval 'cat "$export_symbols" >> "$output_objdir/$outputname.def"'
4757 eval "$SED -e 's/\([].[*^$]\)/\\\\\1/g' -e 's/^/ /' -e 's/$/$/'"' < "$export_symbols" > "$output_objdir/$outputname.exp"'
4758 eval '$GREP -f "$output_objdir/$outputname.exp" < "$nlist" > "$nlist"T'
4759 eval '$MV "$nlist"T "$nlist"'
4761 *cygwin* | *mingw* | *cegcc* )
4762 eval "echo EXPORTS "'> "$output_objdir/$outputname.def"'
4763 eval 'cat "$nlist" >> "$output_objdir/$outputname.def"'
4770 for dlprefile in $dlprefiles; do
4771 func_verbose "extracting global C symbols from '$dlprefile'"
4772 func_basename "$dlprefile"
4773 name=$func_basename_result
4775 *cygwin* | *mingw* | *cegcc* )
4776 # if an import library, we need to obtain dlname
4777 if func_win32_import_lib_p "$dlprefile"; then
4778 func_tr_sh "$dlprefile"
4779 eval "curr_lafile=\$libfile_$func_tr_sh_result"
4780 dlprefile_dlbasename=
4781 if test -n "$curr_lafile" && func_lalib_p "$curr_lafile"; then
4782 # Use subshell, to avoid clobbering current variable values
4783 dlprefile_dlname=`source "$curr_lafile" && echo "$dlname"`
4784 if test -n "$dlprefile_dlname"; then
4785 func_basename "$dlprefile_dlname"
4786 dlprefile_dlbasename=$func_basename_result
4788 # no lafile. user explicitly requested -dlpreopen <import library>.
4789 $sharedlib_from_linklib_cmd "$dlprefile"
4790 dlprefile_dlbasename=$sharedlib_from_linklib_result
4794 if test -n "$dlprefile_dlbasename"; then
4795 eval '$ECHO ": $dlprefile_dlbasename" >> "$nlist"'
4797 func_warning "Could not compute DLL name from $name"
4798 eval '$ECHO ": $name " >> "$nlist"'
4800 func_to_tool_file "$dlprefile" func_convert_file_msys_to_w32
4801 eval "$NM \"$func_to_tool_file_result\" 2>/dev/null | $global_symbol_pipe |
4802 $SED -e '/I __imp/d' -e 's/I __nm_/D /;s/_nm__//' >> '$nlist'"
4804 else # not an import lib
4806 eval '$ECHO ": $name " >> "$nlist"'
4807 func_to_tool_file "$dlprefile" func_convert_file_msys_to_w32
4808 eval "$NM \"$func_to_tool_file_result\" 2>/dev/null | $global_symbol_pipe >> '$nlist'"
4814 eval '$ECHO ": $name " >> "$nlist"'
4815 func_to_tool_file "$dlprefile" func_convert_file_msys_to_w32
4816 eval "$NM \"$func_to_tool_file_result\" 2>/dev/null | $global_symbol_pipe >> '$nlist'"
4823 # Make sure we have at least an empty file.
4824 test -f "$nlist" || : > "$nlist"
4826 if test -n "$exclude_expsyms"; then
4827 $EGREP -v " ($exclude_expsyms)$" "$nlist" > "$nlist"T
4828 $MV "$nlist"T "$nlist"
4831 # Try sorting and uniquifying the output.
4832 if $GREP -v "^: " < "$nlist" |
4833 if sort -k 3 </dev/null >/dev/null 2>&1; then
4838 uniq > "$nlist"S; then
4841 $GREP -v "^: " < "$nlist" > "$nlist"S
4844 if test -f "$nlist"S; then
4845 eval "$global_symbol_to_cdecl"' < "$nlist"S >> "$output_objdir/$my_dlsyms"'
4847 echo '/* NONE */' >> "$output_objdir/$my_dlsyms"
4850 func_show_eval '$RM "${nlist}I"'
4851 if test -n "$global_symbol_to_import"; then
4852 eval "$global_symbol_to_import"' < "$nlist"S > "$nlist"I'
4855 echo >> "$output_objdir/$my_dlsyms" "\
4857 /* The mapping between symbol names and symbols. */
4862 extern LT_DLSYM_CONST lt_dlsymlist
4863 lt_${my_prefix}_LTX_preloaded_symbols[];\
4866 if test -s "$nlist"I; then
4867 echo >> "$output_objdir/$my_dlsyms" "\
4868 static void lt_syminit(void)
4870 LT_DLSYM_CONST lt_dlsymlist *symbol = lt_${my_prefix}_LTX_preloaded_symbols;
4871 for (; symbol->name; ++symbol)
4873 $SED 's/.*/ if (STREQ (symbol->name, \"&\")) symbol->address = (void *) \&&;/' < "$nlist"I >> "$output_objdir/$my_dlsyms"
4874 echo >> "$output_objdir/$my_dlsyms" "\
4878 echo >> "$output_objdir/$my_dlsyms" "\
4879 LT_DLSYM_CONST lt_dlsymlist
4880 lt_${my_prefix}_LTX_preloaded_symbols[] =
4881 { {\"$my_originator\", (void *) 0},"
4883 if test -s "$nlist"I; then
4884 echo >> "$output_objdir/$my_dlsyms" "\
4885 {\"@INIT@\", (void *) <_syminit},"
4888 case $need_lib_prefix in
4890 eval "$global_symbol_to_c_name_address" < "$nlist" >> "$output_objdir/$my_dlsyms"
4893 eval "$global_symbol_to_c_name_address_lib_prefix" < "$nlist" >> "$output_objdir/$my_dlsyms"
4896 echo >> "$output_objdir/$my_dlsyms" "\
4900 /* This works around a problem in FreeBSD linker */
4901 #ifdef FREEBSD_WORKAROUND
4902 static const void *lt_preloaded_setup() {
4903 return lt_${my_prefix}_LTX_preloaded_symbols;
4913 pic_flag_for_symtable=
4914 case "$compile_command " in
4918 # compiling the symbol table file with pic_flag works around
4919 # a FreeBSD bug that causes programs to crash when -lm is
4920 # linked before any other PIC object. But we must not use
4921 # pic_flag when linking with -static. The problem exists in
4922 # FreeBSD 2.2.6 and is fixed in FreeBSD 3.1.
4923 *-*-freebsd2.*|*-*-freebsd3.0*|*-*-freebsdelf3.0*)
4924 pic_flag_for_symtable=" $pic_flag -DFREEBSD_WORKAROUND" ;;
4926 pic_flag_for_symtable=" $pic_flag" ;;
4928 $my_pic_p && pic_flag_for_symtable=" $pic_flag"
4934 for arg in $LTCFLAGS; do
4936 -pie | -fpie | -fPIE) ;;
4937 *) func_append symtab_cflags " $arg" ;;
4941 # Now compile the dynamic symbol file.
4942 func_show_eval '(cd $output_objdir && $LTCC$symtab_cflags -c$no_builtin_flag$pic_flag_for_symtable "$my_dlsyms")' 'exit $?'
4944 # Clean up the generated files.
4945 func_show_eval '$RM "$output_objdir/$my_dlsyms" "$nlist" "${nlist}S" "${nlist}T" "${nlist}I"'
4947 # Transform the symbol file into the correct name.
4948 symfileobj=$output_objdir/${my_outputname}S.$objext
4950 *cygwin* | *mingw* | *cegcc* )
4951 if test -f "$output_objdir/$my_outputname.def"; then
4952 compile_command=`$ECHO "$compile_command" | $SED "s%@SYMFILE@%$output_objdir/$my_outputname.def $symfileobj%"`
4953 finalize_command=`$ECHO "$finalize_command" | $SED "s%@SYMFILE@%$output_objdir/$my_outputname.def $symfileobj%"`
4955 compile_command=`$ECHO "$compile_command" | $SED "s%@SYMFILE@%$symfileobj%"`
4956 finalize_command=`$ECHO "$finalize_command" | $SED "s%@SYMFILE@%$symfileobj%"`
4960 compile_command=`$ECHO "$compile_command" | $SED "s%@SYMFILE@%$symfileobj%"`
4961 finalize_command=`$ECHO "$finalize_command" | $SED "s%@SYMFILE@%$symfileobj%"`
4966 func_fatal_error "unknown suffix for '$my_dlsyms'"
4970 # We keep going just in case the user didn't refer to
4971 # lt_preloaded_symbols. The linker will fail if global_symbol_pipe
4972 # really was required.
4974 # Nullify the symbol file.
4975 compile_command=`$ECHO "$compile_command" | $SED "s% @SYMFILE@%%"`
4976 finalize_command=`$ECHO "$finalize_command" | $SED "s% @SYMFILE@%%"`
4980 # func_cygming_gnu_implib_p ARG
4981 # This predicate returns with zero status (TRUE) if
4982 # ARG is a GNU/binutils-style import library. Returns
4983 # with nonzero status (FALSE) otherwise.
4984 func_cygming_gnu_implib_p ()
4988 func_to_tool_file "$1" func_convert_file_msys_to_w32
4989 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)$'`
4990 test -n "$func_cygming_gnu_implib_tmp"
4993 # func_cygming_ms_implib_p ARG
4994 # This predicate returns with zero status (TRUE) if
4995 # ARG is an MS-style import library. Returns
4996 # with nonzero status (FALSE) otherwise.
4997 func_cygming_ms_implib_p ()
5001 func_to_tool_file "$1" func_convert_file_msys_to_w32
5002 func_cygming_ms_implib_tmp=`$NM "$func_to_tool_file_result" | eval "$global_symbol_pipe" | $GREP '_NULL_IMPORT_DESCRIPTOR'`
5003 test -n "$func_cygming_ms_implib_tmp"
5006 # func_win32_libid arg
5007 # return the library type of file 'arg'
5009 # Need a lot of goo to handle *both* DLLs and import libs
5010 # Has to be a shell function in order to 'eat' the argument
5011 # that is supplied when $file_magic_command is called.
5012 # Despite the name, also deal with 64 bit binaries.
5017 win32_libid_type=unknown
5018 win32_fileres=`file -L $1 2>/dev/null`
5019 case $win32_fileres in
5020 *ar\ archive\ import\ library*) # definitely import
5021 win32_libid_type="x86 archive import"
5023 *ar\ archive*) # could be an import, or static
5024 # Keep the egrep pattern in sync with the one in _LT_CHECK_MAGIC_METHOD.
5025 if eval $OBJDUMP -f $1 | $SED -e '10q' 2>/dev/null |
5026 $EGREP 'file format (pei*-i386(.*architecture: i386)?|pe-arm-wince|pe-x86-64)' >/dev/null; then
5027 case $nm_interface in
5029 if func_cygming_ms_implib_p "$1" ||
5030 func_cygming_gnu_implib_p "$1"
5038 func_to_tool_file "$1" func_convert_file_msys_to_w32
5039 win32_nmres=`eval $NM -f posix -A \"$func_to_tool_file_result\" |
5050 case $win32_nmres in
5051 import*) win32_libid_type="x86 archive import";;
5052 *) win32_libid_type="x86 archive static";;
5057 win32_libid_type="x86 DLL"
5059 *executable*) # but shell scripts are "executable" too...
5060 case $win32_fileres in
5061 *MS\ Windows\ PE\ Intel*)
5062 win32_libid_type="x86 DLL"
5067 $ECHO "$win32_libid_type"
5070 # func_cygming_dll_for_implib ARG
5072 # Platform-specific function to extract the
5073 # name of the DLL associated with the specified
5074 # import library ARG.
5075 # Invoked by eval'ing the libtool variable
5076 # $sharedlib_from_linklib_cmd
5077 # Result is available in the variable
5078 # $sharedlib_from_linklib_result
5079 func_cygming_dll_for_implib ()
5083 sharedlib_from_linklib_result=`$DLLTOOL --identify-strict --identify "$1"`
5086 # func_cygming_dll_for_implib_fallback_core SECTION_NAME LIBNAMEs
5088 # The is the core of a fallback implementation of a
5089 # platform-specific function to extract the name of the
5090 # DLL associated with the specified import library LIBNAME.
5092 # SECTION_NAME is either .idata$6 or .idata$7, depending
5093 # on the platform and compiler that created the implib.
5095 # Echos the name of the DLL associated with the
5096 # specified import library.
5097 func_cygming_dll_for_implib_fallback_core ()
5101 match_literal=`$ECHO "$1" | $SED "$sed_make_literal_regex"`
5102 $OBJDUMP -s --section "$1" "$2" 2>/dev/null |
5103 $SED '/^Contents of section '"$match_literal"':/{
5104 # Place marker at beginning of archive member dllname section
5109 # These lines can sometimes be longer than 43 characters, but
5110 # are always uninteresting
5111 /:[ ]*file format pe[i]\{,1\}-/d
5112 /^In archive [^:]*:/d
5113 # Ensure marker is printed
5115 # Remove all lines with less than 43 characters
5117 # From remaining lines, remove first 43 characters
5120 # Join marker and all lines until next marker into a single line
5121 /^====MARK====/ b para
5130 # Remove trailing dots and whitespace
5134 # we now have a list, one entry per line, of the stringified
5135 # contents of the appropriate section of all members of the
5136 # archive that possess that section. Heuristic: eliminate
5137 # all those that have a first or second character that is
5138 # a '.' (that is, objdump's representation of an unprintable
5139 # character.) This should work for all archives with less than
5140 # 0x302f exports -- but will fail for DLLs whose name actually
5141 # begins with a literal '.' or a single character followed by
5144 # Of those that remain, print the first one.
5145 $SED -e '/^\./d;/^.\./d;q'
5148 # func_cygming_dll_for_implib_fallback ARG
5149 # Platform-specific function to extract the
5150 # name of the DLL associated with the specified
5151 # import library ARG.
5153 # This fallback implementation is for use when $DLLTOOL
5154 # does not support the --identify-strict option.
5155 # Invoked by eval'ing the libtool variable
5156 # $sharedlib_from_linklib_cmd
5157 # Result is available in the variable
5158 # $sharedlib_from_linklib_result
5159 func_cygming_dll_for_implib_fallback ()
5163 if func_cygming_gnu_implib_p "$1"; then
5164 # binutils import library
5165 sharedlib_from_linklib_result=`func_cygming_dll_for_implib_fallback_core '.idata$7' "$1"`
5166 elif func_cygming_ms_implib_p "$1"; then
5167 # ms-generated import library
5168 sharedlib_from_linklib_result=`func_cygming_dll_for_implib_fallback_core '.idata$6' "$1"`
5171 sharedlib_from_linklib_result=
5176 # func_extract_an_archive dir oldlib
5177 func_extract_an_archive ()
5181 f_ex_an_ar_dir=$1; shift
5182 f_ex_an_ar_oldlib=$1
5183 if test yes = "$lock_old_archive_extraction"; then
5184 lockfile=$f_ex_an_ar_oldlib.lock
5185 until $opt_dry_run || ln "$progpath" "$lockfile" 2>/dev/null; do
5186 func_echo "Waiting for $lockfile to be removed"
5190 func_show_eval "(cd \$f_ex_an_ar_dir && $AR x \"\$f_ex_an_ar_oldlib\")" \
5191 'stat=$?; rm -f "$lockfile"; exit $stat'
5192 if test yes = "$lock_old_archive_extraction"; then
5193 $opt_dry_run || rm -f "$lockfile"
5195 if ($AR t "$f_ex_an_ar_oldlib" | sort | sort -uc >/dev/null 2>&1); then
5198 func_fatal_error "object name conflicts in archive: $f_ex_an_ar_dir/$f_ex_an_ar_oldlib"
5203 # func_extract_archives gentop oldlib ...
5204 func_extract_archives ()
5209 my_oldlibs=${1+"$@"}
5215 for my_xlib in $my_oldlibs; do
5216 # Extract the objects.
5218 [\\/]* | [A-Za-z]:[\\/]*) my_xabs=$my_xlib ;;
5219 *) my_xabs=`pwd`"/$my_xlib" ;;
5221 func_basename "$my_xlib"
5222 my_xlib=$func_basename_result
5225 case " $extracted_archives " in
5227 func_arith $extracted_serial + 1
5228 extracted_serial=$func_arith_result
5229 my_xlib_u=lt$extracted_serial-$my_xlib ;;
5233 extracted_archives="$extracted_archives $my_xlib_u"
5234 my_xdir=$my_gentop/$my_xlib_u
5236 func_mkdir_p "$my_xdir"
5240 func_verbose "Extracting $my_xabs"
5241 # Do not bother doing anything if just a dry run
5243 darwin_orig_dir=`pwd`
5244 cd $my_xdir || exit $?
5245 darwin_archive=$my_xabs
5247 func_basename "$darwin_archive"
5248 darwin_base_archive=$func_basename_result
5249 darwin_arches=`$LIPO -info "$darwin_archive" 2>/dev/null | $GREP Architectures 2>/dev/null || true`
5250 if test -n "$darwin_arches"; then
5251 darwin_arches=`$ECHO "$darwin_arches" | $SED -e 's/.*are://'`
5253 func_verbose "$darwin_base_archive has multiple architectures $darwin_arches"
5254 for darwin_arch in $darwin_arches; do
5255 func_mkdir_p "unfat-$$/$darwin_base_archive-$darwin_arch"
5256 $LIPO -thin $darwin_arch -output "unfat-$$/$darwin_base_archive-$darwin_arch/$darwin_base_archive" "$darwin_archive"
5257 cd "unfat-$$/$darwin_base_archive-$darwin_arch"
5258 func_extract_an_archive "`pwd`" "$darwin_base_archive"
5260 $RM "unfat-$$/$darwin_base_archive-$darwin_arch/$darwin_base_archive"
5261 done # $darwin_arches
5262 ## Okay now we've a bunch of thin objects, gotta fatten them up :)
5263 darwin_filelist=`find unfat-$$ -type f -name \*.o -print -o -name \*.lo -print | $SED -e "$sed_basename" | sort -u`
5266 for darwin_file in $darwin_filelist; do
5267 darwin_files=`find unfat-$$ -name $darwin_file -print | sort | $NL2SP`
5268 $LIPO -create -output "$darwin_file" $darwin_files
5269 done # $darwin_filelist
5271 cd "$darwin_orig_dir"
5274 func_extract_an_archive "$my_xdir" "$my_xabs"
5279 func_extract_an_archive "$my_xdir" "$my_xabs"
5282 my_oldobjs="$my_oldobjs "`find $my_xdir -name \*.$objext -print -o -name \*.lo -print | sort | $NL2SP`
5285 func_extract_archives_result=$my_oldobjs
5289 # func_emit_wrapper [arg=no]
5291 # Emit a libtool wrapper script on stdout.
5292 # Don't directly open a file because we may want to
5293 # incorporate the script contents within a cygwin/mingw
5294 # wrapper executable. Must ONLY be called from within
5295 # func_mode_link because it depends on a number of variables
5298 # ARG is the value that the WRAPPER_SCRIPT_BELONGS_IN_OBJDIR
5299 # variable will take. If 'yes', then the emitted script
5300 # will assume that the directory where it is stored is
5301 # the $objdir directory. This is a cygwin/mingw-specific
5303 func_emit_wrapper ()
5305 func_emit_wrapper_arg1=${1-no}
5310 # $output - temporary wrapper script for $objdir/$outputname
5311 # Generated by $PROGRAM (GNU $PACKAGE) $VERSION
5313 # The $output program cannot be directly executed until all the libtool
5314 # libraries that it depends on are installed.
5316 # This wrapper script should never be moved out of the build directory.
5317 # If it is, it will not operate correctly.
5319 # Sed substitution that helps us do robust quoting. It backslashifies
5320 # metacharacters that are still active within double-quoted strings.
5321 sed_quote_subst='$sed_quote_subst'
5323 # Be Bourne compatible
5324 if test -n \"\${ZSH_VERSION+set}\" && (emulate sh) >/dev/null 2>&1; then
5327 # Zsh 3.x and 4.x performs word splitting on \${1+\"\$@\"}, which
5328 # is contrary to our usage. Disable this feature.
5329 alias -g '\${1+\"\$@\"}'='\"\$@\"'
5330 setopt NO_GLOB_SUBST
5332 case \`(set -o) 2>/dev/null\` in *posix*) set -o posix;; esac
5334 BIN_SH=xpg4; export BIN_SH # for Tru64
5335 DUALCASE=1; export DUALCASE # for MKS sh
5337 # The HP-UX ksh and POSIX shell print the target directory to stdout
5339 (unset CDPATH) >/dev/null 2>&1 && unset CDPATH
5341 relink_command=\"$relink_command\"
5343 # This environment variable determines our operation mode.
5344 if test \"\$libtool_install_magic\" = \"$magic\"; then
5345 # install mode needs the following variables:
5346 generated_by_libtool_version='$macro_version'
5347 notinst_deplibs='$notinst_deplibs'
5349 # When we are sourced in execute mode, \$file and \$ECHO are already set.
5350 if test \"\$libtool_execute_magic\" != \"$magic\"; then
5353 qECHO=`$ECHO "$ECHO" | $SED "$sed_quote_subst"`
5356 # A function that is used when there is no print builtin or printf.
5357 func_fallback_echo ()
5359 eval 'cat <<_LTECHO_EOF
5366 # Very basic option parsing. These options are (a) specific to
5367 # the libtool wrapper, (b) are identical between the wrapper
5368 # /script/ and the wrapper /executable/ that is used only on
5369 # windows platforms, and (c) all begin with the string "--lt-"
5370 # (application programs are unlikely to have options that match
5373 # There are only two supported options: --lt-debug and
5374 # --lt-dump-script. There is, deliberately, no --lt-help.
5376 # The first argument to this parsing function should be the
5377 # script's $0 value, followed by "$@".
5379 func_parse_lt_options ()
5385 case \"\$lt_opt\" in
5386 --lt-debug) lt_option_debug=1 ;;
5388 lt_dump_D=\`\$ECHO \"X\$lt_script_arg0\" | $SED -e 's/^X//' -e 's%/[^/]*$%%'\`
5389 test \"X\$lt_dump_D\" = \"X\$lt_script_arg0\" && lt_dump_D=.
5390 lt_dump_F=\`\$ECHO \"X\$lt_script_arg0\" | $SED -e 's/^X//' -e 's%^.*/%%'\`
5391 cat \"\$lt_dump_D/\$lt_dump_F\"
5395 \$ECHO \"Unrecognized --lt- option: '\$lt_opt'\" 1>&2
5401 # Print the debug banner immediately:
5402 if test -n \"\$lt_option_debug\"; then
5403 echo \"$outputname:$output:\$LINENO: libtool wrapper (GNU $PACKAGE) $VERSION\" 1>&2
5407 # Used when --lt-debug. Prints its arguments to stdout
5408 # (redirection is the responsibility of the caller)
5409 func_lt_dump_args ()
5414 \$ECHO \"$outputname:$output:\$LINENO: newargv[\$lt_dump_args_N]: \$lt_arg\"
5415 lt_dump_args_N=\`expr \$lt_dump_args_N + 1\`
5419 # Core function for launching the target application
5420 func_exec_program_core ()
5424 # Backslashes separate directories on plain windows
5425 *-*-mingw | *-*-os2* | *-cegcc*)
5427 if test -n \"\$lt_option_debug\"; then
5428 \$ECHO \"$outputname:$output:\$LINENO: newargv[0]: \$progdir\\\\\$program\" 1>&2
5429 func_lt_dump_args \${1+\"\$@\"} 1>&2
5431 exec \"\$progdir\\\\\$program\" \${1+\"\$@\"}
5437 if test -n \"\$lt_option_debug\"; then
5438 \$ECHO \"$outputname:$output:\$LINENO: newargv[0]: \$progdir/\$program\" 1>&2
5439 func_lt_dump_args \${1+\"\$@\"} 1>&2
5441 exec \"\$progdir/\$program\" \${1+\"\$@\"}
5446 \$ECHO \"\$0: cannot exec \$program \$*\" 1>&2
5450 # A function to encapsulate launching the target application
5451 # Strips options in the --lt-* namespace from \$@ and
5452 # launches target application with the remaining arguments.
5453 func_exec_program ()
5461 *) set x \"\$@\" \"\$lt_wr_arg\"; shift;;
5466 func_exec_program_core \${1+\"\$@\"}
5470 func_parse_lt_options \"\$0\" \${1+\"\$@\"}
5472 # Find the directory that this script lives in.
5473 thisdir=\`\$ECHO \"\$file\" | $SED 's%/[^/]*$%%'\`
5474 test \"x\$thisdir\" = \"x\$file\" && thisdir=.
5476 # Follow symbolic links until we get to the real thisdir.
5477 file=\`ls -ld \"\$file\" | $SED -n 's/.*-> //p'\`
5478 while test -n \"\$file\"; do
5479 destdir=\`\$ECHO \"\$file\" | $SED 's%/[^/]*\$%%'\`
5481 # If there was a directory component, then change thisdir.
5482 if test \"x\$destdir\" != \"x\$file\"; then
5483 case \"\$destdir\" in
5484 [\\\\/]* | [A-Za-z]:[\\\\/]*) thisdir=\"\$destdir\" ;;
5485 *) thisdir=\"\$thisdir/\$destdir\" ;;
5489 file=\`\$ECHO \"\$file\" | $SED 's%^.*/%%'\`
5490 file=\`ls -ld \"\$thisdir/\$file\" | $SED -n 's/.*-> //p'\`
5493 # Usually 'no', except on cygwin/mingw when embedded into
5495 WRAPPER_SCRIPT_BELONGS_IN_OBJDIR=$func_emit_wrapper_arg1
5496 if test \"\$WRAPPER_SCRIPT_BELONGS_IN_OBJDIR\" = \"yes\"; then
5497 # special case for '.'
5498 if test \"\$thisdir\" = \".\"; then
5501 # remove .libs from thisdir
5502 case \"\$thisdir\" in
5503 *[\\\\/]$objdir ) thisdir=\`\$ECHO \"\$thisdir\" | $SED 's%[\\\\/][^\\\\/]*$%%'\` ;;
5504 $objdir ) thisdir=. ;;
5508 # Try to get the absolute directory name.
5509 absdir=\`cd \"\$thisdir\" && pwd\`
5510 test -n \"\$absdir\" && thisdir=\"\$absdir\"
5513 if test yes = "$fast_install"; then
5515 program=lt-'$outputname'$exeext
5516 progdir=\"\$thisdir/$objdir\"
5518 if test ! -f \"\$progdir/\$program\" ||
5519 { file=\`ls -1dt \"\$progdir/\$program\" \"\$progdir/../\$program\" 2>/dev/null | $SED 1q\`; \\
5520 test \"X\$file\" != \"X\$progdir/\$program\"; }; then
5522 file=\"\$\$-\$program\"
5524 if test ! -d \"\$progdir\"; then
5525 $MKDIR \"\$progdir\"
5527 $RM \"\$progdir/\$file\"
5532 # relink executable if necessary
5533 if test -n \"\$relink_command\"; then
5534 if relink_command_output=\`eval \$relink_command 2>&1\`; then :
5536 \$ECHO \"\$relink_command_output\" >&2
5537 $RM \"\$progdir/\$file\"
5542 $MV \"\$progdir/\$file\" \"\$progdir/\$program\" 2>/dev/null ||
5543 { $RM \"\$progdir/\$program\";
5544 $MV \"\$progdir/\$file\" \"\$progdir/\$program\"; }
5545 $RM \"\$progdir/\$file\"
5549 program='$outputname'
5550 progdir=\"\$thisdir/$objdir\"
5556 if test -f \"\$progdir/\$program\"; then"
5558 # fixup the dll searchpath if we need to.
5560 # Fix the DLL searchpath if we need to. Do this before prepending
5561 # to shlibpath, because on Windows, both are PATH and uninstalled
5562 # libraries must come first.
5563 if test -n "$dllsearchpath"; then
5565 # Add the dll search path components to the executable PATH
5566 PATH=$dllsearchpath:\$PATH
5570 # Export our shlibpath_var if we have one.
5571 if test yes = "$shlibpath_overrides_runpath" && test -n "$shlibpath_var" && test -n "$temp_rpath"; then
5573 # Add our own library path to $shlibpath_var
5574 $shlibpath_var=\"$temp_rpath\$$shlibpath_var\"
5576 # Some systems cannot cope with colon-terminated $shlibpath_var
5577 # The second colon is a workaround for a bug in BeOS R4 sed
5578 $shlibpath_var=\`\$ECHO \"\$$shlibpath_var\" | $SED 's/::*\$//'\`
5580 export $shlibpath_var
5585 if test \"\$libtool_execute_magic\" != \"$magic\"; then
5586 # Run the actual program with our arguments.
5587 func_exec_program \${1+\"\$@\"}
5590 # The program doesn't exist.
5591 \$ECHO \"\$0: error: '\$progdir/\$program' does not exist\" 1>&2
5592 \$ECHO \"This script is just a wrapper for \$program.\" 1>&2
5593 \$ECHO \"See the $PACKAGE documentation for more information.\" 1>&2
5601 # func_emit_cwrapperexe_src
5602 # emit the source code for a wrapper executable on stdout
5603 # Must ONLY be called from within func_mode_link because
5604 # it depends on a number of variable set therein.
5605 func_emit_cwrapperexe_src ()
5609 /* $cwrappersource - temporary wrapper executable for $objdir/$outputname
5610 Generated by $PROGRAM (GNU $PACKAGE) $VERSION
5612 The $output program cannot be directly executed until all the libtool
5613 libraries that it depends on are installed.
5615 This wrapper executable should never be moved out of the build directory.
5616 If it is, it will not operate correctly.
5621 # define _CRT_SECURE_NO_DEPRECATE 1
5626 # include <direct.h>
5627 # include <process.h>
5630 # include <unistd.h>
5631 # include <stdint.h>
5643 #include <sys/stat.h>
5645 #define STREQ(s1, s2) (strcmp ((s1), (s2)) == 0)
5647 /* declarations of non-ANSI functions */
5648 #if defined __MINGW32__
5649 # ifdef __STRICT_ANSI__
5650 int _putenv (const char *);
5652 #elif defined __CYGWIN__
5653 # ifdef __STRICT_ANSI__
5654 char *realpath (const char *, char *);
5655 int putenv (char *);
5656 int setenv (const char *, const char *, int);
5658 /* #elif defined other_platform || defined ... */
5661 /* portability defines, excluding path handling macros */
5662 #if defined _MSC_VER
5663 # define setmode _setmode
5665 # define chmod _chmod
5666 # define getcwd _getcwd
5667 # define putenv _putenv
5668 # define S_IXUSR _S_IEXEC
5669 #elif defined __MINGW32__
5670 # define setmode _setmode
5672 # define chmod _chmod
5673 # define getcwd _getcwd
5674 # define putenv _putenv
5675 #elif defined __CYGWIN__
5676 # define HAVE_SETENV
5677 # define FOPEN_WB "wb"
5678 /* #elif defined other platforms ... */
5681 #if defined PATH_MAX
5682 # define LT_PATHMAX PATH_MAX
5683 #elif defined MAXPATHLEN
5684 # define LT_PATHMAX MAXPATHLEN
5686 # define LT_PATHMAX 1024
5696 /* path handling portability macros */
5697 #ifndef DIR_SEPARATOR
5698 # define DIR_SEPARATOR '/'
5699 # define PATH_SEPARATOR ':'
5702 #if defined _WIN32 || defined __MSDOS__ || defined __DJGPP__ || \
5704 # define HAVE_DOS_BASED_FILE_SYSTEM
5705 # define FOPEN_WB "wb"
5706 # ifndef DIR_SEPARATOR_2
5707 # define DIR_SEPARATOR_2 '\\'
5709 # ifndef PATH_SEPARATOR_2
5710 # define PATH_SEPARATOR_2 ';'
5714 #ifndef DIR_SEPARATOR_2
5715 # define IS_DIR_SEPARATOR(ch) ((ch) == DIR_SEPARATOR)
5716 #else /* DIR_SEPARATOR_2 */
5717 # define IS_DIR_SEPARATOR(ch) \
5718 (((ch) == DIR_SEPARATOR) || ((ch) == DIR_SEPARATOR_2))
5719 #endif /* DIR_SEPARATOR_2 */
5721 #ifndef PATH_SEPARATOR_2
5722 # define IS_PATH_SEPARATOR(ch) ((ch) == PATH_SEPARATOR)
5723 #else /* PATH_SEPARATOR_2 */
5724 # define IS_PATH_SEPARATOR(ch) ((ch) == PATH_SEPARATOR_2)
5725 #endif /* PATH_SEPARATOR_2 */
5728 # define FOPEN_WB "w"
5731 # define _O_BINARY 0
5734 #define XMALLOC(type, num) ((type *) xmalloc ((num) * sizeof(type)))
5735 #define XFREE(stale) do { \
5736 if (stale) { free (stale); stale = 0; } \
5739 #if defined LT_DEBUGWRAPPER
5740 static int lt_debug = 1;
5742 static int lt_debug = 0;
5745 const char *program_name = "libtool-wrapper"; /* in case xstrdup fails */
5747 void *xmalloc (size_t num);
5748 char *xstrdup (const char *string);
5749 const char *base_name (const char *name);
5750 char *find_executable (const char *wrapper);
5751 char *chase_symlinks (const char *pathspec);
5752 int make_executable (const char *path);
5753 int check_executable (const char *path);
5754 char *strendzap (char *str, const char *pat);
5755 void lt_debugprintf (const char *file, int line, const char *fmt, ...);
5756 void lt_fatal (const char *file, int line, const char *message, ...);
5757 static const char *nonnull (const char *s);
5758 static const char *nonempty (const char *s);
5759 void lt_setenv (const char *name, const char *value);
5760 char *lt_extend_str (const char *orig_value, const char *add, int to_end);
5761 void lt_update_exe_path (const char *name, const char *value);
5762 void lt_update_lib_path (const char *name, const char *value);
5763 char **prepare_spawn (char **argv);
5764 void lt_dump_script (FILE *f);
5768 #if __GNUC__ < 4 || (__GNUC__ == 4 && __GNUC_MINOR__ < 5)
5769 # define externally_visible volatile
5771 # define externally_visible __attribute__((externally_visible)) volatile
5773 externally_visible const char * MAGIC_EXE = "$magic_exe";
5774 const char * LIB_PATH_VARNAME = "$shlibpath_var";
5777 if test yes = "$shlibpath_overrides_runpath" && test -n "$shlibpath_var" && test -n "$temp_rpath"; then
5778 func_to_host_path "$temp_rpath"
5780 const char * LIB_PATH_VALUE = "$func_to_host_path_result";
5784 const char * LIB_PATH_VALUE = "";
5788 if test -n "$dllsearchpath"; then
5789 func_to_host_path "$dllsearchpath:"
5791 const char * EXE_PATH_VARNAME = "PATH";
5792 const char * EXE_PATH_VALUE = "$func_to_host_path_result";
5796 const char * EXE_PATH_VARNAME = "";
5797 const char * EXE_PATH_VALUE = "";
5801 if test yes = "$fast_install"; then
5803 const char * TARGET_PROGRAM_NAME = "lt-$outputname"; /* hopefully, no .exe */
5807 const char * TARGET_PROGRAM_NAME = "$outputname"; /* hopefully, no .exe */
5814 #define LTWRAPPER_OPTION_PREFIX "--lt-"
5816 static const char *ltwrapper_option_prefix = LTWRAPPER_OPTION_PREFIX;
5817 static const char *dumpscript_opt = LTWRAPPER_OPTION_PREFIX "dump-script";
5818 static const char *debug_opt = LTWRAPPER_OPTION_PREFIX "debug";
5821 main (int argc, char *argv[])
5826 char *actual_cwrapper_path;
5827 char *actual_cwrapper_name;
5834 program_name = (char *) xstrdup (base_name (argv[0]));
5835 newargz = XMALLOC (char *, (size_t) argc + 1);
5837 /* very simple arg parsing; don't want to rely on getopt
5838 * also, copy all non cwrapper options to newargz, except
5839 * argz[0], which is handled differently
5842 for (i = 1; i < argc; i++)
5844 if (STREQ (argv[i], dumpscript_opt))
5848 *mingw* | *cygwin* )
5849 # make stdout use "unix" line endings
5850 echo " setmode(1,_O_BINARY);"
5855 lt_dump_script (stdout);
5858 if (STREQ (argv[i], debug_opt))
5863 if (STREQ (argv[i], ltwrapper_option_prefix))
5865 /* however, if there is an option in the LTWRAPPER_OPTION_PREFIX
5866 namespace, but it is not one of the ones we know about and
5867 have already dealt with, above (inluding dump-script), then
5868 report an error. Otherwise, targets might begin to believe
5869 they are allowed to use options in the LTWRAPPER_OPTION_PREFIX
5870 namespace. The first time any user complains about this, we'll
5871 need to make LTWRAPPER_OPTION_PREFIX a configure-time option
5872 or a configure.ac-settable value.
5874 lt_fatal (__FILE__, __LINE__,
5875 "unrecognized %s option: '%s'",
5876 ltwrapper_option_prefix, argv[i]);
5879 newargz[++newargc] = xstrdup (argv[i]);
5881 newargz[++newargc] = NULL;
5885 /* The GNU banner must be the first non-error debug message */
5886 lt_debugprintf (__FILE__, __LINE__, "libtool wrapper (GNU $PACKAGE) $VERSION\n");
5889 lt_debugprintf (__FILE__, __LINE__, "(main) argv[0]: %s\n", argv[0]);
5890 lt_debugprintf (__FILE__, __LINE__, "(main) program_name: %s\n", program_name);
5892 tmp_pathspec = find_executable (argv[0]);
5893 if (tmp_pathspec == NULL)
5894 lt_fatal (__FILE__, __LINE__, "couldn't find %s", argv[0]);
5895 lt_debugprintf (__FILE__, __LINE__,
5896 "(main) found exe (before symlink chase) at: %s\n",
5899 actual_cwrapper_path = chase_symlinks (tmp_pathspec);
5900 lt_debugprintf (__FILE__, __LINE__,
5901 "(main) found exe (after symlink chase) at: %s\n",
5902 actual_cwrapper_path);
5903 XFREE (tmp_pathspec);
5905 actual_cwrapper_name = xstrdup (base_name (actual_cwrapper_path));
5906 strendzap (actual_cwrapper_path, actual_cwrapper_name);
5908 /* wrapper name transforms */
5909 strendzap (actual_cwrapper_name, ".exe");
5910 tmp_pathspec = lt_extend_str (actual_cwrapper_name, ".exe", 1);
5911 XFREE (actual_cwrapper_name);
5912 actual_cwrapper_name = tmp_pathspec;
5915 /* target_name transforms -- use actual target program name; might have lt- prefix */
5916 target_name = xstrdup (base_name (TARGET_PROGRAM_NAME));
5917 strendzap (target_name, ".exe");
5918 tmp_pathspec = lt_extend_str (target_name, ".exe", 1);
5919 XFREE (target_name);
5920 target_name = tmp_pathspec;
5923 lt_debugprintf (__FILE__, __LINE__,
5924 "(main) libtool target name: %s\n",
5930 XMALLOC (char, (strlen (actual_cwrapper_path) +
5931 strlen ("$objdir") + 1 + strlen (actual_cwrapper_name) + 1));
5932 strcpy (newargz[0], actual_cwrapper_path);
5933 strcat (newargz[0], "$objdir");
5934 strcat (newargz[0], "/");
5938 /* stop here, and copy so we don't have to do this twice */
5939 tmp_pathspec = xstrdup (newargz[0]);
5941 /* do NOT want the lt- prefix here, so use actual_cwrapper_name */
5942 strcat (newargz[0], actual_cwrapper_name);
5944 /* DO want the lt- prefix here if it exists, so use target_name */
5945 lt_argv_zero = lt_extend_str (tmp_pathspec, target_name, 1);
5946 XFREE (tmp_pathspec);
5947 tmp_pathspec = NULL;
5955 while ((p = strchr (newargz[0], '\\')) != NULL)
5959 while ((p = strchr (lt_argv_zero, '\\')) != NULL)
5969 XFREE (target_name);
5970 XFREE (actual_cwrapper_path);
5971 XFREE (actual_cwrapper_name);
5973 lt_setenv ("BIN_SH", "xpg4"); /* for Tru64 */
5974 lt_setenv ("DUALCASE", "1"); /* for MSK sh */
5975 /* Update the DLL searchpath. EXE_PATH_VALUE ($dllsearchpath) must
5976 be prepended before (that is, appear after) LIB_PATH_VALUE ($temp_rpath)
5977 because on Windows, both *_VARNAMEs are PATH but uninstalled
5978 libraries must come first. */
5979 lt_update_exe_path (EXE_PATH_VARNAME, EXE_PATH_VALUE);
5980 lt_update_lib_path (LIB_PATH_VARNAME, LIB_PATH_VALUE);
5982 lt_debugprintf (__FILE__, __LINE__, "(main) lt_argv_zero: %s\n",
5983 nonnull (lt_argv_zero));
5984 for (i = 0; i < newargc; i++)
5986 lt_debugprintf (__FILE__, __LINE__, "(main) newargz[%d]: %s\n",
5987 i, nonnull (newargz[i]));
5995 /* execv doesn't actually work on mingw as expected on unix */
5996 newargz = prepare_spawn (newargz);
5997 rval = (int) _spawnv (_P_WAIT, lt_argv_zero, (const char * const *) newargz);
6000 /* failed to start process */
6001 lt_debugprintf (__FILE__, __LINE__,
6002 "(main) failed to launch target \"%s\": %s\n",
6003 lt_argv_zero, nonnull (strerror (errno)));
6011 execv (lt_argv_zero, newargz);
6012 return rval; /* =127, but avoids unused variable warning */
6021 xmalloc (size_t num)
6023 void *p = (void *) malloc (num);
6025 lt_fatal (__FILE__, __LINE__, "memory exhausted");
6031 xstrdup (const char *string)
6033 return string ? strcpy ((char *) xmalloc (strlen (string) + 1),
6038 base_name (const char *name)
6042 #if defined HAVE_DOS_BASED_FILE_SYSTEM
6043 /* Skip over the disk name in MSDOS pathnames. */
6044 if (isalpha ((unsigned char) name[0]) && name[1] == ':')
6048 for (base = name; *name; name++)
6049 if (IS_DIR_SEPARATOR (*name))
6055 check_executable (const char *path)
6059 lt_debugprintf (__FILE__, __LINE__, "(check_executable): %s\n",
6061 if ((!path) || (!*path))
6064 if ((stat (path, &st) >= 0)
6065 && (st.st_mode & (S_IXUSR | S_IXGRP | S_IXOTH)))
6072 make_executable (const char *path)
6077 lt_debugprintf (__FILE__, __LINE__, "(make_executable): %s\n",
6079 if ((!path) || (!*path))
6082 if (stat (path, &st) >= 0)
6084 rval = chmod (path, st.st_mode | S_IXOTH | S_IXGRP | S_IXUSR);
6089 /* Searches for the full path of the wrapper. Returns
6090 newly allocated full path name if found, NULL otherwise
6091 Does not chase symlinks, even on platforms that support them.
6094 find_executable (const char *wrapper)
6099 /* static buffer for getcwd */
6100 char tmp[LT_PATHMAX + 1];
6104 lt_debugprintf (__FILE__, __LINE__, "(find_executable): %s\n",
6105 nonempty (wrapper));
6107 if ((wrapper == NULL) || (*wrapper == '\0'))
6110 /* Absolute path? */
6111 #if defined HAVE_DOS_BASED_FILE_SYSTEM
6112 if (isalpha ((unsigned char) wrapper[0]) && wrapper[1] == ':')
6114 concat_name = xstrdup (wrapper);
6115 if (check_executable (concat_name))
6117 XFREE (concat_name);
6122 if (IS_DIR_SEPARATOR (wrapper[0]))
6124 concat_name = xstrdup (wrapper);
6125 if (check_executable (concat_name))
6127 XFREE (concat_name);
6129 #if defined HAVE_DOS_BASED_FILE_SYSTEM
6133 for (p = wrapper; *p; p++)
6141 /* no slashes; search PATH */
6142 const char *path = getenv ("PATH");
6145 for (p = path; *p; p = p_next)
6149 for (q = p; *q; q++)
6150 if (IS_PATH_SEPARATOR (*q))
6152 p_len = (size_t) (q - p);
6153 p_next = (*q == '\0' ? q : q + 1);
6156 /* empty path: current directory */
6157 if (getcwd (tmp, LT_PATHMAX) == NULL)
6158 lt_fatal (__FILE__, __LINE__, "getcwd failed: %s",
6159 nonnull (strerror (errno)));
6160 tmp_len = strlen (tmp);
6162 XMALLOC (char, tmp_len + 1 + strlen (wrapper) + 1);
6163 memcpy (concat_name, tmp, tmp_len);
6164 concat_name[tmp_len] = '/';
6165 strcpy (concat_name + tmp_len + 1, wrapper);
6170 XMALLOC (char, p_len + 1 + strlen (wrapper) + 1);
6171 memcpy (concat_name, p, p_len);
6172 concat_name[p_len] = '/';
6173 strcpy (concat_name + p_len + 1, wrapper);
6175 if (check_executable (concat_name))
6177 XFREE (concat_name);
6180 /* not found in PATH; assume curdir */
6182 /* Relative path | not found in path: prepend cwd */
6183 if (getcwd (tmp, LT_PATHMAX) == NULL)
6184 lt_fatal (__FILE__, __LINE__, "getcwd failed: %s",
6185 nonnull (strerror (errno)));
6186 tmp_len = strlen (tmp);
6187 concat_name = XMALLOC (char, tmp_len + 1 + strlen (wrapper) + 1);
6188 memcpy (concat_name, tmp, tmp_len);
6189 concat_name[tmp_len] = '/';
6190 strcpy (concat_name + tmp_len + 1, wrapper);
6192 if (check_executable (concat_name))
6194 XFREE (concat_name);
6199 chase_symlinks (const char *pathspec)
6202 return xstrdup (pathspec);
6204 char buf[LT_PATHMAX];
6206 char *tmp_pathspec = xstrdup (pathspec);
6208 int has_symlinks = 0;
6209 while (strlen (tmp_pathspec) && !has_symlinks)
6211 lt_debugprintf (__FILE__, __LINE__,
6212 "checking path component for symlinks: %s\n",
6214 if (lstat (tmp_pathspec, &s) == 0)
6216 if (S_ISLNK (s.st_mode) != 0)
6222 /* search backwards for last DIR_SEPARATOR */
6223 p = tmp_pathspec + strlen (tmp_pathspec) - 1;
6224 while ((p > tmp_pathspec) && (!IS_DIR_SEPARATOR (*p)))
6226 if ((p == tmp_pathspec) && (!IS_DIR_SEPARATOR (*p)))
6228 /* no more DIR_SEPARATORS left */
6235 lt_fatal (__FILE__, __LINE__,
6236 "error accessing file \"%s\": %s",
6237 tmp_pathspec, nonnull (strerror (errno)));
6240 XFREE (tmp_pathspec);
6244 return xstrdup (pathspec);
6247 tmp_pathspec = realpath (pathspec, buf);
6248 if (tmp_pathspec == 0)
6250 lt_fatal (__FILE__, __LINE__,
6251 "could not follow symlinks for %s", pathspec);
6253 return xstrdup (tmp_pathspec);
6258 strendzap (char *str, const char *pat)
6262 assert (str != NULL);
6263 assert (pat != NULL);
6266 patlen = strlen (pat);
6270 str += len - patlen;
6271 if (STREQ (str, pat))
6278 lt_debugprintf (const char *file, int line, const char *fmt, ...)
6283 (void) fprintf (stderr, "%s:%s:%d: ", program_name, file, line);
6284 va_start (args, fmt);
6285 (void) vfprintf (stderr, fmt, args);
6291 lt_error_core (int exit_status, const char *file,
6292 int line, const char *mode,
6293 const char *message, va_list ap)
6295 fprintf (stderr, "%s:%s:%d: %s: ", program_name, file, line, mode);
6296 vfprintf (stderr, message, ap);
6297 fprintf (stderr, ".\n");
6299 if (exit_status >= 0)
6304 lt_fatal (const char *file, int line, const char *message, ...)
6307 va_start (ap, message);
6308 lt_error_core (EXIT_FAILURE, file, line, "FATAL", message, ap);
6313 nonnull (const char *s)
6315 return s ? s : "(null)";
6319 nonempty (const char *s)
6321 return (s && !*s) ? "(empty)" : nonnull (s);
6325 lt_setenv (const char *name, const char *value)
6327 lt_debugprintf (__FILE__, __LINE__,
6328 "(lt_setenv) setting '%s' to '%s'\n",
6329 nonnull (name), nonnull (value));
6332 /* always make a copy, for consistency with !HAVE_SETENV */
6333 char *str = xstrdup (value);
6334 setenv (name, str, 1);
6336 size_t len = strlen (name) + 1 + strlen (value) + 1;
6337 char *str = XMALLOC (char, len);
6338 sprintf (str, "%s=%s", name, value);
6339 if (putenv (str) != EXIT_SUCCESS)
6348 lt_extend_str (const char *orig_value, const char *add, int to_end)
6351 if (orig_value && *orig_value)
6353 size_t orig_value_len = strlen (orig_value);
6354 size_t add_len = strlen (add);
6355 new_value = XMALLOC (char, add_len + orig_value_len + 1);
6358 strcpy (new_value, orig_value);
6359 strcpy (new_value + orig_value_len, add);
6363 strcpy (new_value, add);
6364 strcpy (new_value + add_len, orig_value);
6369 new_value = xstrdup (add);
6375 lt_update_exe_path (const char *name, const char *value)
6377 lt_debugprintf (__FILE__, __LINE__,
6378 "(lt_update_exe_path) modifying '%s' by prepending '%s'\n",
6379 nonnull (name), nonnull (value));
6381 if (name && *name && value && *value)
6383 char *new_value = lt_extend_str (getenv (name), value, 0);
6384 /* some systems can't cope with a ':'-terminated path #' */
6385 size_t len = strlen (new_value);
6386 while ((len > 0) && IS_PATH_SEPARATOR (new_value[len-1]))
6388 new_value[--len] = '\0';
6390 lt_setenv (name, new_value);
6396 lt_update_lib_path (const char *name, const char *value)
6398 lt_debugprintf (__FILE__, __LINE__,
6399 "(lt_update_lib_path) modifying '%s' by prepending '%s'\n",
6400 nonnull (name), nonnull (value));
6402 if (name && *name && value && *value)
6404 char *new_value = lt_extend_str (getenv (name), value, 0);
6405 lt_setenv (name, new_value);
6415 /* Prepares an argument vector before calling spawn().
6416 Note that spawn() does not by itself call the command interpreter
6417 (getenv ("COMSPEC") != NULL ? getenv ("COMSPEC") :
6418 ({ OSVERSIONINFO v; v.dwOSVersionInfoSize = sizeof(OSVERSIONINFO);
6420 v.dwPlatformId == VER_PLATFORM_WIN32_NT;
6421 }) ? "cmd.exe" : "command.com").
6422 Instead it simply concatenates the arguments, separated by ' ', and calls
6423 CreateProcess(). We must quote the arguments since Win32 CreateProcess()
6424 interprets characters like ' ', '\t', '\\', '"' (but not '<' and '>') in a
6426 - Space and tab are interpreted as delimiters. They are not treated as
6427 delimiters if they are surrounded by double quotes: "...".
6428 - Unescaped double quotes are removed from the input. Their only effect is
6429 that within double quotes, space and tab are treated like normal
6431 - Backslashes not followed by double quotes are not special.
6432 - But 2*n+1 backslashes followed by a double quote become
6433 n backslashes followed by a double quote (n >= 0):
6438 #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"
6439 #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"
6441 prepare_spawn (char **argv)
6447 /* Count number of arguments. */
6448 for (argc = 0; argv[argc] != NULL; argc++)
6451 /* Allocate new argument vector. */
6452 new_argv = XMALLOC (char *, argc + 1);
6454 /* Put quoted arguments into the new argument vector. */
6455 for (i = 0; i < argc; i++)
6457 const char *string = argv[i];
6459 if (string[0] == '\0')
6460 new_argv[i] = xstrdup ("\"\"");
6461 else if (strpbrk (string, SHELL_SPECIAL_CHARS) != NULL)
6463 int quote_around = (strpbrk (string, SHELL_SPACE_CHARS) != NULL);
6465 unsigned int backslashes;
6467 char *quoted_string;
6474 for (s = string; *s != '\0'; s++)
6478 length += backslashes + 1;
6486 length += backslashes + 1;
6488 quoted_string = XMALLOC (char, length + 1);
6494 for (s = string; *s != '\0'; s++)
6500 for (j = backslashes + 1; j > 0; j--)
6512 for (j = backslashes; j > 0; j--)
6518 new_argv[i] = quoted_string;
6521 new_argv[i] = (char *) string;
6523 new_argv[argc] = NULL;
6532 void lt_dump_script (FILE* f)
6535 func_emit_wrapper yes |
6537 s/^\(.\{79\}\)\(..*\)/\1\
6542 s/\([^\n]*\).*/ fputs ("\1", f);/p
6549 # end: func_emit_cwrapperexe_src
6551 # func_win32_import_lib_p ARG
6552 # True if ARG is an import lib, as indicated by $file_magic_cmd
6553 func_win32_import_lib_p ()
6557 case `eval $file_magic_cmd \"\$1\" 2>/dev/null | $SED -e 10q` in
6563 # func_suncc_cstd_abi
6564 # !!ONLY CALL THIS FOR SUN CC AFTER $compile_command IS FULLY EXPANDED!!
6565 # Several compiler flags select an ABI that is incompatible with the
6566 # Cstd library. Avoid specifying it if any are in CXXFLAGS.
6567 func_suncc_cstd_abi ()
6571 case " $compile_command " in
6572 *" -compat=g "*|*\ -std=c++[0-9][0-9]\ *|*" -library=stdcxx4 "*|*" -library=stlport4 "*)
6573 suncc_use_cstd_abi=no
6576 suncc_use_cstd_abi=yes
6581 # func_mode_link arg...
6587 *-*-cygwin* | *-*-mingw* | *-*-pw32* | *-*-os2* | *-cegcc*)
6588 # It is impossible to link a dll without this setting, and
6589 # we shouldn't force the makefile maintainer to figure out
6590 # what system we are compiling for in order to pass an extra
6591 # flag for every libtool invocation.
6592 # allow_undefined=no
6594 # FIXME: Unfortunately, there are problems with the above when trying
6595 # to make a dll that has undefined symbols, in which case not
6596 # even a static library is built. For now, we need to specify
6597 # -no-undefined on the libtool link line when we can be certain
6598 # that all symbols are satisfied, otherwise we get a static library.
6605 libtool_args=$nonopt
6606 base_compile="$nonopt $@"
6607 compile_command=$nonopt
6608 finalize_command=$nonopt
6621 lib_search_path=`pwd`
6623 new_inherited_linker_flags=
6632 export_symbols_regex=
6641 precious_files_regex=
6642 prefer_static_libs=no
6655 single_module=$wl-single_module
6656 func_infer_tag $base_compile
6658 # We need to know -static, to get the right output filenames.
6663 test yes != "$build_libtool_libs" \
6664 && func_fatal_configuration "cannot build a shared library"
6668 -all-static | -static | -static-libtool-libs)
6671 if test yes = "$build_libtool_libs" && test -z "$link_static_flag"; then
6672 func_warning "complete static linking is impossible in this configuration"
6674 if test -n "$link_static_flag"; then
6675 dlopen_self=$dlopen_self_static
6677 prefer_static_libs=yes
6680 if test -z "$pic_flag" && test -n "$link_static_flag"; then
6681 dlopen_self=$dlopen_self_static
6683 prefer_static_libs=built
6685 -static-libtool-libs)
6686 if test -z "$pic_flag" && test -n "$link_static_flag"; then
6687 dlopen_self=$dlopen_self_static
6689 prefer_static_libs=yes
6692 build_libtool_libs=no
6699 # See if our shared archives depend on static archives.
6700 test -n "$old_archive_from_new_cmds" && build_old_libs=yes
6702 # Go through the arguments, transforming them on the way.
6703 while test "$#" -gt 0; do
6706 func_quote_for_eval "$arg"
6707 qarg=$func_quote_for_eval_unquoted_result
6708 func_append libtool_args " $func_quote_for_eval_result"
6710 # If the previous option needs an argument, assign it.
6711 if test -n "$prev"; then
6714 func_append compile_command " @OUTPUT@"
6715 func_append finalize_command " @OUTPUT@"
6727 # Add the symbol object into the linking commands.
6728 func_append compile_command " @SYMFILE@"
6729 func_append finalize_command " @SYMFILE@"
6733 *.la | *.lo) ;; # We handle these cases below.
6735 if test no = "$dlself"; then
6743 if test dlprefiles = "$prev"; then
6745 elif test dlfiles = "$prev" && test yes != "$dlopen_self"; then
6755 if test dlfiles = "$prev"; then
6756 func_append dlfiles " $arg"
6758 func_append dlprefiles " $arg"
6768 || func_fatal_error "symbol file '$arg' does not exist"
6773 export_symbols_regex=$arg
6781 *" $qarg.ltframework "*) ;;
6782 *) func_append deplibs " $qarg.ltframework" # this is fixed later
6791 inst_prefix_dir=$arg
6796 # Clang does not use LLVM to link, so we can simply discard any
6797 # '-mllvm $arg' options when doing the link step.
6802 if test -f "$arg"; then
6805 for fil in `cat "$save_arg"`
6807 # func_append moreargs " $fil"
6809 # A libtool-controlled object.
6811 # Check to see that this really is a libtool object.
6812 if func_lalib_unsafe_p "$arg"; then
6819 if test -z "$pic_object" ||
6820 test -z "$non_pic_object" ||
6821 test none = "$pic_object" &&
6822 test none = "$non_pic_object"; then
6823 func_fatal_error "cannot find name of object for '$arg'"
6826 # Extract subdirectory from the argument.
6827 func_dirname "$arg" "/" ""
6828 xdir=$func_dirname_result
6830 if test none != "$pic_object"; then
6831 # Prepend the subdirectory the object is found in.
6832 pic_object=$xdir$pic_object
6834 if test dlfiles = "$prev"; then
6835 if test yes = "$build_libtool_libs" && test yes = "$dlopen_support"; then
6836 func_append dlfiles " $pic_object"
6840 # If libtool objects are unsupported, then we need to preload.
6845 # CHECK ME: I think I busted this. -Ossama
6846 if test dlprefiles = "$prev"; then
6847 # Preload the old-style object.
6848 func_append dlprefiles " $pic_object"
6853 func_append libobjs " $pic_object"
6858 if test none != "$non_pic_object"; then
6859 # Prepend the subdirectory the object is found in.
6860 non_pic_object=$xdir$non_pic_object
6862 # A standard non-PIC object
6863 func_append non_pic_objects " $non_pic_object"
6864 if test -z "$pic_object" || test none = "$pic_object"; then
6868 # If the PIC object exists, use it instead.
6869 # $xdir was prepended to $pic_object above.
6870 non_pic_object=$pic_object
6871 func_append non_pic_objects " $non_pic_object"
6874 # Only an error if not doing a dry-run.
6875 if $opt_dry_run; then
6876 # Extract subdirectory from the argument.
6877 func_dirname "$arg" "/" ""
6878 xdir=$func_dirname_result
6881 pic_object=$xdir$objdir/$func_lo2o_result
6882 non_pic_object=$xdir$func_lo2o_result
6883 func_append libobjs " $pic_object"
6884 func_append non_pic_objects " $non_pic_object"
6886 func_fatal_error "'$arg' is not a valid libtool object"
6891 func_fatal_error "link input file '$arg' does not exist"
6903 precious_files_regex=$arg
6913 # We need an absolute path.
6915 [\\/]* | [A-Za-z]:[\\/]*) ;;
6917 func_fatal_error "only absolute run-paths are allowed"
6920 if test rpath = "$prev"; then
6923 *) func_append rpath " $arg" ;;
6928 *) func_append xrpath " $arg" ;;
6940 func_append weak_libs " $arg"
6945 func_append linker_flags " $qarg"
6946 func_append compiler_flags " $qarg"
6948 func_append compile_command " $qarg"
6949 func_append finalize_command " $qarg"
6953 func_append compiler_flags " $qarg"
6955 func_append compile_command " $qarg"
6956 func_append finalize_command " $qarg"
6960 func_append linker_flags " $qarg"
6961 func_append compiler_flags " $wl$qarg"
6963 func_append compile_command " $wl$qarg"
6964 func_append finalize_command " $wl$qarg"
6968 eval "$prev=\"\$arg\""
6973 fi # test -n "$prev"
6979 if test -n "$link_static_flag"; then
6980 # See comment for -static flag below, for more details.
6981 func_append compile_command " $link_static_flag"
6982 func_append finalize_command " $link_static_flag"
6988 # FIXME: remove this flag sometime in the future.
6989 func_fatal_error "'-allow-undefined' must not be used because it is the default"
7017 -export-symbols | -export-symbols-regex)
7018 if test -n "$export_symbols" || test -n "$export_symbols_regex"; then
7019 func_fatal_error "more than one -exported-symbols argument is not allowed"
7021 if test X-export-symbols = "X$arg"; then
7039 # The native IRIX linker understands -LANG:*, -LIST:* and -LNO:*
7040 # so, if we see these flags be careful not to treat them like -L
7042 case $with_gcc/$host in
7043 no/*-*-irix* | /*-*-irix*)
7044 func_append compile_command " $arg"
7045 func_append finalize_command " $arg"
7052 func_stripname "-L" '' "$arg"
7053 if test -z "$func_stripname_result"; then
7054 if test "$#" -gt 0; then
7055 func_fatal_error "require no space between '-L' and '$1'"
7057 func_fatal_error "need path for '-L' option"
7060 func_resolve_sysroot "$func_stripname_result"
7061 dir=$func_resolve_sysroot_result
7062 # We need an absolute path.
7064 [\\/]* | [A-Za-z]:[\\/]*) ;;
7066 absdir=`cd "$dir" && pwd`
7067 test -z "$absdir" && \
7068 func_fatal_error "cannot determine absolute directory name of '$dir'"
7073 *" -L$dir "* | *" $arg "*)
7074 # Will only happen for absolute or sysroot arguments
7077 # Preserve sysroot, but never include relative directories
7079 [\\/]* | [A-Za-z]:[\\/]* | =*) func_append deplibs " $arg" ;;
7080 *) func_append deplibs " -L$dir" ;;
7082 func_append lib_search_path " $dir"
7086 *-*-cygwin* | *-*-mingw* | *-*-pw32* | *-*-os2* | *-cegcc*)
7087 testbindir=`$ECHO "$dir" | $SED 's*/lib$*/bin*'`
7088 case :$dllsearchpath: in
7090 ::) dllsearchpath=$dir;;
7091 *) func_append dllsearchpath ":$dir";;
7093 case :$dllsearchpath: in
7094 *":$testbindir:"*) ;;
7095 ::) dllsearchpath=$testbindir;;
7096 *) func_append dllsearchpath ":$testbindir";;
7104 if test X-lc = "X$arg" || test X-lm = "X$arg"; then
7106 *-*-cygwin* | *-*-mingw* | *-*-pw32* | *-*-beos* | *-cegcc* | *-*-haiku*)
7107 # These systems don't actually have a C or math library (as such)
7111 # These systems don't actually have a C library (as such)
7112 test X-lc = "X$arg" && continue
7114 *-*-openbsd* | *-*-freebsd* | *-*-dragonfly* | *-*-bitrig*)
7115 # Do not include libc due to us having libc/libc_r.
7116 test X-lc = "X$arg" && continue
7118 *-*-rhapsody* | *-*-darwin1.[012])
7119 # Rhapsody C and math libraries are in the System framework
7120 func_append deplibs " System.ltframework"
7123 *-*-sco3.2v5* | *-*-sco5v6*)
7124 # Causes problems with __ctype
7125 test X-lc = "X$arg" && continue
7127 *-*-sysv4.2uw2* | *-*-sysv5* | *-*-unixware* | *-*-OpenUNIX*)
7128 # Compiler inserts libc in the correct place for threads to work
7129 test X-lc = "X$arg" && continue
7132 elif test X-lc_r = "X$arg"; then
7134 *-*-openbsd* | *-*-freebsd* | *-*-dragonfly* | *-*-bitrig*)
7135 # Do not include libc_r directly, use -pthread flag.
7140 func_append deplibs " $arg"
7154 # Tru64 UNIX uses -model [arg] to determine the layout of C++
7155 # classes, name mangling, and exception handling.
7156 # Darwin uses the -arch flag to determine output architecture.
7157 -model|-arch|-isysroot|--sysroot)
7158 func_append compiler_flags " $arg"
7159 func_append compile_command " $arg"
7160 func_append finalize_command " $arg"
7165 -mt|-mthreads|-kthread|-Kthread|-pthread|-pthreads|--thread-safe \
7166 |-threads|-fopenmp|-openmp|-mp|-xopenmp|-omp|-qsmp=*)
7167 func_append compiler_flags " $arg"
7168 func_append compile_command " $arg"
7169 func_append finalize_command " $arg"
7170 case "$new_inherited_linker_flags " in
7172 * ) func_append new_inherited_linker_flags " $arg" ;;
7178 single_module=$wl-multi_module
7189 *-*-cygwin* | *-*-mingw* | *-*-pw32* | *-*-os2* | *-*-darwin* | *-cegcc*)
7190 # The PATH hackery in wrapper scripts is required on Windows
7191 # and Darwin in order for the loader to find any dlls it needs.
7192 func_warning "'-no-install' is ignored for $host"
7193 func_warning "assuming '-no-fast-install' instead"
7196 *) no_install=yes ;;
7218 -precious-files-regex)
7239 func_stripname '-R' '' "$arg"
7240 dir=$func_stripname_result
7241 # We need an absolute path.
7243 [\\/]* | [A-Za-z]:[\\/]*) ;;
7245 func_stripname '=' '' "$dir"
7246 dir=$lt_sysroot$func_stripname_result
7249 func_fatal_error "only absolute run-paths are allowed"
7254 *) func_append xrpath " $dir" ;;
7260 # The effects of -shared are defined in a previous loop.
7269 -static | -static-libtool-libs)
7270 # The effects of -static are defined in a previous loop.
7271 # We used to do the same as -all-static on platforms that
7272 # didn't have a PIC flag, but the assumption that the effects
7273 # would be equivalent was wrong. It would break on at least
7274 # Digital Unix and AIX.
7300 func_stripname '-Wc,' '' "$arg"
7301 args=$func_stripname_result
7303 save_ifs=$IFS; IFS=,
7304 for flag in $args; do
7306 func_quote_for_eval "$flag"
7307 func_append arg " $func_quote_for_eval_result"
7308 func_append compiler_flags " $func_quote_for_eval_result"
7311 func_stripname ' ' '' "$arg"
7312 arg=$func_stripname_result
7316 func_stripname '-Wl,' '' "$arg"
7317 args=$func_stripname_result
7319 save_ifs=$IFS; IFS=,
7320 for flag in $args; do
7322 func_quote_for_eval "$flag"
7323 func_append arg " $wl$func_quote_for_eval_result"
7324 func_append compiler_flags " $wl$func_quote_for_eval_result"
7325 func_append linker_flags " $func_quote_for_eval_result"
7328 func_stripname ' ' '' "$arg"
7329 arg=$func_stripname_result
7349 func_quote_for_eval "$arg"
7350 arg=$func_quote_for_eval_result
7353 # Flags to be passed through unchanged, with rationale:
7354 # -64, -mips[0-9] enable 64-bit mode for the SGI compiler
7355 # -r[0-9][0-9]* specify processor for the SGI compiler
7356 # -xarch=*, -xtarget=* enable 64-bit mode for the Sun compiler
7357 # +DA*, +DD* enable 64-bit mode for the HP compiler
7358 # -q* compiler args for the IBM compiler
7359 # -m*, -t[45]*, -txscale* architecture-specific flags for GCC
7360 # -F/path path to uninstalled frameworks, gcc on darwin
7361 # -p, -pg, --coverage, -fprofile-* profiling flags for GCC
7362 # -fstack-protector* stack protector flags for GCC
7363 # @file GCC response files
7364 # -tp=* Portland pgcc target processor selection
7365 # --sysroot=* for sysroot support
7366 # -O*, -g*, -flto*, -fwhopr*, -fuse-linker-plugin GCC link-time optimization
7367 # -specs=* GCC specs files
7368 # -stdlib=* select c++ std lib with clang
7369 # -fsanitize=* Clang/GCC memory and address sanitizer
7370 # -fuse-ld=* Linker select flags for GCC
7371 # -static-* direct GCC to link specific libraries statically
7372 # -fcilkplus Cilk Plus language extension features for C/C++
7373 -64|-mips[0-9]|-r[0-9][0-9]*|-xarch=*|-xtarget=*|+DA*|+DD*|-q*|-m*| \
7374 -t[45]*|-txscale*|-p|-pg|--coverage|-fprofile-*|-F*|@*|-tp=*|--sysroot=*| \
7375 -O*|-g*|-flto*|-fwhopr*|-fuse-linker-plugin|-fstack-protector*|-stdlib=*| \
7376 -specs=*|-fsanitize=*|-fuse-ld=*|-static-*|-fcilkplus)
7377 func_quote_for_eval "$arg"
7378 arg=$func_quote_for_eval_result
7379 func_append compile_command " $arg"
7380 func_append finalize_command " $arg"
7381 func_append compiler_flags " $arg"
7386 if test os2 = "`expr $host : '.*\(os2\)'`"; then
7387 # OS/2 uses -Zxxx to specify OS/2-specific options
7388 compiler_flags="$compiler_flags $arg"
7389 func_append compile_command " $arg"
7390 func_append finalize_command " $arg"
7398 # Otherwise treat like 'Some other compiler flag' below
7399 func_quote_for_eval "$arg"
7400 arg=$func_quote_for_eval_result
7404 # Some other compiler flag.
7406 func_quote_for_eval "$arg"
7407 arg=$func_quote_for_eval_result
7411 # A standard object.
7412 func_append objs " $arg"
7416 # A libtool-controlled object.
7418 # Check to see that this really is a libtool object.
7419 if func_lalib_unsafe_p "$arg"; then
7426 if test -z "$pic_object" ||
7427 test -z "$non_pic_object" ||
7428 test none = "$pic_object" &&
7429 test none = "$non_pic_object"; then
7430 func_fatal_error "cannot find name of object for '$arg'"
7433 # Extract subdirectory from the argument.
7434 func_dirname "$arg" "/" ""
7435 xdir=$func_dirname_result
7437 test none = "$pic_object" || {
7438 # Prepend the subdirectory the object is found in.
7439 pic_object=$xdir$pic_object
7441 if test dlfiles = "$prev"; then
7442 if test yes = "$build_libtool_libs" && test yes = "$dlopen_support"; then
7443 func_append dlfiles " $pic_object"
7447 # If libtool objects are unsupported, then we need to preload.
7452 # CHECK ME: I think I busted this. -Ossama
7453 if test dlprefiles = "$prev"; then
7454 # Preload the old-style object.
7455 func_append dlprefiles " $pic_object"
7460 func_append libobjs " $pic_object"
7465 if test none != "$non_pic_object"; then
7466 # Prepend the subdirectory the object is found in.
7467 non_pic_object=$xdir$non_pic_object
7469 # A standard non-PIC object
7470 func_append non_pic_objects " $non_pic_object"
7471 if test -z "$pic_object" || test none = "$pic_object"; then
7475 # If the PIC object exists, use it instead.
7476 # $xdir was prepended to $pic_object above.
7477 non_pic_object=$pic_object
7478 func_append non_pic_objects " $non_pic_object"
7481 # Only an error if not doing a dry-run.
7482 if $opt_dry_run; then
7483 # Extract subdirectory from the argument.
7484 func_dirname "$arg" "/" ""
7485 xdir=$func_dirname_result
7488 pic_object=$xdir$objdir/$func_lo2o_result
7489 non_pic_object=$xdir$func_lo2o_result
7490 func_append libobjs " $pic_object"
7491 func_append non_pic_objects " $non_pic_object"
7493 func_fatal_error "'$arg' is not a valid libtool object"
7500 func_append deplibs " $arg"
7501 func_append old_deplibs " $arg"
7506 # A libtool-controlled library.
7508 func_resolve_sysroot "$arg"
7509 if test dlfiles = "$prev"; then
7510 # This library was specified with -dlopen.
7511 func_append dlfiles " $func_resolve_sysroot_result"
7513 elif test dlprefiles = "$prev"; then
7514 # The library was specified with -dlpreopen.
7515 func_append dlprefiles " $func_resolve_sysroot_result"
7518 func_append deplibs " $func_resolve_sysroot_result"
7523 # Some other compiler argument.
7525 # Unknown arguments in both finalize_command and compile_command need
7526 # to be aesthetically quoted because they are evaled later.
7527 func_quote_for_eval "$arg"
7528 arg=$func_quote_for_eval_result
7532 # Now actually substitute the argument into the commands.
7533 if test -n "$arg"; then
7534 func_append compile_command " $arg"
7535 func_append finalize_command " $arg"
7537 done # argument parsing loop
7539 test -n "$prev" && \
7540 func_fatal_help "the '$prevarg' option requires an argument"
7542 if test yes = "$export_dynamic" && test -n "$export_dynamic_flag_spec"; then
7543 eval arg=\"$export_dynamic_flag_spec\"
7544 func_append compile_command " $arg"
7545 func_append finalize_command " $arg"
7549 # calculate the name of the file, without its directory
7550 func_basename "$output"
7551 outputname=$func_basename_result
7552 libobjs_save=$libobjs
7554 if test -n "$shlibpath_var"; then
7555 # get the directories listed in $shlibpath_var
7556 eval shlib_search_path=\`\$ECHO \"\$$shlibpath_var\" \| \$SED \'s/:/ /g\'\`
7560 eval sys_lib_search_path=\"$sys_lib_search_path_spec\"
7561 eval sys_lib_dlsearch_path=\"$sys_lib_dlsearch_path_spec\"
7563 # Definition is injected by LT_CONFIG during libtool generation.
7564 func_munge_path_list sys_lib_dlsearch_path "$LT_SYS_LIBRARY_PATH"
7566 func_dirname "$output" "/" ""
7567 output_objdir=$func_dirname_result$objdir
7568 func_to_tool_file "$output_objdir/"
7569 tool_output_objdir=$func_to_tool_file_result
7570 # Create the object directory.
7571 func_mkdir_p "$output_objdir"
7573 # Determine the type of output
7576 func_fatal_help "you must specify an output file"
7578 *.$libext) linkmode=oldlib ;;
7579 *.lo | *.$objext) linkmode=obj ;;
7580 *.la) linkmode=lib ;;
7581 *) linkmode=prog ;; # Anything else should be a program.
7587 # Find all interdependent deplibs by searching for libraries
7588 # that are linked more than once (e.g. -la -lb -la)
7589 for deplib in $deplibs; do
7590 if $opt_preserve_dup_deps; then
7592 *" $deplib "*) func_append specialdeplibs " $deplib" ;;
7595 func_append libs " $deplib"
7598 if test lib = "$linkmode"; then
7599 libs="$predeps $libs $compiler_lib_search_path $postdeps"
7601 # Compute libraries that are listed more than once in $predeps
7602 # $postdeps and mark them as special (i.e., whose duplicates are
7603 # not to be eliminated).
7605 if $opt_duplicate_compiler_generated_deps; then
7606 for pre_post_dep in $predeps $postdeps; do
7607 case "$pre_post_deps " in
7608 *" $pre_post_dep "*) func_append specialdeplibs " $pre_post_deps" ;;
7610 func_append pre_post_deps " $pre_post_dep"
7619 need_relink=no # whether we're linking any uninstalled libtool libraries
7620 notinst_deplibs= # not-installed libtool libraries
7621 notinst_path= # paths that contain not-installed libtool libraries
7625 passes="conv dlpreopen link"
7626 for file in $dlfiles $dlprefiles; do
7630 func_fatal_help "libraries can '-dlopen' only libtool libraries: $file"
7641 passes="conv scan dlopen dlpreopen link"
7647 for pass in $passes; do
7648 # The preopen pass in lib mode reverses $deplibs; put it back here
7649 # so that -L comes before libs that need it for instance...
7650 if test lib,link = "$linkmode,$pass"; then
7651 ## FIXME: Find the place where the list is rebuilt in the wrong
7652 ## order, and fix it there properly
7654 for deplib in $deplibs; do
7655 tmp_deplibs="$deplib $tmp_deplibs"
7657 deplibs=$tmp_deplibs
7660 if test lib,link = "$linkmode,$pass" ||
7661 test prog,scan = "$linkmode,$pass"; then
7665 if test prog = "$linkmode"; then
7667 dlopen) libs=$dlfiles ;;
7668 dlpreopen) libs=$dlprefiles ;;
7670 libs="$deplibs %DEPLIBS%"
7671 test "X$link_all_deplibs" != Xno && libs="$libs $dependency_libs"
7675 if test lib,dlpreopen = "$linkmode,$pass"; then
7676 # Collect and forward deplibs of preopened libtool libs
7677 for lib in $dlprefiles; do
7678 # Ignore non-libtool-libs
7680 func_resolve_sysroot "$lib"
7682 *.la) func_source "$func_resolve_sysroot_result" ;;
7685 # Collect preopened libtool deplibs, except any this library
7686 # has declared as weak libs
7687 for deplib in $dependency_libs; do
7688 func_basename "$deplib"
7689 deplib_base=$func_basename_result
7690 case " $weak_libs " in
7691 *" $deplib_base "*) ;;
7692 *) func_append deplibs " $deplib" ;;
7698 if test dlopen = "$pass"; then
7699 # Collect dlpreopened libraries
7700 save_deplibs=$deplibs
7704 for deplib in $libs; do
7708 -mt|-mthreads|-kthread|-Kthread|-pthread|-pthreads|--thread-safe \
7709 |-threads|-fopenmp|-openmp|-mp|-xopenmp|-omp|-qsmp=*)
7710 if test prog,link = "$linkmode,$pass"; then
7711 compile_deplibs="$deplib $compile_deplibs"
7712 finalize_deplibs="$deplib $finalize_deplibs"
7714 func_append compiler_flags " $deplib"
7715 if test lib = "$linkmode"; then
7716 case "$new_inherited_linker_flags " in
7718 * ) func_append new_inherited_linker_flags " $deplib" ;;
7725 if test lib != "$linkmode" && test prog != "$linkmode"; then
7726 func_warning "'-l' is ignored for archives/objects"
7729 func_stripname '-l' '' "$deplib"
7730 name=$func_stripname_result
7731 if test lib = "$linkmode"; then
7732 searchdirs="$newlib_search_path $lib_search_path $compiler_lib_search_dirs $sys_lib_search_path $shlib_search_path"
7734 searchdirs="$newlib_search_path $lib_search_path $sys_lib_search_path $shlib_search_path"
7736 for searchdir in $searchdirs; do
7737 for search_ext in .la $std_shrext .so .a; do
7738 # Search the libtool library
7739 lib=$searchdir/lib$name$search_ext
7740 if test -f "$lib"; then
7741 if test .la = "$search_ext"; then
7751 # deplib is a libtool library
7752 # If $allow_libtool_libs_with_static_runtimes && $deplib is a stdlib,
7753 # We need to do some special things here, and not later.
7754 if test yes = "$allow_libtool_libs_with_static_runtimes"; then
7755 case " $predeps $postdeps " in
7757 if func_lalib_p "$lib"; then
7761 for l in $old_library $library_names; do
7764 if test "X$ll" = "X$old_library"; then # only static version available
7766 func_dirname "$lib" "" "."
7767 ladir=$func_dirname_result
7768 lib=$ladir/$old_library
7769 if test prog,link = "$linkmode,$pass"; then
7770 compile_deplibs="$deplib $compile_deplibs"
7771 finalize_deplibs="$deplib $finalize_deplibs"
7773 deplibs="$deplib $deplibs"
7774 test lib = "$linkmode" && newdependency_libs="$deplib $newdependency_libs"
7784 # deplib doesn't seem to be a libtool library
7785 if test prog,link = "$linkmode,$pass"; then
7786 compile_deplibs="$deplib $compile_deplibs"
7787 finalize_deplibs="$deplib $finalize_deplibs"
7789 deplibs="$deplib $deplibs"
7790 test lib = "$linkmode" && newdependency_libs="$deplib $newdependency_libs"
7796 if test prog,link = "$linkmode,$pass"; then
7797 compile_deplibs="$deplib $compile_deplibs"
7798 finalize_deplibs="$deplib $finalize_deplibs"
7800 deplibs="$deplib $deplibs"
7801 if test lib = "$linkmode"; then
7802 case "$new_inherited_linker_flags " in
7804 * ) func_append new_inherited_linker_flags " $deplib" ;;
7813 deplibs="$deplib $deplibs"
7814 test conv = "$pass" && continue
7815 newdependency_libs="$deplib $newdependency_libs"
7816 func_stripname '-L' '' "$deplib"
7817 func_resolve_sysroot "$func_stripname_result"
7818 func_append newlib_search_path " $func_resolve_sysroot_result"
7821 if test conv = "$pass"; then
7822 deplibs="$deplib $deplibs"
7825 if test scan = "$pass"; then
7826 deplibs="$deplib $deplibs"
7828 compile_deplibs="$deplib $compile_deplibs"
7829 finalize_deplibs="$deplib $finalize_deplibs"
7831 func_stripname '-L' '' "$deplib"
7832 func_resolve_sysroot "$func_stripname_result"
7833 func_append newlib_search_path " $func_resolve_sysroot_result"
7836 func_warning "'-L' is ignored for archives/objects"
7842 if test link = "$pass"; then
7843 func_stripname '-R' '' "$deplib"
7844 func_resolve_sysroot "$func_stripname_result"
7845 dir=$func_resolve_sysroot_result
7846 # Make sure the xrpath contains only unique directories.
7849 *) func_append xrpath " $dir" ;;
7852 deplibs="$deplib $deplibs"
7856 func_resolve_sysroot "$deplib"
7857 lib=$func_resolve_sysroot_result
7860 if test conv = "$pass"; then
7861 deplibs="$deplib $deplibs"
7866 # Linking convenience modules into shared libraries is allowed,
7867 # but linking other static libraries is non-portable.
7868 case " $dlpreconveniencelibs " in
7872 case $deplibs_check_method in
7874 set dummy $deplibs_check_method; shift
7875 match_pattern_regex=`expr "$deplibs_check_method" : "$1 \(.*\)"`
7876 if eval "\$ECHO \"$deplib\"" 2>/dev/null | $SED 10q \
7877 | $EGREP "$match_pattern_regex" > /dev/null; then
7885 if $valid_a_lib; then
7887 $ECHO "*** Warning: Linking the shared library $output against the"
7888 $ECHO "*** static library $deplib is not portable!"
7889 deplibs="$deplib $deplibs"
7892 $ECHO "*** Warning: Trying to link with static lib archive $deplib."
7893 echo "*** I have the capability to make that library automatically link in when"
7894 echo "*** you link to this library. But I can only do this if you have a"
7895 echo "*** shared version of the library, which you do not appear to have"
7896 echo "*** because the file extensions .$libext of this argument makes me believe"
7897 echo "*** that it is just a static archive that I should not use here."
7904 if test link != "$pass"; then
7905 deplibs="$deplib $deplibs"
7907 compile_deplibs="$deplib $compile_deplibs"
7908 finalize_deplibs="$deplib $finalize_deplibs"
7915 if test conv = "$pass"; then
7916 deplibs="$deplib $deplibs"
7917 elif test prog = "$linkmode"; then
7918 if test dlpreopen = "$pass" || test yes != "$dlopen_support" || test no = "$build_libtool_libs"; then
7919 # If there is no dlopen support or we're linking statically,
7920 # we need to preload.
7921 func_append newdlprefiles " $deplib"
7922 compile_deplibs="$deplib $compile_deplibs"
7923 finalize_deplibs="$deplib $finalize_deplibs"
7925 func_append newdlfiles " $deplib"
7936 $found || test -f "$lib" \
7937 || func_fatal_error "cannot find the library '$lib' or unhandled argument '$deplib'"
7939 # Check to see that this really is a libtool archive.
7940 func_lalib_unsafe_p "$lib" \
7941 || func_fatal_error "'$lib' is not a valid libtool archive"
7943 func_dirname "$lib" "" "."
7944 ladir=$func_dirname_result
7952 inherited_linker_flags=
7953 # If the library was installed with an old release of libtool,
7954 # it will not redefine variables installed, or shouldnotlink
7963 # Convert "-framework foo" to "foo.ltframework"
7964 if test -n "$inherited_linker_flags"; then
7965 tmp_inherited_linker_flags=`$ECHO "$inherited_linker_flags" | $SED 's/-framework \([^ $]*\)/\1.ltframework/g'`
7966 for tmp_inherited_linker_flag in $tmp_inherited_linker_flags; do
7967 case " $new_inherited_linker_flags " in
7968 *" $tmp_inherited_linker_flag "*) ;;
7969 *) func_append new_inherited_linker_flags " $tmp_inherited_linker_flag";;
7973 dependency_libs=`$ECHO " $dependency_libs" | $SED 's% \([^ $]*\).ltframework% -framework \1%g'`
7974 if test lib,link = "$linkmode,$pass" ||
7975 test prog,scan = "$linkmode,$pass" ||
7976 { test prog != "$linkmode" && test lib != "$linkmode"; }; then
7977 test -n "$dlopen" && func_append dlfiles " $dlopen"
7978 test -n "$dlpreopen" && func_append dlprefiles " $dlpreopen"
7981 if test conv = "$pass"; then
7982 # Only check for convenience libraries
7983 deplibs="$lib $deplibs"
7984 if test -z "$libdir"; then
7985 if test -z "$old_library"; then
7986 func_fatal_error "cannot find name of link library for '$lib'"
7988 # It is a libtool convenience library, so add in its objects.
7989 func_append convenience " $ladir/$objdir/$old_library"
7990 func_append old_convenience " $ladir/$objdir/$old_library"
7992 for deplib in $dependency_libs; do
7993 deplibs="$deplib $deplibs"
7994 if $opt_preserve_dup_deps; then
7995 case "$tmp_libs " in
7996 *" $deplib "*) func_append specialdeplibs " $deplib" ;;
7999 func_append tmp_libs " $deplib"
8001 elif test prog != "$linkmode" && test lib != "$linkmode"; then
8002 func_fatal_error "'$lib' is not a convenience library"
8008 # Get the name of the library we link against.
8010 if test -n "$old_library" &&
8011 { test yes = "$prefer_static_libs" ||
8012 test built,no = "$prefer_static_libs,$installed"; }; then
8013 linklib=$old_library
8015 for l in $old_library $library_names; do
8019 if test -z "$linklib"; then
8020 func_fatal_error "cannot find name of link library for '$lib'"
8023 # This library was specified with -dlopen.
8024 if test dlopen = "$pass"; then
8026 && func_fatal_error "cannot -dlopen a convenience library: '$lib'"
8027 if test -z "$dlname" ||
8028 test yes != "$dlopen_support" ||
8029 test no = "$build_libtool_libs"
8031 # If there is no dlname, no dlopen support or we're linking
8032 # statically, we need to preload. We also need to preload any
8033 # dependent libraries so libltdl's deplib preloader doesn't
8034 # bomb out in the load deplibs phase.
8035 func_append dlprefiles " $lib $dependency_libs"
8037 func_append newdlfiles " $lib"
8042 # We need an absolute path.
8044 [\\/]* | [A-Za-z]:[\\/]*) abs_ladir=$ladir ;;
8046 abs_ladir=`cd "$ladir" && pwd`
8047 if test -z "$abs_ladir"; then
8048 func_warning "cannot determine absolute directory name of '$ladir'"
8049 func_warning "passing it literally to the linker, although it might fail"
8054 func_basename "$lib"
8055 laname=$func_basename_result
8057 # Find the relevant object directory and library name.
8058 if test yes = "$installed"; then
8059 if test ! -f "$lt_sysroot$libdir/$linklib" && test -f "$abs_ladir/$linklib"; then
8060 func_warning "library '$lib' was moved."
8065 dir=$lt_sysroot$libdir
8066 absdir=$lt_sysroot$libdir
8068 test yes = "$hardcode_automatic" && avoidtemprpath=yes
8070 if test ! -f "$ladir/$objdir/$linklib" && test -f "$abs_ladir/$linklib"; then
8073 # Remove this search path later
8074 func_append notinst_path " $abs_ladir"
8077 absdir=$abs_ladir/$objdir
8078 # Remove this search path later
8079 func_append notinst_path " $abs_ladir"
8081 fi # $installed = yes
8082 func_stripname 'lib' '.la' "$laname"
8083 name=$func_stripname_result
8085 # This library was specified with -dlpreopen.
8086 if test dlpreopen = "$pass"; then
8087 if test -z "$libdir" && test prog = "$linkmode"; then
8088 func_fatal_error "only libraries may -dlpreopen a convenience library: '$lib'"
8091 # special handling for platforms with PE-DLLs.
8092 *cygwin* | *mingw* | *cegcc* )
8093 # Linker will automatically link against shared library if both
8094 # static and shared are present. Therefore, ensure we extract
8095 # symbols from the import library if a shared library is present
8096 # (otherwise, the dlopen module name will be incorrect). We do
8097 # this by putting the import library name into $newdlprefiles.
8098 # We recover the dlopen module name by 'saving' the la file
8099 # name in a special purpose variable, and (later) extracting the
8100 # dlname from the la file.
8101 if test -n "$dlname"; then
8102 func_tr_sh "$dir/$linklib"
8103 eval "libfile_$func_tr_sh_result=\$abs_ladir/\$laname"
8104 func_append newdlprefiles " $dir/$linklib"
8106 func_append newdlprefiles " $dir/$old_library"
8107 # Keep a list of preopened convenience libraries to check
8108 # that they are being used correctly in the link pass.
8109 test -z "$libdir" && \
8110 func_append dlpreconveniencelibs " $dir/$old_library"
8114 # Prefer using a static library (so that no silly _DYNAMIC symbols
8115 # are required to link).
8116 if test -n "$old_library"; then
8117 func_append newdlprefiles " $dir/$old_library"
8118 # Keep a list of preopened convenience libraries to check
8119 # that they are being used correctly in the link pass.
8120 test -z "$libdir" && \
8121 func_append dlpreconveniencelibs " $dir/$old_library"
8122 # Otherwise, use the dlname, so that lt_dlopen finds it.
8123 elif test -n "$dlname"; then
8124 func_append newdlprefiles " $dir/$dlname"
8126 func_append newdlprefiles " $dir/$linklib"
8130 fi # $pass = dlpreopen
8132 if test -z "$libdir"; then
8133 # Link the convenience library
8134 if test lib = "$linkmode"; then
8135 deplibs="$dir/$old_library $deplibs"
8136 elif test prog,link = "$linkmode,$pass"; then
8137 compile_deplibs="$dir/$old_library $compile_deplibs"
8138 finalize_deplibs="$dir/$old_library $finalize_deplibs"
8140 deplibs="$lib $deplibs" # used for prog,scan pass
8146 if test prog = "$linkmode" && test link != "$pass"; then
8147 func_append newlib_search_path " $ladir"
8148 deplibs="$lib $deplibs"
8150 linkalldeplibs=false
8151 if test no != "$link_all_deplibs" || test -z "$library_names" ||
8152 test no = "$build_libtool_libs"; then
8157 for deplib in $dependency_libs; do
8159 -L*) func_stripname '-L' '' "$deplib"
8160 func_resolve_sysroot "$func_stripname_result"
8161 func_append newlib_search_path " $func_resolve_sysroot_result"
8164 # Need to link against all dependency_libs?
8165 if $linkalldeplibs; then
8166 deplibs="$deplib $deplibs"
8168 # Need to hardcode shared library paths
8169 # or/and link against static libraries
8170 newdependency_libs="$deplib $newdependency_libs"
8172 if $opt_preserve_dup_deps; then
8173 case "$tmp_libs " in
8174 *" $deplib "*) func_append specialdeplibs " $deplib" ;;
8177 func_append tmp_libs " $deplib"
8180 fi # $linkmode = prog...
8182 if test prog,link = "$linkmode,$pass"; then
8183 if test -n "$library_names" &&
8184 { { test no = "$prefer_static_libs" ||
8185 test built,yes = "$prefer_static_libs,$installed"; } ||
8186 test -z "$old_library"; }; then
8187 # We need to hardcode the library path
8188 if test -n "$shlibpath_var" && test -z "$avoidtemprpath"; then
8189 # Make sure the rpath contains only unique directories.
8190 case $temp_rpath: in
8192 *) func_append temp_rpath "$absdir:" ;;
8196 # Hardcode the library path.
8197 # Skip directories that are in the system default run-time
8199 case " $sys_lib_dlsearch_path " in
8202 case "$compile_rpath " in
8204 *) func_append compile_rpath " $absdir" ;;
8208 case " $sys_lib_dlsearch_path " in
8211 case "$finalize_rpath " in
8213 *) func_append finalize_rpath " $libdir" ;;
8217 fi # $linkmode,$pass = prog,link...
8220 { test pass_all = "$deplibs_check_method" ||
8221 { test yes = "$build_libtool_libs" &&
8222 test -n "$library_names"; }; }; then
8223 # We only need to search for static libraries
8228 link_static=no # Whether the deplib will be linked statically
8229 use_static_libs=$prefer_static_libs
8230 if test built = "$use_static_libs" && test yes = "$installed"; then
8233 if test -n "$library_names" &&
8234 { test no = "$use_static_libs" || test -z "$old_library"; }; then
8236 *cygwin* | *mingw* | *cegcc* | *os2*)
8237 # No point in relinking DLLs because paths are not encoded
8238 func_append notinst_deplibs " $lib"
8242 if test no = "$installed"; then
8243 func_append notinst_deplibs " $lib"
8248 # This is a shared library
8250 # Warn about portability, can't link against -module's on some
8251 # systems (darwin). Don't bleat about dlopened modules though!
8253 for dlpremoduletest in $dlprefiles; do
8254 if test "X$dlpremoduletest" = "X$lib"; then
8255 dlopenmodule=$dlpremoduletest
8259 if test -z "$dlopenmodule" && test yes = "$shouldnotlink" && test link = "$pass"; then
8261 if test prog = "$linkmode"; then
8262 $ECHO "*** Warning: Linking the executable $output against the loadable module"
8264 $ECHO "*** Warning: Linking the shared library $output against the loadable module"
8266 $ECHO "*** $linklib is not portable!"
8268 if test lib = "$linkmode" &&
8269 test yes = "$hardcode_into_libs"; then
8270 # Hardcode the library path.
8271 # Skip directories that are in the system default run-time
8273 case " $sys_lib_dlsearch_path " in
8276 case "$compile_rpath " in
8278 *) func_append compile_rpath " $absdir" ;;
8282 case " $sys_lib_dlsearch_path " in
8285 case "$finalize_rpath " in
8287 *) func_append finalize_rpath " $libdir" ;;
8293 if test -n "$old_archive_from_expsyms_cmds"; then
8294 # figure out the soname
8295 set dummy $library_names
8299 libname=`eval "\\$ECHO \"$libname_spec\""`
8300 # use dlname if we got it. it's perfectly good, no?
8301 if test -n "$dlname"; then
8303 elif test -n "$soname_spec"; then
8306 *cygwin* | mingw* | *cegcc* | *os2*)
8307 func_arith $current - $age
8308 major=$func_arith_result
8312 eval soname=\"$soname_spec\"
8317 # Make a new name for the extract_expsyms_cmds to use
8319 func_basename "$soroot"
8320 soname=$func_basename_result
8321 func_stripname 'lib' '.dll' "$soname"
8322 newlib=libimp-$func_stripname_result.a
8324 # If the library has no export list, then create one now
8325 if test -f "$output_objdir/$soname-def"; then :
8327 func_verbose "extracting exported symbol list from '$soname'"
8328 func_execute_cmds "$extract_expsyms_cmds" 'exit $?'
8332 if test -f "$output_objdir/$newlib"; then :; else
8333 func_verbose "generating import library for '$soname'"
8334 func_execute_cmds "$old_archive_from_expsyms_cmds" 'exit $?'
8336 # make sure the library variables are pointing to the new library
8339 fi # test -n "$old_archive_from_expsyms_cmds"
8341 if test prog = "$linkmode" || test relink != "$opt_mode"; then
8346 case $hardcode_action in
8347 immediate | unsupported)
8348 if test no = "$hardcode_direct"; then
8351 *-*-sco3.2v5.0.[024]*) add_dir=-L$dir ;;
8352 *-*-sysv4*uw2*) add_dir=-L$dir ;;
8353 *-*-sysv5OpenUNIX* | *-*-sysv5UnixWare7.[01].[10]* | \
8354 *-*-unixware7*) add_dir=-L$dir ;;
8356 # if the lib is a (non-dlopened) module then we cannot
8357 # link against it, someone is ignoring the earlier warnings
8358 if /usr/bin/file -L $add 2> /dev/null |
8359 $GREP ": [^:]* bundle" >/dev/null; then
8360 if test "X$dlopenmodule" != "X$lib"; then
8361 $ECHO "*** Warning: lib $linklib is a module, not a shared library"
8362 if test -z "$old_library"; then
8364 echo "*** And there doesn't seem to be a static archive available"
8365 echo "*** The link will probably fail, sorry"
8367 add=$dir/$old_library
8369 elif test -n "$old_library"; then
8370 add=$dir/$old_library
8374 elif test no = "$hardcode_minus_L"; then
8376 *-*-sunos*) add_shlibpath=$dir ;;
8380 elif test no = "$hardcode_shlibpath_var"; then
8388 if test yes = "$hardcode_direct" &&
8389 test no = "$hardcode_direct_absolute"; then
8391 elif test yes = "$hardcode_minus_L"; then
8393 # Try looking first in the location we're being installed to.
8394 if test -n "$inst_prefix_dir"; then
8397 func_append add_dir " -L$inst_prefix_dir$libdir"
8402 elif test yes = "$hardcode_shlibpath_var"; then
8412 if test yes != "$lib_linked"; then
8413 func_fatal_configuration "unsupported hardcode properties"
8416 if test -n "$add_shlibpath"; then
8417 case :$compile_shlibpath: in
8418 *":$add_shlibpath:"*) ;;
8419 *) func_append compile_shlibpath "$add_shlibpath:" ;;
8422 if test prog = "$linkmode"; then
8423 test -n "$add_dir" && compile_deplibs="$add_dir $compile_deplibs"
8424 test -n "$add" && compile_deplibs="$add $compile_deplibs"
8426 test -n "$add_dir" && deplibs="$add_dir $deplibs"
8427 test -n "$add" && deplibs="$add $deplibs"
8428 if test yes != "$hardcode_direct" &&
8429 test yes != "$hardcode_minus_L" &&
8430 test yes = "$hardcode_shlibpath_var"; then
8431 case :$finalize_shlibpath: in
8433 *) func_append finalize_shlibpath "$libdir:" ;;
8439 if test prog = "$linkmode" || test relink = "$opt_mode"; then
8443 # Finalize command for both is simple: just hardcode it.
8444 if test yes = "$hardcode_direct" &&
8445 test no = "$hardcode_direct_absolute"; then
8446 add=$libdir/$linklib
8447 elif test yes = "$hardcode_minus_L"; then
8450 elif test yes = "$hardcode_shlibpath_var"; then
8451 case :$finalize_shlibpath: in
8453 *) func_append finalize_shlibpath "$libdir:" ;;
8456 elif test yes = "$hardcode_automatic"; then
8457 if test -n "$inst_prefix_dir" &&
8458 test -f "$inst_prefix_dir$libdir/$linklib"; then
8459 add=$inst_prefix_dir$libdir/$linklib
8461 add=$libdir/$linklib
8464 # We cannot seem to hardcode it, guess we'll fake it.
8466 # Try looking first in the location we're being installed to.
8467 if test -n "$inst_prefix_dir"; then
8470 func_append add_dir " -L$inst_prefix_dir$libdir"
8477 if test prog = "$linkmode"; then
8478 test -n "$add_dir" && finalize_deplibs="$add_dir $finalize_deplibs"
8479 test -n "$add" && finalize_deplibs="$add $finalize_deplibs"
8481 test -n "$add_dir" && deplibs="$add_dir $deplibs"
8482 test -n "$add" && deplibs="$add $deplibs"
8485 elif test prog = "$linkmode"; then
8486 # Here we assume that one of hardcode_direct or hardcode_minus_L
8487 # is not unsupported. This is valid on all known static and
8489 if test unsupported != "$hardcode_direct"; then
8490 test -n "$old_library" && linklib=$old_library
8491 compile_deplibs="$dir/$linklib $compile_deplibs"
8492 finalize_deplibs="$dir/$linklib $finalize_deplibs"
8494 compile_deplibs="-l$name -L$dir $compile_deplibs"
8495 finalize_deplibs="-l$name -L$dir $finalize_deplibs"
8497 elif test yes = "$build_libtool_libs"; then
8498 # Not a shared library
8499 if test pass_all != "$deplibs_check_method"; then
8500 # We're trying link a shared library against a static one
8501 # but the system doesn't support it.
8503 # Just print a warning and add the library to dependency_libs so
8504 # that the program can be linked against the static library.
8506 $ECHO "*** Warning: This system cannot link to static lib archive $lib."
8507 echo "*** I have the capability to make that library automatically link in when"
8508 echo "*** you link to this library. But I can only do this if you have a"
8509 echo "*** shared version of the library, which you do not appear to have."
8510 if test yes = "$module"; then
8511 echo "*** But as you try to build a module library, libtool will still create "
8512 echo "*** a static module, that should work as long as the dlopening application"
8513 echo "*** is linked with the -dlopen flag to resolve symbols at runtime."
8514 if test -z "$global_symbol_pipe"; then
8516 echo "*** However, this would only work if libtool was able to extract symbol"
8517 echo "*** lists from a program, using 'nm' or equivalent, but libtool could"
8518 echo "*** not find such a program. So, this module is probably useless."
8519 echo "*** 'nm' from GNU binutils and a full rebuild may help."
8521 if test no = "$build_old_libs"; then
8522 build_libtool_libs=module
8525 build_libtool_libs=no
8529 deplibs="$dir/$old_library $deplibs"
8532 fi # link shared/static library?
8534 if test lib = "$linkmode"; then
8535 if test -n "$dependency_libs" &&
8536 { test yes != "$hardcode_into_libs" ||
8537 test yes = "$build_old_libs" ||
8538 test yes = "$link_static"; }; then
8539 # Extract -R from dependency_libs
8541 for libdir in $dependency_libs; do
8543 -R*) func_stripname '-R' '' "$libdir"
8544 temp_xrpath=$func_stripname_result
8546 *" $temp_xrpath "*) ;;
8547 *) func_append xrpath " $temp_xrpath";;
8549 *) func_append temp_deplibs " $libdir";;
8552 dependency_libs=$temp_deplibs
8555 func_append newlib_search_path " $absdir"
8556 # Link against this library
8557 test no = "$link_static" && newdependency_libs="$abs_ladir/$laname $newdependency_libs"
8558 # ... and its dependency_libs
8560 for deplib in $dependency_libs; do
8561 newdependency_libs="$deplib $newdependency_libs"
8563 -L*) func_stripname '-L' '' "$deplib"
8564 func_resolve_sysroot "$func_stripname_result";;
8565 *) func_resolve_sysroot "$deplib" ;;
8567 if $opt_preserve_dup_deps; then
8568 case "$tmp_libs " in
8569 *" $func_resolve_sysroot_result "*)
8570 func_append specialdeplibs " $func_resolve_sysroot_result" ;;
8573 func_append tmp_libs " $func_resolve_sysroot_result"
8576 if test no != "$link_all_deplibs"; then
8577 # Add the search paths of all dependency libraries
8578 for deplib in $dependency_libs; do
8581 -L*) path=$deplib ;;
8583 func_resolve_sysroot "$deplib"
8584 deplib=$func_resolve_sysroot_result
8585 func_dirname "$deplib" "" "."
8586 dir=$func_dirname_result
8587 # We need an absolute path.
8589 [\\/]* | [A-Za-z]:[\\/]*) absdir=$dir ;;
8591 absdir=`cd "$dir" && pwd`
8592 if test -z "$absdir"; then
8593 func_warning "cannot determine absolute directory name of '$dir'"
8598 if $GREP "^installed=no" $deplib > /dev/null; then
8602 eval deplibrary_names=`$SED -n -e 's/^library_names=\(.*\)$/\1/p' $deplib`
8603 if test -n "$deplibrary_names"; then
8604 for tmp in $deplibrary_names; do
8607 if test -f "$absdir/$objdir/$depdepl"; then
8608 depdepl=$absdir/$objdir/$depdepl
8609 darwin_install_name=`$OTOOL -L $depdepl | awk '{if (NR == 2) {print $1;exit}}'`
8610 if test -z "$darwin_install_name"; then
8611 darwin_install_name=`$OTOOL64 -L $depdepl | awk '{if (NR == 2) {print $1;exit}}'`
8613 func_append compiler_flags " $wl-dylib_file $wl$darwin_install_name:$depdepl"
8614 func_append linker_flags " -dylib_file $darwin_install_name:$depdepl"
8620 path=-L$absdir/$objdir
8624 eval libdir=`$SED -n -e 's/^libdir=\(.*\)$/\1/p' $deplib`
8625 test -z "$libdir" && \
8626 func_fatal_error "'$deplib' is not a valid libtool archive"
8627 test "$absdir" != "$libdir" && \
8628 func_warning "'$deplib' seems to be moved"
8634 case " $deplibs " in
8636 *) deplibs="$path $deplibs" ;;
8639 fi # link_all_deplibs != no
8641 done # for deplib in $libs
8642 if test link = "$pass"; then
8643 if test prog = "$linkmode"; then
8644 compile_deplibs="$new_inherited_linker_flags $compile_deplibs"
8645 finalize_deplibs="$new_inherited_linker_flags $finalize_deplibs"
8647 compiler_flags="$compiler_flags "`$ECHO " $new_inherited_linker_flags" | $SED 's% \([^ $]*\).ltframework% -framework \1%g'`
8650 dependency_libs=$newdependency_libs
8651 if test dlpreopen = "$pass"; then
8652 # Link the dlpreopened libraries before other libraries
8653 for deplib in $save_deplibs; do
8654 deplibs="$deplib $deplibs"
8657 if test dlopen != "$pass"; then
8658 test conv = "$pass" || {
8659 # Make sure lib_search_path contains only unique directories.
8661 for dir in $newlib_search_path; do
8662 case "$lib_search_path " in
8664 *) func_append lib_search_path " $dir" ;;
8670 if test prog,link = "$linkmode,$pass"; then
8671 vars="compile_deplibs finalize_deplibs"
8675 for var in $vars dependency_libs; do
8676 # Add libraries to $var in reverse order
8677 eval tmp_libs=\"\$$var\"
8679 for deplib in $tmp_libs; do
8680 # FIXME: Pedantically, this is the right thing to do, so
8681 # that some nasty dependency loop isn't accidentally
8683 #new_libs="$deplib $new_libs"
8684 # Pragmatically, this seems to cause very few problems in
8687 -L*) new_libs="$deplib $new_libs" ;;
8690 # And here is the reason: when a library appears more
8691 # than once as an explicit dependence of a library, or
8692 # is implicitly linked in more than once by the
8693 # compiler, it is considered special, and multiple
8694 # occurrences thereof are not removed. Compare this
8695 # with having the same library being listed as a
8696 # dependency of multiple other libraries: in this case,
8697 # we know (pedantically, we assume) the library does not
8698 # need to be listed more than once, so we keep only the
8699 # last copy. This is not always right, but it is rare
8700 # enough that we require users that really mean to play
8701 # such unportable linking tricks to link the library
8702 # using -Wl,-lname, so that libtool does not consider it
8703 # for duplicate removal.
8704 case " $specialdeplibs " in
8705 *" $deplib "*) new_libs="$deplib $new_libs" ;;
8707 case " $new_libs " in
8709 *) new_libs="$deplib $new_libs" ;;
8717 for deplib in $new_libs; do
8720 case " $tmp_libs " in
8722 *) func_append tmp_libs " $deplib" ;;
8725 *) func_append tmp_libs " $deplib" ;;
8728 eval $var=\"$tmp_libs\"
8732 # Add Sun CC postdeps if required:
8733 test CXX = "$tagname" && {
8736 case `$CC -V 2>&1 | sed 5q` in
8737 *Sun\ C*) # Sun C++ 5.9
8740 if test no != "$suncc_use_cstd_abi"; then
8741 func_append postdeps ' -library=Cstd -library=Crun'
8748 func_cc_basename "$CC"
8749 case $func_cc_basename_result in
8753 if test no != "$suncc_use_cstd_abi"; then
8754 func_append postdeps ' -library=Cstd -library=Crun'
8762 # Last step: remove runtime libs from dependency_libs
8763 # (they stay in deplibs)
8765 for i in $dependency_libs; do
8766 case " $predeps $postdeps $compiler_lib_search_path " in
8771 if test -n "$i"; then
8772 func_append tmp_libs " $i"
8775 dependency_libs=$tmp_libs
8777 if test prog = "$linkmode"; then
8780 if test prog = "$linkmode" || test lib = "$linkmode"; then
8781 dlprefiles=$newdlprefiles
8786 if test -n "$dlfiles$dlprefiles" || test no != "$dlself"; then
8787 func_warning "'-dlopen' is ignored for archives"
8792 func_warning "'-l' and '-L' are ignored for archives" ;;
8795 test -n "$rpath" && \
8796 func_warning "'-rpath' is ignored for archives"
8798 test -n "$xrpath" && \
8799 func_warning "'-R' is ignored for archives"
8801 test -n "$vinfo" && \
8802 func_warning "'-version-info/-version-number' is ignored for archives"
8804 test -n "$release" && \
8805 func_warning "'-release' is ignored for archives"
8807 test -n "$export_symbols$export_symbols_regex" && \
8808 func_warning "'-export-symbols' is ignored for archives"
8810 # Now set the variables for building old libraries.
8811 build_libtool_libs=no
8813 func_append objs "$old_deplibs"
8817 # Make sure we only generate libraries of the form 'libNAME.la'.
8820 func_stripname 'lib' '.la' "$outputname"
8821 name=$func_stripname_result
8822 eval shared_ext=\"$shrext_cmds\"
8823 eval libname=\"$libname_spec\"
8826 test no = "$module" \
8827 && func_fatal_help "libtool library '$output' must begin with 'lib'"
8829 if test no != "$need_lib_prefix"; then
8830 # Add the "lib" prefix for modules if required
8831 func_stripname '' '.la' "$outputname"
8832 name=$func_stripname_result
8833 eval shared_ext=\"$shrext_cmds\"
8834 eval libname=\"$libname_spec\"
8836 func_stripname '' '.la' "$outputname"
8837 libname=$func_stripname_result
8842 if test -n "$objs"; then
8843 if test pass_all != "$deplibs_check_method"; then
8844 func_fatal_error "cannot build libtool library '$output' from non-libtool objects on this host:$objs"
8847 $ECHO "*** Warning: Linking the shared library $output against the non-libtool"
8848 $ECHO "*** objects $objs is not portable!"
8849 func_append libobjs " $objs"
8853 test no = "$dlself" \
8854 || func_warning "'-dlopen self' is ignored for libtool libraries"
8859 && func_warning "ignoring multiple '-rpath's for a libtool library"
8864 if test -z "$rpath"; then
8865 if test yes = "$build_libtool_libs"; then
8866 # Building a libtool convenience library.
8867 # Some compilers have problems with a '.al' extension so
8868 # convenience libraries should have the same extension an
8869 # archive normally would.
8870 oldlibs="$output_objdir/$libname.$libext $oldlibs"
8871 build_libtool_libs=convenience
8875 test -n "$vinfo" && \
8876 func_warning "'-version-info/-version-number' is ignored for convenience libraries"
8878 test -n "$release" && \
8879 func_warning "'-release' is ignored for convenience libraries"
8882 # Parse the version information argument.
8883 save_ifs=$IFS; IFS=:
8884 set dummy $vinfo 0 0 0
8889 func_fatal_help "too many parameters to '-version-info'"
8891 # convert absolute version numbers to libtool ages
8892 # this retains compatibility with .la files and attempts
8893 # to make the code below a bit more comprehensible
8895 case $vinfo_number in
8901 # There are really only two kinds -- those that
8902 # use the current revision as the major version
8903 # and those that subtract age and use age as
8904 # a minor version. But, then there is irix
8905 # that has an extra 1 added just for fun
8907 case $version_type in
8908 # correct linux to gnu/linux during the next big refactor
8909 darwin|freebsd-elf|linux|osf|windows|none)
8910 func_arith $number_major + $number_minor
8911 current=$func_arith_result
8913 revision=$number_revision
8915 freebsd-aout|qnx|sunos)
8916 current=$number_major
8917 revision=$number_minor
8921 func_arith $number_major + $number_minor
8922 current=$func_arith_result
8924 revision=$number_minor
8925 lt_irix_increment=no
8928 func_fatal_configuration "$modename: unknown library version type '$version_type'"
8939 # Check that each of the things are valid numbers.
8941 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]) ;;
8943 func_error "CURRENT '$current' must be a nonnegative integer"
8944 func_fatal_error "'$vinfo' is not valid version information"
8949 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]) ;;
8951 func_error "REVISION '$revision' must be a nonnegative integer"
8952 func_fatal_error "'$vinfo' is not valid version information"
8957 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]) ;;
8959 func_error "AGE '$age' must be a nonnegative integer"
8960 func_fatal_error "'$vinfo' is not valid version information"
8964 if test "$age" -gt "$current"; then
8965 func_error "AGE '$age' is greater than the current interface number '$current'"
8966 func_fatal_error "'$vinfo' is not valid version information"
8969 # Calculate the version variables.
8973 case $version_type in
8977 # Like Linux, but with the current version available in
8978 # verstring for coding it into the library header
8979 func_arith $current - $age
8980 major=.$func_arith_result
8981 versuffix=$major.$age.$revision
8982 # Darwin ld doesn't like 0 for these options...
8983 func_arith $current + 1
8984 minor_current=$func_arith_result
8985 xlcverstring="$wl-compatibility_version $wl$minor_current $wl-current_version $wl$minor_current.$revision"
8986 verstring="-compatibility_version $minor_current -current_version $minor_current.$revision"
8987 # On Darwin other compilers
8990 verstring="$wl-compatibility_version $wl$minor_current $wl-current_version $wl$minor_current.$revision"
8993 verstring="-compatibility_version $minor_current -current_version $minor_current.$revision"
9000 versuffix=.$current.$revision
9004 func_arith $current - $age
9005 major=.$func_arith_result
9006 versuffix=$major.$age.$revision
9010 if test no = "$lt_irix_increment"; then
9011 func_arith $current - $age
9013 func_arith $current - $age + 1
9015 major=$func_arith_result
9017 case $version_type in
9018 nonstopux) verstring_prefix=nonstopux ;;
9019 *) verstring_prefix=sgi ;;
9021 verstring=$verstring_prefix$major.$revision
9023 # Add in all the interfaces that we are compatible with.
9025 while test 0 -ne "$loop"; do
9026 func_arith $revision - $loop
9027 iface=$func_arith_result
9028 func_arith $loop - 1
9029 loop=$func_arith_result
9030 verstring=$verstring_prefix$major.$iface:$verstring
9033 # Before this point, $major must not contain '.'.
9035 versuffix=$major.$revision
9038 linux) # correct to gnu/linux during the next big refactor
9039 func_arith $current - $age
9040 major=.$func_arith_result
9041 versuffix=$major.$age.$revision
9045 func_arith $current - $age
9046 major=.$func_arith_result
9047 versuffix=.$current.$age.$revision
9048 verstring=$current.$age.$revision
9050 # Add in all the interfaces that we are compatible with.
9052 while test 0 -ne "$loop"; do
9053 func_arith $current - $loop
9054 iface=$func_arith_result
9055 func_arith $loop - 1
9056 loop=$func_arith_result
9057 verstring=$verstring:$iface.0
9060 # Make executables depend on our current version.
9061 func_append verstring ":$current.0"
9076 versuffix=.$current.$revision
9080 # Use '-' rather than '.', since we only want one
9081 # extension on DOS 8.3 file systems.
9082 func_arith $current - $age
9083 major=$func_arith_result
9088 func_fatal_configuration "unknown library version type '$version_type'"
9092 # Clear the version info if we defaulted, and they specified a release.
9093 if test -z "$vinfo" && test -n "$release"; then
9095 case $version_type in
9097 # we can't check for "0.0" in archive_cmds due to quoting
9098 # problems, so we reset it completely
9105 if test no = "$need_version"; then
9112 # Remove version info from name if versioning should be avoided
9113 if test yes,no = "$avoid_version,$need_version"; then
9119 # Check to see if the archive will have undefined symbols.
9120 if test yes = "$allow_undefined"; then
9121 if test unsupported = "$allow_undefined_flag"; then
9122 if test yes = "$build_old_libs"; then
9123 func_warning "undefined symbols not allowed in $host shared libraries; building static only"
9124 build_libtool_libs=no
9126 func_fatal_error "can't build $host shared library unless -no-undefined is specified"
9130 # Don't allow undefined symbols.
9131 allow_undefined_flag=$no_undefined_flag
9136 func_generate_dlsyms "$libname" "$libname" :
9137 func_append libobjs " $symfileobj"
9138 test " " = "$libobjs" && libobjs=
9140 if test relink != "$opt_mode"; then
9141 # Remove our outputs, but don't remove object files since they
9142 # may have been created when compiling PIC objects.
9144 tempremovelist=`$ECHO "$output_objdir/*"`
9145 for p in $tempremovelist; do
9149 $output_objdir/$outputname | $output_objdir/$libname.* | $output_objdir/$libname$release.*)
9150 if test -n "$precious_files_regex"; then
9151 if $ECHO "$p" | $EGREP -e "$precious_files_regex" >/dev/null 2>&1
9156 func_append removelist " $p"
9161 test -n "$removelist" && \
9162 func_show_eval "${RM}r \$removelist"
9165 # Now set the variables for building old libraries.
9166 if test yes = "$build_old_libs" && test convenience != "$build_libtool_libs"; then
9167 func_append oldlibs " $output_objdir/$libname.$libext"
9169 # Transform .lo files to .o files.
9170 oldobjs="$objs "`$ECHO "$libobjs" | $SP2NL | $SED "/\.$libext$/d; $lo2o" | $NL2SP`
9173 # Eliminate all temporary directories.
9174 #for path in $notinst_path; do
9175 # lib_search_path=`$ECHO "$lib_search_path " | $SED "s% $path % %g"`
9176 # deplibs=`$ECHO "$deplibs " | $SED "s% -L$path % %g"`
9177 # dependency_libs=`$ECHO "$dependency_libs " | $SED "s% -L$path % %g"`
9180 if test -n "$xrpath"; then
9181 # If the user specified any rpath flags, then add them.
9183 for libdir in $xrpath; do
9184 func_replace_sysroot "$libdir"
9185 func_append temp_xrpath " -R$func_replace_sysroot_result"
9186 case "$finalize_rpath " in
9188 *) func_append finalize_rpath " $libdir" ;;
9191 if test yes != "$hardcode_into_libs" || test yes = "$build_old_libs"; then
9192 dependency_libs="$temp_xrpath $dependency_libs"
9196 # Make sure dlfiles contains only unique files that won't be dlpreopened
9197 old_dlfiles=$dlfiles
9199 for lib in $old_dlfiles; do
9200 case " $dlprefiles $dlfiles " in
9202 *) func_append dlfiles " $lib" ;;
9206 # Make sure dlprefiles contains only unique files
9207 old_dlprefiles=$dlprefiles
9209 for lib in $old_dlprefiles; do
9210 case "$dlprefiles " in
9212 *) func_append dlprefiles " $lib" ;;
9216 if test yes = "$build_libtool_libs"; then
9217 if test -n "$rpath"; then
9219 *-*-cygwin* | *-*-mingw* | *-*-pw32* | *-*-os2* | *-*-beos* | *-cegcc* | *-*-haiku*)
9220 # these systems don't actually have a c library (as such)!
9222 *-*-rhapsody* | *-*-darwin1.[012])
9223 # Rhapsody C library is in the System framework
9224 func_append deplibs " System.ltframework"
9227 # Don't link with libc until the a.out ld.so is fixed.
9229 *-*-openbsd* | *-*-freebsd* | *-*-dragonfly*)
9230 # Do not include libc due to us having libc/libc_r.
9232 *-*-sco3.2v5* | *-*-sco5v6*)
9233 # Causes problems with __ctype
9235 *-*-sysv4.2uw2* | *-*-sysv5* | *-*-unixware* | *-*-OpenUNIX*)
9236 # Compiler inserts libc in the correct place for threads to work
9239 # Add libc to deplibs on all other systems if necessary.
9240 if test yes = "$build_libtool_need_lc"; then
9241 func_append deplibs " -lc"
9247 # Transform deplibs into only deplibs that can be linked in shared.
9249 libname_save=$libname
9250 release_save=$release
9251 versuffix_save=$versuffix
9253 # I'm not sure if I'm treating the release correctly. I think
9254 # release should show up in the -l (ie -lgmp5) so we don't want to
9255 # add it in twice. Is that correct?
9261 case $deplibs_check_method in
9263 # Don't check for shared/static. Everything works.
9264 # This might be a little naive. We might want to check
9265 # whether the library exists or not. But this is on
9266 # osf3 & osf4 and I'm not really sure... Just
9267 # implementing what was already the behavior.
9271 # This code stresses the "libraries are programs" paradigm to its
9272 # limits. Maybe even breaks it. We compile a program, linking it
9273 # against the deplibs as a proxy for the library. Then we can check
9274 # whether they linked in statically or dynamically with ldd.
9275 $opt_dry_run || $RM conftest.c
9276 cat > conftest.c <<EOF
9277 int main() { return 0; }
9279 $opt_dry_run || $RM conftest
9280 if $LTCC $LTCFLAGS -o conftest conftest.c $deplibs; then
9281 ldd_output=`ldd conftest`
9282 for i in $deplibs; do
9285 func_stripname -l '' "$i"
9286 name=$func_stripname_result
9287 if test yes = "$allow_libtool_libs_with_static_runtimes"; then
9288 case " $predeps $postdeps " in
9290 func_append newdeplibs " $i"
9295 if test -n "$i"; then
9296 libname=`eval "\\$ECHO \"$libname_spec\""`
9297 deplib_matches=`eval "\\$ECHO \"$library_names_spec\""`
9298 set dummy $deplib_matches; shift
9300 if test `expr "$ldd_output" : ".*$deplib_match"` -ne 0; then
9301 func_append newdeplibs " $i"
9305 $ECHO "*** Warning: dynamic linker does not accept needed library $i."
9306 echo "*** I have the capability to make that library automatically link in when"
9307 echo "*** you link to this library. But I can only do this if you have a"
9308 echo "*** shared version of the library, which I believe you do not have"
9309 echo "*** because a test_compile did reveal that the linker did not use it for"
9310 echo "*** its dynamic dependency list that programs get resolved with at runtime."
9315 func_append newdeplibs " $i"
9320 # Error occurred in the first compile. Let's try to salvage
9321 # the situation: Compile a separate program for each library.
9322 for i in $deplibs; do
9325 func_stripname -l '' "$i"
9326 name=$func_stripname_result
9327 $opt_dry_run || $RM conftest
9328 if $LTCC $LTCFLAGS -o conftest conftest.c $i; then
9329 ldd_output=`ldd conftest`
9330 if test yes = "$allow_libtool_libs_with_static_runtimes"; then
9331 case " $predeps $postdeps " in
9333 func_append newdeplibs " $i"
9338 if test -n "$i"; then
9339 libname=`eval "\\$ECHO \"$libname_spec\""`
9340 deplib_matches=`eval "\\$ECHO \"$library_names_spec\""`
9341 set dummy $deplib_matches; shift
9343 if test `expr "$ldd_output" : ".*$deplib_match"` -ne 0; then
9344 func_append newdeplibs " $i"
9348 $ECHO "*** Warning: dynamic linker does not accept needed library $i."
9349 echo "*** I have the capability to make that library automatically link in when"
9350 echo "*** you link to this library. But I can only do this if you have a"
9351 echo "*** shared version of the library, which you do not appear to have"
9352 echo "*** because a test_compile did reveal that the linker did not use this one"
9353 echo "*** as a dynamic dependency that programs can get resolved with at runtime."
9359 $ECHO "*** Warning! Library $i is needed by this library but I was not able to"
9360 echo "*** make it link in! You will probably need to install it or some"
9361 echo "*** library that it depends on before this library will be fully"
9362 echo "*** functional. Installing it before continuing would be even better."
9366 func_append newdeplibs " $i"
9373 set dummy $deplibs_check_method; shift
9374 file_magic_regex=`expr "$deplibs_check_method" : "$1 \(.*\)"`
9375 for a_deplib in $deplibs; do
9378 func_stripname -l '' "$a_deplib"
9379 name=$func_stripname_result
9380 if test yes = "$allow_libtool_libs_with_static_runtimes"; then
9381 case " $predeps $postdeps " in
9383 func_append newdeplibs " $a_deplib"
9388 if test -n "$a_deplib"; then
9389 libname=`eval "\\$ECHO \"$libname_spec\""`
9390 if test -n "$file_magic_glob"; then
9391 libnameglob=`func_echo_all "$libname" | $SED -e $file_magic_glob`
9393 libnameglob=$libname
9395 test yes = "$want_nocaseglob" && nocaseglob=`shopt -p nocaseglob`
9396 for i in $lib_search_path $sys_lib_search_path $shlib_search_path; do
9397 if test yes = "$want_nocaseglob"; then
9399 potential_libs=`ls $i/$libnameglob[.-]* 2>/dev/null`
9402 potential_libs=`ls $i/$libnameglob[.-]* 2>/dev/null`
9404 for potent_lib in $potential_libs; do
9405 # Follow soft links.
9406 if ls -lLd "$potent_lib" 2>/dev/null |
9407 $GREP " -> " >/dev/null; then
9410 # The statement above tries to avoid entering an
9411 # endless loop below, in case of cyclic links.
9412 # We might still enter an endless loop, since a link
9413 # loop can be closed while we follow links,
9416 while test -h "$potlib" 2>/dev/null; do
9417 potliblink=`ls -ld $potlib | $SED 's/.* -> //'`
9419 [\\/]* | [A-Za-z]:[\\/]*) potlib=$potliblink;;
9420 *) potlib=`$ECHO "$potlib" | $SED 's|[^/]*$||'`"$potliblink";;
9423 if eval $file_magic_cmd \"\$potlib\" 2>/dev/null |
9425 $EGREP "$file_magic_regex" > /dev/null; then
9426 func_append newdeplibs " $a_deplib"
9433 if test -n "$a_deplib"; then
9436 $ECHO "*** Warning: linker path does not have real file for library $a_deplib."
9437 echo "*** I have the capability to make that library automatically link in when"
9438 echo "*** you link to this library. But I can only do this if you have a"
9439 echo "*** shared version of the library, which you do not appear to have"
9440 echo "*** because I did check the linker path looking for a file starting"
9441 if test -z "$potlib"; then
9442 $ECHO "*** with $libname but no candidates were found. (...for file magic test)"
9444 $ECHO "*** with $libname and none of the candidates passed a file format test"
9445 $ECHO "*** using a file magic. Last file checked: $potlib"
9450 # Add a -L argument.
9451 func_append newdeplibs " $a_deplib"
9454 done # Gone through all deplibs.
9457 set dummy $deplibs_check_method; shift
9458 match_pattern_regex=`expr "$deplibs_check_method" : "$1 \(.*\)"`
9459 for a_deplib in $deplibs; do
9462 func_stripname -l '' "$a_deplib"
9463 name=$func_stripname_result
9464 if test yes = "$allow_libtool_libs_with_static_runtimes"; then
9465 case " $predeps $postdeps " in
9467 func_append newdeplibs " $a_deplib"
9472 if test -n "$a_deplib"; then
9473 libname=`eval "\\$ECHO \"$libname_spec\""`
9474 for i in $lib_search_path $sys_lib_search_path $shlib_search_path; do
9475 potential_libs=`ls $i/$libname[.-]* 2>/dev/null`
9476 for potent_lib in $potential_libs; do
9477 potlib=$potent_lib # see symlink-check above in file_magic test
9478 if eval "\$ECHO \"$potent_lib\"" 2>/dev/null | $SED 10q | \
9479 $EGREP "$match_pattern_regex" > /dev/null; then
9480 func_append newdeplibs " $a_deplib"
9487 if test -n "$a_deplib"; then
9490 $ECHO "*** Warning: linker path does not have real file for library $a_deplib."
9491 echo "*** I have the capability to make that library automatically link in when"
9492 echo "*** you link to this library. But I can only do this if you have a"
9493 echo "*** shared version of the library, which you do not appear to have"
9494 echo "*** because I did check the linker path looking for a file starting"
9495 if test -z "$potlib"; then
9496 $ECHO "*** with $libname but no candidates were found. (...for regex pattern test)"
9498 $ECHO "*** with $libname and none of the candidates passed a file format test"
9499 $ECHO "*** using a regex pattern. Last file checked: $potlib"
9504 # Add a -L argument.
9505 func_append newdeplibs " $a_deplib"
9508 done # Gone through all deplibs.
9512 tmp_deplibs=`$ECHO " $deplibs" | $SED 's/ -lc$//; s/ -[LR][^ ]*//g'`
9513 if test yes = "$allow_libtool_libs_with_static_runtimes"; then
9514 for i in $predeps $postdeps; do
9515 # can't use Xsed below, because $i might contain '/'
9516 tmp_deplibs=`$ECHO " $tmp_deplibs" | $SED "s|$i||"`
9519 case $tmp_deplibs in
9522 if test none = "$deplibs_check_method"; then
9523 echo "*** Warning: inter-library dependencies are not supported in this platform."
9525 echo "*** Warning: inter-library dependencies are not known to be supported."
9527 echo "*** All declared inter-library dependencies are being dropped."
9533 versuffix=$versuffix_save
9535 release=$release_save
9536 libname=$libname_save
9540 *-*-rhapsody* | *-*-darwin1.[012])
9541 # On Rhapsody replace the C library with the System framework
9542 newdeplibs=`$ECHO " $newdeplibs" | $SED 's/ -lc / System.ltframework /'`
9546 if test yes = "$droppeddeps"; then
9547 if test yes = "$module"; then
9549 echo "*** Warning: libtool could not satisfy all declared inter-library"
9550 $ECHO "*** dependencies of module $libname. Therefore, libtool will create"
9551 echo "*** a static module, that should work as long as the dlopening"
9552 echo "*** application is linked with the -dlopen flag."
9553 if test -z "$global_symbol_pipe"; then
9555 echo "*** However, this would only work if libtool was able to extract symbol"
9556 echo "*** lists from a program, using 'nm' or equivalent, but libtool could"
9557 echo "*** not find such a program. So, this module is probably useless."
9558 echo "*** 'nm' from GNU binutils and a full rebuild may help."
9560 if test no = "$build_old_libs"; then
9561 oldlibs=$output_objdir/$libname.$libext
9562 build_libtool_libs=module
9565 build_libtool_libs=no
9568 echo "*** The inter-library dependencies that have been dropped here will be"
9569 echo "*** automatically added whenever a program is linked with this library"
9570 echo "*** or is declared to -dlopen it."
9572 if test no = "$allow_undefined"; then
9574 echo "*** Since this library must not contain undefined symbols,"
9575 echo "*** because either the platform does not support them or"
9576 echo "*** it was explicitly requested with -no-undefined,"
9577 echo "*** libtool will only create a static version of it."
9578 if test no = "$build_old_libs"; then
9579 oldlibs=$output_objdir/$libname.$libext
9580 build_libtool_libs=module
9583 build_libtool_libs=no
9588 # Done checking deplibs!
9591 # Time to change all our "foo.ltframework" stuff back to "-framework foo"
9594 newdeplibs=`$ECHO " $newdeplibs" | $SED 's% \([^ $]*\).ltframework% -framework \1%g'`
9595 new_inherited_linker_flags=`$ECHO " $new_inherited_linker_flags" | $SED 's% \([^ $]*\).ltframework% -framework \1%g'`
9596 deplibs=`$ECHO " $deplibs" | $SED 's% \([^ $]*\).ltframework% -framework \1%g'`
9600 # move library search paths that coincide with paths to not yet
9601 # installed libraries to the beginning of the library search list
9603 for path in $notinst_path; do
9604 case " $new_libs " in
9605 *" -L$path/$objdir "*) ;;
9607 case " $deplibs " in
9608 *" -L$path/$objdir "*)
9609 func_append new_libs " -L$path/$objdir" ;;
9614 for deplib in $deplibs; do
9617 case " $new_libs " in
9619 *) func_append new_libs " $deplib" ;;
9622 *) func_append new_libs " $deplib" ;;
9627 # All the library-specific variables (install_libdir is set above).
9632 # Test again, we may have decided not to build it any more
9633 if test yes = "$build_libtool_libs"; then
9634 # Remove $wl instances when linking with ld.
9635 # FIXME: should test the right _cmds variable.
9636 case $archive_cmds in
9639 if test yes = "$hardcode_into_libs"; then
9640 # Hardcode the library paths
9643 rpath=$finalize_rpath
9644 test relink = "$opt_mode" || rpath=$compile_rpath$rpath
9645 for libdir in $rpath; do
9646 if test -n "$hardcode_libdir_flag_spec"; then
9647 if test -n "$hardcode_libdir_separator"; then
9648 func_replace_sysroot "$libdir"
9649 libdir=$func_replace_sysroot_result
9650 if test -z "$hardcode_libdirs"; then
9651 hardcode_libdirs=$libdir
9653 # Just accumulate the unique libdirs.
9654 case $hardcode_libdir_separator$hardcode_libdirs$hardcode_libdir_separator in
9655 *"$hardcode_libdir_separator$libdir$hardcode_libdir_separator"*)
9658 func_append hardcode_libdirs "$hardcode_libdir_separator$libdir"
9663 eval flag=\"$hardcode_libdir_flag_spec\"
9664 func_append dep_rpath " $flag"
9666 elif test -n "$runpath_var"; then
9667 case "$perm_rpath " in
9669 *) func_append perm_rpath " $libdir" ;;
9673 # Substitute the hardcoded libdirs into the rpath.
9674 if test -n "$hardcode_libdir_separator" &&
9675 test -n "$hardcode_libdirs"; then
9676 libdir=$hardcode_libdirs
9677 eval "dep_rpath=\"$hardcode_libdir_flag_spec\""
9679 if test -n "$runpath_var" && test -n "$perm_rpath"; then
9680 # We should set the runpath_var.
9682 for dir in $perm_rpath; do
9683 func_append rpath "$dir:"
9685 eval "$runpath_var='$rpath\$$runpath_var'; export $runpath_var"
9687 test -n "$dep_rpath" && deplibs="$dep_rpath $deplibs"
9690 shlibpath=$finalize_shlibpath
9691 test relink = "$opt_mode" || shlibpath=$compile_shlibpath$shlibpath
9692 if test -n "$shlibpath"; then
9693 eval "$shlibpath_var='$shlibpath\$$shlibpath_var'; export $shlibpath_var"
9696 # Get the real and link names of the library.
9697 eval shared_ext=\"$shrext_cmds\"
9698 eval library_names=\"$library_names_spec\"
9699 set dummy $library_names
9704 if test -n "$soname_spec"; then
9705 eval soname=\"$soname_spec\"
9709 if test -z "$dlname"; then
9713 lib=$output_objdir/$realname
9717 func_append linknames " $link"
9720 # Use standard objects if they are pic
9721 test -z "$pic_flag" && libobjs=`$ECHO "$libobjs" | $SP2NL | $SED "$lo2o" | $NL2SP`
9722 test "X$libobjs" = "X " && libobjs=
9725 if test -n "$export_symbols" && test -n "$include_expsyms"; then
9726 $opt_dry_run || cp "$export_symbols" "$output_objdir/$libname.uexp"
9727 export_symbols=$output_objdir/$libname.uexp
9728 func_append delfiles " $export_symbols"
9731 orig_export_symbols=
9733 cygwin* | mingw* | cegcc*)
9734 if test -n "$export_symbols" && test -z "$export_symbols_regex"; then
9735 # exporting using user supplied symfile
9736 func_dll_def_p "$export_symbols" || {
9737 # and it's NOT already a .def file. Must figure out
9738 # which of the given symbols are data symbols and tag
9739 # them as such. So, trigger use of export_symbols_cmds.
9740 # export_symbols gets reassigned inside the "prepare
9741 # the list of exported symbols" if statement, so the
9742 # include_expsyms logic still works.
9743 orig_export_symbols=$export_symbols
9745 always_export_symbols=yes
9751 # Prepare the list of exported symbols
9752 if test -z "$export_symbols"; then
9753 if test yes = "$always_export_symbols" || test -n "$export_symbols_regex"; then
9754 func_verbose "generating symbol list for '$libname.la'"
9755 export_symbols=$output_objdir/$libname.exp
9756 $opt_dry_run || $RM $export_symbols
9757 cmds=$export_symbols_cmds
9758 save_ifs=$IFS; IFS='~'
9759 for cmd1 in $cmds; do
9761 # Take the normal branch if the nm_file_list_spec branch
9762 # doesn't work or if tool conversion is not needed.
9763 case $nm_file_list_spec~$to_tool_file_cmd in
9764 *~func_convert_file_noop | *~func_convert_file_msys_to_w32 | ~*)
9765 try_normal_branch=yes
9768 len=$func_len_result
9771 try_normal_branch=no
9774 if test yes = "$try_normal_branch" \
9775 && { test "$len" -lt "$max_cmd_len" \
9776 || test "$max_cmd_len" -le -1; }
9778 func_show_eval "$cmd" 'exit $?'
9779 skipped_export=false
9780 elif test -n "$nm_file_list_spec"; then
9781 func_basename "$output"
9782 output_la=$func_basename_result
9783 save_libobjs=$libobjs
9785 output=$output_objdir/$output_la.nm
9786 func_to_tool_file "$output"
9787 libobjs=$nm_file_list_spec$func_to_tool_file_result
9788 func_append delfiles " $output"
9789 func_verbose "creating $NM input file list: $output"
9790 for obj in $save_libobjs; do
9791 func_to_tool_file "$obj"
9792 $ECHO "$func_to_tool_file_result"
9795 func_show_eval "$cmd" 'exit $?'
9797 libobjs=$save_libobjs
9798 skipped_export=false
9800 # The command line is too long to execute in one step.
9801 func_verbose "using reloadable object file for export list..."
9803 # Break out early, otherwise skipped_export may be
9804 # set to false by a later but shorter cmd.
9809 if test -n "$export_symbols_regex" && test : != "$skipped_export"; then
9810 func_show_eval '$EGREP -e "$export_symbols_regex" "$export_symbols" > "${export_symbols}T"'
9811 func_show_eval '$MV "${export_symbols}T" "$export_symbols"'
9816 if test -n "$export_symbols" && test -n "$include_expsyms"; then
9817 tmp_export_symbols=$export_symbols
9818 test -n "$orig_export_symbols" && tmp_export_symbols=$orig_export_symbols
9819 $opt_dry_run || eval '$ECHO "$include_expsyms" | $SP2NL >> "$tmp_export_symbols"'
9822 if test : != "$skipped_export" && test -n "$orig_export_symbols"; then
9823 # The given exports_symbols file has to be filtered, so filter it.
9824 func_verbose "filter symbol list for '$libname.la' to tag DATA exports"
9825 # FIXME: $output_objdir/$libname.filter potentially contains lots of
9826 # 's' commands, which not all seds can handle. GNU sed should be fine
9827 # though. Also, the filter scales superlinearly with the number of
9828 # global variables. join(1) would be nice here, but unfortunately
9829 # isn't a blessed tool.
9830 $opt_dry_run || $SED -e '/[ ,]DATA/!d;s,\(.*\)\([ \,].*\),s|^\1$|\1\2|,' < $export_symbols > $output_objdir/$libname.filter
9831 func_append delfiles " $export_symbols $output_objdir/$libname.filter"
9832 export_symbols=$output_objdir/$libname.def
9833 $opt_dry_run || $SED -f $output_objdir/$libname.filter < $orig_export_symbols > $export_symbols
9837 for test_deplib in $deplibs; do
9838 case " $convenience " in
9839 *" $test_deplib "*) ;;
9841 func_append tmp_deplibs " $test_deplib"
9845 deplibs=$tmp_deplibs
9847 if test -n "$convenience"; then
9848 if test -n "$whole_archive_flag_spec" &&
9849 test yes = "$compiler_needs_object" &&
9850 test -z "$libobjs"; then
9851 # extract the archives, so we have objects to list.
9852 # TODO: could optimize this to just extract one archive.
9853 whole_archive_flag_spec=
9855 if test -n "$whole_archive_flag_spec"; then
9856 save_libobjs=$libobjs
9857 eval libobjs=\"\$libobjs $whole_archive_flag_spec\"
9858 test "X$libobjs" = "X " && libobjs=
9860 gentop=$output_objdir/${outputname}x
9861 func_append generated " $gentop"
9863 func_extract_archives $gentop $convenience
9864 func_append libobjs " $func_extract_archives_result"
9865 test "X$libobjs" = "X " && libobjs=
9869 if test yes = "$thread_safe" && test -n "$thread_safe_flag_spec"; then
9870 eval flag=\"$thread_safe_flag_spec\"
9871 func_append linker_flags " $flag"
9874 # Make a backup of the uninstalled library when relinking
9875 if test relink = "$opt_mode"; then
9876 $opt_dry_run || eval '(cd $output_objdir && $RM ${realname}U && $MV $realname ${realname}U)' || exit $?
9879 # Do each of the archive commands.
9880 if test yes = "$module" && test -n "$module_cmds"; then
9881 if test -n "$export_symbols" && test -n "$module_expsym_cmds"; then
9882 eval test_cmds=\"$module_expsym_cmds\"
9883 cmds=$module_expsym_cmds
9885 eval test_cmds=\"$module_cmds\"
9889 if test -n "$export_symbols" && test -n "$archive_expsym_cmds"; then
9890 eval test_cmds=\"$archive_expsym_cmds\"
9891 cmds=$archive_expsym_cmds
9893 eval test_cmds=\"$archive_cmds\"
9898 if test : != "$skipped_export" &&
9899 func_len " $test_cmds" &&
9900 len=$func_len_result &&
9901 test "$len" -lt "$max_cmd_len" || test "$max_cmd_len" -le -1; then
9904 # The command line is too long to link in one step, link piecewise
9905 # or, if using GNU ld and skipped_export is not :, use a linker
9908 # Save the value of $output and $libobjs because we want to
9909 # use them later. If we have whole_archive_flag_spec, we
9910 # want to use save_libobjs as it was before
9911 # whole_archive_flag_spec was expanded, because we can't
9912 # assume the linker understands whole_archive_flag_spec.
9913 # This may have to be revisited, in case too many
9914 # convenience libraries get linked in and end up exceeding
9916 if test -z "$convenience" || test -z "$whole_archive_flag_spec"; then
9917 save_libobjs=$libobjs
9920 func_basename "$output"
9921 output_la=$func_basename_result
9923 # Clear the reloadable object creation command queue and
9924 # initialize k to one.
9931 if test -n "$save_libobjs" && test : != "$skipped_export" && test yes = "$with_gnu_ld"; then
9932 output=$output_objdir/$output_la.lnkscript
9933 func_verbose "creating GNU ld script: $output"
9934 echo 'INPUT (' > $output
9935 for obj in $save_libobjs
9937 func_to_tool_file "$obj"
9938 $ECHO "$func_to_tool_file_result" >> $output
9941 func_append delfiles " $output"
9942 func_to_tool_file "$output"
9943 output=$func_to_tool_file_result
9944 elif test -n "$save_libobjs" && test : != "$skipped_export" && test -n "$file_list_spec"; then
9945 output=$output_objdir/$output_la.lnk
9946 func_verbose "creating linker input file list: $output"
9951 if test yes = "$compiler_needs_object"; then
9957 func_to_tool_file "$obj"
9958 $ECHO "$func_to_tool_file_result" >> $output
9960 func_append delfiles " $output"
9961 func_to_tool_file "$output"
9962 output=$firstobj\"$file_list_spec$func_to_tool_file_result\"
9964 if test -n "$save_libobjs"; then
9965 func_verbose "creating reloadable object files..."
9966 output=$output_objdir/$output_la-$k.$objext
9967 eval test_cmds=\"$reload_cmds\"
9968 func_len " $test_cmds"
9969 len0=$func_len_result
9972 # Loop over the list of objects to be linked.
9973 for obj in $save_libobjs
9976 func_arith $len + $func_len_result
9977 len=$func_arith_result
9978 if test -z "$objlist" ||
9979 test "$len" -lt "$max_cmd_len"; then
9980 func_append objlist " $obj"
9982 # The command $test_cmds is almost too long, add a
9983 # command to the queue.
9984 if test 1 -eq "$k"; then
9985 # The first file doesn't have a previous command to add.
9986 reload_objs=$objlist
9987 eval concat_cmds=\"$reload_cmds\"
9989 # All subsequent reloadable object files will link in
9990 # the last one created.
9991 reload_objs="$objlist $last_robj"
9992 eval concat_cmds=\"\$concat_cmds~$reload_cmds~\$RM $last_robj\"
9994 last_robj=$output_objdir/$output_la-$k.$objext
9996 k=$func_arith_result
9997 output=$output_objdir/$output_la-$k.$objext
9999 func_len " $last_robj"
10000 func_arith $len0 + $func_len_result
10001 len=$func_arith_result
10004 # Handle the remaining objects by creating one last
10005 # reloadable object file. All subsequent reloadable object
10006 # files will link in the last one created.
10007 test -z "$concat_cmds" || concat_cmds=$concat_cmds~
10008 reload_objs="$objlist $last_robj"
10009 eval concat_cmds=\"\$concat_cmds$reload_cmds\"
10010 if test -n "$last_robj"; then
10011 eval concat_cmds=\"\$concat_cmds~\$RM $last_robj\"
10013 func_append delfiles " $output"
10019 ${skipped_export-false} && {
10020 func_verbose "generating symbol list for '$libname.la'"
10021 export_symbols=$output_objdir/$libname.exp
10022 $opt_dry_run || $RM $export_symbols
10024 # Append the command to create the export file.
10025 test -z "$concat_cmds" || concat_cmds=$concat_cmds~
10026 eval concat_cmds=\"\$concat_cmds$export_symbols_cmds\"
10027 if test -n "$last_robj"; then
10028 eval concat_cmds=\"\$concat_cmds~\$RM $last_robj\"
10032 test -n "$save_libobjs" &&
10033 func_verbose "creating a temporary reloadable object file: $output"
10035 # Loop through the commands generated above and execute them.
10036 save_ifs=$IFS; IFS='~'
10037 for cmd in $concat_cmds; do
10040 func_quote_for_expand "$cmd"
10041 eval "func_echo $func_quote_for_expand_result"
10043 $opt_dry_run || eval "$cmd" || {
10046 # Restore the uninstalled library and exit
10047 if test relink = "$opt_mode"; then
10048 ( cd "$output_objdir" && \
10049 $RM "${realname}T" && \
10050 $MV "${realname}U" "$realname" )
10058 if test -n "$export_symbols_regex" && ${skipped_export-false}; then
10059 func_show_eval '$EGREP -e "$export_symbols_regex" "$export_symbols" > "${export_symbols}T"'
10060 func_show_eval '$MV "${export_symbols}T" "$export_symbols"'
10064 ${skipped_export-false} && {
10065 if test -n "$export_symbols" && test -n "$include_expsyms"; then
10066 tmp_export_symbols=$export_symbols
10067 test -n "$orig_export_symbols" && tmp_export_symbols=$orig_export_symbols
10068 $opt_dry_run || eval '$ECHO "$include_expsyms" | $SP2NL >> "$tmp_export_symbols"'
10071 if test -n "$orig_export_symbols"; then
10072 # The given exports_symbols file has to be filtered, so filter it.
10073 func_verbose "filter symbol list for '$libname.la' to tag DATA exports"
10074 # FIXME: $output_objdir/$libname.filter potentially contains lots of
10075 # 's' commands, which not all seds can handle. GNU sed should be fine
10076 # though. Also, the filter scales superlinearly with the number of
10077 # global variables. join(1) would be nice here, but unfortunately
10078 # isn't a blessed tool.
10079 $opt_dry_run || $SED -e '/[ ,]DATA/!d;s,\(.*\)\([ \,].*\),s|^\1$|\1\2|,' < $export_symbols > $output_objdir/$libname.filter
10080 func_append delfiles " $export_symbols $output_objdir/$libname.filter"
10081 export_symbols=$output_objdir/$libname.def
10082 $opt_dry_run || $SED -f $output_objdir/$libname.filter < $orig_export_symbols > $export_symbols
10087 # Restore the value of output.
10088 output=$save_output
10090 if test -n "$convenience" && test -n "$whole_archive_flag_spec"; then
10091 eval libobjs=\"\$libobjs $whole_archive_flag_spec\"
10092 test "X$libobjs" = "X " && libobjs=
10094 # Expand the library linking commands again to reset the
10095 # value of $libobjs for piecewise linking.
10097 # Do each of the archive commands.
10098 if test yes = "$module" && test -n "$module_cmds"; then
10099 if test -n "$export_symbols" && test -n "$module_expsym_cmds"; then
10100 cmds=$module_expsym_cmds
10105 if test -n "$export_symbols" && test -n "$archive_expsym_cmds"; then
10106 cmds=$archive_expsym_cmds
10113 if test -n "$delfiles"; then
10114 # Append the command to remove temporary files to $cmds.
10115 eval cmds=\"\$cmds~\$RM $delfiles\"
10118 # Add any objects from preloaded convenience libraries
10119 if test -n "$dlprefiles"; then
10120 gentop=$output_objdir/${outputname}x
10121 func_append generated " $gentop"
10123 func_extract_archives $gentop $dlprefiles
10124 func_append libobjs " $func_extract_archives_result"
10125 test "X$libobjs" = "X " && libobjs=
10128 save_ifs=$IFS; IFS='~'
10129 for cmd in $cmds; do
10134 func_quote_for_expand "$cmd"
10135 eval "func_echo $func_quote_for_expand_result"
10137 $opt_dry_run || eval "$cmd" || {
10140 # Restore the uninstalled library and exit
10141 if test relink = "$opt_mode"; then
10142 ( cd "$output_objdir" && \
10143 $RM "${realname}T" && \
10144 $MV "${realname}U" "$realname" )
10152 # Restore the uninstalled library and exit
10153 if test relink = "$opt_mode"; then
10154 $opt_dry_run || eval '(cd $output_objdir && $RM ${realname}T && $MV $realname ${realname}T && $MV ${realname}U $realname)' || exit $?
10156 if test -n "$convenience"; then
10157 if test -z "$whole_archive_flag_spec"; then
10158 func_show_eval '${RM}r "$gentop"'
10165 # Create links to the real library.
10166 for linkname in $linknames; do
10167 if test "$realname" != "$linkname"; then
10168 func_show_eval '(cd "$output_objdir" && $RM "$linkname" && $LN_S "$realname" "$linkname")' 'exit $?'
10172 # If -module or -export-dynamic was specified, set the dlname.
10173 if test yes = "$module" || test yes = "$export_dynamic"; then
10174 # On all known operating systems, these are identical.
10181 if test -n "$dlfiles$dlprefiles" || test no != "$dlself"; then
10182 func_warning "'-dlopen' is ignored for objects"
10185 case " $deplibs" in
10187 func_warning "'-l' and '-L' are ignored for objects" ;;
10190 test -n "$rpath" && \
10191 func_warning "'-rpath' is ignored for objects"
10193 test -n "$xrpath" && \
10194 func_warning "'-R' is ignored for objects"
10196 test -n "$vinfo" && \
10197 func_warning "'-version-info' is ignored for objects"
10199 test -n "$release" && \
10200 func_warning "'-release' is ignored for objects"
10204 test -n "$objs$old_deplibs" && \
10205 func_fatal_error "cannot build library object '$output' from non-libtool objects"
10208 func_lo2o "$libobj"
10209 obj=$func_lo2o_result
10217 # Delete the old objects.
10218 $opt_dry_run || $RM $obj $libobj
10220 # Objects from convenience libraries. This assumes
10221 # single-version convenience libraries. Whenever we create
10222 # different ones for PIC/non-PIC, this we'll have to duplicate
10226 # if reload_cmds runs $LD directly, get rid of -Wl from
10227 # whole_archive_flag_spec and hope we can get by with turning comma
10229 case $reload_cmds in
10230 *\$LD[\ \$]*) wl= ;;
10232 if test -n "$convenience"; then
10233 if test -n "$whole_archive_flag_spec"; then
10234 eval tmp_whole_archive_flags=\"$whole_archive_flag_spec\"
10235 test -n "$wl" || tmp_whole_archive_flags=`$ECHO "$tmp_whole_archive_flags" | $SED 's|,| |g'`
10236 reload_conv_objs=$reload_objs\ $tmp_whole_archive_flags
10238 gentop=$output_objdir/${obj}x
10239 func_append generated " $gentop"
10241 func_extract_archives $gentop $convenience
10242 reload_conv_objs="$reload_objs $func_extract_archives_result"
10246 # If we're not building shared, we need to use non_pic_objs
10247 test yes = "$build_libtool_libs" || libobjs=$non_pic_objects
10249 # Create the old-style object.
10250 reload_objs=$objs$old_deplibs' '`$ECHO "$libobjs" | $SP2NL | $SED "/\.$libext$/d; /\.lib$/d; $lo2o" | $NL2SP`' '$reload_conv_objs
10253 func_execute_cmds "$reload_cmds" 'exit $?'
10255 # Exit if we aren't doing a library object file.
10256 if test -z "$libobj"; then
10257 if test -n "$gentop"; then
10258 func_show_eval '${RM}r "$gentop"'
10264 test yes = "$build_libtool_libs" || {
10265 if test -n "$gentop"; then
10266 func_show_eval '${RM}r "$gentop"'
10269 # Create an invalid libtool object if no PIC, so that we don't
10270 # accidentally link it into a program.
10271 # $show "echo timestamp > $libobj"
10272 # $opt_dry_run || eval "echo timestamp > $libobj" || exit $?
10276 if test -n "$pic_flag" || test default != "$pic_mode"; then
10277 # Only do commands if we really have different PIC objects.
10278 reload_objs="$libobjs $reload_conv_objs"
10280 func_execute_cmds "$reload_cmds" 'exit $?'
10283 if test -n "$gentop"; then
10284 func_show_eval '${RM}r "$gentop"'
10292 *cygwin*) func_stripname '' '.exe' "$output"
10293 output=$func_stripname_result.exe;;
10295 test -n "$vinfo" && \
10296 func_warning "'-version-info' is ignored for programs"
10298 test -n "$release" && \
10299 func_warning "'-release' is ignored for programs"
10302 && test unknown,unknown,unknown = "$dlopen_support,$dlopen_self,$dlopen_self_static" \
10303 && func_warning "'LT_INIT([dlopen])' not used. Assuming no dlopen support."
10306 *-*-rhapsody* | *-*-darwin1.[012])
10307 # On Rhapsody replace the C library is the System framework
10308 compile_deplibs=`$ECHO " $compile_deplibs" | $SED 's/ -lc / System.ltframework /'`
10309 finalize_deplibs=`$ECHO " $finalize_deplibs" | $SED 's/ -lc / System.ltframework /'`
10315 # Don't allow lazy linking, it breaks C++ global constructors
10316 # But is supposedly fixed on 10.4 or later (yay!).
10317 if test CXX = "$tagname"; then
10318 case ${MACOSX_DEPLOYMENT_TARGET-10.0} in
10320 func_append compile_command " $wl-bind_at_load"
10321 func_append finalize_command " $wl-bind_at_load"
10325 # Time to change all our "foo.ltframework" stuff back to "-framework foo"
10326 compile_deplibs=`$ECHO " $compile_deplibs" | $SED 's% \([^ $]*\).ltframework% -framework \1%g'`
10327 finalize_deplibs=`$ECHO " $finalize_deplibs" | $SED 's% \([^ $]*\).ltframework% -framework \1%g'`
10332 # move library search paths that coincide with paths to not yet
10333 # installed libraries to the beginning of the library search list
10335 for path in $notinst_path; do
10336 case " $new_libs " in
10337 *" -L$path/$objdir "*) ;;
10339 case " $compile_deplibs " in
10340 *" -L$path/$objdir "*)
10341 func_append new_libs " -L$path/$objdir" ;;
10346 for deplib in $compile_deplibs; do
10349 case " $new_libs " in
10351 *) func_append new_libs " $deplib" ;;
10354 *) func_append new_libs " $deplib" ;;
10357 compile_deplibs=$new_libs
10360 func_append compile_command " $compile_deplibs"
10361 func_append finalize_command " $finalize_deplibs"
10363 if test -n "$rpath$xrpath"; then
10364 # If the user specified any rpath flags, then add them.
10365 for libdir in $rpath $xrpath; do
10366 # This is the magic to use -rpath.
10367 case "$finalize_rpath " in
10369 *) func_append finalize_rpath " $libdir" ;;
10374 # Now hardcode the library paths
10377 for libdir in $compile_rpath $finalize_rpath; do
10378 if test -n "$hardcode_libdir_flag_spec"; then
10379 if test -n "$hardcode_libdir_separator"; then
10380 if test -z "$hardcode_libdirs"; then
10381 hardcode_libdirs=$libdir
10383 # Just accumulate the unique libdirs.
10384 case $hardcode_libdir_separator$hardcode_libdirs$hardcode_libdir_separator in
10385 *"$hardcode_libdir_separator$libdir$hardcode_libdir_separator"*)
10388 func_append hardcode_libdirs "$hardcode_libdir_separator$libdir"
10393 eval flag=\"$hardcode_libdir_flag_spec\"
10394 func_append rpath " $flag"
10396 elif test -n "$runpath_var"; then
10397 case "$perm_rpath " in
10399 *) func_append perm_rpath " $libdir" ;;
10403 *-*-cygwin* | *-*-mingw* | *-*-pw32* | *-*-os2* | *-cegcc*)
10404 testbindir=`$ECHO "$libdir" | $SED -e 's*/lib$*/bin*'`
10405 case :$dllsearchpath: in
10407 ::) dllsearchpath=$libdir;;
10408 *) func_append dllsearchpath ":$libdir";;
10410 case :$dllsearchpath: in
10411 *":$testbindir:"*) ;;
10412 ::) dllsearchpath=$testbindir;;
10413 *) func_append dllsearchpath ":$testbindir";;
10418 # Substitute the hardcoded libdirs into the rpath.
10419 if test -n "$hardcode_libdir_separator" &&
10420 test -n "$hardcode_libdirs"; then
10421 libdir=$hardcode_libdirs
10422 eval rpath=\" $hardcode_libdir_flag_spec\"
10424 compile_rpath=$rpath
10428 for libdir in $finalize_rpath; do
10429 if test -n "$hardcode_libdir_flag_spec"; then
10430 if test -n "$hardcode_libdir_separator"; then
10431 if test -z "$hardcode_libdirs"; then
10432 hardcode_libdirs=$libdir
10434 # Just accumulate the unique libdirs.
10435 case $hardcode_libdir_separator$hardcode_libdirs$hardcode_libdir_separator in
10436 *"$hardcode_libdir_separator$libdir$hardcode_libdir_separator"*)
10439 func_append hardcode_libdirs "$hardcode_libdir_separator$libdir"
10444 eval flag=\"$hardcode_libdir_flag_spec\"
10445 func_append rpath " $flag"
10447 elif test -n "$runpath_var"; then
10448 case "$finalize_perm_rpath " in
10450 *) func_append finalize_perm_rpath " $libdir" ;;
10454 # Substitute the hardcoded libdirs into the rpath.
10455 if test -n "$hardcode_libdir_separator" &&
10456 test -n "$hardcode_libdirs"; then
10457 libdir=$hardcode_libdirs
10458 eval rpath=\" $hardcode_libdir_flag_spec\"
10460 finalize_rpath=$rpath
10462 if test -n "$libobjs" && test yes = "$build_old_libs"; then
10463 # Transform all the library objects into standard objects.
10464 compile_command=`$ECHO "$compile_command" | $SP2NL | $SED "$lo2o" | $NL2SP`
10465 finalize_command=`$ECHO "$finalize_command" | $SP2NL | $SED "$lo2o" | $NL2SP`
10468 func_generate_dlsyms "$outputname" "@PROGRAM@" false
10470 # template prelinking step
10471 if test -n "$prelink_cmds"; then
10472 func_execute_cmds "$prelink_cmds" 'exit $?'
10475 wrappers_required=:
10477 *cegcc* | *mingw32ce*)
10478 # Disable wrappers for cegcc and mingw32ce hosts, we are cross compiling anyway.
10479 wrappers_required=false
10481 *cygwin* | *mingw* )
10482 test yes = "$build_libtool_libs" || wrappers_required=false
10485 if test no = "$need_relink" || test yes != "$build_libtool_libs"; then
10486 wrappers_required=false
10490 $wrappers_required || {
10491 # Replace the output file specification.
10492 compile_command=`$ECHO "$compile_command" | $SED 's%@OUTPUT@%'"$output"'%g'`
10493 link_command=$compile_command$compile_rpath
10495 # We have no uninstalled library dependencies, so finalize right now.
10497 func_show_eval "$link_command" 'exit_status=$?'
10499 if test -n "$postlink_cmds"; then
10500 func_to_tool_file "$output"
10501 postlink_cmds=`func_echo_all "$postlink_cmds" | $SED -e 's%@OUTPUT@%'"$output"'%g' -e 's%@TOOL_OUTPUT@%'"$func_to_tool_file_result"'%g'`
10502 func_execute_cmds "$postlink_cmds" 'exit $?'
10505 # Delete the generated files.
10506 if test -f "$output_objdir/${outputname}S.$objext"; then
10507 func_show_eval '$RM "$output_objdir/${outputname}S.$objext"'
10513 if test -n "$compile_shlibpath$finalize_shlibpath"; then
10514 compile_command="$shlibpath_var=\"$compile_shlibpath$finalize_shlibpath\$$shlibpath_var\" $compile_command"
10516 if test -n "$finalize_shlibpath"; then
10517 finalize_command="$shlibpath_var=\"$finalize_shlibpath\$$shlibpath_var\" $finalize_command"
10522 if test -n "$runpath_var"; then
10523 if test -n "$perm_rpath"; then
10524 # We should set the runpath_var.
10526 for dir in $perm_rpath; do
10527 func_append rpath "$dir:"
10529 compile_var="$runpath_var=\"$rpath\$$runpath_var\" "
10531 if test -n "$finalize_perm_rpath"; then
10532 # We should set the runpath_var.
10534 for dir in $finalize_perm_rpath; do
10535 func_append rpath "$dir:"
10537 finalize_var="$runpath_var=\"$rpath\$$runpath_var\" "
10541 if test yes = "$no_install"; then
10542 # We don't need to create a wrapper script.
10543 link_command=$compile_var$compile_command$compile_rpath
10544 # Replace the output file specification.
10545 link_command=`$ECHO "$link_command" | $SED 's%@OUTPUT@%'"$output"'%g'`
10546 # Delete the old output file.
10547 $opt_dry_run || $RM $output
10548 # Link the executable and exit
10549 func_show_eval "$link_command" 'exit $?'
10551 if test -n "$postlink_cmds"; then
10552 func_to_tool_file "$output"
10553 postlink_cmds=`func_echo_all "$postlink_cmds" | $SED -e 's%@OUTPUT@%'"$output"'%g' -e 's%@TOOL_OUTPUT@%'"$func_to_tool_file_result"'%g'`
10554 func_execute_cmds "$postlink_cmds" 'exit $?'
10560 case $hardcode_action,$fast_install in
10562 # Fast installation is not supported
10563 link_command=$compile_var$compile_command$compile_rpath
10564 relink_command=$finalize_var$finalize_command$finalize_rpath
10566 func_warning "this platform does not like uninstalled shared libraries"
10567 func_warning "'$output' will be relinked during installation"
10570 link_command=$finalize_var$compile_command$finalize_rpath
10571 relink_command=`$ECHO "$compile_var$compile_command$compile_rpath" | $SED 's%@OUTPUT@%\$progdir/\$file%g'`
10574 link_command=$compile_var$compile_command$compile_rpath
10575 relink_command=$finalize_var$finalize_command$finalize_rpath
10578 link_command=$finalize_var$compile_command$finalize_rpath
10583 # Replace the output file specification.
10584 link_command=`$ECHO "$link_command" | $SED 's%@OUTPUT@%'"$output_objdir/$outputname"'%g'`
10586 # Delete the old output files.
10587 $opt_dry_run || $RM $output $output_objdir/$outputname $output_objdir/lt-$outputname
10589 func_show_eval "$link_command" 'exit $?'
10591 if test -n "$postlink_cmds"; then
10592 func_to_tool_file "$output_objdir/$outputname"
10593 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'`
10594 func_execute_cmds "$postlink_cmds" 'exit $?'
10597 # Now create the wrapper script.
10598 func_verbose "creating $output"
10600 # Quote the relink command for shipping.
10601 if test -n "$relink_command"; then
10602 # Preserve any variables that may affect compiler behavior
10603 for var in $variables_saved_for_relink; do
10604 if eval test -z \"\${$var+set}\"; then
10605 relink_command="{ test -z \"\${$var+set}\" || $lt_unset $var || { $var=; export $var; }; }; $relink_command"
10606 elif eval var_value=\$$var; test -z "$var_value"; then
10607 relink_command="$var=; export $var; $relink_command"
10609 func_quote_for_eval "$var_value"
10610 relink_command="$var=$func_quote_for_eval_result; export $var; $relink_command"
10613 relink_command="(cd `pwd`; $relink_command)"
10614 relink_command=`$ECHO "$relink_command" | $SED "$sed_quote_subst"`
10617 # Only actually do things if not in dry run mode.
10619 # win32 will think the script is a binary if it has
10620 # a .exe suffix, so we strip it off here.
10622 *.exe) func_stripname '' '.exe' "$output"
10623 output=$func_stripname_result ;;
10625 # test for cygwin because mv fails w/o .exe extensions
10629 func_stripname '' '.exe' "$outputname"
10630 outputname=$func_stripname_result ;;
10634 *cygwin* | *mingw* )
10635 func_dirname_and_basename "$output" "" "."
10636 output_name=$func_basename_result
10637 output_path=$func_dirname_result
10638 cwrappersource=$output_path/$objdir/lt-$output_name.c
10639 cwrapper=$output_path/$output_name.exe
10640 $RM $cwrappersource $cwrapper
10641 trap "$RM $cwrappersource $cwrapper; exit $EXIT_FAILURE" 1 2 15
10643 func_emit_cwrapperexe_src > $cwrappersource
10645 # The wrapper executable is built using the $host compiler,
10646 # because it contains $host paths and files. If cross-
10647 # compiling, it, like the target executable, must be
10648 # executed on the $host or under an emulation environment.
10650 $LTCC $LTCFLAGS -o $cwrapper $cwrappersource
10654 # Now, create the wrapper script for func_source use:
10655 func_ltwrapper_scriptname $cwrapper
10656 $RM $func_ltwrapper_scriptname_result
10657 trap "$RM $func_ltwrapper_scriptname_result; exit $EXIT_FAILURE" 1 2 15
10659 # note: this script will not be executed, so do not chmod.
10660 if test "x$build" = "x$host"; then
10661 $cwrapper --lt-dump-script > $func_ltwrapper_scriptname_result
10663 func_emit_wrapper no > $func_ltwrapper_scriptname_result
10669 trap "$RM $output; exit $EXIT_FAILURE" 1 2 15
10671 func_emit_wrapper no > $output
10680 # See if we need to build an old-fashioned archive.
10681 for oldlib in $oldlibs; do
10683 case $build_libtool_libs in
10685 oldobjs="$libobjs_save $symfileobj"
10686 addlibs=$convenience
10687 build_libtool_libs=no
10690 oldobjs=$libobjs_save
10691 addlibs=$old_convenience
10692 build_libtool_libs=no
10695 oldobjs="$old_deplibs $non_pic_objects"
10696 $preload && test -f "$symfileobj" \
10697 && func_append oldobjs " $symfileobj"
10698 addlibs=$old_convenience
10702 if test -n "$addlibs"; then
10703 gentop=$output_objdir/${outputname}x
10704 func_append generated " $gentop"
10706 func_extract_archives $gentop $addlibs
10707 func_append oldobjs " $func_extract_archives_result"
10710 # Do each command in the archive commands.
10711 if test -n "$old_archive_from_new_cmds" && test yes = "$build_libtool_libs"; then
10712 cmds=$old_archive_from_new_cmds
10715 # Add any objects from preloaded convenience libraries
10716 if test -n "$dlprefiles"; then
10717 gentop=$output_objdir/${outputname}x
10718 func_append generated " $gentop"
10720 func_extract_archives $gentop $dlprefiles
10721 func_append oldobjs " $func_extract_archives_result"
10724 # POSIX demands no paths to be encoded in archives. We have
10725 # to avoid creating archives with duplicate basenames if we
10726 # might have to extract them afterwards, e.g., when creating a
10727 # static archive out of a convenience library, or when linking
10728 # the entirety of a libtool archive into another (currently
10729 # not supported by libtool).
10730 if (for obj in $oldobjs
10732 func_basename "$obj"
10733 $ECHO "$func_basename_result"
10734 done | sort | sort -uc >/dev/null 2>&1); then
10737 echo "copying selected object files to avoid basename conflicts..."
10738 gentop=$output_objdir/${outputname}x
10739 func_append generated " $gentop"
10740 func_mkdir_p "$gentop"
10741 save_oldobjs=$oldobjs
10744 for obj in $save_oldobjs
10746 func_basename "$obj"
10747 objbase=$func_basename_result
10748 case " $oldobjs " in
10749 " ") oldobjs=$obj ;;
10750 *[\ /]"$objbase "*)
10752 # Make sure we don't pick an alternate name that also
10754 newobj=lt$counter-$objbase
10755 func_arith $counter + 1
10756 counter=$func_arith_result
10757 case " $oldobjs " in
10758 *[\ /]"$newobj "*) ;;
10759 *) if test ! -f "$gentop/$newobj"; then break; fi ;;
10762 func_show_eval "ln $obj $gentop/$newobj || cp $obj $gentop/$newobj"
10763 func_append oldobjs " $gentop/$newobj"
10765 *) func_append oldobjs " $obj" ;;
10769 func_to_tool_file "$oldlib" func_convert_file_msys_to_w32
10770 tool_oldlib=$func_to_tool_file_result
10771 eval cmds=\"$old_archive_cmds\"
10774 len=$func_len_result
10775 if test "$len" -lt "$max_cmd_len" || test "$max_cmd_len" -le -1; then
10776 cmds=$old_archive_cmds
10777 elif test -n "$archiver_list_spec"; then
10778 func_verbose "using command file archive linking..."
10779 for obj in $oldobjs
10781 func_to_tool_file "$obj"
10782 $ECHO "$func_to_tool_file_result"
10783 done > $output_objdir/$libname.libcmd
10784 func_to_tool_file "$output_objdir/$libname.libcmd"
10785 oldobjs=" $archiver_list_spec$func_to_tool_file_result"
10786 cmds=$old_archive_cmds
10788 # the command line is too long to link in one step, link in parts
10789 func_verbose "using piecewise archive linking..."
10790 save_RANLIB=$RANLIB
10794 save_oldobjs=$oldobjs
10796 # Is there a better way of finding the last object in the list?
10797 for obj in $save_oldobjs
10801 eval test_cmds=\"$old_archive_cmds\"
10802 func_len " $test_cmds"
10803 len0=$func_len_result
10805 for obj in $save_oldobjs
10808 func_arith $len + $func_len_result
10809 len=$func_arith_result
10810 func_append objlist " $obj"
10811 if test "$len" -lt "$max_cmd_len"; then
10814 # the above command should be used before it gets too long
10816 if test "$obj" = "$last_oldobj"; then
10817 RANLIB=$save_RANLIB
10819 test -z "$concat_cmds" || concat_cmds=$concat_cmds~
10820 eval concat_cmds=\"\$concat_cmds$old_archive_cmds\"
10825 RANLIB=$save_RANLIB
10827 if test -z "$oldobjs"; then
10828 eval cmds=\"\$concat_cmds\"
10830 eval cmds=\"\$concat_cmds~\$old_archive_cmds\"
10834 func_execute_cmds "$cmds" 'exit $?'
10837 test -n "$generated" && \
10838 func_show_eval "${RM}r$generated"
10840 # Now create the libtool archive.
10844 test yes = "$build_old_libs" && old_library=$libname.$libext
10845 func_verbose "creating $output"
10847 # Preserve any variables that may affect compiler behavior
10848 for var in $variables_saved_for_relink; do
10849 if eval test -z \"\${$var+set}\"; then
10850 relink_command="{ test -z \"\${$var+set}\" || $lt_unset $var || { $var=; export $var; }; }; $relink_command"
10851 elif eval var_value=\$$var; test -z "$var_value"; then
10852 relink_command="$var=; export $var; $relink_command"
10854 func_quote_for_eval "$var_value"
10855 relink_command="$var=$func_quote_for_eval_result; export $var; $relink_command"
10858 # Quote the link command for shipping.
10859 relink_command="(cd `pwd`; $SHELL \"$progpath\" $preserve_args --mode=relink $libtool_args @inst_prefix_dir@)"
10860 relink_command=`$ECHO "$relink_command" | $SED "$sed_quote_subst"`
10861 if test yes = "$hardcode_automatic"; then
10865 # Only create the output if not a dry run.
10867 for installed in no yes; do
10868 if test yes = "$installed"; then
10869 if test -z "$install_libdir"; then
10872 output=$output_objdir/${outputname}i
10873 # Replace all uninstalled libtool libraries with the installed ones
10874 newdependency_libs=
10875 for deplib in $dependency_libs; do
10878 func_basename "$deplib"
10879 name=$func_basename_result
10880 func_resolve_sysroot "$deplib"
10881 eval libdir=`$SED -n -e 's/^libdir=\(.*\)$/\1/p' $func_resolve_sysroot_result`
10882 test -z "$libdir" && \
10883 func_fatal_error "'$deplib' is not a valid libtool archive"
10884 func_append newdependency_libs " ${lt_sysroot:+=}$libdir/$name"
10887 func_stripname -L '' "$deplib"
10888 func_replace_sysroot "$func_stripname_result"
10889 func_append newdependency_libs " -L$func_replace_sysroot_result"
10892 func_stripname -R '' "$deplib"
10893 func_replace_sysroot "$func_stripname_result"
10894 func_append newdependency_libs " -R$func_replace_sysroot_result"
10896 *) func_append newdependency_libs " $deplib" ;;
10899 dependency_libs=$newdependency_libs
10902 for lib in $dlfiles; do
10905 func_basename "$lib"
10906 name=$func_basename_result
10907 eval libdir=`$SED -n -e 's/^libdir=\(.*\)$/\1/p' $lib`
10908 test -z "$libdir" && \
10909 func_fatal_error "'$lib' is not a valid libtool archive"
10910 func_append newdlfiles " ${lt_sysroot:+=}$libdir/$name"
10912 *) func_append newdlfiles " $lib" ;;
10915 dlfiles=$newdlfiles
10917 for lib in $dlprefiles; do
10920 # Only pass preopened files to the pseudo-archive (for
10921 # eventual linking with the app. that links it) if we
10922 # didn't already link the preopened objects directly into
10924 func_basename "$lib"
10925 name=$func_basename_result
10926 eval libdir=`$SED -n -e 's/^libdir=\(.*\)$/\1/p' $lib`
10927 test -z "$libdir" && \
10928 func_fatal_error "'$lib' is not a valid libtool archive"
10929 func_append newdlprefiles " ${lt_sysroot:+=}$libdir/$name"
10933 dlprefiles=$newdlprefiles
10936 for lib in $dlfiles; do
10938 [\\/]* | [A-Za-z]:[\\/]*) abs=$lib ;;
10939 *) abs=`pwd`"/$lib" ;;
10941 func_append newdlfiles " $abs"
10943 dlfiles=$newdlfiles
10945 for lib in $dlprefiles; do
10947 [\\/]* | [A-Za-z]:[\\/]*) abs=$lib ;;
10948 *) abs=`pwd`"/$lib" ;;
10950 func_append newdlprefiles " $abs"
10952 dlprefiles=$newdlprefiles
10955 # place dlname in correct position for cygwin
10956 # In fact, it would be nice if we could use this code for all target
10957 # systems that can't hard-code library paths into their executables
10958 # and that have no shared library path variable independent of PATH,
10959 # but it turns out we can't easily determine that from inspecting
10960 # libtool variables, so we have to hard-code the OSs to which it
10961 # applies here; at the moment, that means platforms that use the PE
10962 # object format with DLL files. See the long comment at the top of
10963 # tests/bindir.at for full details.
10965 case $host,$output,$installed,$module,$dlname in
10966 *cygwin*,*lai,yes,no,*.dll | *mingw*,*lai,yes,no,*.dll | *cegcc*,*lai,yes,no,*.dll)
10967 # If a -bindir argument was supplied, place the dll there.
10968 if test -n "$bindir"; then
10969 func_relative_path "$install_libdir" "$bindir"
10970 tdlname=$func_relative_path_result/$dlname
10972 # Otherwise fall back on heuristic.
10973 tdlname=../bin/$dlname
10978 # $outputname - a libtool library file
10979 # Generated by $PROGRAM (GNU $PACKAGE) $VERSION
10981 # Please DO NOT delete this file!
10982 # It is necessary for linking the library.
10984 # The name that we can dlopen(3).
10987 # Names of this library.
10988 library_names='$library_names'
10990 # The name of the static archive.
10991 old_library='$old_library'
10993 # Linker flags that cannot go in dependency_libs.
10994 inherited_linker_flags='$new_inherited_linker_flags'
10996 # Libraries that this one depends upon.
10997 dependency_libs='$dependency_libs'
10999 # Names of additional weak libraries provided by this library
11000 weak_library_names='$weak_libs'
11002 # Version information for $libname.
11007 # Is this an already installed library?
11008 installed=$installed
11010 # Should we warn about portability when linking against -modules?
11011 shouldnotlink=$module
11013 # Files to dlopen/dlpreopen
11015 dlpreopen='$dlprefiles'
11017 # Directory that this library needs to be installed in:
11018 libdir='$install_libdir'"
11019 if test no,yes = "$installed,$need_relink"; then
11020 $ECHO >> $output "\
11021 relink_command=\"$relink_command\""
11026 # Do a symbolic link so that the libtool archive can be found in
11027 # LD_LIBRARY_PATH before the program is installed.
11028 func_show_eval '( cd "$output_objdir" && $RM "$outputname" && $LN_S "../$outputname" "$outputname" )' 'exit $?'
11034 if test link = "$opt_mode" || test relink = "$opt_mode"; then
11035 func_mode_link ${1+"$@"}
11039 # func_mode_uninstall arg...
11040 func_mode_uninstall ()
11049 # This variable tells wrapper scripts just to set variables rather
11050 # than running their programs.
11051 libtool_install_magic=$magic
11056 -f) func_append RM " $arg"; rmforce=: ;;
11057 -*) func_append RM " $arg" ;;
11058 *) func_append files " $arg" ;;
11063 func_fatal_help "you must specify an RM program"
11067 for file in $files; do
11068 func_dirname "$file" "" "."
11069 dir=$func_dirname_result
11070 if test . = "$dir"; then
11075 func_basename "$file"
11076 name=$func_basename_result
11077 test uninstall = "$opt_mode" && odir=$dir
11079 # Remember odir for removal later, being careful to avoid duplicates
11080 if test clean = "$opt_mode"; then
11081 case " $rmdirs " in
11083 *) func_append rmdirs " $odir" ;;
11087 # Don't error if the file doesn't exist and rm -f was used.
11088 if { test -L "$file"; } >/dev/null 2>&1 ||
11089 { test -h "$file"; } >/dev/null 2>&1 ||
11090 test -f "$file"; then
11092 elif test -d "$file"; then
11095 elif $rmforce; then
11103 # Possibly a libtool archive, so verify it.
11104 if func_lalib_p "$file"; then
11105 func_source $dir/$name
11107 # Delete the libtool libraries and symlinks.
11108 for n in $library_names; do
11109 func_append rmfiles " $odir/$n"
11111 test -n "$old_library" && func_append rmfiles " $odir/$old_library"
11115 case " $library_names " in
11117 *) test -n "$dlname" && func_append rmfiles " $odir/$dlname" ;;
11119 test -n "$libdir" && func_append rmfiles " $odir/$name $odir/${name}i"
11122 if test -n "$library_names"; then
11123 # Do each command in the postuninstall commands.
11124 func_execute_cmds "$postuninstall_cmds" '$rmforce || exit_status=1'
11127 if test -n "$old_library"; then
11128 # Do each command in the old_postuninstall commands.
11129 func_execute_cmds "$old_postuninstall_cmds" '$rmforce || exit_status=1'
11131 # FIXME: should reinstall the best remaining shared library.
11138 # Possibly a libtool object, so verify it.
11139 if func_lalib_p "$file"; then
11141 # Read the .lo file
11142 func_source $dir/$name
11144 # Add PIC object to the list of files to remove.
11145 if test -n "$pic_object" && test none != "$pic_object"; then
11146 func_append rmfiles " $dir/$pic_object"
11149 # Add non-PIC object to the list of files to remove.
11150 if test -n "$non_pic_object" && test none != "$non_pic_object"; then
11151 func_append rmfiles " $dir/$non_pic_object"
11157 if test clean = "$opt_mode"; then
11161 func_stripname '' '.exe' "$file"
11162 file=$func_stripname_result
11163 func_stripname '' '.exe' "$name"
11164 noexename=$func_stripname_result
11165 # $file with .exe has already been added to rmfiles,
11166 # add $file without .exe
11167 func_append rmfiles " $file"
11170 # Do a test to see if this is a libtool program.
11171 if func_ltwrapper_p "$file"; then
11172 if func_ltwrapper_executable_p "$file"; then
11173 func_ltwrapper_scriptname "$file"
11175 func_source $func_ltwrapper_scriptname_result
11176 func_append rmfiles " $func_ltwrapper_scriptname_result"
11179 func_source $dir/$noexename
11182 # note $name still contains .exe if it was in $file originally
11183 # as does the version of $file that was added into $rmfiles
11184 func_append rmfiles " $odir/$name $odir/${name}S.$objext"
11185 if test yes = "$fast_install" && test -n "$relink_command"; then
11186 func_append rmfiles " $odir/lt-$name"
11188 if test "X$noexename" != "X$name"; then
11189 func_append rmfiles " $odir/lt-$noexename.c"
11195 func_show_eval "$RM $rmfiles" 'exit_status=1'
11198 # Try to remove the $objdir's in the directories where we deleted files
11199 for dir in $rmdirs; do
11200 if test -d "$dir"; then
11201 func_show_eval "rmdir $dir >/dev/null 2>&1"
11208 if test uninstall = "$opt_mode" || test clean = "$opt_mode"; then
11209 func_mode_uninstall ${1+"$@"}
11212 test -z "$opt_mode" && {
11214 func_fatal_help "you must specify a MODE"
11217 test -z "$exec_cmd" && \
11218 func_fatal_help "invalid operation mode '$opt_mode'"
11220 if test -n "$exec_cmd"; then
11221 eval exec "$exec_cmd"
11228 # The TAGs below are defined such that we never get into a situation
11229 # where we disable both kinds of libraries. Given conflicting
11230 # choices, we go for a static library, that is the most portable,
11231 # since we can't tell whether shared libraries were disabled because
11232 # the user asked for that or because the platform doesn't support
11233 # them. This is particularly important on AIX, because we don't
11234 # support having both static and shared libraries enabled at the same
11235 # time on that platform, so we default to a shared-only configuration.
11236 # If a disable-shared tag is given, we'll fallback to a static-only
11237 # configuration. But we'll never go from static-only to shared-only.
11239 # ### BEGIN LIBTOOL TAG CONFIG: disable-shared
11240 build_libtool_libs=no
11242 # ### END LIBTOOL TAG CONFIG: disable-shared
11244 # ### BEGIN LIBTOOL TAG CONFIG: disable-static
11245 build_old_libs=`case $build_libtool_libs in yes) echo no;; *) echo yes;; esac`
11246 # ### END LIBTOOL TAG CONFIG: disable-static
11249 # mode:shell-script