etc/services - sync with NetBSD-8
[minix.git] / external / bsd / bind / dist / ltmain.sh
blob16ddbf884b6756243e6e93772161bfe363a417b1
2 # libtool (GNU libtool) 2.4.2
3 # Written by Gordon Matzigkeit <gord@gnu.ai.mit.edu>, 1996
5 # Copyright (C) 1996, 1997, 1998, 1999, 2000, 2001, 2003, 2004, 2005, 2006,
6 # 2007, 2008, 2009, 2010, 2011 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 # --no-quiet, --no-silent
43 # print informational messages (default)
44 # --no-warn don't display warning messages
45 # --tag=TAG use configuration variables from tag TAG
46 # -v, --verbose print more informational messages than default
47 # --no-verbose don't print the extra informational messages
48 # --version print version information
49 # -h, --help, --help-all print short, long, or detailed help message
51 # MODE must be one of the following:
53 # clean remove files from the build directory
54 # compile compile a source file into a libtool object
55 # execute automatically set library path, then run a program
56 # finish complete the installation of libtool libraries
57 # install install libraries or executables
58 # link create a library or an executable
59 # uninstall remove libraries from an installed directory
61 # MODE-ARGS vary depending on the MODE. When passed as first option,
62 # `--mode=MODE' may be abbreviated as `MODE' or a unique abbreviation of that.
63 # Try `$progname --help --mode=MODE' for a more detailed description of MODE.
65 # When reporting a bug, please describe a test case to reproduce it and
66 # include the following information:
68 # host-triplet: $host
69 # shell: $SHELL
70 # compiler: $LTCC
71 # compiler flags: $LTCFLAGS
72 # linker: $LD (gnu? $with_gnu_ld)
73 # $progname: (GNU libtool) 2.4.2
74 # automake: $automake_version
75 # autoconf: $autoconf_version
77 # Report bugs to <bug-libtool@gnu.org>.
78 # GNU libtool home page: <http://www.gnu.org/software/libtool/>.
79 # General help using GNU software: <http://www.gnu.org/gethelp/>.
81 PROGRAM=libtool
82 PACKAGE=libtool
83 VERSION=2.4.2
84 TIMESTAMP=""
85 package_revision=1.3337
87 # Be Bourne compatible
88 if test -n "${ZSH_VERSION+set}" && (emulate sh) >/dev/null 2>&1; then
89 emulate sh
90 NULLCMD=:
91 # Zsh 3.x and 4.x performs word splitting on ${1+"$@"}, which
92 # is contrary to our usage. Disable this feature.
93 alias -g '${1+"$@"}'='"$@"'
94 setopt NO_GLOB_SUBST
95 else
96 case `(set -o) 2>/dev/null` in *posix*) set -o posix;; esac
98 BIN_SH=xpg4; export BIN_SH # for Tru64
99 DUALCASE=1; export DUALCASE # for MKS sh
101 # A function that is used when there is no print builtin or printf.
102 func_fallback_echo ()
104 eval 'cat <<_LTECHO_EOF
106 _LTECHO_EOF'
109 # NLS nuisances: We save the old values to restore during execute mode.
110 lt_user_locale=
111 lt_safe_locale=
112 for lt_var in LANG LANGUAGE LC_ALL LC_CTYPE LC_COLLATE LC_MESSAGES
114 eval "if test \"\${$lt_var+set}\" = set; then
115 save_$lt_var=\$$lt_var
116 $lt_var=C
117 export $lt_var
118 lt_user_locale=\"$lt_var=\\\$save_\$lt_var; \$lt_user_locale\"
119 lt_safe_locale=\"$lt_var=C; \$lt_safe_locale\"
121 done
122 LC_ALL=C
123 LANGUAGE=C
124 export LANGUAGE LC_ALL
126 $lt_unset CDPATH
129 # Work around backward compatibility issue on IRIX 6.5. On IRIX 6.4+, sh
130 # is ksh but when the shell is invoked as "sh" and the current value of
131 # the _XPG environment variable is not equal to 1 (one), the special
132 # positional parameter $0, within a function call, is the name of the
133 # function.
134 progpath="$0"
138 : ${CP="cp -f"}
139 test "${ECHO+set}" = set || ECHO=${as_echo-'printf %s\n'}
140 : ${MAKE="make"}
141 : ${MKDIR="mkdir"}
142 : ${MV="mv -f"}
143 : ${RM="rm -f"}
144 : ${SHELL="${CONFIG_SHELL-/bin/sh}"}
145 : ${Xsed="$SED -e 1s/^X//"}
147 # Global variables:
148 EXIT_SUCCESS=0
149 EXIT_FAILURE=1
150 EXIT_MISMATCH=63 # $? = 63 is used to indicate version mismatch to missing.
151 EXIT_SKIP=77 # $? = 77 is used to indicate a skipped test to automake.
153 exit_status=$EXIT_SUCCESS
155 # Make sure IFS has a sensible default
156 lt_nl='
158 IFS=" $lt_nl"
160 dirname="s,/[^/]*$,,"
161 basename="s,^.*/,,"
163 # func_dirname file append nondir_replacement
164 # Compute the dirname of FILE. If nonempty, add APPEND to the result,
165 # otherwise set result to NONDIR_REPLACEMENT.
166 func_dirname ()
168 func_dirname_result=`$ECHO "${1}" | $SED "$dirname"`
169 if test "X$func_dirname_result" = "X${1}"; then
170 func_dirname_result="${3}"
171 else
172 func_dirname_result="$func_dirname_result${2}"
174 } # func_dirname may be replaced by extended shell implementation
177 # func_basename file
178 func_basename ()
180 func_basename_result=`$ECHO "${1}" | $SED "$basename"`
181 } # func_basename may be replaced by extended shell implementation
184 # func_dirname_and_basename file append nondir_replacement
185 # perform func_basename and func_dirname in a single function
186 # call:
187 # dirname: Compute the dirname of FILE. If nonempty,
188 # add APPEND to the result, otherwise set result
189 # to NONDIR_REPLACEMENT.
190 # value returned in "$func_dirname_result"
191 # basename: Compute filename of FILE.
192 # value retuned in "$func_basename_result"
193 # Implementation must be kept synchronized with func_dirname
194 # and func_basename. For efficiency, we do not delegate to
195 # those functions but instead duplicate the functionality here.
196 func_dirname_and_basename ()
198 # Extract subdirectory from the argument.
199 func_dirname_result=`$ECHO "${1}" | $SED -e "$dirname"`
200 if test "X$func_dirname_result" = "X${1}"; then
201 func_dirname_result="${3}"
202 else
203 func_dirname_result="$func_dirname_result${2}"
205 func_basename_result=`$ECHO "${1}" | $SED -e "$basename"`
206 } # func_dirname_and_basename may be replaced by extended shell implementation
209 # func_stripname prefix suffix name
210 # strip PREFIX and SUFFIX off of NAME.
211 # PREFIX and SUFFIX must not contain globbing or regex special
212 # characters, hashes, percent signs, but SUFFIX may contain a leading
213 # dot (in which case that matches only a dot).
214 # func_strip_suffix prefix name
215 func_stripname ()
217 case ${2} in
218 .*) func_stripname_result=`$ECHO "${3}" | $SED "s%^${1}%%; s%\\\\${2}\$%%"`;;
219 *) func_stripname_result=`$ECHO "${3}" | $SED "s%^${1}%%; s%${2}\$%%"`;;
220 esac
221 } # func_stripname may be replaced by extended shell implementation
224 # These SED scripts presuppose an absolute path with a trailing slash.
225 pathcar='s,^/\([^/]*\).*$,\1,'
226 pathcdr='s,^/[^/]*,,'
227 removedotparts=':dotsl
228 s@/\./@/@g
229 t dotsl
230 s,/\.$,/,'
231 collapseslashes='s@/\{1,\}@/@g'
232 finalslash='s,/*$,/,'
234 # func_normal_abspath PATH
235 # Remove doubled-up and trailing slashes, "." path components,
236 # and cancel out any ".." path components in PATH after making
237 # it an absolute path.
238 # value returned in "$func_normal_abspath_result"
239 func_normal_abspath ()
241 # Start from root dir and reassemble the path.
242 func_normal_abspath_result=
243 func_normal_abspath_tpath=$1
244 func_normal_abspath_altnamespace=
245 case $func_normal_abspath_tpath in
247 # Empty path, that just means $cwd.
248 func_stripname '' '/' "`pwd`"
249 func_normal_abspath_result=$func_stripname_result
250 return
252 # The next three entries are used to spot a run of precisely
253 # two leading slashes without using negated character classes;
254 # we take advantage of case's first-match behaviour.
255 ///*)
256 # Unusual form of absolute path, do nothing.
258 //*)
259 # Not necessarily an ordinary path; POSIX reserves leading '//'
260 # and for example Cygwin uses it to access remote file shares
261 # over CIFS/SMB, so we conserve a leading double slash if found.
262 func_normal_abspath_altnamespace=/
265 # Absolute path, do nothing.
268 # Relative path, prepend $cwd.
269 func_normal_abspath_tpath=`pwd`/$func_normal_abspath_tpath
271 esac
272 # Cancel out all the simple stuff to save iterations. We also want
273 # the path to end with a slash for ease of parsing, so make sure
274 # there is one (and only one) here.
275 func_normal_abspath_tpath=`$ECHO "$func_normal_abspath_tpath" | $SED \
276 -e "$removedotparts" -e "$collapseslashes" -e "$finalslash"`
277 while :; do
278 # Processed it all yet?
279 if test "$func_normal_abspath_tpath" = / ; then
280 # If we ascended to the root using ".." the result may be empty now.
281 if test -z "$func_normal_abspath_result" ; then
282 func_normal_abspath_result=/
284 break
286 func_normal_abspath_tcomponent=`$ECHO "$func_normal_abspath_tpath" | $SED \
287 -e "$pathcar"`
288 func_normal_abspath_tpath=`$ECHO "$func_normal_abspath_tpath" | $SED \
289 -e "$pathcdr"`
290 # Figure out what to do with it
291 case $func_normal_abspath_tcomponent in
293 # Trailing empty path component, ignore it.
296 # Parent dir; strip last assembled component from result.
297 func_dirname "$func_normal_abspath_result"
298 func_normal_abspath_result=$func_dirname_result
301 # Actual path component, append it.
302 func_normal_abspath_result=$func_normal_abspath_result/$func_normal_abspath_tcomponent
304 esac
305 done
306 # Restore leading double-slash if one was found on entry.
307 func_normal_abspath_result=$func_normal_abspath_altnamespace$func_normal_abspath_result
310 # func_relative_path SRCDIR DSTDIR
311 # generates a relative path from SRCDIR to DSTDIR, with a trailing
312 # slash if non-empty, suitable for immediately appending a filename
313 # without needing to append a separator.
314 # value returned in "$func_relative_path_result"
315 func_relative_path ()
317 func_relative_path_result=
318 func_normal_abspath "$1"
319 func_relative_path_tlibdir=$func_normal_abspath_result
320 func_normal_abspath "$2"
321 func_relative_path_tbindir=$func_normal_abspath_result
323 # Ascend the tree starting from libdir
324 while :; do
325 # check if we have found a prefix of bindir
326 case $func_relative_path_tbindir in
327 $func_relative_path_tlibdir)
328 # found an exact match
329 func_relative_path_tcancelled=
330 break
332 $func_relative_path_tlibdir*)
333 # found a matching prefix
334 func_stripname "$func_relative_path_tlibdir" '' "$func_relative_path_tbindir"
335 func_relative_path_tcancelled=$func_stripname_result
336 if test -z "$func_relative_path_result"; then
337 func_relative_path_result=.
339 break
342 func_dirname $func_relative_path_tlibdir
343 func_relative_path_tlibdir=${func_dirname_result}
344 if test "x$func_relative_path_tlibdir" = x ; then
345 # Have to descend all the way to the root!
346 func_relative_path_result=../$func_relative_path_result
347 func_relative_path_tcancelled=$func_relative_path_tbindir
348 break
350 func_relative_path_result=../$func_relative_path_result
352 esac
353 done
355 # Now calculate path; take care to avoid doubling-up slashes.
356 func_stripname '' '/' "$func_relative_path_result"
357 func_relative_path_result=$func_stripname_result
358 func_stripname '/' '/' "$func_relative_path_tcancelled"
359 if test "x$func_stripname_result" != x ; then
360 func_relative_path_result=${func_relative_path_result}/${func_stripname_result}
363 # Normalisation. If bindir is libdir, return empty string,
364 # else relative path ending with a slash; either way, target
365 # file name can be directly appended.
366 if test ! -z "$func_relative_path_result"; then
367 func_stripname './' '' "$func_relative_path_result/"
368 func_relative_path_result=$func_stripname_result
372 # The name of this program:
373 func_dirname_and_basename "$progpath"
374 progname=$func_basename_result
376 # Make sure we have an absolute path for reexecution:
377 case $progpath in
378 [\\/]*|[A-Za-z]:\\*) ;;
379 *[\\/]*)
380 progdir=$func_dirname_result
381 progdir=`cd "$progdir" && pwd`
382 progpath="$progdir/$progname"
385 save_IFS="$IFS"
386 IFS=${PATH_SEPARATOR-:}
387 for progdir in $PATH; do
388 IFS="$save_IFS"
389 test -x "$progdir/$progname" && break
390 done
391 IFS="$save_IFS"
392 test -n "$progdir" || progdir=`pwd`
393 progpath="$progdir/$progname"
395 esac
397 # Sed substitution that helps us do robust quoting. It backslashifies
398 # metacharacters that are still active within double-quoted strings.
399 Xsed="${SED}"' -e 1s/^X//'
400 sed_quote_subst='s/\([`"$\\]\)/\\\1/g'
402 # Same as above, but do not quote variable references.
403 double_quote_subst='s/\(["`\\]\)/\\\1/g'
405 # Sed substitution that turns a string into a regex matching for the
406 # string literally.
407 sed_make_literal_regex='s,[].[^$\\*\/],\\&,g'
409 # Sed substitution that converts a w32 file name or path
410 # which contains forward slashes, into one that contains
411 # (escaped) backslashes. A very naive implementation.
412 lt_sed_naive_backslashify='s|\\\\*|\\|g;s|/|\\|g;s|\\|\\\\|g'
414 # Re-`\' parameter expansions in output of double_quote_subst that were
415 # `\'-ed in input to the same. If an odd number of `\' preceded a '$'
416 # in input to double_quote_subst, that '$' was protected from expansion.
417 # Since each input `\' is now two `\'s, look for any number of runs of
418 # four `\'s followed by two `\'s and then a '$'. `\' that '$'.
419 bs='\\'
420 bs2='\\\\'
421 bs4='\\\\\\\\'
422 dollar='\$'
423 sed_double_backslash="\
424 s/$bs4/&\\
426 s/^$bs2$dollar/$bs&/
427 s/\\([^$bs]\\)$bs2$dollar/\\1$bs2$bs$dollar/g
428 s/\n//g"
430 # Standard options:
431 opt_dry_run=false
432 opt_help=false
433 opt_quiet=false
434 opt_verbose=false
435 opt_warning=:
437 # func_echo arg...
438 # Echo program name prefixed message, along with the current mode
439 # name if it has been set yet.
440 func_echo ()
442 $ECHO "$progname: ${opt_mode+$opt_mode: }$*"
445 # func_verbose arg...
446 # Echo program name prefixed message in verbose mode only.
447 func_verbose ()
449 $opt_verbose && func_echo ${1+"$@"}
451 # A bug in bash halts the script if the last line of a function
452 # fails when set -e is in force, so we need another command to
453 # work around that:
457 # func_echo_all arg...
458 # Invoke $ECHO with all args, space-separated.
459 func_echo_all ()
461 $ECHO "$*"
464 # func_error arg...
465 # Echo program name prefixed message to standard error.
466 func_error ()
468 $ECHO "$progname: ${opt_mode+$opt_mode: }"${1+"$@"} 1>&2
471 # func_warning arg...
472 # Echo program name prefixed warning message to standard error.
473 func_warning ()
475 $opt_warning && $ECHO "$progname: ${opt_mode+$opt_mode: }warning: "${1+"$@"} 1>&2
477 # bash bug again:
481 # func_fatal_error arg...
482 # Echo program name prefixed message to standard error, and exit.
483 func_fatal_error ()
485 func_error ${1+"$@"}
486 exit $EXIT_FAILURE
489 # func_fatal_help arg...
490 # Echo program name prefixed message to standard error, followed by
491 # a help hint, and exit.
492 func_fatal_help ()
494 func_error ${1+"$@"}
495 func_fatal_error "$help"
497 help="Try \`$progname --help' for more information." ## default
500 # func_grep expression filename
501 # Check whether EXPRESSION matches any line of FILENAME, without output.
502 func_grep ()
504 $GREP "$1" "$2" >/dev/null 2>&1
508 # func_mkdir_p directory-path
509 # Make sure the entire path to DIRECTORY-PATH is available.
510 func_mkdir_p ()
512 my_directory_path="$1"
513 my_dir_list=
515 if test -n "$my_directory_path" && test "$opt_dry_run" != ":"; then
517 # Protect directory names starting with `-'
518 case $my_directory_path in
519 -*) my_directory_path="./$my_directory_path" ;;
520 esac
522 # While some portion of DIR does not yet exist...
523 while test ! -d "$my_directory_path"; do
524 # ...make a list in topmost first order. Use a colon delimited
525 # list incase some portion of path contains whitespace.
526 my_dir_list="$my_directory_path:$my_dir_list"
528 # If the last portion added has no slash in it, the list is done
529 case $my_directory_path in */*) ;; *) break ;; esac
531 # ...otherwise throw away the child directory and loop
532 my_directory_path=`$ECHO "$my_directory_path" | $SED -e "$dirname"`
533 done
534 my_dir_list=`$ECHO "$my_dir_list" | $SED 's,:*$,,'`
536 save_mkdir_p_IFS="$IFS"; IFS=':'
537 for my_dir in $my_dir_list; do
538 IFS="$save_mkdir_p_IFS"
539 # mkdir can fail with a `File exist' error if two processes
540 # try to create one of the directories concurrently. Don't
541 # stop in that case!
542 $MKDIR "$my_dir" 2>/dev/null || :
543 done
544 IFS="$save_mkdir_p_IFS"
546 # Bail out if we (or some other process) failed to create a directory.
547 test -d "$my_directory_path" || \
548 func_fatal_error "Failed to create \`$1'"
553 # func_mktempdir [string]
554 # Make a temporary directory that won't clash with other running
555 # libtool processes, and avoids race conditions if possible. If
556 # given, STRING is the basename for that directory.
557 func_mktempdir ()
559 my_template="${TMPDIR-/tmp}/${1-$progname}"
561 if test "$opt_dry_run" = ":"; then
562 # Return a directory name, but don't create it in dry-run mode
563 my_tmpdir="${my_template}-$$"
564 else
566 # If mktemp works, use that first and foremost
567 my_tmpdir=`mktemp -d "${my_template}-XXXXXXXX" 2>/dev/null`
569 if test ! -d "$my_tmpdir"; then
570 # Failing that, at least try and use $RANDOM to avoid a race
571 my_tmpdir="${my_template}-${RANDOM-0}$$"
573 save_mktempdir_umask=`umask`
574 umask 0077
575 $MKDIR "$my_tmpdir"
576 umask $save_mktempdir_umask
579 # If we're not in dry-run mode, bomb out on failure
580 test -d "$my_tmpdir" || \
581 func_fatal_error "cannot create temporary directory \`$my_tmpdir'"
584 $ECHO "$my_tmpdir"
588 # func_quote_for_eval arg
589 # Aesthetically quote ARG to be evaled later.
590 # This function returns two values: FUNC_QUOTE_FOR_EVAL_RESULT
591 # is double-quoted, suitable for a subsequent eval, whereas
592 # FUNC_QUOTE_FOR_EVAL_UNQUOTED_RESULT has merely all characters
593 # which are still active within double quotes backslashified.
594 func_quote_for_eval ()
596 case $1 in
597 *[\\\`\"\$]*)
598 func_quote_for_eval_unquoted_result=`$ECHO "$1" | $SED "$sed_quote_subst"` ;;
600 func_quote_for_eval_unquoted_result="$1" ;;
601 esac
603 case $func_quote_for_eval_unquoted_result in
604 # Double-quote args containing shell metacharacters to delay
605 # word splitting, command substitution and and variable
606 # expansion for a subsequent eval.
607 # Many Bourne shells cannot handle close brackets correctly
608 # in scan sets, so we specify it separately.
609 *[\[\~\#\^\&\*\(\)\{\}\|\;\<\>\?\'\ \ ]*|*]*|"")
610 func_quote_for_eval_result="\"$func_quote_for_eval_unquoted_result\""
613 func_quote_for_eval_result="$func_quote_for_eval_unquoted_result"
614 esac
618 # func_quote_for_expand arg
619 # Aesthetically quote ARG to be evaled later; same as above,
620 # but do not quote variable references.
621 func_quote_for_expand ()
623 case $1 in
624 *[\\\`\"]*)
625 my_arg=`$ECHO "$1" | $SED \
626 -e "$double_quote_subst" -e "$sed_double_backslash"` ;;
628 my_arg="$1" ;;
629 esac
631 case $my_arg in
632 # Double-quote args containing shell metacharacters to delay
633 # word splitting and command substitution for a subsequent eval.
634 # Many Bourne shells cannot handle close brackets correctly
635 # in scan sets, so we specify it separately.
636 *[\[\~\#\^\&\*\(\)\{\}\|\;\<\>\?\'\ \ ]*|*]*|"")
637 my_arg="\"$my_arg\""
639 esac
641 func_quote_for_expand_result="$my_arg"
645 # func_show_eval cmd [fail_exp]
646 # Unless opt_silent is true, then output CMD. Then, if opt_dryrun is
647 # not true, evaluate CMD. If the evaluation of CMD fails, and FAIL_EXP
648 # is given, then evaluate it.
649 func_show_eval ()
651 my_cmd="$1"
652 my_fail_exp="${2-:}"
654 ${opt_silent-false} || {
655 func_quote_for_expand "$my_cmd"
656 eval "func_echo $func_quote_for_expand_result"
659 if ${opt_dry_run-false}; then :; else
660 eval "$my_cmd"
661 my_status=$?
662 if test "$my_status" -eq 0; then :; else
663 eval "(exit $my_status); $my_fail_exp"
669 # func_show_eval_locale cmd [fail_exp]
670 # Unless opt_silent is true, then output CMD. Then, if opt_dryrun is
671 # not true, evaluate CMD. If the evaluation of CMD fails, and FAIL_EXP
672 # is given, then evaluate it. Use the saved locale for evaluation.
673 func_show_eval_locale ()
675 my_cmd="$1"
676 my_fail_exp="${2-:}"
678 ${opt_silent-false} || {
679 func_quote_for_expand "$my_cmd"
680 eval "func_echo $func_quote_for_expand_result"
683 if ${opt_dry_run-false}; then :; else
684 eval "$lt_user_locale
685 $my_cmd"
686 my_status=$?
687 eval "$lt_safe_locale"
688 if test "$my_status" -eq 0; then :; else
689 eval "(exit $my_status); $my_fail_exp"
694 # func_tr_sh
695 # Turn $1 into a string suitable for a shell variable name.
696 # Result is stored in $func_tr_sh_result. All characters
697 # not in the set a-zA-Z0-9_ are replaced with '_'. Further,
698 # if $1 begins with a digit, a '_' is prepended as well.
699 func_tr_sh ()
701 case $1 in
702 [0-9]* | *[!a-zA-Z0-9_]*)
703 func_tr_sh_result=`$ECHO "$1" | $SED 's/^\([0-9]\)/_\1/; s/[^a-zA-Z0-9_]/_/g'`
706 func_tr_sh_result=$1
708 esac
712 # func_version
713 # Echo version message to standard output and exit.
714 func_version ()
716 $opt_debug
718 $SED -n '/(C)/!b go
719 :more
720 /\./!{
722 s/\n# / /
723 b more
726 /^# '$PROGRAM' (GNU /,/# warranty; / {
727 s/^# //
728 s/^# *$//
729 s/\((C)\)[ 0-9,-]*\( [1-9][0-9]*\)/\1\2/
731 }' < "$progpath"
732 exit $?
735 # func_usage
736 # Echo short help message to standard output and exit.
737 func_usage ()
739 $opt_debug
741 $SED -n '/^# Usage:/,/^# *.*--help/ {
742 s/^# //
743 s/^# *$//
744 s/\$progname/'$progname'/
746 }' < "$progpath"
747 echo
748 $ECHO "run \`$progname --help | more' for full usage"
749 exit $?
752 # func_help [NOEXIT]
753 # Echo long help message to standard output and exit,
754 # unless 'noexit' is passed as argument.
755 func_help ()
757 $opt_debug
759 $SED -n '/^# Usage:/,/# Report bugs to/ {
760 :print
761 s/^# //
762 s/^# *$//
763 s*\$progname*'$progname'*
764 s*\$host*'"$host"'*
765 s*\$SHELL*'"$SHELL"'*
766 s*\$LTCC*'"$LTCC"'*
767 s*\$LTCFLAGS*'"$LTCFLAGS"'*
768 s*\$LD*'"$LD"'*
769 s/\$with_gnu_ld/'"$with_gnu_ld"'/
770 s/\$automake_version/'"`(${AUTOMAKE-automake} --version) 2>/dev/null |$SED 1q`"'/
771 s/\$autoconf_version/'"`(${AUTOCONF-autoconf} --version) 2>/dev/null |$SED 1q`"'/
775 /^# .* home page:/b print
776 /^# General help using/b print
777 ' < "$progpath"
778 ret=$?
779 if test -z "$1"; then
780 exit $ret
784 # func_missing_arg argname
785 # Echo program name prefixed message to standard error and set global
786 # exit_cmd.
787 func_missing_arg ()
789 $opt_debug
791 func_error "missing argument for $1."
792 exit_cmd=exit
796 # func_split_short_opt shortopt
797 # Set func_split_short_opt_name and func_split_short_opt_arg shell
798 # variables after splitting SHORTOPT after the 2nd character.
799 func_split_short_opt ()
801 my_sed_short_opt='1s/^\(..\).*$/\1/;q'
802 my_sed_short_rest='1s/^..\(.*\)$/\1/;q'
804 func_split_short_opt_name=`$ECHO "$1" | $SED "$my_sed_short_opt"`
805 func_split_short_opt_arg=`$ECHO "$1" | $SED "$my_sed_short_rest"`
806 } # func_split_short_opt may be replaced by extended shell implementation
809 # func_split_long_opt longopt
810 # Set func_split_long_opt_name and func_split_long_opt_arg shell
811 # variables after splitting LONGOPT at the `=' sign.
812 func_split_long_opt ()
814 my_sed_long_opt='1s/^\(--[^=]*\)=.*/\1/;q'
815 my_sed_long_arg='1s/^--[^=]*=//'
817 func_split_long_opt_name=`$ECHO "$1" | $SED "$my_sed_long_opt"`
818 func_split_long_opt_arg=`$ECHO "$1" | $SED "$my_sed_long_arg"`
819 } # func_split_long_opt may be replaced by extended shell implementation
821 exit_cmd=:
827 magic="%%%MAGIC variable%%%"
828 magic_exe="%%%MAGIC EXE variable%%%"
830 # Global variables.
831 nonopt=
832 preserve_args=
833 lo2o="s/\\.lo\$/.${objext}/"
834 o2lo="s/\\.${objext}\$/.lo/"
835 extracted_archives=
836 extracted_serial=0
838 # If this variable is set in any of the actions, the command in it
839 # will be execed at the end. This prevents here-documents from being
840 # left over by shells.
841 exec_cmd=
843 # func_append var value
844 # Append VALUE to the end of shell variable VAR.
845 func_append ()
847 eval "${1}=\$${1}\${2}"
848 } # func_append may be replaced by extended shell implementation
850 # func_append_quoted var value
851 # Quote VALUE and append to the end of shell variable VAR, separated
852 # by a space.
853 func_append_quoted ()
855 func_quote_for_eval "${2}"
856 eval "${1}=\$${1}\\ \$func_quote_for_eval_result"
857 } # func_append_quoted may be replaced by extended shell implementation
860 # func_arith arithmetic-term...
861 func_arith ()
863 func_arith_result=`expr "${@}"`
864 } # func_arith may be replaced by extended shell implementation
867 # func_len string
868 # STRING may not start with a hyphen.
869 func_len ()
871 func_len_result=`expr "${1}" : ".*" 2>/dev/null || echo $max_cmd_len`
872 } # func_len may be replaced by extended shell implementation
875 # func_lo2o object
876 func_lo2o ()
878 func_lo2o_result=`$ECHO "${1}" | $SED "$lo2o"`
879 } # func_lo2o may be replaced by extended shell implementation
882 # func_xform libobj-or-source
883 func_xform ()
885 func_xform_result=`$ECHO "${1}" | $SED 's/\.[^.]*$/.lo/'`
886 } # func_xform may be replaced by extended shell implementation
889 # func_fatal_configuration arg...
890 # Echo program name prefixed message to standard error, followed by
891 # a configuration failure hint, and exit.
892 func_fatal_configuration ()
894 func_error ${1+"$@"}
895 func_error "See the $PACKAGE documentation for more information."
896 func_fatal_error "Fatal configuration error."
900 # func_config
901 # Display the configuration for all the tags in this script.
902 func_config ()
904 re_begincf='^# ### BEGIN LIBTOOL'
905 re_endcf='^# ### END LIBTOOL'
907 # Default configuration.
908 $SED "1,/$re_begincf CONFIG/d;/$re_endcf CONFIG/,\$d" < "$progpath"
910 # Now print the configurations for the tags.
911 for tagname in $taglist; do
912 $SED -n "/$re_begincf TAG CONFIG: $tagname\$/,/$re_endcf TAG CONFIG: $tagname\$/p" < "$progpath"
913 done
915 exit $?
918 # func_features
919 # Display the features supported by this script.
920 func_features ()
922 echo "host: $host"
923 if test "$build_libtool_libs" = yes; then
924 echo "enable shared libraries"
925 else
926 echo "disable shared libraries"
928 if test "$build_old_libs" = yes; then
929 echo "enable static libraries"
930 else
931 echo "disable static libraries"
934 exit $?
937 # func_enable_tag tagname
938 # Verify that TAGNAME is valid, and either flag an error and exit, or
939 # enable the TAGNAME tag. We also add TAGNAME to the global $taglist
940 # variable here.
941 func_enable_tag ()
943 # Global variable:
944 tagname="$1"
946 re_begincf="^# ### BEGIN LIBTOOL TAG CONFIG: $tagname\$"
947 re_endcf="^# ### END LIBTOOL TAG CONFIG: $tagname\$"
948 sed_extractcf="/$re_begincf/,/$re_endcf/p"
950 # Validate tagname.
951 case $tagname in
952 *[!-_A-Za-z0-9,/]*)
953 func_fatal_error "invalid tag name: $tagname"
955 esac
957 # Don't test for the "default" C tag, as we know it's
958 # there but not specially marked.
959 case $tagname in
960 CC) ;;
962 if $GREP "$re_begincf" "$progpath" >/dev/null 2>&1; then
963 taglist="$taglist $tagname"
965 # Evaluate the configuration. Be careful to quote the path
966 # and the sed script, to avoid splitting on whitespace, but
967 # also don't use non-portable quotes within backquotes within
968 # quotes we have to do it in 2 steps:
969 extractedcf=`$SED -n -e "$sed_extractcf" < "$progpath"`
970 eval "$extractedcf"
971 else
972 func_error "ignoring unknown tag $tagname"
975 esac
978 # func_check_version_match
979 # Ensure that we are using m4 macros, and libtool script from the same
980 # release of libtool.
981 func_check_version_match ()
983 if test "$package_revision" != "$macro_revision"; then
984 if test "$VERSION" != "$macro_version"; then
985 if test -z "$macro_version"; then
986 cat >&2 <<_LT_EOF
987 $progname: Version mismatch error. This is $PACKAGE $VERSION, but the
988 $progname: definition of this LT_INIT comes from an older release.
989 $progname: You should recreate aclocal.m4 with macros from $PACKAGE $VERSION
990 $progname: and run autoconf again.
991 _LT_EOF
992 else
993 cat >&2 <<_LT_EOF
994 $progname: Version mismatch error. This is $PACKAGE $VERSION, but the
995 $progname: definition of this LT_INIT comes from $PACKAGE $macro_version.
996 $progname: You should recreate aclocal.m4 with macros from $PACKAGE $VERSION
997 $progname: and run autoconf again.
998 _LT_EOF
1000 else
1001 cat >&2 <<_LT_EOF
1002 $progname: Version mismatch error. This is $PACKAGE $VERSION, revision $package_revision,
1003 $progname: but the definition of this LT_INIT comes from revision $macro_revision.
1004 $progname: You should recreate aclocal.m4 with macros from revision $package_revision
1005 $progname: of $PACKAGE $VERSION and run autoconf again.
1006 _LT_EOF
1009 exit $EXIT_MISMATCH
1014 # Shorthand for --mode=foo, only valid as the first argument
1015 case $1 in
1016 clean|clea|cle|cl)
1017 shift; set dummy --mode clean ${1+"$@"}; shift
1019 compile|compil|compi|comp|com|co|c)
1020 shift; set dummy --mode compile ${1+"$@"}; shift
1022 execute|execut|execu|exec|exe|ex|e)
1023 shift; set dummy --mode execute ${1+"$@"}; shift
1025 finish|finis|fini|fin|fi|f)
1026 shift; set dummy --mode finish ${1+"$@"}; shift
1028 install|instal|insta|inst|ins|in|i)
1029 shift; set dummy --mode install ${1+"$@"}; shift
1031 link|lin|li|l)
1032 shift; set dummy --mode link ${1+"$@"}; shift
1034 uninstall|uninstal|uninsta|uninst|unins|unin|uni|un|u)
1035 shift; set dummy --mode uninstall ${1+"$@"}; shift
1037 esac
1041 # Option defaults:
1042 opt_debug=:
1043 opt_dry_run=false
1044 opt_config=false
1045 opt_preserve_dup_deps=false
1046 opt_features=false
1047 opt_finish=false
1048 opt_help=false
1049 opt_help_all=false
1050 opt_silent=:
1051 opt_warning=:
1052 opt_verbose=:
1053 opt_silent=false
1054 opt_verbose=false
1057 # Parse options once, thoroughly. This comes as soon as possible in the
1058 # script to make things like `--version' happen as quickly as we can.
1060 # this just eases exit handling
1061 while test $# -gt 0; do
1062 opt="$1"
1063 shift
1064 case $opt in
1065 --debug|-x) opt_debug='set -x'
1066 func_echo "enabling shell trace mode"
1067 $opt_debug
1069 --dry-run|--dryrun|-n)
1070 opt_dry_run=:
1072 --config)
1073 opt_config=:
1074 func_config
1076 --dlopen|-dlopen)
1077 optarg="$1"
1078 opt_dlopen="${opt_dlopen+$opt_dlopen
1079 }$optarg"
1080 shift
1082 --preserve-dup-deps)
1083 opt_preserve_dup_deps=:
1085 --features)
1086 opt_features=:
1087 func_features
1089 --finish)
1090 opt_finish=:
1091 set dummy --mode finish ${1+"$@"}; shift
1093 --help)
1094 opt_help=:
1096 --help-all)
1097 opt_help_all=:
1098 opt_help=': help-all'
1100 --mode)
1101 test $# = 0 && func_missing_arg $opt && break
1102 optarg="$1"
1103 opt_mode="$optarg"
1104 case $optarg in
1105 # Valid mode arguments:
1106 clean|compile|execute|finish|install|link|relink|uninstall) ;;
1108 # Catch anything else as an error
1109 *) func_error "invalid argument for $opt"
1110 exit_cmd=exit
1111 break
1113 esac
1114 shift
1116 --no-silent|--no-quiet)
1117 opt_silent=false
1118 func_append preserve_args " $opt"
1120 --no-warning|--no-warn)
1121 opt_warning=false
1122 func_append preserve_args " $opt"
1124 --no-verbose)
1125 opt_verbose=false
1126 func_append preserve_args " $opt"
1128 --silent|--quiet)
1129 opt_silent=:
1130 func_append preserve_args " $opt"
1131 opt_verbose=false
1133 --verbose|-v)
1134 opt_verbose=:
1135 func_append preserve_args " $opt"
1136 opt_silent=false
1138 --tag)
1139 test $# = 0 && func_missing_arg $opt && break
1140 optarg="$1"
1141 opt_tag="$optarg"
1142 func_append preserve_args " $opt $optarg"
1143 func_enable_tag "$optarg"
1144 shift
1147 -\?|-h) func_usage ;;
1148 --help) func_help ;;
1149 --version) func_version ;;
1151 # Separate optargs to long options:
1152 --*=*)
1153 func_split_long_opt "$opt"
1154 set dummy "$func_split_long_opt_name" "$func_split_long_opt_arg" ${1+"$@"}
1155 shift
1158 # Separate non-argument short options:
1159 -\?*|-h*|-n*|-v*)
1160 func_split_short_opt "$opt"
1161 set dummy "$func_split_short_opt_name" "-$func_split_short_opt_arg" ${1+"$@"}
1162 shift
1165 --) break ;;
1166 -*) func_fatal_help "unrecognized option \`$opt'" ;;
1167 *) set dummy "$opt" ${1+"$@"}; shift; break ;;
1168 esac
1169 done
1171 # Validate options:
1173 # save first non-option argument
1174 if test "$#" -gt 0; then
1175 nonopt="$opt"
1176 shift
1179 # preserve --debug
1180 test "$opt_debug" = : || func_append preserve_args " --debug"
1182 case $host in
1183 *cygwin* | *mingw* | *pw32* | *cegcc*)
1184 # don't eliminate duplications in $postdeps and $predeps
1185 opt_duplicate_compiler_generated_deps=:
1188 opt_duplicate_compiler_generated_deps=$opt_preserve_dup_deps
1190 esac
1192 $opt_help || {
1193 # Sanity checks first:
1194 func_check_version_match
1196 if test "$build_libtool_libs" != yes && test "$build_old_libs" != yes; then
1197 func_fatal_configuration "not configured to build any kind of library"
1200 # Darwin sucks
1201 eval std_shrext=\"$shrext_cmds\"
1203 # Only execute mode is allowed to have -dlopen flags.
1204 if test -n "$opt_dlopen" && test "$opt_mode" != execute; then
1205 func_error "unrecognized option \`-dlopen'"
1206 $ECHO "$help" 1>&2
1207 exit $EXIT_FAILURE
1210 # Change the help message to a mode-specific one.
1211 generic_help="$help"
1212 help="Try \`$progname --help --mode=$opt_mode' for more information."
1216 # Bail if the options were screwed
1217 $exit_cmd $EXIT_FAILURE
1223 ## ----------- ##
1224 ## Main. ##
1225 ## ----------- ##
1227 # func_lalib_p file
1228 # True iff FILE is a libtool `.la' library or `.lo' object file.
1229 # This function is only a basic sanity check; it will hardly flush out
1230 # determined imposters.
1231 func_lalib_p ()
1233 test -f "$1" &&
1234 $SED -e 4q "$1" 2>/dev/null \
1235 | $GREP "^# Generated by .*$PACKAGE" > /dev/null 2>&1
1238 # func_lalib_unsafe_p file
1239 # True iff FILE is a libtool `.la' library or `.lo' object file.
1240 # This function implements the same check as func_lalib_p without
1241 # resorting to external programs. To this end, it redirects stdin and
1242 # closes it afterwards, without saving the original file descriptor.
1243 # As a safety measure, use it only where a negative result would be
1244 # fatal anyway. Works if `file' does not exist.
1245 func_lalib_unsafe_p ()
1247 lalib_p=no
1248 if test -f "$1" && test -r "$1" && exec 5<&0 <"$1"; then
1249 for lalib_p_l in 1 2 3 4
1251 read lalib_p_line
1252 case "$lalib_p_line" in
1253 \#\ Generated\ by\ *$PACKAGE* ) lalib_p=yes; break;;
1254 esac
1255 done
1256 exec 0<&5 5<&-
1258 test "$lalib_p" = yes
1261 # func_ltwrapper_script_p file
1262 # True iff FILE is a libtool wrapper script
1263 # This function is only a basic sanity check; it will hardly flush out
1264 # determined imposters.
1265 func_ltwrapper_script_p ()
1267 func_lalib_p "$1"
1270 # func_ltwrapper_executable_p file
1271 # True iff FILE is a libtool wrapper executable
1272 # This function is only a basic sanity check; it will hardly flush out
1273 # determined imposters.
1274 func_ltwrapper_executable_p ()
1276 func_ltwrapper_exec_suffix=
1277 case $1 in
1278 *.exe) ;;
1279 *) func_ltwrapper_exec_suffix=.exe ;;
1280 esac
1281 $GREP "$magic_exe" "$1$func_ltwrapper_exec_suffix" >/dev/null 2>&1
1284 # func_ltwrapper_scriptname file
1285 # Assumes file is an ltwrapper_executable
1286 # uses $file to determine the appropriate filename for a
1287 # temporary ltwrapper_script.
1288 func_ltwrapper_scriptname ()
1290 func_dirname_and_basename "$1" "" "."
1291 func_stripname '' '.exe' "$func_basename_result"
1292 func_ltwrapper_scriptname_result="$func_dirname_result/$objdir/${func_stripname_result}_ltshwrapper"
1295 # func_ltwrapper_p file
1296 # True iff FILE is a libtool wrapper script or wrapper executable
1297 # This function is only a basic sanity check; it will hardly flush out
1298 # determined imposters.
1299 func_ltwrapper_p ()
1301 func_ltwrapper_script_p "$1" || func_ltwrapper_executable_p "$1"
1305 # func_execute_cmds commands fail_cmd
1306 # Execute tilde-delimited COMMANDS.
1307 # If FAIL_CMD is given, eval that upon failure.
1308 # FAIL_CMD may read-access the current command in variable CMD!
1309 func_execute_cmds ()
1311 $opt_debug
1312 save_ifs=$IFS; IFS='~'
1313 for cmd in $1; do
1314 IFS=$save_ifs
1315 eval cmd=\"$cmd\"
1316 func_show_eval "$cmd" "${2-:}"
1317 done
1318 IFS=$save_ifs
1322 # func_source file
1323 # Source FILE, adding directory component if necessary.
1324 # Note that it is not necessary on cygwin/mingw to append a dot to
1325 # FILE even if both FILE and FILE.exe exist: automatic-append-.exe
1326 # behavior happens only for exec(3), not for open(2)! Also, sourcing
1327 # `FILE.' does not work on cygwin managed mounts.
1328 func_source ()
1330 $opt_debug
1331 case $1 in
1332 */* | *\\*) . "$1" ;;
1333 *) . "./$1" ;;
1334 esac
1338 # func_resolve_sysroot PATH
1339 # Replace a leading = in PATH with a sysroot. Store the result into
1340 # func_resolve_sysroot_result
1341 func_resolve_sysroot ()
1343 func_resolve_sysroot_result=$1
1344 case $func_resolve_sysroot_result in
1346 func_stripname '=' '' "$func_resolve_sysroot_result"
1347 func_resolve_sysroot_result=$lt_sysroot$func_stripname_result
1349 esac
1352 # func_replace_sysroot PATH
1353 # If PATH begins with the sysroot, replace it with = and
1354 # store the result into func_replace_sysroot_result.
1355 func_replace_sysroot ()
1357 case "$lt_sysroot:$1" in
1358 ?*:"$lt_sysroot"*)
1359 func_stripname "$lt_sysroot" '' "$1"
1360 func_replace_sysroot_result="=$func_stripname_result"
1363 # Including no sysroot.
1364 func_replace_sysroot_result=$1
1366 esac
1369 # func_infer_tag arg
1370 # Infer tagged configuration to use if any are available and
1371 # if one wasn't chosen via the "--tag" command line option.
1372 # Only attempt this if the compiler in the base compile
1373 # command doesn't match the default compiler.
1374 # arg is usually of the form 'gcc ...'
1375 func_infer_tag ()
1377 $opt_debug
1379 # FreeBSD-specific: where we install compilers with non-standard names
1380 tag_compilers_CC="*cc cc* *gcc gcc* clang"
1381 tag_compilers_CXX="*c++ c++* *g++ g++* clang++"
1382 base_compiler=`set -- "$@"; echo $1`
1384 # If $tagname isn't set, then try to infer if the default "CC" tag applies
1385 if test -z "$tagname"; then
1386 for zp in $tag_compilers_CC; do
1387 case $base_compiler in
1388 $zp) tagname="CC"; break;;
1389 esac
1390 done
1393 if test -n "$available_tags" && test -z "$tagname"; then
1394 CC_quoted=
1395 for arg in $CC; do
1396 func_append_quoted CC_quoted "$arg"
1397 done
1398 CC_expanded=`func_echo_all $CC`
1399 CC_quoted_expanded=`func_echo_all $CC_quoted`
1400 case $@ in
1401 # Blanks in the command may have been stripped by the calling shell,
1402 # but not from the CC environment variable when configure was run.
1403 " $CC "* | "$CC "* | " $CC_expanded "* | "$CC_expanded "* | \
1404 " $CC_quoted"* | "$CC_quoted "* | " $CC_quoted_expanded "* | "$CC_quoted_expanded "*) ;;
1405 # Blanks at the start of $base_compile will cause this to fail
1406 # if we don't check for them as well.
1408 for z in $available_tags; do
1409 if $GREP "^# ### BEGIN LIBTOOL TAG CONFIG: $z$" < "$progpath" > /dev/null; then
1410 # Evaluate the configuration.
1411 eval "`${SED} -n -e '/^# ### BEGIN LIBTOOL TAG CONFIG: '$z'$/,/^# ### END LIBTOOL TAG CONFIG: '$z'$/p' < $progpath`"
1412 CC_quoted=
1413 for arg in $CC; do
1414 # Double-quote args containing other shell metacharacters.
1415 func_append_quoted CC_quoted "$arg"
1416 done
1417 CC_expanded=`func_echo_all $CC`
1418 CC_quoted_expanded=`func_echo_all $CC_quoted`
1419 case "$@ " in
1420 " $CC "* | "$CC "* | " $CC_expanded "* | "$CC_expanded "* | \
1421 " $CC_quoted"* | "$CC_quoted "* | " $CC_quoted_expanded "* | "$CC_quoted_expanded "*)
1422 # The compiler in the base compile command matches
1423 # the one in the tagged configuration.
1424 # Assume this is the tagged configuration we want.
1425 tagname=$z
1426 break
1428 esac
1430 # FreeBSD-specific: try compilers based on inferred tag
1431 if test -z "$tagname"; then
1432 eval "tag_compilers=\$tag_compilers_${z}"
1433 if test -n "$tag_compilers"; then
1434 for zp in $tag_compilers; do
1435 case $base_compiler in
1436 $zp) tagname=$z; break;;
1437 esac
1438 done
1439 if test -n "$tagname"; then
1440 break
1445 done
1446 # If $tagname still isn't set, then no tagged configuration
1447 # was found and let the user know that the "--tag" command
1448 # line option must be used.
1449 if test -z "$tagname"; then
1450 func_echo "unable to infer tagged configuration"
1451 func_fatal_error "specify a tag with \`--tag'"
1452 # else
1453 # func_verbose "using $tagname tagged configuration"
1456 esac
1462 # func_write_libtool_object output_name pic_name nonpic_name
1463 # Create a libtool object file (analogous to a ".la" file),
1464 # but don't create it if we're doing a dry run.
1465 func_write_libtool_object ()
1467 write_libobj=${1}
1468 if test "$build_libtool_libs" = yes; then
1469 write_lobj=\'${2}\'
1470 else
1471 write_lobj=none
1474 if test "$build_old_libs" = yes; then
1475 write_oldobj=\'${3}\'
1476 else
1477 write_oldobj=none
1480 $opt_dry_run || {
1481 cat >${write_libobj}T <<EOF
1482 # $write_libobj - a libtool object file
1483 # Generated by $PROGRAM (GNU $PACKAGE$TIMESTAMP) $VERSION
1485 # Please DO NOT delete this file!
1486 # It is necessary for linking the library.
1488 # Name of the PIC object.
1489 pic_object=$write_lobj
1491 # Name of the non-PIC object
1492 non_pic_object=$write_oldobj
1495 $MV "${write_libobj}T" "${write_libobj}"
1500 ##################################################
1501 # FILE NAME AND PATH CONVERSION HELPER FUNCTIONS #
1502 ##################################################
1504 # func_convert_core_file_wine_to_w32 ARG
1505 # Helper function used by file name conversion functions when $build is *nix,
1506 # and $host is mingw, cygwin, or some other w32 environment. Relies on a
1507 # correctly configured wine environment available, with the winepath program
1508 # in $build's $PATH.
1510 # ARG is the $build file name to be converted to w32 format.
1511 # Result is available in $func_convert_core_file_wine_to_w32_result, and will
1512 # be empty on error (or when ARG is empty)
1513 func_convert_core_file_wine_to_w32 ()
1515 $opt_debug
1516 func_convert_core_file_wine_to_w32_result="$1"
1517 if test -n "$1"; then
1518 # Unfortunately, winepath does not exit with a non-zero error code, so we
1519 # are forced to check the contents of stdout. On the other hand, if the
1520 # command is not found, the shell will set an exit code of 127 and print
1521 # *an error message* to stdout. So we must check for both error code of
1522 # zero AND non-empty stdout, which explains the odd construction:
1523 func_convert_core_file_wine_to_w32_tmp=`winepath -w "$1" 2>/dev/null`
1524 if test "$?" -eq 0 && test -n "${func_convert_core_file_wine_to_w32_tmp}"; then
1525 func_convert_core_file_wine_to_w32_result=`$ECHO "$func_convert_core_file_wine_to_w32_tmp" |
1526 $SED -e "$lt_sed_naive_backslashify"`
1527 else
1528 func_convert_core_file_wine_to_w32_result=
1532 # end: func_convert_core_file_wine_to_w32
1535 # func_convert_core_path_wine_to_w32 ARG
1536 # Helper function used by path conversion functions when $build is *nix, and
1537 # $host is mingw, cygwin, or some other w32 environment. Relies on a correctly
1538 # configured wine environment available, with the winepath program in $build's
1539 # $PATH. Assumes ARG has no leading or trailing path separator characters.
1541 # ARG is path to be converted from $build format to win32.
1542 # Result is available in $func_convert_core_path_wine_to_w32_result.
1543 # Unconvertible file (directory) names in ARG are skipped; if no directory names
1544 # are convertible, then the result may be empty.
1545 func_convert_core_path_wine_to_w32 ()
1547 $opt_debug
1548 # unfortunately, winepath doesn't convert paths, only file names
1549 func_convert_core_path_wine_to_w32_result=""
1550 if test -n "$1"; then
1551 oldIFS=$IFS
1552 IFS=:
1553 for func_convert_core_path_wine_to_w32_f in $1; do
1554 IFS=$oldIFS
1555 func_convert_core_file_wine_to_w32 "$func_convert_core_path_wine_to_w32_f"
1556 if test -n "$func_convert_core_file_wine_to_w32_result" ; then
1557 if test -z "$func_convert_core_path_wine_to_w32_result"; then
1558 func_convert_core_path_wine_to_w32_result="$func_convert_core_file_wine_to_w32_result"
1559 else
1560 func_append func_convert_core_path_wine_to_w32_result ";$func_convert_core_file_wine_to_w32_result"
1563 done
1564 IFS=$oldIFS
1567 # end: func_convert_core_path_wine_to_w32
1570 # func_cygpath ARGS...
1571 # Wrapper around calling the cygpath program via LT_CYGPATH. This is used when
1572 # when (1) $build is *nix and Cygwin is hosted via a wine environment; or (2)
1573 # $build is MSYS and $host is Cygwin, or (3) $build is Cygwin. In case (1) or
1574 # (2), returns the Cygwin file name or path in func_cygpath_result (input
1575 # file name or path is assumed to be in w32 format, as previously converted
1576 # from $build's *nix or MSYS format). In case (3), returns the w32 file name
1577 # or path in func_cygpath_result (input file name or path is assumed to be in
1578 # Cygwin format). Returns an empty string on error.
1580 # ARGS are passed to cygpath, with the last one being the file name or path to
1581 # be converted.
1583 # Specify the absolute *nix (or w32) name to cygpath in the LT_CYGPATH
1584 # environment variable; do not put it in $PATH.
1585 func_cygpath ()
1587 $opt_debug
1588 if test -n "$LT_CYGPATH" && test -f "$LT_CYGPATH"; then
1589 func_cygpath_result=`$LT_CYGPATH "$@" 2>/dev/null`
1590 if test "$?" -ne 0; then
1591 # on failure, ensure result is empty
1592 func_cygpath_result=
1594 else
1595 func_cygpath_result=
1596 func_error "LT_CYGPATH is empty or specifies non-existent file: \`$LT_CYGPATH'"
1599 #end: func_cygpath
1602 # func_convert_core_msys_to_w32 ARG
1603 # Convert file name or path ARG from MSYS format to w32 format. Return
1604 # result in func_convert_core_msys_to_w32_result.
1605 func_convert_core_msys_to_w32 ()
1607 $opt_debug
1608 # awkward: cmd appends spaces to result
1609 func_convert_core_msys_to_w32_result=`( cmd //c echo "$1" ) 2>/dev/null |
1610 $SED -e 's/[ ]*$//' -e "$lt_sed_naive_backslashify"`
1612 #end: func_convert_core_msys_to_w32
1615 # func_convert_file_check ARG1 ARG2
1616 # Verify that ARG1 (a file name in $build format) was converted to $host
1617 # format in ARG2. Otherwise, emit an error message, but continue (resetting
1618 # func_to_host_file_result to ARG1).
1619 func_convert_file_check ()
1621 $opt_debug
1622 if test -z "$2" && test -n "$1" ; then
1623 func_error "Could not determine host file name corresponding to"
1624 func_error " \`$1'"
1625 func_error "Continuing, but uninstalled executables may not work."
1626 # Fallback:
1627 func_to_host_file_result="$1"
1630 # end func_convert_file_check
1633 # func_convert_path_check FROM_PATHSEP TO_PATHSEP FROM_PATH TO_PATH
1634 # Verify that FROM_PATH (a path in $build format) was converted to $host
1635 # format in TO_PATH. Otherwise, emit an error message, but continue, resetting
1636 # func_to_host_file_result to a simplistic fallback value (see below).
1637 func_convert_path_check ()
1639 $opt_debug
1640 if test -z "$4" && test -n "$3"; then
1641 func_error "Could not determine the host path corresponding to"
1642 func_error " \`$3'"
1643 func_error "Continuing, but uninstalled executables may not work."
1644 # Fallback. This is a deliberately simplistic "conversion" and
1645 # should not be "improved". See libtool.info.
1646 if test "x$1" != "x$2"; then
1647 lt_replace_pathsep_chars="s|$1|$2|g"
1648 func_to_host_path_result=`echo "$3" |
1649 $SED -e "$lt_replace_pathsep_chars"`
1650 else
1651 func_to_host_path_result="$3"
1655 # end func_convert_path_check
1658 # func_convert_path_front_back_pathsep FRONTPAT BACKPAT REPL ORIG
1659 # Modifies func_to_host_path_result by prepending REPL if ORIG matches FRONTPAT
1660 # and appending REPL if ORIG matches BACKPAT.
1661 func_convert_path_front_back_pathsep ()
1663 $opt_debug
1664 case $4 in
1665 $1 ) func_to_host_path_result="$3$func_to_host_path_result"
1667 esac
1668 case $4 in
1669 $2 ) func_append func_to_host_path_result "$3"
1671 esac
1673 # end func_convert_path_front_back_pathsep
1676 ##################################################
1677 # $build to $host FILE NAME CONVERSION FUNCTIONS #
1678 ##################################################
1679 # invoked via `$to_host_file_cmd ARG'
1681 # In each case, ARG is the path to be converted from $build to $host format.
1682 # Result will be available in $func_to_host_file_result.
1685 # func_to_host_file ARG
1686 # Converts the file name ARG from $build format to $host format. Return result
1687 # in func_to_host_file_result.
1688 func_to_host_file ()
1690 $opt_debug
1691 $to_host_file_cmd "$1"
1693 # end func_to_host_file
1696 # func_to_tool_file ARG LAZY
1697 # converts the file name ARG from $build format to toolchain format. Return
1698 # result in func_to_tool_file_result. If the conversion in use is listed
1699 # in (the comma separated) LAZY, no conversion takes place.
1700 func_to_tool_file ()
1702 $opt_debug
1703 case ,$2, in
1704 *,"$to_tool_file_cmd",*)
1705 func_to_tool_file_result=$1
1708 $to_tool_file_cmd "$1"
1709 func_to_tool_file_result=$func_to_host_file_result
1711 esac
1713 # end func_to_tool_file
1716 # func_convert_file_noop ARG
1717 # Copy ARG to func_to_host_file_result.
1718 func_convert_file_noop ()
1720 func_to_host_file_result="$1"
1722 # end func_convert_file_noop
1725 # func_convert_file_msys_to_w32 ARG
1726 # Convert file name ARG from (mingw) MSYS to (mingw) w32 format; automatic
1727 # conversion to w32 is not available inside the cwrapper. Returns result in
1728 # func_to_host_file_result.
1729 func_convert_file_msys_to_w32 ()
1731 $opt_debug
1732 func_to_host_file_result="$1"
1733 if test -n "$1"; then
1734 func_convert_core_msys_to_w32 "$1"
1735 func_to_host_file_result="$func_convert_core_msys_to_w32_result"
1737 func_convert_file_check "$1" "$func_to_host_file_result"
1739 # end func_convert_file_msys_to_w32
1742 # func_convert_file_cygwin_to_w32 ARG
1743 # Convert file name ARG from Cygwin to w32 format. Returns result in
1744 # func_to_host_file_result.
1745 func_convert_file_cygwin_to_w32 ()
1747 $opt_debug
1748 func_to_host_file_result="$1"
1749 if test -n "$1"; then
1750 # because $build is cygwin, we call "the" cygpath in $PATH; no need to use
1751 # LT_CYGPATH in this case.
1752 func_to_host_file_result=`cygpath -m "$1"`
1754 func_convert_file_check "$1" "$func_to_host_file_result"
1756 # end func_convert_file_cygwin_to_w32
1759 # func_convert_file_nix_to_w32 ARG
1760 # Convert file name ARG from *nix to w32 format. Requires a wine environment
1761 # and a working winepath. Returns result in func_to_host_file_result.
1762 func_convert_file_nix_to_w32 ()
1764 $opt_debug
1765 func_to_host_file_result="$1"
1766 if test -n "$1"; then
1767 func_convert_core_file_wine_to_w32 "$1"
1768 func_to_host_file_result="$func_convert_core_file_wine_to_w32_result"
1770 func_convert_file_check "$1" "$func_to_host_file_result"
1772 # end func_convert_file_nix_to_w32
1775 # func_convert_file_msys_to_cygwin ARG
1776 # Convert file name ARG from MSYS to Cygwin format. Requires LT_CYGPATH set.
1777 # Returns result in func_to_host_file_result.
1778 func_convert_file_msys_to_cygwin ()
1780 $opt_debug
1781 func_to_host_file_result="$1"
1782 if test -n "$1"; then
1783 func_convert_core_msys_to_w32 "$1"
1784 func_cygpath -u "$func_convert_core_msys_to_w32_result"
1785 func_to_host_file_result="$func_cygpath_result"
1787 func_convert_file_check "$1" "$func_to_host_file_result"
1789 # end func_convert_file_msys_to_cygwin
1792 # func_convert_file_nix_to_cygwin ARG
1793 # Convert file name ARG from *nix to Cygwin format. Requires Cygwin installed
1794 # in a wine environment, working winepath, and LT_CYGPATH set. Returns result
1795 # in func_to_host_file_result.
1796 func_convert_file_nix_to_cygwin ()
1798 $opt_debug
1799 func_to_host_file_result="$1"
1800 if test -n "$1"; then
1801 # convert from *nix to w32, then use cygpath to convert from w32 to cygwin.
1802 func_convert_core_file_wine_to_w32 "$1"
1803 func_cygpath -u "$func_convert_core_file_wine_to_w32_result"
1804 func_to_host_file_result="$func_cygpath_result"
1806 func_convert_file_check "$1" "$func_to_host_file_result"
1808 # end func_convert_file_nix_to_cygwin
1811 #############################################
1812 # $build to $host PATH CONVERSION FUNCTIONS #
1813 #############################################
1814 # invoked via `$to_host_path_cmd ARG'
1816 # In each case, ARG is the path to be converted from $build to $host format.
1817 # The result will be available in $func_to_host_path_result.
1819 # Path separators are also converted from $build format to $host format. If
1820 # ARG begins or ends with a path separator character, it is preserved (but
1821 # converted to $host format) on output.
1823 # All path conversion functions are named using the following convention:
1824 # file name conversion function : func_convert_file_X_to_Y ()
1825 # path conversion function : func_convert_path_X_to_Y ()
1826 # where, for any given $build/$host combination the 'X_to_Y' value is the
1827 # same. If conversion functions are added for new $build/$host combinations,
1828 # the two new functions must follow this pattern, or func_init_to_host_path_cmd
1829 # will break.
1832 # func_init_to_host_path_cmd
1833 # Ensures that function "pointer" variable $to_host_path_cmd is set to the
1834 # appropriate value, based on the value of $to_host_file_cmd.
1835 to_host_path_cmd=
1836 func_init_to_host_path_cmd ()
1838 $opt_debug
1839 if test -z "$to_host_path_cmd"; then
1840 func_stripname 'func_convert_file_' '' "$to_host_file_cmd"
1841 to_host_path_cmd="func_convert_path_${func_stripname_result}"
1846 # func_to_host_path ARG
1847 # Converts the path ARG from $build format to $host format. Return result
1848 # in func_to_host_path_result.
1849 func_to_host_path ()
1851 $opt_debug
1852 func_init_to_host_path_cmd
1853 $to_host_path_cmd "$1"
1855 # end func_to_host_path
1858 # func_convert_path_noop ARG
1859 # Copy ARG to func_to_host_path_result.
1860 func_convert_path_noop ()
1862 func_to_host_path_result="$1"
1864 # end func_convert_path_noop
1867 # func_convert_path_msys_to_w32 ARG
1868 # Convert path ARG from (mingw) MSYS to (mingw) w32 format; automatic
1869 # conversion to w32 is not available inside the cwrapper. Returns result in
1870 # func_to_host_path_result.
1871 func_convert_path_msys_to_w32 ()
1873 $opt_debug
1874 func_to_host_path_result="$1"
1875 if test -n "$1"; then
1876 # Remove leading and trailing path separator characters from ARG. MSYS
1877 # behavior is inconsistent here; cygpath turns them into '.;' and ';.';
1878 # and winepath ignores them completely.
1879 func_stripname : : "$1"
1880 func_to_host_path_tmp1=$func_stripname_result
1881 func_convert_core_msys_to_w32 "$func_to_host_path_tmp1"
1882 func_to_host_path_result="$func_convert_core_msys_to_w32_result"
1883 func_convert_path_check : ";" \
1884 "$func_to_host_path_tmp1" "$func_to_host_path_result"
1885 func_convert_path_front_back_pathsep ":*" "*:" ";" "$1"
1888 # end func_convert_path_msys_to_w32
1891 # func_convert_path_cygwin_to_w32 ARG
1892 # Convert path ARG from Cygwin to w32 format. Returns result in
1893 # func_to_host_file_result.
1894 func_convert_path_cygwin_to_w32 ()
1896 $opt_debug
1897 func_to_host_path_result="$1"
1898 if test -n "$1"; then
1899 # See func_convert_path_msys_to_w32:
1900 func_stripname : : "$1"
1901 func_to_host_path_tmp1=$func_stripname_result
1902 func_to_host_path_result=`cygpath -m -p "$func_to_host_path_tmp1"`
1903 func_convert_path_check : ";" \
1904 "$func_to_host_path_tmp1" "$func_to_host_path_result"
1905 func_convert_path_front_back_pathsep ":*" "*:" ";" "$1"
1908 # end func_convert_path_cygwin_to_w32
1911 # func_convert_path_nix_to_w32 ARG
1912 # Convert path ARG from *nix to w32 format. Requires a wine environment and
1913 # a working winepath. Returns result in func_to_host_file_result.
1914 func_convert_path_nix_to_w32 ()
1916 $opt_debug
1917 func_to_host_path_result="$1"
1918 if test -n "$1"; then
1919 # See func_convert_path_msys_to_w32:
1920 func_stripname : : "$1"
1921 func_to_host_path_tmp1=$func_stripname_result
1922 func_convert_core_path_wine_to_w32 "$func_to_host_path_tmp1"
1923 func_to_host_path_result="$func_convert_core_path_wine_to_w32_result"
1924 func_convert_path_check : ";" \
1925 "$func_to_host_path_tmp1" "$func_to_host_path_result"
1926 func_convert_path_front_back_pathsep ":*" "*:" ";" "$1"
1929 # end func_convert_path_nix_to_w32
1932 # func_convert_path_msys_to_cygwin ARG
1933 # Convert path ARG from MSYS to Cygwin format. Requires LT_CYGPATH set.
1934 # Returns result in func_to_host_file_result.
1935 func_convert_path_msys_to_cygwin ()
1937 $opt_debug
1938 func_to_host_path_result="$1"
1939 if test -n "$1"; then
1940 # See func_convert_path_msys_to_w32:
1941 func_stripname : : "$1"
1942 func_to_host_path_tmp1=$func_stripname_result
1943 func_convert_core_msys_to_w32 "$func_to_host_path_tmp1"
1944 func_cygpath -u -p "$func_convert_core_msys_to_w32_result"
1945 func_to_host_path_result="$func_cygpath_result"
1946 func_convert_path_check : : \
1947 "$func_to_host_path_tmp1" "$func_to_host_path_result"
1948 func_convert_path_front_back_pathsep ":*" "*:" : "$1"
1951 # end func_convert_path_msys_to_cygwin
1954 # func_convert_path_nix_to_cygwin ARG
1955 # Convert path ARG from *nix to Cygwin format. Requires Cygwin installed in a
1956 # a wine environment, working winepath, and LT_CYGPATH set. Returns result in
1957 # func_to_host_file_result.
1958 func_convert_path_nix_to_cygwin ()
1960 $opt_debug
1961 func_to_host_path_result="$1"
1962 if test -n "$1"; then
1963 # Remove leading and trailing path separator characters from
1964 # ARG. msys behavior is inconsistent here, cygpath turns them
1965 # into '.;' and ';.', and winepath ignores them completely.
1966 func_stripname : : "$1"
1967 func_to_host_path_tmp1=$func_stripname_result
1968 func_convert_core_path_wine_to_w32 "$func_to_host_path_tmp1"
1969 func_cygpath -u -p "$func_convert_core_path_wine_to_w32_result"
1970 func_to_host_path_result="$func_cygpath_result"
1971 func_convert_path_check : : \
1972 "$func_to_host_path_tmp1" "$func_to_host_path_result"
1973 func_convert_path_front_back_pathsep ":*" "*:" : "$1"
1976 # end func_convert_path_nix_to_cygwin
1979 # func_mode_compile arg...
1980 func_mode_compile ()
1982 $opt_debug
1983 # Get the compilation command and the source file.
1984 base_compile=
1985 srcfile="$nonopt" # always keep a non-empty value in "srcfile"
1986 suppress_opt=yes
1987 suppress_output=
1988 arg_mode=normal
1989 libobj=
1990 later=
1991 pie_flag=
1993 for arg
1995 case $arg_mode in
1996 arg )
1997 # do not "continue". Instead, add this to base_compile
1998 lastarg="$arg"
1999 arg_mode=normal
2002 target )
2003 libobj="$arg"
2004 arg_mode=normal
2005 continue
2008 normal )
2009 # Accept any command-line options.
2010 case $arg in
2012 test -n "$libobj" && \
2013 func_fatal_error "you cannot specify \`-o' more than once"
2014 arg_mode=target
2015 continue
2018 -pie | -fpie | -fPIE)
2019 func_append pie_flag " $arg"
2020 continue
2023 -shared | -static | -prefer-pic | -prefer-non-pic)
2024 func_append later " $arg"
2025 continue
2028 -no-suppress)
2029 suppress_opt=no
2030 continue
2033 -Xcompiler)
2034 arg_mode=arg # the next one goes into the "base_compile" arg list
2035 continue # The current "srcfile" will either be retained or
2036 ;; # replaced later. I would guess that would be a bug.
2038 -Wc,*)
2039 func_stripname '-Wc,' '' "$arg"
2040 args=$func_stripname_result
2041 lastarg=
2042 save_ifs="$IFS"; IFS=','
2043 for arg in $args; do
2044 IFS="$save_ifs"
2045 func_append_quoted lastarg "$arg"
2046 done
2047 IFS="$save_ifs"
2048 func_stripname ' ' '' "$lastarg"
2049 lastarg=$func_stripname_result
2051 # Add the arguments to base_compile.
2052 func_append base_compile " $lastarg"
2053 continue
2057 # Accept the current argument as the source file.
2058 # The previous "srcfile" becomes the current argument.
2060 lastarg="$srcfile"
2061 srcfile="$arg"
2063 esac # case $arg
2065 esac # case $arg_mode
2067 # Aesthetically quote the previous argument.
2068 func_append_quoted base_compile "$lastarg"
2069 done # for arg
2071 case $arg_mode in
2072 arg)
2073 func_fatal_error "you must specify an argument for -Xcompile"
2075 target)
2076 func_fatal_error "you must specify a target with \`-o'"
2079 # Get the name of the library object.
2080 test -z "$libobj" && {
2081 func_basename "$srcfile"
2082 libobj="$func_basename_result"
2085 esac
2087 # Recognize several different file suffixes.
2088 # If the user specifies -o file.o, it is replaced with file.lo
2089 case $libobj in
2090 *.[cCFSifmso] | \
2091 *.ada | *.adb | *.ads | *.asm | \
2092 *.c++ | *.cc | *.ii | *.class | *.cpp | *.cxx | \
2093 *.[fF][09]? | *.for | *.java | *.go | *.obj | *.sx | *.cu | *.cup)
2094 func_xform "$libobj"
2095 libobj=$func_xform_result
2097 esac
2099 case $libobj in
2100 *.lo) func_lo2o "$libobj"; obj=$func_lo2o_result ;;
2102 func_fatal_error "cannot determine name of library object from \`$libobj'"
2104 esac
2106 func_infer_tag $base_compile
2108 for arg in $later; do
2109 case $arg in
2110 -shared)
2111 test "$build_libtool_libs" != yes && \
2112 func_fatal_configuration "can not build a shared library"
2113 build_old_libs=no
2114 continue
2117 -static)
2118 build_libtool_libs=no
2119 build_old_libs=yes
2120 continue
2123 -prefer-pic)
2124 pic_mode=yes
2125 continue
2128 -prefer-non-pic)
2129 pic_mode=no
2130 continue
2132 esac
2133 done
2135 func_quote_for_eval "$libobj"
2136 test "X$libobj" != "X$func_quote_for_eval_result" \
2137 && $ECHO "X$libobj" | $GREP '[]~#^*{};<>?"'"'"' &()|`$[]' \
2138 && func_warning "libobj name \`$libobj' may not contain shell special characters."
2139 func_dirname_and_basename "$obj" "/" ""
2140 objname="$func_basename_result"
2141 xdir="$func_dirname_result"
2142 lobj=${xdir}$objdir/$objname
2144 test -z "$base_compile" && \
2145 func_fatal_help "you must specify a compilation command"
2147 # Delete any leftover library objects.
2148 if test "$build_old_libs" = yes; then
2149 removelist="$obj $lobj $libobj ${libobj}T"
2150 else
2151 removelist="$lobj $libobj ${libobj}T"
2154 # On Cygwin there's no "real" PIC flag so we must build both object types
2155 case $host_os in
2156 cygwin* | mingw* | pw32* | os2* | cegcc*)
2157 pic_mode=default
2159 esac
2160 if test "$pic_mode" = no && test "$deplibs_check_method" != pass_all; then
2161 # non-PIC code in shared libraries is not supported
2162 pic_mode=default
2165 # Calculate the filename of the output object if compiler does
2166 # not support -o with -c
2167 if test "$compiler_c_o" = no; then
2168 output_obj=`$ECHO "$srcfile" | $SED 's%^.*/%%; s%\.[^.]*$%%'`.${objext}
2169 lockfile="$output_obj.lock"
2170 else
2171 output_obj=
2172 need_locks=no
2173 lockfile=
2176 # Lock this critical section if it is needed
2177 # We use this script file to make the link, it avoids creating a new file
2178 if test "$need_locks" = yes; then
2179 until $opt_dry_run || ln "$progpath" "$lockfile" 2>/dev/null; do
2180 func_echo "Waiting for $lockfile to be removed"
2181 sleep 2
2182 done
2183 elif test "$need_locks" = warn; then
2184 if test -f "$lockfile"; then
2185 $ECHO "\
2186 *** ERROR, $lockfile exists and contains:
2187 `cat $lockfile 2>/dev/null`
2189 This indicates that another process is trying to use the same
2190 temporary object file, and libtool could not work around it because
2191 your compiler does not support \`-c' and \`-o' together. If you
2192 repeat this compilation, it may succeed, by chance, but you had better
2193 avoid parallel builds (make -j) in this platform, or get a better
2194 compiler."
2196 $opt_dry_run || $RM $removelist
2197 exit $EXIT_FAILURE
2199 func_append removelist " $output_obj"
2200 $ECHO "$srcfile" > "$lockfile"
2203 $opt_dry_run || $RM $removelist
2204 func_append removelist " $lockfile"
2205 trap '$opt_dry_run || $RM $removelist; exit $EXIT_FAILURE' 1 2 15
2207 func_to_tool_file "$srcfile" func_convert_file_msys_to_w32
2208 srcfile=$func_to_tool_file_result
2209 func_quote_for_eval "$srcfile"
2210 qsrcfile=$func_quote_for_eval_result
2212 # Only build a PIC object if we are building libtool libraries.
2213 if test "$build_libtool_libs" = yes; then
2214 # Without this assignment, base_compile gets emptied.
2215 fbsd_hideous_sh_bug=$base_compile
2217 if test "$pic_mode" != no; then
2218 command="$base_compile $qsrcfile $pic_flag"
2219 else
2220 # Don't build PIC code
2221 command="$base_compile $qsrcfile"
2224 func_mkdir_p "$xdir$objdir"
2226 if test -z "$output_obj"; then
2227 # Place PIC objects in $objdir
2228 func_append command " -o $lobj"
2231 func_show_eval_locale "$command" \
2232 'test -n "$output_obj" && $RM $removelist; exit $EXIT_FAILURE'
2234 if test "$need_locks" = warn &&
2235 test "X`cat $lockfile 2>/dev/null`" != "X$srcfile"; then
2236 $ECHO "\
2237 *** ERROR, $lockfile contains:
2238 `cat $lockfile 2>/dev/null`
2240 but it should contain:
2241 $srcfile
2243 This indicates that another process is trying to use the same
2244 temporary object file, and libtool could not work around it because
2245 your compiler does not support \`-c' and \`-o' together. If you
2246 repeat this compilation, it may succeed, by chance, but you had better
2247 avoid parallel builds (make -j) in this platform, or get a better
2248 compiler."
2250 $opt_dry_run || $RM $removelist
2251 exit $EXIT_FAILURE
2254 # Just move the object if needed, then go on to compile the next one
2255 if test -n "$output_obj" && test "X$output_obj" != "X$lobj"; then
2256 func_show_eval '$MV "$output_obj" "$lobj"' \
2257 'error=$?; $opt_dry_run || $RM $removelist; exit $error'
2260 # Allow error messages only from the first compilation.
2261 if test "$suppress_opt" = yes; then
2262 suppress_output=' >/dev/null 2>&1'
2266 # Only build a position-dependent object if we build old libraries.
2267 if test "$build_old_libs" = yes; then
2268 if test "$pic_mode" != yes; then
2269 # Don't build PIC code
2270 command="$base_compile $qsrcfile$pie_flag"
2271 else
2272 command="$base_compile $qsrcfile $pic_flag"
2274 if test "$compiler_c_o" = yes; then
2275 func_append command " -o $obj"
2278 # Suppress compiler output if we already did a PIC compilation.
2279 func_append command "$suppress_output"
2280 func_show_eval_locale "$command" \
2281 '$opt_dry_run || $RM $removelist; exit $EXIT_FAILURE'
2283 if test "$need_locks" = warn &&
2284 test "X`cat $lockfile 2>/dev/null`" != "X$srcfile"; then
2285 $ECHO "\
2286 *** ERROR, $lockfile contains:
2287 `cat $lockfile 2>/dev/null`
2289 but it should contain:
2290 $srcfile
2292 This indicates that another process is trying to use the same
2293 temporary object file, and libtool could not work around it because
2294 your compiler does not support \`-c' and \`-o' together. If you
2295 repeat this compilation, it may succeed, by chance, but you had better
2296 avoid parallel builds (make -j) in this platform, or get a better
2297 compiler."
2299 $opt_dry_run || $RM $removelist
2300 exit $EXIT_FAILURE
2303 # Just move the object if needed
2304 if test -n "$output_obj" && test "X$output_obj" != "X$obj"; then
2305 func_show_eval '$MV "$output_obj" "$obj"' \
2306 'error=$?; $opt_dry_run || $RM $removelist; exit $error'
2310 $opt_dry_run || {
2311 func_write_libtool_object "$libobj" "$objdir/$objname" "$objname"
2313 # Unlock the critical section if it was locked
2314 if test "$need_locks" != no; then
2315 removelist=$lockfile
2316 $RM "$lockfile"
2320 exit $EXIT_SUCCESS
2323 $opt_help || {
2324 test "$opt_mode" = compile && func_mode_compile ${1+"$@"}
2327 func_mode_help ()
2329 # We need to display help for each of the modes.
2330 case $opt_mode in
2332 # Generic help is extracted from the usage comments
2333 # at the start of this file.
2334 func_help
2337 clean)
2338 $ECHO \
2339 "Usage: $progname [OPTION]... --mode=clean RM [RM-OPTION]... FILE...
2341 Remove files from the build directory.
2343 RM is the name of the program to use to delete files associated with each FILE
2344 (typically \`/bin/rm'). RM-OPTIONS are options (such as \`-f') to be passed
2345 to RM.
2347 If FILE is a libtool library, object or program, all the files associated
2348 with it are deleted. Otherwise, only FILE itself is deleted using RM."
2351 compile)
2352 $ECHO \
2353 "Usage: $progname [OPTION]... --mode=compile COMPILE-COMMAND... SOURCEFILE
2355 Compile a source file into a libtool library object.
2357 This mode accepts the following additional options:
2359 -o OUTPUT-FILE set the output file name to OUTPUT-FILE
2360 -no-suppress do not suppress compiler output for multiple passes
2361 -prefer-pic try to build PIC objects only
2362 -prefer-non-pic try to build non-PIC objects only
2363 -shared do not build a \`.o' file suitable for static linking
2364 -static only build a \`.o' file suitable for static linking
2365 -Wc,FLAG pass FLAG directly to the compiler
2367 COMPILE-COMMAND is a command to be used in creating a \`standard' object file
2368 from the given SOURCEFILE.
2370 The output file name is determined by removing the directory component from
2371 SOURCEFILE, then substituting the C source code suffix \`.c' with the
2372 library object suffix, \`.lo'."
2375 execute)
2376 $ECHO \
2377 "Usage: $progname [OPTION]... --mode=execute COMMAND [ARGS]...
2379 Automatically set library path, then run a program.
2381 This mode accepts the following additional options:
2383 -dlopen FILE add the directory containing FILE to the library path
2385 This mode sets the library path environment variable according to \`-dlopen'
2386 flags.
2388 If any of the ARGS are libtool executable wrappers, then they are translated
2389 into their corresponding uninstalled binary, and any of their required library
2390 directories are added to the library path.
2392 Then, COMMAND is executed, with ARGS as arguments."
2395 finish)
2396 $ECHO \
2397 "Usage: $progname [OPTION]... --mode=finish [LIBDIR]...
2399 Complete the installation of libtool libraries.
2401 Each LIBDIR is a directory that contains libtool libraries.
2403 The commands that this mode executes may require superuser privileges. Use
2404 the \`--dry-run' option if you just want to see what would be executed."
2407 install)
2408 $ECHO \
2409 "Usage: $progname [OPTION]... --mode=install INSTALL-COMMAND...
2411 Install executables or libraries.
2413 INSTALL-COMMAND is the installation command. The first component should be
2414 either the \`install' or \`cp' program.
2416 The following components of INSTALL-COMMAND are treated specially:
2418 -inst-prefix-dir PREFIX-DIR Use PREFIX-DIR as a staging area for installation
2420 The rest of the components are interpreted as arguments to that command (only
2421 BSD-compatible install options are recognized)."
2424 link)
2425 $ECHO \
2426 "Usage: $progname [OPTION]... --mode=link LINK-COMMAND...
2428 Link object files or libraries together to form another library, or to
2429 create an executable program.
2431 LINK-COMMAND is a command using the C compiler that you would use to create
2432 a program from several object files.
2434 The following components of LINK-COMMAND are treated specially:
2436 -all-static do not do any dynamic linking at all
2437 -avoid-version do not add a version suffix if possible
2438 -bindir BINDIR specify path to binaries directory (for systems where
2439 libraries must be found in the PATH setting at runtime)
2440 -dlopen FILE \`-dlpreopen' FILE if it cannot be dlopened at runtime
2441 -dlpreopen FILE link in FILE and add its symbols to lt_preloaded_symbols
2442 -export-dynamic allow symbols from OUTPUT-FILE to be resolved with dlsym(3)
2443 -export-symbols SYMFILE
2444 try to export only the symbols listed in SYMFILE
2445 -export-symbols-regex REGEX
2446 try to export only the symbols matching REGEX
2447 -LLIBDIR search LIBDIR for required installed libraries
2448 -lNAME OUTPUT-FILE requires the installed library libNAME
2449 -module build a library that can dlopened
2450 -no-fast-install disable the fast-install mode
2451 -no-install link a not-installable executable
2452 -no-undefined declare that a library does not refer to external symbols
2453 -o OUTPUT-FILE create OUTPUT-FILE from the specified objects
2454 -objectlist FILE Use a list of object files found in FILE to specify objects
2455 -precious-files-regex REGEX
2456 don't remove output files matching REGEX
2457 -release RELEASE specify package release information
2458 -rpath LIBDIR the created library will eventually be installed in LIBDIR
2459 -R[ ]LIBDIR add LIBDIR to the runtime path of programs and libraries
2460 -shared only do dynamic linking of libtool libraries
2461 -shrext SUFFIX override the standard shared library file extension
2462 -static do not do any dynamic linking of uninstalled libtool libraries
2463 -static-libtool-libs
2464 do not do any dynamic linking of libtool libraries
2465 -version-info CURRENT[:REVISION[:AGE]]
2466 specify library version info [each variable defaults to 0]
2467 -weak LIBNAME declare that the target provides the LIBNAME interface
2468 -Wc,FLAG
2469 -Xcompiler FLAG pass linker-specific FLAG directly to the compiler
2470 -Wl,FLAG
2471 -Xlinker FLAG pass linker-specific FLAG directly to the linker
2472 -XCClinker FLAG pass link-specific FLAG to the compiler driver (CC)
2474 All other options (arguments beginning with \`-') are ignored.
2476 Every other argument is treated as a filename. Files ending in \`.la' are
2477 treated as uninstalled libtool libraries, other files are standard or library
2478 object files.
2480 If the OUTPUT-FILE ends in \`.la', then a libtool library is created,
2481 only library objects (\`.lo' files) may be specified, and \`-rpath' is
2482 required, except when creating a convenience library.
2484 If OUTPUT-FILE ends in \`.a' or \`.lib', then a standard library is created
2485 using \`ar' and \`ranlib', or on Windows using \`lib'.
2487 If OUTPUT-FILE ends in \`.lo' or \`.${objext}', then a reloadable object file
2488 is created, otherwise an executable program is created."
2491 uninstall)
2492 $ECHO \
2493 "Usage: $progname [OPTION]... --mode=uninstall RM [RM-OPTION]... FILE...
2495 Remove libraries from an installation directory.
2497 RM is the name of the program to use to delete files associated with each FILE
2498 (typically \`/bin/rm'). RM-OPTIONS are options (such as \`-f') to be passed
2499 to RM.
2501 If FILE is a libtool library, all the files associated with it are deleted.
2502 Otherwise, only FILE itself is deleted using RM."
2506 func_fatal_help "invalid operation mode \`$opt_mode'"
2508 esac
2510 echo
2511 $ECHO "Try \`$progname --help' for more information about other modes."
2514 # Now that we've collected a possible --mode arg, show help if necessary
2515 if $opt_help; then
2516 if test "$opt_help" = :; then
2517 func_mode_help
2518 else
2520 func_help noexit
2521 for opt_mode in compile link execute install finish uninstall clean; do
2522 func_mode_help
2523 done
2524 } | sed -n '1p; 2,$s/^Usage:/ or: /p'
2526 func_help noexit
2527 for opt_mode in compile link execute install finish uninstall clean; do
2528 echo
2529 func_mode_help
2530 done
2532 sed '1d
2533 /^When reporting/,/^Report/{
2538 /information about other modes/d
2539 /more detailed .*MODE/d
2540 s/^Usage:.*--mode=\([^ ]*\) .*/Description of \1 mode:/'
2542 exit $?
2546 # func_mode_execute arg...
2547 func_mode_execute ()
2549 $opt_debug
2550 # The first argument is the command name.
2551 cmd="$nonopt"
2552 test -z "$cmd" && \
2553 func_fatal_help "you must specify a COMMAND"
2555 # Handle -dlopen flags immediately.
2556 for file in $opt_dlopen; do
2557 test -f "$file" \
2558 || func_fatal_help "\`$file' is not a file"
2560 dir=
2561 case $file in
2562 *.la)
2563 func_resolve_sysroot "$file"
2564 file=$func_resolve_sysroot_result
2566 # Check to see that this really is a libtool archive.
2567 func_lalib_unsafe_p "$file" \
2568 || func_fatal_help "\`$lib' is not a valid libtool archive"
2570 # Read the libtool library.
2571 dlname=
2572 library_names=
2573 func_source "$file"
2575 # Skip this library if it cannot be dlopened.
2576 if test -z "$dlname"; then
2577 # Warn if it was a shared library.
2578 test -n "$library_names" && \
2579 func_warning "\`$file' was not linked with \`-export-dynamic'"
2580 continue
2583 func_dirname "$file" "" "."
2584 dir="$func_dirname_result"
2586 if test -f "$dir/$objdir/$dlname"; then
2587 func_append dir "/$objdir"
2588 else
2589 if test ! -f "$dir/$dlname"; then
2590 func_fatal_error "cannot find \`$dlname' in \`$dir' or \`$dir/$objdir'"
2595 *.lo)
2596 # Just add the directory containing the .lo file.
2597 func_dirname "$file" "" "."
2598 dir="$func_dirname_result"
2602 func_warning "\`-dlopen' is ignored for non-libtool libraries and objects"
2603 continue
2605 esac
2607 # Get the absolute pathname.
2608 absdir=`cd "$dir" && pwd`
2609 test -n "$absdir" && dir="$absdir"
2611 # Now add the directory to shlibpath_var.
2612 if eval "test -z \"\$$shlibpath_var\""; then
2613 eval "$shlibpath_var=\"\$dir\""
2614 else
2615 eval "$shlibpath_var=\"\$dir:\$$shlibpath_var\""
2617 done
2619 # This variable tells wrapper scripts just to set shlibpath_var
2620 # rather than running their programs.
2621 libtool_execute_magic="$magic"
2623 # Check if any of the arguments is a wrapper script.
2624 args=
2625 for file
2627 case $file in
2628 -* | *.la | *.lo ) ;;
2630 # Do a test to see if this is really a libtool program.
2631 if func_ltwrapper_script_p "$file"; then
2632 func_source "$file"
2633 # Transform arg to wrapped name.
2634 file="$progdir/$program"
2635 elif func_ltwrapper_executable_p "$file"; then
2636 func_ltwrapper_scriptname "$file"
2637 func_source "$func_ltwrapper_scriptname_result"
2638 # Transform arg to wrapped name.
2639 file="$progdir/$program"
2642 esac
2643 # Quote arguments (to preserve shell metacharacters).
2644 func_append_quoted args "$file"
2645 done
2647 if test "X$opt_dry_run" = Xfalse; then
2648 if test -n "$shlibpath_var"; then
2649 # Export the shlibpath_var.
2650 eval "export $shlibpath_var"
2653 # Restore saved environment variables
2654 for lt_var in LANG LANGUAGE LC_ALL LC_CTYPE LC_COLLATE LC_MESSAGES
2656 eval "if test \"\${save_$lt_var+set}\" = set; then
2657 $lt_var=\$save_$lt_var; export $lt_var
2658 else
2659 $lt_unset $lt_var
2661 done
2663 # Now prepare to actually exec the command.
2664 exec_cmd="\$cmd$args"
2665 else
2666 # Display what would be done.
2667 if test -n "$shlibpath_var"; then
2668 eval "\$ECHO \"\$shlibpath_var=\$$shlibpath_var\""
2669 echo "export $shlibpath_var"
2671 $ECHO "$cmd$args"
2672 exit $EXIT_SUCCESS
2676 test "$opt_mode" = execute && func_mode_execute ${1+"$@"}
2679 # func_mode_finish arg...
2680 func_mode_finish ()
2682 $opt_debug
2683 libs=
2684 libdirs=
2685 admincmds=
2687 for opt in "$nonopt" ${1+"$@"}
2689 if test -d "$opt"; then
2690 func_append libdirs " $opt"
2692 elif test -f "$opt"; then
2693 if func_lalib_unsafe_p "$opt"; then
2694 func_append libs " $opt"
2695 else
2696 func_warning "\`$opt' is not a valid libtool archive"
2699 else
2700 func_fatal_error "invalid argument \`$opt'"
2702 done
2704 if test -n "$libs"; then
2705 if test -n "$lt_sysroot"; then
2706 sysroot_regex=`$ECHO "$lt_sysroot" | $SED "$sed_make_literal_regex"`
2707 sysroot_cmd="s/\([ ']\)$sysroot_regex/\1/g;"
2708 else
2709 sysroot_cmd=
2712 # Remove sysroot references
2713 if $opt_dry_run; then
2714 for lib in $libs; do
2715 echo "removing references to $lt_sysroot and \`=' prefixes from $lib"
2716 done
2717 else
2718 tmpdir=`func_mktempdir`
2719 for lib in $libs; do
2720 sed -e "${sysroot_cmd} s/\([ ']-[LR]\)=/\1/g; s/\([ ']\)=/\1/g" $lib \
2721 > $tmpdir/tmp-la
2722 mv -f $tmpdir/tmp-la $lib
2723 done
2724 ${RM}r "$tmpdir"
2728 if test -n "$finish_cmds$finish_eval" && test -n "$libdirs"; then
2729 for libdir in $libdirs; do
2730 if test -n "$finish_cmds"; then
2731 # Do each command in the finish commands.
2732 func_execute_cmds "$finish_cmds" 'admincmds="$admincmds
2733 '"$cmd"'"'
2735 if test -n "$finish_eval"; then
2736 # Do the single finish_eval.
2737 eval cmds=\"$finish_eval\"
2738 $opt_dry_run || eval "$cmds" || func_append admincmds "
2739 $cmds"
2741 done
2744 # Exit here if they wanted silent mode.
2745 $opt_silent && exit $EXIT_SUCCESS
2747 if test -n "$finish_cmds$finish_eval" && test -n "$libdirs"; then
2748 echo "----------------------------------------------------------------------"
2749 echo "Libraries have been installed in:"
2750 for libdir in $libdirs; do
2751 $ECHO " $libdir"
2752 done
2753 echo
2754 echo "If you ever happen to want to link against installed libraries"
2755 echo "in a given directory, LIBDIR, you must either use libtool, and"
2756 echo "specify the full pathname of the library, or use the \`-LLIBDIR'"
2757 echo "flag during linking and do at least one of the following:"
2758 if test -n "$shlibpath_var"; then
2759 echo " - add LIBDIR to the \`$shlibpath_var' environment variable"
2760 echo " during execution"
2762 if test -n "$runpath_var"; then
2763 echo " - add LIBDIR to the \`$runpath_var' environment variable"
2764 echo " during linking"
2766 if test -n "$hardcode_libdir_flag_spec"; then
2767 libdir=LIBDIR
2768 eval flag=\"$hardcode_libdir_flag_spec\"
2770 $ECHO " - use the \`$flag' linker flag"
2772 if test -n "$admincmds"; then
2773 $ECHO " - have your system administrator run these commands:$admincmds"
2775 if test -f /etc/ld.so.conf; then
2776 echo " - have your system administrator add LIBDIR to \`/etc/ld.so.conf'"
2778 echo
2780 echo "See any operating system documentation about shared libraries for"
2781 case $host in
2782 solaris2.[6789]|solaris2.1[0-9])
2783 echo "more information, such as the ld(1), crle(1) and ld.so(8) manual"
2784 echo "pages."
2787 echo "more information, such as the ld(1) and ld.so(8) manual pages."
2789 esac
2790 echo "----------------------------------------------------------------------"
2792 exit $EXIT_SUCCESS
2795 test "$opt_mode" = finish && func_mode_finish ${1+"$@"}
2798 # func_mode_install arg...
2799 func_mode_install ()
2801 $opt_debug
2802 # There may be an optional sh(1) argument at the beginning of
2803 # install_prog (especially on Windows NT).
2804 if test "$nonopt" = "$SHELL" || test "$nonopt" = /bin/sh ||
2805 # Allow the use of GNU shtool's install command.
2806 case $nonopt in *shtool*) :;; *) false;; esac; then
2807 # Aesthetically quote it.
2808 func_quote_for_eval "$nonopt"
2809 install_prog="$func_quote_for_eval_result "
2810 arg=$1
2811 shift
2812 else
2813 install_prog=
2814 arg=$nonopt
2817 # The real first argument should be the name of the installation program.
2818 # Aesthetically quote it.
2819 func_quote_for_eval "$arg"
2820 func_append install_prog "$func_quote_for_eval_result"
2821 install_shared_prog=$install_prog
2822 case " $install_prog " in
2823 *[\\\ /]cp\ *) install_cp=: ;;
2824 *) install_cp=false ;;
2825 esac
2827 # We need to accept at least all the BSD install flags.
2828 dest=
2829 files=
2830 opts=
2831 prev=
2832 install_type=
2833 isdir=no
2834 stripme=
2835 no_mode=:
2836 for arg
2838 arg2=
2839 if test -n "$dest"; then
2840 func_append files " $dest"
2841 dest=$arg
2842 continue
2845 case $arg in
2846 -d) isdir=yes ;;
2848 if $install_cp; then :; else
2849 prev=$arg
2852 -g | -m | -o)
2853 prev=$arg
2856 stripme=" -s"
2857 continue
2862 # If the previous option needed an argument, then skip it.
2863 if test -n "$prev"; then
2864 if test "x$prev" = x-m && test -n "$install_override_mode"; then
2865 arg2=$install_override_mode
2866 no_mode=false
2868 prev=
2869 else
2870 dest=$arg
2871 continue
2874 esac
2876 # Aesthetically quote the argument.
2877 func_quote_for_eval "$arg"
2878 func_append install_prog " $func_quote_for_eval_result"
2879 if test -n "$arg2"; then
2880 func_quote_for_eval "$arg2"
2882 func_append install_shared_prog " $func_quote_for_eval_result"
2883 done
2885 test -z "$install_prog" && \
2886 func_fatal_help "you must specify an install program"
2888 test -n "$prev" && \
2889 func_fatal_help "the \`$prev' option requires an argument"
2891 if test -n "$install_override_mode" && $no_mode; then
2892 if $install_cp; then :; else
2893 func_quote_for_eval "$install_override_mode"
2894 func_append install_shared_prog " -m $func_quote_for_eval_result"
2898 if test -z "$files"; then
2899 if test -z "$dest"; then
2900 func_fatal_help "no file or destination specified"
2901 else
2902 func_fatal_help "you must specify a destination"
2906 # Strip any trailing slash from the destination.
2907 func_stripname '' '/' "$dest"
2908 dest=$func_stripname_result
2910 # Check to see that the destination is a directory.
2911 test -d "$dest" && isdir=yes
2912 if test "$isdir" = yes; then
2913 destdir="$dest"
2914 destname=
2915 else
2916 func_dirname_and_basename "$dest" "" "."
2917 destdir="$func_dirname_result"
2918 destname="$func_basename_result"
2920 # Not a directory, so check to see that there is only one file specified.
2921 set dummy $files; shift
2922 test "$#" -gt 1 && \
2923 func_fatal_help "\`$dest' is not a directory"
2925 case $destdir in
2926 [\\/]* | [A-Za-z]:[\\/]*) ;;
2928 for file in $files; do
2929 case $file in
2930 *.lo) ;;
2932 func_fatal_help "\`$destdir' must be an absolute directory name"
2934 esac
2935 done
2937 esac
2939 # This variable tells wrapper scripts just to set variables rather
2940 # than running their programs.
2941 libtool_install_magic="$magic"
2943 staticlibs=
2944 future_libdirs=
2945 current_libdirs=
2946 for file in $files; do
2948 # Do each installation.
2949 case $file in
2950 *.$libext)
2951 # Do the static libraries later.
2952 func_append staticlibs " $file"
2955 *.la)
2956 func_resolve_sysroot "$file"
2957 file=$func_resolve_sysroot_result
2959 # Check to see that this really is a libtool archive.
2960 func_lalib_unsafe_p "$file" \
2961 || func_fatal_help "\`$file' is not a valid libtool archive"
2963 library_names=
2964 old_library=
2965 relink_command=
2966 func_source "$file"
2968 # Add the libdir to current_libdirs if it is the destination.
2969 if test "X$destdir" = "X$libdir"; then
2970 case "$current_libdirs " in
2971 *" $libdir "*) ;;
2972 *) func_append current_libdirs " $libdir" ;;
2973 esac
2974 else
2975 # Note the libdir as a future libdir.
2976 case "$future_libdirs " in
2977 *" $libdir "*) ;;
2978 *) func_append future_libdirs " $libdir" ;;
2979 esac
2982 func_dirname "$file" "/" ""
2983 dir="$func_dirname_result"
2984 func_append dir "$objdir"
2986 if test -n "$relink_command"; then
2987 # Determine the prefix the user has applied to our future dir.
2988 inst_prefix_dir=`$ECHO "$destdir" | $SED -e "s%$libdir\$%%"`
2990 # Don't allow the user to place us outside of our expected
2991 # location b/c this prevents finding dependent libraries that
2992 # are installed to the same prefix.
2993 # At present, this check doesn't affect windows .dll's that
2994 # are installed into $libdir/../bin (currently, that works fine)
2995 # but it's something to keep an eye on.
2996 test "$inst_prefix_dir" = "$destdir" && \
2997 func_fatal_error "error: cannot install \`$file' to a directory not ending in $libdir"
2999 if test -n "$inst_prefix_dir"; then
3000 # Stick the inst_prefix_dir data into the link command.
3001 relink_command=`$ECHO "$relink_command" | $SED "s%@inst_prefix_dir@%-inst-prefix-dir $inst_prefix_dir%"`
3002 else
3003 relink_command=`$ECHO "$relink_command" | $SED "s%@inst_prefix_dir@%%"`
3006 func_warning "relinking \`$file'"
3007 func_show_eval "$relink_command" \
3008 'func_fatal_error "error: relink \`$file'\'' with the above command before installing it"'
3011 # See the names of the shared library.
3012 set dummy $library_names; shift
3013 if test -n "$1"; then
3014 realname="$1"
3015 shift
3017 srcname="$realname"
3018 test -n "$relink_command" && srcname="$realname"T
3020 # Install the shared library and build the symlinks.
3021 func_show_eval "$install_shared_prog $dir/$srcname $destdir/$realname" \
3022 'exit $?'
3023 tstripme="$stripme"
3024 case $host_os in
3025 cygwin* | mingw* | pw32* | cegcc*)
3026 case $realname in
3027 *.dll.a)
3028 tstripme=""
3030 esac
3032 esac
3033 if test -n "$tstripme" && test -n "$striplib"; then
3034 func_show_eval "$striplib $destdir/$realname" 'exit $?'
3037 if test "$#" -gt 0; then
3038 # Delete the old symlinks, and create new ones.
3039 # Try `ln -sf' first, because the `ln' binary might depend on
3040 # the symlink we replace! Solaris /bin/ln does not understand -f,
3041 # so we also need to try rm && ln -s.
3042 for linkname
3044 test "$linkname" != "$realname" \
3045 && func_show_eval "(cd $destdir && { $LN_S -f $realname $linkname || { $RM $linkname && $LN_S $realname $linkname; }; })"
3046 done
3049 # Do each command in the postinstall commands.
3050 lib="$destdir/$realname"
3051 func_execute_cmds "$postinstall_cmds" 'exit $?'
3054 # Install the pseudo-library for information purposes.
3055 func_basename "$file"
3056 name="$func_basename_result"
3057 instname="$dir/$name"i
3058 func_show_eval "$install_prog $instname $destdir/$name" 'exit $?'
3060 # Maybe install the static library, too.
3061 test -n "$old_library" && func_append staticlibs " $dir/$old_library"
3064 *.lo)
3065 # Install (i.e. copy) a libtool object.
3067 # Figure out destination file name, if it wasn't already specified.
3068 if test -n "$destname"; then
3069 destfile="$destdir/$destname"
3070 else
3071 func_basename "$file"
3072 destfile="$func_basename_result"
3073 destfile="$destdir/$destfile"
3076 # Deduce the name of the destination old-style object file.
3077 case $destfile in
3078 *.lo)
3079 func_lo2o "$destfile"
3080 staticdest=$func_lo2o_result
3082 *.$objext)
3083 staticdest="$destfile"
3084 destfile=
3087 func_fatal_help "cannot copy a libtool object to \`$destfile'"
3089 esac
3091 # Install the libtool object if requested.
3092 test -n "$destfile" && \
3093 func_show_eval "$install_prog $file $destfile" 'exit $?'
3095 # Install the old object if enabled.
3096 if test "$build_old_libs" = yes; then
3097 # Deduce the name of the old-style object file.
3098 func_lo2o "$file"
3099 staticobj=$func_lo2o_result
3100 func_show_eval "$install_prog \$staticobj \$staticdest" 'exit $?'
3102 exit $EXIT_SUCCESS
3106 # Figure out destination file name, if it wasn't already specified.
3107 if test -n "$destname"; then
3108 destfile="$destdir/$destname"
3109 else
3110 func_basename "$file"
3111 destfile="$func_basename_result"
3112 destfile="$destdir/$destfile"
3115 # If the file is missing, and there is a .exe on the end, strip it
3116 # because it is most likely a libtool script we actually want to
3117 # install
3118 stripped_ext=""
3119 case $file in
3120 *.exe)
3121 if test ! -f "$file"; then
3122 func_stripname '' '.exe' "$file"
3123 file=$func_stripname_result
3124 stripped_ext=".exe"
3127 esac
3129 # Do a test to see if this is really a libtool program.
3130 case $host in
3131 *cygwin* | *mingw*)
3132 if func_ltwrapper_executable_p "$file"; then
3133 func_ltwrapper_scriptname "$file"
3134 wrapper=$func_ltwrapper_scriptname_result
3135 else
3136 func_stripname '' '.exe' "$file"
3137 wrapper=$func_stripname_result
3141 wrapper=$file
3143 esac
3144 if func_ltwrapper_script_p "$wrapper"; then
3145 notinst_deplibs=
3146 relink_command=
3148 func_source "$wrapper"
3150 # Check the variables that should have been set.
3151 test -z "$generated_by_libtool_version" && \
3152 func_fatal_error "invalid libtool wrapper script \`$wrapper'"
3154 finalize=yes
3155 for lib in $notinst_deplibs; do
3156 # Check to see that each library is installed.
3157 libdir=
3158 if test -f "$lib"; then
3159 func_source "$lib"
3161 libfile="$libdir/"`$ECHO "$lib" | $SED 's%^.*/%%g'` ### testsuite: skip nested quoting test
3162 if test -n "$libdir" && test ! -f "$libfile"; then
3163 func_warning "\`$lib' has not been installed in \`$libdir'"
3164 finalize=no
3166 done
3168 relink_command=
3169 func_source "$wrapper"
3171 outputname=
3172 if test "$fast_install" = no && test -n "$relink_command"; then
3173 $opt_dry_run || {
3174 if test "$finalize" = yes; then
3175 tmpdir=`func_mktempdir`
3176 func_basename "$file$stripped_ext"
3177 file="$func_basename_result"
3178 outputname="$tmpdir/$file"
3179 # Replace the output file specification.
3180 relink_command=`$ECHO "$relink_command" | $SED 's%@OUTPUT@%'"$outputname"'%g'`
3182 $opt_silent || {
3183 func_quote_for_expand "$relink_command"
3184 eval "func_echo $func_quote_for_expand_result"
3186 if eval "$relink_command"; then :
3187 else
3188 func_error "error: relink \`$file' with the above command before installing it"
3189 $opt_dry_run || ${RM}r "$tmpdir"
3190 continue
3192 file="$outputname"
3193 else
3194 func_warning "cannot relink \`$file'"
3197 else
3198 # Install the binary that we compiled earlier.
3199 file=`$ECHO "$file$stripped_ext" | $SED "s%\([^/]*\)$%$objdir/\1%"`
3203 # remove .exe since cygwin /usr/bin/install will append another
3204 # one anyway
3205 case $install_prog,$host in
3206 */usr/bin/install*,*cygwin*)
3207 case $file:$destfile in
3208 *.exe:*.exe)
3209 # this is ok
3211 *.exe:*)
3212 destfile=$destfile.exe
3214 *:*.exe)
3215 func_stripname '' '.exe' "$destfile"
3216 destfile=$func_stripname_result
3218 esac
3220 esac
3221 func_show_eval "$install_prog\$stripme \$file \$destfile" 'exit $?'
3222 $opt_dry_run || if test -n "$outputname"; then
3223 ${RM}r "$tmpdir"
3226 esac
3227 done
3229 for file in $staticlibs; do
3230 func_basename "$file"
3231 name="$func_basename_result"
3233 # Set up the ranlib parameters.
3234 oldlib="$destdir/$name"
3235 func_to_tool_file "$oldlib" func_convert_file_msys_to_w32
3236 tool_oldlib=$func_to_tool_file_result
3238 func_show_eval "$install_prog \$file \$oldlib" 'exit $?'
3240 if test -n "$stripme" && test -n "$old_striplib"; then
3241 func_show_eval "$old_striplib $tool_oldlib" 'exit $?'
3244 # Do each command in the postinstall commands.
3245 func_execute_cmds "$old_postinstall_cmds" 'exit $?'
3246 done
3248 test -n "$future_libdirs" && \
3249 func_warning "remember to run \`$progname --finish$future_libdirs'"
3251 if test -n "$current_libdirs"; then
3252 # Maybe just do a dry run.
3253 $opt_dry_run && current_libdirs=" -n$current_libdirs"
3254 exec_cmd='$SHELL $progpath $preserve_args --finish$current_libdirs'
3255 else
3256 exit $EXIT_SUCCESS
3260 test "$opt_mode" = install && func_mode_install ${1+"$@"}
3263 # func_generate_dlsyms outputname originator pic_p
3264 # Extract symbols from dlprefiles and create ${outputname}S.o with
3265 # a dlpreopen symbol table.
3266 func_generate_dlsyms ()
3268 $opt_debug
3269 my_outputname="$1"
3270 my_originator="$2"
3271 my_pic_p="${3-no}"
3272 my_prefix=`$ECHO "$my_originator" | sed 's%[^a-zA-Z0-9]%_%g'`
3273 my_dlsyms=
3275 if test -n "$dlfiles$dlprefiles" || test "$dlself" != no; then
3276 if test -n "$NM" && test -n "$global_symbol_pipe"; then
3277 my_dlsyms="${my_outputname}S.c"
3278 else
3279 func_error "not configured to extract global symbols from dlpreopened files"
3283 if test -n "$my_dlsyms"; then
3284 case $my_dlsyms in
3285 "") ;;
3286 *.c)
3287 # Discover the nlist of each of the dlfiles.
3288 nlist="$output_objdir/${my_outputname}.nm"
3290 func_show_eval "$RM $nlist ${nlist}S ${nlist}T"
3292 # Parse the name list into a source file.
3293 func_verbose "creating $output_objdir/$my_dlsyms"
3295 $opt_dry_run || $ECHO > "$output_objdir/$my_dlsyms" "\
3296 /* $my_dlsyms - symbol resolution table for \`$my_outputname' dlsym emulation. */
3297 /* Generated by $PROGRAM (GNU $PACKAGE$TIMESTAMP) $VERSION */
3299 #ifdef __cplusplus
3300 extern \"C\" {
3301 #endif
3303 #if defined(__GNUC__) && (((__GNUC__ == 4) && (__GNUC_MINOR__ >= 4)) || (__GNUC__ > 4))
3304 #pragma GCC diagnostic ignored \"-Wstrict-prototypes\"
3305 #endif
3307 /* Keep this code in sync between libtool.m4, ltmain, lt_system.h, and tests. */
3308 #if defined(_WIN32) || defined(__CYGWIN__) || defined(_WIN32_WCE)
3309 /* DATA imports from DLLs on WIN32 con't be const, because runtime
3310 relocations are performed -- see ld's documentation on pseudo-relocs. */
3311 # define LT_DLSYM_CONST
3312 #elif defined(__osf__)
3313 /* This system does not cope well with relocations in const data. */
3314 # define LT_DLSYM_CONST
3315 #else
3316 # define LT_DLSYM_CONST const
3317 #endif
3319 /* External symbol declarations for the compiler. */\
3322 if test "$dlself" = yes; then
3323 func_verbose "generating symbol list for \`$output'"
3325 $opt_dry_run || echo ': @PROGRAM@ ' > "$nlist"
3327 # Add our own program objects to the symbol list.
3328 progfiles=`$ECHO "$objs$old_deplibs" | $SP2NL | $SED "$lo2o" | $NL2SP`
3329 for progfile in $progfiles; do
3330 func_to_tool_file "$progfile" func_convert_file_msys_to_w32
3331 func_verbose "extracting global C symbols from \`$func_to_tool_file_result'"
3332 $opt_dry_run || eval "$NM $func_to_tool_file_result | $global_symbol_pipe >> '$nlist'"
3333 done
3335 if test -n "$exclude_expsyms"; then
3336 $opt_dry_run || {
3337 eval '$EGREP -v " ($exclude_expsyms)$" "$nlist" > "$nlist"T'
3338 eval '$MV "$nlist"T "$nlist"'
3342 if test -n "$export_symbols_regex"; then
3343 $opt_dry_run || {
3344 eval '$EGREP -e "$export_symbols_regex" "$nlist" > "$nlist"T'
3345 eval '$MV "$nlist"T "$nlist"'
3349 # Prepare the list of exported symbols
3350 if test -z "$export_symbols"; then
3351 export_symbols="$output_objdir/$outputname.exp"
3352 $opt_dry_run || {
3353 $RM $export_symbols
3354 eval "${SED} -n -e '/^: @PROGRAM@ $/d' -e 's/^.* \(.*\)$/\1/p' "'< "$nlist" > "$export_symbols"'
3355 case $host in
3356 *cygwin* | *mingw* | *cegcc* )
3357 eval "echo EXPORTS "'> "$output_objdir/$outputname.def"'
3358 eval 'cat "$export_symbols" >> "$output_objdir/$outputname.def"'
3360 esac
3362 else
3363 $opt_dry_run || {
3364 eval "${SED} -e 's/\([].[*^$]\)/\\\\\1/g' -e 's/^/ /' -e 's/$/$/'"' < "$export_symbols" > "$output_objdir/$outputname.exp"'
3365 eval '$GREP -f "$output_objdir/$outputname.exp" < "$nlist" > "$nlist"T'
3366 eval '$MV "$nlist"T "$nlist"'
3367 case $host in
3368 *cygwin* | *mingw* | *cegcc* )
3369 eval "echo EXPORTS "'> "$output_objdir/$outputname.def"'
3370 eval 'cat "$nlist" >> "$output_objdir/$outputname.def"'
3372 esac
3377 for dlprefile in $dlprefiles; do
3378 func_verbose "extracting global C symbols from \`$dlprefile'"
3379 func_basename "$dlprefile"
3380 name="$func_basename_result"
3381 case $host in
3382 *cygwin* | *mingw* | *cegcc* )
3383 # if an import library, we need to obtain dlname
3384 if func_win32_import_lib_p "$dlprefile"; then
3385 func_tr_sh "$dlprefile"
3386 eval "curr_lafile=\$libfile_$func_tr_sh_result"
3387 dlprefile_dlbasename=""
3388 if test -n "$curr_lafile" && func_lalib_p "$curr_lafile"; then
3389 # Use subshell, to avoid clobbering current variable values
3390 dlprefile_dlname=`source "$curr_lafile" && echo "$dlname"`
3391 if test -n "$dlprefile_dlname" ; then
3392 func_basename "$dlprefile_dlname"
3393 dlprefile_dlbasename="$func_basename_result"
3394 else
3395 # no lafile. user explicitly requested -dlpreopen <import library>.
3396 $sharedlib_from_linklib_cmd "$dlprefile"
3397 dlprefile_dlbasename=$sharedlib_from_linklib_result
3400 $opt_dry_run || {
3401 if test -n "$dlprefile_dlbasename" ; then
3402 eval '$ECHO ": $dlprefile_dlbasename" >> "$nlist"'
3403 else
3404 func_warning "Could not compute DLL name from $name"
3405 eval '$ECHO ": $name " >> "$nlist"'
3407 func_to_tool_file "$dlprefile" func_convert_file_msys_to_w32
3408 eval "$NM \"$func_to_tool_file_result\" 2>/dev/null | $global_symbol_pipe |
3409 $SED -e '/I __imp/d' -e 's/I __nm_/D /;s/_nm__//' >> '$nlist'"
3411 else # not an import lib
3412 $opt_dry_run || {
3413 eval '$ECHO ": $name " >> "$nlist"'
3414 func_to_tool_file "$dlprefile" func_convert_file_msys_to_w32
3415 eval "$NM \"$func_to_tool_file_result\" 2>/dev/null | $global_symbol_pipe >> '$nlist'"
3420 $opt_dry_run || {
3421 eval '$ECHO ": $name " >> "$nlist"'
3422 func_to_tool_file "$dlprefile" func_convert_file_msys_to_w32
3423 eval "$NM \"$func_to_tool_file_result\" 2>/dev/null | $global_symbol_pipe >> '$nlist'"
3426 esac
3427 done
3429 $opt_dry_run || {
3430 # Make sure we have at least an empty file.
3431 test -f "$nlist" || : > "$nlist"
3433 if test -n "$exclude_expsyms"; then
3434 $EGREP -v " ($exclude_expsyms)$" "$nlist" > "$nlist"T
3435 $MV "$nlist"T "$nlist"
3438 # Try sorting and uniquifying the output.
3439 if $GREP -v "^: " < "$nlist" |
3440 if sort -k 3 </dev/null >/dev/null 2>&1; then
3441 sort -k 3
3442 else
3443 sort +2
3444 fi |
3445 uniq > "$nlist"S; then
3447 else
3448 $GREP -v "^: " < "$nlist" > "$nlist"S
3451 if test -f "$nlist"S; then
3452 eval "$global_symbol_to_cdecl"' < "$nlist"S >> "$output_objdir/$my_dlsyms"'
3453 else
3454 echo '/* NONE */' >> "$output_objdir/$my_dlsyms"
3457 echo >> "$output_objdir/$my_dlsyms" "\
3459 /* The mapping between symbol names and symbols. */
3460 typedef struct {
3461 const char *name;
3462 void *address;
3463 } lt_dlsymlist;
3464 extern LT_DLSYM_CONST lt_dlsymlist
3465 lt_${my_prefix}_LTX_preloaded_symbols[];
3466 LT_DLSYM_CONST lt_dlsymlist
3467 lt_${my_prefix}_LTX_preloaded_symbols[] =
3469 { \"$my_originator\", (void *) 0 },"
3471 case $need_lib_prefix in
3473 eval "$global_symbol_to_c_name_address" < "$nlist" >> "$output_objdir/$my_dlsyms"
3476 eval "$global_symbol_to_c_name_address_lib_prefix" < "$nlist" >> "$output_objdir/$my_dlsyms"
3478 esac
3479 echo >> "$output_objdir/$my_dlsyms" "\
3480 {0, (void *) 0}
3483 /* This works around a problem in FreeBSD linker */
3484 #ifdef FREEBSD_WORKAROUND
3485 static const void *lt_preloaded_setup() {
3486 return lt_${my_prefix}_LTX_preloaded_symbols;
3488 #endif
3490 #ifdef __cplusplus
3492 #endif\
3494 } # !$opt_dry_run
3496 pic_flag_for_symtable=
3497 case "$compile_command " in
3498 *" -static "*) ;;
3500 case $host in
3501 # compiling the symbol table file with pic_flag works around
3502 # a FreeBSD bug that causes programs to crash when -lm is
3503 # linked before any other PIC object. But we must not use
3504 # pic_flag when linking with -static. The problem exists in
3505 # FreeBSD 2.2.6 and is fixed in FreeBSD 3.1.
3506 *-*-freebsd2.*|*-*-freebsd3.0*|*-*-freebsdelf3.0*)
3507 pic_flag_for_symtable=" $pic_flag -DFREEBSD_WORKAROUND" ;;
3508 *-*-hpux*)
3509 pic_flag_for_symtable=" $pic_flag" ;;
3511 if test "X$my_pic_p" != Xno; then
3512 pic_flag_for_symtable=" $pic_flag"
3515 esac
3517 esac
3518 symtab_cflags=
3519 for arg in $LTCFLAGS; do
3520 case $arg in
3521 -pie | -fpie | -fPIE) ;;
3522 *) func_append symtab_cflags " $arg" ;;
3523 esac
3524 done
3526 # Now compile the dynamic symbol file.
3527 func_show_eval '(cd $output_objdir && $LTCC$symtab_cflags -c$no_builtin_flag$pic_flag_for_symtable "$my_dlsyms")' 'exit $?'
3529 # Clean up the generated files.
3530 func_show_eval '$RM "$output_objdir/$my_dlsyms" "$nlist" "${nlist}S" "${nlist}T"'
3532 # Transform the symbol file into the correct name.
3533 symfileobj="$output_objdir/${my_outputname}S.$objext"
3534 case $host in
3535 *cygwin* | *mingw* | *cegcc* )
3536 if test -f "$output_objdir/$my_outputname.def"; then
3537 compile_command=`$ECHO "$compile_command" | $SED "s%@SYMFILE@%$output_objdir/$my_outputname.def $symfileobj%"`
3538 finalize_command=`$ECHO "$finalize_command" | $SED "s%@SYMFILE@%$output_objdir/$my_outputname.def $symfileobj%"`
3539 else
3540 compile_command=`$ECHO "$compile_command" | $SED "s%@SYMFILE@%$symfileobj%"`
3541 finalize_command=`$ECHO "$finalize_command" | $SED "s%@SYMFILE@%$symfileobj%"`
3545 compile_command=`$ECHO "$compile_command" | $SED "s%@SYMFILE@%$symfileobj%"`
3546 finalize_command=`$ECHO "$finalize_command" | $SED "s%@SYMFILE@%$symfileobj%"`
3548 esac
3550 *-*-freebsd*)
3551 # FreeBSD doesn't need this...
3554 func_fatal_error "unknown suffix for \`$my_dlsyms'"
3556 esac
3557 else
3558 # We keep going just in case the user didn't refer to
3559 # lt_preloaded_symbols. The linker will fail if global_symbol_pipe
3560 # really was required.
3562 # Nullify the symbol file.
3563 compile_command=`$ECHO "$compile_command" | $SED "s% @SYMFILE@%%"`
3564 finalize_command=`$ECHO "$finalize_command" | $SED "s% @SYMFILE@%%"`
3568 # func_win32_libid arg
3569 # return the library type of file 'arg'
3571 # Need a lot of goo to handle *both* DLLs and import libs
3572 # Has to be a shell function in order to 'eat' the argument
3573 # that is supplied when $file_magic_command is called.
3574 # Despite the name, also deal with 64 bit binaries.
3575 func_win32_libid ()
3577 $opt_debug
3578 win32_libid_type="unknown"
3579 win32_fileres=`file -L $1 2>/dev/null`
3580 case $win32_fileres in
3581 *ar\ archive\ import\ library*) # definitely import
3582 win32_libid_type="x86 archive import"
3584 *ar\ archive*) # could be an import, or static
3585 # Keep the egrep pattern in sync with the one in _LT_CHECK_MAGIC_METHOD.
3586 if eval $OBJDUMP -f $1 | $SED -e '10q' 2>/dev/null |
3587 $EGREP 'file format (pei*-i386(.*architecture: i386)?|pe-arm-wince|pe-x86-64)' >/dev/null; then
3588 func_to_tool_file "$1" func_convert_file_msys_to_w32
3589 win32_nmres=`eval $NM -f posix -A \"$func_to_tool_file_result\" |
3590 $SED -n -e '
3591 1,100{
3592 / I /{
3593 s,.*,import,
3598 case $win32_nmres in
3599 import*) win32_libid_type="x86 archive import";;
3600 *) win32_libid_type="x86 archive static";;
3601 esac
3604 *DLL*)
3605 win32_libid_type="x86 DLL"
3607 *executable*) # but shell scripts are "executable" too...
3608 case $win32_fileres in
3609 *MS\ Windows\ PE\ Intel*)
3610 win32_libid_type="x86 DLL"
3612 esac
3614 esac
3615 $ECHO "$win32_libid_type"
3618 # func_cygming_dll_for_implib ARG
3620 # Platform-specific function to extract the
3621 # name of the DLL associated with the specified
3622 # import library ARG.
3623 # Invoked by eval'ing the libtool variable
3624 # $sharedlib_from_linklib_cmd
3625 # Result is available in the variable
3626 # $sharedlib_from_linklib_result
3627 func_cygming_dll_for_implib ()
3629 $opt_debug
3630 sharedlib_from_linklib_result=`$DLLTOOL --identify-strict --identify "$1"`
3633 # func_cygming_dll_for_implib_fallback_core SECTION_NAME LIBNAMEs
3635 # The is the core of a fallback implementation of a
3636 # platform-specific function to extract the name of the
3637 # DLL associated with the specified import library LIBNAME.
3639 # SECTION_NAME is either .idata$6 or .idata$7, depending
3640 # on the platform and compiler that created the implib.
3642 # Echos the name of the DLL associated with the
3643 # specified import library.
3644 func_cygming_dll_for_implib_fallback_core ()
3646 $opt_debug
3647 match_literal=`$ECHO "$1" | $SED "$sed_make_literal_regex"`
3648 $OBJDUMP -s --section "$1" "$2" 2>/dev/null |
3649 $SED '/^Contents of section '"$match_literal"':/{
3650 # Place marker at beginning of archive member dllname section
3651 s/.*/====MARK====/
3655 # These lines can sometimes be longer than 43 characters, but
3656 # are always uninteresting
3657 /:[ ]*file format pe[i]\{,1\}-/d
3658 /^In archive [^:]*:/d
3659 # Ensure marker is printed
3660 /^====MARK====/p
3661 # Remove all lines with less than 43 characters
3662 /^.\{43\}/!d
3663 # From remaining lines, remove first 43 characters
3664 s/^.\{43\}//' |
3665 $SED -n '
3666 # Join marker and all lines until next marker into a single line
3667 /^====MARK====/ b para
3669 $ b para
3671 :para
3673 s/\n//g
3674 # Remove the marker
3675 s/^====MARK====//
3676 # Remove trailing dots and whitespace
3677 s/[\. \t]*$//
3678 # Print
3679 /./p' |
3680 # we now have a list, one entry per line, of the stringified
3681 # contents of the appropriate section of all members of the
3682 # archive which possess that section. Heuristic: eliminate
3683 # all those which have a first or second character that is
3684 # a '.' (that is, objdump's representation of an unprintable
3685 # character.) This should work for all archives with less than
3686 # 0x302f exports -- but will fail for DLLs whose name actually
3687 # begins with a literal '.' or a single character followed by
3688 # a '.'.
3690 # Of those that remain, print the first one.
3691 $SED -e '/^\./d;/^.\./d;q'
3694 # func_cygming_gnu_implib_p ARG
3695 # This predicate returns with zero status (TRUE) if
3696 # ARG is a GNU/binutils-style import library. Returns
3697 # with nonzero status (FALSE) otherwise.
3698 func_cygming_gnu_implib_p ()
3700 $opt_debug
3701 func_to_tool_file "$1" func_convert_file_msys_to_w32
3702 func_cygming_gnu_implib_tmp=`$NM "$func_to_tool_file_result" | eval "$global_symbol_pipe" | $EGREP ' (_head_[A-Za-z0-9_]+_[ad]l*|[A-Za-z0-9_]+_[ad]l*_iname)$'`
3703 test -n "$func_cygming_gnu_implib_tmp"
3706 # func_cygming_ms_implib_p ARG
3707 # This predicate returns with zero status (TRUE) if
3708 # ARG is an MS-style import library. Returns
3709 # with nonzero status (FALSE) otherwise.
3710 func_cygming_ms_implib_p ()
3712 $opt_debug
3713 func_to_tool_file "$1" func_convert_file_msys_to_w32
3714 func_cygming_ms_implib_tmp=`$NM "$func_to_tool_file_result" | eval "$global_symbol_pipe" | $GREP '_NULL_IMPORT_DESCRIPTOR'`
3715 test -n "$func_cygming_ms_implib_tmp"
3718 # func_cygming_dll_for_implib_fallback ARG
3719 # Platform-specific function to extract the
3720 # name of the DLL associated with the specified
3721 # import library ARG.
3723 # This fallback implementation is for use when $DLLTOOL
3724 # does not support the --identify-strict option.
3725 # Invoked by eval'ing the libtool variable
3726 # $sharedlib_from_linklib_cmd
3727 # Result is available in the variable
3728 # $sharedlib_from_linklib_result
3729 func_cygming_dll_for_implib_fallback ()
3731 $opt_debug
3732 if func_cygming_gnu_implib_p "$1" ; then
3733 # binutils import library
3734 sharedlib_from_linklib_result=`func_cygming_dll_for_implib_fallback_core '.idata$7' "$1"`
3735 elif func_cygming_ms_implib_p "$1" ; then
3736 # ms-generated import library
3737 sharedlib_from_linklib_result=`func_cygming_dll_for_implib_fallback_core '.idata$6' "$1"`
3738 else
3739 # unknown
3740 sharedlib_from_linklib_result=""
3745 # func_extract_an_archive dir oldlib
3746 func_extract_an_archive ()
3748 $opt_debug
3749 f_ex_an_ar_dir="$1"; shift
3750 f_ex_an_ar_oldlib="$1"
3751 if test "$lock_old_archive_extraction" = yes; then
3752 lockfile=$f_ex_an_ar_oldlib.lock
3753 until $opt_dry_run || ln "$progpath" "$lockfile" 2>/dev/null; do
3754 func_echo "Waiting for $lockfile to be removed"
3755 sleep 2
3756 done
3758 func_show_eval "(cd \$f_ex_an_ar_dir && $AR x \"\$f_ex_an_ar_oldlib\")" \
3759 'stat=$?; rm -f "$lockfile"; exit $stat'
3760 if test "$lock_old_archive_extraction" = yes; then
3761 $opt_dry_run || rm -f "$lockfile"
3763 if ($AR t "$f_ex_an_ar_oldlib" | sort | sort -uc >/dev/null 2>&1); then
3765 else
3766 func_fatal_error "object name conflicts in archive: $f_ex_an_ar_dir/$f_ex_an_ar_oldlib"
3771 # func_extract_archives gentop oldlib ...
3772 func_extract_archives ()
3774 $opt_debug
3775 my_gentop="$1"; shift
3776 my_oldlibs=${1+"$@"}
3777 my_oldobjs=""
3778 my_xlib=""
3779 my_xabs=""
3780 my_xdir=""
3782 for my_xlib in $my_oldlibs; do
3783 # Extract the objects.
3784 case $my_xlib in
3785 [\\/]* | [A-Za-z]:[\\/]*) my_xabs="$my_xlib" ;;
3786 *) my_xabs=`pwd`"/$my_xlib" ;;
3787 esac
3788 func_basename "$my_xlib"
3789 my_xlib="$func_basename_result"
3790 my_xlib_u=$my_xlib
3791 while :; do
3792 case " $extracted_archives " in
3793 *" $my_xlib_u "*)
3794 func_arith $extracted_serial + 1
3795 extracted_serial=$func_arith_result
3796 my_xlib_u=lt$extracted_serial-$my_xlib ;;
3797 *) break ;;
3798 esac
3799 done
3800 extracted_archives="$extracted_archives $my_xlib_u"
3801 my_xdir="$my_gentop/$my_xlib_u"
3803 func_mkdir_p "$my_xdir"
3805 case $host in
3806 *-darwin*)
3807 func_verbose "Extracting $my_xabs"
3808 # Do not bother doing anything if just a dry run
3809 $opt_dry_run || {
3810 darwin_orig_dir=`pwd`
3811 cd $my_xdir || exit $?
3812 darwin_archive=$my_xabs
3813 darwin_curdir=`pwd`
3814 darwin_base_archive=`basename "$darwin_archive"`
3815 darwin_arches=`$LIPO -info "$darwin_archive" 2>/dev/null | $GREP Architectures 2>/dev/null || true`
3816 if test -n "$darwin_arches"; then
3817 darwin_arches=`$ECHO "$darwin_arches" | $SED -e 's/.*are://'`
3818 darwin_arch=
3819 func_verbose "$darwin_base_archive has multiple architectures $darwin_arches"
3820 for darwin_arch in $darwin_arches ; do
3821 func_mkdir_p "unfat-$$/${darwin_base_archive}-${darwin_arch}"
3822 $LIPO -thin $darwin_arch -output "unfat-$$/${darwin_base_archive}-${darwin_arch}/${darwin_base_archive}" "${darwin_archive}"
3823 cd "unfat-$$/${darwin_base_archive}-${darwin_arch}"
3824 func_extract_an_archive "`pwd`" "${darwin_base_archive}"
3825 cd "$darwin_curdir"
3826 $RM "unfat-$$/${darwin_base_archive}-${darwin_arch}/${darwin_base_archive}"
3827 done # $darwin_arches
3828 ## Okay now we've a bunch of thin objects, gotta fatten them up :)
3829 darwin_filelist=`find unfat-$$ -type f -name \*.o -print -o -name \*.lo -print | $SED -e "$basename" | sort -u`
3830 darwin_file=
3831 darwin_files=
3832 for darwin_file in $darwin_filelist; do
3833 darwin_files=`find unfat-$$ -name $darwin_file -print | sort | $NL2SP`
3834 $LIPO -create -output "$darwin_file" $darwin_files
3835 done # $darwin_filelist
3836 $RM -rf unfat-$$
3837 cd "$darwin_orig_dir"
3838 else
3839 cd $darwin_orig_dir
3840 func_extract_an_archive "$my_xdir" "$my_xabs"
3841 fi # $darwin_arches
3842 } # !$opt_dry_run
3845 func_extract_an_archive "$my_xdir" "$my_xabs"
3847 esac
3848 my_oldobjs="$my_oldobjs "`find $my_xdir -name \*.$objext -print -o -name \*.lo -print | sort | $NL2SP`
3849 done
3851 func_extract_archives_result="$my_oldobjs"
3855 # func_emit_wrapper [arg=no]
3857 # Emit a libtool wrapper script on stdout.
3858 # Don't directly open a file because we may want to
3859 # incorporate the script contents within a cygwin/mingw
3860 # wrapper executable. Must ONLY be called from within
3861 # func_mode_link because it depends on a number of variables
3862 # set therein.
3864 # ARG is the value that the WRAPPER_SCRIPT_BELONGS_IN_OBJDIR
3865 # variable will take. If 'yes', then the emitted script
3866 # will assume that the directory in which it is stored is
3867 # the $objdir directory. This is a cygwin/mingw-specific
3868 # behavior.
3869 func_emit_wrapper ()
3871 func_emit_wrapper_arg1=${1-no}
3873 $ECHO "\
3874 #! $SHELL
3876 # $output - temporary wrapper script for $objdir/$outputname
3877 # Generated by $PROGRAM (GNU $PACKAGE$TIMESTAMP) $VERSION
3879 # The $output program cannot be directly executed until all the libtool
3880 # libraries that it depends on are installed.
3882 # This wrapper script should never be moved out of the build directory.
3883 # If it is, it will not operate correctly.
3885 # Sed substitution that helps us do robust quoting. It backslashifies
3886 # metacharacters that are still active within double-quoted strings.
3887 sed_quote_subst='$sed_quote_subst'
3889 # Be Bourne compatible
3890 if test -n \"\${ZSH_VERSION+set}\" && (emulate sh) >/dev/null 2>&1; then
3891 emulate sh
3892 NULLCMD=:
3893 # Zsh 3.x and 4.x performs word splitting on \${1+\"\$@\"}, which
3894 # is contrary to our usage. Disable this feature.
3895 alias -g '\${1+\"\$@\"}'='\"\$@\"'
3896 setopt NO_GLOB_SUBST
3897 else
3898 case \`(set -o) 2>/dev/null\` in *posix*) set -o posix;; esac
3900 BIN_SH=xpg4; export BIN_SH # for Tru64
3901 DUALCASE=1; export DUALCASE # for MKS sh
3903 # The HP-UX ksh and POSIX shell print the target directory to stdout
3904 # if CDPATH is set.
3905 (unset CDPATH) >/dev/null 2>&1 && unset CDPATH
3907 relink_command=\"$relink_command\"
3909 # This environment variable determines our operation mode.
3910 if test \"\$libtool_install_magic\" = \"$magic\"; then
3911 # install mode needs the following variables:
3912 generated_by_libtool_version='$macro_version'
3913 notinst_deplibs='$notinst_deplibs'
3914 else
3915 # When we are sourced in execute mode, \$file and \$ECHO are already set.
3916 if test \"\$libtool_execute_magic\" != \"$magic\"; then
3917 file=\"\$0\""
3919 qECHO=`$ECHO "$ECHO" | $SED "$sed_quote_subst"`
3920 $ECHO "\
3922 # A function that is used when there is no print builtin or printf.
3923 func_fallback_echo ()
3925 eval 'cat <<_LTECHO_EOF
3927 _LTECHO_EOF'
3929 ECHO=\"$qECHO\"
3932 # Very basic option parsing. These options are (a) specific to
3933 # the libtool wrapper, (b) are identical between the wrapper
3934 # /script/ and the wrapper /executable/ which is used only on
3935 # windows platforms, and (c) all begin with the string "--lt-"
3936 # (application programs are unlikely to have options which match
3937 # this pattern).
3939 # There are only two supported options: --lt-debug and
3940 # --lt-dump-script. There is, deliberately, no --lt-help.
3942 # The first argument to this parsing function should be the
3943 # script's $0 value, followed by "$@".
3944 lt_option_debug=
3945 func_parse_lt_options ()
3947 lt_script_arg0=\$0
3948 shift
3949 for lt_opt
3951 case \"\$lt_opt\" in
3952 --lt-debug) lt_option_debug=1 ;;
3953 --lt-dump-script)
3954 lt_dump_D=\`\$ECHO \"X\$lt_script_arg0\" | $SED -e 's/^X//' -e 's%/[^/]*$%%'\`
3955 test \"X\$lt_dump_D\" = \"X\$lt_script_arg0\" && lt_dump_D=.
3956 lt_dump_F=\`\$ECHO \"X\$lt_script_arg0\" | $SED -e 's/^X//' -e 's%^.*/%%'\`
3957 cat \"\$lt_dump_D/\$lt_dump_F\"
3958 exit 0
3960 --lt-*)
3961 \$ECHO \"Unrecognized --lt- option: '\$lt_opt'\" 1>&2
3962 exit 1
3964 esac
3965 done
3967 # Print the debug banner immediately:
3968 if test -n \"\$lt_option_debug\"; then
3969 echo \"${outputname}:${output}:\${LINENO}: libtool wrapper (GNU $PACKAGE$TIMESTAMP) $VERSION\" 1>&2
3973 # Used when --lt-debug. Prints its arguments to stdout
3974 # (redirection is the responsibility of the caller)
3975 func_lt_dump_args ()
3977 lt_dump_args_N=1;
3978 for lt_arg
3980 \$ECHO \"${outputname}:${output}:\${LINENO}: newargv[\$lt_dump_args_N]: \$lt_arg\"
3981 lt_dump_args_N=\`expr \$lt_dump_args_N + 1\`
3982 done
3985 # Core function for launching the target application
3986 func_exec_program_core ()
3989 case $host in
3990 # Backslashes separate directories on plain windows
3991 *-*-mingw | *-*-os2* | *-cegcc*)
3992 $ECHO "\
3993 if test -n \"\$lt_option_debug\"; then
3994 \$ECHO \"${outputname}:${output}:\${LINENO}: newargv[0]: \$progdir\\\\\$program\" 1>&2
3995 func_lt_dump_args \${1+\"\$@\"} 1>&2
3997 exec \"\$progdir\\\\\$program\" \${1+\"\$@\"}
4002 $ECHO "\
4003 if test -n \"\$lt_option_debug\"; then
4004 \$ECHO \"${outputname}:${output}:\${LINENO}: newargv[0]: \$progdir/\$program\" 1>&2
4005 func_lt_dump_args \${1+\"\$@\"} 1>&2
4007 exec \"\$progdir/\$program\" \${1+\"\$@\"}
4010 esac
4011 $ECHO "\
4012 \$ECHO \"\$0: cannot exec \$program \$*\" 1>&2
4013 exit 1
4016 # A function to encapsulate launching the target application
4017 # Strips options in the --lt-* namespace from \$@ and
4018 # launches target application with the remaining arguments.
4019 func_exec_program ()
4021 case \" \$* \" in
4022 *\\ --lt-*)
4023 for lt_wr_arg
4025 case \$lt_wr_arg in
4026 --lt-*) ;;
4027 *) set x \"\$@\" \"\$lt_wr_arg\"; shift;;
4028 esac
4029 shift
4030 done ;;
4031 esac
4032 func_exec_program_core \${1+\"\$@\"}
4035 # Parse options
4036 func_parse_lt_options \"\$0\" \${1+\"\$@\"}
4038 # Find the directory that this script lives in.
4039 thisdir=\`\$ECHO \"\$file\" | $SED 's%/[^/]*$%%'\`
4040 test \"x\$thisdir\" = \"x\$file\" && thisdir=.
4042 # Follow symbolic links until we get to the real thisdir.
4043 file=\`ls -ld \"\$file\" | $SED -n 's/.*-> //p'\`
4044 while test -n \"\$file\"; do
4045 destdir=\`\$ECHO \"\$file\" | $SED 's%/[^/]*\$%%'\`
4047 # If there was a directory component, then change thisdir.
4048 if test \"x\$destdir\" != \"x\$file\"; then
4049 case \"\$destdir\" in
4050 [\\\\/]* | [A-Za-z]:[\\\\/]*) thisdir=\"\$destdir\" ;;
4051 *) thisdir=\"\$thisdir/\$destdir\" ;;
4052 esac
4055 file=\`\$ECHO \"\$file\" | $SED 's%^.*/%%'\`
4056 file=\`ls -ld \"\$thisdir/\$file\" | $SED -n 's/.*-> //p'\`
4057 done
4059 # Usually 'no', except on cygwin/mingw when embedded into
4060 # the cwrapper.
4061 WRAPPER_SCRIPT_BELONGS_IN_OBJDIR=$func_emit_wrapper_arg1
4062 if test \"\$WRAPPER_SCRIPT_BELONGS_IN_OBJDIR\" = \"yes\"; then
4063 # special case for '.'
4064 if test \"\$thisdir\" = \".\"; then
4065 thisdir=\`pwd\`
4067 # remove .libs from thisdir
4068 case \"\$thisdir\" in
4069 *[\\\\/]$objdir ) thisdir=\`\$ECHO \"\$thisdir\" | $SED 's%[\\\\/][^\\\\/]*$%%'\` ;;
4070 $objdir ) thisdir=. ;;
4071 esac
4074 # Try to get the absolute directory name.
4075 absdir=\`cd \"\$thisdir\" && pwd\`
4076 test -n \"\$absdir\" && thisdir=\"\$absdir\"
4079 if test "$fast_install" = yes; then
4080 $ECHO "\
4081 program=lt-'$outputname'$exeext
4082 progdir=\"\$thisdir/$objdir\"
4084 if test ! -f \"\$progdir/\$program\" ||
4085 { file=\`ls -1dt \"\$progdir/\$program\" \"\$progdir/../\$program\" 2>/dev/null | ${SED} 1q\`; \\
4086 test \"X\$file\" != \"X\$progdir/\$program\"; }; then
4088 file=\"\$\$-\$program\"
4090 if test ! -d \"\$progdir\"; then
4091 $MKDIR \"\$progdir\"
4092 else
4093 $RM \"\$progdir/\$file\"
4096 $ECHO "\
4098 # relink executable if necessary
4099 if test -n \"\$relink_command\"; then
4100 if relink_command_output=\`eval \$relink_command 2>&1\`; then :
4101 else
4102 $ECHO \"\$relink_command_output\" >&2
4103 $RM \"\$progdir/\$file\"
4104 exit 1
4108 $MV \"\$progdir/\$file\" \"\$progdir/\$program\" 2>/dev/null ||
4109 { $RM \"\$progdir/\$program\";
4110 $MV \"\$progdir/\$file\" \"\$progdir/\$program\"; }
4111 $RM \"\$progdir/\$file\"
4113 else
4114 $ECHO "\
4115 program='$outputname'
4116 progdir=\"\$thisdir/$objdir\"
4120 $ECHO "\
4122 if test -f \"\$progdir/\$program\"; then"
4124 # fixup the dll searchpath if we need to.
4126 # Fix the DLL searchpath if we need to. Do this before prepending
4127 # to shlibpath, because on Windows, both are PATH and uninstalled
4128 # libraries must come first.
4129 if test -n "$dllsearchpath"; then
4130 $ECHO "\
4131 # Add the dll search path components to the executable PATH
4132 PATH=$dllsearchpath:\$PATH
4136 # Export our shlibpath_var if we have one.
4137 if test "$shlibpath_overrides_runpath" = yes && test -n "$shlibpath_var" && test -n "$temp_rpath"; then
4138 $ECHO "\
4139 # Add our own library path to $shlibpath_var
4140 $shlibpath_var=\"$temp_rpath\$$shlibpath_var\"
4142 # Some systems cannot cope with colon-terminated $shlibpath_var
4143 # The second colon is a workaround for a bug in BeOS R4 sed
4144 $shlibpath_var=\`\$ECHO \"\$$shlibpath_var\" | $SED 's/::*\$//'\`
4146 export $shlibpath_var
4150 $ECHO "\
4151 if test \"\$libtool_execute_magic\" != \"$magic\"; then
4152 # Run the actual program with our arguments.
4153 func_exec_program \${1+\"\$@\"}
4155 else
4156 # The program doesn't exist.
4157 \$ECHO \"\$0: error: \\\`\$progdir/\$program' does not exist\" 1>&2
4158 \$ECHO \"This script is just a wrapper for \$program.\" 1>&2
4159 \$ECHO \"See the $PACKAGE documentation for more information.\" 1>&2
4160 exit 1
4167 # func_emit_cwrapperexe_src
4168 # emit the source code for a wrapper executable on stdout
4169 # Must ONLY be called from within func_mode_link because
4170 # it depends on a number of variable set therein.
4171 func_emit_cwrapperexe_src ()
4173 cat <<EOF
4175 /* $cwrappersource - temporary wrapper executable for $objdir/$outputname
4176 Generated by $PROGRAM (GNU $PACKAGE$TIMESTAMP) $VERSION
4178 The $output program cannot be directly executed until all the libtool
4179 libraries that it depends on are installed.
4181 This wrapper executable should never be moved out of the build directory.
4182 If it is, it will not operate correctly.
4185 cat <<"EOF"
4186 #ifdef _MSC_VER
4187 # define _CRT_SECURE_NO_DEPRECATE 1
4188 #endif
4189 #include <stdio.h>
4190 #include <stdlib.h>
4191 #ifdef _MSC_VER
4192 # include <direct.h>
4193 # include <process.h>
4194 # include <io.h>
4195 #else
4196 # include <unistd.h>
4197 # include <stdint.h>
4198 # ifdef __CYGWIN__
4199 # include <io.h>
4200 # endif
4201 #endif
4202 #include <malloc.h>
4203 #include <stdarg.h>
4204 #include <assert.h>
4205 #include <string.h>
4206 #include <ctype.h>
4207 #include <errno.h>
4208 #include <fcntl.h>
4209 #include <sys/stat.h>
4211 /* declarations of non-ANSI functions */
4212 #if defined(__MINGW32__)
4213 # ifdef __STRICT_ANSI__
4214 int _putenv (const char *);
4215 # endif
4216 #elif defined(__CYGWIN__)
4217 # ifdef __STRICT_ANSI__
4218 char *realpath (const char *, char *);
4219 int putenv (char *);
4220 int setenv (const char *, const char *, int);
4221 # endif
4222 /* #elif defined (other platforms) ... */
4223 #endif
4225 /* portability defines, excluding path handling macros */
4226 #if defined(_MSC_VER)
4227 # define setmode _setmode
4228 # define stat _stat
4229 # define chmod _chmod
4230 # define getcwd _getcwd
4231 # define putenv _putenv
4232 # define S_IXUSR _S_IEXEC
4233 # ifndef _INTPTR_T_DEFINED
4234 # define _INTPTR_T_DEFINED
4235 # define intptr_t int
4236 # endif
4237 #elif defined(__MINGW32__)
4238 # define setmode _setmode
4239 # define stat _stat
4240 # define chmod _chmod
4241 # define getcwd _getcwd
4242 # define putenv _putenv
4243 #elif defined(__CYGWIN__)
4244 # define HAVE_SETENV
4245 # define FOPEN_WB "wb"
4246 /* #elif defined (other platforms) ... */
4247 #endif
4249 #if defined(PATH_MAX)
4250 # define LT_PATHMAX PATH_MAX
4251 #elif defined(MAXPATHLEN)
4252 # define LT_PATHMAX MAXPATHLEN
4253 #else
4254 # define LT_PATHMAX 1024
4255 #endif
4257 #ifndef S_IXOTH
4258 # define S_IXOTH 0
4259 #endif
4260 #ifndef S_IXGRP
4261 # define S_IXGRP 0
4262 #endif
4264 /* path handling portability macros */
4265 #ifndef DIR_SEPARATOR
4266 # define DIR_SEPARATOR '/'
4267 # define PATH_SEPARATOR ':'
4268 #endif
4270 #if defined (_WIN32) || defined (__MSDOS__) || defined (__DJGPP__) || \
4271 defined (__OS2__)
4272 # define HAVE_DOS_BASED_FILE_SYSTEM
4273 # define FOPEN_WB "wb"
4274 # ifndef DIR_SEPARATOR_2
4275 # define DIR_SEPARATOR_2 '\\'
4276 # endif
4277 # ifndef PATH_SEPARATOR_2
4278 # define PATH_SEPARATOR_2 ';'
4279 # endif
4280 #endif
4282 #ifndef DIR_SEPARATOR_2
4283 # define IS_DIR_SEPARATOR(ch) ((ch) == DIR_SEPARATOR)
4284 #else /* DIR_SEPARATOR_2 */
4285 # define IS_DIR_SEPARATOR(ch) \
4286 (((ch) == DIR_SEPARATOR) || ((ch) == DIR_SEPARATOR_2))
4287 #endif /* DIR_SEPARATOR_2 */
4289 #ifndef PATH_SEPARATOR_2
4290 # define IS_PATH_SEPARATOR(ch) ((ch) == PATH_SEPARATOR)
4291 #else /* PATH_SEPARATOR_2 */
4292 # define IS_PATH_SEPARATOR(ch) ((ch) == PATH_SEPARATOR_2)
4293 #endif /* PATH_SEPARATOR_2 */
4295 #ifndef FOPEN_WB
4296 # define FOPEN_WB "w"
4297 #endif
4298 #ifndef _O_BINARY
4299 # define _O_BINARY 0
4300 #endif
4302 #define XMALLOC(type, num) ((type *) xmalloc ((num) * sizeof(type)))
4303 #define XFREE(stale) do { \
4304 if (stale) { free ((void *) stale); stale = 0; } \
4305 } while (0)
4307 #if defined(LT_DEBUGWRAPPER)
4308 static int lt_debug = 1;
4309 #else
4310 static int lt_debug = 0;
4311 #endif
4313 const char *program_name = "libtool-wrapper"; /* in case xstrdup fails */
4315 void *xmalloc (size_t num);
4316 char *xstrdup (const char *string);
4317 const char *base_name (const char *name);
4318 char *find_executable (const char *wrapper);
4319 char *chase_symlinks (const char *pathspec);
4320 int make_executable (const char *path);
4321 int check_executable (const char *path);
4322 char *strendzap (char *str, const char *pat);
4323 void lt_debugprintf (const char *file, int line, const char *fmt, ...);
4324 void lt_fatal (const char *file, int line, const char *message, ...);
4325 static const char *nonnull (const char *s);
4326 static const char *nonempty (const char *s);
4327 void lt_setenv (const char *name, const char *value);
4328 char *lt_extend_str (const char *orig_value, const char *add, int to_end);
4329 void lt_update_exe_path (const char *name, const char *value);
4330 void lt_update_lib_path (const char *name, const char *value);
4331 char **prepare_spawn (char **argv);
4332 void lt_dump_script (FILE *f);
4335 cat <<EOF
4336 volatile const char * MAGIC_EXE = "$magic_exe";
4337 const char * LIB_PATH_VARNAME = "$shlibpath_var";
4340 if test "$shlibpath_overrides_runpath" = yes && test -n "$shlibpath_var" && test -n "$temp_rpath"; then
4341 func_to_host_path "$temp_rpath"
4342 cat <<EOF
4343 const char * LIB_PATH_VALUE = "$func_to_host_path_result";
4345 else
4346 cat <<"EOF"
4347 const char * LIB_PATH_VALUE = "";
4351 if test -n "$dllsearchpath"; then
4352 func_to_host_path "$dllsearchpath:"
4353 cat <<EOF
4354 const char * EXE_PATH_VARNAME = "PATH";
4355 const char * EXE_PATH_VALUE = "$func_to_host_path_result";
4357 else
4358 cat <<"EOF"
4359 const char * EXE_PATH_VARNAME = "";
4360 const char * EXE_PATH_VALUE = "";
4364 if test "$fast_install" = yes; then
4365 cat <<EOF
4366 const char * TARGET_PROGRAM_NAME = "lt-$outputname"; /* hopefully, no .exe */
4368 else
4369 cat <<EOF
4370 const char * TARGET_PROGRAM_NAME = "$outputname"; /* hopefully, no .exe */
4375 cat <<"EOF"
4377 #define LTWRAPPER_OPTION_PREFIX "--lt-"
4379 static const char *ltwrapper_option_prefix = LTWRAPPER_OPTION_PREFIX;
4380 static const char *dumpscript_opt = LTWRAPPER_OPTION_PREFIX "dump-script";
4381 static const char *debug_opt = LTWRAPPER_OPTION_PREFIX "debug";
4384 main (int argc, char *argv[])
4386 char **newargz;
4387 int newargc;
4388 char *tmp_pathspec;
4389 char *actual_cwrapper_path;
4390 char *actual_cwrapper_name;
4391 char *target_name;
4392 char *lt_argv_zero;
4393 intptr_t rval = 127;
4395 int i;
4397 program_name = (char *) xstrdup (base_name (argv[0]));
4398 newargz = XMALLOC (char *, argc + 1);
4400 /* very simple arg parsing; don't want to rely on getopt
4401 * also, copy all non cwrapper options to newargz, except
4402 * argz[0], which is handled differently
4404 newargc=0;
4405 for (i = 1; i < argc; i++)
4407 if (strcmp (argv[i], dumpscript_opt) == 0)
4410 case "$host" in
4411 *mingw* | *cygwin* )
4412 # make stdout use "unix" line endings
4413 echo " setmode(1,_O_BINARY);"
4415 esac
4417 cat <<"EOF"
4418 lt_dump_script (stdout);
4419 return 0;
4421 if (strcmp (argv[i], debug_opt) == 0)
4423 lt_debug = 1;
4424 continue;
4426 if (strcmp (argv[i], ltwrapper_option_prefix) == 0)
4428 /* however, if there is an option in the LTWRAPPER_OPTION_PREFIX
4429 namespace, but it is not one of the ones we know about and
4430 have already dealt with, above (inluding dump-script), then
4431 report an error. Otherwise, targets might begin to believe
4432 they are allowed to use options in the LTWRAPPER_OPTION_PREFIX
4433 namespace. The first time any user complains about this, we'll
4434 need to make LTWRAPPER_OPTION_PREFIX a configure-time option
4435 or a configure.ac-settable value.
4437 lt_fatal (__FILE__, __LINE__,
4438 "unrecognized %s option: '%s'",
4439 ltwrapper_option_prefix, argv[i]);
4441 /* otherwise ... */
4442 newargz[++newargc] = xstrdup (argv[i]);
4444 newargz[++newargc] = NULL;
4447 cat <<EOF
4448 /* The GNU banner must be the first non-error debug message */
4449 lt_debugprintf (__FILE__, __LINE__, "libtool wrapper (GNU $PACKAGE$TIMESTAMP) $VERSION\n");
4451 cat <<"EOF"
4452 lt_debugprintf (__FILE__, __LINE__, "(main) argv[0]: %s\n", argv[0]);
4453 lt_debugprintf (__FILE__, __LINE__, "(main) program_name: %s\n", program_name);
4455 tmp_pathspec = find_executable (argv[0]);
4456 if (tmp_pathspec == NULL)
4457 lt_fatal (__FILE__, __LINE__, "couldn't find %s", argv[0]);
4458 lt_debugprintf (__FILE__, __LINE__,
4459 "(main) found exe (before symlink chase) at: %s\n",
4460 tmp_pathspec);
4462 actual_cwrapper_path = chase_symlinks (tmp_pathspec);
4463 lt_debugprintf (__FILE__, __LINE__,
4464 "(main) found exe (after symlink chase) at: %s\n",
4465 actual_cwrapper_path);
4466 XFREE (tmp_pathspec);
4468 actual_cwrapper_name = xstrdup (base_name (actual_cwrapper_path));
4469 strendzap (actual_cwrapper_path, actual_cwrapper_name);
4471 /* wrapper name transforms */
4472 strendzap (actual_cwrapper_name, ".exe");
4473 tmp_pathspec = lt_extend_str (actual_cwrapper_name, ".exe", 1);
4474 XFREE (actual_cwrapper_name);
4475 actual_cwrapper_name = tmp_pathspec;
4476 tmp_pathspec = 0;
4478 /* target_name transforms -- use actual target program name; might have lt- prefix */
4479 target_name = xstrdup (base_name (TARGET_PROGRAM_NAME));
4480 strendzap (target_name, ".exe");
4481 tmp_pathspec = lt_extend_str (target_name, ".exe", 1);
4482 XFREE (target_name);
4483 target_name = tmp_pathspec;
4484 tmp_pathspec = 0;
4486 lt_debugprintf (__FILE__, __LINE__,
4487 "(main) libtool target name: %s\n",
4488 target_name);
4491 cat <<EOF
4492 newargz[0] =
4493 XMALLOC (char, (strlen (actual_cwrapper_path) +
4494 strlen ("$objdir") + 1 + strlen (actual_cwrapper_name) + 1));
4495 strcpy (newargz[0], actual_cwrapper_path);
4496 strcat (newargz[0], "$objdir");
4497 strcat (newargz[0], "/");
4500 cat <<"EOF"
4501 /* stop here, and copy so we don't have to do this twice */
4502 tmp_pathspec = xstrdup (newargz[0]);
4504 /* do NOT want the lt- prefix here, so use actual_cwrapper_name */
4505 strcat (newargz[0], actual_cwrapper_name);
4507 /* DO want the lt- prefix here if it exists, so use target_name */
4508 lt_argv_zero = lt_extend_str (tmp_pathspec, target_name, 1);
4509 XFREE (tmp_pathspec);
4510 tmp_pathspec = NULL;
4513 case $host_os in
4514 mingw*)
4515 cat <<"EOF"
4517 char* p;
4518 while ((p = strchr (newargz[0], '\\')) != NULL)
4520 *p = '/';
4522 while ((p = strchr (lt_argv_zero, '\\')) != NULL)
4524 *p = '/';
4529 esac
4531 cat <<"EOF"
4532 XFREE (target_name);
4533 XFREE (actual_cwrapper_path);
4534 XFREE (actual_cwrapper_name);
4536 lt_setenv ("BIN_SH", "xpg4"); /* for Tru64 */
4537 lt_setenv ("DUALCASE", "1"); /* for MSK sh */
4538 /* Update the DLL searchpath. EXE_PATH_VALUE ($dllsearchpath) must
4539 be prepended before (that is, appear after) LIB_PATH_VALUE ($temp_rpath)
4540 because on Windows, both *_VARNAMEs are PATH but uninstalled
4541 libraries must come first. */
4542 lt_update_exe_path (EXE_PATH_VARNAME, EXE_PATH_VALUE);
4543 lt_update_lib_path (LIB_PATH_VARNAME, LIB_PATH_VALUE);
4545 lt_debugprintf (__FILE__, __LINE__, "(main) lt_argv_zero: %s\n",
4546 nonnull (lt_argv_zero));
4547 for (i = 0; i < newargc; i++)
4549 lt_debugprintf (__FILE__, __LINE__, "(main) newargz[%d]: %s\n",
4550 i, nonnull (newargz[i]));
4555 case $host_os in
4556 mingw*)
4557 cat <<"EOF"
4558 /* execv doesn't actually work on mingw as expected on unix */
4559 newargz = prepare_spawn (newargz);
4560 rval = _spawnv (_P_WAIT, lt_argv_zero, (const char * const *) newargz);
4561 if (rval == -1)
4563 /* failed to start process */
4564 lt_debugprintf (__FILE__, __LINE__,
4565 "(main) failed to launch target \"%s\": %s\n",
4566 lt_argv_zero, nonnull (strerror (errno)));
4567 return 127;
4569 return rval;
4573 cat <<"EOF"
4574 execv (lt_argv_zero, newargz);
4575 return rval; /* =127, but avoids unused variable warning */
4578 esac
4580 cat <<"EOF"
4583 void *
4584 xmalloc (size_t num)
4586 void *p = (void *) malloc (num);
4587 if (!p)
4588 lt_fatal (__FILE__, __LINE__, "memory exhausted");
4590 return p;
4593 char *
4594 xstrdup (const char *string)
4596 return string ? strcpy ((char *) xmalloc (strlen (string) + 1),
4597 string) : NULL;
4600 const char *
4601 base_name (const char *name)
4603 const char *base;
4605 #if defined (HAVE_DOS_BASED_FILE_SYSTEM)
4606 /* Skip over the disk name in MSDOS pathnames. */
4607 if (isalpha ((unsigned char) name[0]) && name[1] == ':')
4608 name += 2;
4609 #endif
4611 for (base = name; *name; name++)
4612 if (IS_DIR_SEPARATOR (*name))
4613 base = name + 1;
4614 return base;
4618 check_executable (const char *path)
4620 struct stat st;
4622 lt_debugprintf (__FILE__, __LINE__, "(check_executable): %s\n",
4623 nonempty (path));
4624 if ((!path) || (!*path))
4625 return 0;
4627 if ((stat (path, &st) >= 0)
4628 && (st.st_mode & (S_IXUSR | S_IXGRP | S_IXOTH)))
4629 return 1;
4630 else
4631 return 0;
4635 make_executable (const char *path)
4637 int rval = 0;
4638 struct stat st;
4640 lt_debugprintf (__FILE__, __LINE__, "(make_executable): %s\n",
4641 nonempty (path));
4642 if ((!path) || (!*path))
4643 return 0;
4645 if (stat (path, &st) >= 0)
4647 rval = chmod (path, st.st_mode | S_IXOTH | S_IXGRP | S_IXUSR);
4649 return rval;
4652 /* Searches for the full path of the wrapper. Returns
4653 newly allocated full path name if found, NULL otherwise
4654 Does not chase symlinks, even on platforms that support them.
4656 char *
4657 find_executable (const char *wrapper)
4659 int has_slash = 0;
4660 const char *p;
4661 const char *p_next;
4662 /* static buffer for getcwd */
4663 char tmp[LT_PATHMAX + 1];
4664 int tmp_len;
4665 char *concat_name;
4667 lt_debugprintf (__FILE__, __LINE__, "(find_executable): %s\n",
4668 nonempty (wrapper));
4670 if ((wrapper == NULL) || (*wrapper == '\0'))
4671 return NULL;
4673 /* Absolute path? */
4674 #if defined (HAVE_DOS_BASED_FILE_SYSTEM)
4675 if (isalpha ((unsigned char) wrapper[0]) && wrapper[1] == ':')
4677 concat_name = xstrdup (wrapper);
4678 if (check_executable (concat_name))
4679 return concat_name;
4680 XFREE (concat_name);
4682 else
4684 #endif
4685 if (IS_DIR_SEPARATOR (wrapper[0]))
4687 concat_name = xstrdup (wrapper);
4688 if (check_executable (concat_name))
4689 return concat_name;
4690 XFREE (concat_name);
4692 #if defined (HAVE_DOS_BASED_FILE_SYSTEM)
4694 #endif
4696 for (p = wrapper; *p; p++)
4697 if (*p == '/')
4699 has_slash = 1;
4700 break;
4702 if (!has_slash)
4704 /* no slashes; search PATH */
4705 const char *path = getenv ("PATH");
4706 if (path != NULL)
4708 for (p = path; *p; p = p_next)
4710 const char *q;
4711 size_t p_len;
4712 for (q = p; *q; q++)
4713 if (IS_PATH_SEPARATOR (*q))
4714 break;
4715 p_len = q - p;
4716 p_next = (*q == '\0' ? q : q + 1);
4717 if (p_len == 0)
4719 /* empty path: current directory */
4720 if (getcwd (tmp, LT_PATHMAX) == NULL)
4721 lt_fatal (__FILE__, __LINE__, "getcwd failed: %s",
4722 nonnull (strerror (errno)));
4723 tmp_len = strlen (tmp);
4724 concat_name =
4725 XMALLOC (char, tmp_len + 1 + strlen (wrapper) + 1);
4726 memcpy (concat_name, tmp, tmp_len);
4727 concat_name[tmp_len] = '/';
4728 strcpy (concat_name + tmp_len + 1, wrapper);
4730 else
4732 concat_name =
4733 XMALLOC (char, p_len + 1 + strlen (wrapper) + 1);
4734 memcpy (concat_name, p, p_len);
4735 concat_name[p_len] = '/';
4736 strcpy (concat_name + p_len + 1, wrapper);
4738 if (check_executable (concat_name))
4739 return concat_name;
4740 XFREE (concat_name);
4743 /* not found in PATH; assume curdir */
4745 /* Relative path | not found in path: prepend cwd */
4746 if (getcwd (tmp, LT_PATHMAX) == NULL)
4747 lt_fatal (__FILE__, __LINE__, "getcwd failed: %s",
4748 nonnull (strerror (errno)));
4749 tmp_len = strlen (tmp);
4750 concat_name = XMALLOC (char, tmp_len + 1 + strlen (wrapper) + 1);
4751 memcpy (concat_name, tmp, tmp_len);
4752 concat_name[tmp_len] = '/';
4753 strcpy (concat_name + tmp_len + 1, wrapper);
4755 if (check_executable (concat_name))
4756 return concat_name;
4757 XFREE (concat_name);
4758 return NULL;
4761 char *
4762 chase_symlinks (const char *pathspec)
4764 #ifndef S_ISLNK
4765 return xstrdup (pathspec);
4766 #else
4767 char buf[LT_PATHMAX];
4768 struct stat s;
4769 char *tmp_pathspec = xstrdup (pathspec);
4770 char *p;
4771 int has_symlinks = 0;
4772 while (strlen (tmp_pathspec) && !has_symlinks)
4774 lt_debugprintf (__FILE__, __LINE__,
4775 "checking path component for symlinks: %s\n",
4776 tmp_pathspec);
4777 if (lstat (tmp_pathspec, &s) == 0)
4779 if (S_ISLNK (s.st_mode) != 0)
4781 has_symlinks = 1;
4782 break;
4785 /* search backwards for last DIR_SEPARATOR */
4786 p = tmp_pathspec + strlen (tmp_pathspec) - 1;
4787 while ((p > tmp_pathspec) && (!IS_DIR_SEPARATOR (*p)))
4788 p--;
4789 if ((p == tmp_pathspec) && (!IS_DIR_SEPARATOR (*p)))
4791 /* no more DIR_SEPARATORS left */
4792 break;
4794 *p = '\0';
4796 else
4798 lt_fatal (__FILE__, __LINE__,
4799 "error accessing file \"%s\": %s",
4800 tmp_pathspec, nonnull (strerror (errno)));
4803 XFREE (tmp_pathspec);
4805 if (!has_symlinks)
4807 return xstrdup (pathspec);
4810 tmp_pathspec = realpath (pathspec, buf);
4811 if (tmp_pathspec == 0)
4813 lt_fatal (__FILE__, __LINE__,
4814 "could not follow symlinks for %s", pathspec);
4816 return xstrdup (tmp_pathspec);
4817 #endif
4820 char *
4821 strendzap (char *str, const char *pat)
4823 size_t len, patlen;
4825 assert (str != NULL);
4826 assert (pat != NULL);
4828 len = strlen (str);
4829 patlen = strlen (pat);
4831 if (patlen <= len)
4833 str += len - patlen;
4834 if (strcmp (str, pat) == 0)
4835 *str = '\0';
4837 return str;
4840 void
4841 lt_debugprintf (const char *file, int line, const char *fmt, ...)
4843 va_list args;
4844 if (lt_debug)
4846 (void) fprintf (stderr, "%s:%s:%d: ", program_name, file, line);
4847 va_start (args, fmt);
4848 (void) vfprintf (stderr, fmt, args);
4849 va_end (args);
4853 static void
4854 lt_error_core (int exit_status, const char *file,
4855 int line, const char *mode,
4856 const char *message, va_list ap)
4858 fprintf (stderr, "%s:%s:%d: %s: ", program_name, file, line, mode);
4859 vfprintf (stderr, message, ap);
4860 fprintf (stderr, ".\n");
4862 if (exit_status >= 0)
4863 exit (exit_status);
4866 void
4867 lt_fatal (const char *file, int line, const char *message, ...)
4869 va_list ap;
4870 va_start (ap, message);
4871 lt_error_core (EXIT_FAILURE, file, line, "FATAL", message, ap);
4872 va_end (ap);
4875 static const char *
4876 nonnull (const char *s)
4878 return s ? s : "(null)";
4881 static const char *
4882 nonempty (const char *s)
4884 return (s && !*s) ? "(empty)" : nonnull (s);
4887 void
4888 lt_setenv (const char *name, const char *value)
4890 lt_debugprintf (__FILE__, __LINE__,
4891 "(lt_setenv) setting '%s' to '%s'\n",
4892 nonnull (name), nonnull (value));
4894 #ifdef HAVE_SETENV
4895 /* always make a copy, for consistency with !HAVE_SETENV */
4896 char *str = xstrdup (value);
4897 setenv (name, str, 1);
4898 #else
4899 int len = strlen (name) + 1 + strlen (value) + 1;
4900 char *str = XMALLOC (char, len);
4901 sprintf (str, "%s=%s", name, value);
4902 if (putenv (str) != EXIT_SUCCESS)
4904 XFREE (str);
4906 #endif
4910 char *
4911 lt_extend_str (const char *orig_value, const char *add, int to_end)
4913 char *new_value;
4914 if (orig_value && *orig_value)
4916 int orig_value_len = strlen (orig_value);
4917 int add_len = strlen (add);
4918 new_value = XMALLOC (char, add_len + orig_value_len + 1);
4919 if (to_end)
4921 strcpy (new_value, orig_value);
4922 strcpy (new_value + orig_value_len, add);
4924 else
4926 strcpy (new_value, add);
4927 strcpy (new_value + add_len, orig_value);
4930 else
4932 new_value = xstrdup (add);
4934 return new_value;
4937 void
4938 lt_update_exe_path (const char *name, const char *value)
4940 lt_debugprintf (__FILE__, __LINE__,
4941 "(lt_update_exe_path) modifying '%s' by prepending '%s'\n",
4942 nonnull (name), nonnull (value));
4944 if (name && *name && value && *value)
4946 char *new_value = lt_extend_str (getenv (name), value, 0);
4947 /* some systems can't cope with a ':'-terminated path #' */
4948 int len = strlen (new_value);
4949 while (((len = strlen (new_value)) > 0) && IS_PATH_SEPARATOR (new_value[len-1]))
4951 new_value[len-1] = '\0';
4953 lt_setenv (name, new_value);
4954 XFREE (new_value);
4958 void
4959 lt_update_lib_path (const char *name, const char *value)
4961 lt_debugprintf (__FILE__, __LINE__,
4962 "(lt_update_lib_path) modifying '%s' by prepending '%s'\n",
4963 nonnull (name), nonnull (value));
4965 if (name && *name && value && *value)
4967 char *new_value = lt_extend_str (getenv (name), value, 0);
4968 lt_setenv (name, new_value);
4969 XFREE (new_value);
4974 case $host_os in
4975 mingw*)
4976 cat <<"EOF"
4978 /* Prepares an argument vector before calling spawn().
4979 Note that spawn() does not by itself call the command interpreter
4980 (getenv ("COMSPEC") != NULL ? getenv ("COMSPEC") :
4981 ({ OSVERSIONINFO v; v.dwOSVersionInfoSize = sizeof(OSVERSIONINFO);
4982 GetVersionEx(&v);
4983 v.dwPlatformId == VER_PLATFORM_WIN32_NT;
4984 }) ? "cmd.exe" : "command.com").
4985 Instead it simply concatenates the arguments, separated by ' ', and calls
4986 CreateProcess(). We must quote the arguments since Win32 CreateProcess()
4987 interprets characters like ' ', '\t', '\\', '"' (but not '<' and '>') in a
4988 special way:
4989 - Space and tab are interpreted as delimiters. They are not treated as
4990 delimiters if they are surrounded by double quotes: "...".
4991 - Unescaped double quotes are removed from the input. Their only effect is
4992 that within double quotes, space and tab are treated like normal
4993 characters.
4994 - Backslashes not followed by double quotes are not special.
4995 - But 2*n+1 backslashes followed by a double quote become
4996 n backslashes followed by a double quote (n >= 0):
4997 \" -> "
4998 \\\" -> \"
4999 \\\\\" -> \\"
5001 #define SHELL_SPECIAL_CHARS "\"\\ \001\002\003\004\005\006\007\010\011\012\013\014\015\016\017\020\021\022\023\024\025\026\027\030\031\032\033\034\035\036\037"
5002 #define SHELL_SPACE_CHARS " \001\002\003\004\005\006\007\010\011\012\013\014\015\016\017\020\021\022\023\024\025\026\027\030\031\032\033\034\035\036\037"
5003 char **
5004 prepare_spawn (char **argv)
5006 size_t argc;
5007 char **new_argv;
5008 size_t i;
5010 /* Count number of arguments. */
5011 for (argc = 0; argv[argc] != NULL; argc++)
5014 /* Allocate new argument vector. */
5015 new_argv = XMALLOC (char *, argc + 1);
5017 /* Put quoted arguments into the new argument vector. */
5018 for (i = 0; i < argc; i++)
5020 const char *string = argv[i];
5022 if (string[0] == '\0')
5023 new_argv[i] = xstrdup ("\"\"");
5024 else if (strpbrk (string, SHELL_SPECIAL_CHARS) != NULL)
5026 int quote_around = (strpbrk (string, SHELL_SPACE_CHARS) != NULL);
5027 size_t length;
5028 unsigned int backslashes;
5029 const char *s;
5030 char *quoted_string;
5031 char *p;
5033 length = 0;
5034 backslashes = 0;
5035 if (quote_around)
5036 length++;
5037 for (s = string; *s != '\0'; s++)
5039 char c = *s;
5040 if (c == '"')
5041 length += backslashes + 1;
5042 length++;
5043 if (c == '\\')
5044 backslashes++;
5045 else
5046 backslashes = 0;
5048 if (quote_around)
5049 length += backslashes + 1;
5051 quoted_string = XMALLOC (char, length + 1);
5053 p = quoted_string;
5054 backslashes = 0;
5055 if (quote_around)
5056 *p++ = '"';
5057 for (s = string; *s != '\0'; s++)
5059 char c = *s;
5060 if (c == '"')
5062 unsigned int j;
5063 for (j = backslashes + 1; j > 0; j--)
5064 *p++ = '\\';
5066 *p++ = c;
5067 if (c == '\\')
5068 backslashes++;
5069 else
5070 backslashes = 0;
5072 if (quote_around)
5074 unsigned int j;
5075 for (j = backslashes; j > 0; j--)
5076 *p++ = '\\';
5077 *p++ = '"';
5079 *p = '\0';
5081 new_argv[i] = quoted_string;
5083 else
5084 new_argv[i] = (char *) string;
5086 new_argv[argc] = NULL;
5088 return new_argv;
5092 esac
5094 cat <<"EOF"
5095 void lt_dump_script (FILE* f)
5098 func_emit_wrapper yes |
5099 $SED -n -e '
5100 s/^\(.\{79\}\)\(..*\)/\1\
5103 s/\([\\"]\)/\\\1/g
5104 s/$/\\n/
5105 s/\([^\n]*\).*/ fputs ("\1", f);/p
5108 cat <<"EOF"
5112 # end: func_emit_cwrapperexe_src
5114 # func_win32_import_lib_p ARG
5115 # True if ARG is an import lib, as indicated by $file_magic_cmd
5116 func_win32_import_lib_p ()
5118 $opt_debug
5119 case `eval $file_magic_cmd \"\$1\" 2>/dev/null | $SED -e 10q` in
5120 *import*) : ;;
5121 *) false ;;
5122 esac
5125 # func_mode_link arg...
5126 func_mode_link ()
5128 $opt_debug
5129 case $host in
5130 *-*-cygwin* | *-*-mingw* | *-*-pw32* | *-*-os2* | *-cegcc*)
5131 # It is impossible to link a dll without this setting, and
5132 # we shouldn't force the makefile maintainer to figure out
5133 # which system we are compiling for in order to pass an extra
5134 # flag for every libtool invocation.
5135 # allow_undefined=no
5137 # FIXME: Unfortunately, there are problems with the above when trying
5138 # to make a dll which has undefined symbols, in which case not
5139 # even a static library is built. For now, we need to specify
5140 # -no-undefined on the libtool link line when we can be certain
5141 # that all symbols are satisfied, otherwise we get a static library.
5142 allow_undefined=yes
5145 allow_undefined=yes
5147 esac
5148 libtool_args=$nonopt
5149 base_compile="$nonopt $@"
5150 compile_command=$nonopt
5151 finalize_command=$nonopt
5153 compile_rpath=
5154 finalize_rpath=
5155 compile_shlibpath=
5156 finalize_shlibpath=
5157 convenience=
5158 old_convenience=
5159 deplibs=
5160 old_deplibs=
5161 compiler_flags=
5162 linker_flags=
5163 dllsearchpath=
5164 lib_search_path=`pwd`
5165 inst_prefix_dir=
5166 new_inherited_linker_flags=
5168 avoid_version=no
5169 bindir=
5170 dlfiles=
5171 dlprefiles=
5172 dlself=no
5173 export_dynamic=no
5174 export_symbols=
5175 export_symbols_regex=
5176 generated=
5177 libobjs=
5178 ltlibs=
5179 module=no
5180 no_install=no
5181 objs=
5182 non_pic_objects=
5183 precious_files_regex=
5184 prefer_static_libs=no
5185 preload=no
5186 prev=
5187 prevarg=
5188 release=
5189 rpath=
5190 xrpath=
5191 perm_rpath=
5192 temp_rpath=
5193 thread_safe=no
5194 vinfo=
5195 vinfo_number=no
5196 weak_libs=
5197 single_module="${wl}-single_module"
5198 func_infer_tag $base_compile
5200 # We need to know -static, to get the right output filenames.
5201 for arg
5203 case $arg in
5204 -shared)
5205 test "$build_libtool_libs" != yes && \
5206 func_fatal_configuration "can not build a shared library"
5207 build_old_libs=no
5208 break
5210 -all-static | -static | -static-libtool-libs)
5211 case $arg in
5212 -all-static)
5213 if test "$build_libtool_libs" = yes && test -z "$link_static_flag"; then
5214 func_warning "complete static linking is impossible in this configuration"
5216 if test -n "$link_static_flag"; then
5217 dlopen_self=$dlopen_self_static
5219 prefer_static_libs=yes
5221 -static)
5222 if test -z "$pic_flag" && test -n "$link_static_flag"; then
5223 dlopen_self=$dlopen_self_static
5225 prefer_static_libs=built
5227 -static-libtool-libs)
5228 if test -z "$pic_flag" && test -n "$link_static_flag"; then
5229 dlopen_self=$dlopen_self_static
5231 prefer_static_libs=yes
5233 esac
5234 build_libtool_libs=no
5235 build_old_libs=yes
5236 break
5238 esac
5239 done
5241 # See if our shared archives depend on static archives.
5242 test -n "$old_archive_from_new_cmds" && build_old_libs=yes
5244 # Go through the arguments, transforming them on the way.
5245 while test "$#" -gt 0; do
5246 arg="$1"
5247 shift
5248 func_quote_for_eval "$arg"
5249 qarg=$func_quote_for_eval_unquoted_result
5250 func_append libtool_args " $func_quote_for_eval_result"
5252 # If the previous option needs an argument, assign it.
5253 if test -n "$prev"; then
5254 case $prev in
5255 output)
5256 func_append compile_command " @OUTPUT@"
5257 func_append finalize_command " @OUTPUT@"
5259 esac
5261 case $prev in
5262 bindir)
5263 bindir="$arg"
5264 prev=
5265 continue
5267 dlfiles|dlprefiles)
5268 if test "$preload" = no; then
5269 # Add the symbol object into the linking commands.
5270 func_append compile_command " @SYMFILE@"
5271 func_append finalize_command " @SYMFILE@"
5272 preload=yes
5274 case $arg in
5275 *.la | *.lo) ;; # We handle these cases below.
5276 force)
5277 if test "$dlself" = no; then
5278 dlself=needless
5279 export_dynamic=yes
5281 prev=
5282 continue
5284 self)
5285 if test "$prev" = dlprefiles; then
5286 dlself=yes
5287 elif test "$prev" = dlfiles && test "$dlopen_self" != yes; then
5288 dlself=yes
5289 else
5290 dlself=needless
5291 export_dynamic=yes
5293 prev=
5294 continue
5297 if test "$prev" = dlfiles; then
5298 func_append dlfiles " $arg"
5299 else
5300 func_append dlprefiles " $arg"
5302 prev=
5303 continue
5305 esac
5307 expsyms)
5308 export_symbols="$arg"
5309 test -f "$arg" \
5310 || func_fatal_error "symbol file \`$arg' does not exist"
5311 prev=
5312 continue
5314 expsyms_regex)
5315 export_symbols_regex="$arg"
5316 prev=
5317 continue
5319 framework)
5320 case $host in
5321 *-*-darwin*)
5322 case "$deplibs " in
5323 *" $qarg.ltframework "*) ;;
5324 *) func_append deplibs " $qarg.ltframework" # this is fixed later
5326 esac
5328 esac
5329 prev=
5330 continue
5332 inst_prefix)
5333 inst_prefix_dir="$arg"
5334 prev=
5335 continue
5337 objectlist)
5338 if test -f "$arg"; then
5339 save_arg=$arg
5340 moreargs=
5341 for fil in `cat "$save_arg"`
5343 # func_append moreargs " $fil"
5344 arg=$fil
5345 # A libtool-controlled object.
5347 # Check to see that this really is a libtool object.
5348 if func_lalib_unsafe_p "$arg"; then
5349 pic_object=
5350 non_pic_object=
5352 # Read the .lo file
5353 func_source "$arg"
5355 if test -z "$pic_object" ||
5356 test -z "$non_pic_object" ||
5357 test "$pic_object" = none &&
5358 test "$non_pic_object" = none; then
5359 func_fatal_error "cannot find name of object for \`$arg'"
5362 # Extract subdirectory from the argument.
5363 func_dirname "$arg" "/" ""
5364 xdir="$func_dirname_result"
5366 if test "$pic_object" != none; then
5367 # Prepend the subdirectory the object is found in.
5368 pic_object="$xdir$pic_object"
5370 if test "$prev" = dlfiles; then
5371 if test "$build_libtool_libs" = yes && test "$dlopen_support" = yes; then
5372 func_append dlfiles " $pic_object"
5373 prev=
5374 continue
5375 else
5376 # If libtool objects are unsupported, then we need to preload.
5377 prev=dlprefiles
5381 # CHECK ME: I think I busted this. -Ossama
5382 if test "$prev" = dlprefiles; then
5383 # Preload the old-style object.
5384 func_append dlprefiles " $pic_object"
5385 prev=
5388 # A PIC object.
5389 func_append libobjs " $pic_object"
5390 arg="$pic_object"
5393 # Non-PIC object.
5394 if test "$non_pic_object" != none; then
5395 # Prepend the subdirectory the object is found in.
5396 non_pic_object="$xdir$non_pic_object"
5398 # A standard non-PIC object
5399 func_append non_pic_objects " $non_pic_object"
5400 if test -z "$pic_object" || test "$pic_object" = none ; then
5401 arg="$non_pic_object"
5403 else
5404 # If the PIC object exists, use it instead.
5405 # $xdir was prepended to $pic_object above.
5406 non_pic_object="$pic_object"
5407 func_append non_pic_objects " $non_pic_object"
5409 else
5410 # Only an error if not doing a dry-run.
5411 if $opt_dry_run; then
5412 # Extract subdirectory from the argument.
5413 func_dirname "$arg" "/" ""
5414 xdir="$func_dirname_result"
5416 func_lo2o "$arg"
5417 pic_object=$xdir$objdir/$func_lo2o_result
5418 non_pic_object=$xdir$func_lo2o_result
5419 func_append libobjs " $pic_object"
5420 func_append non_pic_objects " $non_pic_object"
5421 else
5422 func_fatal_error "\`$arg' is not a valid libtool object"
5425 done
5426 else
5427 func_fatal_error "link input file \`$arg' does not exist"
5429 arg=$save_arg
5430 prev=
5431 continue
5433 precious_regex)
5434 precious_files_regex="$arg"
5435 prev=
5436 continue
5438 release)
5439 release="-$arg"
5440 prev=
5441 continue
5443 rpath | xrpath)
5444 # We need an absolute path.
5445 case $arg in
5446 [\\/]* | [A-Za-z]:[\\/]*) ;;
5448 func_fatal_error "only absolute run-paths are allowed"
5450 esac
5451 if test "$prev" = rpath; then
5452 case "$rpath " in
5453 *" $arg "*) ;;
5454 *) func_append rpath " $arg" ;;
5455 esac
5456 else
5457 case "$xrpath " in
5458 *" $arg "*) ;;
5459 *) func_append xrpath " $arg" ;;
5460 esac
5462 prev=
5463 continue
5465 shrext)
5466 shrext_cmds="$arg"
5467 prev=
5468 continue
5470 weak)
5471 func_append weak_libs " $arg"
5472 prev=
5473 continue
5475 xcclinker)
5476 func_append linker_flags " $qarg"
5477 func_append compiler_flags " $qarg"
5478 prev=
5479 func_append compile_command " $qarg"
5480 func_append finalize_command " $qarg"
5481 continue
5483 xcompiler)
5484 func_append compiler_flags " $qarg"
5485 prev=
5486 func_append compile_command " $qarg"
5487 func_append finalize_command " $qarg"
5488 continue
5490 xlinker)
5491 func_append linker_flags " $qarg"
5492 func_append compiler_flags " $wl$qarg"
5493 prev=
5494 func_append compile_command " $wl$qarg"
5495 func_append finalize_command " $wl$qarg"
5496 continue
5499 eval "$prev=\"\$arg\""
5500 prev=
5501 continue
5503 esac
5504 fi # test -n "$prev"
5506 prevarg="$arg"
5508 case $arg in
5509 -all-static)
5510 if test -n "$link_static_flag"; then
5511 # See comment for -static flag below, for more details.
5512 func_append compile_command " $link_static_flag"
5513 func_append finalize_command " $link_static_flag"
5515 continue
5518 -allow-undefined)
5519 # FIXME: remove this flag sometime in the future.
5520 func_fatal_error "\`-allow-undefined' must not be used because it is the default"
5523 -avoid-version)
5524 avoid_version=yes
5525 continue
5528 -bindir)
5529 prev=bindir
5530 continue
5533 -dlopen)
5534 prev=dlfiles
5535 continue
5538 -dlpreopen)
5539 prev=dlprefiles
5540 continue
5543 -export-dynamic)
5544 export_dynamic=yes
5545 continue
5548 -export-symbols | -export-symbols-regex)
5549 if test -n "$export_symbols" || test -n "$export_symbols_regex"; then
5550 func_fatal_error "more than one -exported-symbols argument is not allowed"
5552 if test "X$arg" = "X-export-symbols"; then
5553 prev=expsyms
5554 else
5555 prev=expsyms_regex
5557 continue
5560 -framework)
5561 prev=framework
5562 continue
5565 -inst-prefix-dir)
5566 prev=inst_prefix
5567 continue
5570 # The native IRIX linker understands -LANG:*, -LIST:* and -LNO:*
5571 # so, if we see these flags be careful not to treat them like -L
5572 -L[A-Z][A-Z]*:*)
5573 case $with_gcc/$host in
5574 no/*-*-irix* | /*-*-irix*)
5575 func_append compile_command " $arg"
5576 func_append finalize_command " $arg"
5578 esac
5579 continue
5582 -L*)
5583 func_stripname "-L" '' "$arg"
5584 if test -z "$func_stripname_result"; then
5585 if test "$#" -gt 0; then
5586 func_fatal_error "require no space between \`-L' and \`$1'"
5587 else
5588 func_fatal_error "need path for \`-L' option"
5591 func_resolve_sysroot "$func_stripname_result"
5592 dir=$func_resolve_sysroot_result
5593 # We need an absolute path.
5594 case $dir in
5595 [\\/]* | [A-Za-z]:[\\/]*) ;;
5597 absdir=`cd "$dir" && pwd`
5598 test -z "$absdir" && \
5599 func_fatal_error "cannot determine absolute directory name of \`$dir'"
5600 dir="$absdir"
5602 esac
5603 case "$deplibs " in
5604 *" -L$dir "* | *" $arg "*)
5605 # Will only happen for absolute or sysroot arguments
5608 # Preserve sysroot, but never include relative directories
5609 case $dir in
5610 [\\/]* | [A-Za-z]:[\\/]* | =*) func_append deplibs " $arg" ;;
5611 *) func_append deplibs " -L$dir" ;;
5612 esac
5613 func_append lib_search_path " $dir"
5615 esac
5616 case $host in
5617 *-*-cygwin* | *-*-mingw* | *-*-pw32* | *-*-os2* | *-cegcc*)
5618 testbindir=`$ECHO "$dir" | $SED 's*/lib$*/bin*'`
5619 case :$dllsearchpath: in
5620 *":$dir:"*) ;;
5621 ::) dllsearchpath=$dir;;
5622 *) func_append dllsearchpath ":$dir";;
5623 esac
5624 case :$dllsearchpath: in
5625 *":$testbindir:"*) ;;
5626 ::) dllsearchpath=$testbindir;;
5627 *) func_append dllsearchpath ":$testbindir";;
5628 esac
5630 esac
5631 deplibs="$deplibs $arg"
5632 continue
5635 -l*)
5636 if test "X$arg" = "X-lc" || test "X$arg" = "X-lm"; then
5637 case $host in
5638 *-*-cygwin* | *-*-mingw* | *-*-pw32* | *-*-beos* | *-cegcc* | *-*-haiku*)
5639 # These systems don't actually have a C or math library (as such)
5640 continue
5642 *-*-os2*)
5643 # These systems don't actually have a C library (as such)
5644 test "X$arg" = "X-lc" && continue
5646 *-*-openbsd* | *-*-freebsd* | *-*-dragonfly*)
5647 # Do not include libc due to us having libc/libc_r.
5648 test "X$arg" = "X-lc" && continue
5650 *-*-rhapsody* | *-*-darwin1.[012])
5651 # Rhapsody C and math libraries are in the System framework
5652 func_append deplibs " System.ltframework"
5653 continue
5655 *-*-sco3.2v5* | *-*-sco5v6*)
5656 # Causes problems with __ctype
5657 test "X$arg" = "X-lc" && continue
5659 *-*-sysv4.2uw2* | *-*-sysv5* | *-*-unixware* | *-*-OpenUNIX*)
5660 # Compiler inserts libc in the correct place for threads to work
5661 test "X$arg" = "X-lc" && continue
5663 esac
5664 elif test "X$arg" = "X-lc_r"; then
5665 case $host in
5666 *-*-openbsd* | *-*-freebsd* | *-*-dragonfly*)
5667 # Do not include libc_r directly, use -pthread flag.
5668 continue
5670 esac
5672 func_append deplibs " $arg"
5673 continue
5676 -module)
5677 module=yes
5678 continue
5681 # Tru64 UNIX uses -model [arg] to determine the layout of C++
5682 # classes, name mangling, and exception handling.
5683 # Darwin uses the -arch flag to determine output architecture.
5684 -model|-arch|-isysroot|--sysroot)
5685 func_append compiler_flags " $arg"
5686 func_append compile_command " $arg"
5687 func_append finalize_command " $arg"
5688 prev=xcompiler
5689 continue
5692 -mt|-mthreads|-kthread|-Kthread|-pthread|-pthreads|--thread-safe \
5693 |-threads|-fopenmp|-openmp|-mp|-xopenmp|-omp|-qsmp=*)
5694 func_append compiler_flags " $arg"
5695 func_append compile_command " $arg"
5696 func_append finalize_command " $arg"
5697 case "$new_inherited_linker_flags " in
5698 *" $arg "*) ;;
5699 * ) func_append new_inherited_linker_flags " $arg" ;;
5700 esac
5701 continue
5704 -multi_module)
5705 single_module="${wl}-multi_module"
5706 continue
5709 -no-fast-install)
5710 fast_install=no
5711 continue
5714 -no-install)
5715 case $host in
5716 *-*-cygwin* | *-*-mingw* | *-*-pw32* | *-*-os2* | *-*-darwin* | *-cegcc*)
5717 # The PATH hackery in wrapper scripts is required on Windows
5718 # and Darwin in order for the loader to find any dlls it needs.
5719 func_warning "\`-no-install' is ignored for $host"
5720 func_warning "assuming \`-no-fast-install' instead"
5721 fast_install=no
5723 *) no_install=yes ;;
5724 esac
5725 continue
5728 -no-undefined)
5729 allow_undefined=no
5730 continue
5733 -objectlist)
5734 prev=objectlist
5735 continue
5738 -o) prev=output ;;
5740 -precious-files-regex)
5741 prev=precious_regex
5742 continue
5745 -release)
5746 prev=release
5747 continue
5750 -rpath)
5751 prev=rpath
5752 continue
5756 prev=xrpath
5757 continue
5760 -R*)
5761 func_stripname '-R' '' "$arg"
5762 dir=$func_stripname_result
5763 # We need an absolute path.
5764 case $dir in
5765 [\\/]* | [A-Za-z]:[\\/]*) ;;
5767 func_stripname '=' '' "$dir"
5768 dir=$lt_sysroot$func_stripname_result
5771 func_fatal_error "only absolute run-paths are allowed"
5773 esac
5774 case "$xrpath " in
5775 *" $dir "*) ;;
5776 *) func_append xrpath " $dir" ;;
5777 esac
5778 continue
5781 -shared)
5782 # The effects of -shared are defined in a previous loop.
5783 continue
5786 -shrext)
5787 prev=shrext
5788 continue
5791 -static | -static-libtool-libs)
5792 # The effects of -static are defined in a previous loop.
5793 # We used to do the same as -all-static on platforms that
5794 # didn't have a PIC flag, but the assumption that the effects
5795 # would be equivalent was wrong. It would break on at least
5796 # Digital Unix and AIX.
5797 continue
5800 -thread-safe)
5801 thread_safe=yes
5802 continue
5805 -version-info)
5806 prev=vinfo
5807 continue
5810 -version-number)
5811 prev=vinfo
5812 vinfo_number=yes
5813 continue
5816 -weak)
5817 prev=weak
5818 continue
5821 -Wc,*)
5822 func_stripname '-Wc,' '' "$arg"
5823 args=$func_stripname_result
5824 arg=
5825 save_ifs="$IFS"; IFS=','
5826 for flag in $args; do
5827 IFS="$save_ifs"
5828 func_quote_for_eval "$flag"
5829 func_append arg " $func_quote_for_eval_result"
5830 func_append compiler_flags " $func_quote_for_eval_result"
5831 done
5832 IFS="$save_ifs"
5833 func_stripname ' ' '' "$arg"
5834 arg=$func_stripname_result
5837 -Wl,*)
5838 func_stripname '-Wl,' '' "$arg"
5839 args=$func_stripname_result
5840 arg=
5841 save_ifs="$IFS"; IFS=','
5842 for flag in $args; do
5843 IFS="$save_ifs"
5844 func_quote_for_eval "$flag"
5845 func_append arg " $wl$func_quote_for_eval_result"
5846 func_append compiler_flags " $wl$func_quote_for_eval_result"
5847 func_append linker_flags " $func_quote_for_eval_result"
5848 done
5849 IFS="$save_ifs"
5850 func_stripname ' ' '' "$arg"
5851 arg=$func_stripname_result
5854 -Xcompiler)
5855 prev=xcompiler
5856 continue
5859 -Xlinker)
5860 prev=xlinker
5861 continue
5864 -XCClinker)
5865 prev=xcclinker
5866 continue
5869 # -msg_* for osf cc
5870 -msg_*)
5871 func_quote_for_eval "$arg"
5872 arg="$func_quote_for_eval_result"
5875 # Flags to be passed through unchanged, with rationale:
5876 # -64, -mips[0-9] enable 64-bit mode for the SGI compiler
5877 # -r[0-9][0-9]* specify processor for the SGI compiler
5878 # -xarch=*, -xtarget=* enable 64-bit mode for the Sun compiler
5879 # +DA*, +DD* enable 64-bit mode for the HP compiler
5880 # -q* compiler args for the IBM compiler
5881 # -m*, -t[45]*, -txscale* architecture-specific flags for GCC
5882 # -F/path path to uninstalled frameworks, gcc on darwin
5883 # -p, -pg, --coverage, -fprofile-* profiling flags for GCC
5884 # @file GCC response files
5885 # -tp=* Portland pgcc target processor selection
5886 # --sysroot=* for sysroot support
5887 # -O*, -flto*, -fwhopr*, -fuse-linker-plugin GCC link-time optimization
5888 -64|-mips[0-9]|-r[0-9][0-9]*|-xarch=*|-xtarget=*|+DA*|+DD*|-q*|-m*| \
5889 -t[45]*|-txscale*|-p|-pg|--coverage|-fprofile-*|-F*|@*|-tp=*|--sysroot=*| \
5890 -O*|-flto*|-fwhopr*|-fuse-linker-plugin)
5891 func_quote_for_eval "$arg"
5892 arg="$func_quote_for_eval_result"
5893 func_append compile_command " $arg"
5894 func_append finalize_command " $arg"
5895 func_append compiler_flags " $arg"
5896 continue
5899 # Some other compiler flag.
5900 -* | +*)
5901 func_quote_for_eval "$arg"
5902 arg="$func_quote_for_eval_result"
5905 *.$objext)
5906 # A standard object.
5907 func_append objs " $arg"
5910 *.lo)
5911 # A libtool-controlled object.
5913 # Check to see that this really is a libtool object.
5914 if func_lalib_unsafe_p "$arg"; then
5915 pic_object=
5916 non_pic_object=
5918 # Read the .lo file
5919 func_source "$arg"
5921 if test -z "$pic_object" ||
5922 test -z "$non_pic_object" ||
5923 test "$pic_object" = none &&
5924 test "$non_pic_object" = none; then
5925 func_fatal_error "cannot find name of object for \`$arg'"
5928 # Extract subdirectory from the argument.
5929 func_dirname "$arg" "/" ""
5930 xdir="$func_dirname_result"
5932 if test "$pic_object" != none; then
5933 # Prepend the subdirectory the object is found in.
5934 pic_object="$xdir$pic_object"
5936 if test "$prev" = dlfiles; then
5937 if test "$build_libtool_libs" = yes && test "$dlopen_support" = yes; then
5938 func_append dlfiles " $pic_object"
5939 prev=
5940 continue
5941 else
5942 # If libtool objects are unsupported, then we need to preload.
5943 prev=dlprefiles
5947 # CHECK ME: I think I busted this. -Ossama
5948 if test "$prev" = dlprefiles; then
5949 # Preload the old-style object.
5950 func_append dlprefiles " $pic_object"
5951 prev=
5954 # A PIC object.
5955 func_append libobjs " $pic_object"
5956 arg="$pic_object"
5959 # Non-PIC object.
5960 if test "$non_pic_object" != none; then
5961 # Prepend the subdirectory the object is found in.
5962 non_pic_object="$xdir$non_pic_object"
5964 # A standard non-PIC object
5965 func_append non_pic_objects " $non_pic_object"
5966 if test -z "$pic_object" || test "$pic_object" = none ; then
5967 arg="$non_pic_object"
5969 else
5970 # If the PIC object exists, use it instead.
5971 # $xdir was prepended to $pic_object above.
5972 non_pic_object="$pic_object"
5973 func_append non_pic_objects " $non_pic_object"
5975 else
5976 # Only an error if not doing a dry-run.
5977 if $opt_dry_run; then
5978 # Extract subdirectory from the argument.
5979 func_dirname "$arg" "/" ""
5980 xdir="$func_dirname_result"
5982 func_lo2o "$arg"
5983 pic_object=$xdir$objdir/$func_lo2o_result
5984 non_pic_object=$xdir$func_lo2o_result
5985 func_append libobjs " $pic_object"
5986 func_append non_pic_objects " $non_pic_object"
5987 else
5988 func_fatal_error "\`$arg' is not a valid libtool object"
5993 *.$libext)
5994 # An archive.
5995 func_append deplibs " $arg"
5996 func_append old_deplibs " $arg"
5997 continue
6000 *.la)
6001 # A libtool-controlled library.
6003 func_resolve_sysroot "$arg"
6004 if test "$prev" = dlfiles; then
6005 # This library was specified with -dlopen.
6006 func_append dlfiles " $func_resolve_sysroot_result"
6007 prev=
6008 elif test "$prev" = dlprefiles; then
6009 # The library was specified with -dlpreopen.
6010 func_append dlprefiles " $func_resolve_sysroot_result"
6011 prev=
6012 else
6013 func_append deplibs " $func_resolve_sysroot_result"
6015 continue
6018 # Some other compiler argument.
6020 # Unknown arguments in both finalize_command and compile_command need
6021 # to be aesthetically quoted because they are evaled later.
6022 func_quote_for_eval "$arg"
6023 arg="$func_quote_for_eval_result"
6025 esac # arg
6027 # Now actually substitute the argument into the commands.
6028 if test -n "$arg"; then
6029 func_append compile_command " $arg"
6030 func_append finalize_command " $arg"
6032 done # argument parsing loop
6034 test -n "$prev" && \
6035 func_fatal_help "the \`$prevarg' option requires an argument"
6037 if test "$export_dynamic" = yes && test -n "$export_dynamic_flag_spec"; then
6038 eval arg=\"$export_dynamic_flag_spec\"
6039 func_append compile_command " $arg"
6040 func_append finalize_command " $arg"
6043 oldlibs=
6044 # calculate the name of the file, without its directory
6045 func_basename "$output"
6046 outputname="$func_basename_result"
6047 libobjs_save="$libobjs"
6049 if test -n "$shlibpath_var"; then
6050 # get the directories listed in $shlibpath_var
6051 eval shlib_search_path=\`\$ECHO \"\${$shlibpath_var}\" \| \$SED \'s/:/ /g\'\`
6052 else
6053 shlib_search_path=
6055 eval sys_lib_search_path=\"$sys_lib_search_path_spec\"
6056 eval sys_lib_dlsearch_path=\"$sys_lib_dlsearch_path_spec\"
6058 func_dirname "$output" "/" ""
6059 output_objdir="$func_dirname_result$objdir"
6060 func_to_tool_file "$output_objdir/"
6061 tool_output_objdir=$func_to_tool_file_result
6062 # Create the object directory.
6063 func_mkdir_p "$output_objdir"
6065 # Determine the type of output
6066 case $output in
6068 func_fatal_help "you must specify an output file"
6070 *.$libext) linkmode=oldlib ;;
6071 *.lo | *.$objext) linkmode=obj ;;
6072 *.la) linkmode=lib ;;
6073 *) linkmode=prog ;; # Anything else should be a program.
6074 esac
6076 specialdeplibs=
6078 libs=
6079 # Find all interdependent deplibs by searching for libraries
6080 # that are linked more than once (e.g. -la -lb -la)
6081 for deplib in $deplibs; do
6082 if $opt_preserve_dup_deps ; then
6083 case "$libs " in
6084 *" $deplib "*) func_append specialdeplibs " $deplib" ;;
6085 esac
6087 func_append libs " $deplib"
6088 done
6090 if test "$linkmode" = lib; then
6091 libs="$predeps $libs $compiler_lib_search_path $postdeps"
6093 # Compute libraries that are listed more than once in $predeps
6094 # $postdeps and mark them as special (i.e., whose duplicates are
6095 # not to be eliminated).
6096 pre_post_deps=
6097 if $opt_duplicate_compiler_generated_deps; then
6098 for pre_post_dep in $predeps $postdeps; do
6099 case "$pre_post_deps " in
6100 *" $pre_post_dep "*) func_append specialdeplibs " $pre_post_deps" ;;
6101 esac
6102 func_append pre_post_deps " $pre_post_dep"
6103 done
6105 pre_post_deps=
6108 deplibs=
6109 newdependency_libs=
6110 newlib_search_path=
6111 need_relink=no # whether we're linking any uninstalled libtool libraries
6112 notinst_deplibs= # not-installed libtool libraries
6113 notinst_path= # paths that contain not-installed libtool libraries
6115 case $linkmode in
6116 lib)
6117 passes="conv dlpreopen link"
6118 for file in $dlfiles $dlprefiles; do
6119 case $file in
6120 *.la) ;;
6122 func_fatal_help "libraries can \`-dlopen' only libtool libraries: $file"
6124 esac
6125 done
6127 prog)
6128 compile_deplibs=
6129 finalize_deplibs=
6130 alldeplibs=no
6131 newdlfiles=
6132 newdlprefiles=
6133 passes="conv scan dlopen dlpreopen link"
6135 *) passes="conv"
6137 esac
6139 for pass in $passes; do
6140 # The preopen pass in lib mode reverses $deplibs; put it back here
6141 # so that -L comes before libs that need it for instance...
6142 if test "$linkmode,$pass" = "lib,link"; then
6143 ## FIXME: Find the place where the list is rebuilt in the wrong
6144 ## order, and fix it there properly
6145 tmp_deplibs=
6146 for deplib in $deplibs; do
6147 tmp_deplibs="$deplib $tmp_deplibs"
6148 done
6149 deplibs="$tmp_deplibs"
6152 if test "$linkmode,$pass" = "lib,link" ||
6153 test "$linkmode,$pass" = "prog,scan"; then
6154 libs="$deplibs"
6155 deplibs=
6157 if test "$linkmode" = prog; then
6158 case $pass in
6159 dlopen) libs="$dlfiles" ;;
6160 dlpreopen) libs="$dlprefiles" ;;
6161 link) libs="$deplibs %DEPLIBS% $dependency_libs" ;;
6162 esac
6164 if test "$linkmode,$pass" = "lib,dlpreopen"; then
6165 # Collect and forward deplibs of preopened libtool libs
6166 for lib in $dlprefiles; do
6167 # Ignore non-libtool-libs
6168 dependency_libs=
6169 func_resolve_sysroot "$lib"
6170 case $lib in
6171 *.la) func_source "$func_resolve_sysroot_result" ;;
6172 esac
6174 # Collect preopened libtool deplibs, except any this library
6175 # has declared as weak libs
6176 for deplib in $dependency_libs; do
6177 func_basename "$deplib"
6178 deplib_base=$func_basename_result
6179 case " $weak_libs " in
6180 *" $deplib_base "*) ;;
6181 *) func_append deplibs " $deplib" ;;
6182 esac
6183 done
6184 done
6185 libs="$dlprefiles"
6187 if test "$pass" = dlopen; then
6188 # Collect dlpreopened libraries
6189 save_deplibs="$deplibs"
6190 deplibs=
6193 for deplib in $libs; do
6194 lib=
6195 found=no
6196 case $deplib in
6197 -mt|-mthreads|-kthread|-Kthread|-pthread|-pthreads|--thread-safe \
6198 |-threads|-fopenmp|-openmp|-mp|-xopenmp|-omp|-qsmp=*)
6199 if test "$linkmode,$pass" = "prog,link"; then
6200 compile_deplibs="$deplib $compile_deplibs"
6201 finalize_deplibs="$deplib $finalize_deplibs"
6202 else
6203 func_append compiler_flags " $deplib"
6206 case $linkmode in
6207 lib)
6208 deplibs="$deplib $deplibs"
6209 test "$pass" = conv && continue
6210 newdependency_libs="$deplib $newdependency_libs"
6212 prog)
6213 if test "$pass" = conv; then
6214 deplibs="$deplib $deplibs"
6215 continue
6217 if test "$pass" = scan; then
6218 deplibs="$deplib $deplibs"
6219 else
6220 compile_deplibs="$deplib $compile_deplibs"
6221 finalize_deplibs="$deplib $finalize_deplibs"
6226 esac # linkmode
6228 continue
6230 -l*)
6231 if test "$linkmode" != lib && test "$linkmode" != prog; then
6232 func_warning "\`-l' is ignored for archives/objects"
6233 continue
6235 func_stripname '-l' '' "$deplib"
6236 name=$func_stripname_result
6237 if test "$linkmode" = lib; then
6238 searchdirs="$newlib_search_path $lib_search_path $compiler_lib_search_dirs $sys_lib_search_path $shlib_search_path"
6239 else
6240 searchdirs="$newlib_search_path $lib_search_path $sys_lib_search_path $shlib_search_path"
6242 for searchdir in $searchdirs; do
6243 for search_ext in .la $std_shrext .so .a; do
6244 # Search the libtool library
6245 lib="$searchdir/lib${name}${search_ext}"
6246 if test -f "$lib"; then
6247 if test "$search_ext" = ".la"; then
6248 found=yes
6249 else
6250 found=no
6252 break 2
6254 done
6255 done
6256 if test "$found" != yes; then
6257 # deplib doesn't seem to be a libtool library
6258 if test "$linkmode,$pass" = "prog,link"; then
6259 compile_deplibs="$deplib $compile_deplibs"
6260 finalize_deplibs="$deplib $finalize_deplibs"
6261 else
6262 deplibs="$deplib $deplibs"
6263 test "$linkmode" = lib && newdependency_libs="$deplib $newdependency_libs"
6265 continue
6266 else # deplib is a libtool library
6267 # If $allow_libtool_libs_with_static_runtimes && $deplib is a stdlib,
6268 # We need to do some special things here, and not later.
6269 if test "X$allow_libtool_libs_with_static_runtimes" = "Xyes" ; then
6270 case " $predeps $postdeps " in
6271 *" $deplib "*)
6272 if func_lalib_p "$lib"; then
6273 library_names=
6274 old_library=
6275 func_source "$lib"
6276 for l in $old_library $library_names; do
6277 ll="$l"
6278 done
6279 if test "X$ll" = "X$old_library" ; then # only static version available
6280 found=no
6281 func_dirname "$lib" "" "."
6282 ladir="$func_dirname_result"
6283 lib=$ladir/$old_library
6284 if test "$linkmode,$pass" = "prog,link"; then
6285 compile_deplibs="$deplib $compile_deplibs"
6286 finalize_deplibs="$deplib $finalize_deplibs"
6287 else
6288 deplibs="$deplib $deplibs"
6289 test "$linkmode" = lib && newdependency_libs="$deplib $newdependency_libs"
6291 continue
6295 *) ;;
6296 esac
6299 ;; # -l
6300 *.ltframework)
6301 if test "$linkmode,$pass" = "prog,link"; then
6302 compile_deplibs="$deplib $compile_deplibs"
6303 finalize_deplibs="$deplib $finalize_deplibs"
6304 else
6305 deplibs="$deplib $deplibs"
6306 if test "$linkmode" = lib ; then
6307 case "$new_inherited_linker_flags " in
6308 *" $deplib "*) ;;
6309 * ) func_append new_inherited_linker_flags " $deplib" ;;
6310 esac
6313 continue
6315 -L*)
6316 case $linkmode in
6317 lib)
6318 deplibs="$deplib $deplibs"
6319 test "$pass" = conv && continue
6320 newdependency_libs="$deplib $newdependency_libs"
6321 func_stripname '-L' '' "$deplib"
6322 func_resolve_sysroot "$func_stripname_result"
6323 func_append newlib_search_path " $func_resolve_sysroot_result"
6325 prog)
6326 if test "$pass" = conv; then
6327 deplibs="$deplib $deplibs"
6328 continue
6330 if test "$pass" = scan; then
6331 deplibs="$deplib $deplibs"
6332 else
6333 compile_deplibs="$deplib $compile_deplibs"
6334 finalize_deplibs="$deplib $finalize_deplibs"
6336 func_stripname '-L' '' "$deplib"
6337 func_resolve_sysroot "$func_stripname_result"
6338 func_append newlib_search_path " $func_resolve_sysroot_result"
6341 func_warning "\`-L' is ignored for archives/objects"
6343 esac # linkmode
6344 continue
6345 ;; # -L
6346 -R*)
6347 if test "$pass" = link; then
6348 func_stripname '-R' '' "$deplib"
6349 func_resolve_sysroot "$func_stripname_result"
6350 dir=$func_resolve_sysroot_result
6351 # Make sure the xrpath contains only unique directories.
6352 case "$xrpath " in
6353 *" $dir "*) ;;
6354 *) func_append xrpath " $dir" ;;
6355 esac
6357 deplibs="$deplib $deplibs"
6358 continue
6360 *.la)
6361 func_resolve_sysroot "$deplib"
6362 lib=$func_resolve_sysroot_result
6364 *.$libext)
6365 if test "$pass" = conv; then
6366 deplibs="$deplib $deplibs"
6367 continue
6369 case $linkmode in
6370 lib)
6371 # Linking convenience modules into shared libraries is allowed,
6372 # but linking other static libraries is non-portable.
6373 case " $dlpreconveniencelibs " in
6374 *" $deplib "*) ;;
6376 valid_a_lib=no
6377 case $deplibs_check_method in
6378 match_pattern*)
6379 set dummy $deplibs_check_method; shift
6380 match_pattern_regex=`expr "$deplibs_check_method" : "$1 \(.*\)"`
6381 if eval "\$ECHO \"$deplib\"" 2>/dev/null | $SED 10q \
6382 | $EGREP "$match_pattern_regex" > /dev/null; then
6383 valid_a_lib=yes
6386 pass_all)
6387 valid_a_lib=yes
6389 esac
6390 if test "$valid_a_lib" != yes; then
6391 echo
6392 $ECHO "*** Warning: Trying to link with static lib archive $deplib."
6393 echo "*** I have the capability to make that library automatically link in when"
6394 echo "*** you link to this library. But I can only do this if you have a"
6395 echo "*** shared version of the library, which you do not appear to have"
6396 echo "*** because the file extensions .$libext of this argument makes me believe"
6397 echo "*** that it is just a static archive that I should not use here."
6398 else
6399 echo
6400 $ECHO "*** Warning: Linking the shared library $output against the"
6401 $ECHO "*** static library $deplib is not portable!"
6402 deplibs="$deplib $deplibs"
6405 esac
6406 continue
6408 prog)
6409 if test "$pass" != link; then
6410 deplibs="$deplib $deplibs"
6411 else
6412 compile_deplibs="$deplib $compile_deplibs"
6413 finalize_deplibs="$deplib $finalize_deplibs"
6415 continue
6417 esac # linkmode
6418 ;; # *.$libext
6419 *.lo | *.$objext)
6420 if test "$pass" = conv; then
6421 deplibs="$deplib $deplibs"
6422 elif test "$linkmode" = prog; then
6423 if test "$pass" = dlpreopen || test "$dlopen_support" != yes || test "$build_libtool_libs" = no; then
6424 # If there is no dlopen support or we're linking statically,
6425 # we need to preload.
6426 func_append newdlprefiles " $deplib"
6427 compile_deplibs="$deplib $compile_deplibs"
6428 finalize_deplibs="$deplib $finalize_deplibs"
6429 else
6430 func_append newdlfiles " $deplib"
6433 continue
6435 %DEPLIBS%)
6436 alldeplibs=yes
6437 continue
6439 esac # case $deplib
6441 if test "$found" = yes || test -f "$lib"; then :
6442 else
6443 func_fatal_error "cannot find the library \`$lib' or unhandled argument \`$deplib'"
6446 # Check to see that this really is a libtool archive.
6447 func_lalib_unsafe_p "$lib" \
6448 || func_fatal_error "\`$lib' is not a valid libtool archive"
6450 func_dirname "$lib" "" "."
6451 ladir="$func_dirname_result"
6453 dlname=
6454 dlopen=
6455 dlpreopen=
6456 libdir=
6457 library_names=
6458 old_library=
6459 inherited_linker_flags=
6460 # If the library was installed with an old release of libtool,
6461 # it will not redefine variables installed, or shouldnotlink
6462 installed=yes
6463 shouldnotlink=no
6464 avoidtemprpath=
6467 # Read the .la file
6468 func_source "$lib"
6470 # Convert "-framework foo" to "foo.ltframework"
6471 if test -n "$inherited_linker_flags"; then
6472 tmp_inherited_linker_flags=`$ECHO "$inherited_linker_flags" | $SED 's/-framework \([^ $]*\)/\1.ltframework/g'`
6473 for tmp_inherited_linker_flag in $tmp_inherited_linker_flags; do
6474 case " $new_inherited_linker_flags " in
6475 *" $tmp_inherited_linker_flag "*) ;;
6476 *) func_append new_inherited_linker_flags " $tmp_inherited_linker_flag";;
6477 esac
6478 done
6480 dependency_libs=`$ECHO " $dependency_libs" | $SED 's% \([^ $]*\).ltframework% -framework \1%g'`
6481 if test "$linkmode,$pass" = "lib,link" ||
6482 test "$linkmode,$pass" = "prog,scan" ||
6483 { test "$linkmode" != prog && test "$linkmode" != lib; }; then
6484 test -n "$dlopen" && func_append dlfiles " $dlopen"
6485 test -n "$dlpreopen" && func_append dlprefiles " $dlpreopen"
6488 if test "$pass" = conv; then
6489 # Only check for convenience libraries
6490 deplibs="$lib $deplibs"
6491 if test -z "$libdir"; then
6492 if test -z "$old_library"; then
6493 func_fatal_error "cannot find name of link library for \`$lib'"
6495 # It is a libtool convenience library, so add in its objects.
6496 func_append convenience " $ladir/$objdir/$old_library"
6497 func_append old_convenience " $ladir/$objdir/$old_library"
6498 elif test "$linkmode" != prog && test "$linkmode" != lib; then
6499 func_fatal_error "\`$lib' is not a convenience library"
6501 tmp_libs=
6502 for deplib in $dependency_libs; do
6503 deplibs="$deplib $deplibs"
6504 if $opt_preserve_dup_deps ; then
6505 case "$tmp_libs " in
6506 *" $deplib "*) func_append specialdeplibs " $deplib" ;;
6507 esac
6509 func_append tmp_libs " $deplib"
6510 done
6511 continue
6512 fi # $pass = conv
6515 # Get the name of the library we link against.
6516 linklib=
6517 if test -n "$old_library" &&
6518 { test "$prefer_static_libs" = yes ||
6519 test "$prefer_static_libs,$installed" = "built,no"; }; then
6520 linklib=$old_library
6521 else
6522 for l in $old_library $library_names; do
6523 linklib="$l"
6524 done
6526 if test -z "$linklib"; then
6527 func_fatal_error "cannot find name of link library for \`$lib'"
6530 # This library was specified with -dlopen.
6531 if test "$pass" = dlopen; then
6532 if test -z "$libdir"; then
6533 func_fatal_error "cannot -dlopen a convenience library: \`$lib'"
6535 if test -z "$dlname" ||
6536 test "$dlopen_support" != yes ||
6537 test "$build_libtool_libs" = no; then
6538 # If there is no dlname, no dlopen support or we're linking
6539 # statically, we need to preload. We also need to preload any
6540 # dependent libraries so libltdl's deplib preloader doesn't
6541 # bomb out in the load deplibs phase.
6542 func_append dlprefiles " $lib $dependency_libs"
6543 else
6544 func_append newdlfiles " $lib"
6546 continue
6547 fi # $pass = dlopen
6549 # We need an absolute path.
6550 case $ladir in
6551 [\\/]* | [A-Za-z]:[\\/]*) abs_ladir="$ladir" ;;
6553 abs_ladir=`cd "$ladir" && pwd`
6554 if test -z "$abs_ladir"; then
6555 func_warning "cannot determine absolute directory name of \`$ladir'"
6556 func_warning "passing it literally to the linker, although it might fail"
6557 abs_ladir="$ladir"
6560 esac
6561 func_basename "$lib"
6562 laname="$func_basename_result"
6564 # Find the relevant object directory and library name.
6565 if test "X$installed" = Xyes; then
6566 if test ! -f "$lt_sysroot$libdir/$linklib" && test -f "$abs_ladir/$linklib"; then
6567 func_warning "library \`$lib' was moved."
6568 dir="$ladir"
6569 absdir="$abs_ladir"
6570 libdir="$abs_ladir"
6571 else
6572 dir="$lt_sysroot$libdir"
6573 absdir="$lt_sysroot$libdir"
6575 test "X$hardcode_automatic" = Xyes && avoidtemprpath=yes
6576 else
6577 if test ! -f "$ladir/$objdir/$linklib" && test -f "$abs_ladir/$linklib"; then
6578 dir="$ladir"
6579 absdir="$abs_ladir"
6580 # Remove this search path later
6581 func_append notinst_path " $abs_ladir"
6582 else
6583 dir="$ladir/$objdir"
6584 absdir="$abs_ladir/$objdir"
6585 # Remove this search path later
6586 func_append notinst_path " $abs_ladir"
6588 fi # $installed = yes
6589 func_stripname 'lib' '.la' "$laname"
6590 name=$func_stripname_result
6592 # This library was specified with -dlpreopen.
6593 if test "$pass" = dlpreopen; then
6594 if test -z "$libdir" && test "$linkmode" = prog; then
6595 func_fatal_error "only libraries may -dlpreopen a convenience library: \`$lib'"
6597 case "$host" in
6598 # special handling for platforms with PE-DLLs.
6599 *cygwin* | *mingw* | *cegcc* )
6600 # Linker will automatically link against shared library if both
6601 # static and shared are present. Therefore, ensure we extract
6602 # symbols from the import library if a shared library is present
6603 # (otherwise, the dlopen module name will be incorrect). We do
6604 # this by putting the import library name into $newdlprefiles.
6605 # We recover the dlopen module name by 'saving' the la file
6606 # name in a special purpose variable, and (later) extracting the
6607 # dlname from the la file.
6608 if test -n "$dlname"; then
6609 func_tr_sh "$dir/$linklib"
6610 eval "libfile_$func_tr_sh_result=\$abs_ladir/\$laname"
6611 func_append newdlprefiles " $dir/$linklib"
6612 else
6613 func_append newdlprefiles " $dir/$old_library"
6614 # Keep a list of preopened convenience libraries to check
6615 # that they are being used correctly in the link pass.
6616 test -z "$libdir" && \
6617 func_append dlpreconveniencelibs " $dir/$old_library"
6621 # Prefer using a static library (so that no silly _DYNAMIC symbols
6622 # are required to link).
6623 if test -n "$old_library"; then
6624 func_append newdlprefiles " $dir/$old_library"
6625 # Keep a list of preopened convenience libraries to check
6626 # that they are being used correctly in the link pass.
6627 test -z "$libdir" && \
6628 func_append dlpreconveniencelibs " $dir/$old_library"
6629 # Otherwise, use the dlname, so that lt_dlopen finds it.
6630 elif test -n "$dlname"; then
6631 func_append newdlprefiles " $dir/$dlname"
6632 else
6633 func_append newdlprefiles " $dir/$linklib"
6636 esac
6637 fi # $pass = dlpreopen
6639 if test -z "$libdir"; then
6640 # Link the convenience library
6641 if test "$linkmode" = lib; then
6642 deplibs="$dir/$old_library $deplibs"
6643 elif test "$linkmode,$pass" = "prog,link"; then
6644 compile_deplibs="$dir/$old_library $compile_deplibs"
6645 finalize_deplibs="$dir/$old_library $finalize_deplibs"
6646 else
6647 deplibs="$lib $deplibs" # used for prog,scan pass
6649 continue
6653 if test "$linkmode" = prog && test "$pass" != link; then
6654 func_append newlib_search_path " $ladir"
6655 deplibs="$lib $deplibs"
6657 linkalldeplibs=no
6658 if test "$link_all_deplibs" != no || test -z "$library_names" ||
6659 test "$build_libtool_libs" = no; then
6660 linkalldeplibs=yes
6663 tmp_libs=
6664 for deplib in $dependency_libs; do
6665 case $deplib in
6666 -L*) func_stripname '-L' '' "$deplib"
6667 func_resolve_sysroot "$func_stripname_result"
6668 func_append newlib_search_path " $func_resolve_sysroot_result"
6670 esac
6671 # Need to link against all dependency_libs?
6672 if test "$linkalldeplibs" = yes; then
6673 deplibs="$deplib $deplibs"
6674 else
6675 # Need to hardcode shared library paths
6676 # or/and link against static libraries
6677 newdependency_libs="$deplib $newdependency_libs"
6679 if $opt_preserve_dup_deps ; then
6680 case "$tmp_libs " in
6681 *" $deplib "*) func_append specialdeplibs " $deplib" ;;
6682 esac
6684 func_append tmp_libs " $deplib"
6685 done # for deplib
6686 continue
6687 fi # $linkmode = prog...
6689 if test "$linkmode,$pass" = "prog,link"; then
6690 if test -n "$library_names" &&
6691 { { test "$prefer_static_libs" = no ||
6692 test "$prefer_static_libs,$installed" = "built,yes"; } ||
6693 test -z "$old_library"; }; then
6694 # We need to hardcode the library path
6695 if test -n "$shlibpath_var" && test -z "$avoidtemprpath" ; then
6696 # Make sure the rpath contains only unique directories.
6697 case "$temp_rpath:" in
6698 *"$absdir:"*) ;;
6699 *) func_append temp_rpath "$absdir:" ;;
6700 esac
6703 # Hardcode the library path.
6704 # Skip directories that are in the system default run-time
6705 # search path.
6706 case " $sys_lib_dlsearch_path " in
6707 *" $absdir "*) ;;
6709 case "$compile_rpath " in
6710 *" $absdir "*) ;;
6711 *) func_append compile_rpath " $absdir" ;;
6712 esac
6714 esac
6715 case " $sys_lib_dlsearch_path " in
6716 *" $libdir "*) ;;
6718 case "$finalize_rpath " in
6719 *" $libdir "*) ;;
6720 *) func_append finalize_rpath " $libdir" ;;
6721 esac
6723 esac
6724 fi # $linkmode,$pass = prog,link...
6726 if test "$alldeplibs" = yes &&
6727 { test "$deplibs_check_method" = pass_all ||
6728 { test "$build_libtool_libs" = yes &&
6729 test -n "$library_names"; }; }; then
6730 # We only need to search for static libraries
6731 continue
6735 link_static=no # Whether the deplib will be linked statically
6736 use_static_libs=$prefer_static_libs
6737 if test "$use_static_libs" = built && test "$installed" = yes; then
6738 use_static_libs=no
6740 if test -n "$library_names" &&
6741 { test "$use_static_libs" = no || test -z "$old_library"; }; then
6742 case $host in
6743 *cygwin* | *mingw* | *cegcc*)
6744 # No point in relinking DLLs because paths are not encoded
6745 func_append notinst_deplibs " $lib"
6746 need_relink=no
6749 if test "$installed" = no; then
6750 func_append notinst_deplibs " $lib"
6751 need_relink=yes
6754 esac
6755 # This is a shared library
6757 # Warn about portability, can't link against -module's on some
6758 # systems (darwin). Don't bleat about dlopened modules though!
6759 dlopenmodule=""
6760 for dlpremoduletest in $dlprefiles; do
6761 if test "X$dlpremoduletest" = "X$lib"; then
6762 dlopenmodule="$dlpremoduletest"
6763 break
6765 done
6766 if test -z "$dlopenmodule" && test "$shouldnotlink" = yes && test "$pass" = link; then
6767 echo
6768 if test "$linkmode" = prog; then
6769 $ECHO "*** Warning: Linking the executable $output against the loadable module"
6770 else
6771 $ECHO "*** Warning: Linking the shared library $output against the loadable module"
6773 $ECHO "*** $linklib is not portable!"
6775 if test "$linkmode" = lib &&
6776 test "$hardcode_into_libs" = yes; then
6777 # Hardcode the library path.
6778 # Skip directories that are in the system default run-time
6779 # search path.
6780 case " $sys_lib_dlsearch_path " in
6781 *" $absdir "*) ;;
6783 case "$compile_rpath " in
6784 *" $absdir "*) ;;
6785 *) func_append compile_rpath " $absdir" ;;
6786 esac
6788 esac
6789 case " $sys_lib_dlsearch_path " in
6790 *" $libdir "*) ;;
6792 case "$finalize_rpath " in
6793 *" $libdir "*) ;;
6794 *) func_append finalize_rpath " $libdir" ;;
6795 esac
6797 esac
6800 if test -n "$old_archive_from_expsyms_cmds"; then
6801 # figure out the soname
6802 set dummy $library_names
6803 shift
6804 realname="$1"
6805 shift
6806 libname=`eval "\\$ECHO \"$libname_spec\""`
6807 # use dlname if we got it. it's perfectly good, no?
6808 if test -n "$dlname"; then
6809 soname="$dlname"
6810 elif test -n "$soname_spec"; then
6811 # bleh windows
6812 case $host in
6813 *cygwin* | mingw* | *cegcc*)
6814 func_arith $current - $age
6815 major=$func_arith_result
6816 versuffix="-$major"
6818 esac
6819 eval soname=\"$soname_spec\"
6820 else
6821 soname="$realname"
6824 # Make a new name for the extract_expsyms_cmds to use
6825 soroot="$soname"
6826 func_basename "$soroot"
6827 soname="$func_basename_result"
6828 func_stripname 'lib' '.dll' "$soname"
6829 newlib=libimp-$func_stripname_result.a
6831 # If the library has no export list, then create one now
6832 if test -f "$output_objdir/$soname-def"; then :
6833 else
6834 func_verbose "extracting exported symbol list from \`$soname'"
6835 func_execute_cmds "$extract_expsyms_cmds" 'exit $?'
6838 # Create $newlib
6839 if test -f "$output_objdir/$newlib"; then :; else
6840 func_verbose "generating import library for \`$soname'"
6841 func_execute_cmds "$old_archive_from_expsyms_cmds" 'exit $?'
6843 # make sure the library variables are pointing to the new library
6844 dir=$output_objdir
6845 linklib=$newlib
6846 fi # test -n "$old_archive_from_expsyms_cmds"
6848 if test "$linkmode" = prog || test "$opt_mode" != relink; then
6849 add_shlibpath=
6850 add_dir=
6851 add=
6852 lib_linked=yes
6853 case $hardcode_action in
6854 immediate | unsupported)
6855 if test "$hardcode_direct" = no; then
6856 add="$dir/$linklib"
6857 case $host in
6858 *-*-sco3.2v5.0.[024]*) add_dir="-L$dir" ;;
6859 *-*-sysv4*uw2*) add_dir="-L$dir" ;;
6860 *-*-sysv5OpenUNIX* | *-*-sysv5UnixWare7.[01].[10]* | \
6861 *-*-unixware7*) add_dir="-L$dir" ;;
6862 *-*-darwin* )
6863 # if the lib is a (non-dlopened) module then we can not
6864 # link against it, someone is ignoring the earlier warnings
6865 if /usr/bin/file -L $add 2> /dev/null |
6866 $GREP ": [^:]* bundle" >/dev/null ; then
6867 if test "X$dlopenmodule" != "X$lib"; then
6868 $ECHO "*** Warning: lib $linklib is a module, not a shared library"
6869 if test -z "$old_library" ; then
6870 echo
6871 echo "*** And there doesn't seem to be a static archive available"
6872 echo "*** The link will probably fail, sorry"
6873 else
6874 add="$dir/$old_library"
6876 elif test -n "$old_library"; then
6877 add="$dir/$old_library"
6880 esac
6881 elif test "$hardcode_minus_L" = no; then
6882 case $host in
6883 *-*-sunos*) add_shlibpath="$dir" ;;
6884 esac
6885 add_dir="-L$dir"
6886 add="-l$name"
6887 elif test "$hardcode_shlibpath_var" = no; then
6888 add_shlibpath="$dir"
6889 add="-l$name"
6890 else
6891 lib_linked=no
6894 relink)
6895 if test "$hardcode_direct" = yes &&
6896 test "$hardcode_direct_absolute" = no; then
6897 add="$dir/$linklib"
6898 elif test "$hardcode_minus_L" = yes; then
6899 add_dir="-L$absdir"
6900 # Try looking first in the location we're being installed to.
6901 if test -n "$inst_prefix_dir"; then
6902 case $libdir in
6903 [\\/]*)
6904 func_append add_dir " -L$inst_prefix_dir$libdir"
6906 esac
6908 add="-l$name"
6909 elif test "$hardcode_shlibpath_var" = yes; then
6910 add_shlibpath="$dir"
6911 add="-l$name"
6912 else
6913 lib_linked=no
6916 *) lib_linked=no ;;
6917 esac
6919 if test "$lib_linked" != yes; then
6920 func_fatal_configuration "unsupported hardcode properties"
6923 if test -n "$add_shlibpath"; then
6924 case :$compile_shlibpath: in
6925 *":$add_shlibpath:"*) ;;
6926 *) func_append compile_shlibpath "$add_shlibpath:" ;;
6927 esac
6929 if test "$linkmode" = prog; then
6930 test -n "$add_dir" && compile_deplibs="$add_dir $compile_deplibs"
6931 test -n "$add" && compile_deplibs="$add $compile_deplibs"
6932 else
6933 test -n "$add_dir" && deplibs="$add_dir $deplibs"
6934 test -n "$add" && deplibs="$add $deplibs"
6935 if test "$hardcode_direct" != yes &&
6936 test "$hardcode_minus_L" != yes &&
6937 test "$hardcode_shlibpath_var" = yes; then
6938 case :$finalize_shlibpath: in
6939 *":$libdir:"*) ;;
6940 *) func_append finalize_shlibpath "$libdir:" ;;
6941 esac
6946 if test "$linkmode" = prog || test "$opt_mode" = relink; then
6947 add_shlibpath=
6948 add_dir=
6949 add=
6950 # Finalize command for both is simple: just hardcode it.
6951 if test "$hardcode_direct" = yes &&
6952 test "$hardcode_direct_absolute" = no; then
6953 add="$libdir/$linklib"
6954 elif test "$hardcode_minus_L" = yes; then
6955 add_dir="-L$libdir"
6956 add="-l$name"
6957 elif test "$hardcode_shlibpath_var" = yes; then
6958 case :$finalize_shlibpath: in
6959 *":$libdir:"*) ;;
6960 *) func_append finalize_shlibpath "$libdir:" ;;
6961 esac
6962 add="-l$name"
6963 elif test "$hardcode_automatic" = yes; then
6964 if test -n "$inst_prefix_dir" &&
6965 test -f "$inst_prefix_dir$libdir/$linklib" ; then
6966 add="$inst_prefix_dir$libdir/$linklib"
6967 else
6968 add="$libdir/$linklib"
6970 else
6971 # We cannot seem to hardcode it, guess we'll fake it.
6972 add_dir="-L$libdir"
6973 # Try looking first in the location we're being installed to.
6974 if test -n "$inst_prefix_dir"; then
6975 case $libdir in
6976 [\\/]*)
6977 func_append add_dir " -L$inst_prefix_dir$libdir"
6979 esac
6981 add="-l$name"
6984 if test "$linkmode" = prog; then
6985 test -n "$add_dir" && finalize_deplibs="$add_dir $finalize_deplibs"
6986 test -n "$add" && finalize_deplibs="$add $finalize_deplibs"
6987 else
6988 test -n "$add_dir" && deplibs="$add_dir $deplibs"
6989 test -n "$add" && deplibs="$add $deplibs"
6992 elif test "$linkmode" = prog; then
6993 # Here we assume that one of hardcode_direct or hardcode_minus_L
6994 # is not unsupported. This is valid on all known static and
6995 # shared platforms.
6996 if test "$hardcode_direct" != unsupported; then
6997 test -n "$old_library" && linklib="$old_library"
6998 compile_deplibs="$dir/$linklib $compile_deplibs"
6999 finalize_deplibs="$dir/$linklib $finalize_deplibs"
7000 else
7001 compile_deplibs="-l$name -L$dir $compile_deplibs"
7002 finalize_deplibs="-l$name -L$dir $finalize_deplibs"
7004 elif test "$build_libtool_libs" = yes; then
7005 # Not a shared library
7006 if test "$deplibs_check_method" != pass_all; then
7007 # We're trying link a shared library against a static one
7008 # but the system doesn't support it.
7010 # Just print a warning and add the library to dependency_libs so
7011 # that the program can be linked against the static library.
7012 echo
7013 $ECHO "*** Warning: This system can not link to static lib archive $lib."
7014 echo "*** I have the capability to make that library automatically link in when"
7015 echo "*** you link to this library. But I can only do this if you have a"
7016 echo "*** shared version of the library, which you do not appear to have."
7017 if test "$module" = yes; then
7018 echo "*** But as you try to build a module library, libtool will still create "
7019 echo "*** a static module, that should work as long as the dlopening application"
7020 echo "*** is linked with the -dlopen flag to resolve symbols at runtime."
7021 if test -z "$global_symbol_pipe"; then
7022 echo
7023 echo "*** However, this would only work if libtool was able to extract symbol"
7024 echo "*** lists from a program, using \`nm' or equivalent, but libtool could"
7025 echo "*** not find such a program. So, this module is probably useless."
7026 echo "*** \`nm' from GNU binutils and a full rebuild may help."
7028 if test "$build_old_libs" = no; then
7029 build_libtool_libs=module
7030 build_old_libs=yes
7031 else
7032 build_libtool_libs=no
7035 else
7036 deplibs="$dir/$old_library $deplibs"
7037 link_static=yes
7039 fi # link shared/static library?
7041 if test "$linkmode" = lib; then
7042 if test -n "$dependency_libs" &&
7043 { test "$hardcode_into_libs" != yes ||
7044 test "$build_old_libs" = yes ||
7045 test "$link_static" = yes; }; then
7046 # Extract -R from dependency_libs
7047 temp_deplibs=
7048 for libdir in $dependency_libs; do
7049 case $libdir in
7050 -R*) func_stripname '-R' '' "$libdir"
7051 temp_xrpath=$func_stripname_result
7052 case " $xrpath " in
7053 *" $temp_xrpath "*) ;;
7054 *) func_append xrpath " $temp_xrpath";;
7055 esac;;
7056 *) func_append temp_deplibs " $libdir";;
7057 esac
7058 done
7059 dependency_libs="$temp_deplibs"
7062 func_append newlib_search_path " $absdir"
7063 # Link against this library
7064 test "$link_static" = no && newdependency_libs="$abs_ladir/$laname $newdependency_libs"
7065 # ... and its dependency_libs
7066 tmp_libs=
7067 for deplib in $dependency_libs; do
7068 newdependency_libs="$deplib $newdependency_libs"
7069 case $deplib in
7070 -L*) func_stripname '-L' '' "$deplib"
7071 func_resolve_sysroot "$func_stripname_result";;
7072 *) func_resolve_sysroot "$deplib" ;;
7073 esac
7074 if $opt_preserve_dup_deps ; then
7075 case "$tmp_libs " in
7076 *" $func_resolve_sysroot_result "*)
7077 func_append specialdeplibs " $func_resolve_sysroot_result" ;;
7078 esac
7080 func_append tmp_libs " $func_resolve_sysroot_result"
7081 done
7083 if test "$link_all_deplibs" != no; then
7084 # Add the search paths of all dependency libraries
7085 for deplib in $dependency_libs; do
7086 path=
7087 case $deplib in
7088 -L*) path="$deplib" ;;
7089 *.la)
7090 func_resolve_sysroot "$deplib"
7091 deplib=$func_resolve_sysroot_result
7092 func_dirname "$deplib" "" "."
7093 dir=$func_dirname_result
7094 # We need an absolute path.
7095 case $dir in
7096 [\\/]* | [A-Za-z]:[\\/]*) absdir="$dir" ;;
7098 absdir=`cd "$dir" && pwd`
7099 if test -z "$absdir"; then
7100 func_warning "cannot determine absolute directory name of \`$dir'"
7101 absdir="$dir"
7104 esac
7105 if $GREP "^installed=no" $deplib > /dev/null; then
7106 case $host in
7107 *-*-darwin*)
7108 depdepl=
7109 eval deplibrary_names=`${SED} -n -e 's/^library_names=\(.*\)$/\1/p' $deplib`
7110 if test -n "$deplibrary_names" ; then
7111 for tmp in $deplibrary_names ; do
7112 depdepl=$tmp
7113 done
7114 if test -f "$absdir/$objdir/$depdepl" ; then
7115 depdepl="$absdir/$objdir/$depdepl"
7116 darwin_install_name=`${OTOOL} -L $depdepl | awk '{if (NR == 2) {print $1;exit}}'`
7117 if test -z "$darwin_install_name"; then
7118 darwin_install_name=`${OTOOL64} -L $depdepl | awk '{if (NR == 2) {print $1;exit}}'`
7120 func_append compiler_flags " ${wl}-dylib_file ${wl}${darwin_install_name}:${depdepl}"
7121 func_append linker_flags " -dylib_file ${darwin_install_name}:${depdepl}"
7122 path=
7127 path="-L$absdir/$objdir"
7129 esac
7130 else
7131 eval libdir=`${SED} -n -e 's/^libdir=\(.*\)$/\1/p' $deplib`
7132 test -z "$libdir" && \
7133 func_fatal_error "\`$deplib' is not a valid libtool archive"
7134 test "$absdir" != "$libdir" && \
7135 func_warning "\`$deplib' seems to be moved"
7137 path="-L$absdir"
7140 esac
7141 case " $deplibs " in
7142 *" $path "*) ;;
7143 *) deplibs="$path $deplibs" ;;
7144 esac
7145 done
7146 fi # link_all_deplibs != no
7147 fi # linkmode = lib
7148 done # for deplib in $libs
7149 if test "$pass" = link; then
7150 if test "$linkmode" = "prog"; then
7151 compile_deplibs="$new_inherited_linker_flags $compile_deplibs"
7152 finalize_deplibs="$new_inherited_linker_flags $finalize_deplibs"
7153 else
7154 compiler_flags="$compiler_flags "`$ECHO " $new_inherited_linker_flags" | $SED 's% \([^ $]*\).ltframework% -framework \1%g'`
7157 dependency_libs="$newdependency_libs"
7158 if test "$pass" = dlpreopen; then
7159 # Link the dlpreopened libraries before other libraries
7160 for deplib in $save_deplibs; do
7161 deplibs="$deplib $deplibs"
7162 done
7164 if test "$pass" != dlopen; then
7165 if test "$pass" != conv; then
7166 # Make sure lib_search_path contains only unique directories.
7167 lib_search_path=
7168 for dir in $newlib_search_path; do
7169 case "$lib_search_path " in
7170 *" $dir "*) ;;
7171 *) func_append lib_search_path " $dir" ;;
7172 esac
7173 done
7174 newlib_search_path=
7177 if test "$linkmode,$pass" != "prog,link"; then
7178 vars="deplibs"
7179 else
7180 vars="compile_deplibs finalize_deplibs"
7182 for var in $vars dependency_libs; do
7183 # Add libraries to $var in reverse order
7184 eval tmp_libs=\"\$$var\"
7185 new_libs=
7186 for deplib in $tmp_libs; do
7187 # FIXME: Pedantically, this is the right thing to do, so
7188 # that some nasty dependency loop isn't accidentally
7189 # broken:
7190 #new_libs="$deplib $new_libs"
7191 # Pragmatically, this seems to cause very few problems in
7192 # practice:
7193 case $deplib in
7194 -L*) new_libs="$deplib $new_libs" ;;
7195 -R*) ;;
7197 # And here is the reason: when a library appears more
7198 # than once as an explicit dependence of a library, or
7199 # is implicitly linked in more than once by the
7200 # compiler, it is considered special, and multiple
7201 # occurrences thereof are not removed. Compare this
7202 # with having the same library being listed as a
7203 # dependency of multiple other libraries: in this case,
7204 # we know (pedantically, we assume) the library does not
7205 # need to be listed more than once, so we keep only the
7206 # last copy. This is not always right, but it is rare
7207 # enough that we require users that really mean to play
7208 # such unportable linking tricks to link the library
7209 # using -Wl,-lname, so that libtool does not consider it
7210 # for duplicate removal.
7211 case " $specialdeplibs " in
7212 *" $deplib "*) new_libs="$deplib $new_libs" ;;
7214 case " $new_libs " in
7215 *" $deplib "*) ;;
7216 *) new_libs="$deplib $new_libs" ;;
7217 esac
7219 esac
7221 esac
7222 done
7223 tmp_libs=
7224 for deplib in $new_libs; do
7225 case $deplib in
7226 -L*)
7227 case " $tmp_libs " in
7228 *" $deplib "*) ;;
7229 *) func_append tmp_libs " $deplib" ;;
7230 esac
7232 *) func_append tmp_libs " $deplib" ;;
7233 esac
7234 done
7235 eval $var=\"$tmp_libs\"
7236 done # for var
7238 # Last step: remove runtime libs from dependency_libs
7239 # (they stay in deplibs)
7240 tmp_libs=
7241 for i in $dependency_libs ; do
7242 case " $predeps $postdeps $compiler_lib_search_path " in
7243 *" $i "*)
7244 i=""
7246 esac
7247 if test -n "$i" ; then
7248 func_append tmp_libs " $i"
7250 done
7251 dependency_libs=$tmp_libs
7252 done # for pass
7253 if test "$linkmode" = prog; then
7254 dlfiles="$newdlfiles"
7256 if test "$linkmode" = prog || test "$linkmode" = lib; then
7257 dlprefiles="$newdlprefiles"
7260 case $linkmode in
7261 oldlib)
7262 if test -n "$dlfiles$dlprefiles" || test "$dlself" != no; then
7263 func_warning "\`-dlopen' is ignored for archives"
7266 case " $deplibs" in
7267 *\ -l* | *\ -L*)
7268 func_warning "\`-l' and \`-L' are ignored for archives" ;;
7269 esac
7271 test -n "$rpath" && \
7272 func_warning "\`-rpath' is ignored for archives"
7274 test -n "$xrpath" && \
7275 func_warning "\`-R' is ignored for archives"
7277 test -n "$vinfo" && \
7278 func_warning "\`-version-info/-version-number' is ignored for archives"
7280 test -n "$release" && \
7281 func_warning "\`-release' is ignored for archives"
7283 test -n "$export_symbols$export_symbols_regex" && \
7284 func_warning "\`-export-symbols' is ignored for archives"
7286 # Now set the variables for building old libraries.
7287 build_libtool_libs=no
7288 oldlibs="$output"
7289 func_append objs "$old_deplibs"
7292 lib)
7293 # Make sure we only generate libraries of the form `libNAME.la'.
7294 case $outputname in
7295 lib*)
7296 func_stripname 'lib' '.la' "$outputname"
7297 name=$func_stripname_result
7298 eval shared_ext=\"$shrext_cmds\"
7299 eval libname=\"$libname_spec\"
7302 test "$module" = no && \
7303 func_fatal_help "libtool library \`$output' must begin with \`lib'"
7305 if test "$need_lib_prefix" != no; then
7306 # Add the "lib" prefix for modules if required
7307 func_stripname '' '.la' "$outputname"
7308 name=$func_stripname_result
7309 eval shared_ext=\"$shrext_cmds\"
7310 eval libname=\"$libname_spec\"
7311 else
7312 func_stripname '' '.la' "$outputname"
7313 libname=$func_stripname_result
7316 esac
7318 if test -n "$objs"; then
7319 if test "$deplibs_check_method" != pass_all; then
7320 func_fatal_error "cannot build libtool library \`$output' from non-libtool objects on this host:$objs"
7321 else
7322 echo
7323 $ECHO "*** Warning: Linking the shared library $output against the non-libtool"
7324 $ECHO "*** objects $objs is not portable!"
7325 func_append libobjs " $objs"
7329 test "$dlself" != no && \
7330 func_warning "\`-dlopen self' is ignored for libtool libraries"
7332 set dummy $rpath
7333 shift
7334 test "$#" -gt 1 && \
7335 func_warning "ignoring multiple \`-rpath's for a libtool library"
7337 install_libdir="$1"
7339 oldlibs=
7340 if test -z "$rpath"; then
7341 if test "$build_libtool_libs" = yes; then
7342 # Building a libtool convenience library.
7343 # Some compilers have problems with a `.al' extension so
7344 # convenience libraries should have the same extension an
7345 # archive normally would.
7346 oldlibs="$output_objdir/$libname.$libext $oldlibs"
7347 build_libtool_libs=convenience
7348 build_old_libs=yes
7351 test -n "$vinfo" && \
7352 func_warning "\`-version-info/-version-number' is ignored for convenience libraries"
7354 test -n "$release" && \
7355 func_warning "\`-release' is ignored for convenience libraries"
7356 else
7358 # Parse the version information argument.
7359 save_ifs="$IFS"; IFS=':'
7360 set dummy $vinfo 0 0 0
7361 shift
7362 IFS="$save_ifs"
7364 test -n "$7" && \
7365 func_fatal_help "too many parameters to \`-version-info'"
7367 # convert absolute version numbers to libtool ages
7368 # this retains compatibility with .la files and attempts
7369 # to make the code below a bit more comprehensible
7371 case $vinfo_number in
7372 yes)
7373 number_major="$1"
7374 number_minor="$2"
7375 number_revision="$3"
7377 # There are really only two kinds -- those that
7378 # use the current revision as the major version
7379 # and those that subtract age and use age as
7380 # a minor version. But, then there is irix
7381 # which has an extra 1 added just for fun
7383 case $version_type in
7384 # correct linux to gnu/linux during the next big refactor
7385 darwin|linux|osf|windows|none)
7386 func_arith $number_major + $number_minor
7387 current=$func_arith_result
7388 age="$number_minor"
7389 revision="$number_revision"
7391 freebsd-aout|freebsd-elf|qnx|sunos)
7392 current="$number_major"
7393 revision="$number_minor"
7394 age="0"
7396 irix|nonstopux)
7397 func_arith $number_major + $number_minor
7398 current=$func_arith_result
7399 age="$number_minor"
7400 revision="$number_minor"
7401 lt_irix_increment=no
7403 esac
7406 current="$1"
7407 revision="$2"
7408 age="$3"
7410 esac
7412 # Check that each of the things are valid numbers.
7413 case $current in
7414 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]) ;;
7416 func_error "CURRENT \`$current' must be a nonnegative integer"
7417 func_fatal_error "\`$vinfo' is not valid version information"
7419 esac
7421 case $revision in
7422 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]) ;;
7424 func_error "REVISION \`$revision' must be a nonnegative integer"
7425 func_fatal_error "\`$vinfo' is not valid version information"
7427 esac
7429 case $age in
7430 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]) ;;
7432 func_error "AGE \`$age' must be a nonnegative integer"
7433 func_fatal_error "\`$vinfo' is not valid version information"
7435 esac
7437 if test "$age" -gt "$current"; then
7438 func_error "AGE \`$age' is greater than the current interface number \`$current'"
7439 func_fatal_error "\`$vinfo' is not valid version information"
7442 # Calculate the version variables.
7443 major=
7444 versuffix=
7445 verstring=
7446 case $version_type in
7447 none) ;;
7449 darwin)
7450 # Like Linux, but with the current version available in
7451 # verstring for coding it into the library header
7452 func_arith $current - $age
7453 major=.$func_arith_result
7454 versuffix="$major.$age.$revision"
7455 # Darwin ld doesn't like 0 for these options...
7456 func_arith $current + 1
7457 minor_current=$func_arith_result
7458 xlcverstring="${wl}-compatibility_version ${wl}$minor_current ${wl}-current_version ${wl}$minor_current.$revision"
7459 verstring="-compatibility_version $minor_current -current_version $minor_current.$revision"
7462 freebsd-aout)
7463 major=".$current"
7464 versuffix=".$current.$revision";
7467 freebsd-elf)
7468 major=".$current"
7469 versuffix=".$current"
7472 irix | nonstopux)
7473 if test "X$lt_irix_increment" = "Xno"; then
7474 func_arith $current - $age
7475 else
7476 func_arith $current - $age + 1
7478 major=$func_arith_result
7480 case $version_type in
7481 nonstopux) verstring_prefix=nonstopux ;;
7482 *) verstring_prefix=sgi ;;
7483 esac
7484 verstring="$verstring_prefix$major.$revision"
7486 # Add in all the interfaces that we are compatible with.
7487 loop=$revision
7488 while test "$loop" -ne 0; do
7489 func_arith $revision - $loop
7490 iface=$func_arith_result
7491 func_arith $loop - 1
7492 loop=$func_arith_result
7493 verstring="$verstring_prefix$major.$iface:$verstring"
7494 done
7496 # Before this point, $major must not contain `.'.
7497 major=.$major
7498 versuffix="$major.$revision"
7501 linux) # correct to gnu/linux during the next big refactor
7502 func_arith $current - $age
7503 major=.$func_arith_result
7504 versuffix="$major.$age.$revision"
7507 osf)
7508 func_arith $current - $age
7509 major=.$func_arith_result
7510 versuffix=".$current.$age.$revision"
7511 verstring="$current.$age.$revision"
7513 # Add in all the interfaces that we are compatible with.
7514 loop=$age
7515 while test "$loop" -ne 0; do
7516 func_arith $current - $loop
7517 iface=$func_arith_result
7518 func_arith $loop - 1
7519 loop=$func_arith_result
7520 verstring="$verstring:${iface}.0"
7521 done
7523 # Make executables depend on our current version.
7524 func_append verstring ":${current}.0"
7527 qnx)
7528 major=".$current"
7529 versuffix=".$current"
7532 sunos)
7533 major=".$current"
7534 versuffix=".$current.$revision"
7537 windows)
7538 # Use '-' rather than '.', since we only want one
7539 # extension on DOS 8.3 filesystems.
7540 func_arith $current - $age
7541 major=$func_arith_result
7542 versuffix="-$major"
7546 func_fatal_configuration "unknown library version type \`$version_type'"
7548 esac
7550 # Clear the version info if we defaulted, and they specified a release.
7551 if test -z "$vinfo" && test -n "$release"; then
7552 major=
7553 case $version_type in
7554 darwin)
7555 # we can't check for "0.0" in archive_cmds due to quoting
7556 # problems, so we reset it completely
7557 verstring=
7560 verstring="0.0"
7562 esac
7563 if test "$need_version" = no; then
7564 versuffix=
7565 else
7566 versuffix=".0.0"
7570 # Remove version info from name if versioning should be avoided
7571 if test "$avoid_version" = yes && test "$need_version" = no; then
7572 major=
7573 versuffix=
7574 verstring=""
7577 # Check to see if the archive will have undefined symbols.
7578 if test "$allow_undefined" = yes; then
7579 if test "$allow_undefined_flag" = unsupported; then
7580 func_warning "undefined symbols not allowed in $host shared libraries"
7581 build_libtool_libs=no
7582 build_old_libs=yes
7584 else
7585 # Don't allow undefined symbols.
7586 allow_undefined_flag="$no_undefined_flag"
7591 func_generate_dlsyms "$libname" "$libname" "yes"
7592 func_append libobjs " $symfileobj"
7593 test "X$libobjs" = "X " && libobjs=
7595 if test "$opt_mode" != relink; then
7596 # Remove our outputs, but don't remove object files since they
7597 # may have been created when compiling PIC objects.
7598 removelist=
7599 tempremovelist=`$ECHO "$output_objdir/*"`
7600 for p in $tempremovelist; do
7601 case $p in
7602 *.$objext | *.gcno)
7604 $output_objdir/$outputname | $output_objdir/$libname.* | $output_objdir/${libname}${release}.*)
7605 if test "X$precious_files_regex" != "X"; then
7606 if $ECHO "$p" | $EGREP -e "$precious_files_regex" >/dev/null 2>&1
7607 then
7608 continue
7611 func_append removelist " $p"
7613 *) ;;
7614 esac
7615 done
7616 test -n "$removelist" && \
7617 func_show_eval "${RM}r \$removelist"
7620 # Now set the variables for building old libraries.
7621 if test "$build_old_libs" = yes && test "$build_libtool_libs" != convenience ; then
7622 func_append oldlibs " $output_objdir/$libname.$libext"
7624 # Transform .lo files to .o files.
7625 oldobjs="$objs "`$ECHO "$libobjs" | $SP2NL | $SED "/\.${libext}$/d; $lo2o" | $NL2SP`
7628 # Eliminate all temporary directories.
7629 #for path in $notinst_path; do
7630 # lib_search_path=`$ECHO "$lib_search_path " | $SED "s% $path % %g"`
7631 # deplibs=`$ECHO "$deplibs " | $SED "s% -L$path % %g"`
7632 # dependency_libs=`$ECHO "$dependency_libs " | $SED "s% -L$path % %g"`
7633 #done
7635 if test -n "$xrpath"; then
7636 # If the user specified any rpath flags, then add them.
7637 temp_xrpath=
7638 for libdir in $xrpath; do
7639 func_replace_sysroot "$libdir"
7640 func_append temp_xrpath " -R$func_replace_sysroot_result"
7641 case "$finalize_rpath " in
7642 *" $libdir "*) ;;
7643 *) func_append finalize_rpath " $libdir" ;;
7644 esac
7645 done
7646 if test "$hardcode_into_libs" != yes || test "$build_old_libs" = yes; then
7647 dependency_libs="$temp_xrpath $dependency_libs"
7651 # Make sure dlfiles contains only unique files that won't be dlpreopened
7652 old_dlfiles="$dlfiles"
7653 dlfiles=
7654 for lib in $old_dlfiles; do
7655 case " $dlprefiles $dlfiles " in
7656 *" $lib "*) ;;
7657 *) func_append dlfiles " $lib" ;;
7658 esac
7659 done
7661 # Make sure dlprefiles contains only unique files
7662 old_dlprefiles="$dlprefiles"
7663 dlprefiles=
7664 for lib in $old_dlprefiles; do
7665 case "$dlprefiles " in
7666 *" $lib "*) ;;
7667 *) func_append dlprefiles " $lib" ;;
7668 esac
7669 done
7671 if test "$build_libtool_libs" = yes; then
7672 if test -n "$rpath"; then
7673 case $host in
7674 *-*-cygwin* | *-*-mingw* | *-*-pw32* | *-*-os2* | *-*-beos* | *-cegcc* | *-*-haiku*)
7675 # these systems don't actually have a c library (as such)!
7677 *-*-rhapsody* | *-*-darwin1.[012])
7678 # Rhapsody C library is in the System framework
7679 func_append deplibs " System.ltframework"
7681 *-*-netbsd*)
7682 # Don't link with libc until the a.out ld.so is fixed.
7684 *-*-openbsd* | *-*-freebsd* | *-*-dragonfly*)
7685 # Do not include libc due to us having libc/libc_r.
7687 *-*-sco3.2v5* | *-*-sco5v6*)
7688 # Causes problems with __ctype
7690 *-*-sysv4.2uw2* | *-*-sysv5* | *-*-unixware* | *-*-OpenUNIX*)
7691 # Compiler inserts libc in the correct place for threads to work
7694 # Add libc to deplibs on all other systems if necessary.
7695 if test "$build_libtool_need_lc" = "yes"; then
7696 func_append deplibs " -lc"
7699 esac
7702 # Transform deplibs into only deplibs that can be linked in shared.
7703 name_save=$name
7704 libname_save=$libname
7705 release_save=$release
7706 versuffix_save=$versuffix
7707 major_save=$major
7708 # I'm not sure if I'm treating the release correctly. I think
7709 # release should show up in the -l (ie -lgmp5) so we don't want to
7710 # add it in twice. Is that correct?
7711 release=""
7712 versuffix=""
7713 major=""
7714 newdeplibs=
7715 droppeddeps=no
7716 case $deplibs_check_method in
7717 pass_all)
7718 # Don't check for shared/static. Everything works.
7719 # This might be a little naive. We might want to check
7720 # whether the library exists or not. But this is on
7721 # osf3 & osf4 and I'm not really sure... Just
7722 # implementing what was already the behavior.
7723 newdeplibs=$deplibs
7725 test_compile)
7726 # This code stresses the "libraries are programs" paradigm to its
7727 # limits. Maybe even breaks it. We compile a program, linking it
7728 # against the deplibs as a proxy for the library. Then we can check
7729 # whether they linked in statically or dynamically with ldd.
7730 $opt_dry_run || $RM conftest.c
7731 cat > conftest.c <<EOF
7732 int main() { return 0; }
7734 $opt_dry_run || $RM conftest
7735 if $LTCC $LTCFLAGS -o conftest conftest.c $deplibs; then
7736 ldd_output=`ldd conftest`
7737 for i in $deplibs; do
7738 case $i in
7739 -l*)
7740 func_stripname -l '' "$i"
7741 name=$func_stripname_result
7742 if test "X$allow_libtool_libs_with_static_runtimes" = "Xyes" ; then
7743 case " $predeps $postdeps " in
7744 *" $i "*)
7745 func_append newdeplibs " $i"
7746 i=""
7748 esac
7750 if test -n "$i" ; then
7751 libname=`eval "\\$ECHO \"$libname_spec\""`
7752 deplib_matches=`eval "\\$ECHO \"$library_names_spec\""`
7753 set dummy $deplib_matches; shift
7754 deplib_match=$1
7755 if test `expr "$ldd_output" : ".*$deplib_match"` -ne 0 ; then
7756 func_append newdeplibs " $i"
7757 else
7758 droppeddeps=yes
7759 echo
7760 $ECHO "*** Warning: dynamic linker does not accept needed library $i."
7761 echo "*** I have the capability to make that library automatically link in when"
7762 echo "*** you link to this library. But I can only do this if you have a"
7763 echo "*** shared version of the library, which I believe you do not have"
7764 echo "*** because a test_compile did reveal that the linker did not use it for"
7765 echo "*** its dynamic dependency list that programs get resolved with at runtime."
7770 func_append newdeplibs " $i"
7772 esac
7773 done
7774 else
7775 # Error occurred in the first compile. Let's try to salvage
7776 # the situation: Compile a separate program for each library.
7777 for i in $deplibs; do
7778 case $i in
7779 -l*)
7780 func_stripname -l '' "$i"
7781 name=$func_stripname_result
7782 $opt_dry_run || $RM conftest
7783 if $LTCC $LTCFLAGS -o conftest conftest.c $i; then
7784 ldd_output=`ldd conftest`
7785 if test "X$allow_libtool_libs_with_static_runtimes" = "Xyes" ; then
7786 case " $predeps $postdeps " in
7787 *" $i "*)
7788 func_append newdeplibs " $i"
7789 i=""
7791 esac
7793 if test -n "$i" ; then
7794 libname=`eval "\\$ECHO \"$libname_spec\""`
7795 deplib_matches=`eval "\\$ECHO \"$library_names_spec\""`
7796 set dummy $deplib_matches; shift
7797 deplib_match=$1
7798 if test `expr "$ldd_output" : ".*$deplib_match"` -ne 0 ; then
7799 func_append newdeplibs " $i"
7800 else
7801 droppeddeps=yes
7802 echo
7803 $ECHO "*** Warning: dynamic linker does not accept needed library $i."
7804 echo "*** I have the capability to make that library automatically link in when"
7805 echo "*** you link to this library. But I can only do this if you have a"
7806 echo "*** shared version of the library, which you do not appear to have"
7807 echo "*** because a test_compile did reveal that the linker did not use this one"
7808 echo "*** as a dynamic dependency that programs can get resolved with at runtime."
7811 else
7812 droppeddeps=yes
7813 echo
7814 $ECHO "*** Warning! Library $i is needed by this library but I was not able to"
7815 echo "*** make it link in! You will probably need to install it or some"
7816 echo "*** library that it depends on before this library will be fully"
7817 echo "*** functional. Installing it before continuing would be even better."
7821 func_append newdeplibs " $i"
7823 esac
7824 done
7827 file_magic*)
7828 set dummy $deplibs_check_method; shift
7829 file_magic_regex=`expr "$deplibs_check_method" : "$1 \(.*\)"`
7830 for a_deplib in $deplibs; do
7831 case $a_deplib in
7832 -l*)
7833 func_stripname -l '' "$a_deplib"
7834 name=$func_stripname_result
7835 if test "X$allow_libtool_libs_with_static_runtimes" = "Xyes" ; then
7836 case " $predeps $postdeps " in
7837 *" $a_deplib "*)
7838 func_append newdeplibs " $a_deplib"
7839 a_deplib=""
7841 esac
7843 if test -n "$a_deplib" ; then
7844 libname=`eval "\\$ECHO \"$libname_spec\""`
7845 if test -n "$file_magic_glob"; then
7846 libnameglob=`func_echo_all "$libname" | $SED -e $file_magic_glob`
7847 else
7848 libnameglob=$libname
7850 test "$want_nocaseglob" = yes && nocaseglob=`shopt -p nocaseglob`
7851 for i in $lib_search_path $sys_lib_search_path $shlib_search_path; do
7852 if test "$want_nocaseglob" = yes; then
7853 shopt -s nocaseglob
7854 potential_libs=`ls $i/$libnameglob[.-]* 2>/dev/null`
7855 $nocaseglob
7856 else
7857 potential_libs=`ls $i/$libnameglob[.-]* 2>/dev/null`
7859 for potent_lib in $potential_libs; do
7860 # Follow soft links.
7861 if ls -lLd "$potent_lib" 2>/dev/null |
7862 $GREP " -> " >/dev/null; then
7863 continue
7865 # The statement above tries to avoid entering an
7866 # endless loop below, in case of cyclic links.
7867 # We might still enter an endless loop, since a link
7868 # loop can be closed while we follow links,
7869 # but so what?
7870 potlib="$potent_lib"
7871 while test -h "$potlib" 2>/dev/null; do
7872 potliblink=`ls -ld $potlib | ${SED} 's/.* -> //'`
7873 case $potliblink in
7874 [\\/]* | [A-Za-z]:[\\/]*) potlib="$potliblink";;
7875 *) potlib=`$ECHO "$potlib" | $SED 's,[^/]*$,,'`"$potliblink";;
7876 esac
7877 done
7878 if eval $file_magic_cmd \"\$potlib\" 2>/dev/null |
7879 $SED -e 10q |
7880 $EGREP "$file_magic_regex" > /dev/null; then
7881 func_append newdeplibs " $a_deplib"
7882 a_deplib=""
7883 break 2
7885 done
7886 done
7888 if test -n "$a_deplib" ; then
7889 droppeddeps=yes
7890 echo
7891 $ECHO "*** Warning: linker path does not have real file for library $a_deplib."
7892 echo "*** I have the capability to make that library automatically link in when"
7893 echo "*** you link to this library. But I can only do this if you have a"
7894 echo "*** shared version of the library, which you do not appear to have"
7895 echo "*** because I did check the linker path looking for a file starting"
7896 if test -z "$potlib" ; then
7897 $ECHO "*** with $libname but no candidates were found. (...for file magic test)"
7898 else
7899 $ECHO "*** with $libname and none of the candidates passed a file format test"
7900 $ECHO "*** using a file magic. Last file checked: $potlib"
7905 # Add a -L argument.
7906 func_append newdeplibs " $a_deplib"
7908 esac
7909 done # Gone through all deplibs.
7911 match_pattern*)
7912 set dummy $deplibs_check_method; shift
7913 match_pattern_regex=`expr "$deplibs_check_method" : "$1 \(.*\)"`
7914 for a_deplib in $deplibs; do
7915 case $a_deplib in
7916 -l*)
7917 func_stripname -l '' "$a_deplib"
7918 name=$func_stripname_result
7919 if test "X$allow_libtool_libs_with_static_runtimes" = "Xyes" ; then
7920 case " $predeps $postdeps " in
7921 *" $a_deplib "*)
7922 func_append newdeplibs " $a_deplib"
7923 a_deplib=""
7925 esac
7927 if test -n "$a_deplib" ; then
7928 libname=`eval "\\$ECHO \"$libname_spec\""`
7929 for i in $lib_search_path $sys_lib_search_path $shlib_search_path; do
7930 potential_libs=`ls $i/$libname[.-]* 2>/dev/null`
7931 for potent_lib in $potential_libs; do
7932 potlib="$potent_lib" # see symlink-check above in file_magic test
7933 if eval "\$ECHO \"$potent_lib\"" 2>/dev/null | $SED 10q | \
7934 $EGREP "$match_pattern_regex" > /dev/null; then
7935 func_append newdeplibs " $a_deplib"
7936 a_deplib=""
7937 break 2
7939 done
7940 done
7942 if test -n "$a_deplib" ; then
7943 droppeddeps=yes
7944 echo
7945 $ECHO "*** Warning: linker path does not have real file for library $a_deplib."
7946 echo "*** I have the capability to make that library automatically link in when"
7947 echo "*** you link to this library. But I can only do this if you have a"
7948 echo "*** shared version of the library, which you do not appear to have"
7949 echo "*** because I did check the linker path looking for a file starting"
7950 if test -z "$potlib" ; then
7951 $ECHO "*** with $libname but no candidates were found. (...for regex pattern test)"
7952 else
7953 $ECHO "*** with $libname and none of the candidates passed a file format test"
7954 $ECHO "*** using a regex pattern. Last file checked: $potlib"
7959 # Add a -L argument.
7960 func_append newdeplibs " $a_deplib"
7962 esac
7963 done # Gone through all deplibs.
7965 none | unknown | *)
7966 newdeplibs=""
7967 tmp_deplibs=`$ECHO " $deplibs" | $SED 's/ -lc$//; s/ -[LR][^ ]*//g'`
7968 if test "X$allow_libtool_libs_with_static_runtimes" = "Xyes" ; then
7969 for i in $predeps $postdeps ; do
7970 # can't use Xsed below, because $i might contain '/'
7971 tmp_deplibs=`$ECHO " $tmp_deplibs" | $SED "s,$i,,"`
7972 done
7974 case $tmp_deplibs in
7975 *[!\ \ ]*)
7976 echo
7977 if test "X$deplibs_check_method" = "Xnone"; then
7978 echo "*** Warning: inter-library dependencies are not supported in this platform."
7979 else
7980 echo "*** Warning: inter-library dependencies are not known to be supported."
7982 echo "*** All declared inter-library dependencies are being dropped."
7983 droppeddeps=yes
7985 esac
7987 esac
7988 versuffix=$versuffix_save
7989 major=$major_save
7990 release=$release_save
7991 libname=$libname_save
7992 name=$name_save
7994 case $host in
7995 *-*-rhapsody* | *-*-darwin1.[012])
7996 # On Rhapsody replace the C library with the System framework
7997 newdeplibs=`$ECHO " $newdeplibs" | $SED 's/ -lc / System.ltframework /'`
7999 esac
8001 if test "$droppeddeps" = yes; then
8002 if test "$module" = yes; then
8003 echo
8004 echo "*** Warning: libtool could not satisfy all declared inter-library"
8005 $ECHO "*** dependencies of module $libname. Therefore, libtool will create"
8006 echo "*** a static module, that should work as long as the dlopening"
8007 echo "*** application is linked with the -dlopen flag."
8008 if test -z "$global_symbol_pipe"; then
8009 echo
8010 echo "*** However, this would only work if libtool was able to extract symbol"
8011 echo "*** lists from a program, using \`nm' or equivalent, but libtool could"
8012 echo "*** not find such a program. So, this module is probably useless."
8013 echo "*** \`nm' from GNU binutils and a full rebuild may help."
8015 if test "$build_old_libs" = no; then
8016 oldlibs="$output_objdir/$libname.$libext"
8017 build_libtool_libs=module
8018 build_old_libs=yes
8019 else
8020 build_libtool_libs=no
8022 else
8023 echo "*** The inter-library dependencies that have been dropped here will be"
8024 echo "*** automatically added whenever a program is linked with this library"
8025 echo "*** or is declared to -dlopen it."
8027 if test "$allow_undefined" = no; then
8028 echo
8029 echo "*** Since this library must not contain undefined symbols,"
8030 echo "*** because either the platform does not support them or"
8031 echo "*** it was explicitly requested with -no-undefined,"
8032 echo "*** libtool will only create a static version of it."
8033 if test "$build_old_libs" = no; then
8034 oldlibs="$output_objdir/$libname.$libext"
8035 build_libtool_libs=module
8036 build_old_libs=yes
8037 else
8038 build_libtool_libs=no
8043 # Done checking deplibs!
8044 deplibs=$newdeplibs
8046 # Time to change all our "foo.ltframework" stuff back to "-framework foo"
8047 case $host in
8048 *-*-darwin*)
8049 newdeplibs=`$ECHO " $newdeplibs" | $SED 's% \([^ $]*\).ltframework% -framework \1%g'`
8050 new_inherited_linker_flags=`$ECHO " $new_inherited_linker_flags" | $SED 's% \([^ $]*\).ltframework% -framework \1%g'`
8051 deplibs=`$ECHO " $deplibs" | $SED 's% \([^ $]*\).ltframework% -framework \1%g'`
8053 esac
8055 # move library search paths that coincide with paths to not yet
8056 # installed libraries to the beginning of the library search list
8057 new_libs=
8058 for path in $notinst_path; do
8059 case " $new_libs " in
8060 *" -L$path/$objdir "*) ;;
8062 case " $deplibs " in
8063 *" -L$path/$objdir "*)
8064 func_append new_libs " -L$path/$objdir" ;;
8065 esac
8067 esac
8068 done
8069 for deplib in $deplibs; do
8070 case $deplib in
8071 -L*)
8072 case " $new_libs " in
8073 *" $deplib "*) ;;
8074 *) func_append new_libs " $deplib" ;;
8075 esac
8077 *) func_append new_libs " $deplib" ;;
8078 esac
8079 done
8080 deplibs="$new_libs"
8082 # All the library-specific variables (install_libdir is set above).
8083 library_names=
8084 old_library=
8085 dlname=
8087 # Test again, we may have decided not to build it any more
8088 if test "$build_libtool_libs" = yes; then
8089 # Remove ${wl} instances when linking with ld.
8090 # FIXME: should test the right _cmds variable.
8091 case $archive_cmds in
8092 *\$LD\ *) wl= ;;
8093 esac
8094 if test "$hardcode_into_libs" = yes; then
8095 # Hardcode the library paths
8096 hardcode_libdirs=
8097 dep_rpath=
8098 rpath="$finalize_rpath"
8099 test "$opt_mode" != relink && rpath="$compile_rpath$rpath"
8100 for libdir in $rpath; do
8101 if test -n "$hardcode_libdir_flag_spec"; then
8102 if test -n "$hardcode_libdir_separator"; then
8103 func_replace_sysroot "$libdir"
8104 libdir=$func_replace_sysroot_result
8105 if test -z "$hardcode_libdirs"; then
8106 hardcode_libdirs="$libdir"
8107 else
8108 # Just accumulate the unique libdirs.
8109 case $hardcode_libdir_separator$hardcode_libdirs$hardcode_libdir_separator in
8110 *"$hardcode_libdir_separator$libdir$hardcode_libdir_separator"*)
8113 func_append hardcode_libdirs "$hardcode_libdir_separator$libdir"
8115 esac
8117 else
8118 eval flag=\"$hardcode_libdir_flag_spec\"
8119 func_append dep_rpath " $flag"
8121 elif test -n "$runpath_var"; then
8122 case "$perm_rpath " in
8123 *" $libdir "*) ;;
8124 *) func_append perm_rpath " $libdir" ;;
8125 esac
8127 done
8128 # Substitute the hardcoded libdirs into the rpath.
8129 if test -n "$hardcode_libdir_separator" &&
8130 test -n "$hardcode_libdirs"; then
8131 libdir="$hardcode_libdirs"
8132 eval "dep_rpath=\"$hardcode_libdir_flag_spec\""
8134 if test -n "$runpath_var" && test -n "$perm_rpath"; then
8135 # We should set the runpath_var.
8136 rpath=
8137 for dir in $perm_rpath; do
8138 func_append rpath "$dir:"
8139 done
8140 eval "$runpath_var='$rpath\$$runpath_var'; export $runpath_var"
8142 test -n "$dep_rpath" && deplibs="$dep_rpath $deplibs"
8145 shlibpath="$finalize_shlibpath"
8146 test "$opt_mode" != relink && shlibpath="$compile_shlibpath$shlibpath"
8147 if test -n "$shlibpath"; then
8148 eval "$shlibpath_var='$shlibpath\$$shlibpath_var'; export $shlibpath_var"
8151 # Get the real and link names of the library.
8152 eval shared_ext=\"$shrext_cmds\"
8153 eval library_names=\"$library_names_spec\"
8154 set dummy $library_names
8155 shift
8156 realname="$1"
8157 shift
8159 if test -n "$soname_spec"; then
8160 eval soname=\"$soname_spec\"
8161 else
8162 soname="$realname"
8164 if test -z "$dlname"; then
8165 dlname=$soname
8168 lib="$output_objdir/$realname"
8169 linknames=
8170 for link
8172 func_append linknames " $link"
8173 done
8175 # Use standard objects if they are pic
8176 test -z "$pic_flag" && libobjs=`$ECHO "$libobjs" | $SP2NL | $SED "$lo2o" | $NL2SP`
8177 test "X$libobjs" = "X " && libobjs=
8179 delfiles=
8180 if test -n "$export_symbols" && test -n "$include_expsyms"; then
8181 $opt_dry_run || cp "$export_symbols" "$output_objdir/$libname.uexp"
8182 export_symbols="$output_objdir/$libname.uexp"
8183 func_append delfiles " $export_symbols"
8186 orig_export_symbols=
8187 case $host_os in
8188 cygwin* | mingw* | cegcc*)
8189 if test -n "$export_symbols" && test -z "$export_symbols_regex"; then
8190 # exporting using user supplied symfile
8191 if test "x`$SED 1q $export_symbols`" != xEXPORTS; then
8192 # and it's NOT already a .def file. Must figure out
8193 # which of the given symbols are data symbols and tag
8194 # them as such. So, trigger use of export_symbols_cmds.
8195 # export_symbols gets reassigned inside the "prepare
8196 # the list of exported symbols" if statement, so the
8197 # include_expsyms logic still works.
8198 orig_export_symbols="$export_symbols"
8199 export_symbols=
8200 always_export_symbols=yes
8204 esac
8206 # Prepare the list of exported symbols
8207 if test -z "$export_symbols"; then
8208 if test "$always_export_symbols" = yes || test -n "$export_symbols_regex"; then
8209 func_verbose "generating symbol list for \`$libname.la'"
8210 export_symbols="$output_objdir/$libname.exp"
8211 $opt_dry_run || $RM $export_symbols
8212 cmds=$export_symbols_cmds
8213 save_ifs="$IFS"; IFS='~'
8214 for cmd1 in $cmds; do
8215 IFS="$save_ifs"
8216 # Take the normal branch if the nm_file_list_spec branch
8217 # doesn't work or if tool conversion is not needed.
8218 case $nm_file_list_spec~$to_tool_file_cmd in
8219 *~func_convert_file_noop | *~func_convert_file_msys_to_w32 | ~*)
8220 try_normal_branch=yes
8221 eval cmd=\"$cmd1\"
8222 func_len " $cmd"
8223 len=$func_len_result
8226 try_normal_branch=no
8228 esac
8229 if test "$try_normal_branch" = yes \
8230 && { test "$len" -lt "$max_cmd_len" \
8231 || test "$max_cmd_len" -le -1; }
8232 then
8233 func_show_eval "$cmd" 'exit $?'
8234 skipped_export=false
8235 elif test -n "$nm_file_list_spec"; then
8236 func_basename "$output"
8237 output_la=$func_basename_result
8238 save_libobjs=$libobjs
8239 save_output=$output
8240 output=${output_objdir}/${output_la}.nm
8241 func_to_tool_file "$output"
8242 libobjs=$nm_file_list_spec$func_to_tool_file_result
8243 func_append delfiles " $output"
8244 func_verbose "creating $NM input file list: $output"
8245 for obj in $save_libobjs; do
8246 func_to_tool_file "$obj"
8247 $ECHO "$func_to_tool_file_result"
8248 done > "$output"
8249 eval cmd=\"$cmd1\"
8250 func_show_eval "$cmd" 'exit $?'
8251 output=$save_output
8252 libobjs=$save_libobjs
8253 skipped_export=false
8254 else
8255 # The command line is too long to execute in one step.
8256 func_verbose "using reloadable object file for export list..."
8257 skipped_export=:
8258 # Break out early, otherwise skipped_export may be
8259 # set to false by a later but shorter cmd.
8260 break
8262 done
8263 IFS="$save_ifs"
8264 if test -n "$export_symbols_regex" && test "X$skipped_export" != "X:"; then
8265 func_show_eval '$EGREP -e "$export_symbols_regex" "$export_symbols" > "${export_symbols}T"'
8266 func_show_eval '$MV "${export_symbols}T" "$export_symbols"'
8271 if test -n "$export_symbols" && test -n "$include_expsyms"; then
8272 tmp_export_symbols="$export_symbols"
8273 test -n "$orig_export_symbols" && tmp_export_symbols="$orig_export_symbols"
8274 $opt_dry_run || eval '$ECHO "$include_expsyms" | $SP2NL >> "$tmp_export_symbols"'
8277 if test "X$skipped_export" != "X:" && test -n "$orig_export_symbols"; then
8278 # The given exports_symbols file has to be filtered, so filter it.
8279 func_verbose "filter symbol list for \`$libname.la' to tag DATA exports"
8280 # FIXME: $output_objdir/$libname.filter potentially contains lots of
8281 # 's' commands which not all seds can handle. GNU sed should be fine
8282 # though. Also, the filter scales superlinearly with the number of
8283 # global variables. join(1) would be nice here, but unfortunately
8284 # isn't a blessed tool.
8285 $opt_dry_run || $SED -e '/[ ,]DATA/!d;s,\(.*\)\([ \,].*\),s|^\1$|\1\2|,' < $export_symbols > $output_objdir/$libname.filter
8286 func_append delfiles " $export_symbols $output_objdir/$libname.filter"
8287 export_symbols=$output_objdir/$libname.def
8288 $opt_dry_run || $SED -f $output_objdir/$libname.filter < $orig_export_symbols > $export_symbols
8291 tmp_deplibs=
8292 for test_deplib in $deplibs; do
8293 case " $convenience " in
8294 *" $test_deplib "*) ;;
8296 func_append tmp_deplibs " $test_deplib"
8298 esac
8299 done
8300 deplibs="$tmp_deplibs"
8302 if test -n "$convenience"; then
8303 if test -n "$whole_archive_flag_spec" &&
8304 test "$compiler_needs_object" = yes &&
8305 test -z "$libobjs"; then
8306 # extract the archives, so we have objects to list.
8307 # TODO: could optimize this to just extract one archive.
8308 whole_archive_flag_spec=
8310 if test -n "$whole_archive_flag_spec"; then
8311 save_libobjs=$libobjs
8312 eval libobjs=\"\$libobjs $whole_archive_flag_spec\"
8313 test "X$libobjs" = "X " && libobjs=
8314 else
8315 gentop="$output_objdir/${outputname}x"
8316 func_append generated " $gentop"
8318 func_extract_archives $gentop $convenience
8319 func_append libobjs " $func_extract_archives_result"
8320 test "X$libobjs" = "X " && libobjs=
8324 if test "$thread_safe" = yes && test -n "$thread_safe_flag_spec"; then
8325 eval flag=\"$thread_safe_flag_spec\"
8326 func_append linker_flags " $flag"
8329 # Make a backup of the uninstalled library when relinking
8330 if test "$opt_mode" = relink; then
8331 $opt_dry_run || eval '(cd $output_objdir && $RM ${realname}U && $MV $realname ${realname}U)' || exit $?
8334 # Do each of the archive commands.
8335 if test "$module" = yes && test -n "$module_cmds" ; then
8336 if test -n "$export_symbols" && test -n "$module_expsym_cmds"; then
8337 eval test_cmds=\"$module_expsym_cmds\"
8338 cmds=$module_expsym_cmds
8339 else
8340 eval test_cmds=\"$module_cmds\"
8341 cmds=$module_cmds
8343 else
8344 if test -n "$export_symbols" && test -n "$archive_expsym_cmds"; then
8345 eval test_cmds=\"$archive_expsym_cmds\"
8346 cmds=$archive_expsym_cmds
8347 else
8348 eval test_cmds=\"$archive_cmds\"
8349 cmds=$archive_cmds
8353 if test "X$skipped_export" != "X:" &&
8354 func_len " $test_cmds" &&
8355 len=$func_len_result &&
8356 test "$len" -lt "$max_cmd_len" || test "$max_cmd_len" -le -1; then
8358 else
8359 # The command line is too long to link in one step, link piecewise
8360 # or, if using GNU ld and skipped_export is not :, use a linker
8361 # script.
8363 # Save the value of $output and $libobjs because we want to
8364 # use them later. If we have whole_archive_flag_spec, we
8365 # want to use save_libobjs as it was before
8366 # whole_archive_flag_spec was expanded, because we can't
8367 # assume the linker understands whole_archive_flag_spec.
8368 # This may have to be revisited, in case too many
8369 # convenience libraries get linked in and end up exceeding
8370 # the spec.
8371 if test -z "$convenience" || test -z "$whole_archive_flag_spec"; then
8372 save_libobjs=$libobjs
8374 save_output=$output
8375 func_basename "$output"
8376 output_la=$func_basename_result
8378 # Clear the reloadable object creation command queue and
8379 # initialize k to one.
8380 test_cmds=
8381 concat_cmds=
8382 objlist=
8383 last_robj=
8386 if test -n "$save_libobjs" && test "X$skipped_export" != "X:" && test "$with_gnu_ld" = yes; then
8387 output=${output_objdir}/${output_la}.lnkscript
8388 func_verbose "creating GNU ld script: $output"
8389 echo 'INPUT (' > $output
8390 for obj in $save_libobjs
8392 func_to_tool_file "$obj"
8393 $ECHO "$func_to_tool_file_result" >> $output
8394 done
8395 echo ')' >> $output
8396 func_append delfiles " $output"
8397 func_to_tool_file "$output"
8398 output=$func_to_tool_file_result
8399 elif test -n "$save_libobjs" && test "X$skipped_export" != "X:" && test "X$file_list_spec" != X; then
8400 output=${output_objdir}/${output_la}.lnk
8401 func_verbose "creating linker input file list: $output"
8402 : > $output
8403 set x $save_libobjs
8404 shift
8405 firstobj=
8406 if test "$compiler_needs_object" = yes; then
8407 firstobj="$1 "
8408 shift
8410 for obj
8412 func_to_tool_file "$obj"
8413 $ECHO "$func_to_tool_file_result" >> $output
8414 done
8415 func_append delfiles " $output"
8416 func_to_tool_file "$output"
8417 output=$firstobj\"$file_list_spec$func_to_tool_file_result\"
8418 else
8419 if test -n "$save_libobjs"; then
8420 func_verbose "creating reloadable object files..."
8421 output=$output_objdir/$output_la-${k}.$objext
8422 eval test_cmds=\"$reload_cmds\"
8423 func_len " $test_cmds"
8424 len0=$func_len_result
8425 len=$len0
8427 # Loop over the list of objects to be linked.
8428 for obj in $save_libobjs
8430 func_len " $obj"
8431 func_arith $len + $func_len_result
8432 len=$func_arith_result
8433 if test "X$objlist" = X ||
8434 test "$len" -lt "$max_cmd_len"; then
8435 func_append objlist " $obj"
8436 else
8437 # The command $test_cmds is almost too long, add a
8438 # command to the queue.
8439 if test "$k" -eq 1 ; then
8440 # The first file doesn't have a previous command to add.
8441 reload_objs=$objlist
8442 eval concat_cmds=\"$reload_cmds\"
8443 else
8444 # All subsequent reloadable object files will link in
8445 # the last one created.
8446 reload_objs="$objlist $last_robj"
8447 eval concat_cmds=\"\$concat_cmds~$reload_cmds~\$RM $last_robj\"
8449 last_robj=$output_objdir/$output_la-${k}.$objext
8450 func_arith $k + 1
8451 k=$func_arith_result
8452 output=$output_objdir/$output_la-${k}.$objext
8453 objlist=" $obj"
8454 func_len " $last_robj"
8455 func_arith $len0 + $func_len_result
8456 len=$func_arith_result
8458 done
8459 # Handle the remaining objects by creating one last
8460 # reloadable object file. All subsequent reloadable object
8461 # files will link in the last one created.
8462 test -z "$concat_cmds" || concat_cmds=$concat_cmds~
8463 reload_objs="$objlist $last_robj"
8464 eval concat_cmds=\"\${concat_cmds}$reload_cmds\"
8465 if test -n "$last_robj"; then
8466 eval concat_cmds=\"\${concat_cmds}~\$RM $last_robj\"
8468 func_append delfiles " $output"
8470 else
8471 output=
8474 if ${skipped_export-false}; then
8475 func_verbose "generating symbol list for \`$libname.la'"
8476 export_symbols="$output_objdir/$libname.exp"
8477 $opt_dry_run || $RM $export_symbols
8478 libobjs=$output
8479 # Append the command to create the export file.
8480 test -z "$concat_cmds" || concat_cmds=$concat_cmds~
8481 eval concat_cmds=\"\$concat_cmds$export_symbols_cmds\"
8482 if test -n "$last_robj"; then
8483 eval concat_cmds=\"\$concat_cmds~\$RM $last_robj\"
8487 test -n "$save_libobjs" &&
8488 func_verbose "creating a temporary reloadable object file: $output"
8490 # Loop through the commands generated above and execute them.
8491 save_ifs="$IFS"; IFS='~'
8492 for cmd in $concat_cmds; do
8493 IFS="$save_ifs"
8494 $opt_silent || {
8495 func_quote_for_expand "$cmd"
8496 eval "func_echo $func_quote_for_expand_result"
8498 $opt_dry_run || eval "$cmd" || {
8499 lt_exit=$?
8501 # Restore the uninstalled library and exit
8502 if test "$opt_mode" = relink; then
8503 ( cd "$output_objdir" && \
8504 $RM "${realname}T" && \
8505 $MV "${realname}U" "$realname" )
8508 exit $lt_exit
8510 done
8511 IFS="$save_ifs"
8513 if test -n "$export_symbols_regex" && ${skipped_export-false}; then
8514 func_show_eval '$EGREP -e "$export_symbols_regex" "$export_symbols" > "${export_symbols}T"'
8515 func_show_eval '$MV "${export_symbols}T" "$export_symbols"'
8519 if ${skipped_export-false}; then
8520 if test -n "$export_symbols" && test -n "$include_expsyms"; then
8521 tmp_export_symbols="$export_symbols"
8522 test -n "$orig_export_symbols" && tmp_export_symbols="$orig_export_symbols"
8523 $opt_dry_run || eval '$ECHO "$include_expsyms" | $SP2NL >> "$tmp_export_symbols"'
8526 if test -n "$orig_export_symbols"; then
8527 # The given exports_symbols file has to be filtered, so filter it.
8528 func_verbose "filter symbol list for \`$libname.la' to tag DATA exports"
8529 # FIXME: $output_objdir/$libname.filter potentially contains lots of
8530 # 's' commands which not all seds can handle. GNU sed should be fine
8531 # though. Also, the filter scales superlinearly with the number of
8532 # global variables. join(1) would be nice here, but unfortunately
8533 # isn't a blessed tool.
8534 $opt_dry_run || $SED -e '/[ ,]DATA/!d;s,\(.*\)\([ \,].*\),s|^\1$|\1\2|,' < $export_symbols > $output_objdir/$libname.filter
8535 func_append delfiles " $export_symbols $output_objdir/$libname.filter"
8536 export_symbols=$output_objdir/$libname.def
8537 $opt_dry_run || $SED -f $output_objdir/$libname.filter < $orig_export_symbols > $export_symbols
8541 libobjs=$output
8542 # Restore the value of output.
8543 output=$save_output
8545 if test -n "$convenience" && test -n "$whole_archive_flag_spec"; then
8546 eval libobjs=\"\$libobjs $whole_archive_flag_spec\"
8547 test "X$libobjs" = "X " && libobjs=
8549 # Expand the library linking commands again to reset the
8550 # value of $libobjs for piecewise linking.
8552 # Do each of the archive commands.
8553 if test "$module" = yes && test -n "$module_cmds" ; then
8554 if test -n "$export_symbols" && test -n "$module_expsym_cmds"; then
8555 cmds=$module_expsym_cmds
8556 else
8557 cmds=$module_cmds
8559 else
8560 if test -n "$export_symbols" && test -n "$archive_expsym_cmds"; then
8561 cmds=$archive_expsym_cmds
8562 else
8563 cmds=$archive_cmds
8568 if test -n "$delfiles"; then
8569 # Append the command to remove temporary files to $cmds.
8570 eval cmds=\"\$cmds~\$RM $delfiles\"
8573 # Add any objects from preloaded convenience libraries
8574 if test -n "$dlprefiles"; then
8575 gentop="$output_objdir/${outputname}x"
8576 func_append generated " $gentop"
8578 func_extract_archives $gentop $dlprefiles
8579 func_append libobjs " $func_extract_archives_result"
8580 test "X$libobjs" = "X " && libobjs=
8583 save_ifs="$IFS"; IFS='~'
8584 for cmd in $cmds; do
8585 IFS="$save_ifs"
8586 eval cmd=\"$cmd\"
8587 $opt_silent || {
8588 func_quote_for_expand "$cmd"
8589 eval "func_echo $func_quote_for_expand_result"
8591 $opt_dry_run || eval "$cmd" || {
8592 lt_exit=$?
8594 # Restore the uninstalled library and exit
8595 if test "$opt_mode" = relink; then
8596 ( cd "$output_objdir" && \
8597 $RM "${realname}T" && \
8598 $MV "${realname}U" "$realname" )
8601 exit $lt_exit
8603 done
8604 IFS="$save_ifs"
8606 # Restore the uninstalled library and exit
8607 if test "$opt_mode" = relink; then
8608 $opt_dry_run || eval '(cd $output_objdir && $RM ${realname}T && $MV $realname ${realname}T && $MV ${realname}U $realname)' || exit $?
8610 if test -n "$convenience"; then
8611 if test -z "$whole_archive_flag_spec"; then
8612 func_show_eval '${RM}r "$gentop"'
8616 exit $EXIT_SUCCESS
8619 # Create links to the real library.
8620 for linkname in $linknames; do
8621 if test "$realname" != "$linkname"; then
8622 func_show_eval '(cd "$output_objdir" && $RM "$linkname" && $LN_S "$realname" "$linkname")' 'exit $?'
8624 done
8626 # If -module or -export-dynamic was specified, set the dlname.
8627 if test "$module" = yes || test "$export_dynamic" = yes; then
8628 # On all known operating systems, these are identical.
8629 dlname="$soname"
8634 obj)
8635 if test -n "$dlfiles$dlprefiles" || test "$dlself" != no; then
8636 func_warning "\`-dlopen' is ignored for objects"
8639 case " $deplibs" in
8640 *\ -l* | *\ -L*)
8641 func_warning "\`-l' and \`-L' are ignored for objects" ;;
8642 esac
8644 test -n "$rpath" && \
8645 func_warning "\`-rpath' is ignored for objects"
8647 test -n "$xrpath" && \
8648 func_warning "\`-R' is ignored for objects"
8650 test -n "$vinfo" && \
8651 func_warning "\`-version-info' is ignored for objects"
8653 test -n "$release" && \
8654 func_warning "\`-release' is ignored for objects"
8656 case $output in
8657 *.lo)
8658 test -n "$objs$old_deplibs" && \
8659 func_fatal_error "cannot build library object \`$output' from non-libtool objects"
8661 libobj=$output
8662 func_lo2o "$libobj"
8663 obj=$func_lo2o_result
8666 libobj=
8667 obj="$output"
8669 esac
8671 # Delete the old objects.
8672 $opt_dry_run || $RM $obj $libobj
8674 # Objects from convenience libraries. This assumes
8675 # single-version convenience libraries. Whenever we create
8676 # different ones for PIC/non-PIC, this we'll have to duplicate
8677 # the extraction.
8678 reload_conv_objs=
8679 gentop=
8680 # reload_cmds runs $LD directly, so let us get rid of
8681 # -Wl from whole_archive_flag_spec and hope we can get by with
8682 # turning comma into space..
8685 if test -n "$convenience"; then
8686 if test -n "$whole_archive_flag_spec"; then
8687 eval tmp_whole_archive_flags=\"$whole_archive_flag_spec\"
8688 reload_conv_objs=$reload_objs\ `$ECHO "$tmp_whole_archive_flags" | $SED 's|,| |g'`
8689 else
8690 gentop="$output_objdir/${obj}x"
8691 func_append generated " $gentop"
8693 func_extract_archives $gentop $convenience
8694 reload_conv_objs="$reload_objs $func_extract_archives_result"
8698 # If we're not building shared, we need to use non_pic_objs
8699 test "$build_libtool_libs" != yes && libobjs="$non_pic_objects"
8701 # Create the old-style object.
8702 reload_objs="$objs$old_deplibs "`$ECHO "$libobjs" | $SP2NL | $SED "/\.${libext}$/d; /\.lib$/d; $lo2o" | $NL2SP`" $reload_conv_objs" ### testsuite: skip nested quoting test
8704 output="$obj"
8705 func_execute_cmds "$reload_cmds" 'exit $?'
8707 # Exit if we aren't doing a library object file.
8708 if test -z "$libobj"; then
8709 if test -n "$gentop"; then
8710 func_show_eval '${RM}r "$gentop"'
8713 exit $EXIT_SUCCESS
8716 if test "$build_libtool_libs" != yes; then
8717 if test -n "$gentop"; then
8718 func_show_eval '${RM}r "$gentop"'
8721 # Create an invalid libtool object if no PIC, so that we don't
8722 # accidentally link it into a program.
8723 # $show "echo timestamp > $libobj"
8724 # $opt_dry_run || eval "echo timestamp > $libobj" || exit $?
8725 exit $EXIT_SUCCESS
8728 if test -n "$pic_flag" || test "$pic_mode" != default; then
8729 # Only do commands if we really have different PIC objects.
8730 reload_objs="$libobjs $reload_conv_objs"
8731 output="$libobj"
8732 func_execute_cmds "$reload_cmds" 'exit $?'
8735 if test -n "$gentop"; then
8736 func_show_eval '${RM}r "$gentop"'
8739 exit $EXIT_SUCCESS
8742 prog)
8743 case $host in
8744 *cygwin*) func_stripname '' '.exe' "$output"
8745 output=$func_stripname_result.exe;;
8746 esac
8747 test -n "$vinfo" && \
8748 func_warning "\`-version-info' is ignored for programs"
8750 test -n "$release" && \
8751 func_warning "\`-release' is ignored for programs"
8753 test "$preload" = yes \
8754 && test "$dlopen_support" = unknown \
8755 && test "$dlopen_self" = unknown \
8756 && test "$dlopen_self_static" = unknown && \
8757 func_warning "\`LT_INIT([dlopen])' not used. Assuming no dlopen support."
8759 case $host in
8760 *-*-rhapsody* | *-*-darwin1.[012])
8761 # On Rhapsody replace the C library is the System framework
8762 compile_deplibs=`$ECHO " $compile_deplibs" | $SED 's/ -lc / System.ltframework /'`
8763 finalize_deplibs=`$ECHO " $finalize_deplibs" | $SED 's/ -lc / System.ltframework /'`
8765 esac
8767 case $host in
8768 *-*-darwin*)
8769 # Don't allow lazy linking, it breaks C++ global constructors
8770 # But is supposedly fixed on 10.4 or later (yay!).
8771 if test "$tagname" = CXX ; then
8772 case ${MACOSX_DEPLOYMENT_TARGET-10.0} in
8773 10.[0123])
8774 func_append compile_command " ${wl}-bind_at_load"
8775 func_append finalize_command " ${wl}-bind_at_load"
8777 esac
8779 # Time to change all our "foo.ltframework" stuff back to "-framework foo"
8780 compile_deplibs=`$ECHO " $compile_deplibs" | $SED 's% \([^ $]*\).ltframework% -framework \1%g'`
8781 finalize_deplibs=`$ECHO " $finalize_deplibs" | $SED 's% \([^ $]*\).ltframework% -framework \1%g'`
8783 esac
8786 # move library search paths that coincide with paths to not yet
8787 # installed libraries to the beginning of the library search list
8788 new_libs=
8789 for path in $notinst_path; do
8790 case " $new_libs " in
8791 *" -L$path/$objdir "*) ;;
8793 case " $compile_deplibs " in
8794 *" -L$path/$objdir "*)
8795 func_append new_libs " -L$path/$objdir" ;;
8796 esac
8798 esac
8799 done
8800 for deplib in $compile_deplibs; do
8801 case $deplib in
8802 -L*)
8803 case " $new_libs " in
8804 *" $deplib "*) ;;
8805 *) func_append new_libs " $deplib" ;;
8806 esac
8808 *) func_append new_libs " $deplib" ;;
8809 esac
8810 done
8811 compile_deplibs="$new_libs"
8814 func_append compile_command " $compile_deplibs"
8815 func_append finalize_command " $finalize_deplibs"
8817 if test -n "$rpath$xrpath"; then
8818 # If the user specified any rpath flags, then add them.
8819 for libdir in $rpath $xrpath; do
8820 # This is the magic to use -rpath.
8821 case "$finalize_rpath " in
8822 *" $libdir "*) ;;
8823 *) func_append finalize_rpath " $libdir" ;;
8824 esac
8825 done
8828 # Now hardcode the library paths
8829 rpath=
8830 hardcode_libdirs=
8831 for libdir in $compile_rpath $finalize_rpath; do
8832 if test -n "$hardcode_libdir_flag_spec"; then
8833 if test -n "$hardcode_libdir_separator"; then
8834 if test -z "$hardcode_libdirs"; then
8835 hardcode_libdirs="$libdir"
8836 else
8837 # Just accumulate the unique libdirs.
8838 case $hardcode_libdir_separator$hardcode_libdirs$hardcode_libdir_separator in
8839 *"$hardcode_libdir_separator$libdir$hardcode_libdir_separator"*)
8842 func_append hardcode_libdirs "$hardcode_libdir_separator$libdir"
8844 esac
8846 else
8847 eval flag=\"$hardcode_libdir_flag_spec\"
8848 func_append rpath " $flag"
8850 elif test -n "$runpath_var"; then
8851 case "$perm_rpath " in
8852 *" $libdir "*) ;;
8853 *) func_append perm_rpath " $libdir" ;;
8854 esac
8856 case $host in
8857 *-*-cygwin* | *-*-mingw* | *-*-pw32* | *-*-os2* | *-cegcc*)
8858 testbindir=`${ECHO} "$libdir" | ${SED} -e 's*/lib$*/bin*'`
8859 case :$dllsearchpath: in
8860 *":$libdir:"*) ;;
8861 ::) dllsearchpath=$libdir;;
8862 *) func_append dllsearchpath ":$libdir";;
8863 esac
8864 case :$dllsearchpath: in
8865 *":$testbindir:"*) ;;
8866 ::) dllsearchpath=$testbindir;;
8867 *) func_append dllsearchpath ":$testbindir";;
8868 esac
8870 esac
8871 done
8872 # Substitute the hardcoded libdirs into the rpath.
8873 if test -n "$hardcode_libdir_separator" &&
8874 test -n "$hardcode_libdirs"; then
8875 libdir="$hardcode_libdirs"
8876 eval rpath=\" $hardcode_libdir_flag_spec\"
8878 compile_rpath="$rpath"
8880 rpath=
8881 hardcode_libdirs=
8882 for libdir in $finalize_rpath; do
8883 if test -n "$hardcode_libdir_flag_spec"; then
8884 if test -n "$hardcode_libdir_separator"; then
8885 if test -z "$hardcode_libdirs"; then
8886 hardcode_libdirs="$libdir"
8887 else
8888 # Just accumulate the unique libdirs.
8889 case $hardcode_libdir_separator$hardcode_libdirs$hardcode_libdir_separator in
8890 *"$hardcode_libdir_separator$libdir$hardcode_libdir_separator"*)
8893 func_append hardcode_libdirs "$hardcode_libdir_separator$libdir"
8895 esac
8897 else
8898 eval flag=\"$hardcode_libdir_flag_spec\"
8899 func_append rpath " $flag"
8901 elif test -n "$runpath_var"; then
8902 case "$finalize_perm_rpath " in
8903 *" $libdir "*) ;;
8904 *) func_append finalize_perm_rpath " $libdir" ;;
8905 esac
8907 done
8908 # Substitute the hardcoded libdirs into the rpath.
8909 if test -n "$hardcode_libdir_separator" &&
8910 test -n "$hardcode_libdirs"; then
8911 libdir="$hardcode_libdirs"
8912 eval rpath=\" $hardcode_libdir_flag_spec\"
8914 finalize_rpath="$rpath"
8916 if test -n "$libobjs" && test "$build_old_libs" = yes; then
8917 # Transform all the library objects into standard objects.
8918 compile_command=`$ECHO "$compile_command" | $SP2NL | $SED "$lo2o" | $NL2SP`
8919 finalize_command=`$ECHO "$finalize_command" | $SP2NL | $SED "$lo2o" | $NL2SP`
8922 func_generate_dlsyms "$outputname" "@PROGRAM@" "no"
8924 # template prelinking step
8925 if test -n "$prelink_cmds"; then
8926 func_execute_cmds "$prelink_cmds" 'exit $?'
8929 wrappers_required=yes
8930 case $host in
8931 *cegcc* | *mingw32ce*)
8932 # Disable wrappers for cegcc and mingw32ce hosts, we are cross compiling anyway.
8933 wrappers_required=no
8935 *cygwin* | *mingw* )
8936 if test "$build_libtool_libs" != yes; then
8937 wrappers_required=no
8941 if test "$need_relink" = no || test "$build_libtool_libs" != yes; then
8942 wrappers_required=no
8945 esac
8946 if test "$wrappers_required" = no; then
8947 # Replace the output file specification.
8948 compile_command=`$ECHO "$compile_command" | $SED 's%@OUTPUT@%'"$output"'%g'`
8949 link_command="$compile_command$compile_rpath"
8951 # We have no uninstalled library dependencies, so finalize right now.
8952 exit_status=0
8953 func_show_eval "$link_command" 'exit_status=$?'
8955 if test -n "$postlink_cmds"; then
8956 func_to_tool_file "$output"
8957 postlink_cmds=`func_echo_all "$postlink_cmds" | $SED -e 's%@OUTPUT@%'"$output"'%g' -e 's%@TOOL_OUTPUT@%'"$func_to_tool_file_result"'%g'`
8958 func_execute_cmds "$postlink_cmds" 'exit $?'
8961 # Delete the generated files.
8962 if test -f "$output_objdir/${outputname}S.${objext}"; then
8963 func_show_eval '$RM "$output_objdir/${outputname}S.${objext}"'
8966 exit $exit_status
8969 if test -n "$compile_shlibpath$finalize_shlibpath"; then
8970 compile_command="$shlibpath_var=\"$compile_shlibpath$finalize_shlibpath\$$shlibpath_var\" $compile_command"
8972 if test -n "$finalize_shlibpath"; then
8973 finalize_command="$shlibpath_var=\"$finalize_shlibpath\$$shlibpath_var\" $finalize_command"
8976 compile_var=
8977 finalize_var=
8978 if test -n "$runpath_var"; then
8979 if test -n "$perm_rpath"; then
8980 # We should set the runpath_var.
8981 rpath=
8982 for dir in $perm_rpath; do
8983 func_append rpath "$dir:"
8984 done
8985 compile_var="$runpath_var=\"$rpath\$$runpath_var\" "
8987 if test -n "$finalize_perm_rpath"; then
8988 # We should set the runpath_var.
8989 rpath=
8990 for dir in $finalize_perm_rpath; do
8991 func_append rpath "$dir:"
8992 done
8993 finalize_var="$runpath_var=\"$rpath\$$runpath_var\" "
8997 if test "$no_install" = yes; then
8998 # We don't need to create a wrapper script.
8999 link_command="$compile_var$compile_command$compile_rpath"
9000 # Replace the output file specification.
9001 link_command=`$ECHO "$link_command" | $SED 's%@OUTPUT@%'"$output"'%g'`
9002 # Delete the old output file.
9003 $opt_dry_run || $RM $output
9004 # Link the executable and exit
9005 func_show_eval "$link_command" 'exit $?'
9007 if test -n "$postlink_cmds"; then
9008 func_to_tool_file "$output"
9009 postlink_cmds=`func_echo_all "$postlink_cmds" | $SED -e 's%@OUTPUT@%'"$output"'%g' -e 's%@TOOL_OUTPUT@%'"$func_to_tool_file_result"'%g'`
9010 func_execute_cmds "$postlink_cmds" 'exit $?'
9013 exit $EXIT_SUCCESS
9016 if test "$hardcode_action" = relink; then
9017 # Fast installation is not supported
9018 link_command="$compile_var$compile_command$compile_rpath"
9019 relink_command="$finalize_var$finalize_command$finalize_rpath"
9021 func_warning "this platform does not like uninstalled shared libraries"
9022 func_warning "\`$output' will be relinked during installation"
9023 else
9024 if test "$fast_install" != no; then
9025 link_command="$finalize_var$compile_command$finalize_rpath"
9026 if test "$fast_install" = yes; then
9027 relink_command=`$ECHO "$compile_var$compile_command$compile_rpath" | $SED 's%@OUTPUT@%\$progdir/\$file%g'`
9028 else
9029 # fast_install is set to needless
9030 relink_command=
9032 else
9033 link_command="$compile_var$compile_command$compile_rpath"
9034 relink_command="$finalize_var$finalize_command$finalize_rpath"
9038 # Replace the output file specification.
9039 link_command=`$ECHO "$link_command" | $SED 's%@OUTPUT@%'"$output_objdir/$outputname"'%g'`
9041 # Delete the old output files.
9042 $opt_dry_run || $RM $output $output_objdir/$outputname $output_objdir/lt-$outputname
9044 func_show_eval "$link_command" 'exit $?'
9046 if test -n "$postlink_cmds"; then
9047 func_to_tool_file "$output_objdir/$outputname"
9048 postlink_cmds=`func_echo_all "$postlink_cmds" | $SED -e 's%@OUTPUT@%'"$output_objdir/$outputname"'%g' -e 's%@TOOL_OUTPUT@%'"$func_to_tool_file_result"'%g'`
9049 func_execute_cmds "$postlink_cmds" 'exit $?'
9052 # Now create the wrapper script.
9053 func_verbose "creating $output"
9055 # Quote the relink command for shipping.
9056 if test -n "$relink_command"; then
9057 # Preserve any variables that may affect compiler behavior
9058 for var in $variables_saved_for_relink; do
9059 if eval test -z \"\${$var+set}\"; then
9060 relink_command="{ test -z \"\${$var+set}\" || $lt_unset $var || { $var=; export $var; }; }; $relink_command"
9061 elif eval var_value=\$$var; test -z "$var_value"; then
9062 relink_command="$var=; export $var; $relink_command"
9063 else
9064 func_quote_for_eval "$var_value"
9065 relink_command="$var=$func_quote_for_eval_result; export $var; $relink_command"
9067 done
9068 relink_command="(cd `pwd`; $relink_command)"
9069 relink_command=`$ECHO "$relink_command" | $SED "$sed_quote_subst"`
9072 # Only actually do things if not in dry run mode.
9073 $opt_dry_run || {
9074 # win32 will think the script is a binary if it has
9075 # a .exe suffix, so we strip it off here.
9076 case $output in
9077 *.exe) func_stripname '' '.exe' "$output"
9078 output=$func_stripname_result ;;
9079 esac
9080 # test for cygwin because mv fails w/o .exe extensions
9081 case $host in
9082 *cygwin*)
9083 exeext=.exe
9084 func_stripname '' '.exe' "$outputname"
9085 outputname=$func_stripname_result ;;
9086 *) exeext= ;;
9087 esac
9088 case $host in
9089 *cygwin* | *mingw* )
9090 func_dirname_and_basename "$output" "" "."
9091 output_name=$func_basename_result
9092 output_path=$func_dirname_result
9093 cwrappersource="$output_path/$objdir/lt-$output_name.c"
9094 cwrapper="$output_path/$output_name.exe"
9095 $RM $cwrappersource $cwrapper
9096 trap "$RM $cwrappersource $cwrapper; exit $EXIT_FAILURE" 1 2 15
9098 func_emit_cwrapperexe_src > $cwrappersource
9100 # The wrapper executable is built using the $host compiler,
9101 # because it contains $host paths and files. If cross-
9102 # compiling, it, like the target executable, must be
9103 # executed on the $host or under an emulation environment.
9104 $opt_dry_run || {
9105 $LTCC $LTCFLAGS -o $cwrapper $cwrappersource
9106 $STRIP $cwrapper
9109 # Now, create the wrapper script for func_source use:
9110 func_ltwrapper_scriptname $cwrapper
9111 $RM $func_ltwrapper_scriptname_result
9112 trap "$RM $func_ltwrapper_scriptname_result; exit $EXIT_FAILURE" 1 2 15
9113 $opt_dry_run || {
9114 # note: this script will not be executed, so do not chmod.
9115 if test "x$build" = "x$host" ; then
9116 $cwrapper --lt-dump-script > $func_ltwrapper_scriptname_result
9117 else
9118 func_emit_wrapper no > $func_ltwrapper_scriptname_result
9123 $RM $output
9124 trap "$RM $output; exit $EXIT_FAILURE" 1 2 15
9126 func_emit_wrapper no > $output
9127 chmod +x $output
9129 esac
9131 exit $EXIT_SUCCESS
9133 esac
9135 # See if we need to build an old-fashioned archive.
9136 for oldlib in $oldlibs; do
9138 if test "$build_libtool_libs" = convenience; then
9139 oldobjs="$libobjs_save $symfileobj"
9140 addlibs="$convenience"
9141 build_libtool_libs=no
9142 else
9143 if test "$build_libtool_libs" = module; then
9144 oldobjs="$libobjs_save"
9145 build_libtool_libs=no
9146 else
9147 oldobjs="$old_deplibs $non_pic_objects"
9148 if test "$preload" = yes && test -f "$symfileobj"; then
9149 func_append oldobjs " $symfileobj"
9152 addlibs="$old_convenience"
9155 if test -n "$addlibs"; then
9156 gentop="$output_objdir/${outputname}x"
9157 func_append generated " $gentop"
9159 func_extract_archives $gentop $addlibs
9160 func_append oldobjs " $func_extract_archives_result"
9163 # Do each command in the archive commands.
9164 if test -n "$old_archive_from_new_cmds" && test "$build_libtool_libs" = yes; then
9165 cmds=$old_archive_from_new_cmds
9166 else
9168 # Add any objects from preloaded convenience libraries
9169 if test -n "$dlprefiles"; then
9170 gentop="$output_objdir/${outputname}x"
9171 func_append generated " $gentop"
9173 func_extract_archives $gentop $dlprefiles
9174 func_append oldobjs " $func_extract_archives_result"
9177 # POSIX demands no paths to be encoded in archives. We have
9178 # to avoid creating archives with duplicate basenames if we
9179 # might have to extract them afterwards, e.g., when creating a
9180 # static archive out of a convenience library, or when linking
9181 # the entirety of a libtool archive into another (currently
9182 # not supported by libtool).
9183 if (for obj in $oldobjs
9185 func_basename "$obj"
9186 $ECHO "$func_basename_result"
9187 done | sort | sort -uc >/dev/null 2>&1); then
9189 else
9190 echo "copying selected object files to avoid basename conflicts..."
9191 gentop="$output_objdir/${outputname}x"
9192 func_append generated " $gentop"
9193 func_mkdir_p "$gentop"
9194 save_oldobjs=$oldobjs
9195 oldobjs=
9196 counter=1
9197 for obj in $save_oldobjs
9199 func_basename "$obj"
9200 objbase="$func_basename_result"
9201 case " $oldobjs " in
9202 " ") oldobjs=$obj ;;
9203 *[\ /]"$objbase "*)
9204 while :; do
9205 # Make sure we don't pick an alternate name that also
9206 # overlaps.
9207 newobj=lt$counter-$objbase
9208 func_arith $counter + 1
9209 counter=$func_arith_result
9210 case " $oldobjs " in
9211 *[\ /]"$newobj "*) ;;
9212 *) if test ! -f "$gentop/$newobj"; then break; fi ;;
9213 esac
9214 done
9215 func_show_eval "ln $obj $gentop/$newobj || cp $obj $gentop/$newobj"
9216 func_append oldobjs " $gentop/$newobj"
9218 *) func_append oldobjs " $obj" ;;
9219 esac
9220 done
9222 func_to_tool_file "$oldlib" func_convert_file_msys_to_w32
9223 tool_oldlib=$func_to_tool_file_result
9224 eval cmds=\"$old_archive_cmds\"
9226 func_len " $cmds"
9227 len=$func_len_result
9228 if test "$len" -lt "$max_cmd_len" || test "$max_cmd_len" -le -1; then
9229 cmds=$old_archive_cmds
9230 elif test -n "$archiver_list_spec"; then
9231 func_verbose "using command file archive linking..."
9232 for obj in $oldobjs
9234 func_to_tool_file "$obj"
9235 $ECHO "$func_to_tool_file_result"
9236 done > $output_objdir/$libname.libcmd
9237 func_to_tool_file "$output_objdir/$libname.libcmd"
9238 oldobjs=" $archiver_list_spec$func_to_tool_file_result"
9239 cmds=$old_archive_cmds
9240 else
9241 # the command line is too long to link in one step, link in parts
9242 func_verbose "using piecewise archive linking..."
9243 save_RANLIB=$RANLIB
9244 RANLIB=:
9245 objlist=
9246 concat_cmds=
9247 save_oldobjs=$oldobjs
9248 oldobjs=
9249 # Is there a better way of finding the last object in the list?
9250 for obj in $save_oldobjs
9252 last_oldobj=$obj
9253 done
9254 eval test_cmds=\"$old_archive_cmds\"
9255 func_len " $test_cmds"
9256 len0=$func_len_result
9257 len=$len0
9258 for obj in $save_oldobjs
9260 func_len " $obj"
9261 func_arith $len + $func_len_result
9262 len=$func_arith_result
9263 func_append objlist " $obj"
9264 if test "$len" -lt "$max_cmd_len"; then
9266 else
9267 # the above command should be used before it gets too long
9268 oldobjs=$objlist
9269 if test "$obj" = "$last_oldobj" ; then
9270 RANLIB=$save_RANLIB
9272 test -z "$concat_cmds" || concat_cmds=$concat_cmds~
9273 eval concat_cmds=\"\${concat_cmds}$old_archive_cmds\"
9274 objlist=
9275 len=$len0
9277 done
9278 RANLIB=$save_RANLIB
9279 oldobjs=$objlist
9280 if test "X$oldobjs" = "X" ; then
9281 eval cmds=\"\$concat_cmds\"
9282 else
9283 eval cmds=\"\$concat_cmds~\$old_archive_cmds\"
9287 func_execute_cmds "$cmds" 'exit $?'
9288 done
9290 test -n "$generated" && \
9291 func_show_eval "${RM}r$generated"
9293 # Now create the libtool archive.
9294 case $output in
9295 *.la)
9296 old_library=
9297 test "$build_old_libs" = yes && old_library="$libname.$libext"
9298 func_verbose "creating $output"
9300 # Preserve any variables that may affect compiler behavior
9301 for var in $variables_saved_for_relink; do
9302 if eval test -z \"\${$var+set}\"; then
9303 relink_command="{ test -z \"\${$var+set}\" || $lt_unset $var || { $var=; export $var; }; }; $relink_command"
9304 elif eval var_value=\$$var; test -z "$var_value"; then
9305 relink_command="$var=; export $var; $relink_command"
9306 else
9307 func_quote_for_eval "$var_value"
9308 relink_command="$var=$func_quote_for_eval_result; export $var; $relink_command"
9310 done
9311 # Quote the link command for shipping.
9312 relink_command="(cd `pwd`; $SHELL $progpath $preserve_args --mode=relink $libtool_args @inst_prefix_dir@)"
9313 relink_command=`$ECHO "$relink_command" | $SED "$sed_quote_subst"`
9314 if test "$hardcode_automatic" = yes ; then
9315 relink_command=
9318 # Only create the output if not a dry run.
9319 $opt_dry_run || {
9320 for installed in no yes; do
9321 if test "$installed" = yes; then
9322 if test -z "$install_libdir"; then
9323 break
9325 output="$output_objdir/$outputname"i
9326 # Replace all uninstalled libtool libraries with the installed ones
9327 newdependency_libs=
9328 for deplib in $dependency_libs; do
9329 case $deplib in
9330 *.la)
9331 func_basename "$deplib"
9332 name="$func_basename_result"
9333 func_resolve_sysroot "$deplib"
9334 eval libdir=`${SED} -n -e 's/^libdir=\(.*\)$/\1/p' $func_resolve_sysroot_result`
9335 test -z "$libdir" && \
9336 func_fatal_error "\`$deplib' is not a valid libtool archive"
9337 func_append newdependency_libs " ${lt_sysroot:+=}$libdir/$name"
9339 -L*)
9340 func_stripname -L '' "$deplib"
9341 func_replace_sysroot "$func_stripname_result"
9342 func_append newdependency_libs " -L$func_replace_sysroot_result"
9344 -R*)
9345 func_stripname -R '' "$deplib"
9346 func_replace_sysroot "$func_stripname_result"
9347 func_append newdependency_libs " -R$func_replace_sysroot_result"
9349 *) func_append newdependency_libs " $deplib" ;;
9350 esac
9351 done
9352 dependency_libs="$newdependency_libs"
9353 newdlfiles=
9355 for lib in $dlfiles; do
9356 case $lib in
9357 *.la)
9358 func_basename "$lib"
9359 name="$func_basename_result"
9360 eval libdir=`${SED} -n -e 's/^libdir=\(.*\)$/\1/p' $lib`
9361 test -z "$libdir" && \
9362 func_fatal_error "\`$lib' is not a valid libtool archive"
9363 func_append newdlfiles " ${lt_sysroot:+=}$libdir/$name"
9365 *) func_append newdlfiles " $lib" ;;
9366 esac
9367 done
9368 dlfiles="$newdlfiles"
9369 newdlprefiles=
9370 for lib in $dlprefiles; do
9371 case $lib in
9372 *.la)
9373 # Only pass preopened files to the pseudo-archive (for
9374 # eventual linking with the app. that links it) if we
9375 # didn't already link the preopened objects directly into
9376 # the library:
9377 func_basename "$lib"
9378 name="$func_basename_result"
9379 eval libdir=`${SED} -n -e 's/^libdir=\(.*\)$/\1/p' $lib`
9380 test -z "$libdir" && \
9381 func_fatal_error "\`$lib' is not a valid libtool archive"
9382 func_append newdlprefiles " ${lt_sysroot:+=}$libdir/$name"
9384 esac
9385 done
9386 dlprefiles="$newdlprefiles"
9387 else
9388 newdlfiles=
9389 for lib in $dlfiles; do
9390 case $lib in
9391 [\\/]* | [A-Za-z]:[\\/]*) abs="$lib" ;;
9392 *) abs=`pwd`"/$lib" ;;
9393 esac
9394 func_append newdlfiles " $abs"
9395 done
9396 dlfiles="$newdlfiles"
9397 newdlprefiles=
9398 for lib in $dlprefiles; do
9399 case $lib in
9400 [\\/]* | [A-Za-z]:[\\/]*) abs="$lib" ;;
9401 *) abs=`pwd`"/$lib" ;;
9402 esac
9403 func_append newdlprefiles " $abs"
9404 done
9405 dlprefiles="$newdlprefiles"
9407 $RM $output
9408 # place dlname in correct position for cygwin
9409 # In fact, it would be nice if we could use this code for all target
9410 # systems that can't hard-code library paths into their executables
9411 # and that have no shared library path variable independent of PATH,
9412 # but it turns out we can't easily determine that from inspecting
9413 # libtool variables, so we have to hard-code the OSs to which it
9414 # applies here; at the moment, that means platforms that use the PE
9415 # object format with DLL files. See the long comment at the top of
9416 # tests/bindir.at for full details.
9417 tdlname=$dlname
9418 case $host,$output,$installed,$module,$dlname in
9419 *cygwin*,*lai,yes,no,*.dll | *mingw*,*lai,yes,no,*.dll | *cegcc*,*lai,yes,no,*.dll)
9420 # If a -bindir argument was supplied, place the dll there.
9421 if test "x$bindir" != x ;
9422 then
9423 func_relative_path "$install_libdir" "$bindir"
9424 tdlname=$func_relative_path_result$dlname
9425 else
9426 # Otherwise fall back on heuristic.
9427 tdlname=../bin/$dlname
9430 esac
9431 $ECHO > $output "\
9432 # $outputname - a libtool library file
9433 # Generated by $PROGRAM (GNU $PACKAGE$TIMESTAMP) $VERSION
9435 # Please DO NOT delete this file!
9436 # It is necessary for linking the library.
9438 # The name that we can dlopen(3).
9439 dlname='$tdlname'
9441 # Names of this library.
9442 library_names='$library_names'
9444 # The name of the static archive.
9445 old_library='$old_library'
9447 # Linker flags that can not go in dependency_libs.
9448 inherited_linker_flags='$new_inherited_linker_flags'
9450 # Libraries that this one depends upon.
9451 dependency_libs='$dependency_libs'
9453 # Names of additional weak libraries provided by this library
9454 weak_library_names='$weak_libs'
9456 # Version information for $libname.
9457 current=$current
9458 age=$age
9459 revision=$revision
9461 # Is this an already installed library?
9462 installed=$installed
9464 # Should we warn about portability when linking against -modules?
9465 shouldnotlink=$module
9467 # Files to dlopen/dlpreopen
9468 dlopen='$dlfiles'
9469 dlpreopen='$dlprefiles'
9471 # Directory that this library needs to be installed in:
9472 libdir='$install_libdir'"
9473 if test "$installed" = no && test "$need_relink" = yes; then
9474 $ECHO >> $output "\
9475 relink_command=\"$relink_command\""
9477 done
9480 # Do a symbolic link so that the libtool archive can be found in
9481 # LD_LIBRARY_PATH before the program is installed.
9482 func_show_eval '( cd "$output_objdir" && $RM "$outputname" && $LN_S "../$outputname" "$outputname" )' 'exit $?'
9484 esac
9485 exit $EXIT_SUCCESS
9488 { test "$opt_mode" = link || test "$opt_mode" = relink; } &&
9489 func_mode_link ${1+"$@"}
9492 # func_mode_uninstall arg...
9493 func_mode_uninstall ()
9495 $opt_debug
9496 RM="$nonopt"
9497 files=
9498 rmforce=
9499 exit_status=0
9501 # This variable tells wrapper scripts just to set variables rather
9502 # than running their programs.
9503 libtool_install_magic="$magic"
9505 for arg
9507 case $arg in
9508 -f) func_append RM " $arg"; rmforce=yes ;;
9509 -*) func_append RM " $arg" ;;
9510 *) func_append files " $arg" ;;
9511 esac
9512 done
9514 test -z "$RM" && \
9515 func_fatal_help "you must specify an RM program"
9517 rmdirs=
9519 for file in $files; do
9520 func_dirname "$file" "" "."
9521 dir="$func_dirname_result"
9522 if test "X$dir" = X.; then
9523 odir="$objdir"
9524 else
9525 odir="$dir/$objdir"
9527 func_basename "$file"
9528 name="$func_basename_result"
9529 test "$opt_mode" = uninstall && odir="$dir"
9531 # Remember odir for removal later, being careful to avoid duplicates
9532 if test "$opt_mode" = clean; then
9533 case " $rmdirs " in
9534 *" $odir "*) ;;
9535 *) func_append rmdirs " $odir" ;;
9536 esac
9539 # Don't error if the file doesn't exist and rm -f was used.
9540 if { test -L "$file"; } >/dev/null 2>&1 ||
9541 { test -h "$file"; } >/dev/null 2>&1 ||
9542 test -f "$file"; then
9544 elif test -d "$file"; then
9545 exit_status=1
9546 continue
9547 elif test "$rmforce" = yes; then
9548 continue
9551 rmfiles="$file"
9553 case $name in
9554 *.la)
9555 # Possibly a libtool archive, so verify it.
9556 if func_lalib_p "$file"; then
9557 func_source $dir/$name
9559 # Delete the libtool libraries and symlinks.
9560 for n in $library_names; do
9561 func_append rmfiles " $odir/$n"
9562 done
9563 test -n "$old_library" && func_append rmfiles " $odir/$old_library"
9565 case "$opt_mode" in
9566 clean)
9567 case " $library_names " in
9568 *" $dlname "*) ;;
9569 *) test -n "$dlname" && func_append rmfiles " $odir/$dlname" ;;
9570 esac
9571 test -n "$libdir" && func_append rmfiles " $odir/$name $odir/${name}i"
9573 uninstall)
9574 if test -n "$library_names"; then
9575 # Do each command in the postuninstall commands.
9576 func_execute_cmds "$postuninstall_cmds" 'test "$rmforce" = yes || exit_status=1'
9579 if test -n "$old_library"; then
9580 # Do each command in the old_postuninstall commands.
9581 func_execute_cmds "$old_postuninstall_cmds" 'test "$rmforce" = yes || exit_status=1'
9583 # FIXME: should reinstall the best remaining shared library.
9585 esac
9589 *.lo)
9590 # Possibly a libtool object, so verify it.
9591 if func_lalib_p "$file"; then
9593 # Read the .lo file
9594 func_source $dir/$name
9596 # Add PIC object to the list of files to remove.
9597 if test -n "$pic_object" &&
9598 test "$pic_object" != none; then
9599 func_append rmfiles " $dir/$pic_object"
9602 # Add non-PIC object to the list of files to remove.
9603 if test -n "$non_pic_object" &&
9604 test "$non_pic_object" != none; then
9605 func_append rmfiles " $dir/$non_pic_object"
9611 if test "$opt_mode" = clean ; then
9612 noexename=$name
9613 case $file in
9614 *.exe)
9615 func_stripname '' '.exe' "$file"
9616 file=$func_stripname_result
9617 func_stripname '' '.exe' "$name"
9618 noexename=$func_stripname_result
9619 # $file with .exe has already been added to rmfiles,
9620 # add $file without .exe
9621 func_append rmfiles " $file"
9623 esac
9624 # Do a test to see if this is a libtool program.
9625 if func_ltwrapper_p "$file"; then
9626 if func_ltwrapper_executable_p "$file"; then
9627 func_ltwrapper_scriptname "$file"
9628 relink_command=
9629 func_source $func_ltwrapper_scriptname_result
9630 func_append rmfiles " $func_ltwrapper_scriptname_result"
9631 else
9632 relink_command=
9633 func_source $dir/$noexename
9636 # note $name still contains .exe if it was in $file originally
9637 # as does the version of $file that was added into $rmfiles
9638 func_append rmfiles " $odir/$name $odir/${name}S.${objext}"
9639 if test "$fast_install" = yes && test -n "$relink_command"; then
9640 func_append rmfiles " $odir/lt-$name"
9642 if test "X$noexename" != "X$name" ; then
9643 func_append rmfiles " $odir/lt-${noexename}.c"
9648 esac
9649 func_show_eval "$RM $rmfiles" 'exit_status=1'
9650 done
9652 # Try to remove the ${objdir}s in the directories where we deleted files
9653 for dir in $rmdirs; do
9654 if test -d "$dir"; then
9655 func_show_eval "rmdir $dir >/dev/null 2>&1"
9657 done
9659 exit $exit_status
9662 { test "$opt_mode" = uninstall || test "$opt_mode" = clean; } &&
9663 func_mode_uninstall ${1+"$@"}
9665 test -z "$opt_mode" && {
9666 help="$generic_help"
9667 func_fatal_help "you must specify a MODE"
9670 test -z "$exec_cmd" && \
9671 func_fatal_help "invalid operation mode \`$opt_mode'"
9673 if test -n "$exec_cmd"; then
9674 eval exec "$exec_cmd"
9675 exit $EXIT_FAILURE
9678 exit $exit_status
9681 # The TAGs below are defined such that we never get into a situation
9682 # in which we disable both kinds of libraries. Given conflicting
9683 # choices, we go for a static library, that is the most portable,
9684 # since we can't tell whether shared libraries were disabled because
9685 # the user asked for that or because the platform doesn't support
9686 # them. This is particularly important on AIX, because we don't
9687 # support having both static and shared libraries enabled at the same
9688 # time on that platform, so we default to a shared-only configuration.
9689 # If a disable-shared tag is given, we'll fallback to a static-only
9690 # configuration. But we'll never go from static-only to shared-only.
9692 # ### BEGIN LIBTOOL TAG CONFIG: disable-shared
9693 build_libtool_libs=no
9694 build_old_libs=yes
9695 # ### END LIBTOOL TAG CONFIG: disable-shared
9697 # ### BEGIN LIBTOOL TAG CONFIG: disable-static
9698 build_old_libs=`case $build_libtool_libs in yes) echo no;; *) echo yes;; esac`
9699 # ### END LIBTOOL TAG CONFIG: disable-static
9701 # Local Variables:
9702 # mode:shell-script
9703 # sh-indentation:2
9704 # End:
9705 # vi:sw=2