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.2.444.28-053d
6 # Provide generalized library-building support services.
7 # Written by Gordon Matzigkeit <gord@gnu.ai.mit.edu>, 1996
9 # Copyright (C) 1996-2014 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.2.444.28-053d
35 package_revision=2.4.2.444.28
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=2014-02-10.13; # UTC
69 # General shell script boiler plate, and helper functions.
70 # Written by Gary V. Vaughan, 2004
72 # Copyright (C) 2004-2014 Free Software Foundation, Inc.
73 # This is free software; see the source for copying conditions. There is NO
74 # warranty; not even for MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
76 # This program is free software; you can redistribute it and/or modify
77 # it under the terms of the GNU General Public License as published by
78 # the Free Software Foundation; either version 3 of the License, or
79 # (at your option) any later version.
81 # As a special exception to the GNU General Public License, if you distribute
82 # this file as part of a program or library that is built using GNU Libtool,
83 # you may include this file under the same distribution terms that you use
84 # for the rest of that program.
86 # This program is distributed in the hope that it will be useful,
87 # but WITHOUT ANY WARRANTY; without even the implied warranty of
88 # MERCHANTABILITY or FITNES FOR A PARTICULAR PURPOSE. See the GNU
89 # General Public License for more details.
91 # You should have received a copy of the GNU General Public License
92 # along with this program. If not, see <http://www.gnu.org/licenses/>.
94 # Please report bugs or propose patches to gary@gnu.org.
101 # Evaluate this file near the top of your script to gain access to
102 # the functions and variables defined here:
104 # . `echo "$0" | ${SED-sed} 's|[^/]*$||'`/build-aux/funclib.sh
106 # If you need to override any of the default environment variable
107 # settings, do that before evaluating this file.
110 ## -------------------- ##
111 ## Shell normalisation. ##
112 ## -------------------- ##
114 # Some shells need a little help to be as Bourne compatible as possible.
115 # Before doing anything else, make sure all that help has been provided!
117 DUALCASE=1; export DUALCASE # for MKS sh
118 if test -n "${ZSH_VERSION+set}" && (emulate sh) >/dev/null 2>&1; then :
121 # Pre-4.2 versions of Zsh do word splitting on ${1+"$@"}, which
122 # is contrary to our usage. Disable this feature.
123 alias -g '${1+"$@"}'='"$@"'
126 case `(set -o) 2>/dev/null` in *posix*) set -o posix ;; esac
129 # NLS nuisances: We save the old values in case they are required later.
132 for _G_var in LANG LANGUAGE LC_ALL LC_CTYPE LC_COLLATE LC_MESSAGES
134 eval "if test set = \"\${$_G_var+set}\"; then
135 save_$_G_var=\$$_G_var
138 _G_user_locale=\"$_G_var=\\\$save_\$_G_var; \$_G_user_locale\"
139 _G_safe_locale=\"$_G_var=C; \$_G_safe_locale\"
144 (unset CDPATH) >/dev/null 2>&1 && unset CDPATH
146 # Make sure IFS has a sensible default
152 # There are apparently some retarded systems that use ';' as a PATH separator!
153 if test "${PATH_SEPARATOR+set}" != set; then
155 (PATH='/bin;/bin'; FPATH=$PATH; sh -c :) >/dev/null 2>&1 && {
156 (PATH='/bin:/bin'; FPATH=$PATH; sh -c :) >/dev/null 2>&1 ||
163 ## ------------------------- ##
164 ## Locate command utilities. ##
165 ## ------------------------- ##
168 # func_executable_p FILE
169 # ----------------------
170 # Check that FILE is an executable regular file.
173 test -f "$1" && test -x "$1"
177 # func_path_progs PROGS_LIST CHECK_FUNC [PATH]
178 # --------------------------------------------
179 # Search for either a program that responds to --version with output
180 # containing "GNU", or else returned by CHECK_FUNC otherwise, by
181 # trying all the directories in PATH with each of the elements of
184 # CHECK_FUNC should accept the path to a candidate program, and
185 # set $func_check_prog_result if it truncates its output less than
186 # $_G_path_prog_max characters.
194 _G_path_prog_found=false
195 _G_save_IFS=$IFS; IFS=$PATH_SEPARATOR
196 for _G_dir in $_G_PATH; do
198 test -z "$_G_dir" && _G_dir=.
199 for _G_prog_name in $_G_progs_list; do
200 for _exeext in '' .EXE; do
201 _G_path_prog=$_G_dir/$_G_prog_name$_exeext
202 func_executable_p "$_G_path_prog" || continue
203 case `"$_G_path_prog" --version 2>&1` in
204 *GNU*) func_path_progs_result=$_G_path_prog _G_path_prog_found=: ;;
205 *) $_G_check_func $_G_path_prog
206 func_path_progs_result=$func_check_prog_result
209 $_G_path_prog_found && break 3
214 test -z "$func_path_progs_result" && {
215 echo "no acceptable sed could be found in \$PATH" >&2
221 # We want to be able to use the functions in this file before configure
222 # has figured out where the best binaries are kept, which means we have
223 # to search for them ourselves - except when the results are already set
224 # where we skip the searches.
226 # Unless the user overrides by setting SED, search the path for either GNU
227 # sed, or the sed that truncates its output the least.
229 _G_sed_script=s/aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa/bbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbb/
230 for _G_i in 1 2 3 4 5 6 7; do
231 _G_sed_script=$_G_sed_script$nl$_G_sed_script
233 echo "$_G_sed_script" 2>/dev/null | sed 99q >conftest.sed
236 func_check_prog_sed ()
241 printf 0123456789 >conftest.in
244 cat conftest.in conftest.in >conftest.tmp
245 mv conftest.tmp conftest.in
246 cp conftest.in conftest.nl
247 echo '' >> conftest.nl
248 "$_G_path_prog" -f conftest.sed <conftest.nl >conftest.out 2>/dev/null || break
249 diff conftest.out conftest.nl >/dev/null 2>&1 || break
250 _G_count=`expr $_G_count + 1`
251 if test "$_G_count" -gt "$_G_path_prog_max"; then
252 # Best one so far, save it but keep looking for a better one
253 func_check_prog_result=$_G_path_prog
254 _G_path_prog_max=$_G_count
256 # 10*(2^10) chars as input seems more than enough
257 test 10 -lt "$_G_count" && break
259 rm -f conftest.in conftest.tmp conftest.nl conftest.out
262 func_path_progs "sed gsed" func_check_prog_sed $PATH:/usr/xpg4/bin
264 SED=$func_path_progs_result
268 # Unless the user overrides by setting GREP, search the path for either GNU
269 # grep, or the grep that truncates its output the least.
271 func_check_prog_grep ()
277 printf 0123456789 >conftest.in
280 cat conftest.in conftest.in >conftest.tmp
281 mv conftest.tmp conftest.in
282 cp conftest.in conftest.nl
283 echo 'GREP' >> conftest.nl
284 "$_G_path_prog" -e 'GREP$' -e '-(cannot match)-' <conftest.nl >conftest.out 2>/dev/null || break
285 diff conftest.out conftest.nl >/dev/null 2>&1 || break
286 _G_count=`expr $_G_count + 1`
287 if test "$_G_count" -gt "$_G_path_prog_max"; then
288 # Best one so far, save it but keep looking for a better one
289 func_check_prog_result=$_G_path_prog
290 _G_path_prog_max=$_G_count
292 # 10*(2^10) chars as input seems more than enough
293 test 10 -lt "$_G_count" && break
295 rm -f conftest.in conftest.tmp conftest.nl conftest.out
298 func_path_progs "grep ggrep" func_check_prog_grep $PATH:/usr/xpg4/bin
299 GREP=$func_path_progs_result
303 ## ------------------------------- ##
304 ## User overridable command paths. ##
305 ## ------------------------------- ##
307 # All uppercase variable names are used for environment variables. These
308 # variables can be overridden by the user before calling a script that
309 # uses them if a suitable command of that name is not already available
310 # in the command search PATH.
313 : ${ECHO="printf %s\n"}
314 : ${EGREP="$GREP -E"}
315 : ${FGREP="$GREP -F"}
321 : ${SHELL="${CONFIG_SHELL-/bin/sh}"}
324 ## -------------------- ##
325 ## Useful sed snippets. ##
326 ## -------------------- ##
328 sed_dirname='s|/[^/]*$||'
329 sed_basename='s|^.*/||'
331 # Sed substitution that helps us do robust quoting. It backslashifies
332 # metacharacters that are still active within double-quoted strings.
333 sed_quote_subst='s|\([`"$\\]\)|\\\1|g'
335 # Same as above, but do not quote variable references.
336 sed_double_quote_subst='s/\(["`\\]\)/\\\1/g'
338 # Sed substitution that turns a string into a regex matching for the
340 sed_make_literal_regex='s|[].[^$\\*\/]|\\&|g'
342 # Sed substitution that converts a w32 file name or path
343 # that contains forward slashes, into one that contains
344 # (escaped) backslashes. A very naive implementation.
345 sed_naive_backslashify='s|\\\\*|\\|g;s|/|\\|g;s|\\|\\\\|g'
347 # Re-'\' parameter expansions in output of sed_double_quote_subst that
348 # were '\'-ed in input to the same. If an odd number of '\' preceded a
349 # '$' in input to sed_double_quote_subst, that '$' was protected from
350 # expansion. Since each input '\' is now two '\'s, look for any number
351 # of runs of four '\'s followed by two '\'s and then a '$'. '\' that '$'.
356 sed_double_backslash="\
359 s/^$_G_bs2$_G_dollar/$_G_bs&/
360 s/\\([^$_G_bs]\\)$_G_bs2$_G_dollar/\\1$_G_bs2$_G_bs$_G_dollar/g
364 ## ----------------- ##
365 ## Global variables. ##
366 ## ----------------- ##
368 # Except for the global variables explicitly listed below, the following
369 # functions in the '^func_' namespace, and the '^require_' namespace
370 # variables initialised in the 'Resource management' section, sourcing
371 # this file will not pollute your global namespace with anything
372 # else. There's no portable way to scope variables in Bourne shell
373 # though, so actually running these functions will sometimes place
374 # results into a variable named after the function, and often use
375 # temporary variables in the '^_G_' namespace. If you are careful to
376 # avoid using those namespaces casually in your sourcing script, things
377 # should continue to work as you expect. And, of course, you can freely
378 # overwrite any of the functions or variables defined here before
379 # calling anything to customize them.
383 EXIT_MISMATCH=63 # $? = 63 is used to indicate version mismatch to missing.
384 EXIT_SKIP=77 # $? = 77 is used to indicate a skipped test to automake.
386 # Allow overriding, eg assuming that you follow the convention of
387 # putting '$debug_cmd' at the start of all your functions, you can get
388 # bash to show function call trace with:
390 # debug_cmd='eval echo "${FUNCNAME[0]} $*" >&2' bash your-script-name
391 debug_cmd=${debug_cmd-":"}
394 # By convention, finish your script with:
398 # so that you can set exit_status to non-zero if you want to indicate
399 # something went wrong during execution without actually bailing out at
400 # the point of failure.
401 exit_status=$EXIT_SUCCESS
403 # Work around backward compatibility issue on IRIX 6.5. On IRIX 6.4+, sh
404 # is ksh but when the shell is invoked as "sh" and the current value of
405 # the _XPG environment variable is not equal to 1 (one), the special
406 # positional parameter $0, within a function call, is the name of the
410 # The name of this program.
411 progname=`$ECHO "$progpath" |$SED "$sed_basename"`
413 # Make sure we have an absolute progpath for reexecution:
415 [\\/]*|[A-Za-z]:\\*) ;;
417 progdir=`$ECHO "$progpath" |$SED "$sed_dirname"`
418 progdir=`cd "$progdir" && pwd`
419 progpath=$progdir/$progname
423 IFS=${PATH_SEPARATOR-:}
424 for progdir in $PATH; do
426 test -x "$progdir/$progname" && break
429 test -n "$progdir" || progdir=`pwd`
430 progpath=$progdir/$progname
435 ## ----------------- ##
436 ## Standard options. ##
437 ## ----------------- ##
439 # The following options affect the operation of the functions defined
440 # below, and should be set appropriately depending on run-time para-
441 # meters passed on the command line.
447 # Categories 'all' and 'none' are always available. Append any others
448 # you will pass as the first argument to func_warning from your own
452 # By default, display warnings according to 'opt_warning_types'. Set
453 # 'warning_func' to ':' to elide all warnings, or func_fatal_error to
454 # treat the next displayed warning as a fatal error.
455 warning_func=func_warn_and_continue
457 # Set to 'all' to display all warnings, 'none' to suppress all
458 # warnings, or a space delimited list of some subset of
459 # 'warning_categories' to display only the listed warnings.
460 opt_warning_types=all
463 ## -------------------- ##
464 ## Resource management. ##
465 ## -------------------- ##
467 # This section contains definitions for functions that each ensure a
468 # particular resource (a file, or a non-empty configuration variable for
469 # example) is available, and if appropriate to extract default values
470 # from pertinent package files. Call them using their associated
471 # 'require_*' variable to ensure that they are executed, at most, once.
473 # It's entirely deliberate that calling these functions can set
474 # variables that don't obey the namespace limitations obeyed by the rest
475 # of this file, in order that that they be as useful as possible to
479 # require_term_colors
480 # -------------------
481 # Allow display of bold text on terminals that support it.
482 require_term_colors=func_require_term_colors
483 func_require_term_colors ()
488 # COLORTERM and USE_ANSI_COLORS environment variables take
489 # precedence, because most terminfo databases neglect to describe
490 # whether color sequences are supported.
491 test -n "${COLORTERM+set}" && : ${USE_ANSI_COLORS="1"}
493 if test 1 = "$USE_ANSI_COLORS"; then
494 # Standard ANSI escape sequences
496 tc_bold='
\e[1m'; tc_standout='
\e[7m'
497 tc_red='
\e[31m'; tc_green='
\e[32m'
498 tc_blue='
\e[34m'; tc_cyan='
\e[36m'
500 # Otherwise trust the terminfo database after all.
501 test -n "`tput sgr0 2>/dev/null`" && {
503 test -n "`tput bold 2>/dev/null`" && tc_bold=`tput bold`
505 test -n "`tput smso 2>/dev/null`" && tc_standout=`tput smso`
506 test -n "`tput setaf 1 2>/dev/null`" && tc_red=`tput setaf 1`
507 test -n "`tput setaf 2 2>/dev/null`" && tc_green=`tput setaf 2`
508 test -n "`tput setaf 4 2>/dev/null`" && tc_blue=`tput setaf 4`
509 test -n "`tput setaf 5 2>/dev/null`" && tc_cyan=`tput setaf 5`
514 require_term_colors=:
518 ## ----------------- ##
519 ## Function library. ##
520 ## ----------------- ##
522 # This section contains a variety of useful functions to call in your
523 # scripts. Take note of the portable wrappers for features provided by
524 # some modern shells, which will fall back to slower equivalents on
525 # less featureful shells.
528 # func_append VAR VALUE
529 # ---------------------
530 # Append VALUE onto the existing contents of VAR.
532 # We should try to minimise forks, especially on Windows where they are
533 # unreasonably slow, so skip the feature probes when bash or zsh are
535 if test set = "${BASH_VERSION+set}${ZSH_VERSION+set}"; then
536 : ${_G_HAVE_ARITH_OP="yes"}
537 : ${_G_HAVE_XSI_OPS="yes"}
538 # The += operator was introduced in bash 3.1
539 case $BASH_VERSION in
540 [12].* | 3.0 | 3.0*) ;;
542 : ${_G_HAVE_PLUSEQ_OP="yes"}
548 # Can be empty, in which case the shell is probed, "yes" if += is
549 # useable or anything else if it does not work.
550 test -z "$_G_HAVE_PLUSEQ_OP" \
551 && (eval 'x=a; x+=" b"; test "a b" = "$x"') 2>/dev/null \
552 && _G_HAVE_PLUSEQ_OP=yes
554 if test yes = "$_G_HAVE_PLUSEQ_OP"
556 # This is an XSI compatible shell, allowing a faster implementation...
564 # ...otherwise fall back to using expr, which is often a shell builtin.
574 # func_append_quoted VAR VALUE
575 # ----------------------------
576 # Quote VALUE and append to the end of shell variable VAR, separated
578 if test yes = "$_G_HAVE_PLUSEQ_OP"; then
579 eval 'func_append_quoted ()
583 func_quote_for_eval "$2"
584 eval "$1+=\\ \$func_quote_for_eval_result"
587 func_append_quoted ()
591 func_quote_for_eval "$2"
592 eval "$1=\$$1\\ \$func_quote_for_eval_result"
597 # func_append_uniq VAR VALUE
598 # --------------------------
599 # Append unique VALUE onto the existing contents of VAR, assuming
600 # entries are delimited by the first character of VALUE. For example:
602 # func_append_uniq options " --another-option option-argument"
604 # will only append to $options if " --another-option option-argument "
605 # is not already present somewhere in $options already (note spaces at
606 # each end implied by leading space in second argument).
611 eval _G_current_value='`$ECHO $'$1'`'
612 _G_delim=`expr "$2" : '\(.\)'`
614 case $_G_delim$_G_current_value$_G_delim in
616 *) func_append "$@" ;;
623 # Set func_arith_result to the result of evaluating TERMs.
624 test -z "$_G_HAVE_ARITH_OP" \
625 && (eval 'test 2 = $(( 1 + 1 ))') 2>/dev/null \
626 && _G_HAVE_ARITH_OP=yes
628 if test yes = "$_G_HAVE_ARITH_OP"; then
633 func_arith_result=$(( $* ))
640 func_arith_result=`expr "$@"`
647 # Set func_basename_result to FILE with everything up to and including
648 # the last / stripped.
649 if test yes = "$_G_HAVE_XSI_OPS"; then
650 # If this shell supports suffix pattern removal, then use it to avoid
651 # forking. Hide the definitions single quotes in case the shell chokes
652 # on unsupported syntax...
653 _b='func_basename_result=${1##*/}'
655 */*) func_dirname_result=${1%/*}$2 ;;
656 * ) func_dirname_result=$3 ;;
660 # ...otherwise fall back to using sed.
661 _b='func_basename_result=`$ECHO "$1" |$SED "$sed_basename"`'
662 _d='func_dirname_result=`$ECHO "$1" |$SED "$sed_dirname"`
663 if test "X$func_dirname_result" = "X$1"; then
664 func_dirname_result=$3
666 func_append func_dirname_result "$2"
670 eval 'func_basename ()
678 # func_dirname FILE APPEND NONDIR_REPLACEMENT
679 # -------------------------------------------
680 # Compute the dirname of FILE. If nonempty, add APPEND to the result,
681 # otherwise set result to NONDIR_REPLACEMENT.
682 eval 'func_dirname ()
690 # func_dirname_and_basename FILE APPEND NONDIR_REPLACEMENT
691 # --------------------------------------------------------
692 # Perform func_basename and func_dirname in a single function
694 # dirname: Compute the dirname of FILE. If nonempty,
695 # add APPEND to the result, otherwise set result
696 # to NONDIR_REPLACEMENT.
697 # value returned in "$func_dirname_result"
698 # basename: Compute filename of FILE.
699 # value retuned in "$func_basename_result"
700 # For efficiency, we do not delegate to the functions above but instead
701 # duplicate the functionality here.
702 eval 'func_dirname_and_basename ()
713 # Echo program name prefixed message.
722 for _G_line in $_G_message; do
724 $ECHO "$progname: $_G_line"
730 # func_echo_all ARG...
731 # --------------------
732 # Invoke $ECHO with all args, space-separated.
739 # func_echo_infix_1 INFIX ARG...
740 # ------------------------------
741 # Echo program name, followed by INFIX on the first line, with any
742 # additional lines not showing INFIX.
751 _G_prefix="$progname: $_G_infix: "
754 # Strip color escape sequences before counting printable length
755 for _G_tc in "$tc_reset" "$tc_bold" "$tc_standout" "$tc_red" "$tc_green" "$tc_blue" "$tc_cyan"
757 test -n "$_G_tc" && {
758 _G_esc_tc=`$ECHO "$_G_tc" | $SED "$sed_make_literal_regex"`
759 _G_indent=`$ECHO "$_G_indent" | $SED "s|$_G_esc_tc||g"`
762 _G_indent="$progname: "`echo "$_G_indent" | $SED 's|.| |g'`" " ## exclude from sc_prohibit_nested_quotes
764 func_echo_infix_1_IFS=$IFS
766 for _G_line in $_G_message; do
767 IFS=$func_echo_infix_1_IFS
768 $ECHO "$_G_prefix$tc_bold$_G_line$tc_reset" >&2
771 IFS=$func_echo_infix_1_IFS
777 # Echo program name prefixed message to standard error.
784 func_echo_infix_1 " $tc_standout${tc_red}error$tc_reset" "$*" >&2
788 # func_fatal_error ARG...
789 # -----------------------
790 # Echo program name prefixed message to standard error, and exit.
800 # func_grep EXPRESSION FILENAME
801 # -----------------------------
802 # Check whether EXPRESSION matches any line of FILENAME, without output.
807 $GREP "$1" "$2" >/dev/null 2>&1
813 # Set func_len_result to the length of STRING. STRING may not
814 # start with a hyphen.
815 test -z "$_G_HAVE_XSI_OPS" \
817 test 5aa/bb/cc = "${#x}${x%%/*}${x%/*}${x#*/}${x##*/}"') 2>/dev/null \
818 && _G_HAVE_XSI_OPS=yes
820 if test yes = "$_G_HAVE_XSI_OPS"; then
825 func_len_result=${#1}
832 func_len_result=`expr "$1" : ".*" 2>/dev/null || echo $max_cmd_len`
837 # func_mkdir_p DIRECTORY-PATH
838 # ---------------------------
839 # Make sure the entire path to DIRECTORY-PATH is available.
847 if test -n "$_G_directory_path" && test : != "$opt_dry_run"; then
849 # Protect directory names starting with '-'
850 case $_G_directory_path in
851 -*) _G_directory_path=./$_G_directory_path ;;
854 # While some portion of DIR does not yet exist...
855 while test ! -d "$_G_directory_path"; do
856 # ...make a list in topmost first order. Use a colon delimited
857 # list incase some portion of path contains whitespace.
858 _G_dir_list=$_G_directory_path:$_G_dir_list
860 # If the last portion added has no slash in it, the list is done
861 case $_G_directory_path in */*) ;; *) break ;; esac
863 # ...otherwise throw away the child directory and loop
864 _G_directory_path=`$ECHO "$_G_directory_path" | $SED -e "$sed_dirname"`
866 _G_dir_list=`$ECHO "$_G_dir_list" | $SED 's|:*$||'`
868 func_mkdir_p_IFS=$IFS; IFS=:
869 for _G_dir in $_G_dir_list; do
870 IFS=$func_mkdir_p_IFS
871 # mkdir can fail with a 'File exist' error if two processes
872 # try to create one of the directories concurrently. Don't
874 $MKDIR "$_G_dir" 2>/dev/null || :
876 IFS=$func_mkdir_p_IFS
878 # Bail out if we (or some other process) failed to create a directory.
879 test -d "$_G_directory_path" || \
880 func_fatal_error "Failed to create '$1'"
885 # func_mktempdir [BASENAME]
886 # -------------------------
887 # Make a temporary directory that won't clash with other running
888 # libtool processes, and avoids race conditions if possible. If
889 # given, BASENAME is the basename for that directory.
894 _G_template=${TMPDIR-/tmp}/${1-$progname}
896 if test : = "$opt_dry_run"; then
897 # Return a directory name, but don't create it in dry-run mode
898 _G_tmpdir=$_G_template-$$
901 # If mktemp works, use that first and foremost
902 _G_tmpdir=`mktemp -d "$_G_template-XXXXXXXX" 2>/dev/null`
904 if test ! -d "$_G_tmpdir"; then
905 # Failing that, at least try and use $RANDOM to avoid a race
906 _G_tmpdir=$_G_template-${RANDOM-0}$$
908 func_mktempdir_umask=`umask`
911 umask $func_mktempdir_umask
914 # If we're not in dry-run mode, bomb out on failure
915 test -d "$_G_tmpdir" || \
916 func_fatal_error "cannot create temporary directory '$_G_tmpdir'"
923 # func_normal_abspath PATH
924 # ------------------------
925 # Remove doubled-up and trailing slashes, "." path components,
926 # and cancel out any ".." path components in PATH after making
927 # it an absolute path.
928 func_normal_abspath ()
932 # These SED scripts presuppose an absolute path with a trailing slash.
933 _G_pathcar='s|^/\([^/]*\).*$|\1|'
934 _G_pathcdr='s|^/[^/]*||'
935 _G_removedotparts=':dotsl
939 _G_collapseslashes='s|/\{1,\}|/|g'
940 _G_finalslash='s|/*$|/|'
942 # Start from root dir and reassemble the path.
943 func_normal_abspath_result=
944 func_normal_abspath_tpath=$1
945 func_normal_abspath_altnamespace=
946 case $func_normal_abspath_tpath in
948 # Empty path, that just means $cwd.
949 func_stripname '' '/' "`pwd`"
950 func_normal_abspath_result=$func_stripname_result
953 # The next three entries are used to spot a run of precisely
954 # two leading slashes without using negated character classes;
955 # we take advantage of case's first-match behaviour.
957 # Unusual form of absolute path, do nothing.
960 # Not necessarily an ordinary path; POSIX reserves leading '//'
961 # and for example Cygwin uses it to access remote file shares
962 # over CIFS/SMB, so we conserve a leading double slash if found.
963 func_normal_abspath_altnamespace=/
966 # Absolute path, do nothing.
969 # Relative path, prepend $cwd.
970 func_normal_abspath_tpath=`pwd`/$func_normal_abspath_tpath
974 # Cancel out all the simple stuff to save iterations. We also want
975 # the path to end with a slash for ease of parsing, so make sure
976 # there is one (and only one) here.
977 func_normal_abspath_tpath=`$ECHO "$func_normal_abspath_tpath" | $SED \
978 -e "$_G_removedotparts" -e "$_G_collapseslashes" -e "$_G_finalslash"`
980 # Processed it all yet?
981 if test / = "$func_normal_abspath_tpath"; then
982 # If we ascended to the root using ".." the result may be empty now.
983 if test -z "$func_normal_abspath_result"; then
984 func_normal_abspath_result=/
988 func_normal_abspath_tcomponent=`$ECHO "$func_normal_abspath_tpath" | $SED \
990 func_normal_abspath_tpath=`$ECHO "$func_normal_abspath_tpath" | $SED \
992 # Figure out what to do with it
993 case $func_normal_abspath_tcomponent in
995 # Trailing empty path component, ignore it.
998 # Parent dir; strip last assembled component from result.
999 func_dirname "$func_normal_abspath_result"
1000 func_normal_abspath_result=$func_dirname_result
1003 # Actual path component, append it.
1004 func_append func_normal_abspath_result "/$func_normal_abspath_tcomponent"
1008 # Restore leading double-slash if one was found on entry.
1009 func_normal_abspath_result=$func_normal_abspath_altnamespace$func_normal_abspath_result
1013 # func_notquiet ARG...
1014 # --------------------
1015 # Echo program name prefixed message only when not in quiet mode.
1020 $opt_quiet || func_echo ${1+"$@"}
1022 # A bug in bash halts the script if the last line of a function
1023 # fails when set -e is in force, so we need another command to
1029 # func_relative_path SRCDIR DSTDIR
1030 # --------------------------------
1031 # Set func_relative_path_result to the relative path from SRCDIR to DSTDIR.
1032 func_relative_path ()
1036 func_relative_path_result=
1037 func_normal_abspath "$1"
1038 func_relative_path_tlibdir=$func_normal_abspath_result
1039 func_normal_abspath "$2"
1040 func_relative_path_tbindir=$func_normal_abspath_result
1042 # Ascend the tree starting from libdir
1044 # check if we have found a prefix of bindir
1045 case $func_relative_path_tbindir in
1046 $func_relative_path_tlibdir)
1047 # found an exact match
1048 func_relative_path_tcancelled=
1051 $func_relative_path_tlibdir*)
1052 # found a matching prefix
1053 func_stripname "$func_relative_path_tlibdir" '' "$func_relative_path_tbindir"
1054 func_relative_path_tcancelled=$func_stripname_result
1055 if test -z "$func_relative_path_result"; then
1056 func_relative_path_result=.
1061 func_dirname $func_relative_path_tlibdir
1062 func_relative_path_tlibdir=$func_dirname_result
1063 if test -z "$func_relative_path_tlibdir"; then
1064 # Have to descend all the way to the root!
1065 func_relative_path_result=../$func_relative_path_result
1066 func_relative_path_tcancelled=$func_relative_path_tbindir
1069 func_relative_path_result=../$func_relative_path_result
1074 # Now calculate path; take care to avoid doubling-up slashes.
1075 func_stripname '' '/' "$func_relative_path_result"
1076 func_relative_path_result=$func_stripname_result
1077 func_stripname '/' '/' "$func_relative_path_tcancelled"
1078 if test -n "$func_stripname_result"; then
1079 func_append func_relative_path_result "/$func_stripname_result"
1082 # Normalisation. If bindir is libdir, return '.' else relative path.
1083 if test -n "$func_relative_path_result"; then
1084 func_stripname './' '' "$func_relative_path_result"
1085 func_relative_path_result=$func_stripname_result
1088 test -n "$func_relative_path_result" || func_relative_path_result=.
1094 # func_quote_for_eval ARG...
1095 # --------------------------
1096 # Aesthetically quote ARGs to be evaled later.
1097 # This function returns two values:
1098 # i) func_quote_for_eval_result
1099 # double-quoted, suitable for a subsequent eval
1100 # ii) func_quote_for_eval_unquoted_result
1101 # has all characters that are still active within double
1102 # quotes backslashified.
1103 func_quote_for_eval ()
1107 func_quote_for_eval_unquoted_result=
1108 func_quote_for_eval_result=
1109 while test 0 -lt $#; do
1112 _G_unquoted_arg=`printf '%s\n' "$1" |$SED "$sed_quote_subst"` ;;
1114 _G_unquoted_arg=$1 ;;
1116 if test -n "$func_quote_for_eval_unquoted_result"; then
1117 func_append func_quote_for_eval_unquoted_result " $_G_unquoted_arg"
1119 func_append func_quote_for_eval_unquoted_result "$_G_unquoted_arg"
1122 case $_G_unquoted_arg in
1123 # Double-quote args containing shell metacharacters to delay
1124 # word splitting, command substitution and variable expansion
1125 # for a subsequent eval.
1126 # Many Bourne shells cannot handle close brackets correctly
1127 # in scan sets, so we specify it separately.
1128 *[\[\~\#\^\&\*\(\)\{\}\|\;\<\>\?\'\ \ ]*|*]*|"")
1129 _G_quoted_arg=\"$_G_unquoted_arg\"
1132 _G_quoted_arg=$_G_unquoted_arg
1136 if test -n "$func_quote_for_eval_result"; then
1137 func_append func_quote_for_eval_result " $_G_quoted_arg"
1139 func_append func_quote_for_eval_result "$_G_quoted_arg"
1146 # func_quote_for_expand ARG
1147 # -------------------------
1148 # Aesthetically quote ARG to be evaled later; same as above,
1149 # but do not quote variable references.
1150 func_quote_for_expand ()
1156 _G_arg=`$ECHO "$1" | $SED \
1157 -e "$sed_double_quote_subst" -e "$sed_double_backslash"` ;;
1163 # Double-quote args containing shell metacharacters to delay
1164 # word splitting and command substitution for a subsequent eval.
1165 # Many Bourne shells cannot handle close brackets correctly
1166 # in scan sets, so we specify it separately.
1167 *[\[\~\#\^\&\*\(\)\{\}\|\;\<\>\?\'\ \ ]*|*]*|"")
1172 func_quote_for_expand_result=$_G_arg
1176 # func_stripname PREFIX SUFFIX NAME
1177 # ---------------------------------
1178 # strip PREFIX and SUFFIX from NAME, and store in func_stripname_result.
1179 # PREFIX and SUFFIX must not contain globbing or regex special
1180 # characters, hashes, percent signs, but SUFFIX may contain a leading
1181 # dot (in which case that matches only a dot).
1182 if test yes = "$_G_HAVE_XSI_OPS"; then
1183 eval 'func_stripname ()
1187 # pdksh 5.2.14 does not do ${X%$Y} correctly if both X and Y are
1188 # positional parameters, so assign one to ordinary variable first.
1189 func_stripname_result=$3
1190 func_stripname_result=${func_stripname_result#"$1"}
1191 func_stripname_result=${func_stripname_result%"$2"}
1199 .*) func_stripname_result=`$ECHO "$3" | $SED -e "s%^$1%%" -e "s%\\\\$2\$%%"`;;
1200 *) func_stripname_result=`$ECHO "$3" | $SED -e "s%^$1%%" -e "s%$2\$%%"`;;
1206 # func_show_eval CMD [FAIL_EXP]
1207 # -----------------------------
1208 # Unless opt_quiet is true, then output CMD. Then, if opt_dryrun is
1209 # not true, evaluate CMD. If the evaluation of CMD fails, and FAIL_EXP
1210 # is given, then evaluate it.
1216 _G_fail_exp=${2-':'}
1218 func_quote_for_expand "$_G_cmd"
1219 eval "func_notquiet $func_quote_for_expand_result"
1224 if test 0 -ne "$_G_status"; then
1225 eval "(exit $_G_status); $_G_fail_exp"
1231 # func_show_eval_locale CMD [FAIL_EXP]
1232 # ------------------------------------
1233 # Unless opt_quiet is true, then output CMD. Then, if opt_dryrun is
1234 # not true, evaluate CMD. If the evaluation of CMD fails, and FAIL_EXP
1235 # is given, then evaluate it. Use the saved locale for evaluation.
1236 func_show_eval_locale ()
1241 _G_fail_exp=${2-':'}
1244 func_quote_for_expand "$_G_cmd"
1245 eval "func_echo $func_quote_for_expand_result"
1249 eval "$_G_user_locale
1252 eval "$_G_safe_locale"
1253 if test 0 -ne "$_G_status"; then
1254 eval "(exit $_G_status); $_G_fail_exp"
1262 # Turn $1 into a string suitable for a shell variable name.
1263 # Result is stored in $func_tr_sh_result. All characters
1264 # not in the set a-zA-Z0-9_ are replaced with '_'. Further,
1265 # if $1 begins with a digit, a '_' is prepended as well.
1271 [0-9]* | *[!a-zA-Z0-9_]*)
1272 func_tr_sh_result=`$ECHO "$1" | $SED -e 's/^\([0-9]\)/_\1/' -e 's/[^a-zA-Z0-9_]/_/g'`
1275 func_tr_sh_result=$1
1281 # func_verbose ARG...
1282 # -------------------
1283 # Echo program name prefixed message in verbose mode only.
1288 $opt_verbose && func_echo "$*"
1294 # func_warn_and_continue ARG...
1295 # -----------------------------
1296 # Echo program name prefixed warning message to standard error.
1297 func_warn_and_continue ()
1301 $require_term_colors
1303 func_echo_infix_1 "${tc_red}warning$tc_reset" "$*" >&2
1307 # func_warning CATEGORY ARG...
1308 # ----------------------------
1309 # Echo program name prefixed warning message to standard error. Warning
1310 # messages can be filtered according to CATEGORY, where this function
1311 # elides messages where CATEGORY is not listed in the global variable
1312 # 'opt_warning_types'.
1317 # CATEGORY must be in the warning_categories list!
1318 case " $warning_categories " in
1320 *) func_internal_error "invalid warning category '$1'" ;;
1326 case " $opt_warning_types " in
1327 *" $_G_category "*) $warning_func ${1+"$@"} ;;
1332 # func_sort_ver VER1 VER2
1333 # -----------------------
1334 # 'sort -V' is not generally available.
1335 # Note this deviates from the version comparison in automake
1336 # in that it treats 1.5 < 1.5.0, and treats 1.4-p12a < 1.4-p3a
1337 # but this should suffice as we won't be specifying old
1338 # version formats or redundant trailing .0 in bootstrap.conf.
1339 # If we did want full compatibility then we should probably
1340 # use m4_version_compare from autoconf.
1345 printf '%s\n%s\n' "$1" "$2" \
1346 | sort -t. -k 1,1n -k 2,2n -k 3,3n -k 4,4n -k 5,5n -k 6,6n -k 7,7n -k 8,8n -k 9,9n
1349 # func_lt_ver PREV CURR
1350 # ---------------------
1351 # Return true if PREV and CURR are in the correct order according to
1352 # func_sort_ver, otherwise false. Use it like this:
1354 # func_lt_ver "$prev_ver" "$proposed_ver" || func_fatal_error "..."
1359 test "x$1" = x`func_sort_ver "$1" "$2" | $SED 1q`
1364 # mode: shell-script
1366 # eval: (add-hook 'before-save-hook 'time-stamp)
1367 # time-stamp-pattern: "10/scriptversion=%:y-%02m-%02d.%02H; # UTC"
1368 # time-stamp-time-zone: "UTC"
1372 # Set a version string for this script.
1373 scriptversion=2014-01-07.03; # UTC
1375 # A portable, pluggable option parser for Bourne shell.
1376 # Written by Gary V. Vaughan, 2010
1378 # Copyright (C) 2010-2014 Free Software Foundation, Inc.
1379 # This is free software; see the source for copying conditions. There is NO
1380 # warranty; not even for MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
1382 # This program is free software: you can redistribute it and/or modify
1383 # it under the terms of the GNU General Public License as published by
1384 # the Free Software Foundation, either version 3 of the License, or
1385 # (at your option) any later version.
1387 # This program is distributed in the hope that it will be useful,
1388 # but WITHOUT ANY WARRANTY; without even the implied warranty of
1389 # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
1390 # GNU General Public License for more details.
1392 # You should have received a copy of the GNU General Public License
1393 # along with this program. If not, see <http://www.gnu.org/licenses/>.
1395 # Please report bugs or propose patches to gary@gnu.org.
1402 # This file is a library for parsing options in your shell scripts along
1403 # with assorted other useful supporting features that you can make use
1406 # For the simplest scripts you might need only:
1409 # . relative/path/to/funclib.sh
1410 # . relative/path/to/options-parser
1412 # func_options ${1+"$@"}
1413 # eval set dummy "$func_options_result"; shift
1414 # ...rest of your script...
1416 # In order for the '--version' option to work, you will need to have a
1417 # suitably formatted comment like the one at the top of this file
1418 # starting with '# Written by ' and ending with '# warranty; '.
1420 # For '-h' and '--help' to work, you will also need a one line
1421 # description of your script's purpose in a comment directly above the
1422 # '# Written by ' line, like the one at the top of this file.
1424 # The default options also support '--debug', which will turn on shell
1425 # execution tracing (see the comment above debug_cmd below for another
1426 # use), and '--verbose' and the func_verbose function to allow your script
1427 # to display verbose messages only when your user has specified
1430 # After sourcing this file, you can plug processing for additional
1431 # options by amending the variables from the 'Configuration' section
1432 # below, and following the instructions in the 'Option parsing'
1433 # section further down.
1435 ## -------------- ##
1436 ## Configuration. ##
1437 ## -------------- ##
1439 # You should override these variables in your script after sourcing this
1440 # file so that they reflect the customisations you have added to the
1443 # The usage line for option parsing errors and the start of '-h' and
1444 # '--help' output messages. You can embed shell variables for delayed
1445 # expansion at the time the message is displayed, but you will need to
1446 # quote other shell meta-characters carefully to prevent them being
1447 # expanded when the contents are evaled.
1448 usage='$progpath [OPTION]...'
1450 # Short help message in response to '-h' and '--help'. Add to this or
1451 # override it after sourcing this library to reflect the full set of
1452 # options your script accepts.
1454 --debug enable verbose shell tracing
1455 -W, --warnings=CATEGORY
1456 report the warnings falling in CATEGORY [all]
1457 -v, --verbose verbosely report processing
1458 --version print version information and exit
1459 -h, --help print short or long help message and exit
1462 # Additional text appended to 'usage_message' in response to '--help'.
1464 Warning categories include:
1465 'all' show all warnings
1466 'none' turn off all the warnings
1467 'error' warnings are treated as fatal errors"
1469 # Help message printed before fatal option parsing errors.
1470 fatal_help="Try '\$progname --help' for more information."
1474 ## ------------------------- ##
1475 ## Hook function management. ##
1476 ## ------------------------- ##
1478 # This section contains functions for adding, removing, and running hooks
1479 # to the main code. A hook is just a named list of of function, that can
1480 # be run in order later on.
1482 # func_hookable FUNC_NAME
1483 # -----------------------
1484 # Declare that FUNC_NAME will run hooks added with
1485 # 'func_add_hook FUNC_NAME ...'.
1490 func_append hookable_fns " $1"
1494 # func_add_hook FUNC_NAME HOOK_FUNC
1495 # ---------------------------------
1496 # Request that FUNC_NAME call HOOK_FUNC before it returns. FUNC_NAME must
1497 # first have been declared "hookable" by a call to 'func_hookable'.
1502 case " $hookable_fns " in
1504 *) func_fatal_error "'$1' does not accept hook functions." ;;
1507 eval func_append ${1}_hooks '" $2"'
1511 # func_remove_hook FUNC_NAME HOOK_FUNC
1512 # ------------------------------------
1513 # Remove HOOK_FUNC from the list of functions called by FUNC_NAME.
1518 eval ${1}_hooks='`$ECHO "\$'$1'_hooks" |$SED "s| '$2'||"`'
1522 # func_run_hooks FUNC_NAME [ARG]...
1523 # ---------------------------------
1524 # Run all hook functions registered to FUNC_NAME.
1525 # It is assumed that the list of hook functions contains nothing more
1526 # than a whitespace-delimited list of legal shell function names, and
1527 # no effort is wasted trying to catch shell meta-characters or preserve
1533 case " $hookable_fns " in
1535 *) func_fatal_error "'$1' does not support hook funcions.n" ;;
1538 eval _G_hook_fns=\$$1_hooks; shift
1540 for _G_hook in $_G_hook_fns; do
1541 eval $_G_hook '"$@"'
1543 # store returned options list back into positional
1544 # parameters for next 'cmd' execution.
1545 eval _G_hook_result=\$${_G_hook}_result
1546 eval set dummy "$_G_hook_result"; shift
1549 func_quote_for_eval ${1+"$@"}
1550 func_run_hooks_result=$func_quote_for_eval_result
1555 ## --------------- ##
1556 ## Option parsing. ##
1557 ## --------------- ##
1559 # In order to add your own option parsing hooks, you must accept the
1560 # full positional parameter list in your hook function, remove any
1561 # options that you action, and then pass back the remaining unprocessed
1562 # options in '<hooked_function_name>_result', escaped suitably for
1563 # 'eval'. Like this:
1565 # my_options_prep ()
1569 # # Extend the existing usage message.
1570 # usage_message=$usage_message'
1571 # -s, --silent don'\''t print informational messages
1574 # func_quote_for_eval ${1+"$@"}
1575 # my_options_prep_result=$func_quote_for_eval_result
1577 # func_add_hook func_options_prep my_options_prep
1580 # my_silent_option ()
1584 # # Note that for efficiency, we parse as many options as we can
1585 # # recognise in a loop before passing the remainder back to the
1586 # # caller on the first unrecognised argument we encounter.
1587 # while test $# -gt 0; do
1590 # --silent|-s) opt_silent=: ;;
1591 # # Separate non-argument short options:
1592 # -s*) func_split_short_opt "$_G_opt"
1593 # set dummy "$func_split_short_opt_name" \
1594 # "-$func_split_short_opt_arg" ${1+"$@"}
1597 # *) set dummy "$_G_opt" "$*"; shift; break ;;
1601 # func_quote_for_eval ${1+"$@"}
1602 # my_silent_option_result=$func_quote_for_eval_result
1604 # func_add_hook func_parse_options my_silent_option
1607 # my_option_validation ()
1611 # $opt_silent && $opt_verbose && func_fatal_help "\
1612 # '--silent' and '--verbose' options are mutually exclusive."
1614 # func_quote_for_eval ${1+"$@"}
1615 # my_option_validation_result=$func_quote_for_eval_result
1617 # func_add_hook func_validate_options my_option_validation
1619 # You'll alse need to manually amend $usage_message to reflect the extra
1620 # options you parse. It's preferable to append if you can, so that
1621 # multiple option parsing hooks can be added safely.
1624 # func_options [ARG]...
1625 # ---------------------
1626 # All the functions called inside func_options are hookable. See the
1627 # individual implementations for details.
1628 func_hookable func_options
1633 func_options_prep ${1+"$@"}
1634 eval func_parse_options \
1635 ${func_options_prep_result+"$func_options_prep_result"}
1636 eval func_validate_options \
1637 ${func_parse_options_result+"$func_parse_options_result"}
1639 eval func_run_hooks func_options \
1640 ${func_validate_options_result+"$func_validate_options_result"}
1642 # save modified positional parameters for caller
1643 func_options_result=$func_run_hooks_result
1647 # func_options_prep [ARG]...
1648 # --------------------------
1649 # All initialisations required before starting the option parse loop.
1650 # Note that when calling hook functions, we pass through the list of
1651 # positional parameters. If a hook function modifies that list, and
1652 # needs to propogate that back to rest of this script, then the complete
1653 # modified list must be put in 'func_run_hooks_result' before
1655 func_hookable func_options_prep
1656 func_options_prep ()
1664 func_run_hooks func_options_prep ${1+"$@"}
1666 # save modified positional parameters for caller
1667 func_options_prep_result=$func_run_hooks_result
1671 # func_parse_options [ARG]...
1672 # ---------------------------
1673 # The main option parsing loop.
1674 func_hookable func_parse_options
1675 func_parse_options ()
1679 func_parse_options_result=
1681 # this just eases exit handling
1682 while test $# -gt 0; do
1683 # Defer to hook functions for initial option parsing, so they
1684 # get priority in the event of reusing an option name.
1685 func_run_hooks func_parse_options ${1+"$@"}
1687 # Adjust func_parse_options positional parameters to match
1688 eval set dummy "$func_run_hooks_result"; shift
1690 # Break out of the loop if we already parsed every option.
1691 test $# -gt 0 || break
1696 --debug|-x) debug_cmd='set -x'
1697 func_echo "enabling shell trace mode"
1701 --no-warnings|--no-warning|--no-warn)
1702 set dummy --warnings none ${1+"$@"}
1706 --warnings|--warning|-W)
1707 test $# = 0 && func_missing_arg $_G_opt && break
1708 case " $warning_categories $1" in
1710 # trailing space prevents matching last $1 above
1711 func_append_uniq opt_warning_types " $1"
1714 opt_warning_types=$warning_categories
1717 opt_warning_types=none
1721 opt_warning_types=$warning_categories
1722 warning_func=func_fatal_error
1726 "unsupported warning category: '$1'"
1732 --verbose|-v) opt_verbose=: ;;
1733 --version) func_version ;;
1734 -\?|-h) func_usage ;;
1735 --help) func_help ;;
1737 # Separate optargs to long options (plugins may need this):
1738 --*=*) func_split_equals "$_G_opt"
1739 set dummy "$func_split_equals_lhs" \
1740 "$func_split_equals_rhs" ${1+"$@"}
1744 # Separate optargs to short options:
1746 func_split_short_opt "$_G_opt"
1747 set dummy "$func_split_short_opt_name" \
1748 "$func_split_short_opt_arg" ${1+"$@"}
1752 # Separate non-argument short options:
1754 func_split_short_opt "$_G_opt"
1755 set dummy "$func_split_short_opt_name" \
1756 "-$func_split_short_opt_arg" ${1+"$@"}
1761 -*) func_fatal_help "unrecognised option: '$_G_opt'" ;;
1762 *) set dummy "$_G_opt" ${1+"$@"}; shift; break ;;
1766 # save modified positional parameters for caller
1767 func_quote_for_eval ${1+"$@"}
1768 func_parse_options_result=$func_quote_for_eval_result
1772 # func_validate_options [ARG]...
1773 # ------------------------------
1774 # Perform any sanity checks on option settings and/or unconsumed
1776 func_hookable func_validate_options
1777 func_validate_options ()
1781 # Display all warnings if -W was not given.
1782 test -n "$opt_warning_types" || opt_warning_types=" $warning_categories"
1784 func_run_hooks func_validate_options ${1+"$@"}
1786 # Bail if the options were screwed!
1787 $exit_cmd $EXIT_FAILURE
1789 # save modified positional parameters for caller
1790 func_validate_options_result=$func_run_hooks_result
1795 ## ----------------- ##
1796 ## Helper functions. ##
1797 ## ----------------- ##
1799 # This section contains the helper functions used by the rest of the
1800 # hookable option parser framework in ascii-betical order.
1803 # func_fatal_help ARG...
1804 # ----------------------
1805 # Echo program name prefixed message to standard error, followed by
1806 # a help hint, and exit.
1811 eval \$ECHO \""Usage: $usage"\"
1812 eval \$ECHO \""$fatal_help"\"
1813 func_error ${1+"$@"}
1820 # Echo long help message to standard output and exit.
1826 $ECHO "$long_help_message"
1831 # func_missing_arg ARGNAME
1832 # ------------------------
1833 # Echo program name prefixed message to standard error and set global
1839 func_error "Missing argument for '$1'."
1844 # func_split_equals STRING
1845 # ------------------------
1846 # Set func_split_equals_lhs and func_split_equals_rhs shell variables after
1847 # splitting STRING at the '=' sign.
1848 test -z "$_G_HAVE_XSI_OPS" \
1850 test 5aa/bb/cc = "${#x}${x%%/*}${x%/*}${x#*/}${x##*/}"') 2>/dev/null \
1851 && _G_HAVE_XSI_OPS=yes
1853 if test yes = "$_G_HAVE_XSI_OPS"
1855 # This is an XSI compatible shell, allowing a faster implementation...
1856 eval 'func_split_equals ()
1860 func_split_equals_lhs=${1%%=*}
1861 func_split_equals_rhs=${1#*=}
1862 test "x$func_split_equals_lhs" = "x$1" \
1863 && func_split_equals_rhs=
1866 # ...otherwise fall back to using expr, which is often a shell builtin.
1867 func_split_equals ()
1871 func_split_equals_lhs=`expr "x$1" : 'x\([^=]*\)'`
1872 func_split_equals_rhs=
1873 test "x$func_split_equals_lhs" = "x$1" \
1874 || func_split_equals_rhs=`expr "x$1" : 'x[^=]*=\(.*\)$'`
1876 fi #func_split_equals
1879 # func_split_short_opt SHORTOPT
1880 # -----------------------------
1881 # Set func_split_short_opt_name and func_split_short_opt_arg shell
1882 # variables after splitting SHORTOPT after the 2nd character.
1883 if test yes = "$_G_HAVE_XSI_OPS"
1885 # This is an XSI compatible shell, allowing a faster implementation...
1886 eval 'func_split_short_opt ()
1890 func_split_short_opt_arg=${1#??}
1891 func_split_short_opt_name=${1%"$func_split_short_opt_arg"}
1894 # ...otherwise fall back to using expr, which is often a shell builtin.
1895 func_split_short_opt ()
1899 func_split_short_opt_name=`expr "x$1" : 'x-\(.\)'`
1900 func_split_short_opt_arg=`expr "x$1" : 'x-.\(.*\)$'`
1902 fi #func_split_short_opt
1907 # Echo short help message to standard output and exit.
1913 $ECHO "Run '$progname --help |${PAGER-more}' for full usage"
1918 # func_usage_message
1919 # ------------------
1920 # Echo short help message to standard output.
1921 func_usage_message ()
1925 eval \$ECHO \""Usage: $usage"\"
1932 /^Written by/q' < "$progpath"
1934 eval \$ECHO \""$usage_message"\"
1940 # Echo version message to standard output and exit.
1945 printf '%s\n' "$progname $scriptversion"
1955 /^# Written by /,/# warranty; / {
1958 s|\((C)\)[ 0-9,-]*[ ,-]\([1-9][0-9]* \)|\1 \2|
1965 /^warranty; /q' < "$progpath"
1972 # mode: shell-script
1974 # eval: (add-hook 'before-save-hook 'time-stamp)
1975 # time-stamp-pattern: "10/scriptversion=%:y-%02m-%02d.%02H; # UTC"
1976 # time-stamp-time-zone: "UTC"
1979 # Set a version string.
1980 scriptversion='(GNU libtool) 2.4.2.444.28-053d'
1985 # Libtool also displays the current mode in messages, so override
1986 # funclib.sh func_echo with this custom definition.
1995 for _G_line in $_G_message; do
1997 $ECHO "$progname${opt_mode+: $opt_mode}: $_G_line"
2003 # func_warning ARG...
2004 # -------------------
2005 # Libtool warnings are not categorized, so override funclib.sh
2006 # func_warning with this simpler definition.
2011 $warning_func ${1+"$@"}
2015 ## ---------------- ##
2016 ## Options parsing. ##
2017 ## ---------------- ##
2019 # Hook in the functions to make sure our own options are parsed during
2020 # the option parsing loop.
2022 usage='$progpath [OPTION]... [MODE-ARG]...'
2024 # Short help message in response to '-h'.
2025 usage_message="Options:
2026 --config show all configuration variables
2027 --debug enable verbose shell tracing
2028 -n, --dry-run display commands without modifying any files
2029 --features display basic configuration information and exit
2030 --mode=MODE use operation mode MODE
2031 --no-warnings equivalent to '-Wnone'
2032 --preserve-dup-deps don't remove duplicate dependency libraries
2033 --quiet, --silent don't print informational messages
2034 --tag=TAG use configuration variables from tag TAG
2035 -v, --verbose print more informational messages than default
2036 --version print version information
2037 -W, --warnings=CATEGORY report the warnings falling in CATEGORY [all]
2038 -h, --help, --help-all print short, long, or detailed help message
2041 # Additional text appended to 'usage_message' in response to '--help'.
2042 long_help_message=$long_help_message"
2044 MODE must be one of the following:
2046 clean remove files from the build directory
2047 compile compile a source file into a libtool object
2048 execute automatically set library path, then run a program
2049 finish complete the installation of libtool libraries
2050 install install libraries or executables
2051 link create a library or an executable
2052 uninstall remove libraries from an installed directory
2054 MODE-ARGS vary depending on the MODE. When passed as first option,
2055 '--mode=MODE' may be abbreviated as 'MODE' or a unique abbreviation of that.
2056 Try '$progname --help --mode=MODE' for a more detailed description of MODE.
2058 When reporting a bug, please describe a test case to reproduce it and
2059 include the following information:
2064 compiler flags: $LTCFLAGS
2065 linker: $LD (gnu? $with_gnu_ld)
2066 version: $progname (GNU libtool) 2.4.2.444.28-053d
2067 automake: `($AUTOMAKE --version) 2>/dev/null |$SED 1q`
2068 autoconf: `($AUTOCONF --version) 2>/dev/null |$SED 1q`
2070 Report bugs to <bug-libtool@gnu.org>.
2071 GNU libtool home page: <http://www.gnu.org/s/libtool/>.
2072 General help using GNU software: <http://www.gnu.org/gethelp/>."
2075 # func_lo2o OBJECT-NAME
2076 # ---------------------
2077 # Transform OBJECT-NAME from a '.lo' suffix to the platform specific
2080 lo2o=s/\\.lo\$/.$objext/
2081 o2lo=s/\\.$objext\$/.lo/
2083 if test yes = "$_G_HAVE_XSI_OPS"; then
2087 *.lo) func_lo2o_result=${1%.lo}.$objext ;;
2088 * ) func_lo2o_result=$1 ;;
2092 # func_xform LIBOBJ-OR-SOURCE
2093 # ---------------------------
2094 # Transform LIBOBJ-OR-SOURCE from a '.o' or '.c' (or otherwise)
2095 # suffix to a '.lo' libtool-object suffix.
2098 func_xform_result=${1%.*}.lo
2101 # ...otherwise fall back to using sed.
2104 func_lo2o_result=`$ECHO "$1" | $SED "$lo2o"`
2109 func_xform_result=`$ECHO "$1" | $SED 's|\.[^.]*$|.lo|'`
2114 # func_fatal_configuration ARG...
2115 # -------------------------------
2116 # Echo program name prefixed message to standard error, followed by
2117 # a configuration failure hint, and exit.
2118 func_fatal_configuration ()
2120 func__fatal_error ${1+"$@"} \
2121 "See the $PACKAGE documentation for more information." \
2122 "Fatal configuration error."
2128 # Display the configuration for all the tags in this script.
2131 re_begincf='^# ### BEGIN LIBTOOL'
2132 re_endcf='^# ### END LIBTOOL'
2134 # Default configuration.
2135 $SED "1,/$re_begincf CONFIG/d;/$re_endcf CONFIG/,\$d" < "$progpath"
2137 # Now print the configurations for the tags.
2138 for tagname in $taglist; do
2139 $SED -n "/$re_begincf TAG CONFIG: $tagname\$/,/$re_endcf TAG CONFIG: $tagname\$/p" < "$progpath"
2148 # Display the features supported by this script.
2152 if test yes = "$build_libtool_libs"; then
2153 echo "enable shared libraries"
2155 echo "disable shared libraries"
2157 if test yes = "$build_old_libs"; then
2158 echo "enable static libraries"
2160 echo "disable static libraries"
2167 # func_enable_tag TAGNAME
2168 # -----------------------
2169 # Verify that TAGNAME is valid, and either flag an error and exit, or
2170 # enable the TAGNAME tag. We also add TAGNAME to the global $taglist
2177 re_begincf="^# ### BEGIN LIBTOOL TAG CONFIG: $tagname\$"
2178 re_endcf="^# ### END LIBTOOL TAG CONFIG: $tagname\$"
2179 sed_extractcf=/$re_begincf/,/$re_endcf/p
2184 func_fatal_error "invalid tag name: $tagname"
2188 # Don't test for the "default" C tag, as we know it's
2189 # there but not specially marked.
2193 if $GREP "$re_begincf" "$progpath" >/dev/null 2>&1; then
2194 taglist="$taglist $tagname"
2196 # Evaluate the configuration. Be careful to quote the path
2197 # and the sed script, to avoid splitting on whitespace, but
2198 # also don't use non-portable quotes within backquotes within
2199 # quotes we have to do it in 2 steps:
2200 extractedcf=`$SED -n -e "$sed_extractcf" < "$progpath"`
2203 func_error "ignoring unknown tag $tagname"
2210 # func_check_version_match
2211 # ------------------------
2212 # Ensure that we are using m4 macros, and libtool script from the same
2213 # release of libtool.
2214 func_check_version_match ()
2216 if test "$package_revision" != "$macro_revision"; then
2217 if test "$VERSION" != "$macro_version"; then
2218 if test -z "$macro_version"; then
2220 $progname: Version mismatch error. This is $PACKAGE $VERSION, but the
2221 $progname: definition of this LT_INIT comes from an older release.
2222 $progname: You should recreate aclocal.m4 with macros from $PACKAGE $VERSION
2223 $progname: and run autoconf again.
2227 $progname: Version mismatch error. This is $PACKAGE $VERSION, but the
2228 $progname: definition of this LT_INIT comes from $PACKAGE $macro_version.
2229 $progname: You should recreate aclocal.m4 with macros from $PACKAGE $VERSION
2230 $progname: and run autoconf again.
2235 $progname: Version mismatch error. This is $PACKAGE $VERSION, revision $package_revision,
2236 $progname: but the definition of this LT_INIT comes from revision $macro_revision.
2237 $progname: You should recreate aclocal.m4 with macros from revision $package_revision
2238 $progname: of $PACKAGE $VERSION and run autoconf again.
2247 # libtool_options_prep [ARG]...
2248 # -----------------------------
2249 # Preparation for options parsed by libtool.
2250 libtool_options_prep ()
2260 opt_preserve_dup_deps=false
2266 # Shorthand for --mode=foo, only valid as the first argument
2269 shift; set dummy --mode clean ${1+"$@"}; shift
2271 compile|compil|compi|comp|com|co|c)
2272 shift; set dummy --mode compile ${1+"$@"}; shift
2274 execute|execut|execu|exec|exe|ex|e)
2275 shift; set dummy --mode execute ${1+"$@"}; shift
2277 finish|finis|fini|fin|fi|f)
2278 shift; set dummy --mode finish ${1+"$@"}; shift
2280 install|instal|insta|inst|ins|in|i)
2281 shift; set dummy --mode install ${1+"$@"}; shift
2284 shift; set dummy --mode link ${1+"$@"}; shift
2286 uninstall|uninstal|uninsta|uninst|unins|unin|uni|un|u)
2287 shift; set dummy --mode uninstall ${1+"$@"}; shift
2291 # Pass back the list of options.
2292 func_quote_for_eval ${1+"$@"}
2293 libtool_options_prep_result=$func_quote_for_eval_result
2295 func_add_hook func_options_prep libtool_options_prep
2298 # libtool_parse_options [ARG]...
2299 # ---------------------------------
2300 # Provide handling for libtool specific options.
2301 libtool_parse_options ()
2305 # Perform our own loop to consume as many options as possible in
2307 while test $# -gt 0; do
2311 --dry-run|--dryrun|-n)
2315 --config) func_config ;;
2318 opt_dlopen="${opt_dlopen+$opt_dlopen
2323 --preserve-dup-deps)
2324 opt_preserve_dup_deps=: ;;
2326 --features) func_features ;;
2328 --finish) set dummy --mode finish ${1+"$@"}; shift ;;
2330 --help) opt_help=: ;;
2332 --help-all) opt_help=': help-all' ;;
2334 --mode) test $# = 0 && func_missing_arg $_G_opt && break
2337 # Valid mode arguments:
2338 clean|compile|execute|finish|install|link|relink|uninstall) ;;
2340 # Catch anything else as an error
2341 *) func_error "invalid argument for $_G_opt"
2349 --no-silent|--no-quiet)
2351 func_append preserve_args " $_G_opt"
2354 --no-warnings|--no-warning|--no-warn)
2356 func_append preserve_args " $_G_opt"
2361 func_append preserve_args " $_G_opt"
2367 func_append preserve_args " $_G_opt"
2370 --tag) test $# = 0 && func_missing_arg $_G_opt && break
2372 func_append preserve_args " $_G_opt $1"
2373 func_enable_tag "$1"
2377 --verbose|-v) opt_quiet=false
2379 func_append preserve_args " $_G_opt"
2382 # An option not handled by this hook function:
2383 *) set dummy "$_G_opt" ${1+"$@"}; shift; break ;;
2388 # save modified positional parameters for caller
2389 func_quote_for_eval ${1+"$@"}
2390 libtool_parse_options_result=$func_quote_for_eval_result
2392 func_add_hook func_parse_options libtool_parse_options
2396 # libtool_validate_options [ARG]...
2397 # ---------------------------------
2398 # Perform any sanity checks on option settings and/or unconsumed
2400 libtool_validate_options ()
2402 # save first non-option argument
2403 if test 0 -lt $#; then
2409 test : = "$debug_cmd" || func_append preserve_args " --debug"
2412 # Solaris2 added to fix http://debbugs.gnu.org/cgi/bugreport.cgi?bug=16452
2413 # see also: http://gcc.gnu.org/bugzilla/show_bug.cgi?id=59788
2414 *cygwin* | *mingw* | *pw32* | *cegcc* | *solaris2*)
2415 # don't eliminate duplications in $postdeps and $predeps
2416 opt_duplicate_compiler_generated_deps=:
2419 opt_duplicate_compiler_generated_deps=$opt_preserve_dup_deps
2424 # Sanity checks first:
2425 func_check_version_match
2427 test yes != "$build_libtool_libs" \
2428 && test yes != "$build_old_libs" \
2429 && func_fatal_configuration "not configured to build any kind of library"
2432 eval std_shrext=\"$shrext_cmds\"
2434 # Only execute mode is allowed to have -dlopen flags.
2435 if test -n "$opt_dlopen" && test execute != "$opt_mode"; then
2436 func_error "unrecognized option '-dlopen'"
2441 # Change the help message to a mode-specific one.
2443 help="Try '$progname --help --mode=$opt_mode' for more information."
2446 # Pass back the unparsed argument list
2447 func_quote_for_eval ${1+"$@"}
2448 libtool_validate_options_result=$func_quote_for_eval_result
2450 func_add_hook func_validate_options libtool_validate_options
2453 # Process options as early as possible so that --help and --version
2454 # can return quickly.
2455 func_options ${1+"$@"}
2456 eval set dummy "$func_options_result"; shift
2464 magic='%%%MAGIC variable%%%'
2465 magic_exe='%%%MAGIC EXE variable%%%'
2471 # If this variable is set in any of the actions, the command in it
2472 # will be execed at the end. This prevents here-documents from being
2473 # left over by shells.
2477 # A function that is used when there is no print builtin or printf.
2478 func_fallback_echo ()
2480 eval 'cat <<_LTECHO_EOF
2486 # True iff FILE is a libtool '.la' library or '.lo' object file.
2487 # This function is only a basic sanity check; it will hardly flush out
2488 # determined imposters.
2492 $SED -e 4q "$1" 2>/dev/null \
2493 | $GREP "^# Generated by .*$PACKAGE" > /dev/null 2>&1
2496 # func_lalib_unsafe_p file
2497 # True iff FILE is a libtool '.la' library or '.lo' object file.
2498 # This function implements the same check as func_lalib_p without
2499 # resorting to external programs. To this end, it redirects stdin and
2500 # closes it afterwards, without saving the original file descriptor.
2501 # As a safety measure, use it only where a negative result would be
2502 # fatal anyway. Works if 'file' does not exist.
2503 func_lalib_unsafe_p ()
2506 if test -f "$1" && test -r "$1" && exec 5<&0 <"$1"; then
2507 for lalib_p_l in 1 2 3 4
2510 case $lalib_p_line in
2511 \#\ Generated\ by\ *$PACKAGE* ) lalib_p=yes; break;;
2516 test yes = "$lalib_p"
2519 # func_ltwrapper_script_p file
2520 # True iff FILE is a libtool wrapper script
2521 # This function is only a basic sanity check; it will hardly flush out
2522 # determined imposters.
2523 func_ltwrapper_script_p ()
2528 # func_ltwrapper_executable_p file
2529 # True iff FILE is a libtool wrapper executable
2530 # This function is only a basic sanity check; it will hardly flush out
2531 # determined imposters.
2532 func_ltwrapper_executable_p ()
2534 func_ltwrapper_exec_suffix=
2537 *) func_ltwrapper_exec_suffix=.exe ;;
2539 $GREP "$magic_exe" "$1$func_ltwrapper_exec_suffix" >/dev/null 2>&1
2542 # func_ltwrapper_scriptname file
2543 # Assumes file is an ltwrapper_executable
2544 # uses $file to determine the appropriate filename for a
2545 # temporary ltwrapper_script.
2546 func_ltwrapper_scriptname ()
2548 func_dirname_and_basename "$1" "" "."
2549 func_stripname '' '.exe' "$func_basename_result"
2550 func_ltwrapper_scriptname_result=$func_dirname_result/$objdir/${func_stripname_result}_ltshwrapper
2553 # func_ltwrapper_p file
2554 # True iff FILE is a libtool wrapper script or wrapper executable
2555 # This function is only a basic sanity check; it will hardly flush out
2556 # determined imposters.
2559 func_ltwrapper_script_p "$1" || func_ltwrapper_executable_p "$1"
2563 # func_execute_cmds commands fail_cmd
2564 # Execute tilde-delimited COMMANDS.
2565 # If FAIL_CMD is given, eval that upon failure.
2566 # FAIL_CMD may read-access the current command in variable CMD!
2567 func_execute_cmds ()
2571 save_ifs=$IFS; IFS='~'
2576 func_show_eval "$cmd" "${2-:}"
2583 # Source FILE, adding directory component if necessary.
2584 # Note that it is not necessary on cygwin/mingw to append a dot to
2585 # FILE even if both FILE and FILE.exe exist: automatic-append-.exe
2586 # behavior happens only for exec(3), not for open(2)! Also, sourcing
2587 # 'FILE.' does not work on cygwin managed mounts.
2593 */* | *\\*) . "$1" ;;
2599 # func_resolve_sysroot PATH
2600 # Replace a leading = in PATH with a sysroot. Store the result into
2601 # func_resolve_sysroot_result
2602 func_resolve_sysroot ()
2604 func_resolve_sysroot_result=$1
2605 case $func_resolve_sysroot_result in
2607 func_stripname '=' '' "$func_resolve_sysroot_result"
2608 func_resolve_sysroot_result=$lt_sysroot$func_stripname_result
2613 # func_replace_sysroot PATH
2614 # If PATH begins with the sysroot, replace it with = and
2615 # store the result into func_replace_sysroot_result.
2616 func_replace_sysroot ()
2618 case $lt_sysroot:$1 in
2620 func_stripname "$lt_sysroot" '' "$1"
2621 func_replace_sysroot_result='='$func_stripname_result
2624 # Including no sysroot.
2625 func_replace_sysroot_result=$1
2630 # func_infer_tag arg
2631 # Infer tagged configuration to use if any are available and
2632 # if one wasn't chosen via the "--tag" command line option.
2633 # Only attempt this if the compiler in the base compile
2634 # command doesn't match the default compiler.
2635 # arg is usually of the form 'gcc ...'
2640 if test -n "$available_tags" && test -z "$tagname"; then
2643 func_append_quoted CC_quoted "$arg"
2645 CC_expanded=`func_echo_all $CC`
2646 CC_quoted_expanded=`func_echo_all $CC_quoted`
2648 # Blanks in the command may have been stripped by the calling shell,
2649 # but not from the CC environment variable when configure was run.
2650 " $CC "* | "$CC "* | " $CC_expanded "* | "$CC_expanded "* | \
2651 " $CC_quoted"* | "$CC_quoted "* | " $CC_quoted_expanded "* | "$CC_quoted_expanded "*) ;;
2652 # Blanks at the start of $base_compile will cause this to fail
2653 # if we don't check for them as well.
2655 for z in $available_tags; do
2656 if $GREP "^# ### BEGIN LIBTOOL TAG CONFIG: $z$" < "$progpath" > /dev/null; then
2657 # Evaluate the configuration.
2658 eval "`$SED -n -e '/^# ### BEGIN LIBTOOL TAG CONFIG: '$z'$/,/^# ### END LIBTOOL TAG CONFIG: '$z'$/p' < $progpath`"
2661 # Double-quote args containing other shell metacharacters.
2662 func_append_quoted CC_quoted "$arg"
2664 CC_expanded=`func_echo_all $CC`
2665 CC_quoted_expanded=`func_echo_all $CC_quoted`
2667 " $CC "* | "$CC "* | " $CC_expanded "* | "$CC_expanded "* | \
2668 " $CC_quoted"* | "$CC_quoted "* | " $CC_quoted_expanded "* | "$CC_quoted_expanded "*)
2669 # The compiler in the base compile command matches
2670 # the one in the tagged configuration.
2671 # Assume this is the tagged configuration we want.
2678 # If $tagname still isn't set, then no tagged configuration
2679 # was found and let the user know that the "--tag" command
2680 # line option must be used.
2681 if test -z "$tagname"; then
2682 func_echo "unable to infer tagged configuration"
2683 func_fatal_error "specify a tag with '--tag'"
2685 # func_verbose "using $tagname tagged configuration"
2694 # func_write_libtool_object output_name pic_name nonpic_name
2695 # Create a libtool object file (analogous to a ".la" file),
2696 # but don't create it if we're doing a dry run.
2697 func_write_libtool_object ()
2700 if test yes = "$build_libtool_libs"; then
2706 if test yes = "$build_old_libs"; then
2713 cat >${write_libobj}T <<EOF
2714 # $write_libobj - a libtool object file
2715 # Generated by $PROGRAM (GNU $PACKAGE) $VERSION
2717 # Please DO NOT delete this file!
2718 # It is necessary for linking the library.
2720 # Name of the PIC object.
2721 pic_object=$write_lobj
2723 # Name of the non-PIC object
2724 non_pic_object=$write_oldobj
2727 $MV "${write_libobj}T" "$write_libobj"
2732 ##################################################
2733 # FILE NAME AND PATH CONVERSION HELPER FUNCTIONS #
2734 ##################################################
2736 # func_convert_core_file_wine_to_w32 ARG
2737 # Helper function used by file name conversion functions when $build is *nix,
2738 # and $host is mingw, cygwin, or some other w32 environment. Relies on a
2739 # correctly configured wine environment available, with the winepath program
2740 # in $build's $PATH.
2742 # ARG is the $build file name to be converted to w32 format.
2743 # Result is available in $func_convert_core_file_wine_to_w32_result, and will
2744 # be empty on error (or when ARG is empty)
2745 func_convert_core_file_wine_to_w32 ()
2749 func_convert_core_file_wine_to_w32_result=$1
2750 if test -n "$1"; then
2751 # Unfortunately, winepath does not exit with a non-zero error code, so we
2752 # are forced to check the contents of stdout. On the other hand, if the
2753 # command is not found, the shell will set an exit code of 127 and print
2754 # *an error message* to stdout. So we must check for both error code of
2755 # zero AND non-empty stdout, which explains the odd construction:
2756 func_convert_core_file_wine_to_w32_tmp=`winepath -w "$1" 2>/dev/null`
2757 if test "$?" -eq 0 && test -n "$func_convert_core_file_wine_to_w32_tmp"; then
2758 func_convert_core_file_wine_to_w32_result=`$ECHO "$func_convert_core_file_wine_to_w32_tmp" |
2759 $SED -e "$sed_naive_backslashify"`
2761 func_convert_core_file_wine_to_w32_result=
2765 # end: func_convert_core_file_wine_to_w32
2768 # func_convert_core_path_wine_to_w32 ARG
2769 # Helper function used by path conversion functions when $build is *nix, and
2770 # $host is mingw, cygwin, or some other w32 environment. Relies on a correctly
2771 # configured wine environment available, with the winepath program in $build's
2772 # $PATH. Assumes ARG has no leading or trailing path separator characters.
2774 # ARG is path to be converted from $build format to win32.
2775 # Result is available in $func_convert_core_path_wine_to_w32_result.
2776 # Unconvertible file (directory) names in ARG are skipped; if no directory names
2777 # are convertible, then the result may be empty.
2778 func_convert_core_path_wine_to_w32 ()
2782 # unfortunately, winepath doesn't convert paths, only file names
2783 func_convert_core_path_wine_to_w32_result=
2784 if test -n "$1"; then
2787 for func_convert_core_path_wine_to_w32_f in $1; do
2789 func_convert_core_file_wine_to_w32 "$func_convert_core_path_wine_to_w32_f"
2790 if test -n "$func_convert_core_file_wine_to_w32_result"; then
2791 if test -z "$func_convert_core_path_wine_to_w32_result"; then
2792 func_convert_core_path_wine_to_w32_result=$func_convert_core_file_wine_to_w32_result
2794 func_append func_convert_core_path_wine_to_w32_result ";$func_convert_core_file_wine_to_w32_result"
2801 # end: func_convert_core_path_wine_to_w32
2804 # func_cygpath ARGS...
2805 # Wrapper around calling the cygpath program via LT_CYGPATH. This is used when
2806 # when (1) $build is *nix and Cygwin is hosted via a wine environment; or (2)
2807 # $build is MSYS and $host is Cygwin, or (3) $build is Cygwin. In case (1) or
2808 # (2), returns the Cygwin file name or path in func_cygpath_result (input
2809 # file name or path is assumed to be in w32 format, as previously converted
2810 # from $build's *nix or MSYS format). In case (3), returns the w32 file name
2811 # or path in func_cygpath_result (input file name or path is assumed to be in
2812 # Cygwin format). Returns an empty string on error.
2814 # ARGS are passed to cygpath, with the last one being the file name or path to
2817 # Specify the absolute *nix (or w32) name to cygpath in the LT_CYGPATH
2818 # environment variable; do not put it in $PATH.
2823 if test -n "$LT_CYGPATH" && test -f "$LT_CYGPATH"; then
2824 func_cygpath_result=`$LT_CYGPATH "$@" 2>/dev/null`
2825 if test "$?" -ne 0; then
2826 # on failure, ensure result is empty
2827 func_cygpath_result=
2830 func_cygpath_result=
2831 func_error "LT_CYGPATH is empty or specifies non-existent file: '$LT_CYGPATH'"
2837 # func_convert_core_msys_to_w32 ARG
2838 # Convert file name or path ARG from MSYS format to w32 format. Return
2839 # result in func_convert_core_msys_to_w32_result.
2840 func_convert_core_msys_to_w32 ()
2844 # awkward: cmd appends spaces to result
2845 func_convert_core_msys_to_w32_result=`( cmd //c echo "$1" ) 2>/dev/null |
2846 $SED -e 's/[ ]*$//' -e "$sed_naive_backslashify"`
2848 #end: func_convert_core_msys_to_w32
2851 # func_convert_file_check ARG1 ARG2
2852 # Verify that ARG1 (a file name in $build format) was converted to $host
2853 # format in ARG2. Otherwise, emit an error message, but continue (resetting
2854 # func_to_host_file_result to ARG1).
2855 func_convert_file_check ()
2859 if test -z "$2" && test -n "$1"; then
2860 func_error "Could not determine host file name corresponding to"
2862 func_error "Continuing, but uninstalled executables may not work."
2864 func_to_host_file_result=$1
2867 # end func_convert_file_check
2870 # func_convert_path_check FROM_PATHSEP TO_PATHSEP FROM_PATH TO_PATH
2871 # Verify that FROM_PATH (a path in $build format) was converted to $host
2872 # format in TO_PATH. Otherwise, emit an error message, but continue, resetting
2873 # func_to_host_file_result to a simplistic fallback value (see below).
2874 func_convert_path_check ()
2878 if test -z "$4" && test -n "$3"; then
2879 func_error "Could not determine the host path corresponding to"
2881 func_error "Continuing, but uninstalled executables may not work."
2882 # Fallback. This is a deliberately simplistic "conversion" and
2883 # should not be "improved". See libtool.info.
2884 if test "x$1" != "x$2"; then
2885 lt_replace_pathsep_chars="s|$1|$2|g"
2886 func_to_host_path_result=`echo "$3" |
2887 $SED -e "$lt_replace_pathsep_chars"`
2889 func_to_host_path_result=$3
2893 # end func_convert_path_check
2896 # func_convert_path_front_back_pathsep FRONTPAT BACKPAT REPL ORIG
2897 # Modifies func_to_host_path_result by prepending REPL if ORIG matches FRONTPAT
2898 # and appending REPL if ORIG matches BACKPAT.
2899 func_convert_path_front_back_pathsep ()
2904 $1 ) func_to_host_path_result=$3$func_to_host_path_result
2908 $2 ) func_append func_to_host_path_result "$3"
2912 # end func_convert_path_front_back_pathsep
2915 ##################################################
2916 # $build to $host FILE NAME CONVERSION FUNCTIONS #
2917 ##################################################
2918 # invoked via '$to_host_file_cmd ARG'
2920 # In each case, ARG is the path to be converted from $build to $host format.
2921 # Result will be available in $func_to_host_file_result.
2924 # func_to_host_file ARG
2925 # Converts the file name ARG from $build format to $host format. Return result
2926 # in func_to_host_file_result.
2927 func_to_host_file ()
2931 $to_host_file_cmd "$1"
2933 # end func_to_host_file
2936 # func_to_tool_file ARG LAZY
2937 # converts the file name ARG from $build format to toolchain format. Return
2938 # result in func_to_tool_file_result. If the conversion in use is listed
2939 # in (the comma separated) LAZY, no conversion takes place.
2940 func_to_tool_file ()
2945 *,"$to_tool_file_cmd",*)
2946 func_to_tool_file_result=$1
2949 $to_tool_file_cmd "$1"
2950 func_to_tool_file_result=$func_to_host_file_result
2954 # end func_to_tool_file
2957 # func_convert_file_noop ARG
2958 # Copy ARG to func_to_host_file_result.
2959 func_convert_file_noop ()
2961 func_to_host_file_result=$1
2963 # end func_convert_file_noop
2966 # func_convert_file_msys_to_w32 ARG
2967 # Convert file name ARG from (mingw) MSYS to (mingw) w32 format; automatic
2968 # conversion to w32 is not available inside the cwrapper. Returns result in
2969 # func_to_host_file_result.
2970 func_convert_file_msys_to_w32 ()
2974 func_to_host_file_result=$1
2975 if test -n "$1"; then
2976 func_convert_core_msys_to_w32 "$1"
2977 func_to_host_file_result=$func_convert_core_msys_to_w32_result
2979 func_convert_file_check "$1" "$func_to_host_file_result"
2981 # end func_convert_file_msys_to_w32
2984 # func_convert_file_cygwin_to_w32 ARG
2985 # Convert file name ARG from Cygwin to w32 format. Returns result in
2986 # func_to_host_file_result.
2987 func_convert_file_cygwin_to_w32 ()
2991 func_to_host_file_result=$1
2992 if test -n "$1"; then
2993 # because $build is cygwin, we call "the" cygpath in $PATH; no need to use
2994 # LT_CYGPATH in this case.
2995 func_to_host_file_result=`cygpath -m "$1"`
2997 func_convert_file_check "$1" "$func_to_host_file_result"
2999 # end func_convert_file_cygwin_to_w32
3002 # func_convert_file_nix_to_w32 ARG
3003 # Convert file name ARG from *nix to w32 format. Requires a wine environment
3004 # and a working winepath. Returns result in func_to_host_file_result.
3005 func_convert_file_nix_to_w32 ()
3009 func_to_host_file_result=$1
3010 if test -n "$1"; then
3011 func_convert_core_file_wine_to_w32 "$1"
3012 func_to_host_file_result=$func_convert_core_file_wine_to_w32_result
3014 func_convert_file_check "$1" "$func_to_host_file_result"
3016 # end func_convert_file_nix_to_w32
3019 # func_convert_file_msys_to_cygwin ARG
3020 # Convert file name ARG from MSYS to Cygwin format. Requires LT_CYGPATH set.
3021 # Returns result in func_to_host_file_result.
3022 func_convert_file_msys_to_cygwin ()
3026 func_to_host_file_result=$1
3027 if test -n "$1"; then
3028 func_convert_core_msys_to_w32 "$1"
3029 func_cygpath -u "$func_convert_core_msys_to_w32_result"
3030 func_to_host_file_result=$func_cygpath_result
3032 func_convert_file_check "$1" "$func_to_host_file_result"
3034 # end func_convert_file_msys_to_cygwin
3037 # func_convert_file_nix_to_cygwin ARG
3038 # Convert file name ARG from *nix to Cygwin format. Requires Cygwin installed
3039 # in a wine environment, working winepath, and LT_CYGPATH set. Returns result
3040 # in func_to_host_file_result.
3041 func_convert_file_nix_to_cygwin ()
3045 func_to_host_file_result=$1
3046 if test -n "$1"; then
3047 # convert from *nix to w32, then use cygpath to convert from w32 to cygwin.
3048 func_convert_core_file_wine_to_w32 "$1"
3049 func_cygpath -u "$func_convert_core_file_wine_to_w32_result"
3050 func_to_host_file_result=$func_cygpath_result
3052 func_convert_file_check "$1" "$func_to_host_file_result"
3054 # end func_convert_file_nix_to_cygwin
3057 #############################################
3058 # $build to $host PATH CONVERSION FUNCTIONS #
3059 #############################################
3060 # invoked via '$to_host_path_cmd ARG'
3062 # In each case, ARG is the path to be converted from $build to $host format.
3063 # The result will be available in $func_to_host_path_result.
3065 # Path separators are also converted from $build format to $host format. If
3066 # ARG begins or ends with a path separator character, it is preserved (but
3067 # converted to $host format) on output.
3069 # All path conversion functions are named using the following convention:
3070 # file name conversion function : func_convert_file_X_to_Y ()
3071 # path conversion function : func_convert_path_X_to_Y ()
3072 # where, for any given $build/$host combination the 'X_to_Y' value is the
3073 # same. If conversion functions are added for new $build/$host combinations,
3074 # the two new functions must follow this pattern, or func_init_to_host_path_cmd
3078 # func_init_to_host_path_cmd
3079 # Ensures that function "pointer" variable $to_host_path_cmd is set to the
3080 # appropriate value, based on the value of $to_host_file_cmd.
3082 func_init_to_host_path_cmd ()
3086 if test -z "$to_host_path_cmd"; then
3087 func_stripname 'func_convert_file_' '' "$to_host_file_cmd"
3088 to_host_path_cmd=func_convert_path_$func_stripname_result
3093 # func_to_host_path ARG
3094 # Converts the path ARG from $build format to $host format. Return result
3095 # in func_to_host_path_result.
3096 func_to_host_path ()
3100 func_init_to_host_path_cmd
3101 $to_host_path_cmd "$1"
3103 # end func_to_host_path
3106 # func_convert_path_noop ARG
3107 # Copy ARG to func_to_host_path_result.
3108 func_convert_path_noop ()
3110 func_to_host_path_result=$1
3112 # end func_convert_path_noop
3115 # func_convert_path_msys_to_w32 ARG
3116 # Convert path ARG from (mingw) MSYS to (mingw) w32 format; automatic
3117 # conversion to w32 is not available inside the cwrapper. Returns result in
3118 # func_to_host_path_result.
3119 func_convert_path_msys_to_w32 ()
3123 func_to_host_path_result=$1
3124 if test -n "$1"; then
3125 # Remove leading and trailing path separator characters from ARG. MSYS
3126 # behavior is inconsistent here; cygpath turns them into '.;' and ';.';
3127 # and winepath ignores them completely.
3128 func_stripname : : "$1"
3129 func_to_host_path_tmp1=$func_stripname_result
3130 func_convert_core_msys_to_w32 "$func_to_host_path_tmp1"
3131 func_to_host_path_result=$func_convert_core_msys_to_w32_result
3132 func_convert_path_check : ";" \
3133 "$func_to_host_path_tmp1" "$func_to_host_path_result"
3134 func_convert_path_front_back_pathsep ":*" "*:" ";" "$1"
3137 # end func_convert_path_msys_to_w32
3140 # func_convert_path_cygwin_to_w32 ARG
3141 # Convert path ARG from Cygwin to w32 format. Returns result in
3142 # func_to_host_file_result.
3143 func_convert_path_cygwin_to_w32 ()
3147 func_to_host_path_result=$1
3148 if test -n "$1"; then
3149 # See func_convert_path_msys_to_w32:
3150 func_stripname : : "$1"
3151 func_to_host_path_tmp1=$func_stripname_result
3152 func_to_host_path_result=`cygpath -m -p "$func_to_host_path_tmp1"`
3153 func_convert_path_check : ";" \
3154 "$func_to_host_path_tmp1" "$func_to_host_path_result"
3155 func_convert_path_front_back_pathsep ":*" "*:" ";" "$1"
3158 # end func_convert_path_cygwin_to_w32
3161 # func_convert_path_nix_to_w32 ARG
3162 # Convert path ARG from *nix to w32 format. Requires a wine environment and
3163 # a working winepath. Returns result in func_to_host_file_result.
3164 func_convert_path_nix_to_w32 ()
3168 func_to_host_path_result=$1
3169 if test -n "$1"; then
3170 # See func_convert_path_msys_to_w32:
3171 func_stripname : : "$1"
3172 func_to_host_path_tmp1=$func_stripname_result
3173 func_convert_core_path_wine_to_w32 "$func_to_host_path_tmp1"
3174 func_to_host_path_result=$func_convert_core_path_wine_to_w32_result
3175 func_convert_path_check : ";" \
3176 "$func_to_host_path_tmp1" "$func_to_host_path_result"
3177 func_convert_path_front_back_pathsep ":*" "*:" ";" "$1"
3180 # end func_convert_path_nix_to_w32
3183 # func_convert_path_msys_to_cygwin ARG
3184 # Convert path ARG from MSYS to Cygwin format. Requires LT_CYGPATH set.
3185 # Returns result in func_to_host_file_result.
3186 func_convert_path_msys_to_cygwin ()
3190 func_to_host_path_result=$1
3191 if test -n "$1"; then
3192 # See func_convert_path_msys_to_w32:
3193 func_stripname : : "$1"
3194 func_to_host_path_tmp1=$func_stripname_result
3195 func_convert_core_msys_to_w32 "$func_to_host_path_tmp1"
3196 func_cygpath -u -p "$func_convert_core_msys_to_w32_result"
3197 func_to_host_path_result=$func_cygpath_result
3198 func_convert_path_check : : \
3199 "$func_to_host_path_tmp1" "$func_to_host_path_result"
3200 func_convert_path_front_back_pathsep ":*" "*:" : "$1"
3203 # end func_convert_path_msys_to_cygwin
3206 # func_convert_path_nix_to_cygwin ARG
3207 # Convert path ARG from *nix to Cygwin format. Requires Cygwin installed in a
3208 # a wine environment, working winepath, and LT_CYGPATH set. Returns result in
3209 # func_to_host_file_result.
3210 func_convert_path_nix_to_cygwin ()
3214 func_to_host_path_result=$1
3215 if test -n "$1"; then
3216 # Remove leading and trailing path separator characters from
3217 # ARG. msys behavior is inconsistent here, cygpath turns them
3218 # into '.;' and ';.', and winepath ignores them completely.
3219 func_stripname : : "$1"
3220 func_to_host_path_tmp1=$func_stripname_result
3221 func_convert_core_path_wine_to_w32 "$func_to_host_path_tmp1"
3222 func_cygpath -u -p "$func_convert_core_path_wine_to_w32_result"
3223 func_to_host_path_result=$func_cygpath_result
3224 func_convert_path_check : : \
3225 "$func_to_host_path_tmp1" "$func_to_host_path_result"
3226 func_convert_path_front_back_pathsep ":*" "*:" : "$1"
3229 # end func_convert_path_nix_to_cygwin
3232 # func_dll_def_p FILE
3233 # True iff FILE is a Windows DLL '.def' file.
3234 # Keep in sync with _LT_DLL_DEF_P in libtool.m4
3239 func_dll_def_p_tmp=`$SED -n \
3241 -e '/^\(;.*\)*$/d' \
3242 -e 's/^\(EXPORTS\|LIBRARY\)\([ ].*\)*$/DEF/p' \
3245 test DEF = "$func_dll_def_p_tmp"
3249 # func_mode_compile arg...
3250 func_mode_compile ()
3254 # Get the compilation command and the source file.
3256 srcfile=$nonopt # always keep a non-empty value in "srcfile"
3268 # do not "continue". Instead, add this to base_compile
3280 # Accept any command-line options.
3283 test -n "$libobj" && \
3284 func_fatal_error "you cannot specify '-o' more than once"
3289 -pie | -fpie | -fPIE)
3290 func_append pie_flag " $arg"
3294 -shared | -static | -prefer-pic | -prefer-non-pic)
3295 func_append later " $arg"
3305 arg_mode=arg # the next one goes into the "base_compile" arg list
3306 continue # The current "srcfile" will either be retained or
3307 ;; # replaced later. I would guess that would be a bug.
3310 func_stripname '-Wc,' '' "$arg"
3311 args=$func_stripname_result
3313 save_ifs=$IFS; IFS=,
3314 for arg in $args; do
3316 func_append_quoted lastarg "$arg"
3319 func_stripname ' ' '' "$lastarg"
3320 lastarg=$func_stripname_result
3322 # Add the arguments to base_compile.
3323 func_append base_compile " $lastarg"
3328 # Accept the current argument as the source file.
3329 # The previous "srcfile" becomes the current argument.
3336 esac # case $arg_mode
3338 # Aesthetically quote the previous argument.
3339 func_append_quoted base_compile "$lastarg"
3344 func_fatal_error "you must specify an argument for -Xcompile"
3347 func_fatal_error "you must specify a target with '-o'"
3350 # Get the name of the library object.
3351 test -z "$libobj" && {
3352 func_basename "$srcfile"
3353 libobj=$func_basename_result
3358 # Recognize several different file suffixes.
3359 # If the user specifies -o file.o, it is replaced with file.lo
3362 *.ada | *.adb | *.ads | *.asm | \
3363 *.c++ | *.cc | *.ii | *.class | *.cpp | *.cxx | \
3364 *.[fF][09]? | *.for | *.java | *.go | *.obj | *.sx | *.cu | *.cup)
3365 func_xform "$libobj"
3366 libobj=$func_xform_result
3371 *.lo) func_lo2o "$libobj"; obj=$func_lo2o_result ;;
3373 func_fatal_error "cannot determine name of library object from '$libobj'"
3377 func_infer_tag $base_compile
3379 for arg in $later; do
3382 test yes = "$build_libtool_libs" \
3383 || func_fatal_configuration "cannot build a shared library"
3389 build_libtool_libs=no
3406 func_quote_for_eval "$libobj"
3407 test "X$libobj" != "X$func_quote_for_eval_result" \
3408 && $ECHO "X$libobj" | $GREP '[]~#^*{};<>?"'"'"' &()|`$[]' \
3409 && func_warning "libobj name '$libobj' may not contain shell special characters."
3410 func_dirname_and_basename "$obj" "/" ""
3411 objname=$func_basename_result
3412 xdir=$func_dirname_result
3413 lobj=$xdir$objdir/$objname
3415 test -z "$base_compile" && \
3416 func_fatal_help "you must specify a compilation command"
3418 # Delete any leftover library objects.
3419 if test yes = "$build_old_libs"; then
3420 removelist="$obj $lobj $libobj ${libobj}T"
3422 removelist="$lobj $libobj ${libobj}T"
3425 # On Cygwin there's no "real" PIC flag so we must build both object types
3427 cygwin* | mingw* | pw32* | os2* | cegcc*)
3431 if test no = "$pic_mode" && test pass_all != "$deplibs_check_method"; then
3432 # non-PIC code in shared libraries is not supported
3436 # Calculate the filename of the output object if compiler does
3437 # not support -o with -c
3438 if test no = "$compiler_c_o"; then
3439 output_obj=`$ECHO "$srcfile" | $SED 's%^.*/%%; s%\.[^.]*$%%'`.$objext
3440 lockfile=$output_obj.lock
3447 # Lock this critical section if it is needed
3448 # We use this script file to make the link, it avoids creating a new file
3449 if test yes = "$need_locks"; then
3450 until $opt_dry_run || ln "$progpath" "$lockfile" 2>/dev/null; do
3451 func_echo "Waiting for $lockfile to be removed"
3454 elif test warn = "$need_locks"; then
3455 if test -f "$lockfile"; then
3457 *** ERROR, $lockfile exists and contains:
3458 `cat $lockfile 2>/dev/null`
3460 This indicates that another process is trying to use the same
3461 temporary object file, and libtool could not work around it because
3462 your compiler does not support '-c' and '-o' together. If you
3463 repeat this compilation, it may succeed, by chance, but you had better
3464 avoid parallel builds (make -j) in this platform, or get a better
3467 $opt_dry_run || $RM $removelist
3470 func_append removelist " $output_obj"
3471 $ECHO "$srcfile" > "$lockfile"
3474 $opt_dry_run || $RM $removelist
3475 func_append removelist " $lockfile"
3476 trap '$opt_dry_run || $RM $removelist; exit $EXIT_FAILURE' 1 2 15
3478 func_to_tool_file "$srcfile" func_convert_file_msys_to_w32
3479 srcfile=$func_to_tool_file_result
3480 func_quote_for_eval "$srcfile"
3481 qsrcfile=$func_quote_for_eval_result
3483 # Only build a PIC object if we are building libtool libraries.
3484 if test yes = "$build_libtool_libs"; then
3485 # Without this assignment, base_compile gets emptied.
3486 fbsd_hideous_sh_bug=$base_compile
3488 if test no != "$pic_mode"; then
3489 command="$base_compile $qsrcfile $pic_flag"
3491 # Don't build PIC code
3492 command="$base_compile $qsrcfile"
3495 func_mkdir_p "$xdir$objdir"
3497 if test -z "$output_obj"; then
3498 # Place PIC objects in $objdir
3499 func_append command " -o $lobj"
3502 func_show_eval_locale "$command" \
3503 'test -n "$output_obj" && $RM $removelist; exit $EXIT_FAILURE'
3505 if test warn = "$need_locks" &&
3506 test "X`cat $lockfile 2>/dev/null`" != "X$srcfile"; then
3508 *** ERROR, $lockfile contains:
3509 `cat $lockfile 2>/dev/null`
3511 but it should contain:
3514 This indicates that another process is trying to use the same
3515 temporary object file, and libtool could not work around it because
3516 your compiler does not support '-c' and '-o' together. If you
3517 repeat this compilation, it may succeed, by chance, but you had better
3518 avoid parallel builds (make -j) in this platform, or get a better
3521 $opt_dry_run || $RM $removelist
3525 # Just move the object if needed, then go on to compile the next one
3526 if test -n "$output_obj" && test "X$output_obj" != "X$lobj"; then
3527 func_show_eval '$MV "$output_obj" "$lobj"' \
3528 'error=$?; $opt_dry_run || $RM $removelist; exit $error'
3531 # Allow error messages only from the first compilation.
3532 if test yes = "$suppress_opt"; then
3533 suppress_output=' >/dev/null 2>&1'
3537 # Only build a position-dependent object if we build old libraries.
3538 if test yes = "$build_old_libs"; then
3539 if test yes != "$pic_mode"; then
3540 # Don't build PIC code
3541 command="$base_compile $qsrcfile$pie_flag"
3543 command="$base_compile $qsrcfile $pic_flag"
3545 if test yes = "$compiler_c_o"; then
3546 func_append command " -o $obj"
3549 # Suppress compiler output if we already did a PIC compilation.
3550 func_append command "$suppress_output"
3551 func_show_eval_locale "$command" \
3552 '$opt_dry_run || $RM $removelist; exit $EXIT_FAILURE'
3554 if test warn = "$need_locks" &&
3555 test "X`cat $lockfile 2>/dev/null`" != "X$srcfile"; then
3557 *** ERROR, $lockfile contains:
3558 `cat $lockfile 2>/dev/null`
3560 but it should contain:
3563 This indicates that another process is trying to use the same
3564 temporary object file, and libtool could not work around it because
3565 your compiler does not support '-c' and '-o' together. If you
3566 repeat this compilation, it may succeed, by chance, but you had better
3567 avoid parallel builds (make -j) in this platform, or get a better
3570 $opt_dry_run || $RM $removelist
3574 # Just move the object if needed
3575 if test -n "$output_obj" && test "X$output_obj" != "X$obj"; then
3576 func_show_eval '$MV "$output_obj" "$obj"' \
3577 'error=$?; $opt_dry_run || $RM $removelist; exit $error'
3582 func_write_libtool_object "$libobj" "$objdir/$objname" "$objname"
3584 # Unlock the critical section if it was locked
3585 if test no != "$need_locks"; then
3586 removelist=$lockfile
3595 test compile = "$opt_mode" && func_mode_compile ${1+"$@"}
3600 # We need to display help for each of the modes.
3603 # Generic help is extracted from the usage comments
3604 # at the start of this file.
3610 "Usage: $progname [OPTION]... --mode=clean RM [RM-OPTION]... FILE...
3612 Remove files from the build directory.
3614 RM is the name of the program to use to delete files associated with each FILE
3615 (typically '/bin/rm'). RM-OPTIONS are options (such as '-f') to be passed
3618 If FILE is a libtool library, object or program, all the files associated
3619 with it are deleted. Otherwise, only FILE itself is deleted using RM."
3624 "Usage: $progname [OPTION]... --mode=compile COMPILE-COMMAND... SOURCEFILE
3626 Compile a source file into a libtool library object.
3628 This mode accepts the following additional options:
3630 -o OUTPUT-FILE set the output file name to OUTPUT-FILE
3631 -no-suppress do not suppress compiler output for multiple passes
3632 -prefer-pic try to build PIC objects only
3633 -prefer-non-pic try to build non-PIC objects only
3634 -shared do not build a '.o' file suitable for static linking
3635 -static only build a '.o' file suitable for static linking
3636 -Wc,FLAG pass FLAG directly to the compiler
3638 COMPILE-COMMAND is a command to be used in creating a 'standard' object file
3639 from the given SOURCEFILE.
3641 The output file name is determined by removing the directory component from
3642 SOURCEFILE, then substituting the C source code suffix '.c' with the
3643 library object suffix, '.lo'."
3648 "Usage: $progname [OPTION]... --mode=execute COMMAND [ARGS]...
3650 Automatically set library path, then run a program.
3652 This mode accepts the following additional options:
3654 -dlopen FILE add the directory containing FILE to the library path
3656 This mode sets the library path environment variable according to '-dlopen'
3659 If any of the ARGS are libtool executable wrappers, then they are translated
3660 into their corresponding uninstalled binary, and any of their required library
3661 directories are added to the library path.
3663 Then, COMMAND is executed, with ARGS as arguments."
3668 "Usage: $progname [OPTION]... --mode=finish [LIBDIR]...
3670 Complete the installation of libtool libraries.
3672 Each LIBDIR is a directory that contains libtool libraries.
3674 The commands that this mode executes may require superuser privileges. Use
3675 the '--dry-run' option if you just want to see what would be executed."
3680 "Usage: $progname [OPTION]... --mode=install INSTALL-COMMAND...
3682 Install executables or libraries.
3684 INSTALL-COMMAND is the installation command. The first component should be
3685 either the 'install' or 'cp' program.
3687 The following components of INSTALL-COMMAND are treated specially:
3689 -inst-prefix-dir PREFIX-DIR Use PREFIX-DIR as a staging area for installation
3691 The rest of the components are interpreted as arguments to that command (only
3692 BSD-compatible install options are recognized)."
3697 "Usage: $progname [OPTION]... --mode=link LINK-COMMAND...
3699 Link object files or libraries together to form another library, or to
3700 create an executable program.
3702 LINK-COMMAND is a command using the C compiler that you would use to create
3703 a program from several object files.
3705 The following components of LINK-COMMAND are treated specially:
3707 -all-static do not do any dynamic linking at all
3708 -avoid-version do not add a version suffix if possible
3709 -bindir BINDIR specify path to binaries directory (for systems where
3710 libraries must be found in the PATH setting at runtime)
3711 -dlopen FILE '-dlpreopen' FILE if it cannot be dlopened at runtime
3712 -dlpreopen FILE link in FILE and add its symbols to lt_preloaded_symbols
3713 -export-dynamic allow symbols from OUTPUT-FILE to be resolved with dlsym(3)
3714 -export-symbols SYMFILE
3715 try to export only the symbols listed in SYMFILE
3716 -export-symbols-regex REGEX
3717 try to export only the symbols matching REGEX
3718 -LLIBDIR search LIBDIR for required installed libraries
3719 -lNAME OUTPUT-FILE requires the installed library libNAME
3720 -module build a library that can dlopened
3721 -no-fast-install disable the fast-install mode
3722 -no-install link a not-installable executable
3723 -no-undefined declare that a library does not refer to external symbols
3724 -o OUTPUT-FILE create OUTPUT-FILE from the specified objects
3725 -objectlist FILE Use a list of object files found in FILE to specify objects
3726 -precious-files-regex REGEX
3727 don't remove output files matching REGEX
3728 -release RELEASE specify package release information
3729 -rpath LIBDIR the created library will eventually be installed in LIBDIR
3730 -R[ ]LIBDIR add LIBDIR to the runtime path of programs and libraries
3731 -shared only do dynamic linking of libtool libraries
3732 -shrext SUFFIX override the standard shared library file extension
3733 -static do not do any dynamic linking of uninstalled libtool libraries
3734 -static-libtool-libs
3735 do not do any dynamic linking of libtool libraries
3736 -version-info CURRENT[:REVISION[:AGE]]
3737 specify library version info [each variable defaults to 0]
3738 -weak LIBNAME declare that the target provides the LIBNAME interface
3740 -Xcompiler FLAG pass linker-specific FLAG directly to the compiler
3742 -Xlinker FLAG pass linker-specific FLAG directly to the linker
3743 -XCClinker FLAG pass link-specific FLAG to the compiler driver (CC)
3745 All other options (arguments beginning with '-') are ignored.
3747 Every other argument is treated as a filename. Files ending in '.la' are
3748 treated as uninstalled libtool libraries, other files are standard or library
3751 If the OUTPUT-FILE ends in '.la', then a libtool library is created,
3752 only library objects ('.lo' files) may be specified, and '-rpath' is
3753 required, except when creating a convenience library.
3755 If OUTPUT-FILE ends in '.a' or '.lib', then a standard library is created
3756 using 'ar' and 'ranlib', or on Windows using 'lib'.
3758 If OUTPUT-FILE ends in '.lo' or '.$objext', then a reloadable object file
3759 is created, otherwise an executable program is created."
3764 "Usage: $progname [OPTION]... --mode=uninstall RM [RM-OPTION]... FILE...
3766 Remove libraries from an installation directory.
3768 RM is the name of the program to use to delete files associated with each FILE
3769 (typically '/bin/rm'). RM-OPTIONS are options (such as '-f') to be passed
3772 If FILE is a libtool library, all the files associated with it are deleted.
3773 Otherwise, only FILE itself is deleted using RM."
3777 func_fatal_help "invalid operation mode '$opt_mode'"
3782 $ECHO "Try '$progname --help' for more information about other modes."
3785 # Now that we've collected a possible --mode arg, show help if necessary
3787 if test : = "$opt_help"; then
3792 for opt_mode in compile link execute install finish uninstall clean; do
3795 } | $SED -n '1p; 2,$s/^Usage:/ or: /p'
3798 for opt_mode in compile link execute install finish uninstall clean; do
3804 /^When reporting/,/^Report/{
3809 /information about other modes/d
3810 /more detailed .*MODE/d
3811 s/^Usage:.*--mode=\([^ ]*\) .*/Description of \1 mode:/'
3817 # func_mode_execute arg...
3818 func_mode_execute ()
3822 # The first argument is the command name.
3825 func_fatal_help "you must specify a COMMAND"
3827 # Handle -dlopen flags immediately.
3828 for file in $opt_dlopen; do
3830 || func_fatal_help "'$file' is not a file"
3835 func_resolve_sysroot "$file"
3836 file=$func_resolve_sysroot_result
3838 # Check to see that this really is a libtool archive.
3839 func_lalib_unsafe_p "$file" \
3840 || func_fatal_help "'$lib' is not a valid libtool archive"
3842 # Read the libtool library.
3847 # Skip this library if it cannot be dlopened.
3848 if test -z "$dlname"; then
3849 # Warn if it was a shared library.
3850 test -n "$library_names" && \
3851 func_warning "'$file' was not linked with '-export-dynamic'"
3855 func_dirname "$file" "" "."
3856 dir=$func_dirname_result
3858 if test -f "$dir/$objdir/$dlname"; then
3859 func_append dir "/$objdir"
3861 if test ! -f "$dir/$dlname"; then
3862 func_fatal_error "cannot find '$dlname' in '$dir' or '$dir/$objdir'"
3868 # Just add the directory containing the .lo file.
3869 func_dirname "$file" "" "."
3870 dir=$func_dirname_result
3874 func_warning "'-dlopen' is ignored for non-libtool libraries and objects"
3879 # Get the absolute pathname.
3880 absdir=`cd "$dir" && pwd`
3881 test -n "$absdir" && dir=$absdir
3883 # Now add the directory to shlibpath_var.
3884 if eval "test -z \"\$$shlibpath_var\""; then
3885 eval "$shlibpath_var=\"\$dir\""
3887 eval "$shlibpath_var=\"\$dir:\$$shlibpath_var\""
3891 # This variable tells wrapper scripts just to set shlibpath_var
3892 # rather than running their programs.
3893 libtool_execute_magic=$magic
3895 # Check if any of the arguments is a wrapper script.
3900 -* | *.la | *.lo ) ;;
3902 # Do a test to see if this is really a libtool program.
3903 if func_ltwrapper_script_p "$file"; then
3905 # Transform arg to wrapped name.
3906 file=$progdir/$program
3907 elif func_ltwrapper_executable_p "$file"; then
3908 func_ltwrapper_scriptname "$file"
3909 func_source "$func_ltwrapper_scriptname_result"
3910 # Transform arg to wrapped name.
3911 file=$progdir/$program
3915 # Quote arguments (to preserve shell metacharacters).
3916 func_append_quoted args "$file"
3919 if $opt_dry_run; then
3920 # Display what would be done.
3921 if test -n "$shlibpath_var"; then
3922 eval "\$ECHO \"\$shlibpath_var=\$$shlibpath_var\""
3923 echo "export $shlibpath_var"
3928 if test -n "$shlibpath_var"; then
3929 # Export the shlibpath_var.
3930 eval "export $shlibpath_var"
3933 # Restore saved environment variables
3934 for lt_var in LANG LANGUAGE LC_ALL LC_CTYPE LC_COLLATE LC_MESSAGES
3936 eval "if test \"\${save_$lt_var+set}\" = set; then
3937 $lt_var=\$save_$lt_var; export $lt_var
3943 # Now prepare to actually exec the command.
3948 test execute = "$opt_mode" && func_mode_execute ${1+"$@"}
3951 # func_mode_finish arg...
3960 for opt in "$nonopt" ${1+"$@"}
3962 if test -d "$opt"; then
3963 func_append libdirs " $opt"
3965 elif test -f "$opt"; then
3966 if func_lalib_unsafe_p "$opt"; then
3967 func_append libs " $opt"
3969 func_warning "'$opt' is not a valid libtool archive"
3973 func_fatal_error "invalid argument '$opt'"
3977 if test -n "$libs"; then
3978 if test -n "$lt_sysroot"; then
3979 sysroot_regex=`$ECHO "$lt_sysroot" | $SED "$sed_make_literal_regex"`
3980 sysroot_cmd="s/\([ ']\)$sysroot_regex/\1/g;"
3985 # Remove sysroot references
3986 if $opt_dry_run; then
3987 for lib in $libs; do
3988 echo "removing references to $lt_sysroot and '=' prefixes from $lib"
3991 tmpdir=`func_mktempdir`
3992 for lib in $libs; do
3993 $SED -e "$sysroot_cmd s/\([ ']-[LR]\)=/\1/g; s/\([ ']\)=/\1/g" $lib \
3995 mv -f $tmpdir/tmp-la $lib
4001 if test -n "$finish_cmds$finish_eval" && test -n "$libdirs"; then
4002 for libdir in $libdirs; do
4003 if test -n "$finish_cmds"; then
4004 # Do each command in the finish commands.
4005 func_execute_cmds "$finish_cmds" 'admincmds="$admincmds
4008 if test -n "$finish_eval"; then
4009 # Do the single finish_eval.
4010 eval cmds=\"$finish_eval\"
4011 $opt_dry_run || eval "$cmds" || func_append admincmds "
4017 # Exit here if they wanted silent mode.
4018 $opt_quiet && exit $EXIT_SUCCESS
4020 if test -n "$finish_cmds$finish_eval" && test -n "$libdirs"; then
4021 echo "----------------------------------------------------------------------"
4022 echo "Libraries have been installed in:"
4023 for libdir in $libdirs; do
4027 echo "If you ever happen to want to link against installed libraries"
4028 echo "in a given directory, LIBDIR, you must either use libtool, and"
4029 echo "specify the full pathname of the library, or use the '-LLIBDIR'"
4030 echo "flag during linking and do at least one of the following:"
4031 if test -n "$shlibpath_var"; then
4032 echo " - add LIBDIR to the '$shlibpath_var' environment variable"
4033 echo " during execution"
4035 if test -n "$runpath_var"; then
4036 echo " - add LIBDIR to the '$runpath_var' environment variable"
4037 echo " during linking"
4039 if test -n "$hardcode_libdir_flag_spec"; then
4041 eval flag=\"$hardcode_libdir_flag_spec\"
4043 $ECHO " - use the '$flag' linker flag"
4045 if test -n "$admincmds"; then
4046 $ECHO " - have your system administrator run these commands:$admincmds"
4048 if test -f /etc/ld.so.conf; then
4049 echo " - have your system administrator add LIBDIR to '/etc/ld.so.conf'"
4053 echo "See any operating system documentation about shared libraries for"
4055 solaris2.[6789]|solaris2.1[0-9])
4056 echo "more information, such as the ld(1), crle(1) and ld.so(8) manual"
4060 echo "more information, such as the ld(1) and ld.so(8) manual pages."
4063 echo "----------------------------------------------------------------------"
4068 test finish = "$opt_mode" && func_mode_finish ${1+"$@"}
4071 # func_mode_install arg...
4072 func_mode_install ()
4076 # There may be an optional sh(1) argument at the beginning of
4077 # install_prog (especially on Windows NT).
4078 if test "$SHELL" = "$nonopt" || test /bin/sh = "$nonopt" ||
4079 # Allow the use of GNU shtool's install command.
4080 case $nonopt in *shtool*) :;; *) false;; esac
4082 # Aesthetically quote it.
4083 func_quote_for_eval "$nonopt"
4084 install_prog="$func_quote_for_eval_result "
4092 # The real first argument should be the name of the installation program.
4093 # Aesthetically quote it.
4094 func_quote_for_eval "$arg"
4095 func_append install_prog "$func_quote_for_eval_result"
4096 install_shared_prog=$install_prog
4097 case " $install_prog " in
4098 *[\\\ /]cp\ *) install_cp=: ;;
4099 *) install_cp=false ;;
4102 # We need to accept at least all the BSD install flags.
4114 if test -n "$dest"; then
4115 func_append files " $dest"
4123 if $install_cp; then :; else
4137 # If the previous option needed an argument, then skip it.
4138 if test -n "$prev"; then
4139 if test X-m = "X$prev" && test -n "$install_override_mode"; then
4140 arg2=$install_override_mode
4151 # Aesthetically quote the argument.
4152 func_quote_for_eval "$arg"
4153 func_append install_prog " $func_quote_for_eval_result"
4154 if test -n "$arg2"; then
4155 func_quote_for_eval "$arg2"
4157 func_append install_shared_prog " $func_quote_for_eval_result"
4160 test -z "$install_prog" && \
4161 func_fatal_help "you must specify an install program"
4163 test -n "$prev" && \
4164 func_fatal_help "the '$prev' option requires an argument"
4166 if test -n "$install_override_mode" && $no_mode; then
4167 if $install_cp; then :; else
4168 func_quote_for_eval "$install_override_mode"
4169 func_append install_shared_prog " -m $func_quote_for_eval_result"
4173 if test -z "$files"; then
4174 if test -z "$dest"; then
4175 func_fatal_help "no file or destination specified"
4177 func_fatal_help "you must specify a destination"
4181 # Strip any trailing slash from the destination.
4182 func_stripname '' '/' "$dest"
4183 dest=$func_stripname_result
4185 # Check to see that the destination is a directory.
4186 test -d "$dest" && isdir=:
4191 func_dirname_and_basename "$dest" "" "."
4192 destdir=$func_dirname_result
4193 destname=$func_basename_result
4195 # Not a directory, so check to see that there is only one file specified.
4196 set dummy $files; shift
4197 test "$#" -gt 1 && \
4198 func_fatal_help "'$dest' is not a directory"
4201 [\\/]* | [A-Za-z]:[\\/]*) ;;
4203 for file in $files; do
4207 func_fatal_help "'$destdir' must be an absolute directory name"
4214 # This variable tells wrapper scripts just to set variables rather
4215 # than running their programs.
4216 libtool_install_magic=$magic
4221 for file in $files; do
4223 # Do each installation.
4226 # Do the static libraries later.
4227 func_append staticlibs " $file"
4231 func_resolve_sysroot "$file"
4232 file=$func_resolve_sysroot_result
4234 # Check to see that this really is a libtool archive.
4235 func_lalib_unsafe_p "$file" \
4236 || func_fatal_help "'$file' is not a valid libtool archive"
4243 # Add the libdir to current_libdirs if it is the destination.
4244 if test "X$destdir" = "X$libdir"; then
4245 case "$current_libdirs " in
4247 *) func_append current_libdirs " $libdir" ;;
4250 # Note the libdir as a future libdir.
4251 case "$future_libdirs " in
4253 *) func_append future_libdirs " $libdir" ;;
4257 func_dirname "$file" "/" ""
4258 dir=$func_dirname_result
4259 func_append dir "$objdir"
4261 if test -n "$relink_command"; then
4262 # Determine the prefix the user has applied to our future dir.
4263 inst_prefix_dir=`$ECHO "$destdir" | $SED -e "s%$libdir\$%%"`
4265 # Don't allow the user to place us outside of our expected
4266 # location b/c this prevents finding dependent libraries that
4267 # are installed to the same prefix.
4268 # At present, this check doesn't affect windows .dll's that
4269 # are installed into $libdir/../bin (currently, that works fine)
4270 # but it's something to keep an eye on.
4271 test "$inst_prefix_dir" = "$destdir" && \
4272 func_fatal_error "error: cannot install '$file' to a directory not ending in $libdir"
4274 if test -n "$inst_prefix_dir"; then
4275 # Stick the inst_prefix_dir data into the link command.
4276 relink_command=`$ECHO "$relink_command" | $SED "s%@inst_prefix_dir@%-inst-prefix-dir $inst_prefix_dir%"`
4278 relink_command=`$ECHO "$relink_command" | $SED "s%@inst_prefix_dir@%%"`
4281 func_warning "relinking '$file'"
4282 func_show_eval "$relink_command" \
4283 'func_fatal_error "error: relink '\''$file'\'' with the above command before installing it"'
4286 # See the names of the shared library.
4287 set dummy $library_names; shift
4288 if test -n "$1"; then
4293 test -n "$relink_command" && srcname=${realname}T
4295 # Install the shared library and build the symlinks.
4296 func_show_eval "$install_shared_prog $dir/$srcname $destdir/$realname" \
4300 cygwin* | mingw* | pw32* | cegcc*)
4308 if test -n "$tstripme" && test -n "$striplib"; then
4309 func_show_eval "$striplib $destdir/$realname" 'exit $?'
4312 if test "$#" -gt 0; then
4313 # Delete the old symlinks, and create new ones.
4314 # Try 'ln -sf' first, because the 'ln' binary might depend on
4315 # the symlink we replace! Solaris /bin/ln does not understand -f,
4316 # so we also need to try rm && ln -s.
4319 test "$linkname" != "$realname" \
4320 && func_show_eval "(cd $destdir && { $LN_S -f $realname $linkname || { $RM $linkname && $LN_S $realname $linkname; }; })"
4324 # Do each command in the postinstall commands.
4325 lib=$destdir/$realname
4326 func_execute_cmds "$postinstall_cmds" 'exit $?'
4329 # Install the pseudo-library for information purposes.
4330 func_basename "$file"
4331 name=$func_basename_result
4332 instname=$dir/${name}i
4333 func_show_eval "$install_prog $instname $destdir/$name" 'exit $?'
4335 # Maybe install the static library, too.
4336 test -n "$old_library" && func_append staticlibs " $dir/$old_library"
4340 # Install (i.e. copy) a libtool object.
4342 # Figure out destination file name, if it wasn't already specified.
4343 if test -n "$destname"; then
4344 destfile=$destdir/$destname
4346 func_basename "$file"
4347 destfile=$func_basename_result
4348 destfile=$destdir/$destfile
4351 # Deduce the name of the destination old-style object file.
4354 func_lo2o "$destfile"
4355 staticdest=$func_lo2o_result
4358 staticdest=$destfile
4362 func_fatal_help "cannot copy a libtool object to '$destfile'"
4366 # Install the libtool object if requested.
4367 test -n "$destfile" && \
4368 func_show_eval "$install_prog $file $destfile" 'exit $?'
4370 # Install the old object if enabled.
4371 if test yes = "$build_old_libs"; then
4372 # Deduce the name of the old-style object file.
4374 staticobj=$func_lo2o_result
4375 func_show_eval "$install_prog \$staticobj \$staticdest" 'exit $?'
4381 # Figure out destination file name, if it wasn't already specified.
4382 if test -n "$destname"; then
4383 destfile=$destdir/$destname
4385 func_basename "$file"
4386 destfile=$func_basename_result
4387 destfile=$destdir/$destfile
4390 # If the file is missing, and there is a .exe on the end, strip it
4391 # because it is most likely a libtool script we actually want to
4396 if test ! -f "$file"; then
4397 func_stripname '' '.exe' "$file"
4398 file=$func_stripname_result
4404 # Do a test to see if this is really a libtool program.
4407 if func_ltwrapper_executable_p "$file"; then
4408 func_ltwrapper_scriptname "$file"
4409 wrapper=$func_ltwrapper_scriptname_result
4411 func_stripname '' '.exe' "$file"
4412 wrapper=$func_stripname_result
4419 if func_ltwrapper_script_p "$wrapper"; then
4423 func_source "$wrapper"
4425 # Check the variables that should have been set.
4426 test -z "$generated_by_libtool_version" && \
4427 func_fatal_error "invalid libtool wrapper script '$wrapper'"
4430 for lib in $notinst_deplibs; do
4431 # Check to see that each library is installed.
4433 if test -f "$lib"; then
4436 libfile=$libdir/`$ECHO "$lib" | $SED 's%^.*/%%g'`
4437 if test -n "$libdir" && test ! -f "$libfile"; then
4438 func_warning "'$lib' has not been installed in '$libdir'"
4444 func_source "$wrapper"
4447 if test no = "$fast_install" && test -n "$relink_command"; then
4450 tmpdir=`func_mktempdir`
4451 func_basename "$file$stripped_ext"
4452 file=$func_basename_result
4453 outputname=$tmpdir/$file
4454 # Replace the output file specification.
4455 relink_command=`$ECHO "$relink_command" | $SED 's%@OUTPUT@%'"$outputname"'%g'`
4458 func_quote_for_expand "$relink_command"
4459 eval "func_echo $func_quote_for_expand_result"
4461 if eval "$relink_command"; then :
4463 func_error "error: relink '$file' with the above command before installing it"
4464 $opt_dry_run || ${RM}r "$tmpdir"
4469 func_warning "cannot relink '$file'"
4473 # Install the binary that we compiled earlier.
4474 file=`$ECHO "$file$stripped_ext" | $SED "s%\([^/]*\)$%$objdir/\1%"`
4478 # remove .exe since cygwin /usr/bin/install will append another
4480 case $install_prog,$host in
4481 */usr/bin/install*,*cygwin*)
4482 case $file:$destfile in
4487 destfile=$destfile.exe
4490 func_stripname '' '.exe' "$destfile"
4491 destfile=$func_stripname_result
4496 func_show_eval "$install_prog\$stripme \$file \$destfile" 'exit $?'
4497 $opt_dry_run || if test -n "$outputname"; then
4504 for file in $staticlibs; do
4505 func_basename "$file"
4506 name=$func_basename_result
4508 # Set up the ranlib parameters.
4509 oldlib=$destdir/$name
4510 func_to_tool_file "$oldlib" func_convert_file_msys_to_w32
4511 tool_oldlib=$func_to_tool_file_result
4513 func_show_eval "$install_prog \$file \$oldlib" 'exit $?'
4515 if test -n "$stripme" && test -n "$old_striplib"; then
4516 func_show_eval "$old_striplib $tool_oldlib" 'exit $?'
4519 # Do each command in the postinstall commands.
4520 func_execute_cmds "$old_postinstall_cmds" 'exit $?'
4523 test -n "$future_libdirs" && \
4524 func_warning "remember to run '$progname --finish$future_libdirs'"
4526 if test -n "$current_libdirs"; then
4527 # Maybe just do a dry run.
4528 $opt_dry_run && current_libdirs=" -n$current_libdirs"
4529 exec_cmd='$SHELL "$progpath" $preserve_args --finish$current_libdirs'
4535 test install = "$opt_mode" && func_mode_install ${1+"$@"}
4538 # func_generate_dlsyms outputname originator pic_p
4539 # Extract symbols from dlprefiles and create ${outputname}S.o with
4540 # a dlpreopen symbol table.
4541 func_generate_dlsyms ()
4548 my_prefix=`$ECHO "$my_originator" | $SED 's%[^a-zA-Z0-9]%_%g'`
4551 if test -n "$dlfiles$dlprefiles" || test no != "$dlself"; then
4552 if test -n "$NM" && test -n "$global_symbol_pipe"; then
4553 my_dlsyms=${my_outputname}S.c
4555 func_error "not configured to extract global symbols from dlpreopened files"
4559 if test -n "$my_dlsyms"; then
4563 # Discover the nlist of each of the dlfiles.
4564 nlist=$output_objdir/$my_outputname.nm
4566 func_show_eval "$RM $nlist ${nlist}S ${nlist}T"
4568 # Parse the name list into a source file.
4569 func_verbose "creating $output_objdir/$my_dlsyms"
4571 $opt_dry_run || $ECHO > "$output_objdir/$my_dlsyms" "\
4572 /* $my_dlsyms - symbol resolution table for '$my_outputname' dlsym emulation. */
4573 /* Generated by $PROGRAM (GNU $PACKAGE) $VERSION */
4579 #if defined __GNUC__ && (((__GNUC__ == 4) && (__GNUC_MINOR__ >= 4)) || (__GNUC__ > 4))
4580 #pragma GCC diagnostic ignored \"-Wstrict-prototypes\"
4583 /* Keep this code in sync between libtool.m4, ltmain, lt_system.h, and tests. */
4584 #if defined _WIN32 || defined __CYGWIN__ || defined _WIN32_WCE
4585 /* DATA imports from DLLs on WIN32 can't be const, because runtime
4586 relocations are performed -- see ld's documentation on pseudo-relocs. */
4587 # define LT_DLSYM_CONST
4588 #elif defined __osf__
4589 /* This system does not cope well with relocations in const data. */
4590 # define LT_DLSYM_CONST
4592 # define LT_DLSYM_CONST const
4595 #define STREQ(s1, s2) (strcmp ((s1), (s2)) == 0)
4597 /* External symbol declarations for the compiler. */\
4600 if test yes = "$dlself"; then
4601 func_verbose "generating symbol list for '$output'"
4603 $opt_dry_run || echo ': @PROGRAM@ ' > "$nlist"
4605 # Add our own program objects to the symbol list.
4606 progfiles=`$ECHO "$objs$old_deplibs" | $SP2NL | $SED "$lo2o" | $NL2SP`
4607 for progfile in $progfiles; do
4608 func_to_tool_file "$progfile" func_convert_file_msys_to_w32
4609 func_verbose "extracting global C symbols from '$func_to_tool_file_result'"
4610 $opt_dry_run || eval "$NM $func_to_tool_file_result | $global_symbol_pipe >> '$nlist'"
4613 if test -n "$exclude_expsyms"; then
4615 eval '$EGREP -v " ($exclude_expsyms)$" "$nlist" > "$nlist"T'
4616 eval '$MV "$nlist"T "$nlist"'
4620 if test -n "$export_symbols_regex"; then
4622 eval '$EGREP -e "$export_symbols_regex" "$nlist" > "$nlist"T'
4623 eval '$MV "$nlist"T "$nlist"'
4627 # Prepare the list of exported symbols
4628 if test -z "$export_symbols"; then
4629 export_symbols=$output_objdir/$outputname.exp
4632 eval "$SED -n -e '/^: @PROGRAM@ $/d' -e 's/^.* \(.*\)$/\1/p' "'< "$nlist" > "$export_symbols"'
4634 *cygwin* | *mingw* | *cegcc* )
4635 eval "echo EXPORTS "'> "$output_objdir/$outputname.def"'
4636 eval 'cat "$export_symbols" >> "$output_objdir/$outputname.def"'
4642 eval "$SED -e 's/\([].[*^$]\)/\\\\\1/g' -e 's/^/ /' -e 's/$/$/'"' < "$export_symbols" > "$output_objdir/$outputname.exp"'
4643 eval '$GREP -f "$output_objdir/$outputname.exp" < "$nlist" > "$nlist"T'
4644 eval '$MV "$nlist"T "$nlist"'
4646 *cygwin* | *mingw* | *cegcc* )
4647 eval "echo EXPORTS "'> "$output_objdir/$outputname.def"'
4648 eval 'cat "$nlist" >> "$output_objdir/$outputname.def"'
4655 for dlprefile in $dlprefiles; do
4656 func_verbose "extracting global C symbols from '$dlprefile'"
4657 func_basename "$dlprefile"
4658 name=$func_basename_result
4660 *cygwin* | *mingw* | *cegcc* )
4661 # if an import library, we need to obtain dlname
4662 if func_win32_import_lib_p "$dlprefile"; then
4663 func_tr_sh "$dlprefile"
4664 eval "curr_lafile=\$libfile_$func_tr_sh_result"
4665 dlprefile_dlbasename=
4666 if test -n "$curr_lafile" && func_lalib_p "$curr_lafile"; then
4667 # Use subshell, to avoid clobbering current variable values
4668 dlprefile_dlname=`source "$curr_lafile" && echo "$dlname"`
4669 if test -n "$dlprefile_dlname"; then
4670 func_basename "$dlprefile_dlname"
4671 dlprefile_dlbasename=$func_basename_result
4673 # no lafile. user explicitly requested -dlpreopen <import library>.
4674 $sharedlib_from_linklib_cmd "$dlprefile"
4675 dlprefile_dlbasename=$sharedlib_from_linklib_result
4679 if test -n "$dlprefile_dlbasename"; then
4680 eval '$ECHO ": $dlprefile_dlbasename" >> "$nlist"'
4682 func_warning "Could not compute DLL name from $name"
4683 eval '$ECHO ": $name " >> "$nlist"'
4685 func_to_tool_file "$dlprefile" func_convert_file_msys_to_w32
4686 eval "$NM \"$func_to_tool_file_result\" 2>/dev/null | $global_symbol_pipe |
4687 $SED -e '/I __imp/d' -e 's/I __nm_/D /;s/_nm__//' >> '$nlist'"
4689 else # not an import lib
4691 eval '$ECHO ": $name " >> "$nlist"'
4692 func_to_tool_file "$dlprefile" func_convert_file_msys_to_w32
4693 eval "$NM \"$func_to_tool_file_result\" 2>/dev/null | $global_symbol_pipe >> '$nlist'"
4699 eval '$ECHO ": $name " >> "$nlist"'
4700 func_to_tool_file "$dlprefile" func_convert_file_msys_to_w32
4701 eval "$NM \"$func_to_tool_file_result\" 2>/dev/null | $global_symbol_pipe >> '$nlist'"
4708 # Make sure we have at least an empty file.
4709 test -f "$nlist" || : > "$nlist"
4711 if test -n "$exclude_expsyms"; then
4712 $EGREP -v " ($exclude_expsyms)$" "$nlist" > "$nlist"T
4713 $MV "$nlist"T "$nlist"
4716 # Try sorting and uniquifying the output.
4717 if $GREP -v "^: " < "$nlist" |
4718 if sort -k 3 </dev/null >/dev/null 2>&1; then
4723 uniq > "$nlist"S; then
4726 $GREP -v "^: " < "$nlist" > "$nlist"S
4729 if test -f "$nlist"S; then
4730 eval "$global_symbol_to_cdecl"' < "$nlist"S >> "$output_objdir/$my_dlsyms"'
4732 echo '/* NONE */' >> "$output_objdir/$my_dlsyms"
4735 func_show_eval '$RM "${nlist}I"'
4736 if test -n "$global_symbol_to_import"; then
4737 eval "$global_symbol_to_import"' < "$nlist"S > "$nlist"I'
4740 echo >> "$output_objdir/$my_dlsyms" "\
4742 /* The mapping between symbol names and symbols. */
4747 extern LT_DLSYM_CONST lt_dlsymlist
4748 lt_${my_prefix}_LTX_preloaded_symbols[];\
4751 if test -s "$nlist"I; then
4752 echo >> "$output_objdir/$my_dlsyms" "\
4753 static void lt_syminit(void)
4755 LT_DLSYM_CONST lt_dlsymlist *symbol = lt_${my_prefix}_LTX_preloaded_symbols;
4756 for (; symbol->name; ++symbol)
4758 $SED 's/.*/ if (STREQ (symbol->name, \"&\")) symbol->address = (void *) \&&;/' < "$nlist"I >> "$output_objdir/$my_dlsyms"
4759 echo >> "$output_objdir/$my_dlsyms" "\
4763 echo >> "$output_objdir/$my_dlsyms" "\
4764 LT_DLSYM_CONST lt_dlsymlist
4765 lt_${my_prefix}_LTX_preloaded_symbols[] =
4766 { {\"$my_originator\", (void *) 0},"
4768 if test -s "$nlist"I; then
4769 echo >> "$output_objdir/$my_dlsyms" "\
4770 {\"@INIT@\", (void *) <_syminit},"
4773 case $need_lib_prefix in
4775 eval "$global_symbol_to_c_name_address" < "$nlist" >> "$output_objdir/$my_dlsyms"
4778 eval "$global_symbol_to_c_name_address_lib_prefix" < "$nlist" >> "$output_objdir/$my_dlsyms"
4781 echo >> "$output_objdir/$my_dlsyms" "\
4785 /* This works around a problem in FreeBSD linker */
4786 #ifdef FREEBSD_WORKAROUND
4787 static const void *lt_preloaded_setup() {
4788 return lt_${my_prefix}_LTX_preloaded_symbols;
4798 pic_flag_for_symtable=
4799 case "$compile_command " in
4803 # compiling the symbol table file with pic_flag works around
4804 # a FreeBSD bug that causes programs to crash when -lm is
4805 # linked before any other PIC object. But we must not use
4806 # pic_flag when linking with -static. The problem exists in
4807 # FreeBSD 2.2.6 and is fixed in FreeBSD 3.1.
4808 *-*-freebsd2.*|*-*-freebsd3.0*|*-*-freebsdelf3.0*)
4809 pic_flag_for_symtable=" $pic_flag -DFREEBSD_WORKAROUND" ;;
4811 pic_flag_for_symtable=" $pic_flag" ;;
4813 $my_pic_p && pic_flag_for_symtable=" $pic_flag"
4819 for arg in $LTCFLAGS; do
4821 -pie | -fpie | -fPIE) ;;
4822 *) func_append symtab_cflags " $arg" ;;
4826 # Now compile the dynamic symbol file.
4827 func_show_eval '(cd $output_objdir && $LTCC$symtab_cflags -c$no_builtin_flag$pic_flag_for_symtable "$my_dlsyms")' 'exit $?'
4829 # Clean up the generated files.
4830 func_show_eval '$RM "$output_objdir/$my_dlsyms" "$nlist" "${nlist}S" "${nlist}T" "${nlist}I"'
4832 # Transform the symbol file into the correct name.
4833 symfileobj=$output_objdir/${my_outputname}S.$objext
4835 *cygwin* | *mingw* | *cegcc* )
4836 if test -f "$output_objdir/$my_outputname.def"; then
4837 compile_command=`$ECHO "$compile_command" | $SED "s%@SYMFILE@%$output_objdir/$my_outputname.def $symfileobj%"`
4838 finalize_command=`$ECHO "$finalize_command" | $SED "s%@SYMFILE@%$output_objdir/$my_outputname.def $symfileobj%"`
4840 compile_command=`$ECHO "$compile_command" | $SED "s%@SYMFILE@%$symfileobj%"`
4841 finalize_command=`$ECHO "$finalize_command" | $SED "s%@SYMFILE@%$symfileobj%"`
4845 compile_command=`$ECHO "$compile_command" | $SED "s%@SYMFILE@%$symfileobj%"`
4846 finalize_command=`$ECHO "$finalize_command" | $SED "s%@SYMFILE@%$symfileobj%"`
4851 func_fatal_error "unknown suffix for '$my_dlsyms'"
4855 # We keep going just in case the user didn't refer to
4856 # lt_preloaded_symbols. The linker will fail if global_symbol_pipe
4857 # really was required.
4859 # Nullify the symbol file.
4860 compile_command=`$ECHO "$compile_command" | $SED "s% @SYMFILE@%%"`
4861 finalize_command=`$ECHO "$finalize_command" | $SED "s% @SYMFILE@%%"`
4865 # func_cygming_gnu_implib_p ARG
4866 # This predicate returns with zero status (TRUE) if
4867 # ARG is a GNU/binutils-style import library. Returns
4868 # with nonzero status (FALSE) otherwise.
4869 func_cygming_gnu_implib_p ()
4873 func_to_tool_file "$1" func_convert_file_msys_to_w32
4874 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)$'`
4875 test -n "$func_cygming_gnu_implib_tmp"
4878 # func_cygming_ms_implib_p ARG
4879 # This predicate returns with zero status (TRUE) if
4880 # ARG is an MS-style import library. Returns
4881 # with nonzero status (FALSE) otherwise.
4882 func_cygming_ms_implib_p ()
4886 func_to_tool_file "$1" func_convert_file_msys_to_w32
4887 func_cygming_ms_implib_tmp=`$NM "$func_to_tool_file_result" | eval "$global_symbol_pipe" | $GREP '_NULL_IMPORT_DESCRIPTOR'`
4888 test -n "$func_cygming_ms_implib_tmp"
4891 # func_win32_libid arg
4892 # return the library type of file 'arg'
4894 # Need a lot of goo to handle *both* DLLs and import libs
4895 # Has to be a shell function in order to 'eat' the argument
4896 # that is supplied when $file_magic_command is called.
4897 # Despite the name, also deal with 64 bit binaries.
4902 win32_libid_type=unknown
4903 win32_fileres=`file -L $1 2>/dev/null`
4904 case $win32_fileres in
4905 *ar\ archive\ import\ library*) # definitely import
4906 win32_libid_type="x86 archive import"
4908 *ar\ archive*) # could be an import, or static
4909 # Keep the egrep pattern in sync with the one in _LT_CHECK_MAGIC_METHOD.
4910 if eval $OBJDUMP -f $1 | $SED -e '10q' 2>/dev/null |
4911 $EGREP 'file format (pei*-i386(.*architecture: i386)?|pe-arm-wince|pe-x86-64)' >/dev/null; then
4912 case $nm_interface in
4914 if func_cygming_ms_implib_p "$1" ||
4915 func_cygming_gnu_implib_p "$1"
4923 func_to_tool_file "$1" func_convert_file_msys_to_w32
4924 win32_nmres=`eval $NM -f posix -A \"$func_to_tool_file_result\" |
4935 case $win32_nmres in
4936 import*) win32_libid_type="x86 archive import";;
4937 *) win32_libid_type="x86 archive static";;
4942 win32_libid_type="x86 DLL"
4944 *executable*) # but shell scripts are "executable" too...
4945 case $win32_fileres in
4946 *MS\ Windows\ PE\ Intel*)
4947 win32_libid_type="x86 DLL"
4952 $ECHO "$win32_libid_type"
4955 # func_cygming_dll_for_implib ARG
4957 # Platform-specific function to extract the
4958 # name of the DLL associated with the specified
4959 # import library ARG.
4960 # Invoked by eval'ing the libtool variable
4961 # $sharedlib_from_linklib_cmd
4962 # Result is available in the variable
4963 # $sharedlib_from_linklib_result
4964 func_cygming_dll_for_implib ()
4968 sharedlib_from_linklib_result=`$DLLTOOL --identify-strict --identify "$1"`
4971 # func_cygming_dll_for_implib_fallback_core SECTION_NAME LIBNAMEs
4973 # The is the core of a fallback implementation of a
4974 # platform-specific function to extract the name of the
4975 # DLL associated with the specified import library LIBNAME.
4977 # SECTION_NAME is either .idata$6 or .idata$7, depending
4978 # on the platform and compiler that created the implib.
4980 # Echos the name of the DLL associated with the
4981 # specified import library.
4982 func_cygming_dll_for_implib_fallback_core ()
4986 match_literal=`$ECHO "$1" | $SED "$sed_make_literal_regex"`
4987 $OBJDUMP -s --section "$1" "$2" 2>/dev/null |
4988 $SED '/^Contents of section '"$match_literal"':/{
4989 # Place marker at beginning of archive member dllname section
4994 # These lines can sometimes be longer than 43 characters, but
4995 # are always uninteresting
4996 /:[ ]*file format pe[i]\{,1\}-/d
4997 /^In archive [^:]*:/d
4998 # Ensure marker is printed
5000 # Remove all lines with less than 43 characters
5002 # From remaining lines, remove first 43 characters
5005 # Join marker and all lines until next marker into a single line
5006 /^====MARK====/ b para
5015 # Remove trailing dots and whitespace
5019 # we now have a list, one entry per line, of the stringified
5020 # contents of the appropriate section of all members of the
5021 # archive that possess that section. Heuristic: eliminate
5022 # all those that have a first or second character that is
5023 # a '.' (that is, objdump's representation of an unprintable
5024 # character.) This should work for all archives with less than
5025 # 0x302f exports -- but will fail for DLLs whose name actually
5026 # begins with a literal '.' or a single character followed by
5029 # Of those that remain, print the first one.
5030 $SED -e '/^\./d;/^.\./d;q'
5033 # func_cygming_dll_for_implib_fallback ARG
5034 # Platform-specific function to extract the
5035 # name of the DLL associated with the specified
5036 # import library ARG.
5038 # This fallback implementation is for use when $DLLTOOL
5039 # does not support the --identify-strict option.
5040 # Invoked by eval'ing the libtool variable
5041 # $sharedlib_from_linklib_cmd
5042 # Result is available in the variable
5043 # $sharedlib_from_linklib_result
5044 func_cygming_dll_for_implib_fallback ()
5048 if func_cygming_gnu_implib_p "$1"; then
5049 # binutils import library
5050 sharedlib_from_linklib_result=`func_cygming_dll_for_implib_fallback_core '.idata$7' "$1"`
5051 elif func_cygming_ms_implib_p "$1"; then
5052 # ms-generated import library
5053 sharedlib_from_linklib_result=`func_cygming_dll_for_implib_fallback_core '.idata$6' "$1"`
5056 sharedlib_from_linklib_result=
5061 # func_extract_an_archive dir oldlib
5062 func_extract_an_archive ()
5066 f_ex_an_ar_dir=$1; shift
5067 f_ex_an_ar_oldlib=$1
5068 if test yes = "$lock_old_archive_extraction"; then
5069 lockfile=$f_ex_an_ar_oldlib.lock
5070 until $opt_dry_run || ln "$progpath" "$lockfile" 2>/dev/null; do
5071 func_echo "Waiting for $lockfile to be removed"
5075 func_show_eval "(cd \$f_ex_an_ar_dir && $AR x \"\$f_ex_an_ar_oldlib\")" \
5076 'stat=$?; rm -f "$lockfile"; exit $stat'
5077 if test yes = "$lock_old_archive_extraction"; then
5078 $opt_dry_run || rm -f "$lockfile"
5080 if ($AR t "$f_ex_an_ar_oldlib" | sort | sort -uc >/dev/null 2>&1); then
5083 func_fatal_error "object name conflicts in archive: $f_ex_an_ar_dir/$f_ex_an_ar_oldlib"
5088 # func_extract_archives gentop oldlib ...
5089 func_extract_archives ()
5094 my_oldlibs=${1+"$@"}
5100 for my_xlib in $my_oldlibs; do
5101 # Extract the objects.
5103 [\\/]* | [A-Za-z]:[\\/]*) my_xabs=$my_xlib ;;
5104 *) my_xabs=`pwd`"/$my_xlib" ;;
5106 func_basename "$my_xlib"
5107 my_xlib=$func_basename_result
5110 case " $extracted_archives " in
5112 func_arith $extracted_serial + 1
5113 extracted_serial=$func_arith_result
5114 my_xlib_u=lt$extracted_serial-$my_xlib ;;
5118 extracted_archives="$extracted_archives $my_xlib_u"
5119 my_xdir=$my_gentop/$my_xlib_u
5121 func_mkdir_p "$my_xdir"
5125 func_verbose "Extracting $my_xabs"
5126 # Do not bother doing anything if just a dry run
5128 darwin_orig_dir=`pwd`
5129 cd $my_xdir || exit $?
5130 darwin_archive=$my_xabs
5132 func_basename "$darwin_archive"
5133 darwin_base_archive=$func_basename_result
5134 darwin_arches=`$LIPO -info "$darwin_archive" 2>/dev/null | $GREP Architectures 2>/dev/null || true`
5135 if test -n "$darwin_arches"; then
5136 darwin_arches=`$ECHO "$darwin_arches" | $SED -e 's/.*are://'`
5138 func_verbose "$darwin_base_archive has multiple architectures $darwin_arches"
5139 for darwin_arch in $darwin_arches; do
5140 func_mkdir_p "unfat-$$/$darwin_base_archive-$darwin_arch"
5141 $LIPO -thin $darwin_arch -output "unfat-$$/$darwin_base_archive-$darwin_arch/$darwin_base_archive" "$darwin_archive"
5142 cd "unfat-$$/$darwin_base_archive-$darwin_arch"
5143 func_extract_an_archive "`pwd`" "$darwin_base_archive"
5145 $RM "unfat-$$/$darwin_base_archive-$darwin_arch/$darwin_base_archive"
5146 done # $darwin_arches
5147 ## Okay now we've a bunch of thin objects, gotta fatten them up :)
5148 darwin_filelist=`find unfat-$$ -type f -name \*.o -print -o -name \*.lo -print | $SED -e "$basename" | sort -u`
5151 for darwin_file in $darwin_filelist; do
5152 darwin_files=`find unfat-$$ -name $darwin_file -print | sort | $NL2SP`
5153 $LIPO -create -output "$darwin_file" $darwin_files
5154 done # $darwin_filelist
5156 cd "$darwin_orig_dir"
5159 func_extract_an_archive "$my_xdir" "$my_xabs"
5164 func_extract_an_archive "$my_xdir" "$my_xabs"
5167 my_oldobjs="$my_oldobjs "`find $my_xdir -name \*.$objext -print -o -name \*.lo -print | sort | $NL2SP`
5170 func_extract_archives_result=$my_oldobjs
5174 # func_emit_wrapper [arg=no]
5176 # Emit a libtool wrapper script on stdout.
5177 # Don't directly open a file because we may want to
5178 # incorporate the script contents within a cygwin/mingw
5179 # wrapper executable. Must ONLY be called from within
5180 # func_mode_link because it depends on a number of variables
5183 # ARG is the value that the WRAPPER_SCRIPT_BELONGS_IN_OBJDIR
5184 # variable will take. If 'yes', then the emitted script
5185 # will assume that the directory where it is stored is
5186 # the $objdir directory. This is a cygwin/mingw-specific
5188 func_emit_wrapper ()
5190 func_emit_wrapper_arg1=${1-no}
5195 # $output - temporary wrapper script for $objdir/$outputname
5196 # Generated by $PROGRAM (GNU $PACKAGE) $VERSION
5198 # The $output program cannot be directly executed until all the libtool
5199 # libraries that it depends on are installed.
5201 # This wrapper script should never be moved out of the build directory.
5202 # If it is, it will not operate correctly.
5204 # Sed substitution that helps us do robust quoting. It backslashifies
5205 # metacharacters that are still active within double-quoted strings.
5206 sed_quote_subst='$sed_quote_subst'
5208 # Be Bourne compatible
5209 if test -n \"\${ZSH_VERSION+set}\" && (emulate sh) >/dev/null 2>&1; then
5212 # Zsh 3.x and 4.x performs word splitting on \${1+\"\$@\"}, which
5213 # is contrary to our usage. Disable this feature.
5214 alias -g '\${1+\"\$@\"}'='\"\$@\"'
5215 setopt NO_GLOB_SUBST
5217 case \`(set -o) 2>/dev/null\` in *posix*) set -o posix;; esac
5219 BIN_SH=xpg4; export BIN_SH # for Tru64
5220 DUALCASE=1; export DUALCASE # for MKS sh
5222 # The HP-UX ksh and POSIX shell print the target directory to stdout
5224 (unset CDPATH) >/dev/null 2>&1 && unset CDPATH
5226 relink_command=\"$relink_command\"
5228 # This environment variable determines our operation mode.
5229 if test \"\$libtool_install_magic\" = \"$magic\"; then
5230 # install mode needs the following variables:
5231 generated_by_libtool_version='$macro_version'
5232 notinst_deplibs='$notinst_deplibs'
5234 # When we are sourced in execute mode, \$file and \$ECHO are already set.
5235 if test \"\$libtool_execute_magic\" != \"$magic\"; then
5238 qECHO=`$ECHO "$ECHO" | $SED "$sed_quote_subst"`
5241 # A function that is used when there is no print builtin or printf.
5242 func_fallback_echo ()
5244 eval 'cat <<_LTECHO_EOF
5251 # Very basic option parsing. These options are (a) specific to
5252 # the libtool wrapper, (b) are identical between the wrapper
5253 # /script/ and the wrapper /executable/ that is used only on
5254 # windows platforms, and (c) all begin with the string "--lt-"
5255 # (application programs are unlikely to have options that match
5258 # There are only two supported options: --lt-debug and
5259 # --lt-dump-script. There is, deliberately, no --lt-help.
5261 # The first argument to this parsing function should be the
5262 # script's $0 value, followed by "$@".
5264 func_parse_lt_options ()
5270 case \"\$lt_opt\" in
5271 --lt-debug) lt_option_debug=1 ;;
5273 lt_dump_D=\`\$ECHO \"X\$lt_script_arg0\" | $SED -e 's/^X//' -e 's%/[^/]*$%%'\`
5274 test \"X\$lt_dump_D\" = \"X\$lt_script_arg0\" && lt_dump_D=.
5275 lt_dump_F=\`\$ECHO \"X\$lt_script_arg0\" | $SED -e 's/^X//' -e 's%^.*/%%'\`
5276 cat \"\$lt_dump_D/\$lt_dump_F\"
5280 \$ECHO \"Unrecognized --lt- option: '\$lt_opt'\" 1>&2
5286 # Print the debug banner immediately:
5287 if test -n \"\$lt_option_debug\"; then
5288 echo \"$outputname:$output:\$LINENO: libtool wrapper (GNU $PACKAGE) $VERSION\" 1>&2
5292 # Used when --lt-debug. Prints its arguments to stdout
5293 # (redirection is the responsibility of the caller)
5294 func_lt_dump_args ()
5299 \$ECHO \"$outputname:$output:\$LINENO: newargv[\$lt_dump_args_N]: \$lt_arg\"
5300 lt_dump_args_N=\`expr \$lt_dump_args_N + 1\`
5304 # Core function for launching the target application
5305 func_exec_program_core ()
5309 # Backslashes separate directories on plain windows
5310 *-*-mingw | *-*-os2* | *-cegcc*)
5312 if test -n \"\$lt_option_debug\"; then
5313 \$ECHO \"$outputname:$output:\$LINENO: newargv[0]: \$progdir\\\\\$program\" 1>&2
5314 func_lt_dump_args \${1+\"\$@\"} 1>&2
5316 exec \"\$progdir\\\\\$program\" \${1+\"\$@\"}
5322 if test -n \"\$lt_option_debug\"; then
5323 \$ECHO \"$outputname:$output:\$LINENO: newargv[0]: \$progdir/\$program\" 1>&2
5324 func_lt_dump_args \${1+\"\$@\"} 1>&2
5326 exec \"\$progdir/\$program\" \${1+\"\$@\"}
5331 \$ECHO \"\$0: cannot exec \$program \$*\" 1>&2
5335 # A function to encapsulate launching the target application
5336 # Strips options in the --lt-* namespace from \$@ and
5337 # launches target application with the remaining arguments.
5338 func_exec_program ()
5346 *) set x \"\$@\" \"\$lt_wr_arg\"; shift;;
5351 func_exec_program_core \${1+\"\$@\"}
5355 func_parse_lt_options \"\$0\" \${1+\"\$@\"}
5357 # Find the directory that this script lives in.
5358 thisdir=\`\$ECHO \"\$file\" | $SED 's%/[^/]*$%%'\`
5359 test \"x\$thisdir\" = \"x\$file\" && thisdir=.
5361 # Follow symbolic links until we get to the real thisdir.
5362 file=\`ls -ld \"\$file\" | $SED -n 's/.*-> //p'\`
5363 while test -n \"\$file\"; do
5364 destdir=\`\$ECHO \"\$file\" | $SED 's%/[^/]*\$%%'\`
5366 # If there was a directory component, then change thisdir.
5367 if test \"x\$destdir\" != \"x\$file\"; then
5368 case \"\$destdir\" in
5369 [\\\\/]* | [A-Za-z]:[\\\\/]*) thisdir=\"\$destdir\" ;;
5370 *) thisdir=\"\$thisdir/\$destdir\" ;;
5374 file=\`\$ECHO \"\$file\" | $SED 's%^.*/%%'\`
5375 file=\`ls -ld \"\$thisdir/\$file\" | $SED -n 's/.*-> //p'\`
5378 # Usually 'no', except on cygwin/mingw when embedded into
5380 WRAPPER_SCRIPT_BELONGS_IN_OBJDIR=$func_emit_wrapper_arg1
5381 if test \"\$WRAPPER_SCRIPT_BELONGS_IN_OBJDIR\" = \"yes\"; then
5382 # special case for '.'
5383 if test \"\$thisdir\" = \".\"; then
5386 # remove .libs from thisdir
5387 case \"\$thisdir\" in
5388 *[\\\\/]$objdir ) thisdir=\`\$ECHO \"\$thisdir\" | $SED 's%[\\\\/][^\\\\/]*$%%'\` ;;
5389 $objdir ) thisdir=. ;;
5393 # Try to get the absolute directory name.
5394 absdir=\`cd \"\$thisdir\" && pwd\`
5395 test -n \"\$absdir\" && thisdir=\"\$absdir\"
5398 if test yes = "$fast_install"; then
5400 program=lt-'$outputname'$exeext
5401 progdir=\"\$thisdir/$objdir\"
5403 if test ! -f \"\$progdir/\$program\" ||
5404 { file=\`ls -1dt \"\$progdir/\$program\" \"\$progdir/../\$program\" 2>/dev/null | $SED 1q\`; \\
5405 test \"X\$file\" != \"X\$progdir/\$program\"; }; then
5407 file=\"\$\$-\$program\"
5409 if test ! -d \"\$progdir\"; then
5410 $MKDIR \"\$progdir\"
5412 $RM \"\$progdir/\$file\"
5417 # relink executable if necessary
5418 if test -n \"\$relink_command\"; then
5419 if relink_command_output=\`eval \$relink_command 2>&1\`; then :
5421 $ECHO \"\$relink_command_output\" >&2
5422 $RM \"\$progdir/\$file\"
5427 $MV \"\$progdir/\$file\" \"\$progdir/\$program\" 2>/dev/null ||
5428 { $RM \"\$progdir/\$program\";
5429 $MV \"\$progdir/\$file\" \"\$progdir/\$program\"; }
5430 $RM \"\$progdir/\$file\"
5434 program='$outputname'
5435 progdir=\"\$thisdir/$objdir\"
5441 if test -f \"\$progdir/\$program\"; then"
5443 # fixup the dll searchpath if we need to.
5445 # Fix the DLL searchpath if we need to. Do this before prepending
5446 # to shlibpath, because on Windows, both are PATH and uninstalled
5447 # libraries must come first.
5448 if test -n "$dllsearchpath"; then
5450 # Add the dll search path components to the executable PATH
5451 PATH=$dllsearchpath:\$PATH
5455 # Export our shlibpath_var if we have one.
5456 if test yes = "$shlibpath_overrides_runpath" && test -n "$shlibpath_var" && test -n "$temp_rpath"; then
5458 # Add our own library path to $shlibpath_var
5459 $shlibpath_var=\"$temp_rpath\$$shlibpath_var\"
5461 # Some systems cannot cope with colon-terminated $shlibpath_var
5462 # The second colon is a workaround for a bug in BeOS R4 sed
5463 $shlibpath_var=\`\$ECHO \"\$$shlibpath_var\" | $SED 's/::*\$//'\`
5465 export $shlibpath_var
5470 if test \"\$libtool_execute_magic\" != \"$magic\"; then
5471 # Run the actual program with our arguments.
5472 func_exec_program \${1+\"\$@\"}
5475 # The program doesn't exist.
5476 \$ECHO \"\$0: error: '\$progdir/\$program' does not exist\" 1>&2
5477 \$ECHO \"This script is just a wrapper for \$program.\" 1>&2
5478 \$ECHO \"See the $PACKAGE documentation for more information.\" 1>&2
5486 # func_emit_cwrapperexe_src
5487 # emit the source code for a wrapper executable on stdout
5488 # Must ONLY be called from within func_mode_link because
5489 # it depends on a number of variable set therein.
5490 func_emit_cwrapperexe_src ()
5494 /* $cwrappersource - temporary wrapper executable for $objdir/$outputname
5495 Generated by $PROGRAM (GNU $PACKAGE) $VERSION
5497 The $output program cannot be directly executed until all the libtool
5498 libraries that it depends on are installed.
5500 This wrapper executable should never be moved out of the build directory.
5501 If it is, it will not operate correctly.
5506 # define _CRT_SECURE_NO_DEPRECATE 1
5511 # include <direct.h>
5512 # include <process.h>
5515 # include <unistd.h>
5516 # include <stdint.h>
5528 #include <sys/stat.h>
5530 #define STREQ(s1, s2) (strcmp ((s1), (s2)) == 0)
5532 /* declarations of non-ANSI functions */
5533 #if defined __MINGW32__
5534 # ifdef __STRICT_ANSI__
5535 int _putenv (const char *);
5537 #elif defined __CYGWIN__
5538 # ifdef __STRICT_ANSI__
5539 char *realpath (const char *, char *);
5540 int putenv (char *);
5541 int setenv (const char *, const char *, int);
5543 /* #elif defined other_platform || defined ... */
5546 /* portability defines, excluding path handling macros */
5547 #if defined _MSC_VER
5548 # define setmode _setmode
5550 # define chmod _chmod
5551 # define getcwd _getcwd
5552 # define putenv _putenv
5553 # define S_IXUSR _S_IEXEC
5554 #elif defined __MINGW32__
5555 # define setmode _setmode
5557 # define chmod _chmod
5558 # define getcwd _getcwd
5559 # define putenv _putenv
5560 #elif defined __CYGWIN__
5561 # define HAVE_SETENV
5562 # define FOPEN_WB "wb"
5563 /* #elif defined other platforms ... */
5566 #if defined PATH_MAX
5567 # define LT_PATHMAX PATH_MAX
5568 #elif defined MAXPATHLEN
5569 # define LT_PATHMAX MAXPATHLEN
5571 # define LT_PATHMAX 1024
5581 /* path handling portability macros */
5582 #ifndef DIR_SEPARATOR
5583 # define DIR_SEPARATOR '/'
5584 # define PATH_SEPARATOR ':'
5587 #if defined _WIN32 || defined __MSDOS__ || defined __DJGPP__ || \
5589 # define HAVE_DOS_BASED_FILE_SYSTEM
5590 # define FOPEN_WB "wb"
5591 # ifndef DIR_SEPARATOR_2
5592 # define DIR_SEPARATOR_2 '\\'
5594 # ifndef PATH_SEPARATOR_2
5595 # define PATH_SEPARATOR_2 ';'
5599 #ifndef DIR_SEPARATOR_2
5600 # define IS_DIR_SEPARATOR(ch) ((ch) == DIR_SEPARATOR)
5601 #else /* DIR_SEPARATOR_2 */
5602 # define IS_DIR_SEPARATOR(ch) \
5603 (((ch) == DIR_SEPARATOR) || ((ch) == DIR_SEPARATOR_2))
5604 #endif /* DIR_SEPARATOR_2 */
5606 #ifndef PATH_SEPARATOR_2
5607 # define IS_PATH_SEPARATOR(ch) ((ch) == PATH_SEPARATOR)
5608 #else /* PATH_SEPARATOR_2 */
5609 # define IS_PATH_SEPARATOR(ch) ((ch) == PATH_SEPARATOR_2)
5610 #endif /* PATH_SEPARATOR_2 */
5613 # define FOPEN_WB "w"
5616 # define _O_BINARY 0
5619 #define XMALLOC(type, num) ((type *) xmalloc ((num) * sizeof(type)))
5620 #define XFREE(stale) do { \
5621 if (stale) { free (stale); stale = 0; } \
5624 #if defined LT_DEBUGWRAPPER
5625 static int lt_debug = 1;
5627 static int lt_debug = 0;
5630 const char *program_name = "libtool-wrapper"; /* in case xstrdup fails */
5632 void *xmalloc (size_t num);
5633 char *xstrdup (const char *string);
5634 const char *base_name (const char *name);
5635 char *find_executable (const char *wrapper);
5636 char *chase_symlinks (const char *pathspec);
5637 int make_executable (const char *path);
5638 int check_executable (const char *path);
5639 char *strendzap (char *str, const char *pat);
5640 void lt_debugprintf (const char *file, int line, const char *fmt, ...);
5641 void lt_fatal (const char *file, int line, const char *message, ...);
5642 static const char *nonnull (const char *s);
5643 static const char *nonempty (const char *s);
5644 void lt_setenv (const char *name, const char *value);
5645 char *lt_extend_str (const char *orig_value, const char *add, int to_end);
5646 void lt_update_exe_path (const char *name, const char *value);
5647 void lt_update_lib_path (const char *name, const char *value);
5648 char **prepare_spawn (char **argv);
5649 void lt_dump_script (FILE *f);
5653 volatile const char * MAGIC_EXE = "$magic_exe";
5654 const char * LIB_PATH_VARNAME = "$shlibpath_var";
5657 if test yes = "$shlibpath_overrides_runpath" && test -n "$shlibpath_var" && test -n "$temp_rpath"; then
5658 func_to_host_path "$temp_rpath"
5660 const char * LIB_PATH_VALUE = "$func_to_host_path_result";
5664 const char * LIB_PATH_VALUE = "";
5668 if test -n "$dllsearchpath"; then
5669 func_to_host_path "$dllsearchpath:"
5671 const char * EXE_PATH_VARNAME = "PATH";
5672 const char * EXE_PATH_VALUE = "$func_to_host_path_result";
5676 const char * EXE_PATH_VARNAME = "";
5677 const char * EXE_PATH_VALUE = "";
5681 if test yes = "$fast_install"; then
5683 const char * TARGET_PROGRAM_NAME = "lt-$outputname"; /* hopefully, no .exe */
5687 const char * TARGET_PROGRAM_NAME = "$outputname"; /* hopefully, no .exe */
5694 #define LTWRAPPER_OPTION_PREFIX "--lt-"
5696 static const char *ltwrapper_option_prefix = LTWRAPPER_OPTION_PREFIX;
5697 static const char *dumpscript_opt = LTWRAPPER_OPTION_PREFIX "dump-script";
5698 static const char *debug_opt = LTWRAPPER_OPTION_PREFIX "debug";
5701 main (int argc, char *argv[])
5706 char *actual_cwrapper_path;
5707 char *actual_cwrapper_name;
5714 program_name = (char *) xstrdup (base_name (argv[0]));
5715 newargz = XMALLOC (char *, (size_t) argc + 1);
5717 /* very simple arg parsing; don't want to rely on getopt
5718 * also, copy all non cwrapper options to newargz, except
5719 * argz[0], which is handled differently
5722 for (i = 1; i < argc; i++)
5724 if (STREQ (argv[i], dumpscript_opt))
5728 *mingw* | *cygwin* )
5729 # make stdout use "unix" line endings
5730 echo " setmode(1,_O_BINARY);"
5735 lt_dump_script (stdout);
5738 if (STREQ (argv[i], debug_opt))
5743 if (STREQ (argv[i], ltwrapper_option_prefix))
5745 /* however, if there is an option in the LTWRAPPER_OPTION_PREFIX
5746 namespace, but it is not one of the ones we know about and
5747 have already dealt with, above (inluding dump-script), then
5748 report an error. Otherwise, targets might begin to believe
5749 they are allowed to use options in the LTWRAPPER_OPTION_PREFIX
5750 namespace. The first time any user complains about this, we'll
5751 need to make LTWRAPPER_OPTION_PREFIX a configure-time option
5752 or a configure.ac-settable value.
5754 lt_fatal (__FILE__, __LINE__,
5755 "unrecognized %s option: '%s'",
5756 ltwrapper_option_prefix, argv[i]);
5759 newargz[++newargc] = xstrdup (argv[i]);
5761 newargz[++newargc] = NULL;
5765 /* The GNU banner must be the first non-error debug message */
5766 lt_debugprintf (__FILE__, __LINE__, "libtool wrapper (GNU $PACKAGE) $VERSION\n");
5769 lt_debugprintf (__FILE__, __LINE__, "(main) argv[0]: %s\n", argv[0]);
5770 lt_debugprintf (__FILE__, __LINE__, "(main) program_name: %s\n", program_name);
5772 tmp_pathspec = find_executable (argv[0]);
5773 if (tmp_pathspec == NULL)
5774 lt_fatal (__FILE__, __LINE__, "couldn't find %s", argv[0]);
5775 lt_debugprintf (__FILE__, __LINE__,
5776 "(main) found exe (before symlink chase) at: %s\n",
5779 actual_cwrapper_path = chase_symlinks (tmp_pathspec);
5780 lt_debugprintf (__FILE__, __LINE__,
5781 "(main) found exe (after symlink chase) at: %s\n",
5782 actual_cwrapper_path);
5783 XFREE (tmp_pathspec);
5785 actual_cwrapper_name = xstrdup (base_name (actual_cwrapper_path));
5786 strendzap (actual_cwrapper_path, actual_cwrapper_name);
5788 /* wrapper name transforms */
5789 strendzap (actual_cwrapper_name, ".exe");
5790 tmp_pathspec = lt_extend_str (actual_cwrapper_name, ".exe", 1);
5791 XFREE (actual_cwrapper_name);
5792 actual_cwrapper_name = tmp_pathspec;
5795 /* target_name transforms -- use actual target program name; might have lt- prefix */
5796 target_name = xstrdup (base_name (TARGET_PROGRAM_NAME));
5797 strendzap (target_name, ".exe");
5798 tmp_pathspec = lt_extend_str (target_name, ".exe", 1);
5799 XFREE (target_name);
5800 target_name = tmp_pathspec;
5803 lt_debugprintf (__FILE__, __LINE__,
5804 "(main) libtool target name: %s\n",
5810 XMALLOC (char, (strlen (actual_cwrapper_path) +
5811 strlen ("$objdir") + 1 + strlen (actual_cwrapper_name) + 1));
5812 strcpy (newargz[0], actual_cwrapper_path);
5813 strcat (newargz[0], "$objdir");
5814 strcat (newargz[0], "/");
5818 /* stop here, and copy so we don't have to do this twice */
5819 tmp_pathspec = xstrdup (newargz[0]);
5821 /* do NOT want the lt- prefix here, so use actual_cwrapper_name */
5822 strcat (newargz[0], actual_cwrapper_name);
5824 /* DO want the lt- prefix here if it exists, so use target_name */
5825 lt_argv_zero = lt_extend_str (tmp_pathspec, target_name, 1);
5826 XFREE (tmp_pathspec);
5827 tmp_pathspec = NULL;
5835 while ((p = strchr (newargz[0], '\\')) != NULL)
5839 while ((p = strchr (lt_argv_zero, '\\')) != NULL)
5849 XFREE (target_name);
5850 XFREE (actual_cwrapper_path);
5851 XFREE (actual_cwrapper_name);
5853 lt_setenv ("BIN_SH", "xpg4"); /* for Tru64 */
5854 lt_setenv ("DUALCASE", "1"); /* for MSK sh */
5855 /* Update the DLL searchpath. EXE_PATH_VALUE ($dllsearchpath) must
5856 be prepended before (that is, appear after) LIB_PATH_VALUE ($temp_rpath)
5857 because on Windows, both *_VARNAMEs are PATH but uninstalled
5858 libraries must come first. */
5859 lt_update_exe_path (EXE_PATH_VARNAME, EXE_PATH_VALUE);
5860 lt_update_lib_path (LIB_PATH_VARNAME, LIB_PATH_VALUE);
5862 lt_debugprintf (__FILE__, __LINE__, "(main) lt_argv_zero: %s\n",
5863 nonnull (lt_argv_zero));
5864 for (i = 0; i < newargc; i++)
5866 lt_debugprintf (__FILE__, __LINE__, "(main) newargz[%d]: %s\n",
5867 i, nonnull (newargz[i]));
5875 /* execv doesn't actually work on mingw as expected on unix */
5876 newargz = prepare_spawn (newargz);
5877 rval = (int) _spawnv (_P_WAIT, lt_argv_zero, (const char * const *) newargz);
5880 /* failed to start process */
5881 lt_debugprintf (__FILE__, __LINE__,
5882 "(main) failed to launch target \"%s\": %s\n",
5883 lt_argv_zero, nonnull (strerror (errno)));
5891 execv (lt_argv_zero, newargz);
5892 return rval; /* =127, but avoids unused variable warning */
5901 xmalloc (size_t num)
5903 void *p = (void *) malloc (num);
5905 lt_fatal (__FILE__, __LINE__, "memory exhausted");
5911 xstrdup (const char *string)
5913 return string ? strcpy ((char *) xmalloc (strlen (string) + 1),
5918 base_name (const char *name)
5922 #if defined HAVE_DOS_BASED_FILE_SYSTEM
5923 /* Skip over the disk name in MSDOS pathnames. */
5924 if (isalpha ((unsigned char) name[0]) && name[1] == ':')
5928 for (base = name; *name; name++)
5929 if (IS_DIR_SEPARATOR (*name))
5935 check_executable (const char *path)
5939 lt_debugprintf (__FILE__, __LINE__, "(check_executable): %s\n",
5941 if ((!path) || (!*path))
5944 if ((stat (path, &st) >= 0)
5945 && (st.st_mode & (S_IXUSR | S_IXGRP | S_IXOTH)))
5952 make_executable (const char *path)
5957 lt_debugprintf (__FILE__, __LINE__, "(make_executable): %s\n",
5959 if ((!path) || (!*path))
5962 if (stat (path, &st) >= 0)
5964 rval = chmod (path, st.st_mode | S_IXOTH | S_IXGRP | S_IXUSR);
5969 /* Searches for the full path of the wrapper. Returns
5970 newly allocated full path name if found, NULL otherwise
5971 Does not chase symlinks, even on platforms that support them.
5974 find_executable (const char *wrapper)
5979 /* static buffer for getcwd */
5980 char tmp[LT_PATHMAX + 1];
5984 lt_debugprintf (__FILE__, __LINE__, "(find_executable): %s\n",
5985 nonempty (wrapper));
5987 if ((wrapper == NULL) || (*wrapper == '\0'))
5990 /* Absolute path? */
5991 #if defined HAVE_DOS_BASED_FILE_SYSTEM
5992 if (isalpha ((unsigned char) wrapper[0]) && wrapper[1] == ':')
5994 concat_name = xstrdup (wrapper);
5995 if (check_executable (concat_name))
5997 XFREE (concat_name);
6002 if (IS_DIR_SEPARATOR (wrapper[0]))
6004 concat_name = xstrdup (wrapper);
6005 if (check_executable (concat_name))
6007 XFREE (concat_name);
6009 #if defined HAVE_DOS_BASED_FILE_SYSTEM
6013 for (p = wrapper; *p; p++)
6021 /* no slashes; search PATH */
6022 const char *path = getenv ("PATH");
6025 for (p = path; *p; p = p_next)
6029 for (q = p; *q; q++)
6030 if (IS_PATH_SEPARATOR (*q))
6032 p_len = (size_t) (q - p);
6033 p_next = (*q == '\0' ? q : q + 1);
6036 /* empty path: current directory */
6037 if (getcwd (tmp, LT_PATHMAX) == NULL)
6038 lt_fatal (__FILE__, __LINE__, "getcwd failed: %s",
6039 nonnull (strerror (errno)));
6040 tmp_len = strlen (tmp);
6042 XMALLOC (char, tmp_len + 1 + strlen (wrapper) + 1);
6043 memcpy (concat_name, tmp, tmp_len);
6044 concat_name[tmp_len] = '/';
6045 strcpy (concat_name + tmp_len + 1, wrapper);
6050 XMALLOC (char, p_len + 1 + strlen (wrapper) + 1);
6051 memcpy (concat_name, p, p_len);
6052 concat_name[p_len] = '/';
6053 strcpy (concat_name + p_len + 1, wrapper);
6055 if (check_executable (concat_name))
6057 XFREE (concat_name);
6060 /* not found in PATH; assume curdir */
6062 /* Relative path | not found in path: prepend cwd */
6063 if (getcwd (tmp, LT_PATHMAX) == NULL)
6064 lt_fatal (__FILE__, __LINE__, "getcwd failed: %s",
6065 nonnull (strerror (errno)));
6066 tmp_len = strlen (tmp);
6067 concat_name = XMALLOC (char, tmp_len + 1 + strlen (wrapper) + 1);
6068 memcpy (concat_name, tmp, tmp_len);
6069 concat_name[tmp_len] = '/';
6070 strcpy (concat_name + tmp_len + 1, wrapper);
6072 if (check_executable (concat_name))
6074 XFREE (concat_name);
6079 chase_symlinks (const char *pathspec)
6082 return xstrdup (pathspec);
6084 char buf[LT_PATHMAX];
6086 char *tmp_pathspec = xstrdup (pathspec);
6088 int has_symlinks = 0;
6089 while (strlen (tmp_pathspec) && !has_symlinks)
6091 lt_debugprintf (__FILE__, __LINE__,
6092 "checking path component for symlinks: %s\n",
6094 if (lstat (tmp_pathspec, &s) == 0)
6096 if (S_ISLNK (s.st_mode) != 0)
6102 /* search backwards for last DIR_SEPARATOR */
6103 p = tmp_pathspec + strlen (tmp_pathspec) - 1;
6104 while ((p > tmp_pathspec) && (!IS_DIR_SEPARATOR (*p)))
6106 if ((p == tmp_pathspec) && (!IS_DIR_SEPARATOR (*p)))
6108 /* no more DIR_SEPARATORS left */
6115 lt_fatal (__FILE__, __LINE__,
6116 "error accessing file \"%s\": %s",
6117 tmp_pathspec, nonnull (strerror (errno)));
6120 XFREE (tmp_pathspec);
6124 return xstrdup (pathspec);
6127 tmp_pathspec = realpath (pathspec, buf);
6128 if (tmp_pathspec == 0)
6130 lt_fatal (__FILE__, __LINE__,
6131 "could not follow symlinks for %s", pathspec);
6133 return xstrdup (tmp_pathspec);
6138 strendzap (char *str, const char *pat)
6142 assert (str != NULL);
6143 assert (pat != NULL);
6146 patlen = strlen (pat);
6150 str += len - patlen;
6151 if (STREQ (str, pat))
6158 lt_debugprintf (const char *file, int line, const char *fmt, ...)
6163 (void) fprintf (stderr, "%s:%s:%d: ", program_name, file, line);
6164 va_start (args, fmt);
6165 (void) vfprintf (stderr, fmt, args);
6171 lt_error_core (int exit_status, const char *file,
6172 int line, const char *mode,
6173 const char *message, va_list ap)
6175 fprintf (stderr, "%s:%s:%d: %s: ", program_name, file, line, mode);
6176 vfprintf (stderr, message, ap);
6177 fprintf (stderr, ".\n");
6179 if (exit_status >= 0)
6184 lt_fatal (const char *file, int line, const char *message, ...)
6187 va_start (ap, message);
6188 lt_error_core (EXIT_FAILURE, file, line, "FATAL", message, ap);
6193 nonnull (const char *s)
6195 return s ? s : "(null)";
6199 nonempty (const char *s)
6201 return (s && !*s) ? "(empty)" : nonnull (s);
6205 lt_setenv (const char *name, const char *value)
6207 lt_debugprintf (__FILE__, __LINE__,
6208 "(lt_setenv) setting '%s' to '%s'\n",
6209 nonnull (name), nonnull (value));
6212 /* always make a copy, for consistency with !HAVE_SETENV */
6213 char *str = xstrdup (value);
6214 setenv (name, str, 1);
6216 size_t len = strlen (name) + 1 + strlen (value) + 1;
6217 char *str = XMALLOC (char, len);
6218 sprintf (str, "%s=%s", name, value);
6219 if (putenv (str) != EXIT_SUCCESS)
6228 lt_extend_str (const char *orig_value, const char *add, int to_end)
6231 if (orig_value && *orig_value)
6233 size_t orig_value_len = strlen (orig_value);
6234 size_t add_len = strlen (add);
6235 new_value = XMALLOC (char, add_len + orig_value_len + 1);
6238 strcpy (new_value, orig_value);
6239 strcpy (new_value + orig_value_len, add);
6243 strcpy (new_value, add);
6244 strcpy (new_value + add_len, orig_value);
6249 new_value = xstrdup (add);
6255 lt_update_exe_path (const char *name, const char *value)
6257 lt_debugprintf (__FILE__, __LINE__,
6258 "(lt_update_exe_path) modifying '%s' by prepending '%s'\n",
6259 nonnull (name), nonnull (value));
6261 if (name && *name && value && *value)
6263 char *new_value = lt_extend_str (getenv (name), value, 0);
6264 /* some systems can't cope with a ':'-terminated path #' */
6265 size_t len = strlen (new_value);
6266 while ((len > 0) && IS_PATH_SEPARATOR (new_value[len-1]))
6268 new_value[--len] = '\0';
6270 lt_setenv (name, new_value);
6276 lt_update_lib_path (const char *name, const char *value)
6278 lt_debugprintf (__FILE__, __LINE__,
6279 "(lt_update_lib_path) modifying '%s' by prepending '%s'\n",
6280 nonnull (name), nonnull (value));
6282 if (name && *name && value && *value)
6284 char *new_value = lt_extend_str (getenv (name), value, 0);
6285 lt_setenv (name, new_value);
6295 /* Prepares an argument vector before calling spawn().
6296 Note that spawn() does not by itself call the command interpreter
6297 (getenv ("COMSPEC") != NULL ? getenv ("COMSPEC") :
6298 ({ OSVERSIONINFO v; v.dwOSVersionInfoSize = sizeof(OSVERSIONINFO);
6300 v.dwPlatformId == VER_PLATFORM_WIN32_NT;
6301 }) ? "cmd.exe" : "command.com").
6302 Instead it simply concatenates the arguments, separated by ' ', and calls
6303 CreateProcess(). We must quote the arguments since Win32 CreateProcess()
6304 interprets characters like ' ', '\t', '\\', '"' (but not '<' and '>') in a
6306 - Space and tab are interpreted as delimiters. They are not treated as
6307 delimiters if they are surrounded by double quotes: "...".
6308 - Unescaped double quotes are removed from the input. Their only effect is
6309 that within double quotes, space and tab are treated like normal
6311 - Backslashes not followed by double quotes are not special.
6312 - But 2*n+1 backslashes followed by a double quote become
6313 n backslashes followed by a double quote (n >= 0):
6318 #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"
6319 #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"
6321 prepare_spawn (char **argv)
6327 /* Count number of arguments. */
6328 for (argc = 0; argv[argc] != NULL; argc++)
6331 /* Allocate new argument vector. */
6332 new_argv = XMALLOC (char *, argc + 1);
6334 /* Put quoted arguments into the new argument vector. */
6335 for (i = 0; i < argc; i++)
6337 const char *string = argv[i];
6339 if (string[0] == '\0')
6340 new_argv[i] = xstrdup ("\"\"");
6341 else if (strpbrk (string, SHELL_SPECIAL_CHARS) != NULL)
6343 int quote_around = (strpbrk (string, SHELL_SPACE_CHARS) != NULL);
6345 unsigned int backslashes;
6347 char *quoted_string;
6354 for (s = string; *s != '\0'; s++)
6358 length += backslashes + 1;
6366 length += backslashes + 1;
6368 quoted_string = XMALLOC (char, length + 1);
6374 for (s = string; *s != '\0'; s++)
6380 for (j = backslashes + 1; j > 0; j--)
6392 for (j = backslashes; j > 0; j--)
6398 new_argv[i] = quoted_string;
6401 new_argv[i] = (char *) string;
6403 new_argv[argc] = NULL;
6412 void lt_dump_script (FILE* f)
6415 func_emit_wrapper yes |
6417 s/^\(.\{79\}\)\(..*\)/\1\
6422 s/\([^\n]*\).*/ fputs ("\1", f);/p
6429 # end: func_emit_cwrapperexe_src
6431 # func_win32_import_lib_p ARG
6432 # True if ARG is an import lib, as indicated by $file_magic_cmd
6433 func_win32_import_lib_p ()
6437 case `eval $file_magic_cmd \"\$1\" 2>/dev/null | $SED -e 10q` in
6443 # func_mode_link arg...
6449 *-*-cygwin* | *-*-mingw* | *-*-pw32* | *-*-os2* | *-cegcc*)
6450 # It is impossible to link a dll without this setting, and
6451 # we shouldn't force the makefile maintainer to figure out
6452 # what system we are compiling for in order to pass an extra
6453 # flag for every libtool invocation.
6454 # allow_undefined=no
6456 # FIXME: Unfortunately, there are problems with the above when trying
6457 # to make a dll that has undefined symbols, in which case not
6458 # even a static library is built. For now, we need to specify
6459 # -no-undefined on the libtool link line when we can be certain
6460 # that all symbols are satisfied, otherwise we get a static library.
6467 libtool_args=$nonopt
6468 base_compile="$nonopt $@"
6469 compile_command=$nonopt
6470 finalize_command=$nonopt
6483 lib_search_path=`pwd`
6485 new_inherited_linker_flags=
6494 export_symbols_regex=
6502 precious_files_regex=
6503 prefer_static_libs=no
6516 single_module=$wl-single_module
6517 func_infer_tag $base_compile
6519 # We need to know -static, to get the right output filenames.
6524 test yes != "$build_libtool_libs" \
6525 && func_fatal_configuration "cannot build a shared library"
6529 -all-static | -static | -static-libtool-libs)
6532 if test yes = "$build_libtool_libs" && test -z "$link_static_flag"; then
6533 func_warning "complete static linking is impossible in this configuration"
6535 if test -n "$link_static_flag"; then
6536 dlopen_self=$dlopen_self_static
6538 prefer_static_libs=yes
6541 if test -z "$pic_flag" && test -n "$link_static_flag"; then
6542 dlopen_self=$dlopen_self_static
6544 prefer_static_libs=built
6546 -static-libtool-libs)
6547 if test -z "$pic_flag" && test -n "$link_static_flag"; then
6548 dlopen_self=$dlopen_self_static
6550 prefer_static_libs=yes
6553 build_libtool_libs=no
6560 # See if our shared archives depend on static archives.
6561 test -n "$old_archive_from_new_cmds" && build_old_libs=yes
6563 # Go through the arguments, transforming them on the way.
6564 while test "$#" -gt 0; do
6567 func_quote_for_eval "$arg"
6568 qarg=$func_quote_for_eval_unquoted_result
6569 func_append libtool_args " $func_quote_for_eval_result"
6571 # If the previous option needs an argument, assign it.
6572 if test -n "$prev"; then
6575 func_append compile_command " @OUTPUT@"
6576 func_append finalize_command " @OUTPUT@"
6588 # Add the symbol object into the linking commands.
6589 func_append compile_command " @SYMFILE@"
6590 func_append finalize_command " @SYMFILE@"
6594 *.la | *.lo) ;; # We handle these cases below.
6596 if test no = "$dlself"; then
6604 if test dlprefiles = "$prev"; then
6606 elif test dlfiles = "$prev" && test yes != "$dlopen_self"; then
6616 if test dlfiles = "$prev"; then
6617 func_append dlfiles " $arg"
6619 func_append dlprefiles " $arg"
6629 || func_fatal_error "symbol file '$arg' does not exist"
6634 export_symbols_regex=$arg
6642 *" $qarg.ltframework "*) ;;
6643 *) func_append deplibs " $qarg.ltframework" # this is fixed later
6652 inst_prefix_dir=$arg
6657 # Clang does not use LLVM to link, so we can simply discard any
6658 # '-mllvm $arg' options when doing the link step.
6663 if test -f "$arg"; then
6666 for fil in `cat "$save_arg"`
6668 # func_append moreargs " $fil"
6670 # A libtool-controlled object.
6672 # Check to see that this really is a libtool object.
6673 if func_lalib_unsafe_p "$arg"; then
6680 if test -z "$pic_object" ||
6681 test -z "$non_pic_object" ||
6682 test none = "$pic_object" &&
6683 test none = "$non_pic_object"; then
6684 func_fatal_error "cannot find name of object for '$arg'"
6687 # Extract subdirectory from the argument.
6688 func_dirname "$arg" "/" ""
6689 xdir=$func_dirname_result
6691 if test none != "$pic_object"; then
6692 # Prepend the subdirectory the object is found in.
6693 pic_object=$xdir$pic_object
6695 if test dlfiles = "$prev"; then
6696 if test yes = "$build_libtool_libs" && test yes = "$dlopen_support"; then
6697 func_append dlfiles " $pic_object"
6701 # If libtool objects are unsupported, then we need to preload.
6706 # CHECK ME: I think I busted this. -Ossama
6707 if test dlprefiles = "$prev"; then
6708 # Preload the old-style object.
6709 func_append dlprefiles " $pic_object"
6714 func_append libobjs " $pic_object"
6719 if test none != "$non_pic_object"; then
6720 # Prepend the subdirectory the object is found in.
6721 non_pic_object=$xdir$non_pic_object
6723 # A standard non-PIC object
6724 func_append non_pic_objects " $non_pic_object"
6725 if test -z "$pic_object" || test none = "$pic_object"; then
6729 # If the PIC object exists, use it instead.
6730 # $xdir was prepended to $pic_object above.
6731 non_pic_object=$pic_object
6732 func_append non_pic_objects " $non_pic_object"
6735 # Only an error if not doing a dry-run.
6736 if $opt_dry_run; then
6737 # Extract subdirectory from the argument.
6738 func_dirname "$arg" "/" ""
6739 xdir=$func_dirname_result
6742 pic_object=$xdir$objdir/$func_lo2o_result
6743 non_pic_object=$xdir$func_lo2o_result
6744 func_append libobjs " $pic_object"
6745 func_append non_pic_objects " $non_pic_object"
6747 func_fatal_error "'$arg' is not a valid libtool object"
6752 func_fatal_error "link input file '$arg' does not exist"
6759 precious_files_regex=$arg
6769 # We need an absolute path.
6771 [\\/]* | [A-Za-z]:[\\/]*) ;;
6773 func_fatal_error "only absolute run-paths are allowed"
6776 if test rpath = "$prev"; then
6779 *) func_append rpath " $arg" ;;
6784 *) func_append xrpath " $arg" ;;
6796 func_append weak_libs " $arg"
6801 func_append linker_flags " $qarg"
6802 func_append compiler_flags " $qarg"
6804 func_append compile_command " $qarg"
6805 func_append finalize_command " $qarg"
6809 func_append compiler_flags " $qarg"
6811 func_append compile_command " $qarg"
6812 func_append finalize_command " $qarg"
6816 func_append linker_flags " $qarg"
6817 func_append compiler_flags " $wl$qarg"
6819 func_append compile_command " $wl$qarg"
6820 func_append finalize_command " $wl$qarg"
6824 eval "$prev=\"\$arg\""
6829 fi # test -n "$prev"
6835 if test -n "$link_static_flag"; then
6836 # See comment for -static flag below, for more details.
6837 func_append compile_command " $link_static_flag"
6838 func_append finalize_command " $link_static_flag"
6844 # FIXME: remove this flag sometime in the future.
6845 func_fatal_error "'-allow-undefined' must not be used because it is the default"
6873 -export-symbols | -export-symbols-regex)
6874 if test -n "$export_symbols" || test -n "$export_symbols_regex"; then
6875 func_fatal_error "more than one -exported-symbols argument is not allowed"
6877 if test X-export-symbols = "X$arg"; then
6895 # The native IRIX linker understands -LANG:*, -LIST:* and -LNO:*
6896 # so, if we see these flags be careful not to treat them like -L
6898 case $with_gcc/$host in
6899 no/*-*-irix* | /*-*-irix*)
6900 func_append compile_command " $arg"
6901 func_append finalize_command " $arg"
6908 func_stripname "-L" '' "$arg"
6909 if test -z "$func_stripname_result"; then
6910 if test "$#" -gt 0; then
6911 func_fatal_error "require no space between '-L' and '$1'"
6913 func_fatal_error "need path for '-L' option"
6916 func_resolve_sysroot "$func_stripname_result"
6917 dir=$func_resolve_sysroot_result
6918 # We need an absolute path.
6920 [\\/]* | [A-Za-z]:[\\/]*) ;;
6922 absdir=`cd "$dir" && pwd`
6923 test -z "$absdir" && \
6924 func_fatal_error "cannot determine absolute directory name of '$dir'"
6929 *" -L$dir "* | *" $arg "*)
6930 # Will only happen for absolute or sysroot arguments
6933 # Preserve sysroot, but never include relative directories
6935 [\\/]* | [A-Za-z]:[\\/]* | =*) func_append deplibs " $arg" ;;
6936 *) func_append deplibs " -L$dir" ;;
6938 func_append lib_search_path " $dir"
6942 *-*-cygwin* | *-*-mingw* | *-*-pw32* | *-*-os2* | *-cegcc*)
6943 testbindir=`$ECHO "$dir" | $SED 's*/lib$*/bin*'`
6944 case :$dllsearchpath: in
6946 ::) dllsearchpath=$dir;;
6947 *) func_append dllsearchpath ":$dir";;
6949 case :$dllsearchpath: in
6950 *":$testbindir:"*) ;;
6951 ::) dllsearchpath=$testbindir;;
6952 *) func_append dllsearchpath ":$testbindir";;
6960 if test X-lc = "X$arg" || test X-lm = "X$arg"; then
6962 *-*-cygwin* | *-*-mingw* | *-*-pw32* | *-*-beos* | *-cegcc* | *-*-haiku*)
6963 # These systems don't actually have a C or math library (as such)
6967 # These systems don't actually have a C library (as such)
6968 test X-lc = "X$arg" && continue
6970 *-*-openbsd* | *-*-freebsd* | *-*-dragonfly* | *-*-bitrig*)
6971 # Do not include libc due to us having libc/libc_r.
6972 test X-lc = "X$arg" && continue
6974 *-*-rhapsody* | *-*-darwin1.[012])
6975 # Rhapsody C and math libraries are in the System framework
6976 func_append deplibs " System.ltframework"
6979 *-*-sco3.2v5* | *-*-sco5v6*)
6980 # Causes problems with __ctype
6981 test X-lc = "X$arg" && continue
6983 *-*-sysv4.2uw2* | *-*-sysv5* | *-*-unixware* | *-*-OpenUNIX*)
6984 # Compiler inserts libc in the correct place for threads to work
6985 test X-lc = "X$arg" && continue
6988 elif test X-lc_r = "X$arg"; then
6990 *-*-openbsd* | *-*-freebsd* | *-*-dragonfly* | *-*-bitrig*)
6991 # Do not include libc_r directly, use -pthread flag.
6996 func_append deplibs " $arg"
7010 # Tru64 UNIX uses -model [arg] to determine the layout of C++
7011 # classes, name mangling, and exception handling.
7012 # Darwin uses the -arch flag to determine output architecture.
7013 -model|-arch|-isysroot|--sysroot)
7014 func_append compiler_flags " $arg"
7015 func_append compile_command " $arg"
7016 func_append finalize_command " $arg"
7021 -mt|-mthreads|-kthread|-Kthread|-pthread|-pthreads|--thread-safe \
7022 |-threads|-fopenmp|-openmp|-mp|-xopenmp|-omp|-qsmp=*)
7023 func_append compiler_flags " $arg"
7024 func_append compile_command " $arg"
7025 func_append finalize_command " $arg"
7026 case "$new_inherited_linker_flags " in
7028 * ) func_append new_inherited_linker_flags " $arg" ;;
7034 single_module=$wl-multi_module
7045 *-*-cygwin* | *-*-mingw* | *-*-pw32* | *-*-os2* | *-*-darwin* | *-cegcc*)
7046 # The PATH hackery in wrapper scripts is required on Windows
7047 # and Darwin in order for the loader to find any dlls it needs.
7048 func_warning "'-no-install' is ignored for $host"
7049 func_warning "assuming '-no-fast-install' instead"
7052 *) no_install=yes ;;
7069 -precious-files-regex)
7090 func_stripname '-R' '' "$arg"
7091 dir=$func_stripname_result
7092 # We need an absolute path.
7094 [\\/]* | [A-Za-z]:[\\/]*) ;;
7096 func_stripname '=' '' "$dir"
7097 dir=$lt_sysroot$func_stripname_result
7100 func_fatal_error "only absolute run-paths are allowed"
7105 *) func_append xrpath " $dir" ;;
7111 # The effects of -shared are defined in a previous loop.
7120 -static | -static-libtool-libs)
7121 # The effects of -static are defined in a previous loop.
7122 # We used to do the same as -all-static on platforms that
7123 # didn't have a PIC flag, but the assumption that the effects
7124 # would be equivalent was wrong. It would break on at least
7125 # Digital Unix and AIX.
7151 func_stripname '-Wc,' '' "$arg"
7152 args=$func_stripname_result
7154 save_ifs=$IFS; IFS=,
7155 for flag in $args; do
7157 func_quote_for_eval "$flag"
7158 func_append arg " $func_quote_for_eval_result"
7159 func_append compiler_flags " $func_quote_for_eval_result"
7162 func_stripname ' ' '' "$arg"
7163 arg=$func_stripname_result
7167 func_stripname '-Wl,' '' "$arg"
7168 args=$func_stripname_result
7170 save_ifs=$IFS; IFS=,
7171 for flag in $args; do
7173 func_quote_for_eval "$flag"
7174 func_append arg " $wl$func_quote_for_eval_result"
7175 func_append compiler_flags " $wl$func_quote_for_eval_result"
7176 func_append linker_flags " $func_quote_for_eval_result"
7179 func_stripname ' ' '' "$arg"
7180 arg=$func_stripname_result
7200 func_quote_for_eval "$arg"
7201 arg=$func_quote_for_eval_result
7204 # Flags to be passed through unchanged, with rationale:
7205 # -64, -mips[0-9] enable 64-bit mode for the SGI compiler
7206 # -r[0-9][0-9]* specify processor for the SGI compiler
7207 # -xarch=*, -xtarget=* enable 64-bit mode for the Sun compiler
7208 # +DA*, +DD* enable 64-bit mode for the HP compiler
7209 # -q* compiler args for the IBM compiler
7210 # -m*, -t[45]*, -txscale* architecture-specific flags for GCC
7211 # -F/path path to uninstalled frameworks, gcc on darwin
7212 # -p, -pg, --coverage, -fprofile-* profiling flags for GCC
7213 # @file GCC response files
7214 # -tp=* Portland pgcc target processor selection
7215 # --sysroot=* for sysroot support
7216 # -O*, -g*, -flto*, -fwhopr*, -fuse-linker-plugin GCC link-time optimization
7217 # -stdlib=* select c++ std lib with clang
7218 -64|-mips[0-9]|-r[0-9][0-9]*|-xarch=*|-xtarget=*|+DA*|+DD*|-q*|-m*| \
7219 -t[45]*|-txscale*|-p|-pg|--coverage|-fprofile-*|-F*|@*|-tp=*|--sysroot=*| \
7220 -O*|-g*|-flto*|-fwhopr*|-fuse-linker-plugin|-stdlib=*)
7221 func_quote_for_eval "$arg"
7222 arg=$func_quote_for_eval_result
7223 func_append compile_command " $arg"
7224 func_append finalize_command " $arg"
7225 func_append compiler_flags " $arg"
7229 # Some other compiler flag.
7231 func_quote_for_eval "$arg"
7232 arg=$func_quote_for_eval_result
7236 # A standard object.
7237 func_append objs " $arg"
7241 # A libtool-controlled object.
7243 # Check to see that this really is a libtool object.
7244 if func_lalib_unsafe_p "$arg"; then
7251 if test -z "$pic_object" ||
7252 test -z "$non_pic_object" ||
7253 test none = "$pic_object" &&
7254 test none = "$non_pic_object"; then
7255 func_fatal_error "cannot find name of object for '$arg'"
7258 # Extract subdirectory from the argument.
7259 func_dirname "$arg" "/" ""
7260 xdir=$func_dirname_result
7262 test none = "$pic_object" || {
7263 # Prepend the subdirectory the object is found in.
7264 pic_object=$xdir$pic_object
7266 if test dlfiles = "$prev"; then
7267 if test yes = "$build_libtool_libs" && test yes = "$dlopen_support"; then
7268 func_append dlfiles " $pic_object"
7272 # If libtool objects are unsupported, then we need to preload.
7277 # CHECK ME: I think I busted this. -Ossama
7278 if test dlprefiles = "$prev"; then
7279 # Preload the old-style object.
7280 func_append dlprefiles " $pic_object"
7285 func_append libobjs " $pic_object"
7290 if test none != "$non_pic_object"; then
7291 # Prepend the subdirectory the object is found in.
7292 non_pic_object=$xdir$non_pic_object
7294 # A standard non-PIC object
7295 func_append non_pic_objects " $non_pic_object"
7296 if test -z "$pic_object" || test none = "$pic_object"; then
7300 # If the PIC object exists, use it instead.
7301 # $xdir was prepended to $pic_object above.
7302 non_pic_object=$pic_object
7303 func_append non_pic_objects " $non_pic_object"
7306 # Only an error if not doing a dry-run.
7307 if $opt_dry_run; then
7308 # Extract subdirectory from the argument.
7309 func_dirname "$arg" "/" ""
7310 xdir=$func_dirname_result
7313 pic_object=$xdir$objdir/$func_lo2o_result
7314 non_pic_object=$xdir$func_lo2o_result
7315 func_append libobjs " $pic_object"
7316 func_append non_pic_objects " $non_pic_object"
7318 func_fatal_error "'$arg' is not a valid libtool object"
7325 func_append deplibs " $arg"
7326 func_append old_deplibs " $arg"
7331 # A libtool-controlled library.
7333 func_resolve_sysroot "$arg"
7334 if test dlfiles = "$prev"; then
7335 # This library was specified with -dlopen.
7336 func_append dlfiles " $func_resolve_sysroot_result"
7338 elif test dlprefiles = "$prev"; then
7339 # The library was specified with -dlpreopen.
7340 func_append dlprefiles " $func_resolve_sysroot_result"
7343 func_append deplibs " $func_resolve_sysroot_result"
7348 # Some other compiler argument.
7350 # Unknown arguments in both finalize_command and compile_command need
7351 # to be aesthetically quoted because they are evaled later.
7352 func_quote_for_eval "$arg"
7353 arg=$func_quote_for_eval_result
7357 # Now actually substitute the argument into the commands.
7358 if test -n "$arg"; then
7359 func_append compile_command " $arg"
7360 func_append finalize_command " $arg"
7362 done # argument parsing loop
7364 test -n "$prev" && \
7365 func_fatal_help "the '$prevarg' option requires an argument"
7367 if test yes = "$export_dynamic" && test -n "$export_dynamic_flag_spec"; then
7368 eval arg=\"$export_dynamic_flag_spec\"
7369 func_append compile_command " $arg"
7370 func_append finalize_command " $arg"
7374 # calculate the name of the file, without its directory
7375 func_basename "$output"
7376 outputname=$func_basename_result
7377 libobjs_save=$libobjs
7379 if test -n "$shlibpath_var"; then
7380 # get the directories listed in $shlibpath_var
7381 eval shlib_search_path=\`\$ECHO \"\$$shlibpath_var\" \| \$SED \'s/:/ /g\'\`
7385 eval sys_lib_search_path=\"$sys_lib_search_path_spec\"
7386 eval sys_lib_dlsearch_path=\"$sys_lib_dlsearch_path_spec\"
7388 func_dirname "$output" "/" ""
7389 output_objdir=$func_dirname_result$objdir
7390 func_to_tool_file "$output_objdir/"
7391 tool_output_objdir=$func_to_tool_file_result
7392 # Create the object directory.
7393 func_mkdir_p "$output_objdir"
7395 # Determine the type of output
7398 func_fatal_help "you must specify an output file"
7400 *.$libext) linkmode=oldlib ;;
7401 *.lo | *.$objext) linkmode=obj ;;
7402 *.la) linkmode=lib ;;
7403 *) linkmode=prog ;; # Anything else should be a program.
7409 # Find all interdependent deplibs by searching for libraries
7410 # that are linked more than once (e.g. -la -lb -la)
7411 for deplib in $deplibs; do
7412 if $opt_preserve_dup_deps; then
7414 *" $deplib "*) func_append specialdeplibs " $deplib" ;;
7417 func_append libs " $deplib"
7420 if test lib = "$linkmode"; then
7421 libs="$predeps $libs $compiler_lib_search_path $postdeps"
7423 # Compute libraries that are listed more than once in $predeps
7424 # $postdeps and mark them as special (i.e., whose duplicates are
7425 # not to be eliminated).
7427 if $opt_duplicate_compiler_generated_deps; then
7428 for pre_post_dep in $predeps $postdeps; do
7429 case "$pre_post_deps " in
7430 *" $pre_post_dep "*) func_append specialdeplibs " $pre_post_deps" ;;
7432 func_append pre_post_deps " $pre_post_dep"
7441 need_relink=no # whether we're linking any uninstalled libtool libraries
7442 notinst_deplibs= # not-installed libtool libraries
7443 notinst_path= # paths that contain not-installed libtool libraries
7447 passes="conv dlpreopen link"
7448 for file in $dlfiles $dlprefiles; do
7452 func_fatal_help "libraries can '-dlopen' only libtool libraries: $file"
7463 passes="conv scan dlopen dlpreopen link"
7469 for pass in $passes; do
7470 # The preopen pass in lib mode reverses $deplibs; put it back here
7471 # so that -L comes before libs that need it for instance...
7472 if test lib,link = "$linkmode,$pass"; then
7473 ## FIXME: Find the place where the list is rebuilt in the wrong
7474 ## order, and fix it there properly
7476 for deplib in $deplibs; do
7477 tmp_deplibs="$deplib $tmp_deplibs"
7479 deplibs=$tmp_deplibs
7482 if test lib,link = "$linkmode,$pass" ||
7483 test prog,scan = "$linkmode,$pass"; then
7487 if test prog = "$linkmode"; then
7489 dlopen) libs=$dlfiles ;;
7490 dlpreopen) libs=$dlprefiles ;;
7491 link) libs="$deplibs %DEPLIBS% $dependency_libs" ;;
7494 if test lib,dlpreopen = "$linkmode,$pass"; then
7495 # Collect and forward deplibs of preopened libtool libs
7496 for lib in $dlprefiles; do
7497 # Ignore non-libtool-libs
7499 func_resolve_sysroot "$lib"
7501 *.la) func_source "$func_resolve_sysroot_result" ;;
7504 # Collect preopened libtool deplibs, except any this library
7505 # has declared as weak libs
7506 for deplib in $dependency_libs; do
7507 func_basename "$deplib"
7508 deplib_base=$func_basename_result
7509 case " $weak_libs " in
7510 *" $deplib_base "*) ;;
7511 *) func_append deplibs " $deplib" ;;
7517 if test dlopen = "$pass"; then
7518 # Collect dlpreopened libraries
7519 save_deplibs=$deplibs
7523 for deplib in $libs; do
7527 -mt|-mthreads|-kthread|-Kthread|-pthread|-pthreads|--thread-safe \
7528 |-threads|-fopenmp|-openmp|-mp|-xopenmp|-omp|-qsmp=*)
7529 if test prog,link = "$linkmode,$pass"; then
7530 compile_deplibs="$deplib $compile_deplibs"
7531 finalize_deplibs="$deplib $finalize_deplibs"
7533 func_append compiler_flags " $deplib"
7534 if test lib = "$linkmode"; then
7535 case "$new_inherited_linker_flags " in
7537 * ) func_append new_inherited_linker_flags " $deplib" ;;
7544 if test lib != "$linkmode" && test prog != "$linkmode"; then
7545 func_warning "'-l' is ignored for archives/objects"
7548 func_stripname '-l' '' "$deplib"
7549 name=$func_stripname_result
7550 if test lib = "$linkmode"; then
7551 searchdirs="$newlib_search_path $lib_search_path $compiler_lib_search_dirs $sys_lib_search_path $shlib_search_path"
7553 searchdirs="$newlib_search_path $lib_search_path $sys_lib_search_path $shlib_search_path"
7555 for searchdir in $searchdirs; do
7556 for search_ext in .la $std_shrext .so .a; do
7557 # Search the libtool library
7558 lib=$searchdir/lib$name$search_ext
7559 if test -f "$lib"; then
7560 if test .la = "$search_ext"; then
7570 # deplib is a libtool library
7571 # If $allow_libtool_libs_with_static_runtimes && $deplib is a stdlib,
7572 # We need to do some special things here, and not later.
7573 if test yes = "$allow_libtool_libs_with_static_runtimes"; then
7574 case " $predeps $postdeps " in
7576 if func_lalib_p "$lib"; then
7580 for l in $old_library $library_names; do
7583 if test "X$ll" = "X$old_library"; then # only static version available
7585 func_dirname "$lib" "" "."
7586 ladir=$func_dirname_result
7587 lib=$ladir/$old_library
7588 if test prog,link = "$linkmode,$pass"; then
7589 compile_deplibs="$deplib $compile_deplibs"
7590 finalize_deplibs="$deplib $finalize_deplibs"
7592 deplibs="$deplib $deplibs"
7593 test lib = "$linkmode" && newdependency_libs="$deplib $newdependency_libs"
7603 # deplib doesn't seem to be a libtool library
7604 if test prog,link = "$linkmode,$pass"; then
7605 compile_deplibs="$deplib $compile_deplibs"
7606 finalize_deplibs="$deplib $finalize_deplibs"
7608 deplibs="$deplib $deplibs"
7609 test lib = "$linkmode" && newdependency_libs="$deplib $newdependency_libs"
7615 if test prog,link = "$linkmode,$pass"; then
7616 compile_deplibs="$deplib $compile_deplibs"
7617 finalize_deplibs="$deplib $finalize_deplibs"
7619 deplibs="$deplib $deplibs"
7620 if test lib = "$linkmode"; then
7621 case "$new_inherited_linker_flags " in
7623 * ) func_append new_inherited_linker_flags " $deplib" ;;
7632 deplibs="$deplib $deplibs"
7633 test conv = "$pass" && continue
7634 newdependency_libs="$deplib $newdependency_libs"
7635 func_stripname '-L' '' "$deplib"
7636 func_resolve_sysroot "$func_stripname_result"
7637 func_append newlib_search_path " $func_resolve_sysroot_result"
7640 if test conv = "$pass"; then
7641 deplibs="$deplib $deplibs"
7644 if test scan = "$pass"; then
7645 deplibs="$deplib $deplibs"
7647 compile_deplibs="$deplib $compile_deplibs"
7648 finalize_deplibs="$deplib $finalize_deplibs"
7650 func_stripname '-L' '' "$deplib"
7651 func_resolve_sysroot "$func_stripname_result"
7652 func_append newlib_search_path " $func_resolve_sysroot_result"
7655 func_warning "'-L' is ignored for archives/objects"
7661 if test link = "$pass"; then
7662 func_stripname '-R' '' "$deplib"
7663 func_resolve_sysroot "$func_stripname_result"
7664 dir=$func_resolve_sysroot_result
7665 # Make sure the xrpath contains only unique directories.
7668 *) func_append xrpath " $dir" ;;
7671 deplibs="$deplib $deplibs"
7675 func_resolve_sysroot "$deplib"
7676 lib=$func_resolve_sysroot_result
7679 if test conv = "$pass"; then
7680 deplibs="$deplib $deplibs"
7685 # Linking convenience modules into shared libraries is allowed,
7686 # but linking other static libraries is non-portable.
7687 case " $dlpreconveniencelibs " in
7691 case $deplibs_check_method in
7693 set dummy $deplibs_check_method; shift
7694 match_pattern_regex=`expr "$deplibs_check_method" : "$1 \(.*\)"`
7695 if eval "\$ECHO \"$deplib\"" 2>/dev/null | $SED 10q \
7696 | $EGREP "$match_pattern_regex" > /dev/null; then
7704 if $valid_a_lib; then
7706 $ECHO "*** Warning: Linking the shared library $output against the"
7707 $ECHO "*** static library $deplib is not portable!"
7708 deplibs="$deplib $deplibs"
7711 $ECHO "*** Warning: Trying to link with static lib archive $deplib."
7712 echo "*** I have the capability to make that library automatically link in when"
7713 echo "*** you link to this library. But I can only do this if you have a"
7714 echo "*** shared version of the library, which you do not appear to have"
7715 echo "*** because the file extensions .$libext of this argument makes me believe"
7716 echo "*** that it is just a static archive that I should not use here."
7723 if test link != "$pass"; then
7724 deplibs="$deplib $deplibs"
7726 compile_deplibs="$deplib $compile_deplibs"
7727 finalize_deplibs="$deplib $finalize_deplibs"
7734 if test conv = "$pass"; then
7735 deplibs="$deplib $deplibs"
7736 elif test prog = "$linkmode"; then
7737 if test dlpreopen = "$pass" || test yes != "$dlopen_support" || test no = "$build_libtool_libs"; then
7738 # If there is no dlopen support or we're linking statically,
7739 # we need to preload.
7740 func_append newdlprefiles " $deplib"
7741 compile_deplibs="$deplib $compile_deplibs"
7742 finalize_deplibs="$deplib $finalize_deplibs"
7744 func_append newdlfiles " $deplib"
7755 $found || test -f "$lib" \
7756 || func_fatal_error "cannot find the library '$lib' or unhandled argument '$deplib'"
7758 # Check to see that this really is a libtool archive.
7759 func_lalib_unsafe_p "$lib" \
7760 || func_fatal_error "'$lib' is not a valid libtool archive"
7762 func_dirname "$lib" "" "."
7763 ladir=$func_dirname_result
7771 inherited_linker_flags=
7772 # If the library was installed with an old release of libtool,
7773 # it will not redefine variables installed, or shouldnotlink
7782 # Convert "-framework foo" to "foo.ltframework"
7783 if test -n "$inherited_linker_flags"; then
7784 tmp_inherited_linker_flags=`$ECHO "$inherited_linker_flags" | $SED 's/-framework \([^ $]*\)/\1.ltframework/g'`
7785 for tmp_inherited_linker_flag in $tmp_inherited_linker_flags; do
7786 case " $new_inherited_linker_flags " in
7787 *" $tmp_inherited_linker_flag "*) ;;
7788 *) func_append new_inherited_linker_flags " $tmp_inherited_linker_flag";;
7792 dependency_libs=`$ECHO " $dependency_libs" | $SED 's% \([^ $]*\).ltframework% -framework \1%g'`
7793 if test lib,link = "$linkmode,$pass" ||
7794 test prog,scan = "$linkmode,$pass" ||
7795 { test prog != "$linkmode" && test lib != "$linkmode"; }; then
7796 test -n "$dlopen" && func_append dlfiles " $dlopen"
7797 test -n "$dlpreopen" && func_append dlprefiles " $dlpreopen"
7800 if test conv = "$pass"; then
7801 # Only check for convenience libraries
7802 deplibs="$lib $deplibs"
7803 if test -z "$libdir"; then
7804 if test -z "$old_library"; then
7805 func_fatal_error "cannot find name of link library for '$lib'"
7807 # It is a libtool convenience library, so add in its objects.
7808 func_append convenience " $ladir/$objdir/$old_library"
7809 func_append old_convenience " $ladir/$objdir/$old_library"
7810 elif test prog != "$linkmode" && test lib != "$linkmode"; then
7811 func_fatal_error "'$lib' is not a convenience library"
7814 for deplib in $dependency_libs; do
7815 deplibs="$deplib $deplibs"
7816 if $opt_preserve_dup_deps; then
7817 case "$tmp_libs " in
7818 *" $deplib "*) func_append specialdeplibs " $deplib" ;;
7821 func_append tmp_libs " $deplib"
7827 # Get the name of the library we link against.
7829 if test -n "$old_library" &&
7830 { test yes = "$prefer_static_libs" ||
7831 test built,no = "$prefer_static_libs,$installed"; }; then
7832 linklib=$old_library
7834 for l in $old_library $library_names; do
7838 if test -z "$linklib"; then
7839 func_fatal_error "cannot find name of link library for '$lib'"
7842 # This library was specified with -dlopen.
7843 if test dlopen = "$pass"; then
7845 && func_fatal_error "cannot -dlopen a convenience library: '$lib'"
7846 if test -z "$dlname" ||
7847 test yes != "$dlopen_support" ||
7848 test no = "$build_libtool_libs"
7850 # If there is no dlname, no dlopen support or we're linking
7851 # statically, we need to preload. We also need to preload any
7852 # dependent libraries so libltdl's deplib preloader doesn't
7853 # bomb out in the load deplibs phase.
7854 func_append dlprefiles " $lib $dependency_libs"
7856 func_append newdlfiles " $lib"
7861 # We need an absolute path.
7863 [\\/]* | [A-Za-z]:[\\/]*) abs_ladir=$ladir ;;
7865 abs_ladir=`cd "$ladir" && pwd`
7866 if test -z "$abs_ladir"; then
7867 func_warning "cannot determine absolute directory name of '$ladir'"
7868 func_warning "passing it literally to the linker, although it might fail"
7873 func_basename "$lib"
7874 laname=$func_basename_result
7876 # Find the relevant object directory and library name.
7877 if test yes = "$installed"; then
7878 if test ! -f "$lt_sysroot$libdir/$linklib" && test -f "$abs_ladir/$linklib"; then
7879 func_warning "library '$lib' was moved."
7884 dir=$lt_sysroot$libdir
7885 absdir=$lt_sysroot$libdir
7887 test yes = "$hardcode_automatic" && avoidtemprpath=yes
7889 if test ! -f "$ladir/$objdir/$linklib" && test -f "$abs_ladir/$linklib"; then
7892 # Remove this search path later
7893 func_append notinst_path " $abs_ladir"
7896 absdir=$abs_ladir/$objdir
7897 # Remove this search path later
7898 func_append notinst_path " $abs_ladir"
7900 fi # $installed = yes
7901 func_stripname 'lib' '.la' "$laname"
7902 name=$func_stripname_result
7904 # This library was specified with -dlpreopen.
7905 if test dlpreopen = "$pass"; then
7906 if test -z "$libdir" && test prog = "$linkmode"; then
7907 func_fatal_error "only libraries may -dlpreopen a convenience library: '$lib'"
7910 # special handling for platforms with PE-DLLs.
7911 *cygwin* | *mingw* | *cegcc* )
7912 # Linker will automatically link against shared library if both
7913 # static and shared are present. Therefore, ensure we extract
7914 # symbols from the import library if a shared library is present
7915 # (otherwise, the dlopen module name will be incorrect). We do
7916 # this by putting the import library name into $newdlprefiles.
7917 # We recover the dlopen module name by 'saving' the la file
7918 # name in a special purpose variable, and (later) extracting the
7919 # dlname from the la file.
7920 if test -n "$dlname"; then
7921 func_tr_sh "$dir/$linklib"
7922 eval "libfile_$func_tr_sh_result=\$abs_ladir/\$laname"
7923 func_append newdlprefiles " $dir/$linklib"
7925 func_append newdlprefiles " $dir/$old_library"
7926 # Keep a list of preopened convenience libraries to check
7927 # that they are being used correctly in the link pass.
7928 test -z "$libdir" && \
7929 func_append dlpreconveniencelibs " $dir/$old_library"
7933 # Prefer using a static library (so that no silly _DYNAMIC symbols
7934 # are required to link).
7935 if test -n "$old_library"; then
7936 func_append newdlprefiles " $dir/$old_library"
7937 # Keep a list of preopened convenience libraries to check
7938 # that they are being used correctly in the link pass.
7939 test -z "$libdir" && \
7940 func_append dlpreconveniencelibs " $dir/$old_library"
7941 # Otherwise, use the dlname, so that lt_dlopen finds it.
7942 elif test -n "$dlname"; then
7943 func_append newdlprefiles " $dir/$dlname"
7945 func_append newdlprefiles " $dir/$linklib"
7949 fi # $pass = dlpreopen
7951 if test -z "$libdir"; then
7952 # Link the convenience library
7953 if test lib = "$linkmode"; then
7954 deplibs="$dir/$old_library $deplibs"
7955 elif test prog,link = "$linkmode,$pass"; then
7956 compile_deplibs="$dir/$old_library $compile_deplibs"
7957 finalize_deplibs="$dir/$old_library $finalize_deplibs"
7959 deplibs="$lib $deplibs" # used for prog,scan pass
7965 if test prog = "$linkmode" && test link != "$pass"; then
7966 func_append newlib_search_path " $ladir"
7967 deplibs="$lib $deplibs"
7969 linkalldeplibs=false
7970 if test no != "$link_all_deplibs" || test -z "$library_names" ||
7971 test no = "$build_libtool_libs"; then
7976 for deplib in $dependency_libs; do
7978 -L*) func_stripname '-L' '' "$deplib"
7979 func_resolve_sysroot "$func_stripname_result"
7980 func_append newlib_search_path " $func_resolve_sysroot_result"
7983 # Need to link against all dependency_libs?
7984 if $linkalldeplibs; then
7985 deplibs="$deplib $deplibs"
7987 # Need to hardcode shared library paths
7988 # or/and link against static libraries
7989 newdependency_libs="$deplib $newdependency_libs"
7991 if $opt_preserve_dup_deps; then
7992 case "$tmp_libs " in
7993 *" $deplib "*) func_append specialdeplibs " $deplib" ;;
7996 func_append tmp_libs " $deplib"
7999 fi # $linkmode = prog...
8001 if test prog,link = "$linkmode,$pass"; then
8002 if test -n "$library_names" &&
8003 { { test no = "$prefer_static_libs" ||
8004 test built,yes = "$prefer_static_libs,$installed"; } ||
8005 test -z "$old_library"; }; then
8006 # We need to hardcode the library path
8007 if test -n "$shlibpath_var" && test -z "$avoidtemprpath"; then
8008 # Make sure the rpath contains only unique directories.
8009 case $temp_rpath: in
8011 *) func_append temp_rpath "$absdir:" ;;
8015 # Hardcode the library path.
8016 # Skip directories that are in the system default run-time
8018 case " $sys_lib_dlsearch_path " in
8021 case "$compile_rpath " in
8023 *) func_append compile_rpath " $absdir" ;;
8027 case " $sys_lib_dlsearch_path " in
8030 case "$finalize_rpath " in
8032 *) func_append finalize_rpath " $libdir" ;;
8036 fi # $linkmode,$pass = prog,link...
8039 { test pass_all = "$deplibs_check_method" ||
8040 { test yes = "$build_libtool_libs" &&
8041 test -n "$library_names"; }; }; then
8042 # We only need to search for static libraries
8047 link_static=no # Whether the deplib will be linked statically
8048 use_static_libs=$prefer_static_libs
8049 if test built = "$use_static_libs" && test yes = "$installed"; then
8052 if test -n "$library_names" &&
8053 { test no = "$use_static_libs" || test -z "$old_library"; }; then
8055 *cygwin* | *mingw* | *cegcc*)
8056 # No point in relinking DLLs because paths are not encoded
8057 func_append notinst_deplibs " $lib"
8061 if test no = "$installed"; then
8062 func_append notinst_deplibs " $lib"
8067 # This is a shared library
8069 # Warn about portability, can't link against -module's on some
8070 # systems (darwin). Don't bleat about dlopened modules though!
8072 for dlpremoduletest in $dlprefiles; do
8073 if test "X$dlpremoduletest" = "X$lib"; then
8074 dlopenmodule=$dlpremoduletest
8078 if test -z "$dlopenmodule" && test yes = "$shouldnotlink" && test link = "$pass"; then
8080 if test prog = "$linkmode"; then
8081 $ECHO "*** Warning: Linking the executable $output against the loadable module"
8083 $ECHO "*** Warning: Linking the shared library $output against the loadable module"
8085 $ECHO "*** $linklib is not portable!"
8087 if test lib = "$linkmode" &&
8088 test yes = "$hardcode_into_libs"; then
8089 # Hardcode the library path.
8090 # Skip directories that are in the system default run-time
8092 case " $sys_lib_dlsearch_path " in
8095 case "$compile_rpath " in
8097 *) func_append compile_rpath " $absdir" ;;
8101 case " $sys_lib_dlsearch_path " in
8104 case "$finalize_rpath " in
8106 *) func_append finalize_rpath " $libdir" ;;
8112 if test -n "$old_archive_from_expsyms_cmds"; then
8113 # figure out the soname
8114 set dummy $library_names
8118 libname=`eval "\\$ECHO \"$libname_spec\""`
8119 # use dlname if we got it. it's perfectly good, no?
8120 if test -n "$dlname"; then
8122 elif test -n "$soname_spec"; then
8125 *cygwin* | mingw* | *cegcc*)
8126 func_arith $current - $age
8127 major=$func_arith_result
8131 eval soname=\"$soname_spec\"
8136 # Make a new name for the extract_expsyms_cmds to use
8138 func_basename "$soroot"
8139 soname=$func_basename_result
8140 func_stripname 'lib' '.dll' "$soname"
8141 newlib=libimp-$func_stripname_result.a
8143 # If the library has no export list, then create one now
8144 if test -f "$output_objdir/$soname-def"; then :
8146 func_verbose "extracting exported symbol list from '$soname'"
8147 func_execute_cmds "$extract_expsyms_cmds" 'exit $?'
8151 if test -f "$output_objdir/$newlib"; then :; else
8152 func_verbose "generating import library for '$soname'"
8153 func_execute_cmds "$old_archive_from_expsyms_cmds" 'exit $?'
8155 # make sure the library variables are pointing to the new library
8158 fi # test -n "$old_archive_from_expsyms_cmds"
8160 if test prog = "$linkmode" || test relink != "$opt_mode"; then
8165 case $hardcode_action in
8166 immediate | unsupported)
8167 if test no = "$hardcode_direct"; then
8170 *-*-sco3.2v5.0.[024]*) add_dir=-L$dir ;;
8171 *-*-sysv4*uw2*) add_dir=-L$dir ;;
8172 *-*-sysv5OpenUNIX* | *-*-sysv5UnixWare7.[01].[10]* | \
8173 *-*-unixware7*) add_dir=-L$dir ;;
8175 # if the lib is a (non-dlopened) module then we cannot
8176 # link against it, someone is ignoring the earlier warnings
8177 if /usr/bin/file -L $add 2> /dev/null |
8178 $GREP ": [^:]* bundle" >/dev/null; then
8179 if test "X$dlopenmodule" != "X$lib"; then
8180 $ECHO "*** Warning: lib $linklib is a module, not a shared library"
8181 if test -z "$old_library"; then
8183 echo "*** And there doesn't seem to be a static archive available"
8184 echo "*** The link will probably fail, sorry"
8186 add=$dir/$old_library
8188 elif test -n "$old_library"; then
8189 add=$dir/$old_library
8193 elif test no = "$hardcode_minus_L"; then
8195 *-*-sunos*) add_shlibpath=$dir ;;
8199 elif test no = "$hardcode_shlibpath_var"; then
8207 if test yes = "$hardcode_direct" &&
8208 test no = "$hardcode_direct_absolute"; then
8210 elif test yes = "$hardcode_minus_L"; then
8212 # Try looking first in the location we're being installed to.
8213 if test -n "$inst_prefix_dir"; then
8216 func_append add_dir " -L$inst_prefix_dir$libdir"
8221 elif test yes = "$hardcode_shlibpath_var"; then
8231 if test yes != "$lib_linked"; then
8232 func_fatal_configuration "unsupported hardcode properties"
8235 if test -n "$add_shlibpath"; then
8236 case :$compile_shlibpath: in
8237 *":$add_shlibpath:"*) ;;
8238 *) func_append compile_shlibpath "$add_shlibpath:" ;;
8241 if test prog = "$linkmode"; then
8242 test -n "$add_dir" && compile_deplibs="$add_dir $compile_deplibs"
8243 test -n "$add" && compile_deplibs="$add $compile_deplibs"
8245 test -n "$add_dir" && deplibs="$add_dir $deplibs"
8246 test -n "$add" && deplibs="$add $deplibs"
8247 if test yes != "$hardcode_direct" &&
8248 test yes != "$hardcode_minus_L" &&
8249 test yes = "$hardcode_shlibpath_var"; then
8250 case :$finalize_shlibpath: in
8252 *) func_append finalize_shlibpath "$libdir:" ;;
8258 if test prog = "$linkmode" || test relink = "$opt_mode"; then
8262 # Finalize command for both is simple: just hardcode it.
8263 if test yes = "$hardcode_direct" &&
8264 test no = "$hardcode_direct_absolute"; then
8265 add=$libdir/$linklib
8266 elif test yes = "$hardcode_minus_L"; then
8269 elif test yes = "$hardcode_shlibpath_var"; then
8270 case :$finalize_shlibpath: in
8272 *) func_append finalize_shlibpath "$libdir:" ;;
8275 elif test yes = "$hardcode_automatic"; then
8276 if test -n "$inst_prefix_dir" &&
8277 test -f "$inst_prefix_dir$libdir/$linklib"; then
8278 add=$inst_prefix_dir$libdir/$linklib
8280 add=$libdir/$linklib
8283 # We cannot seem to hardcode it, guess we'll fake it.
8285 # Try looking first in the location we're being installed to.
8286 if test -n "$inst_prefix_dir"; then
8289 func_append add_dir " -L$inst_prefix_dir$libdir"
8296 if test prog = "$linkmode"; then
8297 test -n "$add_dir" && finalize_deplibs="$add_dir $finalize_deplibs"
8298 test -n "$add" && finalize_deplibs="$add $finalize_deplibs"
8300 test -n "$add_dir" && deplibs="$add_dir $deplibs"
8301 test -n "$add" && deplibs="$add $deplibs"
8304 elif test prog = "$linkmode"; then
8305 # Here we assume that one of hardcode_direct or hardcode_minus_L
8306 # is not unsupported. This is valid on all known static and
8308 if test unsupported != "$hardcode_direct"; then
8309 test -n "$old_library" && linklib=$old_library
8310 compile_deplibs="$dir/$linklib $compile_deplibs"
8311 finalize_deplibs="$dir/$linklib $finalize_deplibs"
8313 compile_deplibs="-l$name -L$dir $compile_deplibs"
8314 finalize_deplibs="-l$name -L$dir $finalize_deplibs"
8316 elif test yes = "$build_libtool_libs"; then
8317 # Not a shared library
8318 if test pass_all != "$deplibs_check_method"; then
8319 # We're trying link a shared library against a static one
8320 # but the system doesn't support it.
8322 # Just print a warning and add the library to dependency_libs so
8323 # that the program can be linked against the static library.
8325 $ECHO "*** Warning: This system cannot link to static lib archive $lib."
8326 echo "*** I have the capability to make that library automatically link in when"
8327 echo "*** you link to this library. But I can only do this if you have a"
8328 echo "*** shared version of the library, which you do not appear to have."
8329 if test yes = "$module"; then
8330 echo "*** But as you try to build a module library, libtool will still create "
8331 echo "*** a static module, that should work as long as the dlopening application"
8332 echo "*** is linked with the -dlopen flag to resolve symbols at runtime."
8333 if test -z "$global_symbol_pipe"; then
8335 echo "*** However, this would only work if libtool was able to extract symbol"
8336 echo "*** lists from a program, using 'nm' or equivalent, but libtool could"
8337 echo "*** not find such a program. So, this module is probably useless."
8338 echo "*** 'nm' from GNU binutils and a full rebuild may help."
8340 if test no = "$build_old_libs"; then
8341 build_libtool_libs=module
8344 build_libtool_libs=no
8348 deplibs="$dir/$old_library $deplibs"
8351 fi # link shared/static library?
8353 if test lib = "$linkmode"; then
8354 if test -n "$dependency_libs" &&
8355 { test yes != "$hardcode_into_libs" ||
8356 test yes = "$build_old_libs" ||
8357 test yes = "$link_static"; }; then
8358 # Extract -R from dependency_libs
8360 for libdir in $dependency_libs; do
8362 -R*) func_stripname '-R' '' "$libdir"
8363 temp_xrpath=$func_stripname_result
8365 *" $temp_xrpath "*) ;;
8366 *) func_append xrpath " $temp_xrpath";;
8368 *) func_append temp_deplibs " $libdir";;
8371 dependency_libs=$temp_deplibs
8374 func_append newlib_search_path " $absdir"
8375 # Link against this library
8376 test no = "$link_static" && newdependency_libs="$abs_ladir/$laname $newdependency_libs"
8377 # ... and its dependency_libs
8379 for deplib in $dependency_libs; do
8380 newdependency_libs="$deplib $newdependency_libs"
8382 -L*) func_stripname '-L' '' "$deplib"
8383 func_resolve_sysroot "$func_stripname_result";;
8384 *) func_resolve_sysroot "$deplib" ;;
8386 if $opt_preserve_dup_deps; then
8387 case "$tmp_libs " in
8388 *" $func_resolve_sysroot_result "*)
8389 func_append specialdeplibs " $func_resolve_sysroot_result" ;;
8392 func_append tmp_libs " $func_resolve_sysroot_result"
8395 if test no != "$link_all_deplibs"; then
8396 # Add the search paths of all dependency libraries
8397 for deplib in $dependency_libs; do
8400 -L*) path=$deplib ;;
8402 func_resolve_sysroot "$deplib"
8403 deplib=$func_resolve_sysroot_result
8404 func_dirname "$deplib" "" "."
8405 dir=$func_dirname_result
8406 # We need an absolute path.
8408 [\\/]* | [A-Za-z]:[\\/]*) absdir=$dir ;;
8410 absdir=`cd "$dir" && pwd`
8411 if test -z "$absdir"; then
8412 func_warning "cannot determine absolute directory name of '$dir'"
8417 if $GREP "^installed=no" $deplib > /dev/null; then
8421 eval deplibrary_names=`$SED -n -e 's/^library_names=\(.*\)$/\1/p' $deplib`
8422 if test -n "$deplibrary_names"; then
8423 for tmp in $deplibrary_names; do
8426 if test -f "$absdir/$objdir/$depdepl"; then
8427 depdepl=$absdir/$objdir/$depdepl
8428 darwin_install_name=`$OTOOL -L $depdepl | awk '{if (NR == 2) {print $1;exit}}'`
8429 if test -z "$darwin_install_name"; then
8430 darwin_install_name=`$OTOOL64 -L $depdepl | awk '{if (NR == 2) {print $1;exit}}'`
8432 func_append compiler_flags " $wl-dylib_file $wl$darwin_install_name:$depdepl"
8433 func_append linker_flags " -dylib_file $darwin_install_name:$depdepl"
8439 path=-L$absdir/$objdir
8443 eval libdir=`$SED -n -e 's/^libdir=\(.*\)$/\1/p' $deplib`
8444 test -z "$libdir" && \
8445 func_fatal_error "'$deplib' is not a valid libtool archive"
8446 test "$absdir" != "$libdir" && \
8447 func_warning "'$deplib' seems to be moved"
8453 case " $deplibs " in
8455 *) deplibs="$path $deplibs" ;;
8458 fi # link_all_deplibs != no
8460 done # for deplib in $libs
8461 if test link = "$pass"; then
8462 if test prog = "$linkmode"; then
8463 compile_deplibs="$new_inherited_linker_flags $compile_deplibs"
8464 finalize_deplibs="$new_inherited_linker_flags $finalize_deplibs"
8466 compiler_flags="$compiler_flags "`$ECHO " $new_inherited_linker_flags" | $SED 's% \([^ $]*\).ltframework% -framework \1%g'`
8469 dependency_libs=$newdependency_libs
8470 if test dlpreopen = "$pass"; then
8471 # Link the dlpreopened libraries before other libraries
8472 for deplib in $save_deplibs; do
8473 deplibs="$deplib $deplibs"
8476 if test dlopen != "$pass"; then
8477 test conv = "$pass" || {
8478 # Make sure lib_search_path contains only unique directories.
8480 for dir in $newlib_search_path; do
8481 case "$lib_search_path " in
8483 *) func_append lib_search_path " $dir" ;;
8489 if test prog,link = "$linkmode,$pass"; then
8490 vars="compile_deplibs finalize_deplibs"
8494 for var in $vars dependency_libs; do
8495 # Add libraries to $var in reverse order
8496 eval tmp_libs=\"\$$var\"
8498 for deplib in $tmp_libs; do
8499 # FIXME: Pedantically, this is the right thing to do, so
8500 # that some nasty dependency loop isn't accidentally
8502 #new_libs="$deplib $new_libs"
8503 # Pragmatically, this seems to cause very few problems in
8506 -L*) new_libs="$deplib $new_libs" ;;
8509 # And here is the reason: when a library appears more
8510 # than once as an explicit dependence of a library, or
8511 # is implicitly linked in more than once by the
8512 # compiler, it is considered special, and multiple
8513 # occurrences thereof are not removed. Compare this
8514 # with having the same library being listed as a
8515 # dependency of multiple other libraries: in this case,
8516 # we know (pedantically, we assume) the library does not
8517 # need to be listed more than once, so we keep only the
8518 # last copy. This is not always right, but it is rare
8519 # enough that we require users that really mean to play
8520 # such unportable linking tricks to link the library
8521 # using -Wl,-lname, so that libtool does not consider it
8522 # for duplicate removal.
8523 case " $specialdeplibs " in
8524 *" $deplib "*) new_libs="$deplib $new_libs" ;;
8526 case " $new_libs " in
8528 *) new_libs="$deplib $new_libs" ;;
8536 for deplib in $new_libs; do
8539 case " $tmp_libs " in
8541 *) func_append tmp_libs " $deplib" ;;
8544 *) func_append tmp_libs " $deplib" ;;
8547 eval $var=\"$tmp_libs\"
8550 # Last step: remove runtime libs from dependency_libs
8551 # (they stay in deplibs)
8553 for i in $dependency_libs; do
8554 case " $predeps $postdeps $compiler_lib_search_path " in
8559 if test -n "$i"; then
8560 func_append tmp_libs " $i"
8563 dependency_libs=$tmp_libs
8565 if test prog = "$linkmode"; then
8568 if test prog = "$linkmode" || test lib = "$linkmode"; then
8569 dlprefiles=$newdlprefiles
8574 if test -n "$dlfiles$dlprefiles" || test no != "$dlself"; then
8575 func_warning "'-dlopen' is ignored for archives"
8580 func_warning "'-l' and '-L' are ignored for archives" ;;
8583 test -n "$rpath" && \
8584 func_warning "'-rpath' is ignored for archives"
8586 test -n "$xrpath" && \
8587 func_warning "'-R' is ignored for archives"
8589 test -n "$vinfo" && \
8590 func_warning "'-version-info/-version-number' is ignored for archives"
8592 test -n "$release" && \
8593 func_warning "'-release' is ignored for archives"
8595 test -n "$export_symbols$export_symbols_regex" && \
8596 func_warning "'-export-symbols' is ignored for archives"
8598 # Now set the variables for building old libraries.
8599 build_libtool_libs=no
8601 func_append objs "$old_deplibs"
8605 # Make sure we only generate libraries of the form 'libNAME.la'.
8608 func_stripname 'lib' '.la' "$outputname"
8609 name=$func_stripname_result
8610 eval shared_ext=\"$shrext_cmds\"
8611 eval libname=\"$libname_spec\"
8614 test no = "$module" \
8615 && func_fatal_help "libtool library '$output' must begin with 'lib'"
8617 if test no != "$need_lib_prefix"; then
8618 # Add the "lib" prefix for modules if required
8619 func_stripname '' '.la' "$outputname"
8620 name=$func_stripname_result
8621 eval shared_ext=\"$shrext_cmds\"
8622 eval libname=\"$libname_spec\"
8624 func_stripname '' '.la' "$outputname"
8625 libname=$func_stripname_result
8630 if test -n "$objs"; then
8631 if test pass_all != "$deplibs_check_method"; then
8632 func_fatal_error "cannot build libtool library '$output' from non-libtool objects on this host:$objs"
8635 $ECHO "*** Warning: Linking the shared library $output against the non-libtool"
8636 $ECHO "*** objects $objs is not portable!"
8637 func_append libobjs " $objs"
8641 test no = "$dlself" \
8642 || func_warning "'-dlopen self' is ignored for libtool libraries"
8647 && func_warning "ignoring multiple '-rpath's for a libtool library"
8652 if test -z "$rpath"; then
8653 if test yes = "$build_libtool_libs"; then
8654 # Building a libtool convenience library.
8655 # Some compilers have problems with a '.al' extension so
8656 # convenience libraries should have the same extension an
8657 # archive normally would.
8658 oldlibs="$output_objdir/$libname.$libext $oldlibs"
8659 build_libtool_libs=convenience
8663 test -n "$vinfo" && \
8664 func_warning "'-version-info/-version-number' is ignored for convenience libraries"
8666 test -n "$release" && \
8667 func_warning "'-release' is ignored for convenience libraries"
8670 # Parse the version information argument.
8671 save_ifs=$IFS; IFS=:
8672 set dummy $vinfo 0 0 0
8677 func_fatal_help "too many parameters to '-version-info'"
8679 # convert absolute version numbers to libtool ages
8680 # this retains compatibility with .la files and attempts
8681 # to make the code below a bit more comprehensible
8683 case $vinfo_number in
8689 # There are really only two kinds -- those that
8690 # use the current revision as the major version
8691 # and those that subtract age and use age as
8692 # a minor version. But, then there is irix
8693 # that has an extra 1 added just for fun
8695 case $version_type in
8696 # correct linux to gnu/linux during the next big refactor
8697 darwin|linux|osf|windows|none)
8698 func_arith $number_major + $number_minor
8699 current=$func_arith_result
8701 revision=$number_revision
8703 freebsd-aout|freebsd-elf|qnx|sunos)
8704 current=$number_major
8705 revision=$number_minor
8709 func_arith $number_major + $number_minor
8710 current=$func_arith_result
8712 revision=$number_minor
8713 lt_irix_increment=no
8724 # Check that each of the things are valid numbers.
8726 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]) ;;
8728 func_error "CURRENT '$current' must be a nonnegative integer"
8729 func_fatal_error "'$vinfo' is not valid version information"
8734 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]) ;;
8736 func_error "REVISION '$revision' must be a nonnegative integer"
8737 func_fatal_error "'$vinfo' is not valid version information"
8742 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]) ;;
8744 func_error "AGE '$age' must be a nonnegative integer"
8745 func_fatal_error "'$vinfo' is not valid version information"
8749 if test "$age" -gt "$current"; then
8750 func_error "AGE '$age' is greater than the current interface number '$current'"
8751 func_fatal_error "'$vinfo' is not valid version information"
8754 # Calculate the version variables.
8758 case $version_type in
8762 # Like Linux, but with the current version available in
8763 # verstring for coding it into the library header
8764 func_arith $current - $age
8765 major=.$func_arith_result
8766 versuffix=$major.$age.$revision
8767 # Darwin ld doesn't like 0 for these options...
8768 func_arith $current + 1
8769 minor_current=$func_arith_result
8770 xlcverstring="$wl-compatibility_version $wl$minor_current $wl-current_version $wl$minor_current.$revision"
8771 verstring="-compatibility_version $minor_current -current_version $minor_current.$revision"
8772 # On Darwin other compilers
8775 verstring="$wl-compatibility_version $wl$minor_current $wl-current_version $wl$minor_current.$revision"
8778 verstring="-compatibility_version $minor_current -current_version $minor_current.$revision"
8785 versuffix=.$current.$revision
8794 if test no = "$lt_irix_increment"; then
8795 func_arith $current - $age
8797 func_arith $current - $age + 1
8799 major=$func_arith_result
8801 case $version_type in
8802 nonstopux) verstring_prefix=nonstopux ;;
8803 *) verstring_prefix=sgi ;;
8805 verstring=$verstring_prefix$major.$revision
8807 # Add in all the interfaces that we are compatible with.
8809 while test 0 -ne "$loop"; do
8810 func_arith $revision - $loop
8811 iface=$func_arith_result
8812 func_arith $loop - 1
8813 loop=$func_arith_result
8814 verstring=$verstring_prefix$major.$iface:$verstring
8817 # Before this point, $major must not contain '.'.
8819 versuffix=$major.$revision
8822 linux) # correct to gnu/linux during the next big refactor
8823 func_arith $current - $age
8824 major=.$func_arith_result
8825 versuffix=$major.$age.$revision
8829 func_arith $current - $age
8830 major=.$func_arith_result
8831 versuffix=.$current.$age.$revision
8832 verstring=$current.$age.$revision
8834 # Add in all the interfaces that we are compatible with.
8836 while test 0 -ne "$loop"; do
8837 func_arith $current - $loop
8838 iface=$func_arith_result
8839 func_arith $loop - 1
8840 loop=$func_arith_result
8841 verstring=$verstring:$iface.0
8844 # Make executables depend on our current version.
8845 func_append verstring ":$current.0"
8855 versuffix=.$current.$revision
8859 # Use '-' rather than '.', since we only want one
8860 # extension on DOS 8.3 file systems.
8861 func_arith $current - $age
8862 major=$func_arith_result
8867 func_fatal_configuration "unknown library version type '$version_type'"
8871 # Clear the version info if we defaulted, and they specified a release.
8872 if test -z "$vinfo" && test -n "$release"; then
8874 case $version_type in
8876 # we can't check for "0.0" in archive_cmds due to quoting
8877 # problems, so we reset it completely
8884 if test no = "$need_version"; then
8891 # Remove version info from name if versioning should be avoided
8892 if test yes,no = "$avoid_version,$need_version"; then
8898 # Check to see if the archive will have undefined symbols.
8899 if test yes = "$allow_undefined"; then
8900 if test unsupported = "$allow_undefined_flag"; then
8901 if test yes = "$build_old_libs"; then
8902 func_warning "undefined symbols not allowed in $host shared libraries; building static only"
8903 build_libtool_libs=no
8905 func_fatal_error "can't build $host shared library unless -no-undefined is specified"
8909 # Don't allow undefined symbols.
8910 allow_undefined_flag=$no_undefined_flag
8915 func_generate_dlsyms "$libname" "$libname" :
8916 func_append libobjs " $symfileobj"
8917 test " " = "$libobjs" && libobjs=
8919 if test relink != "$opt_mode"; then
8920 # Remove our outputs, but don't remove object files since they
8921 # may have been created when compiling PIC objects.
8923 tempremovelist=`$ECHO "$output_objdir/*"`
8924 for p in $tempremovelist; do
8928 $output_objdir/$outputname | $output_objdir/$libname.* | $output_objdir/$libname$release.*)
8929 if test -n "$precious_files_regex"; then
8930 if $ECHO "$p" | $EGREP -e "$precious_files_regex" >/dev/null 2>&1
8935 func_append removelist " $p"
8940 test -n "$removelist" && \
8941 func_show_eval "${RM}r \$removelist"
8944 # Now set the variables for building old libraries.
8945 if test yes = "$build_old_libs" && test convenience != "$build_libtool_libs"; then
8946 func_append oldlibs " $output_objdir/$libname.$libext"
8948 # Transform .lo files to .o files.
8949 oldobjs="$objs "`$ECHO "$libobjs" | $SP2NL | $SED "/\.$libext$/d; $lo2o" | $NL2SP`
8952 # Eliminate all temporary directories.
8953 #for path in $notinst_path; do
8954 # lib_search_path=`$ECHO "$lib_search_path " | $SED "s% $path % %g"`
8955 # deplibs=`$ECHO "$deplibs " | $SED "s% -L$path % %g"`
8956 # dependency_libs=`$ECHO "$dependency_libs " | $SED "s% -L$path % %g"`
8959 if test -n "$xrpath"; then
8960 # If the user specified any rpath flags, then add them.
8962 for libdir in $xrpath; do
8963 func_replace_sysroot "$libdir"
8964 func_append temp_xrpath " -R$func_replace_sysroot_result"
8965 case "$finalize_rpath " in
8967 *) func_append finalize_rpath " $libdir" ;;
8970 if test yes != "$hardcode_into_libs" || test yes = "$build_old_libs"; then
8971 dependency_libs="$temp_xrpath $dependency_libs"
8975 # Make sure dlfiles contains only unique files that won't be dlpreopened
8976 old_dlfiles=$dlfiles
8978 for lib in $old_dlfiles; do
8979 case " $dlprefiles $dlfiles " in
8981 *) func_append dlfiles " $lib" ;;
8985 # Make sure dlprefiles contains only unique files
8986 old_dlprefiles=$dlprefiles
8988 for lib in $old_dlprefiles; do
8989 case "$dlprefiles " in
8991 *) func_append dlprefiles " $lib" ;;
8995 if test yes = "$build_libtool_libs"; then
8996 if test -n "$rpath"; then
8998 *-*-cygwin* | *-*-mingw* | *-*-pw32* | *-*-os2* | *-*-beos* | *-cegcc* | *-*-haiku*)
8999 # these systems don't actually have a c library (as such)!
9001 *-*-rhapsody* | *-*-darwin1.[012])
9002 # Rhapsody C library is in the System framework
9003 func_append deplibs " System.ltframework"
9006 # Don't link with libc until the a.out ld.so is fixed.
9008 *-*-openbsd* | *-*-freebsd* | *-*-dragonfly*)
9009 # Do not include libc due to us having libc/libc_r.
9011 *-*-sco3.2v5* | *-*-sco5v6*)
9012 # Causes problems with __ctype
9014 *-*-sysv4.2uw2* | *-*-sysv5* | *-*-unixware* | *-*-OpenUNIX*)
9015 # Compiler inserts libc in the correct place for threads to work
9018 # Add libc to deplibs on all other systems if necessary.
9019 if test yes = "$build_libtool_need_lc"; then
9020 func_append deplibs " -lc"
9026 # Transform deplibs into only deplibs that can be linked in shared.
9028 libname_save=$libname
9029 release_save=$release
9030 versuffix_save=$versuffix
9032 # I'm not sure if I'm treating the release correctly. I think
9033 # release should show up in the -l (ie -lgmp5) so we don't want to
9034 # add it in twice. Is that correct?
9040 case $deplibs_check_method in
9042 # Don't check for shared/static. Everything works.
9043 # This might be a little naive. We might want to check
9044 # whether the library exists or not. But this is on
9045 # osf3 & osf4 and I'm not really sure... Just
9046 # implementing what was already the behavior.
9050 # This code stresses the "libraries are programs" paradigm to its
9051 # limits. Maybe even breaks it. We compile a program, linking it
9052 # against the deplibs as a proxy for the library. Then we can check
9053 # whether they linked in statically or dynamically with ldd.
9054 $opt_dry_run || $RM conftest.c
9055 cat > conftest.c <<EOF
9056 int main() { return 0; }
9058 $opt_dry_run || $RM conftest
9059 if $LTCC $LTCFLAGS -o conftest conftest.c $deplibs; then
9060 ldd_output=`ldd conftest`
9061 for i in $deplibs; do
9064 func_stripname -l '' "$i"
9065 name=$func_stripname_result
9066 if test yes = "$allow_libtool_libs_with_static_runtimes"; then
9067 case " $predeps $postdeps " in
9069 func_append newdeplibs " $i"
9074 if test -n "$i"; then
9075 libname=`eval "\\$ECHO \"$libname_spec\""`
9076 deplib_matches=`eval "\\$ECHO \"$library_names_spec\""`
9077 set dummy $deplib_matches; shift
9079 if test `expr "$ldd_output" : ".*$deplib_match"` -ne 0; then
9080 func_append newdeplibs " $i"
9084 $ECHO "*** Warning: dynamic linker does not accept needed library $i."
9085 echo "*** I have the capability to make that library automatically link in when"
9086 echo "*** you link to this library. But I can only do this if you have a"
9087 echo "*** shared version of the library, which I believe you do not have"
9088 echo "*** because a test_compile did reveal that the linker did not use it for"
9089 echo "*** its dynamic dependency list that programs get resolved with at runtime."
9094 func_append newdeplibs " $i"
9099 # Error occurred in the first compile. Let's try to salvage
9100 # the situation: Compile a separate program for each library.
9101 for i in $deplibs; do
9104 func_stripname -l '' "$i"
9105 name=$func_stripname_result
9106 $opt_dry_run || $RM conftest
9107 if $LTCC $LTCFLAGS -o conftest conftest.c $i; then
9108 ldd_output=`ldd conftest`
9109 if test yes = "$allow_libtool_libs_with_static_runtimes"; then
9110 case " $predeps $postdeps " in
9112 func_append newdeplibs " $i"
9117 if test -n "$i"; then
9118 libname=`eval "\\$ECHO \"$libname_spec\""`
9119 deplib_matches=`eval "\\$ECHO \"$library_names_spec\""`
9120 set dummy $deplib_matches; shift
9122 if test `expr "$ldd_output" : ".*$deplib_match"` -ne 0; then
9123 func_append newdeplibs " $i"
9127 $ECHO "*** Warning: dynamic linker does not accept needed library $i."
9128 echo "*** I have the capability to make that library automatically link in when"
9129 echo "*** you link to this library. But I can only do this if you have a"
9130 echo "*** shared version of the library, which you do not appear to have"
9131 echo "*** because a test_compile did reveal that the linker did not use this one"
9132 echo "*** as a dynamic dependency that programs can get resolved with at runtime."
9138 $ECHO "*** Warning! Library $i is needed by this library but I was not able to"
9139 echo "*** make it link in! You will probably need to install it or some"
9140 echo "*** library that it depends on before this library will be fully"
9141 echo "*** functional. Installing it before continuing would be even better."
9145 func_append newdeplibs " $i"
9152 set dummy $deplibs_check_method; shift
9153 file_magic_regex=`expr "$deplibs_check_method" : "$1 \(.*\)"`
9154 for a_deplib in $deplibs; do
9157 func_stripname -l '' "$a_deplib"
9158 name=$func_stripname_result
9159 if test yes = "$allow_libtool_libs_with_static_runtimes"; then
9160 case " $predeps $postdeps " in
9162 func_append newdeplibs " $a_deplib"
9167 if test -n "$a_deplib"; then
9168 libname=`eval "\\$ECHO \"$libname_spec\""`
9169 if test -n "$file_magic_glob"; then
9170 libnameglob=`func_echo_all "$libname" | $SED -e $file_magic_glob`
9172 libnameglob=$libname
9174 test yes = "$want_nocaseglob" && nocaseglob=`shopt -p nocaseglob`
9175 for i in $lib_search_path $sys_lib_search_path $shlib_search_path; do
9176 if test yes = "$want_nocaseglob"; then
9178 potential_libs=`ls $i/$libnameglob[.-]* 2>/dev/null`
9181 potential_libs=`ls $i/$libnameglob[.-]* 2>/dev/null`
9183 for potent_lib in $potential_libs; do
9184 # Follow soft links.
9185 if ls -lLd "$potent_lib" 2>/dev/null |
9186 $GREP " -> " >/dev/null; then
9189 # The statement above tries to avoid entering an
9190 # endless loop below, in case of cyclic links.
9191 # We might still enter an endless loop, since a link
9192 # loop can be closed while we follow links,
9195 while test -h "$potlib" 2>/dev/null; do
9196 potliblink=`ls -ld $potlib | $SED 's/.* -> //'`
9198 [\\/]* | [A-Za-z]:[\\/]*) potlib=$potliblink;;
9199 *) potlib=`$ECHO "$potlib" | $SED 's|[^/]*$||'`"$potliblink";;
9202 if eval $file_magic_cmd \"\$potlib\" 2>/dev/null |
9204 $EGREP "$file_magic_regex" > /dev/null; then
9205 func_append newdeplibs " $a_deplib"
9212 if test -n "$a_deplib"; then
9215 $ECHO "*** Warning: linker path does not have real file for library $a_deplib."
9216 echo "*** I have the capability to make that library automatically link in when"
9217 echo "*** you link to this library. But I can only do this if you have a"
9218 echo "*** shared version of the library, which you do not appear to have"
9219 echo "*** because I did check the linker path looking for a file starting"
9220 if test -z "$potlib"; then
9221 $ECHO "*** with $libname but no candidates were found. (...for file magic test)"
9223 $ECHO "*** with $libname and none of the candidates passed a file format test"
9224 $ECHO "*** using a file magic. Last file checked: $potlib"
9229 # Add a -L argument.
9230 func_append newdeplibs " $a_deplib"
9233 done # Gone through all deplibs.
9236 set dummy $deplibs_check_method; shift
9237 match_pattern_regex=`expr "$deplibs_check_method" : "$1 \(.*\)"`
9238 for a_deplib in $deplibs; do
9241 func_stripname -l '' "$a_deplib"
9242 name=$func_stripname_result
9243 if test yes = "$allow_libtool_libs_with_static_runtimes"; then
9244 case " $predeps $postdeps " in
9246 func_append newdeplibs " $a_deplib"
9251 if test -n "$a_deplib"; then
9252 libname=`eval "\\$ECHO \"$libname_spec\""`
9253 for i in $lib_search_path $sys_lib_search_path $shlib_search_path; do
9254 potential_libs=`ls $i/$libname[.-]* 2>/dev/null`
9255 for potent_lib in $potential_libs; do
9256 potlib=$potent_lib # see symlink-check above in file_magic test
9257 if eval "\$ECHO \"$potent_lib\"" 2>/dev/null | $SED 10q | \
9258 $EGREP "$match_pattern_regex" > /dev/null; then
9259 func_append newdeplibs " $a_deplib"
9266 if test -n "$a_deplib"; then
9269 $ECHO "*** Warning: linker path does not have real file for library $a_deplib."
9270 echo "*** I have the capability to make that library automatically link in when"
9271 echo "*** you link to this library. But I can only do this if you have a"
9272 echo "*** shared version of the library, which you do not appear to have"
9273 echo "*** because I did check the linker path looking for a file starting"
9274 if test -z "$potlib"; then
9275 $ECHO "*** with $libname but no candidates were found. (...for regex pattern test)"
9277 $ECHO "*** with $libname and none of the candidates passed a file format test"
9278 $ECHO "*** using a regex pattern. Last file checked: $potlib"
9283 # Add a -L argument.
9284 func_append newdeplibs " $a_deplib"
9287 done # Gone through all deplibs.
9291 tmp_deplibs=`$ECHO " $deplibs" | $SED 's/ -lc$//; s/ -[LR][^ ]*//g'`
9292 if test yes = "$allow_libtool_libs_with_static_runtimes"; then
9293 for i in $predeps $postdeps; do
9294 # can't use Xsed below, because $i might contain '/'
9295 tmp_deplibs=`$ECHO " $tmp_deplibs" | $SED "s|$i||"`
9298 case $tmp_deplibs in
9301 if test none = "$deplibs_check_method"; then
9302 echo "*** Warning: inter-library dependencies are not supported in this platform."
9304 echo "*** Warning: inter-library dependencies are not known to be supported."
9306 echo "*** All declared inter-library dependencies are being dropped."
9312 versuffix=$versuffix_save
9314 release=$release_save
9315 libname=$libname_save
9319 *-*-rhapsody* | *-*-darwin1.[012])
9320 # On Rhapsody replace the C library with the System framework
9321 newdeplibs=`$ECHO " $newdeplibs" | $SED 's/ -lc / System.ltframework /'`
9325 if test yes = "$droppeddeps"; then
9326 if test yes = "$module"; then
9328 echo "*** Warning: libtool could not satisfy all declared inter-library"
9329 $ECHO "*** dependencies of module $libname. Therefore, libtool will create"
9330 echo "*** a static module, that should work as long as the dlopening"
9331 echo "*** application is linked with the -dlopen flag."
9332 if test -z "$global_symbol_pipe"; then
9334 echo "*** However, this would only work if libtool was able to extract symbol"
9335 echo "*** lists from a program, using 'nm' or equivalent, but libtool could"
9336 echo "*** not find such a program. So, this module is probably useless."
9337 echo "*** 'nm' from GNU binutils and a full rebuild may help."
9339 if test no = "$build_old_libs"; then
9340 oldlibs=$output_objdir/$libname.$libext
9341 build_libtool_libs=module
9344 build_libtool_libs=no
9347 echo "*** The inter-library dependencies that have been dropped here will be"
9348 echo "*** automatically added whenever a program is linked with this library"
9349 echo "*** or is declared to -dlopen it."
9351 if test no = "$allow_undefined"; then
9353 echo "*** Since this library must not contain undefined symbols,"
9354 echo "*** because either the platform does not support them or"
9355 echo "*** it was explicitly requested with -no-undefined,"
9356 echo "*** libtool will only create a static version of it."
9357 if test no = "$build_old_libs"; then
9358 oldlibs=$output_objdir/$libname.$libext
9359 build_libtool_libs=module
9362 build_libtool_libs=no
9367 # Done checking deplibs!
9370 # Time to change all our "foo.ltframework" stuff back to "-framework foo"
9373 newdeplibs=`$ECHO " $newdeplibs" | $SED 's% \([^ $]*\).ltframework% -framework \1%g'`
9374 new_inherited_linker_flags=`$ECHO " $new_inherited_linker_flags" | $SED 's% \([^ $]*\).ltframework% -framework \1%g'`
9375 deplibs=`$ECHO " $deplibs" | $SED 's% \([^ $]*\).ltframework% -framework \1%g'`
9379 # move library search paths that coincide with paths to not yet
9380 # installed libraries to the beginning of the library search list
9382 for path in $notinst_path; do
9383 case " $new_libs " in
9384 *" -L$path/$objdir "*) ;;
9386 case " $deplibs " in
9387 *" -L$path/$objdir "*)
9388 func_append new_libs " -L$path/$objdir" ;;
9393 for deplib in $deplibs; do
9396 case " $new_libs " in
9398 *) func_append new_libs " $deplib" ;;
9401 *) func_append new_libs " $deplib" ;;
9406 # All the library-specific variables (install_libdir is set above).
9411 # Test again, we may have decided not to build it any more
9412 if test yes = "$build_libtool_libs"; then
9413 # Remove $wl instances when linking with ld.
9414 # FIXME: should test the right _cmds variable.
9415 case $archive_cmds in
9418 if test yes = "$hardcode_into_libs"; then
9419 # Hardcode the library paths
9422 rpath=$finalize_rpath
9423 test relink = "$opt_mode" || rpath=$compile_rpath$rpath
9424 for libdir in $rpath; do
9425 if test -n "$hardcode_libdir_flag_spec"; then
9426 if test -n "$hardcode_libdir_separator"; then
9427 func_replace_sysroot "$libdir"
9428 libdir=$func_replace_sysroot_result
9429 if test -z "$hardcode_libdirs"; then
9430 hardcode_libdirs=$libdir
9432 # Just accumulate the unique libdirs.
9433 case $hardcode_libdir_separator$hardcode_libdirs$hardcode_libdir_separator in
9434 *"$hardcode_libdir_separator$libdir$hardcode_libdir_separator"*)
9437 func_append hardcode_libdirs "$hardcode_libdir_separator$libdir"
9442 eval flag=\"$hardcode_libdir_flag_spec\"
9443 func_append dep_rpath " $flag"
9445 elif test -n "$runpath_var"; then
9446 case "$perm_rpath " in
9448 *) func_append perm_rpath " $libdir" ;;
9452 # Substitute the hardcoded libdirs into the rpath.
9453 if test -n "$hardcode_libdir_separator" &&
9454 test -n "$hardcode_libdirs"; then
9455 libdir=$hardcode_libdirs
9456 eval "dep_rpath=\"$hardcode_libdir_flag_spec\""
9458 if test -n "$runpath_var" && test -n "$perm_rpath"; then
9459 # We should set the runpath_var.
9461 for dir in $perm_rpath; do
9462 func_append rpath "$dir:"
9464 eval "$runpath_var='$rpath\$$runpath_var'; export $runpath_var"
9466 test -n "$dep_rpath" && deplibs="$dep_rpath $deplibs"
9469 shlibpath=$finalize_shlibpath
9470 test relink = "$opt_mode" || shlibpath=$compile_shlibpath$shlibpath
9471 if test -n "$shlibpath"; then
9472 eval "$shlibpath_var='$shlibpath\$$shlibpath_var'; export $shlibpath_var"
9475 # Get the real and link names of the library.
9476 eval shared_ext=\"$shrext_cmds\"
9477 eval library_names=\"$library_names_spec\"
9478 set dummy $library_names
9483 if test -n "$soname_spec"; then
9484 eval soname=\"$soname_spec\"
9488 if test -z "$dlname"; then
9492 lib=$output_objdir/$realname
9496 func_append linknames " $link"
9499 # Use standard objects if they are pic
9500 test -z "$pic_flag" && libobjs=`$ECHO "$libobjs" | $SP2NL | $SED "$lo2o" | $NL2SP`
9501 test "X$libobjs" = "X " && libobjs=
9504 if test -n "$export_symbols" && test -n "$include_expsyms"; then
9505 $opt_dry_run || cp "$export_symbols" "$output_objdir/$libname.uexp"
9506 export_symbols=$output_objdir/$libname.uexp
9507 func_append delfiles " $export_symbols"
9510 orig_export_symbols=
9512 cygwin* | mingw* | cegcc*)
9513 if test -n "$export_symbols" && test -z "$export_symbols_regex"; then
9514 # exporting using user supplied symfile
9515 func_dll_def_p "$export_symbols" || {
9516 # and it's NOT already a .def file. Must figure out
9517 # which of the given symbols are data symbols and tag
9518 # them as such. So, trigger use of export_symbols_cmds.
9519 # export_symbols gets reassigned inside the "prepare
9520 # the list of exported symbols" if statement, so the
9521 # include_expsyms logic still works.
9522 orig_export_symbols=$export_symbols
9524 always_export_symbols=yes
9530 # Prepare the list of exported symbols
9531 if test -z "$export_symbols"; then
9532 if test yes = "$always_export_symbols" || test -n "$export_symbols_regex"; then
9533 func_verbose "generating symbol list for '$libname.la'"
9534 export_symbols=$output_objdir/$libname.exp
9535 $opt_dry_run || $RM $export_symbols
9536 cmds=$export_symbols_cmds
9537 save_ifs=$IFS; IFS='~'
9538 for cmd1 in $cmds; do
9540 # Take the normal branch if the nm_file_list_spec branch
9541 # doesn't work or if tool conversion is not needed.
9542 case $nm_file_list_spec~$to_tool_file_cmd in
9543 *~func_convert_file_noop | *~func_convert_file_msys_to_w32 | ~*)
9544 try_normal_branch=yes
9547 len=$func_len_result
9550 try_normal_branch=no
9553 if test yes = "$try_normal_branch" \
9554 && { test "$len" -lt "$max_cmd_len" \
9555 || test "$max_cmd_len" -le -1; }
9557 func_show_eval "$cmd" 'exit $?'
9558 skipped_export=false
9559 elif test -n "$nm_file_list_spec"; then
9560 func_basename "$output"
9561 output_la=$func_basename_result
9562 save_libobjs=$libobjs
9564 output=$output_objdir/$output_la.nm
9565 func_to_tool_file "$output"
9566 libobjs=$nm_file_list_spec$func_to_tool_file_result
9567 func_append delfiles " $output"
9568 func_verbose "creating $NM input file list: $output"
9569 for obj in $save_libobjs; do
9570 func_to_tool_file "$obj"
9571 $ECHO "$func_to_tool_file_result"
9574 func_show_eval "$cmd" 'exit $?'
9576 libobjs=$save_libobjs
9577 skipped_export=false
9579 # The command line is too long to execute in one step.
9580 func_verbose "using reloadable object file for export list..."
9582 # Break out early, otherwise skipped_export may be
9583 # set to false by a later but shorter cmd.
9588 if test -n "$export_symbols_regex" && test : != "$skipped_export"; then
9589 func_show_eval '$EGREP -e "$export_symbols_regex" "$export_symbols" > "${export_symbols}T"'
9590 func_show_eval '$MV "${export_symbols}T" "$export_symbols"'
9595 if test -n "$export_symbols" && test -n "$include_expsyms"; then
9596 tmp_export_symbols=$export_symbols
9597 test -n "$orig_export_symbols" && tmp_export_symbols=$orig_export_symbols
9598 $opt_dry_run || eval '$ECHO "$include_expsyms" | $SP2NL >> "$tmp_export_symbols"'
9601 if test : != "$skipped_export" && test -n "$orig_export_symbols"; then
9602 # The given exports_symbols file has to be filtered, so filter it.
9603 func_verbose "filter symbol list for '$libname.la' to tag DATA exports"
9604 # FIXME: $output_objdir/$libname.filter potentially contains lots of
9605 # 's' commands, which not all seds can handle. GNU sed should be fine
9606 # though. Also, the filter scales superlinearly with the number of
9607 # global variables. join(1) would be nice here, but unfortunately
9608 # isn't a blessed tool.
9609 $opt_dry_run || $SED -e '/[ ,]DATA/!d;s,\(.*\)\([ \,].*\),s|^\1$|\1\2|,' < $export_symbols > $output_objdir/$libname.filter
9610 func_append delfiles " $export_symbols $output_objdir/$libname.filter"
9611 export_symbols=$output_objdir/$libname.def
9612 $opt_dry_run || $SED -f $output_objdir/$libname.filter < $orig_export_symbols > $export_symbols
9616 for test_deplib in $deplibs; do
9617 case " $convenience " in
9618 *" $test_deplib "*) ;;
9620 func_append tmp_deplibs " $test_deplib"
9624 deplibs=$tmp_deplibs
9626 if test -n "$convenience"; then
9627 if test -n "$whole_archive_flag_spec" &&
9628 test yes = "$compiler_needs_object" &&
9629 test -z "$libobjs"; then
9630 # extract the archives, so we have objects to list.
9631 # TODO: could optimize this to just extract one archive.
9632 whole_archive_flag_spec=
9634 if test -n "$whole_archive_flag_spec"; then
9635 save_libobjs=$libobjs
9636 eval libobjs=\"\$libobjs $whole_archive_flag_spec\"
9637 test "X$libobjs" = "X " && libobjs=
9639 gentop=$output_objdir/${outputname}x
9640 func_append generated " $gentop"
9642 func_extract_archives $gentop $convenience
9643 func_append libobjs " $func_extract_archives_result"
9644 test "X$libobjs" = "X " && libobjs=
9648 if test yes = "$thread_safe" && test -n "$thread_safe_flag_spec"; then
9649 eval flag=\"$thread_safe_flag_spec\"
9650 func_append linker_flags " $flag"
9653 # Make a backup of the uninstalled library when relinking
9654 if test relink = "$opt_mode"; then
9655 $opt_dry_run || eval '(cd $output_objdir && $RM ${realname}U && $MV $realname ${realname}U)' || exit $?
9658 # Do each of the archive commands.
9659 if test yes = "$module" && test -n "$module_cmds"; then
9660 if test -n "$export_symbols" && test -n "$module_expsym_cmds"; then
9661 eval test_cmds=\"$module_expsym_cmds\"
9662 cmds=$module_expsym_cmds
9664 eval test_cmds=\"$module_cmds\"
9668 if test -n "$export_symbols" && test -n "$archive_expsym_cmds"; then
9669 eval test_cmds=\"$archive_expsym_cmds\"
9670 cmds=$archive_expsym_cmds
9672 eval test_cmds=\"$archive_cmds\"
9677 if test : != "$skipped_export" &&
9678 func_len " $test_cmds" &&
9679 len=$func_len_result &&
9680 test "$len" -lt "$max_cmd_len" || test "$max_cmd_len" -le -1; then
9683 # The command line is too long to link in one step, link piecewise
9684 # or, if using GNU ld and skipped_export is not :, use a linker
9687 # Save the value of $output and $libobjs because we want to
9688 # use them later. If we have whole_archive_flag_spec, we
9689 # want to use save_libobjs as it was before
9690 # whole_archive_flag_spec was expanded, because we can't
9691 # assume the linker understands whole_archive_flag_spec.
9692 # This may have to be revisited, in case too many
9693 # convenience libraries get linked in and end up exceeding
9695 if test -z "$convenience" || test -z "$whole_archive_flag_spec"; then
9696 save_libobjs=$libobjs
9699 func_basename "$output"
9700 output_la=$func_basename_result
9702 # Clear the reloadable object creation command queue and
9703 # initialize k to one.
9710 if test -n "$save_libobjs" && test : != "$skipped_export" && test yes = "$with_gnu_ld"; then
9711 output=$output_objdir/$output_la.lnkscript
9712 func_verbose "creating GNU ld script: $output"
9713 echo 'INPUT (' > $output
9714 for obj in $save_libobjs
9716 func_to_tool_file "$obj"
9717 $ECHO "$func_to_tool_file_result" >> $output
9720 func_append delfiles " $output"
9721 func_to_tool_file "$output"
9722 output=$func_to_tool_file_result
9723 elif test -n "$save_libobjs" && test : != "$skipped_export" && test -n "$file_list_spec"; then
9724 output=$output_objdir/$output_la.lnk
9725 func_verbose "creating linker input file list: $output"
9730 if test yes = "$compiler_needs_object"; then
9736 func_to_tool_file "$obj"
9737 $ECHO "$func_to_tool_file_result" >> $output
9739 func_append delfiles " $output"
9740 func_to_tool_file "$output"
9741 output=$firstobj\"$file_list_spec$func_to_tool_file_result\"
9743 if test -n "$save_libobjs"; then
9744 func_verbose "creating reloadable object files..."
9745 output=$output_objdir/$output_la-$k.$objext
9746 eval test_cmds=\"$reload_cmds\"
9747 func_len " $test_cmds"
9748 len0=$func_len_result
9751 # Loop over the list of objects to be linked.
9752 for obj in $save_libobjs
9755 func_arith $len + $func_len_result
9756 len=$func_arith_result
9757 if test -z "$objlist" ||
9758 test "$len" -lt "$max_cmd_len"; then
9759 func_append objlist " $obj"
9761 # The command $test_cmds is almost too long, add a
9762 # command to the queue.
9763 if test 1 -eq "$k"; then
9764 # The first file doesn't have a previous command to add.
9765 reload_objs=$objlist
9766 eval concat_cmds=\"$reload_cmds\"
9768 # All subsequent reloadable object files will link in
9769 # the last one created.
9770 reload_objs="$objlist $last_robj"
9771 eval concat_cmds=\"\$concat_cmds~$reload_cmds~\$RM $last_robj\"
9773 last_robj=$output_objdir/$output_la-$k.$objext
9775 k=$func_arith_result
9776 output=$output_objdir/$output_la-$k.$objext
9778 func_len " $last_robj"
9779 func_arith $len0 + $func_len_result
9780 len=$func_arith_result
9783 # Handle the remaining objects by creating one last
9784 # reloadable object file. All subsequent reloadable object
9785 # files will link in the last one created.
9786 test -z "$concat_cmds" || concat_cmds=$concat_cmds~
9787 reload_objs="$objlist $last_robj"
9788 eval concat_cmds=\"\$concat_cmds$reload_cmds\"
9789 if test -n "$last_robj"; then
9790 eval concat_cmds=\"\$concat_cmds~\$RM $last_robj\"
9792 func_append delfiles " $output"
9798 ${skipped_export-false} && {
9799 func_verbose "generating symbol list for '$libname.la'"
9800 export_symbols=$output_objdir/$libname.exp
9801 $opt_dry_run || $RM $export_symbols
9803 # Append the command to create the export file.
9804 test -z "$concat_cmds" || concat_cmds=$concat_cmds~
9805 eval concat_cmds=\"\$concat_cmds$export_symbols_cmds\"
9806 if test -n "$last_robj"; then
9807 eval concat_cmds=\"\$concat_cmds~\$RM $last_robj\"
9811 test -n "$save_libobjs" &&
9812 func_verbose "creating a temporary reloadable object file: $output"
9814 # Loop through the commands generated above and execute them.
9815 save_ifs=$IFS; IFS='~'
9816 for cmd in $concat_cmds; do
9819 func_quote_for_expand "$cmd"
9820 eval "func_echo $func_quote_for_expand_result"
9822 $opt_dry_run || eval "$cmd" || {
9825 # Restore the uninstalled library and exit
9826 if test relink = "$opt_mode"; then
9827 ( cd "$output_objdir" && \
9828 $RM "${realname}T" && \
9829 $MV "${realname}U" "$realname" )
9837 if test -n "$export_symbols_regex" && ${skipped_export-false}; then
9838 func_show_eval '$EGREP -e "$export_symbols_regex" "$export_symbols" > "${export_symbols}T"'
9839 func_show_eval '$MV "${export_symbols}T" "$export_symbols"'
9843 ${skipped_export-false} && {
9844 if test -n "$export_symbols" && test -n "$include_expsyms"; then
9845 tmp_export_symbols=$export_symbols
9846 test -n "$orig_export_symbols" && tmp_export_symbols=$orig_export_symbols
9847 $opt_dry_run || eval '$ECHO "$include_expsyms" | $SP2NL >> "$tmp_export_symbols"'
9850 if test -n "$orig_export_symbols"; then
9851 # The given exports_symbols file has to be filtered, so filter it.
9852 func_verbose "filter symbol list for '$libname.la' to tag DATA exports"
9853 # FIXME: $output_objdir/$libname.filter potentially contains lots of
9854 # 's' commands, which not all seds can handle. GNU sed should be fine
9855 # though. Also, the filter scales superlinearly with the number of
9856 # global variables. join(1) would be nice here, but unfortunately
9857 # isn't a blessed tool.
9858 $opt_dry_run || $SED -e '/[ ,]DATA/!d;s,\(.*\)\([ \,].*\),s|^\1$|\1\2|,' < $export_symbols > $output_objdir/$libname.filter
9859 func_append delfiles " $export_symbols $output_objdir/$libname.filter"
9860 export_symbols=$output_objdir/$libname.def
9861 $opt_dry_run || $SED -f $output_objdir/$libname.filter < $orig_export_symbols > $export_symbols
9866 # Restore the value of output.
9869 if test -n "$convenience" && test -n "$whole_archive_flag_spec"; then
9870 eval libobjs=\"\$libobjs $whole_archive_flag_spec\"
9871 test "X$libobjs" = "X " && libobjs=
9873 # Expand the library linking commands again to reset the
9874 # value of $libobjs for piecewise linking.
9876 # Do each of the archive commands.
9877 if test yes = "$module" && test -n "$module_cmds"; then
9878 if test -n "$export_symbols" && test -n "$module_expsym_cmds"; then
9879 cmds=$module_expsym_cmds
9884 if test -n "$export_symbols" && test -n "$archive_expsym_cmds"; then
9885 cmds=$archive_expsym_cmds
9892 if test -n "$delfiles"; then
9893 # Append the command to remove temporary files to $cmds.
9894 eval cmds=\"\$cmds~\$RM $delfiles\"
9897 # Add any objects from preloaded convenience libraries
9898 if test -n "$dlprefiles"; then
9899 gentop=$output_objdir/${outputname}x
9900 func_append generated " $gentop"
9902 func_extract_archives $gentop $dlprefiles
9903 func_append libobjs " $func_extract_archives_result"
9904 test "X$libobjs" = "X " && libobjs=
9907 save_ifs=$IFS; IFS='~'
9908 for cmd in $cmds; do
9913 func_quote_for_expand "$cmd"
9914 eval "func_echo $func_quote_for_expand_result"
9916 $opt_dry_run || eval "$cmd" || {
9919 # Restore the uninstalled library and exit
9920 if test relink = "$opt_mode"; then
9921 ( cd "$output_objdir" && \
9922 $RM "${realname}T" && \
9923 $MV "${realname}U" "$realname" )
9931 # Restore the uninstalled library and exit
9932 if test relink = "$opt_mode"; then
9933 $opt_dry_run || eval '(cd $output_objdir && $RM ${realname}T && $MV $realname ${realname}T && $MV ${realname}U $realname)' || exit $?
9935 if test -n "$convenience"; then
9936 if test -z "$whole_archive_flag_spec"; then
9937 func_show_eval '${RM}r "$gentop"'
9944 # Create links to the real library.
9945 for linkname in $linknames; do
9946 if test "$realname" != "$linkname"; then
9947 func_show_eval '(cd "$output_objdir" && $RM "$linkname" && $LN_S "$realname" "$linkname")' 'exit $?'
9951 # If -module or -export-dynamic was specified, set the dlname.
9952 if test yes = "$module" || test yes = "$export_dynamic"; then
9953 # On all known operating systems, these are identical.
9960 if test -n "$dlfiles$dlprefiles" || test no != "$dlself"; then
9961 func_warning "'-dlopen' is ignored for objects"
9966 func_warning "'-l' and '-L' are ignored for objects" ;;
9969 test -n "$rpath" && \
9970 func_warning "'-rpath' is ignored for objects"
9972 test -n "$xrpath" && \
9973 func_warning "'-R' is ignored for objects"
9975 test -n "$vinfo" && \
9976 func_warning "'-version-info' is ignored for objects"
9978 test -n "$release" && \
9979 func_warning "'-release' is ignored for objects"
9983 test -n "$objs$old_deplibs" && \
9984 func_fatal_error "cannot build library object '$output' from non-libtool objects"
9988 obj=$func_lo2o_result
9996 # Delete the old objects.
9997 $opt_dry_run || $RM $obj $libobj
9999 # Objects from convenience libraries. This assumes
10000 # single-version convenience libraries. Whenever we create
10001 # different ones for PIC/non-PIC, this we'll have to duplicate
10005 # if reload_cmds runs $LD directly, get rid of -Wl from
10006 # whole_archive_flag_spec and hope we can get by with turning comma
10008 case $reload_cmds in
10009 *\$LD[\ \$]*) wl= ;;
10011 if test -n "$convenience"; then
10012 if test -n "$whole_archive_flag_spec"; then
10013 eval tmp_whole_archive_flags=\"$whole_archive_flag_spec\"
10014 test -n "$wl" || tmp_whole_archive_flags=`$ECHO "$tmp_whole_archive_flags" | $SED 's|,| |g'`
10015 reload_conv_objs=$reload_objs\ $tmp_whole_archive_flags
10017 gentop=$output_objdir/${obj}x
10018 func_append generated " $gentop"
10020 func_extract_archives $gentop $convenience
10021 reload_conv_objs="$reload_objs $func_extract_archives_result"
10025 # If we're not building shared, we need to use non_pic_objs
10026 test yes = "$build_libtool_libs" || libobjs=$non_pic_objects
10028 # Create the old-style object.
10029 reload_objs=$objs$old_deplibs' '`$ECHO "$libobjs" | $SP2NL | $SED "/\.$libext$/d; /\.lib$/d; $lo2o" | $NL2SP`' '$reload_conv_objs
10032 func_execute_cmds "$reload_cmds" 'exit $?'
10034 # Exit if we aren't doing a library object file.
10035 if test -z "$libobj"; then
10036 if test -n "$gentop"; then
10037 func_show_eval '${RM}r "$gentop"'
10043 test yes = "$build_libtool_libs" || {
10044 if test -n "$gentop"; then
10045 func_show_eval '${RM}r "$gentop"'
10048 # Create an invalid libtool object if no PIC, so that we don't
10049 # accidentally link it into a program.
10050 # $show "echo timestamp > $libobj"
10051 # $opt_dry_run || eval "echo timestamp > $libobj" || exit $?
10055 if test -n "$pic_flag" || test default != "$pic_mode"; then
10056 # Only do commands if we really have different PIC objects.
10057 reload_objs="$libobjs $reload_conv_objs"
10059 func_execute_cmds "$reload_cmds" 'exit $?'
10062 if test -n "$gentop"; then
10063 func_show_eval '${RM}r "$gentop"'
10071 *cygwin*) func_stripname '' '.exe' "$output"
10072 output=$func_stripname_result.exe;;
10074 test -n "$vinfo" && \
10075 func_warning "'-version-info' is ignored for programs"
10077 test -n "$release" && \
10078 func_warning "'-release' is ignored for programs"
10081 && test unknown,unknown,unknown = "$dlopen_support,$dlopen_self,$dlopen_self_static" \
10082 && func_warning "'LT_INIT([dlopen])' not used. Assuming no dlopen support."
10085 *-*-rhapsody* | *-*-darwin1.[012])
10086 # On Rhapsody replace the C library is the System framework
10087 compile_deplibs=`$ECHO " $compile_deplibs" | $SED 's/ -lc / System.ltframework /'`
10088 finalize_deplibs=`$ECHO " $finalize_deplibs" | $SED 's/ -lc / System.ltframework /'`
10094 # Don't allow lazy linking, it breaks C++ global constructors
10095 # But is supposedly fixed on 10.4 or later (yay!).
10096 if test CXX = "$tagname"; then
10097 case ${MACOSX_DEPLOYMENT_TARGET-10.0} in
10099 func_append compile_command " $wl-bind_at_load"
10100 func_append finalize_command " $wl-bind_at_load"
10104 # Time to change all our "foo.ltframework" stuff back to "-framework foo"
10105 compile_deplibs=`$ECHO " $compile_deplibs" | $SED 's% \([^ $]*\).ltframework% -framework \1%g'`
10106 finalize_deplibs=`$ECHO " $finalize_deplibs" | $SED 's% \([^ $]*\).ltframework% -framework \1%g'`
10111 # move library search paths that coincide with paths to not yet
10112 # installed libraries to the beginning of the library search list
10114 for path in $notinst_path; do
10115 case " $new_libs " in
10116 *" -L$path/$objdir "*) ;;
10118 case " $compile_deplibs " in
10119 *" -L$path/$objdir "*)
10120 func_append new_libs " -L$path/$objdir" ;;
10125 for deplib in $compile_deplibs; do
10128 case " $new_libs " in
10130 *) func_append new_libs " $deplib" ;;
10133 *) func_append new_libs " $deplib" ;;
10136 compile_deplibs=$new_libs
10139 func_append compile_command " $compile_deplibs"
10140 func_append finalize_command " $finalize_deplibs"
10142 if test -n "$rpath$xrpath"; then
10143 # If the user specified any rpath flags, then add them.
10144 for libdir in $rpath $xrpath; do
10145 # This is the magic to use -rpath.
10146 case "$finalize_rpath " in
10148 *) func_append finalize_rpath " $libdir" ;;
10153 # Now hardcode the library paths
10156 for libdir in $compile_rpath $finalize_rpath; do
10157 if test -n "$hardcode_libdir_flag_spec"; then
10158 if test -n "$hardcode_libdir_separator"; then
10159 if test -z "$hardcode_libdirs"; then
10160 hardcode_libdirs=$libdir
10162 # Just accumulate the unique libdirs.
10163 case $hardcode_libdir_separator$hardcode_libdirs$hardcode_libdir_separator in
10164 *"$hardcode_libdir_separator$libdir$hardcode_libdir_separator"*)
10167 func_append hardcode_libdirs "$hardcode_libdir_separator$libdir"
10172 eval flag=\"$hardcode_libdir_flag_spec\"
10173 func_append rpath " $flag"
10175 elif test -n "$runpath_var"; then
10176 case "$perm_rpath " in
10178 *) func_append perm_rpath " $libdir" ;;
10182 *-*-cygwin* | *-*-mingw* | *-*-pw32* | *-*-os2* | *-cegcc*)
10183 testbindir=`$ECHO "$libdir" | $SED -e 's*/lib$*/bin*'`
10184 case :$dllsearchpath: in
10186 ::) dllsearchpath=$libdir;;
10187 *) func_append dllsearchpath ":$libdir";;
10189 case :$dllsearchpath: in
10190 *":$testbindir:"*) ;;
10191 ::) dllsearchpath=$testbindir;;
10192 *) func_append dllsearchpath ":$testbindir";;
10197 # Substitute the hardcoded libdirs into the rpath.
10198 if test -n "$hardcode_libdir_separator" &&
10199 test -n "$hardcode_libdirs"; then
10200 libdir=$hardcode_libdirs
10201 eval rpath=\" $hardcode_libdir_flag_spec\"
10203 compile_rpath=$rpath
10207 for libdir in $finalize_rpath; do
10208 if test -n "$hardcode_libdir_flag_spec"; then
10209 if test -n "$hardcode_libdir_separator"; then
10210 if test -z "$hardcode_libdirs"; then
10211 hardcode_libdirs=$libdir
10213 # Just accumulate the unique libdirs.
10214 case $hardcode_libdir_separator$hardcode_libdirs$hardcode_libdir_separator in
10215 *"$hardcode_libdir_separator$libdir$hardcode_libdir_separator"*)
10218 func_append hardcode_libdirs "$hardcode_libdir_separator$libdir"
10223 eval flag=\"$hardcode_libdir_flag_spec\"
10224 func_append rpath " $flag"
10226 elif test -n "$runpath_var"; then
10227 case "$finalize_perm_rpath " in
10229 *) func_append finalize_perm_rpath " $libdir" ;;
10233 # Substitute the hardcoded libdirs into the rpath.
10234 if test -n "$hardcode_libdir_separator" &&
10235 test -n "$hardcode_libdirs"; then
10236 libdir=$hardcode_libdirs
10237 eval rpath=\" $hardcode_libdir_flag_spec\"
10239 finalize_rpath=$rpath
10241 if test -n "$libobjs" && test yes = "$build_old_libs"; then
10242 # Transform all the library objects into standard objects.
10243 compile_command=`$ECHO "$compile_command" | $SP2NL | $SED "$lo2o" | $NL2SP`
10244 finalize_command=`$ECHO "$finalize_command" | $SP2NL | $SED "$lo2o" | $NL2SP`
10247 func_generate_dlsyms "$outputname" "@PROGRAM@" false
10249 # template prelinking step
10250 if test -n "$prelink_cmds"; then
10251 func_execute_cmds "$prelink_cmds" 'exit $?'
10254 wrappers_required=:
10256 *cegcc* | *mingw32ce*)
10257 # Disable wrappers for cegcc and mingw32ce hosts, we are cross compiling anyway.
10258 wrappers_required=false
10260 *cygwin* | *mingw* )
10261 test yes = "$build_libtool_libs" || wrappers_required=false
10264 if test no = "$need_relink" || test yes != "$build_libtool_libs"; then
10265 wrappers_required=false
10269 $wrappers_required || {
10270 # Replace the output file specification.
10271 compile_command=`$ECHO "$compile_command" | $SED 's%@OUTPUT@%'"$output"'%g'`
10272 link_command=$compile_command$compile_rpath
10274 # We have no uninstalled library dependencies, so finalize right now.
10276 func_show_eval "$link_command" 'exit_status=$?'
10278 if test -n "$postlink_cmds"; then
10279 func_to_tool_file "$output"
10280 postlink_cmds=`func_echo_all "$postlink_cmds" | $SED -e 's%@OUTPUT@%'"$output"'%g' -e 's%@TOOL_OUTPUT@%'"$func_to_tool_file_result"'%g'`
10281 func_execute_cmds "$postlink_cmds" 'exit $?'
10284 # Delete the generated files.
10285 if test -f "$output_objdir/${outputname}S.$objext"; then
10286 func_show_eval '$RM "$output_objdir/${outputname}S.$objext"'
10292 if test -n "$compile_shlibpath$finalize_shlibpath"; then
10293 compile_command="$shlibpath_var=\"$compile_shlibpath$finalize_shlibpath\$$shlibpath_var\" $compile_command"
10295 if test -n "$finalize_shlibpath"; then
10296 finalize_command="$shlibpath_var=\"$finalize_shlibpath\$$shlibpath_var\" $finalize_command"
10301 if test -n "$runpath_var"; then
10302 if test -n "$perm_rpath"; then
10303 # We should set the runpath_var.
10305 for dir in $perm_rpath; do
10306 func_append rpath "$dir:"
10308 compile_var="$runpath_var=\"$rpath\$$runpath_var\" "
10310 if test -n "$finalize_perm_rpath"; then
10311 # We should set the runpath_var.
10313 for dir in $finalize_perm_rpath; do
10314 func_append rpath "$dir:"
10316 finalize_var="$runpath_var=\"$rpath\$$runpath_var\" "
10320 if test yes = "$no_install"; then
10321 # We don't need to create a wrapper script.
10322 link_command=$compile_var$compile_command$compile_rpath
10323 # Replace the output file specification.
10324 link_command=`$ECHO "$link_command" | $SED 's%@OUTPUT@%'"$output"'%g'`
10325 # Delete the old output file.
10326 $opt_dry_run || $RM $output
10327 # Link the executable and exit
10328 func_show_eval "$link_command" 'exit $?'
10330 if test -n "$postlink_cmds"; then
10331 func_to_tool_file "$output"
10332 postlink_cmds=`func_echo_all "$postlink_cmds" | $SED -e 's%@OUTPUT@%'"$output"'%g' -e 's%@TOOL_OUTPUT@%'"$func_to_tool_file_result"'%g'`
10333 func_execute_cmds "$postlink_cmds" 'exit $?'
10339 case $hardcode_action,$fast_install in
10341 # Fast installation is not supported
10342 link_command=$compile_var$compile_command$compile_rpath
10343 relink_command=$finalize_var$finalize_command$finalize_rpath
10345 func_warning "this platform does not like uninstalled shared libraries"
10346 func_warning "'$output' will be relinked during installation"
10349 link_command=$finalize_var$compile_command$finalize_rpath
10350 relink_command=`$ECHO "$compile_var$compile_command$compile_rpath" | $SED 's%@OUTPUT@%\$progdir/\$file%g'`
10353 link_command=$compile_var$compile_command$compile_rpath
10354 relink_command=$finalize_var$finalize_command$finalize_rpath
10357 link_command=$finalize_var$compile_command$finalize_rpath
10362 # Replace the output file specification.
10363 link_command=`$ECHO "$link_command" | $SED 's%@OUTPUT@%'"$output_objdir/$outputname"'%g'`
10365 # Delete the old output files.
10366 $opt_dry_run || $RM $output $output_objdir/$outputname $output_objdir/lt-$outputname
10368 func_show_eval "$link_command" 'exit $?'
10370 if test -n "$postlink_cmds"; then
10371 func_to_tool_file "$output_objdir/$outputname"
10372 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'`
10373 func_execute_cmds "$postlink_cmds" 'exit $?'
10376 # Now create the wrapper script.
10377 func_verbose "creating $output"
10379 # Quote the relink command for shipping.
10380 if test -n "$relink_command"; then
10381 # Preserve any variables that may affect compiler behavior
10382 for var in $variables_saved_for_relink; do
10383 if eval test -z \"\${$var+set}\"; then
10384 relink_command="{ test -z \"\${$var+set}\" || $lt_unset $var || { $var=; export $var; }; }; $relink_command"
10385 elif eval var_value=\$$var; test -z "$var_value"; then
10386 relink_command="$var=; export $var; $relink_command"
10388 func_quote_for_eval "$var_value"
10389 relink_command="$var=$func_quote_for_eval_result; export $var; $relink_command"
10392 relink_command="(cd `pwd`; $relink_command)"
10393 relink_command=`$ECHO "$relink_command" | $SED "$sed_quote_subst"`
10396 # Only actually do things if not in dry run mode.
10398 # win32 will think the script is a binary if it has
10399 # a .exe suffix, so we strip it off here.
10401 *.exe) func_stripname '' '.exe' "$output"
10402 output=$func_stripname_result ;;
10404 # test for cygwin because mv fails w/o .exe extensions
10408 func_stripname '' '.exe' "$outputname"
10409 outputname=$func_stripname_result ;;
10413 *cygwin* | *mingw* )
10414 func_dirname_and_basename "$output" "" "."
10415 output_name=$func_basename_result
10416 output_path=$func_dirname_result
10417 cwrappersource=$output_path/$objdir/lt-$output_name.c
10418 cwrapper=$output_path/$output_name.exe
10419 $RM $cwrappersource $cwrapper
10420 trap "$RM $cwrappersource $cwrapper; exit $EXIT_FAILURE" 1 2 15
10422 func_emit_cwrapperexe_src > $cwrappersource
10424 # The wrapper executable is built using the $host compiler,
10425 # because it contains $host paths and files. If cross-
10426 # compiling, it, like the target executable, must be
10427 # executed on the $host or under an emulation environment.
10429 $LTCC $LTCFLAGS -o $cwrapper $cwrappersource
10433 # Now, create the wrapper script for func_source use:
10434 func_ltwrapper_scriptname $cwrapper
10435 $RM $func_ltwrapper_scriptname_result
10436 trap "$RM $func_ltwrapper_scriptname_result; exit $EXIT_FAILURE" 1 2 15
10438 # note: this script will not be executed, so do not chmod.
10439 if test "x$build" = "x$host"; then
10440 $cwrapper --lt-dump-script > $func_ltwrapper_scriptname_result
10442 func_emit_wrapper no > $func_ltwrapper_scriptname_result
10448 trap "$RM $output; exit $EXIT_FAILURE" 1 2 15
10450 func_emit_wrapper no > $output
10459 # See if we need to build an old-fashioned archive.
10460 for oldlib in $oldlibs; do
10462 case $build_libtool_libs in
10464 oldobjs="$libobjs_save $symfileobj"
10465 addlibs=$convenience
10466 build_libtool_libs=no
10469 oldobjs=$libobjs_save
10470 addlibs=$old_convenience
10471 build_libtool_libs=no
10474 oldobjs="$old_deplibs $non_pic_objects"
10475 $preload && test -f "$symfileobj" \
10476 && func_append oldobjs " $symfileobj"
10477 addlibs=$old_convenience
10481 if test -n "$addlibs"; then
10482 gentop=$output_objdir/${outputname}x
10483 func_append generated " $gentop"
10485 func_extract_archives $gentop $addlibs
10486 func_append oldobjs " $func_extract_archives_result"
10489 # Do each command in the archive commands.
10490 if test -n "$old_archive_from_new_cmds" && test yes = "$build_libtool_libs"; then
10491 cmds=$old_archive_from_new_cmds
10494 # Add any objects from preloaded convenience libraries
10495 if test -n "$dlprefiles"; then
10496 gentop=$output_objdir/${outputname}x
10497 func_append generated " $gentop"
10499 func_extract_archives $gentop $dlprefiles
10500 func_append oldobjs " $func_extract_archives_result"
10503 # POSIX demands no paths to be encoded in archives. We have
10504 # to avoid creating archives with duplicate basenames if we
10505 # might have to extract them afterwards, e.g., when creating a
10506 # static archive out of a convenience library, or when linking
10507 # the entirety of a libtool archive into another (currently
10508 # not supported by libtool).
10509 if (for obj in $oldobjs
10511 func_basename "$obj"
10512 $ECHO "$func_basename_result"
10513 done | sort | sort -uc >/dev/null 2>&1); then
10516 echo "copying selected object files to avoid basename conflicts..."
10517 gentop=$output_objdir/${outputname}x
10518 func_append generated " $gentop"
10519 func_mkdir_p "$gentop"
10520 save_oldobjs=$oldobjs
10523 for obj in $save_oldobjs
10525 func_basename "$obj"
10526 objbase=$func_basename_result
10527 case " $oldobjs " in
10528 " ") oldobjs=$obj ;;
10529 *[\ /]"$objbase "*)
10531 # Make sure we don't pick an alternate name that also
10533 newobj=lt$counter-$objbase
10534 func_arith $counter + 1
10535 counter=$func_arith_result
10536 case " $oldobjs " in
10537 *[\ /]"$newobj "*) ;;
10538 *) if test ! -f "$gentop/$newobj"; then break; fi ;;
10541 func_show_eval "ln $obj $gentop/$newobj || cp $obj $gentop/$newobj"
10542 func_append oldobjs " $gentop/$newobj"
10544 *) func_append oldobjs " $obj" ;;
10548 func_to_tool_file "$oldlib" func_convert_file_msys_to_w32
10549 tool_oldlib=$func_to_tool_file_result
10550 eval cmds=\"$old_archive_cmds\"
10553 len=$func_len_result
10554 if test "$len" -lt "$max_cmd_len" || test "$max_cmd_len" -le -1; then
10555 cmds=$old_archive_cmds
10556 elif test -n "$archiver_list_spec"; then
10557 func_verbose "using command file archive linking..."
10558 for obj in $oldobjs
10560 func_to_tool_file "$obj"
10561 $ECHO "$func_to_tool_file_result"
10562 done > $output_objdir/$libname.libcmd
10563 func_to_tool_file "$output_objdir/$libname.libcmd"
10564 oldobjs=" $archiver_list_spec$func_to_tool_file_result"
10565 cmds=$old_archive_cmds
10567 # the command line is too long to link in one step, link in parts
10568 func_verbose "using piecewise archive linking..."
10569 save_RANLIB=$RANLIB
10573 save_oldobjs=$oldobjs
10575 # Is there a better way of finding the last object in the list?
10576 for obj in $save_oldobjs
10580 eval test_cmds=\"$old_archive_cmds\"
10581 func_len " $test_cmds"
10582 len0=$func_len_result
10584 for obj in $save_oldobjs
10587 func_arith $len + $func_len_result
10588 len=$func_arith_result
10589 func_append objlist " $obj"
10590 if test "$len" -lt "$max_cmd_len"; then
10593 # the above command should be used before it gets too long
10595 if test "$obj" = "$last_oldobj"; then
10596 RANLIB=$save_RANLIB
10598 test -z "$concat_cmds" || concat_cmds=$concat_cmds~
10599 eval concat_cmds=\"\$concat_cmds$old_archive_cmds\"
10604 RANLIB=$save_RANLIB
10606 if test -z "$oldobjs"; then
10607 eval cmds=\"\$concat_cmds\"
10609 eval cmds=\"\$concat_cmds~\$old_archive_cmds\"
10613 func_execute_cmds "$cmds" 'exit $?'
10616 test -n "$generated" && \
10617 func_show_eval "${RM}r$generated"
10619 # Now create the libtool archive.
10623 test yes = "$build_old_libs" && old_library=$libname.$libext
10624 func_verbose "creating $output"
10626 # Preserve any variables that may affect compiler behavior
10627 for var in $variables_saved_for_relink; do
10628 if eval test -z \"\${$var+set}\"; then
10629 relink_command="{ test -z \"\${$var+set}\" || $lt_unset $var || { $var=; export $var; }; }; $relink_command"
10630 elif eval var_value=\$$var; test -z "$var_value"; then
10631 relink_command="$var=; export $var; $relink_command"
10633 func_quote_for_eval "$var_value"
10634 relink_command="$var=$func_quote_for_eval_result; export $var; $relink_command"
10637 # Quote the link command for shipping.
10638 relink_command="(cd `pwd`; $SHELL \"$progpath\" $preserve_args --mode=relink $libtool_args @inst_prefix_dir@)"
10639 relink_command=`$ECHO "$relink_command" | $SED "$sed_quote_subst"`
10640 if test yes = "$hardcode_automatic"; then
10644 # Only create the output if not a dry run.
10646 for installed in no yes; do
10647 if test yes = "$installed"; then
10648 if test -z "$install_libdir"; then
10651 output=$output_objdir/${outputname}i
10652 # Replace all uninstalled libtool libraries with the installed ones
10653 newdependency_libs=
10654 for deplib in $dependency_libs; do
10657 func_basename "$deplib"
10658 name=$func_basename_result
10659 func_resolve_sysroot "$deplib"
10660 eval libdir=`$SED -n -e 's/^libdir=\(.*\)$/\1/p' $func_resolve_sysroot_result`
10661 test -z "$libdir" && \
10662 func_fatal_error "'$deplib' is not a valid libtool archive"
10663 func_append newdependency_libs " ${lt_sysroot:+=}$libdir/$name"
10666 func_stripname -L '' "$deplib"
10667 func_replace_sysroot "$func_stripname_result"
10668 func_append newdependency_libs " -L$func_replace_sysroot_result"
10671 func_stripname -R '' "$deplib"
10672 func_replace_sysroot "$func_stripname_result"
10673 func_append newdependency_libs " -R$func_replace_sysroot_result"
10675 *) func_append newdependency_libs " $deplib" ;;
10678 dependency_libs=$newdependency_libs
10681 for lib in $dlfiles; do
10684 func_basename "$lib"
10685 name=$func_basename_result
10686 eval libdir=`$SED -n -e 's/^libdir=\(.*\)$/\1/p' $lib`
10687 test -z "$libdir" && \
10688 func_fatal_error "'$lib' is not a valid libtool archive"
10689 func_append newdlfiles " ${lt_sysroot:+=}$libdir/$name"
10691 *) func_append newdlfiles " $lib" ;;
10694 dlfiles=$newdlfiles
10696 for lib in $dlprefiles; do
10699 # Only pass preopened files to the pseudo-archive (for
10700 # eventual linking with the app. that links it) if we
10701 # didn't already link the preopened objects directly into
10703 func_basename "$lib"
10704 name=$func_basename_result
10705 eval libdir=`$SED -n -e 's/^libdir=\(.*\)$/\1/p' $lib`
10706 test -z "$libdir" && \
10707 func_fatal_error "'$lib' is not a valid libtool archive"
10708 func_append newdlprefiles " ${lt_sysroot:+=}$libdir/$name"
10712 dlprefiles=$newdlprefiles
10715 for lib in $dlfiles; do
10717 [\\/]* | [A-Za-z]:[\\/]*) abs=$lib ;;
10718 *) abs=`pwd`"/$lib" ;;
10720 func_append newdlfiles " $abs"
10722 dlfiles=$newdlfiles
10724 for lib in $dlprefiles; do
10726 [\\/]* | [A-Za-z]:[\\/]*) abs=$lib ;;
10727 *) abs=`pwd`"/$lib" ;;
10729 func_append newdlprefiles " $abs"
10731 dlprefiles=$newdlprefiles
10734 # place dlname in correct position for cygwin
10735 # In fact, it would be nice if we could use this code for all target
10736 # systems that can't hard-code library paths into their executables
10737 # and that have no shared library path variable independent of PATH,
10738 # but it turns out we can't easily determine that from inspecting
10739 # libtool variables, so we have to hard-code the OSs to which it
10740 # applies here; at the moment, that means platforms that use the PE
10741 # object format with DLL files. See the long comment at the top of
10742 # tests/bindir.at for full details.
10744 case $host,$output,$installed,$module,$dlname in
10745 *cygwin*,*lai,yes,no,*.dll | *mingw*,*lai,yes,no,*.dll | *cegcc*,*lai,yes,no,*.dll)
10746 # If a -bindir argument was supplied, place the dll there.
10747 if test -n "$bindir"; then
10748 func_relative_path "$install_libdir" "$bindir"
10749 tdlname=$func_relative_path_result/$dlname
10751 # Otherwise fall back on heuristic.
10752 tdlname=../bin/$dlname
10757 # $outputname - a libtool library file
10758 # Generated by $PROGRAM (GNU $PACKAGE) $VERSION
10760 # Please DO NOT delete this file!
10761 # It is necessary for linking the library.
10763 # The name that we can dlopen(3).
10766 # Names of this library.
10767 library_names='$library_names'
10769 # The name of the static archive.
10770 old_library='$old_library'
10772 # Linker flags that cannot go in dependency_libs.
10773 inherited_linker_flags='$new_inherited_linker_flags'
10775 # Libraries that this one depends upon.
10776 dependency_libs='$dependency_libs'
10778 # Names of additional weak libraries provided by this library
10779 weak_library_names='$weak_libs'
10781 # Version information for $libname.
10786 # Is this an already installed library?
10787 installed=$installed
10789 # Should we warn about portability when linking against -modules?
10790 shouldnotlink=$module
10792 # Files to dlopen/dlpreopen
10794 dlpreopen='$dlprefiles'
10796 # Directory that this library needs to be installed in:
10797 libdir='$install_libdir'"
10798 if test no,yes = "$installed,$need_relink"; then
10799 $ECHO >> $output "\
10800 relink_command=\"$relink_command\""
10805 # Do a symbolic link so that the libtool archive can be found in
10806 # LD_LIBRARY_PATH before the program is installed.
10807 func_show_eval '( cd "$output_objdir" && $RM "$outputname" && $LN_S "../$outputname" "$outputname" )' 'exit $?'
10813 if test link = "$opt_mode" || test relink = "$opt_mode"; then
10814 func_mode_link ${1+"$@"}
10818 # func_mode_uninstall arg...
10819 func_mode_uninstall ()
10828 # This variable tells wrapper scripts just to set variables rather
10829 # than running their programs.
10830 libtool_install_magic=$magic
10835 -f) func_append RM " $arg"; rmforce=: ;;
10836 -*) func_append RM " $arg" ;;
10837 *) func_append files " $arg" ;;
10842 func_fatal_help "you must specify an RM program"
10846 for file in $files; do
10847 func_dirname "$file" "" "."
10848 dir=$func_dirname_result
10849 if test . = "$dir"; then
10854 func_basename "$file"
10855 name=$func_basename_result
10856 test uninstall = "$opt_mode" && odir=$dir
10858 # Remember odir for removal later, being careful to avoid duplicates
10859 if test clean = "$opt_mode"; then
10860 case " $rmdirs " in
10862 *) func_append rmdirs " $odir" ;;
10866 # Don't error if the file doesn't exist and rm -f was used.
10867 if { test -L "$file"; } >/dev/null 2>&1 ||
10868 { test -h "$file"; } >/dev/null 2>&1 ||
10869 test -f "$file"; then
10871 elif test -d "$file"; then
10874 elif $rmforce; then
10882 # Possibly a libtool archive, so verify it.
10883 if func_lalib_p "$file"; then
10884 func_source $dir/$name
10886 # Delete the libtool libraries and symlinks.
10887 for n in $library_names; do
10888 func_append rmfiles " $odir/$n"
10890 test -n "$old_library" && func_append rmfiles " $odir/$old_library"
10894 case " $library_names " in
10896 *) test -n "$dlname" && func_append rmfiles " $odir/$dlname" ;;
10898 test -n "$libdir" && func_append rmfiles " $odir/$name $odir/${name}i"
10901 if test -n "$library_names"; then
10902 # Do each command in the postuninstall commands.
10903 func_execute_cmds "$postuninstall_cmds" '$rmforce || exit_status=1'
10906 if test -n "$old_library"; then
10907 # Do each command in the old_postuninstall commands.
10908 func_execute_cmds "$old_postuninstall_cmds" '$rmforce || exit_status=1'
10910 # FIXME: should reinstall the best remaining shared library.
10917 # Possibly a libtool object, so verify it.
10918 if func_lalib_p "$file"; then
10920 # Read the .lo file
10921 func_source $dir/$name
10923 # Add PIC object to the list of files to remove.
10924 if test -n "$pic_object" && test none != "$pic_object"; then
10925 func_append rmfiles " $dir/$pic_object"
10928 # Add non-PIC object to the list of files to remove.
10929 if test -n "$non_pic_object" && test none != "$non_pic_object"; then
10930 func_append rmfiles " $dir/$non_pic_object"
10936 if test clean = "$opt_mode"; then
10940 func_stripname '' '.exe' "$file"
10941 file=$func_stripname_result
10942 func_stripname '' '.exe' "$name"
10943 noexename=$func_stripname_result
10944 # $file with .exe has already been added to rmfiles,
10945 # add $file without .exe
10946 func_append rmfiles " $file"
10949 # Do a test to see if this is a libtool program.
10950 if func_ltwrapper_p "$file"; then
10951 if func_ltwrapper_executable_p "$file"; then
10952 func_ltwrapper_scriptname "$file"
10954 func_source $func_ltwrapper_scriptname_result
10955 func_append rmfiles " $func_ltwrapper_scriptname_result"
10958 func_source $dir/$noexename
10961 # note $name still contains .exe if it was in $file originally
10962 # as does the version of $file that was added into $rmfiles
10963 func_append rmfiles " $odir/$name $odir/${name}S.$objext"
10964 if test yes = "$fast_install" && test -n "$relink_command"; then
10965 func_append rmfiles " $odir/lt-$name"
10967 if test "X$noexename" != "X$name"; then
10968 func_append rmfiles " $odir/lt-$noexename.c"
10974 func_show_eval "$RM $rmfiles" 'exit_status=1'
10977 # Try to remove the $objdir's in the directories where we deleted files
10978 for dir in $rmdirs; do
10979 if test -d "$dir"; then
10980 func_show_eval "rmdir $dir >/dev/null 2>&1"
10987 if test uninstall = "$opt_mode" || test clean = "$opt_mode"; then
10988 func_mode_uninstall ${1+"$@"}
10991 test -z "$opt_mode" && {
10993 func_fatal_help "you must specify a MODE"
10996 test -z "$exec_cmd" && \
10997 func_fatal_help "invalid operation mode '$opt_mode'"
10999 if test -n "$exec_cmd"; then
11000 eval exec "$exec_cmd"
11007 # The TAGs below are defined such that we never get into a situation
11008 # where we disable both kinds of libraries. Given conflicting
11009 # choices, we go for a static library, that is the most portable,
11010 # since we can't tell whether shared libraries were disabled because
11011 # the user asked for that or because the platform doesn't support
11012 # them. This is particularly important on AIX, because we don't
11013 # support having both static and shared libraries enabled at the same
11014 # time on that platform, so we default to a shared-only configuration.
11015 # If a disable-shared tag is given, we'll fallback to a static-only
11016 # configuration. But we'll never go from static-only to shared-only.
11018 # ### BEGIN LIBTOOL TAG CONFIG: disable-shared
11019 build_libtool_libs=no
11021 # ### END LIBTOOL TAG CONFIG: disable-shared
11023 # ### BEGIN LIBTOOL TAG CONFIG: disable-static
11024 build_old_libs=`case $build_libtool_libs in yes) echo no;; *) echo yes;; esac`
11025 # ### END LIBTOOL TAG CONFIG: disable-static
11028 # mode:shell-script