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-9"
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='eval 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-9
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 -64|-mips[0-9]|-r[0-9][0-9]*|-xarch=*|-xtarget=*|+DA*|+DD*|-q*|-m*| \
7372 -t[45]*|-txscale*|-p|-pg|--coverage|-fprofile-*|-F*|@*|-tp=*|--sysroot=*| \
7373 -O*|-g*|-flto*|-fwhopr*|-fuse-linker-plugin|-fstack-protector*|-stdlib=*| \
7374 -specs=*|-fsanitize=*|-fuse-ld=*)
7375 func_quote_for_eval "$arg"
7376 arg=$func_quote_for_eval_result
7377 func_append compile_command " $arg"
7378 func_append finalize_command " $arg"
7379 func_append compiler_flags " $arg"
7384 if test os2 = "`expr $host : '.*\(os2\)'`"; then
7385 # OS/2 uses -Zxxx to specify OS/2-specific options
7386 compiler_flags="$compiler_flags $arg"
7387 func_append compile_command " $arg"
7388 func_append finalize_command " $arg"
7396 # Otherwise treat like 'Some other compiler flag' below
7397 func_quote_for_eval "$arg"
7398 arg=$func_quote_for_eval_result
7402 # Some other compiler flag.
7404 func_quote_for_eval "$arg"
7405 arg=$func_quote_for_eval_result
7409 # A standard object.
7410 func_append objs " $arg"
7414 # A libtool-controlled object.
7416 # Check to see that this really is a libtool object.
7417 if func_lalib_unsafe_p "$arg"; then
7424 if test -z "$pic_object" ||
7425 test -z "$non_pic_object" ||
7426 test none = "$pic_object" &&
7427 test none = "$non_pic_object"; then
7428 func_fatal_error "cannot find name of object for '$arg'"
7431 # Extract subdirectory from the argument.
7432 func_dirname "$arg" "/" ""
7433 xdir=$func_dirname_result
7435 test none = "$pic_object" || {
7436 # Prepend the subdirectory the object is found in.
7437 pic_object=$xdir$pic_object
7439 if test dlfiles = "$prev"; then
7440 if test yes = "$build_libtool_libs" && test yes = "$dlopen_support"; then
7441 func_append dlfiles " $pic_object"
7445 # If libtool objects are unsupported, then we need to preload.
7450 # CHECK ME: I think I busted this. -Ossama
7451 if test dlprefiles = "$prev"; then
7452 # Preload the old-style object.
7453 func_append dlprefiles " $pic_object"
7458 func_append libobjs " $pic_object"
7463 if test none != "$non_pic_object"; then
7464 # Prepend the subdirectory the object is found in.
7465 non_pic_object=$xdir$non_pic_object
7467 # A standard non-PIC object
7468 func_append non_pic_objects " $non_pic_object"
7469 if test -z "$pic_object" || test none = "$pic_object"; then
7473 # If the PIC object exists, use it instead.
7474 # $xdir was prepended to $pic_object above.
7475 non_pic_object=$pic_object
7476 func_append non_pic_objects " $non_pic_object"
7479 # Only an error if not doing a dry-run.
7480 if $opt_dry_run; then
7481 # Extract subdirectory from the argument.
7482 func_dirname "$arg" "/" ""
7483 xdir=$func_dirname_result
7486 pic_object=$xdir$objdir/$func_lo2o_result
7487 non_pic_object=$xdir$func_lo2o_result
7488 func_append libobjs " $pic_object"
7489 func_append non_pic_objects " $non_pic_object"
7491 func_fatal_error "'$arg' is not a valid libtool object"
7498 func_append deplibs " $arg"
7499 func_append old_deplibs " $arg"
7504 # A libtool-controlled library.
7506 func_resolve_sysroot "$arg"
7507 if test dlfiles = "$prev"; then
7508 # This library was specified with -dlopen.
7509 func_append dlfiles " $func_resolve_sysroot_result"
7511 elif test dlprefiles = "$prev"; then
7512 # The library was specified with -dlpreopen.
7513 func_append dlprefiles " $func_resolve_sysroot_result"
7516 func_append deplibs " $func_resolve_sysroot_result"
7521 # Some other compiler argument.
7523 # Unknown arguments in both finalize_command and compile_command need
7524 # to be aesthetically quoted because they are evaled later.
7525 func_quote_for_eval "$arg"
7526 arg=$func_quote_for_eval_result
7530 # Now actually substitute the argument into the commands.
7531 if test -n "$arg"; then
7532 func_append compile_command " $arg"
7533 func_append finalize_command " $arg"
7535 done # argument parsing loop
7537 test -n "$prev" && \
7538 func_fatal_help "the '$prevarg' option requires an argument"
7540 if test yes = "$export_dynamic" && test -n "$export_dynamic_flag_spec"; then
7541 eval arg=\"$export_dynamic_flag_spec\"
7542 func_append compile_command " $arg"
7543 func_append finalize_command " $arg"
7547 # calculate the name of the file, without its directory
7548 func_basename "$output"
7549 outputname=$func_basename_result
7550 libobjs_save=$libobjs
7552 if test -n "$shlibpath_var"; then
7553 # get the directories listed in $shlibpath_var
7554 eval shlib_search_path=\`\$ECHO \"\$$shlibpath_var\" \| \$SED \'s/:/ /g\'\`
7558 eval sys_lib_search_path=\"$sys_lib_search_path_spec\"
7559 eval sys_lib_dlsearch_path=\"$sys_lib_dlsearch_path_spec\"
7561 # Definition is injected by LT_CONFIG during libtool generation.
7562 func_munge_path_list sys_lib_dlsearch_path "$LT_SYS_LIBRARY_PATH"
7564 func_dirname "$output" "/" ""
7565 output_objdir=$func_dirname_result$objdir
7566 func_to_tool_file "$output_objdir/"
7567 tool_output_objdir=$func_to_tool_file_result
7568 # Create the object directory.
7569 func_mkdir_p "$output_objdir"
7571 # Determine the type of output
7574 func_fatal_help "you must specify an output file"
7576 *.$libext) linkmode=oldlib ;;
7577 *.lo | *.$objext) linkmode=obj ;;
7578 *.la) linkmode=lib ;;
7579 *) linkmode=prog ;; # Anything else should be a program.
7585 # Find all interdependent deplibs by searching for libraries
7586 # that are linked more than once (e.g. -la -lb -la)
7587 for deplib in $deplibs; do
7588 if $opt_preserve_dup_deps; then
7590 *" $deplib "*) func_append specialdeplibs " $deplib" ;;
7593 func_append libs " $deplib"
7596 if test lib = "$linkmode"; then
7597 libs="$predeps $libs $compiler_lib_search_path $postdeps"
7599 # Compute libraries that are listed more than once in $predeps
7600 # $postdeps and mark them as special (i.e., whose duplicates are
7601 # not to be eliminated).
7603 if $opt_duplicate_compiler_generated_deps; then
7604 for pre_post_dep in $predeps $postdeps; do
7605 case "$pre_post_deps " in
7606 *" $pre_post_dep "*) func_append specialdeplibs " $pre_post_deps" ;;
7608 func_append pre_post_deps " $pre_post_dep"
7617 need_relink=no # whether we're linking any uninstalled libtool libraries
7618 notinst_deplibs= # not-installed libtool libraries
7619 notinst_path= # paths that contain not-installed libtool libraries
7623 passes="conv dlpreopen link"
7624 for file in $dlfiles $dlprefiles; do
7628 func_fatal_help "libraries can '-dlopen' only libtool libraries: $file"
7639 passes="conv scan dlopen dlpreopen link"
7645 for pass in $passes; do
7646 # The preopen pass in lib mode reverses $deplibs; put it back here
7647 # so that -L comes before libs that need it for instance...
7648 if test lib,link = "$linkmode,$pass"; then
7649 ## FIXME: Find the place where the list is rebuilt in the wrong
7650 ## order, and fix it there properly
7652 for deplib in $deplibs; do
7653 tmp_deplibs="$deplib $tmp_deplibs"
7655 deplibs=$tmp_deplibs
7658 if test lib,link = "$linkmode,$pass" ||
7659 test prog,scan = "$linkmode,$pass"; then
7663 if test prog = "$linkmode"; then
7665 dlopen) libs=$dlfiles ;;
7666 dlpreopen) libs=$dlprefiles ;;
7668 libs="$deplibs %DEPLIBS%"
7669 test "X$link_all_deplibs" != Xno && libs="$libs $dependency_libs"
7673 if test lib,dlpreopen = "$linkmode,$pass"; then
7674 # Collect and forward deplibs of preopened libtool libs
7675 for lib in $dlprefiles; do
7676 # Ignore non-libtool-libs
7678 func_resolve_sysroot "$lib"
7680 *.la) func_source "$func_resolve_sysroot_result" ;;
7683 # Collect preopened libtool deplibs, except any this library
7684 # has declared as weak libs
7685 for deplib in $dependency_libs; do
7686 func_basename "$deplib"
7687 deplib_base=$func_basename_result
7688 case " $weak_libs " in
7689 *" $deplib_base "*) ;;
7690 *) func_append deplibs " $deplib" ;;
7696 if test dlopen = "$pass"; then
7697 # Collect dlpreopened libraries
7698 save_deplibs=$deplibs
7702 for deplib in $libs; do
7706 -mt|-mthreads|-kthread|-Kthread|-pthread|-pthreads|--thread-safe \
7707 |-threads|-fopenmp|-openmp|-mp|-xopenmp|-omp|-qsmp=*)
7708 if test prog,link = "$linkmode,$pass"; then
7709 compile_deplibs="$deplib $compile_deplibs"
7710 finalize_deplibs="$deplib $finalize_deplibs"
7712 func_append compiler_flags " $deplib"
7713 if test lib = "$linkmode"; then
7714 case "$new_inherited_linker_flags " in
7716 * ) func_append new_inherited_linker_flags " $deplib" ;;
7723 if test lib != "$linkmode" && test prog != "$linkmode"; then
7724 func_warning "'-l' is ignored for archives/objects"
7727 func_stripname '-l' '' "$deplib"
7728 name=$func_stripname_result
7729 if test lib = "$linkmode"; then
7730 searchdirs="$newlib_search_path $lib_search_path $compiler_lib_search_dirs $sys_lib_search_path $shlib_search_path"
7732 searchdirs="$newlib_search_path $lib_search_path $sys_lib_search_path $shlib_search_path"
7734 for searchdir in $searchdirs; do
7735 for search_ext in .la $std_shrext .so .a; do
7736 # Search the libtool library
7737 lib=$searchdir/lib$name$search_ext
7738 if test -f "$lib"; then
7739 if test .la = "$search_ext"; then
7749 # deplib is a libtool library
7750 # If $allow_libtool_libs_with_static_runtimes && $deplib is a stdlib,
7751 # We need to do some special things here, and not later.
7752 if test yes = "$allow_libtool_libs_with_static_runtimes"; then
7753 case " $predeps $postdeps " in
7755 if func_lalib_p "$lib"; then
7759 for l in $old_library $library_names; do
7762 if test "X$ll" = "X$old_library"; then # only static version available
7764 func_dirname "$lib" "" "."
7765 ladir=$func_dirname_result
7766 lib=$ladir/$old_library
7767 if test prog,link = "$linkmode,$pass"; then
7768 compile_deplibs="$deplib $compile_deplibs"
7769 finalize_deplibs="$deplib $finalize_deplibs"
7771 deplibs="$deplib $deplibs"
7772 test lib = "$linkmode" && newdependency_libs="$deplib $newdependency_libs"
7782 # deplib doesn't seem to be a libtool library
7783 if test prog,link = "$linkmode,$pass"; then
7784 compile_deplibs="$deplib $compile_deplibs"
7785 finalize_deplibs="$deplib $finalize_deplibs"
7787 deplibs="$deplib $deplibs"
7788 test lib = "$linkmode" && newdependency_libs="$deplib $newdependency_libs"
7794 if test prog,link = "$linkmode,$pass"; then
7795 compile_deplibs="$deplib $compile_deplibs"
7796 finalize_deplibs="$deplib $finalize_deplibs"
7798 deplibs="$deplib $deplibs"
7799 if test lib = "$linkmode"; then
7800 case "$new_inherited_linker_flags " in
7802 * ) func_append new_inherited_linker_flags " $deplib" ;;
7811 deplibs="$deplib $deplibs"
7812 test conv = "$pass" && continue
7813 newdependency_libs="$deplib $newdependency_libs"
7814 func_stripname '-L' '' "$deplib"
7815 func_resolve_sysroot "$func_stripname_result"
7816 func_append newlib_search_path " $func_resolve_sysroot_result"
7819 if test conv = "$pass"; then
7820 deplibs="$deplib $deplibs"
7823 if test scan = "$pass"; then
7824 deplibs="$deplib $deplibs"
7826 compile_deplibs="$deplib $compile_deplibs"
7827 finalize_deplibs="$deplib $finalize_deplibs"
7829 func_stripname '-L' '' "$deplib"
7830 func_resolve_sysroot "$func_stripname_result"
7831 func_append newlib_search_path " $func_resolve_sysroot_result"
7834 func_warning "'-L' is ignored for archives/objects"
7840 if test link = "$pass"; then
7841 func_stripname '-R' '' "$deplib"
7842 func_resolve_sysroot "$func_stripname_result"
7843 dir=$func_resolve_sysroot_result
7844 # Make sure the xrpath contains only unique directories.
7847 *) func_append xrpath " $dir" ;;
7850 deplibs="$deplib $deplibs"
7854 func_resolve_sysroot "$deplib"
7855 lib=$func_resolve_sysroot_result
7858 if test conv = "$pass"; then
7859 deplibs="$deplib $deplibs"
7864 # Linking convenience modules into shared libraries is allowed,
7865 # but linking other static libraries is non-portable.
7866 case " $dlpreconveniencelibs " in
7870 case $deplibs_check_method in
7872 set dummy $deplibs_check_method; shift
7873 match_pattern_regex=`expr "$deplibs_check_method" : "$1 \(.*\)"`
7874 if eval "\$ECHO \"$deplib\"" 2>/dev/null | $SED 10q \
7875 | $EGREP "$match_pattern_regex" > /dev/null; then
7883 if $valid_a_lib; then
7885 $ECHO "*** Warning: Linking the shared library $output against the"
7886 $ECHO "*** static library $deplib is not portable!"
7887 deplibs="$deplib $deplibs"
7890 $ECHO "*** Warning: Trying to link with static lib archive $deplib."
7891 echo "*** I have the capability to make that library automatically link in when"
7892 echo "*** you link to this library. But I can only do this if you have a"
7893 echo "*** shared version of the library, which you do not appear to have"
7894 echo "*** because the file extensions .$libext of this argument makes me believe"
7895 echo "*** that it is just a static archive that I should not use here."
7902 if test link != "$pass"; then
7903 deplibs="$deplib $deplibs"
7905 compile_deplibs="$deplib $compile_deplibs"
7906 finalize_deplibs="$deplib $finalize_deplibs"
7913 if test conv = "$pass"; then
7914 deplibs="$deplib $deplibs"
7915 elif test prog = "$linkmode"; then
7916 if test dlpreopen = "$pass" || test yes != "$dlopen_support" || test no = "$build_libtool_libs"; then
7917 # If there is no dlopen support or we're linking statically,
7918 # we need to preload.
7919 func_append newdlprefiles " $deplib"
7920 compile_deplibs="$deplib $compile_deplibs"
7921 finalize_deplibs="$deplib $finalize_deplibs"
7923 func_append newdlfiles " $deplib"
7934 $found || test -f "$lib" \
7935 || func_fatal_error "cannot find the library '$lib' or unhandled argument '$deplib'"
7937 # Check to see that this really is a libtool archive.
7938 func_lalib_unsafe_p "$lib" \
7939 || func_fatal_error "'$lib' is not a valid libtool archive"
7941 func_dirname "$lib" "" "."
7942 ladir=$func_dirname_result
7950 inherited_linker_flags=
7951 # If the library was installed with an old release of libtool,
7952 # it will not redefine variables installed, or shouldnotlink
7961 # Convert "-framework foo" to "foo.ltframework"
7962 if test -n "$inherited_linker_flags"; then
7963 tmp_inherited_linker_flags=`$ECHO "$inherited_linker_flags" | $SED 's/-framework \([^ $]*\)/\1.ltframework/g'`
7964 for tmp_inherited_linker_flag in $tmp_inherited_linker_flags; do
7965 case " $new_inherited_linker_flags " in
7966 *" $tmp_inherited_linker_flag "*) ;;
7967 *) func_append new_inherited_linker_flags " $tmp_inherited_linker_flag";;
7971 dependency_libs=`$ECHO " $dependency_libs" | $SED 's% \([^ $]*\).ltframework% -framework \1%g'`
7972 if test lib,link = "$linkmode,$pass" ||
7973 test prog,scan = "$linkmode,$pass" ||
7974 { test prog != "$linkmode" && test lib != "$linkmode"; }; then
7975 test -n "$dlopen" && func_append dlfiles " $dlopen"
7976 test -n "$dlpreopen" && func_append dlprefiles " $dlpreopen"
7979 if test conv = "$pass"; then
7980 # Only check for convenience libraries
7981 deplibs="$lib $deplibs"
7982 if test -z "$libdir"; then
7983 if test -z "$old_library"; then
7984 func_fatal_error "cannot find name of link library for '$lib'"
7986 # It is a libtool convenience library, so add in its objects.
7987 func_append convenience " $ladir/$objdir/$old_library"
7988 func_append old_convenience " $ladir/$objdir/$old_library"
7990 for deplib in $dependency_libs; do
7991 deplibs="$deplib $deplibs"
7992 if $opt_preserve_dup_deps; then
7993 case "$tmp_libs " in
7994 *" $deplib "*) func_append specialdeplibs " $deplib" ;;
7997 func_append tmp_libs " $deplib"
7999 elif test prog != "$linkmode" && test lib != "$linkmode"; then
8000 func_fatal_error "'$lib' is not a convenience library"
8006 # Get the name of the library we link against.
8008 if test -n "$old_library" &&
8009 { test yes = "$prefer_static_libs" ||
8010 test built,no = "$prefer_static_libs,$installed"; }; then
8011 linklib=$old_library
8013 for l in $old_library $library_names; do
8017 if test -z "$linklib"; then
8018 func_fatal_error "cannot find name of link library for '$lib'"
8021 # This library was specified with -dlopen.
8022 if test dlopen = "$pass"; then
8024 && func_fatal_error "cannot -dlopen a convenience library: '$lib'"
8025 if test -z "$dlname" ||
8026 test yes != "$dlopen_support" ||
8027 test no = "$build_libtool_libs"
8029 # If there is no dlname, no dlopen support or we're linking
8030 # statically, we need to preload. We also need to preload any
8031 # dependent libraries so libltdl's deplib preloader doesn't
8032 # bomb out in the load deplibs phase.
8033 func_append dlprefiles " $lib $dependency_libs"
8035 func_append newdlfiles " $lib"
8040 # We need an absolute path.
8042 [\\/]* | [A-Za-z]:[\\/]*) abs_ladir=$ladir ;;
8044 abs_ladir=`cd "$ladir" && pwd`
8045 if test -z "$abs_ladir"; then
8046 func_warning "cannot determine absolute directory name of '$ladir'"
8047 func_warning "passing it literally to the linker, although it might fail"
8052 func_basename "$lib"
8053 laname=$func_basename_result
8055 # Find the relevant object directory and library name.
8056 if test yes = "$installed"; then
8057 if test ! -f "$lt_sysroot$libdir/$linklib" && test -f "$abs_ladir/$linklib"; then
8058 func_warning "library '$lib' was moved."
8063 dir=$lt_sysroot$libdir
8064 absdir=$lt_sysroot$libdir
8066 test yes = "$hardcode_automatic" && avoidtemprpath=yes
8068 if test ! -f "$ladir/$objdir/$linklib" && test -f "$abs_ladir/$linklib"; then
8071 # Remove this search path later
8072 func_append notinst_path " $abs_ladir"
8075 absdir=$abs_ladir/$objdir
8076 # Remove this search path later
8077 func_append notinst_path " $abs_ladir"
8079 fi # $installed = yes
8080 func_stripname 'lib' '.la' "$laname"
8081 name=$func_stripname_result
8083 # This library was specified with -dlpreopen.
8084 if test dlpreopen = "$pass"; then
8085 if test -z "$libdir" && test prog = "$linkmode"; then
8086 func_fatal_error "only libraries may -dlpreopen a convenience library: '$lib'"
8089 # special handling for platforms with PE-DLLs.
8090 *cygwin* | *mingw* | *cegcc* )
8091 # Linker will automatically link against shared library if both
8092 # static and shared are present. Therefore, ensure we extract
8093 # symbols from the import library if a shared library is present
8094 # (otherwise, the dlopen module name will be incorrect). We do
8095 # this by putting the import library name into $newdlprefiles.
8096 # We recover the dlopen module name by 'saving' the la file
8097 # name in a special purpose variable, and (later) extracting the
8098 # dlname from the la file.
8099 if test -n "$dlname"; then
8100 func_tr_sh "$dir/$linklib"
8101 eval "libfile_$func_tr_sh_result=\$abs_ladir/\$laname"
8102 func_append newdlprefiles " $dir/$linklib"
8104 func_append newdlprefiles " $dir/$old_library"
8105 # Keep a list of preopened convenience libraries to check
8106 # that they are being used correctly in the link pass.
8107 test -z "$libdir" && \
8108 func_append dlpreconveniencelibs " $dir/$old_library"
8112 # Prefer using a static library (so that no silly _DYNAMIC symbols
8113 # are required to link).
8114 if test -n "$old_library"; then
8115 func_append newdlprefiles " $dir/$old_library"
8116 # Keep a list of preopened convenience libraries to check
8117 # that they are being used correctly in the link pass.
8118 test -z "$libdir" && \
8119 func_append dlpreconveniencelibs " $dir/$old_library"
8120 # Otherwise, use the dlname, so that lt_dlopen finds it.
8121 elif test -n "$dlname"; then
8122 func_append newdlprefiles " $dir/$dlname"
8124 func_append newdlprefiles " $dir/$linklib"
8128 fi # $pass = dlpreopen
8130 if test -z "$libdir"; then
8131 # Link the convenience library
8132 if test lib = "$linkmode"; then
8133 deplibs="$dir/$old_library $deplibs"
8134 elif test prog,link = "$linkmode,$pass"; then
8135 compile_deplibs="$dir/$old_library $compile_deplibs"
8136 finalize_deplibs="$dir/$old_library $finalize_deplibs"
8138 deplibs="$lib $deplibs" # used for prog,scan pass
8144 if test prog = "$linkmode" && test link != "$pass"; then
8145 func_append newlib_search_path " $ladir"
8146 deplibs="$lib $deplibs"
8148 linkalldeplibs=false
8149 if test no != "$link_all_deplibs" || test -z "$library_names" ||
8150 test no = "$build_libtool_libs"; then
8155 for deplib in $dependency_libs; do
8157 -L*) func_stripname '-L' '' "$deplib"
8158 func_resolve_sysroot "$func_stripname_result"
8159 func_append newlib_search_path " $func_resolve_sysroot_result"
8162 # Need to link against all dependency_libs?
8163 if $linkalldeplibs; then
8164 deplibs="$deplib $deplibs"
8166 # Need to hardcode shared library paths
8167 # or/and link against static libraries
8168 newdependency_libs="$deplib $newdependency_libs"
8170 if $opt_preserve_dup_deps; then
8171 case "$tmp_libs " in
8172 *" $deplib "*) func_append specialdeplibs " $deplib" ;;
8175 func_append tmp_libs " $deplib"
8178 fi # $linkmode = prog...
8180 if test prog,link = "$linkmode,$pass"; then
8181 if test -n "$library_names" &&
8182 { { test no = "$prefer_static_libs" ||
8183 test built,yes = "$prefer_static_libs,$installed"; } ||
8184 test -z "$old_library"; }; then
8185 # We need to hardcode the library path
8186 if test -n "$shlibpath_var" && test -z "$avoidtemprpath"; then
8187 # Make sure the rpath contains only unique directories.
8188 case $temp_rpath: in
8190 *) func_append temp_rpath "$absdir:" ;;
8194 # Hardcode the library path.
8195 # Skip directories that are in the system default run-time
8197 case " $sys_lib_dlsearch_path " in
8200 case "$compile_rpath " in
8202 *) func_append compile_rpath " $absdir" ;;
8206 case " $sys_lib_dlsearch_path " in
8209 case "$finalize_rpath " in
8211 *) func_append finalize_rpath " $libdir" ;;
8215 fi # $linkmode,$pass = prog,link...
8218 { test pass_all = "$deplibs_check_method" ||
8219 { test yes = "$build_libtool_libs" &&
8220 test -n "$library_names"; }; }; then
8221 # We only need to search for static libraries
8226 link_static=no # Whether the deplib will be linked statically
8227 use_static_libs=$prefer_static_libs
8228 if test built = "$use_static_libs" && test yes = "$installed"; then
8231 if test -n "$library_names" &&
8232 { test no = "$use_static_libs" || test -z "$old_library"; }; then
8234 *cygwin* | *mingw* | *cegcc* | *os2*)
8235 # No point in relinking DLLs because paths are not encoded
8236 func_append notinst_deplibs " $lib"
8240 if test no = "$installed"; then
8241 func_append notinst_deplibs " $lib"
8246 # This is a shared library
8248 # Warn about portability, can't link against -module's on some
8249 # systems (darwin). Don't bleat about dlopened modules though!
8251 for dlpremoduletest in $dlprefiles; do
8252 if test "X$dlpremoduletest" = "X$lib"; then
8253 dlopenmodule=$dlpremoduletest
8257 if test -z "$dlopenmodule" && test yes = "$shouldnotlink" && test link = "$pass"; then
8259 if test prog = "$linkmode"; then
8260 $ECHO "*** Warning: Linking the executable $output against the loadable module"
8262 $ECHO "*** Warning: Linking the shared library $output against the loadable module"
8264 $ECHO "*** $linklib is not portable!"
8266 if test lib = "$linkmode" &&
8267 test yes = "$hardcode_into_libs"; then
8268 # Hardcode the library path.
8269 # Skip directories that are in the system default run-time
8271 case " $sys_lib_dlsearch_path " in
8274 case "$compile_rpath " in
8276 *) func_append compile_rpath " $absdir" ;;
8280 case " $sys_lib_dlsearch_path " in
8283 case "$finalize_rpath " in
8285 *) func_append finalize_rpath " $libdir" ;;
8291 if test -n "$old_archive_from_expsyms_cmds"; then
8292 # figure out the soname
8293 set dummy $library_names
8297 libname=`eval "\\$ECHO \"$libname_spec\""`
8298 # use dlname if we got it. it's perfectly good, no?
8299 if test -n "$dlname"; then
8301 elif test -n "$soname_spec"; then
8304 *cygwin* | mingw* | *cegcc* | *os2*)
8305 func_arith $current - $age
8306 major=$func_arith_result
8310 eval soname=\"$soname_spec\"
8315 # Make a new name for the extract_expsyms_cmds to use
8317 func_basename "$soroot"
8318 soname=$func_basename_result
8319 func_stripname 'lib' '.dll' "$soname"
8320 newlib=libimp-$func_stripname_result.a
8322 # If the library has no export list, then create one now
8323 if test -f "$output_objdir/$soname-def"; then :
8325 func_verbose "extracting exported symbol list from '$soname'"
8326 func_execute_cmds "$extract_expsyms_cmds" 'exit $?'
8330 if test -f "$output_objdir/$newlib"; then :; else
8331 func_verbose "generating import library for '$soname'"
8332 func_execute_cmds "$old_archive_from_expsyms_cmds" 'exit $?'
8334 # make sure the library variables are pointing to the new library
8337 fi # test -n "$old_archive_from_expsyms_cmds"
8339 if test prog = "$linkmode" || test relink != "$opt_mode"; then
8344 case $hardcode_action in
8345 immediate | unsupported)
8346 if test no = "$hardcode_direct"; then
8349 *-*-sco3.2v5.0.[024]*) add_dir=-L$dir ;;
8350 *-*-sysv4*uw2*) add_dir=-L$dir ;;
8351 *-*-sysv5OpenUNIX* | *-*-sysv5UnixWare7.[01].[10]* | \
8352 *-*-unixware7*) add_dir=-L$dir ;;
8354 # if the lib is a (non-dlopened) module then we cannot
8355 # link against it, someone is ignoring the earlier warnings
8356 if /usr/bin/file -L $add 2> /dev/null |
8357 $GREP ": [^:]* bundle" >/dev/null; then
8358 if test "X$dlopenmodule" != "X$lib"; then
8359 $ECHO "*** Warning: lib $linklib is a module, not a shared library"
8360 if test -z "$old_library"; then
8362 echo "*** And there doesn't seem to be a static archive available"
8363 echo "*** The link will probably fail, sorry"
8365 add=$dir/$old_library
8367 elif test -n "$old_library"; then
8368 add=$dir/$old_library
8372 elif test no = "$hardcode_minus_L"; then
8374 *-*-sunos*) add_shlibpath=$dir ;;
8378 elif test no = "$hardcode_shlibpath_var"; then
8386 if test yes = "$hardcode_direct" &&
8387 test no = "$hardcode_direct_absolute"; then
8389 elif test yes = "$hardcode_minus_L"; then
8391 # Try looking first in the location we're being installed to.
8392 if test -n "$inst_prefix_dir"; then
8395 func_append add_dir " -L$inst_prefix_dir$libdir"
8400 elif test yes = "$hardcode_shlibpath_var"; then
8410 if test yes != "$lib_linked"; then
8411 func_fatal_configuration "unsupported hardcode properties"
8414 if test -n "$add_shlibpath"; then
8415 case :$compile_shlibpath: in
8416 *":$add_shlibpath:"*) ;;
8417 *) func_append compile_shlibpath "$add_shlibpath:" ;;
8420 if test prog = "$linkmode"; then
8421 test -n "$add_dir" && compile_deplibs="$add_dir $compile_deplibs"
8422 test -n "$add" && compile_deplibs="$add $compile_deplibs"
8424 test -n "$add_dir" && deplibs="$add_dir $deplibs"
8425 test -n "$add" && deplibs="$add $deplibs"
8426 if test yes != "$hardcode_direct" &&
8427 test yes != "$hardcode_minus_L" &&
8428 test yes = "$hardcode_shlibpath_var"; then
8429 case :$finalize_shlibpath: in
8431 *) func_append finalize_shlibpath "$libdir:" ;;
8437 if test prog = "$linkmode" || test relink = "$opt_mode"; then
8441 # Finalize command for both is simple: just hardcode it.
8442 if test yes = "$hardcode_direct" &&
8443 test no = "$hardcode_direct_absolute"; then
8444 add=$libdir/$linklib
8445 elif test yes = "$hardcode_minus_L"; then
8448 elif test yes = "$hardcode_shlibpath_var"; then
8449 case :$finalize_shlibpath: in
8451 *) func_append finalize_shlibpath "$libdir:" ;;
8454 elif test yes = "$hardcode_automatic"; then
8455 if test -n "$inst_prefix_dir" &&
8456 test -f "$inst_prefix_dir$libdir/$linklib"; then
8457 add=$inst_prefix_dir$libdir/$linklib
8459 add=$libdir/$linklib
8462 # We cannot seem to hardcode it, guess we'll fake it.
8464 # Try looking first in the location we're being installed to.
8465 if test -n "$inst_prefix_dir"; then
8468 func_append add_dir " -L$inst_prefix_dir$libdir"
8475 if test prog = "$linkmode"; then
8476 test -n "$add_dir" && finalize_deplibs="$add_dir $finalize_deplibs"
8477 test -n "$add" && finalize_deplibs="$add $finalize_deplibs"
8479 test -n "$add_dir" && deplibs="$add_dir $deplibs"
8480 test -n "$add" && deplibs="$add $deplibs"
8483 elif test prog = "$linkmode"; then
8484 # Here we assume that one of hardcode_direct or hardcode_minus_L
8485 # is not unsupported. This is valid on all known static and
8487 if test unsupported != "$hardcode_direct"; then
8488 test -n "$old_library" && linklib=$old_library
8489 compile_deplibs="$dir/$linklib $compile_deplibs"
8490 finalize_deplibs="$dir/$linklib $finalize_deplibs"
8492 compile_deplibs="-l$name -L$dir $compile_deplibs"
8493 finalize_deplibs="-l$name -L$dir $finalize_deplibs"
8495 elif test yes = "$build_libtool_libs"; then
8496 # Not a shared library
8497 if test pass_all != "$deplibs_check_method"; then
8498 # We're trying link a shared library against a static one
8499 # but the system doesn't support it.
8501 # Just print a warning and add the library to dependency_libs so
8502 # that the program can be linked against the static library.
8504 $ECHO "*** Warning: This system cannot link to static lib archive $lib."
8505 echo "*** I have the capability to make that library automatically link in when"
8506 echo "*** you link to this library. But I can only do this if you have a"
8507 echo "*** shared version of the library, which you do not appear to have."
8508 if test yes = "$module"; then
8509 echo "*** But as you try to build a module library, libtool will still create "
8510 echo "*** a static module, that should work as long as the dlopening application"
8511 echo "*** is linked with the -dlopen flag to resolve symbols at runtime."
8512 if test -z "$global_symbol_pipe"; then
8514 echo "*** However, this would only work if libtool was able to extract symbol"
8515 echo "*** lists from a program, using 'nm' or equivalent, but libtool could"
8516 echo "*** not find such a program. So, this module is probably useless."
8517 echo "*** 'nm' from GNU binutils and a full rebuild may help."
8519 if test no = "$build_old_libs"; then
8520 build_libtool_libs=module
8523 build_libtool_libs=no
8527 deplibs="$dir/$old_library $deplibs"
8530 fi # link shared/static library?
8532 if test lib = "$linkmode"; then
8533 if test -n "$dependency_libs" &&
8534 { test yes != "$hardcode_into_libs" ||
8535 test yes = "$build_old_libs" ||
8536 test yes = "$link_static"; }; then
8537 # Extract -R from dependency_libs
8539 for libdir in $dependency_libs; do
8541 -R*) func_stripname '-R' '' "$libdir"
8542 temp_xrpath=$func_stripname_result
8544 *" $temp_xrpath "*) ;;
8545 *) func_append xrpath " $temp_xrpath";;
8547 *) func_append temp_deplibs " $libdir";;
8550 dependency_libs=$temp_deplibs
8553 func_append newlib_search_path " $absdir"
8554 # Link against this library
8555 test no = "$link_static" && newdependency_libs="$abs_ladir/$laname $newdependency_libs"
8556 # ... and its dependency_libs
8558 for deplib in $dependency_libs; do
8559 newdependency_libs="$deplib $newdependency_libs"
8561 -L*) func_stripname '-L' '' "$deplib"
8562 func_resolve_sysroot "$func_stripname_result";;
8563 *) func_resolve_sysroot "$deplib" ;;
8565 if $opt_preserve_dup_deps; then
8566 case "$tmp_libs " in
8567 *" $func_resolve_sysroot_result "*)
8568 func_append specialdeplibs " $func_resolve_sysroot_result" ;;
8571 func_append tmp_libs " $func_resolve_sysroot_result"
8574 if test no != "$link_all_deplibs"; then
8575 # Add the search paths of all dependency libraries
8576 for deplib in $dependency_libs; do
8579 -L*) path=$deplib ;;
8581 func_resolve_sysroot "$deplib"
8582 deplib=$func_resolve_sysroot_result
8583 func_dirname "$deplib" "" "."
8584 dir=$func_dirname_result
8585 # We need an absolute path.
8587 [\\/]* | [A-Za-z]:[\\/]*) absdir=$dir ;;
8589 absdir=`cd "$dir" && pwd`
8590 if test -z "$absdir"; then
8591 func_warning "cannot determine absolute directory name of '$dir'"
8596 if $GREP "^installed=no" $deplib > /dev/null; then
8600 eval deplibrary_names=`$SED -n -e 's/^library_names=\(.*\)$/\1/p' $deplib`
8601 if test -n "$deplibrary_names"; then
8602 for tmp in $deplibrary_names; do
8605 if test -f "$absdir/$objdir/$depdepl"; then
8606 depdepl=$absdir/$objdir/$depdepl
8607 darwin_install_name=`$OTOOL -L $depdepl | awk '{if (NR == 2) {print $1;exit}}'`
8608 if test -z "$darwin_install_name"; then
8609 darwin_install_name=`$OTOOL64 -L $depdepl | awk '{if (NR == 2) {print $1;exit}}'`
8611 func_append compiler_flags " $wl-dylib_file $wl$darwin_install_name:$depdepl"
8612 func_append linker_flags " -dylib_file $darwin_install_name:$depdepl"
8618 path=-L$absdir/$objdir
8622 eval libdir=`$SED -n -e 's/^libdir=\(.*\)$/\1/p' $deplib`
8623 test -z "$libdir" && \
8624 func_fatal_error "'$deplib' is not a valid libtool archive"
8625 test "$absdir" != "$libdir" && \
8626 func_warning "'$deplib' seems to be moved"
8632 case " $deplibs " in
8634 *) deplibs="$path $deplibs" ;;
8637 fi # link_all_deplibs != no
8639 done # for deplib in $libs
8640 if test link = "$pass"; then
8641 if test prog = "$linkmode"; then
8642 compile_deplibs="$new_inherited_linker_flags $compile_deplibs"
8643 finalize_deplibs="$new_inherited_linker_flags $finalize_deplibs"
8645 compiler_flags="$compiler_flags "`$ECHO " $new_inherited_linker_flags" | $SED 's% \([^ $]*\).ltframework% -framework \1%g'`
8648 dependency_libs=$newdependency_libs
8649 if test dlpreopen = "$pass"; then
8650 # Link the dlpreopened libraries before other libraries
8651 for deplib in $save_deplibs; do
8652 deplibs="$deplib $deplibs"
8655 if test dlopen != "$pass"; then
8656 test conv = "$pass" || {
8657 # Make sure lib_search_path contains only unique directories.
8659 for dir in $newlib_search_path; do
8660 case "$lib_search_path " in
8662 *) func_append lib_search_path " $dir" ;;
8668 if test prog,link = "$linkmode,$pass"; then
8669 vars="compile_deplibs finalize_deplibs"
8673 for var in $vars dependency_libs; do
8674 # Add libraries to $var in reverse order
8675 eval tmp_libs=\"\$$var\"
8677 for deplib in $tmp_libs; do
8678 # FIXME: Pedantically, this is the right thing to do, so
8679 # that some nasty dependency loop isn't accidentally
8681 #new_libs="$deplib $new_libs"
8682 # Pragmatically, this seems to cause very few problems in
8685 -L*) new_libs="$deplib $new_libs" ;;
8688 # And here is the reason: when a library appears more
8689 # than once as an explicit dependence of a library, or
8690 # is implicitly linked in more than once by the
8691 # compiler, it is considered special, and multiple
8692 # occurrences thereof are not removed. Compare this
8693 # with having the same library being listed as a
8694 # dependency of multiple other libraries: in this case,
8695 # we know (pedantically, we assume) the library does not
8696 # need to be listed more than once, so we keep only the
8697 # last copy. This is not always right, but it is rare
8698 # enough that we require users that really mean to play
8699 # such unportable linking tricks to link the library
8700 # using -Wl,-lname, so that libtool does not consider it
8701 # for duplicate removal.
8702 case " $specialdeplibs " in
8703 *" $deplib "*) new_libs="$deplib $new_libs" ;;
8705 case " $new_libs " in
8707 *) new_libs="$deplib $new_libs" ;;
8715 for deplib in $new_libs; do
8718 case " $tmp_libs " in
8720 *) func_append tmp_libs " $deplib" ;;
8723 *) func_append tmp_libs " $deplib" ;;
8726 eval $var=\"$tmp_libs\"
8730 # Add Sun CC postdeps if required:
8731 test CXX = "$tagname" && {
8734 case `$CC -V 2>&1 | sed 5q` in
8735 *Sun\ C*) # Sun C++ 5.9
8738 if test no != "$suncc_use_cstd_abi"; then
8739 func_append postdeps ' -library=Cstd -library=Crun'
8746 func_cc_basename "$CC"
8747 case $func_cc_basename_result in
8751 if test no != "$suncc_use_cstd_abi"; then
8752 func_append postdeps ' -library=Cstd -library=Crun'
8760 # Last step: remove runtime libs from dependency_libs
8761 # (they stay in deplibs)
8763 for i in $dependency_libs; do
8764 case " $predeps $postdeps $compiler_lib_search_path " in
8769 if test -n "$i"; then
8770 func_append tmp_libs " $i"
8773 dependency_libs=$tmp_libs
8775 if test prog = "$linkmode"; then
8778 if test prog = "$linkmode" || test lib = "$linkmode"; then
8779 dlprefiles=$newdlprefiles
8784 if test -n "$dlfiles$dlprefiles" || test no != "$dlself"; then
8785 func_warning "'-dlopen' is ignored for archives"
8790 func_warning "'-l' and '-L' are ignored for archives" ;;
8793 test -n "$rpath" && \
8794 func_warning "'-rpath' is ignored for archives"
8796 test -n "$xrpath" && \
8797 func_warning "'-R' is ignored for archives"
8799 test -n "$vinfo" && \
8800 func_warning "'-version-info/-version-number' is ignored for archives"
8802 test -n "$release" && \
8803 func_warning "'-release' is ignored for archives"
8805 test -n "$export_symbols$export_symbols_regex" && \
8806 func_warning "'-export-symbols' is ignored for archives"
8808 # Now set the variables for building old libraries.
8809 build_libtool_libs=no
8811 func_append objs "$old_deplibs"
8815 # Make sure we only generate libraries of the form 'libNAME.la'.
8818 func_stripname 'lib' '.la' "$outputname"
8819 name=$func_stripname_result
8820 eval shared_ext=\"$shrext_cmds\"
8821 eval libname=\"$libname_spec\"
8824 test no = "$module" \
8825 && func_fatal_help "libtool library '$output' must begin with 'lib'"
8827 if test no != "$need_lib_prefix"; then
8828 # Add the "lib" prefix for modules if required
8829 func_stripname '' '.la' "$outputname"
8830 name=$func_stripname_result
8831 eval shared_ext=\"$shrext_cmds\"
8832 eval libname=\"$libname_spec\"
8834 func_stripname '' '.la' "$outputname"
8835 libname=$func_stripname_result
8840 if test -n "$objs"; then
8841 if test pass_all != "$deplibs_check_method"; then
8842 func_fatal_error "cannot build libtool library '$output' from non-libtool objects on this host:$objs"
8845 $ECHO "*** Warning: Linking the shared library $output against the non-libtool"
8846 $ECHO "*** objects $objs is not portable!"
8847 func_append libobjs " $objs"
8851 test no = "$dlself" \
8852 || func_warning "'-dlopen self' is ignored for libtool libraries"
8857 && func_warning "ignoring multiple '-rpath's for a libtool library"
8862 if test -z "$rpath"; then
8863 if test yes = "$build_libtool_libs"; then
8864 # Building a libtool convenience library.
8865 # Some compilers have problems with a '.al' extension so
8866 # convenience libraries should have the same extension an
8867 # archive normally would.
8868 oldlibs="$output_objdir/$libname.$libext $oldlibs"
8869 build_libtool_libs=convenience
8873 test -n "$vinfo" && \
8874 func_warning "'-version-info/-version-number' is ignored for convenience libraries"
8876 test -n "$release" && \
8877 func_warning "'-release' is ignored for convenience libraries"
8880 # Parse the version information argument.
8881 save_ifs=$IFS; IFS=:
8882 set dummy $vinfo 0 0 0
8887 func_fatal_help "too many parameters to '-version-info'"
8889 # convert absolute version numbers to libtool ages
8890 # this retains compatibility with .la files and attempts
8891 # to make the code below a bit more comprehensible
8893 case $vinfo_number in
8899 # There are really only two kinds -- those that
8900 # use the current revision as the major version
8901 # and those that subtract age and use age as
8902 # a minor version. But, then there is irix
8903 # that has an extra 1 added just for fun
8905 case $version_type in
8906 # correct linux to gnu/linux during the next big refactor
8907 darwin|freebsd-elf|linux|osf|windows|none)
8908 func_arith $number_major + $number_minor
8909 current=$func_arith_result
8911 revision=$number_revision
8913 freebsd-aout|qnx|sunos)
8914 current=$number_major
8915 revision=$number_minor
8919 func_arith $number_major + $number_minor
8920 current=$func_arith_result
8922 revision=$number_minor
8923 lt_irix_increment=no
8926 func_fatal_configuration "$modename: unknown library version type '$version_type'"
8937 # Check that each of the things are valid numbers.
8939 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]) ;;
8941 func_error "CURRENT '$current' must be a nonnegative integer"
8942 func_fatal_error "'$vinfo' is not valid version information"
8947 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]) ;;
8949 func_error "REVISION '$revision' must be a nonnegative integer"
8950 func_fatal_error "'$vinfo' is not valid version information"
8955 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]) ;;
8957 func_error "AGE '$age' must be a nonnegative integer"
8958 func_fatal_error "'$vinfo' is not valid version information"
8962 if test "$age" -gt "$current"; then
8963 func_error "AGE '$age' is greater than the current interface number '$current'"
8964 func_fatal_error "'$vinfo' is not valid version information"
8967 # Calculate the version variables.
8971 case $version_type in
8975 # Like Linux, but with the current version available in
8976 # verstring for coding it into the library header
8977 func_arith $current - $age
8978 major=.$func_arith_result
8979 versuffix=$major.$age.$revision
8980 # Darwin ld doesn't like 0 for these options...
8981 func_arith $current + 1
8982 minor_current=$func_arith_result
8983 xlcverstring="$wl-compatibility_version $wl$minor_current $wl-current_version $wl$minor_current.$revision"
8984 verstring="-compatibility_version $minor_current -current_version $minor_current.$revision"
8985 # On Darwin other compilers
8988 verstring="$wl-compatibility_version $wl$minor_current $wl-current_version $wl$minor_current.$revision"
8991 verstring="-compatibility_version $minor_current -current_version $minor_current.$revision"
8998 versuffix=.$current.$revision
9002 func_arith $current - $age
9003 major=.$func_arith_result
9004 versuffix=$major.$age.$revision
9008 if test no = "$lt_irix_increment"; then
9009 func_arith $current - $age
9011 func_arith $current - $age + 1
9013 major=$func_arith_result
9015 case $version_type in
9016 nonstopux) verstring_prefix=nonstopux ;;
9017 *) verstring_prefix=sgi ;;
9019 verstring=$verstring_prefix$major.$revision
9021 # Add in all the interfaces that we are compatible with.
9023 while test 0 -ne "$loop"; do
9024 func_arith $revision - $loop
9025 iface=$func_arith_result
9026 func_arith $loop - 1
9027 loop=$func_arith_result
9028 verstring=$verstring_prefix$major.$iface:$verstring
9031 # Before this point, $major must not contain '.'.
9033 versuffix=$major.$revision
9036 linux) # correct to gnu/linux during the next big refactor
9037 func_arith $current - $age
9038 major=.$func_arith_result
9039 versuffix=$major.$age.$revision
9043 func_arith $current - $age
9044 major=.$func_arith_result
9045 versuffix=.$current.$age.$revision
9046 verstring=$current.$age.$revision
9048 # Add in all the interfaces that we are compatible with.
9050 while test 0 -ne "$loop"; do
9051 func_arith $current - $loop
9052 iface=$func_arith_result
9053 func_arith $loop - 1
9054 loop=$func_arith_result
9055 verstring=$verstring:$iface.0
9058 # Make executables depend on our current version.
9059 func_append verstring ":$current.0"
9074 versuffix=.$current.$revision
9078 # Use '-' rather than '.', since we only want one
9079 # extension on DOS 8.3 file systems.
9080 func_arith $current - $age
9081 major=$func_arith_result
9086 func_fatal_configuration "unknown library version type '$version_type'"
9090 # Clear the version info if we defaulted, and they specified a release.
9091 if test -z "$vinfo" && test -n "$release"; then
9093 case $version_type in
9095 # we can't check for "0.0" in archive_cmds due to quoting
9096 # problems, so we reset it completely
9103 if test no = "$need_version"; then
9110 # Remove version info from name if versioning should be avoided
9111 if test yes,no = "$avoid_version,$need_version"; then
9117 # Check to see if the archive will have undefined symbols.
9118 if test yes = "$allow_undefined"; then
9119 if test unsupported = "$allow_undefined_flag"; then
9120 if test yes = "$build_old_libs"; then
9121 func_warning "undefined symbols not allowed in $host shared libraries; building static only"
9122 build_libtool_libs=no
9124 func_fatal_error "can't build $host shared library unless -no-undefined is specified"
9128 # Don't allow undefined symbols.
9129 allow_undefined_flag=$no_undefined_flag
9134 func_generate_dlsyms "$libname" "$libname" :
9135 func_append libobjs " $symfileobj"
9136 test " " = "$libobjs" && libobjs=
9138 if test relink != "$opt_mode"; then
9139 # Remove our outputs, but don't remove object files since they
9140 # may have been created when compiling PIC objects.
9142 tempremovelist=`$ECHO "$output_objdir/*"`
9143 for p in $tempremovelist; do
9147 $output_objdir/$outputname | $output_objdir/$libname.* | $output_objdir/$libname$release.*)
9148 if test -n "$precious_files_regex"; then
9149 if $ECHO "$p" | $EGREP -e "$precious_files_regex" >/dev/null 2>&1
9154 func_append removelist " $p"
9159 test -n "$removelist" && \
9160 func_show_eval "${RM}r \$removelist"
9163 # Now set the variables for building old libraries.
9164 if test yes = "$build_old_libs" && test convenience != "$build_libtool_libs"; then
9165 func_append oldlibs " $output_objdir/$libname.$libext"
9167 # Transform .lo files to .o files.
9168 oldobjs="$objs "`$ECHO "$libobjs" | $SP2NL | $SED "/\.$libext$/d; $lo2o" | $NL2SP`
9171 # Eliminate all temporary directories.
9172 #for path in $notinst_path; do
9173 # lib_search_path=`$ECHO "$lib_search_path " | $SED "s% $path % %g"`
9174 # deplibs=`$ECHO "$deplibs " | $SED "s% -L$path % %g"`
9175 # dependency_libs=`$ECHO "$dependency_libs " | $SED "s% -L$path % %g"`
9178 if test -n "$xrpath"; then
9179 # If the user specified any rpath flags, then add them.
9181 for libdir in $xrpath; do
9182 func_replace_sysroot "$libdir"
9183 func_append temp_xrpath " -R$func_replace_sysroot_result"
9184 case "$finalize_rpath " in
9186 *) func_append finalize_rpath " $libdir" ;;
9189 if test yes != "$hardcode_into_libs" || test yes = "$build_old_libs"; then
9190 dependency_libs="$temp_xrpath $dependency_libs"
9194 # Make sure dlfiles contains only unique files that won't be dlpreopened
9195 old_dlfiles=$dlfiles
9197 for lib in $old_dlfiles; do
9198 case " $dlprefiles $dlfiles " in
9200 *) func_append dlfiles " $lib" ;;
9204 # Make sure dlprefiles contains only unique files
9205 old_dlprefiles=$dlprefiles
9207 for lib in $old_dlprefiles; do
9208 case "$dlprefiles " in
9210 *) func_append dlprefiles " $lib" ;;
9214 if test yes = "$build_libtool_libs"; then
9215 if test -n "$rpath"; then
9217 *-*-cygwin* | *-*-mingw* | *-*-pw32* | *-*-os2* | *-*-beos* | *-cegcc* | *-*-haiku*)
9218 # these systems don't actually have a c library (as such)!
9220 *-*-rhapsody* | *-*-darwin1.[012])
9221 # Rhapsody C library is in the System framework
9222 func_append deplibs " System.ltframework"
9225 # Don't link with libc until the a.out ld.so is fixed.
9227 *-*-openbsd* | *-*-freebsd* | *-*-dragonfly*)
9228 # Do not include libc due to us having libc/libc_r.
9230 *-*-sco3.2v5* | *-*-sco5v6*)
9231 # Causes problems with __ctype
9233 *-*-sysv4.2uw2* | *-*-sysv5* | *-*-unixware* | *-*-OpenUNIX*)
9234 # Compiler inserts libc in the correct place for threads to work
9237 # Add libc to deplibs on all other systems if necessary.
9238 if test yes = "$build_libtool_need_lc"; then
9239 func_append deplibs " -lc"
9245 # Transform deplibs into only deplibs that can be linked in shared.
9247 libname_save=$libname
9248 release_save=$release
9249 versuffix_save=$versuffix
9251 # I'm not sure if I'm treating the release correctly. I think
9252 # release should show up in the -l (ie -lgmp5) so we don't want to
9253 # add it in twice. Is that correct?
9259 case $deplibs_check_method in
9261 # Don't check for shared/static. Everything works.
9262 # This might be a little naive. We might want to check
9263 # whether the library exists or not. But this is on
9264 # osf3 & osf4 and I'm not really sure... Just
9265 # implementing what was already the behavior.
9269 # This code stresses the "libraries are programs" paradigm to its
9270 # limits. Maybe even breaks it. We compile a program, linking it
9271 # against the deplibs as a proxy for the library. Then we can check
9272 # whether they linked in statically or dynamically with ldd.
9273 $opt_dry_run || $RM conftest.c
9274 cat > conftest.c <<EOF
9275 int main() { return 0; }
9277 $opt_dry_run || $RM conftest
9278 if $LTCC $LTCFLAGS -o conftest conftest.c $deplibs; then
9279 ldd_output=`ldd conftest`
9280 for i in $deplibs; do
9283 func_stripname -l '' "$i"
9284 name=$func_stripname_result
9285 if test yes = "$allow_libtool_libs_with_static_runtimes"; then
9286 case " $predeps $postdeps " in
9288 func_append newdeplibs " $i"
9293 if test -n "$i"; then
9294 libname=`eval "\\$ECHO \"$libname_spec\""`
9295 deplib_matches=`eval "\\$ECHO \"$library_names_spec\""`
9296 set dummy $deplib_matches; shift
9298 if test `expr "$ldd_output" : ".*$deplib_match"` -ne 0; then
9299 func_append newdeplibs " $i"
9303 $ECHO "*** Warning: dynamic linker does not accept needed library $i."
9304 echo "*** I have the capability to make that library automatically link in when"
9305 echo "*** you link to this library. But I can only do this if you have a"
9306 echo "*** shared version of the library, which I believe you do not have"
9307 echo "*** because a test_compile did reveal that the linker did not use it for"
9308 echo "*** its dynamic dependency list that programs get resolved with at runtime."
9313 func_append newdeplibs " $i"
9318 # Error occurred in the first compile. Let's try to salvage
9319 # the situation: Compile a separate program for each library.
9320 for i in $deplibs; do
9323 func_stripname -l '' "$i"
9324 name=$func_stripname_result
9325 $opt_dry_run || $RM conftest
9326 if $LTCC $LTCFLAGS -o conftest conftest.c $i; then
9327 ldd_output=`ldd conftest`
9328 if test yes = "$allow_libtool_libs_with_static_runtimes"; then
9329 case " $predeps $postdeps " in
9331 func_append newdeplibs " $i"
9336 if test -n "$i"; then
9337 libname=`eval "\\$ECHO \"$libname_spec\""`
9338 deplib_matches=`eval "\\$ECHO \"$library_names_spec\""`
9339 set dummy $deplib_matches; shift
9341 if test `expr "$ldd_output" : ".*$deplib_match"` -ne 0; then
9342 func_append newdeplibs " $i"
9346 $ECHO "*** Warning: dynamic linker does not accept needed library $i."
9347 echo "*** I have the capability to make that library automatically link in when"
9348 echo "*** you link to this library. But I can only do this if you have a"
9349 echo "*** shared version of the library, which you do not appear to have"
9350 echo "*** because a test_compile did reveal that the linker did not use this one"
9351 echo "*** as a dynamic dependency that programs can get resolved with at runtime."
9357 $ECHO "*** Warning! Library $i is needed by this library but I was not able to"
9358 echo "*** make it link in! You will probably need to install it or some"
9359 echo "*** library that it depends on before this library will be fully"
9360 echo "*** functional. Installing it before continuing would be even better."
9364 func_append newdeplibs " $i"
9371 set dummy $deplibs_check_method; shift
9372 file_magic_regex=`expr "$deplibs_check_method" : "$1 \(.*\)"`
9373 for a_deplib in $deplibs; do
9376 func_stripname -l '' "$a_deplib"
9377 name=$func_stripname_result
9378 if test yes = "$allow_libtool_libs_with_static_runtimes"; then
9379 case " $predeps $postdeps " in
9381 func_append newdeplibs " $a_deplib"
9386 if test -n "$a_deplib"; then
9387 libname=`eval "\\$ECHO \"$libname_spec\""`
9388 if test -n "$file_magic_glob"; then
9389 libnameglob=`func_echo_all "$libname" | $SED -e $file_magic_glob`
9391 libnameglob=$libname
9393 test yes = "$want_nocaseglob" && nocaseglob=`shopt -p nocaseglob`
9394 for i in $lib_search_path $sys_lib_search_path $shlib_search_path; do
9395 if test yes = "$want_nocaseglob"; then
9397 potential_libs=`ls $i/$libnameglob[.-]* 2>/dev/null`
9400 potential_libs=`ls $i/$libnameglob[.-]* 2>/dev/null`
9402 for potent_lib in $potential_libs; do
9403 # Follow soft links.
9404 if ls -lLd "$potent_lib" 2>/dev/null |
9405 $GREP " -> " >/dev/null; then
9408 # The statement above tries to avoid entering an
9409 # endless loop below, in case of cyclic links.
9410 # We might still enter an endless loop, since a link
9411 # loop can be closed while we follow links,
9414 while test -h "$potlib" 2>/dev/null; do
9415 potliblink=`ls -ld $potlib | $SED 's/.* -> //'`
9417 [\\/]* | [A-Za-z]:[\\/]*) potlib=$potliblink;;
9418 *) potlib=`$ECHO "$potlib" | $SED 's|[^/]*$||'`"$potliblink";;
9421 if eval $file_magic_cmd \"\$potlib\" 2>/dev/null |
9423 $EGREP "$file_magic_regex" > /dev/null; then
9424 func_append newdeplibs " $a_deplib"
9431 if test -n "$a_deplib"; then
9434 $ECHO "*** Warning: linker path does not have real file for library $a_deplib."
9435 echo "*** I have the capability to make that library automatically link in when"
9436 echo "*** you link to this library. But I can only do this if you have a"
9437 echo "*** shared version of the library, which you do not appear to have"
9438 echo "*** because I did check the linker path looking for a file starting"
9439 if test -z "$potlib"; then
9440 $ECHO "*** with $libname but no candidates were found. (...for file magic test)"
9442 $ECHO "*** with $libname and none of the candidates passed a file format test"
9443 $ECHO "*** using a file magic. Last file checked: $potlib"
9448 # Add a -L argument.
9449 func_append newdeplibs " $a_deplib"
9452 done # Gone through all deplibs.
9455 set dummy $deplibs_check_method; shift
9456 match_pattern_regex=`expr "$deplibs_check_method" : "$1 \(.*\)"`
9457 for a_deplib in $deplibs; do
9460 func_stripname -l '' "$a_deplib"
9461 name=$func_stripname_result
9462 if test yes = "$allow_libtool_libs_with_static_runtimes"; then
9463 case " $predeps $postdeps " in
9465 func_append newdeplibs " $a_deplib"
9470 if test -n "$a_deplib"; then
9471 libname=`eval "\\$ECHO \"$libname_spec\""`
9472 for i in $lib_search_path $sys_lib_search_path $shlib_search_path; do
9473 potential_libs=`ls $i/$libname[.-]* 2>/dev/null`
9474 for potent_lib in $potential_libs; do
9475 potlib=$potent_lib # see symlink-check above in file_magic test
9476 if eval "\$ECHO \"$potent_lib\"" 2>/dev/null | $SED 10q | \
9477 $EGREP "$match_pattern_regex" > /dev/null; then
9478 func_append newdeplibs " $a_deplib"
9485 if test -n "$a_deplib"; then
9488 $ECHO "*** Warning: linker path does not have real file for library $a_deplib."
9489 echo "*** I have the capability to make that library automatically link in when"
9490 echo "*** you link to this library. But I can only do this if you have a"
9491 echo "*** shared version of the library, which you do not appear to have"
9492 echo "*** because I did check the linker path looking for a file starting"
9493 if test -z "$potlib"; then
9494 $ECHO "*** with $libname but no candidates were found. (...for regex pattern test)"
9496 $ECHO "*** with $libname and none of the candidates passed a file format test"
9497 $ECHO "*** using a regex pattern. Last file checked: $potlib"
9502 # Add a -L argument.
9503 func_append newdeplibs " $a_deplib"
9506 done # Gone through all deplibs.
9510 tmp_deplibs=`$ECHO " $deplibs" | $SED 's/ -lc$//; s/ -[LR][^ ]*//g'`
9511 if test yes = "$allow_libtool_libs_with_static_runtimes"; then
9512 for i in $predeps $postdeps; do
9513 # can't use Xsed below, because $i might contain '/'
9514 tmp_deplibs=`$ECHO " $tmp_deplibs" | $SED "s|$i||"`
9517 case $tmp_deplibs in
9520 if test none = "$deplibs_check_method"; then
9521 echo "*** Warning: inter-library dependencies are not supported in this platform."
9523 echo "*** Warning: inter-library dependencies are not known to be supported."
9525 echo "*** All declared inter-library dependencies are being dropped."
9531 versuffix=$versuffix_save
9533 release=$release_save
9534 libname=$libname_save
9538 *-*-rhapsody* | *-*-darwin1.[012])
9539 # On Rhapsody replace the C library with the System framework
9540 newdeplibs=`$ECHO " $newdeplibs" | $SED 's/ -lc / System.ltframework /'`
9544 if test yes = "$droppeddeps"; then
9545 if test yes = "$module"; then
9547 echo "*** Warning: libtool could not satisfy all declared inter-library"
9548 $ECHO "*** dependencies of module $libname. Therefore, libtool will create"
9549 echo "*** a static module, that should work as long as the dlopening"
9550 echo "*** application is linked with the -dlopen flag."
9551 if test -z "$global_symbol_pipe"; then
9553 echo "*** However, this would only work if libtool was able to extract symbol"
9554 echo "*** lists from a program, using 'nm' or equivalent, but libtool could"
9555 echo "*** not find such a program. So, this module is probably useless."
9556 echo "*** 'nm' from GNU binutils and a full rebuild may help."
9558 if test no = "$build_old_libs"; then
9559 oldlibs=$output_objdir/$libname.$libext
9560 build_libtool_libs=module
9563 build_libtool_libs=no
9566 echo "*** The inter-library dependencies that have been dropped here will be"
9567 echo "*** automatically added whenever a program is linked with this library"
9568 echo "*** or is declared to -dlopen it."
9570 if test no = "$allow_undefined"; then
9572 echo "*** Since this library must not contain undefined symbols,"
9573 echo "*** because either the platform does not support them or"
9574 echo "*** it was explicitly requested with -no-undefined,"
9575 echo "*** libtool will only create a static version of it."
9576 if test no = "$build_old_libs"; then
9577 oldlibs=$output_objdir/$libname.$libext
9578 build_libtool_libs=module
9581 build_libtool_libs=no
9586 # Done checking deplibs!
9589 # Time to change all our "foo.ltframework" stuff back to "-framework foo"
9592 newdeplibs=`$ECHO " $newdeplibs" | $SED 's% \([^ $]*\).ltframework% -framework \1%g'`
9593 new_inherited_linker_flags=`$ECHO " $new_inherited_linker_flags" | $SED 's% \([^ $]*\).ltframework% -framework \1%g'`
9594 deplibs=`$ECHO " $deplibs" | $SED 's% \([^ $]*\).ltframework% -framework \1%g'`
9598 # move library search paths that coincide with paths to not yet
9599 # installed libraries to the beginning of the library search list
9601 for path in $notinst_path; do
9602 case " $new_libs " in
9603 *" -L$path/$objdir "*) ;;
9605 case " $deplibs " in
9606 *" -L$path/$objdir "*)
9607 func_append new_libs " -L$path/$objdir" ;;
9612 for deplib in $deplibs; do
9615 case " $new_libs " in
9617 *) func_append new_libs " $deplib" ;;
9620 *) func_append new_libs " $deplib" ;;
9625 # All the library-specific variables (install_libdir is set above).
9630 # Test again, we may have decided not to build it any more
9631 if test yes = "$build_libtool_libs"; then
9632 # Remove $wl instances when linking with ld.
9633 # FIXME: should test the right _cmds variable.
9634 case $archive_cmds in
9637 if test yes = "$hardcode_into_libs"; then
9638 # Hardcode the library paths
9641 rpath=$finalize_rpath
9642 test relink = "$opt_mode" || rpath=$compile_rpath$rpath
9643 for libdir in $rpath; do
9644 if test -n "$hardcode_libdir_flag_spec"; then
9645 if test -n "$hardcode_libdir_separator"; then
9646 func_replace_sysroot "$libdir"
9647 libdir=$func_replace_sysroot_result
9648 if test -z "$hardcode_libdirs"; then
9649 hardcode_libdirs=$libdir
9651 # Just accumulate the unique libdirs.
9652 case $hardcode_libdir_separator$hardcode_libdirs$hardcode_libdir_separator in
9653 *"$hardcode_libdir_separator$libdir$hardcode_libdir_separator"*)
9656 func_append hardcode_libdirs "$hardcode_libdir_separator$libdir"
9661 eval flag=\"$hardcode_libdir_flag_spec\"
9662 func_append dep_rpath " $flag"
9664 elif test -n "$runpath_var"; then
9665 case "$perm_rpath " in
9667 *) func_append perm_rpath " $libdir" ;;
9671 # Substitute the hardcoded libdirs into the rpath.
9672 if test -n "$hardcode_libdir_separator" &&
9673 test -n "$hardcode_libdirs"; then
9674 libdir=$hardcode_libdirs
9675 eval "dep_rpath=\"$hardcode_libdir_flag_spec\""
9677 if test -n "$runpath_var" && test -n "$perm_rpath"; then
9678 # We should set the runpath_var.
9680 for dir in $perm_rpath; do
9681 func_append rpath "$dir:"
9683 eval "$runpath_var='$rpath\$$runpath_var'; export $runpath_var"
9685 test -n "$dep_rpath" && deplibs="$dep_rpath $deplibs"
9688 shlibpath=$finalize_shlibpath
9689 test relink = "$opt_mode" || shlibpath=$compile_shlibpath$shlibpath
9690 if test -n "$shlibpath"; then
9691 eval "$shlibpath_var='$shlibpath\$$shlibpath_var'; export $shlibpath_var"
9694 # Get the real and link names of the library.
9695 eval shared_ext=\"$shrext_cmds\"
9696 eval library_names=\"$library_names_spec\"
9697 set dummy $library_names
9702 if test -n "$soname_spec"; then
9703 eval soname=\"$soname_spec\"
9707 if test -z "$dlname"; then
9711 lib=$output_objdir/$realname
9715 func_append linknames " $link"
9718 # Use standard objects if they are pic
9719 test -z "$pic_flag" && libobjs=`$ECHO "$libobjs" | $SP2NL | $SED "$lo2o" | $NL2SP`
9720 test "X$libobjs" = "X " && libobjs=
9723 if test -n "$export_symbols" && test -n "$include_expsyms"; then
9724 $opt_dry_run || cp "$export_symbols" "$output_objdir/$libname.uexp"
9725 export_symbols=$output_objdir/$libname.uexp
9726 func_append delfiles " $export_symbols"
9729 orig_export_symbols=
9731 cygwin* | mingw* | cegcc*)
9732 if test -n "$export_symbols" && test -z "$export_symbols_regex"; then
9733 # exporting using user supplied symfile
9734 func_dll_def_p "$export_symbols" || {
9735 # and it's NOT already a .def file. Must figure out
9736 # which of the given symbols are data symbols and tag
9737 # them as such. So, trigger use of export_symbols_cmds.
9738 # export_symbols gets reassigned inside the "prepare
9739 # the list of exported symbols" if statement, so the
9740 # include_expsyms logic still works.
9741 orig_export_symbols=$export_symbols
9743 always_export_symbols=yes
9749 # Prepare the list of exported symbols
9750 if test -z "$export_symbols"; then
9751 if test yes = "$always_export_symbols" || test -n "$export_symbols_regex"; then
9752 func_verbose "generating symbol list for '$libname.la'"
9753 export_symbols=$output_objdir/$libname.exp
9754 $opt_dry_run || $RM $export_symbols
9755 cmds=$export_symbols_cmds
9756 save_ifs=$IFS; IFS='~'
9757 for cmd1 in $cmds; do
9759 # Take the normal branch if the nm_file_list_spec branch
9760 # doesn't work or if tool conversion is not needed.
9761 case $nm_file_list_spec~$to_tool_file_cmd in
9762 *~func_convert_file_noop | *~func_convert_file_msys_to_w32 | ~*)
9763 try_normal_branch=yes
9766 len=$func_len_result
9769 try_normal_branch=no
9772 if test yes = "$try_normal_branch" \
9773 && { test "$len" -lt "$max_cmd_len" \
9774 || test "$max_cmd_len" -le -1; }
9776 func_show_eval "$cmd" 'exit $?'
9777 skipped_export=false
9778 elif test -n "$nm_file_list_spec"; then
9779 func_basename "$output"
9780 output_la=$func_basename_result
9781 save_libobjs=$libobjs
9783 output=$output_objdir/$output_la.nm
9784 func_to_tool_file "$output"
9785 libobjs=$nm_file_list_spec$func_to_tool_file_result
9786 func_append delfiles " $output"
9787 func_verbose "creating $NM input file list: $output"
9788 for obj in $save_libobjs; do
9789 func_to_tool_file "$obj"
9790 $ECHO "$func_to_tool_file_result"
9793 func_show_eval "$cmd" 'exit $?'
9795 libobjs=$save_libobjs
9796 skipped_export=false
9798 # The command line is too long to execute in one step.
9799 func_verbose "using reloadable object file for export list..."
9801 # Break out early, otherwise skipped_export may be
9802 # set to false by a later but shorter cmd.
9807 if test -n "$export_symbols_regex" && test : != "$skipped_export"; then
9808 func_show_eval '$EGREP -e "$export_symbols_regex" "$export_symbols" > "${export_symbols}T"'
9809 func_show_eval '$MV "${export_symbols}T" "$export_symbols"'
9814 if test -n "$export_symbols" && test -n "$include_expsyms"; then
9815 tmp_export_symbols=$export_symbols
9816 test -n "$orig_export_symbols" && tmp_export_symbols=$orig_export_symbols
9817 $opt_dry_run || eval '$ECHO "$include_expsyms" | $SP2NL >> "$tmp_export_symbols"'
9820 if test : != "$skipped_export" && test -n "$orig_export_symbols"; then
9821 # The given exports_symbols file has to be filtered, so filter it.
9822 func_verbose "filter symbol list for '$libname.la' to tag DATA exports"
9823 # FIXME: $output_objdir/$libname.filter potentially contains lots of
9824 # 's' commands, which not all seds can handle. GNU sed should be fine
9825 # though. Also, the filter scales superlinearly with the number of
9826 # global variables. join(1) would be nice here, but unfortunately
9827 # isn't a blessed tool.
9828 $opt_dry_run || $SED -e '/[ ,]DATA/!d;s,\(.*\)\([ \,].*\),s|^\1$|\1\2|,' < $export_symbols > $output_objdir/$libname.filter
9829 func_append delfiles " $export_symbols $output_objdir/$libname.filter"
9830 export_symbols=$output_objdir/$libname.def
9831 $opt_dry_run || $SED -f $output_objdir/$libname.filter < $orig_export_symbols > $export_symbols
9835 for test_deplib in $deplibs; do
9836 case " $convenience " in
9837 *" $test_deplib "*) ;;
9839 func_append tmp_deplibs " $test_deplib"
9843 deplibs=$tmp_deplibs
9845 if test -n "$convenience"; then
9846 if test -n "$whole_archive_flag_spec" &&
9847 test yes = "$compiler_needs_object" &&
9848 test -z "$libobjs"; then
9849 # extract the archives, so we have objects to list.
9850 # TODO: could optimize this to just extract one archive.
9851 whole_archive_flag_spec=
9853 if test -n "$whole_archive_flag_spec"; then
9854 save_libobjs=$libobjs
9855 eval libobjs=\"\$libobjs $whole_archive_flag_spec\"
9856 test "X$libobjs" = "X " && libobjs=
9858 gentop=$output_objdir/${outputname}x
9859 func_append generated " $gentop"
9861 func_extract_archives $gentop $convenience
9862 func_append libobjs " $func_extract_archives_result"
9863 test "X$libobjs" = "X " && libobjs=
9867 if test yes = "$thread_safe" && test -n "$thread_safe_flag_spec"; then
9868 eval flag=\"$thread_safe_flag_spec\"
9869 func_append linker_flags " $flag"
9872 # Make a backup of the uninstalled library when relinking
9873 if test relink = "$opt_mode"; then
9874 $opt_dry_run || eval '(cd $output_objdir && $RM ${realname}U && $MV $realname ${realname}U)' || exit $?
9877 # Do each of the archive commands.
9878 if test yes = "$module" && test -n "$module_cmds"; then
9879 if test -n "$export_symbols" && test -n "$module_expsym_cmds"; then
9880 eval test_cmds=\"$module_expsym_cmds\"
9881 cmds=$module_expsym_cmds
9883 eval test_cmds=\"$module_cmds\"
9887 if test -n "$export_symbols" && test -n "$archive_expsym_cmds"; then
9888 eval test_cmds=\"$archive_expsym_cmds\"
9889 cmds=$archive_expsym_cmds
9891 eval test_cmds=\"$archive_cmds\"
9896 if test : != "$skipped_export" &&
9897 func_len " $test_cmds" &&
9898 len=$func_len_result &&
9899 test "$len" -lt "$max_cmd_len" || test "$max_cmd_len" -le -1; then
9902 # The command line is too long to link in one step, link piecewise
9903 # or, if using GNU ld and skipped_export is not :, use a linker
9906 # Save the value of $output and $libobjs because we want to
9907 # use them later. If we have whole_archive_flag_spec, we
9908 # want to use save_libobjs as it was before
9909 # whole_archive_flag_spec was expanded, because we can't
9910 # assume the linker understands whole_archive_flag_spec.
9911 # This may have to be revisited, in case too many
9912 # convenience libraries get linked in and end up exceeding
9914 if test -z "$convenience" || test -z "$whole_archive_flag_spec"; then
9915 save_libobjs=$libobjs
9918 func_basename "$output"
9919 output_la=$func_basename_result
9921 # Clear the reloadable object creation command queue and
9922 # initialize k to one.
9929 if test -n "$save_libobjs" && test : != "$skipped_export" && test yes = "$with_gnu_ld"; then
9930 output=$output_objdir/$output_la.lnkscript
9931 func_verbose "creating GNU ld script: $output"
9932 echo 'INPUT (' > $output
9933 for obj in $save_libobjs
9935 func_to_tool_file "$obj"
9936 $ECHO "$func_to_tool_file_result" >> $output
9939 func_append delfiles " $output"
9940 func_to_tool_file "$output"
9941 output=$func_to_tool_file_result
9942 elif test -n "$save_libobjs" && test : != "$skipped_export" && test -n "$file_list_spec"; then
9943 output=$output_objdir/$output_la.lnk
9944 func_verbose "creating linker input file list: $output"
9949 if test yes = "$compiler_needs_object"; then
9955 func_to_tool_file "$obj"
9956 $ECHO "$func_to_tool_file_result" >> $output
9958 func_append delfiles " $output"
9959 func_to_tool_file "$output"
9960 output=$firstobj\"$file_list_spec$func_to_tool_file_result\"
9962 if test -n "$save_libobjs"; then
9963 func_verbose "creating reloadable object files..."
9964 output=$output_objdir/$output_la-$k.$objext
9965 eval test_cmds=\"$reload_cmds\"
9966 func_len " $test_cmds"
9967 len0=$func_len_result
9970 # Loop over the list of objects to be linked.
9971 for obj in $save_libobjs
9974 func_arith $len + $func_len_result
9975 len=$func_arith_result
9976 if test -z "$objlist" ||
9977 test "$len" -lt "$max_cmd_len"; then
9978 func_append objlist " $obj"
9980 # The command $test_cmds is almost too long, add a
9981 # command to the queue.
9982 if test 1 -eq "$k"; then
9983 # The first file doesn't have a previous command to add.
9984 reload_objs=$objlist
9985 eval concat_cmds=\"$reload_cmds\"
9987 # All subsequent reloadable object files will link in
9988 # the last one created.
9989 reload_objs="$objlist $last_robj"
9990 eval concat_cmds=\"\$concat_cmds~$reload_cmds~\$RM $last_robj\"
9992 last_robj=$output_objdir/$output_la-$k.$objext
9994 k=$func_arith_result
9995 output=$output_objdir/$output_la-$k.$objext
9997 func_len " $last_robj"
9998 func_arith $len0 + $func_len_result
9999 len=$func_arith_result
10002 # Handle the remaining objects by creating one last
10003 # reloadable object file. All subsequent reloadable object
10004 # files will link in the last one created.
10005 test -z "$concat_cmds" || concat_cmds=$concat_cmds~
10006 reload_objs="$objlist $last_robj"
10007 eval concat_cmds=\"\$concat_cmds$reload_cmds\"
10008 if test -n "$last_robj"; then
10009 eval concat_cmds=\"\$concat_cmds~\$RM $last_robj\"
10011 func_append delfiles " $output"
10017 ${skipped_export-false} && {
10018 func_verbose "generating symbol list for '$libname.la'"
10019 export_symbols=$output_objdir/$libname.exp
10020 $opt_dry_run || $RM $export_symbols
10022 # Append the command to create the export file.
10023 test -z "$concat_cmds" || concat_cmds=$concat_cmds~
10024 eval concat_cmds=\"\$concat_cmds$export_symbols_cmds\"
10025 if test -n "$last_robj"; then
10026 eval concat_cmds=\"\$concat_cmds~\$RM $last_robj\"
10030 test -n "$save_libobjs" &&
10031 func_verbose "creating a temporary reloadable object file: $output"
10033 # Loop through the commands generated above and execute them.
10034 save_ifs=$IFS; IFS='~'
10035 for cmd in $concat_cmds; do
10038 func_quote_for_expand "$cmd"
10039 eval "func_echo $func_quote_for_expand_result"
10041 $opt_dry_run || eval "$cmd" || {
10044 # Restore the uninstalled library and exit
10045 if test relink = "$opt_mode"; then
10046 ( cd "$output_objdir" && \
10047 $RM "${realname}T" && \
10048 $MV "${realname}U" "$realname" )
10056 if test -n "$export_symbols_regex" && ${skipped_export-false}; then
10057 func_show_eval '$EGREP -e "$export_symbols_regex" "$export_symbols" > "${export_symbols}T"'
10058 func_show_eval '$MV "${export_symbols}T" "$export_symbols"'
10062 ${skipped_export-false} && {
10063 if test -n "$export_symbols" && test -n "$include_expsyms"; then
10064 tmp_export_symbols=$export_symbols
10065 test -n "$orig_export_symbols" && tmp_export_symbols=$orig_export_symbols
10066 $opt_dry_run || eval '$ECHO "$include_expsyms" | $SP2NL >> "$tmp_export_symbols"'
10069 if test -n "$orig_export_symbols"; then
10070 # The given exports_symbols file has to be filtered, so filter it.
10071 func_verbose "filter symbol list for '$libname.la' to tag DATA exports"
10072 # FIXME: $output_objdir/$libname.filter potentially contains lots of
10073 # 's' commands, which not all seds can handle. GNU sed should be fine
10074 # though. Also, the filter scales superlinearly with the number of
10075 # global variables. join(1) would be nice here, but unfortunately
10076 # isn't a blessed tool.
10077 $opt_dry_run || $SED -e '/[ ,]DATA/!d;s,\(.*\)\([ \,].*\),s|^\1$|\1\2|,' < $export_symbols > $output_objdir/$libname.filter
10078 func_append delfiles " $export_symbols $output_objdir/$libname.filter"
10079 export_symbols=$output_objdir/$libname.def
10080 $opt_dry_run || $SED -f $output_objdir/$libname.filter < $orig_export_symbols > $export_symbols
10085 # Restore the value of output.
10086 output=$save_output
10088 if test -n "$convenience" && test -n "$whole_archive_flag_spec"; then
10089 eval libobjs=\"\$libobjs $whole_archive_flag_spec\"
10090 test "X$libobjs" = "X " && libobjs=
10092 # Expand the library linking commands again to reset the
10093 # value of $libobjs for piecewise linking.
10095 # Do each of the archive commands.
10096 if test yes = "$module" && test -n "$module_cmds"; then
10097 if test -n "$export_symbols" && test -n "$module_expsym_cmds"; then
10098 cmds=$module_expsym_cmds
10103 if test -n "$export_symbols" && test -n "$archive_expsym_cmds"; then
10104 cmds=$archive_expsym_cmds
10111 if test -n "$delfiles"; then
10112 # Append the command to remove temporary files to $cmds.
10113 eval cmds=\"\$cmds~\$RM $delfiles\"
10116 # Add any objects from preloaded convenience libraries
10117 if test -n "$dlprefiles"; then
10118 gentop=$output_objdir/${outputname}x
10119 func_append generated " $gentop"
10121 func_extract_archives $gentop $dlprefiles
10122 func_append libobjs " $func_extract_archives_result"
10123 test "X$libobjs" = "X " && libobjs=
10126 save_ifs=$IFS; IFS='~'
10127 for cmd in $cmds; do
10132 func_quote_for_expand "$cmd"
10133 eval "func_echo $func_quote_for_expand_result"
10135 $opt_dry_run || eval "$cmd" || {
10138 # Restore the uninstalled library and exit
10139 if test relink = "$opt_mode"; then
10140 ( cd "$output_objdir" && \
10141 $RM "${realname}T" && \
10142 $MV "${realname}U" "$realname" )
10150 # Restore the uninstalled library and exit
10151 if test relink = "$opt_mode"; then
10152 $opt_dry_run || eval '(cd $output_objdir && $RM ${realname}T && $MV $realname ${realname}T && $MV ${realname}U $realname)' || exit $?
10154 if test -n "$convenience"; then
10155 if test -z "$whole_archive_flag_spec"; then
10156 func_show_eval '${RM}r "$gentop"'
10163 # Create links to the real library.
10164 for linkname in $linknames; do
10165 if test "$realname" != "$linkname"; then
10166 func_show_eval '(cd "$output_objdir" && $RM "$linkname" && $LN_S "$realname" "$linkname")' 'exit $?'
10170 # If -module or -export-dynamic was specified, set the dlname.
10171 if test yes = "$module" || test yes = "$export_dynamic"; then
10172 # On all known operating systems, these are identical.
10179 if test -n "$dlfiles$dlprefiles" || test no != "$dlself"; then
10180 func_warning "'-dlopen' is ignored for objects"
10183 case " $deplibs" in
10185 func_warning "'-l' and '-L' are ignored for objects" ;;
10188 test -n "$rpath" && \
10189 func_warning "'-rpath' is ignored for objects"
10191 test -n "$xrpath" && \
10192 func_warning "'-R' is ignored for objects"
10194 test -n "$vinfo" && \
10195 func_warning "'-version-info' is ignored for objects"
10197 test -n "$release" && \
10198 func_warning "'-release' is ignored for objects"
10202 test -n "$objs$old_deplibs" && \
10203 func_fatal_error "cannot build library object '$output' from non-libtool objects"
10206 func_lo2o "$libobj"
10207 obj=$func_lo2o_result
10215 # Delete the old objects.
10216 $opt_dry_run || $RM $obj $libobj
10218 # Objects from convenience libraries. This assumes
10219 # single-version convenience libraries. Whenever we create
10220 # different ones for PIC/non-PIC, this we'll have to duplicate
10224 # if reload_cmds runs $LD directly, get rid of -Wl from
10225 # whole_archive_flag_spec and hope we can get by with turning comma
10227 case $reload_cmds in
10228 *\$LD[\ \$]*) wl= ;;
10230 if test -n "$convenience"; then
10231 if test -n "$whole_archive_flag_spec"; then
10232 eval tmp_whole_archive_flags=\"$whole_archive_flag_spec\"
10233 test -n "$wl" || tmp_whole_archive_flags=`$ECHO "$tmp_whole_archive_flags" | $SED 's|,| |g'`
10234 reload_conv_objs=$reload_objs\ $tmp_whole_archive_flags
10236 gentop=$output_objdir/${obj}x
10237 func_append generated " $gentop"
10239 func_extract_archives $gentop $convenience
10240 reload_conv_objs="$reload_objs $func_extract_archives_result"
10244 # If we're not building shared, we need to use non_pic_objs
10245 test yes = "$build_libtool_libs" || libobjs=$non_pic_objects
10247 # Create the old-style object.
10248 reload_objs=$objs$old_deplibs' '`$ECHO "$libobjs" | $SP2NL | $SED "/\.$libext$/d; /\.lib$/d; $lo2o" | $NL2SP`' '$reload_conv_objs
10251 func_execute_cmds "$reload_cmds" 'exit $?'
10253 # Exit if we aren't doing a library object file.
10254 if test -z "$libobj"; then
10255 if test -n "$gentop"; then
10256 func_show_eval '${RM}r "$gentop"'
10262 test yes = "$build_libtool_libs" || {
10263 if test -n "$gentop"; then
10264 func_show_eval '${RM}r "$gentop"'
10267 # Create an invalid libtool object if no PIC, so that we don't
10268 # accidentally link it into a program.
10269 # $show "echo timestamp > $libobj"
10270 # $opt_dry_run || eval "echo timestamp > $libobj" || exit $?
10274 if test -n "$pic_flag" || test default != "$pic_mode"; then
10275 # Only do commands if we really have different PIC objects.
10276 reload_objs="$libobjs $reload_conv_objs"
10278 func_execute_cmds "$reload_cmds" 'exit $?'
10281 if test -n "$gentop"; then
10282 func_show_eval '${RM}r "$gentop"'
10290 *cygwin*) func_stripname '' '.exe' "$output"
10291 output=$func_stripname_result.exe;;
10293 test -n "$vinfo" && \
10294 func_warning "'-version-info' is ignored for programs"
10296 test -n "$release" && \
10297 func_warning "'-release' is ignored for programs"
10300 && test unknown,unknown,unknown = "$dlopen_support,$dlopen_self,$dlopen_self_static" \
10301 && func_warning "'LT_INIT([dlopen])' not used. Assuming no dlopen support."
10304 *-*-rhapsody* | *-*-darwin1.[012])
10305 # On Rhapsody replace the C library is the System framework
10306 compile_deplibs=`$ECHO " $compile_deplibs" | $SED 's/ -lc / System.ltframework /'`
10307 finalize_deplibs=`$ECHO " $finalize_deplibs" | $SED 's/ -lc / System.ltframework /'`
10313 # Don't allow lazy linking, it breaks C++ global constructors
10314 # But is supposedly fixed on 10.4 or later (yay!).
10315 if test CXX = "$tagname"; then
10316 case ${MACOSX_DEPLOYMENT_TARGET-10.0} in
10318 func_append compile_command " $wl-bind_at_load"
10319 func_append finalize_command " $wl-bind_at_load"
10323 # Time to change all our "foo.ltframework" stuff back to "-framework foo"
10324 compile_deplibs=`$ECHO " $compile_deplibs" | $SED 's% \([^ $]*\).ltframework% -framework \1%g'`
10325 finalize_deplibs=`$ECHO " $finalize_deplibs" | $SED 's% \([^ $]*\).ltframework% -framework \1%g'`
10330 # move library search paths that coincide with paths to not yet
10331 # installed libraries to the beginning of the library search list
10333 for path in $notinst_path; do
10334 case " $new_libs " in
10335 *" -L$path/$objdir "*) ;;
10337 case " $compile_deplibs " in
10338 *" -L$path/$objdir "*)
10339 func_append new_libs " -L$path/$objdir" ;;
10344 for deplib in $compile_deplibs; do
10347 case " $new_libs " in
10349 *) func_append new_libs " $deplib" ;;
10352 *) func_append new_libs " $deplib" ;;
10355 compile_deplibs=$new_libs
10358 func_append compile_command " $compile_deplibs"
10359 func_append finalize_command " $finalize_deplibs"
10361 if test -n "$rpath$xrpath"; then
10362 # If the user specified any rpath flags, then add them.
10363 for libdir in $rpath $xrpath; do
10364 # This is the magic to use -rpath.
10365 case "$finalize_rpath " in
10367 *) func_append finalize_rpath " $libdir" ;;
10372 # Now hardcode the library paths
10375 for libdir in $compile_rpath $finalize_rpath; do
10376 if test -n "$hardcode_libdir_flag_spec"; then
10377 if test -n "$hardcode_libdir_separator"; then
10378 if test -z "$hardcode_libdirs"; then
10379 hardcode_libdirs=$libdir
10381 # Just accumulate the unique libdirs.
10382 case $hardcode_libdir_separator$hardcode_libdirs$hardcode_libdir_separator in
10383 *"$hardcode_libdir_separator$libdir$hardcode_libdir_separator"*)
10386 func_append hardcode_libdirs "$hardcode_libdir_separator$libdir"
10391 eval flag=\"$hardcode_libdir_flag_spec\"
10392 func_append rpath " $flag"
10394 elif test -n "$runpath_var"; then
10395 case "$perm_rpath " in
10397 *) func_append perm_rpath " $libdir" ;;
10401 *-*-cygwin* | *-*-mingw* | *-*-pw32* | *-*-os2* | *-cegcc*)
10402 testbindir=`$ECHO "$libdir" | $SED -e 's*/lib$*/bin*'`
10403 case :$dllsearchpath: in
10405 ::) dllsearchpath=$libdir;;
10406 *) func_append dllsearchpath ":$libdir";;
10408 case :$dllsearchpath: in
10409 *":$testbindir:"*) ;;
10410 ::) dllsearchpath=$testbindir;;
10411 *) func_append dllsearchpath ":$testbindir";;
10416 # Substitute the hardcoded libdirs into the rpath.
10417 if test -n "$hardcode_libdir_separator" &&
10418 test -n "$hardcode_libdirs"; then
10419 libdir=$hardcode_libdirs
10420 eval rpath=\" $hardcode_libdir_flag_spec\"
10422 compile_rpath=$rpath
10426 for libdir in $finalize_rpath; do
10427 if test -n "$hardcode_libdir_flag_spec"; then
10428 if test -n "$hardcode_libdir_separator"; then
10429 if test -z "$hardcode_libdirs"; then
10430 hardcode_libdirs=$libdir
10432 # Just accumulate the unique libdirs.
10433 case $hardcode_libdir_separator$hardcode_libdirs$hardcode_libdir_separator in
10434 *"$hardcode_libdir_separator$libdir$hardcode_libdir_separator"*)
10437 func_append hardcode_libdirs "$hardcode_libdir_separator$libdir"
10442 eval flag=\"$hardcode_libdir_flag_spec\"
10443 func_append rpath " $flag"
10445 elif test -n "$runpath_var"; then
10446 case "$finalize_perm_rpath " in
10448 *) func_append finalize_perm_rpath " $libdir" ;;
10452 # Substitute the hardcoded libdirs into the rpath.
10453 if test -n "$hardcode_libdir_separator" &&
10454 test -n "$hardcode_libdirs"; then
10455 libdir=$hardcode_libdirs
10456 eval rpath=\" $hardcode_libdir_flag_spec\"
10458 finalize_rpath=$rpath
10460 if test -n "$libobjs" && test yes = "$build_old_libs"; then
10461 # Transform all the library objects into standard objects.
10462 compile_command=`$ECHO "$compile_command" | $SP2NL | $SED "$lo2o" | $NL2SP`
10463 finalize_command=`$ECHO "$finalize_command" | $SP2NL | $SED "$lo2o" | $NL2SP`
10466 func_generate_dlsyms "$outputname" "@PROGRAM@" false
10468 # template prelinking step
10469 if test -n "$prelink_cmds"; then
10470 func_execute_cmds "$prelink_cmds" 'exit $?'
10473 wrappers_required=:
10475 *cegcc* | *mingw32ce*)
10476 # Disable wrappers for cegcc and mingw32ce hosts, we are cross compiling anyway.
10477 wrappers_required=false
10479 *cygwin* | *mingw* )
10480 test yes = "$build_libtool_libs" || wrappers_required=false
10483 if test no = "$need_relink" || test yes != "$build_libtool_libs"; then
10484 wrappers_required=false
10488 $wrappers_required || {
10489 # Replace the output file specification.
10490 compile_command=`$ECHO "$compile_command" | $SED 's%@OUTPUT@%'"$output"'%g'`
10491 link_command=$compile_command$compile_rpath
10493 # We have no uninstalled library dependencies, so finalize right now.
10495 func_show_eval "$link_command" 'exit_status=$?'
10497 if test -n "$postlink_cmds"; then
10498 func_to_tool_file "$output"
10499 postlink_cmds=`func_echo_all "$postlink_cmds" | $SED -e 's%@OUTPUT@%'"$output"'%g' -e 's%@TOOL_OUTPUT@%'"$func_to_tool_file_result"'%g'`
10500 func_execute_cmds "$postlink_cmds" 'exit $?'
10503 # Delete the generated files.
10504 if test -f "$output_objdir/${outputname}S.$objext"; then
10505 func_show_eval '$RM "$output_objdir/${outputname}S.$objext"'
10511 if test -n "$compile_shlibpath$finalize_shlibpath"; then
10512 compile_command="$shlibpath_var=\"$compile_shlibpath$finalize_shlibpath\$$shlibpath_var\" $compile_command"
10514 if test -n "$finalize_shlibpath"; then
10515 finalize_command="$shlibpath_var=\"$finalize_shlibpath\$$shlibpath_var\" $finalize_command"
10520 if test -n "$runpath_var"; then
10521 if test -n "$perm_rpath"; then
10522 # We should set the runpath_var.
10524 for dir in $perm_rpath; do
10525 func_append rpath "$dir:"
10527 compile_var="$runpath_var=\"$rpath\$$runpath_var\" "
10529 if test -n "$finalize_perm_rpath"; then
10530 # We should set the runpath_var.
10532 for dir in $finalize_perm_rpath; do
10533 func_append rpath "$dir:"
10535 finalize_var="$runpath_var=\"$rpath\$$runpath_var\" "
10539 if test yes = "$no_install"; then
10540 # We don't need to create a wrapper script.
10541 link_command=$compile_var$compile_command$compile_rpath
10542 # Replace the output file specification.
10543 link_command=`$ECHO "$link_command" | $SED 's%@OUTPUT@%'"$output"'%g'`
10544 # Delete the old output file.
10545 $opt_dry_run || $RM $output
10546 # Link the executable and exit
10547 func_show_eval "$link_command" 'exit $?'
10549 if test -n "$postlink_cmds"; then
10550 func_to_tool_file "$output"
10551 postlink_cmds=`func_echo_all "$postlink_cmds" | $SED -e 's%@OUTPUT@%'"$output"'%g' -e 's%@TOOL_OUTPUT@%'"$func_to_tool_file_result"'%g'`
10552 func_execute_cmds "$postlink_cmds" 'exit $?'
10558 case $hardcode_action,$fast_install in
10560 # Fast installation is not supported
10561 link_command=$compile_var$compile_command$compile_rpath
10562 relink_command=$finalize_var$finalize_command$finalize_rpath
10564 func_warning "this platform does not like uninstalled shared libraries"
10565 func_warning "'$output' will be relinked during installation"
10568 link_command=$finalize_var$compile_command$finalize_rpath
10569 relink_command=`$ECHO "$compile_var$compile_command$compile_rpath" | $SED 's%@OUTPUT@%\$progdir/\$file%g'`
10572 link_command=$compile_var$compile_command$compile_rpath
10573 relink_command=$finalize_var$finalize_command$finalize_rpath
10576 link_command=$finalize_var$compile_command$finalize_rpath
10581 # Replace the output file specification.
10582 link_command=`$ECHO "$link_command" | $SED 's%@OUTPUT@%'"$output_objdir/$outputname"'%g'`
10584 # Delete the old output files.
10585 $opt_dry_run || $RM $output $output_objdir/$outputname $output_objdir/lt-$outputname
10587 func_show_eval "$link_command" 'exit $?'
10589 if test -n "$postlink_cmds"; then
10590 func_to_tool_file "$output_objdir/$outputname"
10591 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'`
10592 func_execute_cmds "$postlink_cmds" 'exit $?'
10595 # Now create the wrapper script.
10596 func_verbose "creating $output"
10598 # Quote the relink command for shipping.
10599 if test -n "$relink_command"; then
10600 # Preserve any variables that may affect compiler behavior
10601 for var in $variables_saved_for_relink; do
10602 if eval test -z \"\${$var+set}\"; then
10603 relink_command="{ test -z \"\${$var+set}\" || $lt_unset $var || { $var=; export $var; }; }; $relink_command"
10604 elif eval var_value=\$$var; test -z "$var_value"; then
10605 relink_command="$var=; export $var; $relink_command"
10607 func_quote_for_eval "$var_value"
10608 relink_command="$var=$func_quote_for_eval_result; export $var; $relink_command"
10611 relink_command="(cd `pwd`; $relink_command)"
10612 relink_command=`$ECHO "$relink_command" | $SED "$sed_quote_subst"`
10615 # Only actually do things if not in dry run mode.
10617 # win32 will think the script is a binary if it has
10618 # a .exe suffix, so we strip it off here.
10620 *.exe) func_stripname '' '.exe' "$output"
10621 output=$func_stripname_result ;;
10623 # test for cygwin because mv fails w/o .exe extensions
10627 func_stripname '' '.exe' "$outputname"
10628 outputname=$func_stripname_result ;;
10632 *cygwin* | *mingw* )
10633 func_dirname_and_basename "$output" "" "."
10634 output_name=$func_basename_result
10635 output_path=$func_dirname_result
10636 cwrappersource=$output_path/$objdir/lt-$output_name.c
10637 cwrapper=$output_path/$output_name.exe
10638 $RM $cwrappersource $cwrapper
10639 trap "$RM $cwrappersource $cwrapper; exit $EXIT_FAILURE" 1 2 15
10641 func_emit_cwrapperexe_src > $cwrappersource
10643 # The wrapper executable is built using the $host compiler,
10644 # because it contains $host paths and files. If cross-
10645 # compiling, it, like the target executable, must be
10646 # executed on the $host or under an emulation environment.
10648 $LTCC $LTCFLAGS -o $cwrapper $cwrappersource
10652 # Now, create the wrapper script for func_source use:
10653 func_ltwrapper_scriptname $cwrapper
10654 $RM $func_ltwrapper_scriptname_result
10655 trap "$RM $func_ltwrapper_scriptname_result; exit $EXIT_FAILURE" 1 2 15
10657 # note: this script will not be executed, so do not chmod.
10658 if test "x$build" = "x$host"; then
10659 $cwrapper --lt-dump-script > $func_ltwrapper_scriptname_result
10661 func_emit_wrapper no > $func_ltwrapper_scriptname_result
10667 trap "$RM $output; exit $EXIT_FAILURE" 1 2 15
10669 func_emit_wrapper no > $output
10678 # See if we need to build an old-fashioned archive.
10679 for oldlib in $oldlibs; do
10681 case $build_libtool_libs in
10683 oldobjs="$libobjs_save $symfileobj"
10684 addlibs=$convenience
10685 build_libtool_libs=no
10688 oldobjs=$libobjs_save
10689 addlibs=$old_convenience
10690 build_libtool_libs=no
10693 oldobjs="$old_deplibs $non_pic_objects"
10694 $preload && test -f "$symfileobj" \
10695 && func_append oldobjs " $symfileobj"
10696 addlibs=$old_convenience
10700 if test -n "$addlibs"; then
10701 gentop=$output_objdir/${outputname}x
10702 func_append generated " $gentop"
10704 func_extract_archives $gentop $addlibs
10705 func_append oldobjs " $func_extract_archives_result"
10708 # Do each command in the archive commands.
10709 if test -n "$old_archive_from_new_cmds" && test yes = "$build_libtool_libs"; then
10710 cmds=$old_archive_from_new_cmds
10713 # Add any objects from preloaded convenience libraries
10714 if test -n "$dlprefiles"; then
10715 gentop=$output_objdir/${outputname}x
10716 func_append generated " $gentop"
10718 func_extract_archives $gentop $dlprefiles
10719 func_append oldobjs " $func_extract_archives_result"
10722 # POSIX demands no paths to be encoded in archives. We have
10723 # to avoid creating archives with duplicate basenames if we
10724 # might have to extract them afterwards, e.g., when creating a
10725 # static archive out of a convenience library, or when linking
10726 # the entirety of a libtool archive into another (currently
10727 # not supported by libtool).
10728 if (for obj in $oldobjs
10730 func_basename "$obj"
10731 $ECHO "$func_basename_result"
10732 done | sort | sort -uc >/dev/null 2>&1); then
10735 echo "copying selected object files to avoid basename conflicts..."
10736 gentop=$output_objdir/${outputname}x
10737 func_append generated " $gentop"
10738 func_mkdir_p "$gentop"
10739 save_oldobjs=$oldobjs
10742 for obj in $save_oldobjs
10744 func_basename "$obj"
10745 objbase=$func_basename_result
10746 case " $oldobjs " in
10747 " ") oldobjs=$obj ;;
10748 *[\ /]"$objbase "*)
10750 # Make sure we don't pick an alternate name that also
10752 newobj=lt$counter-$objbase
10753 func_arith $counter + 1
10754 counter=$func_arith_result
10755 case " $oldobjs " in
10756 *[\ /]"$newobj "*) ;;
10757 *) if test ! -f "$gentop/$newobj"; then break; fi ;;
10760 func_show_eval "ln $obj $gentop/$newobj || cp $obj $gentop/$newobj"
10761 func_append oldobjs " $gentop/$newobj"
10763 *) func_append oldobjs " $obj" ;;
10767 func_to_tool_file "$oldlib" func_convert_file_msys_to_w32
10768 tool_oldlib=$func_to_tool_file_result
10769 eval cmds=\"$old_archive_cmds\"
10772 len=$func_len_result
10773 if test "$len" -lt "$max_cmd_len" || test "$max_cmd_len" -le -1; then
10774 cmds=$old_archive_cmds
10775 elif test -n "$archiver_list_spec"; then
10776 func_verbose "using command file archive linking..."
10777 for obj in $oldobjs
10779 func_to_tool_file "$obj"
10780 $ECHO "$func_to_tool_file_result"
10781 done > $output_objdir/$libname.libcmd
10782 func_to_tool_file "$output_objdir/$libname.libcmd"
10783 oldobjs=" $archiver_list_spec$func_to_tool_file_result"
10784 cmds=$old_archive_cmds
10786 # the command line is too long to link in one step, link in parts
10787 func_verbose "using piecewise archive linking..."
10788 save_RANLIB=$RANLIB
10792 save_oldobjs=$oldobjs
10794 # Is there a better way of finding the last object in the list?
10795 for obj in $save_oldobjs
10799 eval test_cmds=\"$old_archive_cmds\"
10800 func_len " $test_cmds"
10801 len0=$func_len_result
10803 for obj in $save_oldobjs
10806 func_arith $len + $func_len_result
10807 len=$func_arith_result
10808 func_append objlist " $obj"
10809 if test "$len" -lt "$max_cmd_len"; then
10812 # the above command should be used before it gets too long
10814 if test "$obj" = "$last_oldobj"; then
10815 RANLIB=$save_RANLIB
10817 test -z "$concat_cmds" || concat_cmds=$concat_cmds~
10818 eval concat_cmds=\"\$concat_cmds$old_archive_cmds\"
10823 RANLIB=$save_RANLIB
10825 if test -z "$oldobjs"; then
10826 eval cmds=\"\$concat_cmds\"
10828 eval cmds=\"\$concat_cmds~\$old_archive_cmds\"
10832 func_execute_cmds "$cmds" 'exit $?'
10835 test -n "$generated" && \
10836 func_show_eval "${RM}r$generated"
10838 # Now create the libtool archive.
10842 test yes = "$build_old_libs" && old_library=$libname.$libext
10843 func_verbose "creating $output"
10845 # Preserve any variables that may affect compiler behavior
10846 for var in $variables_saved_for_relink; do
10847 if eval test -z \"\${$var+set}\"; then
10848 relink_command="{ test -z \"\${$var+set}\" || $lt_unset $var || { $var=; export $var; }; }; $relink_command"
10849 elif eval var_value=\$$var; test -z "$var_value"; then
10850 relink_command="$var=; export $var; $relink_command"
10852 func_quote_for_eval "$var_value"
10853 relink_command="$var=$func_quote_for_eval_result; export $var; $relink_command"
10856 # Quote the link command for shipping.
10857 relink_command="(cd `pwd`; $SHELL \"$progpath\" $preserve_args --mode=relink $libtool_args @inst_prefix_dir@)"
10858 relink_command=`$ECHO "$relink_command" | $SED "$sed_quote_subst"`
10859 if test yes = "$hardcode_automatic"; then
10863 # Only create the output if not a dry run.
10865 for installed in no yes; do
10866 if test yes = "$installed"; then
10867 if test -z "$install_libdir"; then
10870 output=$output_objdir/${outputname}i
10871 # Replace all uninstalled libtool libraries with the installed ones
10872 newdependency_libs=
10873 for deplib in $dependency_libs; do
10876 func_basename "$deplib"
10877 name=$func_basename_result
10878 func_resolve_sysroot "$deplib"
10879 eval libdir=`$SED -n -e 's/^libdir=\(.*\)$/\1/p' $func_resolve_sysroot_result`
10880 test -z "$libdir" && \
10881 func_fatal_error "'$deplib' is not a valid libtool archive"
10882 func_append newdependency_libs " ${lt_sysroot:+=}$libdir/$name"
10885 func_stripname -L '' "$deplib"
10886 func_replace_sysroot "$func_stripname_result"
10887 func_append newdependency_libs " -L$func_replace_sysroot_result"
10890 func_stripname -R '' "$deplib"
10891 func_replace_sysroot "$func_stripname_result"
10892 func_append newdependency_libs " -R$func_replace_sysroot_result"
10894 *) func_append newdependency_libs " $deplib" ;;
10897 dependency_libs=$newdependency_libs
10900 for lib in $dlfiles; do
10903 func_basename "$lib"
10904 name=$func_basename_result
10905 eval libdir=`$SED -n -e 's/^libdir=\(.*\)$/\1/p' $lib`
10906 test -z "$libdir" && \
10907 func_fatal_error "'$lib' is not a valid libtool archive"
10908 func_append newdlfiles " ${lt_sysroot:+=}$libdir/$name"
10910 *) func_append newdlfiles " $lib" ;;
10913 dlfiles=$newdlfiles
10915 for lib in $dlprefiles; do
10918 # Only pass preopened files to the pseudo-archive (for
10919 # eventual linking with the app. that links it) if we
10920 # didn't already link the preopened objects directly into
10922 func_basename "$lib"
10923 name=$func_basename_result
10924 eval libdir=`$SED -n -e 's/^libdir=\(.*\)$/\1/p' $lib`
10925 test -z "$libdir" && \
10926 func_fatal_error "'$lib' is not a valid libtool archive"
10927 func_append newdlprefiles " ${lt_sysroot:+=}$libdir/$name"
10931 dlprefiles=$newdlprefiles
10934 for lib in $dlfiles; do
10936 [\\/]* | [A-Za-z]:[\\/]*) abs=$lib ;;
10937 *) abs=`pwd`"/$lib" ;;
10939 func_append newdlfiles " $abs"
10941 dlfiles=$newdlfiles
10943 for lib in $dlprefiles; do
10945 [\\/]* | [A-Za-z]:[\\/]*) abs=$lib ;;
10946 *) abs=`pwd`"/$lib" ;;
10948 func_append newdlprefiles " $abs"
10950 dlprefiles=$newdlprefiles
10953 # place dlname in correct position for cygwin
10954 # In fact, it would be nice if we could use this code for all target
10955 # systems that can't hard-code library paths into their executables
10956 # and that have no shared library path variable independent of PATH,
10957 # but it turns out we can't easily determine that from inspecting
10958 # libtool variables, so we have to hard-code the OSs to which it
10959 # applies here; at the moment, that means platforms that use the PE
10960 # object format with DLL files. See the long comment at the top of
10961 # tests/bindir.at for full details.
10963 case $host,$output,$installed,$module,$dlname in
10964 *cygwin*,*lai,yes,no,*.dll | *mingw*,*lai,yes,no,*.dll | *cegcc*,*lai,yes,no,*.dll)
10965 # If a -bindir argument was supplied, place the dll there.
10966 if test -n "$bindir"; then
10967 func_relative_path "$install_libdir" "$bindir"
10968 tdlname=$func_relative_path_result/$dlname
10970 # Otherwise fall back on heuristic.
10971 tdlname=../bin/$dlname
10976 # $outputname - a libtool library file
10977 # Generated by $PROGRAM (GNU $PACKAGE) $VERSION
10979 # Please DO NOT delete this file!
10980 # It is necessary for linking the library.
10982 # The name that we can dlopen(3).
10985 # Names of this library.
10986 library_names='$library_names'
10988 # The name of the static archive.
10989 old_library='$old_library'
10991 # Linker flags that cannot go in dependency_libs.
10992 inherited_linker_flags='$new_inherited_linker_flags'
10994 # Libraries that this one depends upon.
10995 dependency_libs='$dependency_libs'
10997 # Names of additional weak libraries provided by this library
10998 weak_library_names='$weak_libs'
11000 # Version information for $libname.
11005 # Is this an already installed library?
11006 installed=$installed
11008 # Should we warn about portability when linking against -modules?
11009 shouldnotlink=$module
11011 # Files to dlopen/dlpreopen
11013 dlpreopen='$dlprefiles'
11015 # Directory that this library needs to be installed in:
11016 libdir='$install_libdir'"
11017 if test no,yes = "$installed,$need_relink"; then
11018 $ECHO >> $output "\
11019 relink_command=\"$relink_command\""
11024 # Do a symbolic link so that the libtool archive can be found in
11025 # LD_LIBRARY_PATH before the program is installed.
11026 func_show_eval '( cd "$output_objdir" && $RM "$outputname" && $LN_S "../$outputname" "$outputname" )' 'exit $?'
11032 if test link = "$opt_mode" || test relink = "$opt_mode"; then
11033 func_mode_link ${1+"$@"}
11037 # func_mode_uninstall arg...
11038 func_mode_uninstall ()
11047 # This variable tells wrapper scripts just to set variables rather
11048 # than running their programs.
11049 libtool_install_magic=$magic
11054 -f) func_append RM " $arg"; rmforce=: ;;
11055 -*) func_append RM " $arg" ;;
11056 *) func_append files " $arg" ;;
11061 func_fatal_help "you must specify an RM program"
11065 for file in $files; do
11066 func_dirname "$file" "" "."
11067 dir=$func_dirname_result
11068 if test . = "$dir"; then
11073 func_basename "$file"
11074 name=$func_basename_result
11075 test uninstall = "$opt_mode" && odir=$dir
11077 # Remember odir for removal later, being careful to avoid duplicates
11078 if test clean = "$opt_mode"; then
11079 case " $rmdirs " in
11081 *) func_append rmdirs " $odir" ;;
11085 # Don't error if the file doesn't exist and rm -f was used.
11086 if { test -L "$file"; } >/dev/null 2>&1 ||
11087 { test -h "$file"; } >/dev/null 2>&1 ||
11088 test -f "$file"; then
11090 elif test -d "$file"; then
11093 elif $rmforce; then
11101 # Possibly a libtool archive, so verify it.
11102 if func_lalib_p "$file"; then
11103 func_source $dir/$name
11105 # Delete the libtool libraries and symlinks.
11106 for n in $library_names; do
11107 func_append rmfiles " $odir/$n"
11109 test -n "$old_library" && func_append rmfiles " $odir/$old_library"
11113 case " $library_names " in
11115 *) test -n "$dlname" && func_append rmfiles " $odir/$dlname" ;;
11117 test -n "$libdir" && func_append rmfiles " $odir/$name $odir/${name}i"
11120 if test -n "$library_names"; then
11121 # Do each command in the postuninstall commands.
11122 func_execute_cmds "$postuninstall_cmds" '$rmforce || exit_status=1'
11125 if test -n "$old_library"; then
11126 # Do each command in the old_postuninstall commands.
11127 func_execute_cmds "$old_postuninstall_cmds" '$rmforce || exit_status=1'
11129 # FIXME: should reinstall the best remaining shared library.
11136 # Possibly a libtool object, so verify it.
11137 if func_lalib_p "$file"; then
11139 # Read the .lo file
11140 func_source $dir/$name
11142 # Add PIC object to the list of files to remove.
11143 if test -n "$pic_object" && test none != "$pic_object"; then
11144 func_append rmfiles " $dir/$pic_object"
11147 # Add non-PIC object to the list of files to remove.
11148 if test -n "$non_pic_object" && test none != "$non_pic_object"; then
11149 func_append rmfiles " $dir/$non_pic_object"
11155 if test clean = "$opt_mode"; then
11159 func_stripname '' '.exe' "$file"
11160 file=$func_stripname_result
11161 func_stripname '' '.exe' "$name"
11162 noexename=$func_stripname_result
11163 # $file with .exe has already been added to rmfiles,
11164 # add $file without .exe
11165 func_append rmfiles " $file"
11168 # Do a test to see if this is a libtool program.
11169 if func_ltwrapper_p "$file"; then
11170 if func_ltwrapper_executable_p "$file"; then
11171 func_ltwrapper_scriptname "$file"
11173 func_source $func_ltwrapper_scriptname_result
11174 func_append rmfiles " $func_ltwrapper_scriptname_result"
11177 func_source $dir/$noexename
11180 # note $name still contains .exe if it was in $file originally
11181 # as does the version of $file that was added into $rmfiles
11182 func_append rmfiles " $odir/$name $odir/${name}S.$objext"
11183 if test yes = "$fast_install" && test -n "$relink_command"; then
11184 func_append rmfiles " $odir/lt-$name"
11186 if test "X$noexename" != "X$name"; then
11187 func_append rmfiles " $odir/lt-$noexename.c"
11193 func_show_eval "$RM $rmfiles" 'exit_status=1'
11196 # Try to remove the $objdir's in the directories where we deleted files
11197 for dir in $rmdirs; do
11198 if test -d "$dir"; then
11199 func_show_eval "rmdir $dir >/dev/null 2>&1"
11206 if test uninstall = "$opt_mode" || test clean = "$opt_mode"; then
11207 func_mode_uninstall ${1+"$@"}
11210 test -z "$opt_mode" && {
11212 func_fatal_help "you must specify a MODE"
11215 test -z "$exec_cmd" && \
11216 func_fatal_help "invalid operation mode '$opt_mode'"
11218 if test -n "$exec_cmd"; then
11219 eval exec "$exec_cmd"
11226 # The TAGs below are defined such that we never get into a situation
11227 # where we disable both kinds of libraries. Given conflicting
11228 # choices, we go for a static library, that is the most portable,
11229 # since we can't tell whether shared libraries were disabled because
11230 # the user asked for that or because the platform doesn't support
11231 # them. This is particularly important on AIX, because we don't
11232 # support having both static and shared libraries enabled at the same
11233 # time on that platform, so we default to a shared-only configuration.
11234 # If a disable-shared tag is given, we'll fallback to a static-only
11235 # configuration. But we'll never go from static-only to shared-only.
11237 # ### BEGIN LIBTOOL TAG CONFIG: disable-shared
11238 build_libtool_libs=no
11240 # ### END LIBTOOL TAG CONFIG: disable-shared
11242 # ### BEGIN LIBTOOL TAG CONFIG: disable-static
11243 build_old_libs=`case $build_libtool_libs in yes) echo no;; *) echo yes;; esac`
11244 # ### END LIBTOOL TAG CONFIG: disable-static
11247 # mode:shell-script