Merge Chromium + Blink git repositories
[chromium-blink-merge.git] / third_party / sqlite / sqlite-src-3080704 / ltmain.sh
blob0634c4bccce12e53a48e3ba015df80305b579618
1 # Generated from ltmain.m4sh.
3 # ltmain.sh (GNU libtool) 2.2.6
4 # Written by Gordon Matzigkeit <gord@gnu.ai.mit.edu>, 1996
6 # Copyright (C) 1996, 1997, 1998, 1999, 2000, 2001, 2003, 2004, 2005, 2006, 2007 2008 Free Software Foundation, Inc.
7 # This is free software; see the source for copying conditions. There is NO
8 # warranty; not even for MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
10 # GNU Libtool is free software; you can redistribute it and/or modify
11 # it under the terms of the GNU General Public License as published by
12 # the Free Software Foundation; either version 2 of the License, or
13 # (at your option) any later version.
15 # As a special exception to the GNU General Public License,
16 # if you distribute this file as part of a program or library that
17 # is built using GNU Libtool, you may include this file under the
18 # same distribution terms that you use for the rest of that program.
20 # GNU Libtool is distributed in the hope that it will be useful, but
21 # WITHOUT ANY WARRANTY; without even the implied warranty of
22 # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
23 # General Public License for more details.
25 # You should have received a copy of the GNU General Public License
26 # along with GNU Libtool; see the file COPYING. If not, a copy
27 # can be downloaded from http://www.gnu.org/licenses/gpl.html,
28 # or obtained by writing to the Free Software Foundation, Inc.,
29 # 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
31 # Usage: $progname [OPTION]... [MODE-ARG]...
33 # Provide generalized library-building support services.
35 # --config show all configuration variables
36 # --debug enable verbose shell tracing
37 # -n, --dry-run display commands without modifying any files
38 # --features display basic configuration information and exit
39 # --mode=MODE use operation mode MODE
40 # --preserve-dup-deps don't remove duplicate dependency libraries
41 # --quiet, --silent don't print informational messages
42 # --tag=TAG use configuration variables from tag TAG
43 # -v, --verbose print informational messages (default)
44 # --version print version information
45 # -h, --help print short or long help message
47 # MODE must be one of the following:
49 # clean remove files from the build directory
50 # compile compile a source file into a libtool object
51 # execute automatically set library path, then run a program
52 # finish complete the installation of libtool libraries
53 # install install libraries or executables
54 # link create a library or an executable
55 # uninstall remove libraries from an installed directory
57 # MODE-ARGS vary depending on the MODE.
58 # Try `$progname --help --mode=MODE' for a more detailed description of MODE.
60 # When reporting a bug, please describe a test case to reproduce it and
61 # include the following information:
63 # host-triplet: $host
64 # shell: $SHELL
65 # compiler: $LTCC
66 # compiler flags: $LTCFLAGS
67 # linker: $LD (gnu? $with_gnu_ld)
68 # $progname: (GNU libtool) 2.2.6
69 # automake: $automake_version
70 # autoconf: $autoconf_version
72 # Report bugs to <bug-libtool@gnu.org>.
74 PROGRAM=ltmain.sh
75 PACKAGE=libtool
76 VERSION=2.2.6
77 TIMESTAMP=""
78 package_revision=1.3012
80 # Be Bourne compatible
81 if test -n "${ZSH_VERSION+set}" && (emulate sh) >/dev/null 2>&1; then
82 emulate sh
83 NULLCMD=:
84 # Zsh 3.x and 4.x performs word splitting on ${1+"$@"}, which
85 # is contrary to our usage. Disable this feature.
86 alias -g '${1+"$@"}'='"$@"'
87 setopt NO_GLOB_SUBST
88 else
89 case `(set -o) 2>/dev/null` in *posix*) set -o posix;; esac
91 BIN_SH=xpg4; export BIN_SH # for Tru64
92 DUALCASE=1; export DUALCASE # for MKS sh
94 # NLS nuisances: We save the old values to restore during execute mode.
95 # Only set LANG and LC_ALL to C if already set.
96 # These must not be set unconditionally because not all systems understand
97 # e.g. LANG=C (notably SCO).
98 lt_user_locale=
99 lt_safe_locale=
100 for lt_var in LANG LANGUAGE LC_ALL LC_CTYPE LC_COLLATE LC_MESSAGES
102 eval "if test \"\${$lt_var+set}\" = set; then
103 save_$lt_var=\$$lt_var
104 $lt_var=C
105 export $lt_var
106 lt_user_locale=\"$lt_var=\\\$save_\$lt_var; \$lt_user_locale\"
107 lt_safe_locale=\"$lt_var=C; \$lt_safe_locale\"
109 done
111 $lt_unset CDPATH
117 : ${CP="cp -f"}
118 : ${ECHO="echo"}
119 : ${EGREP="/usr/bin/grep -E"}
120 : ${FGREP="/usr/bin/grep -F"}
121 : ${GREP="/usr/bin/grep"}
122 : ${LN_S="ln -s"}
123 : ${MAKE="make"}
124 : ${MKDIR="mkdir"}
125 : ${MV="mv -f"}
126 : ${RM="rm -f"}
127 : ${SED="/opt/local/bin/gsed"}
128 : ${SHELL="${CONFIG_SHELL-/bin/sh}"}
129 : ${Xsed="$SED -e 1s/^X//"}
131 # Global variables:
132 EXIT_SUCCESS=0
133 EXIT_FAILURE=1
134 EXIT_MISMATCH=63 # $? = 63 is used to indicate version mismatch to missing.
135 EXIT_SKIP=77 # $? = 77 is used to indicate a skipped test to automake.
137 exit_status=$EXIT_SUCCESS
139 # Make sure IFS has a sensible default
140 lt_nl='
142 IFS=" $lt_nl"
144 dirname="s,/[^/]*$,,"
145 basename="s,^.*/,,"
147 # func_dirname_and_basename file append nondir_replacement
148 # perform func_basename and func_dirname in a single function
149 # call:
150 # dirname: Compute the dirname of FILE. If nonempty,
151 # add APPEND to the result, otherwise set result
152 # to NONDIR_REPLACEMENT.
153 # value returned in "$func_dirname_result"
154 # basename: Compute filename of FILE.
155 # value retuned in "$func_basename_result"
156 # Implementation must be kept synchronized with func_dirname
157 # and func_basename. For efficiency, we do not delegate to
158 # those functions but instead duplicate the functionality here.
159 func_dirname_and_basename ()
161 # Extract subdirectory from the argument.
162 func_dirname_result=`$ECHO "X${1}" | $Xsed -e "$dirname"`
163 if test "X$func_dirname_result" = "X${1}"; then
164 func_dirname_result="${3}"
165 else
166 func_dirname_result="$func_dirname_result${2}"
168 func_basename_result=`$ECHO "X${1}" | $Xsed -e "$basename"`
171 # Generated shell functions inserted here.
173 # Work around backward compatibility issue on IRIX 6.5. On IRIX 6.4+, sh
174 # is ksh but when the shell is invoked as "sh" and the current value of
175 # the _XPG environment variable is not equal to 1 (one), the special
176 # positional parameter $0, within a function call, is the name of the
177 # function.
178 progpath="$0"
180 # The name of this program:
181 # In the unlikely event $progname began with a '-', it would play havoc with
182 # func_echo (imagine progname=-n), so we prepend ./ in that case:
183 func_dirname_and_basename "$progpath"
184 progname=$func_basename_result
185 case $progname in
186 -*) progname=./$progname ;;
187 esac
189 # Make sure we have an absolute path for reexecution:
190 case $progpath in
191 [\\/]*|[A-Za-z]:\\*) ;;
192 *[\\/]*)
193 progdir=$func_dirname_result
194 progdir=`cd "$progdir" && pwd`
195 progpath="$progdir/$progname"
198 save_IFS="$IFS"
199 IFS=:
200 for progdir in $PATH; do
201 IFS="$save_IFS"
202 test -x "$progdir/$progname" && break
203 done
204 IFS="$save_IFS"
205 test -n "$progdir" || progdir=`pwd`
206 progpath="$progdir/$progname"
208 esac
210 # Sed substitution that helps us do robust quoting. It backslashifies
211 # metacharacters that are still active within double-quoted strings.
212 Xsed="${SED}"' -e 1s/^X//'
213 sed_quote_subst='s/\([`"$\\]\)/\\\1/g'
215 # Same as above, but do not quote variable references.
216 double_quote_subst='s/\(["`\\]\)/\\\1/g'
218 # Re-`\' parameter expansions in output of double_quote_subst that were
219 # `\'-ed in input to the same. If an odd number of `\' preceded a '$'
220 # in input to double_quote_subst, that '$' was protected from expansion.
221 # Since each input `\' is now two `\'s, look for any number of runs of
222 # four `\'s followed by two `\'s and then a '$'. `\' that '$'.
223 bs='\\'
224 bs2='\\\\'
225 bs4='\\\\\\\\'
226 dollar='\$'
227 sed_double_backslash="\
228 s/$bs4/&\\
230 s/^$bs2$dollar/$bs&/
231 s/\\([^$bs]\\)$bs2$dollar/\\1$bs2$bs$dollar/g
232 s/\n//g"
234 # Standard options:
235 opt_dry_run=false
236 opt_help=false
237 opt_quiet=false
238 opt_verbose=false
239 opt_warning=:
241 # func_echo arg...
242 # Echo program name prefixed message, along with the current mode
243 # name if it has been set yet.
244 func_echo ()
246 $ECHO "$progname${mode+: }$mode: $*"
249 # func_verbose arg...
250 # Echo program name prefixed message in verbose mode only.
251 func_verbose ()
253 $opt_verbose && func_echo ${1+"$@"}
255 # A bug in bash halts the script if the last line of a function
256 # fails when set -e is in force, so we need another command to
257 # work around that:
261 # func_error arg...
262 # Echo program name prefixed message to standard error.
263 func_error ()
265 $ECHO "$progname${mode+: }$mode: "${1+"$@"} 1>&2
268 # func_warning arg...
269 # Echo program name prefixed warning message to standard error.
270 func_warning ()
272 $opt_warning && $ECHO "$progname${mode+: }$mode: warning: "${1+"$@"} 1>&2
274 # bash bug again:
278 # func_fatal_error arg...
279 # Echo program name prefixed message to standard error, and exit.
280 func_fatal_error ()
282 func_error ${1+"$@"}
283 exit $EXIT_FAILURE
286 # func_fatal_help arg...
287 # Echo program name prefixed message to standard error, followed by
288 # a help hint, and exit.
289 func_fatal_help ()
291 func_error ${1+"$@"}
292 func_fatal_error "$help"
294 help="Try \`$progname --help' for more information." ## default
297 # func_grep expression filename
298 # Check whether EXPRESSION matches any line of FILENAME, without output.
299 func_grep ()
301 $GREP "$1" "$2" >/dev/null 2>&1
305 # func_mkdir_p directory-path
306 # Make sure the entire path to DIRECTORY-PATH is available.
307 func_mkdir_p ()
309 my_directory_path="$1"
310 my_dir_list=
312 if test -n "$my_directory_path" && test "$opt_dry_run" != ":"; then
314 # Protect directory names starting with `-'
315 case $my_directory_path in
316 -*) my_directory_path="./$my_directory_path" ;;
317 esac
319 # While some portion of DIR does not yet exist...
320 while test ! -d "$my_directory_path"; do
321 # ...make a list in topmost first order. Use a colon delimited
322 # list incase some portion of path contains whitespace.
323 my_dir_list="$my_directory_path:$my_dir_list"
325 # If the last portion added has no slash in it, the list is done
326 case $my_directory_path in */*) ;; *) break ;; esac
328 # ...otherwise throw away the child directory and loop
329 my_directory_path=`$ECHO "X$my_directory_path" | $Xsed -e "$dirname"`
330 done
331 my_dir_list=`$ECHO "X$my_dir_list" | $Xsed -e 's,:*$,,'`
333 save_mkdir_p_IFS="$IFS"; IFS=':'
334 for my_dir in $my_dir_list; do
335 IFS="$save_mkdir_p_IFS"
336 # mkdir can fail with a `File exist' error if two processes
337 # try to create one of the directories concurrently. Don't
338 # stop in that case!
339 $MKDIR "$my_dir" 2>/dev/null || :
340 done
341 IFS="$save_mkdir_p_IFS"
343 # Bail out if we (or some other process) failed to create a directory.
344 test -d "$my_directory_path" || \
345 func_fatal_error "Failed to create \`$1'"
350 # func_mktempdir [string]
351 # Make a temporary directory that won't clash with other running
352 # libtool processes, and avoids race conditions if possible. If
353 # given, STRING is the basename for that directory.
354 func_mktempdir ()
356 my_template="${TMPDIR-/tmp}/${1-$progname}"
358 if test "$opt_dry_run" = ":"; then
359 # Return a directory name, but don't create it in dry-run mode
360 my_tmpdir="${my_template}-$$"
361 else
363 # If mktemp works, use that first and foremost
364 my_tmpdir=`mktemp -d "${my_template}-XXXXXXXX" 2>/dev/null`
366 if test ! -d "$my_tmpdir"; then
367 # Failing that, at least try and use $RANDOM to avoid a race
368 my_tmpdir="${my_template}-${RANDOM-0}$$"
370 save_mktempdir_umask=`umask`
371 umask 0077
372 $MKDIR "$my_tmpdir"
373 umask $save_mktempdir_umask
376 # If we're not in dry-run mode, bomb out on failure
377 test -d "$my_tmpdir" || \
378 func_fatal_error "cannot create temporary directory \`$my_tmpdir'"
381 $ECHO "X$my_tmpdir" | $Xsed
385 # func_quote_for_eval arg
386 # Aesthetically quote ARG to be evaled later.
387 # This function returns two values: FUNC_QUOTE_FOR_EVAL_RESULT
388 # is double-quoted, suitable for a subsequent eval, whereas
389 # FUNC_QUOTE_FOR_EVAL_UNQUOTED_RESULT has merely all characters
390 # which are still active within double quotes backslashified.
391 func_quote_for_eval ()
393 case $1 in
394 *[\\\`\"\$]*)
395 func_quote_for_eval_unquoted_result=`$ECHO "X$1" | $Xsed -e "$sed_quote_subst"` ;;
397 func_quote_for_eval_unquoted_result="$1" ;;
398 esac
400 case $func_quote_for_eval_unquoted_result in
401 # Double-quote args containing shell metacharacters to delay
402 # word splitting, command substitution and and variable
403 # expansion for a subsequent eval.
404 # Many Bourne shells cannot handle close brackets correctly
405 # in scan sets, so we specify it separately.
406 *[\[\~\#\^\&\*\(\)\{\}\|\;\<\>\?\'\ \ ]*|*]*|"")
407 func_quote_for_eval_result="\"$func_quote_for_eval_unquoted_result\""
410 func_quote_for_eval_result="$func_quote_for_eval_unquoted_result"
411 esac
415 # func_quote_for_expand arg
416 # Aesthetically quote ARG to be evaled later; same as above,
417 # but do not quote variable references.
418 func_quote_for_expand ()
420 case $1 in
421 *[\\\`\"]*)
422 my_arg=`$ECHO "X$1" | $Xsed \
423 -e "$double_quote_subst" -e "$sed_double_backslash"` ;;
425 my_arg="$1" ;;
426 esac
428 case $my_arg in
429 # Double-quote args containing shell metacharacters to delay
430 # word splitting and command substitution for a subsequent eval.
431 # Many Bourne shells cannot handle close brackets correctly
432 # in scan sets, so we specify it separately.
433 *[\[\~\#\^\&\*\(\)\{\}\|\;\<\>\?\'\ \ ]*|*]*|"")
434 my_arg="\"$my_arg\""
436 esac
438 func_quote_for_expand_result="$my_arg"
442 # func_show_eval cmd [fail_exp]
443 # Unless opt_silent is true, then output CMD. Then, if opt_dryrun is
444 # not true, evaluate CMD. If the evaluation of CMD fails, and FAIL_EXP
445 # is given, then evaluate it.
446 func_show_eval ()
448 my_cmd="$1"
449 my_fail_exp="${2-:}"
451 ${opt_silent-false} || {
452 func_quote_for_expand "$my_cmd"
453 eval "func_echo $func_quote_for_expand_result"
456 if ${opt_dry_run-false}; then :; else
457 eval "$my_cmd"
458 my_status=$?
459 if test "$my_status" -eq 0; then :; else
460 eval "(exit $my_status); $my_fail_exp"
466 # func_show_eval_locale cmd [fail_exp]
467 # Unless opt_silent is true, then output CMD. Then, if opt_dryrun is
468 # not true, evaluate CMD. If the evaluation of CMD fails, and FAIL_EXP
469 # is given, then evaluate it. Use the saved locale for evaluation.
470 func_show_eval_locale ()
472 my_cmd="$1"
473 my_fail_exp="${2-:}"
475 ${opt_silent-false} || {
476 func_quote_for_expand "$my_cmd"
477 eval "func_echo $func_quote_for_expand_result"
480 if ${opt_dry_run-false}; then :; else
481 eval "$lt_user_locale
482 $my_cmd"
483 my_status=$?
484 eval "$lt_safe_locale"
485 if test "$my_status" -eq 0; then :; else
486 eval "(exit $my_status); $my_fail_exp"
495 # func_version
496 # Echo version message to standard output and exit.
497 func_version ()
499 $SED -n '/^# '$PROGRAM' (GNU /,/# warranty; / {
500 s/^# //
501 s/^# *$//
502 s/\((C)\)[ 0-9,-]*\( [1-9][0-9]*\)/\1\2/
504 }' < "$progpath"
505 exit $?
508 # func_usage
509 # Echo short help message to standard output and exit.
510 func_usage ()
512 $SED -n '/^# Usage:/,/# -h/ {
513 s/^# //
514 s/^# *$//
515 s/\$progname/'$progname'/
517 }' < "$progpath"
518 $ECHO
519 $ECHO "run \`$progname --help | more' for full usage"
520 exit $?
523 # func_help
524 # Echo long help message to standard output and exit.
525 func_help ()
527 $SED -n '/^# Usage:/,/# Report bugs to/ {
528 s/^# //
529 s/^# *$//
530 s*\$progname*'$progname'*
531 s*\$host*'"$host"'*
532 s*\$SHELL*'"$SHELL"'*
533 s*\$LTCC*'"$LTCC"'*
534 s*\$LTCFLAGS*'"$LTCFLAGS"'*
535 s*\$LD*'"$LD"'*
536 s/\$with_gnu_ld/'"$with_gnu_ld"'/
537 s/\$automake_version/'"`(automake --version) 2>/dev/null |$SED 1q`"'/
538 s/\$autoconf_version/'"`(autoconf --version) 2>/dev/null |$SED 1q`"'/
540 }' < "$progpath"
541 exit $?
544 # func_missing_arg argname
545 # Echo program name prefixed message to standard error and set global
546 # exit_cmd.
547 func_missing_arg ()
549 func_error "missing argument for $1"
550 exit_cmd=exit
553 exit_cmd=:
559 # Check that we have a working $ECHO.
560 if test "X$1" = X--no-reexec; then
561 # Discard the --no-reexec flag, and continue.
562 shift
563 elif test "X$1" = X--fallback-echo; then
564 # Avoid inline document here, it may be left over
566 elif test "X`{ $ECHO '\t'; } 2>/dev/null`" = 'X\t'; then
567 # Yippee, $ECHO works!
569 else
570 # Restart under the correct shell, and then maybe $ECHO will work.
571 exec $SHELL "$progpath" --no-reexec ${1+"$@"}
573 # Same for EGREP, and just to be sure, do LTCC as well
574 if test "x$EGREP" = x ; then
575 EGREP=egrep
577 if test "x$LTCC" = x ; then
578 LTCC=${CC-gcc}
581 if test "X$1" = X--fallback-echo; then
582 # used as fallback echo
583 shift
584 cat <<EOF
587 exit $EXIT_SUCCESS
590 magic="%%%MAGIC variable%%%"
591 magic_exe="%%%MAGIC EXE variable%%%"
593 # Global variables.
594 # $mode is unset
595 nonopt=
596 execute_dlfiles=
597 preserve_args=
598 lo2o="s/\\.lo\$/.${objext}/"
599 o2lo="s/\\.${objext}\$/.lo/"
600 extracted_archives=
601 extracted_serial=0
603 opt_dry_run=false
604 opt_duplicate_deps=false
605 opt_silent=false
606 opt_debug=:
608 # If this variable is set in any of the actions, the command in it
609 # will be execed at the end. This prevents here-documents from being
610 # left over by shells.
611 exec_cmd=
613 # func_fatal_configuration arg...
614 # Echo program name prefixed message to standard error, followed by
615 # a configuration failure hint, and exit.
616 func_fatal_configuration ()
618 func_error ${1+"$@"}
619 func_error "See the $PACKAGE documentation for more information."
620 func_fatal_error "Fatal configuration error."
624 # func_config
625 # Display the configuration for all the tags in this script.
626 func_config ()
628 re_begincf='^# ### BEGIN LIBTOOL'
629 re_endcf='^# ### END LIBTOOL'
631 # Default configuration.
632 $SED "1,/$re_begincf CONFIG/d;/$re_endcf CONFIG/,\$d" < "$progpath"
634 # Now print the configurations for the tags.
635 for tagname in $taglist; do
636 $SED -n "/$re_begincf TAG CONFIG: $tagname\$/,/$re_endcf TAG CONFIG: $tagname\$/p" < "$progpath"
637 done
639 exit $?
642 # func_features
643 # Display the features supported by this script.
644 func_features ()
646 $ECHO "host: $host"
647 if test "$build_libtool_libs" = yes; then
648 $ECHO "enable shared libraries"
649 else
650 $ECHO "disable shared libraries"
652 if test "$build_old_libs" = yes; then
653 $ECHO "enable static libraries"
654 else
655 $ECHO "disable static libraries"
658 exit $?
661 # func_enable_tag tagname
662 # Verify that TAGNAME is valid, and either flag an error and exit, or
663 # enable the TAGNAME tag. We also add TAGNAME to the global $taglist
664 # variable here.
665 func_enable_tag ()
667 # Global variable:
668 tagname="$1"
670 re_begincf="^# ### BEGIN LIBTOOL TAG CONFIG: $tagname\$"
671 re_endcf="^# ### END LIBTOOL TAG CONFIG: $tagname\$"
672 sed_extractcf="/$re_begincf/,/$re_endcf/p"
674 # Validate tagname.
675 case $tagname in
676 *[!-_A-Za-z0-9,/]*)
677 func_fatal_error "invalid tag name: $tagname"
679 esac
681 # Don't test for the "default" C tag, as we know it's
682 # there but not specially marked.
683 case $tagname in
684 CC) ;;
686 if $GREP "$re_begincf" "$progpath" >/dev/null 2>&1; then
687 taglist="$taglist $tagname"
689 # Evaluate the configuration. Be careful to quote the path
690 # and the sed script, to avoid splitting on whitespace, but
691 # also don't use non-portable quotes within backquotes within
692 # quotes we have to do it in 2 steps:
693 extractedcf=`$SED -n -e "$sed_extractcf" < "$progpath"`
694 eval "$extractedcf"
695 else
696 func_error "ignoring unknown tag $tagname"
699 esac
702 # Parse options once, thoroughly. This comes as soon as possible in
703 # the script to make things like `libtool --version' happen quickly.
706 # Shorthand for --mode=foo, only valid as the first argument
707 case $1 in
708 clean|clea|cle|cl)
709 shift; set dummy --mode clean ${1+"$@"}; shift
711 compile|compil|compi|comp|com|co|c)
712 shift; set dummy --mode compile ${1+"$@"}; shift
714 execute|execut|execu|exec|exe|ex|e)
715 shift; set dummy --mode execute ${1+"$@"}; shift
717 finish|finis|fini|fin|fi|f)
718 shift; set dummy --mode finish ${1+"$@"}; shift
720 install|instal|insta|inst|ins|in|i)
721 shift; set dummy --mode install ${1+"$@"}; shift
723 link|lin|li|l)
724 shift; set dummy --mode link ${1+"$@"}; shift
726 uninstall|uninstal|uninsta|uninst|unins|unin|uni|un|u)
727 shift; set dummy --mode uninstall ${1+"$@"}; shift
729 esac
731 # Parse non-mode specific arguments:
732 while test "$#" -gt 0; do
733 opt="$1"
734 shift
736 case $opt in
737 --config) func_config ;;
739 --debug) preserve_args="$preserve_args $opt"
740 func_echo "enabling shell trace mode"
741 opt_debug='set -x'
742 $opt_debug
745 -dlopen) test "$#" -eq 0 && func_missing_arg "$opt" && break
746 execute_dlfiles="$execute_dlfiles $1"
747 shift
750 --dry-run | -n) opt_dry_run=: ;;
751 --features) func_features ;;
752 --finish) mode="finish" ;;
754 --mode) test "$#" -eq 0 && func_missing_arg "$opt" && break
755 case $1 in
756 # Valid mode arguments:
757 clean) ;;
758 compile) ;;
759 execute) ;;
760 finish) ;;
761 install) ;;
762 link) ;;
763 relink) ;;
764 uninstall) ;;
766 # Catch anything else as an error
767 *) func_error "invalid argument for $opt"
768 exit_cmd=exit
769 break
771 esac
773 mode="$1"
774 shift
777 --preserve-dup-deps)
778 opt_duplicate_deps=: ;;
780 --quiet|--silent) preserve_args="$preserve_args $opt"
781 opt_silent=:
784 --verbose| -v) preserve_args="$preserve_args $opt"
785 opt_silent=false
788 --tag) test "$#" -eq 0 && func_missing_arg "$opt" && break
789 preserve_args="$preserve_args $opt $1"
790 func_enable_tag "$1" # tagname is set here
791 shift
794 # Separate optargs to long options:
795 -dlopen=*|--mode=*|--tag=*)
796 func_opt_split "$opt"
797 set dummy "$func_opt_split_opt" "$func_opt_split_arg" ${1+"$@"}
798 shift
801 -\?|-h) func_usage ;;
802 --help) opt_help=: ;;
803 --version) func_version ;;
805 -*) func_fatal_help "unrecognized option \`$opt'" ;;
807 *) nonopt="$opt"
808 break
810 esac
811 done
814 case $host in
815 *cygwin* | *mingw* | *pw32* | *cegcc*)
816 # don't eliminate duplications in $postdeps and $predeps
817 opt_duplicate_compiler_generated_deps=:
820 opt_duplicate_compiler_generated_deps=$opt_duplicate_deps
822 esac
824 # Having warned about all mis-specified options, bail out if
825 # anything was wrong.
826 $exit_cmd $EXIT_FAILURE
829 # func_check_version_match
830 # Ensure that we are using m4 macros, and libtool script from the same
831 # release of libtool.
832 func_check_version_match ()
834 if test "$package_revision" != "$macro_revision"; then
835 if test "$VERSION" != "$macro_version"; then
836 if test -z "$macro_version"; then
837 cat >&2 <<_LT_EOF
838 $progname: Version mismatch error. This is $PACKAGE $VERSION, but the
839 $progname: definition of this LT_INIT comes from an older release.
840 $progname: You should recreate aclocal.m4 with macros from $PACKAGE $VERSION
841 $progname: and run autoconf again.
842 _LT_EOF
843 else
844 cat >&2 <<_LT_EOF
845 $progname: Version mismatch error. This is $PACKAGE $VERSION, but the
846 $progname: definition of this LT_INIT comes from $PACKAGE $macro_version.
847 $progname: You should recreate aclocal.m4 with macros from $PACKAGE $VERSION
848 $progname: and run autoconf again.
849 _LT_EOF
851 else
852 cat >&2 <<_LT_EOF
853 $progname: Version mismatch error. This is $PACKAGE $VERSION, revision $package_revision,
854 $progname: but the definition of this LT_INIT comes from revision $macro_revision.
855 $progname: You should recreate aclocal.m4 with macros from revision $package_revision
856 $progname: of $PACKAGE $VERSION and run autoconf again.
857 _LT_EOF
860 exit $EXIT_MISMATCH
865 ## ----------- ##
866 ## Main. ##
867 ## ----------- ##
869 $opt_help || {
870 # Sanity checks first:
871 func_check_version_match
873 if test "$build_libtool_libs" != yes && test "$build_old_libs" != yes; then
874 func_fatal_configuration "not configured to build any kind of library"
877 test -z "$mode" && func_fatal_error "error: you must specify a MODE."
880 # Darwin sucks
881 eval std_shrext=\"$shrext_cmds\"
884 # Only execute mode is allowed to have -dlopen flags.
885 if test -n "$execute_dlfiles" && test "$mode" != execute; then
886 func_error "unrecognized option \`-dlopen'"
887 $ECHO "$help" 1>&2
888 exit $EXIT_FAILURE
891 # Change the help message to a mode-specific one.
892 generic_help="$help"
893 help="Try \`$progname --help --mode=$mode' for more information."
897 # func_lalib_p file
898 # True iff FILE is a libtool `.la' library or `.lo' object file.
899 # This function is only a basic sanity check; it will hardly flush out
900 # determined imposters.
901 func_lalib_p ()
903 test -f "$1" &&
904 $SED -e 4q "$1" 2>/dev/null \
905 | $GREP "^# Generated by .*$PACKAGE" > /dev/null 2>&1
908 # func_lalib_unsafe_p file
909 # True iff FILE is a libtool `.la' library or `.lo' object file.
910 # This function implements the same check as func_lalib_p without
911 # resorting to external programs. To this end, it redirects stdin and
912 # closes it afterwards, without saving the original file descriptor.
913 # As a safety measure, use it only where a negative result would be
914 # fatal anyway. Works if `file' does not exist.
915 func_lalib_unsafe_p ()
917 lalib_p=no
918 if test -f "$1" && test -r "$1" && exec 5<&0 <"$1"; then
919 for lalib_p_l in 1 2 3 4
921 read lalib_p_line
922 case "$lalib_p_line" in
923 \#\ Generated\ by\ *$PACKAGE* ) lalib_p=yes; break;;
924 esac
925 done
926 exec 0<&5 5<&-
928 test "$lalib_p" = yes
931 # func_ltwrapper_script_p file
932 # True iff FILE is a libtool wrapper script
933 # This function is only a basic sanity check; it will hardly flush out
934 # determined imposters.
935 func_ltwrapper_script_p ()
937 func_lalib_p "$1"
940 # func_ltwrapper_executable_p file
941 # True iff FILE is a libtool wrapper executable
942 # This function is only a basic sanity check; it will hardly flush out
943 # determined imposters.
944 func_ltwrapper_executable_p ()
946 func_ltwrapper_exec_suffix=
947 case $1 in
948 *.exe) ;;
949 *) func_ltwrapper_exec_suffix=.exe ;;
950 esac
951 $GREP "$magic_exe" "$1$func_ltwrapper_exec_suffix" >/dev/null 2>&1
954 # func_ltwrapper_scriptname file
955 # Assumes file is an ltwrapper_executable
956 # uses $file to determine the appropriate filename for a
957 # temporary ltwrapper_script.
958 func_ltwrapper_scriptname ()
960 func_ltwrapper_scriptname_result=""
961 if func_ltwrapper_executable_p "$1"; then
962 func_dirname_and_basename "$1" "" "."
963 func_stripname '' '.exe' "$func_basename_result"
964 func_ltwrapper_scriptname_result="$func_dirname_result/$objdir/${func_stripname_result}_ltshwrapper"
968 # func_ltwrapper_p file
969 # True iff FILE is a libtool wrapper script or wrapper executable
970 # This function is only a basic sanity check; it will hardly flush out
971 # determined imposters.
972 func_ltwrapper_p ()
974 func_ltwrapper_script_p "$1" || func_ltwrapper_executable_p "$1"
978 # func_execute_cmds commands fail_cmd
979 # Execute tilde-delimited COMMANDS.
980 # If FAIL_CMD is given, eval that upon failure.
981 # FAIL_CMD may read-access the current command in variable CMD!
982 func_execute_cmds ()
984 $opt_debug
985 save_ifs=$IFS; IFS='~'
986 for cmd in $1; do
987 IFS=$save_ifs
988 eval cmd=\"$cmd\"
989 func_show_eval "$cmd" "${2-:}"
990 done
991 IFS=$save_ifs
995 # func_source file
996 # Source FILE, adding directory component if necessary.
997 # Note that it is not necessary on cygwin/mingw to append a dot to
998 # FILE even if both FILE and FILE.exe exist: automatic-append-.exe
999 # behavior happens only for exec(3), not for open(2)! Also, sourcing
1000 # `FILE.' does not work on cygwin managed mounts.
1001 func_source ()
1003 $opt_debug
1004 case $1 in
1005 */* | *\\*) . "$1" ;;
1006 *) . "./$1" ;;
1007 esac
1011 # func_infer_tag arg
1012 # Infer tagged configuration to use if any are available and
1013 # if one wasn't chosen via the "--tag" command line option.
1014 # Only attempt this if the compiler in the base compile
1015 # command doesn't match the default compiler.
1016 # arg is usually of the form 'gcc ...'
1017 func_infer_tag ()
1019 $opt_debug
1020 if test -n "$available_tags" && test -z "$tagname"; then
1021 CC_quoted=
1022 for arg in $CC; do
1023 func_quote_for_eval "$arg"
1024 CC_quoted="$CC_quoted $func_quote_for_eval_result"
1025 done
1026 case $@ in
1027 # Blanks in the command may have been stripped by the calling shell,
1028 # but not from the CC environment variable when configure was run.
1029 " $CC "* | "$CC "* | " `$ECHO $CC` "* | "`$ECHO $CC` "* | " $CC_quoted"* | "$CC_quoted "* | " `$ECHO $CC_quoted` "* | "`$ECHO $CC_quoted` "*) ;;
1030 # Blanks at the start of $base_compile will cause this to fail
1031 # if we don't check for them as well.
1033 for z in $available_tags; do
1034 if $GREP "^# ### BEGIN LIBTOOL TAG CONFIG: $z$" < "$progpath" > /dev/null; then
1035 # Evaluate the configuration.
1036 eval "`${SED} -n -e '/^# ### BEGIN LIBTOOL TAG CONFIG: '$z'$/,/^# ### END LIBTOOL TAG CONFIG: '$z'$/p' < $progpath`"
1037 CC_quoted=
1038 for arg in $CC; do
1039 # Double-quote args containing other shell metacharacters.
1040 func_quote_for_eval "$arg"
1041 CC_quoted="$CC_quoted $func_quote_for_eval_result"
1042 done
1043 case "$@ " in
1044 " $CC "* | "$CC "* | " `$ECHO $CC` "* | "`$ECHO $CC` "* | " $CC_quoted"* | "$CC_quoted "* | " `$ECHO $CC_quoted` "* | "`$ECHO $CC_quoted` "*)
1045 # The compiler in the base compile command matches
1046 # the one in the tagged configuration.
1047 # Assume this is the tagged configuration we want.
1048 tagname=$z
1049 break
1051 esac
1053 done
1054 # If $tagname still isn't set, then no tagged configuration
1055 # was found and let the user know that the "--tag" command
1056 # line option must be used.
1057 if test -z "$tagname"; then
1058 func_echo "unable to infer tagged configuration"
1059 func_fatal_error "specify a tag with \`--tag'"
1060 # else
1061 # func_verbose "using $tagname tagged configuration"
1064 esac
1070 # func_write_libtool_object output_name pic_name nonpic_name
1071 # Create a libtool object file (analogous to a ".la" file),
1072 # but don't create it if we're doing a dry run.
1073 func_write_libtool_object ()
1075 write_libobj=${1}
1076 if test "$build_libtool_libs" = yes; then
1077 write_lobj=\'${2}\'
1078 else
1079 write_lobj=none
1082 if test "$build_old_libs" = yes; then
1083 write_oldobj=\'${3}\'
1084 else
1085 write_oldobj=none
1088 $opt_dry_run || {
1089 cat >${write_libobj}T <<EOF
1090 # $write_libobj - a libtool object file
1091 # Generated by $PROGRAM (GNU $PACKAGE$TIMESTAMP) $VERSION
1093 # Please DO NOT delete this file!
1094 # It is necessary for linking the library.
1096 # Name of the PIC object.
1097 pic_object=$write_lobj
1099 # Name of the non-PIC object
1100 non_pic_object=$write_oldobj
1103 $MV "${write_libobj}T" "${write_libobj}"
1107 # func_mode_compile arg...
1108 func_mode_compile ()
1110 $opt_debug
1111 # Get the compilation command and the source file.
1112 base_compile=
1113 srcfile="$nonopt" # always keep a non-empty value in "srcfile"
1114 suppress_opt=yes
1115 suppress_output=
1116 arg_mode=normal
1117 libobj=
1118 later=
1119 pie_flag=
1121 for arg
1123 case $arg_mode in
1124 arg )
1125 # do not "continue". Instead, add this to base_compile
1126 lastarg="$arg"
1127 arg_mode=normal
1130 target )
1131 libobj="$arg"
1132 arg_mode=normal
1133 continue
1136 normal )
1137 # Accept any command-line options.
1138 case $arg in
1140 test -n "$libobj" && \
1141 func_fatal_error "you cannot specify \`-o' more than once"
1142 arg_mode=target
1143 continue
1146 -pie | -fpie | -fPIE)
1147 pie_flag="$pie_flag $arg"
1148 continue
1151 -shared | -static | -prefer-pic | -prefer-non-pic)
1152 later="$later $arg"
1153 continue
1156 -no-suppress)
1157 suppress_opt=no
1158 continue
1161 -Xcompiler)
1162 arg_mode=arg # the next one goes into the "base_compile" arg list
1163 continue # The current "srcfile" will either be retained or
1164 ;; # replaced later. I would guess that would be a bug.
1166 -Wc,*)
1167 func_stripname '-Wc,' '' "$arg"
1168 args=$func_stripname_result
1169 lastarg=
1170 save_ifs="$IFS"; IFS=','
1171 for arg in $args; do
1172 IFS="$save_ifs"
1173 func_quote_for_eval "$arg"
1174 lastarg="$lastarg $func_quote_for_eval_result"
1175 done
1176 IFS="$save_ifs"
1177 func_stripname ' ' '' "$lastarg"
1178 lastarg=$func_stripname_result
1180 # Add the arguments to base_compile.
1181 base_compile="$base_compile $lastarg"
1182 continue
1186 # Accept the current argument as the source file.
1187 # The previous "srcfile" becomes the current argument.
1189 lastarg="$srcfile"
1190 srcfile="$arg"
1192 esac # case $arg
1194 esac # case $arg_mode
1196 # Aesthetically quote the previous argument.
1197 func_quote_for_eval "$lastarg"
1198 base_compile="$base_compile $func_quote_for_eval_result"
1199 done # for arg
1201 case $arg_mode in
1202 arg)
1203 func_fatal_error "you must specify an argument for -Xcompile"
1205 target)
1206 func_fatal_error "you must specify a target with \`-o'"
1209 # Get the name of the library object.
1210 test -z "$libobj" && {
1211 func_basename "$srcfile"
1212 libobj="$func_basename_result"
1215 esac
1217 # Recognize several different file suffixes.
1218 # If the user specifies -o file.o, it is replaced with file.lo
1219 case $libobj in
1220 *.[cCFSifmso] | \
1221 *.ada | *.adb | *.ads | *.asm | \
1222 *.c++ | *.cc | *.ii | *.class | *.cpp | *.cxx | \
1223 *.[fF][09]? | *.for | *.java | *.obj | *.sx)
1224 func_xform "$libobj"
1225 libobj=$func_xform_result
1227 esac
1229 case $libobj in
1230 *.lo) func_lo2o "$libobj"; obj=$func_lo2o_result ;;
1232 func_fatal_error "cannot determine name of library object from \`$libobj'"
1234 esac
1236 func_infer_tag $base_compile
1238 for arg in $later; do
1239 case $arg in
1240 -shared)
1241 test "$build_libtool_libs" != yes && \
1242 func_fatal_configuration "can not build a shared library"
1243 build_old_libs=no
1244 continue
1247 -static)
1248 build_libtool_libs=no
1249 build_old_libs=yes
1250 continue
1253 -prefer-pic)
1254 pic_mode=yes
1255 continue
1258 -prefer-non-pic)
1259 pic_mode=no
1260 continue
1262 esac
1263 done
1265 func_quote_for_eval "$libobj"
1266 test "X$libobj" != "X$func_quote_for_eval_result" \
1267 && $ECHO "X$libobj" | $GREP '[]~#^*{};<>?"'"'"' &()|`$[]' \
1268 && func_warning "libobj name \`$libobj' may not contain shell special characters."
1269 func_dirname_and_basename "$obj" "/" ""
1270 objname="$func_basename_result"
1271 xdir="$func_dirname_result"
1272 lobj=${xdir}$objdir/$objname
1274 test -z "$base_compile" && \
1275 func_fatal_help "you must specify a compilation command"
1277 # Delete any leftover library objects.
1278 if test "$build_old_libs" = yes; then
1279 removelist="$obj $lobj $libobj ${libobj}T"
1280 else
1281 removelist="$lobj $libobj ${libobj}T"
1284 # On Cygwin there's no "real" PIC flag so we must build both object types
1285 case $host_os in
1286 cygwin* | mingw* | pw32* | os2* | cegcc*)
1287 pic_mode=default
1289 esac
1290 if test "$pic_mode" = no && test "$deplibs_check_method" != pass_all; then
1291 # non-PIC code in shared libraries is not supported
1292 pic_mode=default
1295 # Calculate the filename of the output object if compiler does
1296 # not support -o with -c
1297 if test "$compiler_c_o" = no; then
1298 output_obj=`$ECHO "X$srcfile" | $Xsed -e 's%^.*/%%' -e 's%\.[^.]*$%%'`.${objext}
1299 lockfile="$output_obj.lock"
1300 else
1301 output_obj=
1302 need_locks=no
1303 lockfile=
1306 # Lock this critical section if it is needed
1307 # We use this script file to make the link, it avoids creating a new file
1308 if test "$need_locks" = yes; then
1309 until $opt_dry_run || ln "$progpath" "$lockfile" 2>/dev/null; do
1310 func_echo "Waiting for $lockfile to be removed"
1311 sleep 2
1312 done
1313 elif test "$need_locks" = warn; then
1314 if test -f "$lockfile"; then
1315 $ECHO "\
1316 *** ERROR, $lockfile exists and contains:
1317 `cat $lockfile 2>/dev/null`
1319 This indicates that another process is trying to use the same
1320 temporary object file, and libtool could not work around it because
1321 your compiler does not support \`-c' and \`-o' together. If you
1322 repeat this compilation, it may succeed, by chance, but you had better
1323 avoid parallel builds (make -j) in this platform, or get a better
1324 compiler."
1326 $opt_dry_run || $RM $removelist
1327 exit $EXIT_FAILURE
1329 removelist="$removelist $output_obj"
1330 $ECHO "$srcfile" > "$lockfile"
1333 $opt_dry_run || $RM $removelist
1334 removelist="$removelist $lockfile"
1335 trap '$opt_dry_run || $RM $removelist; exit $EXIT_FAILURE' 1 2 15
1337 if test -n "$fix_srcfile_path"; then
1338 eval srcfile=\"$fix_srcfile_path\"
1340 func_quote_for_eval "$srcfile"
1341 qsrcfile=$func_quote_for_eval_result
1343 # Only build a PIC object if we are building libtool libraries.
1344 if test "$build_libtool_libs" = yes; then
1345 # Without this assignment, base_compile gets emptied.
1346 fbsd_hideous_sh_bug=$base_compile
1348 if test "$pic_mode" != no; then
1349 command="$base_compile $qsrcfile $pic_flag"
1350 else
1351 # Don't build PIC code
1352 command="$base_compile $qsrcfile"
1355 func_mkdir_p "$xdir$objdir"
1357 if test -z "$output_obj"; then
1358 # Place PIC objects in $objdir
1359 command="$command -o $lobj"
1362 func_show_eval_locale "$command" \
1363 'test -n "$output_obj" && $RM $removelist; exit $EXIT_FAILURE'
1365 if test "$need_locks" = warn &&
1366 test "X`cat $lockfile 2>/dev/null`" != "X$srcfile"; then
1367 $ECHO "\
1368 *** ERROR, $lockfile contains:
1369 `cat $lockfile 2>/dev/null`
1371 but it should contain:
1372 $srcfile
1374 This indicates that another process is trying to use the same
1375 temporary object file, and libtool could not work around it because
1376 your compiler does not support \`-c' and \`-o' together. If you
1377 repeat this compilation, it may succeed, by chance, but you had better
1378 avoid parallel builds (make -j) in this platform, or get a better
1379 compiler."
1381 $opt_dry_run || $RM $removelist
1382 exit $EXIT_FAILURE
1385 # Just move the object if needed, then go on to compile the next one
1386 if test -n "$output_obj" && test "X$output_obj" != "X$lobj"; then
1387 func_show_eval '$MV "$output_obj" "$lobj"' \
1388 'error=$?; $opt_dry_run || $RM $removelist; exit $error'
1391 # Allow error messages only from the first compilation.
1392 if test "$suppress_opt" = yes; then
1393 suppress_output=' >/dev/null 2>&1'
1397 # Only build a position-dependent object if we build old libraries.
1398 if test "$build_old_libs" = yes; then
1399 if test "$pic_mode" != yes; then
1400 # Don't build PIC code
1401 command="$base_compile $qsrcfile$pie_flag"
1402 else
1403 command="$base_compile $qsrcfile $pic_flag"
1405 if test "$compiler_c_o" = yes; then
1406 command="$command -o $obj"
1409 # Suppress compiler output if we already did a PIC compilation.
1410 command="$command$suppress_output"
1411 func_show_eval_locale "$command" \
1412 '$opt_dry_run || $RM $removelist; exit $EXIT_FAILURE'
1414 if test "$need_locks" = warn &&
1415 test "X`cat $lockfile 2>/dev/null`" != "X$srcfile"; then
1416 $ECHO "\
1417 *** ERROR, $lockfile contains:
1418 `cat $lockfile 2>/dev/null`
1420 but it should contain:
1421 $srcfile
1423 This indicates that another process is trying to use the same
1424 temporary object file, and libtool could not work around it because
1425 your compiler does not support \`-c' and \`-o' together. If you
1426 repeat this compilation, it may succeed, by chance, but you had better
1427 avoid parallel builds (make -j) in this platform, or get a better
1428 compiler."
1430 $opt_dry_run || $RM $removelist
1431 exit $EXIT_FAILURE
1434 # Just move the object if needed
1435 if test -n "$output_obj" && test "X$output_obj" != "X$obj"; then
1436 func_show_eval '$MV "$output_obj" "$obj"' \
1437 'error=$?; $opt_dry_run || $RM $removelist; exit $error'
1441 $opt_dry_run || {
1442 func_write_libtool_object "$libobj" "$objdir/$objname" "$objname"
1444 # Unlock the critical section if it was locked
1445 if test "$need_locks" != no; then
1446 removelist=$lockfile
1447 $RM "$lockfile"
1451 exit $EXIT_SUCCESS
1454 $opt_help || {
1455 test "$mode" = compile && func_mode_compile ${1+"$@"}
1458 func_mode_help ()
1460 # We need to display help for each of the modes.
1461 case $mode in
1463 # Generic help is extracted from the usage comments
1464 # at the start of this file.
1465 func_help
1468 clean)
1469 $ECHO \
1470 "Usage: $progname [OPTION]... --mode=clean RM [RM-OPTION]... FILE...
1472 Remove files from the build directory.
1474 RM is the name of the program to use to delete files associated with each FILE
1475 (typically \`/bin/rm'). RM-OPTIONS are options (such as \`-f') to be passed
1476 to RM.
1478 If FILE is a libtool library, object or program, all the files associated
1479 with it are deleted. Otherwise, only FILE itself is deleted using RM."
1482 compile)
1483 $ECHO \
1484 "Usage: $progname [OPTION]... --mode=compile COMPILE-COMMAND... SOURCEFILE
1486 Compile a source file into a libtool library object.
1488 This mode accepts the following additional options:
1490 -o OUTPUT-FILE set the output file name to OUTPUT-FILE
1491 -no-suppress do not suppress compiler output for multiple passes
1492 -prefer-pic try to building PIC objects only
1493 -prefer-non-pic try to building non-PIC objects only
1494 -shared do not build a \`.o' file suitable for static linking
1495 -static only build a \`.o' file suitable for static linking
1497 COMPILE-COMMAND is a command to be used in creating a \`standard' object file
1498 from the given SOURCEFILE.
1500 The output file name is determined by removing the directory component from
1501 SOURCEFILE, then substituting the C source code suffix \`.c' with the
1502 library object suffix, \`.lo'."
1505 execute)
1506 $ECHO \
1507 "Usage: $progname [OPTION]... --mode=execute COMMAND [ARGS]...
1509 Automatically set library path, then run a program.
1511 This mode accepts the following additional options:
1513 -dlopen FILE add the directory containing FILE to the library path
1515 This mode sets the library path environment variable according to \`-dlopen'
1516 flags.
1518 If any of the ARGS are libtool executable wrappers, then they are translated
1519 into their corresponding uninstalled binary, and any of their required library
1520 directories are added to the library path.
1522 Then, COMMAND is executed, with ARGS as arguments."
1525 finish)
1526 $ECHO \
1527 "Usage: $progname [OPTION]... --mode=finish [LIBDIR]...
1529 Complete the installation of libtool libraries.
1531 Each LIBDIR is a directory that contains libtool libraries.
1533 The commands that this mode executes may require superuser privileges. Use
1534 the \`--dry-run' option if you just want to see what would be executed."
1537 install)
1538 $ECHO \
1539 "Usage: $progname [OPTION]... --mode=install INSTALL-COMMAND...
1541 Install executables or libraries.
1543 INSTALL-COMMAND is the installation command. The first component should be
1544 either the \`install' or \`cp' program.
1546 The following components of INSTALL-COMMAND are treated specially:
1548 -inst-prefix PREFIX-DIR Use PREFIX-DIR as a staging area for installation
1550 The rest of the components are interpreted as arguments to that command (only
1551 BSD-compatible install options are recognized)."
1554 link)
1555 $ECHO \
1556 "Usage: $progname [OPTION]... --mode=link LINK-COMMAND...
1558 Link object files or libraries together to form another library, or to
1559 create an executable program.
1561 LINK-COMMAND is a command using the C compiler that you would use to create
1562 a program from several object files.
1564 The following components of LINK-COMMAND are treated specially:
1566 -all-static do not do any dynamic linking at all
1567 -avoid-version do not add a version suffix if possible
1568 -dlopen FILE \`-dlpreopen' FILE if it cannot be dlopened at runtime
1569 -dlpreopen FILE link in FILE and add its symbols to lt_preloaded_symbols
1570 -export-dynamic allow symbols from OUTPUT-FILE to be resolved with dlsym(3)
1571 -export-symbols SYMFILE
1572 try to export only the symbols listed in SYMFILE
1573 -export-symbols-regex REGEX
1574 try to export only the symbols matching REGEX
1575 -LLIBDIR search LIBDIR for required installed libraries
1576 -lNAME OUTPUT-FILE requires the installed library libNAME
1577 -module build a library that can dlopened
1578 -no-fast-install disable the fast-install mode
1579 -no-install link a not-installable executable
1580 -no-undefined declare that a library does not refer to external symbols
1581 -o OUTPUT-FILE create OUTPUT-FILE from the specified objects
1582 -objectlist FILE Use a list of object files found in FILE to specify objects
1583 -precious-files-regex REGEX
1584 don't remove output files matching REGEX
1585 -release RELEASE specify package release information
1586 -rpath LIBDIR the created library will eventually be installed in LIBDIR
1587 -R[ ]LIBDIR add LIBDIR to the runtime path of programs and libraries
1588 -shared only do dynamic linking of libtool libraries
1589 -shrext SUFFIX override the standard shared library file extension
1590 -static do not do any dynamic linking of uninstalled libtool libraries
1591 -static-libtool-libs
1592 do not do any dynamic linking of libtool libraries
1593 -version-info CURRENT[:REVISION[:AGE]]
1594 specify library version info [each variable defaults to 0]
1595 -weak LIBNAME declare that the target provides the LIBNAME interface
1597 All other options (arguments beginning with \`-') are ignored.
1599 Every other argument is treated as a filename. Files ending in \`.la' are
1600 treated as uninstalled libtool libraries, other files are standard or library
1601 object files.
1603 If the OUTPUT-FILE ends in \`.la', then a libtool library is created,
1604 only library objects (\`.lo' files) may be specified, and \`-rpath' is
1605 required, except when creating a convenience library.
1607 If OUTPUT-FILE ends in \`.a' or \`.lib', then a standard library is created
1608 using \`ar' and \`ranlib', or on Windows using \`lib'.
1610 If OUTPUT-FILE ends in \`.lo' or \`.${objext}', then a reloadable object file
1611 is created, otherwise an executable program is created."
1614 uninstall)
1615 $ECHO \
1616 "Usage: $progname [OPTION]... --mode=uninstall RM [RM-OPTION]... FILE...
1618 Remove libraries from an installation directory.
1620 RM is the name of the program to use to delete files associated with each FILE
1621 (typically \`/bin/rm'). RM-OPTIONS are options (such as \`-f') to be passed
1622 to RM.
1624 If FILE is a libtool library, all the files associated with it are deleted.
1625 Otherwise, only FILE itself is deleted using RM."
1629 func_fatal_help "invalid operation mode \`$mode'"
1631 esac
1633 $ECHO
1634 $ECHO "Try \`$progname --help' for more information about other modes."
1636 exit $?
1639 # Now that we've collected a possible --mode arg, show help if necessary
1640 $opt_help && func_mode_help
1643 # func_mode_execute arg...
1644 func_mode_execute ()
1646 $opt_debug
1647 # The first argument is the command name.
1648 cmd="$nonopt"
1649 test -z "$cmd" && \
1650 func_fatal_help "you must specify a COMMAND"
1652 # Handle -dlopen flags immediately.
1653 for file in $execute_dlfiles; do
1654 test -f "$file" \
1655 || func_fatal_help "\`$file' is not a file"
1657 dir=
1658 case $file in
1659 *.la)
1660 # Check to see that this really is a libtool archive.
1661 func_lalib_unsafe_p "$file" \
1662 || func_fatal_help "\`$lib' is not a valid libtool archive"
1664 # Read the libtool library.
1665 dlname=
1666 library_names=
1667 func_source "$file"
1669 # Skip this library if it cannot be dlopened.
1670 if test -z "$dlname"; then
1671 # Warn if it was a shared library.
1672 test -n "$library_names" && \
1673 func_warning "\`$file' was not linked with \`-export-dynamic'"
1674 continue
1677 func_dirname "$file" "" "."
1678 dir="$func_dirname_result"
1680 if test -f "$dir/$objdir/$dlname"; then
1681 dir="$dir/$objdir"
1682 else
1683 if test ! -f "$dir/$dlname"; then
1684 func_fatal_error "cannot find \`$dlname' in \`$dir' or \`$dir/$objdir'"
1689 *.lo)
1690 # Just add the directory containing the .lo file.
1691 func_dirname "$file" "" "."
1692 dir="$func_dirname_result"
1696 func_warning "\`-dlopen' is ignored for non-libtool libraries and objects"
1697 continue
1699 esac
1701 # Get the absolute pathname.
1702 absdir=`cd "$dir" && pwd`
1703 test -n "$absdir" && dir="$absdir"
1705 # Now add the directory to shlibpath_var.
1706 if eval "test -z \"\$$shlibpath_var\""; then
1707 eval "$shlibpath_var=\"\$dir\""
1708 else
1709 eval "$shlibpath_var=\"\$dir:\$$shlibpath_var\""
1711 done
1713 # This variable tells wrapper scripts just to set shlibpath_var
1714 # rather than running their programs.
1715 libtool_execute_magic="$magic"
1717 # Check if any of the arguments is a wrapper script.
1718 args=
1719 for file
1721 case $file in
1722 -*) ;;
1724 # Do a test to see if this is really a libtool program.
1725 if func_ltwrapper_script_p "$file"; then
1726 func_source "$file"
1727 # Transform arg to wrapped name.
1728 file="$progdir/$program"
1729 elif func_ltwrapper_executable_p "$file"; then
1730 func_ltwrapper_scriptname "$file"
1731 func_source "$func_ltwrapper_scriptname_result"
1732 # Transform arg to wrapped name.
1733 file="$progdir/$program"
1736 esac
1737 # Quote arguments (to preserve shell metacharacters).
1738 func_quote_for_eval "$file"
1739 args="$args $func_quote_for_eval_result"
1740 done
1742 if test "X$opt_dry_run" = Xfalse; then
1743 if test -n "$shlibpath_var"; then
1744 # Export the shlibpath_var.
1745 eval "export $shlibpath_var"
1748 # Restore saved environment variables
1749 for lt_var in LANG LANGUAGE LC_ALL LC_CTYPE LC_COLLATE LC_MESSAGES
1751 eval "if test \"\${save_$lt_var+set}\" = set; then
1752 $lt_var=\$save_$lt_var; export $lt_var
1753 else
1754 $lt_unset $lt_var
1756 done
1758 # Now prepare to actually exec the command.
1759 exec_cmd="\$cmd$args"
1760 else
1761 # Display what would be done.
1762 if test -n "$shlibpath_var"; then
1763 eval "\$ECHO \"\$shlibpath_var=\$$shlibpath_var\""
1764 $ECHO "export $shlibpath_var"
1766 $ECHO "$cmd$args"
1767 exit $EXIT_SUCCESS
1771 test "$mode" = execute && func_mode_execute ${1+"$@"}
1774 # func_mode_finish arg...
1775 func_mode_finish ()
1777 $opt_debug
1778 libdirs="$nonopt"
1779 admincmds=
1781 if test -n "$finish_cmds$finish_eval" && test -n "$libdirs"; then
1782 for dir
1784 libdirs="$libdirs $dir"
1785 done
1787 for libdir in $libdirs; do
1788 if test -n "$finish_cmds"; then
1789 # Do each command in the finish commands.
1790 func_execute_cmds "$finish_cmds" 'admincmds="$admincmds
1791 '"$cmd"'"'
1793 if test -n "$finish_eval"; then
1794 # Do the single finish_eval.
1795 eval cmds=\"$finish_eval\"
1796 $opt_dry_run || eval "$cmds" || admincmds="$admincmds
1797 $cmds"
1799 done
1802 # Exit here if they wanted silent mode.
1803 $opt_silent && exit $EXIT_SUCCESS
1805 $ECHO "X----------------------------------------------------------------------" | $Xsed
1806 $ECHO "Libraries have been installed in:"
1807 for libdir in $libdirs; do
1808 $ECHO " $libdir"
1809 done
1810 $ECHO
1811 $ECHO "If you ever happen to want to link against installed libraries"
1812 $ECHO "in a given directory, LIBDIR, you must either use libtool, and"
1813 $ECHO "specify the full pathname of the library, or use the \`-LLIBDIR'"
1814 $ECHO "flag during linking and do at least one of the following:"
1815 if test -n "$shlibpath_var"; then
1816 $ECHO " - add LIBDIR to the \`$shlibpath_var' environment variable"
1817 $ECHO " during execution"
1819 if test -n "$runpath_var"; then
1820 $ECHO " - add LIBDIR to the \`$runpath_var' environment variable"
1821 $ECHO " during linking"
1823 if test -n "$hardcode_libdir_flag_spec"; then
1824 libdir=LIBDIR
1825 eval flag=\"$hardcode_libdir_flag_spec\"
1827 $ECHO " - use the \`$flag' linker flag"
1829 if test -n "$admincmds"; then
1830 $ECHO " - have your system administrator run these commands:$admincmds"
1832 if test -f /etc/ld.so.conf; then
1833 $ECHO " - have your system administrator add LIBDIR to \`/etc/ld.so.conf'"
1835 $ECHO
1837 $ECHO "See any operating system documentation about shared libraries for"
1838 case $host in
1839 solaris2.[6789]|solaris2.1[0-9])
1840 $ECHO "more information, such as the ld(1), crle(1) and ld.so(8) manual"
1841 $ECHO "pages."
1844 $ECHO "more information, such as the ld(1) and ld.so(8) manual pages."
1846 esac
1847 $ECHO "X----------------------------------------------------------------------" | $Xsed
1848 exit $EXIT_SUCCESS
1851 test "$mode" = finish && func_mode_finish ${1+"$@"}
1854 # func_mode_install arg...
1855 func_mode_install ()
1857 $opt_debug
1858 # There may be an optional sh(1) argument at the beginning of
1859 # install_prog (especially on Windows NT).
1860 if test "$nonopt" = "$SHELL" || test "$nonopt" = /bin/sh ||
1861 # Allow the use of GNU shtool's install command.
1862 $ECHO "X$nonopt" | $GREP shtool >/dev/null; then
1863 # Aesthetically quote it.
1864 func_quote_for_eval "$nonopt"
1865 install_prog="$func_quote_for_eval_result "
1866 arg=$1
1867 shift
1868 else
1869 install_prog=
1870 arg=$nonopt
1873 # The real first argument should be the name of the installation program.
1874 # Aesthetically quote it.
1875 func_quote_for_eval "$arg"
1876 install_prog="$install_prog$func_quote_for_eval_result"
1878 # We need to accept at least all the BSD install flags.
1879 dest=
1880 files=
1881 opts=
1882 prev=
1883 install_type=
1884 isdir=no
1885 stripme=
1886 for arg
1888 if test -n "$dest"; then
1889 files="$files $dest"
1890 dest=$arg
1891 continue
1894 case $arg in
1895 -d) isdir=yes ;;
1897 case " $install_prog " in
1898 *[\\\ /]cp\ *) ;;
1899 *) prev=$arg ;;
1900 esac
1902 -g | -m | -o)
1903 prev=$arg
1906 stripme=" -s"
1907 continue
1912 # If the previous option needed an argument, then skip it.
1913 if test -n "$prev"; then
1914 prev=
1915 else
1916 dest=$arg
1917 continue
1920 esac
1922 # Aesthetically quote the argument.
1923 func_quote_for_eval "$arg"
1924 install_prog="$install_prog $func_quote_for_eval_result"
1925 done
1927 test -z "$install_prog" && \
1928 func_fatal_help "you must specify an install program"
1930 test -n "$prev" && \
1931 func_fatal_help "the \`$prev' option requires an argument"
1933 if test -z "$files"; then
1934 if test -z "$dest"; then
1935 func_fatal_help "no file or destination specified"
1936 else
1937 func_fatal_help "you must specify a destination"
1941 # Strip any trailing slash from the destination.
1942 func_stripname '' '/' "$dest"
1943 dest=$func_stripname_result
1945 # Check to see that the destination is a directory.
1946 test -d "$dest" && isdir=yes
1947 if test "$isdir" = yes; then
1948 destdir="$dest"
1949 destname=
1950 else
1951 func_dirname_and_basename "$dest" "" "."
1952 destdir="$func_dirname_result"
1953 destname="$func_basename_result"
1955 # Not a directory, so check to see that there is only one file specified.
1956 set dummy $files; shift
1957 test "$#" -gt 1 && \
1958 func_fatal_help "\`$dest' is not a directory"
1960 case $destdir in
1961 [\\/]* | [A-Za-z]:[\\/]*) ;;
1963 for file in $files; do
1964 case $file in
1965 *.lo) ;;
1967 func_fatal_help "\`$destdir' must be an absolute directory name"
1969 esac
1970 done
1972 esac
1974 # This variable tells wrapper scripts just to set variables rather
1975 # than running their programs.
1976 libtool_install_magic="$magic"
1978 staticlibs=
1979 future_libdirs=
1980 current_libdirs=
1981 for file in $files; do
1983 # Do each installation.
1984 case $file in
1985 *.$libext)
1986 # Do the static libraries later.
1987 staticlibs="$staticlibs $file"
1990 *.la)
1991 # Check to see that this really is a libtool archive.
1992 func_lalib_unsafe_p "$file" \
1993 || func_fatal_help "\`$file' is not a valid libtool archive"
1995 library_names=
1996 old_library=
1997 relink_command=
1998 func_source "$file"
2000 # Add the libdir to current_libdirs if it is the destination.
2001 if test "X$destdir" = "X$libdir"; then
2002 case "$current_libdirs " in
2003 *" $libdir "*) ;;
2004 *) current_libdirs="$current_libdirs $libdir" ;;
2005 esac
2006 else
2007 # Note the libdir as a future libdir.
2008 case "$future_libdirs " in
2009 *" $libdir "*) ;;
2010 *) future_libdirs="$future_libdirs $libdir" ;;
2011 esac
2014 func_dirname "$file" "/" ""
2015 dir="$func_dirname_result"
2016 dir="$dir$objdir"
2018 if test -n "$relink_command"; then
2019 # Determine the prefix the user has applied to our future dir.
2020 inst_prefix_dir=`$ECHO "X$destdir" | $Xsed -e "s%$libdir\$%%"`
2022 # Don't allow the user to place us outside of our expected
2023 # location b/c this prevents finding dependent libraries that
2024 # are installed to the same prefix.
2025 # At present, this check doesn't affect windows .dll's that
2026 # are installed into $libdir/../bin (currently, that works fine)
2027 # but it's something to keep an eye on.
2028 test "$inst_prefix_dir" = "$destdir" && \
2029 func_fatal_error "error: cannot install \`$file' to a directory not ending in $libdir"
2031 if test -n "$inst_prefix_dir"; then
2032 # Stick the inst_prefix_dir data into the link command.
2033 relink_command=`$ECHO "X$relink_command" | $Xsed -e "s%@inst_prefix_dir@%-inst-prefix-dir $inst_prefix_dir%"`
2034 else
2035 relink_command=`$ECHO "X$relink_command" | $Xsed -e "s%@inst_prefix_dir@%%"`
2038 func_warning "relinking \`$file'"
2039 func_show_eval "$relink_command" \
2040 'func_fatal_error "error: relink \`$file'\'' with the above command before installing it"'
2043 # See the names of the shared library.
2044 set dummy $library_names; shift
2045 if test -n "$1"; then
2046 realname="$1"
2047 shift
2049 srcname="$realname"
2050 test -n "$relink_command" && srcname="$realname"T
2052 # Install the shared library and build the symlinks.
2053 func_show_eval "$install_prog $dir/$srcname $destdir/$realname" \
2054 'exit $?'
2055 tstripme="$stripme"
2056 case $host_os in
2057 cygwin* | mingw* | pw32* | cegcc*)
2058 case $realname in
2059 *.dll.a)
2060 tstripme=""
2062 esac
2064 esac
2065 if test -n "$tstripme" && test -n "$striplib"; then
2066 func_show_eval "$striplib $destdir/$realname" 'exit $?'
2069 if test "$#" -gt 0; then
2070 # Delete the old symlinks, and create new ones.
2071 # Try `ln -sf' first, because the `ln' binary might depend on
2072 # the symlink we replace! Solaris /bin/ln does not understand -f,
2073 # so we also need to try rm && ln -s.
2074 for linkname
2076 test "$linkname" != "$realname" \
2077 && func_show_eval "(cd $destdir && { $LN_S -f $realname $linkname || { $RM $linkname && $LN_S $realname $linkname; }; })"
2078 done
2081 # Do each command in the postinstall commands.
2082 lib="$destdir/$realname"
2083 func_execute_cmds "$postinstall_cmds" 'exit $?'
2086 # Install the pseudo-library for information purposes.
2087 func_basename "$file"
2088 name="$func_basename_result"
2089 instname="$dir/$name"i
2090 func_show_eval "$install_prog $instname $destdir/$name" 'exit $?'
2092 # Maybe install the static library, too.
2093 test -n "$old_library" && staticlibs="$staticlibs $dir/$old_library"
2096 *.lo)
2097 # Install (i.e. copy) a libtool object.
2099 # Figure out destination file name, if it wasn't already specified.
2100 if test -n "$destname"; then
2101 destfile="$destdir/$destname"
2102 else
2103 func_basename "$file"
2104 destfile="$func_basename_result"
2105 destfile="$destdir/$destfile"
2108 # Deduce the name of the destination old-style object file.
2109 case $destfile in
2110 *.lo)
2111 func_lo2o "$destfile"
2112 staticdest=$func_lo2o_result
2114 *.$objext)
2115 staticdest="$destfile"
2116 destfile=
2119 func_fatal_help "cannot copy a libtool object to \`$destfile'"
2121 esac
2123 # Install the libtool object if requested.
2124 test -n "$destfile" && \
2125 func_show_eval "$install_prog $file $destfile" 'exit $?'
2127 # Install the old object if enabled.
2128 if test "$build_old_libs" = yes; then
2129 # Deduce the name of the old-style object file.
2130 func_lo2o "$file"
2131 staticobj=$func_lo2o_result
2132 func_show_eval "$install_prog \$staticobj \$staticdest" 'exit $?'
2134 exit $EXIT_SUCCESS
2138 # Figure out destination file name, if it wasn't already specified.
2139 if test -n "$destname"; then
2140 destfile="$destdir/$destname"
2141 else
2142 func_basename "$file"
2143 destfile="$func_basename_result"
2144 destfile="$destdir/$destfile"
2147 # If the file is missing, and there is a .exe on the end, strip it
2148 # because it is most likely a libtool script we actually want to
2149 # install
2150 stripped_ext=""
2151 case $file in
2152 *.exe)
2153 if test ! -f "$file"; then
2154 func_stripname '' '.exe' "$file"
2155 file=$func_stripname_result
2156 stripped_ext=".exe"
2159 esac
2161 # Do a test to see if this is really a libtool program.
2162 case $host in
2163 *cygwin* | *mingw*)
2164 if func_ltwrapper_executable_p "$file"; then
2165 func_ltwrapper_scriptname "$file"
2166 wrapper=$func_ltwrapper_scriptname_result
2167 else
2168 func_stripname '' '.exe' "$file"
2169 wrapper=$func_stripname_result
2173 wrapper=$file
2175 esac
2176 if func_ltwrapper_script_p "$wrapper"; then
2177 notinst_deplibs=
2178 relink_command=
2180 func_source "$wrapper"
2182 # Check the variables that should have been set.
2183 test -z "$generated_by_libtool_version" && \
2184 func_fatal_error "invalid libtool wrapper script \`$wrapper'"
2186 finalize=yes
2187 for lib in $notinst_deplibs; do
2188 # Check to see that each library is installed.
2189 libdir=
2190 if test -f "$lib"; then
2191 func_source "$lib"
2193 libfile="$libdir/"`$ECHO "X$lib" | $Xsed -e 's%^.*/%%g'` ### testsuite: skip nested quoting test
2194 if test -n "$libdir" && test ! -f "$libfile"; then
2195 func_warning "\`$lib' has not been installed in \`$libdir'"
2196 finalize=no
2198 done
2200 relink_command=
2201 func_source "$wrapper"
2203 outputname=
2204 if test "$fast_install" = no && test -n "$relink_command"; then
2205 $opt_dry_run || {
2206 if test "$finalize" = yes; then
2207 tmpdir=`func_mktempdir`
2208 func_basename "$file$stripped_ext"
2209 file="$func_basename_result"
2210 outputname="$tmpdir/$file"
2211 # Replace the output file specification.
2212 relink_command=`$ECHO "X$relink_command" | $Xsed -e 's%@OUTPUT@%'"$outputname"'%g'`
2214 $opt_silent || {
2215 func_quote_for_expand "$relink_command"
2216 eval "func_echo $func_quote_for_expand_result"
2218 if eval "$relink_command"; then :
2219 else
2220 func_error "error: relink \`$file' with the above command before installing it"
2221 $opt_dry_run || ${RM}r "$tmpdir"
2222 continue
2224 file="$outputname"
2225 else
2226 func_warning "cannot relink \`$file'"
2229 else
2230 # Install the binary that we compiled earlier.
2231 file=`$ECHO "X$file$stripped_ext" | $Xsed -e "s%\([^/]*\)$%$objdir/\1%"`
2235 # remove .exe since cygwin /usr/bin/install will append another
2236 # one anyway
2237 case $install_prog,$host in
2238 */usr/bin/install*,*cygwin*)
2239 case $file:$destfile in
2240 *.exe:*.exe)
2241 # this is ok
2243 *.exe:*)
2244 destfile=$destfile.exe
2246 *:*.exe)
2247 func_stripname '' '.exe' "$destfile"
2248 destfile=$func_stripname_result
2250 esac
2252 esac
2253 func_show_eval "$install_prog\$stripme \$file \$destfile" 'exit $?'
2254 $opt_dry_run || if test -n "$outputname"; then
2255 ${RM}r "$tmpdir"
2258 esac
2259 done
2261 for file in $staticlibs; do
2262 func_basename "$file"
2263 name="$func_basename_result"
2265 # Set up the ranlib parameters.
2266 oldlib="$destdir/$name"
2268 func_show_eval "$install_prog \$file \$oldlib" 'exit $?'
2270 if test -n "$stripme" && test -n "$old_striplib"; then
2271 func_show_eval "$old_striplib $oldlib" 'exit $?'
2274 # Do each command in the postinstall commands.
2275 func_execute_cmds "$old_postinstall_cmds" 'exit $?'
2276 done
2278 test -n "$future_libdirs" && \
2279 func_warning "remember to run \`$progname --finish$future_libdirs'"
2281 if test -n "$current_libdirs"; then
2282 # Maybe just do a dry run.
2283 $opt_dry_run && current_libdirs=" -n$current_libdirs"
2284 exec_cmd='$SHELL $progpath $preserve_args --finish$current_libdirs'
2285 else
2286 exit $EXIT_SUCCESS
2290 test "$mode" = install && func_mode_install ${1+"$@"}
2293 # func_generate_dlsyms outputname originator pic_p
2294 # Extract symbols from dlprefiles and create ${outputname}S.o with
2295 # a dlpreopen symbol table.
2296 func_generate_dlsyms ()
2298 $opt_debug
2299 my_outputname="$1"
2300 my_originator="$2"
2301 my_pic_p="${3-no}"
2302 my_prefix=`$ECHO "$my_originator" | sed 's%[^a-zA-Z0-9]%_%g'`
2303 my_dlsyms=
2305 if test -n "$dlfiles$dlprefiles" || test "$dlself" != no; then
2306 if test -n "$NM" && test -n "$global_symbol_pipe"; then
2307 my_dlsyms="${my_outputname}S.c"
2308 else
2309 func_error "not configured to extract global symbols from dlpreopened files"
2313 if test -n "$my_dlsyms"; then
2314 case $my_dlsyms in
2315 "") ;;
2316 *.c)
2317 # Discover the nlist of each of the dlfiles.
2318 nlist="$output_objdir/${my_outputname}.nm"
2320 func_show_eval "$RM $nlist ${nlist}S ${nlist}T"
2322 # Parse the name list into a source file.
2323 func_verbose "creating $output_objdir/$my_dlsyms"
2325 $opt_dry_run || $ECHO > "$output_objdir/$my_dlsyms" "\
2326 /* $my_dlsyms - symbol resolution table for \`$my_outputname' dlsym emulation. */
2327 /* Generated by $PROGRAM (GNU $PACKAGE$TIMESTAMP) $VERSION */
2329 #ifdef __cplusplus
2330 extern \"C\" {
2331 #endif
2333 /* External symbol declarations for the compiler. */\
2336 if test "$dlself" = yes; then
2337 func_verbose "generating symbol list for \`$output'"
2339 $opt_dry_run || echo ': @PROGRAM@ ' > "$nlist"
2341 # Add our own program objects to the symbol list.
2342 progfiles=`$ECHO "X$objs$old_deplibs" | $SP2NL | $Xsed -e "$lo2o" | $NL2SP`
2343 for progfile in $progfiles; do
2344 func_verbose "extracting global C symbols from \`$progfile'"
2345 $opt_dry_run || eval "$NM $progfile | $global_symbol_pipe >> '$nlist'"
2346 done
2348 if test -n "$exclude_expsyms"; then
2349 $opt_dry_run || {
2350 eval '$EGREP -v " ($exclude_expsyms)$" "$nlist" > "$nlist"T'
2351 eval '$MV "$nlist"T "$nlist"'
2355 if test -n "$export_symbols_regex"; then
2356 $opt_dry_run || {
2357 eval '$EGREP -e "$export_symbols_regex" "$nlist" > "$nlist"T'
2358 eval '$MV "$nlist"T "$nlist"'
2362 # Prepare the list of exported symbols
2363 if test -z "$export_symbols"; then
2364 export_symbols="$output_objdir/$outputname.exp"
2365 $opt_dry_run || {
2366 $RM $export_symbols
2367 eval "${SED} -n -e '/^: @PROGRAM@ $/d' -e 's/^.* \(.*\)$/\1/p' "'< "$nlist" > "$export_symbols"'
2368 case $host in
2369 *cygwin* | *mingw* | *cegcc* )
2370 eval "echo EXPORTS "'> "$output_objdir/$outputname.def"'
2371 eval 'cat "$export_symbols" >> "$output_objdir/$outputname.def"'
2373 esac
2375 else
2376 $opt_dry_run || {
2377 eval "${SED} -e 's/\([].[*^$]\)/\\\\\1/g' -e 's/^/ /' -e 's/$/$/'"' < "$export_symbols" > "$output_objdir/$outputname.exp"'
2378 eval '$GREP -f "$output_objdir/$outputname.exp" < "$nlist" > "$nlist"T'
2379 eval '$MV "$nlist"T "$nlist"'
2380 case $host in
2381 *cygwin | *mingw* | *cegcc* )
2382 eval "echo EXPORTS "'> "$output_objdir/$outputname.def"'
2383 eval 'cat "$nlist" >> "$output_objdir/$outputname.def"'
2385 esac
2390 for dlprefile in $dlprefiles; do
2391 func_verbose "extracting global C symbols from \`$dlprefile'"
2392 func_basename "$dlprefile"
2393 name="$func_basename_result"
2394 $opt_dry_run || {
2395 eval '$ECHO ": $name " >> "$nlist"'
2396 eval "$NM $dlprefile 2>/dev/null | $global_symbol_pipe >> '$nlist'"
2398 done
2400 $opt_dry_run || {
2401 # Make sure we have at least an empty file.
2402 test -f "$nlist" || : > "$nlist"
2404 if test -n "$exclude_expsyms"; then
2405 $EGREP -v " ($exclude_expsyms)$" "$nlist" > "$nlist"T
2406 $MV "$nlist"T "$nlist"
2409 # Try sorting and uniquifying the output.
2410 if $GREP -v "^: " < "$nlist" |
2411 if sort -k 3 </dev/null >/dev/null 2>&1; then
2412 sort -k 3
2413 else
2414 sort +2
2415 fi |
2416 uniq > "$nlist"S; then
2418 else
2419 $GREP -v "^: " < "$nlist" > "$nlist"S
2422 if test -f "$nlist"S; then
2423 eval "$global_symbol_to_cdecl"' < "$nlist"S >> "$output_objdir/$my_dlsyms"'
2424 else
2425 $ECHO '/* NONE */' >> "$output_objdir/$my_dlsyms"
2428 $ECHO >> "$output_objdir/$my_dlsyms" "\
2430 /* The mapping between symbol names and symbols. */
2431 typedef struct {
2432 const char *name;
2433 void *address;
2434 } lt_dlsymlist;
2436 case $host in
2437 *cygwin* | *mingw* | *cegcc* )
2438 $ECHO >> "$output_objdir/$my_dlsyms" "\
2439 /* DATA imports from DLLs on WIN32 con't be const, because
2440 runtime relocations are performed -- see ld's documentation
2441 on pseudo-relocs. */"
2442 lt_dlsym_const= ;;
2443 *osf5*)
2444 echo >> "$output_objdir/$my_dlsyms" "\
2445 /* This system does not cope well with relocations in const data */"
2446 lt_dlsym_const= ;;
2448 lt_dlsym_const=const ;;
2449 esac
2451 $ECHO >> "$output_objdir/$my_dlsyms" "\
2452 extern $lt_dlsym_const lt_dlsymlist
2453 lt_${my_prefix}_LTX_preloaded_symbols[];
2454 $lt_dlsym_const lt_dlsymlist
2455 lt_${my_prefix}_LTX_preloaded_symbols[] =
2457 { \"$my_originator\", (void *) 0 },"
2459 case $need_lib_prefix in
2461 eval "$global_symbol_to_c_name_address" < "$nlist" >> "$output_objdir/$my_dlsyms"
2464 eval "$global_symbol_to_c_name_address_lib_prefix" < "$nlist" >> "$output_objdir/$my_dlsyms"
2466 esac
2467 $ECHO >> "$output_objdir/$my_dlsyms" "\
2468 {0, (void *) 0}
2471 /* This works around a problem in FreeBSD linker */
2472 #ifdef FREEBSD_WORKAROUND
2473 static const void *lt_preloaded_setup() {
2474 return lt_${my_prefix}_LTX_preloaded_symbols;
2476 #endif
2478 #ifdef __cplusplus
2480 #endif\
2482 } # !$opt_dry_run
2484 pic_flag_for_symtable=
2485 case "$compile_command " in
2486 *" -static "*) ;;
2488 case $host in
2489 # compiling the symbol table file with pic_flag works around
2490 # a FreeBSD bug that causes programs to crash when -lm is
2491 # linked before any other PIC object. But we must not use
2492 # pic_flag when linking with -static. The problem exists in
2493 # FreeBSD 2.2.6 and is fixed in FreeBSD 3.1.
2494 *-*-freebsd2*|*-*-freebsd3.0*|*-*-freebsdelf3.0*)
2495 pic_flag_for_symtable=" $pic_flag -DFREEBSD_WORKAROUND" ;;
2496 *-*-hpux*)
2497 pic_flag_for_symtable=" $pic_flag" ;;
2499 if test "X$my_pic_p" != Xno; then
2500 pic_flag_for_symtable=" $pic_flag"
2503 esac
2505 esac
2506 symtab_cflags=
2507 for arg in $LTCFLAGS; do
2508 case $arg in
2509 -pie | -fpie | -fPIE) ;;
2510 *) symtab_cflags="$symtab_cflags $arg" ;;
2511 esac
2512 done
2514 # Now compile the dynamic symbol file.
2515 func_show_eval '(cd $output_objdir && $LTCC$symtab_cflags -c$no_builtin_flag$pic_flag_for_symtable "$my_dlsyms")' 'exit $?'
2517 # Clean up the generated files.
2518 func_show_eval '$RM "$output_objdir/$my_dlsyms" "$nlist" "${nlist}S" "${nlist}T"'
2520 # Transform the symbol file into the correct name.
2521 symfileobj="$output_objdir/${my_outputname}S.$objext"
2522 case $host in
2523 *cygwin* | *mingw* | *cegcc* )
2524 if test -f "$output_objdir/$my_outputname.def"; then
2525 compile_command=`$ECHO "X$compile_command" | $Xsed -e "s%@SYMFILE@%$output_objdir/$my_outputname.def $symfileobj%"`
2526 finalize_command=`$ECHO "X$finalize_command" | $Xsed -e "s%@SYMFILE@%$output_objdir/$my_outputname.def $symfileobj%"`
2527 else
2528 compile_command=`$ECHO "X$compile_command" | $Xsed -e "s%@SYMFILE@%$symfileobj%"`
2529 finalize_command=`$ECHO "X$finalize_command" | $Xsed -e "s%@SYMFILE@%$symfileobj%"`
2533 compile_command=`$ECHO "X$compile_command" | $Xsed -e "s%@SYMFILE@%$symfileobj%"`
2534 finalize_command=`$ECHO "X$finalize_command" | $Xsed -e "s%@SYMFILE@%$symfileobj%"`
2536 esac
2539 func_fatal_error "unknown suffix for \`$my_dlsyms'"
2541 esac
2542 else
2543 # We keep going just in case the user didn't refer to
2544 # lt_preloaded_symbols. The linker will fail if global_symbol_pipe
2545 # really was required.
2547 # Nullify the symbol file.
2548 compile_command=`$ECHO "X$compile_command" | $Xsed -e "s% @SYMFILE@%%"`
2549 finalize_command=`$ECHO "X$finalize_command" | $Xsed -e "s% @SYMFILE@%%"`
2553 # func_win32_libid arg
2554 # return the library type of file 'arg'
2556 # Need a lot of goo to handle *both* DLLs and import libs
2557 # Has to be a shell function in order to 'eat' the argument
2558 # that is supplied when $file_magic_command is called.
2559 func_win32_libid ()
2561 $opt_debug
2562 win32_libid_type="unknown"
2563 win32_fileres=`file -L $1 2>/dev/null`
2564 case $win32_fileres in
2565 *ar\ archive\ import\ library*) # definitely import
2566 win32_libid_type="x86 archive import"
2568 *ar\ archive*) # could be an import, or static
2569 if eval $OBJDUMP -f $1 | $SED -e '10q' 2>/dev/null |
2570 $EGREP 'file format pe-i386(.*architecture: i386)?' >/dev/null ; then
2571 win32_nmres=`eval $NM -f posix -A $1 |
2572 $SED -n -e '
2573 1,100{
2574 / I /{
2575 s,.*,import,
2580 case $win32_nmres in
2581 import*) win32_libid_type="x86 archive import";;
2582 *) win32_libid_type="x86 archive static";;
2583 esac
2586 *DLL*)
2587 win32_libid_type="x86 DLL"
2589 *executable*) # but shell scripts are "executable" too...
2590 case $win32_fileres in
2591 *MS\ Windows\ PE\ Intel*)
2592 win32_libid_type="x86 DLL"
2594 esac
2596 esac
2597 $ECHO "$win32_libid_type"
2602 # func_extract_an_archive dir oldlib
2603 func_extract_an_archive ()
2605 $opt_debug
2606 f_ex_an_ar_dir="$1"; shift
2607 f_ex_an_ar_oldlib="$1"
2608 func_show_eval "(cd \$f_ex_an_ar_dir && $AR x \"\$f_ex_an_ar_oldlib\")" 'exit $?'
2609 if ($AR t "$f_ex_an_ar_oldlib" | sort | sort -uc >/dev/null 2>&1); then
2611 else
2612 func_fatal_error "object name conflicts in archive: $f_ex_an_ar_dir/$f_ex_an_ar_oldlib"
2617 # func_extract_archives gentop oldlib ...
2618 func_extract_archives ()
2620 $opt_debug
2621 my_gentop="$1"; shift
2622 my_oldlibs=${1+"$@"}
2623 my_oldobjs=""
2624 my_xlib=""
2625 my_xabs=""
2626 my_xdir=""
2628 for my_xlib in $my_oldlibs; do
2629 # Extract the objects.
2630 case $my_xlib in
2631 [\\/]* | [A-Za-z]:[\\/]*) my_xabs="$my_xlib" ;;
2632 *) my_xabs=`pwd`"/$my_xlib" ;;
2633 esac
2634 func_basename "$my_xlib"
2635 my_xlib="$func_basename_result"
2636 my_xlib_u=$my_xlib
2637 while :; do
2638 case " $extracted_archives " in
2639 *" $my_xlib_u "*)
2640 func_arith $extracted_serial + 1
2641 extracted_serial=$func_arith_result
2642 my_xlib_u=lt$extracted_serial-$my_xlib ;;
2643 *) break ;;
2644 esac
2645 done
2646 extracted_archives="$extracted_archives $my_xlib_u"
2647 my_xdir="$my_gentop/$my_xlib_u"
2649 func_mkdir_p "$my_xdir"
2651 case $host in
2652 *-darwin*)
2653 func_verbose "Extracting $my_xabs"
2654 # Do not bother doing anything if just a dry run
2655 $opt_dry_run || {
2656 darwin_orig_dir=`pwd`
2657 cd $my_xdir || exit $?
2658 darwin_archive=$my_xabs
2659 darwin_curdir=`pwd`
2660 darwin_base_archive=`basename "$darwin_archive"`
2661 darwin_arches=`$LIPO -info "$darwin_archive" 2>/dev/null | $GREP Architectures 2>/dev/null || true`
2662 if test -n "$darwin_arches"; then
2663 darwin_arches=`$ECHO "$darwin_arches" | $SED -e 's/.*are://'`
2664 darwin_arch=
2665 func_verbose "$darwin_base_archive has multiple architectures $darwin_arches"
2666 for darwin_arch in $darwin_arches ; do
2667 func_mkdir_p "unfat-$$/${darwin_base_archive}-${darwin_arch}"
2668 $LIPO -thin $darwin_arch -output "unfat-$$/${darwin_base_archive}-${darwin_arch}/${darwin_base_archive}" "${darwin_archive}"
2669 cd "unfat-$$/${darwin_base_archive}-${darwin_arch}"
2670 func_extract_an_archive "`pwd`" "${darwin_base_archive}"
2671 cd "$darwin_curdir"
2672 $RM "unfat-$$/${darwin_base_archive}-${darwin_arch}/${darwin_base_archive}"
2673 done # $darwin_arches
2674 ## Okay now we've a bunch of thin objects, gotta fatten them up :)
2675 darwin_filelist=`find unfat-$$ -type f -name \*.o -print -o -name \*.lo -print | $SED -e "$basename" | sort -u`
2676 darwin_file=
2677 darwin_files=
2678 for darwin_file in $darwin_filelist; do
2679 darwin_files=`find unfat-$$ -name $darwin_file -print | $NL2SP`
2680 $LIPO -create -output "$darwin_file" $darwin_files
2681 done # $darwin_filelist
2682 $RM -rf unfat-$$
2683 cd "$darwin_orig_dir"
2684 else
2685 cd $darwin_orig_dir
2686 func_extract_an_archive "$my_xdir" "$my_xabs"
2687 fi # $darwin_arches
2688 } # !$opt_dry_run
2691 func_extract_an_archive "$my_xdir" "$my_xabs"
2693 esac
2694 my_oldobjs="$my_oldobjs "`find $my_xdir -name \*.$objext -print -o -name \*.lo -print | $NL2SP`
2695 done
2697 func_extract_archives_result="$my_oldobjs"
2702 # func_emit_wrapper_part1 [arg=no]
2704 # Emit the first part of a libtool wrapper script on stdout.
2705 # For more information, see the description associated with
2706 # func_emit_wrapper(), below.
2707 func_emit_wrapper_part1 ()
2709 func_emit_wrapper_part1_arg1=no
2710 if test -n "$1" ; then
2711 func_emit_wrapper_part1_arg1=$1
2714 $ECHO "\
2715 #! $SHELL
2717 # $output - temporary wrapper script for $objdir/$outputname
2718 # Generated by $PROGRAM (GNU $PACKAGE$TIMESTAMP) $VERSION
2720 # The $output program cannot be directly executed until all the libtool
2721 # libraries that it depends on are installed.
2723 # This wrapper script should never be moved out of the build directory.
2724 # If it is, it will not operate correctly.
2726 # Sed substitution that helps us do robust quoting. It backslashifies
2727 # metacharacters that are still active within double-quoted strings.
2728 Xsed='${SED} -e 1s/^X//'
2729 sed_quote_subst='$sed_quote_subst'
2731 # Be Bourne compatible
2732 if test -n \"\${ZSH_VERSION+set}\" && (emulate sh) >/dev/null 2>&1; then
2733 emulate sh
2734 NULLCMD=:
2735 # Zsh 3.x and 4.x performs word splitting on \${1+\"\$@\"}, which
2736 # is contrary to our usage. Disable this feature.
2737 alias -g '\${1+\"\$@\"}'='\"\$@\"'
2738 setopt NO_GLOB_SUBST
2739 else
2740 case \`(set -o) 2>/dev/null\` in *posix*) set -o posix;; esac
2742 BIN_SH=xpg4; export BIN_SH # for Tru64
2743 DUALCASE=1; export DUALCASE # for MKS sh
2745 # The HP-UX ksh and POSIX shell print the target directory to stdout
2746 # if CDPATH is set.
2747 (unset CDPATH) >/dev/null 2>&1 && unset CDPATH
2749 relink_command=\"$relink_command\"
2751 # This environment variable determines our operation mode.
2752 if test \"\$libtool_install_magic\" = \"$magic\"; then
2753 # install mode needs the following variables:
2754 generated_by_libtool_version='$macro_version'
2755 notinst_deplibs='$notinst_deplibs'
2756 else
2757 # When we are sourced in execute mode, \$file and \$ECHO are already set.
2758 if test \"\$libtool_execute_magic\" != \"$magic\"; then
2759 ECHO=\"$qecho\"
2760 file=\"\$0\"
2761 # Make sure echo works.
2762 if test \"X\$1\" = X--no-reexec; then
2763 # Discard the --no-reexec flag, and continue.
2764 shift
2765 elif test \"X\`{ \$ECHO '\t'; } 2>/dev/null\`\" = 'X\t'; then
2766 # Yippee, \$ECHO works!
2768 else
2769 # Restart under the correct shell, and then maybe \$ECHO will work.
2770 exec $SHELL \"\$0\" --no-reexec \${1+\"\$@\"}
2774 $ECHO "\
2776 # Find the directory that this script lives in.
2777 thisdir=\`\$ECHO \"X\$file\" | \$Xsed -e 's%/[^/]*$%%'\`
2778 test \"x\$thisdir\" = \"x\$file\" && thisdir=.
2780 # Follow symbolic links until we get to the real thisdir.
2781 file=\`ls -ld \"\$file\" | ${SED} -n 's/.*-> //p'\`
2782 while test -n \"\$file\"; do
2783 destdir=\`\$ECHO \"X\$file\" | \$Xsed -e 's%/[^/]*\$%%'\`
2785 # If there was a directory component, then change thisdir.
2786 if test \"x\$destdir\" != \"x\$file\"; then
2787 case \"\$destdir\" in
2788 [\\\\/]* | [A-Za-z]:[\\\\/]*) thisdir=\"\$destdir\" ;;
2789 *) thisdir=\"\$thisdir/\$destdir\" ;;
2790 esac
2793 file=\`\$ECHO \"X\$file\" | \$Xsed -e 's%^.*/%%'\`
2794 file=\`ls -ld \"\$thisdir/\$file\" | ${SED} -n 's/.*-> //p'\`
2795 done
2798 # end: func_emit_wrapper_part1
2800 # func_emit_wrapper_part2 [arg=no]
2802 # Emit the second part of a libtool wrapper script on stdout.
2803 # For more information, see the description associated with
2804 # func_emit_wrapper(), below.
2805 func_emit_wrapper_part2 ()
2807 func_emit_wrapper_part2_arg1=no
2808 if test -n "$1" ; then
2809 func_emit_wrapper_part2_arg1=$1
2812 $ECHO "\
2814 # Usually 'no', except on cygwin/mingw when embedded into
2815 # the cwrapper.
2816 WRAPPER_SCRIPT_BELONGS_IN_OBJDIR=$func_emit_wrapper_part2_arg1
2817 if test \"\$WRAPPER_SCRIPT_BELONGS_IN_OBJDIR\" = \"yes\"; then
2818 # special case for '.'
2819 if test \"\$thisdir\" = \".\"; then
2820 thisdir=\`pwd\`
2822 # remove .libs from thisdir
2823 case \"\$thisdir\" in
2824 *[\\\\/]$objdir ) thisdir=\`\$ECHO \"X\$thisdir\" | \$Xsed -e 's%[\\\\/][^\\\\/]*$%%'\` ;;
2825 $objdir ) thisdir=. ;;
2826 esac
2829 # Try to get the absolute directory name.
2830 absdir=\`cd \"\$thisdir\" && pwd\`
2831 test -n \"\$absdir\" && thisdir=\"\$absdir\"
2834 if test "$fast_install" = yes; then
2835 $ECHO "\
2836 program=lt-'$outputname'$exeext
2837 progdir=\"\$thisdir/$objdir\"
2839 if test ! -f \"\$progdir/\$program\" ||
2840 { file=\`ls -1dt \"\$progdir/\$program\" \"\$progdir/../\$program\" 2>/dev/null | ${SED} 1q\`; \\
2841 test \"X\$file\" != \"X\$progdir/\$program\"; }; then
2843 file=\"\$\$-\$program\"
2845 if test ! -d \"\$progdir\"; then
2846 $MKDIR \"\$progdir\"
2847 else
2848 $RM \"\$progdir/\$file\"
2851 $ECHO "\
2853 # relink executable if necessary
2854 if test -n \"\$relink_command\"; then
2855 if relink_command_output=\`eval \$relink_command 2>&1\`; then :
2856 else
2857 $ECHO \"\$relink_command_output\" >&2
2858 $RM \"\$progdir/\$file\"
2859 exit 1
2863 $MV \"\$progdir/\$file\" \"\$progdir/\$program\" 2>/dev/null ||
2864 { $RM \"\$progdir/\$program\";
2865 $MV \"\$progdir/\$file\" \"\$progdir/\$program\"; }
2866 $RM \"\$progdir/\$file\"
2868 else
2869 $ECHO "\
2870 program='$outputname'
2871 progdir=\"\$thisdir/$objdir\"
2875 $ECHO "\
2877 if test -f \"\$progdir/\$program\"; then"
2879 # Export our shlibpath_var if we have one.
2880 if test "$shlibpath_overrides_runpath" = yes && test -n "$shlibpath_var" && test -n "$temp_rpath"; then
2881 $ECHO "\
2882 # Add our own library path to $shlibpath_var
2883 $shlibpath_var=\"$temp_rpath\$$shlibpath_var\"
2885 # Some systems cannot cope with colon-terminated $shlibpath_var
2886 # The second colon is a workaround for a bug in BeOS R4 sed
2887 $shlibpath_var=\`\$ECHO \"X\$$shlibpath_var\" | \$Xsed -e 's/::*\$//'\`
2889 export $shlibpath_var
2893 # fixup the dll searchpath if we need to.
2894 if test -n "$dllsearchpath"; then
2895 $ECHO "\
2896 # Add the dll search path components to the executable PATH
2897 PATH=$dllsearchpath:\$PATH
2901 $ECHO "\
2902 if test \"\$libtool_execute_magic\" != \"$magic\"; then
2903 # Run the actual program with our arguments.
2905 case $host in
2906 # Backslashes separate directories on plain windows
2907 *-*-mingw | *-*-os2* | *-cegcc*)
2908 $ECHO "\
2909 exec \"\$progdir\\\\\$program\" \${1+\"\$@\"}
2914 $ECHO "\
2915 exec \"\$progdir/\$program\" \${1+\"\$@\"}
2918 esac
2919 $ECHO "\
2920 \$ECHO \"\$0: cannot exec \$program \$*\" 1>&2
2921 exit 1
2923 else
2924 # The program doesn't exist.
2925 \$ECHO \"\$0: error: \\\`\$progdir/\$program' does not exist\" 1>&2
2926 \$ECHO \"This script is just a wrapper for \$program.\" 1>&2
2927 $ECHO \"See the $PACKAGE documentation for more information.\" 1>&2
2928 exit 1
2933 # end: func_emit_wrapper_part2
2936 # func_emit_wrapper [arg=no]
2938 # Emit a libtool wrapper script on stdout.
2939 # Don't directly open a file because we may want to
2940 # incorporate the script contents within a cygwin/mingw
2941 # wrapper executable. Must ONLY be called from within
2942 # func_mode_link because it depends on a number of variables
2943 # set therein.
2945 # ARG is the value that the WRAPPER_SCRIPT_BELONGS_IN_OBJDIR
2946 # variable will take. If 'yes', then the emitted script
2947 # will assume that the directory in which it is stored is
2948 # the $objdir directory. This is a cygwin/mingw-specific
2949 # behavior.
2950 func_emit_wrapper ()
2952 func_emit_wrapper_arg1=no
2953 if test -n "$1" ; then
2954 func_emit_wrapper_arg1=$1
2957 # split this up so that func_emit_cwrapperexe_src
2958 # can call each part independently.
2959 func_emit_wrapper_part1 "${func_emit_wrapper_arg1}"
2960 func_emit_wrapper_part2 "${func_emit_wrapper_arg1}"
2964 # func_to_host_path arg
2966 # Convert paths to host format when used with build tools.
2967 # Intended for use with "native" mingw (where libtool itself
2968 # is running under the msys shell), or in the following cross-
2969 # build environments:
2970 # $build $host
2971 # mingw (msys) mingw [e.g. native]
2972 # cygwin mingw
2973 # *nix + wine mingw
2974 # where wine is equipped with the `winepath' executable.
2975 # In the native mingw case, the (msys) shell automatically
2976 # converts paths for any non-msys applications it launches,
2977 # but that facility isn't available from inside the cwrapper.
2978 # Similar accommodations are necessary for $host mingw and
2979 # $build cygwin. Calling this function does no harm for other
2980 # $host/$build combinations not listed above.
2982 # ARG is the path (on $build) that should be converted to
2983 # the proper representation for $host. The result is stored
2984 # in $func_to_host_path_result.
2985 func_to_host_path ()
2987 func_to_host_path_result="$1"
2988 if test -n "$1" ; then
2989 case $host in
2990 *mingw* )
2991 lt_sed_naive_backslashify='s|\\\\*|\\|g;s|/|\\|g;s|\\|\\\\|g'
2992 case $build in
2993 *mingw* ) # actually, msys
2994 # awkward: cmd appends spaces to result
2995 lt_sed_strip_trailing_spaces="s/[ ]*\$//"
2996 func_to_host_path_tmp1=`( cmd //c echo "$1" |\
2997 $SED -e "$lt_sed_strip_trailing_spaces" ) 2>/dev/null || echo ""`
2998 func_to_host_path_result=`echo "$func_to_host_path_tmp1" |\
2999 $SED -e "$lt_sed_naive_backslashify"`
3001 *cygwin* )
3002 func_to_host_path_tmp1=`cygpath -w "$1"`
3003 func_to_host_path_result=`echo "$func_to_host_path_tmp1" |\
3004 $SED -e "$lt_sed_naive_backslashify"`
3007 # Unfortunately, winepath does not exit with a non-zero
3008 # error code, so we are forced to check the contents of
3009 # stdout. On the other hand, if the command is not
3010 # found, the shell will set an exit code of 127 and print
3011 # *an error message* to stdout. So we must check for both
3012 # error code of zero AND non-empty stdout, which explains
3013 # the odd construction:
3014 func_to_host_path_tmp1=`winepath -w "$1" 2>/dev/null`
3015 if test "$?" -eq 0 && test -n "${func_to_host_path_tmp1}"; then
3016 func_to_host_path_result=`echo "$func_to_host_path_tmp1" |\
3017 $SED -e "$lt_sed_naive_backslashify"`
3018 else
3019 # Allow warning below.
3020 func_to_host_path_result=""
3023 esac
3024 if test -z "$func_to_host_path_result" ; then
3025 func_error "Could not determine host path corresponding to"
3026 func_error " '$1'"
3027 func_error "Continuing, but uninstalled executables may not work."
3028 # Fallback:
3029 func_to_host_path_result="$1"
3032 esac
3035 # end: func_to_host_path
3037 # func_to_host_pathlist arg
3039 # Convert pathlists to host format when used with build tools.
3040 # See func_to_host_path(), above. This function supports the
3041 # following $build/$host combinations (but does no harm for
3042 # combinations not listed here):
3043 # $build $host
3044 # mingw (msys) mingw [e.g. native]
3045 # cygwin mingw
3046 # *nix + wine mingw
3048 # Path separators are also converted from $build format to
3049 # $host format. If ARG begins or ends with a path separator
3050 # character, it is preserved (but converted to $host format)
3051 # on output.
3053 # ARG is a pathlist (on $build) that should be converted to
3054 # the proper representation on $host. The result is stored
3055 # in $func_to_host_pathlist_result.
3056 func_to_host_pathlist ()
3058 func_to_host_pathlist_result="$1"
3059 if test -n "$1" ; then
3060 case $host in
3061 *mingw* )
3062 lt_sed_naive_backslashify='s|\\\\*|\\|g;s|/|\\|g;s|\\|\\\\|g'
3063 # Remove leading and trailing path separator characters from
3064 # ARG. msys behavior is inconsistent here, cygpath turns them
3065 # into '.;' and ';.', and winepath ignores them completely.
3066 func_to_host_pathlist_tmp2="$1"
3067 # Once set for this call, this variable should not be
3068 # reassigned. It is used in tha fallback case.
3069 func_to_host_pathlist_tmp1=`echo "$func_to_host_pathlist_tmp2" |\
3070 $SED -e 's|^:*||' -e 's|:*$||'`
3071 case $build in
3072 *mingw* ) # Actually, msys.
3073 # Awkward: cmd appends spaces to result.
3074 lt_sed_strip_trailing_spaces="s/[ ]*\$//"
3075 func_to_host_pathlist_tmp2=`( cmd //c echo "$func_to_host_pathlist_tmp1" |\
3076 $SED -e "$lt_sed_strip_trailing_spaces" ) 2>/dev/null || echo ""`
3077 func_to_host_pathlist_result=`echo "$func_to_host_pathlist_tmp2" |\
3078 $SED -e "$lt_sed_naive_backslashify"`
3080 *cygwin* )
3081 func_to_host_pathlist_tmp2=`cygpath -w -p "$func_to_host_pathlist_tmp1"`
3082 func_to_host_pathlist_result=`echo "$func_to_host_pathlist_tmp2" |\
3083 $SED -e "$lt_sed_naive_backslashify"`
3086 # unfortunately, winepath doesn't convert pathlists
3087 func_to_host_pathlist_result=""
3088 func_to_host_pathlist_oldIFS=$IFS
3089 IFS=:
3090 for func_to_host_pathlist_f in $func_to_host_pathlist_tmp1 ; do
3091 IFS=$func_to_host_pathlist_oldIFS
3092 if test -n "$func_to_host_pathlist_f" ; then
3093 func_to_host_path "$func_to_host_pathlist_f"
3094 if test -n "$func_to_host_path_result" ; then
3095 if test -z "$func_to_host_pathlist_result" ; then
3096 func_to_host_pathlist_result="$func_to_host_path_result"
3097 else
3098 func_to_host_pathlist_result="$func_to_host_pathlist_result;$func_to_host_path_result"
3102 IFS=:
3103 done
3104 IFS=$func_to_host_pathlist_oldIFS
3106 esac
3107 if test -z "$func_to_host_pathlist_result" ; then
3108 func_error "Could not determine the host path(s) corresponding to"
3109 func_error " '$1'"
3110 func_error "Continuing, but uninstalled executables may not work."
3111 # Fallback. This may break if $1 contains DOS-style drive
3112 # specifications. The fix is not to complicate the expression
3113 # below, but for the user to provide a working wine installation
3114 # with winepath so that path translation in the cross-to-mingw
3115 # case works properly.
3116 lt_replace_pathsep_nix_to_dos="s|:|;|g"
3117 func_to_host_pathlist_result=`echo "$func_to_host_pathlist_tmp1" |\
3118 $SED -e "$lt_replace_pathsep_nix_to_dos"`
3120 # Now, add the leading and trailing path separators back
3121 case "$1" in
3122 :* ) func_to_host_pathlist_result=";$func_to_host_pathlist_result"
3124 esac
3125 case "$1" in
3126 *: ) func_to_host_pathlist_result="$func_to_host_pathlist_result;"
3128 esac
3130 esac
3133 # end: func_to_host_pathlist
3135 # func_emit_cwrapperexe_src
3136 # emit the source code for a wrapper executable on stdout
3137 # Must ONLY be called from within func_mode_link because
3138 # it depends on a number of variable set therein.
3139 func_emit_cwrapperexe_src ()
3141 cat <<EOF
3143 /* $cwrappersource - temporary wrapper executable for $objdir/$outputname
3144 Generated by $PROGRAM (GNU $PACKAGE$TIMESTAMP) $VERSION
3146 The $output program cannot be directly executed until all the libtool
3147 libraries that it depends on are installed.
3149 This wrapper executable should never be moved out of the build directory.
3150 If it is, it will not operate correctly.
3152 Currently, it simply execs the wrapper *script* "$SHELL $output",
3153 but could eventually absorb all of the scripts functionality and
3154 exec $objdir/$outputname directly.
3157 cat <<"EOF"
3158 #include <stdio.h>
3159 #include <stdlib.h>
3160 #ifdef _MSC_VER
3161 # include <direct.h>
3162 # include <process.h>
3163 # include <io.h>
3164 # define setmode _setmode
3165 #else
3166 # include <unistd.h>
3167 # include <stdint.h>
3168 # ifdef __CYGWIN__
3169 # include <io.h>
3170 # define HAVE_SETENV
3171 # ifdef __STRICT_ANSI__
3172 char *realpath (const char *, char *);
3173 int putenv (char *);
3174 int setenv (const char *, const char *, int);
3175 # endif
3176 # endif
3177 #endif
3178 #include <malloc.h>
3179 #include <stdarg.h>
3180 #include <assert.h>
3181 #include <string.h>
3182 #include <ctype.h>
3183 #include <errno.h>
3184 #include <fcntl.h>
3185 #include <sys/stat.h>
3187 #if defined(PATH_MAX)
3188 # define LT_PATHMAX PATH_MAX
3189 #elif defined(MAXPATHLEN)
3190 # define LT_PATHMAX MAXPATHLEN
3191 #else
3192 # define LT_PATHMAX 1024
3193 #endif
3195 #ifndef S_IXOTH
3196 # define S_IXOTH 0
3197 #endif
3198 #ifndef S_IXGRP
3199 # define S_IXGRP 0
3200 #endif
3202 #ifdef _MSC_VER
3203 # define S_IXUSR _S_IEXEC
3204 # define stat _stat
3205 # ifndef _INTPTR_T_DEFINED
3206 # define intptr_t int
3207 # endif
3208 #endif
3210 #ifndef DIR_SEPARATOR
3211 # define DIR_SEPARATOR '/'
3212 # define PATH_SEPARATOR ':'
3213 #endif
3215 #if defined (_WIN32) || defined (__MSDOS__) || defined (__DJGPP__) || \
3216 defined (__OS2__)
3217 # define HAVE_DOS_BASED_FILE_SYSTEM
3218 # define FOPEN_WB "wb"
3219 # ifndef DIR_SEPARATOR_2
3220 # define DIR_SEPARATOR_2 '\\'
3221 # endif
3222 # ifndef PATH_SEPARATOR_2
3223 # define PATH_SEPARATOR_2 ';'
3224 # endif
3225 #endif
3227 #ifndef DIR_SEPARATOR_2
3228 # define IS_DIR_SEPARATOR(ch) ((ch) == DIR_SEPARATOR)
3229 #else /* DIR_SEPARATOR_2 */
3230 # define IS_DIR_SEPARATOR(ch) \
3231 (((ch) == DIR_SEPARATOR) || ((ch) == DIR_SEPARATOR_2))
3232 #endif /* DIR_SEPARATOR_2 */
3234 #ifndef PATH_SEPARATOR_2
3235 # define IS_PATH_SEPARATOR(ch) ((ch) == PATH_SEPARATOR)
3236 #else /* PATH_SEPARATOR_2 */
3237 # define IS_PATH_SEPARATOR(ch) ((ch) == PATH_SEPARATOR_2)
3238 #endif /* PATH_SEPARATOR_2 */
3240 #ifdef __CYGWIN__
3241 # define FOPEN_WB "wb"
3242 #endif
3244 #ifndef FOPEN_WB
3245 # define FOPEN_WB "w"
3246 #endif
3247 #ifndef _O_BINARY
3248 # define _O_BINARY 0
3249 #endif
3251 #define XMALLOC(type, num) ((type *) xmalloc ((num) * sizeof(type)))
3252 #define XFREE(stale) do { \
3253 if (stale) { free ((void *) stale); stale = 0; } \
3254 } while (0)
3256 #undef LTWRAPPER_DEBUGPRINTF
3257 #if defined DEBUGWRAPPER
3258 # define LTWRAPPER_DEBUGPRINTF(args) ltwrapper_debugprintf args
3259 static void
3260 ltwrapper_debugprintf (const char *fmt, ...)
3262 va_list args;
3263 va_start (args, fmt);
3264 (void) vfprintf (stderr, fmt, args);
3265 va_end (args);
3267 #else
3268 # define LTWRAPPER_DEBUGPRINTF(args)
3269 #endif
3271 const char *program_name = NULL;
3273 void *xmalloc (size_t num);
3274 char *xstrdup (const char *string);
3275 const char *base_name (const char *name);
3276 char *find_executable (const char *wrapper);
3277 char *chase_symlinks (const char *pathspec);
3278 int make_executable (const char *path);
3279 int check_executable (const char *path);
3280 char *strendzap (char *str, const char *pat);
3281 void lt_fatal (const char *message, ...);
3282 void lt_setenv (const char *name, const char *value);
3283 char *lt_extend_str (const char *orig_value, const char *add, int to_end);
3284 void lt_opt_process_env_set (const char *arg);
3285 void lt_opt_process_env_prepend (const char *arg);
3286 void lt_opt_process_env_append (const char *arg);
3287 int lt_split_name_value (const char *arg, char** name, char** value);
3288 void lt_update_exe_path (const char *name, const char *value);
3289 void lt_update_lib_path (const char *name, const char *value);
3291 static const char *script_text_part1 =
3294 func_emit_wrapper_part1 yes |
3295 $SED -e 's/\([\\"]\)/\\\1/g' \
3296 -e 's/^/ "/' -e 's/$/\\n"/'
3297 echo ";"
3298 cat <<EOF
3300 static const char *script_text_part2 =
3302 func_emit_wrapper_part2 yes |
3303 $SED -e 's/\([\\"]\)/\\\1/g' \
3304 -e 's/^/ "/' -e 's/$/\\n"/'
3305 echo ";"
3307 cat <<EOF
3308 const char * MAGIC_EXE = "$magic_exe";
3309 const char * LIB_PATH_VARNAME = "$shlibpath_var";
3312 if test "$shlibpath_overrides_runpath" = yes && test -n "$shlibpath_var" && test -n "$temp_rpath"; then
3313 func_to_host_pathlist "$temp_rpath"
3314 cat <<EOF
3315 const char * LIB_PATH_VALUE = "$func_to_host_pathlist_result";
3317 else
3318 cat <<"EOF"
3319 const char * LIB_PATH_VALUE = "";
3323 if test -n "$dllsearchpath"; then
3324 func_to_host_pathlist "$dllsearchpath:"
3325 cat <<EOF
3326 const char * EXE_PATH_VARNAME = "PATH";
3327 const char * EXE_PATH_VALUE = "$func_to_host_pathlist_result";
3329 else
3330 cat <<"EOF"
3331 const char * EXE_PATH_VARNAME = "";
3332 const char * EXE_PATH_VALUE = "";
3336 if test "$fast_install" = yes; then
3337 cat <<EOF
3338 const char * TARGET_PROGRAM_NAME = "lt-$outputname"; /* hopefully, no .exe */
3340 else
3341 cat <<EOF
3342 const char * TARGET_PROGRAM_NAME = "$outputname"; /* hopefully, no .exe */
3347 cat <<"EOF"
3349 #define LTWRAPPER_OPTION_PREFIX "--lt-"
3350 #define LTWRAPPER_OPTION_PREFIX_LENGTH 5
3352 static const size_t opt_prefix_len = LTWRAPPER_OPTION_PREFIX_LENGTH;
3353 static const char *ltwrapper_option_prefix = LTWRAPPER_OPTION_PREFIX;
3355 static const char *dumpscript_opt = LTWRAPPER_OPTION_PREFIX "dump-script";
3357 static const size_t env_set_opt_len = LTWRAPPER_OPTION_PREFIX_LENGTH + 7;
3358 static const char *env_set_opt = LTWRAPPER_OPTION_PREFIX "env-set";
3359 /* argument is putenv-style "foo=bar", value of foo is set to bar */
3361 static const size_t env_prepend_opt_len = LTWRAPPER_OPTION_PREFIX_LENGTH + 11;
3362 static const char *env_prepend_opt = LTWRAPPER_OPTION_PREFIX "env-prepend";
3363 /* argument is putenv-style "foo=bar", new value of foo is bar${foo} */
3365 static const size_t env_append_opt_len = LTWRAPPER_OPTION_PREFIX_LENGTH + 10;
3366 static const char *env_append_opt = LTWRAPPER_OPTION_PREFIX "env-append";
3367 /* argument is putenv-style "foo=bar", new value of foo is ${foo}bar */
3370 main (int argc, char *argv[])
3372 char **newargz;
3373 int newargc;
3374 char *tmp_pathspec;
3375 char *actual_cwrapper_path;
3376 char *actual_cwrapper_name;
3377 char *target_name;
3378 char *lt_argv_zero;
3379 intptr_t rval = 127;
3381 int i;
3383 program_name = (char *) xstrdup (base_name (argv[0]));
3384 LTWRAPPER_DEBUGPRINTF (("(main) argv[0] : %s\n", argv[0]));
3385 LTWRAPPER_DEBUGPRINTF (("(main) program_name : %s\n", program_name));
3387 /* very simple arg parsing; don't want to rely on getopt */
3388 for (i = 1; i < argc; i++)
3390 if (strcmp (argv[i], dumpscript_opt) == 0)
3393 case "$host" in
3394 *mingw* | *cygwin* )
3395 # make stdout use "unix" line endings
3396 echo " setmode(1,_O_BINARY);"
3398 esac
3400 cat <<"EOF"
3401 printf ("%s", script_text_part1);
3402 printf ("%s", script_text_part2);
3403 return 0;
3407 newargz = XMALLOC (char *, argc + 1);
3408 tmp_pathspec = find_executable (argv[0]);
3409 if (tmp_pathspec == NULL)
3410 lt_fatal ("Couldn't find %s", argv[0]);
3411 LTWRAPPER_DEBUGPRINTF (("(main) found exe (before symlink chase) at : %s\n",
3412 tmp_pathspec));
3414 actual_cwrapper_path = chase_symlinks (tmp_pathspec);
3415 LTWRAPPER_DEBUGPRINTF (("(main) found exe (after symlink chase) at : %s\n",
3416 actual_cwrapper_path));
3417 XFREE (tmp_pathspec);
3419 actual_cwrapper_name = xstrdup( base_name (actual_cwrapper_path));
3420 strendzap (actual_cwrapper_path, actual_cwrapper_name);
3422 /* wrapper name transforms */
3423 strendzap (actual_cwrapper_name, ".exe");
3424 tmp_pathspec = lt_extend_str (actual_cwrapper_name, ".exe", 1);
3425 XFREE (actual_cwrapper_name);
3426 actual_cwrapper_name = tmp_pathspec;
3427 tmp_pathspec = 0;
3429 /* target_name transforms -- use actual target program name; might have lt- prefix */
3430 target_name = xstrdup (base_name (TARGET_PROGRAM_NAME));
3431 strendzap (target_name, ".exe");
3432 tmp_pathspec = lt_extend_str (target_name, ".exe", 1);
3433 XFREE (target_name);
3434 target_name = tmp_pathspec;
3435 tmp_pathspec = 0;
3437 LTWRAPPER_DEBUGPRINTF (("(main) libtool target name: %s\n",
3438 target_name));
3441 cat <<EOF
3442 newargz[0] =
3443 XMALLOC (char, (strlen (actual_cwrapper_path) +
3444 strlen ("$objdir") + 1 + strlen (actual_cwrapper_name) + 1));
3445 strcpy (newargz[0], actual_cwrapper_path);
3446 strcat (newargz[0], "$objdir");
3447 strcat (newargz[0], "/");
3450 cat <<"EOF"
3451 /* stop here, and copy so we don't have to do this twice */
3452 tmp_pathspec = xstrdup (newargz[0]);
3454 /* do NOT want the lt- prefix here, so use actual_cwrapper_name */
3455 strcat (newargz[0], actual_cwrapper_name);
3457 /* DO want the lt- prefix here if it exists, so use target_name */
3458 lt_argv_zero = lt_extend_str (tmp_pathspec, target_name, 1);
3459 XFREE (tmp_pathspec);
3460 tmp_pathspec = NULL;
3463 case $host_os in
3464 mingw*)
3465 cat <<"EOF"
3467 char* p;
3468 while ((p = strchr (newargz[0], '\\')) != NULL)
3470 *p = '/';
3472 while ((p = strchr (lt_argv_zero, '\\')) != NULL)
3474 *p = '/';
3479 esac
3481 cat <<"EOF"
3482 XFREE (target_name);
3483 XFREE (actual_cwrapper_path);
3484 XFREE (actual_cwrapper_name);
3486 lt_setenv ("BIN_SH", "xpg4"); /* for Tru64 */
3487 lt_setenv ("DUALCASE", "1"); /* for MSK sh */
3488 lt_update_lib_path (LIB_PATH_VARNAME, LIB_PATH_VALUE);
3489 lt_update_exe_path (EXE_PATH_VARNAME, EXE_PATH_VALUE);
3491 newargc=0;
3492 for (i = 1; i < argc; i++)
3494 if (strncmp (argv[i], env_set_opt, env_set_opt_len) == 0)
3496 if (argv[i][env_set_opt_len] == '=')
3498 const char *p = argv[i] + env_set_opt_len + 1;
3499 lt_opt_process_env_set (p);
3501 else if (argv[i][env_set_opt_len] == '\0' && i + 1 < argc)
3503 lt_opt_process_env_set (argv[++i]); /* don't copy */
3505 else
3506 lt_fatal ("%s missing required argument", env_set_opt);
3507 continue;
3509 if (strncmp (argv[i], env_prepend_opt, env_prepend_opt_len) == 0)
3511 if (argv[i][env_prepend_opt_len] == '=')
3513 const char *p = argv[i] + env_prepend_opt_len + 1;
3514 lt_opt_process_env_prepend (p);
3516 else if (argv[i][env_prepend_opt_len] == '\0' && i + 1 < argc)
3518 lt_opt_process_env_prepend (argv[++i]); /* don't copy */
3520 else
3521 lt_fatal ("%s missing required argument", env_prepend_opt);
3522 continue;
3524 if (strncmp (argv[i], env_append_opt, env_append_opt_len) == 0)
3526 if (argv[i][env_append_opt_len] == '=')
3528 const char *p = argv[i] + env_append_opt_len + 1;
3529 lt_opt_process_env_append (p);
3531 else if (argv[i][env_append_opt_len] == '\0' && i + 1 < argc)
3533 lt_opt_process_env_append (argv[++i]); /* don't copy */
3535 else
3536 lt_fatal ("%s missing required argument", env_append_opt);
3537 continue;
3539 if (strncmp (argv[i], ltwrapper_option_prefix, opt_prefix_len) == 0)
3541 /* however, if there is an option in the LTWRAPPER_OPTION_PREFIX
3542 namespace, but it is not one of the ones we know about and
3543 have already dealt with, above (inluding dump-script), then
3544 report an error. Otherwise, targets might begin to believe
3545 they are allowed to use options in the LTWRAPPER_OPTION_PREFIX
3546 namespace. The first time any user complains about this, we'll
3547 need to make LTWRAPPER_OPTION_PREFIX a configure-time option
3548 or a configure.ac-settable value.
3550 lt_fatal ("Unrecognized option in %s namespace: '%s'",
3551 ltwrapper_option_prefix, argv[i]);
3553 /* otherwise ... */
3554 newargz[++newargc] = xstrdup (argv[i]);
3556 newargz[++newargc] = NULL;
3558 LTWRAPPER_DEBUGPRINTF (("(main) lt_argv_zero : %s\n", (lt_argv_zero ? lt_argv_zero : "<NULL>")));
3559 for (i = 0; i < newargc; i++)
3561 LTWRAPPER_DEBUGPRINTF (("(main) newargz[%d] : %s\n", i, (newargz[i] ? newargz[i] : "<NULL>")));
3566 case $host_os in
3567 mingw*)
3568 cat <<"EOF"
3569 /* execv doesn't actually work on mingw as expected on unix */
3570 rval = _spawnv (_P_WAIT, lt_argv_zero, (const char * const *) newargz);
3571 if (rval == -1)
3573 /* failed to start process */
3574 LTWRAPPER_DEBUGPRINTF (("(main) failed to launch target \"%s\": errno = %d\n", lt_argv_zero, errno));
3575 return 127;
3577 return rval;
3581 cat <<"EOF"
3582 execv (lt_argv_zero, newargz);
3583 return rval; /* =127, but avoids unused variable warning */
3586 esac
3588 cat <<"EOF"
3591 void *
3592 xmalloc (size_t num)
3594 void *p = (void *) malloc (num);
3595 if (!p)
3596 lt_fatal ("Memory exhausted");
3598 return p;
3601 char *
3602 xstrdup (const char *string)
3604 return string ? strcpy ((char *) xmalloc (strlen (string) + 1),
3605 string) : NULL;
3608 const char *
3609 base_name (const char *name)
3611 const char *base;
3613 #if defined (HAVE_DOS_BASED_FILE_SYSTEM)
3614 /* Skip over the disk name in MSDOS pathnames. */
3615 if (isalpha ((unsigned char) name[0]) && name[1] == ':')
3616 name += 2;
3617 #endif
3619 for (base = name; *name; name++)
3620 if (IS_DIR_SEPARATOR (*name))
3621 base = name + 1;
3622 return base;
3626 check_executable (const char *path)
3628 struct stat st;
3630 LTWRAPPER_DEBUGPRINTF (("(check_executable) : %s\n",
3631 path ? (*path ? path : "EMPTY!") : "NULL!"));
3632 if ((!path) || (!*path))
3633 return 0;
3635 if ((stat (path, &st) >= 0)
3636 && (st.st_mode & (S_IXUSR | S_IXGRP | S_IXOTH)))
3637 return 1;
3638 else
3639 return 0;
3643 make_executable (const char *path)
3645 int rval = 0;
3646 struct stat st;
3648 LTWRAPPER_DEBUGPRINTF (("(make_executable) : %s\n",
3649 path ? (*path ? path : "EMPTY!") : "NULL!"));
3650 if ((!path) || (!*path))
3651 return 0;
3653 if (stat (path, &st) >= 0)
3655 rval = chmod (path, st.st_mode | S_IXOTH | S_IXGRP | S_IXUSR);
3657 return rval;
3660 /* Searches for the full path of the wrapper. Returns
3661 newly allocated full path name if found, NULL otherwise
3662 Does not chase symlinks, even on platforms that support them.
3664 char *
3665 find_executable (const char *wrapper)
3667 int has_slash = 0;
3668 const char *p;
3669 const char *p_next;
3670 /* static buffer for getcwd */
3671 char tmp[LT_PATHMAX + 1];
3672 int tmp_len;
3673 char *concat_name;
3675 LTWRAPPER_DEBUGPRINTF (("(find_executable) : %s\n",
3676 wrapper ? (*wrapper ? wrapper : "EMPTY!") : "NULL!"));
3678 if ((wrapper == NULL) || (*wrapper == '\0'))
3679 return NULL;
3681 /* Absolute path? */
3682 #if defined (HAVE_DOS_BASED_FILE_SYSTEM)
3683 if (isalpha ((unsigned char) wrapper[0]) && wrapper[1] == ':')
3685 concat_name = xstrdup (wrapper);
3686 if (check_executable (concat_name))
3687 return concat_name;
3688 XFREE (concat_name);
3690 else
3692 #endif
3693 if (IS_DIR_SEPARATOR (wrapper[0]))
3695 concat_name = xstrdup (wrapper);
3696 if (check_executable (concat_name))
3697 return concat_name;
3698 XFREE (concat_name);
3700 #if defined (HAVE_DOS_BASED_FILE_SYSTEM)
3702 #endif
3704 for (p = wrapper; *p; p++)
3705 if (*p == '/')
3707 has_slash = 1;
3708 break;
3710 if (!has_slash)
3712 /* no slashes; search PATH */
3713 const char *path = getenv ("PATH");
3714 if (path != NULL)
3716 for (p = path; *p; p = p_next)
3718 const char *q;
3719 size_t p_len;
3720 for (q = p; *q; q++)
3721 if (IS_PATH_SEPARATOR (*q))
3722 break;
3723 p_len = q - p;
3724 p_next = (*q == '\0' ? q : q + 1);
3725 if (p_len == 0)
3727 /* empty path: current directory */
3728 if (getcwd (tmp, LT_PATHMAX) == NULL)
3729 lt_fatal ("getcwd failed");
3730 tmp_len = strlen (tmp);
3731 concat_name =
3732 XMALLOC (char, tmp_len + 1 + strlen (wrapper) + 1);
3733 memcpy (concat_name, tmp, tmp_len);
3734 concat_name[tmp_len] = '/';
3735 strcpy (concat_name + tmp_len + 1, wrapper);
3737 else
3739 concat_name =
3740 XMALLOC (char, p_len + 1 + strlen (wrapper) + 1);
3741 memcpy (concat_name, p, p_len);
3742 concat_name[p_len] = '/';
3743 strcpy (concat_name + p_len + 1, wrapper);
3745 if (check_executable (concat_name))
3746 return concat_name;
3747 XFREE (concat_name);
3750 /* not found in PATH; assume curdir */
3752 /* Relative path | not found in path: prepend cwd */
3753 if (getcwd (tmp, LT_PATHMAX) == NULL)
3754 lt_fatal ("getcwd failed");
3755 tmp_len = strlen (tmp);
3756 concat_name = XMALLOC (char, tmp_len + 1 + strlen (wrapper) + 1);
3757 memcpy (concat_name, tmp, tmp_len);
3758 concat_name[tmp_len] = '/';
3759 strcpy (concat_name + tmp_len + 1, wrapper);
3761 if (check_executable (concat_name))
3762 return concat_name;
3763 XFREE (concat_name);
3764 return NULL;
3767 char *
3768 chase_symlinks (const char *pathspec)
3770 #ifndef S_ISLNK
3771 return xstrdup (pathspec);
3772 #else
3773 char buf[LT_PATHMAX];
3774 struct stat s;
3775 char *tmp_pathspec = xstrdup (pathspec);
3776 char *p;
3777 int has_symlinks = 0;
3778 while (strlen (tmp_pathspec) && !has_symlinks)
3780 LTWRAPPER_DEBUGPRINTF (("checking path component for symlinks: %s\n",
3781 tmp_pathspec));
3782 if (lstat (tmp_pathspec, &s) == 0)
3784 if (S_ISLNK (s.st_mode) != 0)
3786 has_symlinks = 1;
3787 break;
3790 /* search backwards for last DIR_SEPARATOR */
3791 p = tmp_pathspec + strlen (tmp_pathspec) - 1;
3792 while ((p > tmp_pathspec) && (!IS_DIR_SEPARATOR (*p)))
3793 p--;
3794 if ((p == tmp_pathspec) && (!IS_DIR_SEPARATOR (*p)))
3796 /* no more DIR_SEPARATORS left */
3797 break;
3799 *p = '\0';
3801 else
3803 char *errstr = strerror (errno);
3804 lt_fatal ("Error accessing file %s (%s)", tmp_pathspec, errstr);
3807 XFREE (tmp_pathspec);
3809 if (!has_symlinks)
3811 return xstrdup (pathspec);
3814 tmp_pathspec = realpath (pathspec, buf);
3815 if (tmp_pathspec == 0)
3817 lt_fatal ("Could not follow symlinks for %s", pathspec);
3819 return xstrdup (tmp_pathspec);
3820 #endif
3823 char *
3824 strendzap (char *str, const char *pat)
3826 size_t len, patlen;
3828 assert (str != NULL);
3829 assert (pat != NULL);
3831 len = strlen (str);
3832 patlen = strlen (pat);
3834 if (patlen <= len)
3836 str += len - patlen;
3837 if (strcmp (str, pat) == 0)
3838 *str = '\0';
3840 return str;
3843 static void
3844 lt_error_core (int exit_status, const char *mode,
3845 const char *message, va_list ap)
3847 fprintf (stderr, "%s: %s: ", program_name, mode);
3848 vfprintf (stderr, message, ap);
3849 fprintf (stderr, ".\n");
3851 if (exit_status >= 0)
3852 exit (exit_status);
3855 void
3856 lt_fatal (const char *message, ...)
3858 va_list ap;
3859 va_start (ap, message);
3860 lt_error_core (EXIT_FAILURE, "FATAL", message, ap);
3861 va_end (ap);
3864 void
3865 lt_setenv (const char *name, const char *value)
3867 LTWRAPPER_DEBUGPRINTF (("(lt_setenv) setting '%s' to '%s'\n",
3868 (name ? name : "<NULL>"),
3869 (value ? value : "<NULL>")));
3871 #ifdef HAVE_SETENV
3872 /* always make a copy, for consistency with !HAVE_SETENV */
3873 char *str = xstrdup (value);
3874 setenv (name, str, 1);
3875 #else
3876 int len = strlen (name) + 1 + strlen (value) + 1;
3877 char *str = XMALLOC (char, len);
3878 sprintf (str, "%s=%s", name, value);
3879 if (putenv (str) != EXIT_SUCCESS)
3881 XFREE (str);
3883 #endif
3887 char *
3888 lt_extend_str (const char *orig_value, const char *add, int to_end)
3890 char *new_value;
3891 if (orig_value && *orig_value)
3893 int orig_value_len = strlen (orig_value);
3894 int add_len = strlen (add);
3895 new_value = XMALLOC (char, add_len + orig_value_len + 1);
3896 if (to_end)
3898 strcpy (new_value, orig_value);
3899 strcpy (new_value + orig_value_len, add);
3901 else
3903 strcpy (new_value, add);
3904 strcpy (new_value + add_len, orig_value);
3907 else
3909 new_value = xstrdup (add);
3911 return new_value;
3915 lt_split_name_value (const char *arg, char** name, char** value)
3917 const char *p;
3918 int len;
3919 if (!arg || !*arg)
3920 return 1;
3922 p = strchr (arg, (int)'=');
3924 if (!p)
3925 return 1;
3927 *value = xstrdup (++p);
3929 len = strlen (arg) - strlen (*value);
3930 *name = XMALLOC (char, len);
3931 strncpy (*name, arg, len-1);
3932 (*name)[len - 1] = '\0';
3934 return 0;
3937 void
3938 lt_opt_process_env_set (const char *arg)
3940 char *name = NULL;
3941 char *value = NULL;
3943 if (lt_split_name_value (arg, &name, &value) != 0)
3945 XFREE (name);
3946 XFREE (value);
3947 lt_fatal ("bad argument for %s: '%s'", env_set_opt, arg);
3950 lt_setenv (name, value);
3951 XFREE (name);
3952 XFREE (value);
3955 void
3956 lt_opt_process_env_prepend (const char *arg)
3958 char *name = NULL;
3959 char *value = NULL;
3960 char *new_value = NULL;
3962 if (lt_split_name_value (arg, &name, &value) != 0)
3964 XFREE (name);
3965 XFREE (value);
3966 lt_fatal ("bad argument for %s: '%s'", env_prepend_opt, arg);
3969 new_value = lt_extend_str (getenv (name), value, 0);
3970 lt_setenv (name, new_value);
3971 XFREE (new_value);
3972 XFREE (name);
3973 XFREE (value);
3976 void
3977 lt_opt_process_env_append (const char *arg)
3979 char *name = NULL;
3980 char *value = NULL;
3981 char *new_value = NULL;
3983 if (lt_split_name_value (arg, &name, &value) != 0)
3985 XFREE (name);
3986 XFREE (value);
3987 lt_fatal ("bad argument for %s: '%s'", env_append_opt, arg);
3990 new_value = lt_extend_str (getenv (name), value, 1);
3991 lt_setenv (name, new_value);
3992 XFREE (new_value);
3993 XFREE (name);
3994 XFREE (value);
3997 void
3998 lt_update_exe_path (const char *name, const char *value)
4000 LTWRAPPER_DEBUGPRINTF (("(lt_update_exe_path) modifying '%s' by prepending '%s'\n",
4001 (name ? name : "<NULL>"),
4002 (value ? value : "<NULL>")));
4004 if (name && *name && value && *value)
4006 char *new_value = lt_extend_str (getenv (name), value, 0);
4007 /* some systems can't cope with a ':'-terminated path #' */
4008 int len = strlen (new_value);
4009 while (((len = strlen (new_value)) > 0) && IS_PATH_SEPARATOR (new_value[len-1]))
4011 new_value[len-1] = '\0';
4013 lt_setenv (name, new_value);
4014 XFREE (new_value);
4018 void
4019 lt_update_lib_path (const char *name, const char *value)
4021 LTWRAPPER_DEBUGPRINTF (("(lt_update_lib_path) modifying '%s' by prepending '%s'\n",
4022 (name ? name : "<NULL>"),
4023 (value ? value : "<NULL>")));
4025 if (name && *name && value && *value)
4027 char *new_value = lt_extend_str (getenv (name), value, 0);
4028 lt_setenv (name, new_value);
4029 XFREE (new_value);
4036 # end: func_emit_cwrapperexe_src
4038 # func_mode_link arg...
4039 func_mode_link ()
4041 $opt_debug
4042 case $host in
4043 *-*-cygwin* | *-*-mingw* | *-*-pw32* | *-*-os2* | *-cegcc*)
4044 # It is impossible to link a dll without this setting, and
4045 # we shouldn't force the makefile maintainer to figure out
4046 # which system we are compiling for in order to pass an extra
4047 # flag for every libtool invocation.
4048 # allow_undefined=no
4050 # FIXME: Unfortunately, there are problems with the above when trying
4051 # to make a dll which has undefined symbols, in which case not
4052 # even a static library is built. For now, we need to specify
4053 # -no-undefined on the libtool link line when we can be certain
4054 # that all symbols are satisfied, otherwise we get a static library.
4055 allow_undefined=yes
4058 allow_undefined=yes
4060 esac
4061 libtool_args=$nonopt
4062 base_compile="$nonopt $@"
4063 compile_command=$nonopt
4064 finalize_command=$nonopt
4066 compile_rpath=
4067 finalize_rpath=
4068 compile_shlibpath=
4069 finalize_shlibpath=
4070 convenience=
4071 old_convenience=
4072 deplibs=
4073 old_deplibs=
4074 compiler_flags=
4075 linker_flags=
4076 dllsearchpath=
4077 lib_search_path=`pwd`
4078 inst_prefix_dir=
4079 new_inherited_linker_flags=
4081 avoid_version=no
4082 dlfiles=
4083 dlprefiles=
4084 dlself=no
4085 export_dynamic=no
4086 export_symbols=
4087 export_symbols_regex=
4088 generated=
4089 libobjs=
4090 ltlibs=
4091 module=no
4092 no_install=no
4093 objs=
4094 non_pic_objects=
4095 precious_files_regex=
4096 prefer_static_libs=no
4097 preload=no
4098 prev=
4099 prevarg=
4100 release=
4101 rpath=
4102 xrpath=
4103 perm_rpath=
4104 temp_rpath=
4105 thread_safe=no
4106 vinfo=
4107 vinfo_number=no
4108 weak_libs=
4109 single_module="${wl}-single_module"
4110 func_infer_tag $base_compile
4112 # We need to know -static, to get the right output filenames.
4113 for arg
4115 case $arg in
4116 -shared)
4117 test "$build_libtool_libs" != yes && \
4118 func_fatal_configuration "can not build a shared library"
4119 build_old_libs=no
4120 break
4122 -all-static | -static | -static-libtool-libs)
4123 case $arg in
4124 -all-static)
4125 if test "$build_libtool_libs" = yes && test -z "$link_static_flag"; then
4126 func_warning "complete static linking is impossible in this configuration"
4128 if test -n "$link_static_flag"; then
4129 dlopen_self=$dlopen_self_static
4131 prefer_static_libs=yes
4133 -static)
4134 if test -z "$pic_flag" && test -n "$link_static_flag"; then
4135 dlopen_self=$dlopen_self_static
4137 prefer_static_libs=built
4139 -static-libtool-libs)
4140 if test -z "$pic_flag" && test -n "$link_static_flag"; then
4141 dlopen_self=$dlopen_self_static
4143 prefer_static_libs=yes
4145 esac
4146 build_libtool_libs=no
4147 build_old_libs=yes
4148 break
4150 esac
4151 done
4153 # See if our shared archives depend on static archives.
4154 test -n "$old_archive_from_new_cmds" && build_old_libs=yes
4156 # Go through the arguments, transforming them on the way.
4157 while test "$#" -gt 0; do
4158 arg="$1"
4159 shift
4160 func_quote_for_eval "$arg"
4161 qarg=$func_quote_for_eval_unquoted_result
4162 func_append libtool_args " $func_quote_for_eval_result"
4164 # If the previous option needs an argument, assign it.
4165 if test -n "$prev"; then
4166 case $prev in
4167 output)
4168 func_append compile_command " @OUTPUT@"
4169 func_append finalize_command " @OUTPUT@"
4171 esac
4173 case $prev in
4174 dlfiles|dlprefiles)
4175 if test "$preload" = no; then
4176 # Add the symbol object into the linking commands.
4177 func_append compile_command " @SYMFILE@"
4178 func_append finalize_command " @SYMFILE@"
4179 preload=yes
4181 case $arg in
4182 *.la | *.lo) ;; # We handle these cases below.
4183 force)
4184 if test "$dlself" = no; then
4185 dlself=needless
4186 export_dynamic=yes
4188 prev=
4189 continue
4191 self)
4192 if test "$prev" = dlprefiles; then
4193 dlself=yes
4194 elif test "$prev" = dlfiles && test "$dlopen_self" != yes; then
4195 dlself=yes
4196 else
4197 dlself=needless
4198 export_dynamic=yes
4200 prev=
4201 continue
4204 if test "$prev" = dlfiles; then
4205 dlfiles="$dlfiles $arg"
4206 else
4207 dlprefiles="$dlprefiles $arg"
4209 prev=
4210 continue
4212 esac
4214 expsyms)
4215 export_symbols="$arg"
4216 test -f "$arg" \
4217 || func_fatal_error "symbol file \`$arg' does not exist"
4218 prev=
4219 continue
4221 expsyms_regex)
4222 export_symbols_regex="$arg"
4223 prev=
4224 continue
4226 framework)
4227 case $host in
4228 *-*-darwin*)
4229 case "$deplibs " in
4230 *" $qarg.ltframework "*) ;;
4231 *) deplibs="$deplibs $qarg.ltframework" # this is fixed later
4233 esac
4235 esac
4236 prev=
4237 continue
4239 inst_prefix)
4240 inst_prefix_dir="$arg"
4241 prev=
4242 continue
4244 objectlist)
4245 if test -f "$arg"; then
4246 save_arg=$arg
4247 moreargs=
4248 for fil in `cat "$save_arg"`
4250 # moreargs="$moreargs $fil"
4251 arg=$fil
4252 # A libtool-controlled object.
4254 # Check to see that this really is a libtool object.
4255 if func_lalib_unsafe_p "$arg"; then
4256 pic_object=
4257 non_pic_object=
4259 # Read the .lo file
4260 func_source "$arg"
4262 if test -z "$pic_object" ||
4263 test -z "$non_pic_object" ||
4264 test "$pic_object" = none &&
4265 test "$non_pic_object" = none; then
4266 func_fatal_error "cannot find name of object for \`$arg'"
4269 # Extract subdirectory from the argument.
4270 func_dirname "$arg" "/" ""
4271 xdir="$func_dirname_result"
4273 if test "$pic_object" != none; then
4274 # Prepend the subdirectory the object is found in.
4275 pic_object="$xdir$pic_object"
4277 if test "$prev" = dlfiles; then
4278 if test "$build_libtool_libs" = yes && test "$dlopen_support" = yes; then
4279 dlfiles="$dlfiles $pic_object"
4280 prev=
4281 continue
4282 else
4283 # If libtool objects are unsupported, then we need to preload.
4284 prev=dlprefiles
4288 # CHECK ME: I think I busted this. -Ossama
4289 if test "$prev" = dlprefiles; then
4290 # Preload the old-style object.
4291 dlprefiles="$dlprefiles $pic_object"
4292 prev=
4295 # A PIC object.
4296 func_append libobjs " $pic_object"
4297 arg="$pic_object"
4300 # Non-PIC object.
4301 if test "$non_pic_object" != none; then
4302 # Prepend the subdirectory the object is found in.
4303 non_pic_object="$xdir$non_pic_object"
4305 # A standard non-PIC object
4306 func_append non_pic_objects " $non_pic_object"
4307 if test -z "$pic_object" || test "$pic_object" = none ; then
4308 arg="$non_pic_object"
4310 else
4311 # If the PIC object exists, use it instead.
4312 # $xdir was prepended to $pic_object above.
4313 non_pic_object="$pic_object"
4314 func_append non_pic_objects " $non_pic_object"
4316 else
4317 # Only an error if not doing a dry-run.
4318 if $opt_dry_run; then
4319 # Extract subdirectory from the argument.
4320 func_dirname "$arg" "/" ""
4321 xdir="$func_dirname_result"
4323 func_lo2o "$arg"
4324 pic_object=$xdir$objdir/$func_lo2o_result
4325 non_pic_object=$xdir$func_lo2o_result
4326 func_append libobjs " $pic_object"
4327 func_append non_pic_objects " $non_pic_object"
4328 else
4329 func_fatal_error "\`$arg' is not a valid libtool object"
4332 done
4333 else
4334 func_fatal_error "link input file \`$arg' does not exist"
4336 arg=$save_arg
4337 prev=
4338 continue
4340 precious_regex)
4341 precious_files_regex="$arg"
4342 prev=
4343 continue
4345 release)
4346 release="-$arg"
4347 prev=
4348 continue
4350 rpath | xrpath)
4351 # We need an absolute path.
4352 case $arg in
4353 [\\/]* | [A-Za-z]:[\\/]*) ;;
4355 func_fatal_error "only absolute run-paths are allowed"
4357 esac
4358 if test "$prev" = rpath; then
4359 case "$rpath " in
4360 *" $arg "*) ;;
4361 *) rpath="$rpath $arg" ;;
4362 esac
4363 else
4364 case "$xrpath " in
4365 *" $arg "*) ;;
4366 *) xrpath="$xrpath $arg" ;;
4367 esac
4369 prev=
4370 continue
4372 shrext)
4373 shrext_cmds="$arg"
4374 prev=
4375 continue
4377 weak)
4378 weak_libs="$weak_libs $arg"
4379 prev=
4380 continue
4382 xcclinker)
4383 linker_flags="$linker_flags $qarg"
4384 compiler_flags="$compiler_flags $qarg"
4385 prev=
4386 func_append compile_command " $qarg"
4387 func_append finalize_command " $qarg"
4388 continue
4390 xcompiler)
4391 compiler_flags="$compiler_flags $qarg"
4392 prev=
4393 func_append compile_command " $qarg"
4394 func_append finalize_command " $qarg"
4395 continue
4397 xlinker)
4398 linker_flags="$linker_flags $qarg"
4399 compiler_flags="$compiler_flags $wl$qarg"
4400 prev=
4401 func_append compile_command " $wl$qarg"
4402 func_append finalize_command " $wl$qarg"
4403 continue
4406 eval "$prev=\"\$arg\""
4407 prev=
4408 continue
4410 esac
4411 fi # test -n "$prev"
4413 prevarg="$arg"
4415 case $arg in
4416 -all-static)
4417 if test -n "$link_static_flag"; then
4418 # See comment for -static flag below, for more details.
4419 func_append compile_command " $link_static_flag"
4420 func_append finalize_command " $link_static_flag"
4422 continue
4425 -allow-undefined)
4426 # FIXME: remove this flag sometime in the future.
4427 func_fatal_error "\`-allow-undefined' must not be used because it is the default"
4430 -avoid-version)
4431 avoid_version=yes
4432 continue
4435 -dlopen)
4436 prev=dlfiles
4437 continue
4440 -dlpreopen)
4441 prev=dlprefiles
4442 continue
4445 -export-dynamic)
4446 export_dynamic=yes
4447 continue
4450 -export-symbols | -export-symbols-regex)
4451 if test -n "$export_symbols" || test -n "$export_symbols_regex"; then
4452 func_fatal_error "more than one -exported-symbols argument is not allowed"
4454 if test "X$arg" = "X-export-symbols"; then
4455 prev=expsyms
4456 else
4457 prev=expsyms_regex
4459 continue
4462 -framework)
4463 prev=framework
4464 continue
4467 -inst-prefix-dir)
4468 prev=inst_prefix
4469 continue
4472 # The native IRIX linker understands -LANG:*, -LIST:* and -LNO:*
4473 # so, if we see these flags be careful not to treat them like -L
4474 -L[A-Z][A-Z]*:*)
4475 case $with_gcc/$host in
4476 no/*-*-irix* | /*-*-irix*)
4477 func_append compile_command " $arg"
4478 func_append finalize_command " $arg"
4480 esac
4481 continue
4484 -L*)
4485 func_stripname '-L' '' "$arg"
4486 dir=$func_stripname_result
4487 if test -z "$dir"; then
4488 if test "$#" -gt 0; then
4489 func_fatal_error "require no space between \`-L' and \`$1'"
4490 else
4491 func_fatal_error "need path for \`-L' option"
4494 # We need an absolute path.
4495 case $dir in
4496 [\\/]* | [A-Za-z]:[\\/]*) ;;
4498 absdir=`cd "$dir" && pwd`
4499 test -z "$absdir" && \
4500 func_fatal_error "cannot determine absolute directory name of \`$dir'"
4501 dir="$absdir"
4503 esac
4504 case "$deplibs " in
4505 *" -L$dir "*) ;;
4507 deplibs="$deplibs -L$dir"
4508 lib_search_path="$lib_search_path $dir"
4510 esac
4511 case $host in
4512 *-*-cygwin* | *-*-mingw* | *-*-pw32* | *-*-os2* | *-cegcc*)
4513 testbindir=`$ECHO "X$dir" | $Xsed -e 's*/lib$*/bin*'`
4514 case :$dllsearchpath: in
4515 *":$dir:"*) ;;
4516 ::) dllsearchpath=$dir;;
4517 *) dllsearchpath="$dllsearchpath:$dir";;
4518 esac
4519 case :$dllsearchpath: in
4520 *":$testbindir:"*) ;;
4521 ::) dllsearchpath=$testbindir;;
4522 *) dllsearchpath="$dllsearchpath:$testbindir";;
4523 esac
4525 esac
4526 continue
4529 -l*)
4530 if test "X$arg" = "X-lc" || test "X$arg" = "X-lm"; then
4531 case $host in
4532 *-*-cygwin* | *-*-mingw* | *-*-pw32* | *-*-beos* | *-cegcc*)
4533 # These systems don't actually have a C or math library (as such)
4534 continue
4536 *-*-os2*)
4537 # These systems don't actually have a C library (as such)
4538 test "X$arg" = "X-lc" && continue
4540 *-*-openbsd* | *-*-freebsd* | *-*-dragonfly*)
4541 # Do not include libc due to us having libc/libc_r.
4542 test "X$arg" = "X-lc" && continue
4544 *-*-rhapsody* | *-*-darwin1.[012])
4545 # Rhapsody C and math libraries are in the System framework
4546 deplibs="$deplibs System.ltframework"
4547 continue
4549 *-*-sco3.2v5* | *-*-sco5v6*)
4550 # Causes problems with __ctype
4551 test "X$arg" = "X-lc" && continue
4553 *-*-sysv4.2uw2* | *-*-sysv5* | *-*-unixware* | *-*-OpenUNIX*)
4554 # Compiler inserts libc in the correct place for threads to work
4555 test "X$arg" = "X-lc" && continue
4557 esac
4558 elif test "X$arg" = "X-lc_r"; then
4559 case $host in
4560 *-*-openbsd* | *-*-freebsd* | *-*-dragonfly*)
4561 # Do not include libc_r directly, use -pthread flag.
4562 continue
4564 esac
4566 deplibs="$deplibs $arg"
4567 continue
4570 -module)
4571 module=yes
4572 continue
4575 # Tru64 UNIX uses -model [arg] to determine the layout of C++
4576 # classes, name mangling, and exception handling.
4577 # Darwin uses the -arch flag to determine output architecture.
4578 -model|-arch|-isysroot)
4579 compiler_flags="$compiler_flags $arg"
4580 func_append compile_command " $arg"
4581 func_append finalize_command " $arg"
4582 prev=xcompiler
4583 continue
4586 -mt|-mthreads|-kthread|-Kthread|-pthread|-pthreads|--thread-safe|-threads)
4587 compiler_flags="$compiler_flags $arg"
4588 func_append compile_command " $arg"
4589 func_append finalize_command " $arg"
4590 case "$new_inherited_linker_flags " in
4591 *" $arg "*) ;;
4592 * ) new_inherited_linker_flags="$new_inherited_linker_flags $arg" ;;
4593 esac
4594 continue
4597 -multi_module)
4598 single_module="${wl}-multi_module"
4599 continue
4602 -no-fast-install)
4603 fast_install=no
4604 continue
4607 -no-install)
4608 case $host in
4609 *-*-cygwin* | *-*-mingw* | *-*-pw32* | *-*-os2* | *-*-darwin* | *-cegcc*)
4610 # The PATH hackery in wrapper scripts is required on Windows
4611 # and Darwin in order for the loader to find any dlls it needs.
4612 func_warning "\`-no-install' is ignored for $host"
4613 func_warning "assuming \`-no-fast-install' instead"
4614 fast_install=no
4616 *) no_install=yes ;;
4617 esac
4618 continue
4621 -no-undefined)
4622 allow_undefined=no
4623 continue
4626 -objectlist)
4627 prev=objectlist
4628 continue
4631 -o) prev=output ;;
4633 -precious-files-regex)
4634 prev=precious_regex
4635 continue
4638 -release)
4639 prev=release
4640 continue
4643 -rpath)
4644 prev=rpath
4645 continue
4649 prev=xrpath
4650 continue
4653 -R*)
4654 func_stripname '-R' '' "$arg"
4655 dir=$func_stripname_result
4656 # We need an absolute path.
4657 case $dir in
4658 [\\/]* | [A-Za-z]:[\\/]*) ;;
4660 func_fatal_error "only absolute run-paths are allowed"
4662 esac
4663 case "$xrpath " in
4664 *" $dir "*) ;;
4665 *) xrpath="$xrpath $dir" ;;
4666 esac
4667 continue
4670 -shared)
4671 # The effects of -shared are defined in a previous loop.
4672 continue
4675 -shrext)
4676 prev=shrext
4677 continue
4680 -static | -static-libtool-libs)
4681 # The effects of -static are defined in a previous loop.
4682 # We used to do the same as -all-static on platforms that
4683 # didn't have a PIC flag, but the assumption that the effects
4684 # would be equivalent was wrong. It would break on at least
4685 # Digital Unix and AIX.
4686 continue
4689 -thread-safe)
4690 thread_safe=yes
4691 continue
4694 -version-info)
4695 prev=vinfo
4696 continue
4699 -version-number)
4700 prev=vinfo
4701 vinfo_number=yes
4702 continue
4705 -weak)
4706 prev=weak
4707 continue
4710 -Wc,*)
4711 func_stripname '-Wc,' '' "$arg"
4712 args=$func_stripname_result
4713 arg=
4714 save_ifs="$IFS"; IFS=','
4715 for flag in $args; do
4716 IFS="$save_ifs"
4717 func_quote_for_eval "$flag"
4718 arg="$arg $wl$func_quote_for_eval_result"
4719 compiler_flags="$compiler_flags $func_quote_for_eval_result"
4720 done
4721 IFS="$save_ifs"
4722 func_stripname ' ' '' "$arg"
4723 arg=$func_stripname_result
4726 -Wl,*)
4727 func_stripname '-Wl,' '' "$arg"
4728 args=$func_stripname_result
4729 arg=
4730 save_ifs="$IFS"; IFS=','
4731 for flag in $args; do
4732 IFS="$save_ifs"
4733 func_quote_for_eval "$flag"
4734 arg="$arg $wl$func_quote_for_eval_result"
4735 compiler_flags="$compiler_flags $wl$func_quote_for_eval_result"
4736 linker_flags="$linker_flags $func_quote_for_eval_result"
4737 done
4738 IFS="$save_ifs"
4739 func_stripname ' ' '' "$arg"
4740 arg=$func_stripname_result
4743 -Xcompiler)
4744 prev=xcompiler
4745 continue
4748 -Xlinker)
4749 prev=xlinker
4750 continue
4753 -XCClinker)
4754 prev=xcclinker
4755 continue
4758 # -msg_* for osf cc
4759 -msg_*)
4760 func_quote_for_eval "$arg"
4761 arg="$func_quote_for_eval_result"
4764 # -64, -mips[0-9] enable 64-bit mode on the SGI compiler
4765 # -r[0-9][0-9]* specifies the processor on the SGI compiler
4766 # -xarch=*, -xtarget=* enable 64-bit mode on the Sun compiler
4767 # +DA*, +DD* enable 64-bit mode on the HP compiler
4768 # -q* pass through compiler args for the IBM compiler
4769 # -m*, -t[45]*, -txscale* pass through architecture-specific
4770 # compiler args for GCC
4771 # -F/path gives path to uninstalled frameworks, gcc on darwin
4772 # -p, -pg, --coverage, -fprofile-* pass through profiling flag for GCC
4773 # @file GCC response files
4774 -64|-mips[0-9]|-r[0-9][0-9]*|-xarch=*|-xtarget=*|+DA*|+DD*|-q*|-m*| \
4775 -t[45]*|-txscale*|-p|-pg|--coverage|-fprofile-*|-F*|@*)
4776 func_quote_for_eval "$arg"
4777 arg="$func_quote_for_eval_result"
4778 func_append compile_command " $arg"
4779 func_append finalize_command " $arg"
4780 compiler_flags="$compiler_flags $arg"
4781 continue
4784 # Some other compiler flag.
4785 -* | +*)
4786 func_quote_for_eval "$arg"
4787 arg="$func_quote_for_eval_result"
4790 *.$objext)
4791 # A standard object.
4792 objs="$objs $arg"
4795 *.lo)
4796 # A libtool-controlled object.
4798 # Check to see that this really is a libtool object.
4799 if func_lalib_unsafe_p "$arg"; then
4800 pic_object=
4801 non_pic_object=
4803 # Read the .lo file
4804 func_source "$arg"
4806 if test -z "$pic_object" ||
4807 test -z "$non_pic_object" ||
4808 test "$pic_object" = none &&
4809 test "$non_pic_object" = none; then
4810 func_fatal_error "cannot find name of object for \`$arg'"
4813 # Extract subdirectory from the argument.
4814 func_dirname "$arg" "/" ""
4815 xdir="$func_dirname_result"
4817 if test "$pic_object" != none; then
4818 # Prepend the subdirectory the object is found in.
4819 pic_object="$xdir$pic_object"
4821 if test "$prev" = dlfiles; then
4822 if test "$build_libtool_libs" = yes && test "$dlopen_support" = yes; then
4823 dlfiles="$dlfiles $pic_object"
4824 prev=
4825 continue
4826 else
4827 # If libtool objects are unsupported, then we need to preload.
4828 prev=dlprefiles
4832 # CHECK ME: I think I busted this. -Ossama
4833 if test "$prev" = dlprefiles; then
4834 # Preload the old-style object.
4835 dlprefiles="$dlprefiles $pic_object"
4836 prev=
4839 # A PIC object.
4840 func_append libobjs " $pic_object"
4841 arg="$pic_object"
4844 # Non-PIC object.
4845 if test "$non_pic_object" != none; then
4846 # Prepend the subdirectory the object is found in.
4847 non_pic_object="$xdir$non_pic_object"
4849 # A standard non-PIC object
4850 func_append non_pic_objects " $non_pic_object"
4851 if test -z "$pic_object" || test "$pic_object" = none ; then
4852 arg="$non_pic_object"
4854 else
4855 # If the PIC object exists, use it instead.
4856 # $xdir was prepended to $pic_object above.
4857 non_pic_object="$pic_object"
4858 func_append non_pic_objects " $non_pic_object"
4860 else
4861 # Only an error if not doing a dry-run.
4862 if $opt_dry_run; then
4863 # Extract subdirectory from the argument.
4864 func_dirname "$arg" "/" ""
4865 xdir="$func_dirname_result"
4867 func_lo2o "$arg"
4868 pic_object=$xdir$objdir/$func_lo2o_result
4869 non_pic_object=$xdir$func_lo2o_result
4870 func_append libobjs " $pic_object"
4871 func_append non_pic_objects " $non_pic_object"
4872 else
4873 func_fatal_error "\`$arg' is not a valid libtool object"
4878 *.$libext)
4879 # An archive.
4880 deplibs="$deplibs $arg"
4881 old_deplibs="$old_deplibs $arg"
4882 continue
4885 *.la)
4886 # A libtool-controlled library.
4888 if test "$prev" = dlfiles; then
4889 # This library was specified with -dlopen.
4890 dlfiles="$dlfiles $arg"
4891 prev=
4892 elif test "$prev" = dlprefiles; then
4893 # The library was specified with -dlpreopen.
4894 dlprefiles="$dlprefiles $arg"
4895 prev=
4896 else
4897 deplibs="$deplibs $arg"
4899 continue
4902 # Some other compiler argument.
4904 # Unknown arguments in both finalize_command and compile_command need
4905 # to be aesthetically quoted because they are evaled later.
4906 func_quote_for_eval "$arg"
4907 arg="$func_quote_for_eval_result"
4909 esac # arg
4911 # Now actually substitute the argument into the commands.
4912 if test -n "$arg"; then
4913 func_append compile_command " $arg"
4914 func_append finalize_command " $arg"
4916 done # argument parsing loop
4918 test -n "$prev" && \
4919 func_fatal_help "the \`$prevarg' option requires an argument"
4921 if test "$export_dynamic" = yes && test -n "$export_dynamic_flag_spec"; then
4922 eval arg=\"$export_dynamic_flag_spec\"
4923 func_append compile_command " $arg"
4924 func_append finalize_command " $arg"
4927 oldlibs=
4928 # calculate the name of the file, without its directory
4929 func_basename "$output"
4930 outputname="$func_basename_result"
4931 libobjs_save="$libobjs"
4933 if test -n "$shlibpath_var"; then
4934 # get the directories listed in $shlibpath_var
4935 eval shlib_search_path=\`\$ECHO \"X\${$shlibpath_var}\" \| \$Xsed -e \'s/:/ /g\'\`
4936 else
4937 shlib_search_path=
4939 eval sys_lib_search_path=\"$sys_lib_search_path_spec\"
4940 eval sys_lib_dlsearch_path=\"$sys_lib_dlsearch_path_spec\"
4942 func_dirname "$output" "/" ""
4943 output_objdir="$func_dirname_result$objdir"
4944 # Create the object directory.
4945 func_mkdir_p "$output_objdir"
4947 # Determine the type of output
4948 case $output in
4950 func_fatal_help "you must specify an output file"
4952 *.$libext) linkmode=oldlib ;;
4953 *.lo | *.$objext) linkmode=obj ;;
4954 *.la) linkmode=lib ;;
4955 *) linkmode=prog ;; # Anything else should be a program.
4956 esac
4958 specialdeplibs=
4960 libs=
4961 # Find all interdependent deplibs by searching for libraries
4962 # that are linked more than once (e.g. -la -lb -la)
4963 for deplib in $deplibs; do
4964 if $opt_duplicate_deps ; then
4965 case "$libs " in
4966 *" $deplib "*) specialdeplibs="$specialdeplibs $deplib" ;;
4967 esac
4969 libs="$libs $deplib"
4970 done
4972 if test "$linkmode" = lib; then
4973 libs="$predeps $libs $compiler_lib_search_path $postdeps"
4975 # Compute libraries that are listed more than once in $predeps
4976 # $postdeps and mark them as special (i.e., whose duplicates are
4977 # not to be eliminated).
4978 pre_post_deps=
4979 if $opt_duplicate_compiler_generated_deps; then
4980 for pre_post_dep in $predeps $postdeps; do
4981 case "$pre_post_deps " in
4982 *" $pre_post_dep "*) specialdeplibs="$specialdeplibs $pre_post_deps" ;;
4983 esac
4984 pre_post_deps="$pre_post_deps $pre_post_dep"
4985 done
4987 pre_post_deps=
4990 deplibs=
4991 newdependency_libs=
4992 newlib_search_path=
4993 need_relink=no # whether we're linking any uninstalled libtool libraries
4994 notinst_deplibs= # not-installed libtool libraries
4995 notinst_path= # paths that contain not-installed libtool libraries
4997 case $linkmode in
4998 lib)
4999 passes="conv dlpreopen link"
5000 for file in $dlfiles $dlprefiles; do
5001 case $file in
5002 *.la) ;;
5004 func_fatal_help "libraries can \`-dlopen' only libtool libraries: $file"
5006 esac
5007 done
5009 prog)
5010 compile_deplibs=
5011 finalize_deplibs=
5012 alldeplibs=no
5013 newdlfiles=
5014 newdlprefiles=
5015 passes="conv scan dlopen dlpreopen link"
5017 *) passes="conv"
5019 esac
5021 for pass in $passes; do
5022 # The preopen pass in lib mode reverses $deplibs; put it back here
5023 # so that -L comes before libs that need it for instance...
5024 if test "$linkmode,$pass" = "lib,link"; then
5025 ## FIXME: Find the place where the list is rebuilt in the wrong
5026 ## order, and fix it there properly
5027 tmp_deplibs=
5028 for deplib in $deplibs; do
5029 tmp_deplibs="$deplib $tmp_deplibs"
5030 done
5031 deplibs="$tmp_deplibs"
5034 if test "$linkmode,$pass" = "lib,link" ||
5035 test "$linkmode,$pass" = "prog,scan"; then
5036 libs="$deplibs"
5037 deplibs=
5039 if test "$linkmode" = prog; then
5040 case $pass in
5041 dlopen) libs="$dlfiles" ;;
5042 dlpreopen) libs="$dlprefiles" ;;
5043 link) libs="$deplibs %DEPLIBS% $dependency_libs" ;;
5044 esac
5046 if test "$linkmode,$pass" = "lib,dlpreopen"; then
5047 # Collect and forward deplibs of preopened libtool libs
5048 for lib in $dlprefiles; do
5049 # Ignore non-libtool-libs
5050 dependency_libs=
5051 case $lib in
5052 *.la) func_source "$lib" ;;
5053 esac
5055 # Collect preopened libtool deplibs, except any this library
5056 # has declared as weak libs
5057 for deplib in $dependency_libs; do
5058 deplib_base=`$ECHO "X$deplib" | $Xsed -e "$basename"`
5059 case " $weak_libs " in
5060 *" $deplib_base "*) ;;
5061 *) deplibs="$deplibs $deplib" ;;
5062 esac
5063 done
5064 done
5065 libs="$dlprefiles"
5067 if test "$pass" = dlopen; then
5068 # Collect dlpreopened libraries
5069 save_deplibs="$deplibs"
5070 deplibs=
5073 for deplib in $libs; do
5074 lib=
5075 found=no
5076 case $deplib in
5077 -mt|-mthreads|-kthread|-Kthread|-pthread|-pthreads|--thread-safe|-threads)
5078 if test "$linkmode,$pass" = "prog,link"; then
5079 compile_deplibs="$deplib $compile_deplibs"
5080 finalize_deplibs="$deplib $finalize_deplibs"
5081 else
5082 compiler_flags="$compiler_flags $deplib"
5083 if test "$linkmode" = lib ; then
5084 case "$new_inherited_linker_flags " in
5085 *" $deplib "*) ;;
5086 * ) new_inherited_linker_flags="$new_inherited_linker_flags $deplib" ;;
5087 esac
5090 continue
5092 -l*)
5093 if test "$linkmode" != lib && test "$linkmode" != prog; then
5094 func_warning "\`-l' is ignored for archives/objects"
5095 continue
5097 func_stripname '-l' '' "$deplib"
5098 name=$func_stripname_result
5099 if test "$linkmode" = lib; then
5100 searchdirs="$newlib_search_path $lib_search_path $compiler_lib_search_dirs $sys_lib_search_path $shlib_search_path"
5101 else
5102 searchdirs="$newlib_search_path $lib_search_path $sys_lib_search_path $shlib_search_path"
5104 for searchdir in $searchdirs; do
5105 for search_ext in .la $std_shrext .so .a; do
5106 # Search the libtool library
5107 lib="$searchdir/lib${name}${search_ext}"
5108 if test -f "$lib"; then
5109 if test "$search_ext" = ".la"; then
5110 found=yes
5111 else
5112 found=no
5114 break 2
5116 done
5117 done
5118 if test "$found" != yes; then
5119 # deplib doesn't seem to be a libtool library
5120 if test "$linkmode,$pass" = "prog,link"; then
5121 compile_deplibs="$deplib $compile_deplibs"
5122 finalize_deplibs="$deplib $finalize_deplibs"
5123 else
5124 deplibs="$deplib $deplibs"
5125 test "$linkmode" = lib && newdependency_libs="$deplib $newdependency_libs"
5127 continue
5128 else # deplib is a libtool library
5129 # If $allow_libtool_libs_with_static_runtimes && $deplib is a stdlib,
5130 # We need to do some special things here, and not later.
5131 if test "X$allow_libtool_libs_with_static_runtimes" = "Xyes" ; then
5132 case " $predeps $postdeps " in
5133 *" $deplib "*)
5134 if func_lalib_p "$lib"; then
5135 library_names=
5136 old_library=
5137 func_source "$lib"
5138 for l in $old_library $library_names; do
5139 ll="$l"
5140 done
5141 if test "X$ll" = "X$old_library" ; then # only static version available
5142 found=no
5143 func_dirname "$lib" "" "."
5144 ladir="$func_dirname_result"
5145 lib=$ladir/$old_library
5146 if test "$linkmode,$pass" = "prog,link"; then
5147 compile_deplibs="$deplib $compile_deplibs"
5148 finalize_deplibs="$deplib $finalize_deplibs"
5149 else
5150 deplibs="$deplib $deplibs"
5151 test "$linkmode" = lib && newdependency_libs="$deplib $newdependency_libs"
5153 continue
5157 *) ;;
5158 esac
5161 ;; # -l
5162 *.ltframework)
5163 if test "$linkmode,$pass" = "prog,link"; then
5164 compile_deplibs="$deplib $compile_deplibs"
5165 finalize_deplibs="$deplib $finalize_deplibs"
5166 else
5167 deplibs="$deplib $deplibs"
5168 if test "$linkmode" = lib ; then
5169 case "$new_inherited_linker_flags " in
5170 *" $deplib "*) ;;
5171 * ) new_inherited_linker_flags="$new_inherited_linker_flags $deplib" ;;
5172 esac
5175 continue
5177 -L*)
5178 case $linkmode in
5179 lib)
5180 deplibs="$deplib $deplibs"
5181 test "$pass" = conv && continue
5182 newdependency_libs="$deplib $newdependency_libs"
5183 func_stripname '-L' '' "$deplib"
5184 newlib_search_path="$newlib_search_path $func_stripname_result"
5186 prog)
5187 if test "$pass" = conv; then
5188 deplibs="$deplib $deplibs"
5189 continue
5191 if test "$pass" = scan; then
5192 deplibs="$deplib $deplibs"
5193 else
5194 compile_deplibs="$deplib $compile_deplibs"
5195 finalize_deplibs="$deplib $finalize_deplibs"
5197 func_stripname '-L' '' "$deplib"
5198 newlib_search_path="$newlib_search_path $func_stripname_result"
5201 func_warning "\`-L' is ignored for archives/objects"
5203 esac # linkmode
5204 continue
5205 ;; # -L
5206 -R*)
5207 if test "$pass" = link; then
5208 func_stripname '-R' '' "$deplib"
5209 dir=$func_stripname_result
5210 # Make sure the xrpath contains only unique directories.
5211 case "$xrpath " in
5212 *" $dir "*) ;;
5213 *) xrpath="$xrpath $dir" ;;
5214 esac
5216 deplibs="$deplib $deplibs"
5217 continue
5219 *.la) lib="$deplib" ;;
5220 *.$libext)
5221 if test "$pass" = conv; then
5222 deplibs="$deplib $deplibs"
5223 continue
5225 case $linkmode in
5226 lib)
5227 # Linking convenience modules into shared libraries is allowed,
5228 # but linking other static libraries is non-portable.
5229 case " $dlpreconveniencelibs " in
5230 *" $deplib "*) ;;
5232 valid_a_lib=no
5233 case $deplibs_check_method in
5234 match_pattern*)
5235 set dummy $deplibs_check_method; shift
5236 match_pattern_regex=`expr "$deplibs_check_method" : "$1 \(.*\)"`
5237 if eval "\$ECHO \"X$deplib\"" 2>/dev/null | $Xsed -e 10q \
5238 | $EGREP "$match_pattern_regex" > /dev/null; then
5239 valid_a_lib=yes
5242 pass_all)
5243 valid_a_lib=yes
5245 esac
5246 if test "$valid_a_lib" != yes; then
5247 $ECHO
5248 $ECHO "*** Warning: Trying to link with static lib archive $deplib."
5249 $ECHO "*** I have the capability to make that library automatically link in when"
5250 $ECHO "*** you link to this library. But I can only do this if you have a"
5251 $ECHO "*** shared version of the library, which you do not appear to have"
5252 $ECHO "*** because the file extensions .$libext of this argument makes me believe"
5253 $ECHO "*** that it is just a static archive that I should not use here."
5254 else
5255 $ECHO
5256 $ECHO "*** Warning: Linking the shared library $output against the"
5257 $ECHO "*** static library $deplib is not portable!"
5258 deplibs="$deplib $deplibs"
5261 esac
5262 continue
5264 prog)
5265 if test "$pass" != link; then
5266 deplibs="$deplib $deplibs"
5267 else
5268 compile_deplibs="$deplib $compile_deplibs"
5269 finalize_deplibs="$deplib $finalize_deplibs"
5271 continue
5273 esac # linkmode
5274 ;; # *.$libext
5275 *.lo | *.$objext)
5276 if test "$pass" = conv; then
5277 deplibs="$deplib $deplibs"
5278 elif test "$linkmode" = prog; then
5279 if test "$pass" = dlpreopen || test "$dlopen_support" != yes || test "$build_libtool_libs" = no; then
5280 # If there is no dlopen support or we're linking statically,
5281 # we need to preload.
5282 newdlprefiles="$newdlprefiles $deplib"
5283 compile_deplibs="$deplib $compile_deplibs"
5284 finalize_deplibs="$deplib $finalize_deplibs"
5285 else
5286 newdlfiles="$newdlfiles $deplib"
5289 continue
5291 %DEPLIBS%)
5292 alldeplibs=yes
5293 continue
5295 esac # case $deplib
5297 if test "$found" = yes || test -f "$lib"; then :
5298 else
5299 func_fatal_error "cannot find the library \`$lib' or unhandled argument \`$deplib'"
5302 # Check to see that this really is a libtool archive.
5303 func_lalib_unsafe_p "$lib" \
5304 || func_fatal_error "\`$lib' is not a valid libtool archive"
5306 func_dirname "$lib" "" "."
5307 ladir="$func_dirname_result"
5309 dlname=
5310 dlopen=
5311 dlpreopen=
5312 libdir=
5313 library_names=
5314 old_library=
5315 inherited_linker_flags=
5316 # If the library was installed with an old release of libtool,
5317 # it will not redefine variables installed, or shouldnotlink
5318 installed=yes
5319 shouldnotlink=no
5320 avoidtemprpath=
5323 # Read the .la file
5324 func_source "$lib"
5326 # Convert "-framework foo" to "foo.ltframework"
5327 if test -n "$inherited_linker_flags"; then
5328 tmp_inherited_linker_flags=`$ECHO "X$inherited_linker_flags" | $Xsed -e 's/-framework \([^ $]*\)/\1.ltframework/g'`
5329 for tmp_inherited_linker_flag in $tmp_inherited_linker_flags; do
5330 case " $new_inherited_linker_flags " in
5331 *" $tmp_inherited_linker_flag "*) ;;
5332 *) new_inherited_linker_flags="$new_inherited_linker_flags $tmp_inherited_linker_flag";;
5333 esac
5334 done
5336 dependency_libs=`$ECHO "X $dependency_libs" | $Xsed -e 's% \([^ $]*\).ltframework% -framework \1%g'`
5337 if test "$linkmode,$pass" = "lib,link" ||
5338 test "$linkmode,$pass" = "prog,scan" ||
5339 { test "$linkmode" != prog && test "$linkmode" != lib; }; then
5340 test -n "$dlopen" && dlfiles="$dlfiles $dlopen"
5341 test -n "$dlpreopen" && dlprefiles="$dlprefiles $dlpreopen"
5344 if test "$pass" = conv; then
5345 # Only check for convenience libraries
5346 deplibs="$lib $deplibs"
5347 if test -z "$libdir"; then
5348 if test -z "$old_library"; then
5349 func_fatal_error "cannot find name of link library for \`$lib'"
5351 # It is a libtool convenience library, so add in its objects.
5352 convenience="$convenience $ladir/$objdir/$old_library"
5353 old_convenience="$old_convenience $ladir/$objdir/$old_library"
5354 elif test "$linkmode" != prog && test "$linkmode" != lib; then
5355 func_fatal_error "\`$lib' is not a convenience library"
5357 tmp_libs=
5358 for deplib in $dependency_libs; do
5359 deplibs="$deplib $deplibs"
5360 if $opt_duplicate_deps ; then
5361 case "$tmp_libs " in
5362 *" $deplib "*) specialdeplibs="$specialdeplibs $deplib" ;;
5363 esac
5365 tmp_libs="$tmp_libs $deplib"
5366 done
5367 continue
5368 fi # $pass = conv
5371 # Get the name of the library we link against.
5372 linklib=
5373 for l in $old_library $library_names; do
5374 linklib="$l"
5375 done
5376 if test -z "$linklib"; then
5377 func_fatal_error "cannot find name of link library for \`$lib'"
5380 # This library was specified with -dlopen.
5381 if test "$pass" = dlopen; then
5382 if test -z "$libdir"; then
5383 func_fatal_error "cannot -dlopen a convenience library: \`$lib'"
5385 if test -z "$dlname" ||
5386 test "$dlopen_support" != yes ||
5387 test "$build_libtool_libs" = no; then
5388 # If there is no dlname, no dlopen support or we're linking
5389 # statically, we need to preload. We also need to preload any
5390 # dependent libraries so libltdl's deplib preloader doesn't
5391 # bomb out in the load deplibs phase.
5392 dlprefiles="$dlprefiles $lib $dependency_libs"
5393 else
5394 newdlfiles="$newdlfiles $lib"
5396 continue
5397 fi # $pass = dlopen
5399 # We need an absolute path.
5400 case $ladir in
5401 [\\/]* | [A-Za-z]:[\\/]*) abs_ladir="$ladir" ;;
5403 abs_ladir=`cd "$ladir" && pwd`
5404 if test -z "$abs_ladir"; then
5405 func_warning "cannot determine absolute directory name of \`$ladir'"
5406 func_warning "passing it literally to the linker, although it might fail"
5407 abs_ladir="$ladir"
5410 esac
5411 func_basename "$lib"
5412 laname="$func_basename_result"
5414 # Find the relevant object directory and library name.
5415 if test "X$installed" = Xyes; then
5416 if test ! -f "$libdir/$linklib" && test -f "$abs_ladir/$linklib"; then
5417 func_warning "library \`$lib' was moved."
5418 dir="$ladir"
5419 absdir="$abs_ladir"
5420 libdir="$abs_ladir"
5421 else
5422 dir="$libdir"
5423 absdir="$libdir"
5425 test "X$hardcode_automatic" = Xyes && avoidtemprpath=yes
5426 else
5427 if test ! -f "$ladir/$objdir/$linklib" && test -f "$abs_ladir/$linklib"; then
5428 dir="$ladir"
5429 absdir="$abs_ladir"
5430 # Remove this search path later
5431 notinst_path="$notinst_path $abs_ladir"
5432 else
5433 dir="$ladir/$objdir"
5434 absdir="$abs_ladir/$objdir"
5435 # Remove this search path later
5436 notinst_path="$notinst_path $abs_ladir"
5438 fi # $installed = yes
5439 func_stripname 'lib' '.la' "$laname"
5440 name=$func_stripname_result
5442 # This library was specified with -dlpreopen.
5443 if test "$pass" = dlpreopen; then
5444 if test -z "$libdir" && test "$linkmode" = prog; then
5445 func_fatal_error "only libraries may -dlpreopen a convenience library: \`$lib'"
5447 # Prefer using a static library (so that no silly _DYNAMIC symbols
5448 # are required to link).
5449 if test -n "$old_library"; then
5450 newdlprefiles="$newdlprefiles $dir/$old_library"
5451 # Keep a list of preopened convenience libraries to check
5452 # that they are being used correctly in the link pass.
5453 test -z "$libdir" && \
5454 dlpreconveniencelibs="$dlpreconveniencelibs $dir/$old_library"
5455 # Otherwise, use the dlname, so that lt_dlopen finds it.
5456 elif test -n "$dlname"; then
5457 newdlprefiles="$newdlprefiles $dir/$dlname"
5458 else
5459 newdlprefiles="$newdlprefiles $dir/$linklib"
5461 fi # $pass = dlpreopen
5463 if test -z "$libdir"; then
5464 # Link the convenience library
5465 if test "$linkmode" = lib; then
5466 deplibs="$dir/$old_library $deplibs"
5467 elif test "$linkmode,$pass" = "prog,link"; then
5468 compile_deplibs="$dir/$old_library $compile_deplibs"
5469 finalize_deplibs="$dir/$old_library $finalize_deplibs"
5470 else
5471 deplibs="$lib $deplibs" # used for prog,scan pass
5473 continue
5477 if test "$linkmode" = prog && test "$pass" != link; then
5478 newlib_search_path="$newlib_search_path $ladir"
5479 deplibs="$lib $deplibs"
5481 linkalldeplibs=no
5482 if test "$link_all_deplibs" != no || test -z "$library_names" ||
5483 test "$build_libtool_libs" = no; then
5484 linkalldeplibs=yes
5487 tmp_libs=
5488 for deplib in $dependency_libs; do
5489 case $deplib in
5490 -L*) func_stripname '-L' '' "$deplib"
5491 newlib_search_path="$newlib_search_path $func_stripname_result"
5493 esac
5494 # Need to link against all dependency_libs?
5495 if test "$linkalldeplibs" = yes; then
5496 deplibs="$deplib $deplibs"
5497 else
5498 # Need to hardcode shared library paths
5499 # or/and link against static libraries
5500 newdependency_libs="$deplib $newdependency_libs"
5502 if $opt_duplicate_deps ; then
5503 case "$tmp_libs " in
5504 *" $deplib "*) specialdeplibs="$specialdeplibs $deplib" ;;
5505 esac
5507 tmp_libs="$tmp_libs $deplib"
5508 done # for deplib
5509 continue
5510 fi # $linkmode = prog...
5512 if test "$linkmode,$pass" = "prog,link"; then
5513 if test -n "$library_names" &&
5514 { { test "$prefer_static_libs" = no ||
5515 test "$prefer_static_libs,$installed" = "built,yes"; } ||
5516 test -z "$old_library"; }; then
5517 # We need to hardcode the library path
5518 if test -n "$shlibpath_var" && test -z "$avoidtemprpath" ; then
5519 # Make sure the rpath contains only unique directories.
5520 case "$temp_rpath:" in
5521 *"$absdir:"*) ;;
5522 *) temp_rpath="$temp_rpath$absdir:" ;;
5523 esac
5526 # Hardcode the library path.
5527 # Skip directories that are in the system default run-time
5528 # search path.
5529 case " $sys_lib_dlsearch_path " in
5530 *" $absdir "*) ;;
5532 case "$compile_rpath " in
5533 *" $absdir "*) ;;
5534 *) compile_rpath="$compile_rpath $absdir"
5535 esac
5537 esac
5538 case " $sys_lib_dlsearch_path " in
5539 *" $libdir "*) ;;
5541 case "$finalize_rpath " in
5542 *" $libdir "*) ;;
5543 *) finalize_rpath="$finalize_rpath $libdir"
5544 esac
5546 esac
5547 fi # $linkmode,$pass = prog,link...
5549 if test "$alldeplibs" = yes &&
5550 { test "$deplibs_check_method" = pass_all ||
5551 { test "$build_libtool_libs" = yes &&
5552 test -n "$library_names"; }; }; then
5553 # We only need to search for static libraries
5554 continue
5558 link_static=no # Whether the deplib will be linked statically
5559 use_static_libs=$prefer_static_libs
5560 if test "$use_static_libs" = built && test "$installed" = yes; then
5561 use_static_libs=no
5563 if test -n "$library_names" &&
5564 { test "$use_static_libs" = no || test -z "$old_library"; }; then
5565 case $host in
5566 *cygwin* | *mingw* | *cegcc*)
5567 # No point in relinking DLLs because paths are not encoded
5568 notinst_deplibs="$notinst_deplibs $lib"
5569 need_relink=no
5572 if test "$installed" = no; then
5573 notinst_deplibs="$notinst_deplibs $lib"
5574 need_relink=yes
5577 esac
5578 # This is a shared library
5580 # Warn about portability, can't link against -module's on some
5581 # systems (darwin). Don't bleat about dlopened modules though!
5582 dlopenmodule=""
5583 for dlpremoduletest in $dlprefiles; do
5584 if test "X$dlpremoduletest" = "X$lib"; then
5585 dlopenmodule="$dlpremoduletest"
5586 break
5588 done
5589 if test -z "$dlopenmodule" && test "$shouldnotlink" = yes && test "$pass" = link; then
5590 $ECHO
5591 if test "$linkmode" = prog; then
5592 $ECHO "*** Warning: Linking the executable $output against the loadable module"
5593 else
5594 $ECHO "*** Warning: Linking the shared library $output against the loadable module"
5596 $ECHO "*** $linklib is not portable!"
5598 if test "$linkmode" = lib &&
5599 test "$hardcode_into_libs" = yes; then
5600 # Hardcode the library path.
5601 # Skip directories that are in the system default run-time
5602 # search path.
5603 case " $sys_lib_dlsearch_path " in
5604 *" $absdir "*) ;;
5606 case "$compile_rpath " in
5607 *" $absdir "*) ;;
5608 *) compile_rpath="$compile_rpath $absdir"
5609 esac
5611 esac
5612 case " $sys_lib_dlsearch_path " in
5613 *" $libdir "*) ;;
5615 case "$finalize_rpath " in
5616 *" $libdir "*) ;;
5617 *) finalize_rpath="$finalize_rpath $libdir"
5618 esac
5620 esac
5623 if test -n "$old_archive_from_expsyms_cmds"; then
5624 # figure out the soname
5625 set dummy $library_names
5626 shift
5627 realname="$1"
5628 shift
5629 libname=`eval "\\$ECHO \"$libname_spec\""`
5630 # use dlname if we got it. it's perfectly good, no?
5631 if test -n "$dlname"; then
5632 soname="$dlname"
5633 elif test -n "$soname_spec"; then
5634 # bleh windows
5635 case $host in
5636 *cygwin* | mingw* | *cegcc*)
5637 func_arith $current - $age
5638 major=$func_arith_result
5639 versuffix="-$major"
5641 esac
5642 eval soname=\"$soname_spec\"
5643 else
5644 soname="$realname"
5647 # Make a new name for the extract_expsyms_cmds to use
5648 soroot="$soname"
5649 func_basename "$soroot"
5650 soname="$func_basename_result"
5651 func_stripname 'lib' '.dll' "$soname"
5652 newlib=libimp-$func_stripname_result.a
5654 # If the library has no export list, then create one now
5655 if test -f "$output_objdir/$soname-def"; then :
5656 else
5657 func_verbose "extracting exported symbol list from \`$soname'"
5658 func_execute_cmds "$extract_expsyms_cmds" 'exit $?'
5661 # Create $newlib
5662 if test -f "$output_objdir/$newlib"; then :; else
5663 func_verbose "generating import library for \`$soname'"
5664 func_execute_cmds "$old_archive_from_expsyms_cmds" 'exit $?'
5666 # make sure the library variables are pointing to the new library
5667 dir=$output_objdir
5668 linklib=$newlib
5669 fi # test -n "$old_archive_from_expsyms_cmds"
5671 if test "$linkmode" = prog || test "$mode" != relink; then
5672 add_shlibpath=
5673 add_dir=
5674 add=
5675 lib_linked=yes
5676 case $hardcode_action in
5677 immediate | unsupported)
5678 if test "$hardcode_direct" = no; then
5679 add="$dir/$linklib"
5680 case $host in
5681 *-*-sco3.2v5.0.[024]*) add_dir="-L$dir" ;;
5682 *-*-sysv4*uw2*) add_dir="-L$dir" ;;
5683 *-*-sysv5OpenUNIX* | *-*-sysv5UnixWare7.[01].[10]* | \
5684 *-*-unixware7*) add_dir="-L$dir" ;;
5685 *-*-darwin* )
5686 # if the lib is a (non-dlopened) module then we can not
5687 # link against it, someone is ignoring the earlier warnings
5688 if /usr/bin/file -L $add 2> /dev/null |
5689 $GREP ": [^:]* bundle" >/dev/null ; then
5690 if test "X$dlopenmodule" != "X$lib"; then
5691 $ECHO "*** Warning: lib $linklib is a module, not a shared library"
5692 if test -z "$old_library" ; then
5693 $ECHO
5694 $ECHO "*** And there doesn't seem to be a static archive available"
5695 $ECHO "*** The link will probably fail, sorry"
5696 else
5697 add="$dir/$old_library"
5699 elif test -n "$old_library"; then
5700 add="$dir/$old_library"
5703 esac
5704 elif test "$hardcode_minus_L" = no; then
5705 case $host in
5706 *-*-sunos*) add_shlibpath="$dir" ;;
5707 esac
5708 add_dir="-L$dir"
5709 add="-l$name"
5710 elif test "$hardcode_shlibpath_var" = no; then
5711 add_shlibpath="$dir"
5712 add="-l$name"
5713 else
5714 lib_linked=no
5717 relink)
5718 if test "$hardcode_direct" = yes &&
5719 test "$hardcode_direct_absolute" = no; then
5720 add="$dir/$linklib"
5721 elif test "$hardcode_minus_L" = yes; then
5722 add_dir="-L$dir"
5723 # Try looking first in the location we're being installed to.
5724 if test -n "$inst_prefix_dir"; then
5725 case $libdir in
5726 [\\/]*)
5727 add_dir="$add_dir -L$inst_prefix_dir$libdir"
5729 esac
5731 add="-l$name"
5732 elif test "$hardcode_shlibpath_var" = yes; then
5733 add_shlibpath="$dir"
5734 add="-l$name"
5735 else
5736 lib_linked=no
5739 *) lib_linked=no ;;
5740 esac
5742 if test "$lib_linked" != yes; then
5743 func_fatal_configuration "unsupported hardcode properties"
5746 if test -n "$add_shlibpath"; then
5747 case :$compile_shlibpath: in
5748 *":$add_shlibpath:"*) ;;
5749 *) compile_shlibpath="$compile_shlibpath$add_shlibpath:" ;;
5750 esac
5752 if test "$linkmode" = prog; then
5753 test -n "$add_dir" && compile_deplibs="$add_dir $compile_deplibs"
5754 test -n "$add" && compile_deplibs="$add $compile_deplibs"
5755 else
5756 test -n "$add_dir" && deplibs="$add_dir $deplibs"
5757 test -n "$add" && deplibs="$add $deplibs"
5758 if test "$hardcode_direct" != yes &&
5759 test "$hardcode_minus_L" != yes &&
5760 test "$hardcode_shlibpath_var" = yes; then
5761 case :$finalize_shlibpath: in
5762 *":$libdir:"*) ;;
5763 *) finalize_shlibpath="$finalize_shlibpath$libdir:" ;;
5764 esac
5769 if test "$linkmode" = prog || test "$mode" = relink; then
5770 add_shlibpath=
5771 add_dir=
5772 add=
5773 # Finalize command for both is simple: just hardcode it.
5774 if test "$hardcode_direct" = yes &&
5775 test "$hardcode_direct_absolute" = no; then
5776 add="$libdir/$linklib"
5777 elif test "$hardcode_minus_L" = yes; then
5778 add_dir="-L$libdir"
5779 add="-l$name"
5780 elif test "$hardcode_shlibpath_var" = yes; then
5781 case :$finalize_shlibpath: in
5782 *":$libdir:"*) ;;
5783 *) finalize_shlibpath="$finalize_shlibpath$libdir:" ;;
5784 esac
5785 add="-l$name"
5786 elif test "$hardcode_automatic" = yes; then
5787 if test -n "$inst_prefix_dir" &&
5788 test -f "$inst_prefix_dir$libdir/$linklib" ; then
5789 add="$inst_prefix_dir$libdir/$linklib"
5790 else
5791 add="$libdir/$linklib"
5793 else
5794 # We cannot seem to hardcode it, guess we'll fake it.
5795 add_dir="-L$libdir"
5796 # Try looking first in the location we're being installed to.
5797 if test -n "$inst_prefix_dir"; then
5798 case $libdir in
5799 [\\/]*)
5800 add_dir="$add_dir -L$inst_prefix_dir$libdir"
5802 esac
5804 add="-l$name"
5807 if test "$linkmode" = prog; then
5808 test -n "$add_dir" && finalize_deplibs="$add_dir $finalize_deplibs"
5809 test -n "$add" && finalize_deplibs="$add $finalize_deplibs"
5810 else
5811 test -n "$add_dir" && deplibs="$add_dir $deplibs"
5812 test -n "$add" && deplibs="$add $deplibs"
5815 elif test "$linkmode" = prog; then
5816 # Here we assume that one of hardcode_direct or hardcode_minus_L
5817 # is not unsupported. This is valid on all known static and
5818 # shared platforms.
5819 if test "$hardcode_direct" != unsupported; then
5820 test -n "$old_library" && linklib="$old_library"
5821 compile_deplibs="$dir/$linklib $compile_deplibs"
5822 finalize_deplibs="$dir/$linklib $finalize_deplibs"
5823 else
5824 compile_deplibs="-l$name -L$dir $compile_deplibs"
5825 finalize_deplibs="-l$name -L$dir $finalize_deplibs"
5827 elif test "$build_libtool_libs" = yes; then
5828 # Not a shared library
5829 if test "$deplibs_check_method" != pass_all; then
5830 # We're trying link a shared library against a static one
5831 # but the system doesn't support it.
5833 # Just print a warning and add the library to dependency_libs so
5834 # that the program can be linked against the static library.
5835 $ECHO
5836 $ECHO "*** Warning: This system can not link to static lib archive $lib."
5837 $ECHO "*** I have the capability to make that library automatically link in when"
5838 $ECHO "*** you link to this library. But I can only do this if you have a"
5839 $ECHO "*** shared version of the library, which you do not appear to have."
5840 if test "$module" = yes; then
5841 $ECHO "*** But as you try to build a module library, libtool will still create "
5842 $ECHO "*** a static module, that should work as long as the dlopening application"
5843 $ECHO "*** is linked with the -dlopen flag to resolve symbols at runtime."
5844 if test -z "$global_symbol_pipe"; then
5845 $ECHO
5846 $ECHO "*** However, this would only work if libtool was able to extract symbol"
5847 $ECHO "*** lists from a program, using \`nm' or equivalent, but libtool could"
5848 $ECHO "*** not find such a program. So, this module is probably useless."
5849 $ECHO "*** \`nm' from GNU binutils and a full rebuild may help."
5851 if test "$build_old_libs" = no; then
5852 build_libtool_libs=module
5853 build_old_libs=yes
5854 else
5855 build_libtool_libs=no
5858 else
5859 deplibs="$dir/$old_library $deplibs"
5860 link_static=yes
5862 fi # link shared/static library?
5864 if test "$linkmode" = lib; then
5865 if test -n "$dependency_libs" &&
5866 { test "$hardcode_into_libs" != yes ||
5867 test "$build_old_libs" = yes ||
5868 test "$link_static" = yes; }; then
5869 # Extract -R from dependency_libs
5870 temp_deplibs=
5871 for libdir in $dependency_libs; do
5872 case $libdir in
5873 -R*) func_stripname '-R' '' "$libdir"
5874 temp_xrpath=$func_stripname_result
5875 case " $xrpath " in
5876 *" $temp_xrpath "*) ;;
5877 *) xrpath="$xrpath $temp_xrpath";;
5878 esac;;
5879 *) temp_deplibs="$temp_deplibs $libdir";;
5880 esac
5881 done
5882 dependency_libs="$temp_deplibs"
5885 newlib_search_path="$newlib_search_path $absdir"
5886 # Link against this library
5887 test "$link_static" = no && newdependency_libs="$abs_ladir/$laname $newdependency_libs"
5888 # ... and its dependency_libs
5889 tmp_libs=
5890 for deplib in $dependency_libs; do
5891 newdependency_libs="$deplib $newdependency_libs"
5892 if $opt_duplicate_deps ; then
5893 case "$tmp_libs " in
5894 *" $deplib "*) specialdeplibs="$specialdeplibs $deplib" ;;
5895 esac
5897 tmp_libs="$tmp_libs $deplib"
5898 done
5900 if test "$link_all_deplibs" != no; then
5901 # Add the search paths of all dependency libraries
5902 for deplib in $dependency_libs; do
5903 case $deplib in
5904 -L*) path="$deplib" ;;
5905 *.la)
5906 func_dirname "$deplib" "" "."
5907 dir="$func_dirname_result"
5908 # We need an absolute path.
5909 case $dir in
5910 [\\/]* | [A-Za-z]:[\\/]*) absdir="$dir" ;;
5912 absdir=`cd "$dir" && pwd`
5913 if test -z "$absdir"; then
5914 func_warning "cannot determine absolute directory name of \`$dir'"
5915 absdir="$dir"
5918 esac
5919 if $GREP "^installed=no" $deplib > /dev/null; then
5920 case $host in
5921 *-*-darwin*)
5922 depdepl=
5923 eval deplibrary_names=`${SED} -n -e 's/^library_names=\(.*\)$/\1/p' $deplib`
5924 if test -n "$deplibrary_names" ; then
5925 for tmp in $deplibrary_names ; do
5926 depdepl=$tmp
5927 done
5928 if test -f "$absdir/$objdir/$depdepl" ; then
5929 depdepl="$absdir/$objdir/$depdepl"
5930 darwin_install_name=`${OTOOL} -L $depdepl | awk '{if (NR == 2) {print $1;exit}}'`
5931 if test -z "$darwin_install_name"; then
5932 darwin_install_name=`${OTOOL64} -L $depdepl | awk '{if (NR == 2) {print $1;exit}}'`
5934 compiler_flags="$compiler_flags ${wl}-dylib_file ${wl}${darwin_install_name}:${depdepl}"
5935 linker_flags="$linker_flags -dylib_file ${darwin_install_name}:${depdepl}"
5936 path=
5941 path="-L$absdir/$objdir"
5943 esac
5944 else
5945 eval libdir=`${SED} -n -e 's/^libdir=\(.*\)$/\1/p' $deplib`
5946 test -z "$libdir" && \
5947 func_fatal_error "\`$deplib' is not a valid libtool archive"
5948 test "$absdir" != "$libdir" && \
5949 func_warning "\`$deplib' seems to be moved"
5951 path="-L$absdir"
5954 esac
5955 case " $deplibs " in
5956 *" $path "*) ;;
5957 *) deplibs="$path $deplibs" ;;
5958 esac
5959 done
5960 fi # link_all_deplibs != no
5961 fi # linkmode = lib
5962 done # for deplib in $libs
5963 if test "$pass" = link; then
5964 if test "$linkmode" = "prog"; then
5965 compile_deplibs="$new_inherited_linker_flags $compile_deplibs"
5966 finalize_deplibs="$new_inherited_linker_flags $finalize_deplibs"
5967 else
5968 compiler_flags="$compiler_flags "`$ECHO "X $new_inherited_linker_flags" | $Xsed -e 's% \([^ $]*\).ltframework% -framework \1%g'`
5971 dependency_libs="$newdependency_libs"
5972 if test "$pass" = dlpreopen; then
5973 # Link the dlpreopened libraries before other libraries
5974 for deplib in $save_deplibs; do
5975 deplibs="$deplib $deplibs"
5976 done
5978 if test "$pass" != dlopen; then
5979 if test "$pass" != conv; then
5980 # Make sure lib_search_path contains only unique directories.
5981 lib_search_path=
5982 for dir in $newlib_search_path; do
5983 case "$lib_search_path " in
5984 *" $dir "*) ;;
5985 *) lib_search_path="$lib_search_path $dir" ;;
5986 esac
5987 done
5988 newlib_search_path=
5991 if test "$linkmode,$pass" != "prog,link"; then
5992 vars="deplibs"
5993 else
5994 vars="compile_deplibs finalize_deplibs"
5996 for var in $vars dependency_libs; do
5997 # Add libraries to $var in reverse order
5998 eval tmp_libs=\"\$$var\"
5999 new_libs=
6000 for deplib in $tmp_libs; do
6001 # FIXME: Pedantically, this is the right thing to do, so
6002 # that some nasty dependency loop isn't accidentally
6003 # broken:
6004 #new_libs="$deplib $new_libs"
6005 # Pragmatically, this seems to cause very few problems in
6006 # practice:
6007 case $deplib in
6008 -L*) new_libs="$deplib $new_libs" ;;
6009 -R*) ;;
6011 # And here is the reason: when a library appears more
6012 # than once as an explicit dependence of a library, or
6013 # is implicitly linked in more than once by the
6014 # compiler, it is considered special, and multiple
6015 # occurrences thereof are not removed. Compare this
6016 # with having the same library being listed as a
6017 # dependency of multiple other libraries: in this case,
6018 # we know (pedantically, we assume) the library does not
6019 # need to be listed more than once, so we keep only the
6020 # last copy. This is not always right, but it is rare
6021 # enough that we require users that really mean to play
6022 # such unportable linking tricks to link the library
6023 # using -Wl,-lname, so that libtool does not consider it
6024 # for duplicate removal.
6025 case " $specialdeplibs " in
6026 *" $deplib "*) new_libs="$deplib $new_libs" ;;
6028 case " $new_libs " in
6029 *" $deplib "*) ;;
6030 *) new_libs="$deplib $new_libs" ;;
6031 esac
6033 esac
6035 esac
6036 done
6037 tmp_libs=
6038 for deplib in $new_libs; do
6039 case $deplib in
6040 -L*)
6041 case " $tmp_libs " in
6042 *" $deplib "*) ;;
6043 *) tmp_libs="$tmp_libs $deplib" ;;
6044 esac
6046 *) tmp_libs="$tmp_libs $deplib" ;;
6047 esac
6048 done
6049 eval $var=\"$tmp_libs\"
6050 done # for var
6052 # Last step: remove runtime libs from dependency_libs
6053 # (they stay in deplibs)
6054 tmp_libs=
6055 for i in $dependency_libs ; do
6056 case " $predeps $postdeps $compiler_lib_search_path " in
6057 *" $i "*)
6058 i=""
6060 esac
6061 if test -n "$i" ; then
6062 tmp_libs="$tmp_libs $i"
6064 done
6065 dependency_libs=$tmp_libs
6066 done # for pass
6067 if test "$linkmode" = prog; then
6068 dlfiles="$newdlfiles"
6070 if test "$linkmode" = prog || test "$linkmode" = lib; then
6071 dlprefiles="$newdlprefiles"
6074 case $linkmode in
6075 oldlib)
6076 if test -n "$dlfiles$dlprefiles" || test "$dlself" != no; then
6077 func_warning "\`-dlopen' is ignored for archives"
6080 case " $deplibs" in
6081 *\ -l* | *\ -L*)
6082 func_warning "\`-l' and \`-L' are ignored for archives" ;;
6083 esac
6085 test -n "$rpath" && \
6086 func_warning "\`-rpath' is ignored for archives"
6088 test -n "$xrpath" && \
6089 func_warning "\`-R' is ignored for archives"
6091 test -n "$vinfo" && \
6092 func_warning "\`-version-info/-version-number' is ignored for archives"
6094 test -n "$release" && \
6095 func_warning "\`-release' is ignored for archives"
6097 test -n "$export_symbols$export_symbols_regex" && \
6098 func_warning "\`-export-symbols' is ignored for archives"
6100 # Now set the variables for building old libraries.
6101 build_libtool_libs=no
6102 oldlibs="$output"
6103 objs="$objs$old_deplibs"
6106 lib)
6107 # Make sure we only generate libraries of the form `libNAME.la'.
6108 case $outputname in
6109 lib*)
6110 func_stripname 'lib' '.la' "$outputname"
6111 name=$func_stripname_result
6112 eval shared_ext=\"$shrext_cmds\"
6113 eval libname=\"$libname_spec\"
6116 test "$module" = no && \
6117 func_fatal_help "libtool library \`$output' must begin with \`lib'"
6119 if test "$need_lib_prefix" != no; then
6120 # Add the "lib" prefix for modules if required
6121 func_stripname '' '.la' "$outputname"
6122 name=$func_stripname_result
6123 eval shared_ext=\"$shrext_cmds\"
6124 eval libname=\"$libname_spec\"
6125 else
6126 func_stripname '' '.la' "$outputname"
6127 libname=$func_stripname_result
6130 esac
6132 if test -n "$objs"; then
6133 if test "$deplibs_check_method" != pass_all; then
6134 func_fatal_error "cannot build libtool library \`$output' from non-libtool objects on this host:$objs"
6135 else
6136 $ECHO
6137 $ECHO "*** Warning: Linking the shared library $output against the non-libtool"
6138 $ECHO "*** objects $objs is not portable!"
6139 libobjs="$libobjs $objs"
6143 test "$dlself" != no && \
6144 func_warning "\`-dlopen self' is ignored for libtool libraries"
6146 set dummy $rpath
6147 shift
6148 test "$#" -gt 1 && \
6149 func_warning "ignoring multiple \`-rpath's for a libtool library"
6151 install_libdir="$1"
6153 oldlibs=
6154 if test -z "$rpath"; then
6155 if test "$build_libtool_libs" = yes; then
6156 # Building a libtool convenience library.
6157 # Some compilers have problems with a `.al' extension so
6158 # convenience libraries should have the same extension an
6159 # archive normally would.
6160 oldlibs="$output_objdir/$libname.$libext $oldlibs"
6161 build_libtool_libs=convenience
6162 build_old_libs=yes
6165 test -n "$vinfo" && \
6166 func_warning "\`-version-info/-version-number' is ignored for convenience libraries"
6168 test -n "$release" && \
6169 func_warning "\`-release' is ignored for convenience libraries"
6170 else
6172 # Parse the version information argument.
6173 save_ifs="$IFS"; IFS=':'
6174 set dummy $vinfo 0 0 0
6175 shift
6176 IFS="$save_ifs"
6178 test -n "$7" && \
6179 func_fatal_help "too many parameters to \`-version-info'"
6181 # convert absolute version numbers to libtool ages
6182 # this retains compatibility with .la files and attempts
6183 # to make the code below a bit more comprehensible
6185 case $vinfo_number in
6186 yes)
6187 number_major="$1"
6188 number_minor="$2"
6189 number_revision="$3"
6191 # There are really only two kinds -- those that
6192 # use the current revision as the major version
6193 # and those that subtract age and use age as
6194 # a minor version. But, then there is irix
6195 # which has an extra 1 added just for fun
6197 case $version_type in
6198 darwin|linux|osf|windows|none)
6199 func_arith $number_major + $number_minor
6200 current=$func_arith_result
6201 age="$number_minor"
6202 revision="$number_revision"
6204 freebsd-aout|freebsd-elf|sunos)
6205 current="$number_major"
6206 revision="$number_minor"
6207 age="0"
6209 irix|nonstopux)
6210 func_arith $number_major + $number_minor
6211 current=$func_arith_result
6212 age="$number_minor"
6213 revision="$number_minor"
6214 lt_irix_increment=no
6216 esac
6219 current="$1"
6220 revision="$2"
6221 age="$3"
6223 esac
6225 # Check that each of the things are valid numbers.
6226 case $current in
6227 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]) ;;
6229 func_error "CURRENT \`$current' must be a nonnegative integer"
6230 func_fatal_error "\`$vinfo' is not valid version information"
6232 esac
6234 case $revision in
6235 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]) ;;
6237 func_error "REVISION \`$revision' must be a nonnegative integer"
6238 func_fatal_error "\`$vinfo' is not valid version information"
6240 esac
6242 case $age in
6243 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]) ;;
6245 func_error "AGE \`$age' must be a nonnegative integer"
6246 func_fatal_error "\`$vinfo' is not valid version information"
6248 esac
6250 if test "$age" -gt "$current"; then
6251 func_error "AGE \`$age' is greater than the current interface number \`$current'"
6252 func_fatal_error "\`$vinfo' is not valid version information"
6255 # Calculate the version variables.
6256 major=
6257 versuffix=
6258 verstring=
6259 case $version_type in
6260 none) ;;
6262 darwin)
6263 # Like Linux, but with the current version available in
6264 # verstring for coding it into the library header
6265 func_arith $current - $age
6266 major=.$func_arith_result
6267 versuffix="$major.$age.$revision"
6268 # Darwin ld doesn't like 0 for these options...
6269 func_arith $current + 1
6270 minor_current=$func_arith_result
6271 xlcverstring="${wl}-compatibility_version ${wl}$minor_current ${wl}-current_version ${wl}$minor_current.$revision"
6272 verstring="-compatibility_version $minor_current -current_version $minor_current.$revision"
6275 freebsd-aout)
6276 major=".$current"
6277 versuffix=".$current.$revision";
6280 freebsd-elf)
6281 major=".$current"
6282 versuffix=".$current"
6285 irix | nonstopux)
6286 if test "X$lt_irix_increment" = "Xno"; then
6287 func_arith $current - $age
6288 else
6289 func_arith $current - $age + 1
6291 major=$func_arith_result
6293 case $version_type in
6294 nonstopux) verstring_prefix=nonstopux ;;
6295 *) verstring_prefix=sgi ;;
6296 esac
6297 verstring="$verstring_prefix$major.$revision"
6299 # Add in all the interfaces that we are compatible with.
6300 loop=$revision
6301 while test "$loop" -ne 0; do
6302 func_arith $revision - $loop
6303 iface=$func_arith_result
6304 func_arith $loop - 1
6305 loop=$func_arith_result
6306 verstring="$verstring_prefix$major.$iface:$verstring"
6307 done
6309 # Before this point, $major must not contain `.'.
6310 major=.$major
6311 versuffix="$major.$revision"
6314 linux)
6315 func_arith $current - $age
6316 major=.$func_arith_result
6317 versuffix="$major.$age.$revision"
6320 osf)
6321 func_arith $current - $age
6322 major=.$func_arith_result
6323 versuffix=".$current.$age.$revision"
6324 verstring="$current.$age.$revision"
6326 # Add in all the interfaces that we are compatible with.
6327 loop=$age
6328 while test "$loop" -ne 0; do
6329 func_arith $current - $loop
6330 iface=$func_arith_result
6331 func_arith $loop - 1
6332 loop=$func_arith_result
6333 verstring="$verstring:${iface}.0"
6334 done
6336 # Make executables depend on our current version.
6337 verstring="$verstring:${current}.0"
6340 qnx)
6341 major=".$current"
6342 versuffix=".$current"
6345 sunos)
6346 major=".$current"
6347 versuffix=".$current.$revision"
6350 windows)
6351 # Use '-' rather than '.', since we only want one
6352 # extension on DOS 8.3 filesystems.
6353 func_arith $current - $age
6354 major=$func_arith_result
6355 versuffix="-$major"
6359 func_fatal_configuration "unknown library version type \`$version_type'"
6361 esac
6363 # Clear the version info if we defaulted, and they specified a release.
6364 if test -z "$vinfo" && test -n "$release"; then
6365 major=
6366 case $version_type in
6367 darwin)
6368 # we can't check for "0.0" in archive_cmds due to quoting
6369 # problems, so we reset it completely
6370 verstring=
6373 verstring="0.0"
6375 esac
6376 if test "$need_version" = no; then
6377 versuffix=
6378 else
6379 versuffix=".0.0"
6383 # Remove version info from name if versioning should be avoided
6384 if test "$avoid_version" = yes && test "$need_version" = no; then
6385 major=
6386 versuffix=
6387 verstring=""
6390 # Check to see if the archive will have undefined symbols.
6391 if test "$allow_undefined" = yes; then
6392 if test "$allow_undefined_flag" = unsupported; then
6393 func_warning "undefined symbols not allowed in $host shared libraries"
6394 build_libtool_libs=no
6395 build_old_libs=yes
6397 else
6398 # Don't allow undefined symbols.
6399 allow_undefined_flag="$no_undefined_flag"
6404 func_generate_dlsyms "$libname" "$libname" "yes"
6405 libobjs="$libobjs $symfileobj"
6406 test "X$libobjs" = "X " && libobjs=
6408 if test "$mode" != relink; then
6409 # Remove our outputs, but don't remove object files since they
6410 # may have been created when compiling PIC objects.
6411 removelist=
6412 tempremovelist=`$ECHO "$output_objdir/*"`
6413 for p in $tempremovelist; do
6414 case $p in
6415 *.$objext | *.gcno)
6417 $output_objdir/$outputname | $output_objdir/$libname.* | $output_objdir/${libname}${release}.*)
6418 if test "X$precious_files_regex" != "X"; then
6419 if $ECHO "$p" | $EGREP -e "$precious_files_regex" >/dev/null 2>&1
6420 then
6421 continue
6424 removelist="$removelist $p"
6426 *) ;;
6427 esac
6428 done
6429 test -n "$removelist" && \
6430 func_show_eval "${RM}r \$removelist"
6433 # Now set the variables for building old libraries.
6434 if test "$build_old_libs" = yes && test "$build_libtool_libs" != convenience ; then
6435 oldlibs="$oldlibs $output_objdir/$libname.$libext"
6437 # Transform .lo files to .o files.
6438 oldobjs="$objs "`$ECHO "X$libobjs" | $SP2NL | $Xsed -e '/\.'${libext}'$/d' -e "$lo2o" | $NL2SP`
6441 # Eliminate all temporary directories.
6442 #for path in $notinst_path; do
6443 # lib_search_path=`$ECHO "X$lib_search_path " | $Xsed -e "s% $path % %g"`
6444 # deplibs=`$ECHO "X$deplibs " | $Xsed -e "s% -L$path % %g"`
6445 # dependency_libs=`$ECHO "X$dependency_libs " | $Xsed -e "s% -L$path % %g"`
6446 #done
6448 if test -n "$xrpath"; then
6449 # If the user specified any rpath flags, then add them.
6450 temp_xrpath=
6451 for libdir in $xrpath; do
6452 temp_xrpath="$temp_xrpath -R$libdir"
6453 case "$finalize_rpath " in
6454 *" $libdir "*) ;;
6455 *) finalize_rpath="$finalize_rpath $libdir" ;;
6456 esac
6457 done
6458 if test "$hardcode_into_libs" != yes || test "$build_old_libs" = yes; then
6459 dependency_libs="$temp_xrpath $dependency_libs"
6463 # Make sure dlfiles contains only unique files that won't be dlpreopened
6464 old_dlfiles="$dlfiles"
6465 dlfiles=
6466 for lib in $old_dlfiles; do
6467 case " $dlprefiles $dlfiles " in
6468 *" $lib "*) ;;
6469 *) dlfiles="$dlfiles $lib" ;;
6470 esac
6471 done
6473 # Make sure dlprefiles contains only unique files
6474 old_dlprefiles="$dlprefiles"
6475 dlprefiles=
6476 for lib in $old_dlprefiles; do
6477 case "$dlprefiles " in
6478 *" $lib "*) ;;
6479 *) dlprefiles="$dlprefiles $lib" ;;
6480 esac
6481 done
6483 if test "$build_libtool_libs" = yes; then
6484 if test -n "$rpath"; then
6485 case $host in
6486 *-*-cygwin* | *-*-mingw* | *-*-pw32* | *-*-os2* | *-*-beos* | *-cegcc*)
6487 # these systems don't actually have a c library (as such)!
6489 *-*-rhapsody* | *-*-darwin1.[012])
6490 # Rhapsody C library is in the System framework
6491 deplibs="$deplibs System.ltframework"
6493 *-*-netbsd*)
6494 # Don't link with libc until the a.out ld.so is fixed.
6496 *-*-openbsd* | *-*-freebsd* | *-*-dragonfly*)
6497 # Do not include libc due to us having libc/libc_r.
6499 *-*-sco3.2v5* | *-*-sco5v6*)
6500 # Causes problems with __ctype
6502 *-*-sysv4.2uw2* | *-*-sysv5* | *-*-unixware* | *-*-OpenUNIX*)
6503 # Compiler inserts libc in the correct place for threads to work
6506 # Add libc to deplibs on all other systems if necessary.
6507 if test "$build_libtool_need_lc" = "yes"; then
6508 deplibs="$deplibs -lc"
6511 esac
6514 # Transform deplibs into only deplibs that can be linked in shared.
6515 name_save=$name
6516 libname_save=$libname
6517 release_save=$release
6518 versuffix_save=$versuffix
6519 major_save=$major
6520 # I'm not sure if I'm treating the release correctly. I think
6521 # release should show up in the -l (ie -lgmp5) so we don't want to
6522 # add it in twice. Is that correct?
6523 release=""
6524 versuffix=""
6525 major=""
6526 newdeplibs=
6527 droppeddeps=no
6528 case $deplibs_check_method in
6529 pass_all)
6530 # Don't check for shared/static. Everything works.
6531 # This might be a little naive. We might want to check
6532 # whether the library exists or not. But this is on
6533 # osf3 & osf4 and I'm not really sure... Just
6534 # implementing what was already the behavior.
6535 newdeplibs=$deplibs
6537 test_compile)
6538 # This code stresses the "libraries are programs" paradigm to its
6539 # limits. Maybe even breaks it. We compile a program, linking it
6540 # against the deplibs as a proxy for the library. Then we can check
6541 # whether they linked in statically or dynamically with ldd.
6542 $opt_dry_run || $RM conftest.c
6543 cat > conftest.c <<EOF
6544 int main() { return 0; }
6546 $opt_dry_run || $RM conftest
6547 if $LTCC $LTCFLAGS -o conftest conftest.c $deplibs; then
6548 ldd_output=`ldd conftest`
6549 for i in $deplibs; do
6550 case $i in
6551 -l*)
6552 func_stripname -l '' "$i"
6553 name=$func_stripname_result
6554 if test "X$allow_libtool_libs_with_static_runtimes" = "Xyes" ; then
6555 case " $predeps $postdeps " in
6556 *" $i "*)
6557 newdeplibs="$newdeplibs $i"
6558 i=""
6560 esac
6562 if test -n "$i" ; then
6563 libname=`eval "\\$ECHO \"$libname_spec\""`
6564 deplib_matches=`eval "\\$ECHO \"$library_names_spec\""`
6565 set dummy $deplib_matches; shift
6566 deplib_match=$1
6567 if test `expr "$ldd_output" : ".*$deplib_match"` -ne 0 ; then
6568 newdeplibs="$newdeplibs $i"
6569 else
6570 droppeddeps=yes
6571 $ECHO
6572 $ECHO "*** Warning: dynamic linker does not accept needed library $i."
6573 $ECHO "*** I have the capability to make that library automatically link in when"
6574 $ECHO "*** you link to this library. But I can only do this if you have a"
6575 $ECHO "*** shared version of the library, which I believe you do not have"
6576 $ECHO "*** because a test_compile did reveal that the linker did not use it for"
6577 $ECHO "*** its dynamic dependency list that programs get resolved with at runtime."
6582 newdeplibs="$newdeplibs $i"
6584 esac
6585 done
6586 else
6587 # Error occurred in the first compile. Let's try to salvage
6588 # the situation: Compile a separate program for each library.
6589 for i in $deplibs; do
6590 case $i in
6591 -l*)
6592 func_stripname -l '' "$i"
6593 name=$func_stripname_result
6594 $opt_dry_run || $RM conftest
6595 if $LTCC $LTCFLAGS -o conftest conftest.c $i; then
6596 ldd_output=`ldd conftest`
6597 if test "X$allow_libtool_libs_with_static_runtimes" = "Xyes" ; then
6598 case " $predeps $postdeps " in
6599 *" $i "*)
6600 newdeplibs="$newdeplibs $i"
6601 i=""
6603 esac
6605 if test -n "$i" ; then
6606 libname=`eval "\\$ECHO \"$libname_spec\""`
6607 deplib_matches=`eval "\\$ECHO \"$library_names_spec\""`
6608 set dummy $deplib_matches; shift
6609 deplib_match=$1
6610 if test `expr "$ldd_output" : ".*$deplib_match"` -ne 0 ; then
6611 newdeplibs="$newdeplibs $i"
6612 else
6613 droppeddeps=yes
6614 $ECHO
6615 $ECHO "*** Warning: dynamic linker does not accept needed library $i."
6616 $ECHO "*** I have the capability to make that library automatically link in when"
6617 $ECHO "*** you link to this library. But I can only do this if you have a"
6618 $ECHO "*** shared version of the library, which you do not appear to have"
6619 $ECHO "*** because a test_compile did reveal that the linker did not use this one"
6620 $ECHO "*** as a dynamic dependency that programs can get resolved with at runtime."
6623 else
6624 droppeddeps=yes
6625 $ECHO
6626 $ECHO "*** Warning! Library $i is needed by this library but I was not able to"
6627 $ECHO "*** make it link in! You will probably need to install it or some"
6628 $ECHO "*** library that it depends on before this library will be fully"
6629 $ECHO "*** functional. Installing it before continuing would be even better."
6633 newdeplibs="$newdeplibs $i"
6635 esac
6636 done
6639 file_magic*)
6640 set dummy $deplibs_check_method; shift
6641 file_magic_regex=`expr "$deplibs_check_method" : "$1 \(.*\)"`
6642 for a_deplib in $deplibs; do
6643 case $a_deplib in
6644 -l*)
6645 func_stripname -l '' "$a_deplib"
6646 name=$func_stripname_result
6647 if test "X$allow_libtool_libs_with_static_runtimes" = "Xyes" ; then
6648 case " $predeps $postdeps " in
6649 *" $a_deplib "*)
6650 newdeplibs="$newdeplibs $a_deplib"
6651 a_deplib=""
6653 esac
6655 if test -n "$a_deplib" ; then
6656 libname=`eval "\\$ECHO \"$libname_spec\""`
6657 for i in $lib_search_path $sys_lib_search_path $shlib_search_path; do
6658 potential_libs=`ls $i/$libname[.-]* 2>/dev/null`
6659 for potent_lib in $potential_libs; do
6660 # Follow soft links.
6661 if ls -lLd "$potent_lib" 2>/dev/null |
6662 $GREP " -> " >/dev/null; then
6663 continue
6665 # The statement above tries to avoid entering an
6666 # endless loop below, in case of cyclic links.
6667 # We might still enter an endless loop, since a link
6668 # loop can be closed while we follow links,
6669 # but so what?
6670 potlib="$potent_lib"
6671 while test -h "$potlib" 2>/dev/null; do
6672 potliblink=`ls -ld $potlib | ${SED} 's/.* -> //'`
6673 case $potliblink in
6674 [\\/]* | [A-Za-z]:[\\/]*) potlib="$potliblink";;
6675 *) potlib=`$ECHO "X$potlib" | $Xsed -e 's,[^/]*$,,'`"$potliblink";;
6676 esac
6677 done
6678 if eval $file_magic_cmd \"\$potlib\" 2>/dev/null |
6679 $SED -e 10q |
6680 $EGREP "$file_magic_regex" > /dev/null; then
6681 newdeplibs="$newdeplibs $a_deplib"
6682 a_deplib=""
6683 break 2
6685 done
6686 done
6688 if test -n "$a_deplib" ; then
6689 droppeddeps=yes
6690 $ECHO
6691 $ECHO "*** Warning: linker path does not have real file for library $a_deplib."
6692 $ECHO "*** I have the capability to make that library automatically link in when"
6693 $ECHO "*** you link to this library. But I can only do this if you have a"
6694 $ECHO "*** shared version of the library, which you do not appear to have"
6695 $ECHO "*** because I did check the linker path looking for a file starting"
6696 if test -z "$potlib" ; then
6697 $ECHO "*** with $libname but no candidates were found. (...for file magic test)"
6698 else
6699 $ECHO "*** with $libname and none of the candidates passed a file format test"
6700 $ECHO "*** using a file magic. Last file checked: $potlib"
6705 # Add a -L argument.
6706 newdeplibs="$newdeplibs $a_deplib"
6708 esac
6709 done # Gone through all deplibs.
6711 match_pattern*)
6712 set dummy $deplibs_check_method; shift
6713 match_pattern_regex=`expr "$deplibs_check_method" : "$1 \(.*\)"`
6714 for a_deplib in $deplibs; do
6715 case $a_deplib in
6716 -l*)
6717 func_stripname -l '' "$a_deplib"
6718 name=$func_stripname_result
6719 if test "X$allow_libtool_libs_with_static_runtimes" = "Xyes" ; then
6720 case " $predeps $postdeps " in
6721 *" $a_deplib "*)
6722 newdeplibs="$newdeplibs $a_deplib"
6723 a_deplib=""
6725 esac
6727 if test -n "$a_deplib" ; then
6728 libname=`eval "\\$ECHO \"$libname_spec\""`
6729 for i in $lib_search_path $sys_lib_search_path $shlib_search_path; do
6730 potential_libs=`ls $i/$libname[.-]* 2>/dev/null`
6731 for potent_lib in $potential_libs; do
6732 potlib="$potent_lib" # see symlink-check above in file_magic test
6733 if eval "\$ECHO \"X$potent_lib\"" 2>/dev/null | $Xsed -e 10q | \
6734 $EGREP "$match_pattern_regex" > /dev/null; then
6735 newdeplibs="$newdeplibs $a_deplib"
6736 a_deplib=""
6737 break 2
6739 done
6740 done
6742 if test -n "$a_deplib" ; then
6743 droppeddeps=yes
6744 $ECHO
6745 $ECHO "*** Warning: linker path does not have real file for library $a_deplib."
6746 $ECHO "*** I have the capability to make that library automatically link in when"
6747 $ECHO "*** you link to this library. But I can only do this if you have a"
6748 $ECHO "*** shared version of the library, which you do not appear to have"
6749 $ECHO "*** because I did check the linker path looking for a file starting"
6750 if test -z "$potlib" ; then
6751 $ECHO "*** with $libname but no candidates were found. (...for regex pattern test)"
6752 else
6753 $ECHO "*** with $libname and none of the candidates passed a file format test"
6754 $ECHO "*** using a regex pattern. Last file checked: $potlib"
6759 # Add a -L argument.
6760 newdeplibs="$newdeplibs $a_deplib"
6762 esac
6763 done # Gone through all deplibs.
6765 none | unknown | *)
6766 newdeplibs=""
6767 tmp_deplibs=`$ECHO "X $deplibs" | $Xsed \
6768 -e 's/ -lc$//' -e 's/ -[LR][^ ]*//g'`
6769 if test "X$allow_libtool_libs_with_static_runtimes" = "Xyes" ; then
6770 for i in $predeps $postdeps ; do
6771 # can't use Xsed below, because $i might contain '/'
6772 tmp_deplibs=`$ECHO "X $tmp_deplibs" | $Xsed -e "s,$i,,"`
6773 done
6775 if $ECHO "X $tmp_deplibs" | $Xsed -e 's/[ ]//g' |
6776 $GREP . >/dev/null; then
6777 $ECHO
6778 if test "X$deplibs_check_method" = "Xnone"; then
6779 $ECHO "*** Warning: inter-library dependencies are not supported in this platform."
6780 else
6781 $ECHO "*** Warning: inter-library dependencies are not known to be supported."
6783 $ECHO "*** All declared inter-library dependencies are being dropped."
6784 droppeddeps=yes
6787 esac
6788 versuffix=$versuffix_save
6789 major=$major_save
6790 release=$release_save
6791 libname=$libname_save
6792 name=$name_save
6794 case $host in
6795 *-*-rhapsody* | *-*-darwin1.[012])
6796 # On Rhapsody replace the C library with the System framework
6797 newdeplibs=`$ECHO "X $newdeplibs" | $Xsed -e 's/ -lc / System.ltframework /'`
6799 esac
6801 if test "$droppeddeps" = yes; then
6802 if test "$module" = yes; then
6803 $ECHO
6804 $ECHO "*** Warning: libtool could not satisfy all declared inter-library"
6805 $ECHO "*** dependencies of module $libname. Therefore, libtool will create"
6806 $ECHO "*** a static module, that should work as long as the dlopening"
6807 $ECHO "*** application is linked with the -dlopen flag."
6808 if test -z "$global_symbol_pipe"; then
6809 $ECHO
6810 $ECHO "*** However, this would only work if libtool was able to extract symbol"
6811 $ECHO "*** lists from a program, using \`nm' or equivalent, but libtool could"
6812 $ECHO "*** not find such a program. So, this module is probably useless."
6813 $ECHO "*** \`nm' from GNU binutils and a full rebuild may help."
6815 if test "$build_old_libs" = no; then
6816 oldlibs="$output_objdir/$libname.$libext"
6817 build_libtool_libs=module
6818 build_old_libs=yes
6819 else
6820 build_libtool_libs=no
6822 else
6823 $ECHO "*** The inter-library dependencies that have been dropped here will be"
6824 $ECHO "*** automatically added whenever a program is linked with this library"
6825 $ECHO "*** or is declared to -dlopen it."
6827 if test "$allow_undefined" = no; then
6828 $ECHO
6829 $ECHO "*** Since this library must not contain undefined symbols,"
6830 $ECHO "*** because either the platform does not support them or"
6831 $ECHO "*** it was explicitly requested with -no-undefined,"
6832 $ECHO "*** libtool will only create a static version of it."
6833 if test "$build_old_libs" = no; then
6834 oldlibs="$output_objdir/$libname.$libext"
6835 build_libtool_libs=module
6836 build_old_libs=yes
6837 else
6838 build_libtool_libs=no
6843 # Done checking deplibs!
6844 deplibs=$newdeplibs
6846 # Time to change all our "foo.ltframework" stuff back to "-framework foo"
6847 case $host in
6848 *-*-darwin*)
6849 newdeplibs=`$ECHO "X $newdeplibs" | $Xsed -e 's% \([^ $]*\).ltframework% -framework \1%g'`
6850 new_inherited_linker_flags=`$ECHO "X $new_inherited_linker_flags" | $Xsed -e 's% \([^ $]*\).ltframework% -framework \1%g'`
6851 deplibs=`$ECHO "X $deplibs" | $Xsed -e 's% \([^ $]*\).ltframework% -framework \1%g'`
6853 esac
6855 # move library search paths that coincide with paths to not yet
6856 # installed libraries to the beginning of the library search list
6857 new_libs=
6858 for path in $notinst_path; do
6859 case " $new_libs " in
6860 *" -L$path/$objdir "*) ;;
6862 case " $deplibs " in
6863 *" -L$path/$objdir "*)
6864 new_libs="$new_libs -L$path/$objdir" ;;
6865 esac
6867 esac
6868 done
6869 for deplib in $deplibs; do
6870 case $deplib in
6871 -L*)
6872 case " $new_libs " in
6873 *" $deplib "*) ;;
6874 *) new_libs="$new_libs $deplib" ;;
6875 esac
6877 *) new_libs="$new_libs $deplib" ;;
6878 esac
6879 done
6880 deplibs="$new_libs"
6882 # All the library-specific variables (install_libdir is set above).
6883 library_names=
6884 old_library=
6885 dlname=
6887 # Test again, we may have decided not to build it any more
6888 if test "$build_libtool_libs" = yes; then
6889 if test "$hardcode_into_libs" = yes; then
6890 # Hardcode the library paths
6891 hardcode_libdirs=
6892 dep_rpath=
6893 rpath="$finalize_rpath"
6894 test "$mode" != relink && rpath="$compile_rpath$rpath"
6895 for libdir in $rpath; do
6896 if test -n "$hardcode_libdir_flag_spec"; then
6897 if test -n "$hardcode_libdir_separator"; then
6898 if test -z "$hardcode_libdirs"; then
6899 hardcode_libdirs="$libdir"
6900 else
6901 # Just accumulate the unique libdirs.
6902 case $hardcode_libdir_separator$hardcode_libdirs$hardcode_libdir_separator in
6903 *"$hardcode_libdir_separator$libdir$hardcode_libdir_separator"*)
6906 hardcode_libdirs="$hardcode_libdirs$hardcode_libdir_separator$libdir"
6908 esac
6910 else
6911 eval flag=\"$hardcode_libdir_flag_spec\"
6912 dep_rpath="$dep_rpath $flag"
6914 elif test -n "$runpath_var"; then
6915 case "$perm_rpath " in
6916 *" $libdir "*) ;;
6917 *) perm_rpath="$perm_rpath $libdir" ;;
6918 esac
6920 done
6921 # Substitute the hardcoded libdirs into the rpath.
6922 if test -n "$hardcode_libdir_separator" &&
6923 test -n "$hardcode_libdirs"; then
6924 libdir="$hardcode_libdirs"
6925 if test -n "$hardcode_libdir_flag_spec_ld"; then
6926 eval dep_rpath=\"$hardcode_libdir_flag_spec_ld\"
6927 else
6928 eval dep_rpath=\"$hardcode_libdir_flag_spec\"
6931 if test -n "$runpath_var" && test -n "$perm_rpath"; then
6932 # We should set the runpath_var.
6933 rpath=
6934 for dir in $perm_rpath; do
6935 rpath="$rpath$dir:"
6936 done
6937 eval "$runpath_var='$rpath\$$runpath_var'; export $runpath_var"
6939 test -n "$dep_rpath" && deplibs="$dep_rpath $deplibs"
6942 shlibpath="$finalize_shlibpath"
6943 test "$mode" != relink && shlibpath="$compile_shlibpath$shlibpath"
6944 if test -n "$shlibpath"; then
6945 eval "$shlibpath_var='$shlibpath\$$shlibpath_var'; export $shlibpath_var"
6948 # Get the real and link names of the library.
6949 eval shared_ext=\"$shrext_cmds\"
6950 eval library_names=\"$library_names_spec\"
6951 set dummy $library_names
6952 shift
6953 realname="$1"
6954 shift
6956 if test -n "$soname_spec"; then
6957 eval soname=\"$soname_spec\"
6958 else
6959 soname="$realname"
6961 if test -z "$dlname"; then
6962 dlname=$soname
6965 lib="$output_objdir/$realname"
6966 linknames=
6967 for link
6969 linknames="$linknames $link"
6970 done
6972 # Use standard objects if they are pic
6973 test -z "$pic_flag" && libobjs=`$ECHO "X$libobjs" | $SP2NL | $Xsed -e "$lo2o" | $NL2SP`
6974 test "X$libobjs" = "X " && libobjs=
6976 delfiles=
6977 if test -n "$export_symbols" && test -n "$include_expsyms"; then
6978 $opt_dry_run || cp "$export_symbols" "$output_objdir/$libname.uexp"
6979 export_symbols="$output_objdir/$libname.uexp"
6980 delfiles="$delfiles $export_symbols"
6983 orig_export_symbols=
6984 case $host_os in
6985 cygwin* | mingw* | cegcc*)
6986 if test -n "$export_symbols" && test -z "$export_symbols_regex"; then
6987 # exporting using user supplied symfile
6988 if test "x`$SED 1q $export_symbols`" != xEXPORTS; then
6989 # and it's NOT already a .def file. Must figure out
6990 # which of the given symbols are data symbols and tag
6991 # them as such. So, trigger use of export_symbols_cmds.
6992 # export_symbols gets reassigned inside the "prepare
6993 # the list of exported symbols" if statement, so the
6994 # include_expsyms logic still works.
6995 orig_export_symbols="$export_symbols"
6996 export_symbols=
6997 always_export_symbols=yes
7001 esac
7003 # Prepare the list of exported symbols
7004 if test -z "$export_symbols"; then
7005 if test "$always_export_symbols" = yes || test -n "$export_symbols_regex"; then
7006 func_verbose "generating symbol list for \`$libname.la'"
7007 export_symbols="$output_objdir/$libname.exp"
7008 $opt_dry_run || $RM $export_symbols
7009 cmds=$export_symbols_cmds
7010 save_ifs="$IFS"; IFS='~'
7011 for cmd in $cmds; do
7012 IFS="$save_ifs"
7013 eval cmd=\"$cmd\"
7014 func_len " $cmd"
7015 len=$func_len_result
7016 if test "$len" -lt "$max_cmd_len" || test "$max_cmd_len" -le -1; then
7017 func_show_eval "$cmd" 'exit $?'
7018 skipped_export=false
7019 else
7020 # The command line is too long to execute in one step.
7021 func_verbose "using reloadable object file for export list..."
7022 skipped_export=:
7023 # Break out early, otherwise skipped_export may be
7024 # set to false by a later but shorter cmd.
7025 break
7027 done
7028 IFS="$save_ifs"
7029 if test -n "$export_symbols_regex" && test "X$skipped_export" != "X:"; then
7030 func_show_eval '$EGREP -e "$export_symbols_regex" "$export_symbols" > "${export_symbols}T"'
7031 func_show_eval '$MV "${export_symbols}T" "$export_symbols"'
7036 if test -n "$export_symbols" && test -n "$include_expsyms"; then
7037 tmp_export_symbols="$export_symbols"
7038 test -n "$orig_export_symbols" && tmp_export_symbols="$orig_export_symbols"
7039 $opt_dry_run || eval '$ECHO "X$include_expsyms" | $Xsed | $SP2NL >> "$tmp_export_symbols"'
7042 if test "X$skipped_export" != "X:" && test -n "$orig_export_symbols"; then
7043 # The given exports_symbols file has to be filtered, so filter it.
7044 func_verbose "filter symbol list for \`$libname.la' to tag DATA exports"
7045 # FIXME: $output_objdir/$libname.filter potentially contains lots of
7046 # 's' commands which not all seds can handle. GNU sed should be fine
7047 # though. Also, the filter scales superlinearly with the number of
7048 # global variables. join(1) would be nice here, but unfortunately
7049 # isn't a blessed tool.
7050 $opt_dry_run || $SED -e '/[ ,]DATA/!d;s,\(.*\)\([ \,].*\),s|^\1$|\1\2|,' < $export_symbols > $output_objdir/$libname.filter
7051 delfiles="$delfiles $export_symbols $output_objdir/$libname.filter"
7052 export_symbols=$output_objdir/$libname.def
7053 $opt_dry_run || $SED -f $output_objdir/$libname.filter < $orig_export_symbols > $export_symbols
7056 tmp_deplibs=
7057 for test_deplib in $deplibs; do
7058 case " $convenience " in
7059 *" $test_deplib "*) ;;
7061 tmp_deplibs="$tmp_deplibs $test_deplib"
7063 esac
7064 done
7065 deplibs="$tmp_deplibs"
7067 if test -n "$convenience"; then
7068 if test -n "$whole_archive_flag_spec" &&
7069 test "$compiler_needs_object" = yes &&
7070 test -z "$libobjs"; then
7071 # extract the archives, so we have objects to list.
7072 # TODO: could optimize this to just extract one archive.
7073 whole_archive_flag_spec=
7075 if test -n "$whole_archive_flag_spec"; then
7076 save_libobjs=$libobjs
7077 eval libobjs=\"\$libobjs $whole_archive_flag_spec\"
7078 test "X$libobjs" = "X " && libobjs=
7079 else
7080 gentop="$output_objdir/${outputname}x"
7081 generated="$generated $gentop"
7083 func_extract_archives $gentop $convenience
7084 libobjs="$libobjs $func_extract_archives_result"
7085 test "X$libobjs" = "X " && libobjs=
7089 if test "$thread_safe" = yes && test -n "$thread_safe_flag_spec"; then
7090 eval flag=\"$thread_safe_flag_spec\"
7091 linker_flags="$linker_flags $flag"
7094 # Make a backup of the uninstalled library when relinking
7095 if test "$mode" = relink; then
7096 $opt_dry_run || eval '(cd $output_objdir && $RM ${realname}U && $MV $realname ${realname}U)' || exit $?
7099 # Do each of the archive commands.
7100 if test "$module" = yes && test -n "$module_cmds" ; then
7101 if test -n "$export_symbols" && test -n "$module_expsym_cmds"; then
7102 eval test_cmds=\"$module_expsym_cmds\"
7103 cmds=$module_expsym_cmds
7104 else
7105 eval test_cmds=\"$module_cmds\"
7106 cmds=$module_cmds
7108 else
7109 if test -n "$export_symbols" && test -n "$archive_expsym_cmds"; then
7110 eval test_cmds=\"$archive_expsym_cmds\"
7111 cmds=$archive_expsym_cmds
7112 else
7113 eval test_cmds=\"$archive_cmds\"
7114 cmds=$archive_cmds
7118 if test "X$skipped_export" != "X:" &&
7119 func_len " $test_cmds" &&
7120 len=$func_len_result &&
7121 test "$len" -lt "$max_cmd_len" || test "$max_cmd_len" -le -1; then
7123 else
7124 # The command line is too long to link in one step, link piecewise
7125 # or, if using GNU ld and skipped_export is not :, use a linker
7126 # script.
7128 # Save the value of $output and $libobjs because we want to
7129 # use them later. If we have whole_archive_flag_spec, we
7130 # want to use save_libobjs as it was before
7131 # whole_archive_flag_spec was expanded, because we can't
7132 # assume the linker understands whole_archive_flag_spec.
7133 # This may have to be revisited, in case too many
7134 # convenience libraries get linked in and end up exceeding
7135 # the spec.
7136 if test -z "$convenience" || test -z "$whole_archive_flag_spec"; then
7137 save_libobjs=$libobjs
7139 save_output=$output
7140 output_la=`$ECHO "X$output" | $Xsed -e "$basename"`
7142 # Clear the reloadable object creation command queue and
7143 # initialize k to one.
7144 test_cmds=
7145 concat_cmds=
7146 objlist=
7147 last_robj=
7150 if test -n "$save_libobjs" && test "X$skipped_export" != "X:" && test "$with_gnu_ld" = yes; then
7151 output=${output_objdir}/${output_la}.lnkscript
7152 func_verbose "creating GNU ld script: $output"
7153 $ECHO 'INPUT (' > $output
7154 for obj in $save_libobjs
7156 $ECHO "$obj" >> $output
7157 done
7158 $ECHO ')' >> $output
7159 delfiles="$delfiles $output"
7160 elif test -n "$save_libobjs" && test "X$skipped_export" != "X:" && test "X$file_list_spec" != X; then
7161 output=${output_objdir}/${output_la}.lnk
7162 func_verbose "creating linker input file list: $output"
7163 : > $output
7164 set x $save_libobjs
7165 shift
7166 firstobj=
7167 if test "$compiler_needs_object" = yes; then
7168 firstobj="$1 "
7169 shift
7171 for obj
7173 $ECHO "$obj" >> $output
7174 done
7175 delfiles="$delfiles $output"
7176 output=$firstobj\"$file_list_spec$output\"
7177 else
7178 if test -n "$save_libobjs"; then
7179 func_verbose "creating reloadable object files..."
7180 output=$output_objdir/$output_la-${k}.$objext
7181 eval test_cmds=\"$reload_cmds\"
7182 func_len " $test_cmds"
7183 len0=$func_len_result
7184 len=$len0
7186 # Loop over the list of objects to be linked.
7187 for obj in $save_libobjs
7189 func_len " $obj"
7190 func_arith $len + $func_len_result
7191 len=$func_arith_result
7192 if test "X$objlist" = X ||
7193 test "$len" -lt "$max_cmd_len"; then
7194 func_append objlist " $obj"
7195 else
7196 # The command $test_cmds is almost too long, add a
7197 # command to the queue.
7198 if test "$k" -eq 1 ; then
7199 # The first file doesn't have a previous command to add.
7200 eval concat_cmds=\"$reload_cmds $objlist $last_robj\"
7201 else
7202 # All subsequent reloadable object files will link in
7203 # the last one created.
7204 eval concat_cmds=\"\$concat_cmds~$reload_cmds $objlist $last_robj~\$RM $last_robj\"
7206 last_robj=$output_objdir/$output_la-${k}.$objext
7207 func_arith $k + 1
7208 k=$func_arith_result
7209 output=$output_objdir/$output_la-${k}.$objext
7210 objlist=$obj
7211 func_len " $last_robj"
7212 func_arith $len0 + $func_len_result
7213 len=$func_arith_result
7215 done
7216 # Handle the remaining objects by creating one last
7217 # reloadable object file. All subsequent reloadable object
7218 # files will link in the last one created.
7219 test -z "$concat_cmds" || concat_cmds=$concat_cmds~
7220 eval concat_cmds=\"\${concat_cmds}$reload_cmds $objlist $last_robj\"
7221 if test -n "$last_robj"; then
7222 eval concat_cmds=\"\${concat_cmds}~\$RM $last_robj\"
7224 delfiles="$delfiles $output"
7226 else
7227 output=
7230 if ${skipped_export-false}; then
7231 func_verbose "generating symbol list for \`$libname.la'"
7232 export_symbols="$output_objdir/$libname.exp"
7233 $opt_dry_run || $RM $export_symbols
7234 libobjs=$output
7235 # Append the command to create the export file.
7236 test -z "$concat_cmds" || concat_cmds=$concat_cmds~
7237 eval concat_cmds=\"\$concat_cmds$export_symbols_cmds\"
7238 if test -n "$last_robj"; then
7239 eval concat_cmds=\"\$concat_cmds~\$RM $last_robj\"
7243 test -n "$save_libobjs" &&
7244 func_verbose "creating a temporary reloadable object file: $output"
7246 # Loop through the commands generated above and execute them.
7247 save_ifs="$IFS"; IFS='~'
7248 for cmd in $concat_cmds; do
7249 IFS="$save_ifs"
7250 $opt_silent || {
7251 func_quote_for_expand "$cmd"
7252 eval "func_echo $func_quote_for_expand_result"
7254 $opt_dry_run || eval "$cmd" || {
7255 lt_exit=$?
7257 # Restore the uninstalled library and exit
7258 if test "$mode" = relink; then
7259 ( cd "$output_objdir" && \
7260 $RM "${realname}T" && \
7261 $MV "${realname}U" "$realname" )
7264 exit $lt_exit
7266 done
7267 IFS="$save_ifs"
7269 if test -n "$export_symbols_regex" && ${skipped_export-false}; then
7270 func_show_eval '$EGREP -e "$export_symbols_regex" "$export_symbols" > "${export_symbols}T"'
7271 func_show_eval '$MV "${export_symbols}T" "$export_symbols"'
7275 if ${skipped_export-false}; then
7276 if test -n "$export_symbols" && test -n "$include_expsyms"; then
7277 tmp_export_symbols="$export_symbols"
7278 test -n "$orig_export_symbols" && tmp_export_symbols="$orig_export_symbols"
7279 $opt_dry_run || eval '$ECHO "X$include_expsyms" | $Xsed | $SP2NL >> "$tmp_export_symbols"'
7282 if test -n "$orig_export_symbols"; then
7283 # The given exports_symbols file has to be filtered, so filter it.
7284 func_verbose "filter symbol list for \`$libname.la' to tag DATA exports"
7285 # FIXME: $output_objdir/$libname.filter potentially contains lots of
7286 # 's' commands which not all seds can handle. GNU sed should be fine
7287 # though. Also, the filter scales superlinearly with the number of
7288 # global variables. join(1) would be nice here, but unfortunately
7289 # isn't a blessed tool.
7290 $opt_dry_run || $SED -e '/[ ,]DATA/!d;s,\(.*\)\([ \,].*\),s|^\1$|\1\2|,' < $export_symbols > $output_objdir/$libname.filter
7291 delfiles="$delfiles $export_symbols $output_objdir/$libname.filter"
7292 export_symbols=$output_objdir/$libname.def
7293 $opt_dry_run || $SED -f $output_objdir/$libname.filter < $orig_export_symbols > $export_symbols
7297 libobjs=$output
7298 # Restore the value of output.
7299 output=$save_output
7301 if test -n "$convenience" && test -n "$whole_archive_flag_spec"; then
7302 eval libobjs=\"\$libobjs $whole_archive_flag_spec\"
7303 test "X$libobjs" = "X " && libobjs=
7305 # Expand the library linking commands again to reset the
7306 # value of $libobjs for piecewise linking.
7308 # Do each of the archive commands.
7309 if test "$module" = yes && test -n "$module_cmds" ; then
7310 if test -n "$export_symbols" && test -n "$module_expsym_cmds"; then
7311 cmds=$module_expsym_cmds
7312 else
7313 cmds=$module_cmds
7315 else
7316 if test -n "$export_symbols" && test -n "$archive_expsym_cmds"; then
7317 cmds=$archive_expsym_cmds
7318 else
7319 cmds=$archive_cmds
7324 if test -n "$delfiles"; then
7325 # Append the command to remove temporary files to $cmds.
7326 eval cmds=\"\$cmds~\$RM $delfiles\"
7329 # Add any objects from preloaded convenience libraries
7330 if test -n "$dlprefiles"; then
7331 gentop="$output_objdir/${outputname}x"
7332 generated="$generated $gentop"
7334 func_extract_archives $gentop $dlprefiles
7335 libobjs="$libobjs $func_extract_archives_result"
7336 test "X$libobjs" = "X " && libobjs=
7339 save_ifs="$IFS"; IFS='~'
7340 for cmd in $cmds; do
7341 IFS="$save_ifs"
7342 eval cmd=\"$cmd\"
7343 $opt_silent || {
7344 func_quote_for_expand "$cmd"
7345 eval "func_echo $func_quote_for_expand_result"
7347 $opt_dry_run || eval "$cmd" || {
7348 lt_exit=$?
7350 # Restore the uninstalled library and exit
7351 if test "$mode" = relink; then
7352 ( cd "$output_objdir" && \
7353 $RM "${realname}T" && \
7354 $MV "${realname}U" "$realname" )
7357 exit $lt_exit
7359 done
7360 IFS="$save_ifs"
7362 # Restore the uninstalled library and exit
7363 if test "$mode" = relink; then
7364 $opt_dry_run || eval '(cd $output_objdir && $RM ${realname}T && $MV $realname ${realname}T && $MV ${realname}U $realname)' || exit $?
7366 if test -n "$convenience"; then
7367 if test -z "$whole_archive_flag_spec"; then
7368 func_show_eval '${RM}r "$gentop"'
7372 exit $EXIT_SUCCESS
7375 # Create links to the real library.
7376 for linkname in $linknames; do
7377 if test "$realname" != "$linkname"; then
7378 func_show_eval '(cd "$output_objdir" && $RM "$linkname" && $LN_S "$realname" "$linkname")' 'exit $?'
7380 done
7382 # If -module or -export-dynamic was specified, set the dlname.
7383 if test "$module" = yes || test "$export_dynamic" = yes; then
7384 # On all known operating systems, these are identical.
7385 dlname="$soname"
7390 obj)
7391 if test -n "$dlfiles$dlprefiles" || test "$dlself" != no; then
7392 func_warning "\`-dlopen' is ignored for objects"
7395 case " $deplibs" in
7396 *\ -l* | *\ -L*)
7397 func_warning "\`-l' and \`-L' are ignored for objects" ;;
7398 esac
7400 test -n "$rpath" && \
7401 func_warning "\`-rpath' is ignored for objects"
7403 test -n "$xrpath" && \
7404 func_warning "\`-R' is ignored for objects"
7406 test -n "$vinfo" && \
7407 func_warning "\`-version-info' is ignored for objects"
7409 test -n "$release" && \
7410 func_warning "\`-release' is ignored for objects"
7412 case $output in
7413 *.lo)
7414 test -n "$objs$old_deplibs" && \
7415 func_fatal_error "cannot build library object \`$output' from non-libtool objects"
7417 libobj=$output
7418 func_lo2o "$libobj"
7419 obj=$func_lo2o_result
7422 libobj=
7423 obj="$output"
7425 esac
7427 # Delete the old objects.
7428 $opt_dry_run || $RM $obj $libobj
7430 # Objects from convenience libraries. This assumes
7431 # single-version convenience libraries. Whenever we create
7432 # different ones for PIC/non-PIC, this we'll have to duplicate
7433 # the extraction.
7434 reload_conv_objs=
7435 gentop=
7436 # reload_cmds runs $LD directly, so let us get rid of
7437 # -Wl from whole_archive_flag_spec and hope we can get by with
7438 # turning comma into space..
7441 if test -n "$convenience"; then
7442 if test -n "$whole_archive_flag_spec"; then
7443 eval tmp_whole_archive_flags=\"$whole_archive_flag_spec\"
7444 reload_conv_objs=$reload_objs\ `$ECHO "X$tmp_whole_archive_flags" | $Xsed -e 's|,| |g'`
7445 else
7446 gentop="$output_objdir/${obj}x"
7447 generated="$generated $gentop"
7449 func_extract_archives $gentop $convenience
7450 reload_conv_objs="$reload_objs $func_extract_archives_result"
7454 # Create the old-style object.
7455 reload_objs="$objs$old_deplibs "`$ECHO "X$libobjs" | $SP2NL | $Xsed -e '/\.'${libext}$'/d' -e '/\.lib$/d' -e "$lo2o" | $NL2SP`" $reload_conv_objs" ### testsuite: skip nested quoting test
7457 output="$obj"
7458 func_execute_cmds "$reload_cmds" 'exit $?'
7460 # Exit if we aren't doing a library object file.
7461 if test -z "$libobj"; then
7462 if test -n "$gentop"; then
7463 func_show_eval '${RM}r "$gentop"'
7466 exit $EXIT_SUCCESS
7469 if test "$build_libtool_libs" != yes; then
7470 if test -n "$gentop"; then
7471 func_show_eval '${RM}r "$gentop"'
7474 # Create an invalid libtool object if no PIC, so that we don't
7475 # accidentally link it into a program.
7476 # $show "echo timestamp > $libobj"
7477 # $opt_dry_run || eval "echo timestamp > $libobj" || exit $?
7478 exit $EXIT_SUCCESS
7481 if test -n "$pic_flag" || test "$pic_mode" != default; then
7482 # Only do commands if we really have different PIC objects.
7483 reload_objs="$libobjs $reload_conv_objs"
7484 output="$libobj"
7485 func_execute_cmds "$reload_cmds" 'exit $?'
7488 if test -n "$gentop"; then
7489 func_show_eval '${RM}r "$gentop"'
7492 exit $EXIT_SUCCESS
7495 prog)
7496 case $host in
7497 *cygwin*) func_stripname '' '.exe' "$output"
7498 output=$func_stripname_result.exe;;
7499 esac
7500 test -n "$vinfo" && \
7501 func_warning "\`-version-info' is ignored for programs"
7503 test -n "$release" && \
7504 func_warning "\`-release' is ignored for programs"
7506 test "$preload" = yes \
7507 && test "$dlopen_support" = unknown \
7508 && test "$dlopen_self" = unknown \
7509 && test "$dlopen_self_static" = unknown && \
7510 func_warning "\`LT_INIT([dlopen])' not used. Assuming no dlopen support."
7512 case $host in
7513 *-*-rhapsody* | *-*-darwin1.[012])
7514 # On Rhapsody replace the C library is the System framework
7515 compile_deplibs=`$ECHO "X $compile_deplibs" | $Xsed -e 's/ -lc / System.ltframework /'`
7516 finalize_deplibs=`$ECHO "X $finalize_deplibs" | $Xsed -e 's/ -lc / System.ltframework /'`
7518 esac
7520 case $host in
7521 *-*-darwin*)
7522 # Don't allow lazy linking, it breaks C++ global constructors
7523 # But is supposedly fixed on 10.4 or later (yay!).
7524 if test "$tagname" = CXX ; then
7525 case ${MACOSX_DEPLOYMENT_TARGET-10.0} in
7526 10.[0123])
7527 compile_command="$compile_command ${wl}-bind_at_load"
7528 finalize_command="$finalize_command ${wl}-bind_at_load"
7530 esac
7532 # Time to change all our "foo.ltframework" stuff back to "-framework foo"
7533 compile_deplibs=`$ECHO "X $compile_deplibs" | $Xsed -e 's% \([^ $]*\).ltframework% -framework \1%g'`
7534 finalize_deplibs=`$ECHO "X $finalize_deplibs" | $Xsed -e 's% \([^ $]*\).ltframework% -framework \1%g'`
7536 esac
7539 # move library search paths that coincide with paths to not yet
7540 # installed libraries to the beginning of the library search list
7541 new_libs=
7542 for path in $notinst_path; do
7543 case " $new_libs " in
7544 *" -L$path/$objdir "*) ;;
7546 case " $compile_deplibs " in
7547 *" -L$path/$objdir "*)
7548 new_libs="$new_libs -L$path/$objdir" ;;
7549 esac
7551 esac
7552 done
7553 for deplib in $compile_deplibs; do
7554 case $deplib in
7555 -L*)
7556 case " $new_libs " in
7557 *" $deplib "*) ;;
7558 *) new_libs="$new_libs $deplib" ;;
7559 esac
7561 *) new_libs="$new_libs $deplib" ;;
7562 esac
7563 done
7564 compile_deplibs="$new_libs"
7567 compile_command="$compile_command $compile_deplibs"
7568 finalize_command="$finalize_command $finalize_deplibs"
7570 if test -n "$rpath$xrpath"; then
7571 # If the user specified any rpath flags, then add them.
7572 for libdir in $rpath $xrpath; do
7573 # This is the magic to use -rpath.
7574 case "$finalize_rpath " in
7575 *" $libdir "*) ;;
7576 *) finalize_rpath="$finalize_rpath $libdir" ;;
7577 esac
7578 done
7581 # Now hardcode the library paths
7582 rpath=
7583 hardcode_libdirs=
7584 for libdir in $compile_rpath $finalize_rpath; do
7585 if test -n "$hardcode_libdir_flag_spec"; then
7586 if test -n "$hardcode_libdir_separator"; then
7587 if test -z "$hardcode_libdirs"; then
7588 hardcode_libdirs="$libdir"
7589 else
7590 # Just accumulate the unique libdirs.
7591 case $hardcode_libdir_separator$hardcode_libdirs$hardcode_libdir_separator in
7592 *"$hardcode_libdir_separator$libdir$hardcode_libdir_separator"*)
7595 hardcode_libdirs="$hardcode_libdirs$hardcode_libdir_separator$libdir"
7597 esac
7599 else
7600 eval flag=\"$hardcode_libdir_flag_spec\"
7601 rpath="$rpath $flag"
7603 elif test -n "$runpath_var"; then
7604 case "$perm_rpath " in
7605 *" $libdir "*) ;;
7606 *) perm_rpath="$perm_rpath $libdir" ;;
7607 esac
7609 case $host in
7610 *-*-cygwin* | *-*-mingw* | *-*-pw32* | *-*-os2* | *-cegcc*)
7611 testbindir=`${ECHO} "$libdir" | ${SED} -e 's*/lib$*/bin*'`
7612 case :$dllsearchpath: in
7613 *":$libdir:"*) ;;
7614 ::) dllsearchpath=$libdir;;
7615 *) dllsearchpath="$dllsearchpath:$libdir";;
7616 esac
7617 case :$dllsearchpath: in
7618 *":$testbindir:"*) ;;
7619 ::) dllsearchpath=$testbindir;;
7620 *) dllsearchpath="$dllsearchpath:$testbindir";;
7621 esac
7623 esac
7624 done
7625 # Substitute the hardcoded libdirs into the rpath.
7626 if test -n "$hardcode_libdir_separator" &&
7627 test -n "$hardcode_libdirs"; then
7628 libdir="$hardcode_libdirs"
7629 eval rpath=\" $hardcode_libdir_flag_spec\"
7631 compile_rpath="$rpath"
7633 rpath=
7634 hardcode_libdirs=
7635 for libdir in $finalize_rpath; do
7636 if test -n "$hardcode_libdir_flag_spec"; then
7637 if test -n "$hardcode_libdir_separator"; then
7638 if test -z "$hardcode_libdirs"; then
7639 hardcode_libdirs="$libdir"
7640 else
7641 # Just accumulate the unique libdirs.
7642 case $hardcode_libdir_separator$hardcode_libdirs$hardcode_libdir_separator in
7643 *"$hardcode_libdir_separator$libdir$hardcode_libdir_separator"*)
7646 hardcode_libdirs="$hardcode_libdirs$hardcode_libdir_separator$libdir"
7648 esac
7650 else
7651 eval flag=\"$hardcode_libdir_flag_spec\"
7652 rpath="$rpath $flag"
7654 elif test -n "$runpath_var"; then
7655 case "$finalize_perm_rpath " in
7656 *" $libdir "*) ;;
7657 *) finalize_perm_rpath="$finalize_perm_rpath $libdir" ;;
7658 esac
7660 done
7661 # Substitute the hardcoded libdirs into the rpath.
7662 if test -n "$hardcode_libdir_separator" &&
7663 test -n "$hardcode_libdirs"; then
7664 libdir="$hardcode_libdirs"
7665 eval rpath=\" $hardcode_libdir_flag_spec\"
7667 finalize_rpath="$rpath"
7669 if test -n "$libobjs" && test "$build_old_libs" = yes; then
7670 # Transform all the library objects into standard objects.
7671 compile_command=`$ECHO "X$compile_command" | $SP2NL | $Xsed -e "$lo2o" | $NL2SP`
7672 finalize_command=`$ECHO "X$finalize_command" | $SP2NL | $Xsed -e "$lo2o" | $NL2SP`
7675 func_generate_dlsyms "$outputname" "@PROGRAM@" "no"
7677 # template prelinking step
7678 if test -n "$prelink_cmds"; then
7679 func_execute_cmds "$prelink_cmds" 'exit $?'
7682 wrappers_required=yes
7683 case $host in
7684 *cygwin* | *mingw* )
7685 if test "$build_libtool_libs" != yes; then
7686 wrappers_required=no
7689 *cegcc)
7690 # Disable wrappers for cegcc, we are cross compiling anyway.
7691 wrappers_required=no
7694 if test "$need_relink" = no || test "$build_libtool_libs" != yes; then
7695 wrappers_required=no
7698 esac
7699 if test "$wrappers_required" = no; then
7700 # Replace the output file specification.
7701 compile_command=`$ECHO "X$compile_command" | $Xsed -e 's%@OUTPUT@%'"$output"'%g'`
7702 link_command="$compile_command$compile_rpath"
7704 # We have no uninstalled library dependencies, so finalize right now.
7705 exit_status=0
7706 func_show_eval "$link_command" 'exit_status=$?'
7708 # Delete the generated files.
7709 if test -f "$output_objdir/${outputname}S.${objext}"; then
7710 func_show_eval '$RM "$output_objdir/${outputname}S.${objext}"'
7713 exit $exit_status
7716 if test -n "$compile_shlibpath$finalize_shlibpath"; then
7717 compile_command="$shlibpath_var=\"$compile_shlibpath$finalize_shlibpath\$$shlibpath_var\" $compile_command"
7719 if test -n "$finalize_shlibpath"; then
7720 finalize_command="$shlibpath_var=\"$finalize_shlibpath\$$shlibpath_var\" $finalize_command"
7723 compile_var=
7724 finalize_var=
7725 if test -n "$runpath_var"; then
7726 if test -n "$perm_rpath"; then
7727 # We should set the runpath_var.
7728 rpath=
7729 for dir in $perm_rpath; do
7730 rpath="$rpath$dir:"
7731 done
7732 compile_var="$runpath_var=\"$rpath\$$runpath_var\" "
7734 if test -n "$finalize_perm_rpath"; then
7735 # We should set the runpath_var.
7736 rpath=
7737 for dir in $finalize_perm_rpath; do
7738 rpath="$rpath$dir:"
7739 done
7740 finalize_var="$runpath_var=\"$rpath\$$runpath_var\" "
7744 if test "$no_install" = yes; then
7745 # We don't need to create a wrapper script.
7746 link_command="$compile_var$compile_command$compile_rpath"
7747 # Replace the output file specification.
7748 link_command=`$ECHO "X$link_command" | $Xsed -e 's%@OUTPUT@%'"$output"'%g'`
7749 # Delete the old output file.
7750 $opt_dry_run || $RM $output
7751 # Link the executable and exit
7752 func_show_eval "$link_command" 'exit $?'
7753 exit $EXIT_SUCCESS
7756 if test "$hardcode_action" = relink; then
7757 # Fast installation is not supported
7758 link_command="$compile_var$compile_command$compile_rpath"
7759 relink_command="$finalize_var$finalize_command$finalize_rpath"
7761 func_warning "this platform does not like uninstalled shared libraries"
7762 func_warning "\`$output' will be relinked during installation"
7763 else
7764 if test "$fast_install" != no; then
7765 link_command="$finalize_var$compile_command$finalize_rpath"
7766 if test "$fast_install" = yes; then
7767 relink_command=`$ECHO "X$compile_var$compile_command$compile_rpath" | $Xsed -e 's%@OUTPUT@%\$progdir/\$file%g'`
7768 else
7769 # fast_install is set to needless
7770 relink_command=
7772 else
7773 link_command="$compile_var$compile_command$compile_rpath"
7774 relink_command="$finalize_var$finalize_command$finalize_rpath"
7778 # Replace the output file specification.
7779 link_command=`$ECHO "X$link_command" | $Xsed -e 's%@OUTPUT@%'"$output_objdir/$outputname"'%g'`
7781 # Delete the old output files.
7782 $opt_dry_run || $RM $output $output_objdir/$outputname $output_objdir/lt-$outputname
7784 func_show_eval "$link_command" 'exit $?'
7786 # Now create the wrapper script.
7787 func_verbose "creating $output"
7789 # Quote the relink command for shipping.
7790 if test -n "$relink_command"; then
7791 # Preserve any variables that may affect compiler behavior
7792 for var in $variables_saved_for_relink; do
7793 if eval test -z \"\${$var+set}\"; then
7794 relink_command="{ test -z \"\${$var+set}\" || $lt_unset $var || { $var=; export $var; }; }; $relink_command"
7795 elif eval var_value=\$$var; test -z "$var_value"; then
7796 relink_command="$var=; export $var; $relink_command"
7797 else
7798 func_quote_for_eval "$var_value"
7799 relink_command="$var=$func_quote_for_eval_result; export $var; $relink_command"
7801 done
7802 relink_command="(cd `pwd`; $relink_command)"
7803 relink_command=`$ECHO "X$relink_command" | $Xsed -e "$sed_quote_subst"`
7806 # Quote $ECHO for shipping.
7807 if test "X$ECHO" = "X$SHELL $progpath --fallback-echo"; then
7808 case $progpath in
7809 [\\/]* | [A-Za-z]:[\\/]*) qecho="$SHELL $progpath --fallback-echo";;
7810 *) qecho="$SHELL `pwd`/$progpath --fallback-echo";;
7811 esac
7812 qecho=`$ECHO "X$qecho" | $Xsed -e "$sed_quote_subst"`
7813 else
7814 qecho=`$ECHO "X$ECHO" | $Xsed -e "$sed_quote_subst"`
7817 # Only actually do things if not in dry run mode.
7818 $opt_dry_run || {
7819 # win32 will think the script is a binary if it has
7820 # a .exe suffix, so we strip it off here.
7821 case $output in
7822 *.exe) func_stripname '' '.exe' "$output"
7823 output=$func_stripname_result ;;
7824 esac
7825 # test for cygwin because mv fails w/o .exe extensions
7826 case $host in
7827 *cygwin*)
7828 exeext=.exe
7829 func_stripname '' '.exe' "$outputname"
7830 outputname=$func_stripname_result ;;
7831 *) exeext= ;;
7832 esac
7833 case $host in
7834 *cygwin* | *mingw* )
7835 func_dirname_and_basename "$output" "" "."
7836 output_name=$func_basename_result
7837 output_path=$func_dirname_result
7838 cwrappersource="$output_path/$objdir/lt-$output_name.c"
7839 cwrapper="$output_path/$output_name.exe"
7840 $RM $cwrappersource $cwrapper
7841 trap "$RM $cwrappersource $cwrapper; exit $EXIT_FAILURE" 1 2 15
7843 func_emit_cwrapperexe_src > $cwrappersource
7845 # The wrapper executable is built using the $host compiler,
7846 # because it contains $host paths and files. If cross-
7847 # compiling, it, like the target executable, must be
7848 # executed on the $host or under an emulation environment.
7849 $opt_dry_run || {
7850 $LTCC $LTCFLAGS -o $cwrapper $cwrappersource
7851 $STRIP $cwrapper
7854 # Now, create the wrapper script for func_source use:
7855 func_ltwrapper_scriptname $cwrapper
7856 $RM $func_ltwrapper_scriptname_result
7857 trap "$RM $func_ltwrapper_scriptname_result; exit $EXIT_FAILURE" 1 2 15
7858 $opt_dry_run || {
7859 # note: this script will not be executed, so do not chmod.
7860 if test "x$build" = "x$host" ; then
7861 $cwrapper --lt-dump-script > $func_ltwrapper_scriptname_result
7862 else
7863 func_emit_wrapper no > $func_ltwrapper_scriptname_result
7868 $RM $output
7869 trap "$RM $output; exit $EXIT_FAILURE" 1 2 15
7871 func_emit_wrapper no > $output
7872 chmod +x $output
7874 esac
7876 exit $EXIT_SUCCESS
7878 esac
7880 # See if we need to build an old-fashioned archive.
7881 for oldlib in $oldlibs; do
7883 if test "$build_libtool_libs" = convenience; then
7884 oldobjs="$libobjs_save $symfileobj"
7885 addlibs="$convenience"
7886 build_libtool_libs=no
7887 else
7888 if test "$build_libtool_libs" = module; then
7889 oldobjs="$libobjs_save"
7890 build_libtool_libs=no
7891 else
7892 oldobjs="$old_deplibs $non_pic_objects"
7893 if test "$preload" = yes && test -f "$symfileobj"; then
7894 oldobjs="$oldobjs $symfileobj"
7897 addlibs="$old_convenience"
7900 if test -n "$addlibs"; then
7901 gentop="$output_objdir/${outputname}x"
7902 generated="$generated $gentop"
7904 func_extract_archives $gentop $addlibs
7905 oldobjs="$oldobjs $func_extract_archives_result"
7908 # Do each command in the archive commands.
7909 if test -n "$old_archive_from_new_cmds" && test "$build_libtool_libs" = yes; then
7910 cmds=$old_archive_from_new_cmds
7911 else
7913 # Add any objects from preloaded convenience libraries
7914 if test -n "$dlprefiles"; then
7915 gentop="$output_objdir/${outputname}x"
7916 generated="$generated $gentop"
7918 func_extract_archives $gentop $dlprefiles
7919 oldobjs="$oldobjs $func_extract_archives_result"
7922 # POSIX demands no paths to be encoded in archives. We have
7923 # to avoid creating archives with duplicate basenames if we
7924 # might have to extract them afterwards, e.g., when creating a
7925 # static archive out of a convenience library, or when linking
7926 # the entirety of a libtool archive into another (currently
7927 # not supported by libtool).
7928 if (for obj in $oldobjs
7930 func_basename "$obj"
7931 $ECHO "$func_basename_result"
7932 done | sort | sort -uc >/dev/null 2>&1); then
7934 else
7935 $ECHO "copying selected object files to avoid basename conflicts..."
7936 gentop="$output_objdir/${outputname}x"
7937 generated="$generated $gentop"
7938 func_mkdir_p "$gentop"
7939 save_oldobjs=$oldobjs
7940 oldobjs=
7941 counter=1
7942 for obj in $save_oldobjs
7944 func_basename "$obj"
7945 objbase="$func_basename_result"
7946 case " $oldobjs " in
7947 " ") oldobjs=$obj ;;
7948 *[\ /]"$objbase "*)
7949 while :; do
7950 # Make sure we don't pick an alternate name that also
7951 # overlaps.
7952 newobj=lt$counter-$objbase
7953 func_arith $counter + 1
7954 counter=$func_arith_result
7955 case " $oldobjs " in
7956 *[\ /]"$newobj "*) ;;
7957 *) if test ! -f "$gentop/$newobj"; then break; fi ;;
7958 esac
7959 done
7960 func_show_eval "ln $obj $gentop/$newobj || cp $obj $gentop/$newobj"
7961 oldobjs="$oldobjs $gentop/$newobj"
7963 *) oldobjs="$oldobjs $obj" ;;
7964 esac
7965 done
7967 eval cmds=\"$old_archive_cmds\"
7969 func_len " $cmds"
7970 len=$func_len_result
7971 if test "$len" -lt "$max_cmd_len" || test "$max_cmd_len" -le -1; then
7972 cmds=$old_archive_cmds
7973 else
7974 # the command line is too long to link in one step, link in parts
7975 func_verbose "using piecewise archive linking..."
7976 save_RANLIB=$RANLIB
7977 RANLIB=:
7978 objlist=
7979 concat_cmds=
7980 save_oldobjs=$oldobjs
7981 oldobjs=
7982 # Is there a better way of finding the last object in the list?
7983 for obj in $save_oldobjs
7985 last_oldobj=$obj
7986 done
7987 eval test_cmds=\"$old_archive_cmds\"
7988 func_len " $test_cmds"
7989 len0=$func_len_result
7990 len=$len0
7991 for obj in $save_oldobjs
7993 func_len " $obj"
7994 func_arith $len + $func_len_result
7995 len=$func_arith_result
7996 func_append objlist " $obj"
7997 if test "$len" -lt "$max_cmd_len"; then
7999 else
8000 # the above command should be used before it gets too long
8001 oldobjs=$objlist
8002 if test "$obj" = "$last_oldobj" ; then
8003 RANLIB=$save_RANLIB
8005 test -z "$concat_cmds" || concat_cmds=$concat_cmds~
8006 eval concat_cmds=\"\${concat_cmds}$old_archive_cmds\"
8007 objlist=
8008 len=$len0
8010 done
8011 RANLIB=$save_RANLIB
8012 oldobjs=$objlist
8013 if test "X$oldobjs" = "X" ; then
8014 eval cmds=\"\$concat_cmds\"
8015 else
8016 eval cmds=\"\$concat_cmds~\$old_archive_cmds\"
8020 func_execute_cmds "$cmds" 'exit $?'
8021 done
8023 test -n "$generated" && \
8024 func_show_eval "${RM}r$generated"
8026 # Now create the libtool archive.
8027 case $output in
8028 *.la)
8029 old_library=
8030 test "$build_old_libs" = yes && old_library="$libname.$libext"
8031 func_verbose "creating $output"
8033 # Preserve any variables that may affect compiler behavior
8034 for var in $variables_saved_for_relink; do
8035 if eval test -z \"\${$var+set}\"; then
8036 relink_command="{ test -z \"\${$var+set}\" || $lt_unset $var || { $var=; export $var; }; }; $relink_command"
8037 elif eval var_value=\$$var; test -z "$var_value"; then
8038 relink_command="$var=; export $var; $relink_command"
8039 else
8040 func_quote_for_eval "$var_value"
8041 relink_command="$var=$func_quote_for_eval_result; export $var; $relink_command"
8043 done
8044 # Quote the link command for shipping.
8045 relink_command="(cd `pwd`; $SHELL $progpath $preserve_args --mode=relink $libtool_args @inst_prefix_dir@)"
8046 relink_command=`$ECHO "X$relink_command" | $Xsed -e "$sed_quote_subst"`
8047 if test "$hardcode_automatic" = yes ; then
8048 relink_command=
8051 # Only create the output if not a dry run.
8052 $opt_dry_run || {
8053 for installed in no yes; do
8054 if test "$installed" = yes; then
8055 if test -z "$install_libdir"; then
8056 break
8058 output="$output_objdir/$outputname"i
8059 # Replace all uninstalled libtool libraries with the installed ones
8060 newdependency_libs=
8061 for deplib in $dependency_libs; do
8062 case $deplib in
8063 *.la)
8064 func_basename "$deplib"
8065 name="$func_basename_result"
8066 eval libdir=`${SED} -n -e 's/^libdir=\(.*\)$/\1/p' $deplib`
8067 test -z "$libdir" && \
8068 func_fatal_error "\`$deplib' is not a valid libtool archive"
8069 if test "x$EGREP" = x ; then
8070 EGREP=egrep
8072 # We do not want portage's install root ($D) present. Check only for
8073 # this if the .la is being installed.
8074 if test "$installed" = yes && test "$D"; then
8075 eval mynewdependency_lib=`echo "$libdir/$name" |sed -e "s:$D:/:g" -e 's:/\+:/:g'`
8076 else
8077 mynewdependency_lib="$libdir/$name"
8079 # Do not add duplicates
8080 if test "$mynewdependency_lib"; then
8081 my_little_ninja_foo_1=`echo $newdependency_libs |$EGREP -e "$mynewdependency_lib"`
8082 if test -z "$my_little_ninja_foo_1"; then
8083 newdependency_libs="$newdependency_libs $mynewdependency_lib"
8088 if test "$installed" = yes; then
8089 # Rather use S=WORKDIR if our version of portage supports it.
8090 # This is because some ebuild (gcc) do not use $S as buildroot.
8091 if test "$PWORKDIR"; then
8092 S="$PWORKDIR"
8094 # We do not want portage's build root ($S) present.
8095 my_little_ninja_foo_2=`echo $deplib |$EGREP -e "$S"`
8096 # We do not want portage's install root ($D) present.
8097 my_little_ninja_foo_3=`echo $deplib |$EGREP -e "$D"`
8098 if test -n "$my_little_ninja_foo_2" && test "$S"; then
8099 mynewdependency_lib=""
8100 elif test -n "$my_little_ninja_foo_3" && test "$D"; then
8101 eval mynewdependency_lib=`echo "$deplib" |sed -e "s:$D:/:g" -e 's:/\+:/:g'`
8102 else
8103 mynewdependency_lib="$deplib"
8105 else
8106 mynewdependency_lib="$deplib"
8108 # Do not add duplicates
8109 if test "$mynewdependency_lib"; then
8110 my_little_ninja_foo_4=`echo $newdependency_libs |$EGREP -e "$mynewdependency_lib"`
8111 if test -z "$my_little_ninja_foo_4"; then
8112 newdependency_libs="$newdependency_libs $mynewdependency_lib"
8116 esac
8117 done
8118 dependency_libs="$newdependency_libs"
8119 newdlfiles=
8121 for lib in $dlfiles; do
8122 case $lib in
8123 *.la)
8124 func_basename "$lib"
8125 name="$func_basename_result"
8126 eval libdir=`${SED} -n -e 's/^libdir=\(.*\)$/\1/p' $lib`
8127 test -z "$libdir" && \
8128 func_fatal_error "\`$lib' is not a valid libtool archive"
8129 newdlfiles="$newdlfiles $libdir/$name"
8131 *) newdlfiles="$newdlfiles $lib" ;;
8132 esac
8133 done
8134 dlfiles="$newdlfiles"
8135 newdlprefiles=
8136 for lib in $dlprefiles; do
8137 case $lib in
8138 *.la)
8139 # Only pass preopened files to the pseudo-archive (for
8140 # eventual linking with the app. that links it) if we
8141 # didn't already link the preopened objects directly into
8142 # the library:
8143 func_basename "$lib"
8144 name="$func_basename_result"
8145 eval libdir=`${SED} -n -e 's/^libdir=\(.*\)$/\1/p' $lib`
8146 test -z "$libdir" && \
8147 func_fatal_error "\`$lib' is not a valid libtool archive"
8148 newdlprefiles="$newdlprefiles $libdir/$name"
8150 esac
8151 done
8152 dlprefiles="$newdlprefiles"
8153 else
8154 newdlfiles=
8155 for lib in $dlfiles; do
8156 case $lib in
8157 [\\/]* | [A-Za-z]:[\\/]*) abs="$lib" ;;
8158 *) abs=`pwd`"/$lib" ;;
8159 esac
8160 newdlfiles="$newdlfiles $abs"
8161 done
8162 dlfiles="$newdlfiles"
8163 newdlprefiles=
8164 for lib in $dlprefiles; do
8165 case $lib in
8166 [\\/]* | [A-Za-z]:[\\/]*) abs="$lib" ;;
8167 *) abs=`pwd`"/$lib" ;;
8168 esac
8169 newdlprefiles="$newdlprefiles $abs"
8170 done
8171 dlprefiles="$newdlprefiles"
8173 $RM $output
8174 # place dlname in correct position for cygwin
8175 tdlname=$dlname
8176 case $host,$output,$installed,$module,$dlname in
8177 *cygwin*,*lai,yes,no,*.dll | *mingw*,*lai,yes,no,*.dll | *cegcc*,*lai,yes,no,*.dll) tdlname=../bin/$dlname ;;
8178 esac
8179 # Do not add duplicates
8180 if test "$installed" = yes && test "$D"; then
8181 install_libdir=`echo "$install_libdir" |sed -e "s:$D:/:g" -e 's:/\+:/:g'`
8183 $ECHO > $output "\
8184 # $outputname - a libtool library file
8185 # Generated by $PROGRAM (GNU $PACKAGE$TIMESTAMP) $VERSION
8187 # Please DO NOT delete this file!
8188 # It is necessary for linking the library.
8190 # The name that we can dlopen(3).
8191 dlname='$tdlname'
8193 # Names of this library.
8194 library_names='$library_names'
8196 # The name of the static archive.
8197 old_library='$old_library'
8199 # Linker flags that can not go in dependency_libs.
8200 inherited_linker_flags='$new_inherited_linker_flags'
8202 # Libraries that this one depends upon.
8203 dependency_libs='$dependency_libs'
8205 # Names of additional weak libraries provided by this library
8206 weak_library_names='$weak_libs'
8208 # Version information for $libname.
8209 current=$current
8210 age=$age
8211 revision=$revision
8213 # Is this an already installed library?
8214 installed=$installed
8216 # Should we warn about portability when linking against -modules?
8217 shouldnotlink=$module
8219 # Files to dlopen/dlpreopen
8220 dlopen='$dlfiles'
8221 dlpreopen='$dlprefiles'
8223 # Directory that this library needs to be installed in:
8224 libdir='$install_libdir'"
8225 if test "$installed" = no && test "$need_relink" = yes; then
8226 $ECHO >> $output "\
8227 relink_command=\"$relink_command\""
8229 done
8232 # Do a symbolic link so that the libtool archive can be found in
8233 # LD_LIBRARY_PATH before the program is installed.
8234 func_show_eval '( cd "$output_objdir" && $RM "$outputname" && $LN_S "../$outputname" "$outputname" )' 'exit $?'
8236 esac
8237 exit $EXIT_SUCCESS
8240 { test "$mode" = link || test "$mode" = relink; } &&
8241 func_mode_link ${1+"$@"}
8244 # func_mode_uninstall arg...
8245 func_mode_uninstall ()
8247 $opt_debug
8248 RM="$nonopt"
8249 files=
8250 rmforce=
8251 exit_status=0
8253 # This variable tells wrapper scripts just to set variables rather
8254 # than running their programs.
8255 libtool_install_magic="$magic"
8257 for arg
8259 case $arg in
8260 -f) RM="$RM $arg"; rmforce=yes ;;
8261 -*) RM="$RM $arg" ;;
8262 *) files="$files $arg" ;;
8263 esac
8264 done
8266 test -z "$RM" && \
8267 func_fatal_help "you must specify an RM program"
8269 rmdirs=
8271 origobjdir="$objdir"
8272 for file in $files; do
8273 func_dirname "$file" "" "."
8274 dir="$func_dirname_result"
8275 if test "X$dir" = X.; then
8276 objdir="$origobjdir"
8277 else
8278 objdir="$dir/$origobjdir"
8280 func_basename "$file"
8281 name="$func_basename_result"
8282 test "$mode" = uninstall && objdir="$dir"
8284 # Remember objdir for removal later, being careful to avoid duplicates
8285 if test "$mode" = clean; then
8286 case " $rmdirs " in
8287 *" $objdir "*) ;;
8288 *) rmdirs="$rmdirs $objdir" ;;
8289 esac
8292 # Don't error if the file doesn't exist and rm -f was used.
8293 if { test -L "$file"; } >/dev/null 2>&1 ||
8294 { test -h "$file"; } >/dev/null 2>&1 ||
8295 test -f "$file"; then
8297 elif test -d "$file"; then
8298 exit_status=1
8299 continue
8300 elif test "$rmforce" = yes; then
8301 continue
8304 rmfiles="$file"
8306 case $name in
8307 *.la)
8308 # Possibly a libtool archive, so verify it.
8309 if func_lalib_p "$file"; then
8310 func_source $dir/$name
8312 # Delete the libtool libraries and symlinks.
8313 for n in $library_names; do
8314 rmfiles="$rmfiles $objdir/$n"
8315 done
8316 test -n "$old_library" && rmfiles="$rmfiles $objdir/$old_library"
8318 case "$mode" in
8319 clean)
8320 case " $library_names " in
8321 # " " in the beginning catches empty $dlname
8322 *" $dlname "*) ;;
8323 *) rmfiles="$rmfiles $objdir/$dlname" ;;
8324 esac
8325 test -n "$libdir" && rmfiles="$rmfiles $objdir/$name $objdir/${name}i"
8327 uninstall)
8328 if test -n "$library_names"; then
8329 # Do each command in the postuninstall commands.
8330 func_execute_cmds "$postuninstall_cmds" 'test "$rmforce" = yes || exit_status=1'
8333 if test -n "$old_library"; then
8334 # Do each command in the old_postuninstall commands.
8335 func_execute_cmds "$old_postuninstall_cmds" 'test "$rmforce" = yes || exit_status=1'
8337 # FIXME: should reinstall the best remaining shared library.
8339 esac
8343 *.lo)
8344 # Possibly a libtool object, so verify it.
8345 if func_lalib_p "$file"; then
8347 # Read the .lo file
8348 func_source $dir/$name
8350 # Add PIC object to the list of files to remove.
8351 if test -n "$pic_object" &&
8352 test "$pic_object" != none; then
8353 rmfiles="$rmfiles $dir/$pic_object"
8356 # Add non-PIC object to the list of files to remove.
8357 if test -n "$non_pic_object" &&
8358 test "$non_pic_object" != none; then
8359 rmfiles="$rmfiles $dir/$non_pic_object"
8365 if test "$mode" = clean ; then
8366 noexename=$name
8367 case $file in
8368 *.exe)
8369 func_stripname '' '.exe' "$file"
8370 file=$func_stripname_result
8371 func_stripname '' '.exe' "$name"
8372 noexename=$func_stripname_result
8373 # $file with .exe has already been added to rmfiles,
8374 # add $file without .exe
8375 rmfiles="$rmfiles $file"
8377 esac
8378 # Do a test to see if this is a libtool program.
8379 if func_ltwrapper_p "$file"; then
8380 if func_ltwrapper_executable_p "$file"; then
8381 func_ltwrapper_scriptname "$file"
8382 relink_command=
8383 func_source $func_ltwrapper_scriptname_result
8384 rmfiles="$rmfiles $func_ltwrapper_scriptname_result"
8385 else
8386 relink_command=
8387 func_source $dir/$noexename
8390 # note $name still contains .exe if it was in $file originally
8391 # as does the version of $file that was added into $rmfiles
8392 rmfiles="$rmfiles $objdir/$name $objdir/${name}S.${objext}"
8393 if test "$fast_install" = yes && test -n "$relink_command"; then
8394 rmfiles="$rmfiles $objdir/lt-$name"
8396 if test "X$noexename" != "X$name" ; then
8397 rmfiles="$rmfiles $objdir/lt-${noexename}.c"
8402 esac
8403 func_show_eval "$RM $rmfiles" 'exit_status=1'
8404 done
8405 objdir="$origobjdir"
8407 # Try to remove the ${objdir}s in the directories where we deleted files
8408 for dir in $rmdirs; do
8409 if test -d "$dir"; then
8410 func_show_eval "rmdir $dir >/dev/null 2>&1"
8412 done
8414 exit $exit_status
8417 { test "$mode" = uninstall || test "$mode" = clean; } &&
8418 func_mode_uninstall ${1+"$@"}
8420 test -z "$mode" && {
8421 help="$generic_help"
8422 func_fatal_help "you must specify a MODE"
8425 test -z "$exec_cmd" && \
8426 func_fatal_help "invalid operation mode \`$mode'"
8428 if test -n "$exec_cmd"; then
8429 eval exec "$exec_cmd"
8430 exit $EXIT_FAILURE
8433 exit $exit_status
8436 # The TAGs below are defined such that we never get into a situation
8437 # in which we disable both kinds of libraries. Given conflicting
8438 # choices, we go for a static library, that is the most portable,
8439 # since we can't tell whether shared libraries were disabled because
8440 # the user asked for that or because the platform doesn't support
8441 # them. This is particularly important on AIX, because we don't
8442 # support having both static and shared libraries enabled at the same
8443 # time on that platform, so we default to a shared-only configuration.
8444 # If a disable-shared tag is given, we'll fallback to a static-only
8445 # configuration. But we'll never go from static-only to shared-only.
8447 # ### BEGIN LIBTOOL TAG CONFIG: disable-shared
8448 build_libtool_libs=no
8449 build_old_libs=yes
8450 # ### END LIBTOOL TAG CONFIG: disable-shared
8452 # ### BEGIN LIBTOOL TAG CONFIG: disable-static
8453 build_old_libs=`case $build_libtool_libs in yes) echo no;; *) echo yes;; esac`
8454 # ### END LIBTOOL TAG CONFIG: disable-static
8456 # Local Variables:
8457 # mode:shell-script
8458 # sh-indentation:2
8459 # End:
8460 # vi:sw=2