2 ## DO NOT EDIT - This file generated from ./build-aux/ltmain.in
3 ## by inline-source v2014-01-03.01
5 # libtool (GNU libtool) 2.4.6
6 # Provide generalized library-building support services.
7 # Written by Gordon Matzigkeit <gord@gnu.ai.mit.edu>, 1996
9 # Copyright (C) 1996-2015 Free Software Foundation, Inc.
10 # This is free software; see the source for copying conditions. There is NO
11 # warranty; not even for MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
13 # GNU Libtool is free software; you can redistribute it and/or modify
14 # it under the terms of the GNU General Public License as published by
15 # the Free Software Foundation; either version 2 of the License, or
16 # (at your option) any later version.
18 # As a special exception to the GNU General Public License,
19 # if you distribute this file as part of a program or library that
20 # is built using GNU Libtool, you may include this file under the
21 # same distribution terms that you use for the rest of that program.
23 # GNU Libtool is distributed in the hope that it will be useful, but
24 # WITHOUT ANY WARRANTY; without even the implied warranty of
25 # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
26 # General Public License for more details.
28 # You should have received a copy of the GNU General Public License
29 # along with this program. If not, see <http://www.gnu.org/licenses/>.
35 package_revision=2.4.6
42 # Run './libtool --help' for help with using this script from the
46 ## ------------------------------- ##
47 ## User overridable command paths. ##
48 ## ------------------------------- ##
50 # After configure completes, it has a better idea of some of the
51 # shell tools we need than the defaults used by the functions shared
52 # with bootstrap, so set those here where they can still be over-
53 # ridden by the user, but otherwise take precedence.
55 : ${AUTOCONF="autoconf"}
56 : ${AUTOMAKE="automake"}
59 ## -------------------------- ##
60 ## Source external libraries. ##
61 ## -------------------------- ##
63 # Much of our low-level functionality needs to be sourced from external
64 # libraries, which are installed to $pkgauxdir.
66 # Set a version string for this script.
67 scriptversion=2015-01-20.17; # UTC
69 # General shell script boiler plate, and helper functions.
70 # Written by Gary V. Vaughan, 2004
72 # Copyright (C) 2004-2015 Free Software Foundation, Inc.
73 # This is free software; see the source for copying conditions. There is NO
74 # warranty; not even for MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
76 # This program is free software; you can redistribute it and/or modify
77 # it under the terms of the GNU General Public License as published by
78 # the Free Software Foundation; either version 3 of the License, or
79 # (at your option) any later version.
81 # As a special exception to the GNU General Public License, if you distribute
82 # this file as part of a program or library that is built using GNU Libtool,
83 # you may include this file under the same distribution terms that you use
84 # for the rest of that program.
86 # This program is distributed in the hope that it will be useful,
87 # but WITHOUT ANY WARRANTY; without even the implied warranty of
88 # MERCHANTABILITY or FITNES FOR A PARTICULAR PURPOSE. See the GNU
89 # General Public License for more details.
91 # You should have received a copy of the GNU General Public License
92 # along with this program. If not, see <http://www.gnu.org/licenses/>.
94 # Please report bugs or propose patches to gary@gnu.org.
101 # Evaluate this file near the top of your script to gain access to
102 # the functions and variables defined here:
104 # . `echo "$0" | ${SED-sed} 's|[^/]*$||'`/build-aux/funclib.sh
106 # If you need to override any of the default environment variable
107 # settings, do that before evaluating this file.
110 ## -------------------- ##
111 ## Shell normalisation. ##
112 ## -------------------- ##
114 # Some shells need a little help to be as Bourne compatible as possible.
115 # Before doing anything else, make sure all that help has been provided!
117 DUALCASE=1; export DUALCASE # for MKS sh
118 if test -n "${ZSH_VERSION+set}" && (emulate sh) >/dev/null 2>&1; then :
121 # Pre-4.2 versions of Zsh do word splitting on ${1+"$@"}, which
122 # is contrary to our usage. Disable this feature.
123 alias -g '${1+"$@"}'='"$@"'
126 case `(set -o) 2>/dev/null` in *posix*) set -o posix ;; esac
129 # NLS nuisances: We save the old values in case they are required later.
132 for _G_var in LANG LANGUAGE LC_ALL LC_CTYPE LC_COLLATE LC_MESSAGES
134 eval "if test set = \"\${$_G_var+set}\"; then
135 save_$_G_var=\$$_G_var
138 _G_user_locale=\"$_G_var=\\\$save_\$_G_var; \$_G_user_locale\"
139 _G_safe_locale=\"$_G_var=C; \$_G_safe_locale\"
144 (unset CDPATH) >/dev/null 2>&1 && unset CDPATH
146 # Make sure IFS has a sensible default
152 # There are apparently some retarded systems that use ';' as a PATH separator!
153 if test "${PATH_SEPARATOR+set}" != set; then
155 (PATH='/bin;/bin'; FPATH=$PATH; sh -c :) >/dev/null 2>&1 && {
156 (PATH='/bin:/bin'; FPATH=$PATH; sh -c :) >/dev/null 2>&1 ||
163 ## ------------------------- ##
164 ## Locate command utilities. ##
165 ## ------------------------- ##
168 # func_executable_p FILE
169 # ----------------------
170 # Check that FILE is an executable regular file.
173 test -f "$1" && test -x "$1"
177 # func_path_progs PROGS_LIST CHECK_FUNC [PATH]
178 # --------------------------------------------
179 # Search for either a program that responds to --version with output
180 # containing "GNU", or else returned by CHECK_FUNC otherwise, by
181 # trying all the directories in PATH with each of the elements of
184 # CHECK_FUNC should accept the path to a candidate program, and
185 # set $func_check_prog_result if it truncates its output less than
186 # $_G_path_prog_max characters.
194 _G_path_prog_found=false
195 _G_save_IFS=$IFS; IFS=${PATH_SEPARATOR-:}
196 for _G_dir in $_G_PATH; do
198 test -z "$_G_dir" && _G_dir=.
199 for _G_prog_name in $_G_progs_list; do
200 for _exeext in '' .EXE; do
201 _G_path_prog=$_G_dir/$_G_prog_name$_exeext
202 func_executable_p "$_G_path_prog" || continue
203 case `"$_G_path_prog" --version 2>&1` in
204 *GNU*) func_path_progs_result=$_G_path_prog _G_path_prog_found=: ;;
205 *) $_G_check_func $_G_path_prog
206 func_path_progs_result=$func_check_prog_result
209 $_G_path_prog_found && break 3
214 test -z "$func_path_progs_result" && {
215 echo "no acceptable sed could be found in \$PATH" >&2
221 # We want to be able to use the functions in this file before configure
222 # has figured out where the best binaries are kept, which means we have
223 # to search for them ourselves - except when the results are already set
224 # where we skip the searches.
226 # Unless the user overrides by setting SED, search the path for either GNU
227 # sed, or the sed that truncates its output the least.
229 _G_sed_script=s/aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa/bbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbb/
230 for _G_i in 1 2 3 4 5 6 7; do
231 _G_sed_script=$_G_sed_script$nl$_G_sed_script
233 echo "$_G_sed_script" 2>/dev/null | sed 99q >conftest.sed
236 func_check_prog_sed ()
241 printf 0123456789 >conftest.in
244 cat conftest.in conftest.in >conftest.tmp
245 mv conftest.tmp conftest.in
246 cp conftest.in conftest.nl
247 echo '' >> conftest.nl
248 "$_G_path_prog" -f conftest.sed <conftest.nl >conftest.out 2>/dev/null || break
249 diff conftest.out conftest.nl >/dev/null 2>&1 || break
250 _G_count=`expr $_G_count + 1`
251 if test "$_G_count" -gt "$_G_path_prog_max"; then
252 # Best one so far, save it but keep looking for a better one
253 func_check_prog_result=$_G_path_prog
254 _G_path_prog_max=$_G_count
256 # 10*(2^10) chars as input seems more than enough
257 test 10 -lt "$_G_count" && break
259 rm -f conftest.in conftest.tmp conftest.nl conftest.out
262 func_path_progs "sed gsed" func_check_prog_sed $PATH:/usr/xpg4/bin
264 SED=$func_path_progs_result
268 # Unless the user overrides by setting GREP, search the path for either GNU
269 # grep, or the grep that truncates its output the least.
271 func_check_prog_grep ()
277 printf 0123456789 >conftest.in
280 cat conftest.in conftest.in >conftest.tmp
281 mv conftest.tmp conftest.in
282 cp conftest.in conftest.nl
283 echo 'GREP' >> conftest.nl
284 "$_G_path_prog" -e 'GREP$' -e '-(cannot match)-' <conftest.nl >conftest.out 2>/dev/null || break
285 diff conftest.out conftest.nl >/dev/null 2>&1 || break
286 _G_count=`expr $_G_count + 1`
287 if test "$_G_count" -gt "$_G_path_prog_max"; then
288 # Best one so far, save it but keep looking for a better one
289 func_check_prog_result=$_G_path_prog
290 _G_path_prog_max=$_G_count
292 # 10*(2^10) chars as input seems more than enough
293 test 10 -lt "$_G_count" && break
295 rm -f conftest.in conftest.tmp conftest.nl conftest.out
298 func_path_progs "grep ggrep" func_check_prog_grep $PATH:/usr/xpg4/bin
299 GREP=$func_path_progs_result
303 ## ------------------------------- ##
304 ## User overridable command paths. ##
305 ## ------------------------------- ##
307 # All uppercase variable names are used for environment variables. These
308 # variables can be overridden by the user before calling a script that
309 # uses them if a suitable command of that name is not already available
310 # in the command search PATH.
316 : ${ECHO="printf %s\n"}
317 : ${EGREP="$GREP -E"}
318 : ${FGREP="$GREP -F"}
324 : ${SHELL="${CONFIG_SHELL-/bin/sh}"}
327 ## -------------------- ##
328 ## Useful sed snippets. ##
329 ## -------------------- ##
331 sed_dirname='s|/[^/]*$||'
332 sed_basename='s|^.*/||'
334 # Sed substitution that helps us do robust quoting. It backslashifies
335 # metacharacters that are still active within double-quoted strings.
336 sed_quote_subst='s|\([`"$\\]\)|\\\1|g'
338 # Same as above, but do not quote variable references.
339 sed_double_quote_subst='s/\(["`\\]\)/\\\1/g'
341 # Sed substitution that turns a string into a regex matching for the
343 sed_make_literal_regex='s|[].[^$\\*\/]|\\&|g'
345 # Sed substitution that converts a w32 file name or path
346 # that contains forward slashes, into one that contains
347 # (escaped) backslashes. A very naive implementation.
348 sed_naive_backslashify='s|\\\\*|\\|g;s|/|\\|g;s|\\|\\\\|g'
350 # Re-'\' parameter expansions in output of sed_double_quote_subst that
351 # were '\'-ed in input to the same. If an odd number of '\' preceded a
352 # '$' in input to sed_double_quote_subst, that '$' was protected from
353 # expansion. Since each input '\' is now two '\'s, look for any number
354 # of runs of four '\'s followed by two '\'s and then a '$'. '\' that '$'.
359 sed_double_backslash="\
362 s/^$_G_bs2$_G_dollar/$_G_bs&/
363 s/\\([^$_G_bs]\\)$_G_bs2$_G_dollar/\\1$_G_bs2$_G_bs$_G_dollar/g
367 ## ----------------- ##
368 ## Global variables. ##
369 ## ----------------- ##
371 # Except for the global variables explicitly listed below, the following
372 # functions in the '^func_' namespace, and the '^require_' namespace
373 # variables initialised in the 'Resource management' section, sourcing
374 # this file will not pollute your global namespace with anything
375 # else. There's no portable way to scope variables in Bourne shell
376 # though, so actually running these functions will sometimes place
377 # results into a variable named after the function, and often use
378 # temporary variables in the '^_G_' namespace. If you are careful to
379 # avoid using those namespaces casually in your sourcing script, things
380 # should continue to work as you expect. And, of course, you can freely
381 # overwrite any of the functions or variables defined here before
382 # calling anything to customize them.
386 EXIT_MISMATCH=63 # $? = 63 is used to indicate version mismatch to missing.
387 EXIT_SKIP=77 # $? = 77 is used to indicate a skipped test to automake.
389 # Allow overriding, eg assuming that you follow the convention of
390 # putting '$debug_cmd' at the start of all your functions, you can get
391 # bash to show function call trace with:
393 # debug_cmd='eval echo "${FUNCNAME[0]} $*" >&2' bash your-script-name
394 debug_cmd=${debug_cmd-":"}
397 # By convention, finish your script with:
401 # so that you can set exit_status to non-zero if you want to indicate
402 # something went wrong during execution without actually bailing out at
403 # the point of failure.
404 exit_status=$EXIT_SUCCESS
406 # Work around backward compatibility issue on IRIX 6.5. On IRIX 6.4+, sh
407 # is ksh but when the shell is invoked as "sh" and the current value of
408 # the _XPG environment variable is not equal to 1 (one), the special
409 # positional parameter $0, within a function call, is the name of the
413 # The name of this program.
414 progname=`$ECHO "$progpath" |$SED "$sed_basename"`
416 # Make sure we have an absolute progpath for reexecution:
418 [\\/]*|[A-Za-z]:\\*) ;;
420 progdir=`$ECHO "$progpath" |$SED "$sed_dirname"`
421 progdir=`cd "$progdir" && pwd`
422 progpath=$progdir/$progname
426 IFS=${PATH_SEPARATOR-:}
427 for progdir in $PATH; do
429 test -x "$progdir/$progname" && break
432 test -n "$progdir" || progdir=`pwd`
433 progpath=$progdir/$progname
438 ## ----------------- ##
439 ## Standard options. ##
440 ## ----------------- ##
442 # The following options affect the operation of the functions defined
443 # below, and should be set appropriately depending on run-time para-
444 # meters passed on the command line.
450 # Categories 'all' and 'none' are always available. Append any others
451 # you will pass as the first argument to func_warning from your own
455 # By default, display warnings according to 'opt_warning_types'. Set
456 # 'warning_func' to ':' to elide all warnings, or func_fatal_error to
457 # treat the next displayed warning as a fatal error.
458 warning_func=func_warn_and_continue
460 # Set to 'all' to display all warnings, 'none' to suppress all
461 # warnings, or a space delimited list of some subset of
462 # 'warning_categories' to display only the listed warnings.
463 opt_warning_types=all
466 ## -------------------- ##
467 ## Resource management. ##
468 ## -------------------- ##
470 # This section contains definitions for functions that each ensure a
471 # particular resource (a file, or a non-empty configuration variable for
472 # example) is available, and if appropriate to extract default values
473 # from pertinent package files. Call them using their associated
474 # 'require_*' variable to ensure that they are executed, at most, once.
476 # It's entirely deliberate that calling these functions can set
477 # variables that don't obey the namespace limitations obeyed by the rest
478 # of this file, in order that that they be as useful as possible to
482 # require_term_colors
483 # -------------------
484 # Allow display of bold text on terminals that support it.
485 require_term_colors=func_require_term_colors
486 func_require_term_colors ()
491 # COLORTERM and USE_ANSI_COLORS environment variables take
492 # precedence, because most terminfo databases neglect to describe
493 # whether color sequences are supported.
494 test -n "${COLORTERM+set}" && : ${USE_ANSI_COLORS="1"}
496 if test 1 = "$USE_ANSI_COLORS"; then
497 # Standard ANSI escape sequences
499 tc_bold='
\e[1m'; tc_standout='
\e[7m'
500 tc_red='
\e[31m'; tc_green='
\e[32m'
501 tc_blue='
\e[34m'; tc_cyan='
\e[36m'
503 # Otherwise trust the terminfo database after all.
504 test -n "`tput sgr0 2>/dev/null`" && {
506 test -n "`tput bold 2>/dev/null`" && tc_bold=`tput bold`
508 test -n "`tput smso 2>/dev/null`" && tc_standout=`tput smso`
509 test -n "`tput setaf 1 2>/dev/null`" && tc_red=`tput setaf 1`
510 test -n "`tput setaf 2 2>/dev/null`" && tc_green=`tput setaf 2`
511 test -n "`tput setaf 4 2>/dev/null`" && tc_blue=`tput setaf 4`
512 test -n "`tput setaf 5 2>/dev/null`" && tc_cyan=`tput setaf 5`
517 require_term_colors=:
521 ## ----------------- ##
522 ## Function library. ##
523 ## ----------------- ##
525 # This section contains a variety of useful functions to call in your
526 # scripts. Take note of the portable wrappers for features provided by
527 # some modern shells, which will fall back to slower equivalents on
528 # less featureful shells.
531 # func_append VAR VALUE
532 # ---------------------
533 # Append VALUE onto the existing contents of VAR.
535 # We should try to minimise forks, especially on Windows where they are
536 # unreasonably slow, so skip the feature probes when bash or zsh are
538 if test set = "${BASH_VERSION+set}${ZSH_VERSION+set}"; then
539 : ${_G_HAVE_ARITH_OP="yes"}
540 : ${_G_HAVE_XSI_OPS="yes"}
541 # The += operator was introduced in bash 3.1
542 case $BASH_VERSION in
543 [12].* | 3.0 | 3.0*) ;;
545 : ${_G_HAVE_PLUSEQ_OP="yes"}
551 # Can be empty, in which case the shell is probed, "yes" if += is
552 # useable or anything else if it does not work.
553 test -z "$_G_HAVE_PLUSEQ_OP" \
554 && (eval 'x=a; x+=" b"; test "a b" = "$x"') 2>/dev/null \
555 && _G_HAVE_PLUSEQ_OP=yes
557 if test yes = "$_G_HAVE_PLUSEQ_OP"
559 # This is an XSI compatible shell, allowing a faster implementation...
567 # ...otherwise fall back to using expr, which is often a shell builtin.
577 # func_append_quoted VAR VALUE
578 # ----------------------------
579 # Quote VALUE and append to the end of shell variable VAR, separated
581 if test yes = "$_G_HAVE_PLUSEQ_OP"; then
582 eval 'func_append_quoted ()
586 func_quote_for_eval "$2"
587 eval "$1+=\\ \$func_quote_for_eval_result"
590 func_append_quoted ()
594 func_quote_for_eval "$2"
595 eval "$1=\$$1\\ \$func_quote_for_eval_result"
600 # func_append_uniq VAR VALUE
601 # --------------------------
602 # Append unique VALUE onto the existing contents of VAR, assuming
603 # entries are delimited by the first character of VALUE. For example:
605 # func_append_uniq options " --another-option option-argument"
607 # will only append to $options if " --another-option option-argument "
608 # is not already present somewhere in $options already (note spaces at
609 # each end implied by leading space in second argument).
614 eval _G_current_value='`$ECHO $'$1'`'
615 _G_delim=`expr "$2" : '\(.\)'`
617 case $_G_delim$_G_current_value$_G_delim in
619 *) func_append "$@" ;;
626 # Set func_arith_result to the result of evaluating TERMs.
627 test -z "$_G_HAVE_ARITH_OP" \
628 && (eval 'test 2 = $(( 1 + 1 ))') 2>/dev/null \
629 && _G_HAVE_ARITH_OP=yes
631 if test yes = "$_G_HAVE_ARITH_OP"; then
636 func_arith_result=$(( $* ))
643 func_arith_result=`expr "$@"`
650 # Set func_basename_result to FILE with everything up to and including
651 # the last / stripped.
652 if test yes = "$_G_HAVE_XSI_OPS"; then
653 # If this shell supports suffix pattern removal, then use it to avoid
654 # forking. Hide the definitions single quotes in case the shell chokes
655 # on unsupported syntax...
656 _b='func_basename_result=${1##*/}'
658 */*) func_dirname_result=${1%/*}$2 ;;
659 * ) func_dirname_result=$3 ;;
663 # ...otherwise fall back to using sed.
664 _b='func_basename_result=`$ECHO "$1" |$SED "$sed_basename"`'
665 _d='func_dirname_result=`$ECHO "$1" |$SED "$sed_dirname"`
666 if test "X$func_dirname_result" = "X$1"; then
667 func_dirname_result=$3
669 func_append func_dirname_result "$2"
673 eval 'func_basename ()
681 # func_dirname FILE APPEND NONDIR_REPLACEMENT
682 # -------------------------------------------
683 # Compute the dirname of FILE. If nonempty, add APPEND to the result,
684 # otherwise set result to NONDIR_REPLACEMENT.
685 eval 'func_dirname ()
693 # func_dirname_and_basename FILE APPEND NONDIR_REPLACEMENT
694 # --------------------------------------------------------
695 # Perform func_basename and func_dirname in a single function
697 # dirname: Compute the dirname of FILE. If nonempty,
698 # add APPEND to the result, otherwise set result
699 # to NONDIR_REPLACEMENT.
700 # value returned in "$func_dirname_result"
701 # basename: Compute filename of FILE.
702 # value retuned in "$func_basename_result"
703 # For efficiency, we do not delegate to the functions above but instead
704 # duplicate the functionality here.
705 eval 'func_dirname_and_basename ()
716 # Echo program name prefixed message.
725 for _G_line in $_G_message; do
727 $ECHO "$progname: $_G_line"
733 # func_echo_all ARG...
734 # --------------------
735 # Invoke $ECHO with all args, space-separated.
742 # func_echo_infix_1 INFIX ARG...
743 # ------------------------------
744 # Echo program name, followed by INFIX on the first line, with any
745 # additional lines not showing INFIX.
754 _G_prefix="$progname: $_G_infix: "
757 # Strip color escape sequences before counting printable length
758 for _G_tc in "$tc_reset" "$tc_bold" "$tc_standout" "$tc_red" "$tc_green" "$tc_blue" "$tc_cyan"
760 test -n "$_G_tc" && {
761 _G_esc_tc=`$ECHO "$_G_tc" | $SED "$sed_make_literal_regex"`
762 _G_indent=`$ECHO "$_G_indent" | $SED "s|$_G_esc_tc||g"`
765 _G_indent="$progname: "`echo "$_G_indent" | $SED 's|.| |g'`" " ## exclude from sc_prohibit_nested_quotes
767 func_echo_infix_1_IFS=$IFS
769 for _G_line in $_G_message; do
770 IFS=$func_echo_infix_1_IFS
771 $ECHO "$_G_prefix$tc_bold$_G_line$tc_reset" >&2
774 IFS=$func_echo_infix_1_IFS
780 # Echo program name prefixed message to standard error.
787 func_echo_infix_1 " $tc_standout${tc_red}error$tc_reset" "$*" >&2
791 # func_fatal_error ARG...
792 # -----------------------
793 # Echo program name prefixed message to standard error, and exit.
803 # func_grep EXPRESSION FILENAME
804 # -----------------------------
805 # Check whether EXPRESSION matches any line of FILENAME, without output.
810 $GREP "$1" "$2" >/dev/null 2>&1
816 # Set func_len_result to the length of STRING. STRING may not
817 # start with a hyphen.
818 test -z "$_G_HAVE_XSI_OPS" \
820 test 5aa/bb/cc = "${#x}${x%%/*}${x%/*}${x#*/}${x##*/}"') 2>/dev/null \
821 && _G_HAVE_XSI_OPS=yes
823 if test yes = "$_G_HAVE_XSI_OPS"; then
828 func_len_result=${#1}
835 func_len_result=`expr "$1" : ".*" 2>/dev/null || echo $max_cmd_len`
840 # func_mkdir_p DIRECTORY-PATH
841 # ---------------------------
842 # Make sure the entire path to DIRECTORY-PATH is available.
850 if test -n "$_G_directory_path" && test : != "$opt_dry_run"; then
852 # Protect directory names starting with '-'
853 case $_G_directory_path in
854 -*) _G_directory_path=./$_G_directory_path ;;
857 # While some portion of DIR does not yet exist...
858 while test ! -d "$_G_directory_path"; do
859 # ...make a list in topmost first order. Use a colon delimited
860 # list incase some portion of path contains whitespace.
861 _G_dir_list=$_G_directory_path:$_G_dir_list
863 # If the last portion added has no slash in it, the list is done
864 case $_G_directory_path in */*) ;; *) break ;; esac
866 # ...otherwise throw away the child directory and loop
867 _G_directory_path=`$ECHO "$_G_directory_path" | $SED -e "$sed_dirname"`
869 _G_dir_list=`$ECHO "$_G_dir_list" | $SED 's|:*$||'`
871 func_mkdir_p_IFS=$IFS; IFS=:
872 for _G_dir in $_G_dir_list; do
873 IFS=$func_mkdir_p_IFS
874 # mkdir can fail with a 'File exist' error if two processes
875 # try to create one of the directories concurrently. Don't
877 $MKDIR "$_G_dir" 2>/dev/null || :
879 IFS=$func_mkdir_p_IFS
881 # Bail out if we (or some other process) failed to create a directory.
882 test -d "$_G_directory_path" || \
883 func_fatal_error "Failed to create '$1'"
888 # func_mktempdir [BASENAME]
889 # -------------------------
890 # Make a temporary directory that won't clash with other running
891 # libtool processes, and avoids race conditions if possible. If
892 # given, BASENAME is the basename for that directory.
897 _G_template=${TMPDIR-/tmp}/${1-$progname}
899 if test : = "$opt_dry_run"; then
900 # Return a directory name, but don't create it in dry-run mode
901 _G_tmpdir=$_G_template-$$
904 # If mktemp works, use that first and foremost
905 _G_tmpdir=`mktemp -d "$_G_template-XXXXXXXX" 2>/dev/null`
907 if test ! -d "$_G_tmpdir"; then
908 # Failing that, at least try and use $RANDOM to avoid a race
909 _G_tmpdir=$_G_template-${RANDOM-0}$$
911 func_mktempdir_umask=`umask`
914 umask $func_mktempdir_umask
917 # If we're not in dry-run mode, bomb out on failure
918 test -d "$_G_tmpdir" || \
919 func_fatal_error "cannot create temporary directory '$_G_tmpdir'"
926 # func_normal_abspath PATH
927 # ------------------------
928 # Remove doubled-up and trailing slashes, "." path components,
929 # and cancel out any ".." path components in PATH after making
930 # it an absolute path.
931 func_normal_abspath ()
935 # These SED scripts presuppose an absolute path with a trailing slash.
936 _G_pathcar='s|^/\([^/]*\).*$|\1|'
937 _G_pathcdr='s|^/[^/]*||'
938 _G_removedotparts=':dotsl
942 _G_collapseslashes='s|/\{1,\}|/|g'
943 _G_finalslash='s|/*$|/|'
945 # Start from root dir and reassemble the path.
946 func_normal_abspath_result=
947 func_normal_abspath_tpath=$1
948 func_normal_abspath_altnamespace=
949 case $func_normal_abspath_tpath in
951 # Empty path, that just means $cwd.
952 func_stripname '' '/' "`pwd`"
953 func_normal_abspath_result=$func_stripname_result
956 # The next three entries are used to spot a run of precisely
957 # two leading slashes without using negated character classes;
958 # we take advantage of case's first-match behaviour.
960 # Unusual form of absolute path, do nothing.
963 # Not necessarily an ordinary path; POSIX reserves leading '//'
964 # and for example Cygwin uses it to access remote file shares
965 # over CIFS/SMB, so we conserve a leading double slash if found.
966 func_normal_abspath_altnamespace=/
969 # Absolute path, do nothing.
972 # Relative path, prepend $cwd.
973 func_normal_abspath_tpath=`pwd`/$func_normal_abspath_tpath
977 # Cancel out all the simple stuff to save iterations. We also want
978 # the path to end with a slash for ease of parsing, so make sure
979 # there is one (and only one) here.
980 func_normal_abspath_tpath=`$ECHO "$func_normal_abspath_tpath" | $SED \
981 -e "$_G_removedotparts" -e "$_G_collapseslashes" -e "$_G_finalslash"`
983 # Processed it all yet?
984 if test / = "$func_normal_abspath_tpath"; then
985 # If we ascended to the root using ".." the result may be empty now.
986 if test -z "$func_normal_abspath_result"; then
987 func_normal_abspath_result=/
991 func_normal_abspath_tcomponent=`$ECHO "$func_normal_abspath_tpath" | $SED \
993 func_normal_abspath_tpath=`$ECHO "$func_normal_abspath_tpath" | $SED \
995 # Figure out what to do with it
996 case $func_normal_abspath_tcomponent in
998 # Trailing empty path component, ignore it.
1001 # Parent dir; strip last assembled component from result.
1002 func_dirname "$func_normal_abspath_result"
1003 func_normal_abspath_result=$func_dirname_result
1006 # Actual path component, append it.
1007 func_append func_normal_abspath_result "/$func_normal_abspath_tcomponent"
1011 # Restore leading double-slash if one was found on entry.
1012 func_normal_abspath_result=$func_normal_abspath_altnamespace$func_normal_abspath_result
1016 # func_notquiet ARG...
1017 # --------------------
1018 # Echo program name prefixed message only when not in quiet mode.
1023 $opt_quiet || func_echo ${1+"$@"}
1025 # A bug in bash halts the script if the last line of a function
1026 # fails when set -e is in force, so we need another command to
1032 # func_relative_path SRCDIR DSTDIR
1033 # --------------------------------
1034 # Set func_relative_path_result to the relative path from SRCDIR to DSTDIR.
1035 func_relative_path ()
1039 func_relative_path_result=
1040 func_normal_abspath "$1"
1041 func_relative_path_tlibdir=$func_normal_abspath_result
1042 func_normal_abspath "$2"
1043 func_relative_path_tbindir=$func_normal_abspath_result
1045 # Ascend the tree starting from libdir
1047 # check if we have found a prefix of bindir
1048 case $func_relative_path_tbindir in
1049 $func_relative_path_tlibdir)
1050 # found an exact match
1051 func_relative_path_tcancelled=
1054 $func_relative_path_tlibdir*)
1055 # found a matching prefix
1056 func_stripname "$func_relative_path_tlibdir" '' "$func_relative_path_tbindir"
1057 func_relative_path_tcancelled=$func_stripname_result
1058 if test -z "$func_relative_path_result"; then
1059 func_relative_path_result=.
1064 func_dirname $func_relative_path_tlibdir
1065 func_relative_path_tlibdir=$func_dirname_result
1066 if test -z "$func_relative_path_tlibdir"; then
1067 # Have to descend all the way to the root!
1068 func_relative_path_result=../$func_relative_path_result
1069 func_relative_path_tcancelled=$func_relative_path_tbindir
1072 func_relative_path_result=../$func_relative_path_result
1077 # Now calculate path; take care to avoid doubling-up slashes.
1078 func_stripname '' '/' "$func_relative_path_result"
1079 func_relative_path_result=$func_stripname_result
1080 func_stripname '/' '/' "$func_relative_path_tcancelled"
1081 if test -n "$func_stripname_result"; then
1082 func_append func_relative_path_result "/$func_stripname_result"
1085 # Normalisation. If bindir is libdir, return '.' else relative path.
1086 if test -n "$func_relative_path_result"; then
1087 func_stripname './' '' "$func_relative_path_result"
1088 func_relative_path_result=$func_stripname_result
1091 test -n "$func_relative_path_result" || func_relative_path_result=.
1097 # func_quote_for_eval ARG...
1098 # --------------------------
1099 # Aesthetically quote ARGs to be evaled later.
1100 # This function returns two values:
1101 # i) func_quote_for_eval_result
1102 # double-quoted, suitable for a subsequent eval
1103 # ii) func_quote_for_eval_unquoted_result
1104 # has all characters that are still active within double
1105 # quotes backslashified.
1106 func_quote_for_eval ()
1110 func_quote_for_eval_unquoted_result=
1111 func_quote_for_eval_result=
1112 while test 0 -lt $#; do
1115 _G_unquoted_arg=`printf '%s\n' "$1" |$SED "$sed_quote_subst"` ;;
1117 _G_unquoted_arg=$1 ;;
1119 if test -n "$func_quote_for_eval_unquoted_result"; then
1120 func_append func_quote_for_eval_unquoted_result " $_G_unquoted_arg"
1122 func_append func_quote_for_eval_unquoted_result "$_G_unquoted_arg"
1125 case $_G_unquoted_arg in
1126 # Double-quote args containing shell metacharacters to delay
1127 # word splitting, command substitution and variable expansion
1128 # for a subsequent eval.
1129 # Many Bourne shells cannot handle close brackets correctly
1130 # in scan sets, so we specify it separately.
1131 *[\[\~\#\^\&\*\(\)\{\}\|\;\<\>\?\'\ \ ]*|*]*|"")
1132 _G_quoted_arg=\"$_G_unquoted_arg\"
1135 _G_quoted_arg=$_G_unquoted_arg
1139 if test -n "$func_quote_for_eval_result"; then
1140 func_append func_quote_for_eval_result " $_G_quoted_arg"
1142 func_append func_quote_for_eval_result "$_G_quoted_arg"
1149 # func_quote_for_expand ARG
1150 # -------------------------
1151 # Aesthetically quote ARG to be evaled later; same as above,
1152 # but do not quote variable references.
1153 func_quote_for_expand ()
1159 _G_arg=`$ECHO "$1" | $SED \
1160 -e "$sed_double_quote_subst" -e "$sed_double_backslash"` ;;
1166 # Double-quote args containing shell metacharacters to delay
1167 # word splitting and command substitution for a subsequent eval.
1168 # Many Bourne shells cannot handle close brackets correctly
1169 # in scan sets, so we specify it separately.
1170 *[\[\~\#\^\&\*\(\)\{\}\|\;\<\>\?\'\ \ ]*|*]*|"")
1175 func_quote_for_expand_result=$_G_arg
1179 # func_stripname PREFIX SUFFIX NAME
1180 # ---------------------------------
1181 # strip PREFIX and SUFFIX from NAME, and store in func_stripname_result.
1182 # PREFIX and SUFFIX must not contain globbing or regex special
1183 # characters, hashes, percent signs, but SUFFIX may contain a leading
1184 # dot (in which case that matches only a dot).
1185 if test yes = "$_G_HAVE_XSI_OPS"; then
1186 eval 'func_stripname ()
1190 # pdksh 5.2.14 does not do ${X%$Y} correctly if both X and Y are
1191 # positional parameters, so assign one to ordinary variable first.
1192 func_stripname_result=$3
1193 func_stripname_result=${func_stripname_result#"$1"}
1194 func_stripname_result=${func_stripname_result%"$2"}
1202 .*) func_stripname_result=`$ECHO "$3" | $SED -e "s%^$1%%" -e "s%\\\\$2\$%%"`;;
1203 *) func_stripname_result=`$ECHO "$3" | $SED -e "s%^$1%%" -e "s%$2\$%%"`;;
1209 # func_show_eval CMD [FAIL_EXP]
1210 # -----------------------------
1211 # Unless opt_quiet is true, then output CMD. Then, if opt_dryrun is
1212 # not true, evaluate CMD. If the evaluation of CMD fails, and FAIL_EXP
1213 # is given, then evaluate it.
1219 _G_fail_exp=${2-':'}
1221 func_quote_for_expand "$_G_cmd"
1222 eval "func_notquiet $func_quote_for_expand_result"
1227 if test 0 -ne "$_G_status"; then
1228 eval "(exit $_G_status); $_G_fail_exp"
1234 # func_show_eval_locale CMD [FAIL_EXP]
1235 # ------------------------------------
1236 # Unless opt_quiet is true, then output CMD. Then, if opt_dryrun is
1237 # not true, evaluate CMD. If the evaluation of CMD fails, and FAIL_EXP
1238 # is given, then evaluate it. Use the saved locale for evaluation.
1239 func_show_eval_locale ()
1244 _G_fail_exp=${2-':'}
1247 func_quote_for_expand "$_G_cmd"
1248 eval "func_echo $func_quote_for_expand_result"
1252 eval "$_G_user_locale
1255 eval "$_G_safe_locale"
1256 if test 0 -ne "$_G_status"; then
1257 eval "(exit $_G_status); $_G_fail_exp"
1265 # Turn $1 into a string suitable for a shell variable name.
1266 # Result is stored in $func_tr_sh_result. All characters
1267 # not in the set a-zA-Z0-9_ are replaced with '_'. Further,
1268 # if $1 begins with a digit, a '_' is prepended as well.
1274 [0-9]* | *[!a-zA-Z0-9_]*)
1275 func_tr_sh_result=`$ECHO "$1" | $SED -e 's/^\([0-9]\)/_\1/' -e 's/[^a-zA-Z0-9_]/_/g'`
1278 func_tr_sh_result=$1
1284 # func_verbose ARG...
1285 # -------------------
1286 # Echo program name prefixed message in verbose mode only.
1291 $opt_verbose && func_echo "$*"
1297 # func_warn_and_continue ARG...
1298 # -----------------------------
1299 # Echo program name prefixed warning message to standard error.
1300 func_warn_and_continue ()
1304 $require_term_colors
1306 func_echo_infix_1 "${tc_red}warning$tc_reset" "$*" >&2
1310 # func_warning CATEGORY ARG...
1311 # ----------------------------
1312 # Echo program name prefixed warning message to standard error. Warning
1313 # messages can be filtered according to CATEGORY, where this function
1314 # elides messages where CATEGORY is not listed in the global variable
1315 # 'opt_warning_types'.
1320 # CATEGORY must be in the warning_categories list!
1321 case " $warning_categories " in
1323 *) func_internal_error "invalid warning category '$1'" ;;
1329 case " $opt_warning_types " in
1330 *" $_G_category "*) $warning_func ${1+"$@"} ;;
1335 # func_sort_ver VER1 VER2
1336 # -----------------------
1337 # 'sort -V' is not generally available.
1338 # Note this deviates from the version comparison in automake
1339 # in that it treats 1.5 < 1.5.0, and treats 1.4.4a < 1.4-p3a
1340 # but this should suffice as we won't be specifying old
1341 # version formats or redundant trailing .0 in bootstrap.conf.
1342 # If we did want full compatibility then we should probably
1343 # use m4_version_compare from autoconf.
1348 printf '%s\n%s\n' "$1" "$2" \
1349 | 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
1352 # func_lt_ver PREV CURR
1353 # ---------------------
1354 # Return true if PREV and CURR are in the correct order according to
1355 # func_sort_ver, otherwise false. Use it like this:
1357 # func_lt_ver "$prev_ver" "$proposed_ver" || func_fatal_error "..."
1362 test "x$1" = x`func_sort_ver "$1" "$2" | $SED 1q`
1367 # mode: shell-script
1369 # eval: (add-hook 'before-save-hook 'time-stamp)
1370 # time-stamp-pattern: "10/scriptversion=%:y-%02m-%02d.%02H; # UTC"
1371 # time-stamp-time-zone: "UTC"
1375 # Set a version string for this script.
1376 scriptversion=2014-01-07.03; # UTC
1378 # A portable, pluggable option parser for Bourne shell.
1379 # Written by Gary V. Vaughan, 2010
1381 # Copyright (C) 2010-2015 Free Software Foundation, Inc.
1382 # This is free software; see the source for copying conditions. There is NO
1383 # warranty; not even for MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
1385 # This program is free software: you can redistribute it and/or modify
1386 # it under the terms of the GNU General Public License as published by
1387 # the Free Software Foundation, either version 3 of the License, or
1388 # (at your option) any later version.
1390 # This program is distributed in the hope that it will be useful,
1391 # but WITHOUT ANY WARRANTY; without even the implied warranty of
1392 # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
1393 # GNU General Public License for more details.
1395 # You should have received a copy of the GNU General Public License
1396 # along with this program. If not, see <http://www.gnu.org/licenses/>.
1398 # Please report bugs or propose patches to gary@gnu.org.
1405 # This file is a library for parsing options in your shell scripts along
1406 # with assorted other useful supporting features that you can make use
1409 # For the simplest scripts you might need only:
1412 # . relative/path/to/funclib.sh
1413 # . relative/path/to/options-parser
1415 # func_options ${1+"$@"}
1416 # eval set dummy "$func_options_result"; shift
1417 # ...rest of your script...
1419 # In order for the '--version' option to work, you will need to have a
1420 # suitably formatted comment like the one at the top of this file
1421 # starting with '# Written by ' and ending with '# warranty; '.
1423 # For '-h' and '--help' to work, you will also need a one line
1424 # description of your script's purpose in a comment directly above the
1425 # '# Written by ' line, like the one at the top of this file.
1427 # The default options also support '--debug', which will turn on shell
1428 # execution tracing (see the comment above debug_cmd below for another
1429 # use), and '--verbose' and the func_verbose function to allow your script
1430 # to display verbose messages only when your user has specified
1433 # After sourcing this file, you can plug processing for additional
1434 # options by amending the variables from the 'Configuration' section
1435 # below, and following the instructions in the 'Option parsing'
1436 # section further down.
1438 ## -------------- ##
1439 ## Configuration. ##
1440 ## -------------- ##
1442 # You should override these variables in your script after sourcing this
1443 # file so that they reflect the customisations you have added to the
1446 # The usage line for option parsing errors and the start of '-h' and
1447 # '--help' output messages. You can embed shell variables for delayed
1448 # expansion at the time the message is displayed, but you will need to
1449 # quote other shell meta-characters carefully to prevent them being
1450 # expanded when the contents are evaled.
1451 usage='$progpath [OPTION]...'
1453 # Short help message in response to '-h' and '--help'. Add to this or
1454 # override it after sourcing this library to reflect the full set of
1455 # options your script accepts.
1457 --debug enable verbose shell tracing
1458 -W, --warnings=CATEGORY
1459 report the warnings falling in CATEGORY [all]
1460 -v, --verbose verbosely report processing
1461 --version print version information and exit
1462 -h, --help print short or long help message and exit
1465 # Additional text appended to 'usage_message' in response to '--help'.
1467 Warning categories include:
1468 'all' show all warnings
1469 'none' turn off all the warnings
1470 'error' warnings are treated as fatal errors"
1472 # Help message printed before fatal option parsing errors.
1473 fatal_help="Try '\$progname --help' for more information."
1477 ## ------------------------- ##
1478 ## Hook function management. ##
1479 ## ------------------------- ##
1481 # This section contains functions for adding, removing, and running hooks
1482 # to the main code. A hook is just a named list of of function, that can
1483 # be run in order later on.
1485 # func_hookable FUNC_NAME
1486 # -----------------------
1487 # Declare that FUNC_NAME will run hooks added with
1488 # 'func_add_hook FUNC_NAME ...'.
1493 func_append hookable_fns " $1"
1497 # func_add_hook FUNC_NAME HOOK_FUNC
1498 # ---------------------------------
1499 # Request that FUNC_NAME call HOOK_FUNC before it returns. FUNC_NAME must
1500 # first have been declared "hookable" by a call to 'func_hookable'.
1505 case " $hookable_fns " in
1507 *) func_fatal_error "'$1' does not accept hook functions." ;;
1510 eval func_append ${1}_hooks '" $2"'
1514 # func_remove_hook FUNC_NAME HOOK_FUNC
1515 # ------------------------------------
1516 # Remove HOOK_FUNC from the list of functions called by FUNC_NAME.
1521 eval ${1}_hooks='`$ECHO "\$'$1'_hooks" |$SED "s| '$2'||"`'
1525 # func_run_hooks FUNC_NAME [ARG]...
1526 # ---------------------------------
1527 # Run all hook functions registered to FUNC_NAME.
1528 # It is assumed that the list of hook functions contains nothing more
1529 # than a whitespace-delimited list of legal shell function names, and
1530 # no effort is wasted trying to catch shell meta-characters or preserve
1536 case " $hookable_fns " in
1538 *) func_fatal_error "'$1' does not support hook funcions.n" ;;
1541 eval _G_hook_fns=\$$1_hooks; shift
1543 for _G_hook in $_G_hook_fns; do
1544 eval $_G_hook '"$@"'
1546 # store returned options list back into positional
1547 # parameters for next 'cmd' execution.
1548 eval _G_hook_result=\$${_G_hook}_result
1549 eval set dummy "$_G_hook_result"; shift
1552 func_quote_for_eval ${1+"$@"}
1553 func_run_hooks_result=$func_quote_for_eval_result
1558 ## --------------- ##
1559 ## Option parsing. ##
1560 ## --------------- ##
1562 # In order to add your own option parsing hooks, you must accept the
1563 # full positional parameter list in your hook function, remove any
1564 # options that you action, and then pass back the remaining unprocessed
1565 # options in '<hooked_function_name>_result', escaped suitably for
1566 # 'eval'. Like this:
1568 # my_options_prep ()
1572 # # Extend the existing usage message.
1573 # usage_message=$usage_message'
1574 # -s, --silent don'\''t print informational messages
1577 # func_quote_for_eval ${1+"$@"}
1578 # my_options_prep_result=$func_quote_for_eval_result
1580 # func_add_hook func_options_prep my_options_prep
1583 # my_silent_option ()
1587 # # Note that for efficiency, we parse as many options as we can
1588 # # recognise in a loop before passing the remainder back to the
1589 # # caller on the first unrecognised argument we encounter.
1590 # while test $# -gt 0; do
1593 # --silent|-s) opt_silent=: ;;
1594 # # Separate non-argument short options:
1595 # -s*) func_split_short_opt "$_G_opt"
1596 # set dummy "$func_split_short_opt_name" \
1597 # "-$func_split_short_opt_arg" ${1+"$@"}
1600 # *) set dummy "$_G_opt" "$*"; shift; break ;;
1604 # func_quote_for_eval ${1+"$@"}
1605 # my_silent_option_result=$func_quote_for_eval_result
1607 # func_add_hook func_parse_options my_silent_option
1610 # my_option_validation ()
1614 # $opt_silent && $opt_verbose && func_fatal_help "\
1615 # '--silent' and '--verbose' options are mutually exclusive."
1617 # func_quote_for_eval ${1+"$@"}
1618 # my_option_validation_result=$func_quote_for_eval_result
1620 # func_add_hook func_validate_options my_option_validation
1622 # You'll alse need to manually amend $usage_message to reflect the extra
1623 # options you parse. It's preferable to append if you can, so that
1624 # multiple option parsing hooks can be added safely.
1627 # func_options [ARG]...
1628 # ---------------------
1629 # All the functions called inside func_options are hookable. See the
1630 # individual implementations for details.
1631 func_hookable func_options
1636 func_options_prep ${1+"$@"}
1637 eval func_parse_options \
1638 ${func_options_prep_result+"$func_options_prep_result"}
1639 eval func_validate_options \
1640 ${func_parse_options_result+"$func_parse_options_result"}
1642 eval func_run_hooks func_options \
1643 ${func_validate_options_result+"$func_validate_options_result"}
1645 # save modified positional parameters for caller
1646 func_options_result=$func_run_hooks_result
1650 # func_options_prep [ARG]...
1651 # --------------------------
1652 # All initialisations required before starting the option parse loop.
1653 # Note that when calling hook functions, we pass through the list of
1654 # positional parameters. If a hook function modifies that list, and
1655 # needs to propogate that back to rest of this script, then the complete
1656 # modified list must be put in 'func_run_hooks_result' before
1658 func_hookable func_options_prep
1659 func_options_prep ()
1667 func_run_hooks func_options_prep ${1+"$@"}
1669 # save modified positional parameters for caller
1670 func_options_prep_result=$func_run_hooks_result
1674 # func_parse_options [ARG]...
1675 # ---------------------------
1676 # The main option parsing loop.
1677 func_hookable func_parse_options
1678 func_parse_options ()
1682 func_parse_options_result=
1684 # this just eases exit handling
1685 while test $# -gt 0; do
1686 # Defer to hook functions for initial option parsing, so they
1687 # get priority in the event of reusing an option name.
1688 func_run_hooks func_parse_options ${1+"$@"}
1690 # Adjust func_parse_options positional parameters to match
1691 eval set dummy "$func_run_hooks_result"; shift
1693 # Break out of the loop if we already parsed every option.
1694 test $# -gt 0 || break
1699 --debug|-x) debug_cmd='set -x'
1700 func_echo "enabling shell trace mode"
1704 --no-warnings|--no-warning|--no-warn)
1705 set dummy --warnings none ${1+"$@"}
1709 --warnings|--warning|-W)
1710 test $# = 0 && func_missing_arg $_G_opt && break
1711 case " $warning_categories $1" in
1713 # trailing space prevents matching last $1 above
1714 func_append_uniq opt_warning_types " $1"
1717 opt_warning_types=$warning_categories
1720 opt_warning_types=none
1724 opt_warning_types=$warning_categories
1725 warning_func=func_fatal_error
1729 "unsupported warning category: '$1'"
1735 --verbose|-v) opt_verbose=: ;;
1736 --version) func_version ;;
1737 -\?|-h) func_usage ;;
1738 --help) func_help ;;
1740 # Separate optargs to long options (plugins may need this):
1741 --*=*) func_split_equals "$_G_opt"
1742 set dummy "$func_split_equals_lhs" \
1743 "$func_split_equals_rhs" ${1+"$@"}
1747 # Separate optargs to short options:
1749 func_split_short_opt "$_G_opt"
1750 set dummy "$func_split_short_opt_name" \
1751 "$func_split_short_opt_arg" ${1+"$@"}
1755 # Separate non-argument short options:
1757 func_split_short_opt "$_G_opt"
1758 set dummy "$func_split_short_opt_name" \
1759 "-$func_split_short_opt_arg" ${1+"$@"}
1764 -*) func_fatal_help "unrecognised option: '$_G_opt'" ;;
1765 *) set dummy "$_G_opt" ${1+"$@"}; shift; break ;;
1769 # save modified positional parameters for caller
1770 func_quote_for_eval ${1+"$@"}
1771 func_parse_options_result=$func_quote_for_eval_result
1775 # func_validate_options [ARG]...
1776 # ------------------------------
1777 # Perform any sanity checks on option settings and/or unconsumed
1779 func_hookable func_validate_options
1780 func_validate_options ()
1784 # Display all warnings if -W was not given.
1785 test -n "$opt_warning_types" || opt_warning_types=" $warning_categories"
1787 func_run_hooks func_validate_options ${1+"$@"}
1789 # Bail if the options were screwed!
1790 $exit_cmd $EXIT_FAILURE
1792 # save modified positional parameters for caller
1793 func_validate_options_result=$func_run_hooks_result
1798 ## ----------------- ##
1799 ## Helper functions. ##
1800 ## ----------------- ##
1802 # This section contains the helper functions used by the rest of the
1803 # hookable option parser framework in ascii-betical order.
1806 # func_fatal_help ARG...
1807 # ----------------------
1808 # Echo program name prefixed message to standard error, followed by
1809 # a help hint, and exit.
1814 eval \$ECHO \""Usage: $usage"\"
1815 eval \$ECHO \""$fatal_help"\"
1816 func_error ${1+"$@"}
1823 # Echo long help message to standard output and exit.
1829 $ECHO "$long_help_message"
1834 # func_missing_arg ARGNAME
1835 # ------------------------
1836 # Echo program name prefixed message to standard error and set global
1842 func_error "Missing argument for '$1'."
1847 # func_split_equals STRING
1848 # ------------------------
1849 # Set func_split_equals_lhs and func_split_equals_rhs shell variables after
1850 # splitting STRING at the '=' sign.
1851 test -z "$_G_HAVE_XSI_OPS" \
1853 test 5aa/bb/cc = "${#x}${x%%/*}${x%/*}${x#*/}${x##*/}"') 2>/dev/null \
1854 && _G_HAVE_XSI_OPS=yes
1856 if test yes = "$_G_HAVE_XSI_OPS"
1858 # This is an XSI compatible shell, allowing a faster implementation...
1859 eval 'func_split_equals ()
1863 func_split_equals_lhs=${1%%=*}
1864 func_split_equals_rhs=${1#*=}
1865 test "x$func_split_equals_lhs" = "x$1" \
1866 && func_split_equals_rhs=
1869 # ...otherwise fall back to using expr, which is often a shell builtin.
1870 func_split_equals ()
1874 func_split_equals_lhs=`expr "x$1" : 'x\([^=]*\)'`
1875 func_split_equals_rhs=
1876 test "x$func_split_equals_lhs" = "x$1" \
1877 || func_split_equals_rhs=`expr "x$1" : 'x[^=]*=\(.*\)$'`
1879 fi #func_split_equals
1882 # func_split_short_opt SHORTOPT
1883 # -----------------------------
1884 # Set func_split_short_opt_name and func_split_short_opt_arg shell
1885 # variables after splitting SHORTOPT after the 2nd character.
1886 if test yes = "$_G_HAVE_XSI_OPS"
1888 # This is an XSI compatible shell, allowing a faster implementation...
1889 eval 'func_split_short_opt ()
1893 func_split_short_opt_arg=${1#??}
1894 func_split_short_opt_name=${1%"$func_split_short_opt_arg"}
1897 # ...otherwise fall back to using expr, which is often a shell builtin.
1898 func_split_short_opt ()
1902 func_split_short_opt_name=`expr "x$1" : 'x-\(.\)'`
1903 func_split_short_opt_arg=`expr "x$1" : 'x-.\(.*\)$'`
1905 fi #func_split_short_opt
1910 # Echo short help message to standard output and exit.
1916 $ECHO "Run '$progname --help |${PAGER-more}' for full usage"
1921 # func_usage_message
1922 # ------------------
1923 # Echo short help message to standard output.
1924 func_usage_message ()
1928 eval \$ECHO \""Usage: $usage"\"
1935 /^Written by/q' < "$progpath"
1937 eval \$ECHO \""$usage_message"\"
1943 # Echo version message to standard output and exit.
1948 printf '%s\n' "$progname $scriptversion"
1958 /^# Written by /,/# warranty; / {
1961 s|\((C)\)[ 0-9,-]*[ ,-]\([1-9][0-9]* \)|\1 \2|
1968 /^warranty; /q' < "$progpath"
1975 # mode: shell-script
1977 # eval: (add-hook 'before-save-hook 'time-stamp)
1978 # time-stamp-pattern: "10/scriptversion=%:y-%02m-%02d.%02H; # UTC"
1979 # time-stamp-time-zone: "UTC"
1982 # Set a version string.
1983 scriptversion='(GNU libtool) 2.4.6'
1988 # Libtool also displays the current mode in messages, so override
1989 # funclib.sh func_echo with this custom definition.
1998 for _G_line in $_G_message; do
2000 $ECHO "$progname${opt_mode+: $opt_mode}: $_G_line"
2006 # func_warning ARG...
2007 # -------------------
2008 # Libtool warnings are not categorized, so override funclib.sh
2009 # func_warning with this simpler definition.
2014 $warning_func ${1+"$@"}
2018 ## ---------------- ##
2019 ## Options parsing. ##
2020 ## ---------------- ##
2022 # Hook in the functions to make sure our own options are parsed during
2023 # the option parsing loop.
2025 usage='$progpath [OPTION]... [MODE-ARG]...'
2027 # Short help message in response to '-h'.
2028 usage_message="Options:
2029 --config show all configuration variables
2030 --debug enable verbose shell tracing
2031 -n, --dry-run display commands without modifying any files
2032 --features display basic configuration information and exit
2033 --mode=MODE use operation mode MODE
2034 --no-warnings equivalent to '-Wnone'
2035 --preserve-dup-deps don't remove duplicate dependency libraries
2036 --quiet, --silent don't print informational messages
2037 --tag=TAG use configuration variables from tag TAG
2038 -v, --verbose print more informational messages than default
2039 --version print version information
2040 -W, --warnings=CATEGORY report the warnings falling in CATEGORY [all]
2041 -h, --help, --help-all print short, long, or detailed help message
2044 # Additional text appended to 'usage_message' in response to '--help'.
2050 $ECHO "$long_help_message
2052 MODE must be one of the following:
2054 clean remove files from the build directory
2055 compile compile a source file into a libtool object
2056 execute automatically set library path, then run a program
2057 finish complete the installation of libtool libraries
2058 install install libraries or executables
2059 link create a library or an executable
2060 uninstall remove libraries from an installed directory
2062 MODE-ARGS vary depending on the MODE. When passed as first option,
2063 '--mode=MODE' may be abbreviated as 'MODE' or a unique abbreviation of that.
2064 Try '$progname --help --mode=MODE' for a more detailed description of MODE.
2066 When reporting a bug, please describe a test case to reproduce it and
2067 include the following information:
2072 compiler flags: $LTCFLAGS
2073 linker: $LD (gnu? $with_gnu_ld)
2074 version: $progname (GNU libtool) 2.4.6
2075 automake: `($AUTOMAKE --version) 2>/dev/null |$SED 1q`
2076 autoconf: `($AUTOCONF --version) 2>/dev/null |$SED 1q`
2078 Report bugs to <bug-libtool@gnu.org>.
2079 GNU libtool home page: <http://www.gnu.org/s/libtool/>.
2080 General help using GNU software: <http://www.gnu.org/gethelp/>."
2085 # func_lo2o OBJECT-NAME
2086 # ---------------------
2087 # Transform OBJECT-NAME from a '.lo' suffix to the platform specific
2090 lo2o=s/\\.lo\$/.$objext/
2091 o2lo=s/\\.$objext\$/.lo/
2093 if test yes = "$_G_HAVE_XSI_OPS"; then
2097 *.lo) func_lo2o_result=${1%.lo}.$objext ;;
2098 * ) func_lo2o_result=$1 ;;
2102 # func_xform LIBOBJ-OR-SOURCE
2103 # ---------------------------
2104 # Transform LIBOBJ-OR-SOURCE from a '.o' or '.c' (or otherwise)
2105 # suffix to a '.lo' libtool-object suffix.
2108 func_xform_result=${1%.*}.lo
2111 # ...otherwise fall back to using sed.
2114 func_lo2o_result=`$ECHO "$1" | $SED "$lo2o"`
2119 func_xform_result=`$ECHO "$1" | $SED 's|\.[^.]*$|.lo|'`
2124 # func_fatal_configuration ARG...
2125 # -------------------------------
2126 # Echo program name prefixed message to standard error, followed by
2127 # a configuration failure hint, and exit.
2128 func_fatal_configuration ()
2130 func__fatal_error ${1+"$@"} \
2131 "See the $PACKAGE documentation for more information." \
2132 "Fatal configuration error."
2138 # Display the configuration for all the tags in this script.
2141 re_begincf='^# ### BEGIN LIBTOOL'
2142 re_endcf='^# ### END LIBTOOL'
2144 # Default configuration.
2145 $SED "1,/$re_begincf CONFIG/d;/$re_endcf CONFIG/,\$d" < "$progpath"
2147 # Now print the configurations for the tags.
2148 for tagname in $taglist; do
2149 $SED -n "/$re_begincf TAG CONFIG: $tagname\$/,/$re_endcf TAG CONFIG: $tagname\$/p" < "$progpath"
2158 # Display the features supported by this script.
2162 if test yes = "$build_libtool_libs"; then
2163 echo "enable shared libraries"
2165 echo "disable shared libraries"
2167 if test yes = "$build_old_libs"; then
2168 echo "enable static libraries"
2170 echo "disable static libraries"
2177 # func_enable_tag TAGNAME
2178 # -----------------------
2179 # Verify that TAGNAME is valid, and either flag an error and exit, or
2180 # enable the TAGNAME tag. We also add TAGNAME to the global $taglist
2187 re_begincf="^# ### BEGIN LIBTOOL TAG CONFIG: $tagname\$"
2188 re_endcf="^# ### END LIBTOOL TAG CONFIG: $tagname\$"
2189 sed_extractcf=/$re_begincf/,/$re_endcf/p
2194 func_fatal_error "invalid tag name: $tagname"
2198 # Don't test for the "default" C tag, as we know it's
2199 # there but not specially marked.
2203 if $GREP "$re_begincf" "$progpath" >/dev/null 2>&1; then
2204 taglist="$taglist $tagname"
2206 # Evaluate the configuration. Be careful to quote the path
2207 # and the sed script, to avoid splitting on whitespace, but
2208 # also don't use non-portable quotes within backquotes within
2209 # quotes we have to do it in 2 steps:
2210 extractedcf=`$SED -n -e "$sed_extractcf" < "$progpath"`
2213 func_error "ignoring unknown tag $tagname"
2220 # func_check_version_match
2221 # ------------------------
2222 # Ensure that we are using m4 macros, and libtool script from the same
2223 # release of libtool.
2224 func_check_version_match ()
2226 if test "$package_revision" != "$macro_revision"; then
2227 if test "$VERSION" != "$macro_version"; then
2228 if test -z "$macro_version"; then
2230 $progname: Version mismatch error. This is $PACKAGE $VERSION, but the
2231 $progname: definition of this LT_INIT comes from an older release.
2232 $progname: You should recreate aclocal.m4 with macros from $PACKAGE $VERSION
2233 $progname: and run autoconf again.
2237 $progname: Version mismatch error. This is $PACKAGE $VERSION, but the
2238 $progname: definition of this LT_INIT comes from $PACKAGE $macro_version.
2239 $progname: You should recreate aclocal.m4 with macros from $PACKAGE $VERSION
2240 $progname: and run autoconf again.
2245 $progname: Version mismatch error. This is $PACKAGE $VERSION, revision $package_revision,
2246 $progname: but the definition of this LT_INIT comes from revision $macro_revision.
2247 $progname: You should recreate aclocal.m4 with macros from revision $package_revision
2248 $progname: of $PACKAGE $VERSION and run autoconf again.
2257 # libtool_options_prep [ARG]...
2258 # -----------------------------
2259 # Preparation for options parsed by libtool.
2260 libtool_options_prep ()
2270 opt_preserve_dup_deps=false
2276 # Shorthand for --mode=foo, only valid as the first argument
2279 shift; set dummy --mode clean ${1+"$@"}; shift
2281 compile|compil|compi|comp|com|co|c)
2282 shift; set dummy --mode compile ${1+"$@"}; shift
2284 execute|execut|execu|exec|exe|ex|e)
2285 shift; set dummy --mode execute ${1+"$@"}; shift
2287 finish|finis|fini|fin|fi|f)
2288 shift; set dummy --mode finish ${1+"$@"}; shift
2290 install|instal|insta|inst|ins|in|i)
2291 shift; set dummy --mode install ${1+"$@"}; shift
2294 shift; set dummy --mode link ${1+"$@"}; shift
2296 uninstall|uninstal|uninsta|uninst|unins|unin|uni|un|u)
2297 shift; set dummy --mode uninstall ${1+"$@"}; shift
2301 # Pass back the list of options.
2302 func_quote_for_eval ${1+"$@"}
2303 libtool_options_prep_result=$func_quote_for_eval_result
2305 func_add_hook func_options_prep libtool_options_prep
2308 # libtool_parse_options [ARG]...
2309 # ---------------------------------
2310 # Provide handling for libtool specific options.
2311 libtool_parse_options ()
2315 # Perform our own loop to consume as many options as possible in
2317 while test $# -gt 0; do
2321 --dry-run|--dryrun|-n)
2325 --config) func_config ;;
2328 opt_dlopen="${opt_dlopen+$opt_dlopen
2333 --preserve-dup-deps)
2334 opt_preserve_dup_deps=: ;;
2336 --features) func_features ;;
2338 --finish) set dummy --mode finish ${1+"$@"}; shift ;;
2340 --help) opt_help=: ;;
2342 --help-all) opt_help=': help-all' ;;
2344 --mode) test $# = 0 && func_missing_arg $_G_opt && break
2347 # Valid mode arguments:
2348 clean|compile|execute|finish|install|link|relink|uninstall) ;;
2350 # Catch anything else as an error
2351 *) func_error "invalid argument for $_G_opt"
2359 --no-silent|--no-quiet)
2361 func_append preserve_args " $_G_opt"
2364 --no-warnings|--no-warning|--no-warn)
2366 func_append preserve_args " $_G_opt"
2371 func_append preserve_args " $_G_opt"
2377 func_append preserve_args " $_G_opt"
2380 --tag) test $# = 0 && func_missing_arg $_G_opt && break
2382 func_append preserve_args " $_G_opt $1"
2383 func_enable_tag "$1"
2387 --verbose|-v) opt_quiet=false
2389 func_append preserve_args " $_G_opt"
2392 # An option not handled by this hook function:
2393 *) set dummy "$_G_opt" ${1+"$@"}; shift; break ;;
2398 # save modified positional parameters for caller
2399 func_quote_for_eval ${1+"$@"}
2400 libtool_parse_options_result=$func_quote_for_eval_result
2402 func_add_hook func_parse_options libtool_parse_options
2406 # libtool_validate_options [ARG]...
2407 # ---------------------------------
2408 # Perform any sanity checks on option settings and/or unconsumed
2410 libtool_validate_options ()
2412 # save first non-option argument
2413 if test 0 -lt $#; then
2419 test : = "$debug_cmd" || func_append preserve_args " --debug"
2422 # Solaris2 added to fix http://debbugs.gnu.org/cgi/bugreport.cgi?bug=16452
2423 # see also: http://gcc.gnu.org/bugzilla/show_bug.cgi?id=59788
2424 *cygwin* | *mingw* | *pw32* | *cegcc* | *solaris2* | *os2*)
2425 # don't eliminate duplications in $postdeps and $predeps
2426 opt_duplicate_compiler_generated_deps=:
2429 opt_duplicate_compiler_generated_deps=$opt_preserve_dup_deps
2434 # Sanity checks first:
2435 func_check_version_match
2437 test yes != "$build_libtool_libs" \
2438 && test yes != "$build_old_libs" \
2439 && func_fatal_configuration "not configured to build any kind of library"
2442 eval std_shrext=\"$shrext_cmds\"
2444 # Only execute mode is allowed to have -dlopen flags.
2445 if test -n "$opt_dlopen" && test execute != "$opt_mode"; then
2446 func_error "unrecognized option '-dlopen'"
2451 # Change the help message to a mode-specific one.
2453 help="Try '$progname --help --mode=$opt_mode' for more information."
2456 # Pass back the unparsed argument list
2457 func_quote_for_eval ${1+"$@"}
2458 libtool_validate_options_result=$func_quote_for_eval_result
2460 func_add_hook func_validate_options libtool_validate_options
2463 # Process options as early as possible so that --help and --version
2464 # can return quickly.
2465 func_options ${1+"$@"}
2466 eval set dummy "$func_options_result"; shift
2474 magic='%%%MAGIC variable%%%'
2475 magic_exe='%%%MAGIC EXE variable%%%'
2481 # If this variable is set in any of the actions, the command in it
2482 # will be execed at the end. This prevents here-documents from being
2483 # left over by shells.
2487 # A function that is used when there is no print builtin or printf.
2488 func_fallback_echo ()
2490 eval 'cat <<_LTECHO_EOF
2495 # func_generated_by_libtool
2496 # True iff stdin has been generated by Libtool. This function is only
2497 # a basic sanity check; it will hardly flush out determined imposters.
2498 func_generated_by_libtool_p ()
2500 $GREP "^# Generated by .*$PACKAGE" > /dev/null 2>&1
2504 # True iff FILE is a libtool '.la' library or '.lo' object file.
2505 # This function is only a basic sanity check; it will hardly flush out
2506 # determined imposters.
2510 $SED -e 4q "$1" 2>/dev/null | func_generated_by_libtool_p
2513 # func_lalib_unsafe_p file
2514 # True iff FILE is a libtool '.la' library or '.lo' object file.
2515 # This function implements the same check as func_lalib_p without
2516 # resorting to external programs. To this end, it redirects stdin and
2517 # closes it afterwards, without saving the original file descriptor.
2518 # As a safety measure, use it only where a negative result would be
2519 # fatal anyway. Works if 'file' does not exist.
2520 func_lalib_unsafe_p ()
2523 if test -f "$1" && test -r "$1" && exec 5<&0 <"$1"; then
2524 for lalib_p_l in 1 2 3 4
2527 case $lalib_p_line in
2528 \#\ Generated\ by\ *$PACKAGE* ) lalib_p=yes; break;;
2533 test yes = "$lalib_p"
2536 # func_ltwrapper_script_p file
2537 # True iff FILE is a libtool wrapper script
2538 # This function is only a basic sanity check; it will hardly flush out
2539 # determined imposters.
2540 func_ltwrapper_script_p ()
2543 $lt_truncate_bin < "$1" 2>/dev/null | func_generated_by_libtool_p
2546 # func_ltwrapper_executable_p file
2547 # True iff FILE is a libtool wrapper executable
2548 # This function is only a basic sanity check; it will hardly flush out
2549 # determined imposters.
2550 func_ltwrapper_executable_p ()
2552 func_ltwrapper_exec_suffix=
2555 *) func_ltwrapper_exec_suffix=.exe ;;
2557 $GREP "$magic_exe" "$1$func_ltwrapper_exec_suffix" >/dev/null 2>&1
2560 # func_ltwrapper_scriptname file
2561 # Assumes file is an ltwrapper_executable
2562 # uses $file to determine the appropriate filename for a
2563 # temporary ltwrapper_script.
2564 func_ltwrapper_scriptname ()
2566 func_dirname_and_basename "$1" "" "."
2567 func_stripname '' '.exe' "$func_basename_result"
2568 func_ltwrapper_scriptname_result=$func_dirname_result/$objdir/${func_stripname_result}_ltshwrapper
2571 # func_ltwrapper_p file
2572 # True iff FILE is a libtool wrapper script or wrapper executable
2573 # This function is only a basic sanity check; it will hardly flush out
2574 # determined imposters.
2577 func_ltwrapper_script_p "$1" || func_ltwrapper_executable_p "$1"
2581 # func_execute_cmds commands fail_cmd
2582 # Execute tilde-delimited COMMANDS.
2583 # If FAIL_CMD is given, eval that upon failure.
2584 # FAIL_CMD may read-access the current command in variable CMD!
2585 func_execute_cmds ()
2589 save_ifs=$IFS; IFS='~'
2594 func_show_eval "$cmd" "${2-:}"
2601 # Source FILE, adding directory component if necessary.
2602 # Note that it is not necessary on cygwin/mingw to append a dot to
2603 # FILE even if both FILE and FILE.exe exist: automatic-append-.exe
2604 # behavior happens only for exec(3), not for open(2)! Also, sourcing
2605 # 'FILE.' does not work on cygwin managed mounts.
2611 */* | *\\*) . "$1" ;;
2617 # func_resolve_sysroot PATH
2618 # Replace a leading = in PATH with a sysroot. Store the result into
2619 # func_resolve_sysroot_result
2620 func_resolve_sysroot ()
2622 func_resolve_sysroot_result=$1
2623 case $func_resolve_sysroot_result in
2625 func_stripname '=' '' "$func_resolve_sysroot_result"
2626 func_resolve_sysroot_result=$lt_sysroot$func_stripname_result
2631 # func_replace_sysroot PATH
2632 # If PATH begins with the sysroot, replace it with = and
2633 # store the result into func_replace_sysroot_result.
2634 func_replace_sysroot ()
2636 case $lt_sysroot:$1 in
2638 func_stripname "$lt_sysroot" '' "$1"
2639 func_replace_sysroot_result='='$func_stripname_result
2642 # Including no sysroot.
2643 func_replace_sysroot_result=$1
2648 # func_infer_tag arg
2649 # Infer tagged configuration to use if any are available and
2650 # if one wasn't chosen via the "--tag" command line option.
2651 # Only attempt this if the compiler in the base compile
2652 # command doesn't match the default compiler.
2653 # arg is usually of the form 'gcc ...'
2658 if test -n "$available_tags" && test -z "$tagname"; then
2661 func_append_quoted CC_quoted "$arg"
2663 CC_expanded=`func_echo_all $CC`
2664 CC_quoted_expanded=`func_echo_all $CC_quoted`
2666 # Blanks in the command may have been stripped by the calling shell,
2667 # but not from the CC environment variable when configure was run.
2668 " $CC "* | "$CC "* | " $CC_expanded "* | "$CC_expanded "* | \
2669 " $CC_quoted"* | "$CC_quoted "* | " $CC_quoted_expanded "* | "$CC_quoted_expanded "*) ;;
2670 # Blanks at the start of $base_compile will cause this to fail
2671 # if we don't check for them as well.
2673 for z in $available_tags; do
2674 if $GREP "^# ### BEGIN LIBTOOL TAG CONFIG: $z$" < "$progpath" > /dev/null; then
2675 # Evaluate the configuration.
2676 eval "`$SED -n -e '/^# ### BEGIN LIBTOOL TAG CONFIG: '$z'$/,/^# ### END LIBTOOL TAG CONFIG: '$z'$/p' < $progpath`"
2679 # Double-quote args containing other shell metacharacters.
2680 func_append_quoted CC_quoted "$arg"
2682 CC_expanded=`func_echo_all $CC`
2683 CC_quoted_expanded=`func_echo_all $CC_quoted`
2685 " $CC "* | "$CC "* | " $CC_expanded "* | "$CC_expanded "* | \
2686 " $CC_quoted"* | "$CC_quoted "* | " $CC_quoted_expanded "* | "$CC_quoted_expanded "*)
2687 # The compiler in the base compile command matches
2688 # the one in the tagged configuration.
2689 # Assume this is the tagged configuration we want.
2696 # If $tagname still isn't set, then no tagged configuration
2697 # was found and let the user know that the "--tag" command
2698 # line option must be used.
2699 if test -z "$tagname"; then
2700 func_echo "unable to infer tagged configuration"
2701 func_fatal_error "specify a tag with '--tag'"
2703 # func_verbose "using $tagname tagged configuration"
2712 # func_write_libtool_object output_name pic_name nonpic_name
2713 # Create a libtool object file (analogous to a ".la" file),
2714 # but don't create it if we're doing a dry run.
2715 func_write_libtool_object ()
2718 if test yes = "$build_libtool_libs"; then
2724 if test yes = "$build_old_libs"; then
2731 cat >${write_libobj}T <<EOF
2732 # $write_libobj - a libtool object file
2733 # Generated by $PROGRAM (GNU $PACKAGE) $VERSION
2735 # Please DO NOT delete this file!
2736 # It is necessary for linking the library.
2738 # Name of the PIC object.
2739 pic_object=$write_lobj
2741 # Name of the non-PIC object
2742 non_pic_object=$write_oldobj
2745 $MV "${write_libobj}T" "$write_libobj"
2750 ##################################################
2751 # FILE NAME AND PATH CONVERSION HELPER FUNCTIONS #
2752 ##################################################
2754 # func_convert_core_file_wine_to_w32 ARG
2755 # Helper function used by file name conversion functions when $build is *nix,
2756 # and $host is mingw, cygwin, or some other w32 environment. Relies on a
2757 # correctly configured wine environment available, with the winepath program
2758 # in $build's $PATH.
2760 # ARG is the $build file name to be converted to w32 format.
2761 # Result is available in $func_convert_core_file_wine_to_w32_result, and will
2762 # be empty on error (or when ARG is empty)
2763 func_convert_core_file_wine_to_w32 ()
2767 func_convert_core_file_wine_to_w32_result=$1
2768 if test -n "$1"; then
2769 # Unfortunately, winepath does not exit with a non-zero error code, so we
2770 # are forced to check the contents of stdout. On the other hand, if the
2771 # command is not found, the shell will set an exit code of 127 and print
2772 # *an error message* to stdout. So we must check for both error code of
2773 # zero AND non-empty stdout, which explains the odd construction:
2774 func_convert_core_file_wine_to_w32_tmp=`winepath -w "$1" 2>/dev/null`
2775 if test "$?" -eq 0 && test -n "$func_convert_core_file_wine_to_w32_tmp"; then
2776 func_convert_core_file_wine_to_w32_result=`$ECHO "$func_convert_core_file_wine_to_w32_tmp" |
2777 $SED -e "$sed_naive_backslashify"`
2779 func_convert_core_file_wine_to_w32_result=
2783 # end: func_convert_core_file_wine_to_w32
2786 # func_convert_core_path_wine_to_w32 ARG
2787 # Helper function used by path conversion functions when $build is *nix, and
2788 # $host is mingw, cygwin, or some other w32 environment. Relies on a correctly
2789 # configured wine environment available, with the winepath program in $build's
2790 # $PATH. Assumes ARG has no leading or trailing path separator characters.
2792 # ARG is path to be converted from $build format to win32.
2793 # Result is available in $func_convert_core_path_wine_to_w32_result.
2794 # Unconvertible file (directory) names in ARG are skipped; if no directory names
2795 # are convertible, then the result may be empty.
2796 func_convert_core_path_wine_to_w32 ()
2800 # unfortunately, winepath doesn't convert paths, only file names
2801 func_convert_core_path_wine_to_w32_result=
2802 if test -n "$1"; then
2805 for func_convert_core_path_wine_to_w32_f in $1; do
2807 func_convert_core_file_wine_to_w32 "$func_convert_core_path_wine_to_w32_f"
2808 if test -n "$func_convert_core_file_wine_to_w32_result"; then
2809 if test -z "$func_convert_core_path_wine_to_w32_result"; then
2810 func_convert_core_path_wine_to_w32_result=$func_convert_core_file_wine_to_w32_result
2812 func_append func_convert_core_path_wine_to_w32_result ";$func_convert_core_file_wine_to_w32_result"
2819 # end: func_convert_core_path_wine_to_w32
2822 # func_cygpath ARGS...
2823 # Wrapper around calling the cygpath program via LT_CYGPATH. This is used when
2824 # when (1) $build is *nix and Cygwin is hosted via a wine environment; or (2)
2825 # $build is MSYS and $host is Cygwin, or (3) $build is Cygwin. In case (1) or
2826 # (2), returns the Cygwin file name or path in func_cygpath_result (input
2827 # file name or path is assumed to be in w32 format, as previously converted
2828 # from $build's *nix or MSYS format). In case (3), returns the w32 file name
2829 # or path in func_cygpath_result (input file name or path is assumed to be in
2830 # Cygwin format). Returns an empty string on error.
2832 # ARGS are passed to cygpath, with the last one being the file name or path to
2835 # Specify the absolute *nix (or w32) name to cygpath in the LT_CYGPATH
2836 # environment variable; do not put it in $PATH.
2841 if test -n "$LT_CYGPATH" && test -f "$LT_CYGPATH"; then
2842 func_cygpath_result=`$LT_CYGPATH "$@" 2>/dev/null`
2843 if test "$?" -ne 0; then
2844 # on failure, ensure result is empty
2845 func_cygpath_result=
2848 func_cygpath_result=
2849 func_error "LT_CYGPATH is empty or specifies non-existent file: '$LT_CYGPATH'"
2855 # func_convert_core_msys_to_w32 ARG
2856 # Convert file name or path ARG from MSYS format to w32 format. Return
2857 # result in func_convert_core_msys_to_w32_result.
2858 func_convert_core_msys_to_w32 ()
2862 # awkward: cmd appends spaces to result
2863 func_convert_core_msys_to_w32_result=`( cmd //c echo "$1" ) 2>/dev/null |
2864 $SED -e 's/[ ]*$//' -e "$sed_naive_backslashify"`
2866 #end: func_convert_core_msys_to_w32
2869 # func_convert_file_check ARG1 ARG2
2870 # Verify that ARG1 (a file name in $build format) was converted to $host
2871 # format in ARG2. Otherwise, emit an error message, but continue (resetting
2872 # func_to_host_file_result to ARG1).
2873 func_convert_file_check ()
2877 if test -z "$2" && test -n "$1"; then
2878 func_error "Could not determine host file name corresponding to"
2880 func_error "Continuing, but uninstalled executables may not work."
2882 func_to_host_file_result=$1
2885 # end func_convert_file_check
2888 # func_convert_path_check FROM_PATHSEP TO_PATHSEP FROM_PATH TO_PATH
2889 # Verify that FROM_PATH (a path in $build format) was converted to $host
2890 # format in TO_PATH. Otherwise, emit an error message, but continue, resetting
2891 # func_to_host_file_result to a simplistic fallback value (see below).
2892 func_convert_path_check ()
2896 if test -z "$4" && test -n "$3"; then
2897 func_error "Could not determine the host path corresponding to"
2899 func_error "Continuing, but uninstalled executables may not work."
2900 # Fallback. This is a deliberately simplistic "conversion" and
2901 # should not be "improved". See libtool.info.
2902 if test "x$1" != "x$2"; then
2903 lt_replace_pathsep_chars="s|$1|$2|g"
2904 func_to_host_path_result=`echo "$3" |
2905 $SED -e "$lt_replace_pathsep_chars"`
2907 func_to_host_path_result=$3
2911 # end func_convert_path_check
2914 # func_convert_path_front_back_pathsep FRONTPAT BACKPAT REPL ORIG
2915 # Modifies func_to_host_path_result by prepending REPL if ORIG matches FRONTPAT
2916 # and appending REPL if ORIG matches BACKPAT.
2917 func_convert_path_front_back_pathsep ()
2922 $1 ) func_to_host_path_result=$3$func_to_host_path_result
2926 $2 ) func_append func_to_host_path_result "$3"
2930 # end func_convert_path_front_back_pathsep
2933 ##################################################
2934 # $build to $host FILE NAME CONVERSION FUNCTIONS #
2935 ##################################################
2936 # invoked via '$to_host_file_cmd ARG'
2938 # In each case, ARG is the path to be converted from $build to $host format.
2939 # Result will be available in $func_to_host_file_result.
2942 # func_to_host_file ARG
2943 # Converts the file name ARG from $build format to $host format. Return result
2944 # in func_to_host_file_result.
2945 func_to_host_file ()
2949 $to_host_file_cmd "$1"
2951 # end func_to_host_file
2954 # func_to_tool_file ARG LAZY
2955 # converts the file name ARG from $build format to toolchain format. Return
2956 # result in func_to_tool_file_result. If the conversion in use is listed
2957 # in (the comma separated) LAZY, no conversion takes place.
2958 func_to_tool_file ()
2963 *,"$to_tool_file_cmd",*)
2964 func_to_tool_file_result=$1
2967 $to_tool_file_cmd "$1"
2968 func_to_tool_file_result=$func_to_host_file_result
2972 # end func_to_tool_file
2975 # func_convert_file_noop ARG
2976 # Copy ARG to func_to_host_file_result.
2977 func_convert_file_noop ()
2979 func_to_host_file_result=$1
2981 # end func_convert_file_noop
2984 # func_convert_file_msys_to_w32 ARG
2985 # Convert file name ARG from (mingw) MSYS to (mingw) w32 format; automatic
2986 # conversion to w32 is not available inside the cwrapper. Returns result in
2987 # func_to_host_file_result.
2988 func_convert_file_msys_to_w32 ()
2992 func_to_host_file_result=$1
2993 if test -n "$1"; then
2994 func_convert_core_msys_to_w32 "$1"
2995 func_to_host_file_result=$func_convert_core_msys_to_w32_result
2997 func_convert_file_check "$1" "$func_to_host_file_result"
2999 # end func_convert_file_msys_to_w32
3002 # func_convert_file_cygwin_to_w32 ARG
3003 # Convert file name ARG from Cygwin to w32 format. Returns result in
3004 # func_to_host_file_result.
3005 func_convert_file_cygwin_to_w32 ()
3009 func_to_host_file_result=$1
3010 if test -n "$1"; then
3011 # because $build is cygwin, we call "the" cygpath in $PATH; no need to use
3012 # LT_CYGPATH in this case.
3013 func_to_host_file_result=`cygpath -m "$1"`
3015 func_convert_file_check "$1" "$func_to_host_file_result"
3017 # end func_convert_file_cygwin_to_w32
3020 # func_convert_file_nix_to_w32 ARG
3021 # Convert file name ARG from *nix to w32 format. Requires a wine environment
3022 # and a working winepath. Returns result in func_to_host_file_result.
3023 func_convert_file_nix_to_w32 ()
3027 func_to_host_file_result=$1
3028 if test -n "$1"; then
3029 func_convert_core_file_wine_to_w32 "$1"
3030 func_to_host_file_result=$func_convert_core_file_wine_to_w32_result
3032 func_convert_file_check "$1" "$func_to_host_file_result"
3034 # end func_convert_file_nix_to_w32
3037 # func_convert_file_msys_to_cygwin ARG
3038 # Convert file name ARG from MSYS to Cygwin format. Requires LT_CYGPATH set.
3039 # Returns result in func_to_host_file_result.
3040 func_convert_file_msys_to_cygwin ()
3044 func_to_host_file_result=$1
3045 if test -n "$1"; then
3046 func_convert_core_msys_to_w32 "$1"
3047 func_cygpath -u "$func_convert_core_msys_to_w32_result"
3048 func_to_host_file_result=$func_cygpath_result
3050 func_convert_file_check "$1" "$func_to_host_file_result"
3052 # end func_convert_file_msys_to_cygwin
3055 # func_convert_file_nix_to_cygwin ARG
3056 # Convert file name ARG from *nix to Cygwin format. Requires Cygwin installed
3057 # in a wine environment, working winepath, and LT_CYGPATH set. Returns result
3058 # in func_to_host_file_result.
3059 func_convert_file_nix_to_cygwin ()
3063 func_to_host_file_result=$1
3064 if test -n "$1"; then
3065 # convert from *nix to w32, then use cygpath to convert from w32 to cygwin.
3066 func_convert_core_file_wine_to_w32 "$1"
3067 func_cygpath -u "$func_convert_core_file_wine_to_w32_result"
3068 func_to_host_file_result=$func_cygpath_result
3070 func_convert_file_check "$1" "$func_to_host_file_result"
3072 # end func_convert_file_nix_to_cygwin
3075 #############################################
3076 # $build to $host PATH CONVERSION FUNCTIONS #
3077 #############################################
3078 # invoked via '$to_host_path_cmd ARG'
3080 # In each case, ARG is the path to be converted from $build to $host format.
3081 # The result will be available in $func_to_host_path_result.
3083 # Path separators are also converted from $build format to $host format. If
3084 # ARG begins or ends with a path separator character, it is preserved (but
3085 # converted to $host format) on output.
3087 # All path conversion functions are named using the following convention:
3088 # file name conversion function : func_convert_file_X_to_Y ()
3089 # path conversion function : func_convert_path_X_to_Y ()
3090 # where, for any given $build/$host combination the 'X_to_Y' value is the
3091 # same. If conversion functions are added for new $build/$host combinations,
3092 # the two new functions must follow this pattern, or func_init_to_host_path_cmd
3096 # func_init_to_host_path_cmd
3097 # Ensures that function "pointer" variable $to_host_path_cmd is set to the
3098 # appropriate value, based on the value of $to_host_file_cmd.
3100 func_init_to_host_path_cmd ()
3104 if test -z "$to_host_path_cmd"; then
3105 func_stripname 'func_convert_file_' '' "$to_host_file_cmd"
3106 to_host_path_cmd=func_convert_path_$func_stripname_result
3111 # func_to_host_path ARG
3112 # Converts the path ARG from $build format to $host format. Return result
3113 # in func_to_host_path_result.
3114 func_to_host_path ()
3118 func_init_to_host_path_cmd
3119 $to_host_path_cmd "$1"
3121 # end func_to_host_path
3124 # func_convert_path_noop ARG
3125 # Copy ARG to func_to_host_path_result.
3126 func_convert_path_noop ()
3128 func_to_host_path_result=$1
3130 # end func_convert_path_noop
3133 # func_convert_path_msys_to_w32 ARG
3134 # Convert path ARG from (mingw) MSYS to (mingw) w32 format; automatic
3135 # conversion to w32 is not available inside the cwrapper. Returns result in
3136 # func_to_host_path_result.
3137 func_convert_path_msys_to_w32 ()
3141 func_to_host_path_result=$1
3142 if test -n "$1"; then
3143 # Remove leading and trailing path separator characters from ARG. MSYS
3144 # behavior is inconsistent here; cygpath turns them into '.;' and ';.';
3145 # and winepath ignores them completely.
3146 func_stripname : : "$1"
3147 func_to_host_path_tmp1=$func_stripname_result
3148 func_convert_core_msys_to_w32 "$func_to_host_path_tmp1"
3149 func_to_host_path_result=$func_convert_core_msys_to_w32_result
3150 func_convert_path_check : ";" \
3151 "$func_to_host_path_tmp1" "$func_to_host_path_result"
3152 func_convert_path_front_back_pathsep ":*" "*:" ";" "$1"
3155 # end func_convert_path_msys_to_w32
3158 # func_convert_path_cygwin_to_w32 ARG
3159 # Convert path ARG from Cygwin to w32 format. Returns result in
3160 # func_to_host_file_result.
3161 func_convert_path_cygwin_to_w32 ()
3165 func_to_host_path_result=$1
3166 if test -n "$1"; then
3167 # See func_convert_path_msys_to_w32:
3168 func_stripname : : "$1"
3169 func_to_host_path_tmp1=$func_stripname_result
3170 func_to_host_path_result=`cygpath -m -p "$func_to_host_path_tmp1"`
3171 func_convert_path_check : ";" \
3172 "$func_to_host_path_tmp1" "$func_to_host_path_result"
3173 func_convert_path_front_back_pathsep ":*" "*:" ";" "$1"
3176 # end func_convert_path_cygwin_to_w32
3179 # func_convert_path_nix_to_w32 ARG
3180 # Convert path ARG from *nix to w32 format. Requires a wine environment and
3181 # a working winepath. Returns result in func_to_host_file_result.
3182 func_convert_path_nix_to_w32 ()
3186 func_to_host_path_result=$1
3187 if test -n "$1"; then
3188 # See func_convert_path_msys_to_w32:
3189 func_stripname : : "$1"
3190 func_to_host_path_tmp1=$func_stripname_result
3191 func_convert_core_path_wine_to_w32 "$func_to_host_path_tmp1"
3192 func_to_host_path_result=$func_convert_core_path_wine_to_w32_result
3193 func_convert_path_check : ";" \
3194 "$func_to_host_path_tmp1" "$func_to_host_path_result"
3195 func_convert_path_front_back_pathsep ":*" "*:" ";" "$1"
3198 # end func_convert_path_nix_to_w32
3201 # func_convert_path_msys_to_cygwin ARG
3202 # Convert path ARG from MSYS to Cygwin format. Requires LT_CYGPATH set.
3203 # Returns result in func_to_host_file_result.
3204 func_convert_path_msys_to_cygwin ()
3208 func_to_host_path_result=$1
3209 if test -n "$1"; then
3210 # See func_convert_path_msys_to_w32:
3211 func_stripname : : "$1"
3212 func_to_host_path_tmp1=$func_stripname_result
3213 func_convert_core_msys_to_w32 "$func_to_host_path_tmp1"
3214 func_cygpath -u -p "$func_convert_core_msys_to_w32_result"
3215 func_to_host_path_result=$func_cygpath_result
3216 func_convert_path_check : : \
3217 "$func_to_host_path_tmp1" "$func_to_host_path_result"
3218 func_convert_path_front_back_pathsep ":*" "*:" : "$1"
3221 # end func_convert_path_msys_to_cygwin
3224 # func_convert_path_nix_to_cygwin ARG
3225 # Convert path ARG from *nix to Cygwin format. Requires Cygwin installed in a
3226 # a wine environment, working winepath, and LT_CYGPATH set. Returns result in
3227 # func_to_host_file_result.
3228 func_convert_path_nix_to_cygwin ()
3232 func_to_host_path_result=$1
3233 if test -n "$1"; then
3234 # Remove leading and trailing path separator characters from
3235 # ARG. msys behavior is inconsistent here, cygpath turns them
3236 # into '.;' and ';.', and winepath ignores them completely.
3237 func_stripname : : "$1"
3238 func_to_host_path_tmp1=$func_stripname_result
3239 func_convert_core_path_wine_to_w32 "$func_to_host_path_tmp1"
3240 func_cygpath -u -p "$func_convert_core_path_wine_to_w32_result"
3241 func_to_host_path_result=$func_cygpath_result
3242 func_convert_path_check : : \
3243 "$func_to_host_path_tmp1" "$func_to_host_path_result"
3244 func_convert_path_front_back_pathsep ":*" "*:" : "$1"
3247 # end func_convert_path_nix_to_cygwin
3250 # func_dll_def_p FILE
3251 # True iff FILE is a Windows DLL '.def' file.
3252 # Keep in sync with _LT_DLL_DEF_P in libtool.m4
3257 func_dll_def_p_tmp=`$SED -n \
3259 -e '/^\(;.*\)*$/d' \
3260 -e 's/^\(EXPORTS\|LIBRARY\)\([ ].*\)*$/DEF/p' \
3263 test DEF = "$func_dll_def_p_tmp"
3267 # func_mode_compile arg...
3268 func_mode_compile ()
3272 # Get the compilation command and the source file.
3274 srcfile=$nonopt # always keep a non-empty value in "srcfile"
3286 # do not "continue". Instead, add this to base_compile
3298 # Accept any command-line options.
3301 test -n "$libobj" && \
3302 func_fatal_error "you cannot specify '-o' more than once"
3307 -pie | -fpie | -fPIE)
3308 func_append pie_flag " $arg"
3312 -shared | -static | -prefer-pic | -prefer-non-pic)
3313 func_append later " $arg"
3323 arg_mode=arg # the next one goes into the "base_compile" arg list
3324 continue # The current "srcfile" will either be retained or
3325 ;; # replaced later. I would guess that would be a bug.
3328 func_stripname '-Wc,' '' "$arg"
3329 args=$func_stripname_result
3331 save_ifs=$IFS; IFS=,
3332 for arg in $args; do
3334 func_append_quoted lastarg "$arg"
3337 func_stripname ' ' '' "$lastarg"
3338 lastarg=$func_stripname_result
3340 # Add the arguments to base_compile.
3341 func_append base_compile " $lastarg"
3346 # Accept the current argument as the source file.
3347 # The previous "srcfile" becomes the current argument.
3354 esac # case $arg_mode
3356 # Aesthetically quote the previous argument.
3357 func_append_quoted base_compile "$lastarg"
3362 func_fatal_error "you must specify an argument for -Xcompile"
3365 func_fatal_error "you must specify a target with '-o'"
3368 # Get the name of the library object.
3369 test -z "$libobj" && {
3370 func_basename "$srcfile"
3371 libobj=$func_basename_result
3376 # Recognize several different file suffixes.
3377 # If the user specifies -o file.o, it is replaced with file.lo
3380 *.ada | *.adb | *.ads | *.asm | \
3381 *.c++ | *.cc | *.ii | *.class | *.cpp | *.cxx | \
3382 *.[fF][09]? | *.for | *.java | *.go | *.obj | *.sx | *.cu | *.cup)
3383 func_xform "$libobj"
3384 libobj=$func_xform_result
3389 *.lo) func_lo2o "$libobj"; obj=$func_lo2o_result ;;
3391 func_fatal_error "cannot determine name of library object from '$libobj'"
3395 func_infer_tag $base_compile
3397 for arg in $later; do
3400 test yes = "$build_libtool_libs" \
3401 || func_fatal_configuration "cannot build a shared library"
3407 build_libtool_libs=no
3424 func_quote_for_eval "$libobj"
3425 test "X$libobj" != "X$func_quote_for_eval_result" \
3426 && $ECHO "X$libobj" | $GREP '[]~#^*{};<>?"'"'"' &()|`$[]' \
3427 && func_warning "libobj name '$libobj' may not contain shell special characters."
3428 func_dirname_and_basename "$obj" "/" ""
3429 objname=$func_basename_result
3430 xdir=$func_dirname_result
3431 lobj=$xdir$objdir/$objname
3433 test -z "$base_compile" && \
3434 func_fatal_help "you must specify a compilation command"
3436 # Delete any leftover library objects.
3437 if test yes = "$build_old_libs"; then
3438 removelist="$obj $lobj $libobj ${libobj}T"
3440 removelist="$lobj $libobj ${libobj}T"
3443 # On Cygwin there's no "real" PIC flag so we must build both object types
3445 cygwin* | mingw* | pw32* | os2* | cegcc*)
3449 if test no = "$pic_mode" && test pass_all != "$deplibs_check_method"; then
3450 # non-PIC code in shared libraries is not supported
3454 # Calculate the filename of the output object if compiler does
3455 # not support -o with -c
3456 if test no = "$compiler_c_o"; then
3457 output_obj=`$ECHO "$srcfile" | $SED 's%^.*/%%; s%\.[^.]*$%%'`.$objext
3458 lockfile=$output_obj.lock
3465 # Lock this critical section if it is needed
3466 # We use this script file to make the link, it avoids creating a new file
3467 if test yes = "$need_locks"; then
3468 until $opt_dry_run || ln "$progpath" "$lockfile" 2>/dev/null; do
3469 func_echo "Waiting for $lockfile to be removed"
3472 elif test warn = "$need_locks"; then
3473 if test -f "$lockfile"; then
3475 *** ERROR, $lockfile exists and contains:
3476 `cat $lockfile 2>/dev/null`
3478 This indicates that another process is trying to use the same
3479 temporary object file, and libtool could not work around it because
3480 your compiler does not support '-c' and '-o' together. If you
3481 repeat this compilation, it may succeed, by chance, but you had better
3482 avoid parallel builds (make -j) in this platform, or get a better
3485 $opt_dry_run || $RM $removelist
3488 func_append removelist " $output_obj"
3489 $ECHO "$srcfile" > "$lockfile"
3492 $opt_dry_run || $RM $removelist
3493 func_append removelist " $lockfile"
3494 trap '$opt_dry_run || $RM $removelist; exit $EXIT_FAILURE' 1 2 15
3496 func_to_tool_file "$srcfile" func_convert_file_msys_to_w32
3497 srcfile=$func_to_tool_file_result
3498 func_quote_for_eval "$srcfile"
3499 qsrcfile=$func_quote_for_eval_result
3501 # Only build a PIC object if we are building libtool libraries.
3502 if test yes = "$build_libtool_libs"; then
3503 # Without this assignment, base_compile gets emptied.
3504 fbsd_hideous_sh_bug=$base_compile
3506 if test no != "$pic_mode"; then
3507 command="$base_compile $qsrcfile $pic_flag"
3509 # Don't build PIC code
3510 command="$base_compile $qsrcfile"
3513 func_mkdir_p "$xdir$objdir"
3515 if test -z "$output_obj"; then
3516 # Place PIC objects in $objdir
3517 func_append command " -o $lobj"
3520 func_show_eval_locale "$command" \
3521 'test -n "$output_obj" && $RM $removelist; exit $EXIT_FAILURE'
3523 if test warn = "$need_locks" &&
3524 test "X`cat $lockfile 2>/dev/null`" != "X$srcfile"; then
3526 *** ERROR, $lockfile contains:
3527 `cat $lockfile 2>/dev/null`
3529 but it should contain:
3532 This indicates that another process is trying to use the same
3533 temporary object file, and libtool could not work around it because
3534 your compiler does not support '-c' and '-o' together. If you
3535 repeat this compilation, it may succeed, by chance, but you had better
3536 avoid parallel builds (make -j) in this platform, or get a better
3539 $opt_dry_run || $RM $removelist
3543 # Just move the object if needed, then go on to compile the next one
3544 if test -n "$output_obj" && test "X$output_obj" != "X$lobj"; then
3545 func_show_eval '$MV "$output_obj" "$lobj"' \
3546 'error=$?; $opt_dry_run || $RM $removelist; exit $error'
3549 # Allow error messages only from the first compilation.
3550 if test yes = "$suppress_opt"; then
3551 suppress_output=' >/dev/null 2>&1'
3555 # Only build a position-dependent object if we build old libraries.
3556 if test yes = "$build_old_libs"; then
3557 if test yes != "$pic_mode"; then
3558 # Don't build PIC code
3559 command="$base_compile $qsrcfile$pie_flag"
3561 command="$base_compile $qsrcfile $pic_flag"
3563 if test yes = "$compiler_c_o"; then
3564 func_append command " -o $obj"
3567 # Suppress compiler output if we already did a PIC compilation.
3568 func_append command "$suppress_output"
3569 func_show_eval_locale "$command" \
3570 '$opt_dry_run || $RM $removelist; exit $EXIT_FAILURE'
3572 if test warn = "$need_locks" &&
3573 test "X`cat $lockfile 2>/dev/null`" != "X$srcfile"; then
3575 *** ERROR, $lockfile contains:
3576 `cat $lockfile 2>/dev/null`
3578 but it should contain:
3581 This indicates that another process is trying to use the same
3582 temporary object file, and libtool could not work around it because
3583 your compiler does not support '-c' and '-o' together. If you
3584 repeat this compilation, it may succeed, by chance, but you had better
3585 avoid parallel builds (make -j) in this platform, or get a better
3588 $opt_dry_run || $RM $removelist
3592 # Just move the object if needed
3593 if test -n "$output_obj" && test "X$output_obj" != "X$obj"; then
3594 func_show_eval '$MV "$output_obj" "$obj"' \
3595 'error=$?; $opt_dry_run || $RM $removelist; exit $error'
3600 func_write_libtool_object "$libobj" "$objdir/$objname" "$objname"
3602 # Unlock the critical section if it was locked
3603 if test no != "$need_locks"; then
3604 removelist=$lockfile
3613 test compile = "$opt_mode" && func_mode_compile ${1+"$@"}
3618 # We need to display help for each of the modes.
3621 # Generic help is extracted from the usage comments
3622 # at the start of this file.
3628 "Usage: $progname [OPTION]... --mode=clean RM [RM-OPTION]... FILE...
3630 Remove files from the build directory.
3632 RM is the name of the program to use to delete files associated with each FILE
3633 (typically '/bin/rm'). RM-OPTIONS are options (such as '-f') to be passed
3636 If FILE is a libtool library, object or program, all the files associated
3637 with it are deleted. Otherwise, only FILE itself is deleted using RM."
3642 "Usage: $progname [OPTION]... --mode=compile COMPILE-COMMAND... SOURCEFILE
3644 Compile a source file into a libtool library object.
3646 This mode accepts the following additional options:
3648 -o OUTPUT-FILE set the output file name to OUTPUT-FILE
3649 -no-suppress do not suppress compiler output for multiple passes
3650 -prefer-pic try to build PIC objects only
3651 -prefer-non-pic try to build non-PIC objects only
3652 -shared do not build a '.o' file suitable for static linking
3653 -static only build a '.o' file suitable for static linking
3654 -Wc,FLAG pass FLAG directly to the compiler
3656 COMPILE-COMMAND is a command to be used in creating a 'standard' object file
3657 from the given SOURCEFILE.
3659 The output file name is determined by removing the directory component from
3660 SOURCEFILE, then substituting the C source code suffix '.c' with the
3661 library object suffix, '.lo'."
3666 "Usage: $progname [OPTION]... --mode=execute COMMAND [ARGS]...
3668 Automatically set library path, then run a program.
3670 This mode accepts the following additional options:
3672 -dlopen FILE add the directory containing FILE to the library path
3674 This mode sets the library path environment variable according to '-dlopen'
3677 If any of the ARGS are libtool executable wrappers, then they are translated
3678 into their corresponding uninstalled binary, and any of their required library
3679 directories are added to the library path.
3681 Then, COMMAND is executed, with ARGS as arguments."
3686 "Usage: $progname [OPTION]... --mode=finish [LIBDIR]...
3688 Complete the installation of libtool libraries.
3690 Each LIBDIR is a directory that contains libtool libraries.
3692 The commands that this mode executes may require superuser privileges. Use
3693 the '--dry-run' option if you just want to see what would be executed."
3698 "Usage: $progname [OPTION]... --mode=install INSTALL-COMMAND...
3700 Install executables or libraries.
3702 INSTALL-COMMAND is the installation command. The first component should be
3703 either the 'install' or 'cp' program.
3705 The following components of INSTALL-COMMAND are treated specially:
3707 -inst-prefix-dir PREFIX-DIR Use PREFIX-DIR as a staging area for installation
3709 The rest of the components are interpreted as arguments to that command (only
3710 BSD-compatible install options are recognized)."
3715 "Usage: $progname [OPTION]... --mode=link LINK-COMMAND...
3717 Link object files or libraries together to form another library, or to
3718 create an executable program.
3720 LINK-COMMAND is a command using the C compiler that you would use to create
3721 a program from several object files.
3723 The following components of LINK-COMMAND are treated specially:
3725 -all-static do not do any dynamic linking at all
3726 -avoid-version do not add a version suffix if possible
3727 -bindir BINDIR specify path to binaries directory (for systems where
3728 libraries must be found in the PATH setting at runtime)
3729 -dlopen FILE '-dlpreopen' FILE if it cannot be dlopened at runtime
3730 -dlpreopen FILE link in FILE and add its symbols to lt_preloaded_symbols
3731 -export-dynamic allow symbols from OUTPUT-FILE to be resolved with dlsym(3)
3732 -export-symbols SYMFILE
3733 try to export only the symbols listed in SYMFILE
3734 -export-symbols-regex REGEX
3735 try to export only the symbols matching REGEX
3736 -LLIBDIR search LIBDIR for required installed libraries
3737 -lNAME OUTPUT-FILE requires the installed library libNAME
3738 -module build a library that can dlopened
3739 -no-fast-install disable the fast-install mode
3740 -no-install link a not-installable executable
3741 -no-undefined declare that a library does not refer to external symbols
3742 -o OUTPUT-FILE create OUTPUT-FILE from the specified objects
3743 -objectlist FILE use a list of object files found in FILE to specify objects
3744 -os2dllname NAME force a short DLL name on OS/2 (no effect on other OSes)
3745 -precious-files-regex REGEX
3746 don't remove output files matching REGEX
3747 -release RELEASE specify package release information
3748 -rpath LIBDIR the created library will eventually be installed in LIBDIR
3749 -R[ ]LIBDIR add LIBDIR to the runtime path of programs and libraries
3750 -shared only do dynamic linking of libtool libraries
3751 -shrext SUFFIX override the standard shared library file extension
3752 -static do not do any dynamic linking of uninstalled libtool libraries
3753 -static-libtool-libs
3754 do not do any dynamic linking of libtool libraries
3755 -version-info CURRENT[:REVISION[:AGE]]
3756 specify library version info [each variable defaults to 0]
3757 -weak LIBNAME declare that the target provides the LIBNAME interface
3759 -Xcompiler FLAG pass linker-specific FLAG directly to the compiler
3761 -Xlinker FLAG pass linker-specific FLAG directly to the linker
3762 -XCClinker FLAG pass link-specific FLAG to the compiler driver (CC)
3764 All other options (arguments beginning with '-') are ignored.
3766 Every other argument is treated as a filename. Files ending in '.la' are
3767 treated as uninstalled libtool libraries, other files are standard or library
3770 If the OUTPUT-FILE ends in '.la', then a libtool library is created,
3771 only library objects ('.lo' files) may be specified, and '-rpath' is
3772 required, except when creating a convenience library.
3774 If OUTPUT-FILE ends in '.a' or '.lib', then a standard library is created
3775 using 'ar' and 'ranlib', or on Windows using 'lib'.
3777 If OUTPUT-FILE ends in '.lo' or '.$objext', then a reloadable object file
3778 is created, otherwise an executable program is created."
3783 "Usage: $progname [OPTION]... --mode=uninstall RM [RM-OPTION]... FILE...
3785 Remove libraries from an installation directory.
3787 RM is the name of the program to use to delete files associated with each FILE
3788 (typically '/bin/rm'). RM-OPTIONS are options (such as '-f') to be passed
3791 If FILE is a libtool library, all the files associated with it are deleted.
3792 Otherwise, only FILE itself is deleted using RM."
3796 func_fatal_help "invalid operation mode '$opt_mode'"
3801 $ECHO "Try '$progname --help' for more information about other modes."
3804 # Now that we've collected a possible --mode arg, show help if necessary
3806 if test : = "$opt_help"; then
3811 for opt_mode in compile link execute install finish uninstall clean; do
3814 } | $SED -n '1p; 2,$s/^Usage:/ or: /p'
3817 for opt_mode in compile link execute install finish uninstall clean; do
3823 /^When reporting/,/^Report/{
3828 /information about other modes/d
3829 /more detailed .*MODE/d
3830 s/^Usage:.*--mode=\([^ ]*\) .*/Description of \1 mode:/'
3836 # func_mode_execute arg...
3837 func_mode_execute ()
3841 # The first argument is the command name.
3844 func_fatal_help "you must specify a COMMAND"
3846 # Handle -dlopen flags immediately.
3847 for file in $opt_dlopen; do
3849 || func_fatal_help "'$file' is not a file"
3854 func_resolve_sysroot "$file"
3855 file=$func_resolve_sysroot_result
3857 # Check to see that this really is a libtool archive.
3858 func_lalib_unsafe_p "$file" \
3859 || func_fatal_help "'$lib' is not a valid libtool archive"
3861 # Read the libtool library.
3866 # Skip this library if it cannot be dlopened.
3867 if test -z "$dlname"; then
3868 # Warn if it was a shared library.
3869 test -n "$library_names" && \
3870 func_warning "'$file' was not linked with '-export-dynamic'"
3874 func_dirname "$file" "" "."
3875 dir=$func_dirname_result
3877 if test -f "$dir/$objdir/$dlname"; then
3878 func_append dir "/$objdir"
3880 if test ! -f "$dir/$dlname"; then
3881 func_fatal_error "cannot find '$dlname' in '$dir' or '$dir/$objdir'"
3887 # Just add the directory containing the .lo file.
3888 func_dirname "$file" "" "."
3889 dir=$func_dirname_result
3893 func_warning "'-dlopen' is ignored for non-libtool libraries and objects"
3898 # Get the absolute pathname.
3899 absdir=`cd "$dir" && pwd`
3900 test -n "$absdir" && dir=$absdir
3902 # Now add the directory to shlibpath_var.
3903 if eval "test -z \"\$$shlibpath_var\""; then
3904 eval "$shlibpath_var=\"\$dir\""
3906 eval "$shlibpath_var=\"\$dir:\$$shlibpath_var\""
3910 # This variable tells wrapper scripts just to set shlibpath_var
3911 # rather than running their programs.
3912 libtool_execute_magic=$magic
3914 # Check if any of the arguments is a wrapper script.
3919 -* | *.la | *.lo ) ;;
3921 # Do a test to see if this is really a libtool program.
3922 if func_ltwrapper_script_p "$file"; then
3924 # Transform arg to wrapped name.
3925 file=$progdir/$program
3926 elif func_ltwrapper_executable_p "$file"; then
3927 func_ltwrapper_scriptname "$file"
3928 func_source "$func_ltwrapper_scriptname_result"
3929 # Transform arg to wrapped name.
3930 file=$progdir/$program
3934 # Quote arguments (to preserve shell metacharacters).
3935 func_append_quoted args "$file"
3938 if $opt_dry_run; then
3939 # Display what would be done.
3940 if test -n "$shlibpath_var"; then
3941 eval "\$ECHO \"\$shlibpath_var=\$$shlibpath_var\""
3942 echo "export $shlibpath_var"
3947 if test -n "$shlibpath_var"; then
3948 # Export the shlibpath_var.
3949 eval "export $shlibpath_var"
3952 # Restore saved environment variables
3953 for lt_var in LANG LANGUAGE LC_ALL LC_CTYPE LC_COLLATE LC_MESSAGES
3955 eval "if test \"\${save_$lt_var+set}\" = set; then
3956 $lt_var=\$save_$lt_var; export $lt_var
3962 # Now prepare to actually exec the command.
3967 test execute = "$opt_mode" && func_mode_execute ${1+"$@"}
3970 # func_mode_finish arg...
3979 for opt in "$nonopt" ${1+"$@"}
3981 if test -d "$opt"; then
3982 func_append libdirs " $opt"
3984 elif test -f "$opt"; then
3985 if func_lalib_unsafe_p "$opt"; then
3986 func_append libs " $opt"
3988 func_warning "'$opt' is not a valid libtool archive"
3992 func_fatal_error "invalid argument '$opt'"
3996 if test -n "$libs"; then
3997 if test -n "$lt_sysroot"; then
3998 sysroot_regex=`$ECHO "$lt_sysroot" | $SED "$sed_make_literal_regex"`
3999 sysroot_cmd="s/\([ ']\)$sysroot_regex/\1/g;"
4004 # Remove sysroot references
4005 if $opt_dry_run; then
4006 for lib in $libs; do
4007 echo "removing references to $lt_sysroot and '=' prefixes from $lib"
4010 tmpdir=`func_mktempdir`
4011 for lib in $libs; do
4012 $SED -e "$sysroot_cmd s/\([ ']-[LR]\)=/\1/g; s/\([ ']\)=/\1/g" $lib \
4014 mv -f $tmpdir/tmp-la $lib
4020 if test -n "$finish_cmds$finish_eval" && test -n "$libdirs"; then
4021 for libdir in $libdirs; do
4022 if test -n "$finish_cmds"; then
4023 # Do each command in the finish commands.
4024 func_execute_cmds "$finish_cmds" 'admincmds="$admincmds
4027 if test -n "$finish_eval"; then
4028 # Do the single finish_eval.
4029 eval cmds=\"$finish_eval\"
4030 $opt_dry_run || eval "$cmds" || func_append admincmds "
4036 # Exit here if they wanted silent mode.
4037 $opt_quiet && exit $EXIT_SUCCESS
4039 if test -n "$finish_cmds$finish_eval" && test -n "$libdirs"; then
4040 echo "----------------------------------------------------------------------"
4041 echo "Libraries have been installed in:"
4042 for libdir in $libdirs; do
4046 echo "If you ever happen to want to link against installed libraries"
4047 echo "in a given directory, LIBDIR, you must either use libtool, and"
4048 echo "specify the full pathname of the library, or use the '-LLIBDIR'"
4049 echo "flag during linking and do at least one of the following:"
4050 if test -n "$shlibpath_var"; then
4051 echo " - add LIBDIR to the '$shlibpath_var' environment variable"
4052 echo " during execution"
4054 if test -n "$runpath_var"; then
4055 echo " - add LIBDIR to the '$runpath_var' environment variable"
4056 echo " during linking"
4058 if test -n "$hardcode_libdir_flag_spec"; then
4060 eval flag=\"$hardcode_libdir_flag_spec\"
4062 $ECHO " - use the '$flag' linker flag"
4064 if test -n "$admincmds"; then
4065 $ECHO " - have your system administrator run these commands:$admincmds"
4067 if test -f /etc/ld.so.conf; then
4068 echo " - have your system administrator add LIBDIR to '/etc/ld.so.conf'"
4072 echo "See any operating system documentation about shared libraries for"
4074 solaris2.[6789]|solaris2.1[0-9])
4075 echo "more information, such as the ld(1), crle(1) and ld.so(8) manual"
4079 echo "more information, such as the ld(1) and ld.so(8) manual pages."
4082 echo "----------------------------------------------------------------------"
4087 test finish = "$opt_mode" && func_mode_finish ${1+"$@"}
4090 # func_mode_install arg...
4091 func_mode_install ()
4095 # There may be an optional sh(1) argument at the beginning of
4096 # install_prog (especially on Windows NT).
4097 if test "$SHELL" = "$nonopt" || test /bin/sh = "$nonopt" ||
4098 # Allow the use of GNU shtool's install command.
4099 case $nonopt in *shtool*) :;; *) false;; esac
4101 # Aesthetically quote it.
4102 func_quote_for_eval "$nonopt"
4103 install_prog="$func_quote_for_eval_result "
4111 # The real first argument should be the name of the installation program.
4112 # Aesthetically quote it.
4113 func_quote_for_eval "$arg"
4114 func_append install_prog "$func_quote_for_eval_result"
4115 install_shared_prog=$install_prog
4116 case " $install_prog " in
4117 *[\\\ /]cp\ *) install_cp=: ;;
4118 *) install_cp=false ;;
4121 # We need to accept at least all the BSD install flags.
4133 if test -n "$dest"; then
4134 func_append files " $dest"
4142 if $install_cp; then :; else
4156 # If the previous option needed an argument, then skip it.
4157 if test -n "$prev"; then
4158 if test X-m = "X$prev" && test -n "$install_override_mode"; then
4159 arg2=$install_override_mode
4170 # Aesthetically quote the argument.
4171 func_quote_for_eval "$arg"
4172 func_append install_prog " $func_quote_for_eval_result"
4173 if test -n "$arg2"; then
4174 func_quote_for_eval "$arg2"
4176 func_append install_shared_prog " $func_quote_for_eval_result"
4179 test -z "$install_prog" && \
4180 func_fatal_help "you must specify an install program"
4182 test -n "$prev" && \
4183 func_fatal_help "the '$prev' option requires an argument"
4185 if test -n "$install_override_mode" && $no_mode; then
4186 if $install_cp; then :; else
4187 func_quote_for_eval "$install_override_mode"
4188 func_append install_shared_prog " -m $func_quote_for_eval_result"
4192 if test -z "$files"; then
4193 if test -z "$dest"; then
4194 func_fatal_help "no file or destination specified"
4196 func_fatal_help "you must specify a destination"
4200 # Strip any trailing slash from the destination.
4201 func_stripname '' '/' "$dest"
4202 dest=$func_stripname_result
4204 # Check to see that the destination is a directory.
4205 test -d "$dest" && isdir=:
4210 func_dirname_and_basename "$dest" "" "."
4211 destdir=$func_dirname_result
4212 destname=$func_basename_result
4214 # Not a directory, so check to see that there is only one file specified.
4215 set dummy $files; shift
4216 test "$#" -gt 1 && \
4217 func_fatal_help "'$dest' is not a directory"
4220 [\\/]* | [A-Za-z]:[\\/]*) ;;
4222 for file in $files; do
4226 func_fatal_help "'$destdir' must be an absolute directory name"
4233 # This variable tells wrapper scripts just to set variables rather
4234 # than running their programs.
4235 libtool_install_magic=$magic
4240 for file in $files; do
4242 # Do each installation.
4245 # Do the static libraries later.
4246 func_append staticlibs " $file"
4250 func_resolve_sysroot "$file"
4251 file=$func_resolve_sysroot_result
4253 # Check to see that this really is a libtool archive.
4254 func_lalib_unsafe_p "$file" \
4255 || func_fatal_help "'$file' is not a valid libtool archive"
4262 # Add the libdir to current_libdirs if it is the destination.
4263 if test "X$destdir" = "X$libdir"; then
4264 case "$current_libdirs " in
4266 *) func_append current_libdirs " $libdir" ;;
4269 # Note the libdir as a future libdir.
4270 case "$future_libdirs " in
4272 *) func_append future_libdirs " $libdir" ;;
4276 func_dirname "$file" "/" ""
4277 dir=$func_dirname_result
4278 func_append dir "$objdir"
4280 if test -n "$relink_command"; then
4281 # Determine the prefix the user has applied to our future dir.
4282 inst_prefix_dir=`$ECHO "$destdir" | $SED -e "s%$libdir\$%%"`
4284 # Don't allow the user to place us outside of our expected
4285 # location b/c this prevents finding dependent libraries that
4286 # are installed to the same prefix.
4287 # At present, this check doesn't affect windows .dll's that
4288 # are installed into $libdir/../bin (currently, that works fine)
4289 # but it's something to keep an eye on.
4290 test "$inst_prefix_dir" = "$destdir" && \
4291 func_fatal_error "error: cannot install '$file' to a directory not ending in $libdir"
4293 if test -n "$inst_prefix_dir"; then
4294 # Stick the inst_prefix_dir data into the link command.
4295 relink_command=`$ECHO "$relink_command" | $SED "s%@inst_prefix_dir@%-inst-prefix-dir $inst_prefix_dir%"`
4297 relink_command=`$ECHO "$relink_command" | $SED "s%@inst_prefix_dir@%%"`
4300 func_warning "relinking '$file'"
4301 func_show_eval "$relink_command" \
4302 'func_fatal_error "error: relink '\''$file'\'' with the above command before installing it"'
4305 # See the names of the shared library.
4306 set dummy $library_names; shift
4307 if test -n "$1"; then
4312 test -n "$relink_command" && srcname=${realname}T
4314 # Install the shared library and build the symlinks.
4315 func_show_eval "$install_shared_prog $dir/$srcname $destdir/$realname" \
4319 cygwin* | mingw* | pw32* | cegcc*)
4334 if test -n "$tstripme" && test -n "$striplib"; then
4335 func_show_eval "$striplib $destdir/$realname" 'exit $?'
4338 if test "$#" -gt 0; then
4339 # Delete the old symlinks, and create new ones.
4340 # Try 'ln -sf' first, because the 'ln' binary might depend on
4341 # the symlink we replace! Solaris /bin/ln does not understand -f,
4342 # so we also need to try rm && ln -s.
4345 test "$linkname" != "$realname" \
4346 && func_show_eval "(cd $destdir && { $LN_S -f $realname $linkname || { $RM $linkname && $LN_S $realname $linkname; }; })"
4350 # Do each command in the postinstall commands.
4351 lib=$destdir/$realname
4352 func_execute_cmds "$postinstall_cmds" 'exit $?'
4355 # Install the pseudo-library for information purposes.
4356 func_basename "$file"
4357 name=$func_basename_result
4358 instname=$dir/${name}i
4359 func_show_eval "$install_prog $instname $destdir/$name" 'exit $?'
4361 # Maybe install the static library, too.
4362 test -n "$old_library" && func_append staticlibs " $dir/$old_library"
4366 # Install (i.e. copy) a libtool object.
4368 # Figure out destination file name, if it wasn't already specified.
4369 if test -n "$destname"; then
4370 destfile=$destdir/$destname
4372 func_basename "$file"
4373 destfile=$func_basename_result
4374 destfile=$destdir/$destfile
4377 # Deduce the name of the destination old-style object file.
4380 func_lo2o "$destfile"
4381 staticdest=$func_lo2o_result
4384 staticdest=$destfile
4388 func_fatal_help "cannot copy a libtool object to '$destfile'"
4392 # Install the libtool object if requested.
4393 test -n "$destfile" && \
4394 func_show_eval "$install_prog $file $destfile" 'exit $?'
4396 # Install the old object if enabled.
4397 if test yes = "$build_old_libs"; then
4398 # Deduce the name of the old-style object file.
4400 staticobj=$func_lo2o_result
4401 func_show_eval "$install_prog \$staticobj \$staticdest" 'exit $?'
4407 # Figure out destination file name, if it wasn't already specified.
4408 if test -n "$destname"; then
4409 destfile=$destdir/$destname
4411 func_basename "$file"
4412 destfile=$func_basename_result
4413 destfile=$destdir/$destfile
4416 # If the file is missing, and there is a .exe on the end, strip it
4417 # because it is most likely a libtool script we actually want to
4422 if test ! -f "$file"; then
4423 func_stripname '' '.exe' "$file"
4424 file=$func_stripname_result
4430 # Do a test to see if this is really a libtool program.
4433 if func_ltwrapper_executable_p "$file"; then
4434 func_ltwrapper_scriptname "$file"
4435 wrapper=$func_ltwrapper_scriptname_result
4437 func_stripname '' '.exe' "$file"
4438 wrapper=$func_stripname_result
4445 if func_ltwrapper_script_p "$wrapper"; then
4449 func_source "$wrapper"
4451 # Check the variables that should have been set.
4452 test -z "$generated_by_libtool_version" && \
4453 func_fatal_error "invalid libtool wrapper script '$wrapper'"
4456 for lib in $notinst_deplibs; do
4457 # Check to see that each library is installed.
4459 if test -f "$lib"; then
4462 libfile=$libdir/`$ECHO "$lib" | $SED 's%^.*/%%g'`
4463 if test -n "$libdir" && test ! -f "$libfile"; then
4464 func_warning "'$lib' has not been installed in '$libdir'"
4470 func_source "$wrapper"
4473 if test no = "$fast_install" && test -n "$relink_command"; then
4476 tmpdir=`func_mktempdir`
4477 func_basename "$file$stripped_ext"
4478 file=$func_basename_result
4479 outputname=$tmpdir/$file
4480 # Replace the output file specification.
4481 relink_command=`$ECHO "$relink_command" | $SED 's%@OUTPUT@%'"$outputname"'%g'`
4484 func_quote_for_expand "$relink_command"
4485 eval "func_echo $func_quote_for_expand_result"
4487 if eval "$relink_command"; then :
4489 func_error "error: relink '$file' with the above command before installing it"
4490 $opt_dry_run || ${RM}r "$tmpdir"
4495 func_warning "cannot relink '$file'"
4499 # Install the binary that we compiled earlier.
4500 file=`$ECHO "$file$stripped_ext" | $SED "s%\([^/]*\)$%$objdir/\1%"`
4504 # remove .exe since cygwin /usr/bin/install will append another
4506 case $install_prog,$host in
4507 */usr/bin/install*,*cygwin*)
4508 case $file:$destfile in
4513 destfile=$destfile.exe
4516 func_stripname '' '.exe' "$destfile"
4517 destfile=$func_stripname_result
4522 func_show_eval "$install_prog\$stripme \$file \$destfile" 'exit $?'
4523 $opt_dry_run || if test -n "$outputname"; then
4530 for file in $staticlibs; do
4531 func_basename "$file"
4532 name=$func_basename_result
4534 # Set up the ranlib parameters.
4535 oldlib=$destdir/$name
4536 func_to_tool_file "$oldlib" func_convert_file_msys_to_w32
4537 tool_oldlib=$func_to_tool_file_result
4539 func_show_eval "$install_prog \$file \$oldlib" 'exit $?'
4541 if test -n "$stripme" && test -n "$old_striplib"; then
4542 func_show_eval "$old_striplib $tool_oldlib" 'exit $?'
4545 # Do each command in the postinstall commands.
4546 func_execute_cmds "$old_postinstall_cmds" 'exit $?'
4549 test -n "$future_libdirs" && \
4550 func_warning "remember to run '$progname --finish$future_libdirs'"
4552 if test -n "$current_libdirs"; then
4553 # Maybe just do a dry run.
4554 $opt_dry_run && current_libdirs=" -n$current_libdirs"
4555 exec_cmd='$SHELL "$progpath" $preserve_args --finish$current_libdirs'
4561 test install = "$opt_mode" && func_mode_install ${1+"$@"}
4564 # func_generate_dlsyms outputname originator pic_p
4565 # Extract symbols from dlprefiles and create ${outputname}S.o with
4566 # a dlpreopen symbol table.
4567 func_generate_dlsyms ()
4574 my_prefix=`$ECHO "$my_originator" | $SED 's%[^a-zA-Z0-9]%_%g'`
4577 if test -n "$dlfiles$dlprefiles" || test no != "$dlself"; then
4578 if test -n "$NM" && test -n "$global_symbol_pipe"; then
4579 my_dlsyms=${my_outputname}S.c
4581 func_error "not configured to extract global symbols from dlpreopened files"
4585 if test -n "$my_dlsyms"; then
4589 # Discover the nlist of each of the dlfiles.
4590 nlist=$output_objdir/$my_outputname.nm
4592 func_show_eval "$RM $nlist ${nlist}S ${nlist}T"
4594 # Parse the name list into a source file.
4595 func_verbose "creating $output_objdir/$my_dlsyms"
4597 $opt_dry_run || $ECHO > "$output_objdir/$my_dlsyms" "\
4598 /* $my_dlsyms - symbol resolution table for '$my_outputname' dlsym emulation. */
4599 /* Generated by $PROGRAM (GNU $PACKAGE) $VERSION */
4605 #if defined __GNUC__ && (((__GNUC__ == 4) && (__GNUC_MINOR__ >= 4)) || (__GNUC__ > 4))
4606 #pragma GCC diagnostic ignored \"-Wstrict-prototypes\"
4609 /* Keep this code in sync between libtool.m4, ltmain, lt_system.h, and tests. */
4610 #if defined _WIN32 || defined __CYGWIN__ || defined _WIN32_WCE
4611 /* DATA imports from DLLs on WIN32 can't be const, because runtime
4612 relocations are performed -- see ld's documentation on pseudo-relocs. */
4613 # define LT_DLSYM_CONST
4614 #elif defined __osf__
4615 /* This system does not cope well with relocations in const data. */
4616 # define LT_DLSYM_CONST
4618 # define LT_DLSYM_CONST const
4621 #define STREQ(s1, s2) (strcmp ((s1), (s2)) == 0)
4623 /* External symbol declarations for the compiler. */\
4626 if test yes = "$dlself"; then
4627 func_verbose "generating symbol list for '$output'"
4629 $opt_dry_run || echo ': @PROGRAM@ ' > "$nlist"
4631 # Add our own program objects to the symbol list.
4632 progfiles=`$ECHO "$objs$old_deplibs" | $SP2NL | $SED "$lo2o" | $NL2SP`
4633 for progfile in $progfiles; do
4634 func_to_tool_file "$progfile" func_convert_file_msys_to_w32
4635 func_verbose "extracting global C symbols from '$func_to_tool_file_result'"
4636 $opt_dry_run || eval "$NM $func_to_tool_file_result | $global_symbol_pipe >> '$nlist'"
4639 if test -n "$exclude_expsyms"; then
4641 eval '$EGREP -v " ($exclude_expsyms)$" "$nlist" > "$nlist"T'
4642 eval '$MV "$nlist"T "$nlist"'
4646 if test -n "$export_symbols_regex"; then
4648 eval '$EGREP -e "$export_symbols_regex" "$nlist" > "$nlist"T'
4649 eval '$MV "$nlist"T "$nlist"'
4653 # Prepare the list of exported symbols
4654 if test -z "$export_symbols"; then
4655 export_symbols=$output_objdir/$outputname.exp
4658 eval "$SED -n -e '/^: @PROGRAM@ $/d' -e 's/^.* \(.*\)$/\1/p' "'< "$nlist" > "$export_symbols"'
4660 *cygwin* | *mingw* | *cegcc* )
4661 eval "echo EXPORTS "'> "$output_objdir/$outputname.def"'
4662 eval 'cat "$export_symbols" >> "$output_objdir/$outputname.def"'
4668 eval "$SED -e 's/\([].[*^$]\)/\\\\\1/g' -e 's/^/ /' -e 's/$/$/'"' < "$export_symbols" > "$output_objdir/$outputname.exp"'
4669 eval '$GREP -f "$output_objdir/$outputname.exp" < "$nlist" > "$nlist"T'
4670 eval '$MV "$nlist"T "$nlist"'
4672 *cygwin* | *mingw* | *cegcc* )
4673 eval "echo EXPORTS "'> "$output_objdir/$outputname.def"'
4674 eval 'cat "$nlist" >> "$output_objdir/$outputname.def"'
4681 for dlprefile in $dlprefiles; do
4682 func_verbose "extracting global C symbols from '$dlprefile'"
4683 func_basename "$dlprefile"
4684 name=$func_basename_result
4686 *cygwin* | *mingw* | *cegcc* )
4687 # if an import library, we need to obtain dlname
4688 if func_win32_import_lib_p "$dlprefile"; then
4689 func_tr_sh "$dlprefile"
4690 eval "curr_lafile=\$libfile_$func_tr_sh_result"
4691 dlprefile_dlbasename=
4692 if test -n "$curr_lafile" && func_lalib_p "$curr_lafile"; then
4693 # Use subshell, to avoid clobbering current variable values
4694 dlprefile_dlname=`source "$curr_lafile" && echo "$dlname"`
4695 if test -n "$dlprefile_dlname"; then
4696 func_basename "$dlprefile_dlname"
4697 dlprefile_dlbasename=$func_basename_result
4699 # no lafile. user explicitly requested -dlpreopen <import library>.
4700 $sharedlib_from_linklib_cmd "$dlprefile"
4701 dlprefile_dlbasename=$sharedlib_from_linklib_result
4705 if test -n "$dlprefile_dlbasename"; then
4706 eval '$ECHO ": $dlprefile_dlbasename" >> "$nlist"'
4708 func_warning "Could not compute DLL name from $name"
4709 eval '$ECHO ": $name " >> "$nlist"'
4711 func_to_tool_file "$dlprefile" func_convert_file_msys_to_w32
4712 eval "$NM \"$func_to_tool_file_result\" 2>/dev/null | $global_symbol_pipe |
4713 $SED -e '/I __imp/d' -e 's/I __nm_/D /;s/_nm__//' >> '$nlist'"
4715 else # not an import lib
4717 eval '$ECHO ": $name " >> "$nlist"'
4718 func_to_tool_file "$dlprefile" func_convert_file_msys_to_w32
4719 eval "$NM \"$func_to_tool_file_result\" 2>/dev/null | $global_symbol_pipe >> '$nlist'"
4725 eval '$ECHO ": $name " >> "$nlist"'
4726 func_to_tool_file "$dlprefile" func_convert_file_msys_to_w32
4727 eval "$NM \"$func_to_tool_file_result\" 2>/dev/null | $global_symbol_pipe >> '$nlist'"
4734 # Make sure we have at least an empty file.
4735 test -f "$nlist" || : > "$nlist"
4737 if test -n "$exclude_expsyms"; then
4738 $EGREP -v " ($exclude_expsyms)$" "$nlist" > "$nlist"T
4739 $MV "$nlist"T "$nlist"
4742 # Try sorting and uniquifying the output.
4743 if $GREP -v "^: " < "$nlist" |
4744 if sort -k 3 </dev/null >/dev/null 2>&1; then
4749 uniq > "$nlist"S; then
4752 $GREP -v "^: " < "$nlist" > "$nlist"S
4755 if test -f "$nlist"S; then
4756 eval "$global_symbol_to_cdecl"' < "$nlist"S >> "$output_objdir/$my_dlsyms"'
4758 echo '/* NONE */' >> "$output_objdir/$my_dlsyms"
4761 func_show_eval '$RM "${nlist}I"'
4762 if test -n "$global_symbol_to_import"; then
4763 eval "$global_symbol_to_import"' < "$nlist"S > "$nlist"I'
4766 echo >> "$output_objdir/$my_dlsyms" "\
4768 /* The mapping between symbol names and symbols. */
4773 extern LT_DLSYM_CONST lt_dlsymlist
4774 lt_${my_prefix}_LTX_preloaded_symbols[];\
4777 if test -s "$nlist"I; then
4778 echo >> "$output_objdir/$my_dlsyms" "\
4779 static void lt_syminit(void)
4781 LT_DLSYM_CONST lt_dlsymlist *symbol = lt_${my_prefix}_LTX_preloaded_symbols;
4782 for (; symbol->name; ++symbol)
4784 $SED 's/.*/ if (STREQ (symbol->name, \"&\")) symbol->address = (void *) \&&;/' < "$nlist"I >> "$output_objdir/$my_dlsyms"
4785 echo >> "$output_objdir/$my_dlsyms" "\
4789 echo >> "$output_objdir/$my_dlsyms" "\
4790 LT_DLSYM_CONST lt_dlsymlist
4791 lt_${my_prefix}_LTX_preloaded_symbols[] =
4792 { {\"$my_originator\", (void *) 0},"
4794 if test -s "$nlist"I; then
4795 echo >> "$output_objdir/$my_dlsyms" "\
4796 {\"@INIT@\", (void *) <_syminit},"
4799 case $need_lib_prefix in
4801 eval "$global_symbol_to_c_name_address" < "$nlist" >> "$output_objdir/$my_dlsyms"
4804 eval "$global_symbol_to_c_name_address_lib_prefix" < "$nlist" >> "$output_objdir/$my_dlsyms"
4807 echo >> "$output_objdir/$my_dlsyms" "\
4811 /* This works around a problem in FreeBSD linker */
4812 #ifdef FREEBSD_WORKAROUND
4813 static const void *lt_preloaded_setup() {
4814 return lt_${my_prefix}_LTX_preloaded_symbols;
4824 pic_flag_for_symtable=
4825 case "$compile_command " in
4829 # compiling the symbol table file with pic_flag works around
4830 # a FreeBSD bug that causes programs to crash when -lm is
4831 # linked before any other PIC object. But we must not use
4832 # pic_flag when linking with -static. The problem exists in
4833 # FreeBSD 2.2.6 and is fixed in FreeBSD 3.1.
4834 *-*-freebsd2.*|*-*-freebsd3.0*|*-*-freebsdelf3.0*)
4835 pic_flag_for_symtable=" $pic_flag -DFREEBSD_WORKAROUND" ;;
4837 pic_flag_for_symtable=" $pic_flag" ;;
4839 $my_pic_p && pic_flag_for_symtable=" $pic_flag"
4845 for arg in $LTCFLAGS; do
4847 -pie | -fpie | -fPIE) ;;
4848 *) func_append symtab_cflags " $arg" ;;
4852 # Now compile the dynamic symbol file.
4853 func_show_eval '(cd $output_objdir && $LTCC$symtab_cflags -c$no_builtin_flag$pic_flag_for_symtable "$my_dlsyms")' 'exit $?'
4855 # Clean up the generated files.
4856 func_show_eval '$RM "$output_objdir/$my_dlsyms" "$nlist" "${nlist}S" "${nlist}T" "${nlist}I"'
4858 # Transform the symbol file into the correct name.
4859 symfileobj=$output_objdir/${my_outputname}S.$objext
4861 *cygwin* | *mingw* | *cegcc* )
4862 if test -f "$output_objdir/$my_outputname.def"; then
4863 compile_command=`$ECHO "$compile_command" | $SED "s%@SYMFILE@%$output_objdir/$my_outputname.def $symfileobj%"`
4864 finalize_command=`$ECHO "$finalize_command" | $SED "s%@SYMFILE@%$output_objdir/$my_outputname.def $symfileobj%"`
4866 compile_command=`$ECHO "$compile_command" | $SED "s%@SYMFILE@%$symfileobj%"`
4867 finalize_command=`$ECHO "$finalize_command" | $SED "s%@SYMFILE@%$symfileobj%"`
4871 compile_command=`$ECHO "$compile_command" | $SED "s%@SYMFILE@%$symfileobj%"`
4872 finalize_command=`$ECHO "$finalize_command" | $SED "s%@SYMFILE@%$symfileobj%"`
4877 func_fatal_error "unknown suffix for '$my_dlsyms'"
4881 # We keep going just in case the user didn't refer to
4882 # lt_preloaded_symbols. The linker will fail if global_symbol_pipe
4883 # really was required.
4885 # Nullify the symbol file.
4886 compile_command=`$ECHO "$compile_command" | $SED "s% @SYMFILE@%%"`
4887 finalize_command=`$ECHO "$finalize_command" | $SED "s% @SYMFILE@%%"`
4891 # func_cygming_gnu_implib_p ARG
4892 # This predicate returns with zero status (TRUE) if
4893 # ARG is a GNU/binutils-style import library. Returns
4894 # with nonzero status (FALSE) otherwise.
4895 func_cygming_gnu_implib_p ()
4899 func_to_tool_file "$1" func_convert_file_msys_to_w32
4900 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)$'`
4901 test -n "$func_cygming_gnu_implib_tmp"
4904 # func_cygming_ms_implib_p ARG
4905 # This predicate returns with zero status (TRUE) if
4906 # ARG is an MS-style import library. Returns
4907 # with nonzero status (FALSE) otherwise.
4908 func_cygming_ms_implib_p ()
4912 func_to_tool_file "$1" func_convert_file_msys_to_w32
4913 func_cygming_ms_implib_tmp=`$NM "$func_to_tool_file_result" | eval "$global_symbol_pipe" | $GREP '_NULL_IMPORT_DESCRIPTOR'`
4914 test -n "$func_cygming_ms_implib_tmp"
4917 # func_win32_libid arg
4918 # return the library type of file 'arg'
4920 # Need a lot of goo to handle *both* DLLs and import libs
4921 # Has to be a shell function in order to 'eat' the argument
4922 # that is supplied when $file_magic_command is called.
4923 # Despite the name, also deal with 64 bit binaries.
4928 win32_libid_type=unknown
4929 win32_fileres=`file -L $1 2>/dev/null`
4930 case $win32_fileres in
4931 *ar\ archive\ import\ library*) # definitely import
4932 win32_libid_type="x86 archive import"
4934 *ar\ archive*) # could be an import, or static
4935 # Keep the egrep pattern in sync with the one in _LT_CHECK_MAGIC_METHOD.
4936 if eval $OBJDUMP -f $1 | $SED -e '10q' 2>/dev/null |
4937 $EGREP 'file format (pei*-i386(.*architecture: i386)?|pe-arm-wince|pe-x86-64)' >/dev/null; then
4938 case $nm_interface in
4940 if func_cygming_ms_implib_p "$1" ||
4941 func_cygming_gnu_implib_p "$1"
4949 func_to_tool_file "$1" func_convert_file_msys_to_w32
4950 win32_nmres=`eval $NM -f posix -A \"$func_to_tool_file_result\" |
4961 case $win32_nmres in
4962 import*) win32_libid_type="x86 archive import";;
4963 *) win32_libid_type="x86 archive static";;
4968 win32_libid_type="x86 DLL"
4970 *executable*) # but shell scripts are "executable" too...
4971 case $win32_fileres in
4972 *MS\ Windows\ PE\ Intel*)
4973 win32_libid_type="x86 DLL"
4978 $ECHO "$win32_libid_type"
4981 # func_cygming_dll_for_implib ARG
4983 # Platform-specific function to extract the
4984 # name of the DLL associated with the specified
4985 # import library ARG.
4986 # Invoked by eval'ing the libtool variable
4987 # $sharedlib_from_linklib_cmd
4988 # Result is available in the variable
4989 # $sharedlib_from_linklib_result
4990 func_cygming_dll_for_implib ()
4994 sharedlib_from_linklib_result=`$DLLTOOL --identify-strict --identify "$1"`
4997 # func_cygming_dll_for_implib_fallback_core SECTION_NAME LIBNAMEs
4999 # The is the core of a fallback implementation of a
5000 # platform-specific function to extract the name of the
5001 # DLL associated with the specified import library LIBNAME.
5003 # SECTION_NAME is either .idata$6 or .idata$7, depending
5004 # on the platform and compiler that created the implib.
5006 # Echos the name of the DLL associated with the
5007 # specified import library.
5008 func_cygming_dll_for_implib_fallback_core ()
5012 match_literal=`$ECHO "$1" | $SED "$sed_make_literal_regex"`
5013 $OBJDUMP -s --section "$1" "$2" 2>/dev/null |
5014 $SED '/^Contents of section '"$match_literal"':/{
5015 # Place marker at beginning of archive member dllname section
5020 # These lines can sometimes be longer than 43 characters, but
5021 # are always uninteresting
5022 /:[ ]*file format pe[i]\{,1\}-/d
5023 /^In archive [^:]*:/d
5024 # Ensure marker is printed
5026 # Remove all lines with less than 43 characters
5028 # From remaining lines, remove first 43 characters
5031 # Join marker and all lines until next marker into a single line
5032 /^====MARK====/ b para
5041 # Remove trailing dots and whitespace
5045 # we now have a list, one entry per line, of the stringified
5046 # contents of the appropriate section of all members of the
5047 # archive that possess that section. Heuristic: eliminate
5048 # all those that have a first or second character that is
5049 # a '.' (that is, objdump's representation of an unprintable
5050 # character.) This should work for all archives with less than
5051 # 0x302f exports -- but will fail for DLLs whose name actually
5052 # begins with a literal '.' or a single character followed by
5055 # Of those that remain, print the first one.
5056 $SED -e '/^\./d;/^.\./d;q'
5059 # func_cygming_dll_for_implib_fallback ARG
5060 # Platform-specific function to extract the
5061 # name of the DLL associated with the specified
5062 # import library ARG.
5064 # This fallback implementation is for use when $DLLTOOL
5065 # does not support the --identify-strict option.
5066 # Invoked by eval'ing the libtool variable
5067 # $sharedlib_from_linklib_cmd
5068 # Result is available in the variable
5069 # $sharedlib_from_linklib_result
5070 func_cygming_dll_for_implib_fallback ()
5074 if func_cygming_gnu_implib_p "$1"; then
5075 # binutils import library
5076 sharedlib_from_linklib_result=`func_cygming_dll_for_implib_fallback_core '.idata$7' "$1"`
5077 elif func_cygming_ms_implib_p "$1"; then
5078 # ms-generated import library
5079 sharedlib_from_linklib_result=`func_cygming_dll_for_implib_fallback_core '.idata$6' "$1"`
5082 sharedlib_from_linklib_result=
5087 # func_extract_an_archive dir oldlib
5088 func_extract_an_archive ()
5092 f_ex_an_ar_dir=$1; shift
5093 f_ex_an_ar_oldlib=$1
5094 if test yes = "$lock_old_archive_extraction"; then
5095 lockfile=$f_ex_an_ar_oldlib.lock
5096 until $opt_dry_run || ln "$progpath" "$lockfile" 2>/dev/null; do
5097 func_echo "Waiting for $lockfile to be removed"
5101 func_show_eval "(cd \$f_ex_an_ar_dir && $AR x \"\$f_ex_an_ar_oldlib\")" \
5102 'stat=$?; rm -f "$lockfile"; exit $stat'
5103 if test yes = "$lock_old_archive_extraction"; then
5104 $opt_dry_run || rm -f "$lockfile"
5106 if ($AR t "$f_ex_an_ar_oldlib" | sort | sort -uc >/dev/null 2>&1); then
5109 func_fatal_error "object name conflicts in archive: $f_ex_an_ar_dir/$f_ex_an_ar_oldlib"
5114 # func_extract_archives gentop oldlib ...
5115 func_extract_archives ()
5120 my_oldlibs=${1+"$@"}
5126 for my_xlib in $my_oldlibs; do
5127 # Extract the objects.
5129 [\\/]* | [A-Za-z]:[\\/]*) my_xabs=$my_xlib ;;
5130 *) my_xabs=`pwd`"/$my_xlib" ;;
5132 func_basename "$my_xlib"
5133 my_xlib=$func_basename_result
5136 case " $extracted_archives " in
5138 func_arith $extracted_serial + 1
5139 extracted_serial=$func_arith_result
5140 my_xlib_u=lt$extracted_serial-$my_xlib ;;
5144 extracted_archives="$extracted_archives $my_xlib_u"
5145 my_xdir=$my_gentop/$my_xlib_u
5147 func_mkdir_p "$my_xdir"
5151 func_verbose "Extracting $my_xabs"
5152 # Do not bother doing anything if just a dry run
5154 darwin_orig_dir=`pwd`
5155 cd $my_xdir || exit $?
5156 darwin_archive=$my_xabs
5158 func_basename "$darwin_archive"
5159 darwin_base_archive=$func_basename_result
5160 darwin_arches=`$LIPO -info "$darwin_archive" 2>/dev/null | $GREP Architectures 2>/dev/null || true`
5161 if test -n "$darwin_arches"; then
5162 darwin_arches=`$ECHO "$darwin_arches" | $SED -e 's/.*are://'`
5164 func_verbose "$darwin_base_archive has multiple architectures $darwin_arches"
5165 for darwin_arch in $darwin_arches; do
5166 func_mkdir_p "unfat-$$/$darwin_base_archive-$darwin_arch"
5167 $LIPO -thin $darwin_arch -output "unfat-$$/$darwin_base_archive-$darwin_arch/$darwin_base_archive" "$darwin_archive"
5168 cd "unfat-$$/$darwin_base_archive-$darwin_arch"
5169 func_extract_an_archive "`pwd`" "$darwin_base_archive"
5171 $RM "unfat-$$/$darwin_base_archive-$darwin_arch/$darwin_base_archive"
5172 done # $darwin_arches
5173 ## Okay now we've a bunch of thin objects, gotta fatten them up :)
5174 darwin_filelist=`find unfat-$$ -type f -name \*.o -print -o -name \*.lo -print | $SED -e "$sed_basename" | sort -u`
5177 for darwin_file in $darwin_filelist; do
5178 darwin_files=`find unfat-$$ -name $darwin_file -print | sort | $NL2SP`
5179 $LIPO -create -output "$darwin_file" $darwin_files
5180 done # $darwin_filelist
5182 cd "$darwin_orig_dir"
5185 func_extract_an_archive "$my_xdir" "$my_xabs"
5190 func_extract_an_archive "$my_xdir" "$my_xabs"
5193 my_oldobjs="$my_oldobjs "`find $my_xdir -name \*.$objext -print -o -name \*.lo -print | sort | $NL2SP`
5196 func_extract_archives_result=$my_oldobjs
5200 # func_emit_wrapper [arg=no]
5202 # Emit a libtool wrapper script on stdout.
5203 # Don't directly open a file because we may want to
5204 # incorporate the script contents within a cygwin/mingw
5205 # wrapper executable. Must ONLY be called from within
5206 # func_mode_link because it depends on a number of variables
5209 # ARG is the value that the WRAPPER_SCRIPT_BELONGS_IN_OBJDIR
5210 # variable will take. If 'yes', then the emitted script
5211 # will assume that the directory where it is stored is
5212 # the $objdir directory. This is a cygwin/mingw-specific
5214 func_emit_wrapper ()
5216 func_emit_wrapper_arg1=${1-no}
5221 # $output - temporary wrapper script for $objdir/$outputname
5222 # Generated by $PROGRAM (GNU $PACKAGE) $VERSION
5224 # The $output program cannot be directly executed until all the libtool
5225 # libraries that it depends on are installed.
5227 # This wrapper script should never be moved out of the build directory.
5228 # If it is, it will not operate correctly.
5230 # Sed substitution that helps us do robust quoting. It backslashifies
5231 # metacharacters that are still active within double-quoted strings.
5232 sed_quote_subst='$sed_quote_subst'
5234 # Be Bourne compatible
5235 if test -n \"\${ZSH_VERSION+set}\" && (emulate sh) >/dev/null 2>&1; then
5238 # Zsh 3.x and 4.x performs word splitting on \${1+\"\$@\"}, which
5239 # is contrary to our usage. Disable this feature.
5240 alias -g '\${1+\"\$@\"}'='\"\$@\"'
5241 setopt NO_GLOB_SUBST
5243 case \`(set -o) 2>/dev/null\` in *posix*) set -o posix;; esac
5245 BIN_SH=xpg4; export BIN_SH # for Tru64
5246 DUALCASE=1; export DUALCASE # for MKS sh
5248 # The HP-UX ksh and POSIX shell print the target directory to stdout
5250 (unset CDPATH) >/dev/null 2>&1 && unset CDPATH
5252 relink_command=\"$relink_command\"
5254 # This environment variable determines our operation mode.
5255 if test \"\$libtool_install_magic\" = \"$magic\"; then
5256 # install mode needs the following variables:
5257 generated_by_libtool_version='$macro_version'
5258 notinst_deplibs='$notinst_deplibs'
5260 # When we are sourced in execute mode, \$file and \$ECHO are already set.
5261 if test \"\$libtool_execute_magic\" != \"$magic\"; then
5264 qECHO=`$ECHO "$ECHO" | $SED "$sed_quote_subst"`
5267 # A function that is used when there is no print builtin or printf.
5268 func_fallback_echo ()
5270 eval 'cat <<_LTECHO_EOF
5277 # Very basic option parsing. These options are (a) specific to
5278 # the libtool wrapper, (b) are identical between the wrapper
5279 # /script/ and the wrapper /executable/ that is used only on
5280 # windows platforms, and (c) all begin with the string "--lt-"
5281 # (application programs are unlikely to have options that match
5284 # There are only two supported options: --lt-debug and
5285 # --lt-dump-script. There is, deliberately, no --lt-help.
5287 # The first argument to this parsing function should be the
5288 # script's $0 value, followed by "$@".
5290 func_parse_lt_options ()
5296 case \"\$lt_opt\" in
5297 --lt-debug) lt_option_debug=1 ;;
5299 lt_dump_D=\`\$ECHO \"X\$lt_script_arg0\" | $SED -e 's/^X//' -e 's%/[^/]*$%%'\`
5300 test \"X\$lt_dump_D\" = \"X\$lt_script_arg0\" && lt_dump_D=.
5301 lt_dump_F=\`\$ECHO \"X\$lt_script_arg0\" | $SED -e 's/^X//' -e 's%^.*/%%'\`
5302 cat \"\$lt_dump_D/\$lt_dump_F\"
5306 \$ECHO \"Unrecognized --lt- option: '\$lt_opt'\" 1>&2
5312 # Print the debug banner immediately:
5313 if test -n \"\$lt_option_debug\"; then
5314 echo \"$outputname:$output:\$LINENO: libtool wrapper (GNU $PACKAGE) $VERSION\" 1>&2
5318 # Used when --lt-debug. Prints its arguments to stdout
5319 # (redirection is the responsibility of the caller)
5320 func_lt_dump_args ()
5325 \$ECHO \"$outputname:$output:\$LINENO: newargv[\$lt_dump_args_N]: \$lt_arg\"
5326 lt_dump_args_N=\`expr \$lt_dump_args_N + 1\`
5330 # Core function for launching the target application
5331 func_exec_program_core ()
5335 # Backslashes separate directories on plain windows
5336 *-*-mingw | *-*-os2* | *-cegcc*)
5338 if test -n \"\$lt_option_debug\"; then
5339 \$ECHO \"$outputname:$output:\$LINENO: newargv[0]: \$progdir\\\\\$program\" 1>&2
5340 func_lt_dump_args \${1+\"\$@\"} 1>&2
5342 exec \"\$progdir\\\\\$program\" \${1+\"\$@\"}
5348 if test -n \"\$lt_option_debug\"; then
5349 \$ECHO \"$outputname:$output:\$LINENO: newargv[0]: \$progdir/\$program\" 1>&2
5350 func_lt_dump_args \${1+\"\$@\"} 1>&2
5352 exec \"\$progdir/\$program\" \${1+\"\$@\"}
5357 \$ECHO \"\$0: cannot exec \$program \$*\" 1>&2
5361 # A function to encapsulate launching the target application
5362 # Strips options in the --lt-* namespace from \$@ and
5363 # launches target application with the remaining arguments.
5364 func_exec_program ()
5372 *) set x \"\$@\" \"\$lt_wr_arg\"; shift;;
5377 func_exec_program_core \${1+\"\$@\"}
5381 func_parse_lt_options \"\$0\" \${1+\"\$@\"}
5383 # Find the directory that this script lives in.
5384 thisdir=\`\$ECHO \"\$file\" | $SED 's%/[^/]*$%%'\`
5385 test \"x\$thisdir\" = \"x\$file\" && thisdir=.
5387 # Follow symbolic links until we get to the real thisdir.
5388 file=\`ls -ld \"\$file\" | $SED -n 's/.*-> //p'\`
5389 while test -n \"\$file\"; do
5390 destdir=\`\$ECHO \"\$file\" | $SED 's%/[^/]*\$%%'\`
5392 # If there was a directory component, then change thisdir.
5393 if test \"x\$destdir\" != \"x\$file\"; then
5394 case \"\$destdir\" in
5395 [\\\\/]* | [A-Za-z]:[\\\\/]*) thisdir=\"\$destdir\" ;;
5396 *) thisdir=\"\$thisdir/\$destdir\" ;;
5400 file=\`\$ECHO \"\$file\" | $SED 's%^.*/%%'\`
5401 file=\`ls -ld \"\$thisdir/\$file\" | $SED -n 's/.*-> //p'\`
5404 # Usually 'no', except on cygwin/mingw when embedded into
5406 WRAPPER_SCRIPT_BELONGS_IN_OBJDIR=$func_emit_wrapper_arg1
5407 if test \"\$WRAPPER_SCRIPT_BELONGS_IN_OBJDIR\" = \"yes\"; then
5408 # special case for '.'
5409 if test \"\$thisdir\" = \".\"; then
5412 # remove .libs from thisdir
5413 case \"\$thisdir\" in
5414 *[\\\\/]$objdir ) thisdir=\`\$ECHO \"\$thisdir\" | $SED 's%[\\\\/][^\\\\/]*$%%'\` ;;
5415 $objdir ) thisdir=. ;;
5419 # Try to get the absolute directory name.
5420 absdir=\`cd \"\$thisdir\" && pwd\`
5421 test -n \"\$absdir\" && thisdir=\"\$absdir\"
5424 if test yes = "$fast_install"; then
5426 program=lt-'$outputname'$exeext
5427 progdir=\"\$thisdir/$objdir\"
5429 if test ! -f \"\$progdir/\$program\" ||
5430 { file=\`ls -1dt \"\$progdir/\$program\" \"\$progdir/../\$program\" 2>/dev/null | $SED 1q\`; \\
5431 test \"X\$file\" != \"X\$progdir/\$program\"; }; then
5433 file=\"\$\$-\$program\"
5435 if test ! -d \"\$progdir\"; then
5436 $MKDIR \"\$progdir\"
5438 $RM \"\$progdir/\$file\"
5443 # relink executable if necessary
5444 if test -n \"\$relink_command\"; then
5445 if relink_command_output=\`eval \$relink_command 2>&1\`; then :
5447 \$ECHO \"\$relink_command_output\" >&2
5448 $RM \"\$progdir/\$file\"
5453 $MV \"\$progdir/\$file\" \"\$progdir/\$program\" 2>/dev/null ||
5454 { $RM \"\$progdir/\$program\";
5455 $MV \"\$progdir/\$file\" \"\$progdir/\$program\"; }
5456 $RM \"\$progdir/\$file\"
5460 program='$outputname'
5461 progdir=\"\$thisdir/$objdir\"
5467 if test -f \"\$progdir/\$program\"; then"
5469 # fixup the dll searchpath if we need to.
5471 # Fix the DLL searchpath if we need to. Do this before prepending
5472 # to shlibpath, because on Windows, both are PATH and uninstalled
5473 # libraries must come first.
5474 if test -n "$dllsearchpath"; then
5476 # Add the dll search path components to the executable PATH
5477 PATH=$dllsearchpath:\$PATH
5481 # Export our shlibpath_var if we have one.
5482 if test yes = "$shlibpath_overrides_runpath" && test -n "$shlibpath_var" && test -n "$temp_rpath"; then
5484 # Add our own library path to $shlibpath_var
5485 $shlibpath_var=\"$temp_rpath\$$shlibpath_var\"
5487 # Some systems cannot cope with colon-terminated $shlibpath_var
5488 # The second colon is a workaround for a bug in BeOS R4 sed
5489 $shlibpath_var=\`\$ECHO \"\$$shlibpath_var\" | $SED 's/::*\$//'\`
5491 export $shlibpath_var
5496 if test \"\$libtool_execute_magic\" != \"$magic\"; then
5497 # Run the actual program with our arguments.
5498 func_exec_program \${1+\"\$@\"}
5501 # The program doesn't exist.
5502 \$ECHO \"\$0: error: '\$progdir/\$program' does not exist\" 1>&2
5503 \$ECHO \"This script is just a wrapper for \$program.\" 1>&2
5504 \$ECHO \"See the $PACKAGE documentation for more information.\" 1>&2
5512 # func_emit_cwrapperexe_src
5513 # emit the source code for a wrapper executable on stdout
5514 # Must ONLY be called from within func_mode_link because
5515 # it depends on a number of variable set therein.
5516 func_emit_cwrapperexe_src ()
5520 /* $cwrappersource - temporary wrapper executable for $objdir/$outputname
5521 Generated by $PROGRAM (GNU $PACKAGE) $VERSION
5523 The $output program cannot be directly executed until all the libtool
5524 libraries that it depends on are installed.
5526 This wrapper executable should never be moved out of the build directory.
5527 If it is, it will not operate correctly.
5532 # define _CRT_SECURE_NO_DEPRECATE 1
5537 # include <direct.h>
5538 # include <process.h>
5541 # include <unistd.h>
5542 # include <stdint.h>
5554 #include <sys/stat.h>
5556 #define STREQ(s1, s2) (strcmp ((s1), (s2)) == 0)
5558 /* declarations of non-ANSI functions */
5559 #if defined __MINGW32__
5560 # ifdef __STRICT_ANSI__
5561 int _putenv (const char *);
5563 #elif defined __CYGWIN__
5564 # ifdef __STRICT_ANSI__
5565 char *realpath (const char *, char *);
5566 int putenv (char *);
5567 int setenv (const char *, const char *, int);
5569 /* #elif defined other_platform || defined ... */
5572 /* portability defines, excluding path handling macros */
5573 #if defined _MSC_VER
5574 # define setmode _setmode
5576 # define chmod _chmod
5577 # define getcwd _getcwd
5578 # define putenv _putenv
5579 # define S_IXUSR _S_IEXEC
5580 #elif defined __MINGW32__
5581 # define setmode _setmode
5583 # define chmod _chmod
5584 # define getcwd _getcwd
5585 # define putenv _putenv
5586 #elif defined __CYGWIN__
5587 # define HAVE_SETENV
5588 # define FOPEN_WB "wb"
5589 /* #elif defined other platforms ... */
5592 #if defined PATH_MAX
5593 # define LT_PATHMAX PATH_MAX
5594 #elif defined MAXPATHLEN
5595 # define LT_PATHMAX MAXPATHLEN
5597 # define LT_PATHMAX 1024
5607 /* path handling portability macros */
5608 #ifndef DIR_SEPARATOR
5609 # define DIR_SEPARATOR '/'
5610 # define PATH_SEPARATOR ':'
5613 #if defined _WIN32 || defined __MSDOS__ || defined __DJGPP__ || \
5615 # define HAVE_DOS_BASED_FILE_SYSTEM
5616 # define FOPEN_WB "wb"
5617 # ifndef DIR_SEPARATOR_2
5618 # define DIR_SEPARATOR_2 '\\'
5620 # ifndef PATH_SEPARATOR_2
5621 # define PATH_SEPARATOR_2 ';'
5625 #ifndef DIR_SEPARATOR_2
5626 # define IS_DIR_SEPARATOR(ch) ((ch) == DIR_SEPARATOR)
5627 #else /* DIR_SEPARATOR_2 */
5628 # define IS_DIR_SEPARATOR(ch) \
5629 (((ch) == DIR_SEPARATOR) || ((ch) == DIR_SEPARATOR_2))
5630 #endif /* DIR_SEPARATOR_2 */
5632 #ifndef PATH_SEPARATOR_2
5633 # define IS_PATH_SEPARATOR(ch) ((ch) == PATH_SEPARATOR)
5634 #else /* PATH_SEPARATOR_2 */
5635 # define IS_PATH_SEPARATOR(ch) ((ch) == PATH_SEPARATOR_2)
5636 #endif /* PATH_SEPARATOR_2 */
5639 # define FOPEN_WB "w"
5642 # define _O_BINARY 0
5645 #define XMALLOC(type, num) ((type *) xmalloc ((num) * sizeof(type)))
5646 #define XFREE(stale) do { \
5647 if (stale) { free (stale); stale = 0; } \
5650 #if defined LT_DEBUGWRAPPER
5651 static int lt_debug = 1;
5653 static int lt_debug = 0;
5656 const char *program_name = "libtool-wrapper"; /* in case xstrdup fails */
5658 void *xmalloc (size_t num);
5659 char *xstrdup (const char *string);
5660 const char *base_name (const char *name);
5661 char *find_executable (const char *wrapper);
5662 char *chase_symlinks (const char *pathspec);
5663 int make_executable (const char *path);
5664 int check_executable (const char *path);
5665 char *strendzap (char *str, const char *pat);
5666 void lt_debugprintf (const char *file, int line, const char *fmt, ...);
5667 void lt_fatal (const char *file, int line, const char *message, ...);
5668 static const char *nonnull (const char *s);
5669 static const char *nonempty (const char *s);
5670 void lt_setenv (const char *name, const char *value);
5671 char *lt_extend_str (const char *orig_value, const char *add, int to_end);
5672 void lt_update_exe_path (const char *name, const char *value);
5673 void lt_update_lib_path (const char *name, const char *value);
5674 char **prepare_spawn (char **argv);
5675 void lt_dump_script (FILE *f);
5679 #if __GNUC__ < 4 || (__GNUC__ == 4 && __GNUC_MINOR__ < 5)
5680 # define externally_visible volatile
5682 # define externally_visible __attribute__((externally_visible)) volatile
5684 externally_visible const char * MAGIC_EXE = "$magic_exe";
5685 const char * LIB_PATH_VARNAME = "$shlibpath_var";
5688 if test yes = "$shlibpath_overrides_runpath" && test -n "$shlibpath_var" && test -n "$temp_rpath"; then
5689 func_to_host_path "$temp_rpath"
5691 const char * LIB_PATH_VALUE = "$func_to_host_path_result";
5695 const char * LIB_PATH_VALUE = "";
5699 if test -n "$dllsearchpath"; then
5700 func_to_host_path "$dllsearchpath:"
5702 const char * EXE_PATH_VARNAME = "PATH";
5703 const char * EXE_PATH_VALUE = "$func_to_host_path_result";
5707 const char * EXE_PATH_VARNAME = "";
5708 const char * EXE_PATH_VALUE = "";
5712 if test yes = "$fast_install"; then
5714 const char * TARGET_PROGRAM_NAME = "lt-$outputname"; /* hopefully, no .exe */
5718 const char * TARGET_PROGRAM_NAME = "$outputname"; /* hopefully, no .exe */
5725 #define LTWRAPPER_OPTION_PREFIX "--lt-"
5727 static const char *ltwrapper_option_prefix = LTWRAPPER_OPTION_PREFIX;
5728 static const char *dumpscript_opt = LTWRAPPER_OPTION_PREFIX "dump-script";
5729 static const char *debug_opt = LTWRAPPER_OPTION_PREFIX "debug";
5732 main (int argc, char *argv[])
5737 char *actual_cwrapper_path;
5738 char *actual_cwrapper_name;
5745 program_name = (char *) xstrdup (base_name (argv[0]));
5746 newargz = XMALLOC (char *, (size_t) argc + 1);
5748 /* very simple arg parsing; don't want to rely on getopt
5749 * also, copy all non cwrapper options to newargz, except
5750 * argz[0], which is handled differently
5753 for (i = 1; i < argc; i++)
5755 if (STREQ (argv[i], dumpscript_opt))
5759 *mingw* | *cygwin* )
5760 # make stdout use "unix" line endings
5761 echo " setmode(1,_O_BINARY);"
5766 lt_dump_script (stdout);
5769 if (STREQ (argv[i], debug_opt))
5774 if (STREQ (argv[i], ltwrapper_option_prefix))
5776 /* however, if there is an option in the LTWRAPPER_OPTION_PREFIX
5777 namespace, but it is not one of the ones we know about and
5778 have already dealt with, above (inluding dump-script), then
5779 report an error. Otherwise, targets might begin to believe
5780 they are allowed to use options in the LTWRAPPER_OPTION_PREFIX
5781 namespace. The first time any user complains about this, we'll
5782 need to make LTWRAPPER_OPTION_PREFIX a configure-time option
5783 or a configure.ac-settable value.
5785 lt_fatal (__FILE__, __LINE__,
5786 "unrecognized %s option: '%s'",
5787 ltwrapper_option_prefix, argv[i]);
5790 newargz[++newargc] = xstrdup (argv[i]);
5792 newargz[++newargc] = NULL;
5796 /* The GNU banner must be the first non-error debug message */
5797 lt_debugprintf (__FILE__, __LINE__, "libtool wrapper (GNU $PACKAGE) $VERSION\n");
5800 lt_debugprintf (__FILE__, __LINE__, "(main) argv[0]: %s\n", argv[0]);
5801 lt_debugprintf (__FILE__, __LINE__, "(main) program_name: %s\n", program_name);
5803 tmp_pathspec = find_executable (argv[0]);
5804 if (tmp_pathspec == NULL)
5805 lt_fatal (__FILE__, __LINE__, "couldn't find %s", argv[0]);
5806 lt_debugprintf (__FILE__, __LINE__,
5807 "(main) found exe (before symlink chase) at: %s\n",
5810 actual_cwrapper_path = chase_symlinks (tmp_pathspec);
5811 lt_debugprintf (__FILE__, __LINE__,
5812 "(main) found exe (after symlink chase) at: %s\n",
5813 actual_cwrapper_path);
5814 XFREE (tmp_pathspec);
5816 actual_cwrapper_name = xstrdup (base_name (actual_cwrapper_path));
5817 strendzap (actual_cwrapper_path, actual_cwrapper_name);
5819 /* wrapper name transforms */
5820 strendzap (actual_cwrapper_name, ".exe");
5821 tmp_pathspec = lt_extend_str (actual_cwrapper_name, ".exe", 1);
5822 XFREE (actual_cwrapper_name);
5823 actual_cwrapper_name = tmp_pathspec;
5826 /* target_name transforms -- use actual target program name; might have lt- prefix */
5827 target_name = xstrdup (base_name (TARGET_PROGRAM_NAME));
5828 strendzap (target_name, ".exe");
5829 tmp_pathspec = lt_extend_str (target_name, ".exe", 1);
5830 XFREE (target_name);
5831 target_name = tmp_pathspec;
5834 lt_debugprintf (__FILE__, __LINE__,
5835 "(main) libtool target name: %s\n",
5841 XMALLOC (char, (strlen (actual_cwrapper_path) +
5842 strlen ("$objdir") + 1 + strlen (actual_cwrapper_name) + 1));
5843 strcpy (newargz[0], actual_cwrapper_path);
5844 strcat (newargz[0], "$objdir");
5845 strcat (newargz[0], "/");
5849 /* stop here, and copy so we don't have to do this twice */
5850 tmp_pathspec = xstrdup (newargz[0]);
5852 /* do NOT want the lt- prefix here, so use actual_cwrapper_name */
5853 strcat (newargz[0], actual_cwrapper_name);
5855 /* DO want the lt- prefix here if it exists, so use target_name */
5856 lt_argv_zero = lt_extend_str (tmp_pathspec, target_name, 1);
5857 XFREE (tmp_pathspec);
5858 tmp_pathspec = NULL;
5866 while ((p = strchr (newargz[0], '\\')) != NULL)
5870 while ((p = strchr (lt_argv_zero, '\\')) != NULL)
5880 XFREE (target_name);
5881 XFREE (actual_cwrapper_path);
5882 XFREE (actual_cwrapper_name);
5884 lt_setenv ("BIN_SH", "xpg4"); /* for Tru64 */
5885 lt_setenv ("DUALCASE", "1"); /* for MSK sh */
5886 /* Update the DLL searchpath. EXE_PATH_VALUE ($dllsearchpath) must
5887 be prepended before (that is, appear after) LIB_PATH_VALUE ($temp_rpath)
5888 because on Windows, both *_VARNAMEs are PATH but uninstalled
5889 libraries must come first. */
5890 lt_update_exe_path (EXE_PATH_VARNAME, EXE_PATH_VALUE);
5891 lt_update_lib_path (LIB_PATH_VARNAME, LIB_PATH_VALUE);
5893 lt_debugprintf (__FILE__, __LINE__, "(main) lt_argv_zero: %s\n",
5894 nonnull (lt_argv_zero));
5895 for (i = 0; i < newargc; i++)
5897 lt_debugprintf (__FILE__, __LINE__, "(main) newargz[%d]: %s\n",
5898 i, nonnull (newargz[i]));
5906 /* execv doesn't actually work on mingw as expected on unix */
5907 newargz = prepare_spawn (newargz);
5908 rval = (int) _spawnv (_P_WAIT, lt_argv_zero, (const char * const *) newargz);
5911 /* failed to start process */
5912 lt_debugprintf (__FILE__, __LINE__,
5913 "(main) failed to launch target \"%s\": %s\n",
5914 lt_argv_zero, nonnull (strerror (errno)));
5922 execv (lt_argv_zero, newargz);
5923 return rval; /* =127, but avoids unused variable warning */
5932 xmalloc (size_t num)
5934 void *p = (void *) malloc (num);
5936 lt_fatal (__FILE__, __LINE__, "memory exhausted");
5942 xstrdup (const char *string)
5944 return string ? strcpy ((char *) xmalloc (strlen (string) + 1),
5949 base_name (const char *name)
5953 #if defined HAVE_DOS_BASED_FILE_SYSTEM
5954 /* Skip over the disk name in MSDOS pathnames. */
5955 if (isalpha ((unsigned char) name[0]) && name[1] == ':')
5959 for (base = name; *name; name++)
5960 if (IS_DIR_SEPARATOR (*name))
5966 check_executable (const char *path)
5970 lt_debugprintf (__FILE__, __LINE__, "(check_executable): %s\n",
5972 if ((!path) || (!*path))
5975 if ((stat (path, &st) >= 0)
5976 && (st.st_mode & (S_IXUSR | S_IXGRP | S_IXOTH)))
5983 make_executable (const char *path)
5988 lt_debugprintf (__FILE__, __LINE__, "(make_executable): %s\n",
5990 if ((!path) || (!*path))
5993 if (stat (path, &st) >= 0)
5995 rval = chmod (path, st.st_mode | S_IXOTH | S_IXGRP | S_IXUSR);
6000 /* Searches for the full path of the wrapper. Returns
6001 newly allocated full path name if found, NULL otherwise
6002 Does not chase symlinks, even on platforms that support them.
6005 find_executable (const char *wrapper)
6010 /* static buffer for getcwd */
6011 char tmp[LT_PATHMAX + 1];
6015 lt_debugprintf (__FILE__, __LINE__, "(find_executable): %s\n",
6016 nonempty (wrapper));
6018 if ((wrapper == NULL) || (*wrapper == '\0'))
6021 /* Absolute path? */
6022 #if defined HAVE_DOS_BASED_FILE_SYSTEM
6023 if (isalpha ((unsigned char) wrapper[0]) && wrapper[1] == ':')
6025 concat_name = xstrdup (wrapper);
6026 if (check_executable (concat_name))
6028 XFREE (concat_name);
6033 if (IS_DIR_SEPARATOR (wrapper[0]))
6035 concat_name = xstrdup (wrapper);
6036 if (check_executable (concat_name))
6038 XFREE (concat_name);
6040 #if defined HAVE_DOS_BASED_FILE_SYSTEM
6044 for (p = wrapper; *p; p++)
6052 /* no slashes; search PATH */
6053 const char *path = getenv ("PATH");
6056 for (p = path; *p; p = p_next)
6060 for (q = p; *q; q++)
6061 if (IS_PATH_SEPARATOR (*q))
6063 p_len = (size_t) (q - p);
6064 p_next = (*q == '\0' ? q : q + 1);
6067 /* empty path: current directory */
6068 if (getcwd (tmp, LT_PATHMAX) == NULL)
6069 lt_fatal (__FILE__, __LINE__, "getcwd failed: %s",
6070 nonnull (strerror (errno)));
6071 tmp_len = strlen (tmp);
6073 XMALLOC (char, tmp_len + 1 + strlen (wrapper) + 1);
6074 memcpy (concat_name, tmp, tmp_len);
6075 concat_name[tmp_len] = '/';
6076 strcpy (concat_name + tmp_len + 1, wrapper);
6081 XMALLOC (char, p_len + 1 + strlen (wrapper) + 1);
6082 memcpy (concat_name, p, p_len);
6083 concat_name[p_len] = '/';
6084 strcpy (concat_name + p_len + 1, wrapper);
6086 if (check_executable (concat_name))
6088 XFREE (concat_name);
6091 /* not found in PATH; assume curdir */
6093 /* Relative path | not found in path: prepend cwd */
6094 if (getcwd (tmp, LT_PATHMAX) == NULL)
6095 lt_fatal (__FILE__, __LINE__, "getcwd failed: %s",
6096 nonnull (strerror (errno)));
6097 tmp_len = strlen (tmp);
6098 concat_name = XMALLOC (char, tmp_len + 1 + strlen (wrapper) + 1);
6099 memcpy (concat_name, tmp, tmp_len);
6100 concat_name[tmp_len] = '/';
6101 strcpy (concat_name + tmp_len + 1, wrapper);
6103 if (check_executable (concat_name))
6105 XFREE (concat_name);
6110 chase_symlinks (const char *pathspec)
6113 return xstrdup (pathspec);
6115 char buf[LT_PATHMAX];
6117 char *tmp_pathspec = xstrdup (pathspec);
6119 int has_symlinks = 0;
6120 while (strlen (tmp_pathspec) && !has_symlinks)
6122 lt_debugprintf (__FILE__, __LINE__,
6123 "checking path component for symlinks: %s\n",
6125 if (lstat (tmp_pathspec, &s) == 0)
6127 if (S_ISLNK (s.st_mode) != 0)
6133 /* search backwards for last DIR_SEPARATOR */
6134 p = tmp_pathspec + strlen (tmp_pathspec) - 1;
6135 while ((p > tmp_pathspec) && (!IS_DIR_SEPARATOR (*p)))
6137 if ((p == tmp_pathspec) && (!IS_DIR_SEPARATOR (*p)))
6139 /* no more DIR_SEPARATORS left */
6146 lt_fatal (__FILE__, __LINE__,
6147 "error accessing file \"%s\": %s",
6148 tmp_pathspec, nonnull (strerror (errno)));
6151 XFREE (tmp_pathspec);
6155 return xstrdup (pathspec);
6158 tmp_pathspec = realpath (pathspec, buf);
6159 if (tmp_pathspec == 0)
6161 lt_fatal (__FILE__, __LINE__,
6162 "could not follow symlinks for %s", pathspec);
6164 return xstrdup (tmp_pathspec);
6169 strendzap (char *str, const char *pat)
6173 assert (str != NULL);
6174 assert (pat != NULL);
6177 patlen = strlen (pat);
6181 str += len - patlen;
6182 if (STREQ (str, pat))
6189 lt_debugprintf (const char *file, int line, const char *fmt, ...)
6194 (void) fprintf (stderr, "%s:%s:%d: ", program_name, file, line);
6195 va_start (args, fmt);
6196 (void) vfprintf (stderr, fmt, args);
6202 lt_error_core (int exit_status, const char *file,
6203 int line, const char *mode,
6204 const char *message, va_list ap)
6206 fprintf (stderr, "%s:%s:%d: %s: ", program_name, file, line, mode);
6207 vfprintf (stderr, message, ap);
6208 fprintf (stderr, ".\n");
6210 if (exit_status >= 0)
6215 lt_fatal (const char *file, int line, const char *message, ...)
6218 va_start (ap, message);
6219 lt_error_core (EXIT_FAILURE, file, line, "FATAL", message, ap);
6224 nonnull (const char *s)
6226 return s ? s : "(null)";
6230 nonempty (const char *s)
6232 return (s && !*s) ? "(empty)" : nonnull (s);
6236 lt_setenv (const char *name, const char *value)
6238 lt_debugprintf (__FILE__, __LINE__,
6239 "(lt_setenv) setting '%s' to '%s'\n",
6240 nonnull (name), nonnull (value));
6243 /* always make a copy, for consistency with !HAVE_SETENV */
6244 char *str = xstrdup (value);
6245 setenv (name, str, 1);
6247 size_t len = strlen (name) + 1 + strlen (value) + 1;
6248 char *str = XMALLOC (char, len);
6249 sprintf (str, "%s=%s", name, value);
6250 if (putenv (str) != EXIT_SUCCESS)
6259 lt_extend_str (const char *orig_value, const char *add, int to_end)
6262 if (orig_value && *orig_value)
6264 size_t orig_value_len = strlen (orig_value);
6265 size_t add_len = strlen (add);
6266 new_value = XMALLOC (char, add_len + orig_value_len + 1);
6269 strcpy (new_value, orig_value);
6270 strcpy (new_value + orig_value_len, add);
6274 strcpy (new_value, add);
6275 strcpy (new_value + add_len, orig_value);
6280 new_value = xstrdup (add);
6286 lt_update_exe_path (const char *name, const char *value)
6288 lt_debugprintf (__FILE__, __LINE__,
6289 "(lt_update_exe_path) modifying '%s' by prepending '%s'\n",
6290 nonnull (name), nonnull (value));
6292 if (name && *name && value && *value)
6294 char *new_value = lt_extend_str (getenv (name), value, 0);
6295 /* some systems can't cope with a ':'-terminated path #' */
6296 size_t len = strlen (new_value);
6297 while ((len > 0) && IS_PATH_SEPARATOR (new_value[len-1]))
6299 new_value[--len] = '\0';
6301 lt_setenv (name, new_value);
6307 lt_update_lib_path (const char *name, const char *value)
6309 lt_debugprintf (__FILE__, __LINE__,
6310 "(lt_update_lib_path) modifying '%s' by prepending '%s'\n",
6311 nonnull (name), nonnull (value));
6313 if (name && *name && value && *value)
6315 char *new_value = lt_extend_str (getenv (name), value, 0);
6316 lt_setenv (name, new_value);
6326 /* Prepares an argument vector before calling spawn().
6327 Note that spawn() does not by itself call the command interpreter
6328 (getenv ("COMSPEC") != NULL ? getenv ("COMSPEC") :
6329 ({ OSVERSIONINFO v; v.dwOSVersionInfoSize = sizeof(OSVERSIONINFO);
6331 v.dwPlatformId == VER_PLATFORM_WIN32_NT;
6332 }) ? "cmd.exe" : "command.com").
6333 Instead it simply concatenates the arguments, separated by ' ', and calls
6334 CreateProcess(). We must quote the arguments since Win32 CreateProcess()
6335 interprets characters like ' ', '\t', '\\', '"' (but not '<' and '>') in a
6337 - Space and tab are interpreted as delimiters. They are not treated as
6338 delimiters if they are surrounded by double quotes: "...".
6339 - Unescaped double quotes are removed from the input. Their only effect is
6340 that within double quotes, space and tab are treated like normal
6342 - Backslashes not followed by double quotes are not special.
6343 - But 2*n+1 backslashes followed by a double quote become
6344 n backslashes followed by a double quote (n >= 0):
6349 #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"
6350 #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"
6352 prepare_spawn (char **argv)
6358 /* Count number of arguments. */
6359 for (argc = 0; argv[argc] != NULL; argc++)
6362 /* Allocate new argument vector. */
6363 new_argv = XMALLOC (char *, argc + 1);
6365 /* Put quoted arguments into the new argument vector. */
6366 for (i = 0; i < argc; i++)
6368 const char *string = argv[i];
6370 if (string[0] == '\0')
6371 new_argv[i] = xstrdup ("\"\"");
6372 else if (strpbrk (string, SHELL_SPECIAL_CHARS) != NULL)
6374 int quote_around = (strpbrk (string, SHELL_SPACE_CHARS) != NULL);
6376 unsigned int backslashes;
6378 char *quoted_string;
6385 for (s = string; *s != '\0'; s++)
6389 length += backslashes + 1;
6397 length += backslashes + 1;
6399 quoted_string = XMALLOC (char, length + 1);
6405 for (s = string; *s != '\0'; s++)
6411 for (j = backslashes + 1; j > 0; j--)
6423 for (j = backslashes; j > 0; j--)
6429 new_argv[i] = quoted_string;
6432 new_argv[i] = (char *) string;
6434 new_argv[argc] = NULL;
6443 void lt_dump_script (FILE* f)
6446 func_emit_wrapper yes |
6448 s/^\(.\{79\}\)\(..*\)/\1\
6453 s/\([^\n]*\).*/ fputs ("\1", f);/p
6460 # end: func_emit_cwrapperexe_src
6462 # func_win32_import_lib_p ARG
6463 # True if ARG is an import lib, as indicated by $file_magic_cmd
6464 func_win32_import_lib_p ()
6468 case `eval $file_magic_cmd \"\$1\" 2>/dev/null | $SED -e 10q` in
6474 # func_suncc_cstd_abi
6475 # !!ONLY CALL THIS FOR SUN CC AFTER $compile_command IS FULLY EXPANDED!!
6476 # Several compiler flags select an ABI that is incompatible with the
6477 # Cstd library. Avoid specifying it if any are in CXXFLAGS.
6478 func_suncc_cstd_abi ()
6482 case " $compile_command " in
6483 *" -compat=g "*|*\ -std=c++[0-9][0-9]\ *|*" -library=stdcxx4 "*|*" -library=stlport4 "*)
6484 suncc_use_cstd_abi=no
6487 suncc_use_cstd_abi=yes
6492 # func_mode_link arg...
6498 *-*-cygwin* | *-*-mingw* | *-*-pw32* | *-*-os2* | *-cegcc*)
6499 # It is impossible to link a dll without this setting, and
6500 # we shouldn't force the makefile maintainer to figure out
6501 # what system we are compiling for in order to pass an extra
6502 # flag for every libtool invocation.
6503 # allow_undefined=no
6505 # FIXME: Unfortunately, there are problems with the above when trying
6506 # to make a dll that has undefined symbols, in which case not
6507 # even a static library is built. For now, we need to specify
6508 # -no-undefined on the libtool link line when we can be certain
6509 # that all symbols are satisfied, otherwise we get a static library.
6516 libtool_args=$nonopt
6517 base_compile="$nonopt $@"
6518 compile_command=$nonopt
6519 finalize_command=$nonopt
6532 lib_search_path=`pwd`
6534 new_inherited_linker_flags=
6543 export_symbols_regex=
6552 precious_files_regex=
6553 prefer_static_libs=no
6566 single_module=$wl-single_module
6567 func_infer_tag $base_compile
6569 # We need to know -static, to get the right output filenames.
6574 test yes != "$build_libtool_libs" \
6575 && func_fatal_configuration "cannot build a shared library"
6579 -all-static | -static | -static-libtool-libs)
6582 if test yes = "$build_libtool_libs" && test -z "$link_static_flag"; then
6583 func_warning "complete static linking is impossible in this configuration"
6585 if test -n "$link_static_flag"; then
6586 dlopen_self=$dlopen_self_static
6588 prefer_static_libs=yes
6591 if test -z "$pic_flag" && test -n "$link_static_flag"; then
6592 dlopen_self=$dlopen_self_static
6594 prefer_static_libs=built
6596 -static-libtool-libs)
6597 if test -z "$pic_flag" && test -n "$link_static_flag"; then
6598 dlopen_self=$dlopen_self_static
6600 prefer_static_libs=yes
6603 build_libtool_libs=no
6610 # See if our shared archives depend on static archives.
6611 test -n "$old_archive_from_new_cmds" && build_old_libs=yes
6613 # Go through the arguments, transforming them on the way.
6614 while test "$#" -gt 0; do
6617 func_quote_for_eval "$arg"
6618 qarg=$func_quote_for_eval_unquoted_result
6619 func_append libtool_args " $func_quote_for_eval_result"
6621 # If the previous option needs an argument, assign it.
6622 if test -n "$prev"; then
6625 func_append compile_command " @OUTPUT@"
6626 func_append finalize_command " @OUTPUT@"
6638 # Add the symbol object into the linking commands.
6639 func_append compile_command " @SYMFILE@"
6640 func_append finalize_command " @SYMFILE@"
6644 *.la | *.lo) ;; # We handle these cases below.
6646 if test no = "$dlself"; then
6654 if test dlprefiles = "$prev"; then
6656 elif test dlfiles = "$prev" && test yes != "$dlopen_self"; then
6666 if test dlfiles = "$prev"; then
6667 func_append dlfiles " $arg"
6669 func_append dlprefiles " $arg"
6679 || func_fatal_error "symbol file '$arg' does not exist"
6684 export_symbols_regex=$arg
6692 *" $qarg.ltframework "*) ;;
6693 *) func_append deplibs " $qarg.ltframework" # this is fixed later
6702 inst_prefix_dir=$arg
6707 # Clang does not use LLVM to link, so we can simply discard any
6708 # '-mllvm $arg' options when doing the link step.
6713 if test -f "$arg"; then
6716 for fil in `cat "$save_arg"`
6718 # func_append moreargs " $fil"
6720 # A libtool-controlled object.
6722 # Check to see that this really is a libtool object.
6723 if func_lalib_unsafe_p "$arg"; then
6730 if test -z "$pic_object" ||
6731 test -z "$non_pic_object" ||
6732 test none = "$pic_object" &&
6733 test none = "$non_pic_object"; then
6734 func_fatal_error "cannot find name of object for '$arg'"
6737 # Extract subdirectory from the argument.
6738 func_dirname "$arg" "/" ""
6739 xdir=$func_dirname_result
6741 if test none != "$pic_object"; then
6742 # Prepend the subdirectory the object is found in.
6743 pic_object=$xdir$pic_object
6745 if test dlfiles = "$prev"; then
6746 if test yes = "$build_libtool_libs" && test yes = "$dlopen_support"; then
6747 func_append dlfiles " $pic_object"
6751 # If libtool objects are unsupported, then we need to preload.
6756 # CHECK ME: I think I busted this. -Ossama
6757 if test dlprefiles = "$prev"; then
6758 # Preload the old-style object.
6759 func_append dlprefiles " $pic_object"
6764 func_append libobjs " $pic_object"
6769 if test none != "$non_pic_object"; then
6770 # Prepend the subdirectory the object is found in.
6771 non_pic_object=$xdir$non_pic_object
6773 # A standard non-PIC object
6774 func_append non_pic_objects " $non_pic_object"
6775 if test -z "$pic_object" || test none = "$pic_object"; then
6779 # If the PIC object exists, use it instead.
6780 # $xdir was prepended to $pic_object above.
6781 non_pic_object=$pic_object
6782 func_append non_pic_objects " $non_pic_object"
6785 # Only an error if not doing a dry-run.
6786 if $opt_dry_run; then
6787 # Extract subdirectory from the argument.
6788 func_dirname "$arg" "/" ""
6789 xdir=$func_dirname_result
6792 pic_object=$xdir$objdir/$func_lo2o_result
6793 non_pic_object=$xdir$func_lo2o_result
6794 func_append libobjs " $pic_object"
6795 func_append non_pic_objects " $non_pic_object"
6797 func_fatal_error "'$arg' is not a valid libtool object"
6802 func_fatal_error "link input file '$arg' does not exist"
6814 precious_files_regex=$arg
6824 # We need an absolute path.
6826 [\\/]* | [A-Za-z]:[\\/]*) ;;
6828 func_fatal_error "only absolute run-paths are allowed"
6831 if test rpath = "$prev"; then
6834 *) func_append rpath " $arg" ;;
6839 *) func_append xrpath " $arg" ;;
6851 func_append weak_libs " $arg"
6856 func_append linker_flags " $qarg"
6857 func_append compiler_flags " $qarg"
6859 func_append compile_command " $qarg"
6860 func_append finalize_command " $qarg"
6864 func_append compiler_flags " $qarg"
6866 func_append compile_command " $qarg"
6867 func_append finalize_command " $qarg"
6871 func_append linker_flags " $qarg"
6872 func_append compiler_flags " $wl$qarg"
6874 func_append compile_command " $wl$qarg"
6875 func_append finalize_command " $wl$qarg"
6879 eval "$prev=\"\$arg\""
6884 fi # test -n "$prev"
6890 if test -n "$link_static_flag"; then
6891 # See comment for -static flag below, for more details.
6892 func_append compile_command " $link_static_flag"
6893 func_append finalize_command " $link_static_flag"
6899 # FIXME: remove this flag sometime in the future.
6900 func_fatal_error "'-allow-undefined' must not be used because it is the default"
6928 -export-symbols | -export-symbols-regex)
6929 if test -n "$export_symbols" || test -n "$export_symbols_regex"; then
6930 func_fatal_error "more than one -exported-symbols argument is not allowed"
6932 if test X-export-symbols = "X$arg"; then
6950 # The native IRIX linker understands -LANG:*, -LIST:* and -LNO:*
6951 # so, if we see these flags be careful not to treat them like -L
6953 case $with_gcc/$host in
6954 no/*-*-irix* | /*-*-irix*)
6955 func_append compile_command " $arg"
6956 func_append finalize_command " $arg"
6963 func_stripname "-L" '' "$arg"
6964 if test -z "$func_stripname_result"; then
6965 if test "$#" -gt 0; then
6966 func_fatal_error "require no space between '-L' and '$1'"
6968 func_fatal_error "need path for '-L' option"
6971 func_resolve_sysroot "$func_stripname_result"
6972 dir=$func_resolve_sysroot_result
6973 # We need an absolute path.
6975 [\\/]* | [A-Za-z]:[\\/]*) ;;
6977 absdir=`cd "$dir" && pwd`
6978 test -z "$absdir" && \
6979 func_fatal_error "cannot determine absolute directory name of '$dir'"
6984 *" -L$dir "* | *" $arg "*)
6985 # Will only happen for absolute or sysroot arguments
6988 # Preserve sysroot, but never include relative directories
6990 [\\/]* | [A-Za-z]:[\\/]* | =*) func_append deplibs " $arg" ;;
6991 *) func_append deplibs " -L$dir" ;;
6993 func_append lib_search_path " $dir"
6997 *-*-cygwin* | *-*-mingw* | *-*-pw32* | *-*-os2* | *-cegcc*)
6998 testbindir=`$ECHO "$dir" | $SED 's*/lib$*/bin*'`
6999 case :$dllsearchpath: in
7001 ::) dllsearchpath=$dir;;
7002 *) func_append dllsearchpath ":$dir";;
7004 case :$dllsearchpath: in
7005 *":$testbindir:"*) ;;
7006 ::) dllsearchpath=$testbindir;;
7007 *) func_append dllsearchpath ":$testbindir";;
7015 if test X-lc = "X$arg" || test X-lm = "X$arg"; then
7017 *-*-cygwin* | *-*-mingw* | *-*-pw32* | *-*-beos* | *-cegcc* | *-*-haiku*)
7018 # These systems don't actually have a C or math library (as such)
7022 # These systems don't actually have a C library (as such)
7023 test X-lc = "X$arg" && continue
7025 *-*-openbsd* | *-*-freebsd* | *-*-dragonfly* | *-*-bitrig*)
7026 # Do not include libc due to us having libc/libc_r.
7027 test X-lc = "X$arg" && continue
7029 *-*-rhapsody* | *-*-darwin1.[012])
7030 # Rhapsody C and math libraries are in the System framework
7031 func_append deplibs " System.ltframework"
7034 *-*-sco3.2v5* | *-*-sco5v6*)
7035 # Causes problems with __ctype
7036 test X-lc = "X$arg" && continue
7038 *-*-sysv4.2uw2* | *-*-sysv5* | *-*-unixware* | *-*-OpenUNIX*)
7039 # Compiler inserts libc in the correct place for threads to work
7040 test X-lc = "X$arg" && continue
7043 elif test X-lc_r = "X$arg"; then
7045 *-*-openbsd* | *-*-freebsd* | *-*-dragonfly* | *-*-bitrig*)
7046 # Do not include libc_r directly, use -pthread flag.
7051 func_append deplibs " $arg"
7065 # Tru64 UNIX uses -model [arg] to determine the layout of C++
7066 # classes, name mangling, and exception handling.
7067 # Darwin uses the -arch flag to determine output architecture.
7068 -model|-arch|-isysroot|--sysroot)
7069 func_append compiler_flags " $arg"
7070 func_append compile_command " $arg"
7071 func_append finalize_command " $arg"
7076 -mt|-mthreads|-kthread|-Kthread|-pthread|-pthreads|--thread-safe \
7077 |-threads|-fopenmp|-openmp|-mp|-xopenmp|-omp|-qsmp=*)
7078 func_append compiler_flags " $arg"
7079 func_append compile_command " $arg"
7080 func_append finalize_command " $arg"
7081 case "$new_inherited_linker_flags " in
7083 * ) func_append new_inherited_linker_flags " $arg" ;;
7089 single_module=$wl-multi_module
7100 *-*-cygwin* | *-*-mingw* | *-*-pw32* | *-*-os2* | *-*-darwin* | *-cegcc*)
7101 # The PATH hackery in wrapper scripts is required on Windows
7102 # and Darwin in order for the loader to find any dlls it needs.
7103 func_warning "'-no-install' is ignored for $host"
7104 func_warning "assuming '-no-fast-install' instead"
7107 *) no_install=yes ;;
7129 -precious-files-regex)
7150 func_stripname '-R' '' "$arg"
7151 dir=$func_stripname_result
7152 # We need an absolute path.
7154 [\\/]* | [A-Za-z]:[\\/]*) ;;
7156 func_stripname '=' '' "$dir"
7157 dir=$lt_sysroot$func_stripname_result
7160 func_fatal_error "only absolute run-paths are allowed"
7165 *) func_append xrpath " $dir" ;;
7171 # The effects of -shared are defined in a previous loop.
7180 -static | -static-libtool-libs)
7181 # The effects of -static are defined in a previous loop.
7182 # We used to do the same as -all-static on platforms that
7183 # didn't have a PIC flag, but the assumption that the effects
7184 # would be equivalent was wrong. It would break on at least
7185 # Digital Unix and AIX.
7211 func_stripname '-Wc,' '' "$arg"
7212 args=$func_stripname_result
7214 save_ifs=$IFS; IFS=,
7215 for flag in $args; do
7217 func_quote_for_eval "$flag"
7218 func_append arg " $func_quote_for_eval_result"
7219 func_append compiler_flags " $func_quote_for_eval_result"
7222 func_stripname ' ' '' "$arg"
7223 arg=$func_stripname_result
7227 func_stripname '-Wl,' '' "$arg"
7228 args=$func_stripname_result
7230 save_ifs=$IFS; IFS=,
7231 for flag in $args; do
7233 func_quote_for_eval "$flag"
7234 func_append arg " $wl$func_quote_for_eval_result"
7235 func_append compiler_flags " $wl$func_quote_for_eval_result"
7236 func_append linker_flags " $func_quote_for_eval_result"
7239 func_stripname ' ' '' "$arg"
7240 arg=$func_stripname_result
7260 func_quote_for_eval "$arg"
7261 arg=$func_quote_for_eval_result
7264 # Flags to be passed through unchanged, with rationale:
7265 # -64, -mips[0-9] enable 64-bit mode for the SGI compiler
7266 # -r[0-9][0-9]* specify processor for the SGI compiler
7267 # -xarch=*, -xtarget=* enable 64-bit mode for the Sun compiler
7268 # +DA*, +DD* enable 64-bit mode for the HP compiler
7269 # -q* compiler args for the IBM compiler
7270 # -m*, -t[45]*, -txscale* architecture-specific flags for GCC
7271 # -F/path path to uninstalled frameworks, gcc on darwin
7272 # -p, -pg, --coverage, -fprofile-* profiling flags for GCC
7273 # -fstack-protector* stack protector flags for GCC
7274 # @file GCC response files
7275 # -tp=* Portland pgcc target processor selection
7276 # --sysroot=* for sysroot support
7277 # -O*, -g*, -flto*, -fwhopr*, -fuse-linker-plugin GCC link-time optimization
7278 # -stdlib=* select c++ std lib with clang
7279 -64|-mips[0-9]|-r[0-9][0-9]*|-xarch=*|-xtarget=*|+DA*|+DD*|-q*|-m*| \
7280 -t[45]*|-txscale*|-p|-pg|--coverage|-fprofile-*|-F*|@*|-tp=*|--sysroot=*| \
7281 -O*|-g*|-flto*|-fwhopr*|-fuse-linker-plugin|-fstack-protector*|-stdlib=*)
7282 func_quote_for_eval "$arg"
7283 arg=$func_quote_for_eval_result
7284 func_append compile_command " $arg"
7285 func_append finalize_command " $arg"
7286 func_append compiler_flags " $arg"
7291 if test os2 = "`expr $host : '.*\(os2\)'`"; then
7292 # OS/2 uses -Zxxx to specify OS/2-specific options
7293 compiler_flags="$compiler_flags $arg"
7294 func_append compile_command " $arg"
7295 func_append finalize_command " $arg"
7303 # Otherwise treat like 'Some other compiler flag' below
7304 func_quote_for_eval "$arg"
7305 arg=$func_quote_for_eval_result
7309 # Some other compiler flag.
7311 func_quote_for_eval "$arg"
7312 arg=$func_quote_for_eval_result
7316 # A standard object.
7317 func_append objs " $arg"
7321 # A libtool-controlled object.
7323 # Check to see that this really is a libtool object.
7324 if func_lalib_unsafe_p "$arg"; then
7331 if test -z "$pic_object" ||
7332 test -z "$non_pic_object" ||
7333 test none = "$pic_object" &&
7334 test none = "$non_pic_object"; then
7335 func_fatal_error "cannot find name of object for '$arg'"
7338 # Extract subdirectory from the argument.
7339 func_dirname "$arg" "/" ""
7340 xdir=$func_dirname_result
7342 test none = "$pic_object" || {
7343 # Prepend the subdirectory the object is found in.
7344 pic_object=$xdir$pic_object
7346 if test dlfiles = "$prev"; then
7347 if test yes = "$build_libtool_libs" && test yes = "$dlopen_support"; then
7348 func_append dlfiles " $pic_object"
7352 # If libtool objects are unsupported, then we need to preload.
7357 # CHECK ME: I think I busted this. -Ossama
7358 if test dlprefiles = "$prev"; then
7359 # Preload the old-style object.
7360 func_append dlprefiles " $pic_object"
7365 func_append libobjs " $pic_object"
7370 if test none != "$non_pic_object"; then
7371 # Prepend the subdirectory the object is found in.
7372 non_pic_object=$xdir$non_pic_object
7374 # A standard non-PIC object
7375 func_append non_pic_objects " $non_pic_object"
7376 if test -z "$pic_object" || test none = "$pic_object"; then
7380 # If the PIC object exists, use it instead.
7381 # $xdir was prepended to $pic_object above.
7382 non_pic_object=$pic_object
7383 func_append non_pic_objects " $non_pic_object"
7386 # Only an error if not doing a dry-run.
7387 if $opt_dry_run; then
7388 # Extract subdirectory from the argument.
7389 func_dirname "$arg" "/" ""
7390 xdir=$func_dirname_result
7393 pic_object=$xdir$objdir/$func_lo2o_result
7394 non_pic_object=$xdir$func_lo2o_result
7395 func_append libobjs " $pic_object"
7396 func_append non_pic_objects " $non_pic_object"
7398 func_fatal_error "'$arg' is not a valid libtool object"
7405 func_append deplibs " $arg"
7406 func_append old_deplibs " $arg"
7411 # A libtool-controlled library.
7413 func_resolve_sysroot "$arg"
7414 if test dlfiles = "$prev"; then
7415 # This library was specified with -dlopen.
7416 func_append dlfiles " $func_resolve_sysroot_result"
7418 elif test dlprefiles = "$prev"; then
7419 # The library was specified with -dlpreopen.
7420 func_append dlprefiles " $func_resolve_sysroot_result"
7423 func_append deplibs " $func_resolve_sysroot_result"
7428 # Some other compiler argument.
7430 # Unknown arguments in both finalize_command and compile_command need
7431 # to be aesthetically quoted because they are evaled later.
7432 func_quote_for_eval "$arg"
7433 arg=$func_quote_for_eval_result
7437 # Now actually substitute the argument into the commands.
7438 if test -n "$arg"; then
7439 func_append compile_command " $arg"
7440 func_append finalize_command " $arg"
7442 done # argument parsing loop
7444 test -n "$prev" && \
7445 func_fatal_help "the '$prevarg' option requires an argument"
7447 if test yes = "$export_dynamic" && test -n "$export_dynamic_flag_spec"; then
7448 eval arg=\"$export_dynamic_flag_spec\"
7449 func_append compile_command " $arg"
7450 func_append finalize_command " $arg"
7454 # calculate the name of the file, without its directory
7455 func_basename "$output"
7456 outputname=$func_basename_result
7457 libobjs_save=$libobjs
7459 if test -n "$shlibpath_var"; then
7460 # get the directories listed in $shlibpath_var
7461 eval shlib_search_path=\`\$ECHO \"\$$shlibpath_var\" \| \$SED \'s/:/ /g\'\`
7465 eval sys_lib_search_path=\"$sys_lib_search_path_spec\"
7466 eval sys_lib_dlsearch_path=\"$sys_lib_dlsearch_path_spec\"
7468 # Definition is injected by LT_CONFIG during libtool generation.
7469 func_munge_path_list sys_lib_dlsearch_path "$LT_SYS_LIBRARY_PATH"
7471 func_dirname "$output" "/" ""
7472 output_objdir=$func_dirname_result$objdir
7473 func_to_tool_file "$output_objdir/"
7474 tool_output_objdir=$func_to_tool_file_result
7475 # Create the object directory.
7476 func_mkdir_p "$output_objdir"
7478 # Determine the type of output
7481 func_fatal_help "you must specify an output file"
7483 *.$libext) linkmode=oldlib ;;
7484 *.lo | *.$objext) linkmode=obj ;;
7485 *.la) linkmode=lib ;;
7486 *) linkmode=prog ;; # Anything else should be a program.
7492 # Find all interdependent deplibs by searching for libraries
7493 # that are linked more than once (e.g. -la -lb -la)
7494 for deplib in $deplibs; do
7495 if $opt_preserve_dup_deps; then
7497 *" $deplib "*) func_append specialdeplibs " $deplib" ;;
7500 func_append libs " $deplib"
7503 if test lib = "$linkmode"; then
7504 libs="$predeps $libs $compiler_lib_search_path $postdeps"
7506 # Compute libraries that are listed more than once in $predeps
7507 # $postdeps and mark them as special (i.e., whose duplicates are
7508 # not to be eliminated).
7510 if $opt_duplicate_compiler_generated_deps; then
7511 for pre_post_dep in $predeps $postdeps; do
7512 case "$pre_post_deps " in
7513 *" $pre_post_dep "*) func_append specialdeplibs " $pre_post_deps" ;;
7515 func_append pre_post_deps " $pre_post_dep"
7524 need_relink=no # whether we're linking any uninstalled libtool libraries
7525 notinst_deplibs= # not-installed libtool libraries
7526 notinst_path= # paths that contain not-installed libtool libraries
7530 passes="conv dlpreopen link"
7531 for file in $dlfiles $dlprefiles; do
7535 func_fatal_help "libraries can '-dlopen' only libtool libraries: $file"
7546 passes="conv scan dlopen dlpreopen link"
7552 for pass in $passes; do
7553 # The preopen pass in lib mode reverses $deplibs; put it back here
7554 # so that -L comes before libs that need it for instance...
7555 if test lib,link = "$linkmode,$pass"; then
7556 ## FIXME: Find the place where the list is rebuilt in the wrong
7557 ## order, and fix it there properly
7559 for deplib in $deplibs; do
7560 tmp_deplibs="$deplib $tmp_deplibs"
7562 deplibs=$tmp_deplibs
7565 if test lib,link = "$linkmode,$pass" ||
7566 test prog,scan = "$linkmode,$pass"; then
7570 if test prog = "$linkmode"; then
7572 dlopen) libs=$dlfiles ;;
7573 dlpreopen) libs=$dlprefiles ;;
7574 link) libs="$deplibs %DEPLIBS% $dependency_libs" ;;
7577 if test lib,dlpreopen = "$linkmode,$pass"; then
7578 # Collect and forward deplibs of preopened libtool libs
7579 for lib in $dlprefiles; do
7580 # Ignore non-libtool-libs
7582 func_resolve_sysroot "$lib"
7584 *.la) func_source "$func_resolve_sysroot_result" ;;
7587 # Collect preopened libtool deplibs, except any this library
7588 # has declared as weak libs
7589 for deplib in $dependency_libs; do
7590 func_basename "$deplib"
7591 deplib_base=$func_basename_result
7592 case " $weak_libs " in
7593 *" $deplib_base "*) ;;
7594 *) func_append deplibs " $deplib" ;;
7600 if test dlopen = "$pass"; then
7601 # Collect dlpreopened libraries
7602 save_deplibs=$deplibs
7606 for deplib in $libs; do
7610 -mt|-mthreads|-kthread|-Kthread|-pthread|-pthreads|--thread-safe \
7611 |-threads|-fopenmp|-openmp|-mp|-xopenmp|-omp|-qsmp=*)
7612 if test prog,link = "$linkmode,$pass"; then
7613 compile_deplibs="$deplib $compile_deplibs"
7614 finalize_deplibs="$deplib $finalize_deplibs"
7616 func_append compiler_flags " $deplib"
7617 if test lib = "$linkmode"; then
7618 case "$new_inherited_linker_flags " in
7620 * ) func_append new_inherited_linker_flags " $deplib" ;;
7627 if test lib != "$linkmode" && test prog != "$linkmode"; then
7628 func_warning "'-l' is ignored for archives/objects"
7631 func_stripname '-l' '' "$deplib"
7632 name=$func_stripname_result
7633 if test lib = "$linkmode"; then
7634 searchdirs="$newlib_search_path $lib_search_path $compiler_lib_search_dirs $sys_lib_search_path $shlib_search_path"
7636 searchdirs="$newlib_search_path $lib_search_path $sys_lib_search_path $shlib_search_path"
7638 for searchdir in $searchdirs; do
7639 for search_ext in .la $std_shrext .so .a; do
7640 # Search the libtool library
7641 lib=$searchdir/lib$name$search_ext
7642 if test -f "$lib"; then
7643 if test .la = "$search_ext"; then
7653 # deplib is a libtool library
7654 # If $allow_libtool_libs_with_static_runtimes && $deplib is a stdlib,
7655 # We need to do some special things here, and not later.
7656 if test yes = "$allow_libtool_libs_with_static_runtimes"; then
7657 case " $predeps $postdeps " in
7659 if func_lalib_p "$lib"; then
7663 for l in $old_library $library_names; do
7666 if test "X$ll" = "X$old_library"; then # only static version available
7668 func_dirname "$lib" "" "."
7669 ladir=$func_dirname_result
7670 lib=$ladir/$old_library
7671 if test prog,link = "$linkmode,$pass"; then
7672 compile_deplibs="$deplib $compile_deplibs"
7673 finalize_deplibs="$deplib $finalize_deplibs"
7675 deplibs="$deplib $deplibs"
7676 test lib = "$linkmode" && newdependency_libs="$deplib $newdependency_libs"
7686 # deplib doesn't seem to be a libtool library
7687 if test prog,link = "$linkmode,$pass"; then
7688 compile_deplibs="$deplib $compile_deplibs"
7689 finalize_deplibs="$deplib $finalize_deplibs"
7691 deplibs="$deplib $deplibs"
7692 test lib = "$linkmode" && newdependency_libs="$deplib $newdependency_libs"
7698 if test prog,link = "$linkmode,$pass"; then
7699 compile_deplibs="$deplib $compile_deplibs"
7700 finalize_deplibs="$deplib $finalize_deplibs"
7702 deplibs="$deplib $deplibs"
7703 if test lib = "$linkmode"; then
7704 case "$new_inherited_linker_flags " in
7706 * ) func_append new_inherited_linker_flags " $deplib" ;;
7715 deplibs="$deplib $deplibs"
7716 test conv = "$pass" && continue
7717 newdependency_libs="$deplib $newdependency_libs"
7718 func_stripname '-L' '' "$deplib"
7719 func_resolve_sysroot "$func_stripname_result"
7720 func_append newlib_search_path " $func_resolve_sysroot_result"
7723 if test conv = "$pass"; then
7724 deplibs="$deplib $deplibs"
7727 if test scan = "$pass"; then
7728 deplibs="$deplib $deplibs"
7730 compile_deplibs="$deplib $compile_deplibs"
7731 finalize_deplibs="$deplib $finalize_deplibs"
7733 func_stripname '-L' '' "$deplib"
7734 func_resolve_sysroot "$func_stripname_result"
7735 func_append newlib_search_path " $func_resolve_sysroot_result"
7738 func_warning "'-L' is ignored for archives/objects"
7744 if test link = "$pass"; then
7745 func_stripname '-R' '' "$deplib"
7746 func_resolve_sysroot "$func_stripname_result"
7747 dir=$func_resolve_sysroot_result
7748 # Make sure the xrpath contains only unique directories.
7751 *) func_append xrpath " $dir" ;;
7754 deplibs="$deplib $deplibs"
7758 func_resolve_sysroot "$deplib"
7759 lib=$func_resolve_sysroot_result
7762 if test conv = "$pass"; then
7763 deplibs="$deplib $deplibs"
7768 # Linking convenience modules into shared libraries is allowed,
7769 # but linking other static libraries is non-portable.
7770 case " $dlpreconveniencelibs " in
7774 case $deplibs_check_method in
7776 set dummy $deplibs_check_method; shift
7777 match_pattern_regex=`expr "$deplibs_check_method" : "$1 \(.*\)"`
7778 if eval "\$ECHO \"$deplib\"" 2>/dev/null | $SED 10q \
7779 | $EGREP "$match_pattern_regex" > /dev/null; then
7787 if $valid_a_lib; then
7789 $ECHO "*** Warning: Linking the shared library $output against the"
7790 $ECHO "*** static library $deplib is not portable!"
7791 deplibs="$deplib $deplibs"
7794 $ECHO "*** Warning: Trying to link with static lib archive $deplib."
7795 echo "*** I have the capability to make that library automatically link in when"
7796 echo "*** you link to this library. But I can only do this if you have a"
7797 echo "*** shared version of the library, which you do not appear to have"
7798 echo "*** because the file extensions .$libext of this argument makes me believe"
7799 echo "*** that it is just a static archive that I should not use here."
7806 if test link != "$pass"; then
7807 deplibs="$deplib $deplibs"
7809 compile_deplibs="$deplib $compile_deplibs"
7810 finalize_deplibs="$deplib $finalize_deplibs"
7817 if test conv = "$pass"; then
7818 deplibs="$deplib $deplibs"
7819 elif test prog = "$linkmode"; then
7820 if test dlpreopen = "$pass" || test yes != "$dlopen_support" || test no = "$build_libtool_libs"; then
7821 # If there is no dlopen support or we're linking statically,
7822 # we need to preload.
7823 func_append newdlprefiles " $deplib"
7824 compile_deplibs="$deplib $compile_deplibs"
7825 finalize_deplibs="$deplib $finalize_deplibs"
7827 func_append newdlfiles " $deplib"
7838 $found || test -f "$lib" \
7839 || func_fatal_error "cannot find the library '$lib' or unhandled argument '$deplib'"
7841 # Check to see that this really is a libtool archive.
7842 func_lalib_unsafe_p "$lib" \
7843 || func_fatal_error "'$lib' is not a valid libtool archive"
7845 func_dirname "$lib" "" "."
7846 ladir=$func_dirname_result
7854 inherited_linker_flags=
7855 # If the library was installed with an old release of libtool,
7856 # it will not redefine variables installed, or shouldnotlink
7865 # Convert "-framework foo" to "foo.ltframework"
7866 if test -n "$inherited_linker_flags"; then
7867 tmp_inherited_linker_flags=`$ECHO "$inherited_linker_flags" | $SED 's/-framework \([^ $]*\)/\1.ltframework/g'`
7868 for tmp_inherited_linker_flag in $tmp_inherited_linker_flags; do
7869 case " $new_inherited_linker_flags " in
7870 *" $tmp_inherited_linker_flag "*) ;;
7871 *) func_append new_inherited_linker_flags " $tmp_inherited_linker_flag";;
7875 dependency_libs=`$ECHO " $dependency_libs" | $SED 's% \([^ $]*\).ltframework% -framework \1%g'`
7876 if test lib,link = "$linkmode,$pass" ||
7877 test prog,scan = "$linkmode,$pass" ||
7878 { test prog != "$linkmode" && test lib != "$linkmode"; }; then
7879 test -n "$dlopen" && func_append dlfiles " $dlopen"
7880 test -n "$dlpreopen" && func_append dlprefiles " $dlpreopen"
7883 if test conv = "$pass"; then
7884 # Only check for convenience libraries
7885 deplibs="$lib $deplibs"
7886 if test -z "$libdir"; then
7887 if test -z "$old_library"; then
7888 func_fatal_error "cannot find name of link library for '$lib'"
7890 # It is a libtool convenience library, so add in its objects.
7891 func_append convenience " $ladir/$objdir/$old_library"
7892 func_append old_convenience " $ladir/$objdir/$old_library"
7893 elif test prog != "$linkmode" && test lib != "$linkmode"; then
7894 func_fatal_error "'$lib' is not a convenience library"
7897 for deplib in $dependency_libs; do
7898 deplibs="$deplib $deplibs"
7899 if $opt_preserve_dup_deps; then
7900 case "$tmp_libs " in
7901 *" $deplib "*) func_append specialdeplibs " $deplib" ;;
7904 func_append tmp_libs " $deplib"
7910 # Get the name of the library we link against.
7912 if test -n "$old_library" &&
7913 { test yes = "$prefer_static_libs" ||
7914 test built,no = "$prefer_static_libs,$installed"; }; then
7915 linklib=$old_library
7917 for l in $old_library $library_names; do
7921 if test -z "$linklib"; then
7922 func_fatal_error "cannot find name of link library for '$lib'"
7925 # This library was specified with -dlopen.
7926 if test dlopen = "$pass"; then
7928 && func_fatal_error "cannot -dlopen a convenience library: '$lib'"
7929 if test -z "$dlname" ||
7930 test yes != "$dlopen_support" ||
7931 test no = "$build_libtool_libs"
7933 # If there is no dlname, no dlopen support or we're linking
7934 # statically, we need to preload. We also need to preload any
7935 # dependent libraries so libltdl's deplib preloader doesn't
7936 # bomb out in the load deplibs phase.
7937 func_append dlprefiles " $lib $dependency_libs"
7939 func_append newdlfiles " $lib"
7944 # We need an absolute path.
7946 [\\/]* | [A-Za-z]:[\\/]*) abs_ladir=$ladir ;;
7948 abs_ladir=`cd "$ladir" && pwd`
7949 if test -z "$abs_ladir"; then
7950 func_warning "cannot determine absolute directory name of '$ladir'"
7951 func_warning "passing it literally to the linker, although it might fail"
7956 func_basename "$lib"
7957 laname=$func_basename_result
7959 # Find the relevant object directory and library name.
7960 if test yes = "$installed"; then
7961 if test ! -f "$lt_sysroot$libdir/$linklib" && test -f "$abs_ladir/$linklib"; then
7962 func_warning "library '$lib' was moved."
7967 dir=$lt_sysroot$libdir
7968 absdir=$lt_sysroot$libdir
7970 test yes = "$hardcode_automatic" && avoidtemprpath=yes
7972 if test ! -f "$ladir/$objdir/$linklib" && test -f "$abs_ladir/$linklib"; then
7975 # Remove this search path later
7976 func_append notinst_path " $abs_ladir"
7979 absdir=$abs_ladir/$objdir
7980 # Remove this search path later
7981 func_append notinst_path " $abs_ladir"
7983 fi # $installed = yes
7984 func_stripname 'lib' '.la' "$laname"
7985 name=$func_stripname_result
7987 # This library was specified with -dlpreopen.
7988 if test dlpreopen = "$pass"; then
7989 if test -z "$libdir" && test prog = "$linkmode"; then
7990 func_fatal_error "only libraries may -dlpreopen a convenience library: '$lib'"
7993 # special handling for platforms with PE-DLLs.
7994 *cygwin* | *mingw* | *cegcc* )
7995 # Linker will automatically link against shared library if both
7996 # static and shared are present. Therefore, ensure we extract
7997 # symbols from the import library if a shared library is present
7998 # (otherwise, the dlopen module name will be incorrect). We do
7999 # this by putting the import library name into $newdlprefiles.
8000 # We recover the dlopen module name by 'saving' the la file
8001 # name in a special purpose variable, and (later) extracting the
8002 # dlname from the la file.
8003 if test -n "$dlname"; then
8004 func_tr_sh "$dir/$linklib"
8005 eval "libfile_$func_tr_sh_result=\$abs_ladir/\$laname"
8006 func_append newdlprefiles " $dir/$linklib"
8008 func_append newdlprefiles " $dir/$old_library"
8009 # Keep a list of preopened convenience libraries to check
8010 # that they are being used correctly in the link pass.
8011 test -z "$libdir" && \
8012 func_append dlpreconveniencelibs " $dir/$old_library"
8016 # Prefer using a static library (so that no silly _DYNAMIC symbols
8017 # are required to link).
8018 if test -n "$old_library"; then
8019 func_append newdlprefiles " $dir/$old_library"
8020 # Keep a list of preopened convenience libraries to check
8021 # that they are being used correctly in the link pass.
8022 test -z "$libdir" && \
8023 func_append dlpreconveniencelibs " $dir/$old_library"
8024 # Otherwise, use the dlname, so that lt_dlopen finds it.
8025 elif test -n "$dlname"; then
8026 func_append newdlprefiles " $dir/$dlname"
8028 func_append newdlprefiles " $dir/$linklib"
8032 fi # $pass = dlpreopen
8034 if test -z "$libdir"; then
8035 # Link the convenience library
8036 if test lib = "$linkmode"; then
8037 deplibs="$dir/$old_library $deplibs"
8038 elif test prog,link = "$linkmode,$pass"; then
8039 compile_deplibs="$dir/$old_library $compile_deplibs"
8040 finalize_deplibs="$dir/$old_library $finalize_deplibs"
8042 deplibs="$lib $deplibs" # used for prog,scan pass
8048 if test prog = "$linkmode" && test link != "$pass"; then
8049 func_append newlib_search_path " $ladir"
8050 deplibs="$lib $deplibs"
8052 linkalldeplibs=false
8053 if test no != "$link_all_deplibs" || test -z "$library_names" ||
8054 test no = "$build_libtool_libs"; then
8059 for deplib in $dependency_libs; do
8061 -L*) func_stripname '-L' '' "$deplib"
8062 func_resolve_sysroot "$func_stripname_result"
8063 func_append newlib_search_path " $func_resolve_sysroot_result"
8066 # Need to link against all dependency_libs?
8067 if $linkalldeplibs; then
8068 deplibs="$deplib $deplibs"
8070 # Need to hardcode shared library paths
8071 # or/and link against static libraries
8072 newdependency_libs="$deplib $newdependency_libs"
8074 if $opt_preserve_dup_deps; then
8075 case "$tmp_libs " in
8076 *" $deplib "*) func_append specialdeplibs " $deplib" ;;
8079 func_append tmp_libs " $deplib"
8082 fi # $linkmode = prog...
8084 if test prog,link = "$linkmode,$pass"; then
8085 if test -n "$library_names" &&
8086 { { test no = "$prefer_static_libs" ||
8087 test built,yes = "$prefer_static_libs,$installed"; } ||
8088 test -z "$old_library"; }; then
8089 # We need to hardcode the library path
8090 if test -n "$shlibpath_var" && test -z "$avoidtemprpath"; then
8091 # Make sure the rpath contains only unique directories.
8092 case $temp_rpath: in
8094 *) func_append temp_rpath "$absdir:" ;;
8098 # Hardcode the library path.
8099 # Skip directories that are in the system default run-time
8101 case " $sys_lib_dlsearch_path " in
8104 case "$compile_rpath " in
8106 *) func_append compile_rpath " $absdir" ;;
8110 case " $sys_lib_dlsearch_path " in
8113 case "$finalize_rpath " in
8115 *) func_append finalize_rpath " $libdir" ;;
8119 fi # $linkmode,$pass = prog,link...
8122 { test pass_all = "$deplibs_check_method" ||
8123 { test yes = "$build_libtool_libs" &&
8124 test -n "$library_names"; }; }; then
8125 # We only need to search for static libraries
8130 link_static=no # Whether the deplib will be linked statically
8131 use_static_libs=$prefer_static_libs
8132 if test built = "$use_static_libs" && test yes = "$installed"; then
8135 if test -n "$library_names" &&
8136 { test no = "$use_static_libs" || test -z "$old_library"; }; then
8138 *cygwin* | *mingw* | *cegcc* | *os2*)
8139 # No point in relinking DLLs because paths are not encoded
8140 func_append notinst_deplibs " $lib"
8144 if test no = "$installed"; then
8145 func_append notinst_deplibs " $lib"
8150 # This is a shared library
8152 # Warn about portability, can't link against -module's on some
8153 # systems (darwin). Don't bleat about dlopened modules though!
8155 for dlpremoduletest in $dlprefiles; do
8156 if test "X$dlpremoduletest" = "X$lib"; then
8157 dlopenmodule=$dlpremoduletest
8161 if test -z "$dlopenmodule" && test yes = "$shouldnotlink" && test link = "$pass"; then
8163 if test prog = "$linkmode"; then
8164 $ECHO "*** Warning: Linking the executable $output against the loadable module"
8166 $ECHO "*** Warning: Linking the shared library $output against the loadable module"
8168 $ECHO "*** $linklib is not portable!"
8170 if test lib = "$linkmode" &&
8171 test yes = "$hardcode_into_libs"; then
8172 # Hardcode the library path.
8173 # Skip directories that are in the system default run-time
8175 case " $sys_lib_dlsearch_path " in
8178 case "$compile_rpath " in
8180 *) func_append compile_rpath " $absdir" ;;
8184 case " $sys_lib_dlsearch_path " in
8187 case "$finalize_rpath " in
8189 *) func_append finalize_rpath " $libdir" ;;
8195 if test -n "$old_archive_from_expsyms_cmds"; then
8196 # figure out the soname
8197 set dummy $library_names
8201 libname=`eval "\\$ECHO \"$libname_spec\""`
8202 # use dlname if we got it. it's perfectly good, no?
8203 if test -n "$dlname"; then
8205 elif test -n "$soname_spec"; then
8208 *cygwin* | mingw* | *cegcc* | *os2*)
8209 func_arith $current - $age
8210 major=$func_arith_result
8214 eval soname=\"$soname_spec\"
8219 # Make a new name for the extract_expsyms_cmds to use
8221 func_basename "$soroot"
8222 soname=$func_basename_result
8223 func_stripname 'lib' '.dll' "$soname"
8224 newlib=libimp-$func_stripname_result.a
8226 # If the library has no export list, then create one now
8227 if test -f "$output_objdir/$soname-def"; then :
8229 func_verbose "extracting exported symbol list from '$soname'"
8230 func_execute_cmds "$extract_expsyms_cmds" 'exit $?'
8234 if test -f "$output_objdir/$newlib"; then :; else
8235 func_verbose "generating import library for '$soname'"
8236 func_execute_cmds "$old_archive_from_expsyms_cmds" 'exit $?'
8238 # make sure the library variables are pointing to the new library
8241 fi # test -n "$old_archive_from_expsyms_cmds"
8243 if test prog = "$linkmode" || test relink != "$opt_mode"; then
8248 case $hardcode_action in
8249 immediate | unsupported)
8250 if test no = "$hardcode_direct"; then
8253 *-*-sco3.2v5.0.[024]*) add_dir=-L$dir ;;
8254 *-*-sysv4*uw2*) add_dir=-L$dir ;;
8255 *-*-sysv5OpenUNIX* | *-*-sysv5UnixWare7.[01].[10]* | \
8256 *-*-unixware7*) add_dir=-L$dir ;;
8258 # if the lib is a (non-dlopened) module then we cannot
8259 # link against it, someone is ignoring the earlier warnings
8260 if /usr/bin/file -L $add 2> /dev/null |
8261 $GREP ": [^:]* bundle" >/dev/null; then
8262 if test "X$dlopenmodule" != "X$lib"; then
8263 $ECHO "*** Warning: lib $linklib is a module, not a shared library"
8264 if test -z "$old_library"; then
8266 echo "*** And there doesn't seem to be a static archive available"
8267 echo "*** The link will probably fail, sorry"
8269 add=$dir/$old_library
8271 elif test -n "$old_library"; then
8272 add=$dir/$old_library
8276 elif test no = "$hardcode_minus_L"; then
8278 *-*-sunos*) add_shlibpath=$dir ;;
8282 elif test no = "$hardcode_shlibpath_var"; then
8290 if test yes = "$hardcode_direct" &&
8291 test no = "$hardcode_direct_absolute"; then
8293 elif test yes = "$hardcode_minus_L"; then
8295 # Try looking first in the location we're being installed to.
8296 if test -n "$inst_prefix_dir"; then
8299 func_append add_dir " -L$inst_prefix_dir$libdir"
8304 elif test yes = "$hardcode_shlibpath_var"; then
8314 if test yes != "$lib_linked"; then
8315 func_fatal_configuration "unsupported hardcode properties"
8318 if test -n "$add_shlibpath"; then
8319 case :$compile_shlibpath: in
8320 *":$add_shlibpath:"*) ;;
8321 *) func_append compile_shlibpath "$add_shlibpath:" ;;
8324 if test prog = "$linkmode"; then
8325 test -n "$add_dir" && compile_deplibs="$add_dir $compile_deplibs"
8326 test -n "$add" && compile_deplibs="$add $compile_deplibs"
8328 test -n "$add_dir" && deplibs="$add_dir $deplibs"
8329 test -n "$add" && deplibs="$add $deplibs"
8330 if test yes != "$hardcode_direct" &&
8331 test yes != "$hardcode_minus_L" &&
8332 test yes = "$hardcode_shlibpath_var"; then
8333 case :$finalize_shlibpath: in
8335 *) func_append finalize_shlibpath "$libdir:" ;;
8341 if test prog = "$linkmode" || test relink = "$opt_mode"; then
8345 # Finalize command for both is simple: just hardcode it.
8346 if test yes = "$hardcode_direct" &&
8347 test no = "$hardcode_direct_absolute"; then
8348 if test -f "$inst_prefix_dir$libdir/$linklib"; then
8349 add="$inst_prefix_dir$libdir/$linklib"
8351 add="$libdir/$linklib"
8353 elif test yes = "$hardcode_minus_L"; then
8356 elif test yes = "$hardcode_shlibpath_var"; then
8357 case :$finalize_shlibpath: in
8359 *) func_append finalize_shlibpath "$libdir:" ;;
8362 elif test yes = "$hardcode_automatic"; then
8363 if test -n "$inst_prefix_dir" &&
8364 test -f "$inst_prefix_dir$libdir/$linklib"; then
8365 add=$inst_prefix_dir$libdir/$linklib
8367 add=$libdir/$linklib
8370 # We cannot seem to hardcode it, guess we'll fake it.
8372 # Try looking first in the location we're being installed to.
8373 if test -n "$inst_prefix_dir"; then
8376 func_append add_dir " -L$inst_prefix_dir$libdir"
8383 if test prog = "$linkmode"; then
8384 test -n "$add_dir" && finalize_deplibs="$add_dir $finalize_deplibs"
8385 test -n "$add" && finalize_deplibs="$add $finalize_deplibs"
8387 test -n "$add_dir" && deplibs="$add_dir $deplibs"
8388 test -n "$add" && deplibs="$add $deplibs"
8391 elif test prog = "$linkmode"; then
8392 # Here we assume that one of hardcode_direct or hardcode_minus_L
8393 # is not unsupported. This is valid on all known static and
8395 if test unsupported != "$hardcode_direct"; then
8396 test -n "$old_library" && linklib=$old_library
8397 compile_deplibs="$dir/$linklib $compile_deplibs"
8398 finalize_deplibs="$dir/$linklib $finalize_deplibs"
8400 compile_deplibs="-l$name -L$dir $compile_deplibs"
8401 finalize_deplibs="-l$name -L$dir $finalize_deplibs"
8403 elif test yes = "$build_libtool_libs"; then
8404 # Not a shared library
8405 if test pass_all != "$deplibs_check_method"; then
8406 # We're trying link a shared library against a static one
8407 # but the system doesn't support it.
8409 # Just print a warning and add the library to dependency_libs so
8410 # that the program can be linked against the static library.
8412 $ECHO "*** Warning: This system cannot link to static lib archive $lib."
8413 echo "*** I have the capability to make that library automatically link in when"
8414 echo "*** you link to this library. But I can only do this if you have a"
8415 echo "*** shared version of the library, which you do not appear to have."
8416 if test yes = "$module"; then
8417 echo "*** But as you try to build a module library, libtool will still create "
8418 echo "*** a static module, that should work as long as the dlopening application"
8419 echo "*** is linked with the -dlopen flag to resolve symbols at runtime."
8420 if test -z "$global_symbol_pipe"; then
8422 echo "*** However, this would only work if libtool was able to extract symbol"
8423 echo "*** lists from a program, using 'nm' or equivalent, but libtool could"
8424 echo "*** not find such a program. So, this module is probably useless."
8425 echo "*** 'nm' from GNU binutils and a full rebuild may help."
8427 if test no = "$build_old_libs"; then
8428 build_libtool_libs=module
8431 build_libtool_libs=no
8435 deplibs="$dir/$old_library $deplibs"
8438 fi # link shared/static library?
8440 if test lib = "$linkmode"; then
8441 if test -n "$dependency_libs" &&
8442 { test yes != "$hardcode_into_libs" ||
8443 test yes = "$build_old_libs" ||
8444 test yes = "$link_static"; }; then
8445 # Extract -R from dependency_libs
8447 for libdir in $dependency_libs; do
8449 -R*) func_stripname '-R' '' "$libdir"
8450 temp_xrpath=$func_stripname_result
8452 *" $temp_xrpath "*) ;;
8453 *) func_append xrpath " $temp_xrpath";;
8455 *) func_append temp_deplibs " $libdir";;
8458 dependency_libs=$temp_deplibs
8461 func_append newlib_search_path " $absdir"
8462 # Link against this library
8463 test no = "$link_static" && newdependency_libs="$abs_ladir/$laname $newdependency_libs"
8464 # ... and its dependency_libs
8466 for deplib in $dependency_libs; do
8467 newdependency_libs="$deplib $newdependency_libs"
8469 -L*) func_stripname '-L' '' "$deplib"
8470 func_resolve_sysroot "$func_stripname_result";;
8471 *) func_resolve_sysroot "$deplib" ;;
8473 if $opt_preserve_dup_deps; then
8474 case "$tmp_libs " in
8475 *" $func_resolve_sysroot_result "*)
8476 func_append specialdeplibs " $func_resolve_sysroot_result" ;;
8479 func_append tmp_libs " $func_resolve_sysroot_result"
8482 if test no != "$link_all_deplibs"; then
8483 # Add the search paths of all dependency libraries
8484 for deplib in $dependency_libs; do
8487 -L*) path=$deplib ;;
8489 func_resolve_sysroot "$deplib"
8490 deplib=$func_resolve_sysroot_result
8491 func_dirname "$deplib" "" "."
8492 dir=$func_dirname_result
8493 # We need an absolute path.
8495 [\\/]* | [A-Za-z]:[\\/]*) absdir=$dir ;;
8497 absdir=`cd "$dir" && pwd`
8498 if test -z "$absdir"; then
8499 func_warning "cannot determine absolute directory name of '$dir'"
8504 if $GREP "^installed=no" $deplib > /dev/null; then
8508 eval deplibrary_names=`$SED -n -e 's/^library_names=\(.*\)$/\1/p' $deplib`
8509 if test -n "$deplibrary_names"; then
8510 for tmp in $deplibrary_names; do
8513 if test -f "$absdir/$objdir/$depdepl"; then
8514 depdepl=$absdir/$objdir/$depdepl
8515 darwin_install_name=`$OTOOL -L $depdepl | awk '{if (NR == 2) {print $1;exit}}'`
8516 if test -z "$darwin_install_name"; then
8517 darwin_install_name=`$OTOOL64 -L $depdepl | awk '{if (NR == 2) {print $1;exit}}'`
8519 func_append compiler_flags " $wl-dylib_file $wl$darwin_install_name:$depdepl"
8520 func_append linker_flags " -dylib_file $darwin_install_name:$depdepl"
8526 path=-L$absdir/$objdir
8530 eval libdir=`$SED -n -e 's/^libdir=\(.*\)$/\1/p' $deplib`
8531 test -z "$libdir" && \
8532 func_fatal_error "'$deplib' is not a valid libtool archive"
8533 test "$absdir" != "$libdir" && \
8534 func_warning "'$deplib' seems to be moved"
8540 case " $deplibs " in
8542 *) deplibs="$path $deplibs" ;;
8545 fi # link_all_deplibs != no
8547 done # for deplib in $libs
8548 if test link = "$pass"; then
8549 if test prog = "$linkmode"; then
8550 compile_deplibs="$new_inherited_linker_flags $compile_deplibs"
8551 finalize_deplibs="$new_inherited_linker_flags $finalize_deplibs"
8553 compiler_flags="$compiler_flags "`$ECHO " $new_inherited_linker_flags" | $SED 's% \([^ $]*\).ltframework% -framework \1%g'`
8556 dependency_libs=$newdependency_libs
8557 if test dlpreopen = "$pass"; then
8558 # Link the dlpreopened libraries before other libraries
8559 for deplib in $save_deplibs; do
8560 deplibs="$deplib $deplibs"
8563 if test dlopen != "$pass"; then
8564 test conv = "$pass" || {
8565 # Make sure lib_search_path contains only unique directories.
8567 for dir in $newlib_search_path; do
8568 case "$lib_search_path " in
8570 *) func_append lib_search_path " $dir" ;;
8576 if test prog,link = "$linkmode,$pass"; then
8577 vars="compile_deplibs finalize_deplibs"
8581 for var in $vars dependency_libs; do
8582 # Add libraries to $var in reverse order
8583 eval tmp_libs=\"\$$var\"
8585 for deplib in $tmp_libs; do
8586 # FIXME: Pedantically, this is the right thing to do, so
8587 # that some nasty dependency loop isn't accidentally
8589 #new_libs="$deplib $new_libs"
8590 # Pragmatically, this seems to cause very few problems in
8593 -L*) new_libs="$deplib $new_libs" ;;
8596 # And here is the reason: when a library appears more
8597 # than once as an explicit dependence of a library, or
8598 # is implicitly linked in more than once by the
8599 # compiler, it is considered special, and multiple
8600 # occurrences thereof are not removed. Compare this
8601 # with having the same library being listed as a
8602 # dependency of multiple other libraries: in this case,
8603 # we know (pedantically, we assume) the library does not
8604 # need to be listed more than once, so we keep only the
8605 # last copy. This is not always right, but it is rare
8606 # enough that we require users that really mean to play
8607 # such unportable linking tricks to link the library
8608 # using -Wl,-lname, so that libtool does not consider it
8609 # for duplicate removal.
8610 case " $specialdeplibs " in
8611 *" $deplib "*) new_libs="$deplib $new_libs" ;;
8613 case " $new_libs " in
8615 *) new_libs="$deplib $new_libs" ;;
8623 for deplib in $new_libs; do
8626 case " $tmp_libs " in
8628 *) func_append tmp_libs " $deplib" ;;
8631 *) func_append tmp_libs " $deplib" ;;
8634 eval $var=\"$tmp_libs\"
8638 # Add Sun CC postdeps if required:
8639 test CXX = "$tagname" && {
8642 case `$CC -V 2>&1 | sed 5q` in
8643 *Sun\ C*) # Sun C++ 5.9
8646 if test no != "$suncc_use_cstd_abi"; then
8647 func_append postdeps ' -library=Cstd -library=Crun'
8654 func_cc_basename "$CC"
8655 case $func_cc_basename_result in
8659 if test no != "$suncc_use_cstd_abi"; then
8660 func_append postdeps ' -library=Cstd -library=Crun'
8668 # Last step: remove runtime libs from dependency_libs
8669 # (they stay in deplibs)
8671 for i in $dependency_libs; do
8672 case " $predeps $postdeps $compiler_lib_search_path " in
8677 if test -n "$i"; then
8678 func_append tmp_libs " $i"
8681 dependency_libs=$tmp_libs
8683 if test prog = "$linkmode"; then
8686 if test prog = "$linkmode" || test lib = "$linkmode"; then
8687 dlprefiles=$newdlprefiles
8692 if test -n "$dlfiles$dlprefiles" || test no != "$dlself"; then
8693 func_warning "'-dlopen' is ignored for archives"
8698 func_warning "'-l' and '-L' are ignored for archives" ;;
8701 test -n "$rpath" && \
8702 func_warning "'-rpath' is ignored for archives"
8704 test -n "$xrpath" && \
8705 func_warning "'-R' is ignored for archives"
8707 test -n "$vinfo" && \
8708 func_warning "'-version-info/-version-number' is ignored for archives"
8710 test -n "$release" && \
8711 func_warning "'-release' is ignored for archives"
8713 test -n "$export_symbols$export_symbols_regex" && \
8714 func_warning "'-export-symbols' is ignored for archives"
8716 # Now set the variables for building old libraries.
8717 build_libtool_libs=no
8719 func_append objs "$old_deplibs"
8723 # Make sure we only generate libraries of the form 'libNAME.la'.
8726 func_stripname 'lib' '.la' "$outputname"
8727 name=$func_stripname_result
8728 eval shared_ext=\"$shrext_cmds\"
8729 eval libname=\"$libname_spec\"
8732 test no = "$module" \
8733 && func_fatal_help "libtool library '$output' must begin with 'lib'"
8735 if test no != "$need_lib_prefix"; then
8736 # Add the "lib" prefix for modules if required
8737 func_stripname '' '.la' "$outputname"
8738 name=$func_stripname_result
8739 eval shared_ext=\"$shrext_cmds\"
8740 eval libname=\"$libname_spec\"
8742 func_stripname '' '.la' "$outputname"
8743 libname=$func_stripname_result
8748 if test -n "$objs"; then
8749 if test pass_all != "$deplibs_check_method"; then
8750 func_fatal_error "cannot build libtool library '$output' from non-libtool objects on this host:$objs"
8753 $ECHO "*** Warning: Linking the shared library $output against the non-libtool"
8754 $ECHO "*** objects $objs is not portable!"
8755 func_append libobjs " $objs"
8759 test no = "$dlself" \
8760 || func_warning "'-dlopen self' is ignored for libtool libraries"
8765 && func_warning "ignoring multiple '-rpath's for a libtool library"
8770 if test -z "$rpath"; then
8771 if test yes = "$build_libtool_libs"; then
8772 # Building a libtool convenience library.
8773 # Some compilers have problems with a '.al' extension so
8774 # convenience libraries should have the same extension an
8775 # archive normally would.
8776 oldlibs="$output_objdir/$libname.$libext $oldlibs"
8777 build_libtool_libs=convenience
8781 test -n "$vinfo" && \
8782 func_warning "'-version-info/-version-number' is ignored for convenience libraries"
8784 test -n "$release" && \
8785 func_warning "'-release' is ignored for convenience libraries"
8788 # Parse the version information argument.
8789 save_ifs=$IFS; IFS=:
8790 set dummy $vinfo 0 0 0
8795 func_fatal_help "too many parameters to '-version-info'"
8797 # convert absolute version numbers to libtool ages
8798 # this retains compatibility with .la files and attempts
8799 # to make the code below a bit more comprehensible
8801 case $vinfo_number in
8807 # There are really only two kinds -- those that
8808 # use the current revision as the major version
8809 # and those that subtract age and use age as
8810 # a minor version. But, then there is irix
8811 # that has an extra 1 added just for fun
8813 case $version_type in
8814 # correct linux to gnu/linux during the next big refactor
8815 darwin|freebsd-elf|linux|osf|windows|none)
8816 func_arith $number_major + $number_minor
8817 current=$func_arith_result
8819 revision=$number_revision
8821 freebsd-aout|qnx|sunos)
8822 current=$number_major
8823 revision=$number_minor
8827 func_arith $number_major + $number_minor
8828 current=$func_arith_result
8830 revision=$number_minor
8831 lt_irix_increment=no
8842 # Check that each of the things are valid numbers.
8844 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]) ;;
8846 func_error "CURRENT '$current' must be a nonnegative integer"
8847 func_fatal_error "'$vinfo' is not valid version information"
8852 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]) ;;
8854 func_error "REVISION '$revision' must be a nonnegative integer"
8855 func_fatal_error "'$vinfo' is not valid version information"
8860 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]) ;;
8862 func_error "AGE '$age' must be a nonnegative integer"
8863 func_fatal_error "'$vinfo' is not valid version information"
8867 if test "$age" -gt "$current"; then
8868 func_error "AGE '$age' is greater than the current interface number '$current'"
8869 func_fatal_error "'$vinfo' is not valid version information"
8872 # Calculate the version variables.
8877 case $version_type in
8881 # Like Linux, but with the current version available in
8882 # verstring for coding it into the library header
8883 func_arith $current - $age
8884 major=.$func_arith_result
8885 versuffix=$major.$age.$revision
8886 # Darwin ld doesn't like 0 for these options...
8887 func_arith $current + 1
8888 minor_current=$func_arith_result
8889 xlcverstring="$wl-compatibility_version $wl$minor_current $wl-current_version $wl$minor_current.$revision"
8890 verstring="-compatibility_version $minor_current -current_version $minor_current.$revision"
8891 # On Darwin other compilers
8894 verstring="$wl-compatibility_version $wl$minor_current $wl-current_version $wl$minor_current.$revision"
8897 verstring="-compatibility_version $minor_current -current_version $minor_current.$revision"
8904 versuffix=.$current.$revision
8908 func_arith $current - $age
8909 major=.$func_arith_result
8910 versuffix=$major.$age.$revision
8914 if test no = "$lt_irix_increment"; then
8915 func_arith $current - $age
8917 func_arith $current - $age + 1
8919 major=$func_arith_result
8921 case $version_type in
8922 nonstopux) verstring_prefix=nonstopux ;;
8923 *) verstring_prefix=sgi ;;
8925 verstring=$verstring_prefix$major.$revision
8927 # Add in all the interfaces that we are compatible with.
8929 while test 0 -ne "$loop"; do
8930 func_arith $revision - $loop
8931 iface=$func_arith_result
8932 func_arith $loop - 1
8933 loop=$func_arith_result
8934 verstring=$verstring_prefix$major.$iface:$verstring
8937 # Before this point, $major must not contain '.'.
8939 versuffix=$major.$revision
8942 linux) # correct to gnu/linux during the next big refactor
8943 func_arith $current - $age
8944 major=.$func_arith_result
8945 versuffix=$major.$age.$revision
8946 versuffix2=$major.$age
8950 func_arith $current - $age
8951 major=.$func_arith_result
8952 versuffix=.$current.$age.$revision
8953 verstring=$current.$age.$revision
8955 # Add in all the interfaces that we are compatible with.
8957 while test 0 -ne "$loop"; do
8958 func_arith $current - $loop
8959 iface=$func_arith_result
8960 func_arith $loop - 1
8961 loop=$func_arith_result
8962 verstring=$verstring:$iface.0
8965 # Make executables depend on our current version.
8966 func_append verstring ":$current.0"
8981 versuffix=.$current.$revision
8985 # Use '-' rather than '.', since we only want one
8986 # extension on DOS 8.3 file systems.
8987 func_arith $current - $age
8988 major=$func_arith_result
8993 func_fatal_configuration "unknown library version type '$version_type'"
8997 # Clear the version info if we defaulted, and they specified a release.
8998 if test -z "$vinfo" && test -n "$release"; then
9000 case $version_type in
9002 # we can't check for "0.0" in archive_cmds due to quoting
9003 # problems, so we reset it completely
9010 if test no = "$need_version"; then
9019 # Remove version info from name if versioning should be avoided
9020 if test yes,no = "$avoid_version,$need_version"; then
9027 # Check to see if the archive will have undefined symbols.
9028 if test yes = "$allow_undefined"; then
9029 if test unsupported = "$allow_undefined_flag"; then
9030 if test yes = "$build_old_libs"; then
9031 func_warning "undefined symbols not allowed in $host shared libraries; building static only"
9032 build_libtool_libs=no
9034 func_fatal_error "can't build $host shared library unless -no-undefined is specified"
9038 # Don't allow undefined symbols.
9039 allow_undefined_flag=$no_undefined_flag
9044 func_generate_dlsyms "$libname" "$libname" :
9045 func_append libobjs " $symfileobj"
9046 test " " = "$libobjs" && libobjs=
9048 if test relink != "$opt_mode"; then
9049 # Remove our outputs, but don't remove object files since they
9050 # may have been created when compiling PIC objects.
9052 tempremovelist=`$ECHO "$output_objdir/*"`
9053 for p in $tempremovelist; do
9057 $output_objdir/$outputname | $output_objdir/$libname.* | $output_objdir/$libname$release.*)
9058 if test -n "$precious_files_regex"; then
9059 if $ECHO "$p" | $EGREP -e "$precious_files_regex" >/dev/null 2>&1
9064 func_append removelist " $p"
9069 test -n "$removelist" && \
9070 func_show_eval "${RM}r \$removelist"
9073 # Now set the variables for building old libraries.
9074 if test yes = "$build_old_libs" && test convenience != "$build_libtool_libs"; then
9075 func_append oldlibs " $output_objdir/$libname.$libext"
9077 # Transform .lo files to .o files.
9078 oldobjs="$objs "`$ECHO "$libobjs" | $SP2NL | $SED "/\.$libext$/d; $lo2o" | $NL2SP`
9081 # Eliminate all temporary directories.
9082 #for path in $notinst_path; do
9083 # lib_search_path=`$ECHO "$lib_search_path " | $SED "s% $path % %g"`
9084 # deplibs=`$ECHO "$deplibs " | $SED "s% -L$path % %g"`
9085 # dependency_libs=`$ECHO "$dependency_libs " | $SED "s% -L$path % %g"`
9088 if test -n "$xrpath"; then
9089 # If the user specified any rpath flags, then add them.
9091 for libdir in $xrpath; do
9092 func_replace_sysroot "$libdir"
9093 func_append temp_xrpath " -R$func_replace_sysroot_result"
9094 case "$finalize_rpath " in
9096 *) func_append finalize_rpath " $libdir" ;;
9099 if test yes != "$hardcode_into_libs" || test yes = "$build_old_libs"; then
9100 dependency_libs="$temp_xrpath $dependency_libs"
9104 # Make sure dlfiles contains only unique files that won't be dlpreopened
9105 old_dlfiles=$dlfiles
9107 for lib in $old_dlfiles; do
9108 case " $dlprefiles $dlfiles " in
9110 *) func_append dlfiles " $lib" ;;
9114 # Make sure dlprefiles contains only unique files
9115 old_dlprefiles=$dlprefiles
9117 for lib in $old_dlprefiles; do
9118 case "$dlprefiles " in
9120 *) func_append dlprefiles " $lib" ;;
9124 if test yes = "$build_libtool_libs"; then
9125 if test -n "$rpath"; then
9127 *-*-cygwin* | *-*-mingw* | *-*-pw32* | *-*-os2* | *-*-beos* | *-cegcc* | *-*-haiku*)
9128 # these systems don't actually have a c library (as such)!
9130 *-*-rhapsody* | *-*-darwin1.[012])
9131 # Rhapsody C library is in the System framework
9132 func_append deplibs " System.ltframework"
9135 # Don't link with libc until the a.out ld.so is fixed.
9137 *-*-openbsd* | *-*-freebsd* | *-*-dragonfly* | *-*-mirbsd*)
9138 # Do not include libc due to us having libc/libc_r.
9140 *-*-sco3.2v5* | *-*-sco5v6*)
9141 # Causes problems with __ctype
9143 *-*-sysv4.2uw2* | *-*-sysv5* | *-*-unixware* | *-*-OpenUNIX*)
9144 # Compiler inserts libc in the correct place for threads to work
9147 # Add libc to deplibs on all other systems if necessary.
9148 if test yes = "$build_libtool_need_lc"; then
9149 func_append deplibs " -lc"
9155 # Transform deplibs into only deplibs that can be linked in shared.
9157 libname_save=$libname
9158 release_save=$release
9159 versuffix_save=$versuffix
9160 versuffix2_save=$versuffix2
9162 # I'm not sure if I'm treating the release correctly. I think
9163 # release should show up in the -l (ie -lgmp5) so we don't want to
9164 # add it in twice. Is that correct?
9171 case $deplibs_check_method in
9173 # Don't check for shared/static. Everything works.
9174 # This might be a little naive. We might want to check
9175 # whether the library exists or not. But this is on
9176 # osf3 & osf4 and I'm not really sure... Just
9177 # implementing what was already the behavior.
9181 # This code stresses the "libraries are programs" paradigm to its
9182 # limits. Maybe even breaks it. We compile a program, linking it
9183 # against the deplibs as a proxy for the library. Then we can check
9184 # whether they linked in statically or dynamically with ldd.
9185 $opt_dry_run || $RM conftest.c
9186 cat > conftest.c <<EOF
9187 int main() { return 0; }
9189 $opt_dry_run || $RM conftest
9190 if $LTCC $LTCFLAGS -o conftest conftest.c $deplibs; then
9191 ldd_output=`ldd conftest`
9192 for i in $deplibs; do
9195 func_stripname -l '' "$i"
9196 name=$func_stripname_result
9197 if test yes = "$allow_libtool_libs_with_static_runtimes"; then
9198 case " $predeps $postdeps " in
9200 func_append newdeplibs " $i"
9205 if test -n "$i"; then
9206 libname=`eval "\\$ECHO \"$libname_spec\""`
9207 deplib_matches=`eval "\\$ECHO \"$library_names_spec\""`
9208 set dummy $deplib_matches; shift
9210 if test `expr "$ldd_output" : ".*$deplib_match"` -ne 0; then
9211 func_append newdeplibs " $i"
9215 $ECHO "*** Warning: dynamic linker does not accept needed library $i."
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 I believe you do not have"
9219 echo "*** because a test_compile did reveal that the linker did not use it for"
9220 echo "*** its dynamic dependency list that programs get resolved with at runtime."
9225 func_append newdeplibs " $i"
9230 # Error occurred in the first compile. Let's try to salvage
9231 # the situation: Compile a separate program for each library.
9232 for i in $deplibs; do
9235 func_stripname -l '' "$i"
9236 name=$func_stripname_result
9237 $opt_dry_run || $RM conftest
9238 if $LTCC $LTCFLAGS -o conftest conftest.c $i; then
9239 ldd_output=`ldd conftest`
9240 if test yes = "$allow_libtool_libs_with_static_runtimes"; then
9241 case " $predeps $postdeps " in
9243 func_append newdeplibs " $i"
9248 if test -n "$i"; then
9249 libname=`eval "\\$ECHO \"$libname_spec\""`
9250 deplib_matches=`eval "\\$ECHO \"$library_names_spec\""`
9251 set dummy $deplib_matches; shift
9253 if test `expr "$ldd_output" : ".*$deplib_match"` -ne 0; then
9254 func_append newdeplibs " $i"
9258 $ECHO "*** Warning: dynamic linker does not accept needed library $i."
9259 echo "*** I have the capability to make that library automatically link in when"
9260 echo "*** you link to this library. But I can only do this if you have a"
9261 echo "*** shared version of the library, which you do not appear to have"
9262 echo "*** because a test_compile did reveal that the linker did not use this one"
9263 echo "*** as a dynamic dependency that programs can get resolved with at runtime."
9269 $ECHO "*** Warning! Library $i is needed by this library but I was not able to"
9270 echo "*** make it link in! You will probably need to install it or some"
9271 echo "*** library that it depends on before this library will be fully"
9272 echo "*** functional. Installing it before continuing would be even better."
9276 func_append newdeplibs " $i"
9283 set dummy $deplibs_check_method; shift
9284 file_magic_regex=`expr "$deplibs_check_method" : "$1 \(.*\)"`
9285 for a_deplib in $deplibs; do
9288 func_stripname -l '' "$a_deplib"
9289 name=$func_stripname_result
9290 if test yes = "$allow_libtool_libs_with_static_runtimes"; then
9291 case " $predeps $postdeps " in
9293 func_append newdeplibs " $a_deplib"
9298 if test -n "$a_deplib"; then
9299 libname=`eval "\\$ECHO \"$libname_spec\""`
9300 if test -n "$file_magic_glob"; then
9301 libnameglob=`func_echo_all "$libname" | $SED -e $file_magic_glob`
9303 libnameglob=$libname
9305 test yes = "$want_nocaseglob" && nocaseglob=`shopt -p nocaseglob`
9306 for i in $lib_search_path $sys_lib_search_path $shlib_search_path; do
9307 if test yes = "$want_nocaseglob"; then
9309 potential_libs=`ls $i/$libnameglob[.-]* 2>/dev/null`
9312 potential_libs=`ls $i/$libnameglob[.-]* 2>/dev/null`
9314 for potent_lib in $potential_libs; do
9315 # Follow soft links.
9316 if ls -lLd "$potent_lib" 2>/dev/null |
9317 $GREP " -> " >/dev/null; then
9320 # The statement above tries to avoid entering an
9321 # endless loop below, in case of cyclic links.
9322 # We might still enter an endless loop, since a link
9323 # loop can be closed while we follow links,
9326 while test -h "$potlib" 2>/dev/null; do
9327 potliblink=`ls -ld $potlib | $SED 's/.* -> //'`
9329 [\\/]* | [A-Za-z]:[\\/]*) potlib=$potliblink;;
9330 *) potlib=`$ECHO "$potlib" | $SED 's|[^/]*$||'`"$potliblink";;
9333 if eval $file_magic_cmd \"\$potlib\" 2>/dev/null |
9335 $EGREP "$file_magic_regex" > /dev/null; then
9336 func_append newdeplibs " $a_deplib"
9343 if test -n "$a_deplib"; then
9346 $ECHO "*** Warning: linker path does not have real file for library $a_deplib."
9347 echo "*** I have the capability to make that library automatically link in when"
9348 echo "*** you link to this library. But I can only do this if you have a"
9349 echo "*** shared version of the library, which you do not appear to have"
9350 echo "*** because I did check the linker path looking for a file starting"
9351 if test -z "$potlib"; then
9352 $ECHO "*** with $libname but no candidates were found. (...for file magic test)"
9354 $ECHO "*** with $libname and none of the candidates passed a file format test"
9355 $ECHO "*** using a file magic. Last file checked: $potlib"
9360 # Add a -L argument.
9361 func_append newdeplibs " $a_deplib"
9364 done # Gone through all deplibs.
9367 set dummy $deplibs_check_method; shift
9368 match_pattern_regex=`expr "$deplibs_check_method" : "$1 \(.*\)"`
9369 for a_deplib in $deplibs; do
9372 func_stripname -l '' "$a_deplib"
9373 name=$func_stripname_result
9374 if test yes = "$allow_libtool_libs_with_static_runtimes"; then
9375 case " $predeps $postdeps " in
9377 func_append newdeplibs " $a_deplib"
9382 if test -n "$a_deplib"; then
9383 libname=`eval "\\$ECHO \"$libname_spec\""`
9384 for i in $lib_search_path $sys_lib_search_path $shlib_search_path; do
9385 potential_libs=`ls $i/$libname[.-]* 2>/dev/null`
9386 for potent_lib in $potential_libs; do
9387 potlib=$potent_lib # see symlink-check above in file_magic test
9388 if eval "\$ECHO \"$potent_lib\"" 2>/dev/null | $SED 10q | \
9389 $EGREP "$match_pattern_regex" > /dev/null; then
9390 func_append newdeplibs " $a_deplib"
9397 if test -n "$a_deplib"; then
9400 $ECHO "*** Warning: linker path does not have real file for library $a_deplib."
9401 echo "*** I have the capability to make that library automatically link in when"
9402 echo "*** you link to this library. But I can only do this if you have a"
9403 echo "*** shared version of the library, which you do not appear to have"
9404 echo "*** because I did check the linker path looking for a file starting"
9405 if test -z "$potlib"; then
9406 $ECHO "*** with $libname but no candidates were found. (...for regex pattern test)"
9408 $ECHO "*** with $libname and none of the candidates passed a file format test"
9409 $ECHO "*** using a regex pattern. Last file checked: $potlib"
9414 # Add a -L argument.
9415 func_append newdeplibs " $a_deplib"
9418 done # Gone through all deplibs.
9422 tmp_deplibs=`$ECHO " $deplibs" | $SED 's/ -lc$//; s/ -[LR][^ ]*//g'`
9423 if test yes = "$allow_libtool_libs_with_static_runtimes"; then
9424 for i in $predeps $postdeps; do
9425 # can't use Xsed below, because $i might contain '/'
9426 tmp_deplibs=`$ECHO " $tmp_deplibs" | $SED "s|$i||"`
9429 case $tmp_deplibs in
9432 if test none = "$deplibs_check_method"; then
9433 echo "*** Warning: inter-library dependencies are not supported in this platform."
9435 echo "*** Warning: inter-library dependencies are not known to be supported."
9437 echo "*** All declared inter-library dependencies are being dropped."
9443 versuffix=$versuffix_save
9444 versuffix2=$versuffix2_save
9446 release=$release_save
9447 libname=$libname_save
9451 *-*-rhapsody* | *-*-darwin1.[012])
9452 # On Rhapsody replace the C library with the System framework
9453 newdeplibs=`$ECHO " $newdeplibs" | $SED 's/ -lc / System.ltframework /'`
9457 if test yes = "$droppeddeps"; then
9458 if test yes = "$module"; then
9460 echo "*** Warning: libtool could not satisfy all declared inter-library"
9461 $ECHO "*** dependencies of module $libname. Therefore, libtool will create"
9462 echo "*** a static module, that should work as long as the dlopening"
9463 echo "*** application is linked with the -dlopen flag."
9464 if test -z "$global_symbol_pipe"; then
9466 echo "*** However, this would only work if libtool was able to extract symbol"
9467 echo "*** lists from a program, using 'nm' or equivalent, but libtool could"
9468 echo "*** not find such a program. So, this module is probably useless."
9469 echo "*** 'nm' from GNU binutils and a full rebuild may help."
9471 if test no = "$build_old_libs"; then
9472 oldlibs=$output_objdir/$libname.$libext
9473 build_libtool_libs=module
9476 build_libtool_libs=no
9479 echo "*** The inter-library dependencies that have been dropped here will be"
9480 echo "*** automatically added whenever a program is linked with this library"
9481 echo "*** or is declared to -dlopen it."
9483 if test no = "$allow_undefined"; then
9485 echo "*** Since this library must not contain undefined symbols,"
9486 echo "*** because either the platform does not support them or"
9487 echo "*** it was explicitly requested with -no-undefined,"
9488 echo "*** libtool will only create a static version of it."
9489 if test no = "$build_old_libs"; then
9490 oldlibs=$output_objdir/$libname.$libext
9491 build_libtool_libs=module
9494 build_libtool_libs=no
9499 # Done checking deplibs!
9502 # Time to change all our "foo.ltframework" stuff back to "-framework foo"
9505 newdeplibs=`$ECHO " $newdeplibs" | $SED 's% \([^ $]*\).ltframework% -framework \1%g'`
9506 new_inherited_linker_flags=`$ECHO " $new_inherited_linker_flags" | $SED 's% \([^ $]*\).ltframework% -framework \1%g'`
9507 deplibs=`$ECHO " $deplibs" | $SED 's% \([^ $]*\).ltframework% -framework \1%g'`
9511 # move library search paths that coincide with paths to not yet
9512 # installed libraries to the beginning of the library search list
9514 for path in $notinst_path; do
9515 case " $new_libs " in
9516 *" -L$path/$objdir "*) ;;
9518 case " $deplibs " in
9519 *" -L$path/$objdir "*)
9520 func_append new_libs " -L$path/$objdir" ;;
9525 for deplib in $deplibs; do
9528 case " $new_libs " in
9530 *) func_append new_libs " $deplib" ;;
9533 *) func_append new_libs " $deplib" ;;
9538 # All the library-specific variables (install_libdir is set above).
9543 # Test again, we may have decided not to build it any more
9544 if test yes = "$build_libtool_libs"; then
9545 # Remove $wl instances when linking with ld.
9546 # FIXME: should test the right _cmds variable.
9547 case $archive_cmds in
9550 if test yes = "$hardcode_into_libs"; then
9551 # Hardcode the library paths
9554 rpath=$finalize_rpath
9555 test relink = "$opt_mode" || rpath=$compile_rpath$rpath
9556 for libdir in $rpath; do
9557 if test -n "$hardcode_libdir_flag_spec"; then
9558 if test -n "$hardcode_libdir_separator"; then
9559 func_replace_sysroot "$libdir"
9560 libdir=$func_replace_sysroot_result
9561 if test -z "$hardcode_libdirs"; then
9562 hardcode_libdirs=$libdir
9564 # Just accumulate the unique libdirs.
9565 case $hardcode_libdir_separator$hardcode_libdirs$hardcode_libdir_separator in
9566 *"$hardcode_libdir_separator$libdir$hardcode_libdir_separator"*)
9569 func_append hardcode_libdirs "$hardcode_libdir_separator$libdir"
9574 eval flag=\"$hardcode_libdir_flag_spec\"
9575 func_append dep_rpath " $flag"
9577 elif test -n "$runpath_var"; then
9578 case "$perm_rpath " in
9580 *) func_append perm_rpath " $libdir" ;;
9584 # Substitute the hardcoded libdirs into the rpath.
9585 if test -n "$hardcode_libdir_separator" &&
9586 test -n "$hardcode_libdirs"; then
9587 libdir=$hardcode_libdirs
9588 eval "dep_rpath=\"$hardcode_libdir_flag_spec\""
9590 if test -n "$runpath_var" && test -n "$perm_rpath"; then
9591 # We should set the runpath_var.
9593 for dir in $perm_rpath; do
9594 func_append rpath "$dir:"
9596 eval "$runpath_var='$rpath\$$runpath_var'; export $runpath_var"
9598 test -n "$dep_rpath" && deplibs="$dep_rpath $deplibs"
9601 shlibpath=$finalize_shlibpath
9602 test relink = "$opt_mode" || shlibpath=$compile_shlibpath$shlibpath
9603 if test -n "$shlibpath"; then
9604 eval "$shlibpath_var='$shlibpath\$$shlibpath_var'; export $shlibpath_var"
9607 # Get the real and link names of the library.
9608 eval shared_ext=\"$shrext_cmds\"
9609 eval library_names=\"$library_names_spec\"
9610 set dummy $library_names
9615 if test -n "$soname_spec"; then
9616 eval soname=\"$soname_spec\"
9620 if test -z "$dlname"; then
9624 lib=$output_objdir/$realname
9628 func_append linknames " $link"
9631 # Use standard objects if they are pic
9632 test -z "$pic_flag" && libobjs=`$ECHO "$libobjs" | $SP2NL | $SED "$lo2o" | $NL2SP`
9633 test "X$libobjs" = "X " && libobjs=
9636 if test -n "$export_symbols" && test -n "$include_expsyms"; then
9637 $opt_dry_run || cp "$export_symbols" "$output_objdir/$libname.uexp"
9638 export_symbols=$output_objdir/$libname.uexp
9639 func_append delfiles " $export_symbols"
9642 orig_export_symbols=
9644 cygwin* | mingw* | cegcc*)
9645 if test -n "$export_symbols" && test -z "$export_symbols_regex"; then
9646 # exporting using user supplied symfile
9647 func_dll_def_p "$export_symbols" || {
9648 # and it's NOT already a .def file. Must figure out
9649 # which of the given symbols are data symbols and tag
9650 # them as such. So, trigger use of export_symbols_cmds.
9651 # export_symbols gets reassigned inside the "prepare
9652 # the list of exported symbols" if statement, so the
9653 # include_expsyms logic still works.
9654 orig_export_symbols=$export_symbols
9656 always_export_symbols=yes
9662 # Prepare the list of exported symbols
9663 if test -z "$export_symbols"; then
9664 if test yes = "$always_export_symbols" || test -n "$export_symbols_regex"; then
9665 func_verbose "generating symbol list for '$libname.la'"
9666 export_symbols=$output_objdir/$libname.exp
9667 $opt_dry_run || $RM $export_symbols
9668 cmds=$export_symbols_cmds
9669 save_ifs=$IFS; IFS='~'
9670 for cmd1 in $cmds; do
9672 # Take the normal branch if the nm_file_list_spec branch
9673 # doesn't work or if tool conversion is not needed.
9674 case $nm_file_list_spec~$to_tool_file_cmd in
9675 *~func_convert_file_noop | *~func_convert_file_msys_to_w32 | ~*)
9676 try_normal_branch=yes
9679 len=$func_len_result
9682 try_normal_branch=no
9685 if test yes = "$try_normal_branch" \
9686 && { test "$len" -lt "$max_cmd_len" \
9687 || test "$max_cmd_len" -le -1; }
9689 func_show_eval "$cmd" 'exit $?'
9690 skipped_export=false
9691 elif test -n "$nm_file_list_spec"; then
9692 func_basename "$output"
9693 output_la=$func_basename_result
9694 save_libobjs=$libobjs
9696 output=$output_objdir/$output_la.nm
9697 func_to_tool_file "$output"
9698 libobjs=$nm_file_list_spec$func_to_tool_file_result
9699 func_append delfiles " $output"
9700 func_verbose "creating $NM input file list: $output"
9701 for obj in $save_libobjs; do
9702 func_to_tool_file "$obj"
9703 $ECHO "$func_to_tool_file_result"
9706 func_show_eval "$cmd" 'exit $?'
9708 libobjs=$save_libobjs
9709 skipped_export=false
9711 # The command line is too long to execute in one step.
9712 func_verbose "using reloadable object file for export list..."
9714 # Break out early, otherwise skipped_export may be
9715 # set to false by a later but shorter cmd.
9720 if test -n "$export_symbols_regex" && test : != "$skipped_export"; then
9721 func_show_eval '$EGREP -e "$export_symbols_regex" "$export_symbols" > "${export_symbols}T"'
9722 func_show_eval '$MV "${export_symbols}T" "$export_symbols"'
9727 if test -n "$export_symbols" && test -n "$include_expsyms"; then
9728 tmp_export_symbols=$export_symbols
9729 test -n "$orig_export_symbols" && tmp_export_symbols=$orig_export_symbols
9730 $opt_dry_run || eval '$ECHO "$include_expsyms" | $SP2NL >> "$tmp_export_symbols"'
9733 if test : != "$skipped_export" && test -n "$orig_export_symbols"; then
9734 # The given exports_symbols file has to be filtered, so filter it.
9735 func_verbose "filter symbol list for '$libname.la' to tag DATA exports"
9736 # FIXME: $output_objdir/$libname.filter potentially contains lots of
9737 # 's' commands, which not all seds can handle. GNU sed should be fine
9738 # though. Also, the filter scales superlinearly with the number of
9739 # global variables. join(1) would be nice here, but unfortunately
9740 # isn't a blessed tool.
9741 $opt_dry_run || $SED -e '/[ ,]DATA/!d;s,\(.*\)\([ \,].*\),s|^\1$|\1\2|,' < $export_symbols > $output_objdir/$libname.filter
9742 func_append delfiles " $export_symbols $output_objdir/$libname.filter"
9743 export_symbols=$output_objdir/$libname.def
9744 $opt_dry_run || $SED -f $output_objdir/$libname.filter < $orig_export_symbols > $export_symbols
9748 for test_deplib in $deplibs; do
9749 case " $convenience " in
9750 *" $test_deplib "*) ;;
9752 func_append tmp_deplibs " $test_deplib"
9756 deplibs=$tmp_deplibs
9758 if test -n "$convenience"; then
9759 if test -n "$whole_archive_flag_spec" &&
9760 test yes = "$compiler_needs_object" &&
9761 test -z "$libobjs"; then
9762 # extract the archives, so we have objects to list.
9763 # TODO: could optimize this to just extract one archive.
9764 whole_archive_flag_spec=
9766 if test -n "$whole_archive_flag_spec"; then
9767 save_libobjs=$libobjs
9768 eval libobjs=\"\$libobjs $whole_archive_flag_spec\"
9769 test "X$libobjs" = "X " && libobjs=
9771 gentop=$output_objdir/${outputname}x
9772 func_append generated " $gentop"
9774 func_extract_archives $gentop $convenience
9775 func_append libobjs " $func_extract_archives_result"
9776 test "X$libobjs" = "X " && libobjs=
9780 if test yes = "$thread_safe" && test -n "$thread_safe_flag_spec"; then
9781 eval flag=\"$thread_safe_flag_spec\"
9782 func_append linker_flags " $flag"
9785 # Make a backup of the uninstalled library when relinking
9786 if test relink = "$opt_mode"; then
9787 $opt_dry_run || eval '(cd $output_objdir && $RM ${realname}U && $MV $realname ${realname}U)' || exit $?
9790 # Do each of the archive commands.
9791 if test yes = "$module" && test -n "$module_cmds"; then
9792 if test -n "$export_symbols" && test -n "$module_expsym_cmds"; then
9793 eval test_cmds=\"$module_expsym_cmds\"
9794 cmds=$module_expsym_cmds
9796 eval test_cmds=\"$module_cmds\"
9800 if test -n "$export_symbols" && test -n "$archive_expsym_cmds"; then
9801 eval test_cmds=\"$archive_expsym_cmds\"
9802 cmds=$archive_expsym_cmds
9804 eval test_cmds=\"$archive_cmds\"
9809 if test : != "$skipped_export" &&
9810 func_len " $test_cmds" &&
9811 len=$func_len_result &&
9812 test "$len" -lt "$max_cmd_len" || test "$max_cmd_len" -le -1; then
9815 # The command line is too long to link in one step, link piecewise
9816 # or, if using GNU ld and skipped_export is not :, use a linker
9819 # Save the value of $output and $libobjs because we want to
9820 # use them later. If we have whole_archive_flag_spec, we
9821 # want to use save_libobjs as it was before
9822 # whole_archive_flag_spec was expanded, because we can't
9823 # assume the linker understands whole_archive_flag_spec.
9824 # This may have to be revisited, in case too many
9825 # convenience libraries get linked in and end up exceeding
9827 if test -z "$convenience" || test -z "$whole_archive_flag_spec"; then
9828 save_libobjs=$libobjs
9831 func_basename "$output"
9832 output_la=$func_basename_result
9834 # Clear the reloadable object creation command queue and
9835 # initialize k to one.
9842 if test -n "$save_libobjs" && test : != "$skipped_export" && test yes = "$with_gnu_ld"; then
9843 output=$output_objdir/$output_la.lnkscript
9844 func_verbose "creating GNU ld script: $output"
9845 echo 'INPUT (' > $output
9846 for obj in $save_libobjs
9848 func_to_tool_file "$obj"
9849 $ECHO "$func_to_tool_file_result" >> $output
9852 func_append delfiles " $output"
9853 func_to_tool_file "$output"
9854 output=$func_to_tool_file_result
9855 elif test -n "$save_libobjs" && test : != "$skipped_export" && test -n "$file_list_spec"; then
9856 output=$output_objdir/$output_la.lnk
9857 func_verbose "creating linker input file list: $output"
9862 if test yes = "$compiler_needs_object"; then
9868 func_to_tool_file "$obj"
9869 $ECHO "$func_to_tool_file_result" >> $output
9871 func_append delfiles " $output"
9872 func_to_tool_file "$output"
9873 output=$firstobj\"$file_list_spec$func_to_tool_file_result\"
9875 if test -n "$save_libobjs"; then
9876 func_verbose "creating reloadable object files..."
9877 output=$output_objdir/$output_la-$k.$objext
9878 eval test_cmds=\"$reload_cmds\"
9879 func_len " $test_cmds"
9880 len0=$func_len_result
9883 # Loop over the list of objects to be linked.
9884 for obj in $save_libobjs
9887 func_arith $len + $func_len_result
9888 len=$func_arith_result
9889 if test -z "$objlist" ||
9890 test "$len" -lt "$max_cmd_len"; then
9891 func_append objlist " $obj"
9893 # The command $test_cmds is almost too long, add a
9894 # command to the queue.
9895 if test 1 -eq "$k"; then
9896 # The first file doesn't have a previous command to add.
9897 reload_objs=$objlist
9898 eval concat_cmds=\"$reload_cmds\"
9900 # All subsequent reloadable object files will link in
9901 # the last one created.
9902 reload_objs="$objlist $last_robj"
9903 eval concat_cmds=\"\$concat_cmds~$reload_cmds~\$RM $last_robj\"
9905 last_robj=$output_objdir/$output_la-$k.$objext
9907 k=$func_arith_result
9908 output=$output_objdir/$output_la-$k.$objext
9910 func_len " $last_robj"
9911 func_arith $len0 + $func_len_result
9912 len=$func_arith_result
9915 # Handle the remaining objects by creating one last
9916 # reloadable object file. All subsequent reloadable object
9917 # files will link in the last one created.
9918 test -z "$concat_cmds" || concat_cmds=$concat_cmds~
9919 reload_objs="$objlist $last_robj"
9920 eval concat_cmds=\"\$concat_cmds$reload_cmds\"
9921 if test -n "$last_robj"; then
9922 eval concat_cmds=\"\$concat_cmds~\$RM $last_robj\"
9924 func_append delfiles " $output"
9930 ${skipped_export-false} && {
9931 func_verbose "generating symbol list for '$libname.la'"
9932 export_symbols=$output_objdir/$libname.exp
9933 $opt_dry_run || $RM $export_symbols
9935 # Append the command to create the export file.
9936 test -z "$concat_cmds" || concat_cmds=$concat_cmds~
9937 eval concat_cmds=\"\$concat_cmds$export_symbols_cmds\"
9938 if test -n "$last_robj"; then
9939 eval concat_cmds=\"\$concat_cmds~\$RM $last_robj\"
9943 test -n "$save_libobjs" &&
9944 func_verbose "creating a temporary reloadable object file: $output"
9946 # Loop through the commands generated above and execute them.
9947 save_ifs=$IFS; IFS='~'
9948 for cmd in $concat_cmds; do
9951 func_quote_for_expand "$cmd"
9952 eval "func_echo $func_quote_for_expand_result"
9954 $opt_dry_run || eval "$cmd" || {
9957 # Restore the uninstalled library and exit
9958 if test relink = "$opt_mode"; then
9959 ( cd "$output_objdir" && \
9960 $RM "${realname}T" && \
9961 $MV "${realname}U" "$realname" )
9969 if test -n "$export_symbols_regex" && ${skipped_export-false}; then
9970 func_show_eval '$EGREP -e "$export_symbols_regex" "$export_symbols" > "${export_symbols}T"'
9971 func_show_eval '$MV "${export_symbols}T" "$export_symbols"'
9975 ${skipped_export-false} && {
9976 if test -n "$export_symbols" && test -n "$include_expsyms"; then
9977 tmp_export_symbols=$export_symbols
9978 test -n "$orig_export_symbols" && tmp_export_symbols=$orig_export_symbols
9979 $opt_dry_run || eval '$ECHO "$include_expsyms" | $SP2NL >> "$tmp_export_symbols"'
9982 if test -n "$orig_export_symbols"; then
9983 # The given exports_symbols file has to be filtered, so filter it.
9984 func_verbose "filter symbol list for '$libname.la' to tag DATA exports"
9985 # FIXME: $output_objdir/$libname.filter potentially contains lots of
9986 # 's' commands, which not all seds can handle. GNU sed should be fine
9987 # though. Also, the filter scales superlinearly with the number of
9988 # global variables. join(1) would be nice here, but unfortunately
9989 # isn't a blessed tool.
9990 $opt_dry_run || $SED -e '/[ ,]DATA/!d;s,\(.*\)\([ \,].*\),s|^\1$|\1\2|,' < $export_symbols > $output_objdir/$libname.filter
9991 func_append delfiles " $export_symbols $output_objdir/$libname.filter"
9992 export_symbols=$output_objdir/$libname.def
9993 $opt_dry_run || $SED -f $output_objdir/$libname.filter < $orig_export_symbols > $export_symbols
9998 # Restore the value of output.
10001 if test -n "$convenience" && test -n "$whole_archive_flag_spec"; then
10002 eval libobjs=\"\$libobjs $whole_archive_flag_spec\"
10003 test "X$libobjs" = "X " && libobjs=
10005 # Expand the library linking commands again to reset the
10006 # value of $libobjs for piecewise linking.
10008 # Do each of the archive commands.
10009 if test yes = "$module" && test -n "$module_cmds"; then
10010 if test -n "$export_symbols" && test -n "$module_expsym_cmds"; then
10011 cmds=$module_expsym_cmds
10016 if test -n "$export_symbols" && test -n "$archive_expsym_cmds"; then
10017 cmds=$archive_expsym_cmds
10024 if test -n "$delfiles"; then
10025 # Append the command to remove temporary files to $cmds.
10026 eval cmds=\"\$cmds~\$RM $delfiles\"
10029 # Add any objects from preloaded convenience libraries
10030 if test -n "$dlprefiles"; then
10031 gentop=$output_objdir/${outputname}x
10032 func_append generated " $gentop"
10034 func_extract_archives $gentop $dlprefiles
10035 func_append libobjs " $func_extract_archives_result"
10036 test "X$libobjs" = "X " && libobjs=
10039 save_ifs=$IFS; IFS='~'
10040 for cmd in $cmds; do
10045 func_quote_for_expand "$cmd"
10046 eval "func_echo $func_quote_for_expand_result"
10048 $opt_dry_run || eval "$cmd" || {
10051 # Restore the uninstalled library and exit
10052 if test relink = "$opt_mode"; then
10053 ( cd "$output_objdir" && \
10054 $RM "${realname}T" && \
10055 $MV "${realname}U" "$realname" )
10063 # Restore the uninstalled library and exit
10064 if test relink = "$opt_mode"; then
10065 $opt_dry_run || eval '(cd $output_objdir && $RM ${realname}T && $MV $realname ${realname}T && $MV ${realname}U $realname)' || exit $?
10067 if test -n "$convenience"; then
10068 if test -z "$whole_archive_flag_spec"; then
10069 func_show_eval '${RM}r "$gentop"'
10076 # Create links to the real library.
10077 for linkname in $linknames; do
10078 if test "$realname" != "$linkname"; then
10079 func_show_eval '(cd "$output_objdir" && $RM "$linkname" && $LN_S "$realname" "$linkname")' 'exit $?'
10083 # If -module or -export-dynamic was specified, set the dlname.
10084 if test yes = "$module" || test yes = "$export_dynamic"; then
10085 # On all known operating systems, these are identical.
10092 if test -n "$dlfiles$dlprefiles" || test no != "$dlself"; then
10093 func_warning "'-dlopen' is ignored for objects"
10096 case " $deplibs" in
10098 func_warning "'-l' and '-L' are ignored for objects" ;;
10101 test -n "$rpath" && \
10102 func_warning "'-rpath' is ignored for objects"
10104 test -n "$xrpath" && \
10105 func_warning "'-R' is ignored for objects"
10107 test -n "$vinfo" && \
10108 func_warning "'-version-info' is ignored for objects"
10110 test -n "$release" && \
10111 func_warning "'-release' is ignored for objects"
10115 test -n "$objs$old_deplibs" && \
10116 func_fatal_error "cannot build library object '$output' from non-libtool objects"
10119 func_lo2o "$libobj"
10120 obj=$func_lo2o_result
10128 # Delete the old objects.
10129 $opt_dry_run || $RM $obj $libobj
10131 # Objects from convenience libraries. This assumes
10132 # single-version convenience libraries. Whenever we create
10133 # different ones for PIC/non-PIC, this we'll have to duplicate
10137 # if reload_cmds runs $LD directly, get rid of -Wl from
10138 # whole_archive_flag_spec and hope we can get by with turning comma
10140 case $reload_cmds in
10141 *\$LD[\ \$]*) wl= ;;
10143 if test -n "$convenience"; then
10144 if test -n "$whole_archive_flag_spec"; then
10145 eval tmp_whole_archive_flags=\"$whole_archive_flag_spec\"
10146 test -n "$wl" || tmp_whole_archive_flags=`$ECHO "$tmp_whole_archive_flags" | $SED 's|,| |g'`
10147 reload_conv_objs=$reload_objs\ $tmp_whole_archive_flags
10149 gentop=$output_objdir/${obj}x
10150 func_append generated " $gentop"
10152 func_extract_archives $gentop $convenience
10153 reload_conv_objs="$reload_objs $func_extract_archives_result"
10157 # If we're not building shared, we need to use non_pic_objs
10158 test yes = "$build_libtool_libs" || libobjs=$non_pic_objects
10160 # Create the old-style object.
10161 reload_objs=$objs$old_deplibs' '`$ECHO "$libobjs" | $SP2NL | $SED "/\.$libext$/d; /\.lib$/d; $lo2o" | $NL2SP`' '$reload_conv_objs
10164 func_execute_cmds "$reload_cmds" 'exit $?'
10166 # Exit if we aren't doing a library object file.
10167 if test -z "$libobj"; then
10168 if test -n "$gentop"; then
10169 func_show_eval '${RM}r "$gentop"'
10175 test yes = "$build_libtool_libs" || {
10176 if test -n "$gentop"; then
10177 func_show_eval '${RM}r "$gentop"'
10180 # Create an invalid libtool object if no PIC, so that we don't
10181 # accidentally link it into a program.
10182 # $show "echo timestamp > $libobj"
10183 # $opt_dry_run || eval "echo timestamp > $libobj" || exit $?
10187 if test -n "$pic_flag" || test default != "$pic_mode"; then
10188 # Only do commands if we really have different PIC objects.
10189 reload_objs="$libobjs $reload_conv_objs"
10191 func_execute_cmds "$reload_cmds" 'exit $?'
10194 if test -n "$gentop"; then
10195 func_show_eval '${RM}r "$gentop"'
10203 *cygwin*) func_stripname '' '.exe' "$output"
10204 output=$func_stripname_result.exe;;
10206 test -n "$vinfo" && \
10207 func_warning "'-version-info' is ignored for programs"
10209 test -n "$release" && \
10210 func_warning "'-release' is ignored for programs"
10213 && test unknown,unknown,unknown = "$dlopen_support,$dlopen_self,$dlopen_self_static" \
10214 && func_warning "'LT_INIT([dlopen])' not used. Assuming no dlopen support."
10217 *-*-rhapsody* | *-*-darwin1.[012])
10218 # On Rhapsody replace the C library is the System framework
10219 compile_deplibs=`$ECHO " $compile_deplibs" | $SED 's/ -lc / System.ltframework /'`
10220 finalize_deplibs=`$ECHO " $finalize_deplibs" | $SED 's/ -lc / System.ltframework /'`
10226 # Don't allow lazy linking, it breaks C++ global constructors
10227 # But is supposedly fixed on 10.4 or later (yay!).
10228 if test CXX = "$tagname"; then
10229 case ${MACOSX_DEPLOYMENT_TARGET-10.0} in
10231 func_append compile_command " $wl-bind_at_load"
10232 func_append finalize_command " $wl-bind_at_load"
10236 # Time to change all our "foo.ltframework" stuff back to "-framework foo"
10237 compile_deplibs=`$ECHO " $compile_deplibs" | $SED 's% \([^ $]*\).ltframework% -framework \1%g'`
10238 finalize_deplibs=`$ECHO " $finalize_deplibs" | $SED 's% \([^ $]*\).ltframework% -framework \1%g'`
10243 # move library search paths that coincide with paths to not yet
10244 # installed libraries to the beginning of the library search list
10246 for path in $notinst_path; do
10247 case " $new_libs " in
10248 *" -L$path/$objdir "*) ;;
10250 case " $compile_deplibs " in
10251 *" -L$path/$objdir "*)
10252 func_append new_libs " -L$path/$objdir" ;;
10257 for deplib in $compile_deplibs; do
10260 case " $new_libs " in
10262 *) func_append new_libs " $deplib" ;;
10265 *) func_append new_libs " $deplib" ;;
10268 compile_deplibs=$new_libs
10271 func_append compile_command " $compile_deplibs"
10272 func_append finalize_command " $finalize_deplibs"
10274 if test -n "$rpath$xrpath"; then
10275 # If the user specified any rpath flags, then add them.
10276 for libdir in $rpath $xrpath; do
10277 # This is the magic to use -rpath.
10278 case "$finalize_rpath " in
10280 *) func_append finalize_rpath " $libdir" ;;
10285 # Now hardcode the library paths
10288 for libdir in $compile_rpath $finalize_rpath; do
10289 if test -n "$hardcode_libdir_flag_spec"; then
10290 if test -n "$hardcode_libdir_separator"; then
10291 if test -z "$hardcode_libdirs"; then
10292 hardcode_libdirs=$libdir
10294 # Just accumulate the unique libdirs.
10295 case $hardcode_libdir_separator$hardcode_libdirs$hardcode_libdir_separator in
10296 *"$hardcode_libdir_separator$libdir$hardcode_libdir_separator"*)
10299 func_append hardcode_libdirs "$hardcode_libdir_separator$libdir"
10304 eval flag=\"$hardcode_libdir_flag_spec\"
10305 func_append rpath " $flag"
10307 elif test -n "$runpath_var"; then
10308 case "$perm_rpath " in
10310 *) func_append perm_rpath " $libdir" ;;
10314 *-*-cygwin* | *-*-mingw* | *-*-pw32* | *-*-os2* | *-cegcc*)
10315 testbindir=`$ECHO "$libdir" | $SED -e 's*/lib$*/bin*'`
10316 case :$dllsearchpath: in
10318 ::) dllsearchpath=$libdir;;
10319 *) func_append dllsearchpath ":$libdir";;
10321 case :$dllsearchpath: in
10322 *":$testbindir:"*) ;;
10323 ::) dllsearchpath=$testbindir;;
10324 *) func_append dllsearchpath ":$testbindir";;
10329 # Substitute the hardcoded libdirs into the rpath.
10330 if test -n "$hardcode_libdir_separator" &&
10331 test -n "$hardcode_libdirs"; then
10332 libdir=$hardcode_libdirs
10333 eval rpath=\" $hardcode_libdir_flag_spec\"
10335 compile_rpath=$rpath
10339 for libdir in $finalize_rpath; do
10340 if test -n "$hardcode_libdir_flag_spec"; then
10341 if test -n "$hardcode_libdir_separator"; then
10342 if test -z "$hardcode_libdirs"; then
10343 hardcode_libdirs=$libdir
10345 # Just accumulate the unique libdirs.
10346 case $hardcode_libdir_separator$hardcode_libdirs$hardcode_libdir_separator in
10347 *"$hardcode_libdir_separator$libdir$hardcode_libdir_separator"*)
10350 func_append hardcode_libdirs "$hardcode_libdir_separator$libdir"
10355 eval flag=\"$hardcode_libdir_flag_spec\"
10356 func_append rpath " $flag"
10358 elif test -n "$runpath_var"; then
10359 case "$finalize_perm_rpath " in
10361 *) func_append finalize_perm_rpath " $libdir" ;;
10365 # Substitute the hardcoded libdirs into the rpath.
10366 if test -n "$hardcode_libdir_separator" &&
10367 test -n "$hardcode_libdirs"; then
10368 libdir=$hardcode_libdirs
10369 eval rpath=\" $hardcode_libdir_flag_spec\"
10371 finalize_rpath=$rpath
10373 if test -n "$libobjs" && test yes = "$build_old_libs"; then
10374 # Transform all the library objects into standard objects.
10375 compile_command=`$ECHO "$compile_command" | $SP2NL | $SED "$lo2o" | $NL2SP`
10376 finalize_command=`$ECHO "$finalize_command" | $SP2NL | $SED "$lo2o" | $NL2SP`
10379 func_generate_dlsyms "$outputname" "@PROGRAM@" false
10381 # template prelinking step
10382 if test -n "$prelink_cmds"; then
10383 func_execute_cmds "$prelink_cmds" 'exit $?'
10386 wrappers_required=:
10388 *cegcc* | *mingw32ce*)
10389 # Disable wrappers for cegcc and mingw32ce hosts, we are cross compiling anyway.
10390 wrappers_required=false
10392 *cygwin* | *mingw* )
10393 test yes = "$build_libtool_libs" || wrappers_required=false
10396 if test no = "$need_relink" || test yes != "$build_libtool_libs"; then
10397 wrappers_required=false
10401 $wrappers_required || {
10402 # Replace the output file specification.
10403 compile_command=`$ECHO "$compile_command" | $SED 's%@OUTPUT@%'"$output"'%g'`
10404 link_command=$compile_command$compile_rpath
10406 # We have no uninstalled library dependencies, so finalize right now.
10408 func_show_eval "$link_command" 'exit_status=$?'
10410 if test -n "$postlink_cmds"; then
10411 func_to_tool_file "$output"
10412 postlink_cmds=`func_echo_all "$postlink_cmds" | $SED -e 's%@OUTPUT@%'"$output"'%g' -e 's%@TOOL_OUTPUT@%'"$func_to_tool_file_result"'%g'`
10413 func_execute_cmds "$postlink_cmds" 'exit $?'
10416 # Delete the generated files.
10417 if test -f "$output_objdir/${outputname}S.$objext"; then
10418 func_show_eval '$RM "$output_objdir/${outputname}S.$objext"'
10424 if test -n "$compile_shlibpath$finalize_shlibpath"; then
10425 compile_command="$shlibpath_var=\"$compile_shlibpath$finalize_shlibpath\$$shlibpath_var\" $compile_command"
10427 if test -n "$finalize_shlibpath"; then
10428 finalize_command="$shlibpath_var=\"$finalize_shlibpath\$$shlibpath_var\" $finalize_command"
10433 if test -n "$runpath_var"; then
10434 if test -n "$perm_rpath"; then
10435 # We should set the runpath_var.
10437 for dir in $perm_rpath; do
10438 func_append rpath "$dir:"
10440 compile_var="$runpath_var=\"$rpath\$$runpath_var\" "
10442 if test -n "$finalize_perm_rpath"; then
10443 # We should set the runpath_var.
10445 for dir in $finalize_perm_rpath; do
10446 func_append rpath "$dir:"
10448 finalize_var="$runpath_var=\"$rpath\$$runpath_var\" "
10452 if test yes = "$no_install"; then
10453 # We don't need to create a wrapper script.
10454 link_command=$compile_var$compile_command$compile_rpath
10455 # Replace the output file specification.
10456 link_command=`$ECHO "$link_command" | $SED 's%@OUTPUT@%'"$output"'%g'`
10457 # Delete the old output file.
10458 $opt_dry_run || $RM $output
10459 # Link the executable and exit
10460 func_show_eval "$link_command" 'exit $?'
10462 if test -n "$postlink_cmds"; then
10463 func_to_tool_file "$output"
10464 postlink_cmds=`func_echo_all "$postlink_cmds" | $SED -e 's%@OUTPUT@%'"$output"'%g' -e 's%@TOOL_OUTPUT@%'"$func_to_tool_file_result"'%g'`
10465 func_execute_cmds "$postlink_cmds" 'exit $?'
10471 case $hardcode_action,$fast_install in
10473 # Fast installation is not supported
10474 link_command=$compile_var$compile_command$compile_rpath
10475 relink_command=$finalize_var$finalize_command$finalize_rpath
10477 func_warning "this platform does not like uninstalled shared libraries"
10478 func_warning "'$output' will be relinked during installation"
10481 link_command=$finalize_var$compile_command$finalize_rpath
10482 relink_command=`$ECHO "$compile_var$compile_command$compile_rpath" | $SED 's%@OUTPUT@%\$progdir/\$file%g'`
10485 link_command=$compile_var$compile_command$compile_rpath
10486 relink_command=$finalize_var$finalize_command$finalize_rpath
10489 link_command=$finalize_var$compile_command$finalize_rpath
10494 # Replace the output file specification.
10495 link_command=`$ECHO "$link_command" | $SED 's%@OUTPUT@%'"$output_objdir/$outputname"'%g'`
10497 # Delete the old output files.
10498 $opt_dry_run || $RM $output $output_objdir/$outputname $output_objdir/lt-$outputname
10500 func_show_eval "$link_command" 'exit $?'
10502 if test -n "$postlink_cmds"; then
10503 func_to_tool_file "$output_objdir/$outputname"
10504 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'`
10505 func_execute_cmds "$postlink_cmds" 'exit $?'
10508 # Now create the wrapper script.
10509 func_verbose "creating $output"
10511 # Quote the relink command for shipping.
10512 if test -n "$relink_command"; then
10513 # Preserve any variables that may affect compiler behavior
10514 for var in $variables_saved_for_relink; do
10515 if eval test -z \"\${$var+set}\"; then
10516 relink_command="{ test -z \"\${$var+set}\" || $lt_unset $var || { $var=; export $var; }; }; $relink_command"
10517 elif eval var_value=\$$var; test -z "$var_value"; then
10518 relink_command="$var=; export $var; $relink_command"
10520 func_quote_for_eval "$var_value"
10521 relink_command="$var=$func_quote_for_eval_result; export $var; $relink_command"
10524 relink_command="(cd `pwd`; $relink_command)"
10525 relink_command=`$ECHO "$relink_command" | $SED "$sed_quote_subst"`
10528 # Only actually do things if not in dry run mode.
10530 # win32 will think the script is a binary if it has
10531 # a .exe suffix, so we strip it off here.
10533 *.exe) func_stripname '' '.exe' "$output"
10534 output=$func_stripname_result ;;
10536 # test for cygwin because mv fails w/o .exe extensions
10540 func_stripname '' '.exe' "$outputname"
10541 outputname=$func_stripname_result ;;
10545 *cygwin* | *mingw* )
10546 func_dirname_and_basename "$output" "" "."
10547 output_name=$func_basename_result
10548 output_path=$func_dirname_result
10549 cwrappersource=$output_path/$objdir/lt-$output_name.c
10550 cwrapper=$output_path/$output_name.exe
10551 $RM $cwrappersource $cwrapper
10552 trap "$RM $cwrappersource $cwrapper; exit $EXIT_FAILURE" 1 2 15
10554 func_emit_cwrapperexe_src > $cwrappersource
10556 # The wrapper executable is built using the $host compiler,
10557 # because it contains $host paths and files. If cross-
10558 # compiling, it, like the target executable, must be
10559 # executed on the $host or under an emulation environment.
10561 $LTCC $LTCFLAGS -o $cwrapper $cwrappersource
10565 # Now, create the wrapper script for func_source use:
10566 func_ltwrapper_scriptname $cwrapper
10567 $RM $func_ltwrapper_scriptname_result
10568 trap "$RM $func_ltwrapper_scriptname_result; exit $EXIT_FAILURE" 1 2 15
10570 # note: this script will not be executed, so do not chmod.
10571 if test "x$build" = "x$host"; then
10572 $cwrapper --lt-dump-script > $func_ltwrapper_scriptname_result
10574 func_emit_wrapper no > $func_ltwrapper_scriptname_result
10580 trap "$RM $output; exit $EXIT_FAILURE" 1 2 15
10582 func_emit_wrapper no > $output
10591 # See if we need to build an old-fashioned archive.
10592 for oldlib in $oldlibs; do
10594 case $build_libtool_libs in
10596 oldobjs="$libobjs_save $symfileobj"
10597 addlibs=$convenience
10598 build_libtool_libs=no
10601 oldobjs=$libobjs_save
10602 addlibs=$old_convenience
10603 build_libtool_libs=no
10606 oldobjs="$old_deplibs $non_pic_objects"
10607 $preload && test -f "$symfileobj" \
10608 && func_append oldobjs " $symfileobj"
10609 addlibs=$old_convenience
10613 if test -n "$addlibs"; then
10614 gentop=$output_objdir/${outputname}x
10615 func_append generated " $gentop"
10617 func_extract_archives $gentop $addlibs
10618 func_append oldobjs " $func_extract_archives_result"
10621 # Do each command in the archive commands.
10622 if test -n "$old_archive_from_new_cmds" && test yes = "$build_libtool_libs"; then
10623 cmds=$old_archive_from_new_cmds
10626 # Add any objects from preloaded convenience libraries
10627 if test -n "$dlprefiles"; then
10628 gentop=$output_objdir/${outputname}x
10629 func_append generated " $gentop"
10631 func_extract_archives $gentop $dlprefiles
10632 func_append oldobjs " $func_extract_archives_result"
10635 # POSIX demands no paths to be encoded in archives. We have
10636 # to avoid creating archives with duplicate basenames if we
10637 # might have to extract them afterwards, e.g., when creating a
10638 # static archive out of a convenience library, or when linking
10639 # the entirety of a libtool archive into another (currently
10640 # not supported by libtool).
10641 if (for obj in $oldobjs
10643 func_basename "$obj"
10644 $ECHO "$func_basename_result"
10645 done | sort | sort -uc >/dev/null 2>&1); then
10648 echo "copying selected object files to avoid basename conflicts..."
10649 gentop=$output_objdir/${outputname}x
10650 func_append generated " $gentop"
10651 func_mkdir_p "$gentop"
10652 save_oldobjs=$oldobjs
10655 for obj in $save_oldobjs
10657 func_basename "$obj"
10658 objbase=$func_basename_result
10659 case " $oldobjs " in
10660 " ") oldobjs=$obj ;;
10661 *[\ /]"$objbase "*)
10663 # Make sure we don't pick an alternate name that also
10665 newobj=lt$counter-$objbase
10666 func_arith $counter + 1
10667 counter=$func_arith_result
10668 case " $oldobjs " in
10669 *[\ /]"$newobj "*) ;;
10670 *) if test ! -f "$gentop/$newobj"; then break; fi ;;
10673 func_show_eval "ln $obj $gentop/$newobj || cp $obj $gentop/$newobj"
10674 func_append oldobjs " $gentop/$newobj"
10676 *) func_append oldobjs " $obj" ;;
10680 func_to_tool_file "$oldlib" func_convert_file_msys_to_w32
10681 tool_oldlib=$func_to_tool_file_result
10682 eval cmds=\"$old_archive_cmds\"
10685 len=$func_len_result
10686 if test "$len" -lt "$max_cmd_len" || test "$max_cmd_len" -le -1; then
10687 cmds=$old_archive_cmds
10688 elif test -n "$archiver_list_spec"; then
10689 func_verbose "using command file archive linking..."
10690 for obj in $oldobjs
10692 func_to_tool_file "$obj"
10693 $ECHO "$func_to_tool_file_result"
10694 done > $output_objdir/$libname.libcmd
10695 func_to_tool_file "$output_objdir/$libname.libcmd"
10696 oldobjs=" $archiver_list_spec$func_to_tool_file_result"
10697 cmds=$old_archive_cmds
10699 # the command line is too long to link in one step, link in parts
10700 func_verbose "using piecewise archive linking..."
10701 save_RANLIB=$RANLIB
10705 save_oldobjs=$oldobjs
10707 # Is there a better way of finding the last object in the list?
10708 for obj in $save_oldobjs
10712 eval test_cmds=\"$old_archive_cmds\"
10713 func_len " $test_cmds"
10714 len0=$func_len_result
10716 for obj in $save_oldobjs
10719 func_arith $len + $func_len_result
10720 len=$func_arith_result
10721 func_append objlist " $obj"
10722 if test "$len" -lt "$max_cmd_len"; then
10725 # the above command should be used before it gets too long
10727 if test "$obj" = "$last_oldobj"; then
10728 RANLIB=$save_RANLIB
10730 test -z "$concat_cmds" || concat_cmds=$concat_cmds~
10731 eval concat_cmds=\"\$concat_cmds$old_archive_cmds\"
10736 RANLIB=$save_RANLIB
10738 if test -z "$oldobjs"; then
10739 eval cmds=\"\$concat_cmds\"
10741 eval cmds=\"\$concat_cmds~\$old_archive_cmds\"
10745 func_execute_cmds "$cmds" 'exit $?'
10748 test -n "$generated" && \
10749 func_show_eval "${RM}r$generated"
10751 # Now create the libtool archive.
10755 test yes = "$build_old_libs" && old_library=$libname.$libext
10756 func_verbose "creating $output"
10758 # Preserve any variables that may affect compiler behavior
10759 for var in $variables_saved_for_relink; do
10760 if eval test -z \"\${$var+set}\"; then
10761 relink_command="{ test -z \"\${$var+set}\" || $lt_unset $var || { $var=; export $var; }; }; $relink_command"
10762 elif eval var_value=\$$var; test -z "$var_value"; then
10763 relink_command="$var=; export $var; $relink_command"
10765 func_quote_for_eval "$var_value"
10766 relink_command="$var=$func_quote_for_eval_result; export $var; $relink_command"
10769 # Quote the link command for shipping.
10770 relink_command="(cd `pwd`; $SHELL \"$progpath\" $preserve_args --mode=relink $libtool_args @inst_prefix_dir@)"
10771 relink_command=`$ECHO "$relink_command" | $SED "$sed_quote_subst"`
10772 if test yes = "$hardcode_automatic"; then
10776 # Only create the output if not a dry run.
10778 for installed in no yes; do
10779 if test yes = "$installed"; then
10780 if test -z "$install_libdir"; then
10783 output=$output_objdir/${outputname}i
10784 # Replace all uninstalled libtool libraries with the installed ones
10785 newdependency_libs=
10786 for deplib in $dependency_libs; do
10789 func_basename "$deplib"
10790 name=$func_basename_result
10791 func_resolve_sysroot "$deplib"
10792 eval libdir=`$SED -n -e 's/^libdir=\(.*\)$/\1/p' $func_resolve_sysroot_result`
10793 test -z "$libdir" && \
10794 func_fatal_error "'$deplib' is not a valid libtool archive"
10795 func_append newdependency_libs " ${lt_sysroot:+=}$libdir/$name"
10798 func_stripname -L '' "$deplib"
10799 func_replace_sysroot "$func_stripname_result"
10800 func_append newdependency_libs " -L$func_replace_sysroot_result"
10803 func_stripname -R '' "$deplib"
10804 func_replace_sysroot "$func_stripname_result"
10805 func_append newdependency_libs " -R$func_replace_sysroot_result"
10807 *) func_append newdependency_libs " $deplib" ;;
10810 dependency_libs=$newdependency_libs
10813 for lib in $dlfiles; do
10816 func_basename "$lib"
10817 name=$func_basename_result
10818 eval libdir=`$SED -n -e 's/^libdir=\(.*\)$/\1/p' $lib`
10819 test -z "$libdir" && \
10820 func_fatal_error "'$lib' is not a valid libtool archive"
10821 func_append newdlfiles " ${lt_sysroot:+=}$libdir/$name"
10823 *) func_append newdlfiles " $lib" ;;
10826 dlfiles=$newdlfiles
10828 for lib in $dlprefiles; do
10831 # Only pass preopened files to the pseudo-archive (for
10832 # eventual linking with the app. that links it) if we
10833 # didn't already link the preopened objects directly into
10835 func_basename "$lib"
10836 name=$func_basename_result
10837 eval libdir=`$SED -n -e 's/^libdir=\(.*\)$/\1/p' $lib`
10838 test -z "$libdir" && \
10839 func_fatal_error "'$lib' is not a valid libtool archive"
10840 func_append newdlprefiles " ${lt_sysroot:+=}$libdir/$name"
10844 dlprefiles=$newdlprefiles
10847 for lib in $dlfiles; do
10849 [\\/]* | [A-Za-z]:[\\/]*) abs=$lib ;;
10850 *) abs=`pwd`"/$lib" ;;
10852 func_append newdlfiles " $abs"
10854 dlfiles=$newdlfiles
10856 for lib in $dlprefiles; do
10858 [\\/]* | [A-Za-z]:[\\/]*) abs=$lib ;;
10859 *) abs=`pwd`"/$lib" ;;
10861 func_append newdlprefiles " $abs"
10863 dlprefiles=$newdlprefiles
10866 # place dlname in correct position for cygwin
10867 # In fact, it would be nice if we could use this code for all target
10868 # systems that can't hard-code library paths into their executables
10869 # and that have no shared library path variable independent of PATH,
10870 # but it turns out we can't easily determine that from inspecting
10871 # libtool variables, so we have to hard-code the OSs to which it
10872 # applies here; at the moment, that means platforms that use the PE
10873 # object format with DLL files. See the long comment at the top of
10874 # tests/bindir.at for full details.
10876 case $host,$output,$installed,$module,$dlname in
10877 *cygwin*,*lai,yes,no,*.dll | *mingw*,*lai,yes,no,*.dll | *cegcc*,*lai,yes,no,*.dll)
10878 # If a -bindir argument was supplied, place the dll there.
10879 if test -n "$bindir"; then
10880 func_relative_path "$install_libdir" "$bindir"
10881 tdlname=$func_relative_path_result/$dlname
10883 # Otherwise fall back on heuristic.
10884 tdlname=../bin/$dlname
10889 # $outputname - a libtool library file
10890 # Generated by $PROGRAM (GNU $PACKAGE) $VERSION
10892 # Please DO NOT delete this file!
10893 # It is necessary for linking the library.
10895 # The name that we can dlopen(3).
10898 # Names of this library.
10899 library_names='$library_names'
10901 # The name of the static archive.
10902 old_library='$old_library'
10904 # Linker flags that cannot go in dependency_libs.
10905 inherited_linker_flags='$new_inherited_linker_flags'
10907 # Libraries that this one depends upon.
10908 dependency_libs='$dependency_libs'
10910 # Names of additional weak libraries provided by this library
10911 weak_library_names='$weak_libs'
10913 # Version information for $libname.
10918 # Is this an already installed library?
10919 installed=$installed
10921 # Should we warn about portability when linking against -modules?
10922 shouldnotlink=$module
10924 # Files to dlopen/dlpreopen
10926 dlpreopen='$dlprefiles'
10928 # Directory that this library needs to be installed in:
10929 libdir='$install_libdir'"
10930 if test no,yes = "$installed,$need_relink" && test -n "$relink_command"; then
10931 $ECHO >> $output "\
10932 relink_command=\"$relink_command\""
10937 # Do a symbolic link so that the libtool archive can be found in
10938 # LD_LIBRARY_PATH before the program is installed.
10939 func_show_eval '( cd "$output_objdir" && $RM "$outputname" && $LN_S "../$outputname" "$outputname" )' 'exit $?'
10945 if test link = "$opt_mode" || test relink = "$opt_mode"; then
10946 func_mode_link ${1+"$@"}
10950 # func_mode_uninstall arg...
10951 func_mode_uninstall ()
10960 # This variable tells wrapper scripts just to set variables rather
10961 # than running their programs.
10962 libtool_install_magic=$magic
10967 -f) func_append RM " $arg"; rmforce=: ;;
10968 -*) func_append RM " $arg" ;;
10969 *) func_append files " $arg" ;;
10974 func_fatal_help "you must specify an RM program"
10978 for file in $files; do
10979 func_dirname "$file" "" "."
10980 dir=$func_dirname_result
10981 if test . = "$dir"; then
10986 func_basename "$file"
10987 name=$func_basename_result
10988 test uninstall = "$opt_mode" && odir=$dir
10990 # Remember odir for removal later, being careful to avoid duplicates
10991 if test clean = "$opt_mode"; then
10992 case " $rmdirs " in
10994 *) func_append rmdirs " $odir" ;;
10998 # Don't error if the file doesn't exist and rm -f was used.
10999 if { test -L "$file"; } >/dev/null 2>&1 ||
11000 { test -h "$file"; } >/dev/null 2>&1 ||
11001 test -f "$file"; then
11003 elif test -d "$file"; then
11006 elif $rmforce; then
11014 # Possibly a libtool archive, so verify it.
11015 if func_lalib_p "$file"; then
11016 func_source $dir/$name
11018 # Delete the libtool libraries and symlinks.
11019 for n in $library_names; do
11020 func_append rmfiles " $odir/$n"
11022 test -n "$old_library" && func_append rmfiles " $odir/$old_library"
11026 case " $library_names " in
11028 *) test -n "$dlname" && func_append rmfiles " $odir/$dlname" ;;
11030 test -n "$libdir" && func_append rmfiles " $odir/$name $odir/${name}i"
11033 if test -n "$library_names"; then
11034 # Do each command in the postuninstall commands.
11035 func_execute_cmds "$postuninstall_cmds" '$rmforce || exit_status=1'
11038 if test -n "$old_library"; then
11039 # Do each command in the old_postuninstall commands.
11040 func_execute_cmds "$old_postuninstall_cmds" '$rmforce || exit_status=1'
11042 # FIXME: should reinstall the best remaining shared library.
11049 # Possibly a libtool object, so verify it.
11050 if func_lalib_p "$file"; then
11052 # Read the .lo file
11053 func_source $dir/$name
11055 # Add PIC object to the list of files to remove.
11056 if test -n "$pic_object" && test none != "$pic_object"; then
11057 func_append rmfiles " $dir/$pic_object"
11060 # Add non-PIC object to the list of files to remove.
11061 if test -n "$non_pic_object" && test none != "$non_pic_object"; then
11062 func_append rmfiles " $dir/$non_pic_object"
11068 if test clean = "$opt_mode"; then
11072 func_stripname '' '.exe' "$file"
11073 file=$func_stripname_result
11074 func_stripname '' '.exe' "$name"
11075 noexename=$func_stripname_result
11076 # $file with .exe has already been added to rmfiles,
11077 # add $file without .exe
11078 func_append rmfiles " $file"
11081 # Do a test to see if this is a libtool program.
11082 if func_ltwrapper_p "$file"; then
11083 if func_ltwrapper_executable_p "$file"; then
11084 func_ltwrapper_scriptname "$file"
11086 func_source $func_ltwrapper_scriptname_result
11087 func_append rmfiles " $func_ltwrapper_scriptname_result"
11090 func_source $dir/$noexename
11093 # note $name still contains .exe if it was in $file originally
11094 # as does the version of $file that was added into $rmfiles
11095 func_append rmfiles " $odir/$name $odir/${name}S.$objext"
11096 if test yes = "$fast_install" && test -n "$relink_command"; then
11097 func_append rmfiles " $odir/lt-$name"
11099 if test "X$noexename" != "X$name"; then
11100 func_append rmfiles " $odir/lt-$noexename.c"
11106 func_show_eval "$RM $rmfiles" 'exit_status=1'
11109 # Try to remove the $objdir's in the directories where we deleted files
11110 for dir in $rmdirs; do
11111 if test -d "$dir"; then
11112 func_show_eval "rmdir $dir >/dev/null 2>&1"
11119 if test uninstall = "$opt_mode" || test clean = "$opt_mode"; then
11120 func_mode_uninstall ${1+"$@"}
11123 test -z "$opt_mode" && {
11125 func_fatal_help "you must specify a MODE"
11128 test -z "$exec_cmd" && \
11129 func_fatal_help "invalid operation mode '$opt_mode'"
11131 if test -n "$exec_cmd"; then
11132 eval exec "$exec_cmd"
11139 # The TAGs below are defined such that we never get into a situation
11140 # where we disable both kinds of libraries. Given conflicting
11141 # choices, we go for a static library, that is the most portable,
11142 # since we can't tell whether shared libraries were disabled because
11143 # the user asked for that or because the platform doesn't support
11144 # them. This is particularly important on AIX, because we don't
11145 # support having both static and shared libraries enabled at the same
11146 # time on that platform, so we default to a shared-only configuration.
11147 # If a disable-shared tag is given, we'll fallback to a static-only
11148 # configuration. But we'll never go from static-only to shared-only.
11150 # ### BEGIN LIBTOOL TAG CONFIG: disable-shared
11151 build_libtool_libs=no
11153 # ### END LIBTOOL TAG CONFIG: disable-shared
11155 # ### BEGIN LIBTOOL TAG CONFIG: disable-static
11156 build_old_libs=`case $build_libtool_libs in yes) echo no;; *) echo yes;; esac`
11157 # ### END LIBTOOL TAG CONFIG: disable-static
11160 # mode:shell-script