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-2.1"
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-10-12.13; # 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_arg pretty "$2"
584 eval "$1+=\\ \$func_quote_arg_result"
587 func_append_quoted ()
591 func_quote_arg pretty "$2"
592 eval "$1=\$$1\\ \$func_quote_arg_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_portable EVAL ARG
1095 # ----------------------------
1096 # Internal function to portably implement func_quote_arg. Note that we still
1097 # keep attention to performance here so we as much as possible try to avoid
1098 # calling sed binary (so far O(N) complexity as long as func_append is O(1)).
1099 func_quote_portable ()
1103 func_quote_portable_result=$2
1105 # one-time-loop (easy break)
1109 func_quote_portable_result=`$ECHO "$2" | $SED \
1110 -e "$sed_double_quote_subst" -e "$sed_double_backslash"`
1115 case $func_quote_portable_result in
1117 case $func_quote_portable_result in
1119 func_quote_portable_result=`$ECHO "$func_quote_portable_result" | $SED "$sed_quote_subst"`
1124 func_quote_portable_old_IFS=$IFS
1125 for _G_char in '\' '`' '"' '$'
1127 # STATE($1) PREV($2) SEPARATOR($3)
1129 func_quote_portable_result=dummy"$_G_char$func_quote_portable_result$_G_char"dummy
1131 for _G_part in $func_quote_portable_result
1135 func_append func_quote_portable_result "$3$2"
1136 set quote "$_G_part" "\\$_G_char"
1140 func_quote_portable_result=
1143 set quote "$_G_part" ""
1148 IFS=$func_quote_portable_old_IFS
1155 func_quote_portable_unquoted_result=$func_quote_portable_result
1156 case $func_quote_portable_result in
1157 # double-quote args containing shell metacharacters to delay
1158 # word splitting, command substitution and variable expansion
1159 # for a subsequent eval.
1160 # many bourne shells cannot handle close brackets correctly
1161 # in scan sets, so we specify it separately.
1162 *[\[\~\#\^\&\*\(\)\{\}\|\;\<\>\?\'\ \ ]*|*]*|"")
1163 func_quote_portable_result=\"$func_quote_portable_result\"
1169 # func_quotefast_eval ARG
1170 # -----------------------
1171 # Quote one ARG (internal). This is equivalent to 'func_quote_arg eval ARG',
1172 # but optimized for speed. Result is stored in $func_quotefast_eval.
1173 if test xyes = `(x=; printf -v x %q yes; echo x"$x") 2>/dev/null`; then
1174 func_quotefast_eval ()
1176 printf -v func_quotefast_eval_result %q "$1"
1179 func_quotefast_eval ()
1181 func_quote_portable false "$1"
1182 func_quotefast_eval_result=$func_quote_portable_result
1187 # func_quote_arg MODEs ARG
1188 # ------------------------
1189 # Quote one ARG to be evaled later. MODEs argument may contain zero ore more
1190 # specifiers listed below separated by ',' character. This function returns two
1192 # i) func_quote_arg_result
1193 # double-quoted (when needed), suitable for a subsequent eval
1194 # ii) func_quote_arg_unquoted_result
1195 # has all characters that are still active within double
1196 # quotes backslashified. Available only if 'unquoted' is specified.
1201 # - escape shell special characters
1203 # - the same as 'eval'; but do not quote variable references
1205 # - request aesthetic output, i.e. '"a b"' instead of 'a\ b'. This might
1206 # later used in func_quote to get output like: 'echo "a b"' instead of
1207 # 'echo a\ b'. This is slower than default on some shells.
1209 # - produce also $func_quote_arg_unquoted_result which does not contain
1210 # wrapping double-quotes.
1212 # Examples for 'func_quote_arg pretty,unquoted string':
1214 # string | *_result | *_unquoted_result
1215 # ------------+-----------------------+-------------------
1218 # "a b" | "\"a b\"" | \"a b\"
1220 # z="${x-$y}" | "z=\"\${x-\$y}\"" | z=\"\${x-\$y}\"
1222 # Examples for 'func_quote_arg pretty,unquoted,expand string':
1224 # string | *_result | *_unquoted_result
1225 # --------------+---------------------+--------------------
1226 # z="${x-$y}" | "z=\"${x-$y}\"" | z=\"${x-$y}\"
1229 _G_quote_expand=false
1237 *,pretty,*|*,expand,*|*,unquoted,*)
1238 func_quote_portable $_G_quote_expand "$2"
1239 func_quote_arg_result=$func_quote_portable_result
1240 func_quote_arg_unquoted_result=$func_quote_portable_unquoted_result
1243 # Faster quote-for-eval for some shells.
1244 func_quotefast_eval "$2"
1245 func_quote_arg_result=$func_quotefast_eval_result
1251 # func_quote MODEs ARGs...
1252 # ------------------------
1253 # Quote all ARGs to be evaled later and join them into single command. See
1254 # func_quote_arg's description for more info.
1258 _G_func_quote_mode=$1 ; shift
1260 while test 0 -lt $#; do
1261 func_quote_arg "$_G_func_quote_mode" "$1"
1262 if test -n "$func_quote_result"; then
1263 func_append func_quote_result " $func_quote_arg_result"
1265 func_append func_quote_result "$func_quote_arg_result"
1272 # func_stripname PREFIX SUFFIX NAME
1273 # ---------------------------------
1274 # strip PREFIX and SUFFIX from NAME, and store in func_stripname_result.
1275 # PREFIX and SUFFIX must not contain globbing or regex special
1276 # characters, hashes, percent signs, but SUFFIX may contain a leading
1277 # dot (in which case that matches only a dot).
1278 if test yes = "$_G_HAVE_XSI_OPS"; then
1279 eval 'func_stripname ()
1283 # pdksh 5.2.14 does not do ${X%$Y} correctly if both X and Y are
1284 # positional parameters, so assign one to ordinary variable first.
1285 func_stripname_result=$3
1286 func_stripname_result=${func_stripname_result#"$1"}
1287 func_stripname_result=${func_stripname_result%"$2"}
1295 .*) func_stripname_result=`$ECHO "$3" | $SED -e "s%^$1%%" -e "s%\\\\$2\$%%"`;;
1296 *) func_stripname_result=`$ECHO "$3" | $SED -e "s%^$1%%" -e "s%$2\$%%"`;;
1302 # func_show_eval CMD [FAIL_EXP]
1303 # -----------------------------
1304 # Unless opt_quiet is true, then output CMD. Then, if opt_dryrun is
1305 # not true, evaluate CMD. If the evaluation of CMD fails, and FAIL_EXP
1306 # is given, then evaluate it.
1312 _G_fail_exp=${2-':'}
1314 func_quote_arg pretty,expand "$_G_cmd"
1315 eval "func_notquiet $func_quote_arg_result"
1320 if test 0 -ne "$_G_status"; then
1321 eval "(exit $_G_status); $_G_fail_exp"
1327 # func_show_eval_locale CMD [FAIL_EXP]
1328 # ------------------------------------
1329 # Unless opt_quiet is true, then output CMD. Then, if opt_dryrun is
1330 # not true, evaluate CMD. If the evaluation of CMD fails, and FAIL_EXP
1331 # is given, then evaluate it. Use the saved locale for evaluation.
1332 func_show_eval_locale ()
1337 _G_fail_exp=${2-':'}
1340 func_quote_arg expand,pretty "$_G_cmd"
1341 eval "func_echo $func_quote_arg_result"
1345 eval "$_G_user_locale
1348 eval "$_G_safe_locale"
1349 if test 0 -ne "$_G_status"; then
1350 eval "(exit $_G_status); $_G_fail_exp"
1358 # Turn $1 into a string suitable for a shell variable name.
1359 # Result is stored in $func_tr_sh_result. All characters
1360 # not in the set a-zA-Z0-9_ are replaced with '_'. Further,
1361 # if $1 begins with a digit, a '_' is prepended as well.
1367 [0-9]* | *[!a-zA-Z0-9_]*)
1368 func_tr_sh_result=`$ECHO "$1" | $SED -e 's/^\([0-9]\)/_\1/' -e 's/[^a-zA-Z0-9_]/_/g'`
1371 func_tr_sh_result=$1
1377 # func_verbose ARG...
1378 # -------------------
1379 # Echo program name prefixed message in verbose mode only.
1384 $opt_verbose && func_echo "$*"
1390 # func_warn_and_continue ARG...
1391 # -----------------------------
1392 # Echo program name prefixed warning message to standard error.
1393 func_warn_and_continue ()
1397 $require_term_colors
1399 func_echo_infix_1 "${tc_red}warning$tc_reset" "$*" >&2
1403 # func_warning CATEGORY ARG...
1404 # ----------------------------
1405 # Echo program name prefixed warning message to standard error. Warning
1406 # messages can be filtered according to CATEGORY, where this function
1407 # elides messages where CATEGORY is not listed in the global variable
1408 # 'opt_warning_types'.
1413 # CATEGORY must be in the warning_categories list!
1414 case " $warning_categories " in
1416 *) func_internal_error "invalid warning category '$1'" ;;
1422 case " $opt_warning_types " in
1423 *" $_G_category "*) $warning_func ${1+"$@"} ;;
1428 # func_sort_ver VER1 VER2
1429 # -----------------------
1430 # 'sort -V' is not generally available.
1431 # Note this deviates from the version comparison in automake
1432 # in that it treats 1.5 < 1.5.0, and treats 1.4.4a < 1.4-p3a
1433 # but this should suffice as we won't be specifying old
1434 # version formats or redundant trailing .0 in bootstrap.conf.
1435 # If we did want full compatibility then we should probably
1436 # use m4_version_compare from autoconf.
1441 printf '%s\n%s\n' "$1" "$2" \
1442 | 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
1445 # func_lt_ver PREV CURR
1446 # ---------------------
1447 # Return true if PREV and CURR are in the correct order according to
1448 # func_sort_ver, otherwise false. Use it like this:
1450 # func_lt_ver "$prev_ver" "$proposed_ver" || func_fatal_error "..."
1455 test "x$1" = x`func_sort_ver "$1" "$2" | $SED 1q`
1460 # mode: shell-script
1462 # eval: (add-hook 'before-save-hook 'time-stamp)
1463 # time-stamp-pattern: "10/scriptversion=%:y-%02m-%02d.%02H; # UTC"
1464 # time-stamp-time-zone: "UTC"
1468 # Set a version string for this script.
1469 scriptversion=2015-10-12.13; # UTC
1471 # A portable, pluggable option parser for Bourne shell.
1472 # Written by Gary V. Vaughan, 2010
1474 # Copyright (C) 2010-2015 Free Software Foundation, Inc.
1475 # This is free software; see the source for copying conditions. There is NO
1476 # warranty; not even for MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
1478 # This program is free software: you can redistribute it and/or modify
1479 # it under the terms of the GNU General Public License as published by
1480 # the Free Software Foundation, either version 3 of the License, or
1481 # (at your option) any later version.
1483 # This program is distributed in the hope that it will be useful,
1484 # but WITHOUT ANY WARRANTY; without even the implied warranty of
1485 # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
1486 # GNU General Public License for more details.
1488 # You should have received a copy of the GNU General Public License
1489 # along with this program. If not, see <http://www.gnu.org/licenses/>.
1491 # Please report bugs or propose patches to gary@gnu.org.
1498 # This file is a library for parsing options in your shell scripts along
1499 # with assorted other useful supporting features that you can make use
1502 # For the simplest scripts you might need only:
1505 # . relative/path/to/funclib.sh
1506 # . relative/path/to/options-parser
1508 # func_options ${1+"$@"}
1509 # eval set dummy "$func_options_result"; shift
1510 # ...rest of your script...
1512 # In order for the '--version' option to work, you will need to have a
1513 # suitably formatted comment like the one at the top of this file
1514 # starting with '# Written by ' and ending with '# warranty; '.
1516 # For '-h' and '--help' to work, you will also need a one line
1517 # description of your script's purpose in a comment directly above the
1518 # '# Written by ' line, like the one at the top of this file.
1520 # The default options also support '--debug', which will turn on shell
1521 # execution tracing (see the comment above debug_cmd below for another
1522 # use), and '--verbose' and the func_verbose function to allow your script
1523 # to display verbose messages only when your user has specified
1526 # After sourcing this file, you can plug processing for additional
1527 # options by amending the variables from the 'Configuration' section
1528 # below, and following the instructions in the 'Option parsing'
1529 # section further down.
1531 ## -------------- ##
1532 ## Configuration. ##
1533 ## -------------- ##
1535 # You should override these variables in your script after sourcing this
1536 # file so that they reflect the customisations you have added to the
1539 # The usage line for option parsing errors and the start of '-h' and
1540 # '--help' output messages. You can embed shell variables for delayed
1541 # expansion at the time the message is displayed, but you will need to
1542 # quote other shell meta-characters carefully to prevent them being
1543 # expanded when the contents are evaled.
1544 usage='$progpath [OPTION]...'
1546 # Short help message in response to '-h' and '--help'. Add to this or
1547 # override it after sourcing this library to reflect the full set of
1548 # options your script accepts.
1550 --debug enable verbose shell tracing
1551 -W, --warnings=CATEGORY
1552 report the warnings falling in CATEGORY [all]
1553 -v, --verbose verbosely report processing
1554 --version print version information and exit
1555 -h, --help print short or long help message and exit
1558 # Additional text appended to 'usage_message' in response to '--help'.
1560 Warning categories include:
1561 'all' show all warnings
1562 'none' turn off all the warnings
1563 'error' warnings are treated as fatal errors"
1565 # Help message printed before fatal option parsing errors.
1566 fatal_help="Try '\$progname --help' for more information."
1570 ## ------------------------- ##
1571 ## Hook function management. ##
1572 ## ------------------------- ##
1574 # This section contains functions for adding, removing, and running hooks
1575 # to the main code. A hook is just a named list of of function, that can
1576 # be run in order later on.
1578 # func_hookable FUNC_NAME
1579 # -----------------------
1580 # Declare that FUNC_NAME will run hooks added with
1581 # 'func_add_hook FUNC_NAME ...'.
1586 func_append hookable_fns " $1"
1590 # func_add_hook FUNC_NAME HOOK_FUNC
1591 # ---------------------------------
1592 # Request that FUNC_NAME call HOOK_FUNC before it returns. FUNC_NAME must
1593 # first have been declared "hookable" by a call to 'func_hookable'.
1598 case " $hookable_fns " in
1600 *) func_fatal_error "'$1' does not accept hook functions." ;;
1603 eval func_append ${1}_hooks '" $2"'
1607 # func_remove_hook FUNC_NAME HOOK_FUNC
1608 # ------------------------------------
1609 # Remove HOOK_FUNC from the list of functions called by FUNC_NAME.
1614 eval ${1}_hooks='`$ECHO "\$'$1'_hooks" |$SED "s| '$2'||"`'
1618 # func_run_hooks FUNC_NAME [ARG]...
1619 # ---------------------------------
1620 # Run all hook functions registered to FUNC_NAME.
1621 # It is assumed that the list of hook functions contains nothing more
1622 # than a whitespace-delimited list of legal shell function names, and
1623 # no effort is wasted trying to catch shell meta-characters or preserve
1629 _G_rc_run_hooks=false
1631 case " $hookable_fns " in
1633 *) func_fatal_error "'$1' does not support hook funcions.n" ;;
1636 eval _G_hook_fns=\$$1_hooks; shift
1638 for _G_hook in $_G_hook_fns; do
1639 if eval $_G_hook '"$@"'; then
1640 # store returned options list back into positional
1641 # parameters for next 'cmd' execution.
1642 eval _G_hook_result=\$${_G_hook}_result
1643 eval set dummy "$_G_hook_result"; shift
1648 $_G_rc_run_hooks && func_run_hooks_result=$_G_hook_result
1653 ## --------------- ##
1654 ## Option parsing. ##
1655 ## --------------- ##
1657 # In order to add your own option parsing hooks, you must accept the
1658 # full positional parameter list in your hook function, you may remove/edit
1659 # any options that you action, and then pass back the remaining unprocessed
1660 # options in '<hooked_function_name>_result', escaped suitably for
1661 # 'eval'. In this case you also must return $EXIT_SUCCESS to let the
1662 # hook's caller know that it should pay attention to
1663 # '<hooked_function_name>_result'. Returning $EXIT_FAILURE signalizes that
1664 # arguments are left untouched by the hook and therefore caller will ignore the
1669 # my_options_prep ()
1673 # # Extend the existing usage message.
1674 # usage_message=$usage_message'
1675 # -s, --silent don'\''t print informational messages
1677 # # No change in '$@' (ignored completely by this hook). There is
1678 # # no need to do the equivalent (but slower) action:
1679 # # func_quote eval ${1+"$@"}
1680 # # my_options_prep_result=$func_quote_result
1683 # func_add_hook func_options_prep my_options_prep
1686 # my_silent_option ()
1690 # args_changed=false
1692 # # Note that for efficiency, we parse as many options as we can
1693 # # recognise in a loop before passing the remainder back to the
1694 # # caller on the first unrecognised argument we encounter.
1695 # while test $# -gt 0; do
1698 # --silent|-s) opt_silent=:
1701 # # Separate non-argument short options:
1702 # -s*) func_split_short_opt "$_G_opt"
1703 # set dummy "$func_split_short_opt_name" \
1704 # "-$func_split_short_opt_arg" ${1+"$@"}
1708 # *) # Make sure the first unrecognised option "$_G_opt"
1709 # # is added back to "$@", we could need that later
1710 # # if $args_changed is true.
1711 # set dummy "$_G_opt" ${1+"$@"}; shift; break ;;
1715 # if $args_changed; then
1716 # func_quote eval ${1+"$@"}
1717 # my_silent_option_result=$func_quote_result
1722 # func_add_hook func_parse_options my_silent_option
1725 # my_option_validation ()
1729 # $opt_silent && $opt_verbose && func_fatal_help "\
1730 # '--silent' and '--verbose' options are mutually exclusive."
1734 # func_add_hook func_validate_options my_option_validation
1736 # You'll also need to manually amend $usage_message to reflect the extra
1737 # options you parse. It's preferable to append if you can, so that
1738 # multiple option parsing hooks can be added safely.
1741 # func_options_finish [ARG]...
1742 # ----------------------------
1743 # Finishing the option parse loop (call 'func_options' hooks ATM).
1744 func_options_finish ()
1748 _G_func_options_finish_exit=false
1749 if func_run_hooks func_options ${1+"$@"}; then
1750 func_options_finish_result=$func_run_hooks_result
1751 _G_func_options_finish_exit=:
1754 $_G_func_options_finish_exit
1758 # func_options [ARG]...
1759 # ---------------------
1760 # All the functions called inside func_options are hookable. See the
1761 # individual implementations for details.
1762 func_hookable func_options
1769 for my_func in options_prep parse_options validate_options options_finish
1771 if eval func_$my_func '${1+"$@"}'; then
1772 eval _G_res_var='$'"func_${my_func}_result"
1773 eval set dummy "$_G_res_var" ; shift
1778 # Save modified positional parameters for caller. As a top-level
1779 # options-parser function we always need to set the 'func_options_result'
1780 # variable (regardless the $_G_rc_options value).
1781 if $_G_rc_options; then
1782 func_options_result=$_G_res_var
1784 func_quote eval ${1+"$@"}
1785 func_options_result=$func_quote_result
1792 # func_options_prep [ARG]...
1793 # --------------------------
1794 # All initialisations required before starting the option parse loop.
1795 # Note that when calling hook functions, we pass through the list of
1796 # positional parameters. If a hook function modifies that list, and
1797 # needs to propagate that back to rest of this script, then the complete
1798 # modified list must be put in 'func_run_hooks_result' before
1799 # returning $EXIT_SUCCESS (otherwise $EXIT_FAILURE is returned).
1800 func_hookable func_options_prep
1801 func_options_prep ()
1809 _G_rc_options_prep=false
1810 if func_run_hooks func_options_prep ${1+"$@"}; then
1811 _G_rc_options_prep=:
1812 # save modified positional parameters for caller
1813 func_options_prep_result=$func_run_hooks_result
1820 # func_parse_options [ARG]...
1821 # ---------------------------
1822 # The main option parsing loop.
1823 func_hookable func_parse_options
1824 func_parse_options ()
1828 func_parse_options_result=
1830 _G_rc_parse_options=false
1831 # this just eases exit handling
1832 while test $# -gt 0; do
1833 # Defer to hook functions for initial option parsing, so they
1834 # get priority in the event of reusing an option name.
1835 if func_run_hooks func_parse_options ${1+"$@"}; then
1836 eval set dummy "$func_run_hooks_result"; shift
1837 _G_rc_parse_options=:
1840 # Break out of the loop if we already parsed every option.
1841 test $# -gt 0 || break
1843 _G_match_parse_options=:
1847 --debug|-x) debug_cmd='set -x'
1848 func_echo "enabling shell trace mode"
1852 --no-warnings|--no-warning|--no-warn)
1853 set dummy --warnings none ${1+"$@"}
1857 --warnings|--warning|-W)
1858 if test $# = 0 && func_missing_arg $_G_opt; then
1859 _G_rc_parse_options=:
1862 case " $warning_categories $1" in
1864 # trailing space prevents matching last $1 above
1865 func_append_uniq opt_warning_types " $1"
1868 opt_warning_types=$warning_categories
1871 opt_warning_types=none
1875 opt_warning_types=$warning_categories
1876 warning_func=func_fatal_error
1880 "unsupported warning category: '$1'"
1886 --verbose|-v) opt_verbose=: ;;
1887 --version) func_version ;;
1888 -\?|-h) func_usage ;;
1889 --help) func_help ;;
1891 # Separate optargs to long options (plugins may need this):
1892 --*=*) func_split_equals "$_G_opt"
1893 set dummy "$func_split_equals_lhs" \
1894 "$func_split_equals_rhs" ${1+"$@"}
1898 # Separate optargs to short options:
1900 func_split_short_opt "$_G_opt"
1901 set dummy "$func_split_short_opt_name" \
1902 "$func_split_short_opt_arg" ${1+"$@"}
1906 # Separate non-argument short options:
1908 func_split_short_opt "$_G_opt"
1909 set dummy "$func_split_short_opt_name" \
1910 "-$func_split_short_opt_arg" ${1+"$@"}
1914 --) _G_rc_parse_options=: ; break ;;
1915 -*) func_fatal_help "unrecognised option: '$_G_opt'" ;;
1916 *) set dummy "$_G_opt" ${1+"$@"}; shift
1917 _G_match_parse_options=false
1922 $_G_match_parse_options && _G_rc_parse_options=:
1926 if $_G_rc_parse_options; then
1927 # save modified positional parameters for caller
1928 func_quote eval ${1+"$@"}
1929 func_parse_options_result=$func_quote_result
1932 $_G_rc_parse_options
1936 # func_validate_options [ARG]...
1937 # ------------------------------
1938 # Perform any sanity checks on option settings and/or unconsumed
1940 func_hookable func_validate_options
1941 func_validate_options ()
1945 _G_rc_validate_options=false
1947 # Display all warnings if -W was not given.
1948 test -n "$opt_warning_types" || opt_warning_types=" $warning_categories"
1950 if func_run_hooks func_validate_options ${1+"$@"}; then
1951 # save modified positional parameters for caller
1952 func_validate_options_result=$func_run_hooks_result
1953 _G_rc_validate_options=:
1956 # Bail if the options were screwed!
1957 $exit_cmd $EXIT_FAILURE
1959 $_G_rc_validate_options
1964 ## ----------------- ##
1965 ## Helper functions. ##
1966 ## ----------------- ##
1968 # This section contains the helper functions used by the rest of the
1969 # hookable option parser framework in ascii-betical order.
1972 # func_fatal_help ARG...
1973 # ----------------------
1974 # Echo program name prefixed message to standard error, followed by
1975 # a help hint, and exit.
1980 eval \$ECHO \""Usage: $usage"\"
1981 eval \$ECHO \""$fatal_help"\"
1982 func_error ${1+"$@"}
1989 # Echo long help message to standard output and exit.
1995 $ECHO "$long_help_message"
2000 # func_missing_arg ARGNAME
2001 # ------------------------
2002 # Echo program name prefixed message to standard error and set global
2008 func_error "Missing argument for '$1'."
2013 # func_split_equals STRING
2014 # ------------------------
2015 # Set func_split_equals_lhs and func_split_equals_rhs shell variables after
2016 # splitting STRING at the '=' sign.
2017 test -z "$_G_HAVE_XSI_OPS" \
2019 test 5aa/bb/cc = "${#x}${x%%/*}${x%/*}${x#*/}${x##*/}"') 2>/dev/null \
2020 && _G_HAVE_XSI_OPS=yes
2022 if test yes = "$_G_HAVE_XSI_OPS"
2024 # This is an XSI compatible shell, allowing a faster implementation...
2025 eval 'func_split_equals ()
2029 func_split_equals_lhs=${1%%=*}
2030 func_split_equals_rhs=${1#*=}
2031 test "x$func_split_equals_lhs" = "x$1" \
2032 && func_split_equals_rhs=
2035 # ...otherwise fall back to using expr, which is often a shell builtin.
2036 func_split_equals ()
2040 func_split_equals_lhs=`expr "x$1" : 'x\([^=]*\)'`
2041 func_split_equals_rhs=
2042 test "x$func_split_equals_lhs" = "x$1" \
2043 || func_split_equals_rhs=`expr "x$1" : 'x[^=]*=\(.*\)$'`
2045 fi #func_split_equals
2048 # func_split_short_opt SHORTOPT
2049 # -----------------------------
2050 # Set func_split_short_opt_name and func_split_short_opt_arg shell
2051 # variables after splitting SHORTOPT after the 2nd character.
2052 if test yes = "$_G_HAVE_XSI_OPS"
2054 # This is an XSI compatible shell, allowing a faster implementation...
2055 eval 'func_split_short_opt ()
2059 func_split_short_opt_arg=${1#??}
2060 func_split_short_opt_name=${1%"$func_split_short_opt_arg"}
2063 # ...otherwise fall back to using expr, which is often a shell builtin.
2064 func_split_short_opt ()
2068 func_split_short_opt_name=`expr "x$1" : 'x-\(.\)'`
2069 func_split_short_opt_arg=`expr "x$1" : 'x-.\(.*\)$'`
2071 fi #func_split_short_opt
2076 # Echo short help message to standard output and exit.
2082 $ECHO "Run '$progname --help |${PAGER-more}' for full usage"
2087 # func_usage_message
2088 # ------------------
2089 # Echo short help message to standard output.
2090 func_usage_message ()
2094 eval \$ECHO \""Usage: $usage"\"
2101 /^Written by/q' < "$progpath"
2103 eval \$ECHO \""$usage_message"\"
2109 # Echo version message to standard output and exit.
2114 printf '%s\n' "$progname $scriptversion"
2124 /^# Written by /,/# warranty; / {
2127 s|\((C)\)[ 0-9,-]*[ ,-]\([1-9][0-9]* \)|\1 \2|
2134 /^warranty; /q' < "$progpath"
2141 # mode: shell-script
2143 # eval: (add-hook 'before-save-hook 'time-stamp)
2144 # time-stamp-pattern: "10/scriptversion=%:y-%02m-%02d.%02H; # UTC"
2145 # time-stamp-time-zone: "UTC"
2148 # Set a version string.
2149 scriptversion='(GNU libtool) 2.4.6'
2154 # Libtool also displays the current mode in messages, so override
2155 # funclib.sh func_echo with this custom definition.
2164 for _G_line in $_G_message; do
2166 $ECHO "$progname${opt_mode+: $opt_mode}: $_G_line"
2172 # func_warning ARG...
2173 # -------------------
2174 # Libtool warnings are not categorized, so override funclib.sh
2175 # func_warning with this simpler definition.
2180 $warning_func ${1+"$@"}
2184 ## ---------------- ##
2185 ## Options parsing. ##
2186 ## ---------------- ##
2188 # Hook in the functions to make sure our own options are parsed during
2189 # the option parsing loop.
2191 usage='$progpath [OPTION]... [MODE-ARG]...'
2193 # Short help message in response to '-h'.
2194 usage_message="Options:
2195 --config show all configuration variables
2196 --debug enable verbose shell tracing
2197 -n, --dry-run display commands without modifying any files
2198 --features display basic configuration information and exit
2199 --mode=MODE use operation mode MODE
2200 --no-warnings equivalent to '-Wnone'
2201 --preserve-dup-deps don't remove duplicate dependency libraries
2202 --quiet, --silent don't print informational messages
2203 --tag=TAG use configuration variables from tag TAG
2204 -v, --verbose print more informational messages than default
2205 --version print version information
2206 -W, --warnings=CATEGORY report the warnings falling in CATEGORY [all]
2207 -h, --help, --help-all print short, long, or detailed help message
2210 # Additional text appended to 'usage_message' in response to '--help'.
2216 $ECHO "$long_help_message
2218 MODE must be one of the following:
2220 clean remove files from the build directory
2221 compile compile a source file into a libtool object
2222 execute automatically set library path, then run a program
2223 finish complete the installation of libtool libraries
2224 install install libraries or executables
2225 link create a library or an executable
2226 uninstall remove libraries from an installed directory
2228 MODE-ARGS vary depending on the MODE. When passed as first option,
2229 '--mode=MODE' may be abbreviated as 'MODE' or a unique abbreviation of that.
2230 Try '$progname --help --mode=MODE' for a more detailed description of MODE.
2232 When reporting a bug, please describe a test case to reproduce it and
2233 include the following information:
2238 compiler flags: $LTCFLAGS
2239 linker: $LD (gnu? $with_gnu_ld)
2240 version: $progname $scriptversion Debian-2.4.6-2.1
2241 automake: `($AUTOMAKE --version) 2>/dev/null |$SED 1q`
2242 autoconf: `($AUTOCONF --version) 2>/dev/null |$SED 1q`
2244 Report bugs to <bug-libtool@gnu.org>.
2245 GNU libtool home page: <http://www.gnu.org/s/libtool/>.
2246 General help using GNU software: <http://www.gnu.org/gethelp/>."
2251 # func_lo2o OBJECT-NAME
2252 # ---------------------
2253 # Transform OBJECT-NAME from a '.lo' suffix to the platform specific
2256 lo2o=s/\\.lo\$/.$objext/
2257 o2lo=s/\\.$objext\$/.lo/
2259 if test yes = "$_G_HAVE_XSI_OPS"; then
2263 *.lo) func_lo2o_result=${1%.lo}.$objext ;;
2264 * ) func_lo2o_result=$1 ;;
2268 # func_xform LIBOBJ-OR-SOURCE
2269 # ---------------------------
2270 # Transform LIBOBJ-OR-SOURCE from a '.o' or '.c' (or otherwise)
2271 # suffix to a '.lo' libtool-object suffix.
2274 func_xform_result=${1%.*}.lo
2277 # ...otherwise fall back to using sed.
2280 func_lo2o_result=`$ECHO "$1" | $SED "$lo2o"`
2285 func_xform_result=`$ECHO "$1" | $SED 's|\.[^.]*$|.lo|'`
2290 # func_fatal_configuration ARG...
2291 # -------------------------------
2292 # Echo program name prefixed message to standard error, followed by
2293 # a configuration failure hint, and exit.
2294 func_fatal_configuration ()
2296 func__fatal_error ${1+"$@"} \
2297 "See the $PACKAGE documentation for more information." \
2298 "Fatal configuration error."
2304 # Display the configuration for all the tags in this script.
2307 re_begincf='^# ### BEGIN LIBTOOL'
2308 re_endcf='^# ### END LIBTOOL'
2310 # Default configuration.
2311 $SED "1,/$re_begincf CONFIG/d;/$re_endcf CONFIG/,\$d" < "$progpath"
2313 # Now print the configurations for the tags.
2314 for tagname in $taglist; do
2315 $SED -n "/$re_begincf TAG CONFIG: $tagname\$/,/$re_endcf TAG CONFIG: $tagname\$/p" < "$progpath"
2324 # Display the features supported by this script.
2328 if test yes = "$build_libtool_libs"; then
2329 echo "enable shared libraries"
2331 echo "disable shared libraries"
2333 if test yes = "$build_old_libs"; then
2334 echo "enable static libraries"
2336 echo "disable static libraries"
2343 # func_enable_tag TAGNAME
2344 # -----------------------
2345 # Verify that TAGNAME is valid, and either flag an error and exit, or
2346 # enable the TAGNAME tag. We also add TAGNAME to the global $taglist
2353 re_begincf="^# ### BEGIN LIBTOOL TAG CONFIG: $tagname\$"
2354 re_endcf="^# ### END LIBTOOL TAG CONFIG: $tagname\$"
2355 sed_extractcf=/$re_begincf/,/$re_endcf/p
2360 func_fatal_error "invalid tag name: $tagname"
2364 # Don't test for the "default" C tag, as we know it's
2365 # there but not specially marked.
2369 if $GREP "$re_begincf" "$progpath" >/dev/null 2>&1; then
2370 taglist="$taglist $tagname"
2372 # Evaluate the configuration. Be careful to quote the path
2373 # and the sed script, to avoid splitting on whitespace, but
2374 # also don't use non-portable quotes within backquotes within
2375 # quotes we have to do it in 2 steps:
2376 extractedcf=`$SED -n -e "$sed_extractcf" < "$progpath"`
2379 func_error "ignoring unknown tag $tagname"
2386 # func_check_version_match
2387 # ------------------------
2388 # Ensure that we are using m4 macros, and libtool script from the same
2389 # release of libtool.
2390 func_check_version_match ()
2392 if test "$package_revision" != "$macro_revision"; then
2393 if test "$VERSION" != "$macro_version"; then
2394 if test -z "$macro_version"; then
2396 $progname: Version mismatch error. This is $PACKAGE $VERSION, but the
2397 $progname: definition of this LT_INIT comes from an older release.
2398 $progname: You should recreate aclocal.m4 with macros from $PACKAGE $VERSION
2399 $progname: and run autoconf again.
2403 $progname: Version mismatch error. This is $PACKAGE $VERSION, but the
2404 $progname: definition of this LT_INIT comes from $PACKAGE $macro_version.
2405 $progname: You should recreate aclocal.m4 with macros from $PACKAGE $VERSION
2406 $progname: and run autoconf again.
2411 $progname: Version mismatch error. This is $PACKAGE $VERSION, revision $package_revision,
2412 $progname: but the definition of this LT_INIT comes from revision $macro_revision.
2413 $progname: You should recreate aclocal.m4 with macros from revision $package_revision
2414 $progname: of $PACKAGE $VERSION and run autoconf again.
2423 # libtool_options_prep [ARG]...
2424 # -----------------------------
2425 # Preparation for options parsed by libtool.
2426 libtool_options_prep ()
2436 opt_preserve_dup_deps=false
2442 _G_rc_lt_options_prep=:
2444 # Shorthand for --mode=foo, only valid as the first argument
2447 shift; set dummy --mode clean ${1+"$@"}; shift
2449 compile|compil|compi|comp|com|co|c)
2450 shift; set dummy --mode compile ${1+"$@"}; shift
2452 execute|execut|execu|exec|exe|ex|e)
2453 shift; set dummy --mode execute ${1+"$@"}; shift
2455 finish|finis|fini|fin|fi|f)
2456 shift; set dummy --mode finish ${1+"$@"}; shift
2458 install|instal|insta|inst|ins|in|i)
2459 shift; set dummy --mode install ${1+"$@"}; shift
2462 shift; set dummy --mode link ${1+"$@"}; shift
2464 uninstall|uninstal|uninsta|uninst|unins|unin|uni|un|u)
2465 shift; set dummy --mode uninstall ${1+"$@"}; shift
2468 _G_rc_lt_options_prep=false
2472 if $_G_rc_lt_options_prep; then
2473 # Pass back the list of options.
2474 func_quote eval ${1+"$@"}
2475 libtool_options_prep_result=$func_quote_result
2478 $_G_rc_lt_options_prep
2480 func_add_hook func_options_prep libtool_options_prep
2483 # libtool_parse_options [ARG]...
2484 # ---------------------------------
2485 # Provide handling for libtool specific options.
2486 libtool_parse_options ()
2490 _G_rc_lt_parse_options=false
2492 # Perform our own loop to consume as many options as possible in
2494 while test $# -gt 0; do
2495 _G_match_lt_parse_options=:
2499 --dry-run|--dryrun|-n)
2503 --config) func_config ;;
2506 opt_dlopen="${opt_dlopen+$opt_dlopen
2511 --preserve-dup-deps)
2512 opt_preserve_dup_deps=: ;;
2514 --features) func_features ;;
2516 --finish) set dummy --mode finish ${1+"$@"}; shift ;;
2518 --help) opt_help=: ;;
2520 --help-all) opt_help=': help-all' ;;
2522 --mode) test $# = 0 && func_missing_arg $_G_opt && break
2525 # Valid mode arguments:
2526 clean|compile|execute|finish|install|link|relink|uninstall) ;;
2528 # Catch anything else as an error
2529 *) func_error "invalid argument for $_G_opt"
2537 --no-silent|--no-quiet)
2539 func_append preserve_args " $_G_opt"
2542 --no-warnings|--no-warning|--no-warn)
2544 func_append preserve_args " $_G_opt"
2549 func_append preserve_args " $_G_opt"
2555 func_append preserve_args " $_G_opt"
2558 --tag) test $# = 0 && func_missing_arg $_G_opt && break
2560 func_append preserve_args " $_G_opt $1"
2561 func_enable_tag "$1"
2565 --verbose|-v) opt_quiet=false
2567 func_append preserve_args " $_G_opt"
2570 # An option not handled by this hook function:
2571 *) set dummy "$_G_opt" ${1+"$@"} ; shift
2572 _G_match_lt_parse_options=false
2576 $_G_match_lt_parse_options && _G_rc_lt_parse_options=:
2579 if $_G_rc_lt_parse_options; then
2580 # save modified positional parameters for caller
2581 func_quote eval ${1+"$@"}
2582 libtool_parse_options_result=$func_quote_result
2585 $_G_rc_lt_parse_options
2587 func_add_hook func_parse_options libtool_parse_options
2591 # libtool_validate_options [ARG]...
2592 # ---------------------------------
2593 # Perform any sanity checks on option settings and/or unconsumed
2595 libtool_validate_options ()
2597 # save first non-option argument
2598 if test 0 -lt $#; then
2604 test : = "$debug_cmd" || func_append preserve_args " --debug"
2607 # Solaris2 added to fix http://debbugs.gnu.org/cgi/bugreport.cgi?bug=16452
2608 # see also: http://gcc.gnu.org/bugzilla/show_bug.cgi?id=59788
2609 *cygwin* | *mingw* | *pw32* | *cegcc* | *solaris2* | *os2*)
2610 # don't eliminate duplications in $postdeps and $predeps
2611 opt_duplicate_compiler_generated_deps=:
2614 opt_duplicate_compiler_generated_deps=$opt_preserve_dup_deps
2619 # Sanity checks first:
2620 func_check_version_match
2622 test yes != "$build_libtool_libs" \
2623 && test yes != "$build_old_libs" \
2624 && func_fatal_configuration "not configured to build any kind of library"
2627 eval std_shrext=\"$shrext_cmds\"
2629 # Only execute mode is allowed to have -dlopen flags.
2630 if test -n "$opt_dlopen" && test execute != "$opt_mode"; then
2631 func_error "unrecognized option '-dlopen'"
2636 # Change the help message to a mode-specific one.
2638 help="Try '$progname --help --mode=$opt_mode' for more information."
2641 # Pass back the unparsed argument list
2642 func_quote eval ${1+"$@"}
2643 libtool_validate_options_result=$func_quote_result
2645 func_add_hook func_validate_options libtool_validate_options
2648 # Process options as early as possible so that --help and --version
2649 # can return quickly.
2650 func_options ${1+"$@"}
2651 eval set dummy "$func_options_result"; shift
2659 magic='%%%MAGIC variable%%%'
2660 magic_exe='%%%MAGIC EXE variable%%%'
2666 # If this variable is set in any of the actions, the command in it
2667 # will be execed at the end. This prevents here-documents from being
2668 # left over by shells.
2672 # A function that is used when there is no print builtin or printf.
2673 func_fallback_echo ()
2675 eval 'cat <<_LTECHO_EOF
2680 # func_generated_by_libtool
2681 # True iff stdin has been generated by Libtool. This function is only
2682 # a basic sanity check; it will hardly flush out determined imposters.
2683 func_generated_by_libtool_p ()
2685 $GREP "^# Generated by .*$PACKAGE" > /dev/null 2>&1
2689 # True iff FILE is a libtool '.la' library or '.lo' object file.
2690 # This function is only a basic sanity check; it will hardly flush out
2691 # determined imposters.
2695 $SED -e 4q "$1" 2>/dev/null | func_generated_by_libtool_p
2698 # func_lalib_unsafe_p file
2699 # True iff FILE is a libtool '.la' library or '.lo' object file.
2700 # This function implements the same check as func_lalib_p without
2701 # resorting to external programs. To this end, it redirects stdin and
2702 # closes it afterwards, without saving the original file descriptor.
2703 # As a safety measure, use it only where a negative result would be
2704 # fatal anyway. Works if 'file' does not exist.
2705 func_lalib_unsafe_p ()
2708 if test -f "$1" && test -r "$1" && exec 5<&0 <"$1"; then
2709 for lalib_p_l in 1 2 3 4
2712 case $lalib_p_line in
2713 \#\ Generated\ by\ *$PACKAGE* ) lalib_p=yes; break;;
2718 test yes = "$lalib_p"
2721 # func_ltwrapper_script_p file
2722 # True iff FILE is a libtool wrapper script
2723 # This function is only a basic sanity check; it will hardly flush out
2724 # determined imposters.
2725 func_ltwrapper_script_p ()
2728 $lt_truncate_bin < "$1" 2>/dev/null | func_generated_by_libtool_p
2731 # func_ltwrapper_executable_p file
2732 # True iff FILE is a libtool wrapper executable
2733 # This function is only a basic sanity check; it will hardly flush out
2734 # determined imposters.
2735 func_ltwrapper_executable_p ()
2737 func_ltwrapper_exec_suffix=
2740 *) func_ltwrapper_exec_suffix=.exe ;;
2742 $GREP "$magic_exe" "$1$func_ltwrapper_exec_suffix" >/dev/null 2>&1
2745 # func_ltwrapper_scriptname file
2746 # Assumes file is an ltwrapper_executable
2747 # uses $file to determine the appropriate filename for a
2748 # temporary ltwrapper_script.
2749 func_ltwrapper_scriptname ()
2751 func_dirname_and_basename "$1" "" "."
2752 func_stripname '' '.exe' "$func_basename_result"
2753 func_ltwrapper_scriptname_result=$func_dirname_result/$objdir/${func_stripname_result}_ltshwrapper
2756 # func_ltwrapper_p file
2757 # True iff FILE is a libtool wrapper script or wrapper executable
2758 # This function is only a basic sanity check; it will hardly flush out
2759 # determined imposters.
2762 func_ltwrapper_script_p "$1" || func_ltwrapper_executable_p "$1"
2766 # func_execute_cmds commands fail_cmd
2767 # Execute tilde-delimited COMMANDS.
2768 # If FAIL_CMD is given, eval that upon failure.
2769 # FAIL_CMD may read-access the current command in variable CMD!
2770 func_execute_cmds ()
2774 save_ifs=$IFS; IFS='~'
2779 func_show_eval "$cmd" "${2-:}"
2786 # Source FILE, adding directory component if necessary.
2787 # Note that it is not necessary on cygwin/mingw to append a dot to
2788 # FILE even if both FILE and FILE.exe exist: automatic-append-.exe
2789 # behavior happens only for exec(3), not for open(2)! Also, sourcing
2790 # 'FILE.' does not work on cygwin managed mounts.
2796 */* | *\\*) . "$1" ;;
2802 # func_resolve_sysroot PATH
2803 # Replace a leading = in PATH with a sysroot. Store the result into
2804 # func_resolve_sysroot_result
2805 func_resolve_sysroot ()
2807 func_resolve_sysroot_result=$1
2808 case $func_resolve_sysroot_result in
2810 func_stripname '=' '' "$func_resolve_sysroot_result"
2811 func_resolve_sysroot_result=$lt_sysroot$func_stripname_result
2816 # func_replace_sysroot PATH
2817 # If PATH begins with the sysroot, replace it with = and
2818 # store the result into func_replace_sysroot_result.
2819 func_replace_sysroot ()
2821 case $lt_sysroot:$1 in
2823 func_stripname "$lt_sysroot" '' "$1"
2824 func_replace_sysroot_result='='$func_stripname_result
2827 # Including no sysroot.
2828 func_replace_sysroot_result=$1
2833 # func_infer_tag arg
2834 # Infer tagged configuration to use if any are available and
2835 # if one wasn't chosen via the "--tag" command line option.
2836 # Only attempt this if the compiler in the base compile
2837 # command doesn't match the default compiler.
2838 # arg is usually of the form 'gcc ...'
2843 if test -n "$available_tags" && test -z "$tagname"; then
2846 func_append_quoted CC_quoted "$arg"
2848 CC_expanded=`func_echo_all $CC`
2849 CC_quoted_expanded=`func_echo_all $CC_quoted`
2851 # Blanks in the command may have been stripped by the calling shell,
2852 # but not from the CC environment variable when configure was run.
2853 " $CC "* | "$CC "* | " $CC_expanded "* | "$CC_expanded "* | \
2854 " $CC_quoted"* | "$CC_quoted "* | " $CC_quoted_expanded "* | "$CC_quoted_expanded "*) ;;
2855 # Blanks at the start of $base_compile will cause this to fail
2856 # if we don't check for them as well.
2858 for z in $available_tags; do
2859 if $GREP "^# ### BEGIN LIBTOOL TAG CONFIG: $z$" < "$progpath" > /dev/null; then
2860 # Evaluate the configuration.
2861 eval "`$SED -n -e '/^# ### BEGIN LIBTOOL TAG CONFIG: '$z'$/,/^# ### END LIBTOOL TAG CONFIG: '$z'$/p' < $progpath`"
2864 # Double-quote args containing other shell metacharacters.
2865 func_append_quoted CC_quoted "$arg"
2867 CC_expanded=`func_echo_all $CC`
2868 CC_quoted_expanded=`func_echo_all $CC_quoted`
2870 " $CC "* | "$CC "* | " $CC_expanded "* | "$CC_expanded "* | \
2871 " $CC_quoted"* | "$CC_quoted "* | " $CC_quoted_expanded "* | "$CC_quoted_expanded "*)
2872 # The compiler in the base compile command matches
2873 # the one in the tagged configuration.
2874 # Assume this is the tagged configuration we want.
2881 # If $tagname still isn't set, then no tagged configuration
2882 # was found and let the user know that the "--tag" command
2883 # line option must be used.
2884 if test -z "$tagname"; then
2885 func_echo "unable to infer tagged configuration"
2886 func_fatal_error "specify a tag with '--tag'"
2888 # func_verbose "using $tagname tagged configuration"
2897 # func_write_libtool_object output_name pic_name nonpic_name
2898 # Create a libtool object file (analogous to a ".la" file),
2899 # but don't create it if we're doing a dry run.
2900 func_write_libtool_object ()
2903 if test yes = "$build_libtool_libs"; then
2909 if test yes = "$build_old_libs"; then
2916 cat >${write_libobj}T <<EOF
2917 # $write_libobj - a libtool object file
2918 # Generated by $PROGRAM (GNU $PACKAGE) $VERSION
2920 # Please DO NOT delete this file!
2921 # It is necessary for linking the library.
2923 # Name of the PIC object.
2924 pic_object=$write_lobj
2926 # Name of the non-PIC object
2927 non_pic_object=$write_oldobj
2930 $MV "${write_libobj}T" "$write_libobj"
2935 ##################################################
2936 # FILE NAME AND PATH CONVERSION HELPER FUNCTIONS #
2937 ##################################################
2939 # func_convert_core_file_wine_to_w32 ARG
2940 # Helper function used by file name conversion functions when $build is *nix,
2941 # and $host is mingw, cygwin, or some other w32 environment. Relies on a
2942 # correctly configured wine environment available, with the winepath program
2943 # in $build's $PATH.
2945 # ARG is the $build file name to be converted to w32 format.
2946 # Result is available in $func_convert_core_file_wine_to_w32_result, and will
2947 # be empty on error (or when ARG is empty)
2948 func_convert_core_file_wine_to_w32 ()
2952 func_convert_core_file_wine_to_w32_result=$1
2953 if test -n "$1"; then
2954 # Unfortunately, winepath does not exit with a non-zero error code, so we
2955 # are forced to check the contents of stdout. On the other hand, if the
2956 # command is not found, the shell will set an exit code of 127 and print
2957 # *an error message* to stdout. So we must check for both error code of
2958 # zero AND non-empty stdout, which explains the odd construction:
2959 func_convert_core_file_wine_to_w32_tmp=`winepath -w "$1" 2>/dev/null`
2960 if test "$?" -eq 0 && test -n "$func_convert_core_file_wine_to_w32_tmp"; then
2961 func_convert_core_file_wine_to_w32_result=`$ECHO "$func_convert_core_file_wine_to_w32_tmp" |
2962 $SED -e "$sed_naive_backslashify"`
2964 func_convert_core_file_wine_to_w32_result=
2968 # end: func_convert_core_file_wine_to_w32
2971 # func_convert_core_path_wine_to_w32 ARG
2972 # Helper function used by path conversion functions when $build is *nix, and
2973 # $host is mingw, cygwin, or some other w32 environment. Relies on a correctly
2974 # configured wine environment available, with the winepath program in $build's
2975 # $PATH. Assumes ARG has no leading or trailing path separator characters.
2977 # ARG is path to be converted from $build format to win32.
2978 # Result is available in $func_convert_core_path_wine_to_w32_result.
2979 # Unconvertible file (directory) names in ARG are skipped; if no directory names
2980 # are convertible, then the result may be empty.
2981 func_convert_core_path_wine_to_w32 ()
2985 # unfortunately, winepath doesn't convert paths, only file names
2986 func_convert_core_path_wine_to_w32_result=
2987 if test -n "$1"; then
2990 for func_convert_core_path_wine_to_w32_f in $1; do
2992 func_convert_core_file_wine_to_w32 "$func_convert_core_path_wine_to_w32_f"
2993 if test -n "$func_convert_core_file_wine_to_w32_result"; then
2994 if test -z "$func_convert_core_path_wine_to_w32_result"; then
2995 func_convert_core_path_wine_to_w32_result=$func_convert_core_file_wine_to_w32_result
2997 func_append func_convert_core_path_wine_to_w32_result ";$func_convert_core_file_wine_to_w32_result"
3004 # end: func_convert_core_path_wine_to_w32
3007 # func_cygpath ARGS...
3008 # Wrapper around calling the cygpath program via LT_CYGPATH. This is used when
3009 # when (1) $build is *nix and Cygwin is hosted via a wine environment; or (2)
3010 # $build is MSYS and $host is Cygwin, or (3) $build is Cygwin. In case (1) or
3011 # (2), returns the Cygwin file name or path in func_cygpath_result (input
3012 # file name or path is assumed to be in w32 format, as previously converted
3013 # from $build's *nix or MSYS format). In case (3), returns the w32 file name
3014 # or path in func_cygpath_result (input file name or path is assumed to be in
3015 # Cygwin format). Returns an empty string on error.
3017 # ARGS are passed to cygpath, with the last one being the file name or path to
3020 # Specify the absolute *nix (or w32) name to cygpath in the LT_CYGPATH
3021 # environment variable; do not put it in $PATH.
3026 if test -n "$LT_CYGPATH" && test -f "$LT_CYGPATH"; then
3027 func_cygpath_result=`$LT_CYGPATH "$@" 2>/dev/null`
3028 if test "$?" -ne 0; then
3029 # on failure, ensure result is empty
3030 func_cygpath_result=
3033 func_cygpath_result=
3034 func_error "LT_CYGPATH is empty or specifies non-existent file: '$LT_CYGPATH'"
3040 # func_convert_core_msys_to_w32 ARG
3041 # Convert file name or path ARG from MSYS format to w32 format. Return
3042 # result in func_convert_core_msys_to_w32_result.
3043 func_convert_core_msys_to_w32 ()
3047 # awkward: cmd appends spaces to result
3048 func_convert_core_msys_to_w32_result=`( cmd //c echo "$1" ) 2>/dev/null |
3049 $SED -e 's/[ ]*$//' -e "$sed_naive_backslashify"`
3051 #end: func_convert_core_msys_to_w32
3054 # func_convert_file_check ARG1 ARG2
3055 # Verify that ARG1 (a file name in $build format) was converted to $host
3056 # format in ARG2. Otherwise, emit an error message, but continue (resetting
3057 # func_to_host_file_result to ARG1).
3058 func_convert_file_check ()
3062 if test -z "$2" && test -n "$1"; then
3063 func_error "Could not determine host file name corresponding to"
3065 func_error "Continuing, but uninstalled executables may not work."
3067 func_to_host_file_result=$1
3070 # end func_convert_file_check
3073 # func_convert_path_check FROM_PATHSEP TO_PATHSEP FROM_PATH TO_PATH
3074 # Verify that FROM_PATH (a path in $build format) was converted to $host
3075 # format in TO_PATH. Otherwise, emit an error message, but continue, resetting
3076 # func_to_host_file_result to a simplistic fallback value (see below).
3077 func_convert_path_check ()
3081 if test -z "$4" && test -n "$3"; then
3082 func_error "Could not determine the host path corresponding to"
3084 func_error "Continuing, but uninstalled executables may not work."
3085 # Fallback. This is a deliberately simplistic "conversion" and
3086 # should not be "improved". See libtool.info.
3087 if test "x$1" != "x$2"; then
3088 lt_replace_pathsep_chars="s|$1|$2|g"
3089 func_to_host_path_result=`echo "$3" |
3090 $SED -e "$lt_replace_pathsep_chars"`
3092 func_to_host_path_result=$3
3096 # end func_convert_path_check
3099 # func_convert_path_front_back_pathsep FRONTPAT BACKPAT REPL ORIG
3100 # Modifies func_to_host_path_result by prepending REPL if ORIG matches FRONTPAT
3101 # and appending REPL if ORIG matches BACKPAT.
3102 func_convert_path_front_back_pathsep ()
3107 $1 ) func_to_host_path_result=$3$func_to_host_path_result
3111 $2 ) func_append func_to_host_path_result "$3"
3115 # end func_convert_path_front_back_pathsep
3118 ##################################################
3119 # $build to $host FILE NAME CONVERSION FUNCTIONS #
3120 ##################################################
3121 # invoked via '$to_host_file_cmd ARG'
3123 # In each case, ARG is the path to be converted from $build to $host format.
3124 # Result will be available in $func_to_host_file_result.
3127 # func_to_host_file ARG
3128 # Converts the file name ARG from $build format to $host format. Return result
3129 # in func_to_host_file_result.
3130 func_to_host_file ()
3134 $to_host_file_cmd "$1"
3136 # end func_to_host_file
3139 # func_to_tool_file ARG LAZY
3140 # converts the file name ARG from $build format to toolchain format. Return
3141 # result in func_to_tool_file_result. If the conversion in use is listed
3142 # in (the comma separated) LAZY, no conversion takes place.
3143 func_to_tool_file ()
3148 *,"$to_tool_file_cmd",*)
3149 func_to_tool_file_result=$1
3152 $to_tool_file_cmd "$1"
3153 func_to_tool_file_result=$func_to_host_file_result
3157 # end func_to_tool_file
3160 # func_convert_file_noop ARG
3161 # Copy ARG to func_to_host_file_result.
3162 func_convert_file_noop ()
3164 func_to_host_file_result=$1
3166 # end func_convert_file_noop
3169 # func_convert_file_msys_to_w32 ARG
3170 # Convert file name ARG from (mingw) MSYS to (mingw) w32 format; automatic
3171 # conversion to w32 is not available inside the cwrapper. Returns result in
3172 # func_to_host_file_result.
3173 func_convert_file_msys_to_w32 ()
3177 func_to_host_file_result=$1
3178 if test -n "$1"; then
3179 func_convert_core_msys_to_w32 "$1"
3180 func_to_host_file_result=$func_convert_core_msys_to_w32_result
3182 func_convert_file_check "$1" "$func_to_host_file_result"
3184 # end func_convert_file_msys_to_w32
3187 # func_convert_file_cygwin_to_w32 ARG
3188 # Convert file name ARG from Cygwin to w32 format. Returns result in
3189 # func_to_host_file_result.
3190 func_convert_file_cygwin_to_w32 ()
3194 func_to_host_file_result=$1
3195 if test -n "$1"; then
3196 # because $build is cygwin, we call "the" cygpath in $PATH; no need to use
3197 # LT_CYGPATH in this case.
3198 func_to_host_file_result=`cygpath -m "$1"`
3200 func_convert_file_check "$1" "$func_to_host_file_result"
3202 # end func_convert_file_cygwin_to_w32
3205 # func_convert_file_nix_to_w32 ARG
3206 # Convert file name ARG from *nix to w32 format. Requires a wine environment
3207 # and a working winepath. Returns result in func_to_host_file_result.
3208 func_convert_file_nix_to_w32 ()
3212 func_to_host_file_result=$1
3213 if test -n "$1"; then
3214 func_convert_core_file_wine_to_w32 "$1"
3215 func_to_host_file_result=$func_convert_core_file_wine_to_w32_result
3217 func_convert_file_check "$1" "$func_to_host_file_result"
3219 # end func_convert_file_nix_to_w32
3222 # func_convert_file_msys_to_cygwin ARG
3223 # Convert file name ARG from MSYS to Cygwin format. Requires LT_CYGPATH set.
3224 # Returns result in func_to_host_file_result.
3225 func_convert_file_msys_to_cygwin ()
3229 func_to_host_file_result=$1
3230 if test -n "$1"; then
3231 func_convert_core_msys_to_w32 "$1"
3232 func_cygpath -u "$func_convert_core_msys_to_w32_result"
3233 func_to_host_file_result=$func_cygpath_result
3235 func_convert_file_check "$1" "$func_to_host_file_result"
3237 # end func_convert_file_msys_to_cygwin
3240 # func_convert_file_nix_to_cygwin ARG
3241 # Convert file name ARG from *nix to Cygwin format. Requires Cygwin installed
3242 # in a wine environment, working winepath, and LT_CYGPATH set. Returns result
3243 # in func_to_host_file_result.
3244 func_convert_file_nix_to_cygwin ()
3248 func_to_host_file_result=$1
3249 if test -n "$1"; then
3250 # convert from *nix to w32, then use cygpath to convert from w32 to cygwin.
3251 func_convert_core_file_wine_to_w32 "$1"
3252 func_cygpath -u "$func_convert_core_file_wine_to_w32_result"
3253 func_to_host_file_result=$func_cygpath_result
3255 func_convert_file_check "$1" "$func_to_host_file_result"
3257 # end func_convert_file_nix_to_cygwin
3260 #############################################
3261 # $build to $host PATH CONVERSION FUNCTIONS #
3262 #############################################
3263 # invoked via '$to_host_path_cmd ARG'
3265 # In each case, ARG is the path to be converted from $build to $host format.
3266 # The result will be available in $func_to_host_path_result.
3268 # Path separators are also converted from $build format to $host format. If
3269 # ARG begins or ends with a path separator character, it is preserved (but
3270 # converted to $host format) on output.
3272 # All path conversion functions are named using the following convention:
3273 # file name conversion function : func_convert_file_X_to_Y ()
3274 # path conversion function : func_convert_path_X_to_Y ()
3275 # where, for any given $build/$host combination the 'X_to_Y' value is the
3276 # same. If conversion functions are added for new $build/$host combinations,
3277 # the two new functions must follow this pattern, or func_init_to_host_path_cmd
3281 # func_init_to_host_path_cmd
3282 # Ensures that function "pointer" variable $to_host_path_cmd is set to the
3283 # appropriate value, based on the value of $to_host_file_cmd.
3285 func_init_to_host_path_cmd ()
3289 if test -z "$to_host_path_cmd"; then
3290 func_stripname 'func_convert_file_' '' "$to_host_file_cmd"
3291 to_host_path_cmd=func_convert_path_$func_stripname_result
3296 # func_to_host_path ARG
3297 # Converts the path ARG from $build format to $host format. Return result
3298 # in func_to_host_path_result.
3299 func_to_host_path ()
3303 func_init_to_host_path_cmd
3304 $to_host_path_cmd "$1"
3306 # end func_to_host_path
3309 # func_convert_path_noop ARG
3310 # Copy ARG to func_to_host_path_result.
3311 func_convert_path_noop ()
3313 func_to_host_path_result=$1
3315 # end func_convert_path_noop
3318 # func_convert_path_msys_to_w32 ARG
3319 # Convert path ARG from (mingw) MSYS to (mingw) w32 format; automatic
3320 # conversion to w32 is not available inside the cwrapper. Returns result in
3321 # func_to_host_path_result.
3322 func_convert_path_msys_to_w32 ()
3326 func_to_host_path_result=$1
3327 if test -n "$1"; then
3328 # Remove leading and trailing path separator characters from ARG. MSYS
3329 # behavior is inconsistent here; cygpath turns them into '.;' and ';.';
3330 # and winepath ignores them completely.
3331 func_stripname : : "$1"
3332 func_to_host_path_tmp1=$func_stripname_result
3333 func_convert_core_msys_to_w32 "$func_to_host_path_tmp1"
3334 func_to_host_path_result=$func_convert_core_msys_to_w32_result
3335 func_convert_path_check : ";" \
3336 "$func_to_host_path_tmp1" "$func_to_host_path_result"
3337 func_convert_path_front_back_pathsep ":*" "*:" ";" "$1"
3340 # end func_convert_path_msys_to_w32
3343 # func_convert_path_cygwin_to_w32 ARG
3344 # Convert path ARG from Cygwin to w32 format. Returns result in
3345 # func_to_host_file_result.
3346 func_convert_path_cygwin_to_w32 ()
3350 func_to_host_path_result=$1
3351 if test -n "$1"; then
3352 # See func_convert_path_msys_to_w32:
3353 func_stripname : : "$1"
3354 func_to_host_path_tmp1=$func_stripname_result
3355 func_to_host_path_result=`cygpath -m -p "$func_to_host_path_tmp1"`
3356 func_convert_path_check : ";" \
3357 "$func_to_host_path_tmp1" "$func_to_host_path_result"
3358 func_convert_path_front_back_pathsep ":*" "*:" ";" "$1"
3361 # end func_convert_path_cygwin_to_w32
3364 # func_convert_path_nix_to_w32 ARG
3365 # Convert path ARG from *nix to w32 format. Requires a wine environment and
3366 # a working winepath. Returns result in func_to_host_file_result.
3367 func_convert_path_nix_to_w32 ()
3371 func_to_host_path_result=$1
3372 if test -n "$1"; then
3373 # See func_convert_path_msys_to_w32:
3374 func_stripname : : "$1"
3375 func_to_host_path_tmp1=$func_stripname_result
3376 func_convert_core_path_wine_to_w32 "$func_to_host_path_tmp1"
3377 func_to_host_path_result=$func_convert_core_path_wine_to_w32_result
3378 func_convert_path_check : ";" \
3379 "$func_to_host_path_tmp1" "$func_to_host_path_result"
3380 func_convert_path_front_back_pathsep ":*" "*:" ";" "$1"
3383 # end func_convert_path_nix_to_w32
3386 # func_convert_path_msys_to_cygwin ARG
3387 # Convert path ARG from MSYS to Cygwin format. Requires LT_CYGPATH set.
3388 # Returns result in func_to_host_file_result.
3389 func_convert_path_msys_to_cygwin ()
3393 func_to_host_path_result=$1
3394 if test -n "$1"; then
3395 # See func_convert_path_msys_to_w32:
3396 func_stripname : : "$1"
3397 func_to_host_path_tmp1=$func_stripname_result
3398 func_convert_core_msys_to_w32 "$func_to_host_path_tmp1"
3399 func_cygpath -u -p "$func_convert_core_msys_to_w32_result"
3400 func_to_host_path_result=$func_cygpath_result
3401 func_convert_path_check : : \
3402 "$func_to_host_path_tmp1" "$func_to_host_path_result"
3403 func_convert_path_front_back_pathsep ":*" "*:" : "$1"
3406 # end func_convert_path_msys_to_cygwin
3409 # func_convert_path_nix_to_cygwin ARG
3410 # Convert path ARG from *nix to Cygwin format. Requires Cygwin installed in a
3411 # a wine environment, working winepath, and LT_CYGPATH set. Returns result in
3412 # func_to_host_file_result.
3413 func_convert_path_nix_to_cygwin ()
3417 func_to_host_path_result=$1
3418 if test -n "$1"; then
3419 # Remove leading and trailing path separator characters from
3420 # ARG. msys behavior is inconsistent here, cygpath turns them
3421 # into '.;' and ';.', and winepath ignores them completely.
3422 func_stripname : : "$1"
3423 func_to_host_path_tmp1=$func_stripname_result
3424 func_convert_core_path_wine_to_w32 "$func_to_host_path_tmp1"
3425 func_cygpath -u -p "$func_convert_core_path_wine_to_w32_result"
3426 func_to_host_path_result=$func_cygpath_result
3427 func_convert_path_check : : \
3428 "$func_to_host_path_tmp1" "$func_to_host_path_result"
3429 func_convert_path_front_back_pathsep ":*" "*:" : "$1"
3432 # end func_convert_path_nix_to_cygwin
3435 # func_dll_def_p FILE
3436 # True iff FILE is a Windows DLL '.def' file.
3437 # Keep in sync with _LT_DLL_DEF_P in libtool.m4
3442 func_dll_def_p_tmp=`$SED -n \
3444 -e '/^\(;.*\)*$/d' \
3445 -e 's/^\(EXPORTS\|LIBRARY\)\([ ].*\)*$/DEF/p' \
3448 test DEF = "$func_dll_def_p_tmp"
3452 # func_mode_compile arg...
3453 func_mode_compile ()
3457 # Get the compilation command and the source file.
3459 srcfile=$nonopt # always keep a non-empty value in "srcfile"
3471 # do not "continue". Instead, add this to base_compile
3483 # Accept any command-line options.
3486 test -n "$libobj" && \
3487 func_fatal_error "you cannot specify '-o' more than once"
3492 -pie | -fpie | -fPIE)
3493 func_append pie_flag " $arg"
3497 -shared | -static | -prefer-pic | -prefer-non-pic)
3498 func_append later " $arg"
3508 arg_mode=arg # the next one goes into the "base_compile" arg list
3509 continue # The current "srcfile" will either be retained or
3510 ;; # replaced later. I would guess that would be a bug.
3513 func_stripname '-Wc,' '' "$arg"
3514 args=$func_stripname_result
3516 save_ifs=$IFS; IFS=,
3517 for arg in $args; do
3519 func_append_quoted lastarg "$arg"
3522 func_stripname ' ' '' "$lastarg"
3523 lastarg=$func_stripname_result
3525 # Add the arguments to base_compile.
3526 func_append base_compile " $lastarg"
3531 # Accept the current argument as the source file.
3532 # The previous "srcfile" becomes the current argument.
3539 esac # case $arg_mode
3541 # Aesthetically quote the previous argument.
3542 func_append_quoted base_compile "$lastarg"
3547 func_fatal_error "you must specify an argument for -Xcompile"
3550 func_fatal_error "you must specify a target with '-o'"
3553 # Get the name of the library object.
3554 test -z "$libobj" && {
3555 func_basename "$srcfile"
3556 libobj=$func_basename_result
3561 # Recognize several different file suffixes.
3562 # If the user specifies -o file.o, it is replaced with file.lo
3565 *.ada | *.adb | *.ads | *.asm | \
3566 *.c++ | *.cc | *.ii | *.class | *.cpp | *.cxx | \
3567 *.[fF][09]? | *.for | *.java | *.go | *.obj | *.sx | *.cu | *.cup)
3568 func_xform "$libobj"
3569 libobj=$func_xform_result
3574 *.lo) func_lo2o "$libobj"; obj=$func_lo2o_result ;;
3576 func_fatal_error "cannot determine name of library object from '$libobj'"
3580 func_infer_tag $base_compile
3582 for arg in $later; do
3585 test yes = "$build_libtool_libs" \
3586 || func_fatal_configuration "cannot build a shared library"
3592 build_libtool_libs=no
3609 func_quote_arg pretty "$libobj"
3610 test "X$libobj" != "X$func_quote_arg_result" \
3611 && $ECHO "X$libobj" | $GREP '[]~#^*{};<>?"'"'"' &()|`$[]' \
3612 && func_warning "libobj name '$libobj' may not contain shell special characters."
3613 func_dirname_and_basename "$obj" "/" ""
3614 objname=$func_basename_result
3615 xdir=$func_dirname_result
3616 lobj=$xdir$objdir/$objname
3618 test -z "$base_compile" && \
3619 func_fatal_help "you must specify a compilation command"
3621 # Delete any leftover library objects.
3622 if test yes = "$build_old_libs"; then
3623 removelist="$obj $lobj $libobj ${libobj}T"
3625 removelist="$lobj $libobj ${libobj}T"
3628 # On Cygwin there's no "real" PIC flag so we must build both object types
3630 cygwin* | mingw* | pw32* | os2* | cegcc*)
3634 if test no = "$pic_mode" && test pass_all != "$deplibs_check_method"; then
3635 # non-PIC code in shared libraries is not supported
3639 # Calculate the filename of the output object if compiler does
3640 # not support -o with -c
3641 if test no = "$compiler_c_o"; then
3642 output_obj=`$ECHO "$srcfile" | $SED 's%^.*/%%; s%\.[^.]*$%%'`.$objext
3643 lockfile=$output_obj.lock
3650 # Lock this critical section if it is needed
3651 # We use this script file to make the link, it avoids creating a new file
3652 if test yes = "$need_locks"; then
3653 until $opt_dry_run || ln "$progpath" "$lockfile" 2>/dev/null; do
3654 func_echo "Waiting for $lockfile to be removed"
3657 elif test warn = "$need_locks"; then
3658 if test -f "$lockfile"; then
3660 *** ERROR, $lockfile exists and contains:
3661 `cat $lockfile 2>/dev/null`
3663 This indicates that another process is trying to use the same
3664 temporary object file, and libtool could not work around it because
3665 your compiler does not support '-c' and '-o' together. If you
3666 repeat this compilation, it may succeed, by chance, but you had better
3667 avoid parallel builds (make -j) in this platform, or get a better
3670 $opt_dry_run || $RM $removelist
3673 func_append removelist " $output_obj"
3674 $ECHO "$srcfile" > "$lockfile"
3677 $opt_dry_run || $RM $removelist
3678 func_append removelist " $lockfile"
3679 trap '$opt_dry_run || $RM $removelist; exit $EXIT_FAILURE' 1 2 15
3681 func_to_tool_file "$srcfile" func_convert_file_msys_to_w32
3682 srcfile=$func_to_tool_file_result
3683 func_quote_arg pretty "$srcfile"
3684 qsrcfile=$func_quote_arg_result
3686 # Only build a PIC object if we are building libtool libraries.
3687 if test yes = "$build_libtool_libs"; then
3688 # Without this assignment, base_compile gets emptied.
3689 fbsd_hideous_sh_bug=$base_compile
3691 if test no != "$pic_mode"; then
3692 command="$base_compile $qsrcfile $pic_flag"
3694 # Don't build PIC code
3695 command="$base_compile $qsrcfile"
3698 func_mkdir_p "$xdir$objdir"
3700 if test -z "$output_obj"; then
3701 # Place PIC objects in $objdir
3702 func_append command " -o $lobj"
3705 func_show_eval_locale "$command" \
3706 'test -n "$output_obj" && $RM $removelist; exit $EXIT_FAILURE'
3708 if test warn = "$need_locks" &&
3709 test "X`cat $lockfile 2>/dev/null`" != "X$srcfile"; then
3711 *** ERROR, $lockfile contains:
3712 `cat $lockfile 2>/dev/null`
3714 but it should contain:
3717 This indicates that another process is trying to use the same
3718 temporary object file, and libtool could not work around it because
3719 your compiler does not support '-c' and '-o' together. If you
3720 repeat this compilation, it may succeed, by chance, but you had better
3721 avoid parallel builds (make -j) in this platform, or get a better
3724 $opt_dry_run || $RM $removelist
3728 # Just move the object if needed, then go on to compile the next one
3729 if test -n "$output_obj" && test "X$output_obj" != "X$lobj"; then
3730 func_show_eval '$MV "$output_obj" "$lobj"' \
3731 'error=$?; $opt_dry_run || $RM $removelist; exit $error'
3734 # Allow error messages only from the first compilation.
3735 if test yes = "$suppress_opt"; then
3736 suppress_output=' >/dev/null 2>&1'
3740 # Only build a position-dependent object if we build old libraries.
3741 if test yes = "$build_old_libs"; then
3742 if test yes != "$pic_mode"; then
3743 # Don't build PIC code
3744 command="$base_compile $qsrcfile$pie_flag"
3746 command="$base_compile $qsrcfile $pic_flag"
3748 if test yes = "$compiler_c_o"; then
3749 func_append command " -o $obj"
3752 # Suppress compiler output if we already did a PIC compilation.
3753 func_append command "$suppress_output"
3754 func_show_eval_locale "$command" \
3755 '$opt_dry_run || $RM $removelist; exit $EXIT_FAILURE'
3757 if test warn = "$need_locks" &&
3758 test "X`cat $lockfile 2>/dev/null`" != "X$srcfile"; then
3760 *** ERROR, $lockfile contains:
3761 `cat $lockfile 2>/dev/null`
3763 but it should contain:
3766 This indicates that another process is trying to use the same
3767 temporary object file, and libtool could not work around it because
3768 your compiler does not support '-c' and '-o' together. If you
3769 repeat this compilation, it may succeed, by chance, but you had better
3770 avoid parallel builds (make -j) in this platform, or get a better
3773 $opt_dry_run || $RM $removelist
3777 # Just move the object if needed
3778 if test -n "$output_obj" && test "X$output_obj" != "X$obj"; then
3779 func_show_eval '$MV "$output_obj" "$obj"' \
3780 'error=$?; $opt_dry_run || $RM $removelist; exit $error'
3785 func_write_libtool_object "$libobj" "$objdir/$objname" "$objname"
3787 # Unlock the critical section if it was locked
3788 if test no != "$need_locks"; then
3789 removelist=$lockfile
3798 test compile = "$opt_mode" && func_mode_compile ${1+"$@"}
3803 # We need to display help for each of the modes.
3806 # Generic help is extracted from the usage comments
3807 # at the start of this file.
3813 "Usage: $progname [OPTION]... --mode=clean RM [RM-OPTION]... FILE...
3815 Remove files from the build directory.
3817 RM is the name of the program to use to delete files associated with each FILE
3818 (typically '/bin/rm'). RM-OPTIONS are options (such as '-f') to be passed
3821 If FILE is a libtool library, object or program, all the files associated
3822 with it are deleted. Otherwise, only FILE itself is deleted using RM."
3827 "Usage: $progname [OPTION]... --mode=compile COMPILE-COMMAND... SOURCEFILE
3829 Compile a source file into a libtool library object.
3831 This mode accepts the following additional options:
3833 -o OUTPUT-FILE set the output file name to OUTPUT-FILE
3834 -no-suppress do not suppress compiler output for multiple passes
3835 -prefer-pic try to build PIC objects only
3836 -prefer-non-pic try to build non-PIC objects only
3837 -shared do not build a '.o' file suitable for static linking
3838 -static only build a '.o' file suitable for static linking
3839 -Wc,FLAG pass FLAG directly to the compiler
3841 COMPILE-COMMAND is a command to be used in creating a 'standard' object file
3842 from the given SOURCEFILE.
3844 The output file name is determined by removing the directory component from
3845 SOURCEFILE, then substituting the C source code suffix '.c' with the
3846 library object suffix, '.lo'."
3851 "Usage: $progname [OPTION]... --mode=execute COMMAND [ARGS]...
3853 Automatically set library path, then run a program.
3855 This mode accepts the following additional options:
3857 -dlopen FILE add the directory containing FILE to the library path
3859 This mode sets the library path environment variable according to '-dlopen'
3862 If any of the ARGS are libtool executable wrappers, then they are translated
3863 into their corresponding uninstalled binary, and any of their required library
3864 directories are added to the library path.
3866 Then, COMMAND is executed, with ARGS as arguments."
3871 "Usage: $progname [OPTION]... --mode=finish [LIBDIR]...
3873 Complete the installation of libtool libraries.
3875 Each LIBDIR is a directory that contains libtool libraries.
3877 The commands that this mode executes may require superuser privileges. Use
3878 the '--dry-run' option if you just want to see what would be executed."
3883 "Usage: $progname [OPTION]... --mode=install INSTALL-COMMAND...
3885 Install executables or libraries.
3887 INSTALL-COMMAND is the installation command. The first component should be
3888 either the 'install' or 'cp' program.
3890 The following components of INSTALL-COMMAND are treated specially:
3892 -inst-prefix-dir PREFIX-DIR Use PREFIX-DIR as a staging area for installation
3894 The rest of the components are interpreted as arguments to that command (only
3895 BSD-compatible install options are recognized)."
3900 "Usage: $progname [OPTION]... --mode=link LINK-COMMAND...
3902 Link object files or libraries together to form another library, or to
3903 create an executable program.
3905 LINK-COMMAND is a command using the C compiler that you would use to create
3906 a program from several object files.
3908 The following components of LINK-COMMAND are treated specially:
3910 -all-static do not do any dynamic linking at all
3911 -avoid-version do not add a version suffix if possible
3912 -bindir BINDIR specify path to binaries directory (for systems where
3913 libraries must be found in the PATH setting at runtime)
3914 -dlopen FILE '-dlpreopen' FILE if it cannot be dlopened at runtime
3915 -dlpreopen FILE link in FILE and add its symbols to lt_preloaded_symbols
3916 -export-dynamic allow symbols from OUTPUT-FILE to be resolved with dlsym(3)
3917 -export-symbols SYMFILE
3918 try to export only the symbols listed in SYMFILE
3919 -export-symbols-regex REGEX
3920 try to export only the symbols matching REGEX
3921 -LLIBDIR search LIBDIR for required installed libraries
3922 -lNAME OUTPUT-FILE requires the installed library libNAME
3923 -module build a library that can dlopened
3924 -no-fast-install disable the fast-install mode
3925 -no-install link a not-installable executable
3926 -no-undefined declare that a library does not refer to external symbols
3927 -o OUTPUT-FILE create OUTPUT-FILE from the specified objects
3928 -objectlist FILE use a list of object files found in FILE to specify objects
3929 -os2dllname NAME force a short DLL name on OS/2 (no effect on other OSes)
3930 -precious-files-regex REGEX
3931 don't remove output files matching REGEX
3932 -release RELEASE specify package release information
3933 -rpath LIBDIR the created library will eventually be installed in LIBDIR
3934 -R[ ]LIBDIR add LIBDIR to the runtime path of programs and libraries
3935 -shared only do dynamic linking of libtool libraries
3936 -shrext SUFFIX override the standard shared library file extension
3937 -static do not do any dynamic linking of uninstalled libtool libraries
3938 -static-libtool-libs
3939 do not do any dynamic linking of libtool libraries
3940 -version-info CURRENT[:REVISION[:AGE]]
3941 specify library version info [each variable defaults to 0]
3942 -weak LIBNAME declare that the target provides the LIBNAME interface
3944 -Xcompiler FLAG pass linker-specific FLAG directly to the compiler
3946 -Xlinker FLAG pass linker-specific FLAG directly to the linker
3947 -XCClinker FLAG pass link-specific FLAG to the compiler driver (CC)
3949 All other options (arguments beginning with '-') are ignored.
3951 Every other argument is treated as a filename. Files ending in '.la' are
3952 treated as uninstalled libtool libraries, other files are standard or library
3955 If the OUTPUT-FILE ends in '.la', then a libtool library is created,
3956 only library objects ('.lo' files) may be specified, and '-rpath' is
3957 required, except when creating a convenience library.
3959 If OUTPUT-FILE ends in '.a' or '.lib', then a standard library is created
3960 using 'ar' and 'ranlib', or on Windows using 'lib'.
3962 If OUTPUT-FILE ends in '.lo' or '.$objext', then a reloadable object file
3963 is created, otherwise an executable program is created."
3968 "Usage: $progname [OPTION]... --mode=uninstall RM [RM-OPTION]... FILE...
3970 Remove libraries from an installation directory.
3972 RM is the name of the program to use to delete files associated with each FILE
3973 (typically '/bin/rm'). RM-OPTIONS are options (such as '-f') to be passed
3976 If FILE is a libtool library, all the files associated with it are deleted.
3977 Otherwise, only FILE itself is deleted using RM."
3981 func_fatal_help "invalid operation mode '$opt_mode'"
3986 $ECHO "Try '$progname --help' for more information about other modes."
3989 # Now that we've collected a possible --mode arg, show help if necessary
3991 if test : = "$opt_help"; then
3996 for opt_mode in compile link execute install finish uninstall clean; do
3999 } | $SED -n '1p; 2,$s/^Usage:/ or: /p'
4002 for opt_mode in compile link execute install finish uninstall clean; do
4008 /^When reporting/,/^Report/{
4013 /information about other modes/d
4014 /more detailed .*MODE/d
4015 s/^Usage:.*--mode=\([^ ]*\) .*/Description of \1 mode:/'
4021 # func_mode_execute arg...
4022 func_mode_execute ()
4026 # The first argument is the command name.
4029 func_fatal_help "you must specify a COMMAND"
4031 # Handle -dlopen flags immediately.
4032 for file in $opt_dlopen; do
4034 || func_fatal_help "'$file' is not a file"
4039 func_resolve_sysroot "$file"
4040 file=$func_resolve_sysroot_result
4042 # Check to see that this really is a libtool archive.
4043 func_lalib_unsafe_p "$file" \
4044 || func_fatal_help "'$lib' is not a valid libtool archive"
4046 # Read the libtool library.
4051 # Skip this library if it cannot be dlopened.
4052 if test -z "$dlname"; then
4053 # Warn if it was a shared library.
4054 test -n "$library_names" && \
4055 func_warning "'$file' was not linked with '-export-dynamic'"
4059 func_dirname "$file" "" "."
4060 dir=$func_dirname_result
4062 if test -f "$dir/$objdir/$dlname"; then
4063 func_append dir "/$objdir"
4065 if test ! -f "$dir/$dlname"; then
4066 func_fatal_error "cannot find '$dlname' in '$dir' or '$dir/$objdir'"
4072 # Just add the directory containing the .lo file.
4073 func_dirname "$file" "" "."
4074 dir=$func_dirname_result
4078 func_warning "'-dlopen' is ignored for non-libtool libraries and objects"
4083 # Get the absolute pathname.
4084 absdir=`cd "$dir" && pwd`
4085 test -n "$absdir" && dir=$absdir
4087 # Now add the directory to shlibpath_var.
4088 if eval "test -z \"\$$shlibpath_var\""; then
4089 eval "$shlibpath_var=\"\$dir\""
4091 eval "$shlibpath_var=\"\$dir:\$$shlibpath_var\""
4095 # This variable tells wrapper scripts just to set shlibpath_var
4096 # rather than running their programs.
4097 libtool_execute_magic=$magic
4099 # Check if any of the arguments is a wrapper script.
4104 -* | *.la | *.lo ) ;;
4106 # Do a test to see if this is really a libtool program.
4107 if func_ltwrapper_script_p "$file"; then
4109 # Transform arg to wrapped name.
4110 file=$progdir/$program
4111 elif func_ltwrapper_executable_p "$file"; then
4112 func_ltwrapper_scriptname "$file"
4113 func_source "$func_ltwrapper_scriptname_result"
4114 # Transform arg to wrapped name.
4115 file=$progdir/$program
4119 # Quote arguments (to preserve shell metacharacters).
4120 func_append_quoted args "$file"
4123 if $opt_dry_run; then
4124 # Display what would be done.
4125 if test -n "$shlibpath_var"; then
4126 eval "\$ECHO \"\$shlibpath_var=\$$shlibpath_var\""
4127 echo "export $shlibpath_var"
4132 if test -n "$shlibpath_var"; then
4133 # Export the shlibpath_var.
4134 eval "export $shlibpath_var"
4137 # Restore saved environment variables
4138 for lt_var in LANG LANGUAGE LC_ALL LC_CTYPE LC_COLLATE LC_MESSAGES
4140 eval "if test \"\${save_$lt_var+set}\" = set; then
4141 $lt_var=\$save_$lt_var; export $lt_var
4147 # Now prepare to actually exec the command.
4152 test execute = "$opt_mode" && func_mode_execute ${1+"$@"}
4155 # func_mode_finish arg...
4164 for opt in "$nonopt" ${1+"$@"}
4166 if test -d "$opt"; then
4167 func_append libdirs " $opt"
4169 elif test -f "$opt"; then
4170 if func_lalib_unsafe_p "$opt"; then
4171 func_append libs " $opt"
4173 func_warning "'$opt' is not a valid libtool archive"
4177 func_fatal_error "invalid argument '$opt'"
4181 if test -n "$libs"; then
4182 if test -n "$lt_sysroot"; then
4183 sysroot_regex=`$ECHO "$lt_sysroot" | $SED "$sed_make_literal_regex"`
4184 sysroot_cmd="s/\([ ']\)$sysroot_regex/\1/g;"
4189 # Remove sysroot references
4190 if $opt_dry_run; then
4191 for lib in $libs; do
4192 echo "removing references to $lt_sysroot and '=' prefixes from $lib"
4195 tmpdir=`func_mktempdir`
4196 for lib in $libs; do
4197 $SED -e "$sysroot_cmd s/\([ ']-[LR]\)=/\1/g; s/\([ ']\)=/\1/g" $lib \
4199 mv -f $tmpdir/tmp-la $lib
4205 if test -n "$finish_cmds$finish_eval" && test -n "$libdirs"; then
4206 for libdir in $libdirs; do
4207 if test -n "$finish_cmds"; then
4208 # Do each command in the finish commands.
4209 func_execute_cmds "$finish_cmds" 'admincmds="$admincmds
4212 if test -n "$finish_eval"; then
4213 # Do the single finish_eval.
4214 eval cmds=\"$finish_eval\"
4215 $opt_dry_run || eval "$cmds" || func_append admincmds "
4221 # Exit here if they wanted silent mode.
4222 $opt_quiet && exit $EXIT_SUCCESS
4224 if test -n "$finish_cmds$finish_eval" && test -n "$libdirs"; then
4225 echo "----------------------------------------------------------------------"
4226 echo "Libraries have been installed in:"
4227 for libdir in $libdirs; do
4231 echo "If you ever happen to want to link against installed libraries"
4232 echo "in a given directory, LIBDIR, you must either use libtool, and"
4233 echo "specify the full pathname of the library, or use the '-LLIBDIR'"
4234 echo "flag during linking and do at least one of the following:"
4235 if test -n "$shlibpath_var"; then
4236 echo " - add LIBDIR to the '$shlibpath_var' environment variable"
4237 echo " during execution"
4239 if test -n "$runpath_var"; then
4240 echo " - add LIBDIR to the '$runpath_var' environment variable"
4241 echo " during linking"
4243 if test -n "$hardcode_libdir_flag_spec"; then
4245 eval flag=\"$hardcode_libdir_flag_spec\"
4247 $ECHO " - use the '$flag' linker flag"
4249 if test -n "$admincmds"; then
4250 $ECHO " - have your system administrator run these commands:$admincmds"
4252 if test -f /etc/ld.so.conf; then
4253 echo " - have your system administrator add LIBDIR to '/etc/ld.so.conf'"
4257 echo "See any operating system documentation about shared libraries for"
4259 solaris2.[6789]|solaris2.1[0-9])
4260 echo "more information, such as the ld(1), crle(1) and ld.so(8) manual"
4264 echo "more information, such as the ld(1) and ld.so(8) manual pages."
4267 echo "----------------------------------------------------------------------"
4272 test finish = "$opt_mode" && func_mode_finish ${1+"$@"}
4275 # func_mode_install arg...
4276 func_mode_install ()
4280 # There may be an optional sh(1) argument at the beginning of
4281 # install_prog (especially on Windows NT).
4282 if test "$SHELL" = "$nonopt" || test /bin/sh = "$nonopt" ||
4283 # Allow the use of GNU shtool's install command.
4284 case $nonopt in *shtool*) :;; *) false;; esac
4286 # Aesthetically quote it.
4287 func_quote_arg pretty "$nonopt"
4288 install_prog="$func_quote_arg_result "
4296 # The real first argument should be the name of the installation program.
4297 # Aesthetically quote it.
4298 func_quote_arg pretty "$arg"
4299 func_append install_prog "$func_quote_arg_result"
4300 install_shared_prog=$install_prog
4301 case " $install_prog " in
4302 *[\\\ /]cp\ *) install_cp=: ;;
4303 *) install_cp=false ;;
4306 # We need to accept at least all the BSD install flags.
4318 if test -n "$dest"; then
4319 func_append files " $dest"
4327 if $install_cp; then :; else
4341 # If the previous option needed an argument, then skip it.
4342 if test -n "$prev"; then
4343 if test X-m = "X$prev" && test -n "$install_override_mode"; then
4344 arg2=$install_override_mode
4355 # Aesthetically quote the argument.
4356 func_quote_arg pretty "$arg"
4357 func_append install_prog " $func_quote_arg_result"
4358 if test -n "$arg2"; then
4359 func_quote_arg pretty "$arg2"
4361 func_append install_shared_prog " $func_quote_arg_result"
4364 test -z "$install_prog" && \
4365 func_fatal_help "you must specify an install program"
4367 test -n "$prev" && \
4368 func_fatal_help "the '$prev' option requires an argument"
4370 if test -n "$install_override_mode" && $no_mode; then
4371 if $install_cp; then :; else
4372 func_quote_arg pretty "$install_override_mode"
4373 func_append install_shared_prog " -m $func_quote_arg_result"
4377 if test -z "$files"; then
4378 if test -z "$dest"; then
4379 func_fatal_help "no file or destination specified"
4381 func_fatal_help "you must specify a destination"
4385 # Strip any trailing slash from the destination.
4386 func_stripname '' '/' "$dest"
4387 dest=$func_stripname_result
4389 # Check to see that the destination is a directory.
4390 test -d "$dest" && isdir=:
4395 func_dirname_and_basename "$dest" "" "."
4396 destdir=$func_dirname_result
4397 destname=$func_basename_result
4399 # Not a directory, so check to see that there is only one file specified.
4400 set dummy $files; shift
4401 test "$#" -gt 1 && \
4402 func_fatal_help "'$dest' is not a directory"
4405 [\\/]* | [A-Za-z]:[\\/]*) ;;
4407 for file in $files; do
4411 func_fatal_help "'$destdir' must be an absolute directory name"
4418 # This variable tells wrapper scripts just to set variables rather
4419 # than running their programs.
4420 libtool_install_magic=$magic
4425 for file in $files; do
4427 # Do each installation.
4430 # Do the static libraries later.
4431 func_append staticlibs " $file"
4435 func_resolve_sysroot "$file"
4436 file=$func_resolve_sysroot_result
4438 # Check to see that this really is a libtool archive.
4439 func_lalib_unsafe_p "$file" \
4440 || func_fatal_help "'$file' is not a valid libtool archive"
4447 # Add the libdir to current_libdirs if it is the destination.
4448 if test "X$destdir" = "X$libdir"; then
4449 case "$current_libdirs " in
4451 *) func_append current_libdirs " $libdir" ;;
4454 # Note the libdir as a future libdir.
4455 case "$future_libdirs " in
4457 *) func_append future_libdirs " $libdir" ;;
4461 func_dirname "$file" "/" ""
4462 dir=$func_dirname_result
4463 func_append dir "$objdir"
4465 if test -n "$relink_command"; then
4466 # Determine the prefix the user has applied to our future dir.
4467 inst_prefix_dir=`$ECHO "$destdir" | $SED -e "s%$libdir\$%%"`
4469 # Don't allow the user to place us outside of our expected
4470 # location b/c this prevents finding dependent libraries that
4471 # are installed to the same prefix.
4472 # At present, this check doesn't affect windows .dll's that
4473 # are installed into $libdir/../bin (currently, that works fine)
4474 # but it's something to keep an eye on.
4475 test "$inst_prefix_dir" = "$destdir" && \
4476 func_fatal_error "error: cannot install '$file' to a directory not ending in $libdir"
4478 if test -n "$inst_prefix_dir"; then
4479 # Stick the inst_prefix_dir data into the link command.
4480 relink_command=`$ECHO "$relink_command" | $SED "s%@inst_prefix_dir@%-inst-prefix-dir $inst_prefix_dir%"`
4482 relink_command=`$ECHO "$relink_command" | $SED "s%@inst_prefix_dir@%%"`
4485 func_warning "relinking '$file'"
4486 func_show_eval "$relink_command" \
4487 'func_fatal_error "error: relink '\''$file'\'' with the above command before installing it"'
4490 # See the names of the shared library.
4491 set dummy $library_names; shift
4492 if test -n "$1"; then
4497 test -n "$relink_command" && srcname=${realname}T
4499 # Install the shared library and build the symlinks.
4500 func_show_eval "$install_shared_prog $dir/$srcname $destdir/$realname" \
4504 cygwin* | mingw* | pw32* | cegcc*)
4519 if test -n "$tstripme" && test -n "$striplib"; then
4520 func_show_eval "$striplib $destdir/$realname" 'exit $?'
4523 if test "$#" -gt 0; then
4524 # Delete the old symlinks, and create new ones.
4525 # Try 'ln -sf' first, because the 'ln' binary might depend on
4526 # the symlink we replace! Solaris /bin/ln does not understand -f,
4527 # so we also need to try rm && ln -s.
4530 test "$linkname" != "$realname" \
4531 && func_show_eval "(cd $destdir && { $LN_S -f $realname $linkname || { $RM $linkname && $LN_S $realname $linkname; }; })"
4535 # Do each command in the postinstall commands.
4536 lib=$destdir/$realname
4537 func_execute_cmds "$postinstall_cmds" 'exit $?'
4540 # Install the pseudo-library for information purposes.
4541 func_basename "$file"
4542 name=$func_basename_result
4543 instname=$dir/${name}i
4544 func_show_eval "$install_prog $instname $destdir/$name" 'exit $?'
4546 # Maybe install the static library, too.
4547 test -n "$old_library" && func_append staticlibs " $dir/$old_library"
4551 # Install (i.e. copy) a libtool object.
4553 # Figure out destination file name, if it wasn't already specified.
4554 if test -n "$destname"; then
4555 destfile=$destdir/$destname
4557 func_basename "$file"
4558 destfile=$func_basename_result
4559 destfile=$destdir/$destfile
4562 # Deduce the name of the destination old-style object file.
4565 func_lo2o "$destfile"
4566 staticdest=$func_lo2o_result
4569 staticdest=$destfile
4573 func_fatal_help "cannot copy a libtool object to '$destfile'"
4577 # Install the libtool object if requested.
4578 test -n "$destfile" && \
4579 func_show_eval "$install_prog $file $destfile" 'exit $?'
4581 # Install the old object if enabled.
4582 if test yes = "$build_old_libs"; then
4583 # Deduce the name of the old-style object file.
4585 staticobj=$func_lo2o_result
4586 func_show_eval "$install_prog \$staticobj \$staticdest" 'exit $?'
4592 # Figure out destination file name, if it wasn't already specified.
4593 if test -n "$destname"; then
4594 destfile=$destdir/$destname
4596 func_basename "$file"
4597 destfile=$func_basename_result
4598 destfile=$destdir/$destfile
4601 # If the file is missing, and there is a .exe on the end, strip it
4602 # because it is most likely a libtool script we actually want to
4607 if test ! -f "$file"; then
4608 func_stripname '' '.exe' "$file"
4609 file=$func_stripname_result
4615 # Do a test to see if this is really a libtool program.
4618 if func_ltwrapper_executable_p "$file"; then
4619 func_ltwrapper_scriptname "$file"
4620 wrapper=$func_ltwrapper_scriptname_result
4622 func_stripname '' '.exe' "$file"
4623 wrapper=$func_stripname_result
4630 if func_ltwrapper_script_p "$wrapper"; then
4634 func_source "$wrapper"
4636 # Check the variables that should have been set.
4637 test -z "$generated_by_libtool_version" && \
4638 func_fatal_error "invalid libtool wrapper script '$wrapper'"
4641 for lib in $notinst_deplibs; do
4642 # Check to see that each library is installed.
4644 if test -f "$lib"; then
4647 libfile=$libdir/`$ECHO "$lib" | $SED 's%^.*/%%g'`
4648 if test -n "$libdir" && test ! -f "$libfile"; then
4649 func_warning "'$lib' has not been installed in '$libdir'"
4655 func_source "$wrapper"
4658 if test no = "$fast_install" && test -n "$relink_command"; then
4661 tmpdir=`func_mktempdir`
4662 func_basename "$file$stripped_ext"
4663 file=$func_basename_result
4664 outputname=$tmpdir/$file
4665 # Replace the output file specification.
4666 relink_command=`$ECHO "$relink_command" | $SED 's%@OUTPUT@%'"$outputname"'%g'`
4669 func_quote_arg expand,pretty "$relink_command"
4670 eval "func_echo $func_quote_arg_result"
4672 if eval "$relink_command"; then :
4674 func_error "error: relink '$file' with the above command before installing it"
4675 $opt_dry_run || ${RM}r "$tmpdir"
4680 func_warning "cannot relink '$file'"
4684 # Install the binary that we compiled earlier.
4685 file=`$ECHO "$file$stripped_ext" | $SED "s%\([^/]*\)$%$objdir/\1%"`
4689 # remove .exe since cygwin /usr/bin/install will append another
4691 case $install_prog,$host in
4692 */usr/bin/install*,*cygwin*)
4693 case $file:$destfile in
4698 destfile=$destfile.exe
4701 func_stripname '' '.exe' "$destfile"
4702 destfile=$func_stripname_result
4707 func_show_eval "$install_prog\$stripme \$file \$destfile" 'exit $?'
4708 $opt_dry_run || if test -n "$outputname"; then
4715 for file in $staticlibs; do
4716 func_basename "$file"
4717 name=$func_basename_result
4719 # Set up the ranlib parameters.
4720 oldlib=$destdir/$name
4721 func_to_tool_file "$oldlib" func_convert_file_msys_to_w32
4722 tool_oldlib=$func_to_tool_file_result
4724 func_show_eval "$install_prog \$file \$oldlib" 'exit $?'
4726 if test -n "$stripme" && test -n "$old_striplib"; then
4727 func_show_eval "$old_striplib $tool_oldlib" 'exit $?'
4730 # Do each command in the postinstall commands.
4731 func_execute_cmds "$old_postinstall_cmds" 'exit $?'
4734 test -n "$future_libdirs" && \
4735 func_warning "remember to run '$progname --finish$future_libdirs'"
4737 if test -n "$current_libdirs"; then
4738 # Maybe just do a dry run.
4739 $opt_dry_run && current_libdirs=" -n$current_libdirs"
4740 exec_cmd='$SHELL "$progpath" $preserve_args --finish$current_libdirs'
4746 test install = "$opt_mode" && func_mode_install ${1+"$@"}
4749 # func_generate_dlsyms outputname originator pic_p
4750 # Extract symbols from dlprefiles and create ${outputname}S.o with
4751 # a dlpreopen symbol table.
4752 func_generate_dlsyms ()
4759 my_prefix=`$ECHO "$my_originator" | $SED 's%[^a-zA-Z0-9]%_%g'`
4762 if test -n "$dlfiles$dlprefiles" || test no != "$dlself"; then
4763 if test -n "$NM" && test -n "$global_symbol_pipe"; then
4764 my_dlsyms=${my_outputname}S.c
4766 func_error "not configured to extract global symbols from dlpreopened files"
4770 if test -n "$my_dlsyms"; then
4774 # Discover the nlist of each of the dlfiles.
4775 nlist=$output_objdir/$my_outputname.nm
4777 func_show_eval "$RM $nlist ${nlist}S ${nlist}T"
4779 # Parse the name list into a source file.
4780 func_verbose "creating $output_objdir/$my_dlsyms"
4782 $opt_dry_run || $ECHO > "$output_objdir/$my_dlsyms" "\
4783 /* $my_dlsyms - symbol resolution table for '$my_outputname' dlsym emulation. */
4784 /* Generated by $PROGRAM (GNU $PACKAGE) $VERSION */
4790 #if defined __GNUC__ && (((__GNUC__ == 4) && (__GNUC_MINOR__ >= 4)) || (__GNUC__ > 4))
4791 #pragma GCC diagnostic ignored \"-Wstrict-prototypes\"
4794 /* Keep this code in sync between libtool.m4, ltmain, lt_system.h, and tests. */
4795 #if defined _WIN32 || defined __CYGWIN__ || defined _WIN32_WCE
4796 /* DATA imports from DLLs on WIN32 can't be const, because runtime
4797 relocations are performed -- see ld's documentation on pseudo-relocs. */
4798 # define LT_DLSYM_CONST
4799 #elif defined __osf__
4800 /* This system does not cope well with relocations in const data. */
4801 # define LT_DLSYM_CONST
4803 # define LT_DLSYM_CONST const
4806 #define STREQ(s1, s2) (strcmp ((s1), (s2)) == 0)
4808 /* External symbol declarations for the compiler. */\
4811 if test yes = "$dlself"; then
4812 func_verbose "generating symbol list for '$output'"
4814 $opt_dry_run || echo ': @PROGRAM@ ' > "$nlist"
4816 # Add our own program objects to the symbol list.
4817 progfiles=`$ECHO "$objs$old_deplibs" | $SP2NL | $SED "$lo2o" | $NL2SP`
4818 for progfile in $progfiles; do
4819 func_to_tool_file "$progfile" func_convert_file_msys_to_w32
4820 func_verbose "extracting global C symbols from '$func_to_tool_file_result'"
4821 $opt_dry_run || eval "$NM $func_to_tool_file_result | $global_symbol_pipe >> '$nlist'"
4824 if test -n "$exclude_expsyms"; then
4826 eval '$EGREP -v " ($exclude_expsyms)$" "$nlist" > "$nlist"T'
4827 eval '$MV "$nlist"T "$nlist"'
4831 if test -n "$export_symbols_regex"; then
4833 eval '$EGREP -e "$export_symbols_regex" "$nlist" > "$nlist"T'
4834 eval '$MV "$nlist"T "$nlist"'
4838 # Prepare the list of exported symbols
4839 if test -z "$export_symbols"; then
4840 export_symbols=$output_objdir/$outputname.exp
4843 eval "$SED -n -e '/^: @PROGRAM@ $/d' -e 's/^.* \(.*\)$/\1/p' "'< "$nlist" > "$export_symbols"'
4845 *cygwin* | *mingw* | *cegcc* )
4846 eval "echo EXPORTS "'> "$output_objdir/$outputname.def"'
4847 eval 'cat "$export_symbols" >> "$output_objdir/$outputname.def"'
4853 eval "$SED -e 's/\([].[*^$]\)/\\\\\1/g' -e 's/^/ /' -e 's/$/$/'"' < "$export_symbols" > "$output_objdir/$outputname.exp"'
4854 eval '$GREP -f "$output_objdir/$outputname.exp" < "$nlist" > "$nlist"T'
4855 eval '$MV "$nlist"T "$nlist"'
4857 *cygwin* | *mingw* | *cegcc* )
4858 eval "echo EXPORTS "'> "$output_objdir/$outputname.def"'
4859 eval 'cat "$nlist" >> "$output_objdir/$outputname.def"'
4866 for dlprefile in $dlprefiles; do
4867 func_verbose "extracting global C symbols from '$dlprefile'"
4868 func_basename "$dlprefile"
4869 name=$func_basename_result
4871 *cygwin* | *mingw* | *cegcc* )
4872 # if an import library, we need to obtain dlname
4873 if func_win32_import_lib_p "$dlprefile"; then
4874 func_tr_sh "$dlprefile"
4875 eval "curr_lafile=\$libfile_$func_tr_sh_result"
4876 dlprefile_dlbasename=
4877 if test -n "$curr_lafile" && func_lalib_p "$curr_lafile"; then
4878 # Use subshell, to avoid clobbering current variable values
4879 dlprefile_dlname=`source "$curr_lafile" && echo "$dlname"`
4880 if test -n "$dlprefile_dlname"; then
4881 func_basename "$dlprefile_dlname"
4882 dlprefile_dlbasename=$func_basename_result
4884 # no lafile. user explicitly requested -dlpreopen <import library>.
4885 $sharedlib_from_linklib_cmd "$dlprefile"
4886 dlprefile_dlbasename=$sharedlib_from_linklib_result
4890 if test -n "$dlprefile_dlbasename"; then
4891 eval '$ECHO ": $dlprefile_dlbasename" >> "$nlist"'
4893 func_warning "Could not compute DLL name from $name"
4894 eval '$ECHO ": $name " >> "$nlist"'
4896 func_to_tool_file "$dlprefile" func_convert_file_msys_to_w32
4897 eval "$NM \"$func_to_tool_file_result\" 2>/dev/null | $global_symbol_pipe |
4898 $SED -e '/I __imp/d' -e 's/I __nm_/D /;s/_nm__//' >> '$nlist'"
4900 else # not an import lib
4902 eval '$ECHO ": $name " >> "$nlist"'
4903 func_to_tool_file "$dlprefile" func_convert_file_msys_to_w32
4904 eval "$NM \"$func_to_tool_file_result\" 2>/dev/null | $global_symbol_pipe >> '$nlist'"
4910 eval '$ECHO ": $name " >> "$nlist"'
4911 func_to_tool_file "$dlprefile" func_convert_file_msys_to_w32
4912 eval "$NM \"$func_to_tool_file_result\" 2>/dev/null | $global_symbol_pipe >> '$nlist'"
4919 # Make sure we have at least an empty file.
4920 test -f "$nlist" || : > "$nlist"
4922 if test -n "$exclude_expsyms"; then
4923 $EGREP -v " ($exclude_expsyms)$" "$nlist" > "$nlist"T
4924 $MV "$nlist"T "$nlist"
4927 # Try sorting and uniquifying the output.
4928 if $GREP -v "^: " < "$nlist" |
4929 if sort -k 3 </dev/null >/dev/null 2>&1; then
4934 uniq > "$nlist"S; then
4937 $GREP -v "^: " < "$nlist" > "$nlist"S
4940 if test -f "$nlist"S; then
4941 eval "$global_symbol_to_cdecl"' < "$nlist"S >> "$output_objdir/$my_dlsyms"'
4943 echo '/* NONE */' >> "$output_objdir/$my_dlsyms"
4946 func_show_eval '$RM "${nlist}I"'
4947 if test -n "$global_symbol_to_import"; then
4948 eval "$global_symbol_to_import"' < "$nlist"S > "$nlist"I'
4951 echo >> "$output_objdir/$my_dlsyms" "\
4953 /* The mapping between symbol names and symbols. */
4958 extern LT_DLSYM_CONST lt_dlsymlist
4959 lt_${my_prefix}_LTX_preloaded_symbols[];\
4962 if test -s "$nlist"I; then
4963 echo >> "$output_objdir/$my_dlsyms" "\
4964 static void lt_syminit(void)
4966 LT_DLSYM_CONST lt_dlsymlist *symbol = lt_${my_prefix}_LTX_preloaded_symbols;
4967 for (; symbol->name; ++symbol)
4969 $SED 's/.*/ if (STREQ (symbol->name, \"&\")) symbol->address = (void *) \&&;/' < "$nlist"I >> "$output_objdir/$my_dlsyms"
4970 echo >> "$output_objdir/$my_dlsyms" "\
4974 echo >> "$output_objdir/$my_dlsyms" "\
4975 LT_DLSYM_CONST lt_dlsymlist
4976 lt_${my_prefix}_LTX_preloaded_symbols[] =
4977 { {\"$my_originator\", (void *) 0},"
4979 if test -s "$nlist"I; then
4980 echo >> "$output_objdir/$my_dlsyms" "\
4981 {\"@INIT@\", (void *) <_syminit},"
4984 case $need_lib_prefix in
4986 eval "$global_symbol_to_c_name_address" < "$nlist" >> "$output_objdir/$my_dlsyms"
4989 eval "$global_symbol_to_c_name_address_lib_prefix" < "$nlist" >> "$output_objdir/$my_dlsyms"
4992 echo >> "$output_objdir/$my_dlsyms" "\
4996 /* This works around a problem in FreeBSD linker */
4997 #ifdef FREEBSD_WORKAROUND
4998 static const void *lt_preloaded_setup() {
4999 return lt_${my_prefix}_LTX_preloaded_symbols;
5009 pic_flag_for_symtable=
5010 case "$compile_command " in
5014 # compiling the symbol table file with pic_flag works around
5015 # a FreeBSD bug that causes programs to crash when -lm is
5016 # linked before any other PIC object. But we must not use
5017 # pic_flag when linking with -static. The problem exists in
5018 # FreeBSD 2.2.6 and is fixed in FreeBSD 3.1.
5019 *-*-freebsd2.*|*-*-freebsd3.0*|*-*-freebsdelf3.0*)
5020 pic_flag_for_symtable=" $pic_flag -DFREEBSD_WORKAROUND" ;;
5022 pic_flag_for_symtable=" $pic_flag" ;;
5024 $my_pic_p && pic_flag_for_symtable=" $pic_flag"
5030 for arg in $LTCFLAGS; do
5032 -pie | -fpie | -fPIE) ;;
5033 *) func_append symtab_cflags " $arg" ;;
5037 # Now compile the dynamic symbol file.
5038 func_show_eval '(cd $output_objdir && $LTCC$symtab_cflags -c$no_builtin_flag$pic_flag_for_symtable "$my_dlsyms")' 'exit $?'
5040 # Clean up the generated files.
5041 func_show_eval '$RM "$output_objdir/$my_dlsyms" "$nlist" "${nlist}S" "${nlist}T" "${nlist}I"'
5043 # Transform the symbol file into the correct name.
5044 symfileobj=$output_objdir/${my_outputname}S.$objext
5046 *cygwin* | *mingw* | *cegcc* )
5047 if test -f "$output_objdir/$my_outputname.def"; then
5048 compile_command=`$ECHO "$compile_command" | $SED "s%@SYMFILE@%$output_objdir/$my_outputname.def $symfileobj%"`
5049 finalize_command=`$ECHO "$finalize_command" | $SED "s%@SYMFILE@%$output_objdir/$my_outputname.def $symfileobj%"`
5051 compile_command=`$ECHO "$compile_command" | $SED "s%@SYMFILE@%$symfileobj%"`
5052 finalize_command=`$ECHO "$finalize_command" | $SED "s%@SYMFILE@%$symfileobj%"`
5056 compile_command=`$ECHO "$compile_command" | $SED "s%@SYMFILE@%$symfileobj%"`
5057 finalize_command=`$ECHO "$finalize_command" | $SED "s%@SYMFILE@%$symfileobj%"`
5062 func_fatal_error "unknown suffix for '$my_dlsyms'"
5066 # We keep going just in case the user didn't refer to
5067 # lt_preloaded_symbols. The linker will fail if global_symbol_pipe
5068 # really was required.
5070 # Nullify the symbol file.
5071 compile_command=`$ECHO "$compile_command" | $SED "s% @SYMFILE@%%"`
5072 finalize_command=`$ECHO "$finalize_command" | $SED "s% @SYMFILE@%%"`
5076 # func_cygming_gnu_implib_p ARG
5077 # This predicate returns with zero status (TRUE) if
5078 # ARG is a GNU/binutils-style import library. Returns
5079 # with nonzero status (FALSE) otherwise.
5080 func_cygming_gnu_implib_p ()
5084 func_to_tool_file "$1" func_convert_file_msys_to_w32
5085 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)$'`
5086 test -n "$func_cygming_gnu_implib_tmp"
5089 # func_cygming_ms_implib_p ARG
5090 # This predicate returns with zero status (TRUE) if
5091 # ARG is an MS-style import library. Returns
5092 # with nonzero status (FALSE) otherwise.
5093 func_cygming_ms_implib_p ()
5097 func_to_tool_file "$1" func_convert_file_msys_to_w32
5098 func_cygming_ms_implib_tmp=`$NM "$func_to_tool_file_result" | eval "$global_symbol_pipe" | $GREP '_NULL_IMPORT_DESCRIPTOR'`
5099 test -n "$func_cygming_ms_implib_tmp"
5102 # func_win32_libid arg
5103 # return the library type of file 'arg'
5105 # Need a lot of goo to handle *both* DLLs and import libs
5106 # Has to be a shell function in order to 'eat' the argument
5107 # that is supplied when $file_magic_command is called.
5108 # Despite the name, also deal with 64 bit binaries.
5113 win32_libid_type=unknown
5114 win32_fileres=`file -L $1 2>/dev/null`
5115 case $win32_fileres in
5116 *ar\ archive\ import\ library*) # definitely import
5117 win32_libid_type="x86 archive import"
5119 *ar\ archive*) # could be an import, or static
5120 # Keep the egrep pattern in sync with the one in _LT_CHECK_MAGIC_METHOD.
5121 if eval $OBJDUMP -f $1 | $SED -e '10q' 2>/dev/null |
5122 $EGREP 'file format (pei*-i386(.*architecture: i386)?|pe-arm-wince|pe-x86-64)' >/dev/null; then
5123 case $nm_interface in
5125 if func_cygming_ms_implib_p "$1" ||
5126 func_cygming_gnu_implib_p "$1"
5134 func_to_tool_file "$1" func_convert_file_msys_to_w32
5135 win32_nmres=`eval $NM -f posix -A \"$func_to_tool_file_result\" |
5146 case $win32_nmres in
5147 import*) win32_libid_type="x86 archive import";;
5148 *) win32_libid_type="x86 archive static";;
5153 win32_libid_type="x86 DLL"
5155 *executable*) # but shell scripts are "executable" too...
5156 case $win32_fileres in
5157 *MS\ Windows\ PE\ Intel*)
5158 win32_libid_type="x86 DLL"
5163 $ECHO "$win32_libid_type"
5166 # func_cygming_dll_for_implib ARG
5168 # Platform-specific function to extract the
5169 # name of the DLL associated with the specified
5170 # import library ARG.
5171 # Invoked by eval'ing the libtool variable
5172 # $sharedlib_from_linklib_cmd
5173 # Result is available in the variable
5174 # $sharedlib_from_linklib_result
5175 func_cygming_dll_for_implib ()
5179 sharedlib_from_linklib_result=`$DLLTOOL --identify-strict --identify "$1"`
5182 # func_cygming_dll_for_implib_fallback_core SECTION_NAME LIBNAMEs
5184 # The is the core of a fallback implementation of a
5185 # platform-specific function to extract the name of the
5186 # DLL associated with the specified import library LIBNAME.
5188 # SECTION_NAME is either .idata$6 or .idata$7, depending
5189 # on the platform and compiler that created the implib.
5191 # Echos the name of the DLL associated with the
5192 # specified import library.
5193 func_cygming_dll_for_implib_fallback_core ()
5197 match_literal=`$ECHO "$1" | $SED "$sed_make_literal_regex"`
5198 $OBJDUMP -s --section "$1" "$2" 2>/dev/null |
5199 $SED '/^Contents of section '"$match_literal"':/{
5200 # Place marker at beginning of archive member dllname section
5205 # These lines can sometimes be longer than 43 characters, but
5206 # are always uninteresting
5207 /:[ ]*file format pe[i]\{,1\}-/d
5208 /^In archive [^:]*:/d
5209 # Ensure marker is printed
5211 # Remove all lines with less than 43 characters
5213 # From remaining lines, remove first 43 characters
5216 # Join marker and all lines until next marker into a single line
5217 /^====MARK====/ b para
5226 # Remove trailing dots and whitespace
5230 # we now have a list, one entry per line, of the stringified
5231 # contents of the appropriate section of all members of the
5232 # archive that possess that section. Heuristic: eliminate
5233 # all those that have a first or second character that is
5234 # a '.' (that is, objdump's representation of an unprintable
5235 # character.) This should work for all archives with less than
5236 # 0x302f exports -- but will fail for DLLs whose name actually
5237 # begins with a literal '.' or a single character followed by
5240 # Of those that remain, print the first one.
5241 $SED -e '/^\./d;/^.\./d;q'
5244 # func_cygming_dll_for_implib_fallback ARG
5245 # Platform-specific function to extract the
5246 # name of the DLL associated with the specified
5247 # import library ARG.
5249 # This fallback implementation is for use when $DLLTOOL
5250 # does not support the --identify-strict option.
5251 # Invoked by eval'ing the libtool variable
5252 # $sharedlib_from_linklib_cmd
5253 # Result is available in the variable
5254 # $sharedlib_from_linklib_result
5255 func_cygming_dll_for_implib_fallback ()
5259 if func_cygming_gnu_implib_p "$1"; then
5260 # binutils import library
5261 sharedlib_from_linklib_result=`func_cygming_dll_for_implib_fallback_core '.idata$7' "$1"`
5262 elif func_cygming_ms_implib_p "$1"; then
5263 # ms-generated import library
5264 sharedlib_from_linklib_result=`func_cygming_dll_for_implib_fallback_core '.idata$6' "$1"`
5267 sharedlib_from_linklib_result=
5272 # func_extract_an_archive dir oldlib
5273 func_extract_an_archive ()
5277 f_ex_an_ar_dir=$1; shift
5278 f_ex_an_ar_oldlib=$1
5279 if test yes = "$lock_old_archive_extraction"; then
5280 lockfile=$f_ex_an_ar_oldlib.lock
5281 until $opt_dry_run || ln "$progpath" "$lockfile" 2>/dev/null; do
5282 func_echo "Waiting for $lockfile to be removed"
5286 func_show_eval "(cd \$f_ex_an_ar_dir && $AR x \"\$f_ex_an_ar_oldlib\")" \
5287 'stat=$?; rm -f "$lockfile"; exit $stat'
5288 if test yes = "$lock_old_archive_extraction"; then
5289 $opt_dry_run || rm -f "$lockfile"
5291 if ($AR t "$f_ex_an_ar_oldlib" | sort | sort -uc >/dev/null 2>&1); then
5294 func_fatal_error "object name conflicts in archive: $f_ex_an_ar_dir/$f_ex_an_ar_oldlib"
5299 # func_extract_archives gentop oldlib ...
5300 func_extract_archives ()
5305 my_oldlibs=${1+"$@"}
5311 for my_xlib in $my_oldlibs; do
5312 # Extract the objects.
5314 [\\/]* | [A-Za-z]:[\\/]*) my_xabs=$my_xlib ;;
5315 *) my_xabs=`pwd`"/$my_xlib" ;;
5317 func_basename "$my_xlib"
5318 my_xlib=$func_basename_result
5321 case " $extracted_archives " in
5323 func_arith $extracted_serial + 1
5324 extracted_serial=$func_arith_result
5325 my_xlib_u=lt$extracted_serial-$my_xlib ;;
5329 extracted_archives="$extracted_archives $my_xlib_u"
5330 my_xdir=$my_gentop/$my_xlib_u
5332 func_mkdir_p "$my_xdir"
5336 func_verbose "Extracting $my_xabs"
5337 # Do not bother doing anything if just a dry run
5339 darwin_orig_dir=`pwd`
5340 cd $my_xdir || exit $?
5341 darwin_archive=$my_xabs
5343 func_basename "$darwin_archive"
5344 darwin_base_archive=$func_basename_result
5345 darwin_arches=`$LIPO -info "$darwin_archive" 2>/dev/null | $GREP Architectures 2>/dev/null || true`
5346 if test -n "$darwin_arches"; then
5347 darwin_arches=`$ECHO "$darwin_arches" | $SED -e 's/.*are://'`
5349 func_verbose "$darwin_base_archive has multiple architectures $darwin_arches"
5350 for darwin_arch in $darwin_arches; do
5351 func_mkdir_p "unfat-$$/$darwin_base_archive-$darwin_arch"
5352 $LIPO -thin $darwin_arch -output "unfat-$$/$darwin_base_archive-$darwin_arch/$darwin_base_archive" "$darwin_archive"
5353 cd "unfat-$$/$darwin_base_archive-$darwin_arch"
5354 func_extract_an_archive "`pwd`" "$darwin_base_archive"
5356 $RM "unfat-$$/$darwin_base_archive-$darwin_arch/$darwin_base_archive"
5357 done # $darwin_arches
5358 ## Okay now we've a bunch of thin objects, gotta fatten them up :)
5359 darwin_filelist=`find unfat-$$ -type f -name \*.o -print -o -name \*.lo -print | $SED -e "$sed_basename" | sort -u`
5362 for darwin_file in $darwin_filelist; do
5363 darwin_files=`find unfat-$$ -name $darwin_file -print | sort | $NL2SP`
5364 $LIPO -create -output "$darwin_file" $darwin_files
5365 done # $darwin_filelist
5367 cd "$darwin_orig_dir"
5370 func_extract_an_archive "$my_xdir" "$my_xabs"
5375 func_extract_an_archive "$my_xdir" "$my_xabs"
5378 my_oldobjs="$my_oldobjs "`find $my_xdir -name \*.$objext -print -o -name \*.lo -print | sort | $NL2SP`
5381 func_extract_archives_result=$my_oldobjs
5385 # func_emit_wrapper [arg=no]
5387 # Emit a libtool wrapper script on stdout.
5388 # Don't directly open a file because we may want to
5389 # incorporate the script contents within a cygwin/mingw
5390 # wrapper executable. Must ONLY be called from within
5391 # func_mode_link because it depends on a number of variables
5394 # ARG is the value that the WRAPPER_SCRIPT_BELONGS_IN_OBJDIR
5395 # variable will take. If 'yes', then the emitted script
5396 # will assume that the directory where it is stored is
5397 # the $objdir directory. This is a cygwin/mingw-specific
5399 func_emit_wrapper ()
5401 func_emit_wrapper_arg1=${1-no}
5406 # $output - temporary wrapper script for $objdir/$outputname
5407 # Generated by $PROGRAM (GNU $PACKAGE) $VERSION
5409 # The $output program cannot be directly executed until all the libtool
5410 # libraries that it depends on are installed.
5412 # This wrapper script should never be moved out of the build directory.
5413 # If it is, it will not operate correctly.
5415 # Sed substitution that helps us do robust quoting. It backslashifies
5416 # metacharacters that are still active within double-quoted strings.
5417 sed_quote_subst='$sed_quote_subst'
5419 # Be Bourne compatible
5420 if test -n \"\${ZSH_VERSION+set}\" && (emulate sh) >/dev/null 2>&1; then
5423 # Zsh 3.x and 4.x performs word splitting on \${1+\"\$@\"}, which
5424 # is contrary to our usage. Disable this feature.
5425 alias -g '\${1+\"\$@\"}'='\"\$@\"'
5426 setopt NO_GLOB_SUBST
5428 case \`(set -o) 2>/dev/null\` in *posix*) set -o posix;; esac
5430 BIN_SH=xpg4; export BIN_SH # for Tru64
5431 DUALCASE=1; export DUALCASE # for MKS sh
5433 # The HP-UX ksh and POSIX shell print the target directory to stdout
5435 (unset CDPATH) >/dev/null 2>&1 && unset CDPATH
5437 relink_command=\"$relink_command\"
5439 # This environment variable determines our operation mode.
5440 if test \"\$libtool_install_magic\" = \"$magic\"; then
5441 # install mode needs the following variables:
5442 generated_by_libtool_version='$macro_version'
5443 notinst_deplibs='$notinst_deplibs'
5445 # When we are sourced in execute mode, \$file and \$ECHO are already set.
5446 if test \"\$libtool_execute_magic\" != \"$magic\"; then
5449 func_quote_arg pretty "$ECHO"
5450 qECHO=$func_quote_arg_result
5453 # A function that is used when there is no print builtin or printf.
5454 func_fallback_echo ()
5456 eval 'cat <<_LTECHO_EOF
5463 # Very basic option parsing. These options are (a) specific to
5464 # the libtool wrapper, (b) are identical between the wrapper
5465 # /script/ and the wrapper /executable/ that is used only on
5466 # windows platforms, and (c) all begin with the string "--lt-"
5467 # (application programs are unlikely to have options that match
5470 # There are only two supported options: --lt-debug and
5471 # --lt-dump-script. There is, deliberately, no --lt-help.
5473 # The first argument to this parsing function should be the
5474 # script's $0 value, followed by "$@".
5476 func_parse_lt_options ()
5482 case \"\$lt_opt\" in
5483 --lt-debug) lt_option_debug=1 ;;
5485 lt_dump_D=\`\$ECHO \"X\$lt_script_arg0\" | $SED -e 's/^X//' -e 's%/[^/]*$%%'\`
5486 test \"X\$lt_dump_D\" = \"X\$lt_script_arg0\" && lt_dump_D=.
5487 lt_dump_F=\`\$ECHO \"X\$lt_script_arg0\" | $SED -e 's/^X//' -e 's%^.*/%%'\`
5488 cat \"\$lt_dump_D/\$lt_dump_F\"
5492 \$ECHO \"Unrecognized --lt- option: '\$lt_opt'\" 1>&2
5498 # Print the debug banner immediately:
5499 if test -n \"\$lt_option_debug\"; then
5500 echo \"$outputname:$output:\$LINENO: libtool wrapper (GNU $PACKAGE) $VERSION\" 1>&2
5504 # Used when --lt-debug. Prints its arguments to stdout
5505 # (redirection is the responsibility of the caller)
5506 func_lt_dump_args ()
5511 \$ECHO \"$outputname:$output:\$LINENO: newargv[\$lt_dump_args_N]: \$lt_arg\"
5512 lt_dump_args_N=\`expr \$lt_dump_args_N + 1\`
5516 # Core function for launching the target application
5517 func_exec_program_core ()
5521 # Backslashes separate directories on plain windows
5522 *-*-mingw | *-*-os2* | *-cegcc*)
5524 if test -n \"\$lt_option_debug\"; then
5525 \$ECHO \"$outputname:$output:\$LINENO: newargv[0]: \$progdir\\\\\$program\" 1>&2
5526 func_lt_dump_args \${1+\"\$@\"} 1>&2
5528 exec \"\$progdir\\\\\$program\" \${1+\"\$@\"}
5534 if test -n \"\$lt_option_debug\"; then
5535 \$ECHO \"$outputname:$output:\$LINENO: newargv[0]: \$progdir/\$program\" 1>&2
5536 func_lt_dump_args \${1+\"\$@\"} 1>&2
5538 exec \"\$progdir/\$program\" \${1+\"\$@\"}
5543 \$ECHO \"\$0: cannot exec \$program \$*\" 1>&2
5547 # A function to encapsulate launching the target application
5548 # Strips options in the --lt-* namespace from \$@ and
5549 # launches target application with the remaining arguments.
5550 func_exec_program ()
5558 *) set x \"\$@\" \"\$lt_wr_arg\"; shift;;
5563 func_exec_program_core \${1+\"\$@\"}
5567 func_parse_lt_options \"\$0\" \${1+\"\$@\"}
5569 # Find the directory that this script lives in.
5570 thisdir=\`\$ECHO \"\$file\" | $SED 's%/[^/]*$%%'\`
5571 test \"x\$thisdir\" = \"x\$file\" && thisdir=.
5573 # Follow symbolic links until we get to the real thisdir.
5574 file=\`ls -ld \"\$file\" | $SED -n 's/.*-> //p'\`
5575 while test -n \"\$file\"; do
5576 destdir=\`\$ECHO \"\$file\" | $SED 's%/[^/]*\$%%'\`
5578 # If there was a directory component, then change thisdir.
5579 if test \"x\$destdir\" != \"x\$file\"; then
5580 case \"\$destdir\" in
5581 [\\\\/]* | [A-Za-z]:[\\\\/]*) thisdir=\"\$destdir\" ;;
5582 *) thisdir=\"\$thisdir/\$destdir\" ;;
5586 file=\`\$ECHO \"\$file\" | $SED 's%^.*/%%'\`
5587 file=\`ls -ld \"\$thisdir/\$file\" | $SED -n 's/.*-> //p'\`
5590 # Usually 'no', except on cygwin/mingw when embedded into
5592 WRAPPER_SCRIPT_BELONGS_IN_OBJDIR=$func_emit_wrapper_arg1
5593 if test \"\$WRAPPER_SCRIPT_BELONGS_IN_OBJDIR\" = \"yes\"; then
5594 # special case for '.'
5595 if test \"\$thisdir\" = \".\"; then
5598 # remove .libs from thisdir
5599 case \"\$thisdir\" in
5600 *[\\\\/]$objdir ) thisdir=\`\$ECHO \"\$thisdir\" | $SED 's%[\\\\/][^\\\\/]*$%%'\` ;;
5601 $objdir ) thisdir=. ;;
5605 # Try to get the absolute directory name.
5606 absdir=\`cd \"\$thisdir\" && pwd\`
5607 test -n \"\$absdir\" && thisdir=\"\$absdir\"
5610 if test yes = "$fast_install"; then
5612 program=lt-'$outputname'$exeext
5613 progdir=\"\$thisdir/$objdir\"
5615 if test ! -f \"\$progdir/\$program\" ||
5616 { file=\`ls -1dt \"\$progdir/\$program\" \"\$progdir/../\$program\" 2>/dev/null | $SED 1q\`; \\
5617 test \"X\$file\" != \"X\$progdir/\$program\"; }; then
5619 file=\"\$\$-\$program\"
5621 if test ! -d \"\$progdir\"; then
5622 $MKDIR \"\$progdir\"
5624 $RM \"\$progdir/\$file\"
5629 # relink executable if necessary
5630 if test -n \"\$relink_command\"; then
5631 if relink_command_output=\`eval \$relink_command 2>&1\`; then :
5633 \$ECHO \"\$relink_command_output\" >&2
5634 $RM \"\$progdir/\$file\"
5639 $MV \"\$progdir/\$file\" \"\$progdir/\$program\" 2>/dev/null ||
5640 { $RM \"\$progdir/\$program\";
5641 $MV \"\$progdir/\$file\" \"\$progdir/\$program\"; }
5642 $RM \"\$progdir/\$file\"
5646 program='$outputname'
5647 progdir=\"\$thisdir/$objdir\"
5653 if test -f \"\$progdir/\$program\"; then"
5655 # fixup the dll searchpath if we need to.
5657 # Fix the DLL searchpath if we need to. Do this before prepending
5658 # to shlibpath, because on Windows, both are PATH and uninstalled
5659 # libraries must come first.
5660 if test -n "$dllsearchpath"; then
5662 # Add the dll search path components to the executable PATH
5663 PATH=$dllsearchpath:\$PATH
5667 # Export our shlibpath_var if we have one.
5668 if test yes = "$shlibpath_overrides_runpath" && test -n "$shlibpath_var" && test -n "$temp_rpath"; then
5670 # Add our own library path to $shlibpath_var
5671 $shlibpath_var=\"$temp_rpath\$$shlibpath_var\"
5673 # Some systems cannot cope with colon-terminated $shlibpath_var
5674 # The second colon is a workaround for a bug in BeOS R4 sed
5675 $shlibpath_var=\`\$ECHO \"\$$shlibpath_var\" | $SED 's/::*\$//'\`
5677 export $shlibpath_var
5682 if test \"\$libtool_execute_magic\" != \"$magic\"; then
5683 # Run the actual program with our arguments.
5684 func_exec_program \${1+\"\$@\"}
5687 # The program doesn't exist.
5688 \$ECHO \"\$0: error: '\$progdir/\$program' does not exist\" 1>&2
5689 \$ECHO \"This script is just a wrapper for \$program.\" 1>&2
5690 \$ECHO \"See the $PACKAGE documentation for more information.\" 1>&2
5698 # func_emit_cwrapperexe_src
5699 # emit the source code for a wrapper executable on stdout
5700 # Must ONLY be called from within func_mode_link because
5701 # it depends on a number of variable set therein.
5702 func_emit_cwrapperexe_src ()
5706 /* $cwrappersource - temporary wrapper executable for $objdir/$outputname
5707 Generated by $PROGRAM (GNU $PACKAGE) $VERSION
5709 The $output program cannot be directly executed until all the libtool
5710 libraries that it depends on are installed.
5712 This wrapper executable should never be moved out of the build directory.
5713 If it is, it will not operate correctly.
5718 # define _CRT_SECURE_NO_DEPRECATE 1
5723 # include <direct.h>
5724 # include <process.h>
5727 # include <unistd.h>
5728 # include <stdint.h>
5740 #include <sys/stat.h>
5742 #define STREQ(s1, s2) (strcmp ((s1), (s2)) == 0)
5744 /* declarations of non-ANSI functions */
5745 #if defined __MINGW32__
5746 # ifdef __STRICT_ANSI__
5747 int _putenv (const char *);
5749 #elif defined __CYGWIN__
5750 # ifdef __STRICT_ANSI__
5751 char *realpath (const char *, char *);
5752 int putenv (char *);
5753 int setenv (const char *, const char *, int);
5755 /* #elif defined other_platform || defined ... */
5758 /* portability defines, excluding path handling macros */
5759 #if defined _MSC_VER
5760 # define setmode _setmode
5762 # define chmod _chmod
5763 # define getcwd _getcwd
5764 # define putenv _putenv
5765 # define S_IXUSR _S_IEXEC
5766 #elif defined __MINGW32__
5767 # define setmode _setmode
5769 # define chmod _chmod
5770 # define getcwd _getcwd
5771 # define putenv _putenv
5772 #elif defined __CYGWIN__
5773 # define HAVE_SETENV
5774 # define FOPEN_WB "wb"
5775 /* #elif defined other platforms ... */
5778 #if defined PATH_MAX
5779 # define LT_PATHMAX PATH_MAX
5780 #elif defined MAXPATHLEN
5781 # define LT_PATHMAX MAXPATHLEN
5783 # define LT_PATHMAX 1024
5793 /* path handling portability macros */
5794 #ifndef DIR_SEPARATOR
5795 # define DIR_SEPARATOR '/'
5796 # define PATH_SEPARATOR ':'
5799 #if defined _WIN32 || defined __MSDOS__ || defined __DJGPP__ || \
5801 # define HAVE_DOS_BASED_FILE_SYSTEM
5802 # define FOPEN_WB "wb"
5803 # ifndef DIR_SEPARATOR_2
5804 # define DIR_SEPARATOR_2 '\\'
5806 # ifndef PATH_SEPARATOR_2
5807 # define PATH_SEPARATOR_2 ';'
5811 #ifndef DIR_SEPARATOR_2
5812 # define IS_DIR_SEPARATOR(ch) ((ch) == DIR_SEPARATOR)
5813 #else /* DIR_SEPARATOR_2 */
5814 # define IS_DIR_SEPARATOR(ch) \
5815 (((ch) == DIR_SEPARATOR) || ((ch) == DIR_SEPARATOR_2))
5816 #endif /* DIR_SEPARATOR_2 */
5818 #ifndef PATH_SEPARATOR_2
5819 # define IS_PATH_SEPARATOR(ch) ((ch) == PATH_SEPARATOR)
5820 #else /* PATH_SEPARATOR_2 */
5821 # define IS_PATH_SEPARATOR(ch) ((ch) == PATH_SEPARATOR_2)
5822 #endif /* PATH_SEPARATOR_2 */
5825 # define FOPEN_WB "w"
5828 # define _O_BINARY 0
5831 #define XMALLOC(type, num) ((type *) xmalloc ((num) * sizeof(type)))
5832 #define XFREE(stale) do { \
5833 if (stale) { free (stale); stale = 0; } \
5836 #if defined LT_DEBUGWRAPPER
5837 static int lt_debug = 1;
5839 static int lt_debug = 0;
5842 const char *program_name = "libtool-wrapper"; /* in case xstrdup fails */
5844 void *xmalloc (size_t num);
5845 char *xstrdup (const char *string);
5846 const char *base_name (const char *name);
5847 char *find_executable (const char *wrapper);
5848 char *chase_symlinks (const char *pathspec);
5849 int make_executable (const char *path);
5850 int check_executable (const char *path);
5851 char *strendzap (char *str, const char *pat);
5852 void lt_debugprintf (const char *file, int line, const char *fmt, ...);
5853 void lt_fatal (const char *file, int line, const char *message, ...);
5854 static const char *nonnull (const char *s);
5855 static const char *nonempty (const char *s);
5856 void lt_setenv (const char *name, const char *value);
5857 char *lt_extend_str (const char *orig_value, const char *add, int to_end);
5858 void lt_update_exe_path (const char *name, const char *value);
5859 void lt_update_lib_path (const char *name, const char *value);
5860 char **prepare_spawn (char **argv);
5861 void lt_dump_script (FILE *f);
5865 #if __GNUC__ < 4 || (__GNUC__ == 4 && __GNUC_MINOR__ < 5)
5866 # define externally_visible volatile
5868 # define externally_visible __attribute__((externally_visible)) volatile
5870 externally_visible const char * MAGIC_EXE = "$magic_exe";
5871 const char * LIB_PATH_VARNAME = "$shlibpath_var";
5874 if test yes = "$shlibpath_overrides_runpath" && test -n "$shlibpath_var" && test -n "$temp_rpath"; then
5875 func_to_host_path "$temp_rpath"
5877 const char * LIB_PATH_VALUE = "$func_to_host_path_result";
5881 const char * LIB_PATH_VALUE = "";
5885 if test -n "$dllsearchpath"; then
5886 func_to_host_path "$dllsearchpath:"
5888 const char * EXE_PATH_VARNAME = "PATH";
5889 const char * EXE_PATH_VALUE = "$func_to_host_path_result";
5893 const char * EXE_PATH_VARNAME = "";
5894 const char * EXE_PATH_VALUE = "";
5898 if test yes = "$fast_install"; then
5900 const char * TARGET_PROGRAM_NAME = "lt-$outputname"; /* hopefully, no .exe */
5904 const char * TARGET_PROGRAM_NAME = "$outputname"; /* hopefully, no .exe */
5911 #define LTWRAPPER_OPTION_PREFIX "--lt-"
5913 static const char *ltwrapper_option_prefix = LTWRAPPER_OPTION_PREFIX;
5914 static const char *dumpscript_opt = LTWRAPPER_OPTION_PREFIX "dump-script";
5915 static const char *debug_opt = LTWRAPPER_OPTION_PREFIX "debug";
5918 main (int argc, char *argv[])
5923 char *actual_cwrapper_path;
5924 char *actual_cwrapper_name;
5931 program_name = (char *) xstrdup (base_name (argv[0]));
5932 newargz = XMALLOC (char *, (size_t) argc + 1);
5934 /* very simple arg parsing; don't want to rely on getopt
5935 * also, copy all non cwrapper options to newargz, except
5936 * argz[0], which is handled differently
5939 for (i = 1; i < argc; i++)
5941 if (STREQ (argv[i], dumpscript_opt))
5945 *mingw* | *cygwin* )
5946 # make stdout use "unix" line endings
5947 echo " setmode(1,_O_BINARY);"
5952 lt_dump_script (stdout);
5955 if (STREQ (argv[i], debug_opt))
5960 if (STREQ (argv[i], ltwrapper_option_prefix))
5962 /* however, if there is an option in the LTWRAPPER_OPTION_PREFIX
5963 namespace, but it is not one of the ones we know about and
5964 have already dealt with, above (inluding dump-script), then
5965 report an error. Otherwise, targets might begin to believe
5966 they are allowed to use options in the LTWRAPPER_OPTION_PREFIX
5967 namespace. The first time any user complains about this, we'll
5968 need to make LTWRAPPER_OPTION_PREFIX a configure-time option
5969 or a configure.ac-settable value.
5971 lt_fatal (__FILE__, __LINE__,
5972 "unrecognized %s option: '%s'",
5973 ltwrapper_option_prefix, argv[i]);
5976 newargz[++newargc] = xstrdup (argv[i]);
5978 newargz[++newargc] = NULL;
5982 /* The GNU banner must be the first non-error debug message */
5983 lt_debugprintf (__FILE__, __LINE__, "libtool wrapper (GNU $PACKAGE) $VERSION\n");
5986 lt_debugprintf (__FILE__, __LINE__, "(main) argv[0]: %s\n", argv[0]);
5987 lt_debugprintf (__FILE__, __LINE__, "(main) program_name: %s\n", program_name);
5989 tmp_pathspec = find_executable (argv[0]);
5990 if (tmp_pathspec == NULL)
5991 lt_fatal (__FILE__, __LINE__, "couldn't find %s", argv[0]);
5992 lt_debugprintf (__FILE__, __LINE__,
5993 "(main) found exe (before symlink chase) at: %s\n",
5996 actual_cwrapper_path = chase_symlinks (tmp_pathspec);
5997 lt_debugprintf (__FILE__, __LINE__,
5998 "(main) found exe (after symlink chase) at: %s\n",
5999 actual_cwrapper_path);
6000 XFREE (tmp_pathspec);
6002 actual_cwrapper_name = xstrdup (base_name (actual_cwrapper_path));
6003 strendzap (actual_cwrapper_path, actual_cwrapper_name);
6005 /* wrapper name transforms */
6006 strendzap (actual_cwrapper_name, ".exe");
6007 tmp_pathspec = lt_extend_str (actual_cwrapper_name, ".exe", 1);
6008 XFREE (actual_cwrapper_name);
6009 actual_cwrapper_name = tmp_pathspec;
6012 /* target_name transforms -- use actual target program name; might have lt- prefix */
6013 target_name = xstrdup (base_name (TARGET_PROGRAM_NAME));
6014 strendzap (target_name, ".exe");
6015 tmp_pathspec = lt_extend_str (target_name, ".exe", 1);
6016 XFREE (target_name);
6017 target_name = tmp_pathspec;
6020 lt_debugprintf (__FILE__, __LINE__,
6021 "(main) libtool target name: %s\n",
6027 XMALLOC (char, (strlen (actual_cwrapper_path) +
6028 strlen ("$objdir") + 1 + strlen (actual_cwrapper_name) + 1));
6029 strcpy (newargz[0], actual_cwrapper_path);
6030 strcat (newargz[0], "$objdir");
6031 strcat (newargz[0], "/");
6035 /* stop here, and copy so we don't have to do this twice */
6036 tmp_pathspec = xstrdup (newargz[0]);
6038 /* do NOT want the lt- prefix here, so use actual_cwrapper_name */
6039 strcat (newargz[0], actual_cwrapper_name);
6041 /* DO want the lt- prefix here if it exists, so use target_name */
6042 lt_argv_zero = lt_extend_str (tmp_pathspec, target_name, 1);
6043 XFREE (tmp_pathspec);
6044 tmp_pathspec = NULL;
6052 while ((p = strchr (newargz[0], '\\')) != NULL)
6056 while ((p = strchr (lt_argv_zero, '\\')) != NULL)
6066 XFREE (target_name);
6067 XFREE (actual_cwrapper_path);
6068 XFREE (actual_cwrapper_name);
6070 lt_setenv ("BIN_SH", "xpg4"); /* for Tru64 */
6071 lt_setenv ("DUALCASE", "1"); /* for MSK sh */
6072 /* Update the DLL searchpath. EXE_PATH_VALUE ($dllsearchpath) must
6073 be prepended before (that is, appear after) LIB_PATH_VALUE ($temp_rpath)
6074 because on Windows, both *_VARNAMEs are PATH but uninstalled
6075 libraries must come first. */
6076 lt_update_exe_path (EXE_PATH_VARNAME, EXE_PATH_VALUE);
6077 lt_update_lib_path (LIB_PATH_VARNAME, LIB_PATH_VALUE);
6079 lt_debugprintf (__FILE__, __LINE__, "(main) lt_argv_zero: %s\n",
6080 nonnull (lt_argv_zero));
6081 for (i = 0; i < newargc; i++)
6083 lt_debugprintf (__FILE__, __LINE__, "(main) newargz[%d]: %s\n",
6084 i, nonnull (newargz[i]));
6092 /* execv doesn't actually work on mingw as expected on unix */
6093 newargz = prepare_spawn (newargz);
6094 rval = (int) _spawnv (_P_WAIT, lt_argv_zero, (const char * const *) newargz);
6097 /* failed to start process */
6098 lt_debugprintf (__FILE__, __LINE__,
6099 "(main) failed to launch target \"%s\": %s\n",
6100 lt_argv_zero, nonnull (strerror (errno)));
6108 execv (lt_argv_zero, newargz);
6109 return rval; /* =127, but avoids unused variable warning */
6118 xmalloc (size_t num)
6120 void *p = (void *) malloc (num);
6122 lt_fatal (__FILE__, __LINE__, "memory exhausted");
6128 xstrdup (const char *string)
6130 return string ? strcpy ((char *) xmalloc (strlen (string) + 1),
6135 base_name (const char *name)
6139 #if defined HAVE_DOS_BASED_FILE_SYSTEM
6140 /* Skip over the disk name in MSDOS pathnames. */
6141 if (isalpha ((unsigned char) name[0]) && name[1] == ':')
6145 for (base = name; *name; name++)
6146 if (IS_DIR_SEPARATOR (*name))
6152 check_executable (const char *path)
6156 lt_debugprintf (__FILE__, __LINE__, "(check_executable): %s\n",
6158 if ((!path) || (!*path))
6161 if ((stat (path, &st) >= 0)
6162 && (st.st_mode & (S_IXUSR | S_IXGRP | S_IXOTH)))
6169 make_executable (const char *path)
6174 lt_debugprintf (__FILE__, __LINE__, "(make_executable): %s\n",
6176 if ((!path) || (!*path))
6179 if (stat (path, &st) >= 0)
6181 rval = chmod (path, st.st_mode | S_IXOTH | S_IXGRP | S_IXUSR);
6186 /* Searches for the full path of the wrapper. Returns
6187 newly allocated full path name if found, NULL otherwise
6188 Does not chase symlinks, even on platforms that support them.
6191 find_executable (const char *wrapper)
6196 /* static buffer for getcwd */
6197 char tmp[LT_PATHMAX + 1];
6201 lt_debugprintf (__FILE__, __LINE__, "(find_executable): %s\n",
6202 nonempty (wrapper));
6204 if ((wrapper == NULL) || (*wrapper == '\0'))
6207 /* Absolute path? */
6208 #if defined HAVE_DOS_BASED_FILE_SYSTEM
6209 if (isalpha ((unsigned char) wrapper[0]) && wrapper[1] == ':')
6211 concat_name = xstrdup (wrapper);
6212 if (check_executable (concat_name))
6214 XFREE (concat_name);
6219 if (IS_DIR_SEPARATOR (wrapper[0]))
6221 concat_name = xstrdup (wrapper);
6222 if (check_executable (concat_name))
6224 XFREE (concat_name);
6226 #if defined HAVE_DOS_BASED_FILE_SYSTEM
6230 for (p = wrapper; *p; p++)
6238 /* no slashes; search PATH */
6239 const char *path = getenv ("PATH");
6242 for (p = path; *p; p = p_next)
6246 for (q = p; *q; q++)
6247 if (IS_PATH_SEPARATOR (*q))
6249 p_len = (size_t) (q - p);
6250 p_next = (*q == '\0' ? q : q + 1);
6253 /* empty path: current directory */
6254 if (getcwd (tmp, LT_PATHMAX) == NULL)
6255 lt_fatal (__FILE__, __LINE__, "getcwd failed: %s",
6256 nonnull (strerror (errno)));
6257 tmp_len = strlen (tmp);
6259 XMALLOC (char, tmp_len + 1 + strlen (wrapper) + 1);
6260 memcpy (concat_name, tmp, tmp_len);
6261 concat_name[tmp_len] = '/';
6262 strcpy (concat_name + tmp_len + 1, wrapper);
6267 XMALLOC (char, p_len + 1 + strlen (wrapper) + 1);
6268 memcpy (concat_name, p, p_len);
6269 concat_name[p_len] = '/';
6270 strcpy (concat_name + p_len + 1, wrapper);
6272 if (check_executable (concat_name))
6274 XFREE (concat_name);
6277 /* not found in PATH; assume curdir */
6279 /* Relative path | not found in path: prepend cwd */
6280 if (getcwd (tmp, LT_PATHMAX) == NULL)
6281 lt_fatal (__FILE__, __LINE__, "getcwd failed: %s",
6282 nonnull (strerror (errno)));
6283 tmp_len = strlen (tmp);
6284 concat_name = XMALLOC (char, tmp_len + 1 + strlen (wrapper) + 1);
6285 memcpy (concat_name, tmp, tmp_len);
6286 concat_name[tmp_len] = '/';
6287 strcpy (concat_name + tmp_len + 1, wrapper);
6289 if (check_executable (concat_name))
6291 XFREE (concat_name);
6296 chase_symlinks (const char *pathspec)
6299 return xstrdup (pathspec);
6301 char buf[LT_PATHMAX];
6303 char *tmp_pathspec = xstrdup (pathspec);
6305 int has_symlinks = 0;
6306 while (strlen (tmp_pathspec) && !has_symlinks)
6308 lt_debugprintf (__FILE__, __LINE__,
6309 "checking path component for symlinks: %s\n",
6311 if (lstat (tmp_pathspec, &s) == 0)
6313 if (S_ISLNK (s.st_mode) != 0)
6319 /* search backwards for last DIR_SEPARATOR */
6320 p = tmp_pathspec + strlen (tmp_pathspec) - 1;
6321 while ((p > tmp_pathspec) && (!IS_DIR_SEPARATOR (*p)))
6323 if ((p == tmp_pathspec) && (!IS_DIR_SEPARATOR (*p)))
6325 /* no more DIR_SEPARATORS left */
6332 lt_fatal (__FILE__, __LINE__,
6333 "error accessing file \"%s\": %s",
6334 tmp_pathspec, nonnull (strerror (errno)));
6337 XFREE (tmp_pathspec);
6341 return xstrdup (pathspec);
6344 tmp_pathspec = realpath (pathspec, buf);
6345 if (tmp_pathspec == 0)
6347 lt_fatal (__FILE__, __LINE__,
6348 "could not follow symlinks for %s", pathspec);
6350 return xstrdup (tmp_pathspec);
6355 strendzap (char *str, const char *pat)
6359 assert (str != NULL);
6360 assert (pat != NULL);
6363 patlen = strlen (pat);
6367 str += len - patlen;
6368 if (STREQ (str, pat))
6375 lt_debugprintf (const char *file, int line, const char *fmt, ...)
6380 (void) fprintf (stderr, "%s:%s:%d: ", program_name, file, line);
6381 va_start (args, fmt);
6382 (void) vfprintf (stderr, fmt, args);
6388 lt_error_core (int exit_status, const char *file,
6389 int line, const char *mode,
6390 const char *message, va_list ap)
6392 fprintf (stderr, "%s:%s:%d: %s: ", program_name, file, line, mode);
6393 vfprintf (stderr, message, ap);
6394 fprintf (stderr, ".\n");
6396 if (exit_status >= 0)
6401 lt_fatal (const char *file, int line, const char *message, ...)
6404 va_start (ap, message);
6405 lt_error_core (EXIT_FAILURE, file, line, "FATAL", message, ap);
6410 nonnull (const char *s)
6412 return s ? s : "(null)";
6416 nonempty (const char *s)
6418 return (s && !*s) ? "(empty)" : nonnull (s);
6422 lt_setenv (const char *name, const char *value)
6424 lt_debugprintf (__FILE__, __LINE__,
6425 "(lt_setenv) setting '%s' to '%s'\n",
6426 nonnull (name), nonnull (value));
6429 /* always make a copy, for consistency with !HAVE_SETENV */
6430 char *str = xstrdup (value);
6431 setenv (name, str, 1);
6433 size_t len = strlen (name) + 1 + strlen (value) + 1;
6434 char *str = XMALLOC (char, len);
6435 sprintf (str, "%s=%s", name, value);
6436 if (putenv (str) != EXIT_SUCCESS)
6445 lt_extend_str (const char *orig_value, const char *add, int to_end)
6448 if (orig_value && *orig_value)
6450 size_t orig_value_len = strlen (orig_value);
6451 size_t add_len = strlen (add);
6452 new_value = XMALLOC (char, add_len + orig_value_len + 1);
6455 strcpy (new_value, orig_value);
6456 strcpy (new_value + orig_value_len, add);
6460 strcpy (new_value, add);
6461 strcpy (new_value + add_len, orig_value);
6466 new_value = xstrdup (add);
6472 lt_update_exe_path (const char *name, const char *value)
6474 lt_debugprintf (__FILE__, __LINE__,
6475 "(lt_update_exe_path) modifying '%s' by prepending '%s'\n",
6476 nonnull (name), nonnull (value));
6478 if (name && *name && value && *value)
6480 char *new_value = lt_extend_str (getenv (name), value, 0);
6481 /* some systems can't cope with a ':'-terminated path #' */
6482 size_t len = strlen (new_value);
6483 while ((len > 0) && IS_PATH_SEPARATOR (new_value[len-1]))
6485 new_value[--len] = '\0';
6487 lt_setenv (name, new_value);
6493 lt_update_lib_path (const char *name, const char *value)
6495 lt_debugprintf (__FILE__, __LINE__,
6496 "(lt_update_lib_path) modifying '%s' by prepending '%s'\n",
6497 nonnull (name), nonnull (value));
6499 if (name && *name && value && *value)
6501 char *new_value = lt_extend_str (getenv (name), value, 0);
6502 lt_setenv (name, new_value);
6512 /* Prepares an argument vector before calling spawn().
6513 Note that spawn() does not by itself call the command interpreter
6514 (getenv ("COMSPEC") != NULL ? getenv ("COMSPEC") :
6515 ({ OSVERSIONINFO v; v.dwOSVersionInfoSize = sizeof(OSVERSIONINFO);
6517 v.dwPlatformId == VER_PLATFORM_WIN32_NT;
6518 }) ? "cmd.exe" : "command.com").
6519 Instead it simply concatenates the arguments, separated by ' ', and calls
6520 CreateProcess(). We must quote the arguments since Win32 CreateProcess()
6521 interprets characters like ' ', '\t', '\\', '"' (but not '<' and '>') in a
6523 - Space and tab are interpreted as delimiters. They are not treated as
6524 delimiters if they are surrounded by double quotes: "...".
6525 - Unescaped double quotes are removed from the input. Their only effect is
6526 that within double quotes, space and tab are treated like normal
6528 - Backslashes not followed by double quotes are not special.
6529 - But 2*n+1 backslashes followed by a double quote become
6530 n backslashes followed by a double quote (n >= 0):
6535 #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"
6536 #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"
6538 prepare_spawn (char **argv)
6544 /* Count number of arguments. */
6545 for (argc = 0; argv[argc] != NULL; argc++)
6548 /* Allocate new argument vector. */
6549 new_argv = XMALLOC (char *, argc + 1);
6551 /* Put quoted arguments into the new argument vector. */
6552 for (i = 0; i < argc; i++)
6554 const char *string = argv[i];
6556 if (string[0] == '\0')
6557 new_argv[i] = xstrdup ("\"\"");
6558 else if (strpbrk (string, SHELL_SPECIAL_CHARS) != NULL)
6560 int quote_around = (strpbrk (string, SHELL_SPACE_CHARS) != NULL);
6562 unsigned int backslashes;
6564 char *quoted_string;
6571 for (s = string; *s != '\0'; s++)
6575 length += backslashes + 1;
6583 length += backslashes + 1;
6585 quoted_string = XMALLOC (char, length + 1);
6591 for (s = string; *s != '\0'; s++)
6597 for (j = backslashes + 1; j > 0; j--)
6609 for (j = backslashes; j > 0; j--)
6615 new_argv[i] = quoted_string;
6618 new_argv[i] = (char *) string;
6620 new_argv[argc] = NULL;
6629 void lt_dump_script (FILE* f)
6632 func_emit_wrapper yes |
6634 s/^\(.\{79\}\)\(..*\)/\1\
6639 s/\([^\n]*\).*/ fputs ("\1", f);/p
6646 # end: func_emit_cwrapperexe_src
6648 # func_win32_import_lib_p ARG
6649 # True if ARG is an import lib, as indicated by $file_magic_cmd
6650 func_win32_import_lib_p ()
6654 case `eval $file_magic_cmd \"\$1\" 2>/dev/null | $SED -e 10q` in
6660 # func_suncc_cstd_abi
6661 # !!ONLY CALL THIS FOR SUN CC AFTER $compile_command IS FULLY EXPANDED!!
6662 # Several compiler flags select an ABI that is incompatible with the
6663 # Cstd library. Avoid specifying it if any are in CXXFLAGS.
6664 func_suncc_cstd_abi ()
6668 case " $compile_command " in
6669 *" -compat=g "*|*\ -std=c++[0-9][0-9]\ *|*" -library=stdcxx4 "*|*" -library=stlport4 "*)
6670 suncc_use_cstd_abi=no
6673 suncc_use_cstd_abi=yes
6678 # func_mode_link arg...
6684 *-*-cygwin* | *-*-mingw* | *-*-pw32* | *-*-os2* | *-cegcc*)
6685 # It is impossible to link a dll without this setting, and
6686 # we shouldn't force the makefile maintainer to figure out
6687 # what system we are compiling for in order to pass an extra
6688 # flag for every libtool invocation.
6689 # allow_undefined=no
6691 # FIXME: Unfortunately, there are problems with the above when trying
6692 # to make a dll that has undefined symbols, in which case not
6693 # even a static library is built. For now, we need to specify
6694 # -no-undefined on the libtool link line when we can be certain
6695 # that all symbols are satisfied, otherwise we get a static library.
6702 libtool_args=$nonopt
6703 base_compile="$nonopt $@"
6704 compile_command=$nonopt
6705 finalize_command=$nonopt
6718 lib_search_path=`pwd`
6720 new_inherited_linker_flags=
6729 export_symbols_regex=
6738 precious_files_regex=
6739 prefer_static_libs=no
6752 single_module=$wl-single_module
6753 func_infer_tag $base_compile
6755 # We need to know -static, to get the right output filenames.
6760 test yes != "$build_libtool_libs" \
6761 && func_fatal_configuration "cannot build a shared library"
6765 -all-static | -static | -static-libtool-libs)
6768 if test yes = "$build_libtool_libs" && test -z "$link_static_flag"; then
6769 func_warning "complete static linking is impossible in this configuration"
6771 if test -n "$link_static_flag"; then
6772 dlopen_self=$dlopen_self_static
6774 prefer_static_libs=yes
6777 if test -z "$pic_flag" && test -n "$link_static_flag"; then
6778 dlopen_self=$dlopen_self_static
6780 prefer_static_libs=built
6782 -static-libtool-libs)
6783 if test -z "$pic_flag" && test -n "$link_static_flag"; then
6784 dlopen_self=$dlopen_self_static
6786 prefer_static_libs=yes
6789 build_libtool_libs=no
6796 # See if our shared archives depend on static archives.
6797 test -n "$old_archive_from_new_cmds" && build_old_libs=yes
6799 # Go through the arguments, transforming them on the way.
6800 while test "$#" -gt 0; do
6803 func_quote_arg pretty,unquoted "$arg"
6804 qarg=$func_quote_arg_unquoted_result
6805 func_append libtool_args " $func_quote_arg_result"
6807 # If the previous option needs an argument, assign it.
6808 if test -n "$prev"; then
6811 func_append compile_command " @OUTPUT@"
6812 func_append finalize_command " @OUTPUT@"
6824 # Add the symbol object into the linking commands.
6825 func_append compile_command " @SYMFILE@"
6826 func_append finalize_command " @SYMFILE@"
6830 *.la | *.lo) ;; # We handle these cases below.
6832 if test no = "$dlself"; then
6840 if test dlprefiles = "$prev"; then
6842 elif test dlfiles = "$prev" && test yes != "$dlopen_self"; then
6852 if test dlfiles = "$prev"; then
6853 func_append dlfiles " $arg"
6855 func_append dlprefiles " $arg"
6865 || func_fatal_error "symbol file '$arg' does not exist"
6870 export_symbols_regex=$arg
6878 *" $qarg.ltframework "*) ;;
6879 *) func_append deplibs " $qarg.ltframework" # this is fixed later
6888 inst_prefix_dir=$arg
6893 # Clang does not use LLVM to link, so we can simply discard any
6894 # '-mllvm $arg' options when doing the link step.
6899 if test -f "$arg"; then
6902 for fil in `cat "$save_arg"`
6904 # func_append moreargs " $fil"
6906 # A libtool-controlled object.
6908 # Check to see that this really is a libtool object.
6909 if func_lalib_unsafe_p "$arg"; then
6916 if test -z "$pic_object" ||
6917 test -z "$non_pic_object" ||
6918 test none = "$pic_object" &&
6919 test none = "$non_pic_object"; then
6920 func_fatal_error "cannot find name of object for '$arg'"
6923 # Extract subdirectory from the argument.
6924 func_dirname "$arg" "/" ""
6925 xdir=$func_dirname_result
6927 if test none != "$pic_object"; then
6928 # Prepend the subdirectory the object is found in.
6929 pic_object=$xdir$pic_object
6931 if test dlfiles = "$prev"; then
6932 if test yes = "$build_libtool_libs" && test yes = "$dlopen_support"; then
6933 func_append dlfiles " $pic_object"
6937 # If libtool objects are unsupported, then we need to preload.
6942 # CHECK ME: I think I busted this. -Ossama
6943 if test dlprefiles = "$prev"; then
6944 # Preload the old-style object.
6945 func_append dlprefiles " $pic_object"
6950 func_append libobjs " $pic_object"
6955 if test none != "$non_pic_object"; then
6956 # Prepend the subdirectory the object is found in.
6957 non_pic_object=$xdir$non_pic_object
6959 # A standard non-PIC object
6960 func_append non_pic_objects " $non_pic_object"
6961 if test -z "$pic_object" || test none = "$pic_object"; then
6965 # If the PIC object exists, use it instead.
6966 # $xdir was prepended to $pic_object above.
6967 non_pic_object=$pic_object
6968 func_append non_pic_objects " $non_pic_object"
6971 # Only an error if not doing a dry-run.
6972 if $opt_dry_run; then
6973 # Extract subdirectory from the argument.
6974 func_dirname "$arg" "/" ""
6975 xdir=$func_dirname_result
6978 pic_object=$xdir$objdir/$func_lo2o_result
6979 non_pic_object=$xdir$func_lo2o_result
6980 func_append libobjs " $pic_object"
6981 func_append non_pic_objects " $non_pic_object"
6983 func_fatal_error "'$arg' is not a valid libtool object"
6988 func_fatal_error "link input file '$arg' does not exist"
7000 precious_files_regex=$arg
7010 # We need an absolute path.
7012 [\\/]* | [A-Za-z]:[\\/]*) ;;
7014 func_fatal_error "only absolute run-paths are allowed"
7017 if test rpath = "$prev"; then
7020 *) func_append rpath " $arg" ;;
7025 *) func_append xrpath " $arg" ;;
7037 func_append weak_libs " $arg"
7042 func_append linker_flags " $qarg"
7043 func_append compiler_flags " $qarg"
7045 func_append compile_command " $qarg"
7046 func_append finalize_command " $qarg"
7050 func_append compiler_flags " $qarg"
7052 func_append compile_command " $qarg"
7053 func_append finalize_command " $qarg"
7057 func_append linker_flags " $qarg"
7058 func_append compiler_flags " $wl$qarg"
7060 func_append compile_command " $wl$qarg"
7061 func_append finalize_command " $wl$qarg"
7065 eval "$prev=\"\$arg\""
7070 fi # test -n "$prev"
7076 if test -n "$link_static_flag"; then
7077 # See comment for -static flag below, for more details.
7078 func_append compile_command " $link_static_flag"
7079 func_append finalize_command " $link_static_flag"
7085 # FIXME: remove this flag sometime in the future.
7086 func_fatal_error "'-allow-undefined' must not be used because it is the default"
7114 -export-symbols | -export-symbols-regex)
7115 if test -n "$export_symbols" || test -n "$export_symbols_regex"; then
7116 func_fatal_error "more than one -exported-symbols argument is not allowed"
7118 if test X-export-symbols = "X$arg"; then
7136 # The native IRIX linker understands -LANG:*, -LIST:* and -LNO:*
7137 # so, if we see these flags be careful not to treat them like -L
7139 case $with_gcc/$host in
7140 no/*-*-irix* | /*-*-irix*)
7141 func_append compile_command " $arg"
7142 func_append finalize_command " $arg"
7149 func_stripname "-L" '' "$arg"
7150 if test -z "$func_stripname_result"; then
7151 if test "$#" -gt 0; then
7152 func_fatal_error "require no space between '-L' and '$1'"
7154 func_fatal_error "need path for '-L' option"
7157 func_resolve_sysroot "$func_stripname_result"
7158 dir=$func_resolve_sysroot_result
7159 # We need an absolute path.
7161 [\\/]* | [A-Za-z]:[\\/]*) ;;
7163 absdir=`cd "$dir" && pwd`
7164 test -z "$absdir" && \
7165 func_fatal_error "cannot determine absolute directory name of '$dir'"
7170 *" -L$dir "* | *" $arg "*)
7171 # Will only happen for absolute or sysroot arguments
7174 # Preserve sysroot, but never include relative directories
7176 [\\/]* | [A-Za-z]:[\\/]* | =*) func_append deplibs " $arg" ;;
7177 *) func_append deplibs " -L$dir" ;;
7179 func_append lib_search_path " $dir"
7183 *-*-cygwin* | *-*-mingw* | *-*-pw32* | *-*-os2* | *-cegcc*)
7184 testbindir=`$ECHO "$dir" | $SED 's*/lib$*/bin*'`
7185 case :$dllsearchpath: in
7187 ::) dllsearchpath=$dir;;
7188 *) func_append dllsearchpath ":$dir";;
7190 case :$dllsearchpath: in
7191 *":$testbindir:"*) ;;
7192 ::) dllsearchpath=$testbindir;;
7193 *) func_append dllsearchpath ":$testbindir";;
7201 if test X-lc = "X$arg" || test X-lm = "X$arg"; then
7203 *-*-cygwin* | *-*-mingw* | *-*-pw32* | *-*-beos* | *-cegcc* | *-*-haiku*)
7204 # These systems don't actually have a C or math library (as such)
7208 # These systems don't actually have a C library (as such)
7209 test X-lc = "X$arg" && continue
7211 *-*-openbsd* | *-*-freebsd* | *-*-dragonfly* | *-*-bitrig*)
7212 # Do not include libc due to us having libc/libc_r.
7213 test X-lc = "X$arg" && continue
7215 *-*-rhapsody* | *-*-darwin1.[012])
7216 # Rhapsody C and math libraries are in the System framework
7217 func_append deplibs " System.ltframework"
7220 *-*-sco3.2v5* | *-*-sco5v6*)
7221 # Causes problems with __ctype
7222 test X-lc = "X$arg" && continue
7224 *-*-sysv4.2uw2* | *-*-sysv5* | *-*-unixware* | *-*-OpenUNIX*)
7225 # Compiler inserts libc in the correct place for threads to work
7226 test X-lc = "X$arg" && continue
7229 elif test X-lc_r = "X$arg"; then
7231 *-*-openbsd* | *-*-freebsd* | *-*-dragonfly* | *-*-bitrig*)
7232 # Do not include libc_r directly, use -pthread flag.
7237 func_append deplibs " $arg"
7251 # Tru64 UNIX uses -model [arg] to determine the layout of C++
7252 # classes, name mangling, and exception handling.
7253 # Darwin uses the -arch flag to determine output architecture.
7254 -model|-arch|-isysroot|--sysroot)
7255 func_append compiler_flags " $arg"
7256 func_append compile_command " $arg"
7257 func_append finalize_command " $arg"
7262 -mt|-mthreads|-kthread|-Kthread|-pthread|-pthreads|--thread-safe \
7263 |-threads|-fopenmp|-openmp|-mp|-xopenmp|-omp|-qsmp=*)
7264 func_append compiler_flags " $arg"
7265 func_append compile_command " $arg"
7266 func_append finalize_command " $arg"
7267 case "$new_inherited_linker_flags " in
7269 * ) func_append new_inherited_linker_flags " $arg" ;;
7275 single_module=$wl-multi_module
7286 *-*-cygwin* | *-*-mingw* | *-*-pw32* | *-*-os2* | *-*-darwin* | *-cegcc*)
7287 # The PATH hackery in wrapper scripts is required on Windows
7288 # and Darwin in order for the loader to find any dlls it needs.
7289 func_warning "'-no-install' is ignored for $host"
7290 func_warning "assuming '-no-fast-install' instead"
7293 *) no_install=yes ;;
7315 -precious-files-regex)
7336 func_stripname '-R' '' "$arg"
7337 dir=$func_stripname_result
7338 # We need an absolute path.
7340 [\\/]* | [A-Za-z]:[\\/]*) ;;
7342 func_stripname '=' '' "$dir"
7343 dir=$lt_sysroot$func_stripname_result
7346 func_fatal_error "only absolute run-paths are allowed"
7351 *) func_append xrpath " $dir" ;;
7357 # The effects of -shared are defined in a previous loop.
7366 -static | -static-libtool-libs)
7367 # The effects of -static are defined in a previous loop.
7368 # We used to do the same as -all-static on platforms that
7369 # didn't have a PIC flag, but the assumption that the effects
7370 # would be equivalent was wrong. It would break on at least
7371 # Digital Unix and AIX.
7397 func_stripname '-Wc,' '' "$arg"
7398 args=$func_stripname_result
7400 save_ifs=$IFS; IFS=,
7401 for flag in $args; do
7403 func_quote_arg pretty "$flag"
7404 func_append arg " $func_quote_arg_result"
7405 func_append compiler_flags " $func_quote_arg_result"
7408 func_stripname ' ' '' "$arg"
7409 arg=$func_stripname_result
7413 func_stripname '-Wl,' '' "$arg"
7414 args=$func_stripname_result
7416 save_ifs=$IFS; IFS=,
7417 for flag in $args; do
7419 func_quote_arg pretty "$flag"
7420 func_append arg " $wl$func_quote_arg_result"
7421 func_append compiler_flags " $wl$func_quote_arg_result"
7422 func_append linker_flags " $func_quote_arg_result"
7425 func_stripname ' ' '' "$arg"
7426 arg=$func_stripname_result
7446 func_quote_arg pretty "$arg"
7447 arg=$func_quote_arg_result
7450 # Flags to be passed through unchanged, with rationale:
7451 # -64, -mips[0-9] enable 64-bit mode for the SGI compiler
7452 # -r[0-9][0-9]* specify processor for the SGI compiler
7453 # -xarch=*, -xtarget=* enable 64-bit mode for the Sun compiler
7454 # +DA*, +DD* enable 64-bit mode for the HP compiler
7455 # -q* compiler args for the IBM compiler
7456 # -m*, -t[45]*, -txscale* architecture-specific flags for GCC
7457 # -F/path path to uninstalled frameworks, gcc on darwin
7458 # -p, -pg, --coverage, -fprofile-* profiling flags for GCC
7459 # -fstack-protector* stack protector flags for GCC
7460 # @file GCC response files
7461 # -tp=* Portland pgcc target processor selection
7462 # --sysroot=* for sysroot support
7463 # -O*, -g*, -flto*, -fwhopr*, -fuse-linker-plugin GCC link-time optimization
7464 # -specs=* GCC specs files
7465 # -stdlib=* select c++ std lib with clang
7466 # -fsanitize=* Clang/GCC memory and address sanitizer
7467 -64|-mips[0-9]|-r[0-9][0-9]*|-xarch=*|-xtarget=*|+DA*|+DD*|-q*|-m*| \
7468 -t[45]*|-txscale*|-p|-pg|--coverage|-fprofile-*|-F*|@*|-tp=*|--sysroot=*| \
7469 -O*|-g*|-flto*|-fwhopr*|-fuse-linker-plugin|-fstack-protector*|-stdlib=*| \
7470 -specs=*|-fsanitize=*)
7471 func_quote_arg pretty "$arg"
7472 arg=$func_quote_arg_result
7473 func_append compile_command " $arg"
7474 func_append finalize_command " $arg"
7475 func_append compiler_flags " $arg"
7480 if test os2 = "`expr $host : '.*\(os2\)'`"; then
7481 # OS/2 uses -Zxxx to specify OS/2-specific options
7482 compiler_flags="$compiler_flags $arg"
7483 func_append compile_command " $arg"
7484 func_append finalize_command " $arg"
7492 # Otherwise treat like 'Some other compiler flag' below
7493 func_quote_arg pretty "$arg"
7494 arg=$func_quote_arg_result
7498 # Some other compiler flag.
7500 func_quote_arg pretty "$arg"
7501 arg=$func_quote_arg_result
7505 # A standard object.
7506 func_append objs " $arg"
7510 # A libtool-controlled object.
7512 # Check to see that this really is a libtool object.
7513 if func_lalib_unsafe_p "$arg"; then
7520 if test -z "$pic_object" ||
7521 test -z "$non_pic_object" ||
7522 test none = "$pic_object" &&
7523 test none = "$non_pic_object"; then
7524 func_fatal_error "cannot find name of object for '$arg'"
7527 # Extract subdirectory from the argument.
7528 func_dirname "$arg" "/" ""
7529 xdir=$func_dirname_result
7531 test none = "$pic_object" || {
7532 # Prepend the subdirectory the object is found in.
7533 pic_object=$xdir$pic_object
7535 if test dlfiles = "$prev"; then
7536 if test yes = "$build_libtool_libs" && test yes = "$dlopen_support"; then
7537 func_append dlfiles " $pic_object"
7541 # If libtool objects are unsupported, then we need to preload.
7546 # CHECK ME: I think I busted this. -Ossama
7547 if test dlprefiles = "$prev"; then
7548 # Preload the old-style object.
7549 func_append dlprefiles " $pic_object"
7554 func_append libobjs " $pic_object"
7559 if test none != "$non_pic_object"; then
7560 # Prepend the subdirectory the object is found in.
7561 non_pic_object=$xdir$non_pic_object
7563 # A standard non-PIC object
7564 func_append non_pic_objects " $non_pic_object"
7565 if test -z "$pic_object" || test none = "$pic_object"; then
7569 # If the PIC object exists, use it instead.
7570 # $xdir was prepended to $pic_object above.
7571 non_pic_object=$pic_object
7572 func_append non_pic_objects " $non_pic_object"
7575 # Only an error if not doing a dry-run.
7576 if $opt_dry_run; then
7577 # Extract subdirectory from the argument.
7578 func_dirname "$arg" "/" ""
7579 xdir=$func_dirname_result
7582 pic_object=$xdir$objdir/$func_lo2o_result
7583 non_pic_object=$xdir$func_lo2o_result
7584 func_append libobjs " $pic_object"
7585 func_append non_pic_objects " $non_pic_object"
7587 func_fatal_error "'$arg' is not a valid libtool object"
7594 func_append deplibs " $arg"
7595 func_append old_deplibs " $arg"
7600 # A libtool-controlled library.
7602 func_resolve_sysroot "$arg"
7603 if test dlfiles = "$prev"; then
7604 # This library was specified with -dlopen.
7605 func_append dlfiles " $func_resolve_sysroot_result"
7607 elif test dlprefiles = "$prev"; then
7608 # The library was specified with -dlpreopen.
7609 func_append dlprefiles " $func_resolve_sysroot_result"
7612 func_append deplibs " $func_resolve_sysroot_result"
7617 # Some other compiler argument.
7619 # Unknown arguments in both finalize_command and compile_command need
7620 # to be aesthetically quoted because they are evaled later.
7621 func_quote_arg pretty "$arg"
7622 arg=$func_quote_arg_result
7626 # Now actually substitute the argument into the commands.
7627 if test -n "$arg"; then
7628 func_append compile_command " $arg"
7629 func_append finalize_command " $arg"
7631 done # argument parsing loop
7633 test -n "$prev" && \
7634 func_fatal_help "the '$prevarg' option requires an argument"
7636 if test yes = "$export_dynamic" && test -n "$export_dynamic_flag_spec"; then
7637 eval arg=\"$export_dynamic_flag_spec\"
7638 func_append compile_command " $arg"
7639 func_append finalize_command " $arg"
7643 # calculate the name of the file, without its directory
7644 func_basename "$output"
7645 outputname=$func_basename_result
7646 libobjs_save=$libobjs
7648 if test -n "$shlibpath_var"; then
7649 # get the directories listed in $shlibpath_var
7650 eval shlib_search_path=\`\$ECHO \"\$$shlibpath_var\" \| \$SED \'s/:/ /g\'\`
7654 eval sys_lib_search_path=\"$sys_lib_search_path_spec\"
7655 eval sys_lib_dlsearch_path=\"$sys_lib_dlsearch_path_spec\"
7657 # Definition is injected by LT_CONFIG during libtool generation.
7658 func_munge_path_list sys_lib_dlsearch_path "$LT_SYS_LIBRARY_PATH"
7660 func_dirname "$output" "/" ""
7661 output_objdir=$func_dirname_result$objdir
7662 func_to_tool_file "$output_objdir/"
7663 tool_output_objdir=$func_to_tool_file_result
7664 # Create the object directory.
7665 func_mkdir_p "$output_objdir"
7667 # Determine the type of output
7670 func_fatal_help "you must specify an output file"
7672 *.$libext) linkmode=oldlib ;;
7673 *.lo | *.$objext) linkmode=obj ;;
7674 *.la) linkmode=lib ;;
7675 *) linkmode=prog ;; # Anything else should be a program.
7681 # Find all interdependent deplibs by searching for libraries
7682 # that are linked more than once (e.g. -la -lb -la)
7683 for deplib in $deplibs; do
7684 if $opt_preserve_dup_deps; then
7686 *" $deplib "*) func_append specialdeplibs " $deplib" ;;
7689 func_append libs " $deplib"
7692 if test lib = "$linkmode"; then
7693 libs="$predeps $libs $compiler_lib_search_path $postdeps"
7695 # Compute libraries that are listed more than once in $predeps
7696 # $postdeps and mark them as special (i.e., whose duplicates are
7697 # not to be eliminated).
7699 if $opt_duplicate_compiler_generated_deps; then
7700 for pre_post_dep in $predeps $postdeps; do
7701 case "$pre_post_deps " in
7702 *" $pre_post_dep "*) func_append specialdeplibs " $pre_post_deps" ;;
7704 func_append pre_post_deps " $pre_post_dep"
7713 need_relink=no # whether we're linking any uninstalled libtool libraries
7714 notinst_deplibs= # not-installed libtool libraries
7715 notinst_path= # paths that contain not-installed libtool libraries
7719 passes="conv dlpreopen link"
7720 for file in $dlfiles $dlprefiles; do
7724 func_fatal_help "libraries can '-dlopen' only libtool libraries: $file"
7735 passes="conv scan dlopen dlpreopen link"
7741 for pass in $passes; do
7742 # The preopen pass in lib mode reverses $deplibs; put it back here
7743 # so that -L comes before libs that need it for instance...
7744 if test lib,link = "$linkmode,$pass"; then
7745 ## FIXME: Find the place where the list is rebuilt in the wrong
7746 ## order, and fix it there properly
7748 for deplib in $deplibs; do
7749 tmp_deplibs="$deplib $tmp_deplibs"
7751 deplibs=$tmp_deplibs
7754 if test lib,link = "$linkmode,$pass" ||
7755 test prog,scan = "$linkmode,$pass"; then
7759 if test prog = "$linkmode"; then
7761 dlopen) libs=$dlfiles ;;
7762 dlpreopen) libs=$dlprefiles ;;
7764 libs="$deplibs %DEPLIBS%"
7765 test "X$link_all_deplibs" != Xno && libs="$libs $dependency_libs"
7769 if test lib,dlpreopen = "$linkmode,$pass"; then
7770 # Collect and forward deplibs of preopened libtool libs
7771 for lib in $dlprefiles; do
7772 # Ignore non-libtool-libs
7774 func_resolve_sysroot "$lib"
7776 *.la) func_source "$func_resolve_sysroot_result" ;;
7779 # Collect preopened libtool deplibs, except any this library
7780 # has declared as weak libs
7781 for deplib in $dependency_libs; do
7782 func_basename "$deplib"
7783 deplib_base=$func_basename_result
7784 case " $weak_libs " in
7785 *" $deplib_base "*) ;;
7786 *) func_append deplibs " $deplib" ;;
7792 if test dlopen = "$pass"; then
7793 # Collect dlpreopened libraries
7794 save_deplibs=$deplibs
7798 for deplib in $libs; do
7802 -mt|-mthreads|-kthread|-Kthread|-pthread|-pthreads|--thread-safe \
7803 |-threads|-fopenmp|-openmp|-mp|-xopenmp|-omp|-qsmp=*)
7804 if test prog,link = "$linkmode,$pass"; then
7805 compile_deplibs="$deplib $compile_deplibs"
7806 finalize_deplibs="$deplib $finalize_deplibs"
7808 func_append compiler_flags " $deplib"
7809 if test lib = "$linkmode"; then
7810 case "$new_inherited_linker_flags " in
7812 * ) func_append new_inherited_linker_flags " $deplib" ;;
7819 if test lib != "$linkmode" && test prog != "$linkmode"; then
7820 func_warning "'-l' is ignored for archives/objects"
7823 func_stripname '-l' '' "$deplib"
7824 name=$func_stripname_result
7825 if test lib = "$linkmode"; then
7826 searchdirs="$newlib_search_path $lib_search_path $compiler_lib_search_dirs $sys_lib_search_path $shlib_search_path"
7828 searchdirs="$newlib_search_path $lib_search_path $sys_lib_search_path $shlib_search_path"
7830 for searchdir in $searchdirs; do
7831 for search_ext in .la $std_shrext .so .a; do
7832 # Search the libtool library
7833 lib=$searchdir/lib$name$search_ext
7834 if test -f "$lib"; then
7835 if test .la = "$search_ext"; then
7845 # deplib is a libtool library
7846 # If $allow_libtool_libs_with_static_runtimes && $deplib is a stdlib,
7847 # We need to do some special things here, and not later.
7848 if test yes = "$allow_libtool_libs_with_static_runtimes"; then
7849 case " $predeps $postdeps " in
7851 if func_lalib_p "$lib"; then
7855 for l in $old_library $library_names; do
7858 if test "X$ll" = "X$old_library"; then # only static version available
7860 func_dirname "$lib" "" "."
7861 ladir=$func_dirname_result
7862 lib=$ladir/$old_library
7863 if test prog,link = "$linkmode,$pass"; then
7864 compile_deplibs="$deplib $compile_deplibs"
7865 finalize_deplibs="$deplib $finalize_deplibs"
7867 deplibs="$deplib $deplibs"
7868 test lib = "$linkmode" && newdependency_libs="$deplib $newdependency_libs"
7878 # deplib doesn't seem to be a libtool library
7879 if test prog,link = "$linkmode,$pass"; then
7880 compile_deplibs="$deplib $compile_deplibs"
7881 finalize_deplibs="$deplib $finalize_deplibs"
7883 deplibs="$deplib $deplibs"
7884 test lib = "$linkmode" && newdependency_libs="$deplib $newdependency_libs"
7890 if test prog,link = "$linkmode,$pass"; then
7891 compile_deplibs="$deplib $compile_deplibs"
7892 finalize_deplibs="$deplib $finalize_deplibs"
7894 deplibs="$deplib $deplibs"
7895 if test lib = "$linkmode"; then
7896 case "$new_inherited_linker_flags " in
7898 * ) func_append new_inherited_linker_flags " $deplib" ;;
7907 deplibs="$deplib $deplibs"
7908 test conv = "$pass" && continue
7909 newdependency_libs="$deplib $newdependency_libs"
7910 func_stripname '-L' '' "$deplib"
7911 func_resolve_sysroot "$func_stripname_result"
7912 func_append newlib_search_path " $func_resolve_sysroot_result"
7915 if test conv = "$pass"; then
7916 deplibs="$deplib $deplibs"
7919 if test scan = "$pass"; then
7920 deplibs="$deplib $deplibs"
7922 compile_deplibs="$deplib $compile_deplibs"
7923 finalize_deplibs="$deplib $finalize_deplibs"
7925 func_stripname '-L' '' "$deplib"
7926 func_resolve_sysroot "$func_stripname_result"
7927 func_append newlib_search_path " $func_resolve_sysroot_result"
7930 func_warning "'-L' is ignored for archives/objects"
7936 if test link = "$pass"; then
7937 func_stripname '-R' '' "$deplib"
7938 func_resolve_sysroot "$func_stripname_result"
7939 dir=$func_resolve_sysroot_result
7940 # Make sure the xrpath contains only unique directories.
7943 *) func_append xrpath " $dir" ;;
7946 deplibs="$deplib $deplibs"
7950 func_resolve_sysroot "$deplib"
7951 lib=$func_resolve_sysroot_result
7954 if test conv = "$pass"; then
7955 deplibs="$deplib $deplibs"
7960 # Linking convenience modules into shared libraries is allowed,
7961 # but linking other static libraries is non-portable.
7962 case " $dlpreconveniencelibs " in
7966 case $deplibs_check_method in
7968 set dummy $deplibs_check_method; shift
7969 match_pattern_regex=`expr "$deplibs_check_method" : "$1 \(.*\)"`
7970 if eval "\$ECHO \"$deplib\"" 2>/dev/null | $SED 10q \
7971 | $EGREP "$match_pattern_regex" > /dev/null; then
7979 if $valid_a_lib; then
7981 $ECHO "*** Warning: Linking the shared library $output against the"
7982 $ECHO "*** static library $deplib is not portable!"
7983 deplibs="$deplib $deplibs"
7986 $ECHO "*** Warning: Trying to link with static lib archive $deplib."
7987 echo "*** I have the capability to make that library automatically link in when"
7988 echo "*** you link to this library. But I can only do this if you have a"
7989 echo "*** shared version of the library, which you do not appear to have"
7990 echo "*** because the file extensions .$libext of this argument makes me believe"
7991 echo "*** that it is just a static archive that I should not use here."
7998 if test link != "$pass"; then
7999 deplibs="$deplib $deplibs"
8001 compile_deplibs="$deplib $compile_deplibs"
8002 finalize_deplibs="$deplib $finalize_deplibs"
8009 if test conv = "$pass"; then
8010 deplibs="$deplib $deplibs"
8011 elif test prog = "$linkmode"; then
8012 if test dlpreopen = "$pass" || test yes != "$dlopen_support" || test no = "$build_libtool_libs"; then
8013 # If there is no dlopen support or we're linking statically,
8014 # we need to preload.
8015 func_append newdlprefiles " $deplib"
8016 compile_deplibs="$deplib $compile_deplibs"
8017 finalize_deplibs="$deplib $finalize_deplibs"
8019 func_append newdlfiles " $deplib"
8030 $found || test -f "$lib" \
8031 || func_fatal_error "cannot find the library '$lib' or unhandled argument '$deplib'"
8033 # Check to see that this really is a libtool archive.
8034 func_lalib_unsafe_p "$lib" \
8035 || func_fatal_error "'$lib' is not a valid libtool archive"
8037 func_dirname "$lib" "" "."
8038 ladir=$func_dirname_result
8046 inherited_linker_flags=
8047 # If the library was installed with an old release of libtool,
8048 # it will not redefine variables installed, or shouldnotlink
8057 # Convert "-framework foo" to "foo.ltframework"
8058 if test -n "$inherited_linker_flags"; then
8059 tmp_inherited_linker_flags=`$ECHO "$inherited_linker_flags" | $SED 's/-framework \([^ $]*\)/\1.ltframework/g'`
8060 for tmp_inherited_linker_flag in $tmp_inherited_linker_flags; do
8061 case " $new_inherited_linker_flags " in
8062 *" $tmp_inherited_linker_flag "*) ;;
8063 *) func_append new_inherited_linker_flags " $tmp_inherited_linker_flag";;
8067 dependency_libs=`$ECHO " $dependency_libs" | $SED 's% \([^ $]*\).ltframework% -framework \1%g'`
8068 if test lib,link = "$linkmode,$pass" ||
8069 test prog,scan = "$linkmode,$pass" ||
8070 { test prog != "$linkmode" && test lib != "$linkmode"; }; then
8071 test -n "$dlopen" && func_append dlfiles " $dlopen"
8072 test -n "$dlpreopen" && func_append dlprefiles " $dlpreopen"
8075 if test conv = "$pass"; then
8076 # Only check for convenience libraries
8077 deplibs="$lib $deplibs"
8078 if test -z "$libdir"; then
8079 if test -z "$old_library"; then
8080 func_fatal_error "cannot find name of link library for '$lib'"
8082 # It is a libtool convenience library, so add in its objects.
8083 func_append convenience " $ladir/$objdir/$old_library"
8084 func_append old_convenience " $ladir/$objdir/$old_library"
8086 for deplib in $dependency_libs; do
8087 deplibs="$deplib $deplibs"
8088 if $opt_preserve_dup_deps; then
8089 case "$tmp_libs " in
8090 *" $deplib "*) func_append specialdeplibs " $deplib" ;;
8093 func_append tmp_libs " $deplib"
8095 elif test prog != "$linkmode" && test lib != "$linkmode"; then
8096 func_fatal_error "'$lib' is not a convenience library"
8102 # Get the name of the library we link against.
8104 if test -n "$old_library" &&
8105 { test yes = "$prefer_static_libs" ||
8106 test built,no = "$prefer_static_libs,$installed"; }; then
8107 linklib=$old_library
8109 for l in $old_library $library_names; do
8113 if test -z "$linklib"; then
8114 func_fatal_error "cannot find name of link library for '$lib'"
8117 # This library was specified with -dlopen.
8118 if test dlopen = "$pass"; then
8120 && func_fatal_error "cannot -dlopen a convenience library: '$lib'"
8121 if test -z "$dlname" ||
8122 test yes != "$dlopen_support" ||
8123 test no = "$build_libtool_libs"
8125 # If there is no dlname, no dlopen support or we're linking
8126 # statically, we need to preload. We also need to preload any
8127 # dependent libraries so libltdl's deplib preloader doesn't
8128 # bomb out in the load deplibs phase.
8129 func_append dlprefiles " $lib $dependency_libs"
8131 func_append newdlfiles " $lib"
8136 # We need an absolute path.
8138 [\\/]* | [A-Za-z]:[\\/]*) abs_ladir=$ladir ;;
8140 abs_ladir=`cd "$ladir" && pwd`
8141 if test -z "$abs_ladir"; then
8142 func_warning "cannot determine absolute directory name of '$ladir'"
8143 func_warning "passing it literally to the linker, although it might fail"
8148 func_basename "$lib"
8149 laname=$func_basename_result
8151 # Find the relevant object directory and library name.
8152 if test yes = "$installed"; then
8153 if test ! -f "$lt_sysroot$libdir/$linklib" && test -f "$abs_ladir/$linklib"; then
8154 func_warning "library '$lib' was moved."
8159 dir=$lt_sysroot$libdir
8160 absdir=$lt_sysroot$libdir
8162 test yes = "$hardcode_automatic" && avoidtemprpath=yes
8164 if test ! -f "$ladir/$objdir/$linklib" && test -f "$abs_ladir/$linklib"; then
8167 # Remove this search path later
8168 func_append notinst_path " $abs_ladir"
8171 absdir=$abs_ladir/$objdir
8172 # Remove this search path later
8173 func_append notinst_path " $abs_ladir"
8175 fi # $installed = yes
8176 func_stripname 'lib' '.la' "$laname"
8177 name=$func_stripname_result
8179 # This library was specified with -dlpreopen.
8180 if test dlpreopen = "$pass"; then
8181 if test -z "$libdir" && test prog = "$linkmode"; then
8182 func_fatal_error "only libraries may -dlpreopen a convenience library: '$lib'"
8185 # special handling for platforms with PE-DLLs.
8186 *cygwin* | *mingw* | *cegcc* )
8187 # Linker will automatically link against shared library if both
8188 # static and shared are present. Therefore, ensure we extract
8189 # symbols from the import library if a shared library is present
8190 # (otherwise, the dlopen module name will be incorrect). We do
8191 # this by putting the import library name into $newdlprefiles.
8192 # We recover the dlopen module name by 'saving' the la file
8193 # name in a special purpose variable, and (later) extracting the
8194 # dlname from the la file.
8195 if test -n "$dlname"; then
8196 func_tr_sh "$dir/$linklib"
8197 eval "libfile_$func_tr_sh_result=\$abs_ladir/\$laname"
8198 func_append newdlprefiles " $dir/$linklib"
8200 func_append newdlprefiles " $dir/$old_library"
8201 # Keep a list of preopened convenience libraries to check
8202 # that they are being used correctly in the link pass.
8203 test -z "$libdir" && \
8204 func_append dlpreconveniencelibs " $dir/$old_library"
8208 # Prefer using a static library (so that no silly _DYNAMIC symbols
8209 # are required to link).
8210 if test -n "$old_library"; then
8211 func_append newdlprefiles " $dir/$old_library"
8212 # Keep a list of preopened convenience libraries to check
8213 # that they are being used correctly in the link pass.
8214 test -z "$libdir" && \
8215 func_append dlpreconveniencelibs " $dir/$old_library"
8216 # Otherwise, use the dlname, so that lt_dlopen finds it.
8217 elif test -n "$dlname"; then
8218 func_append newdlprefiles " $dir/$dlname"
8220 func_append newdlprefiles " $dir/$linklib"
8224 fi # $pass = dlpreopen
8226 if test -z "$libdir"; then
8227 # Link the convenience library
8228 if test lib = "$linkmode"; then
8229 deplibs="$dir/$old_library $deplibs"
8230 elif test prog,link = "$linkmode,$pass"; then
8231 compile_deplibs="$dir/$old_library $compile_deplibs"
8232 finalize_deplibs="$dir/$old_library $finalize_deplibs"
8234 deplibs="$lib $deplibs" # used for prog,scan pass
8240 if test prog = "$linkmode" && test link != "$pass"; then
8241 func_append newlib_search_path " $ladir"
8242 deplibs="$lib $deplibs"
8244 linkalldeplibs=false
8245 if test no != "$link_all_deplibs" || test -z "$library_names" ||
8246 test no = "$build_libtool_libs"; then
8251 for deplib in $dependency_libs; do
8253 -L*) func_stripname '-L' '' "$deplib"
8254 func_resolve_sysroot "$func_stripname_result"
8255 func_append newlib_search_path " $func_resolve_sysroot_result"
8258 # Need to link against all dependency_libs?
8259 if $linkalldeplibs; then
8260 deplibs="$deplib $deplibs"
8262 # Need to hardcode shared library paths
8263 # or/and link against static libraries
8264 newdependency_libs="$deplib $newdependency_libs"
8266 if $opt_preserve_dup_deps; then
8267 case "$tmp_libs " in
8268 *" $deplib "*) func_append specialdeplibs " $deplib" ;;
8271 func_append tmp_libs " $deplib"
8274 fi # $linkmode = prog...
8276 if test prog,link = "$linkmode,$pass"; then
8277 if test -n "$library_names" &&
8278 { { test no = "$prefer_static_libs" ||
8279 test built,yes = "$prefer_static_libs,$installed"; } ||
8280 test -z "$old_library"; }; then
8281 # We need to hardcode the library path
8282 if test -n "$shlibpath_var" && test -z "$avoidtemprpath"; then
8283 # Make sure the rpath contains only unique directories.
8284 case $temp_rpath: in
8286 *) func_append temp_rpath "$absdir:" ;;
8290 # Hardcode the library path.
8291 # Skip directories that are in the system default run-time
8293 case " $sys_lib_dlsearch_path " in
8296 case "$compile_rpath " in
8298 *) func_append compile_rpath " $absdir" ;;
8302 case " $sys_lib_dlsearch_path " in
8305 case "$finalize_rpath " in
8307 *) func_append finalize_rpath " $libdir" ;;
8311 fi # $linkmode,$pass = prog,link...
8314 { test pass_all = "$deplibs_check_method" ||
8315 { test yes = "$build_libtool_libs" &&
8316 test -n "$library_names"; }; }; then
8317 # We only need to search for static libraries
8322 link_static=no # Whether the deplib will be linked statically
8323 use_static_libs=$prefer_static_libs
8324 if test built = "$use_static_libs" && test yes = "$installed"; then
8327 if test -n "$library_names" &&
8328 { test no = "$use_static_libs" || test -z "$old_library"; }; then
8330 *cygwin* | *mingw* | *cegcc* | *os2*)
8331 # No point in relinking DLLs because paths are not encoded
8332 func_append notinst_deplibs " $lib"
8336 if test no = "$installed"; then
8337 func_append notinst_deplibs " $lib"
8342 # This is a shared library
8344 # Warn about portability, can't link against -module's on some
8345 # systems (darwin). Don't bleat about dlopened modules though!
8347 for dlpremoduletest in $dlprefiles; do
8348 if test "X$dlpremoduletest" = "X$lib"; then
8349 dlopenmodule=$dlpremoduletest
8353 if test -z "$dlopenmodule" && test yes = "$shouldnotlink" && test link = "$pass"; then
8355 if test prog = "$linkmode"; then
8356 $ECHO "*** Warning: Linking the executable $output against the loadable module"
8358 $ECHO "*** Warning: Linking the shared library $output against the loadable module"
8360 $ECHO "*** $linklib is not portable!"
8362 if test lib = "$linkmode" &&
8363 test yes = "$hardcode_into_libs"; then
8364 # Hardcode the library path.
8365 # Skip directories that are in the system default run-time
8367 case " $sys_lib_dlsearch_path " in
8370 case "$compile_rpath " in
8372 *) func_append compile_rpath " $absdir" ;;
8376 case " $sys_lib_dlsearch_path " in
8379 case "$finalize_rpath " in
8381 *) func_append finalize_rpath " $libdir" ;;
8387 if test -n "$old_archive_from_expsyms_cmds"; then
8388 # figure out the soname
8389 set dummy $library_names
8393 libname=`eval "\\$ECHO \"$libname_spec\""`
8394 # use dlname if we got it. it's perfectly good, no?
8395 if test -n "$dlname"; then
8397 elif test -n "$soname_spec"; then
8400 *cygwin* | mingw* | *cegcc* | *os2*)
8401 func_arith $current - $age
8402 major=$func_arith_result
8406 eval soname=\"$soname_spec\"
8411 # Make a new name for the extract_expsyms_cmds to use
8413 func_basename "$soroot"
8414 soname=$func_basename_result
8415 func_stripname 'lib' '.dll' "$soname"
8416 newlib=libimp-$func_stripname_result.a
8418 # If the library has no export list, then create one now
8419 if test -f "$output_objdir/$soname-def"; then :
8421 func_verbose "extracting exported symbol list from '$soname'"
8422 func_execute_cmds "$extract_expsyms_cmds" 'exit $?'
8426 if test -f "$output_objdir/$newlib"; then :; else
8427 func_verbose "generating import library for '$soname'"
8428 func_execute_cmds "$old_archive_from_expsyms_cmds" 'exit $?'
8430 # make sure the library variables are pointing to the new library
8433 fi # test -n "$old_archive_from_expsyms_cmds"
8435 if test prog = "$linkmode" || test relink != "$opt_mode"; then
8440 case $hardcode_action in
8441 immediate | unsupported)
8442 if test no = "$hardcode_direct"; then
8445 *-*-sco3.2v5.0.[024]*) add_dir=-L$dir ;;
8446 *-*-sysv4*uw2*) add_dir=-L$dir ;;
8447 *-*-sysv5OpenUNIX* | *-*-sysv5UnixWare7.[01].[10]* | \
8448 *-*-unixware7*) add_dir=-L$dir ;;
8450 # if the lib is a (non-dlopened) module then we cannot
8451 # link against it, someone is ignoring the earlier warnings
8452 if /usr/bin/file -L $add 2> /dev/null |
8453 $GREP ": [^:]* bundle" >/dev/null; then
8454 if test "X$dlopenmodule" != "X$lib"; then
8455 $ECHO "*** Warning: lib $linklib is a module, not a shared library"
8456 if test -z "$old_library"; then
8458 echo "*** And there doesn't seem to be a static archive available"
8459 echo "*** The link will probably fail, sorry"
8461 add=$dir/$old_library
8463 elif test -n "$old_library"; then
8464 add=$dir/$old_library
8468 elif test no = "$hardcode_minus_L"; then
8470 *-*-sunos*) add_shlibpath=$dir ;;
8474 elif test no = "$hardcode_shlibpath_var"; then
8482 if test yes = "$hardcode_direct" &&
8483 test no = "$hardcode_direct_absolute"; then
8485 elif test yes = "$hardcode_minus_L"; then
8487 # Try looking first in the location we're being installed to.
8488 if test -n "$inst_prefix_dir"; then
8491 func_append add_dir " -L$inst_prefix_dir$libdir"
8496 elif test yes = "$hardcode_shlibpath_var"; then
8506 if test yes != "$lib_linked"; then
8507 func_fatal_configuration "unsupported hardcode properties"
8510 if test -n "$add_shlibpath"; then
8511 case :$compile_shlibpath: in
8512 *":$add_shlibpath:"*) ;;
8513 *) func_append compile_shlibpath "$add_shlibpath:" ;;
8516 if test prog = "$linkmode"; then
8517 test -n "$add_dir" && compile_deplibs="$add_dir $compile_deplibs"
8518 test -n "$add" && compile_deplibs="$add $compile_deplibs"
8520 test -n "$add_dir" && deplibs="$add_dir $deplibs"
8521 test -n "$add" && deplibs="$add $deplibs"
8522 if test yes != "$hardcode_direct" &&
8523 test yes != "$hardcode_minus_L" &&
8524 test yes = "$hardcode_shlibpath_var"; then
8525 case :$finalize_shlibpath: in
8527 *) func_append finalize_shlibpath "$libdir:" ;;
8533 if test prog = "$linkmode" || test relink = "$opt_mode"; then
8537 # Finalize command for both is simple: just hardcode it.
8538 if test yes = "$hardcode_direct" &&
8539 test no = "$hardcode_direct_absolute"; then
8540 add=$libdir/$linklib
8541 elif test yes = "$hardcode_minus_L"; then
8544 elif test yes = "$hardcode_shlibpath_var"; then
8545 case :$finalize_shlibpath: in
8547 *) func_append finalize_shlibpath "$libdir:" ;;
8550 elif test yes = "$hardcode_automatic"; then
8551 if test -n "$inst_prefix_dir" &&
8552 test -f "$inst_prefix_dir$libdir/$linklib"; then
8553 add=$inst_prefix_dir$libdir/$linklib
8555 add=$libdir/$linklib
8558 # We cannot seem to hardcode it, guess we'll fake it.
8560 # Try looking first in the location we're being installed to.
8561 if test -n "$inst_prefix_dir"; then
8564 func_append add_dir " -L$inst_prefix_dir$libdir"
8571 if test prog = "$linkmode"; then
8572 test -n "$add_dir" && finalize_deplibs="$add_dir $finalize_deplibs"
8573 test -n "$add" && finalize_deplibs="$add $finalize_deplibs"
8575 test -n "$add_dir" && deplibs="$add_dir $deplibs"
8576 test -n "$add" && deplibs="$add $deplibs"
8579 elif test prog = "$linkmode"; then
8580 # Here we assume that one of hardcode_direct or hardcode_minus_L
8581 # is not unsupported. This is valid on all known static and
8583 if test unsupported != "$hardcode_direct"; then
8584 test -n "$old_library" && linklib=$old_library
8585 compile_deplibs="$dir/$linklib $compile_deplibs"
8586 finalize_deplibs="$dir/$linklib $finalize_deplibs"
8588 compile_deplibs="-l$name -L$dir $compile_deplibs"
8589 finalize_deplibs="-l$name -L$dir $finalize_deplibs"
8591 elif test yes = "$build_libtool_libs"; then
8592 # Not a shared library
8593 if test pass_all != "$deplibs_check_method"; then
8594 # We're trying link a shared library against a static one
8595 # but the system doesn't support it.
8597 # Just print a warning and add the library to dependency_libs so
8598 # that the program can be linked against the static library.
8600 $ECHO "*** Warning: This system cannot link to static lib archive $lib."
8601 echo "*** I have the capability to make that library automatically link in when"
8602 echo "*** you link to this library. But I can only do this if you have a"
8603 echo "*** shared version of the library, which you do not appear to have."
8604 if test yes = "$module"; then
8605 echo "*** But as you try to build a module library, libtool will still create "
8606 echo "*** a static module, that should work as long as the dlopening application"
8607 echo "*** is linked with the -dlopen flag to resolve symbols at runtime."
8608 if test -z "$global_symbol_pipe"; then
8610 echo "*** However, this would only work if libtool was able to extract symbol"
8611 echo "*** lists from a program, using 'nm' or equivalent, but libtool could"
8612 echo "*** not find such a program. So, this module is probably useless."
8613 echo "*** 'nm' from GNU binutils and a full rebuild may help."
8615 if test no = "$build_old_libs"; then
8616 build_libtool_libs=module
8619 build_libtool_libs=no
8623 deplibs="$dir/$old_library $deplibs"
8626 fi # link shared/static library?
8628 if test lib = "$linkmode"; then
8629 if test -n "$dependency_libs" &&
8630 { test yes != "$hardcode_into_libs" ||
8631 test yes = "$build_old_libs" ||
8632 test yes = "$link_static"; }; then
8633 # Extract -R from dependency_libs
8635 for libdir in $dependency_libs; do
8637 -R*) func_stripname '-R' '' "$libdir"
8638 temp_xrpath=$func_stripname_result
8640 *" $temp_xrpath "*) ;;
8641 *) func_append xrpath " $temp_xrpath";;
8643 *) func_append temp_deplibs " $libdir";;
8646 dependency_libs=$temp_deplibs
8649 func_append newlib_search_path " $absdir"
8650 # Link against this library
8651 test no = "$link_static" && newdependency_libs="$abs_ladir/$laname $newdependency_libs"
8652 # ... and its dependency_libs
8654 for deplib in $dependency_libs; do
8655 newdependency_libs="$deplib $newdependency_libs"
8657 -L*) func_stripname '-L' '' "$deplib"
8658 func_resolve_sysroot "$func_stripname_result";;
8659 *) func_resolve_sysroot "$deplib" ;;
8661 if $opt_preserve_dup_deps; then
8662 case "$tmp_libs " in
8663 *" $func_resolve_sysroot_result "*)
8664 func_append specialdeplibs " $func_resolve_sysroot_result" ;;
8667 func_append tmp_libs " $func_resolve_sysroot_result"
8670 if test no != "$link_all_deplibs"; then
8671 # Add the search paths of all dependency libraries
8672 for deplib in $dependency_libs; do
8675 -L*) path=$deplib ;;
8677 func_resolve_sysroot "$deplib"
8678 deplib=$func_resolve_sysroot_result
8679 func_dirname "$deplib" "" "."
8680 dir=$func_dirname_result
8681 # We need an absolute path.
8683 [\\/]* | [A-Za-z]:[\\/]*) absdir=$dir ;;
8685 absdir=`cd "$dir" && pwd`
8686 if test -z "$absdir"; then
8687 func_warning "cannot determine absolute directory name of '$dir'"
8692 if $GREP "^installed=no" $deplib > /dev/null; then
8696 eval deplibrary_names=`$SED -n -e 's/^library_names=\(.*\)$/\1/p' $deplib`
8697 if test -n "$deplibrary_names"; then
8698 for tmp in $deplibrary_names; do
8701 if test -f "$absdir/$objdir/$depdepl"; then
8702 depdepl=$absdir/$objdir/$depdepl
8703 darwin_install_name=`$OTOOL -L $depdepl | awk '{if (NR == 2) {print $1;exit}}'`
8704 if test -z "$darwin_install_name"; then
8705 darwin_install_name=`$OTOOL64 -L $depdepl | awk '{if (NR == 2) {print $1;exit}}'`
8707 func_append compiler_flags " $wl-dylib_file $wl$darwin_install_name:$depdepl"
8708 func_append linker_flags " -dylib_file $darwin_install_name:$depdepl"
8714 path=-L$absdir/$objdir
8718 eval libdir=`$SED -n -e 's/^libdir=\(.*\)$/\1/p' $deplib`
8719 test -z "$libdir" && \
8720 func_fatal_error "'$deplib' is not a valid libtool archive"
8721 test "$absdir" != "$libdir" && \
8722 func_warning "'$deplib' seems to be moved"
8728 case " $deplibs " in
8730 *) deplibs="$path $deplibs" ;;
8733 fi # link_all_deplibs != no
8735 done # for deplib in $libs
8736 if test link = "$pass"; then
8737 if test prog = "$linkmode"; then
8738 compile_deplibs="$new_inherited_linker_flags $compile_deplibs"
8739 finalize_deplibs="$new_inherited_linker_flags $finalize_deplibs"
8741 compiler_flags="$compiler_flags "`$ECHO " $new_inherited_linker_flags" | $SED 's% \([^ $]*\).ltframework% -framework \1%g'`
8744 dependency_libs=$newdependency_libs
8745 if test dlpreopen = "$pass"; then
8746 # Link the dlpreopened libraries before other libraries
8747 for deplib in $save_deplibs; do
8748 deplibs="$deplib $deplibs"
8751 if test dlopen != "$pass"; then
8752 test conv = "$pass" || {
8753 # Make sure lib_search_path contains only unique directories.
8755 for dir in $newlib_search_path; do
8756 case "$lib_search_path " in
8758 *) func_append lib_search_path " $dir" ;;
8764 if test prog,link = "$linkmode,$pass"; then
8765 vars="compile_deplibs finalize_deplibs"
8769 for var in $vars dependency_libs; do
8770 # Add libraries to $var in reverse order
8771 eval tmp_libs=\"\$$var\"
8773 for deplib in $tmp_libs; do
8774 # FIXME: Pedantically, this is the right thing to do, so
8775 # that some nasty dependency loop isn't accidentally
8777 #new_libs="$deplib $new_libs"
8778 # Pragmatically, this seems to cause very few problems in
8781 -L*) new_libs="$deplib $new_libs" ;;
8784 # And here is the reason: when a library appears more
8785 # than once as an explicit dependence of a library, or
8786 # is implicitly linked in more than once by the
8787 # compiler, it is considered special, and multiple
8788 # occurrences thereof are not removed. Compare this
8789 # with having the same library being listed as a
8790 # dependency of multiple other libraries: in this case,
8791 # we know (pedantically, we assume) the library does not
8792 # need to be listed more than once, so we keep only the
8793 # last copy. This is not always right, but it is rare
8794 # enough that we require users that really mean to play
8795 # such unportable linking tricks to link the library
8796 # using -Wl,-lname, so that libtool does not consider it
8797 # for duplicate removal.
8798 case " $specialdeplibs " in
8799 *" $deplib "*) new_libs="$deplib $new_libs" ;;
8801 case " $new_libs " in
8803 *) new_libs="$deplib $new_libs" ;;
8811 for deplib in $new_libs; do
8814 case " $tmp_libs " in
8816 *) func_append tmp_libs " $deplib" ;;
8819 *) func_append tmp_libs " $deplib" ;;
8822 eval $var=\"$tmp_libs\"
8826 # Add Sun CC postdeps if required:
8827 test CXX = "$tagname" && {
8830 case `$CC -V 2>&1 | sed 5q` in
8831 *Sun\ C*) # Sun C++ 5.9
8834 if test no != "$suncc_use_cstd_abi"; then
8835 func_append postdeps ' -library=Cstd -library=Crun'
8842 func_cc_basename "$CC"
8843 case $func_cc_basename_result in
8847 if test no != "$suncc_use_cstd_abi"; then
8848 func_append postdeps ' -library=Cstd -library=Crun'
8856 # Last step: remove runtime libs from dependency_libs
8857 # (they stay in deplibs)
8859 for i in $dependency_libs; do
8860 case " $predeps $postdeps $compiler_lib_search_path " in
8865 if test -n "$i"; then
8866 func_append tmp_libs " $i"
8869 dependency_libs=$tmp_libs
8871 if test prog = "$linkmode"; then
8874 if test prog = "$linkmode" || test lib = "$linkmode"; then
8875 dlprefiles=$newdlprefiles
8880 if test -n "$dlfiles$dlprefiles" || test no != "$dlself"; then
8881 func_warning "'-dlopen' is ignored for archives"
8886 func_warning "'-l' and '-L' are ignored for archives" ;;
8889 test -n "$rpath" && \
8890 func_warning "'-rpath' is ignored for archives"
8892 test -n "$xrpath" && \
8893 func_warning "'-R' is ignored for archives"
8895 test -n "$vinfo" && \
8896 func_warning "'-version-info/-version-number' is ignored for archives"
8898 test -n "$release" && \
8899 func_warning "'-release' is ignored for archives"
8901 test -n "$export_symbols$export_symbols_regex" && \
8902 func_warning "'-export-symbols' is ignored for archives"
8904 # Now set the variables for building old libraries.
8905 build_libtool_libs=no
8907 func_append objs "$old_deplibs"
8911 # Make sure we only generate libraries of the form 'libNAME.la'.
8914 func_stripname 'lib' '.la' "$outputname"
8915 name=$func_stripname_result
8916 eval shared_ext=\"$shrext_cmds\"
8917 eval libname=\"$libname_spec\"
8920 test no = "$module" \
8921 && func_fatal_help "libtool library '$output' must begin with 'lib'"
8923 if test no != "$need_lib_prefix"; then
8924 # Add the "lib" prefix for modules if required
8925 func_stripname '' '.la' "$outputname"
8926 name=$func_stripname_result
8927 eval shared_ext=\"$shrext_cmds\"
8928 eval libname=\"$libname_spec\"
8930 func_stripname '' '.la' "$outputname"
8931 libname=$func_stripname_result
8936 if test -n "$objs"; then
8937 if test pass_all != "$deplibs_check_method"; then
8938 func_fatal_error "cannot build libtool library '$output' from non-libtool objects on this host:$objs"
8941 $ECHO "*** Warning: Linking the shared library $output against the non-libtool"
8942 $ECHO "*** objects $objs is not portable!"
8943 func_append libobjs " $objs"
8947 test no = "$dlself" \
8948 || func_warning "'-dlopen self' is ignored for libtool libraries"
8953 && func_warning "ignoring multiple '-rpath's for a libtool library"
8958 if test -z "$rpath"; then
8959 if test yes = "$build_libtool_libs"; then
8960 # Building a libtool convenience library.
8961 # Some compilers have problems with a '.al' extension so
8962 # convenience libraries should have the same extension an
8963 # archive normally would.
8964 oldlibs="$output_objdir/$libname.$libext $oldlibs"
8965 build_libtool_libs=convenience
8969 test -n "$vinfo" && \
8970 func_warning "'-version-info/-version-number' is ignored for convenience libraries"
8972 test -n "$release" && \
8973 func_warning "'-release' is ignored for convenience libraries"
8976 # Parse the version information argument.
8977 save_ifs=$IFS; IFS=:
8978 set dummy $vinfo 0 0 0
8983 func_fatal_help "too many parameters to '-version-info'"
8985 # convert absolute version numbers to libtool ages
8986 # this retains compatibility with .la files and attempts
8987 # to make the code below a bit more comprehensible
8989 case $vinfo_number in
8995 # There are really only two kinds -- those that
8996 # use the current revision as the major version
8997 # and those that subtract age and use age as
8998 # a minor version. But, then there is irix
8999 # that has an extra 1 added just for fun
9001 case $version_type in
9002 # correct linux to gnu/linux during the next big refactor
9003 darwin|freebsd-elf|linux|osf|windows|none)
9004 func_arith $number_major + $number_minor
9005 current=$func_arith_result
9007 revision=$number_revision
9009 freebsd-aout|qnx|sunos)
9010 current=$number_major
9011 revision=$number_minor
9015 func_arith $number_major + $number_minor
9016 current=$func_arith_result
9018 revision=$number_minor
9019 lt_irix_increment=no
9022 func_fatal_configuration "$modename: unknown library version type '$version_type'"
9033 # Check that each of the things are valid numbers.
9035 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]) ;;
9037 func_error "CURRENT '$current' must be a nonnegative integer"
9038 func_fatal_error "'$vinfo' is not valid version information"
9043 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]) ;;
9045 func_error "REVISION '$revision' must be a nonnegative integer"
9046 func_fatal_error "'$vinfo' is not valid version information"
9051 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]) ;;
9053 func_error "AGE '$age' must be a nonnegative integer"
9054 func_fatal_error "'$vinfo' is not valid version information"
9058 if test "$age" -gt "$current"; then
9059 func_error "AGE '$age' is greater than the current interface number '$current'"
9060 func_fatal_error "'$vinfo' is not valid version information"
9063 # Calculate the version variables.
9067 case $version_type in
9071 # Like Linux, but with the current version available in
9072 # verstring for coding it into the library header
9073 func_arith $current - $age
9074 major=.$func_arith_result
9075 versuffix=$major.$age.$revision
9076 # Darwin ld doesn't like 0 for these options...
9077 func_arith $current + 1
9078 minor_current=$func_arith_result
9079 xlcverstring="$wl-compatibility_version $wl$minor_current $wl-current_version $wl$minor_current.$revision"
9080 verstring="-compatibility_version $minor_current -current_version $minor_current.$revision"
9081 # On Darwin other compilers
9084 verstring="$wl-compatibility_version $wl$minor_current $wl-current_version $wl$minor_current.$revision"
9087 verstring="-compatibility_version $minor_current -current_version $minor_current.$revision"
9094 versuffix=.$current.$revision
9098 func_arith $current - $age
9099 major=.$func_arith_result
9100 versuffix=$major.$age.$revision
9104 if test no = "$lt_irix_increment"; then
9105 func_arith $current - $age
9107 func_arith $current - $age + 1
9109 major=$func_arith_result
9111 case $version_type in
9112 nonstopux) verstring_prefix=nonstopux ;;
9113 *) verstring_prefix=sgi ;;
9115 verstring=$verstring_prefix$major.$revision
9117 # Add in all the interfaces that we are compatible with.
9119 while test 0 -ne "$loop"; do
9120 func_arith $revision - $loop
9121 iface=$func_arith_result
9122 func_arith $loop - 1
9123 loop=$func_arith_result
9124 verstring=$verstring_prefix$major.$iface:$verstring
9127 # Before this point, $major must not contain '.'.
9129 versuffix=$major.$revision
9132 linux) # correct to gnu/linux during the next big refactor
9133 func_arith $current - $age
9134 major=.$func_arith_result
9135 versuffix=$major.$age.$revision
9139 func_arith $current - $age
9140 major=.$func_arith_result
9141 versuffix=.$current.$age.$revision
9142 verstring=$current.$age.$revision
9144 # Add in all the interfaces that we are compatible with.
9146 while test 0 -ne "$loop"; do
9147 func_arith $current - $loop
9148 iface=$func_arith_result
9149 func_arith $loop - 1
9150 loop=$func_arith_result
9151 verstring=$verstring:$iface.0
9154 # Make executables depend on our current version.
9155 func_append verstring ":$current.0"
9170 versuffix=.$current.$revision
9174 # Use '-' rather than '.', since we only want one
9175 # extension on DOS 8.3 file systems.
9176 func_arith $current - $age
9177 major=$func_arith_result
9182 func_fatal_configuration "unknown library version type '$version_type'"
9186 # Clear the version info if we defaulted, and they specified a release.
9187 if test -z "$vinfo" && test -n "$release"; then
9189 case $version_type in
9191 # we can't check for "0.0" in archive_cmds due to quoting
9192 # problems, so we reset it completely
9199 if test no = "$need_version"; then
9206 # Remove version info from name if versioning should be avoided
9207 if test yes,no = "$avoid_version,$need_version"; then
9213 # Check to see if the archive will have undefined symbols.
9214 if test yes = "$allow_undefined"; then
9215 if test unsupported = "$allow_undefined_flag"; then
9216 if test yes = "$build_old_libs"; then
9217 func_warning "undefined symbols not allowed in $host shared libraries; building static only"
9218 build_libtool_libs=no
9220 func_fatal_error "can't build $host shared library unless -no-undefined is specified"
9224 # Don't allow undefined symbols.
9225 allow_undefined_flag=$no_undefined_flag
9230 func_generate_dlsyms "$libname" "$libname" :
9231 func_append libobjs " $symfileobj"
9232 test " " = "$libobjs" && libobjs=
9234 if test relink != "$opt_mode"; then
9235 # Remove our outputs, but don't remove object files since they
9236 # may have been created when compiling PIC objects.
9238 tempremovelist=`$ECHO "$output_objdir/*"`
9239 for p in $tempremovelist; do
9243 $output_objdir/$outputname | $output_objdir/$libname.* | $output_objdir/$libname$release.*)
9244 if test -n "$precious_files_regex"; then
9245 if $ECHO "$p" | $EGREP -e "$precious_files_regex" >/dev/null 2>&1
9250 func_append removelist " $p"
9255 test -n "$removelist" && \
9256 func_show_eval "${RM}r \$removelist"
9259 # Now set the variables for building old libraries.
9260 if test yes = "$build_old_libs" && test convenience != "$build_libtool_libs"; then
9261 func_append oldlibs " $output_objdir/$libname.$libext"
9263 # Transform .lo files to .o files.
9264 oldobjs="$objs "`$ECHO "$libobjs" | $SP2NL | $SED "/\.$libext$/d; $lo2o" | $NL2SP`
9267 # Eliminate all temporary directories.
9268 #for path in $notinst_path; do
9269 # lib_search_path=`$ECHO "$lib_search_path " | $SED "s% $path % %g"`
9270 # deplibs=`$ECHO "$deplibs " | $SED "s% -L$path % %g"`
9271 # dependency_libs=`$ECHO "$dependency_libs " | $SED "s% -L$path % %g"`
9274 if test -n "$xrpath"; then
9275 # If the user specified any rpath flags, then add them.
9277 for libdir in $xrpath; do
9278 func_replace_sysroot "$libdir"
9279 func_append temp_xrpath " -R$func_replace_sysroot_result"
9280 case "$finalize_rpath " in
9282 *) func_append finalize_rpath " $libdir" ;;
9285 if test yes != "$hardcode_into_libs" || test yes = "$build_old_libs"; then
9286 dependency_libs="$temp_xrpath $dependency_libs"
9290 # Make sure dlfiles contains only unique files that won't be dlpreopened
9291 old_dlfiles=$dlfiles
9293 for lib in $old_dlfiles; do
9294 case " $dlprefiles $dlfiles " in
9296 *) func_append dlfiles " $lib" ;;
9300 # Make sure dlprefiles contains only unique files
9301 old_dlprefiles=$dlprefiles
9303 for lib in $old_dlprefiles; do
9304 case "$dlprefiles " in
9306 *) func_append dlprefiles " $lib" ;;
9310 if test yes = "$build_libtool_libs"; then
9311 if test -n "$rpath"; then
9313 *-*-cygwin* | *-*-mingw* | *-*-pw32* | *-*-os2* | *-*-beos* | *-cegcc* | *-*-haiku*)
9314 # these systems don't actually have a c library (as such)!
9316 *-*-rhapsody* | *-*-darwin1.[012])
9317 # Rhapsody C library is in the System framework
9318 func_append deplibs " System.ltframework"
9321 # Don't link with libc until the a.out ld.so is fixed.
9323 *-*-openbsd* | *-*-freebsd* | *-*-dragonfly*)
9324 # Do not include libc due to us having libc/libc_r.
9326 *-*-sco3.2v5* | *-*-sco5v6*)
9327 # Causes problems with __ctype
9329 *-*-sysv4.2uw2* | *-*-sysv5* | *-*-unixware* | *-*-OpenUNIX*)
9330 # Compiler inserts libc in the correct place for threads to work
9333 # Add libc to deplibs on all other systems if necessary.
9334 if test yes = "$build_libtool_need_lc"; then
9335 func_append deplibs " -lc"
9341 # Transform deplibs into only deplibs that can be linked in shared.
9343 libname_save=$libname
9344 release_save=$release
9345 versuffix_save=$versuffix
9347 # I'm not sure if I'm treating the release correctly. I think
9348 # release should show up in the -l (ie -lgmp5) so we don't want to
9349 # add it in twice. Is that correct?
9355 case $deplibs_check_method in
9357 # Don't check for shared/static. Everything works.
9358 # This might be a little naive. We might want to check
9359 # whether the library exists or not. But this is on
9360 # osf3 & osf4 and I'm not really sure... Just
9361 # implementing what was already the behavior.
9365 # This code stresses the "libraries are programs" paradigm to its
9366 # limits. Maybe even breaks it. We compile a program, linking it
9367 # against the deplibs as a proxy for the library. Then we can check
9368 # whether they linked in statically or dynamically with ldd.
9369 $opt_dry_run || $RM conftest.c
9370 cat > conftest.c <<EOF
9371 int main() { return 0; }
9373 $opt_dry_run || $RM conftest
9374 if $LTCC $LTCFLAGS -o conftest conftest.c $deplibs; then
9375 ldd_output=`ldd conftest`
9376 for i in $deplibs; do
9379 func_stripname -l '' "$i"
9380 name=$func_stripname_result
9381 if test yes = "$allow_libtool_libs_with_static_runtimes"; then
9382 case " $predeps $postdeps " in
9384 func_append newdeplibs " $i"
9389 if test -n "$i"; then
9390 libname=`eval "\\$ECHO \"$libname_spec\""`
9391 deplib_matches=`eval "\\$ECHO \"$library_names_spec\""`
9392 set dummy $deplib_matches; shift
9394 if test `expr "$ldd_output" : ".*$deplib_match"` -ne 0; then
9395 func_append newdeplibs " $i"
9399 $ECHO "*** Warning: dynamic linker does not accept needed library $i."
9400 echo "*** I have the capability to make that library automatically link in when"
9401 echo "*** you link to this library. But I can only do this if you have a"
9402 echo "*** shared version of the library, which I believe you do not have"
9403 echo "*** because a test_compile did reveal that the linker did not use it for"
9404 echo "*** its dynamic dependency list that programs get resolved with at runtime."
9409 func_append newdeplibs " $i"
9414 # Error occurred in the first compile. Let's try to salvage
9415 # the situation: Compile a separate program for each library.
9416 for i in $deplibs; do
9419 func_stripname -l '' "$i"
9420 name=$func_stripname_result
9421 $opt_dry_run || $RM conftest
9422 if $LTCC $LTCFLAGS -o conftest conftest.c $i; then
9423 ldd_output=`ldd conftest`
9424 if test yes = "$allow_libtool_libs_with_static_runtimes"; then
9425 case " $predeps $postdeps " in
9427 func_append newdeplibs " $i"
9432 if test -n "$i"; then
9433 libname=`eval "\\$ECHO \"$libname_spec\""`
9434 deplib_matches=`eval "\\$ECHO \"$library_names_spec\""`
9435 set dummy $deplib_matches; shift
9437 if test `expr "$ldd_output" : ".*$deplib_match"` -ne 0; then
9438 func_append newdeplibs " $i"
9442 $ECHO "*** Warning: dynamic linker does not accept needed library $i."
9443 echo "*** I have the capability to make that library automatically link in when"
9444 echo "*** you link to this library. But I can only do this if you have a"
9445 echo "*** shared version of the library, which you do not appear to have"
9446 echo "*** because a test_compile did reveal that the linker did not use this one"
9447 echo "*** as a dynamic dependency that programs can get resolved with at runtime."
9453 $ECHO "*** Warning! Library $i is needed by this library but I was not able to"
9454 echo "*** make it link in! You will probably need to install it or some"
9455 echo "*** library that it depends on before this library will be fully"
9456 echo "*** functional. Installing it before continuing would be even better."
9460 func_append newdeplibs " $i"
9467 set dummy $deplibs_check_method; shift
9468 file_magic_regex=`expr "$deplibs_check_method" : "$1 \(.*\)"`
9469 for a_deplib in $deplibs; do
9472 func_stripname -l '' "$a_deplib"
9473 name=$func_stripname_result
9474 if test yes = "$allow_libtool_libs_with_static_runtimes"; then
9475 case " $predeps $postdeps " in
9477 func_append newdeplibs " $a_deplib"
9482 if test -n "$a_deplib"; then
9483 libname=`eval "\\$ECHO \"$libname_spec\""`
9484 if test -n "$file_magic_glob"; then
9485 libnameglob=`func_echo_all "$libname" | $SED -e $file_magic_glob`
9487 libnameglob=$libname
9489 test yes = "$want_nocaseglob" && nocaseglob=`shopt -p nocaseglob`
9490 for i in $lib_search_path $sys_lib_search_path $shlib_search_path; do
9491 if test yes = "$want_nocaseglob"; then
9493 potential_libs=`ls $i/$libnameglob[.-]* 2>/dev/null`
9496 potential_libs=`ls $i/$libnameglob[.-]* 2>/dev/null`
9498 for potent_lib in $potential_libs; do
9499 # Follow soft links.
9500 if ls -lLd "$potent_lib" 2>/dev/null |
9501 $GREP " -> " >/dev/null; then
9504 # The statement above tries to avoid entering an
9505 # endless loop below, in case of cyclic links.
9506 # We might still enter an endless loop, since a link
9507 # loop can be closed while we follow links,
9510 while test -h "$potlib" 2>/dev/null; do
9511 potliblink=`ls -ld $potlib | $SED 's/.* -> //'`
9513 [\\/]* | [A-Za-z]:[\\/]*) potlib=$potliblink;;
9514 *) potlib=`$ECHO "$potlib" | $SED 's|[^/]*$||'`"$potliblink";;
9517 if eval $file_magic_cmd \"\$potlib\" 2>/dev/null |
9519 $EGREP "$file_magic_regex" > /dev/null; then
9520 func_append newdeplibs " $a_deplib"
9527 if test -n "$a_deplib"; then
9530 $ECHO "*** Warning: linker path does not have real file for library $a_deplib."
9531 echo "*** I have the capability to make that library automatically link in when"
9532 echo "*** you link to this library. But I can only do this if you have a"
9533 echo "*** shared version of the library, which you do not appear to have"
9534 echo "*** because I did check the linker path looking for a file starting"
9535 if test -z "$potlib"; then
9536 $ECHO "*** with $libname but no candidates were found. (...for file magic test)"
9538 $ECHO "*** with $libname and none of the candidates passed a file format test"
9539 $ECHO "*** using a file magic. Last file checked: $potlib"
9544 # Add a -L argument.
9545 func_append newdeplibs " $a_deplib"
9548 done # Gone through all deplibs.
9551 set dummy $deplibs_check_method; shift
9552 match_pattern_regex=`expr "$deplibs_check_method" : "$1 \(.*\)"`
9553 for a_deplib in $deplibs; do
9556 func_stripname -l '' "$a_deplib"
9557 name=$func_stripname_result
9558 if test yes = "$allow_libtool_libs_with_static_runtimes"; then
9559 case " $predeps $postdeps " in
9561 func_append newdeplibs " $a_deplib"
9566 if test -n "$a_deplib"; then
9567 libname=`eval "\\$ECHO \"$libname_spec\""`
9568 for i in $lib_search_path $sys_lib_search_path $shlib_search_path; do
9569 potential_libs=`ls $i/$libname[.-]* 2>/dev/null`
9570 for potent_lib in $potential_libs; do
9571 potlib=$potent_lib # see symlink-check above in file_magic test
9572 if eval "\$ECHO \"$potent_lib\"" 2>/dev/null | $SED 10q | \
9573 $EGREP "$match_pattern_regex" > /dev/null; then
9574 func_append newdeplibs " $a_deplib"
9581 if test -n "$a_deplib"; then
9584 $ECHO "*** Warning: linker path does not have real file for library $a_deplib."
9585 echo "*** I have the capability to make that library automatically link in when"
9586 echo "*** you link to this library. But I can only do this if you have a"
9587 echo "*** shared version of the library, which you do not appear to have"
9588 echo "*** because I did check the linker path looking for a file starting"
9589 if test -z "$potlib"; then
9590 $ECHO "*** with $libname but no candidates were found. (...for regex pattern test)"
9592 $ECHO "*** with $libname and none of the candidates passed a file format test"
9593 $ECHO "*** using a regex pattern. Last file checked: $potlib"
9598 # Add a -L argument.
9599 func_append newdeplibs " $a_deplib"
9602 done # Gone through all deplibs.
9606 tmp_deplibs=`$ECHO " $deplibs" | $SED 's/ -lc$//; s/ -[LR][^ ]*//g'`
9607 if test yes = "$allow_libtool_libs_with_static_runtimes"; then
9608 for i in $predeps $postdeps; do
9609 # can't use Xsed below, because $i might contain '/'
9610 tmp_deplibs=`$ECHO " $tmp_deplibs" | $SED "s|$i||"`
9613 case $tmp_deplibs in
9616 if test none = "$deplibs_check_method"; then
9617 echo "*** Warning: inter-library dependencies are not supported in this platform."
9619 echo "*** Warning: inter-library dependencies are not known to be supported."
9621 echo "*** All declared inter-library dependencies are being dropped."
9627 versuffix=$versuffix_save
9629 release=$release_save
9630 libname=$libname_save
9634 *-*-rhapsody* | *-*-darwin1.[012])
9635 # On Rhapsody replace the C library with the System framework
9636 newdeplibs=`$ECHO " $newdeplibs" | $SED 's/ -lc / System.ltframework /'`
9640 if test yes = "$droppeddeps"; then
9641 if test yes = "$module"; then
9643 echo "*** Warning: libtool could not satisfy all declared inter-library"
9644 $ECHO "*** dependencies of module $libname. Therefore, libtool will create"
9645 echo "*** a static module, that should work as long as the dlopening"
9646 echo "*** application is linked with the -dlopen flag."
9647 if test -z "$global_symbol_pipe"; then
9649 echo "*** However, this would only work if libtool was able to extract symbol"
9650 echo "*** lists from a program, using 'nm' or equivalent, but libtool could"
9651 echo "*** not find such a program. So, this module is probably useless."
9652 echo "*** 'nm' from GNU binutils and a full rebuild may help."
9654 if test no = "$build_old_libs"; then
9655 oldlibs=$output_objdir/$libname.$libext
9656 build_libtool_libs=module
9659 build_libtool_libs=no
9662 echo "*** The inter-library dependencies that have been dropped here will be"
9663 echo "*** automatically added whenever a program is linked with this library"
9664 echo "*** or is declared to -dlopen it."
9666 if test no = "$allow_undefined"; then
9668 echo "*** Since this library must not contain undefined symbols,"
9669 echo "*** because either the platform does not support them or"
9670 echo "*** it was explicitly requested with -no-undefined,"
9671 echo "*** libtool will only create a static version of it."
9672 if test no = "$build_old_libs"; then
9673 oldlibs=$output_objdir/$libname.$libext
9674 build_libtool_libs=module
9677 build_libtool_libs=no
9682 # Done checking deplibs!
9685 # Time to change all our "foo.ltframework" stuff back to "-framework foo"
9688 newdeplibs=`$ECHO " $newdeplibs" | $SED 's% \([^ $]*\).ltframework% -framework \1%g'`
9689 new_inherited_linker_flags=`$ECHO " $new_inherited_linker_flags" | $SED 's% \([^ $]*\).ltframework% -framework \1%g'`
9690 deplibs=`$ECHO " $deplibs" | $SED 's% \([^ $]*\).ltframework% -framework \1%g'`
9694 # move library search paths that coincide with paths to not yet
9695 # installed libraries to the beginning of the library search list
9697 for path in $notinst_path; do
9698 case " $new_libs " in
9699 *" -L$path/$objdir "*) ;;
9701 case " $deplibs " in
9702 *" -L$path/$objdir "*)
9703 func_append new_libs " -L$path/$objdir" ;;
9708 for deplib in $deplibs; do
9711 case " $new_libs " in
9713 *) func_append new_libs " $deplib" ;;
9716 *) func_append new_libs " $deplib" ;;
9721 # All the library-specific variables (install_libdir is set above).
9726 # Test again, we may have decided not to build it any more
9727 if test yes = "$build_libtool_libs"; then
9728 # Remove $wl instances when linking with ld.
9729 # FIXME: should test the right _cmds variable.
9730 case $archive_cmds in
9733 if test yes = "$hardcode_into_libs"; then
9734 # Hardcode the library paths
9737 rpath=$finalize_rpath
9738 test relink = "$opt_mode" || rpath=$compile_rpath$rpath
9739 for libdir in $rpath; do
9740 if test -n "$hardcode_libdir_flag_spec"; then
9741 if test -n "$hardcode_libdir_separator"; then
9742 func_replace_sysroot "$libdir"
9743 libdir=$func_replace_sysroot_result
9744 if test -z "$hardcode_libdirs"; then
9745 hardcode_libdirs=$libdir
9747 # Just accumulate the unique libdirs.
9748 case $hardcode_libdir_separator$hardcode_libdirs$hardcode_libdir_separator in
9749 *"$hardcode_libdir_separator$libdir$hardcode_libdir_separator"*)
9752 func_append hardcode_libdirs "$hardcode_libdir_separator$libdir"
9757 eval flag=\"$hardcode_libdir_flag_spec\"
9758 func_append dep_rpath " $flag"
9760 elif test -n "$runpath_var"; then
9761 case "$perm_rpath " in
9763 *) func_append perm_rpath " $libdir" ;;
9767 # Substitute the hardcoded libdirs into the rpath.
9768 if test -n "$hardcode_libdir_separator" &&
9769 test -n "$hardcode_libdirs"; then
9770 libdir=$hardcode_libdirs
9771 eval "dep_rpath=\"$hardcode_libdir_flag_spec\""
9773 if test -n "$runpath_var" && test -n "$perm_rpath"; then
9774 # We should set the runpath_var.
9776 for dir in $perm_rpath; do
9777 func_append rpath "$dir:"
9779 eval "$runpath_var='$rpath\$$runpath_var'; export $runpath_var"
9781 test -n "$dep_rpath" && deplibs="$dep_rpath $deplibs"
9784 shlibpath=$finalize_shlibpath
9785 test relink = "$opt_mode" || shlibpath=$compile_shlibpath$shlibpath
9786 if test -n "$shlibpath"; then
9787 eval "$shlibpath_var='$shlibpath\$$shlibpath_var'; export $shlibpath_var"
9790 # Get the real and link names of the library.
9791 eval shared_ext=\"$shrext_cmds\"
9792 eval library_names=\"$library_names_spec\"
9793 set dummy $library_names
9798 if test -n "$soname_spec"; then
9799 eval soname=\"$soname_spec\"
9803 if test -z "$dlname"; then
9807 lib=$output_objdir/$realname
9811 func_append linknames " $link"
9814 # Use standard objects if they are pic
9815 test -z "$pic_flag" && libobjs=`$ECHO "$libobjs" | $SP2NL | $SED "$lo2o" | $NL2SP`
9816 test "X$libobjs" = "X " && libobjs=
9819 if test -n "$export_symbols" && test -n "$include_expsyms"; then
9820 $opt_dry_run || cp "$export_symbols" "$output_objdir/$libname.uexp"
9821 export_symbols=$output_objdir/$libname.uexp
9822 func_append delfiles " $export_symbols"
9825 orig_export_symbols=
9827 cygwin* | mingw* | cegcc*)
9828 if test -n "$export_symbols" && test -z "$export_symbols_regex"; then
9829 # exporting using user supplied symfile
9830 func_dll_def_p "$export_symbols" || {
9831 # and it's NOT already a .def file. Must figure out
9832 # which of the given symbols are data symbols and tag
9833 # them as such. So, trigger use of export_symbols_cmds.
9834 # export_symbols gets reassigned inside the "prepare
9835 # the list of exported symbols" if statement, so the
9836 # include_expsyms logic still works.
9837 orig_export_symbols=$export_symbols
9839 always_export_symbols=yes
9845 # Prepare the list of exported symbols
9846 if test -z "$export_symbols"; then
9847 if test yes = "$always_export_symbols" || test -n "$export_symbols_regex"; then
9848 func_verbose "generating symbol list for '$libname.la'"
9849 export_symbols=$output_objdir/$libname.exp
9850 $opt_dry_run || $RM $export_symbols
9851 cmds=$export_symbols_cmds
9852 save_ifs=$IFS; IFS='~'
9853 for cmd1 in $cmds; do
9855 # Take the normal branch if the nm_file_list_spec branch
9856 # doesn't work or if tool conversion is not needed.
9857 case $nm_file_list_spec~$to_tool_file_cmd in
9858 *~func_convert_file_noop | *~func_convert_file_msys_to_w32 | ~*)
9859 try_normal_branch=yes
9862 len=$func_len_result
9865 try_normal_branch=no
9868 if test yes = "$try_normal_branch" \
9869 && { test "$len" -lt "$max_cmd_len" \
9870 || test "$max_cmd_len" -le -1; }
9872 func_show_eval "$cmd" 'exit $?'
9873 skipped_export=false
9874 elif test -n "$nm_file_list_spec"; then
9875 func_basename "$output"
9876 output_la=$func_basename_result
9877 save_libobjs=$libobjs
9879 output=$output_objdir/$output_la.nm
9880 func_to_tool_file "$output"
9881 libobjs=$nm_file_list_spec$func_to_tool_file_result
9882 func_append delfiles " $output"
9883 func_verbose "creating $NM input file list: $output"
9884 for obj in $save_libobjs; do
9885 func_to_tool_file "$obj"
9886 $ECHO "$func_to_tool_file_result"
9889 func_show_eval "$cmd" 'exit $?'
9891 libobjs=$save_libobjs
9892 skipped_export=false
9894 # The command line is too long to execute in one step.
9895 func_verbose "using reloadable object file for export list..."
9897 # Break out early, otherwise skipped_export may be
9898 # set to false by a later but shorter cmd.
9903 if test -n "$export_symbols_regex" && test : != "$skipped_export"; then
9904 func_show_eval '$EGREP -e "$export_symbols_regex" "$export_symbols" > "${export_symbols}T"'
9905 func_show_eval '$MV "${export_symbols}T" "$export_symbols"'
9910 if test -n "$export_symbols" && test -n "$include_expsyms"; then
9911 tmp_export_symbols=$export_symbols
9912 test -n "$orig_export_symbols" && tmp_export_symbols=$orig_export_symbols
9913 $opt_dry_run || eval '$ECHO "$include_expsyms" | $SP2NL >> "$tmp_export_symbols"'
9916 if test : != "$skipped_export" && test -n "$orig_export_symbols"; then
9917 # The given exports_symbols file has to be filtered, so filter it.
9918 func_verbose "filter symbol list for '$libname.la' to tag DATA exports"
9919 # FIXME: $output_objdir/$libname.filter potentially contains lots of
9920 # 's' commands, which not all seds can handle. GNU sed should be fine
9921 # though. Also, the filter scales superlinearly with the number of
9922 # global variables. join(1) would be nice here, but unfortunately
9923 # isn't a blessed tool.
9924 $opt_dry_run || $SED -e '/[ ,]DATA/!d;s,\(.*\)\([ \,].*\),s|^\1$|\1\2|,' < $export_symbols > $output_objdir/$libname.filter
9925 func_append delfiles " $export_symbols $output_objdir/$libname.filter"
9926 export_symbols=$output_objdir/$libname.def
9927 $opt_dry_run || $SED -f $output_objdir/$libname.filter < $orig_export_symbols > $export_symbols
9931 for test_deplib in $deplibs; do
9932 case " $convenience " in
9933 *" $test_deplib "*) ;;
9935 func_append tmp_deplibs " $test_deplib"
9939 deplibs=$tmp_deplibs
9941 if test -n "$convenience"; then
9942 if test -n "$whole_archive_flag_spec" &&
9943 test yes = "$compiler_needs_object" &&
9944 test -z "$libobjs"; then
9945 # extract the archives, so we have objects to list.
9946 # TODO: could optimize this to just extract one archive.
9947 whole_archive_flag_spec=
9949 if test -n "$whole_archive_flag_spec"; then
9950 save_libobjs=$libobjs
9951 eval libobjs=\"\$libobjs $whole_archive_flag_spec\"
9952 test "X$libobjs" = "X " && libobjs=
9954 gentop=$output_objdir/${outputname}x
9955 func_append generated " $gentop"
9957 func_extract_archives $gentop $convenience
9958 func_append libobjs " $func_extract_archives_result"
9959 test "X$libobjs" = "X " && libobjs=
9963 if test yes = "$thread_safe" && test -n "$thread_safe_flag_spec"; then
9964 eval flag=\"$thread_safe_flag_spec\"
9965 func_append linker_flags " $flag"
9968 # Make a backup of the uninstalled library when relinking
9969 if test relink = "$opt_mode"; then
9970 $opt_dry_run || eval '(cd $output_objdir && $RM ${realname}U && $MV $realname ${realname}U)' || exit $?
9973 # Do each of the archive commands.
9974 if test yes = "$module" && test -n "$module_cmds"; then
9975 if test -n "$export_symbols" && test -n "$module_expsym_cmds"; then
9976 eval test_cmds=\"$module_expsym_cmds\"
9977 cmds=$module_expsym_cmds
9979 eval test_cmds=\"$module_cmds\"
9983 if test -n "$export_symbols" && test -n "$archive_expsym_cmds"; then
9984 eval test_cmds=\"$archive_expsym_cmds\"
9985 cmds=$archive_expsym_cmds
9987 eval test_cmds=\"$archive_cmds\"
9992 if test : != "$skipped_export" &&
9993 func_len " $test_cmds" &&
9994 len=$func_len_result &&
9995 test "$len" -lt "$max_cmd_len" || test "$max_cmd_len" -le -1; then
9998 # The command line is too long to link in one step, link piecewise
9999 # or, if using GNU ld and skipped_export is not :, use a linker
10002 # Save the value of $output and $libobjs because we want to
10003 # use them later. If we have whole_archive_flag_spec, we
10004 # want to use save_libobjs as it was before
10005 # whole_archive_flag_spec was expanded, because we can't
10006 # assume the linker understands whole_archive_flag_spec.
10007 # This may have to be revisited, in case too many
10008 # convenience libraries get linked in and end up exceeding
10010 if test -z "$convenience" || test -z "$whole_archive_flag_spec"; then
10011 save_libobjs=$libobjs
10013 save_output=$output
10014 func_basename "$output"
10015 output_la=$func_basename_result
10017 # Clear the reloadable object creation command queue and
10018 # initialize k to one.
10025 if test -n "$save_libobjs" && test : != "$skipped_export" && test yes = "$with_gnu_ld"; then
10026 output=$output_objdir/$output_la.lnkscript
10027 func_verbose "creating GNU ld script: $output"
10028 echo 'INPUT (' > $output
10029 for obj in $save_libobjs
10031 func_to_tool_file "$obj"
10032 $ECHO "$func_to_tool_file_result" >> $output
10034 echo ')' >> $output
10035 func_append delfiles " $output"
10036 func_to_tool_file "$output"
10037 output=$func_to_tool_file_result
10038 elif test -n "$save_libobjs" && test : != "$skipped_export" && test -n "$file_list_spec"; then
10039 output=$output_objdir/$output_la.lnk
10040 func_verbose "creating linker input file list: $output"
10042 set x $save_libobjs
10045 if test yes = "$compiler_needs_object"; then
10051 func_to_tool_file "$obj"
10052 $ECHO "$func_to_tool_file_result" >> $output
10054 func_append delfiles " $output"
10055 func_to_tool_file "$output"
10056 output=$firstobj\"$file_list_spec$func_to_tool_file_result\"
10058 if test -n "$save_libobjs"; then
10059 func_verbose "creating reloadable object files..."
10060 output=$output_objdir/$output_la-$k.$objext
10061 eval test_cmds=\"$reload_cmds\"
10062 func_len " $test_cmds"
10063 len0=$func_len_result
10066 # Loop over the list of objects to be linked.
10067 for obj in $save_libobjs
10070 func_arith $len + $func_len_result
10071 len=$func_arith_result
10072 if test -z "$objlist" ||
10073 test "$len" -lt "$max_cmd_len"; then
10074 func_append objlist " $obj"
10076 # The command $test_cmds is almost too long, add a
10077 # command to the queue.
10078 if test 1 -eq "$k"; then
10079 # The first file doesn't have a previous command to add.
10080 reload_objs=$objlist
10081 eval concat_cmds=\"$reload_cmds\"
10083 # All subsequent reloadable object files will link in
10084 # the last one created.
10085 reload_objs="$objlist $last_robj"
10086 eval concat_cmds=\"\$concat_cmds~$reload_cmds~\$RM $last_robj\"
10088 last_robj=$output_objdir/$output_la-$k.$objext
10090 k=$func_arith_result
10091 output=$output_objdir/$output_la-$k.$objext
10093 func_len " $last_robj"
10094 func_arith $len0 + $func_len_result
10095 len=$func_arith_result
10098 # Handle the remaining objects by creating one last
10099 # reloadable object file. All subsequent reloadable object
10100 # files will link in the last one created.
10101 test -z "$concat_cmds" || concat_cmds=$concat_cmds~
10102 reload_objs="$objlist $last_robj"
10103 eval concat_cmds=\"\$concat_cmds$reload_cmds\"
10104 if test -n "$last_robj"; then
10105 eval concat_cmds=\"\$concat_cmds~\$RM $last_robj\"
10107 func_append delfiles " $output"
10113 ${skipped_export-false} && {
10114 func_verbose "generating symbol list for '$libname.la'"
10115 export_symbols=$output_objdir/$libname.exp
10116 $opt_dry_run || $RM $export_symbols
10118 # Append the command to create the export file.
10119 test -z "$concat_cmds" || concat_cmds=$concat_cmds~
10120 eval concat_cmds=\"\$concat_cmds$export_symbols_cmds\"
10121 if test -n "$last_robj"; then
10122 eval concat_cmds=\"\$concat_cmds~\$RM $last_robj\"
10126 test -n "$save_libobjs" &&
10127 func_verbose "creating a temporary reloadable object file: $output"
10129 # Loop through the commands generated above and execute them.
10130 save_ifs=$IFS; IFS='~'
10131 for cmd in $concat_cmds; do
10134 func_quote_arg expand,pretty "$cmd"
10135 eval "func_echo $func_quote_arg_result"
10137 $opt_dry_run || eval "$cmd" || {
10140 # Restore the uninstalled library and exit
10141 if test relink = "$opt_mode"; then
10142 ( cd "$output_objdir" && \
10143 $RM "${realname}T" && \
10144 $MV "${realname}U" "$realname" )
10152 if test -n "$export_symbols_regex" && ${skipped_export-false}; then
10153 func_show_eval '$EGREP -e "$export_symbols_regex" "$export_symbols" > "${export_symbols}T"'
10154 func_show_eval '$MV "${export_symbols}T" "$export_symbols"'
10158 ${skipped_export-false} && {
10159 if test -n "$export_symbols" && test -n "$include_expsyms"; then
10160 tmp_export_symbols=$export_symbols
10161 test -n "$orig_export_symbols" && tmp_export_symbols=$orig_export_symbols
10162 $opt_dry_run || eval '$ECHO "$include_expsyms" | $SP2NL >> "$tmp_export_symbols"'
10165 if test -n "$orig_export_symbols"; then
10166 # The given exports_symbols file has to be filtered, so filter it.
10167 func_verbose "filter symbol list for '$libname.la' to tag DATA exports"
10168 # FIXME: $output_objdir/$libname.filter potentially contains lots of
10169 # 's' commands, which not all seds can handle. GNU sed should be fine
10170 # though. Also, the filter scales superlinearly with the number of
10171 # global variables. join(1) would be nice here, but unfortunately
10172 # isn't a blessed tool.
10173 $opt_dry_run || $SED -e '/[ ,]DATA/!d;s,\(.*\)\([ \,].*\),s|^\1$|\1\2|,' < $export_symbols > $output_objdir/$libname.filter
10174 func_append delfiles " $export_symbols $output_objdir/$libname.filter"
10175 export_symbols=$output_objdir/$libname.def
10176 $opt_dry_run || $SED -f $output_objdir/$libname.filter < $orig_export_symbols > $export_symbols
10181 # Restore the value of output.
10182 output=$save_output
10184 if test -n "$convenience" && test -n "$whole_archive_flag_spec"; then
10185 eval libobjs=\"\$libobjs $whole_archive_flag_spec\"
10186 test "X$libobjs" = "X " && libobjs=
10188 # Expand the library linking commands again to reset the
10189 # value of $libobjs for piecewise linking.
10191 # Do each of the archive commands.
10192 if test yes = "$module" && test -n "$module_cmds"; then
10193 if test -n "$export_symbols" && test -n "$module_expsym_cmds"; then
10194 cmds=$module_expsym_cmds
10199 if test -n "$export_symbols" && test -n "$archive_expsym_cmds"; then
10200 cmds=$archive_expsym_cmds
10207 if test -n "$delfiles"; then
10208 # Append the command to remove temporary files to $cmds.
10209 eval cmds=\"\$cmds~\$RM $delfiles\"
10212 # Add any objects from preloaded convenience libraries
10213 if test -n "$dlprefiles"; then
10214 gentop=$output_objdir/${outputname}x
10215 func_append generated " $gentop"
10217 func_extract_archives $gentop $dlprefiles
10218 func_append libobjs " $func_extract_archives_result"
10219 test "X$libobjs" = "X " && libobjs=
10222 save_ifs=$IFS; IFS='~'
10223 for cmd in $cmds; do
10228 func_quote_arg expand,pretty "$cmd"
10229 eval "func_echo $func_quote_arg_result"
10231 $opt_dry_run || eval "$cmd" || {
10234 # Restore the uninstalled library and exit
10235 if test relink = "$opt_mode"; then
10236 ( cd "$output_objdir" && \
10237 $RM "${realname}T" && \
10238 $MV "${realname}U" "$realname" )
10246 # Restore the uninstalled library and exit
10247 if test relink = "$opt_mode"; then
10248 $opt_dry_run || eval '(cd $output_objdir && $RM ${realname}T && $MV $realname ${realname}T && $MV ${realname}U $realname)' || exit $?
10250 if test -n "$convenience"; then
10251 if test -z "$whole_archive_flag_spec"; then
10252 func_show_eval '${RM}r "$gentop"'
10259 # Create links to the real library.
10260 for linkname in $linknames; do
10261 if test "$realname" != "$linkname"; then
10262 func_show_eval '(cd "$output_objdir" && $RM "$linkname" && $LN_S "$realname" "$linkname")' 'exit $?'
10266 # If -module or -export-dynamic was specified, set the dlname.
10267 if test yes = "$module" || test yes = "$export_dynamic"; then
10268 # On all known operating systems, these are identical.
10275 if test -n "$dlfiles$dlprefiles" || test no != "$dlself"; then
10276 func_warning "'-dlopen' is ignored for objects"
10279 case " $deplibs" in
10281 func_warning "'-l' and '-L' are ignored for objects" ;;
10284 test -n "$rpath" && \
10285 func_warning "'-rpath' is ignored for objects"
10287 test -n "$xrpath" && \
10288 func_warning "'-R' is ignored for objects"
10290 test -n "$vinfo" && \
10291 func_warning "'-version-info' is ignored for objects"
10293 test -n "$release" && \
10294 func_warning "'-release' is ignored for objects"
10298 test -n "$objs$old_deplibs" && \
10299 func_fatal_error "cannot build library object '$output' from non-libtool objects"
10302 func_lo2o "$libobj"
10303 obj=$func_lo2o_result
10311 # Delete the old objects.
10312 $opt_dry_run || $RM $obj $libobj
10314 # Objects from convenience libraries. This assumes
10315 # single-version convenience libraries. Whenever we create
10316 # different ones for PIC/non-PIC, this we'll have to duplicate
10320 # if reload_cmds runs $LD directly, get rid of -Wl from
10321 # whole_archive_flag_spec and hope we can get by with turning comma
10323 case $reload_cmds in
10324 *\$LD[\ \$]*) wl= ;;
10326 if test -n "$convenience"; then
10327 if test -n "$whole_archive_flag_spec"; then
10328 eval tmp_whole_archive_flags=\"$whole_archive_flag_spec\"
10329 test -n "$wl" || tmp_whole_archive_flags=`$ECHO "$tmp_whole_archive_flags" | $SED 's|,| |g'`
10330 reload_conv_objs=$reload_objs\ $tmp_whole_archive_flags
10332 gentop=$output_objdir/${obj}x
10333 func_append generated " $gentop"
10335 func_extract_archives $gentop $convenience
10336 reload_conv_objs="$reload_objs $func_extract_archives_result"
10340 # If we're not building shared, we need to use non_pic_objs
10341 test yes = "$build_libtool_libs" || libobjs=$non_pic_objects
10343 # Create the old-style object.
10344 reload_objs=$objs$old_deplibs' '`$ECHO "$libobjs" | $SP2NL | $SED "/\.$libext$/d; /\.lib$/d; $lo2o" | $NL2SP`' '$reload_conv_objs
10347 func_execute_cmds "$reload_cmds" 'exit $?'
10349 # Exit if we aren't doing a library object file.
10350 if test -z "$libobj"; then
10351 if test -n "$gentop"; then
10352 func_show_eval '${RM}r "$gentop"'
10358 test yes = "$build_libtool_libs" || {
10359 if test -n "$gentop"; then
10360 func_show_eval '${RM}r "$gentop"'
10363 # Create an invalid libtool object if no PIC, so that we don't
10364 # accidentally link it into a program.
10365 # $show "echo timestamp > $libobj"
10366 # $opt_dry_run || eval "echo timestamp > $libobj" || exit $?
10370 if test -n "$pic_flag" || test default != "$pic_mode"; then
10371 # Only do commands if we really have different PIC objects.
10372 reload_objs="$libobjs $reload_conv_objs"
10374 func_execute_cmds "$reload_cmds" 'exit $?'
10377 if test -n "$gentop"; then
10378 func_show_eval '${RM}r "$gentop"'
10386 *cygwin*) func_stripname '' '.exe' "$output"
10387 output=$func_stripname_result.exe;;
10389 test -n "$vinfo" && \
10390 func_warning "'-version-info' is ignored for programs"
10392 test -n "$release" && \
10393 func_warning "'-release' is ignored for programs"
10396 && test unknown,unknown,unknown = "$dlopen_support,$dlopen_self,$dlopen_self_static" \
10397 && func_warning "'LT_INIT([dlopen])' not used. Assuming no dlopen support."
10400 *-*-rhapsody* | *-*-darwin1.[012])
10401 # On Rhapsody replace the C library is the System framework
10402 compile_deplibs=`$ECHO " $compile_deplibs" | $SED 's/ -lc / System.ltframework /'`
10403 finalize_deplibs=`$ECHO " $finalize_deplibs" | $SED 's/ -lc / System.ltframework /'`
10409 # Don't allow lazy linking, it breaks C++ global constructors
10410 # But is supposedly fixed on 10.4 or later (yay!).
10411 if test CXX = "$tagname"; then
10412 case ${MACOSX_DEPLOYMENT_TARGET-10.0} in
10414 func_append compile_command " $wl-bind_at_load"
10415 func_append finalize_command " $wl-bind_at_load"
10419 # Time to change all our "foo.ltframework" stuff back to "-framework foo"
10420 compile_deplibs=`$ECHO " $compile_deplibs" | $SED 's% \([^ $]*\).ltframework% -framework \1%g'`
10421 finalize_deplibs=`$ECHO " $finalize_deplibs" | $SED 's% \([^ $]*\).ltframework% -framework \1%g'`
10426 # move library search paths that coincide with paths to not yet
10427 # installed libraries to the beginning of the library search list
10429 for path in $notinst_path; do
10430 case " $new_libs " in
10431 *" -L$path/$objdir "*) ;;
10433 case " $compile_deplibs " in
10434 *" -L$path/$objdir "*)
10435 func_append new_libs " -L$path/$objdir" ;;
10440 for deplib in $compile_deplibs; do
10443 case " $new_libs " in
10445 *) func_append new_libs " $deplib" ;;
10448 *) func_append new_libs " $deplib" ;;
10451 compile_deplibs=$new_libs
10454 func_append compile_command " $compile_deplibs"
10455 func_append finalize_command " $finalize_deplibs"
10457 if test -n "$rpath$xrpath"; then
10458 # If the user specified any rpath flags, then add them.
10459 for libdir in $rpath $xrpath; do
10460 # This is the magic to use -rpath.
10461 case "$finalize_rpath " in
10463 *) func_append finalize_rpath " $libdir" ;;
10468 # Now hardcode the library paths
10471 for libdir in $compile_rpath $finalize_rpath; do
10472 if test -n "$hardcode_libdir_flag_spec"; then
10473 if test -n "$hardcode_libdir_separator"; then
10474 if test -z "$hardcode_libdirs"; then
10475 hardcode_libdirs=$libdir
10477 # Just accumulate the unique libdirs.
10478 case $hardcode_libdir_separator$hardcode_libdirs$hardcode_libdir_separator in
10479 *"$hardcode_libdir_separator$libdir$hardcode_libdir_separator"*)
10482 func_append hardcode_libdirs "$hardcode_libdir_separator$libdir"
10487 eval flag=\"$hardcode_libdir_flag_spec\"
10488 func_append rpath " $flag"
10490 elif test -n "$runpath_var"; then
10491 case "$perm_rpath " in
10493 *) func_append perm_rpath " $libdir" ;;
10497 *-*-cygwin* | *-*-mingw* | *-*-pw32* | *-*-os2* | *-cegcc*)
10498 testbindir=`$ECHO "$libdir" | $SED -e 's*/lib$*/bin*'`
10499 case :$dllsearchpath: in
10501 ::) dllsearchpath=$libdir;;
10502 *) func_append dllsearchpath ":$libdir";;
10504 case :$dllsearchpath: in
10505 *":$testbindir:"*) ;;
10506 ::) dllsearchpath=$testbindir;;
10507 *) func_append dllsearchpath ":$testbindir";;
10512 # Substitute the hardcoded libdirs into the rpath.
10513 if test -n "$hardcode_libdir_separator" &&
10514 test -n "$hardcode_libdirs"; then
10515 libdir=$hardcode_libdirs
10516 eval rpath=\" $hardcode_libdir_flag_spec\"
10518 compile_rpath=$rpath
10522 for libdir in $finalize_rpath; do
10523 if test -n "$hardcode_libdir_flag_spec"; then
10524 if test -n "$hardcode_libdir_separator"; then
10525 if test -z "$hardcode_libdirs"; then
10526 hardcode_libdirs=$libdir
10528 # Just accumulate the unique libdirs.
10529 case $hardcode_libdir_separator$hardcode_libdirs$hardcode_libdir_separator in
10530 *"$hardcode_libdir_separator$libdir$hardcode_libdir_separator"*)
10533 func_append hardcode_libdirs "$hardcode_libdir_separator$libdir"
10538 eval flag=\"$hardcode_libdir_flag_spec\"
10539 func_append rpath " $flag"
10541 elif test -n "$runpath_var"; then
10542 case "$finalize_perm_rpath " in
10544 *) func_append finalize_perm_rpath " $libdir" ;;
10548 # Substitute the hardcoded libdirs into the rpath.
10549 if test -n "$hardcode_libdir_separator" &&
10550 test -n "$hardcode_libdirs"; then
10551 libdir=$hardcode_libdirs
10552 eval rpath=\" $hardcode_libdir_flag_spec\"
10554 finalize_rpath=$rpath
10556 if test -n "$libobjs" && test yes = "$build_old_libs"; then
10557 # Transform all the library objects into standard objects.
10558 compile_command=`$ECHO "$compile_command" | $SP2NL | $SED "$lo2o" | $NL2SP`
10559 finalize_command=`$ECHO "$finalize_command" | $SP2NL | $SED "$lo2o" | $NL2SP`
10562 func_generate_dlsyms "$outputname" "@PROGRAM@" false
10564 # template prelinking step
10565 if test -n "$prelink_cmds"; then
10566 func_execute_cmds "$prelink_cmds" 'exit $?'
10569 wrappers_required=:
10571 *cegcc* | *mingw32ce*)
10572 # Disable wrappers for cegcc and mingw32ce hosts, we are cross compiling anyway.
10573 wrappers_required=false
10575 *cygwin* | *mingw* )
10576 test yes = "$build_libtool_libs" || wrappers_required=false
10579 if test no = "$need_relink" || test yes != "$build_libtool_libs"; then
10580 wrappers_required=false
10584 $wrappers_required || {
10585 # Replace the output file specification.
10586 compile_command=`$ECHO "$compile_command" | $SED 's%@OUTPUT@%'"$output"'%g'`
10587 link_command=$compile_command$compile_rpath
10589 # We have no uninstalled library dependencies, so finalize right now.
10591 func_show_eval "$link_command" 'exit_status=$?'
10593 if test -n "$postlink_cmds"; then
10594 func_to_tool_file "$output"
10595 postlink_cmds=`func_echo_all "$postlink_cmds" | $SED -e 's%@OUTPUT@%'"$output"'%g' -e 's%@TOOL_OUTPUT@%'"$func_to_tool_file_result"'%g'`
10596 func_execute_cmds "$postlink_cmds" 'exit $?'
10599 # Delete the generated files.
10600 if test -f "$output_objdir/${outputname}S.$objext"; then
10601 func_show_eval '$RM "$output_objdir/${outputname}S.$objext"'
10607 if test -n "$compile_shlibpath$finalize_shlibpath"; then
10608 compile_command="$shlibpath_var=\"$compile_shlibpath$finalize_shlibpath\$$shlibpath_var\" $compile_command"
10610 if test -n "$finalize_shlibpath"; then
10611 finalize_command="$shlibpath_var=\"$finalize_shlibpath\$$shlibpath_var\" $finalize_command"
10616 if test -n "$runpath_var"; then
10617 if test -n "$perm_rpath"; then
10618 # We should set the runpath_var.
10620 for dir in $perm_rpath; do
10621 func_append rpath "$dir:"
10623 compile_var="$runpath_var=\"$rpath\$$runpath_var\" "
10625 if test -n "$finalize_perm_rpath"; then
10626 # We should set the runpath_var.
10628 for dir in $finalize_perm_rpath; do
10629 func_append rpath "$dir:"
10631 finalize_var="$runpath_var=\"$rpath\$$runpath_var\" "
10635 if test yes = "$no_install"; then
10636 # We don't need to create a wrapper script.
10637 link_command=$compile_var$compile_command$compile_rpath
10638 # Replace the output file specification.
10639 link_command=`$ECHO "$link_command" | $SED 's%@OUTPUT@%'"$output"'%g'`
10640 # Delete the old output file.
10641 $opt_dry_run || $RM $output
10642 # Link the executable and exit
10643 func_show_eval "$link_command" 'exit $?'
10645 if test -n "$postlink_cmds"; then
10646 func_to_tool_file "$output"
10647 postlink_cmds=`func_echo_all "$postlink_cmds" | $SED -e 's%@OUTPUT@%'"$output"'%g' -e 's%@TOOL_OUTPUT@%'"$func_to_tool_file_result"'%g'`
10648 func_execute_cmds "$postlink_cmds" 'exit $?'
10654 case $hardcode_action,$fast_install in
10656 # Fast installation is not supported
10657 link_command=$compile_var$compile_command$compile_rpath
10658 relink_command=$finalize_var$finalize_command$finalize_rpath
10660 func_warning "this platform does not like uninstalled shared libraries"
10661 func_warning "'$output' will be relinked during installation"
10664 link_command=$finalize_var$compile_command$finalize_rpath
10665 relink_command=`$ECHO "$compile_var$compile_command$compile_rpath" | $SED 's%@OUTPUT@%\$progdir/\$file%g'`
10668 link_command=$compile_var$compile_command$compile_rpath
10669 relink_command=$finalize_var$finalize_command$finalize_rpath
10672 link_command=$finalize_var$compile_command$finalize_rpath
10677 # Replace the output file specification.
10678 link_command=`$ECHO "$link_command" | $SED 's%@OUTPUT@%'"$output_objdir/$outputname"'%g'`
10680 # Delete the old output files.
10681 $opt_dry_run || $RM $output $output_objdir/$outputname $output_objdir/lt-$outputname
10683 func_show_eval "$link_command" 'exit $?'
10685 if test -n "$postlink_cmds"; then
10686 func_to_tool_file "$output_objdir/$outputname"
10687 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'`
10688 func_execute_cmds "$postlink_cmds" 'exit $?'
10691 # Now create the wrapper script.
10692 func_verbose "creating $output"
10694 # Quote the relink command for shipping.
10695 if test -n "$relink_command"; then
10696 # Preserve any variables that may affect compiler behavior
10697 for var in $variables_saved_for_relink; do
10698 if eval test -z \"\${$var+set}\"; then
10699 relink_command="{ test -z \"\${$var+set}\" || $lt_unset $var || { $var=; export $var; }; }; $relink_command"
10700 elif eval var_value=\$$var; test -z "$var_value"; then
10701 relink_command="$var=; export $var; $relink_command"
10703 func_quote_arg pretty "$var_value"
10704 relink_command="$var=$func_quote_arg_result; export $var; $relink_command"
10707 func_quote_arg pretty,unquoted "(cd `pwd`; $relink_command)"
10708 relink_command=$func_quote_arg_unquoted_result
10711 # Only actually do things if not in dry run mode.
10713 # win32 will think the script is a binary if it has
10714 # a .exe suffix, so we strip it off here.
10716 *.exe) func_stripname '' '.exe' "$output"
10717 output=$func_stripname_result ;;
10719 # test for cygwin because mv fails w/o .exe extensions
10723 func_stripname '' '.exe' "$outputname"
10724 outputname=$func_stripname_result ;;
10728 *cygwin* | *mingw* )
10729 func_dirname_and_basename "$output" "" "."
10730 output_name=$func_basename_result
10731 output_path=$func_dirname_result
10732 cwrappersource=$output_path/$objdir/lt-$output_name.c
10733 cwrapper=$output_path/$output_name.exe
10734 $RM $cwrappersource $cwrapper
10735 trap "$RM $cwrappersource $cwrapper; exit $EXIT_FAILURE" 1 2 15
10737 func_emit_cwrapperexe_src > $cwrappersource
10739 # The wrapper executable is built using the $host compiler,
10740 # because it contains $host paths and files. If cross-
10741 # compiling, it, like the target executable, must be
10742 # executed on the $host or under an emulation environment.
10744 $LTCC $LTCFLAGS -o $cwrapper $cwrappersource
10748 # Now, create the wrapper script for func_source use:
10749 func_ltwrapper_scriptname $cwrapper
10750 $RM $func_ltwrapper_scriptname_result
10751 trap "$RM $func_ltwrapper_scriptname_result; exit $EXIT_FAILURE" 1 2 15
10753 # note: this script will not be executed, so do not chmod.
10754 if test "x$build" = "x$host"; then
10755 $cwrapper --lt-dump-script > $func_ltwrapper_scriptname_result
10757 func_emit_wrapper no > $func_ltwrapper_scriptname_result
10763 trap "$RM $output; exit $EXIT_FAILURE" 1 2 15
10765 func_emit_wrapper no > $output
10774 # See if we need to build an old-fashioned archive.
10775 for oldlib in $oldlibs; do
10777 case $build_libtool_libs in
10779 oldobjs="$libobjs_save $symfileobj"
10780 addlibs=$convenience
10781 build_libtool_libs=no
10784 oldobjs=$libobjs_save
10785 addlibs=$old_convenience
10786 build_libtool_libs=no
10789 oldobjs="$old_deplibs $non_pic_objects"
10790 $preload && test -f "$symfileobj" \
10791 && func_append oldobjs " $symfileobj"
10792 addlibs=$old_convenience
10796 if test -n "$addlibs"; then
10797 gentop=$output_objdir/${outputname}x
10798 func_append generated " $gentop"
10800 func_extract_archives $gentop $addlibs
10801 func_append oldobjs " $func_extract_archives_result"
10804 # Do each command in the archive commands.
10805 if test -n "$old_archive_from_new_cmds" && test yes = "$build_libtool_libs"; then
10806 cmds=$old_archive_from_new_cmds
10809 # Add any objects from preloaded convenience libraries
10810 if test -n "$dlprefiles"; then
10811 gentop=$output_objdir/${outputname}x
10812 func_append generated " $gentop"
10814 func_extract_archives $gentop $dlprefiles
10815 func_append oldobjs " $func_extract_archives_result"
10818 # POSIX demands no paths to be encoded in archives. We have
10819 # to avoid creating archives with duplicate basenames if we
10820 # might have to extract them afterwards, e.g., when creating a
10821 # static archive out of a convenience library, or when linking
10822 # the entirety of a libtool archive into another (currently
10823 # not supported by libtool).
10824 if (for obj in $oldobjs
10826 func_basename "$obj"
10827 $ECHO "$func_basename_result"
10828 done | sort | sort -uc >/dev/null 2>&1); then
10831 echo "copying selected object files to avoid basename conflicts..."
10832 gentop=$output_objdir/${outputname}x
10833 func_append generated " $gentop"
10834 func_mkdir_p "$gentop"
10835 save_oldobjs=$oldobjs
10838 for obj in $save_oldobjs
10840 func_basename "$obj"
10841 objbase=$func_basename_result
10842 case " $oldobjs " in
10843 " ") oldobjs=$obj ;;
10844 *[\ /]"$objbase "*)
10846 # Make sure we don't pick an alternate name that also
10848 newobj=lt$counter-$objbase
10849 func_arith $counter + 1
10850 counter=$func_arith_result
10851 case " $oldobjs " in
10852 *[\ /]"$newobj "*) ;;
10853 *) if test ! -f "$gentop/$newobj"; then break; fi ;;
10856 func_show_eval "ln $obj $gentop/$newobj || cp $obj $gentop/$newobj"
10857 func_append oldobjs " $gentop/$newobj"
10859 *) func_append oldobjs " $obj" ;;
10863 func_to_tool_file "$oldlib" func_convert_file_msys_to_w32
10864 tool_oldlib=$func_to_tool_file_result
10865 eval cmds=\"$old_archive_cmds\"
10868 len=$func_len_result
10869 if test "$len" -lt "$max_cmd_len" || test "$max_cmd_len" -le -1; then
10870 cmds=$old_archive_cmds
10871 elif test -n "$archiver_list_spec"; then
10872 func_verbose "using command file archive linking..."
10873 for obj in $oldobjs
10875 func_to_tool_file "$obj"
10876 $ECHO "$func_to_tool_file_result"
10877 done > $output_objdir/$libname.libcmd
10878 func_to_tool_file "$output_objdir/$libname.libcmd"
10879 oldobjs=" $archiver_list_spec$func_to_tool_file_result"
10880 cmds=$old_archive_cmds
10882 # the command line is too long to link in one step, link in parts
10883 func_verbose "using piecewise archive linking..."
10884 save_RANLIB=$RANLIB
10888 save_oldobjs=$oldobjs
10890 # Is there a better way of finding the last object in the list?
10891 for obj in $save_oldobjs
10895 eval test_cmds=\"$old_archive_cmds\"
10896 func_len " $test_cmds"
10897 len0=$func_len_result
10899 for obj in $save_oldobjs
10902 func_arith $len + $func_len_result
10903 len=$func_arith_result
10904 func_append objlist " $obj"
10905 if test "$len" -lt "$max_cmd_len"; then
10908 # the above command should be used before it gets too long
10910 if test "$obj" = "$last_oldobj"; then
10911 RANLIB=$save_RANLIB
10913 test -z "$concat_cmds" || concat_cmds=$concat_cmds~
10914 eval concat_cmds=\"\$concat_cmds$old_archive_cmds\"
10919 RANLIB=$save_RANLIB
10921 if test -z "$oldobjs"; then
10922 eval cmds=\"\$concat_cmds\"
10924 eval cmds=\"\$concat_cmds~\$old_archive_cmds\"
10928 func_execute_cmds "$cmds" 'exit $?'
10931 test -n "$generated" && \
10932 func_show_eval "${RM}r$generated"
10934 # Now create the libtool archive.
10938 test yes = "$build_old_libs" && old_library=$libname.$libext
10939 func_verbose "creating $output"
10941 # Preserve any variables that may affect compiler behavior
10942 for var in $variables_saved_for_relink; do
10943 if eval test -z \"\${$var+set}\"; then
10944 relink_command="{ test -z \"\${$var+set}\" || $lt_unset $var || { $var=; export $var; }; }; $relink_command"
10945 elif eval var_value=\$$var; test -z "$var_value"; then
10946 relink_command="$var=; export $var; $relink_command"
10948 func_quote_arg pretty,unquoted "$var_value"
10949 relink_command="$var=$func_quote_arg_unquoted_result; export $var; $relink_command"
10952 # Quote the link command for shipping.
10953 relink_command="(cd `pwd`; $SHELL \"$progpath\" $preserve_args --mode=relink $libtool_args @inst_prefix_dir@)"
10954 func_quote_arg pretty,unquoted "$relink_command"
10955 relink_command=$func_quote_arg_unquoted_result
10956 if test yes = "$hardcode_automatic"; then
10960 # Only create the output if not a dry run.
10962 for installed in no yes; do
10963 if test yes = "$installed"; then
10964 if test -z "$install_libdir"; then
10967 output=$output_objdir/${outputname}i
10968 # Replace all uninstalled libtool libraries with the installed ones
10969 newdependency_libs=
10970 for deplib in $dependency_libs; do
10973 func_basename "$deplib"
10974 name=$func_basename_result
10975 func_resolve_sysroot "$deplib"
10976 eval libdir=`$SED -n -e 's/^libdir=\(.*\)$/\1/p' $func_resolve_sysroot_result`
10977 test -z "$libdir" && \
10978 func_fatal_error "'$deplib' is not a valid libtool archive"
10979 func_append newdependency_libs " ${lt_sysroot:+=}$libdir/$name"
10982 func_stripname -L '' "$deplib"
10983 func_replace_sysroot "$func_stripname_result"
10984 func_append newdependency_libs " -L$func_replace_sysroot_result"
10987 func_stripname -R '' "$deplib"
10988 func_replace_sysroot "$func_stripname_result"
10989 func_append newdependency_libs " -R$func_replace_sysroot_result"
10991 *) func_append newdependency_libs " $deplib" ;;
10994 dependency_libs=$newdependency_libs
10997 for lib in $dlfiles; do
11000 func_basename "$lib"
11001 name=$func_basename_result
11002 eval libdir=`$SED -n -e 's/^libdir=\(.*\)$/\1/p' $lib`
11003 test -z "$libdir" && \
11004 func_fatal_error "'$lib' is not a valid libtool archive"
11005 func_append newdlfiles " ${lt_sysroot:+=}$libdir/$name"
11007 *) func_append newdlfiles " $lib" ;;
11010 dlfiles=$newdlfiles
11012 for lib in $dlprefiles; do
11015 # Only pass preopened files to the pseudo-archive (for
11016 # eventual linking with the app. that links it) if we
11017 # didn't already link the preopened objects directly into
11019 func_basename "$lib"
11020 name=$func_basename_result
11021 eval libdir=`$SED -n -e 's/^libdir=\(.*\)$/\1/p' $lib`
11022 test -z "$libdir" && \
11023 func_fatal_error "'$lib' is not a valid libtool archive"
11024 func_append newdlprefiles " ${lt_sysroot:+=}$libdir/$name"
11028 dlprefiles=$newdlprefiles
11031 for lib in $dlfiles; do
11033 [\\/]* | [A-Za-z]:[\\/]*) abs=$lib ;;
11034 *) abs=`pwd`"/$lib" ;;
11036 func_append newdlfiles " $abs"
11038 dlfiles=$newdlfiles
11040 for lib in $dlprefiles; do
11042 [\\/]* | [A-Za-z]:[\\/]*) abs=$lib ;;
11043 *) abs=`pwd`"/$lib" ;;
11045 func_append newdlprefiles " $abs"
11047 dlprefiles=$newdlprefiles
11050 # place dlname in correct position for cygwin
11051 # In fact, it would be nice if we could use this code for all target
11052 # systems that can't hard-code library paths into their executables
11053 # and that have no shared library path variable independent of PATH,
11054 # but it turns out we can't easily determine that from inspecting
11055 # libtool variables, so we have to hard-code the OSs to which it
11056 # applies here; at the moment, that means platforms that use the PE
11057 # object format with DLL files. See the long comment at the top of
11058 # tests/bindir.at for full details.
11060 case $host,$output,$installed,$module,$dlname in
11061 *cygwin*,*lai,yes,no,*.dll | *mingw*,*lai,yes,no,*.dll | *cegcc*,*lai,yes,no,*.dll)
11062 # If a -bindir argument was supplied, place the dll there.
11063 if test -n "$bindir"; then
11064 func_relative_path "$install_libdir" "$bindir"
11065 tdlname=$func_relative_path_result/$dlname
11067 # Otherwise fall back on heuristic.
11068 tdlname=../bin/$dlname
11073 # $outputname - a libtool library file
11074 # Generated by $PROGRAM (GNU $PACKAGE) $VERSION
11076 # Please DO NOT delete this file!
11077 # It is necessary for linking the library.
11079 # The name that we can dlopen(3).
11082 # Names of this library.
11083 library_names='$library_names'
11085 # The name of the static archive.
11086 old_library='$old_library'
11088 # Linker flags that cannot go in dependency_libs.
11089 inherited_linker_flags='$new_inherited_linker_flags'
11091 # Libraries that this one depends upon.
11092 dependency_libs='$dependency_libs'
11094 # Names of additional weak libraries provided by this library
11095 weak_library_names='$weak_libs'
11097 # Version information for $libname.
11102 # Is this an already installed library?
11103 installed=$installed
11105 # Should we warn about portability when linking against -modules?
11106 shouldnotlink=$module
11108 # Files to dlopen/dlpreopen
11110 dlpreopen='$dlprefiles'
11112 # Directory that this library needs to be installed in:
11113 libdir='$install_libdir'"
11114 if test no,yes = "$installed,$need_relink"; then
11115 $ECHO >> $output "\
11116 relink_command=\"$relink_command\""
11121 # Do a symbolic link so that the libtool archive can be found in
11122 # LD_LIBRARY_PATH before the program is installed.
11123 func_show_eval '( cd "$output_objdir" && $RM "$outputname" && $LN_S "../$outputname" "$outputname" )' 'exit $?'
11129 if test link = "$opt_mode" || test relink = "$opt_mode"; then
11130 func_mode_link ${1+"$@"}
11134 # func_mode_uninstall arg...
11135 func_mode_uninstall ()
11144 # This variable tells wrapper scripts just to set variables rather
11145 # than running their programs.
11146 libtool_install_magic=$magic
11151 -f) func_append RM " $arg"; rmforce=: ;;
11152 -*) func_append RM " $arg" ;;
11153 *) func_append files " $arg" ;;
11158 func_fatal_help "you must specify an RM program"
11162 for file in $files; do
11163 func_dirname "$file" "" "."
11164 dir=$func_dirname_result
11165 if test . = "$dir"; then
11170 func_basename "$file"
11171 name=$func_basename_result
11172 test uninstall = "$opt_mode" && odir=$dir
11174 # Remember odir for removal later, being careful to avoid duplicates
11175 if test clean = "$opt_mode"; then
11176 case " $rmdirs " in
11178 *) func_append rmdirs " $odir" ;;
11182 # Don't error if the file doesn't exist and rm -f was used.
11183 if { test -L "$file"; } >/dev/null 2>&1 ||
11184 { test -h "$file"; } >/dev/null 2>&1 ||
11185 test -f "$file"; then
11187 elif test -d "$file"; then
11190 elif $rmforce; then
11198 # Possibly a libtool archive, so verify it.
11199 if func_lalib_p "$file"; then
11200 func_source $dir/$name
11202 # Delete the libtool libraries and symlinks.
11203 for n in $library_names; do
11204 func_append rmfiles " $odir/$n"
11206 test -n "$old_library" && func_append rmfiles " $odir/$old_library"
11210 case " $library_names " in
11212 *) test -n "$dlname" && func_append rmfiles " $odir/$dlname" ;;
11214 test -n "$libdir" && func_append rmfiles " $odir/$name $odir/${name}i"
11217 if test -n "$library_names"; then
11218 # Do each command in the postuninstall commands.
11219 func_execute_cmds "$postuninstall_cmds" '$rmforce || exit_status=1'
11222 if test -n "$old_library"; then
11223 # Do each command in the old_postuninstall commands.
11224 func_execute_cmds "$old_postuninstall_cmds" '$rmforce || exit_status=1'
11226 # FIXME: should reinstall the best remaining shared library.
11233 # Possibly a libtool object, so verify it.
11234 if func_lalib_p "$file"; then
11236 # Read the .lo file
11237 func_source $dir/$name
11239 # Add PIC object to the list of files to remove.
11240 if test -n "$pic_object" && test none != "$pic_object"; then
11241 func_append rmfiles " $dir/$pic_object"
11244 # Add non-PIC object to the list of files to remove.
11245 if test -n "$non_pic_object" && test none != "$non_pic_object"; then
11246 func_append rmfiles " $dir/$non_pic_object"
11252 if test clean = "$opt_mode"; then
11256 func_stripname '' '.exe' "$file"
11257 file=$func_stripname_result
11258 func_stripname '' '.exe' "$name"
11259 noexename=$func_stripname_result
11260 # $file with .exe has already been added to rmfiles,
11261 # add $file without .exe
11262 func_append rmfiles " $file"
11265 # Do a test to see if this is a libtool program.
11266 if func_ltwrapper_p "$file"; then
11267 if func_ltwrapper_executable_p "$file"; then
11268 func_ltwrapper_scriptname "$file"
11270 func_source $func_ltwrapper_scriptname_result
11271 func_append rmfiles " $func_ltwrapper_scriptname_result"
11274 func_source $dir/$noexename
11277 # note $name still contains .exe if it was in $file originally
11278 # as does the version of $file that was added into $rmfiles
11279 func_append rmfiles " $odir/$name $odir/${name}S.$objext"
11280 if test yes = "$fast_install" && test -n "$relink_command"; then
11281 func_append rmfiles " $odir/lt-$name"
11283 if test "X$noexename" != "X$name"; then
11284 func_append rmfiles " $odir/lt-$noexename.c"
11290 func_show_eval "$RM $rmfiles" 'exit_status=1'
11293 # Try to remove the $objdir's in the directories where we deleted files
11294 for dir in $rmdirs; do
11295 if test -d "$dir"; then
11296 func_show_eval "rmdir $dir >/dev/null 2>&1"
11303 if test uninstall = "$opt_mode" || test clean = "$opt_mode"; then
11304 func_mode_uninstall ${1+"$@"}
11307 test -z "$opt_mode" && {
11309 func_fatal_help "you must specify a MODE"
11312 test -z "$exec_cmd" && \
11313 func_fatal_help "invalid operation mode '$opt_mode'"
11315 if test -n "$exec_cmd"; then
11316 eval exec "$exec_cmd"
11323 # The TAGs below are defined such that we never get into a situation
11324 # where we disable both kinds of libraries. Given conflicting
11325 # choices, we go for a static library, that is the most portable,
11326 # since we can't tell whether shared libraries were disabled because
11327 # the user asked for that or because the platform doesn't support
11328 # them. This is particularly important on AIX, because we don't
11329 # support having both static and shared libraries enabled at the same
11330 # time on that platform, so we default to a shared-only configuration.
11331 # If a disable-shared tag is given, we'll fallback to a static-only
11332 # configuration. But we'll never go from static-only to shared-only.
11334 # ### BEGIN LIBTOOL TAG CONFIG: disable-shared
11335 build_libtool_libs=no
11337 # ### END LIBTOOL TAG CONFIG: disable-shared
11339 # ### BEGIN LIBTOOL TAG CONFIG: disable-static
11340 build_old_libs=`case $build_libtool_libs in yes) echo no;; *) echo yes;; esac`
11341 # ### END LIBTOOL TAG CONFIG: disable-static
11344 # mode:shell-script