1 # Generated from ltmain.m4sh.
3 # ltmain.sh (GNU libtool) 2.2.6
4 # Written by Gordon Matzigkeit <gord@gnu.ai.mit.edu>, 1996
6 # Copyright (C) 1996, 1997, 1998, 1999, 2000, 2001, 2003, 2004, 2005, 2006, 2007 2008 Free Software Foundation, Inc.
7 # This is free software; see the source for copying conditions. There is NO
8 # warranty; not even for MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
10 # GNU Libtool is free software; you can redistribute it and/or modify
11 # it under the terms of the GNU General Public License as published by
12 # the Free Software Foundation; either version 2 of the License, or
13 # (at your option) any later version.
15 # As a special exception to the GNU General Public License,
16 # if you distribute this file as part of a program or library that
17 # is built using GNU Libtool, you may include this file under the
18 # same distribution terms that you use for the rest of that program.
20 # GNU Libtool is distributed in the hope that it will be useful, but
21 # WITHOUT ANY WARRANTY; without even the implied warranty of
22 # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
23 # General Public License for more details.
25 # You should have received a copy of the GNU General Public License
26 # along with GNU Libtool; see the file COPYING. If not, a copy
27 # can be downloaded from http://www.gnu.org/licenses/gpl.html,
28 # or obtained by writing to the Free Software Foundation, Inc.,
29 # 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
31 # Usage: $progname [OPTION]... [MODE-ARG]...
33 # Provide generalized library-building support services.
35 # --config show all configuration variables
36 # --debug enable verbose shell tracing
37 # -n, --dry-run display commands without modifying any files
38 # --features display basic configuration information and exit
39 # --mode=MODE use operation mode MODE
40 # --preserve-dup-deps don't remove duplicate dependency libraries
41 # --quiet, --silent don't print informational messages
42 # --tag=TAG use configuration variables from tag TAG
43 # -v, --verbose print informational messages (default)
44 # --version print version information
45 # -h, --help print short or long help message
47 # MODE must be one of the following:
49 # clean remove files from the build directory
50 # compile compile a source file into a libtool object
51 # execute automatically set library path, then run a program
52 # finish complete the installation of libtool libraries
53 # install install libraries or executables
54 # link create a library or an executable
55 # uninstall remove libraries from an installed directory
57 # MODE-ARGS vary depending on the MODE.
58 # Try `$progname --help --mode=MODE' for a more detailed description of MODE.
60 # When reporting a bug, please describe a test case to reproduce it and
61 # include the following information:
66 # compiler flags: $LTCFLAGS
67 # linker: $LD (gnu? $with_gnu_ld)
68 # $progname: (GNU libtool) 2.2.6
69 # automake: $automake_version
70 # autoconf: $autoconf_version
72 # Report bugs to <bug-libtool@gnu.org>.
78 package_revision=1.3012
80 # Be Bourne compatible
81 if test -n "${ZSH_VERSION+set}" && (emulate sh) >/dev/null 2>&1; then
84 # Zsh 3.x and 4.x performs word splitting on ${1+"$@"}, which
85 # is contrary to our usage. Disable this feature.
86 alias -g '${1+"$@"}'='"$@"'
89 case `(set -o) 2>/dev/null` in *posix*) set -o posix;; esac
91 BIN_SH=xpg4; export BIN_SH # for Tru64
92 DUALCASE=1; export DUALCASE # for MKS sh
94 # NLS nuisances: We save the old values to restore during execute mode.
95 # Only set LANG and LC_ALL to C if already set.
96 # These must not be set unconditionally because not all systems understand
97 # e.g. LANG=C (notably SCO).
100 for lt_var in LANG LANGUAGE LC_ALL LC_CTYPE LC_COLLATE LC_MESSAGES
102 eval "if test \"\${$lt_var+set}\" = set; then
103 save_$lt_var=\$$lt_var
106 lt_user_locale=\"$lt_var=\\\$save_\$lt_var; \$lt_user_locale\"
107 lt_safe_locale=\"$lt_var=C; \$lt_safe_locale\"
119 : ${EGREP="/usr/bin/grep -E"}
120 : ${FGREP="/usr/bin/grep -F"}
121 : ${GREP="/usr/bin/grep"}
127 : ${SED="/opt/local/bin/gsed"}
128 : ${SHELL="${CONFIG_SHELL-/bin/sh}"}
129 : ${Xsed="$SED -e 1s/^X//"}
134 EXIT_MISMATCH=63 # $? = 63 is used to indicate version mismatch to missing.
135 EXIT_SKIP=77 # $? = 77 is used to indicate a skipped test to automake.
137 exit_status=$EXIT_SUCCESS
139 # Make sure IFS has a sensible default
144 dirname="s,/[^/]*$,,"
147 # func_dirname_and_basename file append nondir_replacement
148 # perform func_basename and func_dirname in a single function
150 # dirname: Compute the dirname of FILE. If nonempty,
151 # add APPEND to the result, otherwise set result
152 # to NONDIR_REPLACEMENT.
153 # value returned in "$func_dirname_result"
154 # basename: Compute filename of FILE.
155 # value retuned in "$func_basename_result"
156 # Implementation must be kept synchronized with func_dirname
157 # and func_basename. For efficiency, we do not delegate to
158 # those functions but instead duplicate the functionality here.
159 func_dirname_and_basename ()
161 # Extract subdirectory from the argument.
162 func_dirname_result=`$ECHO "X${1}" | $Xsed -e "$dirname"`
163 if test "X$func_dirname_result" = "X${1}"; then
164 func_dirname_result="${3}"
166 func_dirname_result="$func_dirname_result${2}"
168 func_basename_result=`$ECHO "X${1}" | $Xsed -e "$basename"`
171 # Generated shell functions inserted here.
173 # These SED scripts presuppose an absolute path with a trailing slash.
174 pathcar="s,^/\([^/]*\).*$,\1,"
175 pathcdr="s,^/[^/]*,,"
176 removedotparts="s@/\(\./\)\{1,\}@/@g;s,/\.$,/,"
177 collapseslashes="s@/\{1,\}@/@g"
178 finalslash="s,/*$,/,"
180 # func_normal_abspath PATH
181 # Remove doubled-up and trailing slashes, "." path components,
182 # and cancel out any ".." path components in PATH after making
183 # it an absolute path.
184 # value returned in "$func_normal_abspath_result"
185 func_normal_abspath ()
187 # Start from root dir and reassemble the path.
188 func_normal_abspath_result=
189 func_normal_abspath_tpath=$1
190 func_normal_abspath_altnamespace=
191 case $func_normal_abspath_tpath in
193 # Empty path, that just means $cwd.
194 func_stripname '' '/' "`pwd`"
195 func_normal_abspath_result=$func_stripname_result
198 # The next three entries are used to spot a run of precisely
199 # two leading slashes without using negated character classes;
200 # we take advantage of case's first-match behaviour.
202 # Unusual form of absolute path, do nothing.
205 # Not necessarily an ordinary path; POSIX reserves leading '//'
206 # and for example Cygwin uses it to access remote file shares
207 # over CIFS/SMB, so we conserve a leading double slash if found.
208 func_normal_abspath_altnamespace=/
211 # Absolute path, do nothing.
214 # Relative path, prepend $cwd.
215 func_normal_abspath_tpath=`pwd`/$func_normal_abspath_tpath
218 # Cancel out all the simple stuff to save iterations. We also want
219 # the path to end with a slash for ease of parsing, so make sure
220 # there is one (and only one) here.
221 func_normal_abspath_tpath=`$ECHO "$func_normal_abspath_tpath" | $SED \
222 -e "$removedotparts" -e "$collapseslashes" -e "$finalslash"`
224 # Processed it all yet?
225 if test "$func_normal_abspath_tpath" = / ; then
226 # If we ascended to the root using ".." the result may be empty now.
227 if test -z "$func_normal_abspath_result" ; then
228 func_normal_abspath_result=/
232 func_normal_abspath_tcomponent=`$ECHO "$func_normal_abspath_tpath" | $SED \
234 func_normal_abspath_tpath=`$ECHO "$func_normal_abspath_tpath" | $SED \
236 # Figure out what to do with it
237 case $func_normal_abspath_tcomponent in
239 # Trailing empty path component, ignore it.
242 # Parent dir; strip last assembled component from result.
243 func_dirname "$func_normal_abspath_result"
244 func_normal_abspath_result=$func_dirname_result
247 # Actual path component, append it.
248 func_normal_abspath_result=$func_normal_abspath_result/$func_normal_abspath_tcomponent
252 # Restore leading double-slash if one was found on entry.
253 func_normal_abspath_result=$func_normal_abspath_altnamespace$func_normal_abspath_result
256 # func_relative_path SRCDIR DSTDIR
257 # generates a relative path from SRCDIR to DSTDIR, with a trailing
258 # slash if non-empty, suitable for immediately appending a filename
259 # without needing to append a separator.
260 # value returned in "$func_relative_path_result"
261 func_relative_path ()
263 func_relative_path_result=
264 func_normal_abspath "$1"
265 func_relative_path_tlibdir=$func_normal_abspath_result
266 func_normal_abspath "$2"
267 func_relative_path_tbindir=$func_normal_abspath_result
269 # Ascend the tree starting from libdir
271 # check if we have found a prefix of bindir
272 case $func_relative_path_tbindir in
273 $func_relative_path_tlibdir)
274 # found an exact match
275 func_relative_path_tcancelled=
278 $func_relative_path_tlibdir*)
279 # found a matching prefix
280 func_stripname "$func_relative_path_tlibdir" '' "$func_relative_path_tbindir"
281 func_relative_path_tcancelled=$func_stripname_result
282 if test -z "$func_relative_path_result"; then
283 func_relative_path_result=.
288 func_dirname $func_relative_path_tlibdir
289 func_relative_path_tlibdir=${func_dirname_result}
290 if test "x$func_relative_path_tlibdir" = x ; then
291 # Have to descend all the way to the root!
292 func_relative_path_result=../$func_relative_path_result
293 func_relative_path_tcancelled=$func_relative_path_tbindir
296 func_relative_path_result=../$func_relative_path_result
301 # Now calculate path; take care to avoid doubling-up slashes.
302 func_stripname '' '/' "$func_relative_path_result"
303 func_relative_path_result=$func_stripname_result
304 func_stripname '/' '/' "$func_relative_path_tcancelled"
305 if test "x$func_stripname_result" != x ; then
306 func_relative_path_result=${func_relative_path_result}/${func_stripname_result}
309 # Normalisation. If bindir is libdir, return empty string,
310 # else relative path ending with a slash; either way, target
311 # file name can be directly appended.
312 if test ! -z "$func_relative_path_result"; then
313 func_stripname './' '' "$func_relative_path_result/"
314 func_relative_path_result=$func_stripname_result
318 # Work around backward compatibility issue on IRIX 6.5. On IRIX 6.4+, sh
319 # is ksh but when the shell is invoked as "sh" and the current value of
320 # the _XPG environment variable is not equal to 1 (one), the special
321 # positional parameter $0, within a function call, is the name of the
325 # The name of this program:
326 # In the unlikely event $progname began with a '-', it would play havoc with
327 # func_echo (imagine progname=-n), so we prepend ./ in that case:
328 func_dirname_and_basename "$progpath"
329 progname=$func_basename_result
331 -*) progname=./$progname ;;
334 # Make sure we have an absolute path for reexecution:
336 [\\/]*|[A-Za-z]:\\*) ;;
338 progdir=$func_dirname_result
339 progdir=`cd "$progdir" && pwd`
340 progpath="$progdir/$progname"
345 for progdir in $PATH; do
347 test -x "$progdir/$progname" && break
350 test -n "$progdir" || progdir=`pwd`
351 progpath="$progdir/$progname"
355 # Sed substitution that helps us do robust quoting. It backslashifies
356 # metacharacters that are still active within double-quoted strings.
357 Xsed="${SED}"' -e 1s/^X//'
358 sed_quote_subst='s/\([`"$\\]\)/\\\1/g'
360 # Same as above, but do not quote variable references.
361 double_quote_subst='s/\(["`\\]\)/\\\1/g'
363 # Re-`\' parameter expansions in output of double_quote_subst that were
364 # `\'-ed in input to the same. If an odd number of `\' preceded a '$'
365 # in input to double_quote_subst, that '$' was protected from expansion.
366 # Since each input `\' is now two `\'s, look for any number of runs of
367 # four `\'s followed by two `\'s and then a '$'. `\' that '$'.
372 sed_double_backslash="\
376 s/\\([^$bs]\\)$bs2$dollar/\\1$bs2$bs$dollar/g
387 # Echo program name prefixed message, along with the current mode
388 # name if it has been set yet.
391 $ECHO "$progname${mode+: }$mode: $*"
394 # func_verbose arg...
395 # Echo program name prefixed message in verbose mode only.
398 $opt_verbose && func_echo ${1+"$@"}
400 # A bug in bash halts the script if the last line of a function
401 # fails when set -e is in force, so we need another command to
407 # Echo program name prefixed message to standard error.
410 $ECHO "$progname${mode+: }$mode: "${1+"$@"} 1>&2
413 # func_warning arg...
414 # Echo program name prefixed warning message to standard error.
417 $opt_warning && $ECHO "$progname${mode+: }$mode: warning: "${1+"$@"} 1>&2
423 # func_fatal_error arg...
424 # Echo program name prefixed message to standard error, and exit.
431 # func_fatal_help arg...
432 # Echo program name prefixed message to standard error, followed by
433 # a help hint, and exit.
437 func_fatal_error "$help"
439 help="Try \`$progname --help' for more information." ## default
442 # func_grep expression filename
443 # Check whether EXPRESSION matches any line of FILENAME, without output.
446 $GREP "$1" "$2" >/dev/null 2>&1
450 # func_mkdir_p directory-path
451 # Make sure the entire path to DIRECTORY-PATH is available.
454 my_directory_path="$1"
457 if test -n "$my_directory_path" && test "$opt_dry_run" != ":"; then
459 # Protect directory names starting with `-'
460 case $my_directory_path in
461 -*) my_directory_path="./$my_directory_path" ;;
464 # While some portion of DIR does not yet exist...
465 while test ! -d "$my_directory_path"; do
466 # ...make a list in topmost first order. Use a colon delimited
467 # list incase some portion of path contains whitespace.
468 my_dir_list="$my_directory_path:$my_dir_list"
470 # If the last portion added has no slash in it, the list is done
471 case $my_directory_path in */*) ;; *) break ;; esac
473 # ...otherwise throw away the child directory and loop
474 my_directory_path=`$ECHO "X$my_directory_path" | $Xsed -e "$dirname"`
476 my_dir_list=`$ECHO "X$my_dir_list" | $Xsed -e 's,:*$,,'`
478 save_mkdir_p_IFS="$IFS"; IFS=':'
479 for my_dir in $my_dir_list; do
480 IFS="$save_mkdir_p_IFS"
481 # mkdir can fail with a `File exist' error if two processes
482 # try to create one of the directories concurrently. Don't
484 $MKDIR "$my_dir" 2>/dev/null || :
486 IFS="$save_mkdir_p_IFS"
488 # Bail out if we (or some other process) failed to create a directory.
489 test -d "$my_directory_path" || \
490 func_fatal_error "Failed to create \`$1'"
495 # func_mktempdir [string]
496 # Make a temporary directory that won't clash with other running
497 # libtool processes, and avoids race conditions if possible. If
498 # given, STRING is the basename for that directory.
501 my_template="${TMPDIR-/tmp}/${1-$progname}"
503 if test "$opt_dry_run" = ":"; then
504 # Return a directory name, but don't create it in dry-run mode
505 my_tmpdir="${my_template}-$$"
508 # If mktemp works, use that first and foremost
509 my_tmpdir=`mktemp -d "${my_template}-XXXXXXXX" 2>/dev/null`
511 if test ! -d "$my_tmpdir"; then
512 # Failing that, at least try and use $RANDOM to avoid a race
513 my_tmpdir="${my_template}-${RANDOM-0}$$"
515 save_mktempdir_umask=`umask`
518 umask $save_mktempdir_umask
521 # If we're not in dry-run mode, bomb out on failure
522 test -d "$my_tmpdir" || \
523 func_fatal_error "cannot create temporary directory \`$my_tmpdir'"
526 $ECHO "X$my_tmpdir" | $Xsed
530 # func_quote_for_eval arg
531 # Aesthetically quote ARG to be evaled later.
532 # This function returns two values: FUNC_QUOTE_FOR_EVAL_RESULT
533 # is double-quoted, suitable for a subsequent eval, whereas
534 # FUNC_QUOTE_FOR_EVAL_UNQUOTED_RESULT has merely all characters
535 # which are still active within double quotes backslashified.
536 func_quote_for_eval ()
540 func_quote_for_eval_unquoted_result=`$ECHO "X$1" | $Xsed -e "$sed_quote_subst"` ;;
542 func_quote_for_eval_unquoted_result="$1" ;;
545 case $func_quote_for_eval_unquoted_result in
546 # Double-quote args containing shell metacharacters to delay
547 # word splitting, command substitution and and variable
548 # expansion for a subsequent eval.
549 # Many Bourne shells cannot handle close brackets correctly
550 # in scan sets, so we specify it separately.
551 *[\[\~\#\^\&\*\(\)\{\}\|\;\<\>\?\'\ \ ]*|*]*|"")
552 func_quote_for_eval_result="\"$func_quote_for_eval_unquoted_result\""
555 func_quote_for_eval_result="$func_quote_for_eval_unquoted_result"
560 # func_quote_for_expand arg
561 # Aesthetically quote ARG to be evaled later; same as above,
562 # but do not quote variable references.
563 func_quote_for_expand ()
567 my_arg=`$ECHO "X$1" | $Xsed \
568 -e "$double_quote_subst" -e "$sed_double_backslash"` ;;
574 # Double-quote args containing shell metacharacters to delay
575 # word splitting and command substitution for a subsequent eval.
576 # Many Bourne shells cannot handle close brackets correctly
577 # in scan sets, so we specify it separately.
578 *[\[\~\#\^\&\*\(\)\{\}\|\;\<\>\?\'\ \ ]*|*]*|"")
583 func_quote_for_expand_result="$my_arg"
587 # func_show_eval cmd [fail_exp]
588 # Unless opt_silent is true, then output CMD. Then, if opt_dryrun is
589 # not true, evaluate CMD. If the evaluation of CMD fails, and FAIL_EXP
590 # is given, then evaluate it.
596 ${opt_silent-false} || {
597 func_quote_for_expand "$my_cmd"
598 eval "func_echo $func_quote_for_expand_result"
601 if ${opt_dry_run-false}; then :; else
604 if test "$my_status" -eq 0; then :; else
605 eval "(exit $my_status); $my_fail_exp"
611 # func_show_eval_locale cmd [fail_exp]
612 # Unless opt_silent is true, then output CMD. Then, if opt_dryrun is
613 # not true, evaluate CMD. If the evaluation of CMD fails, and FAIL_EXP
614 # is given, then evaluate it. Use the saved locale for evaluation.
615 func_show_eval_locale ()
620 ${opt_silent-false} || {
621 func_quote_for_expand "$my_cmd"
622 eval "func_echo $func_quote_for_expand_result"
625 if ${opt_dry_run-false}; then :; else
626 eval "$lt_user_locale
629 eval "$lt_safe_locale"
630 if test "$my_status" -eq 0; then :; else
631 eval "(exit $my_status); $my_fail_exp"
641 # Echo version message to standard output and exit.
644 $SED -n '/^# '$PROGRAM' (GNU /,/# warranty; / {
647 s/\((C)\)[ 0-9,-]*\( [1-9][0-9]*\)/\1\2/
654 # Echo short help message to standard output and exit.
657 $SED -n '/^# Usage:/,/# -h/ {
660 s/\$progname/'$progname'/
664 $ECHO "run \`$progname --help | more' for full usage"
669 # Echo long help message to standard output and exit.
672 $SED -n '/^# Usage:/,/# Report bugs to/ {
675 s*\$progname*'$progname'*
677 s*\$SHELL*'"$SHELL"'*
679 s*\$LTCFLAGS*'"$LTCFLAGS"'*
681 s/\$with_gnu_ld/'"$with_gnu_ld"'/
682 s/\$automake_version/'"`(automake --version) 2>/dev/null |$SED 1q`"'/
683 s/\$autoconf_version/'"`(autoconf --version) 2>/dev/null |$SED 1q`"'/
689 # func_missing_arg argname
690 # Echo program name prefixed message to standard error and set global
694 func_error "missing argument for $1"
704 # Check that we have a working $ECHO.
705 if test "X$1" = X--no-reexec; then
706 # Discard the --no-reexec flag, and continue.
708 elif test "X$1" = X--fallback-echo; then
709 # Avoid inline document here, it may be left over
711 elif test "X`{ $ECHO '\t'; } 2>/dev/null`" = 'X\t'; then
712 # Yippee, $ECHO works!
715 # Restart under the correct shell, and then maybe $ECHO will work.
716 exec $SHELL "$progpath" --no-reexec ${1+"$@"}
719 if test "X$1" = X--fallback-echo; then
720 # used as fallback echo
728 magic="%%%MAGIC variable%%%"
729 magic_exe="%%%MAGIC EXE variable%%%"
736 lo2o="s/\\.lo\$/.${objext}/"
737 o2lo="s/\\.${objext}\$/.lo/"
742 opt_duplicate_deps=false
746 # If this variable is set in any of the actions, the command in it
747 # will be execed at the end. This prevents here-documents from being
748 # left over by shells.
751 # func_fatal_configuration arg...
752 # Echo program name prefixed message to standard error, followed by
753 # a configuration failure hint, and exit.
754 func_fatal_configuration ()
757 func_error "See the $PACKAGE documentation for more information."
758 func_fatal_error "Fatal configuration error."
763 # Display the configuration for all the tags in this script.
766 re_begincf='^# ### BEGIN LIBTOOL'
767 re_endcf='^# ### END LIBTOOL'
769 # Default configuration.
770 $SED "1,/$re_begincf CONFIG/d;/$re_endcf CONFIG/,\$d" < "$progpath"
772 # Now print the configurations for the tags.
773 for tagname in $taglist; do
774 $SED -n "/$re_begincf TAG CONFIG: $tagname\$/,/$re_endcf TAG CONFIG: $tagname\$/p" < "$progpath"
781 # Display the features supported by this script.
785 if test "$build_libtool_libs" = yes; then
786 $ECHO "enable shared libraries"
788 $ECHO "disable shared libraries"
790 if test "$build_old_libs" = yes; then
791 $ECHO "enable static libraries"
793 $ECHO "disable static libraries"
799 # func_enable_tag tagname
800 # Verify that TAGNAME is valid, and either flag an error and exit, or
801 # enable the TAGNAME tag. We also add TAGNAME to the global $taglist
808 re_begincf="^# ### BEGIN LIBTOOL TAG CONFIG: $tagname\$"
809 re_endcf="^# ### END LIBTOOL TAG CONFIG: $tagname\$"
810 sed_extractcf="/$re_begincf/,/$re_endcf/p"
815 func_fatal_error "invalid tag name: $tagname"
819 # Don't test for the "default" C tag, as we know it's
820 # there but not specially marked.
824 if $GREP "$re_begincf" "$progpath" >/dev/null 2>&1; then
825 taglist="$taglist $tagname"
827 # Evaluate the configuration. Be careful to quote the path
828 # and the sed script, to avoid splitting on whitespace, but
829 # also don't use non-portable quotes within backquotes within
830 # quotes we have to do it in 2 steps:
831 extractedcf=`$SED -n -e "$sed_extractcf" < "$progpath"`
834 func_error "ignoring unknown tag $tagname"
840 # Parse options once, thoroughly. This comes as soon as possible in
841 # the script to make things like `libtool --version' happen quickly.
844 # Shorthand for --mode=foo, only valid as the first argument
847 shift; set dummy --mode clean ${1+"$@"}; shift
849 compile|compil|compi|comp|com|co|c)
850 shift; set dummy --mode compile ${1+"$@"}; shift
852 execute|execut|execu|exec|exe|ex|e)
853 shift; set dummy --mode execute ${1+"$@"}; shift
855 finish|finis|fini|fin|fi|f)
856 shift; set dummy --mode finish ${1+"$@"}; shift
858 install|instal|insta|inst|ins|in|i)
859 shift; set dummy --mode install ${1+"$@"}; shift
862 shift; set dummy --mode link ${1+"$@"}; shift
864 uninstall|uninstal|uninsta|uninst|unins|unin|uni|un|u)
865 shift; set dummy --mode uninstall ${1+"$@"}; shift
869 # Parse non-mode specific arguments:
870 while test "$#" -gt 0; do
875 --config) func_config ;;
877 --debug) preserve_args="$preserve_args $opt"
878 func_echo "enabling shell trace mode"
883 -dlopen) test "$#" -eq 0 && func_missing_arg "$opt" && break
884 execute_dlfiles="$execute_dlfiles $1"
888 --dry-run | -n) opt_dry_run=: ;;
889 --features) func_features ;;
890 --finish) mode="finish" ;;
892 --mode) test "$#" -eq 0 && func_missing_arg "$opt" && break
894 # Valid mode arguments:
904 # Catch anything else as an error
905 *) func_error "invalid argument for $opt"
916 opt_duplicate_deps=: ;;
918 --quiet|--silent) preserve_args="$preserve_args $opt"
922 --verbose| -v) preserve_args="$preserve_args $opt"
926 --tag) test "$#" -eq 0 && func_missing_arg "$opt" && break
927 preserve_args="$preserve_args $opt $1"
928 func_enable_tag "$1" # tagname is set here
932 # Separate optargs to long options:
933 -dlopen=*|--mode=*|--tag=*)
934 func_opt_split "$opt"
935 set dummy "$func_opt_split_opt" "$func_opt_split_arg" ${1+"$@"}
939 -\?|-h) func_usage ;;
940 --help) opt_help=: ;;
941 --version) func_version ;;
943 -*) func_fatal_help "unrecognized option \`$opt'" ;;
953 *cygwin* | *mingw* | *pw32* | *cegcc*)
954 # don't eliminate duplications in $postdeps and $predeps
955 opt_duplicate_compiler_generated_deps=:
958 opt_duplicate_compiler_generated_deps=$opt_duplicate_deps
962 # Having warned about all mis-specified options, bail out if
963 # anything was wrong.
964 $exit_cmd $EXIT_FAILURE
967 # func_check_version_match
968 # Ensure that we are using m4 macros, and libtool script from the same
969 # release of libtool.
970 func_check_version_match ()
972 if test "$package_revision" != "$macro_revision"; then
973 if test "$VERSION" != "$macro_version"; then
974 if test -z "$macro_version"; then
976 $progname: Version mismatch error. This is $PACKAGE $VERSION, but the
977 $progname: definition of this LT_INIT comes from an older release.
978 $progname: You should recreate aclocal.m4 with macros from $PACKAGE $VERSION
979 $progname: and run autoconf again.
983 $progname: Version mismatch error. This is $PACKAGE $VERSION, but the
984 $progname: definition of this LT_INIT comes from $PACKAGE $macro_version.
985 $progname: You should recreate aclocal.m4 with macros from $PACKAGE $VERSION
986 $progname: and run autoconf again.
991 $progname: Version mismatch error. This is $PACKAGE $VERSION, revision $package_revision,
992 $progname: but the definition of this LT_INIT comes from revision $macro_revision.
993 $progname: You should recreate aclocal.m4 with macros from revision $package_revision
994 $progname: of $PACKAGE $VERSION and run autoconf again.
1008 # Sanity checks first:
1009 func_check_version_match
1011 if test "$build_libtool_libs" != yes && test "$build_old_libs" != yes; then
1012 func_fatal_configuration "not configured to build any kind of library"
1015 test -z "$mode" && func_fatal_error "error: you must specify a MODE."
1019 eval std_shrext=\"$shrext_cmds\"
1022 # Only execute mode is allowed to have -dlopen flags.
1023 if test -n "$execute_dlfiles" && test "$mode" != execute; then
1024 func_error "unrecognized option \`-dlopen'"
1029 # Change the help message to a mode-specific one.
1030 generic_help="$help"
1031 help="Try \`$progname --help --mode=$mode' for more information."
1036 # True iff FILE is a libtool `.la' library or `.lo' object file.
1037 # This function is only a basic sanity check; it will hardly flush out
1038 # determined imposters.
1042 $SED -e 4q "$1" 2>/dev/null \
1043 | $GREP "^# Generated by .*$PACKAGE" > /dev/null 2>&1
1046 # func_lalib_unsafe_p file
1047 # True iff FILE is a libtool `.la' library or `.lo' object file.
1048 # This function implements the same check as func_lalib_p without
1049 # resorting to external programs. To this end, it redirects stdin and
1050 # closes it afterwards, without saving the original file descriptor.
1051 # As a safety measure, use it only where a negative result would be
1052 # fatal anyway. Works if `file' does not exist.
1053 func_lalib_unsafe_p ()
1056 if test -f "$1" && test -r "$1" && exec 5<&0 <"$1"; then
1057 for lalib_p_l in 1 2 3 4
1060 case "$lalib_p_line" in
1061 \#\ Generated\ by\ *$PACKAGE* ) lalib_p=yes; break;;
1066 test "$lalib_p" = yes
1069 # func_ltwrapper_script_p file
1070 # True iff FILE is a libtool wrapper script
1071 # This function is only a basic sanity check; it will hardly flush out
1072 # determined imposters.
1073 func_ltwrapper_script_p ()
1078 # func_ltwrapper_executable_p file
1079 # True iff FILE is a libtool wrapper executable
1080 # This function is only a basic sanity check; it will hardly flush out
1081 # determined imposters.
1082 func_ltwrapper_executable_p ()
1084 func_ltwrapper_exec_suffix=
1087 *) func_ltwrapper_exec_suffix=.exe ;;
1089 $GREP "$magic_exe" "$1$func_ltwrapper_exec_suffix" >/dev/null 2>&1
1092 # func_ltwrapper_scriptname file
1093 # Assumes file is an ltwrapper_executable
1094 # uses $file to determine the appropriate filename for a
1095 # temporary ltwrapper_script.
1096 func_ltwrapper_scriptname ()
1098 func_ltwrapper_scriptname_result=""
1099 if func_ltwrapper_executable_p "$1"; then
1100 func_dirname_and_basename "$1" "" "."
1101 func_stripname '' '.exe' "$func_basename_result"
1102 func_ltwrapper_scriptname_result="$func_dirname_result/$objdir/${func_stripname_result}_ltshwrapper"
1106 # func_ltwrapper_p file
1107 # True iff FILE is a libtool wrapper script or wrapper executable
1108 # This function is only a basic sanity check; it will hardly flush out
1109 # determined imposters.
1112 func_ltwrapper_script_p "$1" || func_ltwrapper_executable_p "$1"
1116 # func_execute_cmds commands fail_cmd
1117 # Execute tilde-delimited COMMANDS.
1118 # If FAIL_CMD is given, eval that upon failure.
1119 # FAIL_CMD may read-access the current command in variable CMD!
1120 func_execute_cmds ()
1123 save_ifs=$IFS; IFS='~'
1127 func_show_eval "$cmd" "${2-:}"
1134 # Source FILE, adding directory component if necessary.
1135 # Note that it is not necessary on cygwin/mingw to append a dot to
1136 # FILE even if both FILE and FILE.exe exist: automatic-append-.exe
1137 # behavior happens only for exec(3), not for open(2)! Also, sourcing
1138 # `FILE.' does not work on cygwin managed mounts.
1143 */* | *\\*) . "$1" ;;
1149 # func_infer_tag arg
1150 # Infer tagged configuration to use if any are available and
1151 # if one wasn't chosen via the "--tag" command line option.
1152 # Only attempt this if the compiler in the base compile
1153 # command doesn't match the default compiler.
1154 # arg is usually of the form 'gcc ...'
1158 if test -n "$available_tags" && test -z "$tagname"; then
1161 func_quote_for_eval "$arg"
1162 CC_quoted="$CC_quoted $func_quote_for_eval_result"
1165 # Blanks in the command may have been stripped by the calling shell,
1166 # but not from the CC environment variable when configure was run.
1167 " $CC "* | "$CC "* | " `$ECHO $CC` "* | "`$ECHO $CC` "* | " $CC_quoted"* | "$CC_quoted "* | " `$ECHO $CC_quoted` "* | "`$ECHO $CC_quoted` "*) ;;
1168 # Blanks at the start of $base_compile will cause this to fail
1169 # if we don't check for them as well.
1171 for z in $available_tags; do
1172 if $GREP "^# ### BEGIN LIBTOOL TAG CONFIG: $z$" < "$progpath" > /dev/null; then
1173 # Evaluate the configuration.
1174 eval "`${SED} -n -e '/^# ### BEGIN LIBTOOL TAG CONFIG: '$z'$/,/^# ### END LIBTOOL TAG CONFIG: '$z'$/p' < $progpath`"
1177 # Double-quote args containing other shell metacharacters.
1178 func_quote_for_eval "$arg"
1179 CC_quoted="$CC_quoted $func_quote_for_eval_result"
1182 " $CC "* | "$CC "* | " `$ECHO $CC` "* | "`$ECHO $CC` "* | " $CC_quoted"* | "$CC_quoted "* | " `$ECHO $CC_quoted` "* | "`$ECHO $CC_quoted` "*)
1183 # The compiler in the base compile command matches
1184 # the one in the tagged configuration.
1185 # Assume this is the tagged configuration we want.
1192 # If $tagname still isn't set, then no tagged configuration
1193 # was found and let the user know that the "--tag" command
1194 # line option must be used.
1195 if test -z "$tagname"; then
1196 func_echo "unable to infer tagged configuration"
1197 func_fatal_error "specify a tag with \`--tag'"
1199 # func_verbose "using $tagname tagged configuration"
1208 # func_write_libtool_object output_name pic_name nonpic_name
1209 # Create a libtool object file (analogous to a ".la" file),
1210 # but don't create it if we're doing a dry run.
1211 func_write_libtool_object ()
1214 if test "$build_libtool_libs" = yes; then
1220 if test "$build_old_libs" = yes; then
1221 write_oldobj=\'${3}\'
1227 cat >${write_libobj}T <<EOF
1228 # $write_libobj - a libtool object file
1229 # Generated by $PROGRAM (GNU $PACKAGE$TIMESTAMP) $VERSION
1231 # Please DO NOT delete this file!
1232 # It is necessary for linking the library.
1234 # Name of the PIC object.
1235 pic_object=$write_lobj
1237 # Name of the non-PIC object
1238 non_pic_object=$write_oldobj
1241 $MV "${write_libobj}T" "${write_libobj}"
1245 # func_mode_compile arg...
1246 func_mode_compile ()
1249 # Get the compilation command and the source file.
1251 srcfile="$nonopt" # always keep a non-empty value in "srcfile"
1263 # do not "continue". Instead, add this to base_compile
1275 # Accept any command-line options.
1278 test -n "$libobj" && \
1279 func_fatal_error "you cannot specify \`-o' more than once"
1284 -pie | -fpie | -fPIE)
1285 pie_flag="$pie_flag $arg"
1289 -shared | -static | -prefer-pic | -prefer-non-pic)
1300 arg_mode=arg # the next one goes into the "base_compile" arg list
1301 continue # The current "srcfile" will either be retained or
1302 ;; # replaced later. I would guess that would be a bug.
1305 func_stripname '-Wc,' '' "$arg"
1306 args=$func_stripname_result
1308 save_ifs="$IFS"; IFS=','
1309 for arg in $args; do
1311 func_quote_for_eval "$arg"
1312 lastarg="$lastarg $func_quote_for_eval_result"
1315 func_stripname ' ' '' "$lastarg"
1316 lastarg=$func_stripname_result
1318 # Add the arguments to base_compile.
1319 base_compile="$base_compile $lastarg"
1324 # Accept the current argument as the source file.
1325 # The previous "srcfile" becomes the current argument.
1332 esac # case $arg_mode
1334 # Aesthetically quote the previous argument.
1335 func_quote_for_eval "$lastarg"
1336 base_compile="$base_compile $func_quote_for_eval_result"
1341 func_fatal_error "you must specify an argument for -Xcompile"
1344 func_fatal_error "you must specify a target with \`-o'"
1347 # Get the name of the library object.
1348 test -z "$libobj" && {
1349 func_basename "$srcfile"
1350 libobj="$func_basename_result"
1355 # Recognize several different file suffixes.
1356 # If the user specifies -o file.o, it is replaced with file.lo
1359 *.ada | *.adb | *.ads | *.asm | \
1360 *.c++ | *.cc | *.ii | *.class | *.cpp | *.cxx | \
1361 *.[fF][09]? | *.for | *.java | *.obj | *.sx)
1362 func_xform "$libobj"
1363 libobj=$func_xform_result
1368 *.lo) func_lo2o "$libobj"; obj=$func_lo2o_result ;;
1370 func_fatal_error "cannot determine name of library object from \`$libobj'"
1374 func_infer_tag $base_compile
1376 for arg in $later; do
1379 test "$build_libtool_libs" != yes && \
1380 func_fatal_configuration "can not build a shared library"
1386 build_libtool_libs=no
1403 func_quote_for_eval "$libobj"
1404 test "X$libobj" != "X$func_quote_for_eval_result" \
1405 && $ECHO "X$libobj" | $GREP '[]~#^*{};<>?"'"'"' &()|`$[]' \
1406 && func_warning "libobj name \`$libobj' may not contain shell special characters."
1407 func_dirname_and_basename "$obj" "/" ""
1408 objname="$func_basename_result"
1409 xdir="$func_dirname_result"
1410 lobj=${xdir}$objdir/$objname
1412 test -z "$base_compile" && \
1413 func_fatal_help "you must specify a compilation command"
1415 # Delete any leftover library objects.
1416 if test "$build_old_libs" = yes; then
1417 removelist="$obj $lobj $libobj ${libobj}T"
1419 removelist="$lobj $libobj ${libobj}T"
1422 # On Cygwin there's no "real" PIC flag so we must build both object types
1424 cygwin* | mingw* | pw32* | os2* | cegcc*)
1428 if test "$pic_mode" = no && test "$deplibs_check_method" != pass_all; then
1429 # non-PIC code in shared libraries is not supported
1433 # Calculate the filename of the output object if compiler does
1434 # not support -o with -c
1435 if test "$compiler_c_o" = no; then
1436 output_obj=`$ECHO "X$srcfile" | $Xsed -e 's%^.*/%%' -e 's%\.[^.]*$%%'`.${objext}
1437 lockfile="$output_obj.lock"
1444 # Lock this critical section if it is needed
1445 # We use this script file to make the link, it avoids creating a new file
1446 if test "$need_locks" = yes; then
1447 until $opt_dry_run || ln "$progpath" "$lockfile" 2>/dev/null; do
1448 func_echo "Waiting for $lockfile to be removed"
1451 elif test "$need_locks" = warn; then
1452 if test -f "$lockfile"; then
1454 *** ERROR, $lockfile exists and contains:
1455 `cat $lockfile 2>/dev/null`
1457 This indicates that another process is trying to use the same
1458 temporary object file, and libtool could not work around it because
1459 your compiler does not support \`-c' and \`-o' together. If you
1460 repeat this compilation, it may succeed, by chance, but you had better
1461 avoid parallel builds (make -j) in this platform, or get a better
1464 $opt_dry_run || $RM $removelist
1467 removelist="$removelist $output_obj"
1468 $ECHO "$srcfile" > "$lockfile"
1471 $opt_dry_run || $RM $removelist
1472 removelist="$removelist $lockfile"
1473 trap '$opt_dry_run || $RM $removelist; exit $EXIT_FAILURE' 1 2 15
1475 if test -n "$fix_srcfile_path"; then
1476 eval srcfile=\"$fix_srcfile_path\"
1478 func_quote_for_eval "$srcfile"
1479 qsrcfile=$func_quote_for_eval_result
1481 # Only build a PIC object if we are building libtool libraries.
1482 if test "$build_libtool_libs" = yes; then
1483 # Without this assignment, base_compile gets emptied.
1484 fbsd_hideous_sh_bug=$base_compile
1486 if test "$pic_mode" != no; then
1487 command="$base_compile $qsrcfile $pic_flag"
1489 # Don't build PIC code
1490 command="$base_compile $qsrcfile"
1493 func_mkdir_p "$xdir$objdir"
1495 if test -z "$output_obj"; then
1496 # Place PIC objects in $objdir
1497 command="$command -o $lobj"
1500 func_show_eval_locale "$command" \
1501 'test -n "$output_obj" && $RM $removelist; exit $EXIT_FAILURE'
1503 if test "$need_locks" = warn &&
1504 test "X`cat $lockfile 2>/dev/null`" != "X$srcfile"; then
1506 *** ERROR, $lockfile contains:
1507 `cat $lockfile 2>/dev/null`
1509 but it should contain:
1512 This indicates that another process is trying to use the same
1513 temporary object file, and libtool could not work around it because
1514 your compiler does not support \`-c' and \`-o' together. If you
1515 repeat this compilation, it may succeed, by chance, but you had better
1516 avoid parallel builds (make -j) in this platform, or get a better
1519 $opt_dry_run || $RM $removelist
1523 # Just move the object if needed, then go on to compile the next one
1524 if test -n "$output_obj" && test "X$output_obj" != "X$lobj"; then
1525 func_show_eval '$MV "$output_obj" "$lobj"' \
1526 'error=$?; $opt_dry_run || $RM $removelist; exit $error'
1529 # Allow error messages only from the first compilation.
1530 if test "$suppress_opt" = yes; then
1531 suppress_output=' >/dev/null 2>&1'
1535 # Only build a position-dependent object if we build old libraries.
1536 if test "$build_old_libs" = yes; then
1537 if test "$pic_mode" != yes; then
1538 # Don't build PIC code
1539 command="$base_compile $qsrcfile$pie_flag"
1541 command="$base_compile $qsrcfile $pic_flag"
1543 if test "$compiler_c_o" = yes; then
1544 command="$command -o $obj"
1547 # Suppress compiler output if we already did a PIC compilation.
1548 command="$command$suppress_output"
1549 func_show_eval_locale "$command" \
1550 '$opt_dry_run || $RM $removelist; exit $EXIT_FAILURE'
1552 if test "$need_locks" = warn &&
1553 test "X`cat $lockfile 2>/dev/null`" != "X$srcfile"; then
1555 *** ERROR, $lockfile contains:
1556 `cat $lockfile 2>/dev/null`
1558 but it should contain:
1561 This indicates that another process is trying to use the same
1562 temporary object file, and libtool could not work around it because
1563 your compiler does not support \`-c' and \`-o' together. If you
1564 repeat this compilation, it may succeed, by chance, but you had better
1565 avoid parallel builds (make -j) in this platform, or get a better
1568 $opt_dry_run || $RM $removelist
1572 # Just move the object if needed
1573 if test -n "$output_obj" && test "X$output_obj" != "X$obj"; then
1574 func_show_eval '$MV "$output_obj" "$obj"' \
1575 'error=$?; $opt_dry_run || $RM $removelist; exit $error'
1580 func_write_libtool_object "$libobj" "$objdir/$objname" "$objname"
1582 # Unlock the critical section if it was locked
1583 if test "$need_locks" != no; then
1584 removelist=$lockfile
1593 test "$mode" = compile && func_mode_compile ${1+"$@"}
1598 # We need to display help for each of the modes.
1601 # Generic help is extracted from the usage comments
1602 # at the start of this file.
1608 "Usage: $progname [OPTION]... --mode=clean RM [RM-OPTION]... FILE...
1610 Remove files from the build directory.
1612 RM is the name of the program to use to delete files associated with each FILE
1613 (typically \`/bin/rm'). RM-OPTIONS are options (such as \`-f') to be passed
1616 If FILE is a libtool library, object or program, all the files associated
1617 with it are deleted. Otherwise, only FILE itself is deleted using RM."
1622 "Usage: $progname [OPTION]... --mode=compile COMPILE-COMMAND... SOURCEFILE
1624 Compile a source file into a libtool library object.
1626 This mode accepts the following additional options:
1628 -o OUTPUT-FILE set the output file name to OUTPUT-FILE
1629 -no-suppress do not suppress compiler output for multiple passes
1630 -prefer-pic try to building PIC objects only
1631 -prefer-non-pic try to building non-PIC objects only
1632 -shared do not build a \`.o' file suitable for static linking
1633 -static only build a \`.o' file suitable for static linking
1635 COMPILE-COMMAND is a command to be used in creating a \`standard' object file
1636 from the given SOURCEFILE.
1638 The output file name is determined by removing the directory component from
1639 SOURCEFILE, then substituting the C source code suffix \`.c' with the
1640 library object suffix, \`.lo'."
1645 "Usage: $progname [OPTION]... --mode=execute COMMAND [ARGS]...
1647 Automatically set library path, then run a program.
1649 This mode accepts the following additional options:
1651 -dlopen FILE add the directory containing FILE to the library path
1653 This mode sets the library path environment variable according to \`-dlopen'
1656 If any of the ARGS are libtool executable wrappers, then they are translated
1657 into their corresponding uninstalled binary, and any of their required library
1658 directories are added to the library path.
1660 Then, COMMAND is executed, with ARGS as arguments."
1665 "Usage: $progname [OPTION]... --mode=finish [LIBDIR]...
1667 Complete the installation of libtool libraries.
1669 Each LIBDIR is a directory that contains libtool libraries.
1671 The commands that this mode executes may require superuser privileges. Use
1672 the \`--dry-run' option if you just want to see what would be executed."
1677 "Usage: $progname [OPTION]... --mode=install INSTALL-COMMAND...
1679 Install executables or libraries.
1681 INSTALL-COMMAND is the installation command. The first component should be
1682 either the \`install' or \`cp' program.
1684 The following components of INSTALL-COMMAND are treated specially:
1686 -inst-prefix PREFIX-DIR Use PREFIX-DIR as a staging area for installation
1688 The rest of the components are interpreted as arguments to that command (only
1689 BSD-compatible install options are recognized)."
1694 "Usage: $progname [OPTION]... --mode=link LINK-COMMAND...
1696 Link object files or libraries together to form another library, or to
1697 create an executable program.
1699 LINK-COMMAND is a command using the C compiler that you would use to create
1700 a program from several object files.
1702 The following components of LINK-COMMAND are treated specially:
1704 -all-static do not do any dynamic linking at all
1705 -avoid-version do not add a version suffix if possible
1706 -bindir BINDIR specify path to binaries directory (for systems where
1707 libraries must be found in the PATH setting at runtime)
1708 -dlopen FILE \`-dlpreopen' FILE if it cannot be dlopened at runtime
1709 -dlpreopen FILE link in FILE and add its symbols to lt_preloaded_symbols
1710 -export-dynamic allow symbols from OUTPUT-FILE to be resolved with dlsym(3)
1711 -export-symbols SYMFILE
1712 try to export only the symbols listed in SYMFILE
1713 -export-symbols-regex REGEX
1714 try to export only the symbols matching REGEX
1715 -LLIBDIR search LIBDIR for required installed libraries
1716 -lNAME OUTPUT-FILE requires the installed library libNAME
1717 -module build a library that can dlopened
1718 -no-fast-install disable the fast-install mode
1719 -no-install link a not-installable executable
1720 -no-undefined declare that a library does not refer to external symbols
1721 -o OUTPUT-FILE create OUTPUT-FILE from the specified objects
1722 -objectlist FILE Use a list of object files found in FILE to specify objects
1723 -precious-files-regex REGEX
1724 don't remove output files matching REGEX
1725 -release RELEASE specify package release information
1726 -rpath LIBDIR the created library will eventually be installed in LIBDIR
1727 -R[ ]LIBDIR add LIBDIR to the runtime path of programs and libraries
1728 -shared only do dynamic linking of libtool libraries
1729 -shrext SUFFIX override the standard shared library file extension
1730 -static do not do any dynamic linking of uninstalled libtool libraries
1731 -static-libtool-libs
1732 do not do any dynamic linking of libtool libraries
1733 -version-info CURRENT[:REVISION[:AGE]]
1734 specify library version info [each variable defaults to 0]
1735 -weak LIBNAME declare that the target provides the LIBNAME interface
1737 All other options (arguments beginning with \`-') are ignored.
1739 Every other argument is treated as a filename. Files ending in \`.la' are
1740 treated as uninstalled libtool libraries, other files are standard or library
1743 If the OUTPUT-FILE ends in \`.la', then a libtool library is created,
1744 only library objects (\`.lo' files) may be specified, and \`-rpath' is
1745 required, except when creating a convenience library.
1747 If OUTPUT-FILE ends in \`.a' or \`.lib', then a standard library is created
1748 using \`ar' and \`ranlib', or on Windows using \`lib'.
1750 If OUTPUT-FILE ends in \`.lo' or \`.${objext}', then a reloadable object file
1751 is created, otherwise an executable program is created."
1756 "Usage: $progname [OPTION]... --mode=uninstall RM [RM-OPTION]... FILE...
1758 Remove libraries from an installation directory.
1760 RM is the name of the program to use to delete files associated with each FILE
1761 (typically \`/bin/rm'). RM-OPTIONS are options (such as \`-f') to be passed
1764 If FILE is a libtool library, all the files associated with it are deleted.
1765 Otherwise, only FILE itself is deleted using RM."
1769 func_fatal_help "invalid operation mode \`$mode'"
1774 $ECHO "Try \`$progname --help' for more information about other modes."
1779 # Now that we've collected a possible --mode arg, show help if necessary
1780 $opt_help && func_mode_help
1783 # func_mode_execute arg...
1784 func_mode_execute ()
1787 # The first argument is the command name.
1790 func_fatal_help "you must specify a COMMAND"
1792 # Handle -dlopen flags immediately.
1793 for file in $execute_dlfiles; do
1795 || func_fatal_help "\`$file' is not a file"
1800 # Check to see that this really is a libtool archive.
1801 func_lalib_unsafe_p "$file" \
1802 || func_fatal_help "\`$lib' is not a valid libtool archive"
1804 # Read the libtool library.
1809 # Skip this library if it cannot be dlopened.
1810 if test -z "$dlname"; then
1811 # Warn if it was a shared library.
1812 test -n "$library_names" && \
1813 func_warning "\`$file' was not linked with \`-export-dynamic'"
1817 func_dirname "$file" "" "."
1818 dir="$func_dirname_result"
1820 if test -f "$dir/$objdir/$dlname"; then
1823 if test ! -f "$dir/$dlname"; then
1824 func_fatal_error "cannot find \`$dlname' in \`$dir' or \`$dir/$objdir'"
1830 # Just add the directory containing the .lo file.
1831 func_dirname "$file" "" "."
1832 dir="$func_dirname_result"
1836 func_warning "\`-dlopen' is ignored for non-libtool libraries and objects"
1841 # Get the absolute pathname.
1842 absdir=`cd "$dir" && pwd`
1843 test -n "$absdir" && dir="$absdir"
1845 # Now add the directory to shlibpath_var.
1846 if eval "test -z \"\$$shlibpath_var\""; then
1847 eval "$shlibpath_var=\"\$dir\""
1849 eval "$shlibpath_var=\"\$dir:\$$shlibpath_var\""
1853 # This variable tells wrapper scripts just to set shlibpath_var
1854 # rather than running their programs.
1855 libtool_execute_magic="$magic"
1857 # Check if any of the arguments is a wrapper script.
1864 # Do a test to see if this is really a libtool program.
1865 if func_ltwrapper_script_p "$file"; then
1867 # Transform arg to wrapped name.
1868 file="$progdir/$program"
1869 elif func_ltwrapper_executable_p "$file"; then
1870 func_ltwrapper_scriptname "$file"
1871 func_source "$func_ltwrapper_scriptname_result"
1872 # Transform arg to wrapped name.
1873 file="$progdir/$program"
1877 # Quote arguments (to preserve shell metacharacters).
1878 func_quote_for_eval "$file"
1879 args="$args $func_quote_for_eval_result"
1882 if test "X$opt_dry_run" = Xfalse; then
1883 if test -n "$shlibpath_var"; then
1884 # Export the shlibpath_var.
1885 eval "export $shlibpath_var"
1888 # Restore saved environment variables
1889 for lt_var in LANG LANGUAGE LC_ALL LC_CTYPE LC_COLLATE LC_MESSAGES
1891 eval "if test \"\${save_$lt_var+set}\" = set; then
1892 $lt_var=\$save_$lt_var; export $lt_var
1898 # Now prepare to actually exec the command.
1899 exec_cmd="\$cmd$args"
1901 # Display what would be done.
1902 if test -n "$shlibpath_var"; then
1903 eval "\$ECHO \"\$shlibpath_var=\$$shlibpath_var\""
1904 $ECHO "export $shlibpath_var"
1911 test "$mode" = execute && func_mode_execute ${1+"$@"}
1914 # func_mode_finish arg...
1921 if test -n "$finish_cmds$finish_eval" && test -n "$libdirs"; then
1924 libdirs="$libdirs $dir"
1927 for libdir in $libdirs; do
1928 if test -n "$finish_cmds"; then
1929 # Do each command in the finish commands.
1930 func_execute_cmds "$finish_cmds" 'admincmds="$admincmds
1933 if test -n "$finish_eval"; then
1934 # Do the single finish_eval.
1935 eval cmds=\"$finish_eval\"
1936 $opt_dry_run || eval "$cmds" || admincmds="$admincmds
1942 # Exit here if they wanted silent mode.
1943 $opt_silent && exit $EXIT_SUCCESS
1945 $ECHO "X----------------------------------------------------------------------" | $Xsed
1946 $ECHO "Libraries have been installed in:"
1947 for libdir in $libdirs; do
1951 $ECHO "If you ever happen to want to link against installed libraries"
1952 $ECHO "in a given directory, LIBDIR, you must either use libtool, and"
1953 $ECHO "specify the full pathname of the library, or use the \`-LLIBDIR'"
1954 $ECHO "flag during linking and do at least one of the following:"
1955 if test -n "$shlibpath_var"; then
1956 $ECHO " - add LIBDIR to the \`$shlibpath_var' environment variable"
1957 $ECHO " during execution"
1959 if test -n "$runpath_var"; then
1960 $ECHO " - add LIBDIR to the \`$runpath_var' environment variable"
1961 $ECHO " during linking"
1963 if test -n "$hardcode_libdir_flag_spec"; then
1965 eval flag=\"$hardcode_libdir_flag_spec\"
1967 $ECHO " - use the \`$flag' linker flag"
1969 if test -n "$admincmds"; then
1970 $ECHO " - have your system administrator run these commands:$admincmds"
1972 if test -f /etc/ld.so.conf; then
1973 $ECHO " - have your system administrator add LIBDIR to \`/etc/ld.so.conf'"
1977 $ECHO "See any operating system documentation about shared libraries for"
1979 solaris2.[6789]|solaris2.1[0-9])
1980 $ECHO "more information, such as the ld(1), crle(1) and ld.so(8) manual"
1984 $ECHO "more information, such as the ld(1) and ld.so(8) manual pages."
1987 $ECHO "X----------------------------------------------------------------------" | $Xsed
1991 test "$mode" = finish && func_mode_finish ${1+"$@"}
1994 # func_mode_install arg...
1995 func_mode_install ()
1998 # There may be an optional sh(1) argument at the beginning of
1999 # install_prog (especially on Windows NT).
2000 if test "$nonopt" = "$SHELL" || test "$nonopt" = /bin/sh ||
2001 # Allow the use of GNU shtool's install command.
2002 $ECHO "X$nonopt" | $GREP shtool >/dev/null; then
2003 # Aesthetically quote it.
2004 func_quote_for_eval "$nonopt"
2005 install_prog="$func_quote_for_eval_result "
2013 # The real first argument should be the name of the installation program.
2014 # Aesthetically quote it.
2015 func_quote_for_eval "$arg"
2016 install_prog="$install_prog$func_quote_for_eval_result"
2018 # We need to accept at least all the BSD install flags.
2028 if test -n "$dest"; then
2029 files="$files $dest"
2037 case " $install_prog " in
2052 # If the previous option needed an argument, then skip it.
2053 if test -n "$prev"; then
2062 # Aesthetically quote the argument.
2063 func_quote_for_eval "$arg"
2064 install_prog="$install_prog $func_quote_for_eval_result"
2067 test -z "$install_prog" && \
2068 func_fatal_help "you must specify an install program"
2070 test -n "$prev" && \
2071 func_fatal_help "the \`$prev' option requires an argument"
2073 if test -z "$files"; then
2074 if test -z "$dest"; then
2075 func_fatal_help "no file or destination specified"
2077 func_fatal_help "you must specify a destination"
2081 # Strip any trailing slash from the destination.
2082 func_stripname '' '/' "$dest"
2083 dest=$func_stripname_result
2085 # Check to see that the destination is a directory.
2086 test -d "$dest" && isdir=yes
2087 if test "$isdir" = yes; then
2091 func_dirname_and_basename "$dest" "" "."
2092 destdir="$func_dirname_result"
2093 destname="$func_basename_result"
2095 # Not a directory, so check to see that there is only one file specified.
2096 set dummy $files; shift
2097 test "$#" -gt 1 && \
2098 func_fatal_help "\`$dest' is not a directory"
2101 [\\/]* | [A-Za-z]:[\\/]*) ;;
2103 for file in $files; do
2107 func_fatal_help "\`$destdir' must be an absolute directory name"
2114 # This variable tells wrapper scripts just to set variables rather
2115 # than running their programs.
2116 libtool_install_magic="$magic"
2121 for file in $files; do
2123 # Do each installation.
2126 # Do the static libraries later.
2127 staticlibs="$staticlibs $file"
2131 # Check to see that this really is a libtool archive.
2132 func_lalib_unsafe_p "$file" \
2133 || func_fatal_help "\`$file' is not a valid libtool archive"
2140 # Add the libdir to current_libdirs if it is the destination.
2141 if test "X$destdir" = "X$libdir"; then
2142 case "$current_libdirs " in
2144 *) current_libdirs="$current_libdirs $libdir" ;;
2147 # Note the libdir as a future libdir.
2148 case "$future_libdirs " in
2150 *) future_libdirs="$future_libdirs $libdir" ;;
2154 func_dirname "$file" "/" ""
2155 dir="$func_dirname_result"
2158 if test -n "$relink_command"; then
2159 # Determine the prefix the user has applied to our future dir.
2160 inst_prefix_dir=`$ECHO "X$destdir" | $Xsed -e "s%$libdir\$%%"`
2162 # Don't allow the user to place us outside of our expected
2163 # location b/c this prevents finding dependent libraries that
2164 # are installed to the same prefix.
2165 # At present, this check doesn't affect windows .dll's that
2166 # are installed into $libdir/../bin (currently, that works fine)
2167 # but it's something to keep an eye on.
2168 test "$inst_prefix_dir" = "$destdir" && \
2169 func_fatal_error "error: cannot install \`$file' to a directory not ending in $libdir"
2171 if test -n "$inst_prefix_dir"; then
2172 # Stick the inst_prefix_dir data into the link command.
2173 relink_command=`$ECHO "X$relink_command" | $Xsed -e "s%@inst_prefix_dir@%-inst-prefix-dir $inst_prefix_dir%"`
2175 relink_command=`$ECHO "X$relink_command" | $Xsed -e "s%@inst_prefix_dir@%%"`
2178 func_warning "relinking \`$file'"
2179 func_show_eval "$relink_command" \
2180 'func_fatal_error "error: relink \`$file'\'' with the above command before installing it"'
2183 # See the names of the shared library.
2184 set dummy $library_names; shift
2185 if test -n "$1"; then
2190 test -n "$relink_command" && srcname="$realname"T
2192 # Install the shared library and build the symlinks.
2193 func_show_eval "$install_prog $dir/$srcname $destdir/$realname" \
2197 cygwin* | mingw* | pw32* | cegcc*)
2205 if test -n "$tstripme" && test -n "$striplib"; then
2206 func_show_eval "$striplib $destdir/$realname" 'exit $?'
2209 if test "$#" -gt 0; then
2210 # Delete the old symlinks, and create new ones.
2211 # Try `ln -sf' first, because the `ln' binary might depend on
2212 # the symlink we replace! Solaris /bin/ln does not understand -f,
2213 # so we also need to try rm && ln -s.
2216 test "$linkname" != "$realname" \
2217 && func_show_eval "(cd $destdir && { $LN_S -f $realname $linkname || { $RM $linkname && $LN_S $realname $linkname; }; })"
2221 # Do each command in the postinstall commands.
2222 lib="$destdir/$realname"
2223 func_execute_cmds "$postinstall_cmds" 'exit $?'
2226 # Install the pseudo-library for information purposes.
2227 func_basename "$file"
2228 name="$func_basename_result"
2229 instname="$dir/$name"i
2230 func_show_eval "$install_prog $instname $destdir/$name" 'exit $?'
2232 # Maybe install the static library, too.
2233 test -n "$old_library" && staticlibs="$staticlibs $dir/$old_library"
2237 # Install (i.e. copy) a libtool object.
2239 # Figure out destination file name, if it wasn't already specified.
2240 if test -n "$destname"; then
2241 destfile="$destdir/$destname"
2243 func_basename "$file"
2244 destfile="$func_basename_result"
2245 destfile="$destdir/$destfile"
2248 # Deduce the name of the destination old-style object file.
2251 func_lo2o "$destfile"
2252 staticdest=$func_lo2o_result
2255 staticdest="$destfile"
2259 func_fatal_help "cannot copy a libtool object to \`$destfile'"
2263 # Install the libtool object if requested.
2264 test -n "$destfile" && \
2265 func_show_eval "$install_prog $file $destfile" 'exit $?'
2267 # Install the old object if enabled.
2268 if test "$build_old_libs" = yes; then
2269 # Deduce the name of the old-style object file.
2271 staticobj=$func_lo2o_result
2272 func_show_eval "$install_prog \$staticobj \$staticdest" 'exit $?'
2278 # Figure out destination file name, if it wasn't already specified.
2279 if test -n "$destname"; then
2280 destfile="$destdir/$destname"
2282 func_basename "$file"
2283 destfile="$func_basename_result"
2284 destfile="$destdir/$destfile"
2287 # If the file is missing, and there is a .exe on the end, strip it
2288 # because it is most likely a libtool script we actually want to
2293 if test ! -f "$file"; then
2294 func_stripname '' '.exe' "$file"
2295 file=$func_stripname_result
2301 # Do a test to see if this is really a libtool program.
2304 if func_ltwrapper_executable_p "$file"; then
2305 func_ltwrapper_scriptname "$file"
2306 wrapper=$func_ltwrapper_scriptname_result
2308 func_stripname '' '.exe' "$file"
2309 wrapper=$func_stripname_result
2316 if func_ltwrapper_script_p "$wrapper"; then
2320 func_source "$wrapper"
2322 # Check the variables that should have been set.
2323 test -z "$generated_by_libtool_version" && \
2324 func_fatal_error "invalid libtool wrapper script \`$wrapper'"
2327 for lib in $notinst_deplibs; do
2328 # Check to see that each library is installed.
2330 if test -f "$lib"; then
2333 libfile="$libdir/"`$ECHO "X$lib" | $Xsed -e 's%^.*/%%g'` ### testsuite: skip nested quoting test
2334 if test -n "$libdir" && test ! -f "$libfile"; then
2335 func_warning "\`$lib' has not been installed in \`$libdir'"
2341 func_source "$wrapper"
2344 if test "$fast_install" = no && test -n "$relink_command"; then
2346 if test "$finalize" = yes; then
2347 tmpdir=`func_mktempdir`
2348 func_basename "$file$stripped_ext"
2349 file="$func_basename_result"
2350 outputname="$tmpdir/$file"
2351 # Replace the output file specification.
2352 relink_command=`$ECHO "X$relink_command" | $Xsed -e 's%@OUTPUT@%'"$outputname"'%g'`
2355 func_quote_for_expand "$relink_command"
2356 eval "func_echo $func_quote_for_expand_result"
2358 if eval "$relink_command"; then :
2360 func_error "error: relink \`$file' with the above command before installing it"
2361 $opt_dry_run || ${RM}r "$tmpdir"
2366 func_warning "cannot relink \`$file'"
2370 # Install the binary that we compiled earlier.
2371 file=`$ECHO "X$file$stripped_ext" | $Xsed -e "s%\([^/]*\)$%$objdir/\1%"`
2375 # remove .exe since cygwin /usr/bin/install will append another
2377 case $install_prog,$host in
2378 */usr/bin/install*,*cygwin*)
2379 case $file:$destfile in
2384 destfile=$destfile.exe
2387 func_stripname '' '.exe' "$destfile"
2388 destfile=$func_stripname_result
2393 func_show_eval "$install_prog\$stripme \$file \$destfile" 'exit $?'
2394 $opt_dry_run || if test -n "$outputname"; then
2401 for file in $staticlibs; do
2402 func_basename "$file"
2403 name="$func_basename_result"
2405 # Set up the ranlib parameters.
2406 oldlib="$destdir/$name"
2408 func_show_eval "$install_prog \$file \$oldlib" 'exit $?'
2410 if test -n "$stripme" && test -n "$old_striplib"; then
2411 func_show_eval "$old_striplib $oldlib" 'exit $?'
2414 # Do each command in the postinstall commands.
2415 func_execute_cmds "$old_postinstall_cmds" 'exit $?'
2418 test -n "$future_libdirs" && \
2419 func_warning "remember to run \`$progname --finish$future_libdirs'"
2421 if test -n "$current_libdirs"; then
2422 # Maybe just do a dry run.
2423 $opt_dry_run && current_libdirs=" -n$current_libdirs"
2424 exec_cmd='$SHELL $progpath $preserve_args --finish$current_libdirs'
2430 test "$mode" = install && func_mode_install ${1+"$@"}
2433 # func_generate_dlsyms outputname originator pic_p
2434 # Extract symbols from dlprefiles and create ${outputname}S.o with
2435 # a dlpreopen symbol table.
2436 func_generate_dlsyms ()
2442 my_prefix=`$ECHO "$my_originator" | sed 's%[^a-zA-Z0-9]%_%g'`
2445 if test -n "$dlfiles$dlprefiles" || test "$dlself" != no; then
2446 if test -n "$NM" && test -n "$global_symbol_pipe"; then
2447 my_dlsyms="${my_outputname}S.c"
2449 func_error "not configured to extract global symbols from dlpreopened files"
2453 if test -n "$my_dlsyms"; then
2457 # Discover the nlist of each of the dlfiles.
2458 nlist="$output_objdir/${my_outputname}.nm"
2460 func_show_eval "$RM $nlist ${nlist}S ${nlist}T"
2462 # Parse the name list into a source file.
2463 func_verbose "creating $output_objdir/$my_dlsyms"
2465 $opt_dry_run || $ECHO > "$output_objdir/$my_dlsyms" "\
2466 /* $my_dlsyms - symbol resolution table for \`$my_outputname' dlsym emulation. */
2467 /* Generated by $PROGRAM (GNU $PACKAGE$TIMESTAMP) $VERSION */
2473 /* External symbol declarations for the compiler. */\
2476 if test "$dlself" = yes; then
2477 func_verbose "generating symbol list for \`$output'"
2479 $opt_dry_run || echo ': @PROGRAM@ ' > "$nlist"
2481 # Add our own program objects to the symbol list.
2482 progfiles=`$ECHO "X$objs$old_deplibs" | $SP2NL | $Xsed -e "$lo2o" | $NL2SP`
2483 for progfile in $progfiles; do
2484 func_verbose "extracting global C symbols from \`$progfile'"
2485 $opt_dry_run || eval "$NM $progfile | $global_symbol_pipe >> '$nlist'"
2488 if test -n "$exclude_expsyms"; then
2490 eval '$EGREP -v " ($exclude_expsyms)$" "$nlist" > "$nlist"T'
2491 eval '$MV "$nlist"T "$nlist"'
2495 if test -n "$export_symbols_regex"; then
2497 eval '$EGREP -e "$export_symbols_regex" "$nlist" > "$nlist"T'
2498 eval '$MV "$nlist"T "$nlist"'
2502 # Prepare the list of exported symbols
2503 if test -z "$export_symbols"; then
2504 export_symbols="$output_objdir/$outputname.exp"
2507 eval "${SED} -n -e '/^: @PROGRAM@ $/d' -e 's/^.* \(.*\)$/\1/p' "'< "$nlist" > "$export_symbols"'
2509 *cygwin* | *mingw* | *cegcc* )
2510 eval "echo EXPORTS "'> "$output_objdir/$outputname.def"'
2511 eval 'cat "$export_symbols" >> "$output_objdir/$outputname.def"'
2517 eval "${SED} -e 's/\([].[*^$]\)/\\\\\1/g' -e 's/^/ /' -e 's/$/$/'"' < "$export_symbols" > "$output_objdir/$outputname.exp"'
2518 eval '$GREP -f "$output_objdir/$outputname.exp" < "$nlist" > "$nlist"T'
2519 eval '$MV "$nlist"T "$nlist"'
2521 *cygwin | *mingw* | *cegcc* )
2522 eval "echo EXPORTS "'> "$output_objdir/$outputname.def"'
2523 eval 'cat "$nlist" >> "$output_objdir/$outputname.def"'
2530 for dlprefile in $dlprefiles; do
2531 func_verbose "extracting global C symbols from \`$dlprefile'"
2532 func_basename "$dlprefile"
2533 name="$func_basename_result"
2535 eval '$ECHO ": $name " >> "$nlist"'
2536 eval "$NM $dlprefile 2>/dev/null | $global_symbol_pipe >> '$nlist'"
2541 # Make sure we have at least an empty file.
2542 test -f "$nlist" || : > "$nlist"
2544 if test -n "$exclude_expsyms"; then
2545 $EGREP -v " ($exclude_expsyms)$" "$nlist" > "$nlist"T
2546 $MV "$nlist"T "$nlist"
2549 # Try sorting and uniquifying the output.
2550 if $GREP -v "^: " < "$nlist" |
2551 if sort -k 3 </dev/null >/dev/null 2>&1; then
2556 uniq > "$nlist"S; then
2559 $GREP -v "^: " < "$nlist" > "$nlist"S
2562 if test -f "$nlist"S; then
2563 eval "$global_symbol_to_cdecl"' < "$nlist"S >> "$output_objdir/$my_dlsyms"'
2565 $ECHO '/* NONE */' >> "$output_objdir/$my_dlsyms"
2568 $ECHO >> "$output_objdir/$my_dlsyms" "\
2570 /* The mapping between symbol names and symbols. */
2577 *cygwin* | *mingw* | *cegcc* )
2578 $ECHO >> "$output_objdir/$my_dlsyms" "\
2579 /* DATA imports from DLLs on WIN32 con't be const, because
2580 runtime relocations are performed -- see ld's documentation
2581 on pseudo-relocs. */"
2584 echo >> "$output_objdir/$my_dlsyms" "\
2585 /* This system does not cope well with relocations in const data */"
2588 lt_dlsym_const=const ;;
2591 $ECHO >> "$output_objdir/$my_dlsyms" "\
2592 extern $lt_dlsym_const lt_dlsymlist
2593 lt_${my_prefix}_LTX_preloaded_symbols[];
2594 $lt_dlsym_const lt_dlsymlist
2595 lt_${my_prefix}_LTX_preloaded_symbols[] =
2597 { \"$my_originator\", (void *) 0 },"
2599 case $need_lib_prefix in
2601 eval "$global_symbol_to_c_name_address" < "$nlist" >> "$output_objdir/$my_dlsyms"
2604 eval "$global_symbol_to_c_name_address_lib_prefix" < "$nlist" >> "$output_objdir/$my_dlsyms"
2607 $ECHO >> "$output_objdir/$my_dlsyms" "\
2611 /* This works around a problem in FreeBSD linker */
2612 #ifdef FREEBSD_WORKAROUND
2613 static const void *lt_preloaded_setup() {
2614 return lt_${my_prefix}_LTX_preloaded_symbols;
2624 pic_flag_for_symtable=
2625 case "$compile_command " in
2629 # compiling the symbol table file with pic_flag works around
2630 # a FreeBSD bug that causes programs to crash when -lm is
2631 # linked before any other PIC object. But we must not use
2632 # pic_flag when linking with -static. The problem exists in
2633 # FreeBSD 2.2.6 and is fixed in FreeBSD 3.1.
2634 *-*-freebsd2*|*-*-freebsd3.0*|*-*-freebsdelf3.0*)
2635 pic_flag_for_symtable=" $pic_flag -DFREEBSD_WORKAROUND" ;;
2637 pic_flag_for_symtable=" $pic_flag" ;;
2639 if test "X$my_pic_p" != Xno; then
2640 pic_flag_for_symtable=" $pic_flag"
2647 for arg in $LTCFLAGS; do
2649 -pie | -fpie | -fPIE) ;;
2650 *) symtab_cflags="$symtab_cflags $arg" ;;
2654 # Now compile the dynamic symbol file.
2655 func_show_eval '(cd $output_objdir && $LTCC$symtab_cflags -c$no_builtin_flag$pic_flag_for_symtable "$my_dlsyms")' 'exit $?'
2657 # Clean up the generated files.
2658 func_show_eval '$RM "$output_objdir/$my_dlsyms" "$nlist" "${nlist}S" "${nlist}T"'
2660 # Transform the symbol file into the correct name.
2661 symfileobj="$output_objdir/${my_outputname}S.$objext"
2663 *cygwin* | *mingw* | *cegcc* )
2664 if test -f "$output_objdir/$my_outputname.def"; then
2665 compile_command=`$ECHO "X$compile_command" | $Xsed -e "s%@SYMFILE@%$output_objdir/$my_outputname.def $symfileobj%"`
2666 finalize_command=`$ECHO "X$finalize_command" | $Xsed -e "s%@SYMFILE@%$output_objdir/$my_outputname.def $symfileobj%"`
2668 compile_command=`$ECHO "X$compile_command" | $Xsed -e "s%@SYMFILE@%$symfileobj%"`
2669 finalize_command=`$ECHO "X$finalize_command" | $Xsed -e "s%@SYMFILE@%$symfileobj%"`
2673 compile_command=`$ECHO "X$compile_command" | $Xsed -e "s%@SYMFILE@%$symfileobj%"`
2674 finalize_command=`$ECHO "X$finalize_command" | $Xsed -e "s%@SYMFILE@%$symfileobj%"`
2679 func_fatal_error "unknown suffix for \`$my_dlsyms'"
2683 # We keep going just in case the user didn't refer to
2684 # lt_preloaded_symbols. The linker will fail if global_symbol_pipe
2685 # really was required.
2687 # Nullify the symbol file.
2688 compile_command=`$ECHO "X$compile_command" | $Xsed -e "s% @SYMFILE@%%"`
2689 finalize_command=`$ECHO "X$finalize_command" | $Xsed -e "s% @SYMFILE@%%"`
2693 # func_win32_libid arg
2694 # return the library type of file 'arg'
2696 # Need a lot of goo to handle *both* DLLs and import libs
2697 # Has to be a shell function in order to 'eat' the argument
2698 # that is supplied when $file_magic_command is called.
2702 win32_libid_type="unknown"
2703 win32_fileres=`file -L $1 2>/dev/null`
2704 case $win32_fileres in
2705 *ar\ archive\ import\ library*) # definitely import
2706 win32_libid_type="x86 archive import"
2708 *ar\ archive*) # could be an import, or static
2709 if eval $OBJDUMP -f $1 | $SED -e '10q' 2>/dev/null |
2710 $EGREP 'file format pe-i386(.*architecture: i386)?' >/dev/null ; then
2711 win32_nmres=`eval $NM -f posix -A $1 |
2720 case $win32_nmres in
2721 import*) win32_libid_type="x86 archive import";;
2722 *) win32_libid_type="x86 archive static";;
2727 win32_libid_type="x86 DLL"
2729 *executable*) # but shell scripts are "executable" too...
2730 case $win32_fileres in
2731 *MS\ Windows\ PE\ Intel*)
2732 win32_libid_type="x86 DLL"
2737 $ECHO "$win32_libid_type"
2742 # func_extract_an_archive dir oldlib
2743 func_extract_an_archive ()
2746 f_ex_an_ar_dir="$1"; shift
2747 f_ex_an_ar_oldlib="$1"
2748 func_show_eval "(cd \$f_ex_an_ar_dir && $AR x \"\$f_ex_an_ar_oldlib\")" 'exit $?'
2749 if ($AR t "$f_ex_an_ar_oldlib" | sort | sort -uc >/dev/null 2>&1); then
2752 func_fatal_error "object name conflicts in archive: $f_ex_an_ar_dir/$f_ex_an_ar_oldlib"
2757 # func_extract_archives gentop oldlib ...
2758 func_extract_archives ()
2761 my_gentop="$1"; shift
2762 my_oldlibs=${1+"$@"}
2768 for my_xlib in $my_oldlibs; do
2769 # Extract the objects.
2771 [\\/]* | [A-Za-z]:[\\/]*) my_xabs="$my_xlib" ;;
2772 *) my_xabs=`pwd`"/$my_xlib" ;;
2774 func_basename "$my_xlib"
2775 my_xlib="$func_basename_result"
2778 case " $extracted_archives " in
2780 func_arith $extracted_serial + 1
2781 extracted_serial=$func_arith_result
2782 my_xlib_u=lt$extracted_serial-$my_xlib ;;
2786 extracted_archives="$extracted_archives $my_xlib_u"
2787 my_xdir="$my_gentop/$my_xlib_u"
2789 func_mkdir_p "$my_xdir"
2793 func_verbose "Extracting $my_xabs"
2794 # Do not bother doing anything if just a dry run
2796 darwin_orig_dir=`pwd`
2797 cd $my_xdir || exit $?
2798 darwin_archive=$my_xabs
2800 darwin_base_archive=`basename "$darwin_archive"`
2801 darwin_arches=`$LIPO -info "$darwin_archive" 2>/dev/null | $GREP Architectures 2>/dev/null || true`
2802 if test -n "$darwin_arches"; then
2803 darwin_arches=`$ECHO "$darwin_arches" | $SED -e 's/.*are://'`
2805 func_verbose "$darwin_base_archive has multiple architectures $darwin_arches"
2806 for darwin_arch in $darwin_arches ; do
2807 func_mkdir_p "unfat-$$/${darwin_base_archive}-${darwin_arch}"
2808 $LIPO -thin $darwin_arch -output "unfat-$$/${darwin_base_archive}-${darwin_arch}/${darwin_base_archive}" "${darwin_archive}"
2809 cd "unfat-$$/${darwin_base_archive}-${darwin_arch}"
2810 func_extract_an_archive "`pwd`" "${darwin_base_archive}"
2812 $RM "unfat-$$/${darwin_base_archive}-${darwin_arch}/${darwin_base_archive}"
2813 done # $darwin_arches
2814 ## Okay now we've a bunch of thin objects, gotta fatten them up :)
2815 darwin_filelist=`find unfat-$$ -type f -name \*.o -print -o -name \*.lo -print | $SED -e "$basename" | sort -u`
2818 for darwin_file in $darwin_filelist; do
2819 darwin_files=`find unfat-$$ -name $darwin_file -print | $NL2SP`
2820 $LIPO -create -output "$darwin_file" $darwin_files
2821 done # $darwin_filelist
2823 cd "$darwin_orig_dir"
2826 func_extract_an_archive "$my_xdir" "$my_xabs"
2831 func_extract_an_archive "$my_xdir" "$my_xabs"
2834 my_oldobjs="$my_oldobjs "`find $my_xdir -name \*.$objext -print -o -name \*.lo -print | $NL2SP`
2837 func_extract_archives_result="$my_oldobjs"
2842 # func_emit_wrapper_part1 [arg=no]
2844 # Emit the first part of a libtool wrapper script on stdout.
2845 # For more information, see the description associated with
2846 # func_emit_wrapper(), below.
2847 func_emit_wrapper_part1 ()
2849 func_emit_wrapper_part1_arg1=no
2850 if test -n "$1" ; then
2851 func_emit_wrapper_part1_arg1=$1
2857 # $output - temporary wrapper script for $objdir/$outputname
2858 # Generated by $PROGRAM (GNU $PACKAGE$TIMESTAMP) $VERSION
2860 # The $output program cannot be directly executed until all the libtool
2861 # libraries that it depends on are installed.
2863 # This wrapper script should never be moved out of the build directory.
2864 # If it is, it will not operate correctly.
2866 # Sed substitution that helps us do robust quoting. It backslashifies
2867 # metacharacters that are still active within double-quoted strings.
2868 Xsed='${SED} -e 1s/^X//'
2869 sed_quote_subst='$sed_quote_subst'
2871 # Be Bourne compatible
2872 if test -n \"\${ZSH_VERSION+set}\" && (emulate sh) >/dev/null 2>&1; then
2875 # Zsh 3.x and 4.x performs word splitting on \${1+\"\$@\"}, which
2876 # is contrary to our usage. Disable this feature.
2877 alias -g '\${1+\"\$@\"}'='\"\$@\"'
2878 setopt NO_GLOB_SUBST
2880 case \`(set -o) 2>/dev/null\` in *posix*) set -o posix;; esac
2882 BIN_SH=xpg4; export BIN_SH # for Tru64
2883 DUALCASE=1; export DUALCASE # for MKS sh
2885 # The HP-UX ksh and POSIX shell print the target directory to stdout
2887 (unset CDPATH) >/dev/null 2>&1 && unset CDPATH
2889 relink_command=\"$relink_command\"
2891 # This environment variable determines our operation mode.
2892 if test \"\$libtool_install_magic\" = \"$magic\"; then
2893 # install mode needs the following variables:
2894 generated_by_libtool_version='$macro_version'
2895 notinst_deplibs='$notinst_deplibs'
2897 # When we are sourced in execute mode, \$file and \$ECHO are already set.
2898 if test \"\$libtool_execute_magic\" != \"$magic\"; then
2901 # Make sure echo works.
2902 if test \"X\$1\" = X--no-reexec; then
2903 # Discard the --no-reexec flag, and continue.
2905 elif test \"X\`{ \$ECHO '\t'; } 2>/dev/null\`\" = 'X\t'; then
2906 # Yippee, \$ECHO works!
2909 # Restart under the correct shell, and then maybe \$ECHO will work.
2910 exec $SHELL \"\$0\" --no-reexec \${1+\"\$@\"}
2916 # Find the directory that this script lives in.
2917 thisdir=\`\$ECHO \"X\$file\" | \$Xsed -e 's%/[^/]*$%%'\`
2918 test \"x\$thisdir\" = \"x\$file\" && thisdir=.
2920 # Follow symbolic links until we get to the real thisdir.
2921 file=\`ls -ld \"\$file\" | ${SED} -n 's/.*-> //p'\`
2922 while test -n \"\$file\"; do
2923 destdir=\`\$ECHO \"X\$file\" | \$Xsed -e 's%/[^/]*\$%%'\`
2925 # If there was a directory component, then change thisdir.
2926 if test \"x\$destdir\" != \"x\$file\"; then
2927 case \"\$destdir\" in
2928 [\\\\/]* | [A-Za-z]:[\\\\/]*) thisdir=\"\$destdir\" ;;
2929 *) thisdir=\"\$thisdir/\$destdir\" ;;
2933 file=\`\$ECHO \"X\$file\" | \$Xsed -e 's%^.*/%%'\`
2934 file=\`ls -ld \"\$thisdir/\$file\" | ${SED} -n 's/.*-> //p'\`
2938 # end: func_emit_wrapper_part1
2940 # func_emit_wrapper_part2 [arg=no]
2942 # Emit the second part of a libtool wrapper script on stdout.
2943 # For more information, see the description associated with
2944 # func_emit_wrapper(), below.
2945 func_emit_wrapper_part2 ()
2947 func_emit_wrapper_part2_arg1=no
2948 if test -n "$1" ; then
2949 func_emit_wrapper_part2_arg1=$1
2954 # Usually 'no', except on cygwin/mingw when embedded into
2956 WRAPPER_SCRIPT_BELONGS_IN_OBJDIR=$func_emit_wrapper_part2_arg1
2957 if test \"\$WRAPPER_SCRIPT_BELONGS_IN_OBJDIR\" = \"yes\"; then
2958 # special case for '.'
2959 if test \"\$thisdir\" = \".\"; then
2962 # remove .libs from thisdir
2963 case \"\$thisdir\" in
2964 *[\\\\/]$objdir ) thisdir=\`\$ECHO \"X\$thisdir\" | \$Xsed -e 's%[\\\\/][^\\\\/]*$%%'\` ;;
2965 $objdir ) thisdir=. ;;
2969 # Try to get the absolute directory name.
2970 absdir=\`cd \"\$thisdir\" && pwd\`
2971 test -n \"\$absdir\" && thisdir=\"\$absdir\"
2974 if test "$fast_install" = yes; then
2976 program=lt-'$outputname'$exeext
2977 progdir=\"\$thisdir/$objdir\"
2979 if test ! -f \"\$progdir/\$program\" ||
2980 { file=\`ls -1dt \"\$progdir/\$program\" \"\$progdir/../\$program\" 2>/dev/null | ${SED} 1q\`; \\
2981 test \"X\$file\" != \"X\$progdir/\$program\"; }; then
2983 file=\"\$\$-\$program\"
2985 if test ! -d \"\$progdir\"; then
2986 $MKDIR \"\$progdir\"
2988 $RM \"\$progdir/\$file\"
2993 # relink executable if necessary
2994 if test -n \"\$relink_command\"; then
2995 if relink_command_output=\`eval \$relink_command 2>&1\`; then :
2997 $ECHO \"\$relink_command_output\" >&2
2998 $RM \"\$progdir/\$file\"
3003 $MV \"\$progdir/\$file\" \"\$progdir/\$program\" 2>/dev/null ||
3004 { $RM \"\$progdir/\$program\";
3005 $MV \"\$progdir/\$file\" \"\$progdir/\$program\"; }
3006 $RM \"\$progdir/\$file\"
3010 program='$outputname'
3011 progdir=\"\$thisdir/$objdir\"
3017 if test -f \"\$progdir/\$program\"; then"
3019 # Export our shlibpath_var if we have one.
3020 if test "$shlibpath_overrides_runpath" = yes && test -n "$shlibpath_var" && test -n "$temp_rpath"; then
3022 # Add our own library path to $shlibpath_var
3023 $shlibpath_var=\"$temp_rpath\$$shlibpath_var\"
3025 # Some systems cannot cope with colon-terminated $shlibpath_var
3026 # The second colon is a workaround for a bug in BeOS R4 sed
3027 $shlibpath_var=\`\$ECHO \"X\$$shlibpath_var\" | \$Xsed -e 's/::*\$//'\`
3029 export $shlibpath_var
3033 # fixup the dll searchpath if we need to.
3034 if test -n "$dllsearchpath"; then
3036 # Add the dll search path components to the executable PATH
3037 PATH=$dllsearchpath:\$PATH
3042 if test \"\$libtool_execute_magic\" != \"$magic\"; then
3043 # Run the actual program with our arguments.
3046 # Backslashes separate directories on plain windows
3047 *-*-mingw | *-*-os2* | *-cegcc*)
3049 exec \"\$progdir\\\\\$program\" \${1+\"\$@\"}
3055 exec \"\$progdir/\$program\" \${1+\"\$@\"}
3060 \$ECHO \"\$0: cannot exec \$program \$*\" 1>&2
3064 # The program doesn't exist.
3065 \$ECHO \"\$0: error: \\\`\$progdir/\$program' does not exist\" 1>&2
3066 \$ECHO \"This script is just a wrapper for \$program.\" 1>&2
3067 $ECHO \"See the $PACKAGE documentation for more information.\" 1>&2
3073 # end: func_emit_wrapper_part2
3076 # func_emit_wrapper [arg=no]
3078 # Emit a libtool wrapper script on stdout.
3079 # Don't directly open a file because we may want to
3080 # incorporate the script contents within a cygwin/mingw
3081 # wrapper executable. Must ONLY be called from within
3082 # func_mode_link because it depends on a number of variables
3085 # ARG is the value that the WRAPPER_SCRIPT_BELONGS_IN_OBJDIR
3086 # variable will take. If 'yes', then the emitted script
3087 # will assume that the directory in which it is stored is
3088 # the $objdir directory. This is a cygwin/mingw-specific
3090 func_emit_wrapper ()
3092 func_emit_wrapper_arg1=no
3093 if test -n "$1" ; then
3094 func_emit_wrapper_arg1=$1
3097 # split this up so that func_emit_cwrapperexe_src
3098 # can call each part independently.
3099 func_emit_wrapper_part1 "${func_emit_wrapper_arg1}"
3100 func_emit_wrapper_part2 "${func_emit_wrapper_arg1}"
3104 # func_to_host_path arg
3106 # Convert paths to host format when used with build tools.
3107 # Intended for use with "native" mingw (where libtool itself
3108 # is running under the msys shell), or in the following cross-
3109 # build environments:
3111 # mingw (msys) mingw [e.g. native]
3114 # where wine is equipped with the `winepath' executable.
3115 # In the native mingw case, the (msys) shell automatically
3116 # converts paths for any non-msys applications it launches,
3117 # but that facility isn't available from inside the cwrapper.
3118 # Similar accommodations are necessary for $host mingw and
3119 # $build cygwin. Calling this function does no harm for other
3120 # $host/$build combinations not listed above.
3122 # ARG is the path (on $build) that should be converted to
3123 # the proper representation for $host. The result is stored
3124 # in $func_to_host_path_result.
3125 func_to_host_path ()
3127 func_to_host_path_result="$1"
3128 if test -n "$1" ; then
3131 lt_sed_naive_backslashify='s|\\\\*|\\|g;s|/|\\|g;s|\\|\\\\|g'
3133 *mingw* ) # actually, msys
3134 # awkward: cmd appends spaces to result
3135 lt_sed_strip_trailing_spaces="s/[ ]*\$//"
3136 func_to_host_path_tmp1=`( cmd //c echo "$1" |\
3137 $SED -e "$lt_sed_strip_trailing_spaces" ) 2>/dev/null || echo ""`
3138 func_to_host_path_result=`echo "$func_to_host_path_tmp1" |\
3139 $SED -e "$lt_sed_naive_backslashify"`
3142 func_to_host_path_tmp1=`cygpath -w "$1"`
3143 func_to_host_path_result=`echo "$func_to_host_path_tmp1" |\
3144 $SED -e "$lt_sed_naive_backslashify"`
3147 # Unfortunately, winepath does not exit with a non-zero
3148 # error code, so we are forced to check the contents of
3149 # stdout. On the other hand, if the command is not
3150 # found, the shell will set an exit code of 127 and print
3151 # *an error message* to stdout. So we must check for both
3152 # error code of zero AND non-empty stdout, which explains
3153 # the odd construction:
3154 func_to_host_path_tmp1=`winepath -w "$1" 2>/dev/null`
3155 if test "$?" -eq 0 && test -n "${func_to_host_path_tmp1}"; then
3156 func_to_host_path_result=`echo "$func_to_host_path_tmp1" |\
3157 $SED -e "$lt_sed_naive_backslashify"`
3159 # Allow warning below.
3160 func_to_host_path_result=""
3164 if test -z "$func_to_host_path_result" ; then
3165 func_error "Could not determine host path corresponding to"
3167 func_error "Continuing, but uninstalled executables may not work."
3169 func_to_host_path_result="$1"
3175 # end: func_to_host_path
3177 # func_to_host_pathlist arg
3179 # Convert pathlists to host format when used with build tools.
3180 # See func_to_host_path(), above. This function supports the
3181 # following $build/$host combinations (but does no harm for
3182 # combinations not listed here):
3184 # mingw (msys) mingw [e.g. native]
3188 # Path separators are also converted from $build format to
3189 # $host format. If ARG begins or ends with a path separator
3190 # character, it is preserved (but converted to $host format)
3193 # ARG is a pathlist (on $build) that should be converted to
3194 # the proper representation on $host. The result is stored
3195 # in $func_to_host_pathlist_result.
3196 func_to_host_pathlist ()
3198 func_to_host_pathlist_result="$1"
3199 if test -n "$1" ; then
3202 lt_sed_naive_backslashify='s|\\\\*|\\|g;s|/|\\|g;s|\\|\\\\|g'
3203 # Remove leading and trailing path separator characters from
3204 # ARG. msys behavior is inconsistent here, cygpath turns them
3205 # into '.;' and ';.', and winepath ignores them completely.
3206 func_to_host_pathlist_tmp2="$1"
3207 # Once set for this call, this variable should not be
3208 # reassigned. It is used in tha fallback case.
3209 func_to_host_pathlist_tmp1=`echo "$func_to_host_pathlist_tmp2" |\
3210 $SED -e 's|^:*||' -e 's|:*$||'`
3212 *mingw* ) # Actually, msys.
3213 # Awkward: cmd appends spaces to result.
3214 lt_sed_strip_trailing_spaces="s/[ ]*\$//"
3215 func_to_host_pathlist_tmp2=`( cmd //c echo "$func_to_host_pathlist_tmp1" |\
3216 $SED -e "$lt_sed_strip_trailing_spaces" ) 2>/dev/null || echo ""`
3217 func_to_host_pathlist_result=`echo "$func_to_host_pathlist_tmp2" |\
3218 $SED -e "$lt_sed_naive_backslashify"`
3221 func_to_host_pathlist_tmp2=`cygpath -w -p "$func_to_host_pathlist_tmp1"`
3222 func_to_host_pathlist_result=`echo "$func_to_host_pathlist_tmp2" |\
3223 $SED -e "$lt_sed_naive_backslashify"`
3226 # unfortunately, winepath doesn't convert pathlists
3227 func_to_host_pathlist_result=""
3228 func_to_host_pathlist_oldIFS=$IFS
3230 for func_to_host_pathlist_f in $func_to_host_pathlist_tmp1 ; do
3231 IFS=$func_to_host_pathlist_oldIFS
3232 if test -n "$func_to_host_pathlist_f" ; then
3233 func_to_host_path "$func_to_host_pathlist_f"
3234 if test -n "$func_to_host_path_result" ; then
3235 if test -z "$func_to_host_pathlist_result" ; then
3236 func_to_host_pathlist_result="$func_to_host_path_result"
3238 func_to_host_pathlist_result="$func_to_host_pathlist_result;$func_to_host_path_result"
3244 IFS=$func_to_host_pathlist_oldIFS
3247 if test -z "$func_to_host_pathlist_result" ; then
3248 func_error "Could not determine the host path(s) corresponding to"
3250 func_error "Continuing, but uninstalled executables may not work."
3251 # Fallback. This may break if $1 contains DOS-style drive
3252 # specifications. The fix is not to complicate the expression
3253 # below, but for the user to provide a working wine installation
3254 # with winepath so that path translation in the cross-to-mingw
3255 # case works properly.
3256 lt_replace_pathsep_nix_to_dos="s|:|;|g"
3257 func_to_host_pathlist_result=`echo "$func_to_host_pathlist_tmp1" |\
3258 $SED -e "$lt_replace_pathsep_nix_to_dos"`
3260 # Now, add the leading and trailing path separators back
3262 :* ) func_to_host_pathlist_result=";$func_to_host_pathlist_result"
3266 *: ) func_to_host_pathlist_result="$func_to_host_pathlist_result;"
3273 # end: func_to_host_pathlist
3275 # func_emit_cwrapperexe_src
3276 # emit the source code for a wrapper executable on stdout
3277 # Must ONLY be called from within func_mode_link because
3278 # it depends on a number of variable set therein.
3279 func_emit_cwrapperexe_src ()
3283 /* $cwrappersource - temporary wrapper executable for $objdir/$outputname
3284 Generated by $PROGRAM (GNU $PACKAGE$TIMESTAMP) $VERSION
3286 The $output program cannot be directly executed until all the libtool
3287 libraries that it depends on are installed.
3289 This wrapper executable should never be moved out of the build directory.
3290 If it is, it will not operate correctly.
3292 Currently, it simply execs the wrapper *script* "$SHELL $output",
3293 but could eventually absorb all of the scripts functionality and
3294 exec $objdir/$outputname directly.
3301 # include <direct.h>
3302 # include <process.h>
3304 # define setmode _setmode
3306 # include <unistd.h>
3307 # include <stdint.h>
3310 # define HAVE_SETENV
3311 # ifdef __STRICT_ANSI__
3312 char *realpath (const char *, char *);
3313 int putenv (char *);
3314 int setenv (const char *, const char *, int);
3325 #include <sys/stat.h>
3327 #if defined(PATH_MAX)
3328 # define LT_PATHMAX PATH_MAX
3329 #elif defined(MAXPATHLEN)
3330 # define LT_PATHMAX MAXPATHLEN
3332 # define LT_PATHMAX 1024
3343 # define S_IXUSR _S_IEXEC
3345 # ifndef _INTPTR_T_DEFINED
3346 # define intptr_t int
3350 #ifndef DIR_SEPARATOR
3351 # define DIR_SEPARATOR '/'
3352 # define PATH_SEPARATOR ':'
3355 #if defined (_WIN32) || defined (__MSDOS__) || defined (__DJGPP__) || \
3357 # define HAVE_DOS_BASED_FILE_SYSTEM
3358 # define FOPEN_WB "wb"
3359 # ifndef DIR_SEPARATOR_2
3360 # define DIR_SEPARATOR_2 '\\'
3362 # ifndef PATH_SEPARATOR_2
3363 # define PATH_SEPARATOR_2 ';'
3367 #ifndef DIR_SEPARATOR_2
3368 # define IS_DIR_SEPARATOR(ch) ((ch) == DIR_SEPARATOR)
3369 #else /* DIR_SEPARATOR_2 */
3370 # define IS_DIR_SEPARATOR(ch) \
3371 (((ch) == DIR_SEPARATOR) || ((ch) == DIR_SEPARATOR_2))
3372 #endif /* DIR_SEPARATOR_2 */
3374 #ifndef PATH_SEPARATOR_2
3375 # define IS_PATH_SEPARATOR(ch) ((ch) == PATH_SEPARATOR)
3376 #else /* PATH_SEPARATOR_2 */
3377 # define IS_PATH_SEPARATOR(ch) ((ch) == PATH_SEPARATOR_2)
3378 #endif /* PATH_SEPARATOR_2 */
3381 # define FOPEN_WB "wb"
3385 # define FOPEN_WB "w"
3388 # define _O_BINARY 0
3391 #define XMALLOC(type, num) ((type *) xmalloc ((num) * sizeof(type)))
3392 #define XFREE(stale) do { \
3393 if (stale) { free ((void *) stale); stale = 0; } \
3396 #undef LTWRAPPER_DEBUGPRINTF
3397 #if defined DEBUGWRAPPER
3398 # define LTWRAPPER_DEBUGPRINTF(args) ltwrapper_debugprintf args
3400 ltwrapper_debugprintf (const char *fmt, ...)
3403 va_start (args, fmt);
3404 (void) vfprintf (stderr, fmt, args);
3408 # define LTWRAPPER_DEBUGPRINTF(args)
3411 const char *program_name = NULL;
3413 void *xmalloc (size_t num);
3414 char *xstrdup (const char *string);
3415 const char *base_name (const char *name);
3416 char *find_executable (const char *wrapper);
3417 char *chase_symlinks (const char *pathspec);
3418 int make_executable (const char *path);
3419 int check_executable (const char *path);
3420 char *strendzap (char *str, const char *pat);
3421 void lt_fatal (const char *message, ...);
3422 void lt_setenv (const char *name, const char *value);
3423 char *lt_extend_str (const char *orig_value, const char *add, int to_end);
3424 void lt_opt_process_env_set (const char *arg);
3425 void lt_opt_process_env_prepend (const char *arg);
3426 void lt_opt_process_env_append (const char *arg);
3427 int lt_split_name_value (const char *arg, char** name, char** value);
3428 void lt_update_exe_path (const char *name, const char *value);
3429 void lt_update_lib_path (const char *name, const char *value);
3431 static const char *script_text_part1 =
3434 func_emit_wrapper_part1 yes |
3435 $SED -e 's/\([\\"]\)/\\\1/g' \
3436 -e 's/^/ "/' -e 's/$/\\n"/'
3440 static const char *script_text_part2 =
3442 func_emit_wrapper_part2 yes |
3443 $SED -e 's/\([\\"]\)/\\\1/g' \
3444 -e 's/^/ "/' -e 's/$/\\n"/'
3448 const char * MAGIC_EXE = "$magic_exe";
3449 const char * LIB_PATH_VARNAME = "$shlibpath_var";
3452 if test "$shlibpath_overrides_runpath" = yes && test -n "$shlibpath_var" && test -n "$temp_rpath"; then
3453 func_to_host_pathlist "$temp_rpath"
3455 const char * LIB_PATH_VALUE = "$func_to_host_pathlist_result";
3459 const char * LIB_PATH_VALUE = "";
3463 if test -n "$dllsearchpath"; then
3464 func_to_host_pathlist "$dllsearchpath:"
3466 const char * EXE_PATH_VARNAME = "PATH";
3467 const char * EXE_PATH_VALUE = "$func_to_host_pathlist_result";
3471 const char * EXE_PATH_VARNAME = "";
3472 const char * EXE_PATH_VALUE = "";
3476 if test "$fast_install" = yes; then
3478 const char * TARGET_PROGRAM_NAME = "lt-$outputname"; /* hopefully, no .exe */
3482 const char * TARGET_PROGRAM_NAME = "$outputname"; /* hopefully, no .exe */
3489 #define LTWRAPPER_OPTION_PREFIX "--lt-"
3490 #define LTWRAPPER_OPTION_PREFIX_LENGTH 5
3492 static const size_t opt_prefix_len = LTWRAPPER_OPTION_PREFIX_LENGTH;
3493 static const char *ltwrapper_option_prefix = LTWRAPPER_OPTION_PREFIX;
3495 static const char *dumpscript_opt = LTWRAPPER_OPTION_PREFIX "dump-script";
3497 static const size_t env_set_opt_len = LTWRAPPER_OPTION_PREFIX_LENGTH + 7;
3498 static const char *env_set_opt = LTWRAPPER_OPTION_PREFIX "env-set";
3499 /* argument is putenv-style "foo=bar", value of foo is set to bar */
3501 static const size_t env_prepend_opt_len = LTWRAPPER_OPTION_PREFIX_LENGTH + 11;
3502 static const char *env_prepend_opt = LTWRAPPER_OPTION_PREFIX "env-prepend";
3503 /* argument is putenv-style "foo=bar", new value of foo is bar${foo} */
3505 static const size_t env_append_opt_len = LTWRAPPER_OPTION_PREFIX_LENGTH + 10;
3506 static const char *env_append_opt = LTWRAPPER_OPTION_PREFIX "env-append";
3507 /* argument is putenv-style "foo=bar", new value of foo is ${foo}bar */
3510 main (int argc, char *argv[])
3515 char *actual_cwrapper_path;
3516 char *actual_cwrapper_name;
3519 intptr_t rval = 127;
3523 program_name = (char *) xstrdup (base_name (argv[0]));
3524 LTWRAPPER_DEBUGPRINTF (("(main) argv[0] : %s\n", argv[0]));
3525 LTWRAPPER_DEBUGPRINTF (("(main) program_name : %s\n", program_name));
3527 /* very simple arg parsing; don't want to rely on getopt */
3528 for (i = 1; i < argc; i++)
3530 if (strcmp (argv[i], dumpscript_opt) == 0)
3534 *mingw* | *cygwin* )
3535 # make stdout use "unix" line endings
3536 echo " setmode(1,_O_BINARY);"
3541 printf ("%s", script_text_part1);
3542 printf ("%s", script_text_part2);
3547 newargz = XMALLOC (char *, argc + 1);
3548 tmp_pathspec = find_executable (argv[0]);
3549 if (tmp_pathspec == NULL)
3550 lt_fatal ("Couldn't find %s", argv[0]);
3551 LTWRAPPER_DEBUGPRINTF (("(main) found exe (before symlink chase) at : %s\n",
3554 actual_cwrapper_path = chase_symlinks (tmp_pathspec);
3555 LTWRAPPER_DEBUGPRINTF (("(main) found exe (after symlink chase) at : %s\n",
3556 actual_cwrapper_path));
3557 XFREE (tmp_pathspec);
3559 actual_cwrapper_name = xstrdup( base_name (actual_cwrapper_path));
3560 strendzap (actual_cwrapper_path, actual_cwrapper_name);
3562 /* wrapper name transforms */
3563 strendzap (actual_cwrapper_name, ".exe");
3564 tmp_pathspec = lt_extend_str (actual_cwrapper_name, ".exe", 1);
3565 XFREE (actual_cwrapper_name);
3566 actual_cwrapper_name = tmp_pathspec;
3569 /* target_name transforms -- use actual target program name; might have lt- prefix */
3570 target_name = xstrdup (base_name (TARGET_PROGRAM_NAME));
3571 strendzap (target_name, ".exe");
3572 tmp_pathspec = lt_extend_str (target_name, ".exe", 1);
3573 XFREE (target_name);
3574 target_name = tmp_pathspec;
3577 LTWRAPPER_DEBUGPRINTF (("(main) libtool target name: %s\n",
3583 XMALLOC (char, (strlen (actual_cwrapper_path) +
3584 strlen ("$objdir") + 1 + strlen (actual_cwrapper_name) + 1));
3585 strcpy (newargz[0], actual_cwrapper_path);
3586 strcat (newargz[0], "$objdir");
3587 strcat (newargz[0], "/");
3591 /* stop here, and copy so we don't have to do this twice */
3592 tmp_pathspec = xstrdup (newargz[0]);
3594 /* do NOT want the lt- prefix here, so use actual_cwrapper_name */
3595 strcat (newargz[0], actual_cwrapper_name);
3597 /* DO want the lt- prefix here if it exists, so use target_name */
3598 lt_argv_zero = lt_extend_str (tmp_pathspec, target_name, 1);
3599 XFREE (tmp_pathspec);
3600 tmp_pathspec = NULL;
3608 while ((p = strchr (newargz[0], '\\')) != NULL)
3612 while ((p = strchr (lt_argv_zero, '\\')) != NULL)
3622 XFREE (target_name);
3623 XFREE (actual_cwrapper_path);
3624 XFREE (actual_cwrapper_name);
3626 lt_setenv ("BIN_SH", "xpg4"); /* for Tru64 */
3627 lt_setenv ("DUALCASE", "1"); /* for MSK sh */
3628 lt_update_lib_path (LIB_PATH_VARNAME, LIB_PATH_VALUE);
3629 lt_update_exe_path (EXE_PATH_VARNAME, EXE_PATH_VALUE);
3632 for (i = 1; i < argc; i++)
3634 if (strncmp (argv[i], env_set_opt, env_set_opt_len) == 0)
3636 if (argv[i][env_set_opt_len] == '=')
3638 const char *p = argv[i] + env_set_opt_len + 1;
3639 lt_opt_process_env_set (p);
3641 else if (argv[i][env_set_opt_len] == '\0' && i + 1 < argc)
3643 lt_opt_process_env_set (argv[++i]); /* don't copy */
3646 lt_fatal ("%s missing required argument", env_set_opt);
3649 if (strncmp (argv[i], env_prepend_opt, env_prepend_opt_len) == 0)
3651 if (argv[i][env_prepend_opt_len] == '=')
3653 const char *p = argv[i] + env_prepend_opt_len + 1;
3654 lt_opt_process_env_prepend (p);
3656 else if (argv[i][env_prepend_opt_len] == '\0' && i + 1 < argc)
3658 lt_opt_process_env_prepend (argv[++i]); /* don't copy */
3661 lt_fatal ("%s missing required argument", env_prepend_opt);
3664 if (strncmp (argv[i], env_append_opt, env_append_opt_len) == 0)
3666 if (argv[i][env_append_opt_len] == '=')
3668 const char *p = argv[i] + env_append_opt_len + 1;
3669 lt_opt_process_env_append (p);
3671 else if (argv[i][env_append_opt_len] == '\0' && i + 1 < argc)
3673 lt_opt_process_env_append (argv[++i]); /* don't copy */
3676 lt_fatal ("%s missing required argument", env_append_opt);
3679 if (strncmp (argv[i], ltwrapper_option_prefix, opt_prefix_len) == 0)
3681 /* however, if there is an option in the LTWRAPPER_OPTION_PREFIX
3682 namespace, but it is not one of the ones we know about and
3683 have already dealt with, above (inluding dump-script), then
3684 report an error. Otherwise, targets might begin to believe
3685 they are allowed to use options in the LTWRAPPER_OPTION_PREFIX
3686 namespace. The first time any user complains about this, we'll
3687 need to make LTWRAPPER_OPTION_PREFIX a configure-time option
3688 or a configure.ac-settable value.
3690 lt_fatal ("Unrecognized option in %s namespace: '%s'",
3691 ltwrapper_option_prefix, argv[i]);
3694 newargz[++newargc] = xstrdup (argv[i]);
3696 newargz[++newargc] = NULL;
3698 LTWRAPPER_DEBUGPRINTF (("(main) lt_argv_zero : %s\n", (lt_argv_zero ? lt_argv_zero : "<NULL>")));
3699 for (i = 0; i < newargc; i++)
3701 LTWRAPPER_DEBUGPRINTF (("(main) newargz[%d] : %s\n", i, (newargz[i] ? newargz[i] : "<NULL>")));
3709 /* execv doesn't actually work on mingw as expected on unix */
3710 rval = _spawnv (_P_WAIT, lt_argv_zero, (const char * const *) newargz);
3713 /* failed to start process */
3714 LTWRAPPER_DEBUGPRINTF (("(main) failed to launch target \"%s\": errno = %d\n", lt_argv_zero, errno));
3722 execv (lt_argv_zero, newargz);
3723 return rval; /* =127, but avoids unused variable warning */
3732 xmalloc (size_t num)
3734 void *p = (void *) malloc (num);
3736 lt_fatal ("Memory exhausted");
3742 xstrdup (const char *string)
3744 return string ? strcpy ((char *) xmalloc (strlen (string) + 1),
3749 base_name (const char *name)
3753 #if defined (HAVE_DOS_BASED_FILE_SYSTEM)
3754 /* Skip over the disk name in MSDOS pathnames. */
3755 if (isalpha ((unsigned char) name[0]) && name[1] == ':')
3759 for (base = name; *name; name++)
3760 if (IS_DIR_SEPARATOR (*name))
3766 check_executable (const char *path)
3770 LTWRAPPER_DEBUGPRINTF (("(check_executable) : %s\n",
3771 path ? (*path ? path : "EMPTY!") : "NULL!"));
3772 if ((!path) || (!*path))
3775 if ((stat (path, &st) >= 0)
3776 && (st.st_mode & (S_IXUSR | S_IXGRP | S_IXOTH)))
3783 make_executable (const char *path)
3788 LTWRAPPER_DEBUGPRINTF (("(make_executable) : %s\n",
3789 path ? (*path ? path : "EMPTY!") : "NULL!"));
3790 if ((!path) || (!*path))
3793 if (stat (path, &st) >= 0)
3795 rval = chmod (path, st.st_mode | S_IXOTH | S_IXGRP | S_IXUSR);
3800 /* Searches for the full path of the wrapper. Returns
3801 newly allocated full path name if found, NULL otherwise
3802 Does not chase symlinks, even on platforms that support them.
3805 find_executable (const char *wrapper)
3810 /* static buffer for getcwd */
3811 char tmp[LT_PATHMAX + 1];
3815 LTWRAPPER_DEBUGPRINTF (("(find_executable) : %s\n",
3816 wrapper ? (*wrapper ? wrapper : "EMPTY!") : "NULL!"));
3818 if ((wrapper == NULL) || (*wrapper == '\0'))
3821 /* Absolute path? */
3822 #if defined (HAVE_DOS_BASED_FILE_SYSTEM)
3823 if (isalpha ((unsigned char) wrapper[0]) && wrapper[1] == ':')
3825 concat_name = xstrdup (wrapper);
3826 if (check_executable (concat_name))
3828 XFREE (concat_name);
3833 if (IS_DIR_SEPARATOR (wrapper[0]))
3835 concat_name = xstrdup (wrapper);
3836 if (check_executable (concat_name))
3838 XFREE (concat_name);
3840 #if defined (HAVE_DOS_BASED_FILE_SYSTEM)
3844 for (p = wrapper; *p; p++)
3852 /* no slashes; search PATH */
3853 const char *path = getenv ("PATH");
3856 for (p = path; *p; p = p_next)
3860 for (q = p; *q; q++)
3861 if (IS_PATH_SEPARATOR (*q))
3864 p_next = (*q == '\0' ? q : q + 1);
3867 /* empty path: current directory */
3868 if (getcwd (tmp, LT_PATHMAX) == NULL)
3869 lt_fatal ("getcwd failed");
3870 tmp_len = strlen (tmp);
3872 XMALLOC (char, tmp_len + 1 + strlen (wrapper) + 1);
3873 memcpy (concat_name, tmp, tmp_len);
3874 concat_name[tmp_len] = '/';
3875 strcpy (concat_name + tmp_len + 1, wrapper);
3880 XMALLOC (char, p_len + 1 + strlen (wrapper) + 1);
3881 memcpy (concat_name, p, p_len);
3882 concat_name[p_len] = '/';
3883 strcpy (concat_name + p_len + 1, wrapper);
3885 if (check_executable (concat_name))
3887 XFREE (concat_name);
3890 /* not found in PATH; assume curdir */
3892 /* Relative path | not found in path: prepend cwd */
3893 if (getcwd (tmp, LT_PATHMAX) == NULL)
3894 lt_fatal ("getcwd failed");
3895 tmp_len = strlen (tmp);
3896 concat_name = XMALLOC (char, tmp_len + 1 + strlen (wrapper) + 1);
3897 memcpy (concat_name, tmp, tmp_len);
3898 concat_name[tmp_len] = '/';
3899 strcpy (concat_name + tmp_len + 1, wrapper);
3901 if (check_executable (concat_name))
3903 XFREE (concat_name);
3908 chase_symlinks (const char *pathspec)
3911 return xstrdup (pathspec);
3913 char buf[LT_PATHMAX];
3915 char *tmp_pathspec = xstrdup (pathspec);
3917 int has_symlinks = 0;
3918 while (strlen (tmp_pathspec) && !has_symlinks)
3920 LTWRAPPER_DEBUGPRINTF (("checking path component for symlinks: %s\n",
3922 if (lstat (tmp_pathspec, &s) == 0)
3924 if (S_ISLNK (s.st_mode) != 0)
3930 /* search backwards for last DIR_SEPARATOR */
3931 p = tmp_pathspec + strlen (tmp_pathspec) - 1;
3932 while ((p > tmp_pathspec) && (!IS_DIR_SEPARATOR (*p)))
3934 if ((p == tmp_pathspec) && (!IS_DIR_SEPARATOR (*p)))
3936 /* no more DIR_SEPARATORS left */
3943 char *errstr = strerror (errno);
3944 lt_fatal ("Error accessing file %s (%s)", tmp_pathspec, errstr);
3947 XFREE (tmp_pathspec);
3951 return xstrdup (pathspec);
3954 tmp_pathspec = realpath (pathspec, buf);
3955 if (tmp_pathspec == 0)
3957 lt_fatal ("Could not follow symlinks for %s", pathspec);
3959 return xstrdup (tmp_pathspec);
3964 strendzap (char *str, const char *pat)
3968 assert (str != NULL);
3969 assert (pat != NULL);
3972 patlen = strlen (pat);
3976 str += len - patlen;
3977 if (strcmp (str, pat) == 0)
3984 lt_error_core (int exit_status, const char *mode,
3985 const char *message, va_list ap)
3987 fprintf (stderr, "%s: %s: ", program_name, mode);
3988 vfprintf (stderr, message, ap);
3989 fprintf (stderr, ".\n");
3991 if (exit_status >= 0)
3996 lt_fatal (const char *message, ...)
3999 va_start (ap, message);
4000 lt_error_core (EXIT_FAILURE, "FATAL", message, ap);
4005 lt_setenv (const char *name, const char *value)
4007 LTWRAPPER_DEBUGPRINTF (("(lt_setenv) setting '%s' to '%s'\n",
4008 (name ? name : "<NULL>"),
4009 (value ? value : "<NULL>")));
4012 /* always make a copy, for consistency with !HAVE_SETENV */
4013 char *str = xstrdup (value);
4014 setenv (name, str, 1);
4016 int len = strlen (name) + 1 + strlen (value) + 1;
4017 char *str = XMALLOC (char, len);
4018 sprintf (str, "%s=%s", name, value);
4019 if (putenv (str) != EXIT_SUCCESS)
4028 lt_extend_str (const char *orig_value, const char *add, int to_end)
4031 if (orig_value && *orig_value)
4033 int orig_value_len = strlen (orig_value);
4034 int add_len = strlen (add);
4035 new_value = XMALLOC (char, add_len + orig_value_len + 1);
4038 strcpy (new_value, orig_value);
4039 strcpy (new_value + orig_value_len, add);
4043 strcpy (new_value, add);
4044 strcpy (new_value + add_len, orig_value);
4049 new_value = xstrdup (add);
4055 lt_split_name_value (const char *arg, char** name, char** value)
4062 p = strchr (arg, (int)'=');
4067 *value = xstrdup (++p);
4069 len = strlen (arg) - strlen (*value);
4070 *name = XMALLOC (char, len);
4071 strncpy (*name, arg, len-1);
4072 (*name)[len - 1] = '\0';
4078 lt_opt_process_env_set (const char *arg)
4083 if (lt_split_name_value (arg, &name, &value) != 0)
4087 lt_fatal ("bad argument for %s: '%s'", env_set_opt, arg);
4090 lt_setenv (name, value);
4096 lt_opt_process_env_prepend (const char *arg)
4100 char *new_value = NULL;
4102 if (lt_split_name_value (arg, &name, &value) != 0)
4106 lt_fatal ("bad argument for %s: '%s'", env_prepend_opt, arg);
4109 new_value = lt_extend_str (getenv (name), value, 0);
4110 lt_setenv (name, new_value);
4117 lt_opt_process_env_append (const char *arg)
4121 char *new_value = NULL;
4123 if (lt_split_name_value (arg, &name, &value) != 0)
4127 lt_fatal ("bad argument for %s: '%s'", env_append_opt, arg);
4130 new_value = lt_extend_str (getenv (name), value, 1);
4131 lt_setenv (name, new_value);
4138 lt_update_exe_path (const char *name, const char *value)
4140 LTWRAPPER_DEBUGPRINTF (("(lt_update_exe_path) modifying '%s' by prepending '%s'\n",
4141 (name ? name : "<NULL>"),
4142 (value ? value : "<NULL>")));
4144 if (name && *name && value && *value)
4146 char *new_value = lt_extend_str (getenv (name), value, 0);
4147 /* some systems can't cope with a ':'-terminated path #' */
4148 int len = strlen (new_value);
4149 while (((len = strlen (new_value)) > 0) && IS_PATH_SEPARATOR (new_value[len-1]))
4151 new_value[len-1] = '\0';
4153 lt_setenv (name, new_value);
4159 lt_update_lib_path (const char *name, const char *value)
4161 LTWRAPPER_DEBUGPRINTF (("(lt_update_lib_path) modifying '%s' by prepending '%s'\n",
4162 (name ? name : "<NULL>"),
4163 (value ? value : "<NULL>")));
4165 if (name && *name && value && *value)
4167 char *new_value = lt_extend_str (getenv (name), value, 0);
4168 lt_setenv (name, new_value);
4176 # end: func_emit_cwrapperexe_src
4178 # func_mode_link arg...
4183 *-*-cygwin* | *-*-mingw* | *-*-pw32* | *-*-os2* | *-cegcc*)
4184 # It is impossible to link a dll without this setting, and
4185 # we shouldn't force the makefile maintainer to figure out
4186 # which system we are compiling for in order to pass an extra
4187 # flag for every libtool invocation.
4188 # allow_undefined=no
4190 # FIXME: Unfortunately, there are problems with the above when trying
4191 # to make a dll which has undefined symbols, in which case not
4192 # even a static library is built. For now, we need to specify
4193 # -no-undefined on the libtool link line when we can be certain
4194 # that all symbols are satisfied, otherwise we get a static library.
4201 libtool_args=$nonopt
4202 base_compile="$nonopt $@"
4203 compile_command=$nonopt
4204 finalize_command=$nonopt
4217 lib_search_path=`pwd`
4219 new_inherited_linker_flags=
4228 export_symbols_regex=
4236 precious_files_regex=
4237 prefer_static_libs=no
4250 single_module="${wl}-single_module"
4251 func_infer_tag $base_compile
4253 # We need to know -static, to get the right output filenames.
4258 test "$build_libtool_libs" != yes && \
4259 func_fatal_configuration "can not build a shared library"
4263 -all-static | -static | -static-libtool-libs)
4266 if test "$build_libtool_libs" = yes && test -z "$link_static_flag"; then
4267 func_warning "complete static linking is impossible in this configuration"
4269 if test -n "$link_static_flag"; then
4270 dlopen_self=$dlopen_self_static
4272 prefer_static_libs=yes
4275 if test -z "$pic_flag" && test -n "$link_static_flag"; then
4276 dlopen_self=$dlopen_self_static
4278 prefer_static_libs=built
4280 -static-libtool-libs)
4281 if test -z "$pic_flag" && test -n "$link_static_flag"; then
4282 dlopen_self=$dlopen_self_static
4284 prefer_static_libs=yes
4287 build_libtool_libs=no
4294 # See if our shared archives depend on static archives.
4295 test -n "$old_archive_from_new_cmds" && build_old_libs=yes
4297 # Go through the arguments, transforming them on the way.
4298 while test "$#" -gt 0; do
4301 func_quote_for_eval "$arg"
4302 qarg=$func_quote_for_eval_unquoted_result
4303 func_append libtool_args " $func_quote_for_eval_result"
4305 # If the previous option needs an argument, assign it.
4306 if test -n "$prev"; then
4309 func_append compile_command " @OUTPUT@"
4310 func_append finalize_command " @OUTPUT@"
4321 if test "$preload" = no; then
4322 # Add the symbol object into the linking commands.
4323 func_append compile_command " @SYMFILE@"
4324 func_append finalize_command " @SYMFILE@"
4328 *.la | *.lo) ;; # We handle these cases below.
4330 if test "$dlself" = no; then
4338 if test "$prev" = dlprefiles; then
4340 elif test "$prev" = dlfiles && test "$dlopen_self" != yes; then
4350 if test "$prev" = dlfiles; then
4351 dlfiles="$dlfiles $arg"
4353 dlprefiles="$dlprefiles $arg"
4361 export_symbols="$arg"
4363 || func_fatal_error "symbol file \`$arg' does not exist"
4368 export_symbols_regex="$arg"
4376 *" $qarg.ltframework "*) ;;
4377 *) deplibs="$deplibs $qarg.ltframework" # this is fixed later
4386 inst_prefix_dir="$arg"
4391 if test -f "$arg"; then
4394 for fil in `cat "$save_arg"`
4396 # moreargs="$moreargs $fil"
4398 # A libtool-controlled object.
4400 # Check to see that this really is a libtool object.
4401 if func_lalib_unsafe_p "$arg"; then
4408 if test -z "$pic_object" ||
4409 test -z "$non_pic_object" ||
4410 test "$pic_object" = none &&
4411 test "$non_pic_object" = none; then
4412 func_fatal_error "cannot find name of object for \`$arg'"
4415 # Extract subdirectory from the argument.
4416 func_dirname "$arg" "/" ""
4417 xdir="$func_dirname_result"
4419 if test "$pic_object" != none; then
4420 # Prepend the subdirectory the object is found in.
4421 pic_object="$xdir$pic_object"
4423 if test "$prev" = dlfiles; then
4424 if test "$build_libtool_libs" = yes && test "$dlopen_support" = yes; then
4425 dlfiles="$dlfiles $pic_object"
4429 # If libtool objects are unsupported, then we need to preload.
4434 # CHECK ME: I think I busted this. -Ossama
4435 if test "$prev" = dlprefiles; then
4436 # Preload the old-style object.
4437 dlprefiles="$dlprefiles $pic_object"
4442 func_append libobjs " $pic_object"
4447 if test "$non_pic_object" != none; then
4448 # Prepend the subdirectory the object is found in.
4449 non_pic_object="$xdir$non_pic_object"
4451 # A standard non-PIC object
4452 func_append non_pic_objects " $non_pic_object"
4453 if test -z "$pic_object" || test "$pic_object" = none ; then
4454 arg="$non_pic_object"
4457 # If the PIC object exists, use it instead.
4458 # $xdir was prepended to $pic_object above.
4459 non_pic_object="$pic_object"
4460 func_append non_pic_objects " $non_pic_object"
4463 # Only an error if not doing a dry-run.
4464 if $opt_dry_run; then
4465 # Extract subdirectory from the argument.
4466 func_dirname "$arg" "/" ""
4467 xdir="$func_dirname_result"
4470 pic_object=$xdir$objdir/$func_lo2o_result
4471 non_pic_object=$xdir$func_lo2o_result
4472 func_append libobjs " $pic_object"
4473 func_append non_pic_objects " $non_pic_object"
4475 func_fatal_error "\`$arg' is not a valid libtool object"
4480 func_fatal_error "link input file \`$arg' does not exist"
4487 precious_files_regex="$arg"
4497 # We need an absolute path.
4499 [\\/]* | [A-Za-z]:[\\/]*) ;;
4501 func_fatal_error "only absolute run-paths are allowed"
4504 if test "$prev" = rpath; then
4507 *) rpath="$rpath $arg" ;;
4512 *) xrpath="$xrpath $arg" ;;
4524 weak_libs="$weak_libs $arg"
4529 linker_flags="$linker_flags $qarg"
4530 compiler_flags="$compiler_flags $qarg"
4532 func_append compile_command " $qarg"
4533 func_append finalize_command " $qarg"
4537 compiler_flags="$compiler_flags $qarg"
4539 func_append compile_command " $qarg"
4540 func_append finalize_command " $qarg"
4544 linker_flags="$linker_flags $qarg"
4545 compiler_flags="$compiler_flags $wl$qarg"
4547 func_append compile_command " $wl$qarg"
4548 func_append finalize_command " $wl$qarg"
4552 eval "$prev=\"\$arg\""
4557 fi # test -n "$prev"
4563 if test -n "$link_static_flag"; then
4564 # See comment for -static flag below, for more details.
4565 func_append compile_command " $link_static_flag"
4566 func_append finalize_command " $link_static_flag"
4572 # FIXME: remove this flag sometime in the future.
4573 func_fatal_error "\`-allow-undefined' must not be used because it is the default"
4601 -export-symbols | -export-symbols-regex)
4602 if test -n "$export_symbols" || test -n "$export_symbols_regex"; then
4603 func_fatal_error "more than one -exported-symbols argument is not allowed"
4605 if test "X$arg" = "X-export-symbols"; then
4623 # The native IRIX linker understands -LANG:*, -LIST:* and -LNO:*
4624 # so, if we see these flags be careful not to treat them like -L
4626 case $with_gcc/$host in
4627 no/*-*-irix* | /*-*-irix*)
4628 func_append compile_command " $arg"
4629 func_append finalize_command " $arg"
4636 func_stripname '-L' '' "$arg"
4637 dir=$func_stripname_result
4638 if test -z "$dir"; then
4639 if test "$#" -gt 0; then
4640 func_fatal_error "require no space between \`-L' and \`$1'"
4642 func_fatal_error "need path for \`-L' option"
4645 # We need an absolute path.
4647 [\\/]* | [A-Za-z]:[\\/]*) ;;
4649 absdir=`cd "$dir" && pwd`
4650 test -z "$absdir" && \
4651 func_fatal_error "cannot determine absolute directory name of \`$dir'"
4658 deplibs="$deplibs -L$dir"
4659 lib_search_path="$lib_search_path $dir"
4663 *-*-cygwin* | *-*-mingw* | *-*-pw32* | *-*-os2* | *-cegcc*)
4664 testbindir=`$ECHO "X$dir" | $Xsed -e 's*/lib$*/bin*'`
4665 case :$dllsearchpath: in
4667 ::) dllsearchpath=$dir;;
4668 *) dllsearchpath="$dllsearchpath:$dir";;
4670 case :$dllsearchpath: in
4671 *":$testbindir:"*) ;;
4672 ::) dllsearchpath=$testbindir;;
4673 *) dllsearchpath="$dllsearchpath:$testbindir";;
4681 if test "X$arg" = "X-lc" || test "X$arg" = "X-lm"; then
4683 *-*-cygwin* | *-*-mingw* | *-*-pw32* | *-*-beos* | *-cegcc*)
4684 # These systems don't actually have a C or math library (as such)
4688 # These systems don't actually have a C library (as such)
4689 test "X$arg" = "X-lc" && continue
4691 *-*-openbsd* | *-*-freebsd* | *-*-dragonfly*)
4692 # Do not include libc due to us having libc/libc_r.
4693 test "X$arg" = "X-lc" && continue
4695 *-*-rhapsody* | *-*-darwin1.[012])
4696 # Rhapsody C and math libraries are in the System framework
4697 deplibs="$deplibs System.ltframework"
4700 *-*-sco3.2v5* | *-*-sco5v6*)
4701 # Causes problems with __ctype
4702 test "X$arg" = "X-lc" && continue
4704 *-*-sysv4.2uw2* | *-*-sysv5* | *-*-unixware* | *-*-OpenUNIX*)
4705 # Compiler inserts libc in the correct place for threads to work
4706 test "X$arg" = "X-lc" && continue
4709 elif test "X$arg" = "X-lc_r"; then
4711 *-*-openbsd* | *-*-freebsd* | *-*-dragonfly*)
4712 # Do not include libc_r directly, use -pthread flag.
4717 deplibs="$deplibs $arg"
4726 # Tru64 UNIX uses -model [arg] to determine the layout of C++
4727 # classes, name mangling, and exception handling.
4728 # Darwin uses the -arch flag to determine output architecture.
4729 -model|-arch|-isysroot)
4730 compiler_flags="$compiler_flags $arg"
4731 func_append compile_command " $arg"
4732 func_append finalize_command " $arg"
4737 -mt|-mthreads|-kthread|-Kthread|-pthread|-pthreads|--thread-safe|-threads)
4738 compiler_flags="$compiler_flags $arg"
4739 func_append compile_command " $arg"
4740 func_append finalize_command " $arg"
4741 case "$new_inherited_linker_flags " in
4743 * ) new_inherited_linker_flags="$new_inherited_linker_flags $arg" ;;
4749 single_module="${wl}-multi_module"
4760 *-*-cygwin* | *-*-mingw* | *-*-pw32* | *-*-os2* | *-*-darwin* | *-cegcc*)
4761 # The PATH hackery in wrapper scripts is required on Windows
4762 # and Darwin in order for the loader to find any dlls it needs.
4763 func_warning "\`-no-install' is ignored for $host"
4764 func_warning "assuming \`-no-fast-install' instead"
4767 *) no_install=yes ;;
4784 -precious-files-regex)
4805 func_stripname '-R' '' "$arg"
4806 dir=$func_stripname_result
4807 # We need an absolute path.
4809 [\\/]* | [A-Za-z]:[\\/]*) ;;
4811 func_fatal_error "only absolute run-paths are allowed"
4816 *) xrpath="$xrpath $dir" ;;
4822 # The effects of -shared are defined in a previous loop.
4831 -static | -static-libtool-libs)
4832 # The effects of -static are defined in a previous loop.
4833 # We used to do the same as -all-static on platforms that
4834 # didn't have a PIC flag, but the assumption that the effects
4835 # would be equivalent was wrong. It would break on at least
4836 # Digital Unix and AIX.
4862 func_stripname '-Wc,' '' "$arg"
4863 args=$func_stripname_result
4865 save_ifs="$IFS"; IFS=','
4866 for flag in $args; do
4868 func_quote_for_eval "$flag"
4869 arg="$arg $wl$func_quote_for_eval_result"
4870 compiler_flags="$compiler_flags $func_quote_for_eval_result"
4873 func_stripname ' ' '' "$arg"
4874 arg=$func_stripname_result
4878 func_stripname '-Wl,' '' "$arg"
4879 args=$func_stripname_result
4881 save_ifs="$IFS"; IFS=','
4882 for flag in $args; do
4884 func_quote_for_eval "$flag"
4885 arg="$arg $wl$func_quote_for_eval_result"
4886 compiler_flags="$compiler_flags $wl$func_quote_for_eval_result"
4887 linker_flags="$linker_flags $func_quote_for_eval_result"
4890 func_stripname ' ' '' "$arg"
4891 arg=$func_stripname_result
4911 func_quote_for_eval "$arg"
4912 arg="$func_quote_for_eval_result"
4915 # -64, -mips[0-9] enable 64-bit mode on the SGI compiler
4916 # -r[0-9][0-9]* specifies the processor on the SGI compiler
4917 # -xarch=*, -xtarget=* enable 64-bit mode on the Sun compiler
4918 # +DA*, +DD* enable 64-bit mode on the HP compiler
4919 # -q* pass through compiler args for the IBM compiler
4920 # -m*, -t[45]*, -txscale* pass through architecture-specific
4921 # compiler args for GCC
4922 # -F/path gives path to uninstalled frameworks, gcc on darwin
4923 # -p, -pg, --coverage, -fprofile-* pass through profiling flag for GCC
4924 # @file GCC response files
4925 -64|-mips[0-9]|-r[0-9][0-9]*|-xarch=*|-xtarget=*|+DA*|+DD*|-q*|-m*| \
4926 -t[45]*|-txscale*|-p|-pg|--coverage|-fprofile-*|-F*|@*)
4927 func_quote_for_eval "$arg"
4928 arg="$func_quote_for_eval_result"
4929 func_append compile_command " $arg"
4930 func_append finalize_command " $arg"
4931 compiler_flags="$compiler_flags $arg"
4935 # Some other compiler flag.
4937 func_quote_for_eval "$arg"
4938 arg="$func_quote_for_eval_result"
4942 # A standard object.
4947 # A libtool-controlled object.
4949 # Check to see that this really is a libtool object.
4950 if func_lalib_unsafe_p "$arg"; then
4957 if test -z "$pic_object" ||
4958 test -z "$non_pic_object" ||
4959 test "$pic_object" = none &&
4960 test "$non_pic_object" = none; then
4961 func_fatal_error "cannot find name of object for \`$arg'"
4964 # Extract subdirectory from the argument.
4965 func_dirname "$arg" "/" ""
4966 xdir="$func_dirname_result"
4968 if test "$pic_object" != none; then
4969 # Prepend the subdirectory the object is found in.
4970 pic_object="$xdir$pic_object"
4972 if test "$prev" = dlfiles; then
4973 if test "$build_libtool_libs" = yes && test "$dlopen_support" = yes; then
4974 dlfiles="$dlfiles $pic_object"
4978 # If libtool objects are unsupported, then we need to preload.
4983 # CHECK ME: I think I busted this. -Ossama
4984 if test "$prev" = dlprefiles; then
4985 # Preload the old-style object.
4986 dlprefiles="$dlprefiles $pic_object"
4991 func_append libobjs " $pic_object"
4996 if test "$non_pic_object" != none; then
4997 # Prepend the subdirectory the object is found in.
4998 non_pic_object="$xdir$non_pic_object"
5000 # A standard non-PIC object
5001 func_append non_pic_objects " $non_pic_object"
5002 if test -z "$pic_object" || test "$pic_object" = none ; then
5003 arg="$non_pic_object"
5006 # If the PIC object exists, use it instead.
5007 # $xdir was prepended to $pic_object above.
5008 non_pic_object="$pic_object"
5009 func_append non_pic_objects " $non_pic_object"
5012 # Only an error if not doing a dry-run.
5013 if $opt_dry_run; then
5014 # Extract subdirectory from the argument.
5015 func_dirname "$arg" "/" ""
5016 xdir="$func_dirname_result"
5019 pic_object=$xdir$objdir/$func_lo2o_result
5020 non_pic_object=$xdir$func_lo2o_result
5021 func_append libobjs " $pic_object"
5022 func_append non_pic_objects " $non_pic_object"
5024 func_fatal_error "\`$arg' is not a valid libtool object"
5031 deplibs="$deplibs $arg"
5032 old_deplibs="$old_deplibs $arg"
5037 # A libtool-controlled library.
5039 if test "$prev" = dlfiles; then
5040 # This library was specified with -dlopen.
5041 dlfiles="$dlfiles $arg"
5043 elif test "$prev" = dlprefiles; then
5044 # The library was specified with -dlpreopen.
5045 dlprefiles="$dlprefiles $arg"
5048 deplibs="$deplibs $arg"
5053 # Some other compiler argument.
5055 # Unknown arguments in both finalize_command and compile_command need
5056 # to be aesthetically quoted because they are evaled later.
5057 func_quote_for_eval "$arg"
5058 arg="$func_quote_for_eval_result"
5062 # Now actually substitute the argument into the commands.
5063 if test -n "$arg"; then
5064 func_append compile_command " $arg"
5065 func_append finalize_command " $arg"
5067 done # argument parsing loop
5069 test -n "$prev" && \
5070 func_fatal_help "the \`$prevarg' option requires an argument"
5072 if test "$export_dynamic" = yes && test -n "$export_dynamic_flag_spec"; then
5073 eval arg=\"$export_dynamic_flag_spec\"
5074 func_append compile_command " $arg"
5075 func_append finalize_command " $arg"
5079 # calculate the name of the file, without its directory
5080 func_basename "$output"
5081 outputname="$func_basename_result"
5082 libobjs_save="$libobjs"
5084 if test -n "$shlibpath_var"; then
5085 # get the directories listed in $shlibpath_var
5086 eval shlib_search_path=\`\$ECHO \"X\${$shlibpath_var}\" \| \$Xsed -e \'s/:/ /g\'\`
5090 eval sys_lib_search_path=\"$sys_lib_search_path_spec\"
5091 eval sys_lib_dlsearch_path=\"$sys_lib_dlsearch_path_spec\"
5093 func_dirname "$output" "/" ""
5094 output_objdir="$func_dirname_result$objdir"
5095 # Create the object directory.
5096 func_mkdir_p "$output_objdir"
5098 # Determine the type of output
5101 func_fatal_help "you must specify an output file"
5103 *.$libext) linkmode=oldlib ;;
5104 *.lo | *.$objext) linkmode=obj ;;
5105 *.la) linkmode=lib ;;
5106 *) linkmode=prog ;; # Anything else should be a program.
5112 # Find all interdependent deplibs by searching for libraries
5113 # that are linked more than once (e.g. -la -lb -la)
5114 for deplib in $deplibs; do
5115 if $opt_duplicate_deps ; then
5117 *" $deplib "*) specialdeplibs="$specialdeplibs $deplib" ;;
5120 libs="$libs $deplib"
5123 if test "$linkmode" = lib; then
5124 libs="$predeps $libs $compiler_lib_search_path $postdeps"
5126 # Compute libraries that are listed more than once in $predeps
5127 # $postdeps and mark them as special (i.e., whose duplicates are
5128 # not to be eliminated).
5130 if $opt_duplicate_compiler_generated_deps; then
5131 for pre_post_dep in $predeps $postdeps; do
5132 case "$pre_post_deps " in
5133 *" $pre_post_dep "*) specialdeplibs="$specialdeplibs $pre_post_deps" ;;
5135 pre_post_deps="$pre_post_deps $pre_post_dep"
5144 need_relink=no # whether we're linking any uninstalled libtool libraries
5145 notinst_deplibs= # not-installed libtool libraries
5146 notinst_path= # paths that contain not-installed libtool libraries
5150 passes="conv dlpreopen link"
5151 for file in $dlfiles $dlprefiles; do
5155 func_fatal_help "libraries can \`-dlopen' only libtool libraries: $file"
5166 passes="conv scan dlopen dlpreopen link"
5172 for pass in $passes; do
5173 # The preopen pass in lib mode reverses $deplibs; put it back here
5174 # so that -L comes before libs that need it for instance...
5175 if test "$linkmode,$pass" = "lib,link"; then
5176 ## FIXME: Find the place where the list is rebuilt in the wrong
5177 ## order, and fix it there properly
5179 for deplib in $deplibs; do
5180 tmp_deplibs="$deplib $tmp_deplibs"
5182 deplibs="$tmp_deplibs"
5185 if test "$linkmode,$pass" = "lib,link" ||
5186 test "$linkmode,$pass" = "prog,scan"; then
5190 if test "$linkmode" = prog; then
5192 dlopen) libs="$dlfiles" ;;
5193 dlpreopen) libs="$dlprefiles" ;;
5194 link) libs="$deplibs %DEPLIBS% $dependency_libs" ;;
5197 if test "$linkmode,$pass" = "lib,dlpreopen"; then
5198 # Collect and forward deplibs of preopened libtool libs
5199 for lib in $dlprefiles; do
5200 # Ignore non-libtool-libs
5203 *.la) func_source "$lib" ;;
5206 # Collect preopened libtool deplibs, except any this library
5207 # has declared as weak libs
5208 for deplib in $dependency_libs; do
5209 deplib_base=`$ECHO "X$deplib" | $Xsed -e "$basename"`
5210 case " $weak_libs " in
5211 *" $deplib_base "*) ;;
5212 *) deplibs="$deplibs $deplib" ;;
5218 if test "$pass" = dlopen; then
5219 # Collect dlpreopened libraries
5220 save_deplibs="$deplibs"
5224 for deplib in $libs; do
5228 -mt|-mthreads|-kthread|-Kthread|-pthread|-pthreads|--thread-safe|-threads)
5229 if test "$linkmode,$pass" = "prog,link"; then
5230 compile_deplibs="$deplib $compile_deplibs"
5231 finalize_deplibs="$deplib $finalize_deplibs"
5233 compiler_flags="$compiler_flags $deplib"
5234 if test "$linkmode" = lib ; then
5235 case "$new_inherited_linker_flags " in
5237 * ) new_inherited_linker_flags="$new_inherited_linker_flags $deplib" ;;
5244 if test "$linkmode" != lib && test "$linkmode" != prog; then
5245 func_warning "\`-l' is ignored for archives/objects"
5248 func_stripname '-l' '' "$deplib"
5249 name=$func_stripname_result
5250 if test "$linkmode" = lib; then
5251 searchdirs="$newlib_search_path $lib_search_path $compiler_lib_search_dirs $sys_lib_search_path $shlib_search_path"
5253 searchdirs="$newlib_search_path $lib_search_path $sys_lib_search_path $shlib_search_path"
5255 for searchdir in $searchdirs; do
5256 for search_ext in .la $std_shrext .so .a; do
5257 # Search the libtool library
5258 lib="$searchdir/lib${name}${search_ext}"
5259 if test -f "$lib"; then
5260 if test "$search_ext" = ".la"; then
5269 if test "$found" != yes; then
5270 # deplib doesn't seem to be a libtool library
5271 if test "$linkmode,$pass" = "prog,link"; then
5272 compile_deplibs="$deplib $compile_deplibs"
5273 finalize_deplibs="$deplib $finalize_deplibs"
5275 deplibs="$deplib $deplibs"
5276 test "$linkmode" = lib && newdependency_libs="$deplib $newdependency_libs"
5279 else # deplib is a libtool library
5280 # If $allow_libtool_libs_with_static_runtimes && $deplib is a stdlib,
5281 # We need to do some special things here, and not later.
5282 if test "X$allow_libtool_libs_with_static_runtimes" = "Xyes" ; then
5283 case " $predeps $postdeps " in
5285 if func_lalib_p "$lib"; then
5289 for l in $old_library $library_names; do
5292 if test "X$ll" = "X$old_library" ; then # only static version available
5294 func_dirname "$lib" "" "."
5295 ladir="$func_dirname_result"
5296 lib=$ladir/$old_library
5297 if test "$linkmode,$pass" = "prog,link"; then
5298 compile_deplibs="$deplib $compile_deplibs"
5299 finalize_deplibs="$deplib $finalize_deplibs"
5301 deplibs="$deplib $deplibs"
5302 test "$linkmode" = lib && newdependency_libs="$deplib $newdependency_libs"
5314 if test "$linkmode,$pass" = "prog,link"; then
5315 compile_deplibs="$deplib $compile_deplibs"
5316 finalize_deplibs="$deplib $finalize_deplibs"
5318 deplibs="$deplib $deplibs"
5319 if test "$linkmode" = lib ; then
5320 case "$new_inherited_linker_flags " in
5322 * ) new_inherited_linker_flags="$new_inherited_linker_flags $deplib" ;;
5331 deplibs="$deplib $deplibs"
5332 test "$pass" = conv && continue
5333 newdependency_libs="$deplib $newdependency_libs"
5334 func_stripname '-L' '' "$deplib"
5335 newlib_search_path="$newlib_search_path $func_stripname_result"
5338 if test "$pass" = conv; then
5339 deplibs="$deplib $deplibs"
5342 if test "$pass" = scan; then
5343 deplibs="$deplib $deplibs"
5345 compile_deplibs="$deplib $compile_deplibs"
5346 finalize_deplibs="$deplib $finalize_deplibs"
5348 func_stripname '-L' '' "$deplib"
5349 newlib_search_path="$newlib_search_path $func_stripname_result"
5352 func_warning "\`-L' is ignored for archives/objects"
5358 if test "$pass" = link; then
5359 func_stripname '-R' '' "$deplib"
5360 dir=$func_stripname_result
5361 # Make sure the xrpath contains only unique directories.
5364 *) xrpath="$xrpath $dir" ;;
5367 deplibs="$deplib $deplibs"
5370 *.la) lib="$deplib" ;;
5372 if test "$pass" = conv; then
5373 deplibs="$deplib $deplibs"
5378 # Linking convenience modules into shared libraries is allowed,
5379 # but linking other static libraries is non-portable.
5380 case " $dlpreconveniencelibs " in
5384 case $deplibs_check_method in
5386 set dummy $deplibs_check_method; shift
5387 match_pattern_regex=`expr "$deplibs_check_method" : "$1 \(.*\)"`
5388 if eval "\$ECHO \"X$deplib\"" 2>/dev/null | $Xsed -e 10q \
5389 | $EGREP "$match_pattern_regex" > /dev/null; then
5397 if test "$valid_a_lib" != yes; then
5399 $ECHO "*** Warning: Trying to link with static lib archive $deplib."
5400 $ECHO "*** I have the capability to make that library automatically link in when"
5401 $ECHO "*** you link to this library. But I can only do this if you have a"
5402 $ECHO "*** shared version of the library, which you do not appear to have"
5403 $ECHO "*** because the file extensions .$libext of this argument makes me believe"
5404 $ECHO "*** that it is just a static archive that I should not use here."
5407 $ECHO "*** Warning: Linking the shared library $output against the"
5408 $ECHO "*** static library $deplib is not portable!"
5409 deplibs="$deplib $deplibs"
5416 if test "$pass" != link; then
5417 deplibs="$deplib $deplibs"
5419 compile_deplibs="$deplib $compile_deplibs"
5420 finalize_deplibs="$deplib $finalize_deplibs"
5427 if test "$pass" = conv; then
5428 deplibs="$deplib $deplibs"
5429 elif test "$linkmode" = prog; then
5430 if test "$pass" = dlpreopen || test "$dlopen_support" != yes || test "$build_libtool_libs" = no; then
5431 # If there is no dlopen support or we're linking statically,
5432 # we need to preload.
5433 newdlprefiles="$newdlprefiles $deplib"
5434 compile_deplibs="$deplib $compile_deplibs"
5435 finalize_deplibs="$deplib $finalize_deplibs"
5437 newdlfiles="$newdlfiles $deplib"
5448 if test "$found" = yes || test -f "$lib"; then :
5450 func_fatal_error "cannot find the library \`$lib' or unhandled argument \`$deplib'"
5453 # Check to see that this really is a libtool archive.
5454 func_lalib_unsafe_p "$lib" \
5455 || func_fatal_error "\`$lib' is not a valid libtool archive"
5457 func_dirname "$lib" "" "."
5458 ladir="$func_dirname_result"
5466 inherited_linker_flags=
5467 # If the library was installed with an old release of libtool,
5468 # it will not redefine variables installed, or shouldnotlink
5477 # Convert "-framework foo" to "foo.ltframework"
5478 if test -n "$inherited_linker_flags"; then
5479 tmp_inherited_linker_flags=`$ECHO "X$inherited_linker_flags" | $Xsed -e 's/-framework \([^ $]*\)/\1.ltframework/g'`
5480 for tmp_inherited_linker_flag in $tmp_inherited_linker_flags; do
5481 case " $new_inherited_linker_flags " in
5482 *" $tmp_inherited_linker_flag "*) ;;
5483 *) new_inherited_linker_flags="$new_inherited_linker_flags $tmp_inherited_linker_flag";;
5487 dependency_libs=`$ECHO "X $dependency_libs" | $Xsed -e 's% \([^ $]*\).ltframework% -framework \1%g'`
5488 if test "$linkmode,$pass" = "lib,link" ||
5489 test "$linkmode,$pass" = "prog,scan" ||
5490 { test "$linkmode" != prog && test "$linkmode" != lib; }; then
5491 test -n "$dlopen" && dlfiles="$dlfiles $dlopen"
5492 test -n "$dlpreopen" && dlprefiles="$dlprefiles $dlpreopen"
5495 if test "$pass" = conv; then
5496 # Only check for convenience libraries
5497 deplibs="$lib $deplibs"
5498 if test -z "$libdir"; then
5499 if test -z "$old_library"; then
5500 func_fatal_error "cannot find name of link library for \`$lib'"
5502 # It is a libtool convenience library, so add in its objects.
5503 convenience="$convenience $ladir/$objdir/$old_library"
5504 old_convenience="$old_convenience $ladir/$objdir/$old_library"
5505 elif test "$linkmode" != prog && test "$linkmode" != lib; then
5506 func_fatal_error "\`$lib' is not a convenience library"
5509 for deplib in $dependency_libs; do
5510 deplibs="$deplib $deplibs"
5511 if $opt_duplicate_deps ; then
5512 case "$tmp_libs " in
5513 *" $deplib "*) specialdeplibs="$specialdeplibs $deplib" ;;
5516 tmp_libs="$tmp_libs $deplib"
5522 # Get the name of the library we link against.
5524 for l in $old_library $library_names; do
5527 if test -z "$linklib"; then
5528 func_fatal_error "cannot find name of link library for \`$lib'"
5531 # This library was specified with -dlopen.
5532 if test "$pass" = dlopen; then
5533 if test -z "$libdir"; then
5534 func_fatal_error "cannot -dlopen a convenience library: \`$lib'"
5536 if test -z "$dlname" ||
5537 test "$dlopen_support" != yes ||
5538 test "$build_libtool_libs" = no; then
5539 # If there is no dlname, no dlopen support or we're linking
5540 # statically, we need to preload. We also need to preload any
5541 # dependent libraries so libltdl's deplib preloader doesn't
5542 # bomb out in the load deplibs phase.
5543 dlprefiles="$dlprefiles $lib $dependency_libs"
5545 newdlfiles="$newdlfiles $lib"
5550 # We need an absolute path.
5552 [\\/]* | [A-Za-z]:[\\/]*) abs_ladir="$ladir" ;;
5554 abs_ladir=`cd "$ladir" && pwd`
5555 if test -z "$abs_ladir"; then
5556 func_warning "cannot determine absolute directory name of \`$ladir'"
5557 func_warning "passing it literally to the linker, although it might fail"
5562 func_basename "$lib"
5563 laname="$func_basename_result"
5565 # Find the relevant object directory and library name.
5566 if test "X$installed" = Xyes; then
5567 if test ! -f "$libdir/$linklib" && test -f "$abs_ladir/$linklib"; then
5568 func_warning "library \`$lib' was moved."
5576 test "X$hardcode_automatic" = Xyes && avoidtemprpath=yes
5578 if test ! -f "$ladir/$objdir/$linklib" && test -f "$abs_ladir/$linklib"; then
5581 # Remove this search path later
5582 notinst_path="$notinst_path $abs_ladir"
5584 dir="$ladir/$objdir"
5585 absdir="$abs_ladir/$objdir"
5586 # Remove this search path later
5587 notinst_path="$notinst_path $abs_ladir"
5589 fi # $installed = yes
5590 func_stripname 'lib' '.la' "$laname"
5591 name=$func_stripname_result
5593 # This library was specified with -dlpreopen.
5594 if test "$pass" = dlpreopen; then
5595 if test -z "$libdir" && test "$linkmode" = prog; then
5596 func_fatal_error "only libraries may -dlpreopen a convenience library: \`$lib'"
5598 # Prefer using a static library (so that no silly _DYNAMIC symbols
5599 # are required to link).
5600 if test -n "$old_library"; then
5601 newdlprefiles="$newdlprefiles $dir/$old_library"
5602 # Keep a list of preopened convenience libraries to check
5603 # that they are being used correctly in the link pass.
5604 test -z "$libdir" && \
5605 dlpreconveniencelibs="$dlpreconveniencelibs $dir/$old_library"
5606 # Otherwise, use the dlname, so that lt_dlopen finds it.
5607 elif test -n "$dlname"; then
5608 newdlprefiles="$newdlprefiles $dir/$dlname"
5610 newdlprefiles="$newdlprefiles $dir/$linklib"
5612 fi # $pass = dlpreopen
5614 if test -z "$libdir"; then
5615 # Link the convenience library
5616 if test "$linkmode" = lib; then
5617 deplibs="$dir/$old_library $deplibs"
5618 elif test "$linkmode,$pass" = "prog,link"; then
5619 compile_deplibs="$dir/$old_library $compile_deplibs"
5620 finalize_deplibs="$dir/$old_library $finalize_deplibs"
5622 deplibs="$lib $deplibs" # used for prog,scan pass
5628 if test "$linkmode" = prog && test "$pass" != link; then
5629 newlib_search_path="$newlib_search_path $ladir"
5630 deplibs="$lib $deplibs"
5633 if test "$link_all_deplibs" != no || test -z "$library_names" ||
5634 test "$build_libtool_libs" = no; then
5639 for deplib in $dependency_libs; do
5641 -L*) func_stripname '-L' '' "$deplib"
5642 newlib_search_path="$newlib_search_path $func_stripname_result"
5645 # Need to link against all dependency_libs?
5646 if test "$linkalldeplibs" = yes; then
5647 deplibs="$deplib $deplibs"
5649 # Need to hardcode shared library paths
5650 # or/and link against static libraries
5651 newdependency_libs="$deplib $newdependency_libs"
5653 if $opt_duplicate_deps ; then
5654 case "$tmp_libs " in
5655 *" $deplib "*) specialdeplibs="$specialdeplibs $deplib" ;;
5658 tmp_libs="$tmp_libs $deplib"
5661 fi # $linkmode = prog...
5663 if test "$linkmode,$pass" = "prog,link"; then
5664 if test -n "$library_names" &&
5665 { { test "$prefer_static_libs" = no ||
5666 test "$prefer_static_libs,$installed" = "built,yes"; } ||
5667 test -z "$old_library"; }; then
5668 # We need to hardcode the library path
5669 if test -n "$shlibpath_var" && test -z "$avoidtemprpath" ; then
5670 # Make sure the rpath contains only unique directories.
5671 case "$temp_rpath:" in
5673 *) temp_rpath="$temp_rpath$absdir:" ;;
5677 # Hardcode the library path.
5678 # Skip directories that are in the system default run-time
5680 case " $sys_lib_dlsearch_path " in
5683 case "$compile_rpath " in
5685 *) compile_rpath="$compile_rpath $absdir"
5689 case " $sys_lib_dlsearch_path " in
5692 case "$finalize_rpath " in
5694 *) finalize_rpath="$finalize_rpath $libdir"
5698 fi # $linkmode,$pass = prog,link...
5700 if test "$alldeplibs" = yes &&
5701 { test "$deplibs_check_method" = pass_all ||
5702 { test "$build_libtool_libs" = yes &&
5703 test -n "$library_names"; }; }; then
5704 # We only need to search for static libraries
5709 link_static=no # Whether the deplib will be linked statically
5710 use_static_libs=$prefer_static_libs
5711 if test "$use_static_libs" = built && test "$installed" = yes; then
5714 if test -n "$library_names" &&
5715 { test "$use_static_libs" = no || test -z "$old_library"; }; then
5717 *cygwin* | *mingw* | *cegcc*)
5718 # No point in relinking DLLs because paths are not encoded
5719 notinst_deplibs="$notinst_deplibs $lib"
5723 if test "$installed" = no; then
5724 notinst_deplibs="$notinst_deplibs $lib"
5729 # This is a shared library
5731 # Warn about portability, can't link against -module's on some
5732 # systems (darwin). Don't bleat about dlopened modules though!
5734 for dlpremoduletest in $dlprefiles; do
5735 if test "X$dlpremoduletest" = "X$lib"; then
5736 dlopenmodule="$dlpremoduletest"
5740 if test -z "$dlopenmodule" && test "$shouldnotlink" = yes && test "$pass" = link; then
5742 if test "$linkmode" = prog; then
5743 $ECHO "*** Warning: Linking the executable $output against the loadable module"
5745 $ECHO "*** Warning: Linking the shared library $output against the loadable module"
5747 $ECHO "*** $linklib is not portable!"
5749 if test "$linkmode" = lib &&
5750 test "$hardcode_into_libs" = yes; then
5751 # Hardcode the library path.
5752 # Skip directories that are in the system default run-time
5754 case " $sys_lib_dlsearch_path " in
5757 case "$compile_rpath " in
5759 *) compile_rpath="$compile_rpath $absdir"
5763 case " $sys_lib_dlsearch_path " in
5766 case "$finalize_rpath " in
5768 *) finalize_rpath="$finalize_rpath $libdir"
5774 if test -n "$old_archive_from_expsyms_cmds"; then
5775 # figure out the soname
5776 set dummy $library_names
5780 libname=`eval "\\$ECHO \"$libname_spec\""`
5781 # use dlname if we got it. it's perfectly good, no?
5782 if test -n "$dlname"; then
5784 elif test -n "$soname_spec"; then
5787 *cygwin* | mingw* | *cegcc*)
5788 func_arith $current - $age
5789 major=$func_arith_result
5793 eval soname=\"$soname_spec\"
5798 # Make a new name for the extract_expsyms_cmds to use
5800 func_basename "$soroot"
5801 soname="$func_basename_result"
5802 func_stripname 'lib' '.dll' "$soname"
5803 newlib=libimp-$func_stripname_result.a
5805 # If the library has no export list, then create one now
5806 if test -f "$output_objdir/$soname-def"; then :
5808 func_verbose "extracting exported symbol list from \`$soname'"
5809 func_execute_cmds "$extract_expsyms_cmds" 'exit $?'
5813 if test -f "$output_objdir/$newlib"; then :; else
5814 func_verbose "generating import library for \`$soname'"
5815 func_execute_cmds "$old_archive_from_expsyms_cmds" 'exit $?'
5817 # make sure the library variables are pointing to the new library
5820 fi # test -n "$old_archive_from_expsyms_cmds"
5822 if test "$linkmode" = prog || test "$mode" != relink; then
5827 case $hardcode_action in
5828 immediate | unsupported)
5829 if test "$hardcode_direct" = no; then
5832 *-*-sco3.2v5.0.[024]*) add_dir="-L$dir" ;;
5833 *-*-sysv4*uw2*) add_dir="-L$dir" ;;
5834 *-*-sysv5OpenUNIX* | *-*-sysv5UnixWare7.[01].[10]* | \
5835 *-*-unixware7*) add_dir="-L$dir" ;;
5837 # if the lib is a (non-dlopened) module then we can not
5838 # link against it, someone is ignoring the earlier warnings
5839 if /usr/bin/file -L $add 2> /dev/null |
5840 $GREP ": [^:]* bundle" >/dev/null ; then
5841 if test "X$dlopenmodule" != "X$lib"; then
5842 $ECHO "*** Warning: lib $linklib is a module, not a shared library"
5843 if test -z "$old_library" ; then
5845 $ECHO "*** And there doesn't seem to be a static archive available"
5846 $ECHO "*** The link will probably fail, sorry"
5848 add="$dir/$old_library"
5850 elif test -n "$old_library"; then
5851 add="$dir/$old_library"
5855 elif test "$hardcode_minus_L" = no; then
5857 *-*-sunos*) add_shlibpath="$dir" ;;
5861 elif test "$hardcode_shlibpath_var" = no; then
5862 add_shlibpath="$dir"
5869 if test "$hardcode_direct" = yes &&
5870 test "$hardcode_direct_absolute" = no; then
5872 elif test "$hardcode_minus_L" = yes; then
5874 # Try looking first in the location we're being installed to.
5875 if test -n "$inst_prefix_dir"; then
5878 add_dir="$add_dir -L$inst_prefix_dir$libdir"
5883 elif test "$hardcode_shlibpath_var" = yes; then
5884 add_shlibpath="$dir"
5893 if test "$lib_linked" != yes; then
5894 func_fatal_configuration "unsupported hardcode properties"
5897 if test -n "$add_shlibpath"; then
5898 case :$compile_shlibpath: in
5899 *":$add_shlibpath:"*) ;;
5900 *) compile_shlibpath="$compile_shlibpath$add_shlibpath:" ;;
5903 if test "$linkmode" = prog; then
5904 test -n "$add_dir" && compile_deplibs="$add_dir $compile_deplibs"
5905 test -n "$add" && compile_deplibs="$add $compile_deplibs"
5907 test -n "$add_dir" && deplibs="$add_dir $deplibs"
5908 test -n "$add" && deplibs="$add $deplibs"
5909 if test "$hardcode_direct" != yes &&
5910 test "$hardcode_minus_L" != yes &&
5911 test "$hardcode_shlibpath_var" = yes; then
5912 case :$finalize_shlibpath: in
5914 *) finalize_shlibpath="$finalize_shlibpath$libdir:" ;;
5920 if test "$linkmode" = prog || test "$mode" = relink; then
5924 # Finalize command for both is simple: just hardcode it.
5925 if test "$hardcode_direct" = yes &&
5926 test "$hardcode_direct_absolute" = no; then
5927 add="$libdir/$linklib"
5928 elif test "$hardcode_minus_L" = yes; then
5931 elif test "$hardcode_shlibpath_var" = yes; then
5932 case :$finalize_shlibpath: in
5934 *) finalize_shlibpath="$finalize_shlibpath$libdir:" ;;
5937 elif test "$hardcode_automatic" = yes; then
5938 if test -n "$inst_prefix_dir" &&
5939 test -f "$inst_prefix_dir$libdir/$linklib" ; then
5940 add="$inst_prefix_dir$libdir/$linklib"
5942 add="$libdir/$linklib"
5945 # We cannot seem to hardcode it, guess we'll fake it.
5947 # Try looking first in the location we're being installed to.
5948 if test -n "$inst_prefix_dir"; then
5951 add_dir="$add_dir -L$inst_prefix_dir$libdir"
5958 if test "$linkmode" = prog; then
5959 test -n "$add_dir" && finalize_deplibs="$add_dir $finalize_deplibs"
5960 test -n "$add" && finalize_deplibs="$add $finalize_deplibs"
5962 test -n "$add_dir" && deplibs="$add_dir $deplibs"
5963 test -n "$add" && deplibs="$add $deplibs"
5966 elif test "$linkmode" = prog; then
5967 # Here we assume that one of hardcode_direct or hardcode_minus_L
5968 # is not unsupported. This is valid on all known static and
5970 if test "$hardcode_direct" != unsupported; then
5971 test -n "$old_library" && linklib="$old_library"
5972 compile_deplibs="$dir/$linklib $compile_deplibs"
5973 finalize_deplibs="$dir/$linklib $finalize_deplibs"
5975 compile_deplibs="-l$name -L$dir $compile_deplibs"
5976 finalize_deplibs="-l$name -L$dir $finalize_deplibs"
5978 elif test "$build_libtool_libs" = yes; then
5979 # Not a shared library
5980 if test "$deplibs_check_method" != pass_all; then
5981 # We're trying link a shared library against a static one
5982 # but the system doesn't support it.
5984 # Just print a warning and add the library to dependency_libs so
5985 # that the program can be linked against the static library.
5987 $ECHO "*** Warning: This system can not link to static lib archive $lib."
5988 $ECHO "*** I have the capability to make that library automatically link in when"
5989 $ECHO "*** you link to this library. But I can only do this if you have a"
5990 $ECHO "*** shared version of the library, which you do not appear to have."
5991 if test "$module" = yes; then
5992 $ECHO "*** But as you try to build a module library, libtool will still create "
5993 $ECHO "*** a static module, that should work as long as the dlopening application"
5994 $ECHO "*** is linked with the -dlopen flag to resolve symbols at runtime."
5995 if test -z "$global_symbol_pipe"; then
5997 $ECHO "*** However, this would only work if libtool was able to extract symbol"
5998 $ECHO "*** lists from a program, using \`nm' or equivalent, but libtool could"
5999 $ECHO "*** not find such a program. So, this module is probably useless."
6000 $ECHO "*** \`nm' from GNU binutils and a full rebuild may help."
6002 if test "$build_old_libs" = no; then
6003 build_libtool_libs=module
6006 build_libtool_libs=no
6010 deplibs="$dir/$old_library $deplibs"
6013 fi # link shared/static library?
6015 if test "$linkmode" = lib; then
6016 if test -n "$dependency_libs" &&
6017 { test "$hardcode_into_libs" != yes ||
6018 test "$build_old_libs" = yes ||
6019 test "$link_static" = yes; }; then
6020 # Extract -R from dependency_libs
6022 for libdir in $dependency_libs; do
6024 -R*) func_stripname '-R' '' "$libdir"
6025 temp_xrpath=$func_stripname_result
6027 *" $temp_xrpath "*) ;;
6028 *) xrpath="$xrpath $temp_xrpath";;
6030 *) temp_deplibs="$temp_deplibs $libdir";;
6033 dependency_libs="$temp_deplibs"
6036 newlib_search_path="$newlib_search_path $absdir"
6037 # Link against this library
6038 test "$link_static" = no && newdependency_libs="$abs_ladir/$laname $newdependency_libs"
6039 # ... and its dependency_libs
6041 for deplib in $dependency_libs; do
6042 newdependency_libs="$deplib $newdependency_libs"
6043 if $opt_duplicate_deps ; then
6044 case "$tmp_libs " in
6045 *" $deplib "*) specialdeplibs="$specialdeplibs $deplib" ;;
6048 tmp_libs="$tmp_libs $deplib"
6051 if test "$link_all_deplibs" != no; then
6052 # Add the search paths of all dependency libraries
6053 for deplib in $dependency_libs; do
6055 -L*) path="$deplib" ;;
6057 func_dirname "$deplib" "" "."
6058 dir="$func_dirname_result"
6059 # We need an absolute path.
6061 [\\/]* | [A-Za-z]:[\\/]*) absdir="$dir" ;;
6063 absdir=`cd "$dir" && pwd`
6064 if test -z "$absdir"; then
6065 func_warning "cannot determine absolute directory name of \`$dir'"
6070 if $GREP "^installed=no" $deplib > /dev/null; then
6074 eval deplibrary_names=`${SED} -n -e 's/^library_names=\(.*\)$/\1/p' $deplib`
6075 if test -n "$deplibrary_names" ; then
6076 for tmp in $deplibrary_names ; do
6079 if test -f "$absdir/$objdir/$depdepl" ; then
6080 depdepl="$absdir/$objdir/$depdepl"
6081 darwin_install_name=`${OTOOL} -L $depdepl | awk '{if (NR == 2) {print $1;exit}}'`
6082 if test -z "$darwin_install_name"; then
6083 darwin_install_name=`${OTOOL64} -L $depdepl | awk '{if (NR == 2) {print $1;exit}}'`
6085 compiler_flags="$compiler_flags ${wl}-dylib_file ${wl}${darwin_install_name}:${depdepl}"
6086 linker_flags="$linker_flags -dylib_file ${darwin_install_name}:${depdepl}"
6092 path="-L$absdir/$objdir"
6096 eval libdir=`${SED} -n -e 's/^libdir=\(.*\)$/\1/p' $deplib`
6097 test -z "$libdir" && \
6098 func_fatal_error "\`$deplib' is not a valid libtool archive"
6099 test "$absdir" != "$libdir" && \
6100 func_warning "\`$deplib' seems to be moved"
6106 case " $deplibs " in
6108 *) deplibs="$path $deplibs" ;;
6111 fi # link_all_deplibs != no
6113 done # for deplib in $libs
6114 if test "$pass" = link; then
6115 if test "$linkmode" = "prog"; then
6116 compile_deplibs="$new_inherited_linker_flags $compile_deplibs"
6117 finalize_deplibs="$new_inherited_linker_flags $finalize_deplibs"
6119 compiler_flags="$compiler_flags "`$ECHO "X $new_inherited_linker_flags" | $Xsed -e 's% \([^ $]*\).ltframework% -framework \1%g'`
6122 dependency_libs="$newdependency_libs"
6123 if test "$pass" = dlpreopen; then
6124 # Link the dlpreopened libraries before other libraries
6125 for deplib in $save_deplibs; do
6126 deplibs="$deplib $deplibs"
6129 if test "$pass" != dlopen; then
6130 if test "$pass" != conv; then
6131 # Make sure lib_search_path contains only unique directories.
6133 for dir in $newlib_search_path; do
6134 case "$lib_search_path " in
6136 *) lib_search_path="$lib_search_path $dir" ;;
6142 if test "$linkmode,$pass" != "prog,link"; then
6145 vars="compile_deplibs finalize_deplibs"
6147 for var in $vars dependency_libs; do
6148 # Add libraries to $var in reverse order
6149 eval tmp_libs=\"\$$var\"
6151 for deplib in $tmp_libs; do
6152 # FIXME: Pedantically, this is the right thing to do, so
6153 # that some nasty dependency loop isn't accidentally
6155 #new_libs="$deplib $new_libs"
6156 # Pragmatically, this seems to cause very few problems in
6159 -L*) new_libs="$deplib $new_libs" ;;
6162 # And here is the reason: when a library appears more
6163 # than once as an explicit dependence of a library, or
6164 # is implicitly linked in more than once by the
6165 # compiler, it is considered special, and multiple
6166 # occurrences thereof are not removed. Compare this
6167 # with having the same library being listed as a
6168 # dependency of multiple other libraries: in this case,
6169 # we know (pedantically, we assume) the library does not
6170 # need to be listed more than once, so we keep only the
6171 # last copy. This is not always right, but it is rare
6172 # enough that we require users that really mean to play
6173 # such unportable linking tricks to link the library
6174 # using -Wl,-lname, so that libtool does not consider it
6175 # for duplicate removal.
6176 case " $specialdeplibs " in
6177 *" $deplib "*) new_libs="$deplib $new_libs" ;;
6179 case " $new_libs " in
6181 *) new_libs="$deplib $new_libs" ;;
6189 for deplib in $new_libs; do
6192 case " $tmp_libs " in
6194 *) tmp_libs="$tmp_libs $deplib" ;;
6197 *) tmp_libs="$tmp_libs $deplib" ;;
6200 eval $var=\"$tmp_libs\"
6203 # Last step: remove runtime libs from dependency_libs
6204 # (they stay in deplibs)
6206 for i in $dependency_libs ; do
6207 case " $predeps $postdeps $compiler_lib_search_path " in
6212 if test -n "$i" ; then
6213 tmp_libs="$tmp_libs $i"
6216 dependency_libs=$tmp_libs
6218 if test "$linkmode" = prog; then
6219 dlfiles="$newdlfiles"
6221 if test "$linkmode" = prog || test "$linkmode" = lib; then
6222 dlprefiles="$newdlprefiles"
6227 if test -n "$dlfiles$dlprefiles" || test "$dlself" != no; then
6228 func_warning "\`-dlopen' is ignored for archives"
6233 func_warning "\`-l' and \`-L' are ignored for archives" ;;
6236 test -n "$rpath" && \
6237 func_warning "\`-rpath' is ignored for archives"
6239 test -n "$xrpath" && \
6240 func_warning "\`-R' is ignored for archives"
6242 test -n "$vinfo" && \
6243 func_warning "\`-version-info/-version-number' is ignored for archives"
6245 test -n "$release" && \
6246 func_warning "\`-release' is ignored for archives"
6248 test -n "$export_symbols$export_symbols_regex" && \
6249 func_warning "\`-export-symbols' is ignored for archives"
6251 # Now set the variables for building old libraries.
6252 build_libtool_libs=no
6254 objs="$objs$old_deplibs"
6258 # Make sure we only generate libraries of the form `libNAME.la'.
6261 func_stripname 'lib' '.la' "$outputname"
6262 name=$func_stripname_result
6263 eval shared_ext=\"$shrext_cmds\"
6264 eval libname=\"$libname_spec\"
6267 test "$module" = no && \
6268 func_fatal_help "libtool library \`$output' must begin with \`lib'"
6270 if test "$need_lib_prefix" != no; then
6271 # Add the "lib" prefix for modules if required
6272 func_stripname '' '.la' "$outputname"
6273 name=$func_stripname_result
6274 eval shared_ext=\"$shrext_cmds\"
6275 eval libname=\"$libname_spec\"
6277 func_stripname '' '.la' "$outputname"
6278 libname=$func_stripname_result
6283 if test -n "$objs"; then
6284 if test "$deplibs_check_method" != pass_all; then
6285 func_fatal_error "cannot build libtool library \`$output' from non-libtool objects on this host:$objs"
6288 $ECHO "*** Warning: Linking the shared library $output against the non-libtool"
6289 $ECHO "*** objects $objs is not portable!"
6290 libobjs="$libobjs $objs"
6294 test "$dlself" != no && \
6295 func_warning "\`-dlopen self' is ignored for libtool libraries"
6299 test "$#" -gt 1 && \
6300 func_warning "ignoring multiple \`-rpath's for a libtool library"
6305 if test -z "$rpath"; then
6306 if test "$build_libtool_libs" = yes; then
6307 # Building a libtool convenience library.
6308 # Some compilers have problems with a `.al' extension so
6309 # convenience libraries should have the same extension an
6310 # archive normally would.
6311 oldlibs="$output_objdir/$libname.$libext $oldlibs"
6312 build_libtool_libs=convenience
6316 test -n "$vinfo" && \
6317 func_warning "\`-version-info/-version-number' is ignored for convenience libraries"
6319 test -n "$release" && \
6320 func_warning "\`-release' is ignored for convenience libraries"
6323 # Parse the version information argument.
6324 save_ifs="$IFS"; IFS=':'
6325 set dummy $vinfo 0 0 0
6330 func_fatal_help "too many parameters to \`-version-info'"
6332 # convert absolute version numbers to libtool ages
6333 # this retains compatibility with .la files and attempts
6334 # to make the code below a bit more comprehensible
6336 case $vinfo_number in
6340 number_revision="$3"
6342 # There are really only two kinds -- those that
6343 # use the current revision as the major version
6344 # and those that subtract age and use age as
6345 # a minor version. But, then there is irix
6346 # which has an extra 1 added just for fun
6348 case $version_type in
6349 darwin|linux|osf|windows|none)
6350 func_arith $number_major + $number_minor
6351 current=$func_arith_result
6353 revision="$number_revision"
6355 freebsd-aout|freebsd-elf|sunos)
6356 current="$number_major"
6357 revision="$number_minor"
6361 func_arith $number_major + $number_minor
6362 current=$func_arith_result
6364 revision="$number_minor"
6365 lt_irix_increment=no
6376 # Check that each of the things are valid numbers.
6378 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]) ;;
6380 func_error "CURRENT \`$current' must be a nonnegative integer"
6381 func_fatal_error "\`$vinfo' is not valid version information"
6386 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]) ;;
6388 func_error "REVISION \`$revision' must be a nonnegative integer"
6389 func_fatal_error "\`$vinfo' is not valid version information"
6394 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]) ;;
6396 func_error "AGE \`$age' must be a nonnegative integer"
6397 func_fatal_error "\`$vinfo' is not valid version information"
6401 if test "$age" -gt "$current"; then
6402 func_error "AGE \`$age' is greater than the current interface number \`$current'"
6403 func_fatal_error "\`$vinfo' is not valid version information"
6406 # Calculate the version variables.
6410 case $version_type in
6414 # Like Linux, but with the current version available in
6415 # verstring for coding it into the library header
6416 func_arith $current - $age
6417 major=.$func_arith_result
6418 versuffix="$major.$age.$revision"
6419 # Darwin ld doesn't like 0 for these options...
6420 func_arith $current + 1
6421 minor_current=$func_arith_result
6422 xlcverstring="${wl}-compatibility_version ${wl}$minor_current ${wl}-current_version ${wl}$minor_current.$revision"
6423 verstring="-compatibility_version $minor_current -current_version $minor_current.$revision"
6428 versuffix=".$current.$revision";
6433 versuffix=".$current"
6437 if test "X$lt_irix_increment" = "Xno"; then
6438 func_arith $current - $age
6440 func_arith $current - $age + 1
6442 major=$func_arith_result
6444 case $version_type in
6445 nonstopux) verstring_prefix=nonstopux ;;
6446 *) verstring_prefix=sgi ;;
6448 verstring="$verstring_prefix$major.$revision"
6450 # Add in all the interfaces that we are compatible with.
6452 while test "$loop" -ne 0; do
6453 func_arith $revision - $loop
6454 iface=$func_arith_result
6455 func_arith $loop - 1
6456 loop=$func_arith_result
6457 verstring="$verstring_prefix$major.$iface:$verstring"
6460 # Before this point, $major must not contain `.'.
6462 versuffix="$major.$revision"
6466 func_arith $current - $age
6467 major=.$func_arith_result
6468 versuffix="$major.$age.$revision"
6472 func_arith $current - $age
6473 major=.$func_arith_result
6474 versuffix=".$current.$age.$revision"
6475 verstring="$current.$age.$revision"
6477 # Add in all the interfaces that we are compatible with.
6479 while test "$loop" -ne 0; do
6480 func_arith $current - $loop
6481 iface=$func_arith_result
6482 func_arith $loop - 1
6483 loop=$func_arith_result
6484 verstring="$verstring:${iface}.0"
6487 # Make executables depend on our current version.
6488 verstring="$verstring:${current}.0"
6493 versuffix=".$current"
6498 versuffix=".$current.$revision"
6502 # Use '-' rather than '.', since we only want one
6503 # extension on DOS 8.3 filesystems.
6504 func_arith $current - $age
6505 major=$func_arith_result
6510 func_fatal_configuration "unknown library version type \`$version_type'"
6514 # Clear the version info if we defaulted, and they specified a release.
6515 if test -z "$vinfo" && test -n "$release"; then
6517 case $version_type in
6519 # we can't check for "0.0" in archive_cmds due to quoting
6520 # problems, so we reset it completely
6527 if test "$need_version" = no; then
6534 # Remove version info from name if versioning should be avoided
6535 if test "$avoid_version" = yes && test "$need_version" = no; then
6541 # Check to see if the archive will have undefined symbols.
6542 if test "$allow_undefined" = yes; then
6543 if test "$allow_undefined_flag" = unsupported; then
6544 func_warning "undefined symbols not allowed in $host shared libraries"
6545 build_libtool_libs=no
6549 # Don't allow undefined symbols.
6550 allow_undefined_flag="$no_undefined_flag"
6555 func_generate_dlsyms "$libname" "$libname" "yes"
6556 libobjs="$libobjs $symfileobj"
6557 test "X$libobjs" = "X " && libobjs=
6559 if test "$mode" != relink; then
6560 # Remove our outputs, but don't remove object files since they
6561 # may have been created when compiling PIC objects.
6563 tempremovelist=`$ECHO "$output_objdir/*"`
6564 for p in $tempremovelist; do
6568 $output_objdir/$outputname | $output_objdir/$libname.* | $output_objdir/${libname}${release}.*)
6569 if test "X$precious_files_regex" != "X"; then
6570 if $ECHO "$p" | $EGREP -e "$precious_files_regex" >/dev/null 2>&1
6575 removelist="$removelist $p"
6580 test -n "$removelist" && \
6581 func_show_eval "${RM}r \$removelist"
6584 # Now set the variables for building old libraries.
6585 if test "$build_old_libs" = yes && test "$build_libtool_libs" != convenience ; then
6586 oldlibs="$oldlibs $output_objdir/$libname.$libext"
6588 # Transform .lo files to .o files.
6589 oldobjs="$objs "`$ECHO "X$libobjs" | $SP2NL | $Xsed -e '/\.'${libext}'$/d' -e "$lo2o" | $NL2SP`
6592 # Eliminate all temporary directories.
6593 #for path in $notinst_path; do
6594 # lib_search_path=`$ECHO "X$lib_search_path " | $Xsed -e "s% $path % %g"`
6595 # deplibs=`$ECHO "X$deplibs " | $Xsed -e "s% -L$path % %g"`
6596 # dependency_libs=`$ECHO "X$dependency_libs " | $Xsed -e "s% -L$path % %g"`
6599 if test -n "$xrpath"; then
6600 # If the user specified any rpath flags, then add them.
6602 for libdir in $xrpath; do
6603 temp_xrpath="$temp_xrpath -R$libdir"
6604 case "$finalize_rpath " in
6606 *) finalize_rpath="$finalize_rpath $libdir" ;;
6609 if test "$hardcode_into_libs" != yes || test "$build_old_libs" = yes; then
6610 dependency_libs="$temp_xrpath $dependency_libs"
6614 # Make sure dlfiles contains only unique files that won't be dlpreopened
6615 old_dlfiles="$dlfiles"
6617 for lib in $old_dlfiles; do
6618 case " $dlprefiles $dlfiles " in
6620 *) dlfiles="$dlfiles $lib" ;;
6624 # Make sure dlprefiles contains only unique files
6625 old_dlprefiles="$dlprefiles"
6627 for lib in $old_dlprefiles; do
6628 case "$dlprefiles " in
6630 *) dlprefiles="$dlprefiles $lib" ;;
6634 if test "$build_libtool_libs" = yes; then
6635 if test -n "$rpath"; then
6637 *-*-cygwin* | *-*-mingw* | *-*-pw32* | *-*-os2* | *-*-beos* | *-cegcc*)
6638 # these systems don't actually have a c library (as such)!
6640 *-*-rhapsody* | *-*-darwin1.[012])
6641 # Rhapsody C library is in the System framework
6642 deplibs="$deplibs System.ltframework"
6645 # Don't link with libc until the a.out ld.so is fixed.
6647 *-*-openbsd* | *-*-freebsd* | *-*-dragonfly*)
6648 # Do not include libc due to us having libc/libc_r.
6650 *-*-sco3.2v5* | *-*-sco5v6*)
6651 # Causes problems with __ctype
6653 *-*-sysv4.2uw2* | *-*-sysv5* | *-*-unixware* | *-*-OpenUNIX*)
6654 # Compiler inserts libc in the correct place for threads to work
6657 # Add libc to deplibs on all other systems if necessary.
6658 if test "$build_libtool_need_lc" = "yes"; then
6659 deplibs="$deplibs -lc"
6665 # Transform deplibs into only deplibs that can be linked in shared.
6667 libname_save=$libname
6668 release_save=$release
6669 versuffix_save=$versuffix
6671 # I'm not sure if I'm treating the release correctly. I think
6672 # release should show up in the -l (ie -lgmp5) so we don't want to
6673 # add it in twice. Is that correct?
6679 case $deplibs_check_method in
6681 # Don't check for shared/static. Everything works.
6682 # This might be a little naive. We might want to check
6683 # whether the library exists or not. But this is on
6684 # osf3 & osf4 and I'm not really sure... Just
6685 # implementing what was already the behavior.
6689 # This code stresses the "libraries are programs" paradigm to its
6690 # limits. Maybe even breaks it. We compile a program, linking it
6691 # against the deplibs as a proxy for the library. Then we can check
6692 # whether they linked in statically or dynamically with ldd.
6693 $opt_dry_run || $RM conftest.c
6694 cat > conftest.c <<EOF
6695 int main() { return 0; }
6697 $opt_dry_run || $RM conftest
6698 if $LTCC $LTCFLAGS -o conftest conftest.c $deplibs; then
6699 ldd_output=`ldd conftest`
6700 for i in $deplibs; do
6703 func_stripname -l '' "$i"
6704 name=$func_stripname_result
6705 if test "X$allow_libtool_libs_with_static_runtimes" = "Xyes" ; then
6706 case " $predeps $postdeps " in
6708 newdeplibs="$newdeplibs $i"
6713 if test -n "$i" ; then
6714 libname=`eval "\\$ECHO \"$libname_spec\""`
6715 deplib_matches=`eval "\\$ECHO \"$library_names_spec\""`
6716 set dummy $deplib_matches; shift
6718 if test `expr "$ldd_output" : ".*$deplib_match"` -ne 0 ; then
6719 newdeplibs="$newdeplibs $i"
6723 $ECHO "*** Warning: dynamic linker does not accept needed library $i."
6724 $ECHO "*** I have the capability to make that library automatically link in when"
6725 $ECHO "*** you link to this library. But I can only do this if you have a"
6726 $ECHO "*** shared version of the library, which I believe you do not have"
6727 $ECHO "*** because a test_compile did reveal that the linker did not use it for"
6728 $ECHO "*** its dynamic dependency list that programs get resolved with at runtime."
6733 newdeplibs="$newdeplibs $i"
6738 # Error occurred in the first compile. Let's try to salvage
6739 # the situation: Compile a separate program for each library.
6740 for i in $deplibs; do
6743 func_stripname -l '' "$i"
6744 name=$func_stripname_result
6745 $opt_dry_run || $RM conftest
6746 if $LTCC $LTCFLAGS -o conftest conftest.c $i; then
6747 ldd_output=`ldd conftest`
6748 if test "X$allow_libtool_libs_with_static_runtimes" = "Xyes" ; then
6749 case " $predeps $postdeps " in
6751 newdeplibs="$newdeplibs $i"
6756 if test -n "$i" ; then
6757 libname=`eval "\\$ECHO \"$libname_spec\""`
6758 deplib_matches=`eval "\\$ECHO \"$library_names_spec\""`
6759 set dummy $deplib_matches; shift
6761 if test `expr "$ldd_output" : ".*$deplib_match"` -ne 0 ; then
6762 newdeplibs="$newdeplibs $i"
6766 $ECHO "*** Warning: dynamic linker does not accept needed library $i."
6767 $ECHO "*** I have the capability to make that library automatically link in when"
6768 $ECHO "*** you link to this library. But I can only do this if you have a"
6769 $ECHO "*** shared version of the library, which you do not appear to have"
6770 $ECHO "*** because a test_compile did reveal that the linker did not use this one"
6771 $ECHO "*** as a dynamic dependency that programs can get resolved with at runtime."
6777 $ECHO "*** Warning! Library $i is needed by this library but I was not able to"
6778 $ECHO "*** make it link in! You will probably need to install it or some"
6779 $ECHO "*** library that it depends on before this library will be fully"
6780 $ECHO "*** functional. Installing it before continuing would be even better."
6784 newdeplibs="$newdeplibs $i"
6791 set dummy $deplibs_check_method; shift
6792 file_magic_regex=`expr "$deplibs_check_method" : "$1 \(.*\)"`
6793 for a_deplib in $deplibs; do
6796 func_stripname -l '' "$a_deplib"
6797 name=$func_stripname_result
6798 if test "X$allow_libtool_libs_with_static_runtimes" = "Xyes" ; then
6799 case " $predeps $postdeps " in
6801 newdeplibs="$newdeplibs $a_deplib"
6806 if test -n "$a_deplib" ; then
6807 libname=`eval "\\$ECHO \"$libname_spec\""`
6808 for i in $lib_search_path $sys_lib_search_path $shlib_search_path; do
6809 potential_libs=`ls $i/$libname[.-]* 2>/dev/null`
6810 for potent_lib in $potential_libs; do
6811 # Follow soft links.
6812 if ls -lLd "$potent_lib" 2>/dev/null |
6813 $GREP " -> " >/dev/null; then
6816 # The statement above tries to avoid entering an
6817 # endless loop below, in case of cyclic links.
6818 # We might still enter an endless loop, since a link
6819 # loop can be closed while we follow links,
6821 potlib="$potent_lib"
6822 while test -h "$potlib" 2>/dev/null; do
6823 potliblink=`ls -ld $potlib | ${SED} 's/.* -> //'`
6825 [\\/]* | [A-Za-z]:[\\/]*) potlib="$potliblink";;
6826 *) potlib=`$ECHO "X$potlib" | $Xsed -e 's,[^/]*$,,'`"$potliblink";;
6829 if eval $file_magic_cmd \"\$potlib\" 2>/dev/null |
6831 $EGREP "$file_magic_regex" > /dev/null; then
6832 newdeplibs="$newdeplibs $a_deplib"
6839 if test -n "$a_deplib" ; then
6842 $ECHO "*** Warning: linker path does not have real file for library $a_deplib."
6843 $ECHO "*** I have the capability to make that library automatically link in when"
6844 $ECHO "*** you link to this library. But I can only do this if you have a"
6845 $ECHO "*** shared version of the library, which you do not appear to have"
6846 $ECHO "*** because I did check the linker path looking for a file starting"
6847 if test -z "$potlib" ; then
6848 $ECHO "*** with $libname but no candidates were found. (...for file magic test)"
6850 $ECHO "*** with $libname and none of the candidates passed a file format test"
6851 $ECHO "*** using a file magic. Last file checked: $potlib"
6856 # Add a -L argument.
6857 newdeplibs="$newdeplibs $a_deplib"
6860 done # Gone through all deplibs.
6863 set dummy $deplibs_check_method; shift
6864 match_pattern_regex=`expr "$deplibs_check_method" : "$1 \(.*\)"`
6865 for a_deplib in $deplibs; do
6868 func_stripname -l '' "$a_deplib"
6869 name=$func_stripname_result
6870 if test "X$allow_libtool_libs_with_static_runtimes" = "Xyes" ; then
6871 case " $predeps $postdeps " in
6873 newdeplibs="$newdeplibs $a_deplib"
6878 if test -n "$a_deplib" ; then
6879 libname=`eval "\\$ECHO \"$libname_spec\""`
6880 for i in $lib_search_path $sys_lib_search_path $shlib_search_path; do
6881 potential_libs=`ls $i/$libname[.-]* 2>/dev/null`
6882 for potent_lib in $potential_libs; do
6883 potlib="$potent_lib" # see symlink-check above in file_magic test
6884 if eval "\$ECHO \"X$potent_lib\"" 2>/dev/null | $Xsed -e 10q | \
6885 $EGREP "$match_pattern_regex" > /dev/null; then
6886 newdeplibs="$newdeplibs $a_deplib"
6893 if test -n "$a_deplib" ; then
6896 $ECHO "*** Warning: linker path does not have real file for library $a_deplib."
6897 $ECHO "*** I have the capability to make that library automatically link in when"
6898 $ECHO "*** you link to this library. But I can only do this if you have a"
6899 $ECHO "*** shared version of the library, which you do not appear to have"
6900 $ECHO "*** because I did check the linker path looking for a file starting"
6901 if test -z "$potlib" ; then
6902 $ECHO "*** with $libname but no candidates were found. (...for regex pattern test)"
6904 $ECHO "*** with $libname and none of the candidates passed a file format test"
6905 $ECHO "*** using a regex pattern. Last file checked: $potlib"
6910 # Add a -L argument.
6911 newdeplibs="$newdeplibs $a_deplib"
6914 done # Gone through all deplibs.
6918 tmp_deplibs=`$ECHO "X $deplibs" | $Xsed \
6919 -e 's/ -lc$//' -e 's/ -[LR][^ ]*//g'`
6920 if test "X$allow_libtool_libs_with_static_runtimes" = "Xyes" ; then
6921 for i in $predeps $postdeps ; do
6922 # can't use Xsed below, because $i might contain '/'
6923 tmp_deplibs=`$ECHO "X $tmp_deplibs" | $Xsed -e "s,$i,,"`
6926 if $ECHO "X $tmp_deplibs" | $Xsed -e 's/[ ]//g' |
6927 $GREP . >/dev/null; then
6929 if test "X$deplibs_check_method" = "Xnone"; then
6930 $ECHO "*** Warning: inter-library dependencies are not supported in this platform."
6932 $ECHO "*** Warning: inter-library dependencies are not known to be supported."
6934 $ECHO "*** All declared inter-library dependencies are being dropped."
6939 versuffix=$versuffix_save
6941 release=$release_save
6942 libname=$libname_save
6946 *-*-rhapsody* | *-*-darwin1.[012])
6947 # On Rhapsody replace the C library with the System framework
6948 newdeplibs=`$ECHO "X $newdeplibs" | $Xsed -e 's/ -lc / System.ltframework /'`
6952 if test "$droppeddeps" = yes; then
6953 if test "$module" = yes; then
6955 $ECHO "*** Warning: libtool could not satisfy all declared inter-library"
6956 $ECHO "*** dependencies of module $libname. Therefore, libtool will create"
6957 $ECHO "*** a static module, that should work as long as the dlopening"
6958 $ECHO "*** application is linked with the -dlopen flag."
6959 if test -z "$global_symbol_pipe"; then
6961 $ECHO "*** However, this would only work if libtool was able to extract symbol"
6962 $ECHO "*** lists from a program, using \`nm' or equivalent, but libtool could"
6963 $ECHO "*** not find such a program. So, this module is probably useless."
6964 $ECHO "*** \`nm' from GNU binutils and a full rebuild may help."
6966 if test "$build_old_libs" = no; then
6967 oldlibs="$output_objdir/$libname.$libext"
6968 build_libtool_libs=module
6971 build_libtool_libs=no
6974 $ECHO "*** The inter-library dependencies that have been dropped here will be"
6975 $ECHO "*** automatically added whenever a program is linked with this library"
6976 $ECHO "*** or is declared to -dlopen it."
6978 if test "$allow_undefined" = no; then
6980 $ECHO "*** Since this library must not contain undefined symbols,"
6981 $ECHO "*** because either the platform does not support them or"
6982 $ECHO "*** it was explicitly requested with -no-undefined,"
6983 $ECHO "*** libtool will only create a static version of it."
6984 if test "$build_old_libs" = no; then
6985 oldlibs="$output_objdir/$libname.$libext"
6986 build_libtool_libs=module
6989 build_libtool_libs=no
6994 # Done checking deplibs!
6997 # Time to change all our "foo.ltframework" stuff back to "-framework foo"
7000 newdeplibs=`$ECHO "X $newdeplibs" | $Xsed -e 's% \([^ $]*\).ltframework% -framework \1%g'`
7001 new_inherited_linker_flags=`$ECHO "X $new_inherited_linker_flags" | $Xsed -e 's% \([^ $]*\).ltframework% -framework \1%g'`
7002 deplibs=`$ECHO "X $deplibs" | $Xsed -e 's% \([^ $]*\).ltframework% -framework \1%g'`
7006 # move library search paths that coincide with paths to not yet
7007 # installed libraries to the beginning of the library search list
7009 for path in $notinst_path; do
7010 case " $new_libs " in
7011 *" -L$path/$objdir "*) ;;
7013 case " $deplibs " in
7014 *" -L$path/$objdir "*)
7015 new_libs="$new_libs -L$path/$objdir" ;;
7020 for deplib in $deplibs; do
7023 case " $new_libs " in
7025 *) new_libs="$new_libs $deplib" ;;
7028 *) new_libs="$new_libs $deplib" ;;
7033 # All the library-specific variables (install_libdir is set above).
7038 # Test again, we may have decided not to build it any more
7039 if test "$build_libtool_libs" = yes; then
7040 if test "$hardcode_into_libs" = yes; then
7041 # Hardcode the library paths
7044 rpath="$finalize_rpath"
7045 test "$mode" != relink && rpath="$compile_rpath$rpath"
7046 for libdir in $rpath; do
7047 if test -n "$hardcode_libdir_flag_spec"; then
7048 if test -n "$hardcode_libdir_separator"; then
7049 if test -z "$hardcode_libdirs"; then
7050 hardcode_libdirs="$libdir"
7052 # Just accumulate the unique libdirs.
7053 case $hardcode_libdir_separator$hardcode_libdirs$hardcode_libdir_separator in
7054 *"$hardcode_libdir_separator$libdir$hardcode_libdir_separator"*)
7057 hardcode_libdirs="$hardcode_libdirs$hardcode_libdir_separator$libdir"
7062 eval flag=\"$hardcode_libdir_flag_spec\"
7063 dep_rpath="$dep_rpath $flag"
7065 elif test -n "$runpath_var"; then
7066 case "$perm_rpath " in
7068 *) perm_rpath="$perm_rpath $libdir" ;;
7072 # Substitute the hardcoded libdirs into the rpath.
7073 if test -n "$hardcode_libdir_separator" &&
7074 test -n "$hardcode_libdirs"; then
7075 libdir="$hardcode_libdirs"
7076 if test -n "$hardcode_libdir_flag_spec_ld"; then
7077 eval dep_rpath=\"$hardcode_libdir_flag_spec_ld\"
7079 eval dep_rpath=\"$hardcode_libdir_flag_spec\"
7082 if test -n "$runpath_var" && test -n "$perm_rpath"; then
7083 # We should set the runpath_var.
7085 for dir in $perm_rpath; do
7088 eval "$runpath_var='$rpath\$$runpath_var'; export $runpath_var"
7090 test -n "$dep_rpath" && deplibs="$dep_rpath $deplibs"
7093 shlibpath="$finalize_shlibpath"
7094 test "$mode" != relink && shlibpath="$compile_shlibpath$shlibpath"
7095 if test -n "$shlibpath"; then
7096 eval "$shlibpath_var='$shlibpath\$$shlibpath_var'; export $shlibpath_var"
7099 # Get the real and link names of the library.
7100 eval shared_ext=\"$shrext_cmds\"
7101 eval library_names=\"$library_names_spec\"
7102 set dummy $library_names
7107 if test -n "$soname_spec"; then
7108 eval soname=\"$soname_spec\"
7112 if test -z "$dlname"; then
7116 lib="$output_objdir/$realname"
7120 linknames="$linknames $link"
7123 # Use standard objects if they are pic
7124 test -z "$pic_flag" && libobjs=`$ECHO "X$libobjs" | $SP2NL | $Xsed -e "$lo2o" | $NL2SP`
7125 test "X$libobjs" = "X " && libobjs=
7128 if test -n "$export_symbols" && test -n "$include_expsyms"; then
7129 $opt_dry_run || cp "$export_symbols" "$output_objdir/$libname.uexp"
7130 export_symbols="$output_objdir/$libname.uexp"
7131 delfiles="$delfiles $export_symbols"
7134 orig_export_symbols=
7136 cygwin* | mingw* | cegcc*)
7137 if test -n "$export_symbols" && test -z "$export_symbols_regex"; then
7138 # exporting using user supplied symfile
7139 if test "x`$SED 1q $export_symbols`" != xEXPORTS; then
7140 # and it's NOT already a .def file. Must figure out
7141 # which of the given symbols are data symbols and tag
7142 # them as such. So, trigger use of export_symbols_cmds.
7143 # export_symbols gets reassigned inside the "prepare
7144 # the list of exported symbols" if statement, so the
7145 # include_expsyms logic still works.
7146 orig_export_symbols="$export_symbols"
7148 always_export_symbols=yes
7154 # Prepare the list of exported symbols
7155 if test -z "$export_symbols"; then
7156 if test "$always_export_symbols" = yes || test -n "$export_symbols_regex"; then
7157 func_verbose "generating symbol list for \`$libname.la'"
7158 export_symbols="$output_objdir/$libname.exp"
7159 $opt_dry_run || $RM $export_symbols
7160 cmds=$export_symbols_cmds
7161 save_ifs="$IFS"; IFS='~'
7162 for cmd in $cmds; do
7166 len=$func_len_result
7167 if test "$len" -lt "$max_cmd_len" || test "$max_cmd_len" -le -1; then
7168 func_show_eval "$cmd" 'exit $?'
7169 skipped_export=false
7171 # The command line is too long to execute in one step.
7172 func_verbose "using reloadable object file for export list..."
7174 # Break out early, otherwise skipped_export may be
7175 # set to false by a later but shorter cmd.
7180 if test -n "$export_symbols_regex" && test "X$skipped_export" != "X:"; then
7181 func_show_eval '$EGREP -e "$export_symbols_regex" "$export_symbols" > "${export_symbols}T"'
7182 func_show_eval '$MV "${export_symbols}T" "$export_symbols"'
7187 if test -n "$export_symbols" && test -n "$include_expsyms"; then
7188 tmp_export_symbols="$export_symbols"
7189 test -n "$orig_export_symbols" && tmp_export_symbols="$orig_export_symbols"
7190 $opt_dry_run || eval '$ECHO "X$include_expsyms" | $Xsed | $SP2NL >> "$tmp_export_symbols"'
7193 if test "X$skipped_export" != "X:" && test -n "$orig_export_symbols"; then
7194 # The given exports_symbols file has to be filtered, so filter it.
7195 func_verbose "filter symbol list for \`$libname.la' to tag DATA exports"
7196 # FIXME: $output_objdir/$libname.filter potentially contains lots of
7197 # 's' commands which not all seds can handle. GNU sed should be fine
7198 # though. Also, the filter scales superlinearly with the number of
7199 # global variables. join(1) would be nice here, but unfortunately
7200 # isn't a blessed tool.
7201 $opt_dry_run || $SED -e '/[ ,]DATA/!d;s,\(.*\)\([ \,].*\),s|^\1$|\1\2|,' < $export_symbols > $output_objdir/$libname.filter
7202 delfiles="$delfiles $export_symbols $output_objdir/$libname.filter"
7203 export_symbols=$output_objdir/$libname.def
7204 $opt_dry_run || $SED -f $output_objdir/$libname.filter < $orig_export_symbols > $export_symbols
7208 for test_deplib in $deplibs; do
7209 case " $convenience " in
7210 *" $test_deplib "*) ;;
7212 tmp_deplibs="$tmp_deplibs $test_deplib"
7216 deplibs="$tmp_deplibs"
7218 if test -n "$convenience"; then
7219 if test -n "$whole_archive_flag_spec" &&
7220 test "$compiler_needs_object" = yes &&
7221 test -z "$libobjs"; then
7222 # extract the archives, so we have objects to list.
7223 # TODO: could optimize this to just extract one archive.
7224 whole_archive_flag_spec=
7226 if test -n "$whole_archive_flag_spec"; then
7227 save_libobjs=$libobjs
7228 eval libobjs=\"\$libobjs $whole_archive_flag_spec\"
7229 test "X$libobjs" = "X " && libobjs=
7231 gentop="$output_objdir/${outputname}x"
7232 generated="$generated $gentop"
7234 func_extract_archives $gentop $convenience
7235 libobjs="$libobjs $func_extract_archives_result"
7236 test "X$libobjs" = "X " && libobjs=
7240 if test "$thread_safe" = yes && test -n "$thread_safe_flag_spec"; then
7241 eval flag=\"$thread_safe_flag_spec\"
7242 linker_flags="$linker_flags $flag"
7245 # Make a backup of the uninstalled library when relinking
7246 if test "$mode" = relink; then
7247 $opt_dry_run || eval '(cd $output_objdir && $RM ${realname}U && $MV $realname ${realname}U)' || exit $?
7250 # Do each of the archive commands.
7251 if test "$module" = yes && test -n "$module_cmds" ; then
7252 if test -n "$export_symbols" && test -n "$module_expsym_cmds"; then
7253 eval test_cmds=\"$module_expsym_cmds\"
7254 cmds=$module_expsym_cmds
7256 eval test_cmds=\"$module_cmds\"
7260 if test -n "$export_symbols" && test -n "$archive_expsym_cmds"; then
7261 eval test_cmds=\"$archive_expsym_cmds\"
7262 cmds=$archive_expsym_cmds
7264 eval test_cmds=\"$archive_cmds\"
7269 if test "X$skipped_export" != "X:" &&
7270 func_len " $test_cmds" &&
7271 len=$func_len_result &&
7272 test "$len" -lt "$max_cmd_len" || test "$max_cmd_len" -le -1; then
7275 # The command line is too long to link in one step, link piecewise
7276 # or, if using GNU ld and skipped_export is not :, use a linker
7279 # Save the value of $output and $libobjs because we want to
7280 # use them later. If we have whole_archive_flag_spec, we
7281 # want to use save_libobjs as it was before
7282 # whole_archive_flag_spec was expanded, because we can't
7283 # assume the linker understands whole_archive_flag_spec.
7284 # This may have to be revisited, in case too many
7285 # convenience libraries get linked in and end up exceeding
7287 if test -z "$convenience" || test -z "$whole_archive_flag_spec"; then
7288 save_libobjs=$libobjs
7291 output_la=`$ECHO "X$output" | $Xsed -e "$basename"`
7293 # Clear the reloadable object creation command queue and
7294 # initialize k to one.
7301 if test -n "$save_libobjs" && test "X$skipped_export" != "X:" && test "$with_gnu_ld" = yes; then
7302 output=${output_objdir}/${output_la}.lnkscript
7303 func_verbose "creating GNU ld script: $output"
7304 $ECHO 'INPUT (' > $output
7305 for obj in $save_libobjs
7307 $ECHO "$obj" >> $output
7309 $ECHO ')' >> $output
7310 delfiles="$delfiles $output"
7311 elif test -n "$save_libobjs" && test "X$skipped_export" != "X:" && test "X$file_list_spec" != X; then
7312 output=${output_objdir}/${output_la}.lnk
7313 func_verbose "creating linker input file list: $output"
7318 if test "$compiler_needs_object" = yes; then
7324 $ECHO "$obj" >> $output
7326 delfiles="$delfiles $output"
7327 output=$firstobj\"$file_list_spec$output\"
7329 if test -n "$save_libobjs"; then
7330 func_verbose "creating reloadable object files..."
7331 output=$output_objdir/$output_la-${k}.$objext
7332 eval test_cmds=\"$reload_cmds\"
7333 func_len " $test_cmds"
7334 len0=$func_len_result
7337 # Loop over the list of objects to be linked.
7338 for obj in $save_libobjs
7341 func_arith $len + $func_len_result
7342 len=$func_arith_result
7343 if test "X$objlist" = X ||
7344 test "$len" -lt "$max_cmd_len"; then
7345 func_append objlist " $obj"
7347 # The command $test_cmds is almost too long, add a
7348 # command to the queue.
7349 if test "$k" -eq 1 ; then
7350 # The first file doesn't have a previous command to add.
7351 eval concat_cmds=\"$reload_cmds $objlist $last_robj\"
7353 # All subsequent reloadable object files will link in
7354 # the last one created.
7355 eval concat_cmds=\"\$concat_cmds~$reload_cmds $objlist $last_robj~\$RM $last_robj\"
7357 last_robj=$output_objdir/$output_la-${k}.$objext
7359 k=$func_arith_result
7360 output=$output_objdir/$output_la-${k}.$objext
7362 func_len " $last_robj"
7363 func_arith $len0 + $func_len_result
7364 len=$func_arith_result
7367 # Handle the remaining objects by creating one last
7368 # reloadable object file. All subsequent reloadable object
7369 # files will link in the last one created.
7370 test -z "$concat_cmds" || concat_cmds=$concat_cmds~
7371 eval concat_cmds=\"\${concat_cmds}$reload_cmds $objlist $last_robj\"
7372 if test -n "$last_robj"; then
7373 eval concat_cmds=\"\${concat_cmds}~\$RM $last_robj\"
7375 delfiles="$delfiles $output"
7381 if ${skipped_export-false}; then
7382 func_verbose "generating symbol list for \`$libname.la'"
7383 export_symbols="$output_objdir/$libname.exp"
7384 $opt_dry_run || $RM $export_symbols
7386 # Append the command to create the export file.
7387 test -z "$concat_cmds" || concat_cmds=$concat_cmds~
7388 eval concat_cmds=\"\$concat_cmds$export_symbols_cmds\"
7389 if test -n "$last_robj"; then
7390 eval concat_cmds=\"\$concat_cmds~\$RM $last_robj\"
7394 test -n "$save_libobjs" &&
7395 func_verbose "creating a temporary reloadable object file: $output"
7397 # Loop through the commands generated above and execute them.
7398 save_ifs="$IFS"; IFS='~'
7399 for cmd in $concat_cmds; do
7402 func_quote_for_expand "$cmd"
7403 eval "func_echo $func_quote_for_expand_result"
7405 $opt_dry_run || eval "$cmd" || {
7408 # Restore the uninstalled library and exit
7409 if test "$mode" = relink; then
7410 ( cd "$output_objdir" && \
7411 $RM "${realname}T" && \
7412 $MV "${realname}U" "$realname" )
7420 if test -n "$export_symbols_regex" && ${skipped_export-false}; then
7421 func_show_eval '$EGREP -e "$export_symbols_regex" "$export_symbols" > "${export_symbols}T"'
7422 func_show_eval '$MV "${export_symbols}T" "$export_symbols"'
7426 if ${skipped_export-false}; then
7427 if test -n "$export_symbols" && test -n "$include_expsyms"; then
7428 tmp_export_symbols="$export_symbols"
7429 test -n "$orig_export_symbols" && tmp_export_symbols="$orig_export_symbols"
7430 $opt_dry_run || eval '$ECHO "X$include_expsyms" | $Xsed | $SP2NL >> "$tmp_export_symbols"'
7433 if test -n "$orig_export_symbols"; then
7434 # The given exports_symbols file has to be filtered, so filter it.
7435 func_verbose "filter symbol list for \`$libname.la' to tag DATA exports"
7436 # FIXME: $output_objdir/$libname.filter potentially contains lots of
7437 # 's' commands which not all seds can handle. GNU sed should be fine
7438 # though. Also, the filter scales superlinearly with the number of
7439 # global variables. join(1) would be nice here, but unfortunately
7440 # isn't a blessed tool.
7441 $opt_dry_run || $SED -e '/[ ,]DATA/!d;s,\(.*\)\([ \,].*\),s|^\1$|\1\2|,' < $export_symbols > $output_objdir/$libname.filter
7442 delfiles="$delfiles $export_symbols $output_objdir/$libname.filter"
7443 export_symbols=$output_objdir/$libname.def
7444 $opt_dry_run || $SED -f $output_objdir/$libname.filter < $orig_export_symbols > $export_symbols
7449 # Restore the value of output.
7452 if test -n "$convenience" && test -n "$whole_archive_flag_spec"; then
7453 eval libobjs=\"\$libobjs $whole_archive_flag_spec\"
7454 test "X$libobjs" = "X " && libobjs=
7456 # Expand the library linking commands again to reset the
7457 # value of $libobjs for piecewise linking.
7459 # Do each of the archive commands.
7460 if test "$module" = yes && test -n "$module_cmds" ; then
7461 if test -n "$export_symbols" && test -n "$module_expsym_cmds"; then
7462 cmds=$module_expsym_cmds
7467 if test -n "$export_symbols" && test -n "$archive_expsym_cmds"; then
7468 cmds=$archive_expsym_cmds
7475 if test -n "$delfiles"; then
7476 # Append the command to remove temporary files to $cmds.
7477 eval cmds=\"\$cmds~\$RM $delfiles\"
7480 # Add any objects from preloaded convenience libraries
7481 if test -n "$dlprefiles"; then
7482 gentop="$output_objdir/${outputname}x"
7483 generated="$generated $gentop"
7485 func_extract_archives $gentop $dlprefiles
7486 libobjs="$libobjs $func_extract_archives_result"
7487 test "X$libobjs" = "X " && libobjs=
7490 save_ifs="$IFS"; IFS='~'
7491 for cmd in $cmds; do
7495 func_quote_for_expand "$cmd"
7496 eval "func_echo $func_quote_for_expand_result"
7498 $opt_dry_run || eval "$cmd" || {
7501 # Restore the uninstalled library and exit
7502 if test "$mode" = relink; then
7503 ( cd "$output_objdir" && \
7504 $RM "${realname}T" && \
7505 $MV "${realname}U" "$realname" )
7513 # Restore the uninstalled library and exit
7514 if test "$mode" = relink; then
7515 $opt_dry_run || eval '(cd $output_objdir && $RM ${realname}T && $MV $realname ${realname}T && $MV ${realname}U $realname)' || exit $?
7517 if test -n "$convenience"; then
7518 if test -z "$whole_archive_flag_spec"; then
7519 func_show_eval '${RM}r "$gentop"'
7526 # Create links to the real library.
7527 for linkname in $linknames; do
7528 if test "$realname" != "$linkname"; then
7529 func_show_eval '(cd "$output_objdir" && $RM "$linkname" && $LN_S "$realname" "$linkname")' 'exit $?'
7533 # If -module or -export-dynamic was specified, set the dlname.
7534 if test "$module" = yes || test "$export_dynamic" = yes; then
7535 # On all known operating systems, these are identical.
7542 if test -n "$dlfiles$dlprefiles" || test "$dlself" != no; then
7543 func_warning "\`-dlopen' is ignored for objects"
7548 func_warning "\`-l' and \`-L' are ignored for objects" ;;
7551 test -n "$rpath" && \
7552 func_warning "\`-rpath' is ignored for objects"
7554 test -n "$xrpath" && \
7555 func_warning "\`-R' is ignored for objects"
7557 test -n "$vinfo" && \
7558 func_warning "\`-version-info' is ignored for objects"
7560 test -n "$release" && \
7561 func_warning "\`-release' is ignored for objects"
7565 test -n "$objs$old_deplibs" && \
7566 func_fatal_error "cannot build library object \`$output' from non-libtool objects"
7570 obj=$func_lo2o_result
7578 # Delete the old objects.
7579 $opt_dry_run || $RM $obj $libobj
7581 # Objects from convenience libraries. This assumes
7582 # single-version convenience libraries. Whenever we create
7583 # different ones for PIC/non-PIC, this we'll have to duplicate
7587 # reload_cmds runs $LD directly, so let us get rid of
7588 # -Wl from whole_archive_flag_spec and hope we can get by with
7589 # turning comma into space..
7592 if test -n "$convenience"; then
7593 if test -n "$whole_archive_flag_spec"; then
7594 eval tmp_whole_archive_flags=\"$whole_archive_flag_spec\"
7595 reload_conv_objs=$reload_objs\ `$ECHO "X$tmp_whole_archive_flags" | $Xsed -e 's|,| |g'`
7597 gentop="$output_objdir/${obj}x"
7598 generated="$generated $gentop"
7600 func_extract_archives $gentop $convenience
7601 reload_conv_objs="$reload_objs $func_extract_archives_result"
7605 # Create the old-style object.
7606 reload_objs="$objs$old_deplibs "`$ECHO "X$libobjs" | $SP2NL | $Xsed -e '/\.'${libext}$'/d' -e '/\.lib$/d' -e "$lo2o" | $NL2SP`" $reload_conv_objs" ### testsuite: skip nested quoting test
7609 func_execute_cmds "$reload_cmds" 'exit $?'
7611 # Exit if we aren't doing a library object file.
7612 if test -z "$libobj"; then
7613 if test -n "$gentop"; then
7614 func_show_eval '${RM}r "$gentop"'
7620 if test "$build_libtool_libs" != yes; then
7621 if test -n "$gentop"; then
7622 func_show_eval '${RM}r "$gentop"'
7625 # Create an invalid libtool object if no PIC, so that we don't
7626 # accidentally link it into a program.
7627 # $show "echo timestamp > $libobj"
7628 # $opt_dry_run || eval "echo timestamp > $libobj" || exit $?
7632 if test -n "$pic_flag" || test "$pic_mode" != default; then
7633 # Only do commands if we really have different PIC objects.
7634 reload_objs="$libobjs $reload_conv_objs"
7636 func_execute_cmds "$reload_cmds" 'exit $?'
7639 if test -n "$gentop"; then
7640 func_show_eval '${RM}r "$gentop"'
7648 *cygwin*) func_stripname '' '.exe' "$output"
7649 output=$func_stripname_result.exe;;
7651 test -n "$vinfo" && \
7652 func_warning "\`-version-info' is ignored for programs"
7654 test -n "$release" && \
7655 func_warning "\`-release' is ignored for programs"
7657 test "$preload" = yes \
7658 && test "$dlopen_support" = unknown \
7659 && test "$dlopen_self" = unknown \
7660 && test "$dlopen_self_static" = unknown && \
7661 func_warning "\`LT_INIT([dlopen])' not used. Assuming no dlopen support."
7664 *-*-rhapsody* | *-*-darwin1.[012])
7665 # On Rhapsody replace the C library is the System framework
7666 compile_deplibs=`$ECHO "X $compile_deplibs" | $Xsed -e 's/ -lc / System.ltframework /'`
7667 finalize_deplibs=`$ECHO "X $finalize_deplibs" | $Xsed -e 's/ -lc / System.ltframework /'`
7673 # Don't allow lazy linking, it breaks C++ global constructors
7674 # But is supposedly fixed on 10.4 or later (yay!).
7675 if test "$tagname" = CXX ; then
7676 case ${MACOSX_DEPLOYMENT_TARGET-10.0} in
7678 compile_command="$compile_command ${wl}-bind_at_load"
7679 finalize_command="$finalize_command ${wl}-bind_at_load"
7683 # Time to change all our "foo.ltframework" stuff back to "-framework foo"
7684 compile_deplibs=`$ECHO "X $compile_deplibs" | $Xsed -e 's% \([^ $]*\).ltframework% -framework \1%g'`
7685 finalize_deplibs=`$ECHO "X $finalize_deplibs" | $Xsed -e 's% \([^ $]*\).ltframework% -framework \1%g'`
7690 # move library search paths that coincide with paths to not yet
7691 # installed libraries to the beginning of the library search list
7693 for path in $notinst_path; do
7694 case " $new_libs " in
7695 *" -L$path/$objdir "*) ;;
7697 case " $compile_deplibs " in
7698 *" -L$path/$objdir "*)
7699 new_libs="$new_libs -L$path/$objdir" ;;
7704 for deplib in $compile_deplibs; do
7707 case " $new_libs " in
7709 *) new_libs="$new_libs $deplib" ;;
7712 *) new_libs="$new_libs $deplib" ;;
7715 compile_deplibs="$new_libs"
7718 compile_command="$compile_command $compile_deplibs"
7719 finalize_command="$finalize_command $finalize_deplibs"
7721 if test -n "$rpath$xrpath"; then
7722 # If the user specified any rpath flags, then add them.
7723 for libdir in $rpath $xrpath; do
7724 # This is the magic to use -rpath.
7725 case "$finalize_rpath " in
7727 *) finalize_rpath="$finalize_rpath $libdir" ;;
7732 # Now hardcode the library paths
7735 for libdir in $compile_rpath $finalize_rpath; do
7736 if test -n "$hardcode_libdir_flag_spec"; then
7737 if test -n "$hardcode_libdir_separator"; then
7738 if test -z "$hardcode_libdirs"; then
7739 hardcode_libdirs="$libdir"
7741 # Just accumulate the unique libdirs.
7742 case $hardcode_libdir_separator$hardcode_libdirs$hardcode_libdir_separator in
7743 *"$hardcode_libdir_separator$libdir$hardcode_libdir_separator"*)
7746 hardcode_libdirs="$hardcode_libdirs$hardcode_libdir_separator$libdir"
7751 eval flag=\"$hardcode_libdir_flag_spec\"
7752 rpath="$rpath $flag"
7754 elif test -n "$runpath_var"; then
7755 case "$perm_rpath " in
7757 *) perm_rpath="$perm_rpath $libdir" ;;
7761 *-*-cygwin* | *-*-mingw* | *-*-pw32* | *-*-os2* | *-cegcc*)
7762 testbindir=`${ECHO} "$libdir" | ${SED} -e 's*/lib$*/bin*'`
7763 case :$dllsearchpath: in
7765 ::) dllsearchpath=$libdir;;
7766 *) dllsearchpath="$dllsearchpath:$libdir";;
7768 case :$dllsearchpath: in
7769 *":$testbindir:"*) ;;
7770 ::) dllsearchpath=$testbindir;;
7771 *) dllsearchpath="$dllsearchpath:$testbindir";;
7776 # Substitute the hardcoded libdirs into the rpath.
7777 if test -n "$hardcode_libdir_separator" &&
7778 test -n "$hardcode_libdirs"; then
7779 libdir="$hardcode_libdirs"
7780 eval rpath=\" $hardcode_libdir_flag_spec\"
7782 compile_rpath="$rpath"
7786 for libdir in $finalize_rpath; do
7787 if test -n "$hardcode_libdir_flag_spec"; then
7788 if test -n "$hardcode_libdir_separator"; then
7789 if test -z "$hardcode_libdirs"; then
7790 hardcode_libdirs="$libdir"
7792 # Just accumulate the unique libdirs.
7793 case $hardcode_libdir_separator$hardcode_libdirs$hardcode_libdir_separator in
7794 *"$hardcode_libdir_separator$libdir$hardcode_libdir_separator"*)
7797 hardcode_libdirs="$hardcode_libdirs$hardcode_libdir_separator$libdir"
7802 eval flag=\"$hardcode_libdir_flag_spec\"
7803 rpath="$rpath $flag"
7805 elif test -n "$runpath_var"; then
7806 case "$finalize_perm_rpath " in
7808 *) finalize_perm_rpath="$finalize_perm_rpath $libdir" ;;
7812 # Substitute the hardcoded libdirs into the rpath.
7813 if test -n "$hardcode_libdir_separator" &&
7814 test -n "$hardcode_libdirs"; then
7815 libdir="$hardcode_libdirs"
7816 eval rpath=\" $hardcode_libdir_flag_spec\"
7818 finalize_rpath="$rpath"
7820 if test -n "$libobjs" && test "$build_old_libs" = yes; then
7821 # Transform all the library objects into standard objects.
7822 compile_command=`$ECHO "X$compile_command" | $SP2NL | $Xsed -e "$lo2o" | $NL2SP`
7823 finalize_command=`$ECHO "X$finalize_command" | $SP2NL | $Xsed -e "$lo2o" | $NL2SP`
7826 func_generate_dlsyms "$outputname" "@PROGRAM@" "no"
7828 # template prelinking step
7829 if test -n "$prelink_cmds"; then
7830 func_execute_cmds "$prelink_cmds" 'exit $?'
7833 wrappers_required=yes
7835 *cygwin* | *mingw* )
7836 if test "$build_libtool_libs" != yes; then
7837 wrappers_required=no
7841 # Disable wrappers for cegcc, we are cross compiling anyway.
7842 wrappers_required=no
7845 if test "$need_relink" = no || test "$build_libtool_libs" != yes; then
7846 wrappers_required=no
7850 if test "$wrappers_required" = no; then
7851 # Replace the output file specification.
7852 compile_command=`$ECHO "X$compile_command" | $Xsed -e 's%@OUTPUT@%'"$output"'%g'`
7853 link_command="$compile_command$compile_rpath"
7855 # We have no uninstalled library dependencies, so finalize right now.
7857 func_show_eval "$link_command" 'exit_status=$?'
7859 # Delete the generated files.
7860 if test -f "$output_objdir/${outputname}S.${objext}"; then
7861 func_show_eval '$RM "$output_objdir/${outputname}S.${objext}"'
7867 if test -n "$compile_shlibpath$finalize_shlibpath"; then
7868 compile_command="$shlibpath_var=\"$compile_shlibpath$finalize_shlibpath\$$shlibpath_var\" $compile_command"
7870 if test -n "$finalize_shlibpath"; then
7871 finalize_command="$shlibpath_var=\"$finalize_shlibpath\$$shlibpath_var\" $finalize_command"
7876 if test -n "$runpath_var"; then
7877 if test -n "$perm_rpath"; then
7878 # We should set the runpath_var.
7880 for dir in $perm_rpath; do
7883 compile_var="$runpath_var=\"$rpath\$$runpath_var\" "
7885 if test -n "$finalize_perm_rpath"; then
7886 # We should set the runpath_var.
7888 for dir in $finalize_perm_rpath; do
7891 finalize_var="$runpath_var=\"$rpath\$$runpath_var\" "
7895 if test "$no_install" = yes; then
7896 # We don't need to create a wrapper script.
7897 link_command="$compile_var$compile_command$compile_rpath"
7898 # Replace the output file specification.
7899 link_command=`$ECHO "X$link_command" | $Xsed -e 's%@OUTPUT@%'"$output"'%g'`
7900 # Delete the old output file.
7901 $opt_dry_run || $RM $output
7902 # Link the executable and exit
7903 func_show_eval "$link_command" 'exit $?'
7907 if test "$hardcode_action" = relink; then
7908 # Fast installation is not supported
7909 link_command="$compile_var$compile_command$compile_rpath"
7910 relink_command="$finalize_var$finalize_command$finalize_rpath"
7912 func_warning "this platform does not like uninstalled shared libraries"
7913 func_warning "\`$output' will be relinked during installation"
7915 if test "$fast_install" != no; then
7916 link_command="$finalize_var$compile_command$finalize_rpath"
7917 if test "$fast_install" = yes; then
7918 relink_command=`$ECHO "X$compile_var$compile_command$compile_rpath" | $Xsed -e 's%@OUTPUT@%\$progdir/\$file%g'`
7920 # fast_install is set to needless
7924 link_command="$compile_var$compile_command$compile_rpath"
7925 relink_command="$finalize_var$finalize_command$finalize_rpath"
7929 # Replace the output file specification.
7930 link_command=`$ECHO "X$link_command" | $Xsed -e 's%@OUTPUT@%'"$output_objdir/$outputname"'%g'`
7932 # Delete the old output files.
7933 $opt_dry_run || $RM $output $output_objdir/$outputname $output_objdir/lt-$outputname
7935 func_show_eval "$link_command" 'exit $?'
7937 # Now create the wrapper script.
7938 func_verbose "creating $output"
7940 # Quote the relink command for shipping.
7941 if test -n "$relink_command"; then
7942 # Preserve any variables that may affect compiler behavior
7943 for var in $variables_saved_for_relink; do
7944 if eval test -z \"\${$var+set}\"; then
7945 relink_command="{ test -z \"\${$var+set}\" || $lt_unset $var || { $var=; export $var; }; }; $relink_command"
7946 elif eval var_value=\$$var; test -z "$var_value"; then
7947 relink_command="$var=; export $var; $relink_command"
7949 func_quote_for_eval "$var_value"
7950 relink_command="$var=$func_quote_for_eval_result; export $var; $relink_command"
7953 relink_command="(cd `pwd`; $relink_command)"
7954 relink_command=`$ECHO "X$relink_command" | $Xsed -e "$sed_quote_subst"`
7957 # Quote $ECHO for shipping.
7958 if test "X$ECHO" = "X$SHELL $progpath --fallback-echo"; then
7960 [\\/]* | [A-Za-z]:[\\/]*) qecho="$SHELL $progpath --fallback-echo";;
7961 *) qecho="$SHELL `pwd`/$progpath --fallback-echo";;
7963 qecho=`$ECHO "X$qecho" | $Xsed -e "$sed_quote_subst"`
7965 qecho=`$ECHO "X$ECHO" | $Xsed -e "$sed_quote_subst"`
7968 # Only actually do things if not in dry run mode.
7970 # win32 will think the script is a binary if it has
7971 # a .exe suffix, so we strip it off here.
7973 *.exe) func_stripname '' '.exe' "$output"
7974 output=$func_stripname_result ;;
7976 # test for cygwin because mv fails w/o .exe extensions
7980 func_stripname '' '.exe' "$outputname"
7981 outputname=$func_stripname_result ;;
7985 *cygwin* | *mingw* )
7986 func_dirname_and_basename "$output" "" "."
7987 output_name=$func_basename_result
7988 output_path=$func_dirname_result
7989 cwrappersource="$output_path/$objdir/lt-$output_name.c"
7990 cwrapper="$output_path/$output_name.exe"
7991 $RM $cwrappersource $cwrapper
7992 trap "$RM $cwrappersource $cwrapper; exit $EXIT_FAILURE" 1 2 15
7994 func_emit_cwrapperexe_src > $cwrappersource
7996 # The wrapper executable is built using the $host compiler,
7997 # because it contains $host paths and files. If cross-
7998 # compiling, it, like the target executable, must be
7999 # executed on the $host or under an emulation environment.
8001 $LTCC $LTCFLAGS -o $cwrapper $cwrappersource
8005 # Now, create the wrapper script for func_source use:
8006 func_ltwrapper_scriptname $cwrapper
8007 $RM $func_ltwrapper_scriptname_result
8008 trap "$RM $func_ltwrapper_scriptname_result; exit $EXIT_FAILURE" 1 2 15
8010 # note: this script will not be executed, so do not chmod.
8011 if test "x$build" = "x$host" ; then
8012 $cwrapper --lt-dump-script > $func_ltwrapper_scriptname_result
8014 func_emit_wrapper no > $func_ltwrapper_scriptname_result
8020 trap "$RM $output; exit $EXIT_FAILURE" 1 2 15
8022 func_emit_wrapper no > $output
8031 # See if we need to build an old-fashioned archive.
8032 for oldlib in $oldlibs; do
8034 if test "$build_libtool_libs" = convenience; then
8035 oldobjs="$libobjs_save $symfileobj"
8036 addlibs="$convenience"
8037 build_libtool_libs=no
8039 if test "$build_libtool_libs" = module; then
8040 oldobjs="$libobjs_save"
8041 build_libtool_libs=no
8043 oldobjs="$old_deplibs $non_pic_objects"
8044 if test "$preload" = yes && test -f "$symfileobj"; then
8045 oldobjs="$oldobjs $symfileobj"
8048 addlibs="$old_convenience"
8051 if test -n "$addlibs"; then
8052 gentop="$output_objdir/${outputname}x"
8053 generated="$generated $gentop"
8055 func_extract_archives $gentop $addlibs
8056 oldobjs="$oldobjs $func_extract_archives_result"
8059 # Do each command in the archive commands.
8060 if test -n "$old_archive_from_new_cmds" && test "$build_libtool_libs" = yes; then
8061 cmds=$old_archive_from_new_cmds
8064 # Add any objects from preloaded convenience libraries
8065 if test -n "$dlprefiles"; then
8066 gentop="$output_objdir/${outputname}x"
8067 generated="$generated $gentop"
8069 func_extract_archives $gentop $dlprefiles
8070 oldobjs="$oldobjs $func_extract_archives_result"
8073 # POSIX demands no paths to be encoded in archives. We have
8074 # to avoid creating archives with duplicate basenames if we
8075 # might have to extract them afterwards, e.g., when creating a
8076 # static archive out of a convenience library, or when linking
8077 # the entirety of a libtool archive into another (currently
8078 # not supported by libtool).
8079 if (for obj in $oldobjs
8081 func_basename "$obj"
8082 $ECHO "$func_basename_result"
8083 done | sort | sort -uc >/dev/null 2>&1); then
8086 $ECHO "copying selected object files to avoid basename conflicts..."
8087 gentop="$output_objdir/${outputname}x"
8088 generated="$generated $gentop"
8089 func_mkdir_p "$gentop"
8090 save_oldobjs=$oldobjs
8093 for obj in $save_oldobjs
8095 func_basename "$obj"
8096 objbase="$func_basename_result"
8097 case " $oldobjs " in
8098 " ") oldobjs=$obj ;;
8101 # Make sure we don't pick an alternate name that also
8103 newobj=lt$counter-$objbase
8104 func_arith $counter + 1
8105 counter=$func_arith_result
8106 case " $oldobjs " in
8107 *[\ /]"$newobj "*) ;;
8108 *) if test ! -f "$gentop/$newobj"; then break; fi ;;
8111 func_show_eval "ln $obj $gentop/$newobj || cp $obj $gentop/$newobj"
8112 oldobjs="$oldobjs $gentop/$newobj"
8114 *) oldobjs="$oldobjs $obj" ;;
8118 eval cmds=\"$old_archive_cmds\"
8121 len=$func_len_result
8122 if test "$len" -lt "$max_cmd_len" || test "$max_cmd_len" -le -1; then
8123 cmds=$old_archive_cmds
8125 # the command line is too long to link in one step, link in parts
8126 func_verbose "using piecewise archive linking..."
8131 save_oldobjs=$oldobjs
8133 # Is there a better way of finding the last object in the list?
8134 for obj in $save_oldobjs
8138 eval test_cmds=\"$old_archive_cmds\"
8139 func_len " $test_cmds"
8140 len0=$func_len_result
8142 for obj in $save_oldobjs
8145 func_arith $len + $func_len_result
8146 len=$func_arith_result
8147 func_append objlist " $obj"
8148 if test "$len" -lt "$max_cmd_len"; then
8151 # the above command should be used before it gets too long
8153 if test "$obj" = "$last_oldobj" ; then
8156 test -z "$concat_cmds" || concat_cmds=$concat_cmds~
8157 eval concat_cmds=\"\${concat_cmds}$old_archive_cmds\"
8164 if test "X$oldobjs" = "X" ; then
8165 eval cmds=\"\$concat_cmds\"
8167 eval cmds=\"\$concat_cmds~\$old_archive_cmds\"
8171 func_execute_cmds "$cmds" 'exit $?'
8174 test -n "$generated" && \
8175 func_show_eval "${RM}r$generated"
8177 # Now create the libtool archive.
8181 test "$build_old_libs" = yes && old_library="$libname.$libext"
8182 func_verbose "creating $output"
8184 # Preserve any variables that may affect compiler behavior
8185 for var in $variables_saved_for_relink; do
8186 if eval test -z \"\${$var+set}\"; then
8187 relink_command="{ test -z \"\${$var+set}\" || $lt_unset $var || { $var=; export $var; }; }; $relink_command"
8188 elif eval var_value=\$$var; test -z "$var_value"; then
8189 relink_command="$var=; export $var; $relink_command"
8191 func_quote_for_eval "$var_value"
8192 relink_command="$var=$func_quote_for_eval_result; export $var; $relink_command"
8195 # Quote the link command for shipping.
8196 relink_command="(cd `pwd`; $SHELL $progpath $preserve_args --mode=relink $libtool_args @inst_prefix_dir@)"
8197 relink_command=`$ECHO "X$relink_command" | $Xsed -e "$sed_quote_subst"`
8198 if test "$hardcode_automatic" = yes ; then
8202 # Only create the output if not a dry run.
8204 for installed in no yes; do
8205 if test "$installed" = yes; then
8206 if test -z "$install_libdir"; then
8209 output="$output_objdir/$outputname"i
8210 # Replace all uninstalled libtool libraries with the installed ones
8212 for deplib in $dependency_libs; do
8215 func_basename "$deplib"
8216 name="$func_basename_result"
8217 eval libdir=`${SED} -n -e 's/^libdir=\(.*\)$/\1/p' $deplib`
8218 test -z "$libdir" && \
8219 func_fatal_error "\`$deplib' is not a valid libtool archive"
8220 newdependency_libs="$newdependency_libs $libdir/$name"
8222 *) newdependency_libs="$newdependency_libs $deplib" ;;
8225 dependency_libs="$newdependency_libs"
8228 for lib in $dlfiles; do
8231 func_basename "$lib"
8232 name="$func_basename_result"
8233 eval libdir=`${SED} -n -e 's/^libdir=\(.*\)$/\1/p' $lib`
8234 test -z "$libdir" && \
8235 func_fatal_error "\`$lib' is not a valid libtool archive"
8236 newdlfiles="$newdlfiles $libdir/$name"
8238 *) newdlfiles="$newdlfiles $lib" ;;
8241 dlfiles="$newdlfiles"
8243 for lib in $dlprefiles; do
8246 # Only pass preopened files to the pseudo-archive (for
8247 # eventual linking with the app. that links it) if we
8248 # didn't already link the preopened objects directly into
8250 func_basename "$lib"
8251 name="$func_basename_result"
8252 eval libdir=`${SED} -n -e 's/^libdir=\(.*\)$/\1/p' $lib`
8253 test -z "$libdir" && \
8254 func_fatal_error "\`$lib' is not a valid libtool archive"
8255 newdlprefiles="$newdlprefiles $libdir/$name"
8259 dlprefiles="$newdlprefiles"
8262 for lib in $dlfiles; do
8264 [\\/]* | [A-Za-z]:[\\/]*) abs="$lib" ;;
8265 *) abs=`pwd`"/$lib" ;;
8267 newdlfiles="$newdlfiles $abs"
8269 dlfiles="$newdlfiles"
8271 for lib in $dlprefiles; do
8273 [\\/]* | [A-Za-z]:[\\/]*) abs="$lib" ;;
8274 *) abs=`pwd`"/$lib" ;;
8276 newdlprefiles="$newdlprefiles $abs"
8278 dlprefiles="$newdlprefiles"
8281 # place dlname in correct position for cygwin
8282 # In fact, it would be nice if we could use this code for all target
8283 # systems that can't hard-code library paths into their executables
8284 # and that have no shared library path variable independent of PATH,
8285 # but it turns out we can't easily determine that from inspecting
8286 # libtool variables, so we have to hard-code the OSs to which it
8287 # applies here; at the moment, that means platforms that use the PE
8288 # object format with DLL files. See the long comment at the top of
8289 # tests/bindir.at for full details.
8291 case $host,$output,$installed,$module,$dlname in
8292 *cygwin*,*lai,yes,no,*.dll | *mingw*,*lai,yes,no,*.dll | *cegcc*,*lai,yes,no,*.dll)
8293 # If a -bindir argument was supplied, place the dll there.
8294 if test "x$bindir" != x ;
8296 func_relative_path "$install_libdir" "$bindir"
8297 tdlname=$func_relative_path_result$dlname
8299 # Otherwise fall back on heuristic.
8300 tdlname=../bin/$dlname
8305 # $outputname - a libtool library file
8306 # Generated by $PROGRAM (GNU $PACKAGE$TIMESTAMP) $VERSION
8308 # Please DO NOT delete this file!
8309 # It is necessary for linking the library.
8311 # The name that we can dlopen(3).
8314 # Names of this library.
8315 library_names='$library_names'
8317 # The name of the static archive.
8318 old_library='$old_library'
8320 # Linker flags that can not go in dependency_libs.
8321 inherited_linker_flags='$new_inherited_linker_flags'
8323 # Libraries that this one depends upon.
8324 dependency_libs='$dependency_libs'
8326 # Names of additional weak libraries provided by this library
8327 weak_library_names='$weak_libs'
8329 # Version information for $libname.
8334 # Is this an already installed library?
8335 installed=$installed
8337 # Should we warn about portability when linking against -modules?
8338 shouldnotlink=$module
8340 # Files to dlopen/dlpreopen
8342 dlpreopen='$dlprefiles'
8344 # Directory that this library needs to be installed in:
8345 libdir='$install_libdir'"
8346 if test "$installed" = no && test "$need_relink" = yes; then
8348 relink_command=\"$relink_command\""
8353 # Do a symbolic link so that the libtool archive can be found in
8354 # LD_LIBRARY_PATH before the program is installed.
8355 func_show_eval '( cd "$output_objdir" && $RM "$outputname" && $LN_S "../$outputname" "$outputname" )' 'exit $?'
8361 { test "$mode" = link || test "$mode" = relink; } &&
8362 func_mode_link ${1+"$@"}
8365 # func_mode_uninstall arg...
8366 func_mode_uninstall ()
8374 # This variable tells wrapper scripts just to set variables rather
8375 # than running their programs.
8376 libtool_install_magic="$magic"
8381 -f) RM="$RM $arg"; rmforce=yes ;;
8382 -*) RM="$RM $arg" ;;
8383 *) files="$files $arg" ;;
8388 func_fatal_help "you must specify an RM program"
8392 origobjdir="$objdir"
8393 for file in $files; do
8394 func_dirname "$file" "" "."
8395 dir="$func_dirname_result"
8396 if test "X$dir" = X.; then
8397 objdir="$origobjdir"
8399 objdir="$dir/$origobjdir"
8401 func_basename "$file"
8402 name="$func_basename_result"
8403 test "$mode" = uninstall && objdir="$dir"
8405 # Remember objdir for removal later, being careful to avoid duplicates
8406 if test "$mode" = clean; then
8409 *) rmdirs="$rmdirs $objdir" ;;
8413 # Don't error if the file doesn't exist and rm -f was used.
8414 if { test -L "$file"; } >/dev/null 2>&1 ||
8415 { test -h "$file"; } >/dev/null 2>&1 ||
8416 test -f "$file"; then
8418 elif test -d "$file"; then
8421 elif test "$rmforce" = yes; then
8429 # Possibly a libtool archive, so verify it.
8430 if func_lalib_p "$file"; then
8431 func_source $dir/$name
8433 # Delete the libtool libraries and symlinks.
8434 for n in $library_names; do
8435 rmfiles="$rmfiles $objdir/$n"
8437 test -n "$old_library" && rmfiles="$rmfiles $objdir/$old_library"
8441 case " $library_names " in
8442 # " " in the beginning catches empty $dlname
8444 *) rmfiles="$rmfiles $objdir/$dlname" ;;
8446 test -n "$libdir" && rmfiles="$rmfiles $objdir/$name $objdir/${name}i"
8449 if test -n "$library_names"; then
8450 # Do each command in the postuninstall commands.
8451 func_execute_cmds "$postuninstall_cmds" 'test "$rmforce" = yes || exit_status=1'
8454 if test -n "$old_library"; then
8455 # Do each command in the old_postuninstall commands.
8456 func_execute_cmds "$old_postuninstall_cmds" 'test "$rmforce" = yes || exit_status=1'
8458 # FIXME: should reinstall the best remaining shared library.
8465 # Possibly a libtool object, so verify it.
8466 if func_lalib_p "$file"; then
8469 func_source $dir/$name
8471 # Add PIC object to the list of files to remove.
8472 if test -n "$pic_object" &&
8473 test "$pic_object" != none; then
8474 rmfiles="$rmfiles $dir/$pic_object"
8477 # Add non-PIC object to the list of files to remove.
8478 if test -n "$non_pic_object" &&
8479 test "$non_pic_object" != none; then
8480 rmfiles="$rmfiles $dir/$non_pic_object"
8486 if test "$mode" = clean ; then
8490 func_stripname '' '.exe' "$file"
8491 file=$func_stripname_result
8492 func_stripname '' '.exe' "$name"
8493 noexename=$func_stripname_result
8494 # $file with .exe has already been added to rmfiles,
8495 # add $file without .exe
8496 rmfiles="$rmfiles $file"
8499 # Do a test to see if this is a libtool program.
8500 if func_ltwrapper_p "$file"; then
8501 if func_ltwrapper_executable_p "$file"; then
8502 func_ltwrapper_scriptname "$file"
8504 func_source $func_ltwrapper_scriptname_result
8505 rmfiles="$rmfiles $func_ltwrapper_scriptname_result"
8508 func_source $dir/$noexename
8511 # note $name still contains .exe if it was in $file originally
8512 # as does the version of $file that was added into $rmfiles
8513 rmfiles="$rmfiles $objdir/$name $objdir/${name}S.${objext}"
8514 if test "$fast_install" = yes && test -n "$relink_command"; then
8515 rmfiles="$rmfiles $objdir/lt-$name"
8517 if test "X$noexename" != "X$name" ; then
8518 rmfiles="$rmfiles $objdir/lt-${noexename}.c"
8524 func_show_eval "$RM $rmfiles" 'exit_status=1'
8526 objdir="$origobjdir"
8528 # Try to remove the ${objdir}s in the directories where we deleted files
8529 for dir in $rmdirs; do
8530 if test -d "$dir"; then
8531 func_show_eval "rmdir $dir >/dev/null 2>&1"
8538 { test "$mode" = uninstall || test "$mode" = clean; } &&
8539 func_mode_uninstall ${1+"$@"}
8541 test -z "$mode" && {
8542 help="$generic_help"
8543 func_fatal_help "you must specify a MODE"
8546 test -z "$exec_cmd" && \
8547 func_fatal_help "invalid operation mode \`$mode'"
8549 if test -n "$exec_cmd"; then
8550 eval exec "$exec_cmd"
8557 # The TAGs below are defined such that we never get into a situation
8558 # in which we disable both kinds of libraries. Given conflicting
8559 # choices, we go for a static library, that is the most portable,
8560 # since we can't tell whether shared libraries were disabled because
8561 # the user asked for that or because the platform doesn't support
8562 # them. This is particularly important on AIX, because we don't
8563 # support having both static and shared libraries enabled at the same
8564 # time on that platform, so we default to a shared-only configuration.
8565 # If a disable-shared tag is given, we'll fallback to a static-only
8566 # configuration. But we'll never go from static-only to shared-only.
8568 # ### BEGIN LIBTOOL TAG CONFIG: disable-shared
8569 build_libtool_libs=no
8571 # ### END LIBTOOL TAG CONFIG: disable-shared
8573 # ### BEGIN LIBTOOL TAG CONFIG: disable-static
8574 build_old_libs=`case $build_libtool_libs in yes) echo no;; *) echo yes;; esac`
8575 # ### END LIBTOOL TAG CONFIG: disable-static